From: Andrea Amorese Date: Tue, 25 Jan 2022 16:45:10 +0000 (+0100) Subject: Built motion from commit fbacb665.|2.5.44 X-Git-Url: http://repos.xcallymotion.com/base//%22./banner.jpg/%22?a=commitdiff_plain;h=21e54a00d87e1752236f636d15c613c6f02d9761;p=motion2.git Built motion from commit fbacb665.|2.5.44 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index cc0f6eb..31ce595 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-25T16:25:02.535Z", + "time": "2022-01-25T16:35:33.398Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 0f89e32..5e74143 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-25T16:25:02.535Z", + "time": "2022-01-25T16:35:33.398Z", "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 0551ab8..0b13a8d 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 _0x0560=['VIRTUAL','integration','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x0560,0x95));var _0x0056=function(_0x3ceaf7,_0x39b5f1){_0x3ceaf7=_0x3ceaf7-0x0;var _0x36b204=_0x0560[_0x3ceaf7];return _0x36b204;};'use strict';var Sequelize=require(_0x0056('0x0'));module['exports']={'name':{'type':Sequelize[_0x0056('0x1')],'get':function(_0x1aaf42){return this['getDataValue']('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x0056('0x2'),'motionbar','jscripty',_0x0056('0x3'),_0x0056('0x4'),_0x0056('0x5'),'script']],'msg':_0x0056('0x6')}},'comment':_0x0056('0x6')},'data1':{'type':Sequelize[_0x0056('0x7')](0x1000),'comment':_0x0056('0x8')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x0056('0x9')},'data3':{'type':Sequelize[_0x0056('0x7')](0x1000),'comment':_0x0056('0xa')},'data4':{'type':Sequelize[_0x0056('0x7')](0x1000),'comments':_0x0056('0xb')},'data5':{'type':Sequelize[_0x0056('0x7')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x0056('0x7')],'comments':_0x0056('0xc')},'data7':{'type':Sequelize[_0x0056('0xd')],'comments':_0x0056('0xe')}}; \ No newline at end of file +var _0x2f92=['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]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','VIRTUAL','action','STRING','contactManager','integration','motionbar','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x1ddc97,_0x32dd52){var _0x525ca2=function(_0x460dad){while(--_0x460dad){_0x1ddc97['push'](_0x1ddc97['shift']());}};_0x525ca2(++_0x32dd52);}(_0x2f92,0xe2));var _0x22f9=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x2f92[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0x22f9('0x0'));module['exports']={'name':{'type':Sequelize[_0x22f9('0x1')],'get':function(_0x3f87a){return this['getDataValue'](_0x22f9('0x2'));}},'action':{'type':Sequelize[_0x22f9('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x22f9('0x4'),_0x22f9('0x5'),_0x22f9('0x6'),_0x22f9('0x7'),'urlForward',_0x22f9('0x8'),_0x22f9('0x9'),_0x22f9('0xa')]],'msg':_0x22f9('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x22f9('0x3')](0x1000),'comment':_0x22f9('0xc')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x22f9('0xd')},'data3':{'type':Sequelize[_0x22f9('0x3')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x22f9('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x22f9('0x3')](0x1000),'comments':_0x22f9('0xe')},'data6':{'type':Sequelize[_0x22f9('0x3')],'comments':_0x22f9('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':_0x22f9('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index e3b8a3a..a381441 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 _0x4038=['params','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','stack','name','send','body','Action','find'];(function(_0x5c7e53,_0x174ce5){var _0x1c9af9=function(_0x38895d){while(--_0x38895d){_0x5c7e53['push'](_0x5c7e53['shift']());}};_0x1c9af9(++_0x174ce5);}(_0x4038,0x17b));var _0x8403=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x4038[_0x480bc8];return _0x28c245;};'use strict';var emlformat=require(_0x8403('0x0'));var rimraf=require(_0x8403('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8403('0x2'));var rp=require(_0x8403('0x3'));var moment=require(_0x8403('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8403('0x5'));var path=require(_0x8403('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8403('0x7'));var _=require(_0x8403('0x8'));var squel=require(_0x8403('0x9'));var crypto=require('crypto');var jsforce=require(_0x8403('0xa'));var deskjs=require(_0x8403('0xb'));var toCsv=require(_0x8403('0xc'));var querystring=require('querystring');var Papa=require(_0x8403('0xd'));var Redis=require(_0x8403('0xe'));var authService=require(_0x8403('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8403('0x10'));var hardwareService=require(_0x8403('0x11'));var logger=require('../../config/logger')(_0x8403('0x12'));var utils=require(_0x8403('0x13'));var config=require(_0x8403('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5aefa4,_0x3b1bee){_0x3b1bee=_0x3b1bee||0xcc;return function(_0x74bfa7){if(_0x74bfa7){return _0x5aefa4[_0x8403('0x15')](_0x3b1bee);}return _0x5aefa4[_0x8403('0x16')](_0x3b1bee)[_0x8403('0x17')]();};}function respondWithResult(_0xa6dab1,_0x1447aa){_0x1447aa=_0x1447aa||0xc8;return function(_0xba82f4){if(_0xba82f4){return _0xa6dab1[_0x8403('0x16')](_0x1447aa)[_0x8403('0x18')](_0xba82f4);}};}function respondWithFilteredResult(_0x5e12e7,_0x16e777){return function(_0x10c877){if(_0x10c877){var _0x386143=typeof _0x16e777[_0x8403('0x19')]==='undefined'&&typeof _0x16e777[_0x8403('0x1a')]===_0x8403('0x1b');var _0x41d88f=_0x10c877['count'];var _0x1b23ef=_0x386143?0x0:_0x16e777[_0x8403('0x19')];var _0x1eae46=_0x386143?_0x10c877[_0x8403('0x1c')]:_0x16e777[_0x8403('0x19')]+_0x16e777[_0x8403('0x1a')];var _0x259d21;if(_0x1eae46>=_0x41d88f){_0x1eae46=_0x41d88f;_0x259d21=0xc8;}else{_0x259d21=0xce;}_0x5e12e7['status'](_0x259d21);return _0x5e12e7[_0x8403('0x1d')]('Content-Range',_0x1b23ef+'-'+_0x1eae46+'/'+_0x41d88f)[_0x8403('0x18')](_0x10c877);}return null;};}function patchUpdates(_0x2c1e0f){return function(_0x5296ba){try{jsonpatch['apply'](_0x5296ba,_0x2c1e0f,!![]);}catch(_0x39e818){return BPromise[_0x8403('0x1e')](_0x39e818);}return _0x5296ba[_0x8403('0x1f')]();};}function saveUpdates(_0x298bb8,_0x1b3186){return function(_0x1be091){if(_0x1be091){return _0x1be091[_0x8403('0x20')](_0x298bb8)[_0x8403('0x21')](function(_0x149ad1){return _0x149ad1;});}return null;};}function removeEntity(_0x2c93bc,_0x3b67e3){return function(_0x5eb75b){if(_0x5eb75b){return _0x5eb75b[_0x8403('0x22')]()[_0x8403('0x21')](function(){_0x2c93bc[_0x8403('0x16')](0xcc)[_0x8403('0x17')]();});}};}function handleEntityNotFound(_0x4991ec,_0x4618fe){return function(_0x5bd2b5){if(!_0x5bd2b5){_0x4991ec[_0x8403('0x15')](0x194);}return _0x5bd2b5;};}function handleError(_0x2ddc07,_0x4d0c0d){_0x4d0c0d=_0x4d0c0d||0x1f4;return function(_0x5879ff){logger['error'](_0x5879ff[_0x8403('0x23')]);if(_0x5879ff[_0x8403('0x24')]){delete _0x5879ff[_0x8403('0x24')];}_0x2ddc07[_0x8403('0x16')](_0x4d0c0d)[_0x8403('0x25')](_0x5879ff);};}exports['update']=function(_0x968e98,_0x584bbf){if(_0x968e98[_0x8403('0x26')]['id']){delete _0x968e98['body']['id'];}return db[_0x8403('0x27')][_0x8403('0x28')]({'where':{'id':_0x968e98[_0x8403('0x29')]['id']}})[_0x8403('0x21')](handleEntityNotFound(_0x584bbf,null))[_0x8403('0x21')](saveUpdates(_0x968e98['body'],null))[_0x8403('0x21')](respondWithResult(_0x584bbf,null))['catch'](handleError(_0x584bbf,null));};exports[_0x8403('0x22')]=function(_0x52944a,_0x142a3b){return db[_0x8403('0x27')][_0x8403('0x28')]({'where':{'id':_0x52944a[_0x8403('0x29')]['id']}})[_0x8403('0x21')](handleEntityNotFound(_0x142a3b,null))[_0x8403('0x21')](removeEntity(_0x142a3b,null))['catch'](handleError(_0x142a3b,null));}; \ No newline at end of file +var _0x5911=['undefined','count','set','reject','save','update','then','error','stack','name','send','Action','find','params','body','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit'];(function(_0x470453,_0x905ca6){var _0x46257d=function(_0x1eeb02){while(--_0x1eeb02){_0x470453['push'](_0x470453['shift']());}};_0x46257d(++_0x905ca6);}(_0x5911,0x1e9));var _0x1591=function(_0x3b47bd,_0x122d99){_0x3b47bd=_0x3b47bd-0x0;var _0x1032d9=_0x5911[_0x3b47bd];return _0x1032d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1591('0x0'));var zipdir=require(_0x1591('0x1'));var jsonpatch=require(_0x1591('0x2'));var rp=require('request-promise');var moment=require(_0x1591('0x3'));var BPromise=require(_0x1591('0x4'));var Mustache=require(_0x1591('0x5'));var util=require('util');var path=require(_0x1591('0x6'));var sox=require(_0x1591('0x7'));var csv=require('to-csv');var ejs=require(_0x1591('0x8'));var fs=require('fs');var fs_extra=require(_0x1591('0x9'));var _=require(_0x1591('0xa'));var squel=require(_0x1591('0xb'));var crypto=require('crypto');var jsforce=require(_0x1591('0xc'));var deskjs=require(_0x1591('0xd'));var toCsv=require(_0x1591('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1591('0xf'));var qs=require(_0x1591('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1591('0x11'));var logger=require(_0x1591('0x12'))(_0x1591('0x13'));var utils=require(_0x1591('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1591('0x15'))['db'];function respondWithStatusCode(_0x20568a,_0x271c71){_0x271c71=_0x271c71||0xcc;return function(_0x4e2a13){if(_0x4e2a13){return _0x20568a[_0x1591('0x16')](_0x271c71);}return _0x20568a[_0x1591('0x17')](_0x271c71)[_0x1591('0x18')]();};}function respondWithResult(_0x3ea316,_0x326830){_0x326830=_0x326830||0xc8;return function(_0x4ab7da){if(_0x4ab7da){return _0x3ea316['status'](_0x326830)['json'](_0x4ab7da);}};}function respondWithFilteredResult(_0x2661c2,_0x3557f3){return function(_0x15c5ec){if(_0x15c5ec){var _0xb9a4ac=typeof _0x3557f3[_0x1591('0x19')]==='undefined'&&typeof _0x3557f3[_0x1591('0x1a')]===_0x1591('0x1b');var _0x107ad9=_0x15c5ec['count'];var _0x2ff3df=_0xb9a4ac?0x0:_0x3557f3[_0x1591('0x19')];var _0x320073=_0xb9a4ac?_0x15c5ec[_0x1591('0x1c')]:_0x3557f3[_0x1591('0x19')]+_0x3557f3[_0x1591('0x1a')];var _0xb80b09;if(_0x320073>=_0x107ad9){_0x320073=_0x107ad9;_0xb80b09=0xc8;}else{_0xb80b09=0xce;}_0x2661c2[_0x1591('0x17')](_0xb80b09);return _0x2661c2[_0x1591('0x1d')]('Content-Range',_0x2ff3df+'-'+_0x320073+'/'+_0x107ad9)['json'](_0x15c5ec);}return null;};}function patchUpdates(_0x215945){return function(_0x1c2a17){try{jsonpatch['apply'](_0x1c2a17,_0x215945,!![]);}catch(_0x1839cb){return BPromise[_0x1591('0x1e')](_0x1839cb);}return _0x1c2a17[_0x1591('0x1f')]();};}function saveUpdates(_0x5f2244,_0x48100c){return function(_0x23a1ba){if(_0x23a1ba){return _0x23a1ba[_0x1591('0x20')](_0x5f2244)[_0x1591('0x21')](function(_0x309192){return _0x309192;});}return null;};}function removeEntity(_0x1190a8,_0x57486a){return function(_0x2ecfff){if(_0x2ecfff){return _0x2ecfff['destroy']()[_0x1591('0x21')](function(){_0x1190a8[_0x1591('0x17')](0xcc)[_0x1591('0x18')]();});}};}function handleEntityNotFound(_0x23d1dc,_0xc7ac7e){return function(_0x40d191){if(!_0x40d191){_0x23d1dc[_0x1591('0x16')](0x194);}return _0x40d191;};}function handleError(_0x57599d,_0x494c87){_0x494c87=_0x494c87||0x1f4;return function(_0x2b4509){logger[_0x1591('0x22')](_0x2b4509[_0x1591('0x23')]);if(_0x2b4509['name']){delete _0x2b4509[_0x1591('0x24')];}_0x57599d[_0x1591('0x17')](_0x494c87)[_0x1591('0x25')](_0x2b4509);};}exports[_0x1591('0x20')]=function(_0x174e28,_0x141469){if(_0x174e28['body']['id']){delete _0x174e28['body']['id'];}return db[_0x1591('0x26')][_0x1591('0x27')]({'where':{'id':_0x174e28[_0x1591('0x28')]['id']}})[_0x1591('0x21')](handleEntityNotFound(_0x141469,null))['then'](saveUpdates(_0x174e28[_0x1591('0x29')],null))[_0x1591('0x21')](respondWithResult(_0x141469,null))['catch'](handleError(_0x141469,null));};exports['destroy']=function(_0x3e1ab9,_0x8256ec){return db['Action']['find']({'where':{'id':_0x3e1ab9[_0x1591('0x28')]['id']}})[_0x1591('0x21')](handleEntityNotFound(_0x8256ec,null))[_0x1591('0x21')](removeEntity(_0x8256ec,null))[_0x1591('0x2a')](handleError(_0x8256ec,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 643b82b..9204881 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 _0x835a=['request-promise','../../config/environment','./action.attributes','exports','define','Action','../../config/logger','api','moment'];(function(_0xb38bba,_0x257536){var _0x1b0e04=function(_0x32e08a){while(--_0x32e08a){_0xb38bba['push'](_0xb38bba['shift']());}};_0x1b0e04(++_0x257536);}(_0x835a,0x8d));var _0xa835=function(_0x7045fb,_0x3ba5a9){_0x7045fb=_0x7045fb-0x0;var _0x47f303=_0x835a[_0x7045fb];return _0x47f303;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa835('0x0'))(_0xa835('0x1'));var moment=require(_0xa835('0x2'));var BPromise=require('bluebird');var rp=require(_0xa835('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa835('0x4'));var attributes=require(_0xa835('0x5'));module[_0xa835('0x6')]=function(_0x1c5e35,_0x3cf4b1){return _0x1c5e35[_0xa835('0x7')](_0xa835('0x8'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0239=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./action.attributes','exports','define','tools_actions','lodash'];(function(_0x8cb2f9,_0x2b8706){var _0x164887=function(_0x1812cc){while(--_0x1812cc){_0x8cb2f9['push'](_0x8cb2f9['shift']());}};_0x164887(++_0x2b8706);}(_0x0239,0x8f));var _0x9023=function(_0xb93e37,_0x3643bf){_0xb93e37=_0xb93e37-0x0;var _0x275cad=_0x0239[_0xb93e37];return _0x275cad;};'use strict';var _=require(_0x9023('0x0'));var util=require('util');var logger=require(_0x9023('0x1'))(_0x9023('0x2'));var moment=require(_0x9023('0x3'));var BPromise=require(_0x9023('0x4'));var rp=require(_0x9023('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9023('0x6'));var config=require(_0x9023('0x7'));var attributes=require(_0x9023('0x8'));module[_0x9023('0x9')]=function(_0x5c973b,_0x4785f3){return _0x5c973b[_0x9023('0xa')]('Action',attributes,{'tableName':_0x9023('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 7c1d56e..5723a79 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 _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x53ec,0x192));var _0xc53e=function(_0x2de66b,_0x33ae0c){_0x2de66b=_0x2de66b-0x0;var _0x19c1ea=_0x53ec[_0x2de66b];return _0x19c1ea;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x1cb9,0x14e));var _0x91cb=function(_0x481ccf,_0x4c1878){_0x481ccf=_0x481ccf-0x0;var _0x2be0ba=_0x1cb9[_0x481ccf];return _0x2be0ba;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 8eb02a4..7ed522a 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 _0x92b4=['fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update','destroy','exports','multer','util','Router'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x92b4,0x169));var _0x492b=function(_0x10d6a3,_0x4a5ee9){_0x10d6a3=_0x10d6a3-0x0;var _0x41d998=_0x92b4[_0x10d6a3];return _0x41d998;};'use strict';var multer=require(_0x492b('0x0'));var util=require(_0x492b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x492b('0x2')]();var fs_extra=require(_0x492b('0x3'));var auth=require(_0x492b('0x4'));var interaction=require(_0x492b('0x5'));var config=require('../../config/environment');var controller=require(_0x492b('0x6'));router[_0x492b('0x7')](_0x492b('0x8'),auth[_0x492b('0x9')](),controller[_0x492b('0xa')]);router['delete'](_0x492b('0x8'),auth[_0x492b('0x9')](),controller[_0x492b('0xb')]);module[_0x492b('0xc')]=router; \ No newline at end of file +var _0x5fd3=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller'];(function(_0x592d48,_0x23f1ba){var _0x5d789e=function(_0x156900){while(--_0x156900){_0x592d48['push'](_0x592d48['shift']());}};_0x5d789e(++_0x23f1ba);}(_0x5fd3,0x15f));var _0x35fd=function(_0x2bee74,_0x283a27){_0x2bee74=_0x2bee74-0x0;var _0x167c55=_0x5fd3[_0x2bee74];return _0x167c55;};'use strict';var multer=require(_0x35fd('0x0'));var util=require(_0x35fd('0x1'));var path=require(_0x35fd('0x2'));var timeout=require(_0x35fd('0x3'));var express=require('express');var router=express[_0x35fd('0x4')]();var fs_extra=require(_0x35fd('0x5'));var auth=require(_0x35fd('0x6'));var interaction=require(_0x35fd('0x7'));var config=require('../../config/environment');var controller=require(_0x35fd('0x8'));router['put'](_0x35fd('0x9'),auth[_0x35fd('0xa')](),controller[_0x35fd('0xb')]);router[_0x35fd('0xc')]('/:id',auth[_0x35fd('0xa')](),controller[_0x35fd('0xd')]);module[_0x35fd('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index ab30723..82a41e3 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 _0xda19=['exports','STRING','TEXT'];(function(_0x565418,_0x5787b7){var _0x565d9b=function(_0x41e1f6){while(--_0x41e1f6){_0x565418['push'](_0x565418['shift']());}};_0x565d9b(++_0x5787b7);}(_0xda19,0xd5));var _0x9da1=function(_0x493bcc,_0x3e9066){_0x493bcc=_0x493bcc-0x0;var _0x51ddd9=_0xda19[_0x493bcc];return _0x51ddd9;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x038b=['exports','STRING','TEXT'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x038b,0x114));var _0xb038=function(_0x12d940,_0x44067b){_0x12d940=_0x12d940-0x0;var _0x38faca=_0x038b[_0x12d940];return _0x38faca;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'name':{'type':Sequelize[_0xb038('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb038('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb038('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb038('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 5be49f9..946a131 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 _0x6abc=['to-csv','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','json','reject','save','update','then','get','CustomReports','UserProfileResource','destroy','sendStatus','error','name','send','index','map','AnalyticCustomReport','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','options','include','catch','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','format','replace','order','orderBy','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','SEC_TO_TIME(%s)','IS\x20EMPTY','value','Sequelize','AnalyticMetric','select','groupBy','DESC','alias','parentKey','output','web','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','cross_join','SUM(%s)','ROUND(%s)','findAll','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x59342a,_0x16827b){var _0x17abc9=function(_0x2f7bfc){while(--_0x2f7bfc){_0x59342a['push'](_0x59342a['shift']());}};_0x17abc9(++_0x16827b);}(_0x6abc,0x9c));var _0xc6ab=function(_0x392ca2,_0x2ddc48){_0x392ca2=_0x392ca2-0x0;var _0x582879=_0x6abc[_0x392ca2];return _0x582879;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6ab('0x0'));var zipdir=require(_0xc6ab('0x1'));var jsonpatch=require(_0xc6ab('0x2'));var rp=require(_0xc6ab('0x3'));var moment=require(_0xc6ab('0x4'));var BPromise=require(_0xc6ab('0x5'));var Mustache=require(_0xc6ab('0x6'));var util=require(_0xc6ab('0x7'));var path=require(_0xc6ab('0x8'));var sox=require(_0xc6ab('0x9'));var csv=require(_0xc6ab('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc6ab('0xb'));var crypto=require('crypto');var jsforce=require(_0xc6ab('0xc'));var deskjs=require(_0xc6ab('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc6ab('0xe'));var Redis=require('ioredis');var authService=require(_0xc6ab('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc6ab('0x10'));var hardwareService=require(_0xc6ab('0x11'));var logger=require(_0xc6ab('0x12'))(_0xc6ab('0x13'));var utils=require('../../config/utils');var config=require(_0xc6ab('0x14'));var licenseUtil=require(_0xc6ab('0x15'));var db=require(_0xc6ab('0x16'))['db'];var dbH=require(_0xc6ab('0x16'))['dbH'];function respondWithStatusCode(_0x19062c,_0x194516){_0x194516=_0x194516||0xcc;return function(_0x217cb7){if(_0x217cb7){return _0x19062c['sendStatus'](_0x194516);}return _0x19062c[_0xc6ab('0x17')](_0x194516)[_0xc6ab('0x18')]();};}function respondWithResult(_0x216768,_0x3693de){_0x3693de=_0x3693de||0xc8;return function(_0x326c18){if(_0x326c18){return _0x216768['status'](_0x3693de)['json'](_0x326c18);}};}function respondWithFilteredResult(_0x3783de,_0x430856){return function(_0x35cb47){if(_0x35cb47){var _0x584de1=typeof _0x430856[_0xc6ab('0x19')]==='undefined'&&typeof _0x430856[_0xc6ab('0x1a')]===_0xc6ab('0x1b');var _0x311c4d=_0x35cb47[_0xc6ab('0x1c')];var _0x4cdd7b=_0x584de1?0x0:_0x430856[_0xc6ab('0x19')];var _0x31ad98=_0x584de1?_0x35cb47[_0xc6ab('0x1c')]:_0x430856[_0xc6ab('0x19')]+_0x430856['limit'];var _0x10c357;if(_0x31ad98>=_0x311c4d){_0x31ad98=_0x311c4d;_0x10c357=0xc8;}else{_0x10c357=0xce;}_0x3783de[_0xc6ab('0x17')](_0x10c357);return _0x3783de[_0xc6ab('0x1d')]('Content-Range',_0x4cdd7b+'-'+_0x31ad98+'/'+_0x311c4d)[_0xc6ab('0x1e')](_0x35cb47);}return null;};}function patchUpdates(_0x524776){return function(_0x2b1953){try{jsonpatch['apply'](_0x2b1953,_0x524776,!![]);}catch(_0x5db49f){return BPromise[_0xc6ab('0x1f')](_0x5db49f);}return _0x2b1953[_0xc6ab('0x20')]();};}function saveUpdates(_0x111d20,_0x1181cd){return function(_0x3caae5){if(_0x3caae5){return _0x3caae5[_0xc6ab('0x21')](_0x111d20)[_0xc6ab('0x22')](function(_0x4ad8ec){return _0x4ad8ec;});}return null;};}function removeEntity(_0x1e4456,_0x197e85){return function(_0x55e516){if(_0x55e516){return _0x55e516['destroy']()['then'](function(){var _0x42506e=_0x55e516[_0xc6ab('0x23')]({'plain':!![]});var _0x436949=_0xc6ab('0x24');return db[_0xc6ab('0x25')][_0xc6ab('0x26')]({'where':{'type':_0x436949,'resourceId':_0x42506e['id']}})[_0xc6ab('0x22')](function(){return _0x55e516;});})['then'](function(){_0x1e4456[_0xc6ab('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f94c6,_0x5e709e){return function(_0x46aaea){if(!_0x46aaea){_0x4f94c6[_0xc6ab('0x27')](0x194);}return _0x46aaea;};}function handleError(_0x36f26a,_0x244a53){_0x244a53=_0x244a53||0x1f4;return function(_0x554a7b){logger[_0xc6ab('0x28')](_0x554a7b['stack']);if(_0x554a7b['name']){delete _0x554a7b[_0xc6ab('0x29')];}_0x36f26a[_0xc6ab('0x17')](_0x244a53)[_0xc6ab('0x2a')](_0x554a7b);};}exports[_0xc6ab('0x2b')]=function(_0x5392be,_0x798218){var _0xe2a24c={},_0x6c6cdb={},_0x1dc432={'count':0x0,'rows':[]};var _0x9cf258=_[_0xc6ab('0x2c')](db[_0xc6ab('0x2d')]['rawAttributes'],function(_0x3ec622){return{'name':_0x3ec622['fieldName'],'type':_0x3ec622[_0xc6ab('0x2e')][_0xc6ab('0x2f')]};});_0x6c6cdb[_0xc6ab('0x30')]=_[_0xc6ab('0x2c')](_0x9cf258,'name');_0x6c6cdb[_0xc6ab('0x31')]=_[_0xc6ab('0x32')](_0x5392be[_0xc6ab('0x31')]);_0x6c6cdb['filters']=_[_0xc6ab('0x33')](_0x6c6cdb[_0xc6ab('0x30')],_0x6c6cdb['query']);_0xe2a24c['attributes']=_[_0xc6ab('0x33')](_0x6c6cdb[_0xc6ab('0x30')],qs[_0xc6ab('0x34')](_0x5392be[_0xc6ab('0x31')]['fields']));_0xe2a24c[_0xc6ab('0x35')]=_0xe2a24c[_0xc6ab('0x35')][_0xc6ab('0x36')]?_0xe2a24c['attributes']:_0x6c6cdb[_0xc6ab('0x30')];if(!_0x5392be[_0xc6ab('0x31')][_0xc6ab('0x37')](_0xc6ab('0x38'))){_0xe2a24c[_0xc6ab('0x1a')]=qs[_0xc6ab('0x1a')](_0x5392be[_0xc6ab('0x31')][_0xc6ab('0x1a')]);_0xe2a24c[_0xc6ab('0x19')]=qs[_0xc6ab('0x19')](_0x5392be['query'][_0xc6ab('0x19')]);}_0xe2a24c['order']=qs[_0xc6ab('0x39')](_0x5392be[_0xc6ab('0x31')][_0xc6ab('0x39')]);_0xe2a24c['where']=qs['filters'](_[_0xc6ab('0x3a')](_0x5392be['query'],_0x6c6cdb[_0xc6ab('0x3b')]),_0x9cf258);if(_0x5392be[_0xc6ab('0x31')][_0xc6ab('0x3c')]){_0xe2a24c[_0xc6ab('0x3d')]=_[_0xc6ab('0x3e')](_0xe2a24c[_0xc6ab('0x3d')],{'$or':_[_0xc6ab('0x2c')](_0x9cf258,function(_0x216f89){if(_0x216f89[_0xc6ab('0x2e')]!==_0xc6ab('0x3f')){var _0xe972e0={};_0xe972e0[_0x216f89[_0xc6ab('0x29')]]={'$like':'%'+_0x5392be[_0xc6ab('0x31')]['filter']+'%'};return _0xe972e0;}})});}_0xe2a24c=_[_0xc6ab('0x3e')]({},_0xe2a24c,_0x5392be[_0xc6ab('0x40')]);var _0x34e84e={'where':_0xe2a24c['where']};return db[_0xc6ab('0x2d')][_0xc6ab('0x1c')](_0x34e84e)['then'](function(_0x1f6fd2){_0x1dc432[_0xc6ab('0x1c')]=_0x1f6fd2;if(_0x5392be['query']['includeAll']){_0xe2a24c[_0xc6ab('0x41')]=[{'all':!![]}];}return db[_0xc6ab('0x2d')]['findAll'](_0xe2a24c);})[_0xc6ab('0x22')](function(_0x2d9ef6){_0x1dc432['rows']=_0x2d9ef6;return _0x1dc432;})['then'](respondWithFilteredResult(_0x798218,_0xe2a24c))[_0xc6ab('0x42')](handleError(_0x798218,null));};exports[_0xc6ab('0x43')]=function(_0x4379f1,_0x531391){var _0x235674={'raw':![],'where':{'id':_0x4379f1[_0xc6ab('0x44')]['id']}},_0x4a45c5={};_0x4a45c5[_0xc6ab('0x30')]=_['keys'](db[_0xc6ab('0x2d')][_0xc6ab('0x45')]);_0x4a45c5['query']=_[_0xc6ab('0x32')](_0x4379f1[_0xc6ab('0x31')]);_0x4a45c5['filters']=_[_0xc6ab('0x33')](_0x4a45c5[_0xc6ab('0x30')],_0x4a45c5['query']);_0x235674[_0xc6ab('0x35')]=_[_0xc6ab('0x33')](_0x4a45c5[_0xc6ab('0x30')],qs['fields'](_0x4379f1[_0xc6ab('0x31')][_0xc6ab('0x34')]));_0x235674[_0xc6ab('0x35')]=_0x235674[_0xc6ab('0x35')]['length']?_0x235674[_0xc6ab('0x35')]:_0x4a45c5[_0xc6ab('0x30')];if(_0x4379f1['query'][_0xc6ab('0x46')]){_0x235674[_0xc6ab('0x41')]=[{'all':!![]}];}_0x235674=_['merge']({},_0x235674,_0x4379f1[_0xc6ab('0x40')]);return db[_0xc6ab('0x2d')][_0xc6ab('0x47')](_0x235674)['then'](handleEntityNotFound(_0x531391,null))[_0xc6ab('0x22')](respondWithResult(_0x531391,null))['catch'](handleError(_0x531391,null));};exports['create']=function(_0x4d60bb,_0x4b3e8e){return db[_0xc6ab('0x2d')][_0xc6ab('0x48')](_0x4d60bb[_0xc6ab('0x49')],{})[_0xc6ab('0x22')](function(_0x37d12f){var _0xc4186a=_0x4d60bb[_0xc6ab('0x4a')]['get']({'plain':!![]});if(!_0xc4186a)throw new Error(_0xc6ab('0x4b'));if(_0xc4186a[_0xc6ab('0x4c')]==='user'){var _0x966806=_0x37d12f[_0xc6ab('0x23')]({'plain':!![]});var _0x4ac054=_0xc6ab('0x4d');return db[_0xc6ab('0x4e')][_0xc6ab('0x47')]({'where':{'name':_0x4ac054,'userProfileId':_0xc4186a[_0xc6ab('0x4f')]},'raw':!![]})['then'](function(_0x4624a1){if(_0x4624a1&&_0x4624a1[_0xc6ab('0x50')]===0x0){return db[_0xc6ab('0x25')][_0xc6ab('0x48')]({'name':_0x966806['name'],'resourceId':_0x966806['id'],'type':_0xc6ab('0x24'),'sectionId':_0x4624a1['id']},{})[_0xc6ab('0x22')](function(){return _0x37d12f;});}else{return _0x37d12f;}})['catch'](function(_0x350c0b){logger[_0xc6ab('0x28')](_0xc6ab('0x51'),_0x350c0b);throw _0x350c0b;});}return _0x37d12f;})[_0xc6ab('0x22')](respondWithResult(_0x4b3e8e,0xc9))[_0xc6ab('0x42')](handleError(_0x4b3e8e,null));};exports[_0xc6ab('0x21')]=function(_0x51eae3,_0x2bc6f2){if(_0x51eae3['body']['id']){delete _0x51eae3[_0xc6ab('0x49')]['id'];}return db[_0xc6ab('0x2d')][_0xc6ab('0x47')]({'where':{'id':_0x51eae3[_0xc6ab('0x44')]['id']}})[_0xc6ab('0x22')](handleEntityNotFound(_0x2bc6f2,null))[_0xc6ab('0x22')](saveUpdates(_0x51eae3[_0xc6ab('0x49')],null))[_0xc6ab('0x22')](respondWithResult(_0x2bc6f2,null))[_0xc6ab('0x42')](handleError(_0x2bc6f2,null));};exports[_0xc6ab('0x26')]=function(_0x39585c,_0x5f2d9e){return db[_0xc6ab('0x2d')][_0xc6ab('0x47')]({'where':{'id':_0x39585c[_0xc6ab('0x44')]['id']}})['then'](handleEntityNotFound(_0x5f2d9e,null))[_0xc6ab('0x22')](removeEntity(_0x5f2d9e,null))[_0xc6ab('0x42')](handleError(_0x5f2d9e,null));};exports[_0xc6ab('0x52')]=function(_0x2b9c2c,_0x49cd71){var _0x5a75f6=0xa;var _0x22e541=[_0xc6ab('0x53'),_0xc6ab('0x54'),_0xc6ab('0x55'),'cross_join'];var _0x380236={'SUM':'SUM(%s)','COUNT':_0xc6ab('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xc6ab('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xc6ab('0x58'),'GROUP_CONCAT ASC':_0xc6ab('0x59'),'GROUP_CONCAT DESC':_0xc6ab('0x5a')};var _0x892d8f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xc6ab('0x5b'),'HOUR':_0xc6ab('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc6ab('0x5d')};var _0x1695ab=function(_0x57ccd9){return!_[_0xc6ab('0x5e')]([_0xc6ab('0x5f'),_0xc6ab('0x60'),'IS\x20EMPTY',_0xc6ab('0x61')],_0x57ccd9);};var _0x1c4841=function(_0x49cacb){if(!_0x49cacb||!_0x49cacb[_0xc6ab('0x62')]['length']){return'';}for(var _0xbb5d71='(',_0x366035=0x0;_0x366035<_0x49cacb[_0xc6ab('0x62')][_0xc6ab('0x36')];_0x366035+=0x1){_0x366035>0x0&&(_0xbb5d71+='\x20'+_0x49cacb[_0xc6ab('0x63')]+'\x20');_0xbb5d71+=_0x49cacb[_0xc6ab('0x62')][_0x366035][_0xc6ab('0x64')]?_0x1c4841(_0x49cacb[_0xc6ab('0x62')][_0x366035][_0xc6ab('0x64')]):_0x49cacb[_0xc6ab('0x62')][_0x366035][_0xc6ab('0x65')]+'\x20'+_0x49cacb['rules'][_0x366035]['condition']+(_0x1695ab(_0x49cacb[_0xc6ab('0x62')][_0x366035][_0xc6ab('0x66')])?'\x20'+_0x49cacb[_0xc6ab('0x62')][_0x366035]['value']:'');}return _0xbb5d71+')';};var _0xfe7b25={'where':{'id':_0x2b9c2c[_0xc6ab('0x44')]['id']}},_0x806072,_0x46b876,_0x5ba3de,_0x555e91,_0x178a88;_0xfe7b25=_[_0xc6ab('0x3e')]({},_0xfe7b25,_0x2b9c2c['options']);return db[_0xc6ab('0x2d')][_0xc6ab('0x47')](_0xfe7b25)[_0xc6ab('0x22')](function(_0x82e7db){if(_0x82e7db){_0x806072=_0x82e7db;return _0x82e7db[_0xc6ab('0x67')]();}return null;})['then'](function(_0x32a302){if(_0x32a302){if(!_0x32a302[_0xc6ab('0x36')]){throw new db['Sequelize'][(_0xc6ab('0x68'))](_0xc6ab('0x69'),0x193);}_0x46b876=_0x32a302;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xc6ab('0x22')](function(_0x1e0d64){if(_0x1e0d64){_0x5ba3de=_[_0xc6ab('0x6a')](_0x1e0d64,'id');var _0x21a6af;var _0x549808=squel['select']();_0x549808[_0xc6ab('0x6b')](_0x806072[_0xc6ab('0x6c')]);for(var _0x562972=0x0;_0x562972<_0x46b876[_0xc6ab('0x36')];_0x562972+=0x1){_0x21a6af=_0x46b876[_0x562972][_0xc6ab('0x6d')]?_0x5ba3de[_0x46b876[_0x562972][_0xc6ab('0x6d')]][_0xc6ab('0x6e')]:_0x46b876[_0x562972][_0xc6ab('0x65')];_0x21a6af=_0x46b876[_0x562972][_0xc6ab('0x6f')]?_['replace'](_0x380236[_0x46b876[_0x562972][_0xc6ab('0x6f')]],'%s',_0x21a6af):_0x21a6af;_0x21a6af=_0x46b876[_0x562972][_0xc6ab('0x70')]?_[_0xc6ab('0x71')](_0x892d8f[_0x46b876[_0x562972][_0xc6ab('0x70')]],'%s',_0x21a6af):_0x21a6af;if(_0x46b876[_0x562972]['groupBy']){_0x549808[_0xc6ab('0x64')](_0x21a6af);}_0x46b876[_0x562972]['orderBy']&&_0x549808[_0xc6ab('0x72')](_0x21a6af,_0x46b876[_0x562972][_0xc6ab('0x73')]==='DESC'?![]:!![]);_0x549808[_0xc6ab('0x65')](_0x21a6af,_0x46b876[_0x562972]['alias']||_0x21a6af);}if(_0x806072[_0xc6ab('0x74')]){_0x806072[_0xc6ab('0x74')]=JSON[_0xc6ab('0x75')](_0x806072[_0xc6ab('0x74')]);for(var _0x1778b6=0x0;_0x1778b6<_0x806072[_0xc6ab('0x74')][_0xc6ab('0x36')];_0x1778b6+=0x1){if(_0x806072['joins'][_0x1778b6][_0xc6ab('0x2e')]&&_[_0xc6ab('0x5e')](_0x22e541,_0x806072['joins'][_0x1778b6][_0xc6ab('0x2e')])&&_0x806072['joins'][_0x1778b6]['parentKey']&&_0x806072['joins'][_0x1778b6][_0xc6ab('0x76')]&&_0x806072[_0xc6ab('0x74')][_0x1778b6][_0xc6ab('0x77')]){_0x549808[_0x806072[_0xc6ab('0x74')][_0x1778b6][_0xc6ab('0x2e')]](_0x806072[_0xc6ab('0x74')][_0x1778b6][_0xc6ab('0x76')],null,util[_0xc6ab('0x70')](_0xc6ab('0x78'),_0x806072[_0xc6ab('0x6c')],_0x806072[_0xc6ab('0x74')][_0x1778b6]['parentKey'],_0x806072[_0xc6ab('0x74')][_0x1778b6][_0xc6ab('0x76')],_0x806072[_0xc6ab('0x74')][_0x1778b6]['foreignKey']));}}}if(_0x806072[_0xc6ab('0x79')]){_0x806072[_0xc6ab('0x79')]=JSON['parse'](_0x806072['conditions']);_0x549808[_0xc6ab('0x3d')](_0x1c4841(_0x806072[_0xc6ab('0x79')][_0xc6ab('0x64')]));}_0x178a88=_0x549808[_0xc6ab('0x7a')]();_0x549808['limit'](_0x5a75f6);_0x549808[_0xc6ab('0x19')](0x0);logger['debug']('Limited\x20Query:',_0x549808['toString']());return dbH[_0xc6ab('0x7b')][_0xc6ab('0x31')](_0x549808['toString'](),{'type':dbH[_0xc6ab('0x7b')][_0xc6ab('0x7c')][_0xc6ab('0x7d')]});}})[_0xc6ab('0x22')](respondWithResult(_0x49cd71,null))['catch'](handleError(_0x49cd71,null));};function runReport(_0x581495,_0x22a0c9,_0x2a966a){var _0x36de17=_0x22a0c9[_0xc6ab('0x29')];var _0x17ded1=0xa;var _0x1bbc96=[_0xc6ab('0x53'),_0xc6ab('0x54'),_0xc6ab('0x55'),'cross_join'];var _0x490006={'SUM':'SUM(%s)','COUNT':_0xc6ab('0x56'),'COUNT DISTINCT':_0xc6ab('0x7e'),'MAX':_0xc6ab('0x7f'),'MIN':'MIN(%s)','AVG':_0xc6ab('0x80'),'GROUP_CONCAT':_0xc6ab('0x58'),'GROUP_CONCAT ASC':_0xc6ab('0x59'),'GROUP_CONCAT DESC':_0xc6ab('0x5a')};var _0x4b1344={'SEC_TO_TIME':_0xc6ab('0x81'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc6ab('0x5d')};var _0x3f8ac6=function(_0x188522){return!_['includes']([_0xc6ab('0x5f'),'IS\x20NOT\x20NULL',_0xc6ab('0x82'),'IS\x20NOT\x20EMPTY'],_0x188522);};var _0x142a68=function(_0x4fded8){if(!_0x4fded8||!_0x4fded8['rules']['length']){return'';}for(var _0x2622ba='(',_0xdb3cab=0x0;_0xdb3cab<_0x4fded8[_0xc6ab('0x62')][_0xc6ab('0x36')];_0xdb3cab+=0x1){_0xdb3cab>0x0&&(_0x2622ba+='\x20'+_0x4fded8[_0xc6ab('0x63')]+'\x20');_0x2622ba+=_0x4fded8['rules'][_0xdb3cab][_0xc6ab('0x64')]?_0x142a68(_0x4fded8[_0xc6ab('0x62')][_0xdb3cab][_0xc6ab('0x64')]):_0x4fded8[_0xc6ab('0x62')][_0xdb3cab]['field']+'\x20'+_0x4fded8[_0xc6ab('0x62')][_0xdb3cab]['condition']+(_0x3f8ac6(_0x4fded8[_0xc6ab('0x62')][_0xdb3cab][_0xc6ab('0x66')])?'\x20'+_0x4fded8[_0xc6ab('0x62')][_0xdb3cab][_0xc6ab('0x83')]:'');}return _0x2622ba+')';};var _0x3c6aa0={'where':{'id':_0x581495['id']}},_0x2fbf96,_0x3c537f,_0x1649b2,_0xc15158,_0xfe9163;_0x3c6aa0=_[_0xc6ab('0x3e')]({},_0x3c6aa0,_0x2a966a);return db['AnalyticCustomReport']['find'](_0x3c6aa0)[_0xc6ab('0x22')](function(_0x195e3b){if(_0x195e3b){_0x2fbf96=_0x195e3b;return _0x195e3b[_0xc6ab('0x67')]();}return null;})['then'](function(_0x311fb9){if(_0x311fb9){if(!_0x311fb9[_0xc6ab('0x36')]){throw new db[(_0xc6ab('0x84'))][(_0xc6ab('0x68'))](_0xc6ab('0x69'),0x193);}_0x3c537f=_0x311fb9;return db[_0xc6ab('0x85')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x1a53c6){if(_0x1a53c6){_0x1649b2=_['keyBy'](_0x1a53c6,'id');var _0x4f8441;var _0x5db216=squel[_0xc6ab('0x86')]();_0x5db216[_0xc6ab('0x6b')](_0x2fbf96[_0xc6ab('0x6c')]);for(var _0x4d03c1=0x0;_0x4d03c1<_0x3c537f['length'];_0x4d03c1+=0x1){_0x4f8441=_0x3c537f[_0x4d03c1][_0xc6ab('0x6d')]?_0x1649b2[_0x3c537f[_0x4d03c1]['MetricId']][_0xc6ab('0x6e')]:_0x3c537f[_0x4d03c1][_0xc6ab('0x65')];_0x4f8441=_0x3c537f[_0x4d03c1][_0xc6ab('0x6f')]?_[_0xc6ab('0x71')](_0x490006[_0x3c537f[_0x4d03c1]['function']],'%s',_0x4f8441):_0x4f8441;_0x4f8441=_0x3c537f[_0x4d03c1][_0xc6ab('0x70')]?_[_0xc6ab('0x71')](_0x4b1344[_0x3c537f[_0x4d03c1][_0xc6ab('0x70')]],'%s',_0x4f8441):_0x4f8441;if(_0x3c537f[_0x4d03c1][_0xc6ab('0x87')]){_0x5db216['group'](_0x4f8441);}_0x3c537f[_0x4d03c1]['orderBy']&&_0x5db216[_0xc6ab('0x72')](_0x4f8441,_0x3c537f[_0x4d03c1][_0xc6ab('0x73')]===_0xc6ab('0x88')?![]:!![]);_0x5db216[_0xc6ab('0x65')](_0x4f8441,_0x3c537f[_0x4d03c1][_0xc6ab('0x89')]||_0x4f8441);}if(_0x2fbf96[_0xc6ab('0x74')]){_0x2fbf96[_0xc6ab('0x74')]=JSON[_0xc6ab('0x75')](_0x2fbf96['joins']);for(var _0x39b620=0x0;_0x39b620<_0x2fbf96['joins'][_0xc6ab('0x36')];_0x39b620+=0x1){if(_0x2fbf96['joins'][_0x39b620][_0xc6ab('0x2e')]&&_[_0xc6ab('0x5e')](_0x1bbc96,_0x2fbf96[_0xc6ab('0x74')][_0x39b620][_0xc6ab('0x2e')])&&_0x2fbf96[_0xc6ab('0x74')][_0x39b620][_0xc6ab('0x8a')]&&_0x2fbf96[_0xc6ab('0x74')][_0x39b620][_0xc6ab('0x76')]&&_0x2fbf96[_0xc6ab('0x74')][_0x39b620][_0xc6ab('0x77')]){_0x5db216[_0x2fbf96[_0xc6ab('0x74')][_0x39b620]['type']](_0x2fbf96['joins'][_0x39b620]['foreignTable'],null,util[_0xc6ab('0x70')](_0xc6ab('0x78'),_0x2fbf96[_0xc6ab('0x6c')],_0x2fbf96[_0xc6ab('0x74')][_0x39b620][_0xc6ab('0x8a')],_0x2fbf96[_0xc6ab('0x74')][_0x39b620][_0xc6ab('0x76')],_0x2fbf96[_0xc6ab('0x74')][_0x39b620][_0xc6ab('0x77')]));}}}if(_0x2fbf96[_0xc6ab('0x79')]){_0x2fbf96[_0xc6ab('0x79')]=JSON[_0xc6ab('0x75')](_0x2fbf96[_0xc6ab('0x79')]);_0x5db216[_0xc6ab('0x3d')](_0x142a68(_0x2fbf96['conditions'][_0xc6ab('0x64')]));}_0xfe9163=_0x5db216['clone']();_0x5db216[_0xc6ab('0x1a')](_0x17ded1);_0x5db216[_0xc6ab('0x19')](0x0);return;}})['then'](function(){if(_0x22a0c9[_0xc6ab('0x8b')]===_0xc6ab('0x8c')){return null;}var _0x1d1823=_[_0xc6ab('0x3e')](_0x22a0c9,{'name':_0x22a0c9[_0xc6ab('0x8d')]||_0x22a0c9['name']||_0x2fbf96[_0xc6ab('0x29')],'basename':_0x36de17,'savename':util[_0xc6ab('0x70')](_0xc6ab('0x8e'),_0x22a0c9['name']||_0x2fbf96[_0xc6ab('0x29')],require('randomstring')[_0xc6ab('0x8f')](0x4),_0x22a0c9[_0xc6ab('0x8b')]||_0xc6ab('0x90')),'reportId':_0x2fbf96['id'],'reportType':_0xc6ab('0x91')});return db[_0xc6ab('0x92')]['create'](_0x1d1823,{'raw':!![]});})[_0xc6ab('0x22')](function(_0xcc6419){if(_0x2fbf96[_0xc6ab('0x6c')]===_0xc6ab('0x93')){_0xfe9163[_0xc6ab('0x3d')](_0x2fbf96[_0xc6ab('0x6c')]+_0xc6ab('0x94'),_0x22a0c9[_0xc6ab('0x95')],_0x22a0c9[_0xc6ab('0x96')]);}else{_0xfe9163[_0xc6ab('0x3d')](_0x2fbf96[_0xc6ab('0x6c')]+_0xc6ab('0x97'),_0x22a0c9['startDate'],_0x22a0c9[_0xc6ab('0x96')]);}if(_0xcc6419){logger['info'](_0xc6ab('0x98'),_0xfe9163[_0xc6ab('0x99')]());require(_0xc6ab('0x9a'))[_0xc6ab('0x9b')](path[_0xc6ab('0x53')](__dirname,_0xc6ab('0x9c'),_0xcc6419[_0xc6ab('0x8b')]),[_0xcc6419['id'],_0xfe9163['toString'](),path['join'](__dirname,_0xc6ab('0x9d'),_0xcc6419[_0xc6ab('0x9e')]),_0x36de17]);return _0xcc6419;}else{var _0x254be3=squel['select']();_0x254be3[_0xc6ab('0x6b')]('('+_0xfe9163[_0xc6ab('0x99')]()+')','countTable');_0x254be3[_0xc6ab('0x65')](_0xc6ab('0x9f'),_0xc6ab('0x1c'));_0xfe9163[_0xc6ab('0x1a')](_0x22a0c9['limit']||_0x17ded1);_0xfe9163[_0xc6ab('0x19')](_0x22a0c9[_0xc6ab('0x19')]||0x0);return dbH[_0xc6ab('0x7b')]['query'](_0x254be3[_0xc6ab('0x99')](),{'type':dbH[_0xc6ab('0x7b')][_0xc6ab('0x7c')][_0xc6ab('0x7d')]})[_0xc6ab('0x22')](function(_0x389d5e){if(!_0x389d5e[_0xc6ab('0x36')]){_0xc15158=0x0;}else{_0xc15158=_0x389d5e[0x0][_0xc6ab('0x1c')]||0x0;}return dbH['sequelize'][_0xc6ab('0x31')](_0xfe9163[_0xc6ab('0x99')](),{'type':dbH[_0xc6ab('0x7b')]['QueryTypes'][_0xc6ab('0x7d')]});})[_0xc6ab('0x22')](function(_0x21e925){return{'rows':_0x21e925||[],'count':_0xc15158};});}});}exports[_0xc6ab('0xa0')]=function(_0x1c4bba,_0x381b64){return runReport(_0x1c4bba[_0xc6ab('0x44')],_0x1c4bba[_0xc6ab('0x31')],_0x1c4bba[_0xc6ab('0x40')])['then'](respondWithResult(_0x381b64,null))[_0xc6ab('0x42')](handleError(_0x381b64,null));};exports['runReport']=runReport;exports[_0xc6ab('0x31')]=function(_0x595435,_0x5303eb){var _0x4b6e88=0xa;var _0x508263=['join',_0xc6ab('0x54'),'right_join',_0xc6ab('0xa1')];var _0x5474d7={'SUM':_0xc6ab('0xa2'),'COUNT':_0xc6ab('0x56'),'COUNT DISTINCT':_0xc6ab('0x7e'),'MAX':_0xc6ab('0x7f'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc6ab('0x58'),'GROUP_CONCAT ASC':_0xc6ab('0x59'),'GROUP_CONCAT DESC':_0xc6ab('0x5a')};var _0x52513a={'SEC_TO_TIME':_0xc6ab('0x81'),'DATE':_0xc6ab('0x5b'),'HOUR':_0xc6ab('0x5c'),'ROUND':_0xc6ab('0xa3'),'UNIX_TIMESTAMP':_0xc6ab('0x5d')};var _0x36e30e=function(_0x47a9ed){return!_[_0xc6ab('0x5e')](['IS\x20NULL',_0xc6ab('0x60'),_0xc6ab('0x82'),_0xc6ab('0x61')],_0x47a9ed);};var _0x24941a=function(_0x3380eb){if(!_0x3380eb||!_0x3380eb[_0xc6ab('0x62')]['length']){return'';}for(var _0x8d1425='(',_0x547376=0x0;_0x547376<_0x3380eb[_0xc6ab('0x62')][_0xc6ab('0x36')];_0x547376+=0x1){_0x547376>0x0&&(_0x8d1425+='\x20'+_0x3380eb['operator']+'\x20');_0x8d1425+=_0x3380eb[_0xc6ab('0x62')][_0x547376][_0xc6ab('0x64')]?_0x24941a(_0x3380eb['rules'][_0x547376][_0xc6ab('0x64')]):_0x3380eb['rules'][_0x547376][_0xc6ab('0x65')]+'\x20'+_0x3380eb[_0xc6ab('0x62')][_0x547376][_0xc6ab('0x66')]+(_0x36e30e(_0x3380eb[_0xc6ab('0x62')][_0x547376][_0xc6ab('0x66')])?'\x20'+_0x3380eb[_0xc6ab('0x62')][_0x547376][_0xc6ab('0x83')]:'');}return _0x8d1425+')';};var _0x11c5e7={'where':{'id':_0x595435['params']['id']}},_0x5aa19d,_0x45f3bc,_0x4d198f,_0x4f4626,_0xabe3ab;_0x11c5e7=_[_0xc6ab('0x3e')]({},_0x11c5e7,_0x595435[_0xc6ab('0x40')]);return db[_0xc6ab('0x2d')][_0xc6ab('0x47')](_0x11c5e7)[_0xc6ab('0x22')](function(_0x4a6a2e){if(_0x4a6a2e){_0x5aa19d=_0x4a6a2e;return _0x4a6a2e[_0xc6ab('0x67')]();}return null;})[_0xc6ab('0x22')](function(_0x464ec5){if(_0x464ec5){if(!_0x464ec5['length']){throw new db[(_0xc6ab('0x84'))][(_0xc6ab('0x68'))](_0xc6ab('0x69'),0x193);}_0x45f3bc=_0x464ec5;return db[_0xc6ab('0x85')][_0xc6ab('0xa4')]({'raw':!![]});}return null;})[_0xc6ab('0x22')](function(_0x2e3b29){if(_0x2e3b29){_0x4d198f=_['keyBy'](_0x2e3b29,'id');var _0x460481;var _0x1554a5=squel[_0xc6ab('0x86')]();_0x1554a5[_0xc6ab('0x6b')](_0x5aa19d[_0xc6ab('0x6c')]);for(var _0x24aafe=0x0;_0x24aafe<_0x45f3bc[_0xc6ab('0x36')];_0x24aafe+=0x1){_0x460481=_0x45f3bc[_0x24aafe][_0xc6ab('0x6d')]?_0x4d198f[_0x45f3bc[_0x24aafe][_0xc6ab('0x6d')]][_0xc6ab('0x6e')]:_0x45f3bc[_0x24aafe]['field'];_0x460481=_0x45f3bc[_0x24aafe]['function']?_[_0xc6ab('0x71')](_0x5474d7[_0x45f3bc[_0x24aafe][_0xc6ab('0x6f')]],'%s',_0x460481):_0x460481;_0x460481=_0x45f3bc[_0x24aafe][_0xc6ab('0x70')]?_[_0xc6ab('0x71')](_0x52513a[_0x45f3bc[_0x24aafe][_0xc6ab('0x70')]],'%s',_0x460481):_0x460481;if(_0x45f3bc[_0x24aafe]['groupBy']){_0x1554a5[_0xc6ab('0x64')](_0x460481);}_0x45f3bc[_0x24aafe][_0xc6ab('0x73')]&&_0x1554a5[_0xc6ab('0x72')](_0x460481,_0x45f3bc[_0x24aafe][_0xc6ab('0x73')]===_0xc6ab('0x88')?![]:!![]);_0x1554a5[_0xc6ab('0x65')](_0x460481,_0x45f3bc[_0x24aafe][_0xc6ab('0x89')]||_0x460481);}if(_0x5aa19d[_0xc6ab('0x74')]){_0x5aa19d[_0xc6ab('0x74')]=JSON['parse'](_0x5aa19d[_0xc6ab('0x74')]);for(var _0x21770e=0x0;_0x21770e<_0x5aa19d[_0xc6ab('0x74')]['length'];_0x21770e+=0x1){if(_0x5aa19d[_0xc6ab('0x74')][_0x21770e][_0xc6ab('0x2e')]&&_[_0xc6ab('0x5e')](_0x508263,_0x5aa19d['joins'][_0x21770e][_0xc6ab('0x2e')])&&_0x5aa19d[_0xc6ab('0x74')][_0x21770e][_0xc6ab('0x8a')]&&_0x5aa19d[_0xc6ab('0x74')][_0x21770e][_0xc6ab('0x76')]&&_0x5aa19d[_0xc6ab('0x74')][_0x21770e]['foreignKey']){_0x1554a5[_0x5aa19d[_0xc6ab('0x74')][_0x21770e][_0xc6ab('0x2e')]](_0x5aa19d[_0xc6ab('0x74')][_0x21770e]['foreignTable'],null,util[_0xc6ab('0x70')]('%s.%s\x20=\x20%s.%s',_0x5aa19d[_0xc6ab('0x6c')],_0x5aa19d[_0xc6ab('0x74')][_0x21770e]['parentKey'],_0x5aa19d[_0xc6ab('0x74')][_0x21770e][_0xc6ab('0x76')],_0x5aa19d[_0xc6ab('0x74')][_0x21770e][_0xc6ab('0x77')]));}}}if(_0x5aa19d[_0xc6ab('0x79')]){_0x5aa19d[_0xc6ab('0x79')]=JSON['parse'](_0x5aa19d[_0xc6ab('0x79')]);_0x1554a5[_0xc6ab('0x3d')](_0x24941a(_0x5aa19d[_0xc6ab('0x79')][_0xc6ab('0x64')]));}_0xabe3ab=_0x1554a5[_0xc6ab('0x7a')]();_0x1554a5['limit'](_0x4b6e88);_0x1554a5['offset'](0x0);logger['debug'](_0xc6ab('0xa5'),_0x1554a5[_0xc6ab('0x99')]());return dbH[_0xc6ab('0x7b')]['query'](_0x1554a5[_0xc6ab('0x99')](),{'type':dbH[_0xc6ab('0x7b')]['QueryTypes']['SELECT']});}})[_0xc6ab('0x22')](function(){return{'sql':_0xabe3ab['toString']()};})[_0xc6ab('0x22')](respondWithResult(_0x5303eb,null))[_0xc6ab('0x42')](handleError(_0x5303eb,null));}; \ No newline at end of file +var _0x8807=['SUM(%s)','COUNT(%s)','SEC_TO_TIME(%s)','IS\x20EMPTY','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','end','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','metric','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','MIN(%s)','GROUP_CONCAT(%s)','ROUND(%s)','ValidationErrorItem','MetricId','function','format','web','fullPath','%s-%s.%s','generate','output','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','SELECT','run','runReport'];(function(_0x4aa5db,_0x185906){var _0x4f4729=function(_0x555ef8){while(--_0x555ef8){_0x4aa5db['push'](_0x4aa5db['shift']());}};_0x4f4729(++_0x185906);}(_0x8807,0xac));var _0x7880=function(_0x1acf4b,_0x5a750c){_0x1acf4b=_0x1acf4b-0x0;var _0x4eca09=_0x8807[_0x1acf4b];return _0x4eca09;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7880('0x0'));var zipdir=require(_0x7880('0x1'));var jsonpatch=require(_0x7880('0x2'));var rp=require(_0x7880('0x3'));var moment=require(_0x7880('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7880('0x5'));var util=require('util');var path=require(_0x7880('0x6'));var sox=require(_0x7880('0x7'));var csv=require(_0x7880('0x8'));var ejs=require(_0x7880('0x9'));var fs=require('fs');var fs_extra=require(_0x7880('0xa'));var _=require(_0x7880('0xb'));var squel=require(_0x7880('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7880('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7880('0xe'));var Redis=require('ioredis');var authService=require(_0x7880('0xf'));var qs=require(_0x7880('0x10'));var as=require(_0x7880('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7880('0x12'))(_0x7880('0x13'));var utils=require(_0x7880('0x14'));var config=require(_0x7880('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7880('0x16'))['db'];var dbH=require(_0x7880('0x16'))[_0x7880('0x17')];function respondWithStatusCode(_0x51009c,_0x3d0fc3){_0x3d0fc3=_0x3d0fc3||0xcc;return function(_0xec3ced){if(_0xec3ced){return _0x51009c[_0x7880('0x18')](_0x3d0fc3);}return _0x51009c[_0x7880('0x19')](_0x3d0fc3)['end']();};}function respondWithResult(_0x13c1fa,_0x345124){_0x345124=_0x345124||0xc8;return function(_0x5d12b2){if(_0x5d12b2){return _0x13c1fa[_0x7880('0x19')](_0x345124)[_0x7880('0x1a')](_0x5d12b2);}};}function respondWithFilteredResult(_0x3479a9,_0x4d408e){return function(_0x2f167b){if(_0x2f167b){var _0x1b4cf6=typeof _0x4d408e[_0x7880('0x1b')]===_0x7880('0x1c')&&typeof _0x4d408e[_0x7880('0x1d')]===_0x7880('0x1c');var _0x1693c3=_0x2f167b['count'];var _0x32d325=_0x1b4cf6?0x0:_0x4d408e['offset'];var _0x328b9f=_0x1b4cf6?_0x2f167b[_0x7880('0x1e')]:_0x4d408e[_0x7880('0x1b')]+_0x4d408e[_0x7880('0x1d')];var _0x53f6a5;if(_0x328b9f>=_0x1693c3){_0x328b9f=_0x1693c3;_0x53f6a5=0xc8;}else{_0x53f6a5=0xce;}_0x3479a9[_0x7880('0x19')](_0x53f6a5);return _0x3479a9['set'](_0x7880('0x1f'),_0x32d325+'-'+_0x328b9f+'/'+_0x1693c3)[_0x7880('0x1a')](_0x2f167b);}return null;};}function patchUpdates(_0xda460f){return function(_0xa9aeb7){try{jsonpatch[_0x7880('0x20')](_0xa9aeb7,_0xda460f,!![]);}catch(_0x45c88c){return BPromise[_0x7880('0x21')](_0x45c88c);}return _0xa9aeb7[_0x7880('0x22')]();};}function saveUpdates(_0x11bd2c,_0x2c0e01){return function(_0x566dbb){if(_0x566dbb){return _0x566dbb[_0x7880('0x23')](_0x11bd2c)[_0x7880('0x24')](function(_0x36bee2){return _0x36bee2;});}return null;};}function removeEntity(_0x28cd6e,_0x5f5087){return function(_0x4980b5){if(_0x4980b5){return _0x4980b5[_0x7880('0x25')]()[_0x7880('0x24')](function(){var _0x1fd318=_0x4980b5[_0x7880('0x26')]({'plain':!![]});var _0x45fc64=_0x7880('0x27');return db[_0x7880('0x28')][_0x7880('0x25')]({'where':{'type':_0x45fc64,'resourceId':_0x1fd318['id']}})[_0x7880('0x24')](function(){return _0x4980b5;});})['then'](function(){_0x28cd6e[_0x7880('0x19')](0xcc)[_0x7880('0x29')]();});}};}function handleEntityNotFound(_0x5a61cd,_0x342062){return function(_0x4ea754){if(!_0x4ea754){_0x5a61cd[_0x7880('0x18')](0x194);}return _0x4ea754;};}function handleError(_0x3eb734,_0x5c5e39){_0x5c5e39=_0x5c5e39||0x1f4;return function(_0x4ac858){logger['error'](_0x4ac858[_0x7880('0x2a')]);if(_0x4ac858[_0x7880('0x2b')]){delete _0x4ac858['name'];}_0x3eb734['status'](_0x5c5e39)[_0x7880('0x2c')](_0x4ac858);};}exports['index']=function(_0x5db878,_0x28d488){var _0x1300f2={},_0x150ada={},_0x4b8a79={'count':0x0,'rows':[]};var _0x2eb1e6=_[_0x7880('0x2d')](db[_0x7880('0x2e')][_0x7880('0x2f')],function(_0x49ca6c){return{'name':_0x49ca6c[_0x7880('0x30')],'type':_0x49ca6c['type'][_0x7880('0x31')]};});_0x150ada[_0x7880('0x32')]=_[_0x7880('0x2d')](_0x2eb1e6,_0x7880('0x2b'));_0x150ada['query']=_['keys'](_0x5db878[_0x7880('0x33')]);_0x150ada['filters']=_['intersection'](_0x150ada[_0x7880('0x32')],_0x150ada['query']);_0x1300f2[_0x7880('0x34')]=_[_0x7880('0x35')](_0x150ada[_0x7880('0x32')],qs[_0x7880('0x36')](_0x5db878[_0x7880('0x33')]['fields']));_0x1300f2['attributes']=_0x1300f2[_0x7880('0x34')][_0x7880('0x37')]?_0x1300f2[_0x7880('0x34')]:_0x150ada['model'];if(!_0x5db878[_0x7880('0x33')][_0x7880('0x38')](_0x7880('0x39'))){_0x1300f2[_0x7880('0x1d')]=qs['limit'](_0x5db878['query'][_0x7880('0x1d')]);_0x1300f2[_0x7880('0x1b')]=qs[_0x7880('0x1b')](_0x5db878[_0x7880('0x33')][_0x7880('0x1b')]);}_0x1300f2[_0x7880('0x3a')]=qs[_0x7880('0x3b')](_0x5db878[_0x7880('0x33')]['sort']);_0x1300f2[_0x7880('0x3c')]=qs[_0x7880('0x3d')](_[_0x7880('0x3e')](_0x5db878[_0x7880('0x33')],_0x150ada[_0x7880('0x3d')]),_0x2eb1e6);if(_0x5db878[_0x7880('0x33')][_0x7880('0x3f')]){_0x1300f2['where']=_['merge'](_0x1300f2[_0x7880('0x3c')],{'$or':_['map'](_0x2eb1e6,function(_0x1453dd){if(_0x1453dd[_0x7880('0x40')]!==_0x7880('0x41')){var _0x3ac7af={};_0x3ac7af[_0x1453dd[_0x7880('0x2b')]]={'$like':'%'+_0x5db878[_0x7880('0x33')]['filter']+'%'};return _0x3ac7af;}})});}_0x1300f2=_[_0x7880('0x42')]({},_0x1300f2,_0x5db878[_0x7880('0x43')]);var _0x23c818={'where':_0x1300f2[_0x7880('0x3c')]};return db[_0x7880('0x2e')][_0x7880('0x1e')](_0x23c818)[_0x7880('0x24')](function(_0x40d115){_0x4b8a79[_0x7880('0x1e')]=_0x40d115;if(_0x5db878[_0x7880('0x33')][_0x7880('0x44')]){_0x1300f2[_0x7880('0x45')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x7880('0x46')](_0x1300f2);})['then'](function(_0x271cf4){_0x4b8a79[_0x7880('0x47')]=_0x271cf4;return _0x4b8a79;})[_0x7880('0x24')](respondWithFilteredResult(_0x28d488,_0x1300f2))['catch'](handleError(_0x28d488,null));};exports[_0x7880('0x48')]=function(_0x25bafa,_0x4aa197){var _0x281b66={'raw':![],'where':{'id':_0x25bafa[_0x7880('0x49')]['id']}},_0x32ed31={};_0x32ed31[_0x7880('0x32')]=_[_0x7880('0x4a')](db[_0x7880('0x2e')]['rawAttributes']);_0x32ed31[_0x7880('0x33')]=_['keys'](_0x25bafa['query']);_0x32ed31[_0x7880('0x3d')]=_['intersection'](_0x32ed31['model'],_0x32ed31['query']);_0x281b66[_0x7880('0x34')]=_[_0x7880('0x35')](_0x32ed31[_0x7880('0x32')],qs['fields'](_0x25bafa[_0x7880('0x33')][_0x7880('0x36')]));_0x281b66[_0x7880('0x34')]=_0x281b66[_0x7880('0x34')][_0x7880('0x37')]?_0x281b66[_0x7880('0x34')]:_0x32ed31['model'];if(_0x25bafa[_0x7880('0x33')][_0x7880('0x44')]){_0x281b66['include']=[{'all':!![]}];}_0x281b66=_[_0x7880('0x42')]({},_0x281b66,_0x25bafa['options']);return db[_0x7880('0x2e')][_0x7880('0x4b')](_0x281b66)[_0x7880('0x24')](handleEntityNotFound(_0x4aa197,null))['then'](respondWithResult(_0x4aa197,null))[_0x7880('0x4c')](handleError(_0x4aa197,null));};exports[_0x7880('0x4d')]=function(_0x432e55,_0x5e024e){return db[_0x7880('0x2e')][_0x7880('0x4d')](_0x432e55['body'],{})[_0x7880('0x24')](function(_0x6d7983){var _0x282164=_0x432e55[_0x7880('0x4e')][_0x7880('0x26')]({'plain':!![]});if(!_0x282164)throw new Error(_0x7880('0x4f'));if(_0x282164[_0x7880('0x50')]===_0x7880('0x4e')){var _0xaea634=_0x6d7983[_0x7880('0x26')]({'plain':!![]});var _0x370502=_0x7880('0x51');return db[_0x7880('0x52')][_0x7880('0x4b')]({'where':{'name':_0x370502,'userProfileId':_0x282164[_0x7880('0x53')]},'raw':!![]})['then'](function(_0x4a005b){if(_0x4a005b&&_0x4a005b[_0x7880('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0xaea634[_0x7880('0x2b')],'resourceId':_0xaea634['id'],'type':_0x7880('0x27'),'sectionId':_0x4a005b['id']},{})['then'](function(){return _0x6d7983;});}else{return _0x6d7983;}})[_0x7880('0x4c')](function(_0x37b46f){logger[_0x7880('0x55')](_0x7880('0x56'),_0x37b46f);throw _0x37b46f;});}return _0x6d7983;})[_0x7880('0x24')](respondWithResult(_0x5e024e,0xc9))[_0x7880('0x4c')](handleError(_0x5e024e,null));};exports[_0x7880('0x23')]=function(_0x5b4597,_0x4884c7){if(_0x5b4597[_0x7880('0x57')]['id']){delete _0x5b4597[_0x7880('0x57')]['id'];}return db[_0x7880('0x2e')][_0x7880('0x4b')]({'where':{'id':_0x5b4597[_0x7880('0x49')]['id']}})['then'](handleEntityNotFound(_0x4884c7,null))[_0x7880('0x24')](saveUpdates(_0x5b4597[_0x7880('0x57')],null))[_0x7880('0x24')](respondWithResult(_0x4884c7,null))[_0x7880('0x4c')](handleError(_0x4884c7,null));};exports[_0x7880('0x25')]=function(_0x170db0,_0x29d89b){return db[_0x7880('0x2e')]['find']({'where':{'id':_0x170db0[_0x7880('0x49')]['id']}})['then'](handleEntityNotFound(_0x29d89b,null))['then'](removeEntity(_0x29d89b,null))[_0x7880('0x4c')](handleError(_0x29d89b,null));};exports[_0x7880('0x58')]=function(_0x270cca,_0x4e0fd9){var _0x513791=0xa;var _0x2b48b2=[_0x7880('0x59'),_0x7880('0x5a'),_0x7880('0x5b'),_0x7880('0x5c')];var _0x593bbb={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7880('0x5d'),'MAX':_0x7880('0x5e'),'MIN':'MIN(%s)','AVG':_0x7880('0x5f'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7880('0x60'),'GROUP_CONCAT DESC':_0x7880('0x61')};var _0x33e86d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x7880('0x62'),'HOUR':_0x7880('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7880('0x64')};var _0xf1a04e=function(_0x57b2f4){return!_[_0x7880('0x65')]([_0x7880('0x66'),_0x7880('0x67'),'IS\x20EMPTY',_0x7880('0x68')],_0x57b2f4);};var _0x43f96e=function(_0x24d00f){if(!_0x24d00f||!_0x24d00f[_0x7880('0x69')]['length']){return'';}for(var _0x1b1045='(',_0x3dcacb=0x0;_0x3dcacb<_0x24d00f[_0x7880('0x69')][_0x7880('0x37')];_0x3dcacb+=0x1){_0x3dcacb>0x0&&(_0x1b1045+='\x20'+_0x24d00f[_0x7880('0x6a')]+'\x20');_0x1b1045+=_0x24d00f['rules'][_0x3dcacb][_0x7880('0x6b')]?_0x43f96e(_0x24d00f['rules'][_0x3dcacb]['group']):_0x24d00f['rules'][_0x3dcacb][_0x7880('0x6c')]+'\x20'+_0x24d00f[_0x7880('0x69')][_0x3dcacb][_0x7880('0x6d')]+(_0xf1a04e(_0x24d00f[_0x7880('0x69')][_0x3dcacb][_0x7880('0x6d')])?'\x20'+_0x24d00f[_0x7880('0x69')][_0x3dcacb][_0x7880('0x6e')]:'');}return _0x1b1045+')';};var _0x47e2e4={'where':{'id':_0x270cca[_0x7880('0x49')]['id']}},_0xd16dea,_0x5625e6,_0x350afd,_0x49628c,_0x4862fc;_0x47e2e4=_['merge']({},_0x47e2e4,_0x270cca[_0x7880('0x43')]);return db[_0x7880('0x2e')][_0x7880('0x4b')](_0x47e2e4)['then'](function(_0x1cda40){if(_0x1cda40){_0xd16dea=_0x1cda40;return _0x1cda40[_0x7880('0x6f')]();}return null;})[_0x7880('0x24')](function(_0x4bfbf6){if(_0x4bfbf6){if(!_0x4bfbf6[_0x7880('0x37')]){throw new db[(_0x7880('0x70'))]['ValidationErrorItem'](_0x7880('0x71'),0x193);}_0x5625e6=_0x4bfbf6;return db[_0x7880('0x72')][_0x7880('0x46')]({'raw':!![]});}return null;})[_0x7880('0x24')](function(_0x1006a0){if(_0x1006a0){_0x350afd=_[_0x7880('0x73')](_0x1006a0,'id');var _0x18a4ff;var _0x532e06=squel[_0x7880('0x74')]();_0x532e06[_0x7880('0x75')](_0xd16dea[_0x7880('0x76')]);for(var _0x2ad8bd=0x0;_0x2ad8bd<_0x5625e6[_0x7880('0x37')];_0x2ad8bd+=0x1){_0x18a4ff=_0x5625e6[_0x2ad8bd]['MetricId']?_0x350afd[_0x5625e6[_0x2ad8bd]['MetricId']][_0x7880('0x77')]:_0x5625e6[_0x2ad8bd][_0x7880('0x6c')];_0x18a4ff=_0x5625e6[_0x2ad8bd]['function']?_[_0x7880('0x78')](_0x593bbb[_0x5625e6[_0x2ad8bd]['function']],'%s',_0x18a4ff):_0x18a4ff;_0x18a4ff=_0x5625e6[_0x2ad8bd]['format']?_['replace'](_0x33e86d[_0x5625e6[_0x2ad8bd]['format']],'%s',_0x18a4ff):_0x18a4ff;if(_0x5625e6[_0x2ad8bd][_0x7880('0x79')]){_0x532e06[_0x7880('0x6b')](_0x18a4ff);}_0x5625e6[_0x2ad8bd]['orderBy']&&_0x532e06[_0x7880('0x3a')](_0x18a4ff,_0x5625e6[_0x2ad8bd][_0x7880('0x7a')]===_0x7880('0x7b')?![]:!![]);_0x532e06[_0x7880('0x6c')](_0x18a4ff,_0x5625e6[_0x2ad8bd][_0x7880('0x7c')]||_0x18a4ff);}if(_0xd16dea[_0x7880('0x7d')]){_0xd16dea[_0x7880('0x7d')]=JSON[_0x7880('0x7e')](_0xd16dea[_0x7880('0x7d')]);for(var _0x1067e3=0x0;_0x1067e3<_0xd16dea[_0x7880('0x7d')][_0x7880('0x37')];_0x1067e3+=0x1){if(_0xd16dea[_0x7880('0x7d')][_0x1067e3][_0x7880('0x40')]&&_['includes'](_0x2b48b2,_0xd16dea[_0x7880('0x7d')][_0x1067e3][_0x7880('0x40')])&&_0xd16dea[_0x7880('0x7d')][_0x1067e3][_0x7880('0x7f')]&&_0xd16dea['joins'][_0x1067e3][_0x7880('0x80')]&&_0xd16dea[_0x7880('0x7d')][_0x1067e3][_0x7880('0x81')]){_0x532e06[_0xd16dea[_0x7880('0x7d')][_0x1067e3]['type']](_0xd16dea[_0x7880('0x7d')][_0x1067e3][_0x7880('0x80')],null,util['format'](_0x7880('0x82'),_0xd16dea[_0x7880('0x76')],_0xd16dea[_0x7880('0x7d')][_0x1067e3]['parentKey'],_0xd16dea[_0x7880('0x7d')][_0x1067e3][_0x7880('0x80')],_0xd16dea[_0x7880('0x7d')][_0x1067e3][_0x7880('0x81')]));}}}if(_0xd16dea[_0x7880('0x83')]){_0xd16dea[_0x7880('0x83')]=JSON[_0x7880('0x7e')](_0xd16dea[_0x7880('0x83')]);_0x532e06['where'](_0x43f96e(_0xd16dea[_0x7880('0x83')][_0x7880('0x6b')]));}_0x4862fc=_0x532e06['clone']();_0x532e06['limit'](_0x513791);_0x532e06['offset'](0x0);logger[_0x7880('0x84')](_0x7880('0x85'),_0x532e06[_0x7880('0x86')]());return dbH['sequelize'][_0x7880('0x33')](_0x532e06[_0x7880('0x86')](),{'type':dbH[_0x7880('0x87')][_0x7880('0x88')]['SELECT']});}})['then'](respondWithResult(_0x4e0fd9,null))['catch'](handleError(_0x4e0fd9,null));};function runReport(_0x56bfc2,_0xcbc80c,_0x3d2aff){var _0x30bbff=_0xcbc80c[_0x7880('0x2b')];var _0x11c84c=0xa;var _0x21748a=[_0x7880('0x59'),'left_join',_0x7880('0x5b'),_0x7880('0x5c')];var _0x874188={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7880('0x5d'),'MAX':'MAX(%s)','MIN':_0x7880('0x89'),'AVG':_0x7880('0x5f'),'GROUP_CONCAT':_0x7880('0x8a'),'GROUP_CONCAT ASC':_0x7880('0x60'),'GROUP_CONCAT DESC':_0x7880('0x61')};var _0x1bd855={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x7880('0x8b'),'UNIX_TIMESTAMP':_0x7880('0x64')};var _0x568d46=function(_0xe6dfaa){return!_[_0x7880('0x65')]([_0x7880('0x66'),_0x7880('0x67'),'IS\x20EMPTY',_0x7880('0x68')],_0xe6dfaa);};var _0x589f36=function(_0x71c586){if(!_0x71c586||!_0x71c586[_0x7880('0x69')][_0x7880('0x37')]){return'';}for(var _0x52a4d5='(',_0x301632=0x0;_0x301632<_0x71c586[_0x7880('0x69')]['length'];_0x301632+=0x1){_0x301632>0x0&&(_0x52a4d5+='\x20'+_0x71c586['operator']+'\x20');_0x52a4d5+=_0x71c586['rules'][_0x301632][_0x7880('0x6b')]?_0x589f36(_0x71c586[_0x7880('0x69')][_0x301632][_0x7880('0x6b')]):_0x71c586[_0x7880('0x69')][_0x301632][_0x7880('0x6c')]+'\x20'+_0x71c586[_0x7880('0x69')][_0x301632][_0x7880('0x6d')]+(_0x568d46(_0x71c586[_0x7880('0x69')][_0x301632][_0x7880('0x6d')])?'\x20'+_0x71c586['rules'][_0x301632][_0x7880('0x6e')]:'');}return _0x52a4d5+')';};var _0x2c6903={'where':{'id':_0x56bfc2['id']}},_0x5ee7f4,_0x222b6e,_0x359fac,_0xb53bd5,_0x5c21c0;_0x2c6903=_[_0x7880('0x42')]({},_0x2c6903,_0x3d2aff);return db['AnalyticCustomReport']['find'](_0x2c6903)['then'](function(_0x8135b9){if(_0x8135b9){_0x5ee7f4=_0x8135b9;return _0x8135b9[_0x7880('0x6f')]();}return null;})[_0x7880('0x24')](function(_0x1a8f15){if(_0x1a8f15){if(!_0x1a8f15[_0x7880('0x37')]){throw new db[(_0x7880('0x70'))][(_0x7880('0x8c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x222b6e=_0x1a8f15;return db[_0x7880('0x72')][_0x7880('0x46')]({'raw':!![]});}return null;})[_0x7880('0x24')](function(_0x86cd6){if(_0x86cd6){_0x359fac=_[_0x7880('0x73')](_0x86cd6,'id');var _0x29d7a7;var _0xc5d8b7=squel[_0x7880('0x74')]();_0xc5d8b7[_0x7880('0x75')](_0x5ee7f4[_0x7880('0x76')]);for(var _0x5266a6=0x0;_0x5266a6<_0x222b6e[_0x7880('0x37')];_0x5266a6+=0x1){_0x29d7a7=_0x222b6e[_0x5266a6][_0x7880('0x8d')]?_0x359fac[_0x222b6e[_0x5266a6]['MetricId']][_0x7880('0x77')]:_0x222b6e[_0x5266a6][_0x7880('0x6c')];_0x29d7a7=_0x222b6e[_0x5266a6][_0x7880('0x8e')]?_[_0x7880('0x78')](_0x874188[_0x222b6e[_0x5266a6]['function']],'%s',_0x29d7a7):_0x29d7a7;_0x29d7a7=_0x222b6e[_0x5266a6]['format']?_[_0x7880('0x78')](_0x1bd855[_0x222b6e[_0x5266a6][_0x7880('0x8f')]],'%s',_0x29d7a7):_0x29d7a7;if(_0x222b6e[_0x5266a6]['groupBy']){_0xc5d8b7[_0x7880('0x6b')](_0x29d7a7);}_0x222b6e[_0x5266a6][_0x7880('0x7a')]&&_0xc5d8b7['order'](_0x29d7a7,_0x222b6e[_0x5266a6]['orderBy']===_0x7880('0x7b')?![]:!![]);_0xc5d8b7[_0x7880('0x6c')](_0x29d7a7,_0x222b6e[_0x5266a6][_0x7880('0x7c')]||_0x29d7a7);}if(_0x5ee7f4[_0x7880('0x7d')]){_0x5ee7f4[_0x7880('0x7d')]=JSON[_0x7880('0x7e')](_0x5ee7f4[_0x7880('0x7d')]);for(var _0x3e9670=0x0;_0x3e9670<_0x5ee7f4[_0x7880('0x7d')]['length'];_0x3e9670+=0x1){if(_0x5ee7f4[_0x7880('0x7d')][_0x3e9670][_0x7880('0x40')]&&_[_0x7880('0x65')](_0x21748a,_0x5ee7f4[_0x7880('0x7d')][_0x3e9670]['type'])&&_0x5ee7f4['joins'][_0x3e9670][_0x7880('0x7f')]&&_0x5ee7f4[_0x7880('0x7d')][_0x3e9670]['foreignTable']&&_0x5ee7f4[_0x7880('0x7d')][_0x3e9670][_0x7880('0x81')]){_0xc5d8b7[_0x5ee7f4[_0x7880('0x7d')][_0x3e9670][_0x7880('0x40')]](_0x5ee7f4[_0x7880('0x7d')][_0x3e9670]['foreignTable'],null,util[_0x7880('0x8f')](_0x7880('0x82'),_0x5ee7f4[_0x7880('0x76')],_0x5ee7f4['joins'][_0x3e9670][_0x7880('0x7f')],_0x5ee7f4['joins'][_0x3e9670][_0x7880('0x80')],_0x5ee7f4[_0x7880('0x7d')][_0x3e9670][_0x7880('0x81')]));}}}if(_0x5ee7f4[_0x7880('0x83')]){_0x5ee7f4['conditions']=JSON[_0x7880('0x7e')](_0x5ee7f4['conditions']);_0xc5d8b7[_0x7880('0x3c')](_0x589f36(_0x5ee7f4['conditions'][_0x7880('0x6b')]));}_0x5c21c0=_0xc5d8b7['clone']();_0xc5d8b7[_0x7880('0x1d')](_0x11c84c);_0xc5d8b7[_0x7880('0x1b')](0x0);return;}})['then'](function(){if(_0xcbc80c['output']===_0x7880('0x90')){return null;}var _0xcf5aff=_[_0x7880('0x42')](_0xcbc80c,{'name':_0xcbc80c[_0x7880('0x91')]||_0xcbc80c[_0x7880('0x2b')]||_0x5ee7f4['name'],'basename':_0x30bbff,'savename':util[_0x7880('0x8f')](_0x7880('0x92'),_0xcbc80c[_0x7880('0x2b')]||_0x5ee7f4['name'],require('randomstring')[_0x7880('0x93')](0x4),_0xcbc80c[_0x7880('0x94')]||_0x7880('0x95')),'reportId':_0x5ee7f4['id'],'reportType':_0x7880('0x96')});return db['AnalyticExtractedReport'][_0x7880('0x4d')](_0xcf5aff,{'raw':!![]});})[_0x7880('0x24')](function(_0x372839){if(_0x5ee7f4[_0x7880('0x76')]===_0x7880('0x97')){_0x5c21c0[_0x7880('0x3c')](_0x5ee7f4[_0x7880('0x76')]+_0x7880('0x98'),_0xcbc80c['startDate'],_0xcbc80c[_0x7880('0x99')]);}else{_0x5c21c0['where'](_0x5ee7f4['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xcbc80c[_0x7880('0x9a')],_0xcbc80c[_0x7880('0x99')]);}if(_0x372839){logger['info'](_0x7880('0x9b'),_0x5c21c0[_0x7880('0x86')]());require(_0x7880('0x9c'))[_0x7880('0x9d')](path[_0x7880('0x59')](__dirname,'../../components/export/',_0x372839['output']),[_0x372839['id'],_0x5c21c0[_0x7880('0x86')](),path[_0x7880('0x59')](__dirname,_0x7880('0x9e'),_0x372839[_0x7880('0x9f')]),_0x30bbff]);return _0x372839;}else{var _0x32cfc7=squel['select']();_0x32cfc7[_0x7880('0x75')]('('+_0x5c21c0[_0x7880('0x86')]()+')',_0x7880('0xa0'));_0x32cfc7['field']('COUNT(*)',_0x7880('0x1e'));_0x5c21c0[_0x7880('0x1d')](_0xcbc80c['limit']||_0x11c84c);_0x5c21c0[_0x7880('0x1b')](_0xcbc80c[_0x7880('0x1b')]||0x0);return dbH[_0x7880('0x87')][_0x7880('0x33')](_0x32cfc7[_0x7880('0x86')](),{'type':dbH[_0x7880('0x87')][_0x7880('0x88')]['SELECT']})[_0x7880('0x24')](function(_0x1f9fee){if(!_0x1f9fee[_0x7880('0x37')]){_0xb53bd5=0x0;}else{_0xb53bd5=_0x1f9fee[0x0]['count']||0x0;}return dbH['sequelize'][_0x7880('0x33')](_0x5c21c0[_0x7880('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x7880('0xa1')]});})[_0x7880('0x24')](function(_0x43dd30){return{'rows':_0x43dd30||[],'count':_0xb53bd5};});}});}exports[_0x7880('0xa2')]=function(_0x3cdf23,_0x2a273d){return runReport(_0x3cdf23[_0x7880('0x49')],_0x3cdf23[_0x7880('0x33')],_0x3cdf23[_0x7880('0x43')])[_0x7880('0x24')](respondWithResult(_0x2a273d,null))[_0x7880('0x4c')](handleError(_0x2a273d,null));};exports[_0x7880('0xa3')]=runReport;exports[_0x7880('0x33')]=function(_0x4fd42c,_0x18b729){var _0x2c8cf8=0xa;var _0x285d67=['join',_0x7880('0x5a'),'right_join',_0x7880('0x5c')];var _0x3d26a7={'SUM':_0x7880('0xa4'),'COUNT':_0x7880('0xa5'),'COUNT DISTINCT':_0x7880('0x5d'),'MAX':'MAX(%s)','MIN':_0x7880('0x89'),'AVG':_0x7880('0x5f'),'GROUP_CONCAT':_0x7880('0x8a'),'GROUP_CONCAT ASC':_0x7880('0x60'),'GROUP_CONCAT DESC':_0x7880('0x61')};var _0x290e53={'SEC_TO_TIME':_0x7880('0xa6'),'DATE':_0x7880('0x62'),'HOUR':_0x7880('0x63'),'ROUND':_0x7880('0x8b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x43eabd=function(_0x473808){return!_[_0x7880('0x65')]([_0x7880('0x66'),_0x7880('0x67'),_0x7880('0xa7'),_0x7880('0x68')],_0x473808);};var _0x2ec27d=function(_0x5a24ec){if(!_0x5a24ec||!_0x5a24ec[_0x7880('0x69')][_0x7880('0x37')]){return'';}for(var _0x5aa8a7='(',_0x4eeb7e=0x0;_0x4eeb7e<_0x5a24ec[_0x7880('0x69')][_0x7880('0x37')];_0x4eeb7e+=0x1){_0x4eeb7e>0x0&&(_0x5aa8a7+='\x20'+_0x5a24ec[_0x7880('0x6a')]+'\x20');_0x5aa8a7+=_0x5a24ec[_0x7880('0x69')][_0x4eeb7e][_0x7880('0x6b')]?_0x2ec27d(_0x5a24ec[_0x7880('0x69')][_0x4eeb7e]['group']):_0x5a24ec[_0x7880('0x69')][_0x4eeb7e]['field']+'\x20'+_0x5a24ec[_0x7880('0x69')][_0x4eeb7e][_0x7880('0x6d')]+(_0x43eabd(_0x5a24ec[_0x7880('0x69')][_0x4eeb7e]['condition'])?'\x20'+_0x5a24ec['rules'][_0x4eeb7e]['value']:'');}return _0x5aa8a7+')';};var _0x9c4245={'where':{'id':_0x4fd42c[_0x7880('0x49')]['id']}},_0x23778f,_0x5d286c,_0xa2ef4c,_0x2306a8,_0x299939;_0x9c4245=_['merge']({},_0x9c4245,_0x4fd42c[_0x7880('0x43')]);return db[_0x7880('0x2e')]['find'](_0x9c4245)['then'](function(_0x522bac){if(_0x522bac){_0x23778f=_0x522bac;return _0x522bac[_0x7880('0x6f')]();}return null;})[_0x7880('0x24')](function(_0x42c0aa){if(_0x42c0aa){if(!_0x42c0aa[_0x7880('0x37')]){throw new db[(_0x7880('0x70'))][(_0x7880('0x8c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5d286c=_0x42c0aa;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x4e4824){if(_0x4e4824){_0xa2ef4c=_[_0x7880('0x73')](_0x4e4824,'id');var _0x148f86;var _0x704bff=squel[_0x7880('0x74')]();_0x704bff[_0x7880('0x75')](_0x23778f[_0x7880('0x76')]);for(var _0x3fe7a4=0x0;_0x3fe7a4<_0x5d286c['length'];_0x3fe7a4+=0x1){_0x148f86=_0x5d286c[_0x3fe7a4][_0x7880('0x8d')]?_0xa2ef4c[_0x5d286c[_0x3fe7a4][_0x7880('0x8d')]][_0x7880('0x77')]:_0x5d286c[_0x3fe7a4]['field'];_0x148f86=_0x5d286c[_0x3fe7a4]['function']?_[_0x7880('0x78')](_0x3d26a7[_0x5d286c[_0x3fe7a4][_0x7880('0x8e')]],'%s',_0x148f86):_0x148f86;_0x148f86=_0x5d286c[_0x3fe7a4]['format']?_[_0x7880('0x78')](_0x290e53[_0x5d286c[_0x3fe7a4][_0x7880('0x8f')]],'%s',_0x148f86):_0x148f86;if(_0x5d286c[_0x3fe7a4][_0x7880('0x79')]){_0x704bff[_0x7880('0x6b')](_0x148f86);}_0x5d286c[_0x3fe7a4]['orderBy']&&_0x704bff[_0x7880('0x3a')](_0x148f86,_0x5d286c[_0x3fe7a4][_0x7880('0x7a')]==='DESC'?![]:!![]);_0x704bff[_0x7880('0x6c')](_0x148f86,_0x5d286c[_0x3fe7a4][_0x7880('0x7c')]||_0x148f86);}if(_0x23778f[_0x7880('0x7d')]){_0x23778f[_0x7880('0x7d')]=JSON[_0x7880('0x7e')](_0x23778f[_0x7880('0x7d')]);for(var _0x1dc852=0x0;_0x1dc852<_0x23778f[_0x7880('0x7d')][_0x7880('0x37')];_0x1dc852+=0x1){if(_0x23778f[_0x7880('0x7d')][_0x1dc852][_0x7880('0x40')]&&_['includes'](_0x285d67,_0x23778f[_0x7880('0x7d')][_0x1dc852][_0x7880('0x40')])&&_0x23778f[_0x7880('0x7d')][_0x1dc852][_0x7880('0x7f')]&&_0x23778f[_0x7880('0x7d')][_0x1dc852]['foreignTable']&&_0x23778f[_0x7880('0x7d')][_0x1dc852]['foreignKey']){_0x704bff[_0x23778f[_0x7880('0x7d')][_0x1dc852][_0x7880('0x40')]](_0x23778f['joins'][_0x1dc852][_0x7880('0x80')],null,util[_0x7880('0x8f')](_0x7880('0x82'),_0x23778f[_0x7880('0x76')],_0x23778f['joins'][_0x1dc852][_0x7880('0x7f')],_0x23778f[_0x7880('0x7d')][_0x1dc852][_0x7880('0x80')],_0x23778f[_0x7880('0x7d')][_0x1dc852][_0x7880('0x81')]));}}}if(_0x23778f['conditions']){_0x23778f[_0x7880('0x83')]=JSON[_0x7880('0x7e')](_0x23778f[_0x7880('0x83')]);_0x704bff[_0x7880('0x3c')](_0x2ec27d(_0x23778f[_0x7880('0x83')][_0x7880('0x6b')]));}_0x299939=_0x704bff['clone']();_0x704bff[_0x7880('0x1d')](_0x2c8cf8);_0x704bff[_0x7880('0x1b')](0x0);logger['debug'](_0x7880('0x85'),_0x704bff[_0x7880('0x86')]());return dbH['sequelize'][_0x7880('0x33')](_0x704bff[_0x7880('0x86')](),{'type':dbH[_0x7880('0x87')]['QueryTypes'][_0x7880('0xa1')]});}})[_0x7880('0x24')](function(){return{'sql':_0x299939['toString']()};})[_0x7880('0x24')](respondWithResult(_0x18b729,null))[_0x7880('0x4c')](handleError(_0x18b729,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 03016a5..579ceca 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 _0x1a00=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api'];(function(_0x55f549,_0x4f90ac){var _0x589a78=function(_0x4b2cc3){while(--_0x4b2cc3){_0x55f549['push'](_0x55f549['shift']());}};_0x589a78(++_0x4f90ac);}(_0x1a00,0x169));var _0x01a0=function(_0x8034fa,_0x210668){_0x8034fa=_0x8034fa-0x0;var _0x1465e5=_0x1a00[_0x8034fa];return _0x1465e5;};'use strict';var _=require(_0x01a0('0x0'));var util=require('util');var logger=require(_0x01a0('0x1'))(_0x01a0('0x2'));var moment=require(_0x01a0('0x3'));var BPromise=require(_0x01a0('0x4'));var rp=require(_0x01a0('0x5'));var fs=require('fs');var path=require(_0x01a0('0x6'));var rimraf=require(_0x01a0('0x7'));var config=require(_0x01a0('0x8'));var attributes=require(_0x01a0('0x9'));module[_0x01a0('0xa')]=function(_0x3b7e53,_0x24c195){return _0x3b7e53[_0x01a0('0xb')](_0x01a0('0xc'),attributes,{'tableName':_0x01a0('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdf6=['moment','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api'];(function(_0x4ba7bf,_0x437bad){var _0x26fd1d=function(_0x35d056){while(--_0x35d056){_0x4ba7bf['push'](_0x4ba7bf['shift']());}};_0x26fd1d(++_0x437bad);}(_0xfdf6,0x105));var _0x6fdf=function(_0x5b4ef4,_0x3c4308){_0x5b4ef4=_0x5b4ef4-0x0;var _0x5da06d=_0xfdf6[_0x5b4ef4];return _0x5da06d;};'use strict';var _=require('lodash');var util=require(_0x6fdf('0x0'));var logger=require(_0x6fdf('0x1'))(_0x6fdf('0x2'));var moment=require(_0x6fdf('0x3'));var BPromise=require(_0x6fdf('0x4'));var rp=require(_0x6fdf('0x5'));var fs=require('fs');var path=require(_0x6fdf('0x6'));var rimraf=require('rimraf');var config=require(_0x6fdf('0x7'));var attributes=require(_0x6fdf('0x8'));module['exports']=function(_0x2fa45a,_0x2cc385){return _0x2fa45a[_0x6fdf('0x9')](_0x6fdf('0xa'),attributes,{'tableName':_0x6fdf('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 176ed45..38a4d66 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 _0xce0e=['info','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xce0e,0x9c));var _0xece0=function(_0x46d693,_0x21af81){_0x46d693=_0x46d693-0x0;var _0x5452db=_0xce0e[_0x46d693];return _0x5452db;};'use strict';var _=require(_0xece0('0x0'));var util=require('util');var moment=require(_0xece0('0x1'));var BPromise=require(_0xece0('0x2'));var rs=require(_0xece0('0x3'));var fs=require('fs');var Redis=require(_0xece0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xece0('0x5'));var logger=require('../../config/logger')(_0xece0('0x6'));var config=require(_0xece0('0x7'));var jayson=require(_0xece0('0x8'));var client=jayson[_0xece0('0x9')][_0xece0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54a67f,_0x292f33,_0x1f9441){return new BPromise(function(_0x25909b,_0x412a70){return client['request'](_0x54a67f,_0x1f9441)[_0xece0('0xb')](function(_0x502106){logger['info'](_0xece0('0xc'),_0x292f33,_0xece0('0xd'));logger[_0xece0('0xe')](_0xece0('0xf'),_0x292f33,_0xece0('0xd'),JSON[_0xece0('0x10')](_0x502106));if(_0x502106[_0xece0('0x11')]){if(_0x502106[_0xece0('0x11')][_0xece0('0x12')]===0x1f4){logger[_0xece0('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x292f33,_0x502106['error']['message']);return _0x412a70(_0x502106[_0xece0('0x11')][_0xece0('0x13')]);}logger['error'](_0xece0('0xc'),_0x292f33,_0x502106[_0xece0('0x11')][_0xece0('0x13')]);return _0x25909b(_0x502106[_0xece0('0x11')][_0xece0('0x13')]);}else{logger[_0xece0('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x292f33,'request\x20sent');_0x25909b(_0x502106[_0xece0('0x15')]['message']);}})['catch'](function(_0x4ecd49){logger[_0xece0('0x11')](_0xece0('0xc'),_0x292f33,_0x4ecd49);_0x412a70(_0x4ecd49);});});} \ No newline at end of file +var _0x96aa=['message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x1b5861,_0x2ebf04){var _0x1f46e6=function(_0x104914){while(--_0x104914){_0x1b5861['push'](_0x1b5861['shift']());}};_0x1f46e6(++_0x2ebf04);}(_0x96aa,0x75));var _0xa96a=function(_0x2c1b9f,_0x4d122b){_0x2c1b9f=_0x2c1b9f-0x0;var _0x46d07e=_0x96aa[_0x2c1b9f];return _0x46d07e;};'use strict';var _=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var moment=require(_0xa96a('0x2'));var BPromise=require(_0xa96a('0x3'));var rs=require(_0xa96a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa96a('0x5'))['db'];var utils=require(_0xa96a('0x6'));var logger=require(_0xa96a('0x7'))(_0xa96a('0x8'));var config=require(_0xa96a('0x9'));var jayson=require(_0xa96a('0xa'));var client=jayson[_0xa96a('0xb')][_0xa96a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c1de1,_0x4ec852,_0x47825d){return new BPromise(function(_0x2ea0ee,_0x542f93){return client['request'](_0x5c1de1,_0x47825d)['then'](function(_0x22415a){logger[_0xa96a('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4ec852,'request\x20sent');logger[_0xa96a('0xe')](_0xa96a('0xf'),_0x4ec852,_0xa96a('0x10'),JSON[_0xa96a('0x11')](_0x22415a));if(_0x22415a['error']){if(_0x22415a['error'][_0xa96a('0x12')]===0x1f4){logger[_0xa96a('0x13')](_0xa96a('0x14'),_0x4ec852,_0x22415a[_0xa96a('0x13')][_0xa96a('0x15')]);return _0x542f93(_0x22415a['error']['message']);}logger[_0xa96a('0x13')](_0xa96a('0x14'),_0x4ec852,_0x22415a[_0xa96a('0x13')]['message']);return _0x2ea0ee(_0x22415a[_0xa96a('0x13')][_0xa96a('0x15')]);}else{logger[_0xa96a('0xd')](_0xa96a('0x14'),_0x4ec852,_0xa96a('0x10'));_0x2ea0ee(_0x22415a[_0xa96a('0x16')][_0xa96a('0x15')]);}})['catch'](function(_0x109762){logger[_0xa96a('0x13')](_0xa96a('0x14'),_0x4ec852,_0x109762);_0x542f93(_0x109762);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 5a47b13..f3e6b9e 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 _0xe1aa=['run','/:id/query','query','post','/:id','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','get','/:id/run'];(function(_0x5c9afe,_0x2d1d03){var _0xfb727c=function(_0xdada09){while(--_0xdada09){_0x5c9afe['push'](_0x5c9afe['shift']());}};_0xfb727c(++_0x2d1d03);}(_0xe1aa,0x15d));var _0xae1a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe1aa[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xae1a('0x0'));var util=require(_0xae1a('0x1'));var path=require('path');var timeout=require(_0xae1a('0x2'));var express=require(_0xae1a('0x3'));var router=express[_0xae1a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xae1a('0x5'));var interaction=require(_0xae1a('0x6'));var config=require(_0xae1a('0x7'));var controller=require(_0xae1a('0x8'));router['get']('/',auth[_0xae1a('0x9')](),controller['index']);router[_0xae1a('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xae1a('0xa')]('/:id/preview',auth['isAuthenticated'](),controller['preview']);router[_0xae1a('0xa')](_0xae1a('0xb'),auth[_0xae1a('0x9')](),controller[_0xae1a('0xc')]);router[_0xae1a('0xa')](_0xae1a('0xd'),auth[_0xae1a('0x9')](),controller[_0xae1a('0xe')]);router[_0xae1a('0xf')]('/',auth[_0xae1a('0x9')](),controller['create']);router['put'](_0xae1a('0x10'),auth[_0xae1a('0x9')](),controller['update']);router[_0xae1a('0x11')]('/:id',auth[_0xae1a('0x9')](),controller['destroy']);module[_0xae1a('0x12')]=router; \ No newline at end of file +var _0xee6f=['query','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','preview','/:id/run','run','/:id/query'];(function(_0x1647d2,_0x3ec152){var _0xd766d9=function(_0x3bdff7){while(--_0x3bdff7){_0x1647d2['push'](_0x1647d2['shift']());}};_0xd766d9(++_0x3ec152);}(_0xee6f,0x6b));var _0xfee6=function(_0x452af7,_0x993b24){_0x452af7=_0x452af7-0x0;var _0x16a885=_0xee6f[_0x452af7];return _0x16a885;};'use strict';var multer=require(_0xfee6('0x0'));var util=require(_0xfee6('0x1'));var path=require(_0xfee6('0x2'));var timeout=require(_0xfee6('0x3'));var express=require('express');var router=express[_0xfee6('0x4')]();var fs_extra=require(_0xfee6('0x5'));var auth=require(_0xfee6('0x6'));var interaction=require(_0xfee6('0x7'));var config=require(_0xfee6('0x8'));var controller=require(_0xfee6('0x9'));router[_0xfee6('0xa')]('/',auth[_0xfee6('0xb')](),controller[_0xfee6('0xc')]);router[_0xfee6('0xa')](_0xfee6('0xd'),auth[_0xfee6('0xb')](),controller['show']);router[_0xfee6('0xa')]('/:id/preview',auth[_0xfee6('0xb')](),controller[_0xfee6('0xe')]);router[_0xfee6('0xa')](_0xfee6('0xf'),auth[_0xfee6('0xb')](),controller[_0xfee6('0x10')]);router['get'](_0xfee6('0x11'),auth[_0xfee6('0xb')](),controller[_0xfee6('0x12')]);router[_0xfee6('0x13')]('/',auth[_0xfee6('0xb')](),controller['create']);router[_0xfee6('0x14')](_0xfee6('0xd'),auth['isAuthenticated'](),controller[_0xfee6('0x15')]);router[_0xfee6('0x16')](_0xfee6('0xd'),auth['isAuthenticated'](),controller[_0xfee6('0x17')]);module[_0xfee6('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index f26f423..951d018 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 _0xb4c7=['STRING','TEXT','sequelize','exports'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x58c129,_0x88288a){_0x58c129=_0x58c129-0x0;var _0x247667=_0xb4c7[_0x58c129];return _0x247667;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'name':{'type':Sequelize[_0x7b4c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b4c('0x2')]},'parent':{'type':Sequelize[_0x7b4c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7b4c('0x3')]},'joins':{'type':Sequelize[_0x7b4c('0x3')]}}; \ No newline at end of file +var _0x53ec=['STRING','TEXT','sequelize','exports'];(function(_0x48d7ce,_0x1afb31){var _0x4d82b4=function(_0x2d4e5f){while(--_0x2d4e5f){_0x48d7ce['push'](_0x48d7ce['shift']());}};_0x4d82b4(++_0x1afb31);}(_0x53ec,0x192));var _0xc53e=function(_0x193bef,_0x229b65){_0x193bef=_0x193bef-0x0;var _0x4c725e=_0x53ec[_0x193bef];return _0x4c725e;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc53e('0x2')]},'parent':{'type':Sequelize[_0xc53e('0x2')]},'table':{'type':Sequelize[_0xc53e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xc53e('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 4733205..354f252 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 _0x46ed=['SEC_TO_TIME(%s)','value','AnalyticMetric','select','DESC','output','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','sequelize','runReport','left_join','COUNT(%s)','MIN(%s)','AVG(%s)','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','QueryTypes','SELECT'];(function(_0x1f8999,_0x58ef02){var _0x4a4d99=function(_0x3ed847){while(--_0x3ed847){_0x1f8999['push'](_0x1f8999['shift']());}};_0x4a4d99(++_0x58ef02);}(_0x46ed,0x168));var _0xd46e=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x46ed[_0x49b207];return _0x2dc8fa;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xf3048c,_0x27dbfb){_0x27dbfb=_0x27dbfb||0xcc;return function(_0x53b309){if(_0x53b309){return _0xf3048c['sendStatus'](_0x27dbfb);}return _0xf3048c[_0xd46e('0x1a')](_0x27dbfb)[_0xd46e('0x1b')]();};}function respondWithResult(_0x1e9aae,_0x3fdf88){_0x3fdf88=_0x3fdf88||0xc8;return function(_0x50c7c3){if(_0x50c7c3){return _0x1e9aae[_0xd46e('0x1a')](_0x3fdf88)[_0xd46e('0x1c')](_0x50c7c3);}};}function respondWithFilteredResult(_0x417402,_0x3d72ce){return function(_0x36a317){if(_0x36a317){var _0x47fa8f=typeof _0x3d72ce[_0xd46e('0x1d')]===_0xd46e('0x1e')&&typeof _0x3d72ce[_0xd46e('0x1f')]==='undefined';var _0x5ddd04=_0x36a317[_0xd46e('0x20')];var _0x1bd574=_0x47fa8f?0x0:_0x3d72ce['offset'];var _0x4fd1f2=_0x47fa8f?_0x36a317[_0xd46e('0x20')]:_0x3d72ce[_0xd46e('0x1d')]+_0x3d72ce[_0xd46e('0x1f')];var _0x2273c5;if(_0x4fd1f2>=_0x5ddd04){_0x4fd1f2=_0x5ddd04;_0x2273c5=0xc8;}else{_0x2273c5=0xce;}_0x417402[_0xd46e('0x1a')](_0x2273c5);return _0x417402[_0xd46e('0x21')](_0xd46e('0x22'),_0x1bd574+'-'+_0x4fd1f2+'/'+_0x5ddd04)[_0xd46e('0x1c')](_0x36a317);}return null;};}function patchUpdates(_0xb4940){return function(_0x3c7e91){try{jsonpatch[_0xd46e('0x23')](_0x3c7e91,_0xb4940,!![]);}catch(_0x5ba94d){return BPromise[_0xd46e('0x24')](_0x5ba94d);}return _0x3c7e91[_0xd46e('0x25')]();};}function saveUpdates(_0x79aa51,_0x45ce0b){return function(_0x128246){if(_0x128246){return _0x128246[_0xd46e('0x26')](_0x79aa51)[_0xd46e('0x27')](function(_0x8a1be){return _0x8a1be;});}return null;};}function removeEntity(_0x62dea5,_0x4cf899){return function(_0x314570){if(_0x314570){return _0x314570['destroy']()['then'](function(){var _0x371054=_0x314570[_0xd46e('0x28')]({'plain':!![]});var _0x21135f=_0xd46e('0x29');return db[_0xd46e('0x2a')][_0xd46e('0x2b')]({'where':{'type':_0x21135f,'resourceId':_0x371054['id']}})[_0xd46e('0x27')](function(){return _0x314570;});})['then'](function(){_0x62dea5[_0xd46e('0x1a')](0xcc)[_0xd46e('0x1b')]();});}};}function handleEntityNotFound(_0xddbce9,_0x17db79){return function(_0x96f15c){if(!_0x96f15c){_0xddbce9[_0xd46e('0x2c')](0x194);}return _0x96f15c;};}function handleError(_0x58aeef,_0x465d54){_0x465d54=_0x465d54||0x1f4;return function(_0x3a1ced){logger[_0xd46e('0x2d')](_0x3a1ced[_0xd46e('0x2e')]);if(_0x3a1ced[_0xd46e('0x2f')]){delete _0x3a1ced[_0xd46e('0x2f')];}_0x58aeef[_0xd46e('0x1a')](_0x465d54)[_0xd46e('0x30')](_0x3a1ced);};}exports[_0xd46e('0x31')]=function(_0x45ea47,_0x2ff785){var _0x504324={},_0x2f4a1b={},_0x5ed8dc={'count':0x0,'rows':[]};var _0x1248ce=_[_0xd46e('0x32')](db[_0xd46e('0x33')][_0xd46e('0x34')],function(_0x5ef248){return{'name':_0x5ef248[_0xd46e('0x35')],'type':_0x5ef248[_0xd46e('0x36')]['key']};});_0x2f4a1b[_0xd46e('0x37')]=_[_0xd46e('0x32')](_0x1248ce,'name');_0x2f4a1b[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x45ea47[_0xd46e('0x38')]);_0x2f4a1b['filters']=_['intersection'](_0x2f4a1b[_0xd46e('0x37')],_0x2f4a1b[_0xd46e('0x38')]);_0x504324[_0xd46e('0x3a')]=_[_0xd46e('0x3b')](_0x2f4a1b[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x504324['attributes']=_0x504324[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x504324[_0xd46e('0x3a')]:_0x2f4a1b[_0xd46e('0x37')];if(!_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3e')](_0xd46e('0x3f'))){_0x504324['limit']=qs[_0xd46e('0x1f')](_0x45ea47[_0xd46e('0x38')]['limit']);_0x504324[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x1d')]);}_0x504324['order']=qs[_0xd46e('0x40')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x40')]);_0x504324[_0xd46e('0x41')]=qs[_0xd46e('0x42')](_[_0xd46e('0x43')](_0x45ea47[_0xd46e('0x38')],_0x2f4a1b[_0xd46e('0x42')]),_0x1248ce);if(_0x45ea47['query'][_0xd46e('0x44')]){_0x504324[_0xd46e('0x41')]=_[_0xd46e('0x45')](_0x504324[_0xd46e('0x41')],{'$or':_[_0xd46e('0x32')](_0x1248ce,function(_0x56f99c){if(_0x56f99c[_0xd46e('0x36')]!=='VIRTUAL'){var _0x55230d={};_0x55230d[_0x56f99c['name']]={'$like':'%'+_0x45ea47['query'][_0xd46e('0x44')]+'%'};return _0x55230d;}})});}_0x504324=_['merge']({},_0x504324,_0x45ea47[_0xd46e('0x46')]);var _0x40720e={'where':_0x504324['where']};return db[_0xd46e('0x33')][_0xd46e('0x20')](_0x40720e)[_0xd46e('0x27')](function(_0x31ba12){_0x5ed8dc[_0xd46e('0x20')]=_0x31ba12;if(_0x45ea47[_0xd46e('0x38')][_0xd46e('0x47')]){_0x504324[_0xd46e('0x48')]=[{'all':!![]}];}return db[_0xd46e('0x33')][_0xd46e('0x49')](_0x504324);})[_0xd46e('0x27')](function(_0x5ea048){_0x5ed8dc['rows']=_0x5ea048;return _0x5ed8dc;})['then'](respondWithFilteredResult(_0x2ff785,_0x504324))[_0xd46e('0x4a')](handleError(_0x2ff785,null));};exports['show']=function(_0x168d35,_0x272f5f){var _0x3fdf67={'raw':!![],'where':{'id':_0x168d35[_0xd46e('0x4b')]['id']}},_0x416505={};_0x416505[_0xd46e('0x37')]=_[_0xd46e('0x39')](db[_0xd46e('0x33')]['rawAttributes']);_0x416505[_0xd46e('0x38')]=_['keys'](_0x168d35[_0xd46e('0x38')]);_0x416505[_0xd46e('0x42')]=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],_0x416505[_0xd46e('0x38')]);_0x3fdf67['attributes']=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x168d35[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x3fdf67['attributes']=_0x3fdf67[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x3fdf67[_0xd46e('0x3a')]:_0x416505[_0xd46e('0x37')];if(_0x168d35[_0xd46e('0x38')]['includeAll']){_0x3fdf67[_0xd46e('0x48')]=[{'all':!![]}];}_0x3fdf67=_[_0xd46e('0x45')]({},_0x3fdf67,_0x168d35[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fdf67)[_0xd46e('0x27')](handleEntityNotFound(_0x272f5f,null))[_0xd46e('0x27')](respondWithResult(_0x272f5f,null))[_0xd46e('0x4a')](handleError(_0x272f5f,null));};exports['create']=function(_0xf9dab,_0x71a8dc){return db[_0xd46e('0x33')][_0xd46e('0x4d')](_0xf9dab[_0xd46e('0x4e')],{})['then'](function(_0x4ae314){var _0x3a94cf=_0xf9dab[_0xd46e('0x4f')][_0xd46e('0x28')]({'plain':!![]});if(!_0x3a94cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a94cf['role']===_0xd46e('0x4f')){var _0x9d8638=_0x4ae314['get']({'plain':!![]});var _0x2eee92=_0xd46e('0x50');return db[_0xd46e('0x51')][_0xd46e('0x4c')]({'where':{'name':_0x2eee92,'userProfileId':_0x3a94cf[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x27')](function(_0x80ed51){if(_0x80ed51&&_0x80ed51[_0xd46e('0x53')]===0x0){return db['UserProfileResource'][_0xd46e('0x4d')]({'name':_0x9d8638[_0xd46e('0x2f')],'resourceId':_0x9d8638['id'],'type':_0xd46e('0x29'),'sectionId':_0x80ed51['id']},{})[_0xd46e('0x27')](function(){return _0x4ae314;});}else{return _0x4ae314;}})['catch'](function(_0x56dd9a){logger[_0xd46e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56dd9a);throw _0x56dd9a;});}return _0x4ae314;})[_0xd46e('0x27')](respondWithResult(_0x71a8dc,0xc9))[_0xd46e('0x4a')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x26')]=function(_0x31f7eb,_0x5a7870){if(_0x31f7eb[_0xd46e('0x4e')]['id']){delete _0x31f7eb['body']['id'];}return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x31f7eb[_0xd46e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7870,null))[_0xd46e('0x27')](saveUpdates(_0x31f7eb[_0xd46e('0x4e')],null))[_0xd46e('0x27')](respondWithResult(_0x5a7870,null))[_0xd46e('0x4a')](handleError(_0x5a7870,null));};exports[_0xd46e('0x2b')]=function(_0x2cc676,_0x2760ef){return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x2cc676[_0xd46e('0x4b')]['id']}})[_0xd46e('0x27')](handleEntityNotFound(_0x2760ef,null))[_0xd46e('0x27')](removeEntity(_0x2760ef,null))[_0xd46e('0x4a')](handleError(_0x2760ef,null));};exports[_0xd46e('0x54')]=function(_0x47a86c,_0x3ec709){var _0x37a22f=0xa;var _0xe0cd61=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0xaf9641={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x481dce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x2dacb4=function(_0x2f9fcb){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x2f9fcb);};var _0x1aaa99=function(_0x272514){if(!_0x272514||!_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x476f09='(',_0x5067b7=0x0;_0x5067b7<_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')];_0x5067b7+=0x1){_0x5067b7>0x0&&(_0x476f09+='\x20'+_0x272514[_0xd46e('0x68')]+'\x20');_0x476f09+=_0x272514['rules'][_0x5067b7][_0xd46e('0x69')]?_0x1aaa99(_0x272514[_0xd46e('0x67')][_0x5067b7]['group']):_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6a')]+'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['condition']+(_0x2dacb4(_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6b')])?'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['value']:'');}return _0x476f09+')';};var _0xe5f8cd={'where':{'id':_0x47a86c[_0xd46e('0x4b')]['id']}},_0x516e7d,_0x32eed0,_0x148187,_0x35db1b,_0x4f3ba0;_0xe5f8cd=_[_0xd46e('0x45')]({},_0xe5f8cd,_0x47a86c[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0xe5f8cd)[_0xd46e('0x27')](function(_0x16f906){if(_0x16f906){_0x516e7d=_0x16f906;return _0x16f906[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0x3e55a3){if(_0x3e55a3){if(!_0x3e55a3[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))](_0xd46e('0x6f'),0x193);}_0x32eed0=_0x3e55a3;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3e0ed5){if(_0x3e0ed5){_0x148187=_[_0xd46e('0x70')](_0x3e0ed5,'id');var _0x2fff69;var _0x249938=squel['select']();_0x249938[_0xd46e('0x71')](_0x516e7d[_0xd46e('0x72')]);for(var _0xfb4073=0x0;_0xfb4073<_0x32eed0[_0xd46e('0x3d')];_0xfb4073+=0x1){_0x2fff69=_0x32eed0[_0xfb4073]['MetricId']?_0x148187[_0x32eed0[_0xfb4073][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x32eed0[_0xfb4073]['field'];_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0xaf9641[_0x32eed0[_0xfb4073]['function']],'%s',_0x2fff69):_0x2fff69;_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x481dce[_0x32eed0[_0xfb4073]['format']],'%s',_0x2fff69):_0x2fff69;if(_0x32eed0[_0xfb4073][_0xd46e('0x78')]){_0x249938['group'](_0x2fff69);}_0x32eed0[_0xfb4073][_0xd46e('0x79')]&&_0x249938[_0xd46e('0x7a')](_0x2fff69,_0x32eed0[_0xfb4073]['orderBy']==='DESC'?![]:!![]);_0x249938[_0xd46e('0x6a')](_0x2fff69,_0x32eed0[_0xfb4073][_0xd46e('0x7b')]||_0x2fff69);}if(_0x516e7d[_0xd46e('0x7c')]){_0x516e7d[_0xd46e('0x7c')]=JSON['parse'](_0x516e7d[_0xd46e('0x7c')]);for(var _0x372509=0x0;_0x372509<_0x516e7d['joins'][_0xd46e('0x3d')];_0x372509+=0x1){if(_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0xe0cd61,_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')])&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7d')]&&_0x516e7d[_0xd46e('0x7c')][_0x372509]['foreignTable']&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7e')]){_0x249938[_0x516e7d['joins'][_0x372509][_0xd46e('0x36')]](_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0x516e7d[_0xd46e('0x72')],_0x516e7d['joins'][_0x372509]['parentKey'],_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],_0x516e7d['joins'][_0x372509]['foreignKey']));}}}if(_0x516e7d['conditions']){_0x516e7d[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x516e7d[_0xd46e('0x81')]);_0x249938['where'](_0x1aaa99(_0x516e7d[_0xd46e('0x81')][_0xd46e('0x69')]));}_0x4f3ba0=_0x249938[_0xd46e('0x83')]();_0x249938['limit'](_0x37a22f);_0x249938['offset'](0x0);logger['debug']('Limited\x20Query:',_0x249938[_0xd46e('0x84')]());return dbH['sequelize'][_0xd46e('0x38')](_0x249938['toString'](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](respondWithResult(_0x3ec709,null))[_0xd46e('0x4a')](handleError(_0x3ec709,null));};function runReport(_0xf16d87,_0x99872a,_0x57a7cc){var _0x586024=_0x99872a[_0xd46e('0x2f')];var _0x383919=0xa;var _0x114f2c=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0x4ca21f={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x5ef4cc={'SEC_TO_TIME':_0xd46e('0x87'),'DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x88460a=function(_0x3a3744){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x3a3744);};var _0x3c476d=function(_0x1b2a6d){if(!_0x1b2a6d||!_0x1b2a6d[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x441f73='(',_0x1d2738=0x0;_0x1d2738<_0x1b2a6d['rules'][_0xd46e('0x3d')];_0x1d2738+=0x1){_0x1d2738>0x0&&(_0x441f73+='\x20'+_0x1b2a6d['operator']+'\x20');_0x441f73+=_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x69')]?_0x3c476d(_0x1b2a6d['rules'][_0x1d2738][_0xd46e('0x69')]):_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6a')]+'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')]+(_0x88460a(_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')])?'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x88')]:'');}return _0x441f73+')';};var _0x3fa34d={'where':{'id':_0xf16d87['id']}},_0xc098c9,_0x5f5ba7,_0x493df5,_0x18e140,_0x459a0c;_0x3fa34d=_[_0xd46e('0x45')]({},_0x3fa34d,_0x57a7cc);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fa34d)[_0xd46e('0x27')](function(_0x5b554e){if(_0x5b554e){_0xc098c9=_0x5b554e;return _0x5b554e[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0xa254f5){if(_0xa254f5){if(!_0xa254f5[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5f5ba7=_0xa254f5;return db[_0xd46e('0x89')][_0xd46e('0x49')]({'raw':!![]});}return null;})['then'](function(_0x3c8d68){if(_0x3c8d68){_0x493df5=_[_0xd46e('0x70')](_0x3c8d68,'id');var _0x9e222d;var _0x3da17e=squel[_0xd46e('0x8a')]();_0x3da17e[_0xd46e('0x71')](_0xc098c9[_0xd46e('0x72')]);for(var _0x282f71=0x0;_0x282f71<_0x5f5ba7[_0xd46e('0x3d')];_0x282f71+=0x1){_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x73')]?_0x493df5[_0x5f5ba7[_0x282f71][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x5f5ba7[_0x282f71][_0xd46e('0x6a')];_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x75')]?_['replace'](_0x4ca21f[_0x5f5ba7[_0x282f71]['function']],'%s',_0x9e222d):_0x9e222d;_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x5ef4cc[_0x5f5ba7[_0x282f71][_0xd46e('0x77')]],'%s',_0x9e222d):_0x9e222d;if(_0x5f5ba7[_0x282f71][_0xd46e('0x78')]){_0x3da17e[_0xd46e('0x69')](_0x9e222d);}_0x5f5ba7[_0x282f71][_0xd46e('0x79')]&&_0x3da17e['order'](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x3da17e[_0xd46e('0x6a')](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x7b')]||_0x9e222d);}if(_0xc098c9['joins']){_0xc098c9[_0xd46e('0x7c')]=JSON[_0xd46e('0x82')](_0xc098c9['joins']);for(var _0xdf967c=0x0;_0xdf967c<_0xc098c9['joins']['length'];_0xdf967c+=0x1){if(_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x114f2c,_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['type'])&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7d')]&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7f')]&&_0xc098c9['joins'][_0xdf967c]['foreignKey']){_0x3da17e[_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]](_0xc098c9['joins'][_0xdf967c]['foreignTable'],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0xc098c9[_0xd46e('0x72')],_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['parentKey'],_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x7f')],_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7e')]));}}}if(_0xc098c9[_0xd46e('0x81')]){_0xc098c9[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0xc098c9[_0xd46e('0x81')]);_0x3da17e[_0xd46e('0x41')](_0x3c476d(_0xc098c9['conditions'][_0xd46e('0x69')]));}_0x459a0c=_0x3da17e[_0xd46e('0x83')]();_0x3da17e['limit'](_0x383919);_0x3da17e['offset'](0x0);return;}})[_0xd46e('0x27')](function(){if(_0x99872a[_0xd46e('0x8c')]==='web'){return null;}var _0x5e637d=_[_0xd46e('0x45')](_0x99872a,{'name':_0x99872a[_0xd46e('0x8d')]||_0x99872a['name']||_0xc098c9[_0xd46e('0x2f')],'basename':_0x586024,'savename':util[_0xd46e('0x77')](_0xd46e('0x8e'),_0x99872a[_0xd46e('0x2f')]||_0xc098c9[_0xd46e('0x2f')],require(_0xd46e('0x8f'))['generate'](0x4),_0x99872a[_0xd46e('0x8c')]||_0xd46e('0x90')),'reportId':_0xc098c9['id'],'reportType':_0xd46e('0x91')});return db[_0xd46e('0x92')][_0xd46e('0x4d')](_0x5e637d,{'raw':!![]});})[_0xd46e('0x27')](function(_0x3311a6){if(_0xc098c9[_0xd46e('0x72')]===_0xd46e('0x93')){_0x459a0c[_0xd46e('0x41')](_0xc098c9[_0xd46e('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x99872a[_0xd46e('0x94')],_0x99872a['endDate']);}else{_0x459a0c['where'](_0xc098c9[_0xd46e('0x72')]+_0xd46e('0x95'),_0x99872a[_0xd46e('0x94')],_0x99872a[_0xd46e('0x96')]);}if(_0x3311a6){logger[_0xd46e('0x97')](_0xd46e('0x98'),_0x459a0c[_0xd46e('0x84')]());require(_0xd46e('0x99'))['fork'](path[_0xd46e('0x55')](__dirname,'../../components/export/',_0x3311a6[_0xd46e('0x8c')]),[_0x3311a6['id'],_0x459a0c[_0xd46e('0x84')](),path[_0xd46e('0x55')](__dirname,_0xd46e('0x9a'),_0x3311a6[_0xd46e('0x9b')]),_0x586024]);return _0x3311a6;}else{var _0x399918=squel[_0xd46e('0x8a')]();_0x399918[_0xd46e('0x71')]('('+_0x459a0c['toString']()+')',_0xd46e('0x9c'));_0x399918[_0xd46e('0x6a')](_0xd46e('0x9d'),'count');_0x459a0c[_0xd46e('0x1f')](_0x99872a[_0xd46e('0x1f')]||_0x383919);_0x459a0c[_0xd46e('0x1d')](_0x99872a['offset']||0x0);return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x399918[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]})['then'](function(_0x4967ff){if(!_0x4967ff[_0xd46e('0x3d')]){_0x18e140=0x0;}else{_0x18e140=_0x4967ff[0x0][_0xd46e('0x20')]||0x0;}return dbH['sequelize'][_0xd46e('0x38')](_0x459a0c[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]});})[_0xd46e('0x27')](function(_0x4bb76b){return{'rows':_0x4bb76b||[],'count':_0x18e140};});}});}exports['run']=function(_0x204a9f,_0x52ca5a){return runReport(_0x204a9f[_0xd46e('0x4b')],_0x204a9f[_0xd46e('0x38')],_0x204a9f['options'])[_0xd46e('0x27')](respondWithResult(_0x52ca5a,null))[_0xd46e('0x4a')](handleError(_0x52ca5a,null));};exports[_0xd46e('0x9f')]=runReport;exports[_0xd46e('0x38')]=function(_0x786ae,_0x537c73){var _0x1610bd=0xa;var _0x20cc4c=[_0xd46e('0x55'),_0xd46e('0xa0'),_0xd46e('0x56'),_0xd46e('0x57')];var _0x368742={'SUM':_0xd46e('0x58'),'COUNT':_0xd46e('0xa1'),'COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':_0xd46e('0xa2'),'AVG':_0xd46e('0xa3'),'GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x285cf8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc87da2=function(_0x195f02){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),'IS\x20NOT\x20NULL',_0xd46e('0x65'),_0xd46e('0x66')],_0x195f02);};var _0x44322f=function(_0x49959f){if(!_0x49959f||!_0x49959f['rules'][_0xd46e('0x3d')]){return'';}for(var _0x2094e5='(',_0x85aac1=0x0;_0x85aac1<_0x49959f[_0xd46e('0x67')][_0xd46e('0x3d')];_0x85aac1+=0x1){_0x85aac1>0x0&&(_0x2094e5+='\x20'+_0x49959f[_0xd46e('0x68')]+'\x20');_0x2094e5+=_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]?_0x44322f(_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]):_0x49959f['rules'][_0x85aac1][_0xd46e('0x6a')]+'\x20'+_0x49959f['rules'][_0x85aac1]['condition']+(_0xc87da2(_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x6b')])?'\x20'+_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x88')]:'');}return _0x2094e5+')';};var _0x101a29={'where':{'id':_0x786ae[_0xd46e('0x4b')]['id']}},_0x3a44da,_0x417068,_0x52e73e,_0x206077,_0xe729b6;_0x101a29=_[_0xd46e('0x45')]({},_0x101a29,_0x786ae[_0xd46e('0x46')]);return db['AnalyticDefaultReport'][_0xd46e('0x4c')](_0x101a29)[_0xd46e('0x27')](function(_0x1d08bb){if(_0x1d08bb){_0x3a44da=_0x1d08bb;return _0x1d08bb['getFields']();}return null;})[_0xd46e('0x27')](function(_0x8c6ed1){if(_0x8c6ed1){if(!_0x8c6ed1['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xd46e('0x6f'),0x193);}_0x417068=_0x8c6ed1;return db[_0xd46e('0x89')]['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3a13f8){if(_0x3a13f8){_0x52e73e=_['keyBy'](_0x3a13f8,'id');var _0x5a8661;var _0x157fb0=squel[_0xd46e('0x8a')]();_0x157fb0[_0xd46e('0x71')](_0x3a44da[_0xd46e('0x72')]);for(var _0x50750f=0x0;_0x50750f<_0x417068['length'];_0x50750f+=0x1){_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x73')]?_0x52e73e[_0x417068[_0x50750f][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x417068[_0x50750f][_0xd46e('0x6a')];_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0x368742[_0x417068[_0x50750f][_0xd46e('0x75')]],'%s',_0x5a8661):_0x5a8661;_0x5a8661=_0x417068[_0x50750f]['format']?_[_0xd46e('0x76')](_0x285cf8[_0x417068[_0x50750f][_0xd46e('0x77')]],'%s',_0x5a8661):_0x5a8661;if(_0x417068[_0x50750f]['groupBy']){_0x157fb0[_0xd46e('0x69')](_0x5a8661);}_0x417068[_0x50750f][_0xd46e('0x79')]&&_0x157fb0[_0xd46e('0x7a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x157fb0[_0xd46e('0x6a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x7b')]||_0x5a8661);}if(_0x3a44da[_0xd46e('0x7c')]){_0x3a44da['joins']=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x7c')]);for(var _0x3c819b=0x0;_0x3c819b<_0x3a44da[_0xd46e('0x7c')][_0xd46e('0x3d')];_0x3c819b+=0x1){if(_0x3a44da['joins'][_0x3c819b][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x20cc4c,_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')])&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7d')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']){_0x157fb0[_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')]](_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3a44da[_0xd46e('0x72')],_0x3a44da['joins'][_0x3c819b][_0xd46e('0x7d')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']));}}}if(_0x3a44da[_0xd46e('0x81')]){_0x3a44da[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x81')]);_0x157fb0[_0xd46e('0x41')](_0x44322f(_0x3a44da[_0xd46e('0x81')][_0xd46e('0x69')]));}_0xe729b6=_0x157fb0[_0xd46e('0x83')]();_0x157fb0[_0xd46e('0x1f')](_0x1610bd);_0x157fb0['offset'](0x0);logger['debug'](_0xd46e('0xa4'),_0x157fb0['toString']());return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x157fb0[_0xd46e('0x84')](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](function(){return{'sql':_0xe729b6['toString']()};})['then'](respondWithResult(_0x537c73,null))[_0xd46e('0x4a')](handleError(_0x537c73,null));}; \ No newline at end of file +var _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_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)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0x1b0a9d,_0x45a72a){var _0x719225=function(_0x5038d9){while(--_0x5038d9){_0x1b0a9d['push'](_0x1b0a9d['shift']());}};_0x719225(++_0x45a72a);}(_0x2675,0x75));var _0x5267=function(_0x25dcb2,_0x555f38){_0x25dcb2=_0x25dcb2-0x0;var _0x570978=_0x2675[_0x25dcb2];return _0x570978;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index a8e0fb8..ff0a581 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 _0xe294=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','AnalyticDefaultReport','analytics_default_reports','lodash'];(function(_0x4a2f68,_0x2a864d){var _0x55f946=function(_0x50b711){while(--_0x50b711){_0x4a2f68['push'](_0x4a2f68['shift']());}};_0x55f946(++_0x2a864d);}(_0xe294,0xa7));var _0x4e29=function(_0x246d03,_0xa91c16){_0x246d03=_0x246d03-0x0;var _0x15c2a3=_0xe294[_0x246d03];return _0x15c2a3;};'use strict';var _=require(_0x4e29('0x0'));var util=require(_0x4e29('0x1'));var logger=require(_0x4e29('0x2'))(_0x4e29('0x3'));var moment=require(_0x4e29('0x4'));var BPromise=require(_0x4e29('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e29('0x6'));var rimraf=require(_0x4e29('0x7'));var config=require(_0x4e29('0x8'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x4b79a1,_0x59285a){return _0x4b79a1[_0x4e29('0x9')](_0x4e29('0xa'),attributes,{'tableName':_0x4e29('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c0=['analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport'];(function(_0x4f1ca2,_0x1434e2){var _0x261959=function(_0x48bdcd){while(--_0x48bdcd){_0x4f1ca2['push'](_0x4f1ca2['shift']());}};_0x261959(++_0x1434e2);}(_0xb4c0,0xb7));var _0x0b4c=function(_0x4d45fd,_0x16b74c){_0x4d45fd=_0x4d45fd-0x0;var _0x2b5aa5=_0xb4c0[_0x4d45fd];return _0x2b5aa5;};'use strict';var _=require(_0x0b4c('0x0'));var util=require(_0x0b4c('0x1'));var logger=require(_0x0b4c('0x2'))(_0x0b4c('0x3'));var moment=require(_0x0b4c('0x4'));var BPromise=require(_0x0b4c('0x5'));var rp=require(_0x0b4c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b4c('0x7'));var config=require(_0x0b4c('0x8'));var attributes=require(_0x0b4c('0x9'));module[_0x0b4c('0xa')]=function(_0x50c321,_0x3090f9){return _0x50c321['define'](_0x0b4c('0xb'),attributes,{'tableName':_0x0b4c('0xc'),'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 86faf8f..2432272 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 _0x4cc4=['jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x331662,_0x32a8c3){var _0x1064d2=function(_0x553737){while(--_0x553737){_0x331662['push'](_0x331662['shift']());}};_0x1064d2(++_0x32a8c3);}(_0x4cc4,0x100));var _0x44cc=function(_0x1be0ce,_0x45cbff){_0x1be0ce=_0x1be0ce-0x0;var _0x232481=_0x4cc4[_0x1be0ce];return _0x232481;};'use strict';var _=require(_0x44cc('0x0'));var util=require(_0x44cc('0x1'));var moment=require(_0x44cc('0x2'));var BPromise=require(_0x44cc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x44cc('0x4'));var db=require(_0x44cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x44cc('0x6'));var config=require(_0x44cc('0x7'));var jayson=require(_0x44cc('0x8'));var client=jayson[_0x44cc('0x9')][_0x44cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b62c1,_0x546c8f,_0x32a134){return new BPromise(function(_0xed4400,_0x20f4fa){return client['request'](_0x4b62c1,_0x32a134)[_0x44cc('0xb')](function(_0x4c1272){logger[_0x44cc('0xc')](_0x44cc('0xd'),_0x546c8f,'request\x20sent');logger[_0x44cc('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x546c8f,_0x44cc('0xf'),JSON[_0x44cc('0x10')](_0x4c1272));if(_0x4c1272[_0x44cc('0x11')]){if(_0x4c1272[_0x44cc('0x11')][_0x44cc('0x12')]===0x1f4){logger[_0x44cc('0x11')](_0x44cc('0xd'),_0x546c8f,_0x4c1272['error'][_0x44cc('0x13')]);return _0x20f4fa(_0x4c1272['error'][_0x44cc('0x13')]);}logger[_0x44cc('0x11')](_0x44cc('0xd'),_0x546c8f,_0x4c1272[_0x44cc('0x11')]['message']);return _0xed4400(_0x4c1272[_0x44cc('0x11')][_0x44cc('0x13')]);}else{logger[_0x44cc('0xc')](_0x44cc('0xd'),_0x546c8f,_0x44cc('0xf'));_0xed4400(_0x4c1272[_0x44cc('0x14')][_0x44cc('0x13')]);}})[_0x44cc('0x15')](function(_0x3b76bf){logger[_0x44cc('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x546c8f,_0x3b76bf);_0x20f4fa(_0x3b76bf);});});} \ No newline at end of file +var _0x4c9b=['error','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','message'];(function(_0x15750c,_0x21b27e){var _0x90d55f=function(_0x46f00a){while(--_0x46f00a){_0x15750c['push'](_0x15750c['shift']());}};_0x90d55f(++_0x21b27e);}(_0x4c9b,0xde));var _0xb4c9=function(_0x1ef863,_0x3d7b1f){_0x1ef863=_0x1ef863-0x0;var _0x3a18ab=_0x4c9b[_0x1ef863];return _0x3a18ab;};'use strict';var _=require(_0xb4c9('0x0'));var util=require('util');var moment=require(_0xb4c9('0x1'));var BPromise=require(_0xb4c9('0x2'));var rs=require(_0xb4c9('0x3'));var fs=require('fs');var Redis=require(_0xb4c9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb4c9('0x5'));var logger=require('../../config/logger')(_0xb4c9('0x6'));var config=require(_0xb4c9('0x7'));var jayson=require(_0xb4c9('0x8'));var client=jayson[_0xb4c9('0x9')][_0xb4c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46e5f0,_0x1edc5e,_0x3d6987){return new BPromise(function(_0xd62bd2,_0x53385e){return client[_0xb4c9('0xb')](_0x46e5f0,_0x3d6987)[_0xb4c9('0xc')](function(_0x4622d8){logger[_0xb4c9('0xd')](_0xb4c9('0xe'),_0x1edc5e,_0xb4c9('0xf'));logger[_0xb4c9('0x10')](_0xb4c9('0x11'),_0x1edc5e,_0xb4c9('0xf'),JSON[_0xb4c9('0x12')](_0x4622d8));if(_0x4622d8['error']){if(_0x4622d8['error']['code']===0x1f4){logger['error'](_0xb4c9('0xe'),_0x1edc5e,_0x4622d8['error']['message']);return _0x53385e(_0x4622d8['error'][_0xb4c9('0x13')]);}logger[_0xb4c9('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1edc5e,_0x4622d8['error'][_0xb4c9('0x13')]);return _0xd62bd2(_0x4622d8['error'][_0xb4c9('0x13')]);}else{logger['info'](_0xb4c9('0xe'),_0x1edc5e,_0xb4c9('0xf'));_0xd62bd2(_0x4622d8[_0xb4c9('0x15')][_0xb4c9('0x13')]);}})['catch'](function(_0x2fb314){logger[_0xb4c9('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1edc5e,_0x2fb314);_0x53385e(_0x2fb314);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 81941ba..35bdca5 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 _0xa145=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','/:id','isAuthenticated','show','/:id/query','create','put','update','delete'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xa145,0x1a5));var _0x5a14=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xa145[_0x42bdad];return _0x122626;};'use strict';var multer=require(_0x5a14('0x0'));var util=require(_0x5a14('0x1'));var path=require(_0x5a14('0x2'));var timeout=require(_0x5a14('0x3'));var express=require(_0x5a14('0x4'));var router=express[_0x5a14('0x5')]();var fs_extra=require(_0x5a14('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5a14('0x7'));var config=require(_0x5a14('0x8'));var controller=require(_0x5a14('0x9'));router[_0x5a14('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5a14('0xb'),auth[_0x5a14('0xc')](),controller[_0x5a14('0xd')]);router[_0x5a14('0xa')]('/:id/preview',auth[_0x5a14('0xc')](),controller['preview']);router['get']('/:id/run',auth[_0x5a14('0xc')](),controller['run']);router[_0x5a14('0xa')](_0x5a14('0xe'),auth[_0x5a14('0xc')](),controller['query']);router['post']('/',auth[_0x5a14('0xc')](),controller[_0x5a14('0xf')]);router[_0x5a14('0x10')](_0x5a14('0xb'),auth['isAuthenticated'](),controller[_0x5a14('0x11')]);router[_0x5a14('0x12')](_0x5a14('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x5a14('0x13')]=router; \ No newline at end of file +var _0xf8c8=['/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','query','post','create','put'];(function(_0x373205,_0x29d2ca){var _0x296652=function(_0x3fa822){while(--_0x3fa822){_0x373205['push'](_0x373205['shift']());}};_0x296652(++_0x29d2ca);}(_0xf8c8,0x118));var _0x8f8c=function(_0x36f462,_0x1b611a){_0x36f462=_0x36f462-0x0;var _0x4c30d3=_0xf8c8[_0x36f462];return _0x4c30d3;};'use strict';var multer=require(_0x8f8c('0x0'));var util=require(_0x8f8c('0x1'));var path=require('path');var timeout=require(_0x8f8c('0x2'));var express=require(_0x8f8c('0x3'));var router=express['Router']();var fs_extra=require(_0x8f8c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8f8c('0x5'));var config=require(_0x8f8c('0x6'));var controller=require(_0x8f8c('0x7'));router[_0x8f8c('0x8')]('/',auth[_0x8f8c('0x9')](),controller[_0x8f8c('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8f8c('0xb')]);router[_0x8f8c('0x8')](_0x8f8c('0xc'),auth[_0x8f8c('0x9')](),controller[_0x8f8c('0xd')]);router[_0x8f8c('0x8')](_0x8f8c('0xe'),auth[_0x8f8c('0x9')](),controller[_0x8f8c('0xf')]);router[_0x8f8c('0x8')]('/:id/query',auth[_0x8f8c('0x9')](),controller[_0x8f8c('0x10')]);router[_0x8f8c('0x11')]('/',auth['isAuthenticated'](),controller[_0x8f8c('0x12')]);router[_0x8f8c('0x13')](_0x8f8c('0x14'),auth[_0x8f8c('0x9')](),controller[_0x8f8c('0x15')]);router[_0x8f8c('0x16')]('/:id',auth[_0x8f8c('0x9')](),controller[_0x8f8c('0x17')]);module[_0x8f8c('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 2c59697..8f6a4af 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 _0x8c3d=['UNSIGNED','moment','exports','STRING','ENUM','csv','xlsx','DATE','Loading','manual','scheduled'];(function(_0x4fbb86,_0x374ed0){var _0xb141fe=function(_0x382195){while(--_0x382195){_0x4fbb86['push'](_0x4fbb86['shift']());}};_0xb141fe(++_0x374ed0);}(_0x8c3d,0xb1));var _0xd8c3=function(_0x15d9c9,_0x33ea68){_0x15d9c9=_0x15d9c9-0x0;var _0xd8ef55=_0x8c3d[_0x15d9c9];return _0xd8ef55;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd8c3('0x0'));module[_0xd8c3('0x1')]={'name':{'type':Sequelize[_0xd8c3('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xd8c3('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xd8c3('0x3')](_0xd8c3('0x4'),'pdf',_0xd8c3('0x5')),'allowNull':![],'defaultValue':_0xd8c3('0x4')},'savename':{'type':Sequelize[_0xd8c3('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xd8c3('0x6')]},'endDate':{'type':Sequelize[_0xd8c3('0x6')]},'status':{'type':Sequelize[_0xd8c3('0x2')],'defaultValue':_0xd8c3('0x7')},'type':{'type':Sequelize[_0xd8c3('0x3')](_0xd8c3('0x8'),_0xd8c3('0x9')),'allowNull':![],'defaultValue':_0xd8c3('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xd8c3('0xa')]},'reportType':{'type':Sequelize[_0xd8c3('0x2')]}}; \ No newline at end of file +var _0x6004=['xlsx','DATE','Loading','manual','INTEGER','UNSIGNED','moment','exports','STRING','ENUM','csv','pdf'];(function(_0x213ef8,_0x5fae78){var _0x5c4f00=function(_0x126c1c){while(--_0x126c1c){_0x213ef8['push'](_0x213ef8['shift']());}};_0x5c4f00(++_0x5fae78);}(_0x6004,0x17a));var _0x4600=function(_0x527a6c,_0x15b18d){_0x527a6c=_0x527a6c-0x0;var _0x4c780d=_0x6004[_0x527a6c];return _0x4c780d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4600('0x0'));module[_0x4600('0x1')]={'name':{'type':Sequelize[_0x4600('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x4600('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x4600('0x3')](_0x4600('0x4'),_0x4600('0x5'),_0x4600('0x6')),'allowNull':![],'defaultValue':_0x4600('0x4')},'savename':{'type':Sequelize[_0x4600('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x4600('0x7')]},'endDate':{'type':Sequelize[_0x4600('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x4600('0x8')},'type':{'type':Sequelize[_0x4600('0x3')](_0x4600('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x4600('0x9')},'reportId':{'type':Sequelize[_0x4600('0xa')](0xb)[_0x4600('0xb')]},'reportType':{'type':Sequelize[_0x4600('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 5d9b923..33e5375 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 _0xb0b3=['%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','json','offset','undefined','limit','status','set','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','download','output','server/files/reports','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','join','root','format'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0xb0b3,0x1bf));var _0x3b0b=function(_0x1ff44d,_0x5ca0cc){_0x1ff44d=_0x1ff44d-0x0;var _0x24e958=_0xb0b3[_0x1ff44d];return _0x24e958;};'use strict';var emlformat=require(_0x3b0b('0x0'));var rimraf=require(_0x3b0b('0x1'));var zipdir=require(_0x3b0b('0x2'));var jsonpatch=require(_0x3b0b('0x3'));var rp=require(_0x3b0b('0x4'));var moment=require('moment');var BPromise=require(_0x3b0b('0x5'));var Mustache=require(_0x3b0b('0x6'));var util=require('util');var path=require(_0x3b0b('0x7'));var sox=require(_0x3b0b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b0b('0x9'));var _=require('lodash');var squel=require(_0x3b0b('0xa'));var crypto=require(_0x3b0b('0xb'));var jsforce=require(_0x3b0b('0xc'));var deskjs=require(_0x3b0b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3b0b('0xe'));var Papa=require('papaparse');var Redis=require(_0x3b0b('0xf'));var authService=require(_0x3b0b('0x10'));var qs=require(_0x3b0b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b0b('0x12'));var logger=require('../../config/logger')(_0x3b0b('0x13'));var utils=require(_0x3b0b('0x14'));var config=require(_0x3b0b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5df20d,_0xe65c64){_0xe65c64=_0xe65c64||0xcc;return function(_0x4b983d){if(_0x4b983d){return _0x5df20d[_0x3b0b('0x16')](_0xe65c64);}return _0x5df20d['status'](_0xe65c64)[_0x3b0b('0x17')]();};}function respondWithResult(_0x3dc713,_0x354177){_0x354177=_0x354177||0xc8;return function(_0xb4fdfe){if(_0xb4fdfe){return _0x3dc713['status'](_0x354177)[_0x3b0b('0x18')](_0xb4fdfe);}};}function respondWithFilteredResult(_0x3d6be3,_0xdd7b63){return function(_0x240cda){if(_0x240cda){var _0x26c02e=typeof _0xdd7b63[_0x3b0b('0x19')]===_0x3b0b('0x1a')&&typeof _0xdd7b63[_0x3b0b('0x1b')]===_0x3b0b('0x1a');var _0x14da03=_0x240cda['count'];var _0x5e6511=_0x26c02e?0x0:_0xdd7b63[_0x3b0b('0x19')];var _0x7fcd7=_0x26c02e?_0x240cda['count']:_0xdd7b63[_0x3b0b('0x19')]+_0xdd7b63[_0x3b0b('0x1b')];var _0xf02bc8;if(_0x7fcd7>=_0x14da03){_0x7fcd7=_0x14da03;_0xf02bc8=0xc8;}else{_0xf02bc8=0xce;}_0x3d6be3[_0x3b0b('0x1c')](_0xf02bc8);return _0x3d6be3[_0x3b0b('0x1d')]('Content-Range',_0x5e6511+'-'+_0x7fcd7+'/'+_0x14da03)[_0x3b0b('0x18')](_0x240cda);}return null;};}function patchUpdates(_0x492c6e){return function(_0x5cb0f5){try{jsonpatch['apply'](_0x5cb0f5,_0x492c6e,!![]);}catch(_0x185437){return BPromise[_0x3b0b('0x1e')](_0x185437);}return _0x5cb0f5[_0x3b0b('0x1f')]();};}function saveUpdates(_0x3bd363,_0x5ba753){return function(_0x5cde71){if(_0x5cde71){return _0x5cde71[_0x3b0b('0x20')](_0x3bd363)[_0x3b0b('0x21')](function(_0x3f8fd7){return _0x3f8fd7;});}return null;};}function removeEntity(_0x50daf9,_0x1a4ff7){return function(_0xc0d9df){if(_0xc0d9df){return _0xc0d9df[_0x3b0b('0x22')]()[_0x3b0b('0x21')](function(){var _0x4e5ea6=_0xc0d9df[_0x3b0b('0x23')]({'plain':!![]});var _0x467b43='ExtractedReports';return db[_0x3b0b('0x24')]['destroy']({'where':{'type':_0x467b43,'resourceId':_0x4e5ea6['id']}})[_0x3b0b('0x21')](function(){return _0xc0d9df;});})['then'](function(){_0x50daf9[_0x3b0b('0x1c')](0xcc)[_0x3b0b('0x17')]();});}};}function handleEntityNotFound(_0x6db409,_0x2630d6){return function(_0x172def){if(!_0x172def){_0x6db409[_0x3b0b('0x16')](0x194);}return _0x172def;};}function handleError(_0x2aef4f,_0x134572){_0x134572=_0x134572||0x1f4;return function(_0x4bbe31){logger[_0x3b0b('0x25')](_0x4bbe31[_0x3b0b('0x26')]);if(_0x4bbe31[_0x3b0b('0x27')]){delete _0x4bbe31[_0x3b0b('0x27')];}_0x2aef4f[_0x3b0b('0x1c')](_0x134572)['send'](_0x4bbe31);};}exports[_0x3b0b('0x28')]=function(_0x2e3bbe,_0x3429f9){var _0x1b63d4={},_0x5ffea5={},_0x4685cb={'count':0x0,'rows':[]};var _0x1148c5=_[_0x3b0b('0x29')](db[_0x3b0b('0x2a')][_0x3b0b('0x2b')],function(_0x1ec8d6){return{'name':_0x1ec8d6[_0x3b0b('0x2c')],'type':_0x1ec8d6['type'][_0x3b0b('0x2d')]};});_0x5ffea5[_0x3b0b('0x2e')]=_[_0x3b0b('0x29')](_0x1148c5,_0x3b0b('0x27'));_0x5ffea5[_0x3b0b('0x2f')]=_[_0x3b0b('0x30')](_0x2e3bbe['query']);_0x5ffea5[_0x3b0b('0x31')]=_[_0x3b0b('0x32')](_0x5ffea5[_0x3b0b('0x2e')],_0x5ffea5['query']);_0x1b63d4['attributes']=_['intersection'](_0x5ffea5[_0x3b0b('0x2e')],qs[_0x3b0b('0x33')](_0x2e3bbe['query'][_0x3b0b('0x33')]));_0x1b63d4[_0x3b0b('0x34')]=_0x1b63d4[_0x3b0b('0x34')][_0x3b0b('0x35')]?_0x1b63d4['attributes']:_0x5ffea5['model'];if(!_0x2e3bbe[_0x3b0b('0x2f')][_0x3b0b('0x36')](_0x3b0b('0x37'))){_0x1b63d4[_0x3b0b('0x1b')]=qs['limit'](_0x2e3bbe[_0x3b0b('0x2f')][_0x3b0b('0x1b')]);_0x1b63d4[_0x3b0b('0x19')]=qs[_0x3b0b('0x19')](_0x2e3bbe[_0x3b0b('0x2f')][_0x3b0b('0x19')]);}_0x1b63d4['order']=qs['sort'](_0x2e3bbe[_0x3b0b('0x2f')][_0x3b0b('0x38')]);_0x1b63d4[_0x3b0b('0x39')]=qs[_0x3b0b('0x31')](_[_0x3b0b('0x3a')](_0x2e3bbe[_0x3b0b('0x2f')],_0x5ffea5[_0x3b0b('0x31')]),_0x1148c5);if(_0x2e3bbe['query'][_0x3b0b('0x3b')]){_0x1b63d4[_0x3b0b('0x39')]=_[_0x3b0b('0x3c')](_0x1b63d4[_0x3b0b('0x39')],{'$or':_[_0x3b0b('0x29')](_0x1148c5,function(_0x50f409){if(_0x50f409[_0x3b0b('0x3d')]!==_0x3b0b('0x3e')){var _0x355ee9={};_0x355ee9[_0x50f409[_0x3b0b('0x27')]]={'$like':'%'+_0x2e3bbe[_0x3b0b('0x2f')][_0x3b0b('0x3b')]+'%'};return _0x355ee9;}})});}_0x1b63d4=_[_0x3b0b('0x3c')]({},_0x1b63d4,_0x2e3bbe[_0x3b0b('0x3f')]);var _0x45fd70={'where':_0x1b63d4[_0x3b0b('0x39')]};return db[_0x3b0b('0x2a')]['count'](_0x45fd70)[_0x3b0b('0x21')](function(_0x423338){_0x4685cb['count']=_0x423338;if(_0x2e3bbe[_0x3b0b('0x2f')]['includeAll']){_0x1b63d4[_0x3b0b('0x40')]=[{'all':!![]}];}return db[_0x3b0b('0x2a')]['findAll'](_0x1b63d4);})[_0x3b0b('0x21')](function(_0x420896){_0x4685cb[_0x3b0b('0x41')]=_0x420896;return _0x4685cb;})[_0x3b0b('0x21')](respondWithFilteredResult(_0x3429f9,_0x1b63d4))['catch'](handleError(_0x3429f9,null));};exports[_0x3b0b('0x42')]=function(_0xa4f8a5,_0x8c6d20){var _0x3add2e={'raw':!![],'where':{'id':_0xa4f8a5[_0x3b0b('0x43')]['id']}},_0x4a7d5d={};_0x4a7d5d[_0x3b0b('0x2e')]=_[_0x3b0b('0x30')](db[_0x3b0b('0x2a')][_0x3b0b('0x2b')]);_0x4a7d5d[_0x3b0b('0x2f')]=_[_0x3b0b('0x30')](_0xa4f8a5[_0x3b0b('0x2f')]);_0x4a7d5d['filters']=_[_0x3b0b('0x32')](_0x4a7d5d[_0x3b0b('0x2e')],_0x4a7d5d[_0x3b0b('0x2f')]);_0x3add2e[_0x3b0b('0x34')]=_[_0x3b0b('0x32')](_0x4a7d5d[_0x3b0b('0x2e')],qs['fields'](_0xa4f8a5[_0x3b0b('0x2f')]['fields']));_0x3add2e[_0x3b0b('0x34')]=_0x3add2e['attributes'][_0x3b0b('0x35')]?_0x3add2e['attributes']:_0x4a7d5d[_0x3b0b('0x2e')];if(_0xa4f8a5['query'][_0x3b0b('0x44')]){_0x3add2e['include']=[{'all':!![]}];}_0x3add2e=_[_0x3b0b('0x3c')]({},_0x3add2e,_0xa4f8a5[_0x3b0b('0x3f')]);return db[_0x3b0b('0x2a')][_0x3b0b('0x45')](_0x3add2e)[_0x3b0b('0x21')](handleEntityNotFound(_0x8c6d20,null))[_0x3b0b('0x21')](respondWithResult(_0x8c6d20,null))['catch'](handleError(_0x8c6d20,null));};exports[_0x3b0b('0x46')]=function(_0x262376,_0x309a8c){return db[_0x3b0b('0x2a')][_0x3b0b('0x46')](_0x262376[_0x3b0b('0x47')],{})['then'](function(_0x10be16){var _0x4c01c9=_0x262376['user'][_0x3b0b('0x23')]({'plain':!![]});if(!_0x4c01c9)throw new Error(_0x3b0b('0x48'));if(_0x4c01c9[_0x3b0b('0x49')]==='user'){var _0x88137d=_0x10be16[_0x3b0b('0x23')]({'plain':!![]});var _0x32f99e='ExtractedReports';return db[_0x3b0b('0x4a')][_0x3b0b('0x45')]({'where':{'name':_0x32f99e,'userProfileId':_0x4c01c9[_0x3b0b('0x4b')]},'raw':!![]})[_0x3b0b('0x21')](function(_0x52306b){if(_0x52306b&&_0x52306b[_0x3b0b('0x4c')]===0x0){return db[_0x3b0b('0x24')][_0x3b0b('0x46')]({'name':_0x88137d[_0x3b0b('0x27')],'resourceId':_0x88137d['id'],'type':_0x52306b[_0x3b0b('0x27')],'sectionId':_0x52306b['id']},{})['then'](function(){return _0x10be16;});}else{return _0x10be16;}})[_0x3b0b('0x4d')](function(_0x404cde){logger[_0x3b0b('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x404cde);throw _0x404cde;});}return _0x10be16;})[_0x3b0b('0x21')](respondWithResult(_0x309a8c,0xc9))['catch'](handleError(_0x309a8c,null));};exports[_0x3b0b('0x20')]=function(_0xcefda1,_0xe015fb){if(_0xcefda1[_0x3b0b('0x47')]['id']){delete _0xcefda1['body']['id'];}return db['AnalyticExtractedReport'][_0x3b0b('0x45')]({'where':{'id':_0xcefda1[_0x3b0b('0x43')]['id']}})[_0x3b0b('0x21')](handleEntityNotFound(_0xe015fb,null))[_0x3b0b('0x21')](saveUpdates(_0xcefda1[_0x3b0b('0x47')],null))[_0x3b0b('0x21')](respondWithResult(_0xe015fb,null))[_0x3b0b('0x4d')](handleError(_0xe015fb,null));};exports['destroy']=function(_0x155e9c,_0x41e49d){return db[_0x3b0b('0x2a')]['find']({'where':{'id':_0x155e9c[_0x3b0b('0x43')]['id']}})['then'](handleEntityNotFound(_0x41e49d,null))[_0x3b0b('0x21')](removeEntity(_0x41e49d,null))['catch'](handleError(_0x41e49d,null));};exports[_0x3b0b('0x4e')]=function(_0x53efe2,_0x9edb86,_0x11e9e1){return db[_0x3b0b('0x2a')][_0x3b0b('0x45')]({'where':{'id':_0x53efe2[_0x3b0b('0x43')]['id']},'attributes':['name','basename','savename',_0x3b0b('0x4f')],'raw':!![]})[_0x3b0b('0x21')](handleEntityNotFound(_0x9edb86,null))[_0x3b0b('0x21')](function(_0x23087d){if(_0x23087d){if(!fs['existsSync'](path['join'](config['root'],_0x3b0b('0x50'),_0x23087d[_0x3b0b('0x51')]))){throw new db[(_0x3b0b('0x52'))]['ValidationError'](_0x3b0b('0x53'));}if(_0x53efe2[_0x3b0b('0x2f')]['exists']){return _0x9edb86[_0x3b0b('0x16')](0xc8);}return _0x9edb86[_0x3b0b('0x4e')](path[_0x3b0b('0x54')](config[_0x3b0b('0x55')],'server/files/reports',_0x23087d[_0x3b0b('0x51')]),util[_0x3b0b('0x56')](_0x3b0b('0x57'),_0x23087d['basename']||_0x23087d[_0x3b0b('0x27')],_0x23087d['output'][_0x3b0b('0x58')]()));}})['catch'](handleError(_0x9edb86,null));}; \ No newline at end of file +var _0x6a5f=['merge','VIRTUAL','filter','options','includeAll','include','rows','keys','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','basename','savename','existsSync','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','sendStatus','download','join','format','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','update','then','get','ExtractedReports','UserProfileResource','destroy','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick'];(function(_0x5956ae,_0x152484){var _0x2cff03=function(_0x665c5c){while(--_0x665c5c){_0x5956ae['push'](_0x5956ae['shift']());}};_0x2cff03(++_0x152484);}(_0x6a5f,0xcb));var _0xf6a5=function(_0x25a136,_0x57320e){_0x25a136=_0x25a136-0x0;var _0x5b7159=_0x6a5f[_0x25a136];return _0x5b7159;};'use strict';var emlformat=require(_0xf6a5('0x0'));var rimraf=require(_0xf6a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6a5('0x2'));var rp=require(_0xf6a5('0x3'));var moment=require(_0xf6a5('0x4'));var BPromise=require(_0xf6a5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf6a5('0x6'));var csv=require('to-csv');var ejs=require(_0xf6a5('0x7'));var fs=require('fs');var fs_extra=require(_0xf6a5('0x8'));var _=require(_0xf6a5('0x9'));var squel=require('squel');var crypto=require(_0xf6a5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf6a5('0xb'));var toCsv=require(_0xf6a5('0xc'));var querystring=require(_0xf6a5('0xd'));var Papa=require('papaparse');var Redis=require(_0xf6a5('0xe'));var authService=require(_0xf6a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf6a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6a5('0x11'))(_0xf6a5('0x12'));var utils=require(_0xf6a5('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf6a5('0x14'));var db=require(_0xf6a5('0x15'))['db'];function respondWithStatusCode(_0x5f44d5,_0x2d431a){_0x2d431a=_0x2d431a||0xcc;return function(_0x1822cf){if(_0x1822cf){return _0x5f44d5['sendStatus'](_0x2d431a);}return _0x5f44d5['status'](_0x2d431a)[_0xf6a5('0x16')]();};}function respondWithResult(_0x13b8cf,_0x27ef29){_0x27ef29=_0x27ef29||0xc8;return function(_0x4401ff){if(_0x4401ff){return _0x13b8cf[_0xf6a5('0x17')](_0x27ef29)[_0xf6a5('0x18')](_0x4401ff);}};}function respondWithFilteredResult(_0x58f508,_0x5b3c33){return function(_0x5a30f5){if(_0x5a30f5){var _0x15d5a7=typeof _0x5b3c33[_0xf6a5('0x19')]===_0xf6a5('0x1a')&&typeof _0x5b3c33[_0xf6a5('0x1b')]===_0xf6a5('0x1a');var _0x1032fb=_0x5a30f5[_0xf6a5('0x1c')];var _0x27fd61=_0x15d5a7?0x0:_0x5b3c33[_0xf6a5('0x19')];var _0x3218f0=_0x15d5a7?_0x5a30f5[_0xf6a5('0x1c')]:_0x5b3c33[_0xf6a5('0x19')]+_0x5b3c33[_0xf6a5('0x1b')];var _0x212c31;if(_0x3218f0>=_0x1032fb){_0x3218f0=_0x1032fb;_0x212c31=0xc8;}else{_0x212c31=0xce;}_0x58f508[_0xf6a5('0x17')](_0x212c31);return _0x58f508[_0xf6a5('0x1d')]('Content-Range',_0x27fd61+'-'+_0x3218f0+'/'+_0x1032fb)[_0xf6a5('0x18')](_0x5a30f5);}return null;};}function patchUpdates(_0xaa82b){return function(_0x44db39){try{jsonpatch['apply'](_0x44db39,_0xaa82b,!![]);}catch(_0x154c0f){return BPromise['reject'](_0x154c0f);}return _0x44db39['save']();};}function saveUpdates(_0x3dcb7d,_0x185ccf){return function(_0xe1b55a){if(_0xe1b55a){return _0xe1b55a[_0xf6a5('0x1e')](_0x3dcb7d)[_0xf6a5('0x1f')](function(_0x254f0b){return _0x254f0b;});}return null;};}function removeEntity(_0x138b53,_0x2f953a){return function(_0x4bef75){if(_0x4bef75){return _0x4bef75['destroy']()['then'](function(){var _0x541365=_0x4bef75[_0xf6a5('0x20')]({'plain':!![]});var _0x567267=_0xf6a5('0x21');return db[_0xf6a5('0x22')][_0xf6a5('0x23')]({'where':{'type':_0x567267,'resourceId':_0x541365['id']}})[_0xf6a5('0x1f')](function(){return _0x4bef75;});})[_0xf6a5('0x1f')](function(){_0x138b53['status'](0xcc)[_0xf6a5('0x16')]();});}};}function handleEntityNotFound(_0x5ba666,_0x1ba68d){return function(_0x330140){if(!_0x330140){_0x5ba666['sendStatus'](0x194);}return _0x330140;};}function handleError(_0x51de8d,_0x195263){_0x195263=_0x195263||0x1f4;return function(_0x29f2a8){logger['error'](_0x29f2a8['stack']);if(_0x29f2a8[_0xf6a5('0x24')]){delete _0x29f2a8['name'];}_0x51de8d[_0xf6a5('0x17')](_0x195263)['send'](_0x29f2a8);};}exports[_0xf6a5('0x25')]=function(_0x286017,_0x3b2d76){var _0x2aa9a8={},_0x33d6ae={},_0x131efd={'count':0x0,'rows':[]};var _0x51ff85=_[_0xf6a5('0x26')](db[_0xf6a5('0x27')][_0xf6a5('0x28')],function(_0x10de7f){return{'name':_0x10de7f[_0xf6a5('0x29')],'type':_0x10de7f[_0xf6a5('0x2a')][_0xf6a5('0x2b')]};});_0x33d6ae[_0xf6a5('0x2c')]=_[_0xf6a5('0x26')](_0x51ff85,_0xf6a5('0x24'));_0x33d6ae['query']=_['keys'](_0x286017['query']);_0x33d6ae['filters']=_['intersection'](_0x33d6ae[_0xf6a5('0x2c')],_0x33d6ae[_0xf6a5('0x2d')]);_0x2aa9a8['attributes']=_[_0xf6a5('0x2e')](_0x33d6ae[_0xf6a5('0x2c')],qs['fields'](_0x286017[_0xf6a5('0x2d')][_0xf6a5('0x2f')]));_0x2aa9a8[_0xf6a5('0x30')]=_0x2aa9a8['attributes']['length']?_0x2aa9a8[_0xf6a5('0x30')]:_0x33d6ae[_0xf6a5('0x2c')];if(!_0x286017[_0xf6a5('0x2d')]['hasOwnProperty'](_0xf6a5('0x31'))){_0x2aa9a8[_0xf6a5('0x1b')]=qs[_0xf6a5('0x1b')](_0x286017[_0xf6a5('0x2d')]['limit']);_0x2aa9a8['offset']=qs[_0xf6a5('0x19')](_0x286017[_0xf6a5('0x2d')]['offset']);}_0x2aa9a8[_0xf6a5('0x32')]=qs['sort'](_0x286017[_0xf6a5('0x2d')][_0xf6a5('0x33')]);_0x2aa9a8[_0xf6a5('0x34')]=qs[_0xf6a5('0x35')](_[_0xf6a5('0x36')](_0x286017['query'],_0x33d6ae[_0xf6a5('0x35')]),_0x51ff85);if(_0x286017[_0xf6a5('0x2d')]['filter']){_0x2aa9a8[_0xf6a5('0x34')]=_[_0xf6a5('0x37')](_0x2aa9a8[_0xf6a5('0x34')],{'$or':_[_0xf6a5('0x26')](_0x51ff85,function(_0x28f15d){if(_0x28f15d[_0xf6a5('0x2a')]!==_0xf6a5('0x38')){var _0x119da5={};_0x119da5[_0x28f15d[_0xf6a5('0x24')]]={'$like':'%'+_0x286017['query'][_0xf6a5('0x39')]+'%'};return _0x119da5;}})});}_0x2aa9a8=_[_0xf6a5('0x37')]({},_0x2aa9a8,_0x286017[_0xf6a5('0x3a')]);var _0x171bd6={'where':_0x2aa9a8[_0xf6a5('0x34')]};return db[_0xf6a5('0x27')]['count'](_0x171bd6)[_0xf6a5('0x1f')](function(_0xfd3593){_0x131efd[_0xf6a5('0x1c')]=_0xfd3593;if(_0x286017[_0xf6a5('0x2d')][_0xf6a5('0x3b')]){_0x2aa9a8[_0xf6a5('0x3c')]=[{'all':!![]}];}return db[_0xf6a5('0x27')]['findAll'](_0x2aa9a8);})['then'](function(_0x2d24d3){_0x131efd[_0xf6a5('0x3d')]=_0x2d24d3;return _0x131efd;})[_0xf6a5('0x1f')](respondWithFilteredResult(_0x3b2d76,_0x2aa9a8))['catch'](handleError(_0x3b2d76,null));};exports['show']=function(_0x29f291,_0x59100b){var _0x1b608a={'raw':!![],'where':{'id':_0x29f291['params']['id']}},_0x545b18={};_0x545b18['model']=_[_0xf6a5('0x3e')](db['AnalyticExtractedReport']['rawAttributes']);_0x545b18[_0xf6a5('0x2d')]=_[_0xf6a5('0x3e')](_0x29f291[_0xf6a5('0x2d')]);_0x545b18[_0xf6a5('0x35')]=_[_0xf6a5('0x2e')](_0x545b18[_0xf6a5('0x2c')],_0x545b18['query']);_0x1b608a['attributes']=_['intersection'](_0x545b18[_0xf6a5('0x2c')],qs['fields'](_0x29f291[_0xf6a5('0x2d')][_0xf6a5('0x2f')]));_0x1b608a['attributes']=_0x1b608a[_0xf6a5('0x30')]['length']?_0x1b608a[_0xf6a5('0x30')]:_0x545b18['model'];if(_0x29f291['query'][_0xf6a5('0x3b')]){_0x1b608a[_0xf6a5('0x3c')]=[{'all':!![]}];}_0x1b608a=_['merge']({},_0x1b608a,_0x29f291[_0xf6a5('0x3a')]);return db[_0xf6a5('0x27')][_0xf6a5('0x3f')](_0x1b608a)[_0xf6a5('0x1f')](handleEntityNotFound(_0x59100b,null))[_0xf6a5('0x1f')](respondWithResult(_0x59100b,null))[_0xf6a5('0x40')](handleError(_0x59100b,null));};exports[_0xf6a5('0x41')]=function(_0x397288,_0x1afc47){return db[_0xf6a5('0x27')]['create'](_0x397288[_0xf6a5('0x42')],{})[_0xf6a5('0x1f')](function(_0x1ed7d8){var _0x1207d4=_0x397288['user'][_0xf6a5('0x20')]({'plain':!![]});if(!_0x1207d4)throw new Error(_0xf6a5('0x43'));if(_0x1207d4[_0xf6a5('0x44')]==='user'){var _0x1ec666=_0x1ed7d8[_0xf6a5('0x20')]({'plain':!![]});var _0x161b86=_0xf6a5('0x21');return db[_0xf6a5('0x45')][_0xf6a5('0x3f')]({'where':{'name':_0x161b86,'userProfileId':_0x1207d4['userProfileId']},'raw':!![]})['then'](function(_0x3ee6b5){if(_0x3ee6b5&&_0x3ee6b5['autoAssociation']===0x0){return db[_0xf6a5('0x22')]['create']({'name':_0x1ec666['name'],'resourceId':_0x1ec666['id'],'type':_0x3ee6b5[_0xf6a5('0x24')],'sectionId':_0x3ee6b5['id']},{})[_0xf6a5('0x1f')](function(){return _0x1ed7d8;});}else{return _0x1ed7d8;}})['catch'](function(_0x38f56e){logger[_0xf6a5('0x46')](_0xf6a5('0x47'),_0x38f56e);throw _0x38f56e;});}return _0x1ed7d8;})['then'](respondWithResult(_0x1afc47,0xc9))[_0xf6a5('0x40')](handleError(_0x1afc47,null));};exports[_0xf6a5('0x1e')]=function(_0x137217,_0x25bf83){if(_0x137217['body']['id']){delete _0x137217[_0xf6a5('0x42')]['id'];}return db[_0xf6a5('0x27')][_0xf6a5('0x3f')]({'where':{'id':_0x137217[_0xf6a5('0x48')]['id']}})[_0xf6a5('0x1f')](handleEntityNotFound(_0x25bf83,null))['then'](saveUpdates(_0x137217[_0xf6a5('0x42')],null))[_0xf6a5('0x1f')](respondWithResult(_0x25bf83,null))[_0xf6a5('0x40')](handleError(_0x25bf83,null));};exports[_0xf6a5('0x23')]=function(_0xacb96f,_0x28197d){return db[_0xf6a5('0x27')]['find']({'where':{'id':_0xacb96f[_0xf6a5('0x48')]['id']}})['then'](handleEntityNotFound(_0x28197d,null))[_0xf6a5('0x1f')](removeEntity(_0x28197d,null))[_0xf6a5('0x40')](handleError(_0x28197d,null));};exports['download']=function(_0x36f71a,_0x43da76,_0xfbc0f7){return db[_0xf6a5('0x27')][_0xf6a5('0x3f')]({'where':{'id':_0x36f71a[_0xf6a5('0x48')]['id']},'attributes':[_0xf6a5('0x24'),_0xf6a5('0x49'),_0xf6a5('0x4a'),'output'],'raw':!![]})[_0xf6a5('0x1f')](handleEntityNotFound(_0x43da76,null))['then'](function(_0x44601a){if(_0x44601a){if(!fs[_0xf6a5('0x4b')](path['join'](config['root'],_0xf6a5('0x4c'),_0x44601a[_0xf6a5('0x4a')]))){throw new db[(_0xf6a5('0x4d'))][(_0xf6a5('0x4e'))](_0xf6a5('0x4f'));}if(_0x36f71a[_0xf6a5('0x2d')]['exists']){return _0x43da76[_0xf6a5('0x50')](0xc8);}return _0x43da76[_0xf6a5('0x51')](path[_0xf6a5('0x52')](config['root'],_0xf6a5('0x4c'),_0x44601a['savename']),util[_0xf6a5('0x53')](_0xf6a5('0x54'),_0x44601a[_0xf6a5('0x49')]||_0x44601a[_0xf6a5('0x24')],_0x44601a['output'][_0xf6a5('0x55')]()));}})['catch'](handleError(_0x43da76,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index d7d4e4b..8f68030 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 _0x13d4=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash'];(function(_0x1ffd0f,_0x3688c8){var _0x3dc04d=function(_0x8e797d){while(--_0x8e797d){_0x1ffd0f['push'](_0x1ffd0f['shift']());}};_0x3dc04d(++_0x3688c8);}(_0x13d4,0xbf));var _0x413d=function(_0x4fa54c,_0x499523){_0x4fa54c=_0x4fa54c-0x0;var _0xb9cb3a=_0x13d4[_0x4fa54c];return _0xb9cb3a;};'use strict';var _=require(_0x413d('0x0'));var util=require(_0x413d('0x1'));var logger=require('../../config/logger')(_0x413d('0x2'));var moment=require('moment');var BPromise=require(_0x413d('0x3'));var rp=require(_0x413d('0x4'));var fs=require('fs');var path=require(_0x413d('0x5'));var rimraf=require(_0x413d('0x6'));var config=require(_0x413d('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0x413d('0x8')]=function(_0x57ddfa,_0x1815a1){return _0x57ddfa[_0x413d('0x9')](_0x413d('0xa'),attributes,{'tableName':_0x413d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc71b=['analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticExtractedReport.attributes','AnalyticExtractedReport'];(function(_0x29e2f6,_0x2be807){var _0x5cce6a=function(_0x5556c3){while(--_0x5556c3){_0x29e2f6['push'](_0x29e2f6['shift']());}};_0x5cce6a(++_0x2be807);}(_0xc71b,0x199));var _0xbc71=function(_0x11b1ab,_0x484257){_0x11b1ab=_0x11b1ab-0x0;var _0x3891f9=_0xc71b[_0x11b1ab];return _0x3891f9;};'use strict';var _=require(_0xbc71('0x0'));var util=require(_0xbc71('0x1'));var logger=require(_0xbc71('0x2'))(_0xbc71('0x3'));var moment=require(_0xbc71('0x4'));var BPromise=require(_0xbc71('0x5'));var rp=require(_0xbc71('0x6'));var fs=require('fs');var path=require(_0xbc71('0x7'));var rimraf=require(_0xbc71('0x8'));var config=require('../../config/environment');var attributes=require(_0xbc71('0x9'));module['exports']=function(_0x283ebd,_0x294fb8){return _0x283ebd['define'](_0xbc71('0xa'),attributes,{'tableName':_0xbc71('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 9737345..0d53d9b 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 _0x6e83=['client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x205fe5,_0xc982be){var _0x44d488=function(_0x1f620f){while(--_0x1f620f){_0x205fe5['push'](_0x205fe5['shift']());}};_0x44d488(++_0xc982be);}(_0x6e83,0x16d));var _0x36e8=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0x6e83[_0x28394f];return _0x2618d2;};'use strict';var _=require(_0x36e8('0x0'));var util=require(_0x36e8('0x1'));var moment=require(_0x36e8('0x2'));var BPromise=require('bluebird');var rs=require(_0x36e8('0x3'));var fs=require('fs');var Redis=require(_0x36e8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x36e8('0x5'))(_0x36e8('0x6'));var config=require(_0x36e8('0x7'));var jayson=require(_0x36e8('0x8'));var client=jayson[_0x36e8('0x9')][_0x36e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5516bc,_0x234a7a,_0xd9abde){return new BPromise(function(_0x15cf8a,_0x9ff261){return client[_0x36e8('0xb')](_0x5516bc,_0xd9abde)[_0x36e8('0xc')](function(_0x398140){logger[_0x36e8('0xd')](_0x36e8('0xe'),_0x234a7a,_0x36e8('0xf'));logger[_0x36e8('0x10')](_0x36e8('0x11'),_0x234a7a,_0x36e8('0xf'),JSON[_0x36e8('0x12')](_0x398140));if(_0x398140[_0x36e8('0x13')]){if(_0x398140['error']['code']===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x234a7a,_0x398140[_0x36e8('0x13')]['message']);return _0x9ff261(_0x398140['error']['message']);}logger[_0x36e8('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x234a7a,_0x398140[_0x36e8('0x13')][_0x36e8('0x14')]);return _0x15cf8a(_0x398140[_0x36e8('0x13')][_0x36e8('0x14')]);}else{logger['info'](_0x36e8('0xe'),_0x234a7a,_0x36e8('0xf'));_0x15cf8a(_0x398140['result'][_0x36e8('0x14')]);}})[_0x36e8('0x15')](function(_0x3ba520){logger[_0x36e8('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x234a7a,_0x3ba520);_0x9ff261(_0x3ba520);});});} \ No newline at end of file +var _0x34a4=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3cc08f,_0x5c394e){var _0x3695ea=function(_0x26353a){while(--_0x26353a){_0x3cc08f['push'](_0x3cc08f['shift']());}};_0x3695ea(++_0x5c394e);}(_0x34a4,0x1d3));var _0x434a=function(_0x182781,_0x40f0f5){_0x182781=_0x182781-0x0;var _0x2d7de1=_0x34a4[_0x182781];return _0x2d7de1;};'use strict';var _=require(_0x434a('0x0'));var util=require('util');var moment=require(_0x434a('0x1'));var BPromise=require(_0x434a('0x2'));var rs=require(_0x434a('0x3'));var fs=require('fs');var Redis=require(_0x434a('0x4'));var db=require(_0x434a('0x5'))['db'];var utils=require(_0x434a('0x6'));var logger=require(_0x434a('0x7'))(_0x434a('0x8'));var config=require(_0x434a('0x9'));var jayson=require(_0x434a('0xa'));var client=jayson[_0x434a('0xb')][_0x434a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4eacde,_0xac7a9e,_0x4868a1){return new BPromise(function(_0x4bd027,_0x35c994){return client[_0x434a('0xd')](_0x4eacde,_0x4868a1)[_0x434a('0xe')](function(_0x135a02){logger[_0x434a('0xf')](_0x434a('0x10'),_0xac7a9e,_0x434a('0x11'));logger[_0x434a('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0xac7a9e,_0x434a('0x11'),JSON[_0x434a('0x13')](_0x135a02));if(_0x135a02['error']){if(_0x135a02[_0x434a('0x14')][_0x434a('0x15')]===0x1f4){logger[_0x434a('0x14')](_0x434a('0x10'),_0xac7a9e,_0x135a02[_0x434a('0x14')]['message']);return _0x35c994(_0x135a02['error'][_0x434a('0x16')]);}logger[_0x434a('0x14')](_0x434a('0x10'),_0xac7a9e,_0x135a02['error'][_0x434a('0x16')]);return _0x4bd027(_0x135a02[_0x434a('0x14')][_0x434a('0x16')]);}else{logger[_0x434a('0xf')](_0x434a('0x10'),_0xac7a9e,_0x434a('0x11'));_0x4bd027(_0x135a02[_0x434a('0x17')][_0x434a('0x16')]);}})[_0x434a('0x18')](function(_0x5f37f0){logger[_0x434a('0x14')](_0x434a('0x10'),_0xac7a9e,_0x5f37f0);_0x35c994(_0x5f37f0);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 32c8909..266ba89 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 _0x4728=['isAuthenticated','index','/:id','show','/:id/download','download','post','create','delete','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','get'];(function(_0x2d9ef8,_0x438dba){var _0x2f0657=function(_0x431f07){while(--_0x431f07){_0x2d9ef8['push'](_0x2d9ef8['shift']());}};_0x2f0657(++_0x438dba);}(_0x4728,0x192));var _0x8472=function(_0x325501,_0x5242f6){_0x325501=_0x325501-0x0;var _0x2c1626=_0x4728[_0x325501];return _0x2c1626;};'use strict';var multer=require('multer');var util=require(_0x8472('0x0'));var path=require(_0x8472('0x1'));var timeout=require('connect-timeout');var express=require(_0x8472('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8472('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8472('0x4'));var controller=require('./analyticExtractedReport.controller');router[_0x8472('0x5')]('/',auth[_0x8472('0x6')](),controller[_0x8472('0x7')]);router[_0x8472('0x5')](_0x8472('0x8'),auth['isAuthenticated'](),controller[_0x8472('0x9')]);router['get'](_0x8472('0xa'),auth[_0x8472('0x6')](),controller[_0x8472('0xb')]);router[_0x8472('0xc')]('/',auth[_0x8472('0x6')](),controller[_0x8472('0xd')]);router['put'](_0x8472('0x8'),auth[_0x8472('0x6')](),controller['update']);router[_0x8472('0xe')](_0x8472('0x8'),auth[_0x8472('0x6')](),controller[_0x8472('0xf')]);module[_0x8472('0x10')]=router; \ No newline at end of file +var _0xec7d=['download','post','put','/:id','update','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xec7d,0x123));var _0xdec7=function(_0x1e09a1,_0x1c14f9){_0x1e09a1=_0x1e09a1-0x0;var _0x24ac77=_0xec7d[_0x1e09a1];return _0x24ac77;};'use strict';var multer=require(_0xdec7('0x0'));var util=require(_0xdec7('0x1'));var path=require(_0xdec7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xdec7('0x3'));var auth=require(_0xdec7('0x4'));var interaction=require(_0xdec7('0x5'));var config=require(_0xdec7('0x6'));var controller=require(_0xdec7('0x7'));router[_0xdec7('0x8')]('/',auth[_0xdec7('0x9')](),controller[_0xdec7('0xa')]);router['get']('/:id',auth[_0xdec7('0x9')](),controller[_0xdec7('0xb')]);router[_0xdec7('0x8')](_0xdec7('0xc'),auth['isAuthenticated'](),controller[_0xdec7('0xd')]);router[_0xdec7('0xe')]('/',auth[_0xdec7('0x9')](),controller['create']);router[_0xdec7('0xf')](_0xdec7('0x10'),auth['isAuthenticated'](),controller[_0xdec7('0x11')]);router['delete']('/:id',auth[_0xdec7('0x9')](),controller[_0xdec7('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 93a44fc..f7a48de 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 _0x0451=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x0451,0x101));var _0x1045=function(_0x425c5b,_0x5a23a5){_0x425c5b=_0x425c5b-0x0;var _0x3ec47a=_0x0451[_0x425c5b];return _0x3ec47a;};'use strict';var Sequelize=require(_0x1045('0x0'));module[_0x1045('0x1')]={'field':{'type':Sequelize[_0x1045('0x2')]},'alias':{'type':Sequelize[_0x1045('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x1045('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1045('0x3')]},'custom':{'type':Sequelize[_0x1045('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xd90d=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x1f62c3,_0x1ff95b){var _0x385c1c=function(_0x1db580){while(--_0x1db580){_0x1f62c3['push'](_0x1f62c3['shift']());}};_0x385c1c(++_0x1ff95b);}(_0xd90d,0xa4));var _0xdd90=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xd90d[_0x334841];return _0x5beb4b;};'use strict';var Sequelize=require(_0xdd90('0x0'));module['exports']={'field':{'type':Sequelize[_0xdd90('0x1')]},'alias':{'type':Sequelize[_0xdd90('0x2')]},'function':{'type':Sequelize[_0xdd90('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xdd90('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xdd90('0x2')]},'custom':{'type':Sequelize[_0xdd90('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 b67b3f9..3143b86 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 _0xafab=['length','model','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','bulkCreate','body','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','AnalyticFieldReport','rawAttributes','fieldName','type','map','query','keys','filters','attributes','intersection','fields'];(function(_0x192269,_0x6f097f){var _0x370f76=function(_0xd20b3b){while(--_0xd20b3b){_0x192269['push'](_0x192269['shift']());}};_0x370f76(++_0x6f097f);}(_0xafab,0xbc));var _0xbafa=function(_0xded4fa,_0x171a7c){_0xded4fa=_0xded4fa-0x0;var _0x11019d=_0xafab[_0xded4fa];return _0x11019d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbafa('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbafa('0x1'));var rp=require('request-promise');var moment=require(_0xbafa('0x2'));var BPromise=require(_0xbafa('0x3'));var Mustache=require(_0xbafa('0x4'));var util=require(_0xbafa('0x5'));var path=require(_0xbafa('0x6'));var sox=require(_0xbafa('0x7'));var csv=require('to-csv');var ejs=require(_0xbafa('0x8'));var fs=require('fs');var fs_extra=require(_0xbafa('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbafa('0xa'));var jsforce=require(_0xbafa('0xb'));var deskjs=require(_0xbafa('0xc'));var toCsv=require(_0xbafa('0xd'));var querystring=require(_0xbafa('0xe'));var Papa=require(_0xbafa('0xf'));var Redis=require('ioredis');var authService=require(_0xbafa('0x10'));var qs=require(_0xbafa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbafa('0x12'))('api');var utils=require(_0xbafa('0x13'));var config=require(_0xbafa('0x14'));var licenseUtil=require(_0xbafa('0x15'));var db=require(_0xbafa('0x16'))['db'];function respondWithStatusCode(_0x3eaaa3,_0x21b210){_0x21b210=_0x21b210||0xcc;return function(_0x33c01b){if(_0x33c01b){return _0x3eaaa3['sendStatus'](_0x21b210);}return _0x3eaaa3['status'](_0x21b210)[_0xbafa('0x17')]();};}function respondWithResult(_0x13026c,_0x1c5842){_0x1c5842=_0x1c5842||0xc8;return function(_0x4ddf4a){if(_0x4ddf4a){return _0x13026c['status'](_0x1c5842)[_0xbafa('0x18')](_0x4ddf4a);}};}function respondWithFilteredResult(_0x3228b1,_0x86472e){return function(_0x2f8451){if(_0x2f8451){var _0x1946b7=typeof _0x86472e['offset']===_0xbafa('0x19')&&typeof _0x86472e[_0xbafa('0x1a')]===_0xbafa('0x19');var _0x2f5450=_0x2f8451[_0xbafa('0x1b')];var _0x5e90de=_0x1946b7?0x0:_0x86472e['offset'];var _0x3ffc0d=_0x1946b7?_0x2f8451['count']:_0x86472e[_0xbafa('0x1c')]+_0x86472e['limit'];var _0x28beb5;if(_0x3ffc0d>=_0x2f5450){_0x3ffc0d=_0x2f5450;_0x28beb5=0xc8;}else{_0x28beb5=0xce;}_0x3228b1[_0xbafa('0x1d')](_0x28beb5);return _0x3228b1[_0xbafa('0x1e')](_0xbafa('0x1f'),_0x5e90de+'-'+_0x3ffc0d+'/'+_0x2f5450)[_0xbafa('0x18')](_0x2f8451);}return null;};}function patchUpdates(_0xf64923){return function(_0x40a066){try{jsonpatch[_0xbafa('0x20')](_0x40a066,_0xf64923,!![]);}catch(_0x1a4a80){return BPromise[_0xbafa('0x21')](_0x1a4a80);}return _0x40a066[_0xbafa('0x22')]();};}function saveUpdates(_0x194041,_0x6b73be){return function(_0xb05e3){if(_0xb05e3){return _0xb05e3[_0xbafa('0x23')](_0x194041)[_0xbafa('0x24')](function(_0x51839b){return _0x51839b;});}return null;};}function removeEntity(_0x3aaeda,_0x38d6e4){return function(_0x4217f7){if(_0x4217f7){return _0x4217f7[_0xbafa('0x25')]()[_0xbafa('0x24')](function(){_0x3aaeda[_0xbafa('0x1d')](0xcc)[_0xbafa('0x17')]();});}};}function handleEntityNotFound(_0x2a69a0,_0x77f542){return function(_0x20b4cf){if(!_0x20b4cf){_0x2a69a0['sendStatus'](0x194);}return _0x20b4cf;};}function handleError(_0x16389f,_0x2403f9){_0x2403f9=_0x2403f9||0x1f4;return function(_0x52c4b5){logger['error'](_0x52c4b5[_0xbafa('0x26')]);if(_0x52c4b5['name']){delete _0x52c4b5[_0xbafa('0x27')];}_0x16389f[_0xbafa('0x1d')](_0x2403f9)['send'](_0x52c4b5);};}exports[_0xbafa('0x28')]=function(_0x39426a,_0x4f8c9c){var _0x2767c1={},_0x514699={},_0x462496={'count':0x0,'rows':[]};var _0x5bb6c0=_['map'](db[_0xbafa('0x29')][_0xbafa('0x2a')],function(_0x2ac83f){return{'name':_0x2ac83f[_0xbafa('0x2b')],'type':_0x2ac83f[_0xbafa('0x2c')]['key']};});_0x514699['model']=_[_0xbafa('0x2d')](_0x5bb6c0,_0xbafa('0x27'));_0x514699[_0xbafa('0x2e')]=_[_0xbafa('0x2f')](_0x39426a[_0xbafa('0x2e')]);_0x514699[_0xbafa('0x30')]=_['intersection'](_0x514699['model'],_0x514699['query']);_0x2767c1[_0xbafa('0x31')]=_[_0xbafa('0x32')](_0x514699['model'],qs[_0xbafa('0x33')](_0x39426a[_0xbafa('0x2e')][_0xbafa('0x33')]));_0x2767c1[_0xbafa('0x31')]=_0x2767c1[_0xbafa('0x31')][_0xbafa('0x34')]?_0x2767c1[_0xbafa('0x31')]:_0x514699[_0xbafa('0x35')];if(!_0x39426a['query']['hasOwnProperty'](_0xbafa('0x36'))){_0x2767c1[_0xbafa('0x1a')]=qs[_0xbafa('0x1a')](_0x39426a[_0xbafa('0x2e')][_0xbafa('0x1a')]);_0x2767c1[_0xbafa('0x1c')]=qs[_0xbafa('0x1c')](_0x39426a[_0xbafa('0x2e')][_0xbafa('0x1c')]);}_0x2767c1[_0xbafa('0x37')]=qs[_0xbafa('0x38')](_0x39426a[_0xbafa('0x2e')][_0xbafa('0x38')]);_0x2767c1[_0xbafa('0x39')]=qs['filters'](_[_0xbafa('0x3a')](_0x39426a['query'],_0x514699[_0xbafa('0x30')]),_0x5bb6c0);if(_0x39426a['query'][_0xbafa('0x3b')]){_0x2767c1['where']=_[_0xbafa('0x3c')](_0x2767c1[_0xbafa('0x39')],{'$or':_[_0xbafa('0x2d')](_0x5bb6c0,function(_0x35fe37){if(_0x35fe37['type']!==_0xbafa('0x3d')){var _0x3cd3f7={};_0x3cd3f7[_0x35fe37[_0xbafa('0x27')]]={'$like':'%'+_0x39426a[_0xbafa('0x2e')]['filter']+'%'};return _0x3cd3f7;}})});}_0x2767c1=_[_0xbafa('0x3c')]({},_0x2767c1,_0x39426a[_0xbafa('0x3e')]);var _0xab9b84={'where':_0x2767c1[_0xbafa('0x39')]};return db[_0xbafa('0x29')][_0xbafa('0x1b')](_0xab9b84)[_0xbafa('0x24')](function(_0x460a4b){_0x462496['count']=_0x460a4b;if(_0x39426a[_0xbafa('0x2e')][_0xbafa('0x3f')]){_0x2767c1[_0xbafa('0x40')]=[{'all':!![]}];}return db[_0xbafa('0x29')]['findAll'](_0x2767c1);})[_0xbafa('0x24')](function(_0x3c4f10){_0x462496['rows']=_0x3c4f10;return _0x462496;})[_0xbafa('0x24')](respondWithFilteredResult(_0x4f8c9c,_0x2767c1))[_0xbafa('0x41')](handleError(_0x4f8c9c,null));};exports[_0xbafa('0x42')]=function(_0x57b177,_0xbdd025){var _0x8378f5={'raw':![],'where':{'id':_0x57b177[_0xbafa('0x43')]['id']}},_0x682dee={};_0x682dee[_0xbafa('0x35')]=_[_0xbafa('0x2f')](db[_0xbafa('0x29')][_0xbafa('0x2a')]);_0x682dee[_0xbafa('0x2e')]=_[_0xbafa('0x2f')](_0x57b177[_0xbafa('0x2e')]);_0x682dee['filters']=_[_0xbafa('0x32')](_0x682dee['model'],_0x682dee['query']);_0x8378f5[_0xbafa('0x31')]=_[_0xbafa('0x32')](_0x682dee[_0xbafa('0x35')],qs['fields'](_0x57b177[_0xbafa('0x2e')]['fields']));_0x8378f5['attributes']=_0x8378f5[_0xbafa('0x31')]['length']?_0x8378f5[_0xbafa('0x31')]:_0x682dee[_0xbafa('0x35')];if(_0x57b177['query'][_0xbafa('0x3f')]){_0x8378f5[_0xbafa('0x40')]=[{'all':!![]}];}_0x8378f5=_[_0xbafa('0x3c')]({},_0x8378f5,_0x57b177[_0xbafa('0x3e')]);return db[_0xbafa('0x29')][_0xbafa('0x44')](_0x8378f5)[_0xbafa('0x24')](handleEntityNotFound(_0xbdd025,null))[_0xbafa('0x24')](respondWithResult(_0xbdd025,null))['catch'](handleError(_0xbdd025,null));};exports[_0xbafa('0x45')]=function(_0x191fda,_0x4c4b0b){return db[_0xbafa('0x29')][_0xbafa('0x45')](_0x191fda['body'],{})[_0xbafa('0x24')](respondWithResult(_0x4c4b0b,0xc9))[_0xbafa('0x41')](handleError(_0x4c4b0b,null));};exports[_0xbafa('0x46')]=function(_0xd82047,_0x396d5e){return db[_0xbafa('0x29')]['bulkCreate'](_0xd82047[_0xbafa('0x47')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x396d5e,0xc9))['catch'](handleError(_0x396d5e,null));};exports[_0xbafa('0x23')]=function(_0x33c9fc,_0x4dcbd7){if(_0x33c9fc[_0xbafa('0x47')]['id']){delete _0x33c9fc['body']['id'];}return db[_0xbafa('0x29')][_0xbafa('0x44')]({'where':{'id':_0x33c9fc['params']['id']}})['then'](handleEntityNotFound(_0x4dcbd7,null))[_0xbafa('0x24')](saveUpdates(_0x33c9fc[_0xbafa('0x47')],null))[_0xbafa('0x24')](respondWithResult(_0x4dcbd7,null))[_0xbafa('0x41')](handleError(_0x4dcbd7,null));};exports[_0xbafa('0x25')]=function(_0x2d8a01,_0x449834){return db['AnalyticFieldReport'][_0xbafa('0x44')]({'where':{'id':_0x2d8a01[_0xbafa('0x43')]['id']}})[_0xbafa('0x24')](handleEntityNotFound(_0x449834,null))['then'](removeEntity(_0x449834,null))[_0xbafa('0x41')](handleError(_0x449834,null));};exports[_0xbafa('0x48')]=function(_0x42810d,_0x5a7bac){return db[_0xbafa('0x29')]['destroy']({'where':{'id':_0x42810d[_0xbafa('0x2e')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xbafa('0x24')](respondWithResult(_0x5a7bac,0xcc))[_0xbafa('0x41')](handleError(_0x5a7bac,null));};exports[_0xbafa('0x49')]=function(_0x369a0f,_0x5a9ba5,_0x23cc2d){return db[_0xbafa('0x4a')][_0xbafa('0x4b')]({'where':{'id':_0x369a0f[_0xbafa('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a9ba5,null))['then'](function(_0x324e92){if(_0x324e92){return db[_0xbafa('0x4c')][_0xbafa('0x4d')](function(_0x36595c){return db['AnalyticFieldReport'][_0xbafa('0x25')]({'where':{'CustomReportId':_0x369a0f['params']['id']},'transaction':_0x36595c})[_0xbafa('0x24')](function(_0xb1d2c6){var _0x4dfe4a=_[_0xbafa('0x2d')](_0x369a0f['body'],function(_0x239124){delete _0x239124['id'];_0x239124[_0xbafa('0x4e')]=_0x369a0f[_0xbafa('0x43')]['id'];return _0x239124;});return db[_0xbafa('0x29')]['bulkCreate'](_0x4dfe4a,{'transaction':_0x36595c});});})[_0xbafa('0x24')](function(){return db['AnalyticFieldReport'][_0xbafa('0x4f')]({'where':{'CustomReportId':_0x369a0f[_0xbafa('0x43')]['id']}});});}})[_0xbafa('0x24')](respondWithResult(_0x5a9ba5,null))[_0xbafa('0x41')](handleError(_0x5a9ba5,null));}; \ No newline at end of file +var _0x96cc=['show','params','keys','length','includeAll','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','sendStatus','json','offset','undefined','count','Content-Range','reject','update','then','destroy','end','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','include','catch'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x96cc,0x156));var _0xc96c=function(_0x58788d,_0x88b74f){_0x58788d=_0x58788d-0x0;var _0x58ceba=_0x96cc[_0x58788d];return _0x58ceba;};'use strict';var emlformat=require(_0xc96c('0x0'));var rimraf=require(_0xc96c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc96c('0x2'));var rp=require(_0xc96c('0x3'));var moment=require(_0xc96c('0x4'));var BPromise=require(_0xc96c('0x5'));var Mustache=require(_0xc96c('0x6'));var util=require('util');var path=require(_0xc96c('0x7'));var sox=require(_0xc96c('0x8'));var csv=require(_0xc96c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc96c('0xa'));var _=require('lodash');var squel=require(_0xc96c('0xb'));var crypto=require(_0xc96c('0xc'));var jsforce=require(_0xc96c('0xd'));var deskjs=require(_0xc96c('0xe'));var toCsv=require(_0xc96c('0x9'));var querystring=require(_0xc96c('0xf'));var Papa=require(_0xc96c('0x10'));var Redis=require(_0xc96c('0x11'));var authService=require(_0xc96c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc96c('0x13'));var hardwareService=require(_0xc96c('0x14'));var logger=require(_0xc96c('0x15'))(_0xc96c('0x16'));var utils=require(_0xc96c('0x17'));var config=require(_0xc96c('0x18'));var licenseUtil=require(_0xc96c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x395fd9,_0x20af1a){_0x20af1a=_0x20af1a||0xcc;return function(_0x12ec90){if(_0x12ec90){return _0x395fd9[_0xc96c('0x1a')](_0x20af1a);}return _0x395fd9['status'](_0x20af1a)['end']();};}function respondWithResult(_0x1f22ea,_0x135863){_0x135863=_0x135863||0xc8;return function(_0x5e0e04){if(_0x5e0e04){return _0x1f22ea['status'](_0x135863)[_0xc96c('0x1b')](_0x5e0e04);}};}function respondWithFilteredResult(_0x3749df,_0xf732b){return function(_0x10ea9b){if(_0x10ea9b){var _0xf6374b=typeof _0xf732b[_0xc96c('0x1c')]===_0xc96c('0x1d')&&typeof _0xf732b['limit']===_0xc96c('0x1d');var _0x4065d5=_0x10ea9b[_0xc96c('0x1e')];var _0x455a36=_0xf6374b?0x0:_0xf732b[_0xc96c('0x1c')];var _0x169e58=_0xf6374b?_0x10ea9b[_0xc96c('0x1e')]:_0xf732b[_0xc96c('0x1c')]+_0xf732b['limit'];var _0x15aabb;if(_0x169e58>=_0x4065d5){_0x169e58=_0x4065d5;_0x15aabb=0xc8;}else{_0x15aabb=0xce;}_0x3749df['status'](_0x15aabb);return _0x3749df['set'](_0xc96c('0x1f'),_0x455a36+'-'+_0x169e58+'/'+_0x4065d5)['json'](_0x10ea9b);}return null;};}function patchUpdates(_0x4c95da){return function(_0x317301){try{jsonpatch['apply'](_0x317301,_0x4c95da,!![]);}catch(_0x1beeb1){return BPromise[_0xc96c('0x20')](_0x1beeb1);}return _0x317301['save']();};}function saveUpdates(_0x48b96e,_0x434078){return function(_0x3e4ef3){if(_0x3e4ef3){return _0x3e4ef3[_0xc96c('0x21')](_0x48b96e)[_0xc96c('0x22')](function(_0x19ecfb){return _0x19ecfb;});}return null;};}function removeEntity(_0x11a996,_0x551913){return function(_0x5e4428){if(_0x5e4428){return _0x5e4428[_0xc96c('0x23')]()[_0xc96c('0x22')](function(){_0x11a996['status'](0xcc)[_0xc96c('0x24')]();});}};}function handleEntityNotFound(_0x4fb791,_0x3e7c70){return function(_0xb9980b){if(!_0xb9980b){_0x4fb791[_0xc96c('0x1a')](0x194);}return _0xb9980b;};}function handleError(_0x4ba774,_0x629e55){_0x629e55=_0x629e55||0x1f4;return function(_0x421e2c){logger['error'](_0x421e2c[_0xc96c('0x25')]);if(_0x421e2c[_0xc96c('0x26')]){delete _0x421e2c['name'];}_0x4ba774['status'](_0x629e55)['send'](_0x421e2c);};}exports[_0xc96c('0x27')]=function(_0x222c92,_0x1f8f26){var _0x5abc39={},_0x372232={},_0x59f472={'count':0x0,'rows':[]};var _0x54be2e=_[_0xc96c('0x28')](db[_0xc96c('0x29')][_0xc96c('0x2a')],function(_0x5080fd){return{'name':_0x5080fd[_0xc96c('0x2b')],'type':_0x5080fd[_0xc96c('0x2c')][_0xc96c('0x2d')]};});_0x372232[_0xc96c('0x2e')]=_[_0xc96c('0x28')](_0x54be2e,'name');_0x372232[_0xc96c('0x2f')]=_['keys'](_0x222c92['query']);_0x372232[_0xc96c('0x30')]=_[_0xc96c('0x31')](_0x372232['model'],_0x372232[_0xc96c('0x2f')]);_0x5abc39[_0xc96c('0x32')]=_['intersection'](_0x372232[_0xc96c('0x2e')],qs[_0xc96c('0x33')](_0x222c92['query'][_0xc96c('0x33')]));_0x5abc39['attributes']=_0x5abc39[_0xc96c('0x32')]['length']?_0x5abc39[_0xc96c('0x32')]:_0x372232['model'];if(!_0x222c92[_0xc96c('0x2f')][_0xc96c('0x34')]('nolimit')){_0x5abc39['limit']=qs['limit'](_0x222c92[_0xc96c('0x2f')]['limit']);_0x5abc39[_0xc96c('0x1c')]=qs[_0xc96c('0x1c')](_0x222c92[_0xc96c('0x2f')][_0xc96c('0x1c')]);}_0x5abc39[_0xc96c('0x35')]=qs[_0xc96c('0x36')](_0x222c92[_0xc96c('0x2f')][_0xc96c('0x36')]);_0x5abc39[_0xc96c('0x37')]=qs[_0xc96c('0x30')](_[_0xc96c('0x38')](_0x222c92['query'],_0x372232[_0xc96c('0x30')]),_0x54be2e);if(_0x222c92[_0xc96c('0x2f')][_0xc96c('0x39')]){_0x5abc39['where']=_['merge'](_0x5abc39[_0xc96c('0x37')],{'$or':_[_0xc96c('0x28')](_0x54be2e,function(_0x385aa7){if(_0x385aa7[_0xc96c('0x2c')]!==_0xc96c('0x3a')){var _0x2ad981={};_0x2ad981[_0x385aa7[_0xc96c('0x26')]]={'$like':'%'+_0x222c92[_0xc96c('0x2f')]['filter']+'%'};return _0x2ad981;}})});}_0x5abc39=_[_0xc96c('0x3b')]({},_0x5abc39,_0x222c92[_0xc96c('0x3c')]);var _0x23cf26={'where':_0x5abc39[_0xc96c('0x37')]};return db[_0xc96c('0x29')][_0xc96c('0x1e')](_0x23cf26)[_0xc96c('0x22')](function(_0x43f612){_0x59f472[_0xc96c('0x1e')]=_0x43f612;if(_0x222c92[_0xc96c('0x2f')]['includeAll']){_0x5abc39[_0xc96c('0x3d')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x5abc39);})['then'](function(_0x1c5e43){_0x59f472['rows']=_0x1c5e43;return _0x59f472;})[_0xc96c('0x22')](respondWithFilteredResult(_0x1f8f26,_0x5abc39))[_0xc96c('0x3e')](handleError(_0x1f8f26,null));};exports[_0xc96c('0x3f')]=function(_0x335618,_0x477b65){var _0x458da5={'raw':![],'where':{'id':_0x335618[_0xc96c('0x40')]['id']}},_0x549fdf={};_0x549fdf[_0xc96c('0x2e')]=_[_0xc96c('0x41')](db['AnalyticFieldReport']['rawAttributes']);_0x549fdf['query']=_[_0xc96c('0x41')](_0x335618[_0xc96c('0x2f')]);_0x549fdf[_0xc96c('0x30')]=_[_0xc96c('0x31')](_0x549fdf[_0xc96c('0x2e')],_0x549fdf[_0xc96c('0x2f')]);_0x458da5['attributes']=_[_0xc96c('0x31')](_0x549fdf[_0xc96c('0x2e')],qs['fields'](_0x335618[_0xc96c('0x2f')][_0xc96c('0x33')]));_0x458da5[_0xc96c('0x32')]=_0x458da5['attributes'][_0xc96c('0x42')]?_0x458da5[_0xc96c('0x32')]:_0x549fdf['model'];if(_0x335618[_0xc96c('0x2f')][_0xc96c('0x43')]){_0x458da5[_0xc96c('0x3d')]=[{'all':!![]}];}_0x458da5=_[_0xc96c('0x3b')]({},_0x458da5,_0x335618[_0xc96c('0x3c')]);return db[_0xc96c('0x29')][_0xc96c('0x44')](_0x458da5)[_0xc96c('0x22')](handleEntityNotFound(_0x477b65,null))[_0xc96c('0x22')](respondWithResult(_0x477b65,null))[_0xc96c('0x3e')](handleError(_0x477b65,null));};exports[_0xc96c('0x45')]=function(_0x564c26,_0x465d21){return db[_0xc96c('0x29')][_0xc96c('0x45')](_0x564c26[_0xc96c('0x46')],{})[_0xc96c('0x22')](respondWithResult(_0x465d21,0xc9))['catch'](handleError(_0x465d21,null));};exports[_0xc96c('0x47')]=function(_0x326188,_0x25d1e5){return db[_0xc96c('0x29')][_0xc96c('0x47')](_0x326188[_0xc96c('0x46')],{'raw':![],'individualHooks':!![]})[_0xc96c('0x22')](respondWithResult(_0x25d1e5,0xc9))[_0xc96c('0x3e')](handleError(_0x25d1e5,null));};exports[_0xc96c('0x21')]=function(_0x3c5492,_0x4559df){if(_0x3c5492[_0xc96c('0x46')]['id']){delete _0x3c5492[_0xc96c('0x46')]['id'];}return db[_0xc96c('0x29')]['find']({'where':{'id':_0x3c5492[_0xc96c('0x40')]['id']}})[_0xc96c('0x22')](handleEntityNotFound(_0x4559df,null))[_0xc96c('0x22')](saveUpdates(_0x3c5492['body'],null))[_0xc96c('0x22')](respondWithResult(_0x4559df,null))[_0xc96c('0x3e')](handleError(_0x4559df,null));};exports['destroy']=function(_0x4da89c,_0x3b357c){return db[_0xc96c('0x29')]['find']({'where':{'id':_0x4da89c[_0xc96c('0x40')]['id']}})[_0xc96c('0x22')](handleEntityNotFound(_0x3b357c,null))[_0xc96c('0x22')](removeEntity(_0x3b357c,null))[_0xc96c('0x3e')](handleError(_0x3b357c,null));};exports[_0xc96c('0x48')]=function(_0x5094d9,_0x3e7eda){return db[_0xc96c('0x29')][_0xc96c('0x23')]({'where':{'id':_0x5094d9[_0xc96c('0x2f')][_0xc96c('0x49')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3e7eda,0xcc))[_0xc96c('0x3e')](handleError(_0x3e7eda,null));};exports[_0xc96c('0x4a')]=function(_0x2d3b61,_0x274e79,_0x41a617){return db[_0xc96c('0x4b')][_0xc96c('0x4c')]({'where':{'id':_0x2d3b61[_0xc96c('0x40')]['id']}})[_0xc96c('0x22')](handleEntityNotFound(_0x274e79,null))[_0xc96c('0x22')](function(_0x5ae629){if(_0x5ae629){return db[_0xc96c('0x4d')][_0xc96c('0x4e')](function(_0x47c8c3){return db['AnalyticFieldReport'][_0xc96c('0x23')]({'where':{'CustomReportId':_0x2d3b61[_0xc96c('0x40')]['id']},'transaction':_0x47c8c3})[_0xc96c('0x22')](function(_0x5ae500){var _0x4e0bab=_[_0xc96c('0x28')](_0x2d3b61[_0xc96c('0x46')],function(_0x5b9122){delete _0x5b9122['id'];_0x5b9122[_0xc96c('0x4f')]=_0x2d3b61['params']['id'];return _0x5b9122;});return db[_0xc96c('0x29')][_0xc96c('0x47')](_0x4e0bab,{'transaction':_0x47c8c3});});})['then'](function(){return db[_0xc96c('0x29')][_0xc96c('0x50')]({'where':{'CustomReportId':_0x2d3b61[_0xc96c('0x40')]['id']}});});}})[_0xc96c('0x22')](respondWithResult(_0x274e79,null))[_0xc96c('0x3e')](handleError(_0x274e79,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index a6d546e..bd07c3b 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 _0xb4e5=['lodash','util','api','moment','bluebird','request-promise','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xb4e5,0x18c));var _0x5b4e=function(_0x3e5237,_0x3845d8){_0x3e5237=_0x3e5237-0x0;var _0x252880=_0xb4e5[_0x3e5237];return _0x252880;};'use strict';var _=require(_0x5b4e('0x0'));var util=require(_0x5b4e('0x1'));var logger=require('../../config/logger')(_0x5b4e('0x2'));var moment=require(_0x5b4e('0x3'));var BPromise=require(_0x5b4e('0x4'));var rp=require(_0x5b4e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5b4e('0x6'));var attributes=require(_0x5b4e('0x7'));module[_0x5b4e('0x8')]=function(_0x589617,_0x2f0aed){return _0x589617['define'](_0x5b4e('0x9'),attributes,{'tableName':_0x5b4e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd133=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','api','bluebird','request-promise','path'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd133,0x192));var _0x3d13=function(_0x318f1f,_0x4a62d9){_0x318f1f=_0x318f1f-0x0;var _0x99ce5f=_0xd133[_0x318f1f];return _0x99ce5f;};'use strict';var _=require(_0x3d13('0x0'));var util=require(_0x3d13('0x1'));var logger=require('../../config/logger')(_0x3d13('0x2'));var moment=require('moment');var BPromise=require(_0x3d13('0x3'));var rp=require(_0x3d13('0x4'));var fs=require('fs');var path=require(_0x3d13('0x5'));var rimraf=require('rimraf');var config=require(_0x3d13('0x6'));var attributes=require(_0x3d13('0x7'));module[_0x3d13('0x8')]=function(_0x11befb,_0x97449){return _0x11befb[_0x3d13('0x9')](_0x3d13('0xa'),attributes,{'tableName':_0x3d13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index a8611d2..d525ef1 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 _0xf7d9=['AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug'];(function(_0x56f086,_0x580fb8){var _0x5a80a1=function(_0x5a4bd4){while(--_0x5a4bd4){_0x56f086['push'](_0x56f086['shift']());}};_0x5a80a1(++_0x580fb8);}(_0xf7d9,0x70));var _0x9f7d=function(_0x2c0160,_0x3a79b5){_0x2c0160=_0x2c0160-0x0;var _0x15d4dd=_0xf7d9[_0x2c0160];return _0x15d4dd;};'use strict';var _=require(_0x9f7d('0x0'));var util=require('util');var moment=require(_0x9f7d('0x1'));var BPromise=require(_0x9f7d('0x2'));var rs=require(_0x9f7d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f7d('0x4'))['db'];var utils=require(_0x9f7d('0x5'));var logger=require(_0x9f7d('0x6'))(_0x9f7d('0x7'));var config=require(_0x9f7d('0x8'));var jayson=require(_0x9f7d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x72e787,_0x1471f8,_0x4a18a0){return new BPromise(function(_0x2c03dd,_0x402c4a){return client['request'](_0x72e787,_0x4a18a0)[_0x9f7d('0xa')](function(_0x566bec){logger[_0x9f7d('0xb')](_0x9f7d('0xc'),_0x1471f8,'request\x20sent');logger[_0x9f7d('0xd')](_0x9f7d('0xe'),_0x1471f8,_0x9f7d('0xf'),JSON[_0x9f7d('0x10')](_0x566bec));if(_0x566bec[_0x9f7d('0x11')]){if(_0x566bec[_0x9f7d('0x11')][_0x9f7d('0x12')]===0x1f4){logger[_0x9f7d('0x11')](_0x9f7d('0xc'),_0x1471f8,_0x566bec[_0x9f7d('0x11')][_0x9f7d('0x13')]);return _0x402c4a(_0x566bec[_0x9f7d('0x11')][_0x9f7d('0x13')]);}logger['error'](_0x9f7d('0xc'),_0x1471f8,_0x566bec[_0x9f7d('0x11')][_0x9f7d('0x13')]);return _0x2c03dd(_0x566bec[_0x9f7d('0x11')][_0x9f7d('0x13')]);}else{logger[_0x9f7d('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1471f8,_0x9f7d('0xf'));_0x2c03dd(_0x566bec['result'][_0x9f7d('0x13')]);}})[_0x9f7d('0x14')](function(_0x214199){logger[_0x9f7d('0x11')](_0x9f7d('0xc'),_0x1471f8,_0x214199);_0x402c4a(_0x214199);});});} \ No newline at end of file +var _0x7546=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x9df469,_0x4ff02d){var _0x2a928d=function(_0x824562){while(--_0x824562){_0x9df469['push'](_0x9df469['shift']());}};_0x2a928d(++_0x4ff02d);}(_0x7546,0xc1));var _0x6754=function(_0x5e2766,_0x1cc554){_0x5e2766=_0x5e2766-0x0;var _0x3d357c=_0x7546[_0x5e2766];return _0x3d357c;};'use strict';var _=require(_0x6754('0x0'));var util=require(_0x6754('0x1'));var moment=require('moment');var BPromise=require(_0x6754('0x2'));var rs=require(_0x6754('0x3'));var fs=require('fs');var Redis=require(_0x6754('0x4'));var db=require(_0x6754('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6754('0x6'))(_0x6754('0x7'));var config=require(_0x6754('0x8'));var jayson=require(_0x6754('0x9'));var client=jayson['client'][_0x6754('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x561f04,_0x15e052,_0x56d842){return new BPromise(function(_0x29bc08,_0x198654){return client['request'](_0x561f04,_0x56d842)['then'](function(_0x17f8cb){logger[_0x6754('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x15e052,'request\x20sent');logger[_0x6754('0xc')](_0x6754('0xd'),_0x15e052,_0x6754('0xe'),JSON[_0x6754('0xf')](_0x17f8cb));if(_0x17f8cb[_0x6754('0x10')]){if(_0x17f8cb['error'][_0x6754('0x11')]===0x1f4){logger[_0x6754('0x10')](_0x6754('0x12'),_0x15e052,_0x17f8cb[_0x6754('0x10')][_0x6754('0x13')]);return _0x198654(_0x17f8cb['error']['message']);}logger[_0x6754('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x15e052,_0x17f8cb['error'][_0x6754('0x13')]);return _0x29bc08(_0x17f8cb[_0x6754('0x10')]['message']);}else{logger[_0x6754('0xb')](_0x6754('0x12'),_0x15e052,'request\x20sent');_0x29bc08(_0x17f8cb[_0x6754('0x14')]['message']);}})[_0x6754('0x15')](function(_0x49971f){logger[_0x6754('0x10')](_0x6754('0x12'),_0x15e052,_0x49971f);_0x198654(_0x49971f);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index fadd717..1889d97 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(_0x99fc98,_0x4acfe1){var _0x59d220=function(_0x4f1357){while(--_0x4f1357){_0x99fc98['push'](_0x99fc98['shift']());}};_0x59d220(++_0x4acfe1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x586685,_0x1f1e78){var _0x427f30=function(_0x1165aa){while(--_0x1165aa){_0x586685['push'](_0x586685['shift']());}};_0x427f30(++_0x1f1e78);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 e9e4e0f..3451100 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 _0xdb94=['exports','STRING','name','sequelize'];(function(_0x24d94a,_0x409962){var _0x5130dc=function(_0x46a646){while(--_0x46a646){_0x24d94a['push'](_0x24d94a['shift']());}};_0x5130dc(++_0x409962);}(_0xdb94,0xab));var _0x4db9=function(_0x413197,_0x48750e){_0x413197=_0x413197-0x0;var _0x1124d6=_0xdb94[_0x413197];return _0x1124d6;};'use strict';var Sequelize=require(_0x4db9('0x0'));module[_0x4db9('0x1')]={'name':{'type':Sequelize[_0x4db9('0x2')],'allowNull':![],'unique':_0x4db9('0x3')},'table':{'type':Sequelize[_0x4db9('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x4db9('0x2')]}}; \ No newline at end of file +var _0x9861=['STRING','TEXT','sequelize','name'];(function(_0x44300b,_0x4fa6d7){var _0x15b8fd=function(_0x2752d4){while(--_0x2752d4){_0x44300b['push'](_0x44300b['shift']());}};_0x15b8fd(++_0x4fa6d7);}(_0x9861,0x176));var _0x1986=function(_0x2dd111,_0x4e2549){_0x2dd111=_0x2dd111-0x0;var _0xafe89f=_0x9861[_0x2dd111];return _0xafe89f;};'use strict';var Sequelize=require(_0x1986('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1986('0x1')},'table':{'type':Sequelize[_0x1986('0x2')]},'metric':{'type':Sequelize[_0x1986('0x3')]},'description':{'type':Sequelize[_0x1986('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 848deca..6694bea 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 _0xd6d6=['includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','include','AnalyticMetric','rows','show'];(function(_0x30d96b,_0x1e2bb3){var _0x21d3f7=function(_0x500d2c){while(--_0x500d2c){_0x30d96b['push'](_0x30d96b['shift']());}};_0x21d3f7(++_0x1e2bb3);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x841311,_0x362f39){_0x841311=_0x841311-0x0;var _0x5b71f5=_0xd6d6[_0x841311];return _0x5b71f5;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){var _0x99f7d6=_0x583b10[_0x6d6d('0x29')]({'plain':!![]});var _0xf0df7f=_0x6d6d('0x2a');return db['UserProfileResource'][_0x6d6d('0x28')]({'where':{'type':_0xf0df7f,'resourceId':_0x99f7d6['id']}})[_0x6d6d('0x27')](function(){return _0x583b10;});})[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0x408f98,_0x3641fc){return function(_0x4a57a1){if(!_0x4a57a1){_0x408f98[_0x6d6d('0x19')](0x194);}return _0x4a57a1;};}function handleError(_0x9595d8,_0x51bd68){_0x51bd68=_0x51bd68||0x1f4;return function(_0x553645){logger[_0x6d6d('0x2b')](_0x553645[_0x6d6d('0x2c')]);if(_0x553645[_0x6d6d('0x2d')]){delete _0x553645['name'];}_0x9595d8[_0x6d6d('0x1a')](_0x51bd68)[_0x6d6d('0x2e')](_0x553645);};}exports[_0x6d6d('0x2f')]=function(_0x1c8340,_0x64d1f7){var _0x428c17={},_0xdda3f2={},_0x359cfd={'count':0x0,'rows':[]};var _0x6c4741=_[_0x6d6d('0x30')](db['AnalyticMetric'][_0x6d6d('0x31')],function(_0x4f1fc5){return{'name':_0x4f1fc5[_0x6d6d('0x32')],'type':_0x4f1fc5[_0x6d6d('0x33')][_0x6d6d('0x34')]};});_0xdda3f2[_0x6d6d('0x35')]=_['map'](_0x6c4741,_0x6d6d('0x2d'));_0xdda3f2['query']=_[_0x6d6d('0x36')](_0x1c8340[_0x6d6d('0x37')]);_0xdda3f2['filters']=_[_0x6d6d('0x38')](_0xdda3f2[_0x6d6d('0x35')],_0xdda3f2[_0x6d6d('0x37')]);_0x428c17[_0x6d6d('0x39')]=_[_0x6d6d('0x38')](_0xdda3f2[_0x6d6d('0x35')],qs[_0x6d6d('0x3a')](_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x3a')]));_0x428c17[_0x6d6d('0x39')]=_0x428c17[_0x6d6d('0x39')][_0x6d6d('0x3b')]?_0x428c17[_0x6d6d('0x39')]:_0xdda3f2[_0x6d6d('0x35')];if(!_0x1c8340['query'][_0x6d6d('0x3c')](_0x6d6d('0x3d'))){_0x428c17[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x1c8340['query']['limit']);_0x428c17[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x1c8340[_0x6d6d('0x37')]['offset']);}_0x428c17[_0x6d6d('0x3e')]=qs[_0x6d6d('0x3f')](_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x3f')]);_0x428c17['where']=qs['filters'](_['pick'](_0x1c8340[_0x6d6d('0x37')],_0xdda3f2[_0x6d6d('0x40')]),_0x6c4741);if(_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x41')]){_0x428c17['where']=_[_0x6d6d('0x42')](_0x428c17[_0x6d6d('0x43')],{'$or':_[_0x6d6d('0x30')](_0x6c4741,function(_0x3c6d23){if(_0x3c6d23[_0x6d6d('0x33')]!==_0x6d6d('0x44')){var _0x4b457d={};_0x4b457d[_0x3c6d23[_0x6d6d('0x2d')]]={'$like':'%'+_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x41')]+'%'};return _0x4b457d;}})});}_0x428c17=_[_0x6d6d('0x42')]({},_0x428c17,_0x1c8340[_0x6d6d('0x45')]);var _0x3e27b7={'where':_0x428c17[_0x6d6d('0x43')]};return db['AnalyticMetric'][_0x6d6d('0x20')](_0x3e27b7)[_0x6d6d('0x27')](function(_0x16e177){_0x359cfd[_0x6d6d('0x20')]=_0x16e177;if(_0x1c8340[_0x6d6d('0x37')]['includeAll']){_0x428c17[_0x6d6d('0x46')]=[{'all':!![]}];}return db[_0x6d6d('0x47')]['findAll'](_0x428c17);})[_0x6d6d('0x27')](function(_0x50dc17){_0x359cfd[_0x6d6d('0x48')]=_0x50dc17;return _0x359cfd;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x64d1f7,_0x428c17))['catch'](handleError(_0x64d1f7,null));};exports[_0x6d6d('0x49')]=function(_0x3324ec,_0x252cbe){var _0x4041f3={'raw':!![],'where':{'id':_0x3324ec['params']['id']}},_0xf7ea0d={};_0xf7ea0d['model']=_[_0x6d6d('0x36')](db['AnalyticMetric']['rawAttributes']);_0xf7ea0d[_0x6d6d('0x37')]=_[_0x6d6d('0x36')](_0x3324ec[_0x6d6d('0x37')]);_0xf7ea0d['filters']=_[_0x6d6d('0x38')](_0xf7ea0d['model'],_0xf7ea0d[_0x6d6d('0x37')]);_0x4041f3[_0x6d6d('0x39')]=_[_0x6d6d('0x38')](_0xf7ea0d[_0x6d6d('0x35')],qs[_0x6d6d('0x3a')](_0x3324ec[_0x6d6d('0x37')][_0x6d6d('0x3a')]));_0x4041f3['attributes']=_0x4041f3[_0x6d6d('0x39')][_0x6d6d('0x3b')]?_0x4041f3[_0x6d6d('0x39')]:_0xf7ea0d[_0x6d6d('0x35')];if(_0x3324ec[_0x6d6d('0x37')][_0x6d6d('0x4a')]){_0x4041f3[_0x6d6d('0x46')]=[{'all':!![]}];}_0x4041f3=_[_0x6d6d('0x42')]({},_0x4041f3,_0x3324ec[_0x6d6d('0x45')]);return db['AnalyticMetric']['find'](_0x4041f3)[_0x6d6d('0x27')](handleEntityNotFound(_0x252cbe,null))[_0x6d6d('0x27')](respondWithResult(_0x252cbe,null))[_0x6d6d('0x4b')](handleError(_0x252cbe,null));};exports[_0x6d6d('0x4c')]=function(_0xe2a20e,_0x492834){return db[_0x6d6d('0x47')][_0x6d6d('0x4c')](_0xe2a20e[_0x6d6d('0x4d')],{})[_0x6d6d('0x27')](function(_0x2ee917){var _0x23c2db=_0xe2a20e[_0x6d6d('0x4e')][_0x6d6d('0x29')]({'plain':!![]});if(!_0x23c2db)throw new Error(_0x6d6d('0x4f'));if(_0x23c2db[_0x6d6d('0x50')]===_0x6d6d('0x4e')){var _0x175e26=_0x2ee917['get']({'plain':!![]});var _0x190786=_0x6d6d('0x2a');return db[_0x6d6d('0x51')][_0x6d6d('0x52')]({'where':{'name':_0x190786,'userProfileId':_0x23c2db[_0x6d6d('0x53')]},'raw':!![]})['then'](function(_0x38c307){if(_0x38c307&&_0x38c307[_0x6d6d('0x54')]===0x0){return db[_0x6d6d('0x55')]['create']({'name':_0x175e26['name'],'resourceId':_0x175e26['id'],'type':_0x38c307[_0x6d6d('0x2d')],'sectionId':_0x38c307['id']},{})['then'](function(){return _0x2ee917;});}else{return _0x2ee917;}})[_0x6d6d('0x4b')](function(_0x995fe2){logger[_0x6d6d('0x2b')](_0x6d6d('0x56'),_0x995fe2);throw _0x995fe2;});}return _0x2ee917;})[_0x6d6d('0x27')](respondWithResult(_0x492834,0xc9))[_0x6d6d('0x4b')](handleError(_0x492834,null));};exports[_0x6d6d('0x26')]=function(_0x26c23a,_0x1a8f33){if(_0x26c23a[_0x6d6d('0x4d')]['id']){delete _0x26c23a['body']['id'];}return db[_0x6d6d('0x47')][_0x6d6d('0x52')]({'where':{'id':_0x26c23a[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x1a8f33,null))[_0x6d6d('0x27')](saveUpdates(_0x26c23a[_0x6d6d('0x4d')],null))[_0x6d6d('0x27')](respondWithResult(_0x1a8f33,null))['catch'](handleError(_0x1a8f33,null));};exports['destroy']=function(_0x3ad9b0,_0x122865){return db['AnalyticMetric'][_0x6d6d('0x52')]({'where':{'id':_0x3ad9b0[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x122865,null))[_0x6d6d('0x27')](removeEntity(_0x122865,null))[_0x6d6d('0x4b')](handleError(_0x122865,null));}; \ No newline at end of file +var _0x81bd=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','AnalyticMetric','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','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','sox','ejs','fs-extra','lodash','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','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','stack','name','send','index','map','fieldName','query','keys'];(function(_0x302c34,_0x38bd1f){var _0x1c1a7f=function(_0x7348a3){while(--_0x7348a3){_0x302c34['push'](_0x302c34['shift']());}};_0x1c1a7f(++_0x38bd1f);}(_0x81bd,0x7c));var _0xd81b=function(_0x33f750,_0x3a0638){_0x33f750=_0x33f750-0x0;var _0xd2186a=_0x81bd[_0x33f750];return _0xd2186a;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xcc;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x1b')](_0x57f71d);}return _0x21dfff['status'](_0x57f71d)[_0xd81b('0x1c')]();};}function respondWithResult(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0xc8;return function(_0x41bf7a){if(_0x41bf7a){return _0x47dd04[_0xd81b('0x1d')](_0x13dd00)[_0xd81b('0x1e')](_0x41bf7a);}};}function respondWithFilteredResult(_0x128162,_0x552215){return function(_0x1c620d){if(_0x1c620d){var _0x27b7a0=typeof _0x552215['offset']===_0xd81b('0x1f')&&typeof _0x552215[_0xd81b('0x20')]===_0xd81b('0x1f');var _0x15e860=_0x1c620d[_0xd81b('0x21')];var _0xc49b8d=_0x27b7a0?0x0:_0x552215[_0xd81b('0x22')];var _0x3d4d34=_0x27b7a0?_0x1c620d[_0xd81b('0x21')]:_0x552215[_0xd81b('0x22')]+_0x552215[_0xd81b('0x20')];var _0x453952;if(_0x3d4d34>=_0x15e860){_0x3d4d34=_0x15e860;_0x453952=0xc8;}else{_0x453952=0xce;}_0x128162[_0xd81b('0x1d')](_0x453952);return _0x128162[_0xd81b('0x23')](_0xd81b('0x24'),_0xc49b8d+'-'+_0x3d4d34+'/'+_0x15e860)[_0xd81b('0x1e')](_0x1c620d);}return null;};}function patchUpdates(_0x5f101a){return function(_0x4d566e){try{jsonpatch[_0xd81b('0x25')](_0x4d566e,_0x5f101a,!![]);}catch(_0x1b7876){return BPromise[_0xd81b('0x26')](_0x1b7876);}return _0x4d566e['save']();};}function saveUpdates(_0x19ed0e,_0x6571a6){return function(_0x542ee2){if(_0x542ee2){return _0x542ee2[_0xd81b('0x27')](_0x19ed0e)[_0xd81b('0x28')](function(_0x1670cd){return _0x1670cd;});}return null;};}function removeEntity(_0x1ad65c,_0x279176){return function(_0xcb4f91){if(_0xcb4f91){return _0xcb4f91[_0xd81b('0x29')]()[_0xd81b('0x28')](function(){var _0x341aec=_0xcb4f91[_0xd81b('0x2a')]({'plain':!![]});var _0x2ccedf=_0xd81b('0x2b');return db['UserProfileResource'][_0xd81b('0x29')]({'where':{'type':_0x2ccedf,'resourceId':_0x341aec['id']}})[_0xd81b('0x28')](function(){return _0xcb4f91;});})[_0xd81b('0x28')](function(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2d0d02,_0x3e28dd){return function(_0x73dc09){if(!_0x73dc09){_0x2d0d02[_0xd81b('0x1b')](0x194);}return _0x73dc09;};}function handleError(_0x483a3d,_0x469cc4){_0x469cc4=_0x469cc4||0x1f4;return function(_0x4e2eff){logger['error'](_0x4e2eff[_0xd81b('0x2c')]);if(_0x4e2eff[_0xd81b('0x2d')]){delete _0x4e2eff['name'];}_0x483a3d['status'](_0x469cc4)[_0xd81b('0x2e')](_0x4e2eff);};}exports[_0xd81b('0x2f')]=function(_0x1b1434,_0x289f54){var _0x1a1572={},_0x4654ba={},_0x5527ed={'count':0x0,'rows':[]};var _0x37d381=_[_0xd81b('0x30')](db['AnalyticMetric']['rawAttributes'],function(_0x165892){return{'name':_0x165892[_0xd81b('0x31')],'type':_0x165892['type']['key']};});_0x4654ba['model']=_[_0xd81b('0x30')](_0x37d381,_0xd81b('0x2d'));_0x4654ba[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x1b1434[_0xd81b('0x32')]);_0x4654ba[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x4654ba['model'],_0x4654ba[_0xd81b('0x32')]);_0x1a1572['attributes']=_[_0xd81b('0x35')](_0x4654ba[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x37')]));_0x1a1572[_0xd81b('0x38')]=_0x1a1572[_0xd81b('0x38')][_0xd81b('0x39')]?_0x1a1572[_0xd81b('0x38')]:_0x4654ba[_0xd81b('0x36')];if(!_0x1b1434[_0xd81b('0x32')][_0xd81b('0x3a')](_0xd81b('0x3b'))){_0x1a1572['limit']=qs['limit'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x20')]);_0x1a1572[_0xd81b('0x22')]=qs['offset'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x22')]);}_0x1a1572['order']=qs[_0xd81b('0x3c')](_0x1b1434[_0xd81b('0x32')]['sort']);_0x1a1572[_0xd81b('0x3d')]=qs['filters'](_[_0xd81b('0x3e')](_0x1b1434[_0xd81b('0x32')],_0x4654ba[_0xd81b('0x34')]),_0x37d381);if(_0x1b1434[_0xd81b('0x32')]['filter']){_0x1a1572[_0xd81b('0x3d')]=_[_0xd81b('0x3f')](_0x1a1572[_0xd81b('0x3d')],{'$or':_[_0xd81b('0x30')](_0x37d381,function(_0x3abd60){if(_0x3abd60[_0xd81b('0x40')]!==_0xd81b('0x41')){var _0x532ada={};_0x532ada[_0x3abd60[_0xd81b('0x2d')]]={'$like':'%'+_0x1b1434[_0xd81b('0x32')][_0xd81b('0x42')]+'%'};return _0x532ada;}})});}_0x1a1572=_['merge']({},_0x1a1572,_0x1b1434[_0xd81b('0x43')]);var _0x3a05f4={'where':_0x1a1572[_0xd81b('0x3d')]};return db[_0xd81b('0x44')][_0xd81b('0x21')](_0x3a05f4)['then'](function(_0x3dfba7){_0x5527ed[_0xd81b('0x21')]=_0x3dfba7;if(_0x1b1434[_0xd81b('0x32')][_0xd81b('0x45')]){_0x1a1572[_0xd81b('0x46')]=[{'all':!![]}];}return db[_0xd81b('0x44')][_0xd81b('0x47')](_0x1a1572);})[_0xd81b('0x28')](function(_0x4405a8){_0x5527ed[_0xd81b('0x48')]=_0x4405a8;return _0x5527ed;})[_0xd81b('0x28')](respondWithFilteredResult(_0x289f54,_0x1a1572))['catch'](handleError(_0x289f54,null));};exports[_0xd81b('0x49')]=function(_0x2778b3,_0x25824e){var _0xa5e391={'raw':!![],'where':{'id':_0x2778b3[_0xd81b('0x4a')]['id']}},_0x1e6654={};_0x1e6654[_0xd81b('0x36')]=_[_0xd81b('0x33')](db['AnalyticMetric']['rawAttributes']);_0x1e6654[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x2778b3[_0xd81b('0x32')]);_0x1e6654[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],_0x1e6654[_0xd81b('0x32')]);_0xa5e391[_0xd81b('0x38')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x2778b3[_0xd81b('0x32')]['fields']));_0xa5e391[_0xd81b('0x38')]=_0xa5e391[_0xd81b('0x38')][_0xd81b('0x39')]?_0xa5e391[_0xd81b('0x38')]:_0x1e6654[_0xd81b('0x36')];if(_0x2778b3[_0xd81b('0x32')][_0xd81b('0x45')]){_0xa5e391[_0xd81b('0x46')]=[{'all':!![]}];}_0xa5e391=_[_0xd81b('0x3f')]({},_0xa5e391,_0x2778b3['options']);return db[_0xd81b('0x44')][_0xd81b('0x4b')](_0xa5e391)[_0xd81b('0x28')](handleEntityNotFound(_0x25824e,null))[_0xd81b('0x28')](respondWithResult(_0x25824e,null))['catch'](handleError(_0x25824e,null));};exports[_0xd81b('0x4c')]=function(_0x151127,_0x15030b){return db[_0xd81b('0x44')][_0xd81b('0x4c')](_0x151127[_0xd81b('0x4d')],{})[_0xd81b('0x28')](function(_0x43d7ce){var _0x133a76=_0x151127['user']['get']({'plain':!![]});if(!_0x133a76)throw new Error(_0xd81b('0x4e'));if(_0x133a76[_0xd81b('0x4f')]===_0xd81b('0x50')){var _0x4da281=_0x43d7ce[_0xd81b('0x2a')]({'plain':!![]});var _0x3d6ab3=_0xd81b('0x2b');return db[_0xd81b('0x51')]['find']({'where':{'name':_0x3d6ab3,'userProfileId':_0x133a76[_0xd81b('0x52')]},'raw':!![]})[_0xd81b('0x28')](function(_0x1b523c){if(_0x1b523c&&_0x1b523c[_0xd81b('0x53')]===0x0){return db[_0xd81b('0x54')]['create']({'name':_0x4da281[_0xd81b('0x2d')],'resourceId':_0x4da281['id'],'type':_0x1b523c[_0xd81b('0x2d')],'sectionId':_0x1b523c['id']},{})['then'](function(){return _0x43d7ce;});}else{return _0x43d7ce;}})[_0xd81b('0x55')](function(_0x315bd5){logger[_0xd81b('0x56')](_0xd81b('0x57'),_0x315bd5);throw _0x315bd5;});}return _0x43d7ce;})[_0xd81b('0x28')](respondWithResult(_0x15030b,0xc9))[_0xd81b('0x55')](handleError(_0x15030b,null));};exports[_0xd81b('0x27')]=function(_0x22f588,_0x3ed626){if(_0x22f588[_0xd81b('0x4d')]['id']){delete _0x22f588[_0xd81b('0x4d')]['id'];}return db['AnalyticMetric'][_0xd81b('0x4b')]({'where':{'id':_0x22f588['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x3ed626,null))[_0xd81b('0x28')](saveUpdates(_0x22f588[_0xd81b('0x4d')],null))[_0xd81b('0x28')](respondWithResult(_0x3ed626,null))[_0xd81b('0x55')](handleError(_0x3ed626,null));};exports[_0xd81b('0x29')]=function(_0x5c196a,_0x2d978d){return db[_0xd81b('0x44')]['find']({'where':{'id':_0x5c196a['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x2d978d,null))['then'](removeEntity(_0x2d978d,null))[_0xd81b('0x55')](handleError(_0x2d978d,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index afa8ac9..6cb25a4 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 _0x3c94=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment'];(function(_0xdca5fd,_0x5c1097){var _0x2d457f=function(_0xe8bbc0){while(--_0xe8bbc0){_0xdca5fd['push'](_0xdca5fd['shift']());}};_0x2d457f(++_0x5c1097);}(_0x3c94,0xcd));var _0x43c9=function(_0x3fd4b3,_0x17d3ef){_0x3fd4b3=_0x3fd4b3-0x0;var _0x2979a3=_0x3c94[_0x3fd4b3];return _0x2979a3;};'use strict';var _=require(_0x43c9('0x0'));var util=require(_0x43c9('0x1'));var logger=require(_0x43c9('0x2'))(_0x43c9('0x3'));var moment=require(_0x43c9('0x4'));var BPromise=require(_0x43c9('0x5'));var rp=require(_0x43c9('0x6'));var fs=require('fs');var path=require(_0x43c9('0x7'));var rimraf=require(_0x43c9('0x8'));var config=require(_0x43c9('0x9'));var attributes=require(_0x43c9('0xa'));module[_0x43c9('0xb')]=function(_0x4fdfc2,_0x39c220){return _0x4fdfc2[_0x43c9('0xc')](_0x43c9('0xd'),attributes,{'tableName':_0x43c9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb82=['../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x25bb37,_0x1e920c){var _0x29551b=function(_0x342b2b){while(--_0x342b2b){_0x25bb37['push'](_0x25bb37['shift']());}};_0x29551b(++_0x1e920c);}(_0xfb82,0x17f));var _0x2fb8=function(_0x207d3f,_0x5996f5){_0x207d3f=_0x207d3f-0x0;var _0x5c6784=_0xfb82[_0x207d3f];return _0x5c6784;};'use strict';var _=require(_0x2fb8('0x0'));var util=require(_0x2fb8('0x1'));var logger=require(_0x2fb8('0x2'))('api');var moment=require(_0x2fb8('0x3'));var BPromise=require(_0x2fb8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2fb8('0x5'));var rimraf=require(_0x2fb8('0x6'));var config=require(_0x2fb8('0x7'));var attributes=require(_0x2fb8('0x8'));module[_0x2fb8('0x9')]=function(_0xe9a5b5,_0x3e6900){return _0xe9a5b5[_0x2fb8('0xa')](_0x2fb8('0xb'),attributes,{'tableName':_0x2fb8('0xc'),'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 03fbff3..e5c5aac 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 _0xe54c=['http','request','then','info','debug','request\x20sent','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','ioredis','../../config/logger','client'];(function(_0x578d9b,_0x486d55){var _0x26bdda=function(_0x247bd0){while(--_0x247bd0){_0x578d9b['push'](_0x578d9b['shift']());}};_0x26bdda(++_0x486d55);}(_0xe54c,0x198));var _0xce54=function(_0x17e2e7,_0xe9e1d0){_0x17e2e7=_0x17e2e7-0x0;var _0x2ed751=_0xe54c[_0x17e2e7];return _0x2ed751;};'use strict';var _=require(_0xce54('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xce54('0x1'));var rs=require(_0xce54('0x2'));var fs=require('fs');var Redis=require(_0xce54('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce54('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xce54('0x5')][_0xce54('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4dd62c,_0x15862e,_0x22849a){return new BPromise(function(_0x291b2b,_0xe79517){return client[_0xce54('0x7')](_0x4dd62c,_0x22849a)[_0xce54('0x8')](function(_0x1f7c96){logger[_0xce54('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x15862e,'request\x20sent');logger[_0xce54('0xa')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x15862e,_0xce54('0xb'),JSON[_0xce54('0xc')](_0x1f7c96));if(_0x1f7c96[_0xce54('0xd')]){if(_0x1f7c96[_0xce54('0xd')][_0xce54('0xe')]===0x1f4){logger[_0xce54('0xd')](_0xce54('0xf'),_0x15862e,_0x1f7c96['error']['message']);return _0xe79517(_0x1f7c96[_0xce54('0xd')]['message']);}logger[_0xce54('0xd')](_0xce54('0xf'),_0x15862e,_0x1f7c96[_0xce54('0xd')]['message']);return _0x291b2b(_0x1f7c96[_0xce54('0xd')][_0xce54('0x10')]);}else{logger['info'](_0xce54('0xf'),_0x15862e,'request\x20sent');_0x291b2b(_0x1f7c96[_0xce54('0x11')]['message']);}})['catch'](function(_0x1231cf){logger[_0xce54('0xd')](_0xce54('0xf'),_0x15862e,_0x1231cf);_0xe79517(_0x1231cf);});});} \ No newline at end of file +var _0x7f3b=['debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x9f2bb5,_0x1f3980){var _0x497548=function(_0x490dc4){while(--_0x490dc4){_0x9f2bb5['push'](_0x9f2bb5['shift']());}};_0x497548(++_0x1f3980);}(_0x7f3b,0xe4));var _0xb7f3=function(_0x3a9161,_0x78370e){_0x3a9161=_0x3a9161-0x0;var _0x5f3b96=_0x7f3b[_0x3a9161];return _0x5f3b96;};'use strict';var _=require('lodash');var util=require(_0xb7f3('0x0'));var moment=require(_0xb7f3('0x1'));var BPromise=require(_0xb7f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb7f3('0x3'))['db'];var utils=require(_0xb7f3('0x4'));var logger=require(_0xb7f3('0x5'))(_0xb7f3('0x6'));var config=require(_0xb7f3('0x7'));var jayson=require(_0xb7f3('0x8'));var client=jayson['client'][_0xb7f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f8872,_0x40670a,_0x355df7){return new BPromise(function(_0x3c043b,_0x18bd45){return client[_0xb7f3('0xa')](_0x3f8872,_0x355df7)[_0xb7f3('0xb')](function(_0x1f58f7){logger['info'](_0xb7f3('0xc'),_0x40670a,_0xb7f3('0xd'));logger[_0xb7f3('0xe')](_0xb7f3('0xf'),_0x40670a,_0xb7f3('0xd'),JSON['stringify'](_0x1f58f7));if(_0x1f58f7['error']){if(_0x1f58f7[_0xb7f3('0x10')][_0xb7f3('0x11')]===0x1f4){logger[_0xb7f3('0x10')](_0xb7f3('0xc'),_0x40670a,_0x1f58f7[_0xb7f3('0x10')][_0xb7f3('0x12')]);return _0x18bd45(_0x1f58f7[_0xb7f3('0x10')]['message']);}logger['error'](_0xb7f3('0xc'),_0x40670a,_0x1f58f7[_0xb7f3('0x10')][_0xb7f3('0x12')]);return _0x3c043b(_0x1f58f7[_0xb7f3('0x10')]['message']);}else{logger[_0xb7f3('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x40670a,'request\x20sent');_0x3c043b(_0x1f58f7[_0xb7f3('0x14')][_0xb7f3('0x12')]);}})[_0xb7f3('0x15')](function(_0x3870d9){logger[_0xb7f3('0x10')](_0xb7f3('0xc'),_0x40670a,_0x3870d9);_0x18bd45(_0x3870d9);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index e3fe624..f7ea0c0 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 _0x7a2d=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x2a1331,_0x383a2c){var _0x4f86e3=function(_0x3a4c91){while(--_0x3a4c91){_0x2a1331['push'](_0x2a1331['shift']());}};_0x4f86e3(++_0x383a2c);}(_0x7a2d,0x142));var _0xd7a2=function(_0x22966a,_0x57ea22){_0x22966a=_0x22966a-0x0;var _0x290c24=_0x7a2d[_0x22966a];return _0x290c24;};'use strict';var multer=require(_0xd7a2('0x0'));var util=require(_0xd7a2('0x1'));var path=require(_0xd7a2('0x2'));var timeout=require(_0xd7a2('0x3'));var express=require(_0xd7a2('0x4'));var router=express[_0xd7a2('0x5')]();var fs_extra=require(_0xd7a2('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd7a2('0x7'));var controller=require(_0xd7a2('0x8'));router[_0xd7a2('0x9')]('/',auth[_0xd7a2('0xa')](),controller['index']);router[_0xd7a2('0x9')](_0xd7a2('0xb'),auth[_0xd7a2('0xa')](),controller[_0xd7a2('0xc')]);router[_0xd7a2('0xd')]('/',auth[_0xd7a2('0xa')](),controller[_0xd7a2('0xe')]);router[_0xd7a2('0xf')](_0xd7a2('0xb'),auth['isAuthenticated'](),controller[_0xd7a2('0x10')]);router[_0xd7a2('0x11')](_0xd7a2('0xb'),auth[_0xd7a2('0xa')](),controller[_0xd7a2('0x12')]);module[_0xd7a2('0x13')]=router; \ No newline at end of file +var _0x8ff3=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./analyticMetric.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5ea5f1,_0x1e80f4){var _0x413ba7=function(_0x1ea54f){while(--_0x1ea54f){_0x5ea5f1['push'](_0x5ea5f1['shift']());}};_0x413ba7(++_0x1e80f4);}(_0x8ff3,0x72));var _0x38ff=function(_0x5773e7,_0x435e69){_0x5773e7=_0x5773e7-0x0;var _0x5e6621=_0x8ff3[_0x5773e7];return _0x5e6621;};'use strict';var multer=require(_0x38ff('0x0'));var util=require(_0x38ff('0x1'));var path=require('path');var timeout=require(_0x38ff('0x2'));var express=require(_0x38ff('0x3'));var router=express[_0x38ff('0x4')]();var fs_extra=require(_0x38ff('0x5'));var auth=require(_0x38ff('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x38ff('0x7'));router['get']('/',auth[_0x38ff('0x8')](),controller['index']);router[_0x38ff('0x9')](_0x38ff('0xa'),auth[_0x38ff('0x8')](),controller[_0x38ff('0xb')]);router[_0x38ff('0xc')]('/',auth[_0x38ff('0x8')](),controller[_0x38ff('0xd')]);router[_0x38ff('0xe')](_0x38ff('0xa'),auth[_0x38ff('0x8')](),controller[_0x38ff('0xf')]);router[_0x38ff('0x10')](_0x38ff('0xa'),auth['isAuthenticated'](),controller[_0x38ff('0x11')]);module[_0x38ff('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index ea0595b..39ba262 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 _0x17a0=['TEXT','exports'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x17a0,0x165));var _0x017a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x17a0[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0x017a('0x0')]={'tree':{'type':Sequelize[_0x017a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x3e11=['exports','sequelize'];(function(_0x3bdb89,_0x4452f8){var _0x2969e3=function(_0x3e31db){while(--_0x3e31db){_0x3bdb89['push'](_0x3bdb89['shift']());}};_0x2969e3(++_0x4452f8);}(_0x3e11,0x109));var _0x13e1=function(_0x258bff,_0x34232a){_0x258bff=_0x258bff-0x0;var _0x2add32=_0x3e11[_0x258bff];return _0x2add32;};'use strict';var Sequelize=require(_0x13e1('0x0'));module[_0x13e1('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 32d9699..1ae1727 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 _0x0083=['../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','merge','includeAll','include','rows','catch','params','keys','options','find','create','update','body','eml-format','rimraf','fast-json-patch','moment','util','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0083,0x1a1));var _0x3008=function(_0x13850b,_0x2f5da0){_0x13850b=_0x13850b-0x0;var _0x234d22=_0x0083[_0x13850b];return _0x234d22;};'use strict';var emlformat=require(_0x3008('0x0'));var rimraf=require(_0x3008('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3008('0x2'));var rp=require('request-promise');var moment=require(_0x3008('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3008('0x4'));var path=require(_0x3008('0x5'));var sox=require('sox');var csv=require(_0x3008('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3008('0x7'));var _=require(_0x3008('0x8'));var squel=require(_0x3008('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3008('0xa'));var toCsv=require(_0x3008('0x6'));var querystring=require(_0x3008('0xb'));var Papa=require(_0x3008('0xc'));var Redis=require('ioredis');var authService=require(_0x3008('0xd'));var qs=require(_0x3008('0xe'));var as=require(_0x3008('0xf'));var hardwareService=require(_0x3008('0x10'));var logger=require('../../config/logger')(_0x3008('0x11'));var utils=require(_0x3008('0x12'));var config=require(_0x3008('0x13'));var licenseUtil=require(_0x3008('0x14'));var db=require(_0x3008('0x15'))['db'];function respondWithStatusCode(_0x45b015,_0x294352){_0x294352=_0x294352||0xcc;return function(_0x494177){if(_0x494177){return _0x45b015['sendStatus'](_0x294352);}return _0x45b015[_0x3008('0x16')](_0x294352)[_0x3008('0x17')]();};}function respondWithResult(_0x5830c0,_0x3f0d33){_0x3f0d33=_0x3f0d33||0xc8;return function(_0x3b73e0){if(_0x3b73e0){return _0x5830c0[_0x3008('0x16')](_0x3f0d33)['json'](_0x3b73e0);}};}function respondWithFilteredResult(_0x22e9b9,_0x415d2c){return function(_0x441741){if(_0x441741){var _0x183907=typeof _0x415d2c[_0x3008('0x18')]===_0x3008('0x19')&&typeof _0x415d2c[_0x3008('0x1a')]===_0x3008('0x19');var _0x4d79d3=_0x441741[_0x3008('0x1b')];var _0x4dd01d=_0x183907?0x0:_0x415d2c[_0x3008('0x18')];var _0x6c8683=_0x183907?_0x441741['count']:_0x415d2c['offset']+_0x415d2c[_0x3008('0x1a')];var _0x4aa781;if(_0x6c8683>=_0x4d79d3){_0x6c8683=_0x4d79d3;_0x4aa781=0xc8;}else{_0x4aa781=0xce;}_0x22e9b9['status'](_0x4aa781);return _0x22e9b9[_0x3008('0x1c')](_0x3008('0x1d'),_0x4dd01d+'-'+_0x6c8683+'/'+_0x4d79d3)[_0x3008('0x1e')](_0x441741);}return null;};}function patchUpdates(_0x362d56){return function(_0x332107){try{jsonpatch[_0x3008('0x1f')](_0x332107,_0x362d56,!![]);}catch(_0x2e0bb8){return BPromise[_0x3008('0x20')](_0x2e0bb8);}return _0x332107[_0x3008('0x21')]();};}function saveUpdates(_0x4ca8e1,_0x20ede2){return function(_0x2c6b4b){if(_0x2c6b4b){return _0x2c6b4b['update'](_0x4ca8e1)['then'](function(_0x1cf05a){return _0x1cf05a;});}return null;};}function removeEntity(_0x57e651,_0x3e7c5f){return function(_0x42d276){if(_0x42d276){return _0x42d276['destroy']()[_0x3008('0x22')](function(){_0x57e651['status'](0xcc)[_0x3008('0x17')]();});}};}function handleEntityNotFound(_0x46c356,_0x3c9d20){return function(_0x475520){if(!_0x475520){_0x46c356[_0x3008('0x23')](0x194);}return _0x475520;};}function handleError(_0x157084,_0x265a89){_0x265a89=_0x265a89||0x1f4;return function(_0x4618ef){logger[_0x3008('0x24')](_0x4618ef[_0x3008('0x25')]);if(_0x4618ef[_0x3008('0x26')]){delete _0x4618ef['name'];}_0x157084[_0x3008('0x16')](_0x265a89)[_0x3008('0x27')](_0x4618ef);};}exports[_0x3008('0x28')]=function(_0x29d963,_0x3cf2ca){var _0x234ada={},_0x3b4033={},_0xe35984={'count':0x0,'rows':[]};var _0x3edacd=_[_0x3008('0x29')](db[_0x3008('0x2a')][_0x3008('0x2b')],function(_0x582833){return{'name':_0x582833[_0x3008('0x2c')],'type':_0x582833['type'][_0x3008('0x2d')]};});_0x3b4033['model']=_[_0x3008('0x29')](_0x3edacd,_0x3008('0x26'));_0x3b4033[_0x3008('0x2e')]=_['keys'](_0x29d963[_0x3008('0x2e')]);_0x3b4033[_0x3008('0x2f')]=_[_0x3008('0x30')](_0x3b4033['model'],_0x3b4033[_0x3008('0x2e')]);_0x234ada[_0x3008('0x31')]=_['intersection'](_0x3b4033[_0x3008('0x32')],qs[_0x3008('0x33')](_0x29d963[_0x3008('0x2e')][_0x3008('0x33')]));_0x234ada[_0x3008('0x31')]=_0x234ada[_0x3008('0x31')][_0x3008('0x34')]?_0x234ada[_0x3008('0x31')]:_0x3b4033['model'];if(!_0x29d963[_0x3008('0x2e')][_0x3008('0x35')](_0x3008('0x36'))){_0x234ada[_0x3008('0x1a')]=qs[_0x3008('0x1a')](_0x29d963[_0x3008('0x2e')][_0x3008('0x1a')]);_0x234ada[_0x3008('0x18')]=qs[_0x3008('0x18')](_0x29d963['query']['offset']);}_0x234ada[_0x3008('0x37')]=qs[_0x3008('0x38')](_0x29d963[_0x3008('0x2e')]['sort']);_0x234ada['where']=qs[_0x3008('0x2f')](_[_0x3008('0x39')](_0x29d963[_0x3008('0x2e')],_0x3b4033['filters']),_0x3edacd);if(_0x29d963[_0x3008('0x2e')][_0x3008('0x3a')]){_0x234ada[_0x3008('0x3b')]=_['merge'](_0x234ada[_0x3008('0x3b')],{'$or':_['map'](_0x3edacd,function(_0x6ed64e){if(_0x6ed64e[_0x3008('0x3c')]!=='VIRTUAL'){var _0x3ccfda={};_0x3ccfda[_0x6ed64e[_0x3008('0x26')]]={'$like':'%'+_0x29d963[_0x3008('0x2e')]['filter']+'%'};return _0x3ccfda;}})});}_0x234ada=_[_0x3008('0x3d')]({},_0x234ada,_0x29d963['options']);var _0x10f8eb={'where':_0x234ada[_0x3008('0x3b')]};return db[_0x3008('0x2a')][_0x3008('0x1b')](_0x10f8eb)['then'](function(_0x5dc98c){_0xe35984[_0x3008('0x1b')]=_0x5dc98c;if(_0x29d963[_0x3008('0x2e')][_0x3008('0x3e')]){_0x234ada[_0x3008('0x3f')]=[{'all':!![]}];}return db[_0x3008('0x2a')]['findAll'](_0x234ada);})[_0x3008('0x22')](function(_0x237160){_0xe35984[_0x3008('0x40')]=_0x237160;return _0xe35984;})[_0x3008('0x22')](respondWithFilteredResult(_0x3cf2ca,_0x234ada))[_0x3008('0x41')](handleError(_0x3cf2ca,null));};exports['show']=function(_0x7b6ab4,_0x4dc109){var _0x234976={'raw':!![],'where':{'id':_0x7b6ab4[_0x3008('0x42')]['id']}},_0x53104d={};_0x53104d[_0x3008('0x32')]=_['keys'](db[_0x3008('0x2a')][_0x3008('0x2b')]);_0x53104d['query']=_[_0x3008('0x43')](_0x7b6ab4[_0x3008('0x2e')]);_0x53104d[_0x3008('0x2f')]=_[_0x3008('0x30')](_0x53104d['model'],_0x53104d[_0x3008('0x2e')]);_0x234976[_0x3008('0x31')]=_[_0x3008('0x30')](_0x53104d[_0x3008('0x32')],qs['fields'](_0x7b6ab4[_0x3008('0x2e')][_0x3008('0x33')]));_0x234976['attributes']=_0x234976['attributes']['length']?_0x234976[_0x3008('0x31')]:_0x53104d[_0x3008('0x32')];if(_0x7b6ab4[_0x3008('0x2e')][_0x3008('0x3e')]){_0x234976[_0x3008('0x3f')]=[{'all':!![]}];}_0x234976=_[_0x3008('0x3d')]({},_0x234976,_0x7b6ab4[_0x3008('0x44')]);return db[_0x3008('0x2a')][_0x3008('0x45')](_0x234976)[_0x3008('0x22')](handleEntityNotFound(_0x4dc109,null))[_0x3008('0x22')](respondWithResult(_0x4dc109,null))[_0x3008('0x41')](handleError(_0x4dc109,null));};exports['create']=function(_0xa0ea54,_0x3571a6){return db[_0x3008('0x2a')][_0x3008('0x46')](_0xa0ea54['body'],{})[_0x3008('0x22')](respondWithResult(_0x3571a6,0xc9))['catch'](handleError(_0x3571a6,null));};exports[_0x3008('0x47')]=function(_0x56ff9a,_0x593ea6){if(_0x56ff9a[_0x3008('0x48')]['id']){delete _0x56ff9a[_0x3008('0x48')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x56ff9a[_0x3008('0x42')]['id']}})[_0x3008('0x22')](handleEntityNotFound(_0x593ea6,null))[_0x3008('0x22')](saveUpdates(_0x56ff9a['body'],null))[_0x3008('0x22')](respondWithResult(_0x593ea6,null))[_0x3008('0x41')](handleError(_0x593ea6,null));};exports['destroy']=function(_0x56aee2,_0x53492d){return db[_0x3008('0x2a')][_0x3008('0x45')]({'where':{'id':_0x56aee2['params']['id']}})[_0x3008('0x22')](handleEntityNotFound(_0x53492d,null))[_0x3008('0x22')](removeEntity(_0x53492d,null))[_0x3008('0x41')](handleError(_0x53492d,null));}; \ No newline at end of file +var _0x7be0=['where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','params','length','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x38180f,_0x5a36d1){var _0x13710f=function(_0x114987){while(--_0x114987){_0x38180f['push'](_0x38180f['shift']());}};_0x13710f(++_0x5a36d1);}(_0x7be0,0x1c5));var _0x07be=function(_0x2b09ac,_0x220e23){_0x2b09ac=_0x2b09ac-0x0;var _0x7df27c=_0x7be0[_0x2b09ac];return _0x7df27c;};'use strict';var emlformat=require(_0x07be('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x07be('0x1'));var jsonpatch=require(_0x07be('0x2'));var rp=require(_0x07be('0x3'));var moment=require(_0x07be('0x4'));var BPromise=require(_0x07be('0x5'));var Mustache=require(_0x07be('0x6'));var util=require('util');var path=require(_0x07be('0x7'));var sox=require(_0x07be('0x8'));var csv=require(_0x07be('0x9'));var ejs=require(_0x07be('0xa'));var fs=require('fs');var fs_extra=require(_0x07be('0xb'));var _=require('lodash');var squel=require(_0x07be('0xc'));var crypto=require('crypto');var jsforce=require(_0x07be('0xd'));var deskjs=require(_0x07be('0xe'));var toCsv=require(_0x07be('0x9'));var querystring=require(_0x07be('0xf'));var Papa=require(_0x07be('0x10'));var Redis=require(_0x07be('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x07be('0x12'));var hardwareService=require(_0x07be('0x13'));var logger=require('../../config/logger')(_0x07be('0x14'));var utils=require(_0x07be('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30b287,_0xae11a8){_0xae11a8=_0xae11a8||0xcc;return function(_0x1ccc60){if(_0x1ccc60){return _0x30b287[_0x07be('0x16')](_0xae11a8);}return _0x30b287['status'](_0xae11a8)[_0x07be('0x17')]();};}function respondWithResult(_0x36f21f,_0x301461){_0x301461=_0x301461||0xc8;return function(_0x34aeeb){if(_0x34aeeb){return _0x36f21f[_0x07be('0x18')](_0x301461)['json'](_0x34aeeb);}};}function respondWithFilteredResult(_0x430771,_0x55d4c8){return function(_0x1c6b47){if(_0x1c6b47){var _0x4482d0=typeof _0x55d4c8[_0x07be('0x19')]===_0x07be('0x1a')&&typeof _0x55d4c8[_0x07be('0x1b')]==='undefined';var _0x4bf1ad=_0x1c6b47[_0x07be('0x1c')];var _0x2f022c=_0x4482d0?0x0:_0x55d4c8[_0x07be('0x19')];var _0x19d515=_0x4482d0?_0x1c6b47[_0x07be('0x1c')]:_0x55d4c8[_0x07be('0x19')]+_0x55d4c8[_0x07be('0x1b')];var _0x448a7f;if(_0x19d515>=_0x4bf1ad){_0x19d515=_0x4bf1ad;_0x448a7f=0xc8;}else{_0x448a7f=0xce;}_0x430771['status'](_0x448a7f);return _0x430771['set'](_0x07be('0x1d'),_0x2f022c+'-'+_0x19d515+'/'+_0x4bf1ad)[_0x07be('0x1e')](_0x1c6b47);}return null;};}function patchUpdates(_0x139baf){return function(_0x3d3aae){try{jsonpatch[_0x07be('0x1f')](_0x3d3aae,_0x139baf,!![]);}catch(_0x299449){return BPromise[_0x07be('0x20')](_0x299449);}return _0x3d3aae[_0x07be('0x21')]();};}function saveUpdates(_0x8dcc1f,_0x5ab403){return function(_0x20ad33){if(_0x20ad33){return _0x20ad33[_0x07be('0x22')](_0x8dcc1f)['then'](function(_0x32acd4){return _0x32acd4;});}return null;};}function removeEntity(_0xe2dc02,_0x594d3b){return function(_0x477ff1){if(_0x477ff1){return _0x477ff1[_0x07be('0x23')]()[_0x07be('0x24')](function(){_0xe2dc02[_0x07be('0x18')](0xcc)[_0x07be('0x17')]();});}};}function handleEntityNotFound(_0x1778f4,_0x140291){return function(_0x3546d8){if(!_0x3546d8){_0x1778f4['sendStatus'](0x194);}return _0x3546d8;};}function handleError(_0x4780ce,_0x1e264f){_0x1e264f=_0x1e264f||0x1f4;return function(_0x360523){logger['error'](_0x360523[_0x07be('0x25')]);if(_0x360523[_0x07be('0x26')]){delete _0x360523[_0x07be('0x26')];}_0x4780ce[_0x07be('0x18')](_0x1e264f)[_0x07be('0x27')](_0x360523);};}exports[_0x07be('0x28')]=function(_0x2794bb,_0xb195e1){var _0x51267a={},_0x5a1093={},_0x12678e={'count':0x0,'rows':[]};var _0x1e7506=_[_0x07be('0x29')](db[_0x07be('0x2a')][_0x07be('0x2b')],function(_0x25c2ca){return{'name':_0x25c2ca[_0x07be('0x2c')],'type':_0x25c2ca[_0x07be('0x2d')][_0x07be('0x2e')]};});_0x5a1093[_0x07be('0x2f')]=_[_0x07be('0x29')](_0x1e7506,_0x07be('0x26'));_0x5a1093[_0x07be('0x30')]=_[_0x07be('0x31')](_0x2794bb[_0x07be('0x30')]);_0x5a1093[_0x07be('0x32')]=_[_0x07be('0x33')](_0x5a1093[_0x07be('0x2f')],_0x5a1093['query']);_0x51267a[_0x07be('0x34')]=_['intersection'](_0x5a1093['model'],qs[_0x07be('0x35')](_0x2794bb[_0x07be('0x30')][_0x07be('0x35')]));_0x51267a[_0x07be('0x34')]=_0x51267a['attributes']['length']?_0x51267a[_0x07be('0x34')]:_0x5a1093[_0x07be('0x2f')];if(!_0x2794bb[_0x07be('0x30')][_0x07be('0x36')](_0x07be('0x37'))){_0x51267a[_0x07be('0x1b')]=qs[_0x07be('0x1b')](_0x2794bb[_0x07be('0x30')][_0x07be('0x1b')]);_0x51267a[_0x07be('0x19')]=qs[_0x07be('0x19')](_0x2794bb['query'][_0x07be('0x19')]);}_0x51267a[_0x07be('0x38')]=qs[_0x07be('0x39')](_0x2794bb[_0x07be('0x30')][_0x07be('0x39')]);_0x51267a[_0x07be('0x3a')]=qs['filters'](_[_0x07be('0x3b')](_0x2794bb[_0x07be('0x30')],_0x5a1093[_0x07be('0x32')]),_0x1e7506);if(_0x2794bb[_0x07be('0x30')][_0x07be('0x3c')]){_0x51267a[_0x07be('0x3a')]=_['merge'](_0x51267a[_0x07be('0x3a')],{'$or':_[_0x07be('0x29')](_0x1e7506,function(_0x2df9c9){if(_0x2df9c9['type']!==_0x07be('0x3d')){var _0x328346={};_0x328346[_0x2df9c9[_0x07be('0x26')]]={'$like':'%'+_0x2794bb[_0x07be('0x30')]['filter']+'%'};return _0x328346;}})});}_0x51267a=_[_0x07be('0x3e')]({},_0x51267a,_0x2794bb[_0x07be('0x3f')]);var _0x4fc254={'where':_0x51267a[_0x07be('0x3a')]};return db[_0x07be('0x2a')][_0x07be('0x1c')](_0x4fc254)[_0x07be('0x24')](function(_0x4f9514){_0x12678e[_0x07be('0x1c')]=_0x4f9514;if(_0x2794bb[_0x07be('0x30')][_0x07be('0x40')]){_0x51267a[_0x07be('0x41')]=[{'all':!![]}];}return db[_0x07be('0x2a')][_0x07be('0x42')](_0x51267a);})[_0x07be('0x24')](function(_0x98a5f2){_0x12678e['rows']=_0x98a5f2;return _0x12678e;})[_0x07be('0x24')](respondWithFilteredResult(_0xb195e1,_0x51267a))['catch'](handleError(_0xb195e1,null));};exports['show']=function(_0x1bbdab,_0x30e55c){var _0x10f7fa={'raw':!![],'where':{'id':_0x1bbdab[_0x07be('0x43')]['id']}},_0x567ffa={};_0x567ffa[_0x07be('0x2f')]=_[_0x07be('0x31')](db[_0x07be('0x2a')][_0x07be('0x2b')]);_0x567ffa[_0x07be('0x30')]=_['keys'](_0x1bbdab[_0x07be('0x30')]);_0x567ffa[_0x07be('0x32')]=_[_0x07be('0x33')](_0x567ffa['model'],_0x567ffa['query']);_0x10f7fa[_0x07be('0x34')]=_[_0x07be('0x33')](_0x567ffa['model'],qs[_0x07be('0x35')](_0x1bbdab[_0x07be('0x30')][_0x07be('0x35')]));_0x10f7fa[_0x07be('0x34')]=_0x10f7fa[_0x07be('0x34')][_0x07be('0x44')]?_0x10f7fa[_0x07be('0x34')]:_0x567ffa[_0x07be('0x2f')];if(_0x1bbdab[_0x07be('0x30')][_0x07be('0x40')]){_0x10f7fa[_0x07be('0x41')]=[{'all':!![]}];}_0x10f7fa=_['merge']({},_0x10f7fa,_0x1bbdab[_0x07be('0x3f')]);return db[_0x07be('0x2a')][_0x07be('0x45')](_0x10f7fa)['then'](handleEntityNotFound(_0x30e55c,null))[_0x07be('0x24')](respondWithResult(_0x30e55c,null))[_0x07be('0x46')](handleError(_0x30e55c,null));};exports['create']=function(_0x5135f8,_0x467787){return db[_0x07be('0x2a')][_0x07be('0x47')](_0x5135f8[_0x07be('0x48')],{})[_0x07be('0x24')](respondWithResult(_0x467787,0xc9))[_0x07be('0x46')](handleError(_0x467787,null));};exports['update']=function(_0x4e19ef,_0x33cbc7){if(_0x4e19ef[_0x07be('0x48')]['id']){delete _0x4e19ef[_0x07be('0x48')]['id'];}return db['AnalyticTreeReport'][_0x07be('0x45')]({'where':{'id':_0x4e19ef[_0x07be('0x43')]['id']}})[_0x07be('0x24')](handleEntityNotFound(_0x33cbc7,null))[_0x07be('0x24')](saveUpdates(_0x4e19ef[_0x07be('0x48')],null))[_0x07be('0x24')](respondWithResult(_0x33cbc7,null))['catch'](handleError(_0x33cbc7,null));};exports[_0x07be('0x23')]=function(_0xf107d,_0x229337){return db[_0x07be('0x2a')]['find']({'where':{'id':_0xf107d['params']['id']}})[_0x07be('0x24')](handleEntityNotFound(_0x229337,null))['then'](removeEntity(_0x229337,null))[_0x07be('0x46')](handleError(_0x229337,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index c4168e8..8ecc587 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 _0x378d=['rimraf','../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3b87f4,_0x112243){var _0x63d16e=function(_0x3e7323){while(--_0x3e7323){_0x3b87f4['push'](_0x3b87f4['shift']());}};_0x63d16e(++_0x112243);}(_0x378d,0x156));var _0xd378=function(_0xb468fc,_0x348a61){_0xb468fc=_0xb468fc-0x0;var _0x553cb6=_0x378d[_0xb468fc];return _0x553cb6;};'use strict';var _=require(_0xd378('0x0'));var util=require(_0xd378('0x1'));var logger=require(_0xd378('0x2'))(_0xd378('0x3'));var moment=require(_0xd378('0x4'));var BPromise=require('bluebird');var rp=require(_0xd378('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd378('0x6'));var config=require(_0xd378('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0xd378('0x8')]=function(_0x43a973,_0x4424d2){return _0x43a973[_0xd378('0x9')](_0xd378('0xa'),attributes,{'tableName':_0xd378('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x848a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','analytics_report_trees','lodash','util','../../config/logger'];(function(_0x5e9874,_0x4a3bc7){var _0x45308d=function(_0xb07a32){while(--_0xb07a32){_0x5e9874['push'](_0x5e9874['shift']());}};_0x45308d(++_0x4a3bc7);}(_0x848a,0xb1));var _0xa848=function(_0x46f3f8,_0x12c74b){_0x46f3f8=_0x46f3f8-0x0;var _0xbc57cd=_0x848a[_0x46f3f8];return _0xbc57cd;};'use strict';var _=require(_0xa848('0x0'));var util=require(_0xa848('0x1'));var logger=require(_0xa848('0x2'))('api');var moment=require(_0xa848('0x3'));var BPromise=require(_0xa848('0x4'));var rp=require(_0xa848('0x5'));var fs=require('fs');var path=require(_0xa848('0x6'));var rimraf=require(_0xa848('0x7'));var config=require(_0xa848('0x8'));var attributes=require(_0xa848('0x9'));module[_0xa848('0xa')]=function(_0x1d278c,_0x4899ef){return _0x1d278c['define']('AnalyticTreeReport',attributes,{'tableName':_0xa848('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 1684f00..b0871e5 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 _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x1aea9f,_0x480003){_0x1aea9f=_0x1aea9f-0x0;var _0x41c103=_0x7a54[_0x1aea9f];return _0x41c103;};'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')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x3c6402,_0x7d2a68){var _0x48ee69=function(_0x574dda){while(--_0x574dda){_0x3c6402['push'](_0x3c6402['shift']());}};_0x48ee69(++_0x7d2a68);}(_0x2ef3,0xba));var _0x32ef=function(_0x15c252,_0x50468c){_0x15c252=_0x15c252-0x0;var _0x1f403b=_0x2ef3[_0x15c252];return _0x1f403b;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 511bb7f..910334e 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 _0xde94=['exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x85fde1,_0x1e30f1){var _0xfad226=function(_0xf61b){while(--_0xf61b){_0x85fde1['push'](_0x85fde1['shift']());}};_0xfad226(++_0x1e30f1);}(_0xde94,0x145));var _0x4de9=function(_0x3ef216,_0x3b7cea){_0x3ef216=_0x3ef216-0x0;var _0x391529=_0xde94[_0x3ef216];return _0x391529;};'use strict';var multer=require(_0x4de9('0x0'));var util=require(_0x4de9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4de9('0x2'));var router=express[_0x4de9('0x3')]();var fs_extra=require(_0x4de9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4de9('0x5'));var config=require(_0x4de9('0x6'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4de9('0x7')]);router[_0x4de9('0x8')](_0x4de9('0x9'),auth[_0x4de9('0xa')](),controller[_0x4de9('0xb')]);router[_0x4de9('0xc')]('/',auth[_0x4de9('0xa')](),controller[_0x4de9('0xd')]);router[_0x4de9('0xe')](_0x4de9('0x9'),auth[_0x4de9('0xa')](),controller[_0x4de9('0xf')]);router[_0x4de9('0x10')](_0x4de9('0x9'),auth[_0x4de9('0xa')](),controller['destroy']);module[_0x4de9('0x11')]=router; \ No newline at end of file +var _0xe47a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x5904bb,_0x169929){var _0x29300d=function(_0x29e985){while(--_0x29e985){_0x5904bb['push'](_0x5904bb['shift']());}};_0x29300d(++_0x169929);}(_0xe47a,0xb8));var _0xae47=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe47a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xae47('0x0'));var util=require(_0xae47('0x1'));var path=require(_0xae47('0x2'));var timeout=require(_0xae47('0x3'));var express=require(_0xae47('0x4'));var router=express[_0xae47('0x5')]();var fs_extra=require(_0xae47('0x6'));var auth=require(_0xae47('0x7'));var interaction=require(_0xae47('0x8'));var config=require(_0xae47('0x9'));var controller=require('./analyticTreeReport.controller');router[_0xae47('0xa')]('/',auth[_0xae47('0xb')](),controller[_0xae47('0xc')]);router['get'](_0xae47('0xd'),auth[_0xae47('0xb')](),controller[_0xae47('0xe')]);router[_0xae47('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xae47('0x10')]('/:id',auth[_0xae47('0xb')](),controller[_0xae47('0x11')]);router['delete'](_0xae47('0xd'),auth[_0xae47('0xb')](),controller[_0xae47('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 28d93a7..0a4012e 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 _0xa739=['STRING','exports'];(function(_0xb84662,_0x13bcb1){var _0x566af2=function(_0x43443c){while(--_0x43443c){_0xb84662['push'](_0xb84662['shift']());}};_0x566af2(++_0x13bcb1);}(_0xa739,0x1e1));var _0x9a73=function(_0x32130f,_0xa1afe2){_0x32130f=_0x32130f-0x0;var _0x156c91=_0xa739[_0x32130f];return _0x156c91;};'use strict';var Sequelize=require('sequelize');module[_0x9a73('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x9a73('0x1')]},'type':{'type':Sequelize[_0x9a73('0x1')]}}; \ No newline at end of file +var _0x05b0=['STRING'];(function(_0x289e16,_0x358284){var _0x22e7da=function(_0x366418){while(--_0x366418){_0x289e16['push'](_0x289e16['shift']());}};_0x22e7da(++_0x358284);}(_0x05b0,0x188));var _0x005b=function(_0x4df878,_0x533ca5){_0x4df878=_0x4df878-0x0;var _0x35bc07=_0x05b0[_0x4df878];return _0x35bc07;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x005b('0x0')]},'basename':{'type':Sequelize[_0x005b('0x0')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 7f97633..455e903 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 _0x5203=['map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','Attachment','includeAll','findAll','rows','catch','params','rawAttributes','include','find','get','omit','createdAt','body','updatedAt','create','update','destroy','file','originalname','basename','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','offline-chat/','join','eml-format','zip-dir','fast-json-patch','request-promise','moment','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','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','then','error','stack','name','send','index'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x5203,0x8c));var _0x3520=function(_0x15a2df,_0x33f406){_0x15a2df=_0x15a2df-0x0;var _0x2dad75=_0x5203[_0x15a2df];return _0x2dad75;};'use strict';var emlformat=require(_0x3520('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3520('0x1'));var jsonpatch=require(_0x3520('0x2'));var rp=require(_0x3520('0x3'));var moment=require(_0x3520('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3520('0x5'));var path=require(_0x3520('0x6'));var sox=require(_0x3520('0x7'));var csv=require(_0x3520('0x8'));var ejs=require(_0x3520('0x9'));var fs=require('fs');var fs_extra=require(_0x3520('0xa'));var _=require('lodash');var squel=require(_0x3520('0xb'));var crypto=require(_0x3520('0xc'));var jsforce=require(_0x3520('0xd'));var deskjs=require(_0x3520('0xe'));var toCsv=require(_0x3520('0x8'));var querystring=require(_0x3520('0xf'));var Papa=require(_0x3520('0x10'));var Redis=require(_0x3520('0x11'));var authService=require(_0x3520('0x12'));var qs=require(_0x3520('0x13'));var as=require(_0x3520('0x14'));var hardwareService=require(_0x3520('0x15'));var logger=require(_0x3520('0x16'))(_0x3520('0x17'));var utils=require(_0x3520('0x18'));var config=require(_0x3520('0x19'));var licenseUtil=require(_0x3520('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26d83d,_0x1a845f){_0x1a845f=_0x1a845f||0xcc;return function(_0x1312b5){if(_0x1312b5){return _0x26d83d[_0x3520('0x1b')](_0x1a845f);}return _0x26d83d[_0x3520('0x1c')](_0x1a845f)[_0x3520('0x1d')]();};}function respondWithResult(_0x5cc65c,_0x33dc2a){_0x33dc2a=_0x33dc2a||0xc8;return function(_0x4d1a34){if(_0x4d1a34){return _0x5cc65c[_0x3520('0x1c')](_0x33dc2a)[_0x3520('0x1e')](_0x4d1a34);}};}function respondWithFilteredResult(_0x44019c,_0x40e216){return function(_0x57d982){if(_0x57d982){var _0x59f930=typeof _0x40e216['offset']===_0x3520('0x1f')&&typeof _0x40e216[_0x3520('0x20')]===_0x3520('0x1f');var _0x4d0e9e=_0x57d982[_0x3520('0x21')];var _0x458ba8=_0x59f930?0x0:_0x40e216[_0x3520('0x22')];var _0xda9fa9=_0x59f930?_0x57d982[_0x3520('0x21')]:_0x40e216[_0x3520('0x22')]+_0x40e216[_0x3520('0x20')];var _0x285909;if(_0xda9fa9>=_0x4d0e9e){_0xda9fa9=_0x4d0e9e;_0x285909=0xc8;}else{_0x285909=0xce;}_0x44019c[_0x3520('0x1c')](_0x285909);return _0x44019c[_0x3520('0x23')](_0x3520('0x24'),_0x458ba8+'-'+_0xda9fa9+'/'+_0x4d0e9e)[_0x3520('0x1e')](_0x57d982);}return null;};}function patchUpdates(_0x110a8c){return function(_0x5bf046){try{jsonpatch[_0x3520('0x25')](_0x5bf046,_0x110a8c,!![]);}catch(_0x6ed021){return BPromise['reject'](_0x6ed021);}return _0x5bf046['save']();};}function saveUpdates(_0x37dcc6,_0x2d18a4){return function(_0x15218f){if(_0x15218f){return _0x15218f['update'](_0x37dcc6)[_0x3520('0x26')](function(_0x5d4fe2){return _0x5d4fe2;});}return null;};}function removeEntity(_0x21d9f1,_0x2f941b){return function(_0x3a14f1){if(_0x3a14f1){return _0x3a14f1['destroy']()[_0x3520('0x26')](function(){_0x21d9f1[_0x3520('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1281a6,_0x46f64c){return function(_0x448343){if(!_0x448343){_0x1281a6[_0x3520('0x1b')](0x194);}return _0x448343;};}function handleError(_0x57df5e,_0x4187ea){_0x4187ea=_0x4187ea||0x1f4;return function(_0x46e6f3){logger[_0x3520('0x27')](_0x46e6f3[_0x3520('0x28')]);if(_0x46e6f3['name']){delete _0x46e6f3[_0x3520('0x29')];}_0x57df5e['status'](_0x4187ea)[_0x3520('0x2a')](_0x46e6f3);};}exports[_0x3520('0x2b')]=function(_0x12e43e,_0x1de46d){var _0x161945={},_0x1bca2d={},_0x63a26={'count':0x0,'rows':[]};var _0x2897d0=_[_0x3520('0x2c')](db['Attachment']['rawAttributes'],function(_0x5c3fae){return{'name':_0x5c3fae[_0x3520('0x2d')],'type':_0x5c3fae[_0x3520('0x2e')][_0x3520('0x2f')]};});_0x1bca2d[_0x3520('0x30')]=_[_0x3520('0x2c')](_0x2897d0,'name');_0x1bca2d[_0x3520('0x31')]=_[_0x3520('0x32')](_0x12e43e[_0x3520('0x31')]);_0x1bca2d[_0x3520('0x33')]=_[_0x3520('0x34')](_0x1bca2d[_0x3520('0x30')],_0x1bca2d['query']);_0x161945[_0x3520('0x35')]=_[_0x3520('0x34')](_0x1bca2d['model'],qs[_0x3520('0x36')](_0x12e43e['query'][_0x3520('0x36')]));_0x161945[_0x3520('0x35')]=_0x161945['attributes'][_0x3520('0x37')]?_0x161945[_0x3520('0x35')]:_0x1bca2d[_0x3520('0x30')];if(!_0x12e43e[_0x3520('0x31')][_0x3520('0x38')]('nolimit')){_0x161945[_0x3520('0x20')]=qs[_0x3520('0x20')](_0x12e43e[_0x3520('0x31')]['limit']);_0x161945[_0x3520('0x22')]=qs[_0x3520('0x22')](_0x12e43e['query'][_0x3520('0x22')]);}_0x161945[_0x3520('0x39')]=qs[_0x3520('0x3a')](_0x12e43e[_0x3520('0x31')][_0x3520('0x3a')]);_0x161945[_0x3520('0x3b')]=qs[_0x3520('0x33')](_[_0x3520('0x3c')](_0x12e43e[_0x3520('0x31')],_0x1bca2d[_0x3520('0x33')]),_0x2897d0);if(_0x12e43e[_0x3520('0x31')][_0x3520('0x3d')]){_0x161945[_0x3520('0x3b')]=_['merge'](_0x161945[_0x3520('0x3b')],{'$or':_[_0x3520('0x2c')](_0x2897d0,function(_0x19e892){if(_0x19e892[_0x3520('0x2e')]!==_0x3520('0x3e')){var _0x31a0c0={};_0x31a0c0[_0x19e892[_0x3520('0x29')]]={'$like':'%'+_0x12e43e[_0x3520('0x31')]['filter']+'%'};return _0x31a0c0;}})});}_0x161945=_[_0x3520('0x3f')]({},_0x161945,_0x12e43e[_0x3520('0x40')]);var _0xc3dfc9={'where':_0x161945[_0x3520('0x3b')]};return db[_0x3520('0x41')][_0x3520('0x21')](_0xc3dfc9)[_0x3520('0x26')](function(_0x3f76d7){_0x63a26[_0x3520('0x21')]=_0x3f76d7;if(_0x12e43e[_0x3520('0x31')][_0x3520('0x42')]){_0x161945['include']=[{'all':!![]}];}return db['Attachment'][_0x3520('0x43')](_0x161945);})['then'](function(_0x2dd26a){_0x63a26[_0x3520('0x44')]=_0x2dd26a;return _0x63a26;})[_0x3520('0x26')](respondWithFilteredResult(_0x1de46d,_0x161945))[_0x3520('0x45')](handleError(_0x1de46d,null));};exports['show']=function(_0xa8313d,_0x5c14fd){var _0x1ccf71={'raw':!![],'where':{'id':_0xa8313d[_0x3520('0x46')]['id']}},_0x5d531c={};_0x5d531c['model']=_[_0x3520('0x32')](db[_0x3520('0x41')][_0x3520('0x47')]);_0x5d531c[_0x3520('0x31')]=_['keys'](_0xa8313d[_0x3520('0x31')]);_0x5d531c[_0x3520('0x33')]=_[_0x3520('0x34')](_0x5d531c['model'],_0x5d531c[_0x3520('0x31')]);_0x1ccf71[_0x3520('0x35')]=_[_0x3520('0x34')](_0x5d531c[_0x3520('0x30')],qs[_0x3520('0x36')](_0xa8313d['query'][_0x3520('0x36')]));_0x1ccf71['attributes']=_0x1ccf71[_0x3520('0x35')]['length']?_0x1ccf71[_0x3520('0x35')]:_0x5d531c[_0x3520('0x30')];if(_0xa8313d[_0x3520('0x31')][_0x3520('0x42')]){_0x1ccf71[_0x3520('0x48')]=[{'all':!![]}];}_0x1ccf71=_[_0x3520('0x3f')]({},_0x1ccf71,_0xa8313d[_0x3520('0x40')]);return db['Attachment']['find'](_0x1ccf71)[_0x3520('0x26')](handleEntityNotFound(_0x5c14fd,null))['then'](respondWithResult(_0x5c14fd,null))[_0x3520('0x45')](handleError(_0x5c14fd,null));};exports['clone']=function(_0x54e7cd,_0x105005){var _0x2a2c20={'where':{'id':_0x54e7cd[_0x3520('0x46')]['id']}},_0x35a55e={};_0x35a55e[_0x3520('0x30')]=_[_0x3520('0x32')](db[_0x3520('0x41')][_0x3520('0x47')]);_0x2a2c20[_0x3520('0x35')]=_['intersection'](_0x35a55e[_0x3520('0x30')],qs['fields'](_0x54e7cd['query'][_0x3520('0x36')]));_0x2a2c20[_0x3520('0x35')]=_0x2a2c20[_0x3520('0x35')]['length']?_0x2a2c20[_0x3520('0x35')]:_0x35a55e[_0x3520('0x30')];if(_0x54e7cd[_0x3520('0x31')][_0x3520('0x42')]){_0x2a2c20['include']=[{'all':!![]}];}_0x2a2c20=_[_0x3520('0x3f')]({},_0x2a2c20,_0x54e7cd[_0x3520('0x40')]);return db[_0x3520('0x41')][_0x3520('0x49')](_0x2a2c20)['then'](handleEntityNotFound(_0x105005,null))[_0x3520('0x26')](function(_0x4f5d66){if(_0x4f5d66){var _0x19b1ec=_0x4f5d66[_0x3520('0x4a')]({'plain':!![]});_0x19b1ec=qs[_0x3520('0x4b')](_0x19b1ec,['id',_0x3520('0x4c'),'updatedAt']);_0x54e7cd[_0x3520('0x4d')]=_[_0x3520('0x4b')](_0x54e7cd['body'],['id',_0x3520('0x4c'),_0x3520('0x4e')]);return db['Attachment'][_0x3520('0x4f')](_[_0x3520('0x3f')](_0x19b1ec,_0x54e7cd['body']),{'include':_0x54e7cd[_0x3520('0x31')][_0x3520('0x42')]?[{'all':!![]}]:undefined});}})[_0x3520('0x26')](respondWithResult(_0x105005,0xc9))[_0x3520('0x45')](handleError(_0x105005,null));};exports[_0x3520('0x50')]=function(_0x1563ee,_0x3f51aa){if(_0x1563ee[_0x3520('0x4d')]['id']){delete _0x1563ee[_0x3520('0x4d')]['id'];}return db['Attachment'][_0x3520('0x49')]({'where':{'id':_0x1563ee[_0x3520('0x46')]['id']}})[_0x3520('0x26')](handleEntityNotFound(_0x3f51aa,null))[_0x3520('0x26')](saveUpdates(_0x1563ee[_0x3520('0x4d')],null))[_0x3520('0x26')](respondWithResult(_0x3f51aa,null))[_0x3520('0x45')](handleError(_0x3f51aa,null));};exports[_0x3520('0x51')]=function(_0x1f8d05,_0x2933c4){return db[_0x3520('0x41')][_0x3520('0x49')]({'where':{'id':_0x1f8d05['params']['id']}})[_0x3520('0x26')](handleEntityNotFound(_0x2933c4,null))[_0x3520('0x26')](removeEntity(_0x2933c4,null))[_0x3520('0x45')](handleError(_0x2933c4,null));};exports[_0x3520('0x4f')]=function(_0x11a8a7,_0x274e6a,_0x4b68e9){_0x11a8a7[_0x3520('0x4d')][_0x3520('0x29')]=_0x11a8a7[_0x3520('0x52')][_0x3520('0x53')];_0x11a8a7['body'][_0x3520('0x54')]=_0x11a8a7[_0x3520('0x52')]['filename'];_0x11a8a7[_0x3520('0x4d')][_0x3520('0x2e')]=_0x11a8a7['file']['mimetype'];return db[_0x3520('0x41')][_0x3520('0x4f')](_0x11a8a7['body'])[_0x3520('0x26')](respondWithResult(_0x274e6a,0xc9))['catch'](handleError(_0x274e6a,null));};exports[_0x3520('0x55')]=function(_0x4219b1,_0x55049d,_0x5d27f5){return db[_0x3520('0x41')][_0x3520('0x56')]({'where':{'id':_0x4219b1['params']['id']},'raw':!![]})[_0x3520('0x26')](handleEntityNotFound(_0x55049d,null))[_0x3520('0x26')](function(_0x1c75f7){if(_0x1c75f7){var _0x468d2e=_0x1c75f7[_0x3520('0x57')]!==null;var _0x1d9c63=path['join'](config[_0x3520('0x58')],_0x3520('0x59'));if(_0x468d2e){_0x1d9c63=path['join'](_0x1d9c63,_0x3520('0x5a'));}var _0x1809a2=path[_0x3520('0x5b')](_0x1d9c63,_0x1c75f7[_0x3520('0x54')]);return _0x55049d['download'](_0x1809a2);}})[_0x3520('0x45')](handleError(_0x55049d,null));}; \ No newline at end of file +var _0x38ed=['limit','count','status','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','Attachment','type','key','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','clone','omit','createdAt','updatedAt','update','body','find','create','file','originalname','basename','filename','mimetype','findOne','join','root','server/files/attachments/','offline-chat/','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined'];(function(_0x141845,_0x35e11d){var _0xc75782=function(_0xac611f){while(--_0xac611f){_0x141845['push'](_0x141845['shift']());}};_0xc75782(++_0x35e11d);}(_0x38ed,0x1ef));var _0xd38e=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x38ed[_0x18ab2a];return _0x16dcee;};'use strict';var emlformat=require(_0xd38e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd38e('0x1'));var jsonpatch=require(_0xd38e('0x2'));var rp=require(_0xd38e('0x3'));var moment=require(_0xd38e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd38e('0x5'));var sox=require(_0xd38e('0x6'));var csv=require(_0xd38e('0x7'));var ejs=require(_0xd38e('0x8'));var fs=require('fs');var fs_extra=require(_0xd38e('0x9'));var _=require('lodash');var squel=require(_0xd38e('0xa'));var crypto=require(_0xd38e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd38e('0x7'));var querystring=require(_0xd38e('0xc'));var Papa=require(_0xd38e('0xd'));var Redis=require(_0xd38e('0xe'));var authService=require(_0xd38e('0xf'));var qs=require(_0xd38e('0x10'));var as=require(_0xd38e('0x11'));var hardwareService=require(_0xd38e('0x12'));var logger=require('../../config/logger')(_0xd38e('0x13'));var utils=require('../../config/utils');var config=require(_0xd38e('0x14'));var licenseUtil=require(_0xd38e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x597b7b,_0x14788e){_0x14788e=_0x14788e||0xcc;return function(_0x4c31a8){if(_0x4c31a8){return _0x597b7b[_0xd38e('0x16')](_0x14788e);}return _0x597b7b['status'](_0x14788e)[_0xd38e('0x17')]();};}function respondWithResult(_0x5412da,_0x45b2ba){_0x45b2ba=_0x45b2ba||0xc8;return function(_0x2b2b4e){if(_0x2b2b4e){return _0x5412da['status'](_0x45b2ba)[_0xd38e('0x18')](_0x2b2b4e);}};}function respondWithFilteredResult(_0x1ce448,_0x3384fb){return function(_0x2fbd27){if(_0x2fbd27){var _0x6a93e9=typeof _0x3384fb[_0xd38e('0x19')]===_0xd38e('0x1a')&&typeof _0x3384fb[_0xd38e('0x1b')]===_0xd38e('0x1a');var _0x213a6f=_0x2fbd27[_0xd38e('0x1c')];var _0x5cd053=_0x6a93e9?0x0:_0x3384fb[_0xd38e('0x19')];var _0x2ca123=_0x6a93e9?_0x2fbd27[_0xd38e('0x1c')]:_0x3384fb[_0xd38e('0x19')]+_0x3384fb[_0xd38e('0x1b')];var _0x598a24;if(_0x2ca123>=_0x213a6f){_0x2ca123=_0x213a6f;_0x598a24=0xc8;}else{_0x598a24=0xce;}_0x1ce448[_0xd38e('0x1d')](_0x598a24);return _0x1ce448[_0xd38e('0x1e')](_0xd38e('0x1f'),_0x5cd053+'-'+_0x2ca123+'/'+_0x213a6f)[_0xd38e('0x18')](_0x2fbd27);}return null;};}function patchUpdates(_0x273d29){return function(_0x1e7c43){try{jsonpatch['apply'](_0x1e7c43,_0x273d29,!![]);}catch(_0x55b5a3){return BPromise[_0xd38e('0x20')](_0x55b5a3);}return _0x1e7c43[_0xd38e('0x21')]();};}function saveUpdates(_0x585fab,_0x50ac27){return function(_0x138ea4){if(_0x138ea4){return _0x138ea4['update'](_0x585fab)[_0xd38e('0x22')](function(_0x2498bd){return _0x2498bd;});}return null;};}function removeEntity(_0x2c956a,_0x4e5ee4){return function(_0x156939){if(_0x156939){return _0x156939[_0xd38e('0x23')]()[_0xd38e('0x22')](function(){_0x2c956a['status'](0xcc)[_0xd38e('0x17')]();});}};}function handleEntityNotFound(_0x2be45a,_0x4b750e){return function(_0x479c94){if(!_0x479c94){_0x2be45a[_0xd38e('0x16')](0x194);}return _0x479c94;};}function handleError(_0x3b68ec,_0x572c43){_0x572c43=_0x572c43||0x1f4;return function(_0x3db537){logger[_0xd38e('0x24')](_0x3db537[_0xd38e('0x25')]);if(_0x3db537[_0xd38e('0x26')]){delete _0x3db537[_0xd38e('0x26')];}_0x3b68ec[_0xd38e('0x1d')](_0x572c43)[_0xd38e('0x27')](_0x3db537);};}exports[_0xd38e('0x28')]=function(_0x3438a7,_0x36b2ea){var _0x4d30f0={},_0x439975={},_0x1f2817={'count':0x0,'rows':[]};var _0x1c0208=_[_0xd38e('0x29')](db[_0xd38e('0x2a')]['rawAttributes'],function(_0x269e26){return{'name':_0x269e26['fieldName'],'type':_0x269e26[_0xd38e('0x2b')][_0xd38e('0x2c')]};});_0x439975['model']=_[_0xd38e('0x29')](_0x1c0208,_0xd38e('0x26'));_0x439975[_0xd38e('0x2d')]=_[_0xd38e('0x2e')](_0x3438a7[_0xd38e('0x2d')]);_0x439975[_0xd38e('0x2f')]=_[_0xd38e('0x30')](_0x439975[_0xd38e('0x31')],_0x439975[_0xd38e('0x2d')]);_0x4d30f0['attributes']=_[_0xd38e('0x30')](_0x439975[_0xd38e('0x31')],qs[_0xd38e('0x32')](_0x3438a7[_0xd38e('0x2d')][_0xd38e('0x32')]));_0x4d30f0['attributes']=_0x4d30f0['attributes'][_0xd38e('0x33')]?_0x4d30f0[_0xd38e('0x34')]:_0x439975[_0xd38e('0x31')];if(!_0x3438a7['query'][_0xd38e('0x35')]('nolimit')){_0x4d30f0[_0xd38e('0x1b')]=qs[_0xd38e('0x1b')](_0x3438a7[_0xd38e('0x2d')]['limit']);_0x4d30f0[_0xd38e('0x19')]=qs['offset'](_0x3438a7[_0xd38e('0x2d')]['offset']);}_0x4d30f0[_0xd38e('0x36')]=qs['sort'](_0x3438a7['query'][_0xd38e('0x37')]);_0x4d30f0[_0xd38e('0x38')]=qs['filters'](_[_0xd38e('0x39')](_0x3438a7['query'],_0x439975[_0xd38e('0x2f')]),_0x1c0208);if(_0x3438a7['query']['filter']){_0x4d30f0['where']=_[_0xd38e('0x3a')](_0x4d30f0[_0xd38e('0x38')],{'$or':_[_0xd38e('0x29')](_0x1c0208,function(_0x22056d){if(_0x22056d[_0xd38e('0x2b')]!==_0xd38e('0x3b')){var _0x3b112c={};_0x3b112c[_0x22056d[_0xd38e('0x26')]]={'$like':'%'+_0x3438a7[_0xd38e('0x2d')][_0xd38e('0x3c')]+'%'};return _0x3b112c;}})});}_0x4d30f0=_['merge']({},_0x4d30f0,_0x3438a7[_0xd38e('0x3d')]);var _0xdc6cc4={'where':_0x4d30f0[_0xd38e('0x38')]};return db[_0xd38e('0x2a')][_0xd38e('0x1c')](_0xdc6cc4)[_0xd38e('0x22')](function(_0x4fc485){_0x1f2817['count']=_0x4fc485;if(_0x3438a7['query'][_0xd38e('0x3e')]){_0x4d30f0[_0xd38e('0x3f')]=[{'all':!![]}];}return db[_0xd38e('0x2a')]['findAll'](_0x4d30f0);})[_0xd38e('0x22')](function(_0x1268c9){_0x1f2817[_0xd38e('0x40')]=_0x1268c9;return _0x1f2817;})['then'](respondWithFilteredResult(_0x36b2ea,_0x4d30f0))[_0xd38e('0x41')](handleError(_0x36b2ea,null));};exports[_0xd38e('0x42')]=function(_0x19f5ca,_0xc23679){var _0x5a2ed2={'raw':!![],'where':{'id':_0x19f5ca[_0xd38e('0x43')]['id']}},_0x3efc77={};_0x3efc77[_0xd38e('0x31')]=_['keys'](db[_0xd38e('0x2a')]['rawAttributes']);_0x3efc77['query']=_[_0xd38e('0x2e')](_0x19f5ca[_0xd38e('0x2d')]);_0x3efc77[_0xd38e('0x2f')]=_[_0xd38e('0x30')](_0x3efc77['model'],_0x3efc77[_0xd38e('0x2d')]);_0x5a2ed2[_0xd38e('0x34')]=_['intersection'](_0x3efc77[_0xd38e('0x31')],qs[_0xd38e('0x32')](_0x19f5ca['query'][_0xd38e('0x32')]));_0x5a2ed2[_0xd38e('0x34')]=_0x5a2ed2['attributes']['length']?_0x5a2ed2[_0xd38e('0x34')]:_0x3efc77['model'];if(_0x19f5ca[_0xd38e('0x2d')]['includeAll']){_0x5a2ed2['include']=[{'all':!![]}];}_0x5a2ed2=_[_0xd38e('0x3a')]({},_0x5a2ed2,_0x19f5ca['options']);return db[_0xd38e('0x2a')]['find'](_0x5a2ed2)[_0xd38e('0x22')](handleEntityNotFound(_0xc23679,null))[_0xd38e('0x22')](respondWithResult(_0xc23679,null))['catch'](handleError(_0xc23679,null));};exports[_0xd38e('0x44')]=function(_0x177711,_0x58086e){var _0x467b86={'where':{'id':_0x177711[_0xd38e('0x43')]['id']}},_0x195076={};_0x195076[_0xd38e('0x31')]=_['keys'](db[_0xd38e('0x2a')]['rawAttributes']);_0x467b86[_0xd38e('0x34')]=_[_0xd38e('0x30')](_0x195076[_0xd38e('0x31')],qs['fields'](_0x177711[_0xd38e('0x2d')]['fields']));_0x467b86[_0xd38e('0x34')]=_0x467b86[_0xd38e('0x34')][_0xd38e('0x33')]?_0x467b86[_0xd38e('0x34')]:_0x195076[_0xd38e('0x31')];if(_0x177711[_0xd38e('0x2d')][_0xd38e('0x3e')]){_0x467b86['include']=[{'all':!![]}];}_0x467b86=_[_0xd38e('0x3a')]({},_0x467b86,_0x177711[_0xd38e('0x3d')]);return db[_0xd38e('0x2a')]['find'](_0x467b86)['then'](handleEntityNotFound(_0x58086e,null))[_0xd38e('0x22')](function(_0x465fae){if(_0x465fae){var _0x9e52a7=_0x465fae['get']({'plain':!![]});_0x9e52a7=qs[_0xd38e('0x45')](_0x9e52a7,['id',_0xd38e('0x46'),'updatedAt']);_0x177711['body']=_[_0xd38e('0x45')](_0x177711['body'],['id','createdAt',_0xd38e('0x47')]);return db[_0xd38e('0x2a')]['create'](_[_0xd38e('0x3a')](_0x9e52a7,_0x177711['body']),{'include':_0x177711[_0xd38e('0x2d')][_0xd38e('0x3e')]?[{'all':!![]}]:undefined});}})[_0xd38e('0x22')](respondWithResult(_0x58086e,0xc9))[_0xd38e('0x41')](handleError(_0x58086e,null));};exports[_0xd38e('0x48')]=function(_0x18cbcc,_0x408a4d){if(_0x18cbcc[_0xd38e('0x49')]['id']){delete _0x18cbcc['body']['id'];}return db[_0xd38e('0x2a')][_0xd38e('0x4a')]({'where':{'id':_0x18cbcc[_0xd38e('0x43')]['id']}})['then'](handleEntityNotFound(_0x408a4d,null))[_0xd38e('0x22')](saveUpdates(_0x18cbcc['body'],null))['then'](respondWithResult(_0x408a4d,null))[_0xd38e('0x41')](handleError(_0x408a4d,null));};exports['destroy']=function(_0xe7ec2f,_0x2e077e){return db[_0xd38e('0x2a')][_0xd38e('0x4a')]({'where':{'id':_0xe7ec2f[_0xd38e('0x43')]['id']}})[_0xd38e('0x22')](handleEntityNotFound(_0x2e077e,null))['then'](removeEntity(_0x2e077e,null))[_0xd38e('0x41')](handleError(_0x2e077e,null));};exports[_0xd38e('0x4b')]=function(_0x2bdbc0,_0x3900d6,_0x61ee42){_0x2bdbc0[_0xd38e('0x49')][_0xd38e('0x26')]=_0x2bdbc0[_0xd38e('0x4c')][_0xd38e('0x4d')];_0x2bdbc0[_0xd38e('0x49')][_0xd38e('0x4e')]=_0x2bdbc0[_0xd38e('0x4c')][_0xd38e('0x4f')];_0x2bdbc0['body'][_0xd38e('0x2b')]=_0x2bdbc0[_0xd38e('0x4c')][_0xd38e('0x50')];return db[_0xd38e('0x2a')][_0xd38e('0x4b')](_0x2bdbc0['body'])[_0xd38e('0x22')](respondWithResult(_0x3900d6,0xc9))[_0xd38e('0x41')](handleError(_0x3900d6,null));};exports['download']=function(_0x3cdb42,_0x2d28d9,_0x41a6f1){return db[_0xd38e('0x2a')][_0xd38e('0x51')]({'where':{'id':_0x3cdb42[_0xd38e('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2d28d9,null))[_0xd38e('0x22')](function(_0x1f3785){if(_0x1f3785){var _0x2e2379=_0x1f3785['ChatOfflineMessageId']!==null;var _0x3a1393=path[_0xd38e('0x52')](config[_0xd38e('0x53')],_0xd38e('0x54'));if(_0x2e2379){_0x3a1393=path['join'](_0x3a1393,_0xd38e('0x55'));}var _0x3c000c=path['join'](_0x3a1393,_0x1f3785[_0xd38e('0x4e')]);return _0x2d28d9[_0xd38e('0x56')](_0x3c000c);}})[_0xd38e('0x41')](handleError(_0x2d28d9,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 0d891a0..59de0b8 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 _0xd194=['attachments','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./attachment.attributes','exports','define','Attachment'];(function(_0x385127,_0x555f9f){var _0x3677a6=function(_0x1565ad){while(--_0x1565ad){_0x385127['push'](_0x385127['shift']());}};_0x3677a6(++_0x555f9f);}(_0xd194,0xaa));var _0x4d19=function(_0x3b2ede,_0x5d0b01){_0x3b2ede=_0x3b2ede-0x0;var _0x285151=_0xd194[_0x3b2ede];return _0x285151;};'use strict';var _=require(_0x4d19('0x0'));var util=require(_0x4d19('0x1'));var logger=require(_0x4d19('0x2'))('api');var moment=require(_0x4d19('0x3'));var BPromise=require(_0x4d19('0x4'));var rp=require(_0x4d19('0x5'));var fs=require('fs');var path=require(_0x4d19('0x6'));var rimraf=require(_0x4d19('0x7'));var config=require('../../config/environment');var attributes=require(_0x4d19('0x8'));module[_0x4d19('0x9')]=function(_0x1a27f1,_0x208fa4){return _0x1a27f1[_0x4d19('0xa')](_0x4d19('0xb'),attributes,{'tableName':_0x4d19('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8092=['request-promise','path','rimraf','../../config/environment','./attachment.attributes','attachments','lodash','util','api','moment','bluebird'];(function(_0x5e87ec,_0x20ed69){var _0x3c3207=function(_0x5eba01){while(--_0x5eba01){_0x5e87ec['push'](_0x5e87ec['shift']());}};_0x3c3207(++_0x20ed69);}(_0x8092,0x12f));var _0x2809=function(_0x18e20a,_0x3c9c8a){_0x18e20a=_0x18e20a-0x0;var _0x4fcbfe=_0x8092[_0x18e20a];return _0x4fcbfe;};'use strict';var _=require(_0x2809('0x0'));var util=require(_0x2809('0x1'));var logger=require('../../config/logger')(_0x2809('0x2'));var moment=require(_0x2809('0x3'));var BPromise=require(_0x2809('0x4'));var rp=require(_0x2809('0x5'));var fs=require('fs');var path=require(_0x2809('0x6'));var rimraf=require(_0x2809('0x7'));var config=require(_0x2809('0x8'));var attributes=require(_0x2809('0x9'));module['exports']=function(_0x461221,_0x4c2ad3){return _0x461221['define']('Attachment',attributes,{'tableName':_0x2809('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 01d34b7..60171bd 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 _0xcc73=['body','raw','stringify','util','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateAttachment','Attachment','create'];(function(_0x3f06e8,_0x36e163){var _0xd2505d=function(_0x566f9f){while(--_0x566f9f){_0x3f06e8['push'](_0x3f06e8['shift']());}};_0xd2505d(++_0x36e163);}(_0xcc73,0x1cb));var _0x3cc7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xcc73[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x3cc7('0x0'));var moment=require(_0x3cc7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3cc7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3cc7('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x3cc7('0x4'));var jayson=require(_0x3cc7('0x5'));var client=jayson[_0x3cc7('0x6')][_0x3cc7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x127590,_0x5604df,_0x416c48){return new BPromise(function(_0x37c184,_0x3f2dd7){return client[_0x3cc7('0x8')](_0x127590,_0x416c48)['then'](function(_0x2ff7ba){logger[_0x3cc7('0x9')](_0x3cc7('0xa'),_0x5604df,_0x3cc7('0xb'));logger[_0x3cc7('0xc')](_0x3cc7('0xd'),_0x5604df,_0x3cc7('0xb'),JSON['stringify'](_0x2ff7ba));if(_0x2ff7ba['error']){if(_0x2ff7ba[_0x3cc7('0xe')]['code']===0x1f4){logger[_0x3cc7('0xe')](_0x3cc7('0xa'),_0x5604df,_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);return _0x3f2dd7(_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);}logger[_0x3cc7('0xe')](_0x3cc7('0xa'),_0x5604df,_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);return _0x37c184(_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);}else{logger[_0x3cc7('0x9')](_0x3cc7('0xa'),_0x5604df,_0x3cc7('0xb'));_0x37c184(_0x2ff7ba[_0x3cc7('0x10')][_0x3cc7('0xf')]);}})[_0x3cc7('0x11')](function(_0x386a31){logger[_0x3cc7('0xe')](_0x3cc7('0xa'),_0x5604df,_0x386a31);_0x3f2dd7(_0x386a31);});});}exports[_0x3cc7('0x12')]=function(_0x2a4ddf){var _0xff4317=this;return new Promise(function(_0x118aa0,_0x2f196a){return db[_0x3cc7('0x13')][_0x3cc7('0x14')](_0x2a4ddf[_0x3cc7('0x15')],{'raw':_0x2a4ddf['options']?_0x2a4ddf['options'][_0x3cc7('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x41c9fb){logger[_0x3cc7('0x9')](_0x3cc7('0x12'),_0x2a4ddf);logger['debug']('CreateAttachment',_0x2a4ddf,JSON[_0x3cc7('0x17')](_0x41c9fb));_0x118aa0(_0x41c9fb);})[_0x3cc7('0x11')](function(_0x4d5b7f){logger[_0x3cc7('0xe')](_0x3cc7('0x12'),_0x4d5b7f['message'],_0x2a4ddf);_0x2f196a(_0xff4317[_0x3cc7('0xe')](0x1f4,_0x4d5b7f['message']));});});}; \ No newline at end of file +var _0x7a2c=['request','info','Attachment,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateAttachment','create','body','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x59c856,_0x37d3c7){var _0x203648=function(_0xae99b6){while(--_0xae99b6){_0x59c856['push'](_0x59c856['shift']());}};_0x203648(++_0x37d3c7);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x4d13fb,_0xc83d5c){_0x4d13fb=_0x4d13fb-0x0;var _0x5a0d53=_0x7a2c[_0x4d13fb];return _0x5a0d53;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var moment=require(_0xc7a2('0x1'));var BPromise=require(_0xc7a2('0x2'));var rs=require(_0xc7a2('0x3'));var fs=require('fs');var Redis=require(_0xc7a2('0x4'));var db=require(_0xc7a2('0x5'))['db'];var utils=require(_0xc7a2('0x6'));var logger=require(_0xc7a2('0x7'))(_0xc7a2('0x8'));var config=require('../../config/environment');var jayson=require(_0xc7a2('0x9'));var client=jayson[_0xc7a2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481430,_0x48773c,_0x1dd150){return new BPromise(function(_0x3de428,_0x3f0573){return client[_0xc7a2('0xb')](_0x481430,_0x1dd150)['then'](function(_0x38518b){logger[_0xc7a2('0xc')](_0xc7a2('0xd'),_0x48773c,'request\x20sent');logger[_0xc7a2('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x48773c,_0xc7a2('0xf'),JSON[_0xc7a2('0x10')](_0x38518b));if(_0x38518b[_0xc7a2('0x11')]){if(_0x38518b['error'][_0xc7a2('0x12')]===0x1f4){logger[_0xc7a2('0x11')](_0xc7a2('0xd'),_0x48773c,_0x38518b['error'][_0xc7a2('0x13')]);return _0x3f0573(_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);}logger[_0xc7a2('0x11')](_0xc7a2('0xd'),_0x48773c,_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);return _0x3de428(_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);}else{logger[_0xc7a2('0xc')](_0xc7a2('0xd'),_0x48773c,_0xc7a2('0xf'));_0x3de428(_0x38518b[_0xc7a2('0x14')][_0xc7a2('0x13')]);}})[_0xc7a2('0x15')](function(_0x506396){logger[_0xc7a2('0x11')]('Attachment,\x20%s,\x20%s',_0x48773c,_0x506396);_0x3f0573(_0x506396);});});}exports[_0xc7a2('0x16')]=function(_0x302d54){var _0x293343=this;return new Promise(function(_0x3da373,_0x4e50fb){return db['Attachment'][_0xc7a2('0x17')](_0x302d54[_0xc7a2('0x18')],{'raw':_0x302d54['options']?_0x302d54['options']['raw']===undefined?!![]:![]:!![]})[_0xc7a2('0x19')](function(_0x5a2f40){logger[_0xc7a2('0xc')](_0xc7a2('0x16'),_0x302d54);logger['debug'](_0xc7a2('0x16'),_0x302d54,JSON[_0xc7a2('0x10')](_0x5a2f40));_0x3da373(_0x5a2f40);})[_0xc7a2('0x15')](function(_0x35e0f6){logger[_0xc7a2('0x11')](_0xc7a2('0x16'),_0x35e0f6[_0xc7a2('0x13')],_0x302d54);_0x4e50fb(_0x293343['error'](0x1f4,_0x35e0f6['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index dbce7f2..998b809 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 _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x5707c3,_0xf15054){var _0x53ab7b=function(_0x192aee){while(--_0x192aee){_0x5707c3['push'](_0x5707c3['shift']());}};_0x53ab7b(++_0xf15054);}(_0x5f2f,0x73));var _0xf5f2=function(_0x109a00,_0xceba9a){_0x109a00=_0x109a00-0x0;var _0x36814a=_0x5f2f[_0x109a00];return _0x36814a;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x4c6393,_0x3d9d4d){var _0x22b930=function(_0x9f59f9){while(--_0x9f59f9){_0x4c6393['push'](_0x4c6393['shift']());}};_0x22b930(++_0x3d9d4d);}(_0xb10b,0x12a));var _0xbb10=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0xb10b[_0x27d8bc];return _0x4b04cb;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 31cccc3..59546ad 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 _0xf8c6=['salt','disabled','blockedAt','online','admin','user','agent','blocked','add','minutes','clearBlockUser','getLicense','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','User','passport','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf8c6,0x156));var _0x6f8c=function(_0x1db464,_0x25e0b2){_0x1db464=_0x1db464-0x0;var _0x592649=_0xf8c6[_0x1db464];return _0x592649;};'use strict';var passport=require(_0x6f8c('0x0'));var LocalStrategy=require(_0x6f8c('0x1'))[_0x6f8c('0x2')];var moment=require(_0x6f8c('0x3'));var ActiveDirectory=require(_0x6f8c('0x4'));var BPromise=require('bluebird');var util=require(_0x6f8c('0x5'));var db=require(_0x6f8c('0x6'))['db'];var authService=require(_0x6f8c('0x7'));var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x6f8c('0x8'));function isActiveDirectoryConfigured(_0x3c715e){var _0x192961=![];if(typeof _0x3c715e[_0x6f8c('0x9')]!==_0x6f8c('0xa')){_0x192961=_0x3c715e[_0x6f8c('0x9')][_0x6f8c('0xb')]&&_0x3c715e['activedirectory'][_0x6f8c('0xc')]&&_0x3c715e['activedirectory'][_0x6f8c('0xd')];}return _0x192961;}function adAuthenticate(_0x599860,_0x446414,_0x1c6238){return new BPromise(function(_0x5bb98d,_0x4aa3bf){try{var _0x4dac63=new ActiveDirectory(_0x599860);_0x4dac63[_0x6f8c('0xe')](_0x446414,_0x1c6238,function(_0x5df9bb,_0x5d2fbc){if(_0x5df9bb){logger[_0x6f8c('0xf')](_0x6f8c('0x10'),_0x446414,util['inspect'](_0x5df9bb,{'showHidden':![],'depth':null}));_0x4aa3bf(_0x6f8c('0x11'));}else if(!_0x5d2fbc){logger[_0x6f8c('0xf')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x446414);_0x4aa3bf(_0x6f8c('0x11'));}else{_0x5bb98d(_0x5d2fbc);}});}catch(_0x5d3e3f){_0x4aa3bf(_0x5d3e3f);}});}function ActiveDirectoryAuthenticate(_0xc48173,_0x5196d4,_0x3ab27f,_0x56d063){var _0x3a7155,_0x2a22a6;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x6f8c('0x12'),_0x5196d4);return _0x56d063(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x6f8c('0x13')][_0x6f8c('0x14')]({'where':{'id':0x1},'attributes':[_0x6f8c('0x15'),_0x6f8c('0x16')],'raw':!![]})[_0x6f8c('0x17')](function(_0x34e880){_0x3a7155=_0x34e880;if(!_0x3a7155[_0x6f8c('0x15')]){logger[_0x6f8c('0xf')](_0x6f8c('0x18'),_0x5196d4);throw new Error(_0x6f8c('0x11'));}return _0xc48173[_0x6f8c('0x14')]({'logging':!![],'attributes':['id',_0x6f8c('0x19'),'password',_0x6f8c('0x1a'),'role',_0x6f8c('0x1b'),'blocked',_0x6f8c('0x1c'),_0x6f8c('0x1d')],'where':{'name':_0x5196d4,'role':{'$or':[_0x6f8c('0x1e'),_0x6f8c('0x1f'),_0x6f8c('0x20')]},'adSsoEnabled':!![]}});})[_0x6f8c('0x17')](function(_0x475596){if(!_0x475596||_0x475596&&_0x475596[_0x6f8c('0x19')]!==_0x5196d4){throw new Error(_0x6f8c('0x11'));}_0x2a22a6=_0x475596;var _0x3696ee=_0x2a22a6['name']+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0x6f8c('0x9')],_0x3696ee,_0x3ab27f);})[_0x6f8c('0x17')](function(_0x30f397){if(_0x2a22a6[_0x6f8c('0x1b')]){throw new Error(_0x6f8c('0x11'));}if(_0x3a7155[_0x6f8c('0x16')]>0x0){if(_0x2a22a6[_0x6f8c('0x21')]){if(moment(_0x2a22a6[_0x6f8c('0x1c')])[_0x6f8c('0x22')](_0x3a7155[_0x6f8c('0x16')],_0x6f8c('0x23'))>moment()){throw new Error(_0x6f8c('0x11'));}return utils[_0x6f8c('0x24')](_0x2a22a6,0x0,![],null)['then'](function(){return utils[_0x6f8c('0x25')](_0x2a22a6);})[_0x6f8c('0x17')](function(){return _0x56d063(null,_0x2a22a6);});}else{return utils['getLicense'](_0x2a22a6)[_0x6f8c('0x17')](function(){return _0x56d063(null,_0x2a22a6);});}}else{return utils[_0x6f8c('0x25')](_0x2a22a6)[_0x6f8c('0x17')](function(){return _0x56d063(null,_0x2a22a6);});}})['catch'](function(_0x3cf9b6){return _0x56d063(null,![],_0x3cf9b6);});}function handleError(_0x3727db,_0x14bf30,_0xdee178){return _0x3727db[_0x6f8c('0x26')](_0x14bf30||0x1f4)[_0x6f8c('0x27')]({'message':_0xdee178?_0xdee178[_0x6f8c('0x28')]||_0xdee178:''});}exports[_0x6f8c('0x29')]=function(_0x1ddc82,_0x461607,_0x6df976){passport[_0x6f8c('0xe')](_0x6f8c('0x2a'),function(_0x452e6b,_0xc62f28,_0x56b798){var _0x4a97a1=_0x452e6b||_0x56b798;if(_0x4a97a1){return handleError(_0x461607,0x191,_0x4a97a1);}if(!_0xc62f28){return handleError(_0x461607,0x194,{'message':_0x6f8c('0x2b')});}else{var _0x13c86a={'payload':{'id':_0xc62f28['id'],'role':_0xc62f28[_0x6f8c('0x2c')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x13c86a)[_0x6f8c('0x17')](function(_0x2474b9){_0x461607['json']({'id':_0xc62f28['id'],'token':_0x2474b9,'statusCall':'','isAlreadyLogged':_0xc62f28[_0x6f8c('0x1d')]});});}})(_0x1ddc82,_0x461607,_0x6df976);};passport['use'](_0x6f8c('0x2a'),new LocalStrategy({'usernameField':_0x6f8c('0x19'),'passwordField':'password'},function(_0x5aa43e,_0x3338b4,_0x263f5e){return ActiveDirectoryAuthenticate(db[_0x6f8c('0x2d')],_0x5aa43e,_0x3338b4,_0x263f5e);})); \ No newline at end of file +var _0x3b61=['then','add','minutes','clearBlockUser','getLicense','status','send','message','login','ad-login','signToken','json','password','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','activedirectory','undefined','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','name','salt','role','blocked','blockedAt','online','admin','agent'];(function(_0x52b182,_0x3fa5b5){var _0x4d1287=function(_0x5742ce){while(--_0x5742ce){_0x52b182['push'](_0x52b182['shift']());}};_0x4d1287(++_0x3fa5b5);}(_0x3b61,0x67));var _0x13b6=function(_0x5c4756,_0x373235){_0x5c4756=_0x5c4756-0x0;var _0x600499=_0x3b61[_0x5c4756];return _0x600499;};'use strict';var passport=require(_0x13b6('0x0'));var LocalStrategy=require(_0x13b6('0x1'))[_0x13b6('0x2')];var moment=require(_0x13b6('0x3'));var ActiveDirectory=require(_0x13b6('0x4'));var BPromise=require(_0x13b6('0x5'));var util=require(_0x13b6('0x6'));var db=require(_0x13b6('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x13b6('0x8'));var config=require(_0x13b6('0x9'));var logger=require(_0x13b6('0xa'))('api');function isActiveDirectoryConfigured(_0x217b6e){var _0x7d8b81=![];if(typeof _0x217b6e[_0x13b6('0xb')]!==_0x13b6('0xc')){_0x7d8b81=_0x217b6e[_0x13b6('0xb')]['baseDN']&&_0x217b6e[_0x13b6('0xb')][_0x13b6('0xd')]&&_0x217b6e[_0x13b6('0xb')][_0x13b6('0xe')];}return _0x7d8b81;}function adAuthenticate(_0xf65302,_0x4300b6,_0x2ea29f){return new BPromise(function(_0x289d02,_0xa17cab){try{var _0x12560d=new ActiveDirectory(_0xf65302);_0x12560d[_0x13b6('0xf')](_0x4300b6,_0x2ea29f,function(_0x3ef0d5,_0x111061){if(_0x3ef0d5){logger[_0x13b6('0x10')](_0x13b6('0x11'),_0x4300b6,util['inspect'](_0x3ef0d5,{'showHidden':![],'depth':null}));_0xa17cab('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x111061){logger[_0x13b6('0x10')](_0x13b6('0x12'),_0x4300b6);_0xa17cab(_0x13b6('0x13'));}else{_0x289d02(_0x111061);}});}catch(_0x8425d4){_0xa17cab(_0x8425d4);}});}function ActiveDirectoryAuthenticate(_0xb6b2c3,_0x1770a5,_0x323b91,_0x3dfc71){var _0x58326e,_0x556a01;if(!isActiveDirectoryConfigured(config)){logger[_0x13b6('0x10')](_0x13b6('0x14'),_0x1770a5);return _0x3dfc71(null,![],{'message':_0x13b6('0x13')});}return db[_0x13b6('0x15')]['findOne']({'where':{'id':0x1},'attributes':[_0x13b6('0x16'),_0x13b6('0x17')],'raw':!![]})['then'](function(_0x3ac9b2){_0x58326e=_0x3ac9b2;if(!_0x58326e[_0x13b6('0x16')]){logger[_0x13b6('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x1770a5);throw new Error(_0x13b6('0x13'));}return _0xb6b2c3['findOne']({'logging':!![],'attributes':['id',_0x13b6('0x18'),'password',_0x13b6('0x19'),_0x13b6('0x1a'),'disabled',_0x13b6('0x1b'),_0x13b6('0x1c'),_0x13b6('0x1d')],'where':{'name':_0x1770a5,'role':{'$or':[_0x13b6('0x1e'),'user',_0x13b6('0x1f')]},'adSsoEnabled':!![]}});})[_0x13b6('0x20')](function(_0x1239c7){if(!_0x1239c7||_0x1239c7&&_0x1239c7[_0x13b6('0x18')]!==_0x1770a5){throw new Error(_0x13b6('0x13'));}_0x556a01=_0x1239c7;var _0x28f5b3=_0x556a01[_0x13b6('0x18')]+'@'+config[_0x13b6('0xb')][_0x13b6('0xe')];return adAuthenticate(config[_0x13b6('0xb')],_0x28f5b3,_0x323b91);})['then'](function(_0x19777c){if(_0x556a01['disabled']){throw new Error(_0x13b6('0x13'));}if(_0x58326e[_0x13b6('0x17')]>0x0){if(_0x556a01[_0x13b6('0x1b')]){if(moment(_0x556a01[_0x13b6('0x1c')])[_0x13b6('0x21')](_0x58326e[_0x13b6('0x17')],_0x13b6('0x22'))>moment()){throw new Error(_0x13b6('0x13'));}return utils[_0x13b6('0x23')](_0x556a01,0x0,![],null)['then'](function(){return utils[_0x13b6('0x24')](_0x556a01);})[_0x13b6('0x20')](function(){return _0x3dfc71(null,_0x556a01);});}else{return utils[_0x13b6('0x24')](_0x556a01)[_0x13b6('0x20')](function(){return _0x3dfc71(null,_0x556a01);});}}else{return utils[_0x13b6('0x24')](_0x556a01)[_0x13b6('0x20')](function(){return _0x3dfc71(null,_0x556a01);});}})['catch'](function(_0x1e072a){return _0x3dfc71(null,![],_0x1e072a);});}function handleError(_0x3d72ab,_0x210a8f,_0x4d246d){return _0x3d72ab[_0x13b6('0x25')](_0x210a8f||0x1f4)[_0x13b6('0x26')]({'message':_0x4d246d?_0x4d246d[_0x13b6('0x27')]||_0x4d246d:''});}exports[_0x13b6('0x28')]=function(_0x35d95a,_0x5703c3,_0x2fe151){passport[_0x13b6('0xf')](_0x13b6('0x29'),function(_0x45fcf2,_0x578b47,_0x3a5d8c){var _0x5eee09=_0x45fcf2||_0x3a5d8c;if(_0x5eee09){return handleError(_0x5703c3,0x191,_0x5eee09);}if(!_0x578b47){return handleError(_0x5703c3,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x48b0b1={'payload':{'id':_0x578b47['id'],'role':_0x578b47[_0x13b6('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0x13b6('0x2a')](_0x48b0b1)[_0x13b6('0x20')](function(_0x2b9edf){_0x5703c3[_0x13b6('0x2b')]({'id':_0x578b47['id'],'token':_0x2b9edf,'statusCall':'','isAlreadyLogged':_0x578b47['online']});});}})(_0x35d95a,_0x5703c3,_0x2fe151);};passport['use'](_0x13b6('0x29'),new LocalStrategy({'usernameField':_0x13b6('0x18'),'passwordField':_0x13b6('0x2c')},function(_0x4d2a21,_0x25c89d,_0x1457e9){return ActiveDirectoryAuthenticate(db['User'],_0x4d2a21,_0x25c89d,_0x1457e9);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 4317316..6edf6a2 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 _0x0490=['Router','./authActiveDirectory.controller','post','login','exports','express'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x0490,0x137));var _0x0049=function(_0x1d5fb9,_0x43aa73){_0x1d5fb9=_0x1d5fb9-0x0;var _0xd72009=_0x0490[_0x1d5fb9];return _0xd72009;};'use strict';var express=require(_0x0049('0x0'));var router=express[_0x0049('0x1')]();var controller=require(_0x0049('0x2'));router[_0x0049('0x3')]('/',controller[_0x0049('0x4')]);module[_0x0049('0x5')]=router; \ No newline at end of file +var _0xb18a=['./authActiveDirectory.controller','post','exports','express'];(function(_0xe66276,_0x165f4e){var _0x2354c1=function(_0x37f151){while(--_0x37f151){_0xe66276['push'](_0xe66276['shift']());}};_0x2354c1(++_0x165f4e);}(_0xb18a,0x19f));var _0xab18=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xb18a[_0x16b9ed];return _0x66b1f8;};'use strict';var express=require(_0xab18('0x0'));var router=express['Router']();var controller=require(_0xab18('0x1'));router[_0xab18('0x2')]('/',controller['login']);module[_0xab18('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 9096303..04eacc4 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(_0x225dd1,_0x28258c){var _0x45ff06=function(_0x443c6d){while(--_0x443c6d){_0x225dd1['push'](_0x225dd1['shift']());}};_0x45ff06(++_0x28258c);}(_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 _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x7a54,0x106));var _0x47a5=function(_0x4c5add,_0x20076e){_0x4c5add=_0x4c5add-0x0;var _0x1bdf7e=_0x7a54[_0x4c5add];return _0x1bdf7e;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index f8deb6d..04f4df8 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 _0x3a96=['setTokenCookie','exports','express','Router','../../components/auth/service','get','login','isMiddleware'];(function(_0x32eb3f,_0x3cc610){var _0x372d5f=function(_0x1c1e25){while(--_0x1c1e25){_0x32eb3f['push'](_0x32eb3f['shift']());}};_0x372d5f(++_0x3cc610);}(_0x3a96,0x1b2));var _0x63a9=function(_0x3324f6,_0x589836){_0x3324f6=_0x3324f6-0x0;var _0x38281e=_0x3a96[_0x3324f6];return _0x38281e;};'use strict';var express=require(_0x63a9('0x0'));var passport=require('passport');var router=express[_0x63a9('0x1')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x63a9('0x2'));router[_0x63a9('0x3')]('/',controller[_0x63a9('0x4')]);router[_0x63a9('0x3')]('/callback',controller['callback'],authService[_0x63a9('0x5')],userController['login'],authService[_0x63a9('0x6')]);module[_0x63a9('0x7')]=router; \ No newline at end of file +var _0x41a6=['login','setTokenCookie','exports','./authGoogle.controller','../user/user.controller.js','get','/callback','isMiddleware'];(function(_0x103b2e,_0x4293f1){var _0x14a460=function(_0x592c76){while(--_0x592c76){_0x103b2e['push'](_0x103b2e['shift']());}};_0x14a460(++_0x4293f1);}(_0x41a6,0x16b));var _0x641a=function(_0x33c6e3,_0x24ce45){_0x33c6e3=_0x33c6e3-0x0;var _0x1119e0=_0x41a6[_0x33c6e3];return _0x1119e0;};'use strict';var express=require('express');var passport=require('passport');var router=express['Router']();var controller=require(_0x641a('0x0'));var userController=require(_0x641a('0x1'));var authService=require('../../components/auth/service');router[_0x641a('0x2')]('/',controller['login']);router[_0x641a('0x2')](_0x641a('0x3'),controller['callback'],authService[_0x641a('0x4')],userController[_0x641a('0x5')],authService[_0x641a('0x6')]);module[_0x641a('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 972c5e3..3b9f39b 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 _0x6a53=['lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','then','name','password','salt','role','disabled','blocked','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','blockedAt','add','minutes','clearBlockUser','allowedLoginAttempts','getLicense','catch','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','pass','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','email','Email\x20parameter\x20is\x20missing','generate','trim','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','User','securePassword','enforcePasswordHistory','validatePasswordHistory','passwordHistoryLimit','resetPasswordToken','Password\x20reset!','local-login','passport-local','Strategy','jayson/promise'];(function(_0x4d150a,_0xf46ee4){var _0x14f893=function(_0x3a5b27){while(--_0x3a5b27){_0x4d150a['push'](_0x4d150a['shift']());}};_0x14f893(++_0xf46ee4);}(_0x6a53,0x1ef));var _0x36a5=function(_0x5e2c70,_0x108e64){_0x5e2c70=_0x5e2c70-0x0;var _0x1e6cbc=_0x6a53[_0x5e2c70];return _0x1e6cbc;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0x36a5('0x0'))[_0x36a5('0x1')];var jayson=require(_0x36a5('0x2'));var _=require(_0x36a5('0x3'));var rs=require(_0x36a5('0x4'));var moment=require(_0x36a5('0x5'));var db=require(_0x36a5('0x6'))['db'];var authService=require(_0x36a5('0x7'));var utils=require(_0x36a5('0x8'));var client=jayson[_0x36a5('0x9')]['http']({'port':0x232b});function localAuthenticate(_0x7e27a7,_0x4e06a4,_0x1ad3a8,_0x6c4299){var _0x31e56f,_0x3d894d;return db[_0x36a5('0xa')][_0x36a5('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x36a5('0xc')](function(_0x1ee266){_0x31e56f=_0x1ee266;return _0x7e27a7[_0x36a5('0xb')]({'attributes':['id',_0x36a5('0xd'),_0x36a5('0xe'),_0x36a5('0xf'),_0x36a5('0x10'),_0x36a5('0x11'),_0x36a5('0x12'),'blockedAt',_0x36a5('0x13')],'where':{'name':_0x4e06a4,'role':{'$or':['admin',_0x36a5('0x14'),_0x36a5('0x15')]}}});})[_0x36a5('0xc')](function(_0x1ec0d2){if(!_0x1ec0d2||_0x1ec0d2&&_0x1ec0d2[_0x36a5('0xd')]!==_0x4e06a4){throw new Error(_0x36a5('0x16'));}else{_0x3d894d=_0x1ec0d2;return _0x3d894d;}})[_0x36a5('0xc')](function(){_0x3d894d[_0x36a5('0x17')](_0x1ad3a8,function(_0x49b96e,_0x4bd23a){var _0x49e73e=_0x3d894d[_0x36a5('0x13')]+0x1;if(_0x49b96e){return _0x6c4299(_0x49b96e);}else if(!_0x4bd23a){if(_0x3d894d['disabled']){return _0x6c4299(null,![],{'message':_0x36a5('0x16')});}else if(_0x31e56f['allowedLoginAttempts']>0x0){if(_0x3d894d[_0x36a5('0x12')]){if(_0x31e56f[_0x36a5('0x18')]>0x0){if(moment(_0x3d894d[_0x36a5('0x19')])[_0x36a5('0x1a')](_0x31e56f[_0x36a5('0x18')],_0x36a5('0x1b'))>moment()){return _0x6c4299(null,![],{'message':_0x36a5('0x16')});}else{return utils[_0x36a5('0x1c')](_0x3d894d,_0x49e73e,![],null)['then'](function(){return _0x6c4299(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x6c4299(null,![],{'message':_0x36a5('0x16')});}}else{if(_0x49e73e>=_0x31e56f[_0x36a5('0x1d')]){return utils[_0x36a5('0x1c')](_0x3d894d,0x0,!![],moment())['then'](function(){return _0x6c4299(null,![],{'message':_0x36a5('0x16')});});}else{return utils[_0x36a5('0x1c')](_0x3d894d,_0x49e73e,![],null)[_0x36a5('0xc')](function(){return _0x6c4299(null,![],{'message':_0x36a5('0x16')});});}}}else{return _0x6c4299(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x3d894d[_0x36a5('0x11')]){return _0x6c4299(null,![],{'message':_0x36a5('0x16')});}else if(_0x31e56f[_0x36a5('0x1d')]>0x0){if(_0x3d894d[_0x36a5('0x12')]){if(_0x31e56f[_0x36a5('0x18')]>0x0){if(moment(_0x3d894d[_0x36a5('0x19')])[_0x36a5('0x1a')](_0x31e56f[_0x36a5('0x18')],_0x36a5('0x1b'))>moment()){return _0x6c4299(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x36a5('0x1c')](_0x3d894d,0x0,![],null)[_0x36a5('0xc')](function(){return utils[_0x36a5('0x1e')](_0x3d894d);})[_0x36a5('0xc')](function(){return _0x6c4299(null,_0x3d894d);});}}else{return _0x6c4299(null,![],{'message':_0x36a5('0x16')});}}else{return utils[_0x36a5('0x1c')](_0x3d894d,0x0,![],null)[_0x36a5('0xc')](function(){return utils[_0x36a5('0x1e')](_0x3d894d);})[_0x36a5('0xc')](function(){return _0x6c4299(null,_0x3d894d);})[_0x36a5('0x1f')](function(_0x11a246){return _0x6c4299(null,![],_0x11a246);});}}else{if(_0x3d894d['blocked']){return _0x6c4299(null,![],{'message':_0x36a5('0x16')});}else{return utils[_0x36a5('0x1e')](_0x3d894d)[_0x36a5('0xc')](function(){return _0x6c4299(null,_0x3d894d);});}}}});})['catch'](function(_0x4dd32e){return _0x6c4299(null,![],_0x4dd32e);});}function sendServiceMail(_0x1d814c){return db[_0x36a5('0x20')][_0x36a5('0x21')]({'where':{'service':!![]},'attributes':['id',_0x36a5('0xd'),'email'],'include':[{'model':db[_0x36a5('0x22')],'as':_0x36a5('0x23')}]})[_0x36a5('0xc')](function(_0x3e5b25){if(!_0x3e5b25){throw new Error(_0x36a5('0x24'));}var _0x27ef52={'tls':{'rejectUnauthorized':![]}};if(_0x3e5b25[_0x36a5('0x23')]['service']){_0x27ef52[_0x36a5('0x25')]=_0x3e5b25[_0x36a5('0x23')]['service'];}else{_0x27ef52[_0x36a5('0x26')]=_0x3e5b25[_0x36a5('0x23')]['host'];_0x27ef52[_0x36a5('0x27')]=_0x3e5b25['Smtp'][_0x36a5('0x27')];_0x27ef52[_0x36a5('0x28')]=_0x3e5b25['Smtp'][_0x36a5('0x28')];}if(_0x3e5b25['Smtp'][_0x36a5('0x29')]){_0x27ef52['auth']={'user':_0x3e5b25[_0x36a5('0x23')]['user'],'pass':_0x3e5b25[_0x36a5('0x23')][_0x36a5('0x2a')]};}var _0x6caed9={'account':_0x27ef52,'message':_['merge']({'from':util[_0x36a5('0x2b')](_0x36a5('0x2c'),_0x3e5b25[_0x36a5('0xd')],_0x3e5b25['email']||_0x3e5b25[_0x36a5('0x23')][_0x36a5('0x14')])},_0x1d814c)};return client[_0x36a5('0x2d')](_0x36a5('0x2e'),_0x6caed9);})[_0x36a5('0xc')](function(_0x7b4f4a){if(_0x7b4f4a[_0x36a5('0x2f')]){throw new Error(util[_0x36a5('0x2b')](_0x36a5('0x30'),_0x7b4f4a[_0x36a5('0x2f')][_0x36a5('0x31')]||JSON[_0x36a5('0x32')](_0x7b4f4a['error'])));}return!![];});}function handleError(_0x247bfc,_0x333c0e,_0x5d3c0a){return _0x247bfc[_0x36a5('0x33')](_0x333c0e||0x1f4)[_0x36a5('0x34')]({'message':_0x5d3c0a?_0x5d3c0a[_0x36a5('0x31')]||_0x5d3c0a:''});}exports[_0x36a5('0x35')]=function(_0x2b8be3,_0x188bbb,_0xd2c66d){passport['authenticate']('local-login',function(_0x1573d4,_0xe4831a,_0x41aa08){var _0x43869d=_0x1573d4||_0x41aa08;if(_0x43869d){return handleError(_0x188bbb,0x191,_0x43869d);}if(!_0xe4831a){return handleError(_0x188bbb,0x194,{'message':_0x36a5('0x36')});}else{var _0x193077={'payload':{'id':_0xe4831a['id'],'role':_0xe4831a[_0x36a5('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x36a5('0x37')](_0x193077)[_0x36a5('0xc')](function(_0x46125d){_0x188bbb[_0x36a5('0x38')]({'id':_0xe4831a['id'],'token':_0x46125d,'statusCall':'','isAlreadyLogged':_0xe4831a[_0x36a5('0x39')]});});}})(_0x2b8be3,_0x188bbb,_0xd2c66d);};exports[_0x36a5('0x3a')]=function(_0x4b2463,_0x55b224,_0x30e445){if(!_0x4b2463[_0x36a5('0x3b')][_0x36a5('0x3c')]){return handleError(_0x55b224,0x1f4,{'message':_0x36a5('0x3d')});}var _0x28213f=rs[_0x36a5('0x3e')]();_0x4b2463[_0x36a5('0x3b')][_0x36a5('0x3c')]=_0x4b2463[_0x36a5('0x3b')][_0x36a5('0x3c')][_0x36a5('0x3f')]()['toLowerCase']();var _0x2d6e67;return db[_0x36a5('0xa')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x36a5('0x18')],'raw':!![]})[_0x36a5('0xc')](function(_0x2a3d71){_0x2d6e67=_0x2a3d71;return db['User'][_0x36a5('0x21')]({'where':{'email':_0x4b2463[_0x36a5('0x3b')][_0x36a5('0x3c')]}});})[_0x36a5('0xc')](function(_0xb4efaa){if(!_0xb4efaa){throw new Error(_0x36a5('0x40'));}if(_0xb4efaa[_0x36a5('0x11')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0xb4efaa[_0x36a5('0x12')]){if(moment(_0xb4efaa['blockedAt'])['add'](_0x2d6e67[_0x36a5('0x18')],_0x36a5('0x1b'))>moment()){throw new Error(_0x36a5('0x41'));}else{_0xb4efaa[_0x36a5('0x12')]=![];_0xb4efaa['blockedAt']=null;}}_0xb4efaa['resetPasswordToken']=_0x28213f;_0xb4efaa[_0x36a5('0x42')]=Date[_0x36a5('0x43')]()+0x36ee80;return _0xb4efaa[_0x36a5('0x44')]();})[_0x36a5('0xc')](function(){return sendServiceMail({'to':_0x4b2463['body'][_0x36a5('0x3c')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x36a5('0x45')+_0x36a5('0x46')+_0x36a5('0x47')+_0x4b2463[_0x36a5('0x48')][_0x36a5('0x26')]+'/reset/'+_0x28213f+'\x0a\x0a'+_0x36a5('0x49')});})[_0x36a5('0xc')](function(){_0x55b224[_0x36a5('0x33')](0xc8)[_0x36a5('0x34')]({'message':_0x36a5('0x4a')});})[_0x36a5('0x1f')](function(_0x516b6c){return handleError(_0x55b224,0x1f4,_0x516b6c);});};exports['reset']=function(_0x29957c,_0x459a4e,_0xcb4d06){return db[_0x36a5('0x4b')][_0x36a5('0x21')]({'where':{'resetPasswordToken':_0x29957c['params']['token'],'resetPasswordExpires':{'$gt':Date[_0x36a5('0x43')]()}}})[_0x36a5('0xc')](function(_0x4ee271){if(!_0x4ee271){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting']['findOne']({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})['then'](function(_0xb02524){if(_0xb02524[_0x36a5('0x4c')])authService['validatePasswordPattern'](_0x29957c[_0x36a5('0x3b')][_0x36a5('0xe')]);if(!_0xb02524[_0x36a5('0x4d')]||!_0x4ee271['previousPasswords'])return _0x4ee271;authService[_0x36a5('0x4e')](_0x29957c['body']['password'],_0x4ee271['previousPasswords'],_0xb02524[_0x36a5('0x4f')]);return _0x4ee271;})['then'](function(){_0x4ee271['password']=_0x29957c[_0x36a5('0x3b')][_0x36a5('0xe')];_0x4ee271[_0x36a5('0x50')]=null;_0x4ee271['resetPasswordExpires']=null;return _0x4ee271[_0x36a5('0x44')]();});})['then'](function(){_0x459a4e[_0x36a5('0x33')](0xc8)[_0x36a5('0x34')]({'message':_0x36a5('0x51')});})['catch'](function(_0x1cb64b){return handleError(_0x459a4e,0x1f4,_0x1cb64b);});};passport['use'](_0x36a5('0x52'),new LocalStrategy({'usernameField':_0x36a5('0xd'),'passwordField':_0x36a5('0xe')},function(_0x5aff70,_0x1addc1,_0x26873c){return localAuthenticate(db[_0x36a5('0x4b')],_0x5aff70,_0x1addc1,_0x26873c);})); \ No newline at end of file +var _0xa78e=['blocked','blockedAt','user','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','add','clearBlockUser','disabled','minutes','getLicense','catch','MailAccount','find','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','auth','pass','format','email','request','error','message','stringify','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','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','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','password','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','Strategy','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','role'];(function(_0x5782e6,_0x7de50f){var _0x3f15d7=function(_0x1adae5){while(--_0x1adae5){_0x5782e6['push'](_0x5782e6['shift']());}};_0x3f15d7(++_0x7de50f);}(_0xa78e,0x194));var _0xea78=function(_0x59f3f4,_0x450a59){_0x59f3f4=_0x59f3f4-0x0;var _0xb0df5f=_0xa78e[_0x59f3f4];return _0xb0df5f;};'use strict';var util=require(_0xea78('0x0'));var passport=require(_0xea78('0x1'));var LocalStrategy=require('passport-local')[_0xea78('0x2')];var jayson=require('jayson/promise');var _=require(_0xea78('0x3'));var rs=require(_0xea78('0x4'));var moment=require(_0xea78('0x5'));var db=require(_0xea78('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xea78('0x7'));var client=jayson[_0xea78('0x8')][_0xea78('0x9')]({'port':0x232b});function localAuthenticate(_0x5d83e5,_0x3d1843,_0x238ada,_0x451a17){var _0x271011,_0x2d3f73;return db[_0xea78('0xa')][_0xea78('0xb')]({'where':{'id':0x1},'attributes':[_0xea78('0xc'),_0xea78('0xd')],'raw':!![]})[_0xea78('0xe')](function(_0x3fd743){_0x271011=_0x3fd743;return _0x5d83e5['findOne']({'attributes':['id','name','password','salt',_0xea78('0xf'),'disabled',_0xea78('0x10'),_0xea78('0x11'),'loginAttempts'],'where':{'name':_0x3d1843,'role':{'$or':['admin',_0xea78('0x12'),'agent']}}});})[_0xea78('0xe')](function(_0x7b5223){if(!_0x7b5223||_0x7b5223&&_0x7b5223[_0xea78('0x13')]!==_0x3d1843){throw new Error(_0xea78('0x14'));}else{_0x2d3f73=_0x7b5223;return _0x2d3f73;}})['then'](function(){_0x2d3f73['authenticate'](_0x238ada,function(_0xd15d22,_0x1dfa6f){var _0x2b0835=_0x2d3f73[_0xea78('0x15')]+0x1;if(_0xd15d22){return _0x451a17(_0xd15d22);}else if(!_0x1dfa6f){if(_0x2d3f73['disabled']){return _0x451a17(null,![],{'message':_0xea78('0x14')});}else if(_0x271011[_0xea78('0xc')]>0x0){if(_0x2d3f73['blocked']){if(_0x271011['blockDuration']>0x0){if(moment(_0x2d3f73[_0xea78('0x11')])[_0xea78('0x16')](_0x271011[_0xea78('0xd')],'minutes')>moment()){return _0x451a17(null,![],{'message':_0xea78('0x14')});}else{return utils[_0xea78('0x17')](_0x2d3f73,_0x2b0835,![],null)[_0xea78('0xe')](function(){return _0x451a17(null,![],{'message':_0xea78('0x14')});});}}else{return _0x451a17(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2b0835>=_0x271011[_0xea78('0xc')]){return utils[_0xea78('0x17')](_0x2d3f73,0x0,!![],moment())[_0xea78('0xe')](function(){return _0x451a17(null,![],{'message':_0xea78('0x14')});});}else{return utils[_0xea78('0x17')](_0x2d3f73,_0x2b0835,![],null)['then'](function(){return _0x451a17(null,![],{'message':_0xea78('0x14')});});}}}else{return _0x451a17(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2d3f73[_0xea78('0x18')]){return _0x451a17(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x271011['allowedLoginAttempts']>0x0){if(_0x2d3f73[_0xea78('0x10')]){if(_0x271011[_0xea78('0xd')]>0x0){if(moment(_0x2d3f73[_0xea78('0x11')])[_0xea78('0x16')](_0x271011[_0xea78('0xd')],_0xea78('0x19'))>moment()){return _0x451a17(null,![],{'message':_0xea78('0x14')});}else{return utils[_0xea78('0x17')](_0x2d3f73,0x0,![],null)[_0xea78('0xe')](function(){return utils[_0xea78('0x1a')](_0x2d3f73);})[_0xea78('0xe')](function(){return _0x451a17(null,_0x2d3f73);});}}else{return _0x451a17(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xea78('0x17')](_0x2d3f73,0x0,![],null)[_0xea78('0xe')](function(){return utils[_0xea78('0x1a')](_0x2d3f73);})[_0xea78('0xe')](function(){return _0x451a17(null,_0x2d3f73);})['catch'](function(_0x499cae){return _0x451a17(null,![],_0x499cae);});}}else{if(_0x2d3f73[_0xea78('0x10')]){return _0x451a17(null,![],{'message':_0xea78('0x14')});}else{return utils[_0xea78('0x1a')](_0x2d3f73)[_0xea78('0xe')](function(){return _0x451a17(null,_0x2d3f73);});}}}});})[_0xea78('0x1b')](function(_0x3fcce0){return _0x451a17(null,![],_0x3fcce0);});}function sendServiceMail(_0x26b3c9){return db[_0xea78('0x1c')][_0xea78('0x1d')]({'where':{'service':!![]},'attributes':['id',_0xea78('0x13'),'email'],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]})[_0xea78('0xe')](function(_0x1505c3){if(!_0x1505c3){throw new Error(_0xea78('0x1e'));}var _0x582a3b={'tls':{'rejectUnauthorized':![]}};if(_0x1505c3[_0xea78('0x1f')]['service']){_0x582a3b[_0xea78('0x20')]=_0x1505c3[_0xea78('0x1f')][_0xea78('0x20')];}else{_0x582a3b[_0xea78('0x21')]=_0x1505c3['Smtp']['host'];_0x582a3b[_0xea78('0x22')]=_0x1505c3[_0xea78('0x1f')]['port'];_0x582a3b[_0xea78('0x23')]=_0x1505c3[_0xea78('0x1f')][_0xea78('0x23')];}if(_0x1505c3[_0xea78('0x1f')]['authentication']){_0x582a3b[_0xea78('0x24')]={'user':_0x1505c3[_0xea78('0x1f')][_0xea78('0x12')],'pass':_0x1505c3[_0xea78('0x1f')][_0xea78('0x25')]};}var _0x15946f={'account':_0x582a3b,'message':_['merge']({'from':util[_0xea78('0x26')]('\x22%s\x22\x20<%s>',_0x1505c3[_0xea78('0x13')],_0x1505c3[_0xea78('0x27')]||_0x1505c3['Smtp'][_0xea78('0x12')])},_0x26b3c9)};return client[_0xea78('0x28')]('SendMail',_0x15946f);})[_0xea78('0xe')](function(_0x1b3e5b){if(_0x1b3e5b[_0xea78('0x29')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x1b3e5b['error'][_0xea78('0x2a')]||JSON[_0xea78('0x2b')](_0x1b3e5b[_0xea78('0x29')])));}return!![];});}function handleError(_0x398068,_0x2adff1,_0x444e92){return _0x398068['status'](_0x2adff1||0x1f4)[_0xea78('0x2c')]({'message':_0x444e92?_0x444e92['message']||_0x444e92:''});}exports[_0xea78('0x2d')]=function(_0x5d8979,_0x10e055,_0x4ddf53){passport[_0xea78('0x2e')](_0xea78('0x2f'),function(_0x16f89e,_0x56f178,_0x3b5a73){var _0x474e72=_0x16f89e||_0x3b5a73;if(_0x474e72){return handleError(_0x10e055,0x191,_0x474e72);}if(!_0x56f178){return handleError(_0x10e055,0x194,{'message':_0xea78('0x30')});}else{var _0x3c320f={'payload':{'id':_0x56f178['id'],'role':_0x56f178[_0xea78('0xf')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x3c320f)[_0xea78('0xe')](function(_0x484f25){_0x10e055[_0xea78('0x31')]({'id':_0x56f178['id'],'token':_0x484f25,'statusCall':'','isAlreadyLogged':_0x56f178[_0xea78('0x32')]});});}})(_0x5d8979,_0x10e055,_0x4ddf53);};exports[_0xea78('0x33')]=function(_0x544229,_0x2702c9,_0x2cb053){if(!_0x544229[_0xea78('0x34')]['email']){return handleError(_0x2702c9,0x1f4,{'message':_0xea78('0x35')});}var _0x4867d5=rs[_0xea78('0x36')]();_0x544229[_0xea78('0x34')]['email']=_0x544229['body'][_0xea78('0x27')][_0xea78('0x37')]()[_0xea78('0x38')]();var _0x6f3039;return db['Setting'][_0xea78('0xb')]({'where':{'id':0x1},'attributes':[_0xea78('0xc'),_0xea78('0xd')],'raw':!![]})[_0xea78('0xe')](function(_0x18676b){_0x6f3039=_0x18676b;return db[_0xea78('0x39')][_0xea78('0x1d')]({'where':{'email':_0x544229[_0xea78('0x34')]['email']}});})['then'](function(_0x5beda1){if(!_0x5beda1){throw new Error(_0xea78('0x3a'));}if(_0x5beda1['disabled']){throw new Error(_0xea78('0x3b'));}if(_0x5beda1[_0xea78('0x10')]){if(moment(_0x5beda1[_0xea78('0x11')])['add'](_0x6f3039[_0xea78('0xd')],_0xea78('0x19'))>moment()){throw new Error(_0xea78('0x3c'));}else{_0x5beda1[_0xea78('0x10')]=![];_0x5beda1['blockedAt']=null;}}_0x5beda1[_0xea78('0x3d')]=_0x4867d5;_0x5beda1[_0xea78('0x3e')]=Date[_0xea78('0x3f')]()+0x36ee80;return _0x5beda1[_0xea78('0x40')]();})['then'](function(){return sendServiceMail({'to':_0x544229[_0xea78('0x34')][_0xea78('0x27')],'subject':_0xea78('0x41'),'text':_0xea78('0x42')+_0xea78('0x43')+_0xea78('0x44')+_0x544229[_0xea78('0x45')][_0xea78('0x21')]+_0xea78('0x46')+_0x4867d5+'\x0a\x0a'+_0xea78('0x47')});})[_0xea78('0xe')](function(){_0x2702c9[_0xea78('0x48')](0xc8)[_0xea78('0x2c')]({'message':_0xea78('0x49')});})[_0xea78('0x1b')](function(_0x216445){return handleError(_0x2702c9,0x1f4,_0x216445);});};exports['reset']=function(_0x32d097,_0x542524,_0x380d22){return db[_0xea78('0x39')]['find']({'where':{'resetPasswordToken':_0x32d097['params'][_0xea78('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xea78('0x3f')]()}}})[_0xea78('0xe')](function(_0x6aa68d){if(!_0x6aa68d){throw new Error(_0xea78('0x4b'));}return db['Setting'][_0xea78('0xb')]({'attributes':['id',_0xea78('0x4c'),_0xea78('0x4d'),_0xea78('0x4e')]})[_0xea78('0xe')](function(_0xb0bdfe){if(_0xb0bdfe['securePassword'])authService['validatePasswordPattern'](_0x32d097[_0xea78('0x34')][_0xea78('0x4f')]);if(!_0xb0bdfe[_0xea78('0x4d')]||!_0x6aa68d[_0xea78('0x50')])return _0x6aa68d;authService[_0xea78('0x51')](_0x32d097[_0xea78('0x34')][_0xea78('0x4f')],_0x6aa68d['previousPasswords'],_0xb0bdfe[_0xea78('0x4e')]);return _0x6aa68d;})[_0xea78('0xe')](function(){_0x6aa68d['password']=_0x32d097['body'][_0xea78('0x4f')];_0x6aa68d[_0xea78('0x3d')]=null;_0x6aa68d['resetPasswordExpires']=null;return _0x6aa68d[_0xea78('0x40')]();});})[_0xea78('0xe')](function(){_0x542524[_0xea78('0x48')](0xc8)['send']({'message':_0xea78('0x52')});})['catch'](function(_0x36c27a){return handleError(_0x542524,0x1f4,_0x36c27a);});};passport[_0xea78('0x53')](_0xea78('0x2f'),new LocalStrategy({'usernameField':_0xea78('0x13'),'passwordField':_0xea78('0x4f')},function(_0x1a8b74,_0x2bad55,_0x34d3da){return localAuthenticate(db[_0xea78('0x39')],_0x1a8b74,_0x2bad55,_0x34d3da);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 45a023e..706500f 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 _0x7db4=['exports','Router','post','login','forgot','reset'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0x7db4,0xc7));var _0x47db=function(_0x202f99,_0x5f1897){_0x202f99=_0x202f99-0x0;var _0x44c111=_0x7db4[_0x202f99];return _0x44c111;};'use strict';var express=require('express');var router=express[_0x47db('0x0')]();var controller=require('./authLocal.controller');router[_0x47db('0x1')]('/',controller[_0x47db('0x2')]);router[_0x47db('0x1')]('/forgot',controller[_0x47db('0x3')]);router[_0x47db('0x1')]('/reset/:token',controller[_0x47db('0x4')]);module[_0x47db('0x5')]=router; \ No newline at end of file +var _0xe554=['./authLocal.controller','login','post','forgot','reset'];(function(_0x3f2b4a,_0x30546b){var _0x221546=function(_0x4a1378){while(--_0x4a1378){_0x3f2b4a['push'](_0x3f2b4a['shift']());}};_0x221546(++_0x30546b);}(_0xe554,0x11d));var _0x4e55=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe554[_0xbca1b1];return _0x4e1686;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x4e55('0x0'));router['post']('/',controller[_0x4e55('0x1')]);router[_0x4e55('0x2')]('/forgot',controller[_0x4e55('0x3')]);router[_0x4e55('0x2')]('/reset/:token',controller[_0x4e55('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 3fff104..26b0e52 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 _0x2270=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x5a588d,_0x8ed81){var _0x3bf58b=function(_0x83df06){while(--_0x83df06){_0x5a588d['push'](_0x5a588d['shift']());}};_0x3bf58b(++_0x8ed81);}(_0x2270,0xaa));var _0x0227=function(_0x33f3a8,_0x4dee8f){_0x33f3a8=_0x33f3a8-0x0;var _0x3327e3=_0x2270[_0x33f3a8];return _0x3327e3;};'use strict';var Sequelize=require(_0x0227('0x0'));module[_0x0227('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0227('0x2')]},'status':{'type':Sequelize[_0x0227('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0227('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x2570=['STRING','BOOLEAN','sequelize'];(function(_0x586f3e,_0x345160){var _0x5e3c4a=function(_0x3fb037){while(--_0x3fb037){_0x586f3e['push'](_0x586f3e['shift']());}};_0x5e3c4a(++_0x345160);}(_0x2570,0xec));var _0x0257=function(_0x3b0449,_0x14bba6){_0x3b0449=_0x3b0449-0x0;var _0x3e7b06=_0x2570[_0x3b0449];return _0x3e7b06;};'use strict';var Sequelize=require(_0x0257('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0257('0x1')]},'status':{'type':Sequelize[_0x0257('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 012aaf5..fc6615f 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 _0xa962=['query','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','find','create','body','update','catch','Condition','ids','omit','getConditions','order','hasOwnProperty','Action','addActions','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','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','end','json','offset','undefined','count','limit','set','reject','save','destroy','then','error','stack','name','send','index','map','Automation','rawAttributes','type','key','model','keys'];(function(_0x10a489,_0x2d1b7c){var _0x5360e5=function(_0x1cf55d){while(--_0x1cf55d){_0x10a489['push'](_0x10a489['shift']());}};_0x5360e5(++_0x2d1b7c);}(_0xa962,0x171));var _0x2a96=function(_0x28f0fe,_0xbfdfc5){_0x28f0fe=_0x28f0fe-0x0;var _0x326ff6=_0xa962[_0x28f0fe];return _0x326ff6;};'use strict';var emlformat=require(_0x2a96('0x0'));var rimraf=require(_0x2a96('0x1'));var zipdir=require(_0x2a96('0x2'));var jsonpatch=require(_0x2a96('0x3'));var rp=require(_0x2a96('0x4'));var moment=require(_0x2a96('0x5'));var BPromise=require(_0x2a96('0x6'));var Mustache=require(_0x2a96('0x7'));var util=require(_0x2a96('0x8'));var path=require(_0x2a96('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a96('0xa'));var _=require(_0x2a96('0xb'));var squel=require('squel');var crypto=require(_0x2a96('0xc'));var jsforce=require(_0x2a96('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2a96('0xe'));var Papa=require(_0x2a96('0xf'));var Redis=require(_0x2a96('0x10'));var authService=require(_0x2a96('0x11'));var qs=require(_0x2a96('0x12'));var as=require(_0x2a96('0x13'));var hardwareService=require(_0x2a96('0x14'));var logger=require('../../config/logger')(_0x2a96('0x15'));var utils=require(_0x2a96('0x16'));var config=require(_0x2a96('0x17'));var licenseUtil=require(_0x2a96('0x18'));var db=require(_0x2a96('0x19'))['db'];function respondWithStatusCode(_0x116479,_0x292b67){_0x292b67=_0x292b67||0xcc;return function(_0x49034b){if(_0x49034b){return _0x116479[_0x2a96('0x1a')](_0x292b67);}return _0x116479[_0x2a96('0x1b')](_0x292b67)[_0x2a96('0x1c')]();};}function respondWithResult(_0x24e0b5,_0x4c6be1){_0x4c6be1=_0x4c6be1||0xc8;return function(_0x432d4c){if(_0x432d4c){return _0x24e0b5[_0x2a96('0x1b')](_0x4c6be1)[_0x2a96('0x1d')](_0x432d4c);}};}function respondWithFilteredResult(_0x4cf394,_0x5bd876){return function(_0x3de8cf){if(_0x3de8cf){var _0x43d767=typeof _0x5bd876[_0x2a96('0x1e')]===_0x2a96('0x1f')&&typeof _0x5bd876['limit']==='undefined';var _0x264f5c=_0x3de8cf[_0x2a96('0x20')];var _0x2868e7=_0x43d767?0x0:_0x5bd876[_0x2a96('0x1e')];var _0x43dcc0=_0x43d767?_0x3de8cf[_0x2a96('0x20')]:_0x5bd876[_0x2a96('0x1e')]+_0x5bd876[_0x2a96('0x21')];var _0xfc0b46;if(_0x43dcc0>=_0x264f5c){_0x43dcc0=_0x264f5c;_0xfc0b46=0xc8;}else{_0xfc0b46=0xce;}_0x4cf394[_0x2a96('0x1b')](_0xfc0b46);return _0x4cf394[_0x2a96('0x22')]('Content-Range',_0x2868e7+'-'+_0x43dcc0+'/'+_0x264f5c)['json'](_0x3de8cf);}return null;};}function patchUpdates(_0x14d7ee){return function(_0x4e279d){try{jsonpatch['apply'](_0x4e279d,_0x14d7ee,!![]);}catch(_0x1e1b29){return BPromise[_0x2a96('0x23')](_0x1e1b29);}return _0x4e279d[_0x2a96('0x24')]();};}function saveUpdates(_0x3c1a41,_0x103984){return function(_0x16a6fa){if(_0x16a6fa){return _0x16a6fa['update'](_0x3c1a41)['then'](function(_0x5ec7db){return _0x5ec7db;});}return null;};}function removeEntity(_0x4ac9be,_0x1adbc9){return function(_0x31ed35){if(_0x31ed35){return _0x31ed35[_0x2a96('0x25')]()[_0x2a96('0x26')](function(){_0x4ac9be['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x27b138,_0xdcb5fd){return function(_0xc83b9d){if(!_0xc83b9d){_0x27b138[_0x2a96('0x1a')](0x194);}return _0xc83b9d;};}function handleError(_0x581158,_0x3a4312){_0x3a4312=_0x3a4312||0x1f4;return function(_0xff9632){logger[_0x2a96('0x27')](_0xff9632[_0x2a96('0x28')]);if(_0xff9632[_0x2a96('0x29')]){delete _0xff9632[_0x2a96('0x29')];}_0x581158[_0x2a96('0x1b')](_0x3a4312)[_0x2a96('0x2a')](_0xff9632);};}exports[_0x2a96('0x2b')]=function(_0x9c8837,_0x5eba69){var _0x4a8714={},_0x1f8aa9={},_0x527169={'count':0x0,'rows':[]};var _0x3e64a=_[_0x2a96('0x2c')](db[_0x2a96('0x2d')][_0x2a96('0x2e')],function(_0x2d0808){return{'name':_0x2d0808['fieldName'],'type':_0x2d0808[_0x2a96('0x2f')][_0x2a96('0x30')]};});_0x1f8aa9[_0x2a96('0x31')]=_['map'](_0x3e64a,'name');_0x1f8aa9['query']=_[_0x2a96('0x32')](_0x9c8837[_0x2a96('0x33')]);_0x1f8aa9[_0x2a96('0x34')]=_[_0x2a96('0x35')](_0x1f8aa9[_0x2a96('0x31')],_0x1f8aa9[_0x2a96('0x33')]);_0x4a8714[_0x2a96('0x36')]=_[_0x2a96('0x35')](_0x1f8aa9[_0x2a96('0x31')],qs[_0x2a96('0x37')](_0x9c8837[_0x2a96('0x33')][_0x2a96('0x37')]));_0x4a8714['attributes']=_0x4a8714[_0x2a96('0x36')][_0x2a96('0x38')]?_0x4a8714['attributes']:_0x1f8aa9['model'];if(!_0x9c8837[_0x2a96('0x33')]['hasOwnProperty'](_0x2a96('0x39'))){_0x4a8714[_0x2a96('0x21')]=qs[_0x2a96('0x21')](_0x9c8837[_0x2a96('0x33')]['limit']);_0x4a8714['offset']=qs[_0x2a96('0x1e')](_0x9c8837['query'][_0x2a96('0x1e')]);}_0x4a8714['order']=qs[_0x2a96('0x3a')](_0x9c8837[_0x2a96('0x33')][_0x2a96('0x3a')]);_0x4a8714['where']=qs[_0x2a96('0x34')](_[_0x2a96('0x3b')](_0x9c8837[_0x2a96('0x33')],_0x1f8aa9[_0x2a96('0x34')]),_0x3e64a);if(_0x9c8837[_0x2a96('0x33')]['filter']){_0x4a8714[_0x2a96('0x3c')]=_[_0x2a96('0x3d')](_0x4a8714[_0x2a96('0x3c')],{'$or':_['map'](_0x3e64a,function(_0xe5a1fb){if(_0xe5a1fb[_0x2a96('0x2f')]!==_0x2a96('0x3e')){var _0x283a94={};_0x283a94[_0xe5a1fb[_0x2a96('0x29')]]={'$like':'%'+_0x9c8837[_0x2a96('0x33')][_0x2a96('0x3f')]+'%'};return _0x283a94;}})});}_0x4a8714=_[_0x2a96('0x3d')]({},_0x4a8714,_0x9c8837[_0x2a96('0x40')]);var _0x8271ff={'where':_0x4a8714[_0x2a96('0x3c')]};return db[_0x2a96('0x2d')][_0x2a96('0x20')](_0x8271ff)['then'](function(_0x2e919a){_0x527169[_0x2a96('0x20')]=_0x2e919a;if(_0x9c8837[_0x2a96('0x33')][_0x2a96('0x41')]){_0x4a8714[_0x2a96('0x42')]=[{'all':!![]}];}return db['Automation']['findAll'](_0x4a8714);})[_0x2a96('0x26')](function(_0x34f8ce){_0x527169[_0x2a96('0x43')]=_0x34f8ce;return _0x527169;})[_0x2a96('0x26')](respondWithFilteredResult(_0x5eba69,_0x4a8714))['catch'](handleError(_0x5eba69,null));};exports[_0x2a96('0x44')]=function(_0x51194b,_0xee3d0a){var _0x555b07={'raw':![],'where':{'id':_0x51194b[_0x2a96('0x45')]['id']}},_0x4a15ec={};_0x4a15ec['model']=_[_0x2a96('0x32')](db[_0x2a96('0x2d')][_0x2a96('0x2e')]);_0x4a15ec[_0x2a96('0x33')]=_['keys'](_0x51194b[_0x2a96('0x33')]);_0x4a15ec[_0x2a96('0x34')]=_[_0x2a96('0x35')](_0x4a15ec[_0x2a96('0x31')],_0x4a15ec[_0x2a96('0x33')]);_0x555b07[_0x2a96('0x36')]=_[_0x2a96('0x35')](_0x4a15ec[_0x2a96('0x31')],qs['fields'](_0x51194b[_0x2a96('0x33')]['fields']));_0x555b07[_0x2a96('0x36')]=_0x555b07[_0x2a96('0x36')][_0x2a96('0x38')]?_0x555b07['attributes']:_0x4a15ec[_0x2a96('0x31')];if(_0x51194b['query']['includeAll']){_0x555b07[_0x2a96('0x42')]=[{'all':!![]}];}_0x555b07=_[_0x2a96('0x3d')]({},_0x555b07,_0x51194b[_0x2a96('0x40')]);return db[_0x2a96('0x2d')][_0x2a96('0x46')](_0x555b07)['then'](handleEntityNotFound(_0xee3d0a,null))[_0x2a96('0x26')](respondWithResult(_0xee3d0a,null))['catch'](handleError(_0xee3d0a,null));};exports[_0x2a96('0x47')]=function(_0x1329f1,_0x1880b9){return db[_0x2a96('0x2d')][_0x2a96('0x47')](_0x1329f1[_0x2a96('0x48')],{})[_0x2a96('0x26')](respondWithResult(_0x1880b9,0xc9))['catch'](handleError(_0x1880b9,null));};exports[_0x2a96('0x49')]=function(_0x570936,_0x2083b4){if(_0x570936['body']['id']){delete _0x570936['body']['id'];}return db[_0x2a96('0x2d')][_0x2a96('0x46')]({'where':{'id':_0x570936[_0x2a96('0x45')]['id']}})['then'](handleEntityNotFound(_0x2083b4,null))['then'](saveUpdates(_0x570936[_0x2a96('0x48')],null))[_0x2a96('0x26')](respondWithResult(_0x2083b4,null))[_0x2a96('0x4a')](handleError(_0x2083b4,null));};exports[_0x2a96('0x25')]=function(_0x2334c2,_0x3790b3){return db[_0x2a96('0x2d')][_0x2a96('0x46')]({'where':{'id':_0x2334c2[_0x2a96('0x45')]['id']}})[_0x2a96('0x26')](handleEntityNotFound(_0x3790b3,null))[_0x2a96('0x26')](removeEntity(_0x3790b3,null))[_0x2a96('0x4a')](handleError(_0x3790b3,null));};exports['addConditions']=function(_0x5df062,_0x587ee0,_0xc1ffd){return db[_0x2a96('0x4b')][_0x2a96('0x46')]({'where':{'id':_0x5df062[_0x2a96('0x45')]['id']}})[_0x2a96('0x26')](handleEntityNotFound(_0x587ee0,null))[_0x2a96('0x26')](function(_0x407715){if(_0x407715){return _0x407715['addConditions'](_0x5df062['body'][_0x2a96('0x4c')],_[_0x2a96('0x4d')](_0x5df062[_0x2a96('0x48')],['ids','id'])||{});}})[_0x2a96('0x26')](respondWithResult(_0x587ee0,null))[_0x2a96('0x4a')](handleError(_0x587ee0,null));};exports[_0x2a96('0x4e')]=function(_0x18eda3,_0x43727c,_0x22ad75){var _0x2df0fa={};var _0x45aef2={};var _0x2bfcfd;var _0x4e6e3e;return db[_0x2a96('0x2d')]['findOne']({'where':{'id':_0x18eda3[_0x2a96('0x45')]['id']}})[_0x2a96('0x26')](handleEntityNotFound(_0x43727c,null))[_0x2a96('0x26')](function(_0x5641e5){if(_0x5641e5){_0x2bfcfd=_0x5641e5;_0x45aef2[_0x2a96('0x31')]=_[_0x2a96('0x32')](db[_0x2a96('0x4b')][_0x2a96('0x2e')]);_0x45aef2[_0x2a96('0x33')]=_[_0x2a96('0x32')](_0x18eda3[_0x2a96('0x33')]);_0x45aef2[_0x2a96('0x34')]=_[_0x2a96('0x35')](_0x45aef2['model'],_0x45aef2[_0x2a96('0x33')]);_0x2df0fa[_0x2a96('0x36')]=_['intersection'](_0x45aef2[_0x2a96('0x31')],qs[_0x2a96('0x37')](_0x18eda3[_0x2a96('0x33')][_0x2a96('0x37')]));_0x2df0fa[_0x2a96('0x36')]=_0x2df0fa['attributes']['length']?_0x2df0fa[_0x2a96('0x36')]:_0x45aef2[_0x2a96('0x31')];_0x2df0fa[_0x2a96('0x4f')]=qs[_0x2a96('0x3a')](_0x18eda3[_0x2a96('0x33')][_0x2a96('0x3a')]);_0x2df0fa[_0x2a96('0x3c')]=qs[_0x2a96('0x34')](_[_0x2a96('0x3b')](_0x18eda3[_0x2a96('0x33')],_0x45aef2[_0x2a96('0x34')]));if(_0x18eda3[_0x2a96('0x33')][_0x2a96('0x3f')]){_0x2df0fa[_0x2a96('0x3c')]=_[_0x2a96('0x3d')](_0x2df0fa[_0x2a96('0x3c')],{'$or':_[_0x2a96('0x2c')](_0x2df0fa[_0x2a96('0x36')],function(_0x3c45aa){var _0x4886b6={};_0x4886b6[_0x3c45aa]={'$like':'%'+_0x18eda3[_0x2a96('0x33')]['filter']+'%'};return _0x4886b6;})});}_0x2df0fa=_[_0x2a96('0x3d')]({},_0x2df0fa,_0x18eda3[_0x2a96('0x40')]);return _0x2bfcfd[_0x2a96('0x4e')](_0x2df0fa);}})[_0x2a96('0x26')](function(_0x338d65){if(_0x338d65){_0x4e6e3e=_0x338d65['length'];if(!_0x18eda3[_0x2a96('0x33')][_0x2a96('0x50')](_0x2a96('0x39'))){_0x2df0fa[_0x2a96('0x21')]=qs['limit'](_0x18eda3[_0x2a96('0x33')]['limit']);_0x2df0fa[_0x2a96('0x1e')]=qs['offset'](_0x18eda3[_0x2a96('0x33')][_0x2a96('0x1e')]);}return _0x2bfcfd['getConditions'](_0x2df0fa);}})[_0x2a96('0x26')](function(_0x4e1fe2){if(_0x4e1fe2){return _0x4e1fe2?{'count':_0x4e6e3e,'rows':_0x4e1fe2}:null;}})[_0x2a96('0x26')](respondWithResult(_0x43727c,null))[_0x2a96('0x4a')](handleError(_0x43727c,null));};exports['addActions']=function(_0x189245,_0x31fc49,_0x4eb0d6){return db[_0x2a96('0x51')][_0x2a96('0x46')]({'where':{'id':_0x189245['params']['id']}})['then'](handleEntityNotFound(_0x31fc49,null))['then'](function(_0x46a1a4){if(_0x46a1a4){return _0x46a1a4[_0x2a96('0x52')](_0x189245[_0x2a96('0x48')][_0x2a96('0x4c')],_[_0x2a96('0x4d')](_0x189245[_0x2a96('0x48')],[_0x2a96('0x4c'),'id'])||{});}})[_0x2a96('0x26')](respondWithResult(_0x31fc49,null))[_0x2a96('0x4a')](handleError(_0x31fc49,null));};exports[_0x2a96('0x53')]=function(_0x284b44,_0x5a66d8,_0x356ae2){var _0x47b0b5={};var _0x83ce35={};var _0x362c62;var _0x787b04;return db[_0x2a96('0x2d')]['findOne']({'where':{'id':_0x284b44[_0x2a96('0x45')]['id']}})[_0x2a96('0x26')](handleEntityNotFound(_0x5a66d8,null))[_0x2a96('0x26')](function(_0x48329c){if(_0x48329c){_0x362c62=_0x48329c;_0x83ce35[_0x2a96('0x31')]=_[_0x2a96('0x32')](db[_0x2a96('0x51')][_0x2a96('0x2e')]);_0x83ce35[_0x2a96('0x33')]=_['keys'](_0x284b44['query']);_0x83ce35[_0x2a96('0x34')]=_[_0x2a96('0x35')](_0x83ce35['model'],_0x83ce35[_0x2a96('0x33')]);_0x47b0b5['attributes']=_[_0x2a96('0x35')](_0x83ce35[_0x2a96('0x31')],qs['fields'](_0x284b44[_0x2a96('0x33')][_0x2a96('0x37')]));_0x47b0b5[_0x2a96('0x36')]=_0x47b0b5[_0x2a96('0x36')][_0x2a96('0x38')]?_0x47b0b5['attributes']:_0x83ce35[_0x2a96('0x31')];_0x47b0b5[_0x2a96('0x4f')]=qs[_0x2a96('0x3a')](_0x284b44[_0x2a96('0x33')][_0x2a96('0x3a')]);_0x47b0b5[_0x2a96('0x3c')]=qs[_0x2a96('0x34')](_[_0x2a96('0x3b')](_0x284b44[_0x2a96('0x33')],_0x83ce35[_0x2a96('0x34')]));if(_0x284b44['query'][_0x2a96('0x3f')]){_0x47b0b5[_0x2a96('0x3c')]=_[_0x2a96('0x3d')](_0x47b0b5['where'],{'$or':_[_0x2a96('0x2c')](_0x47b0b5[_0x2a96('0x36')],function(_0x1f2fb4){var _0x5ba16f={};_0x5ba16f[_0x1f2fb4]={'$like':'%'+_0x284b44[_0x2a96('0x33')][_0x2a96('0x3f')]+'%'};return _0x5ba16f;})});}_0x47b0b5=_['merge']({},_0x47b0b5,_0x284b44[_0x2a96('0x40')]);return _0x362c62['getActions'](_0x47b0b5);}})[_0x2a96('0x26')](function(_0x5d3056){if(_0x5d3056){_0x787b04=_0x5d3056[_0x2a96('0x38')];if(!_0x284b44['query'][_0x2a96('0x50')](_0x2a96('0x39'))){_0x47b0b5[_0x2a96('0x21')]=qs[_0x2a96('0x21')](_0x284b44[_0x2a96('0x33')][_0x2a96('0x21')]);_0x47b0b5[_0x2a96('0x1e')]=qs[_0x2a96('0x1e')](_0x284b44[_0x2a96('0x33')]['offset']);}return _0x362c62[_0x2a96('0x53')](_0x47b0b5);}})[_0x2a96('0x26')](function(_0x3e14f8){if(_0x3e14f8){return _0x3e14f8?{'count':_0x787b04,'rows':_0x3e14f8}:null;}})[_0x2a96('0x26')](respondWithResult(_0x5a66d8,null))[_0x2a96('0x4a')](handleError(_0x5a66d8,null));}; \ No newline at end of file +var _0x0114=['rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','catch','show','params','keys','find','create','body','destroy','ids','omit','findOne','Condition','length','merge','getConditions','addActions','getActions','Action','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','stack','name','send','index','map','Automation'];(function(_0x1fdd46,_0x34c119){var _0x57be2c=function(_0x410cf1){while(--_0x410cf1){_0x1fdd46['push'](_0x1fdd46['shift']());}};_0x57be2c(++_0x34c119);}(_0x0114,0x123));var _0x4011=function(_0x12c5a0,_0x25107b){_0x12c5a0=_0x12c5a0-0x0;var _0x1294ca=_0x0114[_0x12c5a0];return _0x1294ca;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4011('0x0'));var jsonpatch=require(_0x4011('0x1'));var rp=require(_0x4011('0x2'));var moment=require(_0x4011('0x3'));var BPromise=require(_0x4011('0x4'));var Mustache=require(_0x4011('0x5'));var util=require(_0x4011('0x6'));var path=require(_0x4011('0x7'));var sox=require(_0x4011('0x8'));var csv=require('to-csv');var ejs=require(_0x4011('0x9'));var fs=require('fs');var fs_extra=require(_0x4011('0xa'));var _=require('lodash');var squel=require(_0x4011('0xb'));var crypto=require(_0x4011('0xc'));var jsforce=require(_0x4011('0xd'));var deskjs=require(_0x4011('0xe'));var toCsv=require(_0x4011('0xf'));var querystring=require(_0x4011('0x10'));var Papa=require(_0x4011('0x11'));var Redis=require('ioredis');var authService=require(_0x4011('0x12'));var qs=require(_0x4011('0x13'));var as=require(_0x4011('0x14'));var hardwareService=require(_0x4011('0x15'));var logger=require('../../config/logger')(_0x4011('0x16'));var utils=require(_0x4011('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4011('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xefde0e,_0x5907d2){_0x5907d2=_0x5907d2||0xcc;return function(_0x151e31){if(_0x151e31){return _0xefde0e[_0x4011('0x19')](_0x5907d2);}return _0xefde0e['status'](_0x5907d2)[_0x4011('0x1a')]();};}function respondWithResult(_0x1f6236,_0x28adb9){_0x28adb9=_0x28adb9||0xc8;return function(_0x2c52d2){if(_0x2c52d2){return _0x1f6236[_0x4011('0x1b')](_0x28adb9)[_0x4011('0x1c')](_0x2c52d2);}};}function respondWithFilteredResult(_0x47d4e0,_0x39ce4f){return function(_0x48e527){if(_0x48e527){var _0x138d69=typeof _0x39ce4f[_0x4011('0x1d')]===_0x4011('0x1e')&&typeof _0x39ce4f[_0x4011('0x1f')]==='undefined';var _0x3fbc59=_0x48e527[_0x4011('0x20')];var _0x4a964a=_0x138d69?0x0:_0x39ce4f[_0x4011('0x1d')];var _0x21b4fa=_0x138d69?_0x48e527['count']:_0x39ce4f['offset']+_0x39ce4f[_0x4011('0x1f')];var _0x5de56f;if(_0x21b4fa>=_0x3fbc59){_0x21b4fa=_0x3fbc59;_0x5de56f=0xc8;}else{_0x5de56f=0xce;}_0x47d4e0[_0x4011('0x1b')](_0x5de56f);return _0x47d4e0[_0x4011('0x21')](_0x4011('0x22'),_0x4a964a+'-'+_0x21b4fa+'/'+_0x3fbc59)[_0x4011('0x1c')](_0x48e527);}return null;};}function patchUpdates(_0x51ea34){return function(_0x539995){try{jsonpatch['apply'](_0x539995,_0x51ea34,!![]);}catch(_0xc4ab71){return BPromise['reject'](_0xc4ab71);}return _0x539995[_0x4011('0x23')]();};}function saveUpdates(_0x299d27,_0x5704cd){return function(_0x4db159){if(_0x4db159){return _0x4db159[_0x4011('0x24')](_0x299d27)[_0x4011('0x25')](function(_0x296786){return _0x296786;});}return null;};}function removeEntity(_0x1fa899,_0x23f1dc){return function(_0x4cbf63){if(_0x4cbf63){return _0x4cbf63['destroy']()[_0x4011('0x25')](function(){_0x1fa899['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13fb35,_0x5c07da){return function(_0x50194c){if(!_0x50194c){_0x13fb35[_0x4011('0x19')](0x194);}return _0x50194c;};}function handleError(_0x188332,_0x370672){_0x370672=_0x370672||0x1f4;return function(_0x1e7aa5){logger[_0x4011('0x26')](_0x1e7aa5[_0x4011('0x27')]);if(_0x1e7aa5[_0x4011('0x28')]){delete _0x1e7aa5[_0x4011('0x28')];}_0x188332[_0x4011('0x1b')](_0x370672)[_0x4011('0x29')](_0x1e7aa5);};}exports[_0x4011('0x2a')]=function(_0x4c40fb,_0x34e1f0){var _0x375eec={},_0x533987={},_0x413319={'count':0x0,'rows':[]};var _0x33b090=_[_0x4011('0x2b')](db[_0x4011('0x2c')][_0x4011('0x2d')],function(_0x43a564){return{'name':_0x43a564[_0x4011('0x2e')],'type':_0x43a564[_0x4011('0x2f')][_0x4011('0x30')]};});_0x533987[_0x4011('0x31')]=_['map'](_0x33b090,'name');_0x533987[_0x4011('0x32')]=_['keys'](_0x4c40fb[_0x4011('0x32')]);_0x533987[_0x4011('0x33')]=_[_0x4011('0x34')](_0x533987[_0x4011('0x31')],_0x533987[_0x4011('0x32')]);_0x375eec['attributes']=_['intersection'](_0x533987[_0x4011('0x31')],qs['fields'](_0x4c40fb[_0x4011('0x32')][_0x4011('0x35')]));_0x375eec[_0x4011('0x36')]=_0x375eec[_0x4011('0x36')]['length']?_0x375eec[_0x4011('0x36')]:_0x533987[_0x4011('0x31')];if(!_0x4c40fb[_0x4011('0x32')][_0x4011('0x37')](_0x4011('0x38'))){_0x375eec[_0x4011('0x1f')]=qs[_0x4011('0x1f')](_0x4c40fb[_0x4011('0x32')]['limit']);_0x375eec[_0x4011('0x1d')]=qs['offset'](_0x4c40fb['query']['offset']);}_0x375eec[_0x4011('0x39')]=qs[_0x4011('0x3a')](_0x4c40fb[_0x4011('0x32')][_0x4011('0x3a')]);_0x375eec[_0x4011('0x3b')]=qs[_0x4011('0x33')](_[_0x4011('0x3c')](_0x4c40fb[_0x4011('0x32')],_0x533987['filters']),_0x33b090);if(_0x4c40fb[_0x4011('0x32')]['filter']){_0x375eec['where']=_['merge'](_0x375eec[_0x4011('0x3b')],{'$or':_[_0x4011('0x2b')](_0x33b090,function(_0x164577){if(_0x164577[_0x4011('0x2f')]!==_0x4011('0x3d')){var _0x1a6b56={};_0x1a6b56[_0x164577[_0x4011('0x28')]]={'$like':'%'+_0x4c40fb[_0x4011('0x32')][_0x4011('0x3e')]+'%'};return _0x1a6b56;}})});}_0x375eec=_['merge']({},_0x375eec,_0x4c40fb[_0x4011('0x3f')]);var _0x11af2c={'where':_0x375eec[_0x4011('0x3b')]};return db[_0x4011('0x2c')][_0x4011('0x20')](_0x11af2c)['then'](function(_0x2449b2){_0x413319['count']=_0x2449b2;if(_0x4c40fb[_0x4011('0x32')][_0x4011('0x40')]){_0x375eec[_0x4011('0x41')]=[{'all':!![]}];}return db[_0x4011('0x2c')]['findAll'](_0x375eec);})[_0x4011('0x25')](function(_0x7f36dc){_0x413319['rows']=_0x7f36dc;return _0x413319;})[_0x4011('0x25')](respondWithFilteredResult(_0x34e1f0,_0x375eec))[_0x4011('0x42')](handleError(_0x34e1f0,null));};exports[_0x4011('0x43')]=function(_0x4215c4,_0x21974d){var _0x2f40a3={'raw':![],'where':{'id':_0x4215c4[_0x4011('0x44')]['id']}},_0x437b3f={};_0x437b3f[_0x4011('0x31')]=_['keys'](db['Automation']['rawAttributes']);_0x437b3f[_0x4011('0x32')]=_[_0x4011('0x45')](_0x4215c4[_0x4011('0x32')]);_0x437b3f[_0x4011('0x33')]=_['intersection'](_0x437b3f[_0x4011('0x31')],_0x437b3f[_0x4011('0x32')]);_0x2f40a3[_0x4011('0x36')]=_[_0x4011('0x34')](_0x437b3f[_0x4011('0x31')],qs[_0x4011('0x35')](_0x4215c4[_0x4011('0x32')][_0x4011('0x35')]));_0x2f40a3[_0x4011('0x36')]=_0x2f40a3[_0x4011('0x36')]['length']?_0x2f40a3[_0x4011('0x36')]:_0x437b3f[_0x4011('0x31')];if(_0x4215c4[_0x4011('0x32')]['includeAll']){_0x2f40a3[_0x4011('0x41')]=[{'all':!![]}];}_0x2f40a3=_['merge']({},_0x2f40a3,_0x4215c4[_0x4011('0x3f')]);return db[_0x4011('0x2c')][_0x4011('0x46')](_0x2f40a3)['then'](handleEntityNotFound(_0x21974d,null))[_0x4011('0x25')](respondWithResult(_0x21974d,null))[_0x4011('0x42')](handleError(_0x21974d,null));};exports['create']=function(_0x5ee1a2,_0x3c17c4){return db[_0x4011('0x2c')][_0x4011('0x47')](_0x5ee1a2['body'],{})['then'](respondWithResult(_0x3c17c4,0xc9))['catch'](handleError(_0x3c17c4,null));};exports[_0x4011('0x24')]=function(_0x4272b5,_0x28b132){if(_0x4272b5['body']['id']){delete _0x4272b5['body']['id'];}return db[_0x4011('0x2c')]['find']({'where':{'id':_0x4272b5[_0x4011('0x44')]['id']}})[_0x4011('0x25')](handleEntityNotFound(_0x28b132,null))['then'](saveUpdates(_0x4272b5[_0x4011('0x48')],null))[_0x4011('0x25')](respondWithResult(_0x28b132,null))[_0x4011('0x42')](handleError(_0x28b132,null));};exports[_0x4011('0x49')]=function(_0x361408,_0x31e849){return db[_0x4011('0x2c')][_0x4011('0x46')]({'where':{'id':_0x361408['params']['id']}})[_0x4011('0x25')](handleEntityNotFound(_0x31e849,null))[_0x4011('0x25')](removeEntity(_0x31e849,null))[_0x4011('0x42')](handleError(_0x31e849,null));};exports['addConditions']=function(_0xaba9a1,_0x2b4b99,_0x3bfd87){return db['Condition'][_0x4011('0x46')]({'where':{'id':_0xaba9a1[_0x4011('0x44')]['id']}})[_0x4011('0x25')](handleEntityNotFound(_0x2b4b99,null))[_0x4011('0x25')](function(_0x5f38e7){if(_0x5f38e7){return _0x5f38e7['addConditions'](_0xaba9a1[_0x4011('0x48')][_0x4011('0x4a')],_[_0x4011('0x4b')](_0xaba9a1[_0x4011('0x48')],['ids','id'])||{});}})[_0x4011('0x25')](respondWithResult(_0x2b4b99,null))[_0x4011('0x42')](handleError(_0x2b4b99,null));};exports['getConditions']=function(_0xc56a68,_0x6747d4,_0x5c4107){var _0x3c8ac4={};var _0x2d3603={};var _0x20fb81;var _0xf23607;return db['Automation'][_0x4011('0x4c')]({'where':{'id':_0xc56a68['params']['id']}})[_0x4011('0x25')](handleEntityNotFound(_0x6747d4,null))[_0x4011('0x25')](function(_0x5459d4){if(_0x5459d4){_0x20fb81=_0x5459d4;_0x2d3603['model']=_[_0x4011('0x45')](db[_0x4011('0x4d')][_0x4011('0x2d')]);_0x2d3603[_0x4011('0x32')]=_[_0x4011('0x45')](_0xc56a68[_0x4011('0x32')]);_0x2d3603['filters']=_[_0x4011('0x34')](_0x2d3603[_0x4011('0x31')],_0x2d3603[_0x4011('0x32')]);_0x3c8ac4[_0x4011('0x36')]=_[_0x4011('0x34')](_0x2d3603[_0x4011('0x31')],qs[_0x4011('0x35')](_0xc56a68[_0x4011('0x32')][_0x4011('0x35')]));_0x3c8ac4[_0x4011('0x36')]=_0x3c8ac4[_0x4011('0x36')][_0x4011('0x4e')]?_0x3c8ac4['attributes']:_0x2d3603['model'];_0x3c8ac4[_0x4011('0x39')]=qs[_0x4011('0x3a')](_0xc56a68['query']['sort']);_0x3c8ac4[_0x4011('0x3b')]=qs[_0x4011('0x33')](_[_0x4011('0x3c')](_0xc56a68[_0x4011('0x32')],_0x2d3603[_0x4011('0x33')]));if(_0xc56a68['query'][_0x4011('0x3e')]){_0x3c8ac4['where']=_[_0x4011('0x4f')](_0x3c8ac4['where'],{'$or':_['map'](_0x3c8ac4[_0x4011('0x36')],function(_0xd2c17c){var _0x4fbe07={};_0x4fbe07[_0xd2c17c]={'$like':'%'+_0xc56a68['query'][_0x4011('0x3e')]+'%'};return _0x4fbe07;})});}_0x3c8ac4=_[_0x4011('0x4f')]({},_0x3c8ac4,_0xc56a68[_0x4011('0x3f')]);return _0x20fb81[_0x4011('0x50')](_0x3c8ac4);}})[_0x4011('0x25')](function(_0x5e9a17){if(_0x5e9a17){_0xf23607=_0x5e9a17['length'];if(!_0xc56a68['query']['hasOwnProperty'](_0x4011('0x38'))){_0x3c8ac4['limit']=qs[_0x4011('0x1f')](_0xc56a68[_0x4011('0x32')][_0x4011('0x1f')]);_0x3c8ac4['offset']=qs[_0x4011('0x1d')](_0xc56a68[_0x4011('0x32')][_0x4011('0x1d')]);}return _0x20fb81['getConditions'](_0x3c8ac4);}})[_0x4011('0x25')](function(_0x22ca77){if(_0x22ca77){return _0x22ca77?{'count':_0xf23607,'rows':_0x22ca77}:null;}})['then'](respondWithResult(_0x6747d4,null))[_0x4011('0x42')](handleError(_0x6747d4,null));};exports[_0x4011('0x51')]=function(_0x51bdd6,_0x332dac,_0x2d970b){return db['Action'][_0x4011('0x46')]({'where':{'id':_0x51bdd6[_0x4011('0x44')]['id']}})['then'](handleEntityNotFound(_0x332dac,null))['then'](function(_0x5768a9){if(_0x5768a9){return _0x5768a9['addActions'](_0x51bdd6['body'][_0x4011('0x4a')],_[_0x4011('0x4b')](_0x51bdd6[_0x4011('0x48')],[_0x4011('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x332dac,null))[_0x4011('0x42')](handleError(_0x332dac,null));};exports[_0x4011('0x52')]=function(_0x3c9763,_0x370f5d,_0x2ce7f3){var _0xf9614a={};var _0x384a3c={};var _0xd230f;var _0x4b5d1f;return db[_0x4011('0x2c')]['findOne']({'where':{'id':_0x3c9763[_0x4011('0x44')]['id']}})[_0x4011('0x25')](handleEntityNotFound(_0x370f5d,null))['then'](function(_0x2da703){if(_0x2da703){_0xd230f=_0x2da703;_0x384a3c['model']=_[_0x4011('0x45')](db[_0x4011('0x53')][_0x4011('0x2d')]);_0x384a3c[_0x4011('0x32')]=_[_0x4011('0x45')](_0x3c9763['query']);_0x384a3c[_0x4011('0x33')]=_[_0x4011('0x34')](_0x384a3c[_0x4011('0x31')],_0x384a3c[_0x4011('0x32')]);_0xf9614a[_0x4011('0x36')]=_[_0x4011('0x34')](_0x384a3c[_0x4011('0x31')],qs[_0x4011('0x35')](_0x3c9763['query']['fields']));_0xf9614a[_0x4011('0x36')]=_0xf9614a[_0x4011('0x36')][_0x4011('0x4e')]?_0xf9614a['attributes']:_0x384a3c[_0x4011('0x31')];_0xf9614a['order']=qs['sort'](_0x3c9763[_0x4011('0x32')]['sort']);_0xf9614a[_0x4011('0x3b')]=qs[_0x4011('0x33')](_[_0x4011('0x3c')](_0x3c9763[_0x4011('0x32')],_0x384a3c[_0x4011('0x33')]));if(_0x3c9763['query'][_0x4011('0x3e')]){_0xf9614a[_0x4011('0x3b')]=_[_0x4011('0x4f')](_0xf9614a['where'],{'$or':_[_0x4011('0x2b')](_0xf9614a[_0x4011('0x36')],function(_0x162652){var _0x32be54={};_0x32be54[_0x162652]={'$like':'%'+_0x3c9763[_0x4011('0x32')][_0x4011('0x3e')]+'%'};return _0x32be54;})});}_0xf9614a=_[_0x4011('0x4f')]({},_0xf9614a,_0x3c9763['options']);return _0xd230f[_0x4011('0x52')](_0xf9614a);}})['then'](function(_0x56c72e){if(_0x56c72e){_0x4b5d1f=_0x56c72e[_0x4011('0x4e')];if(!_0x3c9763[_0x4011('0x32')][_0x4011('0x37')](_0x4011('0x38'))){_0xf9614a['limit']=qs[_0x4011('0x1f')](_0x3c9763[_0x4011('0x32')][_0x4011('0x1f')]);_0xf9614a[_0x4011('0x1d')]=qs[_0x4011('0x1d')](_0x3c9763[_0x4011('0x32')][_0x4011('0x1d')]);}return _0xd230f['getActions'](_0xf9614a);}})[_0x4011('0x25')](function(_0x1ecc61){if(_0x1ecc61){return _0x1ecc61?{'count':_0x4b5d1f,'rows':_0x1ecc61}:null;}})[_0x4011('0x25')](respondWithResult(_0x370f5d,null))[_0x4011('0x42')](handleError(_0x370f5d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 5be699c..38ac03a 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 _0x8fdb=['exports','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5862e2,_0x1f7ad0){var _0x1640ec=function(_0x2fe79a){while(--_0x2fe79a){_0x5862e2['push'](_0x5862e2['shift']());}};_0x1640ec(++_0x1f7ad0);}(_0x8fdb,0x114));var _0xb8fd=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0x8fdb[_0x25a42a];return _0x1129b1;};'use strict';var _=require(_0xb8fd('0x0'));var util=require(_0xb8fd('0x1'));var logger=require(_0xb8fd('0x2'))(_0xb8fd('0x3'));var moment=require(_0xb8fd('0x4'));var BPromise=require(_0xb8fd('0x5'));var rp=require(_0xb8fd('0x6'));var fs=require('fs');var path=require(_0xb8fd('0x7'));var rimraf=require(_0xb8fd('0x8'));var config=require(_0xb8fd('0x9'));var attributes=require('./automation.attributes');module[_0xb8fd('0xa')]=function(_0xe0445a,_0x33b149){return _0xe0445a['define'](_0xb8fd('0xb'),attributes,{'tableName':_0xb8fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x276c=['lodash','util','api','moment','bluebird','path','rimraf','./automation.attributes','exports','define','tools_automations'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0x276c,0x155));var _0xc276=function(_0x11f44e,_0x5b1c53){_0x11f44e=_0x11f44e-0x0;var _0x48b461=_0x276c[_0x11f44e];return _0x48b461;};'use strict';var _=require(_0xc276('0x0'));var util=require(_0xc276('0x1'));var logger=require('../../config/logger')(_0xc276('0x2'));var moment=require(_0xc276('0x3'));var BPromise=require(_0xc276('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc276('0x5'));var rimraf=require(_0xc276('0x6'));var config=require('../../config/environment');var attributes=require(_0xc276('0x7'));module[_0xc276('0x8')]=function(_0x39de9b,_0x57e69d){return _0x39de9b[_0xc276('0x9')]('Automation',attributes,{'tableName':_0xc276('0xa'),'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 cdcaa1c..f2861c3 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 _0xf4c9=['Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','Automation,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xf4c9[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x9f4c('0x0'));var util=require(_0x9f4c('0x1'));var moment=require(_0x9f4c('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f4c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f4c('0x4'))['db'];var utils=require(_0x9f4c('0x5'));var logger=require(_0x9f4c('0x6'))('rpc');var config=require(_0x9f4c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9f4c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cf322,_0x498795,_0x12aeb7){return new BPromise(function(_0x398b30,_0x72c8ea){return client[_0x9f4c('0x9')](_0x5cf322,_0x12aeb7)[_0x9f4c('0xa')](function(_0x37b693){logger['info'](_0x9f4c('0xb'),_0x498795,_0x9f4c('0xc'));logger[_0x9f4c('0xd')](_0x9f4c('0xe'),_0x498795,_0x9f4c('0xc'),JSON[_0x9f4c('0xf')](_0x37b693));if(_0x37b693[_0x9f4c('0x10')]){if(_0x37b693[_0x9f4c('0x10')]['code']===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x498795,_0x37b693[_0x9f4c('0x10')]['message']);return _0x72c8ea(_0x37b693['error'][_0x9f4c('0x11')]);}logger['error']('Automation,\x20%s,\x20%s',_0x498795,_0x37b693[_0x9f4c('0x10')]['message']);return _0x398b30(_0x37b693['error'][_0x9f4c('0x11')]);}else{logger['info'](_0x9f4c('0xb'),_0x498795,_0x9f4c('0xc'));_0x398b30(_0x37b693[_0x9f4c('0x12')][_0x9f4c('0x11')]);}})[_0x9f4c('0x13')](function(_0xb61bdf){logger['error'](_0x9f4c('0xb'),_0x498795,_0xb61bdf);_0x72c8ea(_0xb61bdf);});});} \ No newline at end of file +var _0xb03e=['debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Automation,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb03e,0x1eb));var _0xeb03=function(_0x534f83,_0x7bbb9b){_0x534f83=_0x534f83-0x0;var _0x4e6dbc=_0xb03e[_0x534f83];return _0x4e6dbc;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var moment=require(_0xeb03('0x1'));var BPromise=require(_0xeb03('0x2'));var rs=require(_0xeb03('0x3'));var fs=require('fs');var Redis=require(_0xeb03('0x4'));var db=require(_0xeb03('0x5'))['db'];var utils=require(_0xeb03('0x6'));var logger=require(_0xeb03('0x7'))(_0xeb03('0x8'));var config=require(_0xeb03('0x9'));var jayson=require(_0xeb03('0xa'));var client=jayson[_0xeb03('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b58a2,_0x3d3322,_0x3a6e31){return new BPromise(function(_0x246c6e,_0x3f2c74){return client[_0xeb03('0xc')](_0x3b58a2,_0x3a6e31)['then'](function(_0x403b77){logger[_0xeb03('0xd')](_0xeb03('0xe'),_0x3d3322,'request\x20sent');logger[_0xeb03('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x3d3322,_0xeb03('0x10'),JSON[_0xeb03('0x11')](_0x403b77));if(_0x403b77[_0xeb03('0x12')]){if(_0x403b77[_0xeb03('0x12')][_0xeb03('0x13')]===0x1f4){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x3f2c74(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}logger[_0xeb03('0x12')]('Automation,\x20%s,\x20%s',_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x246c6e(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}else{logger['info'](_0xeb03('0xe'),_0x3d3322,_0xeb03('0x10'));_0x246c6e(_0x403b77[_0xeb03('0x15')]['message']);}})[_0xeb03('0x16')](function(_0x46dd1b){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x46dd1b);_0x3f2c74(_0x46dd1b);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 6f915a4..910907a 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 _0xcb26=['/:id/actions','getActions','create','post','addConditions','addActions','put','/:id','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./automation.controller','get','isAuthenticated','index','show','/:id/conditions'];(function(_0x3ccbac,_0x52df96){var _0x464030=function(_0x3f8137){while(--_0x3f8137){_0x3ccbac['push'](_0x3ccbac['shift']());}};_0x464030(++_0x52df96);}(_0xcb26,0x14c));var _0x6cb2=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xcb26[_0x4c440b];return _0x2d48cf;};'use strict';var multer=require('multer');var util=require(_0x6cb2('0x0'));var path=require(_0x6cb2('0x1'));var timeout=require(_0x6cb2('0x2'));var express=require(_0x6cb2('0x3'));var router=express[_0x6cb2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6cb2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6cb2('0x6'));var controller=require(_0x6cb2('0x7'));router[_0x6cb2('0x8')]('/',auth[_0x6cb2('0x9')](),controller[_0x6cb2('0xa')]);router[_0x6cb2('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6cb2('0xb')]);router[_0x6cb2('0x8')](_0x6cb2('0xc'),auth[_0x6cb2('0x9')](),controller['getConditions']);router[_0x6cb2('0x8')](_0x6cb2('0xd'),auth[_0x6cb2('0x9')](),controller[_0x6cb2('0xe')]);router['post']('/',auth[_0x6cb2('0x9')](),controller[_0x6cb2('0xf')]);router[_0x6cb2('0x10')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x6cb2('0x11')]);router[_0x6cb2('0x10')]('/:id/actions',auth['isAuthenticated'](),controller[_0x6cb2('0x12')]);router[_0x6cb2('0x13')](_0x6cb2('0x14'),auth[_0x6cb2('0x9')](),controller['update']);router[_0x6cb2('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x6cb2('0x16')]);module['exports']=router; \ No newline at end of file +var _0x2bdb=['post','create','addConditions','put','update','delete','/:id','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id/conditions','getConditions','/:id/actions','getActions'];(function(_0x4fb2bf,_0x20e31d){var _0xaae939=function(_0x565c07){while(--_0x565c07){_0x4fb2bf['push'](_0x4fb2bf['shift']());}};_0xaae939(++_0x20e31d);}(_0x2bdb,0x105));var _0xb2bd=function(_0xb7acca,_0x15a520){_0xb7acca=_0xb7acca-0x0;var _0x176c7a=_0x2bdb[_0xb7acca];return _0x176c7a;};'use strict';var multer=require(_0xb2bd('0x0'));var util=require('util');var path=require(_0xb2bd('0x1'));var timeout=require('connect-timeout');var express=require(_0xb2bd('0x2'));var router=express[_0xb2bd('0x3')]();var fs_extra=require(_0xb2bd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb2bd('0x5'));var config=require(_0xb2bd('0x6'));var controller=require(_0xb2bd('0x7'));router[_0xb2bd('0x8')]('/',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xa')]);router[_0xb2bd('0x8')]('/:id',auth[_0xb2bd('0x9')](),controller['show']);router[_0xb2bd('0x8')](_0xb2bd('0xb'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xc')]);router[_0xb2bd('0x8')](_0xb2bd('0xd'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xe')]);router[_0xb2bd('0xf')]('/',auth['isAuthenticated'](),controller[_0xb2bd('0x10')]);router[_0xb2bd('0xf')](_0xb2bd('0xb'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0x11')]);router[_0xb2bd('0xf')](_0xb2bd('0xd'),auth[_0xb2bd('0x9')](),controller['addActions']);router[_0xb2bd('0x12')]('/:id',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0x13')]);router[_0xb2bd('0x14')](_0xb2bd('0x15'),auth[_0xb2bd('0x9')](),controller['destroy']);module[_0xb2bd('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index dd9b22c..0eca431 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 _0x6e53=['07:00-22:00,*,*,*','ENUM','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#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)'];(function(_0x332fee,_0x102ac2){var _0x5acd7b=function(_0x15852c){while(--_0x15852c){_0x332fee['push'](_0x332fee['shift']());}};_0x5acd7b(++_0x102ac2);}(_0x6e53,0x101));var _0x36e5=function(_0x2b9607,_0x3b5e1d){_0x2b9607=_0x2b9607-0x0;var _0x3044eb=_0x6e53[_0x2b9607];return _0x3044eb;};'use strict';var Sequelize=require('sequelize');module[_0x36e5('0x0')]={'name':{'type':Sequelize[_0x36e5('0x1')],'unique':_0x36e5('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x36e5('0x3')),'allowNull':![],'defaultValue':_0x36e5('0x3')},'description':{'type':Sequelize[_0x36e5('0x1')]},'active':{'type':Sequelize[_0x36e5('0x4')],'defaultValue':0x0,'comment':_0x36e5('0x5')},'limitCalls':{'type':Sequelize[_0x36e5('0x6')](0x4)[_0x36e5('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x36e5('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x36e5('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x36e5('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36e5('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x36e5('0x6')](0x3)[_0x36e5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36e5('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x36e5('0x6')](0x5)[_0x36e5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x36e5('0x6')](0x3)[_0x36e5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36e5('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x36e5('0x6')](0x5)[_0x36e5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36e5('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x36e5('0x6')](0x3)[_0x36e5('0x7')],'defaultValue':0x3,'comment':_0x36e5('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36e5('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x36e5('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x36e5('0xf')},'dialTimezone':{'type':Sequelize[_0x36e5('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x36e5('0x1')],'defaultValue':_0x36e5('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x36e5('0x11')](_0x36e5('0x12'),'never',_0x36e5('0x13')),'defaultValue':_0x36e5('0x12')},'dialAMDActive':{'type':Sequelize[_0x36e5('0x4')],'defaultValue':0x0,'comment':_0x36e5('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x36e5('0x6')](0x9)[_0x36e5('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x36e5('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x36e5('0x6')](0x9)[_0x36e5('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x36e5('0x6')](0x9)[_0x36e5('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x36e5('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x36e5('0x6')](0x9)[_0x36e5('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x36e5('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x36e5('0x6')](0x9)[_0x36e5('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x36e5('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x36e5('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x36e5('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x36e5('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x36e5('0x6')](0x9)[_0x36e5('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x36e5('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x36e5('0x11')](_0x36e5('0x1b'),_0x36e5('0x1c')),'defaultValue':_0x36e5('0x1b')},'dialPrefix':{'type':Sequelize[_0x36e5('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x36e5('0x6')](0x3)[_0x36e5('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x36e5('0x1d')},'dialCutDigit':{'type':Sequelize[_0x36e5('0x6')](0x3)[_0x36e5('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x36e5('0x6')](0x3)[_0x36e5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36e5('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x36e5('0x6')](0x5)[_0x36e5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36e5('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x36e5('0x6')](0x3)[_0x36e5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36e5('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x36e5('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36e5('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x36e5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36e5('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x36e5('0x6')](0x5)[_0x36e5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36e5('0x23')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x36e5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x36e5('0x6')](0x5)[_0x36e5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36e5('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x36e5('0x6')](0x3)[_0x36e5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x36e5('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x36e5('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x36e5('0x26')}}; \ No newline at end of file +var _0x429a=['#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','Random\x20Last\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','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED'];(function(_0x1d3446,_0x263cd4){var _0x67032=function(_0xa1c866){while(--_0xa1c866){_0x1d3446['push'](_0x1d3446['shift']());}};_0x67032(++_0x263cd4);}(_0x429a,0x116));var _0xa429=function(_0x23ca4d,_0x5c2a32){_0x23ca4d=_0x23ca4d-0x0;var _0x435432=_0x429a[_0x23ca4d];return _0x435432;};'use strict';var Sequelize=require(_0xa429('0x0'));module[_0xa429('0x1')]={'name':{'type':Sequelize[_0xa429('0x2')],'unique':_0xa429('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xa429('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xa429('0x2')]},'active':{'type':Sequelize[_0xa429('0x5')],'defaultValue':0x0,'comment':_0xa429('0x6')},'limitCalls':{'type':Sequelize[_0xa429('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xa429('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xa429('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xa429('0x7')](0x3)[_0xa429('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa429('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa429('0x7')](0x5)[_0xa429('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa429('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xa429('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xa429('0x7')](0x5)[_0xa429('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa429('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa429('0x7')](0x3)[_0xa429('0x9')],'defaultValue':0x3,'comment':_0xa429('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa429('0x7')](0x5)[_0xa429('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa429('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa429('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa429('0xf')},'dialTimezone':{'type':Sequelize[_0xa429('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa429('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xa429('0x10')](_0xa429('0x11'),'never',_0xa429('0x12')),'defaultValue':_0xa429('0x11')},'dialAMDActive':{'type':Sequelize[_0xa429('0x5')],'defaultValue':0x0,'comment':_0xa429('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xa429('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa429('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xa429('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa429('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa429('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa429('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xa429('0x7')](0x9)[_0xa429('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa429('0x7')](0x9)[_0xa429('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa429('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa429('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa429('0x7')](0x5)[_0xa429('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa429('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa429('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xa429('0x10')]('DESC','ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xa429('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa429('0x7')](0x3)[_0xa429('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa429('0x1a')},'dialCutDigit':{'type':Sequelize[_0xa429('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa429('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa429('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa429('0x7')](0x5)[_0xa429('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa429('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0xa429('0x7')](0x5)[_0xa429('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa429('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa429('0x7')](0x3)[_0xa429('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa429('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa429('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa429('0x1f')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa429('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa429('0x7')](0x5)[_0xa429('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa429('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa429('0x7')](0x3)[_0xa429('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa429('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa429('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa429('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 89cf4b5..689252e 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 _0x545a=['querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','save','update','destroy','then','UserProfileResource','end','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','clone','omit','createdAt','updatedAt','body','IvrCampaigns','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','hasOwnProperty','rows','getHopperHistories','CmHopperHistory','CampaignId','findOne','CmHopperFinal','pick','CmHopperBlack','getLists','CmList','addLists','ids','dialCheckDuplicateType','always','insert','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','into','fromQuery','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','deletedAt\x20IS\x20NULL','removeBlackLists','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x2e6082,_0x3bff90){var _0x548ac8=function(_0x30f1b2){while(--_0x30f1b2){_0x2e6082['push'](_0x2e6082['shift']());}};_0x548ac8(++_0x3bff90);}(_0x545a,0xf7));var _0xa545=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x545a[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require(_0xa545('0x0'));var rimraf=require(_0xa545('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa545('0x2'));var BPromise=require(_0xa545('0x3'));var Mustache=require(_0xa545('0x4'));var util=require(_0xa545('0x5'));var path=require(_0xa545('0x6'));var sox=require(_0xa545('0x7'));var csv=require(_0xa545('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa545('0x9'));var _=require(_0xa545('0xa'));var squel=require(_0xa545('0xb'));var crypto=require(_0xa545('0xc'));var jsforce=require(_0xa545('0xd'));var deskjs=require(_0xa545('0xe'));var toCsv=require(_0xa545('0x8'));var querystring=require(_0xa545('0xf'));var Papa=require(_0xa545('0x10'));var Redis=require('ioredis');var authService=require(_0xa545('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa545('0x12'))(_0xa545('0x13'));var utils=require(_0xa545('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa545('0x15'));var db=require(_0xa545('0x16'))['db'];function respondWithStatusCode(_0x25e469,_0xc78d51){_0xc78d51=_0xc78d51||0xcc;return function(_0x33c6ca){if(_0x33c6ca){return _0x25e469[_0xa545('0x17')](_0xc78d51);}return _0x25e469[_0xa545('0x18')](_0xc78d51)['end']();};}function respondWithResult(_0x1bd9ce,_0x19f76f){_0x19f76f=_0x19f76f||0xc8;return function(_0x2a7f90){if(_0x2a7f90){return _0x1bd9ce[_0xa545('0x18')](_0x19f76f)[_0xa545('0x19')](_0x2a7f90);}};}function respondWithFilteredResult(_0xe22d38,_0x2b3fe9){return function(_0x11d963){if(_0x11d963){var _0xdd9783=typeof _0x2b3fe9[_0xa545('0x1a')]===_0xa545('0x1b')&&typeof _0x2b3fe9[_0xa545('0x1c')]==='undefined';var _0x19ec57=_0x11d963[_0xa545('0x1d')];var _0x2f9ff7=_0xdd9783?0x0:_0x2b3fe9[_0xa545('0x1a')];var _0x456638=_0xdd9783?_0x11d963[_0xa545('0x1d')]:_0x2b3fe9[_0xa545('0x1a')]+_0x2b3fe9['limit'];var _0x8f1193;if(_0x456638>=_0x19ec57){_0x456638=_0x19ec57;_0x8f1193=0xc8;}else{_0x8f1193=0xce;}_0xe22d38[_0xa545('0x18')](_0x8f1193);return _0xe22d38[_0xa545('0x1e')]('Content-Range',_0x2f9ff7+'-'+_0x456638+'/'+_0x19ec57)[_0xa545('0x19')](_0x11d963);}return null;};}function patchUpdates(_0x30ef58){return function(_0x2a8e1a){try{jsonpatch['apply'](_0x2a8e1a,_0x30ef58,!![]);}catch(_0x47e8d3){return BPromise['reject'](_0x47e8d3);}return _0x2a8e1a[_0xa545('0x1f')]();};}function saveUpdates(_0x54ff6a,_0x2fc5eb){return function(_0x2282b0){if(_0x2282b0){return _0x2282b0[_0xa545('0x20')](_0x54ff6a)['then'](function(_0x4fb13f){return _0x4fb13f;});}return null;};}function removeEntity(_0x6c9d61,_0x806faf){return function(_0x394187){if(_0x394187){return _0x394187[_0xa545('0x21')]()[_0xa545('0x22')](function(){var _0x21fd70=_0x394187['get']({'plain':!![]});var _0x369773='IvrCampaigns';return db[_0xa545('0x23')][_0xa545('0x21')]({'where':{'type':_0x369773,'resourceId':_0x21fd70['id']}})[_0xa545('0x22')](function(){return _0x394187;});})[_0xa545('0x22')](function(){_0x6c9d61[_0xa545('0x18')](0xcc)[_0xa545('0x24')]();});}};}function handleEntityNotFound(_0x50220b,_0x2108ab){return function(_0x4d3941){if(!_0x4d3941){_0x50220b[_0xa545('0x17')](0x194);}return _0x4d3941;};}function handleError(_0x5c6a6c,_0x33157e){_0x33157e=_0x33157e||0x1f4;return function(_0x4ee49a){logger['error'](_0x4ee49a[_0xa545('0x25')]);if(_0x4ee49a[_0xa545('0x26')]){delete _0x4ee49a[_0xa545('0x26')];}_0x5c6a6c['status'](_0x33157e)[_0xa545('0x27')](_0x4ee49a);};}exports[_0xa545('0x28')]=function(_0x3ca76a,_0x2dadb5){var _0x1c4004={},_0x4f0f2c={},_0x20f1fe={'count':0x0,'rows':[]};var _0x55f26f=_[_0xa545('0x29')](db[_0xa545('0x2a')][_0xa545('0x2b')],function(_0x4b931e){return{'name':_0x4b931e[_0xa545('0x2c')],'type':_0x4b931e[_0xa545('0x2d')]['key']};});_0x4f0f2c['model']=_[_0xa545('0x29')](_0x55f26f,_0xa545('0x26'));_0x4f0f2c[_0xa545('0x2e')]=_[_0xa545('0x2f')](_0x3ca76a[_0xa545('0x2e')]);_0x4f0f2c[_0xa545('0x30')]=_[_0xa545('0x31')](_0x4f0f2c['model'],_0x4f0f2c[_0xa545('0x2e')]);_0x1c4004[_0xa545('0x32')]=_[_0xa545('0x31')](_0x4f0f2c['model'],qs['fields'](_0x3ca76a[_0xa545('0x2e')][_0xa545('0x33')]));_0x1c4004[_0xa545('0x32')]=_0x1c4004[_0xa545('0x32')][_0xa545('0x34')]?_0x1c4004['attributes']:_0x4f0f2c[_0xa545('0x35')];if(!_0x3ca76a[_0xa545('0x2e')]['hasOwnProperty'](_0xa545('0x36'))){_0x1c4004[_0xa545('0x1c')]=qs[_0xa545('0x1c')](_0x3ca76a['query'][_0xa545('0x1c')]);_0x1c4004[_0xa545('0x1a')]=qs[_0xa545('0x1a')](_0x3ca76a[_0xa545('0x2e')]['offset']);}_0x1c4004[_0xa545('0x37')]=qs[_0xa545('0x38')](_0x3ca76a[_0xa545('0x2e')]['sort']);_0x1c4004[_0xa545('0x39')]=qs[_0xa545('0x30')](_['pick'](_0x3ca76a[_0xa545('0x2e')],_0x4f0f2c[_0xa545('0x30')]),_0x55f26f);if(_0x3ca76a['query'][_0xa545('0x3a')]){_0x1c4004['where']=_[_0xa545('0x3b')](_0x1c4004['where'],{'$or':_[_0xa545('0x29')](_0x55f26f,function(_0x56e66d){if(_0x56e66d[_0xa545('0x2d')]!==_0xa545('0x3c')){var _0xcb632d={};_0xcb632d[_0x56e66d[_0xa545('0x26')]]={'$like':'%'+_0x3ca76a[_0xa545('0x2e')]['filter']+'%'};return _0xcb632d;}})});}_0x1c4004=_[_0xa545('0x3b')]({},_0x1c4004,_0x3ca76a[_0xa545('0x3d')]);var _0x7e947={'where':_0x1c4004[_0xa545('0x39')]};return db[_0xa545('0x2a')][_0xa545('0x1d')](_0x7e947)[_0xa545('0x22')](function(_0x1980b5){_0x20f1fe['count']=_0x1980b5;if(_0x3ca76a[_0xa545('0x2e')][_0xa545('0x3e')]){_0x1c4004['include']=[{'all':!![]}];}return db[_0xa545('0x2a')][_0xa545('0x3f')](_0x1c4004);})[_0xa545('0x22')](function(_0x472d1f){_0x20f1fe['rows']=_0x472d1f;return _0x20f1fe;})[_0xa545('0x22')](respondWithFilteredResult(_0x2dadb5,_0x1c4004))[_0xa545('0x40')](handleError(_0x2dadb5,null));};exports[_0xa545('0x41')]=function(_0x4d27d8,_0x3db709){var _0x1e39ba={'raw':![],'where':{'id':_0x4d27d8[_0xa545('0x42')]['id']}},_0x53b0c8={};_0x53b0c8['model']=_[_0xa545('0x2f')](db[_0xa545('0x2a')][_0xa545('0x2b')]);_0x53b0c8[_0xa545('0x2e')]=_[_0xa545('0x2f')](_0x4d27d8[_0xa545('0x2e')]);_0x53b0c8[_0xa545('0x30')]=_[_0xa545('0x31')](_0x53b0c8['model'],_0x53b0c8[_0xa545('0x2e')]);_0x1e39ba[_0xa545('0x32')]=_[_0xa545('0x31')](_0x53b0c8[_0xa545('0x35')],qs['fields'](_0x4d27d8['query'][_0xa545('0x33')]));_0x1e39ba[_0xa545('0x32')]=_0x1e39ba[_0xa545('0x32')]['length']?_0x1e39ba['attributes']:_0x53b0c8[_0xa545('0x35')];if(_0x4d27d8[_0xa545('0x2e')]['includeAll']){_0x1e39ba[_0xa545('0x43')]=[{'all':!![]}];}_0x1e39ba=_['merge']({},_0x1e39ba,_0x4d27d8[_0xa545('0x3d')]);return db[_0xa545('0x2a')]['find'](_0x1e39ba)[_0xa545('0x22')](handleEntityNotFound(_0x3db709,null))[_0xa545('0x22')](respondWithResult(_0x3db709,null))[_0xa545('0x40')](handleError(_0x3db709,null));};exports[_0xa545('0x44')]=function(_0x4db2a2,_0x3ad94f){return db[_0xa545('0x2a')]['create'](_0x4db2a2['body'],{})[_0xa545('0x22')](function(_0x1c3a74){var _0x1a0f17=_0x4db2a2[_0xa545('0x45')]['get']({'plain':!![]});if(!_0x1a0f17)throw new Error(_0xa545('0x46'));if(_0x1a0f17[_0xa545('0x47')]===_0xa545('0x45')){var _0x519cfe=_0x1c3a74[_0xa545('0x48')]({'plain':!![]});var _0x37da75='IvrCampaigns';return db[_0xa545('0x49')][_0xa545('0x4a')]({'where':{'name':_0x37da75,'userProfileId':_0x1a0f17[_0xa545('0x4b')]},'raw':!![]})['then'](function(_0x4fc0f1){if(_0x4fc0f1&&_0x4fc0f1['autoAssociation']===0x0){return db[_0xa545('0x23')][_0xa545('0x44')]({'name':_0x519cfe['name'],'resourceId':_0x519cfe['id'],'type':_0x4fc0f1[_0xa545('0x26')],'sectionId':_0x4fc0f1['id']},{})[_0xa545('0x22')](function(){return _0x1c3a74;});}else{return _0x1c3a74;}})[_0xa545('0x40')](function(_0x418ad5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x418ad5);throw _0x418ad5;});}return _0x1c3a74;})[_0xa545('0x22')](respondWithResult(_0x3ad94f,0xc9))[_0xa545('0x40')](handleError(_0x3ad94f,null));};exports[_0xa545('0x4c')]=function(_0x3c21b8,_0x343a8f){var _0x5f77f6={'where':{'id':_0x3c21b8[_0xa545('0x42')]['id']}},_0x32d4e4={};_0x32d4e4[_0xa545('0x35')]=_[_0xa545('0x2f')](db[_0xa545('0x2a')]['rawAttributes']);_0x5f77f6['attributes']=_[_0xa545('0x31')](_0x32d4e4[_0xa545('0x35')],qs[_0xa545('0x33')](_0x3c21b8[_0xa545('0x2e')][_0xa545('0x33')]));_0x5f77f6['attributes']=_0x5f77f6[_0xa545('0x32')]['length']?_0x5f77f6['attributes']:_0x32d4e4['model'];if(_0x3c21b8[_0xa545('0x2e')][_0xa545('0x3e')]){_0x5f77f6['include']=[{'all':!![]}];}_0x5f77f6=_[_0xa545('0x3b')]({},_0x5f77f6,_0x3c21b8[_0xa545('0x3d')]);return db[_0xa545('0x2a')][_0xa545('0x4a')](_0x5f77f6)[_0xa545('0x22')](handleEntityNotFound(_0x343a8f,null))[_0xa545('0x22')](function(_0x7e30ab){if(_0x7e30ab){var _0x12c0eb=_0x7e30ab[_0xa545('0x48')]({'plain':!![]});_0x12c0eb=qs[_0xa545('0x4d')](_0x12c0eb,['id','createdAt','updatedAt']);_0x3c21b8['body']=_['omit'](_0x3c21b8['body'],['id',_0xa545('0x4e'),_0xa545('0x4f')]);return db['Campaign'][_0xa545('0x44')](_[_0xa545('0x3b')](_0x12c0eb,_0x3c21b8[_0xa545('0x50')]),{'include':_0x3c21b8['query'][_0xa545('0x3e')]?[{'all':!![]}]:undefined})[_0xa545('0x22')](function(_0x335e26){var _0x504955=_0x3c21b8[_0xa545('0x45')][_0xa545('0x48')]({'plain':!![]});if(!_0x504955)throw new Error(_0xa545('0x46'));if(_0x504955['role']==='user'){var _0x45559d=_0x335e26[_0xa545('0x48')]({'plain':!![]});var _0x326692=_0xa545('0x51');return db[_0xa545('0x49')]['find']({'where':{'name':_0x326692,'userProfileId':_0x504955[_0xa545('0x4b')]},'raw':!![]})[_0xa545('0x22')](function(_0x1a501e){if(_0x1a501e&&_0x1a501e[_0xa545('0x52')]===0x0){return db[_0xa545('0x23')][_0xa545('0x44')]({'name':_0x45559d[_0xa545('0x26')],'resourceId':_0x45559d['id'],'type':_0x1a501e[_0xa545('0x26')],'sectionId':_0x1a501e['id']},{})['then'](function(){return _0x335e26;});}else{return _0x335e26;}})[_0xa545('0x40')](function(_0x1f95e0){logger['error'](_0xa545('0x53'),_0x1f95e0);throw _0x1f95e0;});}return _0x335e26;});}})[_0xa545('0x22')](respondWithResult(_0x343a8f,0xc9))[_0xa545('0x40')](handleError(_0x343a8f,null));};exports[_0xa545('0x20')]=function(_0x467250,_0x5853a5){if(_0x467250['body']['id']){delete _0x467250['body']['id'];}return db[_0xa545('0x2a')][_0xa545('0x4a')]({'where':{'id':_0x467250['params']['id']}})['then'](handleEntityNotFound(_0x5853a5,null))[_0xa545('0x22')](saveUpdates(_0x467250['body'],null))['then'](respondWithResult(_0x5853a5,null))[_0xa545('0x40')](handleError(_0x5853a5,null));};exports[_0xa545('0x21')]=function(_0x412a17,_0x3fbb35){return db[_0xa545('0x2a')][_0xa545('0x4a')]({'where':{'id':_0x412a17[_0xa545('0x42')]['id']}})[_0xa545('0x22')](handleEntityNotFound(_0x3fbb35,null))[_0xa545('0x22')](removeEntity(_0x3fbb35,null))['catch'](handleError(_0x3fbb35,null));};exports[_0xa545('0x54')]=function(_0x50c89a,_0x1fc35c,_0xd9a363){var _0x47d3d5={'raw':!![],'where':{}};var _0x2613f8={};var _0x2d543e={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x50c89a['params']['id']}})[_0xa545('0x22')](handleEntityNotFound(_0x1fc35c,null))['then'](function(_0x1614cb){if(_0x1614cb){_0x2613f8[_0xa545('0x35')]=_[_0xa545('0x2f')](db[_0xa545('0x55')][_0xa545('0x2b')]);_0x2613f8['query']=_['keys'](_0x50c89a['query']);_0x2613f8[_0xa545('0x30')]=_[_0xa545('0x31')](_0x2613f8[_0xa545('0x35')],_0x2613f8[_0xa545('0x2e')]);_0x47d3d5[_0xa545('0x32')]=_[_0xa545('0x31')](_0x2613f8[_0xa545('0x35')],qs[_0xa545('0x33')](_0x50c89a[_0xa545('0x2e')]['fields']));_0x47d3d5[_0xa545('0x32')]=_0x47d3d5[_0xa545('0x32')]['length']?_0x47d3d5[_0xa545('0x32')]:_0x2613f8[_0xa545('0x35')];if(!_0x50c89a[_0xa545('0x2e')][_0xa545('0x56')](_0xa545('0x36'))){_0x47d3d5['limit']=qs[_0xa545('0x1c')](_0x50c89a['query'][_0xa545('0x1c')]);_0x47d3d5['offset']=qs[_0xa545('0x1a')](_0x50c89a[_0xa545('0x2e')][_0xa545('0x1a')]);}_0x47d3d5[_0xa545('0x37')]=qs[_0xa545('0x38')](_0x50c89a['query'][_0xa545('0x38')]);_0x47d3d5[_0xa545('0x39')]=qs[_0xa545('0x30')](_['pick'](_0x50c89a[_0xa545('0x2e')],_0x2613f8['filters']));_0x47d3d5['where']['CampaignId']=_0x1614cb['id'];if(_0x50c89a[_0xa545('0x2e')][_0xa545('0x3a')]){_0x47d3d5[_0xa545('0x39')]=_[_0xa545('0x3b')](_0x47d3d5[_0xa545('0x39')],{'$or':_[_0xa545('0x29')](_0x47d3d5[_0xa545('0x32')],function(_0x55ab57){var _0x5c55b5={};_0x5c55b5[_0x55ab57]={'$like':'%'+_0x50c89a[_0xa545('0x2e')][_0xa545('0x3a')]+'%'};return _0x5c55b5;})});}_0x47d3d5=_[_0xa545('0x3b')]({},_0x47d3d5,_0x50c89a[_0xa545('0x3d')]);return db[_0xa545('0x55')]['count']({'where':_0x47d3d5['where']})['then'](function(_0x59a3b2){_0x2d543e[_0xa545('0x1d')]=_0x59a3b2;if(_0x50c89a[_0xa545('0x2e')]['includeAll']){_0x47d3d5['include']=[{'all':!![]}];}return db[_0xa545('0x55')][_0xa545('0x3f')](_0x47d3d5);})[_0xa545('0x22')](function(_0x52bb92){_0x2d543e[_0xa545('0x57')]=_0x52bb92;return _0x2d543e;});}})['then'](respondWithFilteredResult(_0x1fc35c,_0x47d3d5))[_0xa545('0x40')](handleError(_0x1fc35c,null));};exports[_0xa545('0x58')]=function(_0xf222a4,_0x2fa4fb,_0x1b04ef){var _0x40d759={'raw':!![],'where':{}};var _0x200824={};var _0x2cc634={'count':0x0,'rows':[]};return db[_0xa545('0x2a')]['findOne']({'where':{'id':_0xf222a4[_0xa545('0x42')]['id']}})[_0xa545('0x22')](handleEntityNotFound(_0x2fa4fb,null))[_0xa545('0x22')](function(_0x38e299){if(_0x38e299){_0x200824['model']=_[_0xa545('0x2f')](db[_0xa545('0x59')][_0xa545('0x2b')]);_0x200824[_0xa545('0x2e')]=_[_0xa545('0x2f')](_0xf222a4['query']);_0x200824[_0xa545('0x30')]=_[_0xa545('0x31')](_0x200824[_0xa545('0x35')],_0x200824[_0xa545('0x2e')]);_0x40d759[_0xa545('0x32')]=_[_0xa545('0x31')](_0x200824['model'],qs[_0xa545('0x33')](_0xf222a4[_0xa545('0x2e')][_0xa545('0x33')]));_0x40d759[_0xa545('0x32')]=_0x40d759[_0xa545('0x32')]['length']?_0x40d759[_0xa545('0x32')]:_0x200824[_0xa545('0x35')];if(!_0xf222a4['query'][_0xa545('0x56')]('nolimit')){_0x40d759[_0xa545('0x1c')]=qs[_0xa545('0x1c')](_0xf222a4[_0xa545('0x2e')][_0xa545('0x1c')]);_0x40d759[_0xa545('0x1a')]=qs['offset'](_0xf222a4['query'][_0xa545('0x1a')]);}_0x40d759[_0xa545('0x37')]=qs['sort'](_0xf222a4[_0xa545('0x2e')][_0xa545('0x38')]);_0x40d759[_0xa545('0x39')]=qs['filters'](_['pick'](_0xf222a4[_0xa545('0x2e')],_0x200824['filters']));_0x40d759[_0xa545('0x39')][_0xa545('0x5a')]=_0x38e299['id'];if(_0xf222a4['query']['filter']){_0x40d759[_0xa545('0x39')]=_['merge'](_0x40d759[_0xa545('0x39')],{'$or':_[_0xa545('0x29')](_0x40d759[_0xa545('0x32')],function(_0x4f031e){var _0x56e6f8={};_0x56e6f8[_0x4f031e]={'$like':'%'+_0xf222a4['query'][_0xa545('0x3a')]+'%'};return _0x56e6f8;})});}_0x40d759=_[_0xa545('0x3b')]({},_0x40d759,_0xf222a4[_0xa545('0x3d')]);return db[_0xa545('0x59')][_0xa545('0x1d')]({'where':_0x40d759[_0xa545('0x39')]})[_0xa545('0x22')](function(_0x3d7cd5){_0x2cc634[_0xa545('0x1d')]=_0x3d7cd5;if(_0xf222a4[_0xa545('0x2e')][_0xa545('0x3e')]){_0x40d759[_0xa545('0x43')]=[{'all':!![]}];}return db[_0xa545('0x59')]['findAll'](_0x40d759);})[_0xa545('0x22')](function(_0x54c777){_0x2cc634[_0xa545('0x57')]=_0x54c777;return _0x2cc634;});}})['then'](respondWithFilteredResult(_0x2fa4fb,_0x40d759))[_0xa545('0x40')](handleError(_0x2fa4fb,null));};exports['getHopperFinals']=function(_0x7adcad,_0x4e6528,_0x19f1d7){var _0x360c6a={'raw':!![],'where':{}};var _0x4c733d={};var _0x54481f={'count':0x0,'rows':[]};return db[_0xa545('0x2a')][_0xa545('0x5b')]({'where':{'id':_0x7adcad[_0xa545('0x42')]['id']}})[_0xa545('0x22')](handleEntityNotFound(_0x4e6528,null))[_0xa545('0x22')](function(_0x22fd56){if(_0x22fd56){_0x4c733d[_0xa545('0x35')]=_[_0xa545('0x2f')](db[_0xa545('0x5c')][_0xa545('0x2b')]);_0x4c733d['query']=_['keys'](_0x7adcad[_0xa545('0x2e')]);_0x4c733d[_0xa545('0x30')]=_['intersection'](_0x4c733d[_0xa545('0x35')],_0x4c733d[_0xa545('0x2e')]);_0x360c6a[_0xa545('0x32')]=_['intersection'](_0x4c733d[_0xa545('0x35')],qs[_0xa545('0x33')](_0x7adcad[_0xa545('0x2e')][_0xa545('0x33')]));_0x360c6a[_0xa545('0x32')]=_0x360c6a[_0xa545('0x32')][_0xa545('0x34')]?_0x360c6a[_0xa545('0x32')]:_0x4c733d[_0xa545('0x35')];if(!_0x7adcad[_0xa545('0x2e')][_0xa545('0x56')](_0xa545('0x36'))){_0x360c6a[_0xa545('0x1c')]=qs[_0xa545('0x1c')](_0x7adcad[_0xa545('0x2e')]['limit']);_0x360c6a[_0xa545('0x1a')]=qs[_0xa545('0x1a')](_0x7adcad[_0xa545('0x2e')][_0xa545('0x1a')]);}_0x360c6a[_0xa545('0x37')]=qs[_0xa545('0x38')](_0x7adcad['query'][_0xa545('0x38')]);_0x360c6a[_0xa545('0x39')]=qs[_0xa545('0x30')](_[_0xa545('0x5d')](_0x7adcad[_0xa545('0x2e')],_0x4c733d[_0xa545('0x30')]));_0x360c6a[_0xa545('0x39')]['CampaignId']=_0x22fd56['id'];if(_0x7adcad[_0xa545('0x2e')][_0xa545('0x3a')]){_0x360c6a[_0xa545('0x39')]=_[_0xa545('0x3b')](_0x360c6a[_0xa545('0x39')],{'$or':_[_0xa545('0x29')](_0x360c6a['attributes'],function(_0x525ef3){var _0x462fc6={};_0x462fc6[_0x525ef3]={'$like':'%'+_0x7adcad[_0xa545('0x2e')][_0xa545('0x3a')]+'%'};return _0x462fc6;})});}_0x360c6a=_['merge']({},_0x360c6a,_0x7adcad[_0xa545('0x3d')]);return db['CmHopperFinal'][_0xa545('0x1d')]({'where':_0x360c6a[_0xa545('0x39')]})[_0xa545('0x22')](function(_0x31b72d){_0x54481f[_0xa545('0x1d')]=_0x31b72d;if(_0x7adcad[_0xa545('0x2e')][_0xa545('0x3e')]){_0x360c6a[_0xa545('0x43')]=[{'all':!![]}];}return db[_0xa545('0x5c')][_0xa545('0x3f')](_0x360c6a);})[_0xa545('0x22')](function(_0x125f3d){_0x54481f[_0xa545('0x57')]=_0x125f3d;return _0x54481f;});}})[_0xa545('0x22')](respondWithFilteredResult(_0x4e6528,_0x360c6a))[_0xa545('0x40')](handleError(_0x4e6528,null));};exports['getHopperBlacks']=function(_0x47c0b0,_0x438aaa,_0x248605){var _0x47ba6d={'raw':!![],'where':{}};var _0x530e5f={};var _0x57f1cc={'count':0x0,'rows':[]};return db[_0xa545('0x2a')][_0xa545('0x5b')]({'where':{'id':_0x47c0b0[_0xa545('0x42')]['id']}})[_0xa545('0x22')](handleEntityNotFound(_0x438aaa,null))[_0xa545('0x22')](function(_0x1c6933){if(_0x1c6933){_0x530e5f[_0xa545('0x35')]=_[_0xa545('0x2f')](db[_0xa545('0x5e')][_0xa545('0x2b')]);_0x530e5f['query']=_[_0xa545('0x2f')](_0x47c0b0[_0xa545('0x2e')]);_0x530e5f[_0xa545('0x30')]=_['intersection'](_0x530e5f[_0xa545('0x35')],_0x530e5f['query']);_0x47ba6d[_0xa545('0x32')]=_[_0xa545('0x31')](_0x530e5f[_0xa545('0x35')],qs[_0xa545('0x33')](_0x47c0b0[_0xa545('0x2e')]['fields']));_0x47ba6d[_0xa545('0x32')]=_0x47ba6d[_0xa545('0x32')][_0xa545('0x34')]?_0x47ba6d[_0xa545('0x32')]:_0x530e5f['model'];if(!_0x47c0b0['query']['hasOwnProperty'](_0xa545('0x36'))){_0x47ba6d[_0xa545('0x1c')]=qs['limit'](_0x47c0b0[_0xa545('0x2e')]['limit']);_0x47ba6d[_0xa545('0x1a')]=qs[_0xa545('0x1a')](_0x47c0b0[_0xa545('0x2e')]['offset']);}_0x47ba6d[_0xa545('0x37')]=qs['sort'](_0x47c0b0[_0xa545('0x2e')][_0xa545('0x38')]);_0x47ba6d[_0xa545('0x39')]=qs[_0xa545('0x30')](_[_0xa545('0x5d')](_0x47c0b0[_0xa545('0x2e')],_0x530e5f[_0xa545('0x30')]));_0x47ba6d[_0xa545('0x39')][_0xa545('0x5a')]=_0x1c6933['id'];if(_0x47c0b0['query'][_0xa545('0x3a')]){_0x47ba6d[_0xa545('0x39')]=_[_0xa545('0x3b')](_0x47ba6d[_0xa545('0x39')],{'$or':_[_0xa545('0x29')](_0x47ba6d['attributes'],function(_0x3b8b84){var _0x7c2124={};_0x7c2124[_0x3b8b84]={'$like':'%'+_0x47c0b0[_0xa545('0x2e')][_0xa545('0x3a')]+'%'};return _0x7c2124;})});}_0x47ba6d=_[_0xa545('0x3b')]({},_0x47ba6d,_0x47c0b0['options']);return db[_0xa545('0x5e')][_0xa545('0x1d')]({'where':_0x47ba6d[_0xa545('0x39')]})[_0xa545('0x22')](function(_0x12a0f9){_0x57f1cc[_0xa545('0x1d')]=_0x12a0f9;if(_0x47c0b0[_0xa545('0x2e')]['includeAll']){_0x47ba6d[_0xa545('0x43')]=[{'all':!![]}];}return db[_0xa545('0x5e')]['findAll'](_0x47ba6d);})[_0xa545('0x22')](function(_0x315d86){_0x57f1cc[_0xa545('0x57')]=_0x315d86;return _0x57f1cc;});}})[_0xa545('0x22')](respondWithFilteredResult(_0x438aaa,_0x47ba6d))[_0xa545('0x40')](handleError(_0x438aaa,null));};exports[_0xa545('0x5f')]=function(_0x4fdca5,_0x720c49,_0xf676d5){var _0x367af9={};var _0xc3f43d={};var _0x1d0ebc;var _0x177068;return db[_0xa545('0x2a')][_0xa545('0x5b')]({'where':{'id':_0x4fdca5[_0xa545('0x42')]['id']}})['then'](handleEntityNotFound(_0x720c49,null))[_0xa545('0x22')](function(_0x56190b){if(_0x56190b){_0x1d0ebc=_0x56190b;_0xc3f43d[_0xa545('0x35')]=_[_0xa545('0x2f')](db[_0xa545('0x60')][_0xa545('0x2b')]);_0xc3f43d['query']=_[_0xa545('0x2f')](_0x4fdca5[_0xa545('0x2e')]);_0xc3f43d[_0xa545('0x30')]=_[_0xa545('0x31')](_0xc3f43d[_0xa545('0x35')],_0xc3f43d[_0xa545('0x2e')]);_0x367af9[_0xa545('0x32')]=_['intersection'](_0xc3f43d['model'],qs[_0xa545('0x33')](_0x4fdca5[_0xa545('0x2e')]['fields']));_0x367af9['attributes']=_0x367af9[_0xa545('0x32')][_0xa545('0x34')]?_0x367af9[_0xa545('0x32')]:_0xc3f43d[_0xa545('0x35')];_0x367af9['order']=qs[_0xa545('0x38')](_0x4fdca5[_0xa545('0x2e')][_0xa545('0x38')]);_0x367af9['where']=qs[_0xa545('0x30')](_['pick'](_0x4fdca5[_0xa545('0x2e')],_0xc3f43d[_0xa545('0x30')]));if(_0x4fdca5[_0xa545('0x2e')][_0xa545('0x3a')]){_0x367af9[_0xa545('0x39')]=_[_0xa545('0x3b')](_0x367af9['where'],{'$or':_[_0xa545('0x29')](_0x367af9['attributes'],function(_0x541720){var _0x4e0f5d={};_0x4e0f5d[_0x541720]={'$like':'%'+_0x4fdca5[_0xa545('0x2e')][_0xa545('0x3a')]+'%'};return _0x4e0f5d;})});}_0x367af9=_[_0xa545('0x3b')]({},_0x367af9,_0x4fdca5[_0xa545('0x3d')]);return _0x1d0ebc[_0xa545('0x5f')](_0x367af9);}})[_0xa545('0x22')](function(_0x1b3e18){if(_0x1b3e18){_0x177068=_0x1b3e18['length'];if(!_0x4fdca5['query'][_0xa545('0x56')](_0xa545('0x36'))){_0x367af9[_0xa545('0x1c')]=qs[_0xa545('0x1c')](_0x4fdca5['query'][_0xa545('0x1c')]);_0x367af9['offset']=qs[_0xa545('0x1a')](_0x4fdca5[_0xa545('0x2e')]['offset']);}return _0x1d0ebc['getLists'](_0x367af9);}})[_0xa545('0x22')](function(_0x4a85ac){if(_0x4a85ac){return _0x4a85ac?{'count':_0x177068,'rows':_0x4a85ac}:null;}})[_0xa545('0x22')](respondWithResult(_0x720c49,null))['catch'](handleError(_0x720c49,null));};exports[_0xa545('0x61')]=function(_0x339009,_0x4c5c6f,_0x16bd6e){var _0x526267,_0x49fdda;return db['Campaign']['find']({'where':{'id':_0x339009[_0xa545('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c5c6f,null))[_0xa545('0x22')](function(_0x2032b5){if(_0x2032b5){_0x49fdda=_0x2032b5;return _0x2032b5['addLists'](_0x339009[_0xa545('0x50')][_0xa545('0x62')],_[_0xa545('0x4d')](_0x339009[_0xa545('0x50')],[_0xa545('0x62'),'id'])||{});}return null;})['spread'](function(_0x3b2c23){var _0x1aa70e;_0x526267=_0x3b2c23||[];var _0x128d6c=[];if(_0x3b2c23){for(var _0x5c7561=0x0;_0x5c7561<_0x3b2c23[_0xa545('0x34')];_0x5c7561+=0x1){var _0x189f16=_0x3b2c23[_0x5c7561][_0xa545('0x48')]({'plain':!![]});_0x49fdda[_0xa545('0x63')]=_0x339009[_0xa545('0x50')]['dialCheckDuplicateType']?_0x339009[_0xa545('0x50')][_0xa545('0x63')]:_0x49fdda[_0xa545('0x63')];switch(_0x49fdda[_0xa545('0x63')]){case _0xa545('0x64'):_0x1aa70e=squel[_0xa545('0x65')]()['into']('cm_hopper')['fromQuery']([_0xa545('0x66'),_0xa545('0x67'),_0xa545('0x68'),_0xa545('0x69'),_0xa545('0x5a'),_0xa545('0x4e'),_0xa545('0x4f')],squel[_0xa545('0x6a')]()[_0xa545('0x6b')](_0xa545('0x66'),_0xa545('0x66'))['field'](_0xa545('0x6c'),'scheduledAt')[_0xa545('0x6b')]('id',_0xa545('0x68'))[_0xa545('0x6b')](_0x189f16[_0xa545('0x6d')][_0xa545('0x6e')](),_0xa545('0x69'))['field'](_0x339009['params']['id']['toString'](),_0xa545('0x5a'))[_0xa545('0x6b')](_0xa545('0x6c'),_0xa545('0x4e'))[_0xa545('0x6b')]('NOW()',_0xa545('0x4f'))[_0xa545('0x6f')](_0xa545('0x70'))[_0xa545('0x39')]('deletedAt\x20IS\x20NULL')[_0xa545('0x39')](_0xa545('0x71'),_0x189f16[_0xa545('0x6d')][_0xa545('0x6e')]())[_0xa545('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0xa545('0x39')](_0xa545('0x72'),squel[_0xa545('0x6a')]()[_0xa545('0x6b')]('COALESCE(calleridnum,\x27\x27)')[_0xa545('0x6f')](_0xa545('0x73'))['where'](_0xa545('0x74'),_0x339009[_0xa545('0x42')]['id']['toString']()))['where'](_0xa545('0x72'),squel['select']()[_0xa545('0x6b')](_0xa545('0x75'))[_0xa545('0x6f')](_0xa545('0x76'))[_0xa545('0x39')]('CampaignId\x20=\x20?',_0x339009['params']['id'][_0xa545('0x6e')]())))[_0xa545('0x6e')]();break;case'onlyIfOpen':_0x1aa70e=squel[_0xa545('0x65')]()[_0xa545('0x77')](_0xa545('0x76'))[_0xa545('0x78')]([_0xa545('0x66'),_0xa545('0x67'),_0xa545('0x68'),_0xa545('0x69'),'CampaignId',_0xa545('0x4e'),'updatedAt'],squel[_0xa545('0x6a')]()[_0xa545('0x6b')](_0xa545('0x66'),_0xa545('0x66'))['field'](_0xa545('0x6c'),_0xa545('0x67'))[_0xa545('0x6b')]('id','ContactId')['field'](_0x189f16[_0xa545('0x6d')][_0xa545('0x6e')](),_0xa545('0x69'))[_0xa545('0x6b')](_0x339009['params']['id']['toString'](),_0xa545('0x5a'))[_0xa545('0x6b')]('NOW()','createdAt')[_0xa545('0x6b')](_0xa545('0x6c'),_0xa545('0x4f'))[_0xa545('0x6f')](_0xa545('0x70'))[_0xa545('0x39')]('deletedAt\x20IS\x20NULL')[_0xa545('0x39')](_0xa545('0x71'),_0x189f16[_0xa545('0x6d')]['toString']())['where'](_0xa545('0x79'))['where'](_0xa545('0x72'),squel[_0xa545('0x6a')]()[_0xa545('0x6b')](_0xa545('0x75'))[_0xa545('0x6f')](_0xa545('0x76'))['where'](_0xa545('0x74'),_0x339009['params']['id'][_0xa545('0x6e')]())))['toString']();break;default:_0x1aa70e=squel['insert']()[_0xa545('0x77')]('cm_hopper')[_0xa545('0x78')](['phone',_0xa545('0x67'),_0xa545('0x68'),'ListId',_0xa545('0x5a'),_0xa545('0x4e'),_0xa545('0x4f')],squel['select']()[_0xa545('0x6b')](_0xa545('0x66'),_0xa545('0x66'))[_0xa545('0x6b')]('NOW()','scheduledAt')[_0xa545('0x6b')]('id',_0xa545('0x68'))['field'](_0x189f16[_0xa545('0x6d')][_0xa545('0x6e')](),_0xa545('0x69'))[_0xa545('0x6b')](_0x339009[_0xa545('0x42')]['id'][_0xa545('0x6e')](),_0xa545('0x5a'))[_0xa545('0x6b')](_0xa545('0x6c'),'createdAt')[_0xa545('0x6b')](_0xa545('0x6c'),_0xa545('0x4f'))[_0xa545('0x6f')](_0xa545('0x70'))[_0xa545('0x39')]('deletedAt\x20IS\x20NULL')[_0xa545('0x39')](_0xa545('0x71'),_0x189f16[_0xa545('0x6d')]['toString']())[_0xa545('0x39')](_0xa545('0x79')))[_0xa545('0x6e')]();}_0x128d6c[_0xa545('0x7a')](db[_0xa545('0x7b')]['query'](_0x1aa70e));}return BPromise[_0xa545('0x7c')](_0x128d6c);}})[_0xa545('0x22')](function(){return _0x526267;})[_0xa545('0x22')](respondWithResult(_0x4c5c6f,null))[_0xa545('0x40')](handleError(_0x4c5c6f,null));};exports[_0xa545('0x7d')]=function(_0xcac9d8,_0x3e8441,_0x372802){return db[_0xa545('0x2a')][_0xa545('0x4a')]({'where':{'id':_0xcac9d8[_0xa545('0x42')]['id']}})[_0xa545('0x22')](handleEntityNotFound(_0x3e8441,null))['then'](function(_0x3ed0a3){if(_0x3ed0a3){return _0x3ed0a3[_0xa545('0x7d')](_0xcac9d8[_0xa545('0x2e')][_0xa545('0x62')]);}})[_0xa545('0x22')](function(_0x53dd1f){if(_0x53dd1f){return db[_0xa545('0x55')]['destroy']({'where':{'ListId':_0xcac9d8['query'][_0xa545('0x62')],'CampaignId':_0xcac9d8[_0xa545('0x42')]['id']}})[_0xa545('0x22')](function(){return _0x53dd1f;});}})['then'](respondWithStatusCode(_0x3e8441,null))[_0xa545('0x40')](handleError(_0x3e8441,null));};exports['getBlackLists']=function(_0x3e62a4,_0x491f0e,_0x5a74db){var _0x3eb51f={};var _0x13030d={};var _0x462746;var _0x4b1fe9;return db[_0xa545('0x2a')][_0xa545('0x5b')]({'where':{'id':_0x3e62a4['params']['id']}})[_0xa545('0x22')](handleEntityNotFound(_0x491f0e,null))[_0xa545('0x22')](function(_0x27e265){if(_0x27e265){_0x462746=_0x27e265;_0x13030d[_0xa545('0x35')]=_['keys'](db[_0xa545('0x60')][_0xa545('0x2b')]);_0x13030d[_0xa545('0x2e')]=_['keys'](_0x3e62a4['query']);_0x13030d[_0xa545('0x30')]=_[_0xa545('0x31')](_0x13030d['model'],_0x13030d[_0xa545('0x2e')]);_0x3eb51f['attributes']=_[_0xa545('0x31')](_0x13030d[_0xa545('0x35')],qs['fields'](_0x3e62a4['query'][_0xa545('0x33')]));_0x3eb51f['attributes']=_0x3eb51f[_0xa545('0x32')][_0xa545('0x34')]?_0x3eb51f[_0xa545('0x32')]:_0x13030d['model'];_0x3eb51f['order']=qs['sort'](_0x3e62a4[_0xa545('0x2e')][_0xa545('0x38')]);_0x3eb51f[_0xa545('0x39')]=qs['filters'](_[_0xa545('0x5d')](_0x3e62a4[_0xa545('0x2e')],_0x13030d[_0xa545('0x30')]));if(_0x3e62a4[_0xa545('0x2e')][_0xa545('0x3a')]){_0x3eb51f[_0xa545('0x39')]=_[_0xa545('0x3b')](_0x3eb51f[_0xa545('0x39')],{'$or':_[_0xa545('0x29')](_0x3eb51f[_0xa545('0x32')],function(_0x579569){var _0x26091f={};_0x26091f[_0x579569]={'$like':'%'+_0x3e62a4[_0xa545('0x2e')]['filter']+'%'};return _0x26091f;})});}_0x3eb51f=_[_0xa545('0x3b')]({},_0x3eb51f,_0x3e62a4[_0xa545('0x3d')]);return _0x462746[_0xa545('0x7e')](_0x3eb51f);}})[_0xa545('0x22')](function(_0x26e757){if(_0x26e757){_0x4b1fe9=_0x26e757['length'];if(!_0x3e62a4[_0xa545('0x2e')][_0xa545('0x56')](_0xa545('0x36'))){_0x3eb51f[_0xa545('0x1c')]=qs[_0xa545('0x1c')](_0x3e62a4['query'][_0xa545('0x1c')]);_0x3eb51f[_0xa545('0x1a')]=qs[_0xa545('0x1a')](_0x3e62a4[_0xa545('0x2e')][_0xa545('0x1a')]);}return _0x462746[_0xa545('0x7e')](_0x3eb51f);}})[_0xa545('0x22')](function(_0x28d977){if(_0x28d977){return _0x28d977?{'count':_0x4b1fe9,'rows':_0x28d977}:null;}})[_0xa545('0x22')](respondWithResult(_0x491f0e,null))[_0xa545('0x40')](handleError(_0x491f0e,null));};exports[_0xa545('0x7f')]=function(_0x440ce4,_0x24c5b7,_0x4f1b19){var _0x323865,_0x52afab;return db['Campaign']['find']({'where':{'id':_0x440ce4[_0xa545('0x42')]['id']}})[_0xa545('0x22')](handleEntityNotFound(_0x24c5b7,null))['then'](function(_0x48c786){if(_0x48c786){_0x52afab=_0x48c786;return _0x48c786['addBlackLists'](_0x440ce4[_0xa545('0x50')][_0xa545('0x62')],_['omit'](_0x440ce4[_0xa545('0x50')],[_0xa545('0x62'),'id'])||{});}return null;})['spread'](function(_0x734f5d){var _0x4875c1;_0x323865=_0x734f5d||[];var _0x42e95d=[];if(_0x734f5d){for(var _0x184545=0x0;_0x184545<_0x734f5d[_0xa545('0x34')];_0x184545+=0x1){var _0x1c4249=_0x734f5d[_0x184545][_0xa545('0x48')]({'plain':!![]});_0x4875c1=squel[_0xa545('0x65')]()['into'](_0xa545('0x80'))['fromQuery']([_0xa545('0x66'),_0xa545('0x68'),_0xa545('0x69'),'CampaignId',_0xa545('0x4e'),_0xa545('0x4f')],squel[_0xa545('0x6a')]()[_0xa545('0x6b')]('phone',_0xa545('0x66'))[_0xa545('0x6b')]('id','ContactId')['field'](_0x1c4249[_0xa545('0x6d')][_0xa545('0x6e')](),_0xa545('0x69'))['field'](_0x440ce4[_0xa545('0x42')]['id'][_0xa545('0x6e')](),_0xa545('0x5a'))[_0xa545('0x6b')](_0xa545('0x6c'),_0xa545('0x4e'))[_0xa545('0x6b')](_0xa545('0x6c'),_0xa545('0x4f'))[_0xa545('0x6f')](_0xa545('0x70'))[_0xa545('0x39')](_0xa545('0x81'))['where'](_0xa545('0x71'),_0x1c4249[_0xa545('0x6d')][_0xa545('0x6e')]())[_0xa545('0x39')](_0xa545('0x79')))['toString']();_0x42e95d[_0xa545('0x7a')](db[_0xa545('0x7b')][_0xa545('0x2e')](_0x4875c1));}return BPromise['all'](_0x42e95d);}})[_0xa545('0x22')](function(){return _0x323865;})['then'](respondWithResult(_0x24c5b7,null))['catch'](handleError(_0x24c5b7,null));};exports['removeBlackLists']=function(_0xecb9f7,_0x1ceef9,_0x214ca2){return db[_0xa545('0x2a')][_0xa545('0x4a')]({'where':{'id':_0xecb9f7[_0xa545('0x42')]['id']}})['then'](handleEntityNotFound(_0x1ceef9,null))['then'](function(_0x5ea40a){if(_0x5ea40a){return _0x5ea40a[_0xa545('0x82')](_0xecb9f7['query'][_0xa545('0x62')]);}})[_0xa545('0x22')](function(_0x169dd9){if(_0x169dd9){return db['CmHopperBlack'][_0xa545('0x21')]({'where':{'ListId':_0xecb9f7[_0xa545('0x2e')][_0xa545('0x62')],'CampaignId':_0xecb9f7[_0xa545('0x42')]['id']}})['then'](function(){return _0x169dd9;});}})['then'](respondWithStatusCode(_0x1ceef9,null))[_0xa545('0x40')](handleError(_0x1ceef9,null));}; \ No newline at end of file +var _0x1d06=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','where','filter','merge','options','include','findAll','rows','catch','show','params','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','user','getHoppers','findOne','keys','CmHopper','sort','pick','CampaignId','includeAll','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','deletedAt\x20IS\x20NULL','push','all','removeLists','getBlackLists','CmList','addBlackLists','spread','cm_hopper_black','ListId\x20=\x20?','sequelize','removeBlackLists','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','IvrCampaigns','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query'];(function(_0x344264,_0x38aca6){var _0x528110=function(_0x3076f1){while(--_0x3076f1){_0x344264['push'](_0x344264['shift']());}};_0x528110(++_0x38aca6);}(_0x1d06,0x1e4));var _0x61d0=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x1d06[_0x1e4360];return _0x31e6b4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x61d0('0x0'));var jsonpatch=require(_0x61d0('0x1'));var rp=require(_0x61d0('0x2'));var moment=require('moment');var BPromise=require(_0x61d0('0x3'));var Mustache=require(_0x61d0('0x4'));var util=require('util');var path=require(_0x61d0('0x5'));var sox=require('sox');var csv=require(_0x61d0('0x6'));var ejs=require(_0x61d0('0x7'));var fs=require('fs');var fs_extra=require(_0x61d0('0x8'));var _=require(_0x61d0('0x9'));var squel=require('squel');var crypto=require(_0x61d0('0xa'));var jsforce=require(_0x61d0('0xb'));var deskjs=require(_0x61d0('0xc'));var toCsv=require(_0x61d0('0x6'));var querystring=require(_0x61d0('0xd'));var Papa=require(_0x61d0('0xe'));var Redis=require(_0x61d0('0xf'));var authService=require(_0x61d0('0x10'));var qs=require(_0x61d0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x61d0('0x12'));var logger=require(_0x61d0('0x13'))(_0x61d0('0x14'));var utils=require('../../config/utils');var config=require(_0x61d0('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x61d0('0x16'))['db'];function respondWithStatusCode(_0xba1a15,_0x5d8e63){_0x5d8e63=_0x5d8e63||0xcc;return function(_0x34066e){if(_0x34066e){return _0xba1a15[_0x61d0('0x17')](_0x5d8e63);}return _0xba1a15[_0x61d0('0x18')](_0x5d8e63)[_0x61d0('0x19')]();};}function respondWithResult(_0x4b0506,_0x3760fa){_0x3760fa=_0x3760fa||0xc8;return function(_0x4e03fc){if(_0x4e03fc){return _0x4b0506[_0x61d0('0x18')](_0x3760fa)['json'](_0x4e03fc);}};}function respondWithFilteredResult(_0xf13354,_0x1030d5){return function(_0x11a4dd){if(_0x11a4dd){var _0x590bc2=typeof _0x1030d5['offset']===_0x61d0('0x1a')&&typeof _0x1030d5[_0x61d0('0x1b')]===_0x61d0('0x1a');var _0xf8ecc0=_0x11a4dd[_0x61d0('0x1c')];var _0x372193=_0x590bc2?0x0:_0x1030d5['offset'];var _0x5eb9f6=_0x590bc2?_0x11a4dd[_0x61d0('0x1c')]:_0x1030d5['offset']+_0x1030d5[_0x61d0('0x1b')];var _0x77da36;if(_0x5eb9f6>=_0xf8ecc0){_0x5eb9f6=_0xf8ecc0;_0x77da36=0xc8;}else{_0x77da36=0xce;}_0xf13354[_0x61d0('0x18')](_0x77da36);return _0xf13354[_0x61d0('0x1d')](_0x61d0('0x1e'),_0x372193+'-'+_0x5eb9f6+'/'+_0xf8ecc0)[_0x61d0('0x1f')](_0x11a4dd);}return null;};}function patchUpdates(_0x472c2e){return function(_0x22f0d2){try{jsonpatch[_0x61d0('0x20')](_0x22f0d2,_0x472c2e,!![]);}catch(_0x313b0c){return BPromise[_0x61d0('0x21')](_0x313b0c);}return _0x22f0d2[_0x61d0('0x22')]();};}function saveUpdates(_0x1c5789,_0x2f1019){return function(_0x488f4d){if(_0x488f4d){return _0x488f4d[_0x61d0('0x23')](_0x1c5789)[_0x61d0('0x24')](function(_0xb8f040){return _0xb8f040;});}return null;};}function removeEntity(_0x252b6a,_0x84d888){return function(_0x406fde){if(_0x406fde){return _0x406fde[_0x61d0('0x25')]()[_0x61d0('0x24')](function(){var _0xa772a9=_0x406fde[_0x61d0('0x26')]({'plain':!![]});var _0x240935=_0x61d0('0x27');return db['UserProfileResource'][_0x61d0('0x25')]({'where':{'type':_0x240935,'resourceId':_0xa772a9['id']}})[_0x61d0('0x24')](function(){return _0x406fde;});})[_0x61d0('0x24')](function(){_0x252b6a[_0x61d0('0x18')](0xcc)[_0x61d0('0x19')]();});}};}function handleEntityNotFound(_0x73672e,_0x516ffb){return function(_0x196e42){if(!_0x196e42){_0x73672e['sendStatus'](0x194);}return _0x196e42;};}function handleError(_0x314789,_0xaff012){_0xaff012=_0xaff012||0x1f4;return function(_0x391e60){logger[_0x61d0('0x28')](_0x391e60[_0x61d0('0x29')]);if(_0x391e60['name']){delete _0x391e60[_0x61d0('0x2a')];}_0x314789[_0x61d0('0x18')](_0xaff012)['send'](_0x391e60);};}exports[_0x61d0('0x2b')]=function(_0x196359,_0x31b91a){var _0x3d460b={},_0xf9cf91={},_0x428997={'count':0x0,'rows':[]};var _0x1d16e1=_[_0x61d0('0x2c')](db[_0x61d0('0x2d')][_0x61d0('0x2e')],function(_0x372a42){return{'name':_0x372a42[_0x61d0('0x2f')],'type':_0x372a42[_0x61d0('0x30')][_0x61d0('0x31')]};});_0xf9cf91[_0x61d0('0x32')]=_[_0x61d0('0x2c')](_0x1d16e1,_0x61d0('0x2a'));_0xf9cf91[_0x61d0('0x33')]=_['keys'](_0x196359['query']);_0xf9cf91[_0x61d0('0x34')]=_[_0x61d0('0x35')](_0xf9cf91[_0x61d0('0x32')],_0xf9cf91['query']);_0x3d460b[_0x61d0('0x36')]=_[_0x61d0('0x35')](_0xf9cf91[_0x61d0('0x32')],qs[_0x61d0('0x37')](_0x196359[_0x61d0('0x33')][_0x61d0('0x37')]));_0x3d460b['attributes']=_0x3d460b['attributes'][_0x61d0('0x38')]?_0x3d460b[_0x61d0('0x36')]:_0xf9cf91['model'];if(!_0x196359[_0x61d0('0x33')][_0x61d0('0x39')](_0x61d0('0x3a'))){_0x3d460b['limit']=qs['limit'](_0x196359[_0x61d0('0x33')][_0x61d0('0x1b')]);_0x3d460b[_0x61d0('0x3b')]=qs[_0x61d0('0x3b')](_0x196359['query'][_0x61d0('0x3b')]);}_0x3d460b[_0x61d0('0x3c')]=qs['sort'](_0x196359['query']['sort']);_0x3d460b[_0x61d0('0x3d')]=qs[_0x61d0('0x34')](_['pick'](_0x196359['query'],_0xf9cf91[_0x61d0('0x34')]),_0x1d16e1);if(_0x196359[_0x61d0('0x33')][_0x61d0('0x3e')]){_0x3d460b[_0x61d0('0x3d')]=_[_0x61d0('0x3f')](_0x3d460b[_0x61d0('0x3d')],{'$or':_['map'](_0x1d16e1,function(_0x5bbea9){if(_0x5bbea9['type']!=='VIRTUAL'){var _0x1c5162={};_0x1c5162[_0x5bbea9[_0x61d0('0x2a')]]={'$like':'%'+_0x196359[_0x61d0('0x33')][_0x61d0('0x3e')]+'%'};return _0x1c5162;}})});}_0x3d460b=_['merge']({},_0x3d460b,_0x196359[_0x61d0('0x40')]);var _0x983224={'where':_0x3d460b['where']};return db['Campaign'][_0x61d0('0x1c')](_0x983224)[_0x61d0('0x24')](function(_0x25c224){_0x428997[_0x61d0('0x1c')]=_0x25c224;if(_0x196359[_0x61d0('0x33')]['includeAll']){_0x3d460b[_0x61d0('0x41')]=[{'all':!![]}];}return db[_0x61d0('0x2d')][_0x61d0('0x42')](_0x3d460b);})[_0x61d0('0x24')](function(_0x23eb79){_0x428997[_0x61d0('0x43')]=_0x23eb79;return _0x428997;})[_0x61d0('0x24')](respondWithFilteredResult(_0x31b91a,_0x3d460b))[_0x61d0('0x44')](handleError(_0x31b91a,null));};exports[_0x61d0('0x45')]=function(_0x27e4bb,_0x16f1c9){var _0x3d28cc={'raw':![],'where':{'id':_0x27e4bb[_0x61d0('0x46')]['id']}},_0x37cd4e={};_0x37cd4e['model']=_['keys'](db[_0x61d0('0x2d')][_0x61d0('0x2e')]);_0x37cd4e[_0x61d0('0x33')]=_['keys'](_0x27e4bb[_0x61d0('0x33')]);_0x37cd4e['filters']=_[_0x61d0('0x35')](_0x37cd4e[_0x61d0('0x32')],_0x37cd4e[_0x61d0('0x33')]);_0x3d28cc[_0x61d0('0x36')]=_[_0x61d0('0x35')](_0x37cd4e[_0x61d0('0x32')],qs[_0x61d0('0x37')](_0x27e4bb['query']['fields']));_0x3d28cc['attributes']=_0x3d28cc['attributes'][_0x61d0('0x38')]?_0x3d28cc[_0x61d0('0x36')]:_0x37cd4e[_0x61d0('0x32')];if(_0x27e4bb['query']['includeAll']){_0x3d28cc['include']=[{'all':!![]}];}_0x3d28cc=_[_0x61d0('0x3f')]({},_0x3d28cc,_0x27e4bb[_0x61d0('0x40')]);return db[_0x61d0('0x2d')][_0x61d0('0x47')](_0x3d28cc)[_0x61d0('0x24')](handleEntityNotFound(_0x16f1c9,null))[_0x61d0('0x24')](respondWithResult(_0x16f1c9,null))[_0x61d0('0x44')](handleError(_0x16f1c9,null));};exports[_0x61d0('0x48')]=function(_0x2110e8,_0x23cd4a){return db[_0x61d0('0x2d')][_0x61d0('0x48')](_0x2110e8[_0x61d0('0x49')],{})[_0x61d0('0x24')](function(_0x3b661a){var _0x2629d3=_0x2110e8['user']['get']({'plain':!![]});if(!_0x2629d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2629d3[_0x61d0('0x4a')]==='user'){var _0x466906=_0x3b661a[_0x61d0('0x26')]({'plain':!![]});var _0x2f14ba=_0x61d0('0x27');return db[_0x61d0('0x4b')][_0x61d0('0x47')]({'where':{'name':_0x2f14ba,'userProfileId':_0x2629d3[_0x61d0('0x4c')]},'raw':!![]})[_0x61d0('0x24')](function(_0x579843){if(_0x579843&&_0x579843[_0x61d0('0x4d')]===0x0){return db[_0x61d0('0x4e')][_0x61d0('0x48')]({'name':_0x466906[_0x61d0('0x2a')],'resourceId':_0x466906['id'],'type':_0x579843[_0x61d0('0x2a')],'sectionId':_0x579843['id']},{})[_0x61d0('0x24')](function(){return _0x3b661a;});}else{return _0x3b661a;}})[_0x61d0('0x44')](function(_0x59a06f){logger['error'](_0x61d0('0x4f'),_0x59a06f);throw _0x59a06f;});}return _0x3b661a;})['then'](respondWithResult(_0x23cd4a,0xc9))[_0x61d0('0x44')](handleError(_0x23cd4a,null));};exports['clone']=function(_0x9106e6,_0x18d004){var _0x548ec8={'where':{'id':_0x9106e6['params']['id']}},_0x1c05e8={};_0x1c05e8['model']=_['keys'](db['Campaign'][_0x61d0('0x2e')]);_0x548ec8[_0x61d0('0x36')]=_[_0x61d0('0x35')](_0x1c05e8[_0x61d0('0x32')],qs[_0x61d0('0x37')](_0x9106e6['query'][_0x61d0('0x37')]));_0x548ec8[_0x61d0('0x36')]=_0x548ec8[_0x61d0('0x36')][_0x61d0('0x38')]?_0x548ec8[_0x61d0('0x36')]:_0x1c05e8[_0x61d0('0x32')];if(_0x9106e6[_0x61d0('0x33')]['includeAll']){_0x548ec8[_0x61d0('0x41')]=[{'all':!![]}];}_0x548ec8=_[_0x61d0('0x3f')]({},_0x548ec8,_0x9106e6[_0x61d0('0x40')]);return db['Campaign'][_0x61d0('0x47')](_0x548ec8)['then'](handleEntityNotFound(_0x18d004,null))[_0x61d0('0x24')](function(_0x31a454){if(_0x31a454){var _0x25e49b=_0x31a454['get']({'plain':!![]});_0x25e49b=qs['omit'](_0x25e49b,['id',_0x61d0('0x50'),_0x61d0('0x51')]);_0x9106e6['body']=_[_0x61d0('0x52')](_0x9106e6['body'],['id',_0x61d0('0x50'),_0x61d0('0x51')]);return db[_0x61d0('0x2d')]['create'](_[_0x61d0('0x3f')](_0x25e49b,_0x9106e6[_0x61d0('0x49')]),{'include':_0x9106e6[_0x61d0('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0x61d0('0x24')](function(_0xc762f3){var _0x4984f9=_0x9106e6[_0x61d0('0x53')][_0x61d0('0x26')]({'plain':!![]});if(!_0x4984f9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4984f9[_0x61d0('0x4a')]===_0x61d0('0x53')){var _0x542a71=_0xc762f3[_0x61d0('0x26')]({'plain':!![]});var _0x4f2198=_0x61d0('0x27');return db[_0x61d0('0x4b')]['find']({'where':{'name':_0x4f2198,'userProfileId':_0x4984f9[_0x61d0('0x4c')]},'raw':!![]})[_0x61d0('0x24')](function(_0x5da5b1){if(_0x5da5b1&&_0x5da5b1[_0x61d0('0x4d')]===0x0){return db[_0x61d0('0x4e')][_0x61d0('0x48')]({'name':_0x542a71['name'],'resourceId':_0x542a71['id'],'type':_0x5da5b1[_0x61d0('0x2a')],'sectionId':_0x5da5b1['id']},{})[_0x61d0('0x24')](function(){return _0xc762f3;});}else{return _0xc762f3;}})[_0x61d0('0x44')](function(_0x5a6e31){logger[_0x61d0('0x28')](_0x61d0('0x4f'),_0x5a6e31);throw _0x5a6e31;});}return _0xc762f3;});}})[_0x61d0('0x24')](respondWithResult(_0x18d004,0xc9))['catch'](handleError(_0x18d004,null));};exports[_0x61d0('0x23')]=function(_0x1973fe,_0xa75f73){if(_0x1973fe[_0x61d0('0x49')]['id']){delete _0x1973fe[_0x61d0('0x49')]['id'];}return db[_0x61d0('0x2d')]['find']({'where':{'id':_0x1973fe['params']['id']}})['then'](handleEntityNotFound(_0xa75f73,null))[_0x61d0('0x24')](saveUpdates(_0x1973fe[_0x61d0('0x49')],null))['then'](respondWithResult(_0xa75f73,null))[_0x61d0('0x44')](handleError(_0xa75f73,null));};exports[_0x61d0('0x25')]=function(_0x3347f3,_0x547161){return db[_0x61d0('0x2d')]['find']({'where':{'id':_0x3347f3[_0x61d0('0x46')]['id']}})[_0x61d0('0x24')](handleEntityNotFound(_0x547161,null))['then'](removeEntity(_0x547161,null))[_0x61d0('0x44')](handleError(_0x547161,null));};exports[_0x61d0('0x54')]=function(_0x1f0c23,_0x46459f,_0x2faca1){var _0x27e4a8={'raw':!![],'where':{}};var _0x13833f={};var _0x4b120b={'count':0x0,'rows':[]};return db['Campaign'][_0x61d0('0x55')]({'where':{'id':_0x1f0c23[_0x61d0('0x46')]['id']}})[_0x61d0('0x24')](handleEntityNotFound(_0x46459f,null))['then'](function(_0x38bff8){if(_0x38bff8){_0x13833f['model']=_[_0x61d0('0x56')](db[_0x61d0('0x57')][_0x61d0('0x2e')]);_0x13833f['query']=_[_0x61d0('0x56')](_0x1f0c23[_0x61d0('0x33')]);_0x13833f[_0x61d0('0x34')]=_['intersection'](_0x13833f[_0x61d0('0x32')],_0x13833f[_0x61d0('0x33')]);_0x27e4a8[_0x61d0('0x36')]=_[_0x61d0('0x35')](_0x13833f['model'],qs[_0x61d0('0x37')](_0x1f0c23[_0x61d0('0x33')]['fields']));_0x27e4a8[_0x61d0('0x36')]=_0x27e4a8['attributes'][_0x61d0('0x38')]?_0x27e4a8['attributes']:_0x13833f['model'];if(!_0x1f0c23[_0x61d0('0x33')][_0x61d0('0x39')](_0x61d0('0x3a'))){_0x27e4a8[_0x61d0('0x1b')]=qs[_0x61d0('0x1b')](_0x1f0c23[_0x61d0('0x33')]['limit']);_0x27e4a8[_0x61d0('0x3b')]=qs[_0x61d0('0x3b')](_0x1f0c23[_0x61d0('0x33')][_0x61d0('0x3b')]);}_0x27e4a8[_0x61d0('0x3c')]=qs['sort'](_0x1f0c23[_0x61d0('0x33')][_0x61d0('0x58')]);_0x27e4a8['where']=qs['filters'](_[_0x61d0('0x59')](_0x1f0c23[_0x61d0('0x33')],_0x13833f[_0x61d0('0x34')]));_0x27e4a8[_0x61d0('0x3d')][_0x61d0('0x5a')]=_0x38bff8['id'];if(_0x1f0c23[_0x61d0('0x33')][_0x61d0('0x3e')]){_0x27e4a8[_0x61d0('0x3d')]=_[_0x61d0('0x3f')](_0x27e4a8['where'],{'$or':_[_0x61d0('0x2c')](_0x27e4a8[_0x61d0('0x36')],function(_0x3ae33c){var _0x36539f={};_0x36539f[_0x3ae33c]={'$like':'%'+_0x1f0c23[_0x61d0('0x33')][_0x61d0('0x3e')]+'%'};return _0x36539f;})});}_0x27e4a8=_[_0x61d0('0x3f')]({},_0x27e4a8,_0x1f0c23[_0x61d0('0x40')]);return db[_0x61d0('0x57')][_0x61d0('0x1c')]({'where':_0x27e4a8[_0x61d0('0x3d')]})['then'](function(_0x34f269){_0x4b120b[_0x61d0('0x1c')]=_0x34f269;if(_0x1f0c23[_0x61d0('0x33')][_0x61d0('0x5b')]){_0x27e4a8[_0x61d0('0x41')]=[{'all':!![]}];}return db[_0x61d0('0x57')][_0x61d0('0x42')](_0x27e4a8);})[_0x61d0('0x24')](function(_0x50235d){_0x4b120b['rows']=_0x50235d;return _0x4b120b;});}})[_0x61d0('0x24')](respondWithFilteredResult(_0x46459f,_0x27e4a8))[_0x61d0('0x44')](handleError(_0x46459f,null));};exports['getHopperHistories']=function(_0x21d2a4,_0x4562bd,_0x1d3876){var _0x5e6b3f={'raw':!![],'where':{}};var _0x32d957={};var _0x30e140={'count':0x0,'rows':[]};return db[_0x61d0('0x2d')]['findOne']({'where':{'id':_0x21d2a4[_0x61d0('0x46')]['id']}})[_0x61d0('0x24')](handleEntityNotFound(_0x4562bd,null))[_0x61d0('0x24')](function(_0x2ae228){if(_0x2ae228){_0x32d957[_0x61d0('0x32')]=_[_0x61d0('0x56')](db['CmHopperHistory']['rawAttributes']);_0x32d957[_0x61d0('0x33')]=_[_0x61d0('0x56')](_0x21d2a4['query']);_0x32d957[_0x61d0('0x34')]=_[_0x61d0('0x35')](_0x32d957['model'],_0x32d957[_0x61d0('0x33')]);_0x5e6b3f[_0x61d0('0x36')]=_[_0x61d0('0x35')](_0x32d957[_0x61d0('0x32')],qs[_0x61d0('0x37')](_0x21d2a4[_0x61d0('0x33')]['fields']));_0x5e6b3f[_0x61d0('0x36')]=_0x5e6b3f[_0x61d0('0x36')][_0x61d0('0x38')]?_0x5e6b3f[_0x61d0('0x36')]:_0x32d957['model'];if(!_0x21d2a4[_0x61d0('0x33')]['hasOwnProperty'](_0x61d0('0x3a'))){_0x5e6b3f[_0x61d0('0x1b')]=qs['limit'](_0x21d2a4[_0x61d0('0x33')][_0x61d0('0x1b')]);_0x5e6b3f['offset']=qs[_0x61d0('0x3b')](_0x21d2a4[_0x61d0('0x33')][_0x61d0('0x3b')]);}_0x5e6b3f['order']=qs[_0x61d0('0x58')](_0x21d2a4['query'][_0x61d0('0x58')]);_0x5e6b3f[_0x61d0('0x3d')]=qs[_0x61d0('0x34')](_[_0x61d0('0x59')](_0x21d2a4[_0x61d0('0x33')],_0x32d957[_0x61d0('0x34')]));_0x5e6b3f[_0x61d0('0x3d')]['CampaignId']=_0x2ae228['id'];if(_0x21d2a4[_0x61d0('0x33')][_0x61d0('0x3e')]){_0x5e6b3f[_0x61d0('0x3d')]=_[_0x61d0('0x3f')](_0x5e6b3f[_0x61d0('0x3d')],{'$or':_[_0x61d0('0x2c')](_0x5e6b3f[_0x61d0('0x36')],function(_0x13fa43){var _0xa52eae={};_0xa52eae[_0x13fa43]={'$like':'%'+_0x21d2a4[_0x61d0('0x33')][_0x61d0('0x3e')]+'%'};return _0xa52eae;})});}_0x5e6b3f=_[_0x61d0('0x3f')]({},_0x5e6b3f,_0x21d2a4[_0x61d0('0x40')]);return db['CmHopperHistory'][_0x61d0('0x1c')]({'where':_0x5e6b3f['where']})[_0x61d0('0x24')](function(_0x6f3e01){_0x30e140[_0x61d0('0x1c')]=_0x6f3e01;if(_0x21d2a4[_0x61d0('0x33')][_0x61d0('0x5b')]){_0x5e6b3f[_0x61d0('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x61d0('0x42')](_0x5e6b3f);})[_0x61d0('0x24')](function(_0x2bd99e){_0x30e140[_0x61d0('0x43')]=_0x2bd99e;return _0x30e140;});}})['then'](respondWithFilteredResult(_0x4562bd,_0x5e6b3f))[_0x61d0('0x44')](handleError(_0x4562bd,null));};exports[_0x61d0('0x5c')]=function(_0x33549c,_0x164840,_0x4d5d87){var _0x154892={'raw':!![],'where':{}};var _0x4681ae={};var _0x3b14b9={'count':0x0,'rows':[]};return db[_0x61d0('0x2d')][_0x61d0('0x55')]({'where':{'id':_0x33549c[_0x61d0('0x46')]['id']}})['then'](handleEntityNotFound(_0x164840,null))[_0x61d0('0x24')](function(_0x31b6ff){if(_0x31b6ff){_0x4681ae[_0x61d0('0x32')]=_[_0x61d0('0x56')](db[_0x61d0('0x5d')]['rawAttributes']);_0x4681ae[_0x61d0('0x33')]=_[_0x61d0('0x56')](_0x33549c['query']);_0x4681ae[_0x61d0('0x34')]=_[_0x61d0('0x35')](_0x4681ae['model'],_0x4681ae[_0x61d0('0x33')]);_0x154892[_0x61d0('0x36')]=_[_0x61d0('0x35')](_0x4681ae[_0x61d0('0x32')],qs[_0x61d0('0x37')](_0x33549c['query'][_0x61d0('0x37')]));_0x154892[_0x61d0('0x36')]=_0x154892[_0x61d0('0x36')][_0x61d0('0x38')]?_0x154892[_0x61d0('0x36')]:_0x4681ae[_0x61d0('0x32')];if(!_0x33549c[_0x61d0('0x33')][_0x61d0('0x39')](_0x61d0('0x3a'))){_0x154892['limit']=qs[_0x61d0('0x1b')](_0x33549c[_0x61d0('0x33')][_0x61d0('0x1b')]);_0x154892[_0x61d0('0x3b')]=qs[_0x61d0('0x3b')](_0x33549c[_0x61d0('0x33')]['offset']);}_0x154892['order']=qs[_0x61d0('0x58')](_0x33549c[_0x61d0('0x33')]['sort']);_0x154892[_0x61d0('0x3d')]=qs[_0x61d0('0x34')](_[_0x61d0('0x59')](_0x33549c['query'],_0x4681ae[_0x61d0('0x34')]));_0x154892[_0x61d0('0x3d')][_0x61d0('0x5a')]=_0x31b6ff['id'];if(_0x33549c[_0x61d0('0x33')][_0x61d0('0x3e')]){_0x154892[_0x61d0('0x3d')]=_['merge'](_0x154892[_0x61d0('0x3d')],{'$or':_[_0x61d0('0x2c')](_0x154892[_0x61d0('0x36')],function(_0x5e5329){var _0x4cbb32={};_0x4cbb32[_0x5e5329]={'$like':'%'+_0x33549c['query']['filter']+'%'};return _0x4cbb32;})});}_0x154892=_['merge']({},_0x154892,_0x33549c[_0x61d0('0x40')]);return db[_0x61d0('0x5d')][_0x61d0('0x1c')]({'where':_0x154892[_0x61d0('0x3d')]})[_0x61d0('0x24')](function(_0x6ae28){_0x3b14b9['count']=_0x6ae28;if(_0x33549c[_0x61d0('0x33')][_0x61d0('0x5b')]){_0x154892['include']=[{'all':!![]}];}return db[_0x61d0('0x5d')][_0x61d0('0x42')](_0x154892);})[_0x61d0('0x24')](function(_0x458476){_0x3b14b9['rows']=_0x458476;return _0x3b14b9;});}})[_0x61d0('0x24')](respondWithFilteredResult(_0x164840,_0x154892))['catch'](handleError(_0x164840,null));};exports[_0x61d0('0x5e')]=function(_0x6c5b43,_0x39b5ee,_0x5ee948){var _0x5d4a97={'raw':!![],'where':{}};var _0x386487={};var _0x580048={'count':0x0,'rows':[]};return db[_0x61d0('0x2d')][_0x61d0('0x55')]({'where':{'id':_0x6c5b43[_0x61d0('0x46')]['id']}})[_0x61d0('0x24')](handleEntityNotFound(_0x39b5ee,null))[_0x61d0('0x24')](function(_0x1a1a12){if(_0x1a1a12){_0x386487[_0x61d0('0x32')]=_[_0x61d0('0x56')](db[_0x61d0('0x5f')][_0x61d0('0x2e')]);_0x386487['query']=_[_0x61d0('0x56')](_0x6c5b43[_0x61d0('0x33')]);_0x386487[_0x61d0('0x34')]=_[_0x61d0('0x35')](_0x386487['model'],_0x386487[_0x61d0('0x33')]);_0x5d4a97['attributes']=_[_0x61d0('0x35')](_0x386487[_0x61d0('0x32')],qs[_0x61d0('0x37')](_0x6c5b43[_0x61d0('0x33')][_0x61d0('0x37')]));_0x5d4a97[_0x61d0('0x36')]=_0x5d4a97[_0x61d0('0x36')][_0x61d0('0x38')]?_0x5d4a97[_0x61d0('0x36')]:_0x386487[_0x61d0('0x32')];if(!_0x6c5b43['query'][_0x61d0('0x39')](_0x61d0('0x3a'))){_0x5d4a97[_0x61d0('0x1b')]=qs[_0x61d0('0x1b')](_0x6c5b43[_0x61d0('0x33')][_0x61d0('0x1b')]);_0x5d4a97[_0x61d0('0x3b')]=qs[_0x61d0('0x3b')](_0x6c5b43['query'][_0x61d0('0x3b')]);}_0x5d4a97['order']=qs['sort'](_0x6c5b43[_0x61d0('0x33')]['sort']);_0x5d4a97[_0x61d0('0x3d')]=qs[_0x61d0('0x34')](_[_0x61d0('0x59')](_0x6c5b43[_0x61d0('0x33')],_0x386487[_0x61d0('0x34')]));_0x5d4a97[_0x61d0('0x3d')][_0x61d0('0x5a')]=_0x1a1a12['id'];if(_0x6c5b43[_0x61d0('0x33')][_0x61d0('0x3e')]){_0x5d4a97['where']=_[_0x61d0('0x3f')](_0x5d4a97[_0x61d0('0x3d')],{'$or':_['map'](_0x5d4a97['attributes'],function(_0x2cd456){var _0x561016={};_0x561016[_0x2cd456]={'$like':'%'+_0x6c5b43[_0x61d0('0x33')]['filter']+'%'};return _0x561016;})});}_0x5d4a97=_['merge']({},_0x5d4a97,_0x6c5b43[_0x61d0('0x40')]);return db['CmHopperBlack'][_0x61d0('0x1c')]({'where':_0x5d4a97[_0x61d0('0x3d')]})[_0x61d0('0x24')](function(_0x5bf567){_0x580048['count']=_0x5bf567;if(_0x6c5b43[_0x61d0('0x33')][_0x61d0('0x5b')]){_0x5d4a97['include']=[{'all':!![]}];}return db[_0x61d0('0x5f')][_0x61d0('0x42')](_0x5d4a97);})[_0x61d0('0x24')](function(_0x2a977d){_0x580048['rows']=_0x2a977d;return _0x580048;});}})[_0x61d0('0x24')](respondWithFilteredResult(_0x39b5ee,_0x5d4a97))[_0x61d0('0x44')](handleError(_0x39b5ee,null));};exports['getLists']=function(_0x2baea5,_0x135feb,_0x2a147f){var _0x2e3465={};var _0x3d8e5d={};var _0x4b7ca7;var _0x704247;return db[_0x61d0('0x2d')]['findOne']({'where':{'id':_0x2baea5[_0x61d0('0x46')]['id']}})[_0x61d0('0x24')](handleEntityNotFound(_0x135feb,null))['then'](function(_0x55b709){if(_0x55b709){_0x4b7ca7=_0x55b709;_0x3d8e5d[_0x61d0('0x32')]=_['keys'](db['CmList']['rawAttributes']);_0x3d8e5d[_0x61d0('0x33')]=_[_0x61d0('0x56')](_0x2baea5[_0x61d0('0x33')]);_0x3d8e5d[_0x61d0('0x34')]=_['intersection'](_0x3d8e5d[_0x61d0('0x32')],_0x3d8e5d[_0x61d0('0x33')]);_0x2e3465['attributes']=_[_0x61d0('0x35')](_0x3d8e5d[_0x61d0('0x32')],qs[_0x61d0('0x37')](_0x2baea5['query'][_0x61d0('0x37')]));_0x2e3465[_0x61d0('0x36')]=_0x2e3465[_0x61d0('0x36')][_0x61d0('0x38')]?_0x2e3465[_0x61d0('0x36')]:_0x3d8e5d[_0x61d0('0x32')];_0x2e3465[_0x61d0('0x3c')]=qs['sort'](_0x2baea5[_0x61d0('0x33')]['sort']);_0x2e3465[_0x61d0('0x3d')]=qs[_0x61d0('0x34')](_[_0x61d0('0x59')](_0x2baea5['query'],_0x3d8e5d[_0x61d0('0x34')]));if(_0x2baea5['query']['filter']){_0x2e3465['where']=_[_0x61d0('0x3f')](_0x2e3465[_0x61d0('0x3d')],{'$or':_[_0x61d0('0x2c')](_0x2e3465[_0x61d0('0x36')],function(_0x20f31a){var _0x57a324={};_0x57a324[_0x20f31a]={'$like':'%'+_0x2baea5[_0x61d0('0x33')][_0x61d0('0x3e')]+'%'};return _0x57a324;})});}_0x2e3465=_['merge']({},_0x2e3465,_0x2baea5[_0x61d0('0x40')]);return _0x4b7ca7[_0x61d0('0x60')](_0x2e3465);}})[_0x61d0('0x24')](function(_0x173c35){if(_0x173c35){_0x704247=_0x173c35[_0x61d0('0x38')];if(!_0x2baea5['query'][_0x61d0('0x39')](_0x61d0('0x3a'))){_0x2e3465[_0x61d0('0x1b')]=qs[_0x61d0('0x1b')](_0x2baea5[_0x61d0('0x33')][_0x61d0('0x1b')]);_0x2e3465[_0x61d0('0x3b')]=qs[_0x61d0('0x3b')](_0x2baea5['query'][_0x61d0('0x3b')]);}return _0x4b7ca7['getLists'](_0x2e3465);}})[_0x61d0('0x24')](function(_0x5aab85){if(_0x5aab85){return _0x5aab85?{'count':_0x704247,'rows':_0x5aab85}:null;}})[_0x61d0('0x24')](respondWithResult(_0x135feb,null))[_0x61d0('0x44')](handleError(_0x135feb,null));};exports[_0x61d0('0x61')]=function(_0xfe186a,_0x57bc9b,_0x2f56dd){var _0x6d06ec,_0x5a872b;return db[_0x61d0('0x2d')][_0x61d0('0x47')]({'where':{'id':_0xfe186a['params']['id']}})[_0x61d0('0x24')](handleEntityNotFound(_0x57bc9b,null))[_0x61d0('0x24')](function(_0x4d07da){if(_0x4d07da){_0x5a872b=_0x4d07da;return _0x4d07da['addLists'](_0xfe186a[_0x61d0('0x49')][_0x61d0('0x62')],_[_0x61d0('0x52')](_0xfe186a['body'],[_0x61d0('0x62'),'id'])||{});}return null;})['spread'](function(_0x39a50f){var _0x2f9a60;_0x6d06ec=_0x39a50f||[];var _0x4ef981=[];if(_0x39a50f){for(var _0x2f49d6=0x0;_0x2f49d6<_0x39a50f[_0x61d0('0x38')];_0x2f49d6+=0x1){var _0x206985=_0x39a50f[_0x2f49d6][_0x61d0('0x26')]({'plain':!![]});_0x5a872b[_0x61d0('0x63')]=_0xfe186a[_0x61d0('0x49')]['dialCheckDuplicateType']?_0xfe186a[_0x61d0('0x49')][_0x61d0('0x63')]:_0x5a872b[_0x61d0('0x63')];switch(_0x5a872b['dialCheckDuplicateType']){case _0x61d0('0x64'):_0x2f9a60=squel[_0x61d0('0x65')]()[_0x61d0('0x66')](_0x61d0('0x67'))[_0x61d0('0x68')]([_0x61d0('0x69'),_0x61d0('0x6a'),_0x61d0('0x6b'),_0x61d0('0x6c'),_0x61d0('0x5a'),_0x61d0('0x50'),_0x61d0('0x51')],squel[_0x61d0('0x6d')]()[_0x61d0('0x6e')]('phone','phone')[_0x61d0('0x6e')](_0x61d0('0x6f'),_0x61d0('0x6a'))[_0x61d0('0x6e')]('id',_0x61d0('0x6b'))[_0x61d0('0x6e')](_0x206985[_0x61d0('0x70')][_0x61d0('0x71')](),_0x61d0('0x6c'))['field'](_0xfe186a[_0x61d0('0x46')]['id'][_0x61d0('0x71')](),'CampaignId')[_0x61d0('0x6e')](_0x61d0('0x6f'),'createdAt')[_0x61d0('0x6e')](_0x61d0('0x6f'),_0x61d0('0x51'))[_0x61d0('0x72')](_0x61d0('0x73'))[_0x61d0('0x3d')]('deletedAt\x20IS\x20NULL')[_0x61d0('0x3d')]('ListId\x20=\x20?',_0x206985[_0x61d0('0x70')][_0x61d0('0x71')]())[_0x61d0('0x3d')](_0x61d0('0x74'))[_0x61d0('0x3d')](_0x61d0('0x75'),squel['select']()[_0x61d0('0x6e')](_0x61d0('0x76'))[_0x61d0('0x72')](_0x61d0('0x77'))[_0x61d0('0x3d')](_0x61d0('0x78'),_0xfe186a[_0x61d0('0x46')]['id'][_0x61d0('0x71')]()))['where'](_0x61d0('0x75'),squel[_0x61d0('0x6d')]()[_0x61d0('0x6e')]('COALESCE(phone,\x27\x27)')['from'](_0x61d0('0x67'))[_0x61d0('0x3d')](_0x61d0('0x78'),_0xfe186a[_0x61d0('0x46')]['id'][_0x61d0('0x71')]())))[_0x61d0('0x71')]();break;case _0x61d0('0x79'):_0x2f9a60=squel[_0x61d0('0x65')]()[_0x61d0('0x66')](_0x61d0('0x67'))['fromQuery']([_0x61d0('0x69'),_0x61d0('0x6a'),'ContactId','ListId',_0x61d0('0x5a'),'createdAt',_0x61d0('0x51')],squel['select']()['field']('phone',_0x61d0('0x69'))['field'](_0x61d0('0x6f'),_0x61d0('0x6a'))[_0x61d0('0x6e')]('id',_0x61d0('0x6b'))[_0x61d0('0x6e')](_0x206985[_0x61d0('0x70')]['toString'](),_0x61d0('0x6c'))['field'](_0xfe186a[_0x61d0('0x46')]['id'][_0x61d0('0x71')](),'CampaignId')['field'](_0x61d0('0x6f'),'createdAt')[_0x61d0('0x6e')](_0x61d0('0x6f'),'updatedAt')[_0x61d0('0x72')](_0x61d0('0x73'))[_0x61d0('0x3d')]('deletedAt\x20IS\x20NULL')[_0x61d0('0x3d')]('ListId\x20=\x20?',_0x206985['CmListId'][_0x61d0('0x71')]())[_0x61d0('0x3d')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x61d0('0x6d')]()['field']('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x61d0('0x3d')]('CampaignId\x20=\x20?',_0xfe186a[_0x61d0('0x46')]['id'][_0x61d0('0x71')]())))[_0x61d0('0x71')]();break;default:_0x2f9a60=squel[_0x61d0('0x65')]()[_0x61d0('0x66')](_0x61d0('0x67'))[_0x61d0('0x68')]([_0x61d0('0x69'),_0x61d0('0x6a'),_0x61d0('0x6b'),_0x61d0('0x6c'),_0x61d0('0x5a'),_0x61d0('0x50'),'updatedAt'],squel['select']()[_0x61d0('0x6e')](_0x61d0('0x69'),_0x61d0('0x69'))[_0x61d0('0x6e')](_0x61d0('0x6f'),'scheduledAt')[_0x61d0('0x6e')]('id',_0x61d0('0x6b'))['field'](_0x206985[_0x61d0('0x70')]['toString'](),'ListId')['field'](_0xfe186a[_0x61d0('0x46')]['id'][_0x61d0('0x71')](),_0x61d0('0x5a'))[_0x61d0('0x6e')]('NOW()',_0x61d0('0x50'))[_0x61d0('0x6e')](_0x61d0('0x6f'),'updatedAt')[_0x61d0('0x72')](_0x61d0('0x73'))[_0x61d0('0x3d')](_0x61d0('0x7a'))[_0x61d0('0x3d')]('ListId\x20=\x20?',_0x206985[_0x61d0('0x70')][_0x61d0('0x71')]())[_0x61d0('0x3d')](_0x61d0('0x74')))[_0x61d0('0x71')]();}_0x4ef981[_0x61d0('0x7b')](db['sequelize'][_0x61d0('0x33')](_0x2f9a60));}return BPromise[_0x61d0('0x7c')](_0x4ef981);}})[_0x61d0('0x24')](function(){return _0x6d06ec;})[_0x61d0('0x24')](respondWithResult(_0x57bc9b,null))['catch'](handleError(_0x57bc9b,null));};exports[_0x61d0('0x7d')]=function(_0x1ddb2a,_0x938bb1,_0x30311a){return db[_0x61d0('0x2d')][_0x61d0('0x47')]({'where':{'id':_0x1ddb2a[_0x61d0('0x46')]['id']}})['then'](handleEntityNotFound(_0x938bb1,null))['then'](function(_0x22f1a2){if(_0x22f1a2){return _0x22f1a2['removeLists'](_0x1ddb2a[_0x61d0('0x33')][_0x61d0('0x62')]);}})[_0x61d0('0x24')](function(_0x56733f){if(_0x56733f){return db[_0x61d0('0x57')][_0x61d0('0x25')]({'where':{'ListId':_0x1ddb2a[_0x61d0('0x33')][_0x61d0('0x62')],'CampaignId':_0x1ddb2a[_0x61d0('0x46')]['id']}})[_0x61d0('0x24')](function(){return _0x56733f;});}})[_0x61d0('0x24')](respondWithStatusCode(_0x938bb1,null))[_0x61d0('0x44')](handleError(_0x938bb1,null));};exports[_0x61d0('0x7e')]=function(_0x293666,_0xabb03f,_0x5ec107){var _0x2a7d50={};var _0x474d58={};var _0xf335cc;var _0x4143b1;return db[_0x61d0('0x2d')][_0x61d0('0x55')]({'where':{'id':_0x293666[_0x61d0('0x46')]['id']}})['then'](handleEntityNotFound(_0xabb03f,null))[_0x61d0('0x24')](function(_0x3e994f){if(_0x3e994f){_0xf335cc=_0x3e994f;_0x474d58['model']=_[_0x61d0('0x56')](db[_0x61d0('0x7f')][_0x61d0('0x2e')]);_0x474d58[_0x61d0('0x33')]=_[_0x61d0('0x56')](_0x293666[_0x61d0('0x33')]);_0x474d58[_0x61d0('0x34')]=_['intersection'](_0x474d58[_0x61d0('0x32')],_0x474d58[_0x61d0('0x33')]);_0x2a7d50[_0x61d0('0x36')]=_['intersection'](_0x474d58[_0x61d0('0x32')],qs['fields'](_0x293666[_0x61d0('0x33')][_0x61d0('0x37')]));_0x2a7d50['attributes']=_0x2a7d50[_0x61d0('0x36')][_0x61d0('0x38')]?_0x2a7d50[_0x61d0('0x36')]:_0x474d58['model'];_0x2a7d50[_0x61d0('0x3c')]=qs[_0x61d0('0x58')](_0x293666['query'][_0x61d0('0x58')]);_0x2a7d50[_0x61d0('0x3d')]=qs[_0x61d0('0x34')](_['pick'](_0x293666[_0x61d0('0x33')],_0x474d58[_0x61d0('0x34')]));if(_0x293666[_0x61d0('0x33')][_0x61d0('0x3e')]){_0x2a7d50[_0x61d0('0x3d')]=_[_0x61d0('0x3f')](_0x2a7d50[_0x61d0('0x3d')],{'$or':_['map'](_0x2a7d50[_0x61d0('0x36')],function(_0xf64c0){var _0x208e65={};_0x208e65[_0xf64c0]={'$like':'%'+_0x293666['query']['filter']+'%'};return _0x208e65;})});}_0x2a7d50=_['merge']({},_0x2a7d50,_0x293666[_0x61d0('0x40')]);return _0xf335cc[_0x61d0('0x7e')](_0x2a7d50);}})[_0x61d0('0x24')](function(_0x333046){if(_0x333046){_0x4143b1=_0x333046[_0x61d0('0x38')];if(!_0x293666[_0x61d0('0x33')]['hasOwnProperty']('nolimit')){_0x2a7d50[_0x61d0('0x1b')]=qs[_0x61d0('0x1b')](_0x293666[_0x61d0('0x33')][_0x61d0('0x1b')]);_0x2a7d50[_0x61d0('0x3b')]=qs[_0x61d0('0x3b')](_0x293666[_0x61d0('0x33')][_0x61d0('0x3b')]);}return _0xf335cc[_0x61d0('0x7e')](_0x2a7d50);}})[_0x61d0('0x24')](function(_0x9096b7){if(_0x9096b7){return _0x9096b7?{'count':_0x4143b1,'rows':_0x9096b7}:null;}})['then'](respondWithResult(_0xabb03f,null))[_0x61d0('0x44')](handleError(_0xabb03f,null));};exports[_0x61d0('0x80')]=function(_0x5af753,_0x493cb1,_0x17d326){var _0x3cb01d,_0x467b0f;return db[_0x61d0('0x2d')][_0x61d0('0x47')]({'where':{'id':_0x5af753[_0x61d0('0x46')]['id']}})[_0x61d0('0x24')](handleEntityNotFound(_0x493cb1,null))['then'](function(_0x10ba44){if(_0x10ba44){_0x467b0f=_0x10ba44;return _0x10ba44[_0x61d0('0x80')](_0x5af753[_0x61d0('0x49')][_0x61d0('0x62')],_[_0x61d0('0x52')](_0x5af753[_0x61d0('0x49')],[_0x61d0('0x62'),'id'])||{});}return null;})[_0x61d0('0x81')](function(_0x1fd4b5){var _0x585957;_0x3cb01d=_0x1fd4b5||[];var _0x3e6f5=[];if(_0x1fd4b5){for(var _0x2676ed=0x0;_0x2676ed<_0x1fd4b5[_0x61d0('0x38')];_0x2676ed+=0x1){var _0x4c8b93=_0x1fd4b5[_0x2676ed][_0x61d0('0x26')]({'plain':!![]});_0x585957=squel[_0x61d0('0x65')]()[_0x61d0('0x66')](_0x61d0('0x82'))['fromQuery']([_0x61d0('0x69'),_0x61d0('0x6b'),_0x61d0('0x6c'),_0x61d0('0x5a'),_0x61d0('0x50'),'updatedAt'],squel['select']()[_0x61d0('0x6e')](_0x61d0('0x69'),_0x61d0('0x69'))[_0x61d0('0x6e')]('id','ContactId')['field'](_0x4c8b93[_0x61d0('0x70')][_0x61d0('0x71')](),'ListId')[_0x61d0('0x6e')](_0x5af753['params']['id'][_0x61d0('0x71')](),'CampaignId')['field'](_0x61d0('0x6f'),'createdAt')[_0x61d0('0x6e')]('NOW()',_0x61d0('0x51'))[_0x61d0('0x72')](_0x61d0('0x73'))[_0x61d0('0x3d')]('deletedAt\x20IS\x20NULL')[_0x61d0('0x3d')](_0x61d0('0x83'),_0x4c8b93['CmListId'][_0x61d0('0x71')]())[_0x61d0('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0x61d0('0x71')]();_0x3e6f5[_0x61d0('0x7b')](db[_0x61d0('0x84')][_0x61d0('0x33')](_0x585957));}return BPromise['all'](_0x3e6f5);}})[_0x61d0('0x24')](function(){return _0x3cb01d;})['then'](respondWithResult(_0x493cb1,null))[_0x61d0('0x44')](handleError(_0x493cb1,null));};exports[_0x61d0('0x85')]=function(_0x5bf9c7,_0xc69444,_0x53592a){return db['Campaign'][_0x61d0('0x47')]({'where':{'id':_0x5bf9c7[_0x61d0('0x46')]['id']}})[_0x61d0('0x24')](handleEntityNotFound(_0xc69444,null))[_0x61d0('0x24')](function(_0x5e43f9){if(_0x5e43f9){return _0x5e43f9['removeBlackLists'](_0x5bf9c7[_0x61d0('0x33')][_0x61d0('0x62')]);}})[_0x61d0('0x24')](function(_0x5bc1dd){if(_0x5bc1dd){return db[_0x61d0('0x5f')][_0x61d0('0x25')]({'where':{'ListId':_0x5bf9c7[_0x61d0('0x33')][_0x61d0('0x62')],'CampaignId':_0x5bf9c7['params']['id']}})['then'](function(){return _0x5bc1dd;});}})['then'](respondWithStatusCode(_0xc69444,null))[_0x61d0('0x44')](handleError(_0xc69444,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 0e996b3..9014d89 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0xd7b331,_0x23f99d){var _0x225ef9=function(_0x3ac16a){while(--_0x3ac16a){_0xd7b331['push'](_0xd7b331['shift']());}};_0x225ef9(++_0x23f99d);}(_0x7a54,0x106));var _0x47a5=function(_0x5483b4,_0x17c75b){_0x5483b4=_0x5483b4-0x0;var _0x3cf446=_0x7a54[_0x5483b4];return _0x3cf446;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0xf1d988,_0x341f87){var _0x264fa0=function(_0x37f308){while(--_0x37f308){_0xf1d988['push'](_0xf1d988['shift']());}};_0x264fa0(++_0x341f87);}(_0x7a54,0x106));var _0x47a5=function(_0x2c432b,_0x207ea1){_0x2c432b=_0x2c432b-0x0;var _0x20db52=_0x7a54[_0x2c432b];return _0x20db52;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 28b1842..be49131 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 _0x44f8=['raw','where','attributes','limit','include','map','model','then','GetCampaign','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','client','http','request\x20sent','error','Campaign,\x20%s,\x20%s','message','result','catch','options'];(function(_0x5bc7e1,_0x426f14){var _0xe13825=function(_0x25ce71){while(--_0x25ce71){_0x5bc7e1['push'](_0x5bc7e1['shift']());}};_0xe13825(++_0x426f14);}(_0x44f8,0x1de));var _0x844f=function(_0x49a95f,_0x1da410){_0x49a95f=_0x49a95f-0x0;var _0x25ef48=_0x44f8[_0x49a95f];return _0x25ef48;};'use strict';var _=require(_0x844f('0x0'));var util=require(_0x844f('0x1'));var moment=require(_0x844f('0x2'));var BPromise=require(_0x844f('0x3'));var rs=require(_0x844f('0x4'));var fs=require('fs');var Redis=require(_0x844f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x844f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x844f('0x7')][_0x844f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46eb2c,_0x38a334,_0x37b697){return new BPromise(function(_0x1987a9,_0x188f88){return client['request'](_0x46eb2c,_0x37b697)['then'](function(_0x39416d){logger['info']('Campaign,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x38a334,'request\x20sent',JSON['stringify'](_0x39416d));if(_0x39416d[_0x844f('0xa')]){if(_0x39416d[_0x844f('0xa')]['code']===0x1f4){logger[_0x844f('0xa')](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')]['message']);return _0x188f88(_0x39416d['error'][_0x844f('0xc')]);}logger['error'](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);return _0x1987a9(_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));_0x1987a9(_0x39416d[_0x844f('0xd')][_0x844f('0xc')]);}})[_0x844f('0xe')](function(_0x4f7ce4){logger[_0x844f('0xa')]('Campaign,\x20%s,\x20%s',_0x38a334,_0x4f7ce4);_0x188f88(_0x4f7ce4);});});}exports['GetCampaign']=function(_0x1f96d0){var _0x2cca8e=this;return new Promise(function(_0x5cc55c,_0x24e386){return db['Campaign']['findAll']({'raw':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0['options'][_0x844f('0x10')]===undefined?!![]:![]:!![],'where':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0[_0x844f('0xf')][_0x844f('0x11')]||null:null,'attributes':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0['options'][_0x844f('0x12')]||null:null,'limit':_0x1f96d0['options']?_0x1f96d0['options'][_0x844f('0x13')]||null:null,'include':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0[_0x844f('0xf')][_0x844f('0x14')]?_[_0x844f('0x15')](_0x1f96d0['options'][_0x844f('0x14')],function(_0x4bd66d){return{'model':db[_0x4bd66d[_0x844f('0x16')]],'as':_0x4bd66d['as'],'attributes':_0x4bd66d['attributes'],'include':_0x4bd66d[_0x844f('0x14')]?_[_0x844f('0x15')](_0x4bd66d[_0x844f('0x14')],function(_0x7dc0c9){return{'model':db[_0x7dc0c9[_0x844f('0x16')]],'as':_0x7dc0c9['as'],'attributes':_0x7dc0c9[_0x844f('0x12')],'include':_0x7dc0c9[_0x844f('0x14')]?_['map'](_0x7dc0c9[_0x844f('0x14')],function(_0x16d7ad){return{'model':db[_0x16d7ad[_0x844f('0x16')]],'as':_0x16d7ad['as'],'attributes':_0x16d7ad[_0x844f('0x12')]};}):[]};}):[]};}):[]:[]})[_0x844f('0x17')](function(_0x29d224){logger['info'](_0x844f('0x18'),_0x1f96d0);logger[_0x844f('0x19')](_0x844f('0x18'),_0x1f96d0,JSON['stringify'](_0x29d224));_0x5cc55c(_0x29d224);})['catch'](function(_0x1e243c){logger[_0x844f('0xa')](_0x844f('0x18'),_0x1e243c['message'],_0x1f96d0);_0x24e386(_0x2cca8e[_0x844f('0xa')](0x1f4,_0x1e243c['message']));});});}; \ No newline at end of file +var _0x9ef8=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','model','map','debug','lodash'];(function(_0x40df5f,_0x8fd59f){var _0x1573f1=function(_0x57b8b8){while(--_0x57b8b8){_0x40df5f['push'](_0x40df5f['shift']());}};_0x1573f1(++_0x8fd59f);}(_0x9ef8,0x17f));var _0x89ef=function(_0x3a2e49,_0x21ebea){_0x3a2e49=_0x3a2e49-0x0;var _0x257140=_0x9ef8[_0x3a2e49];return _0x257140;};'use strict';var _=require(_0x89ef('0x0'));var util=require(_0x89ef('0x1'));var moment=require('moment');var BPromise=require(_0x89ef('0x2'));var rs=require(_0x89ef('0x3'));var fs=require('fs');var Redis=require(_0x89ef('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x89ef('0x5'));var logger=require(_0x89ef('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x89ef('0x7')][_0x89ef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24439e,_0x90b5bf,_0x46c0da){return new BPromise(function(_0x373288,_0x16e8c3){return client[_0x89ef('0x9')](_0x24439e,_0x46c0da)[_0x89ef('0xa')](function(_0x5683b6){logger[_0x89ef('0xb')](_0x89ef('0xc'),_0x90b5bf,_0x89ef('0xd'));logger['debug'](_0x89ef('0xe'),_0x90b5bf,_0x89ef('0xd'),JSON[_0x89ef('0xf')](_0x5683b6));if(_0x5683b6[_0x89ef('0x10')]){if(_0x5683b6[_0x89ef('0x10')]['code']===0x1f4){logger[_0x89ef('0x10')]('Campaign,\x20%s,\x20%s',_0x90b5bf,_0x5683b6[_0x89ef('0x10')][_0x89ef('0x11')]);return _0x16e8c3(_0x5683b6['error'][_0x89ef('0x11')]);}logger[_0x89ef('0x10')](_0x89ef('0xc'),_0x90b5bf,_0x5683b6[_0x89ef('0x10')][_0x89ef('0x11')]);return _0x373288(_0x5683b6['error'][_0x89ef('0x11')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x90b5bf,_0x89ef('0xd'));_0x373288(_0x5683b6[_0x89ef('0x12')]['message']);}})[_0x89ef('0x13')](function(_0x490877){logger[_0x89ef('0x10')]('Campaign,\x20%s,\x20%s',_0x90b5bf,_0x490877);_0x16e8c3(_0x490877);});});}exports[_0x89ef('0x14')]=function(_0x2c5f51){var _0x2aa140=this;return new Promise(function(_0x1189d7,_0x5e3aed){return db[_0x89ef('0x15')][_0x89ef('0x16')]({'raw':_0x2c5f51[_0x89ef('0x17')]?_0x2c5f51[_0x89ef('0x17')][_0x89ef('0x18')]===undefined?!![]:![]:!![],'where':_0x2c5f51[_0x89ef('0x17')]?_0x2c5f51[_0x89ef('0x17')][_0x89ef('0x19')]||null:null,'attributes':_0x2c5f51[_0x89ef('0x17')]?_0x2c5f51[_0x89ef('0x17')][_0x89ef('0x1a')]||null:null,'limit':_0x2c5f51[_0x89ef('0x17')]?_0x2c5f51[_0x89ef('0x17')][_0x89ef('0x1b')]||null:null,'include':_0x2c5f51[_0x89ef('0x17')]?_0x2c5f51[_0x89ef('0x17')][_0x89ef('0x1c')]?_['map'](_0x2c5f51['options']['include'],function(_0x5c9242){return{'model':db[_0x5c9242[_0x89ef('0x1d')]],'as':_0x5c9242['as'],'attributes':_0x5c9242[_0x89ef('0x1a')],'include':_0x5c9242['include']?_['map'](_0x5c9242[_0x89ef('0x1c')],function(_0x10bb22){return{'model':db[_0x10bb22['model']],'as':_0x10bb22['as'],'attributes':_0x10bb22['attributes'],'include':_0x10bb22[_0x89ef('0x1c')]?_[_0x89ef('0x1e')](_0x10bb22[_0x89ef('0x1c')],function(_0x3efb34){return{'model':db[_0x3efb34[_0x89ef('0x1d')]],'as':_0x3efb34['as'],'attributes':_0x3efb34[_0x89ef('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x89ef('0xa')](function(_0x5e8108){logger[_0x89ef('0xb')](_0x89ef('0x14'),_0x2c5f51);logger[_0x89ef('0x1f')](_0x89ef('0x14'),_0x2c5f51,JSON['stringify'](_0x5e8108));_0x1189d7(_0x5e8108);})['catch'](function(_0x51245a){logger[_0x89ef('0x10')](_0x89ef('0x14'),_0x51245a['message'],_0x2c5f51);_0x5e3aed(_0x2aa140[_0x89ef('0x10')](0x1f4,_0x51245a[_0x89ef('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 2230905..54a7fa4 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 _0xe87a=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addLists','addBlackLists','put','/:id','update','delete','destroy','removeLists','removeBlackLists','exports','util'];(function(_0x34a729,_0x3818d6){var _0x12025f=function(_0x4e56ab){while(--_0x4e56ab){_0x34a729['push'](_0x34a729['shift']());}};_0x12025f(++_0x3818d6);}(_0xe87a,0xed));var _0xae87=function(_0x4768cf,_0x57507d){_0x4768cf=_0x4768cf-0x0;var _0x244752=_0xe87a[_0x4768cf];return _0x244752;};'use strict';var multer=require('multer');var util=require(_0xae87('0x0'));var path=require(_0xae87('0x1'));var timeout=require(_0xae87('0x2'));var express=require(_0xae87('0x3'));var router=express[_0xae87('0x4')]();var fs_extra=require(_0xae87('0x5'));var auth=require(_0xae87('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xae87('0x7'));var controller=require('./campaign.controller');router[_0xae87('0x8')]('/',auth[_0xae87('0x9')](),controller['index']);router[_0xae87('0x8')]('/:id',auth[_0xae87('0x9')](),controller[_0xae87('0xa')]);router['get']('/:id/hoppers',auth['isAuthenticated'](),controller['getHoppers']);router[_0xae87('0x8')](_0xae87('0xb'),auth['isAuthenticated'](),controller[_0xae87('0xc')]);router[_0xae87('0x8')](_0xae87('0xd'),auth[_0xae87('0x9')](),controller[_0xae87('0xe')]);router[_0xae87('0x8')](_0xae87('0xf'),auth[_0xae87('0x9')](),controller['getHopperBlacks']);router[_0xae87('0x8')](_0xae87('0x10'),auth[_0xae87('0x9')](),controller[_0xae87('0x11')]);router[_0xae87('0x8')](_0xae87('0x12'),auth['isAuthenticated'](),controller[_0xae87('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xae87('0x14')]);router[_0xae87('0x15')](_0xae87('0x16'),auth['isAuthenticated'](),controller[_0xae87('0x17')]);router[_0xae87('0x15')](_0xae87('0x10'),auth[_0xae87('0x9')](),controller[_0xae87('0x18')]);router[_0xae87('0x15')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xae87('0x19')]);router[_0xae87('0x1a')](_0xae87('0x1b'),auth[_0xae87('0x9')](),controller[_0xae87('0x1c')]);router[_0xae87('0x1d')](_0xae87('0x1b'),auth['isAuthenticated'](),controller[_0xae87('0x1e')]);router['delete'](_0xae87('0x10'),auth[_0xae87('0x9')](),controller[_0xae87('0x1f')]);router['delete'](_0xae87('0x12'),auth[_0xae87('0x9')](),controller[_0xae87('0x20')]);module[_0xae87('0x21')]=router; \ No newline at end of file +var _0xde9d=['/:id/blacklists','post','create','/:id/clone','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','/:id/lists'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xde9d,0x156));var _0xdde9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde9d[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xdde9('0x0'));var util=require(_0xdde9('0x1'));var path=require(_0xdde9('0x2'));var timeout=require(_0xdde9('0x3'));var express=require(_0xdde9('0x4'));var router=express['Router']();var fs_extra=require(_0xdde9('0x5'));var auth=require(_0xdde9('0x6'));var interaction=require(_0xdde9('0x7'));var config=require('../../config/environment');var controller=require(_0xdde9('0x8'));router[_0xdde9('0x9')]('/',auth[_0xdde9('0xa')](),controller['index']);router[_0xdde9('0x9')](_0xdde9('0xb'),auth[_0xdde9('0xa')](),controller[_0xdde9('0xc')]);router[_0xdde9('0x9')]('/:id/hoppers',auth[_0xdde9('0xa')](),controller['getHoppers']);router['get'](_0xdde9('0xd'),auth[_0xdde9('0xa')](),controller[_0xdde9('0xe')]);router['get'](_0xdde9('0xf'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0xdde9('0x9')](_0xdde9('0x10'),auth[_0xdde9('0xa')](),controller['getHopperBlacks']);router['get'](_0xdde9('0x11'),auth[_0xdde9('0xa')](),controller['getLists']);router['get'](_0xdde9('0x12'),auth[_0xdde9('0xa')](),controller['getBlackLists']);router[_0xdde9('0x13')]('/',auth[_0xdde9('0xa')](),controller[_0xdde9('0x14')]);router['post'](_0xdde9('0x15'),auth['isAuthenticated'](),controller['clone']);router[_0xdde9('0x13')]('/:id/lists',auth['isAuthenticated'](),controller['addLists']);router[_0xdde9('0x13')](_0xdde9('0x12'),auth[_0xdde9('0xa')](),controller[_0xdde9('0x16')]);router[_0xdde9('0x17')](_0xdde9('0xb'),auth[_0xdde9('0xa')](),controller[_0xdde9('0x18')]);router[_0xdde9('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xdde9('0x1a')]);router[_0xdde9('0x19')](_0xdde9('0x11'),auth[_0xdde9('0xa')](),controller[_0xdde9('0x1b')]);router[_0xdde9('0x19')](_0xdde9('0x12'),auth['isAuthenticated'](),controller[_0xdde9('0x1c')]);module[_0xdde9('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index a0b496d..abe2b7b 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 _0x22bf=['exports','STRING','VIRTUAL','getDataValue'];(function(_0x57cc7a,_0x1e738d){var _0x5d6159=function(_0xb455d5){while(--_0xb455d5){_0x57cc7a['push'](_0x57cc7a['shift']());}};_0x5d6159(++_0x1e738d);}(_0x22bf,0x6c));var _0xf22b=function(_0x300af4,_0x21cb7c){_0x300af4=_0x300af4-0x0;var _0x4f6d78=_0x22bf[_0x300af4];return _0x4f6d78;};'use strict';var Sequelize=require('sequelize');module[_0xf22b('0x0')]={'key':{'type':Sequelize[_0xf22b('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xf22b('0x2')],'get':function(){return this[_0xf22b('0x3')]('key');}}}; \ No newline at end of file +var _0x2f16=['getDataValue','key','sequelize','STRING','VIRTUAL'];(function(_0x4b956e,_0x2d53d8){var _0x31037a=function(_0x291113){while(--_0x291113){_0x4b956e['push'](_0x4b956e['shift']());}};_0x31037a(++_0x2d53d8);}(_0x2f16,0x165));var _0x62f1=function(_0x4201b9,_0x112d90){_0x4201b9=_0x4201b9-0x0;var _0x4fc0a2=_0x2f16[_0x4201b9];return _0x4fc0a2;};'use strict';var Sequelize=require(_0x62f1('0x0'));module['exports']={'key':{'type':Sequelize[_0x62f1('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x62f1('0x1')]},'name':{'type':Sequelize[_0x62f1('0x2')],'get':function(){return this[_0x62f1('0x3')](_0x62f1('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 355c79f..c0c8e69 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 _0xa828=['update','then','destroy','get','CannedAnswers','UserProfileResource','error','name','send','index','CannedAnswer','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','includeAll','include','findAll','keys','length','options','find','catch','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save'];(function(_0x421e36,_0x18776e){var _0x20b3e3=function(_0x767de4){while(--_0x767de4){_0x421e36['push'](_0x421e36['shift']());}};_0x20b3e3(++_0x18776e);}(_0xa828,0x1e0));var _0x8a82=function(_0x1281a2,_0x431b4c){_0x1281a2=_0x1281a2-0x0;var _0x3c674e=_0xa828[_0x1281a2];return _0x3c674e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8a82('0x0'));var jsonpatch=require(_0x8a82('0x1'));var rp=require('request-promise');var moment=require(_0x8a82('0x2'));var BPromise=require(_0x8a82('0x3'));var Mustache=require(_0x8a82('0x4'));var util=require('util');var path=require(_0x8a82('0x5'));var sox=require(_0x8a82('0x6'));var csv=require(_0x8a82('0x7'));var ejs=require(_0x8a82('0x8'));var fs=require('fs');var fs_extra=require(_0x8a82('0x9'));var _=require('lodash');var squel=require(_0x8a82('0xa'));var crypto=require(_0x8a82('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8a82('0xc'));var toCsv=require(_0x8a82('0x7'));var querystring=require('querystring');var Papa=require(_0x8a82('0xd'));var Redis=require(_0x8a82('0xe'));var authService=require(_0x8a82('0xf'));var qs=require(_0x8a82('0x10'));var as=require(_0x8a82('0x11'));var hardwareService=require(_0x8a82('0x12'));var logger=require(_0x8a82('0x13'))(_0x8a82('0x14'));var utils=require(_0x8a82('0x15'));var config=require(_0x8a82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8a82('0x17'))['db'];function respondWithStatusCode(_0x35495e,_0x33ee79){_0x33ee79=_0x33ee79||0xcc;return function(_0x266a79){if(_0x266a79){return _0x35495e[_0x8a82('0x18')](_0x33ee79);}return _0x35495e[_0x8a82('0x19')](_0x33ee79)[_0x8a82('0x1a')]();};}function respondWithResult(_0x3e0cfb,_0x52e4fe){_0x52e4fe=_0x52e4fe||0xc8;return function(_0x1bb8b4){if(_0x1bb8b4){return _0x3e0cfb[_0x8a82('0x19')](_0x52e4fe)['json'](_0x1bb8b4);}};}function respondWithFilteredResult(_0x27b8af,_0x56a570){return function(_0x121298){if(_0x121298){var _0x32c9bc=typeof _0x56a570[_0x8a82('0x1b')]==='undefined'&&typeof _0x56a570['limit']===_0x8a82('0x1c');var _0x3e6184=_0x121298[_0x8a82('0x1d')];var _0x19a04d=_0x32c9bc?0x0:_0x56a570['offset'];var _0x3d6e24=_0x32c9bc?_0x121298[_0x8a82('0x1d')]:_0x56a570['offset']+_0x56a570[_0x8a82('0x1e')];var _0x128e90;if(_0x3d6e24>=_0x3e6184){_0x3d6e24=_0x3e6184;_0x128e90=0xc8;}else{_0x128e90=0xce;}_0x27b8af[_0x8a82('0x19')](_0x128e90);return _0x27b8af[_0x8a82('0x1f')](_0x8a82('0x20'),_0x19a04d+'-'+_0x3d6e24+'/'+_0x3e6184)[_0x8a82('0x21')](_0x121298);}return null;};}function patchUpdates(_0x59d23a){return function(_0x5591f0){try{jsonpatch[_0x8a82('0x22')](_0x5591f0,_0x59d23a,!![]);}catch(_0x22e87b){return BPromise['reject'](_0x22e87b);}return _0x5591f0[_0x8a82('0x23')]();};}function saveUpdates(_0x14f9e0,_0x5cae95){return function(_0x1d1019){if(_0x1d1019){return _0x1d1019[_0x8a82('0x24')](_0x14f9e0)[_0x8a82('0x25')](function(_0x5a8717){return _0x5a8717;});}return null;};}function removeEntity(_0x49a2e2,_0x4ac248){return function(_0x57e9e2){if(_0x57e9e2){return _0x57e9e2[_0x8a82('0x26')]()[_0x8a82('0x25')](function(){var _0x1fceb1=_0x57e9e2[_0x8a82('0x27')]({'plain':!![]});var _0x5672cd=_0x8a82('0x28');return db[_0x8a82('0x29')][_0x8a82('0x26')]({'where':{'type':_0x5672cd,'resourceId':_0x1fceb1['id']}})[_0x8a82('0x25')](function(){return _0x57e9e2;});})[_0x8a82('0x25')](function(){_0x49a2e2[_0x8a82('0x19')](0xcc)[_0x8a82('0x1a')]();});}};}function handleEntityNotFound(_0x579a21,_0x191cde){return function(_0x2eaad6){if(!_0x2eaad6){_0x579a21[_0x8a82('0x18')](0x194);}return _0x2eaad6;};}function handleError(_0x2202d0,_0x20625f){_0x20625f=_0x20625f||0x1f4;return function(_0x4f56ce){logger[_0x8a82('0x2a')](_0x4f56ce['stack']);if(_0x4f56ce['name']){delete _0x4f56ce[_0x8a82('0x2b')];}_0x2202d0[_0x8a82('0x19')](_0x20625f)[_0x8a82('0x2c')](_0x4f56ce);};}exports[_0x8a82('0x2d')]=function(_0x48e437,_0x4e7c43){var _0x484b36={},_0x527c40={},_0x380241={'count':0x0,'rows':[]};var _0x3af5d4=_['map'](db[_0x8a82('0x2e')][_0x8a82('0x2f')],function(_0x399642){return{'name':_0x399642[_0x8a82('0x30')],'type':_0x399642['type'][_0x8a82('0x31')]};});_0x527c40[_0x8a82('0x32')]=_[_0x8a82('0x33')](_0x3af5d4,_0x8a82('0x2b'));_0x527c40[_0x8a82('0x34')]=_['keys'](_0x48e437[_0x8a82('0x34')]);_0x527c40['filters']=_[_0x8a82('0x35')](_0x527c40[_0x8a82('0x32')],_0x527c40[_0x8a82('0x34')]);_0x484b36[_0x8a82('0x36')]=_[_0x8a82('0x35')](_0x527c40[_0x8a82('0x32')],qs[_0x8a82('0x37')](_0x48e437[_0x8a82('0x34')][_0x8a82('0x37')]));_0x484b36[_0x8a82('0x36')]=_0x484b36[_0x8a82('0x36')]['length']?_0x484b36[_0x8a82('0x36')]:_0x527c40[_0x8a82('0x32')];if(!_0x48e437['query'][_0x8a82('0x38')]('nolimit')){_0x484b36['limit']=qs[_0x8a82('0x1e')](_0x48e437['query']['limit']);_0x484b36['offset']=qs[_0x8a82('0x1b')](_0x48e437[_0x8a82('0x34')][_0x8a82('0x1b')]);}_0x484b36[_0x8a82('0x39')]=qs[_0x8a82('0x3a')](_0x48e437[_0x8a82('0x34')]['sort']);_0x484b36[_0x8a82('0x3b')]=qs[_0x8a82('0x3c')](_['pick'](_0x48e437[_0x8a82('0x34')],_0x527c40['filters']),_0x3af5d4);if(_0x48e437[_0x8a82('0x34')][_0x8a82('0x3d')]){_0x484b36[_0x8a82('0x3b')]=_['merge'](_0x484b36[_0x8a82('0x3b')],{'$or':[{'key':{'$like':'%'+_0x48e437[_0x8a82('0x34')]['filter']+'%'}},{'value':{'$like':'%'+_0x48e437['query'][_0x8a82('0x3d')]+'%'}}]});}_0x484b36=_[_0x8a82('0x3e')]({},_0x484b36,_0x48e437['options']);var _0x51c03b={'where':_0x484b36[_0x8a82('0x3b')]};return db[_0x8a82('0x2e')][_0x8a82('0x1d')](_0x51c03b)['then'](function(_0x53d6ac){_0x380241[_0x8a82('0x1d')]=_0x53d6ac;if(_0x48e437['query'][_0x8a82('0x3f')]){_0x484b36[_0x8a82('0x40')]=[{'all':!![]}];}return db[_0x8a82('0x2e')][_0x8a82('0x41')](_0x484b36);})['then'](function(_0x5aaf21){_0x380241['rows']=_0x5aaf21;return _0x380241;})[_0x8a82('0x25')](respondWithFilteredResult(_0x4e7c43,_0x484b36))['catch'](handleError(_0x4e7c43,null));};exports['show']=function(_0x4c7fa6,_0x48a8e4){var _0x3c9b1f={'raw':!![],'where':{'id':_0x4c7fa6['params']['id']}},_0x509d5c={};_0x509d5c['model']=_[_0x8a82('0x42')](db[_0x8a82('0x2e')][_0x8a82('0x2f')]);_0x509d5c['query']=_['keys'](_0x4c7fa6[_0x8a82('0x34')]);_0x509d5c[_0x8a82('0x3c')]=_['intersection'](_0x509d5c[_0x8a82('0x32')],_0x509d5c['query']);_0x3c9b1f[_0x8a82('0x36')]=_[_0x8a82('0x35')](_0x509d5c[_0x8a82('0x32')],qs[_0x8a82('0x37')](_0x4c7fa6[_0x8a82('0x34')][_0x8a82('0x37')]));_0x3c9b1f[_0x8a82('0x36')]=_0x3c9b1f['attributes'][_0x8a82('0x43')]?_0x3c9b1f[_0x8a82('0x36')]:_0x509d5c[_0x8a82('0x32')];if(_0x4c7fa6[_0x8a82('0x34')][_0x8a82('0x3f')]){_0x3c9b1f['include']=[{'all':!![]}];}_0x3c9b1f=_[_0x8a82('0x3e')]({},_0x3c9b1f,_0x4c7fa6[_0x8a82('0x44')]);return db[_0x8a82('0x2e')][_0x8a82('0x45')](_0x3c9b1f)[_0x8a82('0x25')](handleEntityNotFound(_0x48a8e4,null))[_0x8a82('0x25')](respondWithResult(_0x48a8e4,null))[_0x8a82('0x46')](handleError(_0x48a8e4,null));};exports['update']=function(_0x5c9c6c,_0x1cccc3){if(_0x5c9c6c[_0x8a82('0x47')]['id']){delete _0x5c9c6c[_0x8a82('0x47')]['id'];}return db[_0x8a82('0x2e')][_0x8a82('0x45')]({'where':{'id':_0x5c9c6c[_0x8a82('0x48')]['id']}})[_0x8a82('0x25')](handleEntityNotFound(_0x1cccc3,null))[_0x8a82('0x25')](saveUpdates(_0x5c9c6c[_0x8a82('0x47')],null))['then'](respondWithResult(_0x1cccc3,null))[_0x8a82('0x46')](handleError(_0x1cccc3,null));};exports['destroy']=function(_0x20fe12,_0x48fd6e){return db[_0x8a82('0x2e')][_0x8a82('0x45')]({'where':{'id':_0x20fe12[_0x8a82('0x48')]['id']}})[_0x8a82('0x25')](handleEntityNotFound(_0x48fd6e,null))[_0x8a82('0x25')](removeEntity(_0x48fd6e,null))[_0x8a82('0x46')](handleError(_0x48fd6e,null));};exports[_0x8a82('0x49')]=function(_0x4a9772,_0x5de166){var _0x3bc0f0={'key':_0x4a9772[_0x8a82('0x47')]['key']};if(_0x4a9772[_0x8a82('0x47')][_0x8a82('0x4a')]){_0x3bc0f0[_0x8a82('0x4a')]=_0x4a9772[_0x8a82('0x47')][_0x8a82('0x4a')];}else if(_0x4a9772[_0x8a82('0x47')]['SmsAccountId']){_0x3bc0f0['SmsAccountId']=_0x4a9772[_0x8a82('0x47')][_0x8a82('0x4b')];}else if(_0x4a9772[_0x8a82('0x47')][_0x8a82('0x4c')]){_0x3bc0f0['OpenchannelAccountId']=_0x4a9772[_0x8a82('0x47')][_0x8a82('0x4c')];}else if(_0x4a9772[_0x8a82('0x47')][_0x8a82('0x4d')]){_0x3bc0f0[_0x8a82('0x4d')]=_0x4a9772[_0x8a82('0x47')]['ChatWebsiteId'];}return db['CannedAnswer'][_0x8a82('0x45')]({'where':_0x3bc0f0})[_0x8a82('0x25')](function(_0xeb3340){if(_0xeb3340){throw new db[(_0x8a82('0x4e'))][(_0x8a82('0x4f'))](_0x8a82('0x50'));}return db[_0x8a82('0x2e')]['create'](_0x4a9772[_0x8a82('0x47')]);})[_0x8a82('0x25')](function(_0x3e643b){var _0x30cd85=_0x4a9772[_0x8a82('0x51')][_0x8a82('0x27')]({'plain':!![]});if(!_0x30cd85)throw new Error(_0x8a82('0x52'));if(_0x30cd85[_0x8a82('0x53')]===_0x8a82('0x51')){var _0x63b941=_0x3e643b['get']({'plain':!![]});return db[_0x8a82('0x54')][_0x8a82('0x45')]({'where':{'name':_0x8a82('0x28'),'userProfileId':_0x30cd85[_0x8a82('0x55')]},'raw':!![]})[_0x8a82('0x25')](function(_0x4124bb){if(_0x4124bb&&_0x4124bb['autoAssociation']===0x0){return db[_0x8a82('0x29')][_0x8a82('0x49')]({'name':_0x63b941[_0x8a82('0x2b')],'resourceId':_0x63b941['id'],'type':_0x4124bb[_0x8a82('0x2b')],'sectionId':_0x4124bb['id']},{})['then'](function(){return _0x3e643b;});}else{return _0x3e643b;}})[_0x8a82('0x46')](function(_0xb79d6a){logger[_0x8a82('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb79d6a);throw _0xb79d6a;});}return _0x3e643b;})[_0x8a82('0x25')](respondWithResult(_0x5de166,0xc9))[_0x8a82('0x46')](handleError(_0x5de166,null));}; \ No newline at end of file +var _0x6351=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','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','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','name','send','index','CannedAnswer','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf'];(function(_0x1a4835,_0x540d39){var _0x4361ac=function(_0x3698d1){while(--_0x3698d1){_0x1a4835['push'](_0x1a4835['shift']());}};_0x4361ac(++_0x540d39);}(_0x6351,0x1c1));var _0x1635=function(_0x440236,_0x3701a4){_0x440236=_0x440236-0x0;var _0x508192=_0x6351[_0x440236];return _0x508192;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1635('0x0'));var zipdir=require(_0x1635('0x1'));var jsonpatch=require(_0x1635('0x2'));var rp=require(_0x1635('0x3'));var moment=require('moment');var BPromise=require(_0x1635('0x4'));var Mustache=require(_0x1635('0x5'));var util=require(_0x1635('0x6'));var path=require('path');var sox=require(_0x1635('0x7'));var csv=require(_0x1635('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1635('0x9'));var squel=require(_0x1635('0xa'));var crypto=require(_0x1635('0xb'));var jsforce=require(_0x1635('0xc'));var deskjs=require(_0x1635('0xd'));var toCsv=require(_0x1635('0x8'));var querystring=require('querystring');var Papa=require(_0x1635('0xe'));var Redis=require(_0x1635('0xf'));var authService=require(_0x1635('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1635('0x11'));var hardwareService=require(_0x1635('0x12'));var logger=require(_0x1635('0x13'))(_0x1635('0x14'));var utils=require(_0x1635('0x15'));var config=require(_0x1635('0x16'));var licenseUtil=require(_0x1635('0x17'));var db=require(_0x1635('0x18'))['db'];function respondWithStatusCode(_0x3c64c3,_0x543f56){_0x543f56=_0x543f56||0xcc;return function(_0x455795){if(_0x455795){return _0x3c64c3['sendStatus'](_0x543f56);}return _0x3c64c3[_0x1635('0x19')](_0x543f56)['end']();};}function respondWithResult(_0x370156,_0x15d7ae){_0x15d7ae=_0x15d7ae||0xc8;return function(_0x23303f){if(_0x23303f){return _0x370156[_0x1635('0x19')](_0x15d7ae)[_0x1635('0x1a')](_0x23303f);}};}function respondWithFilteredResult(_0xa2e589,_0x5353ec){return function(_0x2ede43){if(_0x2ede43){var _0x2532bb=typeof _0x5353ec['offset']==='undefined'&&typeof _0x5353ec['limit']===_0x1635('0x1b');var _0x12bf76=_0x2ede43[_0x1635('0x1c')];var _0x5c37ce=_0x2532bb?0x0:_0x5353ec[_0x1635('0x1d')];var _0x1611a0=_0x2532bb?_0x2ede43[_0x1635('0x1c')]:_0x5353ec['offset']+_0x5353ec[_0x1635('0x1e')];var _0x1186e0;if(_0x1611a0>=_0x12bf76){_0x1611a0=_0x12bf76;_0x1186e0=0xc8;}else{_0x1186e0=0xce;}_0xa2e589['status'](_0x1186e0);return _0xa2e589[_0x1635('0x1f')](_0x1635('0x20'),_0x5c37ce+'-'+_0x1611a0+'/'+_0x12bf76)[_0x1635('0x1a')](_0x2ede43);}return null;};}function patchUpdates(_0x2bc4fc){return function(_0x5eb351){try{jsonpatch['apply'](_0x5eb351,_0x2bc4fc,!![]);}catch(_0x5d9b3){return BPromise[_0x1635('0x21')](_0x5d9b3);}return _0x5eb351[_0x1635('0x22')]();};}function saveUpdates(_0x31f53c,_0x34bc44){return function(_0xc08892){if(_0xc08892){return _0xc08892[_0x1635('0x23')](_0x31f53c)[_0x1635('0x24')](function(_0x491a07){return _0x491a07;});}return null;};}function removeEntity(_0x5c2e94,_0x453a9b){return function(_0x51c54c){if(_0x51c54c){return _0x51c54c[_0x1635('0x25')]()[_0x1635('0x24')](function(){var _0x58a8a1=_0x51c54c[_0x1635('0x26')]({'plain':!![]});var _0x3e8565=_0x1635('0x27');return db[_0x1635('0x28')][_0x1635('0x25')]({'where':{'type':_0x3e8565,'resourceId':_0x58a8a1['id']}})[_0x1635('0x24')](function(){return _0x51c54c;});})['then'](function(){_0x5c2e94[_0x1635('0x19')](0xcc)[_0x1635('0x29')]();});}};}function handleEntityNotFound(_0x25662a,_0x48505e){return function(_0x3dd220){if(!_0x3dd220){_0x25662a['sendStatus'](0x194);}return _0x3dd220;};}function handleError(_0x51bb61,_0x589db5){_0x589db5=_0x589db5||0x1f4;return function(_0x4c4010){logger[_0x1635('0x2a')](_0x4c4010['stack']);if(_0x4c4010[_0x1635('0x2b')]){delete _0x4c4010[_0x1635('0x2b')];}_0x51bb61['status'](_0x589db5)[_0x1635('0x2c')](_0x4c4010);};}exports[_0x1635('0x2d')]=function(_0xa35e94,_0x240e73){var _0xe2ebcf={},_0x30df49={},_0x435de7={'count':0x0,'rows':[]};var _0xf8e208=_['map'](db[_0x1635('0x2e')]['rawAttributes'],function(_0x23746f){return{'name':_0x23746f[_0x1635('0x2f')],'type':_0x23746f['type'][_0x1635('0x30')]};});_0x30df49[_0x1635('0x31')]=_[_0x1635('0x32')](_0xf8e208,'name');_0x30df49[_0x1635('0x33')]=_[_0x1635('0x34')](_0xa35e94[_0x1635('0x33')]);_0x30df49[_0x1635('0x35')]=_[_0x1635('0x36')](_0x30df49[_0x1635('0x31')],_0x30df49[_0x1635('0x33')]);_0xe2ebcf[_0x1635('0x37')]=_[_0x1635('0x36')](_0x30df49[_0x1635('0x31')],qs['fields'](_0xa35e94[_0x1635('0x33')][_0x1635('0x38')]));_0xe2ebcf['attributes']=_0xe2ebcf['attributes'][_0x1635('0x39')]?_0xe2ebcf[_0x1635('0x37')]:_0x30df49[_0x1635('0x31')];if(!_0xa35e94['query'][_0x1635('0x3a')](_0x1635('0x3b'))){_0xe2ebcf['limit']=qs['limit'](_0xa35e94[_0x1635('0x33')][_0x1635('0x1e')]);_0xe2ebcf[_0x1635('0x1d')]=qs['offset'](_0xa35e94[_0x1635('0x33')][_0x1635('0x1d')]);}_0xe2ebcf[_0x1635('0x3c')]=qs[_0x1635('0x3d')](_0xa35e94[_0x1635('0x33')][_0x1635('0x3d')]);_0xe2ebcf['where']=qs[_0x1635('0x35')](_[_0x1635('0x3e')](_0xa35e94['query'],_0x30df49[_0x1635('0x35')]),_0xf8e208);if(_0xa35e94[_0x1635('0x33')][_0x1635('0x3f')]){_0xe2ebcf['where']=_[_0x1635('0x40')](_0xe2ebcf[_0x1635('0x41')],{'$or':[{'key':{'$like':'%'+_0xa35e94[_0x1635('0x33')][_0x1635('0x3f')]+'%'}},{'value':{'$like':'%'+_0xa35e94['query'][_0x1635('0x3f')]+'%'}}]});}_0xe2ebcf=_[_0x1635('0x40')]({},_0xe2ebcf,_0xa35e94['options']);var _0x370651={'where':_0xe2ebcf[_0x1635('0x41')]};return db[_0x1635('0x2e')][_0x1635('0x1c')](_0x370651)['then'](function(_0x15eeec){_0x435de7[_0x1635('0x1c')]=_0x15eeec;if(_0xa35e94[_0x1635('0x33')][_0x1635('0x42')]){_0xe2ebcf[_0x1635('0x43')]=[{'all':!![]}];}return db[_0x1635('0x2e')][_0x1635('0x44')](_0xe2ebcf);})[_0x1635('0x24')](function(_0x570c08){_0x435de7[_0x1635('0x45')]=_0x570c08;return _0x435de7;})[_0x1635('0x24')](respondWithFilteredResult(_0x240e73,_0xe2ebcf))['catch'](handleError(_0x240e73,null));};exports[_0x1635('0x46')]=function(_0xa897e1,_0x6ac79a){var _0x253cce={'raw':!![],'where':{'id':_0xa897e1[_0x1635('0x47')]['id']}},_0x5a989d={};_0x5a989d[_0x1635('0x31')]=_[_0x1635('0x34')](db['CannedAnswer'][_0x1635('0x48')]);_0x5a989d[_0x1635('0x33')]=_[_0x1635('0x34')](_0xa897e1[_0x1635('0x33')]);_0x5a989d[_0x1635('0x35')]=_['intersection'](_0x5a989d[_0x1635('0x31')],_0x5a989d[_0x1635('0x33')]);_0x253cce[_0x1635('0x37')]=_['intersection'](_0x5a989d[_0x1635('0x31')],qs[_0x1635('0x38')](_0xa897e1[_0x1635('0x33')]['fields']));_0x253cce[_0x1635('0x37')]=_0x253cce[_0x1635('0x37')][_0x1635('0x39')]?_0x253cce[_0x1635('0x37')]:_0x5a989d[_0x1635('0x31')];if(_0xa897e1[_0x1635('0x33')][_0x1635('0x42')]){_0x253cce['include']=[{'all':!![]}];}_0x253cce=_['merge']({},_0x253cce,_0xa897e1['options']);return db[_0x1635('0x2e')][_0x1635('0x49')](_0x253cce)['then'](handleEntityNotFound(_0x6ac79a,null))[_0x1635('0x24')](respondWithResult(_0x6ac79a,null))[_0x1635('0x4a')](handleError(_0x6ac79a,null));};exports['update']=function(_0x1aa33e,_0x10d4b8){if(_0x1aa33e[_0x1635('0x4b')]['id']){delete _0x1aa33e['body']['id'];}return db[_0x1635('0x2e')][_0x1635('0x49')]({'where':{'id':_0x1aa33e[_0x1635('0x47')]['id']}})[_0x1635('0x24')](handleEntityNotFound(_0x10d4b8,null))['then'](saveUpdates(_0x1aa33e[_0x1635('0x4b')],null))[_0x1635('0x24')](respondWithResult(_0x10d4b8,null))[_0x1635('0x4a')](handleError(_0x10d4b8,null));};exports[_0x1635('0x25')]=function(_0x3f474c,_0x200d7d){return db[_0x1635('0x2e')]['find']({'where':{'id':_0x3f474c[_0x1635('0x47')]['id']}})[_0x1635('0x24')](handleEntityNotFound(_0x200d7d,null))['then'](removeEntity(_0x200d7d,null))[_0x1635('0x4a')](handleError(_0x200d7d,null));};exports[_0x1635('0x4c')]=function(_0x5a68d0,_0x59f36e){var _0xc6feee={'key':_0x5a68d0[_0x1635('0x4b')]['key']};if(_0x5a68d0[_0x1635('0x4b')]['MailAccountId']){_0xc6feee['MailAccountId']=_0x5a68d0[_0x1635('0x4b')][_0x1635('0x4d')];}else if(_0x5a68d0[_0x1635('0x4b')][_0x1635('0x4e')]){_0xc6feee[_0x1635('0x4e')]=_0x5a68d0[_0x1635('0x4b')][_0x1635('0x4e')];}else if(_0x5a68d0[_0x1635('0x4b')]['OpenchannelAccountId']){_0xc6feee[_0x1635('0x4f')]=_0x5a68d0['body'][_0x1635('0x4f')];}else if(_0x5a68d0[_0x1635('0x4b')]['ChatWebsiteId']){_0xc6feee[_0x1635('0x50')]=_0x5a68d0[_0x1635('0x4b')][_0x1635('0x50')];}return db[_0x1635('0x2e')]['find']({'where':_0xc6feee})[_0x1635('0x24')](function(_0x32766e){if(_0x32766e){throw new db[(_0x1635('0x51'))][(_0x1635('0x52'))](_0x1635('0x53'));}return db[_0x1635('0x2e')][_0x1635('0x4c')](_0x5a68d0[_0x1635('0x4b')]);})[_0x1635('0x24')](function(_0x127a22){var _0xe9e722=_0x5a68d0[_0x1635('0x54')]['get']({'plain':!![]});if(!_0xe9e722)throw new Error(_0x1635('0x55'));if(_0xe9e722['role']===_0x1635('0x54')){var _0x582622=_0x127a22[_0x1635('0x26')]({'plain':!![]});return db[_0x1635('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0xe9e722[_0x1635('0x57')]},'raw':!![]})[_0x1635('0x24')](function(_0x1a78f3){if(_0x1a78f3&&_0x1a78f3[_0x1635('0x58')]===0x0){return db['UserProfileResource'][_0x1635('0x4c')]({'name':_0x582622['name'],'resourceId':_0x582622['id'],'type':_0x1a78f3[_0x1635('0x2b')],'sectionId':_0x1a78f3['id']},{})[_0x1635('0x24')](function(){return _0x127a22;});}else{return _0x127a22;}})[_0x1635('0x4a')](function(_0x4ad27d){logger[_0x1635('0x2a')](_0x1635('0x59'),_0x4ad27d);throw _0x4ad27d;});}return _0x127a22;})[_0x1635('0x24')](respondWithResult(_0x59f36e,0xc9))[_0x1635('0x4a')](handleError(_0x59f36e,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index ad430e7..79b1318 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 _0xe74e=['rimraf','../../config/environment','./cannedAnswer.attributes','define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe74e,0x10a));var _0xee74=function(_0x53aee6,_0x5d0e22){_0x53aee6=_0x53aee6-0x0;var _0x72006e=_0xe74e[_0x53aee6];return _0x72006e;};'use strict';var _=require('lodash');var util=require(_0xee74('0x0'));var logger=require(_0xee74('0x1'))(_0xee74('0x2'));var moment=require(_0xee74('0x3'));var BPromise=require(_0xee74('0x4'));var rp=require(_0xee74('0x5'));var fs=require('fs');var path=require(_0xee74('0x6'));var rimraf=require(_0xee74('0x7'));var config=require(_0xee74('0x8'));var attributes=require(_0xee74('0x9'));module['exports']=function(_0x483d0a,_0xbb9d43){return _0x483d0a[_0xee74('0xa')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xee74('0xb'),'collate':_0xee74('0xc')});}; \ No newline at end of file +var _0xfa20=['../../config/environment','./cannedAnswer.attributes','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x551c36,_0x435b25){var _0x4854af=function(_0x473e09){while(--_0x473e09){_0x551c36['push'](_0x551c36['shift']());}};_0x4854af(++_0x435b25);}(_0xfa20,0x141));var _0x0fa2=function(_0x3194c2,_0x807309){_0x3194c2=_0x3194c2-0x0;var _0x4c666a=_0xfa20[_0x3194c2];return _0x4c666a;};'use strict';var _=require(_0x0fa2('0x0'));var util=require(_0x0fa2('0x1'));var logger=require(_0x0fa2('0x2'))(_0x0fa2('0x3'));var moment=require(_0x0fa2('0x4'));var BPromise=require(_0x0fa2('0x5'));var rp=require(_0x0fa2('0x6'));var fs=require('fs');var path=require(_0x0fa2('0x7'));var rimraf=require(_0x0fa2('0x8'));var config=require(_0x0fa2('0x9'));var attributes=require(_0x0fa2('0xa'));module['exports']=function(_0x19387c,_0x2247e9){return _0x19387c['define'](_0x0fa2('0xb'),attributes,{'tableName':_0x0fa2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0fa2('0xd'),'collate':_0x0fa2('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index e1e4562..42654b4 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(_0x39e857,_0x37dc8d){var _0x495596=function(_0x392cc5){while(--_0x392cc5){_0x39e857['push'](_0x39e857['shift']());}};_0x495596(++_0x37dc8d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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(_0x895c2,_0xf618c3){var _0xadbea7=function(_0x2bc323){while(--_0x2bc323){_0x895c2['push'](_0x895c2['shift']());}};_0xadbea7(++_0xf618c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 6ddd883..fdca741 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 _0xcc26=['path','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x5b21ba,_0x4fb171){var _0x33904b=function(_0x2fca42){while(--_0x2fca42){_0x5b21ba['push'](_0x5b21ba['shift']());}};_0x33904b(++_0x4fb171);}(_0xcc26,0xb2));var _0x6cc2=function(_0x10dfdf,_0x36b623){_0x10dfdf=_0x10dfdf-0x0;var _0x4d857d=_0xcc26[_0x10dfdf];return _0x4d857d;};'use strict';var multer=require(_0x6cc2('0x0'));var util=require(_0x6cc2('0x1'));var path=require(_0x6cc2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6cc2('0x3'));router[_0x6cc2('0x4')]('/',auth[_0x6cc2('0x5')](),controller[_0x6cc2('0x6')]);router[_0x6cc2('0x4')](_0x6cc2('0x7'),auth[_0x6cc2('0x5')](),controller[_0x6cc2('0x8')]);router[_0x6cc2('0x9')]('/',auth['isAuthenticated'](),controller[_0x6cc2('0xa')]);router[_0x6cc2('0xb')]('/:id',auth[_0x6cc2('0x5')](),controller[_0x6cc2('0xc')]);router[_0x6cc2('0xd')](_0x6cc2('0x7'),auth[_0x6cc2('0x5')](),controller['destroy']);module[_0x6cc2('0xe')]=router; \ No newline at end of file +var _0xb568=['./cannedAnswer.controller','get','index','/:id','post','isAuthenticated','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2774fa,_0x4f415d){var _0x398994=function(_0x24ef38){while(--_0x24ef38){_0x2774fa['push'](_0x2774fa['shift']());}};_0x398994(++_0x4f415d);}(_0xb568,0x185));var _0x8b56=function(_0x16ca4a,_0x1ed3e7){_0x16ca4a=_0x16ca4a-0x0;var _0x48f844=_0xb568[_0x16ca4a];return _0x48f844;};'use strict';var multer=require(_0x8b56('0x0'));var util=require(_0x8b56('0x1'));var path=require(_0x8b56('0x2'));var timeout=require(_0x8b56('0x3'));var express=require(_0x8b56('0x4'));var router=express[_0x8b56('0x5')]();var fs_extra=require(_0x8b56('0x6'));var auth=require(_0x8b56('0x7'));var interaction=require(_0x8b56('0x8'));var config=require(_0x8b56('0x9'));var controller=require(_0x8b56('0xa'));router[_0x8b56('0xb')]('/',auth['isAuthenticated'](),controller[_0x8b56('0xc')]);router[_0x8b56('0xb')](_0x8b56('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x8b56('0xe')]('/',auth[_0x8b56('0xf')](),controller[_0x8b56('0x10')]);router[_0x8b56('0x11')]('/:id',auth[_0x8b56('0xf')](),controller[_0x8b56('0x12')]);router['delete'](_0x8b56('0xd'),auth[_0x8b56('0xf')](),controller[_0x8b56('0x13')]);module[_0x8b56('0x14')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 7b2ae90..c66d488 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 _0xf429=['STRING','INTEGER','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x26c9c2,_0x80c806){var _0xfa093b=function(_0xd00265){while(--_0xd00265){_0x26c9c2['push'](_0x26c9c2['shift']());}};_0xfa093b(++_0x80c806);}(_0xf429,0xd4));var _0x9f42=function(_0x57d671,_0x1a101c){_0x57d671=_0x57d671-0x0;var _0x450dfe=_0xf429[_0x57d671];return _0x450dfe;};'use strict';var Sequelize=require('sequelize');module[_0x9f42('0x0')]={'calldate':{'type':Sequelize[_0x9f42('0x1')],'allowNull':![],'defaultValue':_0x9f42('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x9f42('0x3')]},'dst':{'type':Sequelize[_0x9f42('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9f42('0x3')]},'dstchannel':{'type':Sequelize[_0x9f42('0x3')]},'lastapp':{'type':Sequelize[_0x9f42('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9f42('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9f42('0x3')]},'amaflags':{'type':Sequelize[_0x9f42('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x9f42('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x9f42('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x9f42('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x9f42('0x3')]}}; \ No newline at end of file +var _0x8b30=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x2abb21,_0x4765b5){var _0x1b978f=function(_0x113284){while(--_0x113284){_0x2abb21['push'](_0x2abb21['shift']());}};_0x1b978f(++_0x4765b5);}(_0x8b30,0x1c7));var _0x08b3=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x8b30[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require(_0x08b3('0x0'));module[_0x08b3('0x1')]={'calldate':{'type':Sequelize[_0x08b3('0x2')],'allowNull':![],'defaultValue':_0x08b3('0x3')},'clid':{'type':Sequelize[_0x08b3('0x4')]},'src':{'type':Sequelize[_0x08b3('0x4')]},'dst':{'type':Sequelize[_0x08b3('0x4')]},'dcontext':{'type':Sequelize[_0x08b3('0x4')]},'channel':{'type':Sequelize[_0x08b3('0x4')]},'dstchannel':{'type':Sequelize[_0x08b3('0x4')]},'lastapp':{'type':Sequelize[_0x08b3('0x4')]},'lastdata':{'type':Sequelize[_0x08b3('0x4')]},'duration':{'type':Sequelize[_0x08b3('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x08b3('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x08b3('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x08b3('0x4')]},'userfield':{'type':Sequelize[_0x08b3('0x4')]},'uniqueid':{'type':Sequelize[_0x08b3('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x08b3('0x4')]},'type':{'type':Sequelize[_0x08b3('0x4')]},'tag':{'type':Sequelize[_0x08b3('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index f1b5fe0..86b0ee7 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 _0x9b67=['where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort'];(function(_0x431e61,_0x53c722){var _0x5328e4=function(_0x6df49e){while(--_0x6df49e){_0x431e61['push'](_0x431e61['shift']());}};_0x5328e4(++_0x53c722);}(_0x9b67,0xf6));var _0x79b6=function(_0x5f37e5,_0x50a980){_0x5f37e5=_0x5f37e5-0x0;var _0x213915=_0x9b67[_0x5f37e5];return _0x213915;};'use strict';var emlformat=require(_0x79b6('0x0'));var rimraf=require(_0x79b6('0x1'));var zipdir=require(_0x79b6('0x2'));var jsonpatch=require(_0x79b6('0x3'));var rp=require(_0x79b6('0x4'));var moment=require('moment');var BPromise=require(_0x79b6('0x5'));var Mustache=require(_0x79b6('0x6'));var util=require('util');var path=require('path');var sox=require(_0x79b6('0x7'));var csv=require(_0x79b6('0x8'));var ejs=require(_0x79b6('0x9'));var fs=require('fs');var fs_extra=require(_0x79b6('0xa'));var _=require(_0x79b6('0xb'));var squel=require(_0x79b6('0xc'));var crypto=require(_0x79b6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x79b6('0xe'));var toCsv=require(_0x79b6('0x8'));var querystring=require(_0x79b6('0xf'));var Papa=require(_0x79b6('0x10'));var Redis=require(_0x79b6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x79b6('0x12'));var as=require(_0x79b6('0x13'));var hardwareService=require(_0x79b6('0x14'));var logger=require(_0x79b6('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x79b6('0x16'));var licenseUtil=require(_0x79b6('0x17'));var db=require(_0x79b6('0x18'))['db'];function respondWithStatusCode(_0x526727,_0xc05a77){_0xc05a77=_0xc05a77||0xcc;return function(_0x2df08d){if(_0x2df08d){return _0x526727[_0x79b6('0x19')](_0xc05a77);}return _0x526727[_0x79b6('0x1a')](_0xc05a77)[_0x79b6('0x1b')]();};}function respondWithResult(_0x40478d,_0x19d5b2){_0x19d5b2=_0x19d5b2||0xc8;return function(_0x3ef1fa){if(_0x3ef1fa){return _0x40478d[_0x79b6('0x1a')](_0x19d5b2)[_0x79b6('0x1c')](_0x3ef1fa);}};}function respondWithFilteredResult(_0x2ac966,_0x3563cc){return function(_0x1e8bf1){if(_0x1e8bf1){var _0x4cf491=typeof _0x3563cc[_0x79b6('0x1d')]===_0x79b6('0x1e')&&typeof _0x3563cc[_0x79b6('0x1f')]===_0x79b6('0x1e');var _0x2a8788=_0x1e8bf1[_0x79b6('0x20')];var _0x131bc5=_0x4cf491?0x0:_0x3563cc[_0x79b6('0x1d')];var _0x3ff583=_0x4cf491?_0x1e8bf1[_0x79b6('0x20')]:_0x3563cc[_0x79b6('0x1d')]+_0x3563cc[_0x79b6('0x1f')];var _0x1361f6;if(_0x3ff583>=_0x2a8788){_0x3ff583=_0x2a8788;_0x1361f6=0xc8;}else{_0x1361f6=0xce;}_0x2ac966['status'](_0x1361f6);return _0x2ac966[_0x79b6('0x21')]('Content-Range',_0x131bc5+'-'+_0x3ff583+'/'+_0x2a8788)[_0x79b6('0x1c')](_0x1e8bf1);}return null;};}function patchUpdates(_0x532e65){return function(_0x28b9c2){try{jsonpatch[_0x79b6('0x22')](_0x28b9c2,_0x532e65,!![]);}catch(_0x299bed){return BPromise['reject'](_0x299bed);}return _0x28b9c2[_0x79b6('0x23')]();};}function saveUpdates(_0x30dc0b,_0x53208a){return function(_0x565f86){if(_0x565f86){return _0x565f86[_0x79b6('0x24')](_0x30dc0b)[_0x79b6('0x25')](function(_0x9bd2cc){return _0x9bd2cc;});}return null;};}function removeEntity(_0x268826,_0x3b2a2a){return function(_0x488102){if(_0x488102){return _0x488102[_0x79b6('0x26')]()[_0x79b6('0x25')](function(){_0x268826[_0x79b6('0x1a')](0xcc)[_0x79b6('0x1b')]();});}};}function handleEntityNotFound(_0x4c275d,_0x53c03c){return function(_0x40ef76){if(!_0x40ef76){_0x4c275d[_0x79b6('0x19')](0x194);}return _0x40ef76;};}function handleError(_0x37b01b,_0xc25c99){_0xc25c99=_0xc25c99||0x1f4;return function(_0x4adf15){logger[_0x79b6('0x27')](_0x4adf15['stack']);if(_0x4adf15[_0x79b6('0x28')]){delete _0x4adf15[_0x79b6('0x28')];}_0x37b01b[_0x79b6('0x1a')](_0xc25c99)[_0x79b6('0x29')](_0x4adf15);};}exports['index']=function(_0x1484e5,_0x310832){var _0x53b463={},_0x158221={},_0x2d219c={'count':0x0,'rows':[]};var _0x1b1f2b=_[_0x79b6('0x2a')](db[_0x79b6('0x2b')][_0x79b6('0x2c')],function(_0x53b2f5){return{'name':_0x53b2f5[_0x79b6('0x2d')],'type':_0x53b2f5[_0x79b6('0x2e')][_0x79b6('0x2f')]};});_0x158221[_0x79b6('0x30')]=_[_0x79b6('0x2a')](_0x1b1f2b,_0x79b6('0x28'));_0x158221['query']=_[_0x79b6('0x31')](_0x1484e5[_0x79b6('0x32')]);_0x158221[_0x79b6('0x33')]=_['intersection'](_0x158221['model'],_0x158221[_0x79b6('0x32')]);_0x53b463[_0x79b6('0x34')]=_[_0x79b6('0x35')](_0x158221[_0x79b6('0x30')],qs[_0x79b6('0x36')](_0x1484e5[_0x79b6('0x32')]['fields']));_0x53b463['attributes']=_0x53b463[_0x79b6('0x34')]['length']?_0x53b463[_0x79b6('0x34')]:_0x158221['model'];if(!_0x1484e5[_0x79b6('0x32')][_0x79b6('0x37')]('nolimit')){_0x53b463[_0x79b6('0x1f')]=qs[_0x79b6('0x1f')](_0x1484e5['query'][_0x79b6('0x1f')]);_0x53b463['offset']=qs[_0x79b6('0x1d')](_0x1484e5[_0x79b6('0x32')][_0x79b6('0x1d')]);}_0x53b463[_0x79b6('0x38')]=qs[_0x79b6('0x39')](_0x1484e5[_0x79b6('0x32')][_0x79b6('0x39')]);_0x53b463[_0x79b6('0x3a')]=qs[_0x79b6('0x33')](_[_0x79b6('0x3b')](_0x1484e5['query'],_0x158221['filters']),_0x1b1f2b);if(_0x1484e5['query'][_0x79b6('0x3c')]){_0x53b463[_0x79b6('0x3a')]=_['merge'](_0x53b463[_0x79b6('0x3a')],{'$or':_['map'](_0x1b1f2b,function(_0x179a98){if(_0x179a98[_0x79b6('0x2e')]!==_0x79b6('0x3d')){var _0x53db1d={};_0x53db1d[_0x179a98[_0x79b6('0x28')]]={'$like':'%'+_0x1484e5['query'][_0x79b6('0x3c')]+'%'};return _0x53db1d;}})});}_0x53b463=_[_0x79b6('0x3e')]({},_0x53b463,_0x1484e5[_0x79b6('0x3f')]);var _0x2feeeb={'where':_0x53b463[_0x79b6('0x3a')]};return db['Cdr']['count'](_0x2feeeb)[_0x79b6('0x25')](function(_0x48ae49){_0x2d219c[_0x79b6('0x20')]=_0x48ae49;if(_0x1484e5[_0x79b6('0x32')][_0x79b6('0x40')]){_0x53b463[_0x79b6('0x41')]=[{'all':!![]}];}return db[_0x79b6('0x2b')][_0x79b6('0x42')](_0x53b463);})[_0x79b6('0x25')](function(_0x4a7f90){_0x2d219c[_0x79b6('0x43')]=_0x4a7f90;return _0x2d219c;})[_0x79b6('0x25')](respondWithFilteredResult(_0x310832,_0x53b463))[_0x79b6('0x44')](handleError(_0x310832,null));};exports[_0x79b6('0x45')]=function(_0x568f6b,_0x12ea22){var _0x4f803c={'raw':!![],'where':{'id':_0x568f6b[_0x79b6('0x46')]['id']}},_0x4ba212={};_0x4ba212[_0x79b6('0x30')]=_[_0x79b6('0x31')](db[_0x79b6('0x2b')][_0x79b6('0x2c')]);_0x4ba212[_0x79b6('0x32')]=_[_0x79b6('0x31')](_0x568f6b[_0x79b6('0x32')]);_0x4ba212['filters']=_[_0x79b6('0x35')](_0x4ba212['model'],_0x4ba212['query']);_0x4f803c[_0x79b6('0x34')]=_[_0x79b6('0x35')](_0x4ba212[_0x79b6('0x30')],qs[_0x79b6('0x36')](_0x568f6b[_0x79b6('0x32')][_0x79b6('0x36')]));_0x4f803c[_0x79b6('0x34')]=_0x4f803c[_0x79b6('0x34')][_0x79b6('0x47')]?_0x4f803c['attributes']:_0x4ba212[_0x79b6('0x30')];if(_0x568f6b[_0x79b6('0x32')][_0x79b6('0x40')]){_0x4f803c[_0x79b6('0x41')]=[{'all':!![]}];}_0x4f803c=_[_0x79b6('0x3e')]({},_0x4f803c,_0x568f6b['options']);return db[_0x79b6('0x2b')][_0x79b6('0x48')](_0x4f803c)['then'](handleEntityNotFound(_0x12ea22,null))['then'](respondWithResult(_0x12ea22,null))[_0x79b6('0x44')](handleError(_0x12ea22,null));};exports[_0x79b6('0x49')]=function(_0x247c79,_0xa0c396){return db[_0x79b6('0x2b')][_0x79b6('0x49')](_0x247c79[_0x79b6('0x4a')],{})[_0x79b6('0x25')](respondWithResult(_0xa0c396,0xc9))[_0x79b6('0x44')](handleError(_0xa0c396,null));};exports[_0x79b6('0x24')]=function(_0x15c795,_0x39972b){if(_0x15c795[_0x79b6('0x4a')]['id']){delete _0x15c795[_0x79b6('0x4a')]['id'];}return db[_0x79b6('0x2b')][_0x79b6('0x48')]({'where':{'id':_0x15c795[_0x79b6('0x46')]['id']}})[_0x79b6('0x25')](handleEntityNotFound(_0x39972b,null))[_0x79b6('0x25')](saveUpdates(_0x15c795['body'],null))['then'](respondWithResult(_0x39972b,null))['catch'](handleError(_0x39972b,null));};exports['destroy']=function(_0x56deb2,_0x412c1e){return db[_0x79b6('0x2b')][_0x79b6('0x48')]({'where':{'id':_0x56deb2[_0x79b6('0x46')]['id']}})[_0x79b6('0x25')](handleEntityNotFound(_0x412c1e,null))[_0x79b6('0x25')](removeEntity(_0x412c1e,null))['catch'](handleError(_0x412c1e,null));};exports[_0x79b6('0x4b')]=function(_0xa2ba0e,_0x58232b){return db[_0x79b6('0x2b')]['describe']()[_0x79b6('0x25')](respondWithResult(_0x58232b,null))['catch'](handleError(_0x58232b,null));}; \ No newline at end of file +var _0xd13e=['limit','count','Content-Range','reject','save','update','destroy','then','end','sendStatus','error','name','index','map','Cdr','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','where','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xd13e,0x193));var _0xed13=function(_0x443e9c,_0x35e1cd){_0x443e9c=_0x443e9c-0x0;var _0x5c9cfe=_0xd13e[_0x443e9c];return _0x5c9cfe;};'use strict';var emlformat=require(_0xed13('0x0'));var rimraf=require(_0xed13('0x1'));var zipdir=require(_0xed13('0x2'));var jsonpatch=require(_0xed13('0x3'));var rp=require('request-promise');var moment=require(_0xed13('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed13('0x5'));var util=require('util');var path=require(_0xed13('0x6'));var sox=require(_0xed13('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed13('0x8'));var squel=require(_0xed13('0x9'));var crypto=require(_0xed13('0xa'));var jsforce=require(_0xed13('0xb'));var deskjs=require(_0xed13('0xc'));var toCsv=require(_0xed13('0xd'));var querystring=require(_0xed13('0xe'));var Papa=require(_0xed13('0xf'));var Redis=require(_0xed13('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xed13('0x11'));var as=require(_0xed13('0x12'));var hardwareService=require(_0xed13('0x13'));var logger=require(_0xed13('0x14'))(_0xed13('0x15'));var utils=require('../../config/utils');var config=require(_0xed13('0x16'));var licenseUtil=require(_0xed13('0x17'));var db=require(_0xed13('0x18'))['db'];function respondWithStatusCode(_0x3c0b22,_0x936103){_0x936103=_0x936103||0xcc;return function(_0x3295ba){if(_0x3295ba){return _0x3c0b22['sendStatus'](_0x936103);}return _0x3c0b22[_0xed13('0x19')](_0x936103)['end']();};}function respondWithResult(_0x257074,_0x56fdc6){_0x56fdc6=_0x56fdc6||0xc8;return function(_0x6e2978){if(_0x6e2978){return _0x257074['status'](_0x56fdc6)[_0xed13('0x1a')](_0x6e2978);}};}function respondWithFilteredResult(_0x4d5435,_0x38901a){return function(_0xf900d2){if(_0xf900d2){var _0x1d3d67=typeof _0x38901a[_0xed13('0x1b')]===_0xed13('0x1c')&&typeof _0x38901a[_0xed13('0x1d')]===_0xed13('0x1c');var _0x1148a3=_0xf900d2[_0xed13('0x1e')];var _0x1e161f=_0x1d3d67?0x0:_0x38901a[_0xed13('0x1b')];var _0x31de07=_0x1d3d67?_0xf900d2[_0xed13('0x1e')]:_0x38901a[_0xed13('0x1b')]+_0x38901a[_0xed13('0x1d')];var _0x2f38c9;if(_0x31de07>=_0x1148a3){_0x31de07=_0x1148a3;_0x2f38c9=0xc8;}else{_0x2f38c9=0xce;}_0x4d5435['status'](_0x2f38c9);return _0x4d5435['set'](_0xed13('0x1f'),_0x1e161f+'-'+_0x31de07+'/'+_0x1148a3)[_0xed13('0x1a')](_0xf900d2);}return null;};}function patchUpdates(_0x4f455b){return function(_0x40dd86){try{jsonpatch['apply'](_0x40dd86,_0x4f455b,!![]);}catch(_0x4e9e3b){return BPromise[_0xed13('0x20')](_0x4e9e3b);}return _0x40dd86[_0xed13('0x21')]();};}function saveUpdates(_0x2d62cd,_0x192d12){return function(_0x1d7621){if(_0x1d7621){return _0x1d7621[_0xed13('0x22')](_0x2d62cd)['then'](function(_0x5c0daf){return _0x5c0daf;});}return null;};}function removeEntity(_0x5d7ae1,_0x19d51b){return function(_0x3b1f23){if(_0x3b1f23){return _0x3b1f23[_0xed13('0x23')]()[_0xed13('0x24')](function(){_0x5d7ae1[_0xed13('0x19')](0xcc)[_0xed13('0x25')]();});}};}function handleEntityNotFound(_0x1f0405,_0x276c57){return function(_0x2410e2){if(!_0x2410e2){_0x1f0405[_0xed13('0x26')](0x194);}return _0x2410e2;};}function handleError(_0x1f064c,_0x3bc666){_0x3bc666=_0x3bc666||0x1f4;return function(_0x2c6c33){logger[_0xed13('0x27')](_0x2c6c33['stack']);if(_0x2c6c33['name']){delete _0x2c6c33[_0xed13('0x28')];}_0x1f064c[_0xed13('0x19')](_0x3bc666)['send'](_0x2c6c33);};}exports[_0xed13('0x29')]=function(_0x40444a,_0x4ed119){var _0x7ce996={},_0x2066ca={},_0x323156={'count':0x0,'rows':[]};var _0x570929=_[_0xed13('0x2a')](db[_0xed13('0x2b')]['rawAttributes'],function(_0x433665){return{'name':_0x433665[_0xed13('0x2c')],'type':_0x433665['type'][_0xed13('0x2d')]};});_0x2066ca[_0xed13('0x2e')]=_[_0xed13('0x2a')](_0x570929,_0xed13('0x28'));_0x2066ca[_0xed13('0x2f')]=_[_0xed13('0x30')](_0x40444a[_0xed13('0x2f')]);_0x2066ca['filters']=_[_0xed13('0x31')](_0x2066ca['model'],_0x2066ca['query']);_0x7ce996[_0xed13('0x32')]=_[_0xed13('0x31')](_0x2066ca[_0xed13('0x2e')],qs['fields'](_0x40444a[_0xed13('0x2f')][_0xed13('0x33')]));_0x7ce996[_0xed13('0x32')]=_0x7ce996['attributes'][_0xed13('0x34')]?_0x7ce996[_0xed13('0x32')]:_0x2066ca[_0xed13('0x2e')];if(!_0x40444a[_0xed13('0x2f')]['hasOwnProperty'](_0xed13('0x35'))){_0x7ce996[_0xed13('0x1d')]=qs[_0xed13('0x1d')](_0x40444a[_0xed13('0x2f')][_0xed13('0x1d')]);_0x7ce996[_0xed13('0x1b')]=qs[_0xed13('0x1b')](_0x40444a[_0xed13('0x2f')][_0xed13('0x1b')]);}_0x7ce996[_0xed13('0x36')]=qs['sort'](_0x40444a[_0xed13('0x2f')][_0xed13('0x37')]);_0x7ce996['where']=qs['filters'](_['pick'](_0x40444a[_0xed13('0x2f')],_0x2066ca[_0xed13('0x38')]),_0x570929);if(_0x40444a['query']['filter']){_0x7ce996[_0xed13('0x39')]=_[_0xed13('0x3a')](_0x7ce996[_0xed13('0x39')],{'$or':_[_0xed13('0x2a')](_0x570929,function(_0x358098){if(_0x358098['type']!=='VIRTUAL'){var _0x1e943a={};_0x1e943a[_0x358098['name']]={'$like':'%'+_0x40444a[_0xed13('0x2f')]['filter']+'%'};return _0x1e943a;}})});}_0x7ce996=_[_0xed13('0x3a')]({},_0x7ce996,_0x40444a['options']);var _0x4d6429={'where':_0x7ce996['where']};return db[_0xed13('0x2b')][_0xed13('0x1e')](_0x4d6429)[_0xed13('0x24')](function(_0x42d5f7){_0x323156[_0xed13('0x1e')]=_0x42d5f7;if(_0x40444a['query'][_0xed13('0x3b')]){_0x7ce996[_0xed13('0x3c')]=[{'all':!![]}];}return db[_0xed13('0x2b')][_0xed13('0x3d')](_0x7ce996);})[_0xed13('0x24')](function(_0x5a8cfb){_0x323156[_0xed13('0x3e')]=_0x5a8cfb;return _0x323156;})[_0xed13('0x24')](respondWithFilteredResult(_0x4ed119,_0x7ce996))[_0xed13('0x3f')](handleError(_0x4ed119,null));};exports[_0xed13('0x40')]=function(_0x187e28,_0x2e43b5){var _0x535de7={'raw':!![],'where':{'id':_0x187e28[_0xed13('0x41')]['id']}},_0x2f04ef={};_0x2f04ef[_0xed13('0x2e')]=_[_0xed13('0x30')](db[_0xed13('0x2b')][_0xed13('0x42')]);_0x2f04ef[_0xed13('0x2f')]=_[_0xed13('0x30')](_0x187e28[_0xed13('0x2f')]);_0x2f04ef[_0xed13('0x38')]=_[_0xed13('0x31')](_0x2f04ef[_0xed13('0x2e')],_0x2f04ef[_0xed13('0x2f')]);_0x535de7[_0xed13('0x32')]=_['intersection'](_0x2f04ef[_0xed13('0x2e')],qs[_0xed13('0x33')](_0x187e28['query'][_0xed13('0x33')]));_0x535de7[_0xed13('0x32')]=_0x535de7[_0xed13('0x32')]['length']?_0x535de7[_0xed13('0x32')]:_0x2f04ef[_0xed13('0x2e')];if(_0x187e28[_0xed13('0x2f')]['includeAll']){_0x535de7['include']=[{'all':!![]}];}_0x535de7=_[_0xed13('0x3a')]({},_0x535de7,_0x187e28[_0xed13('0x43')]);return db['Cdr'][_0xed13('0x44')](_0x535de7)[_0xed13('0x24')](handleEntityNotFound(_0x2e43b5,null))[_0xed13('0x24')](respondWithResult(_0x2e43b5,null))[_0xed13('0x3f')](handleError(_0x2e43b5,null));};exports['create']=function(_0x1df911,_0xf4ea89){return db[_0xed13('0x2b')][_0xed13('0x45')](_0x1df911['body'],{})[_0xed13('0x24')](respondWithResult(_0xf4ea89,0xc9))['catch'](handleError(_0xf4ea89,null));};exports[_0xed13('0x22')]=function(_0x50d12f,_0x5a0828){if(_0x50d12f[_0xed13('0x46')]['id']){delete _0x50d12f[_0xed13('0x46')]['id'];}return db['Cdr'][_0xed13('0x44')]({'where':{'id':_0x50d12f[_0xed13('0x41')]['id']}})[_0xed13('0x24')](handleEntityNotFound(_0x5a0828,null))[_0xed13('0x24')](saveUpdates(_0x50d12f['body'],null))[_0xed13('0x24')](respondWithResult(_0x5a0828,null))['catch'](handleError(_0x5a0828,null));};exports[_0xed13('0x23')]=function(_0x365e50,_0x19762a){return db[_0xed13('0x2b')][_0xed13('0x44')]({'where':{'id':_0x365e50[_0xed13('0x41')]['id']}})[_0xed13('0x24')](handleEntityNotFound(_0x19762a,null))[_0xed13('0x24')](removeEntity(_0x19762a,null))['catch'](handleError(_0x19762a,null));};exports[_0xed13('0x47')]=function(_0x38f66d,_0x372deb){return db[_0xed13('0x2b')]['describe']()[_0xed13('0x24')](respondWithResult(_0x372deb,null))['catch'](handleError(_0x372deb,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 3c98ec4..122ab38 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(_0x1b6761,_0x3edba0){var _0x58d985=function(_0x121c09){while(--_0x121c09){_0x1b6761['push'](_0x1b6761['shift']());}};_0x58d985(++_0x3edba0);}(_0x7a54,0x106));var _0x47a5=function(_0x58038c,_0x389fbf){_0x58038c=_0x58038c-0x0;var _0x19a492=_0x7a54[_0x58038c];return _0x19a492;};'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(_0x237533,_0x5aa66c){var _0x18c7ba=function(_0x56b8b8){while(--_0x56b8b8){_0x237533['push'](_0x237533['shift']());}};_0x18c7ba(++_0x5aa66c);}(_0x7a54,0x106));var _0x47a5=function(_0x4f3514,_0x4ffe19){_0x4f3514=_0x4f3514-0x0;var _0x1e5740=_0x7a54[_0x4f3514];return _0x1e5740;};'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 47fb90b..f04812f 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 _0xc77e=['debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','Cdr,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x12d6c2,_0x409bc8){var _0x1c9825=function(_0x569f66){while(--_0x569f66){_0x12d6c2['push'](_0x12d6c2['shift']());}};_0x1c9825(++_0x409bc8);}(_0xc77e,0x1a9));var _0xec77=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc77e[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xec77('0x0'));var util=require(_0xec77('0x1'));var moment=require('moment');var BPromise=require(_0xec77('0x2'));var rs=require(_0xec77('0x3'));var fs=require('fs');var Redis=require(_0xec77('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xec77('0x5'));var logger=require('../../config/logger')(_0xec77('0x6'));var config=require(_0xec77('0x7'));var jayson=require(_0xec77('0x8'));var client=jayson[_0xec77('0x9')][_0xec77('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a27d6,_0x2db52d,_0x85efeb){return new BPromise(function(_0x12f1f0,_0x3fe6e2){return client[_0xec77('0xb')](_0x1a27d6,_0x85efeb)[_0xec77('0xc')](function(_0x4899ed){logger[_0xec77('0xd')]('Cdr,\x20%s,\x20%s',_0x2db52d,_0xec77('0xe'));logger[_0xec77('0xf')](_0xec77('0x10'),_0x2db52d,_0xec77('0xe'),JSON[_0xec77('0x11')](_0x4899ed));if(_0x4899ed[_0xec77('0x12')]){if(_0x4899ed[_0xec77('0x12')]['code']===0x1f4){logger[_0xec77('0x12')]('Cdr,\x20%s,\x20%s',_0x2db52d,_0x4899ed[_0xec77('0x12')][_0xec77('0x13')]);return _0x3fe6e2(_0x4899ed[_0xec77('0x12')][_0xec77('0x13')]);}logger['error'](_0xec77('0x14'),_0x2db52d,_0x4899ed[_0xec77('0x12')][_0xec77('0x13')]);return _0x12f1f0(_0x4899ed['error'][_0xec77('0x13')]);}else{logger[_0xec77('0xd')](_0xec77('0x14'),_0x2db52d,'request\x20sent');_0x12f1f0(_0x4899ed['result'][_0xec77('0x13')]);}})[_0xec77('0x15')](function(_0x247912){logger[_0xec77('0x12')](_0xec77('0x14'),_0x2db52d,_0x247912);_0x3fe6e2(_0x247912);});});} \ No newline at end of file +var _0x16a5=['jayson/promise','client','request','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x10413d,_0x39ceb2){var _0x26c937=function(_0x3fb540){while(--_0x3fb540){_0x10413d['push'](_0x10413d['shift']());}};_0x26c937(++_0x39ceb2);}(_0x16a5,0x150));var _0x516a=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0x16a5[_0xd21fe7];return _0x14d570;};'use strict';var _=require('lodash');var util=require(_0x516a('0x0'));var moment=require(_0x516a('0x1'));var BPromise=require(_0x516a('0x2'));var rs=require(_0x516a('0x3'));var fs=require('fs');var Redis=require(_0x516a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x516a('0x5'));var logger=require(_0x516a('0x6'))(_0x516a('0x7'));var config=require(_0x516a('0x8'));var jayson=require(_0x516a('0x9'));var client=jayson[_0x516a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29e42f,_0x19a909,_0x2fcd42){return new BPromise(function(_0x2baaa8,_0x3a2fdf){return client[_0x516a('0xb')](_0x29e42f,_0x2fcd42)['then'](function(_0x4361b4){logger[_0x516a('0xc')](_0x516a('0xd'),_0x19a909,'request\x20sent');logger[_0x516a('0xe')](_0x516a('0xf'),_0x19a909,_0x516a('0x10'),JSON[_0x516a('0x11')](_0x4361b4));if(_0x4361b4[_0x516a('0x12')]){if(_0x4361b4[_0x516a('0x12')][_0x516a('0x13')]===0x1f4){logger[_0x516a('0x12')](_0x516a('0xd'),_0x19a909,_0x4361b4[_0x516a('0x12')][_0x516a('0x14')]);return _0x3a2fdf(_0x4361b4['error']['message']);}logger[_0x516a('0x12')](_0x516a('0xd'),_0x19a909,_0x4361b4[_0x516a('0x12')][_0x516a('0x14')]);return _0x2baaa8(_0x4361b4[_0x516a('0x12')][_0x516a('0x14')]);}else{logger[_0x516a('0xc')]('Cdr,\x20%s,\x20%s',_0x19a909,'request\x20sent');_0x2baaa8(_0x4361b4[_0x516a('0x15')]['message']);}})[_0x516a('0x16')](function(_0x3a686e){logger['error'](_0x516a('0xd'),_0x19a909,_0x3a686e);_0x3a2fdf(_0x3a686e);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 7bdcd51..8b5f076 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_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['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index f695108..105a1d4 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 _0x2fcb=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2fcb,0x1a7));var _0xb2fc=function(_0x438be7,_0x5960ef){_0x438be7=_0x438be7-0x0;var _0x5a5d30=_0x2fcb[_0x438be7];return _0x5a5d30;};'use strict';var Sequelize=require(_0xb2fc('0x0'));module[_0xb2fc('0x1')]={'priority':{'type':Sequelize[_0xb2fc('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb2fc('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb2fc('0x4')],'defaultValue':_0xb2fc('0x5')}}; \ No newline at end of file +var _0x2ede=['*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x9302ea,_0x3bb035){var _0x1e12df=function(_0x221307){while(--_0x221307){_0x9302ea['push'](_0x9302ea['shift']());}};_0x1e12df(++_0x3bb035);}(_0x2ede,0x123));var _0xe2ed=function(_0x2e961b,_0x2e0555){_0x2e961b=_0x2e961b-0x0;var _0x2ffc73=_0x2ede[_0x2e961b];return _0x2ffc73;};'use strict';var Sequelize=require(_0xe2ed('0x0'));module[_0xe2ed('0x1')]={'priority':{'type':Sequelize[_0xe2ed('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe2ed('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe2ed('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe2ed('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 3062db0..f628e68 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 _0xaf1d=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','include','merge','find','catch','body','ChatApplication','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x3dc59c,_0x521843){_0x3dc59c=_0x3dc59c-0x0;var _0x42c254=_0xaf1d[_0x3dc59c];return _0x42c254;};'use strict';var emlformat=require(_0xdaf1('0x0'));var rimraf=require(_0xdaf1('0x1'));var zipdir=require(_0xdaf1('0x2'));var jsonpatch=require(_0xdaf1('0x3'));var rp=require('request-promise');var moment=require(_0xdaf1('0x4'));var BPromise=require(_0xdaf1('0x5'));var Mustache=require('mustache');var util=require(_0xdaf1('0x6'));var path=require(_0xdaf1('0x7'));var sox=require(_0xdaf1('0x8'));var csv=require(_0xdaf1('0x9'));var ejs=require(_0xdaf1('0xa'));var fs=require('fs');var fs_extra=require(_0xdaf1('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdaf1('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdaf1('0xd'));var Papa=require(_0xdaf1('0xe'));var Redis=require(_0xdaf1('0xf'));var authService=require(_0xdaf1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdaf1('0x11'));var hardwareService=require(_0xdaf1('0x12'));var logger=require(_0xdaf1('0x13'))(_0xdaf1('0x14'));var utils=require(_0xdaf1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdaf1('0x16'));var db=require(_0xdaf1('0x17'))['db'];function respondWithStatusCode(_0x260c4b,_0x112c60){_0x112c60=_0x112c60||0xcc;return function(_0x3543e1){if(_0x3543e1){return _0x260c4b[_0xdaf1('0x18')](_0x112c60);}return _0x260c4b[_0xdaf1('0x19')](_0x112c60)[_0xdaf1('0x1a')]();};}function respondWithResult(_0x9a5ec6,_0x7393af){_0x7393af=_0x7393af||0xc8;return function(_0x2add26){if(_0x2add26){return _0x9a5ec6[_0xdaf1('0x19')](_0x7393af)[_0xdaf1('0x1b')](_0x2add26);}};}function respondWithFilteredResult(_0x4ed852,_0x506590){return function(_0x2e98d4){if(_0x2e98d4){var _0x562534=typeof _0x506590[_0xdaf1('0x1c')]==='undefined'&&typeof _0x506590[_0xdaf1('0x1d')]===_0xdaf1('0x1e');var _0xc1141c=_0x2e98d4['count'];var _0x1dd985=_0x562534?0x0:_0x506590['offset'];var _0x4896c1=_0x562534?_0x2e98d4[_0xdaf1('0x1f')]:_0x506590[_0xdaf1('0x1c')]+_0x506590[_0xdaf1('0x1d')];var _0x36792f;if(_0x4896c1>=_0xc1141c){_0x4896c1=_0xc1141c;_0x36792f=0xc8;}else{_0x36792f=0xce;}_0x4ed852['status'](_0x36792f);return _0x4ed852['set'](_0xdaf1('0x20'),_0x1dd985+'-'+_0x4896c1+'/'+_0xc1141c)[_0xdaf1('0x1b')](_0x2e98d4);}return null;};}function patchUpdates(_0x37b377){return function(_0x5030e5){try{jsonpatch[_0xdaf1('0x21')](_0x5030e5,_0x37b377,!![]);}catch(_0x2e776d){return BPromise[_0xdaf1('0x22')](_0x2e776d);}return _0x5030e5[_0xdaf1('0x23')]();};}function saveUpdates(_0x77d6c6,_0x110e33){return function(_0x446c5b){if(_0x446c5b){return _0x446c5b[_0xdaf1('0x24')](_0x77d6c6)[_0xdaf1('0x25')](function(_0x28916c){return _0x28916c;});}return null;};}function removeEntity(_0x56b426,_0x1f97e4){return function(_0x41b020){if(_0x41b020){return _0x41b020[_0xdaf1('0x26')]()['then'](function(){_0x56b426['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x556bd8,_0x2e6bf4){return function(_0x10c286){if(!_0x10c286){_0x556bd8['sendStatus'](0x194);}return _0x10c286;};}function handleError(_0x997245,_0x3c2166){_0x3c2166=_0x3c2166||0x1f4;return function(_0x3125d7){logger['error'](_0x3125d7[_0xdaf1('0x27')]);if(_0x3125d7[_0xdaf1('0x28')]){delete _0x3125d7['name'];}_0x997245[_0xdaf1('0x19')](_0x3c2166)[_0xdaf1('0x29')](_0x3125d7);};}exports[_0xdaf1('0x2a')]=function(_0x3892ae,_0x6731f6){var _0x16f6e0={'raw':!![],'where':{'id':_0x3892ae[_0xdaf1('0x2b')]['id']}},_0x520500={};_0x520500[_0xdaf1('0x2c')]=_['keys'](db['ChatApplication'][_0xdaf1('0x2d')]);_0x520500[_0xdaf1('0x2e')]=_[_0xdaf1('0x2f')](_0x3892ae['query']);_0x520500[_0xdaf1('0x30')]=_[_0xdaf1('0x31')](_0x520500[_0xdaf1('0x2c')],_0x520500[_0xdaf1('0x2e')]);_0x16f6e0[_0xdaf1('0x32')]=_['intersection'](_0x520500[_0xdaf1('0x2c')],qs[_0xdaf1('0x33')](_0x3892ae[_0xdaf1('0x2e')]['fields']));_0x16f6e0['attributes']=_0x16f6e0[_0xdaf1('0x32')]['length']?_0x16f6e0[_0xdaf1('0x32')]:_0x520500[_0xdaf1('0x2c')];if(_0x3892ae[_0xdaf1('0x2e')]['includeAll']){_0x16f6e0[_0xdaf1('0x34')]=[{'all':!![]}];}_0x16f6e0=_[_0xdaf1('0x35')]({},_0x16f6e0,_0x3892ae['options']);return db['ChatApplication'][_0xdaf1('0x36')](_0x16f6e0)[_0xdaf1('0x25')](handleEntityNotFound(_0x6731f6,null))['then'](respondWithResult(_0x6731f6,null))[_0xdaf1('0x37')](handleError(_0x6731f6,null));};exports[_0xdaf1('0x24')]=function(_0x318565,_0x57b9ca){if(_0x318565[_0xdaf1('0x38')]['id']){delete _0x318565[_0xdaf1('0x38')]['id'];}return db[_0xdaf1('0x39')][_0xdaf1('0x36')]({'where':{'id':_0x318565['params']['id']}})[_0xdaf1('0x25')](handleEntityNotFound(_0x57b9ca,null))[_0xdaf1('0x25')](saveUpdates(_0x318565[_0xdaf1('0x38')],null))[_0xdaf1('0x25')](respondWithResult(_0x57b9ca,null))[_0xdaf1('0x37')](handleError(_0x57b9ca,null));};exports['destroy']=function(_0x219551,_0x20dee8){return db[_0xdaf1('0x39')]['find']({'where':{'id':_0x219551[_0xdaf1('0x2b')]['id']}})['then'](handleEntityNotFound(_0x20dee8,null))[_0xdaf1('0x25')](removeEntity(_0x20dee8,null))[_0xdaf1('0x37')](handleError(_0x20dee8,null));}; \ No newline at end of file +var _0xca56=['catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','end','error','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','includeAll','merge','options','find'];(function(_0x1dbaa3,_0x4b000b){var _0x1af98a=function(_0x510ad1){while(--_0x510ad1){_0x1dbaa3['push'](_0x1dbaa3['shift']());}};_0x1af98a(++_0x4b000b);}(_0xca56,0xee));var _0x6ca5=function(_0x471761,_0x165eca){_0x471761=_0x471761-0x0;var _0x530a53=_0xca56[_0x471761];return _0x530a53;};'use strict';var emlformat=require(_0x6ca5('0x0'));var rimraf=require(_0x6ca5('0x1'));var zipdir=require(_0x6ca5('0x2'));var jsonpatch=require(_0x6ca5('0x3'));var rp=require(_0x6ca5('0x4'));var moment=require(_0x6ca5('0x5'));var BPromise=require(_0x6ca5('0x6'));var Mustache=require(_0x6ca5('0x7'));var util=require(_0x6ca5('0x8'));var path=require('path');var sox=require(_0x6ca5('0x9'));var csv=require(_0x6ca5('0xa'));var ejs=require(_0x6ca5('0xb'));var fs=require('fs');var fs_extra=require(_0x6ca5('0xc'));var _=require('lodash');var squel=require(_0x6ca5('0xd'));var crypto=require(_0x6ca5('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6ca5('0xa'));var querystring=require(_0x6ca5('0xf'));var Papa=require(_0x6ca5('0x10'));var Redis=require(_0x6ca5('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6ca5('0x12'));var hardwareService=require(_0x6ca5('0x13'));var logger=require(_0x6ca5('0x14'))(_0x6ca5('0x15'));var utils=require(_0x6ca5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6ca5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2eb3b9,_0x4fb08b){_0x4fb08b=_0x4fb08b||0xcc;return function(_0x5dd594){if(_0x5dd594){return _0x2eb3b9[_0x6ca5('0x18')](_0x4fb08b);}return _0x2eb3b9['status'](_0x4fb08b)['end']();};}function respondWithResult(_0x2a35cf,_0x428419){_0x428419=_0x428419||0xc8;return function(_0x5ba653){if(_0x5ba653){return _0x2a35cf[_0x6ca5('0x19')](_0x428419)[_0x6ca5('0x1a')](_0x5ba653);}};}function respondWithFilteredResult(_0x491a95,_0x40483f){return function(_0x19debd){if(_0x19debd){var _0x1cdfdc=typeof _0x40483f[_0x6ca5('0x1b')]===_0x6ca5('0x1c')&&typeof _0x40483f['limit']===_0x6ca5('0x1c');var _0x38f3db=_0x19debd['count'];var _0x2b3daf=_0x1cdfdc?0x0:_0x40483f[_0x6ca5('0x1b')];var _0x4fefd0=_0x1cdfdc?_0x19debd[_0x6ca5('0x1d')]:_0x40483f[_0x6ca5('0x1b')]+_0x40483f[_0x6ca5('0x1e')];var _0x37e362;if(_0x4fefd0>=_0x38f3db){_0x4fefd0=_0x38f3db;_0x37e362=0xc8;}else{_0x37e362=0xce;}_0x491a95[_0x6ca5('0x19')](_0x37e362);return _0x491a95[_0x6ca5('0x1f')]('Content-Range',_0x2b3daf+'-'+_0x4fefd0+'/'+_0x38f3db)[_0x6ca5('0x1a')](_0x19debd);}return null;};}function patchUpdates(_0xc7c1cb){return function(_0x44df63){try{jsonpatch[_0x6ca5('0x20')](_0x44df63,_0xc7c1cb,!![]);}catch(_0x11fe18){return BPromise[_0x6ca5('0x21')](_0x11fe18);}return _0x44df63[_0x6ca5('0x22')]();};}function saveUpdates(_0x1f8119,_0x23c16b){return function(_0x324881){if(_0x324881){return _0x324881[_0x6ca5('0x23')](_0x1f8119)[_0x6ca5('0x24')](function(_0x3754f5){return _0x3754f5;});}return null;};}function removeEntity(_0x1a23f2,_0x18967e){return function(_0x4e2f36){if(_0x4e2f36){return _0x4e2f36[_0x6ca5('0x25')]()[_0x6ca5('0x24')](function(){_0x1a23f2[_0x6ca5('0x19')](0xcc)[_0x6ca5('0x26')]();});}};}function handleEntityNotFound(_0x553930,_0xc10fad){return function(_0x350a69){if(!_0x350a69){_0x553930[_0x6ca5('0x18')](0x194);}return _0x350a69;};}function handleError(_0x1bdcc2,_0x409d7b){_0x409d7b=_0x409d7b||0x1f4;return function(_0x26239c){logger[_0x6ca5('0x27')](_0x26239c['stack']);if(_0x26239c[_0x6ca5('0x28')]){delete _0x26239c[_0x6ca5('0x28')];}_0x1bdcc2[_0x6ca5('0x19')](_0x409d7b)[_0x6ca5('0x29')](_0x26239c);};}exports[_0x6ca5('0x2a')]=function(_0x1b1ee9,_0x51b148){var _0xa570e4={'raw':!![],'where':{'id':_0x1b1ee9[_0x6ca5('0x2b')]['id']}},_0x31ab9c={};_0x31ab9c[_0x6ca5('0x2c')]=_[_0x6ca5('0x2d')](db[_0x6ca5('0x2e')][_0x6ca5('0x2f')]);_0x31ab9c[_0x6ca5('0x30')]=_[_0x6ca5('0x2d')](_0x1b1ee9[_0x6ca5('0x30')]);_0x31ab9c[_0x6ca5('0x31')]=_[_0x6ca5('0x32')](_0x31ab9c[_0x6ca5('0x2c')],_0x31ab9c[_0x6ca5('0x30')]);_0xa570e4[_0x6ca5('0x33')]=_[_0x6ca5('0x32')](_0x31ab9c[_0x6ca5('0x2c')],qs[_0x6ca5('0x34')](_0x1b1ee9[_0x6ca5('0x30')][_0x6ca5('0x34')]));_0xa570e4['attributes']=_0xa570e4[_0x6ca5('0x33')]['length']?_0xa570e4[_0x6ca5('0x33')]:_0x31ab9c[_0x6ca5('0x2c')];if(_0x1b1ee9[_0x6ca5('0x30')][_0x6ca5('0x35')]){_0xa570e4['include']=[{'all':!![]}];}_0xa570e4=_[_0x6ca5('0x36')]({},_0xa570e4,_0x1b1ee9[_0x6ca5('0x37')]);return db[_0x6ca5('0x2e')][_0x6ca5('0x38')](_0xa570e4)[_0x6ca5('0x24')](handleEntityNotFound(_0x51b148,null))[_0x6ca5('0x24')](respondWithResult(_0x51b148,null))[_0x6ca5('0x39')](handleError(_0x51b148,null));};exports[_0x6ca5('0x23')]=function(_0x3f2521,_0x529686){if(_0x3f2521[_0x6ca5('0x3a')]['id']){delete _0x3f2521[_0x6ca5('0x3a')]['id'];}return db[_0x6ca5('0x2e')]['find']({'where':{'id':_0x3f2521[_0x6ca5('0x2b')]['id']}})[_0x6ca5('0x24')](handleEntityNotFound(_0x529686,null))[_0x6ca5('0x24')](saveUpdates(_0x3f2521[_0x6ca5('0x3a')],null))['then'](respondWithResult(_0x529686,null))[_0x6ca5('0x39')](handleError(_0x529686,null));};exports[_0x6ca5('0x25')]=function(_0x353c1a,_0x41c53a){return db[_0x6ca5('0x2e')]['find']({'where':{'id':_0x353c1a[_0x6ca5('0x2b')]['id']}})[_0x6ca5('0x24')](handleEntityNotFound(_0x41c53a,null))[_0x6ca5('0x24')](removeEntity(_0x41c53a,null))[_0x6ca5('0x39')](handleError(_0x41c53a,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 5738fac..da8f2b2 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 _0x7f5b=['./chatApplication.attributes','exports','chat_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x538299,_0x1d7ec2){var _0x1831b0=function(_0x2b6318){while(--_0x2b6318){_0x538299['push'](_0x538299['shift']());}};_0x1831b0(++_0x1d7ec2);}(_0x7f5b,0x101));var _0xb7f5=function(_0x22205c,_0x473493){_0x22205c=_0x22205c-0x0;var _0x3f5efe=_0x7f5b[_0x22205c];return _0x3f5efe;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb7f5('0x0'))(_0xb7f5('0x1'));var moment=require(_0xb7f5('0x2'));var BPromise=require(_0xb7f5('0x3'));var rp=require(_0xb7f5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7f5('0x5'));var config=require(_0xb7f5('0x6'));var attributes=require(_0xb7f5('0x7'));module[_0xb7f5('0x8')]=function(_0x514b68,_0x34d6b6){return _0x514b68['define']('ChatApplication',attributes,{'tableName':_0xb7f5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb7f5('0xa'),'collate':_0xb7f5('0xb')});}; \ No newline at end of file +var _0xd239=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd239,0x92));var _0x9d23=function(_0x3fa3d6,_0x36bad1){_0x3fa3d6=_0x3fa3d6-0x0;var _0x9818a2=_0xd239[_0x3fa3d6];return _0x9818a2;};'use strict';var _=require(_0x9d23('0x0'));var util=require(_0x9d23('0x1'));var logger=require(_0x9d23('0x2'))(_0x9d23('0x3'));var moment=require(_0x9d23('0x4'));var BPromise=require(_0x9d23('0x5'));var rp=require(_0x9d23('0x6'));var fs=require('fs');var path=require(_0x9d23('0x7'));var rimraf=require(_0x9d23('0x8'));var config=require(_0x9d23('0x9'));var attributes=require(_0x9d23('0xa'));module[_0x9d23('0xb')]=function(_0x204f94,_0x595e14){return _0x204f94[_0x9d23('0xc')]('ChatApplication',attributes,{'tableName':_0x9d23('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9d23('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index a5491e9..057fc26 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 _0x87f8=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','ChatApplication,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x5e7d1f,_0x2dcba9){var _0x4a3140=function(_0xad8761){while(--_0xad8761){_0x5e7d1f['push'](_0x5e7d1f['shift']());}};_0x4a3140(++_0x2dcba9);}(_0x87f8,0x80));var _0x887f=function(_0xc0b684,_0x2cda82){_0xc0b684=_0xc0b684-0x0;var _0x4a0c2b=_0x87f8[_0xc0b684];return _0x4a0c2b;};'use strict';var _=require(_0x887f('0x0'));var util=require(_0x887f('0x1'));var moment=require(_0x887f('0x2'));var BPromise=require(_0x887f('0x3'));var rs=require(_0x887f('0x4'));var fs=require('fs');var Redis=require(_0x887f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x887f('0x6'));var logger=require(_0x887f('0x7'))(_0x887f('0x8'));var config=require(_0x887f('0x9'));var jayson=require(_0x887f('0xa'));var client=jayson[_0x887f('0xb')][_0x887f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x509517,_0x5b0afd,_0x3bed8f){return new BPromise(function(_0x2a578f,_0x214251){return client[_0x887f('0xd')](_0x509517,_0x3bed8f)[_0x887f('0xe')](function(_0x3c3543){logger[_0x887f('0xf')]('ChatApplication,\x20%s,\x20%s',_0x5b0afd,_0x887f('0x10'));logger[_0x887f('0x11')](_0x887f('0x12'),_0x5b0afd,_0x887f('0x10'),JSON[_0x887f('0x13')](_0x3c3543));if(_0x3c3543['error']){if(_0x3c3543['error'][_0x887f('0x14')]===0x1f4){logger[_0x887f('0x15')]('ChatApplication,\x20%s,\x20%s',_0x5b0afd,_0x3c3543[_0x887f('0x15')][_0x887f('0x16')]);return _0x214251(_0x3c3543[_0x887f('0x15')][_0x887f('0x16')]);}logger[_0x887f('0x15')](_0x887f('0x17'),_0x5b0afd,_0x3c3543[_0x887f('0x15')][_0x887f('0x16')]);return _0x2a578f(_0x3c3543[_0x887f('0x15')]['message']);}else{logger[_0x887f('0xf')](_0x887f('0x17'),_0x5b0afd,'request\x20sent');_0x2a578f(_0x3c3543[_0x887f('0x18')][_0x887f('0x16')]);}})[_0x887f('0x19')](function(_0x4480d7){logger[_0x887f('0x15')]('ChatApplication,\x20%s,\x20%s',_0x5b0afd,_0x4480d7);_0x214251(_0x4480d7);});});} \ No newline at end of file +var _0x5184=['request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then','info','ChatApplication,\x20%s,\x20%s'];(function(_0x58c825,_0x3899e4){var _0x23d13b=function(_0x486992){while(--_0x486992){_0x58c825['push'](_0x58c825['shift']());}};_0x23d13b(++_0x3899e4);}(_0x5184,0x8c));var _0x4518=function(_0x332c16,_0x30bf3f){_0x332c16=_0x332c16-0x0;var _0x16772d=_0x5184[_0x332c16];return _0x16772d;};'use strict';var _=require(_0x4518('0x0'));var util=require(_0x4518('0x1'));var moment=require(_0x4518('0x2'));var BPromise=require(_0x4518('0x3'));var rs=require(_0x4518('0x4'));var fs=require('fs');var Redis=require(_0x4518('0x5'));var db=require(_0x4518('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4518('0x7'))('rpc');var config=require(_0x4518('0x8'));var jayson=require(_0x4518('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1121da,_0x4c15e7,_0x257789){return new BPromise(function(_0x41376b,_0x2e0b8c){return client[_0x4518('0xa')](_0x1121da,_0x257789)[_0x4518('0xb')](function(_0x1d35d3){logger[_0x4518('0xc')](_0x4518('0xd'),_0x4c15e7,_0x4518('0xe'));logger[_0x4518('0xf')](_0x4518('0x10'),_0x4c15e7,_0x4518('0xe'),JSON[_0x4518('0x11')](_0x1d35d3));if(_0x1d35d3[_0x4518('0x12')]){if(_0x1d35d3[_0x4518('0x12')]['code']===0x1f4){logger[_0x4518('0x12')](_0x4518('0xd'),_0x4c15e7,_0x1d35d3['error'][_0x4518('0x13')]);return _0x2e0b8c(_0x1d35d3['error'][_0x4518('0x13')]);}logger[_0x4518('0x12')](_0x4518('0xd'),_0x4c15e7,_0x1d35d3[_0x4518('0x12')][_0x4518('0x13')]);return _0x41376b(_0x1d35d3[_0x4518('0x12')][_0x4518('0x13')]);}else{logger['info'](_0x4518('0xd'),_0x4c15e7,_0x4518('0xe'));_0x41376b(_0x1d35d3[_0x4518('0x14')][_0x4518('0x13')]);}})[_0x4518('0x15')](function(_0x142717){logger[_0x4518('0x12')]('ChatApplication,\x20%s,\x20%s',_0x4c15e7,_0x142717);_0x2e0b8c(_0x142717);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 8d3a465..aa41f4a 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 _0x1022=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete'];(function(_0xc18f30,_0x4a06ad){var _0x5953bb=function(_0x399dc1){while(--_0x399dc1){_0xc18f30['push'](_0xc18f30['shift']());}};_0x5953bb(++_0x4a06ad);}(_0x1022,0x80));var _0x2102=function(_0x4564ff,_0xd39a3c){_0x4564ff=_0x4564ff-0x0;var _0x35b8b9=_0x1022[_0x4564ff];return _0x35b8b9;};'use strict';var multer=require(_0x2102('0x0'));var util=require('util');var path=require(_0x2102('0x1'));var timeout=require(_0x2102('0x2'));var express=require(_0x2102('0x3'));var router=express[_0x2102('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2102('0x5'));var interaction=require(_0x2102('0x6'));var config=require(_0x2102('0x7'));var controller=require(_0x2102('0x8'));router[_0x2102('0x9')](_0x2102('0xa'),auth[_0x2102('0xb')](),controller[_0x2102('0xc')]);router[_0x2102('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x2102('0xe')]);router[_0x2102('0xf')](_0x2102('0xa'),auth[_0x2102('0xb')](),controller[_0x2102('0x10')]);module[_0x2102('0x11')]=router; \ No newline at end of file +var _0xcde8=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','show','isAuthenticated','update','exports','util'];(function(_0x9bf6c3,_0x325ba4){var _0x40b074=function(_0x595f33){while(--_0x595f33){_0x9bf6c3['push'](_0x9bf6c3['shift']());}};_0x40b074(++_0x325ba4);}(_0xcde8,0xc3));var _0x8cde=function(_0x36b650,_0x3e68ed){_0x36b650=_0x36b650-0x0;var _0x513cec=_0xcde8[_0x36b650];return _0x513cec;};'use strict';var multer=require('multer');var util=require(_0x8cde('0x0'));var path=require(_0x8cde('0x1'));var timeout=require(_0x8cde('0x2'));var express=require(_0x8cde('0x3'));var router=express[_0x8cde('0x4')]();var fs_extra=require(_0x8cde('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8cde('0x6'));var config=require(_0x8cde('0x7'));var controller=require(_0x8cde('0x8'));router['get'](_0x8cde('0x9'),auth['isAuthenticated'](),controller[_0x8cde('0xa')]);router['put'](_0x8cde('0x9'),auth[_0x8cde('0xb')](),controller[_0x8cde('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8cde('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 780d18e..22e5f4e 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 _0x42fa=['exports','BOOLEAN','sequelize'];(function(_0x49a7bc,_0x5c56c6){var _0x3695ef=function(_0x3f5e1d){while(--_0x3f5e1d){_0x49a7bc['push'](_0x49a7bc['shift']());}};_0x3695ef(++_0x5c56c6);}(_0x42fa,0x161));var _0xa42f=function(_0x3bba45,_0x8d0bbc){_0x3bba45=_0x3bba45-0x0;var _0x21d3c7=_0x42fa[_0x3bba45];return _0x21d3c7;};'use strict';var Sequelize=require(_0xa42f('0x0'));module[_0xa42f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xa42f('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x204c=['sequelize','exports','STRING','BOOLEAN'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x204c,0xdc));var _0xc204=function(_0x75813b,_0x1489e7){_0x75813b=_0x75813b-0x0;var _0x1046e4=_0x204c[_0x75813b];return _0x1046e4;};'use strict';var Sequelize=require(_0xc204('0x0'));module[_0xc204('0x1')]={'name':{'type':Sequelize[_0xc204('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc204('0x2')]},'write':{'type':Sequelize[_0xc204('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 26f6355..eda288a 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 _0x69d3=['fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','destroy','params','describe','ChatInternalMessage','user','toInteger','ids','omit','findOne','getMembers','nolimit','removeMembers','addMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','send','index','ChatGroup','rawAttributes','type','model','map','query','keys','filters','intersection','attributes'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x69d3,0x13d));var _0x369d=function(_0x3361a5,_0xa07e2b){_0x3361a5=_0x3361a5-0x0;var _0x47bc28=_0x69d3[_0x3361a5];return _0x47bc28;};'use strict';var emlformat=require(_0x369d('0x0'));var rimraf=require(_0x369d('0x1'));var zipdir=require(_0x369d('0x2'));var jsonpatch=require(_0x369d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x369d('0x4'));var Mustache=require(_0x369d('0x5'));var util=require(_0x369d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x369d('0x7'));var ejs=require(_0x369d('0x8'));var fs=require('fs');var fs_extra=require(_0x369d('0x9'));var _=require('lodash');var squel=require(_0x369d('0xa'));var crypto=require('crypto');var jsforce=require(_0x369d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x369d('0x7'));var querystring=require(_0x369d('0xc'));var Papa=require(_0x369d('0xd'));var Redis=require(_0x369d('0xe'));var authService=require(_0x369d('0xf'));var qs=require(_0x369d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x369d('0x11'));var logger=require(_0x369d('0x12'))(_0x369d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x369d('0x14'))['db'];config['redis']=_[_0x369d('0x15')](config[_0x369d('0x16')],{'host':_0x369d('0x17'),'port':0x18eb});var socket=require(_0x369d('0x18'))(new Redis(config['redis']));require(_0x369d('0x19'))[_0x369d('0x1a')](socket);function respondWithStatusCode(_0xa0cb6d,_0x458e69){_0x458e69=_0x458e69||0xcc;return function(_0x1011c8){if(_0x1011c8){return _0xa0cb6d['sendStatus'](_0x458e69);}return _0xa0cb6d[_0x369d('0x1b')](_0x458e69)['end']();};}function respondWithResult(_0x2ce2b3,_0x1a00f8){_0x1a00f8=_0x1a00f8||0xc8;return function(_0x17546f){if(_0x17546f){return _0x2ce2b3[_0x369d('0x1b')](_0x1a00f8)['json'](_0x17546f);}};}function respondWithFilteredResult(_0x35df39,_0x4f3f76){return function(_0x3f36b9){if(_0x3f36b9){var _0x1f7503=typeof _0x4f3f76[_0x369d('0x1c')]===_0x369d('0x1d')&&typeof _0x4f3f76[_0x369d('0x1e')]===_0x369d('0x1d');var _0x480fe0=_0x3f36b9[_0x369d('0x1f')];var _0x13171d=_0x1f7503?0x0:_0x4f3f76[_0x369d('0x1c')];var _0x2ec9ca=_0x1f7503?_0x3f36b9[_0x369d('0x1f')]:_0x4f3f76[_0x369d('0x1c')]+_0x4f3f76[_0x369d('0x1e')];var _0x2d4c29;if(_0x2ec9ca>=_0x480fe0){_0x2ec9ca=_0x480fe0;_0x2d4c29=0xc8;}else{_0x2d4c29=0xce;}_0x35df39[_0x369d('0x1b')](_0x2d4c29);return _0x35df39[_0x369d('0x20')](_0x369d('0x21'),_0x13171d+'-'+_0x2ec9ca+'/'+_0x480fe0)[_0x369d('0x22')](_0x3f36b9);}return null;};}function patchUpdates(_0x23564b){return function(_0x5c415f){try{jsonpatch[_0x369d('0x23')](_0x5c415f,_0x23564b,!![]);}catch(_0x3f4e59){return BPromise[_0x369d('0x24')](_0x3f4e59);}return _0x5c415f[_0x369d('0x25')]();};}function saveUpdates(_0x2cd2a3,_0x1a4b3f){return function(_0xdd300f){if(_0xdd300f){return _0xdd300f[_0x369d('0x26')](_0x2cd2a3)[_0x369d('0x27')](function(_0x2c0bc5){return _0x2c0bc5;});}return null;};}function removeEntity(_0xc77ea,_0x4fd7f9){return function(_0x3bb19c){if(_0x3bb19c){return _0x3bb19c['destroy']()['then'](function(){_0xc77ea[_0x369d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39d203,_0x39ef21){return function(_0x46056a){if(!_0x46056a){_0x39d203[_0x369d('0x28')](0x194);}return _0x46056a;};}function handleError(_0x338867,_0x44b01f){_0x44b01f=_0x44b01f||0x1f4;return function(_0x1f2487){logger[_0x369d('0x29')](_0x1f2487['stack']);if(_0x1f2487[_0x369d('0x2a')]){delete _0x1f2487[_0x369d('0x2a')];}_0x338867['status'](_0x44b01f)[_0x369d('0x2b')](_0x1f2487);};}exports[_0x369d('0x2c')]=function(_0x3beedd,_0x1b7001){var _0x3dd6b1={},_0x29d06f={},_0x2ac3ac={'count':0x0,'rows':[]};var _0x14fafb=_['map'](db[_0x369d('0x2d')][_0x369d('0x2e')],function(_0x4730df){return{'name':_0x4730df['fieldName'],'type':_0x4730df[_0x369d('0x2f')]['key']};});_0x29d06f[_0x369d('0x30')]=_[_0x369d('0x31')](_0x14fafb,'name');_0x29d06f[_0x369d('0x32')]=_[_0x369d('0x33')](_0x3beedd[_0x369d('0x32')]);_0x29d06f[_0x369d('0x34')]=_[_0x369d('0x35')](_0x29d06f[_0x369d('0x30')],_0x29d06f[_0x369d('0x32')]);_0x3dd6b1[_0x369d('0x36')]=_[_0x369d('0x35')](_0x29d06f[_0x369d('0x30')],qs[_0x369d('0x37')](_0x3beedd[_0x369d('0x32')][_0x369d('0x37')]));_0x3dd6b1[_0x369d('0x36')]=_0x3dd6b1[_0x369d('0x36')][_0x369d('0x38')]?_0x3dd6b1[_0x369d('0x36')]:_0x29d06f[_0x369d('0x30')];if(!_0x3beedd[_0x369d('0x32')][_0x369d('0x39')]('nolimit')){_0x3dd6b1[_0x369d('0x1e')]=qs[_0x369d('0x1e')](_0x3beedd[_0x369d('0x32')][_0x369d('0x1e')]);_0x3dd6b1['offset']=qs[_0x369d('0x1c')](_0x3beedd[_0x369d('0x32')][_0x369d('0x1c')]);}_0x3dd6b1[_0x369d('0x3a')]=qs[_0x369d('0x3b')](_0x3beedd[_0x369d('0x32')][_0x369d('0x3b')]);_0x3dd6b1[_0x369d('0x3c')]=qs[_0x369d('0x34')](_[_0x369d('0x3d')](_0x3beedd[_0x369d('0x32')],_0x29d06f['filters']),_0x14fafb);if(_0x3beedd[_0x369d('0x32')][_0x369d('0x3e')]){_0x3dd6b1['where']=_['merge'](_0x3dd6b1['where'],{'$or':_[_0x369d('0x31')](_0x14fafb,function(_0x16abc8){if(_0x16abc8['type']!==_0x369d('0x3f')){var _0x29af53={};_0x29af53[_0x16abc8[_0x369d('0x2a')]]={'$like':'%'+_0x3beedd[_0x369d('0x32')][_0x369d('0x3e')]+'%'};return _0x29af53;}})});}_0x3dd6b1=_[_0x369d('0x40')]({},_0x3dd6b1,_0x3beedd[_0x369d('0x41')]);var _0x476fb9={'where':_0x3dd6b1[_0x369d('0x3c')]};return db[_0x369d('0x2d')][_0x369d('0x1f')](_0x476fb9)[_0x369d('0x27')](function(_0x186e04){_0x2ac3ac[_0x369d('0x1f')]=_0x186e04;if(_0x3beedd[_0x369d('0x32')][_0x369d('0x42')]){_0x3dd6b1[_0x369d('0x43')]=[{'all':!![]}];}return db['ChatGroup'][_0x369d('0x44')](_0x3dd6b1);})[_0x369d('0x27')](function(_0x19f214){_0x2ac3ac[_0x369d('0x45')]=_0x19f214;return _0x2ac3ac;})[_0x369d('0x27')](respondWithFilteredResult(_0x1b7001,_0x3dd6b1))[_0x369d('0x46')](handleError(_0x1b7001,null));};exports[_0x369d('0x47')]=function(_0x5cef68,_0xf28bf5){var _0xba0702={'raw':!![],'where':{'id':_0x5cef68['params']['id']}},_0x14bfe7={};_0x14bfe7['model']=_['keys'](db['ChatGroup'][_0x369d('0x2e')]);_0x14bfe7[_0x369d('0x32')]=_[_0x369d('0x33')](_0x5cef68['query']);_0x14bfe7[_0x369d('0x34')]=_[_0x369d('0x35')](_0x14bfe7[_0x369d('0x30')],_0x14bfe7['query']);_0xba0702['attributes']=_[_0x369d('0x35')](_0x14bfe7[_0x369d('0x30')],qs[_0x369d('0x37')](_0x5cef68[_0x369d('0x32')][_0x369d('0x37')]));_0xba0702['attributes']=_0xba0702[_0x369d('0x36')]['length']?_0xba0702[_0x369d('0x36')]:_0x14bfe7[_0x369d('0x30')];if(_0x5cef68[_0x369d('0x32')][_0x369d('0x42')]){_0xba0702['include']=[{'all':!![]}];}_0xba0702=_[_0x369d('0x40')]({},_0xba0702,_0x5cef68[_0x369d('0x41')]);return db[_0x369d('0x2d')][_0x369d('0x48')](_0xba0702)[_0x369d('0x27')](handleEntityNotFound(_0xf28bf5,null))[_0x369d('0x27')](respondWithResult(_0xf28bf5,null))[_0x369d('0x46')](handleError(_0xf28bf5,null));};exports[_0x369d('0x49')]=function(_0x56aa68,_0xcd3215){return db[_0x369d('0x2d')][_0x369d('0x49')](_0x56aa68[_0x369d('0x4a')],{})['then'](respondWithResult(_0xcd3215,0xc9))['catch'](handleError(_0xcd3215,null));};exports[_0x369d('0x26')]=function(_0x48fcf0,_0xe1d19b){if(_0x48fcf0[_0x369d('0x4a')]['id']){delete _0x48fcf0[_0x369d('0x4a')]['id'];}return db[_0x369d('0x2d')][_0x369d('0x48')]({'where':{'id':_0x48fcf0['params']['id']}})['then'](handleEntityNotFound(_0xe1d19b,null))[_0x369d('0x27')](saveUpdates(_0x48fcf0[_0x369d('0x4a')],null))['then'](respondWithResult(_0xe1d19b,null))[_0x369d('0x46')](handleError(_0xe1d19b,null));};exports[_0x369d('0x4b')]=function(_0x3890c3,_0xd6b278){return db[_0x369d('0x2d')][_0x369d('0x48')]({'where':{'id':_0x3890c3[_0x369d('0x4c')]['id']}})['then'](handleEntityNotFound(_0xd6b278,null))[_0x369d('0x27')](removeEntity(_0xd6b278,null))[_0x369d('0x46')](handleError(_0xd6b278,null));};exports[_0x369d('0x4d')]=function(_0x522460,_0x409b56){return db[_0x369d('0x2d')][_0x369d('0x4d')]()[_0x369d('0x27')](respondWithResult(_0x409b56,null))[_0x369d('0x46')](handleError(_0x409b56,null));};exports['getUnread']=function(_0x2aa950,_0x42344e,_0x3e1607){return db[_0x369d('0x4e')][_0x369d('0x1f')]({'where':{'ChatGroupId':_0x2aa950[_0x369d('0x4c')]['id'],'ToId':_0x2aa950[_0x369d('0x4f')]['id'],'read':![]}})[_0x369d('0x27')](function(_0x4d1cbe){return{'id':_[_0x369d('0x50')](_0x2aa950[_0x369d('0x4c')]['id']),'count':_0x4d1cbe};})[_0x369d('0x27')](respondWithResult(_0x42344e,null))[_0x369d('0x46')](handleError(_0x42344e,null));};exports['addMembers']=function(_0x2c1e9b,_0x26873e,_0x1b0a36){return db[_0x369d('0x2d')][_0x369d('0x48')]({'where':{'id':_0x2c1e9b[_0x369d('0x4c')]['id']}})[_0x369d('0x27')](handleEntityNotFound(_0x26873e,null))[_0x369d('0x27')](function(_0x24ac9d){if(_0x24ac9d){return _0x24ac9d['addMembers'](_0x2c1e9b[_0x369d('0x4a')][_0x369d('0x51')],_[_0x369d('0x52')](_0x2c1e9b[_0x369d('0x4a')],[_0x369d('0x51'),'id'])||{});}})[_0x369d('0x27')](respondWithResult(_0x26873e,null))[_0x369d('0x46')](handleError(_0x26873e,null));};exports['getMembers']=function(_0x435c9b,_0x4401b9,_0x2cfcde){var _0x5c0e24={};var _0x4623f4={};var _0x406f36;var _0x1f2e21;return db[_0x369d('0x2d')][_0x369d('0x53')]({'where':{'id':_0x435c9b[_0x369d('0x4c')]['id']}})[_0x369d('0x27')](handleEntityNotFound(_0x4401b9,null))[_0x369d('0x27')](function(_0x3df226){if(_0x3df226){_0x406f36=_0x3df226;_0x4623f4['model']=_[_0x369d('0x33')](db['User']['rawAttributes']);_0x4623f4[_0x369d('0x32')]=_[_0x369d('0x33')](_0x435c9b[_0x369d('0x32')]);_0x4623f4[_0x369d('0x34')]=_[_0x369d('0x35')](_0x4623f4['model'],_0x4623f4['query']);_0x5c0e24[_0x369d('0x36')]=_[_0x369d('0x35')](_0x4623f4[_0x369d('0x30')],qs[_0x369d('0x37')](_0x435c9b[_0x369d('0x32')]['fields']));_0x5c0e24[_0x369d('0x36')]=_0x5c0e24[_0x369d('0x36')][_0x369d('0x38')]?_0x5c0e24[_0x369d('0x36')]:_0x4623f4[_0x369d('0x30')];_0x5c0e24[_0x369d('0x3a')]=qs['sort'](_0x435c9b[_0x369d('0x32')]['sort']);_0x5c0e24[_0x369d('0x3c')]=qs[_0x369d('0x34')](_[_0x369d('0x3d')](_0x435c9b['query'],_0x4623f4[_0x369d('0x34')]));if(_0x435c9b[_0x369d('0x32')][_0x369d('0x3e')]){_0x5c0e24[_0x369d('0x3c')]=_['merge'](_0x5c0e24[_0x369d('0x3c')],{'$or':_['map'](_0x5c0e24['attributes'],function(_0x38de48){var _0x126ea8={};_0x126ea8[_0x38de48]={'$like':'%'+_0x435c9b['query']['filter']+'%'};return _0x126ea8;})});}_0x5c0e24=_[_0x369d('0x40')]({},_0x5c0e24,_0x435c9b[_0x369d('0x41')]);return _0x406f36[_0x369d('0x54')](_0x5c0e24);}})['then'](function(_0x2a9519){if(_0x2a9519){_0x1f2e21=_0x2a9519[_0x369d('0x38')];if(!_0x435c9b[_0x369d('0x32')][_0x369d('0x39')](_0x369d('0x55'))){_0x5c0e24[_0x369d('0x1e')]=qs[_0x369d('0x1e')](_0x435c9b['query'][_0x369d('0x1e')]);_0x5c0e24[_0x369d('0x1c')]=qs[_0x369d('0x1c')](_0x435c9b[_0x369d('0x32')][_0x369d('0x1c')]);}return _0x406f36['getMembers'](_0x5c0e24);}})[_0x369d('0x27')](function(_0x477a7d){if(_0x477a7d){return _0x477a7d?{'count':_0x1f2e21,'rows':_0x477a7d}:null;}})[_0x369d('0x27')](respondWithResult(_0x4401b9,null))[_0x369d('0x46')](handleError(_0x4401b9,null));};exports['removeMembers']=function(_0x2eb95e,_0x9d0759,_0x1bc750){return db[_0x369d('0x2d')][_0x369d('0x48')]({'where':{'id':_0x2eb95e['params']['id']}})[_0x369d('0x27')](handleEntityNotFound(_0x9d0759,null))[_0x369d('0x27')](function(_0x55ce56){if(_0x55ce56){return _0x55ce56[_0x369d('0x56')](_0x2eb95e[_0x369d('0x32')][_0x369d('0x51')]);}})[_0x369d('0x27')](respondWithStatusCode(_0x9d0759,null))[_0x369d('0x46')](handleError(_0x9d0759,null));};exports[_0x369d('0x57')]=function(_0x497329,_0x2fde6d,_0x59ff0a){if(_0x497329[_0x369d('0x4a')]['id']){delete _0x497329[_0x369d('0x4a')]['id'];}return db[_0x369d('0x2d')][_0x369d('0x48')]({'where':{'id':_0x497329['params']['id']}})[_0x369d('0x27')](handleEntityNotFound(_0x2fde6d,null))[_0x369d('0x27')](function(_0x3e023c){if(_0x3e023c){_0x497329[_0x369d('0x4a')]['ChatGroupId']=_0x3e023c['id'];return db[_0x369d('0x4e')][_0x369d('0x49')](_0x497329[_0x369d('0x4a')]);}})[_0x369d('0x27')](respondWithResult(_0x2fde6d,null))['catch'](handleError(_0x2fde6d,null));};exports[_0x369d('0x58')]=function(_0x4a0f7c,_0x429d16,_0x39cefa){var _0xd5f72={};var _0x38bf1d={};var _0x5f2b1c;var _0x5878f6;return db['ChatGroup'][_0x369d('0x53')]({'where':{'id':_0x4a0f7c['params']['id']}})[_0x369d('0x27')](handleEntityNotFound(_0x429d16,null))['then'](function(_0xdecce2){if(_0xdecce2){_0x5f2b1c=_0xdecce2;_0x38bf1d['model']=_['keys'](db[_0x369d('0x4e')][_0x369d('0x2e')]);_0x38bf1d[_0x369d('0x32')]=_['keys'](_0x4a0f7c[_0x369d('0x32')]);_0x38bf1d['filters']=_['intersection'](_0x38bf1d['model'],_0x38bf1d[_0x369d('0x32')]);_0xd5f72[_0x369d('0x36')]=_[_0x369d('0x35')](_0x38bf1d[_0x369d('0x30')],qs[_0x369d('0x37')](_0x4a0f7c['query'][_0x369d('0x37')]));_0xd5f72[_0x369d('0x36')]=_0xd5f72[_0x369d('0x36')][_0x369d('0x38')]?_0xd5f72[_0x369d('0x36')]:_0x38bf1d[_0x369d('0x30')];_0xd5f72['order']=qs[_0x369d('0x3b')](_0x4a0f7c[_0x369d('0x32')][_0x369d('0x3b')]);_0xd5f72[_0x369d('0x3c')]=qs[_0x369d('0x34')](_[_0x369d('0x3d')](_0x4a0f7c['query'],_0x38bf1d[_0x369d('0x34')]));if(_0x4a0f7c[_0x369d('0x32')][_0x369d('0x3e')]){_0xd5f72[_0x369d('0x3c')]=_[_0x369d('0x40')](_0xd5f72[_0x369d('0x3c')],{'$or':_['map'](_0xd5f72[_0x369d('0x36')],function(_0x501753){var _0x3847c9={};_0x3847c9[_0x501753]={'$like':'%'+_0x4a0f7c[_0x369d('0x32')][_0x369d('0x3e')]+'%'};return _0x3847c9;})});}if(_0x4a0f7c[_0x369d('0x32')][_0x369d('0x59')]){var _0x2b105d=_0x4a0f7c[_0x369d('0x32')][_0x369d('0x59')][_0x369d('0x5a')](',');var _0x1d529f={};_0x1d529f[_0x2b105d[0x0]]={'$gte':moment(_0x2b105d[0x1])[_0x369d('0x5b')](_0x369d('0x5c'))};_0xd5f72[_0x369d('0x3c')]=_['merge'](_0xd5f72['where'],_0x1d529f);}_0xd5f72=_['merge']({},_0xd5f72,_0x4a0f7c[_0x369d('0x41')]);return _0x5f2b1c[_0x369d('0x58')](_0xd5f72);}})['then'](function(_0x466114){if(_0x466114){_0x5878f6=_0x466114[_0x369d('0x38')];if(!_0x4a0f7c[_0x369d('0x32')]['hasOwnProperty'](_0x369d('0x55'))){_0xd5f72['limit']=qs[_0x369d('0x1e')](_0x4a0f7c['query'][_0x369d('0x1e')]);_0xd5f72[_0x369d('0x1c')]=qs[_0x369d('0x1c')](_0x4a0f7c[_0x369d('0x32')]['offset']);}return _0x5f2b1c[_0x369d('0x58')](_0xd5f72);}})[_0x369d('0x27')](function(_0x189981){if(_0x189981){return _0x189981?{'count':_0x5878f6,'rows':_0x189981}:null;}})[_0x369d('0x27')](respondWithResult(_0x429d16,null))[_0x369d('0x46')](handleError(_0x429d16,null));}; \ No newline at end of file +var _0x2990=['body','params','describe','getUnread','ChatInternalMessage','user','addMembers','omit','getMembers','findOne','User','removeMembers','ids','addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatGroup.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','ChatGroup','includeAll','include','rows','catch','find','create','update'];(function(_0x379f0c,_0x2e609d){var _0x157a60=function(_0x10b1e3){while(--_0x10b1e3){_0x379f0c['push'](_0x379f0c['shift']());}};_0x157a60(++_0x2e609d);}(_0x2990,0x1e4));var _0x0299=function(_0x47f33d,_0x11a7b5){_0x47f33d=_0x47f33d-0x0;var _0x3cbf7b=_0x2990[_0x47f33d];return _0x3cbf7b;};'use strict';var emlformat=require(_0x0299('0x0'));var rimraf=require(_0x0299('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0299('0x2'));var moment=require(_0x0299('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0299('0x4'));var util=require(_0x0299('0x5'));var path=require(_0x0299('0x6'));var sox=require('sox');var csv=require(_0x0299('0x7'));var ejs=require(_0x0299('0x8'));var fs=require('fs');var fs_extra=require(_0x0299('0x9'));var _=require(_0x0299('0xa'));var squel=require(_0x0299('0xb'));var crypto=require(_0x0299('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0299('0xd'));var toCsv=require(_0x0299('0x7'));var querystring=require('querystring');var Papa=require(_0x0299('0xe'));var Redis=require('ioredis');var authService=require(_0x0299('0xf'));var qs=require(_0x0299('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0299('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0299('0x12'));var licenseUtil=require(_0x0299('0x13'));var db=require(_0x0299('0x14'))['db'];config[_0x0299('0x15')]=_[_0x0299('0x16')](config[_0x0299('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0299('0x15')]));require(_0x0299('0x17'))['register'](socket);function respondWithStatusCode(_0x5a0747,_0xb7d36){_0xb7d36=_0xb7d36||0xcc;return function(_0x57ab6a){if(_0x57ab6a){return _0x5a0747[_0x0299('0x18')](_0xb7d36);}return _0x5a0747[_0x0299('0x19')](_0xb7d36)['end']();};}function respondWithResult(_0x4fae29,_0xd31203){_0xd31203=_0xd31203||0xc8;return function(_0x31dc5c){if(_0x31dc5c){return _0x4fae29['status'](_0xd31203)[_0x0299('0x1a')](_0x31dc5c);}};}function respondWithFilteredResult(_0xe1be04,_0x5448c6){return function(_0x253804){if(_0x253804){var _0x1c6ff9=typeof _0x5448c6[_0x0299('0x1b')]===_0x0299('0x1c')&&typeof _0x5448c6[_0x0299('0x1d')]===_0x0299('0x1c');var _0x15cc4c=_0x253804[_0x0299('0x1e')];var _0x423836=_0x1c6ff9?0x0:_0x5448c6[_0x0299('0x1b')];var _0x5dbf4a=_0x1c6ff9?_0x253804['count']:_0x5448c6[_0x0299('0x1b')]+_0x5448c6[_0x0299('0x1d')];var _0x2009b0;if(_0x5dbf4a>=_0x15cc4c){_0x5dbf4a=_0x15cc4c;_0x2009b0=0xc8;}else{_0x2009b0=0xce;}_0xe1be04[_0x0299('0x19')](_0x2009b0);return _0xe1be04[_0x0299('0x1f')](_0x0299('0x20'),_0x423836+'-'+_0x5dbf4a+'/'+_0x15cc4c)[_0x0299('0x1a')](_0x253804);}return null;};}function patchUpdates(_0x139c95){return function(_0x186518){try{jsonpatch[_0x0299('0x21')](_0x186518,_0x139c95,!![]);}catch(_0x29c5e7){return BPromise['reject'](_0x29c5e7);}return _0x186518[_0x0299('0x22')]();};}function saveUpdates(_0xc744f4,_0x35b7ee){return function(_0x5aeb62){if(_0x5aeb62){return _0x5aeb62['update'](_0xc744f4)[_0x0299('0x23')](function(_0x3a687d){return _0x3a687d;});}return null;};}function removeEntity(_0x14134f,_0x28fcad){return function(_0x56e384){if(_0x56e384){return _0x56e384[_0x0299('0x24')]()[_0x0299('0x23')](function(){_0x14134f[_0x0299('0x19')](0xcc)[_0x0299('0x25')]();});}};}function handleEntityNotFound(_0x35892f,_0x1b5d8a){return function(_0x3d79cc){if(!_0x3d79cc){_0x35892f[_0x0299('0x18')](0x194);}return _0x3d79cc;};}function handleError(_0x46a171,_0x29d0a3){_0x29d0a3=_0x29d0a3||0x1f4;return function(_0x19fc0f){logger[_0x0299('0x26')](_0x19fc0f[_0x0299('0x27')]);if(_0x19fc0f[_0x0299('0x28')]){delete _0x19fc0f[_0x0299('0x28')];}_0x46a171[_0x0299('0x19')](_0x29d0a3)[_0x0299('0x29')](_0x19fc0f);};}exports[_0x0299('0x2a')]=function(_0x1a368d,_0x2b8d94){var _0x120391={},_0x1f734={},_0x2ace97={'count':0x0,'rows':[]};var _0x3cfb28=_[_0x0299('0x2b')](db['ChatGroup'][_0x0299('0x2c')],function(_0x2de8ea){return{'name':_0x2de8ea[_0x0299('0x2d')],'type':_0x2de8ea[_0x0299('0x2e')][_0x0299('0x2f')]};});_0x1f734[_0x0299('0x30')]=_[_0x0299('0x2b')](_0x3cfb28,_0x0299('0x28'));_0x1f734['query']=_[_0x0299('0x31')](_0x1a368d[_0x0299('0x32')]);_0x1f734[_0x0299('0x33')]=_[_0x0299('0x34')](_0x1f734[_0x0299('0x30')],_0x1f734[_0x0299('0x32')]);_0x120391['attributes']=_['intersection'](_0x1f734[_0x0299('0x30')],qs[_0x0299('0x35')](_0x1a368d[_0x0299('0x32')][_0x0299('0x35')]));_0x120391['attributes']=_0x120391[_0x0299('0x36')][_0x0299('0x37')]?_0x120391[_0x0299('0x36')]:_0x1f734['model'];if(!_0x1a368d['query'][_0x0299('0x38')](_0x0299('0x39'))){_0x120391[_0x0299('0x1d')]=qs[_0x0299('0x1d')](_0x1a368d['query'][_0x0299('0x1d')]);_0x120391[_0x0299('0x1b')]=qs['offset'](_0x1a368d[_0x0299('0x32')][_0x0299('0x1b')]);}_0x120391[_0x0299('0x3a')]=qs[_0x0299('0x3b')](_0x1a368d[_0x0299('0x32')][_0x0299('0x3b')]);_0x120391[_0x0299('0x3c')]=qs[_0x0299('0x33')](_[_0x0299('0x3d')](_0x1a368d[_0x0299('0x32')],_0x1f734['filters']),_0x3cfb28);if(_0x1a368d[_0x0299('0x32')]['filter']){_0x120391[_0x0299('0x3c')]=_['merge'](_0x120391[_0x0299('0x3c')],{'$or':_[_0x0299('0x2b')](_0x3cfb28,function(_0x3d7729){if(_0x3d7729[_0x0299('0x2e')]!==_0x0299('0x3e')){var _0x5c7b1b={};_0x5c7b1b[_0x3d7729['name']]={'$like':'%'+_0x1a368d[_0x0299('0x32')][_0x0299('0x3f')]+'%'};return _0x5c7b1b;}})});}_0x120391=_[_0x0299('0x40')]({},_0x120391,_0x1a368d[_0x0299('0x41')]);var _0x1dae9e={'where':_0x120391[_0x0299('0x3c')]};return db[_0x0299('0x42')][_0x0299('0x1e')](_0x1dae9e)[_0x0299('0x23')](function(_0x469cfb){_0x2ace97[_0x0299('0x1e')]=_0x469cfb;if(_0x1a368d[_0x0299('0x32')][_0x0299('0x43')]){_0x120391[_0x0299('0x44')]=[{'all':!![]}];}return db[_0x0299('0x42')]['findAll'](_0x120391);})[_0x0299('0x23')](function(_0xa9ea2a){_0x2ace97[_0x0299('0x45')]=_0xa9ea2a;return _0x2ace97;})['then'](respondWithFilteredResult(_0x2b8d94,_0x120391))[_0x0299('0x46')](handleError(_0x2b8d94,null));};exports['show']=function(_0x224cc1,_0x2f388b){var _0x6b2d45={'raw':!![],'where':{'id':_0x224cc1['params']['id']}},_0xfc7df7={};_0xfc7df7[_0x0299('0x30')]=_['keys'](db['ChatGroup'][_0x0299('0x2c')]);_0xfc7df7[_0x0299('0x32')]=_[_0x0299('0x31')](_0x224cc1['query']);_0xfc7df7[_0x0299('0x33')]=_['intersection'](_0xfc7df7['model'],_0xfc7df7['query']);_0x6b2d45[_0x0299('0x36')]=_[_0x0299('0x34')](_0xfc7df7[_0x0299('0x30')],qs[_0x0299('0x35')](_0x224cc1['query']['fields']));_0x6b2d45[_0x0299('0x36')]=_0x6b2d45[_0x0299('0x36')]['length']?_0x6b2d45[_0x0299('0x36')]:_0xfc7df7[_0x0299('0x30')];if(_0x224cc1[_0x0299('0x32')][_0x0299('0x43')]){_0x6b2d45[_0x0299('0x44')]=[{'all':!![]}];}_0x6b2d45=_[_0x0299('0x40')]({},_0x6b2d45,_0x224cc1[_0x0299('0x41')]);return db[_0x0299('0x42')][_0x0299('0x47')](_0x6b2d45)[_0x0299('0x23')](handleEntityNotFound(_0x2f388b,null))[_0x0299('0x23')](respondWithResult(_0x2f388b,null))['catch'](handleError(_0x2f388b,null));};exports['create']=function(_0x34c77d,_0x427726){return db[_0x0299('0x42')][_0x0299('0x48')](_0x34c77d['body'],{})[_0x0299('0x23')](respondWithResult(_0x427726,0xc9))[_0x0299('0x46')](handleError(_0x427726,null));};exports[_0x0299('0x49')]=function(_0xebc75c,_0x3912e1){if(_0xebc75c['body']['id']){delete _0xebc75c[_0x0299('0x4a')]['id'];}return db['ChatGroup'][_0x0299('0x47')]({'where':{'id':_0xebc75c[_0x0299('0x4b')]['id']}})[_0x0299('0x23')](handleEntityNotFound(_0x3912e1,null))['then'](saveUpdates(_0xebc75c[_0x0299('0x4a')],null))[_0x0299('0x23')](respondWithResult(_0x3912e1,null))[_0x0299('0x46')](handleError(_0x3912e1,null));};exports[_0x0299('0x24')]=function(_0x183fce,_0x4f3722){return db[_0x0299('0x42')][_0x0299('0x47')]({'where':{'id':_0x183fce[_0x0299('0x4b')]['id']}})[_0x0299('0x23')](handleEntityNotFound(_0x4f3722,null))[_0x0299('0x23')](removeEntity(_0x4f3722,null))[_0x0299('0x46')](handleError(_0x4f3722,null));};exports[_0x0299('0x4c')]=function(_0x5930f6,_0x5691b3){return db[_0x0299('0x42')]['describe']()[_0x0299('0x23')](respondWithResult(_0x5691b3,null))['catch'](handleError(_0x5691b3,null));};exports[_0x0299('0x4d')]=function(_0x23883d,_0x2abc52,_0x460d70){return db[_0x0299('0x4e')][_0x0299('0x1e')]({'where':{'ChatGroupId':_0x23883d['params']['id'],'ToId':_0x23883d[_0x0299('0x4f')]['id'],'read':![]}})[_0x0299('0x23')](function(_0x2b5145){return{'id':_['toInteger'](_0x23883d[_0x0299('0x4b')]['id']),'count':_0x2b5145};})[_0x0299('0x23')](respondWithResult(_0x2abc52,null))[_0x0299('0x46')](handleError(_0x2abc52,null));};exports['addMembers']=function(_0x2beabb,_0x4eb9cf,_0x1b43c2){return db[_0x0299('0x42')][_0x0299('0x47')]({'where':{'id':_0x2beabb['params']['id']}})[_0x0299('0x23')](handleEntityNotFound(_0x4eb9cf,null))[_0x0299('0x23')](function(_0x1d5c53){if(_0x1d5c53){return _0x1d5c53[_0x0299('0x50')](_0x2beabb['body']['ids'],_[_0x0299('0x51')](_0x2beabb[_0x0299('0x4a')],['ids','id'])||{});}})['then'](respondWithResult(_0x4eb9cf,null))[_0x0299('0x46')](handleError(_0x4eb9cf,null));};exports[_0x0299('0x52')]=function(_0x32a425,_0xba3db3,_0x51d4f9){var _0x39b123={};var _0x3cb2b2={};var _0x2ba052;var _0x4e8661;return db[_0x0299('0x42')][_0x0299('0x53')]({'where':{'id':_0x32a425[_0x0299('0x4b')]['id']}})[_0x0299('0x23')](handleEntityNotFound(_0xba3db3,null))['then'](function(_0x4f1f4e){if(_0x4f1f4e){_0x2ba052=_0x4f1f4e;_0x3cb2b2[_0x0299('0x30')]=_[_0x0299('0x31')](db[_0x0299('0x54')][_0x0299('0x2c')]);_0x3cb2b2['query']=_[_0x0299('0x31')](_0x32a425[_0x0299('0x32')]);_0x3cb2b2[_0x0299('0x33')]=_[_0x0299('0x34')](_0x3cb2b2[_0x0299('0x30')],_0x3cb2b2[_0x0299('0x32')]);_0x39b123[_0x0299('0x36')]=_[_0x0299('0x34')](_0x3cb2b2[_0x0299('0x30')],qs[_0x0299('0x35')](_0x32a425[_0x0299('0x32')][_0x0299('0x35')]));_0x39b123[_0x0299('0x36')]=_0x39b123[_0x0299('0x36')][_0x0299('0x37')]?_0x39b123[_0x0299('0x36')]:_0x3cb2b2['model'];_0x39b123[_0x0299('0x3a')]=qs[_0x0299('0x3b')](_0x32a425[_0x0299('0x32')][_0x0299('0x3b')]);_0x39b123['where']=qs['filters'](_[_0x0299('0x3d')](_0x32a425['query'],_0x3cb2b2[_0x0299('0x33')]));if(_0x32a425[_0x0299('0x32')]['filter']){_0x39b123['where']=_['merge'](_0x39b123[_0x0299('0x3c')],{'$or':_[_0x0299('0x2b')](_0x39b123[_0x0299('0x36')],function(_0x6b68f9){var _0x2eedec={};_0x2eedec[_0x6b68f9]={'$like':'%'+_0x32a425[_0x0299('0x32')]['filter']+'%'};return _0x2eedec;})});}_0x39b123=_[_0x0299('0x40')]({},_0x39b123,_0x32a425[_0x0299('0x41')]);return _0x2ba052['getMembers'](_0x39b123);}})['then'](function(_0x1f5dda){if(_0x1f5dda){_0x4e8661=_0x1f5dda[_0x0299('0x37')];if(!_0x32a425['query'][_0x0299('0x38')](_0x0299('0x39'))){_0x39b123['limit']=qs[_0x0299('0x1d')](_0x32a425[_0x0299('0x32')][_0x0299('0x1d')]);_0x39b123[_0x0299('0x1b')]=qs[_0x0299('0x1b')](_0x32a425[_0x0299('0x32')][_0x0299('0x1b')]);}return _0x2ba052['getMembers'](_0x39b123);}})[_0x0299('0x23')](function(_0x278f6e){if(_0x278f6e){return _0x278f6e?{'count':_0x4e8661,'rows':_0x278f6e}:null;}})[_0x0299('0x23')](respondWithResult(_0xba3db3,null))[_0x0299('0x46')](handleError(_0xba3db3,null));};exports[_0x0299('0x55')]=function(_0x494faa,_0x2a62b7,_0x3537fa){return db[_0x0299('0x42')]['find']({'where':{'id':_0x494faa[_0x0299('0x4b')]['id']}})[_0x0299('0x23')](handleEntityNotFound(_0x2a62b7,null))['then'](function(_0x16f61b){if(_0x16f61b){return _0x16f61b[_0x0299('0x55')](_0x494faa[_0x0299('0x32')][_0x0299('0x56')]);}})['then'](respondWithStatusCode(_0x2a62b7,null))[_0x0299('0x46')](handleError(_0x2a62b7,null));};exports[_0x0299('0x57')]=function(_0x2f50de,_0x561bfd,_0x22d9da){if(_0x2f50de[_0x0299('0x4a')]['id']){delete _0x2f50de['body']['id'];}return db[_0x0299('0x42')][_0x0299('0x47')]({'where':{'id':_0x2f50de[_0x0299('0x4b')]['id']}})[_0x0299('0x23')](handleEntityNotFound(_0x561bfd,null))['then'](function(_0x4e58bd){if(_0x4e58bd){_0x2f50de[_0x0299('0x4a')][_0x0299('0x58')]=_0x4e58bd['id'];return db[_0x0299('0x4e')][_0x0299('0x48')](_0x2f50de[_0x0299('0x4a')]);}})[_0x0299('0x23')](respondWithResult(_0x561bfd,null))[_0x0299('0x46')](handleError(_0x561bfd,null));};exports[_0x0299('0x59')]=function(_0x358779,_0x3dd631,_0x2825a9){var _0x55927f={};var _0x3b15fb={};var _0xb038cb;var _0x1ff4a8;return db[_0x0299('0x42')][_0x0299('0x53')]({'where':{'id':_0x358779[_0x0299('0x4b')]['id']}})[_0x0299('0x23')](handleEntityNotFound(_0x3dd631,null))[_0x0299('0x23')](function(_0x8050be){if(_0x8050be){_0xb038cb=_0x8050be;_0x3b15fb['model']=_[_0x0299('0x31')](db[_0x0299('0x4e')]['rawAttributes']);_0x3b15fb['query']=_[_0x0299('0x31')](_0x358779['query']);_0x3b15fb[_0x0299('0x33')]=_[_0x0299('0x34')](_0x3b15fb[_0x0299('0x30')],_0x3b15fb[_0x0299('0x32')]);_0x55927f[_0x0299('0x36')]=_[_0x0299('0x34')](_0x3b15fb[_0x0299('0x30')],qs[_0x0299('0x35')](_0x358779['query'][_0x0299('0x35')]));_0x55927f['attributes']=_0x55927f[_0x0299('0x36')][_0x0299('0x37')]?_0x55927f[_0x0299('0x36')]:_0x3b15fb[_0x0299('0x30')];_0x55927f['order']=qs['sort'](_0x358779['query']['sort']);_0x55927f[_0x0299('0x3c')]=qs[_0x0299('0x33')](_[_0x0299('0x3d')](_0x358779[_0x0299('0x32')],_0x3b15fb[_0x0299('0x33')]));if(_0x358779['query'][_0x0299('0x3f')]){_0x55927f[_0x0299('0x3c')]=_['merge'](_0x55927f[_0x0299('0x3c')],{'$or':_[_0x0299('0x2b')](_0x55927f['attributes'],function(_0x172c07){var _0x67f9c1={};_0x67f9c1[_0x172c07]={'$like':'%'+_0x358779['query']['filter']+'%'};return _0x67f9c1;})});}if(_0x358779[_0x0299('0x32')][_0x0299('0x5a')]){var _0x32f4d4=_0x358779[_0x0299('0x32')]['$gte']['split'](',');var _0x30a4ab={};_0x30a4ab[_0x32f4d4[0x0]]={'$gte':moment(_0x32f4d4[0x1])[_0x0299('0x5b')](_0x0299('0x5c'))};_0x55927f[_0x0299('0x3c')]=_[_0x0299('0x40')](_0x55927f[_0x0299('0x3c')],_0x30a4ab);}_0x55927f=_[_0x0299('0x40')]({},_0x55927f,_0x358779[_0x0299('0x41')]);return _0xb038cb[_0x0299('0x59')](_0x55927f);}})[_0x0299('0x23')](function(_0x1db309){if(_0x1db309){_0x1ff4a8=_0x1db309[_0x0299('0x37')];if(!_0x358779[_0x0299('0x32')][_0x0299('0x38')](_0x0299('0x39'))){_0x55927f[_0x0299('0x1d')]=qs[_0x0299('0x1d')](_0x358779[_0x0299('0x32')][_0x0299('0x1d')]);_0x55927f[_0x0299('0x1b')]=qs[_0x0299('0x1b')](_0x358779[_0x0299('0x32')][_0x0299('0x1b')]);}return _0xb038cb[_0x0299('0x59')](_0x55927f);}})[_0x0299('0x23')](function(_0x371355){if(_0x371355){return _0x371355?{'count':_0x1ff4a8,'rows':_0x371355}:null;}})['then'](respondWithResult(_0x3dd631,null))[_0x0299('0x46')](handleError(_0x3dd631,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 4da1fa2..14aa68e 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 _0xe139=['emit','hasOwnProperty','hook','events','ChatGroup','setMaxListeners','save','remove'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xe139,0x1eb));var _0x9e13=function(_0x4b7c96,_0x32703c){_0x4b7c96=_0x4b7c96-0x0;var _0x4b688a=_0xe139[_0x4b7c96];return _0x4b688a;};'use strict';var EventEmitter=require(_0x9e13('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x9e13('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9e13('0x2')](0x0);var events={'afterCreate':_0x9e13('0x3'),'afterUpdate':'update','afterDestroy':_0x9e13('0x4')};function emitEvent(_0x3c4232){return function(_0x39e4c8,_0x400dde,_0x146389){ChatGroupEvents['emit'](_0x3c4232+':'+_0x39e4c8['id'],_0x39e4c8);ChatGroupEvents[_0x9e13('0x5')](_0x3c4232,_0x39e4c8);_0x146389(null);};}for(var e in events){if(events[_0x9e13('0x6')](e)){var event=events[e];ChatGroup[_0x9e13('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xea21=['exports','setMaxListeners','save','remove','emit','hook'];(function(_0x363799,_0x338533){var _0x4114a3=function(_0x190b13){while(--_0x190b13){_0x363799['push'](_0x363799['shift']());}};_0x4114a3(++_0x338533);}(_0xea21,0x109));var _0x1ea2=function(_0x3eb476,_0x5e49e9){_0x3eb476=_0x3eb476-0x0;var _0x4f3dc3=_0xea21[_0x3eb476];return _0x4f3dc3;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x1ea2('0x0')](0x0);var events={'afterCreate':_0x1ea2('0x1'),'afterUpdate':'update','afterDestroy':_0x1ea2('0x2')};function emitEvent(_0x5ab549){return function(_0x1f425f,_0x5c7852,_0x44e926){ChatGroupEvents[_0x1ea2('0x3')](_0x5ab549+':'+_0x1f425f['id'],_0x1f425f);ChatGroupEvents[_0x1ea2('0x3')](_0x5ab549,_0x1f425f);_0x44e926(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x1ea2('0x4')](e,emitEvent(event));}}module[_0x1ea2('0x5')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index db811e0..f13103c 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 _0xc2c7=['chat_groups','lodash','util','api','moment','bluebird','request-promise','rimraf','./chatGroup.attributes','define','ChatGroup'];(function(_0x2e7e8d,_0x1b9f4a){var _0x38c6fc=function(_0x2353cf){while(--_0x2353cf){_0x2e7e8d['push'](_0x2e7e8d['shift']());}};_0x38c6fc(++_0x1b9f4a);}(_0xc2c7,0xe8));var _0x7c2c=function(_0x22d2ad,_0x13a58a){_0x22d2ad=_0x22d2ad-0x0;var _0x4971ea=_0xc2c7[_0x22d2ad];return _0x4971ea;};'use strict';var _=require(_0x7c2c('0x0'));var util=require(_0x7c2c('0x1'));var logger=require('../../config/logger')(_0x7c2c('0x2'));var moment=require(_0x7c2c('0x3'));var BPromise=require(_0x7c2c('0x4'));var rp=require(_0x7c2c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c2c('0x6'));var config=require('../../config/environment');var attributes=require(_0x7c2c('0x7'));module['exports']=function(_0x37d6c6,_0x213bc3){return _0x37d6c6[_0x7c2c('0x8')](_0x7c2c('0x9'),attributes,{'tableName':_0x7c2c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x366e=['rimraf','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x366e,0x130));var _0xe366=function(_0xa4bc34,_0x4b8774){_0xa4bc34=_0xa4bc34-0x0;var _0xea4df9=_0x366e[_0xa4bc34];return _0xea4df9;};'use strict';var _=require(_0xe366('0x0'));var util=require(_0xe366('0x1'));var logger=require(_0xe366('0x2'))(_0xe366('0x3'));var moment=require(_0xe366('0x4'));var BPromise=require(_0xe366('0x5'));var rp=require(_0xe366('0x6'));var fs=require('fs');var path=require(_0xe366('0x7'));var rimraf=require(_0xe366('0x8'));var config=require('../../config/environment');var attributes=require(_0xe366('0x9'));module['exports']=function(_0x1609f2,_0x4fb17a){return _0x1609f2[_0xe366('0xa')](_0xe366('0xb'),attributes,{'tableName':_0xe366('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 1dc7a7e..2e38fc4 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 _0x29ae=['../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../config/utils','rpc'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x29ae,0x167));var _0xe29a=function(_0x5ed68a,_0x362990){_0x5ed68a=_0x5ed68a-0x0;var _0x135d96=_0x29ae[_0x5ed68a];return _0x135d96;};'use strict';var _=require(_0xe29a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe29a('0x1'));var fs=require('fs');var Redis=require(_0xe29a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe29a('0x3'));var logger=require('../../config/logger')(_0xe29a('0x4'));var config=require(_0xe29a('0x5'));var jayson=require(_0xe29a('0x6'));var client=jayson['client'][_0xe29a('0x7')]({'port':0x232a});config[_0xe29a('0x8')]=_['defaults'](config['redis'],{'host':_0xe29a('0x9'),'port':0x18eb});var socket=require(_0xe29a('0xa'))(new Redis(config[_0xe29a('0x8')]));require(_0xe29a('0xb'))[_0xe29a('0xc')](socket);function respondWithRpcPromise(_0x221430,_0x4d066b,_0x45b177){return new BPromise(function(_0x5ea357,_0x5e7e65){return client[_0xe29a('0xd')](_0x221430,_0x45b177)[_0xe29a('0xe')](function(_0xdffe5a){logger[_0xe29a('0xf')](_0xe29a('0x10'),_0x4d066b,_0xe29a('0x11'));logger[_0xe29a('0x12')](_0xe29a('0x13'),_0x4d066b,_0xe29a('0x11'),JSON[_0xe29a('0x14')](_0xdffe5a));if(_0xdffe5a[_0xe29a('0x15')]){if(_0xdffe5a['error'][_0xe29a('0x16')]===0x1f4){logger[_0xe29a('0x15')](_0xe29a('0x10'),_0x4d066b,_0xdffe5a[_0xe29a('0x15')][_0xe29a('0x17')]);return _0x5e7e65(_0xdffe5a[_0xe29a('0x15')][_0xe29a('0x17')]);}logger[_0xe29a('0x15')](_0xe29a('0x10'),_0x4d066b,_0xdffe5a[_0xe29a('0x15')][_0xe29a('0x17')]);return _0x5ea357(_0xdffe5a[_0xe29a('0x15')][_0xe29a('0x17')]);}else{logger['info'](_0xe29a('0x10'),_0x4d066b,_0xe29a('0x11'));_0x5ea357(_0xdffe5a[_0xe29a('0x18')][_0xe29a('0x17')]);}})[_0xe29a('0x19')](function(_0x3a1913){logger[_0xe29a('0x15')](_0xe29a('0x10'),_0x4d066b,_0x3a1913);_0x5e7e65(_0x3a1913);});});} \ No newline at end of file +var _0xe57e=['result','catch','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatGroup,\x20%s,\x20%s'];(function(_0x5cb228,_0x248994){var _0x241818=function(_0x1ec3da){while(--_0x1ec3da){_0x5cb228['push'](_0x5cb228['shift']());}};_0x241818(++_0x248994);}(_0xe57e,0xf2));var _0xee57=function(_0x3c0a47,_0x474d78){_0x3c0a47=_0x3c0a47-0x0;var _0xb46a81=_0xe57e[_0x3c0a47];return _0xb46a81;};'use strict';var _=require(_0xee57('0x0'));var util=require('util');var moment=require(_0xee57('0x1'));var BPromise=require(_0xee57('0x2'));var rs=require(_0xee57('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xee57('0x4'));var logger=require('../../config/logger')(_0xee57('0x5'));var config=require(_0xee57('0x6'));var jayson=require(_0xee57('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xee57('0x8')]=_[_0xee57('0x9')](config[_0xee57('0x8')],{'host':_0xee57('0xa'),'port':0x18eb});var socket=require(_0xee57('0xb'))(new Redis(config[_0xee57('0x8')]));require(_0xee57('0xc'))['register'](socket);function respondWithRpcPromise(_0x571f54,_0x195956,_0x3bbe45){return new BPromise(function(_0x3a9422,_0x39428b){return client[_0xee57('0xd')](_0x571f54,_0x3bbe45)[_0xee57('0xe')](function(_0x6a8687){logger['info']('ChatGroup,\x20%s,\x20%s',_0x195956,_0xee57('0xf'));logger[_0xee57('0x10')](_0xee57('0x11'),_0x195956,_0xee57('0xf'),JSON[_0xee57('0x12')](_0x6a8687));if(_0x6a8687['error']){if(_0x6a8687[_0xee57('0x13')]['code']===0x1f4){logger[_0xee57('0x13')]('ChatGroup,\x20%s,\x20%s',_0x195956,_0x6a8687[_0xee57('0x13')]['message']);return _0x39428b(_0x6a8687['error'][_0xee57('0x14')]);}logger[_0xee57('0x13')](_0xee57('0x15'),_0x195956,_0x6a8687[_0xee57('0x13')]['message']);return _0x3a9422(_0x6a8687[_0xee57('0x13')][_0xee57('0x14')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x195956,'request\x20sent');_0x3a9422(_0x6a8687[_0xee57('0x16')]['message']);}})[_0xee57('0x17')](function(_0x3f202f){logger[_0xee57('0x13')](_0xee57('0x15'),_0x195956,_0x3f202f);_0x39428b(_0x3f202f);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index d6e55bc..1e16d48 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 _0x99ca=['update','register','length','chatGroup:','./chatGroup.events','save'];(function(_0x2c503c,_0xd88a2a){var _0x39dce7=function(_0x4b01a5){while(--_0x4b01a5){_0x2c503c['push'](_0x2c503c['shift']());}};_0x39dce7(++_0xd88a2a);}(_0x99ca,0xee));var _0xa99c=function(_0x2a484c,_0x407cee){_0x2a484c=_0x2a484c-0x0;var _0x2b4eb5=_0x99ca[_0x2a484c];return _0x2b4eb5;};'use strict';var ChatGroupEvents=require(_0xa99c('0x0'));var events=[_0xa99c('0x1'),'remove',_0xa99c('0x2')];function createListener(_0x136171,_0x5dd50e){return function(_0x113222){_0x5dd50e['emit'](_0x136171,_0x113222);};}function removeListener(_0x546fa6,_0x2ade2d){return function(){ChatGroupEvents['removeListener'](_0x546fa6,_0x2ade2d);};}exports[_0xa99c('0x3')]=function(_0x51e156){for(var _0x2a3ae1=0x0,_0xae35e6=events[_0xa99c('0x4')];_0x2a3ae1<_0xae35e6;_0x2a3ae1++){var _0x1bd96d=events[_0x2a3ae1];var _0xd458b7=createListener(_0xa99c('0x5')+_0x1bd96d,_0x51e156);ChatGroupEvents['on'](_0x1bd96d,_0xd458b7);}}; \ No newline at end of file +var _0x8e96=['chatGroup:','./chatGroup.events','save','update','removeListener','register'];(function(_0x3a6fe3,_0x10240c){var _0x1c44ad=function(_0x26fab7){while(--_0x26fab7){_0x3a6fe3['push'](_0x3a6fe3['shift']());}};_0x1c44ad(++_0x10240c);}(_0x8e96,0x127));var _0x68e9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e96[_0x3dd15e];return _0x231fd0;};'use strict';var ChatGroupEvents=require(_0x68e9('0x0'));var events=[_0x68e9('0x1'),'remove',_0x68e9('0x2')];function createListener(_0x2a80e1,_0x5d16ae){return function(_0x4cc136){_0x5d16ae['emit'](_0x2a80e1,_0x4cc136);};}function removeListener(_0x296e78,_0x40f5bc){return function(){ChatGroupEvents[_0x68e9('0x3')](_0x296e78,_0x40f5bc);};}exports[_0x68e9('0x4')]=function(_0x18996f){for(var _0x54af40=0x0,_0x3f3457=events['length'];_0x54af40<_0x3f3457;_0x54af40++){var _0x571123=events[_0x54af40];var _0x495315=createListener(_0x68e9('0x5')+_0x571123,_0x18996f);ChatGroupEvents['on'](_0x571123,_0x495315);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 1f404e7..c8b9659 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 _0xe744=['get','isAuthenticated','/:id','show','/:id/unread','getUnread','/:id/members','getMessages','post','create','addMembers','/:id/messages','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller'];(function(_0x1ae4e2,_0x11ffb3){var _0x29bda2=function(_0x4f4683){while(--_0x4f4683){_0x1ae4e2['push'](_0x1ae4e2['shift']());}};_0x29bda2(++_0x11ffb3);}(_0xe744,0x13c));var _0x4e74=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xe744[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0x4e74('0x0'));var util=require(_0x4e74('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4e74('0x2')]();var fs_extra=require(_0x4e74('0x3'));var auth=require(_0x4e74('0x4'));var interaction=require(_0x4e74('0x5'));var config=require(_0x4e74('0x6'));var controller=require(_0x4e74('0x7'));router[_0x4e74('0x8')]('/',auth[_0x4e74('0x9')](),controller['index']);router[_0x4e74('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x4e74('0x8')](_0x4e74('0xa'),auth[_0x4e74('0x9')](),controller[_0x4e74('0xb')]);router['get'](_0x4e74('0xc'),auth[_0x4e74('0x9')](),controller[_0x4e74('0xd')]);router['get'](_0x4e74('0xe'),auth[_0x4e74('0x9')](),controller['getMembers']);router[_0x4e74('0x8')]('/:id/messages',auth[_0x4e74('0x9')](),controller[_0x4e74('0xf')]);router[_0x4e74('0x10')]('/',auth[_0x4e74('0x9')](),controller[_0x4e74('0x11')]);router['post'](_0x4e74('0xe'),auth[_0x4e74('0x9')](),controller[_0x4e74('0x12')]);router[_0x4e74('0x10')](_0x4e74('0x13'),auth['isAuthenticated'](),controller[_0x4e74('0x14')]);router[_0x4e74('0x15')](_0x4e74('0xa'),auth['isAuthenticated'](),controller[_0x4e74('0x16')]);router[_0x4e74('0x17')]('/:id',auth[_0x4e74('0x9')](),controller[_0x4e74('0x18')]);router[_0x4e74('0x17')](_0x4e74('0xe'),auth[_0x4e74('0x9')](),controller[_0x4e74('0x19')]);module[_0x4e74('0x1a')]=router; \ No newline at end of file +var _0xd9a6=['/describe','describe','/:id','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','addMessage','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index'];(function(_0x3eeab9,_0x2ed501){var _0x4a15=function(_0x46b513){while(--_0x46b513){_0x3eeab9['push'](_0x3eeab9['shift']());}};_0x4a15(++_0x2ed501);}(_0xd9a6,0x127));var _0x6d9a=function(_0x5876b6,_0x2bcc96){_0x5876b6=_0x5876b6-0x0;var _0xfc6c5e=_0xd9a6[_0x5876b6];return _0xfc6c5e;};'use strict';var multer=require(_0x6d9a('0x0'));var util=require(_0x6d9a('0x1'));var path=require(_0x6d9a('0x2'));var timeout=require(_0x6d9a('0x3'));var express=require('express');var router=express[_0x6d9a('0x4')]();var fs_extra=require(_0x6d9a('0x5'));var auth=require(_0x6d9a('0x6'));var interaction=require(_0x6d9a('0x7'));var config=require(_0x6d9a('0x8'));var controller=require(_0x6d9a('0x9'));router[_0x6d9a('0xa')]('/',auth[_0x6d9a('0xb')](),controller[_0x6d9a('0xc')]);router['get'](_0x6d9a('0xd'),auth[_0x6d9a('0xb')](),controller[_0x6d9a('0xe')]);router[_0x6d9a('0xa')](_0x6d9a('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x6d9a('0xa')](_0x6d9a('0x10'),auth[_0x6d9a('0xb')](),controller['getUnread']);router[_0x6d9a('0xa')](_0x6d9a('0x11'),auth[_0x6d9a('0xb')](),controller[_0x6d9a('0x12')]);router[_0x6d9a('0xa')](_0x6d9a('0x13'),auth['isAuthenticated'](),controller[_0x6d9a('0x14')]);router['post']('/',auth[_0x6d9a('0xb')](),controller[_0x6d9a('0x15')]);router[_0x6d9a('0x16')](_0x6d9a('0x11'),auth[_0x6d9a('0xb')](),controller[_0x6d9a('0x17')]);router[_0x6d9a('0x16')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6d9a('0x18')]);router[_0x6d9a('0x19')](_0x6d9a('0xf'),auth[_0x6d9a('0xb')](),controller['update']);router[_0x6d9a('0x1a')](_0x6d9a('0xf'),auth[_0x6d9a('0xb')](),controller['destroy']);router[_0x6d9a('0x1a')](_0x6d9a('0x11'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x6d9a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 6e397d9..578cca2 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 _0x8227=['thumb','TEXT','STRING','DATE','out','BOOLEAN','exports','INTEGER','ENUM','star'];(function(_0x1064bc,_0x206f12){var _0x5edc45=function(_0x5087bd){while(--_0x5087bd){_0x1064bc['push'](_0x1064bc['shift']());}};_0x5edc45(++_0x206f12);}(_0x8227,0x146));var _0x7822=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8227[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x7822('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7822('0x1')]},'ratingType':{'type':Sequelize[_0x7822('0x2')](_0x7822('0x3'),_0x7822('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x7822('0x5')]},'pathTranscript':{'type':Sequelize[_0x7822('0x5')]},'mailTranscript':{'type':Sequelize[_0x7822('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7822('0x7')]},'disposition':{'type':Sequelize[_0x7822('0x6')]},'secondDisposition':{'type':Sequelize[_0x7822('0x6')]},'thirdDisposition':{'type':Sequelize[_0x7822('0x6')]},'note':{'type':Sequelize[_0x7822('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x7822('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x7822('0x6')]},'deviceModel':{'type':Sequelize[_0x7822('0x6')]},'deviceVendor':{'type':Sequelize[_0x7822('0x6')]},'deviceType':{'type':Sequelize[_0x7822('0x6')]},'referer':{'type':Sequelize[_0x7822('0x5')]},'customerIp':{'type':Sequelize[_0x7822('0x6')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0x7822('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x7822('0x2')]('in',_0x7822('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7822('0x6')]},'customerPort':{'type':Sequelize[_0x7822('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x7822('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x7822('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xd2bf=['sequelize','ENUM','star','TEXT','STRING','DATE','long','out','BOOLEAN'];(function(_0x474f57,_0x37252e){var _0x31f92f=function(_0x144d8e){while(--_0x144d8e){_0x474f57['push'](_0x474f57['shift']());}};_0x31f92f(++_0x37252e);}(_0xd2bf,0x1dd));var _0xfd2b=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0xd2bf[_0x4450b1];return _0x399b0b;};'use strict';var Sequelize=require(_0xfd2b('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xfd2b('0x1')](_0xfd2b('0x2'),'thumb'),'defaultValue':_0xfd2b('0x2')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xfd2b('0x3')]},'mailTranscript':{'type':Sequelize[_0xfd2b('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xfd2b('0x5')]},'disposition':{'type':Sequelize[_0xfd2b('0x4')]},'secondDisposition':{'type':Sequelize[_0xfd2b('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfd2b('0x4')]},'browserName':{'type':Sequelize[_0xfd2b('0x4')]},'browserVersion':{'type':Sequelize[_0xfd2b('0x4')]},'osName':{'type':Sequelize[_0xfd2b('0x4')]},'osVersion':{'type':Sequelize[_0xfd2b('0x4')]},'deviceModel':{'type':Sequelize[_0xfd2b('0x4')]},'deviceVendor':{'type':Sequelize[_0xfd2b('0x4')]},'deviceType':{'type':Sequelize[_0xfd2b('0x4')]},'referer':{'type':Sequelize[_0xfd2b('0x3')]},'customerIp':{'type':Sequelize[_0xfd2b('0x4')]},'formData':{'type':Sequelize[_0xfd2b('0x3')](_0xfd2b('0x6'))},'read1stAt':{'type':Sequelize[_0xfd2b('0x5')]},'lastMsgAt':{'type':Sequelize[_0xfd2b('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xfd2b('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xfd2b('0x4')]},'customerPort':{'type':Sequelize[_0xfd2b('0x4')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xfd2b('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 f5bf859..be6a9f3 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 _0x36ce=['request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','merge','body','contact','agent','interaction','account','Users','map','fullname','TagIds','Tags','split','push','catch','talking','answered','unmanaged','total','closed','UserId','waiting','disposition','abandoned','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20>\x200','Contact','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','forEach','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','toString','keyBy','ChatInteraction','Account.key','a.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','groupBy','ChatInteractionId','all','rows','show','params','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooNote','vidaooMetadata','vidaooEscalation','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Unauthorized','ChatOfflineMessageId','root','server/files/attachments/','join','close','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','agentAlias','Visitor','agentIdentifier','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','ChatMessage','addMessage','ids','getMessages','hasOwnProperty','filter','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','secret','includeAgent','addTags','setTags','omit','spread','emit','chatInteractionTags:save','unix','files','tmp','attachments','transcript-%d-%s.zip','lastName','Attachment','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','osName','referer','customerPort','tail','createReadStream','pipe','firstName','out','server','views','transcript-','.pdf','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request'];(function(_0x4d27cd,_0x46c5d0){var _0x596dc6=function(_0x2fccaf){while(--_0x2fccaf){_0x4d27cd['push'](_0x4d27cd['shift']());}};_0x596dc6(++_0x46c5d0);}(_0x36ce,0x121));var _0xe36c=function(_0x1acba5,_0x1208e6){_0x1acba5=_0x1acba5-0x0;var _0x35620d=_0x36ce[_0x1acba5];return _0x35620d;};'use strict';var emlformat=require(_0xe36c('0x0'));var rimraf=require(_0xe36c('0x1'));var zipdir=require(_0xe36c('0x2'));var jsonpatch=require(_0xe36c('0x3'));var rp=require('request-promise');var moment=require(_0xe36c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe36c('0x5'));var util=require(_0xe36c('0x6'));var path=require(_0xe36c('0x7'));var sox=require(_0xe36c('0x8'));var csv=require(_0xe36c('0x9'));var ejs=require(_0xe36c('0xa'));var fs=require('fs');var fs_extra=require(_0xe36c('0xb'));var _=require(_0xe36c('0xc'));var squel=require(_0xe36c('0xd'));var crypto=require('crypto');var jsforce=require(_0xe36c('0xe'));var deskjs=require(_0xe36c('0xf'));var toCsv=require(_0xe36c('0x9'));var querystring=require(_0xe36c('0x10'));var Papa=require('papaparse');var Redis=require(_0xe36c('0x11'));var authService=require(_0xe36c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe36c('0x13'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xe36c('0x14'));var logger=require(_0xe36c('0x15'))(_0xe36c('0x16'));var utils=require('../../config/utils');var config=require(_0xe36c('0x17'));var licenseUtil=require(_0xe36c('0x18'));var db=require(_0xe36c('0x19'))['db'];config[_0xe36c('0x1a')]=_['defaults'](config[_0xe36c('0x1a')],{'host':_0xe36c('0x1b'),'port':0x18eb});var socket=require(_0xe36c('0x1c'))(new Redis(config[_0xe36c('0x1a')]));require(_0xe36c('0x1d'))[_0xe36c('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe36c('0x1f')][_0xe36c('0x20')]({'port':0x232b});var client9004=jayson['client'][_0xe36c('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x2d3490,_0x1a39e1,_0x1929cc,_0x38e326){return new BPromise(function(_0x492016,_0x566f24){var _0x2f412a=_0x38e326||client;return _0x2f412a[_0xe36c('0x21')](_0x2d3490,_0x1929cc)['then'](function(_0x485f60){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x1a39e1,_0xe36c('0x22'));logger[_0xe36c('0x23')](_0xe36c('0x24'),_0x1a39e1,_0xe36c('0x22'),JSON[_0xe36c('0x25')](_0x485f60));if(_0x485f60[_0xe36c('0x26')]){if(_0x485f60[_0xe36c('0x26')][_0xe36c('0x27')]===0x1f4){logger[_0xe36c('0x26')](_0xe36c('0x28'),_0x1a39e1,_0x485f60[_0xe36c('0x26')][_0xe36c('0x29')]);return _0x566f24(_0x485f60['error'][_0xe36c('0x29')]);}logger[_0xe36c('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x1a39e1,_0x485f60[_0xe36c('0x26')][_0xe36c('0x29')]);return _0x492016(_0x485f60[_0xe36c('0x26')]['message']);}else{logger['info'](_0xe36c('0x28'),_0x1a39e1,_0xe36c('0x22'));_0x492016(_0x485f60[_0xe36c('0x2a')][_0xe36c('0x29')]);}})['catch'](function(_0x260af5){logger['error'](_0xe36c('0x28'),_0x1a39e1,_0x260af5);_0x566f24(_0x260af5);});});}function respondWithStatusCode(_0xc4c935,_0x1c6037){_0x1c6037=_0x1c6037||0xcc;return function(_0x1f260b){if(_0x1f260b){return _0xc4c935[_0xe36c('0x2b')](_0x1c6037);}return _0xc4c935[_0xe36c('0x2c')](_0x1c6037)[_0xe36c('0x2d')]();};}function respondWithResult(_0x5d6be9,_0x342811){_0x342811=_0x342811||0xc8;return function(_0x11ddaa){if(_0x11ddaa){return _0x5d6be9['status'](_0x342811)[_0xe36c('0x2e')](_0x11ddaa);}};}function respondWithFilteredResult(_0x1c440d,_0x180bdf){return function(_0x3dba1d){if(_0x3dba1d){var _0x1a5414=typeof _0x180bdf[_0xe36c('0x2f')]===_0xe36c('0x30')&&typeof _0x180bdf[_0xe36c('0x31')]===_0xe36c('0x30');var _0x171a00=_0x3dba1d[_0xe36c('0x32')];var _0x440046=_0x1a5414?0x0:_0x180bdf[_0xe36c('0x2f')];var _0xa1a9e4=_0x1a5414?_0x3dba1d[_0xe36c('0x32')]:_0x180bdf[_0xe36c('0x2f')]+_0x180bdf['limit'];var _0x31bd1d;if(_0xa1a9e4>=_0x171a00){_0xa1a9e4=_0x171a00;_0x31bd1d=0xc8;}else{_0x31bd1d=0xce;}_0x1c440d[_0xe36c('0x2c')](_0x31bd1d);return _0x1c440d[_0xe36c('0x33')](_0xe36c('0x34'),_0x440046+'-'+_0xa1a9e4+'/'+_0x171a00)[_0xe36c('0x2e')](_0x3dba1d);}return null;};}function patchUpdates(_0x4d9500){return function(_0x552777){try{jsonpatch[_0xe36c('0x35')](_0x552777,_0x4d9500,!![]);}catch(_0xbbad56){return BPromise[_0xe36c('0x36')](_0xbbad56);}return _0x552777[_0xe36c('0x37')]();};}function saveUpdates(_0x8826c,_0x4201be){return function(_0x19816c){if(_0x19816c){return _0x19816c[_0xe36c('0x38')](_0x8826c)['then'](function(_0x20d992){return _0x20d992;});}return null;};}function removeEntity(_0x51c51a,_0x1549c2){return function(_0x3441be){if(_0x3441be){return _0x3441be[_0xe36c('0x39')]()[_0xe36c('0x3a')](function(){_0x51c51a[_0xe36c('0x2c')](0xcc)[_0xe36c('0x2d')]();});}};}function handleEntityNotFound(_0x245edf,_0x3214fa){return function(_0x31d6e5){if(!_0x31d6e5){_0x245edf[_0xe36c('0x2b')](0x194);}return _0x31d6e5;};}function handleError(_0x3d1592,_0x68e3e1){_0x68e3e1=_0x68e3e1||0x1f4;return function(_0x5a314c){logger[_0xe36c('0x26')](_0x5a314c['stack']);if(_0x5a314c['name']){delete _0x5a314c[_0xe36c('0x3b')];}_0x3d1592[_0xe36c('0x2c')](_0x68e3e1)[_0xe36c('0x3c')](_0x5a314c);};}function getMustacheRender(_0x45e756,_0x3d7fdd){return Mustache['render'](_0x45e756,_[_0xe36c('0x3d')](_0x3d7fdd[_0xe36c('0x3e')],{'contact':_0x3d7fdd[_0xe36c('0x3f')],'message':_0x3d7fdd[_0xe36c('0x29')],'agent':_0x3d7fdd[_0xe36c('0x40')],'interaction':_0x3d7fdd[_0xe36c('0x41')],'account':_0x3d7fdd[_0xe36c('0x42')]}))||'';}function getInteractionUsers(_0x170835,_0x354311){return new BPromise(function(_0x28390f,_0x37288f){try{if(_0x354311[_0x170835['id']]){_0x170835[_0xe36c('0x43')]=_[_0xe36c('0x44')](_0x354311[_0x170835['id']],function(_0x1f440a){return{'id':_0x1f440a['id'],'fullname':_0x1f440a[_0xe36c('0x45')]};});}}catch(_0x522b26){_0x37288f(_0x522b26);}_0x28390f(_0x170835);});}function getInteractionTags(_0x5d27dd,_0x11e8c4){return new BPromise(function(_0x4e276c,_0x50444b){try{if(_0x5d27dd[_0xe36c('0x46')]){_0x5d27dd[_0xe36c('0x47')]=[];_0x5d27dd[_0xe36c('0x46')][_0xe36c('0x48')](',')['forEach'](function(_0x3e7c4){_0x5d27dd[_0xe36c('0x47')][_0xe36c('0x49')](_0x11e8c4[_0x3e7c4]);});}delete _0x5d27dd[_0xe36c('0x46')];}catch(_0x150a9c){_0x50444b(_0x150a9c);}_0x4e276c(_0x5d27dd);});}function updateChatInteraction(_0x52ff61,_0x512b56,_0x579a65){return new BPromise(function(_0x5a6d94,_0x5c874a){return getInteractionUsers(_0x52ff61,_0x579a65)[_0xe36c('0x3a')](function(_0xf27843){return getInteractionTags(_0xf27843,_0x512b56);})[_0xe36c('0x3a')](function(_0x19b4dd){return getStateInteraction(_0x19b4dd);})[_0xe36c('0x3a')](function(_0x4180f3){_0x5a6d94(_0x4180f3);})[_0xe36c('0x4a')](function(_0x2ee426){_0x5c874a(_0x2ee426);});});}function getStateInteraction(_0x1f44f4){return new BPromise(function(_0x2e78a4){_0x1f44f4['waiting']=0x0;_0x1f44f4[_0xe36c('0x4b')]=0x0;_0x1f44f4[_0xe36c('0x4c')]=0x0;_0x1f44f4[_0xe36c('0x4d')]=0x0;_0x1f44f4['abandoned']=0x0;_0x1f44f4[_0xe36c('0x4e')]=0x0;if(!_0x1f44f4[_0xe36c('0x4f')]&&!_0x1f44f4[_0xe36c('0x50')]){_0x1f44f4[_0xe36c('0x51')]+=0x1;}if(!_0x1f44f4[_0xe36c('0x4f')]&&_0x1f44f4[_0xe36c('0x50')]){_0x1f44f4['talking']+=0x1;if(_0x1f44f4['waiting']){_0x1f44f4[_0xe36c('0x51')]-=0x1;}}if(_0x1f44f4[_0xe36c('0x4f')]&&_0x1f44f4[_0xe36c('0x52')]==='abandoned'){_0x1f44f4[_0xe36c('0x53')]+=0x1;if(_0x1f44f4[_0xe36c('0x51')]){_0x1f44f4[_0xe36c('0x51')]-=0x1;}}else if(_0x1f44f4[_0xe36c('0x4f')]&&!_0x1f44f4[_0xe36c('0x50')]&&_0x1f44f4['disposition']){_0x1f44f4[_0xe36c('0x4d')]+=0x1;if(_0x1f44f4['waiting']){_0x1f44f4['waiting']-=0x1;}}else if(_0x1f44f4['closed']&&_0x1f44f4[_0xe36c('0x50')]){_0x1f44f4[_0xe36c('0x4c')]+=0x1;if(_0x1f44f4['talking']){_0x1f44f4[_0xe36c('0x4b')]-=0x1;}}_0x1f44f4['total']+=0x1;_0x2e78a4(_0x1f44f4);});}exports[_0xe36c('0x54')]=function(_0x47afd7,_0x1de4a7){var _0x3f7c7d={},_0x206d22={},_0x1768bb={'count':0x0,'rows':[]};var _0x4d2eb7=_[_0xe36c('0x44')](db['ChatInteraction'][_0xe36c('0x55')],function(_0x3667ed){return{'name':_0x3667ed[_0xe36c('0x56')],'type':_0x3667ed[_0xe36c('0x57')]['key']};});_0x206d22[_0xe36c('0x58')]=_['map'](_0x4d2eb7,'name');_0x206d22[_0xe36c('0x59')]=_[_0xe36c('0x5a')](_0x47afd7[_0xe36c('0x59')]);_0x206d22[_0xe36c('0x5b')]=_[_0xe36c('0x5c')](_0x206d22['model'],_0x206d22[_0xe36c('0x59')]);_0x3f7c7d[_0xe36c('0x5d')]=_[_0xe36c('0x5c')](_0x206d22[_0xe36c('0x58')],qs[_0xe36c('0x5e')](_0x47afd7[_0xe36c('0x59')][_0xe36c('0x5e')]));_0x3f7c7d[_0xe36c('0x5d')]=_0x3f7c7d[_0xe36c('0x5d')][_0xe36c('0x5f')]?_0x3f7c7d[_0xe36c('0x5d')]:_0x206d22['model'];if(!_0x47afd7[_0xe36c('0x59')]['hasOwnProperty'](_0xe36c('0x60'))){_0x3f7c7d[_0xe36c('0x31')]=qs[_0xe36c('0x31')](_0x47afd7['query'][_0xe36c('0x31')]);_0x3f7c7d[_0xe36c('0x2f')]=qs[_0xe36c('0x2f')](_0x47afd7[_0xe36c('0x59')][_0xe36c('0x2f')]);}_0x3f7c7d[_0xe36c('0x61')]=qs['sort'](_0x47afd7[_0xe36c('0x59')][_0xe36c('0x62')]);_0x3f7c7d['where']=qs[_0xe36c('0x5b')](_[_0xe36c('0x63')](_0x47afd7[_0xe36c('0x59')],_0x206d22[_0xe36c('0x5b')]),_0x4d2eb7);var _0xbe69a1=[];var _0x2b07b8=squel[_0xe36c('0x64')]()[_0xe36c('0x65')]('id')['field']('name')[_0xe36c('0x65')](_0xe36c('0x66'))[_0xe36c('0x67')](_0xe36c('0x68'));var _0x1da5ab=squel['select']()[_0xe36c('0x65')](_0xe36c('0x69'))['field'](_0xe36c('0x6a'))[_0xe36c('0x65')](_0xe36c('0x6b'))[_0xe36c('0x67')](_0xe36c('0x6c'),'ui')[_0xe36c('0x6d')](_0xe36c('0x6e'),'u',_0xe36c('0x6f'));var _0x33d097=squel[_0xe36c('0x64')]()[_0xe36c('0x67')]('chat_interactions','i')[_0xe36c('0x6d')](_0xe36c('0x70'),'c',_0xe36c('0x71'))['left_join'](_0xe36c('0x6e'),'o','o.id\x20=\x20i.UserId')['left_join'](_0xe36c('0x72'),'a',_0xe36c('0x73'))[_0xe36c('0x6d')]('chat_messages','me',_0xe36c('0x74'))[_0xe36c('0x6d')](_0xe36c('0x75'),'it',_0xe36c('0x76'))[_0xe36c('0x6d')](_0xe36c('0x68'),'t','t.id\x20=\x20it.TagId');var _0x5b12d8=squel[_0xe36c('0x77')]();var _0x16c2a7=[];var _0x170b30=squel['expr']();var _0x2533e7;if(_0x47afd7[_0xe36c('0x59')][_0xe36c('0x78')]){_0x2533e7=as[_0xe36c('0x79')](_0x47afd7[_0xe36c('0x59')][_0xe36c('0x78')]);var _0x301584=_0x2533e7[_0xe36c('0x7a')];for(var _0xe2c486=0x0;_0xe2c486<_0x2533e7['conditions'][_0xe36c('0x5f')];_0xe2c486++){var _0x567836=_0x2533e7[_0xe36c('0x7b')][_0xe2c486];var _0x2b7321='i';var _0x14f0cc=_[_0xe36c('0x7c')](_0x4d2eb7,[_0xe36c('0x3b'),_0x567836[_0xe36c('0x65')]]);if(!_0x14f0cc){switch(_0x567836['field']){case'unreadMessages':if(_0x567836[_0xe36c('0x7d')]==0x1){_0x33d097[_0xe36c('0x7e')]('`'+_0x567836[_0xe36c('0x65')]+'`\x20=\x200');}else{_0x33d097['having']('`'+_0x567836[_0xe36c('0x65')]+_0xe36c('0x7f'));}break;case _0xe36c('0x80'):if(_0x567836['operator']===_0xe36c('0x81')){if(_0x567836[_0xe36c('0x7d')][_0xe36c('0x48')]('\x20')['length']>0x1){_0x5b12d8[_0x301584]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe36c('0x82')](_0x567836['value']),null);}else{var _0x18e32e='%'+_0x567836[_0xe36c('0x7d')]+'%';_0x5b12d8[_0x301584](_0xe36c('0x83'),_0x18e32e,_0x18e32e,_0x18e32e);}}else{_0x14f0cc=_[_0xe36c('0x7c')](_0x4d2eb7,[_0xe36c('0x3b'),_0xe36c('0x84')]);_0x567836[_0xe36c('0x65')]=_0xe36c('0x84');_0x2e789f=as[_0xe36c('0x85')](_0x2b7321,_0x14f0cc[_0xe36c('0x57')],_0x567836);_0x5b12d8[_0x301584](_0x2e789f[_0xe36c('0x86')],_0x2e789f['value']['start'],_0x2e789f[_0xe36c('0x7d')][_0xe36c('0x2d')]);}break;case _0xe36c('0x87'):var _0x561fd2=_0x567836[_0xe36c('0x7d')][_0xe36c('0x48')](',')['map'](function(_0x16cf13){return Number(_0x16cf13);});_0x561fd2[_0xe36c('0x88')](function(_0x8f9db2){_0x170b30['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x8f9db2+',%');});_0x16c2a7=_[_0xe36c('0x89')](_0x16c2a7,_0x561fd2);break;case _0xe36c('0x8a'):if(_0x567836[_0xe36c('0x8b')]==='$substring'){_0x5b12d8[_0x301584](_0xe36c('0x8c'),'%'+_0x567836[_0xe36c('0x7d')]+'%',null);}else{_0x14f0cc=_[_0xe36c('0x7c')](_0x4d2eb7,[_0xe36c('0x3b'),'UserId']);_0x567836[_0xe36c('0x65')]=_0xe36c('0x50');_0x2e789f=as[_0xe36c('0x85')](_0x2b7321,_0x14f0cc[_0xe36c('0x57')],_0x567836);_0x5b12d8[_0x301584](_0x2e789f['text'],_0x2e789f[_0xe36c('0x7d')][_0xe36c('0x8d')],_0x2e789f[_0xe36c('0x7d')]['end']);}break;case _0xe36c('0x3e'):_0x2e789f=as[_0xe36c('0x85')]('me',null,_0x567836);_0x5b12d8[_0x301584](_0x2e789f[_0xe36c('0x86')],_0x2e789f['value'][_0xe36c('0x8d')],_0x2e789f['value'][_0xe36c('0x2d')]);break;}}else{var _0x2e789f=as[_0xe36c('0x85')](_0x2b7321,_0x14f0cc[_0xe36c('0x57')],_0x567836);_0x5b12d8[_0x301584](_0x2e789f[_0xe36c('0x86')],_0x2e789f[_0xe36c('0x7d')]['start'],_0x2e789f[_0xe36c('0x7d')][_0xe36c('0x2d')]);}}}else{var _0x383f08=_(_0x47afd7['query'])[_0xe36c('0x5a')]()[_0xe36c('0x44')](function(_0x57acad){return _['some'](_0x4d2eb7,[_0xe36c('0x3b'),_0x57acad])?_0x57acad:undefined;})[_0xe36c('0x8e')]()[_0xe36c('0x7d')]();if(!_[_0xe36c('0x8f')](_0x383f08)){_0x383f08[_0xe36c('0x88')](function(_0x3ca503){if(_0x3ca503===_0xe36c('0x90')){_0x33d097['where'](_0xe36c('0x91'),[][_0xe36c('0x92')](_0x47afd7[_0xe36c('0x59')][_0x3ca503]));}else if(_0x3ca503===_0xe36c('0x93')){var _0x1dac2c=JSON['parse'](_0x47afd7[_0xe36c('0x59')][_0x3ca503])[_0xe36c('0x94')];var _0x1780fe=JSON[_0xe36c('0x95')](_0x47afd7[_0xe36c('0x59')][_0x3ca503])[_0xe36c('0x96')];_0x33d097[_0xe36c('0x97')](_0xe36c('0x98'),_0x1dac2c,_0x1780fe);}else{if(_0x47afd7[_0xe36c('0x59')][_0x3ca503]===_0xe36c('0x99')){_0x33d097[_0xe36c('0x97')]('i.'+_0x3ca503+_0xe36c('0x9a'));}else{_0x33d097[_0xe36c('0x97')]('i.'+_0x3ca503+_0xe36c('0x9b'),_0x47afd7[_0xe36c('0x59')][_0x3ca503]);}}});}if(_0x47afd7[_0xe36c('0x59')][_0xe36c('0x9c')]){if(_0x47afd7['query'][_0xe36c('0x9c')]==0x1){_0x33d097['having']('`unreadMessages`\x20=\x200');}else{_0x33d097[_0xe36c('0x7e')](_0xe36c('0x9d'));}}if(_0x47afd7[_0xe36c('0x59')][_0xe36c('0x9e')]){_0x16c2a7=_[_0xe36c('0x9f')](_0x47afd7[_0xe36c('0x59')][_0xe36c('0x9e')])?_0x47afd7[_0xe36c('0x59')][_0xe36c('0x9e')]:new Array(_0x47afd7['query']['tag']);_0x16c2a7[_0xe36c('0x88')](function(_0x3fc8aa){_0x170b30['or'](_0xe36c('0xa0'),'%,'+_0x3fc8aa+',%');});}if(_0x47afd7[_0xe36c('0x59')]['filter']){var _0x4e6542=_0x47afd7[_0xe36c('0x59')]['filter']['replace']('\x5c','\x5c\x5c')[_0xe36c('0xa1')](/'/g,'\x27\x27');if(qs[_0xe36c('0xa2')](_0x4e6542)){_0x5b12d8['or']('i.id\x20LIKE\x20?',_0x4e6542+'%');}else{_0x5b12d8['or'](_0xe36c('0xa3'),qs[_0xe36c('0x82')](_0x4e6542))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4e6542+'%');}}}_0x33d097['where'](_0x5b12d8);_0x33d097['group']('i.id');var _0x50a8c5={'type':db[_0xe36c('0xa4')]['QueryTypes'][_0xe36c('0xa5')],'raw':!![]};var _0x2bf694=_0x33d097[_0xe36c('0xa6')]();_0x2bf694[_0xe36c('0x65')]('i.id');_0x2bf694[_0xe36c('0x65')](_0xe36c('0xa7'),_0xe36c('0xa8'));if(_0x3f7c7d['order']){_0x3f7c7d[_0xe36c('0x61')][_0xe36c('0x88')](function(_0x4dcbcb){var _0x366e21=_0x4dcbcb[0x0]===_0xe36c('0xa9')?_0x4dcbcb[0x0]:'i.'+_0x4dcbcb[0x0];_0x33d097[_0xe36c('0x61')](_0x366e21,_0x4dcbcb[0x1]===_0xe36c('0xaa')?![]:!![]);});}if(!_[_0xe36c('0x8f')](_0x16c2a7)){_0x33d097[_0xe36c('0x7e')](_0x170b30);_0x2bf694[_0xe36c('0x97')]('t.id\x20IN\x20?',_0x16c2a7);}BPromise['resolve']()[_0xe36c('0x3a')](function(){if(!_0x2533e7){if(_0x47afd7[_0xe36c('0x59')][_0xe36c('0x90')])return;_0x2bf694['where'](_0xe36c('0xab'));_0x33d097[_0xe36c('0x97')](_0xe36c('0xab'));return;}if(_0x47afd7[_0xe36c('0xac')][_0xe36c('0xad')]!==_0xe36c('0x40'))return;return _0x47afd7[_0xe36c('0xac')][_0xe36c('0xae')]({'attributes':['id'],'raw':!![]})['then'](function(_0x24f720){if(_['isEmpty'](_0x24f720)){_0x2bf694['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x33d097['where'](_0xe36c('0xaf'));}else{_0x2bf694['where'](_0xe36c('0x91'),_[_0xe36c('0x44')](_0x24f720,'id'));_0x33d097[_0xe36c('0x97')](_0xe36c('0x91'),_['map'](_0x24f720,'id'));}});})[_0xe36c('0x3a')](function(){if(_0x47afd7[_0xe36c('0xac')][_0xe36c('0xad')]===_0xe36c('0x40')&&!_0x2533e7&&!_0x47afd7[_0xe36c('0x59')]['ChatWebsiteId'])return[];return db['sequelize'][_0xe36c('0x59')](_0x2bf694[_0xe36c('0xb0')](),_0x50a8c5);})[_0xe36c('0x3a')](function(_0x441ddf){_0x1768bb[_0xe36c('0x32')]=_0x441ddf['length'];if(_0x1768bb['count']===0x0)return[];return db['sequelize'][_0xe36c('0x59')](_0x2b07b8[_0xe36c('0xb0')](),_0x50a8c5)[_0xe36c('0x3a')](function(_0x138cc0){_0xbe69a1=_[_0xe36c('0xb1')](_0x138cc0,'id');_0x50a8c5=_[_0xe36c('0x3d')](_0x50a8c5,{'model':db[_0xe36c('0xb2')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x47afd7[_0xe36c('0x59')][_0xe36c('0x5e')]){_0x3f7c7d[_0xe36c('0x5d')]['forEach'](function(_0x23763b){_0x33d097[_0xe36c('0x65')]('i.'+_0x23763b);});}else{_0x33d097['field'](_0xe36c('0xa7'),'unreadMessages');_0x33d097[_0xe36c('0x65')]('a.key',_0xe36c('0xb3'));_0x33d097[_0xe36c('0x65')](_0xe36c('0xb4'),'Account.mandatoryDisposition');_0x33d097['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xe36c('0xa9'));_0x33d097[_0xe36c('0x65')](_0xe36c('0xb5'));_0x33d097[_0xe36c('0x65')]('c.firstName',_0xe36c('0xb6'));_0x33d097['field'](_0xe36c('0xb7'),_0xe36c('0xb8'));_0x33d097[_0xe36c('0x65')](_0xe36c('0xb9'),_0xe36c('0xba'));_0x33d097['field'](_0xe36c('0xbb'),_0xe36c('0xbc'));_0x33d097[_0xe36c('0x65')](_0xe36c('0xbd'),'Contact.mobile');_0x33d097[_0xe36c('0x65')](_0xe36c('0xbe'),'Contact.fax');_0x33d097[_0xe36c('0x65')](_0xe36c('0xbf'),_0xe36c('0xc0'));_0x33d097['field']('o.internal',_0xe36c('0xc1'));_0x33d097[_0xe36c('0x65')](_0xe36c('0xc2'),_0xe36c('0x46'));}if(_0x3f7c7d[_0xe36c('0x31')])_0x33d097['limit'](_0x3f7c7d['limit']);if(_0x3f7c7d['offset'])_0x33d097[_0xe36c('0x2f')](_0x3f7c7d['offset']);return db[_0xe36c('0xc3')][_0xe36c('0x59')](_0x33d097[_0xe36c('0xb0')](),_0x50a8c5);})['then'](function(_0x5cb92c){if(_0x5cb92c[_0xe36c('0x5f')]>0x0)_0x1da5ab['where']('ui.ChatInteractionId\x20IN\x20?',_[_0xe36c('0x44')](_0x5cb92c,'id'));return db[_0xe36c('0xc3')][_0xe36c('0x59')](_0x1da5ab[_0xe36c('0xb0')](),_0x50a8c5)[_0xe36c('0x3a')](function(_0x283f81){var _0x2c5857=_[_0xe36c('0xc4')](_0x283f81,_0xe36c('0xc5'));var _0x542478=[];_0x5cb92c[_0xe36c('0x88')](function(_0x58af74){_0x542478[_0xe36c('0x49')](updateChatInteraction(_0x58af74,_0xbe69a1,_0x2c5857));});return BPromise[_0xe36c('0xc6')](_0x542478);});});})[_0xe36c('0x3a')](function(_0x59864d){_0x1768bb[_0xe36c('0xc7')]=_0x59864d;return _0x1768bb;})[_0xe36c('0x3a')](respondWithFilteredResult(_0x1de4a7,_0x3f7c7d))[_0xe36c('0x4a')](handleError(_0x1de4a7,null));};exports[_0xe36c('0xc8')]=function(_0x139904,_0x36935e){var _0x5ba992={'raw':![],'where':{'id':_0x139904[_0xe36c('0xc9')]['id']}},_0x4589d3={};_0x4589d3['model']=_[_0xe36c('0x5a')](db[_0xe36c('0xb2')][_0xe36c('0x55')]);_0x4589d3[_0xe36c('0x59')]=_[_0xe36c('0x5a')](_0x139904[_0xe36c('0x59')]);_0x4589d3[_0xe36c('0x5b')]=_[_0xe36c('0x5c')](_0x4589d3['model'],_0x4589d3['query']);_0x5ba992[_0xe36c('0x5d')]=_['intersection'](_0x4589d3[_0xe36c('0x58')],qs[_0xe36c('0x5e')](_0x139904[_0xe36c('0x59')][_0xe36c('0x5e')]));_0x5ba992['attributes']=_0x5ba992[_0xe36c('0x5d')][_0xe36c('0x5f')]?_0x5ba992[_0xe36c('0x5d')]:_0x4589d3[_0xe36c('0x58')];if(_0x139904['query'][_0xe36c('0xca')]){_0x5ba992[_0xe36c('0xcb')]=[{'all':!![]}];}_0x5ba992=_[_0xe36c('0x3d')]({},_0x5ba992,_0x139904[_0xe36c('0xcc')]);return db[_0xe36c('0xb2')][_0xe36c('0x7c')](_0x5ba992)[_0xe36c('0x3a')](handleEntityNotFound(_0x36935e,null))[_0xe36c('0x3a')](respondWithResult(_0x36935e,null))['catch'](handleError(_0x36935e,null));};exports[_0xe36c('0xcd')]=function(_0x5e759a,_0x4c605c){return db['ChatInteraction'][_0xe36c('0xcd')](_0x5e759a[_0xe36c('0x3e')],{})[_0xe36c('0x3a')](respondWithResult(_0x4c605c,0xc9))['catch'](handleError(_0x4c605c,null));};exports[_0xe36c('0x38')]=function(_0x38bbb6,_0x12eda3){if(_0x38bbb6[_0xe36c('0x3e')]['id']){delete _0x38bbb6[_0xe36c('0x3e')]['id'];}return db[_0xe36c('0xb2')][_0xe36c('0x7c')]({'where':{'id':_0x38bbb6[_0xe36c('0xc9')]['id']}})[_0xe36c('0x3a')](handleEntityNotFound(_0x12eda3,null))['then'](saveUpdates(_0x38bbb6[_0xe36c('0x3e')],null))['then'](respondWithResult(_0x12eda3,null))[_0xe36c('0x4a')](handleError(_0x12eda3,null));};exports[_0xe36c('0x39')]=function(_0x22555e,_0x21098){return db[_0xe36c('0xb2')][_0xe36c('0x7c')]({'where':{'id':_0x22555e['params']['id']}})[_0xe36c('0x3a')](handleEntityNotFound(_0x21098,null))[_0xe36c('0x3a')](removeEntity(_0x21098,null))[_0xe36c('0x4a')](handleError(_0x21098,null));};exports[_0xe36c('0xce')]=function(_0x202144,_0x685c41){return db[_0xe36c('0xb2')]['describe']()[_0xe36c('0x3a')](respondWithResult(_0x685c41,null))['catch'](handleError(_0x685c41,null));};exports[_0xe36c('0xcf')]=function(_0x2bdedf,_0x44ca01){var _0x54999e=_0x2bdedf[_0xe36c('0xc9')]['id'];var _0x5be280;var _0x35d8cb;var _0xe951a;return db[_0xe36c('0xb2')][_0xe36c('0xd0')]({'where':{'id':_0x54999e}})[_0xe36c('0x3a')](function(_0xe5f0e7){_0x5be280=_0xe5f0e7;return db[_0xe36c('0xd1')]['findOne']({'where':{'id':_0xe5f0e7[_0xe36c('0x90')]},'attributes':['id',_0xe36c('0xd2'),'vidaooEscalation','vidaooTopic',_0xe36c('0xd3'),_0xe36c('0xd4')],'raw':!![]});})['then'](function(_0x4292cf){if(_0x4292cf&&_0x4292cf[_0xe36c('0xd2')]&&_0x4292cf[_0xe36c('0xd5')]){_0x35d8cb=_0x4292cf;var _0x1a8956={'interaction':{'id':_0x54999e},'agent':{'id':_0x2bdedf[_0xe36c('0xac')]['id'],'name':_0x2bdedf[_0xe36c('0xac')]['name'],'fullname':_0x2bdedf[_0xe36c('0xac')]['fullname'],'email':_0x2bdedf[_0xe36c('0xac')][_0xe36c('0xd6')]},'contact':_0x2bdedf['body'][_0xe36c('0x3f')],'account':_0x2bdedf[_0xe36c('0x3e')][_0xe36c('0x42')]};var _0x1319c3={'rejectUnauthorized':![],'method':'POST','url':_0xe36c('0xd7'),'headers':{'X-APIKEY':_0x4292cf[_0xe36c('0xd2')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2bdedf[_0xe36c('0xac')][_0xe36c('0xd6')]],'buttons':null,'topic':_0x35d8cb['vidaooTopic'],'note':_[_0xe36c('0xd8')](_0x35d8cb[_0xe36c('0xd3')])?null:getMustacheRender(_0x35d8cb[_0xe36c('0xd3')],_0x1a8956),'metadata':null},'redirect':_0xe36c('0xd9'),'json':!![]};try{if(!_['isNull'](_0x35d8cb[_0xe36c('0xd4')])){var _0x176366=getMustacheRender(_0x35d8cb[_0xe36c('0xd4')],_0x1a8956);var _0x24eb69=JSON[_0xe36c('0x95')](_0x176366);_0x1319c3[_0xe36c('0x3e')][_0xe36c('0xda')]=_0x24eb69;}}catch(_0x37d792){throw new db['Sequelize']['ValidationError'](_0xe36c('0xdb'));}return rp(_0x1319c3);}else{throw new db[(_0xe36c('0xa4'))][(_0xe36c('0xdc'))](_0xe36c('0xdd'));}})[_0xe36c('0x3a')](function(_0xba89b8){_0xe951a=_0xba89b8;if(_0xe951a['id']){var _0x1529ff={'body':_0xe951a[_0xe36c('0xde')],'ChatWebsiteId':_0x35d8cb['id'],'ChatInteractionId':_0x5be280['id'],'direction':'out','UserId':_0x2bdedf[_0xe36c('0xac')]['id']};return db['ChatMessage']['create'](_0x1529ff,{});}else{throw new db[(_0xe36c('0xa4'))][(_0xe36c('0xdc'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xe36c('0x3a')](function(){return _0x5be280[_0xe36c('0xdf')]({'vidaooSessionId':_0xe951a['id']});})[_0xe36c('0x3a')](respondWithResult(_0x44ca01,null))[_0xe36c('0x4a')](handleError(_0x44ca01,null));};exports[_0xe36c('0xe0')]=function(_0x296c54,_0x7b0ea8){if(_0x296c54[_0xe36c('0x3e')]['id']){delete _0x296c54['body']['id'];}return db[_0xe36c('0xb2')][_0xe36c('0x7c')]({'where':{'id':_0x296c54[_0xe36c('0xc9')]['id']},'include':[{'model':db[_0xe36c('0xe1')],'as':_0xe36c('0x80')}]})[_0xe36c('0x3a')](handleEntityNotFound(_0x7b0ea8,null))[_0xe36c('0x3a')](saveUpdates(_0x296c54[_0xe36c('0x3e')],null))[_0xe36c('0x3a')](respondWithResult(_0x7b0ea8,null))[_0xe36c('0x4a')](handleError(_0x7b0ea8,null));};exports[_0xe36c('0xe2')]=function(_0x3fefd7,_0x4f2c46,_0x606c03){if(_0x3fefd7[_0xe36c('0x3e')]['id']){delete _0x3fefd7[_0xe36c('0x3e')]['id'];}return db[_0xe36c('0xb2')][_0xe36c('0x7c')]({'where':{'id':_0x3fefd7[_0xe36c('0xc9')]['id']}})[_0xe36c('0x3a')](function(_0x24ae4e){if(!_0x24ae4e){logger[_0xe36c('0x26')](_0xe36c('0xe3'),_0xe36c('0xe2'),0x194,_0xe36c('0xe4'));_0x4f2c46[_0xe36c('0x2b')](0x194);}else{if(_0x24ae4e[_0xe36c('0x50')]){throw new db[(_0xe36c('0xa4'))][(_0xe36c('0xdc'))](_0xe36c('0xe5'));}}return _0x24ae4e;})['then'](function(_0x41feae){if(_0x41feae){return _0x41feae['update']({'closed':_0x3fefd7[_0xe36c('0x3e')][_0xe36c('0x4f')],'disposition':_0x3fefd7['body'][_0xe36c('0x52')]})[_0xe36c('0x3a')](function(_0x459b6a){return _0x459b6a;});}})['then'](function(_0x56ec25){return respondWithRpcPromise(_0xe36c('0xe6'),'abandon',_0x3fefd7[_0xe36c('0x3e')],client9004);})[_0xe36c('0x3a')](respondWithResult(_0x4f2c46,null))[_0xe36c('0x4a')](handleError(_0x4f2c46,null));};exports[_0xe36c('0xe7')]=function(_0x298d6b,_0x2e4c9d,_0x293800){_0x298d6b[_0xe36c('0x3e')][_0xe36c('0x3b')]=_0x298d6b[_0xe36c('0xe8')][_0xe36c('0xe9')];_0x298d6b[_0xe36c('0x3e')][_0xe36c('0xea')]=_0x298d6b[_0xe36c('0xe8')][_0xe36c('0xeb')];_0x298d6b['body'][_0xe36c('0x57')]=_0x298d6b['file'][_0xe36c('0xec')];return db['Attachment'][_0xe36c('0xcd')](_0x298d6b['body'])[_0xe36c('0x3a')](respondWithResult(_0x2e4c9d,0xc9))['catch'](handleError(_0x2e4c9d,null));};exports['attachmentDownload']=function(_0xd8704f,_0x446794,_0x4b9a4f){return db[_0xe36c('0xb2')][_0xe36c('0xd0')]({'where':{'id':_0xd8704f[_0xe36c('0xc9')]['id']},'raw':!![]})[_0xe36c('0x3a')](handleEntityNotFound(_0x446794,null))['then'](function(_0x1706de){if(_0x1706de){if(_0x1706de[_0xe36c('0x4f')]){return _0x446794[_0xe36c('0x2c')](0x193)[_0xe36c('0x2e')]({'status':0x193,'message':_0xe36c('0xed')});}return db['Attachment'][_0xe36c('0xd0')]({'where':{'id':_0xd8704f[_0xe36c('0x59')]['attachId']},'raw':!![]})[_0xe36c('0x3a')](handleEntityNotFound(_0x446794,null));}})['then'](function(_0x577da0){if(_0x577da0){var _0x5be314=_0x577da0[_0xe36c('0xee')]!==null;var _0x9fe632=path['join'](config[_0xe36c('0xef')],_0xe36c('0xf0'));if(_0x5be314){_0x9fe632=path[_0xe36c('0xf1')](_0x9fe632,'offline-chat/');}var _0x22b786=path[_0xe36c('0xf1')](_0x9fe632,_0x577da0[_0xe36c('0xea')]);return _0x446794['download'](_0x22b786);}})[_0xe36c('0x4a')](handleError(_0x446794,null));};exports[_0xe36c('0xf2')]=function(_0x30979a,_0x26364f){var _0xa73bfb=null;var _0x115e67=null;var _0x28f300=null;var _0x426182=null;if(_0x30979a[_0xe36c('0x3e')]['id']){delete _0x30979a[_0xe36c('0x3e')]['id'];}if(_0x30979a[_0xe36c('0x3e')]['mailTranscript']){_0x426182=path[_0xe36c('0xf1')](config[_0xe36c('0xef')],_0xe36c('0xf3'),util[_0xe36c('0xf4')](_0xe36c('0xf5'),Date[_0xe36c('0xf6')]()));_0x30979a['body'][_0xe36c('0xf7')]=_0x426182;}return db['ChatInteraction'][_0xe36c('0x7c')]({'where':{'id':_0x30979a[_0xe36c('0xc9')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xe36c('0x8a')],'as':_0xe36c('0x8a')}]}]})[_0xe36c('0x3a')](handleEntityNotFound(_0x26364f,null))[_0xe36c('0x3a')](saveUpdates(_0x30979a['body'],null))['then'](function(_0x5f03d5){if(_0x5f03d5){_0xa73bfb=_0x5f03d5;return db['ChatWebsite']['find']({'where':{'id':_0xa73bfb[_0xe36c('0x90')]}});}})['then'](function(_0x2fda27){if(_0x2fda27){_0x28f300=_0x2fda27;return db[_0xe36c('0xe1')][_0xe36c('0x7c')]({'where':{'id':_0xa73bfb[_0xe36c('0x84')]}});}})[_0xe36c('0x3a')](function(_0x5275ac){if(_0x5275ac){_0x115e67=_0x5275ac;if(_0x426182){var _0x394237=null;for(var _0x4ab564=0x1;_0x4ab564<_0xa73bfb['Messages'][_0xe36c('0x5f')];++_0x4ab564){_0x394237=_0xa73bfb[_0xe36c('0xf8')][_0x4ab564];var _0x12b66b=_0x394237[_0xe36c('0x50')]?util[_0xe36c('0xf4')](_0xe36c('0xf9'),_0x28f300[_0xe36c('0xfa')],_0x394237[_0xe36c('0x50')]):'System';var _0x2ba75b=_0x30979a[_0xe36c('0x3e')]['customer']||util[_0xe36c('0xf4')](_0xe36c('0xf9'),_0xe36c('0xfb'),_0x394237[_0xe36c('0x84')]);switch(_0x28f300[_0xe36c('0xfc')]){case'website_alias':_0x12b66b=_0x394237[_0xe36c('0x50')]?util[_0xe36c('0xf4')](_0xe36c('0xf9'),_0x28f300['agentAlias'],_0x394237[_0xe36c('0x50')]):_0xe36c('0xfd');break;case _0xe36c('0xfe'):_0x12b66b=_0x394237['UserId']?_0x394237[_0xe36c('0x8a')][_0xe36c('0xff')]||_0x394237[_0xe36c('0x8a')][_0xe36c('0x45')]:_0xe36c('0xfd');break;case _0xe36c('0x100'):_0x12b66b=_0x394237['UserId']?_0x394237[_0xe36c('0x8a')][_0xe36c('0x45')]:_0xe36c('0xfd');break;default:_0x12b66b=_0x394237[_0xe36c('0x50')]?util[_0xe36c('0xf4')](_0xe36c('0xf9'),_0x28f300[_0xe36c('0xfa')],_0x394237[_0xe36c('0x50')]):_0xe36c('0xfd');}var _0x3074c2=util['format'](_0xe36c('0x101'),moment(_0x394237[_0xe36c('0x93')])[_0xe36c('0xf4')]('MM/DD/YYYY\x20HH:mm:ss'),_0x394237[_0xe36c('0x102')]==='in'?_0x2ba75b:_0x12b66b,_0x394237['body']);if(!_0x394237['secret']){fs[_0xe36c('0x103')](_0x426182,_0x3074c2);}}return db[_0xe36c('0x104')][_0xe36c('0xd0')]({'where':{'service':!![]},'include':[{'model':db[_0xe36c('0x105')],'as':_0xe36c('0x106'),'raw':!![]}]});}}})['then'](function(_0x2f142b){if(_0x2f142b&&_0x2f142b[_0xe36c('0x106')]&&_0x30979a['body']){var _0x453cda={'tls':{'rejectUnauthorized':![]}};if(_0x2f142b[_0xe36c('0x106')][_0xe36c('0x107')]){_0x453cda[_0xe36c('0x107')]=_0x2f142b[_0xe36c('0x106')][_0xe36c('0x107')];}else{_0x453cda[_0xe36c('0x108')]=_0x2f142b[_0xe36c('0x106')]['host'];_0x453cda[_0xe36c('0x109')]=_0x2f142b[_0xe36c('0x106')][_0xe36c('0x109')];_0x453cda[_0xe36c('0x10a')]=_0x2f142b[_0xe36c('0x106')][_0xe36c('0x10a')];}if(_0x2f142b[_0xe36c('0x106')][_0xe36c('0x10b')]){_0x453cda[_0xe36c('0x10c')]={'user':_0x2f142b['Smtp']['user'],'pass':_0x2f142b[_0xe36c('0x106')][_0xe36c('0x10d')]};}return respondWithRpcPromise(_0xe36c('0x10e'),_0xe36c('0x10f'),{'account':_0x453cda,'message':{'from':util[_0xe36c('0xf4')](_0xe36c('0x110'),_0x2f142b['name'],_0x2f142b[_0xe36c('0xd6')]||_0x2f142b[_0xe36c('0x106')][_0xe36c('0xac')]),'to':_0x30979a[_0xe36c('0x3e')][_0xe36c('0x111')],'subject':_0xe36c('0x112'),'text':util[_0xe36c('0xf4')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x30979a[_0xe36c('0x3e')][_0xe36c('0x111')]),'attachments':[{'path':_0x426182}]}})['then'](function(){return _0xa73bfb;})['catch'](function(_0x1f102c){console[_0xe36c('0x26')](_0x1f102c);});}else{return _0xa73bfb;}})[_0xe36c('0x3a')](respondWithStatusCode(_0x26364f,0xc8))[_0xe36c('0x4a')](handleError(_0x26364f,null));};exports['addMessage']=function(_0x5829de,_0x4dd965,_0xc6a091){return db[_0xe36c('0x113')][_0xe36c('0x7c')]({'where':{'id':_0x5829de[_0xe36c('0xc9')]['id']}})['then'](handleEntityNotFound(_0x4dd965,null))[_0xe36c('0x3a')](function(_0x48f9e9){if(_0x48f9e9){return _0x48f9e9[_0xe36c('0x114')](_0x5829de[_0xe36c('0x3e')][_0xe36c('0x115')],_['omit'](_0x5829de[_0xe36c('0x3e')],[_0xe36c('0x115'),'id'])||{});}})[_0xe36c('0x3a')](respondWithResult(_0x4dd965,null))[_0xe36c('0x4a')](handleError(_0x4dd965,null));};exports[_0xe36c('0x116')]=function(_0x266d4e,_0x42dc86,_0x2dbe2b){var _0x3612d4={'raw':![],'where':{}};var _0x56c5a7={};var _0x139af2={'count':0x0,'rows':[]};return db[_0xe36c('0xb2')][_0xe36c('0xd0')]({'where':{'id':_0x266d4e[_0xe36c('0xc9')]['id']}})[_0xe36c('0x3a')](handleEntityNotFound(_0x42dc86,null))[_0xe36c('0x3a')](function(_0x56b93d){if(_0x56b93d){_0x56c5a7['model']=_[_0xe36c('0x5a')](db[_0xe36c('0x113')]['rawAttributes']);_0x56c5a7[_0xe36c('0x59')]=_['keys'](_0x266d4e[_0xe36c('0x59')]);_0x56c5a7['filters']=_['intersection'](_0x56c5a7['model'],_0x56c5a7[_0xe36c('0x59')]);_0x3612d4[_0xe36c('0x5d')]=_[_0xe36c('0x5c')](_0x56c5a7[_0xe36c('0x58')],qs['fields'](_0x266d4e[_0xe36c('0x59')][_0xe36c('0x5e')]));_0x3612d4[_0xe36c('0x5d')]=_0x3612d4[_0xe36c('0x5d')]['length']?_0x3612d4['attributes']:_0x56c5a7[_0xe36c('0x58')];if(!_0x266d4e[_0xe36c('0x59')][_0xe36c('0x117')](_0xe36c('0x60'))){_0x3612d4[_0xe36c('0x31')]=qs[_0xe36c('0x31')](_0x266d4e['query'][_0xe36c('0x31')]);_0x3612d4[_0xe36c('0x2f')]=qs['offset'](_0x266d4e[_0xe36c('0x59')][_0xe36c('0x2f')]);}_0x3612d4[_0xe36c('0x61')]=qs[_0xe36c('0x62')](_0x266d4e[_0xe36c('0x59')][_0xe36c('0x62')]);_0x3612d4[_0xe36c('0x97')]=qs[_0xe36c('0x5b')](_[_0xe36c('0x63')](_0x266d4e[_0xe36c('0x59')],_0x56c5a7['filters']));_0x3612d4[_0xe36c('0x97')]['ChatInteractionId']=_0x56b93d['id'];if(_0x266d4e[_0xe36c('0x59')][_0xe36c('0x118')]){_0x3612d4['where']=_[_0xe36c('0x3d')](_0x3612d4[_0xe36c('0x97')],{'$or':_['map'](_0x3612d4[_0xe36c('0x5d')],function(_0x19d6f3){var _0x564813={};_0x564813[_0x19d6f3]={'$like':'%'+_0x266d4e['query']['filter']+'%'};return _0x564813;})});}if(_0x266d4e[_0xe36c('0x59')][_0xe36c('0x94')]){var _0x4f3b14=_0x266d4e[_0xe36c('0x59')][_0xe36c('0x94')][_0xe36c('0x48')](',');var _0x28d89f={};_0x28d89f[_0x4f3b14[0x0]]={'$gte':moment(_0x4f3b14[0x1])[_0xe36c('0xf4')](_0xe36c('0x119'))};_0x3612d4[_0xe36c('0x97')]=_[_0xe36c('0x3d')](_0x3612d4[_0xe36c('0x97')],_0x28d89f);}_0x3612d4=_['merge']({},_0x3612d4,_0x266d4e[_0xe36c('0xcc')]);return db[_0xe36c('0x113')][_0xe36c('0x32')]({'where':_0x3612d4[_0xe36c('0x97')]})['then'](function(_0x4a7956){_0x139af2['count']=_0x4a7956;if(_0x266d4e[_0xe36c('0x59')]['includeAll']){_0x3612d4[_0xe36c('0xcb')]=[{'all':!![]}];}return db[_0xe36c('0x113')][_0xe36c('0x11a')](_0x3612d4);})[_0xe36c('0x3a')](function(_0x1699d5){_0x139af2['rows']=_0x1699d5;return _0x139af2;});}})[_0xe36c('0x3a')](respondWithFilteredResult(_0x42dc86,_0x3612d4))[_0xe36c('0x4a')](handleError(_0x42dc86,null));};exports[_0xe36c('0x11b')]=function(_0x56acac,_0x274a72,_0x4e57d0){var _0xd3ad16={'where':{}},_0x188213={},_0x37b4b3={'count':0x0,'rows':[]};return db[_0xe36c('0xb2')][_0xe36c('0xd0')]({'where':{'id':_0x56acac[_0xe36c('0xc9')]['id']}})[_0xe36c('0x3a')](handleEntityNotFound(_0x274a72,null))['then'](function(_0x360c3d){if(_0x360c3d){_0x188213[_0xe36c('0x58')]=_[_0xe36c('0x5a')](db[_0xe36c('0x113')]['rawAttributes']);_0x188213[_0xe36c('0x59')]=_['keys'](_0x56acac[_0xe36c('0x59')]);_0x188213[_0xe36c('0x5b')]=_[_0xe36c('0x5c')](_0x188213[_0xe36c('0x58')],_0x188213[_0xe36c('0x59')]);_0xd3ad16[_0xe36c('0x5d')]=_[_0xe36c('0x5c')](_0x188213[_0xe36c('0x58')],qs[_0xe36c('0x5e')](_0x56acac[_0xe36c('0x59')][_0xe36c('0x5e')]));_0xd3ad16['attributes']=_0xd3ad16[_0xe36c('0x5d')][_0xe36c('0x5f')]?_0xd3ad16['attributes']:_0x188213['model'];if(!_0x56acac[_0xe36c('0x59')][_0xe36c('0x117')](_0xe36c('0x60'))){_0xd3ad16['limit']=qs[_0xe36c('0x31')](_0x56acac[_0xe36c('0x59')]['limit']);_0xd3ad16[_0xe36c('0x2f')]=qs[_0xe36c('0x2f')](_0x56acac[_0xe36c('0x59')][_0xe36c('0x2f')]);}_0xd3ad16[_0xe36c('0x61')]=qs[_0xe36c('0x62')](_0x56acac['query'][_0xe36c('0x62')]);_0xd3ad16['where']=qs['filters'](_['pick'](_0x56acac[_0xe36c('0x59')],_0x188213['filters']));_0xd3ad16[_0xe36c('0x97')][_0xe36c('0xc5')]=_0x360c3d['id'];if(_0x56acac[_0xe36c('0x59')]['filter']){_0xd3ad16[_0xe36c('0x97')]=_[_0xe36c('0x3d')](_0xd3ad16[_0xe36c('0x97')],{'$or':_[_0xe36c('0x44')](_0xd3ad16['attributes'],function(_0x30ae31){var _0x2ab45c={};_0x2ab45c[_0x30ae31]={'$like':'%'+_0x56acac[_0xe36c('0x59')][_0xe36c('0x118')]+'%'};return _0x2ab45c;})});}_0xd3ad16[_0xe36c('0x97')][_0xe36c('0x11c')]=![];if(_0x56acac[_0xe36c('0x59')]['id']){_0xd3ad16['where']['id']={'$gt':_0x56acac[_0xe36c('0x59')]['id']};}_0xd3ad16=_[_0xe36c('0x3d')]({},_0xd3ad16,_0x56acac['options']);return db['ChatMessage'][_0xe36c('0x32')]({'where':_0xd3ad16[_0xe36c('0x97')]})[_0xe36c('0x3a')](function(_0x128266){_0x37b4b3['count']=_0x128266;_0xd3ad16[_0xe36c('0xcb')]=[];if(_0x56acac[_0xe36c('0x59')][_0xe36c('0x11d')]){_0xd3ad16['include'][_0xe36c('0x49')]({'model':db[_0xe36c('0x8a')],'as':'User','attributes':['id','fullname',_0xe36c('0xff')]});}if(_0x56acac['query'][_0xe36c('0xca')]){_0xd3ad16['include']=[{'all':!![]}];}return db[_0xe36c('0x113')][_0xe36c('0x11a')](_0xd3ad16);})['then'](function(_0x5c09a6){_0x37b4b3[_0xe36c('0xc7')]=_0x5c09a6;return _0x37b4b3;});}})[_0xe36c('0x3a')](respondWithFilteredResult(_0x274a72,_0xd3ad16))['catch'](handleError(_0x274a72,null));};exports[_0xe36c('0x11e')]=function(_0x1ec1c,_0x14b5bf,_0x5d0cdb){return db[_0xe36c('0xb2')][_0xe36c('0x7c')]({'where':{'id':_0x1ec1c[_0xe36c('0xc9')]['id']}})[_0xe36c('0x3a')](handleEntityNotFound(_0x14b5bf,null))[_0xe36c('0x3a')](function(_0x524c00){if(_0x524c00){return _0x524c00[_0xe36c('0x11f')](_0x1ec1c['body']['ids'],_[_0xe36c('0x120')](_0x1ec1c[_0xe36c('0x3e')],[_0xe36c('0x115'),'id'])||{})[_0xe36c('0x121')](function(){return db[_0xe36c('0x87')]['findAll']({'attributes':['id',_0xe36c('0x3b'),'color'],'where':{'id':_0x1ec1c[_0xe36c('0x3e')][_0xe36c('0x115')]}});})[_0xe36c('0x3a')](function(_0x1417b7){socket[_0xe36c('0x122')](_0xe36c('0x123'),{'id':Number(_0x1ec1c[_0xe36c('0xc9')]['id']),'tags':_0x1417b7||[]});return{'id':Number(_0x1ec1c['params']['id']),'tags':_0x1417b7||[]};});}})['then'](respondWithResult(_0x14b5bf,null))['catch'](handleError(_0x14b5bf,null));};exports['removeTags']=function(_0x38fd8e,_0x43abf4,_0x3669a2){return db[_0xe36c('0xb2')][_0xe36c('0x7c')]({'where':{'id':_0x38fd8e['params']['id']}})['then'](handleEntityNotFound(_0x43abf4,null))[_0xe36c('0x3a')](function(_0x4a654d){if(_0x4a654d){return _0x4a654d['removeTags'](_0x38fd8e[_0xe36c('0x59')]['ids']);}})['then'](respondWithStatusCode(_0x43abf4,null))[_0xe36c('0x4a')](handleError(_0x43abf4,null));};exports['download']=function(_0x3ae929,_0x4762e9){var _0x40c14f=moment()[_0xe36c('0x124')]()['toString']();var _0x3bae43=path[_0xe36c('0xf1')](config[_0xe36c('0xef')],'server',_0xe36c('0x125'),_0xe36c('0x126'));var _0x45a857=path[_0xe36c('0xf1')](config['root'],'server',_0xe36c('0x125'),_0xe36c('0x127'));var _0x1808c7=path['join'](_0x3bae43,_0x40c14f);var _0x411202=util[_0xe36c('0xf4')](_0xe36c('0x128'),_0x3ae929[_0xe36c('0xc9')]['id'],_0x40c14f);var _0x4e71f8=path[_0xe36c('0xf1')](_0x3bae43,_0x411202);var _0x155066=[];_0x155066[_0xe36c('0x49')]({'model':db[_0xe36c('0x8a')],'as':_0xe36c('0x8a'),'attributes':['id',_0xe36c('0x45')],'raw':!![]});_0x155066['push']({'model':db['CmContact'],'as':_0xe36c('0x80'),'attributes':['id','firstName',_0xe36c('0x129')],'raw':!![]});if(_0x3ae929[_0xe36c('0x59')]['attachments']){_0x155066[_0xe36c('0x49')]({'model':db[_0xe36c('0x12a')],'as':_0xe36c('0x12a'),'raw':!![]});}var _0x3e6cdd=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id','body',_0xe36c('0x93'),_0xe36c('0x102'),_0xe36c('0x11c'),_0xe36c('0x9c')],'include':_0x155066}];_0x3e6cdd[_0xe36c('0x49')]({'model':db[_0xe36c('0xd1')],'as':_0xe36c('0x12b'),'attributes':['id',_0xe36c('0x3b')]});_0x3e6cdd[_0xe36c('0x49')]({'model':db['User'],'as':_0xe36c('0x12c'),'attributes':['id','fullname']});return db[_0xe36c('0xb2')][_0xe36c('0x7c')]({'where':{'id':_0x3ae929['params']['id']},'include':_0x3e6cdd})['then'](handleEntityNotFound(_0x4762e9,null))['then'](function(_0x38d526){if(_0x38d526){var _0x3df0ac=_0x38d526[_0xe36c('0x12d')]({'plain':!![]});fs[_0xe36c('0x12e')](_0x1808c7);var _0x52b216={'channel':_0xe36c('0x12f'),'account':_0x3df0ac['Account'][_0xe36c('0x3b')],'agent':_0x3df0ac[_0xe36c('0x12c')]?_0x3df0ac[_0xe36c('0x12c')][_0xe36c('0x45')]:_0xe36c('0x130'),'createdAt':moment(_0x3df0ac[_0xe36c('0x93')])['format'](_0xe36c('0x119'))[_0xe36c('0xb0')](),'closedAt':_0x3df0ac['closed']?moment(_0x3df0ac[_0xe36c('0x131')])[_0xe36c('0xf4')](_0xe36c('0x119'))[_0xe36c('0xb0')]():'','disposition':_0x3df0ac['disposition'],'chatInfo':{'browser':_0x3df0ac[_0xe36c('0x132')],'os':_0x3df0ac[_0xe36c('0x133')],'referer':_0x3df0ac[_0xe36c('0x134')],'customerIp':_0x3df0ac['customerIp'],'customerPort':_0x3df0ac[_0xe36c('0x135')]?_0x3df0ac['customerPort']:'N.A.'},'messages':_(_0x3df0ac[_0xe36c('0xf8')])[_0xe36c('0x136')]()[_0xe36c('0x118')]({'secret':![]})['map'](function(_0x34d588){if(_0x34d588[_0xe36c('0x12a')]){var _0x24f3a6=path['join'](_0x45a857,_0x34d588[_0xe36c('0x12a')][_0xe36c('0xea')]);if(fs['existsSync'](_0x24f3a6)){fs[_0xe36c('0x137')](_0x24f3a6)[_0xe36c('0x138')](fs['createWriteStream'](path[_0xe36c('0xf1')](_0x1808c7,_0x34d588['Attachment']['basename'])));}}return{'date':moment(_0x34d588['createdAt'])[_0xe36c('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe36c('0xb0')](),'sender':_0x34d588[_0xe36c('0x102')]==='out'?_0x34d588[_0xe36c('0x8a')]?_0x34d588[_0xe36c('0x8a')][_0xe36c('0x45')]:_0xe36c('0xfd'):_0x34d588[_0xe36c('0x80')][_0xe36c('0x139')]+(_0x34d588[_0xe36c('0x80')][_0xe36c('0x129')]?'\x20'+_0x34d588[_0xe36c('0x80')][_0xe36c('0x129')]:''),'body':_0x34d588[_0xe36c('0x12a')]?_0x34d588[_0xe36c('0x12a')][_0xe36c('0xea')]:_0x34d588[_0xe36c('0x3e')],'direction':_0x34d588[_0xe36c('0x102')]===_0xe36c('0x13a')?'A':'C','secret':_0x34d588[_0xe36c('0x11c')],'read':_0x34d588['read'],'attachment':_0x34d588['Attachment']};})[_0xe36c('0x7d')]()};return ejs['renderFile'](path[_0xe36c('0xf1')](config[_0xe36c('0xef')],_0xe36c('0x13b'),_0xe36c('0x13c'),'downloadInteraction.ejs'),{'interaction':_0x52b216})[_0xe36c('0x3a')](function(_0x24dc9f){var _0x4792f3=path['join'](_0x1808c7,_0xe36c('0x13d')+_0x3df0ac['id']+'-'+_0x40c14f+_0xe36c('0x13e'));var _0x16c3da={'path':_0x4792f3,'channel':_0xe36c('0x12f'),'interactionId':_0x3df0ac['id']};return pdf['createPdfFromHTML'](_0x24dc9f,_0x16c3da);})['then'](function(){return new BPromise(function(_0x3df380,_0x368adf){zipdir(_0x1808c7,{'saveTo':_0x4e71f8},function(_0x543035,_0x3c5600){if(_0x543035)return _0x368adf(_0x543035);return _0x3df380(_0x3c5600);});})['then'](function(){return new BPromise(function(_0x58dc2b,_0x147b7e){rimraf(_0x1808c7,function(_0x132b35){if(_0x132b35)_0x147b7e(_0x132b35);return _0x58dc2b();});});})[_0xe36c('0x3a')](function(){return _0x4762e9[_0xe36c('0x13f')](_0x4e71f8,_0x411202,function(_0x253ccf){if(_0x253ccf){console[_0xe36c('0x140')](_0xe36c('0x141'),_0x253ccf);}else{fs[_0xe36c('0x142')](_0x4e71f8);}});});});}else{return _0x4762e9[_0xe36c('0x2b')](0xc8);}})['catch'](handleError(_0x4762e9,null));}; \ No newline at end of file +var _0x0d8c=['renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','end','sendStatus','stack','name','send','render','merge','body','agent','interaction','account','map','fullname','TagIds','split','forEach','Tags','push','waiting','talking','unmanaged','abandoned','closed','UserId','disposition','answered','index','ChatInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','select','field','from','tools_tags','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','cm_contacts','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','start','Tag','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','role','sequelize','toString','keyBy','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rows','show','params','includeAll','options','create','update','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','server/files/chat/upload/','transcript-%s.txt','Messages','User','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','format','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','getMessages','hasOwnProperty','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','include','findAll','includeAgent','setTags','ids','omit','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','Account','Owner','get','mkdirSync','Chat','N.A.','osName','referer','customerPort','existsSync','createReadStream','pipe','createWriteStream','out'];(function(_0x3ef984,_0x3f5981){var _0x578b03=function(_0x112d2f){while(--_0x112d2f){_0x3ef984['push'](_0x3ef984['shift']());}};_0x578b03(++_0x3f5981);}(_0x0d8c,0x14c));var _0xc0d8=function(_0x1d77d0,_0x41d470){_0x1d77d0=_0x1d77d0-0x0;var _0x513c2a=_0x0d8c[_0x1d77d0];return _0x513c2a;};'use strict';var emlformat=require(_0xc0d8('0x0'));var rimraf=require(_0xc0d8('0x1'));var zipdir=require(_0xc0d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc0d8('0x3'));var moment=require(_0xc0d8('0x4'));var BPromise=require(_0xc0d8('0x5'));var Mustache=require('mustache');var util=require(_0xc0d8('0x6'));var path=require('path');var sox=require(_0xc0d8('0x7'));var csv=require(_0xc0d8('0x8'));var ejs=require(_0xc0d8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc0d8('0xa'));var crypto=require('crypto');var jsforce=require(_0xc0d8('0xb'));var deskjs=require(_0xc0d8('0xc'));var toCsv=require(_0xc0d8('0x8'));var querystring=require('querystring');var Papa=require(_0xc0d8('0xd'));var Redis=require(_0xc0d8('0xe'));var authService=require(_0xc0d8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc0d8('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0d8('0x11'))(_0xc0d8('0x12'));var utils=require(_0xc0d8('0x13'));var config=require(_0xc0d8('0x14'));var licenseUtil=require(_0xc0d8('0x15'));var db=require('../../mysqldb')['db'];config[_0xc0d8('0x16')]=_[_0xc0d8('0x17')](config[_0xc0d8('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xc0d8('0x18'))(new Redis(config[_0xc0d8('0x16')]));require(_0xc0d8('0x19'))[_0xc0d8('0x1a')](socket);var jayson=require(_0xc0d8('0x1b'));var client=jayson['client'][_0xc0d8('0x1c')]({'port':0x232b});var client9004=jayson[_0xc0d8('0x1d')][_0xc0d8('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x7653f1,_0x26dd0d,_0x32f727,_0x24747b){return new BPromise(function(_0x23807e,_0x246972){var _0x44e2c7=_0x24747b||client;return _0x44e2c7[_0xc0d8('0x1e')](_0x7653f1,_0x32f727)[_0xc0d8('0x1f')](function(_0x55b5fd){logger[_0xc0d8('0x20')](_0xc0d8('0x21'),_0x26dd0d,_0xc0d8('0x22'));logger[_0xc0d8('0x23')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x26dd0d,_0xc0d8('0x22'),JSON['stringify'](_0x55b5fd));if(_0x55b5fd[_0xc0d8('0x24')]){if(_0x55b5fd[_0xc0d8('0x24')][_0xc0d8('0x25')]===0x1f4){logger[_0xc0d8('0x24')](_0xc0d8('0x21'),_0x26dd0d,_0x55b5fd[_0xc0d8('0x24')]['message']);return _0x246972(_0x55b5fd[_0xc0d8('0x24')][_0xc0d8('0x26')]);}logger['error'](_0xc0d8('0x21'),_0x26dd0d,_0x55b5fd[_0xc0d8('0x24')][_0xc0d8('0x26')]);return _0x23807e(_0x55b5fd[_0xc0d8('0x24')]['message']);}else{logger[_0xc0d8('0x20')](_0xc0d8('0x21'),_0x26dd0d,_0xc0d8('0x22'));_0x23807e(_0x55b5fd[_0xc0d8('0x27')][_0xc0d8('0x26')]);}})[_0xc0d8('0x28')](function(_0x42994a){logger[_0xc0d8('0x24')](_0xc0d8('0x21'),_0x26dd0d,_0x42994a);_0x246972(_0x42994a);});});}function respondWithStatusCode(_0x1e66b6,_0xd759b2){_0xd759b2=_0xd759b2||0xcc;return function(_0x410d08){if(_0x410d08){return _0x1e66b6['sendStatus'](_0xd759b2);}return _0x1e66b6[_0xc0d8('0x29')](_0xd759b2)['end']();};}function respondWithResult(_0xa50e52,_0x55afb7){_0x55afb7=_0x55afb7||0xc8;return function(_0x35adf8){if(_0x35adf8){return _0xa50e52[_0xc0d8('0x29')](_0x55afb7)[_0xc0d8('0x2a')](_0x35adf8);}};}function respondWithFilteredResult(_0x51cc16,_0x560ed5){return function(_0x2bbe4b){if(_0x2bbe4b){var _0x1ecbeb=typeof _0x560ed5['offset']===_0xc0d8('0x2b')&&typeof _0x560ed5[_0xc0d8('0x2c')]==='undefined';var _0x38fcc3=_0x2bbe4b[_0xc0d8('0x2d')];var _0x59f5b6=_0x1ecbeb?0x0:_0x560ed5[_0xc0d8('0x2e')];var _0x1125b4=_0x1ecbeb?_0x2bbe4b['count']:_0x560ed5['offset']+_0x560ed5['limit'];var _0x1885f8;if(_0x1125b4>=_0x38fcc3){_0x1125b4=_0x38fcc3;_0x1885f8=0xc8;}else{_0x1885f8=0xce;}_0x51cc16[_0xc0d8('0x29')](_0x1885f8);return _0x51cc16[_0xc0d8('0x2f')](_0xc0d8('0x30'),_0x59f5b6+'-'+_0x1125b4+'/'+_0x38fcc3)[_0xc0d8('0x2a')](_0x2bbe4b);}return null;};}function patchUpdates(_0x4c4114){return function(_0x6f8a99){try{jsonpatch[_0xc0d8('0x31')](_0x6f8a99,_0x4c4114,!![]);}catch(_0x214275){return BPromise[_0xc0d8('0x32')](_0x214275);}return _0x6f8a99[_0xc0d8('0x33')]();};}function saveUpdates(_0x5afadf,_0x4de64a){return function(_0x5acc03){if(_0x5acc03){return _0x5acc03['update'](_0x5afadf)[_0xc0d8('0x1f')](function(_0x850ee7){return _0x850ee7;});}return null;};}function removeEntity(_0x6b98e9,_0x559e6f){return function(_0x45e186){if(_0x45e186){return _0x45e186['destroy']()['then'](function(){_0x6b98e9[_0xc0d8('0x29')](0xcc)[_0xc0d8('0x34')]();});}};}function handleEntityNotFound(_0x335338,_0x5b80ec){return function(_0x1b51dc){if(!_0x1b51dc){_0x335338[_0xc0d8('0x35')](0x194);}return _0x1b51dc;};}function handleError(_0x283abc,_0xe0dd7c){_0xe0dd7c=_0xe0dd7c||0x1f4;return function(_0x54541b){logger[_0xc0d8('0x24')](_0x54541b[_0xc0d8('0x36')]);if(_0x54541b[_0xc0d8('0x37')]){delete _0x54541b[_0xc0d8('0x37')];}_0x283abc[_0xc0d8('0x29')](_0xe0dd7c)[_0xc0d8('0x38')](_0x54541b);};}function getMustacheRender(_0x4b2b57,_0x580637){return Mustache[_0xc0d8('0x39')](_0x4b2b57,_[_0xc0d8('0x3a')](_0x580637[_0xc0d8('0x3b')],{'contact':_0x580637['contact'],'message':_0x580637[_0xc0d8('0x26')],'agent':_0x580637[_0xc0d8('0x3c')],'interaction':_0x580637[_0xc0d8('0x3d')],'account':_0x580637[_0xc0d8('0x3e')]}))||'';}function getInteractionUsers(_0x266776,_0x53e5f3){return new BPromise(function(_0x300c49,_0x33159a){try{if(_0x53e5f3[_0x266776['id']]){_0x266776['Users']=_[_0xc0d8('0x3f')](_0x53e5f3[_0x266776['id']],function(_0x3de5bd){return{'id':_0x3de5bd['id'],'fullname':_0x3de5bd[_0xc0d8('0x40')]};});}}catch(_0x4dadf7){_0x33159a(_0x4dadf7);}_0x300c49(_0x266776);});}function getInteractionTags(_0x293b9b,_0x43f237){return new BPromise(function(_0x40990f,_0x4a8059){try{if(_0x293b9b['TagIds']){_0x293b9b['Tags']=[];_0x293b9b[_0xc0d8('0x41')][_0xc0d8('0x42')](',')[_0xc0d8('0x43')](function(_0x235474){_0x293b9b[_0xc0d8('0x44')][_0xc0d8('0x45')](_0x43f237[_0x235474]);});}delete _0x293b9b[_0xc0d8('0x41')];}catch(_0x4c928d){_0x4a8059(_0x4c928d);}_0x40990f(_0x293b9b);});}function updateChatInteraction(_0xf5ec3d,_0x59493f,_0x4324e5){return new BPromise(function(_0x113ddb,_0x1a7664){return getInteractionUsers(_0xf5ec3d,_0x4324e5)[_0xc0d8('0x1f')](function(_0x340f74){return getInteractionTags(_0x340f74,_0x59493f);})['then'](function(_0x190f41){return getStateInteraction(_0x190f41);})[_0xc0d8('0x1f')](function(_0x252182){_0x113ddb(_0x252182);})[_0xc0d8('0x28')](function(_0x533a80){_0x1a7664(_0x533a80);});});}function getStateInteraction(_0x536ca0){return new BPromise(function(_0x3c31e2){_0x536ca0[_0xc0d8('0x46')]=0x0;_0x536ca0[_0xc0d8('0x47')]=0x0;_0x536ca0['answered']=0x0;_0x536ca0[_0xc0d8('0x48')]=0x0;_0x536ca0[_0xc0d8('0x49')]=0x0;_0x536ca0['total']=0x0;if(!_0x536ca0[_0xc0d8('0x4a')]&&!_0x536ca0[_0xc0d8('0x4b')]){_0x536ca0[_0xc0d8('0x46')]+=0x1;}if(!_0x536ca0['closed']&&_0x536ca0[_0xc0d8('0x4b')]){_0x536ca0[_0xc0d8('0x47')]+=0x1;if(_0x536ca0[_0xc0d8('0x46')]){_0x536ca0[_0xc0d8('0x46')]-=0x1;}}if(_0x536ca0[_0xc0d8('0x4a')]&&_0x536ca0[_0xc0d8('0x4c')]===_0xc0d8('0x49')){_0x536ca0['abandoned']+=0x1;if(_0x536ca0[_0xc0d8('0x46')]){_0x536ca0[_0xc0d8('0x46')]-=0x1;}}else if(_0x536ca0[_0xc0d8('0x4a')]&&!_0x536ca0['UserId']&&_0x536ca0[_0xc0d8('0x4c')]){_0x536ca0[_0xc0d8('0x48')]+=0x1;if(_0x536ca0[_0xc0d8('0x46')]){_0x536ca0[_0xc0d8('0x46')]-=0x1;}}else if(_0x536ca0[_0xc0d8('0x4a')]&&_0x536ca0[_0xc0d8('0x4b')]){_0x536ca0[_0xc0d8('0x4d')]+=0x1;if(_0x536ca0[_0xc0d8('0x47')]){_0x536ca0[_0xc0d8('0x47')]-=0x1;}}_0x536ca0['total']+=0x1;_0x3c31e2(_0x536ca0);});}exports[_0xc0d8('0x4e')]=function(_0x72120a,_0x1856b7){var _0x368422={},_0x4e4ac2={},_0xa40b67={'count':0x0,'rows':[]};var _0xb3b161=_[_0xc0d8('0x3f')](db[_0xc0d8('0x4f')][_0xc0d8('0x50')],function(_0x416768){return{'name':_0x416768[_0xc0d8('0x51')],'type':_0x416768['type'][_0xc0d8('0x52')]};});_0x4e4ac2[_0xc0d8('0x53')]=_['map'](_0xb3b161,_0xc0d8('0x37'));_0x4e4ac2[_0xc0d8('0x54')]=_[_0xc0d8('0x55')](_0x72120a['query']);_0x4e4ac2[_0xc0d8('0x56')]=_[_0xc0d8('0x57')](_0x4e4ac2[_0xc0d8('0x53')],_0x4e4ac2[_0xc0d8('0x54')]);_0x368422['attributes']=_[_0xc0d8('0x57')](_0x4e4ac2[_0xc0d8('0x53')],qs[_0xc0d8('0x58')](_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x58')]));_0x368422[_0xc0d8('0x59')]=_0x368422[_0xc0d8('0x59')][_0xc0d8('0x5a')]?_0x368422[_0xc0d8('0x59')]:_0x4e4ac2[_0xc0d8('0x53')];if(!_0x72120a[_0xc0d8('0x54')]['hasOwnProperty'](_0xc0d8('0x5b'))){_0x368422[_0xc0d8('0x2c')]=qs[_0xc0d8('0x2c')](_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x2c')]);_0x368422['offset']=qs['offset'](_0x72120a['query'][_0xc0d8('0x2e')]);}_0x368422['order']=qs[_0xc0d8('0x5c')](_0x72120a[_0xc0d8('0x54')]['sort']);_0x368422[_0xc0d8('0x5d')]=qs['filters'](_['pick'](_0x72120a[_0xc0d8('0x54')],_0x4e4ac2[_0xc0d8('0x56')]),_0xb3b161);var _0x52ef49=[];var _0x23954e=squel[_0xc0d8('0x5e')]()[_0xc0d8('0x5f')]('id')['field'](_0xc0d8('0x37'))[_0xc0d8('0x5f')]('color')[_0xc0d8('0x60')](_0xc0d8('0x61'));var _0x2f3fc9=squel['select']()['field']('u.id')[_0xc0d8('0x5f')](_0xc0d8('0x62'))[_0xc0d8('0x5f')](_0xc0d8('0x63'))[_0xc0d8('0x60')](_0xc0d8('0x64'),'ui')[_0xc0d8('0x65')]('users','u','u.id\x20=\x20ui.UserId');var _0x2cd1f4=squel['select']()[_0xc0d8('0x60')]('chat_interactions','i')[_0xc0d8('0x65')](_0xc0d8('0x66'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc0d8('0x65')](_0xc0d8('0x67'),'o',_0xc0d8('0x68'))[_0xc0d8('0x65')](_0xc0d8('0x69'),'a',_0xc0d8('0x6a'))['left_join'](_0xc0d8('0x6b'),'me',_0xc0d8('0x6c'))[_0xc0d8('0x65')](_0xc0d8('0x6d'),'it','it.ChatInteractionId\x20=\x20i.id')[_0xc0d8('0x65')](_0xc0d8('0x61'),'t',_0xc0d8('0x6e'));var _0x5cd56d=squel['expr']();var _0x11a4dc=[];var _0x582b72=squel['expr']();var _0x1323c7;if(_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x6f')]){_0x1323c7=as[_0xc0d8('0x70')](_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x6f')]);var _0x36130f=_0x1323c7[_0xc0d8('0x71')];for(var _0x3d55f0=0x0;_0x3d55f0<_0x1323c7['conditions'][_0xc0d8('0x5a')];_0x3d55f0++){var _0x3d255a=_0x1323c7[_0xc0d8('0x72')][_0x3d55f0];var _0x186c59='i';var _0x3e05b5=_[_0xc0d8('0x73')](_0xb3b161,[_0xc0d8('0x37'),_0x3d255a[_0xc0d8('0x5f')]]);if(!_0x3e05b5){switch(_0x3d255a['field']){case _0xc0d8('0x74'):if(_0x3d255a['value']==0x1){_0x2cd1f4[_0xc0d8('0x75')]('`'+_0x3d255a['field']+'`\x20=\x200');}else{_0x2cd1f4[_0xc0d8('0x75')]('`'+_0x3d255a[_0xc0d8('0x5f')]+_0xc0d8('0x76'));}break;case _0xc0d8('0x77'):if(_0x3d255a[_0xc0d8('0x78')]===_0xc0d8('0x79')){if(_0x3d255a[_0xc0d8('0x7a')][_0xc0d8('0x42')]('\x20')[_0xc0d8('0x5a')]>0x1){_0x5cd56d[_0x36130f](_0xc0d8('0x7b'),qs[_0xc0d8('0x7c')](_0x3d255a[_0xc0d8('0x7a')]),null);}else{var _0x15dfa3='%'+_0x3d255a[_0xc0d8('0x7a')]+'%';_0x5cd56d[_0x36130f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x15dfa3,_0x15dfa3,_0x15dfa3);}}else{_0x3e05b5=_['find'](_0xb3b161,[_0xc0d8('0x37'),_0xc0d8('0x7d')]);_0x3d255a[_0xc0d8('0x5f')]=_0xc0d8('0x7d');_0x1366fc=as[_0xc0d8('0x7e')](_0x186c59,_0x3e05b5[_0xc0d8('0x7f')],_0x3d255a);_0x5cd56d[_0x36130f](_0x1366fc[_0xc0d8('0x80')],_0x1366fc[_0xc0d8('0x7a')][_0xc0d8('0x81')],_0x1366fc[_0xc0d8('0x7a')][_0xc0d8('0x34')]);}break;case _0xc0d8('0x82'):var _0x25b240=_0x3d255a[_0xc0d8('0x7a')][_0xc0d8('0x42')](',')[_0xc0d8('0x3f')](function(_0x4eb3a7){return Number(_0x4eb3a7);});_0x25b240[_0xc0d8('0x43')](function(_0x253870){_0x582b72['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x253870+',%');});_0x11a4dc=_['union'](_0x11a4dc,_0x25b240);break;case'User':if(_0x3d255a[_0xc0d8('0x78')]===_0xc0d8('0x79')){_0x5cd56d[_0x36130f](_0xc0d8('0x83'),'%'+_0x3d255a['value']+'%',null);}else{_0x3e05b5=_[_0xc0d8('0x73')](_0xb3b161,['name',_0xc0d8('0x4b')]);_0x3d255a[_0xc0d8('0x5f')]=_0xc0d8('0x4b');_0x1366fc=as[_0xc0d8('0x7e')](_0x186c59,_0x3e05b5[_0xc0d8('0x7f')],_0x3d255a);_0x5cd56d[_0x36130f](_0x1366fc['text'],_0x1366fc[_0xc0d8('0x7a')][_0xc0d8('0x81')],_0x1366fc['value'][_0xc0d8('0x34')]);}break;case _0xc0d8('0x3b'):_0x1366fc=as['buildExpression']('me',null,_0x3d255a);_0x5cd56d[_0x36130f](_0x1366fc['text'],_0x1366fc[_0xc0d8('0x7a')][_0xc0d8('0x81')],_0x1366fc[_0xc0d8('0x7a')]['end']);break;}}else{var _0x1366fc=as[_0xc0d8('0x7e')](_0x186c59,_0x3e05b5['type'],_0x3d255a);_0x5cd56d[_0x36130f](_0x1366fc[_0xc0d8('0x80')],_0x1366fc[_0xc0d8('0x7a')][_0xc0d8('0x81')],_0x1366fc['value']['end']);}}}else{var _0x29f242=_(_0x72120a[_0xc0d8('0x54')])[_0xc0d8('0x55')]()[_0xc0d8('0x3f')](function(_0x515559){return _[_0xc0d8('0x84')](_0xb3b161,[_0xc0d8('0x37'),_0x515559])?_0x515559:undefined;})[_0xc0d8('0x85')]()[_0xc0d8('0x7a')]();if(!_[_0xc0d8('0x86')](_0x29f242)){_0x29f242[_0xc0d8('0x43')](function(_0x166527){if(_0x166527==='ChatWebsiteId'){_0x2cd1f4['where']('i.ChatWebsiteId\x20IN\x20?',[][_0xc0d8('0x87')](_0x72120a[_0xc0d8('0x54')][_0x166527]));}else if(_0x166527==='createdAt'){var _0x183a96=JSON[_0xc0d8('0x88')](_0x72120a[_0xc0d8('0x54')][_0x166527])['$gte'];var _0x35ee66=JSON['parse'](_0x72120a[_0xc0d8('0x54')][_0x166527])[_0xc0d8('0x89')];_0x2cd1f4[_0xc0d8('0x5d')](_0xc0d8('0x8a'),_0x183a96,_0x35ee66);}else{if(_0x72120a[_0xc0d8('0x54')][_0x166527]===_0xc0d8('0x8b')){_0x2cd1f4[_0xc0d8('0x5d')]('i.'+_0x166527+_0xc0d8('0x8c'));}else{_0x2cd1f4['where']('i.'+_0x166527+_0xc0d8('0x8d'),_0x72120a[_0xc0d8('0x54')][_0x166527]);}}});}if(_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x8e')]){if(_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x8e')]==0x1){_0x2cd1f4[_0xc0d8('0x75')](_0xc0d8('0x8f'));}else{_0x2cd1f4['having']('`unreadMessages`\x20>\x200');}}if(_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x90')]){_0x11a4dc=_[_0xc0d8('0x91')](_0x72120a['query'][_0xc0d8('0x90')])?_0x72120a['query'][_0xc0d8('0x90')]:new Array(_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x90')]);_0x11a4dc['forEach'](function(_0x348db9){_0x582b72['or'](_0xc0d8('0x92'),'%,'+_0x348db9+',%');});}if(_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x93')]){var _0x351a46=_0x72120a[_0xc0d8('0x54')][_0xc0d8('0x93')]['replace']('\x5c','\x5c\x5c')[_0xc0d8('0x94')](/'/g,'\x27\x27');if(qs[_0xc0d8('0x95')](_0x351a46)){_0x5cd56d['or'](_0xc0d8('0x96'),_0x351a46+'%');}else{_0x5cd56d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc0d8('0x7c')](_0x351a46))['or'](_0xc0d8('0x97'),_0x351a46+'%');}}}_0x2cd1f4[_0xc0d8('0x5d')](_0x5cd56d);_0x2cd1f4['group'](_0xc0d8('0x98'));var _0x413ae0={'type':db[_0xc0d8('0x99')][_0xc0d8('0x9a')]['SELECT'],'raw':!![]};var _0xa10665=_0x2cd1f4[_0xc0d8('0x9b')]();_0xa10665['field'](_0xc0d8('0x98'));_0xa10665[_0xc0d8('0x5f')](_0xc0d8('0x9c'),'unreadMessages');if(_0x368422[_0xc0d8('0x9d')]){_0x368422[_0xc0d8('0x9d')][_0xc0d8('0x43')](function(_0x196d3b){var _0x28f673=_0x196d3b[0x0]==='contactName'?_0x196d3b[0x0]:'i.'+_0x196d3b[0x0];_0x2cd1f4[_0xc0d8('0x9d')](_0x28f673,_0x196d3b[0x1]===_0xc0d8('0x9e')?![]:!![]);});}if(!_['isEmpty'](_0x11a4dc)){_0x2cd1f4['having'](_0x582b72);_0xa10665[_0xc0d8('0x5d')](_0xc0d8('0x9f'),_0x11a4dc);}BPromise[_0xc0d8('0xa0')]()['then'](function(){if(!_0x1323c7){if(_0x72120a[_0xc0d8('0x54')][_0xc0d8('0xa1')])return;_0xa10665['where'](_0xc0d8('0xa2'));_0x2cd1f4[_0xc0d8('0x5d')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x72120a['user']['role']!==_0xc0d8('0x3c'))return;return _0x72120a[_0xc0d8('0xa3')][_0xc0d8('0xa4')]({'attributes':['id'],'raw':!![]})[_0xc0d8('0x1f')](function(_0x4db77a){if(_[_0xc0d8('0x86')](_0x4db77a)){_0xa10665['where'](_0xc0d8('0xa5'));_0x2cd1f4['where'](_0xc0d8('0xa5'));}else{_0xa10665[_0xc0d8('0x5d')](_0xc0d8('0xa6'),_[_0xc0d8('0x3f')](_0x4db77a,'id'));_0x2cd1f4[_0xc0d8('0x5d')]('i.ChatWebsiteId\x20IN\x20?',_[_0xc0d8('0x3f')](_0x4db77a,'id'));}});})[_0xc0d8('0x1f')](function(){if(_0x72120a[_0xc0d8('0xa3')][_0xc0d8('0xa7')]===_0xc0d8('0x3c')&&!_0x1323c7&&!_0x72120a[_0xc0d8('0x54')]['ChatWebsiteId'])return[];return db[_0xc0d8('0xa8')]['query'](_0xa10665[_0xc0d8('0xa9')](),_0x413ae0);})[_0xc0d8('0x1f')](function(_0x2a5974){_0xa40b67[_0xc0d8('0x2d')]=_0x2a5974[_0xc0d8('0x5a')];if(_0xa40b67[_0xc0d8('0x2d')]===0x0)return[];return db[_0xc0d8('0xa8')]['query'](_0x23954e[_0xc0d8('0xa9')](),_0x413ae0)[_0xc0d8('0x1f')](function(_0x174749){_0x52ef49=_[_0xc0d8('0xaa')](_0x174749,'id');_0x413ae0=_['merge'](_0x413ae0,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x72120a['query'][_0xc0d8('0x58')]){_0x368422['attributes']['forEach'](function(_0xff93f7){_0x2cd1f4[_0xc0d8('0x5f')]('i.'+_0xff93f7);});}else{_0x2cd1f4[_0xc0d8('0x5f')](_0xc0d8('0x9c'),_0xc0d8('0x74'));_0x2cd1f4[_0xc0d8('0x5f')]('a.key','Account.key');_0x2cd1f4[_0xc0d8('0x5f')](_0xc0d8('0xab'),_0xc0d8('0xac'));_0x2cd1f4[_0xc0d8('0x5f')](_0xc0d8('0xad'),_0xc0d8('0xae'));_0x2cd1f4[_0xc0d8('0x5f')](_0xc0d8('0xaf'));_0x2cd1f4[_0xc0d8('0x5f')]('c.firstName','Contact.firstName');_0x2cd1f4[_0xc0d8('0x5f')](_0xc0d8('0xb0'),_0xc0d8('0xb1'));_0x2cd1f4['field']('c.email',_0xc0d8('0xb2'));_0x2cd1f4[_0xc0d8('0x5f')]('c.phone','Contact.phone');_0x2cd1f4['field'](_0xc0d8('0xb3'),_0xc0d8('0xb4'));_0x2cd1f4[_0xc0d8('0x5f')](_0xc0d8('0xb5'),_0xc0d8('0xb6'));_0x2cd1f4[_0xc0d8('0x5f')](_0xc0d8('0xb7'),_0xc0d8('0xb8'));_0x2cd1f4['field'](_0xc0d8('0xb9'),_0xc0d8('0xba'));_0x2cd1f4[_0xc0d8('0x5f')](_0xc0d8('0xbb'),_0xc0d8('0x41'));}if(_0x368422['limit'])_0x2cd1f4[_0xc0d8('0x2c')](_0x368422[_0xc0d8('0x2c')]);if(_0x368422['offset'])_0x2cd1f4[_0xc0d8('0x2e')](_0x368422[_0xc0d8('0x2e')]);return db[_0xc0d8('0xa8')]['query'](_0x2cd1f4[_0xc0d8('0xa9')](),_0x413ae0);})[_0xc0d8('0x1f')](function(_0x1ceabf){if(_0x1ceabf[_0xc0d8('0x5a')]>0x0)_0x2f3fc9[_0xc0d8('0x5d')](_0xc0d8('0xbc'),_[_0xc0d8('0x3f')](_0x1ceabf,'id'));return db[_0xc0d8('0xa8')]['query'](_0x2f3fc9['toString'](),_0x413ae0)['then'](function(_0x1f4ade){var _0x1f730a=_[_0xc0d8('0xbd')](_0x1f4ade,_0xc0d8('0xbe'));var _0xc34450=[];_0x1ceabf['forEach'](function(_0x1cd6ac){_0xc34450[_0xc0d8('0x45')](updateChatInteraction(_0x1cd6ac,_0x52ef49,_0x1f730a));});return BPromise['all'](_0xc34450);});});})['then'](function(_0x4fd044){_0xa40b67[_0xc0d8('0xbf')]=_0x4fd044;return _0xa40b67;})[_0xc0d8('0x1f')](respondWithFilteredResult(_0x1856b7,_0x368422))[_0xc0d8('0x28')](handleError(_0x1856b7,null));};exports[_0xc0d8('0xc0')]=function(_0x668035,_0x7a8a9a){var _0x4976e4={'raw':![],'where':{'id':_0x668035[_0xc0d8('0xc1')]['id']}},_0x93f5ce={};_0x93f5ce[_0xc0d8('0x53')]=_[_0xc0d8('0x55')](db[_0xc0d8('0x4f')][_0xc0d8('0x50')]);_0x93f5ce['query']=_[_0xc0d8('0x55')](_0x668035[_0xc0d8('0x54')]);_0x93f5ce[_0xc0d8('0x56')]=_[_0xc0d8('0x57')](_0x93f5ce[_0xc0d8('0x53')],_0x93f5ce['query']);_0x4976e4['attributes']=_[_0xc0d8('0x57')](_0x93f5ce[_0xc0d8('0x53')],qs['fields'](_0x668035[_0xc0d8('0x54')][_0xc0d8('0x58')]));_0x4976e4['attributes']=_0x4976e4[_0xc0d8('0x59')][_0xc0d8('0x5a')]?_0x4976e4[_0xc0d8('0x59')]:_0x93f5ce[_0xc0d8('0x53')];if(_0x668035['query'][_0xc0d8('0xc2')]){_0x4976e4['include']=[{'all':!![]}];}_0x4976e4=_[_0xc0d8('0x3a')]({},_0x4976e4,_0x668035[_0xc0d8('0xc3')]);return db['ChatInteraction'][_0xc0d8('0x73')](_0x4976e4)[_0xc0d8('0x1f')](handleEntityNotFound(_0x7a8a9a,null))[_0xc0d8('0x1f')](respondWithResult(_0x7a8a9a,null))[_0xc0d8('0x28')](handleError(_0x7a8a9a,null));};exports['create']=function(_0x3f646d,_0x2aea4f){return db[_0xc0d8('0x4f')][_0xc0d8('0xc4')](_0x3f646d['body'],{})['then'](respondWithResult(_0x2aea4f,0xc9))[_0xc0d8('0x28')](handleError(_0x2aea4f,null));};exports[_0xc0d8('0xc5')]=function(_0x25f30d,_0x253a1b){if(_0x25f30d['body']['id']){delete _0x25f30d[_0xc0d8('0x3b')]['id'];}return db[_0xc0d8('0x4f')][_0xc0d8('0x73')]({'where':{'id':_0x25f30d[_0xc0d8('0xc1')]['id']}})['then'](handleEntityNotFound(_0x253a1b,null))[_0xc0d8('0x1f')](saveUpdates(_0x25f30d[_0xc0d8('0x3b')],null))[_0xc0d8('0x1f')](respondWithResult(_0x253a1b,null))[_0xc0d8('0x28')](handleError(_0x253a1b,null));};exports['destroy']=function(_0x535156,_0x137332){return db[_0xc0d8('0x4f')]['find']({'where':{'id':_0x535156[_0xc0d8('0xc1')]['id']}})[_0xc0d8('0x1f')](handleEntityNotFound(_0x137332,null))[_0xc0d8('0x1f')](removeEntity(_0x137332,null))['catch'](handleError(_0x137332,null));};exports[_0xc0d8('0xc6')]=function(_0x41ed4c,_0x56495f){return db[_0xc0d8('0x4f')][_0xc0d8('0xc6')]()[_0xc0d8('0x1f')](respondWithResult(_0x56495f,null))[_0xc0d8('0x28')](handleError(_0x56495f,null));};exports[_0xc0d8('0xc7')]=function(_0x343099,_0x214008){var _0x5618c1=_0x343099[_0xc0d8('0xc1')]['id'];var _0x1c2ef5;var _0x422351;var _0x1b0e1a;return db['ChatInteraction'][_0xc0d8('0xc8')]({'where':{'id':_0x5618c1}})[_0xc0d8('0x1f')](function(_0x41e72c){_0x1c2ef5=_0x41e72c;return db[_0xc0d8('0xc9')][_0xc0d8('0xc8')]({'where':{'id':_0x41e72c[_0xc0d8('0xa1')]},'attributes':['id',_0xc0d8('0xca'),_0xc0d8('0xcb'),_0xc0d8('0xcc'),_0xc0d8('0xcd'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x55e497){if(_0x55e497&&_0x55e497[_0xc0d8('0xca')]&&_0x55e497[_0xc0d8('0xcb')]){_0x422351=_0x55e497;var _0x32b693={'interaction':{'id':_0x5618c1},'agent':{'id':_0x343099[_0xc0d8('0xa3')]['id'],'name':_0x343099['user'][_0xc0d8('0x37')],'fullname':_0x343099[_0xc0d8('0xa3')][_0xc0d8('0x40')],'email':_0x343099[_0xc0d8('0xa3')][_0xc0d8('0xce')]},'contact':_0x343099[_0xc0d8('0x3b')][_0xc0d8('0xcf')],'account':_0x343099[_0xc0d8('0x3b')][_0xc0d8('0x3e')]};var _0xbddfe={'rejectUnauthorized':![],'method':_0xc0d8('0xd0'),'url':_0xc0d8('0xd1'),'headers':{'X-APIKEY':_0x55e497[_0xc0d8('0xca')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x343099[_0xc0d8('0xa3')]['email']],'buttons':null,'topic':_0x422351[_0xc0d8('0xcc')],'note':_[_0xc0d8('0xd2')](_0x422351[_0xc0d8('0xcd')])?null:getMustacheRender(_0x422351[_0xc0d8('0xcd')],_0x32b693),'metadata':null},'redirect':_0xc0d8('0xd3'),'json':!![]};try{if(!_[_0xc0d8('0xd2')](_0x422351[_0xc0d8('0xd4')])){var _0x176ea1=getMustacheRender(_0x422351['vidaooMetadata'],_0x32b693);var _0x915f19=JSON[_0xc0d8('0x88')](_0x176ea1);_0xbddfe[_0xc0d8('0x3b')][_0xc0d8('0xd5')]=_0x915f19;}}catch(_0x52338f){throw new db[(_0xc0d8('0x99'))][(_0xc0d8('0xd6'))](_0xc0d8('0xd7'));}return rp(_0xbddfe);}else{throw new db[(_0xc0d8('0x99'))][(_0xc0d8('0xd6'))](_0xc0d8('0xd8'));}})[_0xc0d8('0x1f')](function(_0x162aab){_0x1b0e1a=_0x162aab;if(_0x1b0e1a['id']){var _0x2cb1e8={'body':_0x1b0e1a[_0xc0d8('0xd9')],'ChatWebsiteId':_0x422351['id'],'ChatInteractionId':_0x1c2ef5['id'],'direction':'out','UserId':_0x343099[_0xc0d8('0xa3')]['id']};return db[_0xc0d8('0xda')][_0xc0d8('0xc4')](_0x2cb1e8,{});}else{throw new db['Sequelize'][(_0xc0d8('0xd6'))](_0xc0d8('0xdb'));}})[_0xc0d8('0x1f')](function(){return _0x1c2ef5[_0xc0d8('0xdc')]({'vidaooSessionId':_0x1b0e1a['id']});})[_0xc0d8('0x1f')](respondWithResult(_0x214008,null))[_0xc0d8('0x28')](handleError(_0x214008,null));};exports[_0xc0d8('0xdd')]=function(_0x63a229,_0x175cca){if(_0x63a229[_0xc0d8('0x3b')]['id']){delete _0x63a229[_0xc0d8('0x3b')]['id'];}return db[_0xc0d8('0x4f')][_0xc0d8('0x73')]({'where':{'id':_0x63a229[_0xc0d8('0xc1')]['id']},'include':[{'model':db[_0xc0d8('0xde')],'as':_0xc0d8('0x77')}]})['then'](handleEntityNotFound(_0x175cca,null))['then'](saveUpdates(_0x63a229[_0xc0d8('0x3b')],null))[_0xc0d8('0x1f')](respondWithResult(_0x175cca,null))[_0xc0d8('0x28')](handleError(_0x175cca,null));};exports[_0xc0d8('0xdf')]=function(_0x1881f4,_0x1398eb,_0x26c1ae){if(_0x1881f4[_0xc0d8('0x3b')]['id']){delete _0x1881f4[_0xc0d8('0x3b')]['id'];}return db[_0xc0d8('0x4f')][_0xc0d8('0x73')]({'where':{'id':_0x1881f4[_0xc0d8('0xc1')]['id']}})[_0xc0d8('0x1f')](function(_0x26459f){if(!_0x26459f){logger['error'](_0xc0d8('0xe0'),'abandon',0x194,_0xc0d8('0xe1'));_0x1398eb[_0xc0d8('0x35')](0x194);}else{if(_0x26459f['UserId']){throw new db['Sequelize'][(_0xc0d8('0xd6'))](_0xc0d8('0xe2'));}}return _0x26459f;})[_0xc0d8('0x1f')](function(_0x2e34a9){if(_0x2e34a9){return _0x2e34a9[_0xc0d8('0xc5')]({'closed':_0x1881f4[_0xc0d8('0x3b')][_0xc0d8('0x4a')],'disposition':_0x1881f4['body'][_0xc0d8('0x4c')]})['then'](function(_0x21c889){return _0x21c889;});}})[_0xc0d8('0x1f')](function(_0x7b3bae){return respondWithRpcPromise(_0xc0d8('0xe3'),_0xc0d8('0xdf'),_0x1881f4[_0xc0d8('0x3b')],client9004);})['then'](respondWithResult(_0x1398eb,null))[_0xc0d8('0x28')](handleError(_0x1398eb,null));};exports[_0xc0d8('0xe4')]=function(_0x2748ef,_0x50fa73,_0x52f5c8){_0x2748ef[_0xc0d8('0x3b')]['name']=_0x2748ef[_0xc0d8('0xe5')][_0xc0d8('0xe6')];_0x2748ef[_0xc0d8('0x3b')][_0xc0d8('0xe7')]=_0x2748ef[_0xc0d8('0xe5')][_0xc0d8('0xe8')];_0x2748ef[_0xc0d8('0x3b')]['type']=_0x2748ef['file']['mimetype'];return db['Attachment']['create'](_0x2748ef[_0xc0d8('0x3b')])[_0xc0d8('0x1f')](respondWithResult(_0x50fa73,0xc9))[_0xc0d8('0x28')](handleError(_0x50fa73,null));};exports[_0xc0d8('0xe9')]=function(_0x396bce,_0x24a15d,_0x351a2e){return db[_0xc0d8('0x4f')][_0xc0d8('0xc8')]({'where':{'id':_0x396bce['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x24a15d,null))[_0xc0d8('0x1f')](function(_0x2ebea7){if(_0x2ebea7){if(_0x2ebea7[_0xc0d8('0x4a')]){return _0x24a15d['status'](0x193)[_0xc0d8('0x2a')]({'status':0x193,'message':_0xc0d8('0xea')});}return db[_0xc0d8('0xeb')]['findOne']({'where':{'id':_0x396bce[_0xc0d8('0x54')][_0xc0d8('0xec')]},'raw':!![]})[_0xc0d8('0x1f')](handleEntityNotFound(_0x24a15d,null));}})['then'](function(_0x40dcef){if(_0x40dcef){var _0x42da29=_0x40dcef[_0xc0d8('0xed')]!==null;var _0x39b3e6=path[_0xc0d8('0xee')](config[_0xc0d8('0xef')],_0xc0d8('0xf0'));if(_0x42da29){_0x39b3e6=path[_0xc0d8('0xee')](_0x39b3e6,_0xc0d8('0xf1'));}var _0xa7497b=path[_0xc0d8('0xee')](_0x39b3e6,_0x40dcef[_0xc0d8('0xe7')]);return _0x24a15d[_0xc0d8('0xf2')](_0xa7497b);}})[_0xc0d8('0x28')](handleError(_0x24a15d,null));};exports[_0xc0d8('0xf3')]=function(_0x57181c,_0x276e7b){var _0x1509d2=null;var _0x5c4006=null;var _0x4de817=null;var _0x241868=null;if(_0x57181c['body']['id']){delete _0x57181c[_0xc0d8('0x3b')]['id'];}if(_0x57181c[_0xc0d8('0x3b')]['mailTranscript']){_0x241868=path[_0xc0d8('0xee')](config[_0xc0d8('0xef')],_0xc0d8('0xf4'),util['format'](_0xc0d8('0xf5'),Date['now']()));_0x57181c[_0xc0d8('0x3b')]['pathTranscript']=_0x241868;}return db[_0xc0d8('0x4f')]['find']({'where':{'id':_0x57181c[_0xc0d8('0xc1')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xc0d8('0xf6'),'include':[{'model':db['User'],'as':_0xc0d8('0xf7')}]}]})[_0xc0d8('0x1f')](handleEntityNotFound(_0x276e7b,null))[_0xc0d8('0x1f')](saveUpdates(_0x57181c[_0xc0d8('0x3b')],null))[_0xc0d8('0x1f')](function(_0x4bf2b3){if(_0x4bf2b3){_0x1509d2=_0x4bf2b3;return db['ChatWebsite'][_0xc0d8('0x73')]({'where':{'id':_0x1509d2['ChatWebsiteId']}});}})[_0xc0d8('0x1f')](function(_0x4c8b77){if(_0x4c8b77){_0x4de817=_0x4c8b77;return db[_0xc0d8('0xde')][_0xc0d8('0x73')]({'where':{'id':_0x1509d2['ContactId']}});}})[_0xc0d8('0x1f')](function(_0x3c17e3){if(_0x3c17e3){_0x5c4006=_0x3c17e3;if(_0x241868){var _0x518448=null;for(var _0x186e2a=0x1;_0x186e2a<_0x1509d2[_0xc0d8('0xf6')][_0xc0d8('0x5a')];++_0x186e2a){_0x518448=_0x1509d2[_0xc0d8('0xf6')][_0x186e2a];var _0x226b28=_0x518448[_0xc0d8('0x4b')]?util['format'](_0xc0d8('0xf8'),_0x4de817[_0xc0d8('0xf9')],_0x518448[_0xc0d8('0x4b')]):_0xc0d8('0xfa');var _0x247cab=_0x57181c[_0xc0d8('0x3b')][_0xc0d8('0xfb')]||util['format'](_0xc0d8('0xf8'),_0xc0d8('0xfc'),_0x518448[_0xc0d8('0x7d')]);switch(_0x4de817[_0xc0d8('0xfd')]){case _0xc0d8('0xfe'):_0x226b28=_0x518448[_0xc0d8('0x4b')]?util['format']('%s%d',_0x4de817[_0xc0d8('0xf9')],_0x518448['UserId']):_0xc0d8('0xfa');break;case _0xc0d8('0xff'):_0x226b28=_0x518448[_0xc0d8('0x4b')]?_0x518448[_0xc0d8('0xf7')][_0xc0d8('0x100')]||_0x518448[_0xc0d8('0xf7')]['fullname']:_0xc0d8('0xfa');break;case _0xc0d8('0x101'):_0x226b28=_0x518448[_0xc0d8('0x4b')]?_0x518448[_0xc0d8('0xf7')][_0xc0d8('0x40')]:_0xc0d8('0xfa');break;default:_0x226b28=_0x518448[_0xc0d8('0x4b')]?util[_0xc0d8('0x102')](_0xc0d8('0xf8'),_0x4de817[_0xc0d8('0xf9')],_0x518448[_0xc0d8('0x4b')]):_0xc0d8('0xfa');}var _0xddb44c=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x518448['createdAt'])[_0xc0d8('0x102')]('MM/DD/YYYY\x20HH:mm:ss'),_0x518448[_0xc0d8('0x103')]==='in'?_0x247cab:_0x226b28,_0x518448[_0xc0d8('0x3b')]);if(!_0x518448[_0xc0d8('0x104')]){fs['appendFileSync'](_0x241868,_0xddb44c);}}return db[_0xc0d8('0x105')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xc0d8('0x106')],'as':'Smtp','raw':!![]}]});}}})[_0xc0d8('0x1f')](function(_0x2f0a85){if(_0x2f0a85&&_0x2f0a85[_0xc0d8('0x107')]&&_0x57181c[_0xc0d8('0x3b')]){var _0x43ecd4={'tls':{'rejectUnauthorized':![]}};if(_0x2f0a85[_0xc0d8('0x107')][_0xc0d8('0x108')]){_0x43ecd4[_0xc0d8('0x108')]=_0x2f0a85[_0xc0d8('0x107')][_0xc0d8('0x108')];}else{_0x43ecd4[_0xc0d8('0x109')]=_0x2f0a85['Smtp'][_0xc0d8('0x109')];_0x43ecd4[_0xc0d8('0x10a')]=_0x2f0a85[_0xc0d8('0x107')][_0xc0d8('0x10a')];_0x43ecd4[_0xc0d8('0x10b')]=_0x2f0a85['Smtp'][_0xc0d8('0x10b')];}if(_0x2f0a85[_0xc0d8('0x107')][_0xc0d8('0x10c')]){_0x43ecd4[_0xc0d8('0x10d')]={'user':_0x2f0a85[_0xc0d8('0x107')]['user'],'pass':_0x2f0a85[_0xc0d8('0x107')][_0xc0d8('0x10e')]};}return respondWithRpcPromise(_0xc0d8('0x10f'),_0xc0d8('0x110'),{'account':_0x43ecd4,'message':{'from':util[_0xc0d8('0x102')](_0xc0d8('0x111'),_0x2f0a85['name'],_0x2f0a85['email']||_0x2f0a85['Smtp'][_0xc0d8('0xa3')]),'to':_0x57181c[_0xc0d8('0x3b')][_0xc0d8('0x112')],'subject':_0xc0d8('0x113'),'text':util[_0xc0d8('0x102')](_0xc0d8('0x114'),_0x57181c[_0xc0d8('0x3b')]['mailTranscript']),'attachments':[{'path':_0x241868}]}})['then'](function(){return _0x1509d2;})['catch'](function(_0x26cac9){console[_0xc0d8('0x24')](_0x26cac9);});}else{return _0x1509d2;}})[_0xc0d8('0x1f')](respondWithStatusCode(_0x276e7b,0xc8))[_0xc0d8('0x28')](handleError(_0x276e7b,null));};exports['addMessage']=function(_0x540e59,_0x49517e,_0x1c45aa){return db['ChatMessage'][_0xc0d8('0x73')]({'where':{'id':_0x540e59['params']['id']}})[_0xc0d8('0x1f')](handleEntityNotFound(_0x49517e,null))[_0xc0d8('0x1f')](function(_0x45b237){if(_0x45b237){return _0x45b237['addMessage'](_0x540e59[_0xc0d8('0x3b')]['ids'],_['omit'](_0x540e59[_0xc0d8('0x3b')],['ids','id'])||{});}})[_0xc0d8('0x1f')](respondWithResult(_0x49517e,null))[_0xc0d8('0x28')](handleError(_0x49517e,null));};exports[_0xc0d8('0x115')]=function(_0x4e5d0c,_0x4245c4,_0x33b060){var _0x553b1e={'raw':![],'where':{}};var _0x5d4f1a={};var _0x367837={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x4e5d0c[_0xc0d8('0xc1')]['id']}})[_0xc0d8('0x1f')](handleEntityNotFound(_0x4245c4,null))['then'](function(_0x3622bf){if(_0x3622bf){_0x5d4f1a['model']=_['keys'](db[_0xc0d8('0xda')][_0xc0d8('0x50')]);_0x5d4f1a[_0xc0d8('0x54')]=_[_0xc0d8('0x55')](_0x4e5d0c[_0xc0d8('0x54')]);_0x5d4f1a[_0xc0d8('0x56')]=_[_0xc0d8('0x57')](_0x5d4f1a[_0xc0d8('0x53')],_0x5d4f1a[_0xc0d8('0x54')]);_0x553b1e[_0xc0d8('0x59')]=_[_0xc0d8('0x57')](_0x5d4f1a[_0xc0d8('0x53')],qs['fields'](_0x4e5d0c['query'][_0xc0d8('0x58')]));_0x553b1e['attributes']=_0x553b1e[_0xc0d8('0x59')][_0xc0d8('0x5a')]?_0x553b1e[_0xc0d8('0x59')]:_0x5d4f1a[_0xc0d8('0x53')];if(!_0x4e5d0c[_0xc0d8('0x54')][_0xc0d8('0x116')](_0xc0d8('0x5b'))){_0x553b1e[_0xc0d8('0x2c')]=qs['limit'](_0x4e5d0c[_0xc0d8('0x54')]['limit']);_0x553b1e[_0xc0d8('0x2e')]=qs[_0xc0d8('0x2e')](_0x4e5d0c[_0xc0d8('0x54')][_0xc0d8('0x2e')]);}_0x553b1e[_0xc0d8('0x9d')]=qs[_0xc0d8('0x5c')](_0x4e5d0c['query'][_0xc0d8('0x5c')]);_0x553b1e[_0xc0d8('0x5d')]=qs['filters'](_[_0xc0d8('0x117')](_0x4e5d0c[_0xc0d8('0x54')],_0x5d4f1a[_0xc0d8('0x56')]));_0x553b1e[_0xc0d8('0x5d')]['ChatInteractionId']=_0x3622bf['id'];if(_0x4e5d0c[_0xc0d8('0x54')][_0xc0d8('0x93')]){_0x553b1e['where']=_[_0xc0d8('0x3a')](_0x553b1e['where'],{'$or':_[_0xc0d8('0x3f')](_0x553b1e[_0xc0d8('0x59')],function(_0x40f5a3){var _0x3f6bb6={};_0x3f6bb6[_0x40f5a3]={'$like':'%'+_0x4e5d0c[_0xc0d8('0x54')][_0xc0d8('0x93')]+'%'};return _0x3f6bb6;})});}if(_0x4e5d0c[_0xc0d8('0x54')][_0xc0d8('0x118')]){var _0x42ee35=_0x4e5d0c[_0xc0d8('0x54')][_0xc0d8('0x118')][_0xc0d8('0x42')](',');var _0xac56fc={};_0xac56fc[_0x42ee35[0x0]]={'$gte':moment(_0x42ee35[0x1])[_0xc0d8('0x102')](_0xc0d8('0x119'))};_0x553b1e[_0xc0d8('0x5d')]=_['merge'](_0x553b1e[_0xc0d8('0x5d')],_0xac56fc);}_0x553b1e=_[_0xc0d8('0x3a')]({},_0x553b1e,_0x4e5d0c[_0xc0d8('0xc3')]);return db[_0xc0d8('0xda')]['count']({'where':_0x553b1e[_0xc0d8('0x5d')]})[_0xc0d8('0x1f')](function(_0x27baaa){_0x367837[_0xc0d8('0x2d')]=_0x27baaa;if(_0x4e5d0c[_0xc0d8('0x54')][_0xc0d8('0xc2')]){_0x553b1e[_0xc0d8('0x11a')]=[{'all':!![]}];}return db[_0xc0d8('0xda')][_0xc0d8('0x11b')](_0x553b1e);})[_0xc0d8('0x1f')](function(_0x3ece25){_0x367837[_0xc0d8('0xbf')]=_0x3ece25;return _0x367837;});}})['then'](respondWithFilteredResult(_0x4245c4,_0x553b1e))[_0xc0d8('0x28')](handleError(_0x4245c4,null));};exports['getMyMessages']=function(_0x1886ca,_0x472f40,_0x15faec){var _0x12e4d4={'where':{}},_0x2dece0={},_0x5e838d={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xc0d8('0xc8')]({'where':{'id':_0x1886ca[_0xc0d8('0xc1')]['id']}})[_0xc0d8('0x1f')](handleEntityNotFound(_0x472f40,null))[_0xc0d8('0x1f')](function(_0x3dc497){if(_0x3dc497){_0x2dece0[_0xc0d8('0x53')]=_[_0xc0d8('0x55')](db['ChatMessage'][_0xc0d8('0x50')]);_0x2dece0['query']=_[_0xc0d8('0x55')](_0x1886ca[_0xc0d8('0x54')]);_0x2dece0['filters']=_[_0xc0d8('0x57')](_0x2dece0[_0xc0d8('0x53')],_0x2dece0[_0xc0d8('0x54')]);_0x12e4d4[_0xc0d8('0x59')]=_['intersection'](_0x2dece0[_0xc0d8('0x53')],qs[_0xc0d8('0x58')](_0x1886ca[_0xc0d8('0x54')]['fields']));_0x12e4d4['attributes']=_0x12e4d4[_0xc0d8('0x59')]['length']?_0x12e4d4[_0xc0d8('0x59')]:_0x2dece0[_0xc0d8('0x53')];if(!_0x1886ca[_0xc0d8('0x54')][_0xc0d8('0x116')](_0xc0d8('0x5b'))){_0x12e4d4[_0xc0d8('0x2c')]=qs[_0xc0d8('0x2c')](_0x1886ca[_0xc0d8('0x54')][_0xc0d8('0x2c')]);_0x12e4d4[_0xc0d8('0x2e')]=qs['offset'](_0x1886ca['query'][_0xc0d8('0x2e')]);}_0x12e4d4[_0xc0d8('0x9d')]=qs[_0xc0d8('0x5c')](_0x1886ca[_0xc0d8('0x54')][_0xc0d8('0x5c')]);_0x12e4d4[_0xc0d8('0x5d')]=qs[_0xc0d8('0x56')](_[_0xc0d8('0x117')](_0x1886ca['query'],_0x2dece0[_0xc0d8('0x56')]));_0x12e4d4[_0xc0d8('0x5d')][_0xc0d8('0xbe')]=_0x3dc497['id'];if(_0x1886ca[_0xc0d8('0x54')][_0xc0d8('0x93')]){_0x12e4d4['where']=_[_0xc0d8('0x3a')](_0x12e4d4[_0xc0d8('0x5d')],{'$or':_[_0xc0d8('0x3f')](_0x12e4d4['attributes'],function(_0x286e4c){var _0x6b65f2={};_0x6b65f2[_0x286e4c]={'$like':'%'+_0x1886ca[_0xc0d8('0x54')]['filter']+'%'};return _0x6b65f2;})});}_0x12e4d4[_0xc0d8('0x5d')][_0xc0d8('0x104')]=![];if(_0x1886ca['query']['id']){_0x12e4d4[_0xc0d8('0x5d')]['id']={'$gt':_0x1886ca[_0xc0d8('0x54')]['id']};}_0x12e4d4=_[_0xc0d8('0x3a')]({},_0x12e4d4,_0x1886ca[_0xc0d8('0xc3')]);return db[_0xc0d8('0xda')][_0xc0d8('0x2d')]({'where':_0x12e4d4['where']})['then'](function(_0x2d5a3e){_0x5e838d[_0xc0d8('0x2d')]=_0x2d5a3e;_0x12e4d4[_0xc0d8('0x11a')]=[];if(_0x1886ca[_0xc0d8('0x54')][_0xc0d8('0x11c')]){_0x12e4d4[_0xc0d8('0x11a')][_0xc0d8('0x45')]({'model':db['User'],'as':_0xc0d8('0xf7'),'attributes':['id',_0xc0d8('0x40'),'alias']});}if(_0x1886ca[_0xc0d8('0x54')]['includeAll']){_0x12e4d4['include']=[{'all':!![]}];}return db[_0xc0d8('0xda')][_0xc0d8('0x11b')](_0x12e4d4);})['then'](function(_0x1b02ad){_0x5e838d[_0xc0d8('0xbf')]=_0x1b02ad;return _0x5e838d;});}})[_0xc0d8('0x1f')](respondWithFilteredResult(_0x472f40,_0x12e4d4))[_0xc0d8('0x28')](handleError(_0x472f40,null));};exports['addTags']=function(_0x2f9d92,_0x268f3a,_0x3bb514){return db[_0xc0d8('0x4f')][_0xc0d8('0x73')]({'where':{'id':_0x2f9d92[_0xc0d8('0xc1')]['id']}})['then'](handleEntityNotFound(_0x268f3a,null))['then'](function(_0x263658){if(_0x263658){return _0x263658[_0xc0d8('0x11d')](_0x2f9d92[_0xc0d8('0x3b')][_0xc0d8('0x11e')],_[_0xc0d8('0x11f')](_0x2f9d92[_0xc0d8('0x3b')],[_0xc0d8('0x11e'),'id'])||{})[_0xc0d8('0x120')](function(){return db[_0xc0d8('0x82')][_0xc0d8('0x11b')]({'attributes':['id','name',_0xc0d8('0x121')],'where':{'id':_0x2f9d92[_0xc0d8('0x3b')][_0xc0d8('0x11e')]}});})[_0xc0d8('0x1f')](function(_0x12f12b){socket[_0xc0d8('0x122')](_0xc0d8('0x123'),{'id':Number(_0x2f9d92[_0xc0d8('0xc1')]['id']),'tags':_0x12f12b||[]});return{'id':Number(_0x2f9d92['params']['id']),'tags':_0x12f12b||[]};});}})[_0xc0d8('0x1f')](respondWithResult(_0x268f3a,null))[_0xc0d8('0x28')](handleError(_0x268f3a,null));};exports['removeTags']=function(_0x3527e4,_0x18f5b5,_0x18bfa3){return db[_0xc0d8('0x4f')][_0xc0d8('0x73')]({'where':{'id':_0x3527e4[_0xc0d8('0xc1')]['id']}})[_0xc0d8('0x1f')](handleEntityNotFound(_0x18f5b5,null))['then'](function(_0xe5c920){if(_0xe5c920){return _0xe5c920[_0xc0d8('0x124')](_0x3527e4[_0xc0d8('0x54')][_0xc0d8('0x11e')]);}})['then'](respondWithStatusCode(_0x18f5b5,null))[_0xc0d8('0x28')](handleError(_0x18f5b5,null));};exports[_0xc0d8('0xf2')]=function(_0x4e7b62,_0x2b96c9){var _0x11fc31=moment()[_0xc0d8('0x125')]()[_0xc0d8('0xa9')]();var _0x102afe=path[_0xc0d8('0xee')](config[_0xc0d8('0xef')],_0xc0d8('0x126'),_0xc0d8('0x127'),_0xc0d8('0x128'));var _0x33d4fb=path[_0xc0d8('0xee')](config[_0xc0d8('0xef')],_0xc0d8('0x126'),_0xc0d8('0x127'),_0xc0d8('0x129'));var _0x4bedd9=path[_0xc0d8('0xee')](_0x102afe,_0x11fc31);var _0x5a0774=util['format'](_0xc0d8('0x12a'),_0x4e7b62[_0xc0d8('0xc1')]['id'],_0x11fc31);var _0x47c6c6=path[_0xc0d8('0xee')](_0x102afe,_0x5a0774);var _0xdd8b70=[];_0xdd8b70[_0xc0d8('0x45')]({'model':db[_0xc0d8('0xf7')],'as':_0xc0d8('0xf7'),'attributes':['id','fullname'],'raw':!![]});_0xdd8b70[_0xc0d8('0x45')]({'model':db['CmContact'],'as':_0xc0d8('0x77'),'attributes':['id',_0xc0d8('0x12b'),_0xc0d8('0x12c')],'raw':!![]});if(_0x4e7b62[_0xc0d8('0x54')]['attachments']){_0xdd8b70['push']({'model':db[_0xc0d8('0xeb')],'as':_0xc0d8('0xeb'),'raw':!![]});}var _0x37861f=[{'model':db[_0xc0d8('0xda')],'as':'Messages','attributes':['id',_0xc0d8('0x3b'),_0xc0d8('0x12d'),_0xc0d8('0x103'),_0xc0d8('0x104'),_0xc0d8('0x8e')],'include':_0xdd8b70}];_0x37861f[_0xc0d8('0x45')]({'model':db[_0xc0d8('0xc9')],'as':_0xc0d8('0x12e'),'attributes':['id',_0xc0d8('0x37')]});_0x37861f[_0xc0d8('0x45')]({'model':db[_0xc0d8('0xf7')],'as':_0xc0d8('0x12f'),'attributes':['id',_0xc0d8('0x40')]});return db[_0xc0d8('0x4f')]['find']({'where':{'id':_0x4e7b62[_0xc0d8('0xc1')]['id']},'include':_0x37861f})[_0xc0d8('0x1f')](handleEntityNotFound(_0x2b96c9,null))[_0xc0d8('0x1f')](function(_0x3e2874){if(_0x3e2874){var _0x2d32d3=_0x3e2874[_0xc0d8('0x130')]({'plain':!![]});fs[_0xc0d8('0x131')](_0x4bedd9);var _0x433eab={'channel':_0xc0d8('0x132'),'account':_0x2d32d3[_0xc0d8('0x12e')][_0xc0d8('0x37')],'agent':_0x2d32d3[_0xc0d8('0x12f')]?_0x2d32d3[_0xc0d8('0x12f')][_0xc0d8('0x40')]:_0xc0d8('0x133'),'createdAt':moment(_0x2d32d3[_0xc0d8('0x12d')])[_0xc0d8('0x102')](_0xc0d8('0x119'))[_0xc0d8('0xa9')](),'closedAt':_0x2d32d3[_0xc0d8('0x4a')]?moment(_0x2d32d3['closedAt'])[_0xc0d8('0x102')](_0xc0d8('0x119'))[_0xc0d8('0xa9')]():'','disposition':_0x2d32d3[_0xc0d8('0x4c')],'chatInfo':{'browser':_0x2d32d3['browserName'],'os':_0x2d32d3[_0xc0d8('0x134')],'referer':_0x2d32d3[_0xc0d8('0x135')],'customerIp':_0x2d32d3['customerIp'],'customerPort':_0x2d32d3[_0xc0d8('0x136')]?_0x2d32d3['customerPort']:_0xc0d8('0x133')},'messages':_(_0x2d32d3[_0xc0d8('0xf6')])['tail']()['filter']({'secret':![]})[_0xc0d8('0x3f')](function(_0x266c9e){if(_0x266c9e[_0xc0d8('0xeb')]){var _0x1d16c8=path[_0xc0d8('0xee')](_0x33d4fb,_0x266c9e['Attachment']['basename']);if(fs[_0xc0d8('0x137')](_0x1d16c8)){fs[_0xc0d8('0x138')](_0x1d16c8)[_0xc0d8('0x139')](fs[_0xc0d8('0x13a')](path[_0xc0d8('0xee')](_0x4bedd9,_0x266c9e[_0xc0d8('0xeb')][_0xc0d8('0xe7')])));}}return{'date':moment(_0x266c9e['createdAt'])[_0xc0d8('0x102')](_0xc0d8('0x119'))[_0xc0d8('0xa9')](),'sender':_0x266c9e[_0xc0d8('0x103')]==='out'?_0x266c9e[_0xc0d8('0xf7')]?_0x266c9e['User'][_0xc0d8('0x40')]:_0xc0d8('0xfa'):_0x266c9e[_0xc0d8('0x77')][_0xc0d8('0x12b')]+(_0x266c9e[_0xc0d8('0x77')][_0xc0d8('0x12c')]?'\x20'+_0x266c9e['Contact'][_0xc0d8('0x12c')]:''),'body':_0x266c9e[_0xc0d8('0xeb')]?_0x266c9e[_0xc0d8('0xeb')][_0xc0d8('0xe7')]:_0x266c9e[_0xc0d8('0x3b')],'direction':_0x266c9e[_0xc0d8('0x103')]===_0xc0d8('0x13b')?'A':'C','secret':_0x266c9e[_0xc0d8('0x104')],'read':_0x266c9e[_0xc0d8('0x8e')],'attachment':_0x266c9e[_0xc0d8('0xeb')]};})[_0xc0d8('0x7a')]()};return ejs[_0xc0d8('0x13c')](path[_0xc0d8('0xee')](config[_0xc0d8('0xef')],_0xc0d8('0x126'),_0xc0d8('0x13d'),_0xc0d8('0x13e')),{'interaction':_0x433eab})['then'](function(_0x91724d){var _0x5ee8d1=path[_0xc0d8('0xee')](_0x4bedd9,_0xc0d8('0x13f')+_0x2d32d3['id']+'-'+_0x11fc31+_0xc0d8('0x140'));var _0x3e422a={'path':_0x5ee8d1,'channel':_0xc0d8('0x132'),'interactionId':_0x2d32d3['id']};return pdf[_0xc0d8('0x141')](_0x91724d,_0x3e422a);})[_0xc0d8('0x1f')](function(){return new BPromise(function(_0x1ab2e0,_0x2338a5){zipdir(_0x4bedd9,{'saveTo':_0x47c6c6},function(_0x2ada8d,_0xd71387){if(_0x2ada8d)return _0x2338a5(_0x2ada8d);return _0x1ab2e0(_0xd71387);});})['then'](function(){return new BPromise(function(_0xc78f60,_0x4707b1){rimraf(_0x4bedd9,function(_0x342d42){if(_0x342d42)_0x4707b1(_0x342d42);return _0xc78f60();});});})[_0xc0d8('0x1f')](function(){return _0x2b96c9[_0xc0d8('0xf2')](_0x47c6c6,_0x5a0774,function(_0x5a73c9){if(_0x5a73c9){console[_0xc0d8('0x142')](_0xc0d8('0x143'),_0x5a73c9);}else{fs['unlinkSync'](_0x47c6c6);}});});});}else{return _0x2b96c9[_0xc0d8('0x35')](0xc8);}})['catch'](handleError(_0x2b96c9,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 64966c8..07fbd2a 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 _0x47bc=['catch','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','emit'];(function(_0x349c0a,_0x35383b){var _0x5b29e1=function(_0x383741){while(--_0x383741){_0x349c0a['push'](_0x349c0a['shift']());}};_0x5b29e1(++_0x35383b);}(_0x47bc,0xe0));var _0xc47b=function(_0x53b56e,_0x1b1228){_0x53b56e=_0x53b56e-0x0;var _0x12b5f8=_0x47bc[_0x53b56e];return _0x12b5f8;};'use strict';var EventEmitter=require(_0xc47b('0x0'));var ChatInteraction=require(_0xc47b('0x1'))['db'][_0xc47b('0x2')];var ChatMessage=require(_0xc47b('0x1'))['db'][_0xc47b('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc47b('0x4')](0x0);var events={'afterCreate':_0xc47b('0x5'),'afterUpdate':_0xc47b('0x6'),'afterDestroy':_0xc47b('0x7')};function emitEvent(_0x176208){return function(_0x6f054e,_0x5b6135,_0x3889e9){_0x6f054e[_0xc47b('0x8')]({'attributes':['id'],'raw':!![]})[_0xc47b('0x9')](function(_0x2d6c39){_0x6f054e[_0xc47b('0xa')](_0xc47b('0xb'),_0x2d6c39['map'](function(_0x2b4bba){return{'id':_0x2b4bba['id']};}));return ChatMessage[_0xc47b('0xc')]({'where':{'ChatInteractionId':_0x6f054e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc47b('0x9')](function(_0x2884c1){_0x6f054e[_0xc47b('0xa')]('unreadMessages',_0x2884c1['length']);ChatInteractionEvents[_0xc47b('0xd')](_0x176208+':'+_0x6f054e['id'],_0x6f054e);ChatInteractionEvents['emit'](_0x176208,_0x6f054e);_0x3889e9(null);})[_0xc47b('0xe')](_0x3889e9(null));};}for(var e in events){if(events[_0xc47b('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xc47b('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xbd3b=['events','../../mysqldb','save','remove','then','setDataValue','Users','findAll','unreadMessages','emit','hasOwnProperty','hook'];(function(_0x24b5dc,_0x2c2e55){var _0x461db2=function(_0x1f2041){while(--_0x1f2041){_0x24b5dc['push'](_0x24b5dc['shift']());}};_0x461db2(++_0x2c2e55);}(_0xbd3b,0x1d4));var _0xbbd3=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0xbd3b[_0x4bd950];return _0x5dc59a;};'use strict';var EventEmitter=require(_0xbbd3('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0xbbd3('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbbd3('0x2'),'afterUpdate':'update','afterDestroy':_0xbbd3('0x3')};function emitEvent(_0x53c4ae){return function(_0x1ceacf,_0x236085,_0xa17659){_0x1ceacf['getUsers']({'attributes':['id'],'raw':!![]})[_0xbbd3('0x4')](function(_0x1cf67e){_0x1ceacf[_0xbbd3('0x5')](_0xbbd3('0x6'),_0x1cf67e['map'](function(_0x7f1b45){return{'id':_0x7f1b45['id']};}));return ChatMessage[_0xbbd3('0x7')]({'where':{'ChatInteractionId':_0x1ceacf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbbd3('0x4')](function(_0x5f4199){_0x1ceacf['setDataValue'](_0xbbd3('0x8'),_0x5f4199['length']);ChatInteractionEvents[_0xbbd3('0x9')](_0x53c4ae+':'+_0x1ceacf['id'],_0x1ceacf);ChatInteractionEvents[_0xbbd3('0x9')](_0x53c4ae,_0x1ceacf);_0xa17659(null);})['catch'](_0xa17659(null));};}for(var e in events){if(events[_0xbbd3('0xa')](e)){var event=events[e];ChatInteraction[_0xbbd3('0xb')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 366c8a2..c893d9a 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 _0xa91e=['define','ChatInteraction','chat_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x21ed6d,_0x26fa0a){var _0x2e82b7=function(_0x16d54a){while(--_0x16d54a){_0x21ed6d['push'](_0x21ed6d['shift']());}};_0x2e82b7(++_0x26fa0a);}(_0xa91e,0x66));var _0xea91=function(_0x591ca7,_0x848827){_0x591ca7=_0x591ca7-0x0;var _0x56cf4d=_0xa91e[_0x591ca7];return _0x56cf4d;};'use strict';var _=require(_0xea91('0x0'));var util=require(_0xea91('0x1'));var logger=require(_0xea91('0x2'))(_0xea91('0x3'));var moment=require(_0xea91('0x4'));var BPromise=require(_0xea91('0x5'));var rp=require(_0xea91('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea91('0x7'));var config=require(_0xea91('0x8'));var attributes=require('./chatInteraction.attributes');module[_0xea91('0x9')]=function(_0x41acfe,_0x41942c){return _0x41acfe[_0xea91('0xa')](_0xea91('0xb'),attributes,{'tableName':_0xea91('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b278a,_0xf481c9,_0x1a8d79){if(_0x5b278a['changed'](_0xea91('0xd'))){_0x5b278a['closedAt']=moment()[_0xea91('0xe')](_0xea91('0xf'));}_0x1a8d79(null,_0x5b278a);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3933=['../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x2703f9,_0x39425b){var _0x3910b1=function(_0x4a9c21){while(--_0x4a9c21){_0x2703f9['push'](_0x2703f9['shift']());}};_0x3910b1(++_0x39425b);}(_0x3933,0x14e));var _0x3393=function(_0x5d23c0,_0x31b911){_0x5d23c0=_0x5d23c0-0x0;var _0x68af05=_0x3933[_0x5d23c0];return _0x68af05;};'use strict';var _=require(_0x3393('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3393('0x1'));var BPromise=require(_0x3393('0x2'));var rp=require(_0x3393('0x3'));var fs=require('fs');var path=require(_0x3393('0x4'));var rimraf=require(_0x3393('0x5'));var config=require(_0x3393('0x6'));var attributes=require(_0x3393('0x7'));module[_0x3393('0x8')]=function(_0x306fb0,_0x1ac255){return _0x306fb0['define'](_0x3393('0x9'),attributes,{'tableName':_0x3393('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47220d,_0x4c7a42,_0x4c835f){if(_0x47220d[_0x3393('0xb')](_0x3393('0xc'))){_0x47220d[_0x3393('0xd')]=moment()[_0x3393('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4c835f(null,_0x47220d);}},'charset':_0x3393('0xf'),'collate':_0x3393('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 1b36080..93830fd 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 _0x917f=['spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ChatInteraction','update','body','options','raw','limit','then','UpdateChatInteraction','stringify','AddTagsToChatInteraction','find','where','addTags','omit','ids'];(function(_0x2f2a40,_0x57007d){var _0x1195aa=function(_0x2f786f){while(--_0x2f786f){_0x2f2a40['push'](_0x2f2a40['shift']());}};_0x1195aa(++_0x57007d);}(_0x917f,0x1c5));var _0xf917=function(_0x1c604f,_0x11bfe2){_0x1c604f=_0x1c604f-0x0;var _0x364242=_0x917f[_0x1c604f];return _0x364242;};'use strict';var _=require(_0xf917('0x0'));var util=require(_0xf917('0x1'));var moment=require(_0xf917('0x2'));var BPromise=require(_0xf917('0x3'));var rs=require(_0xf917('0x4'));var fs=require('fs');var Redis=require(_0xf917('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf917('0x6'))(_0xf917('0x7'));var config=require('../../config/environment');var jayson=require(_0xf917('0x8'));var client=jayson[_0xf917('0x9')][_0xf917('0xa')]({'port':0x232a});config[_0xf917('0xb')]=_['defaults'](config['redis'],{'host':_0xf917('0xc'),'port':0x18eb});var socket=require(_0xf917('0xd'))(new Redis(config[_0xf917('0xb')]));require('./chatInteraction.socket')[_0xf917('0xe')](socket);function respondWithRpcPromise(_0x570803,_0x5f4f2d,_0x469999){return new BPromise(function(_0x3b3894,_0x5b47bd){return client['request'](_0x570803,_0x469999)['then'](function(_0x2bce4b){logger[_0xf917('0xf')](_0xf917('0x10'),_0x5f4f2d,_0xf917('0x11'));logger[_0xf917('0x12')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x5f4f2d,_0xf917('0x11'),JSON['stringify'](_0x2bce4b));if(_0x2bce4b[_0xf917('0x13')]){if(_0x2bce4b[_0xf917('0x13')][_0xf917('0x14')]===0x1f4){logger[_0xf917('0x13')](_0xf917('0x10'),_0x5f4f2d,_0x2bce4b[_0xf917('0x13')][_0xf917('0x15')]);return _0x5b47bd(_0x2bce4b[_0xf917('0x13')][_0xf917('0x15')]);}logger[_0xf917('0x13')](_0xf917('0x10'),_0x5f4f2d,_0x2bce4b['error'][_0xf917('0x15')]);return _0x3b3894(_0x2bce4b['error'][_0xf917('0x15')]);}else{logger[_0xf917('0xf')](_0xf917('0x10'),_0x5f4f2d,_0xf917('0x11'));_0x3b3894(_0x2bce4b[_0xf917('0x16')][_0xf917('0x15')]);}})[_0xf917('0x17')](function(_0x4fab24){logger['error'](_0xf917('0x10'),_0x5f4f2d,_0x4fab24);_0x5b47bd(_0x4fab24);});});}exports['UpdateChatInteraction']=function(_0x4c3fc2){var _0x2ef933=this;return new Promise(function(_0x14b894,_0x5add8e){return db[_0xf917('0x18')][_0xf917('0x19')](_0x4c3fc2[_0xf917('0x1a')],{'raw':_0x4c3fc2[_0xf917('0x1b')]?_0x4c3fc2['options'][_0xf917('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c3fc2[_0xf917('0x1b')]?_0x4c3fc2[_0xf917('0x1b')]['where']||null:null,'attributes':_0x4c3fc2[_0xf917('0x1b')]?_0x4c3fc2[_0xf917('0x1b')]['attributes']||null:null,'limit':_0x4c3fc2[_0xf917('0x1b')]?_0x4c3fc2[_0xf917('0x1b')][_0xf917('0x1d')]||null:null})[_0xf917('0x1e')](function(_0x161cbd){logger[_0xf917('0xf')]('UpdateChatInteraction',_0x4c3fc2);logger[_0xf917('0x12')](_0xf917('0x1f'),_0x4c3fc2,JSON[_0xf917('0x20')](_0x161cbd));_0x14b894(_0x161cbd);})['catch'](function(_0x593a3c){logger[_0xf917('0x13')](_0xf917('0x1f'),_0x593a3c[_0xf917('0x15')],_0x4c3fc2);_0x5add8e(_0x2ef933[_0xf917('0x13')](0x1f4,_0x593a3c[_0xf917('0x15')]));});});};exports[_0xf917('0x21')]=function(_0x3793cb){return new Promise(function(_0x46c050,_0xb445d){return db[_0xf917('0x18')][_0xf917('0x22')]({'where':_0x3793cb[_0xf917('0x1b')]?_0x3793cb['options'][_0xf917('0x23')]||null:null})[_0xf917('0x1e')](function(_0x1f9be7){if(_0x1f9be7){return _0x1f9be7[_0xf917('0x24')](_0x3793cb[_0xf917('0x1a')]['ids'],_[_0xf917('0x25')](_0x3793cb[_0xf917('0x1a')],[_0xf917('0x26'),'id'])||{});}})[_0xf917('0x27')](function(_0x1dc511){logger[_0xf917('0xf')](_0xf917('0x28'),_0x3793cb);logger[_0xf917('0x12')]('AddTags',_0x3793cb,JSON['stringify'](_0x1dc511));_0x46c050(_0x1dc511);})['catch'](function(_0x18653f){logger[_0xf917('0x13')]('AddTags',_0x18653f[_0xf917('0x15')],_0x3793cb);_0xb445d(_this['error'](0x1f4,_0x18653f[_0xf917('0x15')]));});});}; \ No newline at end of file +var _0xa92c=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateChatInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToChatInteraction','find','addTags','ids','spread','AddTags','lodash','util'];(function(_0xcc7a6d,_0x1fe408){var _0x19f821=function(_0x18887c){while(--_0x18887c){_0xcc7a6d['push'](_0xcc7a6d['shift']());}};_0x19f821(++_0x1fe408);}(_0xa92c,0x10c));var _0xca92=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xa92c[_0x101e7b];return _0x4995c0;};'use strict';var _=require(_0xca92('0x0'));var util=require(_0xca92('0x1'));var moment=require(_0xca92('0x2'));var BPromise=require(_0xca92('0x3'));var rs=require(_0xca92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca92('0x5'))['db'];var utils=require(_0xca92('0x6'));var logger=require(_0xca92('0x7'))(_0xca92('0x8'));var config=require(_0xca92('0x9'));var jayson=require(_0xca92('0xa'));var client=jayson[_0xca92('0xb')][_0xca92('0xc')]({'port':0x232a});config[_0xca92('0xd')]=_[_0xca92('0xe')](config[_0xca92('0xd')],{'host':_0xca92('0xf'),'port':0x18eb});var socket=require(_0xca92('0x10'))(new Redis(config[_0xca92('0xd')]));require(_0xca92('0x11'))[_0xca92('0x12')](socket);function respondWithRpcPromise(_0x100031,_0x3c5fa1,_0x163e14){return new BPromise(function(_0xb854fa,_0x381de7){return client[_0xca92('0x13')](_0x100031,_0x163e14)[_0xca92('0x14')](function(_0x34aa02){logger['info'](_0xca92('0x15'),_0x3c5fa1,_0xca92('0x16'));logger['debug'](_0xca92('0x17'),_0x3c5fa1,_0xca92('0x16'),JSON[_0xca92('0x18')](_0x34aa02));if(_0x34aa02[_0xca92('0x19')]){if(_0x34aa02[_0xca92('0x19')]['code']===0x1f4){logger[_0xca92('0x19')](_0xca92('0x15'),_0x3c5fa1,_0x34aa02[_0xca92('0x19')]['message']);return _0x381de7(_0x34aa02['error']['message']);}logger[_0xca92('0x19')](_0xca92('0x15'),_0x3c5fa1,_0x34aa02[_0xca92('0x19')][_0xca92('0x1a')]);return _0xb854fa(_0x34aa02[_0xca92('0x19')]['message']);}else{logger[_0xca92('0x1b')](_0xca92('0x15'),_0x3c5fa1,'request\x20sent');_0xb854fa(_0x34aa02[_0xca92('0x1c')][_0xca92('0x1a')]);}})[_0xca92('0x1d')](function(_0x2b378c){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3c5fa1,_0x2b378c);_0x381de7(_0x2b378c);});});}exports[_0xca92('0x1e')]=function(_0xdbd130){var _0x4131df=this;return new Promise(function(_0x246b61,_0x1965a7){return db['ChatInteraction'][_0xca92('0x1f')](_0xdbd130[_0xca92('0x20')],{'raw':_0xdbd130[_0xca92('0x21')]?_0xdbd130[_0xca92('0x21')][_0xca92('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdbd130[_0xca92('0x21')]?_0xdbd130[_0xca92('0x21')][_0xca92('0x23')]||null:null,'attributes':_0xdbd130[_0xca92('0x21')]?_0xdbd130[_0xca92('0x21')][_0xca92('0x24')]||null:null,'limit':_0xdbd130['options']?_0xdbd130[_0xca92('0x21')][_0xca92('0x25')]||null:null})[_0xca92('0x14')](function(_0x1c8ba0){logger[_0xca92('0x1b')]('UpdateChatInteraction',_0xdbd130);logger[_0xca92('0x26')](_0xca92('0x1e'),_0xdbd130,JSON[_0xca92('0x18')](_0x1c8ba0));_0x246b61(_0x1c8ba0);})['catch'](function(_0x5b4331){logger[_0xca92('0x19')](_0xca92('0x1e'),_0x5b4331[_0xca92('0x1a')],_0xdbd130);_0x1965a7(_0x4131df[_0xca92('0x19')](0x1f4,_0x5b4331[_0xca92('0x1a')]));});});};exports[_0xca92('0x27')]=function(_0x1ae37a){return new Promise(function(_0x1f7fb1,_0x2d6a04){return db['ChatInteraction'][_0xca92('0x28')]({'where':_0x1ae37a[_0xca92('0x21')]?_0x1ae37a[_0xca92('0x21')][_0xca92('0x23')]||null:null})['then'](function(_0x111d00){if(_0x111d00){return _0x111d00[_0xca92('0x29')](_0x1ae37a[_0xca92('0x20')][_0xca92('0x2a')],_['omit'](_0x1ae37a['body'],[_0xca92('0x2a'),'id'])||{});}})[_0xca92('0x2b')](function(_0x48eeb2){logger[_0xca92('0x1b')](_0xca92('0x2c'),_0x1ae37a);logger[_0xca92('0x26')](_0xca92('0x2c'),_0x1ae37a,JSON[_0xca92('0x18')](_0x48eeb2));_0x1f7fb1(_0x48eeb2);})[_0xca92('0x1d')](function(_0x5af478){logger[_0xca92('0x19')](_0xca92('0x2c'),_0x5af478[_0xca92('0x1a')],_0x1ae37a);_0x2d6a04(_this[_0xca92('0x19')](0x1f4,_0x5af478[_0xca92('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 8bb5a19..b27f8f5 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 _0xb6a6=['update','emit','length','save','remove'];(function(_0x2978e1,_0x26b3f5){var _0xca0ea8=function(_0x289c2e){while(--_0x289c2e){_0x2978e1['push'](_0x2978e1['shift']());}};_0xca0ea8(++_0x26b3f5);}(_0xb6a6,0x1ed));var _0x6b6a=function(_0x425c82,_0x5272a6){_0x425c82=_0x425c82-0x0;var _0x21b8ca=_0xb6a6[_0x425c82];return _0x21b8ca;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x6b6a('0x0'),_0x6b6a('0x1'),_0x6b6a('0x2')];function createListener(_0x1cef84,_0x53ea9d){return function(_0xd1fd42){_0x53ea9d[_0x6b6a('0x3')](_0x1cef84,_0xd1fd42);};}function removeListener(_0x2d61a5,_0x33600e){return function(){ChatInteractionEvents['removeListener'](_0x2d61a5,_0x33600e);};}exports['register']=function(_0xb5bba7){for(var _0x46fc69=0x0,_0x1774f7=events[_0x6b6a('0x4')];_0x46fc69<_0x1774f7;_0x46fc69++){var _0x1a352d=events[_0x46fc69];var _0x1f0728=createListener('chatInteraction:'+_0x1a352d,_0xb5bba7);ChatInteractionEvents['on'](_0x1a352d,_0x1f0728);}}; \ No newline at end of file +var _0xd50c=['update','emit','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x15a184,_0x21d451){var _0x134847=function(_0x36a221){while(--_0x36a221){_0x15a184['push'](_0x15a184['shift']());}};_0x134847(++_0x21d451);}(_0xd50c,0xed));var _0xcd50=function(_0x5aa28b,_0x3d4d1e){_0x5aa28b=_0x5aa28b-0x0;var _0xc1df71=_0xd50c[_0x5aa28b];return _0xc1df71;};'use strict';var ChatInteractionEvents=require(_0xcd50('0x0'));var events=[_0xcd50('0x1'),_0xcd50('0x2'),_0xcd50('0x3')];function createListener(_0x391b7e,_0xec40dc){return function(_0x2934d5){_0xec40dc[_0xcd50('0x4')](_0x391b7e,_0x2934d5);};}function removeListener(_0x3906e3,_0x180f7a){return function(){ChatInteractionEvents['removeListener'](_0x3906e3,_0x180f7a);};}exports[_0xcd50('0x5')]=function(_0x1cd5d6){for(var _0x5c868e=0x0,_0x2211fa=events[_0xcd50('0x6')];_0x5c868e<_0x2211fa;_0x5c868e++){var _0x36f6ea=events[_0x5c868e];var _0xa9f880=createListener(_0xcd50('0x7')+_0x36f6ea,_0x1cd5d6);ChatInteractionEvents['on'](_0x36f6ea,_0xa9f880);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 29e6c2b..842e8f1 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 _0x5dc8=['attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','isAuthenticated','/:id','isChatInteractionAuthorized','/:id/attachment_download'];(function(_0x32d5ef,_0x2f7b29){var _0x377ca1=function(_0x4a6966){while(--_0x4a6966){_0x32d5ef['push'](_0x32d5ef['shift']());}};_0x377ca1(++_0x2f7b29);}(_0x5dc8,0xcc));var _0x85dc=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x5dc8[_0x307d86];return _0x361745;};'use strict';var multer=require(_0x85dc('0x0'));var util=require('util');var path=require(_0x85dc('0x1'));var timeout=require(_0x85dc('0x2'));var express=require(_0x85dc('0x3'));var router=express[_0x85dc('0x4')]();var fs_extra=require(_0x85dc('0x5'));var auth=require(_0x85dc('0x6'));var interaction=require(_0x85dc('0x7'));var config=require(_0x85dc('0x8'));var controller=require(_0x85dc('0x9'));router[_0x85dc('0xa')]('/',auth['isAuthenticated'](),controller[_0x85dc('0xb')]);router[_0x85dc('0xa')]('/describe',auth[_0x85dc('0xc')](),controller['describe']);router[_0x85dc('0xa')](_0x85dc('0xd'),auth[_0x85dc('0xe')](),controller['show']);router[_0x85dc('0xa')](_0x85dc('0xf'),auth[_0x85dc('0xe')](),controller[_0x85dc('0x10')]);router['get'](_0x85dc('0x11'),auth[_0x85dc('0xc')](),controller[_0x85dc('0x12')]);router[_0x85dc('0xa')](_0x85dc('0x13'),auth[_0x85dc('0xe')](),controller[_0x85dc('0x14')]);router[_0x85dc('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x85dc('0x15')]);router[_0x85dc('0x16')]('/',auth[_0x85dc('0xc')](),controller[_0x85dc('0x17')]);router[_0x85dc('0x16')](_0x85dc('0x18'),auth[_0x85dc('0xc')](),controller[_0x85dc('0x19')]);var upload=multer({'storage':multer[_0x85dc('0x1a')]({'destination':function(_0x45a587,_0x34c4e5,_0x50f5c4){_0x50f5c4(null,path[_0x85dc('0x1b')](config[_0x85dc('0x1c')],_0x85dc('0x1d')));},'filename':function(_0x203ddb,_0x3a23d1,_0xed0893){_0xed0893(null,util[_0x85dc('0x1e')](_0x85dc('0x1f'),Date[_0x85dc('0x20')](),_0x3a23d1[_0x85dc('0x21')][_0x85dc('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x85dc('0x23'),upload[_0x85dc('0x24')]('file'),controller[_0x85dc('0x25')]);router[_0x85dc('0x16')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0x85dc('0x26')]);router[_0x85dc('0x16')](_0x85dc('0x27'),auth[_0x85dc('0xc')](),interaction[_0x85dc('0x28')](_0x85dc('0x29'),_0x85dc('0x2a')),controller['addTags']);router[_0x85dc('0x2b')]('/:id',auth[_0x85dc('0xc')](),interaction[_0x85dc('0x28')](_0x85dc('0x29'),'chatinteraction:update'),controller[_0x85dc('0x2c')]);router[_0x85dc('0x2b')](_0x85dc('0x2d'),controller[_0x85dc('0x2e')]);router[_0x85dc('0x2b')](_0x85dc('0x2f'),auth['isChatInteractionAuthorized'](),controller[_0x85dc('0x30')]);router[_0x85dc('0x2b')](_0x85dc('0x31'),controller[_0x85dc('0x32')]);router[_0x85dc('0x33')](_0x85dc('0xd'),auth['isAuthenticated'](),interaction[_0x85dc('0x28')]('chat',_0x85dc('0x34')),controller[_0x85dc('0x35')]);router[_0x85dc('0x33')](_0x85dc('0x27'),auth[_0x85dc('0xc')](),controller[_0x85dc('0x36')]);module['exports']=router; \ No newline at end of file +var _0xb14a=['customUpdate','/:id/abandon','abandon','/:id/close','close','delete','tracked','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','chat','addTags','chatinteraction:update','update','put','/:id/custom_update'];(function(_0x39365b,_0x538970){var _0x54ea69=function(_0x421ff1){while(--_0x421ff1){_0x39365b['push'](_0x39365b['shift']());}};_0x54ea69(++_0x538970);}(_0xb14a,0xb5));var _0xab14=function(_0x43ff76,_0x1dc2bb){_0x43ff76=_0x43ff76-0x0;var _0x1967b1=_0xb14a[_0x43ff76];return _0x1967b1;};'use strict';var multer=require('multer');var util=require(_0xab14('0x0'));var path=require(_0xab14('0x1'));var timeout=require(_0xab14('0x2'));var express=require(_0xab14('0x3'));var router=express[_0xab14('0x4')]();var fs_extra=require(_0xab14('0x5'));var auth=require(_0xab14('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xab14('0x7'));var controller=require(_0xab14('0x8'));router[_0xab14('0x9')]('/',auth[_0xab14('0xa')](),controller[_0xab14('0xb')]);router['get'](_0xab14('0xc'),auth[_0xab14('0xa')](),controller[_0xab14('0xd')]);router['get'](_0xab14('0xe'),auth[_0xab14('0xf')](),controller['show']);router['get'](_0xab14('0x10'),auth[_0xab14('0xf')](),controller[_0xab14('0x11')]);router[_0xab14('0x9')](_0xab14('0x12'),auth[_0xab14('0xa')](),controller[_0xab14('0x13')]);router['get'](_0xab14('0x14'),auth[_0xab14('0xf')](),controller[_0xab14('0x15')]);router[_0xab14('0x9')]('/:id/download',auth[_0xab14('0xa')](),controller[_0xab14('0x16')]);router[_0xab14('0x17')]('/',auth['isAuthenticated'](),controller[_0xab14('0x18')]);router[_0xab14('0x17')](_0xab14('0x19'),auth['isAuthenticated'](),controller[_0xab14('0x1a')]);var upload=multer({'storage':multer[_0xab14('0x1b')]({'destination':function(_0x245f1b,_0x354389,_0x47addb){_0x47addb(null,path['join'](config[_0xab14('0x1c')],_0xab14('0x1d')));},'filename':function(_0x3759de,_0x42b2f5,_0x4f38cf){_0x4f38cf(null,util[_0xab14('0x1e')](_0xab14('0x1f'),Date[_0xab14('0x20')](),_0x42b2f5[_0xab14('0x21')][_0xab14('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xab14('0x17')](_0xab14('0x23'),upload[_0xab14('0x24')](_0xab14('0x25')),controller[_0xab14('0x26')]);router[_0xab14('0x17')](_0xab14('0x12'),auth[_0xab14('0xf')](),controller[_0xab14('0x27')]);router[_0xab14('0x17')](_0xab14('0x28'),auth[_0xab14('0xa')](),interaction['tracked'](_0xab14('0x29'),'chatinteraction:addtags'),controller[_0xab14('0x2a')]);router['put']('/:id',auth[_0xab14('0xa')](),interaction['tracked'](_0xab14('0x29'),_0xab14('0x2b')),controller[_0xab14('0x2c')]);router[_0xab14('0x2d')](_0xab14('0x2e'),controller[_0xab14('0x2f')]);router['put'](_0xab14('0x30'),auth['isChatInteractionAuthorized'](),controller[_0xab14('0x31')]);router[_0xab14('0x2d')](_0xab14('0x32'),controller[_0xab14('0x33')]);router[_0xab14('0x34')](_0xab14('0xe'),auth['isAuthenticated'](),interaction[_0xab14('0x35')](_0xab14('0x29'),'chatinteraction:destroy'),controller[_0xab14('0x36')]);router['delete'](_0xab14('0x28'),auth[_0xab14('0xa')](),controller[_0xab14('0x37')]);module[_0xab14('0x38')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index b58cb7f..78ff93f 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 _0xe207=['BOOLEAN','INTEGER','sequelize','exports'];(function(_0x57f9b9,_0x45c6ff){var _0x18345a=function(_0x3a35d4){while(--_0x3a35d4){_0x57f9b9['push'](_0x57f9b9['shift']());}};_0x18345a(++_0x45c6ff);}(_0xe207,0x1de));var _0x7e20=function(_0x4a8e60,_0x278f5e){_0x4a8e60=_0x4a8e60-0x0;var _0x481dfd=_0xe207[_0x4a8e60];return _0x481dfd;};'use strict';var Sequelize=require(_0x7e20('0x0'));module[_0x7e20('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7e20('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x7e20('0x3')]}}; \ No newline at end of file +var _0x3384=['BOOLEAN','sequelize','exports','TEXT','medium'];(function(_0x76a3ae,_0x2e54cb){var _0x6aae2a=function(_0x247e54){while(--_0x247e54){_0x76a3ae['push'](_0x76a3ae['shift']());}};_0x6aae2a(++_0x2e54cb);}(_0x3384,0x1a0));var _0x4338=function(_0x1c4e70,_0x20c24f){_0x1c4e70=_0x1c4e70-0x0;var _0x43d1a7=_0x3384[_0x1c4e70];return _0x43d1a7;};'use strict';var Sequelize=require(_0x4338('0x0'));module[_0x4338('0x1')]={'body':{'type':Sequelize[_0x4338('0x2')](_0x4338('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4338('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 5cd21c0..fd8c76c 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 _0x2615=['Content-Range','json','reject','save','update','then','destroy','end','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','include','findAll','catch','includeAll','merge','find','params','body','describe','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','fullname','role','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','messages','createdAt','FromId','ToId','-createdAt','eml-format','zip-dir','fast-json-patch','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','offset','undefined','limit','count'];(function(_0x3ff5cc,_0x335637){var _0x2c0ac1=function(_0x354dbf){while(--_0x354dbf){_0x3ff5cc['push'](_0x3ff5cc['shift']());}};_0x2c0ac1(++_0x335637);}(_0x2615,0x115));var _0x5261=function(_0x469c01,_0x10c93c){_0x469c01=_0x469c01-0x0;var _0x534c6f=_0x2615[_0x469c01];return _0x534c6f;};'use strict';var emlformat=require(_0x5261('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5261('0x1'));var jsonpatch=require(_0x5261('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5261('0x3'));var Mustache=require('mustache');var util=require(_0x5261('0x4'));var path=require(_0x5261('0x5'));var sox=require('sox');var csv=require(_0x5261('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5261('0x7'));var _=require(_0x5261('0x8'));var squel=require(_0x5261('0x9'));var crypto=require(_0x5261('0xa'));var jsforce=require(_0x5261('0xb'));var deskjs=require(_0x5261('0xc'));var toCsv=require(_0x5261('0x6'));var querystring=require('querystring');var Papa=require(_0x5261('0xd'));var Redis=require('ioredis');var authService=require(_0x5261('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5261('0xf'));var logger=require(_0x5261('0x10'))(_0x5261('0x11'));var utils=require(_0x5261('0x12'));var config=require(_0x5261('0x13'));var licenseUtil=require(_0x5261('0x14'));var db=require(_0x5261('0x15'))['db'];config[_0x5261('0x16')]=_[_0x5261('0x17')](config[_0x5261('0x16')],{'host':_0x5261('0x18'),'port':0x18eb});var socket=require(_0x5261('0x19'))(new Redis(config[_0x5261('0x16')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x3fd895,_0x3f27c2){_0x3f27c2=_0x3f27c2||0xcc;return function(_0x22f897){if(_0x22f897){return _0x3fd895[_0x5261('0x1a')](_0x3f27c2);}return _0x3fd895[_0x5261('0x1b')](_0x3f27c2)['end']();};}function respondWithResult(_0x3ff6f7,_0x505aee){_0x505aee=_0x505aee||0xc8;return function(_0x1a15c0){if(_0x1a15c0){return _0x3ff6f7[_0x5261('0x1b')](_0x505aee)['json'](_0x1a15c0);}};}function respondWithFilteredResult(_0x448c1b,_0x1f3276){return function(_0x1bb657){if(_0x1bb657){var _0x2a6c74=typeof _0x1f3276[_0x5261('0x1c')]===_0x5261('0x1d')&&typeof _0x1f3276[_0x5261('0x1e')]==='undefined';var _0x122215=_0x1bb657[_0x5261('0x1f')];var _0x5a7fe5=_0x2a6c74?0x0:_0x1f3276['offset'];var _0x4276f0=_0x2a6c74?_0x1bb657[_0x5261('0x1f')]:_0x1f3276[_0x5261('0x1c')]+_0x1f3276['limit'];var _0x1859fd;if(_0x4276f0>=_0x122215){_0x4276f0=_0x122215;_0x1859fd=0xc8;}else{_0x1859fd=0xce;}_0x448c1b[_0x5261('0x1b')](_0x1859fd);return _0x448c1b['set'](_0x5261('0x20'),_0x5a7fe5+'-'+_0x4276f0+'/'+_0x122215)[_0x5261('0x21')](_0x1bb657);}return null;};}function patchUpdates(_0x454aa7){return function(_0x1daea5){try{jsonpatch['apply'](_0x1daea5,_0x454aa7,!![]);}catch(_0x4f9944){return BPromise[_0x5261('0x22')](_0x4f9944);}return _0x1daea5[_0x5261('0x23')]();};}function saveUpdates(_0x282199,_0x8f133b){return function(_0x2f5ef7){if(_0x2f5ef7){return _0x2f5ef7[_0x5261('0x24')](_0x282199)[_0x5261('0x25')](function(_0x15c3a3){return _0x15c3a3;});}return null;};}function removeEntity(_0x2dc8f7,_0x32e697){return function(_0x1ec504){if(_0x1ec504){return _0x1ec504[_0x5261('0x26')]()[_0x5261('0x25')](function(){_0x2dc8f7[_0x5261('0x1b')](0xcc)[_0x5261('0x27')]();});}};}function handleEntityNotFound(_0x6902fa,_0x3415a3){return function(_0x28c6d7){if(!_0x28c6d7){_0x6902fa[_0x5261('0x1a')](0x194);}return _0x28c6d7;};}function handleError(_0x15d5cf,_0x5a2e58){_0x5a2e58=_0x5a2e58||0x1f4;return function(_0x1e5dd9){logger['error'](_0x1e5dd9[_0x5261('0x28')]);if(_0x1e5dd9[_0x5261('0x29')]){delete _0x1e5dd9[_0x5261('0x29')];}_0x15d5cf['status'](_0x5a2e58)[_0x5261('0x2a')](_0x1e5dd9);};}exports[_0x5261('0x2b')]=function(_0x5336ab,_0x43937b){var _0x2934a1={},_0x3e6f0a={},_0xe42f9d={'count':0x0,'rows':[]};var _0x56fa8f=_['map'](db[_0x5261('0x2c')][_0x5261('0x2d')],function(_0x1ba0b3){return{'name':_0x1ba0b3[_0x5261('0x2e')],'type':_0x1ba0b3[_0x5261('0x2f')]['key']};});_0x3e6f0a[_0x5261('0x30')]=_[_0x5261('0x31')](_0x56fa8f,'name');_0x3e6f0a[_0x5261('0x32')]=_[_0x5261('0x33')](_0x5336ab[_0x5261('0x32')]);_0x3e6f0a['filters']=_[_0x5261('0x34')](_0x3e6f0a['model'],_0x3e6f0a['query']);_0x2934a1['attributes']=_[_0x5261('0x34')](_0x3e6f0a['model'],qs[_0x5261('0x35')](_0x5336ab[_0x5261('0x32')]['fields']));_0x2934a1[_0x5261('0x36')]=_0x2934a1['attributes'][_0x5261('0x37')]?_0x2934a1[_0x5261('0x36')]:_0x3e6f0a[_0x5261('0x30')];if(!_0x5336ab[_0x5261('0x32')][_0x5261('0x38')](_0x5261('0x39'))){_0x2934a1[_0x5261('0x1e')]=qs['limit'](_0x5336ab[_0x5261('0x32')][_0x5261('0x1e')]);_0x2934a1[_0x5261('0x1c')]=qs[_0x5261('0x1c')](_0x5336ab['query'][_0x5261('0x1c')]);}_0x2934a1['order']=qs[_0x5261('0x3a')](_0x5336ab[_0x5261('0x32')][_0x5261('0x3a')]);_0x2934a1[_0x5261('0x3b')]=qs[_0x5261('0x3c')](_[_0x5261('0x3d')](_0x5336ab[_0x5261('0x32')],_0x3e6f0a['filters']),_0x56fa8f);if(_0x5336ab['query'][_0x5261('0x3e')]){_0x2934a1[_0x5261('0x3b')]=_['merge'](_0x2934a1[_0x5261('0x3b')],{'$or':_['map'](_0x56fa8f,function(_0x5943a1){if(_0x5943a1[_0x5261('0x2f')]!==_0x5261('0x3f')){var _0x51239b={};_0x51239b[_0x5943a1[_0x5261('0x29')]]={'$like':'%'+_0x5336ab[_0x5261('0x32')][_0x5261('0x3e')]+'%'};return _0x51239b;}})});}_0x2934a1=_['merge']({},_0x2934a1,_0x5336ab[_0x5261('0x40')]);var _0x2ce859={'where':_0x2934a1['where']};return db[_0x5261('0x2c')]['count'](_0x2ce859)['then'](function(_0x9172f7){_0xe42f9d['count']=_0x9172f7;if(_0x5336ab[_0x5261('0x32')]['includeAll']){_0x2934a1[_0x5261('0x41')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x5261('0x42')](_0x2934a1);})[_0x5261('0x25')](function(_0x3009e5){_0xe42f9d['rows']=_0x3009e5;return _0xe42f9d;})[_0x5261('0x25')](respondWithFilteredResult(_0x43937b,_0x2934a1))[_0x5261('0x43')](handleError(_0x43937b,null));};exports['show']=function(_0x920ede,_0x44181f){var _0x7ead2b={'raw':!![],'where':{'id':_0x920ede['params']['id']}},_0x4c1095={};_0x4c1095[_0x5261('0x30')]=_[_0x5261('0x33')](db['ChatInternalMessage'][_0x5261('0x2d')]);_0x4c1095['query']=_[_0x5261('0x33')](_0x920ede[_0x5261('0x32')]);_0x4c1095[_0x5261('0x3c')]=_[_0x5261('0x34')](_0x4c1095[_0x5261('0x30')],_0x4c1095[_0x5261('0x32')]);_0x7ead2b[_0x5261('0x36')]=_[_0x5261('0x34')](_0x4c1095[_0x5261('0x30')],qs['fields'](_0x920ede['query'][_0x5261('0x35')]));_0x7ead2b['attributes']=_0x7ead2b[_0x5261('0x36')][_0x5261('0x37')]?_0x7ead2b['attributes']:_0x4c1095[_0x5261('0x30')];if(_0x920ede[_0x5261('0x32')][_0x5261('0x44')]){_0x7ead2b[_0x5261('0x41')]=[{'all':!![]}];}_0x7ead2b=_[_0x5261('0x45')]({},_0x7ead2b,_0x920ede[_0x5261('0x40')]);return db['ChatInternalMessage'][_0x5261('0x46')](_0x7ead2b)[_0x5261('0x25')](handleEntityNotFound(_0x44181f,null))['then'](respondWithResult(_0x44181f,null))[_0x5261('0x43')](handleError(_0x44181f,null));};exports['create']=function(_0x3c18c0,_0x343edb){return db['ChatInternalMessage']['create'](_0x3c18c0['body'],{})[_0x5261('0x25')](respondWithResult(_0x343edb,0xc9))[_0x5261('0x43')](handleError(_0x343edb,null));};exports[_0x5261('0x24')]=function(_0x5df135,_0x41deb3){if(_0x5df135['body']['id']){delete _0x5df135['body']['id'];}return db['ChatInternalMessage'][_0x5261('0x46')]({'where':{'id':_0x5df135[_0x5261('0x47')]['id']}})[_0x5261('0x25')](handleEntityNotFound(_0x41deb3,null))['then'](saveUpdates(_0x5df135[_0x5261('0x48')],null))[_0x5261('0x25')](respondWithResult(_0x41deb3,null))[_0x5261('0x43')](handleError(_0x41deb3,null));};exports['destroy']=function(_0x25bb37,_0x5ee069){return db[_0x5261('0x2c')][_0x5261('0x46')]({'where':{'id':_0x25bb37['params']['id']}})['then'](handleEntityNotFound(_0x5ee069,null))[_0x5261('0x25')](removeEntity(_0x5ee069,null))['catch'](handleError(_0x5ee069,null));};exports['describe']=function(_0x404d68,_0x84e4ec){return db['ChatInternalMessage'][_0x5261('0x49')]()[_0x5261('0x25')](respondWithResult(_0x84e4ec,null))[_0x5261('0x43')](handleError(_0x84e4ec,null));};function wrapUser(_0x22cc70){return function(_0x2d44b6){var _0x1566b4=_0x22cc70['get']({'plain':!![]});_0x1566b4['messages']=[];if(_0x2d44b6){_0x1566b4['lastMessageAt']=_0x2d44b6['createdAt'];_0x1566b4['lastMessage']=_0x2d44b6;}else{_0x1566b4[_0x5261('0x4a')]=moment(0x0)[_0x5261('0x4b')](_0x5261('0x4c'));_0x1566b4['lastMessage']={};}return _0x1566b4;};}exports[_0x5261('0x4d')]=function(_0x3c381c,_0x986573,_0x1854c5){var _0x38c128=[];return db[_0x5261('0x4e')][_0x5261('0x42')]({'where':{'role':[_0x5261('0x4f'),_0x5261('0x50'),'user']},'attributes':['id',_0x5261('0x51'),'name',_0x5261('0x52'),'userpic',_0x5261('0x53'),'online',_0x5261('0x54'),_0x5261('0x55'),_0x5261('0x56')],'order':qs[_0x5261('0x3a')]('-online'),'include':[{'model':db[_0x5261('0x57')],'as':_0x5261('0x58'),'attributes':['id',_0x5261('0x29'),'type'],'through':{'attributes':[]}}]})[_0x5261('0x25')](function(_0x5e1956){if(_0x5e1956){var _0x1415c4=_0x3c381c[_0x5261('0x59')][_0x5261('0x5a')]({'plain':!![]});if(!_0x1415c4)throw new Error(_0x5261('0x5b'));if(_0x1415c4['role']==='user'){return db[_0x5261('0x5c')]['find']({'where':{'name':'Agents','userProfileId':_0x1415c4[_0x5261('0x5d')]},'raw':!![]})['then'](function(_0x39a59c){if(_0x39a59c){if(_0x39a59c[_0x5261('0x5e')]===0x0){return db[_0x5261('0x5f')][_0x5261('0x42')]({'where':{'sectionId':_0x39a59c['id']},'raw':!![]})[_0x5261('0x25')](function(_0x5bcda6){var _0x194bf0=[];if(_[_0x5261('0x60')](_0x5bcda6)){_0x194bf0=_[_0x5261('0x3e')](_0x5e1956,function(_0x5bdd17){if(_0x5bdd17['role']!=='agent'){return _0x5bdd17;}});return _0x194bf0;}else{for(var _0x48f60f=0x0;_0x48f60f<_0x5e1956['length'];_0x48f60f++){var _0x2e38ca=_0x5e1956[_0x48f60f];if(_0x2e38ca['role']===_0x5261('0x4f')){var _0x217a22=_['find'](_0x5bcda6,function(_0x2323d6){return _0x2323d6['resourceId']===_0x2e38ca['id'];});if(_0x217a22)_0x194bf0[_0x5261('0x61')](_0x2e38ca);}else{_0x194bf0[_0x5261('0x61')](_0x2e38ca);}}return _0x194bf0;}});}else{return _0x5e1956;}}else{var _0x1a8e95=_[_0x5261('0x3e')](_0x5e1956,function(_0x3df177){if(_0x3df177[_0x5261('0x52')]!==_0x5261('0x4f')){return _0x3df177;}});return _0x1a8e95;}});}else{return _0x5e1956;}}})[_0x5261('0x25')](function(_0x5823a6){var _0x510a41=[];if(_0x5823a6){_0x38c128=_0x5823a6;for(var _0x58be16=0x0;_0x58be16<_0x5823a6[_0x5261('0x37')];_0x58be16+=0x1){_0x38c128[_0x58be16][_0x5261('0x62')]=[];_0x510a41[_0x5261('0x61')](db[_0x5261('0x2c')][_0x5261('0x46')]({'where':{'FromId':[_0x3c381c[_0x5261('0x59')]['id'],_0x5823a6[_0x58be16]['id']],'ToId':[_0x3c381c[_0x5261('0x59')]['id'],_0x5823a6[_0x58be16]['id']],'ChatGroupId':null},'attributes':['id',_0x5261('0x63'),_0x5261('0x64'),_0x5261('0x65'),'read',_0x5261('0x48')],'order':qs[_0x5261('0x3a')](_0x5261('0x66')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x5261('0x25')](wrapUser(_0x5823a6[_0x58be16])));}return BPromise['all'](_0x510a41);}return[];})[_0x5261('0x25')](function(_0x2238c7){return{'rows':_0x2238c7,'count':_0x2238c7[_0x5261('0x37')]};})[_0x5261('0x25')](respondWithResult(_0x986573,null))['catch'](handleError(_0x986573,null));}; \ No newline at end of file +var _0x4e14=['show','params','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','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/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x4d9d1a,_0x470c36){var _0x31674f=function(_0x32d554){while(--_0x32d554){_0x4d9d1a['push'](_0x4d9d1a['shift']());}};_0x31674f(++_0x470c36);}(_0x4e14,0x98));var _0x44e1=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x4e14[_0x2aea9e];return _0x430b92;};'use strict';var emlformat=require(_0x44e1('0x0'));var rimraf=require(_0x44e1('0x1'));var zipdir=require(_0x44e1('0x2'));var jsonpatch=require(_0x44e1('0x3'));var rp=require(_0x44e1('0x4'));var moment=require('moment');var BPromise=require(_0x44e1('0x5'));var Mustache=require(_0x44e1('0x6'));var util=require(_0x44e1('0x7'));var path=require(_0x44e1('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x44e1('0x9'));var fs=require('fs');var fs_extra=require(_0x44e1('0xa'));var _=require(_0x44e1('0xb'));var squel=require(_0x44e1('0xc'));var crypto=require(_0x44e1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x44e1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x44e1('0xf'));var Papa=require(_0x44e1('0x10'));var Redis=require(_0x44e1('0x11'));var authService=require(_0x44e1('0x12'));var qs=require(_0x44e1('0x13'));var as=require(_0x44e1('0x14'));var hardwareService=require(_0x44e1('0x15'));var logger=require(_0x44e1('0x16'))(_0x44e1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x44e1('0x18'));var db=require(_0x44e1('0x19'))['db'];config[_0x44e1('0x1a')]=_[_0x44e1('0x1b')](config[_0x44e1('0x1a')],{'host':_0x44e1('0x1c'),'port':0x18eb});var socket=require(_0x44e1('0x1d'))(new Redis(config[_0x44e1('0x1a')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x31e7e5,_0x4c428a){_0x4c428a=_0x4c428a||0xcc;return function(_0x19f15b){if(_0x19f15b){return _0x31e7e5[_0x44e1('0x1e')](_0x4c428a);}return _0x31e7e5[_0x44e1('0x1f')](_0x4c428a)[_0x44e1('0x20')]();};}function respondWithResult(_0x3681ef,_0x4c7234){_0x4c7234=_0x4c7234||0xc8;return function(_0x2d5b9b){if(_0x2d5b9b){return _0x3681ef['status'](_0x4c7234)['json'](_0x2d5b9b);}};}function respondWithFilteredResult(_0x42944e,_0x858ff7){return function(_0x29d306){if(_0x29d306){var _0x2e9b42=typeof _0x858ff7[_0x44e1('0x21')]==='undefined'&&typeof _0x858ff7[_0x44e1('0x22')]==='undefined';var _0x2d24d6=_0x29d306[_0x44e1('0x23')];var _0x49aba7=_0x2e9b42?0x0:_0x858ff7[_0x44e1('0x21')];var _0x440b64=_0x2e9b42?_0x29d306[_0x44e1('0x23')]:_0x858ff7[_0x44e1('0x21')]+_0x858ff7[_0x44e1('0x22')];var _0x2a936a;if(_0x440b64>=_0x2d24d6){_0x440b64=_0x2d24d6;_0x2a936a=0xc8;}else{_0x2a936a=0xce;}_0x42944e['status'](_0x2a936a);return _0x42944e['set'](_0x44e1('0x24'),_0x49aba7+'-'+_0x440b64+'/'+_0x2d24d6)['json'](_0x29d306);}return null;};}function patchUpdates(_0x5605d0){return function(_0x3c6b13){try{jsonpatch[_0x44e1('0x25')](_0x3c6b13,_0x5605d0,!![]);}catch(_0x468d16){return BPromise[_0x44e1('0x26')](_0x468d16);}return _0x3c6b13[_0x44e1('0x27')]();};}function saveUpdates(_0x43241a,_0x5a0bfb){return function(_0x9f6306){if(_0x9f6306){return _0x9f6306[_0x44e1('0x28')](_0x43241a)[_0x44e1('0x29')](function(_0x26d08d){return _0x26d08d;});}return null;};}function removeEntity(_0x341951,_0x489aef){return function(_0x4280a4){if(_0x4280a4){return _0x4280a4[_0x44e1('0x2a')]()[_0x44e1('0x29')](function(){_0x341951['status'](0xcc)[_0x44e1('0x20')]();});}};}function handleEntityNotFound(_0x2286fc,_0x207e40){return function(_0x27445e){if(!_0x27445e){_0x2286fc['sendStatus'](0x194);}return _0x27445e;};}function handleError(_0x297085,_0x3694dc){_0x3694dc=_0x3694dc||0x1f4;return function(_0xa08318){logger[_0x44e1('0x2b')](_0xa08318[_0x44e1('0x2c')]);if(_0xa08318[_0x44e1('0x2d')]){delete _0xa08318[_0x44e1('0x2d')];}_0x297085[_0x44e1('0x1f')](_0x3694dc)[_0x44e1('0x2e')](_0xa08318);};}exports['index']=function(_0xc5328f,_0x2828bc){var _0x2b6222={},_0x1f8efd={},_0x56cc8a={'count':0x0,'rows':[]};var _0x51d965=_[_0x44e1('0x2f')](db[_0x44e1('0x30')][_0x44e1('0x31')],function(_0x1cc23a){return{'name':_0x1cc23a[_0x44e1('0x32')],'type':_0x1cc23a[_0x44e1('0x33')][_0x44e1('0x34')]};});_0x1f8efd[_0x44e1('0x35')]=_[_0x44e1('0x2f')](_0x51d965,_0x44e1('0x2d'));_0x1f8efd[_0x44e1('0x36')]=_[_0x44e1('0x37')](_0xc5328f[_0x44e1('0x36')]);_0x1f8efd[_0x44e1('0x38')]=_[_0x44e1('0x39')](_0x1f8efd['model'],_0x1f8efd[_0x44e1('0x36')]);_0x2b6222[_0x44e1('0x3a')]=_[_0x44e1('0x39')](_0x1f8efd['model'],qs[_0x44e1('0x3b')](_0xc5328f[_0x44e1('0x36')]['fields']));_0x2b6222['attributes']=_0x2b6222[_0x44e1('0x3a')][_0x44e1('0x3c')]?_0x2b6222[_0x44e1('0x3a')]:_0x1f8efd[_0x44e1('0x35')];if(!_0xc5328f[_0x44e1('0x36')][_0x44e1('0x3d')](_0x44e1('0x3e'))){_0x2b6222[_0x44e1('0x22')]=qs[_0x44e1('0x22')](_0xc5328f['query'][_0x44e1('0x22')]);_0x2b6222[_0x44e1('0x21')]=qs[_0x44e1('0x21')](_0xc5328f['query'][_0x44e1('0x21')]);}_0x2b6222[_0x44e1('0x3f')]=qs[_0x44e1('0x40')](_0xc5328f[_0x44e1('0x36')][_0x44e1('0x40')]);_0x2b6222[_0x44e1('0x41')]=qs[_0x44e1('0x38')](_[_0x44e1('0x42')](_0xc5328f[_0x44e1('0x36')],_0x1f8efd[_0x44e1('0x38')]),_0x51d965);if(_0xc5328f[_0x44e1('0x36')][_0x44e1('0x43')]){_0x2b6222[_0x44e1('0x41')]=_[_0x44e1('0x44')](_0x2b6222[_0x44e1('0x41')],{'$or':_[_0x44e1('0x2f')](_0x51d965,function(_0x1b9bfc){if(_0x1b9bfc['type']!==_0x44e1('0x45')){var _0x37dfde={};_0x37dfde[_0x1b9bfc['name']]={'$like':'%'+_0xc5328f[_0x44e1('0x36')][_0x44e1('0x43')]+'%'};return _0x37dfde;}})});}_0x2b6222=_[_0x44e1('0x44')]({},_0x2b6222,_0xc5328f[_0x44e1('0x46')]);var _0x5d80fb={'where':_0x2b6222[_0x44e1('0x41')]};return db[_0x44e1('0x30')][_0x44e1('0x23')](_0x5d80fb)['then'](function(_0x290aa3){_0x56cc8a['count']=_0x290aa3;if(_0xc5328f[_0x44e1('0x36')][_0x44e1('0x47')]){_0x2b6222[_0x44e1('0x48')]=[{'all':!![]}];}return db[_0x44e1('0x30')][_0x44e1('0x49')](_0x2b6222);})[_0x44e1('0x29')](function(_0x1df32d){_0x56cc8a[_0x44e1('0x4a')]=_0x1df32d;return _0x56cc8a;})[_0x44e1('0x29')](respondWithFilteredResult(_0x2828bc,_0x2b6222))[_0x44e1('0x4b')](handleError(_0x2828bc,null));};exports[_0x44e1('0x4c')]=function(_0x1e92ad,_0x18ecba){var _0xdf5e07={'raw':!![],'where':{'id':_0x1e92ad[_0x44e1('0x4d')]['id']}},_0xcc01e2={};_0xcc01e2['model']=_[_0x44e1('0x37')](db[_0x44e1('0x30')][_0x44e1('0x31')]);_0xcc01e2[_0x44e1('0x36')]=_[_0x44e1('0x37')](_0x1e92ad[_0x44e1('0x36')]);_0xcc01e2['filters']=_[_0x44e1('0x39')](_0xcc01e2[_0x44e1('0x35')],_0xcc01e2['query']);_0xdf5e07[_0x44e1('0x3a')]=_[_0x44e1('0x39')](_0xcc01e2[_0x44e1('0x35')],qs[_0x44e1('0x3b')](_0x1e92ad[_0x44e1('0x36')][_0x44e1('0x3b')]));_0xdf5e07[_0x44e1('0x3a')]=_0xdf5e07['attributes'][_0x44e1('0x3c')]?_0xdf5e07[_0x44e1('0x3a')]:_0xcc01e2[_0x44e1('0x35')];if(_0x1e92ad[_0x44e1('0x36')][_0x44e1('0x47')]){_0xdf5e07[_0x44e1('0x48')]=[{'all':!![]}];}_0xdf5e07=_['merge']({},_0xdf5e07,_0x1e92ad[_0x44e1('0x46')]);return db[_0x44e1('0x30')][_0x44e1('0x4e')](_0xdf5e07)['then'](handleEntityNotFound(_0x18ecba,null))['then'](respondWithResult(_0x18ecba,null))[_0x44e1('0x4b')](handleError(_0x18ecba,null));};exports[_0x44e1('0x4f')]=function(_0x193612,_0x3c3901){return db[_0x44e1('0x30')]['create'](_0x193612[_0x44e1('0x50')],{})[_0x44e1('0x29')](respondWithResult(_0x3c3901,0xc9))[_0x44e1('0x4b')](handleError(_0x3c3901,null));};exports['update']=function(_0x58ff1a,_0x1367ea){if(_0x58ff1a[_0x44e1('0x50')]['id']){delete _0x58ff1a[_0x44e1('0x50')]['id'];}return db[_0x44e1('0x30')]['find']({'where':{'id':_0x58ff1a['params']['id']}})[_0x44e1('0x29')](handleEntityNotFound(_0x1367ea,null))['then'](saveUpdates(_0x58ff1a['body'],null))[_0x44e1('0x29')](respondWithResult(_0x1367ea,null))[_0x44e1('0x4b')](handleError(_0x1367ea,null));};exports[_0x44e1('0x2a')]=function(_0x12dfcb,_0x1b6389){return db[_0x44e1('0x30')][_0x44e1('0x4e')]({'where':{'id':_0x12dfcb[_0x44e1('0x4d')]['id']}})[_0x44e1('0x29')](handleEntityNotFound(_0x1b6389,null))[_0x44e1('0x29')](removeEntity(_0x1b6389,null))['catch'](handleError(_0x1b6389,null));};exports['describe']=function(_0x3dde2a,_0x49a85d){return db['ChatInternalMessage'][_0x44e1('0x51')]()[_0x44e1('0x29')](respondWithResult(_0x49a85d,null))[_0x44e1('0x4b')](handleError(_0x49a85d,null));};function wrapUser(_0x262a39){return function(_0x569f44){var _0x2de2c5=_0x262a39[_0x44e1('0x52')]({'plain':!![]});_0x2de2c5[_0x44e1('0x53')]=[];if(_0x569f44){_0x2de2c5[_0x44e1('0x54')]=_0x569f44[_0x44e1('0x55')];_0x2de2c5[_0x44e1('0x56')]=_0x569f44;}else{_0x2de2c5[_0x44e1('0x54')]=moment(0x0)[_0x44e1('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x2de2c5[_0x44e1('0x56')]={};}return _0x2de2c5;};}exports['getUsers']=function(_0x187b21,_0x24e2c0,_0x1f31ba){var _0x387b1f=[];return db[_0x44e1('0x58')]['findAll']({'where':{'role':[_0x44e1('0x59'),_0x44e1('0x5a'),_0x44e1('0x5b')]},'attributes':['id',_0x44e1('0x5c'),_0x44e1('0x2d'),_0x44e1('0x5d'),_0x44e1('0x5e'),_0x44e1('0x5f'),_0x44e1('0x60'),_0x44e1('0x61'),_0x44e1('0x62'),_0x44e1('0x63')],'order':qs['sort'](_0x44e1('0x64')),'include':[{'model':db[_0x44e1('0x65')],'as':_0x44e1('0x66'),'attributes':['id',_0x44e1('0x2d'),_0x44e1('0x33')],'through':{'attributes':[]}}]})[_0x44e1('0x29')](function(_0x3683a0){if(_0x3683a0){var _0x47ad65=_0x187b21[_0x44e1('0x5b')][_0x44e1('0x52')]({'plain':!![]});if(!_0x47ad65)throw new Error(_0x44e1('0x67'));if(_0x47ad65[_0x44e1('0x5d')]==='user'){return db[_0x44e1('0x68')][_0x44e1('0x4e')]({'where':{'name':_0x44e1('0x69'),'userProfileId':_0x47ad65['userProfileId']},'raw':!![]})[_0x44e1('0x29')](function(_0x23fe20){if(_0x23fe20){if(_0x23fe20[_0x44e1('0x6a')]===0x0){return db[_0x44e1('0x6b')][_0x44e1('0x49')]({'where':{'sectionId':_0x23fe20['id']},'raw':!![]})[_0x44e1('0x29')](function(_0x53c105){var _0x5297b6=[];if(_[_0x44e1('0x6c')](_0x53c105)){_0x5297b6=_[_0x44e1('0x43')](_0x3683a0,function(_0x12d486){if(_0x12d486[_0x44e1('0x5d')]!==_0x44e1('0x59')){return _0x12d486;}});return _0x5297b6;}else{for(var _0x38618c=0x0;_0x38618c<_0x3683a0[_0x44e1('0x3c')];_0x38618c++){var _0x41d135=_0x3683a0[_0x38618c];if(_0x41d135[_0x44e1('0x5d')]===_0x44e1('0x59')){var _0x55e48f=_[_0x44e1('0x4e')](_0x53c105,function(_0x59ee70){return _0x59ee70[_0x44e1('0x6d')]===_0x41d135['id'];});if(_0x55e48f)_0x5297b6[_0x44e1('0x6e')](_0x41d135);}else{_0x5297b6[_0x44e1('0x6e')](_0x41d135);}}return _0x5297b6;}});}else{return _0x3683a0;}}else{var _0x587c37=_[_0x44e1('0x43')](_0x3683a0,function(_0x36abc1){if(_0x36abc1[_0x44e1('0x5d')]!=='agent'){return _0x36abc1;}});return _0x587c37;}});}else{return _0x3683a0;}}})['then'](function(_0x4dbecd){var _0x57aebe=[];if(_0x4dbecd){_0x387b1f=_0x4dbecd;for(var _0x4e392c=0x0;_0x4e392c<_0x4dbecd[_0x44e1('0x3c')];_0x4e392c+=0x1){_0x387b1f[_0x4e392c]['messages']=[];_0x57aebe[_0x44e1('0x6e')](db['ChatInternalMessage'][_0x44e1('0x4e')]({'where':{'FromId':[_0x187b21[_0x44e1('0x5b')]['id'],_0x4dbecd[_0x4e392c]['id']],'ToId':[_0x187b21[_0x44e1('0x5b')]['id'],_0x4dbecd[_0x4e392c]['id']],'ChatGroupId':null},'attributes':['id',_0x44e1('0x55'),_0x44e1('0x6f'),'ToId','read',_0x44e1('0x50')],'order':qs[_0x44e1('0x40')](_0x44e1('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x44e1('0x29')](wrapUser(_0x4dbecd[_0x4e392c])));}return BPromise[_0x44e1('0x71')](_0x57aebe);}return[];})[_0x44e1('0x29')](function(_0xf3b6e5){return{'rows':_0xf3b6e5,'count':_0xf3b6e5[_0x44e1('0x3c')]};})[_0x44e1('0x29')](respondWithResult(_0x24e2c0,null))[_0x44e1('0x4b')](handleError(_0x24e2c0,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 9a02fff..dc71d45 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 _0xc9de=['events','../../mysqldb','ChatInternalMessage','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x343d36,_0x5f248a){var _0x3bd305=function(_0x611a1e){while(--_0x611a1e){_0x343d36['push'](_0x343d36['shift']());}};_0x3bd305(++_0x5f248a);}(_0xc9de,0x140));var _0xec9d=function(_0x4a8e8a,_0x340eb1){_0x4a8e8a=_0x4a8e8a-0x0;var _0x22b9d0=_0xc9de[_0x4a8e8a];return _0x22b9d0;};'use strict';var EventEmitter=require(_0xec9d('0x0'));var ChatInternalMessage=require(_0xec9d('0x1'))['db'][_0xec9d('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xec9d('0x3'),'afterUpdate':_0xec9d('0x4'),'afterDestroy':_0xec9d('0x5')};function emitEvent(_0xc34261){return function(_0x3cc1cb,_0x14c4e5,_0x9a3338){ChatInternalMessageEvents[_0xec9d('0x6')](_0xc34261+':'+_0x3cc1cb['id'],_0x3cc1cb);ChatInternalMessageEvents['emit'](_0xc34261,_0x3cc1cb);_0x9a3338(null);};}for(var e in events){if(events[_0xec9d('0x7')](e)){var event=events[e];ChatInternalMessage[_0xec9d('0x8')](e,emitEvent(event));}}module[_0xec9d('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x6ea6=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save'];(function(_0x41b3a7,_0x3b754a){var _0x573b21=function(_0x326117){while(--_0x326117){_0x41b3a7['push'](_0x41b3a7['shift']());}};_0x573b21(++_0x3b754a);}(_0x6ea6,0x14f));var _0x66ea=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0x6ea6[_0x546aaf];return _0x1cbf6d;};'use strict';var EventEmitter=require(_0x66ea('0x0'));var ChatInternalMessage=require(_0x66ea('0x1'))['db'][_0x66ea('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x66ea('0x3')](0x0);var events={'afterCreate':_0x66ea('0x4'),'afterUpdate':_0x66ea('0x5'),'afterDestroy':_0x66ea('0x6')};function emitEvent(_0xb2e7d6){return function(_0x1449db,_0x1b5935,_0x1b266f){ChatInternalMessageEvents['emit'](_0xb2e7d6+':'+_0x1449db['id'],_0x1449db);ChatInternalMessageEvents[_0x66ea('0x7')](_0xb2e7d6,_0x1449db);_0x1b266f(null);};}for(var e in events){if(events[_0x66ea('0x8')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x66ea('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index fcf9161..1f8e15d 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 _0xc70b=['path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3e9451,_0x19e65a){var _0x43d95e=function(_0x237b77){while(--_0x237b77){_0x3e9451['push'](_0x3e9451['shift']());}};_0x43d95e(++_0x19e65a);}(_0xc70b,0x1bb));var _0xbc70=function(_0x4fc4fe,_0x1216ed){_0x4fc4fe=_0x4fc4fe-0x0;var _0x168668=_0xc70b[_0x4fc4fe];return _0x168668;};'use strict';var _=require(_0xbc70('0x0'));var util=require(_0xbc70('0x1'));var logger=require(_0xbc70('0x2'))(_0xbc70('0x3'));var moment=require(_0xbc70('0x4'));var BPromise=require(_0xbc70('0x5'));var rp=require(_0xbc70('0x6'));var fs=require('fs');var path=require(_0xbc70('0x7'));var rimraf=require(_0xbc70('0x8'));var config=require(_0xbc70('0x9'));var attributes=require(_0xbc70('0xa'));module[_0xbc70('0xb')]=function(_0x57678d,_0x27b239){return _0x57678d[_0xbc70('0xc')]('ChatInternalMessage',attributes,{'tableName':_0xbc70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbc70('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x23df=['rimraf','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path'];(function(_0x98db33,_0x397f20){var _0x5ae63a=function(_0x411f1c){while(--_0x411f1c){_0x98db33['push'](_0x98db33['shift']());}};_0x5ae63a(++_0x397f20);}(_0x23df,0x173));var _0xf23d=function(_0x57e098,_0x29f6e6){_0x57e098=_0x57e098-0x0;var _0x144829=_0x23df[_0x57e098];return _0x144829;};'use strict';var _=require('lodash');var util=require(_0xf23d('0x0'));var logger=require(_0xf23d('0x1'))(_0xf23d('0x2'));var moment=require(_0xf23d('0x3'));var BPromise=require(_0xf23d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf23d('0x5'));var rimraf=require(_0xf23d('0x6'));var config=require('../../config/environment');var attributes=require(_0xf23d('0x7'));module[_0xf23d('0x8')]=function(_0x39a41a,_0x521c23){return _0x39a41a['define'](_0xf23d('0x9'),attributes,{'tableName':_0xf23d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf23d('0xb'),'collate':_0xf23d('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index ddafdf0..e297087 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 _0xc431=['request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register'];(function(_0x26d4be,_0x28dae9){var _0x3c9511=function(_0x44d2c1){while(--_0x44d2c1){_0x26d4be['push'](_0x26d4be['shift']());}};_0x3c9511(++_0x28dae9);}(_0xc431,0x15c));var _0x1c43=function(_0x3b8cc5,_0x4d223f){_0x3b8cc5=_0x3b8cc5-0x0;var _0x2be3bd=_0xc431[_0x3b8cc5];return _0x2be3bd;};'use strict';var _=require(_0x1c43('0x0'));var util=require(_0x1c43('0x1'));var moment=require(_0x1c43('0x2'));var BPromise=require(_0x1c43('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c43('0x5'));var logger=require(_0x1c43('0x6'))(_0x1c43('0x7'));var config=require('../../config/environment');var jayson=require(_0x1c43('0x8'));var client=jayson[_0x1c43('0x9')][_0x1c43('0xa')]({'port':0x232a});config[_0x1c43('0xb')]=_[_0x1c43('0xc')](config[_0x1c43('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1c43('0xd'))(new Redis(config[_0x1c43('0xb')]));require(_0x1c43('0xe'))[_0x1c43('0xf')](socket);function respondWithRpcPromise(_0x5a5a7d,_0x34de85,_0x23c79f){return new BPromise(function(_0x409cf3,_0x1d0c4b){return client[_0x1c43('0x10')](_0x5a5a7d,_0x23c79f)[_0x1c43('0x11')](function(_0x58bea3){logger['info'](_0x1c43('0x12'),_0x34de85,_0x1c43('0x13'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x34de85,_0x1c43('0x13'),JSON[_0x1c43('0x14')](_0x58bea3));if(_0x58bea3[_0x1c43('0x15')]){if(_0x58bea3[_0x1c43('0x15')][_0x1c43('0x16')]===0x1f4){logger['error'](_0x1c43('0x12'),_0x34de85,_0x58bea3[_0x1c43('0x15')]['message']);return _0x1d0c4b(_0x58bea3[_0x1c43('0x15')][_0x1c43('0x17')]);}logger['error'](_0x1c43('0x12'),_0x34de85,_0x58bea3['error']['message']);return _0x409cf3(_0x58bea3[_0x1c43('0x15')]['message']);}else{logger[_0x1c43('0x18')](_0x1c43('0x12'),_0x34de85,_0x1c43('0x13'));_0x409cf3(_0x58bea3['result']['message']);}})[_0x1c43('0x19')](function(_0x54341f){logger[_0x1c43('0x15')](_0x1c43('0x12'),_0x34de85,_0x54341f);_0x1d0c4b(_0x54341f);});});} \ No newline at end of file +var _0x5267=['client','http','redis','defaults','localhost','register','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x42e3d9,_0x17b0c3){var _0x53c442=function(_0x2df7b7){while(--_0x2df7b7){_0x42e3d9['push'](_0x42e3d9['shift']());}};_0x53c442(++_0x17b0c3);}(_0x5267,0x1f0));var _0x7526=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5267[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7526('0x0'));var util=require('util');var moment=require(_0x7526('0x1'));var BPromise=require(_0x7526('0x2'));var rs=require(_0x7526('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7526('0x4'))['db'];var utils=require(_0x7526('0x5'));var logger=require('../../config/logger')(_0x7526('0x6'));var config=require(_0x7526('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7526('0x8')][_0x7526('0x9')]({'port':0x232a});config[_0x7526('0xa')]=_[_0x7526('0xb')](config[_0x7526('0xa')],{'host':_0x7526('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7526('0xa')]));require('./chatInternalMessage.socket')[_0x7526('0xd')](socket);function respondWithRpcPromise(_0x2d8f30,_0x46f666,_0x33500c){return new BPromise(function(_0x28e843,_0x22a783){return client['request'](_0x2d8f30,_0x33500c)['then'](function(_0x65f35b){logger[_0x7526('0xe')](_0x7526('0xf'),_0x46f666,_0x7526('0x10'));logger[_0x7526('0x11')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x46f666,_0x7526('0x10'),JSON['stringify'](_0x65f35b));if(_0x65f35b[_0x7526('0x12')]){if(_0x65f35b['error']['code']===0x1f4){logger[_0x7526('0x12')](_0x7526('0xf'),_0x46f666,_0x65f35b[_0x7526('0x12')][_0x7526('0x13')]);return _0x22a783(_0x65f35b['error']['message']);}logger[_0x7526('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x46f666,_0x65f35b[_0x7526('0x12')][_0x7526('0x13')]);return _0x28e843(_0x65f35b[_0x7526('0x12')][_0x7526('0x13')]);}else{logger[_0x7526('0xe')](_0x7526('0xf'),_0x46f666,_0x7526('0x10'));_0x28e843(_0x65f35b['result'][_0x7526('0x13')]);}})[_0x7526('0x14')](function(_0xdf7e20){logger[_0x7526('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x46f666,_0xdf7e20);_0x22a783(_0xdf7e20);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 73c9e53..3471103 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 _0x8a98=['save','remove','update','emit','removeListener','register','length','chatInternalMessage:'];(function(_0x5c547f,_0x148789){var _0x5206e7=function(_0xa75e56){while(--_0xa75e56){_0x5c547f['push'](_0x5c547f['shift']());}};_0x5206e7(++_0x148789);}(_0x8a98,0x1b0));var _0x88a9=function(_0xeb80c9,_0x3fe888){_0xeb80c9=_0xeb80c9-0x0;var _0x259c37=_0x8a98[_0xeb80c9];return _0x259c37;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x88a9('0x0'),_0x88a9('0x1'),_0x88a9('0x2')];function createListener(_0x521228,_0xe35f3e){return function(_0x93ccc){_0xe35f3e[_0x88a9('0x3')](_0x521228,_0x93ccc);};}function removeListener(_0x516a64,_0x1a8322){return function(){ChatInternalMessageEvents[_0x88a9('0x4')](_0x516a64,_0x1a8322);};}exports[_0x88a9('0x5')]=function(_0xf83ce7){for(var _0x556572=0x0,_0x31b3a3=events[_0x88a9('0x6')];_0x556572<_0x31b3a3;_0x556572++){var _0x4beac4=events[_0x556572];var _0x389952=createListener(_0x88a9('0x7')+_0x4beac4,_0xf83ce7);ChatInternalMessageEvents['on'](_0x4beac4,_0x389952);}}; \ No newline at end of file +var _0x7673=['remove','update','emit','register','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x261287,_0x11f4af){var _0x2088f1=function(_0x169cc4){while(--_0x169cc4){_0x261287['push'](_0x261287['shift']());}};_0x2088f1(++_0x11f4af);}(_0x7673,0x186));var _0x3767=function(_0x49b73b,_0x49456b){_0x49b73b=_0x49b73b-0x0;var _0x391e11=_0x7673[_0x49b73b];return _0x391e11;};'use strict';var ChatInternalMessageEvents=require(_0x3767('0x0'));var events=[_0x3767('0x1'),_0x3767('0x2'),_0x3767('0x3')];function createListener(_0x566fdd,_0x39f7ea){return function(_0x509148){_0x39f7ea[_0x3767('0x4')](_0x566fdd,_0x509148);};}function removeListener(_0x28afb6,_0x239db6){return function(){ChatInternalMessageEvents['removeListener'](_0x28afb6,_0x239db6);};}exports[_0x3767('0x5')]=function(_0x345854){for(var _0x108aa1=0x0,_0x8aea93=events['length'];_0x108aa1<_0x8aea93;_0x108aa1++){var _0x4d6b2b=events[_0x108aa1];var _0x1b2877=createListener(_0x3767('0x6')+_0x4d6b2b,_0x345854);ChatInternalMessageEvents['on'](_0x4d6b2b,_0x1b2877);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 4e4bbfd..8bc9fdf 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 _0xe6c1=['express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','getUsers','/:id','show','post','update','delete','exports','multer','util'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0xe6c1,0x1da));var _0x1e6c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe6c1[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x1e6c('0x0'));var util=require(_0x1e6c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1e6c('0x2'));var router=express['Router']();var fs_extra=require(_0x1e6c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1e6c('0x4'));var config=require(_0x1e6c('0x5'));var controller=require('./chatInternalMessage.controller');router[_0x1e6c('0x6')]('/',auth[_0x1e6c('0x7')](),controller[_0x1e6c('0x8')]);router[_0x1e6c('0x6')](_0x1e6c('0x9'),auth[_0x1e6c('0x7')](),controller['describe']);router['get']('/users',auth[_0x1e6c('0x7')](),controller[_0x1e6c('0xa')]);router[_0x1e6c('0x6')](_0x1e6c('0xb'),auth[_0x1e6c('0x7')](),controller[_0x1e6c('0xc')]);router[_0x1e6c('0xd')]('/',auth[_0x1e6c('0x7')](),controller['create']);router['put']('/:id',controller[_0x1e6c('0xe')]);router[_0x1e6c('0xf')](_0x1e6c('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1e6c('0x10')]=router; \ No newline at end of file +var _0xd14b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','index','get','/describe','isAuthenticated','describe','/users','getUsers','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x2c4373,_0x462dc7){var _0x421542=function(_0x14dd6d){while(--_0x14dd6d){_0x2c4373['push'](_0x2c4373['shift']());}};_0x421542(++_0x462dc7);}(_0xd14b,0x1b7));var _0xbd14=function(_0x4e61bc,_0x1cff51){_0x4e61bc=_0x4e61bc-0x0;var _0x4e0fb1=_0xd14b[_0x4e61bc];return _0x4e0fb1;};'use strict';var multer=require(_0xbd14('0x0'));var util=require(_0xbd14('0x1'));var path=require(_0xbd14('0x2'));var timeout=require(_0xbd14('0x3'));var express=require(_0xbd14('0x4'));var router=express[_0xbd14('0x5')]();var fs_extra=require(_0xbd14('0x6'));var auth=require(_0xbd14('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbd14('0x8'));var controller=require(_0xbd14('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xbd14('0xa')]);router[_0xbd14('0xb')](_0xbd14('0xc'),auth[_0xbd14('0xd')](),controller[_0xbd14('0xe')]);router[_0xbd14('0xb')](_0xbd14('0xf'),auth[_0xbd14('0xd')](),controller[_0xbd14('0x10')]);router[_0xbd14('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xbd14('0x11')]);router[_0xbd14('0x12')]('/',auth['isAuthenticated'](),controller[_0xbd14('0x13')]);router[_0xbd14('0x14')](_0xbd14('0x15'),controller[_0xbd14('0x16')]);router[_0xbd14('0x17')](_0xbd14('0x15'),auth[_0xbd14('0xd')](),controller[_0xbd14('0x18')]);module[_0xbd14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 6b9de2f..96ffd46 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 _0xabad=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x5c60e0,_0x2b3ade){var _0x23eb8b=function(_0x5eded0){while(--_0x5eded0){_0x5c60e0['push'](_0x5c60e0['shift']());}};_0x23eb8b(++_0x2b3ade);}(_0xabad,0x150));var _0xdaba=function(_0x1e1dea,_0x16fe92){_0x1e1dea=_0x1e1dea-0x0;var _0x360ed7=_0xabad[_0x1e1dea];return _0x360ed7;};'use strict';var Sequelize=require(_0xdaba('0x0'));module['exports']={'body':{'type':Sequelize[_0xdaba('0x1')](_0xdaba('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdaba('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xdaba('0x4')]('in',_0xdaba('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xdaba('0x6')]},'providerName':{'type':Sequelize[_0xdaba('0x7')]},'providerResponse':{'type':Sequelize[_0xdaba('0x1')]}}; \ No newline at end of file +var _0x0b0e=['TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x35f83e,_0x30ec55){var _0x249b05=function(_0x2c2fcc){while(--_0x2c2fcc){_0x35f83e['push'](_0x35f83e['shift']());}};_0x249b05(++_0x30ec55);}(_0x0b0e,0x187));var _0xe0b0=function(_0x47878f,_0x48d3bf){_0x47878f=_0x47878f-0x0;var _0x4b05b8=_0x0b0e[_0x47878f];return _0x4b05b8;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe0b0('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe0b0('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe0b0('0x3')]('in',_0xe0b0('0x4')),'defaultValue':_0xe0b0('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe0b0('0x5')]},'providerName':{'type':Sequelize[_0xe0b0('0x6')]},'providerResponse':{'type':Sequelize[_0xe0b0('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 0230a38..6c8c51f 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 _0x7a19=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','stack','name','send','index','map','ChatMessage','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','show','params','rawAttributes','include','create','body','find','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','read1stAt','interaction','[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','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','email','internal','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x4de5d8,_0x17fbc5){var _0x299c30=function(_0x11865b){while(--_0x11865b){_0x4de5d8['push'](_0x4de5d8['shift']());}};_0x299c30(++_0x17fbc5);}(_0x7a19,0x102));var _0x97a1=function(_0x1fd76e,_0x4a8e7){_0x1fd76e=_0x1fd76e-0x0;var _0x4b6faf=_0x7a19[_0x1fd76e];return _0x4b6faf;};'use strict';var emlformat=require(_0x97a1('0x0'));var rimraf=require(_0x97a1('0x1'));var zipdir=require(_0x97a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x97a1('0x3'));var BPromise=require(_0x97a1('0x4'));var Mustache=require(_0x97a1('0x5'));var util=require(_0x97a1('0x6'));var path=require(_0x97a1('0x7'));var sox=require(_0x97a1('0x8'));var csv=require(_0x97a1('0x9'));var ejs=require(_0x97a1('0xa'));var fs=require('fs');var fs_extra=require(_0x97a1('0xb'));var _=require(_0x97a1('0xc'));var squel=require(_0x97a1('0xd'));var crypto=require(_0x97a1('0xe'));var jsforce=require(_0x97a1('0xf'));var deskjs=require(_0x97a1('0x10'));var toCsv=require(_0x97a1('0x9'));var querystring=require(_0x97a1('0x11'));var Papa=require(_0x97a1('0x12'));var Redis=require('ioredis');var authService=require(_0x97a1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x97a1('0x14'));var hardwareService=require(_0x97a1('0x15'));var logger=require(_0x97a1('0x16'))(_0x97a1('0x17'));var utils=require(_0x97a1('0x18'));var config=require(_0x97a1('0x19'));var licenseUtil=require(_0x97a1('0x1a'));var db=require(_0x97a1('0x1b'))['db'];config[_0x97a1('0x1c')]=_[_0x97a1('0x1d')](config[_0x97a1('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x97a1('0x1e'))(new Redis(config[_0x97a1('0x1c')]));require(_0x97a1('0x1f'))[_0x97a1('0x20')](socket);var jayson=require(_0x97a1('0x21'));var client=jayson[_0x97a1('0x22')][_0x97a1('0x23')]({'port':0x232c});var client9002=jayson['client'][_0x97a1('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x62fd25,_0x251255,_0x5a285e,_0x3ba962){return new BPromise(function(_0x792a93,_0x4e2985){var _0x3a5a9b=_0x3ba962||client;return _0x3a5a9b[_0x97a1('0x24')](_0x62fd25,_0x5a285e)[_0x97a1('0x25')](function(_0x2334ed){logger[_0x97a1('0x26')]('ChatMessage,\x20%s,\x20%s',_0x251255,'request\x20sent');logger['debug'](_0x97a1('0x27'),_0x251255,'request\x20sent',JSON[_0x97a1('0x28')](_0x2334ed));if(_0x2334ed['error']){if(_0x2334ed[_0x97a1('0x29')][_0x97a1('0x2a')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x251255,_0x2334ed[_0x97a1('0x29')][_0x97a1('0x2b')]);return _0x4e2985(_0x2334ed[_0x97a1('0x29')][_0x97a1('0x2b')]);}logger['error'](_0x97a1('0x2c'),_0x251255,_0x2334ed[_0x97a1('0x29')][_0x97a1('0x2b')]);return _0x792a93(_0x2334ed[_0x97a1('0x29')][_0x97a1('0x2b')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x251255,_0x97a1('0x2d'));_0x792a93(_0x2334ed[_0x97a1('0x2e')][_0x97a1('0x2b')]);}})[_0x97a1('0x2f')](function(_0x7991df){logger[_0x97a1('0x29')](_0x97a1('0x2c'),_0x251255,_0x7991df);_0x4e2985(_0x7991df);});});}function respondWithStatusCode(_0x56cc88,_0x25ca25){_0x25ca25=_0x25ca25||0xcc;return function(_0x43a880){if(_0x43a880){return _0x56cc88[_0x97a1('0x30')](_0x25ca25);}return _0x56cc88[_0x97a1('0x31')](_0x25ca25)[_0x97a1('0x32')]();};}function respondWithResult(_0x1db3eb,_0x410c36){_0x410c36=_0x410c36||0xc8;return function(_0x47b72d){if(_0x47b72d){return _0x1db3eb[_0x97a1('0x31')](_0x410c36)[_0x97a1('0x33')](_0x47b72d);}};}function respondWithFilteredResult(_0x57f0b6,_0x15c44e){return function(_0x4da5fc){if(_0x4da5fc){var _0x3cfecd=typeof _0x15c44e[_0x97a1('0x34')]===_0x97a1('0x35')&&typeof _0x15c44e[_0x97a1('0x36')]===_0x97a1('0x35');var _0x216f27=_0x4da5fc[_0x97a1('0x37')];var _0x1f69f3=_0x3cfecd?0x0:_0x15c44e['offset'];var _0x189fca=_0x3cfecd?_0x4da5fc[_0x97a1('0x37')]:_0x15c44e['offset']+_0x15c44e[_0x97a1('0x36')];var _0x5cb998;if(_0x189fca>=_0x216f27){_0x189fca=_0x216f27;_0x5cb998=0xc8;}else{_0x5cb998=0xce;}_0x57f0b6['status'](_0x5cb998);return _0x57f0b6[_0x97a1('0x38')]('Content-Range',_0x1f69f3+'-'+_0x189fca+'/'+_0x216f27)[_0x97a1('0x33')](_0x4da5fc);}return null;};}function patchUpdates(_0x1e126e){return function(_0x549822){try{jsonpatch['apply'](_0x549822,_0x1e126e,!![]);}catch(_0x2cdd9c){return BPromise[_0x97a1('0x39')](_0x2cdd9c);}return _0x549822[_0x97a1('0x3a')]();};}function saveUpdates(_0x189087,_0x14541d){return function(_0x2c5cd1){if(_0x2c5cd1){return _0x2c5cd1[_0x97a1('0x3b')](_0x189087)[_0x97a1('0x25')](function(_0x105a76){return _0x105a76;});}return null;};}function removeEntity(_0x1ab607,_0x20d67f){return function(_0x559a63){if(_0x559a63){return _0x559a63[_0x97a1('0x3c')]()[_0x97a1('0x25')](function(){_0x1ab607[_0x97a1('0x31')](0xcc)[_0x97a1('0x32')]();});}};}function handleEntityNotFound(_0x20e901,_0x3b9278){return function(_0x18b5b0){if(!_0x18b5b0){_0x20e901[_0x97a1('0x30')](0x194);}return _0x18b5b0;};}function handleError(_0xc982,_0x3a5aa1){_0x3a5aa1=_0x3a5aa1||0x1f4;return function(_0x3de90a){logger[_0x97a1('0x29')](_0x3de90a[_0x97a1('0x3d')]);if(_0x3de90a[_0x97a1('0x3e')]){delete _0x3de90a[_0x97a1('0x3e')];}_0xc982[_0x97a1('0x31')](_0x3a5aa1)[_0x97a1('0x3f')](_0x3de90a);};}exports[_0x97a1('0x40')]=function(_0x2467f6,_0x3f2eed){var _0xfd03a6={},_0x22891b={},_0x1b9536={'count':0x0,'rows':[]};var _0x31a784=_[_0x97a1('0x41')](db[_0x97a1('0x42')]['rawAttributes'],function(_0x3a6bc7){return{'name':_0x3a6bc7[_0x97a1('0x43')],'type':_0x3a6bc7[_0x97a1('0x44')][_0x97a1('0x45')]};});_0x22891b[_0x97a1('0x46')]=_['map'](_0x31a784,'name');_0x22891b['query']=_[_0x97a1('0x47')](_0x2467f6[_0x97a1('0x48')]);_0x22891b[_0x97a1('0x49')]=_[_0x97a1('0x4a')](_0x22891b[_0x97a1('0x46')],_0x22891b['query']);_0xfd03a6[_0x97a1('0x4b')]=_[_0x97a1('0x4a')](_0x22891b[_0x97a1('0x46')],qs[_0x97a1('0x4c')](_0x2467f6[_0x97a1('0x48')]['fields']));_0xfd03a6[_0x97a1('0x4b')]=_0xfd03a6['attributes'][_0x97a1('0x4d')]?_0xfd03a6[_0x97a1('0x4b')]:_0x22891b[_0x97a1('0x46')];if(!_0x2467f6[_0x97a1('0x48')][_0x97a1('0x4e')](_0x97a1('0x4f'))){_0xfd03a6[_0x97a1('0x36')]=qs[_0x97a1('0x36')](_0x2467f6[_0x97a1('0x48')][_0x97a1('0x36')]);_0xfd03a6[_0x97a1('0x34')]=qs[_0x97a1('0x34')](_0x2467f6[_0x97a1('0x48')][_0x97a1('0x34')]);}_0xfd03a6['order']=qs[_0x97a1('0x50')](_0x2467f6[_0x97a1('0x48')][_0x97a1('0x50')]);_0xfd03a6[_0x97a1('0x51')]=qs[_0x97a1('0x49')](_[_0x97a1('0x52')](_0x2467f6[_0x97a1('0x48')],_0x22891b[_0x97a1('0x49')]),_0x31a784);if(_0x2467f6[_0x97a1('0x48')]['filter']){_0xfd03a6[_0x97a1('0x51')]=_[_0x97a1('0x53')](_0xfd03a6[_0x97a1('0x51')],{'$or':_[_0x97a1('0x41')](_0x31a784,function(_0x204381){if(_0x204381['type']!==_0x97a1('0x54')){var _0x152f34={};_0x152f34[_0x204381['name']]={'$like':'%'+_0x2467f6[_0x97a1('0x48')][_0x97a1('0x55')]+'%'};return _0x152f34;}})});}_0xfd03a6=_['merge']({},_0xfd03a6,_0x2467f6[_0x97a1('0x56')]);var _0x60c6e9={'where':_0xfd03a6[_0x97a1('0x51')]};return db[_0x97a1('0x42')][_0x97a1('0x37')](_0x60c6e9)[_0x97a1('0x25')](function(_0x34ae33){_0x1b9536[_0x97a1('0x37')]=_0x34ae33;if(_0x2467f6['query'][_0x97a1('0x57')]){_0xfd03a6['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0xfd03a6);})[_0x97a1('0x25')](function(_0x1a8888){_0x1b9536[_0x97a1('0x58')]=_0x1a8888;return _0x1b9536;})[_0x97a1('0x25')](respondWithFilteredResult(_0x3f2eed,_0xfd03a6))[_0x97a1('0x2f')](handleError(_0x3f2eed,null));};exports[_0x97a1('0x59')]=function(_0x3b3f63,_0x5daac6){var _0x4567f4={'raw':!![],'where':{'id':_0x3b3f63[_0x97a1('0x5a')]['id']}},_0x268dfc={};_0x268dfc[_0x97a1('0x46')]=_[_0x97a1('0x47')](db[_0x97a1('0x42')][_0x97a1('0x5b')]);_0x268dfc[_0x97a1('0x48')]=_['keys'](_0x3b3f63[_0x97a1('0x48')]);_0x268dfc[_0x97a1('0x49')]=_[_0x97a1('0x4a')](_0x268dfc['model'],_0x268dfc[_0x97a1('0x48')]);_0x4567f4['attributes']=_['intersection'](_0x268dfc['model'],qs[_0x97a1('0x4c')](_0x3b3f63[_0x97a1('0x48')][_0x97a1('0x4c')]));_0x4567f4[_0x97a1('0x4b')]=_0x4567f4['attributes'][_0x97a1('0x4d')]?_0x4567f4[_0x97a1('0x4b')]:_0x268dfc['model'];if(_0x3b3f63[_0x97a1('0x48')][_0x97a1('0x57')]){_0x4567f4[_0x97a1('0x5c')]=[{'all':!![]}];}_0x4567f4=_['merge']({},_0x4567f4,_0x3b3f63[_0x97a1('0x56')]);return db[_0x97a1('0x42')]['find'](_0x4567f4)[_0x97a1('0x25')](handleEntityNotFound(_0x5daac6,null))['then'](respondWithResult(_0x5daac6,null))[_0x97a1('0x2f')](handleError(_0x5daac6,null));};exports[_0x97a1('0x5d')]=function(_0x1a172c,_0x16d13b){return db[_0x97a1('0x42')][_0x97a1('0x5d')](_0x1a172c['body'],{})[_0x97a1('0x25')](respondWithResult(_0x16d13b,0xc9))['catch'](handleError(_0x16d13b,null));};exports[_0x97a1('0x3b')]=function(_0x1c18fd,_0xb5536c){if(_0x1c18fd['body']['id']){delete _0x1c18fd[_0x97a1('0x5e')]['id'];}return db['ChatMessage'][_0x97a1('0x5f')]({'where':{'id':_0x1c18fd[_0x97a1('0x5a')]['id']}})['then'](handleEntityNotFound(_0xb5536c,null))[_0x97a1('0x25')](saveUpdates(_0x1c18fd[_0x97a1('0x5e')],null))[_0x97a1('0x25')](respondWithResult(_0xb5536c,null))['catch'](handleError(_0xb5536c,null));};exports['destroy']=function(_0x463586,_0x31cf0d){return db[_0x97a1('0x42')][_0x97a1('0x5f')]({'where':{'id':_0x463586['params']['id']}})[_0x97a1('0x25')](handleEntityNotFound(_0x31cf0d,null))['then'](removeEntity(_0x31cf0d,null))[_0x97a1('0x2f')](handleError(_0x31cf0d,null));};exports[_0x97a1('0x60')]=function(_0x2c77b9,_0x2d4bc5){return db[_0x97a1('0x42')][_0x97a1('0x60')]()[_0x97a1('0x25')](respondWithResult(_0x2d4bc5,null))[_0x97a1('0x2f')](handleError(_0x2d4bc5,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x97a1('0x61')]=function(_0x4bc0bd,_0x46b2a0,_0x4c2cae){var _0x3887db={'agent':{},'channel':_0x97a1('0x62')};if(_0x4bc0bd['body']['id']){delete _0x4bc0bd[_0x97a1('0x5e')]['id'];}_0x4bc0bd[_0x97a1('0x5e')][_0x97a1('0x63')]=!![];_0x4bc0bd['body'][_0x97a1('0x64')]=moment()[_0x97a1('0x65')](_0x97a1('0x66'));_0x4bc0bd[_0x97a1('0x5e')]['UserId']=_0x4bc0bd['body'][_0x97a1('0x67')]||_0x4bc0bd[_0x97a1('0x68')]['id'];_0x3887db[_0x97a1('0x69')]['id']=_0x4bc0bd[_0x97a1('0x5e')]['UserId'];return db[_0x97a1('0x42')]['find']({'where':{'id':_0x4bc0bd[_0x97a1('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x46b2a0,null))['then'](saveUpdates(_0x4bc0bd[_0x97a1('0x5e')],null))['then'](function(_0x385ac5){if(_0x385ac5){_0x3887db[_0x97a1('0x2b')]=_0x385ac5[_0x97a1('0x6a')]({'plain':!![]});return db['ChatInteraction'][_0x97a1('0x5f')]({'where':{'id':_0x385ac5['ChatInteractionId']}});}return null;})[_0x97a1('0x25')](handleEntityNotFound(_0x46b2a0,null))[_0x97a1('0x25')](function(_0x15251f){if(_0x15251f){return _0x15251f['update']({'UserId':_0x4bc0bd[_0x97a1('0x5e')]['UserId'],'read1stAt':_['isNil'](_0x15251f[_0x97a1('0x6b')])?moment()[_0x97a1('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x36f239){if(_0x36f239){_0x3887db[_0x97a1('0x6c')]=_0x36f239[_0x97a1('0x6a')]({'plain':!![]});interaction_log['info'](_0x97a1('0x6d'),_0x4bc0bd[_0x97a1('0x68')]['id'],_0x4bc0bd[_0x97a1('0x68')][_0x97a1('0x3e')],_0x4bc0bd[_0x97a1('0x68')][_0x97a1('0x6e')],_0x3887db[_0x97a1('0x6c')]['id'],_0x4bc0bd['body']?JSON[_0x97a1('0x28')](_0x4bc0bd[_0x97a1('0x5e')]):_0x97a1('0x6f'));return respondWithRpcPromise(_0x97a1('0x70'),_0x97a1('0x71'),_0x3887db);}return null;})[_0x97a1('0x25')](function(_0x3cc81e){var _0x284a6f=_0x97a1('0x72')+_0x3cc81e[_0x97a1('0x2b')][_0x97a1('0x73')];return db[_0x97a1('0x74')][_0x97a1('0x48')](_0x284a6f,{'type':db['Sequelize'][_0x97a1('0x75')][_0x97a1('0x76')],'raw':!![]})[_0x97a1('0x25')](function(_0x1f1916){return _0x1f1916;});})[_0x97a1('0x25')](function(_0x304e3e){if(_0x304e3e){_0x3887db[_0x97a1('0x2b')][_0x97a1('0x77')]=_0x304e3e[0x0];if(!_0x4bc0bd[_0x97a1('0x5e')][_0x97a1('0x67')])return;return db[_0x97a1('0x78')][_0x97a1('0x5f')]({'where':{'id':_0x4bc0bd['body'][_0x97a1('0x67')],'role':_0x97a1('0x69')},'attributes':['id',_0x97a1('0x3e'),_0x97a1('0x79'),'email','internal'],'raw':!![]});}return null;})[_0x97a1('0x25')](function(_0x56bf7f){if(!_0x56bf7f)return null;_0x3887db[_0x97a1('0x2b')][_0x97a1('0x69')]=_0x56bf7f;return _0x3887db;})['then'](function(_0x552320){if(_0x552320){if(_0x4bc0bd['body'][_0x97a1('0x7a')]){_0x3887db[_0x97a1('0x2b')][_0x97a1('0x7b')]=util[_0x97a1('0x65')](_0x97a1('0x7c'),_0x4bc0bd[_0x97a1('0x68')][_0x97a1('0x3e')]);_0x3887db['message'][_0x97a1('0x7d')]=_0x3887db[_0x97a1('0x7d')];_0x3887db['message'][_0x97a1('0x7e')]=_0x3887db[_0x97a1('0x7d')];_0x3887db[_0x97a1('0x2b')][_0x97a1('0x7f')]=_0x97a1('0x61');return respondWithRpcPromise(_0x97a1('0x80'),'EventManager',{'event':'acceptmessage','message':_[_0x97a1('0x53')](_0x3887db[_0x97a1('0x2b')],JSON[_0x97a1('0x81')](_0x3887db[_0x97a1('0x6c')][_0x97a1('0x82')]))},client9002)[_0x97a1('0x25')](function(){return _0x3887db;});}return _0x3887db;}return null;})['then'](respondWithResult(_0x46b2a0,null))[_0x97a1('0x2f')](handleError(_0x46b2a0,null));};var interaction_log=require(_0x97a1('0x16'))('chat-interactions');exports[_0x97a1('0x39')]=function(_0x1d2608,_0x2b2448,_0x30e494){var _0x402145={'agent':{},'channel':_0x97a1('0x62')};if(_0x1d2608[_0x97a1('0x5e')]['id']){delete _0x1d2608[_0x97a1('0x5e')]['id'];}_0x1d2608[_0x97a1('0x5e')][_0x97a1('0x67')]=_0x1d2608[_0x97a1('0x5e')]['UserId']||_0x1d2608[_0x97a1('0x68')]['id'];_0x402145[_0x97a1('0x69')]['id']=_0x1d2608[_0x97a1('0x5e')]['UserId'];return db['ChatMessage'][_0x97a1('0x5f')]({'where':{'id':_0x1d2608[_0x97a1('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b2448,null))[_0x97a1('0x25')](function(_0x1710ec){if(_0x1710ec){_0x402145[_0x97a1('0x2b')]=_0x1710ec[_0x97a1('0x6a')]({'plain':!![]});return db[_0x97a1('0x83')]['find']({'where':{'id':_0x1710ec[_0x97a1('0x84')]}});}return null;})[_0x97a1('0x25')](handleEntityNotFound(_0x2b2448,null))[_0x97a1('0x25')](function(_0x24e932){if(_0x24e932){_0x402145[_0x97a1('0x6c')]=_0x24e932[_0x97a1('0x6a')]({'plain':!![]});interaction_log[_0x97a1('0x26')](_0x97a1('0x85'),_0x1d2608[_0x97a1('0x68')]['id'],_0x1d2608['user']['name'],_0x1d2608[_0x97a1('0x68')][_0x97a1('0x6e')],_0x402145[_0x97a1('0x6c')]['id'],_0x1d2608[_0x97a1('0x5e')]?JSON[_0x97a1('0x28')](_0x1d2608[_0x97a1('0x5e')]):'null');return respondWithRpcPromise(_0x97a1('0x86'),_0x97a1('0x87'),_0x402145);}return null;})[_0x97a1('0x25')](function(_0x1e8a8b){var _0x3669a3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1e8a8b[_0x97a1('0x2b')][_0x97a1('0x73')];return db['sequelize'][_0x97a1('0x48')](_0x3669a3,{'type':db[_0x97a1('0x88')][_0x97a1('0x75')][_0x97a1('0x76')],'raw':!![]})[_0x97a1('0x25')](function(_0x55089b){return _0x55089b;});})[_0x97a1('0x25')](function(_0x8e1ea0){if(_0x8e1ea0){_0x402145['message'][_0x97a1('0x77')]=_0x8e1ea0[0x0];if(!_0x1d2608[_0x97a1('0x5e')][_0x97a1('0x67')])return;return db[_0x97a1('0x78')][_0x97a1('0x5f')]({'where':{'id':_0x1d2608[_0x97a1('0x5e')]['UserId'],'role':'agent'},'attributes':['id',_0x97a1('0x3e'),_0x97a1('0x79'),_0x97a1('0x89'),_0x97a1('0x8a')],'raw':!![]});}return null;})[_0x97a1('0x25')](function(_0x2bdbb1){if(!_0x2bdbb1)return null;_0x402145[_0x97a1('0x2b')][_0x97a1('0x69')]=_0x2bdbb1;return _0x402145;})[_0x97a1('0x25')](function(_0x416859){if(_0x416859){_0x416859[_0x97a1('0x2b')][_0x97a1('0x7b')]=util[_0x97a1('0x65')](_0x97a1('0x7c'),_0x1d2608[_0x97a1('0x68')][_0x97a1('0x3e')]);_0x416859['message'][_0x97a1('0x7d')]=_0x402145['channel'];_0x416859[_0x97a1('0x2b')][_0x97a1('0x7e')]=_0x402145[_0x97a1('0x7d')];_0x416859[_0x97a1('0x2b')][_0x97a1('0x7f')]=_0x97a1('0x39');respondWithRpcPromise(_0x97a1('0x80'),'EventManager',{'event':'rejectmessage','message':_[_0x97a1('0x53')](_0x402145['message'],JSON[_0x97a1('0x81')](_0x402145[_0x97a1('0x6c')][_0x97a1('0x82')]))},client9002);return _0x402145;}return null;})[_0x97a1('0x25')](respondWithResult(_0x2b2448,null))[_0x97a1('0x2f')](handleError(_0x2b2448,null));}; \ No newline at end of file +var _0xb160=['show','params','length','find','create','body','describe','../../config/logger','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','isNil','read1stAt','get','[CHATMESSAGE: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','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','interface','SIP/%s','channel','motionChannel','acceptmessage','parse','formData','reject','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','contact','email','EventManager','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','destroy','stack','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','name','options','ChatMessage','includeAll','include','findAll','rows'];(function(_0x5e2a2b,_0x25abe0){var _0x326d1c=function(_0xf77a58){while(--_0xf77a58){_0x5e2a2b['push'](_0x5e2a2b['shift']());}};_0x326d1c(++_0x25abe0);}(_0xb160,0xb3));var _0x0b16=function(_0x43ed8e,_0x4bdd98){_0x43ed8e=_0x43ed8e-0x0;var _0x291e45=_0xb160[_0x43ed8e];return _0x291e45;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b16('0x0'));var zipdir=require(_0x0b16('0x1'));var jsonpatch=require(_0x0b16('0x2'));var rp=require(_0x0b16('0x3'));var moment=require(_0x0b16('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0b16('0x5'));var util=require('util');var path=require(_0x0b16('0x6'));var sox=require(_0x0b16('0x7'));var csv=require(_0x0b16('0x8'));var ejs=require(_0x0b16('0x9'));var fs=require('fs');var fs_extra=require(_0x0b16('0xa'));var _=require(_0x0b16('0xb'));var squel=require(_0x0b16('0xc'));var crypto=require(_0x0b16('0xd'));var jsforce=require(_0x0b16('0xe'));var deskjs=require(_0x0b16('0xf'));var toCsv=require(_0x0b16('0x8'));var querystring=require(_0x0b16('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0b16('0x11'));var qs=require(_0x0b16('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b16('0x13'));var logger=require('../../config/logger')(_0x0b16('0x14'));var utils=require(_0x0b16('0x15'));var config=require(_0x0b16('0x16'));var licenseUtil=require(_0x0b16('0x17'));var db=require('../../mysqldb')['db'];config[_0x0b16('0x18')]=_['defaults'](config[_0x0b16('0x18')],{'host':_0x0b16('0x19'),'port':0x18eb});var socket=require(_0x0b16('0x1a'))(new Redis(config[_0x0b16('0x18')]));require('./chatMessage.socket')[_0x0b16('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0b16('0x1c')][_0x0b16('0x1d')]({'port':0x232c});var client9002=jayson[_0x0b16('0x1c')][_0x0b16('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x216016,_0x2aa868,_0x59d2b7,_0x5f4819){return new BPromise(function(_0x2b2615,_0x226790){var _0x2d2364=_0x5f4819||client;return _0x2d2364[_0x0b16('0x1e')](_0x216016,_0x59d2b7)[_0x0b16('0x1f')](function(_0xe490fc){logger[_0x0b16('0x20')](_0x0b16('0x21'),_0x2aa868,_0x0b16('0x22'));logger[_0x0b16('0x23')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2aa868,_0x0b16('0x22'),JSON[_0x0b16('0x24')](_0xe490fc));if(_0xe490fc[_0x0b16('0x25')]){if(_0xe490fc[_0x0b16('0x25')][_0x0b16('0x26')]===0x1f4){logger[_0x0b16('0x25')](_0x0b16('0x21'),_0x2aa868,_0xe490fc[_0x0b16('0x25')][_0x0b16('0x27')]);return _0x226790(_0xe490fc[_0x0b16('0x25')][_0x0b16('0x27')]);}logger[_0x0b16('0x25')](_0x0b16('0x21'),_0x2aa868,_0xe490fc[_0x0b16('0x25')][_0x0b16('0x27')]);return _0x2b2615(_0xe490fc[_0x0b16('0x25')][_0x0b16('0x27')]);}else{logger['info'](_0x0b16('0x21'),_0x2aa868,'request\x20sent');_0x2b2615(_0xe490fc[_0x0b16('0x28')][_0x0b16('0x27')]);}})[_0x0b16('0x29')](function(_0x64b632){logger[_0x0b16('0x25')](_0x0b16('0x21'),_0x2aa868,_0x64b632);_0x226790(_0x64b632);});});}function respondWithStatusCode(_0x4695a9,_0x568ae1){_0x568ae1=_0x568ae1||0xcc;return function(_0x49ef3f){if(_0x49ef3f){return _0x4695a9[_0x0b16('0x2a')](_0x568ae1);}return _0x4695a9[_0x0b16('0x2b')](_0x568ae1)['end']();};}function respondWithResult(_0x2c1605,_0x59675a){_0x59675a=_0x59675a||0xc8;return function(_0x225915){if(_0x225915){return _0x2c1605[_0x0b16('0x2b')](_0x59675a)[_0x0b16('0x2c')](_0x225915);}};}function respondWithFilteredResult(_0x295e58,_0xda58fe){return function(_0x3935ee){if(_0x3935ee){var _0x1ebb29=typeof _0xda58fe[_0x0b16('0x2d')]==='undefined'&&typeof _0xda58fe[_0x0b16('0x2e')]===_0x0b16('0x2f');var _0x3cd501=_0x3935ee[_0x0b16('0x30')];var _0x107a6d=_0x1ebb29?0x0:_0xda58fe[_0x0b16('0x2d')];var _0x5a4b7c=_0x1ebb29?_0x3935ee[_0x0b16('0x30')]:_0xda58fe[_0x0b16('0x2d')]+_0xda58fe[_0x0b16('0x2e')];var _0x51f68e;if(_0x5a4b7c>=_0x3cd501){_0x5a4b7c=_0x3cd501;_0x51f68e=0xc8;}else{_0x51f68e=0xce;}_0x295e58[_0x0b16('0x2b')](_0x51f68e);return _0x295e58[_0x0b16('0x31')](_0x0b16('0x32'),_0x107a6d+'-'+_0x5a4b7c+'/'+_0x3cd501)[_0x0b16('0x2c')](_0x3935ee);}return null;};}function patchUpdates(_0x2766f9){return function(_0x2d58ff){try{jsonpatch[_0x0b16('0x33')](_0x2d58ff,_0x2766f9,!![]);}catch(_0x215f0a){return BPromise['reject'](_0x215f0a);}return _0x2d58ff['save']();};}function saveUpdates(_0x46d00b,_0x3b0085){return function(_0x165780){if(_0x165780){return _0x165780[_0x0b16('0x34')](_0x46d00b)[_0x0b16('0x1f')](function(_0x152be5){return _0x152be5;});}return null;};}function removeEntity(_0x132492,_0x5049c5){return function(_0x31c963){if(_0x31c963){return _0x31c963[_0x0b16('0x35')]()['then'](function(){_0x132492[_0x0b16('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1100e8,_0x3cbde1){return function(_0x18a054){if(!_0x18a054){_0x1100e8[_0x0b16('0x2a')](0x194);}return _0x18a054;};}function handleError(_0x2a4c4d,_0x1027c1){_0x1027c1=_0x1027c1||0x1f4;return function(_0x584512){logger[_0x0b16('0x25')](_0x584512[_0x0b16('0x36')]);if(_0x584512['name']){delete _0x584512['name'];}_0x2a4c4d['status'](_0x1027c1)['send'](_0x584512);};}exports[_0x0b16('0x37')]=function(_0xe82d54,_0x483410){var _0x103b08={},_0x52abb3={},_0x5edb0f={'count':0x0,'rows':[]};var _0x321fca=_[_0x0b16('0x38')](db['ChatMessage'][_0x0b16('0x39')],function(_0x5020e3){return{'name':_0x5020e3[_0x0b16('0x3a')],'type':_0x5020e3['type'][_0x0b16('0x3b')]};});_0x52abb3['model']=_[_0x0b16('0x38')](_0x321fca,'name');_0x52abb3[_0x0b16('0x3c')]=_[_0x0b16('0x3d')](_0xe82d54['query']);_0x52abb3['filters']=_[_0x0b16('0x3e')](_0x52abb3[_0x0b16('0x3f')],_0x52abb3['query']);_0x103b08['attributes']=_['intersection'](_0x52abb3['model'],qs[_0x0b16('0x40')](_0xe82d54[_0x0b16('0x3c')]['fields']));_0x103b08[_0x0b16('0x41')]=_0x103b08['attributes']['length']?_0x103b08[_0x0b16('0x41')]:_0x52abb3[_0x0b16('0x3f')];if(!_0xe82d54[_0x0b16('0x3c')][_0x0b16('0x42')](_0x0b16('0x43'))){_0x103b08['limit']=qs[_0x0b16('0x2e')](_0xe82d54['query'][_0x0b16('0x2e')]);_0x103b08[_0x0b16('0x2d')]=qs['offset'](_0xe82d54['query'][_0x0b16('0x2d')]);}_0x103b08[_0x0b16('0x44')]=qs['sort'](_0xe82d54[_0x0b16('0x3c')][_0x0b16('0x45')]);_0x103b08[_0x0b16('0x46')]=qs[_0x0b16('0x47')](_[_0x0b16('0x48')](_0xe82d54['query'],_0x52abb3[_0x0b16('0x47')]),_0x321fca);if(_0xe82d54[_0x0b16('0x3c')]['filter']){_0x103b08[_0x0b16('0x46')]=_[_0x0b16('0x49')](_0x103b08[_0x0b16('0x46')],{'$or':_[_0x0b16('0x38')](_0x321fca,function(_0x5923d7){if(_0x5923d7['type']!=='VIRTUAL'){var _0xeca4ad={};_0xeca4ad[_0x5923d7[_0x0b16('0x4a')]]={'$like':'%'+_0xe82d54['query']['filter']+'%'};return _0xeca4ad;}})});}_0x103b08=_[_0x0b16('0x49')]({},_0x103b08,_0xe82d54[_0x0b16('0x4b')]);var _0x53a0ae={'where':_0x103b08[_0x0b16('0x46')]};return db[_0x0b16('0x4c')][_0x0b16('0x30')](_0x53a0ae)[_0x0b16('0x1f')](function(_0x5949b6){_0x5edb0f['count']=_0x5949b6;if(_0xe82d54[_0x0b16('0x3c')][_0x0b16('0x4d')]){_0x103b08[_0x0b16('0x4e')]=[{'all':!![]}];}return db['ChatMessage'][_0x0b16('0x4f')](_0x103b08);})['then'](function(_0x2747d0){_0x5edb0f[_0x0b16('0x50')]=_0x2747d0;return _0x5edb0f;})['then'](respondWithFilteredResult(_0x483410,_0x103b08))[_0x0b16('0x29')](handleError(_0x483410,null));};exports[_0x0b16('0x51')]=function(_0x28a4f6,_0x5946da){var _0x43adaf={'raw':!![],'where':{'id':_0x28a4f6[_0x0b16('0x52')]['id']}},_0x285177={};_0x285177[_0x0b16('0x3f')]=_['keys'](db[_0x0b16('0x4c')][_0x0b16('0x39')]);_0x285177['query']=_['keys'](_0x28a4f6[_0x0b16('0x3c')]);_0x285177[_0x0b16('0x47')]=_[_0x0b16('0x3e')](_0x285177[_0x0b16('0x3f')],_0x285177['query']);_0x43adaf['attributes']=_['intersection'](_0x285177['model'],qs['fields'](_0x28a4f6[_0x0b16('0x3c')][_0x0b16('0x40')]));_0x43adaf[_0x0b16('0x41')]=_0x43adaf[_0x0b16('0x41')][_0x0b16('0x53')]?_0x43adaf[_0x0b16('0x41')]:_0x285177[_0x0b16('0x3f')];if(_0x28a4f6[_0x0b16('0x3c')]['includeAll']){_0x43adaf[_0x0b16('0x4e')]=[{'all':!![]}];}_0x43adaf=_[_0x0b16('0x49')]({},_0x43adaf,_0x28a4f6[_0x0b16('0x4b')]);return db[_0x0b16('0x4c')][_0x0b16('0x54')](_0x43adaf)[_0x0b16('0x1f')](handleEntityNotFound(_0x5946da,null))[_0x0b16('0x1f')](respondWithResult(_0x5946da,null))[_0x0b16('0x29')](handleError(_0x5946da,null));};exports[_0x0b16('0x55')]=function(_0x2364f0,_0x5723c2){return db[_0x0b16('0x4c')][_0x0b16('0x55')](_0x2364f0[_0x0b16('0x56')],{})[_0x0b16('0x1f')](respondWithResult(_0x5723c2,0xc9))[_0x0b16('0x29')](handleError(_0x5723c2,null));};exports[_0x0b16('0x34')]=function(_0x4c8953,_0x380b1d){if(_0x4c8953[_0x0b16('0x56')]['id']){delete _0x4c8953[_0x0b16('0x56')]['id'];}return db[_0x0b16('0x4c')][_0x0b16('0x54')]({'where':{'id':_0x4c8953[_0x0b16('0x52')]['id']}})['then'](handleEntityNotFound(_0x380b1d,null))[_0x0b16('0x1f')](saveUpdates(_0x4c8953[_0x0b16('0x56')],null))[_0x0b16('0x1f')](respondWithResult(_0x380b1d,null))[_0x0b16('0x29')](handleError(_0x380b1d,null));};exports[_0x0b16('0x35')]=function(_0xf49a2d,_0x1ca47e){return db['ChatMessage']['find']({'where':{'id':_0xf49a2d[_0x0b16('0x52')]['id']}})[_0x0b16('0x1f')](handleEntityNotFound(_0x1ca47e,null))[_0x0b16('0x1f')](removeEntity(_0x1ca47e,null))[_0x0b16('0x29')](handleError(_0x1ca47e,null));};exports[_0x0b16('0x57')]=function(_0xd83cb8,_0x47ca41){return db['ChatMessage'][_0x0b16('0x57')]()[_0x0b16('0x1f')](respondWithResult(_0x47ca41,null))[_0x0b16('0x29')](handleError(_0x47ca41,null));};var interaction_log=require(_0x0b16('0x58'))('chat-interactions');exports[_0x0b16('0x59')]=function(_0x1d9c49,_0x2c0434,_0xea335b){var _0x41b4a3={'agent':{},'channel':_0x0b16('0x5a')};if(_0x1d9c49[_0x0b16('0x56')]['id']){delete _0x1d9c49[_0x0b16('0x56')]['id'];}_0x1d9c49[_0x0b16('0x56')]['read']=!![];_0x1d9c49[_0x0b16('0x56')][_0x0b16('0x5b')]=moment()[_0x0b16('0x5c')](_0x0b16('0x5d'));_0x1d9c49[_0x0b16('0x56')][_0x0b16('0x5e')]=_0x1d9c49[_0x0b16('0x56')][_0x0b16('0x5e')]||_0x1d9c49[_0x0b16('0x5f')]['id'];_0x41b4a3[_0x0b16('0x60')]['id']=_0x1d9c49[_0x0b16('0x56')]['UserId'];return db[_0x0b16('0x4c')][_0x0b16('0x54')]({'where':{'id':_0x1d9c49[_0x0b16('0x52')]['id'],'UserId':null}})[_0x0b16('0x1f')](handleEntityNotFound(_0x2c0434,null))[_0x0b16('0x1f')](saveUpdates(_0x1d9c49[_0x0b16('0x56')],null))[_0x0b16('0x1f')](function(_0x5edb9c){if(_0x5edb9c){_0x41b4a3[_0x0b16('0x27')]=_0x5edb9c['get']({'plain':!![]});return db['ChatInteraction'][_0x0b16('0x54')]({'where':{'id':_0x5edb9c['ChatInteractionId']}});}return null;})[_0x0b16('0x1f')](handleEntityNotFound(_0x2c0434,null))['then'](function(_0x42777f){if(_0x42777f){return _0x42777f[_0x0b16('0x34')]({'UserId':_0x1d9c49['body'][_0x0b16('0x5e')],'read1stAt':_[_0x0b16('0x61')](_0x42777f[_0x0b16('0x62')])?moment()[_0x0b16('0x5c')](_0x0b16('0x5d')):undefined});}return null;})[_0x0b16('0x1f')](function(_0x341f3c){if(_0x341f3c){_0x41b4a3['interaction']=_0x341f3c[_0x0b16('0x63')]({'plain':!![]});interaction_log[_0x0b16('0x20')](_0x0b16('0x64'),_0x1d9c49['user']['id'],_0x1d9c49[_0x0b16('0x5f')]['name'],_0x1d9c49['user'][_0x0b16('0x65')],_0x41b4a3[_0x0b16('0x66')]['id'],_0x1d9c49[_0x0b16('0x56')]?JSON[_0x0b16('0x24')](_0x1d9c49[_0x0b16('0x56')]):_0x0b16('0x67'));return respondWithRpcPromise(_0x0b16('0x68'),_0x0b16('0x69'),_0x41b4a3);}return null;})[_0x0b16('0x1f')](function(_0x4db345){var _0x227536=_0x0b16('0x6a')+_0x4db345[_0x0b16('0x27')][_0x0b16('0x6b')];return db[_0x0b16('0x6c')]['query'](_0x227536,{'type':db[_0x0b16('0x6d')][_0x0b16('0x6e')][_0x0b16('0x6f')],'raw':!![]})[_0x0b16('0x1f')](function(_0x535d4f){return _0x535d4f;});})[_0x0b16('0x1f')](function(_0x40493e){if(_0x40493e){_0x41b4a3[_0x0b16('0x27')]['contact']=_0x40493e[0x0];if(!_0x1d9c49['body'][_0x0b16('0x5e')])return;return db[_0x0b16('0x70')][_0x0b16('0x54')]({'where':{'id':_0x1d9c49[_0x0b16('0x56')]['UserId'],'role':'agent'},'attributes':['id',_0x0b16('0x4a'),_0x0b16('0x71'),'email',_0x0b16('0x72')],'raw':!![]});}return null;})[_0x0b16('0x1f')](function(_0x16a071){if(!_0x16a071)return null;_0x41b4a3['message'][_0x0b16('0x60')]=_0x16a071;return _0x41b4a3;})[_0x0b16('0x1f')](function(_0x9a063d){if(_0x9a063d){if(_0x1d9c49[_0x0b16('0x56')]['manual']){_0x41b4a3[_0x0b16('0x27')][_0x0b16('0x73')]=util[_0x0b16('0x5c')](_0x0b16('0x74'),_0x1d9c49[_0x0b16('0x5f')][_0x0b16('0x4a')]);_0x41b4a3[_0x0b16('0x27')][_0x0b16('0x75')]=_0x41b4a3['channel'];_0x41b4a3[_0x0b16('0x27')][_0x0b16('0x76')]=_0x41b4a3['channel'];_0x41b4a3['message']['event']='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0x0b16('0x77'),'message':_[_0x0b16('0x49')](_0x41b4a3[_0x0b16('0x27')],JSON[_0x0b16('0x78')](_0x41b4a3[_0x0b16('0x66')][_0x0b16('0x79')]))},client9002)['then'](function(){return _0x41b4a3;});}return _0x41b4a3;}return null;})['then'](respondWithResult(_0x2c0434,null))[_0x0b16('0x29')](handleError(_0x2c0434,null));};var interaction_log=require(_0x0b16('0x58'))('chat-interactions');exports[_0x0b16('0x7a')]=function(_0x1ddd65,_0xdff954,_0x38f4ce){var _0x4c2677={'agent':{},'channel':_0x0b16('0x5a')};if(_0x1ddd65[_0x0b16('0x56')]['id']){delete _0x1ddd65[_0x0b16('0x56')]['id'];}_0x1ddd65[_0x0b16('0x56')][_0x0b16('0x5e')]=_0x1ddd65[_0x0b16('0x56')][_0x0b16('0x5e')]||_0x1ddd65['user']['id'];_0x4c2677[_0x0b16('0x60')]['id']=_0x1ddd65[_0x0b16('0x56')][_0x0b16('0x5e')];return db[_0x0b16('0x4c')][_0x0b16('0x54')]({'where':{'id':_0x1ddd65[_0x0b16('0x52')]['id'],'UserId':null}})[_0x0b16('0x1f')](handleEntityNotFound(_0xdff954,null))[_0x0b16('0x1f')](function(_0x36b1b4){if(_0x36b1b4){_0x4c2677[_0x0b16('0x27')]=_0x36b1b4[_0x0b16('0x63')]({'plain':!![]});return db[_0x0b16('0x7b')]['find']({'where':{'id':_0x36b1b4[_0x0b16('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0xdff954,null))['then'](function(_0x1bdb70){if(_0x1bdb70){_0x4c2677[_0x0b16('0x66')]=_0x1bdb70[_0x0b16('0x63')]({'plain':!![]});interaction_log['info'](_0x0b16('0x7d'),_0x1ddd65[_0x0b16('0x5f')]['id'],_0x1ddd65[_0x0b16('0x5f')]['name'],_0x1ddd65[_0x0b16('0x5f')][_0x0b16('0x65')],_0x4c2677[_0x0b16('0x66')]['id'],_0x1ddd65[_0x0b16('0x56')]?JSON['stringify'](_0x1ddd65[_0x0b16('0x56')]):_0x0b16('0x67'));return respondWithRpcPromise(_0x0b16('0x7e'),'rejectMessage',_0x4c2677);}return null;})[_0x0b16('0x1f')](function(_0x24e8fe){var _0x26ea88=_0x0b16('0x6a')+_0x24e8fe['message']['ContactId'];return db[_0x0b16('0x6c')][_0x0b16('0x3c')](_0x26ea88,{'type':db[_0x0b16('0x6d')]['QueryTypes'][_0x0b16('0x6f')],'raw':!![]})[_0x0b16('0x1f')](function(_0x407db4){return _0x407db4;});})[_0x0b16('0x1f')](function(_0x2fcad4){if(_0x2fcad4){_0x4c2677[_0x0b16('0x27')][_0x0b16('0x7f')]=_0x2fcad4[0x0];if(!_0x1ddd65[_0x0b16('0x56')]['UserId'])return;return db['User'][_0x0b16('0x54')]({'where':{'id':_0x1ddd65[_0x0b16('0x56')][_0x0b16('0x5e')],'role':'agent'},'attributes':['id',_0x0b16('0x4a'),'fullname',_0x0b16('0x80'),'internal'],'raw':!![]});}return null;})[_0x0b16('0x1f')](function(_0x1182e5){if(!_0x1182e5)return null;_0x4c2677['message']['agent']=_0x1182e5;return _0x4c2677;})[_0x0b16('0x1f')](function(_0x17548f){if(_0x17548f){_0x17548f[_0x0b16('0x27')][_0x0b16('0x73')]=util[_0x0b16('0x5c')](_0x0b16('0x74'),_0x1ddd65['user'][_0x0b16('0x4a')]);_0x17548f[_0x0b16('0x27')][_0x0b16('0x75')]=_0x4c2677[_0x0b16('0x75')];_0x17548f['message'][_0x0b16('0x76')]=_0x4c2677['channel'];_0x17548f[_0x0b16('0x27')]['event']=_0x0b16('0x7a');respondWithRpcPromise(_0x0b16('0x81'),_0x0b16('0x81'),{'event':'rejectmessage','message':_[_0x0b16('0x49')](_0x4c2677['message'],JSON[_0x0b16('0x78')](_0x4c2677[_0x0b16('0x66')][_0x0b16('0x79')]))},client9002);return _0x4c2677;}return null;})[_0x0b16('0x1f')](respondWithResult(_0xdff954,null))[_0x0b16('0x29')](handleError(_0xdff954,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 4dfb902..32fb713 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 _0x74cf=['emit','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x4421b5,_0x13d0f6){var _0x26cca3=function(_0x295016){while(--_0x295016){_0x4421b5['push'](_0x4421b5['shift']());}};_0x26cca3(++_0x13d0f6);}(_0x74cf,0x15a));var _0xf74c=function(_0x47c39d,_0x3eea90){_0x47c39d=_0x47c39d-0x0;var _0xd41416=_0x74cf[_0x47c39d];return _0xd41416;};'use strict';var EventEmitter=require(_0xf74c('0x0'));var ChatMessage=require(_0xf74c('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xf74c('0x2')](0x0);var events={'afterCreate':_0xf74c('0x3'),'afterUpdate':_0xf74c('0x4'),'afterDestroy':_0xf74c('0x5')};function emitEvent(_0x52ef7a){return function(_0x50e20f,_0x1f0f1a,_0x56406a){ChatMessageEvents[_0xf74c('0x6')](_0x52ef7a+':'+_0x50e20f['id'],_0x50e20f);ChatMessageEvents[_0xf74c('0x6')](_0x52ef7a,_0x50e20f);_0x56406a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xf74c('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x18fc=['hasOwnProperty','hook','events','ChatMessage','setMaxListeners','save','emit'];(function(_0x46723d,_0x3d6bd5){var _0x5e2b3a=function(_0x1a3c33){while(--_0x1a3c33){_0x46723d['push'](_0x46723d['shift']());}};_0x5e2b3a(++_0x3d6bd5);}(_0x18fc,0x144));var _0xc18f=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x18fc[_0x26b80e];return _0x84a8a8;};'use strict';var EventEmitter=require(_0xc18f('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xc18f('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xc18f('0x2')](0x0);var events={'afterCreate':_0xc18f('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x32b8e6){return function(_0x2e1d,_0x2afef9,_0x2e1f4d){ChatMessageEvents[_0xc18f('0x4')](_0x32b8e6+':'+_0x2e1d['id'],_0x2e1d);ChatMessageEvents[_0xc18f('0x4')](_0x32b8e6,_0x2e1d);_0x2e1f4d(null);};}for(var e in events){if(events[_0xc18f('0x5')](e)){var event=events[e];ChatMessage[_0xc18f('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 5a67842..32dd296 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 _0x755b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x5afb98,_0x2cdefe){var _0x3187bc=function(_0x1c2394){while(--_0x1c2394){_0x5afb98['push'](_0x5afb98['shift']());}};_0x3187bc(++_0x2cdefe);}(_0x755b,0xfa));var _0xb755=function(_0x4b0d72,_0xf66c17){_0x4b0d72=_0x4b0d72-0x0;var _0x205999=_0x755b[_0x4b0d72];return _0x205999;};'use strict';var _=require('lodash');var util=require(_0xb755('0x0'));var logger=require(_0xb755('0x1'))(_0xb755('0x2'));var moment=require(_0xb755('0x3'));var BPromise=require(_0xb755('0x4'));var rp=require(_0xb755('0x5'));var fs=require('fs');var path=require(_0xb755('0x6'));var rimraf=require(_0xb755('0x7'));var config=require(_0xb755('0x8'));var attributes=require(_0xb755('0x9'));module['exports']=function(_0x1ec43a,_0x399f2a){return _0x1ec43a[_0xb755('0xa')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xb755('0xb')],'type':_0xb755('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ae8f4,_0x1443a8,_0x133d2e){var _0x34e051=_0x1ec43a[_0xb755('0xd')];var _0x5a2e93=_0x4ae8f4[_0xb755('0xe')]({'plain':!![]});if(_0x5a2e93['direction'][_0xb755('0xf')]()==='in'||_0x5a2e93[_0xb755('0x10')][_0xb755('0xf')]()===_0xb755('0x11')&&!_0x5a2e93[_0xb755('0x12')]&&!_[_0xb755('0x13')](_0x5a2e93[_0xb755('0x14')])){_0x34e051[_0xb755('0x15')]['findOne']({'where':{'id':_0x5a2e93[_0xb755('0x16')]}})['then'](function(_0x5731aa){if(_0x5731aa){_0x5731aa['update']({'lastMsgAt':_0x5a2e93[_0xb755('0x17')],'lastMsgDirection':_0x5a2e93['direction'][_0xb755('0xf')]()});}})[_0xb755('0x18')](function(_0x277a5e){console[_0xb755('0x19')](_0x277a5e);});}_0x133d2e();}},'charset':_0xb755('0x1a'),'collate':_0xb755('0x1b')});}; \ No newline at end of file +var _0xbc8a=['path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','get','toLowerCase','out','UserId','ChatInteraction','update','createdAt','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise'];(function(_0x4eed89,_0x108efd){var _0x1d6ded=function(_0x18a0bd){while(--_0x18a0bd){_0x4eed89['push'](_0x4eed89['shift']());}};_0x1d6ded(++_0x108efd);}(_0xbc8a,0x190));var _0xabc8=function(_0x3cff3a,_0x2dcc6b){_0x3cff3a=_0x3cff3a-0x0;var _0x31d709=_0xbc8a[_0x3cff3a];return _0x31d709;};'use strict';var _=require('lodash');var util=require(_0xabc8('0x0'));var logger=require('../../config/logger')(_0xabc8('0x1'));var moment=require(_0xabc8('0x2'));var BPromise=require(_0xabc8('0x3'));var rp=require(_0xabc8('0x4'));var fs=require('fs');var path=require(_0xabc8('0x5'));var rimraf=require(_0xabc8('0x6'));var config=require(_0xabc8('0x7'));var attributes=require(_0xabc8('0x8'));module['exports']=function(_0x4b2afa,_0x3bf739){return _0x4b2afa[_0xabc8('0x9')](_0xabc8('0xa'),attributes,{'tableName':_0xabc8('0xb'),'paranoid':![],'indexes':[{'name':_0xabc8('0xc'),'fields':['body'],'type':_0xabc8('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10acc7,_0x3c3c3f,_0x4b2bd5){var _0x540e36=_0x4b2afa[_0xabc8('0xe')];var _0x4a400a=_0x10acc7[_0xabc8('0xf')]({'plain':!![]});if(_0x4a400a['direction'][_0xabc8('0x10')]()==='in'||_0x4a400a['direction'][_0xabc8('0x10')]()===_0xabc8('0x11')&&!_0x4a400a['secret']&&!_['isNil'](_0x4a400a[_0xabc8('0x12')])){_0x540e36[_0xabc8('0x13')]['findOne']({'where':{'id':_0x4a400a['ChatInteractionId']}})['then'](function(_0x35846c){if(_0x35846c){_0x35846c[_0xabc8('0x14')]({'lastMsgAt':_0x4a400a[_0xabc8('0x15')],'lastMsgDirection':_0x4a400a[_0xabc8('0x16')][_0xabc8('0x10')]()});}})[_0xabc8('0x17')](function(_0x2b86a8){console[_0xabc8('0x18')](_0x2b86a8);});}_0x4b2bd5();}},'charset':_0xabc8('0x19'),'collate':_0xabc8('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 745d56c..7a75a29 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 _0xd177=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateChatMessage','create','options','stringify','moment','bluebird','randomstring','../../config/utils'];(function(_0x4af361,_0x2320b4){var _0x3460fd=function(_0x404dad){while(--_0x404dad){_0x4af361['push'](_0x4af361['shift']());}};_0x3460fd(++_0x2320b4);}(_0xd177,0x11e));var _0x7d17=function(_0x4808af,_0x2682f4){_0x4808af=_0x4808af-0x0;var _0x269076=_0xd177[_0x4808af];return _0x269076;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7d17('0x0'));var BPromise=require(_0x7d17('0x1'));var rs=require(_0x7d17('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7d17('0x3'));var logger=require(_0x7d17('0x4'))(_0x7d17('0x5'));var config=require(_0x7d17('0x6'));var jayson=require(_0x7d17('0x7'));var client=jayson['client'][_0x7d17('0x8')]({'port':0x232a});config[_0x7d17('0x9')]=_[_0x7d17('0xa')](config[_0x7d17('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7d17('0xb'))(new Redis(config['redis']));require(_0x7d17('0xc'))[_0x7d17('0xd')](socket);function respondWithRpcPromise(_0x59cb50,_0x550193,_0x43e92f){return new BPromise(function(_0x552e69,_0x46b53f){return client['request'](_0x59cb50,_0x43e92f)[_0x7d17('0xe')](function(_0x37d71a){logger[_0x7d17('0xf')](_0x7d17('0x10'),_0x550193,_0x7d17('0x11'));logger[_0x7d17('0x12')](_0x7d17('0x13'),_0x550193,_0x7d17('0x11'),JSON['stringify'](_0x37d71a));if(_0x37d71a[_0x7d17('0x14')]){if(_0x37d71a[_0x7d17('0x14')][_0x7d17('0x15')]===0x1f4){logger[_0x7d17('0x14')]('ChatMessage,\x20%s,\x20%s',_0x550193,_0x37d71a['error'][_0x7d17('0x16')]);return _0x46b53f(_0x37d71a[_0x7d17('0x14')]['message']);}logger['error'](_0x7d17('0x10'),_0x550193,_0x37d71a[_0x7d17('0x14')][_0x7d17('0x16')]);return _0x552e69(_0x37d71a[_0x7d17('0x14')][_0x7d17('0x16')]);}else{logger[_0x7d17('0xf')](_0x7d17('0x10'),_0x550193,_0x7d17('0x11'));_0x552e69(_0x37d71a[_0x7d17('0x17')]['message']);}})[_0x7d17('0x18')](function(_0x18b90b){logger['error'](_0x7d17('0x10'),_0x550193,_0x18b90b);_0x46b53f(_0x18b90b);});});}exports[_0x7d17('0x19')]=function(_0x36f4d9){var _0x2c171e=this;return new Promise(function(_0x2688a9,_0x22dd7a){return db['ChatMessage'][_0x7d17('0x1a')](_0x36f4d9['body'],{'raw':_0x36f4d9[_0x7d17('0x1b')]?_0x36f4d9['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4898b2){logger['info'](_0x7d17('0x19'),_0x36f4d9);logger[_0x7d17('0x12')]('CreateChatMessage',_0x36f4d9,JSON[_0x7d17('0x1c')](_0x4898b2));_0x2688a9(_0x4898b2);})['catch'](function(_0x151b0d){logger[_0x7d17('0x14')]('CreateChatMessage',_0x151b0d[_0x7d17('0x16')],_0x36f4d9);_0x22dd7a(_0x2c171e['error'](0x1f4,_0x151b0d[_0x7d17('0x16')]));});});}; \ No newline at end of file +var _0x88f3=['then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','result','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','./chatMessage.socket','request'];(function(_0x3dc36e,_0x1917ec){var _0x3c317b=function(_0x37636f){while(--_0x37636f){_0x3dc36e['push'](_0x3dc36e['shift']());}};_0x3c317b(++_0x1917ec);}(_0x88f3,0x13e));var _0x388f=function(_0x438928,_0x4045dc){_0x438928=_0x438928-0x0;var _0x930564=_0x88f3[_0x438928];return _0x930564;};'use strict';var _=require('lodash');var util=require(_0x388f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x388f('0x1'));var fs=require('fs');var Redis=require(_0x388f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x388f('0x3'));var logger=require(_0x388f('0x4'))(_0x388f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x388f('0x6')]['http']({'port':0x232a});config[_0x388f('0x7')]=_[_0x388f('0x8')](config[_0x388f('0x7')],{'host':_0x388f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x388f('0x7')]));require(_0x388f('0xa'))['register'](socket);function respondWithRpcPromise(_0x98779e,_0x2aa07c,_0x285c5d){return new BPromise(function(_0x165e3c,_0x43644a){return client[_0x388f('0xb')](_0x98779e,_0x285c5d)[_0x388f('0xc')](function(_0x53033c){logger[_0x388f('0xd')]('ChatMessage,\x20%s,\x20%s',_0x2aa07c,_0x388f('0xe'));logger[_0x388f('0xf')](_0x388f('0x10'),_0x2aa07c,_0x388f('0xe'),JSON['stringify'](_0x53033c));if(_0x53033c[_0x388f('0x11')]){if(_0x53033c[_0x388f('0x11')][_0x388f('0x12')]===0x1f4){logger[_0x388f('0x11')](_0x388f('0x13'),_0x2aa07c,_0x53033c['error'][_0x388f('0x14')]);return _0x43644a(_0x53033c['error'][_0x388f('0x14')]);}logger[_0x388f('0x11')]('ChatMessage,\x20%s,\x20%s',_0x2aa07c,_0x53033c['error'][_0x388f('0x14')]);return _0x165e3c(_0x53033c[_0x388f('0x11')]['message']);}else{logger[_0x388f('0xd')](_0x388f('0x13'),_0x2aa07c,'request\x20sent');_0x165e3c(_0x53033c[_0x388f('0x15')][_0x388f('0x14')]);}})['catch'](function(_0x4cfe6a){logger[_0x388f('0x11')](_0x388f('0x13'),_0x2aa07c,_0x4cfe6a);_0x43644a(_0x4cfe6a);});});}exports[_0x388f('0x16')]=function(_0x25e7d3){var _0x4f4e21=this;return new Promise(function(_0x38dbb1,_0x24fffe){return db[_0x388f('0x17')][_0x388f('0x18')](_0x25e7d3[_0x388f('0x19')],{'raw':_0x25e7d3[_0x388f('0x1a')]?_0x25e7d3[_0x388f('0x1a')][_0x388f('0x1b')]===undefined?!![]:![]:!![]})[_0x388f('0xc')](function(_0x275aff){logger[_0x388f('0xd')](_0x388f('0x16'),_0x25e7d3);logger[_0x388f('0xf')](_0x388f('0x16'),_0x25e7d3,JSON[_0x388f('0x1c')](_0x275aff));_0x38dbb1(_0x275aff);})[_0x388f('0x1d')](function(_0x4163ed){logger[_0x388f('0x11')]('CreateChatMessage',_0x4163ed[_0x388f('0x14')],_0x25e7d3);_0x24fffe(_0x4f4e21[_0x388f('0x11')](0x1f4,_0x4163ed[_0x388f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 86da9cf..35b2db6 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 _0xa23f=['save','emit','register','chatMessage:','./chatMessage.events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa23f,0x7c));var _0xfa23=function(_0x3cab14,_0x26258d){_0x3cab14=_0x3cab14-0x0;var _0x40e1fb=_0xa23f[_0x3cab14];return _0x40e1fb;};'use strict';var ChatMessageEvents=require(_0xfa23('0x0'));var events=[_0xfa23('0x1'),'remove','update'];function createListener(_0xb81edf,_0x3f714c){return function(_0x1c85a9){_0x3f714c[_0xfa23('0x2')](_0xb81edf,_0x1c85a9);};}function removeListener(_0x5643b1,_0x86778e){return function(){ChatMessageEvents['removeListener'](_0x5643b1,_0x86778e);};}exports[_0xfa23('0x3')]=function(_0x2df2f5){for(var _0x4c3f4=0x0,_0x3696ef=events['length'];_0x4c3f4<_0x3696ef;_0x4c3f4++){var _0x5a7882=events[_0x4c3f4];var _0x59d53e=createListener(_0xfa23('0x4')+_0x5a7882,_0x2df2f5);ChatMessageEvents['on'](_0x5a7882,_0x59d53e);}}; \ No newline at end of file +var _0x2e8a=['remove','emit','chatMessage:','save'];(function(_0x4f7ca7,_0x5099e7){var _0x55f6b0=function(_0x368838){while(--_0x368838){_0x4f7ca7['push'](_0x4f7ca7['shift']());}};_0x55f6b0(++_0x5099e7);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x16dbab,_0x3ac1e1){_0x16dbab=_0x16dbab-0x0;var _0x59b0b2=_0x2e8a[_0x16dbab];return _0x59b0b2;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xa2e8('0x0'),_0xa2e8('0x1'),'update'];function createListener(_0x3a9fbd,_0x2b63d9){return function(_0x4b770c){_0x2b63d9[_0xa2e8('0x2')](_0x3a9fbd,_0x4b770c);};}function removeListener(_0x522e76,_0x492531){return function(){ChatMessageEvents['removeListener'](_0x522e76,_0x492531);};}exports['register']=function(_0x4593d2){for(var _0x32fb35=0x0,_0x4d31a8=events['length'];_0x32fb35<_0x4d31a8;_0x32fb35++){var _0x99f433=events[_0x32fb35];var _0x3b6834=createListener(_0xa2e8('0x3')+_0x99f433,_0x4593d2);ChatMessageEvents['on'](_0x99f433,_0x3b6834);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 982f840..201ac32 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 _0x8f23=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','post','tracked','chat','chatmessage:create','put','/:id','update','/:id/accept','accept','reject','delete','destroy','exports','multer'];(function(_0x40942b,_0x4fba32){var _0x56529b=function(_0x3b635f){while(--_0x3b635f){_0x40942b['push'](_0x40942b['shift']());}};_0x56529b(++_0x4fba32);}(_0x8f23,0xfb));var _0x38f2=function(_0x352b53,_0x29a403){_0x352b53=_0x352b53-0x0;var _0x2b08b8=_0x8f23[_0x352b53];return _0x2b08b8;};'use strict';var multer=require(_0x38f2('0x0'));var util=require(_0x38f2('0x1'));var path=require(_0x38f2('0x2'));var timeout=require(_0x38f2('0x3'));var express=require(_0x38f2('0x4'));var router=express[_0x38f2('0x5')]();var fs_extra=require(_0x38f2('0x6'));var auth=require(_0x38f2('0x7'));var interaction=require(_0x38f2('0x8'));var config=require(_0x38f2('0x9'));var controller=require(_0x38f2('0xa'));router['get']('/',auth[_0x38f2('0xb')](),controller[_0x38f2('0xc')]);router[_0x38f2('0xd')](_0x38f2('0xe'),auth[_0x38f2('0xb')](),controller['describe']);router[_0x38f2('0xd')]('/:id',auth[_0x38f2('0xb')](),controller['show']);router[_0x38f2('0xf')]('/',auth[_0x38f2('0xb')](),interaction[_0x38f2('0x10')](_0x38f2('0x11'),_0x38f2('0x12')),controller['create']);router[_0x38f2('0x13')](_0x38f2('0x14'),controller[_0x38f2('0x15')]);router[_0x38f2('0x13')](_0x38f2('0x16'),auth[_0x38f2('0xb')](),controller[_0x38f2('0x17')]);router[_0x38f2('0x13')]('/:id/reject',auth['isAuthenticated'](),controller[_0x38f2('0x18')]);router[_0x38f2('0x19')](_0x38f2('0x14'),auth[_0x38f2('0xb')](),controller[_0x38f2('0x1a')]);module[_0x38f2('0x1b')]=router; \ No newline at end of file +var _0xc11d=['get','index','isAuthenticated','describe','/:id','show','post','tracked','chat','update','put','/:id/accept','accept','reject','delete','destroy','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x17b7b6,_0x25aec5){var _0x4d3dd7=function(_0x174be4){while(--_0x174be4){_0x17b7b6['push'](_0x17b7b6['shift']());}};_0x4d3dd7(++_0x25aec5);}(_0xc11d,0x1de));var _0xdc11=function(_0x2fcf33,_0x332942){_0x2fcf33=_0x2fcf33-0x0;var _0xeb551d=_0xc11d[_0x2fcf33];return _0xeb551d;};'use strict';var multer=require(_0xdc11('0x0'));var util=require(_0xdc11('0x1'));var path=require('path');var timeout=require(_0xdc11('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdc11('0x3'));var interaction=require(_0xdc11('0x4'));var config=require(_0xdc11('0x5'));var controller=require('./chatMessage.controller');router[_0xdc11('0x6')]('/',auth['isAuthenticated'](),controller[_0xdc11('0x7')]);router[_0xdc11('0x6')]('/describe',auth[_0xdc11('0x8')](),controller[_0xdc11('0x9')]);router[_0xdc11('0x6')](_0xdc11('0xa'),auth[_0xdc11('0x8')](),controller[_0xdc11('0xb')]);router[_0xdc11('0xc')]('/',auth[_0xdc11('0x8')](),interaction[_0xdc11('0xd')](_0xdc11('0xe'),'chatmessage:create'),controller['create']);router['put'](_0xdc11('0xa'),controller[_0xdc11('0xf')]);router[_0xdc11('0x10')](_0xdc11('0x11'),auth[_0xdc11('0x8')](),controller[_0xdc11('0x12')]);router[_0xdc11('0x10')]('/:id/reject',auth[_0xdc11('0x8')](),controller[_0xdc11('0x13')]);router[_0xdc11('0x14')]('/:id',auth[_0xdc11('0x8')](),controller[_0xdc11('0x15')]);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 7e0022c..2e636ff 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 _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x242daa,_0x4d9e5f){var _0x55990b=function(_0x5075a7){while(--_0x5075a7){_0x242daa['push'](_0x242daa['shift']());}};_0x55990b(++_0x4d9e5f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x585f40,_0x4a3091){_0x585f40=_0x585f40-0x0;var _0x44fc86=_0x5f2f[_0x585f40];return _0x44fc86;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['medium','TEXT','exports'];(function(_0x5c075e,_0x2e9229){var _0x2b4271=function(_0x19ce53){while(--_0x19ce53){_0x5c075e['push'](_0x5c075e['shift']());}};_0x2b4271(++_0x2e9229);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 4181019..7eda674 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x3bd97b,_0x16cced){var _0x2a30c0=function(_0x6fc92f){while(--_0x6fc92f){_0x3bd97b['push'](_0x3bd97b['shift']());}};_0x2a30c0(++_0x16cced);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x5eafc3,_0x53ab20){var _0x5a13d1=function(_0x27f9ee){while(--_0x27f9ee){_0x5eafc3['push'](_0x5eafc3['shift']());}};_0x5a13d1(++_0x53ab20);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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 363fb99..bedc131 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 _0x28e1=['setMaxListeners','save','update','remove','emit','hook','exports','events','ChatOfflineMessage'];(function(_0x31b43c,_0x90291e){var _0x448cb6=function(_0x425bd0){while(--_0x425bd0){_0x31b43c['push'](_0x31b43c['shift']());}};_0x448cb6(++_0x90291e);}(_0x28e1,0x85));var _0x128e=function(_0x5987e1,_0x51fd88){_0x5987e1=_0x5987e1-0x0;var _0x546b12=_0x28e1[_0x5987e1];return _0x546b12;};'use strict';var EventEmitter=require(_0x128e('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x128e('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x128e('0x2')](0x0);var events={'afterCreate':_0x128e('0x3'),'afterUpdate':_0x128e('0x4'),'afterDestroy':_0x128e('0x5')};function emitEvent(_0x2462eb){return function(_0xc67e95,_0x22d5ca,_0x47d695){ChatOfflineMessageEvents[_0x128e('0x6')](_0x2462eb+':'+_0xc67e95['id'],_0xc67e95);ChatOfflineMessageEvents[_0x128e('0x6')](_0x2462eb,_0xc67e95);_0x47d695(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x128e('0x7')](e,emitEvent(event));}}module[_0x128e('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x882a=['hasOwnProperty','events','../../mysqldb','save','update','emit'];(function(_0x34ca5a,_0x2f14b1){var _0x38c2be=function(_0x239f61){while(--_0x239f61){_0x34ca5a['push'](_0x34ca5a['shift']());}};_0x38c2be(++_0x2f14b1);}(_0x882a,0xc7));var _0xa882=function(_0x38d203,_0x550d39){_0x38d203=_0x38d203-0x0;var _0x445791=_0x882a[_0x38d203];return _0x445791;};'use strict';var EventEmitter=require(_0xa882('0x0'));var ChatOfflineMessage=require(_0xa882('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa882('0x2'),'afterUpdate':_0xa882('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3c5051){return function(_0x126b9a,_0x2355bc,_0x24657e){ChatOfflineMessageEvents[_0xa882('0x4')](_0x3c5051+':'+_0x126b9a['id'],_0x126b9a);ChatOfflineMessageEvents[_0xa882('0x4')](_0x3c5051,_0x126b9a);_0x24657e(null);};}for(var e in events){if(events[_0xa882('0x5')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index df14f6d..4ed5516 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 _0xbbb9=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xbbb9,0xa6));var _0x9bbb=function(_0x16d716,_0x578e00){_0x16d716=_0x16d716-0x0;var _0x45b183=_0xbbb9[_0x16d716];return _0x45b183;};'use strict';var attributes=require(_0x9bbb('0x0'));module[_0x9bbb('0x1')]=function(_0x576a19){return _0x576a19[_0x9bbb('0x2')](_0x9bbb('0x3'),attributes,{'tableName':_0x9bbb('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9bbb('0x5'),'collate':_0x9bbb('0x6')});}; \ No newline at end of file +var _0x3cef=['exports','chat_offline_messages','utf8mb4_unicode_ci'];(function(_0x54fea7,_0x33e39c){var _0x502ed1=function(_0x2980ed){while(--_0x2980ed){_0x54fea7['push'](_0x54fea7['shift']());}};_0x502ed1(++_0x33e39c);}(_0x3cef,0x10b));var _0xf3ce=function(_0x3e5e50,_0x28c883){_0x3e5e50=_0x3e5e50-0x0;var _0x3c852a=_0x3cef[_0x3e5e50];return _0x3c852a;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xf3ce('0x0')]=function(_0x30ff22){return _0x30ff22['define']('ChatOfflineMessage',attributes,{'tableName':_0xf3ce('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf3ce('0x2')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 8bb71c1..5d0cabe 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 _0xab33=['catch','util','moment','randomstring','../../config/utils','../../config/logger','rpc','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x406940,_0x2adee7){var _0x7002e9=function(_0x3b899c){while(--_0x3b899c){_0x406940['push'](_0x406940['shift']());}};_0x7002e9(++_0x2adee7);}(_0xab33,0x1a3));var _0x3ab3=function(_0x5706fc,_0xb802b5){_0x5706fc=_0x5706fc-0x0;var _0x46f420=_0xab33[_0x5706fc];return _0x46f420;};'use strict';var _=require('lodash');var util=require(_0x3ab3('0x0'));var moment=require(_0x3ab3('0x1'));var BPromise=require('bluebird');var rs=require(_0x3ab3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3ab3('0x3'));var logger=require(_0x3ab3('0x4'))(_0x3ab3('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3ab3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4451ba,_0x54a9a2,_0x4f760a){return new BPromise(function(_0x277d51,_0x1ce202){return client[_0x3ab3('0x7')](_0x4451ba,_0x4f760a)[_0x3ab3('0x8')](function(_0x147228){logger[_0x3ab3('0x9')](_0x3ab3('0xa'),_0x54a9a2,'request\x20sent');logger[_0x3ab3('0xb')](_0x3ab3('0xc'),_0x54a9a2,_0x3ab3('0xd'),JSON[_0x3ab3('0xe')](_0x147228));if(_0x147228[_0x3ab3('0xf')]){if(_0x147228[_0x3ab3('0xf')]['code']===0x1f4){logger[_0x3ab3('0xf')](_0x3ab3('0xa'),_0x54a9a2,_0x147228[_0x3ab3('0xf')][_0x3ab3('0x10')]);return _0x1ce202(_0x147228[_0x3ab3('0xf')][_0x3ab3('0x10')]);}logger[_0x3ab3('0xf')](_0x3ab3('0xa'),_0x54a9a2,_0x147228['error'][_0x3ab3('0x10')]);return _0x277d51(_0x147228[_0x3ab3('0xf')]['message']);}else{logger[_0x3ab3('0x9')](_0x3ab3('0xa'),_0x54a9a2,_0x3ab3('0xd'));_0x277d51(_0x147228[_0x3ab3('0x11')][_0x3ab3('0x10')]);}})[_0x3ab3('0x12')](function(_0x7ccaf0){logger[_0x3ab3('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x54a9a2,_0x7ccaf0);_0x1ce202(_0x7ccaf0);});});} \ No newline at end of file +var _0x12d7=['request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x12d7,0x181));var _0x712d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x712d('0x0'));var util=require('util');var moment=require(_0x712d('0x1'));var BPromise=require(_0x712d('0x2'));var rs=require(_0x712d('0x3'));var fs=require('fs');var Redis=require(_0x712d('0x4'));var db=require(_0x712d('0x5'))['db'];var utils=require(_0x712d('0x6'));var logger=require('../../config/logger')(_0x712d('0x7'));var config=require(_0x712d('0x8'));var jayson=require(_0x712d('0x9'));var client=jayson[_0x712d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0028,_0x2923c4,_0x80eb6){return new BPromise(function(_0x1dde71,_0x2e32c1){return client[_0x712d('0xb')](_0x4e0028,_0x80eb6)[_0x712d('0xc')](function(_0x3ccad4){logger[_0x712d('0xd')](_0x712d('0xe'),_0x2923c4,_0x712d('0xf'));logger[_0x712d('0x10')](_0x712d('0x11'),_0x2923c4,_0x712d('0xf'),JSON['stringify'](_0x3ccad4));if(_0x3ccad4['error']){if(_0x3ccad4[_0x712d('0x12')]['code']===0x1f4){logger[_0x712d('0x12')](_0x712d('0xe'),_0x2923c4,_0x3ccad4['error']['message']);return _0x2e32c1(_0x3ccad4[_0x712d('0x12')][_0x712d('0x13')]);}logger[_0x712d('0x12')](_0x712d('0xe'),_0x2923c4,_0x3ccad4['error']['message']);return _0x1dde71(_0x3ccad4[_0x712d('0x12')][_0x712d('0x13')]);}else{logger[_0x712d('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2923c4,_0x712d('0xf'));_0x1dde71(_0x3ccad4[_0x712d('0x14')]['message']);}})[_0x712d('0x15')](function(_0x3572bd){logger[_0x712d('0x12')](_0x712d('0xe'),_0x2923c4,_0x3572bd);_0x2e32c1(_0x3572bd);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 3b41bda..bed5fe5 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 _0x26b4=['get','index','/describe','describe','isAuthenticated','show','post','create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x26b4,0x108));var _0x426b=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x26b4[_0x2b9b7f];return _0x4ed19a;};'use strict';var multer=require(_0x426b('0x0'));var util=require(_0x426b('0x1'));var path=require(_0x426b('0x2'));var timeout=require(_0x426b('0x3'));var express=require(_0x426b('0x4'));var router=express['Router']();var fs_extra=require(_0x426b('0x5'));var auth=require(_0x426b('0x6'));var interaction=require(_0x426b('0x7'));var config=require(_0x426b('0x8'));var controller=require('./chatOfflineMessage.controller');router[_0x426b('0x9')]('/',auth['isAuthenticated'](),controller[_0x426b('0xa')]);router['get'](_0x426b('0xb'),auth['isAuthenticated'](),controller[_0x426b('0xc')]);router[_0x426b('0x9')]('/:id',auth[_0x426b('0xd')](),controller[_0x426b('0xe')]);router[_0x426b('0xf')]('/',auth[_0x426b('0xd')](),controller[_0x426b('0x10')]);router['put'](_0x426b('0x11'),auth[_0x426b('0xd')](),controller[_0x426b('0x12')]);router['delete'](_0x426b('0x11'),auth[_0x426b('0xd')](),controller[_0x426b('0x13')]);module[_0x426b('0x14')]=router; \ No newline at end of file +var _0xe9b1=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','create','update','delete','/:id','destroy','multer'];(function(_0x205e1f,_0x12cc1d){var _0x505ea0=function(_0x3afa28){while(--_0x3afa28){_0x205e1f['push'](_0x205e1f['shift']());}};_0x505ea0(++_0x12cc1d);}(_0xe9b1,0x92));var _0x1e9b=function(_0x5a585b,_0x3e0674){_0x5a585b=_0x5a585b-0x0;var _0x4cd398=_0xe9b1[_0x5a585b];return _0x4cd398;};'use strict';var multer=require(_0x1e9b('0x0'));var util=require(_0x1e9b('0x1'));var path=require(_0x1e9b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e9b('0x3')]();var fs_extra=require(_0x1e9b('0x4'));var auth=require(_0x1e9b('0x5'));var interaction=require(_0x1e9b('0x6'));var config=require(_0x1e9b('0x7'));var controller=require(_0x1e9b('0x8'));router[_0x1e9b('0x9')]('/',auth[_0x1e9b('0xa')](),controller[_0x1e9b('0xb')]);router[_0x1e9b('0x9')](_0x1e9b('0xc'),auth[_0x1e9b('0xa')](),controller[_0x1e9b('0xd')]);router[_0x1e9b('0x9')]('/:id',auth[_0x1e9b('0xa')](),controller[_0x1e9b('0xe')]);router[_0x1e9b('0xf')]('/',auth[_0x1e9b('0xa')](),controller[_0x1e9b('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1e9b('0x11')]);router[_0x1e9b('0x12')](_0x1e9b('0x13'),auth[_0x1e9b('0xa')](),controller[_0x1e9b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 80db0c6..e8c62ee 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 _0xbee0=['sequelize','STRING','ENUM','mouseOver','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbee0,0x11d));var _0x0bee=function(_0x8dd6d5,_0x33ddef){_0x8dd6d5=_0x8dd6d5-0x0;var _0x432c03=_0xbee0[_0x8dd6d5];return _0x432c03;};'use strict';var Sequelize=require(_0x0bee('0x0'));module['exports']={'name':{'type':Sequelize[_0x0bee('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0bee('0x2')](_0x0bee('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x0bee('0x1')]},'timeout':{'type':Sequelize[_0x0bee('0x4')]}}; \ No newline at end of file +var _0x660e=['sequelize','exports','STRING','ENUM','mouseOver','INTEGER'];(function(_0x4f26f0,_0x559017){var _0x57a1aa=function(_0x4a644f){while(--_0x4a644f){_0x4f26f0['push'](_0x4f26f0['shift']());}};_0x57a1aa(++_0x559017);}(_0x660e,0x1b0));var _0xe660=function(_0x183608,_0x3302fd){_0x183608=_0x183608-0x0;var _0x292e43=_0x660e[_0x183608];return _0x292e43;};'use strict';var Sequelize=require(_0xe660('0x0'));module[_0xe660('0x1')]={'name':{'type':Sequelize[_0xe660('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe660('0x3')](_0xe660('0x4'),'timeout'),'defaultValue':_0xe660('0x4')},'selector':{'type':Sequelize[_0xe660('0x2')]},'timeout':{'type':Sequelize[_0xe660('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 082a96d..978c704 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 _0x0d4e=['fields','length','includeAll','include','merge','options','find','catch','create','body','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/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','count','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','keys','ChatProactiveAction','query','filters','intersection','attributes'];(function(_0x265045,_0x1a12b8){var _0xaafbb1=function(_0x5366b2){while(--_0x5366b2){_0x265045['push'](_0x265045['shift']());}};_0xaafbb1(++_0x1a12b8);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x0d4e[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0xe0d4('0x0'));var rimraf=require(_0xe0d4('0x1'));var zipdir=require(_0xe0d4('0x2'));var jsonpatch=require(_0xe0d4('0x3'));var rp=require(_0xe0d4('0x4'));var moment=require(_0xe0d4('0x5'));var BPromise=require(_0xe0d4('0x6'));var Mustache=require(_0xe0d4('0x7'));var util=require(_0xe0d4('0x8'));var path=require('path');var sox=require(_0xe0d4('0x9'));var csv=require(_0xe0d4('0xa'));var ejs=require(_0xe0d4('0xb'));var fs=require('fs');var fs_extra=require(_0xe0d4('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe0d4('0xd'));var jsforce=require(_0xe0d4('0xe'));var deskjs=require(_0xe0d4('0xf'));var toCsv=require(_0xe0d4('0xa'));var querystring=require(_0xe0d4('0x10'));var Papa=require(_0xe0d4('0x11'));var Redis=require(_0xe0d4('0x12'));var authService=require(_0xe0d4('0x13'));var qs=require(_0xe0d4('0x14'));var as=require(_0xe0d4('0x15'));var hardwareService=require(_0xe0d4('0x16'));var logger=require(_0xe0d4('0x17'))(_0xe0d4('0x18'));var utils=require('../../config/utils');var config=require(_0xe0d4('0x19'));var licenseUtil=require(_0xe0d4('0x1a'));var db=require(_0xe0d4('0x1b'))['db'];function respondWithStatusCode(_0x258e16,_0x34bce6){_0x34bce6=_0x34bce6||0xcc;return function(_0x2561b5){if(_0x2561b5){return _0x258e16[_0xe0d4('0x1c')](_0x34bce6);}return _0x258e16[_0xe0d4('0x1d')](_0x34bce6)[_0xe0d4('0x1e')]();};}function respondWithResult(_0x161175,_0x3bbfd3){_0x3bbfd3=_0x3bbfd3||0xc8;return function(_0x42db0e){if(_0x42db0e){return _0x161175[_0xe0d4('0x1d')](_0x3bbfd3)[_0xe0d4('0x1f')](_0x42db0e);}};}function respondWithFilteredResult(_0x3a2a41,_0x4d536f){return function(_0x25b833){if(_0x25b833){var _0x3c0986=typeof _0x4d536f[_0xe0d4('0x20')]==='undefined'&&typeof _0x4d536f['limit']===_0xe0d4('0x21');var _0x252b69=_0x25b833[_0xe0d4('0x22')];var _0x174bfa=_0x3c0986?0x0:_0x4d536f[_0xe0d4('0x20')];var _0x58bd0a=_0x3c0986?_0x25b833[_0xe0d4('0x22')]:_0x4d536f[_0xe0d4('0x20')]+_0x4d536f[_0xe0d4('0x23')];var _0x20795b;if(_0x58bd0a>=_0x252b69){_0x58bd0a=_0x252b69;_0x20795b=0xc8;}else{_0x20795b=0xce;}_0x3a2a41[_0xe0d4('0x1d')](_0x20795b);return _0x3a2a41['set'](_0xe0d4('0x24'),_0x174bfa+'-'+_0x58bd0a+'/'+_0x252b69)['json'](_0x25b833);}return null;};}function patchUpdates(_0x533a85){return function(_0x795cf5){try{jsonpatch[_0xe0d4('0x25')](_0x795cf5,_0x533a85,!![]);}catch(_0x20c2c8){return BPromise['reject'](_0x20c2c8);}return _0x795cf5[_0xe0d4('0x26')]();};}function saveUpdates(_0x4527e9,_0x7e5713){return function(_0xb97419){if(_0xb97419){return _0xb97419[_0xe0d4('0x27')](_0x4527e9)[_0xe0d4('0x28')](function(_0x1e13bf){return _0x1e13bf;});}return null;};}function removeEntity(_0x18613d,_0x51adfc){return function(_0x4bfdef){if(_0x4bfdef){return _0x4bfdef[_0xe0d4('0x29')]()[_0xe0d4('0x28')](function(){_0x18613d['status'](0xcc)[_0xe0d4('0x1e')]();});}};}function handleEntityNotFound(_0x48cdef,_0x13c108){return function(_0x9fc63d){if(!_0x9fc63d){_0x48cdef[_0xe0d4('0x1c')](0x194);}return _0x9fc63d;};}function handleError(_0x4becc8,_0x3fe0c9){_0x3fe0c9=_0x3fe0c9||0x1f4;return function(_0x525088){logger['error'](_0x525088[_0xe0d4('0x2a')]);if(_0x525088[_0xe0d4('0x2b')]){delete _0x525088[_0xe0d4('0x2b')];}_0x4becc8[_0xe0d4('0x1d')](_0x3fe0c9)[_0xe0d4('0x2c')](_0x525088);};}exports[_0xe0d4('0x2d')]=function(_0xcae18f,_0x12089c){var _0xe65b15={'raw':!![],'where':{'id':_0xcae18f[_0xe0d4('0x2e')]['id']}},_0x4573ee={};_0x4573ee[_0xe0d4('0x2f')]=_[_0xe0d4('0x30')](db[_0xe0d4('0x31')]['rawAttributes']);_0x4573ee[_0xe0d4('0x32')]=_['keys'](_0xcae18f[_0xe0d4('0x32')]);_0x4573ee[_0xe0d4('0x33')]=_[_0xe0d4('0x34')](_0x4573ee[_0xe0d4('0x2f')],_0x4573ee[_0xe0d4('0x32')]);_0xe65b15[_0xe0d4('0x35')]=_[_0xe0d4('0x34')](_0x4573ee[_0xe0d4('0x2f')],qs[_0xe0d4('0x36')](_0xcae18f[_0xe0d4('0x32')][_0xe0d4('0x36')]));_0xe65b15[_0xe0d4('0x35')]=_0xe65b15['attributes'][_0xe0d4('0x37')]?_0xe65b15['attributes']:_0x4573ee[_0xe0d4('0x2f')];if(_0xcae18f['query'][_0xe0d4('0x38')]){_0xe65b15[_0xe0d4('0x39')]=[{'all':!![]}];}_0xe65b15=_[_0xe0d4('0x3a')]({},_0xe65b15,_0xcae18f[_0xe0d4('0x3b')]);return db['ChatProactiveAction'][_0xe0d4('0x3c')](_0xe65b15)[_0xe0d4('0x28')](handleEntityNotFound(_0x12089c,null))[_0xe0d4('0x28')](respondWithResult(_0x12089c,null))[_0xe0d4('0x3d')](handleError(_0x12089c,null));};exports[_0xe0d4('0x3e')]=function(_0xb845dc,_0x1932c2){return db[_0xe0d4('0x31')][_0xe0d4('0x3e')](_0xb845dc['body'],{})[_0xe0d4('0x28')](respondWithResult(_0x1932c2,0xc9))[_0xe0d4('0x3d')](handleError(_0x1932c2,null));};exports['update']=function(_0x2042ae,_0x396fe2){if(_0x2042ae[_0xe0d4('0x3f')]['id']){delete _0x2042ae[_0xe0d4('0x3f')]['id'];}return db[_0xe0d4('0x31')][_0xe0d4('0x3c')]({'where':{'id':_0x2042ae['params']['id']}})[_0xe0d4('0x28')](handleEntityNotFound(_0x396fe2,null))['then'](saveUpdates(_0x2042ae['body'],null))['then'](respondWithResult(_0x396fe2,null))[_0xe0d4('0x3d')](handleError(_0x396fe2,null));};exports[_0xe0d4('0x29')]=function(_0x1bd6e8,_0xd732fc){return db[_0xe0d4('0x31')]['find']({'where':{'id':_0x1bd6e8['params']['id']}})[_0xe0d4('0x28')](handleEntityNotFound(_0xd732fc,null))[_0xe0d4('0x28')](removeEntity(_0xd732fc,null))[_0xe0d4('0x3d')](handleError(_0xd732fc,null));}; \ No newline at end of file +var _0x20d7=['limit','undefined','count','Content-Range','json','reject','update','error','stack','name','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','then','create','body','catch','destroy','zip-dir','fast-json-patch','request-promise','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x20d7,0x146));var _0x720d=function(_0x96eb37,_0x3f9f23){_0x96eb37=_0x96eb37-0x0;var _0xa04f6e=_0x20d7[_0x96eb37];return _0xa04f6e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x720d('0x0'));var jsonpatch=require(_0x720d('0x1'));var rp=require(_0x720d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x720d('0x3'));var path=require(_0x720d('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x720d('0x5'));var _=require('lodash');var squel=require(_0x720d('0x6'));var crypto=require(_0x720d('0x7'));var jsforce=require(_0x720d('0x8'));var deskjs=require(_0x720d('0x9'));var toCsv=require(_0x720d('0xa'));var querystring=require(_0x720d('0xb'));var Papa=require(_0x720d('0xc'));var Redis=require(_0x720d('0xd'));var authService=require(_0x720d('0xe'));var qs=require(_0x720d('0xf'));var as=require(_0x720d('0x10'));var hardwareService=require(_0x720d('0x11'));var logger=require(_0x720d('0x12'))(_0x720d('0x13'));var utils=require(_0x720d('0x14'));var config=require(_0x720d('0x15'));var licenseUtil=require(_0x720d('0x16'));var db=require(_0x720d('0x17'))['db'];function respondWithStatusCode(_0x1abbf9,_0x555f4f){_0x555f4f=_0x555f4f||0xcc;return function(_0x28daea){if(_0x28daea){return _0x1abbf9[_0x720d('0x18')](_0x555f4f);}return _0x1abbf9[_0x720d('0x19')](_0x555f4f)[_0x720d('0x1a')]();};}function respondWithResult(_0x2c3c4e,_0x3eb77b){_0x3eb77b=_0x3eb77b||0xc8;return function(_0x2e0ecd){if(_0x2e0ecd){return _0x2c3c4e[_0x720d('0x19')](_0x3eb77b)['json'](_0x2e0ecd);}};}function respondWithFilteredResult(_0x408dff,_0x561445){return function(_0x48c460){if(_0x48c460){var _0x5af38e=typeof _0x561445[_0x720d('0x1b')]==='undefined'&&typeof _0x561445[_0x720d('0x1c')]===_0x720d('0x1d');var _0x443443=_0x48c460[_0x720d('0x1e')];var _0x302562=_0x5af38e?0x0:_0x561445[_0x720d('0x1b')];var _0x134394=_0x5af38e?_0x48c460['count']:_0x561445[_0x720d('0x1b')]+_0x561445[_0x720d('0x1c')];var _0x243dce;if(_0x134394>=_0x443443){_0x134394=_0x443443;_0x243dce=0xc8;}else{_0x243dce=0xce;}_0x408dff[_0x720d('0x19')](_0x243dce);return _0x408dff['set'](_0x720d('0x1f'),_0x302562+'-'+_0x134394+'/'+_0x443443)[_0x720d('0x20')](_0x48c460);}return null;};}function patchUpdates(_0x3c09c2){return function(_0x3237c2){try{jsonpatch['apply'](_0x3237c2,_0x3c09c2,!![]);}catch(_0x26b78f){return BPromise[_0x720d('0x21')](_0x26b78f);}return _0x3237c2['save']();};}function saveUpdates(_0x318c23,_0x28690b){return function(_0x1cbe26){if(_0x1cbe26){return _0x1cbe26[_0x720d('0x22')](_0x318c23)['then'](function(_0x3be62e){return _0x3be62e;});}return null;};}function removeEntity(_0x5d27ea,_0x341bcc){return function(_0x466b1d){if(_0x466b1d){return _0x466b1d['destroy']()['then'](function(){_0x5d27ea[_0x720d('0x19')](0xcc)[_0x720d('0x1a')]();});}};}function handleEntityNotFound(_0x5d31ac,_0x2f6d4f){return function(_0x3acb8b){if(!_0x3acb8b){_0x5d31ac[_0x720d('0x18')](0x194);}return _0x3acb8b;};}function handleError(_0x4f44e3,_0xa400f8){_0xa400f8=_0xa400f8||0x1f4;return function(_0x2b7ed4){logger[_0x720d('0x23')](_0x2b7ed4[_0x720d('0x24')]);if(_0x2b7ed4[_0x720d('0x25')]){delete _0x2b7ed4['name'];}_0x4f44e3[_0x720d('0x19')](_0xa400f8)['send'](_0x2b7ed4);};}exports['show']=function(_0x260820,_0x22c161){var _0x4d9778={'raw':!![],'where':{'id':_0x260820[_0x720d('0x26')]['id']}},_0x4b76bd={};_0x4b76bd[_0x720d('0x27')]=_[_0x720d('0x28')](db[_0x720d('0x29')][_0x720d('0x2a')]);_0x4b76bd[_0x720d('0x2b')]=_['keys'](_0x260820[_0x720d('0x2b')]);_0x4b76bd[_0x720d('0x2c')]=_[_0x720d('0x2d')](_0x4b76bd[_0x720d('0x27')],_0x4b76bd['query']);_0x4d9778[_0x720d('0x2e')]=_[_0x720d('0x2d')](_0x4b76bd[_0x720d('0x27')],qs[_0x720d('0x2f')](_0x260820[_0x720d('0x2b')][_0x720d('0x2f')]));_0x4d9778['attributes']=_0x4d9778[_0x720d('0x2e')][_0x720d('0x30')]?_0x4d9778[_0x720d('0x2e')]:_0x4b76bd['model'];if(_0x260820[_0x720d('0x2b')][_0x720d('0x31')]){_0x4d9778[_0x720d('0x32')]=[{'all':!![]}];}_0x4d9778=_[_0x720d('0x33')]({},_0x4d9778,_0x260820[_0x720d('0x34')]);return db[_0x720d('0x29')][_0x720d('0x35')](_0x4d9778)[_0x720d('0x36')](handleEntityNotFound(_0x22c161,null))[_0x720d('0x36')](respondWithResult(_0x22c161,null))['catch'](handleError(_0x22c161,null));};exports[_0x720d('0x37')]=function(_0x41325b,_0x3ede58){return db['ChatProactiveAction'][_0x720d('0x37')](_0x41325b[_0x720d('0x38')],{})[_0x720d('0x36')](respondWithResult(_0x3ede58,0xc9))['catch'](handleError(_0x3ede58,null));};exports[_0x720d('0x22')]=function(_0x3ac007,_0x5be2a8){if(_0x3ac007[_0x720d('0x38')]['id']){delete _0x3ac007[_0x720d('0x38')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x3ac007['params']['id']}})['then'](handleEntityNotFound(_0x5be2a8,null))[_0x720d('0x36')](saveUpdates(_0x3ac007[_0x720d('0x38')],null))[_0x720d('0x36')](respondWithResult(_0x5be2a8,null))[_0x720d('0x39')](handleError(_0x5be2a8,null));};exports[_0x720d('0x3a')]=function(_0x1b401f,_0x306f63){return db[_0x720d('0x29')][_0x720d('0x35')]({'where':{'id':_0x1b401f[_0x720d('0x26')]['id']}})['then'](handleEntityNotFound(_0x306f63,null))['then'](removeEntity(_0x306f63,null))[_0x720d('0x39')](handleError(_0x306f63,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 1925e7b..3a37845 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 _0xd8b2=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x2dc635,_0xaafc6b){var _0x4d0d70=function(_0x1cd15d){while(--_0x1cd15d){_0x2dc635['push'](_0x2dc635['shift']());}};_0x4d0d70(++_0xaafc6b);}(_0xd8b2,0xbb));var _0x2d8b=function(_0x1a0f55,_0x4dc9d2){_0x1a0f55=_0x1a0f55-0x0;var _0x2a6630=_0xd8b2[_0x1a0f55];return _0x2a6630;};'use strict';var _=require('lodash');var util=require(_0x2d8b('0x0'));var logger=require('../../config/logger')(_0x2d8b('0x1'));var moment=require('moment');var BPromise=require(_0x2d8b('0x2'));var rp=require(_0x2d8b('0x3'));var fs=require('fs');var path=require(_0x2d8b('0x4'));var rimraf=require(_0x2d8b('0x5'));var config=require(_0x2d8b('0x6'));var attributes=require('./chatProactiveAction.attributes');module[_0x2d8b('0x7')]=function(_0x184db6,_0x30ea90){return _0x184db6[_0x2d8b('0x8')](_0x2d8b('0x9'),attributes,{'tableName':_0x2d8b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c23=['exports','define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x273dc3,_0x3d8d20){var _0x3dad14=function(_0x4b4a09){while(--_0x4b4a09){_0x273dc3['push'](_0x273dc3['shift']());}};_0x3dad14(++_0x3d8d20);}(_0x6c23,0x13c));var _0x36c2=function(_0x5d8b05,_0x3fe969){_0x5d8b05=_0x5d8b05-0x0;var _0x24b9b5=_0x6c23[_0x5d8b05];return _0x24b9b5;};'use strict';var _=require('lodash');var util=require(_0x36c2('0x0'));var logger=require(_0x36c2('0x1'))(_0x36c2('0x2'));var moment=require(_0x36c2('0x3'));var BPromise=require(_0x36c2('0x4'));var rp=require(_0x36c2('0x5'));var fs=require('fs');var path=require(_0x36c2('0x6'));var rimraf=require(_0x36c2('0x7'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x36c2('0x8')]=function(_0x423ef3,_0xe4415c){return _0x423ef3[_0x36c2('0x9')](_0x36c2('0xa'),attributes,{'tableName':_0x36c2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 4d71fe0..9f3346b 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 _0x0cd5=['request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x0cd5,0x19c));var _0x50cd=function(_0x1c3c59,_0x5f251a){_0x1c3c59=_0x1c3c59-0x0;var _0x1100b7=_0x0cd5[_0x1c3c59];return _0x1100b7;};'use strict';var _=require(_0x50cd('0x0'));var util=require(_0x50cd('0x1'));var moment=require(_0x50cd('0x2'));var BPromise=require(_0x50cd('0x3'));var rs=require(_0x50cd('0x4'));var fs=require('fs');var Redis=require(_0x50cd('0x5'));var db=require(_0x50cd('0x6'))['db'];var utils=require(_0x50cd('0x7'));var logger=require(_0x50cd('0x8'))(_0x50cd('0x9'));var config=require('../../config/environment');var jayson=require(_0x50cd('0xa'));var client=jayson[_0x50cd('0xb')][_0x50cd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a0c77,_0x3af4f3,_0x4e0c92){return new BPromise(function(_0x21a579,_0x345dac){return client[_0x50cd('0xd')](_0x1a0c77,_0x4e0c92)[_0x50cd('0xe')](function(_0x39965c){logger[_0x50cd('0xf')](_0x50cd('0x10'),_0x3af4f3,_0x50cd('0x11'));logger[_0x50cd('0x12')](_0x50cd('0x13'),_0x3af4f3,_0x50cd('0x11'),JSON[_0x50cd('0x14')](_0x39965c));if(_0x39965c[_0x50cd('0x15')]){if(_0x39965c['error'][_0x50cd('0x16')]===0x1f4){logger['error'](_0x50cd('0x10'),_0x3af4f3,_0x39965c[_0x50cd('0x15')]['message']);return _0x345dac(_0x39965c[_0x50cd('0x15')]['message']);}logger[_0x50cd('0x15')](_0x50cd('0x10'),_0x3af4f3,_0x39965c['error'][_0x50cd('0x17')]);return _0x21a579(_0x39965c[_0x50cd('0x15')][_0x50cd('0x17')]);}else{logger['info'](_0x50cd('0x10'),_0x3af4f3,_0x50cd('0x11'));_0x21a579(_0x39965c['result']['message']);}})[_0x50cd('0x18')](function(_0x1644aa){logger[_0x50cd('0x15')](_0x50cd('0x10'),_0x3af4f3,_0x1644aa);_0x345dac(_0x1644aa);});});} \ No newline at end of file +var _0x2437=['request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x2437,0x1bf));var _0x7243=function(_0x5598a4,_0x49f787){_0x5598a4=_0x5598a4-0x0;var _0x1923b6=_0x2437[_0x5598a4];return _0x1923b6;};'use strict';var _=require('lodash');var util=require(_0x7243('0x0'));var moment=require(_0x7243('0x1'));var BPromise=require('bluebird');var rs=require(_0x7243('0x2'));var fs=require('fs');var Redis=require(_0x7243('0x3'));var db=require(_0x7243('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7243('0x5'));var config=require('../../config/environment');var jayson=require(_0x7243('0x6'));var client=jayson[_0x7243('0x7')][_0x7243('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e9857,_0x2e4519,_0x7b9cd4){return new BPromise(function(_0x21623b,_0xe39c08){return client[_0x7243('0x9')](_0x3e9857,_0x7b9cd4)['then'](function(_0x11d537){logger[_0x7243('0xa')](_0x7243('0xb'),_0x2e4519,'request\x20sent');logger['debug'](_0x7243('0xc'),_0x2e4519,_0x7243('0xd'),JSON[_0x7243('0xe')](_0x11d537));if(_0x11d537[_0x7243('0xf')]){if(_0x11d537['error'][_0x7243('0x10')]===0x1f4){logger[_0x7243('0xf')](_0x7243('0xb'),_0x2e4519,_0x11d537[_0x7243('0xf')][_0x7243('0x11')]);return _0xe39c08(_0x11d537[_0x7243('0xf')][_0x7243('0x11')]);}logger[_0x7243('0xf')](_0x7243('0xb'),_0x2e4519,_0x11d537[_0x7243('0xf')][_0x7243('0x11')]);return _0x21623b(_0x11d537[_0x7243('0xf')][_0x7243('0x11')]);}else{logger[_0x7243('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x2e4519,_0x7243('0xd'));_0x21623b(_0x11d537[_0x7243('0x12')]['message']);}})[_0x7243('0x13')](function(_0x34eab3){logger[_0x7243('0xf')](_0x7243('0xb'),_0x2e4519,_0x34eab3);_0xe39c08(_0x34eab3);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 254f0ed..b66c50b 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 _0x5fd1=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','multer','path','connect-timeout','express'];(function(_0x4bacaf,_0xf16fd5){var _0x17dba6=function(_0x1e9bda){while(--_0x1e9bda){_0x4bacaf['push'](_0x4bacaf['shift']());}};_0x17dba6(++_0xf16fd5);}(_0x5fd1,0x155));var _0x15fd=function(_0x3bbe7a,_0x535a60){_0x3bbe7a=_0x3bbe7a-0x0;var _0x38a7aa=_0x5fd1[_0x3bbe7a];return _0x38a7aa;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require(_0x15fd('0x1'));var timeout=require(_0x15fd('0x2'));var express=require(_0x15fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x15fd('0x4'));var interaction=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x15fd('0x7')](_0x15fd('0x8'),auth[_0x15fd('0x9')](),controller[_0x15fd('0xa')]);router[_0x15fd('0xb')]('/',auth['isAuthenticated'](),controller[_0x15fd('0xc')]);router[_0x15fd('0xd')](_0x15fd('0x8'),auth['isAuthenticated'](),controller[_0x15fd('0xe')]);router['delete'](_0x15fd('0x8'),auth[_0x15fd('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8ef6=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','show','post','isAuthenticated','put','/:id','update','delete'];(function(_0x2f50b6,_0xd09fe3){var _0x54b027=function(_0x680941){while(--_0x680941){_0x2f50b6['push'](_0x2f50b6['shift']());}};_0x54b027(++_0xd09fe3);}(_0x8ef6,0xf2));var _0x68ef=function(_0x56c585,_0x45c4f1){_0x56c585=_0x56c585-0x0;var _0xc8da37=_0x8ef6[_0x56c585];return _0xc8da37;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x68ef('0xb')]);router[_0x68ef('0xc')]('/',auth[_0x68ef('0xd')](),controller['create']);router[_0x68ef('0xe')](_0x68ef('0xf'),auth[_0x68ef('0xd')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')](_0x68ef('0xf'),auth[_0x68ef('0xd')](),controller[_0x68ef('0x12')]);module[_0x68ef('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index e19e573..2d3f843 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 _0xee13=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','ENUM'];(function(_0x13d4aa,_0x94fb0e){var _0x1ebce0=function(_0x4b27bb){while(--_0x4b27bb){_0x13d4aa['push'](_0x13d4aa['shift']());}};_0x1ebce0(++_0x94fb0e);}(_0xee13,0x11b));var _0x3ee1=function(_0xd18b44,_0x373993){_0xd18b44=_0xd18b44-0x0;var _0x8cf898=_0xee13[_0xd18b44];return _0x8cf898;};'use strict';var Sequelize=require(_0x3ee1('0x0'));module[_0x3ee1('0x1')]={'name':{'type':Sequelize[_0x3ee1('0x2')],'unique':_0x3ee1('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3ee1('0x4')](_0x3ee1('0x5'),_0x3ee1('0x6'),_0x3ee1('0x7'))}}; \ No newline at end of file +var _0xa877=['STRING','name','rrmemory','beepall','roundrobin','exports'];(function(_0x140e85,_0x5834c5){var _0xd7b268=function(_0x3edca4){while(--_0x3edca4){_0x140e85['push'](_0x140e85['shift']());}};_0xd7b268(++_0x5834c5);}(_0xa877,0x173));var _0x7a87=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa877[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x7a87('0x0')]={'name':{'type':Sequelize[_0x7a87('0x1')],'unique':_0x7a87('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7a87('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7a87('0x3'),_0x7a87('0x4'),_0x7a87('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index ab45090..c96b790 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 _0xf0d0=['union','compact','removeAgents','userChatQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','./chatQueue.socket','register','jayson/promise','client','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','json','undefined','limit','count','offset','apply','reject','save','update','destroy','ChatQueues','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','VIRTUAL','filter','merge','ChatQueue','includeAll','include','findAll','rows','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','get','UserChatQueue','pick','ChatQueueId','User','agent','chatPause','updatedAt','format','SIP','order','getTeams','addTeams','ids','Agents','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','clone','push','sequelize','toString','SELECT','every','includes','all'];(function(_0x3f3a47,_0x28f84b){var _0x57a682=function(_0x1175d3){while(--_0x1175d3){_0x3f3a47['push'](_0x3f3a47['shift']());}};_0x57a682(++_0x28f84b);}(_0xf0d0,0x1bb));var _0x0f0d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0d0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0f0d('0x0'));var rimraf=require(_0x0f0d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f0d('0x2'));var rp=require(_0x0f0d('0x3'));var moment=require(_0x0f0d('0x4'));var BPromise=require(_0x0f0d('0x5'));var Mustache=require('mustache');var util=require(_0x0f0d('0x6'));var path=require(_0x0f0d('0x7'));var sox=require(_0x0f0d('0x8'));var csv=require(_0x0f0d('0x9'));var ejs=require(_0x0f0d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0f0d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0f0d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0f0d('0xd'));var Papa=require('papaparse');var Redis=require(_0x0f0d('0xe'));var authService=require(_0x0f0d('0xf'));var qs=require(_0x0f0d('0x10'));var as=require(_0x0f0d('0x11'));var hardwareService=require(_0x0f0d('0x12'));var logger=require('../../config/logger')(_0x0f0d('0x13'));var utils=require(_0x0f0d('0x14'));var config=require(_0x0f0d('0x15'));var licenseUtil=require(_0x0f0d('0x16'));var db=require('../../mysqldb')['db'];config[_0x0f0d('0x17')]=_['defaults'](config[_0x0f0d('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f0d('0x17')]));require(_0x0f0d('0x18'))[_0x0f0d('0x19')](socket);var jayson=require(_0x0f0d('0x1a'));var client=jayson[_0x0f0d('0x1b')][_0x0f0d('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x11ed7f,_0x3ac0ac,_0xc76253,_0x3455a4){return new BPromise(function(_0x25879b,_0x320822){var _0x212d6e=_0x3455a4||client;return _0x212d6e['request'](_0x11ed7f,_0xc76253)[_0x0f0d('0x1d')](function(_0x5c7aab){logger[_0x0f0d('0x1e')](_0x0f0d('0x1f'),_0x3ac0ac,_0x0f0d('0x20'));logger[_0x0f0d('0x21')](_0x0f0d('0x22'),_0x3ac0ac,_0x0f0d('0x20'),JSON[_0x0f0d('0x23')](_0x5c7aab));if(_0x5c7aab[_0x0f0d('0x24')]){if(_0x5c7aab[_0x0f0d('0x24')][_0x0f0d('0x25')]===0x1f4){logger[_0x0f0d('0x24')]('ChatQueue,\x20%s,\x20%s',_0x3ac0ac,_0x5c7aab[_0x0f0d('0x24')][_0x0f0d('0x26')]);return _0x320822(_0x5c7aab[_0x0f0d('0x24')][_0x0f0d('0x26')]);}logger[_0x0f0d('0x24')](_0x0f0d('0x1f'),_0x3ac0ac,_0x5c7aab['error'][_0x0f0d('0x26')]);return _0x25879b(_0x5c7aab[_0x0f0d('0x24')][_0x0f0d('0x26')]);}else{logger[_0x0f0d('0x1e')](_0x0f0d('0x1f'),_0x3ac0ac,_0x0f0d('0x20'));_0x25879b(_0x5c7aab['result'][_0x0f0d('0x26')]);}})[_0x0f0d('0x27')](function(_0x2c030b){logger[_0x0f0d('0x24')](_0x0f0d('0x1f'),_0x3ac0ac,_0x2c030b);_0x320822(_0x2c030b);});});}function respondWithStatusCode(_0x1f5944,_0x2f144a){_0x2f144a=_0x2f144a||0xcc;return function(_0x432f1e){if(_0x432f1e){return _0x1f5944['sendStatus'](_0x2f144a);}return _0x1f5944['status'](_0x2f144a)[_0x0f0d('0x28')]();};}function respondWithResult(_0x575e35,_0x5a3aab){_0x5a3aab=_0x5a3aab||0xc8;return function(_0x38c642){if(_0x38c642){return _0x575e35[_0x0f0d('0x29')](_0x5a3aab)[_0x0f0d('0x2a')](_0x38c642);}};}function respondWithFilteredResult(_0x1dbc53,_0x563d09){return function(_0x5d490b){if(_0x5d490b){var _0x4e537a=typeof _0x563d09['offset']===_0x0f0d('0x2b')&&typeof _0x563d09[_0x0f0d('0x2c')]==='undefined';var _0x4ae4ac=_0x5d490b[_0x0f0d('0x2d')];var _0x3a2b5f=_0x4e537a?0x0:_0x563d09['offset'];var _0x4993ec=_0x4e537a?_0x5d490b['count']:_0x563d09[_0x0f0d('0x2e')]+_0x563d09[_0x0f0d('0x2c')];var _0x3162ea;if(_0x4993ec>=_0x4ae4ac){_0x4993ec=_0x4ae4ac;_0x3162ea=0xc8;}else{_0x3162ea=0xce;}_0x1dbc53['status'](_0x3162ea);return _0x1dbc53['set']('Content-Range',_0x3a2b5f+'-'+_0x4993ec+'/'+_0x4ae4ac)[_0x0f0d('0x2a')](_0x5d490b);}return null;};}function patchUpdates(_0x24d2c2){return function(_0x363435){try{jsonpatch[_0x0f0d('0x2f')](_0x363435,_0x24d2c2,!![]);}catch(_0x30fba0){return BPromise[_0x0f0d('0x30')](_0x30fba0);}return _0x363435[_0x0f0d('0x31')]();};}function saveUpdates(_0x457465,_0x16c194){return function(_0x18dfa1){if(_0x18dfa1){return _0x18dfa1[_0x0f0d('0x32')](_0x457465)[_0x0f0d('0x1d')](function(_0x431139){return _0x431139;});}return null;};}function removeEntity(_0x5a36f9,_0xa21260){return function(_0x2110f5){if(_0x2110f5){return _0x2110f5[_0x0f0d('0x33')]()[_0x0f0d('0x1d')](function(){var _0x503945=_0x2110f5['get']({'plain':!![]});var _0x287957=_0x0f0d('0x34');return db['UserProfileResource'][_0x0f0d('0x33')]({'where':{'type':_0x287957,'resourceId':_0x503945['id']}})[_0x0f0d('0x1d')](function(){return _0x2110f5;});})[_0x0f0d('0x1d')](function(){_0x5a36f9[_0x0f0d('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e79b0,_0x57a530){return function(_0xe573b0){if(!_0xe573b0){_0x1e79b0[_0x0f0d('0x35')](0x194);}return _0xe573b0;};}function handleError(_0x54c714,_0x3d4e58){_0x3d4e58=_0x3d4e58||0x1f4;return function(_0x328ed7){logger[_0x0f0d('0x24')](_0x328ed7[_0x0f0d('0x36')]);if(_0x328ed7[_0x0f0d('0x37')]){delete _0x328ed7[_0x0f0d('0x37')];}_0x54c714['status'](_0x3d4e58)[_0x0f0d('0x38')](_0x328ed7);};}exports[_0x0f0d('0x39')]=function(_0xdf5f17,_0x570dd5){var _0x5c4f4c={},_0x18738b={},_0x53c717={'count':0x0,'rows':[]};var _0x564ac2=_[_0x0f0d('0x3a')](db['ChatQueue'][_0x0f0d('0x3b')],function(_0x3b690d){return{'name':_0x3b690d[_0x0f0d('0x3c')],'type':_0x3b690d[_0x0f0d('0x3d')]['key']};});_0x18738b[_0x0f0d('0x3e')]=_['map'](_0x564ac2,_0x0f0d('0x37'));_0x18738b[_0x0f0d('0x3f')]=_[_0x0f0d('0x40')](_0xdf5f17[_0x0f0d('0x3f')]);_0x18738b['filters']=_[_0x0f0d('0x41')](_0x18738b['model'],_0x18738b['query']);_0x5c4f4c[_0x0f0d('0x42')]=_[_0x0f0d('0x41')](_0x18738b[_0x0f0d('0x3e')],qs[_0x0f0d('0x43')](_0xdf5f17['query'][_0x0f0d('0x43')]));_0x5c4f4c[_0x0f0d('0x42')]=_0x5c4f4c[_0x0f0d('0x42')][_0x0f0d('0x44')]?_0x5c4f4c[_0x0f0d('0x42')]:_0x18738b['model'];if(!_0xdf5f17['query'][_0x0f0d('0x45')](_0x0f0d('0x46'))){_0x5c4f4c[_0x0f0d('0x2c')]=qs['limit'](_0xdf5f17[_0x0f0d('0x3f')][_0x0f0d('0x2c')]);_0x5c4f4c[_0x0f0d('0x2e')]=qs[_0x0f0d('0x2e')](_0xdf5f17[_0x0f0d('0x3f')]['offset']);}_0x5c4f4c['order']=qs[_0x0f0d('0x47')](_0xdf5f17[_0x0f0d('0x3f')]['sort']);_0x5c4f4c[_0x0f0d('0x48')]=qs['filters'](_['pick'](_0xdf5f17[_0x0f0d('0x3f')],_0x18738b[_0x0f0d('0x49')]),_0x564ac2);if(_0xdf5f17[_0x0f0d('0x3f')]['filter']){_0x5c4f4c['where']=_['merge'](_0x5c4f4c[_0x0f0d('0x48')],{'$or':_[_0x0f0d('0x3a')](_0x564ac2,function(_0x58b210){if(_0x58b210['type']!==_0x0f0d('0x4a')){var _0x2d3606={};_0x2d3606[_0x58b210['name']]={'$like':'%'+_0xdf5f17[_0x0f0d('0x3f')][_0x0f0d('0x4b')]+'%'};return _0x2d3606;}})});}_0x5c4f4c=_[_0x0f0d('0x4c')]({},_0x5c4f4c,_0xdf5f17['options']);var _0x5920f5={'where':_0x5c4f4c[_0x0f0d('0x48')]};return db[_0x0f0d('0x4d')][_0x0f0d('0x2d')](_0x5920f5)[_0x0f0d('0x1d')](function(_0x2af232){_0x53c717[_0x0f0d('0x2d')]=_0x2af232;if(_0xdf5f17[_0x0f0d('0x3f')][_0x0f0d('0x4e')]){_0x5c4f4c[_0x0f0d('0x4f')]=[{'all':!![]}];}return db['ChatQueue'][_0x0f0d('0x50')](_0x5c4f4c);})[_0x0f0d('0x1d')](function(_0x3d8f92){_0x53c717[_0x0f0d('0x51')]=_0x3d8f92;return _0x53c717;})['then'](respondWithFilteredResult(_0x570dd5,_0x5c4f4c))['catch'](handleError(_0x570dd5,null));};exports[_0x0f0d('0x52')]=function(_0x143429,_0x215cf6){var _0x4c54c6={'raw':!![],'where':{'id':_0x143429[_0x0f0d('0x53')]['id']}},_0x463857={};_0x463857[_0x0f0d('0x3e')]=_['keys'](db[_0x0f0d('0x4d')][_0x0f0d('0x3b')]);_0x463857[_0x0f0d('0x3f')]=_[_0x0f0d('0x40')](_0x143429[_0x0f0d('0x3f')]);_0x463857[_0x0f0d('0x49')]=_[_0x0f0d('0x41')](_0x463857[_0x0f0d('0x3e')],_0x463857[_0x0f0d('0x3f')]);_0x4c54c6[_0x0f0d('0x42')]=_[_0x0f0d('0x41')](_0x463857[_0x0f0d('0x3e')],qs[_0x0f0d('0x43')](_0x143429[_0x0f0d('0x3f')][_0x0f0d('0x43')]));_0x4c54c6[_0x0f0d('0x42')]=_0x4c54c6[_0x0f0d('0x42')]['length']?_0x4c54c6['attributes']:_0x463857[_0x0f0d('0x3e')];if(_0x143429[_0x0f0d('0x3f')][_0x0f0d('0x4e')]){_0x4c54c6[_0x0f0d('0x4f')]=[{'all':!![]}];}_0x4c54c6=_[_0x0f0d('0x4c')]({},_0x4c54c6,_0x143429[_0x0f0d('0x54')]);return db['ChatQueue']['find'](_0x4c54c6)[_0x0f0d('0x1d')](handleEntityNotFound(_0x215cf6,null))[_0x0f0d('0x1d')](respondWithResult(_0x215cf6,null))[_0x0f0d('0x27')](handleError(_0x215cf6,null));};exports[_0x0f0d('0x55')]=function(_0x26def7,_0x1a0d7e){return db[_0x0f0d('0x4d')][_0x0f0d('0x55')](_0x26def7[_0x0f0d('0x56')],{})[_0x0f0d('0x1d')](function(_0x1d85c3){var _0x54242d=_0x26def7[_0x0f0d('0x57')]['get']({'plain':!![]});if(!_0x54242d)throw new Error(_0x0f0d('0x58'));if(_0x54242d['role']===_0x0f0d('0x57')){var _0xf7aa2c=_0x1d85c3['get']({'plain':!![]});var _0x42473d=_0x0f0d('0x34');return db[_0x0f0d('0x59')][_0x0f0d('0x5a')]({'where':{'name':_0x42473d,'userProfileId':_0x54242d[_0x0f0d('0x5b')]},'raw':!![]})[_0x0f0d('0x1d')](function(_0x525d0f){if(_0x525d0f&&_0x525d0f[_0x0f0d('0x5c')]===0x0){return db[_0x0f0d('0x5d')][_0x0f0d('0x55')]({'name':_0xf7aa2c['name'],'resourceId':_0xf7aa2c['id'],'type':_0x525d0f['name'],'sectionId':_0x525d0f['id']},{})[_0x0f0d('0x1d')](function(){return _0x1d85c3;});}else{return _0x1d85c3;}})['catch'](function(_0x6bcb9a){logger[_0x0f0d('0x24')](_0x0f0d('0x5e'),_0x6bcb9a);throw _0x6bcb9a;});}return _0x1d85c3;})[_0x0f0d('0x1d')](respondWithResult(_0x1a0d7e,0xc9))[_0x0f0d('0x27')](handleError(_0x1a0d7e,null));};exports[_0x0f0d('0x32')]=function(_0x441ed3,_0x3a4a85){if(_0x441ed3[_0x0f0d('0x56')]['id']){delete _0x441ed3[_0x0f0d('0x56')]['id'];}return db[_0x0f0d('0x4d')]['find']({'where':{'id':_0x441ed3[_0x0f0d('0x53')]['id']}})['then'](handleEntityNotFound(_0x3a4a85,null))[_0x0f0d('0x1d')](saveUpdates(_0x441ed3[_0x0f0d('0x56')],null))[_0x0f0d('0x1d')](respondWithResult(_0x3a4a85,null))[_0x0f0d('0x27')](handleError(_0x3a4a85,null));};exports['destroy']=function(_0x308852,_0x4da4de){return db[_0x0f0d('0x4d')]['find']({'where':{'id':_0x308852['params']['id']}})[_0x0f0d('0x1d')](handleEntityNotFound(_0x4da4de,null))[_0x0f0d('0x1d')](removeEntity(_0x4da4de,null))[_0x0f0d('0x27')](handleError(_0x4da4de,null));};exports[_0x0f0d('0x5f')]=function(_0xba3de7,_0x4bdb0f){return db[_0x0f0d('0x4d')][_0x0f0d('0x5f')]()[_0x0f0d('0x1d')](respondWithResult(_0x4bdb0f,null))[_0x0f0d('0x27')](handleError(_0x4bdb0f,null));};exports[_0x0f0d('0x60')]=function(_0x4d9c40,_0x45f1af,_0x16afaf){var _0xbf31d={'raw':!![],'where':{}},_0x209c2b={},_0x575fe7;return db[_0x0f0d('0x4d')][_0x0f0d('0x61')]({'where':{'id':_0x4d9c40[_0x0f0d('0x53')]['id']}})[_0x0f0d('0x1d')](handleEntityNotFound(_0x45f1af,null))[_0x0f0d('0x1d')](function(_0x49f7e2){if(_0x49f7e2){_0x575fe7=_0x49f7e2[_0x0f0d('0x62')]({'plain':!![]});_0x209c2b[_0x0f0d('0x3e')]=_[_0x0f0d('0x40')](db[_0x0f0d('0x63')]['rawAttributes']);_0x209c2b[_0x0f0d('0x3f')]=_['keys'](_0x4d9c40[_0x0f0d('0x3f')]);_0x209c2b['filters']=_[_0x0f0d('0x41')](_0x209c2b[_0x0f0d('0x3e')],_0x209c2b[_0x0f0d('0x3f')]);_0xbf31d['attributes']=_['intersection'](_0x209c2b[_0x0f0d('0x3e')],qs[_0x0f0d('0x43')](_0x4d9c40[_0x0f0d('0x3f')][_0x0f0d('0x43')]));_0xbf31d[_0x0f0d('0x42')]=_0xbf31d[_0x0f0d('0x42')][_0x0f0d('0x44')]?_0xbf31d[_0x0f0d('0x42')]:_0x209c2b[_0x0f0d('0x3e')];if(!_0x4d9c40[_0x0f0d('0x3f')]['hasOwnProperty'](_0x0f0d('0x46'))){_0xbf31d[_0x0f0d('0x2c')]=qs['limit'](_0x4d9c40['query'][_0x0f0d('0x2c')]);_0xbf31d[_0x0f0d('0x2e')]=qs[_0x0f0d('0x2e')](_0x4d9c40['query'][_0x0f0d('0x2e')]);}_0xbf31d['order']=qs[_0x0f0d('0x47')](_0x4d9c40[_0x0f0d('0x3f')][_0x0f0d('0x47')]);_0xbf31d[_0x0f0d('0x48')]=qs[_0x0f0d('0x49')](_[_0x0f0d('0x64')](_0x4d9c40[_0x0f0d('0x3f')],_0x209c2b[_0x0f0d('0x49')]));_0xbf31d['where'][_0x0f0d('0x65')]=_0x49f7e2['id'];if(_0x4d9c40[_0x0f0d('0x3f')]['filter']){_0xbf31d['where']=_[_0x0f0d('0x4c')](_0xbf31d[_0x0f0d('0x48')],{'$or':_[_0x0f0d('0x3a')](_0xbf31d[_0x0f0d('0x42')],function(_0x3bb6fe){var _0x575d0a={};_0x575d0a[_0x3bb6fe]={'$like':'%'+_0x4d9c40['query'][_0x0f0d('0x4b')]+'%'};return _0x575d0a;})});}_0xbf31d=_['merge']({},_0xbf31d,_0x4d9c40[_0x0f0d('0x54')]);return db['UserChatQueue'][_0x0f0d('0x50')](_0xbf31d);}})[_0x0f0d('0x1d')](function(_0x1a5741){if(_0x1a5741){return db[_0x0f0d('0x66')]['findAndCountAll']({'where':{'id':_[_0x0f0d('0x3a')](_0x1a5741,'UserId'),'role':_0x0f0d('0x67')},'attributes':['id',_0x0f0d('0x37'),_0x0f0d('0x68'),_0x0f0d('0x69'),'createdAt']});}})[_0x0f0d('0x1d')](function(_0x4588f6){if(_0x4588f6){return{'count':_0x4588f6[_0x0f0d('0x2d')],'rows':_[_0x0f0d('0x3a')](_0x4588f6['rows'],function(_0x4b3385){return{'membername':_0x4b3385['name'],'UserId':_0x4b3385['id'],'queue_name':_0x575fe7['name'],'ChatQueueId':_0x575fe7['id'],'interface':util[_0x0f0d('0x6a')]('%s/%s',_0x0f0d('0x6b'),_0x4b3385['name']),'penalty':0x0,'paused':_0x4b3385[_0x0f0d('0x68')],'createdAt':_0x4b3385['createdAt'],'updatedAt':_0x4b3385['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0f0d('0x1d')](respondWithFilteredResult(_0x45f1af,_0xbf31d))['catch'](handleError(_0x45f1af,null));};exports['getTeams']=function(_0x37af96,_0x114cab,_0x14a567){var _0x48c45c={};var _0x2de411={};var _0x1bef57;var _0x2e6416;return db[_0x0f0d('0x4d')][_0x0f0d('0x61')]({'where':{'id':_0x37af96[_0x0f0d('0x53')]['id']}})[_0x0f0d('0x1d')](handleEntityNotFound(_0x114cab,null))['then'](function(_0xb20bc1){if(_0xb20bc1){_0x1bef57=_0xb20bc1;_0x2de411['model']=_[_0x0f0d('0x40')](db['Team'][_0x0f0d('0x3b')]);_0x2de411[_0x0f0d('0x3f')]=_['keys'](_0x37af96[_0x0f0d('0x3f')]);_0x2de411[_0x0f0d('0x49')]=_['intersection'](_0x2de411[_0x0f0d('0x3e')],_0x2de411['query']);_0x48c45c[_0x0f0d('0x42')]=_[_0x0f0d('0x41')](_0x2de411['model'],qs['fields'](_0x37af96[_0x0f0d('0x3f')]['fields']));_0x48c45c[_0x0f0d('0x42')]=_0x48c45c[_0x0f0d('0x42')][_0x0f0d('0x44')]?_0x48c45c[_0x0f0d('0x42')]:_0x2de411['model'];_0x48c45c[_0x0f0d('0x6c')]=qs[_0x0f0d('0x47')](_0x37af96['query'][_0x0f0d('0x47')]);_0x48c45c[_0x0f0d('0x48')]=qs[_0x0f0d('0x49')](_[_0x0f0d('0x64')](_0x37af96[_0x0f0d('0x3f')],_0x2de411[_0x0f0d('0x49')]));if(_0x37af96['query']['filter']){_0x48c45c[_0x0f0d('0x48')]=_[_0x0f0d('0x4c')](_0x48c45c[_0x0f0d('0x48')],{'$or':_[_0x0f0d('0x3a')](_0x48c45c['attributes'],function(_0xd924ba){var _0x2bec41={};_0x2bec41[_0xd924ba]={'$like':'%'+_0x37af96['query']['filter']+'%'};return _0x2bec41;})});}_0x48c45c=_[_0x0f0d('0x4c')]({},_0x48c45c,_0x37af96[_0x0f0d('0x54')]);return _0x1bef57[_0x0f0d('0x6d')](_0x48c45c);}})['then'](function(_0x34850e){if(_0x34850e){_0x2e6416=_0x34850e[_0x0f0d('0x44')];if(!_0x37af96[_0x0f0d('0x3f')]['hasOwnProperty'](_0x0f0d('0x46'))){_0x48c45c['limit']=qs['limit'](_0x37af96['query'][_0x0f0d('0x2c')]);_0x48c45c['offset']=qs[_0x0f0d('0x2e')](_0x37af96['query']['offset']);}return _0x1bef57['getTeams'](_0x48c45c);}})[_0x0f0d('0x1d')](function(_0x874edf){if(_0x874edf){return _0x874edf?{'count':_0x2e6416,'rows':_0x874edf}:null;}})[_0x0f0d('0x1d')](respondWithResult(_0x114cab,null))['catch'](handleError(_0x114cab,null));};exports[_0x0f0d('0x6e')]=function(_0x16eb8f,_0x142d91,_0x3964c1){var _0x2854b4=_0x16eb8f[_0x0f0d('0x56')][_0x0f0d('0x6f')];return db['Team'][_0x0f0d('0x50')]({'where':{'id':_0x2854b4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0f0d('0x70'),'attributes':['id',_0x0f0d('0x37'),'online','voicePause',_0x0f0d('0x71')],'raw':!![]}]})[_0x0f0d('0x1d')](function(_0x5d1cad){if(_0x5d1cad){var _0x3cf5fd=_[_0x0f0d('0x72')](_0x5d1cad,function(_0x12ff3e){var _0x1b17d3=_0x12ff3e[_0x0f0d('0x62')]({'plain':!![]});return _0x1b17d3['Agents'];});return db[_0x0f0d('0x4d')][_0x0f0d('0x5a')]({'where':{'id':_0x16eb8f[_0x0f0d('0x53')]['id']}})['then'](function(_0x221f38){return db['sequelize'][_0x0f0d('0x73')](function(_0x24d831){return _0x221f38[_0x0f0d('0x6e')](_0x2854b4,{'transaction':_0x24d831})[_0x0f0d('0x1d')](function(){return BPromise[_0x0f0d('0x74')](_0x3cf5fd,function(_0x43a7cf){return db[_0x0f0d('0x63')][_0x0f0d('0x75')]({'where':{'UserId':_0x43a7cf['id'],'ChatQueueId':_0x16eb8f[_0x0f0d('0x53')]['id']},'transaction':_0x24d831});});})['then'](function(){_0x3cf5fd[_0x0f0d('0x76')](function(_0xd01ffd){socket[_0x0f0d('0x77')](_0x0f0d('0x78'),{'UserId':_0xd01ffd['id'],'ChatQueueId':_0x221f38['id']});});});});});}})[_0x0f0d('0x1d')](respondWithStatusCode(_0x142d91,null))[_0x0f0d('0x27')](handleError(_0x142d91,null));};exports[_0x0f0d('0x79')]=function(_0x5631b8,_0x523486,_0x37ac19){return db[_0x0f0d('0x7a')][_0x0f0d('0x50')]({'where':{'id':_0x5631b8[_0x0f0d('0x3f')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0f0d('0x66')],'as':_0x0f0d('0x70'),'attributes':['id'],'raw':!![]}]})[_0x0f0d('0x1d')](handleEntityNotFound(_0x523486,null))[_0x0f0d('0x1d')](function(_0x4ace52){var _0x2bdec6=_[_0x0f0d('0x3a')](_0x4ace52,'id');var _0x2f8f40=[];var _0x40db85=[];var _0x33a5e3=squel['select']();_0x33a5e3[_0x0f0d('0x7b')](_0x0f0d('0x7c'))[_0x0f0d('0x7d')](_0x0f0d('0x7e'),'tq')[_0x0f0d('0x7f')](_0x0f0d('0x80'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0f0d('0x48')]('ChatQueueId\x20=\x20?',_0x5631b8[_0x0f0d('0x53')]['id']);for(var _0x5eeda2=0x0;_0x5eeda2<_0x4ace52[_0x0f0d('0x44')];_0x5eeda2+=0x1){let _0x79ebb7=_0x4ace52[_0x5eeda2];for(var _0x18bfad=0x0;_0x18bfad<_0x79ebb7[_0x0f0d('0x70')]['length'];_0x18bfad+=0x1){let _0x3787e7=_0x79ebb7[_0x0f0d('0x70')][_0x18bfad];var _0x1abe1d=_0x33a5e3[_0x0f0d('0x81')]();_0x1abe1d[_0x0f0d('0x48')]('ut.UserId\x20=\x20?',_0x3787e7['id']);_0x40db85[_0x0f0d('0x82')](db[_0x0f0d('0x83')]['query'](_0x1abe1d[_0x0f0d('0x84')](),{'type':db['sequelize']['QueryTypes'][_0x0f0d('0x85')]})[_0x0f0d('0x1d')](function(_0x38f2bd){if(_0x38f2bd[_0x0f0d('0x44')]===0x1){return _0x3787e7['id'];}else{var _0x2718ef=_[_0x0f0d('0x86')](_[_0x0f0d('0x3a')](_0x38f2bd,'TeamId'),function(_0x39fe81){return _[_0x0f0d('0x87')](_0x2bdec6,_0x39fe81);});if(_0x2718ef){return _0x3787e7['id'];}}}));}}return BPromise[_0x0f0d('0x88')](_0x40db85)[_0x0f0d('0x1d')](function(_0x16aee4){_0x2f8f40=_(_0x2f8f40)[_0x0f0d('0x89')](_0x16aee4)[_0x0f0d('0x8a')]()['value']();return db['ChatQueue'][_0x0f0d('0x5a')]({'where':{'id':_0x5631b8[_0x0f0d('0x53')]['id']}})[_0x0f0d('0x1d')](function(_0x481d6b){return db[_0x0f0d('0x83')][_0x0f0d('0x73')](function(_0x5c2ed0){return _0x481d6b['removeTeams'](_0x5631b8['query'][_0x0f0d('0x6f')],{'transaction':_0x5c2ed0})[_0x0f0d('0x1d')](function(){if(!_['isEmpty'](_0x2f8f40)){return _0x481d6b[_0x0f0d('0x8b')](_0x2f8f40,{'transaction':_0x5c2ed0});}})['then'](function(){_0x2f8f40[_0x0f0d('0x76')](function(_0x2d20d6){socket[_0x0f0d('0x77')](_0x0f0d('0x8c'),{'UserId':_0x2d20d6,'ChatQueueId':_0x481d6b['id']});});});});});});})[_0x0f0d('0x1d')](respondWithStatusCode(_0x523486,null))['catch'](handleError(_0x523486,null));};exports[_0x0f0d('0x8d')]=function(_0x3bc432,_0x4c83da,_0x243178){return db[_0x0f0d('0x4d')]['find']({'where':{'id':_0x3bc432['params']['id']}})['then'](handleEntityNotFound(_0x4c83da,null))[_0x0f0d('0x1d')](function(_0x228392){if(_0x228392){return _0x228392[_0x0f0d('0x8d')](_0x3bc432[_0x0f0d('0x56')][_0x0f0d('0x6f')],_[_0x0f0d('0x8e')](_0x3bc432['body'],[_0x0f0d('0x6f'),'id'])||{})['spread'](function(_0x9ae5e3){for(var _0x3f7192=0x0;_0x3f7192<_0x3bc432[_0x0f0d('0x56')]['ids'][_0x0f0d('0x44')];_0x3f7192+=0x1){socket[_0x0f0d('0x77')](_0x0f0d('0x78'),{'UserId':Number(_0x3bc432['body'][_0x0f0d('0x6f')][_0x3f7192]),'ChatQueueId':Number(_0x3bc432[_0x0f0d('0x53')]['id'])});}return _0x9ae5e3;});}})[_0x0f0d('0x1d')](respondWithResult(_0x4c83da,null))[_0x0f0d('0x27')](handleError(_0x4c83da,null));};exports[_0x0f0d('0x8b')]=function(_0x5ce9eb,_0x2b6fd5,_0x4820ec){return db[_0x0f0d('0x4d')][_0x0f0d('0x5a')]({'where':{'id':_0x5ce9eb[_0x0f0d('0x53')]['id']}})[_0x0f0d('0x1d')](handleEntityNotFound(_0x2b6fd5,null))[_0x0f0d('0x1d')](function(_0x3b7300){if(_0x3b7300){return _0x3b7300['removeAgents'](_0x5ce9eb[_0x0f0d('0x3f')]['ids'])[_0x0f0d('0x1d')](function(){if(_[_0x0f0d('0x8f')](_0x5ce9eb[_0x0f0d('0x3f')][_0x0f0d('0x6f')])){for(var _0x21052b=0x0;_0x21052b<_0x5ce9eb[_0x0f0d('0x3f')]['ids'][_0x0f0d('0x44')];_0x21052b+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x5ce9eb[_0x0f0d('0x3f')][_0x0f0d('0x6f')][_0x21052b]),'ChatQueueId':Number(_0x5ce9eb[_0x0f0d('0x53')]['id'])});}}else{socket['emit'](_0x0f0d('0x8c'),{'UserId':Number(_0x5ce9eb[_0x0f0d('0x3f')][_0x0f0d('0x6f')]),'ChatQueueId':Number(_0x5ce9eb[_0x0f0d('0x53')]['id'])});}});}})[_0x0f0d('0x1d')](respondWithStatusCode(_0x2b6fd5,null))[_0x0f0d('0x27')](handleError(_0x2b6fd5,null));};exports[_0x0f0d('0x90')]=function(_0x5cd8f5,_0x80fdee,_0x509cc6){var _0x50173c={};var _0x1dec7d={};var _0x119ef9;var _0x3cbd4c;return db[_0x0f0d('0x4d')]['findOne']({'where':{'id':_0x5cd8f5['params']['id']}})['then'](handleEntityNotFound(_0x80fdee,null))[_0x0f0d('0x1d')](function(_0x24b363){if(_0x24b363){_0x119ef9=_0x24b363;_0x1dec7d['model']=_[_0x0f0d('0x40')](db[_0x0f0d('0x66')][_0x0f0d('0x3b')]);_0x1dec7d[_0x0f0d('0x3f')]=_[_0x0f0d('0x40')](_0x5cd8f5[_0x0f0d('0x3f')]);_0x1dec7d[_0x0f0d('0x49')]=_[_0x0f0d('0x41')](_0x1dec7d[_0x0f0d('0x3e')],_0x1dec7d['query']);_0x50173c[_0x0f0d('0x42')]=_[_0x0f0d('0x41')](_0x1dec7d[_0x0f0d('0x3e')],qs[_0x0f0d('0x43')](_0x5cd8f5[_0x0f0d('0x3f')][_0x0f0d('0x43')]));_0x50173c['attributes']=_0x50173c[_0x0f0d('0x42')]['length']?_0x50173c['attributes']:_0x1dec7d['model'];_0x50173c[_0x0f0d('0x6c')]=qs[_0x0f0d('0x47')](_0x5cd8f5[_0x0f0d('0x3f')][_0x0f0d('0x47')]);_0x50173c['where']=qs['filters'](_[_0x0f0d('0x64')](_0x5cd8f5[_0x0f0d('0x3f')],_0x1dec7d[_0x0f0d('0x49')]));if(_0x5cd8f5['query']['filter']){_0x50173c[_0x0f0d('0x48')]=_['merge'](_0x50173c[_0x0f0d('0x48')],{'$or':_[_0x0f0d('0x3a')](_0x50173c[_0x0f0d('0x42')],function(_0xf58da6){var _0xb7c784={};_0xb7c784[_0xf58da6]={'$like':'%'+_0x5cd8f5[_0x0f0d('0x3f')]['filter']+'%'};return _0xb7c784;})});}_0x50173c=_[_0x0f0d('0x4c')]({},_0x50173c,_0x5cd8f5[_0x0f0d('0x54')]);return _0x119ef9['getAgents'](_0x50173c);}})[_0x0f0d('0x1d')](function(_0x4b0faa){if(_0x4b0faa){_0x3cbd4c=_0x4b0faa[_0x0f0d('0x44')];if(!_0x5cd8f5[_0x0f0d('0x3f')][_0x0f0d('0x45')](_0x0f0d('0x46'))){_0x50173c[_0x0f0d('0x2c')]=qs[_0x0f0d('0x2c')](_0x5cd8f5[_0x0f0d('0x3f')]['limit']);_0x50173c[_0x0f0d('0x2e')]=qs[_0x0f0d('0x2e')](_0x5cd8f5[_0x0f0d('0x3f')][_0x0f0d('0x2e')]);}return _0x119ef9['getAgents'](_0x50173c);}})[_0x0f0d('0x1d')](function(_0x309d0a){if(_0x309d0a){return _0x309d0a?{'count':_0x3cbd4c,'rows':_0x309d0a}:null;}})[_0x0f0d('0x1d')](respondWithResult(_0x80fdee,null))[_0x0f0d('0x27')](handleError(_0x80fdee,null));}; \ No newline at end of file +var _0xf3b5=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','get','ChatQueues','UserProfileResource','destroy','stack','name','index','map','ChatQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','body','params','describe','getMembers','UserChatQueue','ChatQueueId','filter','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','chatPause','updatedAt','findOne','Team','getTeams','ids','Agents','online','voicePause','interface','transaction','addTeams','each','findOrCreate','forEach','userChatQueue:save','select','field','from','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','sequelize','toString','every','TeamId','includes','all','union','removeTeams','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x5944cf,_0x1d517e){var _0x8d3adf=function(_0x3da283){while(--_0x3da283){_0x5944cf['push'](_0x5944cf['shift']());}};_0x8d3adf(++_0x1d517e);}(_0xf3b5,0x8c));var _0x5f3b=function(_0x2ed30c,_0x276d01){_0x2ed30c=_0x2ed30c-0x0;var _0x56e1a7=_0xf3b5[_0x2ed30c];return _0x56e1a7;};'use strict';var emlformat=require(_0x5f3b('0x0'));var rimraf=require(_0x5f3b('0x1'));var zipdir=require(_0x5f3b('0x2'));var jsonpatch=require(_0x5f3b('0x3'));var rp=require(_0x5f3b('0x4'));var moment=require('moment');var BPromise=require(_0x5f3b('0x5'));var Mustache=require(_0x5f3b('0x6'));var util=require(_0x5f3b('0x7'));var path=require('path');var sox=require(_0x5f3b('0x8'));var csv=require(_0x5f3b('0x9'));var ejs=require(_0x5f3b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f3b('0xb'));var squel=require(_0x5f3b('0xc'));var crypto=require(_0x5f3b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5f3b('0xe'));var toCsv=require(_0x5f3b('0x9'));var querystring=require(_0x5f3b('0xf'));var Papa=require(_0x5f3b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5f3b('0x11'));var as=require(_0x5f3b('0x12'));var hardwareService=require(_0x5f3b('0x13'));var logger=require('../../config/logger')(_0x5f3b('0x14'));var utils=require(_0x5f3b('0x15'));var config=require(_0x5f3b('0x16'));var licenseUtil=require(_0x5f3b('0x17'));var db=require(_0x5f3b('0x18'))['db'];config['redis']=_[_0x5f3b('0x19')](config[_0x5f3b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x5f3b('0x1b'))(new Redis(config['redis']));require(_0x5f3b('0x1c'))[_0x5f3b('0x1d')](socket);var jayson=require(_0x5f3b('0x1e'));var client=jayson[_0x5f3b('0x1f')][_0x5f3b('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x18fbf8,_0x377c6b,_0x42f30a,_0x46bfaf){return new BPromise(function(_0x32e476,_0x2210ae){var _0x49c098=_0x46bfaf||client;return _0x49c098['request'](_0x18fbf8,_0x42f30a)['then'](function(_0x58afde){logger[_0x5f3b('0x21')](_0x5f3b('0x22'),_0x377c6b,_0x5f3b('0x23'));logger[_0x5f3b('0x24')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x377c6b,_0x5f3b('0x23'),JSON['stringify'](_0x58afde));if(_0x58afde[_0x5f3b('0x25')]){if(_0x58afde['error'][_0x5f3b('0x26')]===0x1f4){logger[_0x5f3b('0x25')](_0x5f3b('0x22'),_0x377c6b,_0x58afde[_0x5f3b('0x25')][_0x5f3b('0x27')]);return _0x2210ae(_0x58afde['error'][_0x5f3b('0x27')]);}logger[_0x5f3b('0x25')](_0x5f3b('0x22'),_0x377c6b,_0x58afde[_0x5f3b('0x25')]['message']);return _0x32e476(_0x58afde[_0x5f3b('0x25')]['message']);}else{logger[_0x5f3b('0x21')](_0x5f3b('0x22'),_0x377c6b,'request\x20sent');_0x32e476(_0x58afde[_0x5f3b('0x28')][_0x5f3b('0x27')]);}})[_0x5f3b('0x29')](function(_0x58115d){logger['error'](_0x5f3b('0x22'),_0x377c6b,_0x58115d);_0x2210ae(_0x58115d);});});}function respondWithStatusCode(_0x2dc51f,_0x2a1ec5){_0x2a1ec5=_0x2a1ec5||0xcc;return function(_0xcf5156){if(_0xcf5156){return _0x2dc51f[_0x5f3b('0x2a')](_0x2a1ec5);}return _0x2dc51f[_0x5f3b('0x2b')](_0x2a1ec5)[_0x5f3b('0x2c')]();};}function respondWithResult(_0x4095c9,_0x2687f0){_0x2687f0=_0x2687f0||0xc8;return function(_0x5e7a8f){if(_0x5e7a8f){return _0x4095c9[_0x5f3b('0x2b')](_0x2687f0)['json'](_0x5e7a8f);}};}function respondWithFilteredResult(_0x44f43e,_0x191ffc){return function(_0x2df70c){if(_0x2df70c){var _0x17d11=typeof _0x191ffc[_0x5f3b('0x2d')]===_0x5f3b('0x2e')&&typeof _0x191ffc[_0x5f3b('0x2f')]===_0x5f3b('0x2e');var _0x32398b=_0x2df70c[_0x5f3b('0x30')];var _0x54b435=_0x17d11?0x0:_0x191ffc['offset'];var _0x59371f=_0x17d11?_0x2df70c[_0x5f3b('0x30')]:_0x191ffc[_0x5f3b('0x2d')]+_0x191ffc['limit'];var _0x19683c;if(_0x59371f>=_0x32398b){_0x59371f=_0x32398b;_0x19683c=0xc8;}else{_0x19683c=0xce;}_0x44f43e[_0x5f3b('0x2b')](_0x19683c);return _0x44f43e[_0x5f3b('0x31')]('Content-Range',_0x54b435+'-'+_0x59371f+'/'+_0x32398b)[_0x5f3b('0x32')](_0x2df70c);}return null;};}function patchUpdates(_0xd396e9){return function(_0x59e91b){try{jsonpatch[_0x5f3b('0x33')](_0x59e91b,_0xd396e9,!![]);}catch(_0x548852){return BPromise[_0x5f3b('0x34')](_0x548852);}return _0x59e91b[_0x5f3b('0x35')]();};}function saveUpdates(_0xa5d854,_0x10cd1d){return function(_0xa7b254){if(_0xa7b254){return _0xa7b254['update'](_0xa5d854)[_0x5f3b('0x36')](function(_0x4651be){return _0x4651be;});}return null;};}function removeEntity(_0x60ab9,_0x4fa3e5){return function(_0x1f5b24){if(_0x1f5b24){return _0x1f5b24['destroy']()[_0x5f3b('0x36')](function(){var _0x2775bc=_0x1f5b24[_0x5f3b('0x37')]({'plain':!![]});var _0x58ce92=_0x5f3b('0x38');return db[_0x5f3b('0x39')][_0x5f3b('0x3a')]({'where':{'type':_0x58ce92,'resourceId':_0x2775bc['id']}})[_0x5f3b('0x36')](function(){return _0x1f5b24;});})[_0x5f3b('0x36')](function(){_0x60ab9[_0x5f3b('0x2b')](0xcc)[_0x5f3b('0x2c')]();});}};}function handleEntityNotFound(_0x2b7fe7,_0x529884){return function(_0x5960ba){if(!_0x5960ba){_0x2b7fe7[_0x5f3b('0x2a')](0x194);}return _0x5960ba;};}function handleError(_0x3a5476,_0x39c776){_0x39c776=_0x39c776||0x1f4;return function(_0x442c7b){logger['error'](_0x442c7b[_0x5f3b('0x3b')]);if(_0x442c7b[_0x5f3b('0x3c')]){delete _0x442c7b[_0x5f3b('0x3c')];}_0x3a5476[_0x5f3b('0x2b')](_0x39c776)['send'](_0x442c7b);};}exports[_0x5f3b('0x3d')]=function(_0x5c8fb6,_0x24a082){var _0x29dc3a={},_0x3ac574={},_0x1624d5={'count':0x0,'rows':[]};var _0x595d3c=_[_0x5f3b('0x3e')](db[_0x5f3b('0x3f')][_0x5f3b('0x40')],function(_0x2219e1){return{'name':_0x2219e1['fieldName'],'type':_0x2219e1[_0x5f3b('0x41')][_0x5f3b('0x42')]};});_0x3ac574[_0x5f3b('0x43')]=_['map'](_0x595d3c,_0x5f3b('0x3c'));_0x3ac574[_0x5f3b('0x44')]=_[_0x5f3b('0x45')](_0x5c8fb6[_0x5f3b('0x44')]);_0x3ac574[_0x5f3b('0x46')]=_[_0x5f3b('0x47')](_0x3ac574[_0x5f3b('0x43')],_0x3ac574[_0x5f3b('0x44')]);_0x29dc3a[_0x5f3b('0x48')]=_[_0x5f3b('0x47')](_0x3ac574[_0x5f3b('0x43')],qs[_0x5f3b('0x49')](_0x5c8fb6[_0x5f3b('0x44')][_0x5f3b('0x49')]));_0x29dc3a[_0x5f3b('0x48')]=_0x29dc3a[_0x5f3b('0x48')][_0x5f3b('0x4a')]?_0x29dc3a[_0x5f3b('0x48')]:_0x3ac574[_0x5f3b('0x43')];if(!_0x5c8fb6[_0x5f3b('0x44')][_0x5f3b('0x4b')](_0x5f3b('0x4c'))){_0x29dc3a[_0x5f3b('0x2f')]=qs['limit'](_0x5c8fb6[_0x5f3b('0x44')][_0x5f3b('0x2f')]);_0x29dc3a['offset']=qs[_0x5f3b('0x2d')](_0x5c8fb6['query'][_0x5f3b('0x2d')]);}_0x29dc3a[_0x5f3b('0x4d')]=qs[_0x5f3b('0x4e')](_0x5c8fb6[_0x5f3b('0x44')][_0x5f3b('0x4e')]);_0x29dc3a[_0x5f3b('0x4f')]=qs[_0x5f3b('0x46')](_[_0x5f3b('0x50')](_0x5c8fb6[_0x5f3b('0x44')],_0x3ac574['filters']),_0x595d3c);if(_0x5c8fb6['query']['filter']){_0x29dc3a[_0x5f3b('0x4f')]=_[_0x5f3b('0x51')](_0x29dc3a[_0x5f3b('0x4f')],{'$or':_[_0x5f3b('0x3e')](_0x595d3c,function(_0x11908c){if(_0x11908c[_0x5f3b('0x41')]!==_0x5f3b('0x52')){var _0x5345d3={};_0x5345d3[_0x11908c[_0x5f3b('0x3c')]]={'$like':'%'+_0x5c8fb6['query']['filter']+'%'};return _0x5345d3;}})});}_0x29dc3a=_[_0x5f3b('0x51')]({},_0x29dc3a,_0x5c8fb6[_0x5f3b('0x53')]);var _0x383eab={'where':_0x29dc3a[_0x5f3b('0x4f')]};return db[_0x5f3b('0x3f')][_0x5f3b('0x30')](_0x383eab)[_0x5f3b('0x36')](function(_0x13ecda){_0x1624d5[_0x5f3b('0x30')]=_0x13ecda;if(_0x5c8fb6[_0x5f3b('0x44')][_0x5f3b('0x54')]){_0x29dc3a['include']=[{'all':!![]}];}return db[_0x5f3b('0x3f')][_0x5f3b('0x55')](_0x29dc3a);})[_0x5f3b('0x36')](function(_0x46991c){_0x1624d5[_0x5f3b('0x56')]=_0x46991c;return _0x1624d5;})['then'](respondWithFilteredResult(_0x24a082,_0x29dc3a))[_0x5f3b('0x29')](handleError(_0x24a082,null));};exports['show']=function(_0x44ba6c,_0x1a3fa4){var _0x5235fa={'raw':!![],'where':{'id':_0x44ba6c['params']['id']}},_0x572e4a={};_0x572e4a[_0x5f3b('0x43')]=_[_0x5f3b('0x45')](db['ChatQueue']['rawAttributes']);_0x572e4a[_0x5f3b('0x44')]=_[_0x5f3b('0x45')](_0x44ba6c['query']);_0x572e4a['filters']=_[_0x5f3b('0x47')](_0x572e4a[_0x5f3b('0x43')],_0x572e4a['query']);_0x5235fa[_0x5f3b('0x48')]=_['intersection'](_0x572e4a['model'],qs[_0x5f3b('0x49')](_0x44ba6c['query']['fields']));_0x5235fa[_0x5f3b('0x48')]=_0x5235fa[_0x5f3b('0x48')]['length']?_0x5235fa['attributes']:_0x572e4a['model'];if(_0x44ba6c['query'][_0x5f3b('0x54')]){_0x5235fa[_0x5f3b('0x57')]=[{'all':!![]}];}_0x5235fa=_[_0x5f3b('0x51')]({},_0x5235fa,_0x44ba6c['options']);return db[_0x5f3b('0x3f')][_0x5f3b('0x58')](_0x5235fa)[_0x5f3b('0x36')](handleEntityNotFound(_0x1a3fa4,null))[_0x5f3b('0x36')](respondWithResult(_0x1a3fa4,null))['catch'](handleError(_0x1a3fa4,null));};exports[_0x5f3b('0x59')]=function(_0x432efe,_0x20f6dd){return db[_0x5f3b('0x3f')][_0x5f3b('0x59')](_0x432efe['body'],{})[_0x5f3b('0x36')](function(_0x161170){var _0x3db253=_0x432efe[_0x5f3b('0x5a')]['get']({'plain':!![]});if(!_0x3db253)throw new Error(_0x5f3b('0x5b'));if(_0x3db253[_0x5f3b('0x5c')]===_0x5f3b('0x5a')){var _0x28dfd4=_0x161170[_0x5f3b('0x37')]({'plain':!![]});var _0x53264e=_0x5f3b('0x38');return db[_0x5f3b('0x5d')]['find']({'where':{'name':_0x53264e,'userProfileId':_0x3db253[_0x5f3b('0x5e')]},'raw':!![]})[_0x5f3b('0x36')](function(_0x1005bc){if(_0x1005bc&&_0x1005bc['autoAssociation']===0x0){return db[_0x5f3b('0x39')]['create']({'name':_0x28dfd4[_0x5f3b('0x3c')],'resourceId':_0x28dfd4['id'],'type':_0x1005bc[_0x5f3b('0x3c')],'sectionId':_0x1005bc['id']},{})[_0x5f3b('0x36')](function(){return _0x161170;});}else{return _0x161170;}})[_0x5f3b('0x29')](function(_0x24929b){logger[_0x5f3b('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24929b);throw _0x24929b;});}return _0x161170;})[_0x5f3b('0x36')](respondWithResult(_0x20f6dd,0xc9))[_0x5f3b('0x29')](handleError(_0x20f6dd,null));};exports[_0x5f3b('0x5f')]=function(_0xd4b0cd,_0x2188cd){if(_0xd4b0cd[_0x5f3b('0x60')]['id']){delete _0xd4b0cd[_0x5f3b('0x60')]['id'];}return db[_0x5f3b('0x3f')]['find']({'where':{'id':_0xd4b0cd[_0x5f3b('0x61')]['id']}})[_0x5f3b('0x36')](handleEntityNotFound(_0x2188cd,null))[_0x5f3b('0x36')](saveUpdates(_0xd4b0cd[_0x5f3b('0x60')],null))[_0x5f3b('0x36')](respondWithResult(_0x2188cd,null))['catch'](handleError(_0x2188cd,null));};exports[_0x5f3b('0x3a')]=function(_0x52b0bd,_0x47ae05){return db[_0x5f3b('0x3f')]['find']({'where':{'id':_0x52b0bd['params']['id']}})[_0x5f3b('0x36')](handleEntityNotFound(_0x47ae05,null))[_0x5f3b('0x36')](removeEntity(_0x47ae05,null))[_0x5f3b('0x29')](handleError(_0x47ae05,null));};exports[_0x5f3b('0x62')]=function(_0x3dfb32,_0x19a383){return db['ChatQueue'][_0x5f3b('0x62')]()['then'](respondWithResult(_0x19a383,null))[_0x5f3b('0x29')](handleError(_0x19a383,null));};exports[_0x5f3b('0x63')]=function(_0x12de5f,_0x522cf9,_0x3d1d6f){var _0x429268={'raw':!![],'where':{}},_0x26f11a={},_0x3a96c0;return db['ChatQueue']['findOne']({'where':{'id':_0x12de5f[_0x5f3b('0x61')]['id']}})[_0x5f3b('0x36')](handleEntityNotFound(_0x522cf9,null))[_0x5f3b('0x36')](function(_0x229f41){if(_0x229f41){_0x3a96c0=_0x229f41[_0x5f3b('0x37')]({'plain':!![]});_0x26f11a[_0x5f3b('0x43')]=_[_0x5f3b('0x45')](db[_0x5f3b('0x64')]['rawAttributes']);_0x26f11a[_0x5f3b('0x44')]=_['keys'](_0x12de5f[_0x5f3b('0x44')]);_0x26f11a[_0x5f3b('0x46')]=_['intersection'](_0x26f11a[_0x5f3b('0x43')],_0x26f11a[_0x5f3b('0x44')]);_0x429268[_0x5f3b('0x48')]=_[_0x5f3b('0x47')](_0x26f11a[_0x5f3b('0x43')],qs[_0x5f3b('0x49')](_0x12de5f[_0x5f3b('0x44')][_0x5f3b('0x49')]));_0x429268[_0x5f3b('0x48')]=_0x429268[_0x5f3b('0x48')][_0x5f3b('0x4a')]?_0x429268['attributes']:_0x26f11a[_0x5f3b('0x43')];if(!_0x12de5f[_0x5f3b('0x44')][_0x5f3b('0x4b')](_0x5f3b('0x4c'))){_0x429268[_0x5f3b('0x2f')]=qs['limit'](_0x12de5f[_0x5f3b('0x44')][_0x5f3b('0x2f')]);_0x429268[_0x5f3b('0x2d')]=qs['offset'](_0x12de5f[_0x5f3b('0x44')]['offset']);}_0x429268[_0x5f3b('0x4d')]=qs['sort'](_0x12de5f[_0x5f3b('0x44')][_0x5f3b('0x4e')]);_0x429268[_0x5f3b('0x4f')]=qs['filters'](_['pick'](_0x12de5f[_0x5f3b('0x44')],_0x26f11a[_0x5f3b('0x46')]));_0x429268[_0x5f3b('0x4f')][_0x5f3b('0x65')]=_0x229f41['id'];if(_0x12de5f[_0x5f3b('0x44')][_0x5f3b('0x66')]){_0x429268[_0x5f3b('0x4f')]=_[_0x5f3b('0x51')](_0x429268[_0x5f3b('0x4f')],{'$or':_[_0x5f3b('0x3e')](_0x429268[_0x5f3b('0x48')],function(_0x36c926){var _0x4746ad={};_0x4746ad[_0x36c926]={'$like':'%'+_0x12de5f['query'][_0x5f3b('0x66')]+'%'};return _0x4746ad;})});}_0x429268=_[_0x5f3b('0x51')]({},_0x429268,_0x12de5f[_0x5f3b('0x53')]);return db[_0x5f3b('0x64')][_0x5f3b('0x55')](_0x429268);}})[_0x5f3b('0x36')](function(_0x3f81ba){if(_0x3f81ba){return db[_0x5f3b('0x67')][_0x5f3b('0x68')]({'where':{'id':_[_0x5f3b('0x3e')](_0x3f81ba,_0x5f3b('0x69')),'role':_0x5f3b('0x6a')},'attributes':['id',_0x5f3b('0x3c'),'chatPause','updatedAt',_0x5f3b('0x6b')]});}})[_0x5f3b('0x36')](function(_0x339044){if(_0x339044){return{'count':_0x339044[_0x5f3b('0x30')],'rows':_[_0x5f3b('0x3e')](_0x339044['rows'],function(_0x564b78){return{'membername':_0x564b78[_0x5f3b('0x3c')],'UserId':_0x564b78['id'],'queue_name':_0x3a96c0[_0x5f3b('0x3c')],'ChatQueueId':_0x3a96c0['id'],'interface':util[_0x5f3b('0x6c')](_0x5f3b('0x6d'),'SIP',_0x564b78['name']),'penalty':0x0,'paused':_0x564b78[_0x5f3b('0x6e')],'createdAt':_0x564b78[_0x5f3b('0x6b')],'updatedAt':_0x564b78[_0x5f3b('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x522cf9,_0x429268))[_0x5f3b('0x29')](handleError(_0x522cf9,null));};exports['getTeams']=function(_0x2c7853,_0x4ce638,_0x2f189f){var _0x5d2012={};var _0x413ab1={};var _0x49b254;var _0x401548;return db[_0x5f3b('0x3f')][_0x5f3b('0x70')]({'where':{'id':_0x2c7853[_0x5f3b('0x61')]['id']}})[_0x5f3b('0x36')](handleEntityNotFound(_0x4ce638,null))['then'](function(_0x31098a){if(_0x31098a){_0x49b254=_0x31098a;_0x413ab1[_0x5f3b('0x43')]=_[_0x5f3b('0x45')](db[_0x5f3b('0x71')]['rawAttributes']);_0x413ab1[_0x5f3b('0x44')]=_[_0x5f3b('0x45')](_0x2c7853[_0x5f3b('0x44')]);_0x413ab1['filters']=_[_0x5f3b('0x47')](_0x413ab1['model'],_0x413ab1[_0x5f3b('0x44')]);_0x5d2012['attributes']=_[_0x5f3b('0x47')](_0x413ab1[_0x5f3b('0x43')],qs[_0x5f3b('0x49')](_0x2c7853['query'][_0x5f3b('0x49')]));_0x5d2012[_0x5f3b('0x48')]=_0x5d2012['attributes'][_0x5f3b('0x4a')]?_0x5d2012[_0x5f3b('0x48')]:_0x413ab1[_0x5f3b('0x43')];_0x5d2012['order']=qs['sort'](_0x2c7853[_0x5f3b('0x44')][_0x5f3b('0x4e')]);_0x5d2012[_0x5f3b('0x4f')]=qs[_0x5f3b('0x46')](_[_0x5f3b('0x50')](_0x2c7853[_0x5f3b('0x44')],_0x413ab1['filters']));if(_0x2c7853[_0x5f3b('0x44')][_0x5f3b('0x66')]){_0x5d2012[_0x5f3b('0x4f')]=_[_0x5f3b('0x51')](_0x5d2012['where'],{'$or':_[_0x5f3b('0x3e')](_0x5d2012[_0x5f3b('0x48')],function(_0x28a6a5){var _0xc5eea9={};_0xc5eea9[_0x28a6a5]={'$like':'%'+_0x2c7853[_0x5f3b('0x44')]['filter']+'%'};return _0xc5eea9;})});}_0x5d2012=_['merge']({},_0x5d2012,_0x2c7853[_0x5f3b('0x53')]);return _0x49b254[_0x5f3b('0x72')](_0x5d2012);}})['then'](function(_0x28de5d){if(_0x28de5d){_0x401548=_0x28de5d['length'];if(!_0x2c7853[_0x5f3b('0x44')][_0x5f3b('0x4b')](_0x5f3b('0x4c'))){_0x5d2012['limit']=qs[_0x5f3b('0x2f')](_0x2c7853[_0x5f3b('0x44')][_0x5f3b('0x2f')]);_0x5d2012[_0x5f3b('0x2d')]=qs['offset'](_0x2c7853[_0x5f3b('0x44')][_0x5f3b('0x2d')]);}return _0x49b254[_0x5f3b('0x72')](_0x5d2012);}})['then'](function(_0xfa476a){if(_0xfa476a){return _0xfa476a?{'count':_0x401548,'rows':_0xfa476a}:null;}})[_0x5f3b('0x36')](respondWithResult(_0x4ce638,null))[_0x5f3b('0x29')](handleError(_0x4ce638,null));};exports['addTeams']=function(_0x5733cb,_0x1a385c,_0x409935){var _0x1109ff=_0x5733cb[_0x5f3b('0x60')][_0x5f3b('0x73')];return db[_0x5f3b('0x71')][_0x5f3b('0x55')]({'where':{'id':_0x1109ff},'attributes':['id'],'include':[{'model':db[_0x5f3b('0x67')],'as':_0x5f3b('0x74'),'attributes':['id',_0x5f3b('0x3c'),_0x5f3b('0x75'),_0x5f3b('0x76'),_0x5f3b('0x77')],'raw':!![]}]})[_0x5f3b('0x36')](function(_0x3e6d17){if(_0x3e6d17){var _0x1d96e9=_['flatMap'](_0x3e6d17,function(_0x2a38af){var _0x9bc018=_0x2a38af['get']({'plain':!![]});return _0x9bc018[_0x5f3b('0x74')];});return db[_0x5f3b('0x3f')][_0x5f3b('0x58')]({'where':{'id':_0x5733cb[_0x5f3b('0x61')]['id']}})[_0x5f3b('0x36')](function(_0x1312d2){return db['sequelize'][_0x5f3b('0x78')](function(_0x490a09){return _0x1312d2[_0x5f3b('0x79')](_0x1109ff,{'transaction':_0x490a09})[_0x5f3b('0x36')](function(){return BPromise[_0x5f3b('0x7a')](_0x1d96e9,function(_0x581921){return db[_0x5f3b('0x64')][_0x5f3b('0x7b')]({'where':{'UserId':_0x581921['id'],'ChatQueueId':_0x5733cb[_0x5f3b('0x61')]['id']},'transaction':_0x490a09});});})['then'](function(){_0x1d96e9[_0x5f3b('0x7c')](function(_0x53d6ca){socket['emit'](_0x5f3b('0x7d'),{'UserId':_0x53d6ca['id'],'ChatQueueId':_0x1312d2['id']});});});});});}})[_0x5f3b('0x36')](respondWithStatusCode(_0x1a385c,null))['catch'](handleError(_0x1a385c,null));};exports['removeTeams']=function(_0x1492a9,_0x3df5a0,_0x1d4016){return db[_0x5f3b('0x71')][_0x5f3b('0x55')]({'where':{'id':_0x1492a9[_0x5f3b('0x44')][_0x5f3b('0x73')]},'attributes':['id'],'include':[{'model':db[_0x5f3b('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5f3b('0x36')](handleEntityNotFound(_0x3df5a0,null))[_0x5f3b('0x36')](function(_0x5e264d){var _0x107412=_[_0x5f3b('0x3e')](_0x5e264d,'id');var _0x2aed6c=[];var _0xd8ca73=[];var _0x325dad=squel[_0x5f3b('0x7e')]();_0x325dad[_0x5f3b('0x7f')]('tq.TeamId')[_0x5f3b('0x80')]('team_has_chat_queues','tq')[_0x5f3b('0x81')]('user_has_teams','ut',_0x5f3b('0x82'))[_0x5f3b('0x4f')](_0x5f3b('0x83'),_0x1492a9[_0x5f3b('0x61')]['id']);for(var _0x2c66bf=0x0;_0x2c66bf<_0x5e264d[_0x5f3b('0x4a')];_0x2c66bf+=0x1){let _0x5e764d=_0x5e264d[_0x2c66bf];for(var _0x1d6032=0x0;_0x1d6032<_0x5e764d[_0x5f3b('0x74')][_0x5f3b('0x4a')];_0x1d6032+=0x1){let _0x3bd81a=_0x5e764d[_0x5f3b('0x74')][_0x1d6032];var _0x223988=_0x325dad[_0x5f3b('0x84')]();_0x223988[_0x5f3b('0x4f')]('ut.UserId\x20=\x20?',_0x3bd81a['id']);_0xd8ca73[_0x5f3b('0x85')](db[_0x5f3b('0x86')][_0x5f3b('0x44')](_0x223988[_0x5f3b('0x87')](),{'type':db[_0x5f3b('0x86')]['QueryTypes']['SELECT']})[_0x5f3b('0x36')](function(_0x41150b){if(_0x41150b[_0x5f3b('0x4a')]===0x1){return _0x3bd81a['id'];}else{var _0x3d8754=_[_0x5f3b('0x88')](_[_0x5f3b('0x3e')](_0x41150b,_0x5f3b('0x89')),function(_0x167f7f){return _[_0x5f3b('0x8a')](_0x107412,_0x167f7f);});if(_0x3d8754){return _0x3bd81a['id'];}}}));}}return BPromise[_0x5f3b('0x8b')](_0xd8ca73)[_0x5f3b('0x36')](function(_0xc4573e){_0x2aed6c=_(_0x2aed6c)[_0x5f3b('0x8c')](_0xc4573e)['compact']()['value']();return db[_0x5f3b('0x3f')][_0x5f3b('0x58')]({'where':{'id':_0x1492a9[_0x5f3b('0x61')]['id']}})[_0x5f3b('0x36')](function(_0xa0baf7){return db[_0x5f3b('0x86')][_0x5f3b('0x78')](function(_0x2ed6ac){return _0xa0baf7[_0x5f3b('0x8d')](_0x1492a9[_0x5f3b('0x44')]['ids'],{'transaction':_0x2ed6ac})[_0x5f3b('0x36')](function(){if(!_[_0x5f3b('0x8e')](_0x2aed6c)){return _0xa0baf7[_0x5f3b('0x8f')](_0x2aed6c,{'transaction':_0x2ed6ac});}})[_0x5f3b('0x36')](function(){_0x2aed6c[_0x5f3b('0x7c')](function(_0x274367){socket['emit'](_0x5f3b('0x90'),{'UserId':_0x274367,'ChatQueueId':_0xa0baf7['id']});});});});});});})['then'](respondWithStatusCode(_0x3df5a0,null))[_0x5f3b('0x29')](handleError(_0x3df5a0,null));};exports['addAgents']=function(_0x21cbe2,_0x497747,_0x3617dd){return db[_0x5f3b('0x3f')][_0x5f3b('0x58')]({'where':{'id':_0x21cbe2[_0x5f3b('0x61')]['id']}})[_0x5f3b('0x36')](handleEntityNotFound(_0x497747,null))['then'](function(_0x89b0c3){if(_0x89b0c3){return _0x89b0c3[_0x5f3b('0x91')](_0x21cbe2[_0x5f3b('0x60')][_0x5f3b('0x73')],_[_0x5f3b('0x92')](_0x21cbe2['body'],[_0x5f3b('0x73'),'id'])||{})[_0x5f3b('0x93')](function(_0x65c590){for(var _0x57a9c2=0x0;_0x57a9c2<_0x21cbe2[_0x5f3b('0x60')][_0x5f3b('0x73')][_0x5f3b('0x4a')];_0x57a9c2+=0x1){socket[_0x5f3b('0x94')]('userChatQueue:save',{'UserId':Number(_0x21cbe2[_0x5f3b('0x60')][_0x5f3b('0x73')][_0x57a9c2]),'ChatQueueId':Number(_0x21cbe2['params']['id'])});}return _0x65c590;});}})[_0x5f3b('0x36')](respondWithResult(_0x497747,null))[_0x5f3b('0x29')](handleError(_0x497747,null));};exports[_0x5f3b('0x8f')]=function(_0x44b995,_0x129ebd,_0x170a54){return db['ChatQueue'][_0x5f3b('0x58')]({'where':{'id':_0x44b995[_0x5f3b('0x61')]['id']}})['then'](handleEntityNotFound(_0x129ebd,null))[_0x5f3b('0x36')](function(_0x43f89a){if(_0x43f89a){return _0x43f89a[_0x5f3b('0x8f')](_0x44b995[_0x5f3b('0x44')]['ids'])[_0x5f3b('0x36')](function(){if(_[_0x5f3b('0x95')](_0x44b995[_0x5f3b('0x44')][_0x5f3b('0x73')])){for(var _0x142e4b=0x0;_0x142e4b<_0x44b995['query'][_0x5f3b('0x73')][_0x5f3b('0x4a')];_0x142e4b+=0x1){socket[_0x5f3b('0x94')]('userChatQueue:remove',{'UserId':Number(_0x44b995[_0x5f3b('0x44')][_0x5f3b('0x73')][_0x142e4b]),'ChatQueueId':Number(_0x44b995[_0x5f3b('0x61')]['id'])});}}else{socket[_0x5f3b('0x94')]('userChatQueue:remove',{'UserId':Number(_0x44b995['query'][_0x5f3b('0x73')]),'ChatQueueId':Number(_0x44b995[_0x5f3b('0x61')]['id'])});}});}})[_0x5f3b('0x36')](respondWithStatusCode(_0x129ebd,null))[_0x5f3b('0x29')](handleError(_0x129ebd,null));};exports[_0x5f3b('0x96')]=function(_0x264736,_0x43c0cf,_0xf96ffa){var _0x6a3071={};var _0x4df555={};var _0x3bc28a;var _0x5c46c7;return db[_0x5f3b('0x3f')][_0x5f3b('0x70')]({'where':{'id':_0x264736[_0x5f3b('0x61')]['id']}})[_0x5f3b('0x36')](handleEntityNotFound(_0x43c0cf,null))[_0x5f3b('0x36')](function(_0x51defa){if(_0x51defa){_0x3bc28a=_0x51defa;_0x4df555[_0x5f3b('0x43')]=_[_0x5f3b('0x45')](db[_0x5f3b('0x67')][_0x5f3b('0x40')]);_0x4df555['query']=_['keys'](_0x264736[_0x5f3b('0x44')]);_0x4df555[_0x5f3b('0x46')]=_[_0x5f3b('0x47')](_0x4df555[_0x5f3b('0x43')],_0x4df555[_0x5f3b('0x44')]);_0x6a3071[_0x5f3b('0x48')]=_[_0x5f3b('0x47')](_0x4df555['model'],qs[_0x5f3b('0x49')](_0x264736[_0x5f3b('0x44')][_0x5f3b('0x49')]));_0x6a3071[_0x5f3b('0x48')]=_0x6a3071[_0x5f3b('0x48')][_0x5f3b('0x4a')]?_0x6a3071[_0x5f3b('0x48')]:_0x4df555[_0x5f3b('0x43')];_0x6a3071[_0x5f3b('0x4d')]=qs[_0x5f3b('0x4e')](_0x264736['query'][_0x5f3b('0x4e')]);_0x6a3071[_0x5f3b('0x4f')]=qs['filters'](_[_0x5f3b('0x50')](_0x264736[_0x5f3b('0x44')],_0x4df555[_0x5f3b('0x46')]));if(_0x264736['query']['filter']){_0x6a3071[_0x5f3b('0x4f')]=_[_0x5f3b('0x51')](_0x6a3071['where'],{'$or':_[_0x5f3b('0x3e')](_0x6a3071[_0x5f3b('0x48')],function(_0x522ace){var _0x28d711={};_0x28d711[_0x522ace]={'$like':'%'+_0x264736[_0x5f3b('0x44')][_0x5f3b('0x66')]+'%'};return _0x28d711;})});}_0x6a3071=_['merge']({},_0x6a3071,_0x264736[_0x5f3b('0x53')]);return _0x3bc28a['getAgents'](_0x6a3071);}})['then'](function(_0x2aad13){if(_0x2aad13){_0x5c46c7=_0x2aad13['length'];if(!_0x264736[_0x5f3b('0x44')][_0x5f3b('0x4b')](_0x5f3b('0x4c'))){_0x6a3071[_0x5f3b('0x2f')]=qs[_0x5f3b('0x2f')](_0x264736[_0x5f3b('0x44')]['limit']);_0x6a3071[_0x5f3b('0x2d')]=qs[_0x5f3b('0x2d')](_0x264736[_0x5f3b('0x44')][_0x5f3b('0x2d')]);}return _0x3bc28a[_0x5f3b('0x96')](_0x6a3071);}})[_0x5f3b('0x36')](function(_0x4c31fb){if(_0x4c31fb){return _0x4c31fb?{'count':_0x5c46c7,'rows':_0x4c31fb}:null;}})[_0x5f3b('0x36')](respondWithResult(_0x43c0cf,null))[_0x5f3b('0x29')](handleError(_0x43c0cf,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index be31fbf..5e8eda4 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 _0x5c4e=['events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xd2ef0d,_0x1ab25b){var _0x4d8a86=function(_0x3e16e6){while(--_0x3e16e6){_0xd2ef0d['push'](_0xd2ef0d['shift']());}};_0x4d8a86(++_0x1ab25b);}(_0x5c4e,0xea));var _0xe5c4=function(_0x1dedb7,_0x57a29d){_0x1dedb7=_0x1dedb7-0x0;var _0x48fa80=_0x5c4e[_0x1dedb7];return _0x48fa80;};'use strict';var EventEmitter=require(_0xe5c4('0x0'));var ChatQueue=require(_0xe5c4('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe5c4('0x2'),'afterUpdate':_0xe5c4('0x3'),'afterDestroy':_0xe5c4('0x4')};function emitEvent(_0x36d260){return function(_0xa35382,_0x22022e,_0x2d2429){ChatQueueEvents[_0xe5c4('0x5')](_0x36d260+':'+_0xa35382['id'],_0xa35382);ChatQueueEvents[_0xe5c4('0x5')](_0x36d260,_0xa35382);_0x2d2429(null);};}for(var e in events){if(events[_0xe5c4('0x6')](e)){var event=events[e];ChatQueue[_0xe5c4('0x7')](e,emitEvent(event));}}module[_0xe5c4('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x7234=['exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x7234,0x172));var _0x4723=function(_0x2df8d8,_0x4477d1){_0x2df8d8=_0x2df8d8-0x0;var _0xa0732f=_0x7234[_0x2df8d8];return _0xa0732f;};'use strict';var EventEmitter=require(_0x4723('0x0'));var ChatQueue=require(_0x4723('0x1'))['db'][_0x4723('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4723('0x3')](0x0);var events={'afterCreate':_0x4723('0x4'),'afterUpdate':'update','afterDestroy':_0x4723('0x5')};function emitEvent(_0x3663dd){return function(_0x16c121,_0x104c0a,_0x5cead5){ChatQueueEvents[_0x4723('0x6')](_0x3663dd+':'+_0x16c121['id'],_0x16c121);ChatQueueEvents[_0x4723('0x6')](_0x3663dd,_0x16c121);_0x5cead5(null);};}for(var e in events){if(events[_0x4723('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x4723('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 706377e..9be65be 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 _0xb9cf=['ChatQueue','chat_queues','util','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xb9cf,0x1e8));var _0xfb9c=function(_0x423764,_0xcd9f9d){_0x423764=_0x423764-0x0;var _0x207fe8=_0xb9cf[_0x423764];return _0x207fe8;};'use strict';var _=require('lodash');var util=require(_0xfb9c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfb9c('0x1'));var fs=require('fs');var path=require(_0xfb9c('0x2'));var rimraf=require(_0xfb9c('0x3'));var config=require(_0xfb9c('0x4'));var attributes=require('./chatQueue.attributes');module[_0xfb9c('0x5')]=function(_0x320af3,_0xec3807){return _0x320af3[_0xfb9c('0x6')](_0xfb9c('0x7'),attributes,{'tableName':_0xfb9c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d3e=['rimraf','../../config/environment','exports','ChatQueue','chat_queues','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5d3e,0x161));var _0xe5d3=function(_0x499fd2,_0x6343e3){_0x499fd2=_0x499fd2-0x0;var _0x5d7e6b=_0x5d3e[_0x499fd2];return _0x5d7e6b;};'use strict';var _=require(_0xe5d3('0x0'));var util=require(_0xe5d3('0x1'));var logger=require('../../config/logger')(_0xe5d3('0x2'));var moment=require(_0xe5d3('0x3'));var BPromise=require(_0xe5d3('0x4'));var rp=require(_0xe5d3('0x5'));var fs=require('fs');var path=require(_0xe5d3('0x6'));var rimraf=require(_0xe5d3('0x7'));var config=require(_0xe5d3('0x8'));var attributes=require('./chatQueue.attributes');module[_0xe5d3('0x9')]=function(_0x4b6cf2,_0x4ceebc){return _0x4b6cf2['define'](_0xe5d3('0xa'),attributes,{'tableName':_0xe5d3('0xb'),'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 6d3c15b..90961e4 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 _0xe5e8=['request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','find','ShowChatQueue','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./chatQueue.socket','register'];(function(_0x55f0db,_0x123012){var _0x6c9415=function(_0x12f294){while(--_0x12f294){_0x55f0db['push'](_0x55f0db['shift']());}};_0x6c9415(++_0x123012);}(_0xe5e8,0xe7));var _0x8e5e=function(_0x447e3a,_0x3fb9ba){_0x447e3a=_0x447e3a-0x0;var _0x39e865=_0xe5e8[_0x447e3a];return _0x39e865;};'use strict';var _=require(_0x8e5e('0x0'));var util=require(_0x8e5e('0x1'));var moment=require(_0x8e5e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e5e('0x3'))['db'];var utils=require(_0x8e5e('0x4'));var logger=require('../../config/logger')(_0x8e5e('0x5'));var config=require(_0x8e5e('0x6'));var jayson=require(_0x8e5e('0x7'));var client=jayson[_0x8e5e('0x8')][_0x8e5e('0x9')]({'port':0x232a});config['redis']=_[_0x8e5e('0xa')](config[_0x8e5e('0xb')],{'host':_0x8e5e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e5e('0xb')]));require(_0x8e5e('0xd'))[_0x8e5e('0xe')](socket);function respondWithRpcPromise(_0x46f8e8,_0x25fb2e,_0x1efc1c){return new BPromise(function(_0x5f4ec4,_0xdd8381){return client[_0x8e5e('0xf')](_0x46f8e8,_0x1efc1c)[_0x8e5e('0x10')](function(_0x237395){logger[_0x8e5e('0x11')](_0x8e5e('0x12'),_0x25fb2e,_0x8e5e('0x13'));logger[_0x8e5e('0x14')](_0x8e5e('0x15'),_0x25fb2e,_0x8e5e('0x13'),JSON[_0x8e5e('0x16')](_0x237395));if(_0x237395['error']){if(_0x237395[_0x8e5e('0x17')][_0x8e5e('0x18')]===0x1f4){logger[_0x8e5e('0x17')](_0x8e5e('0x12'),_0x25fb2e,_0x237395[_0x8e5e('0x17')]['message']);return _0xdd8381(_0x237395[_0x8e5e('0x17')][_0x8e5e('0x19')]);}logger[_0x8e5e('0x17')](_0x8e5e('0x12'),_0x25fb2e,_0x237395['error']['message']);return _0x5f4ec4(_0x237395[_0x8e5e('0x17')][_0x8e5e('0x19')]);}else{logger[_0x8e5e('0x11')](_0x8e5e('0x12'),_0x25fb2e,_0x8e5e('0x13'));_0x5f4ec4(_0x237395[_0x8e5e('0x1a')][_0x8e5e('0x19')]);}})['catch'](function(_0x1d4e04){logger[_0x8e5e('0x17')](_0x8e5e('0x12'),_0x25fb2e,_0x1d4e04);_0xdd8381(_0x1d4e04);});});}exports[_0x8e5e('0x1b')]=function(_0x213cca){var _0x57d674=this;return new Promise(function(_0x501517,_0x4be73a){return db[_0x8e5e('0x1c')][_0x8e5e('0x1d')]({'raw':_0x213cca[_0x8e5e('0x1e')]?_0x213cca['options'][_0x8e5e('0x1f')]===undefined?!![]:![]:!![],'where':_0x213cca[_0x8e5e('0x1e')]?_0x213cca[_0x8e5e('0x1e')][_0x8e5e('0x20')]||null:null,'attributes':_0x213cca[_0x8e5e('0x1e')]?_0x213cca[_0x8e5e('0x1e')][_0x8e5e('0x21')]||null:null,'limit':_0x213cca['options']?_0x213cca['options'][_0x8e5e('0x22')]||null:null,'include':_0x213cca[_0x8e5e('0x1e')]?_0x213cca[_0x8e5e('0x1e')][_0x8e5e('0x23')]?_[_0x8e5e('0x24')](_0x213cca[_0x8e5e('0x1e')][_0x8e5e('0x23')],function(_0x4ec8d1){return{'model':db[_0x4ec8d1[_0x8e5e('0x25')]],'as':_0x4ec8d1['as'],'attributes':_0x4ec8d1[_0x8e5e('0x21')],'include':_0x4ec8d1[_0x8e5e('0x23')]?_[_0x8e5e('0x24')](_0x4ec8d1[_0x8e5e('0x23')],function(_0x305c30){return{'model':db[_0x305c30[_0x8e5e('0x25')]],'as':_0x305c30['as'],'attributes':_0x305c30[_0x8e5e('0x21')],'include':_0x305c30[_0x8e5e('0x23')]?_['map'](_0x305c30['include'],function(_0x45b7e9){return{'model':db[_0x45b7e9['model']],'as':_0x45b7e9['as'],'attributes':_0x45b7e9[_0x8e5e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8e5e('0x10')](function(_0x4037ff){logger[_0x8e5e('0x11')]('GetChatQueue',_0x213cca);logger[_0x8e5e('0x14')]('GetChatQueue',_0x213cca,JSON[_0x8e5e('0x16')](_0x4037ff));_0x501517(_0x4037ff);})[_0x8e5e('0x26')](function(_0x2d2005){logger[_0x8e5e('0x17')](_0x8e5e('0x1b'),_0x2d2005['message'],_0x213cca);_0x4be73a(_0x57d674[_0x8e5e('0x17')](0x1f4,_0x2d2005[_0x8e5e('0x19')]));});});};exports['ShowChatQueue']=function(_0x3c52ab){var _0x823106=this;return new Promise(function(_0x1740f5,_0x394a75){return db['ChatQueue'][_0x8e5e('0x27')]({'raw':_0x3c52ab[_0x8e5e('0x1e')]?_0x3c52ab[_0x8e5e('0x1e')][_0x8e5e('0x1f')]===undefined?!![]:![]:!![],'where':_0x3c52ab[_0x8e5e('0x1e')]?_0x3c52ab['options'][_0x8e5e('0x20')]||null:null,'attributes':_0x3c52ab[_0x8e5e('0x1e')]?_0x3c52ab[_0x8e5e('0x1e')][_0x8e5e('0x21')]||null:null,'include':_0x3c52ab[_0x8e5e('0x1e')]?_0x3c52ab[_0x8e5e('0x1e')][_0x8e5e('0x23')]?_[_0x8e5e('0x24')](_0x3c52ab[_0x8e5e('0x1e')][_0x8e5e('0x23')],function(_0x33388c){return{'model':db[_0x33388c[_0x8e5e('0x25')]],'as':_0x33388c['as'],'attributes':_0x33388c[_0x8e5e('0x21')],'include':_0x33388c['include']?_[_0x8e5e('0x24')](_0x33388c[_0x8e5e('0x23')],function(_0x4d9052){return{'model':db[_0x4d9052[_0x8e5e('0x25')]],'as':_0x4d9052['as'],'attributes':_0x4d9052[_0x8e5e('0x21')],'include':_0x4d9052[_0x8e5e('0x23')]?_[_0x8e5e('0x24')](_0x4d9052[_0x8e5e('0x23')],function(_0x519276){return{'model':db[_0x519276['model']],'as':_0x519276['as'],'attributes':_0x519276[_0x8e5e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8e5e('0x10')](function(_0x5c659a){logger[_0x8e5e('0x11')](_0x8e5e('0x28'),_0x3c52ab);logger['debug'](_0x8e5e('0x28'),_0x3c52ab,JSON[_0x8e5e('0x16')](_0x5c659a));_0x1740f5(_0x5c659a);})[_0x8e5e('0x26')](function(_0x6e29d6){logger[_0x8e5e('0x17')]('ShowChatQueue',_0x6e29d6[_0x8e5e('0x19')],_0x3c52ab);_0x394a75(_0x823106[_0x8e5e('0x17')](0x1f4,_0x6e29d6['message']));});});}; \ No newline at end of file +var _0x1364=['ioredis','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetChatQueue','findAll','options','raw','where','attributes','limit','map','include','model','ShowChatQueue','ChatQueue','find','debug','lodash','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1364,0x1eb));var _0x4136=function(_0x45aad7,_0x54477f){_0x45aad7=_0x45aad7-0x0;var _0x2e575d=_0x1364[_0x45aad7];return _0x2e575d;};'use strict';var _=require(_0x4136('0x0'));var util=require('util');var moment=require(_0x4136('0x1'));var BPromise=require(_0x4136('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4136('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4136('0x4'));var logger=require(_0x4136('0x5'))(_0x4136('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4136('0x7')]['http']({'port':0x232a});config[_0x4136('0x8')]=_[_0x4136('0x9')](config[_0x4136('0x8')],{'host':_0x4136('0xa'),'port':0x18eb});var socket=require(_0x4136('0xb'))(new Redis(config[_0x4136('0x8')]));require('./chatQueue.socket')[_0x4136('0xc')](socket);function respondWithRpcPromise(_0x1ffc81,_0x4dd717,_0xbf0655){return new BPromise(function(_0xf207ea,_0x1be8e9){return client[_0x4136('0xd')](_0x1ffc81,_0xbf0655)[_0x4136('0xe')](function(_0x54e54e){logger[_0x4136('0xf')](_0x4136('0x10'),_0x4dd717,'request\x20sent');logger['debug'](_0x4136('0x11'),_0x4dd717,_0x4136('0x12'),JSON[_0x4136('0x13')](_0x54e54e));if(_0x54e54e['error']){if(_0x54e54e[_0x4136('0x14')][_0x4136('0x15')]===0x1f4){logger[_0x4136('0x14')](_0x4136('0x10'),_0x4dd717,_0x54e54e['error'][_0x4136('0x16')]);return _0x1be8e9(_0x54e54e[_0x4136('0x14')][_0x4136('0x16')]);}logger[_0x4136('0x14')](_0x4136('0x10'),_0x4dd717,_0x54e54e['error'][_0x4136('0x16')]);return _0xf207ea(_0x54e54e['error']['message']);}else{logger[_0x4136('0xf')](_0x4136('0x10'),_0x4dd717,'request\x20sent');_0xf207ea(_0x54e54e['result']['message']);}})[_0x4136('0x17')](function(_0x37877a){logger['error'](_0x4136('0x10'),_0x4dd717,_0x37877a);_0x1be8e9(_0x37877a);});});}exports[_0x4136('0x18')]=function(_0x19d236){var _0x533d5f=this;return new Promise(function(_0x575ed2,_0x13a1db){return db['ChatQueue'][_0x4136('0x19')]({'raw':_0x19d236[_0x4136('0x1a')]?_0x19d236['options'][_0x4136('0x1b')]===undefined?!![]:![]:!![],'where':_0x19d236[_0x4136('0x1a')]?_0x19d236['options'][_0x4136('0x1c')]||null:null,'attributes':_0x19d236[_0x4136('0x1a')]?_0x19d236[_0x4136('0x1a')][_0x4136('0x1d')]||null:null,'limit':_0x19d236[_0x4136('0x1a')]?_0x19d236[_0x4136('0x1a')][_0x4136('0x1e')]||null:null,'include':_0x19d236[_0x4136('0x1a')]?_0x19d236[_0x4136('0x1a')]['include']?_[_0x4136('0x1f')](_0x19d236['options'][_0x4136('0x20')],function(_0x367aa1){return{'model':db[_0x367aa1['model']],'as':_0x367aa1['as'],'attributes':_0x367aa1[_0x4136('0x1d')],'include':_0x367aa1[_0x4136('0x20')]?_['map'](_0x367aa1[_0x4136('0x20')],function(_0x492d89){return{'model':db[_0x492d89[_0x4136('0x21')]],'as':_0x492d89['as'],'attributes':_0x492d89['attributes'],'include':_0x492d89[_0x4136('0x20')]?_[_0x4136('0x1f')](_0x492d89['include'],function(_0x270cd4){return{'model':db[_0x270cd4[_0x4136('0x21')]],'as':_0x270cd4['as'],'attributes':_0x270cd4[_0x4136('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4136('0xe')](function(_0x5333f2){logger[_0x4136('0xf')](_0x4136('0x18'),_0x19d236);logger['debug'](_0x4136('0x18'),_0x19d236,JSON['stringify'](_0x5333f2));_0x575ed2(_0x5333f2);})[_0x4136('0x17')](function(_0x3f33b3){logger[_0x4136('0x14')](_0x4136('0x18'),_0x3f33b3[_0x4136('0x16')],_0x19d236);_0x13a1db(_0x533d5f['error'](0x1f4,_0x3f33b3[_0x4136('0x16')]));});});};exports[_0x4136('0x22')]=function(_0x729b08){var _0x1c4509=this;return new Promise(function(_0x11c1dc,_0xb692b5){return db[_0x4136('0x23')][_0x4136('0x24')]({'raw':_0x729b08[_0x4136('0x1a')]?_0x729b08[_0x4136('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x729b08[_0x4136('0x1a')]?_0x729b08[_0x4136('0x1a')][_0x4136('0x1c')]||null:null,'attributes':_0x729b08[_0x4136('0x1a')]?_0x729b08[_0x4136('0x1a')][_0x4136('0x1d')]||null:null,'include':_0x729b08[_0x4136('0x1a')]?_0x729b08[_0x4136('0x1a')][_0x4136('0x20')]?_[_0x4136('0x1f')](_0x729b08[_0x4136('0x1a')]['include'],function(_0x732164){return{'model':db[_0x732164[_0x4136('0x21')]],'as':_0x732164['as'],'attributes':_0x732164[_0x4136('0x1d')],'include':_0x732164[_0x4136('0x20')]?_['map'](_0x732164[_0x4136('0x20')],function(_0x1740e5){return{'model':db[_0x1740e5[_0x4136('0x21')]],'as':_0x1740e5['as'],'attributes':_0x1740e5[_0x4136('0x1d')],'include':_0x1740e5[_0x4136('0x20')]?_[_0x4136('0x1f')](_0x1740e5[_0x4136('0x20')],function(_0x34f52e){return{'model':db[_0x34f52e[_0x4136('0x21')]],'as':_0x34f52e['as'],'attributes':_0x34f52e[_0x4136('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4136('0xe')](function(_0xff6f42){logger[_0x4136('0xf')](_0x4136('0x22'),_0x729b08);logger[_0x4136('0x25')]('ShowChatQueue',_0x729b08,JSON[_0x4136('0x13')](_0xff6f42));_0x11c1dc(_0xff6f42);})['catch'](function(_0x395c7e){logger['error'](_0x4136('0x22'),_0x395c7e[_0x4136('0x16')],_0x729b08);_0xb692b5(_0x1c4509[_0x4136('0x14')](0x1f4,_0x395c7e[_0x4136('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 692efbf..5a822f3 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 _0x5db8=['remove','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x176a19,_0x13946a){var _0x4a21a0=function(_0x13c8a1){while(--_0x13c8a1){_0x176a19['push'](_0x176a19['shift']());}};_0x4a21a0(++_0x13946a);}(_0x5db8,0xbb));var _0x85db=function(_0x5e5f5a,_0x5cb19a){_0x5e5f5a=_0x5e5f5a-0x0;var _0x4141ae=_0x5db8[_0x5e5f5a];return _0x4141ae;};'use strict';var ChatQueueEvents=require(_0x85db('0x0'));var events=[_0x85db('0x1'),_0x85db('0x2'),'update'];function createListener(_0x14ab3d,_0x16c069){return function(_0x42c47f){_0x16c069['emit'](_0x14ab3d,_0x42c47f);};}function removeListener(_0x5b7426,_0x13c216){return function(){ChatQueueEvents[_0x85db('0x3')](_0x5b7426,_0x13c216);};}exports[_0x85db('0x4')]=function(_0x34d71f){for(var _0x48bf16=0x0,_0x489b13=events[_0x85db('0x5')];_0x48bf16<_0x489b13;_0x48bf16++){var _0x3a10dd=events[_0x48bf16];var _0xc6fd00=createListener(_0x85db('0x6')+_0x3a10dd,_0x34d71f);ChatQueueEvents['on'](_0x3a10dd,_0xc6fd00);}}; \ No newline at end of file +var _0xe13a=['update','emit','removeListener','register','chatQueue:','save','remove'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0xe13a,0x178));var _0xae13=function(_0x33c845,_0x2e2723){_0x33c845=_0x33c845-0x0;var _0x42e520=_0xe13a[_0x33c845];return _0x42e520;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xae13('0x0'),_0xae13('0x1'),_0xae13('0x2')];function createListener(_0x6066c0,_0x4cf961){return function(_0x3aaf90){_0x4cf961[_0xae13('0x3')](_0x6066c0,_0x3aaf90);};}function removeListener(_0x3ebbfe,_0x10abd7){return function(){ChatQueueEvents[_0xae13('0x4')](_0x3ebbfe,_0x10abd7);};}exports[_0xae13('0x5')]=function(_0x412a07){for(var _0x3379ed=0x0,_0x341ba4=events['length'];_0x3379ed<_0x341ba4;_0x3379ed++){var _0x2f6d10=events[_0x3379ed];var _0x2b2e1f=createListener(_0xae13('0x6')+_0x2f6d10,_0x412a07);ChatQueueEvents['on'](_0x2f6d10,_0x2b2e1f);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 87a92c4..a06bcb2 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3e74,0x175));var _0x43e7=function(_0x4b0b3f,_0x43a4e2){_0x4b0b3f=_0x4b0b3f-0x0;var _0x1215d7=_0x3e74[_0x4b0b3f];return _0x1215d7;};'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 _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x5657af,_0xdaa17d){var _0x40dc44=function(_0x49d43d){while(--_0x49d43d){_0x5657af['push'](_0x5657af['shift']());}};_0x40dc44(++_0xdaa17d);}(_0x55ca,0x126));var _0xa55c=function(_0x529296,_0x1a6a23){_0x529296=_0x529296-0x0;var _0x1796bf=_0x55ca[_0x529296];return _0x1796bf;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['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['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('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 395022b..2c177d0 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 _0xa211=['DATE','moment','exports','STRING'];(function(_0x5cb4ce,_0x14635a){var _0x4b626f=function(_0x19121c){while(--_0x19121c){_0x5cb4ce['push'](_0x5cb4ce['shift']());}};_0x4b626f(++_0x14635a);}(_0xa211,0x101));var _0x1a21=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa211[_0x59ee6f];return _0x4c0979;};'use strict';var moment=require(_0x1a21('0x0'));var Sequelize=require('sequelize');module[_0x1a21('0x1')]={'uniqueid':{'type':Sequelize[_0x1a21('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x1a21('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x1a21('0x2')]}}; \ No newline at end of file +var _0x745d=['exports','STRING','DATE'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x745d,0x1cb));var _0xd745=function(_0x49d538,_0x3d12aa){_0x49d538=_0x49d538-0x0;var _0x2eda35=_0x745d[_0x49d538];return _0x2eda35;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xd745('0x0')]={'uniqueid':{'type':Sequelize[_0xd745('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xd745('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd745('0x2')]},'acceptAt':{'type':Sequelize[_0xd745('0x2')]},'exitAt':{'type':Sequelize[_0xd745('0x2')]},'reason':{'type':Sequelize[_0xd745('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 52f850a..7b6d976 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 _0xf7f7=['json','offset','undefined','limit','count','set','apply','reject','then','sendStatus','error','stack','name','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','ChatQueueReport','includeAll','include','rows','catch','rawAttributes','find','create','body','update','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','status'];(function(_0x393f65,_0x4a077a){var _0x38d9a3=function(_0xa4463d){while(--_0xa4463d){_0x393f65['push'](_0x393f65['shift']());}};_0x38d9a3(++_0x4a077a);}(_0xf7f7,0x192));var _0x7f7f=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xf7f7[_0x31e29a];return _0x32d892;};'use strict';var emlformat=require(_0x7f7f('0x0'));var rimraf=require(_0x7f7f('0x1'));var zipdir=require(_0x7f7f('0x2'));var jsonpatch=require(_0x7f7f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7f7f('0x4'));var Mustache=require(_0x7f7f('0x5'));var util=require(_0x7f7f('0x6'));var path=require(_0x7f7f('0x7'));var sox=require('sox');var csv=require(_0x7f7f('0x8'));var ejs=require(_0x7f7f('0x9'));var fs=require('fs');var fs_extra=require(_0x7f7f('0xa'));var _=require(_0x7f7f('0xb'));var squel=require('squel');var crypto=require(_0x7f7f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7f7f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7f7f('0xe'));var Papa=require('papaparse');var Redis=require(_0x7f7f('0xf'));var authService=require(_0x7f7f('0x10'));var qs=require(_0x7f7f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f7f('0x12'));var logger=require(_0x7f7f('0x13'))(_0x7f7f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7f7f('0x15'))['db'];function respondWithStatusCode(_0x15ca14,_0xb17c0a){_0xb17c0a=_0xb17c0a||0xcc;return function(_0x24499f){if(_0x24499f){return _0x15ca14['sendStatus'](_0xb17c0a);}return _0x15ca14['status'](_0xb17c0a)[_0x7f7f('0x16')]();};}function respondWithResult(_0xd54f98,_0xe4c7b1){_0xe4c7b1=_0xe4c7b1||0xc8;return function(_0x1f0b3a){if(_0x1f0b3a){return _0xd54f98[_0x7f7f('0x17')](_0xe4c7b1)[_0x7f7f('0x18')](_0x1f0b3a);}};}function respondWithFilteredResult(_0x464cc4,_0x15d3a6){return function(_0x329e81){if(_0x329e81){var _0x2c0049=typeof _0x15d3a6[_0x7f7f('0x19')]===_0x7f7f('0x1a')&&typeof _0x15d3a6[_0x7f7f('0x1b')]===_0x7f7f('0x1a');var _0x23584f=_0x329e81[_0x7f7f('0x1c')];var _0x410957=_0x2c0049?0x0:_0x15d3a6[_0x7f7f('0x19')];var _0xa16527=_0x2c0049?_0x329e81[_0x7f7f('0x1c')]:_0x15d3a6[_0x7f7f('0x19')]+_0x15d3a6['limit'];var _0x3ccec6;if(_0xa16527>=_0x23584f){_0xa16527=_0x23584f;_0x3ccec6=0xc8;}else{_0x3ccec6=0xce;}_0x464cc4[_0x7f7f('0x17')](_0x3ccec6);return _0x464cc4[_0x7f7f('0x1d')]('Content-Range',_0x410957+'-'+_0xa16527+'/'+_0x23584f)[_0x7f7f('0x18')](_0x329e81);}return null;};}function patchUpdates(_0x57167b){return function(_0x181619){try{jsonpatch[_0x7f7f('0x1e')](_0x181619,_0x57167b,!![]);}catch(_0x45c12b){return BPromise[_0x7f7f('0x1f')](_0x45c12b);}return _0x181619['save']();};}function saveUpdates(_0x72b10a,_0x9a51d7){return function(_0x3d25a6){if(_0x3d25a6){return _0x3d25a6['update'](_0x72b10a)[_0x7f7f('0x20')](function(_0x4b879d){return _0x4b879d;});}return null;};}function removeEntity(_0x47a262,_0x597be6){return function(_0x3dae62){if(_0x3dae62){return _0x3dae62['destroy']()[_0x7f7f('0x20')](function(){_0x47a262['status'](0xcc)[_0x7f7f('0x16')]();});}};}function handleEntityNotFound(_0x158df8,_0x57f72a){return function(_0x7968ed){if(!_0x7968ed){_0x158df8[_0x7f7f('0x21')](0x194);}return _0x7968ed;};}function handleError(_0x445749,_0x2d7ea6){_0x2d7ea6=_0x2d7ea6||0x1f4;return function(_0x373cc3){logger[_0x7f7f('0x22')](_0x373cc3[_0x7f7f('0x23')]);if(_0x373cc3[_0x7f7f('0x24')]){delete _0x373cc3[_0x7f7f('0x24')];}_0x445749['status'](_0x2d7ea6)['send'](_0x373cc3);};}exports[_0x7f7f('0x25')]=function(_0x2a38cd,_0x347935){var _0x4a028e={},_0x702b2={},_0x970b6f={'count':0x0,'rows':[]};var _0x253791=_['map'](db['ChatQueueReport']['rawAttributes'],function(_0x2c78b2){return{'name':_0x2c78b2[_0x7f7f('0x26')],'type':_0x2c78b2[_0x7f7f('0x27')][_0x7f7f('0x28')]};});_0x702b2[_0x7f7f('0x29')]=_[_0x7f7f('0x2a')](_0x253791,_0x7f7f('0x24'));_0x702b2[_0x7f7f('0x2b')]=_[_0x7f7f('0x2c')](_0x2a38cd[_0x7f7f('0x2b')]);_0x702b2[_0x7f7f('0x2d')]=_[_0x7f7f('0x2e')](_0x702b2[_0x7f7f('0x29')],_0x702b2[_0x7f7f('0x2b')]);_0x4a028e[_0x7f7f('0x2f')]=_['intersection'](_0x702b2[_0x7f7f('0x29')],qs['fields'](_0x2a38cd[_0x7f7f('0x2b')][_0x7f7f('0x30')]));_0x4a028e[_0x7f7f('0x2f')]=_0x4a028e[_0x7f7f('0x2f')][_0x7f7f('0x31')]?_0x4a028e['attributes']:_0x702b2[_0x7f7f('0x29')];if(!_0x2a38cd['query'][_0x7f7f('0x32')]('nolimit')){_0x4a028e[_0x7f7f('0x1b')]=qs['limit'](_0x2a38cd[_0x7f7f('0x2b')]['limit']);_0x4a028e[_0x7f7f('0x19')]=qs['offset'](_0x2a38cd['query'][_0x7f7f('0x19')]);}_0x4a028e['order']=qs['sort'](_0x2a38cd[_0x7f7f('0x2b')][_0x7f7f('0x33')]);_0x4a028e[_0x7f7f('0x34')]=qs['filters'](_[_0x7f7f('0x35')](_0x2a38cd[_0x7f7f('0x2b')],_0x702b2[_0x7f7f('0x2d')]),_0x253791);if(_0x2a38cd[_0x7f7f('0x2b')][_0x7f7f('0x36')]){_0x4a028e['where']=_['merge'](_0x4a028e[_0x7f7f('0x34')],{'$or':_['map'](_0x253791,function(_0x56c4b8){if(_0x56c4b8[_0x7f7f('0x27')]!==_0x7f7f('0x37')){var _0x23fc04={};_0x23fc04[_0x56c4b8[_0x7f7f('0x24')]]={'$like':'%'+_0x2a38cd['query'][_0x7f7f('0x36')]+'%'};return _0x23fc04;}})});}_0x4a028e=_[_0x7f7f('0x38')]({},_0x4a028e,_0x2a38cd[_0x7f7f('0x39')]);var _0x398026={'where':_0x4a028e['where']};return db[_0x7f7f('0x3a')]['count'](_0x398026)['then'](function(_0x4b8456){_0x970b6f[_0x7f7f('0x1c')]=_0x4b8456;if(_0x2a38cd[_0x7f7f('0x2b')][_0x7f7f('0x3b')]){_0x4a028e[_0x7f7f('0x3c')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x4a028e);})[_0x7f7f('0x20')](function(_0x524af0){_0x970b6f[_0x7f7f('0x3d')]=_0x524af0;return _0x970b6f;})[_0x7f7f('0x20')](respondWithFilteredResult(_0x347935,_0x4a028e))[_0x7f7f('0x3e')](handleError(_0x347935,null));};exports['show']=function(_0x401810,_0x509a65){var _0x5ad60c={'raw':!![],'where':{'id':_0x401810['params']['id']}},_0x1b9e3d={};_0x1b9e3d['model']=_[_0x7f7f('0x2c')](db[_0x7f7f('0x3a')][_0x7f7f('0x3f')]);_0x1b9e3d[_0x7f7f('0x2b')]=_['keys'](_0x401810[_0x7f7f('0x2b')]);_0x1b9e3d['filters']=_[_0x7f7f('0x2e')](_0x1b9e3d[_0x7f7f('0x29')],_0x1b9e3d[_0x7f7f('0x2b')]);_0x5ad60c[_0x7f7f('0x2f')]=_[_0x7f7f('0x2e')](_0x1b9e3d[_0x7f7f('0x29')],qs[_0x7f7f('0x30')](_0x401810[_0x7f7f('0x2b')][_0x7f7f('0x30')]));_0x5ad60c['attributes']=_0x5ad60c[_0x7f7f('0x2f')][_0x7f7f('0x31')]?_0x5ad60c['attributes']:_0x1b9e3d['model'];if(_0x401810['query'][_0x7f7f('0x3b')]){_0x5ad60c[_0x7f7f('0x3c')]=[{'all':!![]}];}_0x5ad60c=_[_0x7f7f('0x38')]({},_0x5ad60c,_0x401810[_0x7f7f('0x39')]);return db['ChatQueueReport'][_0x7f7f('0x40')](_0x5ad60c)[_0x7f7f('0x20')](handleEntityNotFound(_0x509a65,null))['then'](respondWithResult(_0x509a65,null))[_0x7f7f('0x3e')](handleError(_0x509a65,null));};exports[_0x7f7f('0x41')]=function(_0x5d6124,_0x96549e){return db[_0x7f7f('0x3a')][_0x7f7f('0x41')](_0x5d6124[_0x7f7f('0x42')],{})[_0x7f7f('0x20')](respondWithResult(_0x96549e,0xc9))[_0x7f7f('0x3e')](handleError(_0x96549e,null));};exports[_0x7f7f('0x43')]=function(_0x3b5b3a,_0xd701ee){if(_0x3b5b3a[_0x7f7f('0x42')]['id']){delete _0x3b5b3a['body']['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x3b5b3a[_0x7f7f('0x44')]['id']}})[_0x7f7f('0x20')](handleEntityNotFound(_0xd701ee,null))[_0x7f7f('0x20')](saveUpdates(_0x3b5b3a[_0x7f7f('0x42')],null))[_0x7f7f('0x20')](respondWithResult(_0xd701ee,null))['catch'](handleError(_0xd701ee,null));};exports[_0x7f7f('0x45')]=function(_0x42c8c0,_0x175eb0){return db[_0x7f7f('0x3a')]['find']({'where':{'id':_0x42c8c0[_0x7f7f('0x44')]['id']}})[_0x7f7f('0x20')](handleEntityNotFound(_0x175eb0,null))[_0x7f7f('0x20')](removeEntity(_0x175eb0,null))[_0x7f7f('0x3e')](handleError(_0x175eb0,null));};exports[_0x7f7f('0x46')]=function(_0x4ca126,_0x2174c1){return db['ChatQueueReport'][_0x7f7f('0x46')]()['then'](respondWithResult(_0x2174c1,null))[_0x7f7f('0x3e')](handleError(_0x2174c1,null));}; \ No newline at end of file +var _0xc962=['name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','ChatQueueReport','includeAll','include','findAll','catch','params','intersection','create','body','find','destroy','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','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/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error','stack'];(function(_0x901b53,_0x29de87){var _0x5aa1bf=function(_0x25dd7d){while(--_0x25dd7d){_0x901b53['push'](_0x901b53['shift']());}};_0x5aa1bf(++_0x29de87);}(_0xc962,0x6d));var _0x2c96=function(_0x50e76a,_0x2d71f6){_0x50e76a=_0x50e76a-0x0;var _0x38e24b=_0xc962[_0x50e76a];return _0x38e24b;};'use strict';var emlformat=require(_0x2c96('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2c96('0x1'));var moment=require(_0x2c96('0x2'));var BPromise=require(_0x2c96('0x3'));var Mustache=require(_0x2c96('0x4'));var util=require(_0x2c96('0x5'));var path=require(_0x2c96('0x6'));var sox=require(_0x2c96('0x7'));var csv=require(_0x2c96('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c96('0x9'));var _=require(_0x2c96('0xa'));var squel=require(_0x2c96('0xb'));var crypto=require(_0x2c96('0xc'));var jsforce=require(_0x2c96('0xd'));var deskjs=require(_0x2c96('0xe'));var toCsv=require(_0x2c96('0x8'));var querystring=require(_0x2c96('0xf'));var Papa=require(_0x2c96('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2c96('0x11'));var as=require(_0x2c96('0x12'));var hardwareService=require(_0x2c96('0x13'));var logger=require(_0x2c96('0x14'))(_0x2c96('0x15'));var utils=require(_0x2c96('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2c96('0x17'))['db'];function respondWithStatusCode(_0x43d83f,_0x27a97c){_0x27a97c=_0x27a97c||0xcc;return function(_0x2491a4){if(_0x2491a4){return _0x43d83f[_0x2c96('0x18')](_0x27a97c);}return _0x43d83f[_0x2c96('0x19')](_0x27a97c)[_0x2c96('0x1a')]();};}function respondWithResult(_0x534203,_0x4fa416){_0x4fa416=_0x4fa416||0xc8;return function(_0x4c1d9a){if(_0x4c1d9a){return _0x534203[_0x2c96('0x19')](_0x4fa416)[_0x2c96('0x1b')](_0x4c1d9a);}};}function respondWithFilteredResult(_0x567ef0,_0x35ad10){return function(_0x3903a7){if(_0x3903a7){var _0x54649f=typeof _0x35ad10[_0x2c96('0x1c')]===_0x2c96('0x1d')&&typeof _0x35ad10[_0x2c96('0x1e')]===_0x2c96('0x1d');var _0x4757f3=_0x3903a7[_0x2c96('0x1f')];var _0x2ccbed=_0x54649f?0x0:_0x35ad10[_0x2c96('0x1c')];var _0x3fde3e=_0x54649f?_0x3903a7['count']:_0x35ad10['offset']+_0x35ad10[_0x2c96('0x1e')];var _0x3fb8a6;if(_0x3fde3e>=_0x4757f3){_0x3fde3e=_0x4757f3;_0x3fb8a6=0xc8;}else{_0x3fb8a6=0xce;}_0x567ef0[_0x2c96('0x19')](_0x3fb8a6);return _0x567ef0['set'](_0x2c96('0x20'),_0x2ccbed+'-'+_0x3fde3e+'/'+_0x4757f3)[_0x2c96('0x1b')](_0x3903a7);}return null;};}function patchUpdates(_0x17573b){return function(_0x4f8178){try{jsonpatch[_0x2c96('0x21')](_0x4f8178,_0x17573b,!![]);}catch(_0x3450ab){return BPromise['reject'](_0x3450ab);}return _0x4f8178[_0x2c96('0x22')]();};}function saveUpdates(_0x173867,_0x361e42){return function(_0x14daf1){if(_0x14daf1){return _0x14daf1[_0x2c96('0x23')](_0x173867)[_0x2c96('0x24')](function(_0x623e95){return _0x623e95;});}return null;};}function removeEntity(_0x5b2332,_0x3d8b21){return function(_0x58933c){if(_0x58933c){return _0x58933c['destroy']()[_0x2c96('0x24')](function(){_0x5b2332['status'](0xcc)[_0x2c96('0x1a')]();});}};}function handleEntityNotFound(_0x66cd41,_0x39e8bf){return function(_0xa5a767){if(!_0xa5a767){_0x66cd41['sendStatus'](0x194);}return _0xa5a767;};}function handleError(_0x345b6c,_0x1496bb){_0x1496bb=_0x1496bb||0x1f4;return function(_0x490f14){logger[_0x2c96('0x25')](_0x490f14[_0x2c96('0x26')]);if(_0x490f14[_0x2c96('0x27')]){delete _0x490f14[_0x2c96('0x27')];}_0x345b6c['status'](_0x1496bb)[_0x2c96('0x28')](_0x490f14);};}exports[_0x2c96('0x29')]=function(_0x1ddcc5,_0x319ad5){var _0x481612={},_0x19ee5d={},_0x332e2a={'count':0x0,'rows':[]};var _0x5eea2f=_[_0x2c96('0x2a')](db['ChatQueueReport'][_0x2c96('0x2b')],function(_0x761fe1){return{'name':_0x761fe1[_0x2c96('0x2c')],'type':_0x761fe1[_0x2c96('0x2d')][_0x2c96('0x2e')]};});_0x19ee5d[_0x2c96('0x2f')]=_[_0x2c96('0x2a')](_0x5eea2f,_0x2c96('0x27'));_0x19ee5d['query']=_[_0x2c96('0x30')](_0x1ddcc5[_0x2c96('0x31')]);_0x19ee5d[_0x2c96('0x32')]=_['intersection'](_0x19ee5d[_0x2c96('0x2f')],_0x19ee5d[_0x2c96('0x31')]);_0x481612[_0x2c96('0x33')]=_['intersection'](_0x19ee5d[_0x2c96('0x2f')],qs[_0x2c96('0x34')](_0x1ddcc5[_0x2c96('0x31')][_0x2c96('0x34')]));_0x481612[_0x2c96('0x33')]=_0x481612['attributes'][_0x2c96('0x35')]?_0x481612[_0x2c96('0x33')]:_0x19ee5d[_0x2c96('0x2f')];if(!_0x1ddcc5[_0x2c96('0x31')][_0x2c96('0x36')](_0x2c96('0x37'))){_0x481612[_0x2c96('0x1e')]=qs[_0x2c96('0x1e')](_0x1ddcc5['query']['limit']);_0x481612[_0x2c96('0x1c')]=qs[_0x2c96('0x1c')](_0x1ddcc5[_0x2c96('0x31')][_0x2c96('0x1c')]);}_0x481612['order']=qs[_0x2c96('0x38')](_0x1ddcc5['query'][_0x2c96('0x38')]);_0x481612[_0x2c96('0x39')]=qs[_0x2c96('0x32')](_[_0x2c96('0x3a')](_0x1ddcc5[_0x2c96('0x31')],_0x19ee5d['filters']),_0x5eea2f);if(_0x1ddcc5[_0x2c96('0x31')]['filter']){_0x481612[_0x2c96('0x39')]=_[_0x2c96('0x3b')](_0x481612['where'],{'$or':_['map'](_0x5eea2f,function(_0xdb4945){if(_0xdb4945[_0x2c96('0x2d')]!==_0x2c96('0x3c')){var _0x4655d6={};_0x4655d6[_0xdb4945[_0x2c96('0x27')]]={'$like':'%'+_0x1ddcc5[_0x2c96('0x31')]['filter']+'%'};return _0x4655d6;}})});}_0x481612=_[_0x2c96('0x3b')]({},_0x481612,_0x1ddcc5[_0x2c96('0x3d')]);var _0x532c08={'where':_0x481612['where']};return db[_0x2c96('0x3e')][_0x2c96('0x1f')](_0x532c08)[_0x2c96('0x24')](function(_0x3a7585){_0x332e2a[_0x2c96('0x1f')]=_0x3a7585;if(_0x1ddcc5[_0x2c96('0x31')][_0x2c96('0x3f')]){_0x481612[_0x2c96('0x40')]=[{'all':!![]}];}return db[_0x2c96('0x3e')][_0x2c96('0x41')](_0x481612);})[_0x2c96('0x24')](function(_0x609778){_0x332e2a['rows']=_0x609778;return _0x332e2a;})['then'](respondWithFilteredResult(_0x319ad5,_0x481612))[_0x2c96('0x42')](handleError(_0x319ad5,null));};exports['show']=function(_0x1c490e,_0x1e6d13){var _0x10348e={'raw':!![],'where':{'id':_0x1c490e[_0x2c96('0x43')]['id']}},_0x1480a1={};_0x1480a1['model']=_['keys'](db[_0x2c96('0x3e')]['rawAttributes']);_0x1480a1[_0x2c96('0x31')]=_[_0x2c96('0x30')](_0x1c490e[_0x2c96('0x31')]);_0x1480a1[_0x2c96('0x32')]=_[_0x2c96('0x44')](_0x1480a1['model'],_0x1480a1[_0x2c96('0x31')]);_0x10348e[_0x2c96('0x33')]=_['intersection'](_0x1480a1[_0x2c96('0x2f')],qs['fields'](_0x1c490e[_0x2c96('0x31')][_0x2c96('0x34')]));_0x10348e[_0x2c96('0x33')]=_0x10348e[_0x2c96('0x33')][_0x2c96('0x35')]?_0x10348e[_0x2c96('0x33')]:_0x1480a1[_0x2c96('0x2f')];if(_0x1c490e[_0x2c96('0x31')]['includeAll']){_0x10348e[_0x2c96('0x40')]=[{'all':!![]}];}_0x10348e=_[_0x2c96('0x3b')]({},_0x10348e,_0x1c490e[_0x2c96('0x3d')]);return db[_0x2c96('0x3e')]['find'](_0x10348e)[_0x2c96('0x24')](handleEntityNotFound(_0x1e6d13,null))[_0x2c96('0x24')](respondWithResult(_0x1e6d13,null))[_0x2c96('0x42')](handleError(_0x1e6d13,null));};exports[_0x2c96('0x45')]=function(_0x202a15,_0x583a6c){return db[_0x2c96('0x3e')][_0x2c96('0x45')](_0x202a15['body'],{})[_0x2c96('0x24')](respondWithResult(_0x583a6c,0xc9))['catch'](handleError(_0x583a6c,null));};exports[_0x2c96('0x23')]=function(_0x26196e,_0x2d2c98){if(_0x26196e[_0x2c96('0x46')]['id']){delete _0x26196e[_0x2c96('0x46')]['id'];}return db[_0x2c96('0x3e')][_0x2c96('0x47')]({'where':{'id':_0x26196e[_0x2c96('0x43')]['id']}})[_0x2c96('0x24')](handleEntityNotFound(_0x2d2c98,null))[_0x2c96('0x24')](saveUpdates(_0x26196e[_0x2c96('0x46')],null))['then'](respondWithResult(_0x2d2c98,null))[_0x2c96('0x42')](handleError(_0x2d2c98,null));};exports[_0x2c96('0x48')]=function(_0x2bbeae,_0x379405){return db[_0x2c96('0x3e')]['find']({'where':{'id':_0x2bbeae[_0x2c96('0x43')]['id']}})['then'](handleEntityNotFound(_0x379405,null))[_0x2c96('0x24')](removeEntity(_0x379405,null))[_0x2c96('0x42')](handleError(_0x379405,null));};exports['describe']=function(_0x244255,_0x7feba3){return db[_0x2c96('0x3e')][_0x2c96('0x49')]()[_0x2c96('0x24')](respondWithResult(_0x7feba3,null))[_0x2c96('0x42')](handleError(_0x7feba3,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 70b4e37..7252ecf 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(_0x49d98e,_0x4e69d1){var _0xbe460c=function(_0x42d810){while(--_0x42d810){_0x49d98e['push'](_0x49d98e['shift']());}};_0xbe460c(++_0x4e69d1);}(_0x757a,0xde));var _0xa757=function(_0x34c546,_0x174ae6){_0x34c546=_0x34c546-0x0;var _0x1d82b8=_0x757a[_0x34c546];return _0x1d82b8;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 2276d97..0e72cde 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 _0xcde4=['../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','UpdateChatQueueReport','update','raw','where','attributes','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x5e48bf,_0x497646){var _0x170eaa=function(_0x260909){while(--_0x260909){_0x5e48bf['push'](_0x5e48bf['shift']());}};_0x170eaa(++_0x497646);}(_0xcde4,0x13a));var _0x4cde=function(_0x3fe042,_0x1106f7){_0x3fe042=_0x3fe042-0x0;var _0x7d4a1f=_0xcde4[_0x3fe042];return _0x7d4a1f;};'use strict';var _=require(_0x4cde('0x0'));var util=require(_0x4cde('0x1'));var moment=require('moment');var BPromise=require(_0x4cde('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4cde('0x3'))['db'];var utils=require(_0x4cde('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4cde('0x5'));var jayson=require(_0x4cde('0x6'));var client=jayson[_0x4cde('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x123de2,_0xc28a78,_0x309a16){return new BPromise(function(_0x425f6c,_0x292a35){return client[_0x4cde('0x8')](_0x123de2,_0x309a16)[_0x4cde('0x9')](function(_0x1312d0){logger[_0x4cde('0xa')](_0x4cde('0xb'),_0xc28a78,_0x4cde('0xc'));logger[_0x4cde('0xd')](_0x4cde('0xe'),_0xc28a78,_0x4cde('0xc'),JSON[_0x4cde('0xf')](_0x1312d0));if(_0x1312d0[_0x4cde('0x10')]){if(_0x1312d0[_0x4cde('0x10')]['code']===0x1f4){logger[_0x4cde('0x10')](_0x4cde('0xb'),_0xc28a78,_0x1312d0['error']['message']);return _0x292a35(_0x1312d0[_0x4cde('0x10')]['message']);}logger[_0x4cde('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0xc28a78,_0x1312d0[_0x4cde('0x10')]['message']);return _0x425f6c(_0x1312d0['error'][_0x4cde('0x11')]);}else{logger[_0x4cde('0xa')]('ChatQueueReport,\x20%s,\x20%s',_0xc28a78,_0x4cde('0xc'));_0x425f6c(_0x1312d0['result'][_0x4cde('0x11')]);}})[_0x4cde('0x12')](function(_0x50c71e){logger[_0x4cde('0x10')](_0x4cde('0xb'),_0xc28a78,_0x50c71e);_0x292a35(_0x50c71e);});});}exports[_0x4cde('0x13')]=function(_0x5b30c0){var _0x563b56=this;return new Promise(function(_0x4c6bfe,_0x2e225c){return db[_0x4cde('0x14')][_0x4cde('0x15')](_0x5b30c0[_0x4cde('0x16')],{'raw':_0x5b30c0[_0x4cde('0x17')]?_0x5b30c0['options']['raw']===undefined?!![]:![]:!![]})[_0x4cde('0x9')](function(_0x333087){logger[_0x4cde('0xa')](_0x4cde('0x13'),_0x5b30c0);logger[_0x4cde('0xd')]('CreateChatQueueReport',_0x5b30c0,JSON[_0x4cde('0xf')](_0x333087));_0x4c6bfe(_0x333087);})['catch'](function(_0x59c16d){logger['error'](_0x4cde('0x13'),_0x59c16d[_0x4cde('0x11')],_0x5b30c0);_0x2e225c(_0x563b56[_0x4cde('0x10')](0x1f4,_0x59c16d[_0x4cde('0x11')]));});});};exports[_0x4cde('0x18')]=function(_0x19a64f){var _0x4cb8d0=this;return new Promise(function(_0x3155bd,_0x48ab2c){return db[_0x4cde('0x14')][_0x4cde('0x19')](_0x19a64f[_0x4cde('0x16')],{'raw':_0x19a64f[_0x4cde('0x17')]?_0x19a64f[_0x4cde('0x17')][_0x4cde('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19a64f[_0x4cde('0x17')]?_0x19a64f[_0x4cde('0x17')][_0x4cde('0x1b')]||null:null,'attributes':_0x19a64f[_0x4cde('0x17')]?_0x19a64f[_0x4cde('0x17')][_0x4cde('0x1c')]||null:null,'limit':_0x19a64f[_0x4cde('0x17')]?_0x19a64f[_0x4cde('0x17')]['limit']||null:null})['then'](function(_0x4128de){logger['info'](_0x4cde('0x18'),_0x19a64f);logger[_0x4cde('0xd')](_0x4cde('0x18'),_0x19a64f,JSON[_0x4cde('0xf')](_0x4128de));_0x3155bd(_0x4128de);})['catch'](function(_0x4ddd6a){logger[_0x4cde('0x10')]('UpdateChatQueueReport',_0x4ddd6a[_0x4cde('0x11')],_0x19a64f);_0x48ab2c(_0x4cb8d0[_0x4cde('0x10')](0x1f4,_0x4ddd6a[_0x4cde('0x11')]));});});}; \ No newline at end of file +var _0x87e4=['jayson/promise','client','http','then','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueueReport,\x20%s,\x20%s','info','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','update','where','attributes','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x248f3e,_0x2405e0){var _0x18f93c=function(_0x459551){while(--_0x459551){_0x248f3e['push'](_0x248f3e['shift']());}};_0x18f93c(++_0x2405e0);}(_0x87e4,0x100));var _0x487e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x87e4[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x487e('0x0'));var util=require(_0x487e('0x1'));var moment=require(_0x487e('0x2'));var BPromise=require(_0x487e('0x3'));var rs=require(_0x487e('0x4'));var fs=require('fs');var Redis=require(_0x487e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x487e('0x6'))(_0x487e('0x7'));var config=require('../../config/environment');var jayson=require(_0x487e('0x8'));var client=jayson[_0x487e('0x9')][_0x487e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d2039,_0x4dcf87,_0x1f4eef){return new BPromise(function(_0x27c661,_0x576ca1){return client['request'](_0x5d2039,_0x1f4eef)[_0x487e('0xb')](function(_0x5a7a2){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x4dcf87,_0x487e('0xc'));logger[_0x487e('0xd')](_0x487e('0xe'),_0x4dcf87,'request\x20sent',JSON[_0x487e('0xf')](_0x5a7a2));if(_0x5a7a2[_0x487e('0x10')]){if(_0x5a7a2[_0x487e('0x10')][_0x487e('0x11')]===0x1f4){logger[_0x487e('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x4dcf87,_0x5a7a2['error']['message']);return _0x576ca1(_0x5a7a2[_0x487e('0x10')][_0x487e('0x12')]);}logger[_0x487e('0x10')](_0x487e('0x13'),_0x4dcf87,_0x5a7a2[_0x487e('0x10')][_0x487e('0x12')]);return _0x27c661(_0x5a7a2[_0x487e('0x10')]['message']);}else{logger[_0x487e('0x14')](_0x487e('0x13'),_0x4dcf87,_0x487e('0xc'));_0x27c661(_0x5a7a2[_0x487e('0x15')]['message']);}})[_0x487e('0x16')](function(_0x32dd2e){logger['error'](_0x487e('0x13'),_0x4dcf87,_0x32dd2e);_0x576ca1(_0x32dd2e);});});}exports[_0x487e('0x17')]=function(_0x4c0fd5){var _0x3b750b=this;return new Promise(function(_0x3579c3,_0x65e27d){return db[_0x487e('0x18')][_0x487e('0x19')](_0x4c0fd5[_0x487e('0x1a')],{'raw':_0x4c0fd5[_0x487e('0x1b')]?_0x4c0fd5[_0x487e('0x1b')][_0x487e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4ca1af){logger[_0x487e('0x14')](_0x487e('0x17'),_0x4c0fd5);logger['debug']('CreateChatQueueReport',_0x4c0fd5,JSON[_0x487e('0xf')](_0x4ca1af));_0x3579c3(_0x4ca1af);})[_0x487e('0x16')](function(_0x4675df){logger[_0x487e('0x10')](_0x487e('0x17'),_0x4675df[_0x487e('0x12')],_0x4c0fd5);_0x65e27d(_0x3b750b[_0x487e('0x10')](0x1f4,_0x4675df[_0x487e('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x377602){var _0x458073=this;return new Promise(function(_0x5623b0,_0x48e3cf){return db[_0x487e('0x18')][_0x487e('0x1d')](_0x377602[_0x487e('0x1a')],{'raw':_0x377602['options']?_0x377602['options'][_0x487e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x377602[_0x487e('0x1b')]?_0x377602[_0x487e('0x1b')][_0x487e('0x1e')]||null:null,'attributes':_0x377602[_0x487e('0x1b')]?_0x377602[_0x487e('0x1b')][_0x487e('0x1f')]||null:null,'limit':_0x377602[_0x487e('0x1b')]?_0x377602[_0x487e('0x1b')]['limit']||null:null})[_0x487e('0xb')](function(_0x3bdf96){logger['info'](_0x487e('0x20'),_0x377602);logger[_0x487e('0xd')](_0x487e('0x20'),_0x377602,JSON['stringify'](_0x3bdf96));_0x5623b0(_0x3bdf96);})[_0x487e('0x16')](function(_0x490e81){logger[_0x487e('0x10')]('UpdateChatQueueReport',_0x490e81[_0x487e('0x12')],_0x377602);_0x48e3cf(_0x458073[_0x487e('0x10')](0x1f4,_0x490e81['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index a6e3f55..7207e59 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 _0xdd1d=['multer','util','path','fs-extra','../../components/auth/service','./chatQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','put','delete','destroy','exports'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0xdd1d,0xa0));var _0xddd1=function(_0x51160c,_0x374b59){_0x51160c=_0x51160c-0x0;var _0x15a3fb=_0xdd1d[_0x51160c];return _0x15a3fb;};'use strict';var multer=require(_0xddd1('0x0'));var util=require(_0xddd1('0x1'));var path=require(_0xddd1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xddd1('0x3'));var auth=require(_0xddd1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xddd1('0x5'));router[_0xddd1('0x6')]('/',auth[_0xddd1('0x7')](),controller['index']);router[_0xddd1('0x6')]('/describe',auth[_0xddd1('0x7')](),controller[_0xddd1('0x8')]);router[_0xddd1('0x6')](_0xddd1('0x9'),auth[_0xddd1('0x7')](),controller[_0xddd1('0xa')]);router[_0xddd1('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xddd1('0xc')](_0xddd1('0x9'),auth[_0xddd1('0x7')](),controller['update']);router[_0xddd1('0xd')](_0xddd1('0x9'),auth['isAuthenticated'](),controller[_0xddd1('0xe')]);module[_0xddd1('0xf')]=router; \ No newline at end of file +var _0xb2e2=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express'];(function(_0x2478fc,_0x41df49){var _0x473f4c=function(_0x31dd33){while(--_0x31dd33){_0x2478fc['push'](_0x2478fc['shift']());}};_0x473f4c(++_0x41df49);}(_0xb2e2,0xac));var _0x2b2e=function(_0x37eaa4,_0x57e9a3){_0x37eaa4=_0x37eaa4-0x0;var _0x202f03=_0xb2e2[_0x37eaa4];return _0x202f03;};'use strict';var multer=require('multer');var util=require(_0x2b2e('0x0'));var path=require(_0x2b2e('0x1'));var timeout=require(_0x2b2e('0x2'));var express=require(_0x2b2e('0x3'));var router=express[_0x2b2e('0x4')]();var fs_extra=require(_0x2b2e('0x5'));var auth=require(_0x2b2e('0x6'));var interaction=require(_0x2b2e('0x7'));var config=require('../../config/environment');var controller=require(_0x2b2e('0x8'));router[_0x2b2e('0x9')]('/',auth[_0x2b2e('0xa')](),controller[_0x2b2e('0xb')]);router[_0x2b2e('0x9')](_0x2b2e('0xc'),auth[_0x2b2e('0xa')](),controller[_0x2b2e('0xd')]);router[_0x2b2e('0x9')](_0x2b2e('0xe'),auth[_0x2b2e('0xa')](),controller[_0x2b2e('0xf')]);router[_0x2b2e('0x10')]('/',auth['isAuthenticated'](),controller[_0x2b2e('0x11')]);router[_0x2b2e('0x12')](_0x2b2e('0xe'),auth[_0x2b2e('0xa')](),controller[_0x2b2e('0x13')]);router[_0x2b2e('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2b2e('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 26446b1..df11165 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(_0x35b896,_0x532d19){var _0xad4c8=function(_0x1752b5){while(--_0x1752b5){_0x35b896['push'](_0x35b896['shift']());}};_0xad4c8(++_0x532d19);}(_0x70e0,0x17b));var _0x070e=function(_0x179a00,_0x211571){_0x179a00=_0x179a00-0x0;var _0x4a64a0=_0x70e0[_0x179a00];return _0x4a64a0;};'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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0xb43b,0x1b2));var _0xbb43=function(_0x238cc2,_0x3c618d){_0x238cc2=_0x238cc2-0x0;var _0x293692=_0xb43b[_0x238cc2];return _0x293692;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index baf05a5..4f4a4fb 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 _0x414c=['undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','intersection','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3bdb7c,_0x2b2e13){var _0x299ed4=function(_0xef4f5a){while(--_0xef4f5a){_0x3bdb7c['push'](_0x3bdb7c['shift']());}};_0x299ed4(++_0x2b2e13);}(_0x414c,0x16a));var _0xc414=function(_0x1a4800,_0x509cb2){_0x1a4800=_0x1a4800-0x0;var _0x301778=_0x414c[_0x1a4800];return _0x301778;};'use strict';var emlformat=require(_0xc414('0x0'));var rimraf=require(_0xc414('0x1'));var zipdir=require(_0xc414('0x2'));var jsonpatch=require(_0xc414('0x3'));var rp=require(_0xc414('0x4'));var moment=require('moment');var BPromise=require(_0xc414('0x5'));var Mustache=require(_0xc414('0x6'));var util=require(_0xc414('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc414('0x8'));var fs=require('fs');var fs_extra=require(_0xc414('0x9'));var _=require(_0xc414('0xa'));var squel=require(_0xc414('0xb'));var crypto=require(_0xc414('0xc'));var jsforce=require(_0xc414('0xd'));var deskjs=require(_0xc414('0xe'));var toCsv=require(_0xc414('0xf'));var querystring=require(_0xc414('0x10'));var Papa=require(_0xc414('0x11'));var Redis=require(_0xc414('0x12'));var authService=require(_0xc414('0x13'));var qs=require(_0xc414('0x14'));var as=require(_0xc414('0x15'));var hardwareService=require(_0xc414('0x16'));var logger=require(_0xc414('0x17'))(_0xc414('0x18'));var utils=require('../../config/utils');var config=require(_0xc414('0x19'));var licenseUtil=require(_0xc414('0x1a'));var db=require(_0xc414('0x1b'))['db'];function respondWithStatusCode(_0x381fb4,_0x3d7d47){_0x3d7d47=_0x3d7d47||0xcc;return function(_0x3924b7){if(_0x3924b7){return _0x381fb4[_0xc414('0x1c')](_0x3d7d47);}return _0x381fb4[_0xc414('0x1d')](_0x3d7d47)[_0xc414('0x1e')]();};}function respondWithResult(_0x372dcc,_0x346dcf){_0x346dcf=_0x346dcf||0xc8;return function(_0x4f915e){if(_0x4f915e){return _0x372dcc[_0xc414('0x1d')](_0x346dcf)[_0xc414('0x1f')](_0x4f915e);}};}function respondWithFilteredResult(_0x13cf1f,_0x1c5b7a){return function(_0x48414a){if(_0x48414a){var _0x4b3747=typeof _0x1c5b7a[_0xc414('0x20')]===_0xc414('0x21')&&typeof _0x1c5b7a[_0xc414('0x22')]===_0xc414('0x21');var _0x64008a=_0x48414a[_0xc414('0x23')];var _0xea1eab=_0x4b3747?0x0:_0x1c5b7a['offset'];var _0x181f4c=_0x4b3747?_0x48414a[_0xc414('0x23')]:_0x1c5b7a['offset']+_0x1c5b7a[_0xc414('0x22')];var _0xcc369a;if(_0x181f4c>=_0x64008a){_0x181f4c=_0x64008a;_0xcc369a=0xc8;}else{_0xcc369a=0xce;}_0x13cf1f[_0xc414('0x1d')](_0xcc369a);return _0x13cf1f[_0xc414('0x24')](_0xc414('0x25'),_0xea1eab+'-'+_0x181f4c+'/'+_0x64008a)[_0xc414('0x1f')](_0x48414a);}return null;};}function patchUpdates(_0x529b3b){return function(_0x122817){try{jsonpatch[_0xc414('0x26')](_0x122817,_0x529b3b,!![]);}catch(_0x480344){return BPromise['reject'](_0x480344);}return _0x122817['save']();};}function saveUpdates(_0x798885,_0x5008d2){return function(_0x431af3){if(_0x431af3){return _0x431af3[_0xc414('0x27')](_0x798885)['then'](function(_0x9464f4){return _0x9464f4;});}return null;};}function removeEntity(_0x25f486,_0x59c45a){return function(_0x5254d7){if(_0x5254d7){return _0x5254d7[_0xc414('0x28')]()[_0xc414('0x29')](function(){_0x25f486[_0xc414('0x1d')](0xcc)[_0xc414('0x1e')]();});}};}function handleEntityNotFound(_0x197736,_0x455f2e){return function(_0x4cb2df){if(!_0x4cb2df){_0x197736[_0xc414('0x1c')](0x194);}return _0x4cb2df;};}function handleError(_0x15db70,_0x5b32e6){_0x5b32e6=_0x5b32e6||0x1f4;return function(_0x37328e){logger[_0xc414('0x2a')](_0x37328e[_0xc414('0x2b')]);if(_0x37328e[_0xc414('0x2c')]){delete _0x37328e[_0xc414('0x2c')];}_0x15db70[_0xc414('0x1d')](_0x5b32e6)[_0xc414('0x2d')](_0x37328e);};}exports[_0xc414('0x2e')]=function(_0x16fef5,_0x3d02bb){var _0x280168={},_0x52bd4d={},_0x325127={'count':0x0,'rows':[]};var _0x51047d=_[_0xc414('0x2f')](db[_0xc414('0x30')][_0xc414('0x31')],function(_0xceae34){return{'name':_0xceae34[_0xc414('0x32')],'type':_0xceae34[_0xc414('0x33')][_0xc414('0x34')]};});_0x52bd4d[_0xc414('0x35')]=_['map'](_0x51047d,_0xc414('0x2c'));_0x52bd4d[_0xc414('0x36')]=_[_0xc414('0x37')](_0x16fef5[_0xc414('0x36')]);_0x52bd4d[_0xc414('0x38')]=_['intersection'](_0x52bd4d[_0xc414('0x35')],_0x52bd4d[_0xc414('0x36')]);_0x280168[_0xc414('0x39')]=_['intersection'](_0x52bd4d[_0xc414('0x35')],qs[_0xc414('0x3a')](_0x16fef5[_0xc414('0x36')][_0xc414('0x3a')]));_0x280168[_0xc414('0x39')]=_0x280168[_0xc414('0x39')][_0xc414('0x3b')]?_0x280168['attributes']:_0x52bd4d[_0xc414('0x35')];if(!_0x16fef5[_0xc414('0x36')][_0xc414('0x3c')](_0xc414('0x3d'))){_0x280168['limit']=qs[_0xc414('0x22')](_0x16fef5[_0xc414('0x36')][_0xc414('0x22')]);_0x280168[_0xc414('0x20')]=qs[_0xc414('0x20')](_0x16fef5[_0xc414('0x36')][_0xc414('0x20')]);}_0x280168['order']=qs['sort'](_0x16fef5['query']['sort']);_0x280168[_0xc414('0x3e')]=qs[_0xc414('0x38')](_[_0xc414('0x3f')](_0x16fef5[_0xc414('0x36')],_0x52bd4d[_0xc414('0x38')]),_0x51047d);if(_0x16fef5[_0xc414('0x36')][_0xc414('0x40')]){_0x280168[_0xc414('0x3e')]=_[_0xc414('0x41')](_0x280168[_0xc414('0x3e')],{'$or':_[_0xc414('0x2f')](_0x51047d,function(_0x413c63){if(_0x413c63[_0xc414('0x33')]!==_0xc414('0x42')){var _0x418202={};_0x418202[_0x413c63['name']]={'$like':'%'+_0x16fef5[_0xc414('0x36')][_0xc414('0x40')]+'%'};return _0x418202;}})});}_0x280168=_[_0xc414('0x41')]({},_0x280168,_0x16fef5['options']);var _0x5d86da={'where':_0x280168[_0xc414('0x3e')]};return db[_0xc414('0x30')][_0xc414('0x23')](_0x5d86da)[_0xc414('0x29')](function(_0x38e97b){_0x325127[_0xc414('0x23')]=_0x38e97b;if(_0x16fef5[_0xc414('0x36')][_0xc414('0x43')]){_0x280168[_0xc414('0x44')]=[{'all':!![]}];}return db[_0xc414('0x30')][_0xc414('0x45')](_0x280168);})['then'](function(_0x3ab60d){_0x325127[_0xc414('0x46')]=_0x3ab60d;return _0x325127;})['then'](respondWithFilteredResult(_0x3d02bb,_0x280168))['catch'](handleError(_0x3d02bb,null));};exports[_0xc414('0x47')]=function(_0x367fe6,_0xbe93f3){var _0x3021ce={'raw':!![],'where':{'id':_0x367fe6[_0xc414('0x48')]['id']}},_0x23bc74={};_0x23bc74[_0xc414('0x35')]=_['keys'](db['ChatTransferReport'][_0xc414('0x31')]);_0x23bc74[_0xc414('0x36')]=_[_0xc414('0x37')](_0x367fe6[_0xc414('0x36')]);_0x23bc74['filters']=_[_0xc414('0x49')](_0x23bc74['model'],_0x23bc74[_0xc414('0x36')]);_0x3021ce[_0xc414('0x39')]=_[_0xc414('0x49')](_0x23bc74[_0xc414('0x35')],qs[_0xc414('0x3a')](_0x367fe6[_0xc414('0x36')][_0xc414('0x3a')]));_0x3021ce['attributes']=_0x3021ce[_0xc414('0x39')][_0xc414('0x3b')]?_0x3021ce[_0xc414('0x39')]:_0x23bc74[_0xc414('0x35')];if(_0x367fe6[_0xc414('0x36')]['includeAll']){_0x3021ce['include']=[{'all':!![]}];}_0x3021ce=_[_0xc414('0x41')]({},_0x3021ce,_0x367fe6['options']);return db[_0xc414('0x30')][_0xc414('0x4a')](_0x3021ce)['then'](handleEntityNotFound(_0xbe93f3,null))[_0xc414('0x29')](respondWithResult(_0xbe93f3,null))[_0xc414('0x4b')](handleError(_0xbe93f3,null));};exports[_0xc414('0x4c')]=function(_0xab872a,_0xf2edf){return db[_0xc414('0x30')][_0xc414('0x4c')](_0xab872a[_0xc414('0x4d')],{})[_0xc414('0x29')](respondWithResult(_0xf2edf,0xc9))[_0xc414('0x4b')](handleError(_0xf2edf,null));};exports['update']=function(_0x4f3a30,_0x228391){if(_0x4f3a30[_0xc414('0x4d')]['id']){delete _0x4f3a30[_0xc414('0x4d')]['id'];}return db[_0xc414('0x30')][_0xc414('0x4a')]({'where':{'id':_0x4f3a30[_0xc414('0x48')]['id']}})[_0xc414('0x29')](handleEntityNotFound(_0x228391,null))['then'](saveUpdates(_0x4f3a30[_0xc414('0x4d')],null))[_0xc414('0x29')](respondWithResult(_0x228391,null))[_0xc414('0x4b')](handleError(_0x228391,null));};exports[_0xc414('0x28')]=function(_0x534166,_0x36a9c1){return db[_0xc414('0x30')]['find']({'where':{'id':_0x534166[_0xc414('0x48')]['id']}})['then'](handleEntityNotFound(_0x36a9c1,null))[_0xc414('0x29')](removeEntity(_0x36a9c1,null))['catch'](handleError(_0x36a9c1,null));};exports[_0xc414('0x4e')]=function(_0xb438a5,_0x34dbf4){return db[_0xc414('0x30')][_0xc414('0x4e')]()[_0xc414('0x29')](respondWithResult(_0x34dbf4,null))['catch'](handleError(_0x34dbf4,null));}; \ No newline at end of file +var _0xf642=['index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','ChatTransferReport','findAll','rows','catch','params','keys','include','create','body','update','find','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','apply','reject','then','destroy','end','error','name'];(function(_0x1423f0,_0x18bb72){var _0x5dfea4=function(_0x240314){while(--_0x240314){_0x1423f0['push'](_0x1423f0['shift']());}};_0x5dfea4(++_0x18bb72);}(_0xf642,0xbc));var _0x2f64=function(_0x348652,_0x1ab849){_0x348652=_0x348652-0x0;var _0x18a9ea=_0xf642[_0x348652];return _0x18a9ea;};'use strict';var emlformat=require(_0x2f64('0x0'));var rimraf=require(_0x2f64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2f64('0x2'));var BPromise=require(_0x2f64('0x3'));var Mustache=require(_0x2f64('0x4'));var util=require(_0x2f64('0x5'));var path=require(_0x2f64('0x6'));var sox=require(_0x2f64('0x7'));var csv=require(_0x2f64('0x8'));var ejs=require(_0x2f64('0x9'));var fs=require('fs');var fs_extra=require(_0x2f64('0xa'));var _=require(_0x2f64('0xb'));var squel=require(_0x2f64('0xc'));var crypto=require(_0x2f64('0xd'));var jsforce=require(_0x2f64('0xe'));var deskjs=require(_0x2f64('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2f64('0x10'));var Papa=require('papaparse');var Redis=require(_0x2f64('0x11'));var authService=require(_0x2f64('0x12'));var qs=require(_0x2f64('0x13'));var as=require(_0x2f64('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f64('0x15'))(_0x2f64('0x16'));var utils=require(_0x2f64('0x17'));var config=require(_0x2f64('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2f64('0x19'))['db'];function respondWithStatusCode(_0x4ca95a,_0x76b722){_0x76b722=_0x76b722||0xcc;return function(_0xa54e7b){if(_0xa54e7b){return _0x4ca95a[_0x2f64('0x1a')](_0x76b722);}return _0x4ca95a[_0x2f64('0x1b')](_0x76b722)['end']();};}function respondWithResult(_0x1c9ccd,_0x164125){_0x164125=_0x164125||0xc8;return function(_0xe94372){if(_0xe94372){return _0x1c9ccd[_0x2f64('0x1b')](_0x164125)[_0x2f64('0x1c')](_0xe94372);}};}function respondWithFilteredResult(_0x5c839f,_0x5d21ab){return function(_0x365413){if(_0x365413){var _0x338f05=typeof _0x5d21ab['offset']===_0x2f64('0x1d')&&typeof _0x5d21ab[_0x2f64('0x1e')]===_0x2f64('0x1d');var _0x2a22e5=_0x365413['count'];var _0x57c3d3=_0x338f05?0x0:_0x5d21ab[_0x2f64('0x1f')];var _0x230423=_0x338f05?_0x365413['count']:_0x5d21ab[_0x2f64('0x1f')]+_0x5d21ab[_0x2f64('0x1e')];var _0x14e056;if(_0x230423>=_0x2a22e5){_0x230423=_0x2a22e5;_0x14e056=0xc8;}else{_0x14e056=0xce;}_0x5c839f[_0x2f64('0x1b')](_0x14e056);return _0x5c839f[_0x2f64('0x20')]('Content-Range',_0x57c3d3+'-'+_0x230423+'/'+_0x2a22e5)[_0x2f64('0x1c')](_0x365413);}return null;};}function patchUpdates(_0x1d1acc){return function(_0x2591cd){try{jsonpatch[_0x2f64('0x21')](_0x2591cd,_0x1d1acc,!![]);}catch(_0x48b752){return BPromise[_0x2f64('0x22')](_0x48b752);}return _0x2591cd['save']();};}function saveUpdates(_0x4a32a9,_0x41fbaf){return function(_0x550a7f){if(_0x550a7f){return _0x550a7f['update'](_0x4a32a9)[_0x2f64('0x23')](function(_0x287b10){return _0x287b10;});}return null;};}function removeEntity(_0x38835,_0x392619){return function(_0x3a63ca){if(_0x3a63ca){return _0x3a63ca[_0x2f64('0x24')]()[_0x2f64('0x23')](function(){_0x38835[_0x2f64('0x1b')](0xcc)[_0x2f64('0x25')]();});}};}function handleEntityNotFound(_0x44ed92,_0x4dd7cf){return function(_0x1fc455){if(!_0x1fc455){_0x44ed92[_0x2f64('0x1a')](0x194);}return _0x1fc455;};}function handleError(_0x3e0d95,_0x587c84){_0x587c84=_0x587c84||0x1f4;return function(_0x340475){logger[_0x2f64('0x26')](_0x340475['stack']);if(_0x340475[_0x2f64('0x27')]){delete _0x340475[_0x2f64('0x27')];}_0x3e0d95[_0x2f64('0x1b')](_0x587c84)['send'](_0x340475);};}exports[_0x2f64('0x28')]=function(_0x124598,_0x2391ff){var _0x253a2a={},_0x118308={},_0x4bbded={'count':0x0,'rows':[]};var _0x1d66ec=_[_0x2f64('0x29')](db['ChatTransferReport'][_0x2f64('0x2a')],function(_0x203f8b){return{'name':_0x203f8b[_0x2f64('0x2b')],'type':_0x203f8b[_0x2f64('0x2c')][_0x2f64('0x2d')]};});_0x118308[_0x2f64('0x2e')]=_[_0x2f64('0x29')](_0x1d66ec,_0x2f64('0x27'));_0x118308[_0x2f64('0x2f')]=_['keys'](_0x124598[_0x2f64('0x2f')]);_0x118308['filters']=_[_0x2f64('0x30')](_0x118308[_0x2f64('0x2e')],_0x118308[_0x2f64('0x2f')]);_0x253a2a['attributes']=_[_0x2f64('0x30')](_0x118308[_0x2f64('0x2e')],qs[_0x2f64('0x31')](_0x124598['query'][_0x2f64('0x31')]));_0x253a2a[_0x2f64('0x32')]=_0x253a2a[_0x2f64('0x32')][_0x2f64('0x33')]?_0x253a2a[_0x2f64('0x32')]:_0x118308[_0x2f64('0x2e')];if(!_0x124598[_0x2f64('0x2f')][_0x2f64('0x34')](_0x2f64('0x35'))){_0x253a2a[_0x2f64('0x1e')]=qs[_0x2f64('0x1e')](_0x124598[_0x2f64('0x2f')]['limit']);_0x253a2a[_0x2f64('0x1f')]=qs['offset'](_0x124598[_0x2f64('0x2f')][_0x2f64('0x1f')]);}_0x253a2a['order']=qs[_0x2f64('0x36')](_0x124598[_0x2f64('0x2f')][_0x2f64('0x36')]);_0x253a2a['where']=qs[_0x2f64('0x37')](_[_0x2f64('0x38')](_0x124598[_0x2f64('0x2f')],_0x118308[_0x2f64('0x37')]),_0x1d66ec);if(_0x124598[_0x2f64('0x2f')][_0x2f64('0x39')]){_0x253a2a[_0x2f64('0x3a')]=_[_0x2f64('0x3b')](_0x253a2a[_0x2f64('0x3a')],{'$or':_['map'](_0x1d66ec,function(_0x4b0bee){if(_0x4b0bee[_0x2f64('0x2c')]!==_0x2f64('0x3c')){var _0x50b41f={};_0x50b41f[_0x4b0bee[_0x2f64('0x27')]]={'$like':'%'+_0x124598[_0x2f64('0x2f')][_0x2f64('0x39')]+'%'};return _0x50b41f;}})});}_0x253a2a=_[_0x2f64('0x3b')]({},_0x253a2a,_0x124598[_0x2f64('0x3d')]);var _0x245d31={'where':_0x253a2a[_0x2f64('0x3a')]};return db['ChatTransferReport'][_0x2f64('0x3e')](_0x245d31)[_0x2f64('0x23')](function(_0x2373d5){_0x4bbded[_0x2f64('0x3e')]=_0x2373d5;if(_0x124598[_0x2f64('0x2f')][_0x2f64('0x3f')]){_0x253a2a['include']=[{'all':!![]}];}return db[_0x2f64('0x40')][_0x2f64('0x41')](_0x253a2a);})['then'](function(_0x49f0ed){_0x4bbded[_0x2f64('0x42')]=_0x49f0ed;return _0x4bbded;})[_0x2f64('0x23')](respondWithFilteredResult(_0x2391ff,_0x253a2a))[_0x2f64('0x43')](handleError(_0x2391ff,null));};exports['show']=function(_0x53ebb3,_0x133a47){var _0x11a4af={'raw':!![],'where':{'id':_0x53ebb3[_0x2f64('0x44')]['id']}},_0x260d0f={};_0x260d0f['model']=_[_0x2f64('0x45')](db[_0x2f64('0x40')]['rawAttributes']);_0x260d0f[_0x2f64('0x2f')]=_[_0x2f64('0x45')](_0x53ebb3[_0x2f64('0x2f')]);_0x260d0f[_0x2f64('0x37')]=_[_0x2f64('0x30')](_0x260d0f[_0x2f64('0x2e')],_0x260d0f['query']);_0x11a4af['attributes']=_['intersection'](_0x260d0f['model'],qs['fields'](_0x53ebb3[_0x2f64('0x2f')]['fields']));_0x11a4af[_0x2f64('0x32')]=_0x11a4af[_0x2f64('0x32')]['length']?_0x11a4af[_0x2f64('0x32')]:_0x260d0f[_0x2f64('0x2e')];if(_0x53ebb3[_0x2f64('0x2f')][_0x2f64('0x3f')]){_0x11a4af[_0x2f64('0x46')]=[{'all':!![]}];}_0x11a4af=_[_0x2f64('0x3b')]({},_0x11a4af,_0x53ebb3[_0x2f64('0x3d')]);return db['ChatTransferReport']['find'](_0x11a4af)[_0x2f64('0x23')](handleEntityNotFound(_0x133a47,null))[_0x2f64('0x23')](respondWithResult(_0x133a47,null))[_0x2f64('0x43')](handleError(_0x133a47,null));};exports['create']=function(_0x5604ee,_0x58f2c4){return db[_0x2f64('0x40')][_0x2f64('0x47')](_0x5604ee[_0x2f64('0x48')],{})[_0x2f64('0x23')](respondWithResult(_0x58f2c4,0xc9))[_0x2f64('0x43')](handleError(_0x58f2c4,null));};exports[_0x2f64('0x49')]=function(_0x597502,_0x20fa85){if(_0x597502[_0x2f64('0x48')]['id']){delete _0x597502[_0x2f64('0x48')]['id'];}return db[_0x2f64('0x40')]['find']({'where':{'id':_0x597502['params']['id']}})['then'](handleEntityNotFound(_0x20fa85,null))[_0x2f64('0x23')](saveUpdates(_0x597502[_0x2f64('0x48')],null))[_0x2f64('0x23')](respondWithResult(_0x20fa85,null))[_0x2f64('0x43')](handleError(_0x20fa85,null));};exports[_0x2f64('0x24')]=function(_0x3375ef,_0x4f8679){return db[_0x2f64('0x40')][_0x2f64('0x4a')]({'where':{'id':_0x3375ef[_0x2f64('0x44')]['id']}})[_0x2f64('0x23')](handleEntityNotFound(_0x4f8679,null))[_0x2f64('0x23')](removeEntity(_0x4f8679,null))['catch'](handleError(_0x4f8679,null));};exports[_0x2f64('0x4b')]=function(_0x30d7cf,_0x24b713){return db[_0x2f64('0x40')][_0x2f64('0x4b')]()[_0x2f64('0x23')](respondWithResult(_0x24b713,null))[_0x2f64('0x43')](handleError(_0x24b713,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 60b52ca..9ac6bb7 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 _0x1fca=['moment','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x1fca,0x11c));var _0xa1fc=function(_0x361805,_0x39bf7b){_0x361805=_0x361805-0x0;var _0x2066b0=_0x1fca[_0x361805];return _0x2066b0;};'use strict';var _=require(_0xa1fc('0x0'));var util=require(_0xa1fc('0x1'));var logger=require(_0xa1fc('0x2'))(_0xa1fc('0x3'));var moment=require(_0xa1fc('0x4'));var BPromise=require('bluebird');var rp=require(_0xa1fc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1fc('0x6'));var config=require(_0xa1fc('0x7'));var attributes=require(_0xa1fc('0x8'));module['exports']=function(_0x4faaac,_0x4e4f76){return _0x4faaac[_0xa1fc('0x9')](_0xa1fc('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xa1fc('0xb'),'fields':[_0xa1fc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x10dd=['./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x10dd,0xc9));var _0xd10d=function(_0x2c7d77,_0xb60231){_0x2c7d77=_0x2c7d77-0x0;var _0x54481d=_0x10dd[_0x2c7d77];return _0x54481d;};'use strict';var _=require(_0xd10d('0x0'));var util=require(_0xd10d('0x1'));var logger=require(_0xd10d('0x2'))('api');var moment=require(_0xd10d('0x3'));var BPromise=require(_0xd10d('0x4'));var rp=require(_0xd10d('0x5'));var fs=require('fs');var path=require(_0xd10d('0x6'));var rimraf=require(_0xd10d('0x7'));var config=require(_0xd10d('0x8'));var attributes=require(_0xd10d('0x9'));module[_0xd10d('0xa')]=function(_0x124bbc,_0x229f92){return _0x124bbc['define'](_0xd10d('0xb'),attributes,{'tableName':_0xd10d('0xc'),'paranoid':![],'indexes':[{'name':_0xd10d('0xd'),'fields':[_0xd10d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 4a85fa0..dc13569 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 _0x9d3b=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring'];(function(_0x14eafa,_0x1f47c7){var _0x20cbd3=function(_0xf05716){while(--_0xf05716){_0x14eafa['push'](_0x14eafa['shift']());}};_0x20cbd3(++_0x1f47c7);}(_0x9d3b,0x1c9));var _0xb9d3=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x9d3b[_0x25662e];return _0x59b7bc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb9d3('0x0'));var BPromise=require(_0xb9d3('0x1'));var rs=require(_0xb9d3('0x2'));var fs=require('fs');var Redis=require(_0xb9d3('0x3'));var db=require(_0xb9d3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb9d3('0x5'))(_0xb9d3('0x6'));var config=require(_0xb9d3('0x7'));var jayson=require(_0xb9d3('0x8'));var client=jayson[_0xb9d3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc58a41,_0x14927a,_0x250c8b){return new BPromise(function(_0xb7d311,_0x3f9876){return client[_0xb9d3('0xa')](_0xc58a41,_0x250c8b)[_0xb9d3('0xb')](function(_0x4d46f4){logger['info'](_0xb9d3('0xc'),_0x14927a,_0xb9d3('0xd'));logger['debug'](_0xb9d3('0xe'),_0x14927a,'request\x20sent',JSON[_0xb9d3('0xf')](_0x4d46f4));if(_0x4d46f4[_0xb9d3('0x10')]){if(_0x4d46f4[_0xb9d3('0x10')][_0xb9d3('0x11')]===0x1f4){logger['error'](_0xb9d3('0xc'),_0x14927a,_0x4d46f4['error'][_0xb9d3('0x12')]);return _0x3f9876(_0x4d46f4[_0xb9d3('0x10')]['message']);}logger[_0xb9d3('0x10')](_0xb9d3('0xc'),_0x14927a,_0x4d46f4[_0xb9d3('0x10')][_0xb9d3('0x12')]);return _0xb7d311(_0x4d46f4[_0xb9d3('0x10')]['message']);}else{logger['info'](_0xb9d3('0xc'),_0x14927a,_0xb9d3('0xd'));_0xb7d311(_0x4d46f4['result'][_0xb9d3('0x12')]);}})[_0xb9d3('0x13')](function(_0x1634a0){logger[_0xb9d3('0x10')](_0xb9d3('0xc'),_0x14927a,_0x1634a0);_0x3f9876(_0x1634a0);});});} \ No newline at end of file +var _0xd39c=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x40c61d,_0x50d58f){var _0x3d7a64=function(_0x5e651a){while(--_0x5e651a){_0x40c61d['push'](_0x40c61d['shift']());}};_0x3d7a64(++_0x50d58f);}(_0xd39c,0xc3));var _0xcd39=function(_0x1ed107,_0x1a23f0){_0x1ed107=_0x1ed107-0x0;var _0x1958a7=_0xd39c[_0x1ed107];return _0x1958a7;};'use strict';var _=require(_0xcd39('0x0'));var util=require(_0xcd39('0x1'));var moment=require(_0xcd39('0x2'));var BPromise=require('bluebird');var rs=require(_0xcd39('0x3'));var fs=require('fs');var Redis=require(_0xcd39('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcd39('0x5'));var logger=require('../../config/logger')(_0xcd39('0x6'));var config=require(_0xcd39('0x7'));var jayson=require(_0xcd39('0x8'));var client=jayson[_0xcd39('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a3498,_0x291a05,_0x5cbb63){return new BPromise(function(_0x508522,_0x709e9){return client[_0xcd39('0xa')](_0x5a3498,_0x5cbb63)['then'](function(_0x5c110d){logger[_0xcd39('0xb')](_0xcd39('0xc'),_0x291a05,_0xcd39('0xd'));logger['debug'](_0xcd39('0xe'),_0x291a05,_0xcd39('0xd'),JSON[_0xcd39('0xf')](_0x5c110d));if(_0x5c110d[_0xcd39('0x10')]){if(_0x5c110d[_0xcd39('0x10')][_0xcd39('0x11')]===0x1f4){logger[_0xcd39('0x10')](_0xcd39('0xc'),_0x291a05,_0x5c110d[_0xcd39('0x10')][_0xcd39('0x12')]);return _0x709e9(_0x5c110d[_0xcd39('0x10')][_0xcd39('0x12')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x291a05,_0x5c110d[_0xcd39('0x10')][_0xcd39('0x12')]);return _0x508522(_0x5c110d[_0xcd39('0x10')][_0xcd39('0x12')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x291a05,_0xcd39('0xd'));_0x508522(_0x5c110d[_0xcd39('0x13')][_0xcd39('0x12')]);}})['catch'](function(_0x4a4acc){logger[_0xcd39('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x291a05,_0x4a4acc);_0x709e9(_0x4a4acc);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 16f5415..dc450df 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 _0x52e9=['/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x47d338,_0x23eabf){var _0x5d3f11=function(_0x461462){while(--_0x461462){_0x47d338['push'](_0x47d338['shift']());}};_0x5d3f11(++_0x23eabf);}(_0x52e9,0x65));var _0x952e=function(_0x88fa7,_0x3eae30){_0x88fa7=_0x88fa7-0x0;var _0x54ae70=_0x52e9[_0x88fa7];return _0x54ae70;};'use strict';var multer=require('multer');var util=require(_0x952e('0x0'));var path=require(_0x952e('0x1'));var timeout=require(_0x952e('0x2'));var express=require(_0x952e('0x3'));var router=express[_0x952e('0x4')]();var fs_extra=require(_0x952e('0x5'));var auth=require(_0x952e('0x6'));var interaction=require(_0x952e('0x7'));var config=require('../../config/environment');var controller=require(_0x952e('0x8'));router['get']('/',auth[_0x952e('0x9')](),controller[_0x952e('0xa')]);router[_0x952e('0xb')](_0x952e('0xc'),auth['isAuthenticated'](),controller[_0x952e('0xd')]);router[_0x952e('0xb')](_0x952e('0xe'),auth[_0x952e('0x9')](),controller[_0x952e('0xf')]);router[_0x952e('0x10')]('/',auth[_0x952e('0x9')](),controller[_0x952e('0x11')]);router[_0x952e('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x952e('0x13')]);router[_0x952e('0x14')](_0x952e('0xe'),auth['isAuthenticated'](),controller[_0x952e('0x15')]);module[_0x952e('0x16')]=router; \ No newline at end of file +var _0xbc90=['create','put','delete','destroy','exports','multer','util','express','fs-extra','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0xbc90,0xfc));var _0x0bc9=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xbc90[_0x513aa5];return _0x1a1a7c;};'use strict';var multer=require(_0x0bc9('0x0'));var util=require(_0x0bc9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0bc9('0x2'));var router=express['Router']();var fs_extra=require(_0x0bc9('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0bc9('0x4'));var controller=require(_0x0bc9('0x5'));router[_0x0bc9('0x6')]('/',auth[_0x0bc9('0x7')](),controller[_0x0bc9('0x8')]);router[_0x0bc9('0x6')](_0x0bc9('0x9'),auth[_0x0bc9('0x7')](),controller[_0x0bc9('0xa')]);router[_0x0bc9('0x6')](_0x0bc9('0xb'),auth[_0x0bc9('0x7')](),controller[_0x0bc9('0xc')]);router[_0x0bc9('0xd')]('/',auth['isAuthenticated'](),controller[_0x0bc9('0xe')]);router[_0x0bc9('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0bc9('0x10')](_0x0bc9('0xb'),auth[_0x0bc9('0x7')](),controller[_0x0bc9('0x11')]);module[_0x0bc9('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 4803a78..2cd1aad 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 _0xd211=['Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','name','text','input','email','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send'];(function(_0x5e586f,_0x31a1ea){var _0x1ab757=function(_0x84fd30){while(--_0x84fd30){_0x5e586f['push'](_0x5e586f['shift']());}};_0x1ab757(++_0x31a1ea);}(_0xd211,0x1a2));var _0x1d21=function(_0x3d52fd,_0x4f5ac0){_0x3d52fd=_0x3d52fd-0x0;var _0x4918d6=_0xd211[_0x3d52fd];return _0x4918d6;};'use strict';var Sequelize=require(_0x1d21('0x0'));var rs=require(_0x1d21('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x1d21('0x2')],'allowNull':![],'unique':_0x1d21('0x3')},'description':{'type':Sequelize[_0x1d21('0x2')]},'mapKey':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0x1d21('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0x4')},'customerAlias':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x1d21('0x2')],'allowNull':![],'defaultValue':_0x1d21('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x1d21('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x1d21('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x1d21('0x2')]},'animation':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x1d21('0x8')](_0x1d21('0x9'),_0x1d21('0xa')),'defaultValue':_0x1d21('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x1d21('0xb')},'start_chat_button':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0xc')},'offline_chat_button':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0xd')},'header_offline':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0xe')},'download_transcript':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x1d21('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x1d21('0x10')]},'closingQuestion':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0x13')},'noteTitle':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x1d21('0x14')},'closingMessage':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0x16')},'conditionAgreement':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0x17')},'ratingType':{'type':Sequelize[_0x1d21('0x8')](_0x1d21('0x18'),_0x1d21('0x19')),'defaultValue':_0x1d21('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x1d21('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x1d21('0x10')],'defaultValue':function(){return JSON[_0x1d21('0x1a')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x1d21('0x1b'),'type':_0x1d21('0x1c'),'required':!![]},'props':{'title':_0x1d21('0x1b'),'helpText':''}},{'type':_0x1d21('0x1d'),'props':{'title':_0x1d21('0x1e'),'helpText':''},'config':{'required':!![],'placeholder':_0x1d21('0x1e'),'type':_0x1d21('0x1e')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x1d21('0x1f')](_0x1d21('0x20'))?JSON[_0x1d21('0x21')](this[_0x1d21('0x1f')](_0x1d21('0x20'))):{};},'set':function(_0x177225){return this[_0x1d21('0x22')](_0x1d21('0x20'),JSON[_0x1d21('0x1a')](_0x177225));}},'offlineForm':{'type':Sequelize[_0x1d21('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x1d21('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x1d21('0x1e'),'type':_0x1d21('0x1e')},'variable':null},{'type':_0x1d21('0x23'),'config':{'placeholder':_0x1d21('0x24')},'props':{'title':_0x1d21('0x24'),'helpText':_0x1d21('0x25')}}],'fromKey':0x0});},'get':function(){return this[_0x1d21('0x1f')](_0x1d21('0x26'))?JSON[_0x1d21('0x21')](this[_0x1d21('0x1f')]('offlineForm')):{};},'set':function(_0x5e60d1){return this[_0x1d21('0x22')]('offlineForm',JSON[_0x1d21('0x1a')](_0x5e60d1));}},'token':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':function(){return rs[_0x1d21('0x27')]();}},'autoclose':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x1d21('0x2')]},'forwardOffline':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x1d21('0x2')]},'waitingTitle':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0x28')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x1d21('0x29')},'offlineMessageSubject':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0x2a')},'offlineMessageBody':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0x2b')},'enableUnmanagedNote':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0x2c')},'skipUnmanaged':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x1d21('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x1d21('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x1d21('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0x2d')},'waitForTheAssignedAgent':{'type':Sequelize[_0x1d21('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0x2e')},'verticalAlignment':{'type':Sequelize[_0x1d21('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0x2f')},'messagesAlignment':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0x30')},'defaultTitle':{'type':Sequelize[_0x1d21('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x1d21('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1d21('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1d21('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x1d21('0x2')],'defaultValue':_0x1d21('0x31')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1d21('0x6')],'comment':_0x1d21('0x32')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x24c470){if(!_0x24c470)this[_0x1d21('0x22')](_0x1d21('0x33'),null);this['setDataValue'](_0x1d21('0x34'),_0x24c470);}},'vidaooEscalation':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x1d21('0x2')]},'vidaooTopic':{'type':Sequelize[_0x1d21('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x1d21('0x35');}},'vidaooMetadata':{'type':Sequelize[_0x1d21('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x1d21('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x1d21('0x10')]}}; \ No newline at end of file +var _0xc5e8=['Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','ENUM','star','thumb','stringify','name','text','input','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5e8,0xf2));var _0x8c5e=function(_0x22acf7,_0x264c90){_0x22acf7=_0x22acf7-0x0;var _0x403e6e=_0xc5e8[_0x22acf7];return _0x403e6e;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x8c5e('0x0')]={'name':{'type':Sequelize[_0x8c5e('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x8c5e('0x1')],'allowNull':![],'unique':_0x8c5e('0x2')},'description':{'type':Sequelize[_0x8c5e('0x1')]},'mapKey':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x8c5e('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x4')},'customerAlias':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x8c5e('0x1')],'allowNull':![],'defaultValue':_0x8c5e('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8c5e('0x1')],'allowNull':![],'defaultValue':_0x8c5e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8c5e('0x1')],'allowNull':![],'defaultValue':_0x8c5e('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x8c5e('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8c5e('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded','squared'),'defaultValue':_0x8c5e('0x8')},'header_online':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x9')},'start_chat_button':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0xa')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x8c5e('0xb')},'header_offline':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0xc')},'download_transcript':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8c5e('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x10')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x11')},'placeholderMessage':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x12')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8c5e('0x13')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8c5e('0xb')},'skipMessageButton':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x8c5e('0x15')](_0x8c5e('0x16'),_0x8c5e('0x17')),'defaultValue':_0x8c5e('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x8c5e('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x8c5e('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x8c5e('0x19'),'type':_0x8c5e('0x1a'),'required':!![]},'props':{'title':_0x8c5e('0x19'),'helpText':''}},{'type':_0x8c5e('0x1b'),'props':{'title':_0x8c5e('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x8c5e('0x3'),'type':_0x8c5e('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x8c5e('0x1c'))?JSON[_0x8c5e('0x1d')](this[_0x8c5e('0x1e')](_0x8c5e('0x1c'))):{};},'set':function(_0x459e51){return this[_0x8c5e('0x1f')]('onlineForm',JSON[_0x8c5e('0x18')](_0x459e51));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8c5e('0x1b'),'props':{'title':_0x8c5e('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x8c5e('0x3'),'type':_0x8c5e('0x3')},'variable':null},{'type':_0x8c5e('0x20'),'config':{'placeholder':'Comments'},'props':{'title':_0x8c5e('0x21'),'helpText':_0x8c5e('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x8c5e('0x1e')]('offlineForm')?JSON[_0x8c5e('0x1d')](this['getDataValue'](_0x8c5e('0x23'))):{};},'set':function(_0x41c730){return this[_0x8c5e('0x1f')](_0x8c5e('0x23'),JSON['stringify'](_0x41c730));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8c5e('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x24')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x25')},'skipUnmanaged':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x14')},'sendUnmanaged':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x8c5e('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x8c5e('0xf')],'defaultValue':function(){return _0x8c5e('0x26');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x8c5e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x8c5e('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x28')},'messagesAlignment':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':_0x8c5e('0x29')},'defaultTitle':{'type':Sequelize[_0x8c5e('0x1')]},'customerAvatar':{'type':Sequelize[_0x8c5e('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x8c5e('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8c5e('0x1')],'allowNull':![],'defaultValue':_0x8c5e('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8c5e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8c5e('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x8c5e('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8c5e('0x7')],'comment':_0x8c5e('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![],'comment':_0x8c5e('0x2c'),'set':function(_0x718e00){if(!_0x718e00)this['setDataValue'](_0x8c5e('0x2d'),null);this[_0x8c5e('0x1f')]('mandatoryDisposition',_0x718e00);}},'vidaooEscalation':{'type':Sequelize[_0x8c5e('0xd')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x8c5e('0x1')]},'vidaooTopic':{'type':Sequelize[_0x8c5e('0x1')],'allowNull':![],'defaultValue':_0x8c5e('0x2e')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x8c5e('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x8c5e('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8c5e('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 352b4b2..54dca47 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 _0x2032=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','length','nolimit','pick','options','removeDispositions','ids','addAnswer','CannedAnswer','findOne','rows','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','sitepic','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','setUA','user-agent','getResult','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','Applications','account','list','List','applications','orderBy','priority','asc','Contacts','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','split','lastName','x-real-port','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','firstName','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','*,*,*,*','Start','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','attachments','offline-chat','basename','sequelize','Attachment','bulkCreate','MailServerOut','forwardOffline','forwardOfflineAddress','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','openNewInteraction','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','email','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','internal','Tag','tag','Command','getSnippet','timezone','interval','indexOf','true','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','some','server/files/chat/iframe.ejs','remote','x-real-ip','remoteAddress','referer','replace','alignment','verticalAlignment','color','textColor','backgroundColor','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','online','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','spread','emit','userChatWebsite:save','userChatWebsite:remove','getAgents','mustache','util','path','fs-extra','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','Pause','map','ChatWebsite','fieldName','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','type','includeAll','findAll','catch','mandatoryDispositionPause','rawAttributes','include','find','create','body','user','get','ChatWebsites','UserProfileSection','userProfileId','autoAssociation'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x2032,0xd9));var _0x2203=function(_0x30a5c3,_0x58c9ab){_0x30a5c3=_0x30a5c3-0x0;var _0x372125=_0x2032[_0x30a5c3];return _0x372125;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var path=require(_0x2203('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2203('0x3'));var _=require(_0x2203('0x4'));var querystring=require('querystring');var Redis=require(_0x2203('0x5'));var qs=require(_0x2203('0x6'));var logger=require(_0x2203('0x7'))(_0x2203('0x8'));var config=require(_0x2203('0x9'));var db=require(_0x2203('0xa'))['db'];config[_0x2203('0xb')]=_[_0x2203('0xc')](config[_0x2203('0xb')],{'host':_0x2203('0xd'),'port':0x18eb});var socket=require(_0x2203('0xe'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x2203('0xf')](socket);var htmlToText=require('html-to-text');var jayson=require(_0x2203('0x10'));var client=jayson[_0x2203('0x11')][_0x2203('0x12')]({'port':0x232c});var client9002=jayson['client'][_0x2203('0x12')]({'port':0x232a});var client9003=jayson['client'][_0x2203('0x12')]({'port':0x232b});var client9001=jayson['client'][_0x2203('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x1abb51,_0x4b9376,_0x583bc7,_0x585c76){return new BPromise(function(_0x5f56ff,_0x4bad7c){var _0x238772=_0x585c76||client;return _0x238772['request'](_0x1abb51,_0x583bc7)['then'](function(_0x21a3af){logger[_0x2203('0x13')](_0x2203('0x14'),_0x4b9376,_0x2203('0x15'));logger[_0x2203('0x16')](_0x2203('0x17'),_0x4b9376,_0x2203('0x15'),JSON[_0x2203('0x18')](_0x21a3af));if(_0x21a3af[_0x2203('0x19')]){if(_0x21a3af[_0x2203('0x19')]['code']===0x1f4){logger[_0x2203('0x19')](_0x2203('0x14'),_0x4b9376,_0x21a3af['error'][_0x2203('0x1a')]);return _0x4bad7c(_0x21a3af[_0x2203('0x19')]['message']);}logger[_0x2203('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x4b9376,_0x21a3af[_0x2203('0x19')][_0x2203('0x1a')]);return _0x5f56ff(_0x21a3af[_0x2203('0x19')][_0x2203('0x1a')]);}else{logger[_0x2203('0x13')](_0x2203('0x14'),_0x4b9376,'request\x20sent');_0x5f56ff(_0x21a3af[_0x2203('0x1b')]['message']);}})['catch'](function(_0x15f543){logger['error'](_0x2203('0x14'),_0x4b9376,_0x15f543);_0x4bad7c(_0x15f543);});});}function respondWithStatusCode(_0x5bfe61,_0x5d4c4e){_0x5d4c4e=_0x5d4c4e||0xcc;return function(_0x3ee25b){if(_0x3ee25b){return _0x5bfe61['sendStatus'](_0x5d4c4e);}return _0x5bfe61['status'](_0x5d4c4e)[_0x2203('0x1c')]();};}function respondWithResult(_0x2718f5,_0x21f930){_0x21f930=_0x21f930||0xc8;return function(_0xfd0970){if(_0xfd0970){return _0x2718f5[_0x2203('0x1d')](_0x21f930)[_0x2203('0x1e')](_0xfd0970);}};}function respondWithFilteredResult(_0x49c12,_0x250349){return function(_0x576378){if(_0x576378){var _0x143f41=typeof _0x250349[_0x2203('0x1f')]===_0x2203('0x20')&&typeof _0x250349['limit']===_0x2203('0x20');var _0x1cec17=_0x576378['count'];var _0xd6e109=_0x143f41?0x0:_0x250349[_0x2203('0x1f')];var _0x1c6a77=_0x143f41?_0x576378[_0x2203('0x21')]:_0x250349[_0x2203('0x1f')]+_0x250349[_0x2203('0x22')];var _0x9c53f;if(_0x1c6a77>=_0x1cec17){_0x1c6a77=_0x1cec17;_0x9c53f=0xc8;}else{_0x9c53f=0xce;}_0x49c12['status'](_0x9c53f);return _0x49c12[_0x2203('0x23')](_0x2203('0x24'),_0xd6e109+'-'+_0x1c6a77+'/'+_0x1cec17)[_0x2203('0x1e')](_0x576378);}return null;};}function saveUpdates(_0x74f035){return function(_0x52a426){if(_0x52a426){return _0x52a426[_0x2203('0x25')](_0x74f035)[_0x2203('0x26')](function(_0x287c95){return _0x287c95;});}return null;};}function removeEntity(_0xf59954){return function(_0x520602){if(_0x520602){return _0x520602[_0x2203('0x27')]()[_0x2203('0x26')](function(){var _0x5e6560=_0x520602['get']({'plain':!![]});var _0x1d5f74='ChatWebsites';return db['UserProfileResource'][_0x2203('0x27')]({'where':{'type':_0x1d5f74,'resourceId':_0x5e6560['id']}})[_0x2203('0x26')](function(){return _0x520602;});})[_0x2203('0x26')](function(){_0xf59954[_0x2203('0x1d')](0xcc)[_0x2203('0x1c')]();});}};}function handleEntityNotFound(_0x5ac74b){return function(_0xb22e28){if(!_0xb22e28){_0x5ac74b[_0x2203('0x28')](0x194);}return _0xb22e28;};}function handleError(_0x49caec,_0x2a2ee7){_0x2a2ee7=_0x2a2ee7||0x1f4;return function(_0x20fbe1){logger[_0x2203('0x19')](_0x20fbe1[_0x2203('0x29')]);if(_0x20fbe1[_0x2203('0x2a')]){delete _0x20fbe1[_0x2203('0x2a')];}_0x49caec[_0x2203('0x1d')](_0x2a2ee7)[_0x2203('0x2b')](_0x20fbe1);};}exports[_0x2203('0x2c')]=function(_0x522a69,_0x15c0ad){var _0x347d3e={'include':[{'model':db[_0x2203('0x2d')],'as':'mandatoryDispositionPause'}]},_0x56f9b2={},_0x54b90b={'count':0x0,'rows':[]};var _0x25cc97=_[_0x2203('0x2e')](db[_0x2203('0x2f')]['rawAttributes'],function(_0x5a2b90){return{'name':_0x5a2b90[_0x2203('0x30')],'type':_0x5a2b90['type'][_0x2203('0x31')]};});_0x56f9b2['model']=_[_0x2203('0x2e')](_0x25cc97,'name');_0x56f9b2[_0x2203('0x32')]=_[_0x2203('0x33')](_0x522a69[_0x2203('0x32')]);_0x56f9b2[_0x2203('0x34')]=_[_0x2203('0x35')](_0x56f9b2['model'],_0x56f9b2['query']);_0x347d3e['attributes']=_[_0x2203('0x35')](_0x56f9b2[_0x2203('0x36')],qs[_0x2203('0x37')](_0x522a69[_0x2203('0x32')][_0x2203('0x37')]));_0x347d3e[_0x2203('0x38')]=_0x347d3e[_0x2203('0x38')]['length']?_0x347d3e[_0x2203('0x38')]:_0x56f9b2[_0x2203('0x36')];if(!_0x522a69[_0x2203('0x32')][_0x2203('0x39')]('nolimit')){_0x347d3e['limit']=qs[_0x2203('0x22')](_0x522a69['query'][_0x2203('0x22')]);_0x347d3e[_0x2203('0x1f')]=qs[_0x2203('0x1f')](_0x522a69['query']['offset']);}_0x347d3e[_0x2203('0x3a')]=qs[_0x2203('0x3b')](_0x522a69[_0x2203('0x32')][_0x2203('0x3b')]);_0x347d3e[_0x2203('0x3c')]=qs[_0x2203('0x34')](_['pick'](_0x522a69[_0x2203('0x32')],_0x56f9b2[_0x2203('0x34')]),_0x25cc97);if(_0x522a69[_0x2203('0x32')][_0x2203('0x3d')]){_0x347d3e[_0x2203('0x3c')]=_[_0x2203('0x3e')](_0x347d3e[_0x2203('0x3c')],{'$or':_[_0x2203('0x2e')](_0x25cc97,function(_0x36b8e4){if(_0x36b8e4[_0x2203('0x3f')]!=='VIRTUAL'){var _0x2e2ca5={};_0x2e2ca5[_0x36b8e4[_0x2203('0x2a')]]={'$like':'%'+_0x522a69[_0x2203('0x32')][_0x2203('0x3d')]+'%'};return _0x2e2ca5;}})});}_0x347d3e=_['merge']({},_0x347d3e,_0x522a69['options']);var _0x1c6661={'where':_0x347d3e['where']};return db[_0x2203('0x2f')][_0x2203('0x21')](_0x1c6661)[_0x2203('0x26')](function(_0x35dba9){_0x54b90b['count']=_0x35dba9;if(_0x522a69[_0x2203('0x32')][_0x2203('0x40')]){_0x347d3e['include']=[{'all':!![]}];}return db[_0x2203('0x2f')][_0x2203('0x41')](_0x347d3e);})[_0x2203('0x26')](function(_0x2600a9){_0x54b90b['rows']=_0x2600a9;return _0x54b90b;})['then'](respondWithFilteredResult(_0x15c0ad,_0x347d3e))[_0x2203('0x42')](handleError(_0x15c0ad,null));};exports['show']=function(_0x543fde,_0x450082){var _0x33b7b5={'raw':![],'where':{'id':_0x543fde['params']['id']},'include':[{'model':db['Pause'],'as':_0x2203('0x43')}]},_0x1a2665={};_0x1a2665[_0x2203('0x36')]=_[_0x2203('0x33')](db[_0x2203('0x2f')][_0x2203('0x44')]);_0x1a2665[_0x2203('0x32')]=_['keys'](_0x543fde[_0x2203('0x32')]);_0x1a2665['filters']=_[_0x2203('0x35')](_0x1a2665[_0x2203('0x36')],_0x1a2665[_0x2203('0x32')]);_0x33b7b5[_0x2203('0x38')]=_['intersection'](_0x1a2665['model'],qs[_0x2203('0x37')](_0x543fde[_0x2203('0x32')][_0x2203('0x37')]));_0x33b7b5[_0x2203('0x38')]=_0x33b7b5['attributes']['length']?_0x33b7b5['attributes']:_0x1a2665[_0x2203('0x36')];if(_0x543fde[_0x2203('0x32')]['includeAll']){_0x33b7b5[_0x2203('0x45')]=[{'all':!![]}];}_0x33b7b5=_[_0x2203('0x3e')]({},_0x33b7b5,_0x543fde['options']);return db[_0x2203('0x2f')][_0x2203('0x46')](_0x33b7b5)[_0x2203('0x26')](handleEntityNotFound(_0x450082,null))[_0x2203('0x26')](respondWithResult(_0x450082,null))['catch'](handleError(_0x450082,null));};exports[_0x2203('0x47')]=function(_0x5268d6,_0x3858f0){return db[_0x2203('0x2f')]['create'](_0x5268d6[_0x2203('0x48')],{})[_0x2203('0x26')](function(_0x11c581){var _0x378132=_0x5268d6[_0x2203('0x49')][_0x2203('0x4a')]({'plain':!![]});if(!_0x378132)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378132['role']===_0x2203('0x49')){var _0x524356=_0x11c581['get']({'plain':!![]});var _0xfddc3b=_0x2203('0x4b');return db[_0x2203('0x4c')]['find']({'where':{'name':_0xfddc3b,'userProfileId':_0x378132[_0x2203('0x4d')]},'raw':!![]})['then'](function(_0x5ddf9e){if(_0x5ddf9e&&_0x5ddf9e[_0x2203('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x524356['name'],'resourceId':_0x524356['id'],'type':_0x5ddf9e[_0x2203('0x2a')],'sectionId':_0x5ddf9e['id']},{})[_0x2203('0x26')](function(){return _0x11c581;});}else{return _0x11c581;}})[_0x2203('0x42')](function(_0x1c6c90){logger[_0x2203('0x19')](_0x2203('0x4f'),_0x1c6c90);throw _0x1c6c90;});}return _0x11c581;})[_0x2203('0x26')](respondWithResult(_0x3858f0,0xc9))[_0x2203('0x42')](handleError(_0x3858f0,null));};exports[_0x2203('0x25')]=function(_0x216641,_0x384a59){if(_0x216641[_0x2203('0x48')]['id']){delete _0x216641['body']['id'];}return db['ChatWebsite'][_0x2203('0x46')]({'where':{'id':_0x216641[_0x2203('0x50')]['id']},'include':[{'model':db[_0x2203('0x2d')],'as':_0x2203('0x43')}]})[_0x2203('0x26')](handleEntityNotFound(_0x384a59,null))[_0x2203('0x26')](saveUpdates(_0x216641['body'],null))['then'](respondWithResult(_0x384a59,null))[_0x2203('0x42')](handleError(_0x384a59,null));};exports[_0x2203('0x27')]=function(_0x21ee59,_0x1e6d21){return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0x21ee59[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x1e6d21,null))[_0x2203('0x26')](removeEntity(_0x1e6d21,null))[_0x2203('0x42')](handleError(_0x1e6d21,null));};exports[_0x2203('0x51')]=function(_0x48bed1,_0x1ea97a){return db[_0x2203('0x2f')][_0x2203('0x51')]()[_0x2203('0x26')](respondWithResult(_0x1ea97a,null))[_0x2203('0x42')](handleError(_0x1ea97a,null));};exports[_0x2203('0x52')]=function(_0x52c159,_0x544756){if(_0x52c159[_0x2203('0x48')]['id']){delete _0x52c159[_0x2203('0x48')]['id'];}return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0x52c159[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x544756,null))[_0x2203('0x26')](function(_0x34e820){if(_0x34e820){_0x52c159[_0x2203('0x48')][_0x2203('0x53')]=_0x34e820['id'];return db[_0x2203('0x54')][_0x2203('0x47')](_0x52c159['body']);}})[_0x2203('0x26')](respondWithResult(_0x544756,null))[_0x2203('0x42')](handleError(_0x544756,null));};exports[_0x2203('0x55')]=function(_0x4e461e,_0x68855d){var _0x3f73e1={'raw':![],'where':{}};var _0x1b4f96={};var _0x1b7aa8={'count':0x0,'rows':[]};return db[_0x2203('0x2f')]['findOne']({'where':{'id':_0x4e461e[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x68855d,null))[_0x2203('0x26')](function(_0x4dde80){if(_0x4dde80){_0x1b4f96['model']=_['keys'](db['Disposition']['rawAttributes']);_0x1b4f96[_0x2203('0x32')]=_[_0x2203('0x33')](_0x4e461e[_0x2203('0x32')]);_0x1b4f96[_0x2203('0x34')]=_[_0x2203('0x35')](_0x1b4f96[_0x2203('0x36')],_0x1b4f96[_0x2203('0x32')]);_0x3f73e1[_0x2203('0x38')]=_['intersection'](_0x1b4f96['model'],qs[_0x2203('0x37')](_0x4e461e[_0x2203('0x32')][_0x2203('0x37')]));_0x3f73e1[_0x2203('0x38')]=_0x3f73e1[_0x2203('0x38')][_0x2203('0x56')]?_0x3f73e1[_0x2203('0x38')]:_0x1b4f96[_0x2203('0x36')];if(!_0x4e461e[_0x2203('0x32')][_0x2203('0x39')](_0x2203('0x57'))){_0x3f73e1[_0x2203('0x22')]=qs[_0x2203('0x22')](_0x4e461e[_0x2203('0x32')][_0x2203('0x22')]);_0x3f73e1[_0x2203('0x1f')]=qs[_0x2203('0x1f')](_0x4e461e[_0x2203('0x32')][_0x2203('0x1f')]);}_0x3f73e1['order']=qs[_0x2203('0x3b')](_0x4e461e['query'][_0x2203('0x3b')]);_0x3f73e1['where']=qs[_0x2203('0x34')](_[_0x2203('0x58')](_0x4e461e[_0x2203('0x32')],_0x1b4f96[_0x2203('0x34')]));_0x3f73e1[_0x2203('0x3c')][_0x2203('0x53')]=_0x4dde80['id'];if(_0x4e461e[_0x2203('0x32')][_0x2203('0x3d')]){_0x3f73e1['where']=_['merge'](_0x3f73e1[_0x2203('0x3c')],{'$or':_[_0x2203('0x2e')](_0x3f73e1[_0x2203('0x38')],function(_0x484549){var _0x48c6c9={};_0x48c6c9[_0x484549]={'$like':'%'+_0x4e461e['query'][_0x2203('0x3d')]+'%'};return _0x48c6c9;})});}_0x3f73e1=_[_0x2203('0x3e')]({},_0x3f73e1,_0x4e461e[_0x2203('0x59')]);return db[_0x2203('0x54')]['count']({'where':_0x3f73e1[_0x2203('0x3c')]})['then'](function(_0x48bd5){_0x1b7aa8[_0x2203('0x21')]=_0x48bd5;if(_0x4e461e[_0x2203('0x32')][_0x2203('0x40')]){_0x3f73e1[_0x2203('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x2203('0x41')](_0x3f73e1);})[_0x2203('0x26')](function(_0x18663f){_0x1b7aa8['rows']=_0x18663f;return _0x1b7aa8;});}})[_0x2203('0x26')](respondWithFilteredResult(_0x68855d,_0x3f73e1))[_0x2203('0x42')](handleError(_0x68855d,null));};exports[_0x2203('0x5a')]=function(_0xd76624,_0x1c65f9){return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0xd76624[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x1c65f9,null))[_0x2203('0x26')](function(_0x112385){if(_0x112385){return _0x112385['removeDispositions'](_0xd76624[_0x2203('0x32')][_0x2203('0x5b')]);}})[_0x2203('0x26')](respondWithStatusCode(_0x1c65f9,null))[_0x2203('0x42')](handleError(_0x1c65f9,null));};exports[_0x2203('0x5c')]=function(_0x52c35e,_0x23f7b1){if(_0x52c35e[_0x2203('0x48')]['id']){delete _0x52c35e[_0x2203('0x48')]['id'];}return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0x52c35e[_0x2203('0x50')]['id']}})['then'](handleEntityNotFound(_0x23f7b1,null))['then'](function(_0x26cfd7){if(_0x26cfd7){_0x52c35e[_0x2203('0x48')][_0x2203('0x53')]=_0x26cfd7['id'];return db[_0x2203('0x5d')][_0x2203('0x47')](_0x52c35e['body']);}})[_0x2203('0x26')](respondWithResult(_0x23f7b1,null))[_0x2203('0x42')](handleError(_0x23f7b1,null));};exports['getAnswers']=function(_0x511689,_0x4edac6){var _0x4fc51a={'raw':![],'where':{}};var _0x5e07d7={};var _0x2952fc={'count':0x0,'rows':[]};return db[_0x2203('0x2f')][_0x2203('0x5e')]({'where':{'id':_0x511689['params']['id']}})['then'](handleEntityNotFound(_0x4edac6,null))['then'](function(_0x1e1969){if(_0x1e1969){_0x5e07d7[_0x2203('0x36')]=_[_0x2203('0x33')](db[_0x2203('0x5d')][_0x2203('0x44')]);_0x5e07d7[_0x2203('0x32')]=_[_0x2203('0x33')](_0x511689['query']);_0x5e07d7[_0x2203('0x34')]=_[_0x2203('0x35')](_0x5e07d7[_0x2203('0x36')],_0x5e07d7[_0x2203('0x32')]);_0x4fc51a[_0x2203('0x38')]=_[_0x2203('0x35')](_0x5e07d7[_0x2203('0x36')],qs['fields'](_0x511689[_0x2203('0x32')]['fields']));_0x4fc51a['attributes']=_0x4fc51a[_0x2203('0x38')]['length']?_0x4fc51a[_0x2203('0x38')]:_0x5e07d7[_0x2203('0x36')];if(!_0x511689['query'][_0x2203('0x39')](_0x2203('0x57'))){_0x4fc51a[_0x2203('0x22')]=qs[_0x2203('0x22')](_0x511689[_0x2203('0x32')][_0x2203('0x22')]);_0x4fc51a['offset']=qs[_0x2203('0x1f')](_0x511689[_0x2203('0x32')]['offset']);}_0x4fc51a['order']=qs[_0x2203('0x3b')](_0x511689[_0x2203('0x32')][_0x2203('0x3b')]);_0x4fc51a[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x58')](_0x511689[_0x2203('0x32')],_0x5e07d7[_0x2203('0x34')]));_0x4fc51a[_0x2203('0x3c')][_0x2203('0x53')]=_0x1e1969['id'];if(_0x511689[_0x2203('0x32')][_0x2203('0x3d')]){_0x4fc51a[_0x2203('0x3c')]=_[_0x2203('0x3e')](_0x4fc51a[_0x2203('0x3c')],{'$or':_[_0x2203('0x2e')](_0x4fc51a['attributes'],function(_0x4e2d30){var _0x2cb712={};_0x2cb712[_0x4e2d30]={'$like':'%'+_0x511689[_0x2203('0x32')]['filter']+'%'};return _0x2cb712;})});}_0x4fc51a=_[_0x2203('0x3e')]({},_0x4fc51a,_0x511689[_0x2203('0x59')]);return db['CannedAnswer'][_0x2203('0x21')]({'where':_0x4fc51a[_0x2203('0x3c')]})['then'](function(_0x21f357){_0x2952fc[_0x2203('0x21')]=_0x21f357;if(_0x511689['query'][_0x2203('0x40')]){_0x4fc51a[_0x2203('0x45')]=[{'all':!![]}];}return db[_0x2203('0x5d')][_0x2203('0x41')](_0x4fc51a);})['then'](function(_0x511c66){_0x2952fc[_0x2203('0x5f')]=_0x511c66;return _0x2952fc;});}})[_0x2203('0x26')](respondWithFilteredResult(_0x4edac6,_0x4fc51a))[_0x2203('0x42')](handleError(_0x4edac6,null));};exports['removeAnswers']=function(_0x5ef759,_0x8df62d){return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0x5ef759['params']['id']}})['then'](handleEntityNotFound(_0x8df62d,null))[_0x2203('0x26')](function(_0x348ce6){if(_0x348ce6){return _0x348ce6['removeAnswers'](_0x5ef759[_0x2203('0x32')][_0x2203('0x5b')]);}})['then'](respondWithStatusCode(_0x8df62d,null))[_0x2203('0x42')](handleError(_0x8df62d,null));};exports['addLogo']=function(_0x1feca9,_0x5505e9){_0x1feca9['body']['sitepic']=_0x1feca9[_0x2203('0x60')][_0x2203('0x61')];return db['ChatWebsite'][_0x2203('0x46')]({'where':{'id':_0x1feca9[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x5505e9,null))['then'](saveUpdates(_0x1feca9[_0x2203('0x48')],null))['then'](respondWithResult(_0x5505e9,null))[_0x2203('0x42')](handleError(_0x5505e9,null));};exports[_0x2203('0x62')]=function(_0x486563,_0x4358c1){_0x486563[_0x2203('0x48')]['agentAvatar']=_0x486563[_0x2203('0x60')][_0x2203('0x61')];return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0x486563[_0x2203('0x50')]['id']}})['then'](handleEntityNotFound(_0x4358c1,null))[_0x2203('0x26')](saveUpdates(_0x486563[_0x2203('0x48')],null))[_0x2203('0x26')](respondWithResult(_0x4358c1,null))[_0x2203('0x42')](handleError(_0x4358c1,null));};exports[_0x2203('0x63')]=function(_0x180b8c,_0x579ddf){_0x180b8c[_0x2203('0x48')][_0x2203('0x64')]=_0x180b8c['file'][_0x2203('0x61')];return db['ChatWebsite'][_0x2203('0x46')]({'where':{'id':_0x180b8c[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x579ddf,null))['then'](saveUpdates(_0x180b8c[_0x2203('0x48')],null))[_0x2203('0x26')](respondWithResult(_0x579ddf,null))[_0x2203('0x42')](handleError(_0x579ddf,null));};exports[_0x2203('0x65')]=function(_0x2c275f,_0x2cd816){_0x2c275f[_0x2203('0x48')]['systemAvatar']=_0x2c275f['file'][_0x2203('0x61')];return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0x2c275f[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x2cd816,null))[_0x2203('0x26')](saveUpdates(_0x2c275f[_0x2203('0x48')],null))['then'](respondWithResult(_0x2cd816,null))[_0x2203('0x42')](handleError(_0x2cd816,null));};exports[_0x2203('0x66')]=function(_0x5d331b,_0x1f18cd){var _0x53b134=path[_0x2203('0x67')](config[_0x2203('0x68')],'server/files/images/logos/default_logo.svg');var _0x2d8d8c={'where':{'id':_0x5d331b[_0x2203('0x50')]['id']},'attributes':['id',_0x2203('0x69')],'raw':!![]};var _0x9d0f9b=![];return require(_0x2203('0x6a'))[_0x2203('0x6b')]()[_0x2203('0x26')](function(_0x46dc26){if(_0x46dc26){_0x9d0f9b=_0x46dc26[_0x2203('0x6c')];}})[_0x2203('0x26')](function(){return db[_0x2203('0x2f')][_0x2203('0x46')](_0x2d8d8c);})['then'](handleEntityNotFound(_0x1f18cd,null))[_0x2203('0x26')](function(_0x50275d){if(_0x50275d){if(!_[_0x2203('0x6d')](_0x50275d[_0x2203('0x69')])){if(fs[_0x2203('0x6e')](path[_0x2203('0x67')](config[_0x2203('0x68')],_0x2203('0x6f'),_0x50275d[_0x2203('0x69')]))&&_0x9d0f9b){_0x53b134=path[_0x2203('0x67')](config[_0x2203('0x68')],_0x2203('0x6f'),_0x50275d[_0x2203('0x69')]);}}return _0x1f18cd['download'](_0x53b134);}})[_0x2203('0x42')](handleError(_0x1f18cd,null));};exports['getAvatar']=function(_0x44e091,_0x3deb3b){var _0x6b8ea4=path['join'](config[_0x2203('0x68')],_0x2203('0x70'));var _0x1add92={'where':{'id':_0x44e091[_0x2203('0x50')]['id']},'attributes':['id',_0x2203('0x71')],'raw':!![]};return db['ChatWebsite'][_0x2203('0x46')](_0x1add92)['then'](handleEntityNotFound(_0x3deb3b,null))[_0x2203('0x26')](function(_0x17e7e7){if(_0x17e7e7){if(!_['isNil'](_0x17e7e7[_0x2203('0x71')])){if(fs[_0x2203('0x6e')](path[_0x2203('0x67')](config[_0x2203('0x68')],'server/files/images/avatars/',_0x17e7e7[_0x2203('0x71')]))){_0x6b8ea4=path['join'](config['root'],_0x2203('0x72'),_0x17e7e7[_0x2203('0x71')]);}}return _0x3deb3b[_0x2203('0x73')](_0x6b8ea4);}})[_0x2203('0x42')](handleError(_0x3deb3b,null));};exports[_0x2203('0x74')]=function(_0x368b54,_0x206502){var _0x4b6d6f=path[_0x2203('0x67')](config[_0x2203('0x68')],_0x2203('0x75'));var _0x492179={'where':{'id':_0x368b54['params']['id']},'attributes':['id','customerAvatar',_0x2203('0x76')],'raw':!![]};return db[_0x2203('0x2f')][_0x2203('0x46')](_0x492179)[_0x2203('0x26')](handleEntityNotFound(_0x206502,null))['then'](function(_0x238e6f){if(_0x238e6f){if(!_[_0x2203('0x6d')](_0x238e6f[_0x2203('0x64')])){if(fs[_0x2203('0x6e')](path['join'](config['root'],_0x2203('0x72'),_0x238e6f[_0x2203('0x64')]))&&_0x238e6f[_0x2203('0x76')]){_0x4b6d6f=path['join'](config[_0x2203('0x68')],_0x2203('0x72'),_0x238e6f[_0x2203('0x64')]);}}return _0x206502[_0x2203('0x73')](_0x4b6d6f);}})[_0x2203('0x42')](handleError(_0x206502,null));};exports[_0x2203('0x77')]=function(_0xbee79c,_0x529bfb){var _0x2e33df=path[_0x2203('0x67')](config[_0x2203('0x68')],_0x2203('0x78'));var _0x268aca={'where':{'id':_0xbee79c[_0x2203('0x50')]['id']},'attributes':['id',_0x2203('0x79')],'raw':!![]};return db[_0x2203('0x2f')][_0x2203('0x46')](_0x268aca)['then'](handleEntityNotFound(_0x529bfb,null))[_0x2203('0x26')](function(_0xa53324){if(_0xa53324){if(!_[_0x2203('0x6d')](_0xa53324[_0x2203('0x79')])){if(fs['existsSync'](path[_0x2203('0x67')](config[_0x2203('0x68')],_0x2203('0x72'),_0xa53324[_0x2203('0x79')]))){_0x2e33df=path[_0x2203('0x67')](config[_0x2203('0x68')],_0x2203('0x72'),_0xa53324[_0x2203('0x79')]);}}return _0x529bfb[_0x2203('0x73')](_0x2e33df);}})['catch'](handleError(_0x529bfb,null));};exports['notify']=function(_0x225ea1,_0x4670e4){var _0x18f1b6=require(_0x2203('0x7a'));var _0x5bbb78=new _0x18f1b6();var _0x411e9e=_0x5bbb78[_0x2203('0x7b')](_0x225ea1['headers'][_0x2203('0x7c')])[_0x2203('0x7d')]();var _0x330f4d={'body':_0x225ea1[_0x2203('0x48')],'channel':'chat'};var _0x3f3690=[];var _0x11639a=[];var _0x1aab65={};var _0x487f71=![];return db[_0x2203('0x7e')][_0x2203('0x51')]()[_0x2203('0x26')](function(_0x5909b8){if(!_0x5909b8){throw new db['Sequelize'][(_0x2203('0x7f'))](_0x2203('0x80'));}_0x3f3690=_[_0x2203('0x81')](_[_0x2203('0x33')](_0x5909b8),['createdAt',_0x2203('0x82')]);_0x11639a=_[_0x2203('0x81')](_[_0x2203('0x33')](_0x5909b8),['createdAt','updatedAt',_0x2203('0x83'),_0x2203('0x84')]);if(_0x225ea1[_0x2203('0x48')]['id']){delete _0x225ea1[_0x2203('0x48')]['id'];}if(_[_0x2203('0x6d')](_0x225ea1[_0x2203('0x48')][_0x2203('0x85')])){throw new db[(_0x2203('0x86'))][(_0x2203('0x7f'))](_0x2203('0x87'));}if(_[_0x2203('0x6d')](_0x225ea1['body'][_0x2203('0x48')])||_0x225ea1['body'][_0x2203('0x48')]===''){throw new db[(_0x2203('0x86'))][(_0x2203('0x7f'))](_0x2203('0x88'));}if(_[_0x2203('0x6d')](_0x225ea1['body'][_0x2203('0x89')])){throw new db[(_0x2203('0x86'))][(_0x2203('0x7f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11639a);}if(!_[_0x2203('0x8a')](_0x11639a,_0x225ea1[_0x2203('0x48')][_0x2203('0x89')])){throw new db[(_0x2203('0x86'))]['ValidationError'](_0x2203('0x8b')+_0x11639a);}_0x1aab65[_0x225ea1[_0x2203('0x48')][_0x2203('0x89')]]=_0x225ea1[_0x2203('0x48')]['from'];})[_0x2203('0x26')](function(){return db[_0x2203('0x2f')]['find']({'where':{'id':_0x225ea1[_0x2203('0x50')]['id']},'include':[{'model':db[_0x2203('0x8c')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x1aab65,'limit':0x1,'order':[['updatedAt',_0x2203('0x8d')]]}]},{'model':db['ChatApplication'],'as':_0x2203('0x8e')}]});})['then'](handleEntityNotFound(_0x4670e4,null))['then'](function(_0x3b9b12){if(_0x3b9b12&&_0x3b9b12['List']){_0x330f4d[_0x2203('0x8f')]=_0x3b9b12;_0x330f4d['applications']=_0x3b9b12[_0x2203('0x8e')];_0x330f4d[_0x2203('0x90')]=_0x3b9b12[_0x2203('0x91')];_0x330f4d[_0x2203('0x92')]=_[_0x2203('0x93')](_0x330f4d[_0x2203('0x92')],[_0x2203('0x94')],[_0x2203('0x95')]);if(_0x330f4d[_0x2203('0x8f')][_0x2203('0x8e')]){delete _0x330f4d[_0x2203('0x8f')][_0x2203('0x8e')];}if(_0x330f4d['account'][_0x2203('0x91')]&&_0x330f4d[_0x2203('0x8f')][_0x2203('0x91')][_0x2203('0x96')][_0x2203('0x56')]){return _0x330f4d[_0x2203('0x8f')]['List'][_0x2203('0x96')][0x0];}var _0x367bb3=_[_0x2203('0xc')](_0x225ea1[_0x2203('0x48')],{'firstName':_0x225ea1[_0x2203('0x48')][_0x2203('0x85')],'ListId':_0x3b9b12['ListId']});_0x367bb3[_0x225ea1[_0x2203('0x48')][_0x2203('0x89')]]=_0x225ea1[_0x2203('0x48')]['from'];return db[_0x2203('0x7e')][_0x2203('0x47')](_0x367bb3,{'fields':_0x3f3690,'raw':!![]});}})[_0x2203('0x26')](handleEntityNotFound(_0x4670e4,null))[_0x2203('0x26')](function(_0x51d662){_0x330f4d[_0x2203('0x97')]=_0x51d662;var _0x4598cb=_0x225ea1[_0x2203('0x48')][_0x2203('0x98')];if(_0x225ea1[_0x2203('0x99')][_0x2203('0x9a')]){_0x4598cb=_0x225ea1[_0x2203('0x99')][_0x2203('0x9a')];}else if(_0x225ea1['headers']['x-forwarded-for']){_0x4598cb=_['first'](_0x225ea1[_0x2203('0x99')][_0x2203('0x9b')][_0x2203('0x9c')](','));}if(_0x51d662){var _0xed2e6d={'ContactId':_0x51d662['id'],'ChatWebsiteId':_0x225ea1['params']['id'],'from':(_0x51d662['firstName']||'')+'\x20'+(_0x51d662[_0x2203('0x9d')]||''),'customerIp':_0x4598cb,'customerPort':_0x225ea1[_0x2203('0x99')]['x-real-port']?_0x225ea1[_0x2203('0x99')][_0x2203('0x9e')]:null,'referer':_0x225ea1[_0x2203('0x48')]['referer'],'browserName':_0x411e9e[_0x2203('0x9f')]['name']&&_0x411e9e[_0x2203('0x9f')]['version']?util[_0x2203('0xa0')](_0x2203('0xa1'),_0x411e9e[_0x2203('0x9f')][_0x2203('0x2a')],_0x411e9e['browser'][_0x2203('0xa2')]):'unknown','browserVersion':_0x411e9e[_0x2203('0x9f')]['version']||_0x2203('0xa3'),'osName':util[_0x2203('0xa0')](_0x2203('0xa1'),_0x411e9e['os'][_0x2203('0x2a')],_0x411e9e['os']['version']),'osVersion':_0x411e9e['os'][_0x2203('0xa2')],'deviceModel':_0x411e9e[_0x2203('0xa4')][_0x2203('0x36')]&&_0x411e9e[_0x2203('0xa4')][_0x2203('0xa5')]?util[_0x2203('0xa0')](_0x2203('0xa6'),_0x411e9e[_0x2203('0xa4')][_0x2203('0x36')],_0x411e9e[_0x2203('0xa4')][_0x2203('0xa5')],_0x411e9e[_0x2203('0xa4')][_0x2203('0x3f')]):null,'deviceVendor':_0x411e9e[_0x2203('0xa4')][_0x2203('0xa5')],'deviceType':_0x411e9e['device']['type'],'formData':JSON['stringify'](_0x225ea1[_0x2203('0x48')])};var _0x1f423e={'ChatWebsiteId':_0x225ea1[_0x2203('0x50')]['id'],'closed':![]};if(_0x225ea1[_0x2203('0x48')][_0x2203('0xa7')]){_0x1f423e[_0x2203('0xa7')]=_0x225ea1['body'][_0x2203('0xa7')];return db[_0x2203('0xa8')]['find']({'where':_0x1f423e})['then'](function(_0x3f4973){if(_0x3f4973){return[_0x3f4973,![]];}_0xed2e6d['threadId']=_0x225ea1[_0x2203('0x48')][_0x2203('0xa7')];_0xed2e6d['externalUrl']=_0x225ea1[_0x2203('0x48')][_0x2203('0xa9')];return db['ChatInteraction'][_0x2203('0x47')](_0xed2e6d)['then'](function(_0x2d94a1){return[_0x2d94a1,!![]];});});}_0x1f423e[_0x2203('0xaa')]=_0x51d662['id'];if(_0x225ea1[_0x2203('0x48')]['interaction']&&_0x225ea1[_0x2203('0x48')][_0x2203('0xab')]['id']){_0x1f423e['id']=_0x225ea1[_0x2203('0x48')][_0x2203('0xab')]['id'];return db[_0x2203('0xa8')]['find']({'where':_0x1f423e})[_0x2203('0x26')](function(_0x20f50b){if(_0x20f50b){return[_0x20f50b,![]];}return db[_0x2203('0xa8')][_0x2203('0x47')](_0xed2e6d)['then'](function(_0x1b645b){return[_0x1b645b,!![]];});});}return db[_0x2203('0xa8')][_0x2203('0x47')](_0xed2e6d)[_0x2203('0x26')](function(_0x43c0bb){return[_0x43c0bb,!![]];});}})['spread'](function(_0x9c7f35,_0x4d594c){if(_0x9c7f35){_0x487f71=_0x4d594c;if(!_0x4d594c){var _0x2edd2f={'from':(_0x330f4d[_0x2203('0x97')][_0x2203('0xac')]||'')+'\x20'+(_0x330f4d[_0x2203('0x97')]['lastName']||'')};if(_0x225ea1[_0x2203('0x48')][_0x2203('0xa7')]&&_0x225ea1[_0x2203('0x48')][_0x2203('0xad')]&&_0x225ea1[_0x2203('0x48')][_0x2203('0xa7')]!=_0x225ea1[_0x2203('0x48')][_0x2203('0xad')]){_0x2edd2f[_0x2203('0xa7')]=_0x225ea1[_0x2203('0x48')][_0x2203('0xad')];}return _0x9c7f35[_0x2203('0x25')](_0x2edd2f);}else{return _0x9c7f35;}}})[_0x2203('0x26')](function(_0xd4c10e){_0x330f4d[_0x2203('0xab')]=_0xd4c10e[_0x2203('0x4a')]({'plain':!![]});_0x330f4d['interaction']['created']=_0x487f71;if(_0x330f4d['interaction'][_0x2203('0xae')]){if(_0x330f4d[_0x2203('0x8f')][_0x2203('0xaf')]){_0x330f4d['applications'][_0x2203('0xb0')]({'id':0x0,'priority':_0x330f4d[_0x2203('0x92')][_0x2203('0x56')]+0x1,'app':_0x2203('0xb1'),'appdata':_0x2203('0xb2'),'interval':'*,*,*,*'});}}return db[_0x2203('0xb3')][_0x2203('0x47')]({'body':_0x225ea1[_0x2203('0x48')][_0x2203('0x48')],'ChatWebsiteId':_0x225ea1[_0x2203('0x50')]['id'],'ChatInteractionId':_0xd4c10e['id'],'direction':'in','ContactId':_0x330f4d['contact']['id'],'AttachmentId':_0x225ea1[_0x2203('0x48')][_0x2203('0xb4')]});})['then'](function(_0x574471){_0x330f4d[_0x2203('0x1a')]=_0x574471;if(_0x330f4d[_0x2203('0xab')][_0x2203('0xb5')]){return db[_0x2203('0xb6')][_0x2203('0x46')]({'attributes':['id',_0x2203('0x2a')],'where':{'id':_0x330f4d['interaction']['UserId']}})[_0x2203('0x26')](function(_0x385c9a){if(_0x385c9a){_0x330f4d[_0x2203('0x92')][_0x2203('0xb7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x385c9a[_0x2203('0x2a')]+','+(_0x330f4d[_0x2203('0x8f')]['waitForTheAssignedAgent']||0xa),'interval':_0x2203('0xb8')});_0x330f4d['forcedOwnership']=!![];}return respondWithRpcPromise(_0x2203('0xb9'),_0x2203('0xba'),_0x330f4d);});}return respondWithRpcPromise('Start','startRouting',_0x330f4d);})[_0x2203('0x26')](function(_0x1350e3){respondWithRpcPromise('EventManager',_0x2203('0xbb'),{'event':'notify','message':_0x1350e3},client9002);return _0x1350e3;})[_0x2203('0x26')](respondWithResult(_0x4670e4,null))['catch'](handleError(_0x4670e4,null));};exports[_0x2203('0xbc')]=function(_0xcb8c16,_0x226c23){var _0x55f80c,_0x3655b1,_0x17927c;var _0x46d93b=[];var _0x8ad33f={};var _0x1468a5=_0xcb8c16[_0x2203('0xbd')]||[];var _0x23edae=[];var _0xa620b2;return db[_0x2203('0x7e')][_0x2203('0x51')]()['then'](function(_0x2a2e3e){if(!_0x2a2e3e){throw new db['Sequelize'][(_0x2203('0x7f'))](_0x2203('0x80'));}_0x46d93b=_[_0x2203('0x81')](_[_0x2203('0x33')](_0x2a2e3e),['createdAt','updatedAt',_0x2203('0x83'),'ListId']);if(_0xcb8c16[_0x2203('0x48')]['id']){delete _0xcb8c16['body']['id'];}if(_[_0x2203('0x6d')](_0xcb8c16['body']['from'])){throw _0x226c23[_0x2203('0x1d')](0x1f4)[_0x2203('0x2b')](new db['Sequelize'][(_0x2203('0x7f'))](_0x2203('0x87')));}if(_[_0x2203('0x6d')](_0xcb8c16[_0x2203('0x48')][_0x2203('0x48')])||_0xcb8c16[_0x2203('0x48')][_0x2203('0x48')]===''){throw _0x226c23['status'](0x1f4)[_0x2203('0x2b')](new db[(_0x2203('0x86'))][(_0x2203('0x7f'))](_0x2203('0x88')));}if(_[_0x2203('0x6d')](_0xcb8c16[_0x2203('0x48')][_0x2203('0xbe')])){throw _0x226c23[_0x2203('0x1d')](0x1f4)[_0x2203('0x2b')](new db[(_0x2203('0x86'))]['ValidationError'](_0x2203('0xbf')+_0x46d93b));}if(!_[_0x2203('0x8a')](_0x46d93b,_0xcb8c16[_0x2203('0x48')][_0x2203('0xbe')])){throw _0x226c23[_0x2203('0x1d')](0x1f4)[_0x2203('0x2b')](new db[(_0x2203('0x86'))][(_0x2203('0x7f'))](_0x2203('0xc0')+_0x46d93b));}_0x8ad33f[_0xcb8c16[_0x2203('0x48')][_0x2203('0xbe')]]=_0xcb8c16[_0x2203('0x48')][_0x2203('0x85')];})['then'](function(){return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0xcb8c16['params']['id']},'include':[{'model':db[_0x2203('0x8c')],'as':_0x2203('0x91')},{'model':db[_0x2203('0xc1')],'as':_0x2203('0xc1')}]});})[_0x2203('0x26')](handleEntityNotFound(_0x226c23,null))[_0x2203('0x26')](function(_0x2efdb8){if(_0x2efdb8&&_0x2efdb8[_0x2203('0x91')]){_0x3655b1=_0x2efdb8;var _0x3e4a72=_['defaults'](_0xcb8c16[_0x2203('0x48')],{'firstName':_0xcb8c16[_0x2203('0x48')][_0x2203('0x85')],'phone':_0xcb8c16[_0x2203('0x48')][_0x2203('0x85')],'ListId':_0x2efdb8[_0x2203('0x84')]});_0x3e4a72[_0xcb8c16[_0x2203('0x48')][_0x2203('0xbe')]]=_0xcb8c16['body'][_0x2203('0x85')];return db['CmContact'][_0x2203('0xc2')]({'where':_0x8ad33f,'defaults':_0x3e4a72});}})['spread'](function(_0x4118af){if(_0x4118af){_0x17927c=_0x4118af;var _0x581c4f=fs[_0x2203('0xc3')](path[_0x2203('0x67')](config[_0x2203('0x68')],_0x2203('0xc4')),_0x2203('0xc5'));var _0x525a98=ejs[_0x2203('0xc6')](_0x581c4f,{'body':_[_0x2203('0xc7')](_0xcb8c16[_0x2203('0x48')][_0x2203('0x48')]),'bodyTitle':_0x3655b1[_0x2203('0xc8')]});return db[_0x2203('0xc9')][_0x2203('0x47')]({'body':_0x525a98,'plainBody':htmlToText[_0x2203('0xca')](_0x525a98),'ContactId':_0x4118af['id'],'ChatWebsiteId':_0x3655b1['id']});}})['then'](function(_0x4b0ef0){_0xa620b2=_0x4b0ef0;if(_0x1468a5['length']){var _0x13fec6=_0x1468a5['map'](function(_0x5507e9){return{'name':_0x5507e9[_0x2203('0xcb')],'basename':_0x5507e9[_0x2203('0x61')],'type':_0x5507e9['mimetype'],'ChatOfflineMessageId':_0x4b0ef0['id']};});_0x23edae=_0x13fec6['map'](_0xe4ef10=>{var _0x314669={'filename':_0xe4ef10[_0x2203('0x2a')],'path':path['join'](config[_0x2203('0x68')],_0x2203('0xcc'),_0x2203('0xbd'),_0x2203('0xcd'),_0x2203('0xce'),_0xe4ef10[_0x2203('0xcf')])};return _0x314669;});if(!_0x3655b1['openNewInteraction']){return db[_0x2203('0xd0')]['transaction'](function(_0x26d72f){return db[_0x2203('0xd1')][_0x2203('0xd2')](_0x13fec6,{'transaction':_0x26d72f});});}}})[_0x2203('0x26')](function(){if(_0xa620b2){_0x55f80c=_0xa620b2;return db[_0x2203('0xc1')][_0x2203('0x5e')]({'where':{'active':!![]},'include':[{'model':db[_0x2203('0xd3')],'as':'Smtp','raw':!![]}]});}})[_0x2203('0x26')](function(_0xb75c36){if(_0xb75c36&&_0xb75c36['Smtp']&&_0x3655b1[_0x2203('0xd4')]&&_0x3655b1[_0x2203('0xd5')]){var _0x3185e6={'tls':{'rejectUnauthorized':![]}};if(_0xb75c36[_0x2203('0xd6')][_0x2203('0xd7')]){_0x3185e6[_0x2203('0xd7')]=_0xb75c36[_0x2203('0xd6')][_0x2203('0xd7')];}else{_0x3185e6[_0x2203('0xd8')]=_0xb75c36[_0x2203('0xd6')]['host'];_0x3185e6[_0x2203('0xd9')]=_0xb75c36[_0x2203('0xd6')][_0x2203('0xd9')];_0x3185e6['secure']=_0xb75c36[_0x2203('0xd6')][_0x2203('0xda')];}if(_0xb75c36[_0x2203('0xd6')][_0x2203('0xdb')]){_0x3185e6[_0x2203('0xdc')]={'user':_0xb75c36[_0x2203('0xd6')][_0x2203('0x49')],'pass':_0xb75c36[_0x2203('0xd6')][_0x2203('0xdd')]};}return respondWithRpcPromise(_0x2203('0xde'),_0x2203('0xdf'),{'account':_0x3185e6,'message':{'from':util['format'](_0x2203('0xe0'),_0xb75c36[_0x2203('0x2a')],_0xb75c36['email']||_0xb75c36[_0x2203('0xd6')][_0x2203('0x49')]),'to':_0x3655b1[_0x2203('0xd5')],'subject':_0x3655b1[_0x2203('0xe1')],'html':_0x55f80c[_0x2203('0x48')],'attachments':_0x23edae}},client9003)[_0x2203('0x26')](function(){return _0x55f80c;})[_0x2203('0x42')](function(_0xaea451){console[_0x2203('0x19')](_0xaea451);});}})['then'](function(){if(_0x3655b1&&_0x3655b1[_0x2203('0xe2')]&&_0x3655b1[_0x2203('0xe3')]){var _0x5a8ae9=[];if(_0x1468a5[_0x2203('0x56')]){_0x5a8ae9=_0x1468a5[_0x2203('0x2e')](function(_0x15ee70){return{'name':_0x15ee70[_0x2203('0xcb')],'basename':_0x15ee70[_0x2203('0x61')],'type':_0x15ee70[_0x2203('0xe4')],'ChatOfflineMessageId':_0xa620b2['id']};});}var _0x26d6cc;if(!_[_0x2203('0x6d')](_0x3655b1[_0x2203('0xe5')])){var _0x44d30c=_[_0x2203('0x2e')](_0xcb8c16[_0x2203('0x48')],function(_0x40620e){return _0x40620e;});var _0xcfef6a=_[_0x2203('0xe6')](_0x44d30c)[0x0];var _0x529742=_[_0x2203('0xe7')](_0xcfef6a,function(_0x5da1d3){return _0x5da1d3;});_0x26d6cc=_0x529742[0x1][_0x3655b1['subjectOffline']];}var _0x6adba5={'from':_0x17927c['email'],'firstName':_0x17927c['firstName'],'lastName':_0x17927c['lastName'],'mapKey':'email','message':{'from':_0x17927c[_0x2203('0xe8')],'to':_0x3655b1[_0x2203('0xc1')][_0x2203('0xe8')],'cc':'','subject':_[_0x2203('0x6d')](_0x26d6cc)?_0x3655b1['offlineMessageSubject']:_0x26d6cc,'messageId':'','sentAt':new Date(),'attach':_0x5a8ae9[_0x2203('0x56')],'attachments':_0x5a8ae9,'originChannel':_0x2203('0xe9'),'ChatWebsiteId':_0x3655b1['id'],'ChatOfflineMessageId':_0x55f80c['id'],'originTo':_0x3655b1[_0x2203('0xc1')]['email']},'body':_0x55f80c['body']};var _0x39a1c3={'account':{'id':_0x3655b1[_0x2203('0xe3')]},'body':_0x6adba5,'log':_0x2203('0xea')};return respondWithRpcPromise(_0x2203('0xea'),_0x2203('0xeb'),_0x39a1c3,client9001)[_0x2203('0x26')](function(){return _0x55f80c;})[_0x2203('0x42')](function(_0x2481f5){console[_0x2203('0x19')](_0x2481f5);});}return;})[_0x2203('0x26')](function(){if(_0x55f80c){return _0x55f80c;}})[_0x2203('0x26')](respondWithResult(_0x226c23,null))['catch'](function(_0x5298e8){console[_0x2203('0x19')](_0x2203('0x42'),_0x5298e8);for(var _0x1b5a7c of _0x1468a5){var _0x14bbc0=path['join'](config[_0x2203('0x68')],_0x2203('0xcc'),_0x2203('0xbd'),'attachments',_0x2203('0xce'),_0x1b5a7c[_0x2203('0x61')]);fs_extra[_0x2203('0xec')](_0x14bbc0)['catch'](function(_0x3e2946){console['error'](_0x2203('0xed'),_0x14bbc0,_0x3e2946);});}});};exports[_0x2203('0xee')]=function(_0x38a7c4,_0x2111b4){return db[_0x2203('0xa8')][_0x2203('0x46')]({'where':{'id':_0x38a7c4[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x2111b4,null))[_0x2203('0x26')](function(_0x20a488){if(_0x20a488){return _0x20a488[_0x2203('0xee')](_0x38a7c4['body'][_0x2203('0x5b')],_[_0x2203('0xef')](_0x38a7c4[_0x2203('0x48')],[_0x2203('0x5b'),'id'])||{});}})[_0x2203('0x26')](respondWithResult(_0x2111b4,null))[_0x2203('0x42')](handleError(_0x2111b4,null));};exports[_0x2203('0xf0')]=function(_0x46f053,_0x29b90d){var _0x3ac5e2={'raw':![],'where':{}};var _0x160ecb={};var _0x556dd4={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x2203('0x5e')]({'where':{'id':_0x46f053[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x29b90d,null))[_0x2203('0x26')](function(_0x973a9c){if(_0x973a9c){_0x160ecb[_0x2203('0x36')]=_[_0x2203('0x33')](db[_0x2203('0xa8')][_0x2203('0x44')]);_0x160ecb[_0x2203('0x32')]=_[_0x2203('0x33')](_0x46f053[_0x2203('0x32')]);_0x160ecb['filters']=_['intersection'](_0x160ecb[_0x2203('0x36')],_0x160ecb['query']);_0x3ac5e2['attributes']=_[_0x2203('0x35')](_0x160ecb['model'],qs[_0x2203('0x37')](_0x46f053[_0x2203('0x32')][_0x2203('0x37')]));_0x3ac5e2[_0x2203('0x38')]=_0x3ac5e2[_0x2203('0x38')][_0x2203('0x56')]?_0x3ac5e2[_0x2203('0x38')]:_0x160ecb[_0x2203('0x36')];if(!_0x46f053[_0x2203('0x32')]['hasOwnProperty'](_0x2203('0x57'))){_0x3ac5e2['limit']=qs[_0x2203('0x22')](_0x46f053[_0x2203('0x32')][_0x2203('0x22')]);_0x3ac5e2[_0x2203('0x1f')]=qs[_0x2203('0x1f')](_0x46f053['query'][_0x2203('0x1f')]);}_0x3ac5e2['order']=qs[_0x2203('0x3b')](_0x46f053['query']['sort']);_0x3ac5e2[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x58')](_0x46f053[_0x2203('0x32')],_0x160ecb['filters']));_0x3ac5e2['where'][_0x2203('0x53')]=_0x973a9c['id'];if(_0x46f053[_0x2203('0x32')][_0x2203('0x3d')]){_0x3ac5e2['where']=_['merge'](_0x3ac5e2[_0x2203('0x3c')],{'$or':_[_0x2203('0x2e')](_0x3ac5e2[_0x2203('0x38')],function(_0x102591){var _0x345283={};_0x345283[_0x102591]={'$like':'%'+_0x46f053[_0x2203('0x32')][_0x2203('0x3d')]+'%'};return _0x345283;})});}_0x3ac5e2=_[_0x2203('0x3e')]({},_0x3ac5e2,_0x46f053[_0x2203('0x59')]);return db[_0x2203('0xa8')][_0x2203('0x21')]({'where':_0x3ac5e2['where']})['then'](function(_0x3f4b71){_0x556dd4['count']=_0x3f4b71;if(_0x46f053[_0x2203('0x32')][_0x2203('0x40')]){_0x3ac5e2['include']=[{'model':db['CmContact'],'as':_0x2203('0xf1'),'required':![]},{'model':db[_0x2203('0xb6')],'as':_0x2203('0xf2'),'attributes':[_0x2203('0x2a'),'fullname',_0x2203('0xf3')],'required':![]},{'model':db[_0x2203('0xf4')],'as':'Tags','attributes':['id',_0x2203('0x2a'),'color'],'where':_0x46f053[_0x2203('0x32')]['tag']?{'id':_0x46f053[_0x2203('0x32')][_0x2203('0xf5')]}:undefined,'required':_0x46f053[_0x2203('0x32')][_0x2203('0xf5')]?!![]:![]}];}return db[_0x2203('0xa8')][_0x2203('0x41')](_0x3ac5e2);})[_0x2203('0x26')](function(_0x48f227){_0x556dd4[_0x2203('0x5f')]=_0x48f227;return _0x556dd4;});}})['then'](respondWithFilteredResult(_0x29b90d,_0x3ac5e2))[_0x2203('0x42')](handleError(_0x29b90d,null));};function iftimePromise(_0x2b802c,_0x1d3c00){return respondWithRpcPromise(_0x2203('0xf6'),_0x2203('0xf7'),{'command':_0x1d3c00[_0x2203('0xf8')]?util['format']('iftime\x20%s,%s',_0x2b802c[_0x2203('0xf9')],_0x1d3c00[_0x2203('0xf8')]):util[_0x2203('0xa0')]('iftime\x20%s',_0x2b802c[_0x2203('0xf9')])},client9002)[_0x2203('0x26')](function(_0x4419a8){var _0x3f4e0f=_0x4419a8&&_0x4419a8[_0x2203('0xfa')](_0x2203('0xfb'))>=0x0?!![]:![];logger[_0x2203('0x13')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1d3c00['id'],_0x2b802c['id'],_0x2b802c[_0x2203('0xf9')],_0x3f4e0f?_0x2203('0xfc'):_0x2203('0xfd'),_0x1d3c00[_0x2203('0xf8')]?_0x1d3c00[_0x2203('0xf8')]:_0x2203('0xfe'));return _0x3f4e0f;})[_0x2203('0x42')](function(_0x1c3684){logger[_0x2203('0x19')](_0x2203('0xff'),_0x1d3c00['id'],_0x2b802c['id'],_0x2b802c[_0x2203('0xf9')],util['inspect'](_0x1c3684,{'showHidden':![],'depth':null}),_0x1d3c00[_0x2203('0xf8')]?_0x1d3c00[_0x2203('0xf8')]:_0x2203('0xfe'));return![];});}exports[_0x2203('0xf7')]=function(_0x2237ba,_0x57665c){var _0x2bc4b8=0x0;var _0x4d4684=0x0;var _0x362eb2=![];var _0x3e38cd;var _0x189c7b;return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0x2237ba[_0x2203('0x50')]['id']},'include':[{'model':db[_0x2203('0x100')],'as':_0x2203('0x100'),'include':[{'model':db[_0x2203('0x100')],'as':_0x2203('0x101'),'attributes':['id',_0x2203('0xf9')],'raw':!![]}]}]})[_0x2203('0x26')](handleEntityNotFound(_0x57665c,null))['then'](function(_0x2e3e42){if(_0x2e3e42){_0x3e38cd=_0x2e3e42;return _0x2e3e42[_0x2203('0x102')]({'raw':!![]});}})[_0x2203('0x26')](function(_0x4574fe){if(_0x3e38cd){if(_0x4574fe){_0x189c7b=_0x4574fe;}}return require(_0x2203('0x6a'))[_0x2203('0x6b')]();})[_0x2203('0x26')](function(_0x2ff7f7){if(_0x2ff7f7){_0x4d4684=_0x2ff7f7[_0x2203('0x103')];_0x362eb2=_0x2ff7f7[_0x2203('0x6c')];}})[_0x2203('0x26')](function(){return db[_0x2203('0xa8')]['count']({'where':{'closed':![]}});})[_0x2203('0x26')](function(_0x2fc0df){_0x2bc4b8=_0x2fc0df;if(_0x4d4684&&_0x2fc0df>_0x4d4684){return db[_0x2203('0x104')][_0x2203('0x5e')]({'where':{'id':0x1}})['then'](function(_0x7a3db2){if(_0x7a3db2){_0x7a3db2[_0x2203('0x105')](_0x2203('0x106'));}});}})[_0x2203('0x26')](function(){if(_0x3e38cd[_0x2203('0x100')]&&_0x3e38cd['Interval'][_0x2203('0x101')]){var _0x5ce868=[];for(var _0xe78125=0x0;_0xe78125<_0x3e38cd['Interval'][_0x2203('0x101')][_0x2203('0x56')];_0xe78125++){var _0x18dc4f=_0x3e38cd[_0x2203('0x100')]['Intervals'][_0xe78125][_0x2203('0x4a')]({'plain':!![]});_0x5ce868['push'](iftimePromise(_0x18dc4f,_0x3e38cd));}return BPromise['all'](_0x5ce868)[_0x2203('0x26')](function(_0x16ae32){return _[_0x2203('0x107')](_0x16ae32);});}else{return!![];}})[_0x2203('0x26')](function(_0xe54582){var _0x56e08e=fs['readFileSync'](path[_0x2203('0x67')](config[_0x2203('0x68')],_0x2203('0x108')),_0x2203('0xc5'));var _0x1361db={'remote':_0x3e38cd[_0x2203('0x109')],'query':querystring[_0x2203('0x18')](_[_0x2203('0x3e')](_0x3e38cd[_0x2203('0x4a')]({'plain':!![]}),{'customerIp':_0x2237ba[_0x2203('0x99')][_0x2203('0x9b')]||_0x2237ba['headers'][_0x2203('0x10a')]||_0x2237ba['connection'][_0x2203('0x10b')]||_0x2237ba['ip'],'referer':_0x2237ba['headers'][_0x2203('0x10c')],'openedInteractions':_0x2bc4b8,'maxInteractions':_0x4d4684,'virtual':_0x362eb2[_0x2203('0x103')],'online':_0xe54582,'custom':_0x362eb2}))[_0x2203('0x10d')](/'/g,'\x5c\x27')};_0x57665c[_0x2203('0x2b')](ejs[_0x2203('0xc6')](Mustache[_0x2203('0xc6')](_0x56e08e,_0x1361db),{'proactiveActions':_0x189c7b,'alignment':_0x3e38cd[_0x2203('0x10e')],'verticalAlignment':_0x3e38cd[_0x2203('0x10f')],'div_color':_0x3e38cd[_0x2203('0x110')],'labelText':_0x3e38cd['labelText'],'text_color':_0x3e38cd[_0x2203('0x111')],'button_color':_0x3e38cd['color_button'],'background_color':_0x3e38cd[_0x2203('0x112')]}));})[_0x2203('0x42')](handleError(_0x57665c,null));};exports['addApplications']=function(_0x32a0be,_0x2aa207){var _0xb52b88=_0x32a0be[_0x2203('0x50')]['id'];var _0x1d3e2d=_0x32a0be[_0x2203('0x48')];var _0x2efa01=0xc8;var _0x1c9339=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x2203('0xd0')]['Transaction'][_0x2203('0x113')][_0x2203('0x114')]},function(_0x374cec){return db['ChatWebsite'][_0x2203('0x5e')]({'where':{'id':_0xb52b88},'transaction':_0x374cec})[_0x2203('0x26')](function(_0x59b35b){if(_0x59b35b){return db[_0x2203('0x115')]['destroy']({'where':{'ChatWebsiteId':_0xb52b88},'transaction':_0x374cec})[_0x2203('0x26')](function(){var _0x56538e=_[_0x2203('0x2e')](_0x1d3e2d,function(_0xa203f0){_0xa203f0[_0x2203('0x53')]=_0xb52b88;return _0xa203f0;});return db[_0x2203('0x115')][_0x2203('0xd2')](_0x56538e,{'transaction':_0x374cec});});}else{_0x2efa01=0x194;_0x1c9339=[];}});})['then'](function(){if(_0x2efa01!==0x194){return db[_0x2203('0x115')][_0x2203('0x116')]({'where':{'ChatWebsiteId':_0xb52b88},'order':_0x2203('0x94')})['then'](function(_0x14c2f1){_0x1c9339=_0x14c2f1;});}})['catch'](function(_0x14dd3e){_0x2efa01=0x1f4;logger[_0x2203('0x19')](_0x14dd3e['stack']);if(_0x14dd3e[_0x2203('0x2a')]){delete _0x14dd3e[_0x2203('0x2a')];}_0x1c9339=_0x14dd3e;})[_0x2203('0x117')](function(){if(_0x1c9339===null){_0x2aa207[_0x2203('0x28')](_0x2efa01);}else{if(_0x2efa01===0x1f4){_0x2aa207[_0x2203('0x1d')](_0x2efa01)[_0x2203('0x2b')](_0x1c9339);}else{_0x2aa207[_0x2203('0x1d')](_0x2efa01)[_0x2203('0x1e')](_0x1c9339);}}});};exports[_0x2203('0x118')]=function(_0x41e423,_0x4adf48){var _0x594167={};var _0x206ac8={};var _0x248885;var _0x25e548;return db['ChatWebsite']['findOne']({'where':{'id':_0x41e423['params']['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x4adf48,null))[_0x2203('0x26')](function(_0x4220a7){if(_0x4220a7){_0x248885=_0x4220a7;_0x206ac8['model']=_['keys'](db[_0x2203('0x115')]['rawAttributes']);_0x206ac8[_0x2203('0x32')]=_['keys'](_0x41e423[_0x2203('0x32')]);_0x206ac8[_0x2203('0x34')]=_[_0x2203('0x35')](_0x206ac8[_0x2203('0x36')],_0x206ac8[_0x2203('0x32')]);_0x594167[_0x2203('0x38')]=_[_0x2203('0x35')](_0x206ac8[_0x2203('0x36')],qs[_0x2203('0x37')](_0x41e423[_0x2203('0x32')][_0x2203('0x37')]));_0x594167[_0x2203('0x38')]=_0x594167[_0x2203('0x38')][_0x2203('0x56')]?_0x594167[_0x2203('0x38')]:_0x206ac8['model'];_0x594167[_0x2203('0x3a')]=qs[_0x2203('0x3b')](_0x41e423[_0x2203('0x32')][_0x2203('0x3b')]);_0x594167['where']=qs['filters'](_['pick'](_0x41e423[_0x2203('0x32')],_0x206ac8['filters']));if(_0x41e423[_0x2203('0x32')][_0x2203('0x3d')]){_0x594167[_0x2203('0x3c')]=_['merge'](_0x594167[_0x2203('0x3c')],{'$or':_['map'](_0x594167[_0x2203('0x38')],function(_0x5c6564){var _0x542f01={};_0x542f01[_0x5c6564]={'$like':'%'+_0x41e423[_0x2203('0x32')][_0x2203('0x3d')]+'%'};return _0x542f01;})});}_0x594167=_['merge']({},_0x594167,_0x41e423[_0x2203('0x59')]);return _0x248885[_0x2203('0x118')](_0x594167);}})[_0x2203('0x26')](function(_0x50457d){if(_0x50457d){_0x25e548=_0x50457d[_0x2203('0x56')];if(!_0x41e423[_0x2203('0x32')][_0x2203('0x39')](_0x2203('0x57'))){_0x594167[_0x2203('0x22')]=qs[_0x2203('0x22')](_0x41e423[_0x2203('0x32')][_0x2203('0x22')]);_0x594167[_0x2203('0x1f')]=qs[_0x2203('0x1f')](_0x41e423[_0x2203('0x32')][_0x2203('0x1f')]);}return _0x248885['getApplications'](_0x594167);}})[_0x2203('0x26')](function(_0x28eb24){if(_0x28eb24){return _0x28eb24?{'count':_0x25e548,'rows':_0x28eb24}:null;}})[_0x2203('0x26')](respondWithResult(_0x4adf48,null))[_0x2203('0x42')](handleError(_0x4adf48,null));};exports['addProactiveActions']=function(_0x2d4daf,_0x7f22d6){return db[_0x2203('0x119')][_0x2203('0x46')]({'where':{'id':_0x2d4daf[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x7f22d6,null))[_0x2203('0x26')](function(_0x243a85){if(_0x243a85){return _0x243a85[_0x2203('0x11a')](_0x2d4daf[_0x2203('0x48')][_0x2203('0x5b')],_['omit'](_0x2d4daf[_0x2203('0x48')],[_0x2203('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x7f22d6,null))[_0x2203('0x42')](handleError(_0x7f22d6,null));};exports[_0x2203('0x102')]=function(_0x5c9ceb,_0x47660a){var _0x4afe90={};var _0x47f1cc={};var _0x1de009;var _0x4c6b1f;return db[_0x2203('0x2f')][_0x2203('0x5e')]({'where':{'id':_0x5c9ceb[_0x2203('0x50')]['id']}})['then'](handleEntityNotFound(_0x47660a,null))[_0x2203('0x26')](function(_0x3b6fa7){if(_0x3b6fa7){_0x1de009=_0x3b6fa7;_0x47f1cc[_0x2203('0x36')]=_['keys'](db['ChatProactiveAction'][_0x2203('0x44')]);_0x47f1cc[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5c9ceb['query']);_0x47f1cc['filters']=_[_0x2203('0x35')](_0x47f1cc[_0x2203('0x36')],_0x47f1cc[_0x2203('0x32')]);_0x4afe90['attributes']=_['intersection'](_0x47f1cc[_0x2203('0x36')],qs['fields'](_0x5c9ceb[_0x2203('0x32')]['fields']));_0x4afe90['attributes']=_0x4afe90[_0x2203('0x38')][_0x2203('0x56')]?_0x4afe90[_0x2203('0x38')]:_0x47f1cc[_0x2203('0x36')];_0x4afe90[_0x2203('0x3a')]=qs[_0x2203('0x3b')](_0x5c9ceb[_0x2203('0x32')][_0x2203('0x3b')]);_0x4afe90['where']=qs[_0x2203('0x34')](_[_0x2203('0x58')](_0x5c9ceb[_0x2203('0x32')],_0x47f1cc[_0x2203('0x34')]));if(_0x5c9ceb[_0x2203('0x32')][_0x2203('0x3d')]){_0x4afe90[_0x2203('0x3c')]=_[_0x2203('0x3e')](_0x4afe90[_0x2203('0x3c')],{'$or':_[_0x2203('0x2e')](_0x4afe90['attributes'],function(_0x55d335){var _0x2b4179={};_0x2b4179[_0x55d335]={'$like':'%'+_0x5c9ceb['query'][_0x2203('0x3d')]+'%'};return _0x2b4179;})});}_0x4afe90=_[_0x2203('0x3e')]({},_0x4afe90,_0x5c9ceb[_0x2203('0x59')]);return _0x1de009[_0x2203('0x102')](_0x4afe90);}})['then'](function(_0xcb2757){if(_0xcb2757){_0x4c6b1f=_0xcb2757[_0x2203('0x56')];if(!_0x5c9ceb[_0x2203('0x32')][_0x2203('0x39')]('nolimit')){_0x4afe90['limit']=qs[_0x2203('0x22')](_0x5c9ceb[_0x2203('0x32')][_0x2203('0x22')]);_0x4afe90[_0x2203('0x1f')]=qs['offset'](_0x5c9ceb[_0x2203('0x32')][_0x2203('0x1f')]);}return _0x1de009[_0x2203('0x102')](_0x4afe90);}})[_0x2203('0x26')](function(_0x35b738){if(_0x35b738){return _0x35b738?{'count':_0x4c6b1f,'rows':_0x35b738}:null;}})['then'](respondWithResult(_0x47660a,null))['catch'](handleError(_0x47660a,null));};exports['getFields']=function(_0x5e35b6,_0x5cda8c){var _0x14b87a=_0x5e35b6[_0x2203('0x32')][_0x2203('0x11b')]===_0x2203('0x11c')?'offlineForm':_0x2203('0x11d');return db[_0x2203('0x2f')][_0x2203('0x46')]({'attributes':['id',_0x14b87a],'where':{'id':_0x5e35b6[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x5cda8c,null))[_0x2203('0x26')](function(_0x4b427b){if(_0x4b427b){var _0x521cfd=_0x4b427b[_0x14b87a];var _0x531cbe=_0x521cfd&&_0x521cfd[_0x2203('0x11e')]?_0x521cfd[_0x2203('0x11e')]:[];_0x5cda8c[_0x2203('0x2b')]({'fromKey':_['isNil'](_0x521cfd[_0x2203('0x11f')])?undefined:_0x521cfd[_0x2203('0x11f')],'count':_0x531cbe[_0x2203('0x56')],'rows':_0x531cbe});}})['catch'](handleError(_0x5cda8c,null));};exports[_0x2203('0x120')]=function(_0x3688f3,_0x5c8865){var _0x315eb4={'raw':![],'where':{}};var _0x30c8ff={};var _0x5dd144={'count':0x0,'rows':[]};return db[_0x2203('0x2f')][_0x2203('0x5e')]({'where':{'id':_0x3688f3[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x5c8865,null))[_0x2203('0x26')](function(_0x3a8325){if(_0x3a8325){_0x30c8ff[_0x2203('0x36')]=_['keys'](db['ChatOfflineMessage'][_0x2203('0x44')]);_0x30c8ff[_0x2203('0x32')]=_['keys'](_0x3688f3[_0x2203('0x32')]);_0x30c8ff[_0x2203('0x34')]=_[_0x2203('0x35')](_0x30c8ff[_0x2203('0x36')],_0x30c8ff[_0x2203('0x32')]);_0x315eb4['attributes']=_[_0x2203('0x35')](_0x30c8ff[_0x2203('0x36')],qs['fields'](_0x3688f3[_0x2203('0x32')][_0x2203('0x37')]));_0x315eb4[_0x2203('0x38')]=_0x315eb4[_0x2203('0x38')][_0x2203('0x56')]?_0x315eb4['attributes']:_0x30c8ff[_0x2203('0x36')];if(!_0x3688f3[_0x2203('0x32')][_0x2203('0x39')]('nolimit')){_0x315eb4[_0x2203('0x22')]=qs[_0x2203('0x22')](_0x3688f3[_0x2203('0x32')][_0x2203('0x22')]);_0x315eb4[_0x2203('0x1f')]=qs['offset'](_0x3688f3[_0x2203('0x32')]['offset']);}_0x315eb4['order']=qs[_0x2203('0x3b')](_0x3688f3['query'][_0x2203('0x3b')]);_0x315eb4['where']=qs['filters'](_['pick'](_0x3688f3[_0x2203('0x32')],_0x30c8ff[_0x2203('0x34')]));_0x315eb4['where'][_0x2203('0x53')]=_0x3a8325['id'];if(_0x3688f3[_0x2203('0x32')][_0x2203('0x3d')]){_0x315eb4['where']=_[_0x2203('0x3e')](_0x315eb4[_0x2203('0x3c')],{'$or':_[_0x2203('0x2e')](_0x315eb4[_0x2203('0x38')],function(_0x5dbb0f){var _0x255fcc={};_0x255fcc[_0x5dbb0f]={'$like':'%'+_0x3688f3[_0x2203('0x32')]['filter']+'%'};return _0x255fcc;})});}_0x315eb4=_[_0x2203('0x3e')]({},_0x315eb4,_0x3688f3['options']);return db[_0x2203('0xc9')]['count']({'where':_0x315eb4[_0x2203('0x3c')]})[_0x2203('0x26')](function(_0x3b43fb){_0x5dd144['count']=_0x3b43fb;if(_0x3688f3['query']['includeAll']){_0x315eb4[_0x2203('0x45')]=[{'all':!![]}];}else{_0x315eb4[_0x2203('0x45')]=[{'model':db['CmContact'],'as':_0x2203('0xf1'),'required':![]},{'model':db['Attachment'],'as':_0x2203('0x121'),'required':![]}];}return db['ChatOfflineMessage'][_0x2203('0x41')](_0x315eb4);})['then'](function(_0x1b31d1){_0x5dd144[_0x2203('0x5f')]=_0x1b31d1;return _0x5dd144;});}})[_0x2203('0x26')](respondWithFilteredResult(_0x5c8865,_0x315eb4))[_0x2203('0x42')](handleError(_0x5c8865,null));};exports[_0x2203('0x122')]=function(_0xf03cfc,_0x4e62c7){return db['ChatWebsite'][_0x2203('0x46')]({'where':{'id':_0xf03cfc[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x4e62c7,null))[_0x2203('0x26')](function(_0x2a4524){if(_0x2a4524){return _0x2a4524[_0x2203('0x122')](_0xf03cfc[_0x2203('0x48')][_0x2203('0x5b')],_[_0x2203('0xef')](_0xf03cfc[_0x2203('0x48')],['ids','id'])||{})[_0x2203('0x123')](function(_0x1c72a3){for(var _0x50aeb9=0x0;_0x50aeb9<_0xf03cfc['body'][_0x2203('0x5b')]['length'];_0x50aeb9+=0x1){socket[_0x2203('0x124')](_0x2203('0x125'),{'UserId':Number(_0xf03cfc[_0x2203('0x48')]['ids'][_0x50aeb9]),'ChatWebsiteId':Number(_0xf03cfc[_0x2203('0x50')]['id'])});}return _0x1c72a3;});}})[_0x2203('0x26')](respondWithResult(_0x4e62c7,null))['catch'](handleError(_0x4e62c7,null));};exports['removeAgents']=function(_0x3404f0,_0x1363d2){return db['ChatWebsite'][_0x2203('0x46')]({'where':{'id':_0x3404f0['params']['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x1363d2,null))[_0x2203('0x26')](function(_0x1ec67a){if(_0x1ec67a){return _0x1ec67a['removeAgents'](_0x3404f0[_0x2203('0x32')][_0x2203('0x5b')])[_0x2203('0x26')](function(){if(_['isArray'](_0x3404f0[_0x2203('0x32')][_0x2203('0x5b')])){for(var _0x39e22d=0x0;_0x39e22d<_0x3404f0[_0x2203('0x32')][_0x2203('0x5b')][_0x2203('0x56')];_0x39e22d+=0x1){socket[_0x2203('0x124')]('userChatWebsite:remove',{'UserId':Number(_0x3404f0[_0x2203('0x32')]['ids'][_0x39e22d]),'ChatWebsiteId':Number(_0x3404f0[_0x2203('0x50')]['id'])});}}else{socket['emit'](_0x2203('0x126'),{'UserId':Number(_0x3404f0[_0x2203('0x32')][_0x2203('0x5b')]),'ChatWebsiteId':Number(_0x3404f0['params']['id'])});}});}})[_0x2203('0x26')](respondWithStatusCode(_0x1363d2,null))[_0x2203('0x42')](handleError(_0x1363d2,null));};exports[_0x2203('0x127')]=function(_0x4aa271,_0x541ada){var _0x3c9c2c={};var _0x20c49b={};var _0x329725;var _0x14b58b;return db[_0x2203('0x2f')]['findOne']({'where':{'id':_0x4aa271[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x541ada,null))[_0x2203('0x26')](function(_0x5b37a4){if(_0x5b37a4){_0x329725=_0x5b37a4;_0x20c49b[_0x2203('0x36')]=_[_0x2203('0x33')](db['User'][_0x2203('0x44')]);_0x20c49b['query']=_['keys'](_0x4aa271['query']);_0x20c49b[_0x2203('0x34')]=_[_0x2203('0x35')](_0x20c49b['model'],_0x20c49b[_0x2203('0x32')]);_0x3c9c2c[_0x2203('0x38')]=_[_0x2203('0x35')](_0x20c49b['model'],qs['fields'](_0x4aa271[_0x2203('0x32')][_0x2203('0x37')]));_0x3c9c2c['attributes']=_0x3c9c2c[_0x2203('0x38')][_0x2203('0x56')]?_0x3c9c2c['attributes']:_0x20c49b[_0x2203('0x36')];_0x3c9c2c[_0x2203('0x3a')]=qs['sort'](_0x4aa271[_0x2203('0x32')]['sort']);_0x3c9c2c[_0x2203('0x3c')]=qs[_0x2203('0x34')](_['pick'](_0x4aa271[_0x2203('0x32')],_0x20c49b[_0x2203('0x34')]));if(_0x4aa271['query'][_0x2203('0x3d')]){_0x3c9c2c[_0x2203('0x3c')]=_[_0x2203('0x3e')](_0x3c9c2c['where'],{'$or':_['map'](_0x3c9c2c[_0x2203('0x38')],function(_0x196296){var _0x5f52b0={};_0x5f52b0[_0x196296]={'$like':'%'+_0x4aa271[_0x2203('0x32')][_0x2203('0x3d')]+'%'};return _0x5f52b0;})});}_0x3c9c2c=_['merge']({},_0x3c9c2c,_0x4aa271[_0x2203('0x59')]);return _0x329725['getAgents'](_0x3c9c2c);}})[_0x2203('0x26')](function(_0x59cebc){if(_0x59cebc){_0x14b58b=_0x59cebc[_0x2203('0x56')];if(!_0x4aa271['query'][_0x2203('0x39')]('nolimit')){_0x3c9c2c['limit']=qs[_0x2203('0x22')](_0x4aa271[_0x2203('0x32')]['limit']);_0x3c9c2c['offset']=qs[_0x2203('0x1f')](_0x4aa271[_0x2203('0x32')][_0x2203('0x1f')]);}return _0x329725[_0x2203('0x127')](_0x3c9c2c);}})['then'](function(_0x135d0b){if(_0x135d0b){return _0x135d0b?{'count':_0x14b58b,'rows':_0x135d0b}:null;}})['then'](respondWithResult(_0x541ada,null))[_0x2203('0x42')](handleError(_0x541ada,null));}; \ No newline at end of file +var _0xb7e7=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','http','client','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','get','ChatWebsites','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','params','rawAttributes','options','find','create','user','UserProfileSection','userProfileId','autoAssociation','body','describe','Disposition','getDispositions','length','order','ChatWebsiteId','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','ChatApplication','Applications','list','applications','orderBy','priority','asc','account','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','vendor','%s\x20%s\x20%s','device','threadId','externalUrl','ChatInteraction','ContactId','interaction','firstName','messageId','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','Start','startRouting','EventManager','files','CompanyId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','render','toPairs','offlineMessageBody','fromString','originalname','mimetype','attachments','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','server','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','inspect','Interval','Intervals','getProactiveActions','virtual','License','chatLicenseExceeded','all','server/files/chat/iframe.ejs','remote','x-real-ip','connection','replace','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','sequelize','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','omit','getFields','online','onlineForm','items','fromKey','ChatOfflineMessage','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','ejs','lodash','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0xee3a14,_0x438a19){var _0x553638=function(_0x4090c1){while(--_0x4090c1){_0xee3a14['push'](_0xee3a14['shift']());}};_0x553638(++_0x438a19);}(_0xb7e7,0x121));var _0x7b7e=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xb7e7[_0x278e3c];return _0x3e2d9b;};'use strict';var BPromise=require(_0x7b7e('0x0'));var Mustache=require('mustache');var util=require(_0x7b7e('0x1'));var path=require('path');var ejs=require(_0x7b7e('0x2'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b7e('0x3'));var querystring=require('querystring');var Redis=require(_0x7b7e('0x4'));var qs=require(_0x7b7e('0x5'));var logger=require(_0x7b7e('0x6'))('api');var config=require('../../config/environment');var db=require(_0x7b7e('0x7'))['db'];config[_0x7b7e('0x8')]=_[_0x7b7e('0x9')](config['redis'],{'host':_0x7b7e('0xa'),'port':0x18eb});var socket=require(_0x7b7e('0xb'))(new Redis(config[_0x7b7e('0x8')]));require(_0x7b7e('0xc'))[_0x7b7e('0xd')](socket);var htmlToText=require(_0x7b7e('0xe'));var jayson=require(_0x7b7e('0xf'));var client=jayson['client'][_0x7b7e('0x10')]({'port':0x232c});var client9002=jayson[_0x7b7e('0x11')][_0x7b7e('0x10')]({'port':0x232a});var client9003=jayson[_0x7b7e('0x11')][_0x7b7e('0x10')]({'port':0x232b});var client9001=jayson[_0x7b7e('0x11')][_0x7b7e('0x10')]({'port':0x2329});function respondWithRpcPromise(_0x55620b,_0xaadda,_0x54d8ce,_0x267446){return new BPromise(function(_0x430eab,_0x50d7d2){var _0x422d3a=_0x267446||client;return _0x422d3a['request'](_0x55620b,_0x54d8ce)['then'](function(_0x2889ed){logger[_0x7b7e('0x12')](_0x7b7e('0x13'),_0xaadda,_0x7b7e('0x14'));logger[_0x7b7e('0x15')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0xaadda,'request\x20sent',JSON[_0x7b7e('0x16')](_0x2889ed));if(_0x2889ed[_0x7b7e('0x17')]){if(_0x2889ed[_0x7b7e('0x17')][_0x7b7e('0x18')]===0x1f4){logger[_0x7b7e('0x17')](_0x7b7e('0x13'),_0xaadda,_0x2889ed[_0x7b7e('0x17')][_0x7b7e('0x19')]);return _0x50d7d2(_0x2889ed[_0x7b7e('0x17')][_0x7b7e('0x19')]);}logger[_0x7b7e('0x17')](_0x7b7e('0x13'),_0xaadda,_0x2889ed[_0x7b7e('0x17')][_0x7b7e('0x19')]);return _0x430eab(_0x2889ed[_0x7b7e('0x17')][_0x7b7e('0x19')]);}else{logger[_0x7b7e('0x12')]('ChatWebsite,\x20%s,\x20%s',_0xaadda,_0x7b7e('0x14'));_0x430eab(_0x2889ed[_0x7b7e('0x1a')][_0x7b7e('0x19')]);}})['catch'](function(_0x313122){logger[_0x7b7e('0x17')](_0x7b7e('0x13'),_0xaadda,_0x313122);_0x50d7d2(_0x313122);});});}function respondWithStatusCode(_0x200156,_0x2b7211){_0x2b7211=_0x2b7211||0xcc;return function(_0x303d8c){if(_0x303d8c){return _0x200156[_0x7b7e('0x1b')](_0x2b7211);}return _0x200156[_0x7b7e('0x1c')](_0x2b7211)['end']();};}function respondWithResult(_0x5d6215,_0x4a836a){_0x4a836a=_0x4a836a||0xc8;return function(_0x26ee14){if(_0x26ee14){return _0x5d6215[_0x7b7e('0x1c')](_0x4a836a)[_0x7b7e('0x1d')](_0x26ee14);}};}function respondWithFilteredResult(_0x483c6f,_0x51d3b1){return function(_0x5dadbb){if(_0x5dadbb){var _0x182245=typeof _0x51d3b1[_0x7b7e('0x1e')]===_0x7b7e('0x1f')&&typeof _0x51d3b1[_0x7b7e('0x20')]===_0x7b7e('0x1f');var _0x48fad1=_0x5dadbb[_0x7b7e('0x21')];var _0x21a15=_0x182245?0x0:_0x51d3b1['offset'];var _0x57b9da=_0x182245?_0x5dadbb['count']:_0x51d3b1[_0x7b7e('0x1e')]+_0x51d3b1[_0x7b7e('0x20')];var _0x503625;if(_0x57b9da>=_0x48fad1){_0x57b9da=_0x48fad1;_0x503625=0xc8;}else{_0x503625=0xce;}_0x483c6f[_0x7b7e('0x1c')](_0x503625);return _0x483c6f['set'](_0x7b7e('0x22'),_0x21a15+'-'+_0x57b9da+'/'+_0x48fad1)[_0x7b7e('0x1d')](_0x5dadbb);}return null;};}function saveUpdates(_0x27b525){return function(_0x5515ca){if(_0x5515ca){return _0x5515ca[_0x7b7e('0x23')](_0x27b525)[_0x7b7e('0x24')](function(_0x35602a){return _0x35602a;});}return null;};}function removeEntity(_0x326dd2){return function(_0x33f9a1){if(_0x33f9a1){return _0x33f9a1['destroy']()[_0x7b7e('0x24')](function(){var _0x51c010=_0x33f9a1[_0x7b7e('0x25')]({'plain':!![]});var _0x1c7de4=_0x7b7e('0x26');return db[_0x7b7e('0x27')][_0x7b7e('0x28')]({'where':{'type':_0x1c7de4,'resourceId':_0x51c010['id']}})[_0x7b7e('0x24')](function(){return _0x33f9a1;});})[_0x7b7e('0x24')](function(){_0x326dd2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xebcdbc){return function(_0x162b84){if(!_0x162b84){_0xebcdbc['sendStatus'](0x194);}return _0x162b84;};}function handleError(_0x3a3bc7,_0x2a4754){_0x2a4754=_0x2a4754||0x1f4;return function(_0x2ca366){logger['error'](_0x2ca366[_0x7b7e('0x29')]);if(_0x2ca366[_0x7b7e('0x2a')]){delete _0x2ca366[_0x7b7e('0x2a')];}_0x3a3bc7[_0x7b7e('0x1c')](_0x2a4754)[_0x7b7e('0x2b')](_0x2ca366);};}exports[_0x7b7e('0x2c')]=function(_0x3e8cf4,_0x202f04){var _0x44497c={'include':[{'model':db[_0x7b7e('0x2d')],'as':_0x7b7e('0x2e')}]},_0x39b3bb={},_0xd5a64d={'count':0x0,'rows':[]};var _0xdcb8ef=_[_0x7b7e('0x2f')](db[_0x7b7e('0x30')]['rawAttributes'],function(_0x8c80d5){return{'name':_0x8c80d5[_0x7b7e('0x31')],'type':_0x8c80d5[_0x7b7e('0x32')][_0x7b7e('0x33')]};});_0x39b3bb[_0x7b7e('0x34')]=_[_0x7b7e('0x2f')](_0xdcb8ef,_0x7b7e('0x2a'));_0x39b3bb[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x3e8cf4[_0x7b7e('0x35')]);_0x39b3bb['filters']=_[_0x7b7e('0x37')](_0x39b3bb[_0x7b7e('0x34')],_0x39b3bb[_0x7b7e('0x35')]);_0x44497c[_0x7b7e('0x38')]=_['intersection'](_0x39b3bb[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x3e8cf4[_0x7b7e('0x35')]['fields']));_0x44497c['attributes']=_0x44497c[_0x7b7e('0x38')]['length']?_0x44497c[_0x7b7e('0x38')]:_0x39b3bb[_0x7b7e('0x34')];if(!_0x3e8cf4['query'][_0x7b7e('0x3a')](_0x7b7e('0x3b'))){_0x44497c[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x3e8cf4[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x44497c[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x3e8cf4[_0x7b7e('0x35')]['offset']);}_0x44497c['order']=qs[_0x7b7e('0x3c')](_0x3e8cf4['query'][_0x7b7e('0x3c')]);_0x44497c['where']=qs['filters'](_[_0x7b7e('0x3d')](_0x3e8cf4['query'],_0x39b3bb[_0x7b7e('0x3e')]),_0xdcb8ef);if(_0x3e8cf4['query'][_0x7b7e('0x3f')]){_0x44497c[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0x44497c[_0x7b7e('0x40')],{'$or':_['map'](_0xdcb8ef,function(_0x1e4505){if(_0x1e4505[_0x7b7e('0x32')]!==_0x7b7e('0x42')){var _0x37895a={};_0x37895a[_0x1e4505[_0x7b7e('0x2a')]]={'$like':'%'+_0x3e8cf4[_0x7b7e('0x35')]['filter']+'%'};return _0x37895a;}})});}_0x44497c=_['merge']({},_0x44497c,_0x3e8cf4['options']);var _0xc5280c={'where':_0x44497c[_0x7b7e('0x40')]};return db[_0x7b7e('0x30')][_0x7b7e('0x21')](_0xc5280c)[_0x7b7e('0x24')](function(_0x2d47c6){_0xd5a64d['count']=_0x2d47c6;if(_0x3e8cf4[_0x7b7e('0x35')][_0x7b7e('0x43')]){_0x44497c['include']=[{'all':!![]}];}return db['ChatWebsite'][_0x7b7e('0x44')](_0x44497c);})[_0x7b7e('0x24')](function(_0x249a6d){_0xd5a64d[_0x7b7e('0x45')]=_0x249a6d;return _0xd5a64d;})[_0x7b7e('0x24')](respondWithFilteredResult(_0x202f04,_0x44497c))[_0x7b7e('0x46')](handleError(_0x202f04,null));};exports['show']=function(_0x2673eb,_0x4cc7db){var _0x402793={'raw':![],'where':{'id':_0x2673eb[_0x7b7e('0x47')]['id']},'include':[{'model':db[_0x7b7e('0x2d')],'as':'mandatoryDispositionPause'}]},_0x1dad4c={};_0x1dad4c[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db[_0x7b7e('0x30')][_0x7b7e('0x48')]);_0x1dad4c[_0x7b7e('0x35')]=_['keys'](_0x2673eb[_0x7b7e('0x35')]);_0x1dad4c[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0x1dad4c[_0x7b7e('0x34')],_0x1dad4c[_0x7b7e('0x35')]);_0x402793['attributes']=_[_0x7b7e('0x37')](_0x1dad4c[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x2673eb[_0x7b7e('0x35')][_0x7b7e('0x39')]));_0x402793[_0x7b7e('0x38')]=_0x402793[_0x7b7e('0x38')]['length']?_0x402793[_0x7b7e('0x38')]:_0x1dad4c['model'];if(_0x2673eb[_0x7b7e('0x35')][_0x7b7e('0x43')]){_0x402793['include']=[{'all':!![]}];}_0x402793=_[_0x7b7e('0x41')]({},_0x402793,_0x2673eb[_0x7b7e('0x49')]);return db[_0x7b7e('0x30')][_0x7b7e('0x4a')](_0x402793)[_0x7b7e('0x24')](handleEntityNotFound(_0x4cc7db,null))[_0x7b7e('0x24')](respondWithResult(_0x4cc7db,null))[_0x7b7e('0x46')](handleError(_0x4cc7db,null));};exports['create']=function(_0xbf044d,_0x3ff731){return db[_0x7b7e('0x30')][_0x7b7e('0x4b')](_0xbf044d['body'],{})['then'](function(_0x5bdf1d){var _0x2471ad=_0xbf044d[_0x7b7e('0x4c')][_0x7b7e('0x25')]({'plain':!![]});if(!_0x2471ad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2471ad['role']===_0x7b7e('0x4c')){var _0x39efb5=_0x5bdf1d['get']({'plain':!![]});var _0xf54f87=_0x7b7e('0x26');return db[_0x7b7e('0x4d')]['find']({'where':{'name':_0xf54f87,'userProfileId':_0x2471ad[_0x7b7e('0x4e')]},'raw':!![]})[_0x7b7e('0x24')](function(_0x4d9a71){if(_0x4d9a71&&_0x4d9a71[_0x7b7e('0x4f')]===0x0){return db[_0x7b7e('0x27')][_0x7b7e('0x4b')]({'name':_0x39efb5[_0x7b7e('0x2a')],'resourceId':_0x39efb5['id'],'type':_0x4d9a71[_0x7b7e('0x2a')],'sectionId':_0x4d9a71['id']},{})[_0x7b7e('0x24')](function(){return _0x5bdf1d;});}else{return _0x5bdf1d;}})[_0x7b7e('0x46')](function(_0x2d1908){logger[_0x7b7e('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d1908);throw _0x2d1908;});}return _0x5bdf1d;})[_0x7b7e('0x24')](respondWithResult(_0x3ff731,0xc9))[_0x7b7e('0x46')](handleError(_0x3ff731,null));};exports['update']=function(_0xc2b1b6,_0xa22edc){if(_0xc2b1b6[_0x7b7e('0x50')]['id']){delete _0xc2b1b6['body']['id'];}return db[_0x7b7e('0x30')]['find']({'where':{'id':_0xc2b1b6[_0x7b7e('0x47')]['id']},'include':[{'model':db[_0x7b7e('0x2d')],'as':'mandatoryDispositionPause'}]})[_0x7b7e('0x24')](handleEntityNotFound(_0xa22edc,null))[_0x7b7e('0x24')](saveUpdates(_0xc2b1b6['body'],null))[_0x7b7e('0x24')](respondWithResult(_0xa22edc,null))[_0x7b7e('0x46')](handleError(_0xa22edc,null));};exports[_0x7b7e('0x28')]=function(_0x3b1adb,_0x5eb32c){return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x3b1adb[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x5eb32c,null))[_0x7b7e('0x24')](removeEntity(_0x5eb32c,null))[_0x7b7e('0x46')](handleError(_0x5eb32c,null));};exports[_0x7b7e('0x51')]=function(_0x709e87,_0x3665ca){return db[_0x7b7e('0x30')]['describe']()[_0x7b7e('0x24')](respondWithResult(_0x3665ca,null))['catch'](handleError(_0x3665ca,null));};exports['addDisposition']=function(_0x2b105a,_0x7cbe6c){if(_0x2b105a[_0x7b7e('0x50')]['id']){delete _0x2b105a[_0x7b7e('0x50')]['id'];}return db['ChatWebsite'][_0x7b7e('0x4a')]({'where':{'id':_0x2b105a[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x7cbe6c,null))[_0x7b7e('0x24')](function(_0x169540){if(_0x169540){_0x2b105a[_0x7b7e('0x50')]['ChatWebsiteId']=_0x169540['id'];return db[_0x7b7e('0x52')]['create'](_0x2b105a['body']);}})[_0x7b7e('0x24')](respondWithResult(_0x7cbe6c,null))['catch'](handleError(_0x7cbe6c,null));};exports[_0x7b7e('0x53')]=function(_0x4a2378,_0x3c3d29){var _0x148dde={'raw':![],'where':{}};var _0x4c46e0={};var _0x2c167d={'count':0x0,'rows':[]};return db[_0x7b7e('0x30')]['findOne']({'where':{'id':_0x4a2378[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x3c3d29,null))[_0x7b7e('0x24')](function(_0x430033){if(_0x430033){_0x4c46e0[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db[_0x7b7e('0x52')][_0x7b7e('0x48')]);_0x4c46e0[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x4a2378['query']);_0x4c46e0['filters']=_[_0x7b7e('0x37')](_0x4c46e0[_0x7b7e('0x34')],_0x4c46e0[_0x7b7e('0x35')]);_0x148dde[_0x7b7e('0x38')]=_[_0x7b7e('0x37')](_0x4c46e0[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x4a2378['query'][_0x7b7e('0x39')]));_0x148dde[_0x7b7e('0x38')]=_0x148dde['attributes'][_0x7b7e('0x54')]?_0x148dde[_0x7b7e('0x38')]:_0x4c46e0[_0x7b7e('0x34')];if(!_0x4a2378[_0x7b7e('0x35')][_0x7b7e('0x3a')](_0x7b7e('0x3b'))){_0x148dde[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x4a2378[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x148dde[_0x7b7e('0x1e')]=qs['offset'](_0x4a2378[_0x7b7e('0x35')][_0x7b7e('0x1e')]);}_0x148dde[_0x7b7e('0x55')]=qs[_0x7b7e('0x3c')](_0x4a2378[_0x7b7e('0x35')][_0x7b7e('0x3c')]);_0x148dde[_0x7b7e('0x40')]=qs['filters'](_[_0x7b7e('0x3d')](_0x4a2378[_0x7b7e('0x35')],_0x4c46e0[_0x7b7e('0x3e')]));_0x148dde['where'][_0x7b7e('0x56')]=_0x430033['id'];if(_0x4a2378[_0x7b7e('0x35')][_0x7b7e('0x3f')]){_0x148dde[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0x148dde['where'],{'$or':_['map'](_0x148dde['attributes'],function(_0x397923){var _0x8b339c={};_0x8b339c[_0x397923]={'$like':'%'+_0x4a2378[_0x7b7e('0x35')]['filter']+'%'};return _0x8b339c;})});}_0x148dde=_[_0x7b7e('0x41')]({},_0x148dde,_0x4a2378[_0x7b7e('0x49')]);return db[_0x7b7e('0x52')]['count']({'where':_0x148dde[_0x7b7e('0x40')]})[_0x7b7e('0x24')](function(_0x111c99){_0x2c167d[_0x7b7e('0x21')]=_0x111c99;if(_0x4a2378['query'][_0x7b7e('0x43')]){_0x148dde[_0x7b7e('0x57')]=[{'all':!![]}];}return db[_0x7b7e('0x52')][_0x7b7e('0x44')](_0x148dde);})['then'](function(_0x4ec41e){_0x2c167d[_0x7b7e('0x45')]=_0x4ec41e;return _0x2c167d;});}})['then'](respondWithFilteredResult(_0x3c3d29,_0x148dde))[_0x7b7e('0x46')](handleError(_0x3c3d29,null));};exports[_0x7b7e('0x58')]=function(_0x4e2b05,_0x30b703){return db['ChatWebsite'][_0x7b7e('0x4a')]({'where':{'id':_0x4e2b05[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x30b703,null))[_0x7b7e('0x24')](function(_0x374312){if(_0x374312){return _0x374312[_0x7b7e('0x58')](_0x4e2b05[_0x7b7e('0x35')][_0x7b7e('0x59')]);}})[_0x7b7e('0x24')](respondWithStatusCode(_0x30b703,null))[_0x7b7e('0x46')](handleError(_0x30b703,null));};exports[_0x7b7e('0x5a')]=function(_0x31a353,_0xbdc4b9){if(_0x31a353[_0x7b7e('0x50')]['id']){delete _0x31a353[_0x7b7e('0x50')]['id'];}return db[_0x7b7e('0x30')]['find']({'where':{'id':_0x31a353[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0xbdc4b9,null))[_0x7b7e('0x24')](function(_0xa03d7a){if(_0xa03d7a){_0x31a353[_0x7b7e('0x50')][_0x7b7e('0x56')]=_0xa03d7a['id'];return db[_0x7b7e('0x5b')]['create'](_0x31a353[_0x7b7e('0x50')]);}})[_0x7b7e('0x24')](respondWithResult(_0xbdc4b9,null))[_0x7b7e('0x46')](handleError(_0xbdc4b9,null));};exports[_0x7b7e('0x5c')]=function(_0x920e05,_0x4b4f55){var _0x51d41f={'raw':![],'where':{}};var _0xb294bd={};var _0x110f2b={'count':0x0,'rows':[]};return db[_0x7b7e('0x30')][_0x7b7e('0x5d')]({'where':{'id':_0x920e05[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x4b4f55,null))[_0x7b7e('0x24')](function(_0x27d180){if(_0x27d180){_0xb294bd[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db['CannedAnswer'][_0x7b7e('0x48')]);_0xb294bd[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x920e05[_0x7b7e('0x35')]);_0xb294bd[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0xb294bd[_0x7b7e('0x34')],_0xb294bd['query']);_0x51d41f[_0x7b7e('0x38')]=_['intersection'](_0xb294bd[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x920e05['query'][_0x7b7e('0x39')]));_0x51d41f[_0x7b7e('0x38')]=_0x51d41f[_0x7b7e('0x38')][_0x7b7e('0x54')]?_0x51d41f[_0x7b7e('0x38')]:_0xb294bd['model'];if(!_0x920e05[_0x7b7e('0x35')]['hasOwnProperty']('nolimit')){_0x51d41f[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x920e05[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x51d41f['offset']=qs[_0x7b7e('0x1e')](_0x920e05['query'][_0x7b7e('0x1e')]);}_0x51d41f[_0x7b7e('0x55')]=qs[_0x7b7e('0x3c')](_0x920e05[_0x7b7e('0x35')][_0x7b7e('0x3c')]);_0x51d41f[_0x7b7e('0x40')]=qs[_0x7b7e('0x3e')](_['pick'](_0x920e05[_0x7b7e('0x35')],_0xb294bd[_0x7b7e('0x3e')]));_0x51d41f['where'][_0x7b7e('0x56')]=_0x27d180['id'];if(_0x920e05[_0x7b7e('0x35')][_0x7b7e('0x3f')]){_0x51d41f[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0x51d41f[_0x7b7e('0x40')],{'$or':_[_0x7b7e('0x2f')](_0x51d41f[_0x7b7e('0x38')],function(_0x41e2b5){var _0x97232d={};_0x97232d[_0x41e2b5]={'$like':'%'+_0x920e05[_0x7b7e('0x35')][_0x7b7e('0x3f')]+'%'};return _0x97232d;})});}_0x51d41f=_[_0x7b7e('0x41')]({},_0x51d41f,_0x920e05[_0x7b7e('0x49')]);return db[_0x7b7e('0x5b')][_0x7b7e('0x21')]({'where':_0x51d41f[_0x7b7e('0x40')]})[_0x7b7e('0x24')](function(_0x45a690){_0x110f2b[_0x7b7e('0x21')]=_0x45a690;if(_0x920e05[_0x7b7e('0x35')][_0x7b7e('0x43')]){_0x51d41f['include']=[{'all':!![]}];}return db[_0x7b7e('0x5b')][_0x7b7e('0x44')](_0x51d41f);})['then'](function(_0x36fae4){_0x110f2b['rows']=_0x36fae4;return _0x110f2b;});}})['then'](respondWithFilteredResult(_0x4b4f55,_0x51d41f))[_0x7b7e('0x46')](handleError(_0x4b4f55,null));};exports['removeAnswers']=function(_0x4d91c6,_0x8925c6){return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x4d91c6['params']['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x8925c6,null))[_0x7b7e('0x24')](function(_0x2a6fdd){if(_0x2a6fdd){return _0x2a6fdd[_0x7b7e('0x5e')](_0x4d91c6[_0x7b7e('0x35')][_0x7b7e('0x59')]);}})[_0x7b7e('0x24')](respondWithStatusCode(_0x8925c6,null))[_0x7b7e('0x46')](handleError(_0x8925c6,null));};exports[_0x7b7e('0x5f')]=function(_0x47fb99,_0x2a31f8){_0x47fb99[_0x7b7e('0x50')][_0x7b7e('0x60')]=_0x47fb99['file'][_0x7b7e('0x61')];return db[_0x7b7e('0x30')]['find']({'where':{'id':_0x47fb99[_0x7b7e('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a31f8,null))['then'](saveUpdates(_0x47fb99[_0x7b7e('0x50')],null))[_0x7b7e('0x24')](respondWithResult(_0x2a31f8,null))['catch'](handleError(_0x2a31f8,null));};exports[_0x7b7e('0x62')]=function(_0x5ab8a7,_0x4c7158){_0x5ab8a7[_0x7b7e('0x50')][_0x7b7e('0x63')]=_0x5ab8a7[_0x7b7e('0x64')][_0x7b7e('0x61')];return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x5ab8a7[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x4c7158,null))['then'](saveUpdates(_0x5ab8a7[_0x7b7e('0x50')],null))[_0x7b7e('0x24')](respondWithResult(_0x4c7158,null))[_0x7b7e('0x46')](handleError(_0x4c7158,null));};exports[_0x7b7e('0x65')]=function(_0x1ae419,_0x13c910){_0x1ae419[_0x7b7e('0x50')][_0x7b7e('0x66')]=_0x1ae419[_0x7b7e('0x64')][_0x7b7e('0x61')];return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x1ae419['params']['id']}})['then'](handleEntityNotFound(_0x13c910,null))[_0x7b7e('0x24')](saveUpdates(_0x1ae419[_0x7b7e('0x50')],null))[_0x7b7e('0x24')](respondWithResult(_0x13c910,null))[_0x7b7e('0x46')](handleError(_0x13c910,null));};exports[_0x7b7e('0x67')]=function(_0x420199,_0x2d885c){_0x420199[_0x7b7e('0x50')][_0x7b7e('0x68')]=_0x420199[_0x7b7e('0x64')][_0x7b7e('0x61')];return db[_0x7b7e('0x30')]['find']({'where':{'id':_0x420199[_0x7b7e('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d885c,null))[_0x7b7e('0x24')](saveUpdates(_0x420199[_0x7b7e('0x50')],null))[_0x7b7e('0x24')](respondWithResult(_0x2d885c,null))['catch'](handleError(_0x2d885c,null));};exports['getLogo']=function(_0x4e7889,_0x110ad6){var _0x88ad=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x6b'));var _0x42531c={'where':{'id':_0x4e7889[_0x7b7e('0x47')]['id']},'attributes':['id',_0x7b7e('0x60')],'raw':!![]};var _0x18846e=![];return require(_0x7b7e('0x6c'))[_0x7b7e('0x6d')]()['then'](function(_0x229527){if(_0x229527){_0x18846e=_0x229527[_0x7b7e('0x6e')];}})[_0x7b7e('0x24')](function(){return db[_0x7b7e('0x30')]['find'](_0x42531c);})[_0x7b7e('0x24')](handleEntityNotFound(_0x110ad6,null))[_0x7b7e('0x24')](function(_0x46f43a){if(_0x46f43a){if(!_[_0x7b7e('0x6f')](_0x46f43a[_0x7b7e('0x60')])){if(fs[_0x7b7e('0x70')](path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x71'),_0x46f43a[_0x7b7e('0x60')]))&&_0x18846e){_0x88ad=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x71'),_0x46f43a[_0x7b7e('0x60')]);}}return _0x110ad6[_0x7b7e('0x72')](_0x88ad);}})[_0x7b7e('0x46')](handleError(_0x110ad6,null));};exports[_0x7b7e('0x73')]=function(_0x451862,_0x1ba63b){var _0x42def4=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x74'));var _0x28a696={'where':{'id':_0x451862[_0x7b7e('0x47')]['id']},'attributes':['id',_0x7b7e('0x63')],'raw':!![]};return db[_0x7b7e('0x30')][_0x7b7e('0x4a')](_0x28a696)['then'](handleEntityNotFound(_0x1ba63b,null))[_0x7b7e('0x24')](function(_0x4ebfa7){if(_0x4ebfa7){if(!_['isNil'](_0x4ebfa7['agentAvatar'])){if(fs[_0x7b7e('0x70')](path[_0x7b7e('0x69')](config['root'],'server/files/images/avatars/',_0x4ebfa7[_0x7b7e('0x63')]))){_0x42def4=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],'server/files/images/avatars/',_0x4ebfa7[_0x7b7e('0x63')]);}}return _0x1ba63b['download'](_0x42def4);}})['catch'](handleError(_0x1ba63b,null));};exports[_0x7b7e('0x75')]=function(_0x596ec1,_0x4deac2){var _0xc55b86=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],'server/files/images/avatars/customer_avatar.png');var _0x59e5f1={'where':{'id':_0x596ec1[_0x7b7e('0x47')]['id']},'attributes':['id',_0x7b7e('0x66'),_0x7b7e('0x76')],'raw':!![]};return db[_0x7b7e('0x30')][_0x7b7e('0x4a')](_0x59e5f1)[_0x7b7e('0x24')](handleEntityNotFound(_0x4deac2,null))[_0x7b7e('0x24')](function(_0x1b4600){if(_0x1b4600){if(!_[_0x7b7e('0x6f')](_0x1b4600['customerAvatar'])){if(fs[_0x7b7e('0x70')](path['join'](config[_0x7b7e('0x6a')],_0x7b7e('0x77'),_0x1b4600[_0x7b7e('0x66')]))&&_0x1b4600[_0x7b7e('0x76')]){_0xc55b86=path[_0x7b7e('0x69')](config['root'],_0x7b7e('0x77'),_0x1b4600[_0x7b7e('0x66')]);}}return _0x4deac2[_0x7b7e('0x72')](_0xc55b86);}})[_0x7b7e('0x46')](handleError(_0x4deac2,null));};exports['getSystemAvatar']=function(_0x137ba6,_0x1d7938){var _0x5e067f=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x78'));var _0x218861={'where':{'id':_0x137ba6[_0x7b7e('0x47')]['id']},'attributes':['id',_0x7b7e('0x68')],'raw':!![]};return db[_0x7b7e('0x30')][_0x7b7e('0x4a')](_0x218861)[_0x7b7e('0x24')](handleEntityNotFound(_0x1d7938,null))[_0x7b7e('0x24')](function(_0x23e2ad){if(_0x23e2ad){if(!_['isNil'](_0x23e2ad[_0x7b7e('0x68')])){if(fs[_0x7b7e('0x70')](path['join'](config[_0x7b7e('0x6a')],'server/files/images/avatars/',_0x23e2ad[_0x7b7e('0x68')]))){_0x5e067f=path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],'server/files/images/avatars/',_0x23e2ad[_0x7b7e('0x68')]);}}return _0x1d7938[_0x7b7e('0x72')](_0x5e067f);}})[_0x7b7e('0x46')](handleError(_0x1d7938,null));};exports[_0x7b7e('0x79')]=function(_0xeeaf19,_0x27785c){var _0x176a28=require(_0x7b7e('0x7a'));var _0x394db1=new _0x176a28();var _0x285728=_0x394db1['setUA'](_0xeeaf19[_0x7b7e('0x7b')][_0x7b7e('0x7c')])[_0x7b7e('0x7d')]();var _0x5d0479={'body':_0xeeaf19['body'],'channel':_0x7b7e('0x7e')};var _0x5afd0b=[];var _0x5ac317=[];var _0x26aef0={};var _0x173308=![];return db[_0x7b7e('0x7f')]['describe']()[_0x7b7e('0x24')](function(_0x33eba1){if(!_0x33eba1){throw new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0x82'));}_0x5afd0b=_['difference'](_[_0x7b7e('0x36')](_0x33eba1),[_0x7b7e('0x83'),_0x7b7e('0x84')]);_0x5ac317=_[_0x7b7e('0x85')](_[_0x7b7e('0x36')](_0x33eba1),[_0x7b7e('0x83'),'updatedAt','CompanyId',_0x7b7e('0x86')]);if(_0xeeaf19['body']['id']){delete _0xeeaf19[_0x7b7e('0x50')]['id'];}if(_[_0x7b7e('0x6f')](_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x87')])){throw new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0x88'));}if(_['isNil'](_0xeeaf19['body'][_0x7b7e('0x50')])||_0xeeaf19[_0x7b7e('0x50')]['body']===''){throw new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x89')])){throw new db[(_0x7b7e('0x80'))]['ValidationError'](_0x7b7e('0x8a')+_0x5ac317);}if(!_[_0x7b7e('0x8b')](_0x5ac317,_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x89')])){throw new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0x8c')+_0x5ac317);}_0x26aef0[_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x89')]]=_0xeeaf19[_0x7b7e('0x50')]['from'];})['then'](function(){return db['ChatWebsite'][_0x7b7e('0x4a')]({'where':{'id':_0xeeaf19['params']['id']},'include':[{'model':db[_0x7b7e('0x8d')],'as':_0x7b7e('0x8e'),'include':[{'model':db[_0x7b7e('0x7f')],'as':'Contacts','where':_0x26aef0,'limit':0x1,'order':[[_0x7b7e('0x84'),_0x7b7e('0x8f')]]}]},{'model':db[_0x7b7e('0x90')],'as':_0x7b7e('0x91')}]});})[_0x7b7e('0x24')](handleEntityNotFound(_0x27785c,null))[_0x7b7e('0x24')](function(_0x398345){if(_0x398345&&_0x398345['List']){_0x5d0479['account']=_0x398345;_0x5d0479['applications']=_0x398345[_0x7b7e('0x91')];_0x5d0479[_0x7b7e('0x92')]=_0x398345[_0x7b7e('0x8e')];_0x5d0479[_0x7b7e('0x93')]=_[_0x7b7e('0x94')](_0x5d0479[_0x7b7e('0x93')],[_0x7b7e('0x95')],[_0x7b7e('0x96')]);if(_0x5d0479[_0x7b7e('0x97')]['Applications']){delete _0x5d0479[_0x7b7e('0x97')][_0x7b7e('0x91')];}if(_0x5d0479[_0x7b7e('0x97')]['List']&&_0x5d0479[_0x7b7e('0x97')]['List'][_0x7b7e('0x98')][_0x7b7e('0x54')]){return _0x5d0479[_0x7b7e('0x97')][_0x7b7e('0x8e')]['Contacts'][0x0];}var _0x40b101=_[_0x7b7e('0x9')](_0xeeaf19[_0x7b7e('0x50')],{'firstName':_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x87')],'ListId':_0x398345['ListId']});_0x40b101[_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x89')]]=_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x87')];return db[_0x7b7e('0x7f')][_0x7b7e('0x4b')](_0x40b101,{'fields':_0x5afd0b,'raw':!![]});}})[_0x7b7e('0x24')](handleEntityNotFound(_0x27785c,null))[_0x7b7e('0x24')](function(_0x576d82){_0x5d0479[_0x7b7e('0x99')]=_0x576d82;var _0x65ccc1=_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x9a')];if(_0xeeaf19[_0x7b7e('0x7b')]['cf-connecting-ip']){_0x65ccc1=_0xeeaf19[_0x7b7e('0x7b')][_0x7b7e('0x9b')];}else if(_0xeeaf19[_0x7b7e('0x7b')][_0x7b7e('0x9c')]){_0x65ccc1=_[_0x7b7e('0x9d')](_0xeeaf19[_0x7b7e('0x7b')][_0x7b7e('0x9c')][_0x7b7e('0x9e')](','));}if(_0x576d82){var _0x3cfe88={'ContactId':_0x576d82['id'],'ChatWebsiteId':_0xeeaf19[_0x7b7e('0x47')]['id'],'from':(_0x576d82['firstName']||'')+'\x20'+(_0x576d82[_0x7b7e('0x9f')]||''),'customerIp':_0x65ccc1,'customerPort':_0xeeaf19['headers'][_0x7b7e('0xa0')]?_0xeeaf19[_0x7b7e('0x7b')][_0x7b7e('0xa0')]:null,'referer':_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xa1')],'browserName':_0x285728[_0x7b7e('0xa2')][_0x7b7e('0x2a')]&&_0x285728[_0x7b7e('0xa2')][_0x7b7e('0xa3')]?util[_0x7b7e('0xa4')](_0x7b7e('0xa5'),_0x285728[_0x7b7e('0xa2')][_0x7b7e('0x2a')],_0x285728['browser']['version']):_0x7b7e('0xa6'),'browserVersion':_0x285728['browser'][_0x7b7e('0xa3')]||_0x7b7e('0xa6'),'osName':util[_0x7b7e('0xa4')](_0x7b7e('0xa5'),_0x285728['os'][_0x7b7e('0x2a')],_0x285728['os']['version']),'osVersion':_0x285728['os'][_0x7b7e('0xa3')],'deviceModel':_0x285728['device']['model']&&_0x285728['device'][_0x7b7e('0xa7')]?util[_0x7b7e('0xa4')](_0x7b7e('0xa8'),_0x285728[_0x7b7e('0xa9')][_0x7b7e('0x34')],_0x285728[_0x7b7e('0xa9')][_0x7b7e('0xa7')],_0x285728['device'][_0x7b7e('0x32')]):null,'deviceVendor':_0x285728[_0x7b7e('0xa9')][_0x7b7e('0xa7')],'deviceType':_0x285728[_0x7b7e('0xa9')][_0x7b7e('0x32')],'formData':JSON[_0x7b7e('0x16')](_0xeeaf19[_0x7b7e('0x50')])};var _0x7025d7={'ChatWebsiteId':_0xeeaf19[_0x7b7e('0x47')]['id'],'closed':![]};if(_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xaa')]){_0x7025d7[_0x7b7e('0xaa')]=_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xaa')];return db['ChatInteraction']['find']({'where':_0x7025d7})[_0x7b7e('0x24')](function(_0x42a8f9){if(_0x42a8f9){return[_0x42a8f9,![]];}_0x3cfe88[_0x7b7e('0xaa')]=_0xeeaf19['body'][_0x7b7e('0xaa')];_0x3cfe88[_0x7b7e('0xab')]=_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xab')];return db[_0x7b7e('0xac')]['create'](_0x3cfe88)['then'](function(_0x51ed9d){return[_0x51ed9d,!![]];});});}_0x7025d7[_0x7b7e('0xad')]=_0x576d82['id'];if(_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xae')]&&_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xae')]['id']){_0x7025d7['id']=_0xeeaf19['body'][_0x7b7e('0xae')]['id'];return db['ChatInteraction'][_0x7b7e('0x4a')]({'where':_0x7025d7})['then'](function(_0x4a2fa9){if(_0x4a2fa9){return[_0x4a2fa9,![]];}return db['ChatInteraction'][_0x7b7e('0x4b')](_0x3cfe88)[_0x7b7e('0x24')](function(_0x5a922a){return[_0x5a922a,!![]];});});}return db[_0x7b7e('0xac')][_0x7b7e('0x4b')](_0x3cfe88)[_0x7b7e('0x24')](function(_0x27a391){return[_0x27a391,!![]];});}})['spread'](function(_0x845230,_0x62846d){if(_0x845230){_0x173308=_0x62846d;if(!_0x62846d){var _0x495348={'from':(_0x5d0479[_0x7b7e('0x99')][_0x7b7e('0xaf')]||'')+'\x20'+(_0x5d0479[_0x7b7e('0x99')][_0x7b7e('0x9f')]||'')};if(_0xeeaf19['body'][_0x7b7e('0xaa')]&&_0xeeaf19[_0x7b7e('0x50')]['messageId']&&_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xaa')]!=_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xb0')]){_0x495348[_0x7b7e('0xaa')]=_0xeeaf19[_0x7b7e('0x50')]['messageId'];}return _0x845230[_0x7b7e('0x23')](_0x495348);}else{return _0x845230;}}})['then'](function(_0x42957f){_0x5d0479['interaction']=_0x42957f[_0x7b7e('0x25')]({'plain':!![]});_0x5d0479[_0x7b7e('0xae')]['created']=_0x173308;if(_0x5d0479['interaction']['created']){if(_0x5d0479[_0x7b7e('0x97')][_0x7b7e('0xb1')]){_0x5d0479[_0x7b7e('0x93')][_0x7b7e('0xb2')]({'id':0x0,'priority':_0x5d0479[_0x7b7e('0x93')][_0x7b7e('0x54')]+0x1,'app':'close','appdata':_0x7b7e('0xb3'),'interval':_0x7b7e('0xb4')});}}return db[_0x7b7e('0xb5')]['create']({'body':_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0x50')],'ChatWebsiteId':_0xeeaf19[_0x7b7e('0x47')]['id'],'ChatInteractionId':_0x42957f['id'],'direction':'in','ContactId':_0x5d0479[_0x7b7e('0x99')]['id'],'AttachmentId':_0xeeaf19[_0x7b7e('0x50')][_0x7b7e('0xb6')]});})[_0x7b7e('0x24')](function(_0xc9ed8f){_0x5d0479[_0x7b7e('0x19')]=_0xc9ed8f;if(_0x5d0479[_0x7b7e('0xae')][_0x7b7e('0xb7')]){return db[_0x7b7e('0xb8')]['find']({'attributes':['id',_0x7b7e('0x2a')],'where':{'id':_0x5d0479['interaction'][_0x7b7e('0xb7')]}})['then'](function(_0x276a76){if(_0x276a76){_0x5d0479[_0x7b7e('0x93')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7b7e('0xb9'),'appdata':_0x276a76['name']+','+(_0x5d0479[_0x7b7e('0x97')]['waitForTheAssignedAgent']||0xa),'interval':_0x7b7e('0xb4')});_0x5d0479['forcedOwnership']=!![];}return respondWithRpcPromise(_0x7b7e('0xba'),_0x7b7e('0xbb'),_0x5d0479);});}return respondWithRpcPromise(_0x7b7e('0xba'),_0x7b7e('0xbb'),_0x5d0479);})[_0x7b7e('0x24')](function(_0x255fed){respondWithRpcPromise(_0x7b7e('0xbc'),_0x7b7e('0xbc'),{'event':_0x7b7e('0x79'),'message':_0x255fed},client9002);return _0x255fed;})[_0x7b7e('0x24')](respondWithResult(_0x27785c,null))[_0x7b7e('0x46')](handleError(_0x27785c,null));};exports['offline']=function(_0x5eae74,_0x4999af){var _0x4a193a,_0x55b604,_0x283d97;var _0x1586b9=[];var _0x3a10d3={};var _0x46f331=_0x5eae74[_0x7b7e('0xbd')]||[];var _0x4ce6b2=[];var _0x5a9723;return db[_0x7b7e('0x7f')]['describe']()[_0x7b7e('0x24')](function(_0x350a01){if(!_0x350a01){throw new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0x82'));}_0x1586b9=_[_0x7b7e('0x85')](_[_0x7b7e('0x36')](_0x350a01),[_0x7b7e('0x83'),'updatedAt',_0x7b7e('0xbe'),'ListId']);if(_0x5eae74['body']['id']){delete _0x5eae74[_0x7b7e('0x50')]['id'];}if(_[_0x7b7e('0x6f')](_0x5eae74[_0x7b7e('0x50')][_0x7b7e('0x87')])){throw _0x4999af[_0x7b7e('0x1c')](0x1f4)[_0x7b7e('0x2b')](new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0x88')));}if(_[_0x7b7e('0x6f')](_0x5eae74[_0x7b7e('0x50')][_0x7b7e('0x50')])||_0x5eae74[_0x7b7e('0x50')]['body']===''){throw _0x4999af[_0x7b7e('0x1c')](0x1f4)[_0x7b7e('0x2b')](new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0xbf')));}if(_[_0x7b7e('0x6f')](_0x5eae74[_0x7b7e('0x50')][_0x7b7e('0xc0')])){throw _0x4999af[_0x7b7e('0x1c')](0x1f4)['send'](new db[(_0x7b7e('0x80'))][(_0x7b7e('0x81'))](_0x7b7e('0xc1')+_0x1586b9));}if(!_[_0x7b7e('0x8b')](_0x1586b9,_0x5eae74[_0x7b7e('0x50')]['mapKeyOffline'])){throw _0x4999af[_0x7b7e('0x1c')](0x1f4)[_0x7b7e('0x2b')](new db[(_0x7b7e('0x80'))]['ValidationError'](_0x7b7e('0xc2')+_0x1586b9));}_0x3a10d3[_0x5eae74[_0x7b7e('0x50')]['mapKeyOffline']]=_0x5eae74['body'][_0x7b7e('0x87')];})[_0x7b7e('0x24')](function(){return db['ChatWebsite'][_0x7b7e('0x4a')]({'where':{'id':_0x5eae74[_0x7b7e('0x47')]['id']},'include':[{'model':db[_0x7b7e('0x8d')],'as':_0x7b7e('0x8e')},{'model':db[_0x7b7e('0xc3')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x4999af,null))[_0x7b7e('0x24')](function(_0x4a6398){if(_0x4a6398&&_0x4a6398[_0x7b7e('0x8e')]){_0x55b604=_0x4a6398;var _0x4b3682=_[_0x7b7e('0x9')](_0x5eae74['body'],{'firstName':_0x5eae74[_0x7b7e('0x50')]['from'],'phone':_0x5eae74['body'][_0x7b7e('0x87')],'ListId':_0x4a6398['ListId']});_0x4b3682[_0x5eae74['body'][_0x7b7e('0xc0')]]=_0x5eae74[_0x7b7e('0x50')]['from'];return db[_0x7b7e('0x7f')][_0x7b7e('0xc4')]({'where':_0x3a10d3,'defaults':_0x4b3682});}})[_0x7b7e('0xc5')](function(_0x45c9b7){if(_0x45c9b7){_0x283d97=_0x45c9b7;var _0x1dc553=fs[_0x7b7e('0xc6')](path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x3e0e3e=ejs[_0x7b7e('0xc7')](_0x1dc553,{'body':_[_0x7b7e('0xc8')](_0x5eae74[_0x7b7e('0x50')][_0x7b7e('0x50')]),'bodyTitle':_0x55b604[_0x7b7e('0xc9')]});return db['ChatOfflineMessage'][_0x7b7e('0x4b')]({'body':_0x3e0e3e,'plainBody':htmlToText[_0x7b7e('0xca')](_0x3e0e3e),'ContactId':_0x45c9b7['id'],'ChatWebsiteId':_0x55b604['id']});}})['then'](function(_0x4a656c){_0x5a9723=_0x4a656c;if(_0x46f331[_0x7b7e('0x54')]){var _0x52531d=_0x46f331[_0x7b7e('0x2f')](function(_0x23f186){return{'name':_0x23f186[_0x7b7e('0xcb')],'basename':_0x23f186[_0x7b7e('0x61')],'type':_0x23f186[_0x7b7e('0xcc')],'ChatOfflineMessageId':_0x4a656c['id']};});_0x4ce6b2=_0x52531d['map'](_0x2405ba=>{var _0x582bb9={'filename':_0x2405ba[_0x7b7e('0x2a')],'path':path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],'server',_0x7b7e('0xbd'),_0x7b7e('0xcd'),'offline-chat',_0x2405ba[_0x7b7e('0xce')])};return _0x582bb9;});if(!_0x55b604[_0x7b7e('0xcf')]){return db['sequelize'][_0x7b7e('0xd0')](function(_0x30e0ac){return db[_0x7b7e('0xd1')][_0x7b7e('0xd2')](_0x52531d,{'transaction':_0x30e0ac});});}}})['then'](function(){if(_0x5a9723){_0x4a193a=_0x5a9723;return db[_0x7b7e('0xc3')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0x7b7e('0xd3')],'as':'Smtp','raw':!![]}]});}})[_0x7b7e('0x24')](function(_0x4e4703){if(_0x4e4703&&_0x4e4703[_0x7b7e('0xd4')]&&_0x55b604[_0x7b7e('0xd5')]&&_0x55b604[_0x7b7e('0xd6')]){var _0xf34506={'tls':{'rejectUnauthorized':![]}};if(_0x4e4703[_0x7b7e('0xd4')]['service']){_0xf34506[_0x7b7e('0xd7')]=_0x4e4703[_0x7b7e('0xd4')][_0x7b7e('0xd7')];}else{_0xf34506['host']=_0x4e4703['Smtp'][_0x7b7e('0xd8')];_0xf34506[_0x7b7e('0xd9')]=_0x4e4703[_0x7b7e('0xd4')][_0x7b7e('0xd9')];_0xf34506['secure']=_0x4e4703[_0x7b7e('0xd4')][_0x7b7e('0xda')];}if(_0x4e4703[_0x7b7e('0xd4')]['authentication']){_0xf34506[_0x7b7e('0xdb')]={'user':_0x4e4703[_0x7b7e('0xd4')][_0x7b7e('0x4c')],'pass':_0x4e4703['Smtp'][_0x7b7e('0xdc')]};}return respondWithRpcPromise(_0x7b7e('0xdd'),_0x7b7e('0xde'),{'account':_0xf34506,'message':{'from':util[_0x7b7e('0xa4')](_0x7b7e('0xdf'),_0x4e4703['name'],_0x4e4703[_0x7b7e('0xe0')]||_0x4e4703[_0x7b7e('0xd4')]['user']),'to':_0x55b604['forwardOfflineAddress'],'subject':_0x55b604[_0x7b7e('0xe1')],'html':_0x4a193a[_0x7b7e('0x50')],'attachments':_0x4ce6b2}},client9003)[_0x7b7e('0x24')](function(){return _0x4a193a;})[_0x7b7e('0x46')](function(_0x1bbd6d){console[_0x7b7e('0x17')](_0x1bbd6d);});}})[_0x7b7e('0x24')](function(){if(_0x55b604&&_0x55b604[_0x7b7e('0xcf')]&&_0x55b604[_0x7b7e('0xe2')]){var _0x50a68e=[];if(_0x46f331[_0x7b7e('0x54')]){_0x50a68e=_0x46f331['map'](function(_0x471524){return{'name':_0x471524['originalname'],'basename':_0x471524[_0x7b7e('0x61')],'type':_0x471524['mimetype'],'ChatOfflineMessageId':_0x5a9723['id']};});}var _0x4c63f5;if(!_['isNil'](_0x55b604[_0x7b7e('0xe3')])){var _0x423c16=_['map'](_0x5eae74[_0x7b7e('0x50')],function(_0x22d7a7){return _0x22d7a7;});var _0x12bd58=_[_0x7b7e('0xe4')](_0x423c16)[0x0];var _0x5e3718=_[_0x7b7e('0xe5')](_0x12bd58,function(_0x22153b){return _0x22153b;});_0x4c63f5=_0x5e3718[0x1][_0x55b604[_0x7b7e('0xe3')]];}var _0x59d4ef={'from':_0x283d97['email'],'firstName':_0x283d97['firstName'],'lastName':_0x283d97[_0x7b7e('0x9f')],'mapKey':'email','message':{'from':_0x283d97[_0x7b7e('0xe0')],'to':_0x55b604[_0x7b7e('0xc3')][_0x7b7e('0xe0')],'cc':'','subject':_[_0x7b7e('0x6f')](_0x4c63f5)?_0x55b604['offlineMessageSubject']:_0x4c63f5,'messageId':'','sentAt':new Date(),'attach':_0x50a68e['length'],'attachments':_0x50a68e,'originChannel':_0x7b7e('0xe6'),'ChatWebsiteId':_0x55b604['id'],'ChatOfflineMessageId':_0x4a193a['id'],'originTo':_0x55b604['MailAccount'][_0x7b7e('0xe0')]},'body':_0x4a193a['body']};var _0x1b2f83={'account':{'id':_0x55b604[_0x7b7e('0xe2')]},'body':_0x59d4ef,'log':_0x7b7e('0xe7')};return respondWithRpcPromise('NotifyMailAccount',_0x7b7e('0xe8'),_0x1b2f83,client9001)[_0x7b7e('0x24')](function(){return _0x4a193a;})[_0x7b7e('0x46')](function(_0x5d0a9e){console[_0x7b7e('0x17')](_0x5d0a9e);});}return;})['then'](function(){if(_0x4a193a){return _0x4a193a;}})[_0x7b7e('0x24')](respondWithResult(_0x4999af,null))['catch'](function(_0x4e4ab6){console[_0x7b7e('0x17')](_0x7b7e('0x46'),_0x4e4ab6);for(var _0x44c7e4 of _0x46f331){var _0x28e62f=path[_0x7b7e('0x69')](config['root'],_0x7b7e('0xe9'),'files',_0x7b7e('0xcd'),_0x7b7e('0xea'),_0x44c7e4[_0x7b7e('0x61')]);fs_extra[_0x7b7e('0xeb')](_0x28e62f)[_0x7b7e('0x46')](function(_0x22fe0f){console[_0x7b7e('0x17')](_0x7b7e('0xec'),_0x28e62f,_0x22fe0f);});}});};exports[_0x7b7e('0xed')]=function(_0x2f7540,_0x11901c){return db[_0x7b7e('0xac')][_0x7b7e('0x4a')]({'where':{'id':_0x2f7540[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x11901c,null))[_0x7b7e('0x24')](function(_0x18d515){if(_0x18d515){return _0x18d515[_0x7b7e('0xed')](_0x2f7540[_0x7b7e('0x50')][_0x7b7e('0x59')],_['omit'](_0x2f7540[_0x7b7e('0x50')],['ids','id'])||{});}})[_0x7b7e('0x24')](respondWithResult(_0x11901c,null))[_0x7b7e('0x46')](handleError(_0x11901c,null));};exports[_0x7b7e('0xee')]=function(_0x5d4968,_0x37ae1c){var _0x4bb4e5={'raw':![],'where':{}};var _0x1c7308={};var _0x57ea72={'count':0x0,'rows':[]};return db[_0x7b7e('0x30')]['findOne']({'where':{'id':_0x5d4968['params']['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x37ae1c,null))['then'](function(_0x215583){if(_0x215583){_0x1c7308[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db['ChatInteraction'][_0x7b7e('0x48')]);_0x1c7308[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x5d4968[_0x7b7e('0x35')]);_0x1c7308[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0x1c7308[_0x7b7e('0x34')],_0x1c7308[_0x7b7e('0x35')]);_0x4bb4e5['attributes']=_[_0x7b7e('0x37')](_0x1c7308['model'],qs[_0x7b7e('0x39')](_0x5d4968['query']['fields']));_0x4bb4e5['attributes']=_0x4bb4e5[_0x7b7e('0x38')][_0x7b7e('0x54')]?_0x4bb4e5[_0x7b7e('0x38')]:_0x1c7308[_0x7b7e('0x34')];if(!_0x5d4968[_0x7b7e('0x35')]['hasOwnProperty']('nolimit')){_0x4bb4e5[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x5d4968[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x4bb4e5[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x5d4968[_0x7b7e('0x35')]['offset']);}_0x4bb4e5['order']=qs[_0x7b7e('0x3c')](_0x5d4968[_0x7b7e('0x35')]['sort']);_0x4bb4e5[_0x7b7e('0x40')]=qs[_0x7b7e('0x3e')](_[_0x7b7e('0x3d')](_0x5d4968[_0x7b7e('0x35')],_0x1c7308[_0x7b7e('0x3e')]));_0x4bb4e5[_0x7b7e('0x40')]['ChatWebsiteId']=_0x215583['id'];if(_0x5d4968[_0x7b7e('0x35')]['filter']){_0x4bb4e5[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0x4bb4e5[_0x7b7e('0x40')],{'$or':_['map'](_0x4bb4e5[_0x7b7e('0x38')],function(_0x401dd6){var _0x3bbf22={};_0x3bbf22[_0x401dd6]={'$like':'%'+_0x5d4968[_0x7b7e('0x35')]['filter']+'%'};return _0x3bbf22;})});}_0x4bb4e5=_[_0x7b7e('0x41')]({},_0x4bb4e5,_0x5d4968[_0x7b7e('0x49')]);return db[_0x7b7e('0xac')][_0x7b7e('0x21')]({'where':_0x4bb4e5['where']})[_0x7b7e('0x24')](function(_0x2be57d){_0x57ea72[_0x7b7e('0x21')]=_0x2be57d;if(_0x5d4968[_0x7b7e('0x35')]['includeAll']){_0x4bb4e5[_0x7b7e('0x57')]=[{'model':db['CmContact'],'as':_0x7b7e('0xef'),'required':![]},{'model':db[_0x7b7e('0xb8')],'as':_0x7b7e('0xf0'),'attributes':['name','fullname',_0x7b7e('0xf1')],'required':![]},{'model':db[_0x7b7e('0xf2')],'as':_0x7b7e('0xf3'),'attributes':['id',_0x7b7e('0x2a'),_0x7b7e('0xf4')],'where':_0x5d4968[_0x7b7e('0x35')][_0x7b7e('0xf5')]?{'id':_0x5d4968[_0x7b7e('0x35')][_0x7b7e('0xf5')]}:undefined,'required':_0x5d4968[_0x7b7e('0x35')][_0x7b7e('0xf5')]?!![]:![]}];}return db[_0x7b7e('0xac')][_0x7b7e('0x44')](_0x4bb4e5);})[_0x7b7e('0x24')](function(_0x2eb712){_0x57ea72[_0x7b7e('0x45')]=_0x2eb712;return _0x57ea72;});}})['then'](respondWithFilteredResult(_0x37ae1c,_0x4bb4e5))[_0x7b7e('0x46')](handleError(_0x37ae1c,null));};function iftimePromise(_0x5a78d6,_0x27d9b7){return respondWithRpcPromise(_0x7b7e('0xf6'),_0x7b7e('0xf7'),{'command':_0x27d9b7[_0x7b7e('0xf8')]?util['format'](_0x7b7e('0xf9'),_0x5a78d6[_0x7b7e('0xfa')],_0x27d9b7[_0x7b7e('0xf8')]):util[_0x7b7e('0xa4')](_0x7b7e('0xfb'),_0x5a78d6[_0x7b7e('0xfa')])},client9002)[_0x7b7e('0x24')](function(_0x1f2174){var _0x1b60e7=_0x1f2174&&_0x1f2174[_0x7b7e('0xfc')](_0x7b7e('0xfd'))>=0x0?!![]:![];logger[_0x7b7e('0x12')](_0x7b7e('0xfe'),_0x27d9b7['id'],_0x5a78d6['id'],_0x5a78d6[_0x7b7e('0xfa')],_0x1b60e7?'ONLINE':_0x7b7e('0xff'),_0x27d9b7[_0x7b7e('0xf8')]?_0x27d9b7[_0x7b7e('0xf8')]:'No\x20timezone');return _0x1b60e7;})[_0x7b7e('0x46')](function(_0x322025){logger['error'](_0x7b7e('0xfe'),_0x27d9b7['id'],_0x5a78d6['id'],_0x5a78d6[_0x7b7e('0xfa')],util[_0x7b7e('0x100')](_0x322025,{'showHidden':![],'depth':null}),_0x27d9b7[_0x7b7e('0xf8')]?_0x27d9b7[_0x7b7e('0xf8')]:'No\x20timezone');return![];});}exports[_0x7b7e('0xf7')]=function(_0x33693d,_0xe12d13){var _0x19a9ec=0x0;var _0x1da40b=0x0;var _0x377613=![];var _0x3b4171;var _0x14757d;return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x33693d[_0x7b7e('0x47')]['id']},'include':[{'model':db[_0x7b7e('0x101')],'as':_0x7b7e('0x101'),'include':[{'model':db[_0x7b7e('0x101')],'as':_0x7b7e('0x102'),'attributes':['id',_0x7b7e('0xfa')],'raw':!![]}]}]})[_0x7b7e('0x24')](handleEntityNotFound(_0xe12d13,null))['then'](function(_0x528506){if(_0x528506){_0x3b4171=_0x528506;return _0x528506[_0x7b7e('0x103')]({'raw':!![]});}})[_0x7b7e('0x24')](function(_0x42d6aa){if(_0x3b4171){if(_0x42d6aa){_0x14757d=_0x42d6aa;}}return require(_0x7b7e('0x6c'))[_0x7b7e('0x6d')]();})[_0x7b7e('0x24')](function(_0x2a7845){if(_0x2a7845){_0x1da40b=_0x2a7845[_0x7b7e('0x104')];_0x377613=_0x2a7845[_0x7b7e('0x6e')];}})['then'](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})['then'](function(_0x204397){_0x19a9ec=_0x204397;if(_0x1da40b&&_0x204397>_0x1da40b){return db[_0x7b7e('0x105')][_0x7b7e('0x5d')]({'where':{'id':0x1}})[_0x7b7e('0x24')](function(_0x43a7fa){if(_0x43a7fa){_0x43a7fa['increment'](_0x7b7e('0x106'));}});}})[_0x7b7e('0x24')](function(){if(_0x3b4171['Interval']&&_0x3b4171[_0x7b7e('0x101')]['Intervals']){var _0x30a1a0=[];for(var _0x2d5595=0x0;_0x2d5595<_0x3b4171[_0x7b7e('0x101')]['Intervals'][_0x7b7e('0x54')];_0x2d5595++){var _0x5ac66a=_0x3b4171[_0x7b7e('0x101')][_0x7b7e('0x102')][_0x2d5595][_0x7b7e('0x25')]({'plain':!![]});_0x30a1a0[_0x7b7e('0xb2')](iftimePromise(_0x5ac66a,_0x3b4171));}return BPromise[_0x7b7e('0x107')](_0x30a1a0)[_0x7b7e('0x24')](function(_0x36755d){return _['some'](_0x36755d);});}else{return!![];}})[_0x7b7e('0x24')](function(_0x5273e5){var _0xeaeb7=fs[_0x7b7e('0xc6')](path[_0x7b7e('0x69')](config[_0x7b7e('0x6a')],_0x7b7e('0x108')),'utf8');var _0x3c9c06={'remote':_0x3b4171[_0x7b7e('0x109')],'query':querystring[_0x7b7e('0x16')](_['merge'](_0x3b4171[_0x7b7e('0x25')]({'plain':!![]}),{'customerIp':_0x33693d[_0x7b7e('0x7b')]['x-forwarded-for']||_0x33693d[_0x7b7e('0x7b')][_0x7b7e('0x10a')]||_0x33693d[_0x7b7e('0x10b')]['remoteAddress']||_0x33693d['ip'],'referer':_0x33693d[_0x7b7e('0x7b')][_0x7b7e('0xa1')],'openedInteractions':_0x19a9ec,'maxInteractions':_0x1da40b,'virtual':_0x377613[_0x7b7e('0x104')],'online':_0x5273e5,'custom':_0x377613}))[_0x7b7e('0x10c')](/'/g,'\x5c\x27')};_0xe12d13[_0x7b7e('0x2b')](ejs['render'](Mustache['render'](_0xeaeb7,_0x3c9c06),{'proactiveActions':_0x14757d,'alignment':_0x3b4171[_0x7b7e('0x10d')],'verticalAlignment':_0x3b4171[_0x7b7e('0x10e')],'div_color':_0x3b4171['color'],'labelText':_0x3b4171[_0x7b7e('0x10f')],'text_color':_0x3b4171[_0x7b7e('0x110')],'button_color':_0x3b4171[_0x7b7e('0x111')],'background_color':_0x3b4171[_0x7b7e('0x112')]}));})[_0x7b7e('0x46')](handleError(_0xe12d13,null));};exports['addApplications']=function(_0x24b8e0,_0x143e7b){var _0x472bbd=_0x24b8e0[_0x7b7e('0x47')]['id'];var _0x335f4b=_0x24b8e0[_0x7b7e('0x50')];var _0x22f1a4=0xc8;var _0x4f1e67=null;return db[_0x7b7e('0x113')]['transaction']({'isolationLevel':db[_0x7b7e('0x113')][_0x7b7e('0x114')][_0x7b7e('0x115')]['READ_COMMITTED']},function(_0x15f854){return db[_0x7b7e('0x30')][_0x7b7e('0x5d')]({'where':{'id':_0x472bbd},'transaction':_0x15f854})[_0x7b7e('0x24')](function(_0xe077b4){if(_0xe077b4){return db[_0x7b7e('0x90')]['destroy']({'where':{'ChatWebsiteId':_0x472bbd},'transaction':_0x15f854})[_0x7b7e('0x24')](function(){var _0xe3ef56=_['map'](_0x335f4b,function(_0x217a46){_0x217a46[_0x7b7e('0x56')]=_0x472bbd;return _0x217a46;});return db[_0x7b7e('0x90')][_0x7b7e('0xd2')](_0xe3ef56,{'transaction':_0x15f854});});}else{_0x22f1a4=0x194;_0x4f1e67=[];}});})[_0x7b7e('0x24')](function(){if(_0x22f1a4!==0x194){return db[_0x7b7e('0x90')][_0x7b7e('0x116')]({'where':{'ChatWebsiteId':_0x472bbd},'order':_0x7b7e('0x95')})['then'](function(_0x508c76){_0x4f1e67=_0x508c76;});}})['catch'](function(_0x2d271d){_0x22f1a4=0x1f4;logger['error'](_0x2d271d[_0x7b7e('0x29')]);if(_0x2d271d[_0x7b7e('0x2a')]){delete _0x2d271d[_0x7b7e('0x2a')];}_0x4f1e67=_0x2d271d;})[_0x7b7e('0x117')](function(){if(_0x4f1e67===null){_0x143e7b[_0x7b7e('0x1b')](_0x22f1a4);}else{if(_0x22f1a4===0x1f4){_0x143e7b[_0x7b7e('0x1c')](_0x22f1a4)['send'](_0x4f1e67);}else{_0x143e7b[_0x7b7e('0x1c')](_0x22f1a4)[_0x7b7e('0x1d')](_0x4f1e67);}}});};exports[_0x7b7e('0x118')]=function(_0x10aaf2,_0x25be32){var _0xc29f56={};var _0x3d9e71={};var _0x33673a;var _0x321eb6;return db['ChatWebsite']['findOne']({'where':{'id':_0x10aaf2[_0x7b7e('0x47')]['id']}})['then'](handleEntityNotFound(_0x25be32,null))['then'](function(_0x444bf4){if(_0x444bf4){_0x33673a=_0x444bf4;_0x3d9e71[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db[_0x7b7e('0x90')][_0x7b7e('0x48')]);_0x3d9e71[_0x7b7e('0x35')]=_['keys'](_0x10aaf2[_0x7b7e('0x35')]);_0x3d9e71[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0x3d9e71[_0x7b7e('0x34')],_0x3d9e71[_0x7b7e('0x35')]);_0xc29f56[_0x7b7e('0x38')]=_['intersection'](_0x3d9e71['model'],qs[_0x7b7e('0x39')](_0x10aaf2[_0x7b7e('0x35')][_0x7b7e('0x39')]));_0xc29f56[_0x7b7e('0x38')]=_0xc29f56['attributes']['length']?_0xc29f56[_0x7b7e('0x38')]:_0x3d9e71['model'];_0xc29f56['order']=qs['sort'](_0x10aaf2[_0x7b7e('0x35')][_0x7b7e('0x3c')]);_0xc29f56['where']=qs[_0x7b7e('0x3e')](_[_0x7b7e('0x3d')](_0x10aaf2[_0x7b7e('0x35')],_0x3d9e71[_0x7b7e('0x3e')]));if(_0x10aaf2[_0x7b7e('0x35')][_0x7b7e('0x3f')]){_0xc29f56[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0xc29f56[_0x7b7e('0x40')],{'$or':_['map'](_0xc29f56['attributes'],function(_0xc31bf){var _0x4794df={};_0x4794df[_0xc31bf]={'$like':'%'+_0x10aaf2[_0x7b7e('0x35')][_0x7b7e('0x3f')]+'%'};return _0x4794df;})});}_0xc29f56=_[_0x7b7e('0x41')]({},_0xc29f56,_0x10aaf2['options']);return _0x33673a[_0x7b7e('0x118')](_0xc29f56);}})[_0x7b7e('0x24')](function(_0x4c6547){if(_0x4c6547){_0x321eb6=_0x4c6547[_0x7b7e('0x54')];if(!_0x10aaf2[_0x7b7e('0x35')]['hasOwnProperty']('nolimit')){_0xc29f56['limit']=qs[_0x7b7e('0x20')](_0x10aaf2[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0xc29f56[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x10aaf2['query'][_0x7b7e('0x1e')]);}return _0x33673a[_0x7b7e('0x118')](_0xc29f56);}})[_0x7b7e('0x24')](function(_0x1f0878){if(_0x1f0878){return _0x1f0878?{'count':_0x321eb6,'rows':_0x1f0878}:null;}})['then'](respondWithResult(_0x25be32,null))[_0x7b7e('0x46')](handleError(_0x25be32,null));};exports[_0x7b7e('0x119')]=function(_0x4746bb,_0x6865f0){return db[_0x7b7e('0x11a')][_0x7b7e('0x4a')]({'where':{'id':_0x4746bb[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x6865f0,null))[_0x7b7e('0x24')](function(_0x3b0796){if(_0x3b0796){return _0x3b0796[_0x7b7e('0x119')](_0x4746bb[_0x7b7e('0x50')][_0x7b7e('0x59')],_[_0x7b7e('0x11b')](_0x4746bb[_0x7b7e('0x50')],[_0x7b7e('0x59'),'id'])||{});}})[_0x7b7e('0x24')](respondWithResult(_0x6865f0,null))[_0x7b7e('0x46')](handleError(_0x6865f0,null));};exports[_0x7b7e('0x103')]=function(_0x119050,_0xd4abb1){var _0x5a79a5={};var _0x246351={};var _0x12de27;var _0x554684;return db[_0x7b7e('0x30')][_0x7b7e('0x5d')]({'where':{'id':_0x119050[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0xd4abb1,null))[_0x7b7e('0x24')](function(_0x2784cb){if(_0x2784cb){_0x12de27=_0x2784cb;_0x246351['model']=_[_0x7b7e('0x36')](db['ChatProactiveAction'][_0x7b7e('0x48')]);_0x246351[_0x7b7e('0x35')]=_['keys'](_0x119050['query']);_0x246351[_0x7b7e('0x3e')]=_['intersection'](_0x246351['model'],_0x246351['query']);_0x5a79a5[_0x7b7e('0x38')]=_[_0x7b7e('0x37')](_0x246351[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x119050[_0x7b7e('0x35')][_0x7b7e('0x39')]));_0x5a79a5[_0x7b7e('0x38')]=_0x5a79a5[_0x7b7e('0x38')][_0x7b7e('0x54')]?_0x5a79a5[_0x7b7e('0x38')]:_0x246351[_0x7b7e('0x34')];_0x5a79a5[_0x7b7e('0x55')]=qs[_0x7b7e('0x3c')](_0x119050['query'][_0x7b7e('0x3c')]);_0x5a79a5[_0x7b7e('0x40')]=qs[_0x7b7e('0x3e')](_[_0x7b7e('0x3d')](_0x119050[_0x7b7e('0x35')],_0x246351[_0x7b7e('0x3e')]));if(_0x119050[_0x7b7e('0x35')][_0x7b7e('0x3f')]){_0x5a79a5[_0x7b7e('0x40')]=_[_0x7b7e('0x41')](_0x5a79a5[_0x7b7e('0x40')],{'$or':_[_0x7b7e('0x2f')](_0x5a79a5[_0x7b7e('0x38')],function(_0x56bb34){var _0x5510d1={};_0x5510d1[_0x56bb34]={'$like':'%'+_0x119050[_0x7b7e('0x35')]['filter']+'%'};return _0x5510d1;})});}_0x5a79a5=_[_0x7b7e('0x41')]({},_0x5a79a5,_0x119050[_0x7b7e('0x49')]);return _0x12de27['getProactiveActions'](_0x5a79a5);}})[_0x7b7e('0x24')](function(_0x297ef5){if(_0x297ef5){_0x554684=_0x297ef5[_0x7b7e('0x54')];if(!_0x119050[_0x7b7e('0x35')][_0x7b7e('0x3a')](_0x7b7e('0x3b'))){_0x5a79a5[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x119050[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x5a79a5['offset']=qs[_0x7b7e('0x1e')](_0x119050[_0x7b7e('0x35')][_0x7b7e('0x1e')]);}return _0x12de27[_0x7b7e('0x103')](_0x5a79a5);}})[_0x7b7e('0x24')](function(_0x5607c0){if(_0x5607c0){return _0x5607c0?{'count':_0x554684,'rows':_0x5607c0}:null;}})[_0x7b7e('0x24')](respondWithResult(_0xd4abb1,null))[_0x7b7e('0x46')](handleError(_0xd4abb1,null));};exports[_0x7b7e('0x11c')]=function(_0x1bb023,_0x28f668){var _0x58b728=_0x1bb023[_0x7b7e('0x35')][_0x7b7e('0x11d')]==='false'?'offlineForm':_0x7b7e('0x11e');return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'attributes':['id',_0x58b728],'where':{'id':_0x1bb023['params']['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x28f668,null))[_0x7b7e('0x24')](function(_0x5c61e3){if(_0x5c61e3){var _0x4772ad=_0x5c61e3[_0x58b728];var _0x3b6f4a=_0x4772ad&&_0x4772ad[_0x7b7e('0x11f')]?_0x4772ad[_0x7b7e('0x11f')]:[];_0x28f668[_0x7b7e('0x2b')]({'fromKey':_['isNil'](_0x4772ad[_0x7b7e('0x120')])?undefined:_0x4772ad[_0x7b7e('0x120')],'count':_0x3b6f4a[_0x7b7e('0x54')],'rows':_0x3b6f4a});}})[_0x7b7e('0x46')](handleError(_0x28f668,null));};exports['getOfflineMessages']=function(_0x16d369,_0x51a98f){var _0x21d4ca={'raw':![],'where':{}};var _0x3409ed={};var _0x2eb5a3={'count':0x0,'rows':[]};return db[_0x7b7e('0x30')][_0x7b7e('0x5d')]({'where':{'id':_0x16d369['params']['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x51a98f,null))[_0x7b7e('0x24')](function(_0x5793a9){if(_0x5793a9){_0x3409ed[_0x7b7e('0x34')]=_[_0x7b7e('0x36')](db[_0x7b7e('0x121')]['rawAttributes']);_0x3409ed[_0x7b7e('0x35')]=_[_0x7b7e('0x36')](_0x16d369['query']);_0x3409ed[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0x3409ed['model'],_0x3409ed[_0x7b7e('0x35')]);_0x21d4ca[_0x7b7e('0x38')]=_['intersection'](_0x3409ed[_0x7b7e('0x34')],qs[_0x7b7e('0x39')](_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x39')]));_0x21d4ca[_0x7b7e('0x38')]=_0x21d4ca[_0x7b7e('0x38')][_0x7b7e('0x54')]?_0x21d4ca[_0x7b7e('0x38')]:_0x3409ed[_0x7b7e('0x34')];if(!_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x3a')]('nolimit')){_0x21d4ca[_0x7b7e('0x20')]=qs['limit'](_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x21d4ca[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x1e')]);}_0x21d4ca['order']=qs[_0x7b7e('0x3c')](_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x3c')]);_0x21d4ca[_0x7b7e('0x40')]=qs[_0x7b7e('0x3e')](_['pick'](_0x16d369[_0x7b7e('0x35')],_0x3409ed['filters']));_0x21d4ca[_0x7b7e('0x40')]['ChatWebsiteId']=_0x5793a9['id'];if(_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x3f')]){_0x21d4ca[_0x7b7e('0x40')]=_['merge'](_0x21d4ca[_0x7b7e('0x40')],{'$or':_[_0x7b7e('0x2f')](_0x21d4ca[_0x7b7e('0x38')],function(_0x432292){var _0x13541e={};_0x13541e[_0x432292]={'$like':'%'+_0x16d369[_0x7b7e('0x35')][_0x7b7e('0x3f')]+'%'};return _0x13541e;})});}_0x21d4ca=_[_0x7b7e('0x41')]({},_0x21d4ca,_0x16d369['options']);return db[_0x7b7e('0x121')][_0x7b7e('0x21')]({'where':_0x21d4ca[_0x7b7e('0x40')]})[_0x7b7e('0x24')](function(_0x3b9377){_0x2eb5a3[_0x7b7e('0x21')]=_0x3b9377;if(_0x16d369['query']['includeAll']){_0x21d4ca[_0x7b7e('0x57')]=[{'all':!![]}];}else{_0x21d4ca[_0x7b7e('0x57')]=[{'model':db['CmContact'],'as':_0x7b7e('0xef'),'required':![]},{'model':db[_0x7b7e('0xd1')],'as':'Attachments','required':![]}];}return db[_0x7b7e('0x121')][_0x7b7e('0x44')](_0x21d4ca);})[_0x7b7e('0x24')](function(_0x58f17c){_0x2eb5a3[_0x7b7e('0x45')]=_0x58f17c;return _0x2eb5a3;});}})[_0x7b7e('0x24')](respondWithFilteredResult(_0x51a98f,_0x21d4ca))[_0x7b7e('0x46')](handleError(_0x51a98f,null));};exports[_0x7b7e('0x122')]=function(_0x1b4510,_0x5581d2){return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0x1b4510[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x5581d2,null))[_0x7b7e('0x24')](function(_0x1febae){if(_0x1febae){return _0x1febae[_0x7b7e('0x122')](_0x1b4510[_0x7b7e('0x50')]['ids'],_[_0x7b7e('0x11b')](_0x1b4510[_0x7b7e('0x50')],[_0x7b7e('0x59'),'id'])||{})[_0x7b7e('0xc5')](function(_0x386416){for(var _0x6297b1=0x0;_0x6297b1<_0x1b4510[_0x7b7e('0x50')][_0x7b7e('0x59')][_0x7b7e('0x54')];_0x6297b1+=0x1){socket[_0x7b7e('0x123')]('userChatWebsite:save',{'UserId':Number(_0x1b4510['body'][_0x7b7e('0x59')][_0x6297b1]),'ChatWebsiteId':Number(_0x1b4510[_0x7b7e('0x47')]['id'])});}return _0x386416;});}})[_0x7b7e('0x24')](respondWithResult(_0x5581d2,null))[_0x7b7e('0x46')](handleError(_0x5581d2,null));};exports[_0x7b7e('0x124')]=function(_0xd1688a,_0x43a6a5){return db[_0x7b7e('0x30')][_0x7b7e('0x4a')]({'where':{'id':_0xd1688a[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x43a6a5,null))[_0x7b7e('0x24')](function(_0x444b73){if(_0x444b73){return _0x444b73['removeAgents'](_0xd1688a[_0x7b7e('0x35')][_0x7b7e('0x59')])[_0x7b7e('0x24')](function(){if(_[_0x7b7e('0x125')](_0xd1688a['query'][_0x7b7e('0x59')])){for(var _0x2eef95=0x0;_0x2eef95<_0xd1688a['query']['ids'][_0x7b7e('0x54')];_0x2eef95+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0xd1688a[_0x7b7e('0x35')][_0x7b7e('0x59')][_0x2eef95]),'ChatWebsiteId':Number(_0xd1688a[_0x7b7e('0x47')]['id'])});}}else{socket[_0x7b7e('0x123')](_0x7b7e('0x126'),{'UserId':Number(_0xd1688a['query'][_0x7b7e('0x59')]),'ChatWebsiteId':Number(_0xd1688a[_0x7b7e('0x47')]['id'])});}});}})[_0x7b7e('0x24')](respondWithStatusCode(_0x43a6a5,null))[_0x7b7e('0x46')](handleError(_0x43a6a5,null));};exports[_0x7b7e('0x127')]=function(_0x3947ea,_0x58c9e7){var _0x439bda={};var _0x11526f={};var _0x37fd3e;var _0x6f772;return db[_0x7b7e('0x30')][_0x7b7e('0x5d')]({'where':{'id':_0x3947ea[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x58c9e7,null))[_0x7b7e('0x24')](function(_0x1c3415){if(_0x1c3415){_0x37fd3e=_0x1c3415;_0x11526f[_0x7b7e('0x34')]=_['keys'](db['User'][_0x7b7e('0x48')]);_0x11526f[_0x7b7e('0x35')]=_['keys'](_0x3947ea['query']);_0x11526f[_0x7b7e('0x3e')]=_[_0x7b7e('0x37')](_0x11526f[_0x7b7e('0x34')],_0x11526f[_0x7b7e('0x35')]);_0x439bda[_0x7b7e('0x38')]=_['intersection'](_0x11526f['model'],qs['fields'](_0x3947ea[_0x7b7e('0x35')][_0x7b7e('0x39')]));_0x439bda['attributes']=_0x439bda[_0x7b7e('0x38')]['length']?_0x439bda['attributes']:_0x11526f[_0x7b7e('0x34')];_0x439bda['order']=qs['sort'](_0x3947ea[_0x7b7e('0x35')][_0x7b7e('0x3c')]);_0x439bda[_0x7b7e('0x40')]=qs['filters'](_[_0x7b7e('0x3d')](_0x3947ea['query'],_0x11526f['filters']));if(_0x3947ea[_0x7b7e('0x35')]['filter']){_0x439bda[_0x7b7e('0x40')]=_['merge'](_0x439bda[_0x7b7e('0x40')],{'$or':_[_0x7b7e('0x2f')](_0x439bda[_0x7b7e('0x38')],function(_0x592624){var _0x1a0cd7={};_0x1a0cd7[_0x592624]={'$like':'%'+_0x3947ea[_0x7b7e('0x35')]['filter']+'%'};return _0x1a0cd7;})});}_0x439bda=_[_0x7b7e('0x41')]({},_0x439bda,_0x3947ea[_0x7b7e('0x49')]);return _0x37fd3e[_0x7b7e('0x127')](_0x439bda);}})['then'](function(_0x2b4c67){if(_0x2b4c67){_0x6f772=_0x2b4c67['length'];if(!_0x3947ea['query']['hasOwnProperty'](_0x7b7e('0x3b'))){_0x439bda[_0x7b7e('0x20')]=qs[_0x7b7e('0x20')](_0x3947ea[_0x7b7e('0x35')][_0x7b7e('0x20')]);_0x439bda[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x3947ea[_0x7b7e('0x35')][_0x7b7e('0x1e')]);}return _0x37fd3e[_0x7b7e('0x127')](_0x439bda);}})[_0x7b7e('0x24')](function(_0x2ee403){if(_0x2ee403){return _0x2ee403?{'count':_0x6f772,'rows':_0x2ee403}:null;}})['then'](respondWithResult(_0x58c9e7,null))[_0x7b7e('0x46')](handleError(_0x58c9e7,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 83ac0a0..b6f49ba 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 _0x0bde=['hook','exports','events','ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x15bde9,_0x2c44e9){var _0xd0c734=function(_0x428b93){while(--_0x428b93){_0x15bde9['push'](_0x15bde9['shift']());}};_0xd0c734(++_0x2c44e9);}(_0x0bde,0x110));var _0xe0bd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0bde[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xe0bd('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xe0bd('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe0bd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe0bd('0x3'),'afterDestroy':_0xe0bd('0x4')};function emitEvent(_0x2294a7){return function(_0x595deb,_0x95dfde,_0x28c970){ChatWebsiteEvents[_0xe0bd('0x5')](_0x2294a7+':'+_0x595deb['id'],_0x595deb);ChatWebsiteEvents[_0xe0bd('0x5')](_0x2294a7,_0x595deb);_0x28c970(null);};}for(var e in events){if(events[_0xe0bd('0x6')](e)){var event=events[e];ChatWebsite[_0xe0bd('0x7')](e,emitEvent(event));}}module[_0xe0bd('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x59c3=['update','emit','hook','events','../../mysqldb','ChatWebsite','setMaxListeners','save'];(function(_0x3a86e4,_0x100abd){var _0x1de922=function(_0x4f9c04){while(--_0x4f9c04){_0x3a86e4['push'](_0x3a86e4['shift']());}};_0x1de922(++_0x100abd);}(_0x59c3,0x133));var _0x359c=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x59c3[_0x2cf2e9];return _0xd3670d;};'use strict';var EventEmitter=require(_0x359c('0x0'));var ChatWebsite=require(_0x359c('0x1'))['db'][_0x359c('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x359c('0x3')](0x0);var events={'afterCreate':_0x359c('0x4'),'afterUpdate':_0x359c('0x5'),'afterDestroy':'remove'};function emitEvent(_0xa40711){return function(_0x225098,_0x61333a,_0x9497b6){ChatWebsiteEvents[_0x359c('0x6')](_0xa40711+':'+_0x225098['id'],_0x225098);ChatWebsiteEvents[_0x359c('0x6')](_0xa40711,_0x225098);_0x9497b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x359c('0x7')](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 ec1689d..b6d91cc 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 _0x890f=['bluebird','request-promise','path','rimraf','./chatWebsite.attributes','exports','define','chat_websites','util','api'];(function(_0x463db8,_0xb21f22){var _0x220560=function(_0x3b9c50){while(--_0x3b9c50){_0x463db8['push'](_0x463db8['shift']());}};_0x220560(++_0xb21f22);}(_0x890f,0x170));var _0xf890=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x890f[_0x256d6a];return _0x460058;};'use strict';var _=require('lodash');var util=require(_0xf890('0x0'));var logger=require('../../config/logger')(_0xf890('0x1'));var moment=require('moment');var BPromise=require(_0xf890('0x2'));var rp=require(_0xf890('0x3'));var fs=require('fs');var path=require(_0xf890('0x4'));var rimraf=require(_0xf890('0x5'));var config=require('../../config/environment');var attributes=require(_0xf890('0x6'));module[_0xf890('0x7')]=function(_0x320b3a,_0x37781d){return _0x320b3a[_0xf890('0x8')]('ChatWebsite',attributes,{'tableName':_0xf890('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9cb=['rimraf','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','lodash','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9cb,0x128));var _0xbe9c=function(_0x21e418,_0xcedbf5){_0x21e418=_0x21e418-0x0;var _0x3e5bc7=_0xe9cb[_0x21e418];return _0x3e5bc7;};'use strict';var _=require(_0xbe9c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbe9c('0x1'));var moment=require('moment');var BPromise=require(_0xbe9c('0x2'));var rp=require(_0xbe9c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe9c('0x4'));var config=require(_0xbe9c('0x5'));var attributes=require(_0xbe9c('0x6'));module[_0xbe9c('0x7')]=function(_0x5f15e3,_0x7cd420){return _0x5f15e3[_0xbe9c('0x8')]('ChatWebsite',attributes,{'tableName':_0xbe9c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index fa8d388..60ebd32 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 _0xe806=['redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xe806,0x13c));var _0x6e80=function(_0x552a2d,_0x392e78){_0x552a2d=_0x552a2d-0x0;var _0x1a65b1=_0xe806[_0x552a2d];return _0x1a65b1;};'use strict';var _=require(_0x6e80('0x0'));var util=require(_0x6e80('0x1'));var moment=require('moment');var BPromise=require(_0x6e80('0x2'));var rs=require(_0x6e80('0x3'));var fs=require('fs');var Redis=require(_0x6e80('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6e80('0x5'));var config=require(_0x6e80('0x6'));var jayson=require(_0x6e80('0x7'));var client=jayson['client'][_0x6e80('0x8')]({'port':0x232a});config[_0x6e80('0x9')]=_['defaults'](config['redis'],{'host':_0x6e80('0xa'),'port':0x18eb});var socket=require(_0x6e80('0xb'))(new Redis(config[_0x6e80('0x9')]));require(_0x6e80('0xc'))[_0x6e80('0xd')](socket);function respondWithRpcPromise(_0xc5dd87,_0x2fbf99,_0xbbc3ed){return new BPromise(function(_0x5c0ec2,_0x36597c){return client[_0x6e80('0xe')](_0xc5dd87,_0xbbc3ed)['then'](function(_0x20198e){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x2fbf99,_0x6e80('0xf'));logger['debug'](_0x6e80('0x10'),_0x2fbf99,_0x6e80('0xf'),JSON[_0x6e80('0x11')](_0x20198e));if(_0x20198e[_0x6e80('0x12')]){if(_0x20198e[_0x6e80('0x12')][_0x6e80('0x13')]===0x1f4){logger[_0x6e80('0x12')](_0x6e80('0x14'),_0x2fbf99,_0x20198e[_0x6e80('0x12')]['message']);return _0x36597c(_0x20198e['error'][_0x6e80('0x15')]);}logger[_0x6e80('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x2fbf99,_0x20198e['error']['message']);return _0x5c0ec2(_0x20198e[_0x6e80('0x12')][_0x6e80('0x15')]);}else{logger[_0x6e80('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x2fbf99,_0x6e80('0xf'));_0x5c0ec2(_0x20198e[_0x6e80('0x17')][_0x6e80('0x15')]);}})[_0x6e80('0x18')](function(_0x432479){logger[_0x6e80('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x2fbf99,_0x432479);_0x36597c(_0x432479);});});} \ No newline at end of file +var _0x9f8d=['localhost','socket.io-emitter','redis','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x5312e3,_0x21fdb4){var _0x4181dc=function(_0x50ef05){while(--_0x50ef05){_0x5312e3['push'](_0x5312e3['shift']());}};_0x4181dc(++_0x21fdb4);}(_0x9f8d,0xc5));var _0xd9f8=function(_0x336c5b,_0x4abbce){_0x336c5b=_0x336c5b-0x0;var _0x11edfd=_0x9f8d[_0x336c5b];return _0x11edfd;};'use strict';var _=require(_0xd9f8('0x0'));var util=require(_0xd9f8('0x1'));var moment=require(_0xd9f8('0x2'));var BPromise=require(_0xd9f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd9f8('0x4'));var logger=require('../../config/logger')(_0xd9f8('0x5'));var config=require(_0xd9f8('0x6'));var jayson=require(_0xd9f8('0x7'));var client=jayson[_0xd9f8('0x8')][_0xd9f8('0x9')]({'port':0x232a});config['redis']=_[_0xd9f8('0xa')](config['redis'],{'host':_0xd9f8('0xb'),'port':0x18eb});var socket=require(_0xd9f8('0xc'))(new Redis(config[_0xd9f8('0xd')]));require('./chatWebsite.socket')[_0xd9f8('0xe')](socket);function respondWithRpcPromise(_0x8e5998,_0x9f8fa9,_0x5f0d51){return new BPromise(function(_0x4fd502,_0x8d25a0){return client[_0xd9f8('0xf')](_0x8e5998,_0x5f0d51)[_0xd9f8('0x10')](function(_0x4c1304){logger[_0xd9f8('0x11')](_0xd9f8('0x12'),_0x9f8fa9,'request\x20sent');logger[_0xd9f8('0x13')](_0xd9f8('0x14'),_0x9f8fa9,_0xd9f8('0x15'),JSON[_0xd9f8('0x16')](_0x4c1304));if(_0x4c1304['error']){if(_0x4c1304['error'][_0xd9f8('0x17')]===0x1f4){logger[_0xd9f8('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x9f8fa9,_0x4c1304[_0xd9f8('0x18')][_0xd9f8('0x19')]);return _0x8d25a0(_0x4c1304[_0xd9f8('0x18')][_0xd9f8('0x19')]);}logger[_0xd9f8('0x18')](_0xd9f8('0x12'),_0x9f8fa9,_0x4c1304[_0xd9f8('0x18')]['message']);return _0x4fd502(_0x4c1304[_0xd9f8('0x18')][_0xd9f8('0x19')]);}else{logger[_0xd9f8('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x9f8fa9,_0xd9f8('0x15'));_0x4fd502(_0x4c1304['result'][_0xd9f8('0x19')]);}})['catch'](function(_0x49907a){logger[_0xd9f8('0x18')](_0xd9f8('0x12'),_0x9f8fa9,_0x49907a);_0x8d25a0(_0x49907a);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 047e906..722e19f 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 _0x81b6=['./chatWebsite.events','update','emit','register'];(function(_0xd405fb,_0xaaa0bd){var _0x211e1d=function(_0x360d91){while(--_0x360d91){_0xd405fb['push'](_0xd405fb['shift']());}};_0x211e1d(++_0xaaa0bd);}(_0x81b6,0x110));var _0x681b=function(_0x31b558,_0x1779da){_0x31b558=_0x31b558-0x0;var _0x174881=_0x81b6[_0x31b558];return _0x174881;};'use strict';var ChatWebsiteEvents=require(_0x681b('0x0'));var events=['save','remove',_0x681b('0x1')];function createListener(_0x215720,_0x4891f0){return function(_0x31d68c){_0x4891f0[_0x681b('0x2')](_0x215720,_0x31d68c);};}function removeListener(_0x471ba1,_0x58a504){return function(){ChatWebsiteEvents['removeListener'](_0x471ba1,_0x58a504);};}exports[_0x681b('0x3')]=function(_0x54c4e0){for(var _0x5af69c=0x0,_0x2bc2fe=events['length'];_0x5af69c<_0x2bc2fe;_0x5af69c++){var _0x57ff79=events[_0x5af69c];var _0x7d8288=createListener('chatWebsite:'+_0x57ff79,_0x54c4e0);ChatWebsiteEvents['on'](_0x57ff79,_0x7d8288);}}; \ No newline at end of file +var _0x24ff=['emit','register','chatWebsite:','save','update'];(function(_0x221d95,_0x2d57ad){var _0x1b06fd=function(_0xe30941){while(--_0xe30941){_0x221d95['push'](_0x221d95['shift']());}};_0x1b06fd(++_0x2d57ad);}(_0x24ff,0xa3));var _0xf24f=function(_0x135bad,_0x3bc595){_0x135bad=_0x135bad-0x0;var _0x4c7793=_0x24ff[_0x135bad];return _0x4c7793;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xf24f('0x0'),'remove',_0xf24f('0x1')];function createListener(_0x1dea46,_0x9d037e){return function(_0x43aed3){_0x9d037e[_0xf24f('0x2')](_0x1dea46,_0x43aed3);};}function removeListener(_0xd3d57b,_0x158c56){return function(){ChatWebsiteEvents['removeListener'](_0xd3d57b,_0x158c56);};}exports[_0xf24f('0x3')]=function(_0x3fad6b){for(var _0x36a8c2=0x0,_0x2ee617=events['length'];_0x36a8c2<_0x2ee617;_0x36a8c2++){var _0x477b57=events[_0x36a8c2];var _0x4964e7=createListener(_0xf24f('0x4')+_0x477b57,_0x3fad6b);ChatWebsiteEvents['on'](_0x477b57,_0x4964e7);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 16bf430..cadeff7 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 _0xa9a0=['attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','/:id/users','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/snippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','format','now','originalname','/:id/logo','single','file','addLogo','server/files/images/avatars/','%s-%s','/:id/avatar','addAvatar','addSystemAvatar','/:id/notify','server/files'];(function(_0x2b0074,_0x42d50b){var _0x25b012=function(_0x53d3b9){while(--_0x53d3b9){_0x2b0074['push'](_0x2b0074['shift']());}};_0x25b012(++_0x42d50b);}(_0xa9a0,0x139));var _0x0a9a=function(_0x3486e9,_0xbcce8f){_0x3486e9=_0x3486e9-0x0;var _0x2f337f=_0xa9a0[_0x3486e9];return _0x2f337f;};'use strict';var multer=require('multer');var util=require(_0x0a9a('0x0'));var path=require(_0x0a9a('0x1'));var timeout=require('connect-timeout');var express=require(_0x0a9a('0x2'));var router=express['Router']();var fs_extra=require(_0x0a9a('0x3'));var auth=require(_0x0a9a('0x4'));var interaction=require(_0x0a9a('0x5'));var config=require(_0x0a9a('0x6'));var controller=require(_0x0a9a('0x7'));router[_0x0a9a('0x8')]('/',auth[_0x0a9a('0x9')](),controller[_0x0a9a('0xa')]);router['get']('/describe',auth[_0x0a9a('0x9')](),controller[_0x0a9a('0xb')]);router['get'](_0x0a9a('0xc'),auth[_0x0a9a('0x9')](),controller[_0x0a9a('0xd')]);router[_0x0a9a('0x8')](_0x0a9a('0xe'),auth['isAuthenticated'](),controller[_0x0a9a('0xf')]);router['get'](_0x0a9a('0x10'),auth[_0x0a9a('0x9')](),controller['getAnswers']);router['get']('/:id/logo',controller[_0x0a9a('0x11')]);router[_0x0a9a('0x8')]('/:id/avatar',controller['getAvatar']);router[_0x0a9a('0x8')](_0x0a9a('0x12'),controller[_0x0a9a('0x13')]);router[_0x0a9a('0x8')](_0x0a9a('0x14'),controller[_0x0a9a('0x15')]);router[_0x0a9a('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0x0a9a('0x8')](_0x0a9a('0x16'),controller['getSnippet']);router['get']('/:id/applications',auth[_0x0a9a('0x9')](),controller[_0x0a9a('0x17')]);router['get'](_0x0a9a('0x18'),auth[_0x0a9a('0x9')](),controller[_0x0a9a('0x19')]);router['get'](_0x0a9a('0x1a'),controller[_0x0a9a('0x1b')]);router['get'](_0x0a9a('0x1c'),auth[_0x0a9a('0x9')](),controller[_0x0a9a('0x1d')]);router['get']('/:id/users',auth[_0x0a9a('0x9')](),controller[_0x0a9a('0x1e')]);router[_0x0a9a('0x1f')]('/',auth[_0x0a9a('0x9')](),controller[_0x0a9a('0x20')]);router[_0x0a9a('0x1f')](_0x0a9a('0xe'),auth['isAuthenticated'](),controller[_0x0a9a('0x21')]);router[_0x0a9a('0x1f')]('/:id/canned_answers',auth[_0x0a9a('0x9')](),controller[_0x0a9a('0x22')]);var upload=multer({'storage':multer[_0x0a9a('0x23')]({'destination':function(_0x2086e8,_0x574caa,_0x467285){_0x467285(null,path[_0x0a9a('0x24')](config[_0x0a9a('0x25')],'server/files/images/logos/'));},'filename':function(_0x45f004,_0xd02af1,_0x36ba1e){_0x36ba1e(null,util[_0x0a9a('0x26')]('%s-%s',Date[_0x0a9a('0x27')](),_0xd02af1[_0x0a9a('0x28')]));}})});router[_0x0a9a('0x1f')](_0x0a9a('0x29'),upload[_0x0a9a('0x2a')](_0x0a9a('0x2b')),controller[_0x0a9a('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x498b97,_0x52ad4d,_0x4789bc){_0x4789bc(null,path[_0x0a9a('0x24')](config['root'],_0x0a9a('0x2d')));},'filename':function(_0x35bb98,_0x2c260a,_0x562380){_0x562380(null,util['format'](_0x0a9a('0x2e'),Date[_0x0a9a('0x27')](),_0x2c260a['originalname']));}})});router[_0x0a9a('0x1f')](_0x0a9a('0x2f'),upload[_0x0a9a('0x2a')]('file'),controller[_0x0a9a('0x30')]);var upload=multer({'storage':multer[_0x0a9a('0x23')]({'destination':function(_0x2de4f8,_0x2ef105,_0x536dc3){_0x536dc3(null,path[_0x0a9a('0x24')](config[_0x0a9a('0x25')],_0x0a9a('0x2d')));},'filename':function(_0x1b4041,_0x3a752a,_0x47907a){_0x47907a(null,util['format'](_0x0a9a('0x2e'),Date['now'](),_0x3a752a['originalname']));}})});router[_0x0a9a('0x1f')](_0x0a9a('0x12'),upload[_0x0a9a('0x2a')](_0x0a9a('0x2b')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4cc4a6,_0x1bf060,_0x51e0fc){_0x51e0fc(null,path[_0x0a9a('0x24')](config[_0x0a9a('0x25')],_0x0a9a('0x2d')));},'filename':function(_0x2ba87b,_0x5d65e7,_0x2168ae){_0x2168ae(null,util['format'](_0x0a9a('0x2e'),Date[_0x0a9a('0x27')](),_0x5d65e7[_0x0a9a('0x28')]));}})});router[_0x0a9a('0x1f')](_0x0a9a('0x14'),upload['single'](_0x0a9a('0x2b')),controller[_0x0a9a('0x31')]);router['post'](_0x0a9a('0x32'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x0a9a('0x23')]({'destination':function(_0x285bbb,_0x4c5f71,_0x5cba29){const _0x14d2ea=path[_0x0a9a('0x24')](config[_0x0a9a('0x25')],_0x0a9a('0x33'),_0x0a9a('0x34'),_0x0a9a('0x35'));fs_extra[_0x0a9a('0x36')](_0x14d2ea,function(){_0x5cba29(null,_0x14d2ea);});},'filename':function(_0x27898b,_0x1316a1,_0x73a616){const _0x5357d0=_0x1316a1['originalname'][_0x0a9a('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x49328b=path[_0x0a9a('0x38')](_0x5357d0);const _0x13dd87=Date['now']()+'-'+_0x5357d0[_0x0a9a('0x37')](_0x49328b,'')+_0x49328b;_0x73a616(null,_0x13dd87);}})});router[_0x0a9a('0x1f')](_0x0a9a('0x39'),offlineUploadMulter[_0x0a9a('0x3a')](),controller[_0x0a9a('0x3b')]);router[_0x0a9a('0x1f')](_0x0a9a('0x3c'),auth[_0x0a9a('0x9')](),controller[_0x0a9a('0x3d')]);router[_0x0a9a('0x1f')]('/:id/applications',auth[_0x0a9a('0x9')](),controller[_0x0a9a('0x3e')]);router[_0x0a9a('0x1f')](_0x0a9a('0x18'),auth['isAuthenticated'](),controller[_0x0a9a('0x3f')]);router[_0x0a9a('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x0a9a('0x40')]);router[_0x0a9a('0x41')](_0x0a9a('0xc'),auth['isAuthenticated'](),controller[_0x0a9a('0x42')]);router[_0x0a9a('0x43')](_0x0a9a('0xc'),auth['isAuthenticated'](),controller[_0x0a9a('0x44')]);router[_0x0a9a('0x43')]('/:id/dispositions',auth[_0x0a9a('0x9')](),controller[_0x0a9a('0x45')]);router[_0x0a9a('0x43')]('/:id/canned_answers',auth[_0x0a9a('0x9')](),controller[_0x0a9a('0x46')]);router[_0x0a9a('0x43')](_0x0a9a('0x47'),auth[_0x0a9a('0x9')](),controller['removeAgents']);module[_0x0a9a('0x48')]=router; \ No newline at end of file +var _0xd505=['getApplications','/:id/proactive_actions','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','file','addLogo','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addApplications','addProactiveActions','delete','removeAnswers','removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet'];(function(_0x1cf333,_0x12b78e){var _0x25734b=function(_0x55787d){while(--_0x55787d){_0x1cf333['push'](_0x1cf333['shift']());}};_0x25734b(++_0x12b78e);}(_0xd505,0x128));var _0x5d50=function(_0x4d509b,_0x4cb65f){_0x4d509b=_0x4d509b-0x0;var _0x17f2f6=_0xd505[_0x4d509b];return _0x17f2f6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5d50('0x0'));var timeout=require(_0x5d50('0x1'));var express=require(_0x5d50('0x2'));var router=express[_0x5d50('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5d50('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5d50('0x5'));var controller=require(_0x5d50('0x6'));router[_0x5d50('0x7')]('/',auth[_0x5d50('0x8')](),controller[_0x5d50('0x9')]);router[_0x5d50('0x7')](_0x5d50('0xa'),auth[_0x5d50('0x8')](),controller['describe']);router['get'](_0x5d50('0xb'),auth[_0x5d50('0x8')](),controller[_0x5d50('0xc')]);router[_0x5d50('0x7')](_0x5d50('0xd'),auth[_0x5d50('0x8')](),controller[_0x5d50('0xe')]);router[_0x5d50('0x7')](_0x5d50('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x5d50('0x7')]('/:id/logo',controller[_0x5d50('0x10')]);router['get'](_0x5d50('0x11'),controller['getAvatar']);router['get'](_0x5d50('0x12'),controller['getCustomerAvatar']);router['get'](_0x5d50('0x13'),controller[_0x5d50('0x14')]);router['get'](_0x5d50('0x15'),auth[_0x5d50('0x8')](),controller[_0x5d50('0x16')]);router[_0x5d50('0x7')]('/:id/snippet',controller[_0x5d50('0x17')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0x5d50('0x18')]);router['get'](_0x5d50('0x19'),auth['isAuthenticated'](),controller['getProactiveActions']);router[_0x5d50('0x7')]('/:id/fields',controller['getFields']);router[_0x5d50('0x7')](_0x5d50('0x1a'),auth[_0x5d50('0x8')](),controller[_0x5d50('0x1b')]);router[_0x5d50('0x7')](_0x5d50('0x1c'),auth[_0x5d50('0x8')](),controller[_0x5d50('0x1d')]);router[_0x5d50('0x1e')]('/',auth[_0x5d50('0x8')](),controller[_0x5d50('0x1f')]);router[_0x5d50('0x1e')](_0x5d50('0xd'),auth[_0x5d50('0x8')](),controller['addDisposition']);router[_0x5d50('0x1e')]('/:id/canned_answers',auth[_0x5d50('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x5d50('0x20')]({'destination':function(_0x1b370e,_0x25488e,_0x3ea0e1){_0x3ea0e1(null,path[_0x5d50('0x21')](config[_0x5d50('0x22')],_0x5d50('0x23')));},'filename':function(_0x2afad1,_0xe47d82,_0x1e6db9){_0x1e6db9(null,util[_0x5d50('0x24')](_0x5d50('0x25'),Date[_0x5d50('0x26')](),_0xe47d82[_0x5d50('0x27')]));}})});router[_0x5d50('0x1e')](_0x5d50('0x28'),upload[_0x5d50('0x29')](_0x5d50('0x2a')),controller[_0x5d50('0x2b')]);var upload=multer({'storage':multer[_0x5d50('0x20')]({'destination':function(_0x26c6dd,_0xc6fc50,_0x2a02da){_0x2a02da(null,path[_0x5d50('0x21')](config[_0x5d50('0x22')],_0x5d50('0x2c')));},'filename':function(_0x52cf42,_0x3d5ca5,_0x7fe96d){_0x7fe96d(null,util[_0x5d50('0x24')](_0x5d50('0x25'),Date['now'](),_0x3d5ca5[_0x5d50('0x27')]));}})});router[_0x5d50('0x1e')](_0x5d50('0x11'),upload['single'](_0x5d50('0x2a')),controller['addAvatar']);var upload=multer({'storage':multer[_0x5d50('0x20')]({'destination':function(_0x170b72,_0x33a57a,_0x58ff98){_0x58ff98(null,path[_0x5d50('0x21')](config[_0x5d50('0x22')],_0x5d50('0x2c')));},'filename':function(_0x236461,_0x283b28,_0x15c64){_0x15c64(null,util['format'](_0x5d50('0x25'),Date[_0x5d50('0x26')](),_0x283b28[_0x5d50('0x27')]));}})});router[_0x5d50('0x1e')](_0x5d50('0x12'),upload[_0x5d50('0x29')](_0x5d50('0x2a')),controller[_0x5d50('0x2d')]);var upload=multer({'storage':multer[_0x5d50('0x20')]({'destination':function(_0x5e88f5,_0x380ecd,_0x3f6528){_0x3f6528(null,path[_0x5d50('0x21')](config[_0x5d50('0x22')],_0x5d50('0x2c')));},'filename':function(_0x437c9b,_0x34100b,_0x247e84){_0x247e84(null,util['format'](_0x5d50('0x25'),Date[_0x5d50('0x26')](),_0x34100b[_0x5d50('0x27')]));}})});router[_0x5d50('0x1e')](_0x5d50('0x13'),upload[_0x5d50('0x29')]('file'),controller[_0x5d50('0x2e')]);router[_0x5d50('0x1e')](_0x5d50('0x2f'),controller[_0x5d50('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0x5d50('0x20')]({'destination':function(_0x4431d5,_0x5e9f8c,_0x20b676){const _0x4cc28c=path['join'](config[_0x5d50('0x22')],_0x5d50('0x31'),_0x5d50('0x32'),_0x5d50('0x33'));fs_extra[_0x5d50('0x34')](_0x4cc28c,function(){_0x20b676(null,_0x4cc28c);});},'filename':function(_0x4c3485,_0x5a8ec6,_0x596c75){const _0x97f8d6=_0x5a8ec6[_0x5d50('0x27')][_0x5d50('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4cee65=path[_0x5d50('0x36')](_0x97f8d6);const _0x428b49=Date[_0x5d50('0x26')]()+'-'+_0x97f8d6[_0x5d50('0x35')](_0x4cee65,'')+_0x4cee65;_0x596c75(null,_0x428b49);}})});router[_0x5d50('0x1e')](_0x5d50('0x37'),offlineUploadMulter[_0x5d50('0x38')](),controller[_0x5d50('0x39')]);router[_0x5d50('0x1e')]('/:id/interactions',auth['isAuthenticated'](),controller['addInteraction']);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x5d50('0x3a')]);router[_0x5d50('0x1e')]('/:id/proactive_actions',auth[_0x5d50('0x8')](),controller[_0x5d50('0x3b')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0x5d50('0x8')](),controller['update']);router[_0x5d50('0x3c')](_0x5d50('0xb'),auth[_0x5d50('0x8')](),controller['destroy']);router[_0x5d50('0x3c')](_0x5d50('0xd'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x5d50('0x3c')](_0x5d50('0xf'),auth[_0x5d50('0x8')](),controller[_0x5d50('0x3d')]);router[_0x5d50('0x3c')](_0x5d50('0x1c'),auth[_0x5d50('0x8')](),controller[_0x5d50('0x3e')]);module[_0x5d50('0x3f')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 7871a47..0cd7181 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 _0x7c3d=['Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','express','../config/environment'];(function(_0x460666,_0x24bfa0){var _0x555cbf=function(_0x3b4743){while(--_0x3b4743){_0x460666['push'](_0x460666['shift']());}};_0x555cbf(++_0x24bfa0);}(_0x7c3d,0x12a));var _0xd7c3=function(_0x5820df,_0x24240a){_0x5820df=_0x5820df-0x0;var _0x7a47f1=_0x7c3d[_0x5820df];return _0x7a47f1;};var beaverLogger=require('beaver-logger/server');var express=require(_0xd7c3('0x0'));var auth=require('../components/auth/service');var config=require(_0xd7c3('0x1'));var router=express[_0xd7c3('0x2')]();var isProduction=config[_0xd7c3('0x3')]===_0xd7c3('0x4')||![];function clientSideLogs(_0x2a27ab,_0xdd41b2,_0x468b1b){var _0x5ac2e5=_0x2a27ab[_0xd7c3('0x5')][_0xd7c3('0x6')](_0xd7c3('0x7'));if(!_0x5ac2e5){throw new Error(_0xd7c3('0x8'));}return beaverLogger[_0xd7c3('0x9')]({'uri':'/client-logs','logger':_0x5ac2e5,'enableCors':!isProduction})(_0x2a27ab,_0xdd41b2,_0x468b1b);}router[_0xd7c3('0xa')](auth[_0xd7c3('0xb')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0x9df9=['app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','exports','express','../components/auth/service','../config/environment','Router','production'];(function(_0x26d868,_0x22fa0b){var _0x3c9a1f=function(_0x56c215){while(--_0x56c215){_0x26d868['push'](_0x26d868['shift']());}};_0x3c9a1f(++_0x22fa0b);}(_0x9df9,0xb1));var _0x99df=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9df9[_0x4b055c];return _0x4b62bb;};var beaverLogger=require('beaver-logger/server');var express=require(_0x99df('0x0'));var auth=require(_0x99df('0x1'));var config=require(_0x99df('0x2'));var router=express[_0x99df('0x3')]();var isProduction=config['env']===_0x99df('0x4')||![];function clientSideLogs(_0x4f1f13,_0xa59f36,_0x2ed11f){var _0x2d8af2=_0x4f1f13[_0x99df('0x5')][_0x99df('0x6')](_0x99df('0x7'));if(!_0x2d8af2){throw new Error(_0x99df('0x8'));}return beaverLogger[_0x99df('0x9')]({'uri':_0x99df('0xa'),'logger':_0x2d8af2,'enableCors':!isProduction})(_0x4f1f13,_0xa59f36,_0x2ed11f);}router[_0x99df('0xb')](auth['isAuthenticated'](),clientSideLogs);module[_0x99df('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index bc16d01..7342851 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 _0xca6e=['ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','STRING'];(function(_0x5273fa,_0x2170f8){var _0x1f4e16=function(_0xbeb79c){while(--_0xbeb79c){_0x5273fa['push'](_0x5273fa['shift']());}};_0x1f4e16(++_0x2170f8);}(_0xca6e,0xde));var _0xeca6=function(_0x4cf4f9,_0x16d4fd){_0x4cf4f9=_0x4cf4f9-0x0;var _0x119a76=_0xca6e[_0x4cf4f9];return _0x119a76;};'use strict';var Sequelize=require(_0xeca6('0x0'));module[_0xeca6('0x1')]={'name':{'type':Sequelize[_0xeca6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xeca6('0x3')](_0xeca6('0x4'),_0xeca6('0x5'),_0xeca6('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xeca6('0x3')](_0xeca6('0x7'),_0xeca6('0x8'))},'data1':{'type':Sequelize[_0xeca6('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xeca6('0x2')],'comment':_0xeca6('0x9')},'data3':{'type':Sequelize['STRING'],'comment':_0xeca6('0xa')},'data4':{'type':Sequelize[_0xeca6('0x2')],'comment':_0xeca6('0xb')},'data5':{'type':Sequelize['TEXT'],'comment':_0xeca6('0xc')},'data6':{'type':Sequelize[_0xeca6('0xd')],'comment':_0xeca6('0xe')},'data7':{'type':Sequelize[_0xeca6('0xd')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x2376=['Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure'];(function(_0xe78f01,_0x525d21){var _0x561def=function(_0x311810){while(--_0x311810){_0xe78f01['push'](_0xe78f01['shift']());}};_0x561def(++_0x525d21);}(_0x2376,0x153));var _0x6237=function(_0x121b0d,_0x22104d){_0x121b0d=_0x121b0d-0x0;var _0x13482f=_0x2376[_0x121b0d];return _0x13482f;};'use strict';var Sequelize=require('sequelize');module[_0x6237('0x0')]={'name':{'type':Sequelize[_0x6237('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x6237('0x2')](_0x6237('0x3'),_0x6237('0x4'),_0x6237('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x6237('0x2')](_0x6237('0x6'),'Dynamics365')},'data1':{'type':Sequelize['STRING'],'comment':_0x6237('0x7')},'data2':{'type':Sequelize[_0x6237('0x1')],'comment':_0x6237('0x8')},'data3':{'type':Sequelize['STRING'],'comment':_0x6237('0x9')},'data4':{'type':Sequelize[_0x6237('0x1')],'comment':_0x6237('0xa')},'data5':{'type':Sequelize[_0x6237('0xb')],'comment':_0x6237('0xc')},'data6':{'type':Sequelize[_0x6237('0xb')],'comment':_0x6237('0xd')},'data7':{'type':Sequelize[_0x6237('0xb')],'comment':_0x6237('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 252f590..55fa82a 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 _0xf613=['find','create','body','Name\x20parameter\x20not\x20specified','service','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','Invalid\x20state\x20parameter','parse','from','state','base64','toString','del','getOauth2MicrosoftAccessToken','data5','access_token','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','update','then','destroy','end','error','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','MicrosoftAzure','decryptString','data3','catch','show','params','keys'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xf613,0x81));var _0x3f61=function(_0x80e289,_0x54b9c8){_0x80e289=_0x80e289-0x0;var _0x228203=_0xf613[_0x80e289];return _0x228203;};'use strict';var _=require(_0x3f61('0x0'));var Redis=require(_0x3f61('0x1'));var qs=require(_0x3f61('0x2'));var encryptor=require(_0x3f61('0x3'));var config=require(_0x3f61('0x4'));var logger=require(_0x3f61('0x5'))(_0x3f61('0x6'));var db=require(_0x3f61('0x7'))['db'];var oauth=require(_0x3f61('0x8'));config[_0x3f61('0x9')]=_['defaults'](config[_0x3f61('0x9')],{'host':_0x3f61('0xa'),'port':0x18eb});var socket=require(_0x3f61('0xb'))(new Redis(config[_0x3f61('0x9')]));var redis=new Redis(config[_0x3f61('0x9')]);function respondWithStatusCode(_0x286a20,_0x4f1568){_0x4f1568=_0x4f1568||0xcc;return function(_0x153128){if(_0x153128){return _0x286a20[_0x3f61('0xc')](_0x4f1568);}return _0x286a20[_0x3f61('0xd')](_0x4f1568)['end']();};}function respondWithResult(_0xfed4e7,_0x38fb75){_0x38fb75=_0x38fb75||0xc8;return function(_0x406296){if(_0x406296){return _0xfed4e7[_0x3f61('0xd')](_0x38fb75)[_0x3f61('0xe')](_0x406296);}};}function respondWithFilteredResult(_0x16c38e,_0x5a4920){return function(_0x37ab76){if(_0x37ab76){var _0x3f14ad=typeof _0x5a4920['offset']==='undefined'&&typeof _0x5a4920['limit']===_0x3f61('0xf');var _0x14265a=_0x37ab76['count'];var _0x53e081=_0x3f14ad?0x0:_0x5a4920['offset'];var _0x146547=_0x3f14ad?_0x37ab76[_0x3f61('0x10')]:_0x5a4920[_0x3f61('0x11')]+_0x5a4920[_0x3f61('0x12')];var _0x5eb66a;if(_0x146547>=_0x14265a){_0x146547=_0x14265a;_0x5eb66a=0xc8;}else{_0x5eb66a=0xce;}_0x16c38e[_0x3f61('0xd')](_0x5eb66a);return _0x16c38e[_0x3f61('0x13')](_0x3f61('0x14'),_0x53e081+'-'+_0x146547+'/'+_0x14265a)['json'](_0x37ab76);}return null;};}function saveUpdates(_0x114bf3){return function(_0x2bb282){if(_0x2bb282){return _0x2bb282[_0x3f61('0x15')](_0x114bf3)[_0x3f61('0x16')](function(_0x32c1f2){return _0x32c1f2;});}return null;};}function removeEntity(_0x20612a){return function(_0x1f19da){if(_0x1f19da){return _0x1f19da[_0x3f61('0x17')]()['then'](function(){_0x20612a['status'](0xcc)[_0x3f61('0x18')]();});}};}function handleEntityNotFound(_0x158cd9){return function(_0x4a595a){if(!_0x4a595a){_0x158cd9[_0x3f61('0xc')](0x194);}return _0x4a595a;};}function handleError(_0x178357,_0xd711ee){_0xd711ee=_0xd711ee||0x1f4;return function(_0x36de98){logger[_0x3f61('0x19')](_0x36de98['stack']);if(_0x36de98[_0x3f61('0x1a')]){delete _0x36de98[_0x3f61('0x1a')];}_0x178357['status'](_0xd711ee)[_0x3f61('0x1b')](_0x36de98);};}function maskClientSecret(_0x20ed1d){return _[_0x3f61('0x1c')](_0x20ed1d[_0x3f61('0x1d')](0x0,0x3),0x14,'*');}exports[_0x3f61('0x1e')]=function(_0x4fc65e,_0x37cc46){var _0x368a98={},_0x583015={},_0x12a662={'count':0x0,'rows':[]};var _0x1604a5=_[_0x3f61('0x1f')](db[_0x3f61('0x20')][_0x3f61('0x21')],function(_0x1d9969){return{'name':_0x1d9969[_0x3f61('0x22')],'type':_0x1d9969[_0x3f61('0x23')][_0x3f61('0x24')]};});_0x583015[_0x3f61('0x25')]=_[_0x3f61('0x1f')](_0x1604a5,_0x3f61('0x1a'));_0x583015[_0x3f61('0x26')]=_['keys'](_0x4fc65e['query']);_0x583015[_0x3f61('0x27')]=_[_0x3f61('0x28')](_0x583015[_0x3f61('0x25')],_0x583015[_0x3f61('0x26')]);_0x368a98[_0x3f61('0x29')]=_[_0x3f61('0x28')](_0x583015[_0x3f61('0x25')],qs[_0x3f61('0x2a')](_0x4fc65e['query']['fields']));_0x368a98[_0x3f61('0x29')]=_0x368a98[_0x3f61('0x29')][_0x3f61('0x2b')]?_0x368a98[_0x3f61('0x29')]:_0x583015[_0x3f61('0x25')];if(!_0x4fc65e[_0x3f61('0x26')][_0x3f61('0x2c')](_0x3f61('0x2d'))){_0x368a98[_0x3f61('0x12')]=qs[_0x3f61('0x12')](_0x4fc65e[_0x3f61('0x26')][_0x3f61('0x12')]);_0x368a98[_0x3f61('0x11')]=qs[_0x3f61('0x11')](_0x4fc65e['query'][_0x3f61('0x11')]);}_0x368a98['order']=qs['sort'](_0x4fc65e[_0x3f61('0x26')][_0x3f61('0x2e')]);_0x368a98['where']=qs[_0x3f61('0x27')](_[_0x3f61('0x2f')](_0x4fc65e[_0x3f61('0x26')],_0x583015[_0x3f61('0x27')]),_0x1604a5);if(_0x4fc65e['query'][_0x3f61('0x30')]){_0x368a98[_0x3f61('0x31')]=_['merge'](_0x368a98[_0x3f61('0x31')],{'$or':_['map'](_0x1604a5,function(_0x1efe48){if(_0x1efe48['type']!==_0x3f61('0x32')){var _0x40bccd={};_0x40bccd[_0x1efe48[_0x3f61('0x1a')]]={'$like':'%'+_0x4fc65e[_0x3f61('0x26')]['filter']+'%'};return _0x40bccd;}})});}_0x368a98=_[_0x3f61('0x33')]({},_0x368a98,_0x4fc65e[_0x3f61('0x34')]);var _0x3ccb4b={'where':_0x368a98[_0x3f61('0x31')]};return db[_0x3f61('0x20')]['count'](_0x3ccb4b)['then'](function(_0xd8b6be){_0x12a662[_0x3f61('0x10')]=_0xd8b6be;if(_0x4fc65e[_0x3f61('0x26')][_0x3f61('0x35')]){_0x368a98[_0x3f61('0x36')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x368a98);})[_0x3f61('0x16')](function(_0x6bc414){_0x12a662[_0x3f61('0x37')]=_[_0x3f61('0x1f')](_0x6bc414,function(_0x22b797){if(_0x22b797['service']===_0x3f61('0x38')){var _0x2d1ba9=encryptor[_0x3f61('0x39')](_0x22b797[_0x3f61('0x3a')]);_0x22b797[_0x3f61('0x3a')]=maskClientSecret(_0x2d1ba9);}return _0x22b797;});return _0x12a662;})['then'](respondWithFilteredResult(_0x37cc46,_0x368a98))[_0x3f61('0x3b')](handleError(_0x37cc46,null));};exports[_0x3f61('0x3c')]=function(_0x4fda2a,_0x725f01){var _0x250dd1={'raw':!![],'where':{'id':_0x4fda2a[_0x3f61('0x3d')]['id']}},_0x3d88fa={};_0x3d88fa[_0x3f61('0x25')]=_[_0x3f61('0x3e')](db[_0x3f61('0x20')][_0x3f61('0x21')]);_0x3d88fa[_0x3f61('0x26')]=_[_0x3f61('0x3e')](_0x4fda2a['query']);_0x3d88fa[_0x3f61('0x27')]=_[_0x3f61('0x28')](_0x3d88fa[_0x3f61('0x25')],_0x3d88fa[_0x3f61('0x26')]);_0x250dd1[_0x3f61('0x29')]=_[_0x3f61('0x28')](_0x3d88fa[_0x3f61('0x25')],qs[_0x3f61('0x2a')](_0x4fda2a['query']['fields']));_0x250dd1[_0x3f61('0x29')]=_0x250dd1['attributes'][_0x3f61('0x2b')]?_0x250dd1[_0x3f61('0x29')]:_0x3d88fa[_0x3f61('0x25')];if(_0x4fda2a[_0x3f61('0x26')][_0x3f61('0x35')]){_0x250dd1[_0x3f61('0x36')]=[{'all':!![]}];}_0x250dd1=_[_0x3f61('0x33')]({},_0x250dd1,_0x4fda2a[_0x3f61('0x34')]);return db[_0x3f61('0x20')][_0x3f61('0x3f')](_0x250dd1)[_0x3f61('0x16')](handleEntityNotFound(_0x725f01,null))[_0x3f61('0x16')](function(_0x3e89c3){if(_0x3e89c3['service']===_0x3f61('0x38')){var _0x5c374=encryptor[_0x3f61('0x39')](_0x3e89c3['data3']);_0x3e89c3[_0x3f61('0x3a')]=maskClientSecret(_0x5c374);}return _0x3e89c3;})[_0x3f61('0x16')](respondWithResult(_0x725f01,null))[_0x3f61('0x3b')](handleError(_0x725f01,null));};exports[_0x3f61('0x40')]=function(_0x4b604b,_0x1007bc){if(!_0x4b604b[_0x3f61('0x41')][_0x3f61('0x1a')])throw new Error(_0x3f61('0x42'));if(!_0x4b604b['body'][_0x3f61('0x43')])throw new Error(_0x3f61('0x44'));var _0x3d2626=db['CloudProvider'][_0x3f61('0x21')][_0x3f61('0x43')][_0x3f61('0x45')];if(!_0x3d2626[_0x3f61('0x46')](_0x4b604b[_0x3f61('0x41')][_0x3f61('0x43')]))throw new Error(_0x3f61('0x47')+_0x3d2626[_0x3f61('0x48')](',\x20'));if(_0x4b604b[_0x3f61('0x41')][_0x3f61('0x43')]===_0x3f61('0x38')&&_0x4b604b[_0x3f61('0x41')][_0x3f61('0x3a')]){_0x4b604b['body'][_0x3f61('0x3a')]=encryptor[_0x3f61('0x49')](_0x4b604b['body'][_0x3f61('0x3a')]);}return db[_0x3f61('0x20')]['create'](_0x4b604b['body'],{})[_0x3f61('0x16')](respondWithResult(_0x1007bc,0xc9))[_0x3f61('0x3b')](handleError(_0x1007bc,null));};exports['update']=function(_0x51ba88,_0x4c3e00){if(_0x51ba88[_0x3f61('0x41')]['id']){delete _0x51ba88[_0x3f61('0x41')]['id'];}return db[_0x3f61('0x20')][_0x3f61('0x3f')]({'where':{'id':_0x51ba88[_0x3f61('0x3d')]['id']}})[_0x3f61('0x16')](handleEntityNotFound(_0x4c3e00,null))[_0x3f61('0x16')](function(_0x473c9e){if(_0x473c9e[_0x3f61('0x43')]===_0x3f61('0x38')&&_0x51ba88[_0x3f61('0x41')][_0x3f61('0x3a')]){_0x51ba88[_0x3f61('0x41')][_0x3f61('0x3a')]=encryptor[_0x3f61('0x49')](_0x51ba88[_0x3f61('0x41')][_0x3f61('0x3a')]);}return _0x473c9e;})[_0x3f61('0x16')](saveUpdates(_0x51ba88[_0x3f61('0x41')],null))['then'](respondWithResult(_0x4c3e00,null))[_0x3f61('0x3b')](handleError(_0x4c3e00,null));};exports[_0x3f61('0x17')]=function(_0x3b25d7,_0x2a0a70){return db[_0x3f61('0x20')][_0x3f61('0x3f')]({'where':{'id':_0x3b25d7[_0x3f61('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2a0a70,null))[_0x3f61('0x16')](removeEntity(_0x2a0a70,null))['catch'](handleError(_0x2a0a70,null));};exports[_0x3f61('0x4a')]=function(_0x176204,_0x3e7ad4){return db[_0x3f61('0x20')][_0x3f61('0x4b')]({'where':{'id':_0x176204[_0x3f61('0x3d')]['id']},'raw':!![]})[_0x3f61('0x16')](function(_0x35692b){if(!_0x35692b)return _0x3e7ad4[_0x3f61('0xc')](0x194);return{'url':oauth[_0x3f61('0x4c')](_0x35692b,_0x176204[_0x3f61('0x4d')]['id'])};})['then'](respondWithResult(_0x3e7ad4,null))[_0x3f61('0x3b')](handleError(_0x3e7ad4,null));};exports[_0x3f61('0x4e')]=function(_0x220d9c,_0x1bea2){var _0x3c43d7=_0x220d9c[_0x3f61('0x41')];var _0x5b0d9a;var _0x1830ce;if(_0x3c43d7[_0x3f61('0x19')])throw _0x3c43d7;redis['get'](_0x3c43d7['state'])['then'](function(_0x2377da){if(!_0x2377da)throw new Error(_0x3f61('0x4f'));_0x5b0d9a=JSON[_0x3f61('0x50')](_0x2377da);var _0xafb039=Buffer[_0x3f61('0x51')](_0x3c43d7[_0x3f61('0x52')],_0x3f61('0x53'))[_0x3f61('0x54')]('ascii');_0x1830ce=JSON[_0x3f61('0x50')](_0xafb039);if(!oauth['isValidIdToken'](_0x3c43d7['id_token'],_0x5b0d9a['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x3f61('0x55')](_0x3c43d7[_0x3f61('0x52')]);return oauth[_0x3f61('0x56')](_0x3c43d7['code'],_0x5b0d9a);})['then'](function(_0x39bff0){_0x5b0d9a[_0x3f61('0x57')]=_0x39bff0[_0x3f61('0x58')];_0x5b0d9a[_0x3f61('0x59')]=_0x39bff0[_0x3f61('0x5a')];return db[_0x3f61('0x20')][_0x3f61('0x15')]({'data5':_0x5b0d9a[_0x3f61('0x57')],'data6':_0x5b0d9a['data6']},{'where':{'id':_0x5b0d9a['id']}});})[_0x3f61('0x16')](function(){oauth['startRefreshInterval'](_0x5b0d9a);socket[_0x3f61('0x5b')](_0x3f61('0x5c'),{'id':_0x1830ce['id']});return;})[_0x3f61('0x16')](respondWithStatusCode(_0x1bea2,null))['catch'](function(_0x562dda){if(_0x1830ce){socket[_0x3f61('0x5b')](_0x3f61('0x5d'),{'id':_0x1830ce['id']});}if(!_0x5b0d9a){logger['error'](_0x3f61('0x5e'),_0x562dda);return _0x1bea2[_0x3f61('0xd')](0x1f4)[_0x3f61('0x1b')](_0x562dda[_0x3f61('0x5f')]);}logger[_0x3f61('0x19')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s',_0x5b0d9a['id'],_0x562dda);});}; \ No newline at end of file +var _0x8e44=['join','encryptString','find','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','status','end','json','undefined','offset','count','limit','set','Content-Range','update','destroy','then','sendStatus','error','name','send','index','map','CloudProvider','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','includeAll','create','body','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'];(function(_0x24a3e0,_0x1d5ebe){var _0x233769=function(_0x30dd43){while(--_0x30dd43){_0x24a3e0['push'](_0x24a3e0['shift']());}};_0x233769(++_0x1d5ebe);}(_0x8e44,0x195));var _0x48e4=function(_0x1bfda4,_0x4a1d18){_0x1bfda4=_0x1bfda4-0x0;var _0x2a3741=_0x8e44[_0x1bfda4];return _0x2a3741;};'use strict';var _=require(_0x48e4('0x0'));var Redis=require(_0x48e4('0x1'));var qs=require(_0x48e4('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0x48e4('0x3'));var logger=require(_0x48e4('0x4'))('api');var db=require(_0x48e4('0x5'))['db'];var oauth=require(_0x48e4('0x6'));config['redis']=_['defaults'](config[_0x48e4('0x7')],{'host':_0x48e4('0x8'),'port':0x18eb});var socket=require(_0x48e4('0x9'))(new Redis(config[_0x48e4('0x7')]));var redis=new Redis(config[_0x48e4('0x7')]);function respondWithStatusCode(_0x445b56,_0x3ed5f5){_0x3ed5f5=_0x3ed5f5||0xcc;return function(_0x4ddd00){if(_0x4ddd00){return _0x445b56['sendStatus'](_0x3ed5f5);}return _0x445b56[_0x48e4('0xa')](_0x3ed5f5)[_0x48e4('0xb')]();};}function respondWithResult(_0x28fa0c,_0x5e41b8){_0x5e41b8=_0x5e41b8||0xc8;return function(_0x599f81){if(_0x599f81){return _0x28fa0c['status'](_0x5e41b8)[_0x48e4('0xc')](_0x599f81);}};}function respondWithFilteredResult(_0x19721a,_0x28ca5f){return function(_0x2ce4b6){if(_0x2ce4b6){var _0x11bf0f=typeof _0x28ca5f['offset']===_0x48e4('0xd')&&typeof _0x28ca5f['limit']===_0x48e4('0xd');var _0x2f839c=_0x2ce4b6['count'];var _0x45588b=_0x11bf0f?0x0:_0x28ca5f[_0x48e4('0xe')];var _0x506e23=_0x11bf0f?_0x2ce4b6[_0x48e4('0xf')]:_0x28ca5f[_0x48e4('0xe')]+_0x28ca5f[_0x48e4('0x10')];var _0x218089;if(_0x506e23>=_0x2f839c){_0x506e23=_0x2f839c;_0x218089=0xc8;}else{_0x218089=0xce;}_0x19721a['status'](_0x218089);return _0x19721a[_0x48e4('0x11')](_0x48e4('0x12'),_0x45588b+'-'+_0x506e23+'/'+_0x2f839c)[_0x48e4('0xc')](_0x2ce4b6);}return null;};}function saveUpdates(_0x3e1b99){return function(_0x50ebcb){if(_0x50ebcb){return _0x50ebcb[_0x48e4('0x13')](_0x3e1b99)['then'](function(_0xaa747f){return _0xaa747f;});}return null;};}function removeEntity(_0x1463fa){return function(_0x40f10a){if(_0x40f10a){return _0x40f10a[_0x48e4('0x14')]()[_0x48e4('0x15')](function(){_0x1463fa['status'](0xcc)[_0x48e4('0xb')]();});}};}function handleEntityNotFound(_0x3e3b3e){return function(_0xaad0ac){if(!_0xaad0ac){_0x3e3b3e[_0x48e4('0x16')](0x194);}return _0xaad0ac;};}function handleError(_0x35712e,_0x10235e){_0x10235e=_0x10235e||0x1f4;return function(_0x988250){logger[_0x48e4('0x17')](_0x988250['stack']);if(_0x988250[_0x48e4('0x18')]){delete _0x988250[_0x48e4('0x18')];}_0x35712e['status'](_0x10235e)[_0x48e4('0x19')](_0x988250);};}function maskClientSecret(_0x435761){return _['padEnd'](_0x435761['slice'](0x0,0x3),0x14,'*');}exports[_0x48e4('0x1a')]=function(_0x52f929,_0x1bdd6f){var _0x3283f5={},_0x34922a={},_0x3c8e29={'count':0x0,'rows':[]};var _0xb58b49=_[_0x48e4('0x1b')](db[_0x48e4('0x1c')][_0x48e4('0x1d')],function(_0x4908d6){return{'name':_0x4908d6[_0x48e4('0x1e')],'type':_0x4908d6['type'][_0x48e4('0x1f')]};});_0x34922a['model']=_[_0x48e4('0x1b')](_0xb58b49,'name');_0x34922a['query']=_['keys'](_0x52f929[_0x48e4('0x20')]);_0x34922a[_0x48e4('0x21')]=_[_0x48e4('0x22')](_0x34922a[_0x48e4('0x23')],_0x34922a['query']);_0x3283f5[_0x48e4('0x24')]=_['intersection'](_0x34922a[_0x48e4('0x23')],qs[_0x48e4('0x25')](_0x52f929[_0x48e4('0x20')][_0x48e4('0x25')]));_0x3283f5[_0x48e4('0x24')]=_0x3283f5['attributes'][_0x48e4('0x26')]?_0x3283f5[_0x48e4('0x24')]:_0x34922a[_0x48e4('0x23')];if(!_0x52f929[_0x48e4('0x20')][_0x48e4('0x27')]('nolimit')){_0x3283f5[_0x48e4('0x10')]=qs[_0x48e4('0x10')](_0x52f929[_0x48e4('0x20')][_0x48e4('0x10')]);_0x3283f5[_0x48e4('0xe')]=qs[_0x48e4('0xe')](_0x52f929[_0x48e4('0x20')][_0x48e4('0xe')]);}_0x3283f5['order']=qs[_0x48e4('0x28')](_0x52f929['query'][_0x48e4('0x28')]);_0x3283f5[_0x48e4('0x29')]=qs[_0x48e4('0x21')](_[_0x48e4('0x2a')](_0x52f929[_0x48e4('0x20')],_0x34922a[_0x48e4('0x21')]),_0xb58b49);if(_0x52f929[_0x48e4('0x20')][_0x48e4('0x2b')]){_0x3283f5[_0x48e4('0x29')]=_[_0x48e4('0x2c')](_0x3283f5[_0x48e4('0x29')],{'$or':_['map'](_0xb58b49,function(_0x213128){if(_0x213128[_0x48e4('0x2d')]!==_0x48e4('0x2e')){var _0x396194={};_0x396194[_0x213128['name']]={'$like':'%'+_0x52f929[_0x48e4('0x20')][_0x48e4('0x2b')]+'%'};return _0x396194;}})});}_0x3283f5=_[_0x48e4('0x2c')]({},_0x3283f5,_0x52f929[_0x48e4('0x2f')]);var _0x56a9ab={'where':_0x3283f5['where']};return db['CloudProvider'][_0x48e4('0xf')](_0x56a9ab)[_0x48e4('0x15')](function(_0x324c7c){_0x3c8e29['count']=_0x324c7c;if(_0x52f929['query']['includeAll']){_0x3283f5[_0x48e4('0x30')]=[{'all':!![]}];}return db['CloudProvider'][_0x48e4('0x31')](_0x3283f5);})[_0x48e4('0x15')](function(_0x2ca7ac){_0x3c8e29[_0x48e4('0x32')]=_[_0x48e4('0x1b')](_0x2ca7ac,function(_0x2415d5){if(_0x2415d5[_0x48e4('0x33')]===_0x48e4('0x34')){var _0x183522=encryptor[_0x48e4('0x35')](_0x2415d5[_0x48e4('0x36')]);_0x2415d5[_0x48e4('0x36')]=maskClientSecret(_0x183522);}return _0x2415d5;});return _0x3c8e29;})[_0x48e4('0x15')](respondWithFilteredResult(_0x1bdd6f,_0x3283f5))[_0x48e4('0x37')](handleError(_0x1bdd6f,null));};exports[_0x48e4('0x38')]=function(_0x4ea8d1,_0x30163d){var _0x1d220a={'raw':!![],'where':{'id':_0x4ea8d1[_0x48e4('0x39')]['id']}},_0x157031={};_0x157031[_0x48e4('0x23')]=_['keys'](db[_0x48e4('0x1c')][_0x48e4('0x1d')]);_0x157031['query']=_[_0x48e4('0x3a')](_0x4ea8d1['query']);_0x157031[_0x48e4('0x21')]=_[_0x48e4('0x22')](_0x157031['model'],_0x157031[_0x48e4('0x20')]);_0x1d220a[_0x48e4('0x24')]=_['intersection'](_0x157031[_0x48e4('0x23')],qs[_0x48e4('0x25')](_0x4ea8d1[_0x48e4('0x20')]['fields']));_0x1d220a[_0x48e4('0x24')]=_0x1d220a[_0x48e4('0x24')][_0x48e4('0x26')]?_0x1d220a[_0x48e4('0x24')]:_0x157031[_0x48e4('0x23')];if(_0x4ea8d1['query'][_0x48e4('0x3b')]){_0x1d220a[_0x48e4('0x30')]=[{'all':!![]}];}_0x1d220a=_[_0x48e4('0x2c')]({},_0x1d220a,_0x4ea8d1[_0x48e4('0x2f')]);return db[_0x48e4('0x1c')]['find'](_0x1d220a)[_0x48e4('0x15')](handleEntityNotFound(_0x30163d,null))['then'](function(_0x17c746){if(_0x17c746[_0x48e4('0x33')]===_0x48e4('0x34')){var _0x5dde9e=encryptor[_0x48e4('0x35')](_0x17c746['data3']);_0x17c746[_0x48e4('0x36')]=maskClientSecret(_0x5dde9e);}return _0x17c746;})[_0x48e4('0x15')](respondWithResult(_0x30163d,null))[_0x48e4('0x37')](handleError(_0x30163d,null));};exports[_0x48e4('0x3c')]=function(_0x108898,_0xbd0630){if(!_0x108898[_0x48e4('0x3d')][_0x48e4('0x18')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x108898['body'][_0x48e4('0x33')])throw new Error(_0x48e4('0x3e'));var _0x29e776=db[_0x48e4('0x1c')][_0x48e4('0x1d')][_0x48e4('0x33')][_0x48e4('0x3f')];if(!_0x29e776['includes'](_0x108898[_0x48e4('0x3d')]['service']))throw new Error(_0x48e4('0x40')+_0x29e776[_0x48e4('0x41')](',\x20'));if(_0x108898[_0x48e4('0x3d')][_0x48e4('0x33')]===_0x48e4('0x34')&&_0x108898[_0x48e4('0x3d')][_0x48e4('0x36')]){_0x108898[_0x48e4('0x3d')][_0x48e4('0x36')]=encryptor[_0x48e4('0x42')](_0x108898[_0x48e4('0x3d')][_0x48e4('0x36')]);}return db[_0x48e4('0x1c')][_0x48e4('0x3c')](_0x108898[_0x48e4('0x3d')],{})['then'](respondWithResult(_0xbd0630,0xc9))['catch'](handleError(_0xbd0630,null));};exports[_0x48e4('0x13')]=function(_0x580a4a,_0x2a99ea){if(_0x580a4a[_0x48e4('0x3d')]['id']){delete _0x580a4a[_0x48e4('0x3d')]['id'];}return db[_0x48e4('0x1c')][_0x48e4('0x43')]({'where':{'id':_0x580a4a[_0x48e4('0x39')]['id']}})['then'](handleEntityNotFound(_0x2a99ea,null))[_0x48e4('0x15')](function(_0x710f80){if(_0x710f80[_0x48e4('0x33')]===_0x48e4('0x34')&&_0x580a4a[_0x48e4('0x3d')]['data3']){_0x580a4a['body']['data3']=encryptor[_0x48e4('0x42')](_0x580a4a[_0x48e4('0x3d')]['data3']);}return _0x710f80;})[_0x48e4('0x15')](saveUpdates(_0x580a4a[_0x48e4('0x3d')],null))[_0x48e4('0x15')](respondWithResult(_0x2a99ea,null))[_0x48e4('0x37')](handleError(_0x2a99ea,null));};exports[_0x48e4('0x14')]=function(_0xbca62a,_0x1f66fd){return db['CloudProvider'][_0x48e4('0x43')]({'where':{'id':_0xbca62a[_0x48e4('0x39')]['id']}})[_0x48e4('0x15')](handleEntityNotFound(_0x1f66fd,null))[_0x48e4('0x15')](removeEntity(_0x1f66fd,null))[_0x48e4('0x37')](handleError(_0x1f66fd,null));};exports[_0x48e4('0x44')]=function(_0x4d13cb,_0x48dabb){return db['CloudProvider'][_0x48e4('0x45')]({'where':{'id':_0x4d13cb[_0x48e4('0x39')]['id']},'raw':!![]})['then'](function(_0x9f96){if(!_0x9f96)return _0x48dabb[_0x48e4('0x16')](0x194);return{'url':oauth[_0x48e4('0x46')](_0x9f96,_0x4d13cb['user']['id'])};})[_0x48e4('0x15')](respondWithResult(_0x48dabb,null))[_0x48e4('0x37')](handleError(_0x48dabb,null));};exports['oauth2MicrosoftCallback']=function(_0x3afcbb,_0x220644){var _0x2ef9cd=_0x3afcbb[_0x48e4('0x3d')];var _0x1326a3;var _0x451d3c;if(_0x2ef9cd['error'])throw _0x2ef9cd;redis[_0x48e4('0x47')](_0x2ef9cd[_0x48e4('0x48')])[_0x48e4('0x15')](function(_0x384143){if(!_0x384143)throw new Error(_0x48e4('0x49'));_0x1326a3=JSON[_0x48e4('0x4a')](_0x384143);var _0x5eb94f=Buffer[_0x48e4('0x4b')](_0x2ef9cd[_0x48e4('0x48')],_0x48e4('0x4c'))[_0x48e4('0x4d')](_0x48e4('0x4e'));_0x451d3c=JSON['parse'](_0x5eb94f);if(!oauth[_0x48e4('0x4f')](_0x2ef9cd[_0x48e4('0x50')],_0x1326a3['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x2ef9cd[_0x48e4('0x48')]);return oauth[_0x48e4('0x51')](_0x2ef9cd[_0x48e4('0x52')],_0x1326a3);})[_0x48e4('0x15')](function(_0x3e9c4a){_0x1326a3['data5']=_0x3e9c4a[_0x48e4('0x53')];_0x1326a3[_0x48e4('0x54')]=_0x3e9c4a[_0x48e4('0x55')];return db[_0x48e4('0x1c')]['update']({'data5':_0x1326a3[_0x48e4('0x56')],'data6':_0x1326a3['data6']},{'where':{'id':_0x1326a3['id']}});})['then'](function(){oauth[_0x48e4('0x57')](_0x1326a3);socket[_0x48e4('0x58')](_0x48e4('0x59'),{'id':_0x451d3c['id']});return;})[_0x48e4('0x15')](respondWithStatusCode(_0x220644,null))[_0x48e4('0x37')](function(_0x3e9163){if(_0x451d3c){socket[_0x48e4('0x58')](_0x48e4('0x5a'),{'id':_0x451d3c['id']});}if(!_0x1326a3){logger[_0x48e4('0x17')](_0x48e4('0x5b'),_0x3e9163);return _0x220644[_0x48e4('0xa')](0x1f4)['send'](_0x3e9163[_0x48e4('0x5c')]);}logger[_0x48e4('0x17')](_0x48e4('0x5d'),_0x1326a3['id'],_0x3e9163);});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 249a362..079b870 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 _0x3a3d=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','CloudProvider','lodash','../../config/logger'];(function(_0x3503d4,_0x718bf){var _0x43bef2=function(_0x474c95){while(--_0x474c95){_0x3503d4['push'](_0x3503d4['shift']());}};_0x43bef2(++_0x718bf);}(_0x3a3d,0xb2));var _0xd3a3=function(_0xa1003e,_0x5582d8){_0xa1003e=_0xa1003e-0x0;var _0x210ea7=_0x3a3d[_0xa1003e];return _0x210ea7;};'use strict';var _=require(_0xd3a3('0x0'));var util=require('util');var logger=require(_0xd3a3('0x1'))('api');var moment=require(_0xd3a3('0x2'));var BPromise=require(_0xd3a3('0x3'));var rp=require(_0xd3a3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd3a3('0x5'));var config=require(_0xd3a3('0x6'));var attributes=require('./cloudProvider.attributes');module[_0xd3a3('0x7')]=function(_0x4c0b9e,_0x5ab06d){return _0x4c0b9e[_0xd3a3('0x8')](_0xd3a3('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f62=['util','api','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash'];(function(_0x36bf76,_0x3a72dc){var _0xfa29c3=function(_0x157b18){while(--_0x157b18){_0x36bf76['push'](_0x36bf76['shift']());}};_0xfa29c3(++_0x3a72dc);}(_0x8f62,0x1af));var _0x28f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8f62[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x28f6('0x0'));var util=require(_0x28f6('0x1'));var logger=require('../../config/logger')(_0x28f6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x28f6('0x3'));var fs=require('fs');var path=require(_0x28f6('0x4'));var rimraf=require(_0x28f6('0x5'));var config=require(_0x28f6('0x6'));var attributes=require(_0x28f6('0x7'));module[_0x28f6('0x8')]=function(_0x125feb,_0x302436){return _0x125feb[_0x28f6('0x9')](_0x28f6('0xa'),attributes,{'tableName':_0x28f6('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 7aa7305..66ca671 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 _0x1261=['toString','randomBytes','data1','response_type','redirect_uri','response_mode','form_post','state','key','value','oauth2Claims','replace','set','stringify','decode','payload','iss','aud','nonce','isAfter','exp','then','data3','CloudProvider','refresh_token','data6','data4','POST','data5','access_token','update','error','decryptString','intervals','bind','findAll','all','catch','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart','exports','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','{TENANT_ID}','data2','id_token'];(function(_0x2fc691,_0x2fc68c){var _0x3cdb8d=function(_0x2e56eb){while(--_0x2e56eb){_0x2fc691['push'](_0x2fc691['shift']());}};_0x3cdb8d(++_0x2fc68c);}(_0x1261,0x144));var _0x1126=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x1261[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require('lodash');var crypto=require(_0x1126('0x0'));var jwt=require(_0x1126('0x1'));var moment=require(_0x1126('0x2'));var Redis=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var util=require(_0x1126('0x5'));var encryptor=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var logger=require(_0x1126('0x8'))(_0x1126('0x9'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0x1126('0xa')]=_[_0x1126('0xb')](config['redis'],{'host':_0x1126('0xc'),'port':0x18eb});var redis=new Redis(config[_0x1126('0xa')]);var MICROSOFT_AUTH_URL=_0x1126('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x1126('0xe'),_0x1126('0xf'),'email',_0x1126('0x10'),_0x1126('0x11'),_0x1126('0x12'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x1126('0xe'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x1126('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x561b93){var _0x15e89b=_[_0x1126('0x14')](AZURE_AUTH_SCOPES[_0x561b93[_0x1126('0x15')]]);if(_0x561b93[_0x1126('0x15')]===_0x1126('0x16'))_0x15e89b[_0x1126('0x17')](_0x561b93[_0x1126('0x18')]+_0x1126('0x19'));return _0x15e89b[_0x1126('0x1a')]('\x20');}function getAccessTokenScope(_0x53a8f0){if(_0x53a8f0['type']===_0x1126('0x1b'))return _0x1126('0x11');if(_0x53a8f0[_0x1126('0x15')]==='Dynamics365')return _0x53a8f0[_0x1126('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x35fe9f,_0x42f379){var _0x257b5f=MICROSOFT_AUTH_URL['replace'](_0x1126('0x1c'),_0x35fe9f[_0x1126('0x1d')]);var _0x4a7b49=['code',_0x1126('0x1e')];var _0x2b2487=Buffer['from'](JSON['stringify']({'id':_0x42f379}))[_0x1126('0x1f')]('base64');var _0x22ed37=crypto[_0x1126('0x20')](0x10)[_0x1126('0x1f')]('hex');var _0x2a08ba=getAuthorizationScopes(_0x35fe9f);var _0x49d209=[{'key':'client_id','value':_0x35fe9f[_0x1126('0x21')]},{'key':_0x1126('0x22'),'value':encodeURIComponent(_0x4a7b49[_0x1126('0x1a')]('\x20'))},{'key':_0x1126('0x23'),'value':_0x35fe9f['data4']},{'key':_0x1126('0x24'),'value':_0x1126('0x25')},{'key':'scope','value':encodeURIComponent(_0x2a08ba)},{'key':_0x1126('0x26'),'value':_0x2b2487},{'key':'nonce','value':_0x22ed37},{'key':'prompt','value':'login'}];var _0x2199d9=_0x257b5f+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x1126('0x14')](_0x49d209,function(_0x329914){return _0x329914[_0x1126('0x27')]+'='+_0x329914[_0x1126('0x28')];})[_0x1126('0x1a')]('&');_0x35fe9f[_0x1126('0x29')]={'issuer':_0x257b5f[_0x1126('0x2a')]('oauth2/',''),'audience':_0x35fe9f[_0x1126('0x21')],'state':_0x2b2487,'nonce':_0x22ed37};redis[_0x1126('0x2b')](_0x2b2487,JSON[_0x1126('0x2c')](_0x35fe9f));return _0x2199d9;}function isValidIdToken(_0x5ddf63,_0x541bc9){try{var _0xeb7d89=jwt[_0x1126('0x2d')](_0x5ddf63,{'complete':!![]});var _0x55e195=_0xeb7d89[_0x1126('0x2e')];if(_0x55e195[_0x1126('0x2f')]!==_0x541bc9['issuer'])return![];if(_0x55e195[_0x1126('0x30')]!==_0x541bc9['audience'])return![];if(_0x55e195[_0x1126('0x31')]!==_0x541bc9['nonce'])return![];if(moment()[_0x1126('0x32')](moment['unix'](_0x55e195[_0x1126('0x33')])))return![];return!![];}catch(_0x5f2611){throw _0x5f2611;}}function refreshOauth2MicrosoftAccessToken(_0x5252e0){return Promise['resolve']()[_0x1126('0x34')](function(){if(_0x5252e0[_0x1126('0x35')])return _0x5252e0;return db[_0x1126('0x36')]['findOne']({'where':{'id':_0x5252e0['id']},'raw':!![]});})[_0x1126('0x34')](function(_0x226afb){var _0x56f7f8={'grant_type':_0x1126('0x37'),'refresh_token':_0x226afb[_0x1126('0x38')],'scope':getAccessTokenScope(_0x226afb),'redirect_uri':_0x226afb[_0x1126('0x39')],'client_id':_0x226afb[_0x1126('0x21')],'client_secret':encryptor['decryptString'](_0x226afb['data3'])};var _0x2a7edc={'method':_0x1126('0x3a'),'uri':MICROSOFT_AUTH_URL[_0x1126('0x2a')](_0x1126('0x1c'),_0x226afb['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x56f7f8,'json':!![]};return rp(_0x2a7edc);})[_0x1126('0x34')](function(_0x6f4312){_0x5252e0[_0x1126('0x3b')]=_0x6f4312[_0x1126('0x3c')];_0x5252e0[_0x1126('0x38')]=_0x6f4312['refresh_token'];return db[_0x1126('0x36')][_0x1126('0x3d')]({'data5':_0x5252e0[_0x1126('0x3b')],'data6':_0x5252e0[_0x1126('0x38')]},{'where':{'id':_0x5252e0['id']}});})['then'](function(){return _0x5252e0;})['catch'](function(_0x22827a){logger[_0x1126('0x3e')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s',_0x5252e0['id'],_0x22827a);});}function getOauth2MicrosoftAccessToken(_0xde37cf,_0xf3c21b){var _0x11b0f6={'grant_type':'authorization_code','code':_0xde37cf,'scope':getAccessTokenScope(_0xf3c21b),'redirect_uri':_0xf3c21b['data4'],'client_id':_0xf3c21b[_0x1126('0x21')],'client_secret':encryptor[_0x1126('0x3f')](_0xf3c21b[_0x1126('0x35')])};var _0x156554={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x1126('0x2a')]('{TENANT_ID}',_0xf3c21b[_0x1126('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x11b0f6,'json':!![]};return rp(_0x156554);}function startRefreshInterval(_0x20e43a){var _0xfa96e0=schedule[_0x1126('0x40')];if(_0xfa96e0[_0x20e43a['id']])clearInterval(_0xfa96e0[_0x20e43a['id']]);_0xfa96e0[_0x20e43a['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x1126('0x41')](this,{'id':_0x20e43a['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0xfa96e0;}function startAllRefreshIntervals(){return db[_0x1126('0x36')][_0x1126('0x42')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x1126('0x34')](function(_0x397e3b){var _0x3469a2=_0x397e3b[_0x1126('0x14')](function(_0x3052f9){return refreshOauth2MicrosoftAccessToken(_0x3052f9)['then'](function(_0x1c8d8a){startRefreshInterval(_0x1c8d8a);});});return Promise[_0x1126('0x43')](_0x3469a2);})[_0x1126('0x44')](function(_0xf3a0bd){var _0xcf0483=_0xf3a0bd?util['inspect'](_0xf3a0bd,{'showHidden':![],'depth':null}):'';logger['error'](_0x1126('0x45'),_0xcf0483);});}module[_0x1126('0x46')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x2ef3=['value','oauth2Claims','replace','oauth2/','set','stringify','decode','payload','iss','aud','audience','unix','exp','resolve','then','data3','findOne','data6','decryptString','data5','access_token','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s','authorization_code','POST','{TENANT_ID}','intervals','CloudProvider','findAll','all','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','/authorize','/token','type','Dynamics365','push','join','Outlook365','data2','code','from','toString','base64','randomBytes','hex','data1','response_type','redirect_uri','data4','response_mode','state','nonce','prompt','map'];(function(_0x422102,_0x43aa77){var _0x4a2906=function(_0x588488){while(--_0x588488){_0x422102['push'](_0x422102['shift']());}};_0x4a2906(++_0x43aa77);}(_0x2ef3,0xba));var _0x32ef=function(_0x5ad87d,_0x2840e3){_0x5ad87d=_0x5ad87d-0x0;var _0x229d99=_0x2ef3[_0x5ad87d];return _0x229d99;};'use strict';var _=require(_0x32ef('0x0'));var crypto=require(_0x32ef('0x1'));var jwt=require(_0x32ef('0x2'));var moment=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var rp=require(_0x32ef('0x5'));var util=require('util');var encryptor=require(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var logger=require('../../config/logger')(_0x32ef('0x8'));var schedule=require(_0x32ef('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x32ef('0xa')](config[_0x32ef('0xb')],{'host':_0x32ef('0xc'),'port':0x18eb});var redis=new Redis(config[_0x32ef('0xb')]);var MICROSOFT_AUTH_URL=_0x32ef('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x32ef('0xe'),_0x32ef('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0x32ef('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x32ef('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5af651){var _0x193714=_['map'](AZURE_AUTH_SCOPES[_0x5af651[_0x32ef('0x15')]]);if(_0x5af651['type']===_0x32ef('0x16'))_0x193714[_0x32ef('0x17')](_0x5af651['data7']+'/.default');return _0x193714[_0x32ef('0x18')]('\x20');}function getAccessTokenScope(_0x4d8009){if(_0x4d8009[_0x32ef('0x15')]===_0x32ef('0x19'))return _0x32ef('0x12');if(_0x4d8009[_0x32ef('0x15')]==='Dynamics365')return _0x4d8009['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x13db1a,_0x3950e6){var _0xb5aed2=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x13db1a[_0x32ef('0x1a')]);var _0x1a9476=[_0x32ef('0x1b'),'id_token'];var _0xbe37f6=Buffer[_0x32ef('0x1c')](JSON['stringify']({'id':_0x3950e6}))[_0x32ef('0x1d')](_0x32ef('0x1e'));var _0x26aff3=crypto[_0x32ef('0x1f')](0x10)[_0x32ef('0x1d')](_0x32ef('0x20'));var _0x4de441=getAuthorizationScopes(_0x13db1a);var _0x3c5b78=[{'key':'client_id','value':_0x13db1a[_0x32ef('0x21')]},{'key':_0x32ef('0x22'),'value':encodeURIComponent(_0x1a9476['join']('\x20'))},{'key':_0x32ef('0x23'),'value':_0x13db1a[_0x32ef('0x24')]},{'key':_0x32ef('0x25'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x4de441)},{'key':_0x32ef('0x26'),'value':_0xbe37f6},{'key':_0x32ef('0x27'),'value':_0x26aff3},{'key':_0x32ef('0x28'),'value':'login'}];var _0x59585f=_0xb5aed2+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x32ef('0x29')](_0x3c5b78,function(_0x4d584b){return _0x4d584b['key']+'='+_0x4d584b[_0x32ef('0x2a')];})[_0x32ef('0x18')]('&');_0x13db1a[_0x32ef('0x2b')]={'issuer':_0xb5aed2[_0x32ef('0x2c')](_0x32ef('0x2d'),''),'audience':_0x13db1a[_0x32ef('0x21')],'state':_0xbe37f6,'nonce':_0x26aff3};redis[_0x32ef('0x2e')](_0xbe37f6,JSON[_0x32ef('0x2f')](_0x13db1a));return _0x59585f;}function isValidIdToken(_0x338f19,_0x2f52d7){try{var _0x1335e2=jwt[_0x32ef('0x30')](_0x338f19,{'complete':!![]});var _0x5a88a5=_0x1335e2[_0x32ef('0x31')];if(_0x5a88a5[_0x32ef('0x32')]!==_0x2f52d7['issuer'])return![];if(_0x5a88a5[_0x32ef('0x33')]!==_0x2f52d7[_0x32ef('0x34')])return![];if(_0x5a88a5[_0x32ef('0x27')]!==_0x2f52d7[_0x32ef('0x27')])return![];if(moment()['isAfter'](moment[_0x32ef('0x35')](_0x5a88a5[_0x32ef('0x36')])))return![];return!![];}catch(_0x31dbc3){throw _0x31dbc3;}}function refreshOauth2MicrosoftAccessToken(_0x2ac686){return Promise[_0x32ef('0x37')]()[_0x32ef('0x38')](function(){if(_0x2ac686[_0x32ef('0x39')])return _0x2ac686;return db['CloudProvider'][_0x32ef('0x3a')]({'where':{'id':_0x2ac686['id']},'raw':!![]});})['then'](function(_0x38bf73){var _0x2b6c6a={'grant_type':'refresh_token','refresh_token':_0x38bf73[_0x32ef('0x3b')],'scope':getAccessTokenScope(_0x38bf73),'redirect_uri':_0x38bf73[_0x32ef('0x24')],'client_id':_0x38bf73[_0x32ef('0x21')],'client_secret':encryptor[_0x32ef('0x3c')](_0x38bf73[_0x32ef('0x39')])};var _0x59a4a3={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x32ef('0x2c')]('{TENANT_ID}',_0x38bf73[_0x32ef('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2b6c6a,'json':!![]};return rp(_0x59a4a3);})[_0x32ef('0x38')](function(_0x2f1349){_0x2ac686[_0x32ef('0x3d')]=_0x2f1349[_0x32ef('0x3e')];_0x2ac686[_0x32ef('0x3b')]=_0x2f1349['refresh_token'];return db['CloudProvider']['update']({'data5':_0x2ac686[_0x32ef('0x3d')],'data6':_0x2ac686[_0x32ef('0x3b')]},{'where':{'id':_0x2ac686['id']}});})[_0x32ef('0x38')](function(){return _0x2ac686;})['catch'](function(_0x4fb402){logger[_0x32ef('0x3f')](_0x32ef('0x40'),_0x2ac686['id'],_0x4fb402);});}function getOauth2MicrosoftAccessToken(_0x410334,_0x480348){var _0x4abbd6={'grant_type':_0x32ef('0x41'),'code':_0x410334,'scope':getAccessTokenScope(_0x480348),'redirect_uri':_0x480348[_0x32ef('0x24')],'client_id':_0x480348[_0x32ef('0x21')],'client_secret':encryptor[_0x32ef('0x3c')](_0x480348[_0x32ef('0x39')])};var _0x211c79={'method':_0x32ef('0x42'),'uri':MICROSOFT_AUTH_URL[_0x32ef('0x2c')](_0x32ef('0x43'),_0x480348['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4abbd6,'json':!![]};return rp(_0x211c79);}function startRefreshInterval(_0x3a4a99){var _0x36e374=schedule[_0x32ef('0x44')];if(_0x36e374[_0x3a4a99['id']])clearInterval(_0x36e374[_0x3a4a99['id']]);_0x36e374[_0x3a4a99['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x3a4a99['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x32ef('0x44')]=_0x36e374;}function startAllRefreshIntervals(){return db[_0x32ef('0x45')][_0x32ef('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x32ef('0x38')](function(_0x1faf72){var _0x33a0fb=_0x1faf72[_0x32ef('0x29')](function(_0x1cebed){return refreshOauth2MicrosoftAccessToken(_0x1cebed)[_0x32ef('0x38')](function(_0x57a3c0){startRefreshInterval(_0x57a3c0);});});return Promise[_0x32ef('0x47')](_0x33a0fb);})[_0x32ef('0x48')](function(_0x48e071){var _0x3cac2e=_0x48e071?util[_0x32ef('0x49')](_0x48e071,{'showHidden':![],'depth':null}):'';logger[_0x32ef('0x3f')](_0x32ef('0x4a'),_0x3cac2e);});}module[_0x32ef('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 70bf0b7..339900e 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 _0x6337=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','CloudProvider,\x20%s,\x20%s'];(function(_0x3bcd63,_0xe31e5c){var _0xf1624f=function(_0x4654e0){while(--_0x4654e0){_0x3bcd63['push'](_0x3bcd63['shift']());}};_0xf1624f(++_0xe31e5c);}(_0x6337,0x18a));var _0x7633=function(_0x1613ec,_0x24ad98){_0x1613ec=_0x1613ec-0x0;var _0x90a695=_0x6337[_0x1613ec];return _0x90a695;};'use strict';var _=require('lodash');var util=require(_0x7633('0x0'));var moment=require(_0x7633('0x1'));var BPromise=require(_0x7633('0x2'));var rs=require(_0x7633('0x3'));var fs=require('fs');var Redis=require(_0x7633('0x4'));var db=require(_0x7633('0x5'))['db'];var utils=require(_0x7633('0x6'));var logger=require(_0x7633('0x7'))(_0x7633('0x8'));var config=require('../../config/environment');var jayson=require(_0x7633('0x9'));var client=jayson[_0x7633('0xa')][_0x7633('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x539d69,_0x1fee41,_0x4b9491){return new BPromise(function(_0x27baac,_0x14742c){return client['request'](_0x539d69,_0x4b9491)[_0x7633('0xc')](function(_0x547874){logger[_0x7633('0xd')]('CloudProvider,\x20%s,\x20%s',_0x1fee41,_0x7633('0xe'));logger[_0x7633('0xf')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x1fee41,_0x7633('0xe'),JSON[_0x7633('0x10')](_0x547874));if(_0x547874[_0x7633('0x11')]){if(_0x547874['error'][_0x7633('0x12')]===0x1f4){logger[_0x7633('0x11')](_0x7633('0x13'),_0x1fee41,_0x547874['error'][_0x7633('0x14')]);return _0x14742c(_0x547874[_0x7633('0x11')][_0x7633('0x14')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x1fee41,_0x547874['error'][_0x7633('0x14')]);return _0x27baac(_0x547874[_0x7633('0x11')][_0x7633('0x14')]);}else{logger[_0x7633('0xd')](_0x7633('0x13'),_0x1fee41,_0x7633('0xe'));_0x27baac(_0x547874[_0x7633('0x15')][_0x7633('0x14')]);}})[_0x7633('0x16')](function(_0x5cbd62){logger[_0x7633('0x11')](_0x7633('0x13'),_0x1fee41,_0x5cbd62);_0x14742c(_0x5cbd62);});});} \ No newline at end of file +var _0x6db4=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird'];(function(_0x13e97c,_0x3c4ad2){var _0x213d81=function(_0x2f4e05){while(--_0x2f4e05){_0x13e97c['push'](_0x13e97c['shift']());}};_0x213d81(++_0x3c4ad2);}(_0x6db4,0x111));var _0x46db=function(_0x5b36af,_0x3ea3f0){_0x5b36af=_0x5b36af-0x0;var _0x2a6901=_0x6db4[_0x5b36af];return _0x2a6901;};'use strict';var _=require('lodash');var util=require(_0x46db('0x0'));var moment=require(_0x46db('0x1'));var BPromise=require(_0x46db('0x2'));var rs=require(_0x46db('0x3'));var fs=require('fs');var Redis=require(_0x46db('0x4'));var db=require(_0x46db('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x46db('0x6'))(_0x46db('0x7'));var config=require(_0x46db('0x8'));var jayson=require(_0x46db('0x9'));var client=jayson[_0x46db('0xa')][_0x46db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23de32,_0x5409cd,_0x3a2dcb){return new BPromise(function(_0x2a597d,_0x27b949){return client[_0x46db('0xc')](_0x23de32,_0x3a2dcb)[_0x46db('0xd')](function(_0x427c62){logger[_0x46db('0xe')](_0x46db('0xf'),_0x5409cd,_0x46db('0x10'));logger[_0x46db('0x11')](_0x46db('0x12'),_0x5409cd,_0x46db('0x10'),JSON['stringify'](_0x427c62));if(_0x427c62[_0x46db('0x13')]){if(_0x427c62[_0x46db('0x13')][_0x46db('0x14')]===0x1f4){logger[_0x46db('0x13')](_0x46db('0xf'),_0x5409cd,_0x427c62[_0x46db('0x13')][_0x46db('0x15')]);return _0x27b949(_0x427c62[_0x46db('0x13')][_0x46db('0x15')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x5409cd,_0x427c62['error'][_0x46db('0x15')]);return _0x2a597d(_0x427c62[_0x46db('0x13')]['message']);}else{logger[_0x46db('0xe')]('CloudProvider,\x20%s,\x20%s',_0x5409cd,_0x46db('0x10'));_0x2a597d(_0x427c62['result'][_0x46db('0x15')]);}})[_0x46db('0x16')](function(_0x5a75fb){logger[_0x46db('0x13')](_0x46db('0xf'),_0x5409cd,_0x5a75fb);_0x27b949(_0x5a75fb);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index e8027d2..4ba62a7 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x1208ef,_0x42c6d3){var _0x1ea522=function(_0x487a86){while(--_0x487a86){_0x1208ef['push'](_0x1208ef['shift']());}};_0x1ea522(++_0x42c6d3);}(_0xdb28,0x106));var _0x8db2=function(_0x3f3e81,_0x333fb0){_0x3f3e81=_0x3f3e81-0x0;var _0x563254=_0xdb28[_0x3f3e81];return _0x563254;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x351b46,_0x26b265){var _0x1515df=function(_0x22896a){while(--_0x22896a){_0x351b46['push'](_0x351b46['shift']());}};_0x1515df(++_0x26b265);}(_0x5f2f,0x73));var _0xf5f2=function(_0x17c118,_0x391c66){_0x17c118=_0x17c118-0x0;var _0x42c295=_0x5f2f[_0x17c118];return _0x42c295;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index f40cb25..e8a74ab 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 _0xff5f=['name','STRING','sequelize'];(function(_0x4da550,_0x3e1509){var _0xc58226=function(_0x1c30a6){while(--_0x1c30a6){_0x4da550['push'](_0x4da550['shift']());}};_0xc58226(++_0x3e1509);}(_0xff5f,0x128));var _0xfff5=function(_0x44b508,_0x295d99){_0x44b508=_0x44b508-0x0;var _0x653255=_0xff5f[_0x44b508];return _0x653255;};'use strict';var Sequelize=require(_0xfff5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xfff5('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xfff5('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xfff5('0x2')]},'phone':{'type':Sequelize[_0xfff5('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xfff5('0x2')]},'street':{'type':Sequelize[_0xfff5('0x2')]},'postalCode':{'type':Sequelize[_0xfff5('0x2')]},'city':{'type':Sequelize[_0xfff5('0x2')]},'country':{'type':Sequelize[_0xfff5('0x2')]},'email':{'type':Sequelize[_0xfff5('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xfff5('0x2')]},'sCity':{'type':Sequelize[_0xfff5('0x2')]},'sCountry':{'type':Sequelize[_0xfff5('0x2')]},'description':{'type':Sequelize[_0xfff5('0x2')]}}; \ No newline at end of file +var _0x0447=['exports','STRING','name','sequelize'];(function(_0x31e630,_0x2c8b92){var _0xd9b265=function(_0x38bae2){while(--_0x38bae2){_0x31e630['push'](_0x31e630['shift']());}};_0xd9b265(++_0x2c8b92);}(_0x0447,0x133));var _0x7044=function(_0x5e1a3e,_0xaf5f51){_0x5e1a3e=_0x5e1a3e-0x0;var _0x3a04b4=_0x0447[_0x5e1a3e];return _0x3a04b4;};'use strict';var Sequelize=require(_0x7044('0x0'));module[_0x7044('0x1')]={'name':{'type':Sequelize[_0x7044('0x2')],'unique':_0x7044('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7044('0x2')]},'companyId':{'type':Sequelize[_0x7044('0x2')]},'website':{'type':Sequelize[_0x7044('0x2')]},'phone':{'type':Sequelize[_0x7044('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7044('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x7044('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7044('0x2')]},'email':{'type':Sequelize[_0x7044('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7044('0x2')]},'sStreet':{'type':Sequelize[_0x7044('0x2')]},'sPostalCode':{'type':Sequelize[_0x7044('0x2')]},'sCity':{'type':Sequelize[_0x7044('0x2')]},'sCountry':{'type':Sequelize[_0x7044('0x2')]},'description':{'type':Sequelize[_0x7044('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 5a4c5e2..2df4759 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 _0x8d0d=['describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','map','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','addContacts','ids','omit','CmContact','sort','filter','getContacts','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','Companies','UserProfileResource','stack','name','send','index','CmCompany'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x8d0d,0x185));var _0xd8d0=function(_0x6c4ec7,_0x5c8bae){_0x6c4ec7=_0x6c4ec7-0x0;var _0x351492=_0x8d0d[_0x6c4ec7];return _0x351492;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd8d0('0x0'));var zipdir=require(_0xd8d0('0x1'));var jsonpatch=require(_0xd8d0('0x2'));var rp=require(_0xd8d0('0x3'));var moment=require(_0xd8d0('0x4'));var BPromise=require(_0xd8d0('0x5'));var Mustache=require(_0xd8d0('0x6'));var util=require(_0xd8d0('0x7'));var path=require('path');var sox=require(_0xd8d0('0x8'));var csv=require(_0xd8d0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8d0('0xa'));var _=require(_0xd8d0('0xb'));var squel=require(_0xd8d0('0xc'));var crypto=require(_0xd8d0('0xd'));var jsforce=require(_0xd8d0('0xe'));var deskjs=require(_0xd8d0('0xf'));var toCsv=require(_0xd8d0('0x9'));var querystring=require('querystring');var Papa=require(_0xd8d0('0x10'));var Redis=require(_0xd8d0('0x11'));var authService=require(_0xd8d0('0x12'));var qs=require(_0xd8d0('0x13'));var as=require(_0xd8d0('0x14'));var hardwareService=require(_0xd8d0('0x15'));var logger=require(_0xd8d0('0x16'))(_0xd8d0('0x17'));var utils=require(_0xd8d0('0x18'));var config=require(_0xd8d0('0x19'));var licenseUtil=require(_0xd8d0('0x1a'));var db=require(_0xd8d0('0x1b'))['db'];function respondWithStatusCode(_0x58926d,_0x317636){_0x317636=_0x317636||0xcc;return function(_0x40173d){if(_0x40173d){return _0x58926d[_0xd8d0('0x1c')](_0x317636);}return _0x58926d[_0xd8d0('0x1d')](_0x317636)[_0xd8d0('0x1e')]();};}function respondWithResult(_0xa49532,_0x2ca862){_0x2ca862=_0x2ca862||0xc8;return function(_0x416af2){if(_0x416af2){return _0xa49532['status'](_0x2ca862)[_0xd8d0('0x1f')](_0x416af2);}};}function respondWithFilteredResult(_0x44491d,_0x21c5ca){return function(_0x512215){if(_0x512215){var _0x5cb926=typeof _0x21c5ca[_0xd8d0('0x20')]==='undefined'&&typeof _0x21c5ca[_0xd8d0('0x21')]===_0xd8d0('0x22');var _0x3cadcb=_0x512215[_0xd8d0('0x23')];var _0x23dbbc=_0x5cb926?0x0:_0x21c5ca[_0xd8d0('0x20')];var _0x2b424c=_0x5cb926?_0x512215[_0xd8d0('0x23')]:_0x21c5ca[_0xd8d0('0x20')]+_0x21c5ca['limit'];var _0x950912;if(_0x2b424c>=_0x3cadcb){_0x2b424c=_0x3cadcb;_0x950912=0xc8;}else{_0x950912=0xce;}_0x44491d[_0xd8d0('0x1d')](_0x950912);return _0x44491d['set'](_0xd8d0('0x24'),_0x23dbbc+'-'+_0x2b424c+'/'+_0x3cadcb)[_0xd8d0('0x1f')](_0x512215);}return null;};}function patchUpdates(_0x3ca078){return function(_0x26dac6){try{jsonpatch['apply'](_0x26dac6,_0x3ca078,!![]);}catch(_0x1f1c39){return BPromise['reject'](_0x1f1c39);}return _0x26dac6['save']();};}function saveUpdates(_0x4ea9d4,_0x2d64d0){return function(_0x202ef3){if(_0x202ef3){return _0x202ef3['update'](_0x4ea9d4)[_0xd8d0('0x25')](function(_0x4155a5){return _0x4155a5;});}return null;};}function removeEntity(_0x56b655,_0x312455){return function(_0x492536){if(_0x492536){return _0x492536[_0xd8d0('0x26')]()[_0xd8d0('0x25')](function(){var _0x25fed3=_0x492536['get']({'plain':!![]});var _0x3d0547=_0xd8d0('0x27');return db[_0xd8d0('0x28')][_0xd8d0('0x26')]({'where':{'type':_0x3d0547,'resourceId':_0x25fed3['id']}})[_0xd8d0('0x25')](function(){return _0x492536;});})['then'](function(){_0x56b655[_0xd8d0('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x315fc9,_0x17ff80){return function(_0x1554cc){if(!_0x1554cc){_0x315fc9[_0xd8d0('0x1c')](0x194);}return _0x1554cc;};}function handleError(_0x1bffdc,_0x1b228e){_0x1b228e=_0x1b228e||0x1f4;return function(_0x245f02){logger['error'](_0x245f02[_0xd8d0('0x29')]);if(_0x245f02[_0xd8d0('0x2a')]){delete _0x245f02[_0xd8d0('0x2a')];}_0x1bffdc[_0xd8d0('0x1d')](_0x1b228e)[_0xd8d0('0x2b')](_0x245f02);};}exports[_0xd8d0('0x2c')]=function(_0x1189ba,_0x5bf63e){var _0x2cf5ba={},_0x2a03da={},_0x6338e4={'count':0x0,'rows':[]};return db[_0xd8d0('0x2d')][_0xd8d0('0x2e')]()[_0xd8d0('0x25')](function(_0x2d2f84){_0x2a03da[_0xd8d0('0x2f')]=_[_0xd8d0('0x30')](_0x2d2f84);_0x2a03da[_0xd8d0('0x31')]=_[_0xd8d0('0x30')](_0x1189ba['query']);_0x2a03da[_0xd8d0('0x32')]=_[_0xd8d0('0x33')](_0x2a03da[_0xd8d0('0x2f')],_0x2a03da[_0xd8d0('0x31')]);_0x2cf5ba[_0xd8d0('0x34')]=_[_0xd8d0('0x33')](_0x2a03da[_0xd8d0('0x2f')],qs[_0xd8d0('0x35')](_0x1189ba[_0xd8d0('0x31')]['fields']));_0x2cf5ba[_0xd8d0('0x34')]=_0x2cf5ba[_0xd8d0('0x34')][_0xd8d0('0x36')]?_0x2cf5ba[_0xd8d0('0x34')]:_0x2a03da[_0xd8d0('0x2f')];if(!_0x1189ba[_0xd8d0('0x31')][_0xd8d0('0x37')](_0xd8d0('0x38'))){_0x2cf5ba[_0xd8d0('0x21')]=qs[_0xd8d0('0x21')](_0x1189ba[_0xd8d0('0x31')][_0xd8d0('0x21')]);_0x2cf5ba[_0xd8d0('0x20')]=qs[_0xd8d0('0x20')](_0x1189ba['query'][_0xd8d0('0x20')]);}_0x2cf5ba[_0xd8d0('0x39')]=qs['sort'](_0x1189ba[_0xd8d0('0x31')]['sort']);_0x2cf5ba[_0xd8d0('0x3a')]=qs[_0xd8d0('0x32')](_[_0xd8d0('0x3b')](_0x1189ba[_0xd8d0('0x31')],_0x2a03da['filters']),_0x2d2f84);if(_0x1189ba[_0xd8d0('0x31')]['filter']){_0x2cf5ba[_0xd8d0('0x3a')]=_[_0xd8d0('0x3c')](_0x2cf5ba[_0xd8d0('0x3a')],{'$or':_[_0xd8d0('0x3d')](_0x2cf5ba[_0xd8d0('0x34')],function(_0x51675a){var _0x435dc5={};_0x435dc5[_0x51675a]={'$like':'%'+_0x1189ba['query']['filter']+'%'};return _0x435dc5;})});}_0x2cf5ba=_[_0xd8d0('0x3c')]({},_0x2cf5ba,_0x1189ba[_0xd8d0('0x3e')]);var _0x19daaa={'where':_0x2cf5ba[_0xd8d0('0x3a')]};return db['CmCompany'][_0xd8d0('0x23')](_0x19daaa)['then'](function(_0x1c11f8){_0x6338e4[_0xd8d0('0x23')]=_0x1c11f8;if(_0x1189ba[_0xd8d0('0x31')][_0xd8d0('0x3f')]){_0x2cf5ba[_0xd8d0('0x40')]=[{'all':!![]}];}return db[_0xd8d0('0x2d')]['findAll'](_0x2cf5ba);})['then'](function(_0x1a194f){_0x6338e4[_0xd8d0('0x41')]=_0x1a194f;return _0x6338e4;})[_0xd8d0('0x25')](respondWithFilteredResult(_0x5bf63e,_0x2cf5ba))[_0xd8d0('0x42')](handleError(_0x5bf63e,null));})[_0xd8d0('0x42')](handleError(_0x5bf63e,null));};exports[_0xd8d0('0x43')]=function(_0xadc74,_0x13dd0a){var _0x2f1605={'raw':![],'where':{'id':_0xadc74[_0xd8d0('0x44')]['id']}},_0x4fffae={};_0x4fffae[_0xd8d0('0x2f')]=_[_0xd8d0('0x30')](db[_0xd8d0('0x2d')][_0xd8d0('0x45')]);_0x4fffae[_0xd8d0('0x31')]=_[_0xd8d0('0x30')](_0xadc74[_0xd8d0('0x31')]);_0x4fffae[_0xd8d0('0x32')]=_[_0xd8d0('0x33')](_0x4fffae[_0xd8d0('0x2f')],_0x4fffae[_0xd8d0('0x31')]);_0x2f1605[_0xd8d0('0x34')]=_[_0xd8d0('0x33')](_0x4fffae[_0xd8d0('0x2f')],qs[_0xd8d0('0x35')](_0xadc74[_0xd8d0('0x31')]['fields']));_0x2f1605[_0xd8d0('0x34')]=_0x2f1605['attributes'][_0xd8d0('0x36')]?_0x2f1605[_0xd8d0('0x34')]:_0x4fffae['model'];if(_0xadc74[_0xd8d0('0x31')][_0xd8d0('0x3f')]){_0x2f1605['include']=[{'all':!![]}];}_0x2f1605=_['merge']({},_0x2f1605,_0xadc74[_0xd8d0('0x3e')]);return db[_0xd8d0('0x2d')]['find'](_0x2f1605)['then'](handleEntityNotFound(_0x13dd0a,null))['then'](respondWithResult(_0x13dd0a,null))[_0xd8d0('0x42')](handleError(_0x13dd0a,null));};exports[_0xd8d0('0x46')]=function(_0x46cba4,_0xb052a3){return db[_0xd8d0('0x2d')][_0xd8d0('0x46')](_0x46cba4[_0xd8d0('0x47')],{})['then'](function(_0x15ac38){var _0x30e715=_0x46cba4[_0xd8d0('0x48')]['get']({'plain':!![]});if(!_0x30e715)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30e715[_0xd8d0('0x49')]===_0xd8d0('0x48')){var _0x23ae7a=_0x15ac38['get']({'plain':!![]});var _0x229efc='Companies';return db[_0xd8d0('0x4a')]['find']({'where':{'name':_0x229efc,'userProfileId':_0x30e715[_0xd8d0('0x4b')]},'raw':!![]})['then'](function(_0x1c9aeb){if(_0x1c9aeb&&_0x1c9aeb['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x23ae7a[_0xd8d0('0x2a')],'resourceId':_0x23ae7a['id'],'type':_0x1c9aeb['name'],'sectionId':_0x1c9aeb['id']},{})[_0xd8d0('0x25')](function(){return _0x15ac38;});}else{return _0x15ac38;}})[_0xd8d0('0x42')](function(_0x17d8f8){logger[_0xd8d0('0x4c')](_0xd8d0('0x4d'),_0x17d8f8);throw _0x17d8f8;});}return _0x15ac38;})[_0xd8d0('0x25')](respondWithResult(_0xb052a3,0xc9))[_0xd8d0('0x42')](handleError(_0xb052a3,null));};exports[_0xd8d0('0x4e')]=function(_0x2dcbed,_0x495a79){if(_0x2dcbed[_0xd8d0('0x47')]['id']){delete _0x2dcbed[_0xd8d0('0x47')]['id'];}return db[_0xd8d0('0x2d')][_0xd8d0('0x4f')]({'where':{'id':_0x2dcbed['params']['id']}})['then'](handleEntityNotFound(_0x495a79,null))[_0xd8d0('0x25')](saveUpdates(_0x2dcbed[_0xd8d0('0x47')],null))[_0xd8d0('0x25')](respondWithResult(_0x495a79,null))[_0xd8d0('0x42')](handleError(_0x495a79,null));};exports['destroy']=function(_0x476119,_0xf4234f){return db[_0xd8d0('0x2d')][_0xd8d0('0x4f')]({'where':{'id':_0x476119[_0xd8d0('0x44')]['id']}})[_0xd8d0('0x25')](handleEntityNotFound(_0xf4234f,null))['then'](removeEntity(_0xf4234f,null))[_0xd8d0('0x42')](handleError(_0xf4234f,null));};exports['describe']=function(_0x2c67c2,_0x32be93){return db[_0xd8d0('0x2d')][_0xd8d0('0x2e')]()[_0xd8d0('0x25')](respondWithResult(_0x32be93,null))[_0xd8d0('0x42')](handleError(_0x32be93,null));};exports[_0xd8d0('0x50')]=function(_0x129dfb,_0xc1f658,_0x180be7){return db['CmContact'][_0xd8d0('0x4f')]({'where':{'id':_0x129dfb['params']['id']}})['then'](handleEntityNotFound(_0xc1f658,null))[_0xd8d0('0x25')](function(_0x53df1e){if(_0x53df1e){return _0x53df1e[_0xd8d0('0x50')](_0x129dfb['body'][_0xd8d0('0x51')],_[_0xd8d0('0x52')](_0x129dfb[_0xd8d0('0x47')],['ids','id'])||{});}})[_0xd8d0('0x25')](respondWithResult(_0xc1f658,null))['catch'](handleError(_0xc1f658,null));};exports['getContacts']=function(_0x124645,_0x4e279f,_0x46f208){var _0x1a4b1f={};var _0x4de90d={};var _0x2029c4;var _0x4fc569;return db[_0xd8d0('0x2d')]['findOne']({'where':{'id':_0x124645[_0xd8d0('0x44')]['id']}})['then'](handleEntityNotFound(_0x4e279f,null))['then'](function(_0x3d2756){if(_0x3d2756){_0x2029c4=_0x3d2756;_0x4de90d[_0xd8d0('0x2f')]=_['keys'](db[_0xd8d0('0x53')][_0xd8d0('0x45')]);_0x4de90d['query']=_[_0xd8d0('0x30')](_0x124645[_0xd8d0('0x31')]);_0x4de90d['filters']=_['intersection'](_0x4de90d['model'],_0x4de90d['query']);_0x1a4b1f['attributes']=_[_0xd8d0('0x33')](_0x4de90d[_0xd8d0('0x2f')],qs['fields'](_0x124645[_0xd8d0('0x31')][_0xd8d0('0x35')]));_0x1a4b1f[_0xd8d0('0x34')]=_0x1a4b1f[_0xd8d0('0x34')][_0xd8d0('0x36')]?_0x1a4b1f[_0xd8d0('0x34')]:_0x4de90d[_0xd8d0('0x2f')];_0x1a4b1f['order']=qs[_0xd8d0('0x54')](_0x124645[_0xd8d0('0x31')]['sort']);_0x1a4b1f[_0xd8d0('0x3a')]=qs[_0xd8d0('0x32')](_[_0xd8d0('0x3b')](_0x124645[_0xd8d0('0x31')],_0x4de90d['filters']));if(_0x124645['query']['filter']){_0x1a4b1f['where']=_[_0xd8d0('0x3c')](_0x1a4b1f[_0xd8d0('0x3a')],{'$or':_[_0xd8d0('0x3d')](_0x1a4b1f['attributes'],function(_0x59a999){var _0xb28426={};_0xb28426[_0x59a999]={'$like':'%'+_0x124645[_0xd8d0('0x31')][_0xd8d0('0x55')]+'%'};return _0xb28426;})});}_0x1a4b1f=_[_0xd8d0('0x3c')]({},_0x1a4b1f,_0x124645[_0xd8d0('0x3e')]);return _0x2029c4['getContacts'](_0x1a4b1f);}})[_0xd8d0('0x25')](function(_0x431938){if(_0x431938){_0x4fc569=_0x431938['length'];if(!_0x124645[_0xd8d0('0x31')]['hasOwnProperty'](_0xd8d0('0x38'))){_0x1a4b1f[_0xd8d0('0x21')]=qs[_0xd8d0('0x21')](_0x124645[_0xd8d0('0x31')]['limit']);_0x1a4b1f['offset']=qs[_0xd8d0('0x20')](_0x124645[_0xd8d0('0x31')][_0xd8d0('0x20')]);}return _0x2029c4[_0xd8d0('0x56')](_0x1a4b1f);}})[_0xd8d0('0x25')](function(_0x10784d){if(_0x10784d){return _0x10784d?{'count':_0x4fc569,'rows':_0x10784d}:null;}})[_0xd8d0('0x25')](respondWithResult(_0x4e279f,null))[_0xd8d0('0x42')](handleError(_0x4e279f,null));}; \ No newline at end of file +var _0x803e=['length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','options','includeAll','findAll','rows','catch','rawAttributes','include','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContact','addContacts','ids','findOne','pick','getContacts','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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/license/util','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','apply','save','update','then','get','destroy','sendStatus','stack','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields'];(function(_0x21065c,_0x559d23){var _0x31417a=function(_0x3d6c87){while(--_0x3d6c87){_0x21065c['push'](_0x21065c['shift']());}};_0x31417a(++_0x559d23);}(_0x803e,0x12e));var _0xe803=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x803e[_0x500419];return _0x241c1a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe803('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe803('0x1'));var rp=require(_0xe803('0x2'));var moment=require(_0xe803('0x3'));var BPromise=require(_0xe803('0x4'));var Mustache=require(_0xe803('0x5'));var util=require(_0xe803('0x6'));var path=require(_0xe803('0x7'));var sox=require(_0xe803('0x8'));var csv=require(_0xe803('0x9'));var ejs=require(_0xe803('0xa'));var fs=require('fs');var fs_extra=require(_0xe803('0xb'));var _=require(_0xe803('0xc'));var squel=require('squel');var crypto=require(_0xe803('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe803('0xe'));var toCsv=require(_0xe803('0x9'));var querystring=require(_0xe803('0xf'));var Papa=require(_0xe803('0x10'));var Redis=require(_0xe803('0x11'));var authService=require(_0xe803('0x12'));var qs=require(_0xe803('0x13'));var as=require(_0xe803('0x14'));var hardwareService=require(_0xe803('0x15'));var logger=require(_0xe803('0x16'))(_0xe803('0x17'));var utils=require(_0xe803('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe803('0x19'));var db=require(_0xe803('0x1a'))['db'];function respondWithStatusCode(_0x3c8352,_0x17618e){_0x17618e=_0x17618e||0xcc;return function(_0x16efe0){if(_0x16efe0){return _0x3c8352['sendStatus'](_0x17618e);}return _0x3c8352['status'](_0x17618e)[_0xe803('0x1b')]();};}function respondWithResult(_0x4dee95,_0x1449c8){_0x1449c8=_0x1449c8||0xc8;return function(_0x5da7f1){if(_0x5da7f1){return _0x4dee95[_0xe803('0x1c')](_0x1449c8)[_0xe803('0x1d')](_0x5da7f1);}};}function respondWithFilteredResult(_0x37f02b,_0x446a19){return function(_0x3d5d6a){if(_0x3d5d6a){var _0x46e652=typeof _0x446a19[_0xe803('0x1e')]==='undefined'&&typeof _0x446a19[_0xe803('0x1f')]==='undefined';var _0x417ff7=_0x3d5d6a[_0xe803('0x20')];var _0x470871=_0x46e652?0x0:_0x446a19[_0xe803('0x1e')];var _0x2c2a0c=_0x46e652?_0x3d5d6a[_0xe803('0x20')]:_0x446a19[_0xe803('0x1e')]+_0x446a19['limit'];var _0x5688aa;if(_0x2c2a0c>=_0x417ff7){_0x2c2a0c=_0x417ff7;_0x5688aa=0xc8;}else{_0x5688aa=0xce;}_0x37f02b['status'](_0x5688aa);return _0x37f02b[_0xe803('0x21')](_0xe803('0x22'),_0x470871+'-'+_0x2c2a0c+'/'+_0x417ff7)['json'](_0x3d5d6a);}return null;};}function patchUpdates(_0x5613ea){return function(_0x5edecf){try{jsonpatch[_0xe803('0x23')](_0x5edecf,_0x5613ea,!![]);}catch(_0xbb6497){return BPromise['reject'](_0xbb6497);}return _0x5edecf[_0xe803('0x24')]();};}function saveUpdates(_0x33f73e,_0x1e7243){return function(_0x15d43c){if(_0x15d43c){return _0x15d43c[_0xe803('0x25')](_0x33f73e)['then'](function(_0x312fad){return _0x312fad;});}return null;};}function removeEntity(_0x2953a1,_0x2f2b8e){return function(_0x3995d3){if(_0x3995d3){return _0x3995d3['destroy']()[_0xe803('0x26')](function(){var _0x67d9c8=_0x3995d3[_0xe803('0x27')]({'plain':!![]});var _0x29e0a2='Companies';return db['UserProfileResource'][_0xe803('0x28')]({'where':{'type':_0x29e0a2,'resourceId':_0x67d9c8['id']}})[_0xe803('0x26')](function(){return _0x3995d3;});})[_0xe803('0x26')](function(){_0x2953a1[_0xe803('0x1c')](0xcc)[_0xe803('0x1b')]();});}};}function handleEntityNotFound(_0x52e094,_0x409896){return function(_0x532478){if(!_0x532478){_0x52e094[_0xe803('0x29')](0x194);}return _0x532478;};}function handleError(_0x4285fa,_0x2b77c2){_0x2b77c2=_0x2b77c2||0x1f4;return function(_0x2a76b2){logger['error'](_0x2a76b2[_0xe803('0x2a')]);if(_0x2a76b2[_0xe803('0x2b')]){delete _0x2a76b2[_0xe803('0x2b')];}_0x4285fa['status'](_0x2b77c2)[_0xe803('0x2c')](_0x2a76b2);};}exports[_0xe803('0x2d')]=function(_0x43d95d,_0x41964a){var _0x333485={},_0x9b8f41={},_0xd68dd={'count':0x0,'rows':[]};return db[_0xe803('0x2e')][_0xe803('0x2f')]()['then'](function(_0x29b567){_0x9b8f41[_0xe803('0x30')]=_[_0xe803('0x31')](_0x29b567);_0x9b8f41[_0xe803('0x32')]=_[_0xe803('0x31')](_0x43d95d[_0xe803('0x32')]);_0x9b8f41['filters']=_[_0xe803('0x33')](_0x9b8f41[_0xe803('0x30')],_0x9b8f41[_0xe803('0x32')]);_0x333485[_0xe803('0x34')]=_[_0xe803('0x33')](_0x9b8f41[_0xe803('0x30')],qs[_0xe803('0x35')](_0x43d95d['query'][_0xe803('0x35')]));_0x333485[_0xe803('0x34')]=_0x333485[_0xe803('0x34')][_0xe803('0x36')]?_0x333485[_0xe803('0x34')]:_0x9b8f41['model'];if(!_0x43d95d[_0xe803('0x32')][_0xe803('0x37')](_0xe803('0x38'))){_0x333485['limit']=qs[_0xe803('0x1f')](_0x43d95d[_0xe803('0x32')]['limit']);_0x333485[_0xe803('0x1e')]=qs[_0xe803('0x1e')](_0x43d95d[_0xe803('0x32')][_0xe803('0x1e')]);}_0x333485[_0xe803('0x39')]=qs['sort'](_0x43d95d[_0xe803('0x32')][_0xe803('0x3a')]);_0x333485[_0xe803('0x3b')]=qs[_0xe803('0x3c')](_['pick'](_0x43d95d[_0xe803('0x32')],_0x9b8f41[_0xe803('0x3c')]),_0x29b567);if(_0x43d95d['query'][_0xe803('0x3d')]){_0x333485[_0xe803('0x3b')]=_[_0xe803('0x3e')](_0x333485['where'],{'$or':_[_0xe803('0x3f')](_0x333485[_0xe803('0x34')],function(_0x4ac58e){var _0xbfacb3={};_0xbfacb3[_0x4ac58e]={'$like':'%'+_0x43d95d['query'][_0xe803('0x3d')]+'%'};return _0xbfacb3;})});}_0x333485=_[_0xe803('0x3e')]({},_0x333485,_0x43d95d[_0xe803('0x40')]);var _0x4e4fed={'where':_0x333485[_0xe803('0x3b')]};return db[_0xe803('0x2e')]['count'](_0x4e4fed)[_0xe803('0x26')](function(_0x27ada8){_0xd68dd[_0xe803('0x20')]=_0x27ada8;if(_0x43d95d[_0xe803('0x32')][_0xe803('0x41')]){_0x333485['include']=[{'all':!![]}];}return db[_0xe803('0x2e')][_0xe803('0x42')](_0x333485);})['then'](function(_0xffe2dd){_0xd68dd[_0xe803('0x43')]=_0xffe2dd;return _0xd68dd;})['then'](respondWithFilteredResult(_0x41964a,_0x333485))[_0xe803('0x44')](handleError(_0x41964a,null));})[_0xe803('0x44')](handleError(_0x41964a,null));};exports['show']=function(_0x48f4b8,_0x212ba2){var _0x274ab4={'raw':![],'where':{'id':_0x48f4b8['params']['id']}},_0x1a33ba={};_0x1a33ba[_0xe803('0x30')]=_['keys'](db['CmCompany'][_0xe803('0x45')]);_0x1a33ba[_0xe803('0x32')]=_[_0xe803('0x31')](_0x48f4b8[_0xe803('0x32')]);_0x1a33ba['filters']=_[_0xe803('0x33')](_0x1a33ba[_0xe803('0x30')],_0x1a33ba[_0xe803('0x32')]);_0x274ab4[_0xe803('0x34')]=_[_0xe803('0x33')](_0x1a33ba[_0xe803('0x30')],qs[_0xe803('0x35')](_0x48f4b8[_0xe803('0x32')]['fields']));_0x274ab4[_0xe803('0x34')]=_0x274ab4['attributes'][_0xe803('0x36')]?_0x274ab4['attributes']:_0x1a33ba[_0xe803('0x30')];if(_0x48f4b8[_0xe803('0x32')][_0xe803('0x41')]){_0x274ab4[_0xe803('0x46')]=[{'all':!![]}];}_0x274ab4=_[_0xe803('0x3e')]({},_0x274ab4,_0x48f4b8[_0xe803('0x40')]);return db[_0xe803('0x2e')]['find'](_0x274ab4)[_0xe803('0x26')](handleEntityNotFound(_0x212ba2,null))[_0xe803('0x26')](respondWithResult(_0x212ba2,null))['catch'](handleError(_0x212ba2,null));};exports['create']=function(_0x2111d8,_0x32c501){return db['CmCompany'][_0xe803('0x47')](_0x2111d8[_0xe803('0x48')],{})[_0xe803('0x26')](function(_0xde157f){var _0x33c1c7=_0x2111d8[_0xe803('0x49')][_0xe803('0x27')]({'plain':!![]});if(!_0x33c1c7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33c1c7[_0xe803('0x4a')]===_0xe803('0x49')){var _0xaf5c7b=_0xde157f[_0xe803('0x27')]({'plain':!![]});var _0x2c345='Companies';return db[_0xe803('0x4b')][_0xe803('0x4c')]({'where':{'name':_0x2c345,'userProfileId':_0x33c1c7[_0xe803('0x4d')]},'raw':!![]})['then'](function(_0x236324){if(_0x236324&&_0x236324[_0xe803('0x4e')]===0x0){return db[_0xe803('0x4f')][_0xe803('0x47')]({'name':_0xaf5c7b['name'],'resourceId':_0xaf5c7b['id'],'type':_0x236324[_0xe803('0x2b')],'sectionId':_0x236324['id']},{})[_0xe803('0x26')](function(){return _0xde157f;});}else{return _0xde157f;}})[_0xe803('0x44')](function(_0x1bf794){logger[_0xe803('0x50')](_0xe803('0x51'),_0x1bf794);throw _0x1bf794;});}return _0xde157f;})[_0xe803('0x26')](respondWithResult(_0x32c501,0xc9))['catch'](handleError(_0x32c501,null));};exports[_0xe803('0x25')]=function(_0x531c6b,_0x209cef){if(_0x531c6b['body']['id']){delete _0x531c6b[_0xe803('0x48')]['id'];}return db[_0xe803('0x2e')][_0xe803('0x4c')]({'where':{'id':_0x531c6b[_0xe803('0x52')]['id']}})[_0xe803('0x26')](handleEntityNotFound(_0x209cef,null))[_0xe803('0x26')](saveUpdates(_0x531c6b['body'],null))['then'](respondWithResult(_0x209cef,null))[_0xe803('0x44')](handleError(_0x209cef,null));};exports['destroy']=function(_0x43caeb,_0x15c67b){return db[_0xe803('0x2e')][_0xe803('0x4c')]({'where':{'id':_0x43caeb[_0xe803('0x52')]['id']}})[_0xe803('0x26')](handleEntityNotFound(_0x15c67b,null))[_0xe803('0x26')](removeEntity(_0x15c67b,null))[_0xe803('0x44')](handleError(_0x15c67b,null));};exports[_0xe803('0x2f')]=function(_0x34b247,_0x32989f){return db['CmCompany'][_0xe803('0x2f')]()[_0xe803('0x26')](respondWithResult(_0x32989f,null))[_0xe803('0x44')](handleError(_0x32989f,null));};exports['addContacts']=function(_0x19bfe5,_0x2a3872,_0x2153fb){return db[_0xe803('0x53')][_0xe803('0x4c')]({'where':{'id':_0x19bfe5[_0xe803('0x52')]['id']}})[_0xe803('0x26')](handleEntityNotFound(_0x2a3872,null))[_0xe803('0x26')](function(_0x1122d3){if(_0x1122d3){return _0x1122d3[_0xe803('0x54')](_0x19bfe5[_0xe803('0x48')][_0xe803('0x55')],_['omit'](_0x19bfe5[_0xe803('0x48')],[_0xe803('0x55'),'id'])||{});}})[_0xe803('0x26')](respondWithResult(_0x2a3872,null))[_0xe803('0x44')](handleError(_0x2a3872,null));};exports['getContacts']=function(_0x2d8627,_0x3dd74e,_0x467605){var _0x1c841f={};var _0x37d37a={};var _0x227fe7;var _0x14ed0a;return db[_0xe803('0x2e')][_0xe803('0x56')]({'where':{'id':_0x2d8627[_0xe803('0x52')]['id']}})[_0xe803('0x26')](handleEntityNotFound(_0x3dd74e,null))['then'](function(_0x1e6708){if(_0x1e6708){_0x227fe7=_0x1e6708;_0x37d37a['model']=_[_0xe803('0x31')](db[_0xe803('0x53')]['rawAttributes']);_0x37d37a['query']=_[_0xe803('0x31')](_0x2d8627[_0xe803('0x32')]);_0x37d37a['filters']=_[_0xe803('0x33')](_0x37d37a[_0xe803('0x30')],_0x37d37a[_0xe803('0x32')]);_0x1c841f[_0xe803('0x34')]=_[_0xe803('0x33')](_0x37d37a[_0xe803('0x30')],qs[_0xe803('0x35')](_0x2d8627[_0xe803('0x32')][_0xe803('0x35')]));_0x1c841f[_0xe803('0x34')]=_0x1c841f['attributes']['length']?_0x1c841f['attributes']:_0x37d37a[_0xe803('0x30')];_0x1c841f[_0xe803('0x39')]=qs[_0xe803('0x3a')](_0x2d8627[_0xe803('0x32')][_0xe803('0x3a')]);_0x1c841f['where']=qs[_0xe803('0x3c')](_[_0xe803('0x57')](_0x2d8627[_0xe803('0x32')],_0x37d37a[_0xe803('0x3c')]));if(_0x2d8627[_0xe803('0x32')][_0xe803('0x3d')]){_0x1c841f[_0xe803('0x3b')]=_['merge'](_0x1c841f[_0xe803('0x3b')],{'$or':_['map'](_0x1c841f[_0xe803('0x34')],function(_0x58fb72){var _0x41a15b={};_0x41a15b[_0x58fb72]={'$like':'%'+_0x2d8627[_0xe803('0x32')][_0xe803('0x3d')]+'%'};return _0x41a15b;})});}_0x1c841f=_[_0xe803('0x3e')]({},_0x1c841f,_0x2d8627[_0xe803('0x40')]);return _0x227fe7[_0xe803('0x58')](_0x1c841f);}})[_0xe803('0x26')](function(_0x232d91){if(_0x232d91){_0x14ed0a=_0x232d91['length'];if(!_0x2d8627[_0xe803('0x32')][_0xe803('0x37')](_0xe803('0x38'))){_0x1c841f[_0xe803('0x1f')]=qs[_0xe803('0x1f')](_0x2d8627['query'][_0xe803('0x1f')]);_0x1c841f['offset']=qs[_0xe803('0x1e')](_0x2d8627[_0xe803('0x32')]['offset']);}return _0x227fe7[_0xe803('0x58')](_0x1c841f);}})['then'](function(_0x2362b9){if(_0x2362b9){return _0x2362b9?{'count':_0x14ed0a,'rows':_0x2362b9}:null;}})['then'](respondWithResult(_0x3dd74e,null))[_0xe803('0x44')](handleError(_0x3dd74e,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index b701cdd..c09afde 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 _0xe68a=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash'];(function(_0x1de032,_0x5efe9d){var _0x43d652=function(_0x1027a0){while(--_0x1027a0){_0x1de032['push'](_0x1de032['shift']());}};_0x43d652(++_0x5efe9d);}(_0xe68a,0x107));var _0xae68=function(_0xf73390,_0x14c109){_0xf73390=_0xf73390-0x0;var _0x4b212f=_0xe68a[_0xf73390];return _0x4b212f;};'use strict';var _=require(_0xae68('0x0'));var util=require('util');var logger=require(_0xae68('0x1'))(_0xae68('0x2'));var moment=require(_0xae68('0x3'));var BPromise=require(_0xae68('0x4'));var rp=require(_0xae68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xae68('0x6'));var attributes=require(_0xae68('0x7'));module['exports']=function(_0x3e7f91,_0x5ecc77){return _0x3e7f91[_0xae68('0x8')](_0xae68('0x9'),attributes,{'tableName':_0xae68('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa837=['./cmCompany.attributes','exports','define','CmCompany','cm_companies','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0xa837,0x10f));var _0x7a83=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa837[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x7a83('0x0'));var logger=require(_0x7a83('0x1'))(_0x7a83('0x2'));var moment=require(_0x7a83('0x3'));var BPromise=require(_0x7a83('0x4'));var rp=require(_0x7a83('0x5'));var fs=require('fs');var path=require(_0x7a83('0x6'));var rimraf=require(_0x7a83('0x7'));var config=require(_0x7a83('0x8'));var attributes=require(_0x7a83('0x9'));module[_0x7a83('0xa')]=function(_0x54171d,_0x40187e){return _0x54171d[_0x7a83('0xb')](_0x7a83('0xc'),attributes,{'tableName':_0x7a83('0xd'),'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 d8409e6..c495685 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 _0x1b32=['http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x38d3ca,_0x56f019){var _0x52eef=function(_0x164b1c){while(--_0x164b1c){_0x38d3ca['push'](_0x38d3ca['shift']());}};_0x52eef(++_0x56f019);}(_0x1b32,0x1d8));var _0x21b3=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x1b32[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0x21b3('0x0'));var util=require(_0x21b3('0x1'));var moment=require(_0x21b3('0x2'));var BPromise=require(_0x21b3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x21b3('0x4'));var db=require(_0x21b3('0x5'))['db'];var utils=require(_0x21b3('0x6'));var logger=require(_0x21b3('0x7'))(_0x21b3('0x8'));var config=require('../../config/environment');var jayson=require(_0x21b3('0x9'));var client=jayson[_0x21b3('0xa')][_0x21b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28ac5f,_0x56d18e,_0x304b33){return new BPromise(function(_0x2d6606,_0x2af537){return client[_0x21b3('0xc')](_0x28ac5f,_0x304b33)[_0x21b3('0xd')](function(_0x3a3550){logger[_0x21b3('0xe')](_0x21b3('0xf'),_0x56d18e,_0x21b3('0x10'));logger[_0x21b3('0x11')](_0x21b3('0x12'),_0x56d18e,_0x21b3('0x10'),JSON['stringify'](_0x3a3550));if(_0x3a3550[_0x21b3('0x13')]){if(_0x3a3550[_0x21b3('0x13')][_0x21b3('0x14')]===0x1f4){logger[_0x21b3('0x13')](_0x21b3('0xf'),_0x56d18e,_0x3a3550[_0x21b3('0x13')][_0x21b3('0x15')]);return _0x2af537(_0x3a3550[_0x21b3('0x13')][_0x21b3('0x15')]);}logger[_0x21b3('0x13')](_0x21b3('0xf'),_0x56d18e,_0x3a3550[_0x21b3('0x13')]['message']);return _0x2d6606(_0x3a3550[_0x21b3('0x13')][_0x21b3('0x15')]);}else{logger[_0x21b3('0xe')](_0x21b3('0xf'),_0x56d18e,_0x21b3('0x10'));_0x2d6606(_0x3a3550['result'][_0x21b3('0x15')]);}})[_0x21b3('0x16')](function(_0xe55089){logger['error']('CmCompany,\x20%s,\x20%s',_0x56d18e,_0xe55089);_0x2af537(_0xe55089);});});} \ No newline at end of file +var _0x5172=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment'];(function(_0x1fe869,_0x1478a7){var _0x460744=function(_0x119a35){while(--_0x119a35){_0x1fe869['push'](_0x1fe869['shift']());}};_0x460744(++_0x1478a7);}(_0x5172,0xfa));var _0x2517=function(_0x2eb295,_0x433288){_0x2eb295=_0x2eb295-0x0;var _0x46333e=_0x5172[_0x2eb295];return _0x46333e;};'use strict';var _=require('lodash');var util=require(_0x2517('0x0'));var moment=require(_0x2517('0x1'));var BPromise=require(_0x2517('0x2'));var rs=require(_0x2517('0x3'));var fs=require('fs');var Redis=require(_0x2517('0x4'));var db=require(_0x2517('0x5'))['db'];var utils=require(_0x2517('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2517('0x7'));var client=jayson[_0x2517('0x8')][_0x2517('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x534f6b,_0x34a0f3,_0xdc9016){return new BPromise(function(_0x351e80,_0x5da3f7){return client[_0x2517('0xa')](_0x534f6b,_0xdc9016)['then'](function(_0x4ef35f){logger[_0x2517('0xb')](_0x2517('0xc'),_0x34a0f3,_0x2517('0xd'));logger[_0x2517('0xe')](_0x2517('0xf'),_0x34a0f3,_0x2517('0xd'),JSON[_0x2517('0x10')](_0x4ef35f));if(_0x4ef35f['error']){if(_0x4ef35f[_0x2517('0x11')][_0x2517('0x12')]===0x1f4){logger[_0x2517('0x11')](_0x2517('0xc'),_0x34a0f3,_0x4ef35f[_0x2517('0x11')][_0x2517('0x13')]);return _0x5da3f7(_0x4ef35f[_0x2517('0x11')]['message']);}logger[_0x2517('0x11')](_0x2517('0xc'),_0x34a0f3,_0x4ef35f['error'][_0x2517('0x13')]);return _0x351e80(_0x4ef35f[_0x2517('0x11')][_0x2517('0x13')]);}else{logger[_0x2517('0xb')]('CmCompany,\x20%s,\x20%s',_0x34a0f3,_0x2517('0xd'));_0x351e80(_0x4ef35f[_0x2517('0x14')]['message']);}})['catch'](function(_0x4f402c){logger[_0x2517('0x11')](_0x2517('0xc'),_0x34a0f3,_0x4f402c);_0x5da3f7(_0x4f402c);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index ed141dc..8d6606f 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 _0x0f1a=['addContacts','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','describe','/:id','show','/:id/contacts','getContacts','post'];(function(_0x3b7037,_0x855d4e){var _0x45fed0=function(_0x33ca62){while(--_0x33ca62){_0x3b7037['push'](_0x3b7037['shift']());}};_0x45fed0(++_0x855d4e);}(_0x0f1a,0x101));var _0xa0f1=function(_0x117473,_0x485375){_0x117473=_0x117473-0x0;var _0x38711a=_0x0f1a[_0x117473];return _0x38711a;};'use strict';var multer=require(_0xa0f1('0x0'));var util=require(_0xa0f1('0x1'));var path=require(_0xa0f1('0x2'));var timeout=require(_0xa0f1('0x3'));var express=require(_0xa0f1('0x4'));var router=express[_0xa0f1('0x5')]();var fs_extra=require(_0xa0f1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa0f1('0x7'));var config=require(_0xa0f1('0x8'));var controller=require(_0xa0f1('0x9'));router['get']('/',auth[_0xa0f1('0xa')](),controller[_0xa0f1('0xb')]);router[_0xa0f1('0xc')]('/describe',auth['isAuthenticated'](),controller[_0xa0f1('0xd')]);router[_0xa0f1('0xc')](_0xa0f1('0xe'),auth[_0xa0f1('0xa')](),controller[_0xa0f1('0xf')]);router[_0xa0f1('0xc')](_0xa0f1('0x10'),auth[_0xa0f1('0xa')](),controller[_0xa0f1('0x11')]);router[_0xa0f1('0x12')]('/',auth[_0xa0f1('0xa')](),controller['create']);router[_0xa0f1('0x12')](_0xa0f1('0x10'),auth[_0xa0f1('0xa')](),controller[_0xa0f1('0x13')]);router[_0xa0f1('0x14')](_0xa0f1('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa0f1('0xe'),auth[_0xa0f1('0xa')](),controller[_0xa0f1('0x15')]);module[_0xa0f1('0x16')]=router; \ No newline at end of file +var _0x02fe=['get','isAuthenticated','index','/describe','show','/:id/contacts','getContacts','post','create','addContacts','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller'];(function(_0xae2add,_0x1c1106){var _0x1a512a=function(_0x1e739e){while(--_0x1e739e){_0xae2add['push'](_0xae2add['shift']());}};_0x1a512a(++_0x1c1106);}(_0x02fe,0x1b8));var _0xe02f=function(_0xf9cd7a,_0x343d80){_0xf9cd7a=_0xf9cd7a-0x0;var _0x234a09=_0x02fe[_0xf9cd7a];return _0x234a09;};'use strict';var multer=require('multer');var util=require(_0xe02f('0x0'));var path=require(_0xe02f('0x1'));var timeout=require(_0xe02f('0x2'));var express=require(_0xe02f('0x3'));var router=express[_0xe02f('0x4')]();var fs_extra=require(_0xe02f('0x5'));var auth=require(_0xe02f('0x6'));var interaction=require(_0xe02f('0x7'));var config=require(_0xe02f('0x8'));var controller=require(_0xe02f('0x9'));router[_0xe02f('0xa')]('/',auth[_0xe02f('0xb')](),controller[_0xe02f('0xc')]);router[_0xe02f('0xa')](_0xe02f('0xd'),auth[_0xe02f('0xb')](),controller['describe']);router[_0xe02f('0xa')]('/:id',auth[_0xe02f('0xb')](),controller[_0xe02f('0xe')]);router[_0xe02f('0xa')](_0xe02f('0xf'),auth['isAuthenticated'](),controller[_0xe02f('0x10')]);router[_0xe02f('0x11')]('/',auth[_0xe02f('0xb')](),controller[_0xe02f('0x12')]);router[_0xe02f('0x11')](_0xe02f('0xf'),auth['isAuthenticated'](),controller[_0xe02f('0x13')]);router[_0xe02f('0x14')](_0xe02f('0x15'),auth[_0xe02f('0xb')](),controller[_0xe02f('0x16')]);router['delete']('/:id',auth[_0xe02f('0xb')](),controller[_0xe02f('0x17')]);module[_0xe02f('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 280952b..7daa618 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 _0xb7e7=['NOW','lodash','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0xb7e7,0x121));var _0x7b7e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xb7e7[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x7b7e('0x0'));var Sequelize=require('sequelize');module[_0x7b7e('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x7b7e('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x7b7e('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7b7e('0x2')]},'dateOfBirth':{'type':Sequelize[_0x7b7e('0x2')]},'description':{'type':Sequelize[_0x7b7e('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x7b7e('0x2')]},'email':{'type':Sequelize[_0x7b7e('0x2')]},'url':{'type':Sequelize[_0x7b7e('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x7b7e('0x2')]},'twitter':{'type':Sequelize[_0x7b7e('0x2')]},'skype':{'type':Sequelize[_0x7b7e('0x2')]},'teams':{'type':Sequelize[_0x7b7e('0x2')]},'viber':{'type':Sequelize[_0x7b7e('0x2')]},'line':{'type':Sequelize[_0x7b7e('0x2')]},'wechat':{'type':Sequelize[_0x7b7e('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x7b7e('0x4')]},'priority':{'type':Sequelize[_0x7b7e('0x4')](0x2)[_0x7b7e('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x7b7e('0x6')],'defaultValue':Sequelize[_0x7b7e('0x7')]},'dialTimezone':{'type':Sequelize[_0x7b7e('0x2')]},'utcOffset':{'type':Sequelize[_0x7b7e('0x4')]}}; \ No newline at end of file +var _0x0b0e=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x2a34a9,_0x55e772){var _0x393119=function(_0x38f2fd){while(--_0x38f2fd){_0x2a34a9['push'](_0x2a34a9['shift']());}};_0x393119(++_0x55e772);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1df473,_0x1a6931){_0x1df473=_0x1df473-0x0;var _0x1bdd49=_0x0b0e[_0x1df473];return _0x1bdd49;};'use strict';var _=require(_0xe0b0('0x0'));var Sequelize=require('sequelize');module[_0xe0b0('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xe0b0('0x2')]},'street':{'type':Sequelize[_0xe0b0('0x2')]},'postalCode':{'type':Sequelize[_0xe0b0('0x2')]},'city':{'type':Sequelize[_0xe0b0('0x2')]},'country':{'type':Sequelize[_0xe0b0('0x2')]},'dateOfBirth':{'type':Sequelize[_0xe0b0('0x2')]},'description':{'type':Sequelize[_0xe0b0('0x3')]},'phone':{'type':Sequelize[_0xe0b0('0x2')]},'mobile':{'type':Sequelize[_0xe0b0('0x2')]},'fax':{'type':Sequelize[_0xe0b0('0x2')]},'email':{'type':Sequelize[_0xe0b0('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xe0b0('0x2')]},'twitter':{'type':Sequelize[_0xe0b0('0x2')]},'skype':{'type':Sequelize[_0xe0b0('0x2')]},'teams':{'type':Sequelize[_0xe0b0('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xe0b0('0x2')]},'wechat':{'type':Sequelize[_0xe0b0('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xe0b0('0x4')]},'priority':{'type':Sequelize[_0xe0b0('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':Sequelize[_0xe0b0('0x6')]},'dialTimezone':{'type':Sequelize[_0xe0b0('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 5ae5b9e..c93ae4e 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 _0x2af2=['Tag','value','split','map','forEach','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','castTo','buildExpression','type','start','isNil','Contact','push','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','filter','replace','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','user','role','agent','some','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','destroy','params','displayName','columnName','values','merge','body','findAll','get','mergeWith','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','JscriptySessionReport','WhatsappInteraction','utcOffset','timezones','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','$and','CmCustomField','omit','format','cf_%d','dialTimezone','setFields','id\x20=\x20?','toParam','text','phone','getTags','rawAttributes','options','setTags','getHoppers','ContactId','includeAll','include','getHopperHistories','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','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','binding','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','chat','sms','openchannel','fax','whatsapp','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','voice','uniqueid','source','destination','starttime','endtime','duration','createdAt','userDisposition','UserId','fullname','alias','startCase','Website','Account','note','secondDisposition','Owner','browserName','customerIp','deviceModel','osName','ratingMessage','referer','mail','subject','externalUrl','threadId','flatten','sortBy','bluebird','util','path','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','update','then','end','sendStatus','error','stack','name','send','index','CmContact','describe','keys','startsWith','findOne','cf_','length','fieldType','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','select','cm_contacts','uc.CmContactId\x20=\x20c.id','left_join','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','conditions','find'];(function(_0x196c32,_0x510698){var _0x132583=function(_0x1aaaf2){while(--_0x1aaaf2){_0x196c32['push'](_0x196c32['shift']());}};_0x132583(++_0x510698);}(_0x2af2,0x1d9));var _0x22af=function(_0x76056,_0x11599f){_0x76056=_0x76056-0x0;var _0x568ae1=_0x2af2[_0x76056];return _0x568ae1;};'use strict';var moment=require('moment');var BPromise=require(_0x22af('0x0'));var util=require(_0x22af('0x1'));var path=require(_0x22af('0x2'));var fs=require('fs');var _=require(_0x22af('0x3'));var squel=require(_0x22af('0x4'));var Papa=require('papaparse');var Redis=require(_0x22af('0x5'));var qs=require(_0x22af('0x6'));var as=require(_0x22af('0x7'));var logger=require(_0x22af('0x8'))(_0x22af('0x9'));var config=require(_0x22af('0xa'));var shared=require(_0x22af('0xb'));var db=require(_0x22af('0xc'))['db'];config[_0x22af('0xd')]=_['defaults'](config['redis'],{'host':_0x22af('0xe'),'port':0x18eb});var socket=require(_0x22af('0xf'))(new Redis(config[_0x22af('0xd')]));require(_0x22af('0x10'))[_0x22af('0x11')](socket);function respondWithResult(_0x58ffc6,_0x421efe){_0x421efe=_0x421efe||0xc8;return function(_0x202352){if(_0x202352){return _0x58ffc6[_0x22af('0x12')](_0x421efe)[_0x22af('0x13')](_0x202352);}};}function respondWithFilteredResult(_0x5557fa,_0x1d584c){return function(_0x2180e3){if(_0x2180e3){var _0x3072aa=typeof _0x1d584c[_0x22af('0x14')]==='undefined'&&typeof _0x1d584c['limit']===_0x22af('0x15');var _0xae3ed7=_0x2180e3[_0x22af('0x16')];var _0x2bbef6=_0x3072aa?0x0:_0x1d584c['offset'];var _0x465f9c=_0x3072aa?_0x2180e3['count']:_0x1d584c['offset']+_0x1d584c[_0x22af('0x17')];var _0x1b6919;if(_0x465f9c>=_0xae3ed7){_0x465f9c=_0xae3ed7;_0x1b6919=0xc8;}else{_0x1b6919=0xce;}_0x5557fa[_0x22af('0x12')](_0x1b6919);return _0x5557fa[_0x22af('0x18')](_0x22af('0x19'),_0x2bbef6+'-'+_0x465f9c+'/'+_0xae3ed7)[_0x22af('0x13')](_0x2180e3);}return null;};}function saveUpdates(_0x2cc2b5){return function(_0x16b18f){if(_0x16b18f){return _0x16b18f[_0x22af('0x1a')](_0x2cc2b5)[_0x22af('0x1b')](function(_0x364941){return _0x364941;});}return null;};}function removeEntity(_0x125ec1){return function(_0x49cf60){if(_0x49cf60){return _0x49cf60['destroy']()['then'](function(){_0x125ec1['status'](0xcc)[_0x22af('0x1c')]();});}};}function handleEntityNotFound(_0x36099d){return function(_0x4aa4b5){if(!_0x4aa4b5){_0x36099d[_0x22af('0x1d')](0x194);}return _0x4aa4b5;};}function handleError(_0x4ede71,_0xde3c89){_0xde3c89=_0xde3c89||0x1f4;return function(_0x3772e3){logger[_0x22af('0x1e')](_0x3772e3[_0x22af('0x1f')]);if(_0x3772e3[_0x22af('0x20')]){delete _0x3772e3[_0x22af('0x20')];}_0x4ede71[_0x22af('0x12')](_0xde3c89)[_0x22af('0x21')](_0x3772e3);};}exports[_0x22af('0x22')]=function(_0x3779c5,_0x31a163){var _0x4ec5ca={},_0x23ba33={},_0x3d5008={'count':0x0,'rows':[]};return db[_0x22af('0x23')][_0x22af('0x24')]()[_0x22af('0x1b')](function(_0x5a336a){var _0x29132b=[];for(var _0x4fac76=0x0;_0x4fac760x1){_0x3086ed['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x22af('0x5f')](_0x18ae0d),null);}else{if(qs['isNumeric'](_0x18ae0d)){_0x3086ed['or'](_0x22af('0x60'),_0x18ae0d+'%');_0x3086ed['or'](_0x22af('0x61'),_0x18ae0d+'%');_0x3086ed['or'](_0x22af('0x62'),_0x18ae0d+'%');_0x3086ed['or']('c.fax\x20LIKE\x20?',_0x18ae0d+'%');}else if(qs['isEmail'](_0x18ae0d)){_0x3086ed['or'](_0x22af('0x63'),_0x18ae0d+'%');}else{_0x3086ed['or'](_0x22af('0x64'),'%'+_0x18ae0d+'%');_0x3086ed['or'](_0x22af('0x65'),'%'+_0x18ae0d+'%');_0x3086ed['or'](_0x22af('0x63'),'%'+_0x18ae0d+'%');}}}}_0x5c1c85[_0x22af('0x35')](_0x3086ed);_0x5c1c85[_0x22af('0x66')](_0x22af('0x67'));var _0x3402f2={'type':db[_0x22af('0x68')][_0x22af('0x69')][_0x22af('0x6a')],'raw':!![]};var _0x47b69a=_0x5c1c85[_0x22af('0x6b')]()['field'](_0x22af('0x67'));if(_0x4ec5ca[_0x22af('0x33')]){_0x4ec5ca[_0x22af('0x33')][_0x22af('0x49')](function(_0x49dfe4){_0x5c1c85[_0x22af('0x33')]('c.'+_0x49dfe4[0x0],_0x49dfe4[0x1]===_0x22af('0x6c')?![]:!![]);});}if(!_['isEmpty'](_0x59284e)){_0x5c1c85['having'](_0x1e02f2);_0x47b69a[_0x22af('0x35')](_0x22af('0x6d'),_0x59284e);}BPromise[_0x22af('0x6e')]()[_0x22af('0x1b')](function(){if(!_0x5da6ec)return;if(_0x3779c5[_0x22af('0x6f')][_0x22af('0x70')]!==_0x22af('0x71'))return;if(!_[_0x22af('0x72')](_0x5da6ec[_0x22af('0x43')],[_0x22af('0x37'),_0x22af('0x4b')])){return _0x3779c5[_0x22af('0x6f')]['getLists']({'attributes':['id'],'raw':!![]})[_0x22af('0x1b')](function(_0xc148d6){if(_['isEmpty'](_0xc148d6)){_0x47b69a[_0x22af('0x35')](_0x22af('0x73'));_0x5c1c85[_0x22af('0x35')](_0x22af('0x73'));}else{_0x47b69a['where'](_0x22af('0x74'),_[_0x22af('0x48')](_0xc148d6,'id'));_0x5c1c85['where']('c.ListId\x20IN\x20?',_['map'](_0xc148d6,'id'));}});}})[_0x22af('0x1b')](function(){if(_0x3779c5[_0x22af('0x6f')]['role']==='agent'&&!_0x5da6ec&&!_0x3779c5[_0x22af('0x2c')][_0x22af('0x57')])return[];return db[_0x22af('0x75')][_0x22af('0x2c')](_0x47b69a[_0x22af('0x76')](),_0x3402f2);})[_0x22af('0x1b')](function(_0x3533ad){_0x3d5008[_0x22af('0x16')]=_0x3533ad['length'];if(_0x3d5008[_0x22af('0x16')]===0x0)return[];return db['sequelize'][_0x22af('0x2c')](_0x898f24[_0x22af('0x76')](),_0x3402f2)['then'](function(_0x2697bb){_0x54b2f9=_['keyBy'](_0x2697bb,'id');_0x3402f2=_['merge'](_0x3402f2,{'model':db[_0x22af('0x23')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3779c5[_0x22af('0x2c')]['fields']){_0x4ec5ca['attributes'][_0x22af('0x49')](function(_0x313d07){_0x5c1c85['field']('c.'+_0x313d07);});}else{_0x5c1c85[_0x22af('0x37')]('c.id');_0x5c1c85[_0x22af('0x37')]('c.firstName');_0x5c1c85['field'](_0x22af('0x77'));_0x5c1c85[_0x22af('0x37')](_0x22af('0x78'));_0x5c1c85[_0x22af('0x37')](_0x22af('0x79'));_0x5c1c85['field'](_0x22af('0x7a'));_0x5c1c85[_0x22af('0x37')](_0x22af('0x7b'));_0x5c1c85['field'](_0x22af('0x7c'));_0x5c1c85[_0x22af('0x37')](_0x22af('0x7d'));_0x5c1c85[_0x22af('0x37')](_0x22af('0x7e'));_0x5c1c85[_0x22af('0x37')](_0x22af('0x7f'));_0x5c1c85[_0x22af('0x37')](_0x22af('0x80'),_0x22af('0x81'));}if(_0x4ec5ca[_0x22af('0x17')])_0x5c1c85[_0x22af('0x17')](_0x4ec5ca['limit']);if(_0x4ec5ca['offset'])_0x5c1c85[_0x22af('0x14')](_0x4ec5ca[_0x22af('0x14')]);return db[_0x22af('0x75')][_0x22af('0x2c')](_0x5c1c85[_0x22af('0x76')](),_0x3402f2);});})[_0x22af('0x1b')](function(_0x3b2b86){_0x3b2b86[_0x22af('0x49')](function(_0x3519d4){if(_0x3519d4[_0x22af('0x81')]){_0x3519d4[_0x22af('0x82')]=[];_0x3519d4[_0x22af('0x81')][_0x22af('0x47')](',')[_0x22af('0x49')](function(_0xdcb1ec){_0x3519d4[_0x22af('0x82')][_0x22af('0x55')](_0x54b2f9[_0xdcb1ec]);});}delete _0x3519d4[_0x22af('0x81')];});_0x3d5008[_0x22af('0x83')]=_0x3b2b86;return _0x3d5008;})[_0x22af('0x1b')](respondWithFilteredResult(_0x31a163,_0x4ec5ca));})[_0x22af('0x84')](handleError(_0x31a163,null));};exports[_0x22af('0x85')]=function(_0x33a4f1,_0x163fb2){return db[_0x22af('0x23')][_0x22af('0x44')]({'where':{'id':_0x33a4f1[_0x22af('0x86')]['id']}})[_0x22af('0x1b')](handleEntityNotFound(_0x163fb2,null))[_0x22af('0x1b')](removeEntity(_0x163fb2,null))[_0x22af('0x84')](handleError(_0x163fb2,null));};exports['describe']=function(_0x4b223c,_0x1b8c5f){return db[_0x22af('0x23')]['describe']()['then'](function(_0x3f9d3f){delete _0x3f9d3f['tags'];for(var _0x130448=0x0;_0x130448=_0x2614cf){_0x3de8d5=_0x2614cf;_0x12e7a0=0xc8;}else{_0x12e7a0=0xce;}_0x24f4b0[_0x0f33('0x12')](_0x12e7a0);return _0x24f4b0[_0x0f33('0x18')](_0x0f33('0x19'),_0x5393ed+'-'+_0x3de8d5+'/'+_0x2614cf)[_0x0f33('0x13')](_0x24f650);}return null;};}function saveUpdates(_0x463dd2){return function(_0xc970e0){if(_0xc970e0){return _0xc970e0[_0x0f33('0x1a')](_0x463dd2)[_0x0f33('0x1b')](function(_0x445279){return _0x445279;});}return null;};}function removeEntity(_0x326489){return function(_0x443958){if(_0x443958){return _0x443958['destroy']()['then'](function(){_0x326489[_0x0f33('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e4ce6){return function(_0x21d02b){if(!_0x21d02b){_0x1e4ce6[_0x0f33('0x1c')](0x194);}return _0x21d02b;};}function handleError(_0x4dcaf7,_0x4260c5){_0x4260c5=_0x4260c5||0x1f4;return function(_0x282d15){logger['error'](_0x282d15['stack']);if(_0x282d15[_0x0f33('0x1d')]){delete _0x282d15[_0x0f33('0x1d')];}_0x4dcaf7[_0x0f33('0x12')](_0x4260c5)[_0x0f33('0x1e')](_0x282d15);};}exports[_0x0f33('0x1f')]=function(_0x36ca43,_0x55c4d5){var _0x2187de={},_0x20d589={},_0x4697e8={'count':0x0,'rows':[]};return db[_0x0f33('0x20')][_0x0f33('0x21')]()['then'](function(_0x3a35d1){var _0x49d54e=[];for(var _0xebaae9=0x0;_0xebaae90x1){_0x3e33fd['or'](_0x0f33('0x5b'),qs[_0x0f33('0x5c')](_0x1a4e47),null);}else{if(qs['isNumeric'](_0x1a4e47)){_0x3e33fd['or'](_0x0f33('0x5d'),_0x1a4e47+'%');_0x3e33fd['or'](_0x0f33('0x5e'),_0x1a4e47+'%');_0x3e33fd['or'](_0x0f33('0x5f'),_0x1a4e47+'%');_0x3e33fd['or'](_0x0f33('0x60'),_0x1a4e47+'%');}else if(qs[_0x0f33('0x61')](_0x1a4e47)){_0x3e33fd['or'](_0x0f33('0x62'),_0x1a4e47+'%');}else{_0x3e33fd['or'](_0x0f33('0x63'),'%'+_0x1a4e47+'%');_0x3e33fd['or'](_0x0f33('0x64'),'%'+_0x1a4e47+'%');_0x3e33fd['or'](_0x0f33('0x62'),'%'+_0x1a4e47+'%');}}}}_0x1a24c4[_0x0f33('0x31')](_0x3e33fd);_0x1a24c4[_0x0f33('0x65')](_0x0f33('0x66'));var _0x399266={'type':db[_0x0f33('0x67')][_0x0f33('0x68')]['SELECT'],'raw':!![]};var _0x314a16=_0x1a24c4[_0x0f33('0x69')]()['field'](_0x0f33('0x66'));if(_0x2187de[_0x0f33('0x6a')]){_0x2187de['order']['forEach'](function(_0x58ce05){_0x1a24c4['order']('c.'+_0x58ce05[0x0],_0x58ce05[0x1]===_0x0f33('0x6b')?![]:!![]);});}if(!_['isEmpty'](_0x49ef6d)){_0x1a24c4['having'](_0x85e904);_0x314a16[_0x0f33('0x31')](_0x0f33('0x6c'),_0x49ef6d);}BPromise['resolve']()[_0x0f33('0x1b')](function(){if(!_0x13a76e)return;if(_0x36ca43['user']['role']!==_0x0f33('0x6d'))return;if(!_[_0x0f33('0x6e')](_0x13a76e[_0x0f33('0x40')],[_0x0f33('0x34'),'User'])){return _0x36ca43[_0x0f33('0x6f')][_0x0f33('0x70')]({'attributes':['id'],'raw':!![]})[_0x0f33('0x1b')](function(_0x54f505){if(_[_0x0f33('0x71')](_0x54f505)){_0x314a16[_0x0f33('0x31')]('c.ListId\x20IS\x20NULL');_0x1a24c4['where'](_0x0f33('0x72'));}else{_0x314a16['where']('c.ListId\x20IN\x20?',_[_0x0f33('0x4c')](_0x54f505,'id'));_0x1a24c4['where'](_0x0f33('0x52'),_['map'](_0x54f505,'id'));}});}})['then'](function(){if(_0x36ca43[_0x0f33('0x6f')]['role']===_0x0f33('0x6d')&&!_0x13a76e&&!_0x36ca43[_0x0f33('0x2b')][_0x0f33('0x51')])return[];return db[_0x0f33('0x73')][_0x0f33('0x2b')](_0x314a16[_0x0f33('0x74')](),_0x399266);})[_0x0f33('0x1b')](function(_0x194990){_0x4697e8['count']=_0x194990[_0x0f33('0x23')];if(_0x4697e8[_0x0f33('0x17')]===0x0)return[];return db['sequelize'][_0x0f33('0x2b')](_0x3714ae[_0x0f33('0x74')](),_0x399266)['then'](function(_0x2a0d02){_0x3207f0=_['keyBy'](_0x2a0d02,'id');_0x399266=_[_0x0f33('0x75')](_0x399266,{'model':db[_0x0f33('0x20')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x36ca43[_0x0f33('0x2b')][_0x0f33('0x2f')]){_0x2187de[_0x0f33('0x2e')][_0x0f33('0x50')](function(_0x58b941){_0x1a24c4[_0x0f33('0x34')]('c.'+_0x58b941);});}else{_0x1a24c4[_0x0f33('0x34')](_0x0f33('0x66'));_0x1a24c4[_0x0f33('0x34')](_0x0f33('0x76'));_0x1a24c4['field'](_0x0f33('0x77'));_0x1a24c4[_0x0f33('0x34')](_0x0f33('0x78'));_0x1a24c4[_0x0f33('0x34')]('c.mobile');_0x1a24c4[_0x0f33('0x34')]('c.fax');_0x1a24c4[_0x0f33('0x34')](_0x0f33('0x79'));_0x1a24c4[_0x0f33('0x34')](_0x0f33('0x7a'));_0x1a24c4[_0x0f33('0x34')](_0x0f33('0x7b'));_0x1a24c4[_0x0f33('0x34')](_0x0f33('0x7c'));_0x1a24c4['field']('c.CompanyId');_0x1a24c4[_0x0f33('0x34')](_0x0f33('0x7d'),_0x0f33('0x7e'));}if(_0x2187de[_0x0f33('0x15')])_0x1a24c4[_0x0f33('0x15')](_0x2187de[_0x0f33('0x15')]);if(_0x2187de['offset'])_0x1a24c4[_0x0f33('0x16')](_0x2187de[_0x0f33('0x16')]);return db[_0x0f33('0x73')]['query'](_0x1a24c4[_0x0f33('0x74')](),_0x399266);});})['then'](function(_0x76b97f){_0x76b97f[_0x0f33('0x50')](function(_0x4f9348){if(_0x4f9348[_0x0f33('0x7e')]){_0x4f9348[_0x0f33('0x7f')]=[];_0x4f9348['TagIds'][_0x0f33('0x5a')](',')['forEach'](function(_0x5afb7c){_0x4f9348['Tags'][_0x0f33('0x25')](_0x3207f0[_0x5afb7c]);});}delete _0x4f9348[_0x0f33('0x7e')];});_0x4697e8[_0x0f33('0x80')]=_0x76b97f;return _0x4697e8;})['then'](respondWithFilteredResult(_0x55c4d5,_0x2187de));})[_0x0f33('0x81')](handleError(_0x55c4d5,null));};exports['destroy']=function(_0x1047fa,_0x5d5752){return db[_0x0f33('0x20')][_0x0f33('0x82')]({'where':{'id':_0x1047fa['params']['id']}})[_0x0f33('0x1b')](handleEntityNotFound(_0x5d5752,null))[_0x0f33('0x1b')](removeEntity(_0x5d5752,null))['catch'](handleError(_0x5d5752,null));};exports[_0x0f33('0x21')]=function(_0x301105,_0x5d7f8b){return db[_0x0f33('0x20')][_0x0f33('0x21')]()[_0x0f33('0x1b')](function(_0x5c9105){delete _0x5c9105[_0x0f33('0x83')];for(var _0x4c96da=0x0;_0x4c96da{}\s\\|]/g,'-');_0x52c650(null,util[_0x40fb('0x26')](_0x40fb('0x27'),path[_0x40fb('0x28')](_0x42c7bb[_0x40fb('0x24')],path[_0x40fb('0x29')](_0x42c7bb[_0x40fb('0x24')])),Date['now'](),path['extname'](_0x42c7bb[_0x40fb('0x24')])));}})});router[_0x40fb('0x19')](_0x40fb('0x2a'),upload[_0x40fb('0x2b')](_0x40fb('0x2c')),controller[_0x40fb('0x2d')]);var upload=multer({'storage':multer[_0x40fb('0x20')]({'destination':function(_0x58b112,_0x5bff0e,_0x4f5dfd){_0x4f5dfd(null,path[_0x40fb('0x21')](config[_0x40fb('0x22')],'server/files/tmp'));},'filename':function(_0x1e6472,_0x3143e2,_0x34376f){_0x3143e2['originalname']=_0x3143e2[_0x40fb('0x24')][_0x40fb('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x34376f(null,util[_0x40fb('0x26')]('%s-%s%s',path[_0x40fb('0x28')](_0x3143e2[_0x40fb('0x24')],path[_0x40fb('0x29')](_0x3143e2[_0x40fb('0x24')])),Date[_0x40fb('0x2e')](),path[_0x40fb('0x29')](_0x3143e2[_0x40fb('0x24')])));}})});router[_0x40fb('0x19')](_0x40fb('0x2f'),upload[_0x40fb('0x2b')](_0x40fb('0x2c')),controller['upload']);router['post'](_0x40fb('0x30'),auth[_0x40fb('0xa')](),controller[_0x40fb('0x31')]);router['put']('/:id',auth[_0x40fb('0xa')](),controller['update']);router[_0x40fb('0x32')](_0x40fb('0xe'),auth[_0x40fb('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe455=['getJourney','/merge','merge','post','create','bulkCreate','/:id/tags','setTags','diskStorage','join','root','originalname','replace','format','basename','extname','now','/csv','single','uploadCsv','server/files/tmp','%s-%s%s','/upload','file','upload','/upload/:id','import','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','/describe','describe','/:id','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey'];(function(_0x435d49,_0xe63b56){var _0x40a43d=function(_0x427d95){while(--_0x427d95){_0x435d49['push'](_0x435d49['shift']());}};_0x40a43d(++_0xe63b56);}(_0xe455,0x12e));var _0x5e45=function(_0x1740ca,_0x4b68e1){_0x1740ca=_0x1740ca-0x0;var _0x23f446=_0xe455[_0x1740ca];return _0x23f446;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5e45('0x0'));var timeout=require(_0x5e45('0x1'));var express=require(_0x5e45('0x2'));var router=express[_0x5e45('0x3')]();var fs_extra=require(_0x5e45('0x4'));var auth=require(_0x5e45('0x5'));var interaction=require(_0x5e45('0x6'));var config=require(_0x5e45('0x7'));var controller=require(_0x5e45('0x8'));router[_0x5e45('0x9')]('/',auth[_0x5e45('0xa')](),controller['index']);router[_0x5e45('0x9')](_0x5e45('0xb'),auth[_0x5e45('0xa')](),controller[_0x5e45('0xc')]);router[_0x5e45('0x9')](_0x5e45('0xd'),auth[_0x5e45('0xa')](),controller['show']);router[_0x5e45('0x9')]('/:id/tags',auth[_0x5e45('0xa')](),controller[_0x5e45('0xe')]);router['get'](_0x5e45('0xf'),auth[_0x5e45('0xa')](),controller[_0x5e45('0x10')]);router[_0x5e45('0x9')](_0x5e45('0x11'),auth[_0x5e45('0xa')](),controller['getHopperHistories']);router[_0x5e45('0x9')]('/:id/hopper_finals',auth[_0x5e45('0xa')](),controller[_0x5e45('0x12')]);router['get'](_0x5e45('0x13'),auth['isAuthenticated'](),controller[_0x5e45('0x14')]);router[_0x5e45('0x9')](_0x5e45('0x15'),auth['isAuthenticated'](),controller[_0x5e45('0x16')]);router['post'](_0x5e45('0x17'),auth['isAuthenticated'](),controller[_0x5e45('0x18')]);router[_0x5e45('0x19')]('/',auth[_0x5e45('0xa')](),controller[_0x5e45('0x1a')]);router[_0x5e45('0x19')]('/create_many',auth[_0x5e45('0xa')](),controller[_0x5e45('0x1b')]);router[_0x5e45('0x19')](_0x5e45('0x1c'),auth[_0x5e45('0xa')](),controller[_0x5e45('0x1d')]);var upload=multer({'storage':multer[_0x5e45('0x1e')]({'destination':function(_0x5dff09,_0x3b075c,_0x14ebff){_0x14ebff(null,path[_0x5e45('0x1f')](config[_0x5e45('0x20')],'server/files/tmp'));},'filename':function(_0x3385e4,_0x38d8c0,_0x2fecd6){_0x38d8c0[_0x5e45('0x21')]=_0x38d8c0['originalname'][_0x5e45('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2fecd6(null,util[_0x5e45('0x23')]('%s-%s%s',path[_0x5e45('0x24')](_0x38d8c0['originalname'],path[_0x5e45('0x25')](_0x38d8c0['originalname'])),Date[_0x5e45('0x26')](),path[_0x5e45('0x25')](_0x38d8c0[_0x5e45('0x21')])));}})});router[_0x5e45('0x19')](_0x5e45('0x27'),upload[_0x5e45('0x28')]('file'),controller[_0x5e45('0x29')]);var upload=multer({'storage':multer[_0x5e45('0x1e')]({'destination':function(_0x1fceeb,_0x5aa12b,_0x18ffb9){_0x18ffb9(null,path[_0x5e45('0x1f')](config[_0x5e45('0x20')],_0x5e45('0x2a')));},'filename':function(_0x4eee82,_0x399b51,_0x4ee3b9){_0x399b51['originalname']=_0x399b51['originalname'][_0x5e45('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4ee3b9(null,util[_0x5e45('0x23')](_0x5e45('0x2b'),path[_0x5e45('0x24')](_0x399b51[_0x5e45('0x21')],path[_0x5e45('0x25')](_0x399b51[_0x5e45('0x21')])),Date[_0x5e45('0x26')](),path[_0x5e45('0x25')](_0x399b51[_0x5e45('0x21')])));}})});router[_0x5e45('0x19')](_0x5e45('0x2c'),upload[_0x5e45('0x28')](_0x5e45('0x2d')),controller[_0x5e45('0x2e')]);router['post'](_0x5e45('0x2f'),auth['isAuthenticated'](),controller[_0x5e45('0x30')]);router[_0x5e45('0x31')](_0x5e45('0xd'),auth[_0x5e45('0xa')](),controller[_0x5e45('0x32')]);router[_0x5e45('0x33')](_0x5e45('0xd'),auth['isAuthenticated'](),controller[_0x5e45('0x34')]);module[_0x5e45('0x35')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 3a243fe..5e1d00f 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 _0xcf99=['values','stringify','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','long','type','select','parse'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xcf99,0x173));var _0x9cf9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcf99[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x9cf9('0x0'));var _=require(_0x9cf9('0x1'));module[_0x9cf9('0x2')]={'name':{'type':Sequelize[_0x9cf9('0x3')],'get':function(_0x26baad){return this[_0x9cf9('0x4')](_0x9cf9('0x5'));}},'alias':{'type':Sequelize[_0x9cf9('0x6')],'allowNull':![],'set':function(_0x5a868b){this[_0x9cf9('0x7')](_0x9cf9('0x5'),_0x5a868b?_0x5a868b:this[_0x9cf9('0x4')](_0x9cf9('0x8')));}},'type':{'type':Sequelize[_0x9cf9('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x9cf9('0x9')),'get':function(){if(this[_0x9cf9('0x4')](_0x9cf9('0xa'))===_0x9cf9('0xb')){return JSON[_0x9cf9('0xc')](this[_0x9cf9('0x4')](_0x9cf9('0xd')));}else{return this['getDataValue']('values');}},'set':function(_0x2ffa8c){if(Array['isArray'](_0x2ffa8c)){this[_0x9cf9('0x7')](_0x9cf9('0xd'),JSON[_0x9cf9('0xe')](_0x2ffa8c));}else{this[_0x9cf9('0x7')](_0x9cf9('0xd'),_0x2ffa8c);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x9cf9('0xf'))}}; \ No newline at end of file +var _0xceb6=['isArray','setDataValue','values','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','name','TEXT','type','select','parse'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0xceb6,0x137));var _0x6ceb=function(_0x92ba74,_0x5798db){_0x92ba74=_0x92ba74-0x0;var _0x9fa6ea=_0xceb6[_0x92ba74];return _0x9fa6ea;};'use strict';var Sequelize=require(_0x6ceb('0x0'));var _=require(_0x6ceb('0x1'));module[_0x6ceb('0x2')]={'name':{'type':Sequelize[_0x6ceb('0x3')],'get':function(_0xcddf32){return this[_0x6ceb('0x4')](_0x6ceb('0x5'));}},'alias':{'type':Sequelize[_0x6ceb('0x6')],'allowNull':![],'set':function(_0x40f182){this['setDataValue']('alias',_0x40f182?_0x40f182:this['getDataValue'](_0x6ceb('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x6ceb('0x8')]('long'),'get':function(){if(this['getDataValue'](_0x6ceb('0x9'))===_0x6ceb('0xa')){return JSON[_0x6ceb('0xb')](this['getDataValue']('values'));}else{return this[_0x6ceb('0x4')]('values');}},'set':function(_0xc84810){if(Array[_0x6ceb('0xc')](_0xc84810)){this[_0x6ceb('0xd')](_0x6ceb('0xe'),JSON[_0x6ceb('0xf')](_0xc84810));}else{this[_0x6ceb('0xd')](_0x6ceb('0xe'),_0xc84810);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x6ceb('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x6ceb('0x11')](_0x6ceb('0x12'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 760cc31..7c89a74 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 _0x1a0f=['sort','where','filters','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','find','update','body','params','destroy','create','sequelize','transaction','text','TEXT','Sequelize','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','apply','then','error','name','index','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','map','keys','query','intersection','attributes','fields','length','nolimit'];(function(_0x5c6d14,_0x484e06){var _0x5b3bfe=function(_0x250890){while(--_0x250890){_0x5c6d14['push'](_0x5c6d14['shift']());}};_0x5b3bfe(++_0x484e06);}(_0x1a0f,0x1c8));var _0xf1a0=function(_0x4b6feb,_0x158c73){_0x4b6feb=_0x4b6feb-0x0;var _0x749123=_0x1a0f[_0x4b6feb];return _0x749123;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf1a0('0x0'));var zipdir=require(_0xf1a0('0x1'));var jsonpatch=require(_0xf1a0('0x2'));var rp=require(_0xf1a0('0x3'));var moment=require(_0xf1a0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf1a0('0x5'));var util=require(_0xf1a0('0x6'));var path=require(_0xf1a0('0x7'));var sox=require(_0xf1a0('0x8'));var csv=require('to-csv');var ejs=require(_0xf1a0('0x9'));var fs=require('fs');var fs_extra=require(_0xf1a0('0xa'));var _=require(_0xf1a0('0xb'));var squel=require('squel');var crypto=require(_0xf1a0('0xc'));var jsforce=require(_0xf1a0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf1a0('0xe'));var Papa=require('papaparse');var Redis=require(_0xf1a0('0xf'));var authService=require(_0xf1a0('0x10'));var qs=require(_0xf1a0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf1a0('0x12'));var logger=require(_0xf1a0('0x13'))(_0xf1a0('0x14'));var utils=require(_0xf1a0('0x15'));var config=require(_0xf1a0('0x16'));var licenseUtil=require(_0xf1a0('0x17'));var db=require(_0xf1a0('0x18'))['db'];function respondWithStatusCode(_0xcb03af,_0x450274){_0x450274=_0x450274||0xcc;return function(_0x40897c){if(_0x40897c){return _0xcb03af[_0xf1a0('0x19')](_0x450274);}return _0xcb03af['status'](_0x450274)[_0xf1a0('0x1a')]();};}function respondWithResult(_0x2fa2b8,_0x206b3a){_0x206b3a=_0x206b3a||0xc8;return function(_0x52c074){if(_0x52c074){return _0x2fa2b8[_0xf1a0('0x1b')](_0x206b3a)[_0xf1a0('0x1c')](_0x52c074);}};}function respondWithFilteredResult(_0x4213ae,_0x217908){return function(_0x42a1f5){if(_0x42a1f5){var _0x35d56c=typeof _0x217908['offset']===_0xf1a0('0x1d')&&typeof _0x217908[_0xf1a0('0x1e')]===_0xf1a0('0x1d');var _0x5379ef=_0x42a1f5['count'];var _0x33c4a6=_0x35d56c?0x0:_0x217908[_0xf1a0('0x1f')];var _0x403883=_0x35d56c?_0x42a1f5['count']:_0x217908[_0xf1a0('0x1f')]+_0x217908['limit'];var _0x1252f8;if(_0x403883>=_0x5379ef){_0x403883=_0x5379ef;_0x1252f8=0xc8;}else{_0x1252f8=0xce;}_0x4213ae[_0xf1a0('0x1b')](_0x1252f8);return _0x4213ae[_0xf1a0('0x20')](_0xf1a0('0x21'),_0x33c4a6+'-'+_0x403883+'/'+_0x5379ef)[_0xf1a0('0x1c')](_0x42a1f5);}return null;};}function patchUpdates(_0x1ac3bd){return function(_0x19d740){try{jsonpatch[_0xf1a0('0x22')](_0x19d740,_0x1ac3bd,!![]);}catch(_0x436a19){return BPromise['reject'](_0x436a19);}return _0x19d740['save']();};}function saveUpdates(_0x53769b,_0x58eae8){return function(_0x3fa418){if(_0x3fa418){return _0x3fa418['update'](_0x53769b)[_0xf1a0('0x23')](function(_0x415903){return _0x415903;});}return null;};}function removeEntity(_0x54768e,_0x3a4778){return function(_0x365fc2){if(_0x365fc2){return _0x365fc2['destroy']()[_0xf1a0('0x23')](function(){_0x54768e[_0xf1a0('0x1b')](0xcc)[_0xf1a0('0x1a')]();});}};}function handleEntityNotFound(_0x28b1eb,_0xcb0181){return function(_0x25950b){if(!_0x25950b){_0x28b1eb[_0xf1a0('0x19')](0x194);}return _0x25950b;};}function handleError(_0x1555da,_0x18377c){_0x18377c=_0x18377c||0x1f4;return function(_0x40d2df){logger[_0xf1a0('0x24')](_0x40d2df['stack']);if(_0x40d2df[_0xf1a0('0x25')]){delete _0x40d2df[_0xf1a0('0x25')];}_0x1555da[_0xf1a0('0x1b')](_0x18377c)['send'](_0x40d2df);};}exports[_0xf1a0('0x26')]=function(_0xed43c9,_0x4dc8fb){var _0x5e361a={},_0x215805={},_0x3a2a55={'count':0x0,'rows':[]};var _0x484af6=_['map'](db[_0xf1a0('0x27')][_0xf1a0('0x28')],function(_0x24664b){return{'name':_0x24664b[_0xf1a0('0x29')],'type':_0x24664b[_0xf1a0('0x2a')][_0xf1a0('0x2b')]};});_0x215805[_0xf1a0('0x2c')]=_[_0xf1a0('0x2d')](_[_0xf1a0('0x2e')](_0x484af6,_0xf1a0('0x25')),[_0xf1a0('0x25')]);_0x215805['query']=_[_0xf1a0('0x2f')](_0xed43c9[_0xf1a0('0x30')]);_0x215805['filters']=_[_0xf1a0('0x31')](_0x215805[_0xf1a0('0x2c')],_0x215805[_0xf1a0('0x30')]);_0x5e361a[_0xf1a0('0x32')]=_[_0xf1a0('0x31')](_0x215805['model'],qs['fields'](_0xed43c9[_0xf1a0('0x30')][_0xf1a0('0x33')]));_0x5e361a['attributes']=_0x5e361a['attributes'][_0xf1a0('0x34')]?_0x5e361a['attributes']:_0x215805[_0xf1a0('0x2c')];if(!_0xed43c9[_0xf1a0('0x30')]['hasOwnProperty'](_0xf1a0('0x35'))){_0x5e361a[_0xf1a0('0x1e')]=qs[_0xf1a0('0x1e')](_0xed43c9[_0xf1a0('0x30')][_0xf1a0('0x1e')]);_0x5e361a[_0xf1a0('0x1f')]=qs[_0xf1a0('0x1f')](_0xed43c9[_0xf1a0('0x30')]['offset']);}_0x5e361a['order']=qs['sort'](_0xed43c9[_0xf1a0('0x30')][_0xf1a0('0x36')]);_0x5e361a[_0xf1a0('0x37')]=qs[_0xf1a0('0x38')](_['pick'](_0xed43c9[_0xf1a0('0x30')],_0x215805['filters']),_0x484af6);if(_0xed43c9['query'][_0xf1a0('0x39')]){_0x5e361a[_0xf1a0('0x37')]=_['merge'](_0x5e361a[_0xf1a0('0x37')],{'$or':_[_0xf1a0('0x2e')](_0x484af6,function(_0x28e297){if(_0x28e297[_0xf1a0('0x2a')]!==_0xf1a0('0x3a')){var _0x4c8399={};_0x4c8399[_0x28e297[_0xf1a0('0x25')]]={'$like':'%'+_0xed43c9[_0xf1a0('0x30')][_0xf1a0('0x39')]+'%'};return _0x4c8399;}})});}_0x5e361a=_[_0xf1a0('0x3b')]({},_0x5e361a,_0xed43c9[_0xf1a0('0x3c')]);var _0x3b9a0a={'where':_0x5e361a[_0xf1a0('0x37')]};return db[_0xf1a0('0x27')][_0xf1a0('0x3d')](_0x3b9a0a)[_0xf1a0('0x23')](function(_0x21781d){_0x3a2a55['count']=_0x21781d;if(_0xed43c9[_0xf1a0('0x30')][_0xf1a0('0x3e')]){_0x5e361a[_0xf1a0('0x3f')]=[{'all':!![]}];}return db[_0xf1a0('0x27')][_0xf1a0('0x40')](_0x5e361a);})['then'](function(_0x3725cf){_0x3a2a55[_0xf1a0('0x41')]=_0x3725cf;return _0x3a2a55;})[_0xf1a0('0x23')](respondWithFilteredResult(_0x4dc8fb,_0x5e361a))[_0xf1a0('0x42')](handleError(_0x4dc8fb,null));};exports['show']=function(_0x4ca31f,_0x33b78c){var _0x48e434={'raw':!![],'where':{'id':_0x4ca31f['params']['id']}},_0x4d0e3f={};_0x4d0e3f[_0xf1a0('0x2c')]=_[_0xf1a0('0x2f')](db[_0xf1a0('0x27')]['rawAttributes']);_0x4d0e3f[_0xf1a0('0x30')]=_[_0xf1a0('0x2f')](_0x4ca31f['query']);_0x4d0e3f[_0xf1a0('0x38')]=_[_0xf1a0('0x31')](_0x4d0e3f['model'],_0x4d0e3f[_0xf1a0('0x30')]);_0x48e434[_0xf1a0('0x32')]=_['intersection'](_0x4d0e3f[_0xf1a0('0x2c')],qs[_0xf1a0('0x33')](_0x4ca31f[_0xf1a0('0x30')][_0xf1a0('0x33')]));_0x48e434[_0xf1a0('0x32')]=_0x48e434[_0xf1a0('0x32')][_0xf1a0('0x34')]?_0x48e434[_0xf1a0('0x32')]:_0x4d0e3f['model'];if(_0x4ca31f[_0xf1a0('0x30')][_0xf1a0('0x3e')]){_0x48e434['include']=[{'all':!![]}];}_0x48e434=_[_0xf1a0('0x3b')]({},_0x48e434,_0x4ca31f[_0xf1a0('0x3c')]);return db[_0xf1a0('0x27')][_0xf1a0('0x43')](_0x48e434)['then'](handleEntityNotFound(_0x33b78c,null))[_0xf1a0('0x23')](respondWithResult(_0x33b78c,null))[_0xf1a0('0x42')](handleError(_0x33b78c,null));};exports[_0xf1a0('0x44')]=function(_0x154240,_0x474f8f){if(_0x154240[_0xf1a0('0x45')]['id']){delete _0x154240[_0xf1a0('0x45')]['id'];}return db[_0xf1a0('0x27')][_0xf1a0('0x43')]({'where':{'id':_0x154240[_0xf1a0('0x46')]['id']}})[_0xf1a0('0x23')](handleEntityNotFound(_0x474f8f,null))[_0xf1a0('0x23')](saveUpdates(_0x154240['body'],null))[_0xf1a0('0x23')](respondWithResult(_0x474f8f,null))[_0xf1a0('0x42')](handleError(_0x474f8f,null));};exports[_0xf1a0('0x47')]=function(_0x5c9a6f,_0x5182d0){return db[_0xf1a0('0x27')][_0xf1a0('0x43')]({'where':{'id':_0x5c9a6f[_0xf1a0('0x46')]['id']}})[_0xf1a0('0x23')](handleEntityNotFound(_0x5182d0,null))[_0xf1a0('0x23')](removeEntity(_0x5182d0,null))[_0xf1a0('0x42')](handleError(_0x5182d0,null));};exports[_0xf1a0('0x48')]=function(_0x99a07,_0x29cdc6){var _0x2375f2;return db[_0xf1a0('0x49')][_0xf1a0('0x4a')](function(_0x4347eb){return db[_0xf1a0('0x27')][_0xf1a0('0x48')](_0x99a07['body'],{'transaction':_0x4347eb})[_0xf1a0('0x23')](function(_0x310971){_0x2375f2=_0x310971;var _0x7fb2c5={'type':db['Sequelize']['TEXT'],'transaction':_0x4347eb};switch(_0x99a07['body'][_0xf1a0('0x2a')]){case _0xf1a0('0x4b'):_0x7fb2c5[_0xf1a0('0x2a')]=db['Sequelize'][_0xf1a0('0x4c')];break;case'number':_0x7fb2c5[_0xf1a0('0x2a')]=db[_0xf1a0('0x4d')][_0xf1a0('0x4e')];break;case _0xf1a0('0x4f'):_0x7fb2c5[_0xf1a0('0x2a')]=db[_0xf1a0('0x4d')][_0xf1a0('0x50')];_0x7fb2c5['defaultValue']=![];break;default:}return db[_0xf1a0('0x49')][_0xf1a0('0x51')][_0xf1a0('0x52')](_0xf1a0('0x53'),util['format'](_0xf1a0('0x54'),_0x2375f2['id']),_0x7fb2c5);})[_0xf1a0('0x23')](function(){return _0x2375f2;});})[_0xf1a0('0x23')](respondWithResult(_0x29cdc6,0xc9))[_0xf1a0('0x42')](handleError(_0x29cdc6,null));}; \ No newline at end of file +var _0x2630=['destroy','sendStatus','error','stack','name','send','index','map','CmCustomField','fieldName','type','key','model','differenceBy','query','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','where','merge','options','includeAll','findAll','rows','show','params','keys','rawAttributes','length','include','find','catch','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','defaultValue','addColumn','cm_contacts','format','cf_%d','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','json','reject','save','update','then'];(function(_0x529727,_0xf7211d){var _0x51de61=function(_0x52c6df){while(--_0x52c6df){_0x529727['push'](_0x529727['shift']());}};_0x51de61(++_0xf7211d);}(_0x2630,0x187));var _0x0263=function(_0x1d44f4,_0x54f648){_0x1d44f4=_0x1d44f4-0x0;var _0x2f7ecf=_0x2630[_0x1d44f4];return _0x2f7ecf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0263('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0263('0x1'));var moment=require(_0x0263('0x2'));var BPromise=require(_0x0263('0x3'));var Mustache=require(_0x0263('0x4'));var util=require(_0x0263('0x5'));var path=require('path');var sox=require(_0x0263('0x6'));var csv=require(_0x0263('0x7'));var ejs=require(_0x0263('0x8'));var fs=require('fs');var fs_extra=require(_0x0263('0x9'));var _=require(_0x0263('0xa'));var squel=require('squel');var crypto=require(_0x0263('0xb'));var jsforce=require(_0x0263('0xc'));var deskjs=require(_0x0263('0xd'));var toCsv=require(_0x0263('0x7'));var querystring=require(_0x0263('0xe'));var Papa=require(_0x0263('0xf'));var Redis=require(_0x0263('0x10'));var authService=require(_0x0263('0x11'));var qs=require(_0x0263('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0263('0x13'));var utils=require('../../config/utils');var config=require(_0x0263('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0263('0x15'))['db'];function respondWithStatusCode(_0x306f24,_0x217698){_0x217698=_0x217698||0xcc;return function(_0xf4e15e){if(_0xf4e15e){return _0x306f24['sendStatus'](_0x217698);}return _0x306f24[_0x0263('0x16')](_0x217698)[_0x0263('0x17')]();};}function respondWithResult(_0x35949e,_0x3c9979){_0x3c9979=_0x3c9979||0xc8;return function(_0x1ad0f7){if(_0x1ad0f7){return _0x35949e['status'](_0x3c9979)['json'](_0x1ad0f7);}};}function respondWithFilteredResult(_0x2c4dba,_0x24063b){return function(_0xf32ce9){if(_0xf32ce9){var _0x25230e=typeof _0x24063b[_0x0263('0x18')]===_0x0263('0x19')&&typeof _0x24063b[_0x0263('0x1a')]===_0x0263('0x19');var _0x25cfbe=_0xf32ce9[_0x0263('0x1b')];var _0x144551=_0x25230e?0x0:_0x24063b[_0x0263('0x18')];var _0x2c7e90=_0x25230e?_0xf32ce9[_0x0263('0x1b')]:_0x24063b[_0x0263('0x18')]+_0x24063b['limit'];var _0x15dc89;if(_0x2c7e90>=_0x25cfbe){_0x2c7e90=_0x25cfbe;_0x15dc89=0xc8;}else{_0x15dc89=0xce;}_0x2c4dba[_0x0263('0x16')](_0x15dc89);return _0x2c4dba[_0x0263('0x1c')]('Content-Range',_0x144551+'-'+_0x2c7e90+'/'+_0x25cfbe)[_0x0263('0x1d')](_0xf32ce9);}return null;};}function patchUpdates(_0x4ce22b){return function(_0x2c6d2b){try{jsonpatch['apply'](_0x2c6d2b,_0x4ce22b,!![]);}catch(_0x2cb4f5){return BPromise[_0x0263('0x1e')](_0x2cb4f5);}return _0x2c6d2b[_0x0263('0x1f')]();};}function saveUpdates(_0x4f9757,_0x4a143d){return function(_0x69a875){if(_0x69a875){return _0x69a875[_0x0263('0x20')](_0x4f9757)[_0x0263('0x21')](function(_0x2b72ab){return _0x2b72ab;});}return null;};}function removeEntity(_0x146be3,_0x33b3d5){return function(_0x518918){if(_0x518918){return _0x518918[_0x0263('0x22')]()[_0x0263('0x21')](function(){_0x146be3[_0x0263('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52c487,_0x235d90){return function(_0x425cb3){if(!_0x425cb3){_0x52c487[_0x0263('0x23')](0x194);}return _0x425cb3;};}function handleError(_0x1dee11,_0x237c61){_0x237c61=_0x237c61||0x1f4;return function(_0x1cadf3){logger[_0x0263('0x24')](_0x1cadf3[_0x0263('0x25')]);if(_0x1cadf3[_0x0263('0x26')]){delete _0x1cadf3[_0x0263('0x26')];}_0x1dee11[_0x0263('0x16')](_0x237c61)[_0x0263('0x27')](_0x1cadf3);};}exports[_0x0263('0x28')]=function(_0x1b81ce,_0x54d475){var _0x11b54d={},_0x441609={},_0x81d1af={'count':0x0,'rows':[]};var _0x4d15b8=_[_0x0263('0x29')](db[_0x0263('0x2a')]['rawAttributes'],function(_0x2a82bd){return{'name':_0x2a82bd[_0x0263('0x2b')],'type':_0x2a82bd[_0x0263('0x2c')][_0x0263('0x2d')]};});_0x441609[_0x0263('0x2e')]=_[_0x0263('0x2f')](_[_0x0263('0x29')](_0x4d15b8,_0x0263('0x26')),['name']);_0x441609[_0x0263('0x30')]=_['keys'](_0x1b81ce['query']);_0x441609['filters']=_[_0x0263('0x31')](_0x441609[_0x0263('0x2e')],_0x441609[_0x0263('0x30')]);_0x11b54d[_0x0263('0x32')]=_[_0x0263('0x31')](_0x441609[_0x0263('0x2e')],qs[_0x0263('0x33')](_0x1b81ce[_0x0263('0x30')][_0x0263('0x33')]));_0x11b54d['attributes']=_0x11b54d[_0x0263('0x32')]['length']?_0x11b54d[_0x0263('0x32')]:_0x441609[_0x0263('0x2e')];if(!_0x1b81ce['query'][_0x0263('0x34')]('nolimit')){_0x11b54d['limit']=qs[_0x0263('0x1a')](_0x1b81ce[_0x0263('0x30')][_0x0263('0x1a')]);_0x11b54d['offset']=qs[_0x0263('0x18')](_0x1b81ce[_0x0263('0x30')][_0x0263('0x18')]);}_0x11b54d[_0x0263('0x35')]=qs[_0x0263('0x36')](_0x1b81ce['query'][_0x0263('0x36')]);_0x11b54d['where']=qs[_0x0263('0x37')](_[_0x0263('0x38')](_0x1b81ce[_0x0263('0x30')],_0x441609[_0x0263('0x37')]),_0x4d15b8);if(_0x1b81ce[_0x0263('0x30')]['filter']){_0x11b54d[_0x0263('0x39')]=_['merge'](_0x11b54d[_0x0263('0x39')],{'$or':_[_0x0263('0x29')](_0x4d15b8,function(_0x258124){if(_0x258124[_0x0263('0x2c')]!=='VIRTUAL'){var _0x21935d={};_0x21935d[_0x258124[_0x0263('0x26')]]={'$like':'%'+_0x1b81ce['query']['filter']+'%'};return _0x21935d;}})});}_0x11b54d=_[_0x0263('0x3a')]({},_0x11b54d,_0x1b81ce[_0x0263('0x3b')]);var _0x5db5c2={'where':_0x11b54d[_0x0263('0x39')]};return db[_0x0263('0x2a')][_0x0263('0x1b')](_0x5db5c2)['then'](function(_0x4a4651){_0x81d1af['count']=_0x4a4651;if(_0x1b81ce[_0x0263('0x30')][_0x0263('0x3c')]){_0x11b54d['include']=[{'all':!![]}];}return db[_0x0263('0x2a')][_0x0263('0x3d')](_0x11b54d);})[_0x0263('0x21')](function(_0x955449){_0x81d1af[_0x0263('0x3e')]=_0x955449;return _0x81d1af;})[_0x0263('0x21')](respondWithFilteredResult(_0x54d475,_0x11b54d))['catch'](handleError(_0x54d475,null));};exports[_0x0263('0x3f')]=function(_0x171c22,_0x44cecc){var _0x476521={'raw':!![],'where':{'id':_0x171c22[_0x0263('0x40')]['id']}},_0x582621={};_0x582621[_0x0263('0x2e')]=_[_0x0263('0x41')](db[_0x0263('0x2a')][_0x0263('0x42')]);_0x582621[_0x0263('0x30')]=_[_0x0263('0x41')](_0x171c22[_0x0263('0x30')]);_0x582621['filters']=_[_0x0263('0x31')](_0x582621['model'],_0x582621[_0x0263('0x30')]);_0x476521[_0x0263('0x32')]=_[_0x0263('0x31')](_0x582621[_0x0263('0x2e')],qs[_0x0263('0x33')](_0x171c22[_0x0263('0x30')]['fields']));_0x476521[_0x0263('0x32')]=_0x476521[_0x0263('0x32')][_0x0263('0x43')]?_0x476521[_0x0263('0x32')]:_0x582621['model'];if(_0x171c22[_0x0263('0x30')]['includeAll']){_0x476521[_0x0263('0x44')]=[{'all':!![]}];}_0x476521=_[_0x0263('0x3a')]({},_0x476521,_0x171c22['options']);return db[_0x0263('0x2a')][_0x0263('0x45')](_0x476521)[_0x0263('0x21')](handleEntityNotFound(_0x44cecc,null))['then'](respondWithResult(_0x44cecc,null))[_0x0263('0x46')](handleError(_0x44cecc,null));};exports[_0x0263('0x20')]=function(_0x34aff9,_0x1af99b){if(_0x34aff9[_0x0263('0x47')]['id']){delete _0x34aff9['body']['id'];}return db['CmCustomField']['find']({'where':{'id':_0x34aff9[_0x0263('0x40')]['id']}})[_0x0263('0x21')](handleEntityNotFound(_0x1af99b,null))[_0x0263('0x21')](saveUpdates(_0x34aff9['body'],null))[_0x0263('0x21')](respondWithResult(_0x1af99b,null))[_0x0263('0x46')](handleError(_0x1af99b,null));};exports[_0x0263('0x22')]=function(_0x34f43f,_0x3183a8){return db[_0x0263('0x2a')][_0x0263('0x45')]({'where':{'id':_0x34f43f[_0x0263('0x40')]['id']}})[_0x0263('0x21')](handleEntityNotFound(_0x3183a8,null))['then'](removeEntity(_0x3183a8,null))[_0x0263('0x46')](handleError(_0x3183a8,null));};exports[_0x0263('0x48')]=function(_0x1ef2dc,_0x77920e){var _0x6a4dac;return db[_0x0263('0x49')][_0x0263('0x4a')](function(_0x2c42d9){return db[_0x0263('0x2a')]['create'](_0x1ef2dc['body'],{'transaction':_0x2c42d9})[_0x0263('0x21')](function(_0x12035b){_0x6a4dac=_0x12035b;var _0x5796db={'type':db[_0x0263('0x4b')][_0x0263('0x4c')],'transaction':_0x2c42d9};switch(_0x1ef2dc[_0x0263('0x47')][_0x0263('0x2c')]){case _0x0263('0x4d'):_0x5796db[_0x0263('0x2c')]=db[_0x0263('0x4b')]['TEXT'];break;case _0x0263('0x4e'):_0x5796db['type']=db[_0x0263('0x4b')][_0x0263('0x4f')];break;case'switch':_0x5796db[_0x0263('0x2c')]=db[_0x0263('0x4b')]['BOOLEAN'];_0x5796db[_0x0263('0x50')]=![];break;default:}return db[_0x0263('0x49')]['queryInterface'][_0x0263('0x51')](_0x0263('0x52'),util[_0x0263('0x53')](_0x0263('0x54'),_0x6a4dac['id']),_0x5796db);})[_0x0263('0x21')](function(){return _0x6a4dac;});})[_0x0263('0x21')](respondWithResult(_0x77920e,0xc9))[_0x0263('0x46')](handleError(_0x77920e,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 29df806..7805e5e 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 _0x73a5=['exports','cm_custom_fields','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0xc581e2,_0x24df14){var _0x232459=function(_0x195a25){while(--_0x195a25){_0xc581e2['push'](_0xc581e2['shift']());}};_0x232459(++_0x24df14);}(_0x73a5,0x86));var _0x573a=function(_0x220dc3,_0x149a64){_0x220dc3=_0x220dc3-0x0;var _0x4944ae=_0x73a5[_0x220dc3];return _0x4944ae;};'use strict';var _=require(_0x573a('0x0'));var util=require(_0x573a('0x1'));var logger=require(_0x573a('0x2'))(_0x573a('0x3'));var moment=require('moment');var BPromise=require(_0x573a('0x4'));var rp=require(_0x573a('0x5'));var fs=require('fs');var path=require(_0x573a('0x6'));var rimraf=require(_0x573a('0x7'));var config=require(_0x573a('0x8'));var attributes=require(_0x573a('0x9'));module[_0x573a('0xa')]=function(_0x3818d4,_0xd92d51){return _0x3818d4['define']('CmCustomField',attributes,{'tableName':_0x573a('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01b2=['CmCustomField','lodash','util','moment','request-promise','path','rimraf','define'];(function(_0x5e68af,_0x3d7a54){var _0x3f6cd5=function(_0x557dd7){while(--_0x557dd7){_0x5e68af['push'](_0x5e68af['shift']());}};_0x3f6cd5(++_0x3d7a54);}(_0x01b2,0x149));var _0x201b=function(_0x3c2166,_0x41fc16){_0x3c2166=_0x3c2166-0x0;var _0x30ccc3=_0x01b2[_0x3c2166];return _0x30ccc3;};'use strict';var _=require(_0x201b('0x0'));var util=require(_0x201b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x201b('0x2'));var BPromise=require('bluebird');var rp=require(_0x201b('0x3'));var fs=require('fs');var path=require(_0x201b('0x4'));var rimraf=require(_0x201b('0x5'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x111efd,_0x3a1ea9){return _0x111efd[_0x201b('0x6')](_0x201b('0x7'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 085736a..43e043f 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 _0x6a04=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x55331c,_0x3258ea){var _0x44cd29=function(_0x4bd03f){while(--_0x4bd03f){_0x55331c['push'](_0x55331c['shift']());}};_0x44cd29(++_0x3258ea);}(_0x6a04,0x182));var _0x46a0=function(_0x2cfa8e,_0x95a43){_0x2cfa8e=_0x2cfa8e-0x0;var _0xf7b0f0=_0x6a04[_0x2cfa8e];return _0xf7b0f0;};'use strict';var _=require(_0x46a0('0x0'));var util=require(_0x46a0('0x1'));var moment=require(_0x46a0('0x2'));var BPromise=require(_0x46a0('0x3'));var rs=require(_0x46a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46a0('0x5'))['db'];var utils=require(_0x46a0('0x6'));var logger=require('../../config/logger')(_0x46a0('0x7'));var config=require(_0x46a0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x46a0('0x9')][_0x46a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20a869,_0x41d83b,_0x4eb250){return new BPromise(function(_0xc3469e,_0x5eb20d){return client[_0x46a0('0xb')](_0x20a869,_0x4eb250)[_0x46a0('0xc')](function(_0x2de332){logger['info'](_0x46a0('0xd'),_0x41d83b,'request\x20sent');logger[_0x46a0('0xe')](_0x46a0('0xf'),_0x41d83b,_0x46a0('0x10'),JSON[_0x46a0('0x11')](_0x2de332));if(_0x2de332[_0x46a0('0x12')]){if(_0x2de332[_0x46a0('0x12')][_0x46a0('0x13')]===0x1f4){logger[_0x46a0('0x12')](_0x46a0('0xd'),_0x41d83b,_0x2de332['error'][_0x46a0('0x14')]);return _0x5eb20d(_0x2de332[_0x46a0('0x12')][_0x46a0('0x14')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x41d83b,_0x2de332[_0x46a0('0x12')]['message']);return _0xc3469e(_0x2de332[_0x46a0('0x12')][_0x46a0('0x14')]);}else{logger['info'](_0x46a0('0xd'),_0x41d83b,_0x46a0('0x10'));_0xc3469e(_0x2de332[_0x46a0('0x15')]['message']);}})[_0x46a0('0x16')](function(_0x110edf){logger[_0x46a0('0x12')](_0x46a0('0xd'),_0x41d83b,_0x110edf);_0x5eb20d(_0x110edf);});});} \ No newline at end of file +var _0x10a4=['http','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x5f3472,_0x47ada9){var _0x30b1fa=function(_0x1872f1){while(--_0x1872f1){_0x5f3472['push'](_0x5f3472['shift']());}};_0x30b1fa(++_0x47ada9);}(_0x10a4,0xb4));var _0x410a=function(_0x3c4702,_0x315207){_0x3c4702=_0x3c4702-0x0;var _0x186a83=_0x10a4[_0x3c4702];return _0x186a83;};'use strict';var _=require(_0x410a('0x0'));var util=require(_0x410a('0x1'));var moment=require(_0x410a('0x2'));var BPromise=require(_0x410a('0x3'));var rs=require(_0x410a('0x4'));var fs=require('fs');var Redis=require(_0x410a('0x5'));var db=require(_0x410a('0x6'))['db'];var utils=require(_0x410a('0x7'));var logger=require(_0x410a('0x8'))(_0x410a('0x9'));var config=require('../../config/environment');var jayson=require(_0x410a('0xa'));var client=jayson[_0x410a('0xb')][_0x410a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d5e98,_0x486625,_0x573c04){return new BPromise(function(_0x30b546,_0x3badd1){return client['request'](_0x5d5e98,_0x573c04)[_0x410a('0xd')](function(_0x5c68b0){logger[_0x410a('0xe')](_0x410a('0xf'),_0x486625,_0x410a('0x10'));logger[_0x410a('0x11')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x486625,_0x410a('0x10'),JSON[_0x410a('0x12')](_0x5c68b0));if(_0x5c68b0[_0x410a('0x13')]){if(_0x5c68b0['error'][_0x410a('0x14')]===0x1f4){logger[_0x410a('0x13')](_0x410a('0xf'),_0x486625,_0x5c68b0['error']['message']);return _0x3badd1(_0x5c68b0[_0x410a('0x13')]['message']);}logger[_0x410a('0x13')](_0x410a('0xf'),_0x486625,_0x5c68b0[_0x410a('0x13')][_0x410a('0x15')]);return _0x30b546(_0x5c68b0['error'][_0x410a('0x15')]);}else{logger[_0x410a('0xe')](_0x410a('0xf'),_0x486625,_0x410a('0x10'));_0x30b546(_0x5c68b0[_0x410a('0x16')][_0x410a('0x15')]);}})[_0x410a('0x17')](function(_0x3d8fe8){logger['error'](_0x410a('0xf'),_0x486625,_0x3d8fe8);_0x3badd1(_0x3d8fe8);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 0dbb7ca..8e7161f 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 _0x5aae=['create','update','delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','isAuthenticated','index','/:id','show'];(function(_0x29bfb7,_0x439c3b){var _0x26e631=function(_0x401c65){while(--_0x401c65){_0x29bfb7['push'](_0x29bfb7['shift']());}};_0x26e631(++_0x439c3b);}(_0x5aae,0xe5));var _0xe5aa=function(_0x3c1d98,_0x5e8a76){_0x3c1d98=_0x3c1d98-0x0;var _0x462c73=_0x5aae[_0x3c1d98];return _0x462c73;};'use strict';var multer=require(_0xe5aa('0x0'));var util=require(_0xe5aa('0x1'));var path=require(_0xe5aa('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe5aa('0x3'));var auth=require(_0xe5aa('0x4'));var interaction=require(_0xe5aa('0x5'));var config=require('../../config/environment');var controller=require(_0xe5aa('0x6'));router['get']('/',auth[_0xe5aa('0x7')](),controller[_0xe5aa('0x8')]);router['get'](_0xe5aa('0x9'),auth['isAuthenticated'](),controller[_0xe5aa('0xa')]);router['post']('/',auth[_0xe5aa('0x7')](),controller[_0xe5aa('0xb')]);router['put'](_0xe5aa('0x9'),auth[_0xe5aa('0x7')](),controller[_0xe5aa('0xc')]);router[_0xe5aa('0xd')]('/:id',auth[_0xe5aa('0x7')](),controller[_0xe5aa('0xe')]);module['exports']=router; \ No newline at end of file +var _0x6cfa=['./cmCustomField.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra'];(function(_0x3ec74a,_0x511693){var _0x39398d=function(_0x1ace5c){while(--_0x1ace5c){_0x3ec74a['push'](_0x3ec74a['shift']());}};_0x39398d(++_0x511693);}(_0x6cfa,0xa1));var _0xa6cf=function(_0x4eced3,_0x556d73){_0x4eced3=_0x4eced3-0x0;var _0x26436c=_0x6cfa[_0x4eced3];return _0x26436c;};'use strict';var multer=require(_0xa6cf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa6cf('0x1'));var express=require('express');var router=express[_0xa6cf('0x2')]();var fs_extra=require(_0xa6cf('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa6cf('0x4'));router[_0xa6cf('0x5')]('/',auth[_0xa6cf('0x6')](),controller[_0xa6cf('0x7')]);router[_0xa6cf('0x5')](_0xa6cf('0x8'),auth[_0xa6cf('0x6')](),controller['show']);router[_0xa6cf('0x9')]('/',auth['isAuthenticated'](),controller[_0xa6cf('0xa')]);router['put'](_0xa6cf('0x8'),auth[_0xa6cf('0x6')](),controller[_0xa6cf('0xb')]);router[_0xa6cf('0xc')]('/:id',auth[_0xa6cf('0x6')](),controller[_0xa6cf('0xd')]);module[_0xa6cf('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index dd97083..dca6df5 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 _0x7708=['moment','sequelize','STRING','INTEGER','BOOLEAN','DATE','UNSIGNED','contactListQueue'];(function(_0x29d398,_0x537070){var _0x3d5ed9=function(_0x5c9b00){while(--_0x5c9b00){_0x29d398['push'](_0x29d398['shift']());}};_0x3d5ed9(++_0x537070);}(_0x7708,0x188));var _0x8770=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x7708[_0x511bd1];return _0x4c48ec;};'use strict';var moment=require(_0x8770('0x0'));var Sequelize=require(_0x8770('0x1'));module['exports']={'phone':{'type':Sequelize[_0x8770('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x8770('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8770('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8770('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8770('0x5')]},'priority':{'type':Sequelize[_0x8770('0x3')](0x2)[_0x8770('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8770('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8770('0x3')],'unique':_0x8770('0x7')},'ListId':{'type':Sequelize[_0x8770('0x3')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x8770('0x3')]},'VoiceQueueId':{'type':Sequelize[_0x8770('0x3')],'unique':_0x8770('0x7')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x8770('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8770('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8770('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8770('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8770('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x8770('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xef0f=['moment','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue'];(function(_0x31e2cd,_0x4c05ba){var _0x48af4e=function(_0x270bdd){while(--_0x270bdd){_0x31e2cd['push'](_0x31e2cd['shift']());}};_0x48af4e(++_0x4c05ba);}(_0xef0f,0x168));var _0xfef0=function(_0xdc4445,_0x4b9e17){_0xdc4445=_0xdc4445-0x0;var _0x356c67=_0xef0f[_0xdc4445];return _0x356c67;};'use strict';var moment=require(_0xfef0('0x0'));var Sequelize=require('sequelize');module[_0xfef0('0x1')]={'phone':{'type':Sequelize[_0xfef0('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xfef0('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xfef0('0x4')](_0xfef0('0x5'))},'countbusyretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xfef0('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfef0('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfef0('0x7')]},'priority':{'type':Sequelize[_0xfef0('0x6')](0x2)[_0xfef0('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xfef0('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xfef0('0x6')],'unique':_0xfef0('0x9')},'UserId':{'type':Sequelize[_0xfef0('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xfef0('0x6')],'unique':_0xfef0('0x9')},'CampaignId':{'type':Sequelize[_0xfef0('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfef0('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xfef0('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0xfef0('0x7')],'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 6ed9fa9..c6d6b1e 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 _0x6f5c=['sendStatus','name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','keys','query','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$not','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','show','params','includeAll','options','find','catch','create','update','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','end','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','direction','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','recallme','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','getVoiceQueues','outbound','hopperId','findOne','scheduledat','getOpenContacts','isNumber','error','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy'];(function(_0x15b26f,_0x131eed){var _0x34c57c=function(_0x1458cf){while(--_0x1458cf){_0x15b26f['push'](_0x15b26f['shift']());}};_0x34c57c(++_0x131eed);}(_0x6f5c,0x7a));var _0xc6f5=function(_0x439875,_0x5769a7){_0x439875=_0x439875-0x0;var _0x318b21=_0x6f5c[_0x439875];return _0x318b21;};'use strict';var emlformat=require(_0xc6f5('0x0'));var rimraf=require(_0xc6f5('0x1'));var zipdir=require(_0xc6f5('0x2'));var jsonpatch=require(_0xc6f5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc6f5('0x4'));var Mustache=require(_0xc6f5('0x5'));var util=require(_0xc6f5('0x6'));var path=require(_0xc6f5('0x7'));var sox=require(_0xc6f5('0x8'));var csv=require('to-csv');var ejs=require(_0xc6f5('0x9'));var fs=require('fs');var fs_extra=require(_0xc6f5('0xa'));var _=require(_0xc6f5('0xb'));var squel=require(_0xc6f5('0xc'));var crypto=require(_0xc6f5('0xd'));var jsforce=require(_0xc6f5('0xe'));var deskjs=require(_0xc6f5('0xf'));var toCsv=require(_0xc6f5('0x10'));var querystring=require(_0xc6f5('0x11'));var Papa=require(_0xc6f5('0x12'));var Redis=require(_0xc6f5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc6f5('0x14'));var as=require(_0xc6f5('0x15'));var hardwareService=require(_0xc6f5('0x16'));var logger=require(_0xc6f5('0x17'))(_0xc6f5('0x18'));var utils=require(_0xc6f5('0x19'));var config=require('../../config/environment');var shared=require(_0xc6f5('0x1a'));var licenseUtil=require(_0xc6f5('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34734a,_0x1aa5a7){_0x1aa5a7=_0x1aa5a7||0xcc;return function(_0x1f7929){if(_0x1f7929){return _0x34734a['sendStatus'](_0x1aa5a7);}return _0x34734a[_0xc6f5('0x1c')](_0x1aa5a7)['end']();};}function respondWithResult(_0x5cd088,_0x17ce8c){_0x17ce8c=_0x17ce8c||0xc8;return function(_0x5b33ea){if(_0x5b33ea){return _0x5cd088[_0xc6f5('0x1c')](_0x17ce8c)[_0xc6f5('0x1d')](_0x5b33ea);}};}function respondWithFilteredResult(_0x4c904c,_0x5a2e9a){return function(_0x5e98c5){if(_0x5e98c5){var _0x397af3=typeof _0x5a2e9a[_0xc6f5('0x1e')]===_0xc6f5('0x1f')&&typeof _0x5a2e9a[_0xc6f5('0x20')]===_0xc6f5('0x1f');var _0x177d96=_0x5e98c5['count'];var _0x201764=_0x397af3?0x0:_0x5a2e9a[_0xc6f5('0x1e')];var _0x10b790=_0x397af3?_0x5e98c5['count']:_0x5a2e9a['offset']+_0x5a2e9a['limit'];var _0xb5156a;if(_0x10b790>=_0x177d96){_0x10b790=_0x177d96;_0xb5156a=0xc8;}else{_0xb5156a=0xce;}_0x4c904c['status'](_0xb5156a);return _0x4c904c[_0xc6f5('0x21')](_0xc6f5('0x22'),_0x201764+'-'+_0x10b790+'/'+_0x177d96)[_0xc6f5('0x1d')](_0x5e98c5);}return null;};}function patchUpdates(_0x55c68d){return function(_0x48a8a6){try{jsonpatch[_0xc6f5('0x23')](_0x48a8a6,_0x55c68d,!![]);}catch(_0xd9ceda){return BPromise[_0xc6f5('0x24')](_0xd9ceda);}return _0x48a8a6['save']();};}function saveUpdates(_0x3c093e,_0x1b7de2){return function(_0x175b5f){if(_0x175b5f){return _0x175b5f['update'](_0x3c093e)[_0xc6f5('0x25')](function(_0x362741){return _0x362741;});}return null;};}function removeEntity(_0x34eb70,_0x1dd8f3){return function(_0x32b13a){if(_0x32b13a){return _0x32b13a[_0xc6f5('0x26')]()['then'](function(){_0x34eb70['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x533942,_0x485aac){return function(_0x1cfb4d){if(!_0x1cfb4d){_0x533942[_0xc6f5('0x27')](0x194);}return _0x1cfb4d;};}function handleError(_0x510a6a,_0x47be67){_0x47be67=_0x47be67||0x1f4;return function(_0x51307c){logger['error'](_0x51307c['stack']);if(_0x51307c[_0xc6f5('0x28')]){delete _0x51307c[_0xc6f5('0x28')];}_0x510a6a[_0xc6f5('0x1c')](_0x47be67)[_0xc6f5('0x29')](_0x51307c);};}exports[_0xc6f5('0x2a')]=function(_0x30b098,_0x239359){var _0x17f779={},_0x5b1c3c={},_0x3b2c88={'count':0x0,'rows':[]};var _0x23a608=_[_0xc6f5('0x2b')](db[_0xc6f5('0x2c')][_0xc6f5('0x2d')],function(_0x49bc65){return{'name':_0x49bc65[_0xc6f5('0x2e')],'type':_0x49bc65[_0xc6f5('0x2f')]['key']};});_0x5b1c3c[_0xc6f5('0x30')]=_[_0xc6f5('0x2b')](_0x23a608,_0xc6f5('0x28'));_0x5b1c3c['query']=_[_0xc6f5('0x31')](_0x30b098[_0xc6f5('0x32')]);_0x5b1c3c[_0xc6f5('0x33')]=_[_0xc6f5('0x34')](_0x5b1c3c['model'],_0x5b1c3c[_0xc6f5('0x32')]);_0x5b1c3c['filters']=_[_0xc6f5('0x35')](_0x5b1c3c[_0xc6f5('0x33')],[_0xc6f5('0x36'),_0xc6f5('0x37'),_0xc6f5('0x38'),_0xc6f5('0x39'),_0xc6f5('0x3a'),_0xc6f5('0x3b'),_0xc6f5('0x3c'),'$eq',_0xc6f5('0x3d'),'$between',_0xc6f5('0x3e'),_0xc6f5('0x3f'),_0xc6f5('0x40'),_0xc6f5('0x41'),'$notLike',_0xc6f5('0x42'),_0xc6f5('0x43'),'$like',_0xc6f5('0x44'),_0xc6f5('0x45'),'$contained',_0xc6f5('0x46')]);_0x17f779[_0xc6f5('0x47')]=_[_0xc6f5('0x34')](_0x5b1c3c[_0xc6f5('0x30')],qs[_0xc6f5('0x48')](_0x30b098['query'][_0xc6f5('0x48')]));_0x17f779[_0xc6f5('0x47')]=_0x17f779[_0xc6f5('0x47')][_0xc6f5('0x49')]?_0x17f779[_0xc6f5('0x47')]:_0x5b1c3c[_0xc6f5('0x30')];if(!_0x30b098[_0xc6f5('0x32')][_0xc6f5('0x4a')](_0xc6f5('0x4b'))){_0x17f779[_0xc6f5('0x20')]=qs[_0xc6f5('0x20')](_0x30b098[_0xc6f5('0x32')][_0xc6f5('0x20')]);_0x17f779[_0xc6f5('0x1e')]=qs[_0xc6f5('0x1e')](_0x30b098['query'][_0xc6f5('0x1e')]);}_0x17f779['order']=qs[_0xc6f5('0x4c')](_0x30b098[_0xc6f5('0x32')][_0xc6f5('0x4c')]);_0x17f779[_0xc6f5('0x4d')]=qs[_0xc6f5('0x33')](_[_0xc6f5('0x4e')](_0x30b098[_0xc6f5('0x32')],_0x5b1c3c[_0xc6f5('0x33')]),_0x23a608);if(_0x30b098[_0xc6f5('0x32')][_0xc6f5('0x4f')]){_0x17f779['where']=_[_0xc6f5('0x50')](_0x17f779[_0xc6f5('0x4d')],{'$or':_['map'](_0x23a608,function(_0x216821){if(_0x216821['type']!==_0xc6f5('0x51')){var _0x24bff6={};_0x24bff6[_0x216821['name']]={'$like':'%'+_0x30b098[_0xc6f5('0x32')][_0xc6f5('0x4f')]+'%'};return _0x24bff6;}})});}_0x17f779=_[_0xc6f5('0x50')]({},_0x17f779,_0x30b098['options']);var _0x5eb46f={'where':_0x17f779[_0xc6f5('0x4d')]};return db[_0xc6f5('0x2c')][_0xc6f5('0x52')](_0x5eb46f)['then'](function(_0x3fdf08){_0x3b2c88[_0xc6f5('0x52')]=_0x3fdf08;if(_0x30b098[_0xc6f5('0x32')]['includeAll']){_0x17f779[_0xc6f5('0x53')]=[{'all':!![]}];}return db['CmHopper'][_0xc6f5('0x54')](_0x17f779);})['then'](function(_0x9a094c){_0x3b2c88[_0xc6f5('0x55')]=_0x9a094c;return _0x3b2c88;})['then'](respondWithFilteredResult(_0x239359,_0x17f779))['catch'](handleError(_0x239359,null));};exports[_0xc6f5('0x56')]=function(_0xe42e58,_0x4ea136){var _0x17013c={'raw':!![],'where':{'id':_0xe42e58[_0xc6f5('0x57')]['id']}},_0xb570b5={};_0xb570b5[_0xc6f5('0x30')]=_[_0xc6f5('0x31')](db[_0xc6f5('0x2c')]['rawAttributes']);_0xb570b5[_0xc6f5('0x32')]=_['keys'](_0xe42e58[_0xc6f5('0x32')]);_0xb570b5[_0xc6f5('0x33')]=_['intersection'](_0xb570b5['model'],_0xb570b5[_0xc6f5('0x32')]);_0x17013c[_0xc6f5('0x47')]=_['intersection'](_0xb570b5[_0xc6f5('0x30')],qs[_0xc6f5('0x48')](_0xe42e58[_0xc6f5('0x32')]['fields']));_0x17013c[_0xc6f5('0x47')]=_0x17013c[_0xc6f5('0x47')][_0xc6f5('0x49')]?_0x17013c[_0xc6f5('0x47')]:_0xb570b5[_0xc6f5('0x30')];if(_0xe42e58[_0xc6f5('0x32')][_0xc6f5('0x58')]){_0x17013c[_0xc6f5('0x53')]=[{'all':!![]}];}_0x17013c=_[_0xc6f5('0x50')]({},_0x17013c,_0xe42e58[_0xc6f5('0x59')]);return db[_0xc6f5('0x2c')][_0xc6f5('0x5a')](_0x17013c)[_0xc6f5('0x25')](handleEntityNotFound(_0x4ea136,null))[_0xc6f5('0x25')](respondWithResult(_0x4ea136,null))[_0xc6f5('0x5b')](handleError(_0x4ea136,null));};exports[_0xc6f5('0x5c')]=function(_0xea4cfc,_0x38c754){return db[_0xc6f5('0x2c')]['create'](_0xea4cfc['body'],{})[_0xc6f5('0x25')](respondWithResult(_0x38c754,0xc9))[_0xc6f5('0x5b')](handleError(_0x38c754,null));};exports[_0xc6f5('0x5d')]=function(_0x26fc43,_0x55c627){if(_0x26fc43[_0xc6f5('0x5e')]['id']){delete _0x26fc43[_0xc6f5('0x5e')]['id'];}return db[_0xc6f5('0x2c')][_0xc6f5('0x5a')]({'where':{'id':_0x26fc43[_0xc6f5('0x57')]['id']}})[_0xc6f5('0x25')](handleEntityNotFound(_0x55c627,null))[_0xc6f5('0x25')](saveUpdates(_0x26fc43[_0xc6f5('0x5e')],null))[_0xc6f5('0x25')](respondWithResult(_0x55c627,null))[_0xc6f5('0x5b')](handleError(_0x55c627,null));};exports[_0xc6f5('0x5f')]=function(_0x46e748,_0x297bae){return db[_0xc6f5('0x2c')][_0xc6f5('0x5f')]()['then'](respondWithResult(_0x297bae,null))[_0xc6f5('0x5b')](handleError(_0x297bae,null));};exports[_0xc6f5('0x26')]=function(_0x4d6a5e,_0x2717dc){var _0x8125d9;return db[_0xc6f5('0x2c')][_0xc6f5('0x5a')]({'where':{'id':_0x4d6a5e[_0xc6f5('0x57')]['id']}})[_0xc6f5('0x25')](handleEntityNotFound(_0x2717dc,null))['then'](function(_0x407f86){if(_0x407f86){return _0x407f86['destroy']()[_0xc6f5('0x25')](function(_0x58c639){return _0x58c639;});}})[_0xc6f5('0x25')](function(_0x338aec){_0x8125d9=_0x338aec;if(_0x338aec){if(_0x338aec[_0xc6f5('0x60')]||_0x338aec[_0xc6f5('0x61')]){return db[_0x338aec['VoiceQueueId']?_0xc6f5('0x62'):_0xc6f5('0x63')][_0xc6f5('0x5a')]({'where':{'id':_0x338aec[_0xc6f5('0x60')]?_0x338aec[_0xc6f5('0x60')]:_0x338aec[_0xc6f5('0x61')]},'attributes':['id',_0xc6f5('0x28')],'raw':!![]});}}})['then'](function(_0x1d3f66){var _0x24aa10={};if(_0x1d3f66){_[_0xc6f5('0x50')](_0x24aa10,_[_0xc6f5('0x64')](_0x8125d9[_0xc6f5('0x65')],[_0xc6f5('0x66'),_0xc6f5('0x67'),'id']));_0x24aa10['state']=0x15;_0x24aa10[_0xc6f5('0x68')]=_0xc6f5('0x69');_0x24aa10[_0xc6f5('0x6a')]=_0x1d3f66[_0xc6f5('0x28')];_0x24aa10[_0xc6f5('0x6b')]=_0x4d6a5e[_0xc6f5('0x6c')]['name'];_0x24aa10[_0xc6f5('0x6d')]=_0x4d6a5e[_0xc6f5('0x6c')]['id'];_0x24aa10[_0xc6f5('0x69')]=!![];_0x24aa10[_0xc6f5('0x6e')]=moment()[_0xc6f5('0x6f')](_0xc6f5('0x70'));_0x24aa10['calleridnum']=_0x8125d9['phone'];_0x24aa10['campaigntype']=_0x8125d9[_0xc6f5('0x60')]?_0xc6f5('0x71'):'ivr';return db[_0xc6f5('0x72')][_0xc6f5('0x5a')]({'where':{'id':_0x24aa10[_0xc6f5('0x73')]},'attributes':[_0xc6f5('0x74'),_0xc6f5('0x75')]})['then'](function(_0x442d0b){if(!_['isNil'](_0x2717dc)&&!_[_0xc6f5('0x76')](_0x442d0b[_0xc6f5('0x74')])){_0x24aa10[_0xc6f5('0x77')]=_0x442d0b[_0xc6f5('0x74')];if(!_[_0xc6f5('0x76')](_0x442d0b[_0xc6f5('0x75')])){_0x24aa10[_0xc6f5('0x77')]+='\x20'+_0x442d0b[_0xc6f5('0x75')];}}})[_0xc6f5('0x78')](function(){return db['CmHopperFinal'][_0xc6f5('0x5c')](_0x24aa10);});}})[_0xc6f5('0x25')](function(){return _0x2717dc[_0xc6f5('0x1c')](0xcc)[_0xc6f5('0x79')]();})[_0xc6f5('0x5b')](handleError(_0x2717dc,null));};exports['getPreview']=function(_0x4fa761,_0x3c197e,_0x1900cc){var _0x406909=[];return db[_0xc6f5('0x72')][_0xc6f5('0x5f')]()[_0xc6f5('0x25')](function(_0x1a9bb5){_0x406909=_['keys'](_0x1a9bb5);return _0x4fa761[_0xc6f5('0x6c')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xc6f5('0x7a')},'attributes':['id',_0xc6f5('0x7b'),_0xc6f5('0x7c')],'raw':!![]});})[_0xc6f5('0x25')](function(_0x16e84d){if(_0x16e84d&&_0x16e84d[_0xc6f5('0x49')]){return db[_0xc6f5('0x7d')][_0xc6f5('0x7e')](function(_0x3c4883){var _0x166374={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xc6f5('0x6f')](_0xc6f5('0x70'))},'VoiceQueueId':{'$in':_[_0xc6f5('0x2b')](_0x16e84d,'id')},'$or':[{'UserId':null},{'UserId':_0x4fa761['user']['id']}]};var _0x9c5d62={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x16e84d)[_0xc6f5('0x4f')](['dialPreviewAutoRecallMe',0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x4fa761[_0xc6f5('0x6c')]['id']}]};var _0x594dd9={'$or':[_0x166374,_0x9c5d62]};var _0x416e1f=[];if(_0x4fa761[_0xc6f5('0x5e')][_0xc6f5('0x7f')]&&_0x4fa761['body'][_0xc6f5('0x7f')]==='prev'){if(!_['isEmpty'](_0x4fa761[_0xc6f5('0x5e')][_0xc6f5('0x80')])){_0x594dd9['id']={'$in':_0x4fa761[_0xc6f5('0x5e')][_0xc6f5('0x80')]};}_0x416e1f=[[_0xc6f5('0x81'),_0xc6f5('0x82')],[_0xc6f5('0x83'),_0x16e84d[0x0][_0xc6f5('0x7b')]==='ASC'?_0xc6f5('0x84'):_0xc6f5('0x82')],db[_0xc6f5('0x7d')][_0xc6f5('0x85')](_0xc6f5('0x86')),['id','DESC']];}else{if(!_[_0xc6f5('0x87')](_0x4fa761[_0xc6f5('0x5e')]['hopperIds'])){_0x594dd9['id']={'$notIn':_0x4fa761[_0xc6f5('0x5e')][_0xc6f5('0x80')]};}_0x416e1f=[[_0xc6f5('0x81'),_0xc6f5('0x84')],[_0xc6f5('0x83'),_0x16e84d[0x0][_0xc6f5('0x7b')]],db['sequelize'][_0xc6f5('0x85')](_0xc6f5('0x88')),['id',_0xc6f5('0x82')]];}return db['CmHopper']['findOne']({'attributes':['id','scheduledat',_0xc6f5('0x89')],'where':_0x594dd9,'order':_0x416e1f,'transaction':_0x3c4883,'lock':_0x3c4883['LOCK'][_0xc6f5('0x8a')],'include':[{'model':db[_0xc6f5('0x72')],'as':_0xc6f5('0x8b'),'attributes':_0x406909,'include':[{'model':db[_0xc6f5('0x8c')],'as':_0xc6f5('0x8d'),'attributes':['id',_0xc6f5('0x28')]}]},{'model':db[_0xc6f5('0x8e')],'as':_0xc6f5('0x8f'),'attributes':['id',_0xc6f5('0x28')]},{'model':db[_0xc6f5('0x62')],'as':_0xc6f5('0x90'),'attributes':['id',_0xc6f5('0x28'),_0xc6f5('0x91')]}]})[_0xc6f5('0x25')](function(_0x5489ce){if(_0x5489ce){return _0x5489ce[_0xc6f5('0x5d')]({'UserId':_0x4fa761['user']['id']},{'transaction':_0x3c4883});}});});}})[_0xc6f5('0x25')](handleEntityNotFound(_0x3c197e,null))['then'](respondWithResult(_0x3c197e,null))[_0xc6f5('0x5b')](handleError(_0x3c197e,null));};exports[_0xc6f5('0x92')]=function(_0x5359eb,_0x1b4a01,_0x49fd00){var _0xcec8cb=[];return db['CmContact'][_0xc6f5('0x5f')]()[_0xc6f5('0x25')](function(_0x34658e){_0xcec8cb=_[_0xc6f5('0x31')](_0x34658e);return _0x5359eb[_0xc6f5('0x6c')][_0xc6f5('0x93')]({'where':{'type':_0xc6f5('0x94'),'dialActive':!![],'dialMethod':_0xc6f5('0x7a')},'attributes':['id','dialOrderByScheduledAt',_0xc6f5('0x7c')],'raw':!![]});})[_0xc6f5('0x25')](function(_0x59a1e1){if(_0x59a1e1&&_0x59a1e1[_0xc6f5('0x49')]){return db[_0xc6f5('0x7d')]['transaction'](function(_0x17e4fd){var _0x4c8d36={'active':![],'recallme':!![],'id':_0x5359eb[_0xc6f5('0x5e')][_0xc6f5('0x95')]};return db[_0xc6f5('0x2c')][_0xc6f5('0x96')]({'attributes':['id',_0xc6f5('0x97'),'recallme'],'where':_0x4c8d36,'transaction':_0x17e4fd,'lock':_0x17e4fd['LOCK'][_0xc6f5('0x8a')],'include':[{'model':db['CmContact'],'as':_0xc6f5('0x8b'),'attributes':_0xcec8cb,'include':[{'model':db[_0xc6f5('0x8c')],'as':_0xc6f5('0x8d'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xc6f5('0x8f'),'attributes':['id','name']},{'model':db[_0xc6f5('0x62')],'as':_0xc6f5('0x90'),'attributes':['id',_0xc6f5('0x28'),'dialActive']}]})['then'](function(_0x3c20aa){if(_0x3c20aa){return _0x3c20aa[_0xc6f5('0x5d')]({'UserId':_0x5359eb[_0xc6f5('0x6c')]['id']},{'transaction':_0x17e4fd});}});});}})[_0xc6f5('0x25')](handleEntityNotFound(_0x1b4a01,null))[_0xc6f5('0x25')](respondWithResult(_0x1b4a01,null))[_0xc6f5('0x5b')](handleError(_0x1b4a01,null));};exports[_0xc6f5('0x98')]=function(_0x2c4789,_0x30f105,_0x4cb954){return _0x2c4789[_0xc6f5('0x6c')][_0xc6f5('0x93')]({'where':{'type':_0xc6f5('0x94'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xc6f5('0x25')](function(_0x49e196){if(_0x49e196&&_0x49e196[_0xc6f5('0x49')]){return db[_0xc6f5('0x2c')][_0xc6f5('0x52')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xc6f5('0x6f')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xc6f5('0x2b')](_0x49e196,'id')},'$or':[{'UserId':null},{'UserId':_0x2c4789[_0xc6f5('0x6c')]['id']}]}});}return 0x0;})[_0xc6f5('0x25')](function(_0x59ba82){if(!_[_0xc6f5('0x76')](_0x59ba82)&&_[_0xc6f5('0x99')](_0x59ba82)){return _0x30f105[_0xc6f5('0x1c')](0xc8)[_0xc6f5('0x1d')]({'contacts':_0x59ba82});}else{logger[_0xc6f5('0x9a')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xc6f5('0x98'),0x194,_0xc6f5('0x9b'));_0x30f105['sendStatus'](0x194);}})[_0xc6f5('0x5b')](handleError(_0x30f105,null));};exports[_0xc6f5('0x9c')]=function(_0x3cfe77,_0xda0583,_0xdd3fe6){var _0x3ad2fd=shared[_0xc6f5('0x9d')];var _0x4241b4=[];_[_0xc6f5('0x2b')](_0x3ad2fd,function(_0x369c61){_0x4241b4[_0xc6f5('0x9e')]({'id':_0x369c61[_0xc6f5('0x28')],'name':_0x369c61[_0xc6f5('0x28')],'utcOffset':_0x369c61[_0xc6f5('0x9f')]});});return _0xda0583[_0xc6f5('0x1c')](0xc8)[_0xc6f5('0x1d')]({'tz':_0x4241b4});};exports[_0xc6f5('0xa0')]=function(_0x154941,_0x3d72d2,_0x26b317){var _0x2b5bf6=shared[_0xc6f5('0x9d')];var _0x13354f={};if(!_[_0xc6f5('0x76')](_0x2b5bf6[_0x154941[_0xc6f5('0x5e')]['id']]))_0x13354f=_0x2b5bf6[_0x154941[_0xc6f5('0x5e')]['id']];return _0x3d72d2[_0xc6f5('0x1c')](0xc8)[_0xc6f5('0x1d')](_0x13354f);}; \ No newline at end of file +var _0x5304=['UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','dialActive','getPreviewRecall','findOne','Company','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','eml-format','rimraf','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','map','filters','intersection','model','query','concat','$and','$or','$gte','$lt','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','CmHopper','includeAll','include','findAll','rows','show','keys','options','catch','create','body','find','params','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','statedesc','campaign'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5304,0x167));var _0x4530=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0x5304[_0x15d18f];return _0xd12bf7;};'use strict';var emlformat=require(_0x4530('0x0'));var rimraf=require(_0x4530('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4530('0x2'));var BPromise=require(_0x4530('0x3'));var Mustache=require(_0x4530('0x4'));var util=require('util');var path=require(_0x4530('0x5'));var sox=require('sox');var csv=require(_0x4530('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4530('0x7'));var _=require('lodash');var squel=require(_0x4530('0x8'));var crypto=require(_0x4530('0x9'));var jsforce=require(_0x4530('0xa'));var deskjs=require(_0x4530('0xb'));var toCsv=require(_0x4530('0x6'));var querystring=require('querystring');var Papa=require(_0x4530('0xc'));var Redis=require(_0x4530('0xd'));var authService=require(_0x4530('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var shared=require('../../config/environment');var licenseUtil=require(_0x4530('0xf'));var db=require(_0x4530('0x10'))['db'];function respondWithStatusCode(_0x895da3,_0x16c428){_0x16c428=_0x16c428||0xcc;return function(_0x9ad0bd){if(_0x9ad0bd){return _0x895da3[_0x4530('0x11')](_0x16c428);}return _0x895da3[_0x4530('0x12')](_0x16c428)[_0x4530('0x13')]();};}function respondWithResult(_0x1bd136,_0x4ed52b){_0x4ed52b=_0x4ed52b||0xc8;return function(_0xcce6b8){if(_0xcce6b8){return _0x1bd136[_0x4530('0x12')](_0x4ed52b)[_0x4530('0x14')](_0xcce6b8);}};}function respondWithFilteredResult(_0x18b1df,_0x5d68f6){return function(_0x31999b){if(_0x31999b){var _0x2b704b=typeof _0x5d68f6[_0x4530('0x15')]===_0x4530('0x16')&&typeof _0x5d68f6[_0x4530('0x17')]===_0x4530('0x16');var _0x50c690=_0x31999b[_0x4530('0x18')];var _0x2e39bb=_0x2b704b?0x0:_0x5d68f6[_0x4530('0x15')];var _0x17ed53=_0x2b704b?_0x31999b[_0x4530('0x18')]:_0x5d68f6['offset']+_0x5d68f6[_0x4530('0x17')];var _0x51191a;if(_0x17ed53>=_0x50c690){_0x17ed53=_0x50c690;_0x51191a=0xc8;}else{_0x51191a=0xce;}_0x18b1df[_0x4530('0x12')](_0x51191a);return _0x18b1df[_0x4530('0x19')](_0x4530('0x1a'),_0x2e39bb+'-'+_0x17ed53+'/'+_0x50c690)['json'](_0x31999b);}return null;};}function patchUpdates(_0x5edac2){return function(_0x57f2f9){try{jsonpatch['apply'](_0x57f2f9,_0x5edac2,!![]);}catch(_0x30b644){return BPromise['reject'](_0x30b644);}return _0x57f2f9[_0x4530('0x1b')]();};}function saveUpdates(_0x45c8e7,_0x3836dd){return function(_0x512d48){if(_0x512d48){return _0x512d48[_0x4530('0x1c')](_0x45c8e7)[_0x4530('0x1d')](function(_0xc51dc7){return _0xc51dc7;});}return null;};}function removeEntity(_0x173a4d,_0x3edb06){return function(_0x5ae4bd){if(_0x5ae4bd){return _0x5ae4bd[_0x4530('0x1e')]()[_0x4530('0x1d')](function(){_0x173a4d[_0x4530('0x12')](0xcc)[_0x4530('0x13')]();});}};}function handleEntityNotFound(_0x3a2eb3,_0x320862){return function(_0x36c6fe){if(!_0x36c6fe){_0x3a2eb3[_0x4530('0x11')](0x194);}return _0x36c6fe;};}function handleError(_0x12e6a8,_0x41e471){_0x41e471=_0x41e471||0x1f4;return function(_0x59b4e0){logger[_0x4530('0x1f')](_0x59b4e0[_0x4530('0x20')]);if(_0x59b4e0[_0x4530('0x21')]){delete _0x59b4e0['name'];}_0x12e6a8[_0x4530('0x12')](_0x41e471)[_0x4530('0x22')](_0x59b4e0);};}exports['index']=function(_0x4dc430,_0x4838e2){var _0x150d11={},_0x235356={},_0x205da5={'count':0x0,'rows':[]};var _0x32e317=_['map'](db['CmHopper'][_0x4530('0x23')],function(_0x17bad2){return{'name':_0x17bad2[_0x4530('0x24')],'type':_0x17bad2[_0x4530('0x25')][_0x4530('0x26')]};});_0x235356['model']=_[_0x4530('0x27')](_0x32e317,_0x4530('0x21'));_0x235356['query']=_['keys'](_0x4dc430['query']);_0x235356[_0x4530('0x28')]=_[_0x4530('0x29')](_0x235356[_0x4530('0x2a')],_0x235356[_0x4530('0x2b')]);_0x235356[_0x4530('0x28')]=_[_0x4530('0x2c')](_0x235356['filters'],[_0x4530('0x2d'),_0x4530('0x2e'),'$gt',_0x4530('0x2f'),_0x4530('0x30'),'$lte',_0x4530('0x31'),_0x4530('0x32'),_0x4530('0x33'),_0x4530('0x34'),_0x4530('0x35'),_0x4530('0x36'),_0x4530('0x37'),_0x4530('0x38'),_0x4530('0x39'),_0x4530('0x3a'),_0x4530('0x3b'),_0x4530('0x38'),'$overlap',_0x4530('0x3c'),'$contained','$any']);_0x150d11[_0x4530('0x3d')]=_[_0x4530('0x29')](_0x235356[_0x4530('0x2a')],qs[_0x4530('0x3e')](_0x4dc430['query']['fields']));_0x150d11['attributes']=_0x150d11[_0x4530('0x3d')][_0x4530('0x3f')]?_0x150d11[_0x4530('0x3d')]:_0x235356[_0x4530('0x2a')];if(!_0x4dc430[_0x4530('0x2b')][_0x4530('0x40')](_0x4530('0x41'))){_0x150d11[_0x4530('0x17')]=qs[_0x4530('0x17')](_0x4dc430[_0x4530('0x2b')][_0x4530('0x17')]);_0x150d11[_0x4530('0x15')]=qs[_0x4530('0x15')](_0x4dc430[_0x4530('0x2b')][_0x4530('0x15')]);}_0x150d11[_0x4530('0x42')]=qs[_0x4530('0x43')](_0x4dc430[_0x4530('0x2b')][_0x4530('0x43')]);_0x150d11[_0x4530('0x44')]=qs[_0x4530('0x28')](_[_0x4530('0x45')](_0x4dc430[_0x4530('0x2b')],_0x235356['filters']),_0x32e317);if(_0x4dc430[_0x4530('0x2b')][_0x4530('0x46')]){_0x150d11[_0x4530('0x44')]=_[_0x4530('0x47')](_0x150d11[_0x4530('0x44')],{'$or':_[_0x4530('0x27')](_0x32e317,function(_0x1fcf4e){if(_0x1fcf4e[_0x4530('0x25')]!==_0x4530('0x48')){var _0x27d926={};_0x27d926[_0x1fcf4e[_0x4530('0x21')]]={'$like':'%'+_0x4dc430[_0x4530('0x2b')][_0x4530('0x46')]+'%'};return _0x27d926;}})});}_0x150d11=_['merge']({},_0x150d11,_0x4dc430['options']);var _0xe8bc79={'where':_0x150d11[_0x4530('0x44')]};return db[_0x4530('0x49')][_0x4530('0x18')](_0xe8bc79)[_0x4530('0x1d')](function(_0x3c7dcb){_0x205da5[_0x4530('0x18')]=_0x3c7dcb;if(_0x4dc430['query'][_0x4530('0x4a')]){_0x150d11[_0x4530('0x4b')]=[{'all':!![]}];}return db['CmHopper'][_0x4530('0x4c')](_0x150d11);})[_0x4530('0x1d')](function(_0x1f5299){_0x205da5[_0x4530('0x4d')]=_0x1f5299;return _0x205da5;})[_0x4530('0x1d')](respondWithFilteredResult(_0x4838e2,_0x150d11))['catch'](handleError(_0x4838e2,null));};exports[_0x4530('0x4e')]=function(_0x85bbd2,_0x336172){var _0x30b310={'raw':!![],'where':{'id':_0x85bbd2['params']['id']}},_0x43291b={};_0x43291b[_0x4530('0x2a')]=_[_0x4530('0x4f')](db[_0x4530('0x49')]['rawAttributes']);_0x43291b['query']=_[_0x4530('0x4f')](_0x85bbd2[_0x4530('0x2b')]);_0x43291b[_0x4530('0x28')]=_['intersection'](_0x43291b[_0x4530('0x2a')],_0x43291b['query']);_0x30b310[_0x4530('0x3d')]=_[_0x4530('0x29')](_0x43291b['model'],qs[_0x4530('0x3e')](_0x85bbd2[_0x4530('0x2b')][_0x4530('0x3e')]));_0x30b310[_0x4530('0x3d')]=_0x30b310['attributes'][_0x4530('0x3f')]?_0x30b310[_0x4530('0x3d')]:_0x43291b['model'];if(_0x85bbd2[_0x4530('0x2b')][_0x4530('0x4a')]){_0x30b310['include']=[{'all':!![]}];}_0x30b310=_[_0x4530('0x47')]({},_0x30b310,_0x85bbd2[_0x4530('0x50')]);return db[_0x4530('0x49')]['find'](_0x30b310)['then'](handleEntityNotFound(_0x336172,null))[_0x4530('0x1d')](respondWithResult(_0x336172,null))[_0x4530('0x51')](handleError(_0x336172,null));};exports[_0x4530('0x52')]=function(_0x5477d4,_0x16b0ae){return db['CmHopper'][_0x4530('0x52')](_0x5477d4[_0x4530('0x53')],{})[_0x4530('0x1d')](respondWithResult(_0x16b0ae,0xc9))['catch'](handleError(_0x16b0ae,null));};exports[_0x4530('0x1c')]=function(_0x31bfc4,_0x22a7d5){if(_0x31bfc4[_0x4530('0x53')]['id']){delete _0x31bfc4[_0x4530('0x53')]['id'];}return db['CmHopper'][_0x4530('0x54')]({'where':{'id':_0x31bfc4[_0x4530('0x55')]['id']}})[_0x4530('0x1d')](handleEntityNotFound(_0x22a7d5,null))[_0x4530('0x1d')](saveUpdates(_0x31bfc4['body'],null))[_0x4530('0x1d')](respondWithResult(_0x22a7d5,null))[_0x4530('0x51')](handleError(_0x22a7d5,null));};exports[_0x4530('0x56')]=function(_0x29007c,_0x232e28){return db['CmHopper'][_0x4530('0x56')]()['then'](respondWithResult(_0x232e28,null))[_0x4530('0x51')](handleError(_0x232e28,null));};exports['destroy']=function(_0x1e7602,_0x5b1361){var _0x4786f8;return db[_0x4530('0x49')][_0x4530('0x54')]({'where':{'id':_0x1e7602[_0x4530('0x55')]['id']}})['then'](handleEntityNotFound(_0x5b1361,null))[_0x4530('0x1d')](function(_0x30c6a3){if(_0x30c6a3){return _0x30c6a3[_0x4530('0x1e')]()[_0x4530('0x1d')](function(_0x5cc099){return _0x5cc099;});}})[_0x4530('0x1d')](function(_0x58fc2c){_0x4786f8=_0x58fc2c;if(_0x58fc2c){if(_0x58fc2c[_0x4530('0x57')]||_0x58fc2c[_0x4530('0x58')]){return db[_0x58fc2c['VoiceQueueId']?_0x4530('0x59'):_0x4530('0x5a')]['find']({'where':{'id':_0x58fc2c[_0x4530('0x57')]?_0x58fc2c[_0x4530('0x57')]:_0x58fc2c['CampaignId']},'attributes':['id',_0x4530('0x21')],'raw':!![]});}}})[_0x4530('0x1d')](function(_0x47f0a1){var _0x183cd3={};if(_0x47f0a1){_[_0x4530('0x47')](_0x183cd3,_[_0x4530('0x5b')](_0x4786f8[_0x4530('0x5c')],[_0x4530('0x5d'),'updatedAt','id']));_0x183cd3[_0x4530('0x5e')]=0x15;_0x183cd3[_0x4530('0x5f')]='deleted';_0x183cd3[_0x4530('0x60')]=_0x47f0a1[_0x4530('0x21')];_0x183cd3['membername']=_0x1e7602['user'][_0x4530('0x21')];_0x183cd3[_0x4530('0x61')]=_0x1e7602[_0x4530('0x62')]['id'];_0x183cd3['deleted']=!![];_0x183cd3[_0x4530('0x63')]=moment()[_0x4530('0x64')](_0x4530('0x65'));_0x183cd3['calleridnum']=_0x4786f8[_0x4530('0x66')];_0x183cd3['campaigntype']=_0x4786f8[_0x4530('0x57')]?_0x4530('0x67'):_0x4530('0x68');return db[_0x4530('0x69')]['find']({'where':{'id':_0x183cd3[_0x4530('0x6a')]},'attributes':[_0x4530('0x6b'),_0x4530('0x6c')]})[_0x4530('0x1d')](function(_0x4ae3c6){if(!_[_0x4530('0x6d')](_0x5b1361)&&!_[_0x4530('0x6d')](_0x4ae3c6[_0x4530('0x6b')])){_0x183cd3[_0x4530('0x6e')]=_0x4ae3c6[_0x4530('0x6b')];if(!_[_0x4530('0x6d')](_0x4ae3c6[_0x4530('0x6c')])){_0x183cd3['calleridname']+='\x20'+_0x4ae3c6[_0x4530('0x6c')];}}})['finally'](function(){return db['CmHopperFinal'][_0x4530('0x52')](_0x183cd3);});}})[_0x4530('0x1d')](function(){return _0x5b1361[_0x4530('0x12')](0xcc)['end']();})[_0x4530('0x51')](handleError(_0x5b1361,null));};exports[_0x4530('0x6f')]=function(_0x16b688,_0x145b73,_0x105542){var _0x16d8cf=[];return db[_0x4530('0x69')][_0x4530('0x56')]()[_0x4530('0x1d')](function(_0xc95b3c){_0x16d8cf=_[_0x4530('0x4f')](_0xc95b3c);return _0x16b688[_0x4530('0x62')][_0x4530('0x70')]({'where':{'type':_0x4530('0x71'),'dialActive':!![],'dialMethod':_0x4530('0x72')},'attributes':['id',_0x4530('0x73'),_0x4530('0x74')],'raw':!![]});})[_0x4530('0x1d')](function(_0x2dface){if(_0x2dface&&_0x2dface['length']){return db[_0x4530('0x75')][_0x4530('0x76')](function(_0x3ad21a){var _0x206caf={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4530('0x64')](_0x4530('0x65'))},'VoiceQueueId':{'$in':_[_0x4530('0x27')](_0x2dface,'id')},'$or':[{'UserId':null},{'UserId':_0x16b688[_0x4530('0x62')]['id']}]};var _0x23e329={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2dface)[_0x4530('0x46')]([_0x4530('0x74'),0x0])[_0x4530('0x27')]('id')[_0x4530('0x77')]()},'$or':[{'UserId':null},{'UserId':_0x16b688['user']['id']}]};var _0x8130bc={'$or':[_0x206caf,_0x23e329]};var _0x53da38=[];if(_0x16b688[_0x4530('0x53')]['direction']&&_0x16b688[_0x4530('0x53')][_0x4530('0x78')]===_0x4530('0x79')){if(!_[_0x4530('0x7a')](_0x16b688['body'][_0x4530('0x7b')])){_0x8130bc['id']={'$in':_0x16b688[_0x4530('0x53')][_0x4530('0x7b')]};}_0x53da38=[[_0x4530('0x7c'),'ASC'],['scheduledAt',_0x2dface[0x0][_0x4530('0x73')]===_0x4530('0x7d')?_0x4530('0x7e'):_0x4530('0x7d')],db[_0x4530('0x75')][_0x4530('0x7f')](_0x4530('0x80')),['id','DESC']];}else{if(!_[_0x4530('0x7a')](_0x16b688[_0x4530('0x53')][_0x4530('0x7b')])){_0x8130bc['id']={'$notIn':_0x16b688[_0x4530('0x53')][_0x4530('0x7b')]};}_0x53da38=[['priority','DESC'],[_0x4530('0x81'),_0x2dface[0x0]['dialOrderByScheduledAt']],db[_0x4530('0x75')][_0x4530('0x7f')](_0x4530('0x82')),['id',_0x4530('0x7d')]];}return db[_0x4530('0x49')]['findOne']({'attributes':['id',_0x4530('0x83'),_0x4530('0x84')],'where':_0x8130bc,'order':_0x53da38,'transaction':_0x3ad21a,'lock':_0x3ad21a[_0x4530('0x85')][_0x4530('0x86')],'include':[{'model':db[_0x4530('0x69')],'as':_0x4530('0x87'),'attributes':_0x16d8cf,'include':[{'model':db[_0x4530('0x88')],'as':'Company','attributes':['id',_0x4530('0x21')]}]},{'model':db[_0x4530('0x89')],'as':_0x4530('0x8a'),'attributes':['id',_0x4530('0x21')]},{'model':db[_0x4530('0x59')],'as':_0x4530('0x8b'),'attributes':['id',_0x4530('0x21'),_0x4530('0x8c')]}]})['then'](function(_0x2592fa){if(_0x2592fa){return _0x2592fa[_0x4530('0x1c')]({'UserId':_0x16b688[_0x4530('0x62')]['id']},{'transaction':_0x3ad21a});}});});}})[_0x4530('0x1d')](handleEntityNotFound(_0x145b73,null))['then'](respondWithResult(_0x145b73,null))[_0x4530('0x51')](handleError(_0x145b73,null));};exports[_0x4530('0x8d')]=function(_0x2ec97c,_0x134522,_0x4dbd56){var _0x522416=[];return db[_0x4530('0x69')][_0x4530('0x56')]()[_0x4530('0x1d')](function(_0xd4d965){_0x522416=_[_0x4530('0x4f')](_0xd4d965);return _0x2ec97c[_0x4530('0x62')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x4530('0x73'),_0x4530('0x74')],'raw':!![]});})['then'](function(_0x22a3ef){if(_0x22a3ef&&_0x22a3ef[_0x4530('0x3f')]){return db[_0x4530('0x75')][_0x4530('0x76')](function(_0x27400d){var _0x2f5c23={'active':![],'recallme':!![],'id':_0x2ec97c['body']['hopperId']};return db['CmHopper'][_0x4530('0x8e')]({'attributes':['id',_0x4530('0x83'),_0x4530('0x84')],'where':_0x2f5c23,'transaction':_0x27400d,'lock':_0x27400d[_0x4530('0x85')]['UPDATE'],'include':[{'model':db[_0x4530('0x69')],'as':_0x4530('0x87'),'attributes':_0x522416,'include':[{'model':db[_0x4530('0x88')],'as':_0x4530('0x8f'),'attributes':['id','name']}]},{'model':db[_0x4530('0x89')],'as':_0x4530('0x8a'),'attributes':['id',_0x4530('0x21')]},{'model':db[_0x4530('0x59')],'as':_0x4530('0x8b'),'attributes':['id',_0x4530('0x21'),'dialActive']}]})[_0x4530('0x1d')](function(_0xe0853a){if(_0xe0853a){return _0xe0853a[_0x4530('0x1c')]({'UserId':_0x2ec97c[_0x4530('0x62')]['id']},{'transaction':_0x27400d});}});});}})[_0x4530('0x1d')](handleEntityNotFound(_0x134522,null))[_0x4530('0x1d')](respondWithResult(_0x134522,null))[_0x4530('0x51')](handleError(_0x134522,null));};exports[_0x4530('0x90')]=function(_0x2d9785,_0x165b6d,_0x2dcb22){return _0x2d9785[_0x4530('0x62')][_0x4530('0x70')]({'where':{'type':_0x4530('0x71'),'dialActive':!![],'dialMethod':_0x4530('0x72')},'attributes':['id'],'raw':!![]})[_0x4530('0x1d')](function(_0x3fc31f){if(_0x3fc31f&&_0x3fc31f[_0x4530('0x3f')]){return db[_0x4530('0x49')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4530('0x64')](_0x4530('0x65'))},'VoiceQueueId':{'$in':_['map'](_0x3fc31f,'id')},'$or':[{'UserId':null},{'UserId':_0x2d9785[_0x4530('0x62')]['id']}]}});}return 0x0;})[_0x4530('0x1d')](function(_0x36b26d){if(!_['isNil'](_0x36b26d)&&_['isNumber'](_0x36b26d)){return _0x165b6d['status'](0xc8)[_0x4530('0x14')]({'contacts':_0x36b26d});}else{logger['error'](_0x4530('0x91'),'getOpenContacts',0x194,_0x4530('0x92'));_0x165b6d['sendStatus'](0x194);}})[_0x4530('0x51')](handleError(_0x165b6d,null));};exports[_0x4530('0x93')]=function(_0x41b218,_0x2da7ce,_0x4a7e13){var _0x51cc67=shared['timezones'];var _0x2002e8=[];_[_0x4530('0x27')](_0x51cc67,function(_0x11375b){_0x2002e8[_0x4530('0x94')]({'id':_0x11375b[_0x4530('0x21')],'name':_0x11375b[_0x4530('0x21')],'utcOffset':_0x11375b[_0x4530('0x95')]});});return _0x2da7ce[_0x4530('0x12')](0xc8)['json']({'tz':_0x2002e8});};exports[_0x4530('0x96')]=function(_0x155b08,_0x16761e,_0x5c97a0){var _0x5c8995=shared[_0x4530('0x97')];var _0x5621ec={};if(!_[_0x4530('0x6d')](_0x5c8995[_0x155b08['body']['id']]))_0x5621ec=_0x5c8995[_0x155b08[_0x4530('0x53')]['id']];return _0x16761e[_0x4530('0x12')](0xc8)['json'](_0x5621ec);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 24e86f5..1746494 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 _0x038b=['util','../../config/logger','api','bluebird','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','phone'];(function(_0x3f7f89,_0x19973f){var _0x17fbf4=function(_0x260c52){while(--_0x260c52){_0x3f7f89['push'](_0x3f7f89['shift']());}};_0x17fbf4(++_0x19973f);}(_0x038b,0x114));var _0xb038=function(_0x45d6a0,_0x11dfdb){_0x45d6a0=_0x45d6a0-0x0;var _0x59ccea=_0x038b[_0x45d6a0];return _0x59ccea;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));module[_0xb038('0x7')]=function(_0x4fe092,_0x54e1e7){return _0x4fe092[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':_0xb038('0xa'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0xb038('0xb'),'fields':[_0xb038('0xb')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['scheduledat','phone','priority','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper'];(function(_0x498903,_0x503c20){var _0x51a96b=function(_0x14bff6){while(--_0x14bff6){_0x498903['push'](_0x498903['shift']());}};_0x51a96b(++_0x503c20);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4b6830,_0x2bf6fb){_0x4b6830=_0x4b6830-0x0;var _0x239e4a=_0x5fc3[_0x4b6830];return _0x239e4a;};'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')]('CmHopper',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]},{'name':_0x35fc('0xd'),'fields':[_0x35fc('0xd')]},{'name':_0x35fc('0xe'),'fields':[_0x35fc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index c2cd8f6..75cb547 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 _0xdde8=['format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','LOCK','GetCmHopperPreview','findOne','phone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','\x20MINUTE','NOW()\x20+\x20INTERVAL\x20','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','http','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopper','options','raw','where','attributes','include','map','model','GetCmHopper','ShowCmHopper','create','body','CreateCmHopper','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','findAll','order','UPDATE','Contact','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','MoveContactManagedDialer','transaction','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','literal','`scheduledat`\x20>=\x20'];(function(_0xdcdc20,_0x3f0aed){var _0x199c35=function(_0x38c02c){while(--_0x38c02c){_0xdcdc20['push'](_0xdcdc20['shift']());}};_0x199c35(++_0x3f0aed);}(_0xdde8,0x11c));var _0x8dde=function(_0x2b5af3,_0xfe1740){_0x2b5af3=_0x2b5af3-0x0;var _0x4f4113=_0xdde8[_0x2b5af3];return _0x4f4113;};'use strict';var _=require(_0x8dde('0x0'));var util=require(_0x8dde('0x1'));var moment=require(_0x8dde('0x2'));var BPromise=require('bluebird');var rs=require(_0x8dde('0x3'));var fs=require('fs');var Redis=require(_0x8dde('0x4'));var db=require(_0x8dde('0x5'))['db'];var utils=require(_0x8dde('0x6'));var logger=require(_0x8dde('0x7'))(_0x8dde('0x8'));var config=require(_0x8dde('0x9'));var jayson=require(_0x8dde('0xa'));const {validateExpressRequest}=require(_0x8dde('0xb'));var client=jayson[_0x8dde('0xc')][_0x8dde('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x35ec3c,_0x5ae6f2,_0x338f1e){return new BPromise(function(_0x3338c9,_0x248e0e){return client['request'](_0x35ec3c,_0x338f1e)[_0x8dde('0xe')](function(_0x3b879c){logger[_0x8dde('0xf')](_0x8dde('0x10'),_0x5ae6f2,_0x8dde('0x11'));logger[_0x8dde('0x12')](_0x8dde('0x13'),_0x5ae6f2,_0x8dde('0x11'),JSON[_0x8dde('0x14')](_0x3b879c));if(_0x3b879c[_0x8dde('0x15')]){if(_0x3b879c[_0x8dde('0x15')][_0x8dde('0x16')]===0x1f4){logger['error'](_0x8dde('0x10'),_0x5ae6f2,_0x3b879c[_0x8dde('0x15')][_0x8dde('0x17')]);return _0x248e0e(_0x3b879c[_0x8dde('0x15')][_0x8dde('0x17')]);}logger['error']('CmHopper,\x20%s,\x20%s',_0x5ae6f2,_0x3b879c[_0x8dde('0x15')][_0x8dde('0x17')]);return _0x3338c9(_0x3b879c[_0x8dde('0x15')][_0x8dde('0x17')]);}else{logger[_0x8dde('0xf')](_0x8dde('0x10'),_0x5ae6f2,'request\x20sent');_0x3338c9(_0x3b879c[_0x8dde('0x18')][_0x8dde('0x17')]);}})[_0x8dde('0x19')](function(_0x20d8b2){logger['error']('CmHopper,\x20%s,\x20%s',_0x5ae6f2,_0x20d8b2);_0x248e0e(_0x20d8b2);});});}exports['GetCmHopper']=function(_0x56b234){var _0x214ed8=this;return new Promise(function(_0x2e1112,_0x5650be){return db[_0x8dde('0x1a')]['findAll']({'raw':_0x56b234['options']?_0x56b234[_0x8dde('0x1b')][_0x8dde('0x1c')]===undefined?!![]:![]:!![],'where':_0x56b234['options']?_0x56b234[_0x8dde('0x1b')][_0x8dde('0x1d')]||null:null,'attributes':_0x56b234[_0x8dde('0x1b')]?_0x56b234[_0x8dde('0x1b')][_0x8dde('0x1e')]||null:null,'limit':_0x56b234[_0x8dde('0x1b')]?_0x56b234['options']['limit']||null:null,'include':_0x56b234[_0x8dde('0x1b')]?_0x56b234[_0x8dde('0x1b')][_0x8dde('0x1f')]?_[_0x8dde('0x20')](_0x56b234['options']['include'],function(_0x1e19c6){return{'model':db[_0x1e19c6[_0x8dde('0x21')]],'as':_0x1e19c6['as'],'attributes':_0x1e19c6[_0x8dde('0x1e')],'include':_0x1e19c6[_0x8dde('0x1f')]?_[_0x8dde('0x20')](_0x1e19c6['include'],function(_0x575755){return{'model':db[_0x575755[_0x8dde('0x21')]],'as':_0x575755['as'],'attributes':_0x575755[_0x8dde('0x1e')],'include':_0x575755[_0x8dde('0x1f')]?_[_0x8dde('0x20')](_0x575755[_0x8dde('0x1f')],function(_0x28e464){return{'model':db[_0x28e464[_0x8dde('0x21')]],'as':_0x28e464['as'],'attributes':_0x28e464['attributes']};}):[]};}):[]};}):[]:[]})[_0x8dde('0xe')](function(_0x599da0){logger[_0x8dde('0xf')](_0x8dde('0x22'),_0x56b234);logger[_0x8dde('0x12')]('GetCmHopper',_0x56b234,JSON[_0x8dde('0x14')](_0x599da0));_0x2e1112(_0x599da0);})[_0x8dde('0x19')](function(_0x5c1caa){logger[_0x8dde('0x15')](_0x8dde('0x22'),_0x5c1caa[_0x8dde('0x17')],_0x56b234);_0x5650be(_0x214ed8['error'](0x1f4,_0x5c1caa[_0x8dde('0x17')]));});});};exports[_0x8dde('0x23')]=function(_0x52b612){var _0x286625=this;return new Promise(function(_0x1e41bc,_0x4b8a88){return db['CmHopper']['find']({'raw':_0x52b612['options']?_0x52b612['options'][_0x8dde('0x1c')]===undefined?!![]:![]:!![],'where':_0x52b612[_0x8dde('0x1b')]?_0x52b612['options'][_0x8dde('0x1d')]||null:null,'attributes':_0x52b612[_0x8dde('0x1b')]?_0x52b612['options'][_0x8dde('0x1e')]||null:null,'include':_0x52b612['options']?_0x52b612['options']['include']?_['map'](_0x52b612['options'][_0x8dde('0x1f')],function(_0xb5f8c5){return{'model':db[_0xb5f8c5[_0x8dde('0x21')]],'as':_0xb5f8c5['as'],'attributes':_0xb5f8c5[_0x8dde('0x1e')],'include':_0xb5f8c5[_0x8dde('0x1f')]?_[_0x8dde('0x20')](_0xb5f8c5['include'],function(_0x3c6133){return{'model':db[_0x3c6133[_0x8dde('0x21')]],'as':_0x3c6133['as'],'attributes':_0x3c6133[_0x8dde('0x1e')],'include':_0x3c6133[_0x8dde('0x1f')]?_[_0x8dde('0x20')](_0x3c6133['include'],function(_0x94e819){return{'model':db[_0x94e819['model']],'as':_0x94e819['as'],'attributes':_0x94e819[_0x8dde('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8dde('0xe')](function(_0x342735){logger[_0x8dde('0xf')](_0x8dde('0x23'),_0x52b612);logger['debug'](_0x8dde('0x23'),_0x52b612,JSON[_0x8dde('0x14')](_0x342735));_0x1e41bc(_0x342735);})[_0x8dde('0x19')](function(_0x1bc715){logger['error'](_0x8dde('0x23'),_0x1bc715[_0x8dde('0x17')],_0x52b612);_0x4b8a88(_0x286625[_0x8dde('0x15')](0x1f4,_0x1bc715[_0x8dde('0x17')]));});});};exports['CreateCmHopper']=function(_0x5326d8){var _0x5a00cf=this;return new Promise(function(_0x195070,_0x41da56){return db[_0x8dde('0x1a')][_0x8dde('0x24')](_0x5326d8[_0x8dde('0x25')],{'raw':_0x5326d8[_0x8dde('0x1b')]?_0x5326d8[_0x8dde('0x1b')][_0x8dde('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4c62f5){logger['info'](_0x8dde('0x26'),_0x5326d8);logger[_0x8dde('0x12')]('CreateCmHopper',_0x5326d8,JSON[_0x8dde('0x14')](_0x4c62f5));_0x195070(_0x4c62f5);})['catch'](function(_0x3b610a){logger[_0x8dde('0x15')](_0x8dde('0x26'),_0x3b610a['message'],_0x5326d8);_0x41da56(_0x5a00cf[_0x8dde('0x15')](0x1f4,_0x3b610a['message']));});});};exports[_0x8dde('0x27')]=function(_0x333d5c){var _0x4ae77f=this;return new Promise(function(_0x2fc411,_0x33c3c0){return db[_0x8dde('0x1a')][_0x8dde('0x28')](_0x333d5c['body'],{'raw':_0x333d5c[_0x8dde('0x1b')]?_0x333d5c[_0x8dde('0x1b')][_0x8dde('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x333d5c['options']?_0x333d5c[_0x8dde('0x1b')][_0x8dde('0x1d')]||null:null,'attributes':_0x333d5c[_0x8dde('0x1b')]?_0x333d5c[_0x8dde('0x1b')][_0x8dde('0x1e')]||null:null,'limit':_0x333d5c[_0x8dde('0x1b')]?_0x333d5c[_0x8dde('0x1b')][_0x8dde('0x29')]||null:null})[_0x8dde('0xe')](function(_0x3313ab){logger[_0x8dde('0xf')](_0x8dde('0x27'),_0x333d5c);logger[_0x8dde('0xf')](_0x8dde('0x2a'),JSON[_0x8dde('0x14')](_0x333d5c['options'][_0x8dde('0x1d')]),_0x333d5c['body'][_0x8dde('0x2b')]);logger[_0x8dde('0x12')](_0x8dde('0x27'),_0x333d5c,JSON[_0x8dde('0x14')](_0x3313ab));_0x2fc411(_0x3313ab);})[_0x8dde('0x19')](function(_0x441cfb){logger['error'](_0x8dde('0x27'),_0x441cfb[_0x8dde('0x17')],_0x333d5c);_0x33c3c0(_0x4ae77f['error'](0x1f4,_0x441cfb[_0x8dde('0x17')]));});});};exports[_0x8dde('0x2c')]=function(_0x894057){var _0x1d8ffb=this;return new Promise(function(_0x54d708,_0x2583d9){return db['CmHopper'][_0x8dde('0x2d')]({'where':_0x894057[_0x8dde('0x1b')]?_0x894057[_0x8dde('0x1b')][_0x8dde('0x1d')]||null:null})[_0x8dde('0xe')](function(_0x41ddf7){logger[_0x8dde('0xf')](_0x8dde('0x2c'),_0x894057);logger[_0x8dde('0x12')](_0x8dde('0x2c'),_0x894057,JSON[_0x8dde('0x14')](_0x41ddf7));_0x54d708(_0x41ddf7);})[_0x8dde('0x19')](function(_0x2a66a1){logger[_0x8dde('0x15')]('DestroyCmHopper',_0x2a66a1[_0x8dde('0x17')],_0x894057);_0x2583d9(_0x1d8ffb[_0x8dde('0x15')](0x1f4,_0x2a66a1[_0x8dde('0x17')]));});});};exports[_0x8dde('0x2e')]=function(_0x2b055e){var _0x17cdf8=this;return new Promise(function(_0x1e5f07,_0x2e9d67){return db[_0x8dde('0x2f')][_0x8dde('0x30')]()['then'](function(_0x48915c){return db[_0x8dde('0x31')]['transaction'](function(_0x30812c){return db[_0x8dde('0x1a')][_0x8dde('0x32')]({'where':_0x2b055e['options']?_0x2b055e['options'][_0x8dde('0x1d')]||null:null,'attributes':_0x2b055e[_0x8dde('0x1b')]?_0x2b055e[_0x8dde('0x1b')][_0x8dde('0x1e')]||null:null,'limit':_0x2b055e[_0x8dde('0x1b')]?_0x2b055e[_0x8dde('0x1b')][_0x8dde('0x29')]||null:null,'order':_0x2b055e[_0x8dde('0x1b')]?_0x2b055e['options'][_0x8dde('0x33')]||null:null,'transaction':_0x30812c,'lock':_0x30812c['LOCK'][_0x8dde('0x34')],'include':[{'model':db['CmContact'],'as':_0x8dde('0x35'),'attributes':_[_0x8dde('0x36')](_0x48915c)},{'model':db[_0x8dde('0x37')],'as':_0x8dde('0x38'),'attributes':['id',_0x8dde('0x39'),_0x8dde('0x3a')]}]})[_0x8dde('0xe')](function(_0x2489de){var _0x3b58bd=[];var _0x520b55=[];for(var _0x10d56f=0x0;_0x10d56f<_0x2489de[_0x8dde('0x3b')];_0x10d56f+=0x1){var _0x369cac=_0x2489de[_0x10d56f][_0x8dde('0x3c')];if(_0x369cac===null){_0x3b58bd[_0x8dde('0x3d')](_0x2489de[_0x10d56f][_0x8dde('0x28')](_0x2b055e[_0x8dde('0x25')],{'transaction':_0x30812c}));}else if(!_0x520b55[_0x8dde('0x3e')](_0x369cac)){_0x520b55[_0x8dde('0x3d')](_0x369cac);_0x3b58bd['push'](_0x2489de[_0x10d56f][_0x8dde('0x28')](_0x2b055e[_0x8dde('0x25')],{'transaction':_0x30812c}));}}return BPromise[_0x8dde('0x3f')](_0x3b58bd);});})[_0x8dde('0xe')](function(_0x357612){logger['info']('GetContactDialer',_0x2b055e);if(_0x357612[_0x8dde('0x3b')]>0x0){logger[_0x8dde('0xf')](_0x8dde('0x40'),_0x357612[0x0][_0x8dde('0x41')]['id'],_0x357612[0x0][_0x8dde('0x41')][_0x8dde('0x42')],_0x357612[0x0][_0x8dde('0x41')][_0x8dde('0x2b')]);}logger['debug'](_0x8dde('0x2e'),_0x2b055e,JSON[_0x8dde('0x14')](_0x357612));_0x1e5f07(_0x357612);})[_0x8dde('0x19')](function(_0x5983a2){logger[_0x8dde('0x15')](_0x8dde('0x2e'),_0x5983a2['message'],_0x2b055e);_0x2e9d67(_0x17cdf8[_0x8dde('0x15')](0x1f4,_0x5983a2[_0x8dde('0x17')]));});});});};exports[_0x8dde('0x43')]=function(_0x7ddb7e){var _0x26f1dc=this;return new Promise(function(_0x12becb,_0xf3b6){return db[_0x8dde('0x31')][_0x8dde('0x44')](function(_0x566bed){return db['CmHopperFinal']['create'](_0x7ddb7e[_0x8dde('0x25')],{'raw':_0x7ddb7e[_0x8dde('0x1b')]?_0x7ddb7e[_0x8dde('0x1b')]['raw']===undefined?!![]:![]:!![],'transaction':_0x566bed})['then'](function(){logger[_0x8dde('0xf')](_0x8dde('0x45'),JSON[_0x8dde('0x14')](_0x7ddb7e['options'][_0x8dde('0x1d')]),_0x7ddb7e[_0x8dde('0x1b')][_0x8dde('0x1d')]['active']);return db[_0x8dde('0x1a')][_0x8dde('0x2d')]({'where':_0x7ddb7e[_0x8dde('0x1b')]?_0x7ddb7e[_0x8dde('0x1b')][_0x8dde('0x1d')]||null:null,'transaction':_0x566bed});});})[_0x8dde('0xe')](function(_0x57a794){logger[_0x8dde('0xf')](_0x8dde('0x43'),_0x7ddb7e);logger[_0x8dde('0x12')](_0x8dde('0x43'),_0x7ddb7e,JSON[_0x8dde('0x14')](_0x57a794));_0x12becb(_0x57a794);})[_0x8dde('0x19')](function(_0x5ea932){logger[_0x8dde('0x15')](_0x8dde('0x43'),_0x5ea932['message'],_0x7ddb7e);_0xf3b6(_0x26f1dc[_0x8dde('0x15')](0x1f4,_0x5ea932['message']));});});};exports['CountReScheduled']=function(_0x1a4e62){var _0x24a929=this;return new Promise(function(_0x1a09bd,_0x29d327){return db[_0x8dde('0x1a')][_0x8dde('0x32')]({'raw':_0x1a4e62[_0x8dde('0x1b')]?_0x1a4e62[_0x8dde('0x1b')][_0x8dde('0x1c')]===undefined?!![]:![]:!![],'where':_0x1a4e62[_0x8dde('0x1b')]?_0x1a4e62[_0x8dde('0x1b')][_0x8dde('0x1d')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x8dde('0x31')]['fn']('IF',db[_0x8dde('0x31')][_0x8dde('0x46')](_0x8dde('0x47')+util[_0x8dde('0x48')](_0x8dde('0x49'),moment()[_0x8dde('0x48')](_0x8dde('0x4a')))+_0x8dde('0x4b')))),'contactsRescheduled']]})['then'](function(_0x273eaf){logger['info']('CountReScheduled',_0x1a4e62);logger[_0x8dde('0x12')](_0x8dde('0x4c'),_0x1a4e62,JSON[_0x8dde('0x14')](_0x273eaf));_0x1a09bd(_0x273eaf);})[_0x8dde('0x19')](function(_0x21abca){logger[_0x8dde('0x15')](_0x8dde('0x4c'),_0x21abca[_0x8dde('0x17')],_0x1a4e62);_0x29d327(_0x24a929[_0x8dde('0x15')](0x1f4,_0x21abca[_0x8dde('0x17')]));});});};exports[_0x8dde('0x4d')]=function(_0x4625d4){var _0x5e4011=this;return new Promise(function(_0x1211f1,_0x507226){return db['CmContact'][_0x8dde('0x30')]()[_0x8dde('0xe')](function(_0x318c83){return db[_0x8dde('0x31')][_0x8dde('0x44')](function(_0x8bd7ab){return db[_0x8dde('0x1a')][_0x8dde('0x32')]({'where':_0x4625d4['options']?_0x4625d4[_0x8dde('0x1b')]['where']||null:null,'attributes':_0x4625d4['options']?_0x4625d4[_0x8dde('0x1b')][_0x8dde('0x1e')]||null:null,'limit':0x1,'order':_0x4625d4[_0x8dde('0x1b')]?_0x4625d4['options'][_0x8dde('0x33')]||null:null,'group':db['CmHopper'][_0x8dde('0x3c')],'transaction':_0x8bd7ab,'lock':_0x8bd7ab[_0x8dde('0x4e')][_0x8dde('0x34')],'include':_0x4625d4[_0x8dde('0x1b')]?_0x4625d4[_0x8dde('0x1b')][_0x8dde('0x1f')]?_[_0x8dde('0x20')](_0x4625d4[_0x8dde('0x1b')][_0x8dde('0x1f')],function(_0x4d54ec){return{'model':db[_0x4d54ec['model']],'as':_0x4d54ec['as'],'attributes':_0x4d54ec[_0x8dde('0x1e')],'include':_0x4d54ec['include']?_[_0x8dde('0x20')](_0x4d54ec[_0x8dde('0x1f')],function(_0x4cf135){return{'model':db[_0x4cf135[_0x8dde('0x21')]],'as':_0x4cf135['as'],'attributes':_0x4cf135[_0x8dde('0x1e')],'include':_0x4cf135[_0x8dde('0x1f')]?_[_0x8dde('0x20')](_0x4cf135[_0x8dde('0x1f')],function(_0x4fcb17){return{'model':db[_0x4fcb17[_0x8dde('0x21')]],'as':_0x4fcb17['as'],'attributes':_0x4fcb17[_0x8dde('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8dde('0xe')](function(_0x238338){var _0x15943e=[];for(var _0x13a268=0x0;_0x13a268<_0x238338[_0x8dde('0x3b')];_0x13a268+=0x1){_0x15943e[_0x8dde('0x3d')](_0x238338[_0x13a268]['update'](_0x4625d4[_0x8dde('0x25')],{'transaction':_0x8bd7ab}));}return BPromise[_0x8dde('0x3f')](_0x15943e);});})[_0x8dde('0xe')](function(_0x235b85){logger[_0x8dde('0xf')]('GetContactRecallMe',_0x4625d4);logger[_0x8dde('0x12')](_0x8dde('0x4d'),_0x4625d4,JSON[_0x8dde('0x14')](_0x235b85));_0x1211f1(_0x235b85);})[_0x8dde('0x19')](function(_0x53d452){logger['error'](_0x8dde('0x4d'),_0x53d452[_0x8dde('0x17')],_0x4625d4);_0x507226(_0x5e4011[_0x8dde('0x15')](0x1f4,_0x53d452[_0x8dde('0x17')]));});});});};exports[_0x8dde('0x4f')]=function(_0x319387){var _0x4c7627=this;return new Promise(function(_0x25941e,_0x5585c6){db[_0x8dde('0x2f')][_0x8dde('0x30')]()[_0x8dde('0xe')](function(_0x16ed38){return db[_0x8dde('0x1a')][_0x8dde('0x32')]({'raw':_0x319387['options']?_0x319387[_0x8dde('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x319387[_0x8dde('0x1b')]?_0x319387[_0x8dde('0x1b')][_0x8dde('0x1d')]||null:null,'attributes':_0x319387[_0x8dde('0x1b')]?_0x319387[_0x8dde('0x1b')][_0x8dde('0x1e')]||null:null,'limit':_0x319387['options']?_0x319387['options'][_0x8dde('0x29')]||null:null,'include':_0x319387[_0x8dde('0x1b')]?_0x319387[_0x8dde('0x1b')][_0x8dde('0x1f')]?_[_0x8dde('0x20')](_0x319387[_0x8dde('0x1b')][_0x8dde('0x1f')],function(_0x59a7a6){return{'model':db[_0x59a7a6['model']],'as':_0x59a7a6['as'],'attributes':_0x59a7a6['as']===_0x8dde('0x35')?_[_0x8dde('0x36')](_0x16ed38):_0x59a7a6[_0x8dde('0x1e')],'include':_0x59a7a6[_0x8dde('0x1f')]?_[_0x8dde('0x20')](_0x59a7a6[_0x8dde('0x1f')],function(_0x5513b3){return{'model':db[_0x5513b3[_0x8dde('0x21')]],'as':_0x5513b3['as'],'attributes':_0x5513b3[_0x8dde('0x1e')],'include':_0x5513b3[_0x8dde('0x1f')]?_[_0x8dde('0x20')](_0x5513b3[_0x8dde('0x1f')],function(_0x12284e){return{'model':db[_0x12284e[_0x8dde('0x21')]],'as':_0x12284e['as'],'attributes':_0x12284e[_0x8dde('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8dde('0xe')](function(_0x4dc5fb){logger[_0x8dde('0xf')]('GetCmHopper',_0x319387);logger[_0x8dde('0x12')](_0x8dde('0x22'),_0x319387,JSON[_0x8dde('0x14')](_0x4dc5fb));_0x25941e(_0x4dc5fb);})[_0x8dde('0x19')](function(_0x4a8494){logger[_0x8dde('0x15')]('GetCmHopper',_0x4a8494[_0x8dde('0x17')],_0x319387);_0x5585c6(_0x4c7627['error'](0x1f4,_0x4a8494[_0x8dde('0x17')]));});});});};exports['GetContactByPhone']=function(_0x9a472d){var _0x571abb=this;return new Promise(function(_0x4c5e10,_0x5d165f){return db[_0x8dde('0x2f')][_0x8dde('0x50')]({'raw':!![],'where':{'phone':_0x9a472d[_0x8dde('0x1b')][_0x8dde('0x1d')][_0x8dde('0x51')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})[_0x8dde('0xe')](function(_0x483fdb){logger[_0x8dde('0xf')](_0x8dde('0x52'),_0x9a472d);logger[_0x8dde('0x12')](_0x8dde('0x52'),_0x9a472d,JSON['stringify'](_0x483fdb));_0x4c5e10(_0x483fdb);})['catch'](function(_0x2a8165){logger[_0x8dde('0x15')](_0x8dde('0x52'),_0x2a8165[_0x8dde('0x17')],_0x9a472d);_0x5d165f(_0x571abb['error'](0x1f4,_0x2a8165['message']));});});};exports['ResetActiveCalls']=function(_0x5dbcc6){var _0x385e89=this;return new Promise(function(_0x46d94a,_0x3842c5){return db[_0x8dde('0x31')]['transaction'](function(_0x12420a){return db['CmHopper'][_0x8dde('0x28')]({'active':![]},{'where':{},'transaction':_0x12420a})[_0x8dde('0xe')](function(_0x5becae){logger[_0x8dde('0xf')]('ResetActiveCalls',_0x5dbcc6);logger['debug'](_0x8dde('0x53'),_0x5dbcc6,JSON[_0x8dde('0x14')](_0x5becae));_0x46d94a(_0x5becae);})[_0x8dde('0x19')](function(_0x255cf5){logger[_0x8dde('0x15')]('ResetActiveCalls',_0x255cf5['message'],_0x5dbcc6);_0x3842c5(_0x385e89[_0x8dde('0x15')](0x1f4,_0x255cf5[_0x8dde('0x17')]));});});});};exports[_0x8dde('0x54')]=function(_0x1ec0be){var _0x23a95a=this;var _0x2841d1=_0x1ec0be[_0x8dde('0x25')][_0x8dde('0x1d')][_0x8dde('0x55')];var _0x71034a=_0x1ec0be['body'][_0x8dde('0x1d')][_0x8dde('0x56')];return new Promise(function(_0x23f660,_0x2797e2){return db[_0x8dde('0x1a')][_0x8dde('0x32')]({'where':{'voiceQueueId':_0x2841d1,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x8dde('0x31')][_0x8dde('0x46')]('NOW()\x20+\x20INTERVAL\x20'+_0x71034a+_0x8dde('0x57'))}},'include':[{'model':db[_0x8dde('0x2f')],'as':'Contact'},{'model':db[_0x8dde('0x37')],'as':_0x8dde('0x38'),'attributes':['id',_0x8dde('0x39'),_0x8dde('0x3a')]},{'model':db['CmList'],'as':'List'}]})[_0x8dde('0xe')](function(_0x5cb414){return db[_0x8dde('0x31')]['transaction'](function(_0x3c7224){return db[_0x8dde('0x1a')][_0x8dde('0x28')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x2841d1,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x8dde('0x31')][_0x8dde('0x46')](_0x8dde('0x58')+_0x71034a+_0x8dde('0x57'))}},'transaction':_0x3c7224})[_0x8dde('0xe')](function(_0x47b4a1){_0x23f660(_0x5cb414);})[_0x8dde('0x19')](function(_0x447731){logger[_0x8dde('0x15')](_0x8dde('0x54'),_0x447731[_0x8dde('0x17')],_0x1ec0be);_0x2797e2(validateExpressRequest);});});})[_0x8dde('0x19')](function(_0xea945f){logger['error'](_0x8dde('0x54'),_0xea945f[_0x8dde('0x17')],_0x1ec0be);_0x2797e2(_0x23a95a[_0x8dde('0x15')](0x1f4,_0xea945f[_0x8dde('0x17')]));});});}; \ No newline at end of file +var _0x3299=['GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','keys','Agent','voicePause','UserId','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','literal','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','Contact','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','User','name','CmList','List','CmHopperHandlePreviewRecallNotifications','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','model','map','catch','ShowCmHopper','find','create','body','CreateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy'];(function(_0x35fb56,_0x5dadff){var _0x2fd52c=function(_0x97bd3f){while(--_0x97bd3f){_0x35fb56['push'](_0x35fb56['shift']());}};_0x2fd52c(++_0x5dadff);}(_0x3299,0x1f0));var _0x9329=function(_0x2ce960,_0x14b428){_0x2ce960=_0x2ce960-0x0;var _0x9a5742=_0x3299[_0x2ce960];return _0x9a5742;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9329('0x0'));var BPromise=require(_0x9329('0x1'));var rs=require(_0x9329('0x2'));var fs=require('fs');var Redis=require(_0x9329('0x3'));var db=require(_0x9329('0x4'))['db'];var utils=require(_0x9329('0x5'));var logger=require(_0x9329('0x6'))(_0x9329('0x7'));var config=require(_0x9329('0x8'));var jayson=require(_0x9329('0x9'));const {validateExpressRequest}=require(_0x9329('0xa'));var client=jayson[_0x9329('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f9ebe,_0x4329ed,_0x5887a5){return new BPromise(function(_0x4e1df9,_0x5d806e){return client[_0x9329('0xc')](_0x2f9ebe,_0x5887a5)[_0x9329('0xd')](function(_0x2df5a9){logger[_0x9329('0xe')](_0x9329('0xf'),_0x4329ed,_0x9329('0x10'));logger[_0x9329('0x11')](_0x9329('0x12'),_0x4329ed,_0x9329('0x10'),JSON[_0x9329('0x13')](_0x2df5a9));if(_0x2df5a9['error']){if(_0x2df5a9[_0x9329('0x14')]['code']===0x1f4){logger[_0x9329('0x14')](_0x9329('0xf'),_0x4329ed,_0x2df5a9['error']['message']);return _0x5d806e(_0x2df5a9['error'][_0x9329('0x15')]);}logger[_0x9329('0x14')](_0x9329('0xf'),_0x4329ed,_0x2df5a9['error'][_0x9329('0x15')]);return _0x4e1df9(_0x2df5a9[_0x9329('0x14')]['message']);}else{logger[_0x9329('0xe')]('CmHopper,\x20%s,\x20%s',_0x4329ed,_0x9329('0x10'));_0x4e1df9(_0x2df5a9['result'][_0x9329('0x15')]);}})['catch'](function(_0x599813){logger[_0x9329('0x14')](_0x9329('0xf'),_0x4329ed,_0x599813);_0x5d806e(_0x599813);});});}exports[_0x9329('0x16')]=function(_0xc9c73f){var _0x201cfc=this;return new Promise(function(_0x55d833,_0x413814){return db[_0x9329('0x17')][_0x9329('0x18')]({'raw':_0xc9c73f[_0x9329('0x19')]?_0xc9c73f[_0x9329('0x19')][_0x9329('0x1a')]===undefined?!![]:![]:!![],'where':_0xc9c73f['options']?_0xc9c73f[_0x9329('0x19')][_0x9329('0x1b')]||null:null,'attributes':_0xc9c73f[_0x9329('0x19')]?_0xc9c73f[_0x9329('0x19')][_0x9329('0x1c')]||null:null,'limit':_0xc9c73f[_0x9329('0x19')]?_0xc9c73f[_0x9329('0x19')]['limit']||null:null,'include':_0xc9c73f[_0x9329('0x19')]?_0xc9c73f['options'][_0x9329('0x1d')]?_['map'](_0xc9c73f[_0x9329('0x19')][_0x9329('0x1d')],function(_0x3088fe){return{'model':db[_0x3088fe[_0x9329('0x1e')]],'as':_0x3088fe['as'],'attributes':_0x3088fe[_0x9329('0x1c')],'include':_0x3088fe[_0x9329('0x1d')]?_[_0x9329('0x1f')](_0x3088fe[_0x9329('0x1d')],function(_0x50cfdd){return{'model':db[_0x50cfdd[_0x9329('0x1e')]],'as':_0x50cfdd['as'],'attributes':_0x50cfdd[_0x9329('0x1c')],'include':_0x50cfdd[_0x9329('0x1d')]?_[_0x9329('0x1f')](_0x50cfdd[_0x9329('0x1d')],function(_0x277f24){return{'model':db[_0x277f24[_0x9329('0x1e')]],'as':_0x277f24['as'],'attributes':_0x277f24['attributes']};}):[]};}):[]};}):[]:[]})[_0x9329('0xd')](function(_0x2cd1af){logger[_0x9329('0xe')](_0x9329('0x16'),_0xc9c73f);logger[_0x9329('0x11')](_0x9329('0x16'),_0xc9c73f,JSON[_0x9329('0x13')](_0x2cd1af));_0x55d833(_0x2cd1af);})[_0x9329('0x20')](function(_0x528626){logger[_0x9329('0x14')](_0x9329('0x16'),_0x528626[_0x9329('0x15')],_0xc9c73f);_0x413814(_0x201cfc[_0x9329('0x14')](0x1f4,_0x528626['message']));});});};exports[_0x9329('0x21')]=function(_0x4582e1){var _0x260e87=this;return new Promise(function(_0x40c04a,_0xf01197){return db['CmHopper'][_0x9329('0x22')]({'raw':_0x4582e1[_0x9329('0x19')]?_0x4582e1[_0x9329('0x19')][_0x9329('0x1a')]===undefined?!![]:![]:!![],'where':_0x4582e1[_0x9329('0x19')]?_0x4582e1[_0x9329('0x19')][_0x9329('0x1b')]||null:null,'attributes':_0x4582e1[_0x9329('0x19')]?_0x4582e1[_0x9329('0x19')]['attributes']||null:null,'include':_0x4582e1[_0x9329('0x19')]?_0x4582e1[_0x9329('0x19')]['include']?_[_0x9329('0x1f')](_0x4582e1[_0x9329('0x19')][_0x9329('0x1d')],function(_0x32a5d9){return{'model':db[_0x32a5d9[_0x9329('0x1e')]],'as':_0x32a5d9['as'],'attributes':_0x32a5d9[_0x9329('0x1c')],'include':_0x32a5d9['include']?_[_0x9329('0x1f')](_0x32a5d9[_0x9329('0x1d')],function(_0xa32c30){return{'model':db[_0xa32c30['model']],'as':_0xa32c30['as'],'attributes':_0xa32c30['attributes'],'include':_0xa32c30[_0x9329('0x1d')]?_[_0x9329('0x1f')](_0xa32c30[_0x9329('0x1d')],function(_0x4569e6){return{'model':db[_0x4569e6[_0x9329('0x1e')]],'as':_0x4569e6['as'],'attributes':_0x4569e6[_0x9329('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6ae08f){logger[_0x9329('0xe')](_0x9329('0x21'),_0x4582e1);logger[_0x9329('0x11')](_0x9329('0x21'),_0x4582e1,JSON['stringify'](_0x6ae08f));_0x40c04a(_0x6ae08f);})[_0x9329('0x20')](function(_0x4cc052){logger[_0x9329('0x14')](_0x9329('0x21'),_0x4cc052[_0x9329('0x15')],_0x4582e1);_0xf01197(_0x260e87['error'](0x1f4,_0x4cc052[_0x9329('0x15')]));});});};exports['CreateCmHopper']=function(_0x5b1980){var _0x4190c4=this;return new Promise(function(_0x1e2e89,_0x3c4225){return db[_0x9329('0x17')][_0x9329('0x23')](_0x5b1980[_0x9329('0x24')],{'raw':_0x5b1980[_0x9329('0x19')]?_0x5b1980['options'][_0x9329('0x1a')]===undefined?!![]:![]:!![]})[_0x9329('0xd')](function(_0x1c00b1){logger['info'](_0x9329('0x25'),_0x5b1980);logger[_0x9329('0x11')](_0x9329('0x25'),_0x5b1980,JSON[_0x9329('0x13')](_0x1c00b1));_0x1e2e89(_0x1c00b1);})['catch'](function(_0x222315){logger[_0x9329('0x14')](_0x9329('0x25'),_0x222315[_0x9329('0x15')],_0x5b1980);_0x3c4225(_0x4190c4[_0x9329('0x14')](0x1f4,_0x222315[_0x9329('0x15')]));});});};exports['UpdateCmHopper']=function(_0x20d0bf){var _0x4b98bb=this;return new Promise(function(_0x1b8dbd,_0xdfb871){return db['CmHopper'][_0x9329('0x26')](_0x20d0bf[_0x9329('0x24')],{'raw':_0x20d0bf[_0x9329('0x19')]?_0x20d0bf['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20d0bf[_0x9329('0x19')]?_0x20d0bf[_0x9329('0x19')][_0x9329('0x1b')]||null:null,'attributes':_0x20d0bf[_0x9329('0x19')]?_0x20d0bf[_0x9329('0x19')][_0x9329('0x1c')]||null:null,'limit':_0x20d0bf[_0x9329('0x19')]?_0x20d0bf[_0x9329('0x19')][_0x9329('0x27')]||null:null})['then'](function(_0x1e5d06){logger[_0x9329('0xe')]('UpdateCmHopper',_0x20d0bf);logger['info'](_0x9329('0x28'),JSON[_0x9329('0x13')](_0x20d0bf[_0x9329('0x19')][_0x9329('0x1b')]),_0x20d0bf[_0x9329('0x24')][_0x9329('0x29')]);logger[_0x9329('0x11')]('UpdateCmHopper',_0x20d0bf,JSON[_0x9329('0x13')](_0x1e5d06));_0x1b8dbd(_0x1e5d06);})[_0x9329('0x20')](function(_0x20357f){logger[_0x9329('0x14')]('UpdateCmHopper',_0x20357f['message'],_0x20d0bf);_0xdfb871(_0x4b98bb[_0x9329('0x14')](0x1f4,_0x20357f['message']));});});};exports[_0x9329('0x2a')]=function(_0xb7e8f5){var _0xd70740=this;return new Promise(function(_0x118a69,_0x2ab988){return db[_0x9329('0x17')][_0x9329('0x2b')]({'where':_0xb7e8f5[_0x9329('0x19')]?_0xb7e8f5[_0x9329('0x19')][_0x9329('0x1b')]||null:null})['then'](function(_0x197814){logger[_0x9329('0xe')](_0x9329('0x2a'),_0xb7e8f5);logger['debug'](_0x9329('0x2a'),_0xb7e8f5,JSON['stringify'](_0x197814));_0x118a69(_0x197814);})['catch'](function(_0x1624ce){logger[_0x9329('0x14')](_0x9329('0x2a'),_0x1624ce['message'],_0xb7e8f5);_0x2ab988(_0xd70740['error'](0x1f4,_0x1624ce[_0x9329('0x15')]));});});};exports[_0x9329('0x2c')]=function(_0x2b12a8){var _0x4f5ae7=this;return new Promise(function(_0x20df98,_0x3ef4bc){return db[_0x9329('0x2d')][_0x9329('0x2e')]()[_0x9329('0xd')](function(_0x1606e6){return db[_0x9329('0x2f')][_0x9329('0x30')](function(_0x2116d7){return db[_0x9329('0x17')][_0x9329('0x18')]({'where':_0x2b12a8['options']?_0x2b12a8[_0x9329('0x19')][_0x9329('0x1b')]||null:null,'attributes':_0x2b12a8[_0x9329('0x19')]?_0x2b12a8[_0x9329('0x19')][_0x9329('0x1c')]||null:null,'limit':_0x2b12a8[_0x9329('0x19')]?_0x2b12a8[_0x9329('0x19')][_0x9329('0x27')]||null:null,'order':_0x2b12a8[_0x9329('0x19')]?_0x2b12a8[_0x9329('0x19')][_0x9329('0x31')]||null:null,'transaction':_0x2116d7,'lock':_0x2116d7[_0x9329('0x32')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x9329('0x33')](_0x1606e6)},{'model':db['User'],'as':_0x9329('0x34'),'attributes':['id','name',_0x9329('0x35')]}]})[_0x9329('0xd')](function(_0x101ccb){var _0x5cab48=[];var _0x569146=[];for(var _0x4e45b2=0x0;_0x4e45b2<_0x101ccb['length'];_0x4e45b2+=0x1){var _0x361e25=_0x101ccb[_0x4e45b2][_0x9329('0x36')];if(_0x361e25===null){_0x5cab48[_0x9329('0x37')](_0x101ccb[_0x4e45b2][_0x9329('0x26')](_0x2b12a8[_0x9329('0x24')],{'transaction':_0x2116d7}));}else if(!_0x569146[_0x9329('0x38')](_0x361e25)){_0x569146[_0x9329('0x37')](_0x361e25);_0x5cab48[_0x9329('0x37')](_0x101ccb[_0x4e45b2][_0x9329('0x26')](_0x2b12a8['body'],{'transaction':_0x2116d7}));}}return BPromise[_0x9329('0x39')](_0x5cab48);});})[_0x9329('0xd')](function(_0x5989bc){logger['info'](_0x9329('0x2c'),_0x2b12a8);if(_0x5989bc[_0x9329('0x3a')]>0x0){logger[_0x9329('0xe')](_0x9329('0x3b'),_0x5989bc[0x0][_0x9329('0x3c')]['id'],_0x5989bc[0x0][_0x9329('0x3c')][_0x9329('0x3d')],_0x5989bc[0x0][_0x9329('0x3c')][_0x9329('0x29')]);}logger[_0x9329('0x11')](_0x9329('0x2c'),_0x2b12a8,JSON['stringify'](_0x5989bc));_0x20df98(_0x5989bc);})['catch'](function(_0x4aeef1){logger['error']('GetContactDialer',_0x4aeef1['message'],_0x2b12a8);_0x3ef4bc(_0x4f5ae7[_0x9329('0x14')](0x1f4,_0x4aeef1['message']));});});});};exports[_0x9329('0x3e')]=function(_0x20a0dd){var _0x166397=this;return new Promise(function(_0x2532fa,_0x57e296){return db[_0x9329('0x2f')][_0x9329('0x30')](function(_0x2ee519){return db[_0x9329('0x3f')][_0x9329('0x23')](_0x20a0dd[_0x9329('0x24')],{'raw':_0x20a0dd[_0x9329('0x19')]?_0x20a0dd[_0x9329('0x19')][_0x9329('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x2ee519})[_0x9329('0xd')](function(){logger['info'](_0x9329('0x40'),JSON[_0x9329('0x13')](_0x20a0dd[_0x9329('0x19')][_0x9329('0x1b')]),_0x20a0dd[_0x9329('0x19')][_0x9329('0x1b')][_0x9329('0x29')]);return db['CmHopper'][_0x9329('0x2b')]({'where':_0x20a0dd[_0x9329('0x19')]?_0x20a0dd[_0x9329('0x19')][_0x9329('0x1b')]||null:null,'transaction':_0x2ee519});});})[_0x9329('0xd')](function(_0x43ec17){logger['info'](_0x9329('0x3e'),_0x20a0dd);logger[_0x9329('0x11')](_0x9329('0x3e'),_0x20a0dd,JSON[_0x9329('0x13')](_0x43ec17));_0x2532fa(_0x43ec17);})[_0x9329('0x20')](function(_0x5779f0){logger[_0x9329('0x14')](_0x9329('0x3e'),_0x5779f0[_0x9329('0x15')],_0x20a0dd);_0x57e296(_0x166397['error'](0x1f4,_0x5779f0['message']));});});};exports['CountReScheduled']=function(_0x209e53){var _0x96fea4=this;return new Promise(function(_0x294a8f,_0xf8f428){return db['CmHopper'][_0x9329('0x18')]({'raw':_0x209e53['options']?_0x209e53[_0x9329('0x19')][_0x9329('0x1a')]===undefined?!![]:![]:!![],'where':_0x209e53[_0x9329('0x19')]?_0x209e53['options']['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x9329('0x2f')]['fn']('IF',db[_0x9329('0x2f')][_0x9329('0x41')]('`scheduledat`\x20>=\x20'+util[_0x9329('0x42')]('\x22%s\x22',moment()['format'](_0x9329('0x43')))+_0x9329('0x44')))),_0x9329('0x45')]]})['then'](function(_0x48a729){logger['info'](_0x9329('0x46'),_0x209e53);logger[_0x9329('0x11')](_0x9329('0x46'),_0x209e53,JSON['stringify'](_0x48a729));_0x294a8f(_0x48a729);})[_0x9329('0x20')](function(_0x1b178c){logger[_0x9329('0x14')](_0x9329('0x46'),_0x1b178c[_0x9329('0x15')],_0x209e53);_0xf8f428(_0x96fea4[_0x9329('0x14')](0x1f4,_0x1b178c[_0x9329('0x15')]));});});};exports[_0x9329('0x47')]=function(_0x3a4bd4){var _0x49b0fb=this;return new Promise(function(_0x28acc1,_0x1aad23){return db[_0x9329('0x2d')][_0x9329('0x2e')]()[_0x9329('0xd')](function(_0x11f033){return db[_0x9329('0x2f')][_0x9329('0x30')](function(_0x3e5b85){return db[_0x9329('0x17')][_0x9329('0x18')]({'where':_0x3a4bd4[_0x9329('0x19')]?_0x3a4bd4[_0x9329('0x19')][_0x9329('0x1b')]||null:null,'attributes':_0x3a4bd4[_0x9329('0x19')]?_0x3a4bd4[_0x9329('0x19')][_0x9329('0x1c')]||null:null,'limit':0x1,'order':_0x3a4bd4[_0x9329('0x19')]?_0x3a4bd4[_0x9329('0x19')][_0x9329('0x31')]||null:null,'group':db[_0x9329('0x17')][_0x9329('0x36')],'transaction':_0x3e5b85,'lock':_0x3e5b85[_0x9329('0x32')][_0x9329('0x48')],'include':_0x3a4bd4['options']?_0x3a4bd4[_0x9329('0x19')][_0x9329('0x1d')]?_[_0x9329('0x1f')](_0x3a4bd4[_0x9329('0x19')]['include'],function(_0x2b2f0b){return{'model':db[_0x2b2f0b[_0x9329('0x1e')]],'as':_0x2b2f0b['as'],'attributes':_0x2b2f0b[_0x9329('0x1c')],'include':_0x2b2f0b[_0x9329('0x1d')]?_[_0x9329('0x1f')](_0x2b2f0b[_0x9329('0x1d')],function(_0x4035bb){return{'model':db[_0x4035bb[_0x9329('0x1e')]],'as':_0x4035bb['as'],'attributes':_0x4035bb['attributes'],'include':_0x4035bb['include']?_[_0x9329('0x1f')](_0x4035bb['include'],function(_0x59a5e5){return{'model':db[_0x59a5e5[_0x9329('0x1e')]],'as':_0x59a5e5['as'],'attributes':_0x59a5e5[_0x9329('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e9adf){var _0x4f42d9=[];for(var _0xf11731=0x0;_0xf11731<_0x1e9adf['length'];_0xf11731+=0x1){_0x4f42d9[_0x9329('0x37')](_0x1e9adf[_0xf11731][_0x9329('0x26')](_0x3a4bd4[_0x9329('0x24')],{'transaction':_0x3e5b85}));}return BPromise['all'](_0x4f42d9);});})[_0x9329('0xd')](function(_0x3d659a){logger[_0x9329('0xe')](_0x9329('0x47'),_0x3a4bd4);logger[_0x9329('0x11')](_0x9329('0x47'),_0x3a4bd4,JSON[_0x9329('0x13')](_0x3d659a));_0x28acc1(_0x3d659a);})[_0x9329('0x20')](function(_0x2a3304){logger[_0x9329('0x14')]('GetContactRecallMe',_0x2a3304[_0x9329('0x15')],_0x3a4bd4);_0x1aad23(_0x49b0fb['error'](0x1f4,_0x2a3304['message']));});});});};exports[_0x9329('0x49')]=function(_0x3e01fb){var _0x124cf8=this;return new Promise(function(_0x42704c,_0x1a05e3){db['CmContact'][_0x9329('0x2e')]()[_0x9329('0xd')](function(_0x2f125f){return db[_0x9329('0x17')][_0x9329('0x18')]({'raw':_0x3e01fb[_0x9329('0x19')]?_0x3e01fb[_0x9329('0x19')][_0x9329('0x1a')]===undefined?!![]:![]:!![],'where':_0x3e01fb[_0x9329('0x19')]?_0x3e01fb[_0x9329('0x19')]['where']||null:null,'attributes':_0x3e01fb[_0x9329('0x19')]?_0x3e01fb[_0x9329('0x19')][_0x9329('0x1c')]||null:null,'limit':_0x3e01fb[_0x9329('0x19')]?_0x3e01fb['options']['limit']||null:null,'include':_0x3e01fb[_0x9329('0x19')]?_0x3e01fb[_0x9329('0x19')][_0x9329('0x1d')]?_[_0x9329('0x1f')](_0x3e01fb[_0x9329('0x19')][_0x9329('0x1d')],function(_0x34cd64){return{'model':db[_0x34cd64[_0x9329('0x1e')]],'as':_0x34cd64['as'],'attributes':_0x34cd64['as']===_0x9329('0x4a')?_[_0x9329('0x33')](_0x2f125f):_0x34cd64['attributes'],'include':_0x34cd64[_0x9329('0x1d')]?_['map'](_0x34cd64[_0x9329('0x1d')],function(_0x5085ce){return{'model':db[_0x5085ce[_0x9329('0x1e')]],'as':_0x5085ce['as'],'attributes':_0x5085ce['attributes'],'include':_0x5085ce[_0x9329('0x1d')]?_['map'](_0x5085ce['include'],function(_0x20630c){return{'model':db[_0x20630c['model']],'as':_0x20630c['as'],'attributes':_0x20630c[_0x9329('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9329('0xd')](function(_0x32afce){logger['info']('GetCmHopper',_0x3e01fb);logger['debug'](_0x9329('0x16'),_0x3e01fb,JSON['stringify'](_0x32afce));_0x42704c(_0x32afce);})[_0x9329('0x20')](function(_0x511eab){logger['error'](_0x9329('0x16'),_0x511eab['message'],_0x3e01fb);_0x1a05e3(_0x124cf8[_0x9329('0x14')](0x1f4,_0x511eab['message']));});});});};exports[_0x9329('0x4b')]=function(_0x21b290){var _0x26d8de=this;return new Promise(function(_0x2ddf9c,_0x6bb610){return db[_0x9329('0x2d')][_0x9329('0x4c')]({'raw':!![],'where':{'phone':_0x21b290[_0x9329('0x19')][_0x9329('0x1b')]['phone']},'attributes':['id',_0x9329('0x4d')],'order':[['id',_0x9329('0x4e')]]})['then'](function(_0x34d658){logger['info'](_0x9329('0x4f'),_0x21b290);logger['debug'](_0x9329('0x4f'),_0x21b290,JSON[_0x9329('0x13')](_0x34d658));_0x2ddf9c(_0x34d658);})[_0x9329('0x20')](function(_0x70a33a){logger[_0x9329('0x14')](_0x9329('0x4f'),_0x70a33a[_0x9329('0x15')],_0x21b290);_0x6bb610(_0x26d8de[_0x9329('0x14')](0x1f4,_0x70a33a['message']));});});};exports[_0x9329('0x50')]=function(_0x4ca2fc){var _0x1a4a90=this;return new Promise(function(_0x175e35,_0x56bc51){return db[_0x9329('0x2f')][_0x9329('0x30')](function(_0x426e7c){return db['CmHopper'][_0x9329('0x26')]({'active':![]},{'where':{},'transaction':_0x426e7c})[_0x9329('0xd')](function(_0x4bf935){logger[_0x9329('0xe')](_0x9329('0x50'),_0x4ca2fc);logger[_0x9329('0x11')]('ResetActiveCalls',_0x4ca2fc,JSON[_0x9329('0x13')](_0x4bf935));_0x175e35(_0x4bf935);})[_0x9329('0x20')](function(_0x5dbc08){logger[_0x9329('0x14')](_0x9329('0x50'),_0x5dbc08[_0x9329('0x15')],_0x4ca2fc);_0x56bc51(_0x1a4a90[_0x9329('0x14')](0x1f4,_0x5dbc08['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x1c90b6){var _0x5157ca=this;var _0x549474=_0x1c90b6[_0x9329('0x24')]['where'][_0x9329('0x51')];var _0x166c4c=_0x1c90b6[_0x9329('0x24')][_0x9329('0x1b')][_0x9329('0x52')];return new Promise(function(_0x3005fb,_0xb83415){return db[_0x9329('0x17')][_0x9329('0x18')]({'where':{'voiceQueueId':_0x549474,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x9329('0x2f')]['literal'](_0x9329('0x53')+_0x166c4c+_0x9329('0x54'))}},'include':[{'model':db[_0x9329('0x2d')],'as':_0x9329('0x4a')},{'model':db[_0x9329('0x55')],'as':_0x9329('0x34'),'attributes':['id',_0x9329('0x56'),_0x9329('0x35')]},{'model':db[_0x9329('0x57')],'as':_0x9329('0x58')}]})[_0x9329('0xd')](function(_0xdae3cb){return db['sequelize'][_0x9329('0x30')](function(_0x4c9872){return db[_0x9329('0x17')][_0x9329('0x26')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x549474,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x9329('0x2f')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x166c4c+_0x9329('0x54'))}},'transaction':_0x4c9872})[_0x9329('0xd')](function(_0x3b9688){_0x3005fb(_0xdae3cb);})[_0x9329('0x20')](function(_0x1d85ea){logger[_0x9329('0x14')]('CmHopperHandlePreviewRecallNotifications',_0x1d85ea[_0x9329('0x15')],_0x1c90b6);_0xb83415(validateExpressRequest);});});})['catch'](function(_0x12a88a){logger[_0x9329('0x14')](_0x9329('0x59'),_0x12a88a[_0x9329('0x15')],_0x1c90b6);_0xb83415(_0x5157ca[_0x9329('0x14')](0x1f4,_0x12a88a[_0x9329('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 59b6ba6..a2f0bd0 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 _0x0082=['/timezones','/:id','post','getPreview','/timezone','getTimezone','/previewrecall','put','delete','destroy','multer','path','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','describe','getOpenContacts'];(function(_0x465f7b,_0x2b0150){var _0x4cce5d=function(_0x4fa334){while(--_0x4fa334){_0x465f7b['push'](_0x465f7b['shift']());}};_0x4cce5d(++_0x2b0150);}(_0x0082,0x73));var _0x2008=function(_0x3a46a1,_0x4b6835){_0x3a46a1=_0x3a46a1-0x0;var _0x47772c=_0x0082[_0x3a46a1];return _0x47772c;};'use strict';var multer=require(_0x2008('0x0'));var util=require('util');var path=require(_0x2008('0x1'));var timeout=require('connect-timeout');var express=require(_0x2008('0x2'));var router=express[_0x2008('0x3')]();var fs_extra=require(_0x2008('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2008('0x5'));var config=require('../../config/environment');var controller=require('./cmHopper.controller');router['get']('/',auth[_0x2008('0x6')](),controller[_0x2008('0x7')]);router[_0x2008('0x8')]('/describe',auth[_0x2008('0x6')](),controller[_0x2008('0x9')]);router[_0x2008('0x8')]('/opencontacts',auth['isAuthenticated'](),controller[_0x2008('0xa')]);router[_0x2008('0x8')](_0x2008('0xb'),auth['isAuthenticated'](),controller['getTimezones']);router[_0x2008('0x8')](_0x2008('0xc'),auth[_0x2008('0x6')](),controller['show']);router['post']('/',auth[_0x2008('0x6')](),controller['create']);router[_0x2008('0xd')]('/preview',auth[_0x2008('0x6')](),controller[_0x2008('0xe')]);router[_0x2008('0xd')](_0x2008('0xf'),auth['isAuthenticated'](),controller[_0x2008('0x10')]);router[_0x2008('0xd')](_0x2008('0x11'),auth['isAuthenticated'](),controller['getPreviewRecall']);router[_0x2008('0x12')]('/:id',auth[_0x2008('0x6')](),controller['update']);router[_0x2008('0x13')]('/:id',auth[_0x2008('0x6')](),controller[_0x2008('0x14')]);module['exports']=router; \ No newline at end of file +var _0xbf9a=['getPreview','/timezone','getTimezone','/previewrecall','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index','/describe','getOpenContacts','/timezones','isAuthenticated','getTimezones','show','create','post'];(function(_0x1a5687,_0xc2188f){var _0x257d5c=function(_0x4a1783){while(--_0x4a1783){_0x1a5687['push'](_0x1a5687['shift']());}};_0x257d5c(++_0xc2188f);}(_0xbf9a,0x7e));var _0xabf9=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0xbf9a[_0x382a62];return _0x490a25;};'use strict';var multer=require(_0xabf9('0x0'));var util=require('util');var path=require(_0xabf9('0x1'));var timeout=require(_0xabf9('0x2'));var express=require(_0xabf9('0x3'));var router=express['Router']();var fs_extra=require(_0xabf9('0x4'));var auth=require(_0xabf9('0x5'));var interaction=require(_0xabf9('0x6'));var config=require(_0xabf9('0x7'));var controller=require(_0xabf9('0x8'));router[_0xabf9('0x9')]('/',auth['isAuthenticated'](),controller[_0xabf9('0xa')]);router[_0xabf9('0x9')](_0xabf9('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/opencontacts',auth['isAuthenticated'](),controller[_0xabf9('0xc')]);router['get'](_0xabf9('0xd'),auth[_0xabf9('0xe')](),controller[_0xabf9('0xf')]);router[_0xabf9('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xabf9('0x10')]);router['post']('/',auth[_0xabf9('0xe')](),controller[_0xabf9('0x11')]);router[_0xabf9('0x12')]('/preview',auth['isAuthenticated'](),controller[_0xabf9('0x13')]);router[_0xabf9('0x12')](_0xabf9('0x14'),auth[_0xabf9('0xe')](),controller[_0xabf9('0x15')]);router[_0xabf9('0x12')](_0xabf9('0x16'),auth[_0xabf9('0xe')](),controller['getPreviewRecall']);router[_0xabf9('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xabf9('0x18')]);router[_0xabf9('0x19')](_0xabf9('0x1a'),auth[_0xabf9('0xe')](),controller[_0xabf9('0x1b')]);module[_0xabf9('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index a505f0e..0b2664c 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 _0x59f2=['contactListQueue','INTEGER','STRING'];(function(_0x12a315,_0x5bfa29){var _0x3e57db=function(_0x3da526){while(--_0x3da526){_0x12a315['push'](_0x12a315['shift']());}};_0x3e57db(++_0x5bfa29);}(_0x59f2,0xb3));var _0x259f=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x59f2[_0x297fd3];return _0x2af381;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x259f('0x0')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x259f('0x1')},'ListId':{'type':Sequelize[_0x259f('0x2')],'unique':_0x259f('0x1')},'VoiceQueueId':{'type':Sequelize[_0x259f('0x2')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x83c8=['contactListQueue','INTEGER','moment','STRING'];(function(_0x10239e,_0x31ba32){var _0x40db42=function(_0x442ac6){while(--_0x442ac6){_0x10239e['push'](_0x10239e['shift']());}};_0x40db42(++_0x31ba32);}(_0x83c8,0x8a));var _0x883c=function(_0x24beac,_0x5aa9c9){_0x24beac=_0x24beac-0x0;var _0x4980dd=_0x83c8[_0x24beac];return _0x4980dd;};'use strict';var moment=require(_0x883c('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x883c('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x883c('0x2')},'ListId':{'type':Sequelize[_0x883c('0x3')],'unique':_0x883c('0x2')},'VoiceQueueId':{'type':Sequelize[_0x883c('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index b93e474..66a61d2 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 _0x821d=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','then','destroy','error','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','rows','params','include','find','update','body','catch','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x313849,_0x5d267a){var _0x802bf0=function(_0x32ca22){while(--_0x32ca22){_0x313849['push'](_0x313849['shift']());}};_0x802bf0(++_0x5d267a);}(_0x821d,0x80));var _0xd821=function(_0x4e5c78,_0x18172a){_0x4e5c78=_0x4e5c78-0x0;var _0x518afb=_0x821d[_0x4e5c78];return _0x518afb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd821('0x0'));var zipdir=require(_0xd821('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd821('0x2'));var moment=require(_0xd821('0x3'));var BPromise=require(_0xd821('0x4'));var Mustache=require(_0xd821('0x5'));var util=require(_0xd821('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd821('0x7'));var ejs=require(_0xd821('0x8'));var fs=require('fs');var fs_extra=require(_0xd821('0x9'));var _=require(_0xd821('0xa'));var squel=require(_0xd821('0xb'));var crypto=require('crypto');var jsforce=require(_0xd821('0xc'));var deskjs=require(_0xd821('0xd'));var toCsv=require(_0xd821('0x7'));var querystring=require('querystring');var Papa=require(_0xd821('0xe'));var Redis=require('ioredis');var authService=require(_0xd821('0xf'));var qs=require(_0xd821('0x10'));var as=require(_0xd821('0x11'));var hardwareService=require(_0xd821('0x12'));var logger=require(_0xd821('0x13'))(_0xd821('0x14'));var utils=require(_0xd821('0x15'));var config=require(_0xd821('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd821('0x17'))['db'];function respondWithStatusCode(_0x469826,_0x1300f1){_0x1300f1=_0x1300f1||0xcc;return function(_0x130bc8){if(_0x130bc8){return _0x469826[_0xd821('0x18')](_0x1300f1);}return _0x469826['status'](_0x1300f1)[_0xd821('0x19')]();};}function respondWithResult(_0x15f380,_0x9ac953){_0x9ac953=_0x9ac953||0xc8;return function(_0x289e62){if(_0x289e62){return _0x15f380[_0xd821('0x1a')](_0x9ac953)[_0xd821('0x1b')](_0x289e62);}};}function respondWithFilteredResult(_0x47d7f2,_0x75080f){return function(_0x41c391){if(_0x41c391){var _0x18b80f=typeof _0x75080f[_0xd821('0x1c')]===_0xd821('0x1d')&&typeof _0x75080f[_0xd821('0x1e')]===_0xd821('0x1d');var _0x2fd007=_0x41c391['count'];var _0x51eb66=_0x18b80f?0x0:_0x75080f[_0xd821('0x1c')];var _0x47dae2=_0x18b80f?_0x41c391['count']:_0x75080f[_0xd821('0x1c')]+_0x75080f[_0xd821('0x1e')];var _0x26acfb;if(_0x47dae2>=_0x2fd007){_0x47dae2=_0x2fd007;_0x26acfb=0xc8;}else{_0x26acfb=0xce;}_0x47d7f2[_0xd821('0x1a')](_0x26acfb);return _0x47d7f2['set'](_0xd821('0x1f'),_0x51eb66+'-'+_0x47dae2+'/'+_0x2fd007)['json'](_0x41c391);}return null;};}function patchUpdates(_0x912b21){return function(_0xf3c3a8){try{jsonpatch[_0xd821('0x20')](_0xf3c3a8,_0x912b21,!![]);}catch(_0x3cdea6){return BPromise[_0xd821('0x21')](_0x3cdea6);}return _0xf3c3a8[_0xd821('0x22')]();};}function saveUpdates(_0x3589a1,_0x52184d){return function(_0x2e84a0){if(_0x2e84a0){return _0x2e84a0['update'](_0x3589a1)[_0xd821('0x23')](function(_0x58ba21){return _0x58ba21;});}return null;};}function removeEntity(_0x3886e7,_0x2b9915){return function(_0x4a8868){if(_0x4a8868){return _0x4a8868[_0xd821('0x24')]()[_0xd821('0x23')](function(){_0x3886e7[_0xd821('0x1a')](0xcc)[_0xd821('0x19')]();});}};}function handleEntityNotFound(_0x10b441,_0x2fcef4){return function(_0x69271){if(!_0x69271){_0x10b441[_0xd821('0x18')](0x194);}return _0x69271;};}function handleError(_0x1d0b83,_0x524c79){_0x524c79=_0x524c79||0x1f4;return function(_0x2a791a){logger[_0xd821('0x25')](_0x2a791a['stack']);if(_0x2a791a[_0xd821('0x26')]){delete _0x2a791a[_0xd821('0x26')];}_0x1d0b83['status'](_0x524c79)[_0xd821('0x27')](_0x2a791a);};}exports[_0xd821('0x28')]=function(_0x2c2881,_0x46f9ba){var _0x143a21={},_0x159cd8={},_0x2773dd={'count':0x0,'rows':[]};var _0x163aa2=_['map'](db[_0xd821('0x29')][_0xd821('0x2a')],function(_0x4b7ac1){return{'name':_0x4b7ac1[_0xd821('0x2b')],'type':_0x4b7ac1[_0xd821('0x2c')][_0xd821('0x2d')]};});_0x159cd8[_0xd821('0x2e')]=_[_0xd821('0x2f')](_0x163aa2,_0xd821('0x26'));_0x159cd8[_0xd821('0x30')]=_[_0xd821('0x31')](_0x2c2881['query']);_0x159cd8[_0xd821('0x32')]=_[_0xd821('0x33')](_0x159cd8[_0xd821('0x2e')],_0x159cd8[_0xd821('0x30')]);_0x143a21[_0xd821('0x34')]=_['intersection'](_0x159cd8[_0xd821('0x2e')],qs['fields'](_0x2c2881[_0xd821('0x30')][_0xd821('0x35')]));_0x143a21[_0xd821('0x34')]=_0x143a21[_0xd821('0x34')][_0xd821('0x36')]?_0x143a21['attributes']:_0x159cd8[_0xd821('0x2e')];if(!_0x2c2881['query'][_0xd821('0x37')]('nolimit')){_0x143a21[_0xd821('0x1e')]=qs['limit'](_0x2c2881[_0xd821('0x30')][_0xd821('0x1e')]);_0x143a21[_0xd821('0x1c')]=qs[_0xd821('0x1c')](_0x2c2881[_0xd821('0x30')][_0xd821('0x1c')]);}_0x143a21['order']=qs[_0xd821('0x38')](_0x2c2881[_0xd821('0x30')][_0xd821('0x38')]);_0x143a21[_0xd821('0x39')]=qs[_0xd821('0x32')](_[_0xd821('0x3a')](_0x2c2881[_0xd821('0x30')],_0x159cd8[_0xd821('0x32')]),_0x163aa2);if(_0x2c2881['query'][_0xd821('0x3b')]){_0x143a21['where']=_['merge'](_0x143a21['where'],{'$or':_[_0xd821('0x2f')](_0x163aa2,function(_0x50e018){if(_0x50e018[_0xd821('0x2c')]!==_0xd821('0x3c')){var _0x4fb318={};_0x4fb318[_0x50e018[_0xd821('0x26')]]={'$like':'%'+_0x2c2881[_0xd821('0x30')][_0xd821('0x3b')]+'%'};return _0x4fb318;}})});}_0x143a21=_[_0xd821('0x3d')]({},_0x143a21,_0x2c2881[_0xd821('0x3e')]);var _0x47c2c6={'where':_0x143a21[_0xd821('0x39')]};return db['CmHopperBlack'][_0xd821('0x3f')](_0x47c2c6)['then'](function(_0x19ce97){_0x2773dd[_0xd821('0x3f')]=_0x19ce97;if(_0x2c2881[_0xd821('0x30')][_0xd821('0x40')]){_0x143a21['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xd821('0x41')](_0x143a21);})[_0xd821('0x23')](function(_0x433108){_0x2773dd[_0xd821('0x42')]=_0x433108;return _0x2773dd;})[_0xd821('0x23')](respondWithFilteredResult(_0x46f9ba,_0x143a21))['catch'](handleError(_0x46f9ba,null));};exports['show']=function(_0x14e272,_0x2b9713){var _0xad42c6={'raw':!![],'where':{'id':_0x14e272[_0xd821('0x43')]['id']}},_0x19f6c8={};_0x19f6c8['model']=_[_0xd821('0x31')](db['CmHopperBlack']['rawAttributes']);_0x19f6c8[_0xd821('0x30')]=_[_0xd821('0x31')](_0x14e272['query']);_0x19f6c8[_0xd821('0x32')]=_[_0xd821('0x33')](_0x19f6c8[_0xd821('0x2e')],_0x19f6c8[_0xd821('0x30')]);_0xad42c6['attributes']=_[_0xd821('0x33')](_0x19f6c8[_0xd821('0x2e')],qs[_0xd821('0x35')](_0x14e272[_0xd821('0x30')][_0xd821('0x35')]));_0xad42c6[_0xd821('0x34')]=_0xad42c6[_0xd821('0x34')][_0xd821('0x36')]?_0xad42c6[_0xd821('0x34')]:_0x19f6c8[_0xd821('0x2e')];if(_0x14e272[_0xd821('0x30')]['includeAll']){_0xad42c6[_0xd821('0x44')]=[{'all':!![]}];}_0xad42c6=_['merge']({},_0xad42c6,_0x14e272[_0xd821('0x3e')]);return db['CmHopperBlack'][_0xd821('0x45')](_0xad42c6)['then'](handleEntityNotFound(_0x2b9713,null))[_0xd821('0x23')](respondWithResult(_0x2b9713,null))['catch'](handleError(_0x2b9713,null));};exports[_0xd821('0x46')]=function(_0x49e6b0,_0x40ac73){if(_0x49e6b0[_0xd821('0x47')]['id']){delete _0x49e6b0[_0xd821('0x47')]['id'];}return db[_0xd821('0x29')][_0xd821('0x45')]({'where':{'id':_0x49e6b0[_0xd821('0x43')]['id']}})[_0xd821('0x23')](handleEntityNotFound(_0x40ac73,null))['then'](saveUpdates(_0x49e6b0[_0xd821('0x47')],null))[_0xd821('0x23')](respondWithResult(_0x40ac73,null))[_0xd821('0x48')](handleError(_0x40ac73,null));};exports[_0xd821('0x24')]=function(_0x1adb68,_0x185b24){return db['CmHopperBlack']['find']({'where':{'id':_0x1adb68['params']['id']}})['then'](handleEntityNotFound(_0x185b24,null))[_0xd821('0x23')](removeEntity(_0x185b24,null))[_0xd821('0x48')](handleError(_0x185b24,null));};exports[_0xd821('0x49')]=function(_0x10a629,_0x22030c){return db[_0xd821('0x29')][_0xd821('0x49')]()[_0xd821('0x23')](respondWithResult(_0x22030c,null))[_0xd821('0x48')](handleError(_0x22030c,null));}; \ No newline at end of file +var _0xe2ea=['limit','undefined','count','set','apply','save','update','then','destroy','sendStatus','error','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','rows','show','intersection','includeAll','catch','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset'];(function(_0x13e1d9,_0x479e22){var _0x5e3c69=function(_0x314654){while(--_0x314654){_0x13e1d9['push'](_0x13e1d9['shift']());}};_0x5e3c69(++_0x479e22);}(_0xe2ea,0xc3));var _0xae2e=function(_0x1537b7,_0x260819){_0x1537b7=_0x1537b7-0x0;var _0x5a13fb=_0xe2ea[_0x1537b7];return _0x5a13fb;};'use strict';var emlformat=require(_0xae2e('0x0'));var rimraf=require(_0xae2e('0x1'));var zipdir=require(_0xae2e('0x2'));var jsonpatch=require(_0xae2e('0x3'));var rp=require(_0xae2e('0x4'));var moment=require(_0xae2e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xae2e('0x6'));var util=require(_0xae2e('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xae2e('0x8'));var fs=require('fs');var fs_extra=require(_0xae2e('0x9'));var _=require(_0xae2e('0xa'));var squel=require(_0xae2e('0xb'));var crypto=require(_0xae2e('0xc'));var jsforce=require(_0xae2e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xae2e('0xe'));var querystring=require(_0xae2e('0xf'));var Papa=require(_0xae2e('0x10'));var Redis=require(_0xae2e('0x11'));var authService=require(_0xae2e('0x12'));var qs=require(_0xae2e('0x13'));var as=require(_0xae2e('0x14'));var hardwareService=require(_0xae2e('0x15'));var logger=require(_0xae2e('0x16'))(_0xae2e('0x17'));var utils=require(_0xae2e('0x18'));var config=require(_0xae2e('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x380c27,_0x204117){_0x204117=_0x204117||0xcc;return function(_0x53e3d9){if(_0x53e3d9){return _0x380c27['sendStatus'](_0x204117);}return _0x380c27[_0xae2e('0x1a')](_0x204117)[_0xae2e('0x1b')]();};}function respondWithResult(_0x4a0b3f,_0x4a1ed3){_0x4a1ed3=_0x4a1ed3||0xc8;return function(_0x3acd83){if(_0x3acd83){return _0x4a0b3f['status'](_0x4a1ed3)[_0xae2e('0x1c')](_0x3acd83);}};}function respondWithFilteredResult(_0x4fa731,_0xfac5dd){return function(_0x3c4077){if(_0x3c4077){var _0x196226=typeof _0xfac5dd[_0xae2e('0x1d')]==='undefined'&&typeof _0xfac5dd[_0xae2e('0x1e')]===_0xae2e('0x1f');var _0x1087b0=_0x3c4077['count'];var _0x1db656=_0x196226?0x0:_0xfac5dd[_0xae2e('0x1d')];var _0x39ab8f=_0x196226?_0x3c4077[_0xae2e('0x20')]:_0xfac5dd[_0xae2e('0x1d')]+_0xfac5dd['limit'];var _0x19a1e5;if(_0x39ab8f>=_0x1087b0){_0x39ab8f=_0x1087b0;_0x19a1e5=0xc8;}else{_0x19a1e5=0xce;}_0x4fa731[_0xae2e('0x1a')](_0x19a1e5);return _0x4fa731[_0xae2e('0x21')]('Content-Range',_0x1db656+'-'+_0x39ab8f+'/'+_0x1087b0)[_0xae2e('0x1c')](_0x3c4077);}return null;};}function patchUpdates(_0x48cd28){return function(_0x45ae83){try{jsonpatch[_0xae2e('0x22')](_0x45ae83,_0x48cd28,!![]);}catch(_0x4ca586){return BPromise['reject'](_0x4ca586);}return _0x45ae83[_0xae2e('0x23')]();};}function saveUpdates(_0x90d7cd,_0x9d4f1f){return function(_0x39e3d5){if(_0x39e3d5){return _0x39e3d5[_0xae2e('0x24')](_0x90d7cd)[_0xae2e('0x25')](function(_0x4de83a){return _0x4de83a;});}return null;};}function removeEntity(_0x326cd4,_0x553207){return function(_0xb24994){if(_0xb24994){return _0xb24994[_0xae2e('0x26')]()['then'](function(){_0x326cd4['status'](0xcc)[_0xae2e('0x1b')]();});}};}function handleEntityNotFound(_0x543892,_0x4f66a1){return function(_0x1640d2){if(!_0x1640d2){_0x543892[_0xae2e('0x27')](0x194);}return _0x1640d2;};}function handleError(_0xd49c22,_0x430cb2){_0x430cb2=_0x430cb2||0x1f4;return function(_0x13b0b9){logger[_0xae2e('0x28')](_0x13b0b9[_0xae2e('0x29')]);if(_0x13b0b9['name']){delete _0x13b0b9[_0xae2e('0x2a')];}_0xd49c22[_0xae2e('0x1a')](_0x430cb2)['send'](_0x13b0b9);};}exports[_0xae2e('0x2b')]=function(_0x29a3b0,_0x2243c1){var _0x1ae7d7={},_0x3644a4={},_0x95ec69={'count':0x0,'rows':[]};var _0x17ee8c=_[_0xae2e('0x2c')](db[_0xae2e('0x2d')][_0xae2e('0x2e')],function(_0x266de9){return{'name':_0x266de9[_0xae2e('0x2f')],'type':_0x266de9[_0xae2e('0x30')][_0xae2e('0x31')]};});_0x3644a4[_0xae2e('0x32')]=_[_0xae2e('0x2c')](_0x17ee8c,'name');_0x3644a4[_0xae2e('0x33')]=_[_0xae2e('0x34')](_0x29a3b0[_0xae2e('0x33')]);_0x3644a4[_0xae2e('0x35')]=_['intersection'](_0x3644a4[_0xae2e('0x32')],_0x3644a4['query']);_0x1ae7d7[_0xae2e('0x36')]=_['intersection'](_0x3644a4[_0xae2e('0x32')],qs[_0xae2e('0x37')](_0x29a3b0['query'][_0xae2e('0x37')]));_0x1ae7d7[_0xae2e('0x36')]=_0x1ae7d7['attributes'][_0xae2e('0x38')]?_0x1ae7d7[_0xae2e('0x36')]:_0x3644a4['model'];if(!_0x29a3b0['query'][_0xae2e('0x39')](_0xae2e('0x3a'))){_0x1ae7d7[_0xae2e('0x1e')]=qs['limit'](_0x29a3b0[_0xae2e('0x33')]['limit']);_0x1ae7d7['offset']=qs[_0xae2e('0x1d')](_0x29a3b0['query'][_0xae2e('0x1d')]);}_0x1ae7d7[_0xae2e('0x3b')]=qs['sort'](_0x29a3b0[_0xae2e('0x33')][_0xae2e('0x3c')]);_0x1ae7d7[_0xae2e('0x3d')]=qs['filters'](_['pick'](_0x29a3b0[_0xae2e('0x33')],_0x3644a4[_0xae2e('0x35')]),_0x17ee8c);if(_0x29a3b0[_0xae2e('0x33')][_0xae2e('0x3e')]){_0x1ae7d7[_0xae2e('0x3d')]=_['merge'](_0x1ae7d7[_0xae2e('0x3d')],{'$or':_[_0xae2e('0x2c')](_0x17ee8c,function(_0x539520){if(_0x539520['type']!=='VIRTUAL'){var _0x32302b={};_0x32302b[_0x539520['name']]={'$like':'%'+_0x29a3b0[_0xae2e('0x33')][_0xae2e('0x3e')]+'%'};return _0x32302b;}})});}_0x1ae7d7=_[_0xae2e('0x3f')]({},_0x1ae7d7,_0x29a3b0[_0xae2e('0x40')]);var _0xbbbbf8={'where':_0x1ae7d7[_0xae2e('0x3d')]};return db[_0xae2e('0x2d')]['count'](_0xbbbbf8)[_0xae2e('0x25')](function(_0x304d33){_0x95ec69[_0xae2e('0x20')]=_0x304d33;if(_0x29a3b0[_0xae2e('0x33')]['includeAll']){_0x1ae7d7[_0xae2e('0x41')]=[{'all':!![]}];}return db[_0xae2e('0x2d')]['findAll'](_0x1ae7d7);})['then'](function(_0x1ca7be){_0x95ec69[_0xae2e('0x42')]=_0x1ca7be;return _0x95ec69;})[_0xae2e('0x25')](respondWithFilteredResult(_0x2243c1,_0x1ae7d7))['catch'](handleError(_0x2243c1,null));};exports[_0xae2e('0x43')]=function(_0x234103,_0x50caf3){var _0x3441d4={'raw':!![],'where':{'id':_0x234103['params']['id']}},_0x473d3d={};_0x473d3d[_0xae2e('0x32')]=_[_0xae2e('0x34')](db[_0xae2e('0x2d')][_0xae2e('0x2e')]);_0x473d3d[_0xae2e('0x33')]=_[_0xae2e('0x34')](_0x234103[_0xae2e('0x33')]);_0x473d3d[_0xae2e('0x35')]=_[_0xae2e('0x44')](_0x473d3d['model'],_0x473d3d[_0xae2e('0x33')]);_0x3441d4[_0xae2e('0x36')]=_[_0xae2e('0x44')](_0x473d3d['model'],qs[_0xae2e('0x37')](_0x234103[_0xae2e('0x33')][_0xae2e('0x37')]));_0x3441d4['attributes']=_0x3441d4['attributes'][_0xae2e('0x38')]?_0x3441d4['attributes']:_0x473d3d[_0xae2e('0x32')];if(_0x234103[_0xae2e('0x33')][_0xae2e('0x45')]){_0x3441d4[_0xae2e('0x41')]=[{'all':!![]}];}_0x3441d4=_[_0xae2e('0x3f')]({},_0x3441d4,_0x234103[_0xae2e('0x40')]);return db[_0xae2e('0x2d')]['find'](_0x3441d4)['then'](handleEntityNotFound(_0x50caf3,null))[_0xae2e('0x25')](respondWithResult(_0x50caf3,null))[_0xae2e('0x46')](handleError(_0x50caf3,null));};exports[_0xae2e('0x24')]=function(_0x15caf6,_0x971b72){if(_0x15caf6[_0xae2e('0x47')]['id']){delete _0x15caf6['body']['id'];}return db[_0xae2e('0x2d')][_0xae2e('0x48')]({'where':{'id':_0x15caf6[_0xae2e('0x49')]['id']}})[_0xae2e('0x25')](handleEntityNotFound(_0x971b72,null))[_0xae2e('0x25')](saveUpdates(_0x15caf6['body'],null))[_0xae2e('0x25')](respondWithResult(_0x971b72,null))[_0xae2e('0x46')](handleError(_0x971b72,null));};exports[_0xae2e('0x26')]=function(_0xa3add9,_0x517800){return db[_0xae2e('0x2d')][_0xae2e('0x48')]({'where':{'id':_0xa3add9['params']['id']}})[_0xae2e('0x25')](handleEntityNotFound(_0x517800,null))[_0xae2e('0x25')](removeEntity(_0x517800,null))[_0xae2e('0x46')](handleError(_0x517800,null));};exports[_0xae2e('0x4a')]=function(_0x5ca245,_0x29018b){return db[_0xae2e('0x2d')][_0xae2e('0x4a')]()[_0xae2e('0x25')](respondWithResult(_0x29018b,null))['catch'](handleError(_0x29018b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 1acbad2..2d2abc4 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 _0x06ad=['bluebird','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x06ad,0x1d7));var _0xd06a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06ad[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd06a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd06a('0x1'));var moment=require('moment');var BPromise=require(_0xd06a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd06a('0x3'));var rimraf=require(_0xd06a('0x4'));var config=require(_0xd06a('0x5'));var attributes=require(_0xd06a('0x6'));module[_0xd06a('0x7')]=function(_0x4b4199,_0x4563fd){return _0x4b4199[_0xd06a('0x8')](_0xd06a('0x9'),attributes,{'tableName':_0xd06a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc628=['request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api'];(function(_0x2ece4f,_0x5cb907){var _0x12e804=function(_0x2dd6d2){while(--_0x2dd6d2){_0x2ece4f['push'](_0x2ece4f['shift']());}};_0x12e804(++_0x5cb907);}(_0xc628,0x126));var _0x8c62=function(_0x275f78,_0x2a0cfc){_0x275f78=_0x275f78-0x0;var _0x538243=_0xc628[_0x275f78];return _0x538243;};'use strict';var _=require(_0x8c62('0x0'));var util=require(_0x8c62('0x1'));var logger=require('../../config/logger')(_0x8c62('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8c62('0x3'));var fs=require('fs');var path=require(_0x8c62('0x4'));var rimraf=require('rimraf');var config=require(_0x8c62('0x5'));var attributes=require(_0x8c62('0x6'));module[_0x8c62('0x7')]=function(_0x2a5a71,_0x3be0c3){return _0x2a5a71[_0x8c62('0x8')](_0x8c62('0x9'),attributes,{'tableName':_0x8c62('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 6ec10d4..96a7f88 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 _0xbd20=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird'];(function(_0x4174b3,_0x274e24){var _0x16cb3d=function(_0x3ced61){while(--_0x3ced61){_0x4174b3['push'](_0x4174b3['shift']());}};_0x16cb3d(++_0x274e24);}(_0xbd20,0x98));var _0x0bd2=function(_0x33654f,_0x1313a8){_0x33654f=_0x33654f-0x0;var _0x1e01b4=_0xbd20[_0x33654f];return _0x1e01b4;};'use strict';var _=require(_0x0bd2('0x0'));var util=require(_0x0bd2('0x1'));var moment=require(_0x0bd2('0x2'));var BPromise=require(_0x0bd2('0x3'));var rs=require(_0x0bd2('0x4'));var fs=require('fs');var Redis=require(_0x0bd2('0x5'));var db=require(_0x0bd2('0x6'))['db'];var utils=require(_0x0bd2('0x7'));var logger=require('../../config/logger')(_0x0bd2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd2('0x9')][_0x0bd2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1605b5,_0x3b1659,_0x1ecdaf){return new BPromise(function(_0x4cb982,_0x5684f8){return client[_0x0bd2('0xb')](_0x1605b5,_0x1ecdaf)[_0x0bd2('0xc')](function(_0x3e9d4f){logger[_0x0bd2('0xd')](_0x0bd2('0xe'),_0x3b1659,_0x0bd2('0xf'));logger[_0x0bd2('0x10')](_0x0bd2('0x11'),_0x3b1659,_0x0bd2('0xf'),JSON[_0x0bd2('0x12')](_0x3e9d4f));if(_0x3e9d4f[_0x0bd2('0x13')]){if(_0x3e9d4f['error']['code']===0x1f4){logger[_0x0bd2('0x13')](_0x0bd2('0xe'),_0x3b1659,_0x3e9d4f['error'][_0x0bd2('0x14')]);return _0x5684f8(_0x3e9d4f[_0x0bd2('0x13')][_0x0bd2('0x14')]);}logger[_0x0bd2('0x13')](_0x0bd2('0xe'),_0x3b1659,_0x3e9d4f[_0x0bd2('0x13')][_0x0bd2('0x14')]);return _0x4cb982(_0x3e9d4f['error']['message']);}else{logger[_0x0bd2('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x3b1659,_0x0bd2('0xf'));_0x4cb982(_0x3e9d4f[_0x0bd2('0x15')][_0x0bd2('0x14')]);}})[_0x0bd2('0x16')](function(_0x428e2b){logger[_0x0bd2('0x13')](_0x0bd2('0xe'),_0x3b1659,_0x428e2b);_0x5684f8(_0x428e2b);});});}exports[_0x0bd2('0x17')]=function(_0x1f8672){var _0x12ae60=this;return new Promise(function(_0x1e460e,_0x23b612){return db[_0x0bd2('0x18')][_0x0bd2('0x19')]({'raw':_0x1f8672[_0x0bd2('0x1a')]?_0x1f8672[_0x0bd2('0x1a')][_0x0bd2('0x1b')]===undefined?!![]:![]:!![],'where':_0x1f8672[_0x0bd2('0x1a')]?_0x1f8672['options'][_0x0bd2('0x1c')]||null:null,'attributes':_0x1f8672[_0x0bd2('0x1a')]?_0x1f8672['options'][_0x0bd2('0x1d')]||null:null,'limit':_0x1f8672['options']?_0x1f8672[_0x0bd2('0x1a')][_0x0bd2('0x1e')]||null:null,'include':_0x1f8672[_0x0bd2('0x1a')]?_0x1f8672[_0x0bd2('0x1a')][_0x0bd2('0x1f')]?_['map'](_0x1f8672[_0x0bd2('0x1a')][_0x0bd2('0x1f')],function(_0x56b007){return{'model':db[_0x56b007[_0x0bd2('0x20')]],'as':_0x56b007['as'],'attributes':_0x56b007[_0x0bd2('0x1d')],'include':_0x56b007[_0x0bd2('0x1f')]?_[_0x0bd2('0x21')](_0x56b007[_0x0bd2('0x1f')],function(_0x2aefaa){return{'model':db[_0x2aefaa[_0x0bd2('0x20')]],'as':_0x2aefaa['as'],'attributes':_0x2aefaa[_0x0bd2('0x1d')],'include':_0x2aefaa[_0x0bd2('0x1f')]?_[_0x0bd2('0x21')](_0x2aefaa['include'],function(_0x482922){return{'model':db[_0x482922['model']],'as':_0x482922['as'],'attributes':_0x482922[_0x0bd2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0bd2('0xc')](function(_0x3282d2){logger[_0x0bd2('0xd')](_0x0bd2('0x17'),_0x1f8672);logger['debug']('GetCmHopperBlack',_0x1f8672,JSON[_0x0bd2('0x12')](_0x3282d2));_0x1e460e(_0x3282d2);})[_0x0bd2('0x16')](function(_0x302747){logger[_0x0bd2('0x13')](_0x0bd2('0x17'),_0x302747['message'],_0x1f8672);_0x23b612(_0x12ae60[_0x0bd2('0x13')](0x1f4,_0x302747[_0x0bd2('0x14')]));});});};exports[_0x0bd2('0x22')]=function(_0x5d323c){var _0x4d0c30=this;return new Promise(function(_0x37f281,_0x6e0e0b){return db[_0x0bd2('0x18')][_0x0bd2('0x23')](_0x5d323c[_0x0bd2('0x24')],{'raw':_0x5d323c[_0x0bd2('0x1a')]?_0x5d323c['options'][_0x0bd2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d323c[_0x0bd2('0x1a')]?_0x5d323c[_0x0bd2('0x1a')]['where']||null:null,'attributes':_0x5d323c[_0x0bd2('0x1a')]?_0x5d323c[_0x0bd2('0x1a')][_0x0bd2('0x1d')]||null:null,'limit':_0x5d323c[_0x0bd2('0x1a')]?_0x5d323c['options'][_0x0bd2('0x1e')]||null:null})[_0x0bd2('0xc')](function(_0x279b9f){logger[_0x0bd2('0xd')](_0x0bd2('0x22'),_0x5d323c);logger[_0x0bd2('0x10')]('UpdateCmHopperBlack',_0x5d323c,JSON[_0x0bd2('0x12')](_0x279b9f));_0x37f281(_0x279b9f);})[_0x0bd2('0x16')](function(_0x3247a7){logger['error']('UpdateCmHopperBlack',_0x3247a7['message'],_0x5d323c);_0x6e0e0b(_0x4d0c30[_0x0bd2('0x13')](0x1f4,_0x3247a7[_0x0bd2('0x14')]));});});};exports[_0x0bd2('0x25')]=function(_0x8e705e){var _0x3fdc5f=this;return new Promise(function(_0x2d01c5,_0x584373){return db['CmHopperBlack'][_0x0bd2('0x26')]({'where':_0x8e705e[_0x0bd2('0x1a')]?_0x8e705e[_0x0bd2('0x1a')][_0x0bd2('0x1c')]||null:null})['then'](function(_0x4a4fc9){logger[_0x0bd2('0xd')]('DestroyCmHopperBlack',_0x8e705e);logger[_0x0bd2('0x10')]('DestroyCmHopperBlack',_0x8e705e,JSON[_0x0bd2('0x12')](_0x4a4fc9));_0x2d01c5(_0x4a4fc9);})[_0x0bd2('0x16')](function(_0x78a0ea){logger[_0x0bd2('0x13')]('DestroyCmHopperBlack',_0x78a0ea[_0x0bd2('0x14')],_0x8e705e);_0x584373(_0x3fdc5f[_0x0bd2('0x13')](0x1f4,_0x78a0ea[_0x0bd2('0x14')]));});});}; \ No newline at end of file +var _0x4722=['error','code','message','info','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','limit','include','map','model','stringify','UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s'];(function(_0x5d3d3b,_0xed4483){var _0x943621=function(_0x1bbab2){while(--_0x1bbab2){_0x5d3d3b['push'](_0x5d3d3b['shift']());}};_0x943621(++_0xed4483);}(_0x4722,0x80));var _0x2472=function(_0x3c126e,_0x2bf56a){_0x3c126e=_0x3c126e-0x0;var _0x2a910b=_0x4722[_0x3c126e];return _0x2a910b;};'use strict';var _=require(_0x2472('0x0'));var util=require('util');var moment=require(_0x2472('0x1'));var BPromise=require(_0x2472('0x2'));var rs=require(_0x2472('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2472('0x4'));var logger=require(_0x2472('0x5'))(_0x2472('0x6'));var config=require(_0x2472('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2472('0x8')][_0x2472('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x466a6f,_0x32498d,_0x2092ad){return new BPromise(function(_0x13514b,_0x45a01a){return client[_0x2472('0xa')](_0x466a6f,_0x2092ad)[_0x2472('0xb')](function(_0x585389){logger['info'](_0x2472('0xc'),_0x32498d,_0x2472('0xd'));logger[_0x2472('0xe')](_0x2472('0xf'),_0x32498d,_0x2472('0xd'),JSON['stringify'](_0x585389));if(_0x585389[_0x2472('0x10')]){if(_0x585389[_0x2472('0x10')][_0x2472('0x11')]===0x1f4){logger[_0x2472('0x10')](_0x2472('0xc'),_0x32498d,_0x585389[_0x2472('0x10')][_0x2472('0x12')]);return _0x45a01a(_0x585389['error'][_0x2472('0x12')]);}logger['error'](_0x2472('0xc'),_0x32498d,_0x585389[_0x2472('0x10')]['message']);return _0x13514b(_0x585389[_0x2472('0x10')][_0x2472('0x12')]);}else{logger[_0x2472('0x13')](_0x2472('0xc'),_0x32498d,_0x2472('0xd'));_0x13514b(_0x585389['result'][_0x2472('0x12')]);}})[_0x2472('0x14')](function(_0x1f5143){logger[_0x2472('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x32498d,_0x1f5143);_0x45a01a(_0x1f5143);});});}exports[_0x2472('0x15')]=function(_0x56baf9){var _0x2ab161=this;return new Promise(function(_0x3c1357,_0x1df07f){return db[_0x2472('0x16')][_0x2472('0x17')]({'raw':_0x56baf9[_0x2472('0x18')]?_0x56baf9[_0x2472('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x56baf9[_0x2472('0x18')]?_0x56baf9['options'][_0x2472('0x19')]||null:null,'attributes':_0x56baf9[_0x2472('0x18')]?_0x56baf9[_0x2472('0x18')][_0x2472('0x1a')]||null:null,'limit':_0x56baf9[_0x2472('0x18')]?_0x56baf9['options'][_0x2472('0x1b')]||null:null,'include':_0x56baf9['options']?_0x56baf9[_0x2472('0x18')][_0x2472('0x1c')]?_[_0x2472('0x1d')](_0x56baf9[_0x2472('0x18')][_0x2472('0x1c')],function(_0x3ab2a2){return{'model':db[_0x3ab2a2[_0x2472('0x1e')]],'as':_0x3ab2a2['as'],'attributes':_0x3ab2a2[_0x2472('0x1a')],'include':_0x3ab2a2[_0x2472('0x1c')]?_[_0x2472('0x1d')](_0x3ab2a2[_0x2472('0x1c')],function(_0x1f7940){return{'model':db[_0x1f7940[_0x2472('0x1e')]],'as':_0x1f7940['as'],'attributes':_0x1f7940[_0x2472('0x1a')],'include':_0x1f7940[_0x2472('0x1c')]?_[_0x2472('0x1d')](_0x1f7940[_0x2472('0x1c')],function(_0x254b13){return{'model':db[_0x254b13[_0x2472('0x1e')]],'as':_0x254b13['as'],'attributes':_0x254b13[_0x2472('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2472('0xb')](function(_0x5281a6){logger[_0x2472('0x13')](_0x2472('0x15'),_0x56baf9);logger[_0x2472('0xe')](_0x2472('0x15'),_0x56baf9,JSON[_0x2472('0x1f')](_0x5281a6));_0x3c1357(_0x5281a6);})[_0x2472('0x14')](function(_0x323931){logger[_0x2472('0x10')](_0x2472('0x15'),_0x323931[_0x2472('0x12')],_0x56baf9);_0x1df07f(_0x2ab161[_0x2472('0x10')](0x1f4,_0x323931[_0x2472('0x12')]));});});};exports[_0x2472('0x20')]=function(_0x209f57){var _0x321be0=this;return new Promise(function(_0x5a76db,_0x5c767e){return db[_0x2472('0x16')][_0x2472('0x21')](_0x209f57['body'],{'raw':_0x209f57[_0x2472('0x18')]?_0x209f57[_0x2472('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x209f57[_0x2472('0x18')]?_0x209f57['options'][_0x2472('0x19')]||null:null,'attributes':_0x209f57[_0x2472('0x18')]?_0x209f57['options'][_0x2472('0x1a')]||null:null,'limit':_0x209f57[_0x2472('0x18')]?_0x209f57['options'][_0x2472('0x1b')]||null:null})[_0x2472('0xb')](function(_0x12d969){logger[_0x2472('0x13')]('UpdateCmHopperBlack',_0x209f57);logger[_0x2472('0xe')]('UpdateCmHopperBlack',_0x209f57,JSON[_0x2472('0x1f')](_0x12d969));_0x5a76db(_0x12d969);})['catch'](function(_0x5f88fc){logger['error']('UpdateCmHopperBlack',_0x5f88fc['message'],_0x209f57);_0x5c767e(_0x321be0[_0x2472('0x10')](0x1f4,_0x5f88fc[_0x2472('0x12')]));});});};exports[_0x2472('0x22')]=function(_0x14dc3c){var _0x3a68f9=this;return new Promise(function(_0x464121,_0x13f053){return db['CmHopperBlack'][_0x2472('0x23')]({'where':_0x14dc3c[_0x2472('0x18')]?_0x14dc3c[_0x2472('0x18')][_0x2472('0x19')]||null:null})[_0x2472('0xb')](function(_0x2f6096){logger[_0x2472('0x13')]('DestroyCmHopperBlack',_0x14dc3c);logger[_0x2472('0xe')]('DestroyCmHopperBlack',_0x14dc3c,JSON[_0x2472('0x1f')](_0x2f6096));_0x464121(_0x2f6096);})[_0x2472('0x14')](function(_0x5b4a3b){logger[_0x2472('0x10')](_0x2472('0x22'),_0x5b4a3b[_0x2472('0x12')],_0x14dc3c);_0x13f053(_0x3a68f9[_0x2472('0x10')](0x1f4,_0x5b4a3b[_0x2472('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 4866b18..ffc2aa6 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 _0xa6b0=['update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','put'];(function(_0x55e9e9,_0x1afc74){var _0x39cb0c=function(_0x4c02f3){while(--_0x4c02f3){_0x55e9e9['push'](_0x55e9e9['shift']());}};_0x39cb0c(++_0x1afc74);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x2a2057,_0xa7dad0){_0x2a2057=_0x2a2057-0x0;var _0x6b6f79=_0xa6b0[_0x2a2057];return _0x6b6f79;};'use strict';var multer=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a6b('0x2'));var router=express[_0x0a6b('0x3')]();var fs_extra=require(_0x0a6b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var controller=require(_0x0a6b('0x7'));router[_0x0a6b('0x8')]('/',auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xa')]);router[_0x0a6b('0x8')](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xc')]);router[_0x0a6b('0x8')](_0x0a6b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0a6b('0xe')](_0x0a6b('0xd'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xf')]);router[_0x0a6b('0x10')](_0x0a6b('0xd'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0x11')]);module[_0x0a6b('0x12')]=router; \ No newline at end of file +var _0xdf55=['../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','delete','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x1e8f9e,_0x148061){var _0x2cec83=function(_0x55d9ee){while(--_0x55d9ee){_0x1e8f9e['push'](_0x1e8f9e['shift']());}};_0x2cec83(++_0x148061);}(_0xdf55,0x83));var _0x5df5=function(_0x197df3,_0x57d366){_0x197df3=_0x197df3-0x0;var _0xafdaf7=_0xdf55[_0x197df3];return _0xafdaf7;};'use strict';var multer=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var path=require('path');var timeout=require(_0x5df5('0x2'));var express=require(_0x5df5('0x3'));var router=express['Router']();var fs_extra=require(_0x5df5('0x4'));var auth=require(_0x5df5('0x5'));var interaction=require(_0x5df5('0x6'));var config=require('../../config/environment');var controller=require(_0x5df5('0x7'));router[_0x5df5('0x8')]('/',auth[_0x5df5('0x9')](),controller[_0x5df5('0xa')]);router[_0x5df5('0x8')](_0x5df5('0xb'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xc')]);router['get'](_0x5df5('0xd'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xe')]);router['put']('/:id',auth[_0x5df5('0x9')](),controller['update']);router[_0x5df5('0xf')](_0x5df5('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x5df5('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 2458264..586300a 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 _0xb917=['STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','moment','INTEGER'];(function(_0x4a2758,_0x437d44){var _0x67f967=function(_0x425aa1){while(--_0x425aa1){_0x4a2758['push'](_0x4a2758['shift']());}};_0x67f967(++_0x437d44);}(_0xb917,0xda));var _0x7b91=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb917[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7b91('0x0'));module['exports']={'state':{'type':Sequelize[_0x7b91('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x7b91('0x2')]},'scheduledat':{'type':Sequelize[_0x7b91('0x3')]},'countbusyretry':{'type':Sequelize[_0x7b91('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7b91('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7b91('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7b91('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x7b91('0x2')]},'originatecalleridname':{'type':Sequelize[_0x7b91('0x2')]},'calleridnum':{'type':Sequelize[_0x7b91('0x2')]},'calleridname':{'type':Sequelize[_0x7b91('0x2')]},'starttime':{'type':Sequelize[_0x7b91('0x3')]},'responsetime':{'type':Sequelize[_0x7b91('0x3')]},'answertime':{'type':Sequelize[_0x7b91('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x7b91('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7b91('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7b91('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7b91('0x2')]},'campaign':{'type':Sequelize[_0x7b91('0x2')]},'campaigntype':{'type':Sequelize[_0x7b91('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x7b91('0x2')]},'disposition':{'type':Sequelize[_0x7b91('0x2')]},'secondDisposition':{'type':Sequelize[_0x7b91('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7b91('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x38307a){var _0x300f07=this[_0x7b91('0x4')](_0x7b91('0x5'));if(_0x300f07&&_0x38307a){this[_0x7b91('0x6')](_0x7b91('0x7'),moment(_0x38307a)[_0x7b91('0x8')](moment(_0x300f07),_0x7b91('0x9')));}return this[_0x7b91('0x6')]('dispositionat',_0x38307a);}},'amd':{'type':Sequelize[_0x7b91('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7b91('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x7b91('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x7b91('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7b91('0x3')]},'deleted':{'type':Sequelize[_0x7b91('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x7b91('0x3')]},'recallme':{'type':Sequelize[_0x7b91('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x7b91('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7b91('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7b91('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7b91('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7b91('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xff5e=['sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN'];(function(_0x5bc6db,_0x33349e){var _0xf97078=function(_0x3af85d){while(--_0x3af85d){_0x5bc6db['push'](_0x5bc6db['shift']());}};_0xf97078(++_0x33349e);}(_0xff5e,0xb6));var _0xeff5=function(_0x1b69d0,_0xd9d920){_0x1b69d0=_0x1b69d0-0x0;var _0x51b6e4=_0xff5e[_0x1b69d0];return _0x51b6e4;};'use strict';var Sequelize=require(_0xeff5('0x0'));var moment=require('moment');module[_0xeff5('0x1')]={'state':{'type':Sequelize[_0xeff5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xeff5('0x3')]},'scheduledat':{'type':Sequelize[_0xeff5('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xeff5('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xeff5('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xeff5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xeff5('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xeff5('0x3')]},'originatecalleridname':{'type':Sequelize[_0xeff5('0x3')]},'calleridnum':{'type':Sequelize[_0xeff5('0x3')]},'calleridname':{'type':Sequelize[_0xeff5('0x3')]},'starttime':{'type':Sequelize[_0xeff5('0x4')]},'responsetime':{'type':Sequelize[_0xeff5('0x4')]},'answertime':{'type':Sequelize[_0xeff5('0x4')]},'droptime':{'type':Sequelize[_0xeff5('0x4')]},'endtime':{'type':Sequelize[_0xeff5('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xeff5('0x3')]},'campaigntype':{'type':Sequelize[_0xeff5('0x3')]},'membername':{'type':Sequelize[_0xeff5('0x3')]},'reason':{'type':Sequelize[_0xeff5('0x3')]},'disposition':{'type':Sequelize[_0xeff5('0x3')]},'secondDisposition':{'type':Sequelize[_0xeff5('0x3')]},'thirdDisposition':{'type':Sequelize[_0xeff5('0x3')]},'dispositionat':{'type':Sequelize[_0xeff5('0x4')],'set':function(_0xbf1805){var _0x243223=this[_0xeff5('0x5')](_0xeff5('0x6'));if(_0x243223&&_0xbf1805){this[_0xeff5('0x7')](_0xeff5('0x8'),moment(_0xbf1805)[_0xeff5('0x9')](moment(_0x243223),_0xeff5('0xa')));}return this[_0xeff5('0x7')](_0xeff5('0xb'),_0xbf1805);}},'amd':{'type':Sequelize[_0xeff5('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xeff5('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xeff5('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xeff5('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xeff5('0x4')]},'callback':{'type':Sequelize[_0xeff5('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xeff5('0x4')]},'deleted':{'type':Sequelize[_0xeff5('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xeff5('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xeff5('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xeff5('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xeff5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xeff5('0x2')],'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 c3c2519..aba38cf 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 _0x33af=['end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','fromQuery','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x13edc1,_0x6906ea){var _0x5206dc=function(_0xd5f08f){while(--_0xd5f08f){_0x13edc1['push'](_0x13edc1['shift']());}};_0x5206dc(++_0x6906ea);}(_0x33af,0xec));var _0xf33a=function(_0x3b4922,_0x2fa365){_0x3b4922=_0x3b4922-0x0;var _0x239729=_0x33af[_0x3b4922];return _0x239729;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['CmHopperFinal'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':!![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')]()[_0xf33a('0x26')](respondWithResult(_0x1a98f9,null))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x4107b1,_0x190a2b){if(_0x4107b1[_0xf33a('0x48')][_0xf33a('0x49')]){delete _0x4107b1[_0xf33a('0x48')][_0xf33a('0x49')];}return db[_0xf33a('0x2d')][_0xf33a('0x4a')]({'where':{'uniqueid':_0x4107b1[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x190a2b,null))[_0xf33a('0x26')](saveUpdates(_0x4107b1[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x190a2b,null))[_0xf33a('0x42')](handleError(_0x190a2b,null));};exports[_0xf33a('0x4b')]=function(_0x3bab07,_0x1f7d8c,_0x57815c){return db['CmHopperFinal'][_0xf33a('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x3bab07[_0xf33a('0x44')]['id']},'attributes':[[db['sequelize']['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal'](_0xf33a('0x4e')))),_0xf33a('0x4f')],[db[_0xf33a('0x4d')]['fn']('COUNT',db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x51')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal'](_0xf33a('0x52')))),_0xf33a('0x53')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xf33a('0x54')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x55')))),'dropContacts'],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x56')))),_0xf33a('0x57')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x58')))),'answeringMachine']]})[_0xf33a('0x26')](handleEntityNotFound(_0x1f7d8c,null))[_0xf33a('0x26')](respondWithResult(_0x1f7d8c,null))[_0xf33a('0x42')](handleError(_0x1f7d8c,null));};exports[_0xf33a('0x59')]=function(_0x2f1fef,_0x129229,_0x473484){return db[_0xf33a('0x2d')][_0xf33a('0x40')]({'raw':![],'where':{'CampaignId':_0x2f1fef[_0xf33a('0x44')]['id']},'attributes':[[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xf33a('0x4f')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x51')))),_0xf33a('0x5a')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x52')))),_0xf33a('0x53')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x5b')))),'congestionContacts'],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x55')))),_0xf33a('0x5c')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db['sequelize']['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x5d')))),_0xf33a('0x5e')],[db[_0xf33a('0x4d')]['fn'](_0xf33a('0x4c'),db[_0xf33a('0x4d')]['fn']('IF',db['sequelize'][_0xf33a('0x50')](_0xf33a('0x56')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0xf33a('0x4d')]['fn']('IF',db[_0xf33a('0x4d')][_0xf33a('0x50')](_0xf33a('0x58')))),_0xf33a('0x5f')]]})[_0xf33a('0x26')](handleEntityNotFound(_0x129229,null))[_0xf33a('0x26')](respondWithResult(_0x129229,null))[_0xf33a('0x42')](handleError(_0x129229,null));};exports[_0xf33a('0x60')]=function(_0x3bebca,_0x40bb02,_0x10a271){return db['VoiceQueue'][_0xf33a('0x4a')]({'where':{'id':_0x3bebca['params']['id']}})['then'](handleEntityNotFound(_0x40bb02,null))[_0xf33a('0x26')](function(_0x25cc49){var _0x132764;if(_0x25cc49){_0x132764=squel['insert']()['into'](_0xf33a('0x61'))['fromQuery']([_0xf33a('0x62'),_0xf33a('0x63'),_0xf33a('0x64'),_0xf33a('0x65'),_0xf33a('0x66'),'createdAt','updatedAt'],squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x69'),_0xf33a('0x62'))['field'](_0xf33a('0x6a'),_0xf33a('0x63'))['field'](_0xf33a('0x6b'),_0xf33a('0x64'))[_0xf33a('0x68')]('ANY_VALUE(ListId)',_0xf33a('0x65'))[_0xf33a('0x68')](_0xf33a('0x6c'),_0xf33a('0x66'))['field'](_0xf33a('0x6a'),_0xf33a('0x6d'))[_0xf33a('0x68')]('NOW()',_0xf33a('0x6e'))[_0xf33a('0x6f')](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id'][_0xf33a('0x72')]())[_0xf33a('0x3b')](_0xf33a('0x73'),_0x3bebca[_0xf33a('0x48')][_0xf33a('0x74')][_0xf33a('0x72')]())[_0xf33a('0x3b')](_0xf33a('0x75'))[_0xf33a('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x62'))[_0xf33a('0x6f')](_0xf33a('0x61'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id'][_0xf33a('0x72')]()))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x77'))['from'](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x71'),_0x3bebca[_0xf33a('0x44')]['id']['toString']())[_0xf33a('0x3b')](_0xf33a('0x78')))[_0xf33a('0x79')](_0xf33a('0x64')))[_0xf33a('0x72')]();return db[_0xf33a('0x4d')][_0xf33a('0x32')](_0x132764);}return[];})[_0xf33a('0x26')](respondWithResult(_0x40bb02,null))['catch'](handleError(_0x40bb02,null));};exports[_0xf33a('0x7a')]=function(_0x1dfb59,_0x9c0b99,_0x17b2fa){return db['Campaign']['find']({'where':{'id':_0x1dfb59[_0xf33a('0x44')]['id']}})['then'](handleEntityNotFound(_0x9c0b99,null))[_0xf33a('0x26')](function(_0x1595b7){var _0x3d8dbe;if(_0x1595b7){_0x3d8dbe=squel[_0xf33a('0x7b')]()['into']('cm_hopper')[_0xf33a('0x7c')](['phone',_0xf33a('0x63'),_0xf33a('0x64'),_0xf33a('0x65'),_0xf33a('0x7d'),_0xf33a('0x6d'),_0xf33a('0x6e')],squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x69'),_0xf33a('0x62'))[_0xf33a('0x68')](_0xf33a('0x6a'),_0xf33a('0x63'))[_0xf33a('0x68')](_0xf33a('0x6b'),_0xf33a('0x64'))['field'](_0xf33a('0x7e'),'ListId')[_0xf33a('0x68')]('ANY_VALUE(CampaignId)','CampaignId')['field'](_0xf33a('0x6a'),_0xf33a('0x6d'))['field'](_0xf33a('0x6a'),_0xf33a('0x6e'))[_0xf33a('0x6f')](_0xf33a('0x70'))[_0xf33a('0x3b')](_0xf33a('0x7f'),_0x1dfb59['params']['id'][_0xf33a('0x72')]())[_0xf33a('0x3b')]('state\x20=\x20?',_0x1dfb59[_0xf33a('0x48')][_0xf33a('0x74')][_0xf33a('0x72')]())['where'](_0xf33a('0x75'))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')]('phone')[_0xf33a('0x6f')](_0xf33a('0x61'))[_0xf33a('0x3b')](_0xf33a('0x7f'),_0x1dfb59[_0xf33a('0x44')]['id']['toString']()))[_0xf33a('0x3b')](_0xf33a('0x76'),squel[_0xf33a('0x67')]()[_0xf33a('0x68')](_0xf33a('0x77'))['from'](_0xf33a('0x70'))['where']('CampaignId\x20=\x20?',_0x1dfb59[_0xf33a('0x44')]['id']['toString']())[_0xf33a('0x3b')](_0xf33a('0x78')))['group'](_0xf33a('0x64')))[_0xf33a('0x72')]();return db[_0xf33a('0x4d')][_0xf33a('0x32')](_0x3d8dbe);}return[];})[_0xf33a('0x26')](respondWithResult(_0x9c0b99,null))[_0xf33a('0x42')](handleError(_0x9c0b99,null));};exports[_0xf33a('0x80')]=function(_0x4abd84,_0x1205d1,_0x1d83a0){return db[_0xf33a('0x81')][_0xf33a('0x82')]({'where':{'VoiceQueueId':_0x4abd84['body'][_0xf33a('0x66')],'CampaignId':_0x4abd84['body'][_0xf33a('0x7d')],'ContactId':_0x4abd84[_0xf33a('0x48')][_0xf33a('0x64')]}})[_0xf33a('0x26')](handleEntityNotFound(_0x1205d1,null))[_0xf33a('0x26')](function(_0x49c40a){if(_0x49c40a){return _0x49c40a;}return null;})[_0xf33a('0x26')](respondWithResult(_0x1205d1,null))[_0xf33a('0x42')](handleError(_0x1205d1,null));}; \ No newline at end of file +var _0xacf4=['reject','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','select','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','NOW()','CampaignId\x20=\x20?','checkContactHopper','CmHopper','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x184e5e,_0x33c5e5){var _0x3e7caa=function(_0xfc7135){while(--_0xfc7135){_0x184e5e['push'](_0x184e5e['shift']());}};_0x3e7caa(++_0x33c5e5);}(_0xacf4,0xe7));var _0x4acf=function(_0x4c2623,_0x4838bb){_0x4c2623=_0x4c2623-0x0;var _0x2be431=_0xacf4[_0x4c2623];return _0x2be431;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['CmHopperFinal'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':!![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['CmHopperFinal']['describe']()[_0x4acf('0x21')](respondWithResult(_0x2d946c,null))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x33bc52,_0x287406){if(_0x33bc52[_0x4acf('0x47')][_0x4acf('0x48')]){delete _0x33bc52[_0x4acf('0x47')][_0x4acf('0x48')];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'uniqueid':_0x33bc52[_0x4acf('0x41')]['id']}})['then'](handleEntityNotFound(_0x287406,null))[_0x4acf('0x21')](saveUpdates(_0x33bc52[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x287406,null))[_0x4acf('0x3f')](handleError(_0x287406,null));};exports[_0x4acf('0x49')]=function(_0x3cf54a,_0x2785b9,_0x2d0561){return db[_0x4acf('0x29')][_0x4acf('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x3cf54a[_0x4acf('0x41')]['id']},'attributes':[[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),_0x4acf('0x4d')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x4e')))),_0x4acf('0x4f')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x50')))),'busyContacts'],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x51')))),_0x4acf('0x52')],[db['sequelize']['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4acf('0x53')],[db['sequelize']['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x54')))),_0x4acf('0x55')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x2022,\x201,\x20null'))),_0x4acf('0x56')],[db[_0x4acf('0x4a')]['fn']('COUNT',db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal'](_0x4acf('0x57')))),_0x4acf('0x58')]]})[_0x4acf('0x21')](handleEntityNotFound(_0x2785b9,null))['then'](respondWithResult(_0x2785b9,null))[_0x4acf('0x3f')](handleError(_0x2785b9,null));};exports[_0x4acf('0x59')]=function(_0xb5bd81,_0x452ee6,_0x54b093){return db[_0x4acf('0x29')][_0x4acf('0x3d')]({'raw':![],'where':{'CampaignId':_0xb5bd81[_0x4acf('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x5a')))),_0x4acf('0x4d')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x4e')))),_0x4acf('0x4f')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x50')))),_0x4acf('0x5b')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x4acf('0x52')],[db['sequelize']['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x4acf('0x5c')))),_0x4acf('0x53')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db['sequelize'][_0x4acf('0x4c')](_0x4acf('0x5d')))),_0x4acf('0x56')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db['sequelize'][_0x4acf('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0x4acf('0x58')]]})[_0x4acf('0x21')](handleEntityNotFound(_0x452ee6,null))[_0x4acf('0x21')](respondWithResult(_0x452ee6,null))[_0x4acf('0x3f')](handleError(_0x452ee6,null));};exports[_0x4acf('0x5e')]=function(_0x173655,_0x1f2dbc,_0xc0d942){return db[_0x4acf('0x5f')][_0x4acf('0x45')]({'where':{'id':_0x173655[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x1f2dbc,null))['then'](function(_0x11f356){var _0xacca91;if(_0x11f356){_0xacca91=squel[_0x4acf('0x60')]()[_0x4acf('0x61')](_0x4acf('0x62'))[_0x4acf('0x63')]([_0x4acf('0x64'),_0x4acf('0x65'),_0x4acf('0x66'),_0x4acf('0x67'),'VoiceQueueId',_0x4acf('0x68'),_0x4acf('0x69')],squel['select']()[_0x4acf('0x6a')](_0x4acf('0x6b'),'phone')[_0x4acf('0x6a')]('NOW()','scheduledAt')[_0x4acf('0x6a')]('ANY_VALUE(ContactId)',_0x4acf('0x66'))[_0x4acf('0x6a')](_0x4acf('0x6c'),_0x4acf('0x67'))['field'](_0x4acf('0x6d'),_0x4acf('0x6e'))['field']('NOW()','createdAt')[_0x4acf('0x6a')]('NOW()',_0x4acf('0x69'))[_0x4acf('0x6f')](_0x4acf('0x70'))['where'](_0x4acf('0x71'),_0x173655[_0x4acf('0x41')]['id']['toString']())[_0x4acf('0x35')](_0x4acf('0x72'),_0x173655['body'][_0x4acf('0x73')][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x75'))[_0x4acf('0x35')](_0x4acf('0x76'),squel['select']()[_0x4acf('0x6a')]('phone')[_0x4acf('0x6f')](_0x4acf('0x62'))['where']('VoiceQueueId\x20=\x20?',_0x173655['params']['id'][_0x4acf('0x74')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x4acf('0x6a')]('calleridnum')[_0x4acf('0x6f')](_0x4acf('0x70'))[_0x4acf('0x35')](_0x4acf('0x71'),_0x173655[_0x4acf('0x41')]['id']['toString']())['where'](_0x4acf('0x77')))[_0x4acf('0x78')](_0x4acf('0x66')))[_0x4acf('0x74')]();return db[_0x4acf('0x4a')]['query'](_0xacca91);}return[];})[_0x4acf('0x21')](respondWithResult(_0x1f2dbc,null))[_0x4acf('0x3f')](handleError(_0x1f2dbc,null));};exports[_0x4acf('0x79')]=function(_0x453c6d,_0x1a82e7,_0x3d02c7){return db[_0x4acf('0x7a')]['find']({'where':{'id':_0x453c6d[_0x4acf('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a82e7,null))[_0x4acf('0x21')](function(_0x1bbe6d){var _0x2a36e2;if(_0x1bbe6d){_0x2a36e2=squel[_0x4acf('0x60')]()[_0x4acf('0x61')]('cm_hopper')[_0x4acf('0x63')](['phone',_0x4acf('0x65'),_0x4acf('0x66'),'ListId',_0x4acf('0x7b'),_0x4acf('0x68'),_0x4acf('0x69')],squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')]('ANY_VALUE(calleridnum)',_0x4acf('0x64'))['field']('NOW()',_0x4acf('0x65'))[_0x4acf('0x6a')](_0x4acf('0x7d'),_0x4acf('0x66'))['field']('ANY_VALUE(ListId)',_0x4acf('0x67'))[_0x4acf('0x6a')](_0x4acf('0x7e'),_0x4acf('0x7b'))[_0x4acf('0x6a')](_0x4acf('0x7f'),_0x4acf('0x68'))[_0x4acf('0x6a')]('NOW()','updatedAt')[_0x4acf('0x6f')](_0x4acf('0x70'))[_0x4acf('0x35')](_0x4acf('0x80'),_0x453c6d[_0x4acf('0x41')]['id'][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x72'),_0x453c6d[_0x4acf('0x47')]['state'][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x75'))[_0x4acf('0x35')](_0x4acf('0x76'),squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')](_0x4acf('0x64'))[_0x4acf('0x6f')](_0x4acf('0x62'))[_0x4acf('0x35')](_0x4acf('0x80'),_0x453c6d[_0x4acf('0x41')]['id']['toString']()))[_0x4acf('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')]('calleridnum')[_0x4acf('0x6f')](_0x4acf('0x70'))['where']('CampaignId\x20=\x20?',_0x453c6d[_0x4acf('0x41')]['id'][_0x4acf('0x74')]())['where']('state\x20=\x204'))[_0x4acf('0x78')](_0x4acf('0x66')))[_0x4acf('0x74')]();return db[_0x4acf('0x4a')]['query'](_0x2a36e2);}return[];})[_0x4acf('0x21')](respondWithResult(_0x1a82e7,null))[_0x4acf('0x3f')](handleError(_0x1a82e7,null));};exports[_0x4acf('0x81')]=function(_0x34e1ea,_0x43e9bf,_0x367ad4){return db[_0x4acf('0x82')]['findOne']({'where':{'VoiceQueueId':_0x34e1ea[_0x4acf('0x47')][_0x4acf('0x6e')],'CampaignId':_0x34e1ea[_0x4acf('0x47')]['CampaignId'],'ContactId':_0x34e1ea[_0x4acf('0x47')][_0x4acf('0x66')]}})[_0x4acf('0x21')](handleEntityNotFound(_0x43e9bf,null))[_0x4acf('0x21')](function(_0x37ffab){if(_0x37ffab){return _0x37ffab;}return null;})[_0x4acf('0x21')](respondWithResult(_0x43e9bf,null))[_0x4acf('0x3f')](handleError(_0x43e9bf,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 142795c..42e270e 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 _0xd481=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x4eb412,_0x50d384){var _0x31a53a=function(_0x169985){while(--_0x169985){_0x4eb412['push'](_0x4eb412['shift']());}};_0x31a53a(++_0x50d384);}(_0xd481,0x1b1));var _0x1d48=function(_0x3d8b16,_0x314ec3){_0x3d8b16=_0x3d8b16-0x0;var _0x352460=_0xd481[_0x3d8b16];return _0x352460;};'use strict';var _=require(_0x1d48('0x0'));var util=require(_0x1d48('0x1'));var logger=require(_0x1d48('0x2'))(_0x1d48('0x3'));var moment=require(_0x1d48('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d48('0x5'));var fs=require('fs');var path=require(_0x1d48('0x6'));var rimraf=require(_0x1d48('0x7'));var config=require(_0x1d48('0x8'));var attributes=require(_0x1d48('0x9'));module[_0x1d48('0xa')]=function(_0x39716d,_0x5619fb){return _0x39716d['define'](_0x1d48('0xb'),attributes,{'tableName':_0x1d48('0xc'),'paranoid':![],'indexes':[{'name':_0x1d48('0xd'),'fields':[_0x1d48('0xd')]},{'name':'uniqueid','fields':[_0x1d48('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf04b=['../../config/logger','bluebird','request-promise','path','rimraf','./cmHopperFinal.attributes','exports','CmHopperFinal','calleridnum','uniqueid','lodash','util'];(function(_0x1fc72c,_0x56285a){var _0x3b50b2=function(_0x3863df){while(--_0x3863df){_0x1fc72c['push'](_0x1fc72c['shift']());}};_0x3b50b2(++_0x56285a);}(_0xf04b,0xb2));var _0xbf04=function(_0x37c1e8,_0x56a79e){_0x37c1e8=_0x37c1e8-0x0;var _0xca01e5=_0xf04b[_0x37c1e8];return _0xca01e5;};'use strict';var _=require(_0xbf04('0x0'));var util=require(_0xbf04('0x1'));var logger=require(_0xbf04('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbf04('0x3'));var rp=require(_0xbf04('0x4'));var fs=require('fs');var path=require(_0xbf04('0x5'));var rimraf=require(_0xbf04('0x6'));var config=require('../../config/environment');var attributes=require(_0xbf04('0x7'));module[_0xbf04('0x8')]=function(_0x5d2452,_0x296c1e){return _0x5d2452['define'](_0xbf04('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xbf04('0xa'),'fields':[_0xbf04('0xa')]},{'name':_0xbf04('0xb'),'fields':[_0xbf04('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 3703137..6bb9945 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x3260a5,_0x451db7){var _0x1bf4b0=function(_0x15fdf8){while(--_0x15fdf8){_0x3260a5['push'](_0x3260a5['shift']());}};_0x1bf4b0(++_0x451db7);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b88f8,_0x20ae18){_0x4b88f8=_0x4b88f8-0x0;var _0x15ecc5=_0xb10b[_0x4b88f8];return _0x15ecc5;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xa5410d,_0x263e70){var _0x35a584=function(_0x55f7c4){while(--_0x55f7c4){_0xa5410d['push'](_0xa5410d['shift']());}};_0x35a584(++_0x263e70);}(_0x7a54,0x106));var _0x47a5=function(_0x3491db,_0x28d9d0){_0x3491db=_0x3491db-0x0;var _0x1f2725=_0x7a54[_0x3491db];return _0x1f2725;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index aa96572..95896e4 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 _0xae60=['moveContactsIvrCampaignHopperFinal','post','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id'];(function(_0x56223f,_0x4eba12){var _0x2892f4=function(_0xc93462){while(--_0xc93462){_0x56223f['push'](_0x56223f['shift']());}};_0x2892f4(++_0x4eba12);}(_0xae60,0x18f));var _0x0ae6=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xae60[_0x40a825];return _0x273a54;};'use strict';var multer=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var path=require(_0x0ae6('0x2'));var timeout=require(_0x0ae6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0ae6('0x4'));var auth=require(_0x0ae6('0x5'));var interaction=require(_0x0ae6('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x0ae6('0x7')](),controller[_0x0ae6('0x8')]);router[_0x0ae6('0x9')](_0x0ae6('0xa'),auth['isAuthenticated'](),controller[_0x0ae6('0xb')]);router[_0x0ae6('0x9')](_0x0ae6('0xc'),auth[_0x0ae6('0x7')](),controller[_0x0ae6('0xd')]);router[_0x0ae6('0x9')](_0x0ae6('0xe'),auth[_0x0ae6('0x7')](),controller[_0x0ae6('0xf')]);router['get'](_0x0ae6('0x10'),auth[_0x0ae6('0x7')](),controller[_0x0ae6('0x11')]);router['post'](_0x0ae6('0x12'),auth[_0x0ae6('0x7')](),controller[_0x0ae6('0x13')]);router['post'](_0x0ae6('0x14'),auth[_0x0ae6('0x7')](),controller[_0x0ae6('0x15')]);router[_0x0ae6('0x16')](_0x0ae6('0x17'),auth[_0x0ae6('0x7')](),controller[_0x0ae6('0x18')]);router[_0x0ae6('0x19')]('/:id',auth[_0x0ae6('0x7')](),controller[_0x0ae6('0x1a')]);module[_0x0ae6('0x1b')]=router; \ No newline at end of file +var _0x7d74=['moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','describe','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id'];(function(_0x578473,_0x1d5330){var _0x26f53e=function(_0x1faf91){while(--_0x1faf91){_0x578473['push'](_0x578473['shift']());}};_0x26f53e(++_0x1d5330);}(_0x7d74,0x1e2));var _0x47d7=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7d74[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x47d7('0x0'));var util=require(_0x47d7('0x1'));var path=require(_0x47d7('0x2'));var timeout=require(_0x47d7('0x3'));var express=require(_0x47d7('0x4'));var router=express[_0x47d7('0x5')]();var fs_extra=require(_0x47d7('0x6'));var auth=require(_0x47d7('0x7'));var interaction=require(_0x47d7('0x8'));var config=require('../../config/environment');var controller=require(_0x47d7('0x9'));router[_0x47d7('0xa')]('/',auth[_0x47d7('0xb')](),controller['index']);router[_0x47d7('0xa')]('/describe',auth[_0x47d7('0xb')](),controller[_0x47d7('0xc')]);router[_0x47d7('0xa')]('/:id',auth[_0x47d7('0xb')](),controller['show']);router[_0x47d7('0xa')]('/voice/queue/countAttributes/:id',auth[_0x47d7('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router['get']('/campaign/countAttributes/:id',auth[_0x47d7('0xb')](),controller[_0x47d7('0xd')]);router[_0x47d7('0xe')](_0x47d7('0xf'),auth['isAuthenticated'](),controller[_0x47d7('0x10')]);router[_0x47d7('0xe')](_0x47d7('0x11'),auth[_0x47d7('0xb')](),controller[_0x47d7('0x12')]);router[_0x47d7('0xe')](_0x47d7('0x13'),auth['isAuthenticated'](),controller[_0x47d7('0x14')]);router[_0x47d7('0x15')](_0x47d7('0x16'),auth[_0x47d7('0xb')](),controller[_0x47d7('0x17')]);module[_0x47d7('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 971f501..5a98b87 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 _0xa971=['STRING','INTEGER','DATE','BOOLEAN','sequelize','exports'];(function(_0x59ad2a,_0x5c77b9){var _0x24f356=function(_0x30e24b){while(--_0x30e24b){_0x59ad2a['push'](_0x59ad2a['shift']());}};_0x24f356(++_0x5c77b9);}(_0xa971,0x9a));var _0x1a97=function(_0xabe893,_0x1fd72e){_0xabe893=_0xabe893-0x0;var _0x1b530c=_0xa971[_0xabe893];return _0x1b530c;};'use strict';var Sequelize=require(_0x1a97('0x0'));module[_0x1a97('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x1a97('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1a97('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1a97('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x1a97('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1a97('0x2')]},'calleridname':{'type':Sequelize[_0x1a97('0x2')]},'starttime':{'type':Sequelize[_0x1a97('0x4')]},'responsetime':{'type':Sequelize[_0x1a97('0x4')]},'answertime':{'type':Sequelize[_0x1a97('0x4')]},'droptime':{'type':Sequelize[_0x1a97('0x4')]},'endtime':{'type':Sequelize[_0x1a97('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1a97('0x2')]},'campaign':{'type':Sequelize[_0x1a97('0x2')]},'campaigntype':{'type':Sequelize[_0x1a97('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x1a97('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1a97('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x1a97('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x1a97('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1a97('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1a97('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1a97('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1a97('0x2')]}}; \ No newline at end of file +var _0x158a=['BOOLEAN','sequelize','INTEGER','DATE','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x158a,0xdd));var _0xa158=function(_0x1e064d,_0x4a94ab){_0x1e064d=_0x1e064d-0x0;var _0x33d2e4=_0x158a[_0x1e064d];return _0x33d2e4;};'use strict';var Sequelize=require(_0xa158('0x0'));module['exports']={'state':{'type':Sequelize[_0xa158('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xa158('0x2')]},'countbusyretry':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa158('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xa158('0x3')]},'originatecalleridname':{'type':Sequelize[_0xa158('0x3')]},'calleridnum':{'type':Sequelize[_0xa158('0x3')]},'calleridname':{'type':Sequelize[_0xa158('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xa158('0x2')]},'answertime':{'type':Sequelize[_0xa158('0x2')]},'droptime':{'type':Sequelize[_0xa158('0x2')]},'endtime':{'type':Sequelize[_0xa158('0x2')]},'ringtime':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa158('0x3')]},'campaign':{'type':Sequelize[_0xa158('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xa158('0x3')]},'reason':{'type':Sequelize[_0xa158('0x3')]},'amd':{'type':Sequelize[_0xa158('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xa158('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa158('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa158('0x2')]},'recallme':{'type':Sequelize[_0xa158('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xa158('0x2')]},'edited':{'type':Sequelize[_0xa158('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa158('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa158('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a933f17..1db8274 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 _0x0d51=['CmHopperHistory','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','create','body','describe','uniqueid','find','rimraf','zip-dir','fast-json-patch','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','offset','limit','undefined','count','Content-Range','apply','save','update','destroy','then','error','name','index','map'];(function(_0x109451,_0x318266){var _0xe2a21c=function(_0x5dc2a9){while(--_0x5dc2a9){_0x109451['push'](_0x109451['shift']());}};_0xe2a21c(++_0x318266);}(_0x0d51,0xbf));var _0x10d5=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x0d51[_0x403c20];return _0x2b271a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x10d5('0x0'));var zipdir=require(_0x10d5('0x1'));var jsonpatch=require(_0x10d5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x10d5('0x3'));var path=require(_0x10d5('0x4'));var sox=require(_0x10d5('0x5'));var csv=require(_0x10d5('0x6'));var ejs=require(_0x10d5('0x7'));var fs=require('fs');var fs_extra=require(_0x10d5('0x8'));var _=require(_0x10d5('0x9'));var squel=require(_0x10d5('0xa'));var crypto=require(_0x10d5('0xb'));var jsforce=require(_0x10d5('0xc'));var deskjs=require(_0x10d5('0xd'));var toCsv=require(_0x10d5('0x6'));var querystring=require(_0x10d5('0xe'));var Papa=require(_0x10d5('0xf'));var Redis=require(_0x10d5('0x10'));var authService=require(_0x10d5('0x11'));var qs=require(_0x10d5('0x12'));var as=require(_0x10d5('0x13'));var hardwareService=require(_0x10d5('0x14'));var logger=require(_0x10d5('0x15'))(_0x10d5('0x16'));var utils=require('../../config/utils');var config=require(_0x10d5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x10d5('0x18'))['db'];function respondWithStatusCode(_0x57193e,_0x230316){_0x230316=_0x230316||0xcc;return function(_0x34bee3){if(_0x34bee3){return _0x57193e[_0x10d5('0x19')](_0x230316);}return _0x57193e[_0x10d5('0x1a')](_0x230316)[_0x10d5('0x1b')]();};}function respondWithResult(_0x4a21f0,_0x434391){_0x434391=_0x434391||0xc8;return function(_0x38ce1a){if(_0x38ce1a){return _0x4a21f0['status'](_0x434391)[_0x10d5('0x1c')](_0x38ce1a);}};}function respondWithFilteredResult(_0xa68e32,_0x522010){return function(_0xde2d8d){if(_0xde2d8d){var _0x5d92ce=typeof _0x522010[_0x10d5('0x1d')]==='undefined'&&typeof _0x522010[_0x10d5('0x1e')]===_0x10d5('0x1f');var _0x44c943=_0xde2d8d[_0x10d5('0x20')];var _0x4ccb31=_0x5d92ce?0x0:_0x522010[_0x10d5('0x1d')];var _0x35a66c=_0x5d92ce?_0xde2d8d[_0x10d5('0x20')]:_0x522010['offset']+_0x522010[_0x10d5('0x1e')];var _0x3069e6;if(_0x35a66c>=_0x44c943){_0x35a66c=_0x44c943;_0x3069e6=0xc8;}else{_0x3069e6=0xce;}_0xa68e32[_0x10d5('0x1a')](_0x3069e6);return _0xa68e32['set'](_0x10d5('0x21'),_0x4ccb31+'-'+_0x35a66c+'/'+_0x44c943)['json'](_0xde2d8d);}return null;};}function patchUpdates(_0x112eee){return function(_0x30d05f){try{jsonpatch[_0x10d5('0x22')](_0x30d05f,_0x112eee,!![]);}catch(_0x3d50f9){return BPromise['reject'](_0x3d50f9);}return _0x30d05f[_0x10d5('0x23')]();};}function saveUpdates(_0x334467,_0x3e3405){return function(_0x3c4532){if(_0x3c4532){return _0x3c4532[_0x10d5('0x24')](_0x334467)['then'](function(_0x2f3f25){return _0x2f3f25;});}return null;};}function removeEntity(_0x354e18,_0x2d3989){return function(_0x43fbd9){if(_0x43fbd9){return _0x43fbd9[_0x10d5('0x25')]()[_0x10d5('0x26')](function(){_0x354e18['status'](0xcc)[_0x10d5('0x1b')]();});}};}function handleEntityNotFound(_0x2f2f77,_0x5d08ad){return function(_0x7ba24e){if(!_0x7ba24e){_0x2f2f77[_0x10d5('0x19')](0x194);}return _0x7ba24e;};}function handleError(_0x31864d,_0xc779e5){_0xc779e5=_0xc779e5||0x1f4;return function(_0xefdaf0){logger[_0x10d5('0x27')](_0xefdaf0['stack']);if(_0xefdaf0['name']){delete _0xefdaf0[_0x10d5('0x28')];}_0x31864d[_0x10d5('0x1a')](_0xc779e5)['send'](_0xefdaf0);};}exports[_0x10d5('0x29')]=function(_0x12b178,_0x28d7a4){var _0x598323={},_0x250216={},_0x4ff3bb={'count':0x0,'rows':[]};var _0x2a3832=_[_0x10d5('0x2a')](db[_0x10d5('0x2b')]['rawAttributes'],function(_0x5dc0f6){return{'name':_0x5dc0f6[_0x10d5('0x2c')],'type':_0x5dc0f6[_0x10d5('0x2d')][_0x10d5('0x2e')]};});_0x250216['model']=_[_0x10d5('0x2a')](_0x2a3832,_0x10d5('0x28'));_0x250216[_0x10d5('0x2f')]=_['keys'](_0x12b178['query']);_0x250216['filters']=_[_0x10d5('0x30')](_0x250216['model'],_0x250216[_0x10d5('0x2f')]);_0x598323[_0x10d5('0x31')]=_[_0x10d5('0x30')](_0x250216[_0x10d5('0x32')],qs['fields'](_0x12b178[_0x10d5('0x2f')][_0x10d5('0x33')]));_0x598323[_0x10d5('0x31')]=_0x598323[_0x10d5('0x31')][_0x10d5('0x34')]?_0x598323[_0x10d5('0x31')]:_0x250216[_0x10d5('0x32')];if(!_0x12b178[_0x10d5('0x2f')][_0x10d5('0x35')](_0x10d5('0x36'))){_0x598323[_0x10d5('0x1e')]=qs['limit'](_0x12b178['query']['limit']);_0x598323[_0x10d5('0x1d')]=qs[_0x10d5('0x1d')](_0x12b178[_0x10d5('0x2f')][_0x10d5('0x1d')]);}_0x598323[_0x10d5('0x37')]=qs[_0x10d5('0x38')](_0x12b178[_0x10d5('0x2f')][_0x10d5('0x38')]);_0x598323[_0x10d5('0x39')]=qs[_0x10d5('0x3a')](_[_0x10d5('0x3b')](_0x12b178[_0x10d5('0x2f')],_0x250216[_0x10d5('0x3a')]),_0x2a3832);if(_0x12b178[_0x10d5('0x2f')][_0x10d5('0x3c')]){_0x598323[_0x10d5('0x39')]=_[_0x10d5('0x3d')](_0x598323[_0x10d5('0x39')],{'$or':_[_0x10d5('0x2a')](_0x2a3832,function(_0x229d76){if(_0x229d76[_0x10d5('0x2d')]!==_0x10d5('0x3e')){var _0x1f4314={};_0x1f4314[_0x229d76[_0x10d5('0x28')]]={'$like':'%'+_0x12b178[_0x10d5('0x2f')]['filter']+'%'};return _0x1f4314;}})});}_0x598323=_[_0x10d5('0x3d')]({},_0x598323,_0x12b178[_0x10d5('0x3f')]);var _0x40ed94={'where':_0x598323[_0x10d5('0x39')]};return db['CmHopperHistory']['count'](_0x40ed94)[_0x10d5('0x26')](function(_0x4436c8){_0x4ff3bb[_0x10d5('0x20')]=_0x4436c8;if(_0x12b178['query'][_0x10d5('0x40')]){_0x598323[_0x10d5('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x10d5('0x42')](_0x598323);})['then'](function(_0x597627){_0x4ff3bb[_0x10d5('0x43')]=_0x597627;return _0x4ff3bb;})[_0x10d5('0x26')](respondWithFilteredResult(_0x28d7a4,_0x598323))[_0x10d5('0x44')](handleError(_0x28d7a4,null));};exports[_0x10d5('0x45')]=function(_0x44a6c3,_0x164b54){var _0x313d99={'raw':!![],'where':{'id':_0x44a6c3[_0x10d5('0x46')]['id']}},_0x4133c9={};_0x4133c9['model']=_['keys'](db[_0x10d5('0x2b')][_0x10d5('0x47')]);_0x4133c9[_0x10d5('0x2f')]=_[_0x10d5('0x48')](_0x44a6c3[_0x10d5('0x2f')]);_0x4133c9[_0x10d5('0x3a')]=_[_0x10d5('0x30')](_0x4133c9[_0x10d5('0x32')],_0x4133c9[_0x10d5('0x2f')]);_0x313d99['attributes']=_[_0x10d5('0x30')](_0x4133c9[_0x10d5('0x32')],qs[_0x10d5('0x33')](_0x44a6c3[_0x10d5('0x2f')][_0x10d5('0x33')]));_0x313d99[_0x10d5('0x31')]=_0x313d99[_0x10d5('0x31')][_0x10d5('0x34')]?_0x313d99[_0x10d5('0x31')]:_0x4133c9[_0x10d5('0x32')];if(_0x44a6c3[_0x10d5('0x2f')][_0x10d5('0x40')]){_0x313d99[_0x10d5('0x41')]=[{'all':!![]}];}_0x313d99=_['merge']({},_0x313d99,_0x44a6c3[_0x10d5('0x3f')]);return db[_0x10d5('0x2b')]['find'](_0x313d99)[_0x10d5('0x26')](handleEntityNotFound(_0x164b54,null))[_0x10d5('0x26')](respondWithResult(_0x164b54,null))[_0x10d5('0x44')](handleError(_0x164b54,null));};exports[_0x10d5('0x49')]=function(_0x3b7a10,_0x6d550d){return db[_0x10d5('0x2b')][_0x10d5('0x49')](_0x3b7a10[_0x10d5('0x4a')],{})[_0x10d5('0x26')](respondWithResult(_0x6d550d,0xc9))[_0x10d5('0x44')](handleError(_0x6d550d,null));};exports[_0x10d5('0x4b')]=function(_0x1c3c86,_0x34f507){return db['CmHopperHistory']['describe']()[_0x10d5('0x26')](respondWithResult(_0x34f507,null))[_0x10d5('0x44')](handleError(_0x34f507,null));};exports['update']=function(_0xa003d,_0x3210c6){if(_0xa003d[_0x10d5('0x4a')]['uniqueid']){delete _0xa003d[_0x10d5('0x4a')][_0x10d5('0x4c')];}return db[_0x10d5('0x2b')][_0x10d5('0x4d')]({'where':{'uniqueid':_0xa003d[_0x10d5('0x46')]['id']}})['then'](handleEntityNotFound(_0x3210c6,null))['then'](saveUpdates(_0xa003d[_0x10d5('0x4a')],null))[_0x10d5('0x26')](respondWithResult(_0x3210c6,null))[_0x10d5('0x44')](handleError(_0x3210c6,null));}; \ No newline at end of file +var _0xd4d0=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CmHopperHistory','then','include','rows','show','params','keys','rawAttributes','includeAll','catch','create','body','describe','update','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x5614cd,_0x5d6c18){var _0x4ca444=function(_0x3f5877){while(--_0x3f5877){_0x5614cd['push'](_0x5614cd['shift']());}};_0x4ca444(++_0x5d6c18);}(_0xd4d0,0x170));var _0x0d4d=function(_0x9ff648,_0x32f221){_0x9ff648=_0x9ff648-0x0;var _0x352c34=_0xd4d0[_0x9ff648];return _0x352c34;};'use strict';var emlformat=require(_0x0d4d('0x0'));var rimraf=require(_0x0d4d('0x1'));var zipdir=require(_0x0d4d('0x2'));var jsonpatch=require(_0x0d4d('0x3'));var rp=require('request-promise');var moment=require(_0x0d4d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0d4d('0x5'));var util=require(_0x0d4d('0x6'));var path=require(_0x0d4d('0x7'));var sox=require('sox');var csv=require(_0x0d4d('0x8'));var ejs=require(_0x0d4d('0x9'));var fs=require('fs');var fs_extra=require(_0x0d4d('0xa'));var _=require('lodash');var squel=require(_0x0d4d('0xb'));var crypto=require(_0x0d4d('0xc'));var jsforce=require(_0x0d4d('0xd'));var deskjs=require(_0x0d4d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0d4d('0xf'));var Papa=require(_0x0d4d('0x10'));var Redis=require('ioredis');var authService=require(_0x0d4d('0x11'));var qs=require(_0x0d4d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d4d('0x13'));var logger=require('../../config/logger')(_0x0d4d('0x14'));var utils=require('../../config/utils');var config=require(_0x0d4d('0x15'));var licenseUtil=require(_0x0d4d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x403541,_0x1f6c78){_0x1f6c78=_0x1f6c78||0xcc;return function(_0x382d4b){if(_0x382d4b){return _0x403541[_0x0d4d('0x17')](_0x1f6c78);}return _0x403541[_0x0d4d('0x18')](_0x1f6c78)[_0x0d4d('0x19')]();};}function respondWithResult(_0x414c51,_0x2bc2f4){_0x2bc2f4=_0x2bc2f4||0xc8;return function(_0x1e68b5){if(_0x1e68b5){return _0x414c51[_0x0d4d('0x18')](_0x2bc2f4)[_0x0d4d('0x1a')](_0x1e68b5);}};}function respondWithFilteredResult(_0x22245b,_0x3eb7c2){return function(_0x202215){if(_0x202215){var _0x389833=typeof _0x3eb7c2['offset']==='undefined'&&typeof _0x3eb7c2[_0x0d4d('0x1b')]===_0x0d4d('0x1c');var _0x1cdce9=_0x202215[_0x0d4d('0x1d')];var _0x389076=_0x389833?0x0:_0x3eb7c2[_0x0d4d('0x1e')];var _0x489007=_0x389833?_0x202215[_0x0d4d('0x1d')]:_0x3eb7c2[_0x0d4d('0x1e')]+_0x3eb7c2[_0x0d4d('0x1b')];var _0x57f6f8;if(_0x489007>=_0x1cdce9){_0x489007=_0x1cdce9;_0x57f6f8=0xc8;}else{_0x57f6f8=0xce;}_0x22245b[_0x0d4d('0x18')](_0x57f6f8);return _0x22245b['set'](_0x0d4d('0x1f'),_0x389076+'-'+_0x489007+'/'+_0x1cdce9)[_0x0d4d('0x1a')](_0x202215);}return null;};}function patchUpdates(_0x241f0d){return function(_0x2c1cf0){try{jsonpatch[_0x0d4d('0x20')](_0x2c1cf0,_0x241f0d,!![]);}catch(_0x4cd0df){return BPromise[_0x0d4d('0x21')](_0x4cd0df);}return _0x2c1cf0[_0x0d4d('0x22')]();};}function saveUpdates(_0x32d463,_0x53be2b){return function(_0x5bbb03){if(_0x5bbb03){return _0x5bbb03['update'](_0x32d463)['then'](function(_0x5bf09f){return _0x5bf09f;});}return null;};}function removeEntity(_0x2bc06f,_0x22ebfd){return function(_0x1cbdc9){if(_0x1cbdc9){return _0x1cbdc9[_0x0d4d('0x23')]()['then'](function(){_0x2bc06f[_0x0d4d('0x18')](0xcc)[_0x0d4d('0x19')]();});}};}function handleEntityNotFound(_0x5ea252,_0x35c36c){return function(_0x16897e){if(!_0x16897e){_0x5ea252[_0x0d4d('0x17')](0x194);}return _0x16897e;};}function handleError(_0x345b2d,_0x59f2c2){_0x59f2c2=_0x59f2c2||0x1f4;return function(_0x3746e6){logger[_0x0d4d('0x24')](_0x3746e6[_0x0d4d('0x25')]);if(_0x3746e6['name']){delete _0x3746e6[_0x0d4d('0x26')];}_0x345b2d[_0x0d4d('0x18')](_0x59f2c2)[_0x0d4d('0x27')](_0x3746e6);};}exports[_0x0d4d('0x28')]=function(_0x588ec9,_0x2acb93){var _0x3008a5={},_0x1b4527={},_0xdf96c8={'count':0x0,'rows':[]};var _0x9dfcd=_[_0x0d4d('0x29')](db['CmHopperHistory']['rawAttributes'],function(_0x555e76){return{'name':_0x555e76[_0x0d4d('0x2a')],'type':_0x555e76[_0x0d4d('0x2b')][_0x0d4d('0x2c')]};});_0x1b4527[_0x0d4d('0x2d')]=_[_0x0d4d('0x29')](_0x9dfcd,_0x0d4d('0x26'));_0x1b4527['query']=_['keys'](_0x588ec9[_0x0d4d('0x2e')]);_0x1b4527[_0x0d4d('0x2f')]=_[_0x0d4d('0x30')](_0x1b4527['model'],_0x1b4527[_0x0d4d('0x2e')]);_0x3008a5[_0x0d4d('0x31')]=_['intersection'](_0x1b4527[_0x0d4d('0x2d')],qs[_0x0d4d('0x32')](_0x588ec9[_0x0d4d('0x2e')]['fields']));_0x3008a5[_0x0d4d('0x31')]=_0x3008a5[_0x0d4d('0x31')][_0x0d4d('0x33')]?_0x3008a5[_0x0d4d('0x31')]:_0x1b4527[_0x0d4d('0x2d')];if(!_0x588ec9[_0x0d4d('0x2e')][_0x0d4d('0x34')](_0x0d4d('0x35'))){_0x3008a5[_0x0d4d('0x1b')]=qs[_0x0d4d('0x1b')](_0x588ec9[_0x0d4d('0x2e')][_0x0d4d('0x1b')]);_0x3008a5[_0x0d4d('0x1e')]=qs[_0x0d4d('0x1e')](_0x588ec9[_0x0d4d('0x2e')][_0x0d4d('0x1e')]);}_0x3008a5[_0x0d4d('0x36')]=qs[_0x0d4d('0x37')](_0x588ec9['query'][_0x0d4d('0x37')]);_0x3008a5[_0x0d4d('0x38')]=qs['filters'](_['pick'](_0x588ec9[_0x0d4d('0x2e')],_0x1b4527[_0x0d4d('0x2f')]),_0x9dfcd);if(_0x588ec9[_0x0d4d('0x2e')][_0x0d4d('0x39')]){_0x3008a5[_0x0d4d('0x38')]=_[_0x0d4d('0x3a')](_0x3008a5[_0x0d4d('0x38')],{'$or':_['map'](_0x9dfcd,function(_0x57f1bd){if(_0x57f1bd[_0x0d4d('0x2b')]!==_0x0d4d('0x3b')){var _0x3232af={};_0x3232af[_0x57f1bd[_0x0d4d('0x26')]]={'$like':'%'+_0x588ec9['query'][_0x0d4d('0x39')]+'%'};return _0x3232af;}})});}_0x3008a5=_[_0x0d4d('0x3a')]({},_0x3008a5,_0x588ec9[_0x0d4d('0x3c')]);var _0x1c617a={'where':_0x3008a5['where']};return db[_0x0d4d('0x3d')]['count'](_0x1c617a)[_0x0d4d('0x3e')](function(_0x1da6bd){_0xdf96c8[_0x0d4d('0x1d')]=_0x1da6bd;if(_0x588ec9[_0x0d4d('0x2e')]['includeAll']){_0x3008a5[_0x0d4d('0x3f')]=[{'all':!![]}];}return db[_0x0d4d('0x3d')]['findAll'](_0x3008a5);})[_0x0d4d('0x3e')](function(_0x25fe78){_0xdf96c8[_0x0d4d('0x40')]=_0x25fe78;return _0xdf96c8;})[_0x0d4d('0x3e')](respondWithFilteredResult(_0x2acb93,_0x3008a5))['catch'](handleError(_0x2acb93,null));};exports[_0x0d4d('0x41')]=function(_0x31e040,_0x18bf46){var _0x3879bd={'raw':!![],'where':{'id':_0x31e040[_0x0d4d('0x42')]['id']}},_0x377567={};_0x377567[_0x0d4d('0x2d')]=_[_0x0d4d('0x43')](db['CmHopperHistory'][_0x0d4d('0x44')]);_0x377567[_0x0d4d('0x2e')]=_[_0x0d4d('0x43')](_0x31e040[_0x0d4d('0x2e')]);_0x377567['filters']=_['intersection'](_0x377567[_0x0d4d('0x2d')],_0x377567[_0x0d4d('0x2e')]);_0x3879bd[_0x0d4d('0x31')]=_[_0x0d4d('0x30')](_0x377567[_0x0d4d('0x2d')],qs[_0x0d4d('0x32')](_0x31e040['query']['fields']));_0x3879bd[_0x0d4d('0x31')]=_0x3879bd[_0x0d4d('0x31')]['length']?_0x3879bd['attributes']:_0x377567[_0x0d4d('0x2d')];if(_0x31e040['query'][_0x0d4d('0x45')]){_0x3879bd['include']=[{'all':!![]}];}_0x3879bd=_[_0x0d4d('0x3a')]({},_0x3879bd,_0x31e040[_0x0d4d('0x3c')]);return db[_0x0d4d('0x3d')]['find'](_0x3879bd)[_0x0d4d('0x3e')](handleEntityNotFound(_0x18bf46,null))['then'](respondWithResult(_0x18bf46,null))[_0x0d4d('0x46')](handleError(_0x18bf46,null));};exports[_0x0d4d('0x47')]=function(_0x1dfe45,_0x2daee4){return db['CmHopperHistory'][_0x0d4d('0x47')](_0x1dfe45[_0x0d4d('0x48')],{})[_0x0d4d('0x3e')](respondWithResult(_0x2daee4,0xc9))[_0x0d4d('0x46')](handleError(_0x2daee4,null));};exports['describe']=function(_0x50f874,_0x2c4f2d){return db[_0x0d4d('0x3d')][_0x0d4d('0x49')]()[_0x0d4d('0x3e')](respondWithResult(_0x2c4f2d,null))[_0x0d4d('0x46')](handleError(_0x2c4f2d,null));};exports[_0x0d4d('0x4a')]=function(_0xe66ef1,_0x2535db){if(_0xe66ef1[_0x0d4d('0x48')][_0x0d4d('0x4b')]){delete _0xe66ef1['body'][_0x0d4d('0x4b')];}return db[_0x0d4d('0x3d')][_0x0d4d('0x4c')]({'where':{'uniqueid':_0xe66ef1['params']['id']}})[_0x0d4d('0x3e')](handleEntityNotFound(_0x2535db,null))[_0x0d4d('0x3e')](saveUpdates(_0xe66ef1[_0x0d4d('0x48')],null))[_0x0d4d('0x3e')](respondWithResult(_0x2535db,null))[_0x0d4d('0x46')](handleError(_0x2535db,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b0699f2..82a6763 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 _0x7d14=['./cmHopperHistory.attributes','exports','cm_hopper_history','endtime','uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x329f42,_0x2de7e7){var _0x3618f0=function(_0xf18f87){while(--_0xf18f87){_0x329f42['push'](_0x329f42['shift']());}};_0x3618f0(++_0x2de7e7);}(_0x7d14,0x6d));var _0x47d1=function(_0x29d976,_0x652e0){_0x29d976=_0x29d976-0x0;var _0xeca83=_0x7d14[_0x29d976];return _0xeca83;};'use strict';var _=require(_0x47d1('0x0'));var util=require(_0x47d1('0x1'));var logger=require('../../config/logger')(_0x47d1('0x2'));var moment=require(_0x47d1('0x3'));var BPromise=require(_0x47d1('0x4'));var rp=require(_0x47d1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x47d1('0x6'));var config=require(_0x47d1('0x7'));var attributes=require(_0x47d1('0x8'));module[_0x47d1('0x9')]=function(_0x1b2f47,_0x550ee2){return _0x1b2f47['define']('CmHopperHistory',attributes,{'tableName':_0x47d1('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x47d1('0xb')]},{'name':_0x47d1('0xc'),'fields':[_0x47d1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1751=['exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes'];(function(_0x531c39,_0x499775){var _0x955259=function(_0x1a18fc){while(--_0x1a18fc){_0x531c39['push'](_0x531c39['shift']());}};_0x955259(++_0x499775);}(_0x1751,0x76));var _0x1175=function(_0x49a555,_0x4dd64f){_0x49a555=_0x49a555-0x0;var _0x311982=_0x1751[_0x49a555];return _0x311982;};'use strict';var _=require(_0x1175('0x0'));var util=require(_0x1175('0x1'));var logger=require(_0x1175('0x2'))(_0x1175('0x3'));var moment=require('moment');var BPromise=require(_0x1175('0x4'));var rp=require(_0x1175('0x5'));var fs=require('fs');var path=require(_0x1175('0x6'));var rimraf=require(_0x1175('0x7'));var config=require(_0x1175('0x8'));var attributes=require(_0x1175('0x9'));module[_0x1175('0xa')]=function(_0x171756,_0x3f99ca){return _0x171756[_0x1175('0xb')](_0x1175('0xc'),attributes,{'tableName':_0x1175('0xd'),'paranoid':![],'indexes':[{'name':_0x1175('0xe'),'fields':[_0x1175('0xe')]},{'name':_0x1175('0xf'),'fields':[_0x1175('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index f6e42ee..a4693ae 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 _0xbf5c=['request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','info','GetVoiceQueueHopperHistory','campaign','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','outboundReCallsDay','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s'];(function(_0x167a24,_0x99153f){var _0x3f467f=function(_0x5ee157){while(--_0x5ee157){_0x167a24['push'](_0x167a24['shift']());}};_0x3f467f(++_0x99153f);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x409e3b,_0x22e7e6){_0x409e3b=_0x409e3b-0x0;var _0x51801a=_0xbf5c[_0x409e3b];return _0x51801a;};'use strict';var _=require(_0xcbf5('0x0'));var util=require(_0xcbf5('0x1'));var moment=require(_0xcbf5('0x2'));var BPromise=require('bluebird');var rs=require(_0xcbf5('0x3'));var fs=require('fs');var Redis=require(_0xcbf5('0x4'));var db=require(_0xcbf5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbf5('0x6'))(_0xcbf5('0x7'));var config=require('../../config/environment');var jayson=require(_0xcbf5('0x8'));var client=jayson[_0xcbf5('0x9')][_0xcbf5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x522014,_0x4504dd,_0x31b6d1){return new BPromise(function(_0x54d2d4,_0x52f784){return client[_0xcbf5('0xb')](_0x522014,_0x31b6d1)[_0xcbf5('0xc')](function(_0x230a6c){logger['info'](_0xcbf5('0xd'),_0x4504dd,_0xcbf5('0xe'));logger[_0xcbf5('0xf')](_0xcbf5('0x10'),_0x4504dd,_0xcbf5('0xe'),JSON[_0xcbf5('0x11')](_0x230a6c));if(_0x230a6c['error']){if(_0x230a6c[_0xcbf5('0x12')][_0xcbf5('0x13')]===0x1f4){logger[_0xcbf5('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x4504dd,_0x230a6c['error'][_0xcbf5('0x14')]);return _0x52f784(_0x230a6c['error'][_0xcbf5('0x14')]);}logger[_0xcbf5('0x12')](_0xcbf5('0xd'),_0x4504dd,_0x230a6c[_0xcbf5('0x12')]['message']);return _0x54d2d4(_0x230a6c['error'][_0xcbf5('0x14')]);}else{logger['info'](_0xcbf5('0xd'),_0x4504dd,'request\x20sent');_0x54d2d4(_0x230a6c['result'][_0xcbf5('0x14')]);}})[_0xcbf5('0x15')](function(_0x18753e){logger[_0xcbf5('0x12')](_0xcbf5('0xd'),_0x4504dd,_0x18753e);_0x52f784(_0x18753e);});});}exports[_0xcbf5('0x16')]=function(_0x462d46){var _0x53939d=this;return new Promise(function(_0xcf3d18,_0x10d573){return db[_0xcbf5('0x17')][_0xcbf5('0x18')](_0x462d46[_0xcbf5('0x19')],{'raw':_0x462d46[_0xcbf5('0x1a')]?_0x462d46[_0xcbf5('0x1a')][_0xcbf5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x155147){logger['info'](_0xcbf5('0x16'),_0x462d46);logger['debug'](_0xcbf5('0x16'),_0x462d46,JSON[_0xcbf5('0x11')](_0x155147));_0xcf3d18(_0x155147);})[_0xcbf5('0x15')](function(_0xf2360){logger[_0xcbf5('0x12')](_0xcbf5('0x16'),_0xf2360['message'],_0x462d46);_0x10d573(_0x53939d[_0xcbf5('0x12')](0x1f4,_0xf2360['message']));});});};exports[_0xcbf5('0x1c')]=function(_0x1b59d4){var _0x26477c=this;return new Promise(function(_0x27558a,_0x4c8d12){return db[_0xcbf5('0x17')][_0xcbf5('0x1d')]({'raw':_0x1b59d4[_0xcbf5('0x1a')]?_0x1b59d4[_0xcbf5('0x1a')][_0xcbf5('0x1b')]===undefined?!![]:![]:!![],'where':_0x1b59d4[_0xcbf5('0x1a')]?_0x1b59d4[_0xcbf5('0x1a')][_0xcbf5('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0xcbf5('0x1f'),db[_0xcbf5('0x20')][_0xcbf5('0x21')]('id')),_0xcbf5('0x22')],[db[_0xcbf5('0x20')]['fn']('COUNT',db[_0xcbf5('0x20')]['fn']('IF',db[_0xcbf5('0x20')][_0xcbf5('0x23')](_0xcbf5('0x24')))),_0xcbf5('0x25')],[db[_0xcbf5('0x20')]['fn']('COUNT',db[_0xcbf5('0x20')]['fn']('IF',db[_0xcbf5('0x20')][_0xcbf5('0x23')](_0xcbf5('0x26')))),_0xcbf5('0x27')],[db[_0xcbf5('0x20')]['fn'](_0xcbf5('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0xcbf5('0x23')]('`state`\x20=\x2011,\x201,\x20null'))),_0xcbf5('0x28')],[db[_0xcbf5('0x20')]['fn'](_0xcbf5('0x29'),db[_0xcbf5('0x20')]['fn']('IF',db[_0xcbf5('0x20')]['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xcbf5('0x2a')],[db[_0xcbf5('0x20')]['fn'](_0xcbf5('0x29'),db[_0xcbf5('0x20')]['fn']('IF',db[_0xcbf5('0x20')][_0xcbf5('0x23')](_0xcbf5('0x2b')))),'predictiveIntervalAvgTalktime']]})[_0xcbf5('0xc')](function(_0x755cb2){logger[_0xcbf5('0x2c')](_0xcbf5('0x1c'),_0x1b59d4);logger['debug'](_0xcbf5('0x1c'),_0x1b59d4,JSON[_0xcbf5('0x11')](_0x755cb2));_0x27558a(_0x755cb2);})['catch'](function(_0x31c5ca){logger[_0xcbf5('0x12')]('AvgHandleTime',_0x31c5ca['message'],_0x1b59d4);_0x4c8d12(_0x26477c[_0xcbf5('0x12')](0x1f4,_0x31c5ca[_0xcbf5('0x14')]));});});};exports[_0xcbf5('0x2d')]=function(_0xb3df4e){var _0x5f5368=this;return new Promise(function(_0x45c654,_0x3c70e6){return db[_0xcbf5('0x17')][_0xcbf5('0x1d')]({'raw':_0xb3df4e['options']?_0xb3df4e[_0xcbf5('0x1a')][_0xcbf5('0x1b')]===undefined?!![]:![]:!![],'where':_0xb3df4e['options']?_0xb3df4e['options'][_0xcbf5('0x1e')]||null:null,'attributes':[[_0xcbf5('0x2e'),'name'],[db[_0xcbf5('0x20')]['fn'](_0xcbf5('0x1f'),db[_0xcbf5('0x20')]['fn']('IF',db[_0xcbf5('0x20')][_0xcbf5('0x23')]('`state`\x20=\x200,\x201,\x20null'))),_0xcbf5('0x2f')],[db[_0xcbf5('0x20')]['fn']('COUNT',db[_0xcbf5('0x20')]['fn']('IF',db['sequelize'][_0xcbf5('0x23')]('`state`\x20=\x203,\x201,\x20null'))),_0xcbf5('0x30')],[db[_0xcbf5('0x20')]['fn'](_0xcbf5('0x1f'),db['sequelize']['fn']('IF',db[_0xcbf5('0x20')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0xcbf5('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcbf5('0x20')][_0xcbf5('0x23')]('`state`\x20=\x205,\x201,\x20null'))),_0xcbf5('0x31')],[db['sequelize']['fn'](_0xcbf5('0x1f'),db[_0xcbf5('0x20')]['fn']('IF',db[_0xcbf5('0x20')][_0xcbf5('0x23')](_0xcbf5('0x32')))),_0xcbf5('0x33')],[db[_0xcbf5('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xcbf5('0x23')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xcbf5('0x34')],[db[_0xcbf5('0x20')]['fn'](_0xcbf5('0x1f'),db[_0xcbf5('0x20')]['fn']('IF',db[_0xcbf5('0x20')][_0xcbf5('0x23')](_0xcbf5('0x35')))),_0xcbf5('0x36')],[db[_0xcbf5('0x20')]['fn'](_0xcbf5('0x1f'),db[_0xcbf5('0x20')]['fn']('IF',db[_0xcbf5('0x20')][_0xcbf5('0x23')](_0xcbf5('0x37')))),'outboundUnknownCallsDay'],[db[_0xcbf5('0x20')]['fn']('COUNT',db[_0xcbf5('0x20')]['fn']('IF',db[_0xcbf5('0x20')][_0xcbf5('0x23')](_0xcbf5('0x38')))),_0xcbf5('0x39')],[db[_0xcbf5('0x20')]['fn'](_0xcbf5('0x1f'),db[_0xcbf5('0x20')]['fn']('IF',db['sequelize']['literal'](_0xcbf5('0x3a')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0xcbf5('0x1f'),db[_0xcbf5('0x20')]['fn']('IF',db[_0xcbf5('0x20')]['literal'](_0xcbf5('0x3b')))),'outboundRejectCallsDay'],[db[_0xcbf5('0x20')]['fn']('COUNT',db[_0xcbf5('0x20')]['fn']('IF',db[_0xcbf5('0x20')][_0xcbf5('0x23')](_0xcbf5('0x3c')))),_0xcbf5('0x3d')],[db['sequelize']['fn'](_0xcbf5('0x1f'),db[_0xcbf5('0x20')]['fn']('IF',db[_0xcbf5('0x20')][_0xcbf5('0x23')]('`state`\x20=\x2020,\x201,\x20null'))),_0xcbf5('0x3e')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xcbf5('0x23')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xcbf5('0x3f')]],'group':[_0xcbf5('0x2e')]})['then'](function(_0x6c7c11){logger[_0xcbf5('0x2c')]('GetVoiceQueueHopperHistory',_0xb3df4e);logger[_0xcbf5('0xf')](_0xcbf5('0x2d'),_0xb3df4e,JSON[_0xcbf5('0x11')](_0x6c7c11));_0x45c654(_0x6c7c11);})['catch'](function(_0x342c23){logger[_0xcbf5('0x12')](_0xcbf5('0x2d'),_0x342c23['message'],_0xb3df4e);_0x3c70e6(_0x5f5368[_0xcbf5('0x12')](0x1f4,_0x342c23[_0xcbf5('0x14')]));});});};exports['GetCampaignHopperHistory']=function(_0xfaad9){var _0x307589=this;return new Promise(function(_0x1fee25,_0x5b47f1){return db[_0xcbf5('0x17')]['findAll']({'raw':_0xfaad9['options']?_0xfaad9[_0xcbf5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xfaad9[_0xcbf5('0x1a')]?_0xfaad9['options'][_0xcbf5('0x1e')]||null:null,'attributes':[[_0xcbf5('0x2e'),'name'],[db[_0xcbf5('0x20')]['fn'](_0xcbf5('0x1f'),db['sequelize'][_0xcbf5('0x21')]('id')),'ivrTotalCallsDays'],[db[_0xcbf5('0x20')]['fn'](_0xcbf5('0x1f'),db[_0xcbf5('0x20')]['fn']('IF',db['sequelize']['literal'](_0xcbf5('0x24')))),_0xcbf5('0x40')]],'group':[_0xcbf5('0x2e')]})[_0xcbf5('0xc')](function(_0x3b9add){logger[_0xcbf5('0x2c')](_0xcbf5('0x41'),_0xfaad9);logger['debug']('GetCampaignHopperHistory',_0xfaad9,JSON[_0xcbf5('0x11')](_0x3b9add));_0x1fee25(_0x3b9add);})[_0xcbf5('0x15')](function(_0x121991){logger[_0xcbf5('0x12')](_0xcbf5('0x41'),_0x121991[_0xcbf5('0x14')],_0xfaad9);_0x5b47f1(_0x307589[_0xcbf5('0x12')](0x1f4,_0x121991[_0xcbf5('0x14')]));});});}; \ No newline at end of file +var _0x12c9=['findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','debug','request\x20sent','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','then','AvgHandleTime','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null'];(function(_0x54c239,_0x400ecb){var _0x3f4865=function(_0x24f40f){while(--_0x24f40f){_0x54c239['push'](_0x54c239['shift']());}};_0x3f4865(++_0x400ecb);}(_0x12c9,0x9f));var _0x912c=function(_0x554f07,_0x4200f3){_0x554f07=_0x554f07-0x0;var _0x145814=_0x12c9[_0x554f07];return _0x145814;};'use strict';var _=require(_0x912c('0x0'));var util=require('util');var moment=require(_0x912c('0x1'));var BPromise=require('bluebird');var rs=require(_0x912c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x912c('0x3'))['db'];var utils=require(_0x912c('0x4'));var logger=require(_0x912c('0x5'))(_0x912c('0x6'));var config=require(_0x912c('0x7'));var jayson=require(_0x912c('0x8'));var client=jayson[_0x912c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31a317,_0xf08f88,_0x4745c5){return new BPromise(function(_0x486e08,_0x2d86b9){return client['request'](_0x31a317,_0x4745c5)['then'](function(_0x28a597){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0xf08f88,'request\x20sent');logger[_0x912c('0xa')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0xf08f88,_0x912c('0xb'),JSON[_0x912c('0xc')](_0x28a597));if(_0x28a597[_0x912c('0xd')]){if(_0x28a597[_0x912c('0xd')][_0x912c('0xe')]===0x1f4){logger[_0x912c('0xd')](_0x912c('0xf'),_0xf08f88,_0x28a597['error'][_0x912c('0x10')]);return _0x2d86b9(_0x28a597[_0x912c('0xd')][_0x912c('0x10')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0xf08f88,_0x28a597[_0x912c('0xd')][_0x912c('0x10')]);return _0x486e08(_0x28a597['error'][_0x912c('0x10')]);}else{logger[_0x912c('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0xf08f88,'request\x20sent');_0x486e08(_0x28a597[_0x912c('0x12')][_0x912c('0x10')]);}})[_0x912c('0x13')](function(_0x533f99){logger[_0x912c('0xd')](_0x912c('0xf'),_0xf08f88,_0x533f99);_0x2d86b9(_0x533f99);});});}exports[_0x912c('0x14')]=function(_0x25b3d6){var _0x4b5255=this;return new Promise(function(_0x46d34c,_0x1c3af6){return db[_0x912c('0x15')][_0x912c('0x16')](_0x25b3d6['body'],{'raw':_0x25b3d6[_0x912c('0x17')]?_0x25b3d6[_0x912c('0x17')][_0x912c('0x18')]===undefined?!![]:![]:!![]})[_0x912c('0x19')](function(_0x551576){logger[_0x912c('0x11')](_0x912c('0x14'),_0x25b3d6);logger[_0x912c('0xa')](_0x912c('0x14'),_0x25b3d6,JSON['stringify'](_0x551576));_0x46d34c(_0x551576);})[_0x912c('0x13')](function(_0x27f644){logger[_0x912c('0xd')](_0x912c('0x14'),_0x27f644[_0x912c('0x10')],_0x25b3d6);_0x1c3af6(_0x4b5255['error'](0x1f4,_0x27f644[_0x912c('0x10')]));});});};exports[_0x912c('0x1a')]=function(_0x4e79ba){var _0x57f829=this;return new Promise(function(_0x47278e,_0x5e2bea){return db[_0x912c('0x15')]['findAll']({'raw':_0x4e79ba['options']?_0x4e79ba[_0x912c('0x17')][_0x912c('0x18')]===undefined?!![]:![]:!![],'where':_0x4e79ba['options']?_0x4e79ba['options'][_0x912c('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')][_0x912c('0x1e')]('id')),_0x912c('0x1f')],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x912c('0x21')],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db['sequelize']['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')](_0x912c('0x22')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x912c('0x1d')]['fn'](_0x912c('0x23'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')](_0x912c('0x24')))),_0x912c('0x25')],[db['sequelize']['fn'](_0x912c('0x23'),db[_0x912c('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x912c('0x26')))),'predictiveIntervalAvgTalktime']]})[_0x912c('0x19')](function(_0x53e664){logger[_0x912c('0x11')](_0x912c('0x1a'),_0x4e79ba);logger[_0x912c('0xa')](_0x912c('0x1a'),_0x4e79ba,JSON[_0x912c('0xc')](_0x53e664));_0x47278e(_0x53e664);})[_0x912c('0x13')](function(_0x245213){logger[_0x912c('0xd')](_0x912c('0x1a'),_0x245213['message'],_0x4e79ba);_0x5e2bea(_0x57f829[_0x912c('0xd')](0x1f4,_0x245213[_0x912c('0x10')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x2bb739){var _0x22cab2=this;return new Promise(function(_0x1f4c8e,_0x42fb5d){return db['CmHopperHistory'][_0x912c('0x27')]({'raw':_0x2bb739['options']?_0x2bb739[_0x912c('0x17')][_0x912c('0x18')]===undefined?!![]:![]:!![],'where':_0x2bb739[_0x912c('0x17')]?_0x2bb739['options'][_0x912c('0x1b')]||null:null,'attributes':[[_0x912c('0x28'),_0x912c('0x29')],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')](_0x912c('0x2a')))),'outboundNoSuchCallsDay'],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db['sequelize'][_0x912c('0x20')](_0x912c('0x2b')))),_0x912c('0x2c')],[db[_0x912c('0x1d')]['fn']('COUNT',db[_0x912c('0x1d')]['fn']('IF',db['sequelize'][_0x912c('0x20')](_0x912c('0x2d')))),'outboundAnswerCallsDay'],[db[_0x912c('0x1d')]['fn']('COUNT',db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')](_0x912c('0x2e')))),'outboundBusyCallsDay'],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')](_0x912c('0x2f')))),_0x912c('0x30')],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')](_0x912c('0x31')))),_0x912c('0x32')],[db['sequelize']['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x912c('0x33')],[db['sequelize']['fn']('COUNT',db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')](_0x912c('0x34')))),'outboundUnknownCallsDay'],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')]['literal'](_0x912c('0x35')))),_0x912c('0x36')],[db[_0x912c('0x1d')]['fn']('COUNT',db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')]('`state`\x20=\x2014,\x201,\x20null'))),_0x912c('0x37')],[db[_0x912c('0x1d')]['fn']('COUNT',db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')]['literal'](_0x912c('0x38')))),_0x912c('0x39')],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db['sequelize']['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0x912c('0x3a')],[db['sequelize']['fn'](_0x912c('0x1c'),db['sequelize']['fn']('IF',db[_0x912c('0x1d')]['literal'](_0x912c('0x3b')))),_0x912c('0x39')],[db['sequelize']['fn']('COUNT',db[_0x912c('0x1d')]['fn']('IF',db['sequelize'][_0x912c('0x20')](_0x912c('0x3c')))),_0x912c('0x3d')]],'group':[_0x912c('0x28')]})[_0x912c('0x19')](function(_0x565f31){logger[_0x912c('0x11')](_0x912c('0x3e'),_0x2bb739);logger[_0x912c('0xa')](_0x912c('0x3e'),_0x2bb739,JSON[_0x912c('0xc')](_0x565f31));_0x1f4c8e(_0x565f31);})['catch'](function(_0x1e92c8){logger[_0x912c('0xd')](_0x912c('0x3e'),_0x1e92c8['message'],_0x2bb739);_0x42fb5d(_0x22cab2[_0x912c('0xd')](0x1f4,_0x1e92c8['message']));});});};exports[_0x912c('0x3f')]=function(_0x269773){var _0x4b4e2e=this;return new Promise(function(_0x2ade1d,_0x13cef7){return db['CmHopperHistory'][_0x912c('0x27')]({'raw':_0x269773[_0x912c('0x17')]?_0x269773['options']['raw']===undefined?!![]:![]:!![],'where':_0x269773[_0x912c('0x17')]?_0x269773[_0x912c('0x17')][_0x912c('0x1b')]||null:null,'attributes':[[_0x912c('0x28'),_0x912c('0x29')],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['col']('id')),_0x912c('0x40')],[db[_0x912c('0x1d')]['fn'](_0x912c('0x1c'),db[_0x912c('0x1d')]['fn']('IF',db[_0x912c('0x1d')][_0x912c('0x20')](_0x912c('0x2d')))),_0x912c('0x41')]],'group':[_0x912c('0x28')]})[_0x912c('0x19')](function(_0x1e7dad){logger[_0x912c('0x11')](_0x912c('0x3f'),_0x269773);logger[_0x912c('0xa')](_0x912c('0x3f'),_0x269773,JSON[_0x912c('0xc')](_0x1e7dad));_0x2ade1d(_0x1e7dad);})[_0x912c('0x13')](function(_0x35cd8a){logger[_0x912c('0xd')](_0x912c('0x3f'),_0x35cd8a[_0x912c('0x10')],_0x269773);_0x13cef7(_0x4b4e2e[_0x912c('0xd')](0x1f4,_0x35cd8a[_0x912c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 4791486..272f5c7 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 _0x1804=['get','describe','/:id','isAuthenticated','show','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0x1804,0x75));var _0x4180=function(_0x16fead,_0x6d2e83){_0x16fead=_0x16fead-0x0;var _0x5ba22e=_0x1804[_0x16fead];return _0x5ba22e;};'use strict';var multer=require(_0x4180('0x0'));var util=require(_0x4180('0x1'));var path=require(_0x4180('0x2'));var timeout=require(_0x4180('0x3'));var express=require(_0x4180('0x4'));var router=express[_0x4180('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4180('0x6'));var interaction=require(_0x4180('0x7'));var config=require(_0x4180('0x8'));var controller=require('./cmHopperHistory.controller');router[_0x4180('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4180('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x4180('0xa')]);router[_0x4180('0x9')](_0x4180('0xb'),auth[_0x4180('0xc')](),controller[_0x4180('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x4180('0xb'),auth[_0x4180('0xc')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x0915=['isAuthenticated','index','describe','show','/:id','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get'];(function(_0x94f612,_0x40bb0f){var _0x4f677c=function(_0x575177){while(--_0x575177){_0x94f612['push'](_0x94f612['shift']());}};_0x4f677c(++_0x40bb0f);}(_0x0915,0x11e));var _0x5091=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0x0915[_0x57014b];return _0x2b258a;};'use strict';var multer=require(_0x5091('0x0'));var util=require(_0x5091('0x1'));var path=require(_0x5091('0x2'));var timeout=require(_0x5091('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5091('0x4'));var config=require(_0x5091('0x5'));var controller=require(_0x5091('0x6'));router[_0x5091('0x7')]('/',auth[_0x5091('0x8')](),controller[_0x5091('0x9')]);router[_0x5091('0x7')]('/describe',auth[_0x5091('0x8')](),controller[_0x5091('0xa')]);router[_0x5091('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x5091('0xb')]);router['post']('/',auth[_0x5091('0x8')](),controller['create']);router['put'](_0x5091('0xc'),auth[_0x5091('0x8')](),controller['update']);module[_0x5091('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index f4c2161..34721ce 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 _0x4074=['sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4074,0xf0));var _0x4407=function(_0x490548,_0x587619){_0x490548=_0x490548-0x0;var _0x3a7567=_0x4074[_0x490548];return _0x3a7567;};'use strict';var Sequelize=require(_0x4407('0x0'));module[_0x4407('0x1')]={'name':{'type':Sequelize[_0x4407('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4407('0x2')]},'dialPrefix':{'type':Sequelize[_0x4407('0x2')]}}; \ No newline at end of file +var _0x1f63=['name','STRING','sequelize','exports'];(function(_0x35c1df,_0x7e0b8){var _0x2919f5=function(_0x11e960){while(--_0x11e960){_0x35c1df['push'](_0x35c1df['shift']());}};_0x2919f5(++_0x7e0b8);}(_0x1f63,0x7a));var _0x31f6=function(_0x8f92a9,_0x149334){_0x8f92a9=_0x8f92a9-0x0;var _0xaea6a7=_0x1f63[_0x8f92a9];return _0xaea6a7;};'use strict';var Sequelize=require(_0x31f6('0x0'));module[_0x31f6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x31f6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x31f6('0x3')]},'dialPrefix':{'type':Sequelize[_0x31f6('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 8584d4b..ba906ac 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 _0xca88=['text','number','INTEGER','switch','Sequelize','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','Lists','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','CmList','includeAll','include','findAll','rows','show','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ListId','Disposition','findOne','removeDispositions','addContacts','CmContact','isArray','tags','join','push','each','omit','ids','success','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','raw','getContactsCsv','concat','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','transaction','addCustomFields','TEXT'];(function(_0x47f719,_0x2e559d){var _0x407f4e=function(_0x2be03a){while(--_0x2be03a){_0x47f719['push'](_0x47f719['shift']());}};_0x407f4e(++_0x2e559d);}(_0xca88,0xab));var _0x8ca8=function(_0x3799a6,_0x31ea90){_0x3799a6=_0x3799a6-0x0;var _0x2cc17e=_0xca88[_0x3799a6];return _0x2cc17e;};'use strict';var emlformat=require(_0x8ca8('0x0'));var rimraf=require(_0x8ca8('0x1'));var zipdir=require(_0x8ca8('0x2'));var jsonpatch=require(_0x8ca8('0x3'));var rp=require(_0x8ca8('0x4'));var moment=require(_0x8ca8('0x5'));var BPromise=require(_0x8ca8('0x6'));var Mustache=require('mustache');var util=require(_0x8ca8('0x7'));var path=require(_0x8ca8('0x8'));var sox=require(_0x8ca8('0x9'));var csv=require(_0x8ca8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ca8('0xb'));var _=require(_0x8ca8('0xc'));var squel=require(_0x8ca8('0xd'));var crypto=require(_0x8ca8('0xe'));var jsforce=require(_0x8ca8('0xf'));var deskjs=require(_0x8ca8('0x10'));var toCsv=require(_0x8ca8('0xa'));var querystring=require(_0x8ca8('0x11'));var Papa=require(_0x8ca8('0x12'));var Redis=require('ioredis');var authService=require(_0x8ca8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8ca8('0x14'));var hardwareService=require(_0x8ca8('0x15'));var logger=require('../../config/logger')(_0x8ca8('0x16'));var utils=require(_0x8ca8('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8ca8('0x18'))['db'];config[_0x8ca8('0x19')]=_[_0x8ca8('0x1a')](config[_0x8ca8('0x19')],{'host':_0x8ca8('0x1b'),'port':0x18eb});var socket=require(_0x8ca8('0x1c'))(new Redis(config[_0x8ca8('0x19')]));require(_0x8ca8('0x1d'))[_0x8ca8('0x1e')](socket);function respondWithStatusCode(_0x36fa47,_0x5eb87a){_0x5eb87a=_0x5eb87a||0xcc;return function(_0x145245){if(_0x145245){return _0x36fa47[_0x8ca8('0x1f')](_0x5eb87a);}return _0x36fa47[_0x8ca8('0x20')](_0x5eb87a)[_0x8ca8('0x21')]();};}function respondWithResult(_0x20ca09,_0x3cddc8){_0x3cddc8=_0x3cddc8||0xc8;return function(_0x1aba29){if(_0x1aba29){return _0x20ca09[_0x8ca8('0x20')](_0x3cddc8)[_0x8ca8('0x22')](_0x1aba29);}};}function respondWithFilteredResult(_0x4e87ac,_0x5eda6b){return function(_0x2690f6){if(_0x2690f6){var _0x16f60a=typeof _0x5eda6b['offset']==='undefined'&&typeof _0x5eda6b[_0x8ca8('0x23')]===_0x8ca8('0x24');var _0x3b562c=_0x2690f6['count'];var _0x2f32e4=_0x16f60a?0x0:_0x5eda6b[_0x8ca8('0x25')];var _0xef24e6=_0x16f60a?_0x2690f6[_0x8ca8('0x26')]:_0x5eda6b[_0x8ca8('0x25')]+_0x5eda6b[_0x8ca8('0x23')];var _0x13f15a;if(_0xef24e6>=_0x3b562c){_0xef24e6=_0x3b562c;_0x13f15a=0xc8;}else{_0x13f15a=0xce;}_0x4e87ac[_0x8ca8('0x20')](_0x13f15a);return _0x4e87ac[_0x8ca8('0x27')](_0x8ca8('0x28'),_0x2f32e4+'-'+_0xef24e6+'/'+_0x3b562c)[_0x8ca8('0x22')](_0x2690f6);}return null;};}function patchUpdates(_0x398920){return function(_0xc14200){try{jsonpatch[_0x8ca8('0x29')](_0xc14200,_0x398920,!![]);}catch(_0x2fc4e3){return BPromise[_0x8ca8('0x2a')](_0x2fc4e3);}return _0xc14200[_0x8ca8('0x2b')]();};}function saveUpdates(_0x52af95,_0x396a80){return function(_0x2cf5c5){if(_0x2cf5c5){return _0x2cf5c5[_0x8ca8('0x2c')](_0x52af95)[_0x8ca8('0x2d')](function(_0x1fdacc){return _0x1fdacc;});}return null;};}function removeEntity(_0x2918c0,_0x3892b4){return function(_0x43997c){if(_0x43997c){return _0x43997c['destroy']()[_0x8ca8('0x2d')](function(){var _0x5f3938=_0x43997c['get']({'plain':!![]});var _0xcba267=_0x8ca8('0x2e');return db[_0x8ca8('0x2f')][_0x8ca8('0x30')]({'where':{'type':_0xcba267,'resourceId':_0x5f3938['id']}})[_0x8ca8('0x2d')](function(){return _0x43997c;});})['then'](function(){_0x2918c0[_0x8ca8('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cd590,_0x51d142){return function(_0x51afee){if(!_0x51afee){_0x4cd590['sendStatus'](0x194);}return _0x51afee;};}function handleError(_0x1ba20f,_0x3c1564){_0x3c1564=_0x3c1564||0x1f4;return function(_0x25d1d8){logger[_0x8ca8('0x31')](_0x25d1d8[_0x8ca8('0x32')]);if(_0x25d1d8[_0x8ca8('0x33')]){delete _0x25d1d8[_0x8ca8('0x33')];}_0x1ba20f[_0x8ca8('0x20')](_0x3c1564)[_0x8ca8('0x34')](_0x25d1d8);};}exports[_0x8ca8('0x35')]=function(_0x712231,_0x5ec254){var _0xdee8f0={},_0x129e80={},_0x197b29={'count':0x0,'rows':[]};var _0x3844b4=_[_0x8ca8('0x36')](db['CmList'][_0x8ca8('0x37')],function(_0x3a4839){return{'name':_0x3a4839[_0x8ca8('0x38')],'type':_0x3a4839[_0x8ca8('0x39')][_0x8ca8('0x3a')]};});_0x129e80[_0x8ca8('0x3b')]=_[_0x8ca8('0x36')](_0x3844b4,_0x8ca8('0x33'));_0x129e80[_0x8ca8('0x3c')]=_[_0x8ca8('0x3d')](_0x712231[_0x8ca8('0x3c')]);_0x129e80['filters']=_['intersection'](_0x129e80['model'],_0x129e80['query']);_0xdee8f0[_0x8ca8('0x3e')]=_[_0x8ca8('0x3f')](_0x129e80['model'],qs[_0x8ca8('0x40')](_0x712231['query'][_0x8ca8('0x40')]));_0xdee8f0[_0x8ca8('0x3e')]=_0xdee8f0[_0x8ca8('0x3e')][_0x8ca8('0x41')]?_0xdee8f0['attributes']:_0x129e80['model'];if(!_0x712231[_0x8ca8('0x3c')][_0x8ca8('0x42')](_0x8ca8('0x43'))){_0xdee8f0[_0x8ca8('0x23')]=qs['limit'](_0x712231[_0x8ca8('0x3c')][_0x8ca8('0x23')]);_0xdee8f0[_0x8ca8('0x25')]=qs[_0x8ca8('0x25')](_0x712231[_0x8ca8('0x3c')]['offset']);}_0xdee8f0[_0x8ca8('0x44')]=qs[_0x8ca8('0x45')](_0x712231[_0x8ca8('0x3c')]['sort']);_0xdee8f0[_0x8ca8('0x46')]=qs[_0x8ca8('0x47')](_[_0x8ca8('0x48')](_0x712231['query'],_0x129e80[_0x8ca8('0x47')]),_0x3844b4);if(_0x712231[_0x8ca8('0x3c')]['filter']){_0xdee8f0[_0x8ca8('0x46')]=_['merge'](_0xdee8f0[_0x8ca8('0x46')],{'$or':_[_0x8ca8('0x36')](_0x3844b4,function(_0x1d2189){if(_0x1d2189[_0x8ca8('0x39')]!==_0x8ca8('0x49')){var _0x1a0b9a={};_0x1a0b9a[_0x1d2189['name']]={'$like':'%'+_0x712231[_0x8ca8('0x3c')][_0x8ca8('0x4a')]+'%'};return _0x1a0b9a;}})});}_0xdee8f0=_[_0x8ca8('0x4b')]({},_0xdee8f0,_0x712231[_0x8ca8('0x4c')]);var _0x4372a8={'where':_0xdee8f0[_0x8ca8('0x46')]};return db[_0x8ca8('0x4d')]['count'](_0x4372a8)[_0x8ca8('0x2d')](function(_0x36907e){_0x197b29['count']=_0x36907e;if(_0x712231['query'][_0x8ca8('0x4e')]){_0xdee8f0[_0x8ca8('0x4f')]=[{'all':!![]}];}return db[_0x8ca8('0x4d')][_0x8ca8('0x50')](_0xdee8f0);})['then'](function(_0x3ea8d8){_0x197b29[_0x8ca8('0x51')]=_0x3ea8d8;return _0x197b29;})['then'](respondWithFilteredResult(_0x5ec254,_0xdee8f0))['catch'](handleError(_0x5ec254,null));};exports[_0x8ca8('0x52')]=function(_0x349c49,_0x5e64ff){var _0xf8e5ae={'raw':![],'where':{'id':_0x349c49['params']['id']}},_0x17cceb={};_0x17cceb[_0x8ca8('0x3b')]=_[_0x8ca8('0x3d')](db[_0x8ca8('0x4d')][_0x8ca8('0x37')]);_0x17cceb[_0x8ca8('0x3c')]=_['keys'](_0x349c49['query']);_0x17cceb[_0x8ca8('0x47')]=_['intersection'](_0x17cceb['model'],_0x17cceb['query']);_0xf8e5ae['attributes']=_[_0x8ca8('0x3f')](_0x17cceb[_0x8ca8('0x3b')],qs[_0x8ca8('0x40')](_0x349c49[_0x8ca8('0x3c')][_0x8ca8('0x40')]));_0xf8e5ae[_0x8ca8('0x3e')]=_0xf8e5ae['attributes']['length']?_0xf8e5ae[_0x8ca8('0x3e')]:_0x17cceb[_0x8ca8('0x3b')];if(_0x349c49[_0x8ca8('0x3c')]['includeAll']){_0xf8e5ae[_0x8ca8('0x4f')]=[{'all':!![]}];}_0xf8e5ae=_[_0x8ca8('0x4b')]({},_0xf8e5ae,_0x349c49[_0x8ca8('0x4c')]);return db[_0x8ca8('0x4d')][_0x8ca8('0x53')](_0xf8e5ae)['then'](handleEntityNotFound(_0x5e64ff,null))[_0x8ca8('0x2d')](respondWithResult(_0x5e64ff,null))[_0x8ca8('0x54')](handleError(_0x5e64ff,null));};exports[_0x8ca8('0x55')]=function(_0x286a38,_0x58d95e){return db[_0x8ca8('0x4d')][_0x8ca8('0x55')](_0x286a38['body'],{})[_0x8ca8('0x2d')](function(_0x29bd1e){var _0x23a8f4=_0x286a38[_0x8ca8('0x56')][_0x8ca8('0x57')]({'plain':!![]});if(!_0x23a8f4)throw new Error(_0x8ca8('0x58'));if(_0x23a8f4[_0x8ca8('0x59')]===_0x8ca8('0x56')){var _0x233f57=_0x29bd1e[_0x8ca8('0x57')]({'plain':!![]});var _0x22e600=_0x8ca8('0x2e');return db[_0x8ca8('0x5a')][_0x8ca8('0x53')]({'where':{'name':_0x22e600,'userProfileId':_0x23a8f4['userProfileId']},'raw':!![]})[_0x8ca8('0x2d')](function(_0x1a8dde){if(_0x1a8dde&&_0x1a8dde[_0x8ca8('0x5b')]===0x0){return db[_0x8ca8('0x2f')]['create']({'name':_0x233f57[_0x8ca8('0x33')],'resourceId':_0x233f57['id'],'type':_0x1a8dde[_0x8ca8('0x33')],'sectionId':_0x1a8dde['id']},{})[_0x8ca8('0x2d')](function(){return _0x29bd1e;});}else{return _0x29bd1e;}})[_0x8ca8('0x54')](function(_0x4255dd){logger[_0x8ca8('0x31')](_0x8ca8('0x5c'),_0x4255dd);throw _0x4255dd;});}return _0x29bd1e;})[_0x8ca8('0x2d')](respondWithResult(_0x58d95e,0xc9))[_0x8ca8('0x54')](handleError(_0x58d95e,null));};exports[_0x8ca8('0x2c')]=function(_0x4c974e,_0x4ae7ae){if(_0x4c974e[_0x8ca8('0x5d')]['id']){delete _0x4c974e['body']['id'];}return db[_0x8ca8('0x4d')][_0x8ca8('0x53')]({'where':{'id':_0x4c974e[_0x8ca8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4ae7ae,null))['then'](saveUpdates(_0x4c974e[_0x8ca8('0x5d')],null))['then'](respondWithResult(_0x4ae7ae,null))[_0x8ca8('0x54')](handleError(_0x4ae7ae,null));};exports['destroy']=function(_0x1297d8,_0xafacc5){return db['CmList'][_0x8ca8('0x53')]({'where':{'id':_0x1297d8[_0x8ca8('0x5e')]['id']}})['then'](handleEntityNotFound(_0xafacc5,null))[_0x8ca8('0x2d')](removeEntity(_0xafacc5,null))['catch'](handleError(_0xafacc5,null));};exports[_0x8ca8('0x5f')]=function(_0x4954bf,_0x4f8975){return db[_0x8ca8('0x4d')][_0x8ca8('0x5f')]()[_0x8ca8('0x2d')](respondWithResult(_0x4f8975,null))['catch'](handleError(_0x4f8975,null));};exports[_0x8ca8('0x60')]=function(_0x3e11e7,_0xdc505,_0x3d5ec6){if(_0x3e11e7[_0x8ca8('0x5d')]['id']){delete _0x3e11e7['body']['id'];}return db[_0x8ca8('0x4d')][_0x8ca8('0x53')]({'where':{'id':_0x3e11e7['params']['id']}})['then'](handleEntityNotFound(_0xdc505,null))[_0x8ca8('0x2d')](function(_0x5d79a5){if(_0x5d79a5){_0x3e11e7[_0x8ca8('0x5d')][_0x8ca8('0x61')]=_0x5d79a5['id'];return db[_0x8ca8('0x62')][_0x8ca8('0x55')](_0x3e11e7[_0x8ca8('0x5d')]);}})[_0x8ca8('0x2d')](respondWithResult(_0xdc505,null))[_0x8ca8('0x54')](handleError(_0xdc505,null));};exports['getDispositions']=function(_0x457b1c,_0x310e9a,_0x27f373){var _0x4ad7a1={'raw':![],'where':{}};var _0x1a809a={};var _0xd05ae2={'count':0x0,'rows':[]};return db[_0x8ca8('0x4d')][_0x8ca8('0x63')]({'where':{'id':_0x457b1c[_0x8ca8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x310e9a,null))[_0x8ca8('0x2d')](function(_0x55aa92){if(_0x55aa92){_0x1a809a[_0x8ca8('0x3b')]=_['keys'](db['Disposition'][_0x8ca8('0x37')]);_0x1a809a[_0x8ca8('0x3c')]=_['keys'](_0x457b1c[_0x8ca8('0x3c')]);_0x1a809a[_0x8ca8('0x47')]=_['intersection'](_0x1a809a['model'],_0x1a809a[_0x8ca8('0x3c')]);_0x4ad7a1[_0x8ca8('0x3e')]=_['intersection'](_0x1a809a[_0x8ca8('0x3b')],qs[_0x8ca8('0x40')](_0x457b1c[_0x8ca8('0x3c')][_0x8ca8('0x40')]));_0x4ad7a1[_0x8ca8('0x3e')]=_0x4ad7a1[_0x8ca8('0x3e')][_0x8ca8('0x41')]?_0x4ad7a1['attributes']:_0x1a809a[_0x8ca8('0x3b')];if(!_0x457b1c[_0x8ca8('0x3c')][_0x8ca8('0x42')](_0x8ca8('0x43'))){_0x4ad7a1[_0x8ca8('0x23')]=qs[_0x8ca8('0x23')](_0x457b1c[_0x8ca8('0x3c')][_0x8ca8('0x23')]);_0x4ad7a1[_0x8ca8('0x25')]=qs['offset'](_0x457b1c[_0x8ca8('0x3c')]['offset']);}_0x4ad7a1['order']=qs[_0x8ca8('0x45')](_0x457b1c['query'][_0x8ca8('0x45')]);_0x4ad7a1[_0x8ca8('0x46')]=qs[_0x8ca8('0x47')](_[_0x8ca8('0x48')](_0x457b1c[_0x8ca8('0x3c')],_0x1a809a['filters']));_0x4ad7a1[_0x8ca8('0x46')][_0x8ca8('0x61')]=_0x55aa92['id'];if(_0x457b1c['query'][_0x8ca8('0x4a')]){_0x4ad7a1['where']=_[_0x8ca8('0x4b')](_0x4ad7a1[_0x8ca8('0x46')],{'$or':_[_0x8ca8('0x36')](_0x4ad7a1[_0x8ca8('0x3e')],function(_0x57ffde){var _0x211882={};_0x211882[_0x57ffde]={'$like':'%'+_0x457b1c[_0x8ca8('0x3c')]['filter']+'%'};return _0x211882;})});}_0x4ad7a1=_[_0x8ca8('0x4b')]({},_0x4ad7a1,_0x457b1c['options']);return db[_0x8ca8('0x62')][_0x8ca8('0x26')]({'where':_0x4ad7a1['where']})[_0x8ca8('0x2d')](function(_0x591771){_0xd05ae2[_0x8ca8('0x26')]=_0x591771;if(_0x457b1c[_0x8ca8('0x3c')][_0x8ca8('0x4e')]){_0x4ad7a1['include']=[{'all':!![]}];}return db[_0x8ca8('0x62')][_0x8ca8('0x50')](_0x4ad7a1);})[_0x8ca8('0x2d')](function(_0xf4699e){_0xd05ae2[_0x8ca8('0x51')]=_0xf4699e;return _0xd05ae2;});}})['then'](respondWithFilteredResult(_0x310e9a,_0x4ad7a1))[_0x8ca8('0x54')](handleError(_0x310e9a,null));};exports[_0x8ca8('0x64')]=function(_0x5520d9,_0x33695b,_0x4fbd19){return db[_0x8ca8('0x4d')][_0x8ca8('0x53')]({'where':{'id':_0x5520d9[_0x8ca8('0x5e')]['id']}})[_0x8ca8('0x2d')](handleEntityNotFound(_0x33695b,null))[_0x8ca8('0x2d')](function(_0x3f9565){if(_0x3f9565){return _0x3f9565[_0x8ca8('0x64')](_0x5520d9[_0x8ca8('0x3c')]['ids']);}})['then'](respondWithStatusCode(_0x33695b,null))[_0x8ca8('0x54')](handleError(_0x33695b,null));};exports[_0x8ca8('0x65')]=function(_0x3fe750,_0x3704b4,_0x4428ed){return db[_0x8ca8('0x4d')][_0x8ca8('0x53')]({'where':{'id':_0x3fe750[_0x8ca8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3704b4,null))['then'](function(_0x2ab166){if(_0x2ab166){var _0x3b9594=[];var _0x261345={'success':[],'errors':[]};return db[_0x8ca8('0x66')][_0x8ca8('0x5f')]()[_0x8ca8('0x2d')](function(_0x343614){if(_0x3fe750[_0x8ca8('0x5d')]['tags']&&_[_0x8ca8('0x67')](_0x3fe750[_0x8ca8('0x5d')][_0x8ca8('0x68')])){if(_0x3fe750['body'][_0x8ca8('0x68')]['length']){_0x3fe750[_0x8ca8('0x5d')]['tags']=_0x3fe750[_0x8ca8('0x5d')][_0x8ca8('0x68')][_0x8ca8('0x69')](';')+';';}else{_0x3fe750[_0x8ca8('0x5d')][_0x8ca8('0x68')]=null;}}else{_0x3fe750[_0x8ca8('0x5d')][_0x8ca8('0x68')]=null;}if(_0x3fe750[_0x8ca8('0x5d')]&&_['isArray'](_0x3fe750[_0x8ca8('0x5d')])){for(var _0x36d53c=0x0;_0x36d53c<_0x3fe750[_0x8ca8('0x5d')][_0x8ca8('0x41')];_0x36d53c+=0x1){_0x3fe750[_0x8ca8('0x5d')][_0x36d53c]['ListId']=_0x3fe750[_0x8ca8('0x5e')]['id'];_0x3b9594[_0x8ca8('0x6a')](_0x3fe750['body'][_0x36d53c]);}return BPromise[_0x8ca8('0x6b')](_0x3b9594,function(_0x410de5){return db['CmContact'][_0x8ca8('0x55')](_[_0x8ca8('0x6c')](_0x410de5,[_0x8ca8('0x6d'),'id'])||{},{'fields':_['keys'](_0x343614),'raw':!![]})[_0x8ca8('0x2d')](function(_0x54a9c7){_0x261345[_0x8ca8('0x6e')][_0x8ca8('0x6a')](_0x54a9c7['dataValues']);})['catch'](function(_0x1b330f){_0x261345[_0x8ca8('0x6f')][_0x8ca8('0x6a')]({'data':_0x410de5,'error':_0x1b330f[_0x8ca8('0x70')]});});})['then'](function(_0x54f8f9){return _0x261345;})['catch'](function(_0x1f55d9){return _0x1f55d9;});}else{_0x3704b4[_0x8ca8('0x20')](0x190)['json']({'message':_0x8ca8('0x71')});}});}})[_0x8ca8('0x2d')](respondWithResult(_0x3704b4,null))[_0x8ca8('0x54')](handleError(_0x3704b4,null));};exports[_0x8ca8('0x72')]=function(_0x2d6502,_0x2c38ad,_0x43b65e){var _0x16d031;return db['CmList']['find']({'where':{'id':_0x2d6502[_0x8ca8('0x5e')]['id']},'include':[{'model':db[_0x8ca8('0x73')],'as':'CustomFields'}]})[_0x8ca8('0x2d')](handleEntityNotFound(_0x2c38ad,null))[_0x8ca8('0x2d')](function(_0x22bb14){if(_0x22bb14){_0x16d031=_0x22bb14;return db[_0x8ca8('0x66')][_0x8ca8('0x37')];}})[_0x8ca8('0x2d')](function(_0x37bd9f){if(_0x37bd9f){var _0xf88635={};var _0x3df99b={};_0x3df99b[_0x8ca8('0x3b')]=_['concat'](_[_0x8ca8('0x3d')](_0x37bd9f),_['map'](_0x16d031[_0x8ca8('0x74')],function(_0x142e6a){return util[_0x8ca8('0x75')](_0x8ca8('0x76'),_0x142e6a['id']);}));_0x3df99b['query']=_[_0x8ca8('0x3d')](_0x2d6502[_0x8ca8('0x3c')]);_0x3df99b['filters']=_['intersection'](_0x3df99b[_0x8ca8('0x3b')],_0x3df99b[_0x8ca8('0x3c')]);_0xf88635[_0x8ca8('0x3e')]=_[_0x8ca8('0x3f')](_0x3df99b[_0x8ca8('0x3b')],qs[_0x8ca8('0x40')](_0x2d6502[_0x8ca8('0x3c')][_0x8ca8('0x40')]));_0xf88635[_0x8ca8('0x3e')]=_0xf88635[_0x8ca8('0x3e')]['length']?_0xf88635[_0x8ca8('0x3e')]:_0x3df99b['model'];if(!_0x2d6502[_0x8ca8('0x3c')]['hasOwnProperty'](_0x8ca8('0x43'))){_0xf88635[_0x8ca8('0x23')]=qs['limit'](_0x2d6502[_0x8ca8('0x3c')][_0x8ca8('0x23')]);_0xf88635['offset']=qs[_0x8ca8('0x25')](_0x2d6502[_0x8ca8('0x3c')][_0x8ca8('0x25')]);}_0xf88635[_0x8ca8('0x44')]=qs[_0x8ca8('0x45')](_0x2d6502[_0x8ca8('0x3c')]['sort']);_0xf88635['where']=qs[_0x8ca8('0x47')](_[_0x8ca8('0x48')](_0x2d6502[_0x8ca8('0x3c')],_0x3df99b['filters']));_0xf88635[_0x8ca8('0x77')]=!![];if(_0x2d6502['query']['filter']){_0xf88635[_0x8ca8('0x46')]=_[_0x8ca8('0x4b')](_0xf88635['where'],{'$or':_[_0x8ca8('0x36')](_0xf88635[_0x8ca8('0x3e')],function(_0x57c98d){var _0x1ed236={};_0x1ed236[_0x57c98d]={'$like':'%'+_0x2d6502[_0x8ca8('0x3c')]['filter']+'%'};return _0x1ed236;})});}_0xf88635=_[_0x8ca8('0x4b')]({},_0xf88635,_0x2d6502[_0x8ca8('0x4c')]);return _0x16d031['getContacts'](_0xf88635);}})[_0x8ca8('0x2d')](respondWithResult(_0x2c38ad,null))[_0x8ca8('0x54')](handleError(_0x2c38ad,null));};exports[_0x8ca8('0x78')]=function(_0x2e3740,_0x4a2fdc,_0x28e6ed){var _0x2dc9d0;return db[_0x8ca8('0x4d')][_0x8ca8('0x53')]({'where':{'id':_0x2e3740['params']['id']},'include':[{'model':db[_0x8ca8('0x73')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x4a2fdc,null))[_0x8ca8('0x2d')](function(_0xd6b8fc){if(_0xd6b8fc){_0x2dc9d0=_0xd6b8fc;return db[_0x8ca8('0x66')][_0x8ca8('0x37')];}})[_0x8ca8('0x2d')](function(_0x41db24){if(_0x41db24){var _0x30f0f8={};var _0x79165d={};_0x79165d['model']=_[_0x8ca8('0x79')](_[_0x8ca8('0x3d')](_0x41db24),_[_0x8ca8('0x36')](_0x2dc9d0[_0x8ca8('0x74')],function(_0x4de495){return util[_0x8ca8('0x75')](_0x8ca8('0x76'),_0x4de495['id']);}));_0x79165d[_0x8ca8('0x3c')]=_[_0x8ca8('0x3d')](_0x2e3740[_0x8ca8('0x3c')]);_0x79165d['filters']=_[_0x8ca8('0x3f')](_0x79165d[_0x8ca8('0x3b')],_0x79165d[_0x8ca8('0x3c')]);_0x30f0f8[_0x8ca8('0x3e')]=_[_0x8ca8('0x3f')](_0x79165d[_0x8ca8('0x3b')],qs[_0x8ca8('0x40')](_0x2e3740[_0x8ca8('0x3c')]['fields']));_0x30f0f8[_0x8ca8('0x3e')]=_0x30f0f8['attributes'][_0x8ca8('0x41')]?_0x30f0f8[_0x8ca8('0x3e')]:_0x79165d[_0x8ca8('0x3b')];if(!_0x2e3740['query']['hasOwnProperty'](_0x8ca8('0x43'))){_0x30f0f8[_0x8ca8('0x23')]=qs[_0x8ca8('0x23')](_0x2e3740[_0x8ca8('0x3c')][_0x8ca8('0x23')]);_0x30f0f8[_0x8ca8('0x25')]=qs['offset'](_0x2e3740[_0x8ca8('0x3c')][_0x8ca8('0x25')]);}_0x30f0f8[_0x8ca8('0x44')]=qs[_0x8ca8('0x45')](_0x2e3740['query'][_0x8ca8('0x45')]);_0x30f0f8[_0x8ca8('0x46')]=qs[_0x8ca8('0x47')](_['pick'](_0x2e3740[_0x8ca8('0x3c')],_0x79165d[_0x8ca8('0x47')]));_0x30f0f8[_0x8ca8('0x77')]=!![];if(_0x2e3740[_0x8ca8('0x3c')][_0x8ca8('0x4a')]){_0x30f0f8[_0x8ca8('0x46')]=_['merge'](_0x30f0f8[_0x8ca8('0x46')],{'$or':_['map'](_0x30f0f8[_0x8ca8('0x3e')],function(_0x1b30b1){var _0x2aba75={};_0x2aba75[_0x1b30b1]={'$like':'%'+_0x2e3740[_0x8ca8('0x3c')][_0x8ca8('0x4a')]+'%'};return _0x2aba75;})});}_0x30f0f8=_[_0x8ca8('0x4b')]({},_0x30f0f8,_0x2e3740[_0x8ca8('0x4c')]);return _0x2dc9d0['getContacts'](_0x30f0f8);}})[_0x8ca8('0x2d')](function(_0x139873){if(!_[_0x8ca8('0x7a')](_0x139873)){var _0x1738de=toCsv(_0x139873);var _0x557828=Date[_0x8ca8('0x7b')]();fs['writeFileSync'](util[_0x8ca8('0x75')](_0x8ca8('0x7c'),_0x2dc9d0['id'],_0x557828),_0x1738de);_0x4a2fdc[_0x8ca8('0x7d')](_0x8ca8('0x7e'),'attachment;\x20filename='+util[_0x8ca8('0x75')](_0x8ca8('0x7f'),_0x2dc9d0['id'],_0x557828));_0x4a2fdc[_0x8ca8('0x7d')](_0x8ca8('0x80'),_0x8ca8('0x81'));return _0x4a2fdc[_0x8ca8('0x82')](util[_0x8ca8('0x75')](_0x8ca8('0x7c'),_0x2dc9d0['id'],_0x557828));}else{return _0x4a2fdc['sendStatus'](0xcc);}})[_0x8ca8('0x54')](handleError(_0x4a2fdc,null));};exports[_0x8ca8('0x83')]=function(_0x2f2322,_0x4d5039,_0x43a2f6){var _0x5a972d;delete _0x2f2322[_0x8ca8('0x5d')]['id'];return db['CmList']['findOne']({'where':{'id':_0x2f2322[_0x8ca8('0x5e')]['id']}})[_0x8ca8('0x2d')](handleEntityNotFound(_0x4d5039,null))[_0x8ca8('0x2d')](function(_0x34613d){if(_0x34613d){return db['sequelize'][_0x8ca8('0x84')](function(_0x588c62){return db['CmCustomField'][_0x8ca8('0x55')](_0x2f2322[_0x8ca8('0x5d')],{'transaction':_0x588c62})[_0x8ca8('0x2d')](function(_0x1ef54d){_0x5a972d=_0x1ef54d;return _0x34613d[_0x8ca8('0x85')](_0x1ef54d,{'transaction':_0x588c62});})[_0x8ca8('0x2d')](function(){var _0x35d31e={'type':db['Sequelize'][_0x8ca8('0x86')],'transaction':_0x588c62};switch(_0x2f2322[_0x8ca8('0x5d')][_0x8ca8('0x39')]){case _0x8ca8('0x87'):_0x35d31e['type']=db['Sequelize'][_0x8ca8('0x86')];break;case _0x8ca8('0x88'):_0x35d31e['type']=db['Sequelize'][_0x8ca8('0x89')];break;case _0x8ca8('0x8a'):_0x35d31e[_0x8ca8('0x39')]=db[_0x8ca8('0x8b')][_0x8ca8('0x8c')];_0x35d31e[_0x8ca8('0x8d')]=![];break;default:}return db['sequelize'][_0x8ca8('0x8e')][_0x8ca8('0x8f')](_0x8ca8('0x90'),util[_0x8ca8('0x75')](_0x8ca8('0x91'),_0x5a972d['id']),_0x35d31e);})[_0x8ca8('0x2d')](function(){return _0x5a972d;});});}})[_0x8ca8('0x2d')](respondWithResult(_0x4d5039,null))[_0x8ca8('0x54')](handleError(_0x4d5039,null));};exports[_0x8ca8('0x92')]=function(_0x3a01d2,_0x42f4e5,_0x35ecf1){var _0x241fee={};var _0xaa44eb={};var _0xc7eb7a;var _0x1fbf1e;return db[_0x8ca8('0x4d')][_0x8ca8('0x63')]({'where':{'id':_0x3a01d2['params']['id']}})[_0x8ca8('0x2d')](handleEntityNotFound(_0x42f4e5,null))['then'](function(_0xe2ba8f){if(_0xe2ba8f){_0xc7eb7a=_0xe2ba8f;_0xaa44eb[_0x8ca8('0x3b')]=_[_0x8ca8('0x3d')](db[_0x8ca8('0x73')][_0x8ca8('0x37')]);_0xaa44eb[_0x8ca8('0x3c')]=_['keys'](_0x3a01d2[_0x8ca8('0x3c')]);_0xaa44eb[_0x8ca8('0x47')]=_[_0x8ca8('0x3f')](_0xaa44eb['model'],_0xaa44eb[_0x8ca8('0x3c')]);_0x241fee[_0x8ca8('0x3e')]=_[_0x8ca8('0x3f')](_0xaa44eb[_0x8ca8('0x3b')],qs[_0x8ca8('0x40')](_0x3a01d2[_0x8ca8('0x3c')][_0x8ca8('0x40')]));_0x241fee[_0x8ca8('0x3e')]=_0x241fee[_0x8ca8('0x3e')][_0x8ca8('0x41')]?_0x241fee[_0x8ca8('0x3e')]:_0xaa44eb[_0x8ca8('0x3b')];_0x241fee[_0x8ca8('0x44')]=qs[_0x8ca8('0x45')](_0x3a01d2[_0x8ca8('0x3c')][_0x8ca8('0x45')]);_0x241fee[_0x8ca8('0x46')]=qs[_0x8ca8('0x47')](_[_0x8ca8('0x48')](_0x3a01d2[_0x8ca8('0x3c')],_0xaa44eb[_0x8ca8('0x47')]));_0x241fee[_0x8ca8('0x46')]=_[_0x8ca8('0x4b')](_0x241fee['where'],{'$or':[{'ListId':_0xe2ba8f['id']},{'ListId':null}]});if(_0x3a01d2[_0x8ca8('0x3c')][_0x8ca8('0x4a')]){_0x241fee[_0x8ca8('0x46')]=_[_0x8ca8('0x4b')](_0x241fee[_0x8ca8('0x46')],{'$or':_[_0x8ca8('0x36')](_0x241fee[_0x8ca8('0x3e')],function(_0x44646d){var _0x4255cc={};_0x4255cc[_0x44646d]={'$like':'%'+_0x3a01d2[_0x8ca8('0x3c')][_0x8ca8('0x4a')]+'%'};return _0x4255cc;})});}_0x241fee=_[_0x8ca8('0x4b')]({},_0x241fee,_0x3a01d2[_0x8ca8('0x4c')]);return db[_0x8ca8('0x73')]['findAndCountAll'](_0x241fee);}})[_0x8ca8('0x2d')](respondWithResult(_0x42f4e5,null))[_0x8ca8('0x54')](handleError(_0x42f4e5,null));};exports[_0x8ca8('0x93')]=function(_0x2d4ce7,_0x24b11a,_0x103adc){return db['CmList']['find']({'where':{'id':_0x2d4ce7[_0x8ca8('0x5e')]['id']}})[_0x8ca8('0x2d')](handleEntityNotFound(_0x24b11a,null))[_0x8ca8('0x2d')](function(_0x264544){if(_0x264544){return _0x264544[_0x8ca8('0x93')](_0x2d4ce7['body'][_0x8ca8('0x6d')],_['omit'](_0x2d4ce7['body'],[_0x8ca8('0x6d'),'id'])||{})[_0x8ca8('0x94')](function(_0x419363){for(var _0x3eb9e7=0x0;_0x3eb9e7<_0x2d4ce7[_0x8ca8('0x5d')][_0x8ca8('0x6d')]['length'];_0x3eb9e7+=0x1){socket['emit'](_0x8ca8('0x95'),{'UserId':Number(_0x2d4ce7['body'][_0x8ca8('0x6d')][_0x3eb9e7]),'CmListId':Number(_0x2d4ce7[_0x8ca8('0x5e')]['id'])});}return _0x419363;});}})[_0x8ca8('0x2d')](respondWithResult(_0x24b11a,null))[_0x8ca8('0x54')](handleError(_0x24b11a,null));};exports[_0x8ca8('0x96')]=function(_0x4b8ba4,_0x33cc3a,_0x36de85){return db[_0x8ca8('0x4d')][_0x8ca8('0x53')]({'where':{'id':_0x4b8ba4['params']['id']}})[_0x8ca8('0x2d')](handleEntityNotFound(_0x33cc3a,null))['then'](function(_0x108b99){if(_0x108b99){return _0x108b99[_0x8ca8('0x96')](_0x4b8ba4[_0x8ca8('0x3c')][_0x8ca8('0x6d')])[_0x8ca8('0x2d')](function(){if(_['isArray'](_0x4b8ba4['query'][_0x8ca8('0x6d')])){for(var _0x1def16=0x0;_0x1def16<_0x4b8ba4[_0x8ca8('0x3c')]['ids'][_0x8ca8('0x41')];_0x1def16+=0x1){socket[_0x8ca8('0x97')](_0x8ca8('0x98'),{'UserId':Number(_0x4b8ba4[_0x8ca8('0x3c')][_0x8ca8('0x6d')][_0x1def16]),'CmListId':Number(_0x4b8ba4[_0x8ca8('0x5e')]['id'])});}}else{socket[_0x8ca8('0x97')](_0x8ca8('0x98'),{'UserId':Number(_0x4b8ba4[_0x8ca8('0x3c')]['ids']),'CmListId':Number(_0x4b8ba4[_0x8ca8('0x5e')]['id'])});}});}})[_0x8ca8('0x2d')](respondWithStatusCode(_0x33cc3a,null))[_0x8ca8('0x54')](handleError(_0x33cc3a,null));};exports['getAgents']=function(_0x2e60cb,_0x5039b8,_0x3d702c){var _0x119016={};var _0x1fcd6a={};var _0x361b86;var _0x48bd18;return db[_0x8ca8('0x4d')][_0x8ca8('0x63')]({'where':{'id':_0x2e60cb[_0x8ca8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5039b8,null))['then'](function(_0x2efd15){if(_0x2efd15){_0x361b86=_0x2efd15;_0x1fcd6a[_0x8ca8('0x3b')]=_['keys'](db['User']['rawAttributes']);_0x1fcd6a[_0x8ca8('0x3c')]=_['keys'](_0x2e60cb[_0x8ca8('0x3c')]);_0x1fcd6a[_0x8ca8('0x47')]=_['intersection'](_0x1fcd6a[_0x8ca8('0x3b')],_0x1fcd6a[_0x8ca8('0x3c')]);_0x119016['attributes']=_[_0x8ca8('0x3f')](_0x1fcd6a['model'],qs[_0x8ca8('0x40')](_0x2e60cb['query']['fields']));_0x119016[_0x8ca8('0x3e')]=_0x119016['attributes'][_0x8ca8('0x41')]?_0x119016[_0x8ca8('0x3e')]:_0x1fcd6a[_0x8ca8('0x3b')];_0x119016[_0x8ca8('0x44')]=qs[_0x8ca8('0x45')](_0x2e60cb['query'][_0x8ca8('0x45')]);_0x119016[_0x8ca8('0x46')]=qs[_0x8ca8('0x47')](_[_0x8ca8('0x48')](_0x2e60cb[_0x8ca8('0x3c')],_0x1fcd6a['filters']));if(_0x2e60cb[_0x8ca8('0x3c')]['filter']){_0x119016[_0x8ca8('0x46')]=_[_0x8ca8('0x4b')](_0x119016[_0x8ca8('0x46')],{'$or':_[_0x8ca8('0x36')](_0x119016['attributes'],function(_0x77c3a2){var _0x22b8f7={};_0x22b8f7[_0x77c3a2]={'$like':'%'+_0x2e60cb[_0x8ca8('0x3c')][_0x8ca8('0x4a')]+'%'};return _0x22b8f7;})});}_0x119016=_[_0x8ca8('0x4b')]({},_0x119016,_0x2e60cb['options']);return _0x361b86['getAgents'](_0x119016);}})[_0x8ca8('0x2d')](function(_0x59499f){if(_0x59499f){_0x48bd18=_0x59499f[_0x8ca8('0x41')];if(!_0x2e60cb['query'][_0x8ca8('0x42')]('nolimit')){_0x119016[_0x8ca8('0x23')]=qs[_0x8ca8('0x23')](_0x2e60cb[_0x8ca8('0x3c')][_0x8ca8('0x23')]);_0x119016[_0x8ca8('0x25')]=qs['offset'](_0x2e60cb[_0x8ca8('0x3c')][_0x8ca8('0x25')]);}return _0x361b86['getAgents'](_0x119016);}})[_0x8ca8('0x2d')](function(_0x5b07e0){if(_0x5b07e0){return _0x5b07e0?{'count':_0x48bd18,'rows':_0x5b07e0}:null;}})[_0x8ca8('0x2d')](respondWithResult(_0x5039b8,null))[_0x8ca8('0x54')](handleError(_0x5039b8,null));}; \ No newline at end of file +var _0x6d6d=['includeAll','findAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findOne','length','order','ListId','rows','removeDispositions','CmContact','tags','isArray','join','push','each','omit','ids','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','concat','cf_%d','raw','getContactsCsv','format','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','transaction','addCustomFields','text','TEXT','number','Sequelize','INTEGER','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','getCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','then','get','UserProfileResource','destroy','error','stack','name','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x405882,_0x2fd472){var _0x25e4fe=function(_0x443e78){while(--_0x443e78){_0x405882['push'](_0x405882['shift']());}};_0x25e4fe(++_0x2fd472);}(_0x6d6d,0xe0));var _0xd6d6=function(_0x12cfdb,_0x5bd754){_0x12cfdb=_0x12cfdb-0x0;var _0x211ad5=_0x6d6d[_0x12cfdb];return _0x211ad5;};'use strict';var emlformat=require(_0xd6d6('0x0'));var rimraf=require(_0xd6d6('0x1'));var zipdir=require(_0xd6d6('0x2'));var jsonpatch=require(_0xd6d6('0x3'));var rp=require(_0xd6d6('0x4'));var moment=require(_0xd6d6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd6d6('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd6d6('0x7'));var csv=require(_0xd6d6('0x8'));var ejs=require(_0xd6d6('0x9'));var fs=require('fs');var fs_extra=require(_0xd6d6('0xa'));var _=require(_0xd6d6('0xb'));var squel=require(_0xd6d6('0xc'));var crypto=require(_0xd6d6('0xd'));var jsforce=require(_0xd6d6('0xe'));var deskjs=require(_0xd6d6('0xf'));var toCsv=require(_0xd6d6('0x8'));var querystring=require(_0xd6d6('0x10'));var Papa=require(_0xd6d6('0x11'));var Redis=require(_0xd6d6('0x12'));var authService=require(_0xd6d6('0x13'));var qs=require(_0xd6d6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd6d6('0x15'));var utils=require('../../config/utils');var config=require(_0xd6d6('0x16'));var licenseUtil=require(_0xd6d6('0x17'));var db=require('../../mysqldb')['db'];config[_0xd6d6('0x18')]=_[_0xd6d6('0x19')](config[_0xd6d6('0x18')],{'host':_0xd6d6('0x1a'),'port':0x18eb});var socket=require(_0xd6d6('0x1b'))(new Redis(config[_0xd6d6('0x18')]));require(_0xd6d6('0x1c'))[_0xd6d6('0x1d')](socket);function respondWithStatusCode(_0x13e4b9,_0x1febf3){_0x1febf3=_0x1febf3||0xcc;return function(_0x138c55){if(_0x138c55){return _0x13e4b9[_0xd6d6('0x1e')](_0x1febf3);}return _0x13e4b9[_0xd6d6('0x1f')](_0x1febf3)[_0xd6d6('0x20')]();};}function respondWithResult(_0x2ca041,_0x4ea2f0){_0x4ea2f0=_0x4ea2f0||0xc8;return function(_0xc5e0be){if(_0xc5e0be){return _0x2ca041[_0xd6d6('0x1f')](_0x4ea2f0)[_0xd6d6('0x21')](_0xc5e0be);}};}function respondWithFilteredResult(_0x2f0fcc,_0x36611b){return function(_0x1301e7){if(_0x1301e7){var _0x50d26f=typeof _0x36611b['offset']===_0xd6d6('0x22')&&typeof _0x36611b[_0xd6d6('0x23')]===_0xd6d6('0x22');var _0x10ca89=_0x1301e7[_0xd6d6('0x24')];var _0x4eec82=_0x50d26f?0x0:_0x36611b[_0xd6d6('0x25')];var _0x1870c0=_0x50d26f?_0x1301e7[_0xd6d6('0x24')]:_0x36611b[_0xd6d6('0x25')]+_0x36611b['limit'];var _0x3137f2;if(_0x1870c0>=_0x10ca89){_0x1870c0=_0x10ca89;_0x3137f2=0xc8;}else{_0x3137f2=0xce;}_0x2f0fcc[_0xd6d6('0x1f')](_0x3137f2);return _0x2f0fcc['set']('Content-Range',_0x4eec82+'-'+_0x1870c0+'/'+_0x10ca89)[_0xd6d6('0x21')](_0x1301e7);}return null;};}function patchUpdates(_0x186a42){return function(_0x585505){try{jsonpatch['apply'](_0x585505,_0x186a42,!![]);}catch(_0xbc3876){return BPromise['reject'](_0xbc3876);}return _0x585505['save']();};}function saveUpdates(_0x421356,_0x2ef58e){return function(_0x15a0f1){if(_0x15a0f1){return _0x15a0f1['update'](_0x421356)[_0xd6d6('0x26')](function(_0x3f16d2){return _0x3f16d2;});}return null;};}function removeEntity(_0x31405c,_0x492057){return function(_0x2a86aa){if(_0x2a86aa){return _0x2a86aa['destroy']()['then'](function(){var _0x4cb6c7=_0x2a86aa[_0xd6d6('0x27')]({'plain':!![]});var _0x5c55cf='Lists';return db[_0xd6d6('0x28')][_0xd6d6('0x29')]({'where':{'type':_0x5c55cf,'resourceId':_0x4cb6c7['id']}})[_0xd6d6('0x26')](function(){return _0x2a86aa;});})['then'](function(){_0x31405c[_0xd6d6('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1016a5,_0x1a9ef1){return function(_0x50c837){if(!_0x50c837){_0x1016a5['sendStatus'](0x194);}return _0x50c837;};}function handleError(_0x352ef0,_0xfb4381){_0xfb4381=_0xfb4381||0x1f4;return function(_0x59a822){logger[_0xd6d6('0x2a')](_0x59a822[_0xd6d6('0x2b')]);if(_0x59a822[_0xd6d6('0x2c')]){delete _0x59a822['name'];}_0x352ef0['status'](_0xfb4381)['send'](_0x59a822);};}exports[_0xd6d6('0x2d')]=function(_0x48c644,_0x169830){var _0x187234={},_0x294852={},_0x4994a2={'count':0x0,'rows':[]};var _0x27060d=_[_0xd6d6('0x2e')](db[_0xd6d6('0x2f')][_0xd6d6('0x30')],function(_0x8958f2){return{'name':_0x8958f2[_0xd6d6('0x31')],'type':_0x8958f2[_0xd6d6('0x32')][_0xd6d6('0x33')]};});_0x294852[_0xd6d6('0x34')]=_[_0xd6d6('0x2e')](_0x27060d,'name');_0x294852[_0xd6d6('0x35')]=_[_0xd6d6('0x36')](_0x48c644[_0xd6d6('0x35')]);_0x294852[_0xd6d6('0x37')]=_[_0xd6d6('0x38')](_0x294852[_0xd6d6('0x34')],_0x294852[_0xd6d6('0x35')]);_0x187234[_0xd6d6('0x39')]=_[_0xd6d6('0x38')](_0x294852[_0xd6d6('0x34')],qs[_0xd6d6('0x3a')](_0x48c644[_0xd6d6('0x35')][_0xd6d6('0x3a')]));_0x187234['attributes']=_0x187234[_0xd6d6('0x39')]['length']?_0x187234[_0xd6d6('0x39')]:_0x294852['model'];if(!_0x48c644[_0xd6d6('0x35')][_0xd6d6('0x3b')](_0xd6d6('0x3c'))){_0x187234[_0xd6d6('0x23')]=qs['limit'](_0x48c644[_0xd6d6('0x35')]['limit']);_0x187234[_0xd6d6('0x25')]=qs[_0xd6d6('0x25')](_0x48c644['query'][_0xd6d6('0x25')]);}_0x187234['order']=qs[_0xd6d6('0x3d')](_0x48c644[_0xd6d6('0x35')][_0xd6d6('0x3d')]);_0x187234[_0xd6d6('0x3e')]=qs[_0xd6d6('0x37')](_[_0xd6d6('0x3f')](_0x48c644[_0xd6d6('0x35')],_0x294852[_0xd6d6('0x37')]),_0x27060d);if(_0x48c644['query'][_0xd6d6('0x40')]){_0x187234[_0xd6d6('0x3e')]=_[_0xd6d6('0x41')](_0x187234[_0xd6d6('0x3e')],{'$or':_[_0xd6d6('0x2e')](_0x27060d,function(_0x4d8fec){if(_0x4d8fec['type']!==_0xd6d6('0x42')){var _0x25305f={};_0x25305f[_0x4d8fec['name']]={'$like':'%'+_0x48c644['query'][_0xd6d6('0x40')]+'%'};return _0x25305f;}})});}_0x187234=_[_0xd6d6('0x41')]({},_0x187234,_0x48c644[_0xd6d6('0x43')]);var _0x9b5345={'where':_0x187234[_0xd6d6('0x3e')]};return db['CmList'][_0xd6d6('0x24')](_0x9b5345)[_0xd6d6('0x26')](function(_0x5ab8eb){_0x4994a2[_0xd6d6('0x24')]=_0x5ab8eb;if(_0x48c644['query'][_0xd6d6('0x44')]){_0x187234['include']=[{'all':!![]}];}return db[_0xd6d6('0x2f')][_0xd6d6('0x45')](_0x187234);})[_0xd6d6('0x26')](function(_0x9faed9){_0x4994a2['rows']=_0x9faed9;return _0x4994a2;})[_0xd6d6('0x26')](respondWithFilteredResult(_0x169830,_0x187234))[_0xd6d6('0x46')](handleError(_0x169830,null));};exports[_0xd6d6('0x47')]=function(_0x1d5fd1,_0x1a0b2f){var _0x2de613={'raw':![],'where':{'id':_0x1d5fd1[_0xd6d6('0x48')]['id']}},_0x5dbf18={};_0x5dbf18[_0xd6d6('0x34')]=_['keys'](db[_0xd6d6('0x2f')][_0xd6d6('0x30')]);_0x5dbf18[_0xd6d6('0x35')]=_[_0xd6d6('0x36')](_0x1d5fd1[_0xd6d6('0x35')]);_0x5dbf18['filters']=_[_0xd6d6('0x38')](_0x5dbf18[_0xd6d6('0x34')],_0x5dbf18[_0xd6d6('0x35')]);_0x2de613[_0xd6d6('0x39')]=_[_0xd6d6('0x38')](_0x5dbf18[_0xd6d6('0x34')],qs['fields'](_0x1d5fd1[_0xd6d6('0x35')][_0xd6d6('0x3a')]));_0x2de613['attributes']=_0x2de613[_0xd6d6('0x39')]['length']?_0x2de613[_0xd6d6('0x39')]:_0x5dbf18[_0xd6d6('0x34')];if(_0x1d5fd1[_0xd6d6('0x35')]['includeAll']){_0x2de613[_0xd6d6('0x49')]=[{'all':!![]}];}_0x2de613=_[_0xd6d6('0x41')]({},_0x2de613,_0x1d5fd1['options']);return db[_0xd6d6('0x2f')][_0xd6d6('0x4a')](_0x2de613)['then'](handleEntityNotFound(_0x1a0b2f,null))[_0xd6d6('0x26')](respondWithResult(_0x1a0b2f,null))[_0xd6d6('0x46')](handleError(_0x1a0b2f,null));};exports[_0xd6d6('0x4b')]=function(_0x1bfe83,_0x3121b3){return db[_0xd6d6('0x2f')]['create'](_0x1bfe83[_0xd6d6('0x4c')],{})['then'](function(_0x3fe5c1){var _0x189ae6=_0x1bfe83[_0xd6d6('0x4d')][_0xd6d6('0x27')]({'plain':!![]});if(!_0x189ae6)throw new Error(_0xd6d6('0x4e'));if(_0x189ae6['role']===_0xd6d6('0x4d')){var _0x34fcf5=_0x3fe5c1[_0xd6d6('0x27')]({'plain':!![]});var _0x4d78d5=_0xd6d6('0x4f');return db[_0xd6d6('0x50')][_0xd6d6('0x4a')]({'where':{'name':_0x4d78d5,'userProfileId':_0x189ae6['userProfileId']},'raw':!![]})[_0xd6d6('0x26')](function(_0x23822c){if(_0x23822c&&_0x23822c[_0xd6d6('0x51')]===0x0){return db[_0xd6d6('0x28')]['create']({'name':_0x34fcf5[_0xd6d6('0x2c')],'resourceId':_0x34fcf5['id'],'type':_0x23822c[_0xd6d6('0x2c')],'sectionId':_0x23822c['id']},{})['then'](function(){return _0x3fe5c1;});}else{return _0x3fe5c1;}})[_0xd6d6('0x46')](function(_0x1f98c0){logger[_0xd6d6('0x2a')](_0xd6d6('0x52'),_0x1f98c0);throw _0x1f98c0;});}return _0x3fe5c1;})['then'](respondWithResult(_0x3121b3,0xc9))['catch'](handleError(_0x3121b3,null));};exports[_0xd6d6('0x53')]=function(_0x53533a,_0x4c520f){if(_0x53533a['body']['id']){delete _0x53533a[_0xd6d6('0x4c')]['id'];}return db['CmList'][_0xd6d6('0x4a')]({'where':{'id':_0x53533a['params']['id']}})['then'](handleEntityNotFound(_0x4c520f,null))['then'](saveUpdates(_0x53533a['body'],null))['then'](respondWithResult(_0x4c520f,null))['catch'](handleError(_0x4c520f,null));};exports[_0xd6d6('0x29')]=function(_0x58926f,_0x110f7a){return db['CmList'][_0xd6d6('0x4a')]({'where':{'id':_0x58926f[_0xd6d6('0x48')]['id']}})['then'](handleEntityNotFound(_0x110f7a,null))[_0xd6d6('0x26')](removeEntity(_0x110f7a,null))[_0xd6d6('0x46')](handleError(_0x110f7a,null));};exports[_0xd6d6('0x54')]=function(_0x5f5332,_0x483e4b){return db[_0xd6d6('0x2f')][_0xd6d6('0x54')]()[_0xd6d6('0x26')](respondWithResult(_0x483e4b,null))[_0xd6d6('0x46')](handleError(_0x483e4b,null));};exports[_0xd6d6('0x55')]=function(_0x49cdf3,_0x24cabe,_0x4d0433){if(_0x49cdf3[_0xd6d6('0x4c')]['id']){delete _0x49cdf3['body']['id'];}return db['CmList'][_0xd6d6('0x4a')]({'where':{'id':_0x49cdf3[_0xd6d6('0x48')]['id']}})[_0xd6d6('0x26')](handleEntityNotFound(_0x24cabe,null))[_0xd6d6('0x26')](function(_0x2367e5){if(_0x2367e5){_0x49cdf3[_0xd6d6('0x4c')]['ListId']=_0x2367e5['id'];return db[_0xd6d6('0x56')][_0xd6d6('0x4b')](_0x49cdf3[_0xd6d6('0x4c')]);}})[_0xd6d6('0x26')](respondWithResult(_0x24cabe,null))[_0xd6d6('0x46')](handleError(_0x24cabe,null));};exports[_0xd6d6('0x57')]=function(_0xdd8af2,_0x1856cb,_0x489461){var _0x500f01={'raw':![],'where':{}};var _0x2f7e65={};var _0x5a7808={'count':0x0,'rows':[]};return db[_0xd6d6('0x2f')][_0xd6d6('0x58')]({'where':{'id':_0xdd8af2[_0xd6d6('0x48')]['id']}})['then'](handleEntityNotFound(_0x1856cb,null))['then'](function(_0x494503){if(_0x494503){_0x2f7e65[_0xd6d6('0x34')]=_[_0xd6d6('0x36')](db[_0xd6d6('0x56')][_0xd6d6('0x30')]);_0x2f7e65[_0xd6d6('0x35')]=_[_0xd6d6('0x36')](_0xdd8af2[_0xd6d6('0x35')]);_0x2f7e65[_0xd6d6('0x37')]=_[_0xd6d6('0x38')](_0x2f7e65['model'],_0x2f7e65[_0xd6d6('0x35')]);_0x500f01[_0xd6d6('0x39')]=_[_0xd6d6('0x38')](_0x2f7e65['model'],qs[_0xd6d6('0x3a')](_0xdd8af2['query'][_0xd6d6('0x3a')]));_0x500f01[_0xd6d6('0x39')]=_0x500f01[_0xd6d6('0x39')][_0xd6d6('0x59')]?_0x500f01[_0xd6d6('0x39')]:_0x2f7e65[_0xd6d6('0x34')];if(!_0xdd8af2[_0xd6d6('0x35')][_0xd6d6('0x3b')](_0xd6d6('0x3c'))){_0x500f01['limit']=qs[_0xd6d6('0x23')](_0xdd8af2[_0xd6d6('0x35')]['limit']);_0x500f01[_0xd6d6('0x25')]=qs[_0xd6d6('0x25')](_0xdd8af2[_0xd6d6('0x35')][_0xd6d6('0x25')]);}_0x500f01[_0xd6d6('0x5a')]=qs[_0xd6d6('0x3d')](_0xdd8af2[_0xd6d6('0x35')][_0xd6d6('0x3d')]);_0x500f01[_0xd6d6('0x3e')]=qs[_0xd6d6('0x37')](_['pick'](_0xdd8af2[_0xd6d6('0x35')],_0x2f7e65[_0xd6d6('0x37')]));_0x500f01[_0xd6d6('0x3e')][_0xd6d6('0x5b')]=_0x494503['id'];if(_0xdd8af2[_0xd6d6('0x35')]['filter']){_0x500f01[_0xd6d6('0x3e')]=_[_0xd6d6('0x41')](_0x500f01[_0xd6d6('0x3e')],{'$or':_[_0xd6d6('0x2e')](_0x500f01[_0xd6d6('0x39')],function(_0x48a39f){var _0x17107d={};_0x17107d[_0x48a39f]={'$like':'%'+_0xdd8af2[_0xd6d6('0x35')][_0xd6d6('0x40')]+'%'};return _0x17107d;})});}_0x500f01=_['merge']({},_0x500f01,_0xdd8af2[_0xd6d6('0x43')]);return db[_0xd6d6('0x56')][_0xd6d6('0x24')]({'where':_0x500f01['where']})['then'](function(_0x8e5ae8){_0x5a7808['count']=_0x8e5ae8;if(_0xdd8af2[_0xd6d6('0x35')][_0xd6d6('0x44')]){_0x500f01[_0xd6d6('0x49')]=[{'all':!![]}];}return db[_0xd6d6('0x56')][_0xd6d6('0x45')](_0x500f01);})[_0xd6d6('0x26')](function(_0x56e74b){_0x5a7808[_0xd6d6('0x5c')]=_0x56e74b;return _0x5a7808;});}})[_0xd6d6('0x26')](respondWithFilteredResult(_0x1856cb,_0x500f01))[_0xd6d6('0x46')](handleError(_0x1856cb,null));};exports['removeDispositions']=function(_0x15b7ce,_0x47fa05,_0x8c6ea9){return db['CmList'][_0xd6d6('0x4a')]({'where':{'id':_0x15b7ce[_0xd6d6('0x48')]['id']}})[_0xd6d6('0x26')](handleEntityNotFound(_0x47fa05,null))['then'](function(_0x181faa){if(_0x181faa){return _0x181faa[_0xd6d6('0x5d')](_0x15b7ce[_0xd6d6('0x35')]['ids']);}})[_0xd6d6('0x26')](respondWithStatusCode(_0x47fa05,null))[_0xd6d6('0x46')](handleError(_0x47fa05,null));};exports['addContacts']=function(_0x13d5c9,_0x3af37b,_0x55f13c){return db[_0xd6d6('0x2f')][_0xd6d6('0x4a')]({'where':{'id':_0x13d5c9[_0xd6d6('0x48')]['id']}})[_0xd6d6('0x26')](handleEntityNotFound(_0x3af37b,null))[_0xd6d6('0x26')](function(_0x578aa7){if(_0x578aa7){var _0x42baba=[];var _0x2f0a33={'success':[],'errors':[]};return db[_0xd6d6('0x5e')]['describe']()['then'](function(_0x4d62ab){if(_0x13d5c9[_0xd6d6('0x4c')][_0xd6d6('0x5f')]&&_[_0xd6d6('0x60')](_0x13d5c9[_0xd6d6('0x4c')][_0xd6d6('0x5f')])){if(_0x13d5c9[_0xd6d6('0x4c')][_0xd6d6('0x5f')]['length']){_0x13d5c9['body'][_0xd6d6('0x5f')]=_0x13d5c9[_0xd6d6('0x4c')][_0xd6d6('0x5f')][_0xd6d6('0x61')](';')+';';}else{_0x13d5c9['body']['tags']=null;}}else{_0x13d5c9[_0xd6d6('0x4c')]['tags']=null;}if(_0x13d5c9['body']&&_['isArray'](_0x13d5c9[_0xd6d6('0x4c')])){for(var _0x207e7e=0x0;_0x207e7e<_0x13d5c9[_0xd6d6('0x4c')][_0xd6d6('0x59')];_0x207e7e+=0x1){_0x13d5c9[_0xd6d6('0x4c')][_0x207e7e][_0xd6d6('0x5b')]=_0x13d5c9['params']['id'];_0x42baba[_0xd6d6('0x62')](_0x13d5c9[_0xd6d6('0x4c')][_0x207e7e]);}return BPromise[_0xd6d6('0x63')](_0x42baba,function(_0x9f4026){return db[_0xd6d6('0x5e')][_0xd6d6('0x4b')](_[_0xd6d6('0x64')](_0x9f4026,[_0xd6d6('0x65'),'id'])||{},{'fields':_[_0xd6d6('0x36')](_0x4d62ab),'raw':!![]})[_0xd6d6('0x26')](function(_0x5099d8){_0x2f0a33[_0xd6d6('0x66')][_0xd6d6('0x62')](_0x5099d8[_0xd6d6('0x67')]);})[_0xd6d6('0x46')](function(_0x379c6c){_0x2f0a33[_0xd6d6('0x68')][_0xd6d6('0x62')]({'data':_0x9f4026,'error':_0x379c6c[_0xd6d6('0x69')]});});})['then'](function(_0x109317){return _0x2f0a33;})[_0xd6d6('0x46')](function(_0x46932e){return _0x46932e;});}else{_0x3af37b['status'](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0xd6d6('0x26')](respondWithResult(_0x3af37b,null))[_0xd6d6('0x46')](handleError(_0x3af37b,null));};exports[_0xd6d6('0x6a')]=function(_0xe1696,_0x107ab7,_0x4cf31a){var _0x303197;return db['CmList'][_0xd6d6('0x4a')]({'where':{'id':_0xe1696[_0xd6d6('0x48')]['id']},'include':[{'model':db[_0xd6d6('0x6b')],'as':_0xd6d6('0x6c')}]})[_0xd6d6('0x26')](handleEntityNotFound(_0x107ab7,null))[_0xd6d6('0x26')](function(_0x15023f){if(_0x15023f){_0x303197=_0x15023f;return db['CmContact'][_0xd6d6('0x30')];}})['then'](function(_0x59bab7){if(_0x59bab7){var _0x840372={};var _0x23649a={};_0x23649a['model']=_[_0xd6d6('0x6d')](_[_0xd6d6('0x36')](_0x59bab7),_['map'](_0x303197['CustomFields'],function(_0x4fe8da){return util['format'](_0xd6d6('0x6e'),_0x4fe8da['id']);}));_0x23649a[_0xd6d6('0x35')]=_[_0xd6d6('0x36')](_0xe1696[_0xd6d6('0x35')]);_0x23649a['filters']=_[_0xd6d6('0x38')](_0x23649a[_0xd6d6('0x34')],_0x23649a[_0xd6d6('0x35')]);_0x840372['attributes']=_['intersection'](_0x23649a[_0xd6d6('0x34')],qs['fields'](_0xe1696['query'][_0xd6d6('0x3a')]));_0x840372['attributes']=_0x840372[_0xd6d6('0x39')]['length']?_0x840372[_0xd6d6('0x39')]:_0x23649a[_0xd6d6('0x34')];if(!_0xe1696[_0xd6d6('0x35')][_0xd6d6('0x3b')](_0xd6d6('0x3c'))){_0x840372['limit']=qs['limit'](_0xe1696[_0xd6d6('0x35')][_0xd6d6('0x23')]);_0x840372[_0xd6d6('0x25')]=qs[_0xd6d6('0x25')](_0xe1696[_0xd6d6('0x35')][_0xd6d6('0x25')]);}_0x840372['order']=qs[_0xd6d6('0x3d')](_0xe1696['query'][_0xd6d6('0x3d')]);_0x840372[_0xd6d6('0x3e')]=qs['filters'](_[_0xd6d6('0x3f')](_0xe1696['query'],_0x23649a[_0xd6d6('0x37')]));_0x840372[_0xd6d6('0x6f')]=!![];if(_0xe1696[_0xd6d6('0x35')]['filter']){_0x840372['where']=_[_0xd6d6('0x41')](_0x840372[_0xd6d6('0x3e')],{'$or':_['map'](_0x840372[_0xd6d6('0x39')],function(_0x2a8d2a){var _0x516b5d={};_0x516b5d[_0x2a8d2a]={'$like':'%'+_0xe1696['query'][_0xd6d6('0x40')]+'%'};return _0x516b5d;})});}_0x840372=_['merge']({},_0x840372,_0xe1696['options']);return _0x303197[_0xd6d6('0x6a')](_0x840372);}})['then'](respondWithResult(_0x107ab7,null))[_0xd6d6('0x46')](handleError(_0x107ab7,null));};exports[_0xd6d6('0x70')]=function(_0x54c5e8,_0x36a4a9,_0x21ca30){var _0x309242;return db[_0xd6d6('0x2f')][_0xd6d6('0x4a')]({'where':{'id':_0x54c5e8[_0xd6d6('0x48')]['id']},'include':[{'model':db[_0xd6d6('0x6b')],'as':_0xd6d6('0x6c')}]})[_0xd6d6('0x26')](handleEntityNotFound(_0x36a4a9,null))[_0xd6d6('0x26')](function(_0x2fccf5){if(_0x2fccf5){_0x309242=_0x2fccf5;return db[_0xd6d6('0x5e')]['rawAttributes'];}})[_0xd6d6('0x26')](function(_0x241f37){if(_0x241f37){var _0xc28475={};var _0x569de4={};_0x569de4[_0xd6d6('0x34')]=_[_0xd6d6('0x6d')](_[_0xd6d6('0x36')](_0x241f37),_[_0xd6d6('0x2e')](_0x309242[_0xd6d6('0x6c')],function(_0x11b921){return util[_0xd6d6('0x71')](_0xd6d6('0x6e'),_0x11b921['id']);}));_0x569de4['query']=_[_0xd6d6('0x36')](_0x54c5e8[_0xd6d6('0x35')]);_0x569de4[_0xd6d6('0x37')]=_[_0xd6d6('0x38')](_0x569de4[_0xd6d6('0x34')],_0x569de4[_0xd6d6('0x35')]);_0xc28475[_0xd6d6('0x39')]=_[_0xd6d6('0x38')](_0x569de4['model'],qs[_0xd6d6('0x3a')](_0x54c5e8[_0xd6d6('0x35')][_0xd6d6('0x3a')]));_0xc28475[_0xd6d6('0x39')]=_0xc28475[_0xd6d6('0x39')]['length']?_0xc28475[_0xd6d6('0x39')]:_0x569de4[_0xd6d6('0x34')];if(!_0x54c5e8[_0xd6d6('0x35')][_0xd6d6('0x3b')](_0xd6d6('0x3c'))){_0xc28475[_0xd6d6('0x23')]=qs[_0xd6d6('0x23')](_0x54c5e8[_0xd6d6('0x35')][_0xd6d6('0x23')]);_0xc28475[_0xd6d6('0x25')]=qs[_0xd6d6('0x25')](_0x54c5e8[_0xd6d6('0x35')][_0xd6d6('0x25')]);}_0xc28475['order']=qs[_0xd6d6('0x3d')](_0x54c5e8[_0xd6d6('0x35')][_0xd6d6('0x3d')]);_0xc28475[_0xd6d6('0x3e')]=qs[_0xd6d6('0x37')](_[_0xd6d6('0x3f')](_0x54c5e8[_0xd6d6('0x35')],_0x569de4[_0xd6d6('0x37')]));_0xc28475['raw']=!![];if(_0x54c5e8[_0xd6d6('0x35')][_0xd6d6('0x40')]){_0xc28475[_0xd6d6('0x3e')]=_[_0xd6d6('0x41')](_0xc28475[_0xd6d6('0x3e')],{'$or':_[_0xd6d6('0x2e')](_0xc28475[_0xd6d6('0x39')],function(_0x40c9de){var _0x5a835d={};_0x5a835d[_0x40c9de]={'$like':'%'+_0x54c5e8[_0xd6d6('0x35')][_0xd6d6('0x40')]+'%'};return _0x5a835d;})});}_0xc28475=_[_0xd6d6('0x41')]({},_0xc28475,_0x54c5e8[_0xd6d6('0x43')]);return _0x309242[_0xd6d6('0x6a')](_0xc28475);}})[_0xd6d6('0x26')](function(_0x1cb63b){if(!_[_0xd6d6('0x72')](_0x1cb63b)){var _0x4eae88=toCsv(_0x1cb63b);var _0x50f43f=Date[_0xd6d6('0x73')]();fs['writeFileSync'](util[_0xd6d6('0x71')](_0xd6d6('0x74'),_0x309242['id'],_0x50f43f),_0x4eae88);_0x36a4a9[_0xd6d6('0x75')](_0xd6d6('0x76'),_0xd6d6('0x77')+util['format'](_0xd6d6('0x78'),_0x309242['id'],_0x50f43f));_0x36a4a9[_0xd6d6('0x75')](_0xd6d6('0x79'),_0xd6d6('0x7a'));return _0x36a4a9[_0xd6d6('0x7b')](util[_0xd6d6('0x71')](_0xd6d6('0x74'),_0x309242['id'],_0x50f43f));}else{return _0x36a4a9[_0xd6d6('0x1e')](0xcc);}})[_0xd6d6('0x46')](handleError(_0x36a4a9,null));};exports[_0xd6d6('0x7c')]=function(_0x5820af,_0x4bca67,_0x52a94a){var _0x5975ab;delete _0x5820af[_0xd6d6('0x4c')]['id'];return db[_0xd6d6('0x2f')][_0xd6d6('0x58')]({'where':{'id':_0x5820af[_0xd6d6('0x48')]['id']}})[_0xd6d6('0x26')](handleEntityNotFound(_0x4bca67,null))['then'](function(_0x3861e6){if(_0x3861e6){return db['sequelize'][_0xd6d6('0x7d')](function(_0x2562c6){return db[_0xd6d6('0x6b')][_0xd6d6('0x4b')](_0x5820af[_0xd6d6('0x4c')],{'transaction':_0x2562c6})[_0xd6d6('0x26')](function(_0x5909b6){_0x5975ab=_0x5909b6;return _0x3861e6[_0xd6d6('0x7e')](_0x5909b6,{'transaction':_0x2562c6});})[_0xd6d6('0x26')](function(){var _0x556b4a={'type':db['Sequelize']['TEXT'],'transaction':_0x2562c6};switch(_0x5820af[_0xd6d6('0x4c')][_0xd6d6('0x32')]){case _0xd6d6('0x7f'):_0x556b4a['type']=db['Sequelize'][_0xd6d6('0x80')];break;case _0xd6d6('0x81'):_0x556b4a['type']=db[_0xd6d6('0x82')][_0xd6d6('0x83')];break;case'switch':_0x556b4a[_0xd6d6('0x32')]=db[_0xd6d6('0x82')]['BOOLEAN'];_0x556b4a[_0xd6d6('0x84')]=![];break;default:}return db[_0xd6d6('0x85')][_0xd6d6('0x86')][_0xd6d6('0x87')](_0xd6d6('0x88'),util[_0xd6d6('0x71')]('cf_%s',_0x5975ab['id']),_0x556b4a);})[_0xd6d6('0x26')](function(){return _0x5975ab;});});}})[_0xd6d6('0x26')](respondWithResult(_0x4bca67,null))[_0xd6d6('0x46')](handleError(_0x4bca67,null));};exports[_0xd6d6('0x89')]=function(_0x58630b,_0xdb8dcf,_0x237360){var _0x56502f={};var _0x1fcaa4={};var _0x486636;var _0x270a67;return db['CmList'][_0xd6d6('0x58')]({'where':{'id':_0x58630b[_0xd6d6('0x48')]['id']}})[_0xd6d6('0x26')](handleEntityNotFound(_0xdb8dcf,null))['then'](function(_0x5cd40b){if(_0x5cd40b){_0x486636=_0x5cd40b;_0x1fcaa4[_0xd6d6('0x34')]=_[_0xd6d6('0x36')](db['CmCustomField'][_0xd6d6('0x30')]);_0x1fcaa4[_0xd6d6('0x35')]=_[_0xd6d6('0x36')](_0x58630b[_0xd6d6('0x35')]);_0x1fcaa4[_0xd6d6('0x37')]=_['intersection'](_0x1fcaa4['model'],_0x1fcaa4['query']);_0x56502f[_0xd6d6('0x39')]=_[_0xd6d6('0x38')](_0x1fcaa4['model'],qs['fields'](_0x58630b[_0xd6d6('0x35')][_0xd6d6('0x3a')]));_0x56502f[_0xd6d6('0x39')]=_0x56502f[_0xd6d6('0x39')]['length']?_0x56502f[_0xd6d6('0x39')]:_0x1fcaa4[_0xd6d6('0x34')];_0x56502f[_0xd6d6('0x5a')]=qs[_0xd6d6('0x3d')](_0x58630b[_0xd6d6('0x35')][_0xd6d6('0x3d')]);_0x56502f[_0xd6d6('0x3e')]=qs[_0xd6d6('0x37')](_[_0xd6d6('0x3f')](_0x58630b[_0xd6d6('0x35')],_0x1fcaa4[_0xd6d6('0x37')]));_0x56502f['where']=_['merge'](_0x56502f['where'],{'$or':[{'ListId':_0x5cd40b['id']},{'ListId':null}]});if(_0x58630b[_0xd6d6('0x35')][_0xd6d6('0x40')]){_0x56502f[_0xd6d6('0x3e')]=_[_0xd6d6('0x41')](_0x56502f['where'],{'$or':_[_0xd6d6('0x2e')](_0x56502f[_0xd6d6('0x39')],function(_0x4b1090){var _0x2b620a={};_0x2b620a[_0x4b1090]={'$like':'%'+_0x58630b[_0xd6d6('0x35')][_0xd6d6('0x40')]+'%'};return _0x2b620a;})});}_0x56502f=_[_0xd6d6('0x41')]({},_0x56502f,_0x58630b['options']);return db['CmCustomField']['findAndCountAll'](_0x56502f);}})['then'](respondWithResult(_0xdb8dcf,null))['catch'](handleError(_0xdb8dcf,null));};exports[_0xd6d6('0x8a')]=function(_0x760a1a,_0x5a9f34,_0x1b74ad){return db[_0xd6d6('0x2f')]['find']({'where':{'id':_0x760a1a['params']['id']}})[_0xd6d6('0x26')](handleEntityNotFound(_0x5a9f34,null))[_0xd6d6('0x26')](function(_0x36cf8e){if(_0x36cf8e){return _0x36cf8e[_0xd6d6('0x8a')](_0x760a1a['body']['ids'],_['omit'](_0x760a1a[_0xd6d6('0x4c')],['ids','id'])||{})[_0xd6d6('0x8b')](function(_0x38dcc2){for(var _0x2ff1c0=0x0;_0x2ff1c0<_0x760a1a[_0xd6d6('0x4c')]['ids'][_0xd6d6('0x59')];_0x2ff1c0+=0x1){socket[_0xd6d6('0x8c')](_0xd6d6('0x8d'),{'UserId':Number(_0x760a1a[_0xd6d6('0x4c')]['ids'][_0x2ff1c0]),'CmListId':Number(_0x760a1a[_0xd6d6('0x48')]['id'])});}return _0x38dcc2;});}})[_0xd6d6('0x26')](respondWithResult(_0x5a9f34,null))[_0xd6d6('0x46')](handleError(_0x5a9f34,null));};exports[_0xd6d6('0x8e')]=function(_0x474800,_0x15d4c6,_0x580850){return db[_0xd6d6('0x2f')][_0xd6d6('0x4a')]({'where':{'id':_0x474800['params']['id']}})[_0xd6d6('0x26')](handleEntityNotFound(_0x15d4c6,null))[_0xd6d6('0x26')](function(_0x2e4d5f){if(_0x2e4d5f){return _0x2e4d5f['removeAgents'](_0x474800['query'][_0xd6d6('0x65')])[_0xd6d6('0x26')](function(){if(_[_0xd6d6('0x60')](_0x474800['query'][_0xd6d6('0x65')])){for(var _0x4d01fe=0x0;_0x4d01fe<_0x474800[_0xd6d6('0x35')]['ids']['length'];_0x4d01fe+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x474800[_0xd6d6('0x35')][_0xd6d6('0x65')][_0x4d01fe]),'CmListId':Number(_0x474800['params']['id'])});}}else{socket[_0xd6d6('0x8c')](_0xd6d6('0x8f'),{'UserId':Number(_0x474800[_0xd6d6('0x35')][_0xd6d6('0x65')]),'CmListId':Number(_0x474800[_0xd6d6('0x48')]['id'])});}});}})[_0xd6d6('0x26')](respondWithStatusCode(_0x15d4c6,null))['catch'](handleError(_0x15d4c6,null));};exports[_0xd6d6('0x90')]=function(_0x31903d,_0x591672,_0x4ad628){var _0x1cb5a8={};var _0x4e241e={};var _0x122c09;var _0x5131c7;return db[_0xd6d6('0x2f')]['findOne']({'where':{'id':_0x31903d[_0xd6d6('0x48')]['id']}})[_0xd6d6('0x26')](handleEntityNotFound(_0x591672,null))[_0xd6d6('0x26')](function(_0x36e5da){if(_0x36e5da){_0x122c09=_0x36e5da;_0x4e241e['model']=_['keys'](db[_0xd6d6('0x91')][_0xd6d6('0x30')]);_0x4e241e['query']=_[_0xd6d6('0x36')](_0x31903d[_0xd6d6('0x35')]);_0x4e241e[_0xd6d6('0x37')]=_[_0xd6d6('0x38')](_0x4e241e[_0xd6d6('0x34')],_0x4e241e[_0xd6d6('0x35')]);_0x1cb5a8[_0xd6d6('0x39')]=_[_0xd6d6('0x38')](_0x4e241e[_0xd6d6('0x34')],qs[_0xd6d6('0x3a')](_0x31903d[_0xd6d6('0x35')][_0xd6d6('0x3a')]));_0x1cb5a8[_0xd6d6('0x39')]=_0x1cb5a8[_0xd6d6('0x39')][_0xd6d6('0x59')]?_0x1cb5a8[_0xd6d6('0x39')]:_0x4e241e[_0xd6d6('0x34')];_0x1cb5a8[_0xd6d6('0x5a')]=qs[_0xd6d6('0x3d')](_0x31903d[_0xd6d6('0x35')][_0xd6d6('0x3d')]);_0x1cb5a8['where']=qs[_0xd6d6('0x37')](_['pick'](_0x31903d[_0xd6d6('0x35')],_0x4e241e[_0xd6d6('0x37')]));if(_0x31903d[_0xd6d6('0x35')][_0xd6d6('0x40')]){_0x1cb5a8[_0xd6d6('0x3e')]=_['merge'](_0x1cb5a8[_0xd6d6('0x3e')],{'$or':_['map'](_0x1cb5a8[_0xd6d6('0x39')],function(_0x1f133){var _0x2e0062={};_0x2e0062[_0x1f133]={'$like':'%'+_0x31903d['query'][_0xd6d6('0x40')]+'%'};return _0x2e0062;})});}_0x1cb5a8=_['merge']({},_0x1cb5a8,_0x31903d[_0xd6d6('0x43')]);return _0x122c09[_0xd6d6('0x90')](_0x1cb5a8);}})[_0xd6d6('0x26')](function(_0x55ce9f){if(_0x55ce9f){_0x5131c7=_0x55ce9f['length'];if(!_0x31903d[_0xd6d6('0x35')][_0xd6d6('0x3b')](_0xd6d6('0x3c'))){_0x1cb5a8[_0xd6d6('0x23')]=qs[_0xd6d6('0x23')](_0x31903d[_0xd6d6('0x35')][_0xd6d6('0x23')]);_0x1cb5a8['offset']=qs['offset'](_0x31903d[_0xd6d6('0x35')][_0xd6d6('0x25')]);}return _0x122c09[_0xd6d6('0x90')](_0x1cb5a8);}})['then'](function(_0x45509a){if(_0x45509a){return _0x45509a?{'count':_0x5131c7,'rows':_0x45509a}:null;}})['then'](respondWithResult(_0x591672,null))['catch'](handleError(_0x591672,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 4d3e5b8..4d1f7d2 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 _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x1829fd,_0x33b470){var _0x177d22=function(_0x595874){while(--_0x595874){_0x1829fd['push'](_0x1829fd['shift']());}};_0x177d22(++_0x33b470);}(_0x814b,0x1a2));var _0xb814=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x814b[_0x5d7227];return _0x15ac55;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x91e5fc,_0x34d314){_0x91e5fc=_0x91e5fc-0x0;var _0xdd79a6=_0x3e74[_0x91e5fc];return _0xdd79a6;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 445d462..def8557 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 _0x6c76=['define','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x31f5b0,_0x13d293){var _0x2d73b3=function(_0xf0a647){while(--_0xf0a647){_0x31f5b0['push'](_0x31f5b0['shift']());}};_0x2d73b3(++_0x13d293);}(_0x6c76,0x184));var _0x66c7=function(_0xab7f1a,_0x328d28){_0xab7f1a=_0xab7f1a-0x0;var _0x528d17=_0x6c76[_0xab7f1a];return _0x528d17;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var moment=require(_0x66c7('0x3'));var BPromise=require(_0x66c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var attributes=require('./cmList.attributes');module[_0x66c7('0x7')]=function(_0x45b0a5,_0x52f71b){return _0x45b0a5[_0x66c7('0x8')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./cmList.attributes','exports','define','cm_lists','../../config/logger','api','moment','bluebird','path'];(function(_0x53b589,_0x4e6902){var _0x31a87f=function(_0x1eea45){while(--_0x1eea45){_0x53b589['push'](_0x53b589['shift']());}};_0x31a87f(++_0x4e6902);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x65c0bb,_0x82e7b8){_0x65c0bb=_0x65c0bb-0x0;var _0x320bd5=_0xcb91[_0x65c0bb];return _0x320bd5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('CmList',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 8c6943c..25bd65d 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 _0xadf9=['request','then','info','CmList,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket'];(function(_0x1b3a5c,_0x2f9d5f){var _0x2ae8cb=function(_0x549ab8){while(--_0x549ab8){_0x1b3a5c['push'](_0x1b3a5c['shift']());}};_0x2ae8cb(++_0x2f9d5f);}(_0xadf9,0x15b));var _0x9adf=function(_0x3df262,_0x373cc1){_0x3df262=_0x3df262-0x0;var _0x3b5aa7=_0xadf9[_0x3df262];return _0x3b5aa7;};'use strict';var _=require(_0x9adf('0x0'));var util=require(_0x9adf('0x1'));var moment=require(_0x9adf('0x2'));var BPromise=require(_0x9adf('0x3'));var rs=require(_0x9adf('0x4'));var fs=require('fs');var Redis=require(_0x9adf('0x5'));var db=require(_0x9adf('0x6'))['db'];var utils=require(_0x9adf('0x7'));var logger=require('../../config/logger')(_0x9adf('0x8'));var config=require('../../config/environment');var jayson=require(_0x9adf('0x9'));var client=jayson[_0x9adf('0xa')][_0x9adf('0xb')]({'port':0x232a});config[_0x9adf('0xc')]=_[_0x9adf('0xd')](config[_0x9adf('0xc')],{'host':_0x9adf('0xe'),'port':0x18eb});var socket=require(_0x9adf('0xf'))(new Redis(config['redis']));require(_0x9adf('0x10'))['register'](socket);function respondWithRpcPromise(_0x1251bd,_0x28b246,_0x80ebef){return new BPromise(function(_0x36d408,_0x567164){return client[_0x9adf('0x11')](_0x1251bd,_0x80ebef)[_0x9adf('0x12')](function(_0x2e4025){logger[_0x9adf('0x13')](_0x9adf('0x14'),_0x28b246,_0x9adf('0x15'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x28b246,'request\x20sent',JSON['stringify'](_0x2e4025));if(_0x2e4025[_0x9adf('0x16')]){if(_0x2e4025[_0x9adf('0x16')][_0x9adf('0x17')]===0x1f4){logger['error'](_0x9adf('0x14'),_0x28b246,_0x2e4025[_0x9adf('0x16')][_0x9adf('0x18')]);return _0x567164(_0x2e4025[_0x9adf('0x16')]['message']);}logger['error'](_0x9adf('0x14'),_0x28b246,_0x2e4025['error'][_0x9adf('0x18')]);return _0x36d408(_0x2e4025[_0x9adf('0x16')][_0x9adf('0x18')]);}else{logger[_0x9adf('0x13')]('CmList,\x20%s,\x20%s',_0x28b246,_0x9adf('0x15'));_0x36d408(_0x2e4025['result'][_0x9adf('0x18')]);}})[_0x9adf('0x19')](function(_0x46dabf){logger['error']('CmList,\x20%s,\x20%s',_0x28b246,_0x46dabf);_0x567164(_0x46dabf);});});} \ No newline at end of file +var _0xcf01=['code','error','message','info','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./cmList.socket','register','request','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x49534b,_0x147009){var _0x22517e=function(_0x2d3b79){while(--_0x2d3b79){_0x49534b['push'](_0x49534b['shift']());}};_0x22517e(++_0x147009);}(_0xcf01,0xd4));var _0x1cf0=function(_0x42d5f0,_0x151b49){_0x42d5f0=_0x42d5f0-0x0;var _0x5d008f=_0xcf01[_0x42d5f0];return _0x5d008f;};'use strict';var _=require(_0x1cf0('0x0'));var util=require('util');var moment=require(_0x1cf0('0x1'));var BPromise=require(_0x1cf0('0x2'));var rs=require(_0x1cf0('0x3'));var fs=require('fs');var Redis=require(_0x1cf0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cf0('0x5'));var logger=require(_0x1cf0('0x6'))(_0x1cf0('0x7'));var config=require(_0x1cf0('0x8'));var jayson=require(_0x1cf0('0x9'));var client=jayson[_0x1cf0('0xa')]['http']({'port':0x232a});config[_0x1cf0('0xb')]=_[_0x1cf0('0xc')](config[_0x1cf0('0xb')],{'host':_0x1cf0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1cf0('0xb')]));require(_0x1cf0('0xe'))[_0x1cf0('0xf')](socket);function respondWithRpcPromise(_0x23d04f,_0xc630a,_0x8eb9e6){return new BPromise(function(_0x362146,_0x371bc0){return client[_0x1cf0('0x10')](_0x23d04f,_0x8eb9e6)['then'](function(_0x31e2d2){logger['info'](_0x1cf0('0x11'),_0xc630a,_0x1cf0('0x12'));logger[_0x1cf0('0x13')](_0x1cf0('0x14'),_0xc630a,_0x1cf0('0x12'),JSON[_0x1cf0('0x15')](_0x31e2d2));if(_0x31e2d2['error']){if(_0x31e2d2['error'][_0x1cf0('0x16')]===0x1f4){logger[_0x1cf0('0x17')](_0x1cf0('0x11'),_0xc630a,_0x31e2d2[_0x1cf0('0x17')][_0x1cf0('0x18')]);return _0x371bc0(_0x31e2d2[_0x1cf0('0x17')]['message']);}logger[_0x1cf0('0x17')]('CmList,\x20%s,\x20%s',_0xc630a,_0x31e2d2[_0x1cf0('0x17')]['message']);return _0x362146(_0x31e2d2['error'][_0x1cf0('0x18')]);}else{logger[_0x1cf0('0x19')](_0x1cf0('0x11'),_0xc630a,_0x1cf0('0x12'));_0x362146(_0x31e2d2['result'][_0x1cf0('0x18')]);}})['catch'](function(_0xb5c8fd){logger[_0x1cf0('0x17')](_0x1cf0('0x11'),_0xc630a,_0xb5c8fd);_0x371bc0(_0xb5c8fd);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 44b7348..12aa157 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 _0xffae=['remove','update','emit','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x245c0b,_0x5d2a30){var _0xf87c35=function(_0x1e4e11){while(--_0x1e4e11){_0x245c0b['push'](_0x245c0b['shift']());}};_0xf87c35(++_0x5d2a30);}(_0xffae,0x73));var _0xeffa=function(_0x464f63,_0x4823f8){_0x464f63=_0x464f63-0x0;var _0x13ad82=_0xffae[_0x464f63];return _0x13ad82;};'use strict';var CmListEvents=require(_0xeffa('0x0'));var events=[_0xeffa('0x1'),_0xeffa('0x2'),_0xeffa('0x3')];function createListener(_0x2ef5f6,_0x6517f3){return function(_0x4b4565){_0x6517f3[_0xeffa('0x4')](_0x2ef5f6,_0x4b4565);};}function removeListener(_0x209002,_0x2fcda6){return function(){CmListEvents[_0xeffa('0x5')](_0x209002,_0x2fcda6);};}exports[_0xeffa('0x6')]=function(_0x4a050a){for(var _0x3fd013=0x0,_0x254e01=events[_0xeffa('0x7')];_0x3fd013<_0x254e01;_0x3fd013++){var _0x3a01a4=events[_0x3fd013];var _0x416a4d=createListener(_0xeffa('0x8')+_0x3a01a4,_0x4a050a);CmListEvents['on'](_0x3a01a4,_0x416a4d);}}; \ No newline at end of file +var _0x9178=['save','removeListener','register','length','cmList:','./cmList.events'];(function(_0x1f8da6,_0x54609d){var _0x4f20ea=function(_0x45a5cf){while(--_0x45a5cf){_0x1f8da6['push'](_0x1f8da6['shift']());}};_0x4f20ea(++_0x54609d);}(_0x9178,0xd7));var _0x8917=function(_0xad3f81,_0x3cbf7f){_0xad3f81=_0xad3f81-0x0;var _0x110f32=_0x9178[_0xad3f81];return _0x110f32;};'use strict';var CmListEvents=require(_0x8917('0x0'));var events=[_0x8917('0x1'),'remove','update'];function createListener(_0x3c4151,_0x4bf7f8){return function(_0x4255b8){_0x4bf7f8['emit'](_0x3c4151,_0x4255b8);};}function removeListener(_0x372132,_0x5658db){return function(){CmListEvents[_0x8917('0x2')](_0x372132,_0x5658db);};}exports[_0x8917('0x3')]=function(_0x2cdfc7){for(var _0x3ee6cf=0x0,_0x3d5d45=events[_0x8917('0x4')];_0x3ee6cf<_0x3d5d45;_0x3ee6cf++){var _0x152fcc=events[_0x3ee6cf];var _0x18e688=createListener(_0x8917('0x5')+_0x152fcc,_0x2cdfc7);CmListEvents['on'](_0x152fcc,_0x18e688);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index f4d678f..369961e 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 _0xad14=['/describe','describe','/:id','show','/:id/dispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','/:id/contacts','addContacts','addCustomField','addAgents','destroy','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x5f4d71,_0xc2c11b){var _0xf53196=function(_0x28104d){while(--_0x28104d){_0x5f4d71['push'](_0x5f4d71['shift']());}};_0xf53196(++_0xc2c11b);}(_0xad14,0x18d));var _0x4ad1=function(_0x180fc6,_0x5f3c92){_0x180fc6=_0x180fc6-0x0;var _0x4dbf08=_0xad14[_0x180fc6];return _0x4dbf08;};'use strict';var multer=require(_0x4ad1('0x0'));var util=require(_0x4ad1('0x1'));var path=require(_0x4ad1('0x2'));var timeout=require(_0x4ad1('0x3'));var express=require(_0x4ad1('0x4'));var router=express[_0x4ad1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4ad1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4ad1('0x7'));var controller=require(_0x4ad1('0x8'));router[_0x4ad1('0x9')]('/',auth[_0x4ad1('0xa')](),controller['index']);router['get'](_0x4ad1('0xb'),auth[_0x4ad1('0xa')](),controller[_0x4ad1('0xc')]);router['get'](_0x4ad1('0xd'),auth[_0x4ad1('0xa')](),controller[_0x4ad1('0xe')]);router[_0x4ad1('0x9')](_0x4ad1('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x4ad1('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x4ad1('0x10')]);router[_0x4ad1('0x9')](_0x4ad1('0x11'),auth[_0x4ad1('0xa')](),controller[_0x4ad1('0x12')]);router[_0x4ad1('0x9')](_0x4ad1('0x13'),auth[_0x4ad1('0xa')](),controller[_0x4ad1('0x14')]);router[_0x4ad1('0x9')](_0x4ad1('0x15'),auth[_0x4ad1('0xa')](),controller[_0x4ad1('0x16')]);router[_0x4ad1('0x17')]('/',auth['isAuthenticated'](),controller[_0x4ad1('0x18')]);router[_0x4ad1('0x17')](_0x4ad1('0xf'),auth[_0x4ad1('0xa')](),controller['addDisposition']);router[_0x4ad1('0x17')](_0x4ad1('0x19'),auth[_0x4ad1('0xa')](),controller[_0x4ad1('0x1a')]);router[_0x4ad1('0x17')](_0x4ad1('0x13'),auth[_0x4ad1('0xa')](),controller[_0x4ad1('0x1b')]);router[_0x4ad1('0x17')]('/:id/users',auth[_0x4ad1('0xa')](),controller[_0x4ad1('0x1c')]);router['put'](_0x4ad1('0xd'),auth[_0x4ad1('0xa')](),controller['update']);router['delete'](_0x4ad1('0xd'),auth[_0x4ad1('0xa')](),controller[_0x4ad1('0x1d')]);router[_0x4ad1('0x1e')](_0x4ad1('0xf'),auth[_0x4ad1('0xa')](),controller[_0x4ad1('0x1f')]);router[_0x4ad1('0x1e')](_0x4ad1('0x15'),auth[_0x4ad1('0xa')](),controller[_0x4ad1('0x20')]);module[_0x4ad1('0x21')]=router; \ No newline at end of file +var _0x180a=['Router','fs-extra','../../config/environment','get','index','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addContacts','addCustomField','addAgents','put','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express'];(function(_0x12c076,_0x5bef17){var _0x2ddd18=function(_0x436336){while(--_0x436336){_0x12c076['push'](_0x12c076['shift']());}};_0x2ddd18(++_0x5bef17);}(_0x180a,0x193));var _0xa180=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x180a[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xa180('0x0'));var util=require(_0xa180('0x1'));var path=require(_0xa180('0x2'));var timeout=require(_0xa180('0x3'));var express=require(_0xa180('0x4'));var router=express[_0xa180('0x5')]();var fs_extra=require(_0xa180('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa180('0x7'));var controller=require('./cmList.controller');router[_0xa180('0x8')]('/',auth['isAuthenticated'](),controller[_0xa180('0x9')]);router[_0xa180('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa180('0xa')]);router[_0xa180('0x8')](_0xa180('0xb'),auth[_0xa180('0xc')](),controller[_0xa180('0xd')]);router['get'](_0xa180('0xe'),auth['isAuthenticated'](),controller[_0xa180('0xf')]);router[_0xa180('0x8')](_0xa180('0x10'),auth[_0xa180('0xc')](),controller[_0xa180('0x11')]);router[_0xa180('0x8')](_0xa180('0x12'),auth['isAuthenticated'](),controller[_0xa180('0x13')]);router['get'](_0xa180('0x14'),auth[_0xa180('0xc')](),controller[_0xa180('0x15')]);router[_0xa180('0x8')](_0xa180('0x16'),auth[_0xa180('0xc')](),controller[_0xa180('0x17')]);router[_0xa180('0x18')]('/',auth[_0xa180('0xc')](),controller[_0xa180('0x19')]);router['post']('/:id/dispositions',auth[_0xa180('0xc')](),controller['addDisposition']);router[_0xa180('0x18')](_0xa180('0x10'),auth[_0xa180('0xc')](),controller[_0xa180('0x1a')]);router[_0xa180('0x18')](_0xa180('0x14'),auth[_0xa180('0xc')](),controller[_0xa180('0x1b')]);router['post']('/:id/users',auth[_0xa180('0xc')](),controller[_0xa180('0x1c')]);router[_0xa180('0x1d')]('/:id',auth[_0xa180('0xc')](),controller['update']);router[_0xa180('0x1e')](_0xa180('0xb'),auth[_0xa180('0xc')](),controller[_0xa180('0x1f')]);router[_0xa180('0x1e')](_0xa180('0xe'),auth[_0xa180('0xc')](),controller['removeDispositions']);router[_0xa180('0x1e')](_0xa180('0x16'),auth[_0xa180('0xc')](),controller[_0xa180('0x20')]);module[_0xa180('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index d3d34c9..62c0167 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 _0x0049=['getDataValue','field','STRING','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0049,0x1ab));var _0x9004=function(_0x453f54,_0x28ebf2){_0x453f54=_0x453f54-0x0;var _0x46f6cc=_0x0049[_0x453f54];return _0x46f6cc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9004('0x0')],'get':function(_0x239f2b){return this[_0x9004('0x1')](_0x9004('0x2'));}},'field':{'type':Sequelize[_0x9004('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x9004('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x9004('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xfe80=['VIRTUAL','getDataValue','field','STRING','sequelize','exports'];(function(_0x4777dc,_0xbce636){var _0x16d933=function(_0x238430){while(--_0x238430){_0x4777dc['push'](_0x4777dc['shift']());}};_0x16d933(++_0xbce636);}(_0xfe80,0x14e));var _0x0fe8=function(_0x564d56,_0x30abb6){_0x564d56=_0x564d56-0x0;var _0x2912b2=_0xfe80[_0x564d56];return _0x2912b2;};'use strict';var Sequelize=require(_0x0fe8('0x0'));module[_0x0fe8('0x1')]={'name':{'type':Sequelize[_0x0fe8('0x2')],'get':function(_0x17f9ae){return this[_0x0fe8('0x3')](_0x0fe8('0x4'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0fe8('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x0fe8('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 27bbded..78bb616 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x52ab79,_0x45a8a4){var _0x1bd914=function(_0x38c014){while(--_0x38c014){_0x52ab79['push'](_0x52ab79['shift']());}};_0x1bd914(++_0x45a8a4);}(_0x7a54,0x106));var _0x47a5=function(_0x99c6fb,_0x65e6f){_0x99c6fb=_0x99c6fb-0x0;var _0x2503cc=_0x7a54[_0x99c6fb];return _0x2503cc;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x4e739a,_0x44a1f7){var _0x469861=function(_0x2d8745){while(--_0x2d8745){_0x4e739a['push'](_0x4e739a['shift']());}};_0x469861(++_0x44a1f7);}(_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 diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 4124762..b8fc3dc 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 _0x38df=['exports','define','Condition','tools_conditions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes'];(function(_0x2f1c8e,_0x436789){var _0xe2c1e7=function(_0x2f44a1){while(--_0x2f44a1){_0x2f1c8e['push'](_0x2f1c8e['shift']());}};_0xe2c1e7(++_0x436789);}(_0x38df,0x17e));var _0xf38d=function(_0x19ac90,_0x554f04){_0x19ac90=_0x19ac90-0x0;var _0x4b9d7d=_0x38df[_0x19ac90];return _0x4b9d7d;};'use strict';var _=require(_0xf38d('0x0'));var util=require(_0xf38d('0x1'));var logger=require(_0xf38d('0x2'))('api');var moment=require(_0xf38d('0x3'));var BPromise=require(_0xf38d('0x4'));var rp=require(_0xf38d('0x5'));var fs=require('fs');var path=require(_0xf38d('0x6'));var rimraf=require(_0xf38d('0x7'));var config=require(_0xf38d('0x8'));var attributes=require(_0xf38d('0x9'));module[_0xf38d('0xa')]=function(_0x456e31,_0x33d214){return _0x456e31[_0xf38d('0xb')](_0xf38d('0xc'),attributes,{'tableName':_0xf38d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67b6=['request-promise','path','rimraf','define','Condition','lodash','util','api','moment','bluebird'];(function(_0x819e48,_0x430040){var _0x522d4a=function(_0x1bb24f){while(--_0x1bb24f){_0x819e48['push'](_0x819e48['shift']());}};_0x522d4a(++_0x430040);}(_0x67b6,0xeb));var _0x667b=function(_0x408cef,_0x4ef5ff){_0x408cef=_0x408cef-0x0;var _0x2e0e76=_0x67b6[_0x408cef];return _0x2e0e76;};'use strict';var _=require(_0x667b('0x0'));var util=require(_0x667b('0x1'));var logger=require('../../config/logger')(_0x667b('0x2'));var moment=require(_0x667b('0x3'));var BPromise=require(_0x667b('0x4'));var rp=require(_0x667b('0x5'));var fs=require('fs');var path=require(_0x667b('0x6'));var rimraf=require(_0x667b('0x7'));var config=require('../../config/environment');var attributes=require('./condition.attributes');module['exports']=function(_0x44d11d,_0x2d942d){return _0x44d11d[_0x667b('0x8')](_0x667b('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index d34c22b..493975e 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 _0x9035=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','Condition,\x20%s,\x20%s','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5d8ace,_0x111a34){var _0xd2034e=function(_0x4924d0){while(--_0x4924d0){_0x5d8ace['push'](_0x5d8ace['shift']());}};_0xd2034e(++_0x111a34);}(_0x9035,0x94));var _0x5903=function(_0xe9feab,_0x6314a8){_0xe9feab=_0xe9feab-0x0;var _0x386e3b=_0x9035[_0xe9feab];return _0x386e3b;};'use strict';var _=require(_0x5903('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5903('0x1'));var rs=require(_0x5903('0x2'));var fs=require('fs');var Redis=require(_0x5903('0x3'));var db=require(_0x5903('0x4'))['db'];var utils=require(_0x5903('0x5'));var logger=require(_0x5903('0x6'))(_0x5903('0x7'));var config=require('../../config/environment');var jayson=require(_0x5903('0x8'));var client=jayson[_0x5903('0x9')][_0x5903('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f713c,_0x27ec49,_0x9a90fa){return new BPromise(function(_0x108fc4,_0x32fd39){return client[_0x5903('0xb')](_0x1f713c,_0x9a90fa)[_0x5903('0xc')](function(_0x1a80c9){logger[_0x5903('0xd')]('Condition,\x20%s,\x20%s',_0x27ec49,_0x5903('0xe'));logger[_0x5903('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x27ec49,_0x5903('0xe'),JSON[_0x5903('0x10')](_0x1a80c9));if(_0x1a80c9[_0x5903('0x11')]){if(_0x1a80c9[_0x5903('0x11')][_0x5903('0x12')]===0x1f4){logger['error'](_0x5903('0x13'),_0x27ec49,_0x1a80c9[_0x5903('0x11')][_0x5903('0x14')]);return _0x32fd39(_0x1a80c9['error'][_0x5903('0x14')]);}logger[_0x5903('0x11')](_0x5903('0x13'),_0x27ec49,_0x1a80c9[_0x5903('0x11')]['message']);return _0x108fc4(_0x1a80c9[_0x5903('0x11')][_0x5903('0x14')]);}else{logger[_0x5903('0xd')](_0x5903('0x13'),_0x27ec49,_0x5903('0xe'));_0x108fc4(_0x1a80c9[_0x5903('0x15')][_0x5903('0x14')]);}})['catch'](function(_0x47fa59){logger[_0x5903('0x11')](_0x5903('0x13'),_0x27ec49,_0x47fa59);_0x32fd39(_0x47fa59);});});} \ No newline at end of file +var _0x7562=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7562,0x14b));var _0x2756=function(_0x4ca6fb,_0x300a7c){_0x4ca6fb=_0x4ca6fb-0x0;var _0x1dc114=_0x7562[_0x4ca6fb];return _0x1dc114;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2756('0x0'));var rs=require(_0x2756('0x1'));var fs=require('fs');var Redis=require(_0x2756('0x2'));var db=require(_0x2756('0x3'))['db'];var utils=require(_0x2756('0x4'));var logger=require(_0x2756('0x5'))(_0x2756('0x6'));var config=require('../../config/environment');var jayson=require(_0x2756('0x7'));var client=jayson[_0x2756('0x8')][_0x2756('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13c554,_0x41bf48,_0x363393){return new BPromise(function(_0xe8db3c,_0x4de075){return client[_0x2756('0xa')](_0x13c554,_0x363393)[_0x2756('0xb')](function(_0x2c9298){logger[_0x2756('0xc')](_0x2756('0xd'),_0x41bf48,'request\x20sent');logger[_0x2756('0xe')](_0x2756('0xf'),_0x41bf48,_0x2756('0x10'),JSON[_0x2756('0x11')](_0x2c9298));if(_0x2c9298[_0x2756('0x12')]){if(_0x2c9298[_0x2756('0x12')]['code']===0x1f4){logger[_0x2756('0x12')](_0x2756('0xd'),_0x41bf48,_0x2c9298[_0x2756('0x12')][_0x2756('0x13')]);return _0x4de075(_0x2c9298['error'][_0x2756('0x13')]);}logger['error']('Condition,\x20%s,\x20%s',_0x41bf48,_0x2c9298[_0x2756('0x12')][_0x2756('0x13')]);return _0xe8db3c(_0x2c9298[_0x2756('0x12')]['message']);}else{logger[_0x2756('0xc')](_0x2756('0xd'),_0x41bf48,'request\x20sent');_0xe8db3c(_0x2c9298['result']['message']);}})[_0x2756('0x14')](function(_0x2de9c1){logger[_0x2756('0x12')](_0x2756('0xd'),_0x41bf48,_0x2de9c1);_0x4de075(_0x2de9c1);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 6c848d0..d98366b 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 _0x5fd6=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./condition.controller','put','update','delete','destroy'];(function(_0x562ec3,_0x332120){var _0x2b5662=function(_0x3e5704){while(--_0x3e5704){_0x562ec3['push'](_0x562ec3['shift']());}};_0x2b5662(++_0x332120);}(_0x5fd6,0xfc));var _0x65fd=function(_0xd88162,_0x490fa6){_0xd88162=_0xd88162-0x0;var _0x63996f=_0x5fd6[_0xd88162];return _0x63996f;};'use strict';var multer=require(_0x65fd('0x0'));var util=require(_0x65fd('0x1'));var path=require(_0x65fd('0x2'));var timeout=require(_0x65fd('0x3'));var express=require(_0x65fd('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x65fd('0x5'));var interaction=require(_0x65fd('0x6'));var config=require('../../config/environment');var controller=require(_0x65fd('0x7'));router[_0x65fd('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x65fd('0x9')]);router[_0x65fd('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x65fd('0xb')]);module['exports']=router; \ No newline at end of file +var _0xb795=['/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put'];(function(_0x3ec012,_0x2f291b){var _0x5e9305=function(_0x44b832){while(--_0x44b832){_0x3ec012['push'](_0x3ec012['shift']());}};_0x5e9305(++_0x2f291b);}(_0xb795,0x146));var _0x5b79=function(_0x7eef7d,_0x50412d){_0x7eef7d=_0x7eef7d-0x0;var _0x416035=_0xb795[_0x7eef7d];return _0x416035;};'use strict';var multer=require(_0x5b79('0x0'));var util=require('util');var path=require(_0x5b79('0x1'));var timeout=require(_0x5b79('0x2'));var express=require(_0x5b79('0x3'));var router=express[_0x5b79('0x4')]();var fs_extra=require(_0x5b79('0x5'));var auth=require(_0x5b79('0x6'));var interaction=require(_0x5b79('0x7'));var config=require('../../config/environment');var controller=require(_0x5b79('0x8'));router[_0x5b79('0x9')](_0x5b79('0xa'),auth[_0x5b79('0xb')](),controller[_0x5b79('0xc')]);router[_0x5b79('0xd')](_0x5b79('0xa'),auth[_0x5b79('0xb')](),controller[_0x5b79('0xe')]);module[_0x5b79('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 9a9170a..118d83c 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 _0xb10b=['name','sequelize','STRING'];(function(_0xa80439,_0x184ffa){var _0x4273e7=function(_0x4f3a0c){while(--_0x4f3a0c){_0xa80439['push'](_0xa80439['shift']());}};_0x4273e7(++_0x184ffa);}(_0xb10b,0x12a));var _0xbb10=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0xb10b[_0x384231];return _0x2480bf;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x25b62b,_0x2965cc){var _0x9c91e9=function(_0x3396a5){while(--_0x3396a5){_0x25b62b['push'](_0x25b62b['shift']());}};_0x9c91e9(++_0x2965cc);}(_0xb10b,0x12a));var _0xbb10=function(_0x557ba5,_0x55735b){_0x557ba5=_0x557ba5-0x0;var _0x4c7d96=_0xb10b[_0x557ba5];return _0x4c7d96;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 24d9b2a..8e12ad4 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 _0xe6db=['iframe','attrUrl','attrs','https://','custom','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','addItem','DashboardId','findOne','DashboardItem','getItems','nolimit','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','get','CustomDashboards','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','updatedAt','body','createdAt','role','UserProfileResource'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0xe6db,0x1a1));var _0xbe6d=function(_0x19f6fc,_0x32f949){_0x19f6fc=_0x19f6fc-0x0;var _0x1d82b5=_0xe6db[_0x19f6fc];return _0x1d82b5;};'use strict';var emlformat=require(_0xbe6d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe6d('0x1'));var rp=require('request-promise');var moment=require(_0xbe6d('0x2'));var BPromise=require(_0xbe6d('0x3'));var Mustache=require(_0xbe6d('0x4'));var util=require(_0xbe6d('0x5'));var path=require(_0xbe6d('0x6'));var sox=require(_0xbe6d('0x7'));var csv=require(_0xbe6d('0x8'));var ejs=require(_0xbe6d('0x9'));var fs=require('fs');var fs_extra=require(_0xbe6d('0xa'));var _=require(_0xbe6d('0xb'));var squel=require('squel');var crypto=require(_0xbe6d('0xc'));var jsforce=require(_0xbe6d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbe6d('0x8'));var querystring=require(_0xbe6d('0xe'));var Papa=require('papaparse');var Redis=require(_0xbe6d('0xf'));var authService=require(_0xbe6d('0x10'));var qs=require(_0xbe6d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe6d('0x12'))(_0xbe6d('0x13'));var utils=require(_0xbe6d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbe6d('0x15'));var db=require(_0xbe6d('0x16'))['db'];config[_0xbe6d('0x17')]=_[_0xbe6d('0x18')](config[_0xbe6d('0x17')],{'host':_0xbe6d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe6d('0x17')]));require(_0xbe6d('0x1a'))[_0xbe6d('0x1b')](socket);function respondWithStatusCode(_0x1e3a94,_0x23ab96){_0x23ab96=_0x23ab96||0xcc;return function(_0x223514){if(_0x223514){return _0x1e3a94[_0xbe6d('0x1c')](_0x23ab96);}return _0x1e3a94[_0xbe6d('0x1d')](_0x23ab96)[_0xbe6d('0x1e')]();};}function respondWithResult(_0x3db956,_0xdb3ab2){_0xdb3ab2=_0xdb3ab2||0xc8;return function(_0x2348dd){if(_0x2348dd){return _0x3db956[_0xbe6d('0x1d')](_0xdb3ab2)['json'](_0x2348dd);}};}function respondWithFilteredResult(_0x531bfa,_0x233e11){return function(_0x4421a0){if(_0x4421a0){var _0x522508=typeof _0x233e11[_0xbe6d('0x1f')]===_0xbe6d('0x20')&&typeof _0x233e11[_0xbe6d('0x21')]==='undefined';var _0x14d1c5=_0x4421a0[_0xbe6d('0x22')];var _0x16f096=_0x522508?0x0:_0x233e11[_0xbe6d('0x1f')];var _0x588b60=_0x522508?_0x4421a0[_0xbe6d('0x22')]:_0x233e11[_0xbe6d('0x1f')]+_0x233e11[_0xbe6d('0x21')];var _0x1f0f20;if(_0x588b60>=_0x14d1c5){_0x588b60=_0x14d1c5;_0x1f0f20=0xc8;}else{_0x1f0f20=0xce;}_0x531bfa[_0xbe6d('0x1d')](_0x1f0f20);return _0x531bfa[_0xbe6d('0x23')]('Content-Range',_0x16f096+'-'+_0x588b60+'/'+_0x14d1c5)[_0xbe6d('0x24')](_0x4421a0);}return null;};}function patchUpdates(_0x3ed419){return function(_0x428cdd){try{jsonpatch[_0xbe6d('0x25')](_0x428cdd,_0x3ed419,!![]);}catch(_0x4750a0){return BPromise[_0xbe6d('0x26')](_0x4750a0);}return _0x428cdd['save']();};}function saveUpdates(_0x37beed,_0x59b13c){return function(_0x4f9bf3){if(_0x4f9bf3){return _0x4f9bf3[_0xbe6d('0x27')](_0x37beed)[_0xbe6d('0x28')](function(_0x303ed4){return _0x303ed4;});}return null;};}function removeEntity(_0x398343,_0x39fb4f){return function(_0x216164){if(_0x216164){return _0x216164[_0xbe6d('0x29')]()[_0xbe6d('0x28')](function(){var _0x85dc57=_0x216164[_0xbe6d('0x2a')]({'plain':!![]});var _0x219b6f=_0xbe6d('0x2b');return db['UserProfileResource'][_0xbe6d('0x29')]({'where':{'type':_0x219b6f,'resourceId':_0x85dc57['id']}})[_0xbe6d('0x28')](function(){return _0x216164;});})[_0xbe6d('0x28')](function(){_0x398343[_0xbe6d('0x1d')](0xcc)[_0xbe6d('0x1e')]();});}};}function handleEntityNotFound(_0x18e618,_0x17d42e){return function(_0x595ce){if(!_0x595ce){_0x18e618[_0xbe6d('0x1c')](0x194);}return _0x595ce;};}function handleError(_0x482d00,_0x6ceb0f){_0x6ceb0f=_0x6ceb0f||0x1f4;return function(_0x243e38){logger[_0xbe6d('0x2c')](_0x243e38[_0xbe6d('0x2d')]);if(_0x243e38[_0xbe6d('0x2e')]){delete _0x243e38['name'];}_0x482d00['status'](_0x6ceb0f)['send'](_0x243e38);};}exports[_0xbe6d('0x2f')]=function(_0x14809a,_0x43bc7e){var _0x19a78b={},_0x5b2c88={},_0x1ef687={'count':0x0,'rows':[]};var _0x4b59c5=_[_0xbe6d('0x30')](db[_0xbe6d('0x31')][_0xbe6d('0x32')],function(_0x2acf4c){return{'name':_0x2acf4c[_0xbe6d('0x33')],'type':_0x2acf4c[_0xbe6d('0x34')][_0xbe6d('0x35')]};});_0x5b2c88[_0xbe6d('0x36')]=_[_0xbe6d('0x30')](_0x4b59c5,_0xbe6d('0x2e'));_0x5b2c88['query']=_[_0xbe6d('0x37')](_0x14809a[_0xbe6d('0x38')]);_0x5b2c88[_0xbe6d('0x39')]=_['intersection'](_0x5b2c88[_0xbe6d('0x36')],_0x5b2c88[_0xbe6d('0x38')]);_0x19a78b[_0xbe6d('0x3a')]=_[_0xbe6d('0x3b')](_0x5b2c88[_0xbe6d('0x36')],qs[_0xbe6d('0x3c')](_0x14809a[_0xbe6d('0x38')]['fields']));_0x19a78b[_0xbe6d('0x3a')]=_0x19a78b['attributes'][_0xbe6d('0x3d')]?_0x19a78b['attributes']:_0x5b2c88[_0xbe6d('0x36')];if(!_0x14809a[_0xbe6d('0x38')][_0xbe6d('0x3e')]('nolimit')){_0x19a78b[_0xbe6d('0x21')]=qs[_0xbe6d('0x21')](_0x14809a['query'][_0xbe6d('0x21')]);_0x19a78b[_0xbe6d('0x1f')]=qs[_0xbe6d('0x1f')](_0x14809a[_0xbe6d('0x38')][_0xbe6d('0x1f')]);}_0x19a78b[_0xbe6d('0x3f')]=qs[_0xbe6d('0x40')](_0x14809a[_0xbe6d('0x38')]['sort']);_0x19a78b['where']=qs[_0xbe6d('0x39')](_[_0xbe6d('0x41')](_0x14809a['query'],_0x5b2c88[_0xbe6d('0x39')]),_0x4b59c5);if(_0x14809a[_0xbe6d('0x38')][_0xbe6d('0x42')]){_0x19a78b[_0xbe6d('0x43')]=_[_0xbe6d('0x44')](_0x19a78b['where'],{'$or':_['map'](_0x4b59c5,function(_0xf93695){if(_0xf93695[_0xbe6d('0x34')]!==_0xbe6d('0x45')){var _0x5bb7a2={};_0x5bb7a2[_0xf93695[_0xbe6d('0x2e')]]={'$like':'%'+_0x14809a['query'][_0xbe6d('0x42')]+'%'};return _0x5bb7a2;}})});}_0x19a78b=_[_0xbe6d('0x44')]({},_0x19a78b,_0x14809a[_0xbe6d('0x46')]);var _0x22e06d={'where':_0x19a78b['where']};return db[_0xbe6d('0x31')][_0xbe6d('0x22')](_0x22e06d)[_0xbe6d('0x28')](function(_0x44e24e){_0x1ef687[_0xbe6d('0x22')]=_0x44e24e;if(_0x14809a[_0xbe6d('0x38')][_0xbe6d('0x47')]){_0x19a78b[_0xbe6d('0x48')]=[{'all':!![]}];}return db[_0xbe6d('0x31')]['findAll'](_0x19a78b);})['then'](function(_0x42b104){_0x1ef687[_0xbe6d('0x49')]=_0x42b104;return _0x1ef687;})['then'](respondWithFilteredResult(_0x43bc7e,_0x19a78b))[_0xbe6d('0x4a')](handleError(_0x43bc7e,null));};exports[_0xbe6d('0x4b')]=function(_0x497f36,_0x479a99){var _0x3f0582={'raw':![],'where':{'id':_0x497f36['params']['id']}},_0x4f8216={};_0x4f8216[_0xbe6d('0x36')]=_[_0xbe6d('0x37')](db[_0xbe6d('0x31')][_0xbe6d('0x32')]);_0x4f8216[_0xbe6d('0x38')]=_[_0xbe6d('0x37')](_0x497f36[_0xbe6d('0x38')]);_0x4f8216['filters']=_['intersection'](_0x4f8216['model'],_0x4f8216[_0xbe6d('0x38')]);_0x3f0582['attributes']=_[_0xbe6d('0x3b')](_0x4f8216['model'],qs[_0xbe6d('0x3c')](_0x497f36['query']['fields']));_0x3f0582[_0xbe6d('0x3a')]=_0x3f0582['attributes'][_0xbe6d('0x3d')]?_0x3f0582['attributes']:_0x4f8216[_0xbe6d('0x36')];if(_0x497f36[_0xbe6d('0x38')][_0xbe6d('0x47')]){_0x3f0582['include']=[{'all':!![]}];}_0x3f0582=_['merge']({},_0x3f0582,_0x497f36['options']);return db[_0xbe6d('0x31')][_0xbe6d('0x4c')](_0x3f0582)['then'](handleEntityNotFound(_0x479a99,null))[_0xbe6d('0x28')](respondWithResult(_0x479a99,null))[_0xbe6d('0x4a')](handleError(_0x479a99,null));};exports[_0xbe6d('0x4d')]=function(_0x106c57,_0x5b2b6a){return db['Dashboard'][_0xbe6d('0x4d')](_0x106c57['body'],{})['then'](function(_0x12e42e){var _0x29ce6=_0x106c57[_0xbe6d('0x4e')][_0xbe6d('0x2a')]({'plain':!![]});if(!_0x29ce6)throw new Error(_0xbe6d('0x4f'));if(_0x29ce6['role']===_0xbe6d('0x4e')){var _0x7bb4e7=_0x12e42e['get']({'plain':!![]});var _0x2961b7=_0xbe6d('0x2b');return db[_0xbe6d('0x50')]['find']({'where':{'name':_0x2961b7,'userProfileId':_0x29ce6[_0xbe6d('0x51')]},'raw':!![]})['then'](function(_0xa997e2){if(_0xa997e2&&_0xa997e2[_0xbe6d('0x52')]===0x0){return db['UserProfileResource'][_0xbe6d('0x4d')]({'name':_0x7bb4e7['name'],'resourceId':_0x7bb4e7['id'],'type':_0xa997e2['name'],'sectionId':_0xa997e2['id']},{})[_0xbe6d('0x28')](function(){return _0x12e42e;});}else{return _0x12e42e;}})['catch'](function(_0x2eb28e){logger[_0xbe6d('0x2c')](_0xbe6d('0x53'),_0x2eb28e);throw _0x2eb28e;});}return _0x12e42e;})[_0xbe6d('0x28')](respondWithResult(_0x5b2b6a,0xc9))[_0xbe6d('0x4a')](handleError(_0x5b2b6a,null));};exports['clone']=function(_0xddfa8c,_0x1dc9b9){var _0x5d263a={'where':{'id':_0xddfa8c[_0xbe6d('0x54')]['id']}},_0x5905f8={};_0x5905f8['model']=_[_0xbe6d('0x37')](db[_0xbe6d('0x31')][_0xbe6d('0x32')]);_0x5d263a[_0xbe6d('0x3a')]=_[_0xbe6d('0x3b')](_0x5905f8[_0xbe6d('0x36')],qs[_0xbe6d('0x3c')](_0xddfa8c['query'][_0xbe6d('0x3c')]));_0x5d263a[_0xbe6d('0x3a')]=_0x5d263a[_0xbe6d('0x3a')]['length']?_0x5d263a['attributes']:_0x5905f8['model'];if(_0xddfa8c[_0xbe6d('0x38')]['includeAll']){_0x5d263a[_0xbe6d('0x48')]=[{'all':!![]}];}_0x5d263a=_['merge']({},_0x5d263a,_0xddfa8c['options']);return db['Dashboard'][_0xbe6d('0x4c')](_0x5d263a)['then'](handleEntityNotFound(_0x1dc9b9,null))[_0xbe6d('0x28')](function(_0x1ce025){if(_0x1ce025){var _0xa77d88=_0x1ce025[_0xbe6d('0x2a')]({'plain':!![]});_0xa77d88=qs[_0xbe6d('0x55')](_0xa77d88,['id','createdAt',_0xbe6d('0x56')]);_0xddfa8c[_0xbe6d('0x57')]=_[_0xbe6d('0x55')](_0xddfa8c['body'],['id',_0xbe6d('0x58'),_0xbe6d('0x56')]);return db[_0xbe6d('0x31')]['create'](_['merge'](_0xa77d88,_0xddfa8c['body']),{'include':_0xddfa8c[_0xbe6d('0x38')][_0xbe6d('0x47')]?[{'all':!![]}]:undefined})[_0xbe6d('0x28')](function(_0x4e7907){var _0x2614d6=_0xddfa8c[_0xbe6d('0x4e')]['get']({'plain':!![]});if(!_0x2614d6)throw new Error(_0xbe6d('0x4f'));if(_0x2614d6[_0xbe6d('0x59')]===_0xbe6d('0x4e')){var _0x5676f1=_0x4e7907[_0xbe6d('0x2a')]({'plain':!![]});var _0x5b6ecf=_0xbe6d('0x2b');return db[_0xbe6d('0x50')][_0xbe6d('0x4c')]({'where':{'name':_0x5b6ecf,'userProfileId':_0x2614d6[_0xbe6d('0x51')]},'raw':!![]})['then'](function(_0x3fd554){if(_0x3fd554&&_0x3fd554['autoAssociation']===0x0){return db[_0xbe6d('0x5a')][_0xbe6d('0x4d')]({'name':_0x5676f1['name'],'resourceId':_0x5676f1['id'],'type':_0x3fd554['name'],'sectionId':_0x3fd554['id']},{})[_0xbe6d('0x28')](function(){return _0x4e7907;});}else{return _0x4e7907;}})[_0xbe6d('0x4a')](function(_0x215fdc){logger['error'](_0xbe6d('0x53'),_0x215fdc);throw _0x215fdc;});}return _0x4e7907;});}})[_0xbe6d('0x28')](respondWithResult(_0x1dc9b9,0xc9))['catch'](handleError(_0x1dc9b9,null));};exports['update']=function(_0x7d645b,_0x359399){if(_0x7d645b[_0xbe6d('0x57')]['id']){delete _0x7d645b['body']['id'];}return db[_0xbe6d('0x31')]['find']({'where':{'id':_0x7d645b['params']['id']}})['then'](handleEntityNotFound(_0x359399,null))[_0xbe6d('0x28')](saveUpdates(_0x7d645b[_0xbe6d('0x57')],null))[_0xbe6d('0x28')](respondWithResult(_0x359399,null))[_0xbe6d('0x4a')](handleError(_0x359399,null));};exports[_0xbe6d('0x29')]=function(_0x6d9b17,_0x44512e){return db[_0xbe6d('0x31')][_0xbe6d('0x4c')]({'where':{'id':_0x6d9b17[_0xbe6d('0x54')]['id']}})['then'](handleEntityNotFound(_0x44512e,null))[_0xbe6d('0x28')](removeEntity(_0x44512e,null))[_0xbe6d('0x4a')](handleError(_0x44512e,null));};function widgetAttributes(_0x3bff6a){try{switch(_0x3bff6a[_0xbe6d('0x34')]){case _0xbe6d('0x5b'):return[{'name':_0xbe6d('0x5c'),'value':_0x3bff6a[_0xbe6d('0x5c')]||(_0x3bff6a['attrs']&&_0x3bff6a['attrs'][0x0]?_0x3bff6a[_0xbe6d('0x5d')][0x0]['value']:undefined)||_0xbe6d('0x5e')}];case _0xbe6d('0x5f'):return[{'name':'attrPath','value':_0x3bff6a['attrPath']||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0x0]?_0x3bff6a[_0xbe6d('0x5d')][0x0][_0xbe6d('0x60')]:undefined)||''}];case'clock':return[{'name':_0xbe6d('0x61'),'value':_0x3bff6a[_0xbe6d('0x61')]||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a['attrs'][0x0]?_0x3bff6a['attrs'][0x0][_0xbe6d('0x60')]:undefined)||_0xbe6d('0x62')},{'name':_0xbe6d('0x63'),'value':_0x3bff6a[_0xbe6d('0x63')]||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a['attrs'][0x1]?_0x3bff6a[_0xbe6d('0x5d')][0x1][_0xbe6d('0x60')]:undefined)||_0xbe6d('0x64')},{'name':_0xbe6d('0x65'),'value':_0x3bff6a['attrFontSize']||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a['attrs'][0x2]?_0x3bff6a[_0xbe6d('0x5d')][0x2][_0xbe6d('0x60')]:undefined)||0xc}];case _0xbe6d('0x66'):return[{'name':'attrMetric','value':_0x3bff6a[_0xbe6d('0x67')]||(_0x3bff6a['attrs']&&_0x3bff6a[_0xbe6d('0x5d')][0x0]?_0x3bff6a[_0xbe6d('0x5d')][0x0]['value']:undefined)||_0xbe6d('0x68')},{'name':_0xbe6d('0x69'),'value':_0x3bff6a[_0xbe6d('0x69')]||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0x1]?_0x3bff6a['attrs'][0x1][_0xbe6d('0x60')]:undefined)||[]},{'name':_0xbe6d('0x65'),'value':_0x3bff6a[_0xbe6d('0x65')]||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0x2]?_0x3bff6a[_0xbe6d('0x5d')][0x2][_0xbe6d('0x60')]:undefined)||0x14},{'name':_0xbe6d('0x6a'),'value':_0x3bff6a[_0xbe6d('0x6a')]||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0x3]?_0x3bff6a[_0xbe6d('0x5d')][0x3]['value']:undefined)||_0xbe6d('0x6b')},{'name':_0xbe6d('0x6c'),'value':_0x3bff6a[_0xbe6d('0x6c')]||(_0x3bff6a['attrs']&&_0x3bff6a[_0xbe6d('0x5d')][0x4]?_0x3bff6a[_0xbe6d('0x5d')][0x4][_0xbe6d('0x60')]:undefined)||''},{'name':_0xbe6d('0x6d'),'value':_0x3bff6a[_0xbe6d('0x6d')]||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0x5]?_0x3bff6a[_0xbe6d('0x5d')][0x5][_0xbe6d('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3bff6a[_0xbe6d('0x6e')]||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a['attrs'][0x6]?_0x3bff6a[_0xbe6d('0x5d')][0x6][_0xbe6d('0x60')]:undefined)||''},{'name':_0xbe6d('0x6f'),'value':_0x3bff6a[_0xbe6d('0x6f')]||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0x7]?_0x3bff6a[_0xbe6d('0x5d')][0x7][_0xbe6d('0x60')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3bff6a[_0xbe6d('0x70')]||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0x8]?_0x3bff6a[_0xbe6d('0x5d')][0x8][_0xbe6d('0x60')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3bff6a[_0xbe6d('0x71')]||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0x9]?_0x3bff6a[_0xbe6d('0x5d')][0x9][_0xbe6d('0x60')]:undefined)||''}];case _0xbe6d('0x72'):case'pie-chart':return[{'name':_0xbe6d('0x73'),'value':_0x3bff6a['attrSerie1']||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0x0]?_0x3bff6a[_0xbe6d('0x5d')][0x0][_0xbe6d('0x60')]:undefined)||'total'},{'name':_0xbe6d('0x74'),'value':_0x3bff6a[_0xbe6d('0x74')]||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a['attrs'][0x1]?_0x3bff6a[_0xbe6d('0x5d')][0x1][_0xbe6d('0x60')]:undefined)||null},{'name':'attrSerie3','value':_0x3bff6a[_0xbe6d('0x75')]||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0x2]?_0x3bff6a['attrs'][0x2]['value']:undefined)||null},{'name':_0xbe6d('0x69'),'value':_0x3bff6a['attrVoiceQueues']||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0x3]?_0x3bff6a[_0xbe6d('0x5d')][0x3][_0xbe6d('0x60')]:undefined)||[]},{'name':_0xbe6d('0x6a'),'value':_0x3bff6a['attrChannel']||(_0x3bff6a['attrs']&&_0x3bff6a[_0xbe6d('0x5d')][0x4]?_0x3bff6a[_0xbe6d('0x5d')][0x4][_0xbe6d('0x60')]:undefined)||_0xbe6d('0x6b')},{'name':_0xbe6d('0x6c'),'value':_0x3bff6a[_0xbe6d('0x6c')]||(_0x3bff6a['attrs']&&_0x3bff6a[_0xbe6d('0x5d')][0x5]?_0x3bff6a['attrs'][0x5][_0xbe6d('0x60')]:undefined)||''},{'name':_0xbe6d('0x6d'),'value':_0x3bff6a[_0xbe6d('0x6d')]||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0x6]?_0x3bff6a['attrs'][0x6]['value']:undefined)||''},{'name':_0xbe6d('0x6e'),'value':_0x3bff6a[_0xbe6d('0x6e')]||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a['attrs'][0x7]?_0x3bff6a[_0xbe6d('0x5d')][0x7][_0xbe6d('0x60')]:undefined)||''},{'name':_0xbe6d('0x6f'),'value':_0x3bff6a['attrOpenchannelAccounts']||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0x8]?_0x3bff6a[_0xbe6d('0x5d')][0x8][_0xbe6d('0x60')]:undefined)||''},{'name':_0xbe6d('0x70'),'value':_0x3bff6a['attrWhatsappAccounts']||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0x9]?_0x3bff6a[_0xbe6d('0x5d')][0x9][_0xbe6d('0x60')]:undefined)||''},{'name':_0xbe6d('0x71'),'value':_0x3bff6a[_0xbe6d('0x71')]||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0xa]?_0x3bff6a[_0xbe6d('0x5d')][0xa]['value']:undefined)||''}];case _0xbe6d('0x76'):return[{'name':_0xbe6d('0x77'),'type':_0x3bff6a['reportType']||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0x0]?_0x3bff6a[_0xbe6d('0x5d')][0x0][_0xbe6d('0x34')]:undefined)||null,'value':_0x3bff6a[_0xbe6d('0x77')]||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0x0]?_0x3bff6a[_0xbe6d('0x5d')][0x0][_0xbe6d('0x60')]:undefined)||null},{'name':'attrRefresh','value':_0x3bff6a[_0xbe6d('0x78')]||(_0x3bff6a[_0xbe6d('0x5d')]&&_0x3bff6a[_0xbe6d('0x5d')][0x1]?_0x3bff6a[_0xbe6d('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x327e65){logger[_0xbe6d('0x2c')]('widgetAttributes:\x20%s',JSON['stringify'](_0x327e65));return[];}}exports[_0xbe6d('0x79')]=function(_0x1f5999,_0x27905e,_0x399465){if(_0x1f5999['body']['id']){delete _0x1f5999['body']['id'];}return db[_0xbe6d('0x31')][_0xbe6d('0x4c')]({'where':{'id':_0x1f5999[_0xbe6d('0x54')]['id']}})[_0xbe6d('0x28')](handleEntityNotFound(_0x27905e,null))['then'](function(_0x52ba09){if(_0x52ba09){_0x1f5999[_0xbe6d('0x57')][_0xbe6d('0x7a')]=_0x52ba09['id'];_0x1f5999[_0xbe6d('0x57')]['attrs']=widgetAttributes(_0x1f5999[_0xbe6d('0x57')]);return db['DashboardItem'][_0xbe6d('0x4d')](_0x1f5999[_0xbe6d('0x57')]);}})[_0xbe6d('0x28')](respondWithResult(_0x27905e,null))[_0xbe6d('0x4a')](handleError(_0x27905e,null));};exports['getItems']=function(_0x118b18,_0x5b043b,_0x3f3828){var _0x1460ad={};var _0x226f8f={};var _0x2903e7;var _0xb62831;return db[_0xbe6d('0x31')][_0xbe6d('0x7b')]({'where':{'id':_0x118b18[_0xbe6d('0x54')]['id']}})['then'](handleEntityNotFound(_0x5b043b,null))[_0xbe6d('0x28')](function(_0x210c48){if(_0x210c48){_0x2903e7=_0x210c48;_0x226f8f[_0xbe6d('0x36')]=_['keys'](db[_0xbe6d('0x7c')][_0xbe6d('0x32')]);_0x226f8f[_0xbe6d('0x38')]=_[_0xbe6d('0x37')](_0x118b18[_0xbe6d('0x38')]);_0x226f8f['filters']=_['intersection'](_0x226f8f[_0xbe6d('0x36')],_0x226f8f[_0xbe6d('0x38')]);_0x1460ad[_0xbe6d('0x3a')]=_['intersection'](_0x226f8f['model'],qs[_0xbe6d('0x3c')](_0x118b18[_0xbe6d('0x38')]['fields']));_0x1460ad[_0xbe6d('0x3a')]=_0x1460ad['attributes']['length']?_0x1460ad[_0xbe6d('0x3a')]:_0x226f8f[_0xbe6d('0x36')];_0x1460ad[_0xbe6d('0x3f')]=qs[_0xbe6d('0x40')](_0x118b18[_0xbe6d('0x38')][_0xbe6d('0x40')]);_0x1460ad['where']=qs[_0xbe6d('0x39')](_[_0xbe6d('0x41')](_0x118b18['query'],_0x226f8f[_0xbe6d('0x39')]));if(_0x118b18[_0xbe6d('0x38')][_0xbe6d('0x42')]){_0x1460ad['where']=_[_0xbe6d('0x44')](_0x1460ad[_0xbe6d('0x43')],{'$or':_[_0xbe6d('0x30')](_0x1460ad[_0xbe6d('0x3a')],function(_0x5301e6){var _0xad041={};_0xad041[_0x5301e6]={'$like':'%'+_0x118b18[_0xbe6d('0x38')][_0xbe6d('0x42')]+'%'};return _0xad041;})});}_0x1460ad=_[_0xbe6d('0x44')]({},_0x1460ad,_0x118b18[_0xbe6d('0x46')]);return _0x2903e7[_0xbe6d('0x7d')](_0x1460ad);}})[_0xbe6d('0x28')](function(_0x4427a8){if(_0x4427a8){_0xb62831=_0x4427a8[_0xbe6d('0x3d')];if(!_0x118b18['query']['hasOwnProperty'](_0xbe6d('0x7e'))){_0x1460ad[_0xbe6d('0x21')]=qs[_0xbe6d('0x21')](_0x118b18[_0xbe6d('0x38')][_0xbe6d('0x21')]);_0x1460ad[_0xbe6d('0x1f')]=qs[_0xbe6d('0x1f')](_0x118b18[_0xbe6d('0x38')]['offset']);}return _0x2903e7[_0xbe6d('0x7d')](_0x1460ad);}})[_0xbe6d('0x28')](function(_0x462a7f){if(_0x462a7f){return _0x462a7f?{'count':_0xb62831,'rows':_0x462a7f}:null;}})[_0xbe6d('0x28')](respondWithResult(_0x5b043b,null))[_0xbe6d('0x4a')](handleError(_0x5b043b,null));}; \ No newline at end of file +var _0x4cdc=['create','body','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrChatWebsites','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','pick','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','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','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','error','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','findAll','rows','catch','params','keys','includeAll'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x4cdc,0xb9));var _0xc4cd=function(_0x946dde,_0x3fa095){_0x946dde=_0x946dde-0x0;var _0xa2a7e0=_0x4cdc[_0x946dde];return _0xa2a7e0;};'use strict';var emlformat=require(_0xc4cd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc4cd('0x1'));var rp=require('request-promise');var moment=require(_0xc4cd('0x2'));var BPromise=require(_0xc4cd('0x3'));var Mustache=require(_0xc4cd('0x4'));var util=require(_0xc4cd('0x5'));var path=require(_0xc4cd('0x6'));var sox=require(_0xc4cd('0x7'));var csv=require('to-csv');var ejs=require(_0xc4cd('0x8'));var fs=require('fs');var fs_extra=require(_0xc4cd('0x9'));var _=require(_0xc4cd('0xa'));var squel=require(_0xc4cd('0xb'));var crypto=require('crypto');var jsforce=require(_0xc4cd('0xc'));var deskjs=require(_0xc4cd('0xd'));var toCsv=require(_0xc4cd('0xe'));var querystring=require(_0xc4cd('0xf'));var Papa=require(_0xc4cd('0x10'));var Redis=require(_0xc4cd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc4cd('0x12'));var hardwareService=require(_0xc4cd('0x13'));var logger=require(_0xc4cd('0x14'))(_0xc4cd('0x15'));var utils=require(_0xc4cd('0x16'));var config=require(_0xc4cd('0x17'));var licenseUtil=require(_0xc4cd('0x18'));var db=require(_0xc4cd('0x19'))['db'];config['redis']=_[_0xc4cd('0x1a')](config['redis'],{'host':_0xc4cd('0x1b'),'port':0x18eb});var socket=require(_0xc4cd('0x1c'))(new Redis(config[_0xc4cd('0x1d')]));require('./dashboard.socket')[_0xc4cd('0x1e')](socket);function respondWithStatusCode(_0x4a2ed9,_0x2fc934){_0x2fc934=_0x2fc934||0xcc;return function(_0x3f1aab){if(_0x3f1aab){return _0x4a2ed9[_0xc4cd('0x1f')](_0x2fc934);}return _0x4a2ed9['status'](_0x2fc934)[_0xc4cd('0x20')]();};}function respondWithResult(_0x22d1f2,_0x4ea11a){_0x4ea11a=_0x4ea11a||0xc8;return function(_0x455993){if(_0x455993){return _0x22d1f2[_0xc4cd('0x21')](_0x4ea11a)[_0xc4cd('0x22')](_0x455993);}};}function respondWithFilteredResult(_0x28f1c6,_0x53b44e){return function(_0x1fae4e){if(_0x1fae4e){var _0x58a4af=typeof _0x53b44e[_0xc4cd('0x23')]===_0xc4cd('0x24')&&typeof _0x53b44e[_0xc4cd('0x25')]===_0xc4cd('0x24');var _0x7c8880=_0x1fae4e[_0xc4cd('0x26')];var _0x6859d4=_0x58a4af?0x0:_0x53b44e[_0xc4cd('0x23')];var _0x2df15a=_0x58a4af?_0x1fae4e[_0xc4cd('0x26')]:_0x53b44e[_0xc4cd('0x23')]+_0x53b44e[_0xc4cd('0x25')];var _0x43141f;if(_0x2df15a>=_0x7c8880){_0x2df15a=_0x7c8880;_0x43141f=0xc8;}else{_0x43141f=0xce;}_0x28f1c6[_0xc4cd('0x21')](_0x43141f);return _0x28f1c6[_0xc4cd('0x27')]('Content-Range',_0x6859d4+'-'+_0x2df15a+'/'+_0x7c8880)['json'](_0x1fae4e);}return null;};}function patchUpdates(_0xd94aa0){return function(_0x3a3fba){try{jsonpatch['apply'](_0x3a3fba,_0xd94aa0,!![]);}catch(_0xd431ca){return BPromise[_0xc4cd('0x28')](_0xd431ca);}return _0x3a3fba[_0xc4cd('0x29')]();};}function saveUpdates(_0x1a51ef,_0x43b576){return function(_0x1dc9a6){if(_0x1dc9a6){return _0x1dc9a6['update'](_0x1a51ef)[_0xc4cd('0x2a')](function(_0x524e99){return _0x524e99;});}return null;};}function removeEntity(_0x228b7e,_0x5b7bb3){return function(_0x28ca8b){if(_0x28ca8b){return _0x28ca8b[_0xc4cd('0x2b')]()[_0xc4cd('0x2a')](function(){var _0x4416dd=_0x28ca8b[_0xc4cd('0x2c')]({'plain':!![]});var _0x438364=_0xc4cd('0x2d');return db[_0xc4cd('0x2e')]['destroy']({'where':{'type':_0x438364,'resourceId':_0x4416dd['id']}})['then'](function(){return _0x28ca8b;});})['then'](function(){_0x228b7e[_0xc4cd('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f5b25,_0x1b59fc){return function(_0x217bb5){if(!_0x217bb5){_0x4f5b25[_0xc4cd('0x1f')](0x194);}return _0x217bb5;};}function handleError(_0x337f53,_0x568d8a){_0x568d8a=_0x568d8a||0x1f4;return function(_0x53cb5f){logger[_0xc4cd('0x2f')](_0x53cb5f['stack']);if(_0x53cb5f['name']){delete _0x53cb5f[_0xc4cd('0x30')];}_0x337f53[_0xc4cd('0x21')](_0x568d8a)[_0xc4cd('0x31')](_0x53cb5f);};}exports[_0xc4cd('0x32')]=function(_0xda96e8,_0x372ccf){var _0x30bbbc={},_0x16961e={},_0x42048d={'count':0x0,'rows':[]};var _0x8ae75c=_[_0xc4cd('0x33')](db[_0xc4cd('0x34')][_0xc4cd('0x35')],function(_0x20e91f){return{'name':_0x20e91f[_0xc4cd('0x36')],'type':_0x20e91f[_0xc4cd('0x37')][_0xc4cd('0x38')]};});_0x16961e[_0xc4cd('0x39')]=_[_0xc4cd('0x33')](_0x8ae75c,_0xc4cd('0x30'));_0x16961e['query']=_['keys'](_0xda96e8[_0xc4cd('0x3a')]);_0x16961e[_0xc4cd('0x3b')]=_[_0xc4cd('0x3c')](_0x16961e[_0xc4cd('0x39')],_0x16961e[_0xc4cd('0x3a')]);_0x30bbbc[_0xc4cd('0x3d')]=_[_0xc4cd('0x3c')](_0x16961e['model'],qs[_0xc4cd('0x3e')](_0xda96e8['query'][_0xc4cd('0x3e')]));_0x30bbbc[_0xc4cd('0x3d')]=_0x30bbbc[_0xc4cd('0x3d')][_0xc4cd('0x3f')]?_0x30bbbc[_0xc4cd('0x3d')]:_0x16961e[_0xc4cd('0x39')];if(!_0xda96e8[_0xc4cd('0x3a')][_0xc4cd('0x40')](_0xc4cd('0x41'))){_0x30bbbc['limit']=qs[_0xc4cd('0x25')](_0xda96e8[_0xc4cd('0x3a')]['limit']);_0x30bbbc['offset']=qs[_0xc4cd('0x23')](_0xda96e8[_0xc4cd('0x3a')][_0xc4cd('0x23')]);}_0x30bbbc[_0xc4cd('0x42')]=qs['sort'](_0xda96e8[_0xc4cd('0x3a')][_0xc4cd('0x43')]);_0x30bbbc[_0xc4cd('0x44')]=qs[_0xc4cd('0x3b')](_['pick'](_0xda96e8[_0xc4cd('0x3a')],_0x16961e['filters']),_0x8ae75c);if(_0xda96e8['query'][_0xc4cd('0x45')]){_0x30bbbc['where']=_['merge'](_0x30bbbc[_0xc4cd('0x44')],{'$or':_[_0xc4cd('0x33')](_0x8ae75c,function(_0x14ae71){if(_0x14ae71['type']!==_0xc4cd('0x46')){var _0x23157b={};_0x23157b[_0x14ae71[_0xc4cd('0x30')]]={'$like':'%'+_0xda96e8['query'][_0xc4cd('0x45')]+'%'};return _0x23157b;}})});}_0x30bbbc=_[_0xc4cd('0x47')]({},_0x30bbbc,_0xda96e8[_0xc4cd('0x48')]);var _0xa2c9c8={'where':_0x30bbbc[_0xc4cd('0x44')]};return db['Dashboard'][_0xc4cd('0x26')](_0xa2c9c8)[_0xc4cd('0x2a')](function(_0x6461a6){_0x42048d[_0xc4cd('0x26')]=_0x6461a6;if(_0xda96e8[_0xc4cd('0x3a')]['includeAll']){_0x30bbbc['include']=[{'all':!![]}];}return db[_0xc4cd('0x34')][_0xc4cd('0x49')](_0x30bbbc);})[_0xc4cd('0x2a')](function(_0x1ed084){_0x42048d[_0xc4cd('0x4a')]=_0x1ed084;return _0x42048d;})['then'](respondWithFilteredResult(_0x372ccf,_0x30bbbc))[_0xc4cd('0x4b')](handleError(_0x372ccf,null));};exports['show']=function(_0x2e6c6d,_0x159875){var _0x284e06={'raw':![],'where':{'id':_0x2e6c6d[_0xc4cd('0x4c')]['id']}},_0x13a155={};_0x13a155[_0xc4cd('0x39')]=_[_0xc4cd('0x4d')](db[_0xc4cd('0x34')][_0xc4cd('0x35')]);_0x13a155[_0xc4cd('0x3a')]=_['keys'](_0x2e6c6d[_0xc4cd('0x3a')]);_0x13a155[_0xc4cd('0x3b')]=_[_0xc4cd('0x3c')](_0x13a155[_0xc4cd('0x39')],_0x13a155['query']);_0x284e06['attributes']=_['intersection'](_0x13a155['model'],qs['fields'](_0x2e6c6d[_0xc4cd('0x3a')][_0xc4cd('0x3e')]));_0x284e06[_0xc4cd('0x3d')]=_0x284e06[_0xc4cd('0x3d')][_0xc4cd('0x3f')]?_0x284e06[_0xc4cd('0x3d')]:_0x13a155[_0xc4cd('0x39')];if(_0x2e6c6d[_0xc4cd('0x3a')][_0xc4cd('0x4e')]){_0x284e06['include']=[{'all':!![]}];}_0x284e06=_[_0xc4cd('0x47')]({},_0x284e06,_0x2e6c6d['options']);return db[_0xc4cd('0x34')]['find'](_0x284e06)[_0xc4cd('0x2a')](handleEntityNotFound(_0x159875,null))[_0xc4cd('0x2a')](respondWithResult(_0x159875,null))[_0xc4cd('0x4b')](handleError(_0x159875,null));};exports[_0xc4cd('0x4f')]=function(_0x4699ca,_0x22bb94){return db[_0xc4cd('0x34')][_0xc4cd('0x4f')](_0x4699ca[_0xc4cd('0x50')],{})[_0xc4cd('0x2a')](function(_0x4a0ddc){var _0x5ba9ad=_0x4699ca[_0xc4cd('0x51')][_0xc4cd('0x2c')]({'plain':!![]});if(!_0x5ba9ad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ba9ad[_0xc4cd('0x52')]===_0xc4cd('0x51')){var _0x581fbb=_0x4a0ddc['get']({'plain':!![]});var _0x599c05=_0xc4cd('0x2d');return db[_0xc4cd('0x53')][_0xc4cd('0x54')]({'where':{'name':_0x599c05,'userProfileId':_0x5ba9ad['userProfileId']},'raw':!![]})[_0xc4cd('0x2a')](function(_0x4e468b){if(_0x4e468b&&_0x4e468b[_0xc4cd('0x55')]===0x0){return db[_0xc4cd('0x2e')]['create']({'name':_0x581fbb[_0xc4cd('0x30')],'resourceId':_0x581fbb['id'],'type':_0x4e468b[_0xc4cd('0x30')],'sectionId':_0x4e468b['id']},{})[_0xc4cd('0x2a')](function(){return _0x4a0ddc;});}else{return _0x4a0ddc;}})['catch'](function(_0xb24ee6){logger['error'](_0xc4cd('0x56'),_0xb24ee6);throw _0xb24ee6;});}return _0x4a0ddc;})[_0xc4cd('0x2a')](respondWithResult(_0x22bb94,0xc9))[_0xc4cd('0x4b')](handleError(_0x22bb94,null));};exports[_0xc4cd('0x57')]=function(_0x559f96,_0x56a891){var _0x49bc27={'where':{'id':_0x559f96[_0xc4cd('0x4c')]['id']}},_0x16b97a={};_0x16b97a['model']=_[_0xc4cd('0x4d')](db[_0xc4cd('0x34')][_0xc4cd('0x35')]);_0x49bc27[_0xc4cd('0x3d')]=_[_0xc4cd('0x3c')](_0x16b97a[_0xc4cd('0x39')],qs[_0xc4cd('0x3e')](_0x559f96[_0xc4cd('0x3a')][_0xc4cd('0x3e')]));_0x49bc27[_0xc4cd('0x3d')]=_0x49bc27[_0xc4cd('0x3d')][_0xc4cd('0x3f')]?_0x49bc27['attributes']:_0x16b97a[_0xc4cd('0x39')];if(_0x559f96[_0xc4cd('0x3a')][_0xc4cd('0x4e')]){_0x49bc27[_0xc4cd('0x58')]=[{'all':!![]}];}_0x49bc27=_[_0xc4cd('0x47')]({},_0x49bc27,_0x559f96[_0xc4cd('0x48')]);return db[_0xc4cd('0x34')][_0xc4cd('0x54')](_0x49bc27)['then'](handleEntityNotFound(_0x56a891,null))[_0xc4cd('0x2a')](function(_0xffcc7){if(_0xffcc7){var _0x2a1378=_0xffcc7[_0xc4cd('0x2c')]({'plain':!![]});_0x2a1378=qs[_0xc4cd('0x59')](_0x2a1378,['id',_0xc4cd('0x5a'),_0xc4cd('0x5b')]);_0x559f96[_0xc4cd('0x50')]=_[_0xc4cd('0x59')](_0x559f96[_0xc4cd('0x50')],['id',_0xc4cd('0x5a'),_0xc4cd('0x5b')]);return db[_0xc4cd('0x34')][_0xc4cd('0x4f')](_[_0xc4cd('0x47')](_0x2a1378,_0x559f96[_0xc4cd('0x50')]),{'include':_0x559f96[_0xc4cd('0x3a')][_0xc4cd('0x4e')]?[{'all':!![]}]:undefined})[_0xc4cd('0x2a')](function(_0x294a10){var _0x2754a2=_0x559f96['user']['get']({'plain':!![]});if(!_0x2754a2)throw new Error(_0xc4cd('0x5c'));if(_0x2754a2[_0xc4cd('0x52')]===_0xc4cd('0x51')){var _0x277408=_0x294a10[_0xc4cd('0x2c')]({'plain':!![]});var _0x3831a5='CustomDashboards';return db[_0xc4cd('0x53')][_0xc4cd('0x54')]({'where':{'name':_0x3831a5,'userProfileId':_0x2754a2[_0xc4cd('0x5d')]},'raw':!![]})['then'](function(_0x501203){if(_0x501203&&_0x501203[_0xc4cd('0x55')]===0x0){return db['UserProfileResource'][_0xc4cd('0x4f')]({'name':_0x277408['name'],'resourceId':_0x277408['id'],'type':_0x501203[_0xc4cd('0x30')],'sectionId':_0x501203['id']},{})[_0xc4cd('0x2a')](function(){return _0x294a10;});}else{return _0x294a10;}})[_0xc4cd('0x4b')](function(_0x1ed862){logger[_0xc4cd('0x2f')](_0xc4cd('0x56'),_0x1ed862);throw _0x1ed862;});}return _0x294a10;});}})['then'](respondWithResult(_0x56a891,0xc9))['catch'](handleError(_0x56a891,null));};exports[_0xc4cd('0x5e')]=function(_0x252439,_0x1311a2){if(_0x252439['body']['id']){delete _0x252439[_0xc4cd('0x50')]['id'];}return db[_0xc4cd('0x34')]['find']({'where':{'id':_0x252439[_0xc4cd('0x4c')]['id']}})[_0xc4cd('0x2a')](handleEntityNotFound(_0x1311a2,null))[_0xc4cd('0x2a')](saveUpdates(_0x252439['body'],null))[_0xc4cd('0x2a')](respondWithResult(_0x1311a2,null))[_0xc4cd('0x4b')](handleError(_0x1311a2,null));};exports['destroy']=function(_0x105693,_0x3f87c7){return db[_0xc4cd('0x34')]['find']({'where':{'id':_0x105693[_0xc4cd('0x4c')]['id']}})[_0xc4cd('0x2a')](handleEntityNotFound(_0x3f87c7,null))[_0xc4cd('0x2a')](removeEntity(_0x3f87c7,null))['catch'](handleError(_0x3f87c7,null));};function widgetAttributes(_0x2657d1){try{switch(_0x2657d1['type']){case _0xc4cd('0x5f'):return[{'name':_0xc4cd('0x60'),'value':_0x2657d1[_0xc4cd('0x60')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x0]?_0x2657d1[_0xc4cd('0x61')][0x0][_0xc4cd('0x62')]:undefined)||_0xc4cd('0x63')}];case _0xc4cd('0x64'):return[{'name':'attrPath','value':_0x2657d1[_0xc4cd('0x65')]||(_0x2657d1['attrs']&&_0x2657d1[_0xc4cd('0x61')][0x0]?_0x2657d1['attrs'][0x0][_0xc4cd('0x62')]:undefined)||''}];case _0xc4cd('0x66'):return[{'name':_0xc4cd('0x67'),'value':_0x2657d1[_0xc4cd('0x67')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x0]?_0x2657d1[_0xc4cd('0x61')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xc4cd('0x68'),'value':_0x2657d1[_0xc4cd('0x68')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x1]?_0x2657d1[_0xc4cd('0x61')][0x1][_0xc4cd('0x62')]:undefined)||_0xc4cd('0x69')},{'name':_0xc4cd('0x6a'),'value':_0x2657d1[_0xc4cd('0x6a')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x2]?_0x2657d1[_0xc4cd('0x61')][0x2]['value']:undefined)||0xc}];case _0xc4cd('0x6b'):return[{'name':_0xc4cd('0x6c'),'value':_0x2657d1[_0xc4cd('0x6c')]||(_0x2657d1['attrs']&&_0x2657d1[_0xc4cd('0x61')][0x0]?_0x2657d1[_0xc4cd('0x61')][0x0][_0xc4cd('0x62')]:undefined)||'total'},{'name':_0xc4cd('0x6d'),'value':_0x2657d1[_0xc4cd('0x6d')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x1]?_0x2657d1[_0xc4cd('0x61')][0x1][_0xc4cd('0x62')]:undefined)||[]},{'name':_0xc4cd('0x6a'),'value':_0x2657d1[_0xc4cd('0x6a')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x2]?_0x2657d1[_0xc4cd('0x61')][0x2][_0xc4cd('0x62')]:undefined)||0x14},{'name':_0xc4cd('0x6e'),'value':_0x2657d1[_0xc4cd('0x6e')]||(_0x2657d1['attrs']&&_0x2657d1['attrs'][0x3]?_0x2657d1['attrs'][0x3][_0xc4cd('0x62')]:undefined)||'voice'},{'name':_0xc4cd('0x6f'),'value':_0x2657d1[_0xc4cd('0x6f')]||(_0x2657d1['attrs']&&_0x2657d1['attrs'][0x4]?_0x2657d1[_0xc4cd('0x61')][0x4][_0xc4cd('0x62')]:undefined)||''},{'name':_0xc4cd('0x70'),'value':_0x2657d1[_0xc4cd('0x70')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x5]?_0x2657d1[_0xc4cd('0x61')][0x5][_0xc4cd('0x62')]:undefined)||''},{'name':_0xc4cd('0x71'),'value':_0x2657d1[_0xc4cd('0x71')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x6]?_0x2657d1[_0xc4cd('0x61')][0x6][_0xc4cd('0x62')]:undefined)||''},{'name':_0xc4cd('0x72'),'value':_0x2657d1[_0xc4cd('0x72')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x7]?_0x2657d1[_0xc4cd('0x61')][0x7][_0xc4cd('0x62')]:undefined)||''},{'name':_0xc4cd('0x73'),'value':_0x2657d1[_0xc4cd('0x73')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x8]?_0x2657d1[_0xc4cd('0x61')][0x8][_0xc4cd('0x62')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2657d1['attrChatWebsites']||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1['attrs'][0x9]?_0x2657d1[_0xc4cd('0x61')][0x9]['value']:undefined)||''}];case _0xc4cd('0x74'):case _0xc4cd('0x75'):return[{'name':_0xc4cd('0x76'),'value':_0x2657d1[_0xc4cd('0x76')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x0]?_0x2657d1[_0xc4cd('0x61')][0x0][_0xc4cd('0x62')]:undefined)||_0xc4cd('0x77')},{'name':_0xc4cd('0x78'),'value':_0x2657d1[_0xc4cd('0x78')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x1]?_0x2657d1[_0xc4cd('0x61')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x2657d1['attrSerie3']||(_0x2657d1['attrs']&&_0x2657d1[_0xc4cd('0x61')][0x2]?_0x2657d1[_0xc4cd('0x61')][0x2]['value']:undefined)||null},{'name':_0xc4cd('0x6d'),'value':_0x2657d1['attrVoiceQueues']||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x3]?_0x2657d1[_0xc4cd('0x61')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x2657d1[_0xc4cd('0x6e')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1['attrs'][0x4]?_0x2657d1['attrs'][0x4]['value']:undefined)||'voice'},{'name':_0xc4cd('0x6f'),'value':_0x2657d1[_0xc4cd('0x6f')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x5]?_0x2657d1[_0xc4cd('0x61')][0x5][_0xc4cd('0x62')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2657d1[_0xc4cd('0x70')]||(_0x2657d1['attrs']&&_0x2657d1[_0xc4cd('0x61')][0x6]?_0x2657d1[_0xc4cd('0x61')][0x6][_0xc4cd('0x62')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2657d1[_0xc4cd('0x71')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x7]?_0x2657d1['attrs'][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2657d1[_0xc4cd('0x72')]||(_0x2657d1['attrs']&&_0x2657d1[_0xc4cd('0x61')][0x8]?_0x2657d1['attrs'][0x8][_0xc4cd('0x62')]:undefined)||''},{'name':_0xc4cd('0x73'),'value':_0x2657d1[_0xc4cd('0x73')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x9]?_0x2657d1[_0xc4cd('0x61')][0x9][_0xc4cd('0x62')]:undefined)||''},{'name':_0xc4cd('0x79'),'value':_0x2657d1[_0xc4cd('0x79')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0xa]?_0x2657d1['attrs'][0xa]['value']:undefined)||''}];case _0xc4cd('0x7a'):return[{'name':_0xc4cd('0x7b'),'type':_0x2657d1['reportType']||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1['attrs'][0x0]?_0x2657d1[_0xc4cd('0x61')][0x0]['type']:undefined)||null,'value':_0x2657d1['attrReport']||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1[_0xc4cd('0x61')][0x0]?_0x2657d1[_0xc4cd('0x61')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x2657d1[_0xc4cd('0x7c')]||(_0x2657d1[_0xc4cd('0x61')]&&_0x2657d1['attrs'][0x1]?_0x2657d1[_0xc4cd('0x61')][0x1][_0xc4cd('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x10341c){logger[_0xc4cd('0x2f')](_0xc4cd('0x7d'),JSON[_0xc4cd('0x7e')](_0x10341c));return[];}}exports[_0xc4cd('0x7f')]=function(_0x3535f4,_0x275959,_0x27eaab){if(_0x3535f4[_0xc4cd('0x50')]['id']){delete _0x3535f4[_0xc4cd('0x50')]['id'];}return db[_0xc4cd('0x34')][_0xc4cd('0x54')]({'where':{'id':_0x3535f4[_0xc4cd('0x4c')]['id']}})[_0xc4cd('0x2a')](handleEntityNotFound(_0x275959,null))[_0xc4cd('0x2a')](function(_0x4f1771){if(_0x4f1771){_0x3535f4[_0xc4cd('0x50')]['DashboardId']=_0x4f1771['id'];_0x3535f4[_0xc4cd('0x50')][_0xc4cd('0x61')]=widgetAttributes(_0x3535f4[_0xc4cd('0x50')]);return db[_0xc4cd('0x80')][_0xc4cd('0x4f')](_0x3535f4[_0xc4cd('0x50')]);}})['then'](respondWithResult(_0x275959,null))[_0xc4cd('0x4b')](handleError(_0x275959,null));};exports[_0xc4cd('0x81')]=function(_0x141622,_0x2f2736,_0x116e90){var _0x335da1={};var _0x3ffafb={};var _0x250891;var _0x1e72b7;return db[_0xc4cd('0x34')][_0xc4cd('0x82')]({'where':{'id':_0x141622[_0xc4cd('0x4c')]['id']}})[_0xc4cd('0x2a')](handleEntityNotFound(_0x2f2736,null))[_0xc4cd('0x2a')](function(_0x5dec03){if(_0x5dec03){_0x250891=_0x5dec03;_0x3ffafb[_0xc4cd('0x39')]=_['keys'](db[_0xc4cd('0x80')][_0xc4cd('0x35')]);_0x3ffafb[_0xc4cd('0x3a')]=_[_0xc4cd('0x4d')](_0x141622[_0xc4cd('0x3a')]);_0x3ffafb[_0xc4cd('0x3b')]=_[_0xc4cd('0x3c')](_0x3ffafb[_0xc4cd('0x39')],_0x3ffafb['query']);_0x335da1[_0xc4cd('0x3d')]=_[_0xc4cd('0x3c')](_0x3ffafb['model'],qs[_0xc4cd('0x3e')](_0x141622[_0xc4cd('0x3a')][_0xc4cd('0x3e')]));_0x335da1[_0xc4cd('0x3d')]=_0x335da1[_0xc4cd('0x3d')][_0xc4cd('0x3f')]?_0x335da1['attributes']:_0x3ffafb['model'];_0x335da1[_0xc4cd('0x42')]=qs[_0xc4cd('0x43')](_0x141622[_0xc4cd('0x3a')][_0xc4cd('0x43')]);_0x335da1[_0xc4cd('0x44')]=qs[_0xc4cd('0x3b')](_[_0xc4cd('0x83')](_0x141622[_0xc4cd('0x3a')],_0x3ffafb[_0xc4cd('0x3b')]));if(_0x141622['query'][_0xc4cd('0x45')]){_0x335da1['where']=_[_0xc4cd('0x47')](_0x335da1[_0xc4cd('0x44')],{'$or':_['map'](_0x335da1[_0xc4cd('0x3d')],function(_0x338764){var _0x198d7f={};_0x198d7f[_0x338764]={'$like':'%'+_0x141622[_0xc4cd('0x3a')][_0xc4cd('0x45')]+'%'};return _0x198d7f;})});}_0x335da1=_[_0xc4cd('0x47')]({},_0x335da1,_0x141622[_0xc4cd('0x48')]);return _0x250891['getItems'](_0x335da1);}})[_0xc4cd('0x2a')](function(_0x459e67){if(_0x459e67){_0x1e72b7=_0x459e67[_0xc4cd('0x3f')];if(!_0x141622[_0xc4cd('0x3a')][_0xc4cd('0x40')]('nolimit')){_0x335da1[_0xc4cd('0x25')]=qs[_0xc4cd('0x25')](_0x141622['query'][_0xc4cd('0x25')]);_0x335da1['offset']=qs[_0xc4cd('0x23')](_0x141622[_0xc4cd('0x3a')][_0xc4cd('0x23')]);}return _0x250891[_0xc4cd('0x81')](_0x335da1);}})[_0xc4cd('0x2a')](function(_0xec6693){if(_0xec6693){return _0xec6693?{'count':_0x1e72b7,'rows':_0xec6693}:null;}})['then'](respondWithResult(_0x2f2736,null))[_0xc4cd('0x4b')](handleError(_0x2f2736,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 1734e67..5acc934 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 _0x3cdc=['Dashboard','setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x2a7174,_0x253f31){var _0x53fd8c=function(_0x255f1e){while(--_0x255f1e){_0x2a7174['push'](_0x2a7174['shift']());}};_0x53fd8c(++_0x253f31);}(_0x3cdc,0x18b));var _0xc3cd=function(_0x14ddd4,_0x5b527d){_0x14ddd4=_0x14ddd4-0x0;var _0x421616=_0x3cdc[_0x14ddd4];return _0x421616;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xc3cd('0x0'))['db'][_0xc3cd('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xc3cd('0x2')](0x0);var events={'afterCreate':_0xc3cd('0x3'),'afterUpdate':_0xc3cd('0x4'),'afterDestroy':_0xc3cd('0x5')};function emitEvent(_0x3b90ad){return function(_0x3274f6,_0x15811d,_0x275374){DashboardEvents[_0xc3cd('0x6')](_0x3b90ad+':'+_0x3274f6['id'],_0x3274f6);DashboardEvents[_0xc3cd('0x6')](_0x3b90ad,_0x3274f6);_0x275374(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xc3cd('0x7')](e,emitEvent(event));}}module[_0xc3cd('0x8')]=DashboardEvents; \ No newline at end of file +var _0xe08b=['events','Dashboard','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe08b,0x10e));var _0xbe08=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xe08b[_0x2ec461];return _0x28603d;};'use strict';var EventEmitter=require(_0xbe08('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xbe08('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xbe08('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbe08('0x3'),'afterDestroy':_0xbe08('0x4')};function emitEvent(_0x27b8f8){return function(_0x469522,_0x41edfb,_0x1ba7e6){DashboardEvents[_0xbe08('0x5')](_0x27b8f8+':'+_0x469522['id'],_0x469522);DashboardEvents[_0xbe08('0x5')](_0x27b8f8,_0x469522);_0x1ba7e6(null);};}for(var e in events){if(events[_0xbe08('0x6')](e)){var event=events[e];Dashboard[_0xbe08('0x7')](e,emitEvent(event));}}module[_0xbe08('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 e95d758..9fc48dc 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 _0x6cfc=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./dashboard.attributes','exports','Dashboard','dashboards'];(function(_0xdc356f,_0x3003d0){var _0x339eaa=function(_0xc2283e){while(--_0xc2283e){_0xdc356f['push'](_0xdc356f['shift']());}};_0x339eaa(++_0x3003d0);}(_0x6cfc,0x14a));var _0xc6cf=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0x6cfc[_0x5a5395];return _0x4da43d;};'use strict';var _=require('lodash');var util=require(_0xc6cf('0x0'));var logger=require(_0xc6cf('0x1'))(_0xc6cf('0x2'));var moment=require(_0xc6cf('0x3'));var BPromise=require(_0xc6cf('0x4'));var rp=require(_0xc6cf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc6cf('0x6'));var config=require('../../config/environment');var attributes=require(_0xc6cf('0x7'));module[_0xc6cf('0x8')]=function(_0x3a9c42,_0xdba158){return _0x3a9c42['define'](_0xc6cf('0x9'),attributes,{'tableName':_0xc6cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce25=['path','../../config/environment','./dashboard.attributes','define','Dashboard','dashboards','../../config/logger','request-promise'];(function(_0x562785,_0x15c245){var _0x4ac95a=function(_0x4832b7){while(--_0x4832b7){_0x562785['push'](_0x562785['shift']());}};_0x4ac95a(++_0x15c245);}(_0xce25,0x196));var _0x5ce2=function(_0x574c51,_0x17628b){_0x574c51=_0x574c51-0x0;var _0x233481=_0xce25[_0x574c51];return _0x233481;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5ce2('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5ce2('0x1'));var fs=require('fs');var path=require(_0x5ce2('0x2'));var rimraf=require('rimraf');var config=require(_0x5ce2('0x3'));var attributes=require(_0x5ce2('0x4'));module['exports']=function(_0x57a7a5,_0x41fb85){return _0x57a7a5[_0x5ce2('0x5')](_0x5ce2('0x6'),attributes,{'tableName':_0x5ce2('0x7'),'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 a766bf0..094b253 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 _0xb89d=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./dashboard.socket','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb89d,0xcc));var _0xdb89=function(_0x40a55c,_0x556e58){_0x40a55c=_0x40a55c-0x0;var _0x59b6c5=_0xb89d[_0x40a55c];return _0x59b6c5;};'use strict';var _=require(_0xdb89('0x0'));var util=require(_0xdb89('0x1'));var moment=require(_0xdb89('0x2'));var BPromise=require('bluebird');var rs=require(_0xdb89('0x3'));var fs=require('fs');var Redis=require(_0xdb89('0x4'));var db=require(_0xdb89('0x5'))['db'];var utils=require(_0xdb89('0x6'));var logger=require(_0xdb89('0x7'))(_0xdb89('0x8'));var config=require(_0xdb89('0x9'));var jayson=require(_0xdb89('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xdb89('0xb')],{'host':_0xdb89('0xc'),'port':0x18eb});var socket=require(_0xdb89('0xd'))(new Redis(config[_0xdb89('0xb')]));require(_0xdb89('0xe'))['register'](socket);function respondWithRpcPromise(_0x904b37,_0x52b978,_0x4ec60a){return new BPromise(function(_0x34b0df,_0x435efe){return client['request'](_0x904b37,_0x4ec60a)['then'](function(_0x3c4e3d){logger[_0xdb89('0xf')](_0xdb89('0x10'),_0x52b978,_0xdb89('0x11'));logger['debug'](_0xdb89('0x12'),_0x52b978,_0xdb89('0x11'),JSON[_0xdb89('0x13')](_0x3c4e3d));if(_0x3c4e3d['error']){if(_0x3c4e3d[_0xdb89('0x14')][_0xdb89('0x15')]===0x1f4){logger[_0xdb89('0x14')](_0xdb89('0x10'),_0x52b978,_0x3c4e3d[_0xdb89('0x14')][_0xdb89('0x16')]);return _0x435efe(_0x3c4e3d['error']['message']);}logger[_0xdb89('0x14')](_0xdb89('0x10'),_0x52b978,_0x3c4e3d['error'][_0xdb89('0x16')]);return _0x34b0df(_0x3c4e3d[_0xdb89('0x14')][_0xdb89('0x16')]);}else{logger[_0xdb89('0xf')](_0xdb89('0x10'),_0x52b978,_0xdb89('0x11'));_0x34b0df(_0x3c4e3d[_0xdb89('0x17')][_0xdb89('0x16')]);}})[_0xdb89('0x18')](function(_0x3bbe86){logger['error'](_0xdb89('0x10'),_0x52b978,_0x3bbe86);_0x435efe(_0x3bbe86);});});} \ No newline at end of file +var _0x3d74=['message','info','result','catch','lodash','moment','bluebird','randomstring','rpc','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0x3d74,0x1e8));var _0x43d7=function(_0x3504e9,_0x334180){_0x3504e9=_0x3504e9-0x0;var _0x1b4d74=_0x3d74[_0x3504e9];return _0x1b4d74;};'use strict';var _=require(_0x43d7('0x0'));var util=require('util');var moment=require(_0x43d7('0x1'));var BPromise=require(_0x43d7('0x2'));var rs=require(_0x43d7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x43d7('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x43d7('0x5')]({'port':0x232a});config[_0x43d7('0x6')]=_[_0x43d7('0x7')](config['redis'],{'host':_0x43d7('0x8'),'port':0x18eb});var socket=require(_0x43d7('0x9'))(new Redis(config[_0x43d7('0x6')]));require(_0x43d7('0xa'))['register'](socket);function respondWithRpcPromise(_0x38b7f1,_0x1ed35a,_0x53fc1c){return new BPromise(function(_0x376721,_0x201a4d){return client[_0x43d7('0xb')](_0x38b7f1,_0x53fc1c)['then'](function(_0x56fe35){logger['info'](_0x43d7('0xc'),_0x1ed35a,'request\x20sent');logger[_0x43d7('0xd')](_0x43d7('0xe'),_0x1ed35a,_0x43d7('0xf'),JSON['stringify'](_0x56fe35));if(_0x56fe35[_0x43d7('0x10')]){if(_0x56fe35[_0x43d7('0x10')][_0x43d7('0x11')]===0x1f4){logger[_0x43d7('0x10')](_0x43d7('0xc'),_0x1ed35a,_0x56fe35[_0x43d7('0x10')][_0x43d7('0x12')]);return _0x201a4d(_0x56fe35[_0x43d7('0x10')]['message']);}logger[_0x43d7('0x10')](_0x43d7('0xc'),_0x1ed35a,_0x56fe35['error']['message']);return _0x376721(_0x56fe35['error']['message']);}else{logger[_0x43d7('0x13')](_0x43d7('0xc'),_0x1ed35a,_0x43d7('0xf'));_0x376721(_0x56fe35[_0x43d7('0x14')][_0x43d7('0x12')]);}})[_0x43d7('0x15')](function(_0x5b2bc5){logger['error'](_0x43d7('0xc'),_0x1ed35a,_0x5b2bc5);_0x201a4d(_0x5b2bc5);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index bd52fd3..8a862ab 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 _0x6e78=['removeListener','register','length','dashboard:','./dashboard.events','save','remove','update','emit'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x6e78,0x109));var _0x86e7=function(_0x365fe8,_0x5df6c8){_0x365fe8=_0x365fe8-0x0;var _0x59d121=_0x6e78[_0x365fe8];return _0x59d121;};'use strict';var DashboardEvents=require(_0x86e7('0x0'));var events=[_0x86e7('0x1'),_0x86e7('0x2'),_0x86e7('0x3')];function createListener(_0xc65519,_0x227690){return function(_0x2330c2){_0x227690[_0x86e7('0x4')](_0xc65519,_0x2330c2);};}function removeListener(_0x1664ca,_0x474316){return function(){DashboardEvents[_0x86e7('0x5')](_0x1664ca,_0x474316);};}exports[_0x86e7('0x6')]=function(_0x537cf9){for(var _0x2d9d01=0x0,_0x566111=events[_0x86e7('0x7')];_0x2d9d01<_0x566111;_0x2d9d01++){var _0x20370e=events[_0x2d9d01];var _0x5e0e53=createListener(_0x86e7('0x8')+_0x20370e,_0x537cf9);DashboardEvents['on'](_0x20370e,_0x5e0e53);}}; \ No newline at end of file +var _0xeb23=['removeListener','dashboard:','./dashboard.events','save','remove','update','emit'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xeb23,0x1d0));var _0x3eb2=function(_0x3ed7af,_0x13f8ca){_0x3ed7af=_0x3ed7af-0x0;var _0x3cc1ac=_0xeb23[_0x3ed7af];return _0x3cc1ac;};'use strict';var DashboardEvents=require(_0x3eb2('0x0'));var events=[_0x3eb2('0x1'),_0x3eb2('0x2'),_0x3eb2('0x3')];function createListener(_0x3719f2,_0x5b535a){return function(_0x5db4ba){_0x5b535a[_0x3eb2('0x4')](_0x3719f2,_0x5db4ba);};}function removeListener(_0x4deffc,_0x4feaa2){return function(){DashboardEvents[_0x3eb2('0x5')](_0x4deffc,_0x4feaa2);};}exports['register']=function(_0x62c0d2){for(var _0x161e72=0x0,_0x261b36=events['length'];_0x161e72<_0x261b36;_0x161e72++){var _0x40f277=events[_0x161e72];var _0x3dee2f=createListener(_0x3eb2('0x6')+_0x40f277,_0x62c0d2);DashboardEvents['on'](_0x40f277,_0x3dee2f);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 7d29df0..fcb0a30 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 _0x4a69=['addItem','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','getItems','post','create','/:id/clone','clone','/:id/items'];(function(_0x5c23fb,_0xdb7d52){var _0x5c26c0=function(_0x1e9f1f){while(--_0x1e9f1f){_0x5c23fb['push'](_0x5c23fb['shift']());}};_0x5c26c0(++_0xdb7d52);}(_0x4a69,0x132));var _0x94a6=function(_0x1ca9a0,_0x17be2b){_0x1ca9a0=_0x1ca9a0-0x0;var _0x4a80d6=_0x4a69[_0x1ca9a0];return _0x4a80d6;};'use strict';var multer=require('multer');var util=require(_0x94a6('0x0'));var path=require(_0x94a6('0x1'));var timeout=require(_0x94a6('0x2'));var express=require(_0x94a6('0x3'));var router=express[_0x94a6('0x4')]();var fs_extra=require(_0x94a6('0x5'));var auth=require(_0x94a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x94a6('0x7'));var controller=require('./dashboard.controller');router['get']('/',auth[_0x94a6('0x8')](),controller[_0x94a6('0x9')]);router[_0x94a6('0xa')](_0x94a6('0xb'),auth[_0x94a6('0x8')](),controller[_0x94a6('0xc')]);router[_0x94a6('0xa')]('/:id/items',auth[_0x94a6('0x8')](),controller[_0x94a6('0xd')]);router[_0x94a6('0xe')]('/',auth[_0x94a6('0x8')](),controller[_0x94a6('0xf')]);router[_0x94a6('0xe')](_0x94a6('0x10'),auth[_0x94a6('0x8')](),controller[_0x94a6('0x11')]);router[_0x94a6('0xe')](_0x94a6('0x12'),auth[_0x94a6('0x8')](),controller[_0x94a6('0x13')]);router[_0x94a6('0x14')](_0x94a6('0xb'),auth[_0x94a6('0x8')](),controller[_0x94a6('0x15')]);router[_0x94a6('0x16')](_0x94a6('0xb'),auth['isAuthenticated'](),controller[_0x94a6('0x17')]);module[_0x94a6('0x18')]=router; \ No newline at end of file +var _0xc8a1=['clone','addItem','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/items','getItems','post'];(function(_0xee1228,_0x2df586){var _0x210f17=function(_0x5b4d31){while(--_0x5b4d31){_0xee1228['push'](_0xee1228['shift']());}};_0x210f17(++_0x2df586);}(_0xc8a1,0x1ea));var _0x1c8a=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0xc8a1[_0x4394b6];return _0x360244;};'use strict';var multer=require(_0x1c8a('0x0'));var util=require(_0x1c8a('0x1'));var path=require(_0x1c8a('0x2'));var timeout=require(_0x1c8a('0x3'));var express=require(_0x1c8a('0x4'));var router=express['Router']();var fs_extra=require(_0x1c8a('0x5'));var auth=require(_0x1c8a('0x6'));var interaction=require(_0x1c8a('0x7'));var config=require(_0x1c8a('0x8'));var controller=require('./dashboard.controller');router[_0x1c8a('0x9')]('/',auth[_0x1c8a('0xa')](),controller[_0x1c8a('0xb')]);router[_0x1c8a('0x9')](_0x1c8a('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1c8a('0x9')](_0x1c8a('0xd'),auth[_0x1c8a('0xa')](),controller[_0x1c8a('0xe')]);router[_0x1c8a('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1c8a('0xf')]('/:id/clone',auth[_0x1c8a('0xa')](),controller[_0x1c8a('0x10')]);router[_0x1c8a('0xf')]('/:id/items',auth[_0x1c8a('0xa')](),controller[_0x1c8a('0x11')]);router[_0x1c8a('0x12')](_0x1c8a('0xc'),auth[_0x1c8a('0xa')](),controller['update']);router[_0x1c8a('0x13')](_0x1c8a('0xc'),auth[_0x1c8a('0xa')](),controller[_0x1c8a('0x14')]);module[_0x1c8a('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 208c343..2116f61 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 _0x524e=['exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','lodash'];(function(_0x4e2dec,_0x39fbf2){var _0x347a60=function(_0x52b8c2){while(--_0x52b8c2){_0x4e2dec['push'](_0x4e2dec['shift']());}};_0x347a60(++_0x39fbf2);}(_0x524e,0x15e));var _0xe524=function(_0x465193,_0x4a7e40){_0x465193=_0x465193-0x0;var _0x2d1398=_0x524e[_0x465193];return _0x2d1398;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0xe524('0x0'));module[_0xe524('0x1')]={'title':{'type':Sequelize[_0xe524('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe524('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xe524('0x3')](_0xe524('0x4')),'get':function(){try{return JSON[_0xe524('0x5')](this[_0xe524('0x6')](_0xe524('0x7')));}catch(_0x110cff){return[];}},'set':function(_0x4f75d6){try{this[_0xe524('0x8')](_0xe524('0x7'),JSON[_0xe524('0x9')](_0x4f75d6));}catch(_0x533c14){this[_0xe524('0x8')](_0xe524('0x7'),JSON[_0xe524('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xe524('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xe524('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xe524('0xa')]},'col':{'type':Sequelize[_0xe524('0xa')]},'background':{'type':Sequelize[_0xe524('0x2')],'allowNull':![],'defaultValue':_0xe524('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xe524('0x2')],'allowNull':![],'defaultValue':_0xe524('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xe524('0x2')]},'titleFontSize':{'type':Sequelize[_0xe524('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x6f47=['#ffffff','squel','lodash','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x527176,_0x4deb09){var _0x29312f=function(_0x212cfe){while(--_0x212cfe){_0x527176['push'](_0x527176['shift']());}};_0x29312f(++_0x4deb09);}(_0x6f47,0xc7));var _0x76f4=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x6f47[_0x17928f];return _0x500b63;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));module['exports']={'title':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x76f4('0x3')]('long'),'get':function(){try{return JSON[_0x76f4('0x4')](this[_0x76f4('0x5')](_0x76f4('0x6')));}catch(_0x2523ba){return[];}},'set':function(_0x5754ca){try{this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')](_0x5754ca));}catch(_0x497f99){this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![],'defaultValue':_0x76f4('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x76f4('0x2')]},'titleFontSize':{'type':Sequelize[_0x76f4('0x9')],'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 43329c6..3e80e12 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 _0xdded=['register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','end','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','destroy','catch','type','iframe','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0x493ed2,_0x5e97f4){var _0x5c5ce8=function(_0x1e1c06){while(--_0x1e1c06){_0x493ed2['push'](_0x493ed2['shift']());}};_0x5c5ce8(++_0x5e97f4);}(_0xdded,0x17a));var _0xddde=function(_0x345689,_0x139381){_0x345689=_0x345689-0x0;var _0x388d78=_0xdded[_0x345689];return _0x388d78;};'use strict';var emlformat=require(_0xddde('0x0'));var rimraf=require(_0xddde('0x1'));var zipdir=require(_0xddde('0x2'));var jsonpatch=require(_0xddde('0x3'));var rp=require(_0xddde('0x4'));var moment=require(_0xddde('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xddde('0x6'));var util=require(_0xddde('0x7'));var path=require(_0xddde('0x8'));var sox=require(_0xddde('0x9'));var csv=require(_0xddde('0xa'));var ejs=require(_0xddde('0xb'));var fs=require('fs');var fs_extra=require(_0xddde('0xc'));var _=require(_0xddde('0xd'));var squel=require(_0xddde('0xe'));var crypto=require(_0xddde('0xf'));var jsforce=require(_0xddde('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xddde('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xddde('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xddde('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xddde('0x13'))(_0xddde('0x14'));var utils=require(_0xddde('0x15'));var config=require(_0xddde('0x16'));var licenseUtil=require(_0xddde('0x17'));var db=require(_0xddde('0x18'))['db'];config[_0xddde('0x19')]=_[_0xddde('0x1a')](config['redis'],{'host':_0xddde('0x1b'),'port':0x18eb});var socket=require(_0xddde('0x1c'))(new Redis(config[_0xddde('0x19')]));require(_0xddde('0x1d'))[_0xddde('0x1e')](socket);function respondWithStatusCode(_0x31c111,_0x491be5){_0x491be5=_0x491be5||0xcc;return function(_0x20b440){if(_0x20b440){return _0x31c111[_0xddde('0x1f')](_0x491be5);}return _0x31c111[_0xddde('0x20')](_0x491be5)['end']();};}function respondWithResult(_0x5de7ce,_0xadd497){_0xadd497=_0xadd497||0xc8;return function(_0x4e98fd){if(_0x4e98fd){return _0x5de7ce[_0xddde('0x20')](_0xadd497)[_0xddde('0x21')](_0x4e98fd);}};}function respondWithFilteredResult(_0x338fa7,_0x463254){return function(_0x2f0e58){if(_0x2f0e58){var _0x55349b=typeof _0x463254[_0xddde('0x22')]===_0xddde('0x23')&&typeof _0x463254['limit']===_0xddde('0x23');var _0x1185f9=_0x2f0e58['count'];var _0x5ae808=_0x55349b?0x0:_0x463254[_0xddde('0x22')];var _0x4c34b1=_0x55349b?_0x2f0e58[_0xddde('0x24')]:_0x463254['offset']+_0x463254[_0xddde('0x25')];var _0xea045b;if(_0x4c34b1>=_0x1185f9){_0x4c34b1=_0x1185f9;_0xea045b=0xc8;}else{_0xea045b=0xce;}_0x338fa7['status'](_0xea045b);return _0x338fa7['set'](_0xddde('0x26'),_0x5ae808+'-'+_0x4c34b1+'/'+_0x1185f9)[_0xddde('0x21')](_0x2f0e58);}return null;};}function patchUpdates(_0x97bb0f){return function(_0x275f76){try{jsonpatch[_0xddde('0x27')](_0x275f76,_0x97bb0f,!![]);}catch(_0xa663e4){return BPromise[_0xddde('0x28')](_0xa663e4);}return _0x275f76['save']();};}function saveUpdates(_0x59320f,_0x3daa4a){return function(_0x261895){if(_0x261895){return _0x261895[_0xddde('0x29')](_0x59320f)[_0xddde('0x2a')](function(_0xdb57ef){return _0xdb57ef;});}return null;};}function removeEntity(_0x533332,_0x394da0){return function(_0x186ae3){if(_0x186ae3){return _0x186ae3['destroy']()['then'](function(){_0x533332[_0xddde('0x20')](0xcc)[_0xddde('0x2b')]();});}};}function handleEntityNotFound(_0x5ddf57,_0x560e28){return function(_0x45941e){if(!_0x45941e){_0x5ddf57['sendStatus'](0x194);}return _0x45941e;};}function handleError(_0x1d1c3e,_0x41d94b){_0x41d94b=_0x41d94b||0x1f4;return function(_0x2dd131){logger[_0xddde('0x2c')](_0x2dd131[_0xddde('0x2d')]);if(_0x2dd131[_0xddde('0x2e')]){delete _0x2dd131[_0xddde('0x2e')];}_0x1d1c3e[_0xddde('0x20')](_0x41d94b)[_0xddde('0x2f')](_0x2dd131);};}exports[_0xddde('0x30')]=function(_0x3a8226,_0x1ff3e2){var _0xe3d006={'raw':![],'where':{'id':_0x3a8226[_0xddde('0x31')]['id']}},_0x718921={};_0x718921[_0xddde('0x32')]=_[_0xddde('0x33')](db[_0xddde('0x34')][_0xddde('0x35')]);_0x718921[_0xddde('0x36')]=_['keys'](_0x3a8226['query']);_0x718921[_0xddde('0x37')]=_[_0xddde('0x38')](_0x718921[_0xddde('0x32')],_0x718921['query']);_0xe3d006['attributes']=_[_0xddde('0x38')](_0x718921[_0xddde('0x32')],qs[_0xddde('0x39')](_0x3a8226[_0xddde('0x36')]['fields']));_0xe3d006[_0xddde('0x3a')]=_0xe3d006['attributes'][_0xddde('0x3b')]?_0xe3d006[_0xddde('0x3a')]:_0x718921[_0xddde('0x32')];if(_0x3a8226[_0xddde('0x36')][_0xddde('0x3c')]){_0xe3d006[_0xddde('0x3d')]=[{'all':!![]}];}_0xe3d006=_[_0xddde('0x3e')]({},_0xe3d006,_0x3a8226[_0xddde('0x3f')]);return db[_0xddde('0x34')][_0xddde('0x40')](_0xe3d006)[_0xddde('0x2a')](handleEntityNotFound(_0x1ff3e2,null))[_0xddde('0x2a')](respondWithResult(_0x1ff3e2,null))['catch'](handleError(_0x1ff3e2,null));};exports[_0xddde('0x41')]=function(_0x170482,_0x4c68ab){return db['DashboardItem']['find']({'where':{'id':_0x170482[_0xddde('0x31')]['id']}})[_0xddde('0x2a')](handleEntityNotFound(_0x4c68ab,null))[_0xddde('0x2a')](removeEntity(_0x4c68ab,null))[_0xddde('0x42')](handleError(_0x4c68ab,null));};function widgetAttributes(_0x2825c6){try{switch(_0x2825c6[_0xddde('0x43')]){case _0xddde('0x44'):return[{'name':'attrUrl','value':_0x2825c6['attrUrl']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6['attrs'][0x0]?_0x2825c6[_0xddde('0x45')][0x0][_0xddde('0x46')]:undefined)||'https://'}];case _0xddde('0x47'):return[{'name':_0xddde('0x48'),'value':_0x2825c6[_0xddde('0x48')]||(_0x2825c6['attrs']&&_0x2825c6['attrs'][0x0]?_0x2825c6[_0xddde('0x45')][0x0]['value']:undefined)||''}];case _0xddde('0x49'):return[{'name':_0xddde('0x4a'),'value':_0x2825c6[_0xddde('0x4a')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x0]?_0x2825c6[_0xddde('0x45')][0x0]['value']:undefined)||_0xddde('0x4b')},{'name':_0xddde('0x4c'),'value':_0x2825c6[_0xddde('0x4c')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x1]?_0x2825c6['attrs'][0x1][_0xddde('0x46')]:undefined)||_0xddde('0x4d')},{'name':_0xddde('0x4e'),'value':_0x2825c6[_0xddde('0x4e')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x2]?_0x2825c6[_0xddde('0x45')][0x2][_0xddde('0x46')]:undefined)||0xc}];case _0xddde('0x4f'):return[{'name':'attrMetric','value':_0x2825c6[_0xddde('0x50')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x0]?_0x2825c6[_0xddde('0x45')][0x0]['value']:undefined)||_0xddde('0x51')},{'name':_0xddde('0x52'),'value':_0x2825c6[_0xddde('0x52')]||(_0x2825c6['attrs']&&_0x2825c6['attrs'][0x1]?_0x2825c6['attrs'][0x1][_0xddde('0x46')]:undefined)||[]},{'name':_0xddde('0x4e'),'value':_0x2825c6[_0xddde('0x4e')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6['attrs'][0x2]?_0x2825c6[_0xddde('0x45')][0x2][_0xddde('0x46')]:undefined)||0x14},{'name':_0xddde('0x53'),'value':_0x2825c6['attrChannel']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x3]?_0x2825c6[_0xddde('0x45')][0x3][_0xddde('0x46')]:undefined)||_0xddde('0x54')},{'name':'attrEmailAccounts','value':_0x2825c6[_0xddde('0x55')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x4]?_0x2825c6['attrs'][0x4][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x56'),'value':_0x2825c6[_0xddde('0x56')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x5]?_0x2825c6[_0xddde('0x45')][0x5][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x57'),'value':_0x2825c6['attrSmsAccounts']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x6]?_0x2825c6[_0xddde('0x45')][0x6][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x58'),'value':_0x2825c6[_0xddde('0x58')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x7]?_0x2825c6[_0xddde('0x45')][0x7][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x59'),'value':_0x2825c6[_0xddde('0x59')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x8]?_0x2825c6[_0xddde('0x45')][0x8][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x5a'),'value':_0x2825c6[_0xddde('0x5a')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x9]?_0x2825c6[_0xddde('0x45')][0x9][_0xddde('0x46')]:undefined)||''}];case _0xddde('0x5b'):case _0xddde('0x5c'):return[{'name':_0xddde('0x5d'),'value':_0x2825c6[_0xddde('0x5d')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x0]?_0x2825c6[_0xddde('0x45')][0x0][_0xddde('0x46')]:undefined)||_0xddde('0x51')},{'name':'attrSerie2','value':_0x2825c6['attrSerie2']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x1]?_0x2825c6[_0xddde('0x45')][0x1][_0xddde('0x46')]:undefined)||null},{'name':_0xddde('0x5e'),'value':_0x2825c6['attrSerie3']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x2]?_0x2825c6[_0xddde('0x45')][0x2][_0xddde('0x46')]:undefined)||null},{'name':_0xddde('0x52'),'value':_0x2825c6[_0xddde('0x52')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x3]?_0x2825c6[_0xddde('0x45')][0x3][_0xddde('0x46')]:undefined)||[]},{'name':'attrChannel','value':_0x2825c6[_0xddde('0x53')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6['attrs'][0x4]?_0x2825c6['attrs'][0x4]['value']:undefined)||_0xddde('0x54')},{'name':'attrEmailAccounts','value':_0x2825c6[_0xddde('0x55')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x5]?_0x2825c6[_0xddde('0x45')][0x5][_0xddde('0x46')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2825c6['attrFaxAccounts']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x6]?_0x2825c6['attrs'][0x6][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x57'),'value':_0x2825c6[_0xddde('0x57')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x7]?_0x2825c6[_0xddde('0x45')][0x7][_0xddde('0x46')]:undefined)||''},{'name':_0xddde('0x58'),'value':_0x2825c6[_0xddde('0x58')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6['attrs'][0x8]?_0x2825c6[_0xddde('0x45')][0x8]['value']:undefined)||''},{'name':_0xddde('0x59'),'value':_0x2825c6[_0xddde('0x59')]||(_0x2825c6['attrs']&&_0x2825c6['attrs'][0x9]?_0x2825c6['attrs'][0x9][_0xddde('0x46')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2825c6[_0xddde('0x5a')]||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0xa]?_0x2825c6['attrs'][0xa][_0xddde('0x46')]:undefined)||''}];case _0xddde('0x5f'):return[{'name':_0xddde('0x60'),'type':_0x2825c6['reportType']||(_0x2825c6[_0xddde('0x45')]&&_0x2825c6[_0xddde('0x45')][0x0]?_0x2825c6[_0xddde('0x45')][0x0][_0xddde('0x43')]:undefined)||null,'value':_0x2825c6[_0xddde('0x60')]||(_0x2825c6['attrs']&&_0x2825c6[_0xddde('0x45')][0x0]?_0x2825c6['attrs'][0x0][_0xddde('0x46')]:undefined)||null},{'name':_0xddde('0x61'),'value':_0x2825c6[_0xddde('0x61')]||(_0x2825c6['attrs']&&_0x2825c6['attrs'][0x1]?_0x2825c6[_0xddde('0x45')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0xf33175){logger[_0xddde('0x2c')](_0xddde('0x62'),JSON[_0xddde('0x63')](_0xf33175));return[];}}exports[_0xddde('0x64')]=function(_0x4eb8ce,_0x29b5b1){if(_0x4eb8ce[_0xddde('0x65')]){_0x4eb8ce[_0xddde('0x65')]['attrs']=widgetAttributes(_0x4eb8ce[_0xddde('0x65')]);}return db['DashboardItem'][_0xddde('0x64')](_0x4eb8ce[_0xddde('0x65')],{})['then'](respondWithResult(_0x29b5b1,0xc9))[_0xddde('0x42')](handleError(_0x29b5b1,null));};exports[_0xddde('0x29')]=function(_0x378758,_0x54c787){if(_0x378758[_0xddde('0x65')]['id']){delete _0x378758[_0xddde('0x65')]['id'];}_0x378758[_0xddde('0x65')][_0xddde('0x45')]=widgetAttributes(_0x378758['body']);return db[_0xddde('0x34')][_0xddde('0x40')]({'where':{'id':_0x378758[_0xddde('0x31')]['id']}})['then'](handleEntityNotFound(_0x54c787,null))[_0xddde('0x2a')](saveUpdates(_0x378758['body'],null))[_0xddde('0x2a')](respondWithResult(_0x54c787,null))[_0xddde('0x42')](handleError(_0x54c787,null));}; \ No newline at end of file +var _0x1751=['pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','params','keys','DashboardItem','rawAttributes','query','intersection','model','attributes','fields','length','include','merge','options','find','destroy','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart'];(function(_0x110aa3,_0x56cb2c){var _0x23a446=function(_0x4c7ad4){while(--_0x4c7ad4){_0x110aa3['push'](_0x110aa3['shift']());}};_0x23a446(++_0x56cb2c);}(_0x1751,0x76));var _0x1175=function(_0xaf7c,_0x5a7953){_0xaf7c=_0xaf7c-0x0;var _0x3178a7=_0x1751[_0xaf7c];return _0x3178a7;};'use strict';var emlformat=require(_0x1175('0x0'));var rimraf=require(_0x1175('0x1'));var zipdir=require(_0x1175('0x2'));var jsonpatch=require(_0x1175('0x3'));var rp=require('request-promise');var moment=require(_0x1175('0x4'));var BPromise=require(_0x1175('0x5'));var Mustache=require(_0x1175('0x6'));var util=require(_0x1175('0x7'));var path=require(_0x1175('0x8'));var sox=require(_0x1175('0x9'));var csv=require(_0x1175('0xa'));var ejs=require(_0x1175('0xb'));var fs=require('fs');var fs_extra=require(_0x1175('0xc'));var _=require(_0x1175('0xd'));var squel=require(_0x1175('0xe'));var crypto=require(_0x1175('0xf'));var jsforce=require(_0x1175('0x10'));var deskjs=require(_0x1175('0x11'));var toCsv=require(_0x1175('0xa'));var querystring=require(_0x1175('0x12'));var Papa=require(_0x1175('0x13'));var Redis=require(_0x1175('0x14'));var authService=require(_0x1175('0x15'));var qs=require(_0x1175('0x16'));var as=require(_0x1175('0x17'));var hardwareService=require(_0x1175('0x18'));var logger=require(_0x1175('0x19'))(_0x1175('0x1a'));var utils=require(_0x1175('0x1b'));var config=require(_0x1175('0x1c'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1175('0x1d')]=_[_0x1175('0x1e')](config['redis'],{'host':_0x1175('0x1f'),'port':0x18eb});var socket=require(_0x1175('0x20'))(new Redis(config[_0x1175('0x1d')]));require('./dashboardItem.socket')[_0x1175('0x21')](socket);function respondWithStatusCode(_0x42671f,_0x16979a){_0x16979a=_0x16979a||0xcc;return function(_0x57cea4){if(_0x57cea4){return _0x42671f[_0x1175('0x22')](_0x16979a);}return _0x42671f['status'](_0x16979a)[_0x1175('0x23')]();};}function respondWithResult(_0x43b6b1,_0x2a9bc4){_0x2a9bc4=_0x2a9bc4||0xc8;return function(_0x2585be){if(_0x2585be){return _0x43b6b1['status'](_0x2a9bc4)[_0x1175('0x24')](_0x2585be);}};}function respondWithFilteredResult(_0xaa45d,_0x5e64c5){return function(_0x50e563){if(_0x50e563){var _0x40b685=typeof _0x5e64c5[_0x1175('0x25')]===_0x1175('0x26')&&typeof _0x5e64c5[_0x1175('0x27')]===_0x1175('0x26');var _0x59b5b8=_0x50e563[_0x1175('0x28')];var _0x3ae698=_0x40b685?0x0:_0x5e64c5[_0x1175('0x25')];var _0x345468=_0x40b685?_0x50e563[_0x1175('0x28')]:_0x5e64c5[_0x1175('0x25')]+_0x5e64c5['limit'];var _0x5e2334;if(_0x345468>=_0x59b5b8){_0x345468=_0x59b5b8;_0x5e2334=0xc8;}else{_0x5e2334=0xce;}_0xaa45d[_0x1175('0x29')](_0x5e2334);return _0xaa45d[_0x1175('0x2a')](_0x1175('0x2b'),_0x3ae698+'-'+_0x345468+'/'+_0x59b5b8)[_0x1175('0x24')](_0x50e563);}return null;};}function patchUpdates(_0x4542c7){return function(_0x1accd1){try{jsonpatch[_0x1175('0x2c')](_0x1accd1,_0x4542c7,!![]);}catch(_0x4bd6cd){return BPromise[_0x1175('0x2d')](_0x4bd6cd);}return _0x1accd1[_0x1175('0x2e')]();};}function saveUpdates(_0x15d346,_0x18e59a){return function(_0x28b5e0){if(_0x28b5e0){return _0x28b5e0[_0x1175('0x2f')](_0x15d346)[_0x1175('0x30')](function(_0x5a3dc9){return _0x5a3dc9;});}return null;};}function removeEntity(_0x9d3b8,_0x383ba5){return function(_0x38cf17){if(_0x38cf17){return _0x38cf17['destroy']()['then'](function(){_0x9d3b8['status'](0xcc)[_0x1175('0x23')]();});}};}function handleEntityNotFound(_0x2e4682,_0x3fd476){return function(_0x5e4ac6){if(!_0x5e4ac6){_0x2e4682['sendStatus'](0x194);}return _0x5e4ac6;};}function handleError(_0x5c590e,_0x514c71){_0x514c71=_0x514c71||0x1f4;return function(_0x3abc9c){logger[_0x1175('0x31')](_0x3abc9c[_0x1175('0x32')]);if(_0x3abc9c[_0x1175('0x33')]){delete _0x3abc9c['name'];}_0x5c590e['status'](_0x514c71)[_0x1175('0x34')](_0x3abc9c);};}exports[_0x1175('0x35')]=function(_0x57f7a8,_0x565c20){var _0x5b6bfb={'raw':![],'where':{'id':_0x57f7a8[_0x1175('0x36')]['id']}},_0x4234c6={};_0x4234c6['model']=_[_0x1175('0x37')](db[_0x1175('0x38')][_0x1175('0x39')]);_0x4234c6[_0x1175('0x3a')]=_[_0x1175('0x37')](_0x57f7a8[_0x1175('0x3a')]);_0x4234c6['filters']=_[_0x1175('0x3b')](_0x4234c6[_0x1175('0x3c')],_0x4234c6[_0x1175('0x3a')]);_0x5b6bfb[_0x1175('0x3d')]=_['intersection'](_0x4234c6[_0x1175('0x3c')],qs['fields'](_0x57f7a8[_0x1175('0x3a')][_0x1175('0x3e')]));_0x5b6bfb[_0x1175('0x3d')]=_0x5b6bfb[_0x1175('0x3d')][_0x1175('0x3f')]?_0x5b6bfb[_0x1175('0x3d')]:_0x4234c6['model'];if(_0x57f7a8['query']['includeAll']){_0x5b6bfb[_0x1175('0x40')]=[{'all':!![]}];}_0x5b6bfb=_[_0x1175('0x41')]({},_0x5b6bfb,_0x57f7a8[_0x1175('0x42')]);return db[_0x1175('0x38')][_0x1175('0x43')](_0x5b6bfb)[_0x1175('0x30')](handleEntityNotFound(_0x565c20,null))['then'](respondWithResult(_0x565c20,null))['catch'](handleError(_0x565c20,null));};exports[_0x1175('0x44')]=function(_0x325cb7,_0x203afa){return db['DashboardItem'][_0x1175('0x43')]({'where':{'id':_0x325cb7[_0x1175('0x36')]['id']}})[_0x1175('0x30')](handleEntityNotFound(_0x203afa,null))['then'](removeEntity(_0x203afa,null))['catch'](handleError(_0x203afa,null));};function widgetAttributes(_0x57650d){try{switch(_0x57650d[_0x1175('0x45')]){case'iframe':return[{'name':_0x1175('0x46'),'value':_0x57650d[_0x1175('0x46')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x0]?_0x57650d[_0x1175('0x47')][0x0][_0x1175('0x48')]:undefined)||_0x1175('0x49')}];case _0x1175('0x4a'):return[{'name':_0x1175('0x4b'),'value':_0x57650d[_0x1175('0x4b')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x0]?_0x57650d[_0x1175('0x47')][0x0][_0x1175('0x48')]:undefined)||''}];case _0x1175('0x4c'):return[{'name':_0x1175('0x4d'),'value':_0x57650d['attrHourFormat']||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x0]?_0x57650d[_0x1175('0x47')][0x0]['value']:undefined)||_0x1175('0x4e')},{'name':_0x1175('0x4f'),'value':_0x57650d[_0x1175('0x4f')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x1]?_0x57650d['attrs'][0x1][_0x1175('0x48')]:undefined)||_0x1175('0x50')},{'name':_0x1175('0x51'),'value':_0x57650d[_0x1175('0x51')]||(_0x57650d['attrs']&&_0x57650d[_0x1175('0x47')][0x2]?_0x57650d[_0x1175('0x47')][0x2][_0x1175('0x48')]:undefined)||0xc}];case'counter':return[{'name':_0x1175('0x52'),'value':_0x57650d['attrMetric']||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x0]?_0x57650d[_0x1175('0x47')][0x0][_0x1175('0x48')]:undefined)||_0x1175('0x53')},{'name':_0x1175('0x54'),'value':_0x57650d[_0x1175('0x54')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x1]?_0x57650d[_0x1175('0x47')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x57650d[_0x1175('0x51')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d['attrs'][0x2]?_0x57650d[_0x1175('0x47')][0x2][_0x1175('0x48')]:undefined)||0x14},{'name':'attrChannel','value':_0x57650d[_0x1175('0x55')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x3]?_0x57650d[_0x1175('0x47')][0x3][_0x1175('0x48')]:undefined)||_0x1175('0x56')},{'name':_0x1175('0x57'),'value':_0x57650d[_0x1175('0x57')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x4]?_0x57650d[_0x1175('0x47')][0x4][_0x1175('0x48')]:undefined)||''},{'name':_0x1175('0x58'),'value':_0x57650d[_0x1175('0x58')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x5]?_0x57650d[_0x1175('0x47')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x57650d[_0x1175('0x59')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x6]?_0x57650d['attrs'][0x6][_0x1175('0x48')]:undefined)||''},{'name':_0x1175('0x5a'),'value':_0x57650d[_0x1175('0x5a')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x7]?_0x57650d[_0x1175('0x47')][0x7]['value']:undefined)||''},{'name':_0x1175('0x5b'),'value':_0x57650d[_0x1175('0x5b')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x8]?_0x57650d[_0x1175('0x47')][0x8][_0x1175('0x48')]:undefined)||''},{'name':_0x1175('0x5c'),'value':_0x57650d[_0x1175('0x5c')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d['attrs'][0x9]?_0x57650d['attrs'][0x9][_0x1175('0x48')]:undefined)||''}];case _0x1175('0x5d'):case _0x1175('0x5e'):return[{'name':_0x1175('0x5f'),'value':_0x57650d['attrSerie1']||(_0x57650d[_0x1175('0x47')]&&_0x57650d['attrs'][0x0]?_0x57650d['attrs'][0x0][_0x1175('0x48')]:undefined)||_0x1175('0x53')},{'name':_0x1175('0x60'),'value':_0x57650d['attrSerie2']||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x1]?_0x57650d[_0x1175('0x47')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x57650d[_0x1175('0x61')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x2]?_0x57650d[_0x1175('0x47')][0x2][_0x1175('0x48')]:undefined)||null},{'name':_0x1175('0x54'),'value':_0x57650d[_0x1175('0x54')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x3]?_0x57650d[_0x1175('0x47')][0x3][_0x1175('0x48')]:undefined)||[]},{'name':_0x1175('0x55'),'value':_0x57650d['attrChannel']||(_0x57650d['attrs']&&_0x57650d[_0x1175('0x47')][0x4]?_0x57650d[_0x1175('0x47')][0x4]['value']:undefined)||_0x1175('0x56')},{'name':'attrEmailAccounts','value':_0x57650d['attrEmailAccounts']||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x5]?_0x57650d[_0x1175('0x47')][0x5][_0x1175('0x48')]:undefined)||''},{'name':_0x1175('0x58'),'value':_0x57650d['attrFaxAccounts']||(_0x57650d['attrs']&&_0x57650d['attrs'][0x6]?_0x57650d['attrs'][0x6][_0x1175('0x48')]:undefined)||''},{'name':_0x1175('0x59'),'value':_0x57650d['attrSmsAccounts']||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x7]?_0x57650d[_0x1175('0x47')][0x7][_0x1175('0x48')]:undefined)||''},{'name':_0x1175('0x5a'),'value':_0x57650d[_0x1175('0x5a')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x8]?_0x57650d[_0x1175('0x47')][0x8][_0x1175('0x48')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x57650d[_0x1175('0x5b')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d['attrs'][0x9]?_0x57650d[_0x1175('0x47')][0x9][_0x1175('0x48')]:undefined)||''},{'name':_0x1175('0x5c'),'value':_0x57650d[_0x1175('0x5c')]||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0xa]?_0x57650d[_0x1175('0x47')][0xa]['value']:undefined)||''}];case _0x1175('0x62'):return[{'name':_0x1175('0x63'),'type':_0x57650d['reportType']||(_0x57650d[_0x1175('0x47')]&&_0x57650d[_0x1175('0x47')][0x0]?_0x57650d[_0x1175('0x47')][0x0][_0x1175('0x45')]:undefined)||null,'value':_0x57650d[_0x1175('0x63')]||(_0x57650d['attrs']&&_0x57650d['attrs'][0x0]?_0x57650d[_0x1175('0x47')][0x0][_0x1175('0x48')]:undefined)||null},{'name':'attrRefresh','value':_0x57650d[_0x1175('0x64')]||(_0x57650d['attrs']&&_0x57650d['attrs'][0x1]?_0x57650d[_0x1175('0x47')][0x1][_0x1175('0x48')]:undefined)||0x0}];default:return[];}}catch(_0x4857b8){logger[_0x1175('0x31')](_0x1175('0x65'),JSON[_0x1175('0x66')](_0x4857b8));return[];}}exports[_0x1175('0x67')]=function(_0x3f3a7,_0x2ed1ef){if(_0x3f3a7[_0x1175('0x68')]){_0x3f3a7[_0x1175('0x68')]['attrs']=widgetAttributes(_0x3f3a7['body']);}return db[_0x1175('0x38')]['create'](_0x3f3a7[_0x1175('0x68')],{})[_0x1175('0x30')](respondWithResult(_0x2ed1ef,0xc9))[_0x1175('0x69')](handleError(_0x2ed1ef,null));};exports['update']=function(_0x446abe,_0x4dc426){if(_0x446abe['body']['id']){delete _0x446abe[_0x1175('0x68')]['id'];}_0x446abe[_0x1175('0x68')][_0x1175('0x47')]=widgetAttributes(_0x446abe[_0x1175('0x68')]);return db['DashboardItem']['find']({'where':{'id':_0x446abe[_0x1175('0x36')]['id']}})[_0x1175('0x30')](handleEntityNotFound(_0x4dc426,null))['then'](saveUpdates(_0x446abe[_0x1175('0x68')],null))['then'](respondWithResult(_0x4dc426,null))[_0x1175('0x69')](handleError(_0x4dc426,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index de3ec49..743dcf7 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 _0xd3b0=['setMaxListeners','update','emit','hook'];(function(_0x105fcd,_0x33b509){var _0x1f1316=function(_0x30a862){while(--_0x30a862){_0x105fcd['push'](_0x105fcd['shift']());}};_0x1f1316(++_0x33b509);}(_0xd3b0,0x14c));var _0x0d3b=function(_0x548176,_0x595a6f){_0x548176=_0x548176-0x0;var _0x4cb6c9=_0xd3b0[_0x548176];return _0x4cb6c9;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0d3b('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d3b('0x1'),'afterDestroy':'remove'};function emitEvent(_0x455039){return function(_0x3a488f,_0x5678a6,_0x4d59f8){DashboardItemEvents[_0x0d3b('0x2')](_0x455039+':'+_0x3a488f['id'],_0x3a488f);DashboardItemEvents[_0x0d3b('0x2')](_0x455039,_0x3a488f);_0x4d59f8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x0d3b('0x3')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x9d1a=['update','remove','emit','hasOwnProperty','exports','events','DashboardItem','setMaxListeners','save'];(function(_0x34f4bb,_0x4f427d){var _0x43920c=function(_0x6f6e4f){while(--_0x6f6e4f){_0x34f4bb['push'](_0x34f4bb['shift']());}};_0x43920c(++_0x4f427d);}(_0x9d1a,0xa7));var _0xa9d1=function(_0x54a360,_0x97497e){_0x54a360=_0x54a360-0x0;var _0x5b9d56=_0x9d1a[_0x54a360];return _0x5b9d56;};'use strict';var EventEmitter=require(_0xa9d1('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xa9d1('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xa9d1('0x2')](0x0);var events={'afterCreate':_0xa9d1('0x3'),'afterUpdate':_0xa9d1('0x4'),'afterDestroy':_0xa9d1('0x5')};function emitEvent(_0x376793){return function(_0x408bfe,_0x4696da,_0x102e98){DashboardItemEvents[_0xa9d1('0x6')](_0x376793+':'+_0x408bfe['id'],_0x408bfe);DashboardItemEvents['emit'](_0x376793,_0x408bfe);_0x102e98(null);};}for(var e in events){if(events[_0xa9d1('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xa9d1('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 6b0b047..dddf63d 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 _0xc178=['../../config/environment','exports','dashboard_items','lodash','api','bluebird','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc178,0xeb));var _0x8c17=function(_0x3bff45,_0x1094b2){_0x3bff45=_0x3bff45-0x0;var _0x740d5e=_0xc178[_0x3bff45];return _0x740d5e;};'use strict';var _=require(_0x8c17('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8c17('0x1'));var moment=require('moment');var BPromise=require(_0x8c17('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c17('0x3'));var rimraf=require(_0x8c17('0x4'));var config=require(_0x8c17('0x5'));var attributes=require('./dashboardItem.attributes');module[_0x8c17('0x6')]=function(_0x281a4c,_0x489322){return _0x281a4c['define']('DashboardItem',attributes,{'tableName':_0x8c17('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c6d=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','dashboard_items'];(function(_0x3651e8,_0x33901e){var _0x5decb1=function(_0x400a53){while(--_0x400a53){_0x3651e8['push'](_0x3651e8['shift']());}};_0x5decb1(++_0x33901e);}(_0x3c6d,0x190));var _0xd3c6=function(_0x489528,_0x2d6632){_0x489528=_0x489528-0x0;var _0x2b96eb=_0x3c6d[_0x489528];return _0x2b96eb;};'use strict';var _=require(_0xd3c6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd3c6('0x1'));var moment=require(_0xd3c6('0x2'));var BPromise=require(_0xd3c6('0x3'));var rp=require(_0xd3c6('0x4'));var fs=require('fs');var path=require(_0xd3c6('0x5'));var rimraf=require(_0xd3c6('0x6'));var config=require(_0xd3c6('0x7'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x4523d4,_0x4a1c95){return _0x4523d4[_0xd3c6('0x8')]('DashboardItem',attributes,{'tableName':_0xd3c6('0x9'),'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 5bd86f1..147c145 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 _0xbb77=['stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','request','then','DashboardItem,\x20%s,\x20%s','debug'];(function(_0x1c008d,_0x19d115){var _0x2f41df=function(_0x49b99e){while(--_0x49b99e){_0x1c008d['push'](_0x1c008d['shift']());}};_0x2f41df(++_0x19d115);}(_0xbb77,0x134));var _0x7bb7=function(_0x409d18,_0x2f866b){_0x409d18=_0x409d18-0x0;var _0x211a0c=_0xbb77[_0x409d18];return _0x211a0c;};'use strict';var _=require(_0x7bb7('0x0'));var util=require(_0x7bb7('0x1'));var moment=require(_0x7bb7('0x2'));var BPromise=require(_0x7bb7('0x3'));var rs=require(_0x7bb7('0x4'));var fs=require('fs');var Redis=require(_0x7bb7('0x5'));var db=require(_0x7bb7('0x6'))['db'];var utils=require(_0x7bb7('0x7'));var logger=require(_0x7bb7('0x8'))('rpc');var config=require(_0x7bb7('0x9'));var jayson=require(_0x7bb7('0xa'));var client=jayson[_0x7bb7('0xb')][_0x7bb7('0xc')]({'port':0x232a});config[_0x7bb7('0xd')]=_[_0x7bb7('0xe')](config[_0x7bb7('0xd')],{'host':_0x7bb7('0xf'),'port':0x18eb});var socket=require(_0x7bb7('0x10'))(new Redis(config['redis']));require(_0x7bb7('0x11'))['register'](socket);function respondWithRpcPromise(_0x1e35e9,_0x55209d,_0x304bee){return new BPromise(function(_0x190141,_0x4bd02a){return client[_0x7bb7('0x12')](_0x1e35e9,_0x304bee)[_0x7bb7('0x13')](function(_0x307ba3){logger['info'](_0x7bb7('0x14'),_0x55209d,'request\x20sent');logger[_0x7bb7('0x15')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x55209d,'request\x20sent',JSON[_0x7bb7('0x16')](_0x307ba3));if(_0x307ba3[_0x7bb7('0x17')]){if(_0x307ba3['error'][_0x7bb7('0x18')]===0x1f4){logger[_0x7bb7('0x17')](_0x7bb7('0x14'),_0x55209d,_0x307ba3[_0x7bb7('0x17')]['message']);return _0x4bd02a(_0x307ba3['error']['message']);}logger['error'](_0x7bb7('0x14'),_0x55209d,_0x307ba3[_0x7bb7('0x17')]['message']);return _0x190141(_0x307ba3['error'][_0x7bb7('0x19')]);}else{logger[_0x7bb7('0x1a')](_0x7bb7('0x14'),_0x55209d,_0x7bb7('0x1b'));_0x190141(_0x307ba3[_0x7bb7('0x1c')][_0x7bb7('0x19')]);}})[_0x7bb7('0x1d')](function(_0x225847){logger[_0x7bb7('0x17')](_0x7bb7('0x14'),_0x55209d,_0x225847);_0x4bd02a(_0x225847);});});} \ No newline at end of file +var _0x0692=['register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboardItem.socket'];(function(_0x426ab0,_0x13c67d){var _0x3bdb3d=function(_0x14f669){while(--_0x14f669){_0x426ab0['push'](_0x426ab0['shift']());}};_0x3bdb3d(++_0x13c67d);}(_0x0692,0x6a));var _0x2069=function(_0x2f0069,_0x5e75f4){_0x2f0069=_0x2f0069-0x0;var _0xe8188b=_0x0692[_0x2f0069];return _0xe8188b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2069('0x0'));var rs=require(_0x2069('0x1'));var fs=require('fs');var Redis=require(_0x2069('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2069('0x3'));var logger=require(_0x2069('0x4'))(_0x2069('0x5'));var config=require(_0x2069('0x6'));var jayson=require(_0x2069('0x7'));var client=jayson[_0x2069('0x8')][_0x2069('0x9')]({'port':0x232a});config[_0x2069('0xa')]=_[_0x2069('0xb')](config[_0x2069('0xa')],{'host':_0x2069('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2069('0xa')]));require(_0x2069('0xd'))[_0x2069('0xe')](socket);function respondWithRpcPromise(_0x24de08,_0x1660a2,_0x13f5f9){return new BPromise(function(_0xc393b0,_0x4b5ad1){return client[_0x2069('0xf')](_0x24de08,_0x13f5f9)[_0x2069('0x10')](function(_0x5b36bb){logger['info'](_0x2069('0x11'),_0x1660a2,_0x2069('0x12'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x1660a2,'request\x20sent',JSON[_0x2069('0x13')](_0x5b36bb));if(_0x5b36bb['error']){if(_0x5b36bb[_0x2069('0x14')]['code']===0x1f4){logger[_0x2069('0x14')](_0x2069('0x11'),_0x1660a2,_0x5b36bb[_0x2069('0x14')][_0x2069('0x15')]);return _0x4b5ad1(_0x5b36bb[_0x2069('0x14')]['message']);}logger['error'](_0x2069('0x11'),_0x1660a2,_0x5b36bb['error'][_0x2069('0x15')]);return _0xc393b0(_0x5b36bb[_0x2069('0x14')]['message']);}else{logger[_0x2069('0x16')](_0x2069('0x11'),_0x1660a2,'request\x20sent');_0xc393b0(_0x5b36bb[_0x2069('0x17')][_0x2069('0x15')]);}})['catch'](function(_0x427da2){logger[_0x2069('0x14')](_0x2069('0x11'),_0x1660a2,_0x427da2);_0x4b5ad1(_0x427da2);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 6cedd41..5059299 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 _0x41c1=['remove','emit','removeListener','register','length','dashboardItem:','save'];(function(_0x52c4e9,_0x5412d0){var _0x252a03=function(_0x57857c){while(--_0x57857c){_0x52c4e9['push'](_0x52c4e9['shift']());}};_0x252a03(++_0x5412d0);}(_0x41c1,0x84));var _0x141c=function(_0x3c0713,_0x118272){_0x3c0713=_0x3c0713-0x0;var _0xda81d3=_0x41c1[_0x3c0713];return _0xda81d3;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x141c('0x0'),_0x141c('0x1'),'update'];function createListener(_0x3614a2,_0x107fd4){return function(_0xe29283){_0x107fd4[_0x141c('0x2')](_0x3614a2,_0xe29283);};}function removeListener(_0x5defb0,_0x26c701){return function(){DashboardItemEvents[_0x141c('0x3')](_0x5defb0,_0x26c701);};}exports[_0x141c('0x4')]=function(_0x27f9ad){for(var _0x413c4c=0x0,_0x5b6523=events[_0x141c('0x5')];_0x413c4c<_0x5b6523;_0x413c4c++){var _0x3798b4=events[_0x413c4c];var _0x2e2b42=createListener(_0x141c('0x6')+_0x3798b4,_0x27f9ad);DashboardItemEvents['on'](_0x3798b4,_0x2e2b42);}}; \ No newline at end of file +var _0x09ae=['dashboardItem:','./dashboardItem.events','remove','update','register','length'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x09ae,0x17b));var _0xe09a=function(_0x2d2a4e,_0x3773f8){_0x2d2a4e=_0x2d2a4e-0x0;var _0x3cb40f=_0x09ae[_0x2d2a4e];return _0x3cb40f;};'use strict';var DashboardItemEvents=require(_0xe09a('0x0'));var events=['save',_0xe09a('0x1'),_0xe09a('0x2')];function createListener(_0x29b6c7,_0xb61bae){return function(_0x52d4f2){_0xb61bae['emit'](_0x29b6c7,_0x52d4f2);};}function removeListener(_0x3fe850,_0x547ad1){return function(){DashboardItemEvents['removeListener'](_0x3fe850,_0x547ad1);};}exports[_0xe09a('0x3')]=function(_0xa1dfb8){for(var _0x5181fc=0x0,_0x9e4eb6=events[_0xe09a('0x4')];_0x5181fc<_0x9e4eb6;_0x5181fc++){var _0x45f8c7=events[_0x5181fc];var _0x27d2a3=createListener(_0xe09a('0x5')+_0x45f8c7,_0xa1dfb8);DashboardItemEvents['on'](_0x45f8c7,_0x27d2a3);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 9de1527..e183bb2 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 _0xd511=['../../config/environment','./dashboardItem.controller','isAuthenticated','post','put','/:id','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x842858,_0x3a3ca0){var _0x46c2a2=function(_0x47f795){while(--_0x47f795){_0x842858['push'](_0x842858['shift']());}};_0x46c2a2(++_0x3a3ca0);}(_0xd511,0x78));var _0x1d51=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd511[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1d51('0x0'));var util=require(_0x1d51('0x1'));var path=require('path');var timeout=require(_0x1d51('0x2'));var express=require(_0x1d51('0x3'));var router=express[_0x1d51('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1d51('0x5'));var config=require(_0x1d51('0x6'));var controller=require(_0x1d51('0x7'));router['get']('/:id',auth[_0x1d51('0x8')](),controller['show']);router[_0x1d51('0x9')]('/',auth[_0x1d51('0x8')](),controller['create']);router[_0x1d51('0xa')](_0x1d51('0xb'),auth[_0x1d51('0x8')](),controller['update']);router[_0x1d51('0xc')](_0x1d51('0xb'),auth[_0x1d51('0x8')](),controller['destroy']);module[_0x1d51('0xd')]=router; \ No newline at end of file +var _0xc92f=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./dashboardItem.controller','isAuthenticated','post','put','/:id','update'];(function(_0x612a71,_0xb27d3f){var _0xb07bc1=function(_0x41b70b){while(--_0x41b70b){_0x612a71['push'](_0x612a71['shift']());}};_0xb07bc1(++_0xb27d3f);}(_0xc92f,0x162));var _0xfc92=function(_0x230431,_0x4e25f1){_0x230431=_0x230431-0x0;var _0x3f9266=_0xc92f[_0x230431];return _0x3f9266;};'use strict';var multer=require(_0xfc92('0x0'));var util=require(_0xfc92('0x1'));var path=require(_0xfc92('0x2'));var timeout=require(_0xfc92('0x3'));var express=require(_0xfc92('0x4'));var router=express[_0xfc92('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfc92('0x6'));var config=require(_0xfc92('0x7'));var controller=require(_0xfc92('0x8'));router['get']('/:id',auth[_0xfc92('0x9')](),controller['show']);router[_0xfc92('0xa')]('/',auth[_0xfc92('0x9')](),controller['create']);router[_0xfc92('0xb')](_0xfc92('0xc'),auth[_0xfc92('0x9')](),controller[_0xfc92('0xd')]);router['delete'](_0xfc92('0xc'),auth[_0xfc92('0x9')](),controller[_0xfc92('0xe')]);module[_0xfc92('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 77dbcda..8742625 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 _0xdab3=['sequelize','STRING','ENUM','first','third'];(function(_0x1d5ce7,_0x213179){var _0x58141b=function(_0x297673){while(--_0x297673){_0x1d5ce7['push'](_0x1d5ce7['shift']());}};_0x58141b(++_0x213179);}(_0xdab3,0x9b));var _0x3dab=function(_0x390d4e,_0x1423a8){_0x390d4e=_0x390d4e-0x0;var _0x48dcc6=_0xdab3[_0x390d4e];return _0x48dcc6;};'use strict';var Sequelize=require(_0x3dab('0x0'));module['exports']={'name':{'type':Sequelize[_0x3dab('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x3dab('0x2')](_0x3dab('0x3'),'second',_0x3dab('0x4')),'allowNull':![],'defaultValue':_0x3dab('0x3')},'description':{'type':Sequelize[_0x3dab('0x1')]}}; \ No newline at end of file +var _0x8870=['second','third','first','sequelize','STRING','ENUM'];(function(_0x36ef0c,_0x547216){var _0x206a4c=function(_0x4b1f03){while(--_0x4b1f03){_0x36ef0c['push'](_0x36ef0c['shift']());}};_0x206a4c(++_0x547216);}(_0x8870,0xff));var _0x0887=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x8870[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x0887('0x0'));module['exports']={'name':{'type':Sequelize[_0x0887('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x0887('0x2')]('first',_0x0887('0x3'),_0x0887('0x4')),'allowNull':![],'defaultValue':_0x0887('0x5')},'description':{'type':Sequelize[_0x0887('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 65c0e9d..106c53c 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 _0x2cd3=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','get','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','params','find','create','body','role','user','Dispositions','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra'];(function(_0x1aab89,_0x40e92d){var _0x192afe=function(_0x34ff86){while(--_0x34ff86){_0x1aab89['push'](_0x1aab89['shift']());}};_0x192afe(++_0x40e92d);}(_0x2cd3,0xf1));var _0x32cd=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0x2cd3[_0x120bc2];return _0x454a41;};'use strict';var emlformat=require(_0x32cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x32cd('0x1'));var jsonpatch=require(_0x32cd('0x2'));var rp=require(_0x32cd('0x3'));var moment=require(_0x32cd('0x4'));var BPromise=require(_0x32cd('0x5'));var Mustache=require(_0x32cd('0x6'));var util=require('util');var path=require('path');var sox=require(_0x32cd('0x7'));var csv=require(_0x32cd('0x8'));var ejs=require(_0x32cd('0x9'));var fs=require('fs');var fs_extra=require(_0x32cd('0xa'));var _=require(_0x32cd('0xb'));var squel=require(_0x32cd('0xc'));var crypto=require(_0x32cd('0xd'));var jsforce=require(_0x32cd('0xe'));var deskjs=require(_0x32cd('0xf'));var toCsv=require(_0x32cd('0x8'));var querystring=require(_0x32cd('0x10'));var Papa=require(_0x32cd('0x11'));var Redis=require(_0x32cd('0x12'));var authService=require(_0x32cd('0x13'));var qs=require(_0x32cd('0x14'));var as=require(_0x32cd('0x15'));var hardwareService=require(_0x32cd('0x16'));var logger=require(_0x32cd('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x32cd('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27db2b,_0x4610ed){_0x4610ed=_0x4610ed||0xcc;return function(_0x459f80){if(_0x459f80){return _0x27db2b[_0x32cd('0x19')](_0x4610ed);}return _0x27db2b[_0x32cd('0x1a')](_0x4610ed)[_0x32cd('0x1b')]();};}function respondWithResult(_0x3ce589,_0x542a02){_0x542a02=_0x542a02||0xc8;return function(_0x51b452){if(_0x51b452){return _0x3ce589[_0x32cd('0x1a')](_0x542a02)[_0x32cd('0x1c')](_0x51b452);}};}function respondWithFilteredResult(_0x149448,_0x440984){return function(_0x4a14b5){if(_0x4a14b5){var _0x3a542b=typeof _0x440984['offset']==='undefined'&&typeof _0x440984[_0x32cd('0x1d')]===_0x32cd('0x1e');var _0x3f9c9c=_0x4a14b5[_0x32cd('0x1f')];var _0x4690c9=_0x3a542b?0x0:_0x440984[_0x32cd('0x20')];var _0x4bfabf=_0x3a542b?_0x4a14b5[_0x32cd('0x1f')]:_0x440984[_0x32cd('0x20')]+_0x440984[_0x32cd('0x1d')];var _0x5d36c9;if(_0x4bfabf>=_0x3f9c9c){_0x4bfabf=_0x3f9c9c;_0x5d36c9=0xc8;}else{_0x5d36c9=0xce;}_0x149448['status'](_0x5d36c9);return _0x149448[_0x32cd('0x21')](_0x32cd('0x22'),_0x4690c9+'-'+_0x4bfabf+'/'+_0x3f9c9c)[_0x32cd('0x1c')](_0x4a14b5);}return null;};}function patchUpdates(_0x19ab29){return function(_0x14b3fe){try{jsonpatch['apply'](_0x14b3fe,_0x19ab29,!![]);}catch(_0x4311cb){return BPromise[_0x32cd('0x23')](_0x4311cb);}return _0x14b3fe[_0x32cd('0x24')]();};}function saveUpdates(_0x1a50a6,_0x3bc9c8){return function(_0x192b1d){if(_0x192b1d){return _0x192b1d[_0x32cd('0x25')](_0x1a50a6)[_0x32cd('0x26')](function(_0x575f97){return _0x575f97;});}return null;};}function removeEntity(_0x3eb73c,_0x5ddfaa){return function(_0x4c7f55){if(_0x4c7f55){return _0x4c7f55[_0x32cd('0x27')]()['then'](function(){var _0x5c0dc1=_0x4c7f55[_0x32cd('0x28')]({'plain':!![]});var _0x57782c='Dispositions';return db['UserProfileResource'][_0x32cd('0x27')]({'where':{'type':_0x57782c,'resourceId':_0x5c0dc1['id']}})[_0x32cd('0x26')](function(){return _0x4c7f55;});})[_0x32cd('0x26')](function(){_0x3eb73c[_0x32cd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58a5c8,_0x4b9ee1){return function(_0x321d71){if(!_0x321d71){_0x58a5c8[_0x32cd('0x19')](0x194);}return _0x321d71;};}function handleError(_0x5ef889,_0x39fd04){_0x39fd04=_0x39fd04||0x1f4;return function(_0x35f798){logger[_0x32cd('0x29')](_0x35f798[_0x32cd('0x2a')]);if(_0x35f798[_0x32cd('0x2b')]){delete _0x35f798[_0x32cd('0x2b')];}_0x5ef889['status'](_0x39fd04)[_0x32cd('0x2c')](_0x35f798);};}exports[_0x32cd('0x2d')]=function(_0x9d4aaa,_0x20365c){var _0x387f2a={},_0x1232f1={},_0x5053ff={'count':0x0,'rows':[]};var _0x576cb2=_[_0x32cd('0x2e')](db[_0x32cd('0x2f')][_0x32cd('0x30')],function(_0x42385a){return{'name':_0x42385a[_0x32cd('0x31')],'type':_0x42385a['type'][_0x32cd('0x32')]};});_0x1232f1[_0x32cd('0x33')]=_['map'](_0x576cb2,_0x32cd('0x2b'));_0x1232f1[_0x32cd('0x34')]=_[_0x32cd('0x35')](_0x9d4aaa[_0x32cd('0x34')]);_0x1232f1[_0x32cd('0x36')]=_[_0x32cd('0x37')](_0x1232f1[_0x32cd('0x33')],_0x1232f1[_0x32cd('0x34')]);_0x387f2a[_0x32cd('0x38')]=_[_0x32cd('0x37')](_0x1232f1[_0x32cd('0x33')],qs[_0x32cd('0x39')](_0x9d4aaa[_0x32cd('0x34')]['fields']));_0x387f2a[_0x32cd('0x38')]=_0x387f2a[_0x32cd('0x38')][_0x32cd('0x3a')]?_0x387f2a[_0x32cd('0x38')]:_0x1232f1['model'];if(!_0x9d4aaa['query'][_0x32cd('0x3b')](_0x32cd('0x3c'))){_0x387f2a[_0x32cd('0x1d')]=qs['limit'](_0x9d4aaa[_0x32cd('0x34')][_0x32cd('0x1d')]);_0x387f2a[_0x32cd('0x20')]=qs[_0x32cd('0x20')](_0x9d4aaa[_0x32cd('0x34')][_0x32cd('0x20')]);}_0x387f2a[_0x32cd('0x3d')]=qs[_0x32cd('0x3e')](_0x9d4aaa[_0x32cd('0x34')]['sort']);_0x387f2a[_0x32cd('0x3f')]=qs['filters'](_[_0x32cd('0x40')](_0x9d4aaa[_0x32cd('0x34')],_0x1232f1[_0x32cd('0x36')]),_0x576cb2);if(_0x9d4aaa[_0x32cd('0x34')]['filter']){_0x387f2a[_0x32cd('0x3f')]=_[_0x32cd('0x41')](_0x387f2a[_0x32cd('0x3f')],{'$or':_[_0x32cd('0x2e')](_0x576cb2,function(_0x3a06e5){if(_0x3a06e5[_0x32cd('0x42')]!==_0x32cd('0x43')){var _0x7c62e0={};_0x7c62e0[_0x3a06e5[_0x32cd('0x2b')]]={'$like':'%'+_0x9d4aaa[_0x32cd('0x34')][_0x32cd('0x44')]+'%'};return _0x7c62e0;}})});}_0x387f2a=_[_0x32cd('0x41')]({},_0x387f2a,_0x9d4aaa[_0x32cd('0x45')]);var _0xdf4d2={'where':_0x387f2a[_0x32cd('0x3f')]};return db[_0x32cd('0x2f')][_0x32cd('0x1f')](_0xdf4d2)['then'](function(_0x285a48){_0x5053ff[_0x32cd('0x1f')]=_0x285a48;if(_0x9d4aaa['query'][_0x32cd('0x46')]){_0x387f2a[_0x32cd('0x47')]=[{'all':!![]}];}return db[_0x32cd('0x2f')]['findAll'](_0x387f2a);})['then'](function(_0x469fa2){_0x5053ff[_0x32cd('0x48')]=_0x469fa2;return _0x5053ff;})[_0x32cd('0x26')](respondWithFilteredResult(_0x20365c,_0x387f2a))[_0x32cd('0x49')](handleError(_0x20365c,null));};exports['show']=function(_0x2f1acd,_0x3c34b9){var _0x2f4eec={'raw':!![],'where':{'id':_0x2f1acd[_0x32cd('0x4a')]['id']}},_0x1d4f10={};_0x1d4f10[_0x32cd('0x33')]=_[_0x32cd('0x35')](db['Disposition'][_0x32cd('0x30')]);_0x1d4f10[_0x32cd('0x34')]=_['keys'](_0x2f1acd[_0x32cd('0x34')]);_0x1d4f10[_0x32cd('0x36')]=_['intersection'](_0x1d4f10[_0x32cd('0x33')],_0x1d4f10[_0x32cd('0x34')]);_0x2f4eec['attributes']=_[_0x32cd('0x37')](_0x1d4f10[_0x32cd('0x33')],qs[_0x32cd('0x39')](_0x2f1acd['query'][_0x32cd('0x39')]));_0x2f4eec[_0x32cd('0x38')]=_0x2f4eec[_0x32cd('0x38')]['length']?_0x2f4eec[_0x32cd('0x38')]:_0x1d4f10[_0x32cd('0x33')];if(_0x2f1acd[_0x32cd('0x34')][_0x32cd('0x46')]){_0x2f4eec[_0x32cd('0x47')]=[{'all':!![]}];}_0x2f4eec=_[_0x32cd('0x41')]({},_0x2f4eec,_0x2f1acd[_0x32cd('0x45')]);return db['Disposition'][_0x32cd('0x4b')](_0x2f4eec)['then'](handleEntityNotFound(_0x3c34b9,null))[_0x32cd('0x26')](respondWithResult(_0x3c34b9,null))[_0x32cd('0x49')](handleError(_0x3c34b9,null));};exports['create']=function(_0x88b34b,_0x27aabc){return db[_0x32cd('0x2f')][_0x32cd('0x4c')](_0x88b34b[_0x32cd('0x4d')],{})[_0x32cd('0x26')](function(_0x3360cb){var _0xa145df=_0x88b34b['user'][_0x32cd('0x28')]({'plain':!![]});if(!_0xa145df)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa145df[_0x32cd('0x4e')]===_0x32cd('0x4f')){var _0x45f485=_0x3360cb[_0x32cd('0x28')]({'plain':!![]});var _0x31f5db=_0x32cd('0x50');return db[_0x32cd('0x51')][_0x32cd('0x4b')]({'where':{'name':_0x31f5db,'userProfileId':_0xa145df['userProfileId']},'raw':!![]})[_0x32cd('0x26')](function(_0xd5f7d9){if(_0xd5f7d9&&_0xd5f7d9[_0x32cd('0x52')]===0x0){return db['UserProfileResource'][_0x32cd('0x4c')]({'name':_0x45f485[_0x32cd('0x2b')],'resourceId':_0x45f485['id'],'type':_0xd5f7d9[_0x32cd('0x2b')],'sectionId':_0xd5f7d9['id']},{})['then'](function(){return _0x3360cb;});}else{return _0x3360cb;}})['catch'](function(_0x300baf){logger['error'](_0x32cd('0x53'),_0x300baf);throw _0x300baf;});}return _0x3360cb;})[_0x32cd('0x26')](respondWithResult(_0x27aabc,0xc9))['catch'](handleError(_0x27aabc,null));};exports['update']=function(_0x4a036f,_0x1c7b25){if(_0x4a036f['body']['id']){delete _0x4a036f['body']['id'];}return db[_0x32cd('0x2f')][_0x32cd('0x4b')]({'where':{'id':_0x4a036f[_0x32cd('0x4a')]['id']}})[_0x32cd('0x26')](handleEntityNotFound(_0x1c7b25,null))[_0x32cd('0x26')](saveUpdates(_0x4a036f[_0x32cd('0x4d')],null))[_0x32cd('0x26')](respondWithResult(_0x1c7b25,null))[_0x32cd('0x49')](handleError(_0x1c7b25,null));};exports['destroy']=function(_0x4d217e,_0x3bccbf){return db[_0x32cd('0x2f')]['find']({'where':{'id':_0x4d217e[_0x32cd('0x4a')]['id']}})[_0x32cd('0x26')](handleEntityNotFound(_0x3bccbf,null))['then'](removeEntity(_0x3bccbf,null))[_0x32cd('0x49')](handleError(_0x3bccbf,null));}; \ No newline at end of file +var _0x2645=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','get','Dispositions','end','error','name','send','map','Disposition','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','catch'];(function(_0x21ecb6,_0x37a730){var _0x178936=function(_0x59bb66){while(--_0x59bb66){_0x21ecb6['push'](_0x21ecb6['shift']());}};_0x178936(++_0x37a730);}(_0x2645,0xb0));var _0x5264=function(_0xb6135c,_0x9a89ff){_0xb6135c=_0xb6135c-0x0;var _0x4e408c=_0x2645[_0xb6135c];return _0x4e408c;};'use strict';var emlformat=require(_0x5264('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5264('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5264('0x2'));var moment=require(_0x5264('0x3'));var BPromise=require(_0x5264('0x4'));var Mustache=require(_0x5264('0x5'));var util=require(_0x5264('0x6'));var path=require(_0x5264('0x7'));var sox=require(_0x5264('0x8'));var csv=require(_0x5264('0x9'));var ejs=require(_0x5264('0xa'));var fs=require('fs');var fs_extra=require(_0x5264('0xb'));var _=require(_0x5264('0xc'));var squel=require(_0x5264('0xd'));var crypto=require(_0x5264('0xe'));var jsforce=require(_0x5264('0xf'));var deskjs=require(_0x5264('0x10'));var toCsv=require(_0x5264('0x9'));var querystring=require(_0x5264('0x11'));var Papa=require('papaparse');var Redis=require(_0x5264('0x12'));var authService=require(_0x5264('0x13'));var qs=require(_0x5264('0x14'));var as=require(_0x5264('0x15'));var hardwareService=require(_0x5264('0x16'));var logger=require('../../config/logger')(_0x5264('0x17'));var utils=require('../../config/utils');var config=require(_0x5264('0x18'));var licenseUtil=require(_0x5264('0x19'));var db=require(_0x5264('0x1a'))['db'];function respondWithStatusCode(_0x1a8172,_0x1c79ea){_0x1c79ea=_0x1c79ea||0xcc;return function(_0x4c78c2){if(_0x4c78c2){return _0x1a8172[_0x5264('0x1b')](_0x1c79ea);}return _0x1a8172[_0x5264('0x1c')](_0x1c79ea)['end']();};}function respondWithResult(_0x483dce,_0x472b8b){_0x472b8b=_0x472b8b||0xc8;return function(_0x3c6781){if(_0x3c6781){return _0x483dce[_0x5264('0x1c')](_0x472b8b)[_0x5264('0x1d')](_0x3c6781);}};}function respondWithFilteredResult(_0x5e4285,_0x6356d6){return function(_0x5313fc){if(_0x5313fc){var _0x52fee1=typeof _0x6356d6['offset']===_0x5264('0x1e')&&typeof _0x6356d6[_0x5264('0x1f')]==='undefined';var _0x208fb1=_0x5313fc[_0x5264('0x20')];var _0x2a5084=_0x52fee1?0x0:_0x6356d6[_0x5264('0x21')];var _0x2801fd=_0x52fee1?_0x5313fc[_0x5264('0x20')]:_0x6356d6[_0x5264('0x21')]+_0x6356d6[_0x5264('0x1f')];var _0x150efb;if(_0x2801fd>=_0x208fb1){_0x2801fd=_0x208fb1;_0x150efb=0xc8;}else{_0x150efb=0xce;}_0x5e4285[_0x5264('0x1c')](_0x150efb);return _0x5e4285[_0x5264('0x22')](_0x5264('0x23'),_0x2a5084+'-'+_0x2801fd+'/'+_0x208fb1)['json'](_0x5313fc);}return null;};}function patchUpdates(_0x22226d){return function(_0x38ac1a){try{jsonpatch['apply'](_0x38ac1a,_0x22226d,!![]);}catch(_0x2cec5d){return BPromise['reject'](_0x2cec5d);}return _0x38ac1a[_0x5264('0x24')]();};}function saveUpdates(_0x3edd29,_0x41fdbd){return function(_0x372263){if(_0x372263){return _0x372263[_0x5264('0x25')](_0x3edd29)[_0x5264('0x26')](function(_0x3585ff){return _0x3585ff;});}return null;};}function removeEntity(_0x54b4ae,_0x1fbd9a){return function(_0x40e994){if(_0x40e994){return _0x40e994[_0x5264('0x27')]()[_0x5264('0x26')](function(){var _0x3f07d0=_0x40e994[_0x5264('0x28')]({'plain':!![]});var _0x1b1a44=_0x5264('0x29');return db['UserProfileResource'][_0x5264('0x27')]({'where':{'type':_0x1b1a44,'resourceId':_0x3f07d0['id']}})[_0x5264('0x26')](function(){return _0x40e994;});})[_0x5264('0x26')](function(){_0x54b4ae[_0x5264('0x1c')](0xcc)[_0x5264('0x2a')]();});}};}function handleEntityNotFound(_0x2074c8,_0x1cef70){return function(_0x3b3517){if(!_0x3b3517){_0x2074c8[_0x5264('0x1b')](0x194);}return _0x3b3517;};}function handleError(_0xe74305,_0x14d748){_0x14d748=_0x14d748||0x1f4;return function(_0x30e52b){logger[_0x5264('0x2b')](_0x30e52b['stack']);if(_0x30e52b[_0x5264('0x2c')]){delete _0x30e52b[_0x5264('0x2c')];}_0xe74305[_0x5264('0x1c')](_0x14d748)[_0x5264('0x2d')](_0x30e52b);};}exports['index']=function(_0x34a7f1,_0x63514e){var _0x3fcef1={},_0x548c11={},_0x4b00b1={'count':0x0,'rows':[]};var _0x4e05e9=_[_0x5264('0x2e')](db[_0x5264('0x2f')]['rawAttributes'],function(_0x43f112){return{'name':_0x43f112[_0x5264('0x30')],'type':_0x43f112['type'][_0x5264('0x31')]};});_0x548c11[_0x5264('0x32')]=_['map'](_0x4e05e9,_0x5264('0x2c'));_0x548c11['query']=_['keys'](_0x34a7f1[_0x5264('0x33')]);_0x548c11[_0x5264('0x34')]=_[_0x5264('0x35')](_0x548c11['model'],_0x548c11[_0x5264('0x33')]);_0x3fcef1['attributes']=_[_0x5264('0x35')](_0x548c11[_0x5264('0x32')],qs[_0x5264('0x36')](_0x34a7f1[_0x5264('0x33')]['fields']));_0x3fcef1[_0x5264('0x37')]=_0x3fcef1[_0x5264('0x37')][_0x5264('0x38')]?_0x3fcef1['attributes']:_0x548c11['model'];if(!_0x34a7f1['query'][_0x5264('0x39')](_0x5264('0x3a'))){_0x3fcef1['limit']=qs['limit'](_0x34a7f1[_0x5264('0x33')][_0x5264('0x1f')]);_0x3fcef1[_0x5264('0x21')]=qs['offset'](_0x34a7f1[_0x5264('0x33')]['offset']);}_0x3fcef1[_0x5264('0x3b')]=qs[_0x5264('0x3c')](_0x34a7f1[_0x5264('0x33')][_0x5264('0x3c')]);_0x3fcef1['where']=qs[_0x5264('0x34')](_[_0x5264('0x3d')](_0x34a7f1['query'],_0x548c11[_0x5264('0x34')]),_0x4e05e9);if(_0x34a7f1['query'][_0x5264('0x3e')]){_0x3fcef1[_0x5264('0x3f')]=_[_0x5264('0x40')](_0x3fcef1[_0x5264('0x3f')],{'$or':_[_0x5264('0x2e')](_0x4e05e9,function(_0x533bbb){if(_0x533bbb['type']!==_0x5264('0x41')){var _0x3f399a={};_0x3f399a[_0x533bbb['name']]={'$like':'%'+_0x34a7f1['query'][_0x5264('0x3e')]+'%'};return _0x3f399a;}})});}_0x3fcef1=_[_0x5264('0x40')]({},_0x3fcef1,_0x34a7f1[_0x5264('0x42')]);var _0x19e789={'where':_0x3fcef1[_0x5264('0x3f')]};return db[_0x5264('0x2f')][_0x5264('0x20')](_0x19e789)[_0x5264('0x26')](function(_0x529ca5){_0x4b00b1[_0x5264('0x20')]=_0x529ca5;if(_0x34a7f1['query'][_0x5264('0x43')]){_0x3fcef1[_0x5264('0x44')]=[{'all':!![]}];}return db[_0x5264('0x2f')]['findAll'](_0x3fcef1);})['then'](function(_0x5180b3){_0x4b00b1[_0x5264('0x45')]=_0x5180b3;return _0x4b00b1;})[_0x5264('0x26')](respondWithFilteredResult(_0x63514e,_0x3fcef1))['catch'](handleError(_0x63514e,null));};exports[_0x5264('0x46')]=function(_0x282b20,_0x41f2e1){var _0x164b16={'raw':!![],'where':{'id':_0x282b20[_0x5264('0x47')]['id']}},_0x2000a7={};_0x2000a7[_0x5264('0x32')]=_['keys'](db[_0x5264('0x2f')]['rawAttributes']);_0x2000a7[_0x5264('0x33')]=_['keys'](_0x282b20['query']);_0x2000a7['filters']=_[_0x5264('0x35')](_0x2000a7[_0x5264('0x32')],_0x2000a7[_0x5264('0x33')]);_0x164b16['attributes']=_[_0x5264('0x35')](_0x2000a7[_0x5264('0x32')],qs[_0x5264('0x36')](_0x282b20[_0x5264('0x33')]['fields']));_0x164b16[_0x5264('0x37')]=_0x164b16[_0x5264('0x37')][_0x5264('0x38')]?_0x164b16['attributes']:_0x2000a7[_0x5264('0x32')];if(_0x282b20[_0x5264('0x33')]['includeAll']){_0x164b16[_0x5264('0x44')]=[{'all':!![]}];}_0x164b16=_[_0x5264('0x40')]({},_0x164b16,_0x282b20[_0x5264('0x42')]);return db['Disposition']['find'](_0x164b16)['then'](handleEntityNotFound(_0x41f2e1,null))[_0x5264('0x26')](respondWithResult(_0x41f2e1,null))[_0x5264('0x48')](handleError(_0x41f2e1,null));};exports[_0x5264('0x49')]=function(_0x5259a5,_0x1f9602){return db['Disposition'][_0x5264('0x49')](_0x5259a5[_0x5264('0x4a')],{})[_0x5264('0x26')](function(_0x4e3236){var _0x1f862f=_0x5259a5[_0x5264('0x4b')][_0x5264('0x28')]({'plain':!![]});if(!_0x1f862f)throw new Error(_0x5264('0x4c'));if(_0x1f862f[_0x5264('0x4d')]==='user'){var _0x1b659a=_0x4e3236['get']({'plain':!![]});var _0x1c4c2b='Dispositions';return db[_0x5264('0x4e')]['find']({'where':{'name':_0x1c4c2b,'userProfileId':_0x1f862f[_0x5264('0x4f')]},'raw':!![]})[_0x5264('0x26')](function(_0x51e171){if(_0x51e171&&_0x51e171[_0x5264('0x50')]===0x0){return db[_0x5264('0x51')]['create']({'name':_0x1b659a[_0x5264('0x2c')],'resourceId':_0x1b659a['id'],'type':_0x51e171[_0x5264('0x2c')],'sectionId':_0x51e171['id']},{})[_0x5264('0x26')](function(){return _0x4e3236;});}else{return _0x4e3236;}})[_0x5264('0x48')](function(_0x29172c){logger[_0x5264('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29172c);throw _0x29172c;});}return _0x4e3236;})[_0x5264('0x26')](respondWithResult(_0x1f9602,0xc9))['catch'](handleError(_0x1f9602,null));};exports[_0x5264('0x25')]=function(_0xf9ab47,_0x215858){if(_0xf9ab47['body']['id']){delete _0xf9ab47[_0x5264('0x4a')]['id'];}return db[_0x5264('0x2f')][_0x5264('0x52')]({'where':{'id':_0xf9ab47[_0x5264('0x47')]['id']}})[_0x5264('0x26')](handleEntityNotFound(_0x215858,null))[_0x5264('0x26')](saveUpdates(_0xf9ab47[_0x5264('0x4a')],null))['then'](respondWithResult(_0x215858,null))[_0x5264('0x48')](handleError(_0x215858,null));};exports[_0x5264('0x27')]=function(_0x24b7dd,_0xf70d43){return db[_0x5264('0x2f')][_0x5264('0x52')]({'where':{'id':_0x24b7dd[_0x5264('0x47')]['id']}})['then'](handleEntityNotFound(_0xf70d43,null))[_0x5264('0x26')](removeEntity(_0xf70d43,null))[_0x5264('0x48')](handleError(_0xf70d43,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index bebb8ad..ff3d8fe 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 _0x6fca=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash'];(function(_0x2b7209,_0x52a355){var _0x46b1ae=function(_0x5d0c66){while(--_0x5d0c66){_0x2b7209['push'](_0x2b7209['shift']());}};_0x46b1ae(++_0x52a355);}(_0x6fca,0x14f));var _0xa6fc=function(_0x318e5c,_0x145a22){_0x318e5c=_0x318e5c-0x0;var _0x2beb05=_0x6fca[_0x318e5c];return _0x2beb05;};'use strict';var _=require(_0xa6fc('0x0'));var util=require(_0xa6fc('0x1'));var logger=require('../../config/logger')(_0xa6fc('0x2'));var moment=require(_0xa6fc('0x3'));var BPromise=require(_0xa6fc('0x4'));var rp=require(_0xa6fc('0x5'));var fs=require('fs');var path=require(_0xa6fc('0x6'));var rimraf=require(_0xa6fc('0x7'));var config=require(_0xa6fc('0x8'));var attributes=require('./disposition.attributes');module[_0xa6fc('0x9')]=function(_0x416446,_0x262923){return _0x416446['define'](_0xa6fc('0xa'),attributes,{'tableName':_0xa6fc('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xa6fc('0xc'),'fields':[_0xa6fc('0xd'),_0xa6fc('0xe')]},{'unique':!![],'name':_0xa6fc('0xf'),'fields':[_0xa6fc('0xd'),_0xa6fc('0x10')]},{'unique':!![],'name':_0xa6fc('0x11'),'fields':[_0xa6fc('0xd'),_0xa6fc('0x12')]},{'unique':!![],'name':'name_sms','fields':[_0xa6fc('0xd'),_0xa6fc('0x13')]},{'unique':!![],'name':_0xa6fc('0x14'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0xa6fc('0x15'),'fields':[_0xa6fc('0xd'),_0xa6fc('0x16')]},{'unique':!![],'name':_0xa6fc('0x17'),'fields':[_0xa6fc('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e2f=['define','Disposition','tools_dispositions','ListId','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./disposition.attributes','exports'];(function(_0x288d06,_0x29730d){var _0x34d754=function(_0x4c265a){while(--_0x4c265a){_0x288d06['push'](_0x288d06['shift']());}};_0x34d754(++_0x29730d);}(_0x1e2f,0x1ee));var _0xf1e2=function(_0x2b0ac8,_0x29a0cc){_0x2b0ac8=_0x2b0ac8-0x0;var _0x1931c2=_0x1e2f[_0x2b0ac8];return _0x1931c2;};'use strict';var _=require(_0xf1e2('0x0'));var util=require(_0xf1e2('0x1'));var logger=require(_0xf1e2('0x2'))(_0xf1e2('0x3'));var moment=require(_0xf1e2('0x4'));var BPromise=require(_0xf1e2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf1e2('0x6'));var config=require(_0xf1e2('0x7'));var attributes=require(_0xf1e2('0x8'));module[_0xf1e2('0x9')]=function(_0x53fe46,_0x411c8d){return _0x53fe46[_0xf1e2('0xa')](_0xf1e2('0xb'),attributes,{'tableName':_0xf1e2('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0xf1e2('0xd')]},{'unique':!![],'name':_0xf1e2('0xe'),'fields':[_0xf1e2('0xf'),_0xf1e2('0x10')]},{'unique':!![],'name':_0xf1e2('0x11'),'fields':[_0xf1e2('0xf'),_0xf1e2('0x12')]},{'unique':!![],'name':'name_sms','fields':['name',_0xf1e2('0x13')]},{'unique':!![],'name':_0xf1e2('0x14'),'fields':[_0xf1e2('0xf'),_0xf1e2('0x15')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0xf1e2('0x16')]},{'unique':!![],'name':_0xf1e2('0x17'),'fields':[_0xf1e2('0xf'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index ba36db1..c27393e 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(_0x3936b8,_0x2532aa){var _0x109993=function(_0x43af28){while(--_0x43af28){_0x3936b8['push'](_0x3936b8['shift']());}};_0x109993(++_0x2532aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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(_0x5c98b9,_0x56430c){var _0x500eef=function(_0x7f39b7){while(--_0x7f39b7){_0x5c98b9['push'](_0x5c98b9['shift']());}};_0x500eef(++_0x56430c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 785ec44..5253c31 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 _0xc8a2=['/:id','isAuthenticated','create','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','index','get'];(function(_0xa81cd4,_0x2c9f48){var _0x934ce4=function(_0x2f12ca){while(--_0x2f12ca){_0xa81cd4['push'](_0xa81cd4['shift']());}};_0x934ce4(++_0x2c9f48);}(_0xc8a2,0x86));var _0x2c8a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc8a2[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x2c8a('0x0'));var path=require('path');var timeout=require(_0x2c8a('0x1'));var express=require(_0x2c8a('0x2'));var router=express[_0x2c8a('0x3')]();var fs_extra=require(_0x2c8a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2c8a('0x5'));var config=require(_0x2c8a('0x6'));var controller=require(_0x2c8a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2c8a('0x8')]);router[_0x2c8a('0x9')](_0x2c8a('0xa'),auth[_0x2c8a('0xb')](),controller['show']);router['post']('/',auth[_0x2c8a('0xb')](),controller[_0x2c8a('0xc')]);router['put']('/:id',auth[_0x2c8a('0xb')](),controller['update']);router[_0x2c8a('0xd')](_0x2c8a('0xa'),auth['isAuthenticated'](),controller[_0x2c8a('0xe')]);module[_0x2c8a('0xf')]=router; \ No newline at end of file +var _0xecc9=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./disposition.controller','isAuthenticated','get','/:id','create','put','update','destroy'];(function(_0xd94141,_0x3dff74){var _0x357c3d=function(_0x34a025){while(--_0x34a025){_0xd94141['push'](_0xd94141['shift']());}};_0x357c3d(++_0x3dff74);}(_0xecc9,0xcd));var _0x9ecc=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xecc9[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x9ecc('0x0'));var util=require(_0x9ecc('0x1'));var path=require(_0x9ecc('0x2'));var timeout=require(_0x9ecc('0x3'));var express=require(_0x9ecc('0x4'));var router=express[_0x9ecc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9ecc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9ecc('0x7'));var controller=require(_0x9ecc('0x8'));router['get']('/',auth[_0x9ecc('0x9')](),controller['index']);router[_0x9ecc('0xa')](_0x9ecc('0xb'),auth[_0x9ecc('0x9')](),controller['show']);router['post']('/',auth[_0x9ecc('0x9')](),controller[_0x9ecc('0xc')]);router[_0x9ecc('0xd')](_0x9ecc('0xb'),auth[_0x9ecc('0x9')](),controller[_0x9ecc('0xe')]);router['delete'](_0x9ecc('0xb'),auth[_0x9ecc('0x9')](),controller[_0x9ecc('0xf')]);module[_0x9ecc('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 6fc1446..4c24b8a 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 _0x17ba=['xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','mandatoryDispositionPauseId','setDataValue','sequelize','exports','STRING','ENUM','yes'];(function(_0x1ffd67,_0x1c18ba){var _0xce170f=function(_0x16cdb2){while(--_0x16cdb2){_0x1ffd67['push'](_0x1ffd67['shift']());}};_0xce170f(++_0x1c18ba);}(_0x17ba,0xab));var _0xa17b=function(_0x5832ac,_0x118027){_0x5832ac=_0x5832ac-0x0;var _0x402242=_0x17ba[_0x5832ac];return _0x402242;};'use strict';var Sequelize=require(_0xa17b('0x0'));module[_0xa17b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa17b('0x2')]},'ecm':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x4'),'no'),'defaultValue':_0xa17b('0x4')},'headerinfo':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x5')},'localstationid':{'type':Sequelize[_0xa17b('0x2')],'unique':_0xa17b('0x6')},'minrate':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x7'),_0xa17b('0x8'),_0xa17b('0x9'),_0xa17b('0xa'),_0xa17b('0xb'),_0xa17b('0xc')),'defaultValue':_0xa17b('0x8')},'maxrate':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0x7'),_0xa17b('0x8'),'7200',_0xa17b('0xa'),_0xa17b('0xb'),_0xa17b('0xc')),'defaultValue':_0xa17b('0xc')},'modem':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0xd')},'gateway':{'type':Sequelize[_0xa17b('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[_0xa17b('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa17b('0x3')](_0xa17b('0xf'),'IAX',_0xa17b('0x10'),_0xa17b('0x11')),'defaultValue':_0xa17b('0xf')},'key':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa17b('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa17b('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa17b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa17b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa17b('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa17b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa17b('0xe')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa17b('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4d5592){if(!_0x4d5592)this['setDataValue'](_0xa17b('0x14'),null);this[_0xa17b('0x15')]('mandatoryDisposition',_0x4d5592);}}}; \ No newline at end of file +var _0x8ab0=['14400','12000','v17,v27,v29','INTEGER','SIP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','2400','4800','7200','9600'];(function(_0x4d3005,_0x18de04){var _0x3953c6=function(_0x3248e1){while(--_0x3248e1){_0x4d3005['push'](_0x4d3005['shift']());}};_0x3953c6(++_0x18de04);}(_0x8ab0,0x8a));var _0x08ab=function(_0x344698,_0x1057a9){_0x344698=_0x344698-0x0;var _0x491ad2=_0x8ab0[_0x344698];return _0x491ad2;};'use strict';var Sequelize=require(_0x08ab('0x0'));module[_0x08ab('0x1')]={'name':{'type':Sequelize[_0x08ab('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x08ab('0x2')]},'ecm':{'type':Sequelize[_0x08ab('0x3')](_0x08ab('0x4'),'no'),'defaultValue':_0x08ab('0x4')},'headerinfo':{'type':Sequelize[_0x08ab('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x08ab('0x3')](_0x08ab('0x5'),_0x08ab('0x6'),_0x08ab('0x7'),_0x08ab('0x8'),'12000',_0x08ab('0x9')),'defaultValue':_0x08ab('0x6')},'maxrate':{'type':Sequelize[_0x08ab('0x3')](_0x08ab('0x5'),_0x08ab('0x6'),_0x08ab('0x7'),_0x08ab('0x8'),_0x08ab('0xa'),_0x08ab('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x08ab('0xb')},'gateway':{'type':Sequelize[_0x08ab('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[_0x08ab('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x08ab('0x3')]('SIP','IAX','DADHI','KHOMP'),'defaultValue':_0x08ab('0xd')},'key':{'type':Sequelize[_0x08ab('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x08ab('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x08ab('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x08ab('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x08ab('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x08ab('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x08ab('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x08ab('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x08ab('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x08ab('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x08ab('0xf')],'defaultValue':![],'comment':_0x08ab('0x11'),'set':function(_0x2d084c){if(!_0x2d084c)this[_0x08ab('0x12')](_0x08ab('0x13'),null);this[_0x08ab('0x12')](_0x08ab('0x14'),_0x2d084c);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index ef2d252..b19d09a 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 _0x7d09=['CmList','List','DESC','attachments','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','Disposition','getDispositions','findOne','sort','removeDispositions','ids','addAnswer','FaxAccountId','getAnswers','nolimit','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','Contact','fullname','Tag','Tags','color','tag','addApplications','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','send','getApplications','from-voip-provider','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','/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','sequelize','VoiceExtension','updateAccountApplications','tech','key','updatedAt','ListId','findById','FaxMessage','$gte','split','format'];(function(_0x553150,_0x589ff3){var _0x18193d=function(_0x3a5ae6){while(--_0x3a5ae6){_0x553150['push'](_0x553150['shift']());}};_0x18193d(++_0x589ff3);}(_0x7d09,0x1a0));var _0x97d0=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0x7d09[_0x5951e8];return _0x20a1f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97d0('0x0'));var zipdir=require(_0x97d0('0x1'));var jsonpatch=require(_0x97d0('0x2'));var rp=require(_0x97d0('0x3'));var moment=require(_0x97d0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x97d0('0x5'));var path=require(_0x97d0('0x6'));var sox=require(_0x97d0('0x7'));var csv=require(_0x97d0('0x8'));var ejs=require(_0x97d0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97d0('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x97d0('0xb'));var deskjs=require(_0x97d0('0xc'));var toCsv=require(_0x97d0('0x8'));var querystring=require(_0x97d0('0xd'));var Papa=require('papaparse');var Redis=require(_0x97d0('0xe'));var authService=require(_0x97d0('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97d0('0x10'));var logger=require(_0x97d0('0x11'))(_0x97d0('0x12'));var utils=require(_0x97d0('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x97d0('0x14'));var db=require(_0x97d0('0x15'))['db'];config[_0x97d0('0x16')]=_[_0x97d0('0x17')](config[_0x97d0('0x16')],{'host':_0x97d0('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x97d0('0x16')]));require(_0x97d0('0x19'))[_0x97d0('0x1a')](socket);var jayson=require(_0x97d0('0x1b'));var client=jayson[_0x97d0('0x1c')][_0x97d0('0x1d')]({'port':0x232c});var client9002=jayson[_0x97d0('0x1c')][_0x97d0('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2a9dbb,_0x2e7771,_0x48412a,_0x1cbae0){return new BPromise(function(_0x189ad3,_0x18ee4b){var _0x57e6bb=_0x1cbae0||client;return _0x57e6bb[_0x97d0('0x1e')](_0x2a9dbb,_0x48412a)['then'](function(_0x48ea18){logger[_0x97d0('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x2e7771,_0x97d0('0x20'));logger[_0x97d0('0x21')](_0x97d0('0x22'),_0x2e7771,_0x97d0('0x20'),JSON[_0x97d0('0x23')](_0x48ea18));if(_0x48ea18[_0x97d0('0x24')]){if(_0x48ea18['error'][_0x97d0('0x25')]===0x1f4){logger['error'](_0x97d0('0x26'),_0x2e7771,_0x48ea18[_0x97d0('0x24')]['message']);return _0x18ee4b(_0x48ea18[_0x97d0('0x24')][_0x97d0('0x27')]);}logger[_0x97d0('0x24')](_0x97d0('0x26'),_0x2e7771,_0x48ea18['error'][_0x97d0('0x27')]);return _0x189ad3(_0x48ea18[_0x97d0('0x24')][_0x97d0('0x27')]);}else{logger[_0x97d0('0x1f')](_0x97d0('0x26'),_0x2e7771,_0x97d0('0x20'));_0x189ad3(_0x48ea18[_0x97d0('0x28')][_0x97d0('0x27')]);}})[_0x97d0('0x29')](function(_0x5f528b){logger[_0x97d0('0x24')](_0x97d0('0x26'),_0x2e7771,_0x5f528b);_0x18ee4b(_0x5f528b);});});}function respondWithStatusCode(_0xb57760,_0x2e0e26){_0x2e0e26=_0x2e0e26||0xcc;return function(_0x95f7f){if(_0x95f7f){return _0xb57760['sendStatus'](_0x2e0e26);}return _0xb57760['status'](_0x2e0e26)[_0x97d0('0x2a')]();};}function respondWithResult(_0x77c55e,_0x29da0b){_0x29da0b=_0x29da0b||0xc8;return function(_0x4096f3){if(_0x4096f3){return _0x77c55e[_0x97d0('0x2b')](_0x29da0b)[_0x97d0('0x2c')](_0x4096f3);}};}function respondWithFilteredResult(_0x1fb554,_0x302c2d){return function(_0x55a84f){if(_0x55a84f){var _0x40bfe9=typeof _0x302c2d['offset']===_0x97d0('0x2d')&&typeof _0x302c2d[_0x97d0('0x2e')]===_0x97d0('0x2d');var _0x8efee1=_0x55a84f[_0x97d0('0x2f')];var _0x3ca611=_0x40bfe9?0x0:_0x302c2d[_0x97d0('0x30')];var _0x2175c0=_0x40bfe9?_0x55a84f['count']:_0x302c2d[_0x97d0('0x30')]+_0x302c2d['limit'];var _0x19fb2e;if(_0x2175c0>=_0x8efee1){_0x2175c0=_0x8efee1;_0x19fb2e=0xc8;}else{_0x19fb2e=0xce;}_0x1fb554[_0x97d0('0x2b')](_0x19fb2e);return _0x1fb554[_0x97d0('0x31')](_0x97d0('0x32'),_0x3ca611+'-'+_0x2175c0+'/'+_0x8efee1)[_0x97d0('0x2c')](_0x55a84f);}return null;};}function patchUpdates(_0x24efeb){return function(_0x50d2c2){try{jsonpatch[_0x97d0('0x33')](_0x50d2c2,_0x24efeb,!![]);}catch(_0x26b40d){return BPromise['reject'](_0x26b40d);}return _0x50d2c2[_0x97d0('0x34')]();};}function saveUpdates(_0x147ae4,_0x231ea5){return function(_0x13bc56){if(_0x13bc56){return _0x13bc56[_0x97d0('0x35')](_0x147ae4)[_0x97d0('0x36')](function(_0x439da3){return _0x439da3;});}return null;};}function removeEntity(_0x44500b,_0x1f5e38){return function(_0x411f30){if(_0x411f30){return _0x411f30['destroy']()[_0x97d0('0x36')](function(){var _0x53c215=_0x411f30[_0x97d0('0x37')]({'plain':!![]});var _0x3be67d=_0x97d0('0x38');return db[_0x97d0('0x39')]['destroy']({'where':{'type':_0x3be67d,'resourceId':_0x53c215['id']}})[_0x97d0('0x36')](function(){return _0x411f30;});})['then'](function(){_0x44500b[_0x97d0('0x2b')](0xcc)[_0x97d0('0x2a')]();});}};}function handleEntityNotFound(_0x145073,_0x38dc49){return function(_0x2ac84a){if(!_0x2ac84a){_0x145073[_0x97d0('0x3a')](0x194);}return _0x2ac84a;};}function handleError(_0x23f0c6,_0x2f361a){_0x2f361a=_0x2f361a||0x1f4;return function(_0x160f47){logger[_0x97d0('0x24')](_0x160f47[_0x97d0('0x3b')]);if(_0x160f47[_0x97d0('0x3c')]){delete _0x160f47[_0x97d0('0x3c')];}_0x23f0c6[_0x97d0('0x2b')](_0x2f361a)['send'](_0x160f47);};}exports[_0x97d0('0x3d')]=function(_0x51a496,_0x48c596){var _0x2a76d6={'include':[{'model':db[_0x97d0('0x3e')],'as':_0x97d0('0x3f')}]},_0xb9ddd8={},_0x30b24d={'count':0x0,'rows':[]};var _0x50bf80=_[_0x97d0('0x40')](db[_0x97d0('0x41')]['rawAttributes'],function(_0x4e2ee5){return{'name':_0x4e2ee5['fieldName'],'type':_0x4e2ee5['type']['key']};});_0xb9ddd8[_0x97d0('0x42')]=_[_0x97d0('0x40')](_0x50bf80,_0x97d0('0x3c'));_0xb9ddd8[_0x97d0('0x43')]=_[_0x97d0('0x44')](_0x51a496[_0x97d0('0x43')]);_0xb9ddd8[_0x97d0('0x45')]=_[_0x97d0('0x46')](_0xb9ddd8[_0x97d0('0x42')],_0xb9ddd8['query']);_0x2a76d6[_0x97d0('0x47')]=_['intersection'](_0xb9ddd8[_0x97d0('0x42')],qs[_0x97d0('0x48')](_0x51a496[_0x97d0('0x43')]['fields']));_0x2a76d6[_0x97d0('0x47')]=_0x2a76d6['attributes']['length']?_0x2a76d6['attributes']:_0xb9ddd8[_0x97d0('0x42')];if(!_0x51a496[_0x97d0('0x43')][_0x97d0('0x49')]('nolimit')){_0x2a76d6[_0x97d0('0x2e')]=qs[_0x97d0('0x2e')](_0x51a496['query'][_0x97d0('0x2e')]);_0x2a76d6['offset']=qs['offset'](_0x51a496[_0x97d0('0x43')][_0x97d0('0x30')]);}_0x2a76d6[_0x97d0('0x4a')]=qs['sort'](_0x51a496[_0x97d0('0x43')]['sort']);_0x2a76d6[_0x97d0('0x4b')]=qs[_0x97d0('0x45')](_[_0x97d0('0x4c')](_0x51a496[_0x97d0('0x43')],_0xb9ddd8[_0x97d0('0x45')]),_0x50bf80);if(_0x51a496[_0x97d0('0x43')]['filter']){_0x2a76d6[_0x97d0('0x4b')]=_[_0x97d0('0x4d')](_0x2a76d6[_0x97d0('0x4b')],{'$or':_[_0x97d0('0x40')](_0x50bf80,function(_0x24715d){if(_0x24715d[_0x97d0('0x4e')]!==_0x97d0('0x4f')){var _0x54f813={};_0x54f813[_0x24715d[_0x97d0('0x3c')]]={'$like':'%'+_0x51a496[_0x97d0('0x43')][_0x97d0('0x50')]+'%'};return _0x54f813;}})});}_0x2a76d6=_[_0x97d0('0x4d')]({},_0x2a76d6,_0x51a496[_0x97d0('0x51')]);var _0xcf433a={'where':_0x2a76d6[_0x97d0('0x4b')]};return db[_0x97d0('0x41')][_0x97d0('0x2f')](_0xcf433a)[_0x97d0('0x36')](function(_0x3b3118){_0x30b24d['count']=_0x3b3118;if(_0x51a496[_0x97d0('0x43')][_0x97d0('0x52')]){_0x2a76d6[_0x97d0('0x53')]=[{'all':!![]}];}return db[_0x97d0('0x41')][_0x97d0('0x54')](_0x2a76d6);})['then'](function(_0x48cdf5){_0x30b24d[_0x97d0('0x55')]=_0x48cdf5;return _0x30b24d;})[_0x97d0('0x36')](respondWithFilteredResult(_0x48c596,_0x2a76d6))['catch'](handleError(_0x48c596,null));};exports[_0x97d0('0x56')]=function(_0xfcb49f,_0x42dad3){var _0x190023={'raw':![],'where':{'id':_0xfcb49f[_0x97d0('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x97d0('0x3f')}]},_0x1a5345={};_0x1a5345[_0x97d0('0x42')]=_[_0x97d0('0x44')](db[_0x97d0('0x41')][_0x97d0('0x58')]);_0x1a5345['query']=_[_0x97d0('0x44')](_0xfcb49f['query']);_0x1a5345[_0x97d0('0x45')]=_[_0x97d0('0x46')](_0x1a5345[_0x97d0('0x42')],_0x1a5345[_0x97d0('0x43')]);_0x190023['attributes']=_[_0x97d0('0x46')](_0x1a5345[_0x97d0('0x42')],qs[_0x97d0('0x48')](_0xfcb49f[_0x97d0('0x43')][_0x97d0('0x48')]));_0x190023[_0x97d0('0x47')]=_0x190023['attributes'][_0x97d0('0x59')]?_0x190023[_0x97d0('0x47')]:_0x1a5345[_0x97d0('0x42')];if(_0xfcb49f['query']['includeAll']){_0x190023[_0x97d0('0x53')]=[{'all':!![]}];}_0x190023=_[_0x97d0('0x4d')]({},_0x190023,_0xfcb49f[_0x97d0('0x51')]);return db['FaxAccount'][_0x97d0('0x5a')](_0x190023)[_0x97d0('0x36')](handleEntityNotFound(_0x42dad3,null))[_0x97d0('0x36')](respondWithResult(_0x42dad3,null))[_0x97d0('0x29')](handleError(_0x42dad3,null));};exports[_0x97d0('0x5b')]=function(_0x2cc859,_0x290299){return db[_0x97d0('0x41')]['create'](_0x2cc859[_0x97d0('0x5c')],{})[_0x97d0('0x36')](function(_0x2a97d3){var _0x86eefd=_0x2cc859['user'][_0x97d0('0x37')]({'plain':!![]});if(!_0x86eefd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x86eefd[_0x97d0('0x5d')]===_0x97d0('0x5e')){var _0xd4c834=_0x2a97d3['get']({'plain':!![]});var _0x21f19a=_0x97d0('0x38');return db[_0x97d0('0x5f')][_0x97d0('0x5a')]({'where':{'name':_0x21f19a,'userProfileId':_0x86eefd[_0x97d0('0x60')]},'raw':!![]})[_0x97d0('0x36')](function(_0x2ca927){if(_0x2ca927&&_0x2ca927[_0x97d0('0x61')]===0x0){return db['UserProfileResource'][_0x97d0('0x5b')]({'name':_0xd4c834['name'],'resourceId':_0xd4c834['id'],'type':_0x2ca927['name'],'sectionId':_0x2ca927['id']},{})[_0x97d0('0x36')](function(){return _0x2a97d3;});}else{return _0x2a97d3;}})[_0x97d0('0x29')](function(_0x2999c8){logger['error'](_0x97d0('0x62'),_0x2999c8);throw _0x2999c8;});}return _0x2a97d3;})[_0x97d0('0x36')](respondWithResult(_0x290299,0xc9))[_0x97d0('0x29')](handleError(_0x290299,null));};exports[_0x97d0('0x35')]=function(_0x8b18c5,_0x24a15b){if(_0x8b18c5[_0x97d0('0x5c')]['id']){delete _0x8b18c5['body']['id'];}return db['FaxAccount'][_0x97d0('0x5a')]({'where':{'id':_0x8b18c5[_0x97d0('0x57')]['id']},'include':[{'model':db[_0x97d0('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x97d0('0x36')](handleEntityNotFound(_0x24a15b,null))[_0x97d0('0x36')](saveUpdates(_0x8b18c5['body'],null))[_0x97d0('0x36')](respondWithResult(_0x24a15b,null))[_0x97d0('0x29')](handleError(_0x24a15b,null));};exports[_0x97d0('0x63')]=function(_0x32f5d5,_0x5d3562){return db[_0x97d0('0x41')]['find']({'where':{'id':_0x32f5d5[_0x97d0('0x57')]['id']}})[_0x97d0('0x36')](handleEntityNotFound(_0x5d3562,null))[_0x97d0('0x36')](removeEntity(_0x5d3562,null))[_0x97d0('0x29')](handleError(_0x5d3562,null));};exports[_0x97d0('0x64')]=function(_0x55f054,_0x1e6717){return db[_0x97d0('0x41')]['describe']()[_0x97d0('0x36')](respondWithResult(_0x1e6717,null))[_0x97d0('0x29')](handleError(_0x1e6717,null));};exports[_0x97d0('0x65')]=function(_0x37b325,_0x5acf16,_0x39651a){if(_0x37b325[_0x97d0('0x5c')]['id']){delete _0x37b325[_0x97d0('0x5c')]['id'];}return db[_0x97d0('0x41')][_0x97d0('0x5a')]({'where':{'id':_0x37b325[_0x97d0('0x57')]['id']}})[_0x97d0('0x36')](handleEntityNotFound(_0x5acf16,null))[_0x97d0('0x36')](function(_0x1679f7){if(_0x1679f7){_0x37b325['body']['FaxAccountId']=_0x1679f7['id'];return db[_0x97d0('0x66')][_0x97d0('0x5b')](_0x37b325[_0x97d0('0x5c')]);}})[_0x97d0('0x36')](respondWithResult(_0x5acf16,null))['catch'](handleError(_0x5acf16,null));};exports[_0x97d0('0x67')]=function(_0x5b1a73,_0x59a9ca,_0xc9c505){var _0x458280={'raw':![],'where':{}};var _0x132c4e={};var _0x5a5593={'count':0x0,'rows':[]};return db[_0x97d0('0x41')][_0x97d0('0x68')]({'where':{'id':_0x5b1a73[_0x97d0('0x57')]['id']}})['then'](handleEntityNotFound(_0x59a9ca,null))[_0x97d0('0x36')](function(_0x1ba9fe){if(_0x1ba9fe){_0x132c4e[_0x97d0('0x42')]=_[_0x97d0('0x44')](db['Disposition'][_0x97d0('0x58')]);_0x132c4e[_0x97d0('0x43')]=_[_0x97d0('0x44')](_0x5b1a73['query']);_0x132c4e[_0x97d0('0x45')]=_[_0x97d0('0x46')](_0x132c4e['model'],_0x132c4e[_0x97d0('0x43')]);_0x458280['attributes']=_[_0x97d0('0x46')](_0x132c4e['model'],qs[_0x97d0('0x48')](_0x5b1a73[_0x97d0('0x43')][_0x97d0('0x48')]));_0x458280[_0x97d0('0x47')]=_0x458280[_0x97d0('0x47')][_0x97d0('0x59')]?_0x458280[_0x97d0('0x47')]:_0x132c4e[_0x97d0('0x42')];if(!_0x5b1a73[_0x97d0('0x43')][_0x97d0('0x49')]('nolimit')){_0x458280['limit']=qs[_0x97d0('0x2e')](_0x5b1a73[_0x97d0('0x43')][_0x97d0('0x2e')]);_0x458280[_0x97d0('0x30')]=qs['offset'](_0x5b1a73[_0x97d0('0x43')][_0x97d0('0x30')]);}_0x458280[_0x97d0('0x4a')]=qs['sort'](_0x5b1a73[_0x97d0('0x43')][_0x97d0('0x69')]);_0x458280['where']=qs['filters'](_[_0x97d0('0x4c')](_0x5b1a73['query'],_0x132c4e[_0x97d0('0x45')]));_0x458280[_0x97d0('0x4b')]['FaxAccountId']=_0x1ba9fe['id'];if(_0x5b1a73[_0x97d0('0x43')][_0x97d0('0x50')]){_0x458280['where']=_[_0x97d0('0x4d')](_0x458280[_0x97d0('0x4b')],{'$or':_[_0x97d0('0x40')](_0x458280[_0x97d0('0x47')],function(_0x5d9950){var _0x13c376={};_0x13c376[_0x5d9950]={'$like':'%'+_0x5b1a73[_0x97d0('0x43')][_0x97d0('0x50')]+'%'};return _0x13c376;})});}_0x458280=_[_0x97d0('0x4d')]({},_0x458280,_0x5b1a73[_0x97d0('0x51')]);return db[_0x97d0('0x66')][_0x97d0('0x2f')]({'where':_0x458280[_0x97d0('0x4b')]})[_0x97d0('0x36')](function(_0x375dcc){_0x5a5593[_0x97d0('0x2f')]=_0x375dcc;if(_0x5b1a73['query'][_0x97d0('0x52')]){_0x458280[_0x97d0('0x53')]=[{'all':!![]}];}return db['Disposition'][_0x97d0('0x54')](_0x458280);})[_0x97d0('0x36')](function(_0x5ba3d8){_0x5a5593[_0x97d0('0x55')]=_0x5ba3d8;return _0x5a5593;});}})['then'](respondWithFilteredResult(_0x59a9ca,_0x458280))[_0x97d0('0x29')](handleError(_0x59a9ca,null));};exports[_0x97d0('0x6a')]=function(_0xacec0e,_0x207948,_0x39d5b6){return db['FaxAccount'][_0x97d0('0x5a')]({'where':{'id':_0xacec0e['params']['id']}})[_0x97d0('0x36')](handleEntityNotFound(_0x207948,null))[_0x97d0('0x36')](function(_0x5e42a1){if(_0x5e42a1){return _0x5e42a1[_0x97d0('0x6a')](_0xacec0e[_0x97d0('0x43')][_0x97d0('0x6b')]);}})[_0x97d0('0x36')](respondWithStatusCode(_0x207948,null))[_0x97d0('0x29')](handleError(_0x207948,null));};exports[_0x97d0('0x6c')]=function(_0x51afdf,_0x420bde,_0xe3254a){if(_0x51afdf[_0x97d0('0x5c')]['id']){delete _0x51afdf[_0x97d0('0x5c')]['id'];}return db['FaxAccount'][_0x97d0('0x5a')]({'where':{'id':_0x51afdf[_0x97d0('0x57')]['id']}})[_0x97d0('0x36')](handleEntityNotFound(_0x420bde,null))[_0x97d0('0x36')](function(_0xe58268){if(_0xe58268){_0x51afdf[_0x97d0('0x5c')][_0x97d0('0x6d')]=_0xe58268['id'];return db['CannedAnswer'][_0x97d0('0x5b')](_0x51afdf[_0x97d0('0x5c')]);}})['then'](respondWithResult(_0x420bde,null))[_0x97d0('0x29')](handleError(_0x420bde,null));};exports[_0x97d0('0x6e')]=function(_0x3853e2,_0x574198,_0x1d0553){var _0x31450f={'raw':![],'where':{}};var _0x3adfb8={};var _0x30fc63={'count':0x0,'rows':[]};return db[_0x97d0('0x41')][_0x97d0('0x68')]({'where':{'id':_0x3853e2['params']['id']}})[_0x97d0('0x36')](handleEntityNotFound(_0x574198,null))['then'](function(_0x189fc9){if(_0x189fc9){_0x3adfb8[_0x97d0('0x42')]=_[_0x97d0('0x44')](db['CannedAnswer'][_0x97d0('0x58')]);_0x3adfb8['query']=_[_0x97d0('0x44')](_0x3853e2['query']);_0x3adfb8[_0x97d0('0x45')]=_[_0x97d0('0x46')](_0x3adfb8[_0x97d0('0x42')],_0x3adfb8['query']);_0x31450f[_0x97d0('0x47')]=_['intersection'](_0x3adfb8['model'],qs[_0x97d0('0x48')](_0x3853e2['query'][_0x97d0('0x48')]));_0x31450f[_0x97d0('0x47')]=_0x31450f['attributes'][_0x97d0('0x59')]?_0x31450f[_0x97d0('0x47')]:_0x3adfb8[_0x97d0('0x42')];if(!_0x3853e2[_0x97d0('0x43')][_0x97d0('0x49')](_0x97d0('0x6f'))){_0x31450f[_0x97d0('0x2e')]=qs[_0x97d0('0x2e')](_0x3853e2['query'][_0x97d0('0x2e')]);_0x31450f[_0x97d0('0x30')]=qs['offset'](_0x3853e2[_0x97d0('0x43')][_0x97d0('0x30')]);}_0x31450f[_0x97d0('0x4a')]=qs['sort'](_0x3853e2[_0x97d0('0x43')][_0x97d0('0x69')]);_0x31450f[_0x97d0('0x4b')]=qs[_0x97d0('0x45')](_[_0x97d0('0x4c')](_0x3853e2[_0x97d0('0x43')],_0x3adfb8[_0x97d0('0x45')]));_0x31450f[_0x97d0('0x4b')][_0x97d0('0x6d')]=_0x189fc9['id'];if(_0x3853e2[_0x97d0('0x43')][_0x97d0('0x50')]){_0x31450f[_0x97d0('0x4b')]=_[_0x97d0('0x4d')](_0x31450f['where'],{'$or':_[_0x97d0('0x40')](_0x31450f['attributes'],function(_0x51777a){var _0x4e5c20={};_0x4e5c20[_0x51777a]={'$like':'%'+_0x3853e2[_0x97d0('0x43')][_0x97d0('0x50')]+'%'};return _0x4e5c20;})});}_0x31450f=_[_0x97d0('0x4d')]({},_0x31450f,_0x3853e2[_0x97d0('0x51')]);return db['CannedAnswer'][_0x97d0('0x2f')]({'where':_0x31450f['where']})[_0x97d0('0x36')](function(_0x5082a5){_0x30fc63[_0x97d0('0x2f')]=_0x5082a5;if(_0x3853e2[_0x97d0('0x43')][_0x97d0('0x52')]){_0x31450f[_0x97d0('0x53')]=[{'all':!![]}];}return db[_0x97d0('0x70')][_0x97d0('0x54')](_0x31450f);})[_0x97d0('0x36')](function(_0x42ae47){_0x30fc63[_0x97d0('0x55')]=_0x42ae47;return _0x30fc63;});}})[_0x97d0('0x36')](respondWithFilteredResult(_0x574198,_0x31450f))[_0x97d0('0x29')](handleError(_0x574198,null));};exports[_0x97d0('0x71')]=function(_0x232685,_0x4fa5f2,_0x18d4c1){return db[_0x97d0('0x41')][_0x97d0('0x5a')]({'where':{'id':_0x232685[_0x97d0('0x57')]['id']}})[_0x97d0('0x36')](handleEntityNotFound(_0x4fa5f2,null))[_0x97d0('0x36')](function(_0x2b6b02){if(_0x2b6b02){return _0x2b6b02['removeAnswers'](_0x232685[_0x97d0('0x43')][_0x97d0('0x6b')]);}})[_0x97d0('0x36')](respondWithStatusCode(_0x4fa5f2,null))[_0x97d0('0x29')](handleError(_0x4fa5f2,null));};exports[_0x97d0('0x72')]=function(_0x4bee29,_0x139a57,_0x44db82){return db[_0x97d0('0x73')][_0x97d0('0x5a')]({'where':{'id':_0x4bee29['params']['id']}})[_0x97d0('0x36')](handleEntityNotFound(_0x139a57,null))[_0x97d0('0x36')](function(_0x59e12e){if(_0x59e12e){return _0x59e12e[_0x97d0('0x72')](_0x4bee29[_0x97d0('0x5c')][_0x97d0('0x6b')],_[_0x97d0('0x74')](_0x4bee29[_0x97d0('0x5c')],['ids','id'])||{});}})['then'](respondWithResult(_0x139a57,null))[_0x97d0('0x29')](handleError(_0x139a57,null));};exports['getInteractions']=function(_0x23e338,_0x208000,_0x1d5a37){var _0x20a59a={'raw':![],'where':{}};var _0x3b3052={};var _0x5005fe={'count':0x0,'rows':[]};return db[_0x97d0('0x41')][_0x97d0('0x68')]({'where':{'id':_0x23e338[_0x97d0('0x57')]['id']}})[_0x97d0('0x36')](handleEntityNotFound(_0x208000,null))[_0x97d0('0x36')](function(_0x4df816){if(_0x4df816){_0x3b3052[_0x97d0('0x42')]=_[_0x97d0('0x44')](db['FaxInteraction'][_0x97d0('0x58')]);_0x3b3052[_0x97d0('0x43')]=_[_0x97d0('0x44')](_0x23e338['query']);_0x3b3052[_0x97d0('0x45')]=_['intersection'](_0x3b3052['model'],_0x3b3052[_0x97d0('0x43')]);_0x20a59a['attributes']=_[_0x97d0('0x46')](_0x3b3052[_0x97d0('0x42')],qs['fields'](_0x23e338[_0x97d0('0x43')][_0x97d0('0x48')]));_0x20a59a[_0x97d0('0x47')]=_0x20a59a[_0x97d0('0x47')][_0x97d0('0x59')]?_0x20a59a[_0x97d0('0x47')]:_0x3b3052[_0x97d0('0x42')];if(!_0x23e338['query']['hasOwnProperty'](_0x97d0('0x6f'))){_0x20a59a[_0x97d0('0x2e')]=qs['limit'](_0x23e338[_0x97d0('0x43')][_0x97d0('0x2e')]);_0x20a59a[_0x97d0('0x30')]=qs[_0x97d0('0x30')](_0x23e338[_0x97d0('0x43')][_0x97d0('0x30')]);}_0x20a59a[_0x97d0('0x4a')]=qs['sort'](_0x23e338['query'][_0x97d0('0x69')]);_0x20a59a[_0x97d0('0x4b')]=qs[_0x97d0('0x45')](_[_0x97d0('0x4c')](_0x23e338[_0x97d0('0x43')],_0x3b3052[_0x97d0('0x45')]));_0x20a59a['where'][_0x97d0('0x6d')]=_0x4df816['id'];if(_0x23e338[_0x97d0('0x43')][_0x97d0('0x50')]){_0x20a59a[_0x97d0('0x4b')]=_[_0x97d0('0x4d')](_0x20a59a[_0x97d0('0x4b')],{'$or':_['map'](_0x20a59a[_0x97d0('0x47')],function(_0x49857e){var _0x3ab232={};_0x3ab232[_0x49857e]={'$like':'%'+_0x23e338[_0x97d0('0x43')]['filter']+'%'};return _0x3ab232;})});}_0x20a59a=_[_0x97d0('0x4d')]({},_0x20a59a,_0x23e338[_0x97d0('0x51')]);return db[_0x97d0('0x73')]['count']({'where':_0x20a59a[_0x97d0('0x4b')]})[_0x97d0('0x36')](function(_0x35769c){_0x5005fe['count']=_0x35769c;if(_0x23e338[_0x97d0('0x43')]['includeAll']){_0x20a59a[_0x97d0('0x53')]=[{'model':db['CmContact'],'as':_0x97d0('0x75'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x97d0('0x3c'),_0x97d0('0x76'),'internal'],'required':![]},{'model':db[_0x97d0('0x77')],'as':_0x97d0('0x78'),'attributes':['id',_0x97d0('0x3c'),_0x97d0('0x79')],'where':_0x23e338[_0x97d0('0x43')][_0x97d0('0x7a')]?{'id':_0x23e338['query'][_0x97d0('0x7a')]}:undefined,'required':_0x23e338[_0x97d0('0x43')][_0x97d0('0x7a')]?!![]:![]}];}return db[_0x97d0('0x73')][_0x97d0('0x54')](_0x20a59a);})['then'](function(_0x1162bf){_0x5005fe['rows']=_0x1162bf;return _0x5005fe;});}})[_0x97d0('0x36')](respondWithFilteredResult(_0x208000,_0x20a59a))[_0x97d0('0x29')](handleError(_0x208000,null));};exports[_0x97d0('0x7b')]=function(_0x5052b4,_0x2b6e39){var _0x382615=_0x5052b4['params']['id'];var _0x250289=_0x5052b4[_0x97d0('0x5c')];var _0xc16591=0xc8;var _0x1e0a17=null;return db['sequelize'][_0x97d0('0x7c')]({'isolationLevel':db['sequelize'][_0x97d0('0x7d')][_0x97d0('0x7e')]['READ_COMMITTED']},function(_0x1d5c4e){return db[_0x97d0('0x41')][_0x97d0('0x68')]({'where':{'id':_0x382615},'transaction':_0x1d5c4e})[_0x97d0('0x36')](function(_0x413ac9){if(_0x413ac9){return db[_0x97d0('0x7f')][_0x97d0('0x63')]({'where':{'FaxAccountId':_0x382615},'transaction':_0x1d5c4e})[_0x97d0('0x36')](function(){var _0x4dd3f3=_[_0x97d0('0x40')](_0x250289,function(_0x5b93b9){_0x5b93b9['FaxAccountId']=_0x382615;return _0x5b93b9;});return db[_0x97d0('0x7f')][_0x97d0('0x80')](_0x4dd3f3,{'transaction':_0x1d5c4e});});}else{_0xc16591=0x194;_0x1e0a17=[];}});})['then'](function(){if(_0xc16591!==0x194){return db[_0x97d0('0x7f')][_0x97d0('0x81')]({'where':{'FaxAccountId':_0x382615},'order':_0x97d0('0x82')})[_0x97d0('0x36')](function(_0x5d8a0d){_0x1e0a17=_0x5d8a0d;});}})[_0x97d0('0x29')](function(_0x3d2e19){_0xc16591=0x1f4;logger['error'](_0x3d2e19['stack']);if(_0x3d2e19['name']){delete _0x3d2e19[_0x97d0('0x3c')];}_0x1e0a17=_0x3d2e19;})['finally'](function(){if(_0x1e0a17===null){_0x2b6e39[_0x97d0('0x3a')](_0xc16591);}else{if(_0xc16591===0x1f4){_0x2b6e39[_0x97d0('0x2b')](_0xc16591)[_0x97d0('0x83')](_0x1e0a17);}else{_0x2b6e39[_0x97d0('0x2b')](_0xc16591)[_0x97d0('0x2c')](_0x1e0a17);}}});};exports[_0x97d0('0x84')]=function(_0x4b78c2,_0x329ede,_0x3d937e){var _0x1aee19={};var _0x1e0f0d={};var _0x404e4c;var _0x2cdbe8;return db[_0x97d0('0x41')][_0x97d0('0x68')]({'where':{'id':_0x4b78c2['params']['id']}})['then'](handleEntityNotFound(_0x329ede,null))['then'](function(_0x8b2563){if(_0x8b2563){_0x404e4c=_0x8b2563;_0x1e0f0d[_0x97d0('0x42')]=_['keys'](db['FaxApplication'][_0x97d0('0x58')]);_0x1e0f0d[_0x97d0('0x43')]=_['keys'](_0x4b78c2[_0x97d0('0x43')]);_0x1e0f0d[_0x97d0('0x45')]=_['intersection'](_0x1e0f0d[_0x97d0('0x42')],_0x1e0f0d[_0x97d0('0x43')]);_0x1aee19[_0x97d0('0x47')]=_[_0x97d0('0x46')](_0x1e0f0d['model'],qs[_0x97d0('0x48')](_0x4b78c2[_0x97d0('0x43')][_0x97d0('0x48')]));_0x1aee19[_0x97d0('0x47')]=_0x1aee19[_0x97d0('0x47')][_0x97d0('0x59')]?_0x1aee19[_0x97d0('0x47')]:_0x1e0f0d[_0x97d0('0x42')];_0x1aee19[_0x97d0('0x4a')]=qs[_0x97d0('0x69')](_0x4b78c2[_0x97d0('0x43')][_0x97d0('0x69')]);_0x1aee19[_0x97d0('0x4b')]=qs[_0x97d0('0x45')](_[_0x97d0('0x4c')](_0x4b78c2[_0x97d0('0x43')],_0x1e0f0d['filters']));if(_0x4b78c2[_0x97d0('0x43')][_0x97d0('0x50')]){_0x1aee19[_0x97d0('0x4b')]=_['merge'](_0x1aee19[_0x97d0('0x4b')],{'$or':_[_0x97d0('0x40')](_0x1aee19['attributes'],function(_0x5b91f2){var _0x1e8ce7={};_0x1e8ce7[_0x5b91f2]={'$like':'%'+_0x4b78c2[_0x97d0('0x43')][_0x97d0('0x50')]+'%'};return _0x1e8ce7;})});}_0x1aee19=_[_0x97d0('0x4d')]({},_0x1aee19,_0x4b78c2[_0x97d0('0x51')]);return _0x404e4c[_0x97d0('0x84')](_0x1aee19);}})['then'](function(_0x54ad9b){if(_0x54ad9b){_0x2cdbe8=_0x54ad9b[_0x97d0('0x59')];if(!_0x4b78c2[_0x97d0('0x43')][_0x97d0('0x49')]('nolimit')){_0x1aee19[_0x97d0('0x2e')]=qs['limit'](_0x4b78c2[_0x97d0('0x43')][_0x97d0('0x2e')]);_0x1aee19['offset']=qs[_0x97d0('0x30')](_0x4b78c2['query'][_0x97d0('0x30')]);}return _0x404e4c[_0x97d0('0x84')](_0x1aee19);}})[_0x97d0('0x36')](function(_0x350d4a){if(_0x350d4a){return _0x350d4a?{'count':_0x2cdbe8,'rows':_0x350d4a}:null;}})['then'](respondWithResult(_0x329ede,null))[_0x97d0('0x29')](handleError(_0x329ede,null));};function Extension(_0x45f4ca,_0x397148,_0x526755,_0x55648b){this['context']=_0x97d0('0x85');this['exten']=_0x45f4ca[_0x97d0('0x86')];this[_0x97d0('0x87')]=_0x55648b;this['type']=_0x97d0('0x88');this[_0x97d0('0x89')]=_0x97d0('0x8a');this[_0x97d0('0x6d')]=_0x45f4ca['id'];this['priority']=_0x397148;this[_0x97d0('0x8b')]=_0x526755;}function createExtensionsReciveFax(_0x5c1c68){var _0x4d0166=0x1;var _0x343964=[];_0x343964[_0x97d0('0x8c')](new Extension(_0x5c1c68,_0x4d0166,'',_0x97d0('0x8d')));_0x4d0166+=0x1;_0x343964[_0x97d0('0x8c')](new Extension(_0x5c1c68,_0x4d0166,_0x97d0('0x8e'),'Set'));_0x4d0166+=0x1;for(var _0x679d9d in _0x5c1c68){if(_0x5c1c68[_0x97d0('0x49')](_0x679d9d)&&(_0x679d9d==='ecm'||_0x679d9d===_0x97d0('0x86')||_0x679d9d===_0x97d0('0x8f')||_0x679d9d===_0x97d0('0x90')||_0x679d9d===_0x97d0('0x91')||_0x679d9d===_0x97d0('0x92')||_0x679d9d===_0x97d0('0x93')||_0x679d9d===_0x97d0('0x94')||_0x679d9d===_0x97d0('0x95'))){_0x343964[_0x97d0('0x8c')](new Extension(_0x5c1c68,_0x4d0166,_0x97d0('0x96')+_0x679d9d+')='+_0x5c1c68[_0x679d9d],_0x97d0('0x97')));_0x4d0166+=0x1;}}_0x343964['push'](new Extension(_0x5c1c68,_0x4d0166,'6','Wait'));_0x4d0166+=0x1;_0x343964['push'](new Extension(_0x5c1c68,_0x4d0166,_0x97d0('0x98'),'ReceiveFax'));_0x4d0166=0x0;return _0x343964;}exports[_0x97d0('0x99')]=function(_0x1cbe93,_0x3b6ff3,_0x52bc43){var _0x42cb4a;return db[_0x97d0('0x9a')][_0x97d0('0x7c')](function(_0x198a07){return db[_0x97d0('0x41')][_0x97d0('0x5b')](_0x1cbe93[_0x97d0('0x5c')],{'transaction':_0x198a07})[_0x97d0('0x36')](function(_0x359c5f){_0x42cb4a=_0x359c5f[_0x97d0('0x37')]({'plain':!![]});return db[_0x97d0('0x9b')][_0x97d0('0x80')](createExtensionsReciveFax(_0x42cb4a),{'transaction':_0x198a07});});})[_0x97d0('0x36')](function(){return _0x42cb4a;})[_0x97d0('0x36')](respondWithResult(_0x3b6ff3,null))[_0x97d0('0x29')](handleError(_0x3b6ff3,null));};exports[_0x97d0('0x9c')]=function(_0x91a00,_0x5722ad,_0x1863b9){var _0xd75207;return db['sequelize'][_0x97d0('0x7c')](function(_0x39e845){return db[_0x97d0('0x41')][_0x97d0('0x35')](_0x91a00[_0x97d0('0x5c')],{'where':{'id':_0x91a00[_0x97d0('0x5c')]['id']},'transaction':_0x39e845})[_0x97d0('0x36')](function(_0x1d3578){return db['VoiceExtension'][_0x97d0('0x63')]({'where':{'FaxAccountId':_0x91a00[_0x97d0('0x5c')]['id']},'transaction':_0x39e845})[_0x97d0('0x36')](function(_0x8c9a3e){return db['VoiceExtension'][_0x97d0('0x80')](createExtensionsReciveFax(_['omit'](_0x91a00[_0x97d0('0x5c')],[_0x97d0('0x9d'),_0x97d0('0x9e'),'createdAt',_0x97d0('0x9f'),'TrunkId',_0x97d0('0xa0')])),{'transaction':_0x39e845});});});})[_0x97d0('0x36')](function(){return db[_0x97d0('0x41')][_0x97d0('0xa1')](_0x91a00[_0x97d0('0x5c')]['id']);})[_0x97d0('0x36')](respondWithResult(_0x5722ad,null))[_0x97d0('0x29')](handleError(_0x5722ad,null));};exports['getMessages']=function(_0x1a6b00,_0x13c331,_0x1ee58b){var _0x2aa240={'raw':!![],'where':{}};var _0x523ae3={};var _0x48cfe8={'count':0x0,'rows':[]};return db[_0x97d0('0x41')]['findOne']({'where':{'id':_0x1a6b00[_0x97d0('0x57')]['id']}})[_0x97d0('0x36')](handleEntityNotFound(_0x13c331,null))['then'](function(_0x1db1ee){if(_0x1db1ee){_0x523ae3['model']=_['keys'](db[_0x97d0('0xa2')][_0x97d0('0x58')]);_0x523ae3[_0x97d0('0x43')]=_[_0x97d0('0x44')](_0x1a6b00[_0x97d0('0x43')]);_0x523ae3['filters']=_['intersection'](_0x523ae3[_0x97d0('0x42')],_0x523ae3[_0x97d0('0x43')]);_0x2aa240[_0x97d0('0x47')]=_['intersection'](_0x523ae3[_0x97d0('0x42')],qs['fields'](_0x1a6b00[_0x97d0('0x43')]['fields']));_0x2aa240[_0x97d0('0x47')]=_0x2aa240[_0x97d0('0x47')][_0x97d0('0x59')]?_0x2aa240[_0x97d0('0x47')]:_0x523ae3['model'];if(!_0x1a6b00[_0x97d0('0x43')][_0x97d0('0x49')](_0x97d0('0x6f'))){_0x2aa240[_0x97d0('0x2e')]=qs[_0x97d0('0x2e')](_0x1a6b00['query'][_0x97d0('0x2e')]);_0x2aa240['offset']=qs[_0x97d0('0x30')](_0x1a6b00[_0x97d0('0x43')][_0x97d0('0x30')]);}_0x2aa240[_0x97d0('0x4a')]=qs['sort'](_0x1a6b00['query'][_0x97d0('0x69')]);_0x2aa240['where']=qs[_0x97d0('0x45')](_[_0x97d0('0x4c')](_0x1a6b00['query'],_0x523ae3[_0x97d0('0x45')]));_0x2aa240[_0x97d0('0x4b')][_0x97d0('0x6d')]=_0x1db1ee['id'];if(_0x1a6b00[_0x97d0('0x43')][_0x97d0('0x50')]){_0x2aa240['where']=_['merge'](_0x2aa240[_0x97d0('0x4b')],{'$or':_[_0x97d0('0x40')](_0x2aa240[_0x97d0('0x47')],function(_0x2d424e){var _0x15efbc={};_0x15efbc[_0x2d424e]={'$like':'%'+_0x1a6b00['query'][_0x97d0('0x50')]+'%'};return _0x15efbc;})});}if(_0x1a6b00[_0x97d0('0x43')][_0x97d0('0xa3')]){var _0x5d2b3c=_0x1a6b00[_0x97d0('0x43')]['$gte'][_0x97d0('0xa4')](',');var _0x38738e={};_0x38738e[_0x5d2b3c[0x0]]={'$gte':moment(_0x5d2b3c[0x1])[_0x97d0('0xa5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2aa240['where']=_[_0x97d0('0x4d')](_0x2aa240[_0x97d0('0x4b')],_0x38738e);}_0x2aa240=_['merge']({},_0x2aa240,_0x1a6b00[_0x97d0('0x51')]);return db[_0x97d0('0xa2')][_0x97d0('0x2f')]({'where':_0x2aa240[_0x97d0('0x4b')]})['then'](function(_0x5a7d5f){_0x48cfe8[_0x97d0('0x2f')]=_0x5a7d5f;if(_0x1a6b00['query'][_0x97d0('0x52')]){_0x2aa240[_0x97d0('0x53')]=[{'all':!![]}];}return db[_0x97d0('0xa2')][_0x97d0('0x54')](_0x2aa240);})[_0x97d0('0x36')](function(_0x4b8d8a){_0x48cfe8[_0x97d0('0x55')]=_0x4b8d8a;return _0x48cfe8;});}})[_0x97d0('0x36')](respondWithFilteredResult(_0x13c331,_0x2aa240))['catch'](handleError(_0x13c331,null));};exports[_0x97d0('0x83')]=function(_0x3f4910,_0x27333e,_0x250412){var _0x382a75,_0x4fef53={},_0xa94e51;if(_0x3f4910['body']['to']){_0xa94e51=_0x3f4910[_0x97d0('0x5c')]['to'][0x0];}return db[_0x97d0('0x41')]['find']({'where':{'id':_0x3f4910['params']['id']},'include':[{'model':db[_0x97d0('0xa6')],'as':_0x97d0('0xa7'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0xa94e51},'limit':0x1,'order':[['updatedAt',_0x97d0('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x27333e,null))[_0x97d0('0x36')](function(_0x162fe9){_0x382a75=_0x162fe9;if(_0x3f4910[_0x97d0('0x5c')][_0x97d0('0xa9')]&&_0x3f4910[_0x97d0('0x5c')][_0x97d0('0xa9')][_0x97d0('0x59')]){for(var _0x386370=0x0;_0x386370<_0x3f4910['body']['attachments'][_0x97d0('0x59')];_0x386370+=0x1){_0x3f4910[_0x97d0('0x5c')][_0x97d0('0xa9')][_0x386370]={'filename':_0x3f4910[_0x97d0('0x5c')][_0x97d0('0xa9')][_0x386370][_0x97d0('0x3c')],'id':_0x3f4910[_0x97d0('0x5c')][_0x97d0('0xa9')][_0x386370]['id'],'path':path['join'](config[_0x97d0('0xaa')],'server/files/attachments',_0x3f4910[_0x97d0('0x5c')][_0x97d0('0xa9')][_0x386370][_0x97d0('0xab')])};}}return respondWithRpcPromise(_0x97d0('0xac'),'CheckAfterSend',{'FaxAccountId':_[_0x97d0('0xad')](_0x3f4910[_0x97d0('0x57')]['id'])?undefined:_0x3f4910[_0x97d0('0x57')]['id'],'path':_[_0x97d0('0xad')](_0x3f4910[_0x97d0('0x5c')][_0x97d0('0xa9')][0x0]['path'])?undefined:_0x3f4910['body'][_0x97d0('0xa9')][0x0][_0x97d0('0x6')],'fax':_[_0x97d0('0xad')](_0x3f4910[_0x97d0('0x5c')]['to'][0x0])?undefined:_0x3f4910[_0x97d0('0x5c')]['to'][0x0]},client9002);})[_0x97d0('0x36')](function(){if(_0x382a75){if(_[_0x97d0('0xad')](_0x3f4910['body']['from'])){_0x3f4910[_0x97d0('0x5c')][_0x97d0('0xae')]=util[_0x97d0('0xa5')](_0x97d0('0xaf'),_0x382a75[_0x97d0('0x3c')],_0x382a75['fax']);}if(_0x382a75[_0x97d0('0xa7')]){if(_0x382a75['List'][_0x97d0('0xb0')]['length']){return _0x382a75[_0x97d0('0xa7')][_0x97d0('0xb0')][0x0];}else{return db['CmContact'][_0x97d0('0x5b')](_['defaults'](_0x3f4910[_0x97d0('0x5c')],{'firstName':_0x3f4910[_0x97d0('0x5c')]['to'][0x0],'phone':_0x3f4910['body']['to'][0x0],'fax':_0x3f4910[_0x97d0('0x5c')]['to'][0x0],'ListId':_0x382a75[_0x97d0('0xa0')]}));}}else{throw new Error(_0x97d0('0xb1'));}}else{throw new Error(_0x97d0('0xb2'));}})[_0x97d0('0x36')](function(_0x2cc6a0){if(_0x2cc6a0){return db[_0x97d0('0x73')][_0x97d0('0x5a')]({'where':{'ContactId':_0x2cc6a0['id'],'closed':![],'FaxAccountId':_0x382a75['id']}})[_0x97d0('0x36')](function(_0x1a7f4){if(_0x1a7f4){return[_0x1a7f4,![]];}return db[_0x97d0('0x73')][_0x97d0('0x5b')]({'UserId':_0x3f4910[_0x97d0('0x5e')]['id'],'ContactId':_0x2cc6a0['id'],'FaxAccountId':_0x382a75['id'],'fax':_0x3f4910[_0x97d0('0x5c')]['to'][0x0],'firstMsgDirection':_0x97d0('0xb3'),'Messages':[_[_0x97d0('0x4d')](_0x3f4910[_0x97d0('0x5c')],{'read':![],'body':_0x3f4910[_0x97d0('0x5c')][_0x97d0('0xa9')][0x0]['filename'],'FaxAccountId':_0x382a75['id'],'UserId':_0x3f4910[_0x97d0('0x5e')]['id'],'ContactId':_0x2cc6a0['id'],'AttachmentId':_0x3f4910[_0x97d0('0x5c')][_0x97d0('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0x97d0('0xa2')],'as':_0x97d0('0xb4')}]})[_0x97d0('0x36')](function(_0x4ef94d){return[_0x4ef94d,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x97d0('0xb5')](function(_0x259b76,_0x5859f5){if(_0x5859f5){return _0x259b76;}return db[_0x97d0('0xa2')]['create']({'direction':'out','read':![],'body':_0x3f4910['body'][_0x97d0('0xa9')][0x0]['filename'],'FaxAccountId':_0x382a75['id'],'FaxInteractionId':_0x259b76['id'],'UserId':_0x3f4910[_0x97d0('0x5e')]['id'],'ContactId':_0x259b76[_0x97d0('0xb6')],'AttachmentId':_0x3f4910[_0x97d0('0x5c')][_0x97d0('0xa9')][0x0]['id']})[_0x97d0('0x36')](function(_0x559ae6){_0x259b76[_0x97d0('0xb7')][_0x97d0('0xb4')]=[];_0x259b76[_0x97d0('0xb7')][_0x97d0('0xb4')][_0x97d0('0x8c')](_0x559ae6[_0x97d0('0xb7')]);return _0x259b76;});})[_0x97d0('0x36')](function(_0x49eed7){respondWithRpcPromise(_0x97d0('0xb8'),_0x97d0('0xb8'),{'FaxAccountId':_[_0x97d0('0xad')](_0x3f4910[_0x97d0('0x57')]['id'])?undefined:_0x3f4910[_0x97d0('0x57')]['id'],'path':_['isNil'](_0x3f4910[_0x97d0('0x5c')]['attachments'][0x0][_0x97d0('0x6')])?undefined:_0x3f4910[_0x97d0('0x5c')][_0x97d0('0xa9')][0x0]['path'],'fax':_[_0x97d0('0xad')](_0x3f4910[_0x97d0('0x5c')]['to'][0x0])?undefined:_0x3f4910[_0x97d0('0x5c')]['to'][0x0],'AttachmentId':_0x3f4910[_0x97d0('0x5c')][_0x97d0('0xa9')][0x0]['id']},client9002)[_0x97d0('0x36')](function(_0x3cb550){logger[_0x97d0('0x1f')](_0x97d0('0xb9'),_0x3cb550);})[_0x97d0('0x29')](function(_0x32c43c){logger[_0x97d0('0x1f')]('SendFaxRpc,\x20%s',_0x32c43c);});return _0x49eed7;})[_0x97d0('0x36')](respondWithResult(_0x27333e,null))[_0x97d0('0x29')](handleError(_0x27333e,null));};exports[_0x97d0('0xba')]=function(_0x1ca241,_0x803bd2,_0x46fe72){return db[_0x97d0('0x41')][_0x97d0('0x5a')]({'where':{'id':_0x1ca241[_0x97d0('0x57')]['id']}})[_0x97d0('0x36')](handleEntityNotFound(_0x803bd2,null))[_0x97d0('0x36')](function(_0x3ab8cf){if(_0x3ab8cf){return _0x3ab8cf['addAgents'](_0x1ca241[_0x97d0('0x5c')][_0x97d0('0x6b')],_[_0x97d0('0x74')](_0x1ca241[_0x97d0('0x5c')],[_0x97d0('0x6b'),'id'])||{})[_0x97d0('0xb5')](function(_0x48c328){for(var _0x3385f7=0x0;_0x3385f7<_0x1ca241['body']['ids'][_0x97d0('0x59')];_0x3385f7+=0x1){socket[_0x97d0('0xbb')](_0x97d0('0xbc'),{'UserId':Number(_0x1ca241[_0x97d0('0x5c')]['ids'][_0x3385f7]),'FaxAccountId':Number(_0x1ca241[_0x97d0('0x57')]['id'])});}return _0x48c328;});}})['then'](respondWithResult(_0x803bd2,null))['catch'](handleError(_0x803bd2,null));};exports[_0x97d0('0xbd')]=function(_0x31bf2e,_0x16e305,_0x1725e3){return db[_0x97d0('0x41')]['find']({'where':{'id':_0x31bf2e['params']['id']}})[_0x97d0('0x36')](handleEntityNotFound(_0x16e305,null))[_0x97d0('0x36')](function(_0x12bb0a){if(_0x12bb0a){return _0x12bb0a[_0x97d0('0xbd')](_0x31bf2e['query'][_0x97d0('0x6b')])[_0x97d0('0x36')](function(){if(_[_0x97d0('0xbe')](_0x31bf2e[_0x97d0('0x43')][_0x97d0('0x6b')])){for(var _0xd4dc83=0x0;_0xd4dc83<_0x31bf2e[_0x97d0('0x43')][_0x97d0('0x6b')][_0x97d0('0x59')];_0xd4dc83+=0x1){socket[_0x97d0('0xbb')](_0x97d0('0xbf'),{'UserId':Number(_0x31bf2e[_0x97d0('0x43')][_0x97d0('0x6b')][_0xd4dc83]),'FaxAccountId':Number(_0x31bf2e[_0x97d0('0x57')]['id'])});}}else{socket[_0x97d0('0xbb')](_0x97d0('0xbf'),{'UserId':Number(_0x31bf2e['query'][_0x97d0('0x6b')]),'FaxAccountId':Number(_0x31bf2e[_0x97d0('0x57')]['id'])});}});}})[_0x97d0('0x36')](respondWithStatusCode(_0x16e305,null))[_0x97d0('0x29')](handleError(_0x16e305,null));};exports[_0x97d0('0xc0')]=function(_0x38ba4b,_0x36b814,_0x38fcf0){var _0x3489aa={};var _0x3e32d3={};var _0x53b41e;var _0x5416b5;return db['FaxAccount'][_0x97d0('0x68')]({'where':{'id':_0x38ba4b[_0x97d0('0x57')]['id']}})['then'](handleEntityNotFound(_0x36b814,null))[_0x97d0('0x36')](function(_0xf09def){if(_0xf09def){_0x53b41e=_0xf09def;_0x3e32d3[_0x97d0('0x42')]=_[_0x97d0('0x44')](db[_0x97d0('0xc1')][_0x97d0('0x58')]);_0x3e32d3['query']=_['keys'](_0x38ba4b[_0x97d0('0x43')]);_0x3e32d3[_0x97d0('0x45')]=_[_0x97d0('0x46')](_0x3e32d3[_0x97d0('0x42')],_0x3e32d3[_0x97d0('0x43')]);_0x3489aa[_0x97d0('0x47')]=_[_0x97d0('0x46')](_0x3e32d3[_0x97d0('0x42')],qs[_0x97d0('0x48')](_0x38ba4b['query'][_0x97d0('0x48')]));_0x3489aa[_0x97d0('0x47')]=_0x3489aa[_0x97d0('0x47')][_0x97d0('0x59')]?_0x3489aa['attributes']:_0x3e32d3['model'];_0x3489aa['order']=qs['sort'](_0x38ba4b[_0x97d0('0x43')]['sort']);_0x3489aa[_0x97d0('0x4b')]=qs[_0x97d0('0x45')](_[_0x97d0('0x4c')](_0x38ba4b[_0x97d0('0x43')],_0x3e32d3[_0x97d0('0x45')]));if(_0x38ba4b[_0x97d0('0x43')][_0x97d0('0x50')]){_0x3489aa['where']=_['merge'](_0x3489aa['where'],{'$or':_['map'](_0x3489aa[_0x97d0('0x47')],function(_0x4bcb72){var _0x2b7100={};_0x2b7100[_0x4bcb72]={'$like':'%'+_0x38ba4b[_0x97d0('0x43')]['filter']+'%'};return _0x2b7100;})});}_0x3489aa=_[_0x97d0('0x4d')]({},_0x3489aa,_0x38ba4b[_0x97d0('0x51')]);return _0x53b41e['getAgents'](_0x3489aa);}})[_0x97d0('0x36')](function(_0x2be2a2){if(_0x2be2a2){_0x5416b5=_0x2be2a2[_0x97d0('0x59')];if(!_0x38ba4b[_0x97d0('0x43')][_0x97d0('0x49')](_0x97d0('0x6f'))){_0x3489aa[_0x97d0('0x2e')]=qs[_0x97d0('0x2e')](_0x38ba4b[_0x97d0('0x43')][_0x97d0('0x2e')]);_0x3489aa[_0x97d0('0x30')]=qs[_0x97d0('0x30')](_0x38ba4b[_0x97d0('0x43')][_0x97d0('0x30')]);}return _0x53b41e[_0x97d0('0xc0')](_0x3489aa);}})[_0x97d0('0x36')](function(_0x5f456a){if(_0x5f456a){return _0x5f456a?{'count':_0x5416b5,'rows':_0x5f456a}:null;}})['then'](respondWithResult(_0x36b814,null))['catch'](handleError(_0x36b814,null));}; \ No newline at end of file +var _0x04c1=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','json','offset','limit','count','status','set','Content-Range','apply','save','get','FaxAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','type','filter','options','include','findAll','rows','params','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','CannedAnswer','getAnswers','order','removeAnswers','ids','omit','getInteractions','FaxInteraction','CmContact','Owner','fullname','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','exten','localstationid','system','push','Answer','Set','ecm','gateway','faxdetect','minrate','modem','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','update','VoiceExtension','tech','key','createdAt','TrunkId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','updatedAt','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','path','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x04c1,0xc2));var _0x104c=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x04c1[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x104c('0x0'));var zipdir=require(_0x104c('0x1'));var jsonpatch=require(_0x104c('0x2'));var rp=require('request-promise');var moment=require(_0x104c('0x3'));var BPromise=require(_0x104c('0x4'));var Mustache=require(_0x104c('0x5'));var util=require(_0x104c('0x6'));var path=require('path');var sox=require(_0x104c('0x7'));var csv=require('to-csv');var ejs=require(_0x104c('0x8'));var fs=require('fs');var fs_extra=require(_0x104c('0x9'));var _=require('lodash');var squel=require(_0x104c('0xa'));var crypto=require(_0x104c('0xb'));var jsforce=require(_0x104c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x104c('0xd'));var querystring=require(_0x104c('0xe'));var Papa=require(_0x104c('0xf'));var Redis=require(_0x104c('0x10'));var authService=require(_0x104c('0x11'));var qs=require(_0x104c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x104c('0x13'))(_0x104c('0x14'));var utils=require('../../config/utils');var config=require(_0x104c('0x15'));var licenseUtil=require(_0x104c('0x16'));var db=require(_0x104c('0x17'))['db'];config[_0x104c('0x18')]=_[_0x104c('0x19')](config[_0x104c('0x18')],{'host':_0x104c('0x1a'),'port':0x18eb});var socket=require(_0x104c('0x1b'))(new Redis(config[_0x104c('0x18')]));require('./faxAccount.socket')[_0x104c('0x1c')](socket);var jayson=require(_0x104c('0x1d'));var client=jayson[_0x104c('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x104c('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59e861,_0x7e37dd,_0x35e02d,_0x1318c1){return new BPromise(function(_0x418099,_0x2fbb1d){var _0x45ab44=_0x1318c1||client;return _0x45ab44[_0x104c('0x1f')](_0x59e861,_0x35e02d)[_0x104c('0x20')](function(_0x3a1c6c){logger[_0x104c('0x21')](_0x104c('0x22'),_0x7e37dd,_0x104c('0x23'));logger['debug'](_0x104c('0x24'),_0x7e37dd,_0x104c('0x23'),JSON[_0x104c('0x25')](_0x3a1c6c));if(_0x3a1c6c[_0x104c('0x26')]){if(_0x3a1c6c[_0x104c('0x26')][_0x104c('0x27')]===0x1f4){logger[_0x104c('0x26')]('FaxAccount,\x20%s,\x20%s',_0x7e37dd,_0x3a1c6c[_0x104c('0x26')][_0x104c('0x28')]);return _0x2fbb1d(_0x3a1c6c[_0x104c('0x26')][_0x104c('0x28')]);}logger[_0x104c('0x26')](_0x104c('0x22'),_0x7e37dd,_0x3a1c6c[_0x104c('0x26')]['message']);return _0x418099(_0x3a1c6c[_0x104c('0x26')][_0x104c('0x28')]);}else{logger[_0x104c('0x21')](_0x104c('0x22'),_0x7e37dd,_0x104c('0x23'));_0x418099(_0x3a1c6c['result']['message']);}})[_0x104c('0x29')](function(_0x220529){logger[_0x104c('0x26')]('FaxAccount,\x20%s,\x20%s',_0x7e37dd,_0x220529);_0x2fbb1d(_0x220529);});});}function respondWithStatusCode(_0x1ea889,_0x5798a9){_0x5798a9=_0x5798a9||0xcc;return function(_0x6b7944){if(_0x6b7944){return _0x1ea889[_0x104c('0x2a')](_0x5798a9);}return _0x1ea889['status'](_0x5798a9)[_0x104c('0x2b')]();};}function respondWithResult(_0x2bac12,_0x5aaa9f){_0x5aaa9f=_0x5aaa9f||0xc8;return function(_0x1943e5){if(_0x1943e5){return _0x2bac12['status'](_0x5aaa9f)[_0x104c('0x2c')](_0x1943e5);}};}function respondWithFilteredResult(_0x240212,_0x18fb6e){return function(_0x3121a6){if(_0x3121a6){var _0x445704=typeof _0x18fb6e[_0x104c('0x2d')]==='undefined'&&typeof _0x18fb6e[_0x104c('0x2e')]==='undefined';var _0x37d004=_0x3121a6[_0x104c('0x2f')];var _0x568f92=_0x445704?0x0:_0x18fb6e[_0x104c('0x2d')];var _0xd56d71=_0x445704?_0x3121a6[_0x104c('0x2f')]:_0x18fb6e[_0x104c('0x2d')]+_0x18fb6e[_0x104c('0x2e')];var _0x2b159f;if(_0xd56d71>=_0x37d004){_0xd56d71=_0x37d004;_0x2b159f=0xc8;}else{_0x2b159f=0xce;}_0x240212[_0x104c('0x30')](_0x2b159f);return _0x240212[_0x104c('0x31')](_0x104c('0x32'),_0x568f92+'-'+_0xd56d71+'/'+_0x37d004)[_0x104c('0x2c')](_0x3121a6);}return null;};}function patchUpdates(_0x60b7e0){return function(_0x2e1c07){try{jsonpatch[_0x104c('0x33')](_0x2e1c07,_0x60b7e0,!![]);}catch(_0x2a8e52){return BPromise['reject'](_0x2a8e52);}return _0x2e1c07[_0x104c('0x34')]();};}function saveUpdates(_0x2871af,_0x1fe6a4){return function(_0x394984){if(_0x394984){return _0x394984['update'](_0x2871af)[_0x104c('0x20')](function(_0x41734b){return _0x41734b;});}return null;};}function removeEntity(_0x401c52,_0x28b6fe){return function(_0x3c5cd1){if(_0x3c5cd1){return _0x3c5cd1['destroy']()['then'](function(){var _0x21742c=_0x3c5cd1[_0x104c('0x35')]({'plain':!![]});var _0x55ffae=_0x104c('0x36');return db[_0x104c('0x37')][_0x104c('0x38')]({'where':{'type':_0x55ffae,'resourceId':_0x21742c['id']}})[_0x104c('0x20')](function(){return _0x3c5cd1;});})[_0x104c('0x20')](function(){_0x401c52[_0x104c('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45cbc0,_0x41015b){return function(_0x20128d){if(!_0x20128d){_0x45cbc0['sendStatus'](0x194);}return _0x20128d;};}function handleError(_0x82f673,_0x2068d2){_0x2068d2=_0x2068d2||0x1f4;return function(_0x2f9db7){logger[_0x104c('0x26')](_0x2f9db7[_0x104c('0x39')]);if(_0x2f9db7[_0x104c('0x3a')]){delete _0x2f9db7[_0x104c('0x3a')];}_0x82f673[_0x104c('0x30')](_0x2068d2)[_0x104c('0x3b')](_0x2f9db7);};}exports[_0x104c('0x3c')]=function(_0x1ffe78,_0x230435){var _0x2b6ea5={'include':[{'model':db[_0x104c('0x3d')],'as':_0x104c('0x3e')}]},_0x230b68={},_0x27af95={'count':0x0,'rows':[]};var _0x4cba3d=_[_0x104c('0x3f')](db[_0x104c('0x40')][_0x104c('0x41')],function(_0x65c434){return{'name':_0x65c434[_0x104c('0x42')],'type':_0x65c434['type']['key']};});_0x230b68['model']=_['map'](_0x4cba3d,'name');_0x230b68[_0x104c('0x43')]=_[_0x104c('0x44')](_0x1ffe78[_0x104c('0x43')]);_0x230b68['filters']=_[_0x104c('0x45')](_0x230b68[_0x104c('0x46')],_0x230b68['query']);_0x2b6ea5[_0x104c('0x47')]=_[_0x104c('0x45')](_0x230b68[_0x104c('0x46')],qs['fields'](_0x1ffe78['query'][_0x104c('0x48')]));_0x2b6ea5[_0x104c('0x47')]=_0x2b6ea5[_0x104c('0x47')][_0x104c('0x49')]?_0x2b6ea5[_0x104c('0x47')]:_0x230b68[_0x104c('0x46')];if(!_0x1ffe78['query'][_0x104c('0x4a')]('nolimit')){_0x2b6ea5[_0x104c('0x2e')]=qs[_0x104c('0x2e')](_0x1ffe78['query'][_0x104c('0x2e')]);_0x2b6ea5[_0x104c('0x2d')]=qs[_0x104c('0x2d')](_0x1ffe78[_0x104c('0x43')]['offset']);}_0x2b6ea5['order']=qs[_0x104c('0x4b')](_0x1ffe78['query']['sort']);_0x2b6ea5[_0x104c('0x4c')]=qs[_0x104c('0x4d')](_[_0x104c('0x4e')](_0x1ffe78['query'],_0x230b68[_0x104c('0x4d')]),_0x4cba3d);if(_0x1ffe78['query']['filter']){_0x2b6ea5['where']=_[_0x104c('0x4f')](_0x2b6ea5[_0x104c('0x4c')],{'$or':_[_0x104c('0x3f')](_0x4cba3d,function(_0x1c2065){if(_0x1c2065[_0x104c('0x50')]!=='VIRTUAL'){var _0x39cf85={};_0x39cf85[_0x1c2065[_0x104c('0x3a')]]={'$like':'%'+_0x1ffe78[_0x104c('0x43')][_0x104c('0x51')]+'%'};return _0x39cf85;}})});}_0x2b6ea5=_[_0x104c('0x4f')]({},_0x2b6ea5,_0x1ffe78[_0x104c('0x52')]);var _0x4bef4a={'where':_0x2b6ea5['where']};return db[_0x104c('0x40')]['count'](_0x4bef4a)['then'](function(_0x4763ed){_0x27af95[_0x104c('0x2f')]=_0x4763ed;if(_0x1ffe78[_0x104c('0x43')]['includeAll']){_0x2b6ea5[_0x104c('0x53')]=[{'all':!![]}];}return db[_0x104c('0x40')][_0x104c('0x54')](_0x2b6ea5);})['then'](function(_0x241c82){_0x27af95[_0x104c('0x55')]=_0x241c82;return _0x27af95;})[_0x104c('0x20')](respondWithFilteredResult(_0x230435,_0x2b6ea5))['catch'](handleError(_0x230435,null));};exports['show']=function(_0x8a99a7,_0x1f6b30){var _0xdedf64={'raw':![],'where':{'id':_0x8a99a7[_0x104c('0x56')]['id']},'include':[{'model':db[_0x104c('0x3d')],'as':_0x104c('0x3e')}]},_0x3a84a6={};_0x3a84a6[_0x104c('0x46')]=_['keys'](db[_0x104c('0x40')][_0x104c('0x41')]);_0x3a84a6['query']=_[_0x104c('0x44')](_0x8a99a7[_0x104c('0x43')]);_0x3a84a6[_0x104c('0x4d')]=_[_0x104c('0x45')](_0x3a84a6[_0x104c('0x46')],_0x3a84a6['query']);_0xdedf64[_0x104c('0x47')]=_[_0x104c('0x45')](_0x3a84a6['model'],qs[_0x104c('0x48')](_0x8a99a7['query'][_0x104c('0x48')]));_0xdedf64['attributes']=_0xdedf64[_0x104c('0x47')]['length']?_0xdedf64[_0x104c('0x47')]:_0x3a84a6['model'];if(_0x8a99a7[_0x104c('0x43')][_0x104c('0x57')]){_0xdedf64['include']=[{'all':!![]}];}_0xdedf64=_[_0x104c('0x4f')]({},_0xdedf64,_0x8a99a7[_0x104c('0x52')]);return db[_0x104c('0x40')]['find'](_0xdedf64)[_0x104c('0x20')](handleEntityNotFound(_0x1f6b30,null))[_0x104c('0x20')](respondWithResult(_0x1f6b30,null))[_0x104c('0x29')](handleError(_0x1f6b30,null));};exports[_0x104c('0x58')]=function(_0x9b5b,_0x4af673){return db['FaxAccount'][_0x104c('0x58')](_0x9b5b[_0x104c('0x59')],{})[_0x104c('0x20')](function(_0x4f05d9){var _0x417e8a=_0x9b5b['user'][_0x104c('0x35')]({'plain':!![]});if(!_0x417e8a)throw new Error(_0x104c('0x5a'));if(_0x417e8a[_0x104c('0x5b')]===_0x104c('0x5c')){var _0x4f9b8e=_0x4f05d9[_0x104c('0x35')]({'plain':!![]});var _0x3294fd=_0x104c('0x36');return db[_0x104c('0x5d')][_0x104c('0x5e')]({'where':{'name':_0x3294fd,'userProfileId':_0x417e8a[_0x104c('0x5f')]},'raw':!![]})[_0x104c('0x20')](function(_0xafc2ca){if(_0xafc2ca&&_0xafc2ca[_0x104c('0x60')]===0x0){return db[_0x104c('0x37')]['create']({'name':_0x4f9b8e[_0x104c('0x3a')],'resourceId':_0x4f9b8e['id'],'type':_0xafc2ca[_0x104c('0x3a')],'sectionId':_0xafc2ca['id']},{})[_0x104c('0x20')](function(){return _0x4f05d9;});}else{return _0x4f05d9;}})['catch'](function(_0x49af07){logger[_0x104c('0x26')](_0x104c('0x61'),_0x49af07);throw _0x49af07;});}return _0x4f05d9;})[_0x104c('0x20')](respondWithResult(_0x4af673,0xc9))[_0x104c('0x29')](handleError(_0x4af673,null));};exports['update']=function(_0x3a2aac,_0x54b669){if(_0x3a2aac[_0x104c('0x59')]['id']){delete _0x3a2aac[_0x104c('0x59')]['id'];}return db['FaxAccount'][_0x104c('0x5e')]({'where':{'id':_0x3a2aac[_0x104c('0x56')]['id']},'include':[{'model':db[_0x104c('0x3d')],'as':_0x104c('0x3e')}]})[_0x104c('0x20')](handleEntityNotFound(_0x54b669,null))[_0x104c('0x20')](saveUpdates(_0x3a2aac['body'],null))[_0x104c('0x20')](respondWithResult(_0x54b669,null))[_0x104c('0x29')](handleError(_0x54b669,null));};exports['destroy']=function(_0x314dd1,_0x1803d9){return db['FaxAccount'][_0x104c('0x5e')]({'where':{'id':_0x314dd1['params']['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x1803d9,null))[_0x104c('0x20')](removeEntity(_0x1803d9,null))[_0x104c('0x29')](handleError(_0x1803d9,null));};exports[_0x104c('0x62')]=function(_0x4758b0,_0x34ec00){return db[_0x104c('0x40')]['describe']()[_0x104c('0x20')](respondWithResult(_0x34ec00,null))[_0x104c('0x29')](handleError(_0x34ec00,null));};exports['addDisposition']=function(_0x54a046,_0x437f70,_0x3926b2){if(_0x54a046[_0x104c('0x59')]['id']){delete _0x54a046[_0x104c('0x59')]['id'];}return db[_0x104c('0x40')]['find']({'where':{'id':_0x54a046[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x437f70,null))['then'](function(_0x4e9a24){if(_0x4e9a24){_0x54a046[_0x104c('0x59')][_0x104c('0x63')]=_0x4e9a24['id'];return db[_0x104c('0x64')][_0x104c('0x58')](_0x54a046[_0x104c('0x59')]);}})[_0x104c('0x20')](respondWithResult(_0x437f70,null))[_0x104c('0x29')](handleError(_0x437f70,null));};exports[_0x104c('0x65')]=function(_0x5dba25,_0x520f29,_0x52c2ab){var _0x150f9b={'raw':![],'where':{}};var _0x1cc80d={};var _0x5c26ec={'count':0x0,'rows':[]};return db[_0x104c('0x40')][_0x104c('0x66')]({'where':{'id':_0x5dba25[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x520f29,null))[_0x104c('0x20')](function(_0x1dbd43){if(_0x1dbd43){_0x1cc80d[_0x104c('0x46')]=_[_0x104c('0x44')](db['Disposition']['rawAttributes']);_0x1cc80d[_0x104c('0x43')]=_[_0x104c('0x44')](_0x5dba25[_0x104c('0x43')]);_0x1cc80d['filters']=_[_0x104c('0x45')](_0x1cc80d[_0x104c('0x46')],_0x1cc80d[_0x104c('0x43')]);_0x150f9b[_0x104c('0x47')]=_[_0x104c('0x45')](_0x1cc80d[_0x104c('0x46')],qs[_0x104c('0x48')](_0x5dba25[_0x104c('0x43')][_0x104c('0x48')]));_0x150f9b[_0x104c('0x47')]=_0x150f9b[_0x104c('0x47')]['length']?_0x150f9b[_0x104c('0x47')]:_0x1cc80d['model'];if(!_0x5dba25[_0x104c('0x43')][_0x104c('0x4a')](_0x104c('0x67'))){_0x150f9b['limit']=qs[_0x104c('0x2e')](_0x5dba25[_0x104c('0x43')][_0x104c('0x2e')]);_0x150f9b['offset']=qs[_0x104c('0x2d')](_0x5dba25[_0x104c('0x43')]['offset']);}_0x150f9b['order']=qs[_0x104c('0x4b')](_0x5dba25['query'][_0x104c('0x4b')]);_0x150f9b['where']=qs['filters'](_[_0x104c('0x4e')](_0x5dba25['query'],_0x1cc80d[_0x104c('0x4d')]));_0x150f9b[_0x104c('0x4c')][_0x104c('0x63')]=_0x1dbd43['id'];if(_0x5dba25[_0x104c('0x43')][_0x104c('0x51')]){_0x150f9b[_0x104c('0x4c')]=_[_0x104c('0x4f')](_0x150f9b['where'],{'$or':_[_0x104c('0x3f')](_0x150f9b[_0x104c('0x47')],function(_0x123812){var _0x3ea180={};_0x3ea180[_0x123812]={'$like':'%'+_0x5dba25[_0x104c('0x43')][_0x104c('0x51')]+'%'};return _0x3ea180;})});}_0x150f9b=_[_0x104c('0x4f')]({},_0x150f9b,_0x5dba25[_0x104c('0x52')]);return db[_0x104c('0x64')][_0x104c('0x2f')]({'where':_0x150f9b[_0x104c('0x4c')]})[_0x104c('0x20')](function(_0x31e0d2){_0x5c26ec['count']=_0x31e0d2;if(_0x5dba25[_0x104c('0x43')]['includeAll']){_0x150f9b[_0x104c('0x53')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x150f9b);})[_0x104c('0x20')](function(_0x186c55){_0x5c26ec['rows']=_0x186c55;return _0x5c26ec;});}})['then'](respondWithFilteredResult(_0x520f29,_0x150f9b))[_0x104c('0x29')](handleError(_0x520f29,null));};exports[_0x104c('0x68')]=function(_0x53d1e9,_0x1aa076,_0x884108){return db[_0x104c('0x40')][_0x104c('0x5e')]({'where':{'id':_0x53d1e9[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x1aa076,null))['then'](function(_0x3cdaf0){if(_0x3cdaf0){return _0x3cdaf0[_0x104c('0x68')](_0x53d1e9[_0x104c('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x1aa076,null))[_0x104c('0x29')](handleError(_0x1aa076,null));};exports['addAnswer']=function(_0x5e1c9e,_0x4ef3e6,_0x583854){if(_0x5e1c9e[_0x104c('0x59')]['id']){delete _0x5e1c9e[_0x104c('0x59')]['id'];}return db[_0x104c('0x40')]['find']({'where':{'id':_0x5e1c9e[_0x104c('0x56')]['id']}})['then'](handleEntityNotFound(_0x4ef3e6,null))[_0x104c('0x20')](function(_0x277ae7){if(_0x277ae7){_0x5e1c9e['body']['FaxAccountId']=_0x277ae7['id'];return db[_0x104c('0x69')]['create'](_0x5e1c9e[_0x104c('0x59')]);}})[_0x104c('0x20')](respondWithResult(_0x4ef3e6,null))['catch'](handleError(_0x4ef3e6,null));};exports[_0x104c('0x6a')]=function(_0xd901e0,_0x40fabb,_0x358614){var _0x5e2e03={'raw':![],'where':{}};var _0x5f1b96={};var _0x24fb0e={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0xd901e0[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x40fabb,null))[_0x104c('0x20')](function(_0x5f381b){if(_0x5f381b){_0x5f1b96[_0x104c('0x46')]=_['keys'](db[_0x104c('0x69')]['rawAttributes']);_0x5f1b96[_0x104c('0x43')]=_[_0x104c('0x44')](_0xd901e0[_0x104c('0x43')]);_0x5f1b96['filters']=_[_0x104c('0x45')](_0x5f1b96[_0x104c('0x46')],_0x5f1b96[_0x104c('0x43')]);_0x5e2e03['attributes']=_['intersection'](_0x5f1b96[_0x104c('0x46')],qs[_0x104c('0x48')](_0xd901e0[_0x104c('0x43')][_0x104c('0x48')]));_0x5e2e03['attributes']=_0x5e2e03[_0x104c('0x47')]['length']?_0x5e2e03[_0x104c('0x47')]:_0x5f1b96[_0x104c('0x46')];if(!_0xd901e0[_0x104c('0x43')][_0x104c('0x4a')](_0x104c('0x67'))){_0x5e2e03[_0x104c('0x2e')]=qs[_0x104c('0x2e')](_0xd901e0[_0x104c('0x43')][_0x104c('0x2e')]);_0x5e2e03[_0x104c('0x2d')]=qs[_0x104c('0x2d')](_0xd901e0[_0x104c('0x43')][_0x104c('0x2d')]);}_0x5e2e03[_0x104c('0x6b')]=qs[_0x104c('0x4b')](_0xd901e0[_0x104c('0x43')][_0x104c('0x4b')]);_0x5e2e03[_0x104c('0x4c')]=qs[_0x104c('0x4d')](_[_0x104c('0x4e')](_0xd901e0[_0x104c('0x43')],_0x5f1b96['filters']));_0x5e2e03[_0x104c('0x4c')][_0x104c('0x63')]=_0x5f381b['id'];if(_0xd901e0[_0x104c('0x43')][_0x104c('0x51')]){_0x5e2e03[_0x104c('0x4c')]=_[_0x104c('0x4f')](_0x5e2e03[_0x104c('0x4c')],{'$or':_[_0x104c('0x3f')](_0x5e2e03['attributes'],function(_0x2ea744){var _0x97005c={};_0x97005c[_0x2ea744]={'$like':'%'+_0xd901e0['query'][_0x104c('0x51')]+'%'};return _0x97005c;})});}_0x5e2e03=_[_0x104c('0x4f')]({},_0x5e2e03,_0xd901e0[_0x104c('0x52')]);return db[_0x104c('0x69')][_0x104c('0x2f')]({'where':_0x5e2e03['where']})[_0x104c('0x20')](function(_0x50c98a){_0x24fb0e['count']=_0x50c98a;if(_0xd901e0[_0x104c('0x43')][_0x104c('0x57')]){_0x5e2e03[_0x104c('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0x104c('0x54')](_0x5e2e03);})[_0x104c('0x20')](function(_0x1c8061){_0x24fb0e[_0x104c('0x55')]=_0x1c8061;return _0x24fb0e;});}})[_0x104c('0x20')](respondWithFilteredResult(_0x40fabb,_0x5e2e03))[_0x104c('0x29')](handleError(_0x40fabb,null));};exports['removeAnswers']=function(_0x5f44e6,_0x429275,_0x30bf1b){return db[_0x104c('0x40')][_0x104c('0x5e')]({'where':{'id':_0x5f44e6[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x429275,null))[_0x104c('0x20')](function(_0x97a36e){if(_0x97a36e){return _0x97a36e[_0x104c('0x6c')](_0x5f44e6['query'][_0x104c('0x6d')]);}})[_0x104c('0x20')](respondWithStatusCode(_0x429275,null))[_0x104c('0x29')](handleError(_0x429275,null));};exports['addInteraction']=function(_0xcefb85,_0x5a83c4,_0x1c77e5){return db['FaxInteraction'][_0x104c('0x5e')]({'where':{'id':_0xcefb85[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x5a83c4,null))[_0x104c('0x20')](function(_0x5aaa6){if(_0x5aaa6){return _0x5aaa6['addInteraction'](_0xcefb85['body'][_0x104c('0x6d')],_[_0x104c('0x6e')](_0xcefb85[_0x104c('0x59')],[_0x104c('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x5a83c4,null))['catch'](handleError(_0x5a83c4,null));};exports[_0x104c('0x6f')]=function(_0x1aa0ae,_0x1db299,_0x2d1a5e){var _0x93b84b={'raw':![],'where':{}};var _0x7b294b={};var _0x4f568f={'count':0x0,'rows':[]};return db['FaxAccount'][_0x104c('0x66')]({'where':{'id':_0x1aa0ae[_0x104c('0x56')]['id']}})['then'](handleEntityNotFound(_0x1db299,null))[_0x104c('0x20')](function(_0x1bcb01){if(_0x1bcb01){_0x7b294b[_0x104c('0x46')]=_[_0x104c('0x44')](db['FaxInteraction']['rawAttributes']);_0x7b294b[_0x104c('0x43')]=_[_0x104c('0x44')](_0x1aa0ae[_0x104c('0x43')]);_0x7b294b[_0x104c('0x4d')]=_[_0x104c('0x45')](_0x7b294b[_0x104c('0x46')],_0x7b294b['query']);_0x93b84b[_0x104c('0x47')]=_[_0x104c('0x45')](_0x7b294b[_0x104c('0x46')],qs['fields'](_0x1aa0ae['query']['fields']));_0x93b84b['attributes']=_0x93b84b[_0x104c('0x47')][_0x104c('0x49')]?_0x93b84b[_0x104c('0x47')]:_0x7b294b[_0x104c('0x46')];if(!_0x1aa0ae[_0x104c('0x43')]['hasOwnProperty'](_0x104c('0x67'))){_0x93b84b[_0x104c('0x2e')]=qs['limit'](_0x1aa0ae[_0x104c('0x43')][_0x104c('0x2e')]);_0x93b84b[_0x104c('0x2d')]=qs[_0x104c('0x2d')](_0x1aa0ae[_0x104c('0x43')][_0x104c('0x2d')]);}_0x93b84b[_0x104c('0x6b')]=qs[_0x104c('0x4b')](_0x1aa0ae[_0x104c('0x43')][_0x104c('0x4b')]);_0x93b84b['where']=qs[_0x104c('0x4d')](_[_0x104c('0x4e')](_0x1aa0ae[_0x104c('0x43')],_0x7b294b['filters']));_0x93b84b[_0x104c('0x4c')][_0x104c('0x63')]=_0x1bcb01['id'];if(_0x1aa0ae[_0x104c('0x43')]['filter']){_0x93b84b[_0x104c('0x4c')]=_[_0x104c('0x4f')](_0x93b84b[_0x104c('0x4c')],{'$or':_[_0x104c('0x3f')](_0x93b84b['attributes'],function(_0x22713b){var _0x5e5a2f={};_0x5e5a2f[_0x22713b]={'$like':'%'+_0x1aa0ae[_0x104c('0x43')][_0x104c('0x51')]+'%'};return _0x5e5a2f;})});}_0x93b84b=_[_0x104c('0x4f')]({},_0x93b84b,_0x1aa0ae[_0x104c('0x52')]);return db[_0x104c('0x70')][_0x104c('0x2f')]({'where':_0x93b84b[_0x104c('0x4c')]})[_0x104c('0x20')](function(_0x257cd8){_0x4f568f[_0x104c('0x2f')]=_0x257cd8;if(_0x1aa0ae[_0x104c('0x43')]['includeAll']){_0x93b84b[_0x104c('0x53')]=[{'model':db[_0x104c('0x71')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x104c('0x72'),'attributes':[_0x104c('0x3a'),_0x104c('0x73'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x104c('0x74'),'attributes':['id',_0x104c('0x3a'),_0x104c('0x75')],'where':_0x1aa0ae[_0x104c('0x43')][_0x104c('0x76')]?{'id':_0x1aa0ae[_0x104c('0x43')][_0x104c('0x76')]}:undefined,'required':_0x1aa0ae[_0x104c('0x43')][_0x104c('0x76')]?!![]:![]}];}return db['FaxInteraction'][_0x104c('0x54')](_0x93b84b);})[_0x104c('0x20')](function(_0x216154){_0x4f568f[_0x104c('0x55')]=_0x216154;return _0x4f568f;});}})[_0x104c('0x20')](respondWithFilteredResult(_0x1db299,_0x93b84b))[_0x104c('0x29')](handleError(_0x1db299,null));};exports[_0x104c('0x77')]=function(_0x2a3fc3,_0x4aef40){var _0x4fd504=_0x2a3fc3[_0x104c('0x56')]['id'];var _0x302b70=_0x2a3fc3[_0x104c('0x59')];var _0x20eb71=0xc8;var _0x16dcfa=null;return db[_0x104c('0x78')][_0x104c('0x79')]({'isolationLevel':db[_0x104c('0x78')][_0x104c('0x7a')][_0x104c('0x7b')][_0x104c('0x7c')]},function(_0x226c83){return db[_0x104c('0x40')][_0x104c('0x66')]({'where':{'id':_0x4fd504},'transaction':_0x226c83})[_0x104c('0x20')](function(_0x412b2f){if(_0x412b2f){return db['FaxApplication'][_0x104c('0x38')]({'where':{'FaxAccountId':_0x4fd504},'transaction':_0x226c83})['then'](function(){var _0x343189=_['map'](_0x302b70,function(_0x43b82b){_0x43b82b['FaxAccountId']=_0x4fd504;return _0x43b82b;});return db[_0x104c('0x7d')][_0x104c('0x7e')](_0x343189,{'transaction':_0x226c83});});}else{_0x20eb71=0x194;_0x16dcfa=[];}});})['then'](function(){if(_0x20eb71!==0x194){return db[_0x104c('0x7d')][_0x104c('0x7f')]({'where':{'FaxAccountId':_0x4fd504},'order':_0x104c('0x80')})['then'](function(_0x5cf3c0){_0x16dcfa=_0x5cf3c0;});}})[_0x104c('0x29')](function(_0x1ab46e){_0x20eb71=0x1f4;logger[_0x104c('0x26')](_0x1ab46e[_0x104c('0x39')]);if(_0x1ab46e[_0x104c('0x3a')]){delete _0x1ab46e['name'];}_0x16dcfa=_0x1ab46e;})[_0x104c('0x81')](function(){if(_0x16dcfa===null){_0x4aef40['sendStatus'](_0x20eb71);}else{if(_0x20eb71===0x1f4){_0x4aef40[_0x104c('0x30')](_0x20eb71)['send'](_0x16dcfa);}else{_0x4aef40[_0x104c('0x30')](_0x20eb71)['json'](_0x16dcfa);}}});};exports[_0x104c('0x82')]=function(_0x462d23,_0xf9d249,_0x31712c){var _0x3af778={};var _0x153331={};var _0x19ba6c;var _0x4c70b9;return db[_0x104c('0x40')][_0x104c('0x66')]({'where':{'id':_0x462d23[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0xf9d249,null))[_0x104c('0x20')](function(_0x375661){if(_0x375661){_0x19ba6c=_0x375661;_0x153331[_0x104c('0x46')]=_[_0x104c('0x44')](db[_0x104c('0x7d')]['rawAttributes']);_0x153331[_0x104c('0x43')]=_[_0x104c('0x44')](_0x462d23[_0x104c('0x43')]);_0x153331['filters']=_[_0x104c('0x45')](_0x153331[_0x104c('0x46')],_0x153331['query']);_0x3af778[_0x104c('0x47')]=_[_0x104c('0x45')](_0x153331[_0x104c('0x46')],qs[_0x104c('0x48')](_0x462d23[_0x104c('0x43')]['fields']));_0x3af778[_0x104c('0x47')]=_0x3af778[_0x104c('0x47')][_0x104c('0x49')]?_0x3af778[_0x104c('0x47')]:_0x153331[_0x104c('0x46')];_0x3af778['order']=qs[_0x104c('0x4b')](_0x462d23[_0x104c('0x43')][_0x104c('0x4b')]);_0x3af778[_0x104c('0x4c')]=qs['filters'](_[_0x104c('0x4e')](_0x462d23[_0x104c('0x43')],_0x153331['filters']));if(_0x462d23[_0x104c('0x43')][_0x104c('0x51')]){_0x3af778[_0x104c('0x4c')]=_['merge'](_0x3af778[_0x104c('0x4c')],{'$or':_[_0x104c('0x3f')](_0x3af778[_0x104c('0x47')],function(_0x10f79b){var _0x1dbcb3={};_0x1dbcb3[_0x10f79b]={'$like':'%'+_0x462d23[_0x104c('0x43')][_0x104c('0x51')]+'%'};return _0x1dbcb3;})});}_0x3af778=_[_0x104c('0x4f')]({},_0x3af778,_0x462d23['options']);return _0x19ba6c['getApplications'](_0x3af778);}})[_0x104c('0x20')](function(_0x462dd5){if(_0x462dd5){_0x4c70b9=_0x462dd5[_0x104c('0x49')];if(!_0x462d23[_0x104c('0x43')]['hasOwnProperty'](_0x104c('0x67'))){_0x3af778['limit']=qs[_0x104c('0x2e')](_0x462d23['query'][_0x104c('0x2e')]);_0x3af778[_0x104c('0x2d')]=qs['offset'](_0x462d23[_0x104c('0x43')][_0x104c('0x2d')]);}return _0x19ba6c[_0x104c('0x82')](_0x3af778);}})[_0x104c('0x20')](function(_0xc479ea){if(_0xc479ea){return _0xc479ea?{'count':_0x4c70b9,'rows':_0xc479ea}:null;}})[_0x104c('0x20')](respondWithResult(_0xf9d249,null))[_0x104c('0x29')](handleError(_0xf9d249,null));};function Extension(_0x548c78,_0x1c9165,_0xb0c677,_0x2ac75e){this[_0x104c('0x83')]='from-voip-provider';this[_0x104c('0x84')]=_0x548c78[_0x104c('0x85')];this['app']=_0x2ac75e;this[_0x104c('0x50')]=_0x104c('0x86');this['description']='Fax\x20Extension';this['FaxAccountId']=_0x548c78['id'];this[_0x104c('0x80')]=_0x1c9165;this['appdata']=_0xb0c677;}function createExtensionsReciveFax(_0x4b5dc2){var _0x34ddf5=0x1;var _0x367e6b=[];_0x367e6b[_0x104c('0x87')](new Extension(_0x4b5dc2,_0x34ddf5,'',_0x104c('0x88')));_0x34ddf5+=0x1;_0x367e6b[_0x104c('0x87')](new Extension(_0x4b5dc2,_0x34ddf5,'CDR(type)=inbound-fax',_0x104c('0x89')));_0x34ddf5+=0x1;for(var _0xb40300 in _0x4b5dc2){if(_0x4b5dc2[_0x104c('0x4a')](_0xb40300)&&(_0xb40300===_0x104c('0x8a')||_0xb40300===_0x104c('0x85')||_0xb40300===_0x104c('0x8b')||_0xb40300===_0x104c('0x8c')||_0xb40300==='headerinfo'||_0xb40300==='maxrate'||_0xb40300===_0x104c('0x8d')||_0xb40300===_0x104c('0x8e')||_0xb40300==='t38timeout')){_0x367e6b[_0x104c('0x87')](new Extension(_0x4b5dc2,_0x34ddf5,'FAXOPT('+_0xb40300+')='+_0x4b5dc2[_0xb40300],'Set'));_0x34ddf5+=0x1;}}_0x367e6b[_0x104c('0x87')](new Extension(_0x4b5dc2,_0x34ddf5,'6',_0x104c('0x8f')));_0x34ddf5+=0x1;_0x367e6b[_0x104c('0x87')](new Extension(_0x4b5dc2,_0x34ddf5,_0x104c('0x90'),_0x104c('0x91')));_0x34ddf5=0x0;return _0x367e6b;}exports[_0x104c('0x92')]=function(_0x421787,_0x329c0b,_0x1d44db){var _0x25f8db;return db['sequelize']['transaction'](function(_0x918669){return db[_0x104c('0x40')][_0x104c('0x58')](_0x421787[_0x104c('0x59')],{'transaction':_0x918669})['then'](function(_0x3d0de8){_0x25f8db=_0x3d0de8[_0x104c('0x35')]({'plain':!![]});return db['VoiceExtension'][_0x104c('0x7e')](createExtensionsReciveFax(_0x25f8db),{'transaction':_0x918669});});})[_0x104c('0x20')](function(){return _0x25f8db;})[_0x104c('0x20')](respondWithResult(_0x329c0b,null))['catch'](handleError(_0x329c0b,null));};exports[_0x104c('0x93')]=function(_0x14dbde,_0x114040,_0x2188b9){var _0x774bf1;return db[_0x104c('0x78')][_0x104c('0x79')](function(_0x248952){return db[_0x104c('0x40')][_0x104c('0x94')](_0x14dbde[_0x104c('0x59')],{'where':{'id':_0x14dbde[_0x104c('0x59')]['id']},'transaction':_0x248952})[_0x104c('0x20')](function(_0x178ae0){return db[_0x104c('0x95')]['destroy']({'where':{'FaxAccountId':_0x14dbde[_0x104c('0x59')]['id']},'transaction':_0x248952})[_0x104c('0x20')](function(_0x17e58f){return db['VoiceExtension'][_0x104c('0x7e')](createExtensionsReciveFax(_[_0x104c('0x6e')](_0x14dbde[_0x104c('0x59')],[_0x104c('0x96'),_0x104c('0x97'),_0x104c('0x98'),'updatedAt',_0x104c('0x99'),'ListId'])),{'transaction':_0x248952});});});})[_0x104c('0x20')](function(){return db[_0x104c('0x40')][_0x104c('0x9a')](_0x14dbde[_0x104c('0x59')]['id']);})[_0x104c('0x20')](respondWithResult(_0x114040,null))[_0x104c('0x29')](handleError(_0x114040,null));};exports['getMessages']=function(_0x496db4,_0x3785fc,_0x33ed63){var _0x1bde01={'raw':!![],'where':{}};var _0x38e3c7={};var _0x332737={'count':0x0,'rows':[]};return db[_0x104c('0x40')][_0x104c('0x66')]({'where':{'id':_0x496db4[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x3785fc,null))[_0x104c('0x20')](function(_0x2559cb){if(_0x2559cb){_0x38e3c7[_0x104c('0x46')]=_[_0x104c('0x44')](db[_0x104c('0x9b')][_0x104c('0x41')]);_0x38e3c7[_0x104c('0x43')]=_[_0x104c('0x44')](_0x496db4['query']);_0x38e3c7[_0x104c('0x4d')]=_[_0x104c('0x45')](_0x38e3c7[_0x104c('0x46')],_0x38e3c7['query']);_0x1bde01['attributes']=_['intersection'](_0x38e3c7['model'],qs[_0x104c('0x48')](_0x496db4[_0x104c('0x43')]['fields']));_0x1bde01[_0x104c('0x47')]=_0x1bde01[_0x104c('0x47')][_0x104c('0x49')]?_0x1bde01[_0x104c('0x47')]:_0x38e3c7['model'];if(!_0x496db4[_0x104c('0x43')]['hasOwnProperty']('nolimit')){_0x1bde01[_0x104c('0x2e')]=qs[_0x104c('0x2e')](_0x496db4[_0x104c('0x43')][_0x104c('0x2e')]);_0x1bde01[_0x104c('0x2d')]=qs[_0x104c('0x2d')](_0x496db4[_0x104c('0x43')]['offset']);}_0x1bde01[_0x104c('0x6b')]=qs[_0x104c('0x4b')](_0x496db4[_0x104c('0x43')][_0x104c('0x4b')]);_0x1bde01[_0x104c('0x4c')]=qs['filters'](_[_0x104c('0x4e')](_0x496db4[_0x104c('0x43')],_0x38e3c7[_0x104c('0x4d')]));_0x1bde01[_0x104c('0x4c')]['FaxAccountId']=_0x2559cb['id'];if(_0x496db4[_0x104c('0x43')][_0x104c('0x51')]){_0x1bde01[_0x104c('0x4c')]=_[_0x104c('0x4f')](_0x1bde01['where'],{'$or':_[_0x104c('0x3f')](_0x1bde01[_0x104c('0x47')],function(_0x4feeec){var _0xf226ef={};_0xf226ef[_0x4feeec]={'$like':'%'+_0x496db4[_0x104c('0x43')][_0x104c('0x51')]+'%'};return _0xf226ef;})});}if(_0x496db4[_0x104c('0x43')]['$gte']){var _0x15f8a2=_0x496db4[_0x104c('0x43')][_0x104c('0x9c')][_0x104c('0x9d')](',');var _0xe47ec7={};_0xe47ec7[_0x15f8a2[0x0]]={'$gte':moment(_0x15f8a2[0x1])[_0x104c('0x9e')](_0x104c('0x9f'))};_0x1bde01[_0x104c('0x4c')]=_[_0x104c('0x4f')](_0x1bde01[_0x104c('0x4c')],_0xe47ec7);}_0x1bde01=_[_0x104c('0x4f')]({},_0x1bde01,_0x496db4['options']);return db[_0x104c('0x9b')][_0x104c('0x2f')]({'where':_0x1bde01[_0x104c('0x4c')]})[_0x104c('0x20')](function(_0x28918c){_0x332737[_0x104c('0x2f')]=_0x28918c;if(_0x496db4['query'][_0x104c('0x57')]){_0x1bde01[_0x104c('0x53')]=[{'all':!![]}];}return db[_0x104c('0x9b')][_0x104c('0x54')](_0x1bde01);})[_0x104c('0x20')](function(_0x1dece8){_0x332737[_0x104c('0x55')]=_0x1dece8;return _0x332737;});}})[_0x104c('0x20')](respondWithFilteredResult(_0x3785fc,_0x1bde01))['catch'](handleError(_0x3785fc,null));};exports[_0x104c('0x3b')]=function(_0x3da497,_0x2653ca,_0x13c990){var _0x3692a3,_0x1fd836={},_0x295ba2;if(_0x3da497[_0x104c('0x59')]['to']){_0x295ba2=_0x3da497[_0x104c('0x59')]['to'][0x0];}return db[_0x104c('0x40')]['find']({'where':{'id':_0x3da497[_0x104c('0x56')]['id']},'include':[{'model':db[_0x104c('0xa0')],'as':_0x104c('0xa1'),'include':[{'model':db[_0x104c('0x71')],'as':'Contacts','where':{'fax':_0x295ba2},'limit':0x1,'order':[[_0x104c('0xa2'),_0x104c('0xa3')]]}]}]})['then'](handleEntityNotFound(_0x2653ca,null))['then'](function(_0x3a5384){_0x3692a3=_0x3a5384;if(_0x3da497['body'][_0x104c('0xa4')]&&_0x3da497[_0x104c('0x59')]['attachments']['length']){for(var _0x5f2c02=0x0;_0x5f2c02<_0x3da497[_0x104c('0x59')]['attachments'][_0x104c('0x49')];_0x5f2c02+=0x1){_0x3da497['body'][_0x104c('0xa4')][_0x5f2c02]={'filename':_0x3da497[_0x104c('0x59')][_0x104c('0xa4')][_0x5f2c02][_0x104c('0x3a')],'id':_0x3da497['body'][_0x104c('0xa4')][_0x5f2c02]['id'],'path':path['join'](config[_0x104c('0xa5')],_0x104c('0xa6'),_0x3da497['body'][_0x104c('0xa4')][_0x5f2c02][_0x104c('0xa7')])};}}return respondWithRpcPromise(_0x104c('0xa8'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x3da497['params']['id'])?undefined:_0x3da497[_0x104c('0x56')]['id'],'path':_['isNil'](_0x3da497[_0x104c('0x59')][_0x104c('0xa4')][0x0][_0x104c('0xa9')])?undefined:_0x3da497[_0x104c('0x59')][_0x104c('0xa4')][0x0][_0x104c('0xa9')],'fax':_[_0x104c('0xaa')](_0x3da497[_0x104c('0x59')]['to'][0x0])?undefined:_0x3da497['body']['to'][0x0]},client9002);})['then'](function(){if(_0x3692a3){if(_[_0x104c('0xaa')](_0x3da497[_0x104c('0x59')][_0x104c('0xab')])){_0x3da497[_0x104c('0x59')][_0x104c('0xab')]=util[_0x104c('0x9e')](_0x104c('0xac'),_0x3692a3[_0x104c('0x3a')],_0x3692a3[_0x104c('0xad')]);}if(_0x3692a3[_0x104c('0xa1')]){if(_0x3692a3[_0x104c('0xa1')][_0x104c('0xae')][_0x104c('0x49')]){return _0x3692a3[_0x104c('0xa1')][_0x104c('0xae')][0x0];}else{return db['CmContact'][_0x104c('0x58')](_[_0x104c('0x19')](_0x3da497['body'],{'firstName':_0x3da497[_0x104c('0x59')]['to'][0x0],'phone':_0x3da497['body']['to'][0x0],'fax':_0x3da497['body']['to'][0x0],'ListId':_0x3692a3[_0x104c('0xaf')]}));}}else{throw new Error(_0x104c('0xb0'));}}else{throw new Error(_0x104c('0xb1'));}})[_0x104c('0x20')](function(_0x3e1d28){if(_0x3e1d28){return db[_0x104c('0x70')][_0x104c('0x5e')]({'where':{'ContactId':_0x3e1d28['id'],'closed':![],'FaxAccountId':_0x3692a3['id']}})['then'](function(_0x3123e9){if(_0x3123e9){return[_0x3123e9,![]];}return db[_0x104c('0x70')][_0x104c('0x58')]({'UserId':_0x3da497['user']['id'],'ContactId':_0x3e1d28['id'],'FaxAccountId':_0x3692a3['id'],'fax':_0x3da497[_0x104c('0x59')]['to'][0x0],'firstMsgDirection':_0x104c('0xb2'),'Messages':[_['merge'](_0x3da497[_0x104c('0x59')],{'read':![],'body':_0x3da497[_0x104c('0x59')][_0x104c('0xa4')][0x0][_0x104c('0xb3')],'FaxAccountId':_0x3692a3['id'],'UserId':_0x3da497['user']['id'],'ContactId':_0x3e1d28['id'],'AttachmentId':_0x3da497[_0x104c('0x59')][_0x104c('0xa4')][0x0]['id']})]},{'include':[{'model':db[_0x104c('0x9b')],'as':_0x104c('0xb4')}]})[_0x104c('0x20')](function(_0x2447cb){return[_0x2447cb,!![]];});});}else{throw new Error(_0x104c('0xb5'));}})[_0x104c('0xb6')](function(_0x877ba7,_0x3af9a7){if(_0x3af9a7){return _0x877ba7;}return db['FaxMessage'][_0x104c('0x58')]({'direction':_0x104c('0xb2'),'read':![],'body':_0x3da497['body'][_0x104c('0xa4')][0x0][_0x104c('0xb3')],'FaxAccountId':_0x3692a3['id'],'FaxInteractionId':_0x877ba7['id'],'UserId':_0x3da497[_0x104c('0x5c')]['id'],'ContactId':_0x877ba7[_0x104c('0xb7')],'AttachmentId':_0x3da497[_0x104c('0x59')][_0x104c('0xa4')][0x0]['id']})[_0x104c('0x20')](function(_0x26f101){_0x877ba7['dataValues'][_0x104c('0xb4')]=[];_0x877ba7[_0x104c('0xb8')][_0x104c('0xb4')]['push'](_0x26f101['dataValues']);return _0x877ba7;});})[_0x104c('0x20')](function(_0x5ba752){respondWithRpcPromise(_0x104c('0xb9'),_0x104c('0xb9'),{'FaxAccountId':_[_0x104c('0xaa')](_0x3da497[_0x104c('0x56')]['id'])?undefined:_0x3da497['params']['id'],'path':_[_0x104c('0xaa')](_0x3da497['body']['attachments'][0x0][_0x104c('0xa9')])?undefined:_0x3da497[_0x104c('0x59')]['attachments'][0x0][_0x104c('0xa9')],'fax':_[_0x104c('0xaa')](_0x3da497[_0x104c('0x59')]['to'][0x0])?undefined:_0x3da497['body']['to'][0x0],'AttachmentId':_0x3da497['body']['attachments'][0x0]['id']},client9002)[_0x104c('0x20')](function(_0x314e4d){logger[_0x104c('0x21')](_0x104c('0xba'),_0x314e4d);})[_0x104c('0x29')](function(_0x1b94c1){logger['info'](_0x104c('0xba'),_0x1b94c1);});return _0x5ba752;})['then'](respondWithResult(_0x2653ca,null))[_0x104c('0x29')](handleError(_0x2653ca,null));};exports[_0x104c('0xbb')]=function(_0x525441,_0x3c4ca1,_0x4c76bc){return db[_0x104c('0x40')][_0x104c('0x5e')]({'where':{'id':_0x525441[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x3c4ca1,null))[_0x104c('0x20')](function(_0x19023d){if(_0x19023d){return _0x19023d[_0x104c('0xbb')](_0x525441[_0x104c('0x59')][_0x104c('0x6d')],_[_0x104c('0x6e')](_0x525441[_0x104c('0x59')],[_0x104c('0x6d'),'id'])||{})[_0x104c('0xb6')](function(_0x2f183e){for(var _0x191ccb=0x0;_0x191ccb<_0x525441[_0x104c('0x59')]['ids'][_0x104c('0x49')];_0x191ccb+=0x1){socket[_0x104c('0xbc')](_0x104c('0xbd'),{'UserId':Number(_0x525441[_0x104c('0x59')]['ids'][_0x191ccb]),'FaxAccountId':Number(_0x525441[_0x104c('0x56')]['id'])});}return _0x2f183e;});}})[_0x104c('0x20')](respondWithResult(_0x3c4ca1,null))[_0x104c('0x29')](handleError(_0x3c4ca1,null));};exports[_0x104c('0xbe')]=function(_0x3ec774,_0x5c9a9a,_0x7b3d14){return db[_0x104c('0x40')][_0x104c('0x5e')]({'where':{'id':_0x3ec774[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x5c9a9a,null))[_0x104c('0x20')](function(_0x22b167){if(_0x22b167){return _0x22b167['removeAgents'](_0x3ec774['query'][_0x104c('0x6d')])[_0x104c('0x20')](function(){if(_[_0x104c('0xbf')](_0x3ec774[_0x104c('0x43')][_0x104c('0x6d')])){for(var _0x1abae5=0x0;_0x1abae5<_0x3ec774['query'][_0x104c('0x6d')][_0x104c('0x49')];_0x1abae5+=0x1){socket[_0x104c('0xbc')](_0x104c('0xc0'),{'UserId':Number(_0x3ec774['query']['ids'][_0x1abae5]),'FaxAccountId':Number(_0x3ec774[_0x104c('0x56')]['id'])});}}else{socket[_0x104c('0xbc')](_0x104c('0xc0'),{'UserId':Number(_0x3ec774[_0x104c('0x43')][_0x104c('0x6d')]),'FaxAccountId':Number(_0x3ec774[_0x104c('0x56')]['id'])});}});}})[_0x104c('0x20')](respondWithStatusCode(_0x5c9a9a,null))[_0x104c('0x29')](handleError(_0x5c9a9a,null));};exports['getAgents']=function(_0x5b374e,_0x437061,_0x38e132){var _0xdc1d98={};var _0x4ca0bd={};var _0x2c427a;var _0x7daf55;return db[_0x104c('0x40')][_0x104c('0x66')]({'where':{'id':_0x5b374e[_0x104c('0x56')]['id']}})[_0x104c('0x20')](handleEntityNotFound(_0x437061,null))[_0x104c('0x20')](function(_0x4a7147){if(_0x4a7147){_0x2c427a=_0x4a7147;_0x4ca0bd[_0x104c('0x46')]=_[_0x104c('0x44')](db['User'][_0x104c('0x41')]);_0x4ca0bd[_0x104c('0x43')]=_[_0x104c('0x44')](_0x5b374e[_0x104c('0x43')]);_0x4ca0bd[_0x104c('0x4d')]=_[_0x104c('0x45')](_0x4ca0bd[_0x104c('0x46')],_0x4ca0bd[_0x104c('0x43')]);_0xdc1d98[_0x104c('0x47')]=_[_0x104c('0x45')](_0x4ca0bd[_0x104c('0x46')],qs[_0x104c('0x48')](_0x5b374e[_0x104c('0x43')][_0x104c('0x48')]));_0xdc1d98[_0x104c('0x47')]=_0xdc1d98[_0x104c('0x47')][_0x104c('0x49')]?_0xdc1d98[_0x104c('0x47')]:_0x4ca0bd[_0x104c('0x46')];_0xdc1d98['order']=qs[_0x104c('0x4b')](_0x5b374e[_0x104c('0x43')][_0x104c('0x4b')]);_0xdc1d98[_0x104c('0x4c')]=qs['filters'](_[_0x104c('0x4e')](_0x5b374e['query'],_0x4ca0bd[_0x104c('0x4d')]));if(_0x5b374e[_0x104c('0x43')][_0x104c('0x51')]){_0xdc1d98['where']=_['merge'](_0xdc1d98['where'],{'$or':_[_0x104c('0x3f')](_0xdc1d98[_0x104c('0x47')],function(_0x278822){var _0x517c2b={};_0x517c2b[_0x278822]={'$like':'%'+_0x5b374e[_0x104c('0x43')][_0x104c('0x51')]+'%'};return _0x517c2b;})});}_0xdc1d98=_[_0x104c('0x4f')]({},_0xdc1d98,_0x5b374e[_0x104c('0x52')]);return _0x2c427a[_0x104c('0xc1')](_0xdc1d98);}})['then'](function(_0x5cf3cc){if(_0x5cf3cc){_0x7daf55=_0x5cf3cc['length'];if(!_0x5b374e['query'][_0x104c('0x4a')](_0x104c('0x67'))){_0xdc1d98['limit']=qs[_0x104c('0x2e')](_0x5b374e[_0x104c('0x43')][_0x104c('0x2e')]);_0xdc1d98[_0x104c('0x2d')]=qs[_0x104c('0x2d')](_0x5b374e[_0x104c('0x43')][_0x104c('0x2d')]);}return _0x2c427a[_0x104c('0xc1')](_0xdc1d98);}})[_0x104c('0x20')](function(_0x30afb3){if(_0x30afb3){return _0x30afb3?{'count':_0x7daf55,'rows':_0x30afb3}:null;}})[_0x104c('0x20')](respondWithResult(_0x437061,null))[_0x104c('0x29')](handleError(_0x437061,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index daad541..b33858a 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 _0x296e=['update','remove','emit','hook','events','../../mysqldb','FaxAccount'];(function(_0xf729a2,_0x26a986){var _0x1c34d2=function(_0x27740d){while(--_0x27740d){_0xf729a2['push'](_0xf729a2['shift']());}};_0x1c34d2(++_0x26a986);}(_0x296e,0x9e));var _0xe296=function(_0x29e1f9,_0x9905e1){_0x29e1f9=_0x29e1f9-0x0;var _0xba6d2a=_0x296e[_0x29e1f9];return _0xba6d2a;};'use strict';var EventEmitter=require(_0xe296('0x0'));var FaxAccount=require(_0xe296('0x1'))['db'][_0xe296('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe296('0x3'),'afterDestroy':_0xe296('0x4')};function emitEvent(_0x33240d){return function(_0x22ad88,_0x2fa0ac,_0xcb2da3){FaxAccountEvents[_0xe296('0x5')](_0x33240d+':'+_0x22ad88['id'],_0x22ad88);FaxAccountEvents[_0xe296('0x5')](_0x33240d,_0x22ad88);_0xcb2da3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xe296('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x711a=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','update','remove','emit'];(function(_0x4ca2ec,_0x1d1ed9){var _0x355d9b=function(_0x217e7b){while(--_0x217e7b){_0x4ca2ec['push'](_0x4ca2ec['shift']());}};_0x355d9b(++_0x1d1ed9);}(_0x711a,0xf3));var _0xa711=function(_0x3d55b2,_0x902089){_0x3d55b2=_0x3d55b2-0x0;var _0x13d8d1=_0x711a[_0x3d55b2];return _0x13d8d1;};'use strict';var EventEmitter=require(_0xa711('0x0'));var FaxAccount=require(_0xa711('0x1'))['db'][_0xa711('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa711('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa711('0x4'),'afterDestroy':_0xa711('0x5')};function emitEvent(_0x1a23c1){return function(_0xeba30e,_0x3b1865,_0x1d12dd){FaxAccountEvents[_0xa711('0x6')](_0x1a23c1+':'+_0xeba30e['id'],_0xeba30e);FaxAccountEvents[_0xa711('0x6')](_0x1a23c1,_0xeba30e);_0x1d12dd(null);};}for(var e in events){if(events[_0xa711('0x7')](e)){var event=events[e];FaxAccount[_0xa711('0x8')](e,emitEvent(event));}}module[_0xa711('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index c289e3d..0e611fb 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 _0x958d=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxAccount','fax_accounts','lodash'];(function(_0x23ea1f,_0x254a22){var _0xfd9fc4=function(_0x15168f){while(--_0x15168f){_0x23ea1f['push'](_0x23ea1f['shift']());}};_0xfd9fc4(++_0x254a22);}(_0x958d,0x15b));var _0xd958=function(_0x17d464,_0x5c7849){_0x17d464=_0x17d464-0x0;var _0x518e25=_0x958d[_0x17d464];return _0x518e25;};'use strict';var _=require(_0xd958('0x0'));var util=require(_0xd958('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd958('0x2'));var BPromise=require(_0xd958('0x3'));var rp=require(_0xd958('0x4'));var fs=require('fs');var path=require(_0xd958('0x5'));var rimraf=require(_0xd958('0x6'));var config=require(_0xd958('0x7'));var attributes=require('./faxAccount.attributes');module[_0xd958('0x8')]=function(_0x8515bc,_0x2cd267){return _0x8515bc[_0xd958('0x9')](_0xd958('0xa'),attributes,{'tableName':_0xd958('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x797f=['api','moment','bluebird','path','../../config/environment','exports','define','FaxAccount','fax_accounts','util','../../config/logger'];(function(_0x24870d,_0x1e9713){var _0x1f53a8=function(_0x2e193f){while(--_0x2e193f){_0x24870d['push'](_0x24870d['shift']());}};_0x1f53a8(++_0x1e9713);}(_0x797f,0xa3));var _0xf797=function(_0x70f4f,_0xf4fcc2){_0x70f4f=_0x70f4f-0x0;var _0x342ca7=_0x797f[_0x70f4f];return _0x342ca7;};'use strict';var _=require('lodash');var util=require(_0xf797('0x0'));var logger=require(_0xf797('0x1'))(_0xf797('0x2'));var moment=require(_0xf797('0x3'));var BPromise=require(_0xf797('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf797('0x5'));var rimraf=require('rimraf');var config=require(_0xf797('0x6'));var attributes=require('./faxAccount.attributes');module[_0xf797('0x7')]=function(_0x3fd61e,_0x3f2b08){return _0x3fd61e[_0xf797('0x8')](_0xf797('0x9'),attributes,{'tableName':_0xf797('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index b9702ca..dc22366 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 _0xfa1a=['./faxAccount.socket','register','request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','include','model','map','then','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','Contacts','DESC','FaxApplication','Applications','List','get','applications','list','orderBy','priority','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa1a,0x103));var _0xafa1=function(_0x1443eb,_0x203408){_0x1443eb=_0x1443eb-0x0;var _0x2b8810=_0xfa1a[_0x1443eb];return _0x2b8810;};'use strict';var _=require(_0xafa1('0x0'));var util=require(_0xafa1('0x1'));var moment=require(_0xafa1('0x2'));var BPromise=require(_0xafa1('0x3'));var rs=require(_0xafa1('0x4'));var fs=require('fs');var Redis=require(_0xafa1('0x5'));var db=require(_0xafa1('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xafa1('0x7'));var jayson=require(_0xafa1('0x8'));var client=jayson[_0xafa1('0x9')][_0xafa1('0xa')]({'port':0x232c});config[_0xafa1('0xb')]=_['defaults'](config[_0xafa1('0xb')],{'host':_0xafa1('0xc'),'port':0x18eb});var socket=require(_0xafa1('0xd'))(new Redis(config['redis']));require(_0xafa1('0xe'))[_0xafa1('0xf')](socket);function respondWithRpcPromise(_0x54bcac,_0x3a0665,_0xd97d){return new BPromise(function(_0x13a4f9,_0x18d86a){return client[_0xafa1('0x10')](_0x54bcac,_0xd97d)['then'](function(_0x2727c1){logger[_0xafa1('0x11')]('FaxAccount,\x20%s,\x20%s',_0x3a0665,_0xafa1('0x12'));logger[_0xafa1('0x13')](_0xafa1('0x14'),_0x3a0665,'request\x20sent',JSON[_0xafa1('0x15')](_0x2727c1));if(_0x2727c1[_0xafa1('0x16')]){if(_0x2727c1['error'][_0xafa1('0x17')]===0x1f4){logger[_0xafa1('0x16')](_0xafa1('0x18'),_0x3a0665,_0x2727c1['error'][_0xafa1('0x19')]);return _0x18d86a(_0x2727c1[_0xafa1('0x16')]['message']);}logger[_0xafa1('0x16')](_0xafa1('0x18'),_0x3a0665,_0x2727c1[_0xafa1('0x16')][_0xafa1('0x19')]);return _0x13a4f9(_0x2727c1[_0xafa1('0x16')][_0xafa1('0x19')]);}else{logger[_0xafa1('0x11')](_0xafa1('0x18'),_0x3a0665,_0xafa1('0x12'));_0x13a4f9(_0x2727c1[_0xafa1('0x1a')]['message']);}})[_0xafa1('0x1b')](function(_0x116da8){logger[_0xafa1('0x16')](_0xafa1('0x18'),_0x3a0665,_0x116da8);_0x18d86a(_0x116da8);});});}exports[_0xafa1('0x1c')]=function(_0x21d063){var _0x254c8d=this;return new Promise(function(_0x58e8a1,_0x5ca8ff){return db[_0xafa1('0x1d')]['findAll']({'raw':_0x21d063['options']?_0x21d063[_0xafa1('0x1e')][_0xafa1('0x1f')]===undefined?!![]:![]:!![],'where':_0x21d063[_0xafa1('0x1e')]?_0x21d063['options'][_0xafa1('0x20')]||null:null,'attributes':_0x21d063['options']?_0x21d063[_0xafa1('0x1e')][_0xafa1('0x21')]||null:null,'limit':_0x21d063[_0xafa1('0x1e')]?_0x21d063[_0xafa1('0x1e')]['limit']||null:null,'include':_0x21d063[_0xafa1('0x1e')]?_0x21d063[_0xafa1('0x1e')][_0xafa1('0x22')]?_['map'](_0x21d063[_0xafa1('0x1e')][_0xafa1('0x22')],function(_0x539ed3){return{'model':db[_0x539ed3[_0xafa1('0x23')]],'as':_0x539ed3['as'],'attributes':_0x539ed3[_0xafa1('0x21')],'include':_0x539ed3[_0xafa1('0x22')]?_[_0xafa1('0x24')](_0x539ed3[_0xafa1('0x22')],function(_0x13b981){return{'model':db[_0x13b981[_0xafa1('0x23')]],'as':_0x13b981['as'],'attributes':_0x13b981['attributes'],'include':_0x13b981['include']?_[_0xafa1('0x24')](_0x13b981['include'],function(_0x51a3b9){return{'model':db[_0x51a3b9[_0xafa1('0x23')]],'as':_0x51a3b9['as'],'attributes':_0x51a3b9['attributes']};}):[]};}):[]};}):[]:[]})[_0xafa1('0x25')](function(_0x10d23f){logger[_0xafa1('0x11')](_0xafa1('0x1c'),_0x21d063);logger[_0xafa1('0x13')]('GetFaxAccount',_0x21d063,JSON[_0xafa1('0x15')](_0x10d23f));_0x58e8a1(_0x10d23f);})[_0xafa1('0x1b')](function(_0x5c49b7){logger[_0xafa1('0x16')](_0xafa1('0x1c'),_0x5c49b7['message'],_0x21d063);_0x5ca8ff(_0x254c8d['error'](0x1f4,_0x5c49b7['message']));});});};exports[_0xafa1('0x26')]=function(_0x34021f,_0x70bea9,_0x25f501){var _0x2887f9=this;return new Promise(function(_0x4087ed,_0x3d07ae){var _0x5212e8={'body':_0x34021f['body'],'channel':_0xafa1('0x27')};var _0x2f505e=[];var _0x185d9d=[];var _0x1faa10={};return db[_0xafa1('0x28')][_0xafa1('0x29')]()[_0xafa1('0x25')](function(_0x3260e6){if(!_0x3260e6){throw new db[(_0xafa1('0x2a'))][(_0xafa1('0x2b'))](_0xafa1('0x2c'));}_0x2f505e=_[_0xafa1('0x2d')](_[_0xafa1('0x2e')](_0x3260e6),[_0xafa1('0x2f'),_0xafa1('0x30')]);_0x185d9d=_[_0xafa1('0x2d')](_['keys'](_0x3260e6),[_0xafa1('0x2f'),'updatedAt','CompanyId',_0xafa1('0x31')]);if(_0x34021f[_0xafa1('0x32')]['id']){delete _0x34021f[_0xafa1('0x32')]['id'];}if(_[_0xafa1('0x33')](_0x34021f[_0xafa1('0x32')][_0xafa1('0x34')])){throw new db[(_0xafa1('0x2a'))][(_0xafa1('0x2b'))](_0xafa1('0x35'));}if(_[_0xafa1('0x33')](_0x34021f['body'][_0xafa1('0x32')])||_0x34021f[_0xafa1('0x32')]['body']===''){throw new db[(_0xafa1('0x2a'))][(_0xafa1('0x2b'))](_0xafa1('0x36'));}if(_['isNil'](_0x34021f[_0xafa1('0x32')][_0xafa1('0x37')])){throw new db['Sequelize'][(_0xafa1('0x2b'))](_0xafa1('0x38')+_0x185d9d);}if(!_[_0xafa1('0x39')](_0x185d9d,_0x34021f[_0xafa1('0x32')][_0xafa1('0x37')])){throw new db[(_0xafa1('0x2a'))][(_0xafa1('0x2b'))](_0xafa1('0x3a')+_0x185d9d);}_0x1faa10[_0x34021f[_0xafa1('0x32')][_0xafa1('0x37')]]=_0x34021f[_0xafa1('0x32')]['from'];})[_0xafa1('0x25')](function(){return db['FaxAccount'][_0xafa1('0x3b')]({'where':{'id':_0x34021f[_0xafa1('0x3c')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xafa1('0x28')],'as':_0xafa1('0x3d'),'where':_0x1faa10,'limit':0x1,'order':[[_0xafa1('0x30'),_0xafa1('0x3e')]]}]},{'model':db[_0xafa1('0x3f')],'as':_0xafa1('0x40')}]});})[_0xafa1('0x25')](function(_0x1dd60f){if(_0x1dd60f&&_0x1dd60f[_0xafa1('0x41')]){var _0x3160d5=_0x1dd60f[_0xafa1('0x42')]({'plain':!![]});_0x5212e8[_0xafa1('0x3c')]=_0x3160d5;_0x5212e8[_0xafa1('0x43')]=_0x3160d5[_0xafa1('0x40')];_0x5212e8[_0xafa1('0x44')]=_0x3160d5[_0xafa1('0x41')];_0x5212e8[_0xafa1('0x43')]=_[_0xafa1('0x45')](_0x5212e8[_0xafa1('0x43')],[_0xafa1('0x46')],['asc']);if(_0x5212e8[_0xafa1('0x3c')]['Applications']){delete _0x5212e8['account']['Applications'];}if(_0x5212e8['account'][_0xafa1('0x41')]&&_0x5212e8['account'][_0xafa1('0x41')][_0xafa1('0x3d')][_0xafa1('0x47')]){return _0x5212e8[_0xafa1('0x3c')][_0xafa1('0x41')][_0xafa1('0x3d')][0x0];}var _0x5c558a=_['defaults'](_0x34021f[_0xafa1('0x32')],{'firstName':_0x34021f[_0xafa1('0x32')][_0xafa1('0x34')],'ListId':_0x3160d5['ListId']});_0x5c558a[_0x34021f[_0xafa1('0x32')][_0xafa1('0x37')]]=_0x34021f['body'][_0xafa1('0x34')];return db[_0xafa1('0x28')][_0xafa1('0x48')](_0x5c558a,{'fields':_0x2f505e,'raw':!![]});}})[_0xafa1('0x25')](function(_0x7c727c){_0x5212e8[_0xafa1('0x49')]=_0x7c727c;if(_0x7c727c){var _0x3dfb20={'ContactId':_0x7c727c['id'],'FaxAccountId':_0x34021f[_0xafa1('0x3c')]['id'],'fax':_0x7c727c[_0xafa1('0x27')]};return db[_0xafa1('0x4a')][_0xafa1('0x3b')]({'where':{'ContactId':_0x7c727c['id'],'closed':![],'FaxAccountId':_0x34021f[_0xafa1('0x3c')]['id']}})[_0xafa1('0x25')](function(_0xa8f89a){if(_0xa8f89a){return[_0xa8f89a,![]];}return db[_0xafa1('0x4a')][_0xafa1('0x48')](_0x3dfb20)[_0xafa1('0x25')](function(_0x33936c){return[_0x33936c,!![]];});});}else{throw new Error(_0xafa1('0x4b'));}})[_0xafa1('0x4c')](function(_0x3330f4,_0x383e44){var _0x2eaf39=_0x3330f4['get']({'plain':!![]});if(_0x383e44){if(_0x5212e8[_0xafa1('0x3c')][_0xafa1('0x4d')]){_0x5212e8[_0xafa1('0x43')]['push']({'id':0x0,'priority':_0x5212e8[_0xafa1('0x43')]['length']+0x1,'app':'close','appdata':_0xafa1('0x4e'),'interval':_0xafa1('0x4f')});}_0x2eaf39[_0xafa1('0x50')]=!![];}else{_0x2eaf39[_0xafa1('0x50')]=![];}_0x5212e8[_0xafa1('0x51')]=_0x2eaf39;return db[_0xafa1('0x52')][_0xafa1('0x48')]({'body':_0x34021f[_0xafa1('0x32')]['body'],'FaxAccountId':_0x34021f[_0xafa1('0x3c')]['id'],'FaxInteractionId':_0x3330f4['id'],'direction':'in','ContactId':_0x3330f4['ContactId'],'AttachmentId':_0x34021f[_0xafa1('0x32')][_0xafa1('0x53')]});})['then'](function(_0x5d89c0){_0x5212e8[_0xafa1('0x19')]=_0x5d89c0;if(_0x5212e8[_0xafa1('0x51')][_0xafa1('0x54')]){return db[_0xafa1('0x55')][_0xafa1('0x3b')]({'attributes':['id',_0xafa1('0x56')],'where':{'id':_0x5212e8[_0xafa1('0x51')][_0xafa1('0x54')]}})['then'](function(_0x1ebea4){if(_0x1ebea4){_0x5212e8[_0xafa1('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0xafa1('0x57'),'appdata':_0x1ebea4[_0xafa1('0x56')]+','+(_0x5212e8['account'][_0xafa1('0x58')]||0xa),'interval':_0xafa1('0x4f')});}return respondWithRpcPromise(_0xafa1('0x59'),_0xafa1('0x5a'),_0x5212e8);});}return respondWithRpcPromise(_0xafa1('0x59'),_0xafa1('0x5a'),_0x5212e8);})[_0xafa1('0x25')](function(_0x360c77){_0x4087ed(_0x360c77);})[_0xafa1('0x1b')](function(_0x5f3127){_0x3d07ae(_0x2887f9[_0xafa1('0x16')](0x1f4,_0x5f3127[_0xafa1('0x19')]));});});}; \ No newline at end of file +var _0xb11d=['Contacts','FaxApplication','Applications','List','list','applications','orderBy','priority','asc','length','create','find','Contact\x20not\x20found','spread','get','autoclose','push','close','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','UserId','User','name','interaction','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','request\x20sent','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList'];(function(_0x2edbaa,_0xa3f50b){var _0x17c906=function(_0x36dcf9){while(--_0x36dcf9){_0x2edbaa['push'](_0x2edbaa['shift']());}};_0x17c906(++_0xa3f50b);}(_0xb11d,0x7d));var _0xdb11=function(_0x7d9d62,_0x59061b){_0x7d9d62=_0x7d9d62-0x0;var _0x3ed57a=_0xb11d[_0x7d9d62];return _0x3ed57a;};'use strict';var _=require(_0xdb11('0x0'));var util=require(_0xdb11('0x1'));var moment=require(_0xdb11('0x2'));var BPromise=require(_0xdb11('0x3'));var rs=require(_0xdb11('0x4'));var fs=require('fs');var Redis=require(_0xdb11('0x5'));var db=require(_0xdb11('0x6'))['db'];var utils=require(_0xdb11('0x7'));var logger=require(_0xdb11('0x8'))(_0xdb11('0x9'));var config=require(_0xdb11('0xa'));var jayson=require(_0xdb11('0xb'));var client=jayson[_0xdb11('0xc')][_0xdb11('0xd')]({'port':0x232c});config[_0xdb11('0xe')]=_[_0xdb11('0xf')](config[_0xdb11('0xe')],{'host':_0xdb11('0x10'),'port':0x18eb});var socket=require(_0xdb11('0x11'))(new Redis(config[_0xdb11('0xe')]));require(_0xdb11('0x12'))['register'](socket);function respondWithRpcPromise(_0x1e4da0,_0x5d2774,_0x53e806){return new BPromise(function(_0x594368,_0x13960e){return client[_0xdb11('0x13')](_0x1e4da0,_0x53e806)[_0xdb11('0x14')](function(_0x3a2958){logger[_0xdb11('0x15')]('FaxAccount,\x20%s,\x20%s',_0x5d2774,_0xdb11('0x16'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5d2774,_0xdb11('0x16'),JSON[_0xdb11('0x17')](_0x3a2958));if(_0x3a2958[_0xdb11('0x18')]){if(_0x3a2958[_0xdb11('0x18')][_0xdb11('0x19')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x5d2774,_0x3a2958[_0xdb11('0x18')]['message']);return _0x13960e(_0x3a2958[_0xdb11('0x18')][_0xdb11('0x1a')]);}logger['error'](_0xdb11('0x1b'),_0x5d2774,_0x3a2958['error'][_0xdb11('0x1a')]);return _0x594368(_0x3a2958[_0xdb11('0x18')][_0xdb11('0x1a')]);}else{logger[_0xdb11('0x15')](_0xdb11('0x1b'),_0x5d2774,'request\x20sent');_0x594368(_0x3a2958[_0xdb11('0x1c')][_0xdb11('0x1a')]);}})[_0xdb11('0x1d')](function(_0x371bfa){logger[_0xdb11('0x18')](_0xdb11('0x1b'),_0x5d2774,_0x371bfa);_0x13960e(_0x371bfa);});});}exports[_0xdb11('0x1e')]=function(_0x27bf61){var _0x37cf78=this;return new Promise(function(_0x501b64,_0x12d1d9){return db[_0xdb11('0x1f')][_0xdb11('0x20')]({'raw':_0x27bf61[_0xdb11('0x21')]?_0x27bf61[_0xdb11('0x21')][_0xdb11('0x22')]===undefined?!![]:![]:!![],'where':_0x27bf61['options']?_0x27bf61[_0xdb11('0x21')][_0xdb11('0x23')]||null:null,'attributes':_0x27bf61[_0xdb11('0x21')]?_0x27bf61[_0xdb11('0x21')][_0xdb11('0x24')]||null:null,'limit':_0x27bf61[_0xdb11('0x21')]?_0x27bf61['options'][_0xdb11('0x25')]||null:null,'include':_0x27bf61[_0xdb11('0x21')]?_0x27bf61['options'][_0xdb11('0x26')]?_[_0xdb11('0x27')](_0x27bf61[_0xdb11('0x21')][_0xdb11('0x26')],function(_0x4cbed8){return{'model':db[_0x4cbed8['model']],'as':_0x4cbed8['as'],'attributes':_0x4cbed8[_0xdb11('0x24')],'include':_0x4cbed8[_0xdb11('0x26')]?_['map'](_0x4cbed8['include'],function(_0x38fedb){return{'model':db[_0x38fedb[_0xdb11('0x28')]],'as':_0x38fedb['as'],'attributes':_0x38fedb[_0xdb11('0x24')],'include':_0x38fedb['include']?_['map'](_0x38fedb[_0xdb11('0x26')],function(_0x1b40fc){return{'model':db[_0x1b40fc['model']],'as':_0x1b40fc['as'],'attributes':_0x1b40fc[_0xdb11('0x24')]};}):[]};}):[]};}):[]:[]})[_0xdb11('0x14')](function(_0x2b4cec){logger[_0xdb11('0x15')](_0xdb11('0x1e'),_0x27bf61);logger[_0xdb11('0x29')](_0xdb11('0x1e'),_0x27bf61,JSON[_0xdb11('0x17')](_0x2b4cec));_0x501b64(_0x2b4cec);})[_0xdb11('0x1d')](function(_0x5b00bc){logger[_0xdb11('0x18')](_0xdb11('0x1e'),_0x5b00bc[_0xdb11('0x1a')],_0x27bf61);_0x12d1d9(_0x37cf78[_0xdb11('0x18')](0x1f4,_0x5b00bc[_0xdb11('0x1a')]));});});};exports['NotifyFaxAccount']=function(_0x1b04f1,_0x37dd31,_0x205414){var _0x404cdb=this;return new Promise(function(_0x5e2944,_0x505eed){var _0x5a6d64={'body':_0x1b04f1[_0xdb11('0x2a')],'channel':_0xdb11('0x2b')};var _0x2aab87=[];var _0x9782ff=[];var _0x53a86c={};return db[_0xdb11('0x2c')][_0xdb11('0x2d')]()[_0xdb11('0x14')](function(_0x27ea2a){if(!_0x27ea2a){throw new db['Sequelize'][(_0xdb11('0x2e'))](_0xdb11('0x2f'));}_0x2aab87=_[_0xdb11('0x30')](_['keys'](_0x27ea2a),['createdAt',_0xdb11('0x31')]);_0x9782ff=_[_0xdb11('0x30')](_['keys'](_0x27ea2a),[_0xdb11('0x32'),'updatedAt',_0xdb11('0x33'),_0xdb11('0x34')]);if(_0x1b04f1[_0xdb11('0x2a')]['id']){delete _0x1b04f1['body']['id'];}if(_[_0xdb11('0x35')](_0x1b04f1['body'][_0xdb11('0x36')])){throw new db[(_0xdb11('0x37'))][(_0xdb11('0x2e'))](_0xdb11('0x38'));}if(_[_0xdb11('0x35')](_0x1b04f1[_0xdb11('0x2a')][_0xdb11('0x2a')])||_0x1b04f1[_0xdb11('0x2a')][_0xdb11('0x2a')]===''){throw new db[(_0xdb11('0x37'))][(_0xdb11('0x2e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xdb11('0x35')](_0x1b04f1['body'][_0xdb11('0x39')])){throw new db[(_0xdb11('0x37'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x9782ff);}if(!_['includes'](_0x9782ff,_0x1b04f1['body']['mapKey'])){throw new db['Sequelize'][(_0xdb11('0x2e'))](_0xdb11('0x3a')+_0x9782ff);}_0x53a86c[_0x1b04f1[_0xdb11('0x2a')][_0xdb11('0x39')]]=_0x1b04f1['body'][_0xdb11('0x36')];})[_0xdb11('0x14')](function(){return db[_0xdb11('0x1f')]['find']({'where':{'id':_0x1b04f1[_0xdb11('0x3b')]['id']},'include':[{'model':db[_0xdb11('0x3c')],'as':'List','include':[{'model':db[_0xdb11('0x2c')],'as':_0xdb11('0x3d'),'where':_0x53a86c,'limit':0x1,'order':[[_0xdb11('0x31'),'DESC']]}]},{'model':db[_0xdb11('0x3e')],'as':_0xdb11('0x3f')}]});})[_0xdb11('0x14')](function(_0x85332a){if(_0x85332a&&_0x85332a[_0xdb11('0x40')]){var _0x1b9c99=_0x85332a['get']({'plain':!![]});_0x5a6d64['account']=_0x1b9c99;_0x5a6d64['applications']=_0x1b9c99[_0xdb11('0x3f')];_0x5a6d64[_0xdb11('0x41')]=_0x1b9c99[_0xdb11('0x40')];_0x5a6d64[_0xdb11('0x42')]=_[_0xdb11('0x43')](_0x5a6d64['applications'],[_0xdb11('0x44')],[_0xdb11('0x45')]);if(_0x5a6d64[_0xdb11('0x3b')][_0xdb11('0x3f')]){delete _0x5a6d64[_0xdb11('0x3b')][_0xdb11('0x3f')];}if(_0x5a6d64[_0xdb11('0x3b')][_0xdb11('0x40')]&&_0x5a6d64[_0xdb11('0x3b')][_0xdb11('0x40')][_0xdb11('0x3d')][_0xdb11('0x46')]){return _0x5a6d64['account'][_0xdb11('0x40')][_0xdb11('0x3d')][0x0];}var _0x100bea=_[_0xdb11('0xf')](_0x1b04f1['body'],{'firstName':_0x1b04f1[_0xdb11('0x2a')][_0xdb11('0x36')],'ListId':_0x1b9c99[_0xdb11('0x34')]});_0x100bea[_0x1b04f1['body'][_0xdb11('0x39')]]=_0x1b04f1[_0xdb11('0x2a')][_0xdb11('0x36')];return db['CmContact'][_0xdb11('0x47')](_0x100bea,{'fields':_0x2aab87,'raw':!![]});}})['then'](function(_0x1a8c07){_0x5a6d64['contact']=_0x1a8c07;if(_0x1a8c07){var _0x2ade70={'ContactId':_0x1a8c07['id'],'FaxAccountId':_0x1b04f1[_0xdb11('0x3b')]['id'],'fax':_0x1a8c07['fax']};return db['FaxInteraction'][_0xdb11('0x48')]({'where':{'ContactId':_0x1a8c07['id'],'closed':![],'FaxAccountId':_0x1b04f1['account']['id']}})['then'](function(_0x38e15c){if(_0x38e15c){return[_0x38e15c,![]];}return db['FaxInteraction']['create'](_0x2ade70)['then'](function(_0x5efe99){return[_0x5efe99,!![]];});});}else{throw new Error(_0xdb11('0x49'));}})[_0xdb11('0x4a')](function(_0x4c8c5,_0x4a51e8){var _0x317282=_0x4c8c5[_0xdb11('0x4b')]({'plain':!![]});if(_0x4a51e8){if(_0x5a6d64[_0xdb11('0x3b')][_0xdb11('0x4c')]){_0x5a6d64[_0xdb11('0x42')][_0xdb11('0x4d')]({'id':0x0,'priority':_0x5a6d64['applications'][_0xdb11('0x46')]+0x1,'app':_0xdb11('0x4e'),'appdata':'unmanaged','interval':_0xdb11('0x4f')});}_0x317282[_0xdb11('0x50')]=!![];}else{_0x317282['created']=![];}_0x5a6d64['interaction']=_0x317282;return db[_0xdb11('0x51')][_0xdb11('0x47')]({'body':_0x1b04f1[_0xdb11('0x2a')][_0xdb11('0x2a')],'FaxAccountId':_0x1b04f1['account']['id'],'FaxInteractionId':_0x4c8c5['id'],'direction':'in','ContactId':_0x4c8c5[_0xdb11('0x52')],'AttachmentId':_0x1b04f1[_0xdb11('0x2a')][_0xdb11('0x53')]});})[_0xdb11('0x14')](function(_0x33a53c){_0x5a6d64[_0xdb11('0x1a')]=_0x33a53c;if(_0x5a6d64['interaction'][_0xdb11('0x54')]){return db[_0xdb11('0x55')][_0xdb11('0x48')]({'attributes':['id',_0xdb11('0x56')],'where':{'id':_0x5a6d64[_0xdb11('0x57')][_0xdb11('0x54')]}})[_0xdb11('0x14')](function(_0x49559f){if(_0x49559f){_0x5a6d64[_0xdb11('0x42')][_0xdb11('0x58')]({'id':0x0,'priority':0x0,'app':_0xdb11('0x59'),'appdata':_0x49559f['name']+','+(_0x5a6d64[_0xdb11('0x3b')][_0xdb11('0x5a')]||0xa),'interval':_0xdb11('0x4f')});}return respondWithRpcPromise(_0xdb11('0x5b'),_0xdb11('0x5c'),_0x5a6d64);});}return respondWithRpcPromise(_0xdb11('0x5b'),_0xdb11('0x5c'),_0x5a6d64);})[_0xdb11('0x14')](function(_0x45c019){_0x5e2944(_0x45c019);})[_0xdb11('0x1d')](function(_0x1c7643){_0x505eed(_0x404cdb[_0xdb11('0x18')](0x1f4,_0x1c7643[_0xdb11('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 100f6eb..ebe58a9 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 _0x7574=['emit','removeListener','faxAccount:','./faxAccount.events','save','update'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x7574,0x1a7));var _0x4757=function(_0x5a481c,_0x20735b){_0x5a481c=_0x5a481c-0x0;var _0x4bc576=_0x7574[_0x5a481c];return _0x4bc576;};'use strict';var FaxAccountEvents=require(_0x4757('0x0'));var events=[_0x4757('0x1'),'remove',_0x4757('0x2')];function createListener(_0x39cf53,_0x5c0c89){return function(_0x4bd215){_0x5c0c89[_0x4757('0x3')](_0x39cf53,_0x4bd215);};}function removeListener(_0x2759d4,_0x441293){return function(){FaxAccountEvents[_0x4757('0x4')](_0x2759d4,_0x441293);};}exports['register']=function(_0x166908){for(var _0x10da1f=0x0,_0x55688d=events['length'];_0x10da1f<_0x55688d;_0x10da1f++){var _0x1e8c28=events[_0x10da1f];var _0x5d1933=createListener(_0x4757('0x5')+_0x1e8c28,_0x166908);FaxAccountEvents['on'](_0x1e8c28,_0x5d1933);}}; \ No newline at end of file +var _0x1917=['save','remove','update','emit','removeListener','faxAccount:','./faxAccount.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1917,0x1aa));var _0x7191=function(_0xfff036,_0x24b67e){_0xfff036=_0xfff036-0x0;var _0x40e3da=_0x1917[_0xfff036];return _0x40e3da;};'use strict';var FaxAccountEvents=require(_0x7191('0x0'));var events=[_0x7191('0x1'),_0x7191('0x2'),_0x7191('0x3')];function createListener(_0x27662e,_0x1e269d){return function(_0x46e0a3){_0x1e269d[_0x7191('0x4')](_0x27662e,_0x46e0a3);};}function removeListener(_0x5d4290,_0x2869f4){return function(){FaxAccountEvents[_0x7191('0x5')](_0x5d4290,_0x2869f4);};}exports['register']=function(_0x5a7f8a){for(var _0x4ef5fe=0x0,_0x46565e=events['length'];_0x4ef5fe<_0x46565e;_0x4ef5fe++){var _0x1c6701=events[_0x4ef5fe];var _0x1bc3d2=createListener(_0x7191('0x6')+_0x1c6701,_0x5a7f8a);FaxAccountEvents['on'](_0x1c6701,_0x1bc3d2);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 1ccfe7a..39d9515 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(_0x26e0a4,_0x41c372){var _0x209666=function(_0x36b672){while(--_0x36b672){_0x26e0a4['push'](_0x26e0a4['shift']());}};_0x209666(++_0x41c372);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x4bc88a,_0x5f1427){var _0x5429c0=function(_0x36116f){while(--_0x36116f){_0x4bc88a['push'](_0x4bc88a['shift']());}};_0x5429c0(++_0x5f1427);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 a6a4437..acc81f5 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 _0xf6ce=['exports','STRING','noop','*,*,*,*','sequelize'];(function(_0x44a12a,_0x40f902){var _0x1dc36f=function(_0x479a72){while(--_0x479a72){_0x44a12a['push'](_0x44a12a['shift']());}};_0x1dc36f(++_0x40f902);}(_0xf6ce,0x9f));var _0xef6c=function(_0x17e1c0,_0x402958){_0x17e1c0=_0x17e1c0-0x0;var _0x1cefb3=_0xf6ce[_0x17e1c0];return _0x1cefb3;};'use strict';var Sequelize=require(_0xef6c('0x0'));module[_0xef6c('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xef6c('0x2')],'allowNull':![],'defaultValue':_0xef6c('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xef6c('0x2')]},'interval':{'type':Sequelize[_0xef6c('0x2')],'defaultValue':_0xef6c('0x4')}}; \ No newline at end of file +var _0x9daf=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x404fd8,_0x136cac){var _0x330229=function(_0x375c2f){while(--_0x375c2f){_0x404fd8['push'](_0x404fd8['shift']());}};_0x330229(++_0x136cac);}(_0x9daf,0x145));var _0xf9da=function(_0x5bd60b,_0x13465a){_0x5bd60b=_0x5bd60b-0x0;var _0x2dcff0=_0x9daf[_0x5bd60b];return _0x2dcff0;};'use strict';var Sequelize=require(_0xf9da('0x0'));module[_0xf9da('0x1')]={'priority':{'type':Sequelize[_0xf9da('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf9da('0x3')],'allowNull':![],'defaultValue':_0xf9da('0x4')},'appdata':{'type':Sequelize[_0xf9da('0x5')]()},'description':{'type':Sequelize[_0xf9da('0x3')]},'interval':{'type':Sequelize[_0xf9da('0x3')],'defaultValue':_0xf9da('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 112c710..e5f2019 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 _0xb1fe=['send','map','rawAttributes','fieldName','type','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','FaxApplication','findAll','rows','catch','show','params','keys','options','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0xb1fe,0xb5));var _0xeb1f=function(_0x57c0cc,_0x1a37f3){_0x57c0cc=_0x57c0cc-0x0;var _0x56dc7b=_0xb1fe[_0x57c0cc];return _0x56dc7b;};'use strict';var emlformat=require(_0xeb1f('0x0'));var rimraf=require(_0xeb1f('0x1'));var zipdir=require(_0xeb1f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeb1f('0x3'));var BPromise=require(_0xeb1f('0x4'));var Mustache=require(_0xeb1f('0x5'));var util=require(_0xeb1f('0x6'));var path=require('path');var sox=require(_0xeb1f('0x7'));var csv=require(_0xeb1f('0x8'));var ejs=require(_0xeb1f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb1f('0xa'));var squel=require('squel');var crypto=require(_0xeb1f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xeb1f('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeb1f('0xd'));var Redis=require('ioredis');var authService=require(_0xeb1f('0xe'));var qs=require(_0xeb1f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb1f('0x10'));var logger=require(_0xeb1f('0x11'))(_0xeb1f('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeb1f('0x13'));var db=require(_0xeb1f('0x14'))['db'];function respondWithStatusCode(_0x4c0780,_0x148f19){_0x148f19=_0x148f19||0xcc;return function(_0x1b616c){if(_0x1b616c){return _0x4c0780['sendStatus'](_0x148f19);}return _0x4c0780[_0xeb1f('0x15')](_0x148f19)['end']();};}function respondWithResult(_0x47b3b8,_0x558dd4){_0x558dd4=_0x558dd4||0xc8;return function(_0x3ef140){if(_0x3ef140){return _0x47b3b8['status'](_0x558dd4)[_0xeb1f('0x16')](_0x3ef140);}};}function respondWithFilteredResult(_0x5a5549,_0x974fef){return function(_0xc3f19d){if(_0xc3f19d){var _0x5617e1=typeof _0x974fef[_0xeb1f('0x17')]===_0xeb1f('0x18')&&typeof _0x974fef[_0xeb1f('0x19')]==='undefined';var _0x3ae4ea=_0xc3f19d[_0xeb1f('0x1a')];var _0x162158=_0x5617e1?0x0:_0x974fef[_0xeb1f('0x17')];var _0x43bf0b=_0x5617e1?_0xc3f19d['count']:_0x974fef[_0xeb1f('0x17')]+_0x974fef['limit'];var _0x1e01a3;if(_0x43bf0b>=_0x3ae4ea){_0x43bf0b=_0x3ae4ea;_0x1e01a3=0xc8;}else{_0x1e01a3=0xce;}_0x5a5549[_0xeb1f('0x15')](_0x1e01a3);return _0x5a5549[_0xeb1f('0x1b')](_0xeb1f('0x1c'),_0x162158+'-'+_0x43bf0b+'/'+_0x3ae4ea)[_0xeb1f('0x16')](_0xc3f19d);}return null;};}function patchUpdates(_0x50d30c){return function(_0x408ace){try{jsonpatch[_0xeb1f('0x1d')](_0x408ace,_0x50d30c,!![]);}catch(_0x6c5b4f){return BPromise[_0xeb1f('0x1e')](_0x6c5b4f);}return _0x408ace[_0xeb1f('0x1f')]();};}function saveUpdates(_0x414859,_0x3819af){return function(_0x3895db){if(_0x3895db){return _0x3895db[_0xeb1f('0x20')](_0x414859)['then'](function(_0x1ddf5b){return _0x1ddf5b;});}return null;};}function removeEntity(_0x5cc38f,_0x1f27c1){return function(_0x9c899f){if(_0x9c899f){return _0x9c899f[_0xeb1f('0x21')]()[_0xeb1f('0x22')](function(){_0x5cc38f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38b672,_0x102010){return function(_0x23950c){if(!_0x23950c){_0x38b672[_0xeb1f('0x23')](0x194);}return _0x23950c;};}function handleError(_0x274a3d,_0x570182){_0x570182=_0x570182||0x1f4;return function(_0x4e6424){logger[_0xeb1f('0x24')](_0x4e6424[_0xeb1f('0x25')]);if(_0x4e6424['name']){delete _0x4e6424['name'];}_0x274a3d[_0xeb1f('0x15')](_0x570182)[_0xeb1f('0x26')](_0x4e6424);};}exports['index']=function(_0x4961b2,_0xfe0d4e){var _0x21beaa={},_0x1c10e9={},_0x350a9e={'count':0x0,'rows':[]};var _0x4cc17b=_[_0xeb1f('0x27')](db['FaxApplication'][_0xeb1f('0x28')],function(_0x25a345){return{'name':_0x25a345[_0xeb1f('0x29')],'type':_0x25a345[_0xeb1f('0x2a')]['key']};});_0x1c10e9[_0xeb1f('0x2b')]=_[_0xeb1f('0x27')](_0x4cc17b,_0xeb1f('0x2c'));_0x1c10e9[_0xeb1f('0x2d')]=_['keys'](_0x4961b2[_0xeb1f('0x2d')]);_0x1c10e9[_0xeb1f('0x2e')]=_[_0xeb1f('0x2f')](_0x1c10e9[_0xeb1f('0x2b')],_0x1c10e9[_0xeb1f('0x2d')]);_0x21beaa[_0xeb1f('0x30')]=_[_0xeb1f('0x2f')](_0x1c10e9['model'],qs[_0xeb1f('0x31')](_0x4961b2[_0xeb1f('0x2d')][_0xeb1f('0x31')]));_0x21beaa[_0xeb1f('0x30')]=_0x21beaa[_0xeb1f('0x30')][_0xeb1f('0x32')]?_0x21beaa[_0xeb1f('0x30')]:_0x1c10e9[_0xeb1f('0x2b')];if(!_0x4961b2[_0xeb1f('0x2d')][_0xeb1f('0x33')](_0xeb1f('0x34'))){_0x21beaa[_0xeb1f('0x19')]=qs[_0xeb1f('0x19')](_0x4961b2[_0xeb1f('0x2d')][_0xeb1f('0x19')]);_0x21beaa[_0xeb1f('0x17')]=qs[_0xeb1f('0x17')](_0x4961b2[_0xeb1f('0x2d')][_0xeb1f('0x17')]);}_0x21beaa[_0xeb1f('0x35')]=qs[_0xeb1f('0x36')](_0x4961b2[_0xeb1f('0x2d')][_0xeb1f('0x36')]);_0x21beaa[_0xeb1f('0x37')]=qs[_0xeb1f('0x2e')](_[_0xeb1f('0x38')](_0x4961b2[_0xeb1f('0x2d')],_0x1c10e9[_0xeb1f('0x2e')]),_0x4cc17b);if(_0x4961b2[_0xeb1f('0x2d')][_0xeb1f('0x39')]){_0x21beaa[_0xeb1f('0x37')]=_[_0xeb1f('0x3a')](_0x21beaa[_0xeb1f('0x37')],{'$or':_['map'](_0x4cc17b,function(_0x48330c){if(_0x48330c['type']!==_0xeb1f('0x3b')){var _0x5df5ef={};_0x5df5ef[_0x48330c[_0xeb1f('0x2c')]]={'$like':'%'+_0x4961b2['query'][_0xeb1f('0x39')]+'%'};return _0x5df5ef;}})});}_0x21beaa=_['merge']({},_0x21beaa,_0x4961b2['options']);var _0x102bf3={'where':_0x21beaa[_0xeb1f('0x37')]};return db['FaxApplication']['count'](_0x102bf3)[_0xeb1f('0x22')](function(_0x2156a1){_0x350a9e['count']=_0x2156a1;if(_0x4961b2[_0xeb1f('0x2d')][_0xeb1f('0x3c')]){_0x21beaa[_0xeb1f('0x3d')]=[{'all':!![]}];}return db[_0xeb1f('0x3e')][_0xeb1f('0x3f')](_0x21beaa);})[_0xeb1f('0x22')](function(_0x46dcc4){_0x350a9e[_0xeb1f('0x40')]=_0x46dcc4;return _0x350a9e;})['then'](respondWithFilteredResult(_0xfe0d4e,_0x21beaa))[_0xeb1f('0x41')](handleError(_0xfe0d4e,null));};exports[_0xeb1f('0x42')]=function(_0x1aa8d7,_0x9ff94d){var _0x3d500a={'raw':!![],'where':{'id':_0x1aa8d7[_0xeb1f('0x43')]['id']}},_0x1fb2e5={};_0x1fb2e5[_0xeb1f('0x2b')]=_[_0xeb1f('0x44')](db[_0xeb1f('0x3e')][_0xeb1f('0x28')]);_0x1fb2e5['query']=_[_0xeb1f('0x44')](_0x1aa8d7[_0xeb1f('0x2d')]);_0x1fb2e5[_0xeb1f('0x2e')]=_[_0xeb1f('0x2f')](_0x1fb2e5['model'],_0x1fb2e5[_0xeb1f('0x2d')]);_0x3d500a[_0xeb1f('0x30')]=_[_0xeb1f('0x2f')](_0x1fb2e5[_0xeb1f('0x2b')],qs['fields'](_0x1aa8d7['query'][_0xeb1f('0x31')]));_0x3d500a[_0xeb1f('0x30')]=_0x3d500a['attributes']['length']?_0x3d500a[_0xeb1f('0x30')]:_0x1fb2e5['model'];if(_0x1aa8d7[_0xeb1f('0x2d')][_0xeb1f('0x3c')]){_0x3d500a[_0xeb1f('0x3d')]=[{'all':!![]}];}_0x3d500a=_[_0xeb1f('0x3a')]({},_0x3d500a,_0x1aa8d7[_0xeb1f('0x45')]);return db[_0xeb1f('0x3e')][_0xeb1f('0x46')](_0x3d500a)[_0xeb1f('0x22')](handleEntityNotFound(_0x9ff94d,null))[_0xeb1f('0x22')](respondWithResult(_0x9ff94d,null))[_0xeb1f('0x41')](handleError(_0x9ff94d,null));};exports[_0xeb1f('0x47')]=function(_0x4ea5d4,_0x66028c){return db[_0xeb1f('0x3e')][_0xeb1f('0x47')](_0x4ea5d4['body'],{})[_0xeb1f('0x22')](respondWithResult(_0x66028c,0xc9))[_0xeb1f('0x41')](handleError(_0x66028c,null));};exports[_0xeb1f('0x20')]=function(_0x371fe1,_0x42fb3d){if(_0x371fe1[_0xeb1f('0x48')]['id']){delete _0x371fe1[_0xeb1f('0x48')]['id'];}return db[_0xeb1f('0x3e')][_0xeb1f('0x46')]({'where':{'id':_0x371fe1['params']['id']}})[_0xeb1f('0x22')](handleEntityNotFound(_0x42fb3d,null))[_0xeb1f('0x22')](saveUpdates(_0x371fe1[_0xeb1f('0x48')],null))[_0xeb1f('0x22')](respondWithResult(_0x42fb3d,null))[_0xeb1f('0x41')](handleError(_0x42fb3d,null));};exports[_0xeb1f('0x21')]=function(_0x539962,_0x1d0d3d){return db['FaxApplication'][_0xeb1f('0x46')]({'where':{'id':_0x539962[_0xeb1f('0x43')]['id']}})[_0xeb1f('0x22')](handleEntityNotFound(_0x1d0d3d,null))['then'](removeEntity(_0x1d0d3d,null))['catch'](handleError(_0x1d0d3d,null));}; \ No newline at end of file +var _0x4c31=['end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','FaxApplication','include','findAll','rows','catch','show','params','includeAll','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2873ab,_0x35f875){var _0x320348=function(_0x2a99ff){while(--_0x2a99ff){_0x2873ab['push'](_0x2873ab['shift']());}};_0x320348(++_0x35f875);}(_0x4c31,0x1df));var _0x14c3=function(_0x3e7392,_0x37a22d){_0x3e7392=_0x3e7392-0x0;var _0x50439d=_0x4c31[_0x3e7392];return _0x50439d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x14c3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14c3('0x1'));var rp=require(_0x14c3('0x2'));var moment=require(_0x14c3('0x3'));var BPromise=require(_0x14c3('0x4'));var Mustache=require(_0x14c3('0x5'));var util=require('util');var path=require(_0x14c3('0x6'));var sox=require(_0x14c3('0x7'));var csv=require(_0x14c3('0x8'));var ejs=require(_0x14c3('0x9'));var fs=require('fs');var fs_extra=require(_0x14c3('0xa'));var _=require(_0x14c3('0xb'));var squel=require('squel');var crypto=require(_0x14c3('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x14c3('0x8'));var querystring=require(_0x14c3('0xd'));var Papa=require(_0x14c3('0xe'));var Redis=require('ioredis');var authService=require(_0x14c3('0xf'));var qs=require(_0x14c3('0x10'));var as=require(_0x14c3('0x11'));var hardwareService=require(_0x14c3('0x12'));var logger=require('../../config/logger')(_0x14c3('0x13'));var utils=require(_0x14c3('0x14'));var config=require(_0x14c3('0x15'));var licenseUtil=require(_0x14c3('0x16'));var db=require(_0x14c3('0x17'))['db'];function respondWithStatusCode(_0xe03528,_0x558a75){_0x558a75=_0x558a75||0xcc;return function(_0x343bbe){if(_0x343bbe){return _0xe03528[_0x14c3('0x18')](_0x558a75);}return _0xe03528['status'](_0x558a75)[_0x14c3('0x19')]();};}function respondWithResult(_0x3fc26a,_0x26a0a8){_0x26a0a8=_0x26a0a8||0xc8;return function(_0x482913){if(_0x482913){return _0x3fc26a[_0x14c3('0x1a')](_0x26a0a8)[_0x14c3('0x1b')](_0x482913);}};}function respondWithFilteredResult(_0x58c36f,_0x5189dc){return function(_0x263fd0){if(_0x263fd0){var _0x4f9244=typeof _0x5189dc[_0x14c3('0x1c')]===_0x14c3('0x1d')&&typeof _0x5189dc[_0x14c3('0x1e')]===_0x14c3('0x1d');var _0x593d5f=_0x263fd0[_0x14c3('0x1f')];var _0xf2435a=_0x4f9244?0x0:_0x5189dc[_0x14c3('0x1c')];var _0x43a07c=_0x4f9244?_0x263fd0[_0x14c3('0x1f')]:_0x5189dc[_0x14c3('0x1c')]+_0x5189dc[_0x14c3('0x1e')];var _0xc5d1d1;if(_0x43a07c>=_0x593d5f){_0x43a07c=_0x593d5f;_0xc5d1d1=0xc8;}else{_0xc5d1d1=0xce;}_0x58c36f[_0x14c3('0x1a')](_0xc5d1d1);return _0x58c36f[_0x14c3('0x20')](_0x14c3('0x21'),_0xf2435a+'-'+_0x43a07c+'/'+_0x593d5f)['json'](_0x263fd0);}return null;};}function patchUpdates(_0xa1989e){return function(_0x2d03a7){try{jsonpatch[_0x14c3('0x22')](_0x2d03a7,_0xa1989e,!![]);}catch(_0x53ade2){return BPromise[_0x14c3('0x23')](_0x53ade2);}return _0x2d03a7['save']();};}function saveUpdates(_0x14eb25,_0x51ec7e){return function(_0x78b730){if(_0x78b730){return _0x78b730[_0x14c3('0x24')](_0x14eb25)[_0x14c3('0x25')](function(_0x365f66){return _0x365f66;});}return null;};}function removeEntity(_0x5cb8ff,_0x1642d0){return function(_0x2ac275){if(_0x2ac275){return _0x2ac275[_0x14c3('0x26')]()[_0x14c3('0x25')](function(){_0x5cb8ff[_0x14c3('0x1a')](0xcc)[_0x14c3('0x19')]();});}};}function handleEntityNotFound(_0x170859,_0x31ab89){return function(_0x1318c1){if(!_0x1318c1){_0x170859[_0x14c3('0x18')](0x194);}return _0x1318c1;};}function handleError(_0x3f0cc2,_0xc69ab9){_0xc69ab9=_0xc69ab9||0x1f4;return function(_0xade6a2){logger[_0x14c3('0x27')](_0xade6a2['stack']);if(_0xade6a2[_0x14c3('0x28')]){delete _0xade6a2[_0x14c3('0x28')];}_0x3f0cc2['status'](_0xc69ab9)[_0x14c3('0x29')](_0xade6a2);};}exports[_0x14c3('0x2a')]=function(_0x3e013e,_0x246f12){var _0x29b19a={},_0x3cbc8a={},_0x935035={'count':0x0,'rows':[]};var _0x5be36f=_['map'](db['FaxApplication'][_0x14c3('0x2b')],function(_0x5f4b16){return{'name':_0x5f4b16['fieldName'],'type':_0x5f4b16['type']['key']};});_0x3cbc8a[_0x14c3('0x2c')]=_[_0x14c3('0x2d')](_0x5be36f,'name');_0x3cbc8a[_0x14c3('0x2e')]=_[_0x14c3('0x2f')](_0x3e013e[_0x14c3('0x2e')]);_0x3cbc8a[_0x14c3('0x30')]=_[_0x14c3('0x31')](_0x3cbc8a['model'],_0x3cbc8a['query']);_0x29b19a[_0x14c3('0x32')]=_[_0x14c3('0x31')](_0x3cbc8a[_0x14c3('0x2c')],qs[_0x14c3('0x33')](_0x3e013e[_0x14c3('0x2e')][_0x14c3('0x33')]));_0x29b19a['attributes']=_0x29b19a[_0x14c3('0x32')][_0x14c3('0x34')]?_0x29b19a[_0x14c3('0x32')]:_0x3cbc8a[_0x14c3('0x2c')];if(!_0x3e013e[_0x14c3('0x2e')][_0x14c3('0x35')]('nolimit')){_0x29b19a[_0x14c3('0x1e')]=qs[_0x14c3('0x1e')](_0x3e013e[_0x14c3('0x2e')]['limit']);_0x29b19a['offset']=qs['offset'](_0x3e013e['query'][_0x14c3('0x1c')]);}_0x29b19a[_0x14c3('0x36')]=qs[_0x14c3('0x37')](_0x3e013e['query'][_0x14c3('0x37')]);_0x29b19a[_0x14c3('0x38')]=qs[_0x14c3('0x30')](_[_0x14c3('0x39')](_0x3e013e[_0x14c3('0x2e')],_0x3cbc8a['filters']),_0x5be36f);if(_0x3e013e[_0x14c3('0x2e')][_0x14c3('0x3a')]){_0x29b19a[_0x14c3('0x38')]=_[_0x14c3('0x3b')](_0x29b19a[_0x14c3('0x38')],{'$or':_['map'](_0x5be36f,function(_0x154388){if(_0x154388[_0x14c3('0x3c')]!=='VIRTUAL'){var _0x1a8acd={};_0x1a8acd[_0x154388[_0x14c3('0x28')]]={'$like':'%'+_0x3e013e['query'][_0x14c3('0x3a')]+'%'};return _0x1a8acd;}})});}_0x29b19a=_[_0x14c3('0x3b')]({},_0x29b19a,_0x3e013e[_0x14c3('0x3d')]);var _0x283d8a={'where':_0x29b19a[_0x14c3('0x38')]};return db[_0x14c3('0x3e')][_0x14c3('0x1f')](_0x283d8a)[_0x14c3('0x25')](function(_0x9f01c6){_0x935035[_0x14c3('0x1f')]=_0x9f01c6;if(_0x3e013e[_0x14c3('0x2e')]['includeAll']){_0x29b19a[_0x14c3('0x3f')]=[{'all':!![]}];}return db[_0x14c3('0x3e')][_0x14c3('0x40')](_0x29b19a);})[_0x14c3('0x25')](function(_0x2a2772){_0x935035[_0x14c3('0x41')]=_0x2a2772;return _0x935035;})[_0x14c3('0x25')](respondWithFilteredResult(_0x246f12,_0x29b19a))[_0x14c3('0x42')](handleError(_0x246f12,null));};exports[_0x14c3('0x43')]=function(_0x32b5a1,_0x19b549){var _0xc77195={'raw':!![],'where':{'id':_0x32b5a1[_0x14c3('0x44')]['id']}},_0x58341e={};_0x58341e[_0x14c3('0x2c')]=_['keys'](db['FaxApplication'][_0x14c3('0x2b')]);_0x58341e[_0x14c3('0x2e')]=_[_0x14c3('0x2f')](_0x32b5a1[_0x14c3('0x2e')]);_0x58341e[_0x14c3('0x30')]=_[_0x14c3('0x31')](_0x58341e[_0x14c3('0x2c')],_0x58341e[_0x14c3('0x2e')]);_0xc77195[_0x14c3('0x32')]=_[_0x14c3('0x31')](_0x58341e['model'],qs[_0x14c3('0x33')](_0x32b5a1[_0x14c3('0x2e')][_0x14c3('0x33')]));_0xc77195[_0x14c3('0x32')]=_0xc77195[_0x14c3('0x32')][_0x14c3('0x34')]?_0xc77195[_0x14c3('0x32')]:_0x58341e[_0x14c3('0x2c')];if(_0x32b5a1[_0x14c3('0x2e')][_0x14c3('0x45')]){_0xc77195[_0x14c3('0x3f')]=[{'all':!![]}];}_0xc77195=_[_0x14c3('0x3b')]({},_0xc77195,_0x32b5a1[_0x14c3('0x3d')]);return db[_0x14c3('0x3e')]['find'](_0xc77195)[_0x14c3('0x25')](handleEntityNotFound(_0x19b549,null))[_0x14c3('0x25')](respondWithResult(_0x19b549,null))[_0x14c3('0x42')](handleError(_0x19b549,null));};exports['create']=function(_0x52912d,_0x3f699b){return db['FaxApplication']['create'](_0x52912d[_0x14c3('0x46')],{})['then'](respondWithResult(_0x3f699b,0xc9))[_0x14c3('0x42')](handleError(_0x3f699b,null));};exports[_0x14c3('0x24')]=function(_0x1603a9,_0x1b0ebb){if(_0x1603a9[_0x14c3('0x46')]['id']){delete _0x1603a9[_0x14c3('0x46')]['id'];}return db[_0x14c3('0x3e')]['find']({'where':{'id':_0x1603a9[_0x14c3('0x44')]['id']}})[_0x14c3('0x25')](handleEntityNotFound(_0x1b0ebb,null))[_0x14c3('0x25')](saveUpdates(_0x1603a9[_0x14c3('0x46')],null))[_0x14c3('0x25')](respondWithResult(_0x1b0ebb,null))[_0x14c3('0x42')](handleError(_0x1b0ebb,null));};exports[_0x14c3('0x26')]=function(_0x1caa7a,_0x2b7fe1){return db[_0x14c3('0x3e')][_0x14c3('0x47')]({'where':{'id':_0x1caa7a[_0x14c3('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b7fe1,null))[_0x14c3('0x25')](removeEntity(_0x2b7fe1,null))['catch'](handleError(_0x2b7fe1,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 9cc3b80..e906abc 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 _0xd7a7=['lodash','util','../../config/logger','api','request-promise','path','../../config/environment','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x532462,_0x13da9e){var _0x1cf708=function(_0x3ccbab){while(--_0x3ccbab){_0x532462['push'](_0x532462['shift']());}};_0x1cf708(++_0x13da9e);}(_0xd7a7,0x18c));var _0x7d7a=function(_0x325bf4,_0x25b708){_0x325bf4=_0x325bf4-0x0;var _0x4478a0=_0xd7a7[_0x325bf4];return _0x4478a0;};'use strict';var _=require(_0x7d7a('0x0'));var util=require(_0x7d7a('0x1'));var logger=require(_0x7d7a('0x2'))(_0x7d7a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7d7a('0x4'));var fs=require('fs');var path=require(_0x7d7a('0x5'));var rimraf=require('rimraf');var config=require(_0x7d7a('0x6'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x365e7e,_0xf5900f){return _0x365e7e[_0x7d7a('0x7')](_0x7d7a('0x8'),attributes,{'tableName':_0x7d7a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7d7a('0xa'),'collate':_0x7d7a('0xb')});}; \ No newline at end of file +var _0x423d=['./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x449f15,_0x58f53c){var _0x111397=function(_0x3b245f){while(--_0x3b245f){_0x449f15['push'](_0x449f15['shift']());}};_0x111397(++_0x58f53c);}(_0x423d,0x125));var _0xd423=function(_0x45ad76,_0x1c40ea){_0x45ad76=_0x45ad76-0x0;var _0x47ee4b=_0x423d[_0x45ad76];return _0x47ee4b;};'use strict';var _=require('lodash');var util=require(_0xd423('0x0'));var logger=require(_0xd423('0x1'))('api');var moment=require(_0xd423('0x2'));var BPromise=require(_0xd423('0x3'));var rp=require(_0xd423('0x4'));var fs=require('fs');var path=require(_0xd423('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd423('0x6'));module[_0xd423('0x7')]=function(_0x32aa5b,_0x28e52f){return _0x32aa5b[_0xd423('0x8')](_0xd423('0x9'),attributes,{'tableName':_0xd423('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd423('0xb'),'collate':_0xd423('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 09ed1de..e7a3733 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 _0x2e3d=['info','request\x20sent','debug','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','update','options','raw','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2797c6,_0x37421b){var _0x54809f=function(_0x2d100c){while(--_0x2d100c){_0x2797c6['push'](_0x2797c6['shift']());}};_0x54809f(++_0x37421b);}(_0x2e3d,0x8c));var _0xd2e3=function(_0x3879de,_0x7cff5b){_0x3879de=_0x3879de-0x0;var _0x4d1488=_0x2e3d[_0x3879de];return _0x4d1488;};'use strict';var _=require(_0xd2e3('0x0'));var util=require(_0xd2e3('0x1'));var moment=require(_0xd2e3('0x2'));var BPromise=require(_0xd2e3('0x3'));var rs=require(_0xd2e3('0x4'));var fs=require('fs');var Redis=require(_0xd2e3('0x5'));var db=require(_0xd2e3('0x6'))['db'];var utils=require(_0xd2e3('0x7'));var logger=require(_0xd2e3('0x8'))('rpc');var config=require(_0xd2e3('0x9'));var jayson=require(_0xd2e3('0xa'));var client=jayson[_0xd2e3('0xb')][_0xd2e3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a3a97,_0xfcf840,_0x5c7736){return new BPromise(function(_0x3152a2,_0x5c10cc){return client[_0xd2e3('0xd')](_0x4a3a97,_0x5c7736)[_0xd2e3('0xe')](function(_0x2b9af0){logger[_0xd2e3('0xf')]('FaxApplication,\x20%s,\x20%s',_0xfcf840,_0xd2e3('0x10'));logger[_0xd2e3('0x11')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0xfcf840,_0xd2e3('0x10'),JSON[_0xd2e3('0x12')](_0x2b9af0));if(_0x2b9af0[_0xd2e3('0x13')]){if(_0x2b9af0['error'][_0xd2e3('0x14')]===0x1f4){logger[_0xd2e3('0x13')](_0xd2e3('0x15'),_0xfcf840,_0x2b9af0[_0xd2e3('0x13')][_0xd2e3('0x16')]);return _0x5c10cc(_0x2b9af0[_0xd2e3('0x13')][_0xd2e3('0x16')]);}logger[_0xd2e3('0x13')](_0xd2e3('0x15'),_0xfcf840,_0x2b9af0[_0xd2e3('0x13')][_0xd2e3('0x16')]);return _0x3152a2(_0x2b9af0[_0xd2e3('0x13')]['message']);}else{logger['info'](_0xd2e3('0x15'),_0xfcf840,_0xd2e3('0x10'));_0x3152a2(_0x2b9af0[_0xd2e3('0x17')][_0xd2e3('0x16')]);}})[_0xd2e3('0x18')](function(_0x42e147){logger[_0xd2e3('0x13')](_0xd2e3('0x15'),_0xfcf840,_0x42e147);_0x5c10cc(_0x42e147);});});}exports[_0xd2e3('0x19')]=function(_0x5830ea){var _0x1ce097=this;return new Promise(function(_0x4d7ec3,_0x597e9b){return db['FaxApplication'][_0xd2e3('0x1a')](_0x5830ea['body'],{'raw':_0x5830ea[_0xd2e3('0x1b')]?_0x5830ea['options'][_0xd2e3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5830ea['options']?_0x5830ea[_0xd2e3('0x1b')]['where']||null:null,'attributes':_0x5830ea[_0xd2e3('0x1b')]?_0x5830ea[_0xd2e3('0x1b')][_0xd2e3('0x1d')]||null:null,'limit':_0x5830ea['options']?_0x5830ea['options'][_0xd2e3('0x1e')]||null:null})[_0xd2e3('0xe')](function(_0x509398){logger['info']('UpdateFaxApplication',_0x5830ea);logger[_0xd2e3('0x11')](_0xd2e3('0x19'),_0x5830ea,JSON[_0xd2e3('0x12')](_0x509398));_0x4d7ec3(_0x509398);})[_0xd2e3('0x18')](function(_0x48b06b){logger[_0xd2e3('0x13')]('UpdateFaxApplication',_0x48b06b[_0xd2e3('0x16')],_0x5830ea);_0x597e9b(_0x1ce097['error'](0x1f4,_0x48b06b[_0xd2e3('0x16')]));});});}; \ No newline at end of file +var _0x9fce=['FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxApplication','update','options','raw','where','limit','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2fca5a,_0x1f0491){var _0x6cf97b=function(_0x411430){while(--_0x411430){_0x2fca5a['push'](_0x2fca5a['shift']());}};_0x6cf97b(++_0x1f0491);}(_0x9fce,0x99));var _0xe9fc=function(_0x4c321c,_0x3e9da0){_0x4c321c=_0x4c321c-0x0;var _0x25accb=_0x9fce[_0x4c321c];return _0x25accb;};'use strict';var _=require(_0xe9fc('0x0'));var util=require(_0xe9fc('0x1'));var moment=require(_0xe9fc('0x2'));var BPromise=require(_0xe9fc('0x3'));var rs=require(_0xe9fc('0x4'));var fs=require('fs');var Redis=require(_0xe9fc('0x5'));var db=require(_0xe9fc('0x6'))['db'];var utils=require(_0xe9fc('0x7'));var logger=require(_0xe9fc('0x8'))(_0xe9fc('0x9'));var config=require(_0xe9fc('0xa'));var jayson=require(_0xe9fc('0xb'));var client=jayson[_0xe9fc('0xc')][_0xe9fc('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5a4d6b,_0x41c616,_0x35aa38){return new BPromise(function(_0x37be81,_0x58d864){return client[_0xe9fc('0xe')](_0x5a4d6b,_0x35aa38)[_0xe9fc('0xf')](function(_0x252fd1){logger[_0xe9fc('0x10')](_0xe9fc('0x11'),_0x41c616,_0xe9fc('0x12'));logger[_0xe9fc('0x13')](_0xe9fc('0x14'),_0x41c616,_0xe9fc('0x12'),JSON[_0xe9fc('0x15')](_0x252fd1));if(_0x252fd1['error']){if(_0x252fd1[_0xe9fc('0x16')][_0xe9fc('0x17')]===0x1f4){logger[_0xe9fc('0x16')](_0xe9fc('0x11'),_0x41c616,_0x252fd1['error'][_0xe9fc('0x18')]);return _0x58d864(_0x252fd1[_0xe9fc('0x16')][_0xe9fc('0x18')]);}logger[_0xe9fc('0x16')](_0xe9fc('0x11'),_0x41c616,_0x252fd1[_0xe9fc('0x16')]['message']);return _0x37be81(_0x252fd1[_0xe9fc('0x16')][_0xe9fc('0x18')]);}else{logger[_0xe9fc('0x10')]('FaxApplication,\x20%s,\x20%s',_0x41c616,'request\x20sent');_0x37be81(_0x252fd1[_0xe9fc('0x19')]['message']);}})[_0xe9fc('0x1a')](function(_0x1cbcae){logger[_0xe9fc('0x16')]('FaxApplication,\x20%s,\x20%s',_0x41c616,_0x1cbcae);_0x58d864(_0x1cbcae);});});}exports['UpdateFaxApplication']=function(_0x1b11b7){var _0xcda88b=this;return new Promise(function(_0x37e789,_0x5bd0b1){return db[_0xe9fc('0x1b')][_0xe9fc('0x1c')](_0x1b11b7['body'],{'raw':_0x1b11b7[_0xe9fc('0x1d')]?_0x1b11b7[_0xe9fc('0x1d')][_0xe9fc('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b11b7['options']?_0x1b11b7['options'][_0xe9fc('0x1f')]||null:null,'attributes':_0x1b11b7[_0xe9fc('0x1d')]?_0x1b11b7[_0xe9fc('0x1d')]['attributes']||null:null,'limit':_0x1b11b7[_0xe9fc('0x1d')]?_0x1b11b7['options'][_0xe9fc('0x20')]||null:null})[_0xe9fc('0xf')](function(_0x21e13e){logger[_0xe9fc('0x10')](_0xe9fc('0x21'),_0x1b11b7);logger['debug'](_0xe9fc('0x21'),_0x1b11b7,JSON['stringify'](_0x21e13e));_0x37e789(_0x21e13e);})['catch'](function(_0x2675a3){logger[_0xe9fc('0x16')]('UpdateFaxApplication',_0x2675a3[_0xe9fc('0x18')],_0x1b11b7);_0x5bd0b1(_0xcda88b[_0xe9fc('0x16')](0x1f4,_0x2675a3[_0xe9fc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index c692a73..aff81ba 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 _0x13f6=['delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','post','create','put','update'];(function(_0x167f66,_0x1d8d76){var _0x568fc9=function(_0x17c422){while(--_0x17c422){_0x167f66['push'](_0x167f66['shift']());}};_0x568fc9(++_0x1d8d76);}(_0x13f6,0x124));var _0x613f=function(_0x4e6318,_0x54feed){_0x4e6318=_0x4e6318-0x0;var _0x22d424=_0x13f6[_0x4e6318];return _0x22d424;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x613f('0xa')]('/',auth[_0x613f('0x8')](),controller[_0x613f('0xb')]);router[_0x613f('0xc')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xd')]);router[_0x613f('0xe')]('/:id',auth[_0x613f('0x8')](),controller[_0x613f('0xf')]);module[_0x613f('0x10')]=router; \ No newline at end of file +var _0xb03e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x5c3588,_0x5150a9){var _0x4d6f46=function(_0x3e9757){while(--_0x3e9757){_0x5c3588['push'](_0x5c3588['shift']());}};_0x4d6f46(++_0x5150a9);}(_0xb03e,0x1eb));var _0xeb03=function(_0x5400b8,_0x3cb4cb){_0x5400b8=_0x5400b8-0x0;var _0x208f0b=_0xb03e[_0x5400b8];return _0x208f0b;};'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('0xe')]('/',auth[_0xeb03('0xb')](),controller['create']);router[_0xeb03('0xf')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller['update']);router[_0xeb03('0x10')]('/:id',auth[_0xeb03('0xb')](),controller[_0xeb03('0x11')]);module[_0xeb03('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 3fa5b63..4ee87d4 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 _0x53a9=['exports','BOOLEAN','DATE','STRING','out'];(function(_0x3e6b70,_0x37bc45){var _0x1283a2=function(_0x1f0ec4){while(--_0x1f0ec4){_0x3e6b70['push'](_0x3e6b70['shift']());}};_0x1283a2(++_0x37bc45);}(_0x53a9,0x154));var _0x953a=function(_0x408c7f,_0x47e89d){_0x408c7f=_0x408c7f-0x0;var _0x48cb70=_0x53a9[_0x408c7f];return _0x48cb70;};'use strict';var Sequelize=require('sequelize');module[_0x953a('0x0')]={'closed':{'type':Sequelize[_0x953a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x953a('0x2')]},'disposition':{'type':Sequelize[_0x953a('0x3')]},'secondDisposition':{'type':Sequelize[_0x953a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x953a('0x3')]},'note':{'type':Sequelize[_0x953a('0x3')]},'read1stAt':{'type':Sequelize[_0x953a('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x953a('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xdc98=['STRING','ENUM','exports','BOOLEAN','DATE'];(function(_0x519cd6,_0x1f07b4){var _0x26640b=function(_0x59c8c2){while(--_0x59c8c2){_0x519cd6['push'](_0x519cd6['shift']());}};_0x26640b(++_0x1f07b4);}(_0xdc98,0x14c));var _0x8dc9=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xdc98[_0x1f9f37];return _0x21c080;};'use strict';var Sequelize=require('sequelize');module[_0x8dc9('0x0')]={'closed':{'type':Sequelize[_0x8dc9('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8dc9('0x2')]},'disposition':{'type':Sequelize[_0x8dc9('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8dc9('0x3')]},'note':{'type':Sequelize[_0x8dc9('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x8dc9('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8dc9('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'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 7765666..1b28155 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 _0xf3c2=['pipe','createWriteStream','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','end','offset','undefined','count','set','json','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','FaxInteraction','rawAttributes','fieldName','type','key','model','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','select','color','from','tools_tags','field','u.id','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','start','body','keys','some','compact','where','i.FaxAccountId\x20IN\x20?','concat','$gte','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.fax\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','isEmpty','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','push','all','rows','params','intersection','includeAll','include','options','create','describe','addMessage','FaxMessage','ids','format','YYYY-MM-DD\x20HH:mm:ss','merge','addTags','omit','spread','Tag','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','createReadStream'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0xf3c2,0x1b5));var _0x2f3c=function(_0x3f5e43,_0x2995c5){_0x3f5e43=_0x3f5e43-0x0;var _0x378392=_0xf3c2[_0x3f5e43];return _0x378392;};'use strict';var emlformat=require(_0x2f3c('0x0'));var rimraf=require(_0x2f3c('0x1'));var zipdir=require(_0x2f3c('0x2'));var jsonpatch=require(_0x2f3c('0x3'));var rp=require(_0x2f3c('0x4'));var moment=require(_0x2f3c('0x5'));var BPromise=require(_0x2f3c('0x6'));var Mustache=require(_0x2f3c('0x7'));var util=require(_0x2f3c('0x8'));var path=require(_0x2f3c('0x9'));var sox=require(_0x2f3c('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f3c('0xb'));var squel=require(_0x2f3c('0xc'));var crypto=require(_0x2f3c('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2f3c('0xe'));var Papa=require('papaparse');var Redis=require(_0x2f3c('0xf'));var authService=require(_0x2f3c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2f3c('0x11'));var hardwareService=require(_0x2f3c('0x12'));var logger=require(_0x2f3c('0x13'))(_0x2f3c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2f3c('0x15'));var db=require(_0x2f3c('0x16'))['db'];config[_0x2f3c('0x17')]=_[_0x2f3c('0x18')](config[_0x2f3c('0x17')],{'host':_0x2f3c('0x19'),'port':0x18eb});var socket=require(_0x2f3c('0x1a'))(new Redis(config[_0x2f3c('0x17')]));require(_0x2f3c('0x1b'))['register'](socket);function respondWithStatusCode(_0x1ab1c5,_0x4516f2){_0x4516f2=_0x4516f2||0xcc;return function(_0x8fb447){if(_0x8fb447){return _0x1ab1c5[_0x2f3c('0x1c')](_0x4516f2);}return _0x1ab1c5['status'](_0x4516f2)[_0x2f3c('0x1d')]();};}function respondWithResult(_0x4b74aa,_0x188be1){_0x188be1=_0x188be1||0xc8;return function(_0x29deaa){if(_0x29deaa){return _0x4b74aa['status'](_0x188be1)['json'](_0x29deaa);}};}function respondWithFilteredResult(_0x13c8f0,_0x353c34){return function(_0x581983){if(_0x581983){var _0x23da71=typeof _0x353c34[_0x2f3c('0x1e')]===_0x2f3c('0x1f')&&typeof _0x353c34['limit']===_0x2f3c('0x1f');var _0x373c59=_0x581983[_0x2f3c('0x20')];var _0x44fcd0=_0x23da71?0x0:_0x353c34[_0x2f3c('0x1e')];var _0x369b0d=_0x23da71?_0x581983[_0x2f3c('0x20')]:_0x353c34[_0x2f3c('0x1e')]+_0x353c34['limit'];var _0x59570a;if(_0x369b0d>=_0x373c59){_0x369b0d=_0x373c59;_0x59570a=0xc8;}else{_0x59570a=0xce;}_0x13c8f0['status'](_0x59570a);return _0x13c8f0[_0x2f3c('0x21')]('Content-Range',_0x44fcd0+'-'+_0x369b0d+'/'+_0x373c59)[_0x2f3c('0x22')](_0x581983);}return null;};}function patchUpdates(_0x11f554){return function(_0x5ccacf){try{jsonpatch['apply'](_0x5ccacf,_0x11f554,!![]);}catch(_0x1886ee){return BPromise['reject'](_0x1886ee);}return _0x5ccacf['save']();};}function saveUpdates(_0x1f72f0,_0x7a4a09){return function(_0x2d3b28){if(_0x2d3b28){return _0x2d3b28[_0x2f3c('0x23')](_0x1f72f0)[_0x2f3c('0x24')](function(_0x1c99a8){return _0x1c99a8;});}return null;};}function removeEntity(_0x519dc3,_0x4468fc){return function(_0x1a488c){if(_0x1a488c){return _0x1a488c[_0x2f3c('0x25')]()[_0x2f3c('0x24')](function(){_0x519dc3['status'](0xcc)[_0x2f3c('0x1d')]();});}};}function handleEntityNotFound(_0x22b90c,_0x2c7f98){return function(_0x24c60e){if(!_0x24c60e){_0x22b90c['sendStatus'](0x194);}return _0x24c60e;};}function handleError(_0x2c46ee,_0x12a7a9){_0x12a7a9=_0x12a7a9||0x1f4;return function(_0x5ec3ac){logger['error'](_0x5ec3ac[_0x2f3c('0x26')]);if(_0x5ec3ac[_0x2f3c('0x27')]){delete _0x5ec3ac[_0x2f3c('0x27')];}_0x2c46ee['status'](_0x12a7a9)[_0x2f3c('0x28')](_0x5ec3ac);};}function getInteractionUsers(_0x426255,_0x5e443b){return new BPromise(function(_0x6d389,_0x38c2e8){try{if(_0x5e443b[_0x426255['id']]){_0x426255[_0x2f3c('0x29')]=_[_0x2f3c('0x2a')](_0x5e443b[_0x426255['id']],function(_0x3d1382){return{'id':_0x3d1382['id'],'fullname':_0x3d1382[_0x2f3c('0x2b')]};});}}catch(_0x40d87a){_0x38c2e8(_0x40d87a);}_0x6d389(_0x426255);});}function getInteractionTags(_0x4f8e44,_0x45d79e){return new BPromise(function(_0x770995,_0x2a9c9f){try{if(_0x4f8e44[_0x2f3c('0x2c')]){_0x4f8e44[_0x2f3c('0x2d')]=[];_0x4f8e44[_0x2f3c('0x2c')]['split'](',')['forEach'](function(_0x9f6702){_0x4f8e44[_0x2f3c('0x2d')]['push'](_0x45d79e[_0x9f6702]);});}delete _0x4f8e44[_0x2f3c('0x2c')];}catch(_0x364b43){_0x2a9c9f(_0x364b43);}_0x770995(_0x4f8e44);});}function updateFaxInteraction(_0x2bc563,_0x57aac7,_0x12844c){return new BPromise(function(_0x4ea2ce,_0x5578eb){return getInteractionUsers(_0x2bc563,_0x12844c)['then'](function(_0x35216b){return getInteractionTags(_0x35216b,_0x57aac7);})[_0x2f3c('0x24')](function(_0x1c9e52){return getStateInteraction(_0x1c9e52);})[_0x2f3c('0x24')](function(_0x47c132){_0x4ea2ce(_0x47c132);})[_0x2f3c('0x2e')](function(_0x28f91c){_0x5578eb(_0x28f91c);});});}function getStateInteraction(_0x2ca00b){return new BPromise(function(_0x46969b){_0x2ca00b[_0x2f3c('0x2f')]=0x0;_0x2ca00b[_0x2f3c('0x30')]=0x0;_0x2ca00b[_0x2f3c('0x31')]=0x0;_0x2ca00b[_0x2f3c('0x32')]=0x0;_0x2ca00b[_0x2f3c('0x33')]=0x0;if(!_0x2ca00b[_0x2f3c('0x34')]&&!_0x2ca00b[_0x2f3c('0x35')]){_0x2ca00b[_0x2f3c('0x2f')]+=0x1;}if(!_0x2ca00b[_0x2f3c('0x34')]&&_0x2ca00b[_0x2f3c('0x35')]){_0x2ca00b['talking']+=0x1;if(_0x2ca00b[_0x2f3c('0x2f')]){_0x2ca00b[_0x2f3c('0x2f')]-=0x1;}}if(_0x2ca00b[_0x2f3c('0x34')]&&_0x2ca00b[_0x2f3c('0x35')]){_0x2ca00b[_0x2f3c('0x31')]+=0x1;if(_0x2ca00b[_0x2f3c('0x30')]){_0x2ca00b['talking']-=0x1;}}if(_0x2ca00b[_0x2f3c('0x34')]&&!_0x2ca00b['UserId']){_0x2ca00b[_0x2f3c('0x32')]+=0x1;if(_0x2ca00b['waiting']){_0x2ca00b[_0x2f3c('0x2f')]-=0x1;}}_0x2ca00b[_0x2f3c('0x33')]+=0x1;_0x46969b(_0x2ca00b);});}exports[_0x2f3c('0x36')]=function(_0x2deaa8,_0x5f5815){var _0x4a044f={},_0x1b457d={},_0x2df6dc={'count':0x0,'rows':[]};var _0x4600ea=_[_0x2f3c('0x2a')](db[_0x2f3c('0x37')][_0x2f3c('0x38')],function(_0x18808a){return{'name':_0x18808a[_0x2f3c('0x39')],'type':_0x18808a[_0x2f3c('0x3a')][_0x2f3c('0x3b')]};});_0x1b457d[_0x2f3c('0x3c')]=_['map'](_0x4600ea,_0x2f3c('0x27'));_0x1b457d[_0x2f3c('0x3d')]=_['keys'](_0x2deaa8[_0x2f3c('0x3d')]);_0x1b457d['filters']=_['intersection'](_0x1b457d[_0x2f3c('0x3c')],_0x1b457d[_0x2f3c('0x3d')]);_0x4a044f['attributes']=_['intersection'](_0x1b457d[_0x2f3c('0x3c')],qs[_0x2f3c('0x3e')](_0x2deaa8[_0x2f3c('0x3d')]['fields']));_0x4a044f[_0x2f3c('0x3f')]=_0x4a044f['attributes'][_0x2f3c('0x40')]?_0x4a044f[_0x2f3c('0x3f')]:_0x1b457d['model'];if(!_0x2deaa8['query'][_0x2f3c('0x41')](_0x2f3c('0x42'))){_0x4a044f[_0x2f3c('0x43')]=qs[_0x2f3c('0x43')](_0x2deaa8[_0x2f3c('0x3d')]['limit']);_0x4a044f[_0x2f3c('0x1e')]=qs[_0x2f3c('0x1e')](_0x2deaa8[_0x2f3c('0x3d')][_0x2f3c('0x1e')]);}_0x4a044f[_0x2f3c('0x44')]=qs[_0x2f3c('0x45')](_0x2deaa8['query'][_0x2f3c('0x45')]);_0x4a044f['where']=qs['filters'](_[_0x2f3c('0x46')](_0x2deaa8[_0x2f3c('0x3d')],_0x1b457d[_0x2f3c('0x47')]),_0x4600ea);var _0x4ddf31=[];var _0x235602=squel[_0x2f3c('0x48')]()['field']('id')['field'](_0x2f3c('0x27'))['field'](_0x2f3c('0x49'))[_0x2f3c('0x4a')](_0x2f3c('0x4b'));var _0x5b6a58=squel['select']()[_0x2f3c('0x4c')](_0x2f3c('0x4d'))[_0x2f3c('0x4c')]('u.fullname')[_0x2f3c('0x4c')](_0x2f3c('0x4e'))['from'](_0x2f3c('0x4f'),'ui')['left_join'](_0x2f3c('0x50'),'u',_0x2f3c('0x51'));var _0x16f774=squel['select']()['from'](_0x2f3c('0x52'),'i')[_0x2f3c('0x53')](_0x2f3c('0x54'),'c',_0x2f3c('0x55'))['left_join'](_0x2f3c('0x50'),'o',_0x2f3c('0x56'))[_0x2f3c('0x53')](_0x2f3c('0x57'),'a',_0x2f3c('0x58'))[_0x2f3c('0x53')](_0x2f3c('0x59'),'me',_0x2f3c('0x5a'))[_0x2f3c('0x53')](_0x2f3c('0x5b'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x2f3c('0x53')](_0x2f3c('0x4b'),'t','t.id\x20=\x20it.TagId');var _0x52200d=squel[_0x2f3c('0x5c')]();var _0x606f2c=[];var _0x52ddf1=squel[_0x2f3c('0x5c')]();var _0x4d7cad;if(_0x2deaa8[_0x2f3c('0x3d')][_0x2f3c('0x5d')]){_0x4d7cad=as[_0x2f3c('0x5e')](_0x2deaa8[_0x2f3c('0x3d')][_0x2f3c('0x5d')]);var _0x55eecc=_0x4d7cad[_0x2f3c('0x5f')];for(var _0x72ebbc=0x0;_0x72ebbc<_0x4d7cad[_0x2f3c('0x60')][_0x2f3c('0x40')];_0x72ebbc++){var _0x414742=_0x4d7cad['conditions'][_0x72ebbc];var _0x2e3fc6='i';var _0x4022a3=_[_0x2f3c('0x61')](_0x4600ea,[_0x2f3c('0x27'),_0x414742[_0x2f3c('0x4c')]]);if(!_0x4022a3){switch(_0x414742[_0x2f3c('0x4c')]){case'unreadMessages':if(_0x414742['value']==0x1){_0x16f774[_0x2f3c('0x62')]('`'+_0x414742[_0x2f3c('0x4c')]+_0x2f3c('0x63'));}else{_0x16f774['having']('`'+_0x414742[_0x2f3c('0x4c')]+_0x2f3c('0x64'));}break;case'Contact':if(_0x414742[_0x2f3c('0x65')]===_0x2f3c('0x66')){if(_0x414742[_0x2f3c('0x67')][_0x2f3c('0x68')]('\x20')[_0x2f3c('0x40')]>0x1){_0x52200d[_0x55eecc](_0x2f3c('0x69'),qs[_0x2f3c('0x6a')](_0x414742['value']),null);}else{var _0xbe69c3='%'+_0x414742[_0x2f3c('0x67')]+'%';_0x52200d[_0x55eecc]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xbe69c3,_0xbe69c3,_0xbe69c3);}}else{_0x4022a3=_[_0x2f3c('0x61')](_0x4600ea,[_0x2f3c('0x27'),_0x2f3c('0x6b')]);_0x414742[_0x2f3c('0x4c')]=_0x2f3c('0x6b');_0x2c3b10=as[_0x2f3c('0x6c')](_0x2e3fc6,_0x4022a3[_0x2f3c('0x3a')],_0x414742);_0x52200d[_0x55eecc](_0x2c3b10[_0x2f3c('0x6d')],_0x2c3b10[_0x2f3c('0x67')]['start'],_0x2c3b10['value'][_0x2f3c('0x1d')]);}break;case'Tag':var _0x43d15c=_0x414742['value'][_0x2f3c('0x68')](',')['map'](function(_0x3bc584){return Number(_0x3bc584);});_0x43d15c[_0x2f3c('0x6e')](function(_0x279371){_0x52ddf1['or'](_0x2f3c('0x6f'),'%,'+_0x279371+',%');});_0x606f2c=_[_0x2f3c('0x70')](_0x606f2c,_0x43d15c);break;case _0x2f3c('0x71'):if(_0x414742['operator']===_0x2f3c('0x66')){_0x52200d[_0x55eecc]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x414742[_0x2f3c('0x67')]+'%',null);}else{_0x4022a3=_[_0x2f3c('0x61')](_0x4600ea,[_0x2f3c('0x27'),_0x2f3c('0x35')]);_0x414742[_0x2f3c('0x4c')]='UserId';_0x2c3b10=as[_0x2f3c('0x6c')](_0x2e3fc6,_0x4022a3[_0x2f3c('0x3a')],_0x414742);_0x52200d[_0x55eecc](_0x2c3b10['text'],_0x2c3b10[_0x2f3c('0x67')][_0x2f3c('0x72')],_0x2c3b10[_0x2f3c('0x67')][_0x2f3c('0x1d')]);}break;case _0x2f3c('0x73'):_0x2c3b10=as[_0x2f3c('0x6c')]('me',null,_0x414742);_0x52200d[_0x55eecc](_0x2c3b10[_0x2f3c('0x6d')],_0x2c3b10[_0x2f3c('0x67')][_0x2f3c('0x72')],_0x2c3b10['value'][_0x2f3c('0x1d')]);break;}}else{var _0x2c3b10=as[_0x2f3c('0x6c')](_0x2e3fc6,_0x4022a3[_0x2f3c('0x3a')],_0x414742);_0x52200d[_0x55eecc](_0x2c3b10[_0x2f3c('0x6d')],_0x2c3b10[_0x2f3c('0x67')][_0x2f3c('0x72')],_0x2c3b10[_0x2f3c('0x67')][_0x2f3c('0x1d')]);}}}else{var _0xb0b3ff=_(_0x2deaa8[_0x2f3c('0x3d')])[_0x2f3c('0x74')]()[_0x2f3c('0x2a')](function(_0x4ef14b){return _[_0x2f3c('0x75')](_0x4600ea,[_0x2f3c('0x27'),_0x4ef14b])?_0x4ef14b:undefined;})[_0x2f3c('0x76')]()[_0x2f3c('0x67')]();if(!_['isEmpty'](_0xb0b3ff)){_0xb0b3ff[_0x2f3c('0x6e')](function(_0x1d2ab1){if(_0x1d2ab1==='FaxAccountId'){_0x16f774[_0x2f3c('0x77')](_0x2f3c('0x78'),[][_0x2f3c('0x79')](_0x2deaa8[_0x2f3c('0x3d')][_0x1d2ab1]));}else if(_0x1d2ab1==='createdAt'){var _0x356f47=JSON['parse'](_0x2deaa8[_0x2f3c('0x3d')][_0x1d2ab1])[_0x2f3c('0x7a')];var _0x37119e=JSON['parse'](_0x2deaa8[_0x2f3c('0x3d')][_0x1d2ab1])['$lte'];_0x16f774[_0x2f3c('0x77')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x356f47,_0x37119e);}else{if(_0x2deaa8[_0x2f3c('0x3d')][_0x1d2ab1]===_0x2f3c('0x7b')){_0x16f774[_0x2f3c('0x77')]('i.'+_0x1d2ab1+_0x2f3c('0x7c'));}else{_0x16f774[_0x2f3c('0x77')]('i.'+_0x1d2ab1+'\x20=\x20?',_0x2deaa8[_0x2f3c('0x3d')][_0x1d2ab1]);}}});}if(_0x2deaa8[_0x2f3c('0x3d')][_0x2f3c('0x7d')]){if(_0x2deaa8[_0x2f3c('0x3d')][_0x2f3c('0x7d')]==0x1){_0x16f774['having']('`unreadMessages`\x20=\x200');}else{_0x16f774[_0x2f3c('0x62')](_0x2f3c('0x7e'));}}if(_0x2deaa8[_0x2f3c('0x3d')][_0x2f3c('0x7f')]){_0x606f2c=_[_0x2f3c('0x80')](_0x2deaa8[_0x2f3c('0x3d')][_0x2f3c('0x7f')])?_0x2deaa8[_0x2f3c('0x3d')][_0x2f3c('0x7f')]:new Array(_0x2deaa8[_0x2f3c('0x3d')][_0x2f3c('0x7f')]);_0x606f2c['forEach'](function(_0x226062){_0x52ddf1['or'](_0x2f3c('0x6f'),'%,'+_0x226062+',%');});}if(_0x2deaa8[_0x2f3c('0x3d')]['filter']){var _0x57c824=_0x2deaa8[_0x2f3c('0x3d')][_0x2f3c('0x81')][_0x2f3c('0x82')]('\x5c','\x5c\x5c')[_0x2f3c('0x82')](/'/g,'\x27\x27');if(qs[_0x2f3c('0x83')](_0x57c824)){_0x52200d['or']('i.id\x20LIKE\x20?',_0x57c824+'%')['or'](_0x2f3c('0x84'),_0x57c824+'%');}_0x52200d['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x57c824+'%');}}_0x16f774[_0x2f3c('0x77')](_0x52200d);_0x16f774[_0x2f3c('0x85')](_0x2f3c('0x86'));var _0x1e9f62={'type':db[_0x2f3c('0x87')]['QueryTypes'][_0x2f3c('0x88')],'raw':!![]};var _0x1055e4=_0x16f774[_0x2f3c('0x89')]();_0x1055e4[_0x2f3c('0x4c')](_0x2f3c('0x86'));_0x1055e4[_0x2f3c('0x4c')](_0x2f3c('0x8a'),_0x2f3c('0x8b'));if(_0x4a044f['order']){_0x4a044f[_0x2f3c('0x44')][_0x2f3c('0x6e')](function(_0xd45f97){var _0x5a6583=_0xd45f97[0x0]===_0x2f3c('0x8c')?_0xd45f97[0x0]:'i.'+_0xd45f97[0x0];_0x16f774[_0x2f3c('0x44')](_0x5a6583,_0xd45f97[0x1]==='DESC'?![]:!![]);});}if(!_[_0x2f3c('0x8d')](_0x606f2c)){_0x16f774[_0x2f3c('0x62')](_0x52ddf1);_0x1055e4[_0x2f3c('0x77')](_0x2f3c('0x8e'),_0x606f2c);}BPromise[_0x2f3c('0x8f')]()[_0x2f3c('0x24')](function(){if(!_0x4d7cad){if(_0x2deaa8['query'][_0x2f3c('0x90')])return;_0x1055e4[_0x2f3c('0x77')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x16f774['where'](_0x2f3c('0x91'));return;}if(_0x2deaa8[_0x2f3c('0x92')]['role']!==_0x2f3c('0x93'))return;return _0x2deaa8[_0x2f3c('0x92')][_0x2f3c('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0xd4b62){if(_[_0x2f3c('0x8d')](_0xd4b62)){_0x1055e4['where'](_0x2f3c('0x95'));_0x16f774['where'](_0x2f3c('0x95'));}else{_0x1055e4[_0x2f3c('0x77')](_0x2f3c('0x78'),_[_0x2f3c('0x2a')](_0xd4b62,'id'));_0x16f774[_0x2f3c('0x77')](_0x2f3c('0x78'),_[_0x2f3c('0x2a')](_0xd4b62,'id'));}});})[_0x2f3c('0x24')](function(){if(_0x2deaa8[_0x2f3c('0x92')][_0x2f3c('0x96')]===_0x2f3c('0x93')&&!_0x4d7cad&&!_0x2deaa8[_0x2f3c('0x3d')][_0x2f3c('0x90')])return[];return db[_0x2f3c('0x97')][_0x2f3c('0x3d')](_0x1055e4['toString'](),_0x1e9f62);})['then'](function(_0x2afe27){_0x2df6dc['count']=_0x2afe27[_0x2f3c('0x40')];if(_0x2df6dc[_0x2f3c('0x20')]===0x0)return[];return db['sequelize'][_0x2f3c('0x3d')](_0x235602[_0x2f3c('0x98')](),_0x1e9f62)[_0x2f3c('0x24')](function(_0x2cdb73){_0x4ddf31=_[_0x2f3c('0x99')](_0x2cdb73,'id');_0x1e9f62=_['merge'](_0x1e9f62,{'model':db[_0x2f3c('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2deaa8[_0x2f3c('0x3d')][_0x2f3c('0x3e')]){_0x4a044f[_0x2f3c('0x3f')]['forEach'](function(_0x4bbd9d){_0x16f774[_0x2f3c('0x4c')]('i.'+_0x4bbd9d);});}else{_0x16f774['field'](_0x2f3c('0x8a'),_0x2f3c('0x8b'));_0x16f774[_0x2f3c('0x4c')](_0x2f3c('0x9a'),_0x2f3c('0x9b'));_0x16f774[_0x2f3c('0x4c')](_0x2f3c('0x9c'),_0x2f3c('0x9d'));_0x16f774[_0x2f3c('0x4c')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x2f3c('0x8c'));_0x16f774['field'](_0x2f3c('0x9e'));_0x16f774['field'](_0x2f3c('0x9f'),_0x2f3c('0xa0'));_0x16f774[_0x2f3c('0x4c')](_0x2f3c('0xa1'),_0x2f3c('0xa2'));_0x16f774[_0x2f3c('0x4c')](_0x2f3c('0xa3'),_0x2f3c('0xa4'));_0x16f774[_0x2f3c('0x4c')]('c.phone','Contact.phone');_0x16f774[_0x2f3c('0x4c')](_0x2f3c('0xa5'),_0x2f3c('0xa6'));_0x16f774[_0x2f3c('0x4c')](_0x2f3c('0xa7'),_0x2f3c('0xa8'));_0x16f774['field'](_0x2f3c('0xa9'),'Owner.fullname');_0x16f774['field'](_0x2f3c('0xaa'),_0x2f3c('0xab'));_0x16f774[_0x2f3c('0x4c')](_0x2f3c('0xac'),_0x2f3c('0x2c'));}if(_0x4a044f['limit'])_0x16f774[_0x2f3c('0x43')](_0x4a044f[_0x2f3c('0x43')]);if(_0x4a044f[_0x2f3c('0x1e')])_0x16f774[_0x2f3c('0x1e')](_0x4a044f[_0x2f3c('0x1e')]);return db['sequelize']['query'](_0x16f774[_0x2f3c('0x98')](),_0x1e9f62);})[_0x2f3c('0x24')](function(_0x519b14){if(_0x519b14[_0x2f3c('0x40')]>0x0)_0x5b6a58[_0x2f3c('0x77')](_0x2f3c('0xad'),_[_0x2f3c('0x2a')](_0x519b14,'id'));return db['sequelize'][_0x2f3c('0x3d')](_0x5b6a58['toString'](),_0x1e9f62)[_0x2f3c('0x24')](function(_0x5a3b7d){var _0x333959=_[_0x2f3c('0xae')](_0x5a3b7d,_0x2f3c('0xaf'));var _0x293b51=[];_0x519b14['forEach'](function(_0x400f25){_0x293b51[_0x2f3c('0xb0')](updateFaxInteraction(_0x400f25,_0x4ddf31,_0x333959));});return BPromise[_0x2f3c('0xb1')](_0x293b51);});});})[_0x2f3c('0x24')](function(_0x322c67){_0x2df6dc[_0x2f3c('0xb2')]=_0x322c67;return _0x2df6dc;})['then'](respondWithFilteredResult(_0x5f5815,_0x4a044f))[_0x2f3c('0x2e')](handleError(_0x5f5815,null));};exports['show']=function(_0x2142e1,_0x266461){var _0x11a26d={'raw':![],'where':{'id':_0x2142e1[_0x2f3c('0xb3')]['id']}},_0x4bf732={};_0x4bf732[_0x2f3c('0x3c')]=_['keys'](db[_0x2f3c('0x37')][_0x2f3c('0x38')]);_0x4bf732[_0x2f3c('0x3d')]=_[_0x2f3c('0x74')](_0x2142e1[_0x2f3c('0x3d')]);_0x4bf732[_0x2f3c('0x47')]=_[_0x2f3c('0xb4')](_0x4bf732[_0x2f3c('0x3c')],_0x4bf732[_0x2f3c('0x3d')]);_0x11a26d[_0x2f3c('0x3f')]=_[_0x2f3c('0xb4')](_0x4bf732[_0x2f3c('0x3c')],qs['fields'](_0x2142e1[_0x2f3c('0x3d')][_0x2f3c('0x3e')]));_0x11a26d[_0x2f3c('0x3f')]=_0x11a26d[_0x2f3c('0x3f')][_0x2f3c('0x40')]?_0x11a26d[_0x2f3c('0x3f')]:_0x4bf732[_0x2f3c('0x3c')];if(_0x2142e1[_0x2f3c('0x3d')][_0x2f3c('0xb5')]){_0x11a26d[_0x2f3c('0xb6')]=[{'all':!![]}];}_0x11a26d=_['merge']({},_0x11a26d,_0x2142e1[_0x2f3c('0xb7')]);return db[_0x2f3c('0x37')][_0x2f3c('0x61')](_0x11a26d)[_0x2f3c('0x24')](handleEntityNotFound(_0x266461,null))['then'](respondWithResult(_0x266461,null))[_0x2f3c('0x2e')](handleError(_0x266461,null));};exports[_0x2f3c('0xb8')]=function(_0xb6b6ea,_0x54636f){return db[_0x2f3c('0x37')][_0x2f3c('0xb8')](_0xb6b6ea[_0x2f3c('0x73')],{})[_0x2f3c('0x24')](respondWithResult(_0x54636f,0xc9))[_0x2f3c('0x2e')](handleError(_0x54636f,null));};exports[_0x2f3c('0x23')]=function(_0x2f5ba3,_0x4cd179){if(_0x2f5ba3['body']['id']){delete _0x2f5ba3[_0x2f3c('0x73')]['id'];}return db[_0x2f3c('0x37')][_0x2f3c('0x61')]({'where':{'id':_0x2f5ba3[_0x2f3c('0xb3')]['id']}})['then'](handleEntityNotFound(_0x4cd179,null))[_0x2f3c('0x24')](saveUpdates(_0x2f5ba3[_0x2f3c('0x73')],null))['then'](respondWithResult(_0x4cd179,null))[_0x2f3c('0x2e')](handleError(_0x4cd179,null));};exports[_0x2f3c('0x25')]=function(_0x234240,_0x2d6a52){return db['FaxInteraction']['find']({'where':{'id':_0x234240[_0x2f3c('0xb3')]['id']}})[_0x2f3c('0x24')](handleEntityNotFound(_0x2d6a52,null))['then'](removeEntity(_0x2d6a52,null))[_0x2f3c('0x2e')](handleError(_0x2d6a52,null));};exports[_0x2f3c('0xb9')]=function(_0x4b972f,_0x4d305b){return db[_0x2f3c('0x37')][_0x2f3c('0xb9')]()[_0x2f3c('0x24')](respondWithResult(_0x4d305b,null))[_0x2f3c('0x2e')](handleError(_0x4d305b,null));};exports[_0x2f3c('0xba')]=function(_0x5b4d1c,_0x112c01,_0x265603){return db[_0x2f3c('0xbb')][_0x2f3c('0x61')]({'where':{'id':_0x5b4d1c[_0x2f3c('0xb3')]['id']}})['then'](handleEntityNotFound(_0x112c01,null))[_0x2f3c('0x24')](function(_0x375daf){if(_0x375daf){return _0x375daf[_0x2f3c('0xba')](_0x5b4d1c[_0x2f3c('0x73')][_0x2f3c('0xbc')],_['omit'](_0x5b4d1c[_0x2f3c('0x73')],[_0x2f3c('0xbc'),'id'])||{});}})['then'](respondWithResult(_0x112c01,null))[_0x2f3c('0x2e')](handleError(_0x112c01,null));};exports['getMessages']=function(_0x24c69e,_0x41ed6c,_0x338796){var _0x59a4cb={'raw':![],'where':{}};var _0x3b687c={};var _0x26b368={'count':0x0,'rows':[]};return db[_0x2f3c('0x37')]['findOne']({'where':{'id':_0x24c69e[_0x2f3c('0xb3')]['id']}})['then'](handleEntityNotFound(_0x41ed6c,null))[_0x2f3c('0x24')](function(_0x298360){if(_0x298360){_0x3b687c[_0x2f3c('0x3c')]=_[_0x2f3c('0x74')](db[_0x2f3c('0xbb')][_0x2f3c('0x38')]);_0x3b687c[_0x2f3c('0x3d')]=_[_0x2f3c('0x74')](_0x24c69e[_0x2f3c('0x3d')]);_0x3b687c[_0x2f3c('0x47')]=_[_0x2f3c('0xb4')](_0x3b687c[_0x2f3c('0x3c')],_0x3b687c[_0x2f3c('0x3d')]);_0x59a4cb[_0x2f3c('0x3f')]=_[_0x2f3c('0xb4')](_0x3b687c['model'],qs['fields'](_0x24c69e[_0x2f3c('0x3d')]['fields']));_0x59a4cb[_0x2f3c('0x3f')]=_0x59a4cb[_0x2f3c('0x3f')][_0x2f3c('0x40')]?_0x59a4cb[_0x2f3c('0x3f')]:_0x3b687c[_0x2f3c('0x3c')];if(!_0x24c69e[_0x2f3c('0x3d')][_0x2f3c('0x41')](_0x2f3c('0x42'))){_0x59a4cb['limit']=qs[_0x2f3c('0x43')](_0x24c69e[_0x2f3c('0x3d')][_0x2f3c('0x43')]);_0x59a4cb[_0x2f3c('0x1e')]=qs[_0x2f3c('0x1e')](_0x24c69e['query'][_0x2f3c('0x1e')]);}_0x59a4cb[_0x2f3c('0x44')]=qs['sort'](_0x24c69e[_0x2f3c('0x3d')][_0x2f3c('0x45')]);_0x59a4cb[_0x2f3c('0x77')]=qs['filters'](_[_0x2f3c('0x46')](_0x24c69e[_0x2f3c('0x3d')],_0x3b687c[_0x2f3c('0x47')]));_0x59a4cb[_0x2f3c('0x77')][_0x2f3c('0xaf')]=_0x298360['id'];if(_0x24c69e[_0x2f3c('0x3d')][_0x2f3c('0x81')]){_0x59a4cb[_0x2f3c('0x77')]=_['merge'](_0x59a4cb[_0x2f3c('0x77')],{'$or':_[_0x2f3c('0x2a')](_0x59a4cb[_0x2f3c('0x3f')],function(_0x429e18){var _0x40399a={};_0x40399a[_0x429e18]={'$like':'%'+_0x24c69e[_0x2f3c('0x3d')][_0x2f3c('0x81')]+'%'};return _0x40399a;})});}if(_0x24c69e[_0x2f3c('0x3d')][_0x2f3c('0x7a')]){var _0x1bba10=_0x24c69e[_0x2f3c('0x3d')][_0x2f3c('0x7a')][_0x2f3c('0x68')](',');var _0x4d48d9={};_0x4d48d9[_0x1bba10[0x0]]={'$gte':moment(_0x1bba10[0x1])[_0x2f3c('0xbd')](_0x2f3c('0xbe'))};_0x59a4cb[_0x2f3c('0x77')]=_[_0x2f3c('0xbf')](_0x59a4cb[_0x2f3c('0x77')],_0x4d48d9);}_0x59a4cb=_[_0x2f3c('0xbf')]({},_0x59a4cb,_0x24c69e[_0x2f3c('0xb7')]);return db[_0x2f3c('0xbb')][_0x2f3c('0x20')]({'where':_0x59a4cb[_0x2f3c('0x77')]})['then'](function(_0x2b1b7e){_0x26b368[_0x2f3c('0x20')]=_0x2b1b7e;if(_0x24c69e[_0x2f3c('0x3d')]['includeAll']){_0x59a4cb[_0x2f3c('0xb6')]=[{'all':!![]}];}return db[_0x2f3c('0xbb')]['findAll'](_0x59a4cb);})[_0x2f3c('0x24')](function(_0x656f14){_0x26b368['rows']=_0x656f14;return _0x26b368;});}})['then'](respondWithFilteredResult(_0x41ed6c,_0x59a4cb))['catch'](handleError(_0x41ed6c,null));};exports[_0x2f3c('0xc0')]=function(_0x96da0e,_0x2062f4,_0x52b8b9){return db[_0x2f3c('0x37')][_0x2f3c('0x61')]({'where':{'id':_0x96da0e[_0x2f3c('0xb3')]['id']}})[_0x2f3c('0x24')](handleEntityNotFound(_0x2062f4,null))[_0x2f3c('0x24')](function(_0x31af04){if(_0x31af04){return _0x31af04['setTags'](_0x96da0e[_0x2f3c('0x73')][_0x2f3c('0xbc')],_[_0x2f3c('0xc1')](_0x96da0e[_0x2f3c('0x73')],[_0x2f3c('0xbc'),'id'])||{})[_0x2f3c('0xc2')](function(){return db[_0x2f3c('0xc3')]['findAll']({'attributes':['id',_0x2f3c('0x27'),_0x2f3c('0x49')],'where':{'id':_0x96da0e['body'][_0x2f3c('0xbc')]}});})[_0x2f3c('0x24')](function(_0xeb3919){socket['emit']('faxInteractionTags:save',{'id':Number(_0x96da0e[_0x2f3c('0xb3')]['id']),'tags':_0xeb3919||[]});return{'id':Number(_0x96da0e[_0x2f3c('0xb3')]['id']),'tags':_0xeb3919||[]};});}})[_0x2f3c('0x24')](respondWithResult(_0x2062f4,null))[_0x2f3c('0x2e')](handleError(_0x2062f4,null));};exports[_0x2f3c('0xc4')]=function(_0x5c7ed4,_0x45f73a,_0x225564){return db[_0x2f3c('0x37')][_0x2f3c('0x61')]({'where':{'id':_0x5c7ed4[_0x2f3c('0xb3')]['id']}})[_0x2f3c('0x24')](handleEntityNotFound(_0x45f73a,null))[_0x2f3c('0x24')](function(_0x8545d1){if(_0x8545d1){return _0x8545d1[_0x2f3c('0xc4')](_0x5c7ed4[_0x2f3c('0x3d')][_0x2f3c('0xbc')]);}})['then'](respondWithStatusCode(_0x45f73a,null))['catch'](handleError(_0x45f73a,null));};exports[_0x2f3c('0xc5')]=function(_0x1731b5,_0x414af1){var _0x1c78d1=moment()['unix']()[_0x2f3c('0x98')]();var _0x3166b7=path[_0x2f3c('0xc6')](config[_0x2f3c('0xc7')],_0x2f3c('0xc8'),_0x2f3c('0xc9'),_0x2f3c('0xca'));var _0x1e6143=path[_0x2f3c('0xc6')](config[_0x2f3c('0xc7')],_0x2f3c('0xc8'),_0x2f3c('0xc9'),_0x2f3c('0xcb'));var _0x2526f3=path[_0x2f3c('0xc6')](_0x3166b7,_0x1c78d1);var _0x6d83fa=util['format'](_0x2f3c('0xcc'),_0x1731b5[_0x2f3c('0xb3')]['id'],_0x1c78d1);var _0x2610ee=path[_0x2f3c('0xc6')](_0x3166b7,_0x6d83fa);var _0x44d6b0=[];_0x44d6b0[_0x2f3c('0xb0')]({'model':db[_0x2f3c('0xcd')],'as':_0x2f3c('0xcd'),'raw':!![]});var _0x5749dc=[{'model':db[_0x2f3c('0xbb')],'as':_0x2f3c('0xce'),'attributes':['id',_0x2f3c('0x73'),'createdAt'],'include':_0x44d6b0}];return db[_0x2f3c('0x37')]['find']({'where':{'id':_0x1731b5[_0x2f3c('0xb3')]['id']},'include':_0x5749dc})[_0x2f3c('0x24')](handleEntityNotFound(_0x414af1,null))[_0x2f3c('0x24')](function(_0x3617c1){if(_0x3617c1&&_0x3617c1[_0x2f3c('0xce')]){var _0x52a764=_0x3617c1[_0x2f3c('0xcf')]({'plain':!![]});fs[_0x2f3c('0xd0')](_0x2526f3);for(var _0x44aea3=0x0;_0x44aea3<_0x52a764[_0x2f3c('0xce')][_0x2f3c('0x40')];_0x44aea3++){var _0xd3c4be=_0x52a764[_0x2f3c('0xce')][_0x44aea3]['Attachment'];if(_0xd3c4be){var _0x10287d=path[_0x2f3c('0xc6')](_0x1e6143,_0xd3c4be[_0x2f3c('0xd1')]);if(fs['existsSync'](_0x10287d)){fs[_0x2f3c('0xd2')](_0x10287d)[_0x2f3c('0xd3')](fs[_0x2f3c('0xd4')](path['join'](_0x2526f3,_0xd3c4be[_0x2f3c('0xd1')])));}}}return BPromise[_0x2f3c('0x8f')]()[_0x2f3c('0x24')](function(){return new BPromise(function(_0x28ea11,_0x27375a){zipdir(_0x2526f3,{'saveTo':_0x2610ee},function(_0x140aa4,_0x39de74){if(_0x140aa4)return _0x27375a(_0x140aa4);return _0x28ea11(_0x39de74);});})[_0x2f3c('0x24')](function(){return new BPromise(function(_0x31b5b6,_0x3ac247){rimraf(_0x2526f3,function(_0x4922ca){if(_0x4922ca)_0x3ac247(_0x4922ca);return _0x31b5b6();});});})[_0x2f3c('0x24')](function(){return _0x414af1['download'](_0x2610ee,_0x6d83fa,function(_0x179ce9){if(_0x179ce9){console[_0x2f3c('0xd5')](_0x2f3c('0xd6'),_0x179ce9);}else{fs[_0x2f3c('0xd7')](_0x2610ee);}});});});}else{return _0x414af1[_0x2f3c('0x1c')](0xc8);}})['catch'](handleError(_0x414af1,null));}; \ No newline at end of file +var _0x15ee=['Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','nolimit','sort','pick','select','field','color','from','tools_tags','u.id','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','parseSearch','length','find','unreadMessages','value','having','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.fax\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','intersection','includeAll','merge','create','body','describe','addMessage','FaxMessage','omit','ids','getMessages','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','pipe','createWriteStream','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','end','status','offset','undefined','limit','count','set','Content-Range','json','save','update','destroy','then','sendStatus','error','stack','name','send'];(function(_0x28cd23,_0x2a69eb){var _0x5e220b=function(_0x2395db){while(--_0x2395db){_0x28cd23['push'](_0x28cd23['shift']());}};_0x5e220b(++_0x2a69eb);}(_0x15ee,0xac));var _0xe15e=function(_0x4d8744,_0x203345){_0x4d8744=_0x4d8744-0x0;var _0x17fb37=_0x15ee[_0x4d8744];return _0x17fb37;};'use strict';var emlformat=require(_0xe15e('0x0'));var rimraf=require(_0xe15e('0x1'));var zipdir=require(_0xe15e('0x2'));var jsonpatch=require(_0xe15e('0x3'));var rp=require(_0xe15e('0x4'));var moment=require(_0xe15e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe15e('0x6'));var path=require(_0xe15e('0x7'));var sox=require(_0xe15e('0x8'));var csv=require(_0xe15e('0x9'));var ejs=require(_0xe15e('0xa'));var fs=require('fs');var fs_extra=require(_0xe15e('0xb'));var _=require(_0xe15e('0xc'));var squel=require(_0xe15e('0xd'));var crypto=require(_0xe15e('0xe'));var jsforce=require(_0xe15e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe15e('0x9'));var querystring=require(_0xe15e('0x10'));var Papa=require(_0xe15e('0x11'));var Redis=require(_0xe15e('0x12'));var authService=require(_0xe15e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe15e('0x14'));var logger=require(_0xe15e('0x15'))(_0xe15e('0x16'));var utils=require(_0xe15e('0x17'));var config=require(_0xe15e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe15e('0x19'))['db'];config[_0xe15e('0x1a')]=_['defaults'](config[_0xe15e('0x1a')],{'host':_0xe15e('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxInteraction.socket')[_0xe15e('0x1c')](socket);function respondWithStatusCode(_0x443321,_0x11acd8){_0x11acd8=_0x11acd8||0xcc;return function(_0x5ccd1a){if(_0x5ccd1a){return _0x443321['sendStatus'](_0x11acd8);}return _0x443321['status'](_0x11acd8)[_0xe15e('0x1d')]();};}function respondWithResult(_0x270449,_0x50e011){_0x50e011=_0x50e011||0xc8;return function(_0x2a1a2e){if(_0x2a1a2e){return _0x270449[_0xe15e('0x1e')](_0x50e011)['json'](_0x2a1a2e);}};}function respondWithFilteredResult(_0x15284c,_0x418032){return function(_0x205600){if(_0x205600){var _0x5e62d4=typeof _0x418032[_0xe15e('0x1f')]===_0xe15e('0x20')&&typeof _0x418032[_0xe15e('0x21')]===_0xe15e('0x20');var _0x3bb32c=_0x205600['count'];var _0x3f849d=_0x5e62d4?0x0:_0x418032[_0xe15e('0x1f')];var _0x5f5300=_0x5e62d4?_0x205600[_0xe15e('0x22')]:_0x418032['offset']+_0x418032['limit'];var _0x2d0c44;if(_0x5f5300>=_0x3bb32c){_0x5f5300=_0x3bb32c;_0x2d0c44=0xc8;}else{_0x2d0c44=0xce;}_0x15284c[_0xe15e('0x1e')](_0x2d0c44);return _0x15284c[_0xe15e('0x23')](_0xe15e('0x24'),_0x3f849d+'-'+_0x5f5300+'/'+_0x3bb32c)[_0xe15e('0x25')](_0x205600);}return null;};}function patchUpdates(_0x32721b){return function(_0x45f154){try{jsonpatch['apply'](_0x45f154,_0x32721b,!![]);}catch(_0x46a46b){return BPromise['reject'](_0x46a46b);}return _0x45f154[_0xe15e('0x26')]();};}function saveUpdates(_0x4f3c45,_0x7d27e6){return function(_0x1718c3){if(_0x1718c3){return _0x1718c3[_0xe15e('0x27')](_0x4f3c45)['then'](function(_0x5c94a4){return _0x5c94a4;});}return null;};}function removeEntity(_0x5b13ad,_0x4fdaf3){return function(_0x340df4){if(_0x340df4){return _0x340df4[_0xe15e('0x28')]()[_0xe15e('0x29')](function(){_0x5b13ad[_0xe15e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1226c5,_0xa1e55){return function(_0x5f55ec){if(!_0x5f55ec){_0x1226c5[_0xe15e('0x2a')](0x194);}return _0x5f55ec;};}function handleError(_0x41162,_0x216e84){_0x216e84=_0x216e84||0x1f4;return function(_0x156967){logger[_0xe15e('0x2b')](_0x156967[_0xe15e('0x2c')]);if(_0x156967[_0xe15e('0x2d')]){delete _0x156967[_0xe15e('0x2d')];}_0x41162[_0xe15e('0x1e')](_0x216e84)[_0xe15e('0x2e')](_0x156967);};}function getInteractionUsers(_0x38ae9d,_0x30a30b){return new BPromise(function(_0x3e1532,_0x67d362){try{if(_0x30a30b[_0x38ae9d['id']]){_0x38ae9d[_0xe15e('0x2f')]=_[_0xe15e('0x30')](_0x30a30b[_0x38ae9d['id']],function(_0xcd1e6){return{'id':_0xcd1e6['id'],'fullname':_0xcd1e6[_0xe15e('0x31')]};});}}catch(_0x2d6d44){_0x67d362(_0x2d6d44);}_0x3e1532(_0x38ae9d);});}function getInteractionTags(_0x46f0c7,_0x31d83d){return new BPromise(function(_0x3cf78a,_0x10ab5b){try{if(_0x46f0c7[_0xe15e('0x32')]){_0x46f0c7[_0xe15e('0x33')]=[];_0x46f0c7[_0xe15e('0x32')][_0xe15e('0x34')](',')[_0xe15e('0x35')](function(_0x1be241){_0x46f0c7['Tags'][_0xe15e('0x36')](_0x31d83d[_0x1be241]);});}delete _0x46f0c7[_0xe15e('0x32')];}catch(_0x54c4d6){_0x10ab5b(_0x54c4d6);}_0x3cf78a(_0x46f0c7);});}function updateFaxInteraction(_0xbed1ad,_0x256617,_0x40fa10){return new BPromise(function(_0x1721c4,_0xfff109){return getInteractionUsers(_0xbed1ad,_0x40fa10)[_0xe15e('0x29')](function(_0x43100a){return getInteractionTags(_0x43100a,_0x256617);})['then'](function(_0x3f2ed2){return getStateInteraction(_0x3f2ed2);})[_0xe15e('0x29')](function(_0x309b5c){_0x1721c4(_0x309b5c);})[_0xe15e('0x37')](function(_0x2e9eaf){_0xfff109(_0x2e9eaf);});});}function getStateInteraction(_0x49909c){return new BPromise(function(_0xbc1903){_0x49909c[_0xe15e('0x38')]=0x0;_0x49909c[_0xe15e('0x39')]=0x0;_0x49909c[_0xe15e('0x3a')]=0x0;_0x49909c[_0xe15e('0x3b')]=0x0;_0x49909c[_0xe15e('0x3c')]=0x0;if(!_0x49909c[_0xe15e('0x3d')]&&!_0x49909c[_0xe15e('0x3e')]){_0x49909c['waiting']+=0x1;}if(!_0x49909c[_0xe15e('0x3d')]&&_0x49909c[_0xe15e('0x3e')]){_0x49909c[_0xe15e('0x39')]+=0x1;if(_0x49909c[_0xe15e('0x38')]){_0x49909c['waiting']-=0x1;}}if(_0x49909c[_0xe15e('0x3d')]&&_0x49909c[_0xe15e('0x3e')]){_0x49909c[_0xe15e('0x3a')]+=0x1;if(_0x49909c[_0xe15e('0x39')]){_0x49909c[_0xe15e('0x39')]-=0x1;}}if(_0x49909c['closed']&&!_0x49909c[_0xe15e('0x3e')]){_0x49909c[_0xe15e('0x3b')]+=0x1;if(_0x49909c['waiting']){_0x49909c[_0xe15e('0x38')]-=0x1;}}_0x49909c[_0xe15e('0x3c')]+=0x1;_0xbc1903(_0x49909c);});}exports['index']=function(_0x147482,_0x5d3009){var _0x494ac8={},_0x81d7db={},_0x4bad9c={'count':0x0,'rows':[]};var _0x571c67=_[_0xe15e('0x30')](db[_0xe15e('0x3f')][_0xe15e('0x40')],function(_0x625566){return{'name':_0x625566[_0xe15e('0x41')],'type':_0x625566[_0xe15e('0x42')][_0xe15e('0x43')]};});_0x81d7db[_0xe15e('0x44')]=_['map'](_0x571c67,'name');_0x81d7db[_0xe15e('0x45')]=_[_0xe15e('0x46')](_0x147482['query']);_0x81d7db[_0xe15e('0x47')]=_['intersection'](_0x81d7db[_0xe15e('0x44')],_0x81d7db['query']);_0x494ac8[_0xe15e('0x48')]=_['intersection'](_0x81d7db[_0xe15e('0x44')],qs[_0xe15e('0x49')](_0x147482[_0xe15e('0x45')][_0xe15e('0x49')]));_0x494ac8[_0xe15e('0x48')]=_0x494ac8[_0xe15e('0x48')]['length']?_0x494ac8['attributes']:_0x81d7db[_0xe15e('0x44')];if(!_0x147482[_0xe15e('0x45')]['hasOwnProperty'](_0xe15e('0x4a'))){_0x494ac8[_0xe15e('0x21')]=qs[_0xe15e('0x21')](_0x147482[_0xe15e('0x45')][_0xe15e('0x21')]);_0x494ac8['offset']=qs['offset'](_0x147482[_0xe15e('0x45')]['offset']);}_0x494ac8['order']=qs[_0xe15e('0x4b')](_0x147482[_0xe15e('0x45')][_0xe15e('0x4b')]);_0x494ac8['where']=qs[_0xe15e('0x47')](_[_0xe15e('0x4c')](_0x147482[_0xe15e('0x45')],_0x81d7db[_0xe15e('0x47')]),_0x571c67);var _0x3c368e=[];var _0x4af5f1=squel[_0xe15e('0x4d')]()[_0xe15e('0x4e')]('id')[_0xe15e('0x4e')](_0xe15e('0x2d'))[_0xe15e('0x4e')](_0xe15e('0x4f'))[_0xe15e('0x50')](_0xe15e('0x51'));var _0xc50a40=squel['select']()[_0xe15e('0x4e')](_0xe15e('0x52'))[_0xe15e('0x4e')]('u.fullname')['field'](_0xe15e('0x53'))[_0xe15e('0x50')](_0xe15e('0x54'),'ui')[_0xe15e('0x55')](_0xe15e('0x56'),'u',_0xe15e('0x57'));var _0x45300b=squel[_0xe15e('0x4d')]()[_0xe15e('0x50')](_0xe15e('0x58'),'i')[_0xe15e('0x55')](_0xe15e('0x59'),'c',_0xe15e('0x5a'))[_0xe15e('0x55')](_0xe15e('0x56'),'o','o.id\x20=\x20i.UserId')[_0xe15e('0x55')](_0xe15e('0x5b'),'a',_0xe15e('0x5c'))['left_join'](_0xe15e('0x5d'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xe15e('0x55')](_0xe15e('0x5e'),'it',_0xe15e('0x5f'))[_0xe15e('0x55')](_0xe15e('0x51'),'t','t.id\x20=\x20it.TagId');var _0x41efcf=squel[_0xe15e('0x60')]();var _0x218e58=[];var _0x849779=squel['expr']();var _0x43f428;if(_0x147482[_0xe15e('0x45')][_0xe15e('0x61')]){_0x43f428=as[_0xe15e('0x62')](_0x147482[_0xe15e('0x45')][_0xe15e('0x61')]);var _0x4fe9e2=_0x43f428['sqlOperator'];for(var _0x5b82ce=0x0;_0x5b82ce<_0x43f428['conditions'][_0xe15e('0x63')];_0x5b82ce++){var _0x54e7e0=_0x43f428['conditions'][_0x5b82ce];var _0x214020='i';var _0x5278b7=_[_0xe15e('0x64')](_0x571c67,[_0xe15e('0x2d'),_0x54e7e0[_0xe15e('0x4e')]]);if(!_0x5278b7){switch(_0x54e7e0['field']){case _0xe15e('0x65'):if(_0x54e7e0[_0xe15e('0x66')]==0x1){_0x45300b[_0xe15e('0x67')]('`'+_0x54e7e0['field']+'`\x20=\x200');}else{_0x45300b['having']('`'+_0x54e7e0[_0xe15e('0x4e')]+'`\x20>\x200');}break;case'Contact':if(_0x54e7e0[_0xe15e('0x68')]==='$substring'){if(_0x54e7e0[_0xe15e('0x66')][_0xe15e('0x34')]('\x20')[_0xe15e('0x63')]>0x1){_0x41efcf[_0x4fe9e2](_0xe15e('0x69'),qs[_0xe15e('0x6a')](_0x54e7e0[_0xe15e('0x66')]),null);}else{var _0x3bbae3='%'+_0x54e7e0[_0xe15e('0x66')]+'%';_0x41efcf[_0x4fe9e2](_0xe15e('0x6b'),_0x3bbae3,_0x3bbae3,_0x3bbae3);}}else{_0x5278b7=_['find'](_0x571c67,['name',_0xe15e('0x6c')]);_0x54e7e0['field']=_0xe15e('0x6c');_0x1fde38=as[_0xe15e('0x6d')](_0x214020,_0x5278b7[_0xe15e('0x42')],_0x54e7e0);_0x41efcf[_0x4fe9e2](_0x1fde38[_0xe15e('0x6e')],_0x1fde38['value']['start'],_0x1fde38[_0xe15e('0x66')][_0xe15e('0x1d')]);}break;case _0xe15e('0x6f'):var _0x454457=_0x54e7e0['value'][_0xe15e('0x34')](',')['map'](function(_0x2123ff){return Number(_0x2123ff);});_0x454457[_0xe15e('0x35')](function(_0x49b51e){_0x849779['or'](_0xe15e('0x70'),'%,'+_0x49b51e+',%');});_0x218e58=_['union'](_0x218e58,_0x454457);break;case _0xe15e('0x71'):if(_0x54e7e0[_0xe15e('0x68')]==='$substring'){_0x41efcf[_0x4fe9e2](_0xe15e('0x72'),'%'+_0x54e7e0[_0xe15e('0x66')]+'%',null);}else{_0x5278b7=_[_0xe15e('0x64')](_0x571c67,[_0xe15e('0x2d'),_0xe15e('0x3e')]);_0x54e7e0[_0xe15e('0x4e')]='UserId';_0x1fde38=as[_0xe15e('0x6d')](_0x214020,_0x5278b7['type'],_0x54e7e0);_0x41efcf[_0x4fe9e2](_0x1fde38[_0xe15e('0x6e')],_0x1fde38[_0xe15e('0x66')][_0xe15e('0x73')],_0x1fde38[_0xe15e('0x66')]['end']);}break;case'body':_0x1fde38=as[_0xe15e('0x6d')]('me',null,_0x54e7e0);_0x41efcf[_0x4fe9e2](_0x1fde38[_0xe15e('0x6e')],_0x1fde38[_0xe15e('0x66')][_0xe15e('0x73')],_0x1fde38[_0xe15e('0x66')][_0xe15e('0x1d')]);break;}}else{var _0x1fde38=as['buildExpression'](_0x214020,_0x5278b7[_0xe15e('0x42')],_0x54e7e0);_0x41efcf[_0x4fe9e2](_0x1fde38[_0xe15e('0x6e')],_0x1fde38['value'][_0xe15e('0x73')],_0x1fde38[_0xe15e('0x66')][_0xe15e('0x1d')]);}}}else{var _0x35701b=_(_0x147482[_0xe15e('0x45')])['keys']()[_0xe15e('0x30')](function(_0x1405b5){return _[_0xe15e('0x74')](_0x571c67,[_0xe15e('0x2d'),_0x1405b5])?_0x1405b5:undefined;})[_0xe15e('0x75')]()['value']();if(!_[_0xe15e('0x76')](_0x35701b)){_0x35701b[_0xe15e('0x35')](function(_0x16631a){if(_0x16631a===_0xe15e('0x77')){_0x45300b[_0xe15e('0x78')](_0xe15e('0x79'),[]['concat'](_0x147482[_0xe15e('0x45')][_0x16631a]));}else if(_0x16631a===_0xe15e('0x7a')){var _0x348f08=JSON[_0xe15e('0x7b')](_0x147482['query'][_0x16631a])[_0xe15e('0x7c')];var _0x453202=JSON['parse'](_0x147482[_0xe15e('0x45')][_0x16631a])['$lte'];_0x45300b[_0xe15e('0x78')](_0xe15e('0x7d'),_0x348f08,_0x453202);}else{if(_0x147482[_0xe15e('0x45')][_0x16631a]==='null'){_0x45300b[_0xe15e('0x78')]('i.'+_0x16631a+_0xe15e('0x7e'));}else{_0x45300b[_0xe15e('0x78')]('i.'+_0x16631a+_0xe15e('0x7f'),_0x147482[_0xe15e('0x45')][_0x16631a]);}}});}if(_0x147482[_0xe15e('0x45')]['read']){if(_0x147482[_0xe15e('0x45')][_0xe15e('0x80')]==0x1){_0x45300b[_0xe15e('0x67')](_0xe15e('0x81'));}else{_0x45300b[_0xe15e('0x67')](_0xe15e('0x82'));}}if(_0x147482[_0xe15e('0x45')][_0xe15e('0x83')]){_0x218e58=_[_0xe15e('0x84')](_0x147482[_0xe15e('0x45')][_0xe15e('0x83')])?_0x147482['query'][_0xe15e('0x83')]:new Array(_0x147482[_0xe15e('0x45')][_0xe15e('0x83')]);_0x218e58[_0xe15e('0x35')](function(_0x1606d6){_0x849779['or'](_0xe15e('0x70'),'%,'+_0x1606d6+',%');});}if(_0x147482[_0xe15e('0x45')][_0xe15e('0x85')]){var _0x3a6161=_0x147482[_0xe15e('0x45')][_0xe15e('0x85')][_0xe15e('0x86')]('\x5c','\x5c\x5c')[_0xe15e('0x86')](/'/g,'\x27\x27');if(qs[_0xe15e('0x87')](_0x3a6161)){_0x41efcf['or']('i.id\x20LIKE\x20?',_0x3a6161+'%')['or'](_0xe15e('0x88'),_0x3a6161+'%');}_0x41efcf['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3a6161+'%');}}_0x45300b[_0xe15e('0x78')](_0x41efcf);_0x45300b[_0xe15e('0x89')]('i.id');var _0x401111={'type':db[_0xe15e('0x8a')][_0xe15e('0x8b')]['SELECT'],'raw':!![]};var _0x122d50=_0x45300b[_0xe15e('0x8c')]();_0x122d50[_0xe15e('0x4e')](_0xe15e('0x8d'));_0x122d50[_0xe15e('0x4e')](_0xe15e('0x8e'),_0xe15e('0x65'));if(_0x494ac8[_0xe15e('0x8f')]){_0x494ac8['order'][_0xe15e('0x35')](function(_0x1c5d90){var _0x57a990=_0x1c5d90[0x0]===_0xe15e('0x90')?_0x1c5d90[0x0]:'i.'+_0x1c5d90[0x0];_0x45300b[_0xe15e('0x8f')](_0x57a990,_0x1c5d90[0x1]===_0xe15e('0x91')?![]:!![]);});}if(!_[_0xe15e('0x76')](_0x218e58)){_0x45300b[_0xe15e('0x67')](_0x849779);_0x122d50[_0xe15e('0x78')](_0xe15e('0x92'),_0x218e58);}BPromise[_0xe15e('0x93')]()['then'](function(){if(!_0x43f428){if(_0x147482[_0xe15e('0x45')][_0xe15e('0x77')])return;_0x122d50[_0xe15e('0x78')](_0xe15e('0x94'));_0x45300b['where'](_0xe15e('0x94'));return;}if(_0x147482[_0xe15e('0x95')][_0xe15e('0x96')]!==_0xe15e('0x97'))return;return _0x147482[_0xe15e('0x95')][_0xe15e('0x98')]({'attributes':['id'],'raw':!![]})[_0xe15e('0x29')](function(_0x14e83a){if(_[_0xe15e('0x76')](_0x14e83a)){_0x122d50[_0xe15e('0x78')](_0xe15e('0x99'));_0x45300b[_0xe15e('0x78')](_0xe15e('0x99'));}else{_0x122d50[_0xe15e('0x78')]('i.FaxAccountId\x20IN\x20?',_[_0xe15e('0x30')](_0x14e83a,'id'));_0x45300b['where']('i.FaxAccountId\x20IN\x20?',_[_0xe15e('0x30')](_0x14e83a,'id'));}});})['then'](function(){if(_0x147482[_0xe15e('0x95')][_0xe15e('0x96')]===_0xe15e('0x97')&&!_0x43f428&&!_0x147482[_0xe15e('0x45')][_0xe15e('0x77')])return[];return db['sequelize'][_0xe15e('0x45')](_0x122d50[_0xe15e('0x9a')](),_0x401111);})[_0xe15e('0x29')](function(_0x2ec7ec){_0x4bad9c[_0xe15e('0x22')]=_0x2ec7ec['length'];if(_0x4bad9c[_0xe15e('0x22')]===0x0)return[];return db['sequelize'][_0xe15e('0x45')](_0x4af5f1[_0xe15e('0x9a')](),_0x401111)[_0xe15e('0x29')](function(_0x2cbd70){_0x3c368e=_[_0xe15e('0x9b')](_0x2cbd70,'id');_0x401111=_['merge'](_0x401111,{'model':db[_0xe15e('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x147482[_0xe15e('0x45')]['fields']){_0x494ac8[_0xe15e('0x48')][_0xe15e('0x35')](function(_0x251c89){_0x45300b[_0xe15e('0x4e')]('i.'+_0x251c89);});}else{_0x45300b['field'](_0xe15e('0x8e'),_0xe15e('0x65'));_0x45300b[_0xe15e('0x4e')]('a.key',_0xe15e('0x9c'));_0x45300b[_0xe15e('0x4e')](_0xe15e('0x9d'),_0xe15e('0x9e'));_0x45300b[_0xe15e('0x4e')](_0xe15e('0x9f'),_0xe15e('0x90'));_0x45300b['field'](_0xe15e('0xa0'));_0x45300b[_0xe15e('0x4e')](_0xe15e('0xa1'),'Contact.firstName');_0x45300b['field'](_0xe15e('0xa2'),_0xe15e('0xa3'));_0x45300b[_0xe15e('0x4e')](_0xe15e('0xa4'),_0xe15e('0xa5'));_0x45300b[_0xe15e('0x4e')](_0xe15e('0xa6'),'Contact.phone');_0x45300b[_0xe15e('0x4e')]('c.mobile',_0xe15e('0xa7'));_0x45300b[_0xe15e('0x4e')]('c.fax','Contact.fax');_0x45300b[_0xe15e('0x4e')](_0xe15e('0xa8'),'Owner.fullname');_0x45300b[_0xe15e('0x4e')](_0xe15e('0xa9'),_0xe15e('0xaa'));_0x45300b[_0xe15e('0x4e')](_0xe15e('0xab'),'TagIds');}if(_0x494ac8['limit'])_0x45300b[_0xe15e('0x21')](_0x494ac8['limit']);if(_0x494ac8[_0xe15e('0x1f')])_0x45300b[_0xe15e('0x1f')](_0x494ac8[_0xe15e('0x1f')]);return db[_0xe15e('0xac')][_0xe15e('0x45')](_0x45300b['toString'](),_0x401111);})[_0xe15e('0x29')](function(_0x71a0ea){if(_0x71a0ea[_0xe15e('0x63')]>0x0)_0xc50a40[_0xe15e('0x78')](_0xe15e('0xad'),_['map'](_0x71a0ea,'id'));return db['sequelize'][_0xe15e('0x45')](_0xc50a40[_0xe15e('0x9a')](),_0x401111)[_0xe15e('0x29')](function(_0x51233e){var _0x1e7316=_[_0xe15e('0xae')](_0x51233e,_0xe15e('0xaf'));var _0x1505c9=[];_0x71a0ea[_0xe15e('0x35')](function(_0x3fcb52){_0x1505c9['push'](updateFaxInteraction(_0x3fcb52,_0x3c368e,_0x1e7316));});return BPromise[_0xe15e('0xb0')](_0x1505c9);});});})[_0xe15e('0x29')](function(_0x24aab8){_0x4bad9c[_0xe15e('0xb1')]=_0x24aab8;return _0x4bad9c;})[_0xe15e('0x29')](respondWithFilteredResult(_0x5d3009,_0x494ac8))[_0xe15e('0x37')](handleError(_0x5d3009,null));};exports[_0xe15e('0xb2')]=function(_0x504ece,_0x556b73){var _0x3e7ec1={'raw':![],'where':{'id':_0x504ece[_0xe15e('0xb3')]['id']}},_0x2e52ef={};_0x2e52ef[_0xe15e('0x44')]=_[_0xe15e('0x46')](db[_0xe15e('0x3f')][_0xe15e('0x40')]);_0x2e52ef['query']=_[_0xe15e('0x46')](_0x504ece['query']);_0x2e52ef['filters']=_[_0xe15e('0xb4')](_0x2e52ef[_0xe15e('0x44')],_0x2e52ef[_0xe15e('0x45')]);_0x3e7ec1[_0xe15e('0x48')]=_[_0xe15e('0xb4')](_0x2e52ef[_0xe15e('0x44')],qs['fields'](_0x504ece['query'][_0xe15e('0x49')]));_0x3e7ec1[_0xe15e('0x48')]=_0x3e7ec1[_0xe15e('0x48')][_0xe15e('0x63')]?_0x3e7ec1['attributes']:_0x2e52ef[_0xe15e('0x44')];if(_0x504ece[_0xe15e('0x45')][_0xe15e('0xb5')]){_0x3e7ec1['include']=[{'all':!![]}];}_0x3e7ec1=_[_0xe15e('0xb6')]({},_0x3e7ec1,_0x504ece['options']);return db['FaxInteraction'][_0xe15e('0x64')](_0x3e7ec1)[_0xe15e('0x29')](handleEntityNotFound(_0x556b73,null))[_0xe15e('0x29')](respondWithResult(_0x556b73,null))[_0xe15e('0x37')](handleError(_0x556b73,null));};exports[_0xe15e('0xb7')]=function(_0x48542f,_0x30e3f9){return db[_0xe15e('0x3f')]['create'](_0x48542f[_0xe15e('0xb8')],{})['then'](respondWithResult(_0x30e3f9,0xc9))[_0xe15e('0x37')](handleError(_0x30e3f9,null));};exports[_0xe15e('0x27')]=function(_0x297888,_0x296438){if(_0x297888[_0xe15e('0xb8')]['id']){delete _0x297888[_0xe15e('0xb8')]['id'];}return db[_0xe15e('0x3f')][_0xe15e('0x64')]({'where':{'id':_0x297888[_0xe15e('0xb3')]['id']}})[_0xe15e('0x29')](handleEntityNotFound(_0x296438,null))[_0xe15e('0x29')](saveUpdates(_0x297888[_0xe15e('0xb8')],null))[_0xe15e('0x29')](respondWithResult(_0x296438,null))['catch'](handleError(_0x296438,null));};exports[_0xe15e('0x28')]=function(_0x196058,_0x3ef896){return db[_0xe15e('0x3f')][_0xe15e('0x64')]({'where':{'id':_0x196058[_0xe15e('0xb3')]['id']}})[_0xe15e('0x29')](handleEntityNotFound(_0x3ef896,null))[_0xe15e('0x29')](removeEntity(_0x3ef896,null))[_0xe15e('0x37')](handleError(_0x3ef896,null));};exports[_0xe15e('0xb9')]=function(_0x3029dc,_0x528e0e){return db[_0xe15e('0x3f')][_0xe15e('0xb9')]()['then'](respondWithResult(_0x528e0e,null))['catch'](handleError(_0x528e0e,null));};exports[_0xe15e('0xba')]=function(_0x1f3b40,_0x126b92,_0x4e32e7){return db[_0xe15e('0xbb')][_0xe15e('0x64')]({'where':{'id':_0x1f3b40['params']['id']}})[_0xe15e('0x29')](handleEntityNotFound(_0x126b92,null))['then'](function(_0x3962f5){if(_0x3962f5){return _0x3962f5[_0xe15e('0xba')](_0x1f3b40['body']['ids'],_[_0xe15e('0xbc')](_0x1f3b40[_0xe15e('0xb8')],[_0xe15e('0xbd'),'id'])||{});}})[_0xe15e('0x29')](respondWithResult(_0x126b92,null))['catch'](handleError(_0x126b92,null));};exports[_0xe15e('0xbe')]=function(_0x47b9c9,_0x570cc7,_0x2020cc){var _0x9448f3={'raw':![],'where':{}};var _0x3f09c0={};var _0x24fbfc={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x47b9c9[_0xe15e('0xb3')]['id']}})[_0xe15e('0x29')](handleEntityNotFound(_0x570cc7,null))[_0xe15e('0x29')](function(_0x295ceb){if(_0x295ceb){_0x3f09c0['model']=_[_0xe15e('0x46')](db[_0xe15e('0xbb')][_0xe15e('0x40')]);_0x3f09c0[_0xe15e('0x45')]=_[_0xe15e('0x46')](_0x47b9c9[_0xe15e('0x45')]);_0x3f09c0[_0xe15e('0x47')]=_['intersection'](_0x3f09c0[_0xe15e('0x44')],_0x3f09c0[_0xe15e('0x45')]);_0x9448f3[_0xe15e('0x48')]=_[_0xe15e('0xb4')](_0x3f09c0[_0xe15e('0x44')],qs['fields'](_0x47b9c9[_0xe15e('0x45')][_0xe15e('0x49')]));_0x9448f3['attributes']=_0x9448f3[_0xe15e('0x48')][_0xe15e('0x63')]?_0x9448f3[_0xe15e('0x48')]:_0x3f09c0[_0xe15e('0x44')];if(!_0x47b9c9['query'][_0xe15e('0xbf')](_0xe15e('0x4a'))){_0x9448f3[_0xe15e('0x21')]=qs['limit'](_0x47b9c9[_0xe15e('0x45')][_0xe15e('0x21')]);_0x9448f3[_0xe15e('0x1f')]=qs[_0xe15e('0x1f')](_0x47b9c9[_0xe15e('0x45')][_0xe15e('0x1f')]);}_0x9448f3[_0xe15e('0x8f')]=qs[_0xe15e('0x4b')](_0x47b9c9['query'][_0xe15e('0x4b')]);_0x9448f3[_0xe15e('0x78')]=qs['filters'](_[_0xe15e('0x4c')](_0x47b9c9[_0xe15e('0x45')],_0x3f09c0[_0xe15e('0x47')]));_0x9448f3[_0xe15e('0x78')][_0xe15e('0xaf')]=_0x295ceb['id'];if(_0x47b9c9[_0xe15e('0x45')][_0xe15e('0x85')]){_0x9448f3[_0xe15e('0x78')]=_['merge'](_0x9448f3[_0xe15e('0x78')],{'$or':_[_0xe15e('0x30')](_0x9448f3[_0xe15e('0x48')],function(_0x54ad96){var _0x166fc0={};_0x166fc0[_0x54ad96]={'$like':'%'+_0x47b9c9['query'][_0xe15e('0x85')]+'%'};return _0x166fc0;})});}if(_0x47b9c9[_0xe15e('0x45')][_0xe15e('0x7c')]){var _0x10941f=_0x47b9c9[_0xe15e('0x45')][_0xe15e('0x7c')][_0xe15e('0x34')](',');var _0x3f0dde={};_0x3f0dde[_0x10941f[0x0]]={'$gte':moment(_0x10941f[0x1])[_0xe15e('0xc0')](_0xe15e('0xc1'))};_0x9448f3[_0xe15e('0x78')]=_[_0xe15e('0xb6')](_0x9448f3[_0xe15e('0x78')],_0x3f0dde);}_0x9448f3=_['merge']({},_0x9448f3,_0x47b9c9['options']);return db[_0xe15e('0xbb')][_0xe15e('0x22')]({'where':_0x9448f3[_0xe15e('0x78')]})[_0xe15e('0x29')](function(_0x460358){_0x24fbfc[_0xe15e('0x22')]=_0x460358;if(_0x47b9c9[_0xe15e('0x45')][_0xe15e('0xb5')]){_0x9448f3[_0xe15e('0xc2')]=[{'all':!![]}];}return db[_0xe15e('0xbb')][_0xe15e('0xc3')](_0x9448f3);})[_0xe15e('0x29')](function(_0x2200dd){_0x24fbfc['rows']=_0x2200dd;return _0x24fbfc;});}})['then'](respondWithFilteredResult(_0x570cc7,_0x9448f3))['catch'](handleError(_0x570cc7,null));};exports['addTags']=function(_0x1fca8b,_0x265ff7,_0x392f77){return db[_0xe15e('0x3f')][_0xe15e('0x64')]({'where':{'id':_0x1fca8b[_0xe15e('0xb3')]['id']}})[_0xe15e('0x29')](handleEntityNotFound(_0x265ff7,null))['then'](function(_0x1e1cac){if(_0x1e1cac){return _0x1e1cac[_0xe15e('0xc4')](_0x1fca8b[_0xe15e('0xb8')][_0xe15e('0xbd')],_[_0xe15e('0xbc')](_0x1fca8b[_0xe15e('0xb8')],[_0xe15e('0xbd'),'id'])||{})[_0xe15e('0xc5')](function(){return db[_0xe15e('0x6f')][_0xe15e('0xc3')]({'attributes':['id','name',_0xe15e('0x4f')],'where':{'id':_0x1fca8b[_0xe15e('0xb8')]['ids']}});})[_0xe15e('0x29')](function(_0x540ebb){socket[_0xe15e('0xc6')](_0xe15e('0xc7'),{'id':Number(_0x1fca8b[_0xe15e('0xb3')]['id']),'tags':_0x540ebb||[]});return{'id':Number(_0x1fca8b['params']['id']),'tags':_0x540ebb||[]};});}})[_0xe15e('0x29')](respondWithResult(_0x265ff7,null))[_0xe15e('0x37')](handleError(_0x265ff7,null));};exports[_0xe15e('0xc8')]=function(_0x168fc6,_0x7bfc6f,_0x179daa){return db[_0xe15e('0x3f')][_0xe15e('0x64')]({'where':{'id':_0x168fc6[_0xe15e('0xb3')]['id']}})[_0xe15e('0x29')](handleEntityNotFound(_0x7bfc6f,null))[_0xe15e('0x29')](function(_0x153ad8){if(_0x153ad8){return _0x153ad8[_0xe15e('0xc8')](_0x168fc6[_0xe15e('0x45')][_0xe15e('0xbd')]);}})[_0xe15e('0x29')](respondWithStatusCode(_0x7bfc6f,null))[_0xe15e('0x37')](handleError(_0x7bfc6f,null));};exports[_0xe15e('0xc9')]=function(_0x553d72,_0x511445){var _0x5eb75f=moment()[_0xe15e('0xca')]()[_0xe15e('0x9a')]();var _0x37973d=path['join'](config[_0xe15e('0xcb')],_0xe15e('0xcc'),_0xe15e('0xcd'),_0xe15e('0xce'));var _0x7209d3=path[_0xe15e('0xcf')](config['root'],_0xe15e('0xcc'),_0xe15e('0xcd'),_0xe15e('0xd0'));var _0x2e2976=path[_0xe15e('0xcf')](_0x37973d,_0x5eb75f);var _0xda3a1a=util[_0xe15e('0xc0')](_0xe15e('0xd1'),_0x553d72[_0xe15e('0xb3')]['id'],_0x5eb75f);var _0x43353b=path[_0xe15e('0xcf')](_0x37973d,_0xda3a1a);var _0x1fb335=[];_0x1fb335[_0xe15e('0x36')]({'model':db[_0xe15e('0xd2')],'as':_0xe15e('0xd2'),'raw':!![]});var _0x4bc73f=[{'model':db[_0xe15e('0xbb')],'as':_0xe15e('0xd3'),'attributes':['id',_0xe15e('0xb8'),_0xe15e('0x7a')],'include':_0x1fb335}];return db[_0xe15e('0x3f')][_0xe15e('0x64')]({'where':{'id':_0x553d72[_0xe15e('0xb3')]['id']},'include':_0x4bc73f})[_0xe15e('0x29')](handleEntityNotFound(_0x511445,null))[_0xe15e('0x29')](function(_0x2722de){if(_0x2722de&&_0x2722de[_0xe15e('0xd3')]){var _0x22508f=_0x2722de[_0xe15e('0xd4')]({'plain':!![]});fs['mkdirSync'](_0x2e2976);for(var _0x5c49f1=0x0;_0x5c49f1<_0x22508f[_0xe15e('0xd3')][_0xe15e('0x63')];_0x5c49f1++){var _0x26c82d=_0x22508f['Messages'][_0x5c49f1][_0xe15e('0xd2')];if(_0x26c82d){var _0x1f0e19=path[_0xe15e('0xcf')](_0x7209d3,_0x26c82d[_0xe15e('0xd5')]);if(fs[_0xe15e('0xd6')](_0x1f0e19)){fs['createReadStream'](_0x1f0e19)[_0xe15e('0xd7')](fs[_0xe15e('0xd8')](path[_0xe15e('0xcf')](_0x2e2976,_0x26c82d[_0xe15e('0xd5')])));}}}return BPromise[_0xe15e('0x93')]()[_0xe15e('0x29')](function(){return new BPromise(function(_0xe3fb2c,_0x3ddf41){zipdir(_0x2e2976,{'saveTo':_0x43353b},function(_0x972247,_0x181a70){if(_0x972247)return _0x3ddf41(_0x972247);return _0xe3fb2c(_0x181a70);});})[_0xe15e('0x29')](function(){return new BPromise(function(_0x88c4c8,_0x4cf912){rimraf(_0x2e2976,function(_0x239700){if(_0x239700)_0x4cf912(_0x239700);return _0x88c4c8();});});})[_0xe15e('0x29')](function(){return _0x511445[_0xe15e('0xc9')](_0x43353b,_0xda3a1a,function(_0x5dbddb){if(_0x5dbddb){console[_0xe15e('0xd9')](_0xe15e('0xda'),_0x5dbddb);}else{fs['unlinkSync'](_0x43353b);}});});});}else{return _0x511445[_0xe15e('0x2a')](0xc8);}})[_0xe15e('0x37')](handleError(_0x511445,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 44c44c0..8c329eb 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 _0x4170=['events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','getUsers','setDataValue','Users','map','findAll','then','emit','catch','hasOwnProperty'];(function(_0x200a88,_0x54c7a3){var _0x105a4d=function(_0x279117){while(--_0x279117){_0x200a88['push'](_0x200a88['shift']());}};_0x105a4d(++_0x54c7a3);}(_0x4170,0x13b));var _0x0417=function(_0x45b1ba,_0x5a6a21){_0x45b1ba=_0x45b1ba-0x0;var _0x145ddb=_0x4170[_0x45b1ba];return _0x145ddb;};'use strict';var EventEmitter=require(_0x0417('0x0'));var FaxInteraction=require(_0x0417('0x1'))['db'][_0x0417('0x2')];var FaxMessage=require(_0x0417('0x1'))['db'][_0x0417('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x0417('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0417('0x5'),'afterDestroy':'remove'};function emitEvent(_0x523001){return function(_0x50b77f,_0x41d267,_0x414869){_0x50b77f[_0x0417('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0xcc6815){_0x50b77f[_0x0417('0x7')](_0x0417('0x8'),_0xcc6815[_0x0417('0x9')](function(_0x3f4a26){return{'id':_0x3f4a26['id']};}));return FaxMessage[_0x0417('0xa')]({'where':{'FaxInteractionId':_0x50b77f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0417('0xb')](function(_0x1bf781){_0x50b77f[_0x0417('0x7')]('unreadMessages',_0x1bf781['length']);FaxInteractionEvents['emit'](_0x523001+':'+_0x50b77f['id'],_0x50b77f);FaxInteractionEvents[_0x0417('0xc')](_0x523001,_0x50b77f);_0x414869(null);})[_0x0417('0xd')](_0x414869(null));};}for(var e in events){if(events[_0x0417('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xb48c=['remove','getUsers','then','Users','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','../../mysqldb','FaxMessage','setMaxListeners','save','update'];(function(_0x59b341,_0x122518){var _0x5690b1=function(_0x3e9204){while(--_0x3e9204){_0x59b341['push'](_0x59b341['shift']());}};_0x5690b1(++_0x122518);}(_0xb48c,0x1b5));var _0xcb48=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb48c[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xcb48('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0xcb48('0x0'))['db'][_0xcb48('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xcb48('0x2')](0x0);var events={'afterCreate':_0xcb48('0x3'),'afterUpdate':_0xcb48('0x4'),'afterDestroy':_0xcb48('0x5')};function emitEvent(_0x485e88){return function(_0x52d436,_0x3ce3dd,_0x51a143){_0x52d436[_0xcb48('0x6')]({'attributes':['id'],'raw':!![]})[_0xcb48('0x7')](function(_0x1aefb1){_0x52d436['setDataValue'](_0xcb48('0x8'),_0x1aefb1[_0xcb48('0x9')](function(_0x39a942){return{'id':_0x39a942['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x52d436['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcb48('0x7')](function(_0x43eb6d){_0x52d436[_0xcb48('0xa')](_0xcb48('0xb'),_0x43eb6d[_0xcb48('0xc')]);FaxInteractionEvents[_0xcb48('0xd')](_0x485e88+':'+_0x52d436['id'],_0x52d436);FaxInteractionEvents['emit'](_0x485e88,_0x52d436);_0x51a143(null);})[_0xcb48('0xe')](_0x51a143(null));};}for(var e in events){if(events[_0xcb48('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xcb48('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index ee75f09..ed4d03d 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 _0x5f05=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5f05,0x1bc));var _0x55f0=function(_0x1d3332,_0x2ec0a1){_0x1d3332=_0x1d3332-0x0;var _0x15e85d=_0x5f05[_0x1d3332];return _0x15e85d;};'use strict';var _=require(_0x55f0('0x0'));var util=require(_0x55f0('0x1'));var logger=require(_0x55f0('0x2'))(_0x55f0('0x3'));var moment=require(_0x55f0('0x4'));var BPromise=require(_0x55f0('0x5'));var rp=require(_0x55f0('0x6'));var fs=require('fs');var path=require(_0x55f0('0x7'));var rimraf=require(_0x55f0('0x8'));var config=require(_0x55f0('0x9'));var attributes=require(_0x55f0('0xa'));module[_0x55f0('0xb')]=function(_0x14919e,_0x51481c){return _0x14919e[_0x55f0('0xc')](_0x55f0('0xd'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e7370,_0x4ecad1,_0x1b5d09){if(_0x1e7370['changed']('closed')){_0x1e7370[_0x55f0('0xe')]=moment()['format'](_0x55f0('0xf'));}_0x1b5d09(null,_0x1e7370);}}});}; \ No newline at end of file +var _0xb5bf=['exports','define','FaxInteraction','fax_interactions','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes'];(function(_0x58d2ee,_0x443649){var _0x4f73ea=function(_0x45666f){while(--_0x45666f){_0x58d2ee['push'](_0x58d2ee['shift']());}};_0x4f73ea(++_0x443649);}(_0xb5bf,0x1d7));var _0xfb5b=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xb5bf[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xfb5b('0x0'));var util=require(_0xfb5b('0x1'));var logger=require(_0xfb5b('0x2'))('api');var moment=require(_0xfb5b('0x3'));var BPromise=require('bluebird');var rp=require(_0xfb5b('0x4'));var fs=require('fs');var path=require(_0xfb5b('0x5'));var rimraf=require(_0xfb5b('0x6'));var config=require(_0xfb5b('0x7'));var attributes=require(_0xfb5b('0x8'));module[_0xfb5b('0x9')]=function(_0x5a9c12,_0x42b1c5){return _0x5a9c12[_0xfb5b('0xa')](_0xfb5b('0xb'),attributes,{'tableName':_0xfb5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ac378,_0x5bd4ce,_0x570b34){if(_0x3ac378['changed']('closed')){_0x3ac378[_0xfb5b('0xd')]=moment()['format'](_0xfb5b('0xe'));}_0x570b34(null,_0x3ac378);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 551b794..48ee8b8 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 _0x33b0=['defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','message','info','catch','FaxInteraction','update','options','raw','attributes','limit','then','UpdateFaxInteraction','stringify','AddTagsToFaxInteraction','where','addTags','omit','body','ids','AddTags','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','http'];(function(_0x20b073,_0xdcae7a){var _0xc3fd37=function(_0x380930){while(--_0x380930){_0x20b073['push'](_0x20b073['shift']());}};_0xc3fd37(++_0xdcae7a);}(_0x33b0,0x10f));var _0x033b=function(_0x30f218,_0xa741d0){_0x30f218=_0x30f218-0x0;var _0x130287=_0x33b0[_0x30f218];return _0x130287;};'use strict';var _=require(_0x033b('0x0'));var util=require(_0x033b('0x1'));var moment=require(_0x033b('0x2'));var BPromise=require(_0x033b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x033b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x033b('0x5'));var config=require(_0x033b('0x6'));var jayson=require(_0x033b('0x7'));var client=jayson['client'][_0x033b('0x8')]({'port':0x232a});config['redis']=_[_0x033b('0x9')](config[_0x033b('0xa')],{'host':_0x033b('0xb'),'port':0x18eb});var socket=require(_0x033b('0xc'))(new Redis(config['redis']));require(_0x033b('0xd'))[_0x033b('0xe')](socket);function respondWithRpcPromise(_0x120904,_0x4db3a0,_0x11e526){return new BPromise(function(_0x3a4724,_0x97017f){return client[_0x033b('0xf')](_0x120904,_0x11e526)['then'](function(_0x5cd34f){logger['info'](_0x033b('0x10'),_0x4db3a0,_0x033b('0x11'));logger[_0x033b('0x12')](_0x033b('0x13'),_0x4db3a0,_0x033b('0x11'),JSON['stringify'](_0x5cd34f));if(_0x5cd34f[_0x033b('0x14')]){if(_0x5cd34f[_0x033b('0x14')]['code']===0x1f4){logger[_0x033b('0x14')](_0x033b('0x10'),_0x4db3a0,_0x5cd34f[_0x033b('0x14')][_0x033b('0x15')]);return _0x97017f(_0x5cd34f[_0x033b('0x14')][_0x033b('0x15')]);}logger[_0x033b('0x14')](_0x033b('0x10'),_0x4db3a0,_0x5cd34f['error'][_0x033b('0x15')]);return _0x3a4724(_0x5cd34f[_0x033b('0x14')][_0x033b('0x15')]);}else{logger[_0x033b('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x4db3a0,_0x033b('0x11'));_0x3a4724(_0x5cd34f['result']['message']);}})[_0x033b('0x17')](function(_0x2cfb14){logger[_0x033b('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x4db3a0,_0x2cfb14);_0x97017f(_0x2cfb14);});});}exports['UpdateFaxInteraction']=function(_0x19bb4b){var _0xf4c29a=this;return new Promise(function(_0x2b7053,_0x24a2d2){return db[_0x033b('0x18')][_0x033b('0x19')](_0x19bb4b['body'],{'raw':_0x19bb4b[_0x033b('0x1a')]?_0x19bb4b['options'][_0x033b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19bb4b[_0x033b('0x1a')]?_0x19bb4b[_0x033b('0x1a')]['where']||null:null,'attributes':_0x19bb4b[_0x033b('0x1a')]?_0x19bb4b['options'][_0x033b('0x1c')]||null:null,'limit':_0x19bb4b['options']?_0x19bb4b[_0x033b('0x1a')][_0x033b('0x1d')]||null:null})[_0x033b('0x1e')](function(_0x22b721){logger[_0x033b('0x16')](_0x033b('0x1f'),_0x19bb4b);logger[_0x033b('0x12')](_0x033b('0x1f'),_0x19bb4b,JSON[_0x033b('0x20')](_0x22b721));_0x2b7053(_0x22b721);})[_0x033b('0x17')](function(_0xc3e2a4){logger[_0x033b('0x14')](_0x033b('0x1f'),_0xc3e2a4[_0x033b('0x15')],_0x19bb4b);_0x24a2d2(_0xf4c29a[_0x033b('0x14')](0x1f4,_0xc3e2a4[_0x033b('0x15')]));});});};exports[_0x033b('0x21')]=function(_0x4b56d2){return new Promise(function(_0x1be94c,_0x30e6f3){return db['FaxInteraction']['find']({'where':_0x4b56d2[_0x033b('0x1a')]?_0x4b56d2[_0x033b('0x1a')][_0x033b('0x22')]||null:null})[_0x033b('0x1e')](function(_0x359c36){if(_0x359c36){return _0x359c36[_0x033b('0x23')](_0x4b56d2['body']['ids'],_[_0x033b('0x24')](_0x4b56d2[_0x033b('0x25')],[_0x033b('0x26'),'id'])||{});}})['spread'](function(_0x5c8f93){logger[_0x033b('0x16')](_0x033b('0x27'),_0x4b56d2);logger[_0x033b('0x12')](_0x033b('0x27'),_0x4b56d2,JSON['stringify'](_0x5c8f93));_0x1be94c(_0x5c8f93);})[_0x033b('0x17')](function(_0x549987){logger[_0x033b('0x14')]('AddTags',_0x549987['message'],_0x4b56d2);_0x30e6f3(_this[_0x033b('0x14')](0x1f4,_0x549987[_0x033b('0x15')]));});});}; \ No newline at end of file +var _0x8237=['jayson/promise','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','request\x20sent','catch','update','options','raw','attributes','UpdateFaxInteraction','AddTagsToFaxInteraction','FaxInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1a74c7,_0x3a05d9){var _0x5d9220=function(_0x128600){while(--_0x128600){_0x1a74c7['push'](_0x1a74c7['shift']());}};_0x5d9220(++_0x3a05d9);}(_0x8237,0x187));var _0x7823=function(_0x85fbc0,_0x5be0a6){_0x85fbc0=_0x85fbc0-0x0;var _0x29b4be=_0x8237[_0x85fbc0];return _0x29b4be;};'use strict';var _=require(_0x7823('0x0'));var util=require(_0x7823('0x1'));var moment=require(_0x7823('0x2'));var BPromise=require(_0x7823('0x3'));var rs=require(_0x7823('0x4'));var fs=require('fs');var Redis=require(_0x7823('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7823('0x6'));var logger=require(_0x7823('0x7'))('rpc');var config=require(_0x7823('0x8'));var jayson=require(_0x7823('0x9'));var client=jayson['client'][_0x7823('0xa')]({'port':0x232a});config[_0x7823('0xb')]=_['defaults'](config[_0x7823('0xb')],{'host':_0x7823('0xc'),'port':0x18eb});var socket=require(_0x7823('0xd'))(new Redis(config['redis']));require(_0x7823('0xe'))['register'](socket);function respondWithRpcPromise(_0x3372d0,_0x238b1b,_0x3d11cd){return new BPromise(function(_0x1a7c61,_0x5548f8){return client[_0x7823('0xf')](_0x3372d0,_0x3d11cd)[_0x7823('0x10')](function(_0x384e48){logger[_0x7823('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x238b1b,'request\x20sent');logger[_0x7823('0x12')](_0x7823('0x13'),_0x238b1b,'request\x20sent',JSON[_0x7823('0x14')](_0x384e48));if(_0x384e48[_0x7823('0x15')]){if(_0x384e48[_0x7823('0x15')][_0x7823('0x16')]===0x1f4){logger[_0x7823('0x15')](_0x7823('0x17'),_0x238b1b,_0x384e48[_0x7823('0x15')][_0x7823('0x18')]);return _0x5548f8(_0x384e48[_0x7823('0x15')][_0x7823('0x18')]);}logger[_0x7823('0x15')](_0x7823('0x17'),_0x238b1b,_0x384e48[_0x7823('0x15')][_0x7823('0x18')]);return _0x1a7c61(_0x384e48[_0x7823('0x15')][_0x7823('0x18')]);}else{logger[_0x7823('0x11')](_0x7823('0x17'),_0x238b1b,_0x7823('0x19'));_0x1a7c61(_0x384e48['result'][_0x7823('0x18')]);}})[_0x7823('0x1a')](function(_0x4c2ce8){logger[_0x7823('0x15')](_0x7823('0x17'),_0x238b1b,_0x4c2ce8);_0x5548f8(_0x4c2ce8);});});}exports['UpdateFaxInteraction']=function(_0x3efd80){var _0x3168a0=this;return new Promise(function(_0x2a1e89,_0x1e67cc){return db['FaxInteraction'][_0x7823('0x1b')](_0x3efd80['body'],{'raw':_0x3efd80[_0x7823('0x1c')]?_0x3efd80['options'][_0x7823('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3efd80[_0x7823('0x1c')]?_0x3efd80[_0x7823('0x1c')]['where']||null:null,'attributes':_0x3efd80['options']?_0x3efd80[_0x7823('0x1c')][_0x7823('0x1e')]||null:null,'limit':_0x3efd80[_0x7823('0x1c')]?_0x3efd80[_0x7823('0x1c')]['limit']||null:null})['then'](function(_0x4077a6){logger[_0x7823('0x11')](_0x7823('0x1f'),_0x3efd80);logger[_0x7823('0x12')](_0x7823('0x1f'),_0x3efd80,JSON['stringify'](_0x4077a6));_0x2a1e89(_0x4077a6);})[_0x7823('0x1a')](function(_0x38ca79){logger['error'](_0x7823('0x1f'),_0x38ca79['message'],_0x3efd80);_0x1e67cc(_0x3168a0[_0x7823('0x15')](0x1f4,_0x38ca79['message']));});});};exports[_0x7823('0x20')]=function(_0x69c80c){return new Promise(function(_0x2b8b81,_0x13d944){return db[_0x7823('0x21')]['find']({'where':_0x69c80c[_0x7823('0x1c')]?_0x69c80c[_0x7823('0x1c')]['where']||null:null})['then'](function(_0x5c01ce){if(_0x5c01ce){return _0x5c01ce[_0x7823('0x22')](_0x69c80c[_0x7823('0x23')][_0x7823('0x24')],_[_0x7823('0x25')](_0x69c80c[_0x7823('0x23')],[_0x7823('0x24'),'id'])||{});}})[_0x7823('0x26')](function(_0x454e16){logger[_0x7823('0x11')](_0x7823('0x27'),_0x69c80c);logger['debug']('AddTags',_0x69c80c,JSON[_0x7823('0x14')](_0x454e16));_0x2b8b81(_0x454e16);})['catch'](function(_0x8a23){logger[_0x7823('0x15')](_0x7823('0x27'),_0x8a23[_0x7823('0x18')],_0x69c80c);_0x13d944(_this['error'](0x1f4,_0x8a23[_0x7823('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 50463c5..2abafdc 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 _0x8dc2=['emit','register','length','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x2440e3,_0x503e70){var _0x2cecfb=function(_0x8f88cb){while(--_0x8f88cb){_0x2440e3['push'](_0x2440e3['shift']());}};_0x2cecfb(++_0x503e70);}(_0x8dc2,0x1e4));var _0x28dc=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0x8dc2[_0x377a6e];return _0x37f751;};'use strict';var FaxInteractionEvents=require(_0x28dc('0x0'));var events=[_0x28dc('0x1'),_0x28dc('0x2'),_0x28dc('0x3')];function createListener(_0xf8faf8,_0x4a249f){return function(_0x1cc718){_0x4a249f[_0x28dc('0x4')](_0xf8faf8,_0x1cc718);};}function removeListener(_0xf500e8,_0x59d991){return function(){FaxInteractionEvents['removeListener'](_0xf500e8,_0x59d991);};}exports[_0x28dc('0x5')]=function(_0x58b35d){for(var _0x49040a=0x0,_0x58e1f0=events[_0x28dc('0x6')];_0x49040a<_0x58e1f0;_0x49040a++){var _0x1c5991=events[_0x49040a];var _0x151603=createListener(_0x28dc('0x7')+_0x1c5991,_0x58b35d);FaxInteractionEvents['on'](_0x1c5991,_0x151603);}}; \ No newline at end of file +var _0x6de3=['faxInteraction:','./faxInteraction.events','save','remove','update','register','length'];(function(_0x1f4c7f,_0x405623){var _0x3486c3=function(_0x266ea0){while(--_0x266ea0){_0x1f4c7f['push'](_0x1f4c7f['shift']());}};_0x3486c3(++_0x405623);}(_0x6de3,0x9b));var _0x36de=function(_0x26a052,_0x2f720d){_0x26a052=_0x26a052-0x0;var _0x5e1bac=_0x6de3[_0x26a052];return _0x5e1bac;};'use strict';var FaxInteractionEvents=require(_0x36de('0x0'));var events=[_0x36de('0x1'),_0x36de('0x2'),_0x36de('0x3')];function createListener(_0x3cedb1,_0x59420a){return function(_0x489227){_0x59420a['emit'](_0x3cedb1,_0x489227);};}function removeListener(_0x2a8075,_0x2a143e){return function(){FaxInteractionEvents['removeListener'](_0x2a8075,_0x2a143e);};}exports[_0x36de('0x4')]=function(_0x1478cc){for(var _0x3e049e=0x0,_0x2b84ea=events[_0x36de('0x5')];_0x3e049e<_0x2b84ea;_0x3e049e++){var _0x1233b5=events[_0x3e049e];var _0x5c787e=createListener(_0x36de('0x6')+_0x1233b5,_0x1478cc);FaxInteractionEvents['on'](_0x1233b5,_0x5c787e);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 53d4da9..f2b4a2a 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 _0x3277=['./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','put','faxinteraction:update','update','delete','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xdec795,_0x2d9a5f){var _0x3876db=function(_0x28f886){while(--_0x28f886){_0xdec795['push'](_0xdec795['shift']());}};_0x3876db(++_0x2d9a5f);}(_0x3277,0x16c));var _0x7327=function(_0x40f9f8,_0x1d2c97){_0x40f9f8=_0x40f9f8-0x0;var _0x3f2a77=_0x3277[_0x40f9f8];return _0x3f2a77;};'use strict';var multer=require('multer');var util=require(_0x7327('0x0'));var path=require(_0x7327('0x1'));var timeout=require(_0x7327('0x2'));var express=require(_0x7327('0x3'));var router=express[_0x7327('0x4')]();var fs_extra=require(_0x7327('0x5'));var auth=require(_0x7327('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7327('0x7'));var controller=require(_0x7327('0x8'));router[_0x7327('0x9')]('/',auth[_0x7327('0xa')](),controller[_0x7327('0xb')]);router['get']('/describe',auth[_0x7327('0xa')](),controller[_0x7327('0xc')]);router[_0x7327('0x9')](_0x7327('0xd'),auth[_0x7327('0xa')](),controller['show']);router['get'](_0x7327('0xe'),auth[_0x7327('0xa')](),controller['getMessages']);router[_0x7327('0x9')](_0x7327('0xf'),auth['isAuthenticated'](),controller[_0x7327('0x10')]);router[_0x7327('0x11')]('/',auth['isAuthenticated'](),controller[_0x7327('0x12')]);router['post'](_0x7327('0xe'),auth[_0x7327('0xa')](),controller[_0x7327('0x13')]);router[_0x7327('0x11')](_0x7327('0x14'),auth[_0x7327('0xa')](),interaction[_0x7327('0x15')](_0x7327('0x16'),_0x7327('0x17')),controller['addTags']);router[_0x7327('0x18')](_0x7327('0xd'),auth[_0x7327('0xa')](),interaction[_0x7327('0x15')](_0x7327('0x16'),_0x7327('0x19')),controller[_0x7327('0x1a')]);router[_0x7327('0x1b')](_0x7327('0xd'),auth[_0x7327('0xa')](),interaction['tracked']('fax','faxinteraction:destroy'),controller[_0x7327('0x1c')]);router['delete'](_0x7327('0x14'),auth[_0x7327('0xa')](),controller[_0x7327('0x1d')]);module[_0x7327('0x1e')]=router; \ No newline at end of file +var _0xdc59=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','faxinteraction:addtags','addTags','put','fax','update','tracked','faxinteraction:destroy','destroy','removeTags','exports','multer','util'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xdc59,0x1a2));var _0x9dc5=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xdc59[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var path=require(_0x9dc5('0x2'));var timeout=require(_0x9dc5('0x3'));var express=require(_0x9dc5('0x4'));var router=express[_0x9dc5('0x5')]();var fs_extra=require(_0x9dc5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9dc5('0x7'));var config=require(_0x9dc5('0x8'));var controller=require(_0x9dc5('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x9dc5('0xa')]);router[_0x9dc5('0xb')](_0x9dc5('0xc'),auth[_0x9dc5('0xd')](),controller[_0x9dc5('0xe')]);router['get'](_0x9dc5('0xf'),auth[_0x9dc5('0xd')](),controller[_0x9dc5('0x10')]);router['get']('/:id/messages',auth[_0x9dc5('0xd')](),controller[_0x9dc5('0x11')]);router[_0x9dc5('0xb')](_0x9dc5('0x12'),auth[_0x9dc5('0xd')](),controller[_0x9dc5('0x13')]);router[_0x9dc5('0x14')]('/',auth[_0x9dc5('0xd')](),controller[_0x9dc5('0x15')]);router[_0x9dc5('0x14')](_0x9dc5('0x16'),auth[_0x9dc5('0xd')](),controller[_0x9dc5('0x17')]);router[_0x9dc5('0x14')](_0x9dc5('0x18'),auth[_0x9dc5('0xd')](),interaction['tracked']('fax',_0x9dc5('0x19')),controller[_0x9dc5('0x1a')]);router[_0x9dc5('0x1b')](_0x9dc5('0xf'),auth['isAuthenticated'](),interaction['tracked'](_0x9dc5('0x1c'),'faxinteraction:update'),controller[_0x9dc5('0x1d')]);router['delete'](_0x9dc5('0xf'),auth['isAuthenticated'](),interaction[_0x9dc5('0x1e')]('fax',_0x9dc5('0x1f')),controller[_0x9dc5('0x20')]);router['delete'](_0x9dc5('0x18'),auth[_0x9dc5('0xd')](),controller[_0x9dc5('0x21')]);module[_0x9dc5('0x22')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 2a2be40..6d8c254 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 _0x2356=['exports','TEXT','ENUM','out','DATE'];(function(_0x17e88d,_0x47d773){var _0x19b9bd=function(_0x1e81b4){while(--_0x1e81b4){_0x17e88d['push'](_0x17e88d['shift']());}};_0x19b9bd(++_0x47d773);}(_0x2356,0x14f));var _0x6235=function(_0x1537f2,_0x449350){_0x1537f2=_0x1537f2-0x0;var _0x33cf7b=_0x2356[_0x1537f2];return _0x33cf7b;};'use strict';var Sequelize=require('sequelize');module[_0x6235('0x0')]={'body':{'type':Sequelize[_0x6235('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6235('0x2')]('in',_0x6235('0x3')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x6235('0x4')]}}; \ No newline at end of file +var _0x303a=['ENUM','out','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x50a1f6,_0x238fd8){var _0x84f8d4=function(_0x2d9586){while(--_0x2d9586){_0x50a1f6['push'](_0x50a1f6['shift']());}};_0x84f8d4(++_0x238fd8);}(_0x303a,0x1a0));var _0xa303=function(_0x3252b1,_0x54e32d){_0x3252b1=_0x3252b1-0x0;var _0x5f189d=_0x303a[_0x3252b1];return _0x5f189d;};'use strict';var Sequelize=require(_0xa303('0x0'));module['exports']={'body':{'type':Sequelize[_0xa303('0x1')](_0xa303('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa303('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa303('0x4')]('in','out'),'defaultValue':_0xa303('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xa303('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xa303('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index c06bf73..9d57cbc 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 _0xd713=['rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','User','fullname','rejectmessage','create','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','zip-dir','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','defaults','localhost','./faxMessage.socket','register','client','http','then','info','FaxMessage,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','FaxMessage','includeAll','include','findAll','rows','params','keys','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','sequelize','Sequelize','QueryTypes','contact','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject'];(function(_0x1d94b7,_0x5988e5){var _0x40a258=function(_0x3da766){while(--_0x3da766){_0x1d94b7['push'](_0x1d94b7['shift']());}};_0x40a258(++_0x5988e5);}(_0xd713,0x1b4));var _0x3d71=function(_0x3e98bd,_0x4751de){_0x3e98bd=_0x3e98bd-0x0;var _0x3a9621=_0xd713[_0x3e98bd];return _0x3a9621;};'use strict';var emlformat=require(_0x3d71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3d71('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3d71('0x2'));var BPromise=require(_0x3d71('0x3'));var Mustache=require('mustache');var util=require(_0x3d71('0x4'));var path=require(_0x3d71('0x5'));var sox=require('sox');var csv=require(_0x3d71('0x6'));var ejs=require(_0x3d71('0x7'));var fs=require('fs');var fs_extra=require(_0x3d71('0x8'));var _=require(_0x3d71('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3d71('0xa'));var toCsv=require(_0x3d71('0x6'));var querystring=require(_0x3d71('0xb'));var Papa=require(_0x3d71('0xc'));var Redis=require(_0x3d71('0xd'));var authService=require(_0x3d71('0xe'));var qs=require(_0x3d71('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d71('0x10'));var logger=require(_0x3d71('0x11'))('api');var utils=require(_0x3d71('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3d71('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3d71('0x14')](config['redis'],{'host':_0x3d71('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d71('0x16'))[_0x3d71('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3d71('0x18')][_0x3d71('0x19')]({'port':0x232c});var client9002=jayson[_0x3d71('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a31df,_0x492d20,_0x5c139c,_0x424174){return new BPromise(function(_0x1a1085,_0x2fd8e9){var _0x1ec3f0=_0x424174||client;return _0x1ec3f0['request'](_0x1a31df,_0x5c139c)[_0x3d71('0x1a')](function(_0x301298){logger[_0x3d71('0x1b')](_0x3d71('0x1c'),_0x492d20,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x492d20,'request\x20sent',JSON[_0x3d71('0x1d')](_0x301298));if(_0x301298[_0x3d71('0x1e')]){if(_0x301298[_0x3d71('0x1e')][_0x3d71('0x1f')]===0x1f4){logger[_0x3d71('0x1e')](_0x3d71('0x1c'),_0x492d20,_0x301298[_0x3d71('0x1e')]['message']);return _0x2fd8e9(_0x301298[_0x3d71('0x1e')][_0x3d71('0x20')]);}logger[_0x3d71('0x1e')]('FaxMessage,\x20%s,\x20%s',_0x492d20,_0x301298['error'][_0x3d71('0x20')]);return _0x1a1085(_0x301298['error'][_0x3d71('0x20')]);}else{logger[_0x3d71('0x1b')](_0x3d71('0x1c'),_0x492d20,_0x3d71('0x21'));_0x1a1085(_0x301298[_0x3d71('0x22')][_0x3d71('0x20')]);}})[_0x3d71('0x23')](function(_0x127bd5){logger[_0x3d71('0x1e')](_0x3d71('0x1c'),_0x492d20,_0x127bd5);_0x2fd8e9(_0x127bd5);});});}function respondWithStatusCode(_0x47e8d3,_0x52c554){_0x52c554=_0x52c554||0xcc;return function(_0x1926be){if(_0x1926be){return _0x47e8d3[_0x3d71('0x24')](_0x52c554);}return _0x47e8d3['status'](_0x52c554)[_0x3d71('0x25')]();};}function respondWithResult(_0x48c716,_0x364b86){_0x364b86=_0x364b86||0xc8;return function(_0x3f8ee9){if(_0x3f8ee9){return _0x48c716[_0x3d71('0x26')](_0x364b86)[_0x3d71('0x27')](_0x3f8ee9);}};}function respondWithFilteredResult(_0x1598df,_0x372b89){return function(_0x17bccf){if(_0x17bccf){var _0x5dc90e=typeof _0x372b89[_0x3d71('0x28')]===_0x3d71('0x29')&&typeof _0x372b89[_0x3d71('0x2a')]==='undefined';var _0x17e5a6=_0x17bccf[_0x3d71('0x2b')];var _0x4e8fef=_0x5dc90e?0x0:_0x372b89[_0x3d71('0x28')];var _0x51a706=_0x5dc90e?_0x17bccf[_0x3d71('0x2b')]:_0x372b89[_0x3d71('0x28')]+_0x372b89[_0x3d71('0x2a')];var _0x56c075;if(_0x51a706>=_0x17e5a6){_0x51a706=_0x17e5a6;_0x56c075=0xc8;}else{_0x56c075=0xce;}_0x1598df[_0x3d71('0x26')](_0x56c075);return _0x1598df[_0x3d71('0x2c')](_0x3d71('0x2d'),_0x4e8fef+'-'+_0x51a706+'/'+_0x17e5a6)[_0x3d71('0x27')](_0x17bccf);}return null;};}function patchUpdates(_0x5f2d52){return function(_0x4180f5){try{jsonpatch[_0x3d71('0x2e')](_0x4180f5,_0x5f2d52,!![]);}catch(_0x24b3c7){return BPromise['reject'](_0x24b3c7);}return _0x4180f5[_0x3d71('0x2f')]();};}function saveUpdates(_0x584b8a,_0x29a50c){return function(_0x4788cb){if(_0x4788cb){return _0x4788cb[_0x3d71('0x30')](_0x584b8a)['then'](function(_0x4085dc){return _0x4085dc;});}return null;};}function removeEntity(_0x3fc754,_0x57022f){return function(_0x556c15){if(_0x556c15){return _0x556c15[_0x3d71('0x31')]()['then'](function(){_0x3fc754[_0x3d71('0x26')](0xcc)[_0x3d71('0x25')]();});}};}function handleEntityNotFound(_0x382b4e,_0x4e552a){return function(_0x526199){if(!_0x526199){_0x382b4e[_0x3d71('0x24')](0x194);}return _0x526199;};}function handleError(_0x27f0ac,_0x62b018){_0x62b018=_0x62b018||0x1f4;return function(_0x8346d0){logger['error'](_0x8346d0[_0x3d71('0x32')]);if(_0x8346d0[_0x3d71('0x33')]){delete _0x8346d0[_0x3d71('0x33')];}_0x27f0ac[_0x3d71('0x26')](_0x62b018)[_0x3d71('0x34')](_0x8346d0);};}exports[_0x3d71('0x35')]=function(_0x1ff78e,_0x33f060){var _0x1d238f={},_0x3f540e={},_0x5cdaf9={'count':0x0,'rows':[]};var _0x533cf5=_[_0x3d71('0x36')](db['FaxMessage'][_0x3d71('0x37')],function(_0x50f15f){return{'name':_0x50f15f[_0x3d71('0x38')],'type':_0x50f15f[_0x3d71('0x39')][_0x3d71('0x3a')]};});_0x3f540e['model']=_[_0x3d71('0x36')](_0x533cf5,_0x3d71('0x33'));_0x3f540e[_0x3d71('0x3b')]=_['keys'](_0x1ff78e[_0x3d71('0x3b')]);_0x3f540e['filters']=_[_0x3d71('0x3c')](_0x3f540e[_0x3d71('0x3d')],_0x3f540e[_0x3d71('0x3b')]);_0x1d238f[_0x3d71('0x3e')]=_[_0x3d71('0x3c')](_0x3f540e[_0x3d71('0x3d')],qs[_0x3d71('0x3f')](_0x1ff78e[_0x3d71('0x3b')][_0x3d71('0x3f')]));_0x1d238f[_0x3d71('0x3e')]=_0x1d238f[_0x3d71('0x3e')]['length']?_0x1d238f[_0x3d71('0x3e')]:_0x3f540e[_0x3d71('0x3d')];if(!_0x1ff78e[_0x3d71('0x3b')][_0x3d71('0x40')](_0x3d71('0x41'))){_0x1d238f[_0x3d71('0x2a')]=qs[_0x3d71('0x2a')](_0x1ff78e[_0x3d71('0x3b')][_0x3d71('0x2a')]);_0x1d238f[_0x3d71('0x28')]=qs[_0x3d71('0x28')](_0x1ff78e[_0x3d71('0x3b')][_0x3d71('0x28')]);}_0x1d238f[_0x3d71('0x42')]=qs[_0x3d71('0x43')](_0x1ff78e[_0x3d71('0x3b')][_0x3d71('0x43')]);_0x1d238f['where']=qs[_0x3d71('0x44')](_[_0x3d71('0x45')](_0x1ff78e[_0x3d71('0x3b')],_0x3f540e[_0x3d71('0x44')]),_0x533cf5);if(_0x1ff78e[_0x3d71('0x3b')][_0x3d71('0x46')]){_0x1d238f[_0x3d71('0x47')]=_[_0x3d71('0x48')](_0x1d238f[_0x3d71('0x47')],{'$or':_['map'](_0x533cf5,function(_0x432f4b){if(_0x432f4b[_0x3d71('0x39')]!==_0x3d71('0x49')){var _0x42cf9b={};_0x42cf9b[_0x432f4b[_0x3d71('0x33')]]={'$like':'%'+_0x1ff78e['query'][_0x3d71('0x46')]+'%'};return _0x42cf9b;}})});}_0x1d238f=_['merge']({},_0x1d238f,_0x1ff78e[_0x3d71('0x4a')]);var _0x5042a2={'where':_0x1d238f[_0x3d71('0x47')]};return db[_0x3d71('0x4b')][_0x3d71('0x2b')](_0x5042a2)[_0x3d71('0x1a')](function(_0x3c4719){_0x5cdaf9[_0x3d71('0x2b')]=_0x3c4719;if(_0x1ff78e[_0x3d71('0x3b')][_0x3d71('0x4c')]){_0x1d238f[_0x3d71('0x4d')]=[{'all':!![]}];}return db[_0x3d71('0x4b')][_0x3d71('0x4e')](_0x1d238f);})[_0x3d71('0x1a')](function(_0x3017da){_0x5cdaf9[_0x3d71('0x4f')]=_0x3017da;return _0x5cdaf9;})['then'](respondWithFilteredResult(_0x33f060,_0x1d238f))[_0x3d71('0x23')](handleError(_0x33f060,null));};exports['show']=function(_0x538276,_0x459f72){var _0x3b4296={'raw':!![],'where':{'id':_0x538276[_0x3d71('0x50')]['id']}},_0x5a116c={};_0x5a116c[_0x3d71('0x3d')]=_[_0x3d71('0x51')](db[_0x3d71('0x4b')][_0x3d71('0x37')]);_0x5a116c['query']=_[_0x3d71('0x51')](_0x538276[_0x3d71('0x3b')]);_0x5a116c[_0x3d71('0x44')]=_['intersection'](_0x5a116c[_0x3d71('0x3d')],_0x5a116c[_0x3d71('0x3b')]);_0x3b4296[_0x3d71('0x3e')]=_['intersection'](_0x5a116c[_0x3d71('0x3d')],qs['fields'](_0x538276[_0x3d71('0x3b')][_0x3d71('0x3f')]));_0x3b4296['attributes']=_0x3b4296['attributes']['length']?_0x3b4296[_0x3d71('0x3e')]:_0x5a116c[_0x3d71('0x3d')];if(_0x538276['query'][_0x3d71('0x4c')]){_0x3b4296['include']=[{'all':!![]}];}_0x3b4296=_[_0x3d71('0x48')]({},_0x3b4296,_0x538276[_0x3d71('0x4a')]);return db['FaxMessage'][_0x3d71('0x52')](_0x3b4296)[_0x3d71('0x1a')](handleEntityNotFound(_0x459f72,null))[_0x3d71('0x1a')](respondWithResult(_0x459f72,null))[_0x3d71('0x23')](handleError(_0x459f72,null));};exports[_0x3d71('0x30')]=function(_0x265eff,_0x468d0a){if(_0x265eff[_0x3d71('0x53')]['id']){delete _0x265eff[_0x3d71('0x53')]['id'];}return db['FaxMessage'][_0x3d71('0x52')]({'where':{'id':_0x265eff[_0x3d71('0x50')]['id']}})['then'](handleEntityNotFound(_0x468d0a,null))[_0x3d71('0x1a')](saveUpdates(_0x265eff[_0x3d71('0x53')],null))['then'](respondWithResult(_0x468d0a,null))[_0x3d71('0x23')](handleError(_0x468d0a,null));};exports[_0x3d71('0x31')]=function(_0xd02c6d,_0x2dae9f){return db[_0x3d71('0x4b')][_0x3d71('0x52')]({'where':{'id':_0xd02c6d[_0x3d71('0x50')]['id']}})[_0x3d71('0x1a')](handleEntityNotFound(_0x2dae9f,null))[_0x3d71('0x1a')](removeEntity(_0x2dae9f,null))[_0x3d71('0x23')](handleError(_0x2dae9f,null));};exports[_0x3d71('0x54')]=function(_0x22387c,_0x23a280){return db[_0x3d71('0x4b')][_0x3d71('0x54')]()['then'](respondWithResult(_0x23a280,null))['catch'](handleError(_0x23a280,null));};var interaction_log=require(_0x3d71('0x11'))(_0x3d71('0x55'));exports[_0x3d71('0x56')]=function(_0x2986b6,_0x3db29c,_0xa2d0e8){var _0x3d079b={'agent':{},'channel':_0x3d71('0x57')};if(_0x2986b6[_0x3d71('0x53')]['id']){delete _0x2986b6['body']['id'];}_0x2986b6[_0x3d71('0x53')][_0x3d71('0x58')]=!![];_0x2986b6[_0x3d71('0x53')][_0x3d71('0x59')]=moment()[_0x3d71('0x5a')](_0x3d71('0x5b'));_0x2986b6[_0x3d71('0x53')][_0x3d71('0x5c')]=_0x2986b6[_0x3d71('0x53')][_0x3d71('0x5c')]||_0x2986b6[_0x3d71('0x5d')]['id'];_0x3d079b[_0x3d71('0x5e')]['id']=_0x2986b6['body']['UserId'];return db[_0x3d71('0x4b')]['find']({'where':{'id':_0x2986b6[_0x3d71('0x50')]['id'],'UserId':null}})[_0x3d71('0x1a')](handleEntityNotFound(_0x3db29c,null))[_0x3d71('0x1a')](saveUpdates(_0x2986b6[_0x3d71('0x53')],null))['then'](function(_0x3baa6c){if(_0x3baa6c){_0x3d079b[_0x3d71('0x20')]=_0x3baa6c[_0x3d71('0x5f')]({'plain':!![]});return db[_0x3d71('0x60')][_0x3d71('0x52')]({'where':{'id':_0x3baa6c[_0x3d71('0x61')]}});}return null;})[_0x3d71('0x1a')](handleEntityNotFound(_0x3db29c,null))[_0x3d71('0x1a')](function(_0x5521b5){if(_0x5521b5){return _0x5521b5['update']({'UserId':_0x2986b6[_0x3d71('0x53')][_0x3d71('0x5c')],'read1stAt':_[_0x3d71('0x62')](_0x5521b5[_0x3d71('0x63')])?moment()['format'](_0x3d71('0x5b')):undefined});}return null;})[_0x3d71('0x1a')](function(_0x3f0c63){if(_0x3f0c63){_0x3d079b[_0x3d71('0x64')]=_0x3f0c63[_0x3d71('0x5f')]({'plain':!![]});interaction_log['info'](_0x3d71('0x65'),_0x2986b6[_0x3d71('0x5d')]['id'],_0x2986b6['user'][_0x3d71('0x33')],_0x2986b6[_0x3d71('0x5d')][_0x3d71('0x66')],_0x3d079b[_0x3d71('0x64')]['id'],_0x2986b6['body']?JSON[_0x3d71('0x1d')](_0x2986b6['body']):_0x3d71('0x67'));return respondWithRpcPromise('AcceptMessage',_0x3d71('0x68'),_0x3d079b);}return null;})[_0x3d71('0x1a')](function(_0x2b3907){var _0x1f1ae8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2b3907[_0x3d71('0x20')]['ContactId'];return db[_0x3d71('0x69')][_0x3d71('0x3b')](_0x1f1ae8,{'type':db[_0x3d71('0x6a')][_0x3d71('0x6b')]['SELECT'],'raw':!![]})[_0x3d71('0x1a')](function(_0x6deff2){return _0x6deff2;});})[_0x3d71('0x1a')](function(_0x57a75c){if(_0x57a75c){_0x3d079b[_0x3d71('0x20')][_0x3d71('0x6c')]=_0x57a75c[0x0];if(!_0x2986b6['body'][_0x3d71('0x5c')])return;return db['User'][_0x3d71('0x52')]({'where':{'id':_0x2986b6[_0x3d71('0x53')][_0x3d71('0x5c')],'role':_0x3d71('0x5e')},'attributes':['id',_0x3d71('0x33'),'fullname',_0x3d71('0x6d'),_0x3d71('0x6e')],'raw':!![]});}return null;})['then'](function(_0x49b2ee){if(!_0x49b2ee)return null;_0x3d079b['message'][_0x3d71('0x5e')]=_0x49b2ee;return _0x3d079b;})[_0x3d71('0x1a')](function(_0x4a2c9d){if(_0x4a2c9d){if(_0x2986b6[_0x3d71('0x53')][_0x3d71('0x6f')]){_0x3d079b[_0x3d71('0x20')][_0x3d71('0x70')]=util[_0x3d71('0x5a')](_0x3d71('0x71'),_0x2986b6[_0x3d71('0x5d')][_0x3d71('0x33')]);_0x3d079b[_0x3d71('0x20')][_0x3d71('0x72')]=_0x3d079b[_0x3d71('0x72')];_0x3d079b[_0x3d71('0x20')][_0x3d71('0x73')]=_0x3d079b[_0x3d71('0x72')];_0x3d079b[_0x3d71('0x20')][_0x3d71('0x74')]=_0x3d71('0x56');return respondWithRpcPromise('EventManager',_0x3d71('0x75'),{'event':_0x3d71('0x76'),'message':_0x3d079b[_0x3d71('0x20')]},client9002)[_0x3d71('0x1a')](function(){return _0x3d079b;});}return _0x3d079b;}return null;})['then'](respondWithResult(_0x3db29c,null))[_0x3d71('0x23')](handleError(_0x3db29c,null));};var interaction_log=require(_0x3d71('0x11'))(_0x3d71('0x55'));exports[_0x3d71('0x77')]=function(_0xd502a4,_0x208263,_0x516d74){var _0xae8650={'agent':{},'channel':_0x3d71('0x57')};if(_0xd502a4[_0x3d71('0x53')]['id']){delete _0xd502a4['body']['id'];}_0xd502a4[_0x3d71('0x53')][_0x3d71('0x5c')]=_0xd502a4[_0x3d71('0x53')][_0x3d71('0x5c')]||_0xd502a4[_0x3d71('0x5d')]['id'];_0xae8650[_0x3d71('0x5e')]['id']=_0xd502a4[_0x3d71('0x53')][_0x3d71('0x5c')];return db[_0x3d71('0x4b')][_0x3d71('0x52')]({'where':{'id':_0xd502a4['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x208263,null))[_0x3d71('0x1a')](function(_0x51398f){if(_0x51398f){_0xae8650['message']=_0x51398f[_0x3d71('0x5f')]({'plain':!![]});return db[_0x3d71('0x60')][_0x3d71('0x52')]({'where':{'id':_0x51398f[_0x3d71('0x61')]}});}return null;})[_0x3d71('0x1a')](handleEntityNotFound(_0x208263,null))['then'](function(_0x2941bd){if(_0x2941bd){_0xae8650['interaction']=_0x2941bd[_0x3d71('0x5f')]({'plain':!![]});interaction_log[_0x3d71('0x1b')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xd502a4[_0x3d71('0x5d')]['id'],_0xd502a4['user'][_0x3d71('0x33')],_0xd502a4[_0x3d71('0x5d')][_0x3d71('0x66')],_0xae8650[_0x3d71('0x64')]['id'],_0xd502a4[_0x3d71('0x53')]?JSON[_0x3d71('0x1d')](_0xd502a4[_0x3d71('0x53')]):_0x3d71('0x67'));return respondWithRpcPromise('RejectMessage',_0x3d71('0x78'),_0xae8650);}return null;})['then'](function(_0x56ed64){var _0x2e8888=_0x3d71('0x79')+_0x56ed64[_0x3d71('0x20')][_0x3d71('0x7a')];return db['sequelize'][_0x3d71('0x3b')](_0x2e8888,{'type':db[_0x3d71('0x6a')][_0x3d71('0x6b')][_0x3d71('0x7b')],'raw':!![]})['then'](function(_0x1b60a0){return _0x1b60a0;});})[_0x3d71('0x1a')](function(_0x3b8ad7){if(_0x3b8ad7){_0xae8650['message']['contact']=_0x3b8ad7[0x0];if(!_0xd502a4[_0x3d71('0x53')]['UserId'])return;return db[_0x3d71('0x7c')]['find']({'where':{'id':_0xd502a4['body'][_0x3d71('0x5c')],'role':_0x3d71('0x5e')},'attributes':['id','name',_0x3d71('0x7d'),_0x3d71('0x6d'),_0x3d71('0x6e')],'raw':!![]});}return null;})[_0x3d71('0x1a')](function(_0x46ccad){if(!_0x46ccad)return null;_0xae8650[_0x3d71('0x20')][_0x3d71('0x5e')]=_0x46ccad;return _0xae8650;})['then'](function(_0x25e28e){if(_0x25e28e){_0x25e28e['message']['interface']=util[_0x3d71('0x5a')]('SIP/%s',_0xd502a4[_0x3d71('0x5d')][_0x3d71('0x33')]);_0x25e28e[_0x3d71('0x20')][_0x3d71('0x72')]=_0xae8650['channel'];_0x25e28e[_0x3d71('0x20')][_0x3d71('0x73')]=_0xae8650[_0x3d71('0x72')];_0x25e28e['message'][_0x3d71('0x74')]=_0x3d71('0x77');respondWithRpcPromise('EventManager',_0x3d71('0x75'),{'event':_0x3d71('0x7e'),'message':_0x25e28e['message']},client9002);return _0xae8650;}return null;})['then'](respondWithResult(_0x208263,null))[_0x3d71('0x23')](handleError(_0x208263,null));};exports[_0x3d71('0x7f')]=function(_0x1bc794,_0x1b4aa9){var _0x347cf6;return db[_0x3d71('0x4b')][_0x3d71('0x7f')](_0x1bc794[_0x3d71('0x53')],{})[_0x3d71('0x1a')](function(_0x526694){_0x347cf6=_0x526694;return db['CmContact']['findOne']({'where':{'id':_0x347cf6[_0x3d71('0x7a')]}});})[_0x3d71('0x1a')](function(_0x5dde70){if(_['isNil'](_0x5dde70)){return;}else{_0x347cf6[_0x3d71('0x57')]=_0x5dde70[_0x3d71('0x57')];return db[_0x3d71('0x80')]['findOne']({'where':{'id':_0x347cf6[_0x3d71('0x81')]}});}})['then'](function(_0xc6d2e4){return respondWithRpcPromise(_0x3d71('0x82'),_0x3d71('0x82'),{'FaxAccountId':_[_0x3d71('0x62')](_0x1bc794[_0x3d71('0x53')])?undefined:_0x1bc794[_0x3d71('0x53')]['FaxAccountId'],'path':_['isNil'](_0xc6d2e4)?undefined:util[_0x3d71('0x5a')](_0x3d71('0x83'),_0xc6d2e4[_0x3d71('0x84')]),'fax':_['isNil'](_0x347cf6[_0x3d71('0x57')])?undefined:_0x347cf6['fax'],'AttachmentId':_0x347cf6[_0x3d71('0x81')]},client9002);})[_0x3d71('0x1a')](respondWithResult(_0x1b4aa9,0xc9))['catch'](handleError(_0x1b4aa9,null));};exports[_0x3d71('0x85')]=function(_0x34569a,_0xdb7d35){var _0x446653=path[_0x3d71('0x86')](config[_0x3d71('0x87')],_0x3d71('0x88'),_0x3d71('0x89'),_0x3d71('0x8a'));return db['FaxMessage'][_0x3d71('0x52')]({'where':{'id':_0x34569a['params']['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x3d71('0x1a')](handleEntityNotFound(_0xdb7d35,null))[_0x3d71('0x1a')](function(_0x1800e0){if(_0x1800e0){return _0xdb7d35[_0x3d71('0x85')](path['join'](_0x446653,_0x1800e0['Attachment'][_0x3d71('0x84')]));}})['catch'](handleError(_0xdb7d35,null));}; \ No newline at end of file +var _0xa80f=['hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','params','find','body','describe','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT','motionChannel','rejectmessage','CmContact','findOne','Attachment','FaxAccountId','join','attachments','download','basename','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','client','http','request','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','apply','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','query','fields','length'];(function(_0x41074c,_0x268379){var _0xef4759=function(_0x9f5076){while(--_0x9f5076){_0x41074c['push'](_0x41074c['shift']());}};_0xef4759(++_0x268379);}(_0xa80f,0xca));var _0xfa80=function(_0x8f15dd,_0x1b132c){_0x8f15dd=_0x8f15dd-0x0;var _0x6a2868=_0xa80f[_0x8f15dd];return _0x6a2868;};'use strict';var emlformat=require(_0xfa80('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfa80('0x1'));var jsonpatch=require(_0xfa80('0x2'));var rp=require(_0xfa80('0x3'));var moment=require('moment');var BPromise=require(_0xfa80('0x4'));var Mustache=require(_0xfa80('0x5'));var util=require(_0xfa80('0x6'));var path=require(_0xfa80('0x7'));var sox=require(_0xfa80('0x8'));var csv=require('to-csv');var ejs=require(_0xfa80('0x9'));var fs=require('fs');var fs_extra=require(_0xfa80('0xa'));var _=require(_0xfa80('0xb'));var squel=require(_0xfa80('0xc'));var crypto=require('crypto');var jsforce=require(_0xfa80('0xd'));var deskjs=require(_0xfa80('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfa80('0xf'));var Papa=require('papaparse');var Redis=require(_0xfa80('0x10'));var authService=require(_0xfa80('0x11'));var qs=require(_0xfa80('0x12'));var as=require(_0xfa80('0x13'));var hardwareService=require(_0xfa80('0x14'));var logger=require(_0xfa80('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfa80('0x16'));var db=require(_0xfa80('0x17'))['db'];config[_0xfa80('0x18')]=_[_0xfa80('0x19')](config[_0xfa80('0x18')],{'host':_0xfa80('0x1a'),'port':0x18eb});var socket=require(_0xfa80('0x1b'))(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xfa80('0x1c')][_0xfa80('0x1d')]({'port':0x232c});var client9002=jayson[_0xfa80('0x1c')][_0xfa80('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xc9a4b4,_0x213805,_0x3b5884,_0x33df3d){return new BPromise(function(_0x11776d,_0x180204){var _0x45c059=_0x33df3d||client;return _0x45c059[_0xfa80('0x1e')](_0xc9a4b4,_0x3b5884)[_0xfa80('0x1f')](function(_0x6e56f7){logger['info']('FaxMessage,\x20%s,\x20%s',_0x213805,_0xfa80('0x20'));logger[_0xfa80('0x21')](_0xfa80('0x22'),_0x213805,_0xfa80('0x20'),JSON[_0xfa80('0x23')](_0x6e56f7));if(_0x6e56f7[_0xfa80('0x24')]){if(_0x6e56f7['error'][_0xfa80('0x25')]===0x1f4){logger[_0xfa80('0x24')](_0xfa80('0x26'),_0x213805,_0x6e56f7['error'][_0xfa80('0x27')]);return _0x180204(_0x6e56f7[_0xfa80('0x24')]['message']);}logger[_0xfa80('0x24')](_0xfa80('0x26'),_0x213805,_0x6e56f7['error']['message']);return _0x11776d(_0x6e56f7[_0xfa80('0x24')][_0xfa80('0x27')]);}else{logger[_0xfa80('0x28')](_0xfa80('0x26'),_0x213805,_0xfa80('0x20'));_0x11776d(_0x6e56f7[_0xfa80('0x29')][_0xfa80('0x27')]);}})[_0xfa80('0x2a')](function(_0x1a26e6){logger[_0xfa80('0x24')](_0xfa80('0x26'),_0x213805,_0x1a26e6);_0x180204(_0x1a26e6);});});}function respondWithStatusCode(_0x311ee7,_0x457fea){_0x457fea=_0x457fea||0xcc;return function(_0x2edf6f){if(_0x2edf6f){return _0x311ee7[_0xfa80('0x2b')](_0x457fea);}return _0x311ee7[_0xfa80('0x2c')](_0x457fea)['end']();};}function respondWithResult(_0x24dcf4,_0x505a41){_0x505a41=_0x505a41||0xc8;return function(_0x381897){if(_0x381897){return _0x24dcf4[_0xfa80('0x2c')](_0x505a41)[_0xfa80('0x2d')](_0x381897);}};}function respondWithFilteredResult(_0x1188ae,_0x3f2c8b){return function(_0x254879){if(_0x254879){var _0xffddba=typeof _0x3f2c8b[_0xfa80('0x2e')]===_0xfa80('0x2f')&&typeof _0x3f2c8b['limit']===_0xfa80('0x2f');var _0x4165e3=_0x254879[_0xfa80('0x30')];var _0x4ad10d=_0xffddba?0x0:_0x3f2c8b[_0xfa80('0x2e')];var _0x187c08=_0xffddba?_0x254879[_0xfa80('0x30')]:_0x3f2c8b[_0xfa80('0x2e')]+_0x3f2c8b[_0xfa80('0x31')];var _0x4f953a;if(_0x187c08>=_0x4165e3){_0x187c08=_0x4165e3;_0x4f953a=0xc8;}else{_0x4f953a=0xce;}_0x1188ae[_0xfa80('0x2c')](_0x4f953a);return _0x1188ae[_0xfa80('0x32')]('Content-Range',_0x4ad10d+'-'+_0x187c08+'/'+_0x4165e3)[_0xfa80('0x2d')](_0x254879);}return null;};}function patchUpdates(_0x1df022){return function(_0x6878ee){try{jsonpatch[_0xfa80('0x33')](_0x6878ee,_0x1df022,!![]);}catch(_0x491d13){return BPromise['reject'](_0x491d13);}return _0x6878ee['save']();};}function saveUpdates(_0x458185,_0x6804b6){return function(_0x58d8ce){if(_0x58d8ce){return _0x58d8ce[_0xfa80('0x34')](_0x458185)['then'](function(_0x3fdc4e){return _0x3fdc4e;});}return null;};}function removeEntity(_0x1bc845,_0x371b75){return function(_0x367435){if(_0x367435){return _0x367435[_0xfa80('0x35')]()[_0xfa80('0x1f')](function(){_0x1bc845['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfe4d34,_0x203e9e){return function(_0x2a973b){if(!_0x2a973b){_0xfe4d34[_0xfa80('0x2b')](0x194);}return _0x2a973b;};}function handleError(_0x1a037c,_0x473041){_0x473041=_0x473041||0x1f4;return function(_0x35e6b8){logger[_0xfa80('0x24')](_0x35e6b8[_0xfa80('0x36')]);if(_0x35e6b8[_0xfa80('0x37')]){delete _0x35e6b8[_0xfa80('0x37')];}_0x1a037c[_0xfa80('0x2c')](_0x473041)[_0xfa80('0x38')](_0x35e6b8);};}exports[_0xfa80('0x39')]=function(_0x582737,_0x3a764c){var _0x1b1f2f={},_0x4e64cb={},_0x117965={'count':0x0,'rows':[]};var _0x23d250=_[_0xfa80('0x3a')](db[_0xfa80('0x3b')][_0xfa80('0x3c')],function(_0xe8cdc9){return{'name':_0xe8cdc9[_0xfa80('0x3d')],'type':_0xe8cdc9[_0xfa80('0x3e')][_0xfa80('0x3f')]};});_0x4e64cb[_0xfa80('0x40')]=_[_0xfa80('0x3a')](_0x23d250,_0xfa80('0x37'));_0x4e64cb['query']=_[_0xfa80('0x41')](_0x582737['query']);_0x4e64cb[_0xfa80('0x42')]=_[_0xfa80('0x43')](_0x4e64cb[_0xfa80('0x40')],_0x4e64cb['query']);_0x1b1f2f[_0xfa80('0x44')]=_[_0xfa80('0x43')](_0x4e64cb[_0xfa80('0x40')],qs['fields'](_0x582737[_0xfa80('0x45')][_0xfa80('0x46')]));_0x1b1f2f[_0xfa80('0x44')]=_0x1b1f2f['attributes'][_0xfa80('0x47')]?_0x1b1f2f[_0xfa80('0x44')]:_0x4e64cb[_0xfa80('0x40')];if(!_0x582737[_0xfa80('0x45')][_0xfa80('0x48')]('nolimit')){_0x1b1f2f[_0xfa80('0x31')]=qs[_0xfa80('0x31')](_0x582737['query'][_0xfa80('0x31')]);_0x1b1f2f[_0xfa80('0x2e')]=qs[_0xfa80('0x2e')](_0x582737[_0xfa80('0x45')][_0xfa80('0x2e')]);}_0x1b1f2f[_0xfa80('0x49')]=qs[_0xfa80('0x4a')](_0x582737[_0xfa80('0x45')][_0xfa80('0x4a')]);_0x1b1f2f[_0xfa80('0x4b')]=qs[_0xfa80('0x42')](_[_0xfa80('0x4c')](_0x582737['query'],_0x4e64cb[_0xfa80('0x42')]),_0x23d250);if(_0x582737[_0xfa80('0x45')][_0xfa80('0x4d')]){_0x1b1f2f[_0xfa80('0x4b')]=_[_0xfa80('0x4e')](_0x1b1f2f['where'],{'$or':_[_0xfa80('0x3a')](_0x23d250,function(_0x3ef12f){if(_0x3ef12f[_0xfa80('0x3e')]!=='VIRTUAL'){var _0x4b5cc9={};_0x4b5cc9[_0x3ef12f[_0xfa80('0x37')]]={'$like':'%'+_0x582737['query'][_0xfa80('0x4d')]+'%'};return _0x4b5cc9;}})});}_0x1b1f2f=_[_0xfa80('0x4e')]({},_0x1b1f2f,_0x582737[_0xfa80('0x4f')]);var _0x194fb4={'where':_0x1b1f2f[_0xfa80('0x4b')]};return db[_0xfa80('0x3b')][_0xfa80('0x30')](_0x194fb4)[_0xfa80('0x1f')](function(_0xa6dd60){_0x117965[_0xfa80('0x30')]=_0xa6dd60;if(_0x582737[_0xfa80('0x45')]['includeAll']){_0x1b1f2f[_0xfa80('0x50')]=[{'all':!![]}];}return db[_0xfa80('0x3b')][_0xfa80('0x51')](_0x1b1f2f);})['then'](function(_0x1b0c62){_0x117965[_0xfa80('0x52')]=_0x1b0c62;return _0x117965;})[_0xfa80('0x1f')](respondWithFilteredResult(_0x3a764c,_0x1b1f2f))[_0xfa80('0x2a')](handleError(_0x3a764c,null));};exports['show']=function(_0x1910c3,_0x175c15){var _0x3364a9={'raw':!![],'where':{'id':_0x1910c3[_0xfa80('0x53')]['id']}},_0x10b4a7={};_0x10b4a7[_0xfa80('0x40')]=_['keys'](db[_0xfa80('0x3b')][_0xfa80('0x3c')]);_0x10b4a7[_0xfa80('0x45')]=_[_0xfa80('0x41')](_0x1910c3[_0xfa80('0x45')]);_0x10b4a7[_0xfa80('0x42')]=_[_0xfa80('0x43')](_0x10b4a7[_0xfa80('0x40')],_0x10b4a7[_0xfa80('0x45')]);_0x3364a9[_0xfa80('0x44')]=_[_0xfa80('0x43')](_0x10b4a7[_0xfa80('0x40')],qs[_0xfa80('0x46')](_0x1910c3[_0xfa80('0x45')][_0xfa80('0x46')]));_0x3364a9['attributes']=_0x3364a9[_0xfa80('0x44')][_0xfa80('0x47')]?_0x3364a9[_0xfa80('0x44')]:_0x10b4a7['model'];if(_0x1910c3[_0xfa80('0x45')]['includeAll']){_0x3364a9[_0xfa80('0x50')]=[{'all':!![]}];}_0x3364a9=_[_0xfa80('0x4e')]({},_0x3364a9,_0x1910c3[_0xfa80('0x4f')]);return db[_0xfa80('0x3b')][_0xfa80('0x54')](_0x3364a9)[_0xfa80('0x1f')](handleEntityNotFound(_0x175c15,null))[_0xfa80('0x1f')](respondWithResult(_0x175c15,null))[_0xfa80('0x2a')](handleError(_0x175c15,null));};exports[_0xfa80('0x34')]=function(_0x64c06d,_0x53cb45){if(_0x64c06d[_0xfa80('0x55')]['id']){delete _0x64c06d[_0xfa80('0x55')]['id'];}return db[_0xfa80('0x3b')][_0xfa80('0x54')]({'where':{'id':_0x64c06d[_0xfa80('0x53')]['id']}})[_0xfa80('0x1f')](handleEntityNotFound(_0x53cb45,null))[_0xfa80('0x1f')](saveUpdates(_0x64c06d['body'],null))[_0xfa80('0x1f')](respondWithResult(_0x53cb45,null))[_0xfa80('0x2a')](handleError(_0x53cb45,null));};exports[_0xfa80('0x35')]=function(_0xfd7b0b,_0x3aaa4e){return db[_0xfa80('0x3b')]['find']({'where':{'id':_0xfd7b0b['params']['id']}})[_0xfa80('0x1f')](handleEntityNotFound(_0x3aaa4e,null))[_0xfa80('0x1f')](removeEntity(_0x3aaa4e,null))[_0xfa80('0x2a')](handleError(_0x3aaa4e,null));};exports[_0xfa80('0x56')]=function(_0x20d72a,_0x416bda){return db[_0xfa80('0x3b')][_0xfa80('0x56')]()[_0xfa80('0x1f')](respondWithResult(_0x416bda,null))[_0xfa80('0x2a')](handleError(_0x416bda,null));};var interaction_log=require(_0xfa80('0x15'))('fax-interactions');exports[_0xfa80('0x57')]=function(_0x571b7a,_0x36b734,_0x33c15a){var _0x36a0b8={'agent':{},'channel':_0xfa80('0x58')};if(_0x571b7a[_0xfa80('0x55')]['id']){delete _0x571b7a['body']['id'];}_0x571b7a[_0xfa80('0x55')]['read']=!![];_0x571b7a['body'][_0xfa80('0x59')]=moment()[_0xfa80('0x5a')](_0xfa80('0x5b'));_0x571b7a[_0xfa80('0x55')][_0xfa80('0x5c')]=_0x571b7a['body'][_0xfa80('0x5c')]||_0x571b7a[_0xfa80('0x5d')]['id'];_0x36a0b8[_0xfa80('0x5e')]['id']=_0x571b7a['body'][_0xfa80('0x5c')];return db[_0xfa80('0x3b')][_0xfa80('0x54')]({'where':{'id':_0x571b7a['params']['id'],'UserId':null}})[_0xfa80('0x1f')](handleEntityNotFound(_0x36b734,null))[_0xfa80('0x1f')](saveUpdates(_0x571b7a[_0xfa80('0x55')],null))[_0xfa80('0x1f')](function(_0xd552b2){if(_0xd552b2){_0x36a0b8['message']=_0xd552b2[_0xfa80('0x5f')]({'plain':!![]});return db[_0xfa80('0x60')][_0xfa80('0x54')]({'where':{'id':_0xd552b2['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x36b734,null))['then'](function(_0x3ef48f){if(_0x3ef48f){return _0x3ef48f['update']({'UserId':_0x571b7a[_0xfa80('0x55')][_0xfa80('0x5c')],'read1stAt':_[_0xfa80('0x61')](_0x3ef48f[_0xfa80('0x62')])?moment()[_0xfa80('0x5a')](_0xfa80('0x5b')):undefined});}return null;})[_0xfa80('0x1f')](function(_0x5e0679){if(_0x5e0679){_0x36a0b8[_0xfa80('0x63')]=_0x5e0679['get']({'plain':!![]});interaction_log[_0xfa80('0x28')](_0xfa80('0x64'),_0x571b7a[_0xfa80('0x5d')]['id'],_0x571b7a[_0xfa80('0x5d')][_0xfa80('0x37')],_0x571b7a[_0xfa80('0x5d')][_0xfa80('0x65')],_0x36a0b8[_0xfa80('0x63')]['id'],_0x571b7a['body']?JSON[_0xfa80('0x23')](_0x571b7a[_0xfa80('0x55')]):'null');return respondWithRpcPromise(_0xfa80('0x66'),_0xfa80('0x67'),_0x36a0b8);}return null;})[_0xfa80('0x1f')](function(_0x270766){var _0x47f533=_0xfa80('0x68')+_0x270766[_0xfa80('0x27')][_0xfa80('0x69')];return db['sequelize'][_0xfa80('0x45')](_0x47f533,{'type':db[_0xfa80('0x6a')][_0xfa80('0x6b')]['SELECT'],'raw':!![]})[_0xfa80('0x1f')](function(_0x16c282){return _0x16c282;});})['then'](function(_0x454418){if(_0x454418){_0x36a0b8[_0xfa80('0x27')][_0xfa80('0x6c')]=_0x454418[0x0];if(!_0x571b7a[_0xfa80('0x55')]['UserId'])return;return db[_0xfa80('0x6d')][_0xfa80('0x54')]({'where':{'id':_0x571b7a[_0xfa80('0x55')][_0xfa80('0x5c')],'role':_0xfa80('0x5e')},'attributes':['id',_0xfa80('0x37'),_0xfa80('0x6e'),_0xfa80('0x6f'),_0xfa80('0x70')],'raw':!![]});}return null;})[_0xfa80('0x1f')](function(_0x107208){if(!_0x107208)return null;_0x36a0b8[_0xfa80('0x27')][_0xfa80('0x5e')]=_0x107208;return _0x36a0b8;})[_0xfa80('0x1f')](function(_0x58b41c){if(_0x58b41c){if(_0x571b7a[_0xfa80('0x55')][_0xfa80('0x71')]){_0x36a0b8[_0xfa80('0x27')][_0xfa80('0x72')]=util[_0xfa80('0x5a')](_0xfa80('0x73'),_0x571b7a[_0xfa80('0x5d')]['name']);_0x36a0b8['message']['channel']=_0x36a0b8[_0xfa80('0x74')];_0x36a0b8['message']['motionChannel']=_0x36a0b8[_0xfa80('0x74')];_0x36a0b8['message'][_0xfa80('0x75')]=_0xfa80('0x57');return respondWithRpcPromise(_0xfa80('0x76'),_0xfa80('0x76'),{'event':_0xfa80('0x77'),'message':_0x36a0b8[_0xfa80('0x27')]},client9002)[_0xfa80('0x1f')](function(){return _0x36a0b8;});}return _0x36a0b8;}return null;})[_0xfa80('0x1f')](respondWithResult(_0x36b734,null))[_0xfa80('0x2a')](handleError(_0x36b734,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xfa80('0x78')]=function(_0x5982b4,_0xadf09b,_0x1f84e1){var _0x52bc9a={'agent':{},'channel':'fax'};if(_0x5982b4[_0xfa80('0x55')]['id']){delete _0x5982b4[_0xfa80('0x55')]['id'];}_0x5982b4['body'][_0xfa80('0x5c')]=_0x5982b4['body'][_0xfa80('0x5c')]||_0x5982b4[_0xfa80('0x5d')]['id'];_0x52bc9a['agent']['id']=_0x5982b4[_0xfa80('0x55')]['UserId'];return db['FaxMessage'][_0xfa80('0x54')]({'where':{'id':_0x5982b4[_0xfa80('0x53')]['id'],'UserId':null}})[_0xfa80('0x1f')](handleEntityNotFound(_0xadf09b,null))[_0xfa80('0x1f')](function(_0x22a503){if(_0x22a503){_0x52bc9a[_0xfa80('0x27')]=_0x22a503[_0xfa80('0x5f')]({'plain':!![]});return db[_0xfa80('0x60')][_0xfa80('0x54')]({'where':{'id':_0x22a503[_0xfa80('0x79')]}});}return null;})['then'](handleEntityNotFound(_0xadf09b,null))[_0xfa80('0x1f')](function(_0x3557b2){if(_0x3557b2){_0x52bc9a['interaction']=_0x3557b2['get']({'plain':!![]});interaction_log[_0xfa80('0x28')](_0xfa80('0x7a'),_0x5982b4[_0xfa80('0x5d')]['id'],_0x5982b4[_0xfa80('0x5d')][_0xfa80('0x37')],_0x5982b4['user']['role'],_0x52bc9a[_0xfa80('0x63')]['id'],_0x5982b4[_0xfa80('0x55')]?JSON[_0xfa80('0x23')](_0x5982b4[_0xfa80('0x55')]):_0xfa80('0x7b'));return respondWithRpcPromise(_0xfa80('0x7c'),_0xfa80('0x7d'),_0x52bc9a);}return null;})['then'](function(_0x3778f6){var _0x43f8a1=_0xfa80('0x68')+_0x3778f6[_0xfa80('0x27')][_0xfa80('0x69')];return db['sequelize']['query'](_0x43f8a1,{'type':db[_0xfa80('0x6a')][_0xfa80('0x6b')][_0xfa80('0x7e')],'raw':!![]})['then'](function(_0x56f726){return _0x56f726;});})[_0xfa80('0x1f')](function(_0x5462bd){if(_0x5462bd){_0x52bc9a[_0xfa80('0x27')][_0xfa80('0x6c')]=_0x5462bd[0x0];if(!_0x5982b4[_0xfa80('0x55')][_0xfa80('0x5c')])return;return db['User'][_0xfa80('0x54')]({'where':{'id':_0x5982b4['body'][_0xfa80('0x5c')],'role':_0xfa80('0x5e')},'attributes':['id',_0xfa80('0x37'),'fullname',_0xfa80('0x6f'),_0xfa80('0x70')],'raw':!![]});}return null;})[_0xfa80('0x1f')](function(_0x12a565){if(!_0x12a565)return null;_0x52bc9a[_0xfa80('0x27')][_0xfa80('0x5e')]=_0x12a565;return _0x52bc9a;})[_0xfa80('0x1f')](function(_0x5ad1d5){if(_0x5ad1d5){_0x5ad1d5['message']['interface']=util[_0xfa80('0x5a')](_0xfa80('0x73'),_0x5982b4['user'][_0xfa80('0x37')]);_0x5ad1d5[_0xfa80('0x27')][_0xfa80('0x74')]=_0x52bc9a[_0xfa80('0x74')];_0x5ad1d5['message'][_0xfa80('0x7f')]=_0x52bc9a[_0xfa80('0x74')];_0x5ad1d5[_0xfa80('0x27')][_0xfa80('0x75')]=_0xfa80('0x78');respondWithRpcPromise(_0xfa80('0x76'),'EventManager',{'event':_0xfa80('0x80'),'message':_0x5ad1d5[_0xfa80('0x27')]},client9002);return _0x52bc9a;}return null;})[_0xfa80('0x1f')](respondWithResult(_0xadf09b,null))[_0xfa80('0x2a')](handleError(_0xadf09b,null));};exports['create']=function(_0x8d3501,_0x3605f7){var _0x2023e3;return db[_0xfa80('0x3b')]['create'](_0x8d3501[_0xfa80('0x55')],{})[_0xfa80('0x1f')](function(_0x3ff55c){_0x2023e3=_0x3ff55c;return db[_0xfa80('0x81')][_0xfa80('0x82')]({'where':{'id':_0x2023e3[_0xfa80('0x69')]}});})[_0xfa80('0x1f')](function(_0x459632){if(_[_0xfa80('0x61')](_0x459632)){return;}else{_0x2023e3[_0xfa80('0x58')]=_0x459632[_0xfa80('0x58')];return db[_0xfa80('0x83')]['findOne']({'where':{'id':_0x2023e3['AttachmentId']}});}})[_0xfa80('0x1f')](function(_0x2968e7){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xfa80('0x61')](_0x8d3501['body'])?undefined:_0x8d3501[_0xfa80('0x55')][_0xfa80('0x84')],'path':_[_0xfa80('0x61')](_0x2968e7)?undefined:util[_0xfa80('0x5a')]('/var/opt/motion2/server/files/attachments/%s',_0x2968e7['basename']),'fax':_['isNil'](_0x2023e3[_0xfa80('0x58')])?undefined:_0x2023e3[_0xfa80('0x58')],'AttachmentId':_0x2023e3['AttachmentId']},client9002);})[_0xfa80('0x1f')](respondWithResult(_0x3605f7,0xc9))['catch'](handleError(_0x3605f7,null));};exports['download']=function(_0x5ad7db,_0x7356f6){var _0x1e09b6=path[_0xfa80('0x85')](config['root'],'server','files',_0xfa80('0x86'));return db[_0xfa80('0x3b')][_0xfa80('0x54')]({'where':{'id':_0x5ad7db[_0xfa80('0x53')]['id']},'include':[{'model':db[_0xfa80('0x83')],'as':_0xfa80('0x83')}]})[_0xfa80('0x1f')](handleEntityNotFound(_0x7356f6,null))[_0xfa80('0x1f')](function(_0x168272){if(_0x168272){return _0x7356f6[_0xfa80('0x87')](path[_0xfa80('0x85')](_0x1e09b6,_0x168272[_0xfa80('0x83')][_0xfa80('0x88')]));}})[_0xfa80('0x2a')](handleError(_0x7356f6,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 257dae8..a441a4f 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 _0x1fcc=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x703bf5,_0x2b49af){var _0x237f9f=function(_0x2370f3){while(--_0x2370f3){_0x703bf5['push'](_0x703bf5['shift']());}};_0x237f9f(++_0x2b49af);}(_0x1fcc,0x125));var _0xc1fc=function(_0x3f00ee,_0x1d1673){_0x3f00ee=_0x3f00ee-0x0;var _0x18a07e=_0x1fcc[_0x3f00ee];return _0x18a07e;};'use strict';var EventEmitter=require(_0xc1fc('0x0'));var FaxMessage=require(_0xc1fc('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc1fc('0x2')](0x0);var events={'afterCreate':_0xc1fc('0x3'),'afterUpdate':_0xc1fc('0x4'),'afterDestroy':_0xc1fc('0x5')};function emitEvent(_0x30234a){return function(_0x2e6a9b,_0xf9bb59,_0x51605f){FaxMessageEvents[_0xc1fc('0x6')](_0x30234a+':'+_0x2e6a9b['id'],_0x2e6a9b);FaxMessageEvents[_0xc1fc('0x6')](_0x30234a,_0x2e6a9b);_0x51605f(null);};}for(var e in events){if(events[_0xc1fc('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xc1fc('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xacf4=['update','remove','emit','hasOwnProperty','hook','exports','FaxMessage','setMaxListeners','save'];(function(_0x2b3f17,_0x57fda3){var _0x3959d7=function(_0x5ea40e){while(--_0x5ea40e){_0x2b3f17['push'](_0x2b3f17['shift']());}};_0x3959d7(++_0x57fda3);}(_0xacf4,0xe7));var _0x4acf=function(_0x10bc9b,_0x435a4c){_0x10bc9b=_0x10bc9b-0x0;var _0x242240=_0xacf4[_0x10bc9b];return _0x242240;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x4acf('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4acf('0x1')](0x0);var events={'afterCreate':_0x4acf('0x2'),'afterUpdate':_0x4acf('0x3'),'afterDestroy':_0x4acf('0x4')};function emitEvent(_0x4138f0){return function(_0x145264,_0x5cf22d,_0x380435){FaxMessageEvents[_0x4acf('0x5')](_0x4138f0+':'+_0x145264['id'],_0x145264);FaxMessageEvents['emit'](_0x4138f0,_0x145264);_0x380435(null);};}for(var e in events){if(events[_0x4acf('0x6')](e)){var event=events[e];FaxMessage[_0x4acf('0x7')](e,emitEvent(event));}}module[_0x4acf('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 121099c..5b8f8b4 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 _0x0864=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','FULLTEXT','models','get','toLowerCase','secret','isNil','UserId','findOne','then','update','createdAt','error','utf8mb4_unicode_ci'];(function(_0xe341ac,_0x248fb4){var _0x2b1442=function(_0x17b4b8){while(--_0x17b4b8){_0xe341ac['push'](_0xe341ac['shift']());}};_0x2b1442(++_0x248fb4);}(_0x0864,0x82));var _0x4086=function(_0x444dda,_0x2243b8){_0x444dda=_0x444dda-0x0;var _0x2f42c3=_0x0864[_0x444dda];return _0x2f42c3;};'use strict';var _=require(_0x4086('0x0'));var util=require('util');var logger=require(_0x4086('0x1'))(_0x4086('0x2'));var moment=require(_0x4086('0x3'));var BPromise=require(_0x4086('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4086('0x5'));var rimraf=require(_0x4086('0x6'));var config=require(_0x4086('0x7'));var attributes=require(_0x4086('0x8'));module[_0x4086('0x9')]=function(_0x44cc9f,_0x3f6195){return _0x44cc9f[_0x4086('0xa')]('FaxMessage',attributes,{'tableName':_0x4086('0xb'),'paranoid':![],'indexes':[{'name':_0x4086('0xc'),'fields':['body'],'type':_0x4086('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c6399,_0x5d0028,_0x16e4d9){var _0x253457=_0x44cc9f[_0x4086('0xe')];var _0x33cadf=_0x2c6399[_0x4086('0xf')]({'plain':!![]});if(_0x33cadf['direction']['toLowerCase']()==='in'||_0x33cadf['direction'][_0x4086('0x10')]()==='out'&&!_0x33cadf[_0x4086('0x11')]&&!_[_0x4086('0x12')](_0x33cadf[_0x4086('0x13')])){_0x253457['FaxInteraction'][_0x4086('0x14')]({'where':{'id':_0x33cadf['FaxInteractionId']}})[_0x4086('0x15')](function(_0x2a982b){if(_0x2a982b){_0x2a982b[_0x4086('0x16')]({'lastMsgAt':_0x33cadf[_0x4086('0x17')],'lastMsgDirection':_0x33cadf['direction'][_0x4086('0x10')]()});}})['catch'](function(_0x542f59){console[_0x4086('0x18')](_0x542f59);});}_0x16e4d9();}},'charset':'utf8mb4','collate':_0x4086('0x19')});}; \ No newline at end of file +var _0x96ae=['FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf','./faxMessage.attributes','define','FaxMessage','fax_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId'];(function(_0x4cf6b0,_0x120ce1){var _0x15d06e=function(_0x4366e1){while(--_0x4366e1){_0x4cf6b0['push'](_0x4cf6b0['shift']());}};_0x15d06e(++_0x120ce1);}(_0x96ae,0x19e));var _0xe96a=function(_0x549d57,_0x6b8598){_0x549d57=_0x549d57-0x0;var _0x330291=_0x96ae[_0x549d57];return _0x330291;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe96a('0x0'))(_0xe96a('0x1'));var moment=require(_0xe96a('0x2'));var BPromise=require(_0xe96a('0x3'));var rp=require(_0xe96a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe96a('0x5'));var config=require('../../config/environment');var attributes=require(_0xe96a('0x6'));module['exports']=function(_0x5d1839,_0x15a4d3){return _0x5d1839[_0xe96a('0x7')](_0xe96a('0x8'),attributes,{'tableName':_0xe96a('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0xe96a('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x43a1a9,_0x12f340,_0x383ced){var _0x5e83d6=_0x5d1839[_0xe96a('0xb')];var _0x5b98ba=_0x43a1a9[_0xe96a('0xc')]({'plain':!![]});if(_0x5b98ba[_0xe96a('0xd')]['toLowerCase']()==='in'||_0x5b98ba[_0xe96a('0xd')][_0xe96a('0xe')]()==='out'&&!_0x5b98ba[_0xe96a('0xf')]&&!_[_0xe96a('0x10')](_0x5b98ba[_0xe96a('0x11')])){_0x5e83d6[_0xe96a('0x12')][_0xe96a('0x13')]({'where':{'id':_0x5b98ba[_0xe96a('0x14')]}})[_0xe96a('0x15')](function(_0x3187b0){if(_0x3187b0){_0x3187b0[_0xe96a('0x16')]({'lastMsgAt':_0x5b98ba[_0xe96a('0x17')],'lastMsgDirection':_0x5b98ba[_0xe96a('0xd')]['toLowerCase']()});}})[_0xe96a('0x18')](function(_0x35bc2f){console['error'](_0x35bc2f);});}_0x383ced();}},'charset':_0xe96a('0x19'),'collate':_0xe96a('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 4084225..6b2139b 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 _0xd2ea=['../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','FaxMessage','create','body','options','raw','CreateFaxMessage','stringify','catch','UpdateFaxMessage','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5ac266,_0xc94081){var _0x5bd92b=function(_0x9551b1){while(--_0x9551b1){_0x5ac266['push'](_0x5ac266['shift']());}};_0x5bd92b(++_0xc94081);}(_0xd2ea,0x15f));var _0xad2e=function(_0x2a48a2,_0x585842){_0x2a48a2=_0x2a48a2-0x0;var _0x1a4834=_0xd2ea[_0x2a48a2];return _0x1a4834;};'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});config[_0xad2e('0xc')]=_[_0xad2e('0xd')](config[_0xad2e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xad2e('0xe'))(new Redis(config[_0xad2e('0xc')]));require('./faxMessage.socket')[_0xad2e('0xf')](socket);function respondWithRpcPromise(_0x51f575,_0x430443,_0x415a41){return new BPromise(function(_0x9879f2,_0x24c5da){return client['request'](_0x51f575,_0x415a41)[_0xad2e('0x10')](function(_0x5707a5){logger[_0xad2e('0x11')](_0xad2e('0x12'),_0x430443,_0xad2e('0x13'));logger[_0xad2e('0x14')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x430443,_0xad2e('0x13'),JSON['stringify'](_0x5707a5));if(_0x5707a5[_0xad2e('0x15')]){if(_0x5707a5['error']['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x430443,_0x5707a5[_0xad2e('0x15')][_0xad2e('0x16')]);return _0x24c5da(_0x5707a5[_0xad2e('0x15')][_0xad2e('0x16')]);}logger[_0xad2e('0x15')](_0xad2e('0x12'),_0x430443,_0x5707a5[_0xad2e('0x15')][_0xad2e('0x16')]);return _0x9879f2(_0x5707a5[_0xad2e('0x15')][_0xad2e('0x16')]);}else{logger[_0xad2e('0x11')](_0xad2e('0x12'),_0x430443,_0xad2e('0x13'));_0x9879f2(_0x5707a5[_0xad2e('0x17')][_0xad2e('0x16')]);}})['catch'](function(_0x245617){logger[_0xad2e('0x15')]('FaxMessage,\x20%s,\x20%s',_0x430443,_0x245617);_0x24c5da(_0x245617);});});}exports['CreateFaxMessage']=function(_0x48d8b5){var _0x4a4b2d=this;return new Promise(function(_0x18c38d,_0x293adc){return db[_0xad2e('0x18')][_0xad2e('0x19')](_0x48d8b5[_0xad2e('0x1a')],{'raw':_0x48d8b5[_0xad2e('0x1b')]?_0x48d8b5[_0xad2e('0x1b')][_0xad2e('0x1c')]===undefined?!![]:![]:!![]})[_0xad2e('0x10')](function(_0x154d54){logger[_0xad2e('0x11')](_0xad2e('0x1d'),_0x48d8b5);logger[_0xad2e('0x14')](_0xad2e('0x1d'),_0x48d8b5,JSON[_0xad2e('0x1e')](_0x154d54));_0x18c38d(_0x154d54);})[_0xad2e('0x1f')](function(_0x59630b){logger[_0xad2e('0x15')](_0xad2e('0x1d'),_0x59630b[_0xad2e('0x16')],_0x48d8b5);_0x293adc(_0x4a4b2d[_0xad2e('0x15')](0x1f4,_0x59630b[_0xad2e('0x16')]));});});};exports[_0xad2e('0x20')]=function(_0x1161d5){var _0x175055=this;return new Promise(function(_0xfd90a4,_0x50d446){return db[_0xad2e('0x18')]['update'](_0x1161d5[_0xad2e('0x1a')],{'raw':_0x1161d5[_0xad2e('0x1b')]?_0x1161d5[_0xad2e('0x1b')][_0xad2e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1161d5[_0xad2e('0x1b')]?_0x1161d5[_0xad2e('0x1b')][_0xad2e('0x21')]||null:null,'attributes':_0x1161d5[_0xad2e('0x1b')]?_0x1161d5[_0xad2e('0x1b')][_0xad2e('0x22')]||null:null,'limit':_0x1161d5['options']?_0x1161d5[_0xad2e('0x1b')][_0xad2e('0x23')]||null:null})[_0xad2e('0x10')](function(_0x4379f4){logger[_0xad2e('0x11')](_0xad2e('0x20'),_0x1161d5);logger[_0xad2e('0x14')](_0xad2e('0x20'),_0x1161d5,JSON[_0xad2e('0x1e')](_0x4379f4));_0xfd90a4(_0x4379f4);})[_0xad2e('0x1f')](function(_0xcc4c66){logger['error'](_0xad2e('0x20'),_0xcc4c66['message'],_0x1161d5);_0x50d446(_0x175055[_0xad2e('0x15')](0x1f4,_0xcc4c66[_0xad2e('0x16')]));});});}; \ No newline at end of file +var _0x84ab=['code','message','result','catch','FaxMessage','create','body','raw','CreateFaxMessage','debug','UpdateFaxMessage','update','options','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','./faxMessage.socket','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x23c66b,_0x4677b1){var _0x497414=function(_0x38fe0e){while(--_0x38fe0e){_0x23c66b['push'](_0x23c66b['shift']());}};_0x497414(++_0x4677b1);}(_0x84ab,0x12f));var _0xb84a=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x84ab[_0xabbd2f];return _0x34a040;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xb84a('0xa')](config['redis'],{'host':_0xb84a('0xb'),'port':0x18eb});var socket=require(_0xb84a('0xc'))(new Redis(config['redis']));require(_0xb84a('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e6a71,_0x1886e0,_0x42daf5){return new BPromise(function(_0x5d3b29,_0x5a34f7){return client['request'](_0x2e6a71,_0x42daf5)[_0xb84a('0xe')](function(_0x17379b){logger[_0xb84a('0xf')](_0xb84a('0x10'),_0x1886e0,_0xb84a('0x11'));logger['debug'](_0xb84a('0x12'),_0x1886e0,_0xb84a('0x11'),JSON[_0xb84a('0x13')](_0x17379b));if(_0x17379b[_0xb84a('0x14')]){if(_0x17379b[_0xb84a('0x14')][_0xb84a('0x15')]===0x1f4){logger[_0xb84a('0x14')](_0xb84a('0x10'),_0x1886e0,_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);return _0x5a34f7(_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);}logger['error'](_0xb84a('0x10'),_0x1886e0,_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);return _0x5d3b29(_0x17379b[_0xb84a('0x14')][_0xb84a('0x16')]);}else{logger[_0xb84a('0xf')](_0xb84a('0x10'),_0x1886e0,_0xb84a('0x11'));_0x5d3b29(_0x17379b[_0xb84a('0x17')][_0xb84a('0x16')]);}})[_0xb84a('0x18')](function(_0x2de49c){logger[_0xb84a('0x14')](_0xb84a('0x10'),_0x1886e0,_0x2de49c);_0x5a34f7(_0x2de49c);});});}exports['CreateFaxMessage']=function(_0x1a0056){var _0x319216=this;return new Promise(function(_0x55a633,_0xac76d3){return db[_0xb84a('0x19')][_0xb84a('0x1a')](_0x1a0056[_0xb84a('0x1b')],{'raw':_0x1a0056['options']?_0x1a0056['options'][_0xb84a('0x1c')]===undefined?!![]:![]:!![]})[_0xb84a('0xe')](function(_0x2d70fd){logger[_0xb84a('0xf')](_0xb84a('0x1d'),_0x1a0056);logger[_0xb84a('0x1e')](_0xb84a('0x1d'),_0x1a0056,JSON[_0xb84a('0x13')](_0x2d70fd));_0x55a633(_0x2d70fd);})[_0xb84a('0x18')](function(_0x26fe42){logger[_0xb84a('0x14')](_0xb84a('0x1d'),_0x26fe42[_0xb84a('0x16')],_0x1a0056);_0xac76d3(_0x319216[_0xb84a('0x14')](0x1f4,_0x26fe42[_0xb84a('0x16')]));});});};exports[_0xb84a('0x1f')]=function(_0x378ce1){var _0x3ff0bc=this;return new Promise(function(_0x3b6805,_0xd468c3){return db[_0xb84a('0x19')][_0xb84a('0x20')](_0x378ce1[_0xb84a('0x1b')],{'raw':_0x378ce1[_0xb84a('0x21')]?_0x378ce1[_0xb84a('0x21')][_0xb84a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378ce1['options']?_0x378ce1['options'][_0xb84a('0x22')]||null:null,'attributes':_0x378ce1[_0xb84a('0x21')]?_0x378ce1['options'][_0xb84a('0x23')]||null:null,'limit':_0x378ce1[_0xb84a('0x21')]?_0x378ce1['options']['limit']||null:null})[_0xb84a('0xe')](function(_0x8e9319){logger['info'](_0xb84a('0x1f'),_0x378ce1);logger[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x378ce1,JSON[_0xb84a('0x13')](_0x8e9319));_0x3b6805(_0x8e9319);})[_0xb84a('0x18')](function(_0x144c25){logger[_0xb84a('0x14')](_0xb84a('0x1f'),_0x144c25['message'],_0x378ce1);_0xd468c3(_0x3ff0bc[_0xb84a('0x14')](0x1f4,_0x144c25['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 11638b7..82d0b38 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 _0xc565=['update','emit','removeListener','register','length','faxMessage:','./faxMessage.events','save','remove'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc565,0x192));var _0x5c56=function(_0x40fbae,_0x2e72f1){_0x40fbae=_0x40fbae-0x0;var _0x3289f2=_0xc565[_0x40fbae];return _0x3289f2;};'use strict';var FaxMessageEvents=require(_0x5c56('0x0'));var events=[_0x5c56('0x1'),_0x5c56('0x2'),_0x5c56('0x3')];function createListener(_0x38020d,_0x23ad3e){return function(_0x2c063e){_0x23ad3e[_0x5c56('0x4')](_0x38020d,_0x2c063e);};}function removeListener(_0xa8978c,_0x1f206b){return function(){FaxMessageEvents[_0x5c56('0x5')](_0xa8978c,_0x1f206b);};}exports[_0x5c56('0x6')]=function(_0xa404c){for(var _0x2dc118=0x0,_0x4fc597=events[_0x5c56('0x7')];_0x2dc118<_0x4fc597;_0x2dc118++){var _0x506623=events[_0x2dc118];var _0x40bc14=createListener(_0x5c56('0x8')+_0x506623,_0xa404c);FaxMessageEvents['on'](_0x506623,_0x40bc14);}}; \ No newline at end of file +var _0x20bc=['register','length','faxMessage:','save','remove','update','emit'];(function(_0x287cf3,_0x4de069){var _0x586ceb=function(_0xfec31f){while(--_0xfec31f){_0x287cf3['push'](_0x287cf3['shift']());}};_0x586ceb(++_0x4de069);}(_0x20bc,0x1d8));var _0xc20b=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0x20bc[_0x1fc18b];return _0x16a351;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xc20b('0x0'),_0xc20b('0x1'),_0xc20b('0x2')];function createListener(_0xe0e61c,_0x59b77c){return function(_0x38f764){_0x59b77c[_0xc20b('0x3')](_0xe0e61c,_0x38f764);};}function removeListener(_0x2e20c8,_0x27e997){return function(){FaxMessageEvents['removeListener'](_0x2e20c8,_0x27e997);};}exports[_0xc20b('0x4')]=function(_0x1ed958){for(var _0x1ebc4b=0x0,_0x201482=events[_0xc20b('0x5')];_0x1ebc4b<_0x201482;_0x1ebc4b++){var _0x26b30c=events[_0x1ebc4b];var _0x35c120=createListener(_0xc20b('0x6')+_0x26b30c,_0x1ed958);FaxMessageEvents['on'](_0x26b30c,_0x35c120);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index f19a905..c643217 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 _0xcb91=['faxmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','index','isAuthenticated','describe','/:id','/:id/download','download','post','tracked','fax'];(function(_0x14f5f2,_0x2f9249){var _0x409f44=function(_0x513c05){while(--_0x513c05){_0x14f5f2['push'](_0x14f5f2['shift']());}};_0x409f44(++_0x2f9249);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0xcb91[_0x57e00e];return _0x415e60;};'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('0x7')](_0x1cb9('0xc'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')]('/',auth['isAuthenticated'](),interaction[_0x1cb9('0xf')](_0x1cb9('0x10'),_0x1cb9('0x11')),controller[_0x1cb9('0x12')]);router[_0x1cb9('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1cb9('0x13')](_0x1cb9('0x14'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x15')]);router['put'](_0x1cb9('0x16'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x17')]);router[_0x1cb9('0x18')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1cb9('0x19')]=router; \ No newline at end of file +var _0xd404=['/:id','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe'];(function(_0x5b6132,_0x83d338){var _0x5d3b6c=function(_0x4fecf9){while(--_0x4fecf9){_0x5b6132['push'](_0x5b6132['shift']());}};_0x5d3b6c(++_0x83d338);}(_0xd404,0x15b));var _0x4d40=function(_0x42a77f,_0x19335f){_0x42a77f=_0x42a77f-0x0;var _0x1a0785=_0xd404[_0x42a77f];return _0x1a0785;};'use strict';var multer=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var path=require('path');var timeout=require(_0x4d40('0x2'));var express=require(_0x4d40('0x3'));var router=express['Router']();var fs_extra=require(_0x4d40('0x4'));var auth=require(_0x4d40('0x5'));var interaction=require(_0x4d40('0x6'));var config=require(_0x4d40('0x7'));var controller=require(_0x4d40('0x8'));router[_0x4d40('0x9')]('/',auth[_0x4d40('0xa')](),controller[_0x4d40('0xb')]);router[_0x4d40('0x9')]('/describe',auth[_0x4d40('0xa')](),controller[_0x4d40('0xc')]);router['get'](_0x4d40('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4d40('0x9')](_0x4d40('0xe'),auth[_0x4d40('0xa')](),controller[_0x4d40('0xf')]);router[_0x4d40('0x10')]('/',auth[_0x4d40('0xa')](),interaction[_0x4d40('0x11')](_0x4d40('0x12'),_0x4d40('0x13')),controller[_0x4d40('0x14')]);router[_0x4d40('0x15')](_0x4d40('0xd'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x16')]);router['put'](_0x4d40('0x17'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x18')]);router[_0x4d40('0x15')](_0x4d40('0x19'),auth['isAuthenticated'](),controller[_0x4d40('0x1a')]);router[_0x4d40('0x1b')](_0x4d40('0xd'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x1c')]);module[_0x4d40('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 17a4918..015e7cf 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 _0x0d68=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x2198e,_0x3887b7){var _0x16bd75=function(_0x34826b){while(--_0x34826b){_0x2198e['push'](_0x2198e['shift']());}};_0x16bd75(++_0x3887b7);}(_0x0d68,0x144));var _0x80d6=function(_0x43ae87,_0x3d9734){_0x43ae87=_0x43ae87-0x0;var _0x4291ed=_0x0d68[_0x43ae87];return _0x4291ed;};'use strict';var Sequelize=require(_0x80d6('0x0'));module[_0x80d6('0x1')]={'name':{'type':Sequelize[_0x80d6('0x2')],'unique':_0x80d6('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x80d6('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x80d6('0x5'),_0x80d6('0x6'),_0x80d6('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x80d6('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1c77=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','exports'];(function(_0x205372,_0x16b312){var _0x580941=function(_0x23ae05){while(--_0x23ae05){_0x205372['push'](_0x205372['shift']());}};_0x580941(++_0x16b312);}(_0x1c77,0xed));var _0x71c7=function(_0x462fe4,_0x394d3e){_0x462fe4=_0x462fe4-0x0;var _0x82b23a=_0x1c77[_0x462fe4];return _0x82b23a;};'use strict';var Sequelize=require('sequelize');module[_0x71c7('0x0')]={'name':{'type':Sequelize[_0x71c7('0x1')],'unique':_0x71c7('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x71c7('0x1')]},'timeout':{'type':Sequelize[_0x71c7('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x71c7('0x4'),_0x71c7('0x5'),_0x71c7('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x71c7('0x3')],'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 c1bbeb7..c45581d 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 _0x0a84=['VIRTUAL','merge','FaxQueue','includeAll','rows','catch','show','params','length','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','UserId','agent','updatedAt','faxPause','createdAt','Team','getTeams','addTeams','ids','findAll','Agents','online','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','tq.TeamId','from','team_has_fax_queues','join','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','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','register','sendStatus','end','status','json','undefined','count','offset','Content-Range','apply','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter'];(function(_0x459008,_0x2ceac8){var _0x2510ca=function(_0xdbc226){while(--_0xdbc226){_0x459008['push'](_0x459008['shift']());}};_0x2510ca(++_0x2ceac8);}(_0x0a84,0x14f));var _0x40a8=function(_0x52b360,_0x2ba738){_0x52b360=_0x52b360-0x0;var _0x2ec232=_0x0a84[_0x52b360];return _0x2ec232;};'use strict';var emlformat=require(_0x40a8('0x0'));var rimraf=require(_0x40a8('0x1'));var zipdir=require(_0x40a8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x40a8('0x3'));var moment=require(_0x40a8('0x4'));var BPromise=require(_0x40a8('0x5'));var Mustache=require(_0x40a8('0x6'));var util=require(_0x40a8('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x40a8('0x8'));var ejs=require(_0x40a8('0x9'));var fs=require('fs');var fs_extra=require(_0x40a8('0xa'));var _=require(_0x40a8('0xb'));var squel=require(_0x40a8('0xc'));var crypto=require('crypto');var jsforce=require(_0x40a8('0xd'));var deskjs=require(_0x40a8('0xe'));var toCsv=require(_0x40a8('0x8'));var querystring=require(_0x40a8('0xf'));var Papa=require('papaparse');var Redis=require(_0x40a8('0x10'));var authService=require(_0x40a8('0x11'));var qs=require(_0x40a8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x40a8('0x13'));var logger=require(_0x40a8('0x14'))('api');var utils=require(_0x40a8('0x15'));var config=require(_0x40a8('0x16'));var licenseUtil=require(_0x40a8('0x17'));var db=require(_0x40a8('0x18'))['db'];config[_0x40a8('0x19')]=_[_0x40a8('0x1a')](config[_0x40a8('0x19')],{'host':_0x40a8('0x1b'),'port':0x18eb});var socket=require(_0x40a8('0x1c'))(new Redis(config[_0x40a8('0x19')]));require('./faxQueue.socket')[_0x40a8('0x1d')](socket);function respondWithStatusCode(_0x47ef7c,_0x69bd48){_0x69bd48=_0x69bd48||0xcc;return function(_0x137242){if(_0x137242){return _0x47ef7c[_0x40a8('0x1e')](_0x69bd48);}return _0x47ef7c['status'](_0x69bd48)[_0x40a8('0x1f')]();};}function respondWithResult(_0x40dcf2,_0x1a3db2){_0x1a3db2=_0x1a3db2||0xc8;return function(_0x32db66){if(_0x32db66){return _0x40dcf2[_0x40a8('0x20')](_0x1a3db2)[_0x40a8('0x21')](_0x32db66);}};}function respondWithFilteredResult(_0x85015c,_0x59b1f1){return function(_0x3d9678){if(_0x3d9678){var _0x24cb27=typeof _0x59b1f1['offset']==='undefined'&&typeof _0x59b1f1['limit']===_0x40a8('0x22');var _0xae0d9b=_0x3d9678[_0x40a8('0x23')];var _0x2e0f69=_0x24cb27?0x0:_0x59b1f1[_0x40a8('0x24')];var _0x376a81=_0x24cb27?_0x3d9678[_0x40a8('0x23')]:_0x59b1f1[_0x40a8('0x24')]+_0x59b1f1['limit'];var _0x567915;if(_0x376a81>=_0xae0d9b){_0x376a81=_0xae0d9b;_0x567915=0xc8;}else{_0x567915=0xce;}_0x85015c['status'](_0x567915);return _0x85015c['set'](_0x40a8('0x25'),_0x2e0f69+'-'+_0x376a81+'/'+_0xae0d9b)[_0x40a8('0x21')](_0x3d9678);}return null;};}function patchUpdates(_0x3f2cf9){return function(_0x4e29b2){try{jsonpatch[_0x40a8('0x26')](_0x4e29b2,_0x3f2cf9,!![]);}catch(_0x12c3f2){return BPromise['reject'](_0x12c3f2);}return _0x4e29b2[_0x40a8('0x27')]();};}function saveUpdates(_0x46b8c6,_0x4c72a6){return function(_0x1265a0){if(_0x1265a0){return _0x1265a0[_0x40a8('0x28')](_0x46b8c6)[_0x40a8('0x29')](function(_0x545a57){return _0x545a57;});}return null;};}function removeEntity(_0x4369b8,_0x582081){return function(_0x48f269){if(_0x48f269){return _0x48f269[_0x40a8('0x2a')]()[_0x40a8('0x29')](function(){var _0x50f594=_0x48f269[_0x40a8('0x2b')]({'plain':!![]});var _0x3985aa=_0x40a8('0x2c');return db[_0x40a8('0x2d')]['destroy']({'where':{'type':_0x3985aa,'resourceId':_0x50f594['id']}})['then'](function(){return _0x48f269;});})['then'](function(){_0x4369b8['status'](0xcc)[_0x40a8('0x1f')]();});}};}function handleEntityNotFound(_0x2e4ca4,_0x19194a){return function(_0xa25f2e){if(!_0xa25f2e){_0x2e4ca4['sendStatus'](0x194);}return _0xa25f2e;};}function handleError(_0x47deaf,_0x1a5541){_0x1a5541=_0x1a5541||0x1f4;return function(_0x41df9c){logger[_0x40a8('0x2e')](_0x41df9c[_0x40a8('0x2f')]);if(_0x41df9c[_0x40a8('0x30')]){delete _0x41df9c[_0x40a8('0x30')];}_0x47deaf[_0x40a8('0x20')](_0x1a5541)['send'](_0x41df9c);};}exports[_0x40a8('0x31')]=function(_0x27406e,_0x1bcf84){var _0x3138e1={},_0x4dc942={},_0x23ad22={'count':0x0,'rows':[]};var _0x24770d=_[_0x40a8('0x32')](db['FaxQueue'][_0x40a8('0x33')],function(_0x19e360){return{'name':_0x19e360[_0x40a8('0x34')],'type':_0x19e360[_0x40a8('0x35')][_0x40a8('0x36')]};});_0x4dc942[_0x40a8('0x37')]=_[_0x40a8('0x32')](_0x24770d,_0x40a8('0x30'));_0x4dc942[_0x40a8('0x38')]=_[_0x40a8('0x39')](_0x27406e[_0x40a8('0x38')]);_0x4dc942[_0x40a8('0x3a')]=_[_0x40a8('0x3b')](_0x4dc942[_0x40a8('0x37')],_0x4dc942[_0x40a8('0x38')]);_0x3138e1[_0x40a8('0x3c')]=_['intersection'](_0x4dc942[_0x40a8('0x37')],qs[_0x40a8('0x3d')](_0x27406e[_0x40a8('0x38')][_0x40a8('0x3d')]));_0x3138e1['attributes']=_0x3138e1[_0x40a8('0x3c')]['length']?_0x3138e1['attributes']:_0x4dc942[_0x40a8('0x37')];if(!_0x27406e['query'][_0x40a8('0x3e')](_0x40a8('0x3f'))){_0x3138e1[_0x40a8('0x40')]=qs[_0x40a8('0x40')](_0x27406e[_0x40a8('0x38')][_0x40a8('0x40')]);_0x3138e1[_0x40a8('0x24')]=qs['offset'](_0x27406e[_0x40a8('0x38')][_0x40a8('0x24')]);}_0x3138e1[_0x40a8('0x41')]=qs[_0x40a8('0x42')](_0x27406e['query'][_0x40a8('0x42')]);_0x3138e1[_0x40a8('0x43')]=qs[_0x40a8('0x3a')](_[_0x40a8('0x44')](_0x27406e[_0x40a8('0x38')],_0x4dc942[_0x40a8('0x3a')]),_0x24770d);if(_0x27406e['query'][_0x40a8('0x45')]){_0x3138e1[_0x40a8('0x43')]=_['merge'](_0x3138e1[_0x40a8('0x43')],{'$or':_[_0x40a8('0x32')](_0x24770d,function(_0x55c020){if(_0x55c020[_0x40a8('0x35')]!==_0x40a8('0x46')){var _0x4c2f5c={};_0x4c2f5c[_0x55c020[_0x40a8('0x30')]]={'$like':'%'+_0x27406e['query'][_0x40a8('0x45')]+'%'};return _0x4c2f5c;}})});}_0x3138e1=_[_0x40a8('0x47')]({},_0x3138e1,_0x27406e['options']);var _0x167cfe={'where':_0x3138e1[_0x40a8('0x43')]};return db[_0x40a8('0x48')][_0x40a8('0x23')](_0x167cfe)[_0x40a8('0x29')](function(_0x29fc90){_0x23ad22['count']=_0x29fc90;if(_0x27406e[_0x40a8('0x38')][_0x40a8('0x49')]){_0x3138e1['include']=[{'all':!![]}];}return db[_0x40a8('0x48')]['findAll'](_0x3138e1);})[_0x40a8('0x29')](function(_0x40c3b9){_0x23ad22[_0x40a8('0x4a')]=_0x40c3b9;return _0x23ad22;})[_0x40a8('0x29')](respondWithFilteredResult(_0x1bcf84,_0x3138e1))[_0x40a8('0x4b')](handleError(_0x1bcf84,null));};exports[_0x40a8('0x4c')]=function(_0x40aef4,_0x487f3f){var _0x3b2205={'raw':!![],'where':{'id':_0x40aef4[_0x40a8('0x4d')]['id']}},_0x3ade99={};_0x3ade99[_0x40a8('0x37')]=_['keys'](db[_0x40a8('0x48')]['rawAttributes']);_0x3ade99['query']=_['keys'](_0x40aef4[_0x40a8('0x38')]);_0x3ade99['filters']=_[_0x40a8('0x3b')](_0x3ade99[_0x40a8('0x37')],_0x3ade99[_0x40a8('0x38')]);_0x3b2205[_0x40a8('0x3c')]=_['intersection'](_0x3ade99[_0x40a8('0x37')],qs[_0x40a8('0x3d')](_0x40aef4['query'][_0x40a8('0x3d')]));_0x3b2205['attributes']=_0x3b2205[_0x40a8('0x3c')][_0x40a8('0x4e')]?_0x3b2205[_0x40a8('0x3c')]:_0x3ade99[_0x40a8('0x37')];if(_0x40aef4[_0x40a8('0x38')][_0x40a8('0x49')]){_0x3b2205[_0x40a8('0x4f')]=[{'all':!![]}];}_0x3b2205=_['merge']({},_0x3b2205,_0x40aef4[_0x40a8('0x50')]);return db[_0x40a8('0x48')]['find'](_0x3b2205)[_0x40a8('0x29')](handleEntityNotFound(_0x487f3f,null))[_0x40a8('0x29')](respondWithResult(_0x487f3f,null))[_0x40a8('0x4b')](handleError(_0x487f3f,null));};exports[_0x40a8('0x51')]=function(_0x4ffbed,_0x5808a9){return db[_0x40a8('0x48')][_0x40a8('0x51')](_0x4ffbed[_0x40a8('0x52')],{})[_0x40a8('0x29')](function(_0x168c62){var _0x577d6d=_0x4ffbed[_0x40a8('0x53')][_0x40a8('0x2b')]({'plain':!![]});if(!_0x577d6d)throw new Error(_0x40a8('0x54'));if(_0x577d6d[_0x40a8('0x55')]===_0x40a8('0x53')){var _0xf8764e=_0x168c62[_0x40a8('0x2b')]({'plain':!![]});var _0x4b5887='FaxQueues';return db[_0x40a8('0x56')][_0x40a8('0x57')]({'where':{'name':_0x4b5887,'userProfileId':_0x577d6d['userProfileId']},'raw':!![]})['then'](function(_0x2dc91b){if(_0x2dc91b&&_0x2dc91b['autoAssociation']===0x0){return db[_0x40a8('0x2d')][_0x40a8('0x51')]({'name':_0xf8764e['name'],'resourceId':_0xf8764e['id'],'type':_0x2dc91b[_0x40a8('0x30')],'sectionId':_0x2dc91b['id']},{})[_0x40a8('0x29')](function(){return _0x168c62;});}else{return _0x168c62;}})[_0x40a8('0x4b')](function(_0x4a110f){logger[_0x40a8('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a110f);throw _0x4a110f;});}return _0x168c62;})[_0x40a8('0x29')](respondWithResult(_0x5808a9,0xc9))[_0x40a8('0x4b')](handleError(_0x5808a9,null));};exports[_0x40a8('0x28')]=function(_0x37e885,_0x3ae202){if(_0x37e885[_0x40a8('0x52')]['id']){delete _0x37e885[_0x40a8('0x52')]['id'];}return db['FaxQueue'][_0x40a8('0x57')]({'where':{'id':_0x37e885[_0x40a8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3ae202,null))[_0x40a8('0x29')](saveUpdates(_0x37e885[_0x40a8('0x52')],null))['then'](respondWithResult(_0x3ae202,null))[_0x40a8('0x4b')](handleError(_0x3ae202,null));};exports[_0x40a8('0x2a')]=function(_0x454706,_0x33cbc7){return db['FaxQueue'][_0x40a8('0x57')]({'where':{'id':_0x454706[_0x40a8('0x4d')]['id']}})[_0x40a8('0x29')](handleEntityNotFound(_0x33cbc7,null))[_0x40a8('0x29')](removeEntity(_0x33cbc7,null))['catch'](handleError(_0x33cbc7,null));};exports[_0x40a8('0x58')]=function(_0x2115e7,_0x5e1f8b){return db[_0x40a8('0x48')]['describe']()[_0x40a8('0x29')](respondWithResult(_0x5e1f8b,null))[_0x40a8('0x4b')](handleError(_0x5e1f8b,null));};exports[_0x40a8('0x59')]=function(_0x14a088,_0x57e96f,_0x3ddaf4){var _0x478485={'raw':!![],'where':{}},_0x186b27={},_0x4fd18c;return db['FaxQueue'][_0x40a8('0x5a')]({'where':{'id':_0x14a088[_0x40a8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x57e96f,null))[_0x40a8('0x29')](function(_0x5ce88f){if(_0x5ce88f){_0x4fd18c=_0x5ce88f[_0x40a8('0x2b')]({'plain':!![]});_0x186b27[_0x40a8('0x37')]=_['keys'](db[_0x40a8('0x5b')][_0x40a8('0x33')]);_0x186b27[_0x40a8('0x38')]=_[_0x40a8('0x39')](_0x14a088['query']);_0x186b27[_0x40a8('0x3a')]=_[_0x40a8('0x3b')](_0x186b27['model'],_0x186b27['query']);_0x478485[_0x40a8('0x3c')]=_[_0x40a8('0x3b')](_0x186b27[_0x40a8('0x37')],qs['fields'](_0x14a088[_0x40a8('0x38')][_0x40a8('0x3d')]));_0x478485[_0x40a8('0x3c')]=_0x478485[_0x40a8('0x3c')][_0x40a8('0x4e')]?_0x478485[_0x40a8('0x3c')]:_0x186b27[_0x40a8('0x37')];if(!_0x14a088[_0x40a8('0x38')][_0x40a8('0x3e')](_0x40a8('0x3f'))){_0x478485[_0x40a8('0x40')]=qs[_0x40a8('0x40')](_0x14a088[_0x40a8('0x38')][_0x40a8('0x40')]);_0x478485[_0x40a8('0x24')]=qs['offset'](_0x14a088[_0x40a8('0x38')][_0x40a8('0x24')]);}_0x478485['order']=qs['sort'](_0x14a088[_0x40a8('0x38')][_0x40a8('0x42')]);_0x478485[_0x40a8('0x43')]=qs['filters'](_[_0x40a8('0x44')](_0x14a088[_0x40a8('0x38')],_0x186b27[_0x40a8('0x3a')]));_0x478485[_0x40a8('0x43')][_0x40a8('0x5c')]=_0x5ce88f['id'];if(_0x14a088[_0x40a8('0x38')][_0x40a8('0x45')]){_0x478485['where']=_[_0x40a8('0x47')](_0x478485[_0x40a8('0x43')],{'$or':_['map'](_0x478485[_0x40a8('0x3c')],function(_0x2e5397){var _0x476991={};_0x476991[_0x2e5397]={'$like':'%'+_0x14a088[_0x40a8('0x38')][_0x40a8('0x45')]+'%'};return _0x476991;})});}_0x478485=_[_0x40a8('0x47')]({},_0x478485,_0x14a088[_0x40a8('0x50')]);return db[_0x40a8('0x5b')]['findAll'](_0x478485);}})['then'](function(_0x16c6d8){if(_0x16c6d8){return db[_0x40a8('0x5d')][_0x40a8('0x5e')]({'where':{'id':_['map'](_0x16c6d8,_0x40a8('0x5f')),'role':_0x40a8('0x60')},'attributes':['id','name','faxPause',_0x40a8('0x61'),'createdAt']});}})[_0x40a8('0x29')](function(_0x32f542){if(_0x32f542){return{'count':_0x32f542[_0x40a8('0x23')],'rows':_[_0x40a8('0x32')](_0x32f542[_0x40a8('0x4a')],function(_0x24acf2){return{'membername':_0x24acf2[_0x40a8('0x30')],'UserId':_0x24acf2['id'],'queue_name':_0x4fd18c[_0x40a8('0x30')],'FaxQueueId':_0x4fd18c['id'],'interface':util['format']('%s/%s','SIP',_0x24acf2['name']),'penalty':0x0,'paused':_0x24acf2[_0x40a8('0x62')],'createdAt':_0x24acf2[_0x40a8('0x63')],'updatedAt':_0x24acf2[_0x40a8('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x40a8('0x29')](respondWithFilteredResult(_0x57e96f,_0x478485))[_0x40a8('0x4b')](handleError(_0x57e96f,null));};exports['getTeams']=function(_0x2edad5,_0x2b699b,_0x398ebd){var _0x2ec613={};var _0x45b37f={};var _0x52b1f6;var _0x3120a4;return db[_0x40a8('0x48')][_0x40a8('0x5a')]({'where':{'id':_0x2edad5[_0x40a8('0x4d')]['id']}})[_0x40a8('0x29')](handleEntityNotFound(_0x2b699b,null))['then'](function(_0x2941f7){if(_0x2941f7){_0x52b1f6=_0x2941f7;_0x45b37f['model']=_[_0x40a8('0x39')](db[_0x40a8('0x64')][_0x40a8('0x33')]);_0x45b37f[_0x40a8('0x38')]=_[_0x40a8('0x39')](_0x2edad5[_0x40a8('0x38')]);_0x45b37f['filters']=_['intersection'](_0x45b37f[_0x40a8('0x37')],_0x45b37f[_0x40a8('0x38')]);_0x2ec613['attributes']=_[_0x40a8('0x3b')](_0x45b37f[_0x40a8('0x37')],qs[_0x40a8('0x3d')](_0x2edad5['query']['fields']));_0x2ec613['attributes']=_0x2ec613[_0x40a8('0x3c')][_0x40a8('0x4e')]?_0x2ec613['attributes']:_0x45b37f[_0x40a8('0x37')];_0x2ec613[_0x40a8('0x41')]=qs[_0x40a8('0x42')](_0x2edad5[_0x40a8('0x38')][_0x40a8('0x42')]);_0x2ec613[_0x40a8('0x43')]=qs[_0x40a8('0x3a')](_[_0x40a8('0x44')](_0x2edad5[_0x40a8('0x38')],_0x45b37f[_0x40a8('0x3a')]));if(_0x2edad5[_0x40a8('0x38')]['filter']){_0x2ec613['where']=_[_0x40a8('0x47')](_0x2ec613[_0x40a8('0x43')],{'$or':_[_0x40a8('0x32')](_0x2ec613[_0x40a8('0x3c')],function(_0x19fa13){var _0x1e795d={};_0x1e795d[_0x19fa13]={'$like':'%'+_0x2edad5[_0x40a8('0x38')][_0x40a8('0x45')]+'%'};return _0x1e795d;})});}_0x2ec613=_[_0x40a8('0x47')]({},_0x2ec613,_0x2edad5['options']);return _0x52b1f6[_0x40a8('0x65')](_0x2ec613);}})['then'](function(_0xf6a8ac){if(_0xf6a8ac){_0x3120a4=_0xf6a8ac[_0x40a8('0x4e')];if(!_0x2edad5[_0x40a8('0x38')][_0x40a8('0x3e')](_0x40a8('0x3f'))){_0x2ec613['limit']=qs['limit'](_0x2edad5[_0x40a8('0x38')][_0x40a8('0x40')]);_0x2ec613['offset']=qs[_0x40a8('0x24')](_0x2edad5[_0x40a8('0x38')]['offset']);}return _0x52b1f6[_0x40a8('0x65')](_0x2ec613);}})['then'](function(_0x465431){if(_0x465431){return _0x465431?{'count':_0x3120a4,'rows':_0x465431}:null;}})[_0x40a8('0x29')](respondWithResult(_0x2b699b,null))['catch'](handleError(_0x2b699b,null));};exports[_0x40a8('0x66')]=function(_0x54aba5,_0x94d940,_0x4858a4){var _0x1669d3=_0x54aba5[_0x40a8('0x52')][_0x40a8('0x67')];return db[_0x40a8('0x64')][_0x40a8('0x68')]({'where':{'id':_0x1669d3},'attributes':['id'],'include':[{'model':db[_0x40a8('0x5d')],'as':_0x40a8('0x69'),'attributes':['id','name',_0x40a8('0x6a'),'voicePause','interface'],'raw':!![]}]})[_0x40a8('0x29')](function(_0x495aca){if(_0x495aca){var _0x1eb2a3=_['flatMap'](_0x495aca,function(_0x562d5b){var _0x558012=_0x562d5b[_0x40a8('0x2b')]({'plain':!![]});return _0x558012[_0x40a8('0x69')];});return db[_0x40a8('0x48')][_0x40a8('0x57')]({'where':{'id':_0x54aba5[_0x40a8('0x4d')]['id']}})[_0x40a8('0x29')](function(_0x178fd8){return db[_0x40a8('0x6b')][_0x40a8('0x6c')](function(_0x3f154e){return _0x178fd8[_0x40a8('0x66')](_0x1669d3,{'transaction':_0x3f154e})['then'](function(){return BPromise[_0x40a8('0x6d')](_0x1eb2a3,function(_0x5e275b){return db[_0x40a8('0x5b')][_0x40a8('0x6e')]({'where':{'UserId':_0x5e275b['id'],'FaxQueueId':_0x54aba5[_0x40a8('0x4d')]['id']},'transaction':_0x3f154e});});})[_0x40a8('0x29')](function(){_0x1eb2a3[_0x40a8('0x6f')](function(_0x1b68c6){socket[_0x40a8('0x70')](_0x40a8('0x71'),{'UserId':_0x1b68c6['id'],'FaxQueueId':_0x178fd8['id']});});});});});}})[_0x40a8('0x29')](respondWithStatusCode(_0x94d940,null))[_0x40a8('0x4b')](handleError(_0x94d940,null));};exports[_0x40a8('0x72')]=function(_0x58c9d5,_0xcdfa91,_0x3e0a35){return db['Team'][_0x40a8('0x68')]({'where':{'id':_0x58c9d5[_0x40a8('0x38')][_0x40a8('0x67')]},'attributes':['id'],'include':[{'model':db[_0x40a8('0x5d')],'as':_0x40a8('0x69'),'attributes':['id'],'raw':!![]}]})[_0x40a8('0x29')](handleEntityNotFound(_0xcdfa91,null))['then'](function(_0x4634b9){var _0x268e2b=_['map'](_0x4634b9,'id');var _0x29d3c3=[];var _0x205c66=[];var _0x11427e=squel['select']();_0x11427e['field'](_0x40a8('0x73'))[_0x40a8('0x74')](_0x40a8('0x75'),'tq')[_0x40a8('0x76')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x40a8('0x43')]('FaxQueueId\x20=\x20?',_0x58c9d5[_0x40a8('0x4d')]['id']);for(var _0x2d50ad=0x0;_0x2d50ad<_0x4634b9[_0x40a8('0x4e')];_0x2d50ad+=0x1){let _0x310451=_0x4634b9[_0x2d50ad];for(var _0x43783c=0x0;_0x43783c<_0x310451['Agents'][_0x40a8('0x4e')];_0x43783c+=0x1){let _0x2ec6c5=_0x310451[_0x40a8('0x69')][_0x43783c];var _0x52777a=_0x11427e[_0x40a8('0x77')]();_0x52777a[_0x40a8('0x43')](_0x40a8('0x78'),_0x2ec6c5['id']);_0x205c66['push'](db[_0x40a8('0x6b')][_0x40a8('0x38')](_0x52777a[_0x40a8('0x79')](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x40a8('0x29')](function(_0xeba225){if(_0xeba225[_0x40a8('0x4e')]===0x1){return _0x2ec6c5['id'];}else{var _0x4d488a=_[_0x40a8('0x7a')](_[_0x40a8('0x32')](_0xeba225,_0x40a8('0x7b')),function(_0x283dce){return _[_0x40a8('0x7c')](_0x268e2b,_0x283dce);});if(_0x4d488a){return _0x2ec6c5['id'];}}}));}}return BPromise['all'](_0x205c66)['then'](function(_0x4a6140){_0x29d3c3=_(_0x29d3c3)[_0x40a8('0x7d')](_0x4a6140)[_0x40a8('0x7e')]()[_0x40a8('0x7f')]();return db[_0x40a8('0x48')]['find']({'where':{'id':_0x58c9d5[_0x40a8('0x4d')]['id']}})['then'](function(_0x3ddf4a){return db[_0x40a8('0x6b')][_0x40a8('0x6c')](function(_0xfeb960){return _0x3ddf4a['removeTeams'](_0x58c9d5[_0x40a8('0x38')][_0x40a8('0x67')],{'transaction':_0xfeb960})['then'](function(){if(!_[_0x40a8('0x80')](_0x29d3c3)){return _0x3ddf4a[_0x40a8('0x81')](_0x29d3c3,{'transaction':_0xfeb960});}})[_0x40a8('0x29')](function(){_0x29d3c3[_0x40a8('0x6f')](function(_0x72fba5){socket[_0x40a8('0x70')](_0x40a8('0x82'),{'UserId':_0x72fba5,'FaxQueueId':_0x3ddf4a['id']});});});});});});})[_0x40a8('0x29')](respondWithStatusCode(_0xcdfa91,null))['catch'](handleError(_0xcdfa91,null));};exports[_0x40a8('0x83')]=function(_0x5d8ce1,_0x2c83cd,_0x51a1d8){return db[_0x40a8('0x48')][_0x40a8('0x57')]({'where':{'id':_0x5d8ce1[_0x40a8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2c83cd,null))[_0x40a8('0x29')](function(_0x13a2ef){if(_0x13a2ef){return _0x13a2ef[_0x40a8('0x83')](_0x5d8ce1[_0x40a8('0x52')][_0x40a8('0x67')],_[_0x40a8('0x84')](_0x5d8ce1['body'],[_0x40a8('0x67'),'id'])||{})['spread'](function(_0x240766){for(var _0x2ab201=0x0;_0x2ab201<_0x5d8ce1[_0x40a8('0x52')]['ids'][_0x40a8('0x4e')];_0x2ab201+=0x1){socket[_0x40a8('0x70')](_0x40a8('0x71'),{'UserId':Number(_0x5d8ce1[_0x40a8('0x52')][_0x40a8('0x67')][_0x2ab201]),'FaxQueueId':Number(_0x5d8ce1['params']['id'])});}return _0x240766;});}})['then'](respondWithResult(_0x2c83cd,null))['catch'](handleError(_0x2c83cd,null));};exports[_0x40a8('0x81')]=function(_0x473dd8,_0x3a366a,_0x49daf0){return db[_0x40a8('0x48')]['find']({'where':{'id':_0x473dd8[_0x40a8('0x4d')]['id']}})[_0x40a8('0x29')](handleEntityNotFound(_0x3a366a,null))[_0x40a8('0x29')](function(_0x437e88){if(_0x437e88){return _0x437e88['removeAgents'](_0x473dd8[_0x40a8('0x38')][_0x40a8('0x67')])[_0x40a8('0x29')](function(){if(_[_0x40a8('0x85')](_0x473dd8[_0x40a8('0x38')][_0x40a8('0x67')])){for(var _0x12deab=0x0;_0x12deab<_0x473dd8[_0x40a8('0x38')][_0x40a8('0x67')][_0x40a8('0x4e')];_0x12deab+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x473dd8['query']['ids'][_0x12deab]),'FaxQueueId':Number(_0x473dd8['params']['id'])});}}else{socket[_0x40a8('0x70')]('userFaxQueue:remove',{'UserId':Number(_0x473dd8[_0x40a8('0x38')][_0x40a8('0x67')]),'FaxQueueId':Number(_0x473dd8[_0x40a8('0x4d')]['id'])});}});}})[_0x40a8('0x29')](respondWithStatusCode(_0x3a366a,null))['catch'](handleError(_0x3a366a,null));};exports[_0x40a8('0x86')]=function(_0xb92c6,_0x424157,_0x46752b){var _0x38cb61={};var _0x7928ac={};var _0xe45a8;var _0x317d87;return db[_0x40a8('0x48')][_0x40a8('0x5a')]({'where':{'id':_0xb92c6[_0x40a8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x424157,null))[_0x40a8('0x29')](function(_0x40b164){if(_0x40b164){_0xe45a8=_0x40b164;_0x7928ac[_0x40a8('0x37')]=_[_0x40a8('0x39')](db[_0x40a8('0x5d')]['rawAttributes']);_0x7928ac['query']=_[_0x40a8('0x39')](_0xb92c6['query']);_0x7928ac['filters']=_[_0x40a8('0x3b')](_0x7928ac['model'],_0x7928ac['query']);_0x38cb61['attributes']=_['intersection'](_0x7928ac[_0x40a8('0x37')],qs[_0x40a8('0x3d')](_0xb92c6[_0x40a8('0x38')][_0x40a8('0x3d')]));_0x38cb61[_0x40a8('0x3c')]=_0x38cb61[_0x40a8('0x3c')][_0x40a8('0x4e')]?_0x38cb61[_0x40a8('0x3c')]:_0x7928ac[_0x40a8('0x37')];_0x38cb61[_0x40a8('0x41')]=qs[_0x40a8('0x42')](_0xb92c6['query']['sort']);_0x38cb61['where']=qs['filters'](_[_0x40a8('0x44')](_0xb92c6[_0x40a8('0x38')],_0x7928ac[_0x40a8('0x3a')]));if(_0xb92c6[_0x40a8('0x38')][_0x40a8('0x45')]){_0x38cb61[_0x40a8('0x43')]=_['merge'](_0x38cb61[_0x40a8('0x43')],{'$or':_[_0x40a8('0x32')](_0x38cb61['attributes'],function(_0x1fc1bf){var _0x119e19={};_0x119e19[_0x1fc1bf]={'$like':'%'+_0xb92c6[_0x40a8('0x38')][_0x40a8('0x45')]+'%'};return _0x119e19;})});}_0x38cb61=_['merge']({},_0x38cb61,_0xb92c6[_0x40a8('0x50')]);return _0xe45a8[_0x40a8('0x86')](_0x38cb61);}})['then'](function(_0x4cbef0){if(_0x4cbef0){_0x317d87=_0x4cbef0['length'];if(!_0xb92c6[_0x40a8('0x38')]['hasOwnProperty']('nolimit')){_0x38cb61[_0x40a8('0x40')]=qs[_0x40a8('0x40')](_0xb92c6[_0x40a8('0x38')][_0x40a8('0x40')]);_0x38cb61[_0x40a8('0x24')]=qs['offset'](_0xb92c6['query']['offset']);}return _0xe45a8['getAgents'](_0x38cb61);}})[_0x40a8('0x29')](function(_0x7a35c6){if(_0x7a35c6){return _0x7a35c6?{'count':_0x317d87,'rows':_0x7a35c6}:null;}})[_0x40a8('0x29')](respondWithResult(_0x424157,null))[_0x40a8('0x4b')](handleError(_0x424157,null));}; \ No newline at end of file +var _0xd5d6=['nolimit','sort','where','pick','filter','merge','VIRTUAL','options','FaxQueue','includeAll','include','findAll','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','UserFaxQueue','order','FaxQueueId','User','findAndCountAll','faxPause','updatedAt','createdAt','rows','format','SIP','Team','length','getTeams','hasOwnProperty','addTeams','ids','online','voicePause','Agents','sequelize','transaction','each','findOrCreate','emit','removeTeams','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','includes','all','value','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','then','get','FaxQueues','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x149225,_0x5869e2){var _0x21e6ac=function(_0x3bbef8){while(--_0x3bbef8){_0x149225['push'](_0x149225['shift']());}};_0x21e6ac(++_0x5869e2);}(_0xd5d6,0xcb));var _0x6d5d=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xd5d6[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x6d5d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6d5d('0x1'));var jsonpatch=require(_0x6d5d('0x2'));var rp=require(_0x6d5d('0x3'));var moment=require(_0x6d5d('0x4'));var BPromise=require(_0x6d5d('0x5'));var Mustache=require(_0x6d5d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6d5d('0x7'));var csv=require(_0x6d5d('0x8'));var ejs=require(_0x6d5d('0x9'));var fs=require('fs');var fs_extra=require(_0x6d5d('0xa'));var _=require(_0x6d5d('0xb'));var squel=require(_0x6d5d('0xc'));var crypto=require(_0x6d5d('0xd'));var jsforce=require(_0x6d5d('0xe'));var deskjs=require(_0x6d5d('0xf'));var toCsv=require(_0x6d5d('0x8'));var querystring=require(_0x6d5d('0x10'));var Papa=require(_0x6d5d('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6d5d('0x12'));var hardwareService=require(_0x6d5d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6d5d('0x14'));var config=require(_0x6d5d('0x15'));var licenseUtil=require(_0x6d5d('0x16'));var db=require(_0x6d5d('0x17'))['db'];config[_0x6d5d('0x18')]=_[_0x6d5d('0x19')](config['redis'],{'host':_0x6d5d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6d5d('0x18')]));require(_0x6d5d('0x1b'))[_0x6d5d('0x1c')](socket);function respondWithStatusCode(_0x588de6,_0xd48dc1){_0xd48dc1=_0xd48dc1||0xcc;return function(_0x247633){if(_0x247633){return _0x588de6[_0x6d5d('0x1d')](_0xd48dc1);}return _0x588de6[_0x6d5d('0x1e')](_0xd48dc1)['end']();};}function respondWithResult(_0xe5bf94,_0x246341){_0x246341=_0x246341||0xc8;return function(_0x125d29){if(_0x125d29){return _0xe5bf94[_0x6d5d('0x1e')](_0x246341)[_0x6d5d('0x1f')](_0x125d29);}};}function respondWithFilteredResult(_0x217eb3,_0x4ec500){return function(_0x2b98c4){if(_0x2b98c4){var _0x2e5fed=typeof _0x4ec500[_0x6d5d('0x20')]===_0x6d5d('0x21')&&typeof _0x4ec500[_0x6d5d('0x22')]===_0x6d5d('0x21');var _0xd41257=_0x2b98c4[_0x6d5d('0x23')];var _0x16c784=_0x2e5fed?0x0:_0x4ec500[_0x6d5d('0x20')];var _0x1ea929=_0x2e5fed?_0x2b98c4[_0x6d5d('0x23')]:_0x4ec500[_0x6d5d('0x20')]+_0x4ec500['limit'];var _0x4faedb;if(_0x1ea929>=_0xd41257){_0x1ea929=_0xd41257;_0x4faedb=0xc8;}else{_0x4faedb=0xce;}_0x217eb3['status'](_0x4faedb);return _0x217eb3['set']('Content-Range',_0x16c784+'-'+_0x1ea929+'/'+_0xd41257)['json'](_0x2b98c4);}return null;};}function patchUpdates(_0x19f13b){return function(_0x32ce28){try{jsonpatch[_0x6d5d('0x24')](_0x32ce28,_0x19f13b,!![]);}catch(_0x1d421e){return BPromise[_0x6d5d('0x25')](_0x1d421e);}return _0x32ce28[_0x6d5d('0x26')]();};}function saveUpdates(_0x3cf36a,_0x184781){return function(_0x356853){if(_0x356853){return _0x356853[_0x6d5d('0x27')](_0x3cf36a)[_0x6d5d('0x28')](function(_0x472ffa){return _0x472ffa;});}return null;};}function removeEntity(_0x5c366a,_0x5a35bc){return function(_0x486c41){if(_0x486c41){return _0x486c41['destroy']()['then'](function(){var _0x5b39ff=_0x486c41[_0x6d5d('0x29')]({'plain':!![]});var _0x3c1a21=_0x6d5d('0x2a');return db['UserProfileResource'][_0x6d5d('0x2b')]({'where':{'type':_0x3c1a21,'resourceId':_0x5b39ff['id']}})[_0x6d5d('0x28')](function(){return _0x486c41;});})[_0x6d5d('0x28')](function(){_0x5c366a[_0x6d5d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b4cb6,_0x46b0ee){return function(_0x596db2){if(!_0x596db2){_0x2b4cb6[_0x6d5d('0x1d')](0x194);}return _0x596db2;};}function handleError(_0x2334b6,_0xc6301d){_0xc6301d=_0xc6301d||0x1f4;return function(_0x2c3a81){logger['error'](_0x2c3a81[_0x6d5d('0x2c')]);if(_0x2c3a81[_0x6d5d('0x2d')]){delete _0x2c3a81[_0x6d5d('0x2d')];}_0x2334b6[_0x6d5d('0x1e')](_0xc6301d)[_0x6d5d('0x2e')](_0x2c3a81);};}exports[_0x6d5d('0x2f')]=function(_0x172484,_0xd74feb){var _0x54b759={},_0x56b5bb={},_0x3b924d={'count':0x0,'rows':[]};var _0x42fc58=_[_0x6d5d('0x30')](db['FaxQueue'][_0x6d5d('0x31')],function(_0x46fd45){return{'name':_0x46fd45['fieldName'],'type':_0x46fd45[_0x6d5d('0x32')][_0x6d5d('0x33')]};});_0x56b5bb[_0x6d5d('0x34')]=_['map'](_0x42fc58,_0x6d5d('0x2d'));_0x56b5bb[_0x6d5d('0x35')]=_[_0x6d5d('0x36')](_0x172484['query']);_0x56b5bb[_0x6d5d('0x37')]=_[_0x6d5d('0x38')](_0x56b5bb['model'],_0x56b5bb['query']);_0x54b759[_0x6d5d('0x39')]=_[_0x6d5d('0x38')](_0x56b5bb[_0x6d5d('0x34')],qs['fields'](_0x172484['query'][_0x6d5d('0x3a')]));_0x54b759[_0x6d5d('0x39')]=_0x54b759['attributes']['length']?_0x54b759['attributes']:_0x56b5bb[_0x6d5d('0x34')];if(!_0x172484[_0x6d5d('0x35')]['hasOwnProperty'](_0x6d5d('0x3b'))){_0x54b759[_0x6d5d('0x22')]=qs[_0x6d5d('0x22')](_0x172484[_0x6d5d('0x35')][_0x6d5d('0x22')]);_0x54b759['offset']=qs['offset'](_0x172484['query'][_0x6d5d('0x20')]);}_0x54b759['order']=qs[_0x6d5d('0x3c')](_0x172484[_0x6d5d('0x35')][_0x6d5d('0x3c')]);_0x54b759[_0x6d5d('0x3d')]=qs['filters'](_[_0x6d5d('0x3e')](_0x172484[_0x6d5d('0x35')],_0x56b5bb[_0x6d5d('0x37')]),_0x42fc58);if(_0x172484[_0x6d5d('0x35')][_0x6d5d('0x3f')]){_0x54b759['where']=_[_0x6d5d('0x40')](_0x54b759[_0x6d5d('0x3d')],{'$or':_[_0x6d5d('0x30')](_0x42fc58,function(_0x3662fa){if(_0x3662fa['type']!==_0x6d5d('0x41')){var _0x31ea7f={};_0x31ea7f[_0x3662fa[_0x6d5d('0x2d')]]={'$like':'%'+_0x172484['query'][_0x6d5d('0x3f')]+'%'};return _0x31ea7f;}})});}_0x54b759=_[_0x6d5d('0x40')]({},_0x54b759,_0x172484[_0x6d5d('0x42')]);var _0x43d7d5={'where':_0x54b759['where']};return db[_0x6d5d('0x43')][_0x6d5d('0x23')](_0x43d7d5)[_0x6d5d('0x28')](function(_0x2a3f93){_0x3b924d[_0x6d5d('0x23')]=_0x2a3f93;if(_0x172484['query'][_0x6d5d('0x44')]){_0x54b759[_0x6d5d('0x45')]=[{'all':!![]}];}return db[_0x6d5d('0x43')][_0x6d5d('0x46')](_0x54b759);})[_0x6d5d('0x28')](function(_0x4d15bc){_0x3b924d['rows']=_0x4d15bc;return _0x3b924d;})[_0x6d5d('0x28')](respondWithFilteredResult(_0xd74feb,_0x54b759))['catch'](handleError(_0xd74feb,null));};exports['show']=function(_0x183330,_0x4594aa){var _0xca1a4={'raw':!![],'where':{'id':_0x183330[_0x6d5d('0x47')]['id']}},_0x42afbb={};_0x42afbb[_0x6d5d('0x34')]=_['keys'](db[_0x6d5d('0x43')][_0x6d5d('0x31')]);_0x42afbb[_0x6d5d('0x35')]=_[_0x6d5d('0x36')](_0x183330['query']);_0x42afbb[_0x6d5d('0x37')]=_[_0x6d5d('0x38')](_0x42afbb[_0x6d5d('0x34')],_0x42afbb[_0x6d5d('0x35')]);_0xca1a4[_0x6d5d('0x39')]=_[_0x6d5d('0x38')](_0x42afbb[_0x6d5d('0x34')],qs['fields'](_0x183330['query']['fields']));_0xca1a4[_0x6d5d('0x39')]=_0xca1a4['attributes']['length']?_0xca1a4[_0x6d5d('0x39')]:_0x42afbb[_0x6d5d('0x34')];if(_0x183330['query'][_0x6d5d('0x44')]){_0xca1a4[_0x6d5d('0x45')]=[{'all':!![]}];}_0xca1a4=_[_0x6d5d('0x40')]({},_0xca1a4,_0x183330[_0x6d5d('0x42')]);return db[_0x6d5d('0x43')][_0x6d5d('0x48')](_0xca1a4)['then'](handleEntityNotFound(_0x4594aa,null))[_0x6d5d('0x28')](respondWithResult(_0x4594aa,null))[_0x6d5d('0x49')](handleError(_0x4594aa,null));};exports[_0x6d5d('0x4a')]=function(_0x56205b,_0xf14d4){return db['FaxQueue'][_0x6d5d('0x4a')](_0x56205b['body'],{})['then'](function(_0x6e9f20){var _0x5a1d0a=_0x56205b[_0x6d5d('0x4b')]['get']({'plain':!![]});if(!_0x5a1d0a)throw new Error(_0x6d5d('0x4c'));if(_0x5a1d0a['role']===_0x6d5d('0x4b')){var _0x124a5e=_0x6e9f20[_0x6d5d('0x29')]({'plain':!![]});var _0x3e105b=_0x6d5d('0x2a');return db['UserProfileSection'][_0x6d5d('0x48')]({'where':{'name':_0x3e105b,'userProfileId':_0x5a1d0a[_0x6d5d('0x4d')]},'raw':!![]})[_0x6d5d('0x28')](function(_0xe7009f){if(_0xe7009f&&_0xe7009f[_0x6d5d('0x4e')]===0x0){return db[_0x6d5d('0x4f')]['create']({'name':_0x124a5e[_0x6d5d('0x2d')],'resourceId':_0x124a5e['id'],'type':_0xe7009f[_0x6d5d('0x2d')],'sectionId':_0xe7009f['id']},{})[_0x6d5d('0x28')](function(){return _0x6e9f20;});}else{return _0x6e9f20;}})[_0x6d5d('0x49')](function(_0x1bc026){logger[_0x6d5d('0x50')](_0x6d5d('0x51'),_0x1bc026);throw _0x1bc026;});}return _0x6e9f20;})[_0x6d5d('0x28')](respondWithResult(_0xf14d4,0xc9))[_0x6d5d('0x49')](handleError(_0xf14d4,null));};exports[_0x6d5d('0x27')]=function(_0x61008d,_0x380d0a){if(_0x61008d[_0x6d5d('0x52')]['id']){delete _0x61008d['body']['id'];}return db[_0x6d5d('0x43')][_0x6d5d('0x48')]({'where':{'id':_0x61008d['params']['id']}})[_0x6d5d('0x28')](handleEntityNotFound(_0x380d0a,null))[_0x6d5d('0x28')](saveUpdates(_0x61008d['body'],null))[_0x6d5d('0x28')](respondWithResult(_0x380d0a,null))[_0x6d5d('0x49')](handleError(_0x380d0a,null));};exports['destroy']=function(_0x213f5f,_0x274ca8){return db['FaxQueue'][_0x6d5d('0x48')]({'where':{'id':_0x213f5f[_0x6d5d('0x47')]['id']}})[_0x6d5d('0x28')](handleEntityNotFound(_0x274ca8,null))[_0x6d5d('0x28')](removeEntity(_0x274ca8,null))[_0x6d5d('0x49')](handleError(_0x274ca8,null));};exports['describe']=function(_0x2c6083,_0x315ad2){return db[_0x6d5d('0x43')]['describe']()['then'](respondWithResult(_0x315ad2,null))[_0x6d5d('0x49')](handleError(_0x315ad2,null));};exports['getMembers']=function(_0x2c6ed1,_0x510433,_0x45c943){var _0x56636b={'raw':!![],'where':{}},_0x83c373={},_0xf571c6;return db[_0x6d5d('0x43')][_0x6d5d('0x53')]({'where':{'id':_0x2c6ed1[_0x6d5d('0x47')]['id']}})[_0x6d5d('0x28')](handleEntityNotFound(_0x510433,null))[_0x6d5d('0x28')](function(_0x3684f7){if(_0x3684f7){_0xf571c6=_0x3684f7[_0x6d5d('0x29')]({'plain':!![]});_0x83c373['model']=_[_0x6d5d('0x36')](db[_0x6d5d('0x54')][_0x6d5d('0x31')]);_0x83c373['query']=_[_0x6d5d('0x36')](_0x2c6ed1[_0x6d5d('0x35')]);_0x83c373[_0x6d5d('0x37')]=_[_0x6d5d('0x38')](_0x83c373[_0x6d5d('0x34')],_0x83c373[_0x6d5d('0x35')]);_0x56636b[_0x6d5d('0x39')]=_[_0x6d5d('0x38')](_0x83c373[_0x6d5d('0x34')],qs[_0x6d5d('0x3a')](_0x2c6ed1[_0x6d5d('0x35')][_0x6d5d('0x3a')]));_0x56636b[_0x6d5d('0x39')]=_0x56636b[_0x6d5d('0x39')]['length']?_0x56636b[_0x6d5d('0x39')]:_0x83c373[_0x6d5d('0x34')];if(!_0x2c6ed1[_0x6d5d('0x35')]['hasOwnProperty']('nolimit')){_0x56636b[_0x6d5d('0x22')]=qs[_0x6d5d('0x22')](_0x2c6ed1[_0x6d5d('0x35')][_0x6d5d('0x22')]);_0x56636b[_0x6d5d('0x20')]=qs[_0x6d5d('0x20')](_0x2c6ed1[_0x6d5d('0x35')]['offset']);}_0x56636b[_0x6d5d('0x55')]=qs[_0x6d5d('0x3c')](_0x2c6ed1[_0x6d5d('0x35')]['sort']);_0x56636b[_0x6d5d('0x3d')]=qs['filters'](_['pick'](_0x2c6ed1[_0x6d5d('0x35')],_0x83c373[_0x6d5d('0x37')]));_0x56636b[_0x6d5d('0x3d')][_0x6d5d('0x56')]=_0x3684f7['id'];if(_0x2c6ed1[_0x6d5d('0x35')]['filter']){_0x56636b[_0x6d5d('0x3d')]=_[_0x6d5d('0x40')](_0x56636b['where'],{'$or':_[_0x6d5d('0x30')](_0x56636b[_0x6d5d('0x39')],function(_0x31f57a){var _0x5b12be={};_0x5b12be[_0x31f57a]={'$like':'%'+_0x2c6ed1[_0x6d5d('0x35')][_0x6d5d('0x3f')]+'%'};return _0x5b12be;})});}_0x56636b=_[_0x6d5d('0x40')]({},_0x56636b,_0x2c6ed1[_0x6d5d('0x42')]);return db['UserFaxQueue'][_0x6d5d('0x46')](_0x56636b);}})['then'](function(_0x10b289){if(_0x10b289){return db[_0x6d5d('0x57')][_0x6d5d('0x58')]({'where':{'id':_['map'](_0x10b289,'UserId'),'role':'agent'},'attributes':['id',_0x6d5d('0x2d'),_0x6d5d('0x59'),_0x6d5d('0x5a'),_0x6d5d('0x5b')]});}})[_0x6d5d('0x28')](function(_0x20746c){if(_0x20746c){return{'count':_0x20746c[_0x6d5d('0x23')],'rows':_[_0x6d5d('0x30')](_0x20746c[_0x6d5d('0x5c')],function(_0x20e823){return{'membername':_0x20e823[_0x6d5d('0x2d')],'UserId':_0x20e823['id'],'queue_name':_0xf571c6['name'],'FaxQueueId':_0xf571c6['id'],'interface':util[_0x6d5d('0x5d')]('%s/%s',_0x6d5d('0x5e'),_0x20e823[_0x6d5d('0x2d')]),'penalty':0x0,'paused':_0x20e823[_0x6d5d('0x59')],'createdAt':_0x20e823['createdAt'],'updatedAt':_0x20e823['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x510433,_0x56636b))[_0x6d5d('0x49')](handleError(_0x510433,null));};exports['getTeams']=function(_0x190a24,_0x3cce23,_0x25ad60){var _0x21b053={};var _0x2fb734={};var _0x1a55d6;var _0xe643ef;return db[_0x6d5d('0x43')][_0x6d5d('0x53')]({'where':{'id':_0x190a24[_0x6d5d('0x47')]['id']}})[_0x6d5d('0x28')](handleEntityNotFound(_0x3cce23,null))[_0x6d5d('0x28')](function(_0x37186d){if(_0x37186d){_0x1a55d6=_0x37186d;_0x2fb734[_0x6d5d('0x34')]=_[_0x6d5d('0x36')](db[_0x6d5d('0x5f')][_0x6d5d('0x31')]);_0x2fb734[_0x6d5d('0x35')]=_['keys'](_0x190a24[_0x6d5d('0x35')]);_0x2fb734[_0x6d5d('0x37')]=_[_0x6d5d('0x38')](_0x2fb734[_0x6d5d('0x34')],_0x2fb734[_0x6d5d('0x35')]);_0x21b053['attributes']=_[_0x6d5d('0x38')](_0x2fb734['model'],qs[_0x6d5d('0x3a')](_0x190a24[_0x6d5d('0x35')]['fields']));_0x21b053[_0x6d5d('0x39')]=_0x21b053[_0x6d5d('0x39')][_0x6d5d('0x60')]?_0x21b053['attributes']:_0x2fb734[_0x6d5d('0x34')];_0x21b053['order']=qs['sort'](_0x190a24[_0x6d5d('0x35')][_0x6d5d('0x3c')]);_0x21b053[_0x6d5d('0x3d')]=qs['filters'](_[_0x6d5d('0x3e')](_0x190a24[_0x6d5d('0x35')],_0x2fb734[_0x6d5d('0x37')]));if(_0x190a24['query'][_0x6d5d('0x3f')]){_0x21b053['where']=_['merge'](_0x21b053[_0x6d5d('0x3d')],{'$or':_['map'](_0x21b053['attributes'],function(_0x5eb5e2){var _0x25eb32={};_0x25eb32[_0x5eb5e2]={'$like':'%'+_0x190a24[_0x6d5d('0x35')]['filter']+'%'};return _0x25eb32;})});}_0x21b053=_['merge']({},_0x21b053,_0x190a24['options']);return _0x1a55d6[_0x6d5d('0x61')](_0x21b053);}})['then'](function(_0x5872d){if(_0x5872d){_0xe643ef=_0x5872d[_0x6d5d('0x60')];if(!_0x190a24[_0x6d5d('0x35')][_0x6d5d('0x62')](_0x6d5d('0x3b'))){_0x21b053['limit']=qs[_0x6d5d('0x22')](_0x190a24[_0x6d5d('0x35')][_0x6d5d('0x22')]);_0x21b053[_0x6d5d('0x20')]=qs[_0x6d5d('0x20')](_0x190a24['query'][_0x6d5d('0x20')]);}return _0x1a55d6[_0x6d5d('0x61')](_0x21b053);}})[_0x6d5d('0x28')](function(_0x49bcd0){if(_0x49bcd0){return _0x49bcd0?{'count':_0xe643ef,'rows':_0x49bcd0}:null;}})[_0x6d5d('0x28')](respondWithResult(_0x3cce23,null))['catch'](handleError(_0x3cce23,null));};exports[_0x6d5d('0x63')]=function(_0x59d8f2,_0x424e60,_0x51609c){var _0x27ba9e=_0x59d8f2[_0x6d5d('0x52')][_0x6d5d('0x64')];return db[_0x6d5d('0x5f')][_0x6d5d('0x46')]({'where':{'id':_0x27ba9e},'attributes':['id'],'include':[{'model':db[_0x6d5d('0x57')],'as':'Agents','attributes':['id',_0x6d5d('0x2d'),_0x6d5d('0x65'),_0x6d5d('0x66'),'interface'],'raw':!![]}]})[_0x6d5d('0x28')](function(_0xc98d07){if(_0xc98d07){var _0x275385=_['flatMap'](_0xc98d07,function(_0xcec27b){var _0x45bd66=_0xcec27b['get']({'plain':!![]});return _0x45bd66[_0x6d5d('0x67')];});return db['FaxQueue'][_0x6d5d('0x48')]({'where':{'id':_0x59d8f2['params']['id']}})[_0x6d5d('0x28')](function(_0x12400d){return db[_0x6d5d('0x68')][_0x6d5d('0x69')](function(_0x3320b1){return _0x12400d[_0x6d5d('0x63')](_0x27ba9e,{'transaction':_0x3320b1})[_0x6d5d('0x28')](function(){return BPromise[_0x6d5d('0x6a')](_0x275385,function(_0x2547fb){return db['UserFaxQueue'][_0x6d5d('0x6b')]({'where':{'UserId':_0x2547fb['id'],'FaxQueueId':_0x59d8f2[_0x6d5d('0x47')]['id']},'transaction':_0x3320b1});});})[_0x6d5d('0x28')](function(){_0x275385['forEach'](function(_0x435b79){socket[_0x6d5d('0x6c')]('userFaxQueue:save',{'UserId':_0x435b79['id'],'FaxQueueId':_0x12400d['id']});});});});});}})[_0x6d5d('0x28')](respondWithStatusCode(_0x424e60,null))[_0x6d5d('0x49')](handleError(_0x424e60,null));};exports[_0x6d5d('0x6d')]=function(_0x24ea7d,_0x7c44e3,_0x25b871){return db['Team'][_0x6d5d('0x46')]({'where':{'id':_0x24ea7d[_0x6d5d('0x35')][_0x6d5d('0x64')]},'attributes':['id'],'include':[{'model':db[_0x6d5d('0x57')],'as':_0x6d5d('0x67'),'attributes':['id'],'raw':!![]}]})[_0x6d5d('0x28')](handleEntityNotFound(_0x7c44e3,null))[_0x6d5d('0x28')](function(_0x70e2f3){var _0x253aa7=_[_0x6d5d('0x30')](_0x70e2f3,'id');var _0x100eed=[];var _0x527637=[];var _0x38508d=squel['select']();_0x38508d[_0x6d5d('0x6e')](_0x6d5d('0x6f'))['from'](_0x6d5d('0x70'),'tq')[_0x6d5d('0x71')](_0x6d5d('0x72'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x6d5d('0x73'),_0x24ea7d[_0x6d5d('0x47')]['id']);for(var _0x441008=0x0;_0x441008<_0x70e2f3[_0x6d5d('0x60')];_0x441008+=0x1){let _0x3bfe20=_0x70e2f3[_0x441008];for(var _0x1f3bc0=0x0;_0x1f3bc0<_0x3bfe20[_0x6d5d('0x67')][_0x6d5d('0x60')];_0x1f3bc0+=0x1){let _0x1c8795=_0x3bfe20['Agents'][_0x1f3bc0];var _0x313313=_0x38508d[_0x6d5d('0x74')]();_0x313313[_0x6d5d('0x3d')]('ut.UserId\x20=\x20?',_0x1c8795['id']);_0x527637[_0x6d5d('0x75')](db[_0x6d5d('0x68')][_0x6d5d('0x35')](_0x313313[_0x6d5d('0x76')](),{'type':db[_0x6d5d('0x68')][_0x6d5d('0x77')]['SELECT']})['then'](function(_0x49f4c6){if(_0x49f4c6[_0x6d5d('0x60')]===0x1){return _0x1c8795['id'];}else{var _0x1f2bbb=_['every'](_['map'](_0x49f4c6,'TeamId'),function(_0x280928){return _[_0x6d5d('0x78')](_0x253aa7,_0x280928);});if(_0x1f2bbb){return _0x1c8795['id'];}}}));}}return BPromise[_0x6d5d('0x79')](_0x527637)[_0x6d5d('0x28')](function(_0x8b15d){_0x100eed=_(_0x100eed)['union'](_0x8b15d)['compact']()[_0x6d5d('0x7a')]();return db['FaxQueue']['find']({'where':{'id':_0x24ea7d[_0x6d5d('0x47')]['id']}})['then'](function(_0x2514d0){return db[_0x6d5d('0x68')]['transaction'](function(_0x117955){return _0x2514d0[_0x6d5d('0x6d')](_0x24ea7d['query'][_0x6d5d('0x64')],{'transaction':_0x117955})[_0x6d5d('0x28')](function(){if(!_[_0x6d5d('0x7b')](_0x100eed)){return _0x2514d0[_0x6d5d('0x7c')](_0x100eed,{'transaction':_0x117955});}})['then'](function(){_0x100eed[_0x6d5d('0x7d')](function(_0x558f8d){socket[_0x6d5d('0x6c')](_0x6d5d('0x7e'),{'UserId':_0x558f8d,'FaxQueueId':_0x2514d0['id']});});});});});});})[_0x6d5d('0x28')](respondWithStatusCode(_0x7c44e3,null))['catch'](handleError(_0x7c44e3,null));};exports[_0x6d5d('0x7f')]=function(_0x481ae3,_0x5637fb,_0x111932){return db[_0x6d5d('0x43')][_0x6d5d('0x48')]({'where':{'id':_0x481ae3[_0x6d5d('0x47')]['id']}})[_0x6d5d('0x28')](handleEntityNotFound(_0x5637fb,null))['then'](function(_0x4eee61){if(_0x4eee61){return _0x4eee61[_0x6d5d('0x7f')](_0x481ae3['body'][_0x6d5d('0x64')],_[_0x6d5d('0x80')](_0x481ae3[_0x6d5d('0x52')],[_0x6d5d('0x64'),'id'])||{})['spread'](function(_0x7082f7){for(var _0x3f717e=0x0;_0x3f717e<_0x481ae3[_0x6d5d('0x52')][_0x6d5d('0x64')][_0x6d5d('0x60')];_0x3f717e+=0x1){socket[_0x6d5d('0x6c')]('userFaxQueue:save',{'UserId':Number(_0x481ae3[_0x6d5d('0x52')][_0x6d5d('0x64')][_0x3f717e]),'FaxQueueId':Number(_0x481ae3[_0x6d5d('0x47')]['id'])});}return _0x7082f7;});}})[_0x6d5d('0x28')](respondWithResult(_0x5637fb,null))['catch'](handleError(_0x5637fb,null));};exports[_0x6d5d('0x7c')]=function(_0x11eeb5,_0xfb2365,_0x35f9cc){return db[_0x6d5d('0x43')][_0x6d5d('0x48')]({'where':{'id':_0x11eeb5['params']['id']}})[_0x6d5d('0x28')](handleEntityNotFound(_0xfb2365,null))['then'](function(_0x1b902f){if(_0x1b902f){return _0x1b902f[_0x6d5d('0x7c')](_0x11eeb5[_0x6d5d('0x35')][_0x6d5d('0x64')])[_0x6d5d('0x28')](function(){if(_[_0x6d5d('0x81')](_0x11eeb5[_0x6d5d('0x35')][_0x6d5d('0x64')])){for(var _0x2f2b88=0x0;_0x2f2b88<_0x11eeb5[_0x6d5d('0x35')][_0x6d5d('0x64')][_0x6d5d('0x60')];_0x2f2b88+=0x1){socket['emit'](_0x6d5d('0x7e'),{'UserId':Number(_0x11eeb5[_0x6d5d('0x35')][_0x6d5d('0x64')][_0x2f2b88]),'FaxQueueId':Number(_0x11eeb5['params']['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x11eeb5[_0x6d5d('0x35')][_0x6d5d('0x64')]),'FaxQueueId':Number(_0x11eeb5['params']['id'])});}});}})[_0x6d5d('0x28')](respondWithStatusCode(_0xfb2365,null))[_0x6d5d('0x49')](handleError(_0xfb2365,null));};exports[_0x6d5d('0x82')]=function(_0x40c8ba,_0x3048b5,_0x1b115b){var _0x3f4f68={};var _0x246e05={};var _0x564b3f;var _0x3d8bc7;return db[_0x6d5d('0x43')][_0x6d5d('0x53')]({'where':{'id':_0x40c8ba['params']['id']}})[_0x6d5d('0x28')](handleEntityNotFound(_0x3048b5,null))[_0x6d5d('0x28')](function(_0x42a970){if(_0x42a970){_0x564b3f=_0x42a970;_0x246e05[_0x6d5d('0x34')]=_['keys'](db['User'][_0x6d5d('0x31')]);_0x246e05[_0x6d5d('0x35')]=_[_0x6d5d('0x36')](_0x40c8ba[_0x6d5d('0x35')]);_0x246e05['filters']=_[_0x6d5d('0x38')](_0x246e05[_0x6d5d('0x34')],_0x246e05[_0x6d5d('0x35')]);_0x3f4f68[_0x6d5d('0x39')]=_[_0x6d5d('0x38')](_0x246e05[_0x6d5d('0x34')],qs['fields'](_0x40c8ba[_0x6d5d('0x35')][_0x6d5d('0x3a')]));_0x3f4f68[_0x6d5d('0x39')]=_0x3f4f68[_0x6d5d('0x39')]['length']?_0x3f4f68[_0x6d5d('0x39')]:_0x246e05[_0x6d5d('0x34')];_0x3f4f68['order']=qs[_0x6d5d('0x3c')](_0x40c8ba[_0x6d5d('0x35')][_0x6d5d('0x3c')]);_0x3f4f68[_0x6d5d('0x3d')]=qs['filters'](_[_0x6d5d('0x3e')](_0x40c8ba[_0x6d5d('0x35')],_0x246e05[_0x6d5d('0x37')]));if(_0x40c8ba['query'][_0x6d5d('0x3f')]){_0x3f4f68[_0x6d5d('0x3d')]=_[_0x6d5d('0x40')](_0x3f4f68[_0x6d5d('0x3d')],{'$or':_[_0x6d5d('0x30')](_0x3f4f68[_0x6d5d('0x39')],function(_0x1ba9fd){var _0x4bf76a={};_0x4bf76a[_0x1ba9fd]={'$like':'%'+_0x40c8ba[_0x6d5d('0x35')][_0x6d5d('0x3f')]+'%'};return _0x4bf76a;})});}_0x3f4f68=_[_0x6d5d('0x40')]({},_0x3f4f68,_0x40c8ba['options']);return _0x564b3f[_0x6d5d('0x82')](_0x3f4f68);}})[_0x6d5d('0x28')](function(_0x128d54){if(_0x128d54){_0x3d8bc7=_0x128d54['length'];if(!_0x40c8ba['query'][_0x6d5d('0x62')](_0x6d5d('0x3b'))){_0x3f4f68['limit']=qs[_0x6d5d('0x22')](_0x40c8ba[_0x6d5d('0x35')][_0x6d5d('0x22')]);_0x3f4f68[_0x6d5d('0x20')]=qs['offset'](_0x40c8ba[_0x6d5d('0x35')][_0x6d5d('0x20')]);}return _0x564b3f['getAgents'](_0x3f4f68);}})[_0x6d5d('0x28')](function(_0x3c6570){if(_0x3c6570){return _0x3c6570?{'count':_0x3d8bc7,'rows':_0x3c6570}:null;}})[_0x6d5d('0x28')](respondWithResult(_0x3048b5,null))['catch'](handleError(_0x3048b5,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index a705a8d..3e1d83c 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 _0xda25=['../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x25ade8,_0x53bec4){var _0x1bdde3=function(_0x5799ac){while(--_0x5799ac){_0x25ade8['push'](_0x25ade8['shift']());}};_0x1bdde3(++_0x53bec4);}(_0xda25,0x170));var _0x5da2=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xda25[_0x2d34d6];return _0x1d3d12;};'use strict';var EventEmitter=require(_0x5da2('0x0'));var FaxQueue=require(_0x5da2('0x1'))['db'][_0x5da2('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5da2('0x3')](0x0);var events={'afterCreate':_0x5da2('0x4'),'afterUpdate':_0x5da2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x40b281){return function(_0x124867,_0x555fd0,_0xf9176f){FaxQueueEvents['emit'](_0x40b281+':'+_0x124867['id'],_0x124867);FaxQueueEvents[_0x5da2('0x6')](_0x40b281,_0x124867);_0xf9176f(null);};}for(var e in events){if(events[_0x5da2('0x7')](e)){var event=events[e];FaxQueue[_0x5da2('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x7e60=['emit','hasOwnProperty','events','../../mysqldb','FaxQueue','save','update','remove'];(function(_0x52e359,_0x70089d){var _0x473cca=function(_0x2e4c10){while(--_0x2e4c10){_0x52e359['push'](_0x52e359['shift']());}};_0x473cca(++_0x70089d);}(_0x7e60,0x142));var _0x07e6=function(_0x51f3d6,_0x572b62){_0x51f3d6=_0x51f3d6-0x0;var _0x2f0dfa=_0x7e60[_0x51f3d6];return _0x2f0dfa;};'use strict';var EventEmitter=require(_0x07e6('0x0'));var FaxQueue=require(_0x07e6('0x1'))['db'][_0x07e6('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x07e6('0x3'),'afterUpdate':_0x07e6('0x4'),'afterDestroy':_0x07e6('0x5')};function emitEvent(_0x4dda6f){return function(_0x1b88c3,_0x3a7cab,_0x3113b5){FaxQueueEvents[_0x07e6('0x6')](_0x4dda6f+':'+_0x1b88c3['id'],_0x1b88c3);FaxQueueEvents[_0x07e6('0x6')](_0x4dda6f,_0x1b88c3);_0x3113b5(null);};}for(var e in events){if(events[_0x07e6('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 2dbbf66..ffef433 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 _0x01f7=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','FaxQueue','lodash','util'];(function(_0x54f695,_0x17e578){var _0x5d8f73=function(_0x19fdb2){while(--_0x19fdb2){_0x54f695['push'](_0x54f695['shift']());}};_0x5d8f73(++_0x17e578);}(_0x01f7,0x1ba));var _0x701f=function(_0x3307bd,_0x256dbf){_0x3307bd=_0x3307bd-0x0;var _0x2561be=_0x01f7[_0x3307bd];return _0x2561be;};'use strict';var _=require(_0x701f('0x0'));var util=require(_0x701f('0x1'));var logger=require(_0x701f('0x2'))(_0x701f('0x3'));var moment=require(_0x701f('0x4'));var BPromise=require('bluebird');var rp=require(_0x701f('0x5'));var fs=require('fs');var path=require(_0x701f('0x6'));var rimraf=require(_0x701f('0x7'));var config=require(_0x701f('0x8'));var attributes=require('./faxQueue.attributes');module[_0x701f('0x9')]=function(_0x437063,_0x179dd6){return _0x437063[_0x701f('0xa')](_0x701f('0xb'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24db=['./faxQueue.attributes','FaxQueue','lodash','util','../../config/logger','api','moment','path'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x24db,0xa2));var _0xb24d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb24d('0x0'));var util=require(_0xb24d('0x1'));var logger=require(_0xb24d('0x2'))(_0xb24d('0x3'));var moment=require(_0xb24d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb24d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb24d('0x6'));module['exports']=function(_0x1c2594,_0x8c709c){return _0x1c2594['define'](_0xb24d('0x7'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 5866492..4ca2bb2 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 _0x3927=['findAll','options','raw','where','attributes','limit','include','map','ShowFaxQueue','find','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxQueue','FaxQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3927,0x1a0));var _0x7392=function(_0x45b38d,_0x5320e4){_0x45b38d=_0x45b38d-0x0;var _0x3b33e2=_0x3927[_0x45b38d];return _0x3b33e2;};'use strict';var _=require(_0x7392('0x0'));var util=require(_0x7392('0x1'));var moment=require(_0x7392('0x2'));var BPromise=require(_0x7392('0x3'));var rs=require(_0x7392('0x4'));var fs=require('fs');var Redis=require(_0x7392('0x5'));var db=require(_0x7392('0x6'))['db'];var utils=require(_0x7392('0x7'));var logger=require(_0x7392('0x8'))(_0x7392('0x9'));var config=require(_0x7392('0xa'));var jayson=require(_0x7392('0xb'));var client=jayson[_0x7392('0xc')][_0x7392('0xd')]({'port':0x232a});config[_0x7392('0xe')]=_[_0x7392('0xf')](config[_0x7392('0xe')],{'host':_0x7392('0x10'),'port':0x18eb});var socket=require(_0x7392('0x11'))(new Redis(config[_0x7392('0xe')]));require(_0x7392('0x12'))[_0x7392('0x13')](socket);function respondWithRpcPromise(_0x182446,_0x42450d,_0x26ebe9){return new BPromise(function(_0x510cff,_0x31de16){return client[_0x7392('0x14')](_0x182446,_0x26ebe9)[_0x7392('0x15')](function(_0x47668b){logger[_0x7392('0x16')](_0x7392('0x17'),_0x42450d,_0x7392('0x18'));logger[_0x7392('0x19')](_0x7392('0x1a'),_0x42450d,_0x7392('0x18'),JSON[_0x7392('0x1b')](_0x47668b));if(_0x47668b[_0x7392('0x1c')]){if(_0x47668b[_0x7392('0x1c')][_0x7392('0x1d')]===0x1f4){logger[_0x7392('0x1c')](_0x7392('0x17'),_0x42450d,_0x47668b['error'][_0x7392('0x1e')]);return _0x31de16(_0x47668b[_0x7392('0x1c')][_0x7392('0x1e')]);}logger[_0x7392('0x1c')](_0x7392('0x17'),_0x42450d,_0x47668b[_0x7392('0x1c')][_0x7392('0x1e')]);return _0x510cff(_0x47668b[_0x7392('0x1c')][_0x7392('0x1e')]);}else{logger[_0x7392('0x16')](_0x7392('0x17'),_0x42450d,_0x7392('0x18'));_0x510cff(_0x47668b['result']['message']);}})[_0x7392('0x1f')](function(_0x9be929){logger[_0x7392('0x1c')]('FaxQueue,\x20%s,\x20%s',_0x42450d,_0x9be929);_0x31de16(_0x9be929);});});}exports[_0x7392('0x20')]=function(_0x13f911){var _0x56c872=this;return new Promise(function(_0x29249f,_0x5338b2){return db[_0x7392('0x21')][_0x7392('0x22')]({'raw':_0x13f911['options']?_0x13f911[_0x7392('0x23')][_0x7392('0x24')]===undefined?!![]:![]:!![],'where':_0x13f911[_0x7392('0x23')]?_0x13f911[_0x7392('0x23')][_0x7392('0x25')]||null:null,'attributes':_0x13f911[_0x7392('0x23')]?_0x13f911['options'][_0x7392('0x26')]||null:null,'limit':_0x13f911[_0x7392('0x23')]?_0x13f911[_0x7392('0x23')][_0x7392('0x27')]||null:null,'include':_0x13f911[_0x7392('0x23')]?_0x13f911[_0x7392('0x23')][_0x7392('0x28')]?_['map'](_0x13f911['options'][_0x7392('0x28')],function(_0x4df5e2){return{'model':db[_0x4df5e2['model']],'as':_0x4df5e2['as'],'attributes':_0x4df5e2[_0x7392('0x26')],'include':_0x4df5e2[_0x7392('0x28')]?_[_0x7392('0x29')](_0x4df5e2[_0x7392('0x28')],function(_0x358fa7){return{'model':db[_0x358fa7['model']],'as':_0x358fa7['as'],'attributes':_0x358fa7[_0x7392('0x26')],'include':_0x358fa7[_0x7392('0x28')]?_[_0x7392('0x29')](_0x358fa7[_0x7392('0x28')],function(_0x5f1cf6){return{'model':db[_0x5f1cf6['model']],'as':_0x5f1cf6['as'],'attributes':_0x5f1cf6[_0x7392('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1eb84e){logger[_0x7392('0x16')](_0x7392('0x20'),_0x13f911);logger['debug'](_0x7392('0x20'),_0x13f911,JSON[_0x7392('0x1b')](_0x1eb84e));_0x29249f(_0x1eb84e);})[_0x7392('0x1f')](function(_0x283548){logger[_0x7392('0x1c')]('GetFaxQueue',_0x283548[_0x7392('0x1e')],_0x13f911);_0x5338b2(_0x56c872['error'](0x1f4,_0x283548[_0x7392('0x1e')]));});});};exports[_0x7392('0x2a')]=function(_0x3b5e83){var _0x21a7b1=this;return new Promise(function(_0xd870ec,_0x67a96f){return db[_0x7392('0x21')][_0x7392('0x2b')]({'raw':_0x3b5e83[_0x7392('0x23')]?_0x3b5e83[_0x7392('0x23')][_0x7392('0x24')]===undefined?!![]:![]:!![],'where':_0x3b5e83['options']?_0x3b5e83[_0x7392('0x23')][_0x7392('0x25')]||null:null,'attributes':_0x3b5e83[_0x7392('0x23')]?_0x3b5e83[_0x7392('0x23')]['attributes']||null:null,'include':_0x3b5e83['options']?_0x3b5e83[_0x7392('0x23')]['include']?_[_0x7392('0x29')](_0x3b5e83[_0x7392('0x23')][_0x7392('0x28')],function(_0x205714){return{'model':db[_0x205714['model']],'as':_0x205714['as'],'attributes':_0x205714[_0x7392('0x26')],'include':_0x205714[_0x7392('0x28')]?_[_0x7392('0x29')](_0x205714[_0x7392('0x28')],function(_0x1be786){return{'model':db[_0x1be786['model']],'as':_0x1be786['as'],'attributes':_0x1be786[_0x7392('0x26')],'include':_0x1be786['include']?_[_0x7392('0x29')](_0x1be786[_0x7392('0x28')],function(_0x118963){return{'model':db[_0x118963[_0x7392('0x2c')]],'as':_0x118963['as'],'attributes':_0x118963[_0x7392('0x26')]};}):[]};}):[]};}):[]:[]})[_0x7392('0x15')](function(_0x502e09){logger[_0x7392('0x16')]('ShowFaxQueue',_0x3b5e83);logger[_0x7392('0x19')](_0x7392('0x2a'),_0x3b5e83,JSON[_0x7392('0x1b')](_0x502e09));_0xd870ec(_0x502e09);})[_0x7392('0x1f')](function(_0x221b6a){logger[_0x7392('0x1c')](_0x7392('0x2a'),_0x221b6a[_0x7392('0x1e')],_0x3b5e83);_0x67a96f(_0x21a7b1[_0x7392('0x1c')](0x1f4,_0x221b6a[_0x7392('0x1e')]));});});}; \ No newline at end of file +var _0xfbc0=['register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','map','model','info','ShowFaxQueue','find','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis'];(function(_0x3431d3,_0x598e39){var _0x3ea7db=function(_0x2497d1){while(--_0x2497d1){_0x3431d3['push'](_0x3431d3['shift']());}};_0x3ea7db(++_0x598e39);}(_0xfbc0,0x103));var _0x0fbc=function(_0x568a34,_0x18e667){_0x568a34=_0x568a34-0x0;var _0x297ff4=_0xfbc0[_0x568a34];return _0x297ff4;};'use strict';var _=require(_0x0fbc('0x0'));var util=require('util');var moment=require(_0x0fbc('0x1'));var BPromise=require(_0x0fbc('0x2'));var rs=require(_0x0fbc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0fbc('0x4'));var logger=require(_0x0fbc('0x5'))(_0x0fbc('0x6'));var config=require('../../config/environment');var jayson=require(_0x0fbc('0x7'));var client=jayson[_0x0fbc('0x8')][_0x0fbc('0x9')]({'port':0x232a});config['redis']=_[_0x0fbc('0xa')](config['redis'],{'host':_0x0fbc('0xb'),'port':0x18eb});var socket=require(_0x0fbc('0xc'))(new Redis(config[_0x0fbc('0xd')]));require('./faxQueue.socket')[_0x0fbc('0xe')](socket);function respondWithRpcPromise(_0x3fbee7,_0x510e1c,_0x237a22){return new BPromise(function(_0x466506,_0x349fa1){return client[_0x0fbc('0xf')](_0x3fbee7,_0x237a22)[_0x0fbc('0x10')](function(_0x4c5288){logger['info'](_0x0fbc('0x11'),_0x510e1c,_0x0fbc('0x12'));logger[_0x0fbc('0x13')](_0x0fbc('0x14'),_0x510e1c,_0x0fbc('0x12'),JSON[_0x0fbc('0x15')](_0x4c5288));if(_0x4c5288[_0x0fbc('0x16')]){if(_0x4c5288[_0x0fbc('0x16')][_0x0fbc('0x17')]===0x1f4){logger['error'](_0x0fbc('0x11'),_0x510e1c,_0x4c5288[_0x0fbc('0x16')][_0x0fbc('0x18')]);return _0x349fa1(_0x4c5288[_0x0fbc('0x16')][_0x0fbc('0x18')]);}logger[_0x0fbc('0x16')]('FaxQueue,\x20%s,\x20%s',_0x510e1c,_0x4c5288[_0x0fbc('0x16')]['message']);return _0x466506(_0x4c5288[_0x0fbc('0x16')][_0x0fbc('0x18')]);}else{logger['info'](_0x0fbc('0x11'),_0x510e1c,_0x0fbc('0x12'));_0x466506(_0x4c5288['result']['message']);}})[_0x0fbc('0x19')](function(_0x3c7d0e){logger['error'](_0x0fbc('0x11'),_0x510e1c,_0x3c7d0e);_0x349fa1(_0x3c7d0e);});});}exports[_0x0fbc('0x1a')]=function(_0x328315){var _0x588833=this;return new Promise(function(_0xd9023b,_0x19e591){return db[_0x0fbc('0x1b')]['findAll']({'raw':_0x328315[_0x0fbc('0x1c')]?_0x328315[_0x0fbc('0x1c')][_0x0fbc('0x1d')]===undefined?!![]:![]:!![],'where':_0x328315['options']?_0x328315[_0x0fbc('0x1c')][_0x0fbc('0x1e')]||null:null,'attributes':_0x328315[_0x0fbc('0x1c')]?_0x328315[_0x0fbc('0x1c')][_0x0fbc('0x1f')]||null:null,'limit':_0x328315[_0x0fbc('0x1c')]?_0x328315[_0x0fbc('0x1c')][_0x0fbc('0x20')]||null:null,'include':_0x328315[_0x0fbc('0x1c')]?_0x328315[_0x0fbc('0x1c')][_0x0fbc('0x21')]?_[_0x0fbc('0x22')](_0x328315[_0x0fbc('0x1c')][_0x0fbc('0x21')],function(_0x4f6326){return{'model':db[_0x4f6326[_0x0fbc('0x23')]],'as':_0x4f6326['as'],'attributes':_0x4f6326[_0x0fbc('0x1f')],'include':_0x4f6326[_0x0fbc('0x21')]?_[_0x0fbc('0x22')](_0x4f6326['include'],function(_0x38267d){return{'model':db[_0x38267d[_0x0fbc('0x23')]],'as':_0x38267d['as'],'attributes':_0x38267d[_0x0fbc('0x1f')],'include':_0x38267d['include']?_[_0x0fbc('0x22')](_0x38267d['include'],function(_0x2707d9){return{'model':db[_0x2707d9[_0x0fbc('0x23')]],'as':_0x2707d9['as'],'attributes':_0x2707d9['attributes']};}):[]};}):[]};}):[]:[]})[_0x0fbc('0x10')](function(_0x52dcf2){logger[_0x0fbc('0x24')]('GetFaxQueue',_0x328315);logger[_0x0fbc('0x13')](_0x0fbc('0x1a'),_0x328315,JSON[_0x0fbc('0x15')](_0x52dcf2));_0xd9023b(_0x52dcf2);})[_0x0fbc('0x19')](function(_0x255821){logger['error'](_0x0fbc('0x1a'),_0x255821['message'],_0x328315);_0x19e591(_0x588833[_0x0fbc('0x16')](0x1f4,_0x255821[_0x0fbc('0x18')]));});});};exports[_0x0fbc('0x25')]=function(_0x13210a){var _0x2b3ef0=this;return new Promise(function(_0x30da9d,_0x388e65){return db[_0x0fbc('0x1b')][_0x0fbc('0x26')]({'raw':_0x13210a[_0x0fbc('0x1c')]?_0x13210a[_0x0fbc('0x1c')][_0x0fbc('0x1d')]===undefined?!![]:![]:!![],'where':_0x13210a[_0x0fbc('0x1c')]?_0x13210a[_0x0fbc('0x1c')][_0x0fbc('0x1e')]||null:null,'attributes':_0x13210a['options']?_0x13210a[_0x0fbc('0x1c')][_0x0fbc('0x1f')]||null:null,'include':_0x13210a[_0x0fbc('0x1c')]?_0x13210a[_0x0fbc('0x1c')][_0x0fbc('0x21')]?_[_0x0fbc('0x22')](_0x13210a[_0x0fbc('0x1c')]['include'],function(_0x32fd8c){return{'model':db[_0x32fd8c[_0x0fbc('0x23')]],'as':_0x32fd8c['as'],'attributes':_0x32fd8c[_0x0fbc('0x1f')],'include':_0x32fd8c['include']?_[_0x0fbc('0x22')](_0x32fd8c[_0x0fbc('0x21')],function(_0x582005){return{'model':db[_0x582005[_0x0fbc('0x23')]],'as':_0x582005['as'],'attributes':_0x582005['attributes'],'include':_0x582005[_0x0fbc('0x21')]?_[_0x0fbc('0x22')](_0x582005[_0x0fbc('0x21')],function(_0x372520){return{'model':db[_0x372520[_0x0fbc('0x23')]],'as':_0x372520['as'],'attributes':_0x372520[_0x0fbc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0fbc('0x10')](function(_0x19a91b){logger[_0x0fbc('0x24')](_0x0fbc('0x25'),_0x13210a);logger[_0x0fbc('0x13')](_0x0fbc('0x25'),_0x13210a,JSON[_0x0fbc('0x15')](_0x19a91b));_0x30da9d(_0x19a91b);})[_0x0fbc('0x19')](function(_0x1852f2){logger['error'](_0x0fbc('0x25'),_0x1852f2['message'],_0x13210a);_0x388e65(_0x2b3ef0['error'](0x1f4,_0x1852f2[_0x0fbc('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 3dff91a..7ef397b 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 _0xf2d8=['update','register','length','./faxQueue.events'];(function(_0x5eb034,_0x135582){var _0x2b0d30=function(_0x2188a7){while(--_0x2188a7){_0x5eb034['push'](_0x5eb034['shift']());}};_0x2b0d30(++_0x135582);}(_0xf2d8,0xbf));var _0x8f2d=function(_0x5ad67c,_0x144860){_0x5ad67c=_0x5ad67c-0x0;var _0xccce2e=_0xf2d8[_0x5ad67c];return _0xccce2e;};'use strict';var FaxQueueEvents=require(_0x8f2d('0x0'));var events=['save','remove',_0x8f2d('0x1')];function createListener(_0x23c123,_0x4a4fbd){return function(_0x13fe91){_0x4a4fbd['emit'](_0x23c123,_0x13fe91);};}function removeListener(_0x3d8793,_0x734b5b){return function(){FaxQueueEvents['removeListener'](_0x3d8793,_0x734b5b);};}exports[_0x8f2d('0x2')]=function(_0x2a5ef2){for(var _0x267a7f=0x0,_0x31e1ef=events[_0x8f2d('0x3')];_0x267a7f<_0x31e1ef;_0x267a7f++){var _0x3da866=events[_0x267a7f];var _0x187b45=createListener('faxQueue:'+_0x3da866,_0x2a5ef2);FaxQueueEvents['on'](_0x3da866,_0x187b45);}}; \ No newline at end of file +var _0xaeab=['emit','removeListener','register','length','faxQueue:','./faxQueue.events','remove'];(function(_0x496e8c,_0x589946){var _0x40d053=function(_0x312885){while(--_0x312885){_0x496e8c['push'](_0x496e8c['shift']());}};_0x40d053(++_0x589946);}(_0xaeab,0x91));var _0xbaea=function(_0x4502b9,_0x487ff0){_0x4502b9=_0x4502b9-0x0;var _0x24012f=_0xaeab[_0x4502b9];return _0x24012f;};'use strict';var FaxQueueEvents=require(_0xbaea('0x0'));var events=['save',_0xbaea('0x1'),'update'];function createListener(_0x2eb81e,_0x236fca){return function(_0x2e3da7){_0x236fca[_0xbaea('0x2')](_0x2eb81e,_0x2e3da7);};}function removeListener(_0x36e839,_0xbe1ff5){return function(){FaxQueueEvents[_0xbaea('0x3')](_0x36e839,_0xbe1ff5);};}exports[_0xbaea('0x4')]=function(_0x1ae44e){for(var _0x1e4331=0x0,_0x5bfed3=events[_0xbaea('0x5')];_0x1e4331<_0x5bfed3;_0x1e4331++){var _0x267afb=events[_0x1e4331];var _0x202d96=createListener(_0xbaea('0x6')+_0x267afb,_0x1ae44e);FaxQueueEvents['on'](_0x267afb,_0x202d96);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 909ca7c..54e525f 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 _0xba34=['create','post','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents'];(function(_0xff3bc8,_0x4b1ff3){var _0x59e775=function(_0x525c2c){while(--_0x525c2c){_0xff3bc8['push'](_0xff3bc8['shift']());}};_0x59e775(++_0x4b1ff3);}(_0xba34,0x119));var _0x4ba3=function(_0x2606d0,_0x3041d1){_0x2606d0=_0x2606d0-0x0;var _0x9811c2=_0xba34[_0x2606d0];return _0x9811c2;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0x8')](_0x4ba3('0xe'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x8')]('/:id/teams',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x10')]);router['get'](_0x4ba3('0x11'),auth['isAuthenticated'](),controller[_0x4ba3('0x12')]);router['post']('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x13')]);router[_0x4ba3('0x14')](_0x4ba3('0x15'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x16')]);router[_0x4ba3('0x14')](_0x4ba3('0x11'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x17')]);router[_0x4ba3('0x18')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x19')]);router[_0x4ba3('0x1a')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x1b')]);router[_0x4ba3('0x1a')](_0x4ba3('0x15'),auth[_0x4ba3('0x9')](),controller['removeTeams']);router[_0x4ba3('0x1a')](_0x4ba3('0x11'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x1c')]);module[_0x4ba3('0x1d')]=router; \ No newline at end of file +var _0x71ab=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','create','post','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0x71ab,0x64));var _0xb71a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x71ab[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var fs_extra=require(_0xb71a('0x3'));var auth=require(_0xb71a('0x4'));var interaction=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var controller=require(_0xb71a('0x7'));router[_0xb71a('0x8')]('/',auth[_0xb71a('0x9')](),controller[_0xb71a('0xa')]);router[_0xb71a('0x8')](_0xb71a('0xb'),auth[_0xb71a('0x9')](),controller[_0xb71a('0xc')]);router[_0xb71a('0x8')](_0xb71a('0xd'),auth[_0xb71a('0x9')](),controller[_0xb71a('0xe')]);router[_0xb71a('0x8')]('/:id/members',auth[_0xb71a('0x9')](),controller['getMembers']);router[_0xb71a('0x8')](_0xb71a('0xf'),auth[_0xb71a('0x9')](),controller['getTeams']);router[_0xb71a('0x8')]('/:id/users',auth[_0xb71a('0x9')](),controller['getAgents']);router['post']('/',auth[_0xb71a('0x9')](),controller[_0xb71a('0x10')]);router[_0xb71a('0x11')](_0xb71a('0xf'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xb71a('0x12'),auth[_0xb71a('0x9')](),controller[_0xb71a('0x13')]);router[_0xb71a('0x14')](_0xb71a('0xd'),auth[_0xb71a('0x9')](),controller[_0xb71a('0x15')]);router[_0xb71a('0x16')](_0xb71a('0xd'),auth['isAuthenticated'](),controller[_0xb71a('0x17')]);router[_0xb71a('0x16')](_0xb71a('0xf'),auth[_0xb71a('0x9')](),controller[_0xb71a('0x18')]);router[_0xb71a('0x16')](_0xb71a('0x12'),auth[_0xb71a('0x9')](),controller[_0xb71a('0x19')]);module[_0xb71a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index c88d5e1..a7249ac 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 _0xe630=['DATE','moment','sequelize','exports','STRING'];(function(_0xcc6216,_0x10e52e){var _0x1bc680=function(_0x309c4a){while(--_0x309c4a){_0xcc6216['push'](_0xcc6216['shift']());}};_0x1bc680(++_0x10e52e);}(_0xe630,0x65));var _0x0e63=function(_0x5cb5b1,_0xafc0d6){_0x5cb5b1=_0x5cb5b1-0x0;var _0x22d423=_0xe630[_0x5cb5b1];return _0x22d423;};'use strict';var moment=require(_0x0e63('0x0'));var Sequelize=require(_0x0e63('0x1'));module[_0x0e63('0x2')]={'uniqueid':{'type':Sequelize[_0x0e63('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0e63('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0e63('0x4')]},'acceptAt':{'type':Sequelize[_0x0e63('0x4')]},'exitAt':{'type':Sequelize[_0x0e63('0x4')]},'reason':{'type':Sequelize[_0x0e63('0x3')]}}; \ No newline at end of file +var _0x45d4=['moment','exports','STRING','DATE'];(function(_0x2f15ee,_0x3b0aaa){var _0x35fcde=function(_0x37a659){while(--_0x37a659){_0x2f15ee['push'](_0x2f15ee['shift']());}};_0x35fcde(++_0x3b0aaa);}(_0x45d4,0x170));var _0x445d=function(_0x2c98f0,_0x3f204f){_0x2c98f0=_0x2c98f0-0x0;var _0x4eaf96=_0x45d4[_0x2c98f0];return _0x4eaf96;};'use strict';var moment=require(_0x445d('0x0'));var Sequelize=require('sequelize');module[_0x445d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x445d('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x445d('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x445d('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index f6abbfd..f0694fa 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 _0x8868=['sox','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','findAll','rows','catch','show','keys','includeAll','options','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x55ef61,_0x3ed986){var _0x261b31=function(_0x36ab3e){while(--_0x36ab3e){_0x55ef61['push'](_0x55ef61['shift']());}};_0x261b31(++_0x3ed986);}(_0x8868,0x1ca));var _0x8886=function(_0x40cd66,_0x47b967){_0x40cd66=_0x40cd66-0x0;var _0x5d4c11=_0x8868[_0x40cd66];return _0x5d4c11;};'use strict';var emlformat=require(_0x8886('0x0'));var rimraf=require(_0x8886('0x1'));var zipdir=require(_0x8886('0x2'));var jsonpatch=require(_0x8886('0x3'));var rp=require(_0x8886('0x4'));var moment=require(_0x8886('0x5'));var BPromise=require(_0x8886('0x6'));var Mustache=require(_0x8886('0x7'));var util=require(_0x8886('0x8'));var path=require(_0x8886('0x9'));var sox=require(_0x8886('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8886('0xb'));var _=require(_0x8886('0xc'));var squel=require('squel');var crypto=require(_0x8886('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8886('0xe'));var toCsv=require(_0x8886('0xf'));var querystring=require(_0x8886('0x10'));var Papa=require(_0x8886('0x11'));var Redis=require(_0x8886('0x12'));var authService=require(_0x8886('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8886('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8886('0x15'));var utils=require('../../config/utils');var config=require(_0x8886('0x16'));var licenseUtil=require(_0x8886('0x17'));var db=require(_0x8886('0x18'))['db'];function respondWithStatusCode(_0x2a154d,_0x54cbc9){_0x54cbc9=_0x54cbc9||0xcc;return function(_0x29fa59){if(_0x29fa59){return _0x2a154d[_0x8886('0x19')](_0x54cbc9);}return _0x2a154d['status'](_0x54cbc9)[_0x8886('0x1a')]();};}function respondWithResult(_0x5ef48a,_0x4a339){_0x4a339=_0x4a339||0xc8;return function(_0x1110fd){if(_0x1110fd){return _0x5ef48a[_0x8886('0x1b')](_0x4a339)[_0x8886('0x1c')](_0x1110fd);}};}function respondWithFilteredResult(_0x57e00c,_0x5b6f4b){return function(_0x31dad3){if(_0x31dad3){var _0x11905e=typeof _0x5b6f4b['offset']==='undefined'&&typeof _0x5b6f4b['limit']==='undefined';var _0x438f1a=_0x31dad3[_0x8886('0x1d')];var _0x1d47a6=_0x11905e?0x0:_0x5b6f4b[_0x8886('0x1e')];var _0xb13c62=_0x11905e?_0x31dad3[_0x8886('0x1d')]:_0x5b6f4b[_0x8886('0x1e')]+_0x5b6f4b[_0x8886('0x1f')];var _0xbf4367;if(_0xb13c62>=_0x438f1a){_0xb13c62=_0x438f1a;_0xbf4367=0xc8;}else{_0xbf4367=0xce;}_0x57e00c[_0x8886('0x1b')](_0xbf4367);return _0x57e00c[_0x8886('0x20')](_0x8886('0x21'),_0x1d47a6+'-'+_0xb13c62+'/'+_0x438f1a)[_0x8886('0x1c')](_0x31dad3);}return null;};}function patchUpdates(_0x19f0ef){return function(_0x5103f9){try{jsonpatch[_0x8886('0x22')](_0x5103f9,_0x19f0ef,!![]);}catch(_0x595f45){return BPromise[_0x8886('0x23')](_0x595f45);}return _0x5103f9[_0x8886('0x24')]();};}function saveUpdates(_0x48ec2e,_0x3894a0){return function(_0x17163e){if(_0x17163e){return _0x17163e[_0x8886('0x25')](_0x48ec2e)[_0x8886('0x26')](function(_0x19a78f){return _0x19a78f;});}return null;};}function removeEntity(_0x1c4485,_0x4d8d5e){return function(_0x3df299){if(_0x3df299){return _0x3df299['destroy']()[_0x8886('0x26')](function(){_0x1c4485[_0x8886('0x1b')](0xcc)[_0x8886('0x1a')]();});}};}function handleEntityNotFound(_0x48280f,_0x31e239){return function(_0x5b966b){if(!_0x5b966b){_0x48280f[_0x8886('0x19')](0x194);}return _0x5b966b;};}function handleError(_0x127fc9,_0x27ba7d){_0x27ba7d=_0x27ba7d||0x1f4;return function(_0x337007){logger[_0x8886('0x27')](_0x337007[_0x8886('0x28')]);if(_0x337007[_0x8886('0x29')]){delete _0x337007['name'];}_0x127fc9['status'](_0x27ba7d)[_0x8886('0x2a')](_0x337007);};}exports[_0x8886('0x2b')]=function(_0x4a37ca,_0xc02082){var _0x45b714={},_0x15cc33={},_0x4aa414={'count':0x0,'rows':[]};var _0x5084a4=_[_0x8886('0x2c')](db[_0x8886('0x2d')][_0x8886('0x2e')],function(_0x381bce){return{'name':_0x381bce[_0x8886('0x2f')],'type':_0x381bce[_0x8886('0x30')][_0x8886('0x31')]};});_0x15cc33['model']=_[_0x8886('0x2c')](_0x5084a4,_0x8886('0x29'));_0x15cc33[_0x8886('0x32')]=_['keys'](_0x4a37ca[_0x8886('0x32')]);_0x15cc33['filters']=_[_0x8886('0x33')](_0x15cc33[_0x8886('0x34')],_0x15cc33['query']);_0x45b714[_0x8886('0x35')]=_[_0x8886('0x33')](_0x15cc33[_0x8886('0x34')],qs[_0x8886('0x36')](_0x4a37ca[_0x8886('0x32')][_0x8886('0x36')]));_0x45b714[_0x8886('0x35')]=_0x45b714['attributes'][_0x8886('0x37')]?_0x45b714[_0x8886('0x35')]:_0x15cc33[_0x8886('0x34')];if(!_0x4a37ca[_0x8886('0x32')][_0x8886('0x38')](_0x8886('0x39'))){_0x45b714['limit']=qs[_0x8886('0x1f')](_0x4a37ca[_0x8886('0x32')][_0x8886('0x1f')]);_0x45b714[_0x8886('0x1e')]=qs[_0x8886('0x1e')](_0x4a37ca['query'][_0x8886('0x1e')]);}_0x45b714[_0x8886('0x3a')]=qs[_0x8886('0x3b')](_0x4a37ca[_0x8886('0x32')][_0x8886('0x3b')]);_0x45b714[_0x8886('0x3c')]=qs[_0x8886('0x3d')](_['pick'](_0x4a37ca[_0x8886('0x32')],_0x15cc33[_0x8886('0x3d')]),_0x5084a4);if(_0x4a37ca['query']['filter']){_0x45b714[_0x8886('0x3c')]=_[_0x8886('0x3e')](_0x45b714['where'],{'$or':_['map'](_0x5084a4,function(_0xed02f4){if(_0xed02f4[_0x8886('0x30')]!==_0x8886('0x3f')){var _0x2125cd={};_0x2125cd[_0xed02f4[_0x8886('0x29')]]={'$like':'%'+_0x4a37ca[_0x8886('0x32')][_0x8886('0x40')]+'%'};return _0x2125cd;}})});}_0x45b714=_[_0x8886('0x3e')]({},_0x45b714,_0x4a37ca['options']);var _0x21422b={'where':_0x45b714[_0x8886('0x3c')]};return db['FaxQueueReport'][_0x8886('0x1d')](_0x21422b)[_0x8886('0x26')](function(_0x5b03ea){_0x4aa414[_0x8886('0x1d')]=_0x5b03ea;if(_0x4a37ca[_0x8886('0x32')]['includeAll']){_0x45b714['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0x8886('0x41')](_0x45b714);})[_0x8886('0x26')](function(_0x16d70c){_0x4aa414[_0x8886('0x42')]=_0x16d70c;return _0x4aa414;})[_0x8886('0x26')](respondWithFilteredResult(_0xc02082,_0x45b714))[_0x8886('0x43')](handleError(_0xc02082,null));};exports[_0x8886('0x44')]=function(_0x52dc2c,_0x56c006){var _0x524353={'raw':!![],'where':{'id':_0x52dc2c['params']['id']}},_0x59e3ba={};_0x59e3ba[_0x8886('0x34')]=_[_0x8886('0x45')](db[_0x8886('0x2d')][_0x8886('0x2e')]);_0x59e3ba[_0x8886('0x32')]=_[_0x8886('0x45')](_0x52dc2c[_0x8886('0x32')]);_0x59e3ba[_0x8886('0x3d')]=_['intersection'](_0x59e3ba[_0x8886('0x34')],_0x59e3ba[_0x8886('0x32')]);_0x524353[_0x8886('0x35')]=_[_0x8886('0x33')](_0x59e3ba[_0x8886('0x34')],qs['fields'](_0x52dc2c[_0x8886('0x32')]['fields']));_0x524353[_0x8886('0x35')]=_0x524353[_0x8886('0x35')][_0x8886('0x37')]?_0x524353[_0x8886('0x35')]:_0x59e3ba[_0x8886('0x34')];if(_0x52dc2c[_0x8886('0x32')][_0x8886('0x46')]){_0x524353['include']=[{'all':!![]}];}_0x524353=_['merge']({},_0x524353,_0x52dc2c[_0x8886('0x47')]);return db[_0x8886('0x2d')][_0x8886('0x48')](_0x524353)[_0x8886('0x26')](handleEntityNotFound(_0x56c006,null))[_0x8886('0x26')](respondWithResult(_0x56c006,null))[_0x8886('0x43')](handleError(_0x56c006,null));};exports[_0x8886('0x49')]=function(_0x445484,_0x40c34b){return db[_0x8886('0x2d')][_0x8886('0x49')](_0x445484[_0x8886('0x4a')],{})['then'](respondWithResult(_0x40c34b,0xc9))[_0x8886('0x43')](handleError(_0x40c34b,null));};exports[_0x8886('0x25')]=function(_0x2679bf,_0x5775ff){if(_0x2679bf[_0x8886('0x4a')]['id']){delete _0x2679bf[_0x8886('0x4a')]['id'];}return db[_0x8886('0x2d')]['find']({'where':{'id':_0x2679bf[_0x8886('0x4b')]['id']}})[_0x8886('0x26')](handleEntityNotFound(_0x5775ff,null))[_0x8886('0x26')](saveUpdates(_0x2679bf['body'],null))[_0x8886('0x26')](respondWithResult(_0x5775ff,null))['catch'](handleError(_0x5775ff,null));};exports[_0x8886('0x4c')]=function(_0x73cd93,_0x4ceb13){return db[_0x8886('0x2d')]['find']({'where':{'id':_0x73cd93['params']['id']}})[_0x8886('0x26')](handleEntityNotFound(_0x4ceb13,null))[_0x8886('0x26')](removeEntity(_0x4ceb13,null))[_0x8886('0x43')](handleError(_0x4ceb13,null));};exports[_0x8886('0x4d')]=function(_0x3e6f6d,_0x1062ba){return db['FaxQueueReport'][_0x8886('0x4d')]()[_0x8886('0x26')](respondWithResult(_0x1062ba,null))[_0x8886('0x43')](handleError(_0x1062ba,null));}; \ No newline at end of file +var _0x195e=['includeAll','include','findAll','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','FaxQueueReport','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options'];(function(_0x2c8b7a,_0x483fe0){var _0x1c1cf9=function(_0x464bcf){while(--_0x464bcf){_0x2c8b7a['push'](_0x2c8b7a['shift']());}};_0x1c1cf9(++_0x483fe0);}(_0x195e,0xfb));var _0xe195=function(_0xb7b10f,_0x174951){_0xb7b10f=_0xb7b10f-0x0;var _0x2b0dd0=_0x195e[_0xb7b10f];return _0x2b0dd0;};'use strict';var emlformat=require(_0xe195('0x0'));var rimraf=require(_0xe195('0x1'));var zipdir=require(_0xe195('0x2'));var jsonpatch=require(_0xe195('0x3'));var rp=require(_0xe195('0x4'));var moment=require(_0xe195('0x5'));var BPromise=require(_0xe195('0x6'));var Mustache=require(_0xe195('0x7'));var util=require(_0xe195('0x8'));var path=require(_0xe195('0x9'));var sox=require(_0xe195('0xa'));var csv=require(_0xe195('0xb'));var ejs=require(_0xe195('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe195('0xd'));var squel=require(_0xe195('0xe'));var crypto=require(_0xe195('0xf'));var jsforce=require(_0xe195('0x10'));var deskjs=require(_0xe195('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe195('0x12'));var authService=require(_0xe195('0x13'));var qs=require(_0xe195('0x14'));var as=require(_0xe195('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe195('0x16'))(_0xe195('0x17'));var utils=require(_0xe195('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe195('0x19'));var db=require(_0xe195('0x1a'))['db'];function respondWithStatusCode(_0x5ae615,_0x3da7d9){_0x3da7d9=_0x3da7d9||0xcc;return function(_0x12fa0f){if(_0x12fa0f){return _0x5ae615[_0xe195('0x1b')](_0x3da7d9);}return _0x5ae615[_0xe195('0x1c')](_0x3da7d9)['end']();};}function respondWithResult(_0x52217d,_0x2e82d1){_0x2e82d1=_0x2e82d1||0xc8;return function(_0x555a6a){if(_0x555a6a){return _0x52217d['status'](_0x2e82d1)[_0xe195('0x1d')](_0x555a6a);}};}function respondWithFilteredResult(_0x5c444f,_0x232c57){return function(_0x542ac7){if(_0x542ac7){var _0x534879=typeof _0x232c57[_0xe195('0x1e')]===_0xe195('0x1f')&&typeof _0x232c57[_0xe195('0x20')]===_0xe195('0x1f');var _0x3a042f=_0x542ac7[_0xe195('0x21')];var _0x4784b1=_0x534879?0x0:_0x232c57[_0xe195('0x1e')];var _0x9c8ba5=_0x534879?_0x542ac7[_0xe195('0x21')]:_0x232c57['offset']+_0x232c57[_0xe195('0x20')];var _0x317d8b;if(_0x9c8ba5>=_0x3a042f){_0x9c8ba5=_0x3a042f;_0x317d8b=0xc8;}else{_0x317d8b=0xce;}_0x5c444f[_0xe195('0x1c')](_0x317d8b);return _0x5c444f[_0xe195('0x22')](_0xe195('0x23'),_0x4784b1+'-'+_0x9c8ba5+'/'+_0x3a042f)[_0xe195('0x1d')](_0x542ac7);}return null;};}function patchUpdates(_0x496722){return function(_0x1c5ac8){try{jsonpatch[_0xe195('0x24')](_0x1c5ac8,_0x496722,!![]);}catch(_0x334b4a){return BPromise[_0xe195('0x25')](_0x334b4a);}return _0x1c5ac8['save']();};}function saveUpdates(_0x4dab1a,_0x4e5f13){return function(_0x57ee33){if(_0x57ee33){return _0x57ee33[_0xe195('0x26')](_0x4dab1a)[_0xe195('0x27')](function(_0x2cb019){return _0x2cb019;});}return null;};}function removeEntity(_0x199148,_0x46b15b){return function(_0x40c6a2){if(_0x40c6a2){return _0x40c6a2[_0xe195('0x28')]()[_0xe195('0x27')](function(){_0x199148[_0xe195('0x1c')](0xcc)[_0xe195('0x29')]();});}};}function handleEntityNotFound(_0x55be2d,_0x36a566){return function(_0x58ea75){if(!_0x58ea75){_0x55be2d[_0xe195('0x1b')](0x194);}return _0x58ea75;};}function handleError(_0x334cb8,_0x147563){_0x147563=_0x147563||0x1f4;return function(_0x2a0504){logger[_0xe195('0x2a')](_0x2a0504[_0xe195('0x2b')]);if(_0x2a0504[_0xe195('0x2c')]){delete _0x2a0504[_0xe195('0x2c')];}_0x334cb8[_0xe195('0x1c')](_0x147563)[_0xe195('0x2d')](_0x2a0504);};}exports['index']=function(_0x33a08d,_0x3e228f){var _0x3199d0={},_0x1f72a2={},_0x283516={'count':0x0,'rows':[]};var _0x4e4d30=_['map'](db[_0xe195('0x2e')][_0xe195('0x2f')],function(_0x46b6f2){return{'name':_0x46b6f2[_0xe195('0x30')],'type':_0x46b6f2[_0xe195('0x31')][_0xe195('0x32')]};});_0x1f72a2['model']=_[_0xe195('0x33')](_0x4e4d30,_0xe195('0x2c'));_0x1f72a2[_0xe195('0x34')]=_['keys'](_0x33a08d[_0xe195('0x34')]);_0x1f72a2['filters']=_[_0xe195('0x35')](_0x1f72a2[_0xe195('0x36')],_0x1f72a2['query']);_0x3199d0[_0xe195('0x37')]=_[_0xe195('0x35')](_0x1f72a2[_0xe195('0x36')],qs['fields'](_0x33a08d[_0xe195('0x34')][_0xe195('0x38')]));_0x3199d0[_0xe195('0x37')]=_0x3199d0[_0xe195('0x37')][_0xe195('0x39')]?_0x3199d0[_0xe195('0x37')]:_0x1f72a2['model'];if(!_0x33a08d[_0xe195('0x34')][_0xe195('0x3a')](_0xe195('0x3b'))){_0x3199d0[_0xe195('0x20')]=qs[_0xe195('0x20')](_0x33a08d[_0xe195('0x34')][_0xe195('0x20')]);_0x3199d0['offset']=qs[_0xe195('0x1e')](_0x33a08d[_0xe195('0x34')]['offset']);}_0x3199d0[_0xe195('0x3c')]=qs[_0xe195('0x3d')](_0x33a08d['query'][_0xe195('0x3d')]);_0x3199d0['where']=qs[_0xe195('0x3e')](_[_0xe195('0x3f')](_0x33a08d[_0xe195('0x34')],_0x1f72a2[_0xe195('0x3e')]),_0x4e4d30);if(_0x33a08d[_0xe195('0x34')][_0xe195('0x40')]){_0x3199d0['where']=_[_0xe195('0x41')](_0x3199d0[_0xe195('0x42')],{'$or':_[_0xe195('0x33')](_0x4e4d30,function(_0x4d5b04){if(_0x4d5b04[_0xe195('0x31')]!==_0xe195('0x43')){var _0x5207e3={};_0x5207e3[_0x4d5b04[_0xe195('0x2c')]]={'$like':'%'+_0x33a08d[_0xe195('0x34')]['filter']+'%'};return _0x5207e3;}})});}_0x3199d0=_[_0xe195('0x41')]({},_0x3199d0,_0x33a08d[_0xe195('0x44')]);var _0x28ac42={'where':_0x3199d0['where']};return db[_0xe195('0x2e')][_0xe195('0x21')](_0x28ac42)[_0xe195('0x27')](function(_0x2ce54e){_0x283516[_0xe195('0x21')]=_0x2ce54e;if(_0x33a08d[_0xe195('0x34')][_0xe195('0x45')]){_0x3199d0[_0xe195('0x46')]=[{'all':!![]}];}return db[_0xe195('0x2e')][_0xe195('0x47')](_0x3199d0);})[_0xe195('0x27')](function(_0xff05fc){_0x283516['rows']=_0xff05fc;return _0x283516;})[_0xe195('0x27')](respondWithFilteredResult(_0x3e228f,_0x3199d0))[_0xe195('0x48')](handleError(_0x3e228f,null));};exports[_0xe195('0x49')]=function(_0x42a856,_0x15293a){var _0x4f66cd={'raw':!![],'where':{'id':_0x42a856['params']['id']}},_0x5d1059={};_0x5d1059['model']=_[_0xe195('0x4a')](db['FaxQueueReport'][_0xe195('0x2f')]);_0x5d1059['query']=_['keys'](_0x42a856[_0xe195('0x34')]);_0x5d1059[_0xe195('0x3e')]=_[_0xe195('0x35')](_0x5d1059[_0xe195('0x36')],_0x5d1059[_0xe195('0x34')]);_0x4f66cd[_0xe195('0x37')]=_[_0xe195('0x35')](_0x5d1059[_0xe195('0x36')],qs['fields'](_0x42a856['query'][_0xe195('0x38')]));_0x4f66cd[_0xe195('0x37')]=_0x4f66cd['attributes'][_0xe195('0x39')]?_0x4f66cd[_0xe195('0x37')]:_0x5d1059[_0xe195('0x36')];if(_0x42a856[_0xe195('0x34')][_0xe195('0x45')]){_0x4f66cd[_0xe195('0x46')]=[{'all':!![]}];}_0x4f66cd=_[_0xe195('0x41')]({},_0x4f66cd,_0x42a856[_0xe195('0x44')]);return db[_0xe195('0x2e')][_0xe195('0x4b')](_0x4f66cd)[_0xe195('0x27')](handleEntityNotFound(_0x15293a,null))[_0xe195('0x27')](respondWithResult(_0x15293a,null))['catch'](handleError(_0x15293a,null));};exports[_0xe195('0x4c')]=function(_0x3dc748,_0x1ebb32){return db[_0xe195('0x2e')][_0xe195('0x4c')](_0x3dc748[_0xe195('0x4d')],{})[_0xe195('0x27')](respondWithResult(_0x1ebb32,0xc9))[_0xe195('0x48')](handleError(_0x1ebb32,null));};exports[_0xe195('0x26')]=function(_0x19e744,_0x2b3d9b){if(_0x19e744['body']['id']){delete _0x19e744[_0xe195('0x4d')]['id'];}return db['FaxQueueReport'][_0xe195('0x4b')]({'where':{'id':_0x19e744[_0xe195('0x4e')]['id']}})[_0xe195('0x27')](handleEntityNotFound(_0x2b3d9b,null))['then'](saveUpdates(_0x19e744['body'],null))[_0xe195('0x27')](respondWithResult(_0x2b3d9b,null))[_0xe195('0x48')](handleError(_0x2b3d9b,null));};exports[_0xe195('0x28')]=function(_0x11aec8,_0x332126){return db[_0xe195('0x2e')][_0xe195('0x4b')]({'where':{'id':_0x11aec8[_0xe195('0x4e')]['id']}})[_0xe195('0x27')](handleEntityNotFound(_0x332126,null))[_0xe195('0x27')](removeEntity(_0x332126,null))[_0xe195('0x48')](handleError(_0x332126,null));};exports[_0xe195('0x4f')]=function(_0x68355f,_0x1b500e){return db[_0xe195('0x2e')][_0xe195('0x4f')]()[_0xe195('0x27')](respondWithResult(_0x1b500e,null))[_0xe195('0x48')](handleError(_0x1b500e,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 0c76f75..c720b93 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x55befc,_0x30da7b){var _0x2388fe=function(_0x11c794){while(--_0x11c794){_0x55befc['push'](_0x55befc['shift']());}};_0x2388fe(++_0x30da7b);}(_0x53ec,0x192));var _0xc53e=function(_0x3882e4,_0x2cd2cd){_0x3882e4=_0x3882e4-0x0;var _0x359fea=_0x53ec[_0x3882e4];return _0x359fea;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x397cfd,_0x44277b){var _0x22c1b2=function(_0x4b083a){while(--_0x4b083a){_0x397cfd['push'](_0x397cfd['shift']());}};_0x22c1b2(++_0x44277b);}(_0xabce,0x103));var _0xeabc=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xabce[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index c268c10..4eeeaff 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 _0x661a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','catch','update','where','attributes','limit','UpdateFaxQueueReport','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x5a82a1,_0x31e101){var _0x1730fa=function(_0x46b558){while(--_0x46b558){_0x5a82a1['push'](_0x5a82a1['shift']());}};_0x1730fa(++_0x31e101);}(_0x661a,0xf7));var _0xa661=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0x661a[_0xd511d];return _0x3f148e;};'use strict';var _=require(_0xa661('0x0'));var util=require(_0xa661('0x1'));var moment=require('moment');var BPromise=require(_0xa661('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa661('0x3'));var db=require(_0xa661('0x4'))['db'];var utils=require(_0xa661('0x5'));var logger=require(_0xa661('0x6'))(_0xa661('0x7'));var config=require(_0xa661('0x8'));var jayson=require(_0xa661('0x9'));var client=jayson[_0xa661('0xa')][_0xa661('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ef858,_0x2e6ea7,_0x5aeff9){return new BPromise(function(_0x21d40c,_0x2469e4){return client[_0xa661('0xc')](_0x5ef858,_0x5aeff9)[_0xa661('0xd')](function(_0x5135af){logger[_0xa661('0xe')](_0xa661('0xf'),_0x2e6ea7,_0xa661('0x10'));logger[_0xa661('0x11')](_0xa661('0x12'),_0x2e6ea7,_0xa661('0x10'),JSON[_0xa661('0x13')](_0x5135af));if(_0x5135af[_0xa661('0x14')]){if(_0x5135af[_0xa661('0x14')][_0xa661('0x15')]===0x1f4){logger[_0xa661('0x14')](_0xa661('0xf'),_0x2e6ea7,_0x5135af[_0xa661('0x14')][_0xa661('0x16')]);return _0x2469e4(_0x5135af[_0xa661('0x14')][_0xa661('0x16')]);}logger[_0xa661('0x14')](_0xa661('0xf'),_0x2e6ea7,_0x5135af[_0xa661('0x14')]['message']);return _0x21d40c(_0x5135af[_0xa661('0x14')][_0xa661('0x16')]);}else{logger[_0xa661('0xe')](_0xa661('0xf'),_0x2e6ea7,_0xa661('0x10'));_0x21d40c(_0x5135af[_0xa661('0x17')][_0xa661('0x16')]);}})['catch'](function(_0x46c2e6){logger[_0xa661('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x2e6ea7,_0x46c2e6);_0x2469e4(_0x46c2e6);});});}exports['CreateFaxQueueReport']=function(_0x369f53){var _0x52b0b4=this;return new Promise(function(_0x384362,_0x12b8e5){return db[_0xa661('0x18')][_0xa661('0x19')](_0x369f53[_0xa661('0x1a')],{'raw':_0x369f53[_0xa661('0x1b')]?_0x369f53['options'][_0xa661('0x1c')]===undefined?!![]:![]:!![]})[_0xa661('0xd')](function(_0x3c0d0a){logger[_0xa661('0xe')](_0xa661('0x1d'),_0x369f53);logger['debug'](_0xa661('0x1d'),_0x369f53,JSON[_0xa661('0x13')](_0x3c0d0a));_0x384362(_0x3c0d0a);})[_0xa661('0x1e')](function(_0x60aa0e){logger[_0xa661('0x14')](_0xa661('0x1d'),_0x60aa0e['message'],_0x369f53);_0x12b8e5(_0x52b0b4[_0xa661('0x14')](0x1f4,_0x60aa0e[_0xa661('0x16')]));});});};exports['UpdateFaxQueueReport']=function(_0x194b3c){var _0x43a4e6=this;return new Promise(function(_0x3a87ed,_0xd56e5d){return db[_0xa661('0x18')][_0xa661('0x1f')](_0x194b3c['body'],{'raw':_0x194b3c[_0xa661('0x1b')]?_0x194b3c['options'][_0xa661('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x194b3c[_0xa661('0x1b')]?_0x194b3c[_0xa661('0x1b')][_0xa661('0x20')]||null:null,'attributes':_0x194b3c['options']?_0x194b3c['options'][_0xa661('0x21')]||null:null,'limit':_0x194b3c['options']?_0x194b3c[_0xa661('0x1b')][_0xa661('0x22')]||null:null})['then'](function(_0x2dadd7){logger['info']('UpdateFaxQueueReport',_0x194b3c);logger[_0xa661('0x11')](_0xa661('0x23'),_0x194b3c,JSON[_0xa661('0x13')](_0x2dadd7));_0x3a87ed(_0x2dadd7);})[_0xa661('0x1e')](function(_0x44ac28){logger['error']('UpdateFaxQueueReport',_0x44ac28[_0xa661('0x16')],_0x194b3c);_0xd56e5d(_0x43a4e6[_0xa661('0x14')](0x1f4,_0x44ac28[_0xa661('0x16')]));});});}; \ No newline at end of file +var _0x916e=['UpdateFaxQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxQueueReport','create','options','CreateFaxQueueReport','update','body','raw','where','attributes','limit'];(function(_0x2be9d6,_0x228020){var _0x27df8a=function(_0x2a11c9){while(--_0x2a11c9){_0x2be9d6['push'](_0x2be9d6['shift']());}};_0x27df8a(++_0x228020);}(_0x916e,0x1dd));var _0xe916=function(_0x281e1e,_0xc91fe0){_0x281e1e=_0x281e1e-0x0;var _0x312126=_0x916e[_0x281e1e];return _0x312126;};'use strict';var _=require(_0xe916('0x0'));var util=require('util');var moment=require(_0xe916('0x1'));var BPromise=require(_0xe916('0x2'));var rs=require(_0xe916('0x3'));var fs=require('fs');var Redis=require(_0xe916('0x4'));var db=require(_0xe916('0x5'))['db'];var utils=require(_0xe916('0x6'));var logger=require(_0xe916('0x7'))('rpc');var config=require(_0xe916('0x8'));var jayson=require(_0xe916('0x9'));var client=jayson['client'][_0xe916('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b1cb5,_0x106912,_0x1d9637){return new BPromise(function(_0x252a6f,_0x1cd480){return client[_0xe916('0xb')](_0x2b1cb5,_0x1d9637)[_0xe916('0xc')](function(_0x49fc2e){logger[_0xe916('0xd')](_0xe916('0xe'),_0x106912,_0xe916('0xf'));logger[_0xe916('0x10')](_0xe916('0x11'),_0x106912,'request\x20sent',JSON[_0xe916('0x12')](_0x49fc2e));if(_0x49fc2e[_0xe916('0x13')]){if(_0x49fc2e[_0xe916('0x13')]['code']===0x1f4){logger[_0xe916('0x13')](_0xe916('0xe'),_0x106912,_0x49fc2e[_0xe916('0x13')][_0xe916('0x14')]);return _0x1cd480(_0x49fc2e[_0xe916('0x13')][_0xe916('0x14')]);}logger['error'](_0xe916('0xe'),_0x106912,_0x49fc2e[_0xe916('0x13')]['message']);return _0x252a6f(_0x49fc2e[_0xe916('0x13')][_0xe916('0x14')]);}else{logger[_0xe916('0xd')](_0xe916('0xe'),_0x106912,_0xe916('0xf'));_0x252a6f(_0x49fc2e[_0xe916('0x15')][_0xe916('0x14')]);}})[_0xe916('0x16')](function(_0x393db1){logger[_0xe916('0x13')](_0xe916('0xe'),_0x106912,_0x393db1);_0x1cd480(_0x393db1);});});}exports['CreateFaxQueueReport']=function(_0x58f2ce){var _0x494a05=this;return new Promise(function(_0x467a77,_0x47e767){return db[_0xe916('0x17')][_0xe916('0x18')](_0x58f2ce['body'],{'raw':_0x58f2ce['options']?_0x58f2ce[_0xe916('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x8efc9d){logger[_0xe916('0xd')]('CreateFaxQueueReport',_0x58f2ce);logger[_0xe916('0x10')](_0xe916('0x1a'),_0x58f2ce,JSON['stringify'](_0x8efc9d));_0x467a77(_0x8efc9d);})['catch'](function(_0x345f4b){logger[_0xe916('0x13')](_0xe916('0x1a'),_0x345f4b[_0xe916('0x14')],_0x58f2ce);_0x47e767(_0x494a05['error'](0x1f4,_0x345f4b[_0xe916('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x4162bf){var _0x2c0faf=this;return new Promise(function(_0x13b0bd,_0x547a94){return db[_0xe916('0x17')][_0xe916('0x1b')](_0x4162bf[_0xe916('0x1c')],{'raw':_0x4162bf[_0xe916('0x19')]?_0x4162bf['options'][_0xe916('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4162bf['options']?_0x4162bf[_0xe916('0x19')][_0xe916('0x1e')]||null:null,'attributes':_0x4162bf[_0xe916('0x19')]?_0x4162bf['options'][_0xe916('0x1f')]||null:null,'limit':_0x4162bf[_0xe916('0x19')]?_0x4162bf[_0xe916('0x19')][_0xe916('0x20')]||null:null})[_0xe916('0xc')](function(_0x42d31f){logger['info'](_0xe916('0x21'),_0x4162bf);logger['debug'](_0xe916('0x21'),_0x4162bf,JSON[_0xe916('0x12')](_0x42d31f));_0x13b0bd(_0x42d31f);})[_0xe916('0x16')](function(_0x5e42b4){logger[_0xe916('0x13')]('UpdateFaxQueueReport',_0x5e42b4[_0xe916('0x14')],_0x4162bf);_0x547a94(_0x2c0faf[_0xe916('0x13')](0x1f4,_0x5e42b4[_0xe916('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 1cd660c..427ab44 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 _0x4d51=['describe','/:id','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get','/describe'];(function(_0x44a5e8,_0x5c6960){var _0x3e0e44=function(_0x18c1a6){while(--_0x18c1a6){_0x44a5e8['push'](_0x44a5e8['shift']());}};_0x3e0e44(++_0x5c6960);}(_0x4d51,0x16d));var _0x14d5=function(_0x2ad227,_0x2a61a3){_0x2ad227=_0x2ad227-0x0;var _0x7bdc60=_0x4d51[_0x2ad227];return _0x7bdc60;};'use strict';var multer=require(_0x14d5('0x0'));var util=require(_0x14d5('0x1'));var path=require('path');var timeout=require(_0x14d5('0x2'));var express=require(_0x14d5('0x3'));var router=express[_0x14d5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x14d5('0x5'));var interaction=require(_0x14d5('0x6'));var config=require(_0x14d5('0x7'));var controller=require(_0x14d5('0x8'));router['get']('/',auth[_0x14d5('0x9')](),controller[_0x14d5('0xa')]);router[_0x14d5('0xb')](_0x14d5('0xc'),auth[_0x14d5('0x9')](),controller[_0x14d5('0xd')]);router[_0x14d5('0xb')](_0x14d5('0xe'),auth[_0x14d5('0x9')](),controller['show']);router[_0x14d5('0xf')]('/',auth[_0x14d5('0x9')](),controller[_0x14d5('0x10')]);router[_0x14d5('0x11')](_0x14d5('0xe'),auth[_0x14d5('0x9')](),controller['update']);router[_0x14d5('0x12')](_0x14d5('0xe'),auth['isAuthenticated'](),controller[_0x14d5('0x13')]);module[_0x14d5('0x14')]=router; \ No newline at end of file +var _0x14bb=['fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/:id','show','post','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x327906,_0x279cad){var _0x14de57=function(_0x9d4d52){while(--_0x9d4d52){_0x327906['push'](_0x327906['shift']());}};_0x14de57(++_0x279cad);}(_0x14bb,0x79));var _0xb14b=function(_0x29d463,_0x3e8f7e){_0x29d463=_0x29d463-0x0;var _0x5772c9=_0x14bb[_0x29d463];return _0x5772c9;};'use strict';var multer=require(_0xb14b('0x0'));var util=require(_0xb14b('0x1'));var path=require(_0xb14b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb14b('0x3'));var router=express[_0xb14b('0x4')]();var fs_extra=require(_0xb14b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb14b('0x6'));var config=require(_0xb14b('0x7'));var controller=require(_0xb14b('0x8'));router[_0xb14b('0x9')]('/',auth[_0xb14b('0xa')](),controller['index']);router['get']('/describe',auth[_0xb14b('0xa')](),controller['describe']);router['get'](_0xb14b('0xb'),auth[_0xb14b('0xa')](),controller[_0xb14b('0xc')]);router[_0xb14b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb14b('0xe')]('/:id',auth[_0xb14b('0xa')](),controller[_0xb14b('0xf')]);router[_0xb14b('0x10')]('/:id',auth[_0xb14b('0xa')](),controller['destroy']);module[_0xb14b('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 0477eb1..a457801 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x49ffda,_0x45ae69){var _0x3960ea=function(_0x238fd5){while(--_0x238fd5){_0x49ffda['push'](_0x49ffda['shift']());}};_0x3960ea(++_0x45ae69);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x16dfb3,_0x1613fc){var _0x1d8030=function(_0x1bd5da){while(--_0x1bd5da){_0x16dfb3['push'](_0x16dfb3['shift']());}};_0x1d8030(++_0x1613fc);}(_0x34e8,0x12c));var _0x834e=function(_0x5aab30,_0xd2b6c1){_0x5aab30=_0x5aab30-0x0;var _0x236aa5=_0x34e8[_0x5aab30];return _0x236aa5;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 9251033..edf573d 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 _0xb4d8=['status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','error','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','then','catch','show','params','fields','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x4ebcf7,_0xc83add){var _0x16bfc9=function(_0x3cdf4a){while(--_0x3cdf4a){_0x4ebcf7['push'](_0x4ebcf7['shift']());}};_0x16bfc9(++_0xc83add);}(_0xb4d8,0x15d));var _0x8b4d=function(_0x4f8ed0,_0x4ee043){_0x4f8ed0=_0x4f8ed0-0x0;var _0x483e61=_0xb4d8[_0x4f8ed0];return _0x483e61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b4d('0x0'));var zipdir=require(_0x8b4d('0x1'));var jsonpatch=require(_0x8b4d('0x2'));var rp=require(_0x8b4d('0x3'));var moment=require(_0x8b4d('0x4'));var BPromise=require(_0x8b4d('0x5'));var Mustache=require(_0x8b4d('0x6'));var util=require(_0x8b4d('0x7'));var path=require(_0x8b4d('0x8'));var sox=require(_0x8b4d('0x9'));var csv=require(_0x8b4d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b4d('0xb'));var _=require(_0x8b4d('0xc'));var squel=require('squel');var crypto=require(_0x8b4d('0xd'));var jsforce=require(_0x8b4d('0xe'));var deskjs=require(_0x8b4d('0xf'));var toCsv=require(_0x8b4d('0xa'));var querystring=require(_0x8b4d('0x10'));var Papa=require(_0x8b4d('0x11'));var Redis=require(_0x8b4d('0x12'));var authService=require(_0x8b4d('0x13'));var qs=require(_0x8b4d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b4d('0x15'))('api');var utils=require(_0x8b4d('0x16'));var config=require(_0x8b4d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8b4d('0x18'))['db'];function respondWithStatusCode(_0x4b3b00,_0x41b150){_0x41b150=_0x41b150||0xcc;return function(_0x301c86){if(_0x301c86){return _0x4b3b00[_0x8b4d('0x19')](_0x41b150);}return _0x4b3b00[_0x8b4d('0x1a')](_0x41b150)['end']();};}function respondWithResult(_0x2a654c,_0xe6efd8){_0xe6efd8=_0xe6efd8||0xc8;return function(_0x13efd3){if(_0x13efd3){return _0x2a654c['status'](_0xe6efd8)[_0x8b4d('0x1b')](_0x13efd3);}};}function respondWithFilteredResult(_0xc4db09,_0x282246){return function(_0x407bf4){if(_0x407bf4){var _0x2fc971=typeof _0x282246[_0x8b4d('0x1c')]==='undefined'&&typeof _0x282246[_0x8b4d('0x1d')]===_0x8b4d('0x1e');var _0x57a06c=_0x407bf4[_0x8b4d('0x1f')];var _0x17e7ce=_0x2fc971?0x0:_0x282246['offset'];var _0x376324=_0x2fc971?_0x407bf4[_0x8b4d('0x1f')]:_0x282246[_0x8b4d('0x1c')]+_0x282246['limit'];var _0x2b6e45;if(_0x376324>=_0x57a06c){_0x376324=_0x57a06c;_0x2b6e45=0xc8;}else{_0x2b6e45=0xce;}_0xc4db09[_0x8b4d('0x1a')](_0x2b6e45);return _0xc4db09[_0x8b4d('0x20')](_0x8b4d('0x21'),_0x17e7ce+'-'+_0x376324+'/'+_0x57a06c)[_0x8b4d('0x1b')](_0x407bf4);}return null;};}function patchUpdates(_0x4a8287){return function(_0x13bb8e){try{jsonpatch[_0x8b4d('0x22')](_0x13bb8e,_0x4a8287,!![]);}catch(_0x8cbc88){return BPromise[_0x8b4d('0x23')](_0x8cbc88);}return _0x13bb8e[_0x8b4d('0x24')]();};}function saveUpdates(_0x5d5fdd,_0x240927){return function(_0xce1250){if(_0xce1250){return _0xce1250[_0x8b4d('0x25')](_0x5d5fdd)['then'](function(_0x204300){return _0x204300;});}return null;};}function removeEntity(_0x52fa8c,_0x30ca19){return function(_0x10a563){if(_0x10a563){return _0x10a563[_0x8b4d('0x26')]()['then'](function(){_0x52fa8c[_0x8b4d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x300d83,_0x2422a0){return function(_0x195a28){if(!_0x195a28){_0x300d83[_0x8b4d('0x19')](0x194);}return _0x195a28;};}function handleError(_0x4addb5,_0xd013e3){_0xd013e3=_0xd013e3||0x1f4;return function(_0x8b44a6){logger[_0x8b4d('0x27')](_0x8b44a6['stack']);if(_0x8b44a6[_0x8b4d('0x28')]){delete _0x8b44a6[_0x8b4d('0x28')];}_0x4addb5['status'](_0xd013e3)[_0x8b4d('0x29')](_0x8b44a6);};}exports[_0x8b4d('0x2a')]=function(_0x235745,_0x392e){var _0x2bfccc={},_0x2f756b={},_0x49707e={'count':0x0,'rows':[]};var _0x3ee841=_[_0x8b4d('0x2b')](db[_0x8b4d('0x2c')][_0x8b4d('0x2d')],function(_0x20c902){return{'name':_0x20c902[_0x8b4d('0x2e')],'type':_0x20c902['type']['key']};});_0x2f756b[_0x8b4d('0x2f')]=_[_0x8b4d('0x2b')](_0x3ee841,_0x8b4d('0x28'));_0x2f756b[_0x8b4d('0x30')]=_[_0x8b4d('0x31')](_0x235745[_0x8b4d('0x30')]);_0x2f756b[_0x8b4d('0x32')]=_[_0x8b4d('0x33')](_0x2f756b[_0x8b4d('0x2f')],_0x2f756b[_0x8b4d('0x30')]);_0x2bfccc[_0x8b4d('0x34')]=_[_0x8b4d('0x33')](_0x2f756b['model'],qs['fields'](_0x235745[_0x8b4d('0x30')]['fields']));_0x2bfccc[_0x8b4d('0x34')]=_0x2bfccc[_0x8b4d('0x34')][_0x8b4d('0x35')]?_0x2bfccc[_0x8b4d('0x34')]:_0x2f756b['model'];if(!_0x235745[_0x8b4d('0x30')]['hasOwnProperty'](_0x8b4d('0x36'))){_0x2bfccc['limit']=qs[_0x8b4d('0x1d')](_0x235745[_0x8b4d('0x30')][_0x8b4d('0x1d')]);_0x2bfccc[_0x8b4d('0x1c')]=qs[_0x8b4d('0x1c')](_0x235745[_0x8b4d('0x30')][_0x8b4d('0x1c')]);}_0x2bfccc['order']=qs[_0x8b4d('0x37')](_0x235745['query'][_0x8b4d('0x37')]);_0x2bfccc[_0x8b4d('0x38')]=qs[_0x8b4d('0x32')](_[_0x8b4d('0x39')](_0x235745[_0x8b4d('0x30')],_0x2f756b['filters']),_0x3ee841);if(_0x235745['query'][_0x8b4d('0x3a')]){_0x2bfccc[_0x8b4d('0x38')]=_[_0x8b4d('0x3b')](_0x2bfccc[_0x8b4d('0x38')],{'$or':_[_0x8b4d('0x2b')](_0x3ee841,function(_0x4918f8){if(_0x4918f8[_0x8b4d('0x3c')]!==_0x8b4d('0x3d')){var _0x205b5a={};_0x205b5a[_0x4918f8[_0x8b4d('0x28')]]={'$like':'%'+_0x235745[_0x8b4d('0x30')][_0x8b4d('0x3a')]+'%'};return _0x205b5a;}})});}_0x2bfccc=_[_0x8b4d('0x3b')]({},_0x2bfccc,_0x235745[_0x8b4d('0x3e')]);var _0xcd1de6={'where':_0x2bfccc[_0x8b4d('0x38')]};return db[_0x8b4d('0x2c')]['count'](_0xcd1de6)['then'](function(_0x35fb7f){_0x49707e['count']=_0x35fb7f;if(_0x235745[_0x8b4d('0x30')][_0x8b4d('0x3f')]){_0x2bfccc[_0x8b4d('0x40')]=[{'all':!![]}];}return db[_0x8b4d('0x2c')][_0x8b4d('0x41')](_0x2bfccc);})[_0x8b4d('0x42')](function(_0xbc5ea6){_0x49707e['rows']=_0xbc5ea6;return _0x49707e;})[_0x8b4d('0x42')](respondWithFilteredResult(_0x392e,_0x2bfccc))[_0x8b4d('0x43')](handleError(_0x392e,null));};exports[_0x8b4d('0x44')]=function(_0x10ed71,_0x5e022a){var _0x2cc2b2={'raw':!![],'where':{'id':_0x10ed71[_0x8b4d('0x45')]['id']}},_0x58a27f={};_0x58a27f[_0x8b4d('0x2f')]=_[_0x8b4d('0x31')](db[_0x8b4d('0x2c')][_0x8b4d('0x2d')]);_0x58a27f['query']=_[_0x8b4d('0x31')](_0x10ed71[_0x8b4d('0x30')]);_0x58a27f['filters']=_[_0x8b4d('0x33')](_0x58a27f[_0x8b4d('0x2f')],_0x58a27f[_0x8b4d('0x30')]);_0x2cc2b2['attributes']=_[_0x8b4d('0x33')](_0x58a27f['model'],qs[_0x8b4d('0x46')](_0x10ed71[_0x8b4d('0x30')][_0x8b4d('0x46')]));_0x2cc2b2[_0x8b4d('0x34')]=_0x2cc2b2[_0x8b4d('0x34')][_0x8b4d('0x35')]?_0x2cc2b2[_0x8b4d('0x34')]:_0x58a27f[_0x8b4d('0x2f')];if(_0x10ed71[_0x8b4d('0x30')][_0x8b4d('0x3f')]){_0x2cc2b2[_0x8b4d('0x40')]=[{'all':!![]}];}_0x2cc2b2=_['merge']({},_0x2cc2b2,_0x10ed71[_0x8b4d('0x3e')]);return db[_0x8b4d('0x2c')][_0x8b4d('0x47')](_0x2cc2b2)[_0x8b4d('0x42')](handleEntityNotFound(_0x5e022a,null))[_0x8b4d('0x42')](respondWithResult(_0x5e022a,null))[_0x8b4d('0x43')](handleError(_0x5e022a,null));};exports['create']=function(_0x403691,_0x88588e){return db[_0x8b4d('0x2c')][_0x8b4d('0x48')](_0x403691[_0x8b4d('0x49')],{})[_0x8b4d('0x42')](respondWithResult(_0x88588e,0xc9))[_0x8b4d('0x43')](handleError(_0x88588e,null));};exports[_0x8b4d('0x25')]=function(_0x36e376,_0x25890d){if(_0x36e376[_0x8b4d('0x49')]['id']){delete _0x36e376[_0x8b4d('0x49')]['id'];}return db[_0x8b4d('0x2c')][_0x8b4d('0x47')]({'where':{'id':_0x36e376[_0x8b4d('0x45')]['id']}})[_0x8b4d('0x42')](handleEntityNotFound(_0x25890d,null))[_0x8b4d('0x42')](saveUpdates(_0x36e376[_0x8b4d('0x49')],null))['then'](respondWithResult(_0x25890d,null))['catch'](handleError(_0x25890d,null));};exports[_0x8b4d('0x26')]=function(_0x233d6f,_0x327d36){return db[_0x8b4d('0x2c')]['find']({'where':{'id':_0x233d6f[_0x8b4d('0x45')]['id']}})[_0x8b4d('0x42')](handleEntityNotFound(_0x327d36,null))['then'](removeEntity(_0x327d36,null))['catch'](handleError(_0x327d36,null));};exports[_0x8b4d('0x4a')]=function(_0x523d0a,_0x35c33d){return db['FaxTransferReport'][_0x8b4d('0x4a')]()[_0x8b4d('0x42')](respondWithResult(_0x35c33d,null))['catch'](handleError(_0x35c33d,null));}; \ No newline at end of file +var _0x3cf1=['describe','eml-format','zip-dir','request-promise','mustache','path','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','map','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','find','create','body'];(function(_0x54a3a0,_0x229245){var _0x625183=function(_0x176b00){while(--_0x176b00){_0x54a3a0['push'](_0x54a3a0['shift']());}};_0x625183(++_0x229245);}(_0x3cf1,0x193));var _0x13cf=function(_0x42389a,_0x33deb6){_0x42389a=_0x42389a-0x0;var _0x4d3de9=_0x3cf1[_0x42389a];return _0x4d3de9;};'use strict';var emlformat=require(_0x13cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x13cf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x13cf('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x13cf('0x3'));var util=require('util');var path=require(_0x13cf('0x4'));var sox=require('sox');var csv=require(_0x13cf('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13cf('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x13cf('0x7'));var jsforce=require(_0x13cf('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x13cf('0x5'));var querystring=require(_0x13cf('0x9'));var Papa=require(_0x13cf('0xa'));var Redis=require('ioredis');var authService=require(_0x13cf('0xb'));var qs=require(_0x13cf('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x13cf('0xd'));var config=require(_0x13cf('0xe'));var licenseUtil=require(_0x13cf('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbeeba8,_0x597a74){_0x597a74=_0x597a74||0xcc;return function(_0x269d58){if(_0x269d58){return _0xbeeba8[_0x13cf('0x10')](_0x597a74);}return _0xbeeba8[_0x13cf('0x11')](_0x597a74)[_0x13cf('0x12')]();};}function respondWithResult(_0x2d91a1,_0x33e490){_0x33e490=_0x33e490||0xc8;return function(_0x3778b8){if(_0x3778b8){return _0x2d91a1[_0x13cf('0x11')](_0x33e490)[_0x13cf('0x13')](_0x3778b8);}};}function respondWithFilteredResult(_0x6e7723,_0x1cb7ff){return function(_0x5a9c7d){if(_0x5a9c7d){var _0x18e9c7=typeof _0x1cb7ff[_0x13cf('0x14')]===_0x13cf('0x15')&&typeof _0x1cb7ff[_0x13cf('0x16')]===_0x13cf('0x15');var _0x37a864=_0x5a9c7d[_0x13cf('0x17')];var _0x12ecd6=_0x18e9c7?0x0:_0x1cb7ff[_0x13cf('0x14')];var _0x5bdba8=_0x18e9c7?_0x5a9c7d[_0x13cf('0x17')]:_0x1cb7ff[_0x13cf('0x14')]+_0x1cb7ff[_0x13cf('0x16')];var _0x20f148;if(_0x5bdba8>=_0x37a864){_0x5bdba8=_0x37a864;_0x20f148=0xc8;}else{_0x20f148=0xce;}_0x6e7723['status'](_0x20f148);return _0x6e7723[_0x13cf('0x18')](_0x13cf('0x19'),_0x12ecd6+'-'+_0x5bdba8+'/'+_0x37a864)['json'](_0x5a9c7d);}return null;};}function patchUpdates(_0xa00010){return function(_0x42b821){try{jsonpatch[_0x13cf('0x1a')](_0x42b821,_0xa00010,!![]);}catch(_0x544c30){return BPromise[_0x13cf('0x1b')](_0x544c30);}return _0x42b821[_0x13cf('0x1c')]();};}function saveUpdates(_0x204a9d,_0xc90ad){return function(_0x5edf57){if(_0x5edf57){return _0x5edf57['update'](_0x204a9d)[_0x13cf('0x1d')](function(_0x540604){return _0x540604;});}return null;};}function removeEntity(_0x4f09f4,_0x9ec13b){return function(_0x2b89db){if(_0x2b89db){return _0x2b89db[_0x13cf('0x1e')]()['then'](function(){_0x4f09f4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4753ab,_0x5c9b58){return function(_0x23dc66){if(!_0x23dc66){_0x4753ab[_0x13cf('0x10')](0x194);}return _0x23dc66;};}function handleError(_0x3eda55,_0x57d3a7){_0x57d3a7=_0x57d3a7||0x1f4;return function(_0x15774e){logger[_0x13cf('0x1f')](_0x15774e[_0x13cf('0x20')]);if(_0x15774e['name']){delete _0x15774e['name'];}_0x3eda55['status'](_0x57d3a7)['send'](_0x15774e);};}exports[_0x13cf('0x21')]=function(_0x409ffd,_0x4ebb99){var _0x2b4667={},_0x14d5f4={},_0x1ddf29={'count':0x0,'rows':[]};var _0x31a2e6=_['map'](db[_0x13cf('0x22')][_0x13cf('0x23')],function(_0x123814){return{'name':_0x123814[_0x13cf('0x24')],'type':_0x123814[_0x13cf('0x25')][_0x13cf('0x26')]};});_0x14d5f4[_0x13cf('0x27')]=_[_0x13cf('0x28')](_0x31a2e6,_0x13cf('0x29'));_0x14d5f4['query']=_['keys'](_0x409ffd[_0x13cf('0x2a')]);_0x14d5f4['filters']=_[_0x13cf('0x2b')](_0x14d5f4[_0x13cf('0x27')],_0x14d5f4[_0x13cf('0x2a')]);_0x2b4667[_0x13cf('0x2c')]=_[_0x13cf('0x2b')](_0x14d5f4[_0x13cf('0x27')],qs[_0x13cf('0x2d')](_0x409ffd['query']['fields']));_0x2b4667[_0x13cf('0x2c')]=_0x2b4667[_0x13cf('0x2c')][_0x13cf('0x2e')]?_0x2b4667[_0x13cf('0x2c')]:_0x14d5f4[_0x13cf('0x27')];if(!_0x409ffd[_0x13cf('0x2a')][_0x13cf('0x2f')](_0x13cf('0x30'))){_0x2b4667[_0x13cf('0x16')]=qs[_0x13cf('0x16')](_0x409ffd[_0x13cf('0x2a')][_0x13cf('0x16')]);_0x2b4667['offset']=qs[_0x13cf('0x14')](_0x409ffd[_0x13cf('0x2a')]['offset']);}_0x2b4667['order']=qs[_0x13cf('0x31')](_0x409ffd[_0x13cf('0x2a')][_0x13cf('0x31')]);_0x2b4667[_0x13cf('0x32')]=qs['filters'](_[_0x13cf('0x33')](_0x409ffd[_0x13cf('0x2a')],_0x14d5f4[_0x13cf('0x34')]),_0x31a2e6);if(_0x409ffd[_0x13cf('0x2a')][_0x13cf('0x35')]){_0x2b4667[_0x13cf('0x32')]=_[_0x13cf('0x36')](_0x2b4667['where'],{'$or':_['map'](_0x31a2e6,function(_0x2882a8){if(_0x2882a8['type']!==_0x13cf('0x37')){var _0x1d8f17={};_0x1d8f17[_0x2882a8[_0x13cf('0x29')]]={'$like':'%'+_0x409ffd['query'][_0x13cf('0x35')]+'%'};return _0x1d8f17;}})});}_0x2b4667=_[_0x13cf('0x36')]({},_0x2b4667,_0x409ffd['options']);var _0x3d8e14={'where':_0x2b4667[_0x13cf('0x32')]};return db[_0x13cf('0x22')][_0x13cf('0x17')](_0x3d8e14)[_0x13cf('0x1d')](function(_0x572744){_0x1ddf29[_0x13cf('0x17')]=_0x572744;if(_0x409ffd[_0x13cf('0x2a')][_0x13cf('0x38')]){_0x2b4667[_0x13cf('0x39')]=[{'all':!![]}];}return db[_0x13cf('0x22')][_0x13cf('0x3a')](_0x2b4667);})['then'](function(_0xfdfa22){_0x1ddf29[_0x13cf('0x3b')]=_0xfdfa22;return _0x1ddf29;})[_0x13cf('0x1d')](respondWithFilteredResult(_0x4ebb99,_0x2b4667))[_0x13cf('0x3c')](handleError(_0x4ebb99,null));};exports['show']=function(_0x5598a7,_0x2f57ce){var _0x3474da={'raw':!![],'where':{'id':_0x5598a7[_0x13cf('0x3d')]['id']}},_0x59011b={};_0x59011b[_0x13cf('0x27')]=_[_0x13cf('0x3e')](db[_0x13cf('0x22')][_0x13cf('0x23')]);_0x59011b[_0x13cf('0x2a')]=_['keys'](_0x5598a7[_0x13cf('0x2a')]);_0x59011b['filters']=_[_0x13cf('0x2b')](_0x59011b[_0x13cf('0x27')],_0x59011b[_0x13cf('0x2a')]);_0x3474da[_0x13cf('0x2c')]=_[_0x13cf('0x2b')](_0x59011b[_0x13cf('0x27')],qs['fields'](_0x5598a7['query'][_0x13cf('0x2d')]));_0x3474da[_0x13cf('0x2c')]=_0x3474da[_0x13cf('0x2c')]['length']?_0x3474da[_0x13cf('0x2c')]:_0x59011b[_0x13cf('0x27')];if(_0x5598a7['query']['includeAll']){_0x3474da['include']=[{'all':!![]}];}_0x3474da=_[_0x13cf('0x36')]({},_0x3474da,_0x5598a7['options']);return db['FaxTransferReport'][_0x13cf('0x3f')](_0x3474da)[_0x13cf('0x1d')](handleEntityNotFound(_0x2f57ce,null))[_0x13cf('0x1d')](respondWithResult(_0x2f57ce,null))[_0x13cf('0x3c')](handleError(_0x2f57ce,null));};exports[_0x13cf('0x40')]=function(_0x56f544,_0x125849){return db[_0x13cf('0x22')]['create'](_0x56f544[_0x13cf('0x41')],{})[_0x13cf('0x1d')](respondWithResult(_0x125849,0xc9))['catch'](handleError(_0x125849,null));};exports['update']=function(_0x4e491c,_0xdb92db){if(_0x4e491c[_0x13cf('0x41')]['id']){delete _0x4e491c[_0x13cf('0x41')]['id'];}return db[_0x13cf('0x22')][_0x13cf('0x3f')]({'where':{'id':_0x4e491c['params']['id']}})[_0x13cf('0x1d')](handleEntityNotFound(_0xdb92db,null))[_0x13cf('0x1d')](saveUpdates(_0x4e491c[_0x13cf('0x41')],null))[_0x13cf('0x1d')](respondWithResult(_0xdb92db,null))[_0x13cf('0x3c')](handleError(_0xdb92db,null));};exports[_0x13cf('0x1e')]=function(_0x1fade5,_0x56ca77){return db[_0x13cf('0x22')][_0x13cf('0x3f')]({'where':{'id':_0x1fade5[_0x13cf('0x3d')]['id']}})['then'](handleEntityNotFound(_0x56ca77,null))['then'](removeEntity(_0x56ca77,null))[_0x13cf('0x3c')](handleError(_0x56ca77,null));};exports[_0x13cf('0x42')]=function(_0x5ac306,_0x1dae9b){return db[_0x13cf('0x22')][_0x13cf('0x42')]()[_0x13cf('0x1d')](respondWithResult(_0x1dae9b,null))['catch'](handleError(_0x1dae9b,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 2cb38fa..95b8e14 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 _0x6000=['moment','bluebird','path','rimraf','./faxTransferReport.attributes','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x21f70a,_0x228d58){var _0xdf92b1=function(_0x38985e){while(--_0x38985e){_0x21f70a['push'](_0x21f70a['shift']());}};_0xdf92b1(++_0x228d58);}(_0x6000,0x17c));var _0x0600=function(_0x357334,_0x57c1f7){_0x357334=_0x357334-0x0;var _0x490778=_0x6000[_0x357334];return _0x490778;};'use strict';var _=require(_0x0600('0x0'));var util=require(_0x0600('0x1'));var logger=require(_0x0600('0x2'))(_0x0600('0x3'));var moment=require(_0x0600('0x4'));var BPromise=require(_0x0600('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0600('0x6'));var rimraf=require(_0x0600('0x7'));var config=require('../../config/environment');var attributes=require(_0x0600('0x8'));module['exports']=function(_0x38f630,_0xc18208){return _0x38f630[_0x0600('0x9')]('FaxTransferReport',attributes,{'tableName':_0x0600('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0600('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x340e=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','define'];(function(_0x2ed96a,_0x1c3d27){var _0x58efae=function(_0x23ae4c){while(--_0x23ae4c){_0x2ed96a['push'](_0x2ed96a['shift']());}};_0x58efae(++_0x1c3d27);}(_0x340e,0x1dc));var _0xe340=function(_0x374328,_0xfedbb4){_0x374328=_0x374328-0x0;var _0x101f88=_0x340e[_0x374328];return _0x101f88;};'use strict';var _=require(_0xe340('0x0'));var util=require('util');var logger=require(_0xe340('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe340('0x2'));var rp=require(_0xe340('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe340('0x4'));var config=require(_0xe340('0x5'));var attributes=require(_0xe340('0x6'));module['exports']=function(_0x3fedb8,_0x538fb9){return _0x3fedb8[_0xe340('0x7')](_0xe340('0x8'),attributes,{'tableName':_0xe340('0x9'),'paranoid':![],'indexes':[{'name':_0xe340('0xa'),'fields':[_0xe340('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 4500c39..9a70b9f 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 _0x99b2=['error','code','FaxTransferReport,\x20%s,\x20%s','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','request\x20sent'];(function(_0xbbc163,_0x202519){var _0x33a016=function(_0x2b3d9d){while(--_0x2b3d9d){_0xbbc163['push'](_0xbbc163['shift']());}};_0x33a016(++_0x202519);}(_0x99b2,0xa5));var _0x299b=function(_0x16decb,_0x118870){_0x16decb=_0x16decb-0x0;var _0x2f3d1d=_0x99b2[_0x16decb];return _0x2f3d1d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x299b('0x0'));var rs=require(_0x299b('0x1'));var fs=require('fs');var Redis=require(_0x299b('0x2'));var db=require(_0x299b('0x3'))['db'];var utils=require(_0x299b('0x4'));var logger=require(_0x299b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x299b('0x6')][_0x299b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4049e0,_0x58f73c,_0x369d5c){return new BPromise(function(_0xe0bbaf,_0x431608){return client[_0x299b('0x8')](_0x4049e0,_0x369d5c)[_0x299b('0x9')](function(_0x26cf0f){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x58f73c,_0x299b('0xa'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x58f73c,'request\x20sent',JSON['stringify'](_0x26cf0f));if(_0x26cf0f[_0x299b('0xb')]){if(_0x26cf0f[_0x299b('0xb')][_0x299b('0xc')]===0x1f4){logger['error'](_0x299b('0xd'),_0x58f73c,_0x26cf0f[_0x299b('0xb')]['message']);return _0x431608(_0x26cf0f[_0x299b('0xb')][_0x299b('0xe')]);}logger[_0x299b('0xb')](_0x299b('0xd'),_0x58f73c,_0x26cf0f[_0x299b('0xb')][_0x299b('0xe')]);return _0xe0bbaf(_0x26cf0f[_0x299b('0xb')][_0x299b('0xe')]);}else{logger['info'](_0x299b('0xd'),_0x58f73c,'request\x20sent');_0xe0bbaf(_0x26cf0f['result'][_0x299b('0xe')]);}})[_0x299b('0xf')](function(_0x55a224){logger[_0x299b('0xb')](_0x299b('0xd'),_0x58f73c,_0x55a224);_0x431608(_0x55a224);});});} \ No newline at end of file +var _0x6eae=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0xc4e62c,_0x5b226e){var _0x44c950=function(_0x3c1298){while(--_0x3c1298){_0xc4e62c['push'](_0xc4e62c['shift']());}};_0x44c950(++_0x5b226e);}(_0x6eae,0x91));var _0xe6ea=function(_0x7edec0,_0x4a74fd){_0x7edec0=_0x7edec0-0x0;var _0x1553fb=_0x6eae[_0x7edec0];return _0x1553fb;};'use strict';var _=require(_0xe6ea('0x0'));var util=require(_0xe6ea('0x1'));var moment=require(_0xe6ea('0x2'));var BPromise=require(_0xe6ea('0x3'));var rs=require(_0xe6ea('0x4'));var fs=require('fs');var Redis=require(_0xe6ea('0x5'));var db=require(_0xe6ea('0x6'))['db'];var utils=require(_0xe6ea('0x7'));var logger=require(_0xe6ea('0x8'))(_0xe6ea('0x9'));var config=require('../../config/environment');var jayson=require(_0xe6ea('0xa'));var client=jayson['client'][_0xe6ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17b887,_0x40c7dd,_0x31aec5){return new BPromise(function(_0x201d32,_0x253397){return client[_0xe6ea('0xc')](_0x17b887,_0x31aec5)[_0xe6ea('0xd')](function(_0xb981aa){logger['info'](_0xe6ea('0xe'),_0x40c7dd,_0xe6ea('0xf'));logger[_0xe6ea('0x10')](_0xe6ea('0x11'),_0x40c7dd,_0xe6ea('0xf'),JSON['stringify'](_0xb981aa));if(_0xb981aa[_0xe6ea('0x12')]){if(_0xb981aa['error'][_0xe6ea('0x13')]===0x1f4){logger[_0xe6ea('0x12')](_0xe6ea('0xe'),_0x40c7dd,_0xb981aa['error'][_0xe6ea('0x14')]);return _0x253397(_0xb981aa['error'][_0xe6ea('0x14')]);}logger[_0xe6ea('0x12')](_0xe6ea('0xe'),_0x40c7dd,_0xb981aa[_0xe6ea('0x12')]['message']);return _0x201d32(_0xb981aa[_0xe6ea('0x12')][_0xe6ea('0x14')]);}else{logger[_0xe6ea('0x15')]('FaxTransferReport,\x20%s,\x20%s',_0x40c7dd,_0xe6ea('0xf'));_0x201d32(_0xb981aa[_0xe6ea('0x16')]['message']);}})[_0xe6ea('0x17')](function(_0x1fe390){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x40c7dd,_0x1fe390);_0x253397(_0x1fe390);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 516ba20..423e16a 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 _0x815e=['/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','describe'];(function(_0x148f4c,_0x3eb8da){var _0x2c99dd=function(_0x45ed96){while(--_0x45ed96){_0x148f4c['push'](_0x148f4c['shift']());}};_0x2c99dd(++_0x3eb8da);}(_0x815e,0x16d));var _0xe815=function(_0x215b5d,_0x36c6f9){_0x215b5d=_0x215b5d-0x0;var _0x35cc48=_0x815e[_0x215b5d];return _0x35cc48;};'use strict';var multer=require('multer');var util=require(_0xe815('0x0'));var path=require('path');var timeout=require(_0xe815('0x1'));var express=require(_0xe815('0x2'));var router=express[_0xe815('0x3')]();var fs_extra=require(_0xe815('0x4'));var auth=require(_0xe815('0x5'));var interaction=require(_0xe815('0x6'));var config=require(_0xe815('0x7'));var controller=require(_0xe815('0x8'));router['get']('/',auth[_0xe815('0x9')](),controller[_0xe815('0xa')]);router[_0xe815('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xe815('0xc')]);router[_0xe815('0xb')](_0xe815('0xd'),auth['isAuthenticated'](),controller[_0xe815('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe815('0xf')]);router[_0xe815('0x10')](_0xe815('0xd'),auth['isAuthenticated'](),controller[_0xe815('0x11')]);router[_0xe815('0x12')](_0xe815('0xd'),auth['isAuthenticated'](),controller[_0xe815('0x13')]);module[_0xe815('0x14')]=router; \ No newline at end of file +var _0x6480=['post','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show'];(function(_0x435f2d,_0x1843f9){var _0x5992a7=function(_0x42d25e){while(--_0x42d25e){_0x435f2d['push'](_0x435f2d['shift']());}};_0x5992a7(++_0x1843f9);}(_0x6480,0x1ea));var _0x0648=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6480[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0648('0x0'));var util=require('util');var path=require(_0x0648('0x1'));var timeout=require(_0x0648('0x2'));var express=require(_0x0648('0x3'));var router=express[_0x0648('0x4')]();var fs_extra=require(_0x0648('0x5'));var auth=require(_0x0648('0x6'));var interaction=require(_0x0648('0x7'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0x0648('0x8')]('/',auth['isAuthenticated'](),controller[_0x0648('0x9')]);router[_0x0648('0x8')](_0x0648('0xa'),auth[_0x0648('0xb')](),controller[_0x0648('0xc')]);router[_0x0648('0x8')]('/:id',auth[_0x0648('0xb')](),controller[_0x0648('0xd')]);router[_0x0648('0xe')]('/',auth[_0x0648('0xb')](),controller[_0x0648('0xf')]);router['put'](_0x0648('0x10'),auth['isAuthenticated'](),controller[_0x0648('0x11')]);router[_0x0648('0x12')](_0x0648('0x10'),auth[_0x0648('0xb')](),controller[_0x0648('0x13')]);module[_0x0648('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 67e5cef..0edcb96 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 _0x2edf=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','/:id','destroy','multer','util','path','fs-extra'];(function(_0x2bb7c9,_0xe1e480){var _0x11cf13=function(_0x516d0f){while(--_0x516d0f){_0x2bb7c9['push'](_0x2bb7c9['shift']());}};_0x11cf13(++_0xe1e480);}(_0x2edf,0x94));var _0xf2ed=function(_0x3cae30,_0x5d8b99){_0x3cae30=_0x3cae30-0x0;var _0x263f77=_0x2edf[_0x3cae30];return _0x263f77;};'use strict';var multer=require(_0xf2ed('0x0'));var util=require(_0xf2ed('0x1'));var path=require(_0xf2ed('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xf2ed('0x3'));var auth=require(_0xf2ed('0x4'));var interaction=require(_0xf2ed('0x5'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0xf2ed('0x6')]('/',auth[_0xf2ed('0x7')](),controller['index']);router[_0xf2ed('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xf2ed('0x8')]);router['get'](_0xf2ed('0x9'),auth[_0xf2ed('0x7')](),controller[_0xf2ed('0xa')]);router[_0xf2ed('0x6')](_0xf2ed('0xb'),auth['isAuthenticated'](),controller[_0xf2ed('0xc')]);router[_0xf2ed('0xd')]('/',auth['isAuthenticated'](),controller[_0xf2ed('0xe')]);router['post'](_0xf2ed('0x9'),auth[_0xf2ed('0x7')](),controller[_0xf2ed('0xf')]);router['put']('/:id',auth[_0xf2ed('0x7')](),controller[_0xf2ed('0x10')]);router['delete'](_0xf2ed('0x11'),auth[_0xf2ed('0x7')](),controller[_0xf2ed('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5284=['getConfigurations','post','create','addConfiguration','put','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5b1df5,_0x25e738){var _0x158df4=function(_0x63a762){while(--_0x63a762){_0x5b1df5['push'](_0x5b1df5['shift']());}};_0x158df4(++_0x25e738);}(_0x5284,0x14a));var _0x4528=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5284[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x4528('0x0'));var util=require(_0x4528('0x1'));var path=require(_0x4528('0x2'));var timeout=require('connect-timeout');var express=require(_0x4528('0x3'));var router=express[_0x4528('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4528('0x5'));var config=require('../../config/environment');var controller=require(_0x4528('0x6'));router[_0x4528('0x7')]('/',auth[_0x4528('0x8')](),controller[_0x4528('0x9')]);router[_0x4528('0x7')](_0x4528('0xa'),auth[_0x4528('0x8')](),controller[_0x4528('0xb')]);router[_0x4528('0x7')]('/:id/configurations',auth[_0x4528('0x8')](),controller[_0x4528('0xc')]);router[_0x4528('0x7')]('/:id/fields',auth[_0x4528('0x8')](),controller['getFields']);router[_0x4528('0xd')]('/',auth[_0x4528('0x8')](),controller[_0x4528('0xe')]);router[_0x4528('0xd')]('/:id/configurations',auth[_0x4528('0x8')](),controller[_0x4528('0xf')]);router[_0x4528('0x10')](_0x4528('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4528('0x11')](_0x4528('0xa'),auth[_0x4528('0x8')](),controller[_0x4528('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index ad0506a..0d3ff0d 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 _0xea4e=['STRING','ENUM','basic','integrationTab','newTab'];(function(_0x219630,_0x374356){var _0x24b3ec=function(_0x2c4db5){while(--_0x2c4db5){_0x219630['push'](_0x219630['shift']());}};_0x24b3ec(++_0x374356);}(_0xea4e,0x8c));var _0xeea4=function(_0x54e333,_0x4ba478){_0x54e333=_0x54e333-0x0;var _0x47279e=_0xea4e[_0x54e333];return _0x47279e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeea4('0x0')]},'username':{'type':Sequelize[_0xeea4('0x0')]},'remoteUri':{'type':Sequelize[_0xeea4('0x0')]},'authType':{'type':Sequelize[_0xeea4('0x1')](_0xeea4('0x2')),'defaultValue':_0xeea4('0x2')},'password':{'type':Sequelize[_0xeea4('0x0')]},'consumerKey':{'type':Sequelize[_0xeea4('0x0')]},'consumerSecret':{'type':Sequelize[_0xeea4('0x0')]},'token':{'type':Sequelize[_0xeea4('0x0')]},'tokenSecret':{'type':Sequelize[_0xeea4('0x0')]},'serverUrl':{'type':Sequelize[_0xeea4('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xeea4('0x1')](_0xeea4('0x3'),_0xeea4('0x4')),'defaultValue':_0xeea4('0x3')}}; \ No newline at end of file +var _0xf9e7=['integrationTab','sequelize','exports','STRING','ENUM','basic','newTab'];(function(_0x1274c6,_0x2f7a97){var _0x113344=function(_0x4a4bee){while(--_0x4a4bee){_0x1274c6['push'](_0x1274c6['shift']());}};_0x113344(++_0x2f7a97);}(_0xf9e7,0x112));var _0x7f9e=function(_0x59a098,_0x2064c1){_0x59a098=_0x59a098-0x0;var _0x5d56dd=_0xf9e7[_0x59a098];return _0x5d56dd;};'use strict';var Sequelize=require(_0x7f9e('0x0'));module[_0x7f9e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7f9e('0x2')]},'username':{'type':Sequelize[_0x7f9e('0x2')]},'remoteUri':{'type':Sequelize[_0x7f9e('0x2')]},'authType':{'type':Sequelize[_0x7f9e('0x3')](_0x7f9e('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x7f9e('0x2')]},'consumerKey':{'type':Sequelize[_0x7f9e('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x7f9e('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7f9e('0x3')]('integrationTab',_0x7f9e('0x5')),'defaultValue':_0x7f9e('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index d9fe7ca..2610c28 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 _0x3687=['channel','Descriptions','getDescriptions','Subjects','getFields','priority','remoteUri','username','password','consumerSecret','slice','substring','GET','format','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','base64','concat','_embedded','label','statusCode','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','name','send','DeskAccount','rawAttributes','type','key','map','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','create','body','find','getConfigurations','findOne','DeskConfiguration','order','getSubjects'];(function(_0x1016e0,_0x15660b){var _0x9cb5c9=function(_0x54a2ab){while(--_0x54a2ab){_0x1016e0['push'](_0x1016e0['shift']());}};_0x9cb5c9(++_0x15660b);}(_0x3687,0x1cc));var _0x7368=function(_0x4cdabb,_0x4821ff){_0x4cdabb=_0x4cdabb-0x0;var _0x10e14c=_0x3687[_0x4cdabb];return _0x10e14c;};'use strict';var emlformat=require(_0x7368('0x0'));var rimraf=require(_0x7368('0x1'));var zipdir=require(_0x7368('0x2'));var jsonpatch=require(_0x7368('0x3'));var rp=require(_0x7368('0x4'));var moment=require(_0x7368('0x5'));var BPromise=require(_0x7368('0x6'));var Mustache=require('mustache');var util=require(_0x7368('0x7'));var path=require(_0x7368('0x8'));var sox=require('sox');var csv=require(_0x7368('0x9'));var ejs=require(_0x7368('0xa'));var fs=require('fs');var fs_extra=require(_0x7368('0xb'));var _=require(_0x7368('0xc'));var squel=require(_0x7368('0xd'));var crypto=require(_0x7368('0xe'));var jsforce=require(_0x7368('0xf'));var deskjs=require(_0x7368('0x10'));var toCsv=require(_0x7368('0x9'));var querystring=require(_0x7368('0x11'));var Papa=require('papaparse');var Redis=require(_0x7368('0x12'));var authService=require(_0x7368('0x13'));var qs=require(_0x7368('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7368('0x15'));var logger=require(_0x7368('0x16'))('api');var utils=require(_0x7368('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7368('0x18'))['db'];var integrations=require(_0x7368('0x19'));function respondWithStatusCode(_0x587f2f,_0x133ede){_0x133ede=_0x133ede||0xcc;return function(_0x33a556){if(_0x33a556){return _0x587f2f[_0x7368('0x1a')](_0x133ede);}return _0x587f2f[_0x7368('0x1b')](_0x133ede)[_0x7368('0x1c')]();};}function respondWithResult(_0x21dc5d,_0x3c84fd){_0x3c84fd=_0x3c84fd||0xc8;return function(_0x30c4dc){if(_0x30c4dc){return _0x21dc5d[_0x7368('0x1b')](_0x3c84fd)[_0x7368('0x1d')](_0x30c4dc);}};}function respondWithFilteredResult(_0x555e56,_0x226dae){return function(_0x2165eb){if(_0x2165eb){var _0x5d5c4f=typeof _0x226dae[_0x7368('0x1e')]===_0x7368('0x1f')&&typeof _0x226dae[_0x7368('0x20')]===_0x7368('0x1f');var _0x30331a=_0x2165eb[_0x7368('0x21')];var _0x15ac0d=_0x5d5c4f?0x0:_0x226dae[_0x7368('0x1e')];var _0x4bdacd=_0x5d5c4f?_0x2165eb[_0x7368('0x21')]:_0x226dae['offset']+_0x226dae[_0x7368('0x20')];var _0x565849;if(_0x4bdacd>=_0x30331a){_0x4bdacd=_0x30331a;_0x565849=0xc8;}else{_0x565849=0xce;}_0x555e56[_0x7368('0x1b')](_0x565849);return _0x555e56[_0x7368('0x22')]('Content-Range',_0x15ac0d+'-'+_0x4bdacd+'/'+_0x30331a)['json'](_0x2165eb);}return null;};}function patchUpdates(_0xe4e90b){return function(_0x8913b0){try{jsonpatch['apply'](_0x8913b0,_0xe4e90b,!![]);}catch(_0x1bd5a4){return BPromise[_0x7368('0x23')](_0x1bd5a4);}return _0x8913b0[_0x7368('0x24')]();};}function saveUpdates(_0x78618f,_0x228cdc){return function(_0x40d966){if(_0x40d966){return _0x40d966[_0x7368('0x25')](_0x78618f)[_0x7368('0x26')](function(_0x6fb876){return _0x6fb876;});}return null;};}function removeEntity(_0x337193,_0x390124){return function(_0x94526f){if(_0x94526f){return _0x94526f[_0x7368('0x27')]()[_0x7368('0x26')](function(){_0x337193[_0x7368('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d1c6c,_0x15786d){return function(_0x5f23d1){if(!_0x5f23d1){_0x2d1c6c[_0x7368('0x1a')](0x194);}return _0x5f23d1;};}function handleError(_0x29c9f9,_0x462e54){_0x462e54=_0x462e54||0x1f4;return function(_0x41ce84){logger[_0x7368('0x28')](_0x41ce84['stack']);if(_0x41ce84[_0x7368('0x29')]){delete _0x41ce84[_0x7368('0x29')];}_0x29c9f9[_0x7368('0x1b')](_0x462e54)[_0x7368('0x2a')](_0x41ce84);};}exports['index']=function(_0x5c5967,_0x156c87){var _0x42c7cd={},_0x39b9f8={},_0x464f1b={'count':0x0,'rows':[]};var _0xf85cf=_['map'](db[_0x7368('0x2b')][_0x7368('0x2c')],function(_0x2c6ae8){return{'name':_0x2c6ae8['fieldName'],'type':_0x2c6ae8[_0x7368('0x2d')][_0x7368('0x2e')]};});_0x39b9f8['model']=_[_0x7368('0x2f')](_0xf85cf,_0x7368('0x29'));_0x39b9f8['query']=_[_0x7368('0x30')](_0x5c5967[_0x7368('0x31')]);_0x39b9f8[_0x7368('0x32')]=_[_0x7368('0x33')](_0x39b9f8['model'],_0x39b9f8['query']);_0x42c7cd[_0x7368('0x34')]=_[_0x7368('0x33')](_0x39b9f8[_0x7368('0x35')],qs[_0x7368('0x36')](_0x5c5967[_0x7368('0x31')][_0x7368('0x36')]));_0x42c7cd[_0x7368('0x34')]=_0x42c7cd[_0x7368('0x34')][_0x7368('0x37')]?_0x42c7cd['attributes']:_0x39b9f8[_0x7368('0x35')];if(!_0x5c5967[_0x7368('0x31')][_0x7368('0x38')](_0x7368('0x39'))){_0x42c7cd['limit']=qs['limit'](_0x5c5967['query'][_0x7368('0x20')]);_0x42c7cd[_0x7368('0x1e')]=qs[_0x7368('0x1e')](_0x5c5967['query'][_0x7368('0x1e')]);}_0x42c7cd['order']=qs[_0x7368('0x3a')](_0x5c5967[_0x7368('0x31')][_0x7368('0x3a')]);_0x42c7cd['where']=qs['filters'](_[_0x7368('0x3b')](_0x5c5967[_0x7368('0x31')],_0x39b9f8['filters']),_0xf85cf);if(_0x5c5967['query'][_0x7368('0x3c')]){_0x42c7cd[_0x7368('0x3d')]=_[_0x7368('0x3e')](_0x42c7cd[_0x7368('0x3d')],{'$or':_[_0x7368('0x2f')](_0xf85cf,function(_0xe9d8f5){if(_0xe9d8f5[_0x7368('0x2d')]!==_0x7368('0x3f')){var _0x1807cc={};_0x1807cc[_0xe9d8f5[_0x7368('0x29')]]={'$like':'%'+_0x5c5967['query']['filter']+'%'};return _0x1807cc;}})});}_0x42c7cd=_[_0x7368('0x3e')]({},_0x42c7cd,_0x5c5967['options']);var _0x13fc45={'where':_0x42c7cd[_0x7368('0x3d')]};return db[_0x7368('0x2b')]['count'](_0x13fc45)[_0x7368('0x26')](function(_0x413dd1){_0x464f1b[_0x7368('0x21')]=_0x413dd1;if(_0x5c5967[_0x7368('0x31')][_0x7368('0x40')]){_0x42c7cd['include']=[{'all':!![]}];}return db[_0x7368('0x2b')][_0x7368('0x41')](_0x42c7cd);})['then'](function(_0x421f08){_0x464f1b[_0x7368('0x42')]=_0x421f08;return _0x464f1b;})['then'](respondWithFilteredResult(_0x156c87,_0x42c7cd))[_0x7368('0x43')](handleError(_0x156c87,null));};exports[_0x7368('0x44')]=function(_0x4d1e0d,_0x302b59){var _0x124f30={'raw':![],'where':{'id':_0x4d1e0d[_0x7368('0x45')]['id']}},_0x1adc1c={};_0x1adc1c[_0x7368('0x35')]=_[_0x7368('0x30')](db[_0x7368('0x2b')][_0x7368('0x2c')]);_0x1adc1c[_0x7368('0x31')]=_[_0x7368('0x30')](_0x4d1e0d[_0x7368('0x31')]);_0x1adc1c['filters']=_[_0x7368('0x33')](_0x1adc1c['model'],_0x1adc1c[_0x7368('0x31')]);_0x124f30['attributes']=_['intersection'](_0x1adc1c[_0x7368('0x35')],qs[_0x7368('0x36')](_0x4d1e0d[_0x7368('0x31')]['fields']));_0x124f30[_0x7368('0x34')]=_0x124f30['attributes'][_0x7368('0x37')]?_0x124f30[_0x7368('0x34')]:_0x1adc1c[_0x7368('0x35')];if(_0x4d1e0d[_0x7368('0x31')][_0x7368('0x40')]){_0x124f30[_0x7368('0x46')]=[{'all':!![]}];}_0x124f30=_[_0x7368('0x3e')]({},_0x124f30,_0x4d1e0d[_0x7368('0x47')]);return db[_0x7368('0x2b')]['find'](_0x124f30)[_0x7368('0x26')](handleEntityNotFound(_0x302b59,null))['then'](respondWithResult(_0x302b59,null))[_0x7368('0x43')](handleError(_0x302b59,null));};exports[_0x7368('0x48')]=function(_0x1ed7e9,_0x383651){return db[_0x7368('0x2b')][_0x7368('0x48')](_0x1ed7e9['body'],{})[_0x7368('0x26')](respondWithResult(_0x383651,0xc9))[_0x7368('0x43')](handleError(_0x383651,null));};exports[_0x7368('0x25')]=function(_0x15e779,_0x191d5c){if(_0x15e779['body']['id']){delete _0x15e779[_0x7368('0x49')]['id'];}return db[_0x7368('0x2b')][_0x7368('0x4a')]({'where':{'id':_0x15e779[_0x7368('0x45')]['id']}})[_0x7368('0x26')](handleEntityNotFound(_0x191d5c,null))[_0x7368('0x26')](saveUpdates(_0x15e779['body'],null))['then'](respondWithResult(_0x191d5c,null))[_0x7368('0x43')](handleError(_0x191d5c,null));};exports[_0x7368('0x27')]=function(_0xc2f251,_0x3430b0){return db[_0x7368('0x2b')][_0x7368('0x4a')]({'where':{'id':_0xc2f251['params']['id']}})[_0x7368('0x26')](handleEntityNotFound(_0x3430b0,null))['then'](removeEntity(_0x3430b0,null))[_0x7368('0x43')](handleError(_0x3430b0,null));};exports[_0x7368('0x4b')]=function(_0x4b9e11,_0x19a608,_0x3a9795){var _0x472525={};var _0x293ea1={};var _0x39ecb9;var _0xbbe2b4;return db[_0x7368('0x2b')][_0x7368('0x4c')]({'where':{'id':_0x4b9e11[_0x7368('0x45')]['id']}})[_0x7368('0x26')](handleEntityNotFound(_0x19a608,null))['then'](function(_0x4010b1){if(_0x4010b1){_0x39ecb9=_0x4010b1;_0x293ea1[_0x7368('0x35')]=_[_0x7368('0x30')](db[_0x7368('0x4d')][_0x7368('0x2c')]);_0x293ea1[_0x7368('0x31')]=_[_0x7368('0x30')](_0x4b9e11['query']);_0x293ea1['filters']=_[_0x7368('0x33')](_0x293ea1['model'],_0x293ea1['query']);_0x472525[_0x7368('0x34')]=_['intersection'](_0x293ea1['model'],qs[_0x7368('0x36')](_0x4b9e11[_0x7368('0x31')]['fields']));_0x472525['attributes']=_0x472525[_0x7368('0x34')][_0x7368('0x37')]?_0x472525['attributes']:_0x293ea1['model'];_0x472525[_0x7368('0x4e')]=qs['sort'](_0x4b9e11[_0x7368('0x31')][_0x7368('0x3a')]);_0x472525[_0x7368('0x3d')]=qs['filters'](_[_0x7368('0x3b')](_0x4b9e11[_0x7368('0x31')],_0x293ea1[_0x7368('0x32')]));if(_0x4b9e11[_0x7368('0x31')][_0x7368('0x3c')]){_0x472525[_0x7368('0x3d')]=_[_0x7368('0x3e')](_0x472525[_0x7368('0x3d')],{'$or':_['map'](_0x472525[_0x7368('0x34')],function(_0x567e42){var _0xb1c79d={};_0xb1c79d[_0x567e42]={'$like':'%'+_0x4b9e11['query'][_0x7368('0x3c')]+'%'};return _0xb1c79d;})});}_0x472525=_[_0x7368('0x3e')]({},_0x472525,_0x4b9e11['options']);return _0x39ecb9['getConfigurations'](_0x472525);}})[_0x7368('0x26')](function(_0x39fcdc){if(_0x39fcdc){_0xbbe2b4=_0x39fcdc['length'];if(!_0x4b9e11[_0x7368('0x31')][_0x7368('0x38')](_0x7368('0x39'))){_0x472525['limit']=qs[_0x7368('0x20')](_0x4b9e11[_0x7368('0x31')]['limit']);_0x472525[_0x7368('0x1e')]=qs['offset'](_0x4b9e11[_0x7368('0x31')][_0x7368('0x1e')]);}return _0x39ecb9[_0x7368('0x4b')](_0x472525);}})[_0x7368('0x26')](function(_0x7135ba){if(_0x7135ba){return _0x7135ba?{'count':_0xbbe2b4,'rows':_0x7135ba}:null;}})['then'](respondWithResult(_0x19a608,null))[_0x7368('0x43')](handleError(_0x19a608,null));};exports['addConfiguration']=function(_0x1f1170,_0x4e7a4a,_0x15ea2f){if(_0x1f1170[_0x7368('0x49')]['id']){delete _0x1f1170[_0x7368('0x49')]['id'];}return db['DeskAccount'][_0x7368('0x4c')]({'where':{'id':_0x1f1170[_0x7368('0x45')]['id']}})[_0x7368('0x26')](handleEntityNotFound(_0x4e7a4a,null))['then'](function(_0x592376){if(_0x592376){_0x1f1170[_0x7368('0x49')]['AccountId']=_0x592376['id'];_0x1f1170[_0x7368('0x49')]['Subjects']=integrations[_0x7368('0x4f')](_0x1f1170['body'][_0x7368('0x50')],_0x1f1170[_0x7368('0x49')][_0x7368('0x2d')]);_0x1f1170[_0x7368('0x49')][_0x7368('0x51')]=integrations[_0x7368('0x52')](_0x1f1170['body'][_0x7368('0x50')],_0x1f1170[_0x7368('0x49')][_0x7368('0x2d')]);return db[_0x7368('0x4d')]['create'](_0x1f1170['body'],{'include':[{'model':db['DeskField'],'as':_0x7368('0x53')},{'model':db['DeskField'],'as':_0x7368('0x51')}]});}return null;})['then'](respondWithResult(_0x4e7a4a,null))[_0x7368('0x43')](handleError(_0x4e7a4a,null));};exports[_0x7368('0x54')]=function(_0xa86319,_0x29c8d7,_0x160a21){var _0x576e1f=[{'name':_0x7368('0x55'),'label':_0x7368('0x55'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x2001ff='';return db[_0x7368('0x2b')]['findOne']({'where':{'id':_0xa86319[_0x7368('0x45')]['id']},'attributes':['id',_0x7368('0x56'),'authType',_0x7368('0x57'),_0x7368('0x58'),'consumerKey',_0x7368('0x59'),'token','tokenSecret']})[_0x7368('0x26')](handleEntityNotFound(_0x29c8d7,null))['then'](function(_0x516274){if(_0x516274){_0x2001ff=_0x516274[_0x7368('0x56')];var _0x44f9b5=_0x2001ff[_0x7368('0x5a')](-0x1);if(_0x44f9b5==='/'){_0x2001ff=_0x2001ff[_0x7368('0x5b')](0x0,_0x2001ff['lastIndexOf'](_0x44f9b5));}var _0x4a5f0b={'method':_0x7368('0x5c'),'uri':util[_0x7368('0x5d')]('%s/custom_fields',_0x2001ff),'headers':{'Content-Type':_0x7368('0x5e'),'Accept':_0x7368('0x5e')},'json':!![]};if(_0x516274[_0x7368('0x5f')]===_0x7368('0x60')){_0x4a5f0b[_0x7368('0x61')][_0x7368('0x62')]=util[_0x7368('0x5d')](_0x7368('0x63'),new Buffer(util[_0x7368('0x5d')](_0x7368('0x64'),_0x516274['username'],_0x516274[_0x7368('0x58')]))['toString'](_0x7368('0x65')));}return rp(_0x4a5f0b)[_0x7368('0x26')](function(_0x56b76a){return _0x576e1f[_0x7368('0x66')](_[_0x7368('0x2f')](_0x56b76a[_0x7368('0x67')]['entries'],function(_0x3a3068){return{'id':_0x3a3068['name'],'name':_0x3a3068[_0x7368('0x29')],'type':_0x3a3068['type'],'active':_0x3a3068['active'],'label':_0x3a3068[_0x7368('0x68')],'custom':!![]};}));});}})['then'](function(_0x5f5862){return{'count':_0x5f5862['length'],'rows':_0x5f5862};})[_0x7368('0x26')](respondWithResult(_0x29c8d7,null))[_0x7368('0x43')](function(_0x221d25){var _0x3abb9d=_0xa86319[_0x7368('0x31')]['test']?0x1f4:_0x221d25[_0x7368('0x69')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x7368('0x54'),_0x3abb9d,JSON[_0x7368('0x6a')](_0x221d25));delete _0x221d25['name'];if(_0x3abb9d===0x191){_0x3abb9d=0x190;}_0x29c8d7[_0x7368('0x1b')](_0x3abb9d)[_0x7368('0x2a')](_0xa86319[_0x7368('0x31')][_0x7368('0x6b')]?{'message':'Wrong\x20credentials','statusCode':_0x221d25[_0x7368('0x69')]}:_0x221d25);});}; \ No newline at end of file +var _0xc3e2=['basic','headers','Authorization','Basic\x20%s','format','base64','concat','_embedded','active','label','test','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../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','stack','name','send','index','map','DeskAccount','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','length','find','create','body','catch','params','destroy','getConfigurations','findOne','DeskConfiguration','addConfiguration','Subjects','getSubjects','channel','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret','substring','lastIndexOf','%s/custom_fields','application/json'];(function(_0x154d6f,_0x5b375e){var _0xe3ab9b=function(_0x40b8a6){while(--_0x40b8a6){_0x154d6f['push'](_0x154d6f['shift']());}};_0xe3ab9b(++_0x5b375e);}(_0xc3e2,0x154));var _0x2c3e=function(_0x1ee06d,_0x351e1c){_0x1ee06d=_0x1ee06d-0x0;var _0x422ccd=_0xc3e2[_0x1ee06d];return _0x422ccd;};'use strict';var emlformat=require(_0x2c3e('0x0'));var rimraf=require(_0x2c3e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c3e('0x2'));var rp=require(_0x2c3e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2c3e('0x4'));var path=require(_0x2c3e('0x5'));var sox=require('sox');var csv=require(_0x2c3e('0x6'));var ejs=require(_0x2c3e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c3e('0x8'));var squel=require(_0x2c3e('0x9'));var crypto=require(_0x2c3e('0xa'));var jsforce=require(_0x2c3e('0xb'));var deskjs=require(_0x2c3e('0xc'));var toCsv=require(_0x2c3e('0x6'));var querystring=require(_0x2c3e('0xd'));var Papa=require('papaparse');var Redis=require(_0x2c3e('0xe'));var authService=require(_0x2c3e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2c3e('0x10'));var hardwareService=require(_0x2c3e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2c3e('0x12'));var config=require(_0x2c3e('0x13'));var licenseUtil=require(_0x2c3e('0x14'));var db=require(_0x2c3e('0x15'))['db'];var integrations=require(_0x2c3e('0x16'));function respondWithStatusCode(_0x3a2db3,_0xd70fd6){_0xd70fd6=_0xd70fd6||0xcc;return function(_0x5174a8){if(_0x5174a8){return _0x3a2db3['sendStatus'](_0xd70fd6);}return _0x3a2db3[_0x2c3e('0x17')](_0xd70fd6)[_0x2c3e('0x18')]();};}function respondWithResult(_0x3e4907,_0x41de3c){_0x41de3c=_0x41de3c||0xc8;return function(_0x5327c8){if(_0x5327c8){return _0x3e4907[_0x2c3e('0x17')](_0x41de3c)[_0x2c3e('0x19')](_0x5327c8);}};}function respondWithFilteredResult(_0x1eebaf,_0x8579e1){return function(_0x2ffa7c){if(_0x2ffa7c){var _0x3c1073=typeof _0x8579e1[_0x2c3e('0x1a')]===_0x2c3e('0x1b')&&typeof _0x8579e1[_0x2c3e('0x1c')]==='undefined';var _0x5cb648=_0x2ffa7c[_0x2c3e('0x1d')];var _0x19ca88=_0x3c1073?0x0:_0x8579e1['offset'];var _0xc4306c=_0x3c1073?_0x2ffa7c[_0x2c3e('0x1d')]:_0x8579e1[_0x2c3e('0x1a')]+_0x8579e1[_0x2c3e('0x1c')];var _0x37684a;if(_0xc4306c>=_0x5cb648){_0xc4306c=_0x5cb648;_0x37684a=0xc8;}else{_0x37684a=0xce;}_0x1eebaf['status'](_0x37684a);return _0x1eebaf[_0x2c3e('0x1e')](_0x2c3e('0x1f'),_0x19ca88+'-'+_0xc4306c+'/'+_0x5cb648)['json'](_0x2ffa7c);}return null;};}function patchUpdates(_0x1ee5eb){return function(_0x17d651){try{jsonpatch[_0x2c3e('0x20')](_0x17d651,_0x1ee5eb,!![]);}catch(_0x8c8cf8){return BPromise[_0x2c3e('0x21')](_0x8c8cf8);}return _0x17d651['save']();};}function saveUpdates(_0x58981e,_0x7703ec){return function(_0x1ed922){if(_0x1ed922){return _0x1ed922[_0x2c3e('0x22')](_0x58981e)[_0x2c3e('0x23')](function(_0x2f21b7){return _0x2f21b7;});}return null;};}function removeEntity(_0x9dceac,_0x15f8e7){return function(_0x180279){if(_0x180279){return _0x180279['destroy']()[_0x2c3e('0x23')](function(){_0x9dceac[_0x2c3e('0x17')](0xcc)[_0x2c3e('0x18')]();});}};}function handleEntityNotFound(_0x10702d,_0x220b1f){return function(_0x46a807){if(!_0x46a807){_0x10702d[_0x2c3e('0x24')](0x194);}return _0x46a807;};}function handleError(_0x50ae64,_0x276cc6){_0x276cc6=_0x276cc6||0x1f4;return function(_0x4fd194){logger[_0x2c3e('0x25')](_0x4fd194[_0x2c3e('0x26')]);if(_0x4fd194['name']){delete _0x4fd194[_0x2c3e('0x27')];}_0x50ae64[_0x2c3e('0x17')](_0x276cc6)[_0x2c3e('0x28')](_0x4fd194);};}exports[_0x2c3e('0x29')]=function(_0x2d4276,_0x463b22){var _0x5ebb1e={},_0x544c3c={},_0x4575eb={'count':0x0,'rows':[]};var _0x305a75=_[_0x2c3e('0x2a')](db[_0x2c3e('0x2b')][_0x2c3e('0x2c')],function(_0xcb98ca){return{'name':_0xcb98ca['fieldName'],'type':_0xcb98ca[_0x2c3e('0x2d')][_0x2c3e('0x2e')]};});_0x544c3c[_0x2c3e('0x2f')]=_[_0x2c3e('0x2a')](_0x305a75,_0x2c3e('0x27'));_0x544c3c[_0x2c3e('0x30')]=_[_0x2c3e('0x31')](_0x2d4276['query']);_0x544c3c[_0x2c3e('0x32')]=_['intersection'](_0x544c3c[_0x2c3e('0x2f')],_0x544c3c[_0x2c3e('0x30')]);_0x5ebb1e[_0x2c3e('0x33')]=_[_0x2c3e('0x34')](_0x544c3c[_0x2c3e('0x2f')],qs[_0x2c3e('0x35')](_0x2d4276[_0x2c3e('0x30')][_0x2c3e('0x35')]));_0x5ebb1e[_0x2c3e('0x33')]=_0x5ebb1e['attributes']['length']?_0x5ebb1e['attributes']:_0x544c3c[_0x2c3e('0x2f')];if(!_0x2d4276[_0x2c3e('0x30')][_0x2c3e('0x36')](_0x2c3e('0x37'))){_0x5ebb1e['limit']=qs[_0x2c3e('0x1c')](_0x2d4276[_0x2c3e('0x30')][_0x2c3e('0x1c')]);_0x5ebb1e[_0x2c3e('0x1a')]=qs[_0x2c3e('0x1a')](_0x2d4276[_0x2c3e('0x30')][_0x2c3e('0x1a')]);}_0x5ebb1e['order']=qs[_0x2c3e('0x38')](_0x2d4276[_0x2c3e('0x30')][_0x2c3e('0x38')]);_0x5ebb1e[_0x2c3e('0x39')]=qs[_0x2c3e('0x32')](_[_0x2c3e('0x3a')](_0x2d4276[_0x2c3e('0x30')],_0x544c3c[_0x2c3e('0x32')]),_0x305a75);if(_0x2d4276[_0x2c3e('0x30')]['filter']){_0x5ebb1e['where']=_[_0x2c3e('0x3b')](_0x5ebb1e['where'],{'$or':_[_0x2c3e('0x2a')](_0x305a75,function(_0x25691f){if(_0x25691f[_0x2c3e('0x2d')]!==_0x2c3e('0x3c')){var _0x289a3f={};_0x289a3f[_0x25691f[_0x2c3e('0x27')]]={'$like':'%'+_0x2d4276['query'][_0x2c3e('0x3d')]+'%'};return _0x289a3f;}})});}_0x5ebb1e=_[_0x2c3e('0x3b')]({},_0x5ebb1e,_0x2d4276[_0x2c3e('0x3e')]);var _0x2803f5={'where':_0x5ebb1e[_0x2c3e('0x39')]};return db[_0x2c3e('0x2b')][_0x2c3e('0x1d')](_0x2803f5)['then'](function(_0x1eb737){_0x4575eb[_0x2c3e('0x1d')]=_0x1eb737;if(_0x2d4276[_0x2c3e('0x30')][_0x2c3e('0x3f')]){_0x5ebb1e[_0x2c3e('0x40')]=[{'all':!![]}];}return db['DeskAccount'][_0x2c3e('0x41')](_0x5ebb1e);})['then'](function(_0x3afb7e){_0x4575eb[_0x2c3e('0x42')]=_0x3afb7e;return _0x4575eb;})[_0x2c3e('0x23')](respondWithFilteredResult(_0x463b22,_0x5ebb1e))['catch'](handleError(_0x463b22,null));};exports['show']=function(_0x3c0ee5,_0x5f1242){var _0x3b8c86={'raw':![],'where':{'id':_0x3c0ee5['params']['id']}},_0x3a3544={};_0x3a3544['model']=_['keys'](db[_0x2c3e('0x2b')]['rawAttributes']);_0x3a3544[_0x2c3e('0x30')]=_['keys'](_0x3c0ee5[_0x2c3e('0x30')]);_0x3a3544[_0x2c3e('0x32')]=_[_0x2c3e('0x34')](_0x3a3544[_0x2c3e('0x2f')],_0x3a3544[_0x2c3e('0x30')]);_0x3b8c86[_0x2c3e('0x33')]=_['intersection'](_0x3a3544['model'],qs[_0x2c3e('0x35')](_0x3c0ee5[_0x2c3e('0x30')]['fields']));_0x3b8c86[_0x2c3e('0x33')]=_0x3b8c86[_0x2c3e('0x33')][_0x2c3e('0x43')]?_0x3b8c86[_0x2c3e('0x33')]:_0x3a3544[_0x2c3e('0x2f')];if(_0x3c0ee5[_0x2c3e('0x30')][_0x2c3e('0x3f')]){_0x3b8c86[_0x2c3e('0x40')]=[{'all':!![]}];}_0x3b8c86=_[_0x2c3e('0x3b')]({},_0x3b8c86,_0x3c0ee5[_0x2c3e('0x3e')]);return db[_0x2c3e('0x2b')][_0x2c3e('0x44')](_0x3b8c86)[_0x2c3e('0x23')](handleEntityNotFound(_0x5f1242,null))[_0x2c3e('0x23')](respondWithResult(_0x5f1242,null))['catch'](handleError(_0x5f1242,null));};exports[_0x2c3e('0x45')]=function(_0x5bfd5e,_0x4ade95){return db[_0x2c3e('0x2b')][_0x2c3e('0x45')](_0x5bfd5e[_0x2c3e('0x46')],{})[_0x2c3e('0x23')](respondWithResult(_0x4ade95,0xc9))[_0x2c3e('0x47')](handleError(_0x4ade95,null));};exports[_0x2c3e('0x22')]=function(_0x503491,_0x5c50ee){if(_0x503491['body']['id']){delete _0x503491[_0x2c3e('0x46')]['id'];}return db[_0x2c3e('0x2b')][_0x2c3e('0x44')]({'where':{'id':_0x503491[_0x2c3e('0x48')]['id']}})[_0x2c3e('0x23')](handleEntityNotFound(_0x5c50ee,null))[_0x2c3e('0x23')](saveUpdates(_0x503491['body'],null))['then'](respondWithResult(_0x5c50ee,null))[_0x2c3e('0x47')](handleError(_0x5c50ee,null));};exports[_0x2c3e('0x49')]=function(_0x5a86b3,_0x2cb503){return db[_0x2c3e('0x2b')][_0x2c3e('0x44')]({'where':{'id':_0x5a86b3[_0x2c3e('0x48')]['id']}})[_0x2c3e('0x23')](handleEntityNotFound(_0x2cb503,null))[_0x2c3e('0x23')](removeEntity(_0x2cb503,null))[_0x2c3e('0x47')](handleError(_0x2cb503,null));};exports[_0x2c3e('0x4a')]=function(_0x561902,_0x25a59e,_0x529369){var _0x4f10b1={};var _0x5aed05={};var _0xb193db;var _0x5e39f2;return db[_0x2c3e('0x2b')][_0x2c3e('0x4b')]({'where':{'id':_0x561902[_0x2c3e('0x48')]['id']}})[_0x2c3e('0x23')](handleEntityNotFound(_0x25a59e,null))['then'](function(_0x14e7c6){if(_0x14e7c6){_0xb193db=_0x14e7c6;_0x5aed05[_0x2c3e('0x2f')]=_[_0x2c3e('0x31')](db[_0x2c3e('0x4c')]['rawAttributes']);_0x5aed05[_0x2c3e('0x30')]=_['keys'](_0x561902[_0x2c3e('0x30')]);_0x5aed05[_0x2c3e('0x32')]=_[_0x2c3e('0x34')](_0x5aed05[_0x2c3e('0x2f')],_0x5aed05['query']);_0x4f10b1[_0x2c3e('0x33')]=_[_0x2c3e('0x34')](_0x5aed05[_0x2c3e('0x2f')],qs[_0x2c3e('0x35')](_0x561902[_0x2c3e('0x30')][_0x2c3e('0x35')]));_0x4f10b1[_0x2c3e('0x33')]=_0x4f10b1[_0x2c3e('0x33')][_0x2c3e('0x43')]?_0x4f10b1[_0x2c3e('0x33')]:_0x5aed05['model'];_0x4f10b1['order']=qs['sort'](_0x561902['query'][_0x2c3e('0x38')]);_0x4f10b1[_0x2c3e('0x39')]=qs[_0x2c3e('0x32')](_[_0x2c3e('0x3a')](_0x561902['query'],_0x5aed05[_0x2c3e('0x32')]));if(_0x561902[_0x2c3e('0x30')]['filter']){_0x4f10b1['where']=_[_0x2c3e('0x3b')](_0x4f10b1[_0x2c3e('0x39')],{'$or':_[_0x2c3e('0x2a')](_0x4f10b1[_0x2c3e('0x33')],function(_0x45c910){var _0x27b432={};_0x27b432[_0x45c910]={'$like':'%'+_0x561902[_0x2c3e('0x30')][_0x2c3e('0x3d')]+'%'};return _0x27b432;})});}_0x4f10b1=_[_0x2c3e('0x3b')]({},_0x4f10b1,_0x561902[_0x2c3e('0x3e')]);return _0xb193db['getConfigurations'](_0x4f10b1);}})[_0x2c3e('0x23')](function(_0x424b6e){if(_0x424b6e){_0x5e39f2=_0x424b6e[_0x2c3e('0x43')];if(!_0x561902[_0x2c3e('0x30')][_0x2c3e('0x36')]('nolimit')){_0x4f10b1[_0x2c3e('0x1c')]=qs[_0x2c3e('0x1c')](_0x561902['query'][_0x2c3e('0x1c')]);_0x4f10b1[_0x2c3e('0x1a')]=qs[_0x2c3e('0x1a')](_0x561902[_0x2c3e('0x30')]['offset']);}return _0xb193db[_0x2c3e('0x4a')](_0x4f10b1);}})[_0x2c3e('0x23')](function(_0xe5cfc5){if(_0xe5cfc5){return _0xe5cfc5?{'count':_0x5e39f2,'rows':_0xe5cfc5}:null;}})[_0x2c3e('0x23')](respondWithResult(_0x25a59e,null))[_0x2c3e('0x47')](handleError(_0x25a59e,null));};exports[_0x2c3e('0x4d')]=function(_0x508ae9,_0x3f56ed,_0x2a7d4e){if(_0x508ae9[_0x2c3e('0x46')]['id']){delete _0x508ae9[_0x2c3e('0x46')]['id'];}return db['DeskAccount'][_0x2c3e('0x4b')]({'where':{'id':_0x508ae9[_0x2c3e('0x48')]['id']}})[_0x2c3e('0x23')](handleEntityNotFound(_0x3f56ed,null))[_0x2c3e('0x23')](function(_0x4bfc62){if(_0x4bfc62){_0x508ae9['body']['AccountId']=_0x4bfc62['id'];_0x508ae9[_0x2c3e('0x46')][_0x2c3e('0x4e')]=integrations[_0x2c3e('0x4f')](_0x508ae9['body'][_0x2c3e('0x50')],_0x508ae9[_0x2c3e('0x46')][_0x2c3e('0x2d')]);_0x508ae9[_0x2c3e('0x46')]['Descriptions']=integrations['getDescriptions'](_0x508ae9['body'][_0x2c3e('0x50')],_0x508ae9[_0x2c3e('0x46')][_0x2c3e('0x2d')]);return db[_0x2c3e('0x4c')]['create'](_0x508ae9['body'],{'include':[{'model':db[_0x2c3e('0x51')],'as':'Subjects'},{'model':db[_0x2c3e('0x51')],'as':_0x2c3e('0x52')}]});}return null;})[_0x2c3e('0x23')](respondWithResult(_0x3f56ed,null))[_0x2c3e('0x47')](handleError(_0x3f56ed,null));};exports[_0x2c3e('0x53')]=function(_0x3f7b36,_0xe80065,_0x56b165){var _0x55e729=[{'name':_0x2c3e('0x54'),'label':_0x2c3e('0x54'),'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 _0x1a6990='';return db['DeskAccount'][_0x2c3e('0x4b')]({'where':{'id':_0x3f7b36[_0x2c3e('0x48')]['id']},'attributes':['id',_0x2c3e('0x55'),_0x2c3e('0x56'),_0x2c3e('0x57'),_0x2c3e('0x58'),_0x2c3e('0x59'),'consumerSecret',_0x2c3e('0x5a'),_0x2c3e('0x5b')]})[_0x2c3e('0x23')](handleEntityNotFound(_0xe80065,null))[_0x2c3e('0x23')](function(_0x5b5496){if(_0x5b5496){_0x1a6990=_0x5b5496[_0x2c3e('0x55')];var _0x3bef32=_0x1a6990['slice'](-0x1);if(_0x3bef32==='/'){_0x1a6990=_0x1a6990[_0x2c3e('0x5c')](0x0,_0x1a6990[_0x2c3e('0x5d')](_0x3bef32));}var _0x488996={'method':'GET','uri':util['format'](_0x2c3e('0x5e'),_0x1a6990),'headers':{'Content-Type':'application/json','Accept':_0x2c3e('0x5f')},'json':!![]};if(_0x5b5496[_0x2c3e('0x56')]===_0x2c3e('0x60')){_0x488996[_0x2c3e('0x61')][_0x2c3e('0x62')]=util['format'](_0x2c3e('0x63'),new Buffer(util[_0x2c3e('0x64')]('%s:%s',_0x5b5496[_0x2c3e('0x57')],_0x5b5496[_0x2c3e('0x58')]))['toString'](_0x2c3e('0x65')));}return rp(_0x488996)[_0x2c3e('0x23')](function(_0x11025d){return _0x55e729[_0x2c3e('0x66')](_['map'](_0x11025d[_0x2c3e('0x67')]['entries'],function(_0x5a13ee){return{'id':_0x5a13ee[_0x2c3e('0x27')],'name':_0x5a13ee['name'],'type':_0x5a13ee[_0x2c3e('0x2d')],'active':_0x5a13ee[_0x2c3e('0x68')],'label':_0x5a13ee[_0x2c3e('0x69')],'custom':!![]};}));});}})[_0x2c3e('0x23')](function(_0x31fc8d){return{'count':_0x31fc8d[_0x2c3e('0x43')],'rows':_0x31fc8d};})[_0x2c3e('0x23')](respondWithResult(_0xe80065,null))['catch'](function(_0x1cd7d6){var _0x4fb42c=_0x3f7b36[_0x2c3e('0x30')][_0x2c3e('0x6a')]?0x1f4:_0x1cd7d6['statusCode']||0x1f4;logger[_0x2c3e('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x2c3e('0x53'),_0x4fb42c,JSON['stringify'](_0x1cd7d6));delete _0x1cd7d6['name'];if(_0x4fb42c===0x191){_0x4fb42c=0x190;}_0xe80065[_0x2c3e('0x17')](_0x4fb42c)[_0x2c3e('0x28')](_0x3f7b36[_0x2c3e('0x30')]['test']?{'message':_0x2c3e('0x6b'),'statusCode':_0x1cd7d6[_0x2c3e('0x6c')]}:_0x1cd7d6);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index f1c2e7b..994a364 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 _0x9a6d=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9a6d,0xbc));var _0xd9a6=function(_0x5100d0,_0x1906b0){_0x5100d0=_0x5100d0-0x0;var _0xc251d5=_0x9a6d[_0x5100d0];return _0xc251d5;};'use strict';var _=require(_0xd9a6('0x0'));var util=require(_0xd9a6('0x1'));var logger=require(_0xd9a6('0x2'))(_0xd9a6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd9a6('0x4'));var fs=require('fs');var path=require(_0xd9a6('0x5'));var rimraf=require(_0xd9a6('0x6'));var config=require(_0xd9a6('0x7'));var attributes=require(_0xd9a6('0x8'));var integrations=require(_0xd9a6('0x9'));module[_0xd9a6('0xa')]=function(_0x51e7eb,_0x1ff458){return _0x51e7eb['define'](_0xd9a6('0xb'),attributes,{'tableName':_0xd9a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75c4=['int_desk_accounts','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount'];(function(_0x27418b,_0x16155a){var _0x147fc4=function(_0x1d50e0){while(--_0x1d50e0){_0x27418b['push'](_0x27418b['shift']());}};_0x147fc4(++_0x16155a);}(_0x75c4,0x1c9));var _0x475c=function(_0x385403,_0x27f102){_0x385403=_0x385403-0x0;var _0x8a8abf=_0x75c4[_0x385403];return _0x8a8abf;};'use strict';var _=require(_0x475c('0x0'));var util=require(_0x475c('0x1'));var logger=require(_0x475c('0x2'))(_0x475c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x475c('0x4'));var fs=require('fs');var path=require(_0x475c('0x5'));var rimraf=require('rimraf');var config=require(_0x475c('0x6'));var attributes=require(_0x475c('0x7'));var integrations=require(_0x475c('0x8'));module[_0x475c('0x9')]=function(_0x21f1f4,_0x1ec094){return _0x21f1f4['define'](_0x475c('0xa'),attributes,{'tableName':_0x475c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index c068f77..74e3393 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 _0xf54d=['request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','find','ShowDeskAccount','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','DeskAccount,\x20%s,\x20%s'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xf54d,0x18b));var _0xdf54=function(_0x27200a,_0x4cb19d){_0x27200a=_0x27200a-0x0;var _0x5b6aa7=_0xf54d[_0x27200a];return _0x5b6aa7;};'use strict';var _=require(_0xdf54('0x0'));var util=require(_0xdf54('0x1'));var moment=require(_0xdf54('0x2'));var BPromise=require(_0xdf54('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf54('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdf54('0x5'))(_0xdf54('0x6'));var config=require(_0xdf54('0x7'));var jayson=require(_0xdf54('0x8'));var client=jayson[_0xdf54('0x9')][_0xdf54('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45b35a,_0x3c73c6,_0x20332e){return new BPromise(function(_0x41e042,_0x4e0b78){return client['request'](_0x45b35a,_0x20332e)['then'](function(_0x182547){logger[_0xdf54('0xb')](_0xdf54('0xc'),_0x3c73c6,_0xdf54('0xd'));logger[_0xdf54('0xe')](_0xdf54('0xf'),_0x3c73c6,_0xdf54('0xd'),JSON[_0xdf54('0x10')](_0x182547));if(_0x182547[_0xdf54('0x11')]){if(_0x182547[_0xdf54('0x11')]['code']===0x1f4){logger[_0xdf54('0x11')]('DeskAccount,\x20%s,\x20%s',_0x3c73c6,_0x182547[_0xdf54('0x11')][_0xdf54('0x12')]);return _0x4e0b78(_0x182547['error']['message']);}logger[_0xdf54('0x11')](_0xdf54('0xc'),_0x3c73c6,_0x182547['error'][_0xdf54('0x12')]);return _0x41e042(_0x182547[_0xdf54('0x11')]['message']);}else{logger[_0xdf54('0xb')](_0xdf54('0xc'),_0x3c73c6,'request\x20sent');_0x41e042(_0x182547['result']['message']);}})['catch'](function(_0x31c00d){logger['error'](_0xdf54('0xc'),_0x3c73c6,_0x31c00d);_0x4e0b78(_0x31c00d);});});}exports[_0xdf54('0x13')]=function(_0x5a064a){var _0x2567c6=this;return new Promise(function(_0x5a1852,_0x26e891){return db[_0xdf54('0x14')][_0xdf54('0x15')]({'raw':_0x5a064a[_0xdf54('0x16')]?_0x5a064a['options'][_0xdf54('0x17')]===undefined?!![]:![]:!![],'where':_0x5a064a[_0xdf54('0x16')]?_0x5a064a[_0xdf54('0x16')][_0xdf54('0x18')]||null:null,'attributes':_0x5a064a[_0xdf54('0x16')]?_0x5a064a['options'][_0xdf54('0x19')]||null:null,'limit':_0x5a064a[_0xdf54('0x16')]?_0x5a064a[_0xdf54('0x16')][_0xdf54('0x1a')]||null:null,'include':_0x5a064a['options']?_0x5a064a['options'][_0xdf54('0x1b')]?_[_0xdf54('0x1c')](_0x5a064a['options'][_0xdf54('0x1b')],function(_0x594af3){return{'model':db[_0x594af3[_0xdf54('0x1d')]],'as':_0x594af3['as'],'attributes':_0x594af3['attributes'],'include':_0x594af3['include']?_[_0xdf54('0x1c')](_0x594af3[_0xdf54('0x1b')],function(_0x5a1ac9){return{'model':db[_0x5a1ac9['model']],'as':_0x5a1ac9['as'],'attributes':_0x5a1ac9[_0xdf54('0x19')],'include':_0x5a1ac9[_0xdf54('0x1b')]?_[_0xdf54('0x1c')](_0x5a1ac9['include'],function(_0x89cd71){return{'model':db[_0x89cd71[_0xdf54('0x1d')]],'as':_0x89cd71['as'],'attributes':_0x89cd71['attributes']};}):[]};}):[]};}):[]:[]})[_0xdf54('0x1e')](function(_0x15e249){logger[_0xdf54('0xb')](_0xdf54('0x13'),_0x5a064a);logger['debug'](_0xdf54('0x13'),_0x5a064a,JSON[_0xdf54('0x10')](_0x15e249));_0x5a1852(_0x15e249);})['catch'](function(_0x2a18bf){logger[_0xdf54('0x11')]('GetDeskAccount',_0x2a18bf[_0xdf54('0x12')],_0x5a064a);_0x26e891(_0x2567c6[_0xdf54('0x11')](0x1f4,_0x2a18bf[_0xdf54('0x12')]));});});};exports['ShowDeskAccount']=function(_0x27aeb1){var _0x370843=this;return new Promise(function(_0x28f0ef,_0x3d6a2c){return db[_0xdf54('0x14')][_0xdf54('0x1f')]({'raw':_0x27aeb1[_0xdf54('0x16')]?_0x27aeb1[_0xdf54('0x16')][_0xdf54('0x17')]===undefined?!![]:![]:!![],'where':_0x27aeb1[_0xdf54('0x16')]?_0x27aeb1[_0xdf54('0x16')][_0xdf54('0x18')]||null:null,'attributes':_0x27aeb1['options']?_0x27aeb1[_0xdf54('0x16')][_0xdf54('0x19')]||null:null,'include':_0x27aeb1[_0xdf54('0x16')]?_0x27aeb1[_0xdf54('0x16')]['include']?_[_0xdf54('0x1c')](_0x27aeb1[_0xdf54('0x16')]['include'],function(_0x3e3139){return{'model':db[_0x3e3139[_0xdf54('0x1d')]],'as':_0x3e3139['as'],'attributes':_0x3e3139['attributes'],'include':_0x3e3139['include']?_[_0xdf54('0x1c')](_0x3e3139[_0xdf54('0x1b')],function(_0x3536d4){return{'model':db[_0x3536d4[_0xdf54('0x1d')]],'as':_0x3536d4['as'],'attributes':_0x3536d4[_0xdf54('0x19')],'include':_0x3536d4[_0xdf54('0x1b')]?_[_0xdf54('0x1c')](_0x3536d4['include'],function(_0xab1a6b){return{'model':db[_0xab1a6b[_0xdf54('0x1d')]],'as':_0xab1a6b['as'],'attributes':_0xab1a6b[_0xdf54('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdf54('0x1e')](function(_0xbe7538){logger[_0xdf54('0xb')](_0xdf54('0x20'),_0x27aeb1);logger['debug'](_0xdf54('0x20'),_0x27aeb1,JSON[_0xdf54('0x10')](_0xbe7538));_0x28f0ef(_0xbe7538);})[_0xdf54('0x21')](function(_0x1bf835){logger[_0xdf54('0x11')](_0xdf54('0x20'),_0x1bf835[_0xdf54('0x12')],_0x27aeb1);_0x3d6a2c(_0x370843[_0xdf54('0x11')](0x1f4,_0x1bf835['message']));});});}; \ No newline at end of file +var _0x3e81=['where','attributes','limit','include','map','model','catch','ShowDeskAccount','DeskAccount','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetDeskAccount','findAll','options','raw'];(function(_0x30741c,_0x475730){var _0x5b08d9=function(_0x26d0f3){while(--_0x26d0f3){_0x30741c['push'](_0x30741c['shift']());}};_0x5b08d9(++_0x475730);}(_0x3e81,0x132));var _0x13e8=function(_0x2473bb,_0x5ec86f){_0x2473bb=_0x2473bb-0x0;var _0x16a632=_0x3e81[_0x2473bb];return _0x16a632;};'use strict';var _=require(_0x13e8('0x0'));var util=require('util');var moment=require(_0x13e8('0x1'));var BPromise=require(_0x13e8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x13e8('0x3'))['db'];var utils=require(_0x13e8('0x4'));var logger=require(_0x13e8('0x5'))(_0x13e8('0x6'));var config=require(_0x13e8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x13e8('0x8')][_0x13e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bca21,_0x594aed,_0x1860eb){return new BPromise(function(_0xc7555f,_0x380fc0){return client['request'](_0x5bca21,_0x1860eb)[_0x13e8('0xa')](function(_0x28a44c){logger[_0x13e8('0xb')](_0x13e8('0xc'),_0x594aed,_0x13e8('0xd'));logger[_0x13e8('0xe')](_0x13e8('0xf'),_0x594aed,_0x13e8('0xd'),JSON[_0x13e8('0x10')](_0x28a44c));if(_0x28a44c[_0x13e8('0x11')]){if(_0x28a44c[_0x13e8('0x11')]['code']===0x1f4){logger[_0x13e8('0x11')](_0x13e8('0xc'),_0x594aed,_0x28a44c['error']['message']);return _0x380fc0(_0x28a44c[_0x13e8('0x11')]['message']);}logger[_0x13e8('0x11')](_0x13e8('0xc'),_0x594aed,_0x28a44c[_0x13e8('0x11')][_0x13e8('0x12')]);return _0xc7555f(_0x28a44c[_0x13e8('0x11')][_0x13e8('0x12')]);}else{logger[_0x13e8('0xb')]('DeskAccount,\x20%s,\x20%s',_0x594aed,_0x13e8('0xd'));_0xc7555f(_0x28a44c[_0x13e8('0x13')][_0x13e8('0x12')]);}})['catch'](function(_0x5301ae){logger['error']('DeskAccount,\x20%s,\x20%s',_0x594aed,_0x5301ae);_0x380fc0(_0x5301ae);});});}exports[_0x13e8('0x14')]=function(_0x28a0b5){var _0xd8a444=this;return new Promise(function(_0x1c2bfd,_0x1b8552){return db['DeskAccount'][_0x13e8('0x15')]({'raw':_0x28a0b5['options']?_0x28a0b5[_0x13e8('0x16')][_0x13e8('0x17')]===undefined?!![]:![]:!![],'where':_0x28a0b5[_0x13e8('0x16')]?_0x28a0b5[_0x13e8('0x16')][_0x13e8('0x18')]||null:null,'attributes':_0x28a0b5[_0x13e8('0x16')]?_0x28a0b5[_0x13e8('0x16')][_0x13e8('0x19')]||null:null,'limit':_0x28a0b5['options']?_0x28a0b5[_0x13e8('0x16')][_0x13e8('0x1a')]||null:null,'include':_0x28a0b5['options']?_0x28a0b5[_0x13e8('0x16')][_0x13e8('0x1b')]?_[_0x13e8('0x1c')](_0x28a0b5[_0x13e8('0x16')][_0x13e8('0x1b')],function(_0x2d2a8a){return{'model':db[_0x2d2a8a[_0x13e8('0x1d')]],'as':_0x2d2a8a['as'],'attributes':_0x2d2a8a[_0x13e8('0x19')],'include':_0x2d2a8a['include']?_['map'](_0x2d2a8a[_0x13e8('0x1b')],function(_0xdca1a4){return{'model':db[_0xdca1a4[_0x13e8('0x1d')]],'as':_0xdca1a4['as'],'attributes':_0xdca1a4['attributes'],'include':_0xdca1a4[_0x13e8('0x1b')]?_[_0x13e8('0x1c')](_0xdca1a4[_0x13e8('0x1b')],function(_0x38d1cf){return{'model':db[_0x38d1cf[_0x13e8('0x1d')]],'as':_0x38d1cf['as'],'attributes':_0x38d1cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x13e8('0xa')](function(_0x3b0b27){logger['info'](_0x13e8('0x14'),_0x28a0b5);logger[_0x13e8('0xe')](_0x13e8('0x14'),_0x28a0b5,JSON[_0x13e8('0x10')](_0x3b0b27));_0x1c2bfd(_0x3b0b27);})[_0x13e8('0x1e')](function(_0x32a18e){logger[_0x13e8('0x11')](_0x13e8('0x14'),_0x32a18e['message'],_0x28a0b5);_0x1b8552(_0xd8a444['error'](0x1f4,_0x32a18e[_0x13e8('0x12')]));});});};exports[_0x13e8('0x1f')]=function(_0x4d48c5){var _0xc8717d=this;return new Promise(function(_0x4c74b9,_0x271525){return db[_0x13e8('0x20')]['find']({'raw':_0x4d48c5[_0x13e8('0x16')]?_0x4d48c5['options'][_0x13e8('0x17')]===undefined?!![]:![]:!![],'where':_0x4d48c5[_0x13e8('0x16')]?_0x4d48c5['options'][_0x13e8('0x18')]||null:null,'attributes':_0x4d48c5[_0x13e8('0x16')]?_0x4d48c5['options'][_0x13e8('0x19')]||null:null,'include':_0x4d48c5[_0x13e8('0x16')]?_0x4d48c5[_0x13e8('0x16')][_0x13e8('0x1b')]?_['map'](_0x4d48c5[_0x13e8('0x16')][_0x13e8('0x1b')],function(_0x518e90){return{'model':db[_0x518e90[_0x13e8('0x1d')]],'as':_0x518e90['as'],'attributes':_0x518e90[_0x13e8('0x19')],'include':_0x518e90[_0x13e8('0x1b')]?_[_0x13e8('0x1c')](_0x518e90[_0x13e8('0x1b')],function(_0xd15edc){return{'model':db[_0xd15edc[_0x13e8('0x1d')]],'as':_0xd15edc['as'],'attributes':_0xd15edc[_0x13e8('0x19')],'include':_0xd15edc[_0x13e8('0x1b')]?_[_0x13e8('0x1c')](_0xd15edc[_0x13e8('0x1b')],function(_0x28757a){return{'model':db[_0x28757a[_0x13e8('0x1d')]],'as':_0x28757a['as'],'attributes':_0x28757a[_0x13e8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x13e8('0xa')](function(_0x48f854){logger[_0x13e8('0xb')](_0x13e8('0x1f'),_0x4d48c5);logger[_0x13e8('0xe')](_0x13e8('0x1f'),_0x4d48c5,JSON[_0x13e8('0x10')](_0x48f854));_0x4c74b9(_0x48f854);})['catch'](function(_0x5c115d){logger[_0x13e8('0x11')](_0x13e8('0x1f'),_0x5c115d['message'],_0x4d48c5);_0x271525(_0xc8717d[_0x13e8('0x11')](0x1f4,_0x5c115d[_0x13e8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index aa64540..c34c0f8 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 _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x389043,_0x384018){var _0x5667c0=function(_0x5132d2){while(--_0x5132d2){_0x389043['push'](_0x389043['shift']());}};_0x5667c0(++_0x384018);}(_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/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x44295c,_0x3afcb0){var _0x9e992c=function(_0x1f55cb){while(--_0x1f55cb){_0x44295c['push'](_0x44295c['shift']());}};_0x9e992c(++_0x3afcb0);}(_0x34e8,0x12c));var _0x834e=function(_0x348558,_0x554400){_0x348558=_0x348558-0x0;var _0x55a9d1=_0x34e8[_0x348558];return _0x55a9d1;};'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('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 813b099..8ecf705 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 _0x4345=['sequelize','exports'];(function(_0xf4b156,_0x593dd1){var _0xa918cd=function(_0x13cf95){while(--_0x13cf95){_0xf4b156['push'](_0xf4b156['shift']());}};_0xa918cd(++_0x593dd1);}(_0x4345,0xc0));var _0x5434=function(_0x12bb36,_0x33752e){_0x12bb36=_0x12bb36-0x0;var _0x20c461=_0x4345[_0x12bb36];return _0x20c461;};'use strict';var Sequelize=require(_0x5434('0x0'));module[_0x5434('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa978=['exports'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xa978,0x14f));var _0x8a97=function(_0x18806c,_0x5143e2){_0x18806c=_0x18806c-0x0;var _0x417b8e=_0xa978[_0x18806c];return _0x417b8e;};'use strict';var Sequelize=require('sequelize');module[_0x8a97('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index fbbba5c..9971b21 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 _0x3c4b=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','destroy','getFields','findOne','DeskField','order','filter','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','end','error','stack','name','send','map','DeskConfiguration','fieldName','type','key'];(function(_0x4d988f,_0x2b1864){var _0x3adabb=function(_0x22fd9a){while(--_0x22fd9a){_0x4d988f['push'](_0x4d988f['shift']());}};_0x3adabb(++_0x2b1864);}(_0x3c4b,0x122));var _0xb3c4=function(_0x2336f7,_0x586429){_0x2336f7=_0x2336f7-0x0;var _0x4689d1=_0x3c4b[_0x2336f7];return _0x4689d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb3c4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb3c4('0x1'));var rp=require('request-promise');var moment=require(_0xb3c4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb3c4('0x3'));var util=require(_0xb3c4('0x4'));var path=require(_0xb3c4('0x5'));var sox=require(_0xb3c4('0x6'));var csv=require(_0xb3c4('0x7'));var ejs=require(_0xb3c4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb3c4('0x9'));var squel=require(_0xb3c4('0xa'));var crypto=require('crypto');var jsforce=require(_0xb3c4('0xb'));var deskjs=require(_0xb3c4('0xc'));var toCsv=require(_0xb3c4('0x7'));var querystring=require(_0xb3c4('0xd'));var Papa=require(_0xb3c4('0xe'));var Redis=require('ioredis');var authService=require(_0xb3c4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb3c4('0x10'));var hardwareService=require(_0xb3c4('0x11'));var logger=require(_0xb3c4('0x12'))(_0xb3c4('0x13'));var utils=require(_0xb3c4('0x14'));var config=require(_0xb3c4('0x15'));var licenseUtil=require(_0xb3c4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44e810,_0x3daff2){_0x3daff2=_0x3daff2||0xcc;return function(_0x3a20fb){if(_0x3a20fb){return _0x44e810[_0xb3c4('0x17')](_0x3daff2);}return _0x44e810[_0xb3c4('0x18')](_0x3daff2)['end']();};}function respondWithResult(_0x164f93,_0x5a4a13){_0x5a4a13=_0x5a4a13||0xc8;return function(_0x17b123){if(_0x17b123){return _0x164f93[_0xb3c4('0x18')](_0x5a4a13)['json'](_0x17b123);}};}function respondWithFilteredResult(_0x47e062,_0x1e8fae){return function(_0xda19ce){if(_0xda19ce){var _0x4f5e36=typeof _0x1e8fae[_0xb3c4('0x19')]==='undefined'&&typeof _0x1e8fae[_0xb3c4('0x1a')]===_0xb3c4('0x1b');var _0x56f52e=_0xda19ce[_0xb3c4('0x1c')];var _0x4aa1a0=_0x4f5e36?0x0:_0x1e8fae[_0xb3c4('0x19')];var _0x3b15a8=_0x4f5e36?_0xda19ce[_0xb3c4('0x1c')]:_0x1e8fae[_0xb3c4('0x19')]+_0x1e8fae[_0xb3c4('0x1a')];var _0x36695a;if(_0x3b15a8>=_0x56f52e){_0x3b15a8=_0x56f52e;_0x36695a=0xc8;}else{_0x36695a=0xce;}_0x47e062[_0xb3c4('0x18')](_0x36695a);return _0x47e062[_0xb3c4('0x1d')](_0xb3c4('0x1e'),_0x4aa1a0+'-'+_0x3b15a8+'/'+_0x56f52e)[_0xb3c4('0x1f')](_0xda19ce);}return null;};}function patchUpdates(_0x4616d9){return function(_0x3ed9d6){try{jsonpatch[_0xb3c4('0x20')](_0x3ed9d6,_0x4616d9,!![]);}catch(_0x396f86){return BPromise[_0xb3c4('0x21')](_0x396f86);}return _0x3ed9d6[_0xb3c4('0x22')]();};}function saveUpdates(_0x23c7eb,_0x4adffa){return function(_0x11d6fd){if(_0x11d6fd){return _0x11d6fd['update'](_0x23c7eb)[_0xb3c4('0x23')](function(_0x4cab4d){return _0x4cab4d;});}return null;};}function removeEntity(_0x54d8ef,_0x28d9cb){return function(_0xfa9e8c){if(_0xfa9e8c){return _0xfa9e8c['destroy']()['then'](function(){_0x54d8ef[_0xb3c4('0x18')](0xcc)[_0xb3c4('0x24')]();});}};}function handleEntityNotFound(_0x111992,_0x2a226){return function(_0x399282){if(!_0x399282){_0x111992[_0xb3c4('0x17')](0x194);}return _0x399282;};}function handleError(_0xd5538d,_0x25bedb){_0x25bedb=_0x25bedb||0x1f4;return function(_0x19de7b){logger[_0xb3c4('0x25')](_0x19de7b[_0xb3c4('0x26')]);if(_0x19de7b['name']){delete _0x19de7b[_0xb3c4('0x27')];}_0xd5538d['status'](_0x25bedb)[_0xb3c4('0x28')](_0x19de7b);};}exports['index']=function(_0x4ad05e,_0x25ef01){var _0x84d456={},_0x4ede34={},_0x5c7d3f={'count':0x0,'rows':[]};var _0x4e6137=_[_0xb3c4('0x29')](db[_0xb3c4('0x2a')]['rawAttributes'],function(_0x1c0e19){return{'name':_0x1c0e19[_0xb3c4('0x2b')],'type':_0x1c0e19[_0xb3c4('0x2c')][_0xb3c4('0x2d')]};});_0x4ede34[_0xb3c4('0x2e')]=_[_0xb3c4('0x29')](_0x4e6137,_0xb3c4('0x27'));_0x4ede34[_0xb3c4('0x2f')]=_[_0xb3c4('0x30')](_0x4ad05e[_0xb3c4('0x2f')]);_0x4ede34[_0xb3c4('0x31')]=_[_0xb3c4('0x32')](_0x4ede34[_0xb3c4('0x2e')],_0x4ede34['query']);_0x84d456[_0xb3c4('0x33')]=_[_0xb3c4('0x32')](_0x4ede34['model'],qs[_0xb3c4('0x34')](_0x4ad05e[_0xb3c4('0x2f')][_0xb3c4('0x34')]));_0x84d456['attributes']=_0x84d456['attributes'][_0xb3c4('0x35')]?_0x84d456['attributes']:_0x4ede34['model'];if(!_0x4ad05e['query'][_0xb3c4('0x36')](_0xb3c4('0x37'))){_0x84d456[_0xb3c4('0x1a')]=qs[_0xb3c4('0x1a')](_0x4ad05e['query'][_0xb3c4('0x1a')]);_0x84d456['offset']=qs[_0xb3c4('0x19')](_0x4ad05e[_0xb3c4('0x2f')][_0xb3c4('0x19')]);}_0x84d456['order']=qs[_0xb3c4('0x38')](_0x4ad05e[_0xb3c4('0x2f')][_0xb3c4('0x38')]);_0x84d456[_0xb3c4('0x39')]=qs[_0xb3c4('0x31')](_[_0xb3c4('0x3a')](_0x4ad05e[_0xb3c4('0x2f')],_0x4ede34[_0xb3c4('0x31')]),_0x4e6137);if(_0x4ad05e[_0xb3c4('0x2f')]['filter']){_0x84d456[_0xb3c4('0x39')]=_['merge'](_0x84d456[_0xb3c4('0x39')],{'$or':_[_0xb3c4('0x29')](_0x4e6137,function(_0x12d0f8){if(_0x12d0f8[_0xb3c4('0x2c')]!==_0xb3c4('0x3b')){var _0x40b774={};_0x40b774[_0x12d0f8[_0xb3c4('0x27')]]={'$like':'%'+_0x4ad05e[_0xb3c4('0x2f')]['filter']+'%'};return _0x40b774;}})});}_0x84d456=_[_0xb3c4('0x3c')]({},_0x84d456,_0x4ad05e['options']);var _0xe4b8ce={'where':_0x84d456['where']};return db[_0xb3c4('0x2a')][_0xb3c4('0x1c')](_0xe4b8ce)['then'](function(_0x2b0df4){_0x5c7d3f['count']=_0x2b0df4;if(_0x4ad05e[_0xb3c4('0x2f')][_0xb3c4('0x3d')]){_0x84d456['include']=[{'all':!![]}];}return db[_0xb3c4('0x2a')][_0xb3c4('0x3e')](_0x84d456);})[_0xb3c4('0x23')](function(_0x414ac9){_0x5c7d3f[_0xb3c4('0x3f')]=_0x414ac9;return _0x5c7d3f;})[_0xb3c4('0x23')](respondWithFilteredResult(_0x25ef01,_0x84d456))[_0xb3c4('0x40')](handleError(_0x25ef01,null));};exports[_0xb3c4('0x41')]=function(_0x20098a,_0x1d663e){var _0x1c7fd9={'raw':![],'where':{'id':_0x20098a[_0xb3c4('0x42')]['id']}},_0x100340={};_0x100340[_0xb3c4('0x2e')]=_[_0xb3c4('0x30')](db[_0xb3c4('0x2a')][_0xb3c4('0x43')]);_0x100340['query']=_[_0xb3c4('0x30')](_0x20098a[_0xb3c4('0x2f')]);_0x100340[_0xb3c4('0x31')]=_['intersection'](_0x100340[_0xb3c4('0x2e')],_0x100340[_0xb3c4('0x2f')]);_0x1c7fd9[_0xb3c4('0x33')]=_[_0xb3c4('0x32')](_0x100340[_0xb3c4('0x2e')],qs['fields'](_0x20098a['query'][_0xb3c4('0x34')]));_0x1c7fd9[_0xb3c4('0x33')]=_0x1c7fd9[_0xb3c4('0x33')]['length']?_0x1c7fd9['attributes']:_0x100340[_0xb3c4('0x2e')];if(_0x20098a['query'][_0xb3c4('0x3d')]){_0x1c7fd9[_0xb3c4('0x44')]=[{'all':!![]}];}_0x1c7fd9=_['merge']({},_0x1c7fd9,_0x20098a[_0xb3c4('0x45')]);return db['DeskConfiguration'][_0xb3c4('0x46')](_0x1c7fd9)[_0xb3c4('0x23')](handleEntityNotFound(_0x1d663e,null))[_0xb3c4('0x23')](respondWithResult(_0x1d663e,null))['catch'](handleError(_0x1d663e,null));};exports[_0xb3c4('0x47')]=function(_0x4e63a6,_0x4ba547){return db[_0xb3c4('0x2a')][_0xb3c4('0x47')](_0x4e63a6[_0xb3c4('0x48')],{})['then'](respondWithResult(_0x4ba547,0xc9))[_0xb3c4('0x40')](handleError(_0x4ba547,null));};exports['update']=function(_0x5c338a,_0x3fc537){if(_0x5c338a['body']['id']){delete _0x5c338a['body']['id'];}return db[_0xb3c4('0x2a')]['find']({'where':{'id':_0x5c338a[_0xb3c4('0x42')]['id']}})['then'](handleEntityNotFound(_0x3fc537,null))[_0xb3c4('0x23')](saveUpdates(_0x5c338a[_0xb3c4('0x48')],null))[_0xb3c4('0x23')](respondWithResult(_0x3fc537,null))['catch'](handleError(_0x3fc537,null));};exports[_0xb3c4('0x49')]=function(_0x15a9bd,_0x1fb315){return db[_0xb3c4('0x2a')]['find']({'where':{'id':_0x15a9bd[_0xb3c4('0x42')]['id']}})[_0xb3c4('0x23')](handleEntityNotFound(_0x1fb315,null))[_0xb3c4('0x23')](removeEntity(_0x1fb315,null))[_0xb3c4('0x40')](handleError(_0x1fb315,null));};exports[_0xb3c4('0x4a')]=function(_0x415935,_0x1ba931,_0x47e180){var _0x50b3cc={};var _0x4a39b2={};var _0x23bb04;var _0x3b1997;return db[_0xb3c4('0x2a')][_0xb3c4('0x4b')]({'where':{'id':_0x415935['params']['id']}})[_0xb3c4('0x23')](handleEntityNotFound(_0x1ba931,null))[_0xb3c4('0x23')](function(_0x572a7d){if(_0x572a7d){_0x23bb04=_0x572a7d;_0x4a39b2[_0xb3c4('0x2e')]=_[_0xb3c4('0x30')](db[_0xb3c4('0x4c')][_0xb3c4('0x43')]);_0x4a39b2[_0xb3c4('0x2f')]=_[_0xb3c4('0x30')](_0x415935[_0xb3c4('0x2f')]);_0x4a39b2['filters']=_[_0xb3c4('0x32')](_0x4a39b2[_0xb3c4('0x2e')],_0x4a39b2['query']);_0x50b3cc[_0xb3c4('0x33')]=_['intersection'](_0x4a39b2[_0xb3c4('0x2e')],qs[_0xb3c4('0x34')](_0x415935['query'][_0xb3c4('0x34')]));_0x50b3cc[_0xb3c4('0x33')]=_0x50b3cc['attributes'][_0xb3c4('0x35')]?_0x50b3cc[_0xb3c4('0x33')]:_0x4a39b2[_0xb3c4('0x2e')];_0x50b3cc[_0xb3c4('0x4d')]=qs['sort'](_0x415935['query'][_0xb3c4('0x38')]);_0x50b3cc[_0xb3c4('0x39')]=qs[_0xb3c4('0x31')](_[_0xb3c4('0x3a')](_0x415935[_0xb3c4('0x2f')],_0x4a39b2[_0xb3c4('0x31')]));if(_0x415935[_0xb3c4('0x2f')][_0xb3c4('0x4e')]){_0x50b3cc[_0xb3c4('0x39')]=_[_0xb3c4('0x3c')](_0x50b3cc[_0xb3c4('0x39')],{'$or':_['map'](_0x50b3cc[_0xb3c4('0x33')],function(_0x5ad373){var _0x1390c9={};_0x1390c9[_0x5ad373]={'$like':'%'+_0x415935[_0xb3c4('0x2f')][_0xb3c4('0x4e')]+'%'};return _0x1390c9;})});}_0x50b3cc=_[_0xb3c4('0x3c')]({},_0x50b3cc,_0x415935['options']);return _0x23bb04[_0xb3c4('0x4a')](_0x50b3cc);}})[_0xb3c4('0x23')](function(_0x190507){if(_0x190507){_0x3b1997=_0x190507[_0xb3c4('0x35')];if(!_0x415935[_0xb3c4('0x2f')][_0xb3c4('0x36')](_0xb3c4('0x37'))){_0x50b3cc['limit']=qs[_0xb3c4('0x1a')](_0x415935[_0xb3c4('0x2f')][_0xb3c4('0x1a')]);_0x50b3cc[_0xb3c4('0x19')]=qs[_0xb3c4('0x19')](_0x415935['query']['offset']);}return _0x23bb04['getFields'](_0x50b3cc);}})['then'](function(_0x42eb2a){if(_0x42eb2a){return _0x42eb2a?{'count':_0x3b1997,'rows':_0x42eb2a}:null;}})[_0xb3c4('0x23')](respondWithResult(_0x1ba931,null))[_0xb3c4('0x40')](handleError(_0x1ba931,null));};exports['getSubjects']=function(_0x12cf31,_0x269ec3,_0x247daf){var _0x1595e6={};var _0x48cab2={};var _0x36988d;var _0x593683;return db[_0xb3c4('0x2a')]['findOne']({'where':{'id':_0x12cf31['params']['id']}})[_0xb3c4('0x23')](handleEntityNotFound(_0x269ec3,null))['then'](function(_0x4c8ed5){if(_0x4c8ed5){_0x36988d=_0x4c8ed5;_0x48cab2[_0xb3c4('0x2e')]=_[_0xb3c4('0x30')](db['DeskField']['rawAttributes']);_0x48cab2[_0xb3c4('0x2f')]=_[_0xb3c4('0x30')](_0x12cf31['query']);_0x48cab2[_0xb3c4('0x31')]=_[_0xb3c4('0x32')](_0x48cab2['model'],_0x48cab2[_0xb3c4('0x2f')]);_0x1595e6[_0xb3c4('0x33')]=_['intersection'](_0x48cab2[_0xb3c4('0x2e')],qs[_0xb3c4('0x34')](_0x12cf31[_0xb3c4('0x2f')]['fields']));_0x1595e6['attributes']=_0x1595e6[_0xb3c4('0x33')][_0xb3c4('0x35')]?_0x1595e6['attributes']:_0x48cab2[_0xb3c4('0x2e')];_0x1595e6[_0xb3c4('0x4d')]=qs[_0xb3c4('0x38')](_0x12cf31[_0xb3c4('0x2f')][_0xb3c4('0x38')]);_0x1595e6[_0xb3c4('0x39')]=qs[_0xb3c4('0x31')](_['pick'](_0x12cf31[_0xb3c4('0x2f')],_0x48cab2[_0xb3c4('0x31')]));if(_0x12cf31[_0xb3c4('0x2f')]['filter']){_0x1595e6[_0xb3c4('0x39')]=_['merge'](_0x1595e6[_0xb3c4('0x39')],{'$or':_[_0xb3c4('0x29')](_0x1595e6[_0xb3c4('0x33')],function(_0x22b3a4){var _0x2b3a90={};_0x2b3a90[_0x22b3a4]={'$like':'%'+_0x12cf31[_0xb3c4('0x2f')][_0xb3c4('0x4e')]+'%'};return _0x2b3a90;})});}_0x1595e6=_[_0xb3c4('0x3c')]({},_0x1595e6,_0x12cf31['options']);return _0x36988d[_0xb3c4('0x4f')](_0x1595e6);}})[_0xb3c4('0x23')](function(_0x18049b){if(_0x18049b){_0x593683=_0x18049b[_0xb3c4('0x35')];if(!_0x12cf31[_0xb3c4('0x2f')][_0xb3c4('0x36')](_0xb3c4('0x37'))){_0x1595e6[_0xb3c4('0x1a')]=qs[_0xb3c4('0x1a')](_0x12cf31['query'][_0xb3c4('0x1a')]);_0x1595e6[_0xb3c4('0x19')]=qs[_0xb3c4('0x19')](_0x12cf31['query'][_0xb3c4('0x19')]);}return _0x36988d[_0xb3c4('0x4f')](_0x1595e6);}})[_0xb3c4('0x23')](function(_0x3d7b99){if(_0x3d7b99){return _0x3d7b99?{'count':_0x593683,'rows':_0x3d7b99}:null;}})[_0xb3c4('0x23')](respondWithResult(_0x269ec3,null))[_0xb3c4('0x40')](handleError(_0x269ec3,null));};exports['getDescriptions']=function(_0x225bc6,_0x15818e,_0x109cc9){var _0x5a93f3={};var _0x4d4823={};var _0x4662be;var _0x5708a7;return db['DeskConfiguration'][_0xb3c4('0x4b')]({'where':{'id':_0x225bc6['params']['id']}})[_0xb3c4('0x23')](handleEntityNotFound(_0x15818e,null))['then'](function(_0x304ee8){if(_0x304ee8){_0x4662be=_0x304ee8;_0x4d4823[_0xb3c4('0x2e')]=_['keys'](db[_0xb3c4('0x4c')][_0xb3c4('0x43')]);_0x4d4823[_0xb3c4('0x2f')]=_[_0xb3c4('0x30')](_0x225bc6[_0xb3c4('0x2f')]);_0x4d4823[_0xb3c4('0x31')]=_[_0xb3c4('0x32')](_0x4d4823[_0xb3c4('0x2e')],_0x4d4823[_0xb3c4('0x2f')]);_0x5a93f3[_0xb3c4('0x33')]=_[_0xb3c4('0x32')](_0x4d4823[_0xb3c4('0x2e')],qs[_0xb3c4('0x34')](_0x225bc6[_0xb3c4('0x2f')][_0xb3c4('0x34')]));_0x5a93f3['attributes']=_0x5a93f3[_0xb3c4('0x33')]['length']?_0x5a93f3[_0xb3c4('0x33')]:_0x4d4823['model'];_0x5a93f3[_0xb3c4('0x4d')]=qs[_0xb3c4('0x38')](_0x225bc6['query']['sort']);_0x5a93f3[_0xb3c4('0x39')]=qs[_0xb3c4('0x31')](_[_0xb3c4('0x3a')](_0x225bc6[_0xb3c4('0x2f')],_0x4d4823['filters']));if(_0x225bc6[_0xb3c4('0x2f')][_0xb3c4('0x4e')]){_0x5a93f3[_0xb3c4('0x39')]=_[_0xb3c4('0x3c')](_0x5a93f3[_0xb3c4('0x39')],{'$or':_[_0xb3c4('0x29')](_0x5a93f3[_0xb3c4('0x33')],function(_0x46d949){var _0x44a424={};_0x44a424[_0x46d949]={'$like':'%'+_0x225bc6[_0xb3c4('0x2f')]['filter']+'%'};return _0x44a424;})});}_0x5a93f3=_[_0xb3c4('0x3c')]({},_0x5a93f3,_0x225bc6['options']);return _0x4662be[_0xb3c4('0x50')](_0x5a93f3);}})[_0xb3c4('0x23')](function(_0x2d58a5){if(_0x2d58a5){_0x5708a7=_0x2d58a5[_0xb3c4('0x35')];if(!_0x225bc6['query']['hasOwnProperty'](_0xb3c4('0x37'))){_0x5a93f3['limit']=qs[_0xb3c4('0x1a')](_0x225bc6['query']['limit']);_0x5a93f3['offset']=qs[_0xb3c4('0x19')](_0x225bc6[_0xb3c4('0x2f')][_0xb3c4('0x19')]);}return _0x4662be[_0xb3c4('0x50')](_0x5a93f3);}})[_0xb3c4('0x23')](function(_0x203b28){if(_0x203b28){return _0x203b28?{'count':_0x5708a7,'rows':_0x203b28}:null;}})['then'](respondWithResult(_0x15818e,null))[_0xb3c4('0x40')](handleError(_0x15818e,null));};exports[_0xb3c4('0x51')]=function(_0x56a3d8,_0x3b2495,_0x139d42){var _0x336eb6={};var _0x3b5cbc={};var _0x5c658f;var _0x78e8db;return db[_0xb3c4('0x2a')][_0xb3c4('0x4b')]({'where':{'id':_0x56a3d8[_0xb3c4('0x42')]['id']}})[_0xb3c4('0x23')](handleEntityNotFound(_0x3b2495,null))[_0xb3c4('0x23')](function(_0x5e77ff){if(_0x5e77ff){_0x5c658f=_0x5e77ff;_0x3b5cbc['model']=_['keys'](db['Tag'][_0xb3c4('0x43')]);_0x3b5cbc[_0xb3c4('0x2f')]=_['keys'](_0x56a3d8[_0xb3c4('0x2f')]);_0x3b5cbc['filters']=_['intersection'](_0x3b5cbc[_0xb3c4('0x2e')],_0x3b5cbc[_0xb3c4('0x2f')]);_0x336eb6['attributes']=_[_0xb3c4('0x32')](_0x3b5cbc[_0xb3c4('0x2e')],qs[_0xb3c4('0x34')](_0x56a3d8['query'][_0xb3c4('0x34')]));_0x336eb6['attributes']=_0x336eb6[_0xb3c4('0x33')][_0xb3c4('0x35')]?_0x336eb6[_0xb3c4('0x33')]:_0x3b5cbc[_0xb3c4('0x2e')];_0x336eb6[_0xb3c4('0x4d')]=qs[_0xb3c4('0x38')](_0x56a3d8[_0xb3c4('0x2f')][_0xb3c4('0x38')]);_0x336eb6[_0xb3c4('0x39')]=qs['filters'](_[_0xb3c4('0x3a')](_0x56a3d8[_0xb3c4('0x2f')],_0x3b5cbc[_0xb3c4('0x31')]));if(_0x56a3d8[_0xb3c4('0x2f')]['filter']){_0x336eb6[_0xb3c4('0x39')]=_[_0xb3c4('0x3c')](_0x336eb6[_0xb3c4('0x39')],{'$or':_[_0xb3c4('0x29')](_0x336eb6[_0xb3c4('0x33')],function(_0x4028ba){var _0x23459d={};_0x23459d[_0x4028ba]={'$like':'%'+_0x56a3d8[_0xb3c4('0x2f')]['filter']+'%'};return _0x23459d;})});}_0x336eb6=_[_0xb3c4('0x3c')]({},_0x336eb6,_0x56a3d8[_0xb3c4('0x45')]);return _0x5c658f[_0xb3c4('0x51')](_0x336eb6);}})['then'](function(_0x2dde1a){if(_0x2dde1a){_0x78e8db=_0x2dde1a[_0xb3c4('0x35')];if(!_0x56a3d8[_0xb3c4('0x2f')][_0xb3c4('0x36')]('nolimit')){_0x336eb6['limit']=qs[_0xb3c4('0x1a')](_0x56a3d8[_0xb3c4('0x2f')]['limit']);_0x336eb6['offset']=qs[_0xb3c4('0x19')](_0x56a3d8['query'][_0xb3c4('0x19')]);}return _0x5c658f['getTags'](_0x336eb6);}})[_0xb3c4('0x23')](function(_0x259fa4){if(_0x259fa4){return _0x259fa4?{'count':_0x78e8db,'rows':_0x259fa4}:null;}})[_0xb3c4('0x23')](respondWithResult(_0x3b2495,null))[_0xb3c4('0x40')](handleError(_0x3b2495,null));};exports['setTags']=function(_0x232cb6,_0x1e7528,_0x2fcb66){if(_0x232cb6[_0xb3c4('0x48')]['id']){delete _0x232cb6[_0xb3c4('0x48')]['id'];}return db['DeskConfiguration'][_0xb3c4('0x4b')]({'where':{'id':_0x232cb6['params']['id']}})[_0xb3c4('0x23')](handleEntityNotFound(_0x1e7528,null))[_0xb3c4('0x23')](function(_0x4cb73f){if(_0x4cb73f){return _0x4cb73f[_0xb3c4('0x52')](_0x232cb6[_0xb3c4('0x48')][_0xb3c4('0x53')]||[]);}return null;})[_0xb3c4('0x23')](respondWithResult(_0x1e7528,null))[_0xb3c4('0x40')](handleError(_0x1e7528,null));}; \ No newline at end of file +var _0xcbb3=['sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','destroy','error','stack','name','send','index','map','DeskConfiguration','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','findOne','DeskField','order','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2a6059,_0x5388ae){var _0x4f1050=function(_0x29b2a8){while(--_0x29b2a8){_0x2a6059['push'](_0x2a6059['shift']());}};_0x4f1050(++_0x5388ae);}(_0xcbb3,0x1ea));var _0x3cbb=function(_0x34689d,_0x4b6403){_0x34689d=_0x34689d-0x0;var _0x3853c7=_0xcbb3[_0x34689d];return _0x3853c7;};'use strict';var emlformat=require(_0x3cbb('0x0'));var rimraf=require(_0x3cbb('0x1'));var zipdir=require(_0x3cbb('0x2'));var jsonpatch=require(_0x3cbb('0x3'));var rp=require(_0x3cbb('0x4'));var moment=require(_0x3cbb('0x5'));var BPromise=require(_0x3cbb('0x6'));var Mustache=require(_0x3cbb('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3cbb('0x8'));var csv=require('to-csv');var ejs=require(_0x3cbb('0x9'));var fs=require('fs');var fs_extra=require(_0x3cbb('0xa'));var _=require('lodash');var squel=require(_0x3cbb('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3cbb('0xc'));var toCsv=require(_0x3cbb('0xd'));var querystring=require(_0x3cbb('0xe'));var Papa=require(_0x3cbb('0xf'));var Redis=require(_0x3cbb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3cbb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3cbb('0x12'));var logger=require(_0x3cbb('0x13'))(_0x3cbb('0x14'));var utils=require(_0x3cbb('0x15'));var config=require(_0x3cbb('0x16'));var licenseUtil=require(_0x3cbb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a8cfe,_0x51e1c0){_0x51e1c0=_0x51e1c0||0xcc;return function(_0x4a4e35){if(_0x4a4e35){return _0x2a8cfe[_0x3cbb('0x18')](_0x51e1c0);}return _0x2a8cfe[_0x3cbb('0x19')](_0x51e1c0)[_0x3cbb('0x1a')]();};}function respondWithResult(_0x422e65,_0x2ffdac){_0x2ffdac=_0x2ffdac||0xc8;return function(_0x838e86){if(_0x838e86){return _0x422e65['status'](_0x2ffdac)[_0x3cbb('0x1b')](_0x838e86);}};}function respondWithFilteredResult(_0xbb0b3e,_0x24c379){return function(_0x43c795){if(_0x43c795){var _0x6a2231=typeof _0x24c379[_0x3cbb('0x1c')]==='undefined'&&typeof _0x24c379[_0x3cbb('0x1d')]===_0x3cbb('0x1e');var _0x5d8258=_0x43c795['count'];var _0x1f0022=_0x6a2231?0x0:_0x24c379[_0x3cbb('0x1c')];var _0xd6e6a7=_0x6a2231?_0x43c795[_0x3cbb('0x1f')]:_0x24c379[_0x3cbb('0x1c')]+_0x24c379[_0x3cbb('0x1d')];var _0x59beaf;if(_0xd6e6a7>=_0x5d8258){_0xd6e6a7=_0x5d8258;_0x59beaf=0xc8;}else{_0x59beaf=0xce;}_0xbb0b3e[_0x3cbb('0x19')](_0x59beaf);return _0xbb0b3e[_0x3cbb('0x20')]('Content-Range',_0x1f0022+'-'+_0xd6e6a7+'/'+_0x5d8258)[_0x3cbb('0x1b')](_0x43c795);}return null;};}function patchUpdates(_0x892276){return function(_0x3c367b){try{jsonpatch[_0x3cbb('0x21')](_0x3c367b,_0x892276,!![]);}catch(_0x183731){return BPromise[_0x3cbb('0x22')](_0x183731);}return _0x3c367b[_0x3cbb('0x23')]();};}function saveUpdates(_0x3633ef,_0x51d600){return function(_0x3e3855){if(_0x3e3855){return _0x3e3855['update'](_0x3633ef)['then'](function(_0x5046ce){return _0x5046ce;});}return null;};}function removeEntity(_0xd7c905,_0x4e2751){return function(_0x4f431e){if(_0x4f431e){return _0x4f431e[_0x3cbb('0x24')]()['then'](function(){_0xd7c905[_0x3cbb('0x19')](0xcc)[_0x3cbb('0x1a')]();});}};}function handleEntityNotFound(_0x1f9a7c,_0xcfb3a9){return function(_0x57fd2d){if(!_0x57fd2d){_0x1f9a7c['sendStatus'](0x194);}return _0x57fd2d;};}function handleError(_0x5ce034,_0x333f8a){_0x333f8a=_0x333f8a||0x1f4;return function(_0xf94890){logger[_0x3cbb('0x25')](_0xf94890[_0x3cbb('0x26')]);if(_0xf94890[_0x3cbb('0x27')]){delete _0xf94890[_0x3cbb('0x27')];}_0x5ce034[_0x3cbb('0x19')](_0x333f8a)[_0x3cbb('0x28')](_0xf94890);};}exports[_0x3cbb('0x29')]=function(_0x2b956b,_0x30d4f2){var _0x181fd3={},_0x2057ae={},_0x46c09={'count':0x0,'rows':[]};var _0x233e46=_[_0x3cbb('0x2a')](db[_0x3cbb('0x2b')]['rawAttributes'],function(_0x500df9){return{'name':_0x500df9['fieldName'],'type':_0x500df9['type'][_0x3cbb('0x2c')]};});_0x2057ae['model']=_[_0x3cbb('0x2a')](_0x233e46,_0x3cbb('0x27'));_0x2057ae['query']=_[_0x3cbb('0x2d')](_0x2b956b[_0x3cbb('0x2e')]);_0x2057ae[_0x3cbb('0x2f')]=_[_0x3cbb('0x30')](_0x2057ae[_0x3cbb('0x31')],_0x2057ae[_0x3cbb('0x2e')]);_0x181fd3[_0x3cbb('0x32')]=_[_0x3cbb('0x30')](_0x2057ae['model'],qs[_0x3cbb('0x33')](_0x2b956b[_0x3cbb('0x2e')][_0x3cbb('0x33')]));_0x181fd3[_0x3cbb('0x32')]=_0x181fd3[_0x3cbb('0x32')][_0x3cbb('0x34')]?_0x181fd3[_0x3cbb('0x32')]:_0x2057ae[_0x3cbb('0x31')];if(!_0x2b956b[_0x3cbb('0x2e')][_0x3cbb('0x35')](_0x3cbb('0x36'))){_0x181fd3[_0x3cbb('0x1d')]=qs[_0x3cbb('0x1d')](_0x2b956b[_0x3cbb('0x2e')][_0x3cbb('0x1d')]);_0x181fd3[_0x3cbb('0x1c')]=qs['offset'](_0x2b956b[_0x3cbb('0x2e')][_0x3cbb('0x1c')]);}_0x181fd3['order']=qs[_0x3cbb('0x37')](_0x2b956b[_0x3cbb('0x2e')][_0x3cbb('0x37')]);_0x181fd3['where']=qs[_0x3cbb('0x2f')](_[_0x3cbb('0x38')](_0x2b956b[_0x3cbb('0x2e')],_0x2057ae[_0x3cbb('0x2f')]),_0x233e46);if(_0x2b956b['query'][_0x3cbb('0x39')]){_0x181fd3[_0x3cbb('0x3a')]=_[_0x3cbb('0x3b')](_0x181fd3[_0x3cbb('0x3a')],{'$or':_[_0x3cbb('0x2a')](_0x233e46,function(_0x2fabd0){if(_0x2fabd0['type']!==_0x3cbb('0x3c')){var _0x1fa6cb={};_0x1fa6cb[_0x2fabd0[_0x3cbb('0x27')]]={'$like':'%'+_0x2b956b['query'][_0x3cbb('0x39')]+'%'};return _0x1fa6cb;}})});}_0x181fd3=_[_0x3cbb('0x3b')]({},_0x181fd3,_0x2b956b['options']);var _0x3fdc85={'where':_0x181fd3[_0x3cbb('0x3a')]};return db[_0x3cbb('0x2b')]['count'](_0x3fdc85)[_0x3cbb('0x3d')](function(_0x4eb627){_0x46c09[_0x3cbb('0x1f')]=_0x4eb627;if(_0x2b956b[_0x3cbb('0x2e')][_0x3cbb('0x3e')]){_0x181fd3['include']=[{'all':!![]}];}return db[_0x3cbb('0x2b')][_0x3cbb('0x3f')](_0x181fd3);})[_0x3cbb('0x3d')](function(_0x2b244e){_0x46c09[_0x3cbb('0x40')]=_0x2b244e;return _0x46c09;})[_0x3cbb('0x3d')](respondWithFilteredResult(_0x30d4f2,_0x181fd3))['catch'](handleError(_0x30d4f2,null));};exports[_0x3cbb('0x41')]=function(_0x14ebcb,_0x56bf67){var _0x29dcec={'raw':![],'where':{'id':_0x14ebcb[_0x3cbb('0x42')]['id']}},_0x2ad7ca={};_0x2ad7ca['model']=_[_0x3cbb('0x2d')](db[_0x3cbb('0x2b')][_0x3cbb('0x43')]);_0x2ad7ca[_0x3cbb('0x2e')]=_[_0x3cbb('0x2d')](_0x14ebcb[_0x3cbb('0x2e')]);_0x2ad7ca[_0x3cbb('0x2f')]=_[_0x3cbb('0x30')](_0x2ad7ca[_0x3cbb('0x31')],_0x2ad7ca[_0x3cbb('0x2e')]);_0x29dcec[_0x3cbb('0x32')]=_['intersection'](_0x2ad7ca[_0x3cbb('0x31')],qs['fields'](_0x14ebcb[_0x3cbb('0x2e')][_0x3cbb('0x33')]));_0x29dcec[_0x3cbb('0x32')]=_0x29dcec[_0x3cbb('0x32')]['length']?_0x29dcec[_0x3cbb('0x32')]:_0x2ad7ca[_0x3cbb('0x31')];if(_0x14ebcb[_0x3cbb('0x2e')]['includeAll']){_0x29dcec['include']=[{'all':!![]}];}_0x29dcec=_[_0x3cbb('0x3b')]({},_0x29dcec,_0x14ebcb[_0x3cbb('0x44')]);return db[_0x3cbb('0x2b')][_0x3cbb('0x45')](_0x29dcec)[_0x3cbb('0x3d')](handleEntityNotFound(_0x56bf67,null))['then'](respondWithResult(_0x56bf67,null))[_0x3cbb('0x46')](handleError(_0x56bf67,null));};exports[_0x3cbb('0x47')]=function(_0x4bace6,_0x12c94f){return db[_0x3cbb('0x2b')][_0x3cbb('0x47')](_0x4bace6[_0x3cbb('0x48')],{})[_0x3cbb('0x3d')](respondWithResult(_0x12c94f,0xc9))['catch'](handleError(_0x12c94f,null));};exports['update']=function(_0x434f55,_0x3c0cc1){if(_0x434f55[_0x3cbb('0x48')]['id']){delete _0x434f55['body']['id'];}return db[_0x3cbb('0x2b')][_0x3cbb('0x45')]({'where':{'id':_0x434f55[_0x3cbb('0x42')]['id']}})[_0x3cbb('0x3d')](handleEntityNotFound(_0x3c0cc1,null))[_0x3cbb('0x3d')](saveUpdates(_0x434f55[_0x3cbb('0x48')],null))[_0x3cbb('0x3d')](respondWithResult(_0x3c0cc1,null))[_0x3cbb('0x46')](handleError(_0x3c0cc1,null));};exports[_0x3cbb('0x24')]=function(_0x541402,_0x6ada0c){return db[_0x3cbb('0x2b')][_0x3cbb('0x45')]({'where':{'id':_0x541402[_0x3cbb('0x42')]['id']}})[_0x3cbb('0x3d')](handleEntityNotFound(_0x6ada0c,null))[_0x3cbb('0x3d')](removeEntity(_0x6ada0c,null))['catch'](handleError(_0x6ada0c,null));};exports['getFields']=function(_0x44ab56,_0x35604f,_0x44b08d){var _0xe3f8bb={};var _0x4e4b60={};var _0x4354c8;var _0x568d44;return db['DeskConfiguration'][_0x3cbb('0x49')]({'where':{'id':_0x44ab56[_0x3cbb('0x42')]['id']}})['then'](handleEntityNotFound(_0x35604f,null))[_0x3cbb('0x3d')](function(_0x310430){if(_0x310430){_0x4354c8=_0x310430;_0x4e4b60[_0x3cbb('0x31')]=_[_0x3cbb('0x2d')](db[_0x3cbb('0x4a')][_0x3cbb('0x43')]);_0x4e4b60[_0x3cbb('0x2e')]=_[_0x3cbb('0x2d')](_0x44ab56[_0x3cbb('0x2e')]);_0x4e4b60[_0x3cbb('0x2f')]=_[_0x3cbb('0x30')](_0x4e4b60[_0x3cbb('0x31')],_0x4e4b60[_0x3cbb('0x2e')]);_0xe3f8bb[_0x3cbb('0x32')]=_[_0x3cbb('0x30')](_0x4e4b60['model'],qs[_0x3cbb('0x33')](_0x44ab56['query'][_0x3cbb('0x33')]));_0xe3f8bb[_0x3cbb('0x32')]=_0xe3f8bb['attributes'][_0x3cbb('0x34')]?_0xe3f8bb[_0x3cbb('0x32')]:_0x4e4b60[_0x3cbb('0x31')];_0xe3f8bb[_0x3cbb('0x4b')]=qs['sort'](_0x44ab56[_0x3cbb('0x2e')]['sort']);_0xe3f8bb[_0x3cbb('0x3a')]=qs[_0x3cbb('0x2f')](_[_0x3cbb('0x38')](_0x44ab56[_0x3cbb('0x2e')],_0x4e4b60[_0x3cbb('0x2f')]));if(_0x44ab56['query'][_0x3cbb('0x39')]){_0xe3f8bb[_0x3cbb('0x3a')]=_[_0x3cbb('0x3b')](_0xe3f8bb[_0x3cbb('0x3a')],{'$or':_[_0x3cbb('0x2a')](_0xe3f8bb[_0x3cbb('0x32')],function(_0x4e56c9){var _0x315414={};_0x315414[_0x4e56c9]={'$like':'%'+_0x44ab56['query'][_0x3cbb('0x39')]+'%'};return _0x315414;})});}_0xe3f8bb=_['merge']({},_0xe3f8bb,_0x44ab56[_0x3cbb('0x44')]);return _0x4354c8[_0x3cbb('0x4c')](_0xe3f8bb);}})[_0x3cbb('0x3d')](function(_0x2ff34e){if(_0x2ff34e){_0x568d44=_0x2ff34e[_0x3cbb('0x34')];if(!_0x44ab56['query'][_0x3cbb('0x35')]('nolimit')){_0xe3f8bb[_0x3cbb('0x1d')]=qs[_0x3cbb('0x1d')](_0x44ab56[_0x3cbb('0x2e')]['limit']);_0xe3f8bb[_0x3cbb('0x1c')]=qs[_0x3cbb('0x1c')](_0x44ab56['query'][_0x3cbb('0x1c')]);}return _0x4354c8[_0x3cbb('0x4c')](_0xe3f8bb);}})['then'](function(_0x7d7979){if(_0x7d7979){return _0x7d7979?{'count':_0x568d44,'rows':_0x7d7979}:null;}})[_0x3cbb('0x3d')](respondWithResult(_0x35604f,null))[_0x3cbb('0x46')](handleError(_0x35604f,null));};exports[_0x3cbb('0x4d')]=function(_0xceffe5,_0x2949fe,_0x405673){var _0x32e864={};var _0x21fc62={};var _0x1fe287;var _0x22448f;return db['DeskConfiguration']['findOne']({'where':{'id':_0xceffe5[_0x3cbb('0x42')]['id']}})[_0x3cbb('0x3d')](handleEntityNotFound(_0x2949fe,null))['then'](function(_0x3bfd32){if(_0x3bfd32){_0x1fe287=_0x3bfd32;_0x21fc62[_0x3cbb('0x31')]=_[_0x3cbb('0x2d')](db['DeskField'][_0x3cbb('0x43')]);_0x21fc62['query']=_[_0x3cbb('0x2d')](_0xceffe5['query']);_0x21fc62[_0x3cbb('0x2f')]=_[_0x3cbb('0x30')](_0x21fc62[_0x3cbb('0x31')],_0x21fc62[_0x3cbb('0x2e')]);_0x32e864[_0x3cbb('0x32')]=_[_0x3cbb('0x30')](_0x21fc62[_0x3cbb('0x31')],qs['fields'](_0xceffe5['query'][_0x3cbb('0x33')]));_0x32e864[_0x3cbb('0x32')]=_0x32e864[_0x3cbb('0x32')]['length']?_0x32e864['attributes']:_0x21fc62[_0x3cbb('0x31')];_0x32e864[_0x3cbb('0x4b')]=qs[_0x3cbb('0x37')](_0xceffe5[_0x3cbb('0x2e')][_0x3cbb('0x37')]);_0x32e864[_0x3cbb('0x3a')]=qs[_0x3cbb('0x2f')](_[_0x3cbb('0x38')](_0xceffe5[_0x3cbb('0x2e')],_0x21fc62[_0x3cbb('0x2f')]));if(_0xceffe5[_0x3cbb('0x2e')][_0x3cbb('0x39')]){_0x32e864[_0x3cbb('0x3a')]=_[_0x3cbb('0x3b')](_0x32e864[_0x3cbb('0x3a')],{'$or':_[_0x3cbb('0x2a')](_0x32e864[_0x3cbb('0x32')],function(_0x33d433){var _0x5629d6={};_0x5629d6[_0x33d433]={'$like':'%'+_0xceffe5[_0x3cbb('0x2e')][_0x3cbb('0x39')]+'%'};return _0x5629d6;})});}_0x32e864=_[_0x3cbb('0x3b')]({},_0x32e864,_0xceffe5[_0x3cbb('0x44')]);return _0x1fe287['getSubjects'](_0x32e864);}})[_0x3cbb('0x3d')](function(_0x3e96a8){if(_0x3e96a8){_0x22448f=_0x3e96a8[_0x3cbb('0x34')];if(!_0xceffe5[_0x3cbb('0x2e')][_0x3cbb('0x35')](_0x3cbb('0x36'))){_0x32e864['limit']=qs[_0x3cbb('0x1d')](_0xceffe5['query'][_0x3cbb('0x1d')]);_0x32e864[_0x3cbb('0x1c')]=qs[_0x3cbb('0x1c')](_0xceffe5[_0x3cbb('0x2e')][_0x3cbb('0x1c')]);}return _0x1fe287[_0x3cbb('0x4d')](_0x32e864);}})[_0x3cbb('0x3d')](function(_0x58ac4b){if(_0x58ac4b){return _0x58ac4b?{'count':_0x22448f,'rows':_0x58ac4b}:null;}})['then'](respondWithResult(_0x2949fe,null))[_0x3cbb('0x46')](handleError(_0x2949fe,null));};exports[_0x3cbb('0x4e')]=function(_0x194979,_0x49d6b4,_0x17c2d1){var _0x2f3e33={};var _0x5c9153={};var _0x6d9501;var _0x4c2683;return db[_0x3cbb('0x2b')]['findOne']({'where':{'id':_0x194979[_0x3cbb('0x42')]['id']}})['then'](handleEntityNotFound(_0x49d6b4,null))[_0x3cbb('0x3d')](function(_0x19eaac){if(_0x19eaac){_0x6d9501=_0x19eaac;_0x5c9153[_0x3cbb('0x31')]=_[_0x3cbb('0x2d')](db[_0x3cbb('0x4a')][_0x3cbb('0x43')]);_0x5c9153[_0x3cbb('0x2e')]=_[_0x3cbb('0x2d')](_0x194979['query']);_0x5c9153[_0x3cbb('0x2f')]=_['intersection'](_0x5c9153[_0x3cbb('0x31')],_0x5c9153['query']);_0x2f3e33[_0x3cbb('0x32')]=_[_0x3cbb('0x30')](_0x5c9153['model'],qs['fields'](_0x194979['query'][_0x3cbb('0x33')]));_0x2f3e33[_0x3cbb('0x32')]=_0x2f3e33[_0x3cbb('0x32')][_0x3cbb('0x34')]?_0x2f3e33[_0x3cbb('0x32')]:_0x5c9153[_0x3cbb('0x31')];_0x2f3e33['order']=qs['sort'](_0x194979[_0x3cbb('0x2e')]['sort']);_0x2f3e33[_0x3cbb('0x3a')]=qs['filters'](_['pick'](_0x194979[_0x3cbb('0x2e')],_0x5c9153[_0x3cbb('0x2f')]));if(_0x194979[_0x3cbb('0x2e')][_0x3cbb('0x39')]){_0x2f3e33['where']=_[_0x3cbb('0x3b')](_0x2f3e33[_0x3cbb('0x3a')],{'$or':_[_0x3cbb('0x2a')](_0x2f3e33[_0x3cbb('0x32')],function(_0x16c3fb){var _0x42a731={};_0x42a731[_0x16c3fb]={'$like':'%'+_0x194979['query'][_0x3cbb('0x39')]+'%'};return _0x42a731;})});}_0x2f3e33=_[_0x3cbb('0x3b')]({},_0x2f3e33,_0x194979['options']);return _0x6d9501[_0x3cbb('0x4e')](_0x2f3e33);}})[_0x3cbb('0x3d')](function(_0x4b082f){if(_0x4b082f){_0x4c2683=_0x4b082f['length'];if(!_0x194979[_0x3cbb('0x2e')][_0x3cbb('0x35')]('nolimit')){_0x2f3e33[_0x3cbb('0x1d')]=qs[_0x3cbb('0x1d')](_0x194979[_0x3cbb('0x2e')]['limit']);_0x2f3e33[_0x3cbb('0x1c')]=qs[_0x3cbb('0x1c')](_0x194979[_0x3cbb('0x2e')]['offset']);}return _0x6d9501[_0x3cbb('0x4e')](_0x2f3e33);}})['then'](function(_0x2679b5){if(_0x2679b5){return _0x2679b5?{'count':_0x4c2683,'rows':_0x2679b5}:null;}})[_0x3cbb('0x3d')](respondWithResult(_0x49d6b4,null))[_0x3cbb('0x46')](handleError(_0x49d6b4,null));};exports[_0x3cbb('0x4f')]=function(_0x7e8552,_0x204ccf,_0x19ee81){var _0x17c98c={};var _0x288522={};var _0x3a655c;var _0xfef92e;return db[_0x3cbb('0x2b')][_0x3cbb('0x49')]({'where':{'id':_0x7e8552['params']['id']}})[_0x3cbb('0x3d')](handleEntityNotFound(_0x204ccf,null))[_0x3cbb('0x3d')](function(_0x1d5b8f){if(_0x1d5b8f){_0x3a655c=_0x1d5b8f;_0x288522[_0x3cbb('0x31')]=_[_0x3cbb('0x2d')](db[_0x3cbb('0x50')]['rawAttributes']);_0x288522['query']=_[_0x3cbb('0x2d')](_0x7e8552[_0x3cbb('0x2e')]);_0x288522[_0x3cbb('0x2f')]=_[_0x3cbb('0x30')](_0x288522['model'],_0x288522[_0x3cbb('0x2e')]);_0x17c98c['attributes']=_[_0x3cbb('0x30')](_0x288522['model'],qs[_0x3cbb('0x33')](_0x7e8552['query']['fields']));_0x17c98c[_0x3cbb('0x32')]=_0x17c98c[_0x3cbb('0x32')]['length']?_0x17c98c[_0x3cbb('0x32')]:_0x288522[_0x3cbb('0x31')];_0x17c98c['order']=qs['sort'](_0x7e8552['query'][_0x3cbb('0x37')]);_0x17c98c[_0x3cbb('0x3a')]=qs[_0x3cbb('0x2f')](_['pick'](_0x7e8552[_0x3cbb('0x2e')],_0x288522[_0x3cbb('0x2f')]));if(_0x7e8552[_0x3cbb('0x2e')]['filter']){_0x17c98c[_0x3cbb('0x3a')]=_[_0x3cbb('0x3b')](_0x17c98c[_0x3cbb('0x3a')],{'$or':_['map'](_0x17c98c[_0x3cbb('0x32')],function(_0x50be6b){var _0x4244b5={};_0x4244b5[_0x50be6b]={'$like':'%'+_0x7e8552[_0x3cbb('0x2e')][_0x3cbb('0x39')]+'%'};return _0x4244b5;})});}_0x17c98c=_[_0x3cbb('0x3b')]({},_0x17c98c,_0x7e8552[_0x3cbb('0x44')]);return _0x3a655c['getTags'](_0x17c98c);}})[_0x3cbb('0x3d')](function(_0x1b209f){if(_0x1b209f){_0xfef92e=_0x1b209f[_0x3cbb('0x34')];if(!_0x7e8552[_0x3cbb('0x2e')][_0x3cbb('0x35')]('nolimit')){_0x17c98c[_0x3cbb('0x1d')]=qs[_0x3cbb('0x1d')](_0x7e8552[_0x3cbb('0x2e')][_0x3cbb('0x1d')]);_0x17c98c[_0x3cbb('0x1c')]=qs[_0x3cbb('0x1c')](_0x7e8552[_0x3cbb('0x2e')][_0x3cbb('0x1c')]);}return _0x3a655c[_0x3cbb('0x4f')](_0x17c98c);}})[_0x3cbb('0x3d')](function(_0x3ffbc0){if(_0x3ffbc0){return _0x3ffbc0?{'count':_0xfef92e,'rows':_0x3ffbc0}:null;}})[_0x3cbb('0x3d')](respondWithResult(_0x204ccf,null))[_0x3cbb('0x46')](handleError(_0x204ccf,null));};exports[_0x3cbb('0x51')]=function(_0x4dbb7d,_0x50f103,_0x177134){if(_0x4dbb7d[_0x3cbb('0x48')]['id']){delete _0x4dbb7d[_0x3cbb('0x48')]['id'];}return db['DeskConfiguration'][_0x3cbb('0x49')]({'where':{'id':_0x4dbb7d[_0x3cbb('0x42')]['id']}})[_0x3cbb('0x3d')](handleEntityNotFound(_0x50f103,null))[_0x3cbb('0x3d')](function(_0x29024a){if(_0x29024a){return _0x29024a['setTags'](_0x4dbb7d[_0x3cbb('0x48')][_0x3cbb('0x52')]||[]);}return null;})[_0x3cbb('0x3d')](respondWithResult(_0x50f103,null))[_0x3cbb('0x46')](handleError(_0x50f103,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index cc58052..b9ffad6 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 _0x281c=['define','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x281c,0x17b));var _0xc281=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x281c[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xc281('0x0'));var logger=require(_0xc281('0x1'))('api');var moment=require(_0xc281('0x2'));var BPromise=require(_0xc281('0x3'));var rp=require(_0xc281('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc281('0x5'));var config=require(_0xc281('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0xc281('0x7')]=function(_0x4bf351,_0x3b10b2){return _0x4bf351[_0xc281('0x8')]('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8262=['define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','exports'];(function(_0x3ceeed,_0x418e70){var _0x25f1b7=function(_0x5cd6e3){while(--_0x5cd6e3){_0x3ceeed['push'](_0x3ceeed['shift']());}};_0x25f1b7(++_0x418e70);}(_0x8262,0x9d));var _0x2826=function(_0x297add,_0x41d63){_0x297add=_0x297add-0x0;var _0x2cd8ba=_0x8262[_0x297add];return _0x2cd8ba;};'use strict';var _=require(_0x2826('0x0'));var util=require(_0x2826('0x1'));var logger=require(_0x2826('0x2'))(_0x2826('0x3'));var moment=require(_0x2826('0x4'));var BPromise=require(_0x2826('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2826('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0x2826('0x7')]=function(_0x22d692,_0x2ba3ea){return _0x22d692[_0x2826('0x8')](_0x2826('0x9'),attributes,{'tableName':_0x2826('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index f47b9d8..c23b314 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 _0x147b=['code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x55a76a,_0x2d0203){var _0x45885a=function(_0x4348d5){while(--_0x4348d5){_0x55a76a['push'](_0x55a76a['shift']());}};_0x45885a(++_0x2d0203);}(_0x147b,0x193));var _0xb147=function(_0x1b776e,_0x1d341e){_0x1b776e=_0x1b776e-0x0;var _0x3b8294=_0x147b[_0x1b776e];return _0x3b8294;};'use strict';var _=require(_0xb147('0x0'));var util=require(_0xb147('0x1'));var moment=require('moment');var BPromise=require(_0xb147('0x2'));var rs=require(_0xb147('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb147('0x4'))['db'];var utils=require(_0xb147('0x5'));var logger=require(_0xb147('0x6'))('rpc');var config=require(_0xb147('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb147('0x8')][_0xb147('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x336146,_0x5e93d8,_0x5456ed){return new BPromise(function(_0x42bbdb,_0x1a1f88){return client[_0xb147('0xa')](_0x336146,_0x5456ed)[_0xb147('0xb')](function(_0xd5122a){logger[_0xb147('0xc')](_0xb147('0xd'),_0x5e93d8,_0xb147('0xe'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5e93d8,_0xb147('0xe'),JSON[_0xb147('0xf')](_0xd5122a));if(_0xd5122a[_0xb147('0x10')]){if(_0xd5122a[_0xb147('0x10')][_0xb147('0x11')]===0x1f4){logger[_0xb147('0x10')](_0xb147('0xd'),_0x5e93d8,_0xd5122a[_0xb147('0x10')][_0xb147('0x12')]);return _0x1a1f88(_0xd5122a[_0xb147('0x10')][_0xb147('0x12')]);}logger['error'](_0xb147('0xd'),_0x5e93d8,_0xd5122a[_0xb147('0x10')][_0xb147('0x12')]);return _0x42bbdb(_0xd5122a[_0xb147('0x10')]['message']);}else{logger[_0xb147('0xc')](_0xb147('0xd'),_0x5e93d8,'request\x20sent');_0x42bbdb(_0xd5122a['result'][_0xb147('0x12')]);}})[_0xb147('0x13')](function(_0x34e3c1){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x5e93d8,_0x34e3c1);_0x1a1f88(_0x34e3c1);});});} \ No newline at end of file +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x28237e,_0x2a7f11){var _0x1c014b=function(_0xaa0d6d){while(--_0xaa0d6d){_0x28237e['push'](_0x28237e['shift']());}};_0x1c014b(++_0x2a7f11);}(_0x14a0,0x8e));var _0x014a=function(_0x723cce,_0x1740f9){_0x723cce=_0x723cce-0x0;var _0x1b3c1f=_0x14a0[_0x723cce];return _0x1b3c1f;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 844b4c0..ec736c3 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 _0x0254=['isAuthenticated','get','/:id','create','put','update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller'];(function(_0x47a870,_0x502e79){var _0x4f0158=function(_0x1d91df){while(--_0x1d91df){_0x47a870['push'](_0x47a870['shift']());}};_0x4f0158(++_0x502e79);}(_0x0254,0x1b8));var _0x4025=function(_0x30367f,_0x18a038){_0x30367f=_0x30367f-0x0;var _0x4033f3=_0x0254[_0x30367f];return _0x4033f3;};'use strict';var multer=require(_0x4025('0x0'));var util=require(_0x4025('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4025('0x2')]();var fs_extra=require(_0x4025('0x3'));var auth=require(_0x4025('0x4'));var interaction=require(_0x4025('0x5'));var config=require(_0x4025('0x6'));var controller=require(_0x4025('0x7'));router['get']('/',auth[_0x4025('0x8')](),controller['index']);router[_0x4025('0x9')](_0x4025('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x4025('0xb')]);router[_0x4025('0xc')](_0x4025('0xa'),auth[_0x4025('0x8')](),controller[_0x4025('0xd')]);router[_0x4025('0xe')](_0x4025('0xa'),auth[_0x4025('0x8')](),controller[_0x4025('0xf')]);module['exports']=router; \ No newline at end of file +var _0xd023=['../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','show','post','create','update','delete','/:id','multer','path','connect-timeout','Router','fs-extra'];(function(_0x6afbc,_0x5b6f76){var _0x4ac2dd=function(_0xe9f744){while(--_0xe9f744){_0x6afbc['push'](_0x6afbc['shift']());}};_0x4ac2dd(++_0x5b6f76);}(_0xd023,0x94));var _0x3d02=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0xd023[_0x39c734];return _0xb2a2f9;};'use strict';var multer=require(_0x3d02('0x0'));var util=require('util');var path=require(_0x3d02('0x1'));var timeout=require(_0x3d02('0x2'));var express=require('express');var router=express[_0x3d02('0x3')]();var fs_extra=require(_0x3d02('0x4'));var auth=require(_0x3d02('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3d02('0x6'));var controller=require(_0x3d02('0x7'));router[_0x3d02('0x8')]('/',auth[_0x3d02('0x9')](),controller[_0x3d02('0xa')]);router[_0x3d02('0x8')]('/:id',auth[_0x3d02('0x9')](),controller[_0x3d02('0xb')]);router[_0x3d02('0xc')]('/',auth[_0x3d02('0x9')](),controller[_0x3d02('0xd')]);router['put']('/:id',auth[_0x3d02('0x9')](),controller[_0x3d02('0xe')]);router[_0x3d02('0xf')](_0x3d02('0x10'),auth[_0x3d02('0x9')](),controller['destroy']);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 7f73ac2..1ffdf1b 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 _0x93a6=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x3dffff,_0x327baa){var _0x5f2d54=function(_0x521f6e){while(--_0x521f6e){_0x3dffff['push'](_0x3dffff['shift']());}};_0x5f2d54(++_0x327baa);}(_0x93a6,0xfb));var _0x693a=function(_0xddfbdc,_0x561a0b){_0xddfbdc=_0xddfbdc-0x0;var _0x395d72=_0x93a6[_0xddfbdc];return _0x395d72;};'use strict';var Sequelize=require(_0x693a('0x0'));module[_0x693a('0x1')]={'type':{'type':Sequelize[_0x693a('0x2')](_0x693a('0x3'),_0x693a('0x4'),_0x693a('0x5'),_0x693a('0x6'),_0x693a('0x7')),'defaultValue':_0x693a('0x3')},'content':{'type':Sequelize[_0x693a('0x8')]},'key':{'type':Sequelize[_0x693a('0x8')]},'keyType':{'type':Sequelize[_0x693a('0x2')](_0x693a('0x3'),'variable',_0x693a('0x5'))},'keyContent':{'type':Sequelize[_0x693a('0x8')]},'idField':{'type':Sequelize[_0x693a('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x693a('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x693a('0x8')]}}; \ No newline at end of file +var _0x8b57=['variable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x44ae0b,_0x3e9865){var _0x69232a=function(_0x5ae588){while(--_0x5ae588){_0x44ae0b['push'](_0x44ae0b['shift']());}};_0x69232a(++_0x3e9865);}(_0x8b57,0x1ac));var _0x78b5=function(_0x73ceb3,_0x31df42){_0x73ceb3=_0x73ceb3-0x0;var _0x2c7bc6=_0x8b57[_0x73ceb3];return _0x2c7bc6;};'use strict';var Sequelize=require(_0x78b5('0x0'));module[_0x78b5('0x1')]={'type':{'type':Sequelize[_0x78b5('0x2')](_0x78b5('0x3'),_0x78b5('0x4'),'customVariable',_0x78b5('0x5'),_0x78b5('0x6')),'defaultValue':_0x78b5('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x78b5('0x2')](_0x78b5('0x3'),_0x78b5('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x78b5('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x78b5('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x78b5('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 686e4c3..4204e12 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 _0x90b5=['intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','then','error','stack','name','send','index','DeskField','rawAttributes','fieldName','key','map','query','keys'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x90b5,0x139));var _0x590b=function(_0x128056,_0x4f314b){_0x128056=_0x128056-0x0;var _0x47da14=_0x90b5[_0x128056];return _0x47da14;};'use strict';var emlformat=require(_0x590b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x590b('0x1'));var jsonpatch=require(_0x590b('0x2'));var rp=require(_0x590b('0x3'));var moment=require(_0x590b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x590b('0x5'));var path=require(_0x590b('0x6'));var sox=require('sox');var csv=require(_0x590b('0x7'));var ejs=require(_0x590b('0x8'));var fs=require('fs');var fs_extra=require(_0x590b('0x9'));var _=require('lodash');var squel=require(_0x590b('0xa'));var crypto=require(_0x590b('0xb'));var jsforce=require(_0x590b('0xc'));var deskjs=require(_0x590b('0xd'));var toCsv=require(_0x590b('0x7'));var querystring=require(_0x590b('0xe'));var Papa=require(_0x590b('0xf'));var Redis=require(_0x590b('0x10'));var authService=require(_0x590b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x590b('0x12'));var hardwareService=require(_0x590b('0x13'));var logger=require('../../config/logger')(_0x590b('0x14'));var utils=require('../../config/utils');var config=require(_0x590b('0x15'));var licenseUtil=require(_0x590b('0x16'));var db=require(_0x590b('0x17'))['db'];function respondWithStatusCode(_0x477069,_0x527487){_0x527487=_0x527487||0xcc;return function(_0xb0ca22){if(_0xb0ca22){return _0x477069[_0x590b('0x18')](_0x527487);}return _0x477069[_0x590b('0x19')](_0x527487)[_0x590b('0x1a')]();};}function respondWithResult(_0x2e85b1,_0x6ad7e7){_0x6ad7e7=_0x6ad7e7||0xc8;return function(_0x45ac04){if(_0x45ac04){return _0x2e85b1[_0x590b('0x19')](_0x6ad7e7)[_0x590b('0x1b')](_0x45ac04);}};}function respondWithFilteredResult(_0x1fbc84,_0x3fc5ca){return function(_0x260f47){if(_0x260f47){var _0x3e4723=typeof _0x3fc5ca[_0x590b('0x1c')]===_0x590b('0x1d')&&typeof _0x3fc5ca['limit']===_0x590b('0x1d');var _0x530e24=_0x260f47[_0x590b('0x1e')];var _0x115309=_0x3e4723?0x0:_0x3fc5ca[_0x590b('0x1c')];var _0x53337c=_0x3e4723?_0x260f47['count']:_0x3fc5ca[_0x590b('0x1c')]+_0x3fc5ca['limit'];var _0x21e771;if(_0x53337c>=_0x530e24){_0x53337c=_0x530e24;_0x21e771=0xc8;}else{_0x21e771=0xce;}_0x1fbc84[_0x590b('0x19')](_0x21e771);return _0x1fbc84[_0x590b('0x1f')]('Content-Range',_0x115309+'-'+_0x53337c+'/'+_0x530e24)[_0x590b('0x1b')](_0x260f47);}return null;};}function patchUpdates(_0x8ab843){return function(_0x2b8ea0){try{jsonpatch[_0x590b('0x20')](_0x2b8ea0,_0x8ab843,!![]);}catch(_0x4990ba){return BPromise[_0x590b('0x21')](_0x4990ba);}return _0x2b8ea0['save']();};}function saveUpdates(_0x10a339,_0x30dc9f){return function(_0x5bdaba){if(_0x5bdaba){return _0x5bdaba['update'](_0x10a339)[_0x590b('0x22')](function(_0x2bcfca){return _0x2bcfca;});}return null;};}function removeEntity(_0x52bdad,_0x21638c){return function(_0x1045d5){if(_0x1045d5){return _0x1045d5['destroy']()['then'](function(){_0x52bdad[_0x590b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39fead,_0x520095){return function(_0x4d3ff9){if(!_0x4d3ff9){_0x39fead[_0x590b('0x18')](0x194);}return _0x4d3ff9;};}function handleError(_0x20571b,_0x5cf6b6){_0x5cf6b6=_0x5cf6b6||0x1f4;return function(_0x1febcd){logger[_0x590b('0x23')](_0x1febcd[_0x590b('0x24')]);if(_0x1febcd[_0x590b('0x25')]){delete _0x1febcd[_0x590b('0x25')];}_0x20571b['status'](_0x5cf6b6)[_0x590b('0x26')](_0x1febcd);};}exports[_0x590b('0x27')]=function(_0x333af8,_0x38a64a){var _0x1ee769={},_0x3b881f={},_0x5ee979={'count':0x0,'rows':[]};var _0x1dfce0=_['map'](db[_0x590b('0x28')][_0x590b('0x29')],function(_0x448ab3){return{'name':_0x448ab3[_0x590b('0x2a')],'type':_0x448ab3['type'][_0x590b('0x2b')]};});_0x3b881f['model']=_[_0x590b('0x2c')](_0x1dfce0,_0x590b('0x25'));_0x3b881f[_0x590b('0x2d')]=_[_0x590b('0x2e')](_0x333af8[_0x590b('0x2d')]);_0x3b881f['filters']=_[_0x590b('0x2f')](_0x3b881f[_0x590b('0x30')],_0x3b881f[_0x590b('0x2d')]);_0x1ee769[_0x590b('0x31')]=_['intersection'](_0x3b881f['model'],qs[_0x590b('0x32')](_0x333af8[_0x590b('0x2d')][_0x590b('0x32')]));_0x1ee769[_0x590b('0x31')]=_0x1ee769['attributes']['length']?_0x1ee769[_0x590b('0x31')]:_0x3b881f['model'];if(!_0x333af8[_0x590b('0x2d')][_0x590b('0x33')](_0x590b('0x34'))){_0x1ee769[_0x590b('0x35')]=qs[_0x590b('0x35')](_0x333af8[_0x590b('0x2d')][_0x590b('0x35')]);_0x1ee769[_0x590b('0x1c')]=qs[_0x590b('0x1c')](_0x333af8[_0x590b('0x2d')]['offset']);}_0x1ee769['order']=qs[_0x590b('0x36')](_0x333af8[_0x590b('0x2d')][_0x590b('0x36')]);_0x1ee769[_0x590b('0x37')]=qs[_0x590b('0x38')](_['pick'](_0x333af8[_0x590b('0x2d')],_0x3b881f[_0x590b('0x38')]),_0x1dfce0);if(_0x333af8[_0x590b('0x2d')][_0x590b('0x39')]){_0x1ee769[_0x590b('0x37')]=_['merge'](_0x1ee769[_0x590b('0x37')],{'$or':_[_0x590b('0x2c')](_0x1dfce0,function(_0x4e3f84){if(_0x4e3f84['type']!==_0x590b('0x3a')){var _0x4be52e={};_0x4be52e[_0x4e3f84[_0x590b('0x25')]]={'$like':'%'+_0x333af8[_0x590b('0x2d')][_0x590b('0x39')]+'%'};return _0x4be52e;}})});}_0x1ee769=_[_0x590b('0x3b')]({},_0x1ee769,_0x333af8[_0x590b('0x3c')]);var _0x419e6a={'where':_0x1ee769[_0x590b('0x37')]};return db[_0x590b('0x28')][_0x590b('0x1e')](_0x419e6a)[_0x590b('0x22')](function(_0x593b35){_0x5ee979[_0x590b('0x1e')]=_0x593b35;if(_0x333af8[_0x590b('0x2d')][_0x590b('0x3d')]){_0x1ee769['include']=[{'all':!![]}];}return db[_0x590b('0x28')][_0x590b('0x3e')](_0x1ee769);})[_0x590b('0x22')](function(_0x114bbe){_0x5ee979[_0x590b('0x3f')]=_0x114bbe;return _0x5ee979;})[_0x590b('0x22')](respondWithFilteredResult(_0x38a64a,_0x1ee769))[_0x590b('0x40')](handleError(_0x38a64a,null));};exports[_0x590b('0x41')]=function(_0x58c62e,_0x7da2e3){var _0x5984c0={'raw':!![],'where':{'id':_0x58c62e[_0x590b('0x42')]['id']}},_0xb345c0={};_0xb345c0[_0x590b('0x30')]=_['keys'](db[_0x590b('0x28')][_0x590b('0x29')]);_0xb345c0[_0x590b('0x2d')]=_[_0x590b('0x2e')](_0x58c62e['query']);_0xb345c0[_0x590b('0x38')]=_[_0x590b('0x2f')](_0xb345c0['model'],_0xb345c0['query']);_0x5984c0['attributes']=_[_0x590b('0x2f')](_0xb345c0[_0x590b('0x30')],qs[_0x590b('0x32')](_0x58c62e['query']['fields']));_0x5984c0[_0x590b('0x31')]=_0x5984c0[_0x590b('0x31')]['length']?_0x5984c0[_0x590b('0x31')]:_0xb345c0[_0x590b('0x30')];if(_0x58c62e[_0x590b('0x2d')][_0x590b('0x3d')]){_0x5984c0[_0x590b('0x43')]=[{'all':!![]}];}_0x5984c0=_[_0x590b('0x3b')]({},_0x5984c0,_0x58c62e[_0x590b('0x3c')]);return db[_0x590b('0x28')][_0x590b('0x44')](_0x5984c0)[_0x590b('0x22')](handleEntityNotFound(_0x7da2e3,null))[_0x590b('0x22')](respondWithResult(_0x7da2e3,null))[_0x590b('0x40')](handleError(_0x7da2e3,null));};exports[_0x590b('0x45')]=function(_0x5e10de,_0x5e79c5){return db[_0x590b('0x28')][_0x590b('0x45')](_0x5e10de[_0x590b('0x46')],{})[_0x590b('0x22')](respondWithResult(_0x5e79c5,0xc9))['catch'](handleError(_0x5e79c5,null));};exports[_0x590b('0x47')]=function(_0x11bb48,_0x2f492a){if(_0x11bb48['body']['id']){delete _0x11bb48[_0x590b('0x46')]['id'];}return db[_0x590b('0x28')]['find']({'where':{'id':_0x11bb48['params']['id']}})[_0x590b('0x22')](handleEntityNotFound(_0x2f492a,null))[_0x590b('0x22')](saveUpdates(_0x11bb48['body'],null))[_0x590b('0x22')](respondWithResult(_0x2f492a,null))[_0x590b('0x40')](handleError(_0x2f492a,null));};exports['destroy']=function(_0x67ee4f,_0xa6c336){return db[_0x590b('0x28')]['find']({'where':{'id':_0x67ee4f['params']['id']}})[_0x590b('0x22')](handleEntityNotFound(_0xa6c336,null))[_0x590b('0x22')](removeEntity(_0xa6c336,null))['catch'](handleError(_0xa6c336,null));}; \ No newline at end of file +var _0x236d=['json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','catch','destroy','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x3dc6ce,_0x412f1b){var _0x26ea6c=function(_0x1311c1){while(--_0x1311c1){_0x3dc6ce['push'](_0x3dc6ce['shift']());}};_0x26ea6c(++_0x412f1b);}(_0x236d,0x7e));var _0xd236=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x236d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd236('0x0'));var rimraf=require(_0xd236('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd236('0x2'));var rp=require('request-promise');var moment=require(_0xd236('0x3'));var BPromise=require(_0xd236('0x4'));var Mustache=require(_0xd236('0x5'));var util=require(_0xd236('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd236('0x7'));var ejs=require(_0xd236('0x8'));var fs=require('fs');var fs_extra=require(_0xd236('0x9'));var _=require(_0xd236('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd236('0xb'));var deskjs=require(_0xd236('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd236('0xd'));var Papa=require(_0xd236('0xe'));var Redis=require('ioredis');var authService=require(_0xd236('0xf'));var qs=require(_0xd236('0x10'));var as=require(_0xd236('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd236('0x12'))(_0xd236('0x13'));var utils=require(_0xd236('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd236('0x15'));var db=require(_0xd236('0x16'))['db'];function respondWithStatusCode(_0x3d1076,_0x160cb1){_0x160cb1=_0x160cb1||0xcc;return function(_0x21f27b){if(_0x21f27b){return _0x3d1076[_0xd236('0x17')](_0x160cb1);}return _0x3d1076[_0xd236('0x18')](_0x160cb1)[_0xd236('0x19')]();};}function respondWithResult(_0x22435c,_0x3d7465){_0x3d7465=_0x3d7465||0xc8;return function(_0x348734){if(_0x348734){return _0x22435c[_0xd236('0x18')](_0x3d7465)[_0xd236('0x1a')](_0x348734);}};}function respondWithFilteredResult(_0x3b60a7,_0xd851b5){return function(_0x3b2535){if(_0x3b2535){var _0x2a076d=typeof _0xd851b5[_0xd236('0x1b')]===_0xd236('0x1c')&&typeof _0xd851b5[_0xd236('0x1d')]==='undefined';var _0x4f06c6=_0x3b2535[_0xd236('0x1e')];var _0x1b02a5=_0x2a076d?0x0:_0xd851b5['offset'];var _0x11c6ec=_0x2a076d?_0x3b2535[_0xd236('0x1e')]:_0xd851b5[_0xd236('0x1b')]+_0xd851b5['limit'];var _0x355b65;if(_0x11c6ec>=_0x4f06c6){_0x11c6ec=_0x4f06c6;_0x355b65=0xc8;}else{_0x355b65=0xce;}_0x3b60a7[_0xd236('0x18')](_0x355b65);return _0x3b60a7[_0xd236('0x1f')]('Content-Range',_0x1b02a5+'-'+_0x11c6ec+'/'+_0x4f06c6)[_0xd236('0x1a')](_0x3b2535);}return null;};}function patchUpdates(_0x3b0a27){return function(_0x26c758){try{jsonpatch[_0xd236('0x20')](_0x26c758,_0x3b0a27,!![]);}catch(_0x2f512d){return BPromise['reject'](_0x2f512d);}return _0x26c758[_0xd236('0x21')]();};}function saveUpdates(_0x30e7aa,_0x1e4ddb){return function(_0x3d1e4e){if(_0x3d1e4e){return _0x3d1e4e[_0xd236('0x22')](_0x30e7aa)['then'](function(_0x4a35d0){return _0x4a35d0;});}return null;};}function removeEntity(_0x257f27,_0x4be5ac){return function(_0x22924d){if(_0x22924d){return _0x22924d['destroy']()[_0xd236('0x23')](function(){_0x257f27[_0xd236('0x18')](0xcc)[_0xd236('0x19')]();});}};}function handleEntityNotFound(_0x49d822,_0x41049a){return function(_0x339b08){if(!_0x339b08){_0x49d822[_0xd236('0x17')](0x194);}return _0x339b08;};}function handleError(_0x13ba7a,_0x3a30d8){_0x3a30d8=_0x3a30d8||0x1f4;return function(_0x17f927){logger[_0xd236('0x24')](_0x17f927[_0xd236('0x25')]);if(_0x17f927[_0xd236('0x26')]){delete _0x17f927[_0xd236('0x26')];}_0x13ba7a[_0xd236('0x18')](_0x3a30d8)[_0xd236('0x27')](_0x17f927);};}exports[_0xd236('0x28')]=function(_0x23714d,_0x3108f4){var _0x28175d={},_0x436a19={},_0x471ed6={'count':0x0,'rows':[]};var _0x463fc8=_[_0xd236('0x29')](db[_0xd236('0x2a')][_0xd236('0x2b')],function(_0x3c1617){return{'name':_0x3c1617[_0xd236('0x2c')],'type':_0x3c1617[_0xd236('0x2d')][_0xd236('0x2e')]};});_0x436a19[_0xd236('0x2f')]=_[_0xd236('0x29')](_0x463fc8,_0xd236('0x26'));_0x436a19['query']=_[_0xd236('0x30')](_0x23714d['query']);_0x436a19[_0xd236('0x31')]=_[_0xd236('0x32')](_0x436a19[_0xd236('0x2f')],_0x436a19['query']);_0x28175d[_0xd236('0x33')]=_[_0xd236('0x32')](_0x436a19[_0xd236('0x2f')],qs[_0xd236('0x34')](_0x23714d[_0xd236('0x35')][_0xd236('0x34')]));_0x28175d[_0xd236('0x33')]=_0x28175d['attributes'][_0xd236('0x36')]?_0x28175d['attributes']:_0x436a19[_0xd236('0x2f')];if(!_0x23714d['query'][_0xd236('0x37')](_0xd236('0x38'))){_0x28175d[_0xd236('0x1d')]=qs[_0xd236('0x1d')](_0x23714d[_0xd236('0x35')][_0xd236('0x1d')]);_0x28175d[_0xd236('0x1b')]=qs[_0xd236('0x1b')](_0x23714d[_0xd236('0x35')][_0xd236('0x1b')]);}_0x28175d[_0xd236('0x39')]=qs[_0xd236('0x3a')](_0x23714d[_0xd236('0x35')]['sort']);_0x28175d[_0xd236('0x3b')]=qs[_0xd236('0x31')](_[_0xd236('0x3c')](_0x23714d['query'],_0x436a19[_0xd236('0x31')]),_0x463fc8);if(_0x23714d[_0xd236('0x35')][_0xd236('0x3d')]){_0x28175d[_0xd236('0x3b')]=_[_0xd236('0x3e')](_0x28175d[_0xd236('0x3b')],{'$or':_['map'](_0x463fc8,function(_0x696bed){if(_0x696bed[_0xd236('0x2d')]!==_0xd236('0x3f')){var _0x3c798f={};_0x3c798f[_0x696bed[_0xd236('0x26')]]={'$like':'%'+_0x23714d[_0xd236('0x35')]['filter']+'%'};return _0x3c798f;}})});}_0x28175d=_[_0xd236('0x3e')]({},_0x28175d,_0x23714d[_0xd236('0x40')]);var _0x2ba3ae={'where':_0x28175d['where']};return db[_0xd236('0x2a')]['count'](_0x2ba3ae)[_0xd236('0x23')](function(_0x5793bf){_0x471ed6['count']=_0x5793bf;if(_0x23714d[_0xd236('0x35')][_0xd236('0x41')]){_0x28175d[_0xd236('0x42')]=[{'all':!![]}];}return db[_0xd236('0x2a')][_0xd236('0x43')](_0x28175d);})['then'](function(_0x4d0d65){_0x471ed6[_0xd236('0x44')]=_0x4d0d65;return _0x471ed6;})[_0xd236('0x23')](respondWithFilteredResult(_0x3108f4,_0x28175d))['catch'](handleError(_0x3108f4,null));};exports[_0xd236('0x45')]=function(_0x342fd5,_0x2d815b){var _0x55007d={'raw':!![],'where':{'id':_0x342fd5['params']['id']}},_0x58a93a={};_0x58a93a[_0xd236('0x2f')]=_['keys'](db['DeskField'][_0xd236('0x2b')]);_0x58a93a[_0xd236('0x35')]=_[_0xd236('0x30')](_0x342fd5[_0xd236('0x35')]);_0x58a93a[_0xd236('0x31')]=_['intersection'](_0x58a93a['model'],_0x58a93a[_0xd236('0x35')]);_0x55007d[_0xd236('0x33')]=_[_0xd236('0x32')](_0x58a93a[_0xd236('0x2f')],qs[_0xd236('0x34')](_0x342fd5[_0xd236('0x35')]['fields']));_0x55007d[_0xd236('0x33')]=_0x55007d['attributes'][_0xd236('0x36')]?_0x55007d[_0xd236('0x33')]:_0x58a93a['model'];if(_0x342fd5['query']['includeAll']){_0x55007d['include']=[{'all':!![]}];}_0x55007d=_[_0xd236('0x3e')]({},_0x55007d,_0x342fd5[_0xd236('0x40')]);return db[_0xd236('0x2a')][_0xd236('0x46')](_0x55007d)[_0xd236('0x23')](handleEntityNotFound(_0x2d815b,null))['then'](respondWithResult(_0x2d815b,null))['catch'](handleError(_0x2d815b,null));};exports[_0xd236('0x47')]=function(_0x7c0650,_0xbf4ba9){return db[_0xd236('0x2a')][_0xd236('0x47')](_0x7c0650[_0xd236('0x48')],{})['then'](respondWithResult(_0xbf4ba9,0xc9))[_0xd236('0x49')](handleError(_0xbf4ba9,null));};exports['update']=function(_0x223a14,_0x2c8861){if(_0x223a14['body']['id']){delete _0x223a14[_0xd236('0x48')]['id'];}return db[_0xd236('0x2a')]['find']({'where':{'id':_0x223a14['params']['id']}})[_0xd236('0x23')](handleEntityNotFound(_0x2c8861,null))[_0xd236('0x23')](saveUpdates(_0x223a14[_0xd236('0x48')],null))[_0xd236('0x23')](respondWithResult(_0x2c8861,null))['catch'](handleError(_0x2c8861,null));};exports[_0xd236('0x4a')]=function(_0x43c12b,_0x3d8ca6){return db[_0xd236('0x2a')][_0xd236('0x46')]({'where':{'id':_0x43c12b[_0xd236('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3d8ca6,null))['then'](removeEntity(_0x3d8ca6,null))[_0xd236('0x49')](handleError(_0x3d8ca6,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index c77d549..4fdeddd 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 _0x5c94=['define','DeskField','int_desk_fields','idField','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports'];(function(_0x513254,_0x1305ca){var _0x384c92=function(_0xb22823){while(--_0xb22823){_0x513254['push'](_0x513254['shift']());}};_0x384c92(++_0x1305ca);}(_0x5c94,0xe1));var _0x45c9=function(_0x31b059,_0x4bad01){_0x31b059=_0x31b059-0x0;var _0x60c4e3=_0x5c94[_0x31b059];return _0x60c4e3;};'use strict';var _=require('lodash');var util=require(_0x45c9('0x0'));var logger=require('../../config/logger')(_0x45c9('0x1'));var moment=require('moment');var BPromise=require(_0x45c9('0x2'));var rp=require(_0x45c9('0x3'));var fs=require('fs');var path=require(_0x45c9('0x4'));var rimraf=require(_0x45c9('0x5'));var config=require(_0x45c9('0x6'));var attributes=require(_0x45c9('0x7'));module[_0x45c9('0x8')]=function(_0x83db3a,_0xa43616){return _0x83db3a[_0x45c9('0x9')](_0x45c9('0xa'),attributes,{'tableName':_0x45c9('0xb'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x45c9('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x84a7=['../../config/logger','api','moment','bluebird','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId'];(function(_0x273f88,_0x5d4150){var _0x177ca1=function(_0xf46ec4){while(--_0xf46ec4){_0x273f88['push'](_0x273f88['shift']());}};_0x177ca1(++_0x5d4150);}(_0x84a7,0xb6));var _0x784a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x84a7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x784a('0x0'))(_0x784a('0x1'));var moment=require(_0x784a('0x2'));var BPromise=require(_0x784a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x784a('0x4'));var attributes=require(_0x784a('0x5'));module[_0x784a('0x6')]=function(_0x50ca70,_0x2ec465){return _0x50ca70[_0x784a('0x7')](_0x784a('0x8'),attributes,{'tableName':_0x784a('0x9'),'paranoid':![],'indexes':[{'name':_0x784a('0xa'),'fields':[_0x784a('0xb'),_0x784a('0xc')],'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 47f07f0..4b5981a 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 _0xe44a=['error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0xe44a,0x96));var _0xae44=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe44a[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xae44('0x0'));var util=require(_0xae44('0x1'));var moment=require('moment');var BPromise=require(_0xae44('0x2'));var rs=require(_0xae44('0x3'));var fs=require('fs');var Redis=require(_0xae44('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xae44('0x5'));var logger=require(_0xae44('0x6'))(_0xae44('0x7'));var config=require(_0xae44('0x8'));var jayson=require(_0xae44('0x9'));var client=jayson[_0xae44('0xa')][_0xae44('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cdc89,_0x2e7259,_0x473a3f){return new BPromise(function(_0x5f3879,_0x11db58){return client[_0xae44('0xc')](_0x1cdc89,_0x473a3f)[_0xae44('0xd')](function(_0x569632){logger['info'](_0xae44('0xe'),_0x2e7259,_0xae44('0xf'));logger[_0xae44('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x2e7259,_0xae44('0xf'),JSON[_0xae44('0x11')](_0x569632));if(_0x569632[_0xae44('0x12')]){if(_0x569632[_0xae44('0x12')][_0xae44('0x13')]===0x1f4){logger[_0xae44('0x12')]('DeskField,\x20%s,\x20%s',_0x2e7259,_0x569632[_0xae44('0x12')][_0xae44('0x14')]);return _0x11db58(_0x569632[_0xae44('0x12')][_0xae44('0x14')]);}logger[_0xae44('0x12')](_0xae44('0xe'),_0x2e7259,_0x569632[_0xae44('0x12')][_0xae44('0x14')]);return _0x5f3879(_0x569632[_0xae44('0x12')]['message']);}else{logger[_0xae44('0x15')](_0xae44('0xe'),_0x2e7259,'request\x20sent');_0x5f3879(_0x569632[_0xae44('0x16')]['message']);}})[_0xae44('0x17')](function(_0x2a689d){logger[_0xae44('0x12')]('DeskField,\x20%s,\x20%s',_0x2e7259,_0x2a689d);_0x11db58(_0x2a689d);});});} \ No newline at end of file +var _0xb9e0=['error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5a31a3,_0x4ab30e){var _0x5e8a9e=function(_0x5b781f){while(--_0x5b781f){_0x5a31a3['push'](_0x5a31a3['shift']());}};_0x5e8a9e(++_0x4ab30e);}(_0xb9e0,0x13c));var _0x0b9e=function(_0x2c6464,_0x51817d){_0x2c6464=_0x2c6464-0x0;var _0x58e452=_0xb9e0[_0x2c6464];return _0x58e452;};'use strict';var _=require(_0x0b9e('0x0'));var util=require(_0x0b9e('0x1'));var moment=require('moment');var BPromise=require(_0x0b9e('0x2'));var rs=require(_0x0b9e('0x3'));var fs=require('fs');var Redis=require(_0x0b9e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b9e('0x5'));var logger=require(_0x0b9e('0x6'))(_0x0b9e('0x7'));var config=require(_0x0b9e('0x8'));var jayson=require(_0x0b9e('0x9'));var client=jayson[_0x0b9e('0xa')][_0x0b9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a80ad,_0x17ff25,_0x46c60b){return new BPromise(function(_0x17f7e2,_0x247e58){return client[_0x0b9e('0xc')](_0x4a80ad,_0x46c60b)[_0x0b9e('0xd')](function(_0x38a3ef){logger[_0x0b9e('0xe')](_0x0b9e('0xf'),_0x17ff25,_0x0b9e('0x10'));logger[_0x0b9e('0x11')](_0x0b9e('0x12'),_0x17ff25,_0x0b9e('0x10'),JSON[_0x0b9e('0x13')](_0x38a3ef));if(_0x38a3ef[_0x0b9e('0x14')]){if(_0x38a3ef['error'][_0x0b9e('0x15')]===0x1f4){logger['error'](_0x0b9e('0xf'),_0x17ff25,_0x38a3ef[_0x0b9e('0x14')][_0x0b9e('0x16')]);return _0x247e58(_0x38a3ef[_0x0b9e('0x14')][_0x0b9e('0x16')]);}logger[_0x0b9e('0x14')](_0x0b9e('0xf'),_0x17ff25,_0x38a3ef[_0x0b9e('0x14')][_0x0b9e('0x16')]);return _0x17f7e2(_0x38a3ef[_0x0b9e('0x14')][_0x0b9e('0x16')]);}else{logger[_0x0b9e('0xe')]('DeskField,\x20%s,\x20%s',_0x17ff25,_0x0b9e('0x10'));_0x17f7e2(_0x38a3ef['result'][_0x0b9e('0x16')]);}})[_0x0b9e('0x17')](function(_0x2e6cc9){logger[_0x0b9e('0x14')](_0x0b9e('0xf'),_0x17ff25,_0x2e6cc9);_0x247e58(_0x2e6cc9);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index d581186..1022c59 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 _0xb64a=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','/:id','update','destroy','exports','multer'];(function(_0xf11539,_0x2af6d1){var _0x14e827=function(_0x34c4d7){while(--_0x34c4d7){_0xf11539['push'](_0xf11539['shift']());}};_0x14e827(++_0x2af6d1);}(_0xb64a,0x1a3));var _0xab64=function(_0xe1d04d,_0x4760ea){_0xe1d04d=_0xe1d04d-0x0;var _0x3f3e33=_0xb64a[_0xe1d04d];return _0x3f3e33;};'use strict';var multer=require(_0xab64('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xab64('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xab64('0x2'));var interaction=require(_0xab64('0x3'));var config=require(_0xab64('0x4'));var controller=require(_0xab64('0x5'));router[_0xab64('0x6')]('/',auth[_0xab64('0x7')](),controller[_0xab64('0x8')]);router[_0xab64('0x6')]('/:id',auth[_0xab64('0x7')](),controller[_0xab64('0x9')]);router['get'](_0xab64('0xa'),auth['isAuthenticated'](),controller[_0xab64('0xb')]);router[_0xab64('0x6')](_0xab64('0xc'),auth[_0xab64('0x7')](),controller[_0xab64('0xd')]);router[_0xab64('0xe')]('/',auth[_0xab64('0x7')](),controller['create']);router[_0xab64('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xab64('0xf')]);router['put'](_0xab64('0x10'),auth['isAuthenticated'](),controller[_0xab64('0x11')]);router['delete']('/:id',auth[_0xab64('0x7')](),controller[_0xab64('0x12')]);module[_0xab64('0x13')]=router; \ No newline at end of file +var _0x219f=['addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x219f,0x1ae));var _0xf219=function(_0x2a74ee,_0x31305d){_0x2a74ee=_0x2a74ee-0x0;var _0x505e0=_0x219f[_0x2a74ee];return _0x505e0;};'use strict';var multer=require(_0xf219('0x0'));var util=require(_0xf219('0x1'));var path=require(_0xf219('0x2'));var timeout=require(_0xf219('0x3'));var express=require(_0xf219('0x4'));var router=express[_0xf219('0x5')]();var fs_extra=require(_0xf219('0x6'));var auth=require(_0xf219('0x7'));var interaction=require(_0xf219('0x8'));var config=require(_0xf219('0x9'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0xf219('0xa')](),controller[_0xf219('0xb')]);router[_0xf219('0xc')](_0xf219('0xd'),auth[_0xf219('0xa')](),controller['show']);router[_0xf219('0xc')](_0xf219('0xe'),auth['isAuthenticated'](),controller[_0xf219('0xf')]);router[_0xf219('0xc')](_0xf219('0x10'),auth[_0xf219('0xa')](),controller[_0xf219('0x11')]);router[_0xf219('0x12')]('/',auth[_0xf219('0xa')](),controller[_0xf219('0x13')]);router[_0xf219('0x12')](_0xf219('0xe'),auth[_0xf219('0xa')](),controller[_0xf219('0x14')]);router[_0xf219('0x15')](_0xf219('0xd'),auth[_0xf219('0xa')](),controller[_0xf219('0x16')]);router['delete'](_0xf219('0xd'),auth[_0xf219('0xa')](),controller[_0xf219('0x17')]);module[_0xf219('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 5290a44..16e8c5a 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 _0x9237=['STRING','sequelize','exports'];(function(_0x3f7e3d,_0x14a2df){var _0x22b9ed=function(_0xfe70b8){while(--_0xfe70b8){_0x3f7e3d['push'](_0x3f7e3d['shift']());}};_0x22b9ed(++_0x14a2df);}(_0x9237,0x145));var _0x7923=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9237[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0x7923('0x0'));module[_0x7923('0x1')]={'name':{'type':Sequelize[_0x7923('0x2')]},'username':{'type':Sequelize[_0x7923('0x2')]},'password':{'type':Sequelize[_0x7923('0x2')]},'remoteUri':{'type':Sequelize[_0x7923('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x7923('0x2')]},'clientSecret':{'type':Sequelize[_0x7923('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5c4b=['STRING','sequelize'];(function(_0x1fa226,_0x575465){var _0x3579a6=function(_0xf8a680){while(--_0xf8a680){_0x1fa226['push'](_0x1fa226['shift']());}};_0x3579a6(++_0x575465);}(_0x5c4b,0x6d));var _0xb5c4=function(_0x253961,_0x3e8075){_0x253961=_0x253961-0x0;var _0x367440=_0x5c4b[_0x253961];return _0x367440;};'use strict';var Sequelize=require(_0xb5c4('0x0'));module['exports']={'name':{'type':Sequelize[_0xb5c4('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb5c4('0x1')]},'remoteUri':{'type':Sequelize[_0xb5c4('0x1')]},'tenantId':{'type':Sequelize[_0xb5c4('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xb5c4('0x1')]},'serverUrl':{'type':Sequelize[_0xb5c4('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb5c4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index d2ac529..681ddf6 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 _0x0b78=['isNil','substring','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','stack','send','Wrong\x20credentials','EntityDefinitions(',')/Attributes(','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','description','customerid','caseorigincode','accountidyominame','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','exchangerate','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','tenantId','clientId','clientSecret','remoteUri','slice','lastIndexOf','format','https://login.microsoftonline.com/','/oauth2/token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','all'];(function(_0x16d9c3,_0x24a9c3){var _0x3712eb=function(_0xef0ae1){while(--_0xef0ae1){_0x16d9c3['push'](_0x16d9c3['shift']());}};_0x3712eb(++_0x24a9c3);}(_0x0b78,0x1ad));var _0x80b7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0b78[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x80b7('0x0'));var rimraf=require(_0x80b7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x80b7('0x2'));var rp=require(_0x80b7('0x3'));var moment=require('moment');var BPromise=require(_0x80b7('0x4'));var Mustache=require('mustache');var util=require(_0x80b7('0x5'));var path=require(_0x80b7('0x6'));var sox=require(_0x80b7('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x80b7('0x8'));var _=require('lodash');var squel=require(_0x80b7('0x9'));var crypto=require(_0x80b7('0xa'));var jsforce=require(_0x80b7('0xb'));var deskjs=require(_0x80b7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x80b7('0xd'));var Papa=require(_0x80b7('0xe'));var Redis=require(_0x80b7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x80b7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x80b7('0x11'));var logger=require(_0x80b7('0x12'))(_0x80b7('0x13'));var utils=require(_0x80b7('0x14'));var config=require(_0x80b7('0x15'));var licenseUtil=require(_0x80b7('0x16'));var db=require(_0x80b7('0x17'))['db'];var integrations=require(_0x80b7('0x18'));function respondWithStatusCode(_0x323d06,_0x366e34){_0x366e34=_0x366e34||0xcc;return function(_0x2b5f78){if(_0x2b5f78){return _0x323d06['sendStatus'](_0x366e34);}return _0x323d06[_0x80b7('0x19')](_0x366e34)[_0x80b7('0x1a')]();};}function respondWithResult(_0x527c5b,_0x2ee168){_0x2ee168=_0x2ee168||0xc8;return function(_0x1a6317){if(_0x1a6317){return _0x527c5b['status'](_0x2ee168)[_0x80b7('0x1b')](_0x1a6317);}};}function respondWithFilteredResult(_0x3b6b13,_0x21ea65){return function(_0x2c0c4e){if(_0x2c0c4e){var _0x36d0bb=typeof _0x21ea65[_0x80b7('0x1c')]===_0x80b7('0x1d')&&typeof _0x21ea65[_0x80b7('0x1e')]===_0x80b7('0x1d');var _0x34299c=_0x2c0c4e['count'];var _0x3bb691=_0x36d0bb?0x0:_0x21ea65[_0x80b7('0x1c')];var _0x205457=_0x36d0bb?_0x2c0c4e[_0x80b7('0x1f')]:_0x21ea65['offset']+_0x21ea65['limit'];var _0x45be23;if(_0x205457>=_0x34299c){_0x205457=_0x34299c;_0x45be23=0xc8;}else{_0x45be23=0xce;}_0x3b6b13[_0x80b7('0x19')](_0x45be23);return _0x3b6b13[_0x80b7('0x20')](_0x80b7('0x21'),_0x3bb691+'-'+_0x205457+'/'+_0x34299c)['json'](_0x2c0c4e);}return null;};}function patchUpdates(_0x4f6eec){return function(_0x2aebe3){try{jsonpatch[_0x80b7('0x22')](_0x2aebe3,_0x4f6eec,!![]);}catch(_0xa465d2){return BPromise[_0x80b7('0x23')](_0xa465d2);}return _0x2aebe3['save']();};}function saveUpdates(_0x18d407,_0x4c3bed){return function(_0x4d2139){if(_0x4d2139){return _0x4d2139[_0x80b7('0x24')](_0x18d407)[_0x80b7('0x25')](function(_0x65d31d){return _0x65d31d;});}return null;};}function removeEntity(_0x155c00,_0x3f3aa5){return function(_0x3a029b){if(_0x3a029b){return _0x3a029b[_0x80b7('0x26')]()[_0x80b7('0x25')](function(){_0x155c00[_0x80b7('0x19')](0xcc)[_0x80b7('0x1a')]();});}};}function handleEntityNotFound(_0x134b3e,_0x311aa3){return function(_0x9da9e9){if(!_0x9da9e9){_0x134b3e[_0x80b7('0x27')](0x194);}return _0x9da9e9;};}function handleError(_0x3995b5,_0x481cd2){_0x481cd2=_0x481cd2||0x1f4;return function(_0x40cfd3){logger[_0x80b7('0x28')](_0x40cfd3['stack']);if(_0x40cfd3[_0x80b7('0x29')]){delete _0x40cfd3[_0x80b7('0x29')];}_0x3995b5[_0x80b7('0x19')](_0x481cd2)['send'](_0x40cfd3);};}exports[_0x80b7('0x2a')]=function(_0x48995a,_0x3ad2ff){var _0x30cd74={},_0x1c4607={},_0x399ef1={'count':0x0,'rows':[]};var _0x1365aa=_[_0x80b7('0x2b')](db[_0x80b7('0x2c')][_0x80b7('0x2d')],function(_0x3fb3da){return{'name':_0x3fb3da[_0x80b7('0x2e')],'type':_0x3fb3da[_0x80b7('0x2f')]['key']};});_0x1c4607['model']=_[_0x80b7('0x2b')](_0x1365aa,_0x80b7('0x29'));_0x1c4607['query']=_['keys'](_0x48995a[_0x80b7('0x30')]);_0x1c4607[_0x80b7('0x31')]=_[_0x80b7('0x32')](_0x1c4607[_0x80b7('0x33')],_0x1c4607[_0x80b7('0x30')]);_0x30cd74[_0x80b7('0x34')]=_['intersection'](_0x1c4607[_0x80b7('0x33')],qs[_0x80b7('0x35')](_0x48995a[_0x80b7('0x30')][_0x80b7('0x35')]));_0x30cd74['attributes']=_0x30cd74[_0x80b7('0x34')][_0x80b7('0x36')]?_0x30cd74['attributes']:_0x1c4607[_0x80b7('0x33')];if(!_0x48995a[_0x80b7('0x30')][_0x80b7('0x37')](_0x80b7('0x38'))){_0x30cd74[_0x80b7('0x1e')]=qs[_0x80b7('0x1e')](_0x48995a[_0x80b7('0x30')][_0x80b7('0x1e')]);_0x30cd74['offset']=qs['offset'](_0x48995a['query'][_0x80b7('0x1c')]);}_0x30cd74[_0x80b7('0x39')]=qs[_0x80b7('0x3a')](_0x48995a[_0x80b7('0x30')][_0x80b7('0x3a')]);_0x30cd74[_0x80b7('0x3b')]=qs[_0x80b7('0x31')](_[_0x80b7('0x3c')](_0x48995a['query'],_0x1c4607[_0x80b7('0x31')]),_0x1365aa);if(_0x48995a[_0x80b7('0x30')][_0x80b7('0x3d')]){_0x30cd74[_0x80b7('0x3b')]=_[_0x80b7('0x3e')](_0x30cd74[_0x80b7('0x3b')],{'$or':_['map'](_0x1365aa,function(_0x287f7e){if(_0x287f7e['type']!==_0x80b7('0x3f')){var _0x1a6e69={};_0x1a6e69[_0x287f7e['name']]={'$like':'%'+_0x48995a['query'][_0x80b7('0x3d')]+'%'};return _0x1a6e69;}})});}_0x30cd74=_['merge']({},_0x30cd74,_0x48995a['options']);var _0x295ca6={'where':_0x30cd74[_0x80b7('0x3b')]};return db['Dynamics365Account'][_0x80b7('0x1f')](_0x295ca6)[_0x80b7('0x25')](function(_0x55cf02){_0x399ef1['count']=_0x55cf02;if(_0x48995a[_0x80b7('0x30')][_0x80b7('0x40')]){_0x30cd74[_0x80b7('0x41')]=[{'all':!![]}];}return db[_0x80b7('0x2c')][_0x80b7('0x42')](_0x30cd74);})[_0x80b7('0x25')](function(_0x57fcbf){_0x399ef1[_0x80b7('0x43')]=_0x57fcbf;return _0x399ef1;})[_0x80b7('0x25')](respondWithFilteredResult(_0x3ad2ff,_0x30cd74))[_0x80b7('0x44')](handleError(_0x3ad2ff,null));};exports[_0x80b7('0x45')]=function(_0x55f00d,_0x20a9b9){var _0x5741ec={'raw':![],'where':{'id':_0x55f00d[_0x80b7('0x46')]['id']}},_0x382fd7={};_0x382fd7[_0x80b7('0x33')]=_[_0x80b7('0x47')](db[_0x80b7('0x2c')][_0x80b7('0x2d')]);_0x382fd7[_0x80b7('0x30')]=_[_0x80b7('0x47')](_0x55f00d[_0x80b7('0x30')]);_0x382fd7[_0x80b7('0x31')]=_[_0x80b7('0x32')](_0x382fd7[_0x80b7('0x33')],_0x382fd7[_0x80b7('0x30')]);_0x5741ec['attributes']=_[_0x80b7('0x32')](_0x382fd7[_0x80b7('0x33')],qs['fields'](_0x55f00d[_0x80b7('0x30')]['fields']));_0x5741ec['attributes']=_0x5741ec[_0x80b7('0x34')]['length']?_0x5741ec['attributes']:_0x382fd7[_0x80b7('0x33')];if(_0x55f00d[_0x80b7('0x30')]['includeAll']){_0x5741ec[_0x80b7('0x41')]=[{'all':!![]}];}_0x5741ec=_[_0x80b7('0x3e')]({},_0x5741ec,_0x55f00d[_0x80b7('0x48')]);return db['Dynamics365Account'][_0x80b7('0x49')](_0x5741ec)[_0x80b7('0x25')](handleEntityNotFound(_0x20a9b9,null))[_0x80b7('0x25')](respondWithResult(_0x20a9b9,null))[_0x80b7('0x44')](handleError(_0x20a9b9,null));};exports['create']=function(_0x5dcbcd,_0x5417b9){return db[_0x80b7('0x2c')][_0x80b7('0x4a')](_0x5dcbcd[_0x80b7('0x4b')],{})[_0x80b7('0x25')](respondWithResult(_0x5417b9,0xc9))[_0x80b7('0x44')](handleError(_0x5417b9,null));};exports[_0x80b7('0x24')]=function(_0x398925,_0x557988){if(_0x398925['body']['id']){delete _0x398925['body']['id'];}return db[_0x80b7('0x2c')][_0x80b7('0x49')]({'where':{'id':_0x398925[_0x80b7('0x46')]['id']}})[_0x80b7('0x25')](handleEntityNotFound(_0x557988,null))[_0x80b7('0x25')](saveUpdates(_0x398925[_0x80b7('0x4b')],null))['then'](respondWithResult(_0x557988,null))[_0x80b7('0x44')](handleError(_0x557988,null));};exports[_0x80b7('0x26')]=function(_0x47bacb,_0x12dc7b){return db[_0x80b7('0x2c')][_0x80b7('0x49')]({'where':{'id':_0x47bacb['params']['id']}})['then'](handleEntityNotFound(_0x12dc7b,null))[_0x80b7('0x25')](removeEntity(_0x12dc7b,null))[_0x80b7('0x44')](handleError(_0x12dc7b,null));};exports[_0x80b7('0x4c')]=function(_0x416631,_0x1b544d,_0x2689ab){var _0x4cc104={};var _0x1b81a2={};var _0x270386;var _0xeece0a;return db[_0x80b7('0x2c')][_0x80b7('0x4d')]({'where':{'id':_0x416631['params']['id']}})['then'](handleEntityNotFound(_0x1b544d,null))[_0x80b7('0x25')](function(_0x2129d3){if(_0x2129d3){_0x270386=_0x2129d3;_0x1b81a2[_0x80b7('0x33')]=_['keys'](db[_0x80b7('0x4e')]['rawAttributes']);_0x1b81a2[_0x80b7('0x30')]=_[_0x80b7('0x47')](_0x416631[_0x80b7('0x30')]);_0x1b81a2[_0x80b7('0x31')]=_[_0x80b7('0x32')](_0x1b81a2[_0x80b7('0x33')],_0x1b81a2[_0x80b7('0x30')]);_0x4cc104[_0x80b7('0x34')]=_[_0x80b7('0x32')](_0x1b81a2[_0x80b7('0x33')],qs[_0x80b7('0x35')](_0x416631[_0x80b7('0x30')][_0x80b7('0x35')]));_0x4cc104[_0x80b7('0x34')]=_0x4cc104['attributes'][_0x80b7('0x36')]?_0x4cc104[_0x80b7('0x34')]:_0x1b81a2[_0x80b7('0x33')];_0x4cc104[_0x80b7('0x39')]=qs[_0x80b7('0x3a')](_0x416631[_0x80b7('0x30')][_0x80b7('0x3a')]);_0x4cc104['where']=qs[_0x80b7('0x31')](_[_0x80b7('0x3c')](_0x416631[_0x80b7('0x30')],_0x1b81a2[_0x80b7('0x31')]));if(_0x416631['query'][_0x80b7('0x3d')]){_0x4cc104[_0x80b7('0x3b')]=_['merge'](_0x4cc104[_0x80b7('0x3b')],{'$or':_[_0x80b7('0x2b')](_0x4cc104['attributes'],function(_0x1a21f4){var _0x359801={};_0x359801[_0x1a21f4]={'$like':'%'+_0x416631['query']['filter']+'%'};return _0x359801;})});}_0x4cc104=_[_0x80b7('0x3e')]({},_0x4cc104,_0x416631['options']);return _0x270386[_0x80b7('0x4c')](_0x4cc104);}})[_0x80b7('0x25')](function(_0x57d361){if(_0x57d361){_0xeece0a=_0x57d361[_0x80b7('0x36')];if(!_0x416631[_0x80b7('0x30')]['hasOwnProperty'](_0x80b7('0x38'))){_0x4cc104[_0x80b7('0x1e')]=qs[_0x80b7('0x1e')](_0x416631[_0x80b7('0x30')][_0x80b7('0x1e')]);_0x4cc104[_0x80b7('0x1c')]=qs[_0x80b7('0x1c')](_0x416631[_0x80b7('0x30')][_0x80b7('0x1c')]);}return _0x270386['getConfigurations'](_0x4cc104);}})['then'](function(_0x6d7c1e){if(_0x6d7c1e){return _0x6d7c1e?{'count':_0xeece0a,'rows':_0x6d7c1e}:null;}})['then'](respondWithResult(_0x1b544d,null))[_0x80b7('0x44')](handleError(_0x1b544d,null));};exports[_0x80b7('0x4f')]=function(_0x25fc84,_0x599f17,_0x349619){if(_0x25fc84[_0x80b7('0x4b')]['id']){delete _0x25fc84['body']['id'];}return db[_0x80b7('0x2c')][_0x80b7('0x4d')]({'where':{'id':_0x25fc84[_0x80b7('0x46')]['id']}})[_0x80b7('0x25')](handleEntityNotFound(_0x599f17,null))['then'](function(_0x5818f2){if(_0x5818f2){_0x25fc84[_0x80b7('0x4b')][_0x80b7('0x50')]=_0x5818f2['id'];_0x25fc84[_0x80b7('0x4b')]['Subjects']=integrations['getSubjects'](_0x25fc84[_0x80b7('0x4b')][_0x80b7('0x51')],_0x25fc84[_0x80b7('0x4b')]['type']);_0x25fc84[_0x80b7('0x4b')][_0x80b7('0x52')]=integrations[_0x80b7('0x53')](_0x25fc84[_0x80b7('0x4b')]['channel'],_0x25fc84['body'][_0x80b7('0x2f')]);return db[_0x80b7('0x4e')]['create'](_0x25fc84['body'],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0x80b7('0x54')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x599f17,null))[_0x80b7('0x44')](handleError(_0x599f17,null));};exports[_0x80b7('0x55')]=function(_0x2ace46,_0x1fe9e6,_0x289a9a){var _0x3e313c=_0x2ace46[_0x80b7('0x30')][_0x80b7('0x56')];var _0x3e5149=_0x3e313c==='incident'?'Incident':'PhoneCall';var _0x3fe3c3='';var _0x2dd01c='';var _0x1a2c0b='';var _0x401247='';var _0x588319='';var _0x1f1725='';var _0x1c3ad6='';var _0x51a86a='';var _0x4ee23b=['title',_0x80b7('0x57'),_0x80b7('0x58'),'ownerid',_0x80b7('0x59'),'subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties'];var _0x4b5e01=['accountidname',_0x80b7('0x5a'),'actualserviceunits',_0x80b7('0x5b'),'contactidname',_0x80b7('0x5c'),_0x80b7('0x5d'),_0x80b7('0x5e'),'createdbyexternalpartyname',_0x80b7('0x5f'),_0x80b7('0x60'),'createdbyyominame',_0x80b7('0x61'),_0x80b7('0x62'),'createdonbehalfbyyominame',_0x80b7('0x63'),_0x80b7('0x64'),_0x80b7('0x65'),'emailaddress',_0x80b7('0x66'),'entityimage_timestamp','entityimage_url','escalatedon',_0x80b7('0x67'),'firstresponsebykpiidname','followupby',_0x80b7('0x68'),_0x80b7('0x69'),_0x80b7('0x6a'),_0x80b7('0x6b'),_0x80b7('0x6c'),_0x80b7('0x6d'),_0x80b7('0x6e'),_0x80b7('0x6f'),_0x80b7('0x70'),_0x80b7('0x71'),_0x80b7('0x72'),_0x80b7('0x73'),'msdyn_incidenttypename',_0x80b7('0x74'),_0x80b7('0x75'),_0x80b7('0x76'),'overriddencreatedon',_0x80b7('0x77'),_0x80b7('0x78'),_0x80b7('0x79'),_0x80b7('0x7a'),_0x80b7('0x7b'),_0x80b7('0x7c'),_0x80b7('0x7d'),_0x80b7('0x7e'),'productserialnumber',_0x80b7('0x7f'),_0x80b7('0x80'),_0x80b7('0x81'),'responsiblecontactidname','responsiblecontactidyominame',_0x80b7('0x82'),_0x80b7('0x83'),_0x80b7('0x84'),_0x80b7('0x85'),'statecode',_0x80b7('0x86'),_0x80b7('0x87'),_0x80b7('0x88'),_0x80b7('0x89'),'transactioncurrencyidname',_0x80b7('0x8a'),_0x80b7('0x8b'),_0x80b7('0x8c')];var _0x486be6=_0x4ee23b[_0x80b7('0x8d')](_0x4b5e01);return db[_0x80b7('0x2c')][_0x80b7('0x4d')]({'where':{'id':_0x2ace46[_0x80b7('0x46')]['id']},'attributes':['id',_0x80b7('0x8e'),_0x80b7('0x8f'),'remoteUri',_0x80b7('0x90'),_0x80b7('0x91'),_0x80b7('0x92')]})['then'](handleEntityNotFound(_0x1fe9e6,null))[_0x80b7('0x25')](function(_0x3f19ba){if(_0x3f19ba){_0x51a86a=_0x3f19ba[_0x80b7('0x93')];var _0x3db25c=_0x51a86a[_0x80b7('0x94')](-0x1);if(_0x3db25c==='/'){_0x51a86a=_0x51a86a['substring'](0x0,_0x51a86a[_0x80b7('0x95')](_0x3db25c));}_0x1c3ad6=util[_0x80b7('0x96')]('%s/api/data/v9.0/',_0x51a86a);var _0x265a0c={'method':'POST','uri':_0x80b7('0x97')+_0x3f19ba['tenantId']+_0x80b7('0x98'),'form':{'client_id':_0x3f19ba[_0x80b7('0x91')],'resource':_0x51a86a,'username':_0x3f19ba['username'],'password':_0x3f19ba[_0x80b7('0x8f')],'grant_type':_0x80b7('0x8f'),'client_secret':_0x3f19ba[_0x80b7('0x92')]},'json':!![]};return rp(_0x265a0c);}})[_0x80b7('0x25')](function(_0x43d2fb){_0x1f1725=_0x43d2fb['access_token'];var _0x57965f={'method':'GET','uri':encodeURI(_0x1c3ad6+_0x80b7('0x99')+_0x3e5149+'\x27'),'headers':{'Authorization':_0x80b7('0x9a')+_0x1f1725,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x57965f);})['then'](function(_0x186d10){var _0x40b8f1=_0x186d10[_0x80b7('0x9b')][0x0];var _0x300cf3=_0x40b8f1[_0x80b7('0x9c')];var _0x267e26={'method':_0x80b7('0x9d'),'uri':_0x1c3ad6+'EntityDefinitions('+_0x300cf3+_0x80b7('0x9e'),'headers':{'Authorization':_0x80b7('0x9a')+_0x1f1725,'If-None-Match':null,'OData-Version':_0x80b7('0x9f')},'json':!![]};return rp(_0x267e26);})[_0x80b7('0x25')](function(_0x1af846){_0x3fe3c3=_0x1af846;_0x2dd01c=_0x3fe3c3[_0x80b7('0xa0')];_0x2dd01c=_[_0x80b7('0xa1')](_0x2dd01c,function(_0x1d9c53){return!_0x486be6[_0x80b7('0xa2')](_0x1d9c53['LogicalName']);});var _0x45e613=[];var _0x192785=[];_0x2dd01c[_0x80b7('0xa3')](function(_0x3530a4){if(_0x3530a4['@odata.type']){var _0x100942=_0x3530a4[_0x80b7('0xa4')]['substring'](_0x3530a4[_0x80b7('0xa4')][_0x80b7('0x95')]('.')+0x1);if(_0x100942===_0x80b7('0xa5')){_0x45e613[_0x80b7('0xa6')](getSelectList(_0x1c3ad6,_0x3e313c,_0x192785,_0x3fe3c3['MetadataId'],_0x3530a4[_0x80b7('0x9c')],_0x1f1725));}}});return Promise[_0x80b7('0xa7')](_0x45e613);})[_0x80b7('0x25')](function(_0x3f912a){_0x1a2c0b=_0x3f912a[0x0];var _0x4b5a26=[];var _0x3ba543=[];_0x2dd01c['forEach'](function(_0x7081d6){if(!_[_0x80b7('0xa8')](_0x7081d6['@odata.type'])){var _0x11e5da=_0x7081d6[_0x80b7('0xa4')]['substring'](_0x7081d6[_0x80b7('0xa4')][_0x80b7('0x95')]('.')+0x1);if(_0x11e5da==='BooleanAttributeMetadata'){_0x4b5a26[_0x80b7('0xa6')](getBooleanList(_0x1c3ad6,_0x3e313c,_0x3ba543,_0x3fe3c3[_0x80b7('0x9c')],_0x7081d6[_0x80b7('0x9c')],_0x1f1725));}}});return Promise['all'](_0x4b5a26);})[_0x80b7('0x25')](function(_0x42ca10){_0x401247=_0x42ca10[0x0];var _0x17b8fd=[];var _0x112379=[];_0x2dd01c[_0x80b7('0xa3')](function(_0x3f1252){if(_0x3f1252[_0x80b7('0xa4')]){var _0x2f6711=_0x3f1252[_0x80b7('0xa4')][_0x80b7('0xa9')](_0x3f1252['@odata.type']['lastIndexOf']('.')+0x1);if(_0x2f6711===_0x80b7('0xaa')||_0x2f6711===_0x80b7('0xab')||_0x2f6711===_0x80b7('0xac')||_0x2f6711===_0x80b7('0xad')||_0x2f6711===_0x80b7('0xae')||_0x2f6711==='DateTimeAttributeMetadata'||_0x2f6711===_0x80b7('0xaf')||_0x2f6711===_0x80b7('0xb0')||_0x2f6711===_0x80b7('0xb1')||_0x2f6711===_0x80b7('0xb2')){_0x17b8fd['push'](getInputList(_0x1c3ad6,_0x3e313c,_0x2f6711,_0x112379,_0x3fe3c3['MetadataId'],_0x3f1252['MetadataId'],_0x1f1725));}}});return Promise[_0x80b7('0xa7')](_0x17b8fd);})['then'](function(_0x5ba717){_0x588319=_0x5ba717[0x0];var _0x1ccfca=_0x1a2c0b[_0x80b7('0x8d')](_0x401247)[_0x80b7('0x8d')](_0x588319);var _0x35cc6e={'count':_0x1ccfca[_0x80b7('0x36')],'rows':_0x1ccfca};return _0x35cc6e;})['then'](respondWithResult(_0x1fe9e6,null))[_0x80b7('0x44')](function(_0x34e00){var _0x395507=_0x2ace46[_0x80b7('0x30')][_0x80b7('0xb3')]?0x1f4:_0x34e00[_0x80b7('0xb4')]||0x1f4;logger['error'](_0x34e00[_0x80b7('0xb5')]);delete _0x34e00[_0x80b7('0x29')];if(_0x395507===0x191){_0x395507=0x190;}_0x1fe9e6[_0x80b7('0x19')](_0x395507)[_0x80b7('0xb6')](_0x2ace46[_0x80b7('0x30')]['test']?{'message':_0x80b7('0xb7'),'statusCode':_0x34e00[_0x80b7('0xb4')]}:_0x34e00);});};function getSelectList(_0x48af9b,_0x749a76,_0x424a42,_0x59e878,_0x4050b1,_0x15c778){var _0x2f6b81={'method':_0x80b7('0x9d'),'uri':_0x48af9b+_0x80b7('0xb8')+_0x59e878+_0x80b7('0xb9')+_0x4050b1+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x80b7('0x9a')+_0x15c778,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2f6b81)[_0x80b7('0x25')](function(_0xd9fa2f){var _0x32d2c5=[];var _0x520218=_0xd9fa2f[_0x80b7('0xba')][_0x80b7('0xbb')];_0x520218[_0x80b7('0xa3')](function(_0x9a532a){_0x32d2c5[_0x80b7('0xa6')]({'name':_0x9a532a[_0x80b7('0xbc')][_0x80b7('0xbd')]['Label'],'value':String(_0x9a532a[_0x80b7('0xbe')])});});var _0x1f9057={'id':_0x749a76+'_'+_0xd9fa2f[_0x80b7('0xbf')],'name':_0xd9fa2f['DisplayName'][_0x80b7('0xbd')]['Label'],'custom':![],'options':_0x32d2c5};_0x424a42[_0x80b7('0xa6')](_0x1f9057);return _0x424a42;});}function getBooleanList(_0x498238,_0x59266f,_0x34b7ce,_0x19702c,_0x26979c,_0x276192){var _0x39980={'method':_0x80b7('0x9d'),'uri':_0x498238+'EntityDefinitions('+_0x19702c+_0x80b7('0xb9')+_0x26979c+_0x80b7('0xc0'),'headers':{'Authorization':_0x80b7('0x9a')+_0x276192,'If-None-Match':null,'OData-Version':_0x80b7('0x9f')},'json':!![]};return rp(_0x39980)['then'](function(_0x39e9b9){var _0x1ad42b=[];_0x1ad42b[_0x80b7('0xa6')]({'name':_0x39e9b9[_0x80b7('0xba')]['TrueOption'][_0x80b7('0xbc')][_0x80b7('0xbd')][_0x80b7('0xbc')],'value':_0x80b7('0xc1')},{'name':_0x39e9b9['OptionSet'][_0x80b7('0xc2')]['Label'][_0x80b7('0xbd')][_0x80b7('0xbc')],'value':_0x80b7('0xc3')});var _0x5cfafd={'id':_0x59266f+'_'+_0x39e9b9[_0x80b7('0xbf')],'name':_0x39e9b9['DisplayName']['UserLocalizedLabel'][_0x80b7('0xbc')],'custom':![],'options':_0x1ad42b};_0x34b7ce[_0x80b7('0xa6')](_0x5cfafd);return _0x34b7ce;});}function getInputList(_0x4e2cb6,_0x3e3f3d,_0x1ba6a0,_0x554327,_0x10f143,_0x2470f6,_0x429354){var _0x3eb758={'method':_0x80b7('0x9d'),'uri':_0x4e2cb6+_0x80b7('0xb8')+_0x10f143+_0x80b7('0xb9')+_0x2470f6+_0x80b7('0xc4')+_0x1ba6a0+_0x80b7('0xc5'),'headers':{'Authorization':'Bearer\x20'+_0x429354,'If-None-Match':null,'OData-Version':_0x80b7('0x9f')},'json':!![]};return rp(_0x3eb758)[_0x80b7('0x25')](function(_0x4a230d){var _0x218601={'id':_0x3e3f3d+'_'+_0x4a230d[_0x80b7('0xbf')],'name':_0x4a230d[_0x80b7('0xc6')][_0x80b7('0xbd')]?_0x4a230d[_0x80b7('0xc6')][_0x80b7('0xbd')][_0x80b7('0xbc')]:_0x4a230d[_0x80b7('0xbf')],'custom':![],'options':[]};_0x554327[_0x80b7('0xa6')](_0x218601);return _0x554327;});} \ No newline at end of file +var _0x495e=['%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','includes','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','push','all','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','LogicalName','DisplayName','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','save','update','destroy','error','name','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','where','filter','merge','VIRTUAL','options','Dynamics365Account','includeAll','include','findAll','then','rows','catch','show','params','find','body','getConfigurations','findOne','Dynamics365Configuration','rawAttributes','order','sort','pick','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','create','Dynamics365Field','Descriptions','getFields','ticketType','Incident','PhoneCall','title','description','customerid','caseorigincode','subject','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','substring','format'];(function(_0x145331,_0x46af5d){var _0x1dd3c0=function(_0x1034c5){while(--_0x1034c5){_0x145331['push'](_0x145331['shift']());}};_0x1dd3c0(++_0x46af5d);}(_0x495e,0xfb));var _0xe495=function(_0x32b122,_0x1ad490){_0x32b122=_0x32b122-0x0;var _0x4ad25a=_0x495e[_0x32b122];return _0x4ad25a;};'use strict';var emlformat=require(_0xe495('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe495('0x1'));var rp=require(_0xe495('0x2'));var moment=require(_0xe495('0x3'));var BPromise=require(_0xe495('0x4'));var Mustache=require('mustache');var util=require(_0xe495('0x5'));var path=require(_0xe495('0x6'));var sox=require(_0xe495('0x7'));var csv=require(_0xe495('0x8'));var ejs=require(_0xe495('0x9'));var fs=require('fs');var fs_extra=require(_0xe495('0xa'));var _=require(_0xe495('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe495('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe495('0xd'));var Papa=require(_0xe495('0xe'));var Redis=require(_0xe495('0xf'));var authService=require(_0xe495('0x10'));var qs=require(_0xe495('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe495('0x12'));var logger=require(_0xe495('0x13'))(_0xe495('0x14'));var utils=require('../../config/utils');var config=require(_0xe495('0x15'));var licenseUtil=require(_0xe495('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1d73a5,_0x13aedb){_0x13aedb=_0x13aedb||0xcc;return function(_0x5df017){if(_0x5df017){return _0x1d73a5[_0xe495('0x17')](_0x13aedb);}return _0x1d73a5[_0xe495('0x18')](_0x13aedb)[_0xe495('0x19')]();};}function respondWithResult(_0x14744d,_0x2b5e19){_0x2b5e19=_0x2b5e19||0xc8;return function(_0x593205){if(_0x593205){return _0x14744d[_0xe495('0x18')](_0x2b5e19)[_0xe495('0x1a')](_0x593205);}};}function respondWithFilteredResult(_0x19d096,_0x1c2d78){return function(_0x1ea256){if(_0x1ea256){var _0x48864f=typeof _0x1c2d78['offset']==='undefined'&&typeof _0x1c2d78[_0xe495('0x1b')]===_0xe495('0x1c');var _0x2aa692=_0x1ea256['count'];var _0x1e602c=_0x48864f?0x0:_0x1c2d78[_0xe495('0x1d')];var _0x3ba8cc=_0x48864f?_0x1ea256[_0xe495('0x1e')]:_0x1c2d78[_0xe495('0x1d')]+_0x1c2d78['limit'];var _0x4dfcb7;if(_0x3ba8cc>=_0x2aa692){_0x3ba8cc=_0x2aa692;_0x4dfcb7=0xc8;}else{_0x4dfcb7=0xce;}_0x19d096[_0xe495('0x18')](_0x4dfcb7);return _0x19d096[_0xe495('0x1f')](_0xe495('0x20'),_0x1e602c+'-'+_0x3ba8cc+'/'+_0x2aa692)[_0xe495('0x1a')](_0x1ea256);}return null;};}function patchUpdates(_0x5d5d35){return function(_0x3d4d3c){try{jsonpatch[_0xe495('0x21')](_0x3d4d3c,_0x5d5d35,!![]);}catch(_0x463ba9){return BPromise['reject'](_0x463ba9);}return _0x3d4d3c[_0xe495('0x22')]();};}function saveUpdates(_0x17d13f,_0x475a7e){return function(_0x22cbc3){if(_0x22cbc3){return _0x22cbc3[_0xe495('0x23')](_0x17d13f)['then'](function(_0x33f19){return _0x33f19;});}return null;};}function removeEntity(_0x4d836b,_0x181ead){return function(_0x39cff4){if(_0x39cff4){return _0x39cff4[_0xe495('0x24')]()['then'](function(){_0x4d836b[_0xe495('0x18')](0xcc)[_0xe495('0x19')]();});}};}function handleEntityNotFound(_0x740be5,_0x1db488){return function(_0x21513b){if(!_0x21513b){_0x740be5[_0xe495('0x17')](0x194);}return _0x21513b;};}function handleError(_0x1ffd8b,_0x48b2eb){_0x48b2eb=_0x48b2eb||0x1f4;return function(_0x5a2c68){logger[_0xe495('0x25')](_0x5a2c68['stack']);if(_0x5a2c68[_0xe495('0x26')]){delete _0x5a2c68[_0xe495('0x26')];}_0x1ffd8b['status'](_0x48b2eb)['send'](_0x5a2c68);};}exports[_0xe495('0x27')]=function(_0x620f00,_0xb2c47){var _0x8623c1={},_0x18c427={},_0x258d9c={'count':0x0,'rows':[]};var _0x181d26=_[_0xe495('0x28')](db['Dynamics365Account']['rawAttributes'],function(_0x37b75){return{'name':_0x37b75[_0xe495('0x29')],'type':_0x37b75[_0xe495('0x2a')][_0xe495('0x2b')]};});_0x18c427['model']=_[_0xe495('0x28')](_0x181d26,_0xe495('0x26'));_0x18c427[_0xe495('0x2c')]=_[_0xe495('0x2d')](_0x620f00[_0xe495('0x2c')]);_0x18c427[_0xe495('0x2e')]=_[_0xe495('0x2f')](_0x18c427[_0xe495('0x30')],_0x18c427[_0xe495('0x2c')]);_0x8623c1[_0xe495('0x31')]=_[_0xe495('0x2f')](_0x18c427[_0xe495('0x30')],qs[_0xe495('0x32')](_0x620f00[_0xe495('0x2c')][_0xe495('0x32')]));_0x8623c1['attributes']=_0x8623c1[_0xe495('0x31')][_0xe495('0x33')]?_0x8623c1['attributes']:_0x18c427[_0xe495('0x30')];if(!_0x620f00[_0xe495('0x2c')]['hasOwnProperty']('nolimit')){_0x8623c1[_0xe495('0x1b')]=qs[_0xe495('0x1b')](_0x620f00[_0xe495('0x2c')][_0xe495('0x1b')]);_0x8623c1['offset']=qs[_0xe495('0x1d')](_0x620f00[_0xe495('0x2c')][_0xe495('0x1d')]);}_0x8623c1['order']=qs['sort'](_0x620f00[_0xe495('0x2c')]['sort']);_0x8623c1[_0xe495('0x34')]=qs[_0xe495('0x2e')](_['pick'](_0x620f00['query'],_0x18c427[_0xe495('0x2e')]),_0x181d26);if(_0x620f00[_0xe495('0x2c')][_0xe495('0x35')]){_0x8623c1[_0xe495('0x34')]=_[_0xe495('0x36')](_0x8623c1[_0xe495('0x34')],{'$or':_[_0xe495('0x28')](_0x181d26,function(_0x43f94f){if(_0x43f94f[_0xe495('0x2a')]!==_0xe495('0x37')){var _0x4f566b={};_0x4f566b[_0x43f94f[_0xe495('0x26')]]={'$like':'%'+_0x620f00['query'][_0xe495('0x35')]+'%'};return _0x4f566b;}})});}_0x8623c1=_[_0xe495('0x36')]({},_0x8623c1,_0x620f00[_0xe495('0x38')]);var _0x6cb073={'where':_0x8623c1['where']};return db[_0xe495('0x39')][_0xe495('0x1e')](_0x6cb073)['then'](function(_0x49e4b4){_0x258d9c['count']=_0x49e4b4;if(_0x620f00[_0xe495('0x2c')][_0xe495('0x3a')]){_0x8623c1[_0xe495('0x3b')]=[{'all':!![]}];}return db[_0xe495('0x39')][_0xe495('0x3c')](_0x8623c1);})[_0xe495('0x3d')](function(_0x4df7d3){_0x258d9c[_0xe495('0x3e')]=_0x4df7d3;return _0x258d9c;})[_0xe495('0x3d')](respondWithFilteredResult(_0xb2c47,_0x8623c1))[_0xe495('0x3f')](handleError(_0xb2c47,null));};exports[_0xe495('0x40')]=function(_0x33d831,_0x2ff501){var _0x39ddda={'raw':![],'where':{'id':_0x33d831[_0xe495('0x41')]['id']}},_0x778cea={};_0x778cea['model']=_['keys'](db[_0xe495('0x39')]['rawAttributes']);_0x778cea[_0xe495('0x2c')]=_[_0xe495('0x2d')](_0x33d831['query']);_0x778cea[_0xe495('0x2e')]=_['intersection'](_0x778cea['model'],_0x778cea[_0xe495('0x2c')]);_0x39ddda['attributes']=_[_0xe495('0x2f')](_0x778cea['model'],qs[_0xe495('0x32')](_0x33d831[_0xe495('0x2c')][_0xe495('0x32')]));_0x39ddda[_0xe495('0x31')]=_0x39ddda[_0xe495('0x31')][_0xe495('0x33')]?_0x39ddda[_0xe495('0x31')]:_0x778cea[_0xe495('0x30')];if(_0x33d831[_0xe495('0x2c')][_0xe495('0x3a')]){_0x39ddda['include']=[{'all':!![]}];}_0x39ddda=_[_0xe495('0x36')]({},_0x39ddda,_0x33d831['options']);return db[_0xe495('0x39')][_0xe495('0x42')](_0x39ddda)[_0xe495('0x3d')](handleEntityNotFound(_0x2ff501,null))[_0xe495('0x3d')](respondWithResult(_0x2ff501,null))['catch'](handleError(_0x2ff501,null));};exports['create']=function(_0x54a346,_0x3b3fb1){return db[_0xe495('0x39')]['create'](_0x54a346[_0xe495('0x43')],{})[_0xe495('0x3d')](respondWithResult(_0x3b3fb1,0xc9))[_0xe495('0x3f')](handleError(_0x3b3fb1,null));};exports[_0xe495('0x23')]=function(_0x13fa96,_0x11f801){if(_0x13fa96[_0xe495('0x43')]['id']){delete _0x13fa96['body']['id'];}return db[_0xe495('0x39')][_0xe495('0x42')]({'where':{'id':_0x13fa96[_0xe495('0x41')]['id']}})[_0xe495('0x3d')](handleEntityNotFound(_0x11f801,null))[_0xe495('0x3d')](saveUpdates(_0x13fa96['body'],null))['then'](respondWithResult(_0x11f801,null))[_0xe495('0x3f')](handleError(_0x11f801,null));};exports[_0xe495('0x24')]=function(_0x1b81fd,_0x53cd3f){return db['Dynamics365Account'][_0xe495('0x42')]({'where':{'id':_0x1b81fd['params']['id']}})[_0xe495('0x3d')](handleEntityNotFound(_0x53cd3f,null))[_0xe495('0x3d')](removeEntity(_0x53cd3f,null))['catch'](handleError(_0x53cd3f,null));};exports[_0xe495('0x44')]=function(_0x3e03a2,_0xb3f987,_0x45813c){var _0x2161e2={};var _0xb8959a={};var _0x9b12f9;var _0x2dd789;return db[_0xe495('0x39')][_0xe495('0x45')]({'where':{'id':_0x3e03a2[_0xe495('0x41')]['id']}})[_0xe495('0x3d')](handleEntityNotFound(_0xb3f987,null))['then'](function(_0x444bb1){if(_0x444bb1){_0x9b12f9=_0x444bb1;_0xb8959a[_0xe495('0x30')]=_[_0xe495('0x2d')](db[_0xe495('0x46')][_0xe495('0x47')]);_0xb8959a[_0xe495('0x2c')]=_[_0xe495('0x2d')](_0x3e03a2[_0xe495('0x2c')]);_0xb8959a[_0xe495('0x2e')]=_[_0xe495('0x2f')](_0xb8959a['model'],_0xb8959a['query']);_0x2161e2[_0xe495('0x31')]=_[_0xe495('0x2f')](_0xb8959a['model'],qs[_0xe495('0x32')](_0x3e03a2[_0xe495('0x2c')][_0xe495('0x32')]));_0x2161e2[_0xe495('0x31')]=_0x2161e2['attributes'][_0xe495('0x33')]?_0x2161e2[_0xe495('0x31')]:_0xb8959a[_0xe495('0x30')];_0x2161e2[_0xe495('0x48')]=qs[_0xe495('0x49')](_0x3e03a2[_0xe495('0x2c')]['sort']);_0x2161e2[_0xe495('0x34')]=qs['filters'](_[_0xe495('0x4a')](_0x3e03a2['query'],_0xb8959a[_0xe495('0x2e')]));if(_0x3e03a2['query'][_0xe495('0x35')]){_0x2161e2['where']=_[_0xe495('0x36')](_0x2161e2[_0xe495('0x34')],{'$or':_['map'](_0x2161e2[_0xe495('0x31')],function(_0x1ccb69){var _0x1371e9={};_0x1371e9[_0x1ccb69]={'$like':'%'+_0x3e03a2[_0xe495('0x2c')][_0xe495('0x35')]+'%'};return _0x1371e9;})});}_0x2161e2=_[_0xe495('0x36')]({},_0x2161e2,_0x3e03a2[_0xe495('0x38')]);return _0x9b12f9[_0xe495('0x44')](_0x2161e2);}})[_0xe495('0x3d')](function(_0x11906c){if(_0x11906c){_0x2dd789=_0x11906c[_0xe495('0x33')];if(!_0x3e03a2[_0xe495('0x2c')][_0xe495('0x4b')](_0xe495('0x4c'))){_0x2161e2[_0xe495('0x1b')]=qs[_0xe495('0x1b')](_0x3e03a2[_0xe495('0x2c')][_0xe495('0x1b')]);_0x2161e2[_0xe495('0x1d')]=qs[_0xe495('0x1d')](_0x3e03a2[_0xe495('0x2c')]['offset']);}return _0x9b12f9[_0xe495('0x44')](_0x2161e2);}})['then'](function(_0x3f0766){if(_0x3f0766){return _0x3f0766?{'count':_0x2dd789,'rows':_0x3f0766}:null;}})[_0xe495('0x3d')](respondWithResult(_0xb3f987,null))['catch'](handleError(_0xb3f987,null));};exports[_0xe495('0x4d')]=function(_0x5ea667,_0x518419,_0x23d962){if(_0x5ea667[_0xe495('0x43')]['id']){delete _0x5ea667['body']['id'];}return db[_0xe495('0x39')][_0xe495('0x45')]({'where':{'id':_0x5ea667[_0xe495('0x41')]['id']}})[_0xe495('0x3d')](handleEntityNotFound(_0x518419,null))['then'](function(_0x894486){if(_0x894486){_0x5ea667[_0xe495('0x43')][_0xe495('0x4e')]=_0x894486['id'];_0x5ea667[_0xe495('0x43')][_0xe495('0x4f')]=integrations['getSubjects'](_0x5ea667[_0xe495('0x43')][_0xe495('0x50')],_0x5ea667[_0xe495('0x43')][_0xe495('0x2a')]);_0x5ea667[_0xe495('0x43')]['Descriptions']=integrations['getDescriptions'](_0x5ea667[_0xe495('0x43')][_0xe495('0x50')],_0x5ea667[_0xe495('0x43')]['type']);return db[_0xe495('0x46')][_0xe495('0x51')](_0x5ea667[_0xe495('0x43')],{'include':[{'model':db[_0xe495('0x52')],'as':_0xe495('0x4f')},{'model':db[_0xe495('0x52')],'as':_0xe495('0x53')}]});}return null;})[_0xe495('0x3d')](respondWithResult(_0x518419,null))['catch'](handleError(_0x518419,null));};exports[_0xe495('0x54')]=function(_0xa73873,_0x23dc48,_0x1bf369){var _0x51ef2b=_0xa73873[_0xe495('0x2c')][_0xe495('0x55')];var _0x4beff2=_0x51ef2b==='incident'?_0xe495('0x56'):_0xe495('0x57');var _0x274aa4='';var _0x1aa3b5='';var _0x4059af='';var _0x3d5742='';var _0x4cdd91='';var _0x315ffd='';var _0x567f5b='';var _0xf8b70d='';var _0x1dfe93=[_0xe495('0x58'),_0xe495('0x59'),_0xe495('0x5a'),'ownerid',_0xe495('0x5b'),_0xe495('0x5c'),'phonenumber',_0xe495('0x5d'),_0xe495('0x5e'),'phonecall_activity_parties'];var _0x1c45b6=[_0xe495('0x5f'),_0xe495('0x60'),_0xe495('0x61'),_0xe495('0x62'),_0xe495('0x63'),_0xe495('0x64'),'contractdetailidname',_0xe495('0x65'),_0xe495('0x66'),'createdbyexternalpartyyominame',_0xe495('0x67'),_0xe495('0x68'),_0xe495('0x69'),_0xe495('0x6a'),'createdonbehalfbyyominame','customeridname',_0xe495('0x6b'),_0xe495('0x6c'),_0xe495('0x6d'),'entitlementidname',_0xe495('0x6e'),_0xe495('0x6f'),_0xe495('0x70'),_0xe495('0x71'),_0xe495('0x72'),_0xe495('0x73'),_0xe495('0x74'),_0xe495('0x75'),_0xe495('0x76'),_0xe495('0x77'),'masteridname','modifiedbyexternalpartyname',_0xe495('0x78'),_0xe495('0x79'),'modifiedbyyominame',_0xe495('0x7a'),_0xe495('0x7b'),_0xe495('0x7c'),_0xe495('0x7d'),'msdyn_iotalertname','numberofchildincidents','onholdtime',_0xe495('0x7e'),_0xe495('0x7f'),_0xe495('0x80'),_0xe495('0x81'),_0xe495('0x82'),_0xe495('0x83'),_0xe495('0x84'),_0xe495('0x85'),'productidname',_0xe495('0x86'),_0xe495('0x87'),_0xe495('0x88'),_0xe495('0x89'),_0xe495('0x8a'),_0xe495('0x8b'),_0xe495('0x8c'),_0xe495('0x8d'),_0xe495('0x8e'),_0xe495('0x8f'),_0xe495('0x90'),'statuscode',_0xe495('0x91'),_0xe495('0x92'),_0xe495('0x93'),_0xe495('0x94'),_0xe495('0x95'),_0xe495('0x96'),'versionnumber'];var _0xb07e72=_0x1dfe93[_0xe495('0x97')](_0x1c45b6);return db['Dynamics365Account'][_0xe495('0x45')]({'where':{'id':_0xa73873[_0xe495('0x41')]['id']},'attributes':['id',_0xe495('0x98'),_0xe495('0x99'),_0xe495('0x9a'),_0xe495('0x9b'),_0xe495('0x9c'),'clientSecret']})[_0xe495('0x3d')](handleEntityNotFound(_0x23dc48,null))['then'](function(_0x32e092){if(_0x32e092){_0xf8b70d=_0x32e092[_0xe495('0x9a')];var _0x222aec=_0xf8b70d['slice'](-0x1);if(_0x222aec==='/'){_0xf8b70d=_0xf8b70d[_0xe495('0x9d')](0x0,_0xf8b70d['lastIndexOf'](_0x222aec));}_0x567f5b=util[_0xe495('0x9e')](_0xe495('0x9f'),_0xf8b70d);var _0x1e2274={'method':_0xe495('0xa0'),'uri':_0xe495('0xa1')+_0x32e092[_0xe495('0x9b')]+_0xe495('0xa2'),'form':{'client_id':_0x32e092['clientId'],'resource':_0xf8b70d,'username':_0x32e092[_0xe495('0x98')],'password':_0x32e092[_0xe495('0x99')],'grant_type':_0xe495('0x99'),'client_secret':_0x32e092[_0xe495('0xa3')]},'json':!![]};return rp(_0x1e2274);}})[_0xe495('0x3d')](function(_0x56f658){_0x315ffd=_0x56f658[_0xe495('0xa4')];var _0xbb26a4={'method':_0xe495('0xa5'),'uri':encodeURI(_0x567f5b+_0xe495('0xa6')+_0x4beff2+'\x27'),'headers':{'Authorization':_0xe495('0xa7')+_0x315ffd,'If-None-Match':null,'OData-Version':_0xe495('0xa8')},'json':!![]};return rp(_0xbb26a4);})['then'](function(_0x3ff17f){var _0x234f6b=_0x3ff17f[_0xe495('0xa9')][0x0];var _0x2fe232=_0x234f6b[_0xe495('0xaa')];var _0x3f8db0={'method':_0xe495('0xa5'),'uri':_0x567f5b+_0xe495('0xab')+_0x2fe232+_0xe495('0xac'),'headers':{'Authorization':'Bearer\x20'+_0x315ffd,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3f8db0);})[_0xe495('0x3d')](function(_0x8aae75){_0x274aa4=_0x8aae75;_0x1aa3b5=_0x274aa4['Attributes'];_0x1aa3b5=_['remove'](_0x1aa3b5,function(_0x3dbae9){return!_0xb07e72[_0xe495('0xad')](_0x3dbae9['LogicalName']);});var _0x3dfb1f=[];var _0x1729c3=[];_0x1aa3b5[_0xe495('0xae')](function(_0x293220){if(_0x293220['@odata.type']){var _0x1af49f=_0x293220[_0xe495('0xaf')][_0xe495('0x9d')](_0x293220[_0xe495('0xaf')][_0xe495('0xb0')]('.')+0x1);if(_0x1af49f===_0xe495('0xb1')){_0x3dfb1f['push'](getSelectList(_0x567f5b,_0x51ef2b,_0x1729c3,_0x274aa4[_0xe495('0xaa')],_0x293220[_0xe495('0xaa')],_0x315ffd));}}});return Promise['all'](_0x3dfb1f);})[_0xe495('0x3d')](function(_0x1018ae){_0x4059af=_0x1018ae[0x0];var _0x19db42=[];var _0x224124=[];_0x1aa3b5[_0xe495('0xae')](function(_0x362832){if(!_[_0xe495('0xb2')](_0x362832[_0xe495('0xaf')])){var _0x1139bf=_0x362832[_0xe495('0xaf')]['substring'](_0x362832[_0xe495('0xaf')][_0xe495('0xb0')]('.')+0x1);if(_0x1139bf===_0xe495('0xb3')){_0x19db42[_0xe495('0xb4')](getBooleanList(_0x567f5b,_0x51ef2b,_0x224124,_0x274aa4[_0xe495('0xaa')],_0x362832['MetadataId'],_0x315ffd));}}});return Promise[_0xe495('0xb5')](_0x19db42);})['then'](function(_0x33e691){_0x3d5742=_0x33e691[0x0];var _0x40f51a=[];var _0x1198f1=[];_0x1aa3b5[_0xe495('0xae')](function(_0x3be16d){if(_0x3be16d[_0xe495('0xaf')]){var _0x31b518=_0x3be16d[_0xe495('0xaf')][_0xe495('0x9d')](_0x3be16d[_0xe495('0xaf')]['lastIndexOf']('.')+0x1);if(_0x31b518==='StringAttributeMetadata'||_0x31b518===_0xe495('0xb6')||_0x31b518===_0xe495('0xb7')||_0x31b518==='IntegerAttributeMetadata'||_0x31b518==='MemoAttributeMetadata'||_0x31b518===_0xe495('0xb8')||_0x31b518===_0xe495('0xb9')||_0x31b518===_0xe495('0xba')||_0x31b518==='StateAttributeMetadata'||_0x31b518===_0xe495('0xbb')){_0x40f51a[_0xe495('0xb4')](getInputList(_0x567f5b,_0x51ef2b,_0x31b518,_0x1198f1,_0x274aa4['MetadataId'],_0x3be16d[_0xe495('0xaa')],_0x315ffd));}}});return Promise[_0xe495('0xb5')](_0x40f51a);})[_0xe495('0x3d')](function(_0x14a9df){_0x4cdd91=_0x14a9df[0x0];var _0x5d1cf4=_0x4059af[_0xe495('0x97')](_0x3d5742)[_0xe495('0x97')](_0x4cdd91);var _0x376e84={'count':_0x5d1cf4[_0xe495('0x33')],'rows':_0x5d1cf4};return _0x376e84;})['then'](respondWithResult(_0x23dc48,null))[_0xe495('0x3f')](function(_0x4631aa){var _0x4257a2=_0xa73873[_0xe495('0x2c')]['test']?0x1f4:_0x4631aa[_0xe495('0xbc')]||0x1f4;logger['error'](_0x4631aa['stack']);delete _0x4631aa[_0xe495('0x26')];if(_0x4257a2===0x191){_0x4257a2=0x190;}_0x23dc48[_0xe495('0x18')](_0x4257a2)[_0xe495('0xbd')](_0xa73873[_0xe495('0x2c')]['test']?{'message':_0xe495('0xbe'),'statusCode':_0x4631aa[_0xe495('0xbc')]}:_0x4631aa);});};function getSelectList(_0x5e91a9,_0x4ec144,_0x3d8eef,_0x218dd9,_0x38f480,_0x42d944){var _0x9f76e8={'method':_0xe495('0xa5'),'uri':_0x5e91a9+_0xe495('0xab')+_0x218dd9+_0xe495('0xbf')+_0x38f480+_0xe495('0xc0')+_0xe495('0xc1'),'headers':{'Authorization':_0xe495('0xa7')+_0x42d944,'If-None-Match':null,'OData-Version':_0xe495('0xa8')},'json':!![]};return rp(_0x9f76e8)[_0xe495('0x3d')](function(_0x4e21dc){var _0xbf121f=[];var _0x58f3ad=_0x4e21dc[_0xe495('0xc2')][_0xe495('0xc3')];_0x58f3ad[_0xe495('0xae')](function(_0x35e91c){_0xbf121f[_0xe495('0xb4')]({'name':_0x35e91c[_0xe495('0xc4')][_0xe495('0xc5')][_0xe495('0xc4')],'value':String(_0x35e91c['Value'])});});var _0x5cee64={'id':_0x4ec144+'_'+_0x4e21dc[_0xe495('0xc6')],'name':_0x4e21dc[_0xe495('0xc7')]['UserLocalizedLabel'][_0xe495('0xc4')],'custom':![],'options':_0xbf121f};_0x3d8eef[_0xe495('0xb4')](_0x5cee64);return _0x3d8eef;});}function getBooleanList(_0x34d418,_0x536857,_0x44664b,_0x5837c4,_0xf6d54c,_0x180f5a){var _0x2c71ca={'method':_0xe495('0xa5'),'uri':_0x34d418+'EntityDefinitions('+_0x5837c4+_0xe495('0xbf')+_0xf6d54c+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xe495('0xa7')+_0x180f5a,'If-None-Match':null,'OData-Version':_0xe495('0xa8')},'json':!![]};return rp(_0x2c71ca)[_0xe495('0x3d')](function(_0x4da1c5){var _0x13329a=[];_0x13329a['push']({'name':_0x4da1c5[_0xe495('0xc2')][_0xe495('0xc8')]['Label'][_0xe495('0xc5')][_0xe495('0xc4')],'value':_0xe495('0xc9')},{'name':_0x4da1c5[_0xe495('0xc2')][_0xe495('0xca')][_0xe495('0xc4')][_0xe495('0xc5')]['Label'],'value':_0xe495('0xcb')});var _0x17d8ba={'id':_0x536857+'_'+_0x4da1c5[_0xe495('0xc6')],'name':_0x4da1c5[_0xe495('0xc7')]['UserLocalizedLabel'][_0xe495('0xc4')],'custom':![],'options':_0x13329a};_0x44664b[_0xe495('0xb4')](_0x17d8ba);return _0x44664b;});}function getInputList(_0x4c38f5,_0xc45ce9,_0x3508f3,_0x59e594,_0x5e50b3,_0x48fa1f,_0x22a862){var _0x4c2a14={'method':'GET','uri':_0x4c38f5+_0xe495('0xab')+_0x5e50b3+_0xe495('0xbf')+_0x48fa1f+')/Microsoft.Dynamics.CRM.'+_0x3508f3+_0xe495('0xcc'),'headers':{'Authorization':_0xe495('0xa7')+_0x22a862,'If-None-Match':null,'OData-Version':_0xe495('0xa8')},'json':!![]};return rp(_0x4c2a14)[_0xe495('0x3d')](function(_0x419a51){var _0x3a7e2b={'id':_0xc45ce9+'_'+_0x419a51['LogicalName'],'name':_0x419a51[_0xe495('0xc7')]['UserLocalizedLabel']?_0x419a51[_0xe495('0xc7')][_0xe495('0xc5')][_0xe495('0xc4')]:_0x419a51['LogicalName'],'custom':![],'options':[]};_0x59e594[_0xe495('0xb4')](_0x3a7e2b);return _0x59e594;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index aa1efb7..93eed02 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 _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x4b954c,_0x10fa1e){var _0x1d3b83=function(_0xa05c72){while(--_0xa05c72){_0x4b954c['push'](_0x4b954c['shift']());}};_0x1d3b83(++_0x10fa1e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xb7e7[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x55be03,_0x58375a){var _0x745919=function(_0x147e34){while(--_0x147e34){_0x55be03['push'](_0x55be03['shift']());}};_0x745919(++_0x58375a);}(_0xe706,0xa3));var _0x6e70=function(_0x2d778d,_0x453b15){_0x2d778d=_0x2d778d-0x0;var _0x41d05b=_0xe706[_0x2d778d];return _0x41d05b;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 09ce277..e0b0f61 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 _0xda60=['catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','ShowDynamics365Account','find','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda60,0xfb));var _0x0da6=function(_0x5b697a,_0x280202){_0x5b697a=_0x5b697a-0x0;var _0x5de43b=_0xda60[_0x5b697a];return _0x5de43b;};'use strict';var _=require(_0x0da6('0x0'));var util=require(_0x0da6('0x1'));var moment=require('moment');var BPromise=require(_0x0da6('0x2'));var rs=require(_0x0da6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0da6('0x4'));var logger=require('../../config/logger')(_0x0da6('0x5'));var config=require(_0x0da6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0da6('0x7')][_0x0da6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52c63e,_0x4febbd,_0x7e1b1){return new BPromise(function(_0x49ee54,_0x3a0a03){return client[_0x0da6('0x9')](_0x52c63e,_0x7e1b1)[_0x0da6('0xa')](function(_0x4420d6){logger[_0x0da6('0xb')](_0x0da6('0xc'),_0x4febbd,_0x0da6('0xd'));logger[_0x0da6('0xe')](_0x0da6('0xf'),_0x4febbd,_0x0da6('0xd'),JSON[_0x0da6('0x10')](_0x4420d6));if(_0x4420d6['error']){if(_0x4420d6[_0x0da6('0x11')][_0x0da6('0x12')]===0x1f4){logger['error'](_0x0da6('0xc'),_0x4febbd,_0x4420d6['error'][_0x0da6('0x13')]);return _0x3a0a03(_0x4420d6[_0x0da6('0x11')][_0x0da6('0x13')]);}logger['error'](_0x0da6('0xc'),_0x4febbd,_0x4420d6[_0x0da6('0x11')]['message']);return _0x49ee54(_0x4420d6['error'][_0x0da6('0x13')]);}else{logger['info'](_0x0da6('0xc'),_0x4febbd,_0x0da6('0xd'));_0x49ee54(_0x4420d6[_0x0da6('0x14')]['message']);}})[_0x0da6('0x15')](function(_0x5ef46c){logger[_0x0da6('0x11')](_0x0da6('0xc'),_0x4febbd,_0x5ef46c);_0x3a0a03(_0x5ef46c);});});}exports[_0x0da6('0x16')]=function(_0x111951){var _0x22cea4=this;return new Promise(function(_0x3e3931,_0x4d373b){return db[_0x0da6('0x17')][_0x0da6('0x18')]({'raw':_0x111951[_0x0da6('0x19')]?_0x111951['options'][_0x0da6('0x1a')]===undefined?!![]:![]:!![],'where':_0x111951[_0x0da6('0x19')]?_0x111951['options'][_0x0da6('0x1b')]||null:null,'attributes':_0x111951[_0x0da6('0x19')]?_0x111951[_0x0da6('0x19')][_0x0da6('0x1c')]||null:null,'limit':_0x111951[_0x0da6('0x19')]?_0x111951[_0x0da6('0x19')]['limit']||null:null,'include':_0x111951['options']?_0x111951['options'][_0x0da6('0x1d')]?_['map'](_0x111951['options']['include'],function(_0x56a8ea){return{'model':db[_0x56a8ea['model']],'as':_0x56a8ea['as'],'attributes':_0x56a8ea[_0x0da6('0x1c')],'include':_0x56a8ea[_0x0da6('0x1d')]?_['map'](_0x56a8ea['include'],function(_0x3811b0){return{'model':db[_0x3811b0['model']],'as':_0x3811b0['as'],'attributes':_0x3811b0[_0x0da6('0x1c')],'include':_0x3811b0[_0x0da6('0x1d')]?_[_0x0da6('0x1e')](_0x3811b0[_0x0da6('0x1d')],function(_0x398f0a){return{'model':db[_0x398f0a[_0x0da6('0x1f')]],'as':_0x398f0a['as'],'attributes':_0x398f0a[_0x0da6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0da6('0xa')](function(_0xee8071){logger[_0x0da6('0xb')](_0x0da6('0x16'),_0x111951);logger[_0x0da6('0xe')]('GetDynamics365Account',_0x111951,JSON[_0x0da6('0x10')](_0xee8071));_0x3e3931(_0xee8071);})[_0x0da6('0x15')](function(_0x37dfcb){logger['error']('GetDynamics365Account',_0x37dfcb[_0x0da6('0x13')],_0x111951);_0x4d373b(_0x22cea4['error'](0x1f4,_0x37dfcb[_0x0da6('0x13')]));});});};exports[_0x0da6('0x20')]=function(_0xe9ed8a){var _0x5a7224=this;return new Promise(function(_0x24f4ca,_0x77154b){return db[_0x0da6('0x17')][_0x0da6('0x21')]({'raw':_0xe9ed8a[_0x0da6('0x19')]?_0xe9ed8a['options'][_0x0da6('0x1a')]===undefined?!![]:![]:!![],'where':_0xe9ed8a[_0x0da6('0x19')]?_0xe9ed8a[_0x0da6('0x19')][_0x0da6('0x1b')]||null:null,'attributes':_0xe9ed8a[_0x0da6('0x19')]?_0xe9ed8a[_0x0da6('0x19')][_0x0da6('0x1c')]||null:null,'include':_0xe9ed8a[_0x0da6('0x19')]?_0xe9ed8a['options'][_0x0da6('0x1d')]?_[_0x0da6('0x1e')](_0xe9ed8a['options'][_0x0da6('0x1d')],function(_0x52f3b8){return{'model':db[_0x52f3b8[_0x0da6('0x1f')]],'as':_0x52f3b8['as'],'attributes':_0x52f3b8[_0x0da6('0x1c')],'include':_0x52f3b8[_0x0da6('0x1d')]?_[_0x0da6('0x1e')](_0x52f3b8[_0x0da6('0x1d')],function(_0x453615){return{'model':db[_0x453615['model']],'as':_0x453615['as'],'attributes':_0x453615[_0x0da6('0x1c')],'include':_0x453615[_0x0da6('0x1d')]?_[_0x0da6('0x1e')](_0x453615[_0x0da6('0x1d')],function(_0xe9fca1){return{'model':db[_0xe9fca1[_0x0da6('0x1f')]],'as':_0xe9fca1['as'],'attributes':_0xe9fca1[_0x0da6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f8dff){logger[_0x0da6('0xb')]('ShowDynamics365Account',_0xe9ed8a);logger[_0x0da6('0xe')](_0x0da6('0x20'),_0xe9ed8a,JSON[_0x0da6('0x10')](_0x3f8dff));_0x24f4ca(_0x3f8dff);})[_0x0da6('0x15')](function(_0x561569){logger[_0x0da6('0x11')](_0x0da6('0x20'),_0x561569[_0x0da6('0x13')],_0xe9ed8a);_0x77154b(_0x5a7224[_0x0da6('0x11')](0x1f4,_0x561569['message']));});});}; \ No newline at end of file +var _0x819a=['../../config/logger','rpc','../../config/environment','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','Dynamics365Account','findAll','options','where','attributes','limit','include','map','model','then','GetDynamics365Account','stringify','ShowDynamics365Account','find','raw','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x819a,0xaf));var _0xa819=function(_0x11eec5,_0x49c834){_0x11eec5=_0x11eec5-0x0;var _0x184378=_0x819a[_0x11eec5];return _0x184378;};'use strict';var _=require(_0xa819('0x0'));var util=require('util');var moment=require(_0xa819('0x1'));var BPromise=require(_0xa819('0x2'));var rs=require(_0xa819('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa819('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa819('0x5'))(_0xa819('0x6'));var config=require(_0xa819('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa819('0x8')][_0xa819('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51a277,_0xeafdf9,_0x5b8519){return new BPromise(function(_0x53e7a2,_0x18a552){return client[_0xa819('0xa')](_0x51a277,_0x5b8519)['then'](function(_0x44d4ca){logger[_0xa819('0xb')](_0xa819('0xc'),_0xeafdf9,'request\x20sent');logger[_0xa819('0xd')](_0xa819('0xe'),_0xeafdf9,_0xa819('0xf'),JSON['stringify'](_0x44d4ca));if(_0x44d4ca['error']){if(_0x44d4ca[_0xa819('0x10')][_0xa819('0x11')]===0x1f4){logger[_0xa819('0x10')](_0xa819('0xc'),_0xeafdf9,_0x44d4ca[_0xa819('0x10')][_0xa819('0x12')]);return _0x18a552(_0x44d4ca[_0xa819('0x10')][_0xa819('0x12')]);}logger[_0xa819('0x10')](_0xa819('0xc'),_0xeafdf9,_0x44d4ca[_0xa819('0x10')][_0xa819('0x12')]);return _0x53e7a2(_0x44d4ca['error'][_0xa819('0x12')]);}else{logger['info'](_0xa819('0xc'),_0xeafdf9,'request\x20sent');_0x53e7a2(_0x44d4ca[_0xa819('0x13')][_0xa819('0x12')]);}})[_0xa819('0x14')](function(_0x1fa750){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0xeafdf9,_0x1fa750);_0x18a552(_0x1fa750);});});}exports['GetDynamics365Account']=function(_0x4c3a17){var _0x354c5a=this;return new Promise(function(_0x4f72c2,_0x4096ee){return db[_0xa819('0x15')][_0xa819('0x16')]({'raw':_0x4c3a17['options']?_0x4c3a17['options']['raw']===undefined?!![]:![]:!![],'where':_0x4c3a17[_0xa819('0x17')]?_0x4c3a17[_0xa819('0x17')][_0xa819('0x18')]||null:null,'attributes':_0x4c3a17['options']?_0x4c3a17[_0xa819('0x17')][_0xa819('0x19')]||null:null,'limit':_0x4c3a17[_0xa819('0x17')]?_0x4c3a17[_0xa819('0x17')][_0xa819('0x1a')]||null:null,'include':_0x4c3a17[_0xa819('0x17')]?_0x4c3a17[_0xa819('0x17')][_0xa819('0x1b')]?_[_0xa819('0x1c')](_0x4c3a17[_0xa819('0x17')]['include'],function(_0x5cf98d){return{'model':db[_0x5cf98d[_0xa819('0x1d')]],'as':_0x5cf98d['as'],'attributes':_0x5cf98d[_0xa819('0x19')],'include':_0x5cf98d[_0xa819('0x1b')]?_[_0xa819('0x1c')](_0x5cf98d[_0xa819('0x1b')],function(_0x322e1f){return{'model':db[_0x322e1f['model']],'as':_0x322e1f['as'],'attributes':_0x322e1f[_0xa819('0x19')],'include':_0x322e1f[_0xa819('0x1b')]?_[_0xa819('0x1c')](_0x322e1f['include'],function(_0x488459){return{'model':db[_0x488459['model']],'as':_0x488459['as'],'attributes':_0x488459[_0xa819('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa819('0x1e')](function(_0x3941ec){logger[_0xa819('0xb')](_0xa819('0x1f'),_0x4c3a17);logger[_0xa819('0xd')]('GetDynamics365Account',_0x4c3a17,JSON[_0xa819('0x20')](_0x3941ec));_0x4f72c2(_0x3941ec);})[_0xa819('0x14')](function(_0x1a4bb3){logger['error'](_0xa819('0x1f'),_0x1a4bb3[_0xa819('0x12')],_0x4c3a17);_0x4096ee(_0x354c5a[_0xa819('0x10')](0x1f4,_0x1a4bb3[_0xa819('0x12')]));});});};exports[_0xa819('0x21')]=function(_0x580b21){var _0x1bfebc=this;return new Promise(function(_0x275afc,_0x451561){return db[_0xa819('0x15')][_0xa819('0x22')]({'raw':_0x580b21[_0xa819('0x17')]?_0x580b21[_0xa819('0x17')][_0xa819('0x23')]===undefined?!![]:![]:!![],'where':_0x580b21['options']?_0x580b21[_0xa819('0x17')][_0xa819('0x18')]||null:null,'attributes':_0x580b21[_0xa819('0x17')]?_0x580b21[_0xa819('0x17')][_0xa819('0x19')]||null:null,'include':_0x580b21[_0xa819('0x17')]?_0x580b21[_0xa819('0x17')][_0xa819('0x1b')]?_[_0xa819('0x1c')](_0x580b21['options'][_0xa819('0x1b')],function(_0x2c0e98){return{'model':db[_0x2c0e98[_0xa819('0x1d')]],'as':_0x2c0e98['as'],'attributes':_0x2c0e98[_0xa819('0x19')],'include':_0x2c0e98['include']?_[_0xa819('0x1c')](_0x2c0e98[_0xa819('0x1b')],function(_0x40309f){return{'model':db[_0x40309f[_0xa819('0x1d')]],'as':_0x40309f['as'],'attributes':_0x40309f[_0xa819('0x19')],'include':_0x40309f[_0xa819('0x1b')]?_[_0xa819('0x1c')](_0x40309f[_0xa819('0x1b')],function(_0x28876e){return{'model':db[_0x28876e[_0xa819('0x1d')]],'as':_0x28876e['as'],'attributes':_0x28876e[_0xa819('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa819('0x1e')](function(_0x514397){logger[_0xa819('0xb')]('ShowDynamics365Account',_0x580b21);logger[_0xa819('0xd')](_0xa819('0x21'),_0x580b21,JSON[_0xa819('0x20')](_0x514397));_0x275afc(_0x514397);})[_0xa819('0x14')](function(_0x56ce4d){logger[_0xa819('0x10')](_0xa819('0x21'),_0x56ce4d[_0xa819('0x12')],_0x580b21);_0x451561(_0x1bfebc['error'](0x1f4,_0x56ce4d[_0xa819('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index fa82fa0..17d9d15 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 _0x88c3=['multer','path','Router','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','put','destroy'];(function(_0x46ba3c,_0x4d78f1){var _0x410ee7=function(_0x539d9b){while(--_0x539d9b){_0x46ba3c['push'](_0x46ba3c['shift']());}};_0x410ee7(++_0x4d78f1);}(_0x88c3,0x1ee));var _0x388c=function(_0x2937aa,_0x5e1bd7){_0x2937aa=_0x2937aa-0x0;var _0x1ae680=_0x88c3[_0x2937aa];return _0x1ae680;};'use strict';var multer=require(_0x388c('0x0'));var util=require('util');var path=require(_0x388c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x388c('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x388c('0x3'));var config=require(_0x388c('0x4'));var controller=require(_0x388c('0x5'));router[_0x388c('0x6')]('/',auth[_0x388c('0x7')](),controller[_0x388c('0x8')]);router['get'](_0x388c('0x9'),auth[_0x388c('0x7')](),controller[_0x388c('0xa')]);router[_0x388c('0x6')](_0x388c('0xb'),auth[_0x388c('0x7')](),controller[_0x388c('0xc')]);router[_0x388c('0x6')]('/:id/subjects',auth[_0x388c('0x7')](),controller['getSubjects']);router['get'](_0x388c('0xd'),auth[_0x388c('0x7')](),controller[_0x388c('0xe')]);router[_0x388c('0xf')]('/',auth[_0x388c('0x7')](),controller[_0x388c('0x10')]);router[_0x388c('0x11')](_0x388c('0x9'),auth[_0x388c('0x7')](),controller['update']);router['delete']('/:id',auth[_0x388c('0x7')](),controller[_0x388c('0x12')]);module['exports']=router; \ No newline at end of file +var _0x30fc=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x20ac35,_0x278bff){var _0x147230=function(_0xe5cc5c){while(--_0xe5cc5c){_0x20ac35['push'](_0x20ac35['shift']());}};_0x147230(++_0x278bff);}(_0x30fc,0x64));var _0xc30f=function(_0x1ee5be,_0x5f46e3){_0x1ee5be=_0x1ee5be-0x0;var _0x177140=_0x30fc[_0x1ee5be];return _0x177140;};'use strict';var multer=require(_0xc30f('0x0'));var util=require(_0xc30f('0x1'));var path=require('path');var timeout=require(_0xc30f('0x2'));var express=require(_0xc30f('0x3'));var router=express[_0xc30f('0x4')]();var fs_extra=require(_0xc30f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc30f('0x6'));var config=require(_0xc30f('0x7'));var controller=require(_0xc30f('0x8'));router[_0xc30f('0x9')]('/',auth[_0xc30f('0xa')](),controller[_0xc30f('0xb')]);router['get'](_0xc30f('0xc'),auth[_0xc30f('0xa')](),controller[_0xc30f('0xd')]);router[_0xc30f('0x9')](_0xc30f('0xe'),auth[_0xc30f('0xa')](),controller[_0xc30f('0xf')]);router[_0xc30f('0x9')](_0xc30f('0x10'),auth['isAuthenticated'](),controller[_0xc30f('0x11')]);router['get'](_0xc30f('0x12'),auth[_0xc30f('0xa')](),controller[_0xc30f('0x13')]);router[_0xc30f('0x14')]('/',auth[_0xc30f('0xa')](),controller[_0xc30f('0x15')]);router['put']('/:id',auth[_0xc30f('0xa')](),controller[_0xc30f('0x16')]);router[_0xc30f('0x17')](_0xc30f('0xc'),auth['isAuthenticated'](),controller[_0xc30f('0x18')]);module[_0xc30f('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 6b42252..374c643 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 _0x11eb=['phonecall','contact','nothing','exports','STRING','incident'];(function(_0xa5d896,_0x263a1d){var _0x1c31f8=function(_0x5d9824){while(--_0x5d9824){_0xa5d896['push'](_0xa5d896['shift']());}};_0x1c31f8(++_0x263a1d);}(_0x11eb,0x1b3));var _0xb11e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x11eb[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0xb11e('0x0')]={'name':{'type':Sequelize[_0xb11e('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xb11e('0x2'),_0xb11e('0x3')),'defaultValue':_0xb11e('0x2')},'moduleCreate':{'type':Sequelize['ENUM'](_0xb11e('0x4'),_0xb11e('0x5')),'defaultValue':'contact','allowNull':![]}}; \ No newline at end of file +var _0x38d0=['phonecall','incident','contact','sequelize','exports','STRING'];(function(_0xdadd1f,_0x4b7d8e){var _0x27fc0a=function(_0x51335f){while(--_0x51335f){_0xdadd1f['push'](_0xdadd1f['shift']());}};_0x27fc0a(++_0x4b7d8e);}(_0x38d0,0x11d));var _0x038d=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x38d0[_0x4a747d];return _0x3a5b5c;};'use strict';var Sequelize=require(_0x038d('0x0'));module[_0x038d('0x1')]={'name':{'type':Sequelize[_0x038d('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM']('incident',_0x038d('0x3')),'defaultValue':_0x038d('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x038d('0x5'),'nothing'),'defaultValue':_0x038d('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 66a66a9..8b2915c 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 _0x6680=['bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','create','body','update','params','find','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6680,0x9c));var _0x0668=function(_0x3e63c6,_0x2c3160){_0x3e63c6=_0x3e63c6-0x0;var _0x5216af=_0x6680[_0x3e63c6];return _0x5216af;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0668('0x0'));var zipdir=require(_0x0668('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0668('0x2'));var moment=require(_0x0668('0x3'));var BPromise=require(_0x0668('0x4'));var Mustache=require('mustache');var util=require(_0x0668('0x5'));var path=require(_0x0668('0x6'));var sox=require(_0x0668('0x7'));var csv=require(_0x0668('0x8'));var ejs=require(_0x0668('0x9'));var fs=require('fs');var fs_extra=require(_0x0668('0xa'));var _=require(_0x0668('0xb'));var squel=require('squel');var crypto=require(_0x0668('0xc'));var jsforce=require(_0x0668('0xd'));var deskjs=require(_0x0668('0xe'));var toCsv=require(_0x0668('0x8'));var querystring=require(_0x0668('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0668('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0668('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0668('0x12'))(_0x0668('0x13'));var utils=require(_0x0668('0x14'));var config=require(_0x0668('0x15'));var licenseUtil=require(_0x0668('0x16'));var db=require(_0x0668('0x17'))['db'];function respondWithStatusCode(_0x20a5c0,_0x448595){_0x448595=_0x448595||0xcc;return function(_0x527a87){if(_0x527a87){return _0x20a5c0[_0x0668('0x18')](_0x448595);}return _0x20a5c0[_0x0668('0x19')](_0x448595)[_0x0668('0x1a')]();};}function respondWithResult(_0x56e8bd,_0x3e990e){_0x3e990e=_0x3e990e||0xc8;return function(_0x195aca){if(_0x195aca){return _0x56e8bd[_0x0668('0x19')](_0x3e990e)[_0x0668('0x1b')](_0x195aca);}};}function respondWithFilteredResult(_0xc58ae1,_0x3c235b){return function(_0x18aff1){if(_0x18aff1){var _0x5295a4=typeof _0x3c235b[_0x0668('0x1c')]==='undefined'&&typeof _0x3c235b[_0x0668('0x1d')]===_0x0668('0x1e');var _0x50c6fa=_0x18aff1['count'];var _0x39c9e2=_0x5295a4?0x0:_0x3c235b[_0x0668('0x1c')];var _0x2369df=_0x5295a4?_0x18aff1[_0x0668('0x1f')]:_0x3c235b[_0x0668('0x1c')]+_0x3c235b[_0x0668('0x1d')];var _0x54b8dc;if(_0x2369df>=_0x50c6fa){_0x2369df=_0x50c6fa;_0x54b8dc=0xc8;}else{_0x54b8dc=0xce;}_0xc58ae1[_0x0668('0x19')](_0x54b8dc);return _0xc58ae1[_0x0668('0x20')](_0x0668('0x21'),_0x39c9e2+'-'+_0x2369df+'/'+_0x50c6fa)['json'](_0x18aff1);}return null;};}function patchUpdates(_0x1f4c93){return function(_0x4e6a8b){try{jsonpatch[_0x0668('0x22')](_0x4e6a8b,_0x1f4c93,!![]);}catch(_0x1bd67b){return BPromise[_0x0668('0x23')](_0x1bd67b);}return _0x4e6a8b[_0x0668('0x24')]();};}function saveUpdates(_0xaba3ab,_0x910bc8){return function(_0x40f974){if(_0x40f974){return _0x40f974['update'](_0xaba3ab)[_0x0668('0x25')](function(_0x3c99e3){return _0x3c99e3;});}return null;};}function removeEntity(_0x3ab229,_0xbec455){return function(_0x2e4fc7){if(_0x2e4fc7){return _0x2e4fc7[_0x0668('0x26')]()[_0x0668('0x25')](function(){_0x3ab229['status'](0xcc)[_0x0668('0x1a')]();});}};}function handleEntityNotFound(_0x581cfe,_0x29d6c3){return function(_0x352b2c){if(!_0x352b2c){_0x581cfe[_0x0668('0x18')](0x194);}return _0x352b2c;};}function handleError(_0x443e3f,_0x1e5beb){_0x1e5beb=_0x1e5beb||0x1f4;return function(_0x5e3b54){logger[_0x0668('0x27')](_0x5e3b54[_0x0668('0x28')]);if(_0x5e3b54[_0x0668('0x29')]){delete _0x5e3b54['name'];}_0x443e3f[_0x0668('0x19')](_0x1e5beb)[_0x0668('0x2a')](_0x5e3b54);};}exports['index']=function(_0x1ed6b0,_0x4e6c79){var _0x59d46b={},_0x2a3c4e={},_0x5451ae={'count':0x0,'rows':[]};var _0x4e12dd=_[_0x0668('0x2b')](db[_0x0668('0x2c')][_0x0668('0x2d')],function(_0x19396b){return{'name':_0x19396b[_0x0668('0x2e')],'type':_0x19396b[_0x0668('0x2f')][_0x0668('0x30')]};});_0x2a3c4e[_0x0668('0x31')]=_[_0x0668('0x2b')](_0x4e12dd,'name');_0x2a3c4e['query']=_[_0x0668('0x32')](_0x1ed6b0[_0x0668('0x33')]);_0x2a3c4e[_0x0668('0x34')]=_[_0x0668('0x35')](_0x2a3c4e[_0x0668('0x31')],_0x2a3c4e[_0x0668('0x33')]);_0x59d46b[_0x0668('0x36')]=_[_0x0668('0x35')](_0x2a3c4e[_0x0668('0x31')],qs['fields'](_0x1ed6b0[_0x0668('0x33')][_0x0668('0x37')]));_0x59d46b['attributes']=_0x59d46b[_0x0668('0x36')][_0x0668('0x38')]?_0x59d46b[_0x0668('0x36')]:_0x2a3c4e['model'];if(!_0x1ed6b0[_0x0668('0x33')][_0x0668('0x39')](_0x0668('0x3a'))){_0x59d46b['limit']=qs[_0x0668('0x1d')](_0x1ed6b0[_0x0668('0x33')]['limit']);_0x59d46b[_0x0668('0x1c')]=qs[_0x0668('0x1c')](_0x1ed6b0[_0x0668('0x33')][_0x0668('0x1c')]);}_0x59d46b[_0x0668('0x3b')]=qs[_0x0668('0x3c')](_0x1ed6b0[_0x0668('0x33')]['sort']);_0x59d46b[_0x0668('0x3d')]=qs['filters'](_[_0x0668('0x3e')](_0x1ed6b0['query'],_0x2a3c4e[_0x0668('0x34')]),_0x4e12dd);if(_0x1ed6b0[_0x0668('0x33')][_0x0668('0x3f')]){_0x59d46b['where']=_[_0x0668('0x40')](_0x59d46b['where'],{'$or':_[_0x0668('0x2b')](_0x4e12dd,function(_0x4bfce0){if(_0x4bfce0['type']!==_0x0668('0x41')){var _0x4597f3={};_0x4597f3[_0x4bfce0[_0x0668('0x29')]]={'$like':'%'+_0x1ed6b0[_0x0668('0x33')]['filter']+'%'};return _0x4597f3;}})});}_0x59d46b=_['merge']({},_0x59d46b,_0x1ed6b0[_0x0668('0x42')]);var _0x54b612={'where':_0x59d46b['where']};return db['Dynamics365Configuration'][_0x0668('0x1f')](_0x54b612)[_0x0668('0x25')](function(_0x2c1d67){_0x5451ae[_0x0668('0x1f')]=_0x2c1d67;if(_0x1ed6b0[_0x0668('0x33')][_0x0668('0x43')]){_0x59d46b[_0x0668('0x44')]=[{'all':!![]}];}return db[_0x0668('0x2c')]['findAll'](_0x59d46b);})[_0x0668('0x25')](function(_0xab6e1c){_0x5451ae['rows']=_0xab6e1c;return _0x5451ae;})['then'](respondWithFilteredResult(_0x4e6c79,_0x59d46b))['catch'](handleError(_0x4e6c79,null));};exports['show']=function(_0x157216,_0x5974c0){var _0x2e6f13={'raw':![],'where':{'id':_0x157216['params']['id']}},_0x214a06={};_0x214a06[_0x0668('0x31')]=_['keys'](db[_0x0668('0x2c')]['rawAttributes']);_0x214a06[_0x0668('0x33')]=_[_0x0668('0x32')](_0x157216[_0x0668('0x33')]);_0x214a06[_0x0668('0x34')]=_['intersection'](_0x214a06[_0x0668('0x31')],_0x214a06['query']);_0x2e6f13[_0x0668('0x36')]=_[_0x0668('0x35')](_0x214a06[_0x0668('0x31')],qs[_0x0668('0x37')](_0x157216[_0x0668('0x33')][_0x0668('0x37')]));_0x2e6f13[_0x0668('0x36')]=_0x2e6f13['attributes']['length']?_0x2e6f13[_0x0668('0x36')]:_0x214a06[_0x0668('0x31')];if(_0x157216[_0x0668('0x33')][_0x0668('0x43')]){_0x2e6f13[_0x0668('0x44')]=[{'all':!![]}];}_0x2e6f13=_[_0x0668('0x40')]({},_0x2e6f13,_0x157216[_0x0668('0x42')]);return db[_0x0668('0x2c')]['find'](_0x2e6f13)[_0x0668('0x25')](handleEntityNotFound(_0x5974c0,null))['then'](respondWithResult(_0x5974c0,null))[_0x0668('0x45')](handleError(_0x5974c0,null));};exports[_0x0668('0x46')]=function(_0x157b9c,_0x125176){return db[_0x0668('0x2c')][_0x0668('0x46')](_0x157b9c[_0x0668('0x47')],{})[_0x0668('0x25')](respondWithResult(_0x125176,0xc9))[_0x0668('0x45')](handleError(_0x125176,null));};exports[_0x0668('0x48')]=function(_0x6776fa,_0xca5fe0){if(_0x6776fa['body']['id']){delete _0x6776fa[_0x0668('0x47')]['id'];}return db[_0x0668('0x2c')]['find']({'where':{'id':_0x6776fa[_0x0668('0x49')]['id']}})[_0x0668('0x25')](handleEntityNotFound(_0xca5fe0,null))[_0x0668('0x25')](saveUpdates(_0x6776fa[_0x0668('0x47')],null))['then'](respondWithResult(_0xca5fe0,null))[_0x0668('0x45')](handleError(_0xca5fe0,null));};exports[_0x0668('0x26')]=function(_0x47d23d,_0x35c365){return db[_0x0668('0x2c')][_0x0668('0x4a')]({'where':{'id':_0x47d23d[_0x0668('0x49')]['id']}})['then'](handleEntityNotFound(_0x35c365,null))[_0x0668('0x25')](removeEntity(_0x35c365,null))[_0x0668('0x45')](handleError(_0x35c365,null));};exports[_0x0668('0x4b')]=function(_0x169cb4,_0x301210,_0x5a89b8){var _0x3c4f8c={};var _0x3dff3c={};var _0x1ecc59;var _0x2dacc5;return db[_0x0668('0x2c')][_0x0668('0x4c')]({'where':{'id':_0x169cb4[_0x0668('0x49')]['id']}})[_0x0668('0x25')](handleEntityNotFound(_0x301210,null))[_0x0668('0x25')](function(_0x31d4bf){if(_0x31d4bf){_0x1ecc59=_0x31d4bf;_0x3dff3c[_0x0668('0x31')]=_['keys'](db[_0x0668('0x4d')][_0x0668('0x2d')]);_0x3dff3c[_0x0668('0x33')]=_[_0x0668('0x32')](_0x169cb4[_0x0668('0x33')]);_0x3dff3c['filters']=_[_0x0668('0x35')](_0x3dff3c[_0x0668('0x31')],_0x3dff3c[_0x0668('0x33')]);_0x3c4f8c[_0x0668('0x36')]=_[_0x0668('0x35')](_0x3dff3c[_0x0668('0x31')],qs[_0x0668('0x37')](_0x169cb4[_0x0668('0x33')][_0x0668('0x37')]));_0x3c4f8c[_0x0668('0x36')]=_0x3c4f8c[_0x0668('0x36')][_0x0668('0x38')]?_0x3c4f8c['attributes']:_0x3dff3c[_0x0668('0x31')];_0x3c4f8c[_0x0668('0x3b')]=qs[_0x0668('0x3c')](_0x169cb4[_0x0668('0x33')][_0x0668('0x3c')]);_0x3c4f8c[_0x0668('0x3d')]=qs[_0x0668('0x34')](_['pick'](_0x169cb4[_0x0668('0x33')],_0x3dff3c[_0x0668('0x34')]));if(_0x169cb4[_0x0668('0x33')][_0x0668('0x3f')]){_0x3c4f8c[_0x0668('0x3d')]=_[_0x0668('0x40')](_0x3c4f8c['where'],{'$or':_[_0x0668('0x2b')](_0x3c4f8c['attributes'],function(_0x2f4259){var _0xd0d364={};_0xd0d364[_0x2f4259]={'$like':'%'+_0x169cb4[_0x0668('0x33')][_0x0668('0x3f')]+'%'};return _0xd0d364;})});}_0x3c4f8c=_[_0x0668('0x40')]({},_0x3c4f8c,_0x169cb4[_0x0668('0x42')]);return _0x1ecc59[_0x0668('0x4b')](_0x3c4f8c);}})[_0x0668('0x25')](function(_0x526c75){if(_0x526c75){_0x2dacc5=_0x526c75[_0x0668('0x38')];if(!_0x169cb4['query'][_0x0668('0x39')](_0x0668('0x3a'))){_0x3c4f8c[_0x0668('0x1d')]=qs[_0x0668('0x1d')](_0x169cb4[_0x0668('0x33')]['limit']);_0x3c4f8c['offset']=qs['offset'](_0x169cb4['query'][_0x0668('0x1c')]);}return _0x1ecc59[_0x0668('0x4b')](_0x3c4f8c);}})[_0x0668('0x25')](function(_0xca3734){if(_0xca3734){return _0xca3734?{'count':_0x2dacc5,'rows':_0xca3734}:null;}})[_0x0668('0x25')](respondWithResult(_0x301210,null))['catch'](handleError(_0x301210,null));};exports[_0x0668('0x4e')]=function(_0x200f40,_0x44033f,_0x3da81b){var _0x47ec8e={};var _0x454c79={};var _0x21d18f;var _0x2eb73f;return db['Dynamics365Configuration'][_0x0668('0x4c')]({'where':{'id':_0x200f40[_0x0668('0x49')]['id']}})[_0x0668('0x25')](handleEntityNotFound(_0x44033f,null))[_0x0668('0x25')](function(_0x55783a){if(_0x55783a){_0x21d18f=_0x55783a;_0x454c79[_0x0668('0x31')]=_[_0x0668('0x32')](db[_0x0668('0x4d')][_0x0668('0x2d')]);_0x454c79['query']=_[_0x0668('0x32')](_0x200f40[_0x0668('0x33')]);_0x454c79['filters']=_['intersection'](_0x454c79[_0x0668('0x31')],_0x454c79['query']);_0x47ec8e[_0x0668('0x36')]=_[_0x0668('0x35')](_0x454c79[_0x0668('0x31')],qs[_0x0668('0x37')](_0x200f40[_0x0668('0x33')][_0x0668('0x37')]));_0x47ec8e[_0x0668('0x36')]=_0x47ec8e[_0x0668('0x36')]['length']?_0x47ec8e[_0x0668('0x36')]:_0x454c79[_0x0668('0x31')];_0x47ec8e[_0x0668('0x3b')]=qs[_0x0668('0x3c')](_0x200f40['query']['sort']);_0x47ec8e[_0x0668('0x3d')]=qs['filters'](_[_0x0668('0x3e')](_0x200f40[_0x0668('0x33')],_0x454c79[_0x0668('0x34')]));if(_0x200f40[_0x0668('0x33')][_0x0668('0x3f')]){_0x47ec8e['where']=_['merge'](_0x47ec8e[_0x0668('0x3d')],{'$or':_[_0x0668('0x2b')](_0x47ec8e['attributes'],function(_0x32652a){var _0x4e92e8={};_0x4e92e8[_0x32652a]={'$like':'%'+_0x200f40[_0x0668('0x33')]['filter']+'%'};return _0x4e92e8;})});}_0x47ec8e=_['merge']({},_0x47ec8e,_0x200f40[_0x0668('0x42')]);return _0x21d18f[_0x0668('0x4e')](_0x47ec8e);}})[_0x0668('0x25')](function(_0x1d5c92){if(_0x1d5c92){_0x2eb73f=_0x1d5c92[_0x0668('0x38')];if(!_0x200f40[_0x0668('0x33')][_0x0668('0x39')]('nolimit')){_0x47ec8e[_0x0668('0x1d')]=qs['limit'](_0x200f40[_0x0668('0x33')]['limit']);_0x47ec8e[_0x0668('0x1c')]=qs[_0x0668('0x1c')](_0x200f40[_0x0668('0x33')][_0x0668('0x1c')]);}return _0x21d18f[_0x0668('0x4e')](_0x47ec8e);}})['then'](function(_0x4bd94e){if(_0x4bd94e){return _0x4bd94e?{'count':_0x2eb73f,'rows':_0x4bd94e}:null;}})[_0x0668('0x25')](respondWithResult(_0x44033f,null))[_0x0668('0x45')](handleError(_0x44033f,null));};exports[_0x0668('0x4f')]=function(_0x565c78,_0x4c472b,_0x2a4fd2){var _0x4928d4={};var _0x15fb78={};var _0x50a817;var _0x5a52ba;return db['Dynamics365Configuration'][_0x0668('0x4c')]({'where':{'id':_0x565c78[_0x0668('0x49')]['id']}})[_0x0668('0x25')](handleEntityNotFound(_0x4c472b,null))['then'](function(_0x658382){if(_0x658382){_0x50a817=_0x658382;_0x15fb78[_0x0668('0x31')]=_[_0x0668('0x32')](db[_0x0668('0x4d')]['rawAttributes']);_0x15fb78['query']=_[_0x0668('0x32')](_0x565c78[_0x0668('0x33')]);_0x15fb78[_0x0668('0x34')]=_[_0x0668('0x35')](_0x15fb78[_0x0668('0x31')],_0x15fb78[_0x0668('0x33')]);_0x4928d4[_0x0668('0x36')]=_[_0x0668('0x35')](_0x15fb78[_0x0668('0x31')],qs[_0x0668('0x37')](_0x565c78[_0x0668('0x33')][_0x0668('0x37')]));_0x4928d4[_0x0668('0x36')]=_0x4928d4[_0x0668('0x36')][_0x0668('0x38')]?_0x4928d4[_0x0668('0x36')]:_0x15fb78['model'];_0x4928d4['order']=qs[_0x0668('0x3c')](_0x565c78[_0x0668('0x33')][_0x0668('0x3c')]);_0x4928d4[_0x0668('0x3d')]=qs[_0x0668('0x34')](_[_0x0668('0x3e')](_0x565c78[_0x0668('0x33')],_0x15fb78[_0x0668('0x34')]));if(_0x565c78[_0x0668('0x33')][_0x0668('0x3f')]){_0x4928d4[_0x0668('0x3d')]=_['merge'](_0x4928d4[_0x0668('0x3d')],{'$or':_[_0x0668('0x2b')](_0x4928d4[_0x0668('0x36')],function(_0x31691a){var _0x3f57f6={};_0x3f57f6[_0x31691a]={'$like':'%'+_0x565c78['query'][_0x0668('0x3f')]+'%'};return _0x3f57f6;})});}_0x4928d4=_[_0x0668('0x40')]({},_0x4928d4,_0x565c78['options']);return _0x50a817['getDescriptions'](_0x4928d4);}})[_0x0668('0x25')](function(_0x95f8da){if(_0x95f8da){_0x5a52ba=_0x95f8da[_0x0668('0x38')];if(!_0x565c78[_0x0668('0x33')][_0x0668('0x39')](_0x0668('0x3a'))){_0x4928d4[_0x0668('0x1d')]=qs['limit'](_0x565c78[_0x0668('0x33')]['limit']);_0x4928d4['offset']=qs[_0x0668('0x1c')](_0x565c78[_0x0668('0x33')][_0x0668('0x1c')]);}return _0x50a817['getDescriptions'](_0x4928d4);}})['then'](function(_0x346e21){if(_0x346e21){return _0x346e21?{'count':_0x5a52ba,'rows':_0x346e21}:null;}})[_0x0668('0x25')](respondWithResult(_0x4c472b,null))[_0x0668('0x45')](handleError(_0x4c472b,null));}; \ No newline at end of file +var _0x5da5=['status','end','json','offset','undefined','count','apply','reject','save','then','destroy','stack','name','send','index','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','map','VIRTUAL','merge','options','Dynamics365Configuration','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','update','params','getFields','findOne','Dynamics365Field','filter','getSubjects','pick','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x118726,_0xe87a30){var _0x2f1062=function(_0x2910b6){while(--_0x2910b6){_0x118726['push'](_0x118726['shift']());}};_0x2f1062(++_0xe87a30);}(_0x5da5,0xcc));var _0x55da=function(_0x4da1a5,_0x2bedc7){_0x4da1a5=_0x4da1a5-0x0;var _0x3f5a9e=_0x5da5[_0x4da1a5];return _0x3f5a9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x55da('0x0'));var zipdir=require(_0x55da('0x1'));var jsonpatch=require(_0x55da('0x2'));var rp=require(_0x55da('0x3'));var moment=require(_0x55da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x55da('0x5'));var util=require(_0x55da('0x6'));var path=require('path');var sox=require(_0x55da('0x7'));var csv=require('to-csv');var ejs=require(_0x55da('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x55da('0x9'));var squel=require('squel');var crypto=require(_0x55da('0xa'));var jsforce=require(_0x55da('0xb'));var deskjs=require(_0x55da('0xc'));var toCsv=require(_0x55da('0xd'));var querystring=require('querystring');var Papa=require(_0x55da('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x55da('0xf'));var hardwareService=require(_0x55da('0x10'));var logger=require(_0x55da('0x11'))('api');var utils=require(_0x55da('0x12'));var config=require(_0x55da('0x13'));var licenseUtil=require(_0x55da('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50416b,_0x4a0185){_0x4a0185=_0x4a0185||0xcc;return function(_0x4c0691){if(_0x4c0691){return _0x50416b['sendStatus'](_0x4a0185);}return _0x50416b[_0x55da('0x15')](_0x4a0185)[_0x55da('0x16')]();};}function respondWithResult(_0x3cf497,_0x1b8d0f){_0x1b8d0f=_0x1b8d0f||0xc8;return function(_0x17eba5){if(_0x17eba5){return _0x3cf497[_0x55da('0x15')](_0x1b8d0f)[_0x55da('0x17')](_0x17eba5);}};}function respondWithFilteredResult(_0x3a73da,_0x427d8c){return function(_0x438ffc){if(_0x438ffc){var _0x46a4c5=typeof _0x427d8c[_0x55da('0x18')]==='undefined'&&typeof _0x427d8c['limit']===_0x55da('0x19');var _0xd809c6=_0x438ffc['count'];var _0x3ebfb1=_0x46a4c5?0x0:_0x427d8c[_0x55da('0x18')];var _0x3fa6d4=_0x46a4c5?_0x438ffc[_0x55da('0x1a')]:_0x427d8c[_0x55da('0x18')]+_0x427d8c['limit'];var _0xea6d0c;if(_0x3fa6d4>=_0xd809c6){_0x3fa6d4=_0xd809c6;_0xea6d0c=0xc8;}else{_0xea6d0c=0xce;}_0x3a73da[_0x55da('0x15')](_0xea6d0c);return _0x3a73da['set']('Content-Range',_0x3ebfb1+'-'+_0x3fa6d4+'/'+_0xd809c6)[_0x55da('0x17')](_0x438ffc);}return null;};}function patchUpdates(_0x4a40f6){return function(_0x4219cd){try{jsonpatch[_0x55da('0x1b')](_0x4219cd,_0x4a40f6,!![]);}catch(_0x19ba8c){return BPromise[_0x55da('0x1c')](_0x19ba8c);}return _0x4219cd[_0x55da('0x1d')]();};}function saveUpdates(_0x25b951,_0x318f3a){return function(_0x130ced){if(_0x130ced){return _0x130ced['update'](_0x25b951)[_0x55da('0x1e')](function(_0x1647bf){return _0x1647bf;});}return null;};}function removeEntity(_0x2d5489,_0x4485e6){return function(_0x31ec42){if(_0x31ec42){return _0x31ec42[_0x55da('0x1f')]()['then'](function(){_0x2d5489['status'](0xcc)[_0x55da('0x16')]();});}};}function handleEntityNotFound(_0xdd8c6c,_0x350845){return function(_0x59d2f5){if(!_0x59d2f5){_0xdd8c6c['sendStatus'](0x194);}return _0x59d2f5;};}function handleError(_0x732f8a,_0x21c5fc){_0x21c5fc=_0x21c5fc||0x1f4;return function(_0x3eca8b){logger['error'](_0x3eca8b[_0x55da('0x20')]);if(_0x3eca8b[_0x55da('0x21')]){delete _0x3eca8b[_0x55da('0x21')];}_0x732f8a[_0x55da('0x15')](_0x21c5fc)[_0x55da('0x22')](_0x3eca8b);};}exports[_0x55da('0x23')]=function(_0x316b9a,_0x4cbd96){var _0x39bccc={},_0x315fdc={},_0x37b27c={'count':0x0,'rows':[]};var _0x10a04e=_['map'](db['Dynamics365Configuration']['rawAttributes'],function(_0x2f1d53){return{'name':_0x2f1d53[_0x55da('0x24')],'type':_0x2f1d53[_0x55da('0x25')]['key']};});_0x315fdc['model']=_['map'](_0x10a04e,_0x55da('0x21'));_0x315fdc[_0x55da('0x26')]=_[_0x55da('0x27')](_0x316b9a[_0x55da('0x26')]);_0x315fdc[_0x55da('0x28')]=_[_0x55da('0x29')](_0x315fdc['model'],_0x315fdc[_0x55da('0x26')]);_0x39bccc[_0x55da('0x2a')]=_[_0x55da('0x29')](_0x315fdc[_0x55da('0x2b')],qs[_0x55da('0x2c')](_0x316b9a[_0x55da('0x26')]['fields']));_0x39bccc[_0x55da('0x2a')]=_0x39bccc[_0x55da('0x2a')][_0x55da('0x2d')]?_0x39bccc[_0x55da('0x2a')]:_0x315fdc[_0x55da('0x2b')];if(!_0x316b9a[_0x55da('0x26')][_0x55da('0x2e')](_0x55da('0x2f'))){_0x39bccc[_0x55da('0x30')]=qs[_0x55da('0x30')](_0x316b9a[_0x55da('0x26')][_0x55da('0x30')]);_0x39bccc['offset']=qs['offset'](_0x316b9a[_0x55da('0x26')][_0x55da('0x18')]);}_0x39bccc[_0x55da('0x31')]=qs[_0x55da('0x32')](_0x316b9a[_0x55da('0x26')]['sort']);_0x39bccc[_0x55da('0x33')]=qs[_0x55da('0x28')](_['pick'](_0x316b9a['query'],_0x315fdc[_0x55da('0x28')]),_0x10a04e);if(_0x316b9a[_0x55da('0x26')]['filter']){_0x39bccc['where']=_['merge'](_0x39bccc[_0x55da('0x33')],{'$or':_[_0x55da('0x34')](_0x10a04e,function(_0x30b951){if(_0x30b951[_0x55da('0x25')]!==_0x55da('0x35')){var _0x40817f={};_0x40817f[_0x30b951['name']]={'$like':'%'+_0x316b9a['query']['filter']+'%'};return _0x40817f;}})});}_0x39bccc=_[_0x55da('0x36')]({},_0x39bccc,_0x316b9a[_0x55da('0x37')]);var _0x58ff1e={'where':_0x39bccc['where']};return db[_0x55da('0x38')][_0x55da('0x1a')](_0x58ff1e)[_0x55da('0x1e')](function(_0x123675){_0x37b27c[_0x55da('0x1a')]=_0x123675;if(_0x316b9a['query'][_0x55da('0x39')]){_0x39bccc[_0x55da('0x3a')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x55da('0x3b')](_0x39bccc);})[_0x55da('0x1e')](function(_0x1d256d){_0x37b27c[_0x55da('0x3c')]=_0x1d256d;return _0x37b27c;})[_0x55da('0x1e')](respondWithFilteredResult(_0x4cbd96,_0x39bccc))[_0x55da('0x3d')](handleError(_0x4cbd96,null));};exports['show']=function(_0x98434e,_0x1758b4){var _0x8e68d5={'raw':![],'where':{'id':_0x98434e['params']['id']}},_0x119936={};_0x119936[_0x55da('0x2b')]=_[_0x55da('0x27')](db['Dynamics365Configuration'][_0x55da('0x3e')]);_0x119936[_0x55da('0x26')]=_[_0x55da('0x27')](_0x98434e[_0x55da('0x26')]);_0x119936['filters']=_[_0x55da('0x29')](_0x119936[_0x55da('0x2b')],_0x119936[_0x55da('0x26')]);_0x8e68d5[_0x55da('0x2a')]=_['intersection'](_0x119936[_0x55da('0x2b')],qs['fields'](_0x98434e[_0x55da('0x26')][_0x55da('0x2c')]));_0x8e68d5[_0x55da('0x2a')]=_0x8e68d5[_0x55da('0x2a')][_0x55da('0x2d')]?_0x8e68d5[_0x55da('0x2a')]:_0x119936['model'];if(_0x98434e[_0x55da('0x26')][_0x55da('0x39')]){_0x8e68d5[_0x55da('0x3a')]=[{'all':!![]}];}_0x8e68d5=_[_0x55da('0x36')]({},_0x8e68d5,_0x98434e[_0x55da('0x37')]);return db[_0x55da('0x38')][_0x55da('0x3f')](_0x8e68d5)[_0x55da('0x1e')](handleEntityNotFound(_0x1758b4,null))[_0x55da('0x1e')](respondWithResult(_0x1758b4,null))[_0x55da('0x3d')](handleError(_0x1758b4,null));};exports[_0x55da('0x40')]=function(_0x2451e4,_0x382932){return db[_0x55da('0x38')][_0x55da('0x40')](_0x2451e4[_0x55da('0x41')],{})[_0x55da('0x1e')](respondWithResult(_0x382932,0xc9))[_0x55da('0x3d')](handleError(_0x382932,null));};exports[_0x55da('0x42')]=function(_0x50405c,_0x452e9f){if(_0x50405c['body']['id']){delete _0x50405c[_0x55da('0x41')]['id'];}return db['Dynamics365Configuration'][_0x55da('0x3f')]({'where':{'id':_0x50405c[_0x55da('0x43')]['id']}})['then'](handleEntityNotFound(_0x452e9f,null))['then'](saveUpdates(_0x50405c[_0x55da('0x41')],null))[_0x55da('0x1e')](respondWithResult(_0x452e9f,null))[_0x55da('0x3d')](handleError(_0x452e9f,null));};exports['destroy']=function(_0x2323a2,_0x2c62c6){return db['Dynamics365Configuration']['find']({'where':{'id':_0x2323a2['params']['id']}})[_0x55da('0x1e')](handleEntityNotFound(_0x2c62c6,null))['then'](removeEntity(_0x2c62c6,null))[_0x55da('0x3d')](handleError(_0x2c62c6,null));};exports[_0x55da('0x44')]=function(_0x2b2e81,_0x5e18f8,_0x429b78){var _0x2ab6ee={};var _0x409117={};var _0x3d9667;var _0x28cb51;return db['Dynamics365Configuration'][_0x55da('0x45')]({'where':{'id':_0x2b2e81[_0x55da('0x43')]['id']}})[_0x55da('0x1e')](handleEntityNotFound(_0x5e18f8,null))[_0x55da('0x1e')](function(_0xccbef0){if(_0xccbef0){_0x3d9667=_0xccbef0;_0x409117['model']=_[_0x55da('0x27')](db[_0x55da('0x46')][_0x55da('0x3e')]);_0x409117[_0x55da('0x26')]=_['keys'](_0x2b2e81[_0x55da('0x26')]);_0x409117[_0x55da('0x28')]=_[_0x55da('0x29')](_0x409117[_0x55da('0x2b')],_0x409117[_0x55da('0x26')]);_0x2ab6ee['attributes']=_[_0x55da('0x29')](_0x409117[_0x55da('0x2b')],qs['fields'](_0x2b2e81[_0x55da('0x26')]['fields']));_0x2ab6ee['attributes']=_0x2ab6ee['attributes'][_0x55da('0x2d')]?_0x2ab6ee[_0x55da('0x2a')]:_0x409117['model'];_0x2ab6ee['order']=qs[_0x55da('0x32')](_0x2b2e81[_0x55da('0x26')]['sort']);_0x2ab6ee[_0x55da('0x33')]=qs['filters'](_['pick'](_0x2b2e81[_0x55da('0x26')],_0x409117[_0x55da('0x28')]));if(_0x2b2e81[_0x55da('0x26')][_0x55da('0x47')]){_0x2ab6ee['where']=_[_0x55da('0x36')](_0x2ab6ee[_0x55da('0x33')],{'$or':_[_0x55da('0x34')](_0x2ab6ee[_0x55da('0x2a')],function(_0x589602){var _0x5c0f1e={};_0x5c0f1e[_0x589602]={'$like':'%'+_0x2b2e81[_0x55da('0x26')][_0x55da('0x47')]+'%'};return _0x5c0f1e;})});}_0x2ab6ee=_['merge']({},_0x2ab6ee,_0x2b2e81['options']);return _0x3d9667[_0x55da('0x44')](_0x2ab6ee);}})[_0x55da('0x1e')](function(_0x586f2b){if(_0x586f2b){_0x28cb51=_0x586f2b[_0x55da('0x2d')];if(!_0x2b2e81[_0x55da('0x26')][_0x55da('0x2e')](_0x55da('0x2f'))){_0x2ab6ee[_0x55da('0x30')]=qs['limit'](_0x2b2e81[_0x55da('0x26')][_0x55da('0x30')]);_0x2ab6ee['offset']=qs['offset'](_0x2b2e81['query'][_0x55da('0x18')]);}return _0x3d9667[_0x55da('0x44')](_0x2ab6ee);}})[_0x55da('0x1e')](function(_0x208351){if(_0x208351){return _0x208351?{'count':_0x28cb51,'rows':_0x208351}:null;}})[_0x55da('0x1e')](respondWithResult(_0x5e18f8,null))[_0x55da('0x3d')](handleError(_0x5e18f8,null));};exports['getSubjects']=function(_0x345cbf,_0x1cb1a3,_0x2617f3){var _0x42af61={};var _0x122b2a={};var _0x324854;var _0x3d4f1e;return db[_0x55da('0x38')][_0x55da('0x45')]({'where':{'id':_0x345cbf['params']['id']}})['then'](handleEntityNotFound(_0x1cb1a3,null))[_0x55da('0x1e')](function(_0x5a9430){if(_0x5a9430){_0x324854=_0x5a9430;_0x122b2a[_0x55da('0x2b')]=_[_0x55da('0x27')](db[_0x55da('0x46')]['rawAttributes']);_0x122b2a[_0x55da('0x26')]=_[_0x55da('0x27')](_0x345cbf['query']);_0x122b2a[_0x55da('0x28')]=_[_0x55da('0x29')](_0x122b2a['model'],_0x122b2a[_0x55da('0x26')]);_0x42af61['attributes']=_[_0x55da('0x29')](_0x122b2a['model'],qs[_0x55da('0x2c')](_0x345cbf['query'][_0x55da('0x2c')]));_0x42af61[_0x55da('0x2a')]=_0x42af61['attributes'][_0x55da('0x2d')]?_0x42af61[_0x55da('0x2a')]:_0x122b2a['model'];_0x42af61[_0x55da('0x31')]=qs[_0x55da('0x32')](_0x345cbf[_0x55da('0x26')][_0x55da('0x32')]);_0x42af61[_0x55da('0x33')]=qs[_0x55da('0x28')](_['pick'](_0x345cbf['query'],_0x122b2a['filters']));if(_0x345cbf[_0x55da('0x26')][_0x55da('0x47')]){_0x42af61[_0x55da('0x33')]=_[_0x55da('0x36')](_0x42af61['where'],{'$or':_[_0x55da('0x34')](_0x42af61['attributes'],function(_0x49685a){var _0xca728e={};_0xca728e[_0x49685a]={'$like':'%'+_0x345cbf[_0x55da('0x26')][_0x55da('0x47')]+'%'};return _0xca728e;})});}_0x42af61=_[_0x55da('0x36')]({},_0x42af61,_0x345cbf[_0x55da('0x37')]);return _0x324854[_0x55da('0x48')](_0x42af61);}})['then'](function(_0x37ba90){if(_0x37ba90){_0x3d4f1e=_0x37ba90['length'];if(!_0x345cbf[_0x55da('0x26')][_0x55da('0x2e')]('nolimit')){_0x42af61[_0x55da('0x30')]=qs['limit'](_0x345cbf[_0x55da('0x26')][_0x55da('0x30')]);_0x42af61[_0x55da('0x18')]=qs[_0x55da('0x18')](_0x345cbf[_0x55da('0x26')]['offset']);}return _0x324854['getSubjects'](_0x42af61);}})[_0x55da('0x1e')](function(_0x368268){if(_0x368268){return _0x368268?{'count':_0x3d4f1e,'rows':_0x368268}:null;}})['then'](respondWithResult(_0x1cb1a3,null))[_0x55da('0x3d')](handleError(_0x1cb1a3,null));};exports['getDescriptions']=function(_0x22d798,_0x4fb23c,_0x4b8f1f){var _0x446a99={};var _0x91b02={};var _0x5cea75;var _0x5b7f59;return db[_0x55da('0x38')][_0x55da('0x45')]({'where':{'id':_0x22d798[_0x55da('0x43')]['id']}})[_0x55da('0x1e')](handleEntityNotFound(_0x4fb23c,null))[_0x55da('0x1e')](function(_0x2f1f7f){if(_0x2f1f7f){_0x5cea75=_0x2f1f7f;_0x91b02[_0x55da('0x2b')]=_['keys'](db[_0x55da('0x46')][_0x55da('0x3e')]);_0x91b02[_0x55da('0x26')]=_[_0x55da('0x27')](_0x22d798[_0x55da('0x26')]);_0x91b02[_0x55da('0x28')]=_[_0x55da('0x29')](_0x91b02['model'],_0x91b02[_0x55da('0x26')]);_0x446a99[_0x55da('0x2a')]=_[_0x55da('0x29')](_0x91b02['model'],qs[_0x55da('0x2c')](_0x22d798[_0x55da('0x26')][_0x55da('0x2c')]));_0x446a99['attributes']=_0x446a99[_0x55da('0x2a')]['length']?_0x446a99[_0x55da('0x2a')]:_0x91b02[_0x55da('0x2b')];_0x446a99[_0x55da('0x31')]=qs[_0x55da('0x32')](_0x22d798[_0x55da('0x26')][_0x55da('0x32')]);_0x446a99['where']=qs[_0x55da('0x28')](_[_0x55da('0x49')](_0x22d798[_0x55da('0x26')],_0x91b02[_0x55da('0x28')]));if(_0x22d798['query'][_0x55da('0x47')]){_0x446a99[_0x55da('0x33')]=_[_0x55da('0x36')](_0x446a99['where'],{'$or':_[_0x55da('0x34')](_0x446a99['attributes'],function(_0x670b34){var _0x1be76b={};_0x1be76b[_0x670b34]={'$like':'%'+_0x22d798['query']['filter']+'%'};return _0x1be76b;})});}_0x446a99=_['merge']({},_0x446a99,_0x22d798['options']);return _0x5cea75[_0x55da('0x4a')](_0x446a99);}})[_0x55da('0x1e')](function(_0x5c3cc3){if(_0x5c3cc3){_0x5b7f59=_0x5c3cc3['length'];if(!_0x22d798['query']['hasOwnProperty'](_0x55da('0x2f'))){_0x446a99[_0x55da('0x30')]=qs[_0x55da('0x30')](_0x22d798[_0x55da('0x26')][_0x55da('0x30')]);_0x446a99[_0x55da('0x18')]=qs[_0x55da('0x18')](_0x22d798['query'][_0x55da('0x18')]);}return _0x5cea75['getDescriptions'](_0x446a99);}})[_0x55da('0x1e')](function(_0x457f1b){if(_0x457f1b){return _0x457f1b?{'count':_0x5b7f59,'rows':_0x457f1b}:null;}})[_0x55da('0x1e')](respondWithResult(_0x4fb23c,null))[_0x55da('0x3d')](handleError(_0x4fb23c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index aa887a0..427fddc 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 _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x9bde89,_0x5d7eab){var _0x3907f5=function(_0xaa931a){while(--_0xaa931a){_0x9bde89['push'](_0x9bde89['shift']());}};_0x3907f5(++_0x5d7eab);}(_0xdace,0xc5));var _0xedac=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0xdace[_0x1f71d8];return _0x10b045;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0x18737e,_0x35f807){var _0x519414=function(_0x2d32a2){while(--_0x2d32a2){_0x18737e['push'](_0x18737e['shift']());}};_0x519414(++_0x35f807);}(_0x9f62,0x154));var _0x29f6=function(_0x53b65a,_0x583d3d){_0x53b65a=_0x53b65a-0x0;var _0x4aee4c=_0x9f62[_0x53b65a];return _0x4aee4c;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'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 e2befa3..927c16a 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 _0xa63b=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','Dynamics365Configuration,\x20%s,\x20%s','lodash','util'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa63b,0xe5));var _0xba63=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa63b[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xba63('0x0'));var util=require(_0xba63('0x1'));var moment=require('moment');var BPromise=require(_0xba63('0x2'));var rs=require(_0xba63('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xba63('0x4'));var logger=require(_0xba63('0x5'))(_0xba63('0x6'));var config=require(_0xba63('0x7'));var jayson=require(_0xba63('0x8'));var client=jayson[_0xba63('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a7290,_0x991c7c,_0xb6c2f4){return new BPromise(function(_0x5803d,_0x3c178c){return client[_0xba63('0xa')](_0x2a7290,_0xb6c2f4)[_0xba63('0xb')](function(_0x13f2a7){logger[_0xba63('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x991c7c,_0xba63('0xd'));logger[_0xba63('0xe')](_0xba63('0xf'),_0x991c7c,_0xba63('0xd'),JSON[_0xba63('0x10')](_0x13f2a7));if(_0x13f2a7['error']){if(_0x13f2a7['error'][_0xba63('0x11')]===0x1f4){logger[_0xba63('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x991c7c,_0x13f2a7[_0xba63('0x12')][_0xba63('0x13')]);return _0x3c178c(_0x13f2a7[_0xba63('0x12')]['message']);}logger[_0xba63('0x12')](_0xba63('0x14'),_0x991c7c,_0x13f2a7[_0xba63('0x12')]['message']);return _0x5803d(_0x13f2a7[_0xba63('0x12')]['message']);}else{logger[_0xba63('0xc')](_0xba63('0x14'),_0x991c7c,_0xba63('0xd'));_0x5803d(_0x13f2a7['result']['message']);}})['catch'](function(_0x46d5dd){logger[_0xba63('0x12')](_0xba63('0x14'),_0x991c7c,_0x46d5dd);_0x3c178c(_0x46d5dd);});});} \ No newline at end of file +var _0xebc0=['../../config/environment','http','request','then','info','debug','request\x20sent','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4ca6a4,_0x5e9694){var _0x120555=function(_0x56888c){while(--_0x56888c){_0x4ca6a4['push'](_0x4ca6a4['shift']());}};_0x120555(++_0x5e9694);}(_0xebc0,0x150));var _0x0ebc=function(_0x1ed164,_0x3080f7){_0x1ed164=_0x1ed164-0x0;var _0x263181=_0xebc0[_0x1ed164];return _0x263181;};'use strict';var _=require(_0x0ebc('0x0'));var util=require(_0x0ebc('0x1'));var moment=require(_0x0ebc('0x2'));var BPromise=require(_0x0ebc('0x3'));var rs=require(_0x0ebc('0x4'));var fs=require('fs');var Redis=require(_0x0ebc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ebc('0x6'));var logger=require(_0x0ebc('0x7'))(_0x0ebc('0x8'));var config=require(_0x0ebc('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0ebc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b3591,_0x5e746c,_0x29859a){return new BPromise(function(_0x5a8adb,_0x4dd04b){return client[_0x0ebc('0xb')](_0x4b3591,_0x29859a)[_0x0ebc('0xc')](function(_0x127cae){logger[_0x0ebc('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5e746c,'request\x20sent');logger[_0x0ebc('0xe')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x5e746c,_0x0ebc('0xf'),JSON[_0x0ebc('0x10')](_0x127cae));if(_0x127cae[_0x0ebc('0x11')]){if(_0x127cae['error'][_0x0ebc('0x12')]===0x1f4){logger['error'](_0x0ebc('0x13'),_0x5e746c,_0x127cae[_0x0ebc('0x11')][_0x0ebc('0x14')]);return _0x4dd04b(_0x127cae[_0x0ebc('0x11')][_0x0ebc('0x14')]);}logger[_0x0ebc('0x11')](_0x0ebc('0x13'),_0x5e746c,_0x127cae[_0x0ebc('0x11')][_0x0ebc('0x14')]);return _0x5a8adb(_0x127cae[_0x0ebc('0x11')][_0x0ebc('0x14')]);}else{logger['info'](_0x0ebc('0x13'),_0x5e746c,_0x0ebc('0xf'));_0x5a8adb(_0x127cae[_0x0ebc('0x15')][_0x0ebc('0x14')]);}})[_0x0ebc('0x16')](function(_0x18e8ce){logger[_0x0ebc('0x11')](_0x0ebc('0x13'),_0x5e746c,_0x18e8ce);_0x4dd04b(_0x18e8ce);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 483d9c3..9450295 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 _0x421c=['/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index'];(function(_0x2a139b,_0x2fca1e){var _0xa5a34e=function(_0x49b4ec){while(--_0x49b4ec){_0x2a139b['push'](_0x2a139b['shift']());}};_0xa5a34e(++_0x2fca1e);}(_0x421c,0x1b7));var _0xc421=function(_0x5d81cc,_0x4b97c1){_0x5d81cc=_0x5d81cc-0x0;var _0x243fa0=_0x421c[_0x5d81cc];return _0x243fa0;};'use strict';var multer=require(_0xc421('0x0'));var util=require(_0xc421('0x1'));var path=require(_0xc421('0x2'));var timeout=require(_0xc421('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc421('0x4'));var interaction=require(_0xc421('0x5'));var config=require(_0xc421('0x6'));var controller=require(_0xc421('0x7'));router[_0xc421('0x8')]('/',auth[_0xc421('0x9')](),controller[_0xc421('0xa')]);router[_0xc421('0x8')](_0xc421('0xb'),auth[_0xc421('0x9')](),controller[_0xc421('0xc')]);router['post']('/',auth[_0xc421('0x9')](),controller['create']);router[_0xc421('0xd')]('/:id',auth[_0xc421('0x9')](),controller[_0xc421('0xe')]);router[_0xc421('0xf')]('/:id',auth[_0xc421('0x9')](),controller[_0xc421('0x10')]);module[_0xc421('0x11')]=router; \ No newline at end of file +var _0x69df=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util'];(function(_0xbb711,_0x307980){var _0x50ce1b=function(_0x3cc732){while(--_0x3cc732){_0xbb711['push'](_0xbb711['shift']());}};_0x50ce1b(++_0x307980);}(_0x69df,0x76));var _0xf69d=function(_0xead859,_0x3682ba){_0xead859=_0xead859-0x0;var _0x5ae5bb=_0x69df[_0xead859];return _0x5ae5bb;};'use strict';var multer=require(_0xf69d('0x0'));var util=require(_0xf69d('0x1'));var path=require(_0xf69d('0x2'));var timeout=require(_0xf69d('0x3'));var express=require(_0xf69d('0x4'));var router=express[_0xf69d('0x5')]();var fs_extra=require(_0xf69d('0x6'));var auth=require(_0xf69d('0x7'));var interaction=require(_0xf69d('0x8'));var config=require(_0xf69d('0x9'));var controller=require('./intDynamics365Field.controller');router[_0xf69d('0xa')]('/',auth[_0xf69d('0xb')](),controller[_0xf69d('0xc')]);router[_0xf69d('0xa')](_0xf69d('0xd'),auth[_0xf69d('0xb')](),controller[_0xf69d('0xe')]);router[_0xf69d('0xf')]('/',auth[_0xf69d('0xb')](),controller[_0xf69d('0x10')]);router[_0xf69d('0x11')]('/:id',auth[_0xf69d('0xb')](),controller[_0xf69d('0x12')]);router['delete'](_0xf69d('0xd'),auth[_0xf69d('0xb')](),controller['destroy']);module[_0xf69d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 1b08519..446f6c2 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 _0x5d64=['exports','ENUM','variable','customVariable','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x21bf9a,_0x3e14d1){var _0xf9c382=function(_0x5db97a){while(--_0x5db97a){_0x21bf9a['push'](_0x21bf9a['shift']());}};_0xf9c382(++_0x3e14d1);}(_0x5d64,0x143));var _0x45d6=function(_0x44647e,_0x407934){_0x44647e=_0x44647e-0x0;var _0x325e4a=_0x5d64[_0x44647e];return _0x325e4a;};'use strict';var Sequelize=require(_0x45d6('0x0'));module[_0x45d6('0x1')]={'type':{'type':Sequelize[_0x45d6('0x2')]('string',_0x45d6('0x3'),_0x45d6('0x4'),'keyValue',_0x45d6('0x5')),'defaultValue':_0x45d6('0x6')},'content':{'type':Sequelize[_0x45d6('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x45d6('0x6'),_0x45d6('0x3'),_0x45d6('0x4'))},'keyContent':{'type':Sequelize[_0x45d6('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x45d6('0x7')]},'customField':{'type':Sequelize[_0x45d6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd0c0=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','ENUM','string'];(function(_0x5e02f9,_0x2f90d7){var _0x363710=function(_0x290742){while(--_0x290742){_0x5e02f9['push'](_0x5e02f9['shift']());}};_0x363710(++_0x2f90d7);}(_0xd0c0,0x12f));var _0x0d0c=function(_0x2aaa68,_0x158cf3){_0x2aaa68=_0x2aaa68-0x0;var _0x27c3a9=_0xd0c0[_0x2aaa68];return _0x27c3a9;};'use strict';var Sequelize=require(_0x0d0c('0x0'));module['exports']={'type':{'type':Sequelize[_0x0d0c('0x1')](_0x0d0c('0x2'),'variable',_0x0d0c('0x3'),_0x0d0c('0x4'),_0x0d0c('0x5')),'defaultValue':_0x0d0c('0x2')},'content':{'type':Sequelize[_0x0d0c('0x6')]},'key':{'type':Sequelize[_0x0d0c('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x0d0c('0x2'),_0x0d0c('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x0d0c('0x6')]},'idField':{'type':Sequelize[_0x0d0c('0x6')]},'nameField':{'type':Sequelize[_0x0d0c('0x6')]},'customField':{'type':Sequelize[_0x0d0c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0d0c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index b20c06e..4314702 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 _0x2c88=['order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','keys','fields','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','Dynamics365Field','rawAttributes','type','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit'];(function(_0x2a7609,_0x2feabb){var _0x268bb2=function(_0x90209){while(--_0x90209){_0x2a7609['push'](_0x2a7609['shift']());}};_0x268bb2(++_0x2feabb);}(_0x2c88,0xa3));var _0x82c8=function(_0x5c9b29,_0x5c3397){_0x5c9b29=_0x5c9b29-0x0;var _0x14c798=_0x2c88[_0x5c9b29];return _0x14c798;};'use strict';var emlformat=require(_0x82c8('0x0'));var rimraf=require(_0x82c8('0x1'));var zipdir=require(_0x82c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x82c8('0x3'));var moment=require(_0x82c8('0x4'));var BPromise=require(_0x82c8('0x5'));var Mustache=require('mustache');var util=require(_0x82c8('0x6'));var path=require(_0x82c8('0x7'));var sox=require(_0x82c8('0x8'));var csv=require(_0x82c8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82c8('0xa'));var _=require(_0x82c8('0xb'));var squel=require(_0x82c8('0xc'));var crypto=require(_0x82c8('0xd'));var jsforce=require(_0x82c8('0xe'));var deskjs=require(_0x82c8('0xf'));var toCsv=require(_0x82c8('0x9'));var querystring=require(_0x82c8('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x82c8('0x11'));var qs=require(_0x82c8('0x12'));var as=require(_0x82c8('0x13'));var hardwareService=require(_0x82c8('0x14'));var logger=require(_0x82c8('0x15'))(_0x82c8('0x16'));var utils=require(_0x82c8('0x17'));var config=require(_0x82c8('0x18'));var licenseUtil=require(_0x82c8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b80f8,_0x4f7754){_0x4f7754=_0x4f7754||0xcc;return function(_0x26822f){if(_0x26822f){return _0x5b80f8[_0x82c8('0x1a')](_0x4f7754);}return _0x5b80f8['status'](_0x4f7754)[_0x82c8('0x1b')]();};}function respondWithResult(_0x3c9ea4,_0x53d46f){_0x53d46f=_0x53d46f||0xc8;return function(_0x358aad){if(_0x358aad){return _0x3c9ea4[_0x82c8('0x1c')](_0x53d46f)[_0x82c8('0x1d')](_0x358aad);}};}function respondWithFilteredResult(_0x1e90a7,_0x2cfbef){return function(_0x5b39f5){if(_0x5b39f5){var _0x30515d=typeof _0x2cfbef[_0x82c8('0x1e')]==='undefined'&&typeof _0x2cfbef['limit']===_0x82c8('0x1f');var _0x196a7d=_0x5b39f5[_0x82c8('0x20')];var _0x300c5d=_0x30515d?0x0:_0x2cfbef[_0x82c8('0x1e')];var _0xa80ebe=_0x30515d?_0x5b39f5[_0x82c8('0x20')]:_0x2cfbef[_0x82c8('0x1e')]+_0x2cfbef[_0x82c8('0x21')];var _0x2b618d;if(_0xa80ebe>=_0x196a7d){_0xa80ebe=_0x196a7d;_0x2b618d=0xc8;}else{_0x2b618d=0xce;}_0x1e90a7[_0x82c8('0x1c')](_0x2b618d);return _0x1e90a7[_0x82c8('0x22')](_0x82c8('0x23'),_0x300c5d+'-'+_0xa80ebe+'/'+_0x196a7d)[_0x82c8('0x1d')](_0x5b39f5);}return null;};}function patchUpdates(_0x225a22){return function(_0x14de66){try{jsonpatch['apply'](_0x14de66,_0x225a22,!![]);}catch(_0x102b08){return BPromise[_0x82c8('0x24')](_0x102b08);}return _0x14de66['save']();};}function saveUpdates(_0x53d714,_0x59b8f5){return function(_0x20e8d2){if(_0x20e8d2){return _0x20e8d2[_0x82c8('0x25')](_0x53d714)[_0x82c8('0x26')](function(_0x196ea1){return _0x196ea1;});}return null;};}function removeEntity(_0x14e376,_0x2fc548){return function(_0x4c7d7c){if(_0x4c7d7c){return _0x4c7d7c[_0x82c8('0x27')]()[_0x82c8('0x26')](function(){_0x14e376['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x332b6a,_0x5c79d5){return function(_0x4b0244){if(!_0x4b0244){_0x332b6a['sendStatus'](0x194);}return _0x4b0244;};}function handleError(_0xb63251,_0x2986ea){_0x2986ea=_0x2986ea||0x1f4;return function(_0x1142ac){logger[_0x82c8('0x28')](_0x1142ac[_0x82c8('0x29')]);if(_0x1142ac['name']){delete _0x1142ac[_0x82c8('0x2a')];}_0xb63251[_0x82c8('0x1c')](_0x2986ea)['send'](_0x1142ac);};}exports[_0x82c8('0x2b')]=function(_0x58cdd8,_0x3f525d){var _0x19016d={},_0x2d3983={},_0x9705b0={'count':0x0,'rows':[]};var _0x2994b1=_[_0x82c8('0x2c')](db[_0x82c8('0x2d')][_0x82c8('0x2e')],function(_0x4b8937){return{'name':_0x4b8937['fieldName'],'type':_0x4b8937[_0x82c8('0x2f')]['key']};});_0x2d3983[_0x82c8('0x30')]=_[_0x82c8('0x2c')](_0x2994b1,_0x82c8('0x2a'));_0x2d3983[_0x82c8('0x31')]=_['keys'](_0x58cdd8['query']);_0x2d3983[_0x82c8('0x32')]=_['intersection'](_0x2d3983[_0x82c8('0x30')],_0x2d3983[_0x82c8('0x31')]);_0x19016d[_0x82c8('0x33')]=_[_0x82c8('0x34')](_0x2d3983[_0x82c8('0x30')],qs['fields'](_0x58cdd8['query']['fields']));_0x19016d[_0x82c8('0x33')]=_0x19016d[_0x82c8('0x33')][_0x82c8('0x35')]?_0x19016d[_0x82c8('0x33')]:_0x2d3983[_0x82c8('0x30')];if(!_0x58cdd8[_0x82c8('0x31')][_0x82c8('0x36')](_0x82c8('0x37'))){_0x19016d[_0x82c8('0x21')]=qs[_0x82c8('0x21')](_0x58cdd8[_0x82c8('0x31')]['limit']);_0x19016d[_0x82c8('0x1e')]=qs[_0x82c8('0x1e')](_0x58cdd8[_0x82c8('0x31')][_0x82c8('0x1e')]);}_0x19016d[_0x82c8('0x38')]=qs[_0x82c8('0x39')](_0x58cdd8[_0x82c8('0x31')][_0x82c8('0x39')]);_0x19016d[_0x82c8('0x3a')]=qs[_0x82c8('0x32')](_[_0x82c8('0x3b')](_0x58cdd8[_0x82c8('0x31')],_0x2d3983[_0x82c8('0x32')]),_0x2994b1);if(_0x58cdd8[_0x82c8('0x31')][_0x82c8('0x3c')]){_0x19016d['where']=_['merge'](_0x19016d[_0x82c8('0x3a')],{'$or':_[_0x82c8('0x2c')](_0x2994b1,function(_0x4f4cd7){if(_0x4f4cd7[_0x82c8('0x2f')]!=='VIRTUAL'){var _0x1da1d6={};_0x1da1d6[_0x4f4cd7[_0x82c8('0x2a')]]={'$like':'%'+_0x58cdd8[_0x82c8('0x31')][_0x82c8('0x3c')]+'%'};return _0x1da1d6;}})});}_0x19016d=_[_0x82c8('0x3d')]({},_0x19016d,_0x58cdd8[_0x82c8('0x3e')]);var _0x5475d6={'where':_0x19016d[_0x82c8('0x3a')]};return db[_0x82c8('0x2d')][_0x82c8('0x20')](_0x5475d6)[_0x82c8('0x26')](function(_0x5cc4e7){_0x9705b0[_0x82c8('0x20')]=_0x5cc4e7;if(_0x58cdd8[_0x82c8('0x31')][_0x82c8('0x3f')]){_0x19016d[_0x82c8('0x40')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x82c8('0x41')](_0x19016d);})['then'](function(_0xc4d51){_0x9705b0['rows']=_0xc4d51;return _0x9705b0;})[_0x82c8('0x26')](respondWithFilteredResult(_0x3f525d,_0x19016d))[_0x82c8('0x42')](handleError(_0x3f525d,null));};exports['show']=function(_0x1d73d7,_0x59dba1){var _0x406ad8={'raw':!![],'where':{'id':_0x1d73d7[_0x82c8('0x43')]['id']}},_0x142ff1={};_0x142ff1[_0x82c8('0x30')]=_[_0x82c8('0x44')](db[_0x82c8('0x2d')]['rawAttributes']);_0x142ff1['query']=_[_0x82c8('0x44')](_0x1d73d7[_0x82c8('0x31')]);_0x142ff1[_0x82c8('0x32')]=_[_0x82c8('0x34')](_0x142ff1[_0x82c8('0x30')],_0x142ff1[_0x82c8('0x31')]);_0x406ad8['attributes']=_[_0x82c8('0x34')](_0x142ff1[_0x82c8('0x30')],qs['fields'](_0x1d73d7[_0x82c8('0x31')][_0x82c8('0x45')]));_0x406ad8[_0x82c8('0x33')]=_0x406ad8[_0x82c8('0x33')]['length']?_0x406ad8[_0x82c8('0x33')]:_0x142ff1[_0x82c8('0x30')];if(_0x1d73d7[_0x82c8('0x31')]['includeAll']){_0x406ad8[_0x82c8('0x40')]=[{'all':!![]}];}_0x406ad8=_[_0x82c8('0x3d')]({},_0x406ad8,_0x1d73d7['options']);return db[_0x82c8('0x2d')][_0x82c8('0x46')](_0x406ad8)[_0x82c8('0x26')](handleEntityNotFound(_0x59dba1,null))[_0x82c8('0x26')](respondWithResult(_0x59dba1,null))[_0x82c8('0x42')](handleError(_0x59dba1,null));};exports['create']=function(_0x335a43,_0x15c0fe){return db[_0x82c8('0x2d')][_0x82c8('0x47')](_0x335a43[_0x82c8('0x48')],{})['then'](respondWithResult(_0x15c0fe,0xc9))[_0x82c8('0x42')](handleError(_0x15c0fe,null));};exports[_0x82c8('0x25')]=function(_0x243300,_0xb31f31){if(_0x243300[_0x82c8('0x48')]['id']){delete _0x243300[_0x82c8('0x48')]['id'];}return db[_0x82c8('0x2d')][_0x82c8('0x46')]({'where':{'id':_0x243300[_0x82c8('0x43')]['id']}})[_0x82c8('0x26')](handleEntityNotFound(_0xb31f31,null))[_0x82c8('0x26')](saveUpdates(_0x243300[_0x82c8('0x48')],null))[_0x82c8('0x26')](respondWithResult(_0xb31f31,null))['catch'](handleError(_0xb31f31,null));};exports['destroy']=function(_0x476d7c,_0x29ac53){return db[_0x82c8('0x2d')][_0x82c8('0x46')]({'where':{'id':_0x476d7c[_0x82c8('0x43')]['id']}})[_0x82c8('0x26')](handleEntityNotFound(_0x29ac53,null))[_0x82c8('0x26')](removeEntity(_0x29ac53,null))[_0x82c8('0x42')](handleError(_0x29ac53,null));}; \ No newline at end of file +var _0xff67=['mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','Dynamics365Field','include','findAll','catch','show','params','includeAll','options','find','create','body','eml-format','rimraf','request-promise','moment'];(function(_0x5c3fc7,_0x11f155){var _0x476a9b=function(_0x227770){while(--_0x227770){_0x5c3fc7['push'](_0x5c3fc7['shift']());}};_0x476a9b(++_0x11f155);}(_0xff67,0x10c));var _0x7ff6=function(_0x43ad68,_0x216a99){_0x43ad68=_0x43ad68-0x0;var _0x497e8c=_0xff67[_0x43ad68];return _0x497e8c;};'use strict';var emlformat=require(_0x7ff6('0x0'));var rimraf=require(_0x7ff6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7ff6('0x2'));var moment=require(_0x7ff6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7ff6('0x4'));var util=require('util');var path=require(_0x7ff6('0x5'));var sox=require(_0x7ff6('0x6'));var csv=require(_0x7ff6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ff6('0x8'));var _=require(_0x7ff6('0x9'));var squel=require('squel');var crypto=require(_0x7ff6('0xa'));var jsforce=require(_0x7ff6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7ff6('0x7'));var querystring=require('querystring');var Papa=require(_0x7ff6('0xc'));var Redis=require(_0x7ff6('0xd'));var authService=require(_0x7ff6('0xe'));var qs=require(_0x7ff6('0xf'));var as=require(_0x7ff6('0x10'));var hardwareService=require(_0x7ff6('0x11'));var logger=require(_0x7ff6('0x12'))(_0x7ff6('0x13'));var utils=require('../../config/utils');var config=require(_0x7ff6('0x14'));var licenseUtil=require(_0x7ff6('0x15'));var db=require(_0x7ff6('0x16'))['db'];function respondWithStatusCode(_0x40a9df,_0x2146c1){_0x2146c1=_0x2146c1||0xcc;return function(_0x5aa4ea){if(_0x5aa4ea){return _0x40a9df[_0x7ff6('0x17')](_0x2146c1);}return _0x40a9df[_0x7ff6('0x18')](_0x2146c1)['end']();};}function respondWithResult(_0x446762,_0x465c13){_0x465c13=_0x465c13||0xc8;return function(_0x5680d5){if(_0x5680d5){return _0x446762[_0x7ff6('0x18')](_0x465c13)['json'](_0x5680d5);}};}function respondWithFilteredResult(_0x4fdfdf,_0x356157){return function(_0x1ff98d){if(_0x1ff98d){var _0x1e0973=typeof _0x356157['offset']===_0x7ff6('0x19')&&typeof _0x356157['limit']===_0x7ff6('0x19');var _0x3b2a29=_0x1ff98d[_0x7ff6('0x1a')];var _0x7ca3be=_0x1e0973?0x0:_0x356157[_0x7ff6('0x1b')];var _0x2d1030=_0x1e0973?_0x1ff98d[_0x7ff6('0x1a')]:_0x356157[_0x7ff6('0x1b')]+_0x356157[_0x7ff6('0x1c')];var _0x734333;if(_0x2d1030>=_0x3b2a29){_0x2d1030=_0x3b2a29;_0x734333=0xc8;}else{_0x734333=0xce;}_0x4fdfdf[_0x7ff6('0x18')](_0x734333);return _0x4fdfdf['set'](_0x7ff6('0x1d'),_0x7ca3be+'-'+_0x2d1030+'/'+_0x3b2a29)['json'](_0x1ff98d);}return null;};}function patchUpdates(_0x5b7d14){return function(_0x53b4c7){try{jsonpatch['apply'](_0x53b4c7,_0x5b7d14,!![]);}catch(_0x3ff707){return BPromise['reject'](_0x3ff707);}return _0x53b4c7[_0x7ff6('0x1e')]();};}function saveUpdates(_0x313fa5,_0x59fb2e){return function(_0x40ae31){if(_0x40ae31){return _0x40ae31[_0x7ff6('0x1f')](_0x313fa5)[_0x7ff6('0x20')](function(_0x5e3304){return _0x5e3304;});}return null;};}function removeEntity(_0x2c62a3,_0x4bc05f){return function(_0x510d47){if(_0x510d47){return _0x510d47[_0x7ff6('0x21')]()['then'](function(){_0x2c62a3[_0x7ff6('0x18')](0xcc)[_0x7ff6('0x22')]();});}};}function handleEntityNotFound(_0x2188ae,_0x542bc9){return function(_0x396636){if(!_0x396636){_0x2188ae[_0x7ff6('0x17')](0x194);}return _0x396636;};}function handleError(_0x1def07,_0x16ce0){_0x16ce0=_0x16ce0||0x1f4;return function(_0x2804c4){logger[_0x7ff6('0x23')](_0x2804c4[_0x7ff6('0x24')]);if(_0x2804c4[_0x7ff6('0x25')]){delete _0x2804c4[_0x7ff6('0x25')];}_0x1def07[_0x7ff6('0x18')](_0x16ce0)[_0x7ff6('0x26')](_0x2804c4);};}exports[_0x7ff6('0x27')]=function(_0x19ffc4,_0x1f9ab1){var _0x470c1d={},_0x3b9e06={},_0x5f1f75={'count':0x0,'rows':[]};var _0x1dc62d=_['map'](db['Dynamics365Field'][_0x7ff6('0x28')],function(_0x417a54){return{'name':_0x417a54[_0x7ff6('0x29')],'type':_0x417a54[_0x7ff6('0x2a')]['key']};});_0x3b9e06[_0x7ff6('0x2b')]=_[_0x7ff6('0x2c')](_0x1dc62d,_0x7ff6('0x25'));_0x3b9e06[_0x7ff6('0x2d')]=_[_0x7ff6('0x2e')](_0x19ffc4[_0x7ff6('0x2d')]);_0x3b9e06[_0x7ff6('0x2f')]=_[_0x7ff6('0x30')](_0x3b9e06[_0x7ff6('0x2b')],_0x3b9e06[_0x7ff6('0x2d')]);_0x470c1d[_0x7ff6('0x31')]=_['intersection'](_0x3b9e06[_0x7ff6('0x2b')],qs[_0x7ff6('0x32')](_0x19ffc4[_0x7ff6('0x2d')][_0x7ff6('0x32')]));_0x470c1d[_0x7ff6('0x31')]=_0x470c1d['attributes'][_0x7ff6('0x33')]?_0x470c1d['attributes']:_0x3b9e06[_0x7ff6('0x2b')];if(!_0x19ffc4[_0x7ff6('0x2d')]['hasOwnProperty'](_0x7ff6('0x34'))){_0x470c1d['limit']=qs[_0x7ff6('0x1c')](_0x19ffc4[_0x7ff6('0x2d')][_0x7ff6('0x1c')]);_0x470c1d[_0x7ff6('0x1b')]=qs['offset'](_0x19ffc4[_0x7ff6('0x2d')]['offset']);}_0x470c1d['order']=qs[_0x7ff6('0x35')](_0x19ffc4[_0x7ff6('0x2d')][_0x7ff6('0x35')]);_0x470c1d[_0x7ff6('0x36')]=qs[_0x7ff6('0x2f')](_['pick'](_0x19ffc4[_0x7ff6('0x2d')],_0x3b9e06['filters']),_0x1dc62d);if(_0x19ffc4[_0x7ff6('0x2d')][_0x7ff6('0x37')]){_0x470c1d[_0x7ff6('0x36')]=_[_0x7ff6('0x38')](_0x470c1d[_0x7ff6('0x36')],{'$or':_[_0x7ff6('0x2c')](_0x1dc62d,function(_0x267cb6){if(_0x267cb6[_0x7ff6('0x2a')]!=='VIRTUAL'){var _0xbe29c4={};_0xbe29c4[_0x267cb6[_0x7ff6('0x25')]]={'$like':'%'+_0x19ffc4[_0x7ff6('0x2d')]['filter']+'%'};return _0xbe29c4;}})});}_0x470c1d=_[_0x7ff6('0x38')]({},_0x470c1d,_0x19ffc4['options']);var _0x9b30b9={'where':_0x470c1d[_0x7ff6('0x36')]};return db[_0x7ff6('0x39')]['count'](_0x9b30b9)[_0x7ff6('0x20')](function(_0x3ff235){_0x5f1f75[_0x7ff6('0x1a')]=_0x3ff235;if(_0x19ffc4[_0x7ff6('0x2d')]['includeAll']){_0x470c1d[_0x7ff6('0x3a')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x7ff6('0x3b')](_0x470c1d);})[_0x7ff6('0x20')](function(_0x42131c){_0x5f1f75['rows']=_0x42131c;return _0x5f1f75;})[_0x7ff6('0x20')](respondWithFilteredResult(_0x1f9ab1,_0x470c1d))[_0x7ff6('0x3c')](handleError(_0x1f9ab1,null));};exports[_0x7ff6('0x3d')]=function(_0x355919,_0x4af652){var _0x9df975={'raw':!![],'where':{'id':_0x355919[_0x7ff6('0x3e')]['id']}},_0x36f4b1={};_0x36f4b1[_0x7ff6('0x2b')]=_[_0x7ff6('0x2e')](db[_0x7ff6('0x39')][_0x7ff6('0x28')]);_0x36f4b1[_0x7ff6('0x2d')]=_['keys'](_0x355919[_0x7ff6('0x2d')]);_0x36f4b1[_0x7ff6('0x2f')]=_[_0x7ff6('0x30')](_0x36f4b1[_0x7ff6('0x2b')],_0x36f4b1[_0x7ff6('0x2d')]);_0x9df975['attributes']=_[_0x7ff6('0x30')](_0x36f4b1[_0x7ff6('0x2b')],qs[_0x7ff6('0x32')](_0x355919['query'][_0x7ff6('0x32')]));_0x9df975[_0x7ff6('0x31')]=_0x9df975[_0x7ff6('0x31')][_0x7ff6('0x33')]?_0x9df975['attributes']:_0x36f4b1[_0x7ff6('0x2b')];if(_0x355919['query'][_0x7ff6('0x3f')]){_0x9df975[_0x7ff6('0x3a')]=[{'all':!![]}];}_0x9df975=_[_0x7ff6('0x38')]({},_0x9df975,_0x355919[_0x7ff6('0x40')]);return db[_0x7ff6('0x39')][_0x7ff6('0x41')](_0x9df975)[_0x7ff6('0x20')](handleEntityNotFound(_0x4af652,null))[_0x7ff6('0x20')](respondWithResult(_0x4af652,null))[_0x7ff6('0x3c')](handleError(_0x4af652,null));};exports[_0x7ff6('0x42')]=function(_0x2b98e2,_0x3af693){return db[_0x7ff6('0x39')]['create'](_0x2b98e2[_0x7ff6('0x43')],{})[_0x7ff6('0x20')](respondWithResult(_0x3af693,0xc9))[_0x7ff6('0x3c')](handleError(_0x3af693,null));};exports[_0x7ff6('0x1f')]=function(_0x2eb904,_0x533785){if(_0x2eb904[_0x7ff6('0x43')]['id']){delete _0x2eb904[_0x7ff6('0x43')]['id'];}return db[_0x7ff6('0x39')][_0x7ff6('0x41')]({'where':{'id':_0x2eb904[_0x7ff6('0x3e')]['id']}})[_0x7ff6('0x20')](handleEntityNotFound(_0x533785,null))[_0x7ff6('0x20')](saveUpdates(_0x2eb904[_0x7ff6('0x43')],null))[_0x7ff6('0x20')](respondWithResult(_0x533785,null))['catch'](handleError(_0x533785,null));};exports[_0x7ff6('0x21')]=function(_0x5b12e8,_0x15cde2){return db[_0x7ff6('0x39')][_0x7ff6('0x41')]({'where':{'id':_0x5b12e8[_0x7ff6('0x3e')]['id']}})[_0x7ff6('0x20')](handleEntityNotFound(_0x15cde2,null))[_0x7ff6('0x20')](removeEntity(_0x15cde2,null))[_0x7ff6('0x3c')](handleError(_0x15cde2,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 5397ff0..2440669 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 _0x5a1f=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','util','../../config/logger','api','bluebird','request-promise','rimraf','./intDynamics365Field.attributes','exports','define'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x5a1f,0xe1));var _0xf5a1=function(_0x55fc44,_0x5d95fd){_0x55fc44=_0x55fc44-0x0;var _0x5a70ce=_0x5a1f[_0x55fc44];return _0x5a70ce;};'use strict';var _=require('lodash');var util=require(_0xf5a1('0x0'));var logger=require(_0xf5a1('0x1'))(_0xf5a1('0x2'));var moment=require('moment');var BPromise=require(_0xf5a1('0x3'));var rp=require(_0xf5a1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf5a1('0x5'));var config=require('../../config/environment');var attributes=require(_0xf5a1('0x6'));module[_0xf5a1('0x7')]=function(_0x65c2f6,_0x3f1aa9){return _0x65c2f6[_0xf5a1('0x8')](_0xf5a1('0x9'),attributes,{'tableName':_0xf5a1('0xa'),'paranoid':![],'indexes':[{'name':_0xf5a1('0xb'),'fields':['idField',_0xf5a1('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50fb=['dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50fb,0xe4));var _0xb50f=function(_0xa17726,_0x5dd508){_0xa17726=_0xa17726-0x0;var _0x21fcef=_0x50fb[_0xa17726];return _0x21fcef;};'use strict';var _=require(_0xb50f('0x0'));var util=require('util');var logger=require(_0xb50f('0x1'))(_0xb50f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb50f('0x3'));var fs=require('fs');var path=require(_0xb50f('0x4'));var rimraf=require(_0xb50f('0x5'));var config=require(_0xb50f('0x6'));var attributes=require(_0xb50f('0x7'));module[_0xb50f('0x8')]=function(_0x7c90f6,_0x3f7e8d){return _0x7c90f6[_0xb50f('0x9')](_0xb50f('0xa'),attributes,{'tableName':_0xb50f('0xb'),'paranoid':![],'indexes':[{'name':_0xb50f('0xc'),'fields':[_0xb50f('0xd'),_0xb50f('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 8e31a9e..2faaaa3 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 _0x8bcb=['request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Dynamics365Field,\x20%s,\x20%s'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x8bcb,0xb9));var _0xb8bc=function(_0x269cdd,_0xed07f7){_0x269cdd=_0x269cdd-0x0;var _0x40c5c9=_0x8bcb[_0x269cdd];return _0x40c5c9;};'use strict';var _=require(_0xb8bc('0x0'));var util=require(_0xb8bc('0x1'));var moment=require(_0xb8bc('0x2'));var BPromise=require(_0xb8bc('0x3'));var rs=require(_0xb8bc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8bc('0x5'))['db'];var utils=require(_0xb8bc('0x6'));var logger=require(_0xb8bc('0x7'))(_0xb8bc('0x8'));var config=require(_0xb8bc('0x9'));var jayson=require(_0xb8bc('0xa'));var client=jayson['client'][_0xb8bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23e8bc,_0x13595e,_0x55c92e){return new BPromise(function(_0x20bf53,_0x4aa96a){return client[_0xb8bc('0xc')](_0x23e8bc,_0x55c92e)[_0xb8bc('0xd')](function(_0x1eae91){logger['info'](_0xb8bc('0xe'),_0x13595e,_0xb8bc('0xf'));logger[_0xb8bc('0x10')](_0xb8bc('0x11'),_0x13595e,'request\x20sent',JSON[_0xb8bc('0x12')](_0x1eae91));if(_0x1eae91[_0xb8bc('0x13')]){if(_0x1eae91[_0xb8bc('0x13')][_0xb8bc('0x14')]===0x1f4){logger[_0xb8bc('0x13')](_0xb8bc('0xe'),_0x13595e,_0x1eae91[_0xb8bc('0x13')]['message']);return _0x4aa96a(_0x1eae91[_0xb8bc('0x13')][_0xb8bc('0x15')]);}logger[_0xb8bc('0x13')](_0xb8bc('0xe'),_0x13595e,_0x1eae91[_0xb8bc('0x13')][_0xb8bc('0x15')]);return _0x20bf53(_0x1eae91[_0xb8bc('0x13')]['message']);}else{logger[_0xb8bc('0x16')](_0xb8bc('0xe'),_0x13595e,'request\x20sent');_0x20bf53(_0x1eae91[_0xb8bc('0x17')][_0xb8bc('0x15')]);}})[_0xb8bc('0x18')](function(_0x5c6aff){logger[_0xb8bc('0x13')](_0xb8bc('0xe'),_0x13595e,_0x5c6aff);_0x4aa96a(_0x5c6aff);});});} \ No newline at end of file +var _0xffe4=['Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x4d7b4c,_0x4764b5){var _0x5b8ee3=function(_0x1eab29){while(--_0x1eab29){_0x4d7b4c['push'](_0x4d7b4c['shift']());}};_0x5b8ee3(++_0x4764b5);}(_0xffe4,0x1aa));var _0x4ffe=function(_0x392444,_0x882d1d){_0x392444=_0x392444-0x0;var _0x2bb572=_0xffe4[_0x392444];return _0x2bb572;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ffe('0x0'));var BPromise=require(_0x4ffe('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ffe('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ffe('0x3'))(_0x4ffe('0x4'));var config=require('../../config/environment');var jayson=require(_0x4ffe('0x5'));var client=jayson[_0x4ffe('0x6')][_0x4ffe('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x50dee1,_0x503899,_0x54e456){return new BPromise(function(_0x34ad19,_0x3cf8d1){return client[_0x4ffe('0x8')](_0x50dee1,_0x54e456)[_0x4ffe('0x9')](function(_0x468d2c){logger[_0x4ffe('0xa')](_0x4ffe('0xb'),_0x503899,_0x4ffe('0xc'));logger[_0x4ffe('0xd')](_0x4ffe('0xe'),_0x503899,_0x4ffe('0xc'),JSON['stringify'](_0x468d2c));if(_0x468d2c[_0x4ffe('0xf')]){if(_0x468d2c[_0x4ffe('0xf')][_0x4ffe('0x10')]===0x1f4){logger[_0x4ffe('0xf')](_0x4ffe('0xb'),_0x503899,_0x468d2c[_0x4ffe('0xf')][_0x4ffe('0x11')]);return _0x3cf8d1(_0x468d2c['error']['message']);}logger[_0x4ffe('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x503899,_0x468d2c[_0x4ffe('0xf')][_0x4ffe('0x11')]);return _0x34ad19(_0x468d2c[_0x4ffe('0xf')][_0x4ffe('0x11')]);}else{logger[_0x4ffe('0xa')](_0x4ffe('0xb'),_0x503899,_0x4ffe('0xc'));_0x34ad19(_0x468d2c[_0x4ffe('0x12')][_0x4ffe('0x11')]);}})['catch'](function(_0x84dd1e){logger['error'](_0x4ffe('0xb'),_0x503899,_0x84dd1e);_0x3cf8d1(_0x84dd1e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 39bf41d..a74da24 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 _0x822d=['isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id'];(function(_0x33da80,_0x24a833){var _0x1c66de=function(_0xd6136c){while(--_0xd6136c){_0x33da80['push'](_0x33da80['shift']());}};_0x1c66de(++_0x24a833);}(_0x822d,0xfc));var _0xd822=function(_0x47159c,_0x1c8216){_0x47159c=_0x47159c-0x0;var _0x454dbe=_0x822d[_0x47159c];return _0x454dbe;};'use strict';var multer=require(_0xd822('0x0'));var util=require(_0xd822('0x1'));var path=require(_0xd822('0x2'));var timeout=require(_0xd822('0x3'));var express=require(_0xd822('0x4'));var router=express[_0xd822('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd822('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd822('0x7'));var controller=require(_0xd822('0x8'));router[_0xd822('0x9')]('/',auth['isAuthenticated'](),controller[_0xd822('0xa')]);router[_0xd822('0x9')](_0xd822('0xb'),auth[_0xd822('0xc')](),controller[_0xd822('0xd')]);router[_0xd822('0x9')](_0xd822('0xe'),auth[_0xd822('0xc')](),controller[_0xd822('0xf')]);router['get']('/:id/fields',auth[_0xd822('0xc')](),controller[_0xd822('0x10')]);router[_0xd822('0x11')]('/',auth['isAuthenticated'](),controller[_0xd822('0x12')]);router['post'](_0xd822('0xe'),auth[_0xd822('0xc')](),controller[_0xd822('0x13')]);router[_0xd822('0x14')](_0xd822('0xb'),auth[_0xd822('0xc')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd822('0x15')]);module['exports']=router; \ No newline at end of file +var _0xfde8=['/:id/fields','getFields','post','addConfiguration','/:id','destroy','exports','util','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/configurations','getConfigurations'];(function(_0x193676,_0x5dfa88){var _0x421902=function(_0x45a06b){while(--_0x45a06b){_0x193676['push'](_0x193676['shift']());}};_0x421902(++_0x5dfa88);}(_0xfde8,0x1ed));var _0x8fde=function(_0x346c13,_0x27cbab){_0x346c13=_0x346c13-0x0;var _0x349f6f=_0xfde8[_0x346c13];return _0x349f6f;};'use strict';var multer=require('multer');var util=require(_0x8fde('0x0'));var path=require('path');var timeout=require(_0x8fde('0x1'));var express=require(_0x8fde('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8fde('0x3'));var config=require(_0x8fde('0x4'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0x8fde('0x5')](),controller[_0x8fde('0x6')]);router[_0x8fde('0x7')]('/:id',auth[_0x8fde('0x5')](),controller[_0x8fde('0x8')]);router['get'](_0x8fde('0x9'),auth[_0x8fde('0x5')](),controller[_0x8fde('0xa')]);router[_0x8fde('0x7')](_0x8fde('0xb'),auth[_0x8fde('0x5')](),controller[_0x8fde('0xc')]);router[_0x8fde('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8fde('0xd')](_0x8fde('0x9'),auth[_0x8fde('0x5')](),controller[_0x8fde('0xe')]);router['put'](_0x8fde('0xf'),auth[_0x8fde('0x5')](),controller['update']);router['delete'](_0x8fde('0xf'),auth['isAuthenticated'](),controller[_0x8fde('0x10')]);module[_0x8fde('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 86b0452..2b1ba90 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 _0xb03e=['STRING','username','remoteUri','exports'];(function(_0x3f9709,_0xf34878){var _0x38f395=function(_0x19beec){while(--_0x19beec){_0x3f9709['push'](_0x3f9709['shift']());}};_0x38f395(++_0xf34878);}(_0xb03e,0x1eb));var _0xeb03=function(_0x35f8ef,_0x4def9a){_0x35f8ef=_0x35f8ef-0x0;var _0x2a0a98=_0xb03e[_0x35f8ef];return _0x2a0a98;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'name':{'type':Sequelize[_0xeb03('0x1')]},'description':{'type':Sequelize[_0xeb03('0x1')]},'username':{'type':Sequelize[_0xeb03('0x1')],'unique':_0xeb03('0x2')},'apiKey':{'type':Sequelize[_0xeb03('0x1')]},'remoteUri':{'type':Sequelize[_0xeb03('0x1')],'unique':_0xeb03('0x3')},'serverUrl':{'type':Sequelize[_0xeb03('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7b84=['sequelize','exports','STRING','username','remoteUri'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x7b84,0x17c));var _0x47b8=function(_0x21e5bf,_0xec66e2){_0x21e5bf=_0x21e5bf-0x0;var _0xc63462=_0x7b84[_0x21e5bf];return _0xc63462;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'name':{'type':Sequelize[_0x47b8('0x2')]},'description':{'type':Sequelize[_0x47b8('0x2')]},'username':{'type':Sequelize[_0x47b8('0x2')],'unique':_0x47b8('0x3')},'apiKey':{'type':Sequelize[_0x47b8('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x47b8('0x4')},'serverUrl':{'type':Sequelize[_0x47b8('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 35beb3c..ff03c9f 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 _0xbe99=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','update','getConfigurations','findOne','rawAttributes','hasOwnProperty','nolimit','addConfiguration','channel','Descriptions','FreshdeskConfiguration','FreshdeskField','Subjects','getFields','apiKey','remoteUri','slice','substring','lastIndexOf','GET','api/v2/ticket_fields','format','Basic\x20%s','toString','base64','requester','subject','priority','source','ticket_type','group','company','remove','includes','default','custom_text','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','map','FreshdeskAccount','fieldName','type','key','model','query','filters','attributes','intersection','fields','sort','where','pick','filter'];(function(_0x5670cb,_0xe6e20d){var _0x11dc29=function(_0x42305b){while(--_0x42305b){_0x5670cb['push'](_0x5670cb['shift']());}};_0x11dc29(++_0xe6e20d);}(_0xbe99,0x196));var _0x9be9=function(_0x34f499,_0xd8ff6e){_0x34f499=_0x34f499-0x0;var _0x2be65b=_0xbe99[_0x34f499];return _0x2be65b;};'use strict';var emlformat=require(_0x9be9('0x0'));var rimraf=require(_0x9be9('0x1'));var zipdir=require(_0x9be9('0x2'));var jsonpatch=require(_0x9be9('0x3'));var rp=require(_0x9be9('0x4'));var moment=require('moment');var BPromise=require(_0x9be9('0x5'));var Mustache=require('mustache');var util=require(_0x9be9('0x6'));var path=require(_0x9be9('0x7'));var sox=require(_0x9be9('0x8'));var csv=require(_0x9be9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9be9('0xa'));var _=require(_0x9be9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9be9('0xc'));var deskjs=require(_0x9be9('0xd'));var toCsv=require(_0x9be9('0x9'));var querystring=require(_0x9be9('0xe'));var Papa=require(_0x9be9('0xf'));var Redis=require(_0x9be9('0x10'));var authService=require(_0x9be9('0x11'));var qs=require(_0x9be9('0x12'));var as=require(_0x9be9('0x13'));var hardwareService=require(_0x9be9('0x14'));var logger=require(_0x9be9('0x15'))(_0x9be9('0x16'));var utils=require(_0x9be9('0x17'));var config=require(_0x9be9('0x18'));var licenseUtil=require(_0x9be9('0x19'));var db=require(_0x9be9('0x1a'))['db'];var integrations=require(_0x9be9('0x1b'));function respondWithStatusCode(_0x4b6d99,_0x1251e4){_0x1251e4=_0x1251e4||0xcc;return function(_0x12ede7){if(_0x12ede7){return _0x4b6d99[_0x9be9('0x1c')](_0x1251e4);}return _0x4b6d99[_0x9be9('0x1d')](_0x1251e4)[_0x9be9('0x1e')]();};}function respondWithResult(_0x50a7fb,_0x2798bd){_0x2798bd=_0x2798bd||0xc8;return function(_0xd3408c){if(_0xd3408c){return _0x50a7fb[_0x9be9('0x1d')](_0x2798bd)['json'](_0xd3408c);}};}function respondWithFilteredResult(_0x2d3e45,_0x418c1e){return function(_0x3c92cc){if(_0x3c92cc){var _0x1c1307=typeof _0x418c1e[_0x9be9('0x1f')]==='undefined'&&typeof _0x418c1e[_0x9be9('0x20')]===_0x9be9('0x21');var _0xa51592=_0x3c92cc['count'];var _0x49649f=_0x1c1307?0x0:_0x418c1e[_0x9be9('0x1f')];var _0x1b45b6=_0x1c1307?_0x3c92cc[_0x9be9('0x22')]:_0x418c1e['offset']+_0x418c1e['limit'];var _0x440431;if(_0x1b45b6>=_0xa51592){_0x1b45b6=_0xa51592;_0x440431=0xc8;}else{_0x440431=0xce;}_0x2d3e45[_0x9be9('0x1d')](_0x440431);return _0x2d3e45[_0x9be9('0x23')](_0x9be9('0x24'),_0x49649f+'-'+_0x1b45b6+'/'+_0xa51592)[_0x9be9('0x25')](_0x3c92cc);}return null;};}function patchUpdates(_0x3761c7){return function(_0x29b335){try{jsonpatch[_0x9be9('0x26')](_0x29b335,_0x3761c7,!![]);}catch(_0x28f055){return BPromise[_0x9be9('0x27')](_0x28f055);}return _0x29b335[_0x9be9('0x28')]();};}function saveUpdates(_0x100637,_0x599429){return function(_0x33d3a5){if(_0x33d3a5){return _0x33d3a5['update'](_0x100637)[_0x9be9('0x29')](function(_0xf87e6d){return _0xf87e6d;});}return null;};}function removeEntity(_0x451e60,_0x3fe959){return function(_0x500e60){if(_0x500e60){return _0x500e60[_0x9be9('0x2a')]()[_0x9be9('0x29')](function(){_0x451e60[_0x9be9('0x1d')](0xcc)[_0x9be9('0x1e')]();});}};}function handleEntityNotFound(_0x60f1ad,_0x13d557){return function(_0x4177a4){if(!_0x4177a4){_0x60f1ad[_0x9be9('0x1c')](0x194);}return _0x4177a4;};}function handleError(_0x292581,_0x27be52){_0x27be52=_0x27be52||0x1f4;return function(_0x5c5858){logger[_0x9be9('0x2b')](_0x5c5858[_0x9be9('0x2c')]);if(_0x5c5858[_0x9be9('0x2d')]){delete _0x5c5858[_0x9be9('0x2d')];}_0x292581[_0x9be9('0x1d')](_0x27be52)['send'](_0x5c5858);};}exports[_0x9be9('0x2e')]=function(_0x45e200,_0x49ed5d){var _0x199623={},_0x49e398={},_0x3bdcb7={'count':0x0,'rows':[]};var _0x16ef5d=_[_0x9be9('0x2f')](db[_0x9be9('0x30')]['rawAttributes'],function(_0x133eca){return{'name':_0x133eca[_0x9be9('0x31')],'type':_0x133eca[_0x9be9('0x32')][_0x9be9('0x33')]};});_0x49e398[_0x9be9('0x34')]=_[_0x9be9('0x2f')](_0x16ef5d,_0x9be9('0x2d'));_0x49e398[_0x9be9('0x35')]=_['keys'](_0x45e200['query']);_0x49e398[_0x9be9('0x36')]=_['intersection'](_0x49e398[_0x9be9('0x34')],_0x49e398[_0x9be9('0x35')]);_0x199623[_0x9be9('0x37')]=_[_0x9be9('0x38')](_0x49e398['model'],qs[_0x9be9('0x39')](_0x45e200[_0x9be9('0x35')][_0x9be9('0x39')]));_0x199623[_0x9be9('0x37')]=_0x199623[_0x9be9('0x37')]['length']?_0x199623[_0x9be9('0x37')]:_0x49e398['model'];if(!_0x45e200['query']['hasOwnProperty']('nolimit')){_0x199623[_0x9be9('0x20')]=qs[_0x9be9('0x20')](_0x45e200['query'][_0x9be9('0x20')]);_0x199623[_0x9be9('0x1f')]=qs[_0x9be9('0x1f')](_0x45e200[_0x9be9('0x35')][_0x9be9('0x1f')]);}_0x199623['order']=qs[_0x9be9('0x3a')](_0x45e200[_0x9be9('0x35')][_0x9be9('0x3a')]);_0x199623[_0x9be9('0x3b')]=qs[_0x9be9('0x36')](_[_0x9be9('0x3c')](_0x45e200[_0x9be9('0x35')],_0x49e398[_0x9be9('0x36')]),_0x16ef5d);if(_0x45e200[_0x9be9('0x35')][_0x9be9('0x3d')]){_0x199623[_0x9be9('0x3b')]=_[_0x9be9('0x3e')](_0x199623[_0x9be9('0x3b')],{'$or':_[_0x9be9('0x2f')](_0x16ef5d,function(_0x40630b){if(_0x40630b[_0x9be9('0x32')]!==_0x9be9('0x3f')){var _0x6750c9={};_0x6750c9[_0x40630b[_0x9be9('0x2d')]]={'$like':'%'+_0x45e200[_0x9be9('0x35')][_0x9be9('0x3d')]+'%'};return _0x6750c9;}})});}_0x199623=_[_0x9be9('0x3e')]({},_0x199623,_0x45e200[_0x9be9('0x40')]);var _0x30c99b={'where':_0x199623['where']};return db[_0x9be9('0x30')][_0x9be9('0x22')](_0x30c99b)[_0x9be9('0x29')](function(_0x222821){_0x3bdcb7[_0x9be9('0x22')]=_0x222821;if(_0x45e200['query'][_0x9be9('0x41')]){_0x199623[_0x9be9('0x42')]=[{'all':!![]}];}return db[_0x9be9('0x30')][_0x9be9('0x43')](_0x199623);})[_0x9be9('0x29')](function(_0x54eb85){_0x3bdcb7[_0x9be9('0x44')]=_0x54eb85;return _0x3bdcb7;})[_0x9be9('0x29')](respondWithFilteredResult(_0x49ed5d,_0x199623))[_0x9be9('0x45')](handleError(_0x49ed5d,null));};exports['show']=function(_0x585809,_0x3ca323){var _0x56bf39={'raw':![],'where':{'id':_0x585809[_0x9be9('0x46')]['id']}},_0x4cf32b={};_0x4cf32b[_0x9be9('0x34')]=_[_0x9be9('0x47')](db['FreshdeskAccount']['rawAttributes']);_0x4cf32b[_0x9be9('0x35')]=_['keys'](_0x585809[_0x9be9('0x35')]);_0x4cf32b[_0x9be9('0x36')]=_['intersection'](_0x4cf32b[_0x9be9('0x34')],_0x4cf32b[_0x9be9('0x35')]);_0x56bf39[_0x9be9('0x37')]=_[_0x9be9('0x38')](_0x4cf32b[_0x9be9('0x34')],qs['fields'](_0x585809[_0x9be9('0x35')][_0x9be9('0x39')]));_0x56bf39[_0x9be9('0x37')]=_0x56bf39['attributes'][_0x9be9('0x48')]?_0x56bf39['attributes']:_0x4cf32b[_0x9be9('0x34')];if(_0x585809[_0x9be9('0x35')][_0x9be9('0x41')]){_0x56bf39[_0x9be9('0x42')]=[{'all':!![]}];}_0x56bf39=_['merge']({},_0x56bf39,_0x585809['options']);return db[_0x9be9('0x30')][_0x9be9('0x49')](_0x56bf39)['then'](handleEntityNotFound(_0x3ca323,null))[_0x9be9('0x29')](respondWithResult(_0x3ca323,null))[_0x9be9('0x45')](handleError(_0x3ca323,null));};exports[_0x9be9('0x4a')]=function(_0x7d0656,_0x2615f6){return db[_0x9be9('0x30')][_0x9be9('0x4a')](_0x7d0656[_0x9be9('0x4b')],{})[_0x9be9('0x29')](respondWithResult(_0x2615f6,0xc9))[_0x9be9('0x45')](handleError(_0x2615f6,null));};exports[_0x9be9('0x4c')]=function(_0x31faa8,_0x4a58e5){if(_0x31faa8[_0x9be9('0x4b')]['id']){delete _0x31faa8[_0x9be9('0x4b')]['id'];}return db[_0x9be9('0x30')][_0x9be9('0x49')]({'where':{'id':_0x31faa8['params']['id']}})['then'](handleEntityNotFound(_0x4a58e5,null))[_0x9be9('0x29')](saveUpdates(_0x31faa8[_0x9be9('0x4b')],null))[_0x9be9('0x29')](respondWithResult(_0x4a58e5,null))[_0x9be9('0x45')](handleError(_0x4a58e5,null));};exports[_0x9be9('0x2a')]=function(_0x5840fc,_0x240265){return db[_0x9be9('0x30')]['find']({'where':{'id':_0x5840fc[_0x9be9('0x46')]['id']}})[_0x9be9('0x29')](handleEntityNotFound(_0x240265,null))['then'](removeEntity(_0x240265,null))[_0x9be9('0x45')](handleError(_0x240265,null));};exports[_0x9be9('0x4d')]=function(_0x1ccb41,_0x64587,_0x5737ee){var _0x24041c={};var _0x2e7fb7={};var _0x2c35fb;var _0x46a7d2;return db[_0x9be9('0x30')][_0x9be9('0x4e')]({'where':{'id':_0x1ccb41[_0x9be9('0x46')]['id']}})[_0x9be9('0x29')](handleEntityNotFound(_0x64587,null))[_0x9be9('0x29')](function(_0x156637){if(_0x156637){_0x2c35fb=_0x156637;_0x2e7fb7['model']=_['keys'](db['FreshdeskConfiguration'][_0x9be9('0x4f')]);_0x2e7fb7[_0x9be9('0x35')]=_['keys'](_0x1ccb41[_0x9be9('0x35')]);_0x2e7fb7[_0x9be9('0x36')]=_[_0x9be9('0x38')](_0x2e7fb7[_0x9be9('0x34')],_0x2e7fb7[_0x9be9('0x35')]);_0x24041c[_0x9be9('0x37')]=_[_0x9be9('0x38')](_0x2e7fb7['model'],qs[_0x9be9('0x39')](_0x1ccb41['query'][_0x9be9('0x39')]));_0x24041c[_0x9be9('0x37')]=_0x24041c['attributes'][_0x9be9('0x48')]?_0x24041c[_0x9be9('0x37')]:_0x2e7fb7[_0x9be9('0x34')];_0x24041c['order']=qs[_0x9be9('0x3a')](_0x1ccb41[_0x9be9('0x35')][_0x9be9('0x3a')]);_0x24041c[_0x9be9('0x3b')]=qs[_0x9be9('0x36')](_[_0x9be9('0x3c')](_0x1ccb41[_0x9be9('0x35')],_0x2e7fb7['filters']));if(_0x1ccb41[_0x9be9('0x35')][_0x9be9('0x3d')]){_0x24041c[_0x9be9('0x3b')]=_[_0x9be9('0x3e')](_0x24041c[_0x9be9('0x3b')],{'$or':_[_0x9be9('0x2f')](_0x24041c[_0x9be9('0x37')],function(_0x328c21){var _0x4286af={};_0x4286af[_0x328c21]={'$like':'%'+_0x1ccb41[_0x9be9('0x35')][_0x9be9('0x3d')]+'%'};return _0x4286af;})});}_0x24041c=_['merge']({},_0x24041c,_0x1ccb41[_0x9be9('0x40')]);return _0x2c35fb[_0x9be9('0x4d')](_0x24041c);}})['then'](function(_0x4bc3f0){if(_0x4bc3f0){_0x46a7d2=_0x4bc3f0[_0x9be9('0x48')];if(!_0x1ccb41[_0x9be9('0x35')][_0x9be9('0x50')](_0x9be9('0x51'))){_0x24041c[_0x9be9('0x20')]=qs['limit'](_0x1ccb41['query'][_0x9be9('0x20')]);_0x24041c[_0x9be9('0x1f')]=qs[_0x9be9('0x1f')](_0x1ccb41[_0x9be9('0x35')][_0x9be9('0x1f')]);}return _0x2c35fb[_0x9be9('0x4d')](_0x24041c);}})[_0x9be9('0x29')](function(_0x11d7e9){if(_0x11d7e9){return _0x11d7e9?{'count':_0x46a7d2,'rows':_0x11d7e9}:null;}})['then'](respondWithResult(_0x64587,null))[_0x9be9('0x45')](handleError(_0x64587,null));};exports[_0x9be9('0x52')]=function(_0x45b7ca,_0x21f550,_0x561713){if(_0x45b7ca[_0x9be9('0x4b')]['id']){delete _0x45b7ca[_0x9be9('0x4b')]['id'];}return db[_0x9be9('0x30')]['findOne']({'where':{'id':_0x45b7ca[_0x9be9('0x46')]['id']}})[_0x9be9('0x29')](handleEntityNotFound(_0x21f550,null))['then'](function(_0xcb0a1c){if(_0xcb0a1c){_0x45b7ca['body']['AccountId']=_0xcb0a1c['id'];_0x45b7ca[_0x9be9('0x4b')]['Subjects']=integrations['getSubjects'](_0x45b7ca[_0x9be9('0x4b')][_0x9be9('0x53')],_0x45b7ca[_0x9be9('0x4b')][_0x9be9('0x32')]);_0x45b7ca[_0x9be9('0x4b')][_0x9be9('0x54')]=integrations['getDescriptions'](_0x45b7ca[_0x9be9('0x4b')][_0x9be9('0x53')],_0x45b7ca[_0x9be9('0x4b')][_0x9be9('0x32')]);return db[_0x9be9('0x55')]['create'](_0x45b7ca[_0x9be9('0x4b')],{'include':[{'model':db[_0x9be9('0x56')],'as':_0x9be9('0x57')},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0x9be9('0x29')](respondWithResult(_0x21f550,null))[_0x9be9('0x45')](handleError(_0x21f550,null));};exports[_0x9be9('0x58')]=function(_0x36a097,_0x36b42a,_0x51d74e){var _0x11c046='';return db[_0x9be9('0x30')][_0x9be9('0x4e')]({'where':{'id':_0x36a097[_0x9be9('0x46')]['id']},'attributes':['id','remoteUri',_0x9be9('0x59')]})[_0x9be9('0x29')](handleEntityNotFound(_0x36b42a,null))[_0x9be9('0x29')](function(_0x5f58af){if(_0x5f58af){_0x11c046=_0x5f58af[_0x9be9('0x5a')];var _0x1d860f=_0x11c046[_0x9be9('0x5b')](-0x1);if(_0x1d860f==='/'){_0x11c046=_0x11c046[_0x9be9('0x5c')](0x0,_0x11c046[_0x9be9('0x5d')](_0x1d860f));}return rp({'method':_0x9be9('0x5e'),'uri':util['format']('%s/%s',_0x11c046,_0x9be9('0x5f')),'headers':{'Authorization':util[_0x9be9('0x60')](_0x9be9('0x61'),new Buffer(util['format']('%s:X',_0x5f58af[_0x9be9('0x59')]))[_0x9be9('0x62')](_0x9be9('0x63')))},'json':!![]});}})[_0x9be9('0x29')](function(_0x40b3f8){if(_0x40b3f8){var _0x41ba84=[_0x9be9('0x64'),_0x9be9('0x65'),'agent','description',_0x9be9('0x1d'),_0x9be9('0x66'),'group',_0x9be9('0x67'),_0x9be9('0x68'),_0x9be9('0x69'),_0x9be9('0x6a')];_[_0x9be9('0x6b')](_0x40b3f8,function(_0x2dbd3e){return _0x41ba84[_0x9be9('0x6c')](_0x2dbd3e[_0x9be9('0x2d')])||!_0x2dbd3e[_0x9be9('0x6d')]&&_0x2dbd3e['type']!==_0x9be9('0x6e')&&_0x2dbd3e['type']!=='custom_dropdown';});return{'count':_0x40b3f8[_0x9be9('0x48')],'rows':_['map'](_0x40b3f8,function(_0x5077f8){return{'id':_0x5077f8[_0x9be9('0x2d')],'name':_0x5077f8['label'],'custom':!_0x5077f8[_0x9be9('0x6d')],'options':_0x5077f8[_0x9be9('0x6f')]?_[_0x9be9('0x2f')](_0x5077f8['choices'],function(_0x56736e){return{'name':_['capitalize'](_0x56736e),'value':_0x56736e};}):[]};})};}})[_0x9be9('0x29')](respondWithResult(_0x36b42a,null))[_0x9be9('0x45')](function(_0x297840){var _0x162561=_0x36a097[_0x9be9('0x35')]['test']?0x1f4:_0x297840[_0x9be9('0x70')]||0x1f4;logger[_0x9be9('0x2b')](_0x9be9('0x71'),_0x9be9('0x58'),_0x162561,JSON[_0x9be9('0x72')](_0x297840));delete _0x297840[_0x9be9('0x2d')];if(_0x162561===0x191){_0x162561=0x190;}_0x36b42a[_0x9be9('0x1d')](_0x162561)['send'](_0x36a097[_0x9be9('0x35')][_0x9be9('0x73')]?{'message':_0x9be9('0x74'),'statusCode':_0x297840[_0x9be9('0x70')]}:_0x297840);});}; \ No newline at end of file +var _0x49e9=['keys','includeAll','options','find','catch','create','body','findOne','length','AccountId','Subjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','priority','group','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','FreshdeskAccount','rawAttributes','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','include','rows','params'];(function(_0xd46033,_0xa8f11f){var _0x2c64d9=function(_0x54475c){while(--_0x54475c){_0xd46033['push'](_0xd46033['shift']());}};_0x2c64d9(++_0xa8f11f);}(_0x49e9,0x10f));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x949e('0x0'));var rimraf=require(_0x949e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x949e('0x2'));var rp=require(_0x949e('0x3'));var moment=require(_0x949e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x949e('0x5'));var path=require('path');var sox=require(_0x949e('0x6'));var csv=require(_0x949e('0x7'));var ejs=require(_0x949e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x949e('0x9'));var squel=require(_0x949e('0xa'));var crypto=require(_0x949e('0xb'));var jsforce=require(_0x949e('0xc'));var deskjs=require(_0x949e('0xd'));var toCsv=require(_0x949e('0x7'));var querystring=require(_0x949e('0xe'));var Papa=require('papaparse');var Redis=require(_0x949e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x949e('0x10'));var as=require(_0x949e('0x11'));var hardwareService=require(_0x949e('0x12'));var logger=require('../../config/logger')(_0x949e('0x13'));var utils=require(_0x949e('0x14'));var config=require(_0x949e('0x15'));var licenseUtil=require(_0x949e('0x16'));var db=require(_0x949e('0x17'))['db'];var integrations=require(_0x949e('0x18'));function respondWithStatusCode(_0x1871a5,_0x17d1f3){_0x17d1f3=_0x17d1f3||0xcc;return function(_0x33730d){if(_0x33730d){return _0x1871a5[_0x949e('0x19')](_0x17d1f3);}return _0x1871a5[_0x949e('0x1a')](_0x17d1f3)[_0x949e('0x1b')]();};}function respondWithResult(_0x3e0e54,_0x7f8be2){_0x7f8be2=_0x7f8be2||0xc8;return function(_0x8aae46){if(_0x8aae46){return _0x3e0e54['status'](_0x7f8be2)[_0x949e('0x1c')](_0x8aae46);}};}function respondWithFilteredResult(_0x3d81cd,_0x587bff){return function(_0xf1f41a){if(_0xf1f41a){var _0x5f5962=typeof _0x587bff[_0x949e('0x1d')]===_0x949e('0x1e')&&typeof _0x587bff['limit']===_0x949e('0x1e');var _0x175d62=_0xf1f41a[_0x949e('0x1f')];var _0x868913=_0x5f5962?0x0:_0x587bff[_0x949e('0x1d')];var _0x5caac9=_0x5f5962?_0xf1f41a[_0x949e('0x1f')]:_0x587bff[_0x949e('0x1d')]+_0x587bff[_0x949e('0x20')];var _0x2f0f57;if(_0x5caac9>=_0x175d62){_0x5caac9=_0x175d62;_0x2f0f57=0xc8;}else{_0x2f0f57=0xce;}_0x3d81cd[_0x949e('0x1a')](_0x2f0f57);return _0x3d81cd[_0x949e('0x21')](_0x949e('0x22'),_0x868913+'-'+_0x5caac9+'/'+_0x175d62)[_0x949e('0x1c')](_0xf1f41a);}return null;};}function patchUpdates(_0x104740){return function(_0x39ad61){try{jsonpatch[_0x949e('0x23')](_0x39ad61,_0x104740,!![]);}catch(_0x260c1c){return BPromise[_0x949e('0x24')](_0x260c1c);}return _0x39ad61[_0x949e('0x25')]();};}function saveUpdates(_0x199d53,_0x2e81f2){return function(_0x4be47c){if(_0x4be47c){return _0x4be47c[_0x949e('0x26')](_0x199d53)[_0x949e('0x27')](function(_0x5572ae){return _0x5572ae;});}return null;};}function removeEntity(_0x48a1d1,_0x23b38e){return function(_0x398e28){if(_0x398e28){return _0x398e28[_0x949e('0x28')]()[_0x949e('0x27')](function(){_0x48a1d1[_0x949e('0x1a')](0xcc)[_0x949e('0x1b')]();});}};}function handleEntityNotFound(_0x29e07b,_0x255b11){return function(_0x3468ac){if(!_0x3468ac){_0x29e07b[_0x949e('0x19')](0x194);}return _0x3468ac;};}function handleError(_0x5dcc46,_0x212224){_0x212224=_0x212224||0x1f4;return function(_0x408f06){logger['error'](_0x408f06[_0x949e('0x29')]);if(_0x408f06[_0x949e('0x2a')]){delete _0x408f06['name'];}_0x5dcc46[_0x949e('0x1a')](_0x212224)[_0x949e('0x2b')](_0x408f06);};}exports['index']=function(_0x1867d9,_0x5b2b0b){var _0x5e6e34={},_0x4e169d={},_0x54ad5d={'count':0x0,'rows':[]};var _0x52f5bd=_[_0x949e('0x2c')](db[_0x949e('0x2d')][_0x949e('0x2e')],function(_0x4c890f){return{'name':_0x4c890f['fieldName'],'type':_0x4c890f['type']['key']};});_0x4e169d[_0x949e('0x2f')]=_[_0x949e('0x2c')](_0x52f5bd,_0x949e('0x2a'));_0x4e169d[_0x949e('0x30')]=_['keys'](_0x1867d9[_0x949e('0x30')]);_0x4e169d[_0x949e('0x31')]=_[_0x949e('0x32')](_0x4e169d['model'],_0x4e169d[_0x949e('0x30')]);_0x5e6e34[_0x949e('0x33')]=_[_0x949e('0x32')](_0x4e169d['model'],qs['fields'](_0x1867d9[_0x949e('0x30')][_0x949e('0x34')]));_0x5e6e34[_0x949e('0x33')]=_0x5e6e34[_0x949e('0x33')]['length']?_0x5e6e34[_0x949e('0x33')]:_0x4e169d[_0x949e('0x2f')];if(!_0x1867d9[_0x949e('0x30')][_0x949e('0x35')](_0x949e('0x36'))){_0x5e6e34[_0x949e('0x20')]=qs[_0x949e('0x20')](_0x1867d9[_0x949e('0x30')]['limit']);_0x5e6e34['offset']=qs[_0x949e('0x1d')](_0x1867d9['query']['offset']);}_0x5e6e34[_0x949e('0x37')]=qs[_0x949e('0x38')](_0x1867d9[_0x949e('0x30')][_0x949e('0x38')]);_0x5e6e34[_0x949e('0x39')]=qs[_0x949e('0x31')](_[_0x949e('0x3a')](_0x1867d9[_0x949e('0x30')],_0x4e169d[_0x949e('0x31')]),_0x52f5bd);if(_0x1867d9[_0x949e('0x30')][_0x949e('0x3b')]){_0x5e6e34[_0x949e('0x39')]=_[_0x949e('0x3c')](_0x5e6e34[_0x949e('0x39')],{'$or':_[_0x949e('0x2c')](_0x52f5bd,function(_0x14fc8b){if(_0x14fc8b[_0x949e('0x3d')]!=='VIRTUAL'){var _0x34bcd5={};_0x34bcd5[_0x14fc8b['name']]={'$like':'%'+_0x1867d9[_0x949e('0x30')][_0x949e('0x3b')]+'%'};return _0x34bcd5;}})});}_0x5e6e34=_['merge']({},_0x5e6e34,_0x1867d9['options']);var _0x53d37a={'where':_0x5e6e34[_0x949e('0x39')]};return db[_0x949e('0x2d')]['count'](_0x53d37a)['then'](function(_0x521231){_0x54ad5d[_0x949e('0x1f')]=_0x521231;if(_0x1867d9[_0x949e('0x30')]['includeAll']){_0x5e6e34[_0x949e('0x3e')]=[{'all':!![]}];}return db[_0x949e('0x2d')]['findAll'](_0x5e6e34);})[_0x949e('0x27')](function(_0x1126fd){_0x54ad5d[_0x949e('0x3f')]=_0x1126fd;return _0x54ad5d;})[_0x949e('0x27')](respondWithFilteredResult(_0x5b2b0b,_0x5e6e34))['catch'](handleError(_0x5b2b0b,null));};exports['show']=function(_0x2bca69,_0x590aa7){var _0x7201da={'raw':![],'where':{'id':_0x2bca69[_0x949e('0x40')]['id']}},_0x3cb36f={};_0x3cb36f[_0x949e('0x2f')]=_[_0x949e('0x41')](db['FreshdeskAccount']['rawAttributes']);_0x3cb36f[_0x949e('0x30')]=_['keys'](_0x2bca69[_0x949e('0x30')]);_0x3cb36f[_0x949e('0x31')]=_[_0x949e('0x32')](_0x3cb36f[_0x949e('0x2f')],_0x3cb36f[_0x949e('0x30')]);_0x7201da[_0x949e('0x33')]=_['intersection'](_0x3cb36f['model'],qs[_0x949e('0x34')](_0x2bca69[_0x949e('0x30')][_0x949e('0x34')]));_0x7201da[_0x949e('0x33')]=_0x7201da[_0x949e('0x33')]['length']?_0x7201da[_0x949e('0x33')]:_0x3cb36f[_0x949e('0x2f')];if(_0x2bca69['query'][_0x949e('0x42')]){_0x7201da[_0x949e('0x3e')]=[{'all':!![]}];}_0x7201da=_[_0x949e('0x3c')]({},_0x7201da,_0x2bca69[_0x949e('0x43')]);return db[_0x949e('0x2d')][_0x949e('0x44')](_0x7201da)[_0x949e('0x27')](handleEntityNotFound(_0x590aa7,null))[_0x949e('0x27')](respondWithResult(_0x590aa7,null))[_0x949e('0x45')](handleError(_0x590aa7,null));};exports['create']=function(_0x1599ea,_0x513407){return db[_0x949e('0x2d')][_0x949e('0x46')](_0x1599ea['body'],{})[_0x949e('0x27')](respondWithResult(_0x513407,0xc9))[_0x949e('0x45')](handleError(_0x513407,null));};exports[_0x949e('0x26')]=function(_0x2e2b6a,_0x3e48d2){if(_0x2e2b6a[_0x949e('0x47')]['id']){delete _0x2e2b6a[_0x949e('0x47')]['id'];}return db[_0x949e('0x2d')]['find']({'where':{'id':_0x2e2b6a[_0x949e('0x40')]['id']}})[_0x949e('0x27')](handleEntityNotFound(_0x3e48d2,null))[_0x949e('0x27')](saveUpdates(_0x2e2b6a[_0x949e('0x47')],null))[_0x949e('0x27')](respondWithResult(_0x3e48d2,null))['catch'](handleError(_0x3e48d2,null));};exports['destroy']=function(_0x46a4fe,_0x16f5ad){return db['FreshdeskAccount'][_0x949e('0x44')]({'where':{'id':_0x46a4fe[_0x949e('0x40')]['id']}})[_0x949e('0x27')](handleEntityNotFound(_0x16f5ad,null))[_0x949e('0x27')](removeEntity(_0x16f5ad,null))['catch'](handleError(_0x16f5ad,null));};exports['getConfigurations']=function(_0x450d16,_0x46d687,_0x4428f1){var _0x97d162={};var _0x16ec1b={};var _0x44daa4;var _0x29ebb6;return db[_0x949e('0x2d')][_0x949e('0x48')]({'where':{'id':_0x450d16['params']['id']}})[_0x949e('0x27')](handleEntityNotFound(_0x46d687,null))['then'](function(_0x2f63aa){if(_0x2f63aa){_0x44daa4=_0x2f63aa;_0x16ec1b['model']=_[_0x949e('0x41')](db['FreshdeskConfiguration'][_0x949e('0x2e')]);_0x16ec1b[_0x949e('0x30')]=_['keys'](_0x450d16[_0x949e('0x30')]);_0x16ec1b[_0x949e('0x31')]=_[_0x949e('0x32')](_0x16ec1b[_0x949e('0x2f')],_0x16ec1b[_0x949e('0x30')]);_0x97d162['attributes']=_['intersection'](_0x16ec1b[_0x949e('0x2f')],qs[_0x949e('0x34')](_0x450d16['query'][_0x949e('0x34')]));_0x97d162[_0x949e('0x33')]=_0x97d162['attributes'][_0x949e('0x49')]?_0x97d162[_0x949e('0x33')]:_0x16ec1b[_0x949e('0x2f')];_0x97d162[_0x949e('0x37')]=qs[_0x949e('0x38')](_0x450d16[_0x949e('0x30')][_0x949e('0x38')]);_0x97d162[_0x949e('0x39')]=qs[_0x949e('0x31')](_[_0x949e('0x3a')](_0x450d16[_0x949e('0x30')],_0x16ec1b[_0x949e('0x31')]));if(_0x450d16[_0x949e('0x30')][_0x949e('0x3b')]){_0x97d162[_0x949e('0x39')]=_[_0x949e('0x3c')](_0x97d162[_0x949e('0x39')],{'$or':_[_0x949e('0x2c')](_0x97d162['attributes'],function(_0x2c5413){var _0x4899ac={};_0x4899ac[_0x2c5413]={'$like':'%'+_0x450d16['query'][_0x949e('0x3b')]+'%'};return _0x4899ac;})});}_0x97d162=_[_0x949e('0x3c')]({},_0x97d162,_0x450d16[_0x949e('0x43')]);return _0x44daa4['getConfigurations'](_0x97d162);}})[_0x949e('0x27')](function(_0x420557){if(_0x420557){_0x29ebb6=_0x420557[_0x949e('0x49')];if(!_0x450d16['query'][_0x949e('0x35')](_0x949e('0x36'))){_0x97d162[_0x949e('0x20')]=qs['limit'](_0x450d16[_0x949e('0x30')][_0x949e('0x20')]);_0x97d162[_0x949e('0x1d')]=qs[_0x949e('0x1d')](_0x450d16[_0x949e('0x30')][_0x949e('0x1d')]);}return _0x44daa4['getConfigurations'](_0x97d162);}})[_0x949e('0x27')](function(_0x35816b){if(_0x35816b){return _0x35816b?{'count':_0x29ebb6,'rows':_0x35816b}:null;}})[_0x949e('0x27')](respondWithResult(_0x46d687,null))['catch'](handleError(_0x46d687,null));};exports['addConfiguration']=function(_0x25076b,_0x4dd2b7,_0x2b112f){if(_0x25076b[_0x949e('0x47')]['id']){delete _0x25076b[_0x949e('0x47')]['id'];}return db[_0x949e('0x2d')][_0x949e('0x48')]({'where':{'id':_0x25076b[_0x949e('0x40')]['id']}})['then'](handleEntityNotFound(_0x4dd2b7,null))[_0x949e('0x27')](function(_0x1c5fc5){if(_0x1c5fc5){_0x25076b[_0x949e('0x47')][_0x949e('0x4a')]=_0x1c5fc5['id'];_0x25076b[_0x949e('0x47')][_0x949e('0x4b')]=integrations['getSubjects'](_0x25076b[_0x949e('0x47')][_0x949e('0x4c')],_0x25076b['body']['type']);_0x25076b[_0x949e('0x47')]['Descriptions']=integrations[_0x949e('0x4d')](_0x25076b['body']['channel'],_0x25076b[_0x949e('0x47')][_0x949e('0x3d')]);return db[_0x949e('0x4e')][_0x949e('0x46')](_0x25076b[_0x949e('0x47')],{'include':[{'model':db[_0x949e('0x4f')],'as':_0x949e('0x4b')},{'model':db[_0x949e('0x4f')],'as':_0x949e('0x50')}]});}return null;})[_0x949e('0x27')](respondWithResult(_0x4dd2b7,null))[_0x949e('0x45')](handleError(_0x4dd2b7,null));};exports[_0x949e('0x51')]=function(_0xd23f7a,_0x161c76,_0x44e52f){var _0x4531e8='';return db[_0x949e('0x2d')][_0x949e('0x48')]({'where':{'id':_0xd23f7a[_0x949e('0x40')]['id']},'attributes':['id',_0x949e('0x52'),_0x949e('0x53')]})[_0x949e('0x27')](handleEntityNotFound(_0x161c76,null))[_0x949e('0x27')](function(_0x29affb){if(_0x29affb){_0x4531e8=_0x29affb[_0x949e('0x52')];var _0x572b4f=_0x4531e8['slice'](-0x1);if(_0x572b4f==='/'){_0x4531e8=_0x4531e8[_0x949e('0x54')](0x0,_0x4531e8[_0x949e('0x55')](_0x572b4f));}return rp({'method':'GET','uri':util[_0x949e('0x56')](_0x949e('0x57'),_0x4531e8,_0x949e('0x58')),'headers':{'Authorization':util[_0x949e('0x56')](_0x949e('0x59'),new Buffer(util[_0x949e('0x56')](_0x949e('0x5a'),_0x29affb[_0x949e('0x53')]))[_0x949e('0x5b')](_0x949e('0x5c')))},'json':!![]});}})[_0x949e('0x27')](function(_0x2a62ed){if(_0x2a62ed){var _0x227907=[_0x949e('0x5d'),'subject','agent','description',_0x949e('0x1a'),_0x949e('0x5e'),_0x949e('0x5f'),'source',_0x949e('0x60'),_0x949e('0x5f'),_0x949e('0x61')];_[_0x949e('0x62')](_0x2a62ed,function(_0x4d33a6){return _0x227907[_0x949e('0x63')](_0x4d33a6[_0x949e('0x2a')])||!_0x4d33a6[_0x949e('0x64')]&&_0x4d33a6[_0x949e('0x3d')]!==_0x949e('0x65')&&_0x4d33a6[_0x949e('0x3d')]!==_0x949e('0x66');});return{'count':_0x2a62ed[_0x949e('0x49')],'rows':_[_0x949e('0x2c')](_0x2a62ed,function(_0xa95796){return{'id':_0xa95796[_0x949e('0x2a')],'name':_0xa95796[_0x949e('0x67')],'custom':!_0xa95796['default'],'options':_0xa95796[_0x949e('0x68')]?_[_0x949e('0x2c')](_0xa95796[_0x949e('0x68')],function(_0x2939bc){return{'name':_[_0x949e('0x69')](_0x2939bc),'value':_0x2939bc};}):[]};})};}})[_0x949e('0x27')](respondWithResult(_0x161c76,null))['catch'](function(_0x1f7c40){var _0x519781=_0xd23f7a[_0x949e('0x30')][_0x949e('0x6a')]?0x1f4:_0x1f7c40['statusCode']||0x1f4;logger[_0x949e('0x6b')](_0x949e('0x6c'),_0x949e('0x51'),_0x519781,JSON[_0x949e('0x6d')](_0x1f7c40));delete _0x1f7c40['name'];if(_0x519781===0x191){_0x519781=0x190;}_0x161c76['status'](_0x519781)['send'](_0xd23f7a[_0x949e('0x30')][_0x949e('0x6a')]?{'message':_0x949e('0x6e'),'statusCode':_0x1f7c40[_0x949e('0x6f')]}:_0x1f7c40);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 70914a8..47590fc 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 _0xca52=['path','../../config/environment','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','util','api','moment','bluebird','request-promise'];(function(_0xd598e9,_0x20cb54){var _0x12c224=function(_0x5046e1){while(--_0x5046e1){_0xd598e9['push'](_0xd598e9['shift']());}};_0x12c224(++_0x20cb54);}(_0xca52,0x127));var _0x2ca5=function(_0x175389,_0x77c642){_0x175389=_0x175389-0x0;var _0x518fbb=_0xca52[_0x175389];return _0x518fbb;};'use strict';var _=require('lodash');var util=require(_0x2ca5('0x0'));var logger=require('../../config/logger')(_0x2ca5('0x1'));var moment=require(_0x2ca5('0x2'));var BPromise=require(_0x2ca5('0x3'));var rp=require(_0x2ca5('0x4'));var fs=require('fs');var path=require(_0x2ca5('0x5'));var rimraf=require('rimraf');var config=require(_0x2ca5('0x6'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x2ca5('0x7'));module[_0x2ca5('0x8')]=function(_0x44b322,_0x2e08bd){return _0x44b322[_0x2ca5('0x9')](_0x2ca5('0xa'),attributes,{'tableName':_0x2ca5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81fc=['define','FreshdeskAccount','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0xa8cb3e,_0x190c95){var _0x56e02e=function(_0xe4191a){while(--_0xe4191a){_0xa8cb3e['push'](_0xa8cb3e['shift']());}};_0x56e02e(++_0x190c95);}(_0x81fc,0x13a));var _0xc81f=function(_0x5ce3af,_0x461522){_0x5ce3af=_0x5ce3af-0x0;var _0x122b27=_0x81fc[_0x5ce3af];return _0x122b27;};'use strict';var _=require(_0xc81f('0x0'));var util=require(_0xc81f('0x1'));var logger=require(_0xc81f('0x2'))('api');var moment=require(_0xc81f('0x3'));var BPromise=require('bluebird');var rp=require(_0xc81f('0x4'));var fs=require('fs');var path=require(_0xc81f('0x5'));var rimraf=require(_0xc81f('0x6'));var config=require(_0xc81f('0x7'));var attributes=require(_0xc81f('0x8'));var integrations=require(_0xc81f('0x9'));module[_0xc81f('0xa')]=function(_0x41dabb,_0x1c8358){return _0x41dabb[_0xc81f('0xb')](_0xc81f('0xc'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index d56dc7c..6c00cc3 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 _0xbfa4=['include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','raw','lodash','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FreshdeskAccount','options','where','attributes','limit'];(function(_0x49a378,_0x4e1947){var _0x370353=function(_0x37e3a4){while(--_0x37e3a4){_0x49a378['push'](_0x49a378['shift']());}};_0x370353(++_0x4e1947);}(_0xbfa4,0x106));var _0x4bfa=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0xbfa4[_0x238671];return _0x474844;};'use strict';var _=require(_0x4bfa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4bfa('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4bfa('0x2'));var logger=require(_0x4bfa('0x3'))(_0x4bfa('0x4'));var config=require(_0x4bfa('0x5'));var jayson=require(_0x4bfa('0x6'));var client=jayson[_0x4bfa('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f78cf,_0x40d37a,_0x2b232d){return new BPromise(function(_0x20b270,_0x18dea3){return client[_0x4bfa('0x8')](_0x1f78cf,_0x2b232d)[_0x4bfa('0x9')](function(_0x316329){logger[_0x4bfa('0xa')](_0x4bfa('0xb'),_0x40d37a,'request\x20sent');logger[_0x4bfa('0xc')](_0x4bfa('0xd'),_0x40d37a,_0x4bfa('0xe'),JSON[_0x4bfa('0xf')](_0x316329));if(_0x316329[_0x4bfa('0x10')]){if(_0x316329[_0x4bfa('0x10')][_0x4bfa('0x11')]===0x1f4){logger[_0x4bfa('0x10')](_0x4bfa('0xb'),_0x40d37a,_0x316329[_0x4bfa('0x10')][_0x4bfa('0x12')]);return _0x18dea3(_0x316329[_0x4bfa('0x10')]['message']);}logger[_0x4bfa('0x10')](_0x4bfa('0xb'),_0x40d37a,_0x316329[_0x4bfa('0x10')][_0x4bfa('0x12')]);return _0x20b270(_0x316329[_0x4bfa('0x10')][_0x4bfa('0x12')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x40d37a,_0x4bfa('0xe'));_0x20b270(_0x316329[_0x4bfa('0x13')][_0x4bfa('0x12')]);}})[_0x4bfa('0x14')](function(_0x22ce16){logger['error'](_0x4bfa('0xb'),_0x40d37a,_0x22ce16);_0x18dea3(_0x22ce16);});});}exports['GetFreshdeskAccount']=function(_0x2069f7){var _0x8b6cf7=this;return new Promise(function(_0x3b4ac4,_0x31dce9){return db[_0x4bfa('0x15')]['findAll']({'raw':_0x2069f7['options']?_0x2069f7['options']['raw']===undefined?!![]:![]:!![],'where':_0x2069f7[_0x4bfa('0x16')]?_0x2069f7[_0x4bfa('0x16')][_0x4bfa('0x17')]||null:null,'attributes':_0x2069f7[_0x4bfa('0x16')]?_0x2069f7[_0x4bfa('0x16')][_0x4bfa('0x18')]||null:null,'limit':_0x2069f7[_0x4bfa('0x16')]?_0x2069f7[_0x4bfa('0x16')][_0x4bfa('0x19')]||null:null,'include':_0x2069f7[_0x4bfa('0x16')]?_0x2069f7[_0x4bfa('0x16')][_0x4bfa('0x1a')]?_[_0x4bfa('0x1b')](_0x2069f7[_0x4bfa('0x16')]['include'],function(_0x1ac625){return{'model':db[_0x1ac625[_0x4bfa('0x1c')]],'as':_0x1ac625['as'],'attributes':_0x1ac625[_0x4bfa('0x18')],'include':_0x1ac625[_0x4bfa('0x1a')]?_['map'](_0x1ac625[_0x4bfa('0x1a')],function(_0x5cc22d){return{'model':db[_0x5cc22d[_0x4bfa('0x1c')]],'as':_0x5cc22d['as'],'attributes':_0x5cc22d[_0x4bfa('0x18')],'include':_0x5cc22d[_0x4bfa('0x1a')]?_[_0x4bfa('0x1b')](_0x5cc22d[_0x4bfa('0x1a')],function(_0x41b8f7){return{'model':db[_0x41b8f7[_0x4bfa('0x1c')]],'as':_0x41b8f7['as'],'attributes':_0x41b8f7[_0x4bfa('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4bfa('0x9')](function(_0x1e395f){logger[_0x4bfa('0xa')](_0x4bfa('0x1d'),_0x2069f7);logger['debug']('GetFreshdeskAccount',_0x2069f7,JSON[_0x4bfa('0xf')](_0x1e395f));_0x3b4ac4(_0x1e395f);})['catch'](function(_0x2ad930){logger['error'](_0x4bfa('0x1d'),_0x2ad930[_0x4bfa('0x12')],_0x2069f7);_0x31dce9(_0x8b6cf7[_0x4bfa('0x10')](0x1f4,_0x2ad930[_0x4bfa('0x12')]));});});};exports[_0x4bfa('0x1e')]=function(_0x268700){var _0x2e69e9=this;return new Promise(function(_0x3de844,_0x5f9817){return db[_0x4bfa('0x15')]['find']({'raw':_0x268700[_0x4bfa('0x16')]?_0x268700[_0x4bfa('0x16')][_0x4bfa('0x1f')]===undefined?!![]:![]:!![],'where':_0x268700['options']?_0x268700[_0x4bfa('0x16')][_0x4bfa('0x17')]||null:null,'attributes':_0x268700[_0x4bfa('0x16')]?_0x268700[_0x4bfa('0x16')][_0x4bfa('0x18')]||null:null,'include':_0x268700['options']?_0x268700[_0x4bfa('0x16')][_0x4bfa('0x1a')]?_[_0x4bfa('0x1b')](_0x268700['options'][_0x4bfa('0x1a')],function(_0xf0debc){return{'model':db[_0xf0debc[_0x4bfa('0x1c')]],'as':_0xf0debc['as'],'attributes':_0xf0debc['attributes'],'include':_0xf0debc['include']?_[_0x4bfa('0x1b')](_0xf0debc[_0x4bfa('0x1a')],function(_0x23fed5){return{'model':db[_0x23fed5[_0x4bfa('0x1c')]],'as':_0x23fed5['as'],'attributes':_0x23fed5[_0x4bfa('0x18')],'include':_0x23fed5[_0x4bfa('0x1a')]?_[_0x4bfa('0x1b')](_0x23fed5[_0x4bfa('0x1a')],function(_0x28cd77){return{'model':db[_0x28cd77[_0x4bfa('0x1c')]],'as':_0x28cd77['as'],'attributes':_0x28cd77[_0x4bfa('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4bfa('0x9')](function(_0x44a4cf){logger['info']('ShowFreshdeskAccount',_0x268700);logger[_0x4bfa('0xc')]('ShowFreshdeskAccount',_0x268700,JSON[_0x4bfa('0xf')](_0x44a4cf));_0x3de844(_0x44a4cf);})[_0x4bfa('0x14')](function(_0x347d45){logger[_0x4bfa('0x10')](_0x4bfa('0x1e'),_0x347d45[_0x4bfa('0x12')],_0x268700);_0x5f9817(_0x2e69e9[_0x4bfa('0x10')](0x1f4,_0x347d45[_0x4bfa('0x12')]));});});}; \ No newline at end of file +var _0xad86=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','lodash','util','moment','bluebird'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xad86,0x194));var _0x6ad8=function(_0x419a45,_0x1d94e5){_0x419a45=_0x419a45-0x0;var _0x23e394=_0xad86[_0x419a45];return _0x23e394;};'use strict';var _=require(_0x6ad8('0x0'));var util=require(_0x6ad8('0x1'));var moment=require(_0x6ad8('0x2'));var BPromise=require(_0x6ad8('0x3'));var rs=require(_0x6ad8('0x4'));var fs=require('fs');var Redis=require(_0x6ad8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ad8('0x6'))(_0x6ad8('0x7'));var config=require(_0x6ad8('0x8'));var jayson=require(_0x6ad8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ecf3f,_0x44b48e,_0x44f61a){return new BPromise(function(_0x1f0fd3,_0x5cce0d){return client['request'](_0x1ecf3f,_0x44f61a)[_0x6ad8('0xa')](function(_0x164208){logger[_0x6ad8('0xb')](_0x6ad8('0xc'),_0x44b48e,_0x6ad8('0xd'));logger[_0x6ad8('0xe')](_0x6ad8('0xf'),_0x44b48e,_0x6ad8('0xd'),JSON[_0x6ad8('0x10')](_0x164208));if(_0x164208['error']){if(_0x164208['error']['code']===0x1f4){logger[_0x6ad8('0x11')](_0x6ad8('0xc'),_0x44b48e,_0x164208['error'][_0x6ad8('0x12')]);return _0x5cce0d(_0x164208['error'][_0x6ad8('0x12')]);}logger[_0x6ad8('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x44b48e,_0x164208[_0x6ad8('0x11')]['message']);return _0x1f0fd3(_0x164208[_0x6ad8('0x11')][_0x6ad8('0x12')]);}else{logger[_0x6ad8('0xb')](_0x6ad8('0xc'),_0x44b48e,'request\x20sent');_0x1f0fd3(_0x164208[_0x6ad8('0x13')][_0x6ad8('0x12')]);}})[_0x6ad8('0x14')](function(_0x300b8d){logger['error'](_0x6ad8('0xc'),_0x44b48e,_0x300b8d);_0x5cce0d(_0x300b8d);});});}exports[_0x6ad8('0x15')]=function(_0x4c2445){var _0x4404da=this;return new Promise(function(_0x4ef013,_0x1de457){return db[_0x6ad8('0x16')][_0x6ad8('0x17')]({'raw':_0x4c2445[_0x6ad8('0x18')]?_0x4c2445['options'][_0x6ad8('0x19')]===undefined?!![]:![]:!![],'where':_0x4c2445[_0x6ad8('0x18')]?_0x4c2445[_0x6ad8('0x18')][_0x6ad8('0x1a')]||null:null,'attributes':_0x4c2445['options']?_0x4c2445[_0x6ad8('0x18')][_0x6ad8('0x1b')]||null:null,'limit':_0x4c2445[_0x6ad8('0x18')]?_0x4c2445[_0x6ad8('0x18')][_0x6ad8('0x1c')]||null:null,'include':_0x4c2445[_0x6ad8('0x18')]?_0x4c2445[_0x6ad8('0x18')][_0x6ad8('0x1d')]?_['map'](_0x4c2445[_0x6ad8('0x18')][_0x6ad8('0x1d')],function(_0x5de250){return{'model':db[_0x5de250['model']],'as':_0x5de250['as'],'attributes':_0x5de250[_0x6ad8('0x1b')],'include':_0x5de250[_0x6ad8('0x1d')]?_[_0x6ad8('0x1e')](_0x5de250[_0x6ad8('0x1d')],function(_0x1297e4){return{'model':db[_0x1297e4[_0x6ad8('0x1f')]],'as':_0x1297e4['as'],'attributes':_0x1297e4[_0x6ad8('0x1b')],'include':_0x1297e4[_0x6ad8('0x1d')]?_['map'](_0x1297e4['include'],function(_0x2303e1){return{'model':db[_0x2303e1[_0x6ad8('0x1f')]],'as':_0x2303e1['as'],'attributes':_0x2303e1[_0x6ad8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ad8('0xa')](function(_0x503184){logger[_0x6ad8('0xb')]('GetFreshdeskAccount',_0x4c2445);logger[_0x6ad8('0xe')](_0x6ad8('0x15'),_0x4c2445,JSON[_0x6ad8('0x10')](_0x503184));_0x4ef013(_0x503184);})[_0x6ad8('0x14')](function(_0x42551a){logger[_0x6ad8('0x11')](_0x6ad8('0x15'),_0x42551a['message'],_0x4c2445);_0x1de457(_0x4404da['error'](0x1f4,_0x42551a[_0x6ad8('0x12')]));});});};exports[_0x6ad8('0x20')]=function(_0x4d2cc6){var _0x4ab967=this;return new Promise(function(_0x10eccd,_0x3b70a7){return db[_0x6ad8('0x16')][_0x6ad8('0x21')]({'raw':_0x4d2cc6[_0x6ad8('0x18')]?_0x4d2cc6['options'][_0x6ad8('0x19')]===undefined?!![]:![]:!![],'where':_0x4d2cc6['options']?_0x4d2cc6[_0x6ad8('0x18')][_0x6ad8('0x1a')]||null:null,'attributes':_0x4d2cc6[_0x6ad8('0x18')]?_0x4d2cc6[_0x6ad8('0x18')][_0x6ad8('0x1b')]||null:null,'include':_0x4d2cc6[_0x6ad8('0x18')]?_0x4d2cc6[_0x6ad8('0x18')][_0x6ad8('0x1d')]?_[_0x6ad8('0x1e')](_0x4d2cc6[_0x6ad8('0x18')][_0x6ad8('0x1d')],function(_0x1e5360){return{'model':db[_0x1e5360['model']],'as':_0x1e5360['as'],'attributes':_0x1e5360[_0x6ad8('0x1b')],'include':_0x1e5360[_0x6ad8('0x1d')]?_[_0x6ad8('0x1e')](_0x1e5360[_0x6ad8('0x1d')],function(_0x511986){return{'model':db[_0x511986[_0x6ad8('0x1f')]],'as':_0x511986['as'],'attributes':_0x511986[_0x6ad8('0x1b')],'include':_0x511986['include']?_['map'](_0x511986[_0x6ad8('0x1d')],function(_0x964b3a){return{'model':db[_0x964b3a[_0x6ad8('0x1f')]],'as':_0x964b3a['as'],'attributes':_0x964b3a[_0x6ad8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ad8('0xa')](function(_0x4bc222){logger[_0x6ad8('0xb')](_0x6ad8('0x20'),_0x4d2cc6);logger[_0x6ad8('0xe')](_0x6ad8('0x20'),_0x4d2cc6,JSON[_0x6ad8('0x10')](_0x4bc222));_0x10eccd(_0x4bc222);})['catch'](function(_0x237091){logger['error'](_0x6ad8('0x20'),_0x237091[_0x6ad8('0x12')],_0x4d2cc6);_0x3b70a7(_0x4ab967[_0x6ad8('0x11')](0x1f4,_0x237091[_0x6ad8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 0fbc5b4..c011fcc 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 _0xd156=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x4ed8ac,_0x3b499){var _0x2fe68f=function(_0x776d2e){while(--_0x776d2e){_0x4ed8ac['push'](_0x4ed8ac['shift']());}};_0x2fe68f(++_0x3b499);}(_0xd156,0x125));var _0x6d15=function(_0x5d4cb3,_0x293631){_0x5d4cb3=_0x5d4cb3-0x0;var _0x5dc627=_0xd156[_0x5d4cb3];return _0x5dc627;};'use strict';var multer=require(_0x6d15('0x0'));var util=require('util');var path=require(_0x6d15('0x1'));var timeout=require(_0x6d15('0x2'));var express=require(_0x6d15('0x3'));var router=express['Router']();var fs_extra=require(_0x6d15('0x4'));var auth=require(_0x6d15('0x5'));var interaction=require(_0x6d15('0x6'));var config=require(_0x6d15('0x7'));var controller=require(_0x6d15('0x8'));router['get']('/',auth[_0x6d15('0x9')](),controller[_0x6d15('0xa')]);router[_0x6d15('0xb')](_0x6d15('0xc'),auth[_0x6d15('0x9')](),controller[_0x6d15('0xd')]);router[_0x6d15('0xb')](_0x6d15('0xe'),auth[_0x6d15('0x9')](),controller['getFields']);router['get'](_0x6d15('0xf'),auth[_0x6d15('0x9')](),controller[_0x6d15('0x10')]);router[_0x6d15('0xb')](_0x6d15('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6d15('0xb')](_0x6d15('0x12'),auth[_0x6d15('0x9')](),controller[_0x6d15('0x13')]);router[_0x6d15('0x14')]('/',auth[_0x6d15('0x9')](),controller[_0x6d15('0x15')]);router[_0x6d15('0x14')](_0x6d15('0x12'),auth[_0x6d15('0x9')](),controller[_0x6d15('0x16')]);router[_0x6d15('0x17')](_0x6d15('0xc'),auth[_0x6d15('0x9')](),controller[_0x6d15('0x18')]);router[_0x6d15('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x6d15('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x658b=['getTags','post','create','setTags','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','/:id/tags'];(function(_0x5a8ca0,_0x145ad1){var _0x23b212=function(_0x360d10){while(--_0x360d10){_0x5a8ca0['push'](_0x5a8ca0['shift']());}};_0x23b212(++_0x145ad1);}(_0x658b,0xb0));var _0xb658=function(_0x5b4c9d,_0x32380c){_0x5b4c9d=_0x5b4c9d-0x0;var _0x32d062=_0x658b[_0x5b4c9d];return _0x32d062;};'use strict';var multer=require(_0xb658('0x0'));var util=require(_0xb658('0x1'));var path=require(_0xb658('0x2'));var timeout=require(_0xb658('0x3'));var express=require(_0xb658('0x4'));var router=express[_0xb658('0x5')]();var fs_extra=require(_0xb658('0x6'));var auth=require(_0xb658('0x7'));var interaction=require(_0xb658('0x8'));var config=require(_0xb658('0x9'));var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0xb658('0xa')](),controller[_0xb658('0xb')]);router[_0xb658('0xc')](_0xb658('0xd'),auth['isAuthenticated'](),controller[_0xb658('0xe')]);router[_0xb658('0xc')](_0xb658('0xf'),auth[_0xb658('0xa')](),controller[_0xb658('0x10')]);router[_0xb658('0xc')]('/:id/subjects',auth[_0xb658('0xa')](),controller['getSubjects']);router[_0xb658('0xc')](_0xb658('0x11'),auth[_0xb658('0xa')](),controller[_0xb658('0x12')]);router[_0xb658('0xc')](_0xb658('0x13'),auth[_0xb658('0xa')](),controller[_0xb658('0x14')]);router[_0xb658('0x15')]('/',auth[_0xb658('0xa')](),controller[_0xb658('0x16')]);router['post']('/:id/tags',auth['isAuthenticated'](),controller[_0xb658('0x17')]);router[_0xb658('0x18')]('/:id',auth[_0xb658('0xa')](),controller[_0xb658('0x19')]);router[_0xb658('0x1a')](_0xb658('0xd'),auth['isAuthenticated'](),controller[_0xb658('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 33d65c3..4ce9e0e 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 _0x207d=['sequelize','exports','STRING'];(function(_0x1e1372,_0x431c99){var _0x5f1438=function(_0xe8becf){while(--_0xe8becf){_0x1e1372['push'](_0x1e1372['shift']());}};_0x5f1438(++_0x431c99);}(_0x207d,0x1a7));var _0xd207=function(_0x246711,_0x2c69f4){_0x246711=_0x246711-0x0;var _0x15acd4=_0x207d[_0x246711];return _0x15acd4;};'use strict';var Sequelize=require(_0xd207('0x0'));module[_0xd207('0x1')]={'name':{'type':Sequelize[_0xd207('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4bfa=['sequelize','exports','STRING'];(function(_0x258a40,_0x19e206){var _0xee8e2=function(_0x152c0b){while(--_0x152c0b){_0x258a40['push'](_0x258a40['shift']());}};_0xee8e2(++_0x19e206);}(_0x4bfa,0xff));var _0xa4bf=function(_0x1a681c,_0x4decba){_0x1a681c=_0x1a681c-0x0;var _0x45643c=_0x4bfa[_0x1a681c];return _0x45643c;};'use strict';var Sequelize=require(_0xa4bf('0x0'));module[_0xa4bf('0x1')]={'name':{'type':Sequelize[_0xa4bf('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 164929a..f6f7914 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 _0x22f6=['send','index','map','rawAttributes','key','query','keys','filters','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','FreshdeskConfiguration','includeAll','catch','show','intersection','length','include','find','create','body','update','params','findOne','FreshdeskField','merge','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','sendStatus','error','stack','name'];(function(_0x4a9a25,_0x14eab9){var _0x5beb80=function(_0x3c6097){while(--_0x3c6097){_0x4a9a25['push'](_0x4a9a25['shift']());}};_0x5beb80(++_0x14eab9);}(_0x22f6,0x1ce));var _0x622f=function(_0x572ce1,_0xa27ca4){_0x572ce1=_0x572ce1-0x0;var _0x57e794=_0x22f6[_0x572ce1];return _0x57e794;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x622f('0x0'));var zipdir=require(_0x622f('0x1'));var jsonpatch=require(_0x622f('0x2'));var rp=require('request-promise');var moment=require(_0x622f('0x3'));var BPromise=require(_0x622f('0x4'));var Mustache=require(_0x622f('0x5'));var util=require(_0x622f('0x6'));var path=require(_0x622f('0x7'));var sox=require('sox');var csv=require(_0x622f('0x8'));var ejs=require(_0x622f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x622f('0xa'));var crypto=require(_0x622f('0xb'));var jsforce=require(_0x622f('0xc'));var deskjs=require(_0x622f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x622f('0xe'));var Redis=require(_0x622f('0xf'));var authService=require(_0x622f('0x10'));var qs=require(_0x622f('0x11'));var as=require(_0x622f('0x12'));var hardwareService=require(_0x622f('0x13'));var logger=require(_0x622f('0x14'))(_0x622f('0x15'));var utils=require('../../config/utils');var config=require(_0x622f('0x16'));var licenseUtil=require(_0x622f('0x17'));var db=require(_0x622f('0x18'))['db'];function respondWithStatusCode(_0x376e45,_0x413e2c){_0x413e2c=_0x413e2c||0xcc;return function(_0x59f840){if(_0x59f840){return _0x376e45['sendStatus'](_0x413e2c);}return _0x376e45[_0x622f('0x19')](_0x413e2c)[_0x622f('0x1a')]();};}function respondWithResult(_0x171dc5,_0x4d43dc){_0x4d43dc=_0x4d43dc||0xc8;return function(_0x334e49){if(_0x334e49){return _0x171dc5[_0x622f('0x19')](_0x4d43dc)['json'](_0x334e49);}};}function respondWithFilteredResult(_0x16570a,_0x3447f1){return function(_0x28ace2){if(_0x28ace2){var _0x1f4cfa=typeof _0x3447f1[_0x622f('0x1b')]===_0x622f('0x1c')&&typeof _0x3447f1[_0x622f('0x1d')]===_0x622f('0x1c');var _0x51f0bf=_0x28ace2[_0x622f('0x1e')];var _0x34f2b5=_0x1f4cfa?0x0:_0x3447f1[_0x622f('0x1b')];var _0x53edf=_0x1f4cfa?_0x28ace2['count']:_0x3447f1['offset']+_0x3447f1['limit'];var _0x5d397e;if(_0x53edf>=_0x51f0bf){_0x53edf=_0x51f0bf;_0x5d397e=0xc8;}else{_0x5d397e=0xce;}_0x16570a['status'](_0x5d397e);return _0x16570a[_0x622f('0x1f')](_0x622f('0x20'),_0x34f2b5+'-'+_0x53edf+'/'+_0x51f0bf)[_0x622f('0x21')](_0x28ace2);}return null;};}function patchUpdates(_0x27320f){return function(_0x24e6f0){try{jsonpatch['apply'](_0x24e6f0,_0x27320f,!![]);}catch(_0x1a19e4){return BPromise[_0x622f('0x22')](_0x1a19e4);}return _0x24e6f0[_0x622f('0x23')]();};}function saveUpdates(_0x3c2d6b,_0xeef89b){return function(_0xa20a5){if(_0xa20a5){return _0xa20a5['update'](_0x3c2d6b)[_0x622f('0x24')](function(_0x2e441e){return _0x2e441e;});}return null;};}function removeEntity(_0x167f45,_0x40db42){return function(_0x33ffd2){if(_0x33ffd2){return _0x33ffd2[_0x622f('0x25')]()[_0x622f('0x24')](function(){_0x167f45[_0x622f('0x19')](0xcc)[_0x622f('0x1a')]();});}};}function handleEntityNotFound(_0x57aeb0,_0x55ad3c){return function(_0x553f04){if(!_0x553f04){_0x57aeb0[_0x622f('0x26')](0x194);}return _0x553f04;};}function handleError(_0x4a2f5f,_0x5afedf){_0x5afedf=_0x5afedf||0x1f4;return function(_0x3548e1){logger[_0x622f('0x27')](_0x3548e1[_0x622f('0x28')]);if(_0x3548e1[_0x622f('0x29')]){delete _0x3548e1['name'];}_0x4a2f5f[_0x622f('0x19')](_0x5afedf)[_0x622f('0x2a')](_0x3548e1);};}exports[_0x622f('0x2b')]=function(_0x3ef0ba,_0x399478){var _0x41c0e2={},_0x3809ec={},_0x428203={'count':0x0,'rows':[]};var _0x247f61=_[_0x622f('0x2c')](db['FreshdeskConfiguration'][_0x622f('0x2d')],function(_0x27c8d5){return{'name':_0x27c8d5['fieldName'],'type':_0x27c8d5['type'][_0x622f('0x2e')]};});_0x3809ec['model']=_['map'](_0x247f61,_0x622f('0x29'));_0x3809ec[_0x622f('0x2f')]=_[_0x622f('0x30')](_0x3ef0ba[_0x622f('0x2f')]);_0x3809ec[_0x622f('0x31')]=_['intersection'](_0x3809ec['model'],_0x3809ec[_0x622f('0x2f')]);_0x41c0e2[_0x622f('0x32')]=_['intersection'](_0x3809ec[_0x622f('0x33')],qs[_0x622f('0x34')](_0x3ef0ba['query']['fields']));_0x41c0e2[_0x622f('0x32')]=_0x41c0e2['attributes']['length']?_0x41c0e2[_0x622f('0x32')]:_0x3809ec[_0x622f('0x33')];if(!_0x3ef0ba[_0x622f('0x2f')][_0x622f('0x35')](_0x622f('0x36'))){_0x41c0e2[_0x622f('0x1d')]=qs['limit'](_0x3ef0ba['query'][_0x622f('0x1d')]);_0x41c0e2[_0x622f('0x1b')]=qs[_0x622f('0x1b')](_0x3ef0ba[_0x622f('0x2f')][_0x622f('0x1b')]);}_0x41c0e2[_0x622f('0x37')]=qs[_0x622f('0x38')](_0x3ef0ba[_0x622f('0x2f')][_0x622f('0x38')]);_0x41c0e2[_0x622f('0x39')]=qs[_0x622f('0x31')](_[_0x622f('0x3a')](_0x3ef0ba[_0x622f('0x2f')],_0x3809ec['filters']),_0x247f61);if(_0x3ef0ba[_0x622f('0x2f')][_0x622f('0x3b')]){_0x41c0e2['where']=_['merge'](_0x41c0e2[_0x622f('0x39')],{'$or':_['map'](_0x247f61,function(_0x4eb5a3){if(_0x4eb5a3['type']!==_0x622f('0x3c')){var _0x2aaaa4={};_0x2aaaa4[_0x4eb5a3[_0x622f('0x29')]]={'$like':'%'+_0x3ef0ba[_0x622f('0x2f')][_0x622f('0x3b')]+'%'};return _0x2aaaa4;}})});}_0x41c0e2=_['merge']({},_0x41c0e2,_0x3ef0ba[_0x622f('0x3d')]);var _0x502504={'where':_0x41c0e2['where']};return db[_0x622f('0x3e')][_0x622f('0x1e')](_0x502504)['then'](function(_0x36b15a){_0x428203[_0x622f('0x1e')]=_0x36b15a;if(_0x3ef0ba[_0x622f('0x2f')][_0x622f('0x3f')]){_0x41c0e2['include']=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x41c0e2);})[_0x622f('0x24')](function(_0x5540b0){_0x428203['rows']=_0x5540b0;return _0x428203;})[_0x622f('0x24')](respondWithFilteredResult(_0x399478,_0x41c0e2))[_0x622f('0x40')](handleError(_0x399478,null));};exports[_0x622f('0x41')]=function(_0x286e24,_0x318724){var _0x39b578={'raw':![],'where':{'id':_0x286e24['params']['id']}},_0x2d40af={};_0x2d40af[_0x622f('0x33')]=_[_0x622f('0x30')](db[_0x622f('0x3e')][_0x622f('0x2d')]);_0x2d40af[_0x622f('0x2f')]=_[_0x622f('0x30')](_0x286e24[_0x622f('0x2f')]);_0x2d40af[_0x622f('0x31')]=_[_0x622f('0x42')](_0x2d40af['model'],_0x2d40af[_0x622f('0x2f')]);_0x39b578[_0x622f('0x32')]=_[_0x622f('0x42')](_0x2d40af[_0x622f('0x33')],qs['fields'](_0x286e24['query'][_0x622f('0x34')]));_0x39b578[_0x622f('0x32')]=_0x39b578[_0x622f('0x32')][_0x622f('0x43')]?_0x39b578['attributes']:_0x2d40af[_0x622f('0x33')];if(_0x286e24[_0x622f('0x2f')][_0x622f('0x3f')]){_0x39b578[_0x622f('0x44')]=[{'all':!![]}];}_0x39b578=_['merge']({},_0x39b578,_0x286e24['options']);return db[_0x622f('0x3e')][_0x622f('0x45')](_0x39b578)['then'](handleEntityNotFound(_0x318724,null))[_0x622f('0x24')](respondWithResult(_0x318724,null))[_0x622f('0x40')](handleError(_0x318724,null));};exports[_0x622f('0x46')]=function(_0x4af23e,_0x2980e6){return db[_0x622f('0x3e')]['create'](_0x4af23e[_0x622f('0x47')],{})[_0x622f('0x24')](respondWithResult(_0x2980e6,0xc9))['catch'](handleError(_0x2980e6,null));};exports[_0x622f('0x48')]=function(_0x3a8e5a,_0x10ca4e){if(_0x3a8e5a[_0x622f('0x47')]['id']){delete _0x3a8e5a[_0x622f('0x47')]['id'];}return db[_0x622f('0x3e')][_0x622f('0x45')]({'where':{'id':_0x3a8e5a[_0x622f('0x49')]['id']}})['then'](handleEntityNotFound(_0x10ca4e,null))[_0x622f('0x24')](saveUpdates(_0x3a8e5a[_0x622f('0x47')],null))[_0x622f('0x24')](respondWithResult(_0x10ca4e,null))[_0x622f('0x40')](handleError(_0x10ca4e,null));};exports[_0x622f('0x25')]=function(_0x136f5a,_0x584378){return db['FreshdeskConfiguration'][_0x622f('0x45')]({'where':{'id':_0x136f5a[_0x622f('0x49')]['id']}})[_0x622f('0x24')](handleEntityNotFound(_0x584378,null))[_0x622f('0x24')](removeEntity(_0x584378,null))[_0x622f('0x40')](handleError(_0x584378,null));};exports['getFields']=function(_0x251e48,_0x562caa,_0x1c425f){var _0x4e588c={};var _0x590ab2={};var _0x5ccc30;var _0x4b1ac5;return db[_0x622f('0x3e')][_0x622f('0x4a')]({'where':{'id':_0x251e48['params']['id']}})[_0x622f('0x24')](handleEntityNotFound(_0x562caa,null))['then'](function(_0x3d48f9){if(_0x3d48f9){_0x5ccc30=_0x3d48f9;_0x590ab2[_0x622f('0x33')]=_[_0x622f('0x30')](db[_0x622f('0x4b')][_0x622f('0x2d')]);_0x590ab2[_0x622f('0x2f')]=_['keys'](_0x251e48[_0x622f('0x2f')]);_0x590ab2['filters']=_['intersection'](_0x590ab2['model'],_0x590ab2[_0x622f('0x2f')]);_0x4e588c[_0x622f('0x32')]=_[_0x622f('0x42')](_0x590ab2['model'],qs['fields'](_0x251e48[_0x622f('0x2f')][_0x622f('0x34')]));_0x4e588c['attributes']=_0x4e588c['attributes'][_0x622f('0x43')]?_0x4e588c['attributes']:_0x590ab2['model'];_0x4e588c['order']=qs[_0x622f('0x38')](_0x251e48[_0x622f('0x2f')][_0x622f('0x38')]);_0x4e588c[_0x622f('0x39')]=qs['filters'](_[_0x622f('0x3a')](_0x251e48[_0x622f('0x2f')],_0x590ab2[_0x622f('0x31')]));if(_0x251e48[_0x622f('0x2f')][_0x622f('0x3b')]){_0x4e588c['where']=_['merge'](_0x4e588c['where'],{'$or':_[_0x622f('0x2c')](_0x4e588c['attributes'],function(_0x4a6fc8){var _0x11daa2={};_0x11daa2[_0x4a6fc8]={'$like':'%'+_0x251e48[_0x622f('0x2f')][_0x622f('0x3b')]+'%'};return _0x11daa2;})});}_0x4e588c=_[_0x622f('0x4c')]({},_0x4e588c,_0x251e48['options']);return _0x5ccc30[_0x622f('0x4d')](_0x4e588c);}})[_0x622f('0x24')](function(_0x343b29){if(_0x343b29){_0x4b1ac5=_0x343b29[_0x622f('0x43')];if(!_0x251e48[_0x622f('0x2f')]['hasOwnProperty']('nolimit')){_0x4e588c['limit']=qs[_0x622f('0x1d')](_0x251e48['query'][_0x622f('0x1d')]);_0x4e588c[_0x622f('0x1b')]=qs[_0x622f('0x1b')](_0x251e48[_0x622f('0x2f')]['offset']);}return _0x5ccc30['getFields'](_0x4e588c);}})['then'](function(_0x19cc1a){if(_0x19cc1a){return _0x19cc1a?{'count':_0x4b1ac5,'rows':_0x19cc1a}:null;}})['then'](respondWithResult(_0x562caa,null))['catch'](handleError(_0x562caa,null));};exports[_0x622f('0x4e')]=function(_0x26a88b,_0x40f8dc,_0x39f481){var _0x17bbfe={};var _0x562b5e={};var _0x2f4831;var _0x5632d0;return db[_0x622f('0x3e')][_0x622f('0x4a')]({'where':{'id':_0x26a88b['params']['id']}})['then'](handleEntityNotFound(_0x40f8dc,null))[_0x622f('0x24')](function(_0x8a6860){if(_0x8a6860){_0x2f4831=_0x8a6860;_0x562b5e['model']=_[_0x622f('0x30')](db[_0x622f('0x4b')][_0x622f('0x2d')]);_0x562b5e[_0x622f('0x2f')]=_[_0x622f('0x30')](_0x26a88b['query']);_0x562b5e[_0x622f('0x31')]=_[_0x622f('0x42')](_0x562b5e[_0x622f('0x33')],_0x562b5e[_0x622f('0x2f')]);_0x17bbfe['attributes']=_[_0x622f('0x42')](_0x562b5e[_0x622f('0x33')],qs[_0x622f('0x34')](_0x26a88b[_0x622f('0x2f')]['fields']));_0x17bbfe['attributes']=_0x17bbfe[_0x622f('0x32')][_0x622f('0x43')]?_0x17bbfe['attributes']:_0x562b5e['model'];_0x17bbfe['order']=qs[_0x622f('0x38')](_0x26a88b[_0x622f('0x2f')]['sort']);_0x17bbfe['where']=qs[_0x622f('0x31')](_['pick'](_0x26a88b[_0x622f('0x2f')],_0x562b5e['filters']));if(_0x26a88b[_0x622f('0x2f')][_0x622f('0x3b')]){_0x17bbfe[_0x622f('0x39')]=_['merge'](_0x17bbfe[_0x622f('0x39')],{'$or':_[_0x622f('0x2c')](_0x17bbfe['attributes'],function(_0x475e80){var _0x1769dc={};_0x1769dc[_0x475e80]={'$like':'%'+_0x26a88b[_0x622f('0x2f')][_0x622f('0x3b')]+'%'};return _0x1769dc;})});}_0x17bbfe=_['merge']({},_0x17bbfe,_0x26a88b['options']);return _0x2f4831[_0x622f('0x4e')](_0x17bbfe);}})[_0x622f('0x24')](function(_0x2c108b){if(_0x2c108b){_0x5632d0=_0x2c108b[_0x622f('0x43')];if(!_0x26a88b[_0x622f('0x2f')][_0x622f('0x35')]('nolimit')){_0x17bbfe[_0x622f('0x1d')]=qs['limit'](_0x26a88b[_0x622f('0x2f')][_0x622f('0x1d')]);_0x17bbfe['offset']=qs['offset'](_0x26a88b[_0x622f('0x2f')]['offset']);}return _0x2f4831['getSubjects'](_0x17bbfe);}})[_0x622f('0x24')](function(_0x203cfa){if(_0x203cfa){return _0x203cfa?{'count':_0x5632d0,'rows':_0x203cfa}:null;}})[_0x622f('0x24')](respondWithResult(_0x40f8dc,null))[_0x622f('0x40')](handleError(_0x40f8dc,null));};exports[_0x622f('0x4f')]=function(_0x1dda5e,_0x5092ad,_0x29b545){var _0x1cec2f={};var _0x107d1e={};var _0x428aa0;var _0x22ce39;return db[_0x622f('0x3e')][_0x622f('0x4a')]({'where':{'id':_0x1dda5e[_0x622f('0x49')]['id']}})['then'](handleEntityNotFound(_0x5092ad,null))[_0x622f('0x24')](function(_0x15ab30){if(_0x15ab30){_0x428aa0=_0x15ab30;_0x107d1e[_0x622f('0x33')]=_['keys'](db[_0x622f('0x4b')][_0x622f('0x2d')]);_0x107d1e['query']=_['keys'](_0x1dda5e[_0x622f('0x2f')]);_0x107d1e[_0x622f('0x31')]=_[_0x622f('0x42')](_0x107d1e[_0x622f('0x33')],_0x107d1e[_0x622f('0x2f')]);_0x1cec2f[_0x622f('0x32')]=_[_0x622f('0x42')](_0x107d1e['model'],qs[_0x622f('0x34')](_0x1dda5e[_0x622f('0x2f')][_0x622f('0x34')]));_0x1cec2f[_0x622f('0x32')]=_0x1cec2f[_0x622f('0x32')][_0x622f('0x43')]?_0x1cec2f['attributes']:_0x107d1e[_0x622f('0x33')];_0x1cec2f['order']=qs[_0x622f('0x38')](_0x1dda5e[_0x622f('0x2f')][_0x622f('0x38')]);_0x1cec2f[_0x622f('0x39')]=qs[_0x622f('0x31')](_[_0x622f('0x3a')](_0x1dda5e[_0x622f('0x2f')],_0x107d1e[_0x622f('0x31')]));if(_0x1dda5e['query'][_0x622f('0x3b')]){_0x1cec2f['where']=_['merge'](_0x1cec2f[_0x622f('0x39')],{'$or':_[_0x622f('0x2c')](_0x1cec2f[_0x622f('0x32')],function(_0x32480b){var _0x94a17f={};_0x94a17f[_0x32480b]={'$like':'%'+_0x1dda5e[_0x622f('0x2f')][_0x622f('0x3b')]+'%'};return _0x94a17f;})});}_0x1cec2f=_['merge']({},_0x1cec2f,_0x1dda5e[_0x622f('0x3d')]);return _0x428aa0[_0x622f('0x4f')](_0x1cec2f);}})['then'](function(_0x2f0819){if(_0x2f0819){_0x22ce39=_0x2f0819[_0x622f('0x43')];if(!_0x1dda5e[_0x622f('0x2f')]['hasOwnProperty']('nolimit')){_0x1cec2f[_0x622f('0x1d')]=qs[_0x622f('0x1d')](_0x1dda5e[_0x622f('0x2f')][_0x622f('0x1d')]);_0x1cec2f[_0x622f('0x1b')]=qs['offset'](_0x1dda5e[_0x622f('0x2f')][_0x622f('0x1b')]);}return _0x428aa0[_0x622f('0x4f')](_0x1cec2f);}})[_0x622f('0x24')](function(_0x27050b){if(_0x27050b){return _0x27050b?{'count':_0x22ce39,'rows':_0x27050b}:null;}})[_0x622f('0x24')](respondWithResult(_0x5092ad,null))[_0x622f('0x40')](handleError(_0x5092ad,null));};exports[_0x622f('0x50')]=function(_0x2b035e,_0x2df647,_0x4bec40){var _0x482229={};var _0x348564={};var _0x4b24e5;var _0x6f3a67;return db[_0x622f('0x3e')][_0x622f('0x4a')]({'where':{'id':_0x2b035e[_0x622f('0x49')]['id']}})[_0x622f('0x24')](handleEntityNotFound(_0x2df647,null))[_0x622f('0x24')](function(_0xef79b8){if(_0xef79b8){_0x4b24e5=_0xef79b8;_0x348564['model']=_[_0x622f('0x30')](db[_0x622f('0x51')]['rawAttributes']);_0x348564[_0x622f('0x2f')]=_['keys'](_0x2b035e[_0x622f('0x2f')]);_0x348564[_0x622f('0x31')]=_[_0x622f('0x42')](_0x348564['model'],_0x348564[_0x622f('0x2f')]);_0x482229[_0x622f('0x32')]=_['intersection'](_0x348564[_0x622f('0x33')],qs[_0x622f('0x34')](_0x2b035e[_0x622f('0x2f')][_0x622f('0x34')]));_0x482229[_0x622f('0x32')]=_0x482229['attributes'][_0x622f('0x43')]?_0x482229[_0x622f('0x32')]:_0x348564[_0x622f('0x33')];_0x482229[_0x622f('0x37')]=qs['sort'](_0x2b035e[_0x622f('0x2f')]['sort']);_0x482229[_0x622f('0x39')]=qs[_0x622f('0x31')](_[_0x622f('0x3a')](_0x2b035e[_0x622f('0x2f')],_0x348564[_0x622f('0x31')]));if(_0x2b035e[_0x622f('0x2f')][_0x622f('0x3b')]){_0x482229[_0x622f('0x39')]=_[_0x622f('0x4c')](_0x482229[_0x622f('0x39')],{'$or':_[_0x622f('0x2c')](_0x482229[_0x622f('0x32')],function(_0x29600c){var _0x1410d4={};_0x1410d4[_0x29600c]={'$like':'%'+_0x2b035e['query']['filter']+'%'};return _0x1410d4;})});}_0x482229=_[_0x622f('0x4c')]({},_0x482229,_0x2b035e[_0x622f('0x3d')]);return _0x4b24e5[_0x622f('0x50')](_0x482229);}})[_0x622f('0x24')](function(_0x340bda){if(_0x340bda){_0x6f3a67=_0x340bda[_0x622f('0x43')];if(!_0x2b035e['query'][_0x622f('0x35')](_0x622f('0x36'))){_0x482229['limit']=qs['limit'](_0x2b035e['query'][_0x622f('0x1d')]);_0x482229[_0x622f('0x1b')]=qs[_0x622f('0x1b')](_0x2b035e[_0x622f('0x2f')][_0x622f('0x1b')]);}return _0x4b24e5[_0x622f('0x50')](_0x482229);}})['then'](function(_0x521f7c){if(_0x521f7c){return _0x521f7c?{'count':_0x6f3a67,'rows':_0x521f7c}:null;}})[_0x622f('0x24')](respondWithResult(_0x2df647,null))[_0x622f('0x40')](handleError(_0x2df647,null));};exports[_0x622f('0x52')]=function(_0xd4f894,_0x51e663,_0x1eb70b){if(_0xd4f894[_0x622f('0x47')]['id']){delete _0xd4f894[_0x622f('0x47')]['id'];}return db[_0x622f('0x3e')][_0x622f('0x4a')]({'where':{'id':_0xd4f894['params']['id']}})[_0x622f('0x24')](handleEntityNotFound(_0x51e663,null))['then'](function(_0x5a3443){if(_0x5a3443){return _0x5a3443[_0x622f('0x52')](_0xd4f894[_0x622f('0x47')][_0x622f('0x53')]||[]);}return null;})[_0x622f('0x24')](respondWithResult(_0x51e663,null))[_0x622f('0x40')](handleError(_0x51e663,null));}; \ No newline at end of file +var _0xf671=['error','stack','name','index','map','FreshdeskConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','body','getFields','findOne','FreshdeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','apply','reject','save','update','then','destroy'];(function(_0x499344,_0x44654e){var _0x559fdc=function(_0x72299d){while(--_0x72299d){_0x499344['push'](_0x499344['shift']());}};_0x559fdc(++_0x44654e);}(_0xf671,0x118));var _0x1f67=function(_0x55ee74,_0x487aff){_0x55ee74=_0x55ee74-0x0;var _0x1a70d4=_0xf671[_0x55ee74];return _0x1a70d4;};'use strict';var emlformat=require(_0x1f67('0x0'));var rimraf=require(_0x1f67('0x1'));var zipdir=require(_0x1f67('0x2'));var jsonpatch=require(_0x1f67('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1f67('0x4'));var util=require(_0x1f67('0x5'));var path=require('path');var sox=require(_0x1f67('0x6'));var csv=require(_0x1f67('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f67('0x8'));var squel=require(_0x1f67('0x9'));var crypto=require(_0x1f67('0xa'));var jsforce=require(_0x1f67('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1f67('0x7'));var querystring=require(_0x1f67('0xc'));var Papa=require(_0x1f67('0xd'));var Redis=require(_0x1f67('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1f67('0xf'));var hardwareService=require(_0x1f67('0x10'));var logger=require(_0x1f67('0x11'))(_0x1f67('0x12'));var utils=require(_0x1f67('0x13'));var config=require(_0x1f67('0x14'));var licenseUtil=require(_0x1f67('0x15'));var db=require(_0x1f67('0x16'))['db'];function respondWithStatusCode(_0x7bdbad,_0x86bdfa){_0x86bdfa=_0x86bdfa||0xcc;return function(_0xa71e93){if(_0xa71e93){return _0x7bdbad['sendStatus'](_0x86bdfa);}return _0x7bdbad[_0x1f67('0x17')](_0x86bdfa)[_0x1f67('0x18')]();};}function respondWithResult(_0x2d312b,_0x431211){_0x431211=_0x431211||0xc8;return function(_0x59e08a){if(_0x59e08a){return _0x2d312b['status'](_0x431211)[_0x1f67('0x19')](_0x59e08a);}};}function respondWithFilteredResult(_0x3c1436,_0x230464){return function(_0x598945){if(_0x598945){var _0x152d45=typeof _0x230464['offset']==='undefined'&&typeof _0x230464['limit']===_0x1f67('0x1a');var _0x202d2e=_0x598945[_0x1f67('0x1b')];var _0x587fce=_0x152d45?0x0:_0x230464['offset'];var _0x5824e3=_0x152d45?_0x598945['count']:_0x230464[_0x1f67('0x1c')]+_0x230464[_0x1f67('0x1d')];var _0x46556c;if(_0x5824e3>=_0x202d2e){_0x5824e3=_0x202d2e;_0x46556c=0xc8;}else{_0x46556c=0xce;}_0x3c1436['status'](_0x46556c);return _0x3c1436['set']('Content-Range',_0x587fce+'-'+_0x5824e3+'/'+_0x202d2e)[_0x1f67('0x19')](_0x598945);}return null;};}function patchUpdates(_0x70ff29){return function(_0x1f3279){try{jsonpatch[_0x1f67('0x1e')](_0x1f3279,_0x70ff29,!![]);}catch(_0x700872){return BPromise[_0x1f67('0x1f')](_0x700872);}return _0x1f3279[_0x1f67('0x20')]();};}function saveUpdates(_0x4211b4,_0x53336a){return function(_0x52b521){if(_0x52b521){return _0x52b521[_0x1f67('0x21')](_0x4211b4)[_0x1f67('0x22')](function(_0x5349c9){return _0x5349c9;});}return null;};}function removeEntity(_0x453209,_0x5612aa){return function(_0x14f177){if(_0x14f177){return _0x14f177[_0x1f67('0x23')]()[_0x1f67('0x22')](function(){_0x453209[_0x1f67('0x17')](0xcc)[_0x1f67('0x18')]();});}};}function handleEntityNotFound(_0x40f748,_0x43aed6){return function(_0x1bcc3e){if(!_0x1bcc3e){_0x40f748['sendStatus'](0x194);}return _0x1bcc3e;};}function handleError(_0x2db57f,_0x1fea10){_0x1fea10=_0x1fea10||0x1f4;return function(_0x3511c1){logger[_0x1f67('0x24')](_0x3511c1[_0x1f67('0x25')]);if(_0x3511c1[_0x1f67('0x26')]){delete _0x3511c1[_0x1f67('0x26')];}_0x2db57f[_0x1f67('0x17')](_0x1fea10)['send'](_0x3511c1);};}exports[_0x1f67('0x27')]=function(_0x4e8ea5,_0x4cab3b){var _0x9bc50b={},_0x39d00f={},_0x223eb4={'count':0x0,'rows':[]};var _0x47f702=_[_0x1f67('0x28')](db[_0x1f67('0x29')][_0x1f67('0x2a')],function(_0x1dcc00){return{'name':_0x1dcc00['fieldName'],'type':_0x1dcc00[_0x1f67('0x2b')]['key']};});_0x39d00f[_0x1f67('0x2c')]=_['map'](_0x47f702,'name');_0x39d00f[_0x1f67('0x2d')]=_[_0x1f67('0x2e')](_0x4e8ea5['query']);_0x39d00f[_0x1f67('0x2f')]=_[_0x1f67('0x30')](_0x39d00f[_0x1f67('0x2c')],_0x39d00f[_0x1f67('0x2d')]);_0x9bc50b[_0x1f67('0x31')]=_[_0x1f67('0x30')](_0x39d00f[_0x1f67('0x2c')],qs[_0x1f67('0x32')](_0x4e8ea5[_0x1f67('0x2d')][_0x1f67('0x32')]));_0x9bc50b[_0x1f67('0x31')]=_0x9bc50b[_0x1f67('0x31')]['length']?_0x9bc50b[_0x1f67('0x31')]:_0x39d00f[_0x1f67('0x2c')];if(!_0x4e8ea5[_0x1f67('0x2d')][_0x1f67('0x33')]('nolimit')){_0x9bc50b[_0x1f67('0x1d')]=qs['limit'](_0x4e8ea5[_0x1f67('0x2d')][_0x1f67('0x1d')]);_0x9bc50b[_0x1f67('0x1c')]=qs[_0x1f67('0x1c')](_0x4e8ea5[_0x1f67('0x2d')][_0x1f67('0x1c')]);}_0x9bc50b[_0x1f67('0x34')]=qs[_0x1f67('0x35')](_0x4e8ea5[_0x1f67('0x2d')][_0x1f67('0x35')]);_0x9bc50b[_0x1f67('0x36')]=qs[_0x1f67('0x2f')](_[_0x1f67('0x37')](_0x4e8ea5['query'],_0x39d00f[_0x1f67('0x2f')]),_0x47f702);if(_0x4e8ea5[_0x1f67('0x2d')][_0x1f67('0x38')]){_0x9bc50b['where']=_[_0x1f67('0x39')](_0x9bc50b[_0x1f67('0x36')],{'$or':_[_0x1f67('0x28')](_0x47f702,function(_0x39579d){if(_0x39579d[_0x1f67('0x2b')]!==_0x1f67('0x3a')){var _0x5c966c={};_0x5c966c[_0x39579d[_0x1f67('0x26')]]={'$like':'%'+_0x4e8ea5['query'][_0x1f67('0x38')]+'%'};return _0x5c966c;}})});}_0x9bc50b=_[_0x1f67('0x39')]({},_0x9bc50b,_0x4e8ea5[_0x1f67('0x3b')]);var _0x6e3b24={'where':_0x9bc50b[_0x1f67('0x36')]};return db[_0x1f67('0x29')]['count'](_0x6e3b24)[_0x1f67('0x22')](function(_0x2d8e45){_0x223eb4[_0x1f67('0x1b')]=_0x2d8e45;if(_0x4e8ea5[_0x1f67('0x2d')]['includeAll']){_0x9bc50b[_0x1f67('0x3c')]=[{'all':!![]}];}return db[_0x1f67('0x29')][_0x1f67('0x3d')](_0x9bc50b);})[_0x1f67('0x22')](function(_0x3b0a01){_0x223eb4[_0x1f67('0x3e')]=_0x3b0a01;return _0x223eb4;})[_0x1f67('0x22')](respondWithFilteredResult(_0x4cab3b,_0x9bc50b))[_0x1f67('0x3f')](handleError(_0x4cab3b,null));};exports[_0x1f67('0x40')]=function(_0x4db9f0,_0x199bab){var _0xe1c82b={'raw':![],'where':{'id':_0x4db9f0[_0x1f67('0x41')]['id']}},_0x1b3c7c={};_0x1b3c7c['model']=_['keys'](db[_0x1f67('0x29')]['rawAttributes']);_0x1b3c7c[_0x1f67('0x2d')]=_['keys'](_0x4db9f0['query']);_0x1b3c7c[_0x1f67('0x2f')]=_[_0x1f67('0x30')](_0x1b3c7c[_0x1f67('0x2c')],_0x1b3c7c['query']);_0xe1c82b[_0x1f67('0x31')]=_[_0x1f67('0x30')](_0x1b3c7c[_0x1f67('0x2c')],qs['fields'](_0x4db9f0['query'][_0x1f67('0x32')]));_0xe1c82b[_0x1f67('0x31')]=_0xe1c82b[_0x1f67('0x31')][_0x1f67('0x42')]?_0xe1c82b[_0x1f67('0x31')]:_0x1b3c7c[_0x1f67('0x2c')];if(_0x4db9f0['query']['includeAll']){_0xe1c82b[_0x1f67('0x3c')]=[{'all':!![]}];}_0xe1c82b=_[_0x1f67('0x39')]({},_0xe1c82b,_0x4db9f0['options']);return db['FreshdeskConfiguration'][_0x1f67('0x43')](_0xe1c82b)['then'](handleEntityNotFound(_0x199bab,null))[_0x1f67('0x22')](respondWithResult(_0x199bab,null))[_0x1f67('0x3f')](handleError(_0x199bab,null));};exports[_0x1f67('0x44')]=function(_0x4698b7,_0x4bbc1e){return db['FreshdeskConfiguration'][_0x1f67('0x44')](_0x4698b7[_0x1f67('0x45')],{})[_0x1f67('0x22')](respondWithResult(_0x4bbc1e,0xc9))['catch'](handleError(_0x4bbc1e,null));};exports[_0x1f67('0x21')]=function(_0x51e278,_0x40ee2f){if(_0x51e278[_0x1f67('0x45')]['id']){delete _0x51e278['body']['id'];}return db[_0x1f67('0x29')][_0x1f67('0x43')]({'where':{'id':_0x51e278['params']['id']}})[_0x1f67('0x22')](handleEntityNotFound(_0x40ee2f,null))['then'](saveUpdates(_0x51e278['body'],null))[_0x1f67('0x22')](respondWithResult(_0x40ee2f,null))[_0x1f67('0x3f')](handleError(_0x40ee2f,null));};exports[_0x1f67('0x23')]=function(_0x59e107,_0x17f20b){return db[_0x1f67('0x29')][_0x1f67('0x43')]({'where':{'id':_0x59e107[_0x1f67('0x41')]['id']}})[_0x1f67('0x22')](handleEntityNotFound(_0x17f20b,null))['then'](removeEntity(_0x17f20b,null))[_0x1f67('0x3f')](handleError(_0x17f20b,null));};exports[_0x1f67('0x46')]=function(_0x5b2b45,_0x1d5c2d,_0x283ee9){var _0x41e5bc={};var _0x35b63e={};var _0x14be1b;var _0x3777b4;return db[_0x1f67('0x29')][_0x1f67('0x47')]({'where':{'id':_0x5b2b45['params']['id']}})['then'](handleEntityNotFound(_0x1d5c2d,null))[_0x1f67('0x22')](function(_0x2ae7f6){if(_0x2ae7f6){_0x14be1b=_0x2ae7f6;_0x35b63e[_0x1f67('0x2c')]=_[_0x1f67('0x2e')](db[_0x1f67('0x48')]['rawAttributes']);_0x35b63e['query']=_['keys'](_0x5b2b45['query']);_0x35b63e['filters']=_['intersection'](_0x35b63e['model'],_0x35b63e[_0x1f67('0x2d')]);_0x41e5bc[_0x1f67('0x31')]=_[_0x1f67('0x30')](_0x35b63e[_0x1f67('0x2c')],qs[_0x1f67('0x32')](_0x5b2b45[_0x1f67('0x2d')][_0x1f67('0x32')]));_0x41e5bc[_0x1f67('0x31')]=_0x41e5bc[_0x1f67('0x31')][_0x1f67('0x42')]?_0x41e5bc[_0x1f67('0x31')]:_0x35b63e[_0x1f67('0x2c')];_0x41e5bc['order']=qs['sort'](_0x5b2b45['query'][_0x1f67('0x35')]);_0x41e5bc['where']=qs[_0x1f67('0x2f')](_['pick'](_0x5b2b45['query'],_0x35b63e[_0x1f67('0x2f')]));if(_0x5b2b45[_0x1f67('0x2d')][_0x1f67('0x38')]){_0x41e5bc[_0x1f67('0x36')]=_[_0x1f67('0x39')](_0x41e5bc[_0x1f67('0x36')],{'$or':_['map'](_0x41e5bc[_0x1f67('0x31')],function(_0x277b90){var _0x12d855={};_0x12d855[_0x277b90]={'$like':'%'+_0x5b2b45[_0x1f67('0x2d')][_0x1f67('0x38')]+'%'};return _0x12d855;})});}_0x41e5bc=_[_0x1f67('0x39')]({},_0x41e5bc,_0x5b2b45['options']);return _0x14be1b['getFields'](_0x41e5bc);}})[_0x1f67('0x22')](function(_0xdc1274){if(_0xdc1274){_0x3777b4=_0xdc1274[_0x1f67('0x42')];if(!_0x5b2b45[_0x1f67('0x2d')][_0x1f67('0x33')](_0x1f67('0x49'))){_0x41e5bc[_0x1f67('0x1d')]=qs[_0x1f67('0x1d')](_0x5b2b45[_0x1f67('0x2d')]['limit']);_0x41e5bc[_0x1f67('0x1c')]=qs[_0x1f67('0x1c')](_0x5b2b45[_0x1f67('0x2d')]['offset']);}return _0x14be1b[_0x1f67('0x46')](_0x41e5bc);}})[_0x1f67('0x22')](function(_0x5e85be){if(_0x5e85be){return _0x5e85be?{'count':_0x3777b4,'rows':_0x5e85be}:null;}})[_0x1f67('0x22')](respondWithResult(_0x1d5c2d,null))[_0x1f67('0x3f')](handleError(_0x1d5c2d,null));};exports['getSubjects']=function(_0x45aef3,_0x150249,_0x4c3bb0){var _0x384f0d={};var _0x933da0={};var _0x4ac781;var _0x1a9415;return db[_0x1f67('0x29')][_0x1f67('0x47')]({'where':{'id':_0x45aef3['params']['id']}})[_0x1f67('0x22')](handleEntityNotFound(_0x150249,null))[_0x1f67('0x22')](function(_0x3a030b){if(_0x3a030b){_0x4ac781=_0x3a030b;_0x933da0[_0x1f67('0x2c')]=_[_0x1f67('0x2e')](db['FreshdeskField']['rawAttributes']);_0x933da0['query']=_[_0x1f67('0x2e')](_0x45aef3[_0x1f67('0x2d')]);_0x933da0[_0x1f67('0x2f')]=_[_0x1f67('0x30')](_0x933da0[_0x1f67('0x2c')],_0x933da0[_0x1f67('0x2d')]);_0x384f0d[_0x1f67('0x31')]=_[_0x1f67('0x30')](_0x933da0[_0x1f67('0x2c')],qs[_0x1f67('0x32')](_0x45aef3[_0x1f67('0x2d')][_0x1f67('0x32')]));_0x384f0d['attributes']=_0x384f0d['attributes']['length']?_0x384f0d[_0x1f67('0x31')]:_0x933da0['model'];_0x384f0d[_0x1f67('0x34')]=qs[_0x1f67('0x35')](_0x45aef3['query']['sort']);_0x384f0d[_0x1f67('0x36')]=qs[_0x1f67('0x2f')](_[_0x1f67('0x37')](_0x45aef3[_0x1f67('0x2d')],_0x933da0['filters']));if(_0x45aef3[_0x1f67('0x2d')]['filter']){_0x384f0d['where']=_[_0x1f67('0x39')](_0x384f0d[_0x1f67('0x36')],{'$or':_[_0x1f67('0x28')](_0x384f0d['attributes'],function(_0x3b1077){var _0x5db688={};_0x5db688[_0x3b1077]={'$like':'%'+_0x45aef3[_0x1f67('0x2d')][_0x1f67('0x38')]+'%'};return _0x5db688;})});}_0x384f0d=_[_0x1f67('0x39')]({},_0x384f0d,_0x45aef3['options']);return _0x4ac781[_0x1f67('0x4a')](_0x384f0d);}})[_0x1f67('0x22')](function(_0x4d2ef8){if(_0x4d2ef8){_0x1a9415=_0x4d2ef8[_0x1f67('0x42')];if(!_0x45aef3['query'][_0x1f67('0x33')](_0x1f67('0x49'))){_0x384f0d[_0x1f67('0x1d')]=qs[_0x1f67('0x1d')](_0x45aef3[_0x1f67('0x2d')]['limit']);_0x384f0d[_0x1f67('0x1c')]=qs['offset'](_0x45aef3[_0x1f67('0x2d')][_0x1f67('0x1c')]);}return _0x4ac781[_0x1f67('0x4a')](_0x384f0d);}})['then'](function(_0x4530b2){if(_0x4530b2){return _0x4530b2?{'count':_0x1a9415,'rows':_0x4530b2}:null;}})[_0x1f67('0x22')](respondWithResult(_0x150249,null))[_0x1f67('0x3f')](handleError(_0x150249,null));};exports[_0x1f67('0x4b')]=function(_0x25cda3,_0x5f0f1c,_0x108d20){var _0x283dd4={};var _0x5f1294={};var _0x18d9c5;var _0x101e00;return db[_0x1f67('0x29')][_0x1f67('0x47')]({'where':{'id':_0x25cda3[_0x1f67('0x41')]['id']}})[_0x1f67('0x22')](handleEntityNotFound(_0x5f0f1c,null))[_0x1f67('0x22')](function(_0x8af54){if(_0x8af54){_0x18d9c5=_0x8af54;_0x5f1294[_0x1f67('0x2c')]=_[_0x1f67('0x2e')](db[_0x1f67('0x48')]['rawAttributes']);_0x5f1294[_0x1f67('0x2d')]=_['keys'](_0x25cda3['query']);_0x5f1294['filters']=_['intersection'](_0x5f1294['model'],_0x5f1294[_0x1f67('0x2d')]);_0x283dd4['attributes']=_[_0x1f67('0x30')](_0x5f1294['model'],qs[_0x1f67('0x32')](_0x25cda3['query'][_0x1f67('0x32')]));_0x283dd4[_0x1f67('0x31')]=_0x283dd4[_0x1f67('0x31')][_0x1f67('0x42')]?_0x283dd4['attributes']:_0x5f1294[_0x1f67('0x2c')];_0x283dd4[_0x1f67('0x34')]=qs[_0x1f67('0x35')](_0x25cda3[_0x1f67('0x2d')][_0x1f67('0x35')]);_0x283dd4[_0x1f67('0x36')]=qs['filters'](_[_0x1f67('0x37')](_0x25cda3[_0x1f67('0x2d')],_0x5f1294['filters']));if(_0x25cda3['query']['filter']){_0x283dd4[_0x1f67('0x36')]=_[_0x1f67('0x39')](_0x283dd4[_0x1f67('0x36')],{'$or':_[_0x1f67('0x28')](_0x283dd4[_0x1f67('0x31')],function(_0x3e65de){var _0x420364={};_0x420364[_0x3e65de]={'$like':'%'+_0x25cda3[_0x1f67('0x2d')]['filter']+'%'};return _0x420364;})});}_0x283dd4=_['merge']({},_0x283dd4,_0x25cda3['options']);return _0x18d9c5[_0x1f67('0x4b')](_0x283dd4);}})[_0x1f67('0x22')](function(_0x474d7d){if(_0x474d7d){_0x101e00=_0x474d7d[_0x1f67('0x42')];if(!_0x25cda3[_0x1f67('0x2d')][_0x1f67('0x33')](_0x1f67('0x49'))){_0x283dd4[_0x1f67('0x1d')]=qs[_0x1f67('0x1d')](_0x25cda3[_0x1f67('0x2d')][_0x1f67('0x1d')]);_0x283dd4[_0x1f67('0x1c')]=qs[_0x1f67('0x1c')](_0x25cda3[_0x1f67('0x2d')][_0x1f67('0x1c')]);}return _0x18d9c5[_0x1f67('0x4b')](_0x283dd4);}})[_0x1f67('0x22')](function(_0x1f00fa){if(_0x1f00fa){return _0x1f00fa?{'count':_0x101e00,'rows':_0x1f00fa}:null;}})[_0x1f67('0x22')](respondWithResult(_0x5f0f1c,null))['catch'](handleError(_0x5f0f1c,null));};exports[_0x1f67('0x4c')]=function(_0x34dc8d,_0x38446f,_0x140939){var _0x33bd2e={};var _0x4368dc={};var _0x277e91;var _0x5df314;return db['FreshdeskConfiguration'][_0x1f67('0x47')]({'where':{'id':_0x34dc8d[_0x1f67('0x41')]['id']}})[_0x1f67('0x22')](handleEntityNotFound(_0x38446f,null))['then'](function(_0x5a2317){if(_0x5a2317){_0x277e91=_0x5a2317;_0x4368dc['model']=_[_0x1f67('0x2e')](db[_0x1f67('0x4d')][_0x1f67('0x2a')]);_0x4368dc['query']=_[_0x1f67('0x2e')](_0x34dc8d[_0x1f67('0x2d')]);_0x4368dc['filters']=_['intersection'](_0x4368dc[_0x1f67('0x2c')],_0x4368dc[_0x1f67('0x2d')]);_0x33bd2e['attributes']=_[_0x1f67('0x30')](_0x4368dc[_0x1f67('0x2c')],qs['fields'](_0x34dc8d[_0x1f67('0x2d')][_0x1f67('0x32')]));_0x33bd2e[_0x1f67('0x31')]=_0x33bd2e[_0x1f67('0x31')][_0x1f67('0x42')]?_0x33bd2e[_0x1f67('0x31')]:_0x4368dc[_0x1f67('0x2c')];_0x33bd2e['order']=qs['sort'](_0x34dc8d['query'][_0x1f67('0x35')]);_0x33bd2e[_0x1f67('0x36')]=qs[_0x1f67('0x2f')](_[_0x1f67('0x37')](_0x34dc8d['query'],_0x4368dc[_0x1f67('0x2f')]));if(_0x34dc8d['query'][_0x1f67('0x38')]){_0x33bd2e[_0x1f67('0x36')]=_[_0x1f67('0x39')](_0x33bd2e['where'],{'$or':_[_0x1f67('0x28')](_0x33bd2e[_0x1f67('0x31')],function(_0x723917){var _0x3c79b4={};_0x3c79b4[_0x723917]={'$like':'%'+_0x34dc8d[_0x1f67('0x2d')]['filter']+'%'};return _0x3c79b4;})});}_0x33bd2e=_[_0x1f67('0x39')]({},_0x33bd2e,_0x34dc8d['options']);return _0x277e91['getTags'](_0x33bd2e);}})[_0x1f67('0x22')](function(_0x4b37a4){if(_0x4b37a4){_0x5df314=_0x4b37a4[_0x1f67('0x42')];if(!_0x34dc8d[_0x1f67('0x2d')][_0x1f67('0x33')](_0x1f67('0x49'))){_0x33bd2e[_0x1f67('0x1d')]=qs[_0x1f67('0x1d')](_0x34dc8d[_0x1f67('0x2d')][_0x1f67('0x1d')]);_0x33bd2e[_0x1f67('0x1c')]=qs[_0x1f67('0x1c')](_0x34dc8d[_0x1f67('0x2d')][_0x1f67('0x1c')]);}return _0x277e91[_0x1f67('0x4c')](_0x33bd2e);}})['then'](function(_0x37b5b1){if(_0x37b5b1){return _0x37b5b1?{'count':_0x5df314,'rows':_0x37b5b1}:null;}})['then'](respondWithResult(_0x38446f,null))[_0x1f67('0x3f')](handleError(_0x38446f,null));};exports[_0x1f67('0x4e')]=function(_0x3bfedb,_0x3bb857,_0xa0fbfb){if(_0x3bfedb[_0x1f67('0x45')]['id']){delete _0x3bfedb[_0x1f67('0x45')]['id'];}return db[_0x1f67('0x29')]['findOne']({'where':{'id':_0x3bfedb[_0x1f67('0x41')]['id']}})[_0x1f67('0x22')](handleEntityNotFound(_0x3bb857,null))[_0x1f67('0x22')](function(_0x54fe53){if(_0x54fe53){return _0x54fe53[_0x1f67('0x4e')](_0x3bfedb[_0x1f67('0x45')]['ids']||[]);}return null;})[_0x1f67('0x22')](respondWithResult(_0x3bb857,null))[_0x1f67('0x3f')](handleError(_0x3bb857,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 9a0f9ea..c60a2de 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 _0x6d7c=['int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6d7c,0xf1));var _0xc6d7=function(_0x4bed59,_0x295982){_0x4bed59=_0x4bed59-0x0;var _0x48846e=_0x6d7c[_0x4bed59];return _0x48846e;};'use strict';var _=require(_0xc6d7('0x0'));var util=require(_0xc6d7('0x1'));var logger=require(_0xc6d7('0x2'))(_0xc6d7('0x3'));var moment=require(_0xc6d7('0x4'));var BPromise=require('bluebird');var rp=require(_0xc6d7('0x5'));var fs=require('fs');var path=require(_0xc6d7('0x6'));var rimraf=require('rimraf');var config=require(_0xc6d7('0x7'));var attributes=require(_0xc6d7('0x8'));module[_0xc6d7('0x9')]=function(_0x36e954,_0x4cf10d){return _0x36e954['define'](_0xc6d7('0xa'),attributes,{'tableName':_0xc6d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfff0=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5e4f85,_0x49cbb1){var _0x130195=function(_0x20b34){while(--_0x20b34){_0x5e4f85['push'](_0x5e4f85['shift']());}};_0x130195(++_0x49cbb1);}(_0xfff0,0x192));var _0x0fff=function(_0x407b41,_0x55e601){_0x407b41=_0x407b41-0x0;var _0x2eaf78=_0xfff0[_0x407b41];return _0x2eaf78;};'use strict';var _=require(_0x0fff('0x0'));var util=require(_0x0fff('0x1'));var logger=require(_0x0fff('0x2'))('api');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var rp=require(_0x0fff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x37490c,_0x101c14){return _0x37490c['define'](_0x0fff('0x8'),attributes,{'tableName':_0x0fff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 2a5462b..7556041 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 _0x8c7f=['result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x49349b,_0xe98d29){var _0x1368c9=function(_0x121a6c){while(--_0x121a6c){_0x49349b['push'](_0x49349b['shift']());}};_0x1368c9(++_0xe98d29);}(_0x8c7f,0x1a0));var _0xf8c7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8c7f[_0x432682];return _0x463d05;};'use strict';var _=require(_0xf8c7('0x0'));var util=require(_0xf8c7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf8c7('0x2'));var fs=require('fs');var Redis=require(_0xf8c7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8c7('0x4'));var logger=require(_0xf8c7('0x5'))(_0xf8c7('0x6'));var config=require(_0xf8c7('0x7'));var jayson=require(_0xf8c7('0x8'));var client=jayson[_0xf8c7('0x9')][_0xf8c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f55d8,_0x45fda4,_0x2cb240){return new BPromise(function(_0x49256c,_0x4c4cc1){return client[_0xf8c7('0xb')](_0x4f55d8,_0x2cb240)[_0xf8c7('0xc')](function(_0x9158ca){logger[_0xf8c7('0xd')](_0xf8c7('0xe'),_0x45fda4,_0xf8c7('0xf'));logger[_0xf8c7('0x10')](_0xf8c7('0x11'),_0x45fda4,_0xf8c7('0xf'),JSON['stringify'](_0x9158ca));if(_0x9158ca[_0xf8c7('0x12')]){if(_0x9158ca[_0xf8c7('0x12')][_0xf8c7('0x13')]===0x1f4){logger[_0xf8c7('0x12')](_0xf8c7('0xe'),_0x45fda4,_0x9158ca[_0xf8c7('0x12')][_0xf8c7('0x14')]);return _0x4c4cc1(_0x9158ca['error'][_0xf8c7('0x14')]);}logger[_0xf8c7('0x12')](_0xf8c7('0xe'),_0x45fda4,_0x9158ca['error'][_0xf8c7('0x14')]);return _0x49256c(_0x9158ca['error'][_0xf8c7('0x14')]);}else{logger[_0xf8c7('0xd')](_0xf8c7('0xe'),_0x45fda4,_0xf8c7('0xf'));_0x49256c(_0x9158ca[_0xf8c7('0x15')][_0xf8c7('0x14')]);}})[_0xf8c7('0x16')](function(_0x1db80b){logger['error'](_0xf8c7('0xe'),_0x45fda4,_0x1db80b);_0x4c4cc1(_0x1db80b);});});} \ No newline at end of file +var _0xb511=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','util','bluebird','randomstring','ioredis'];(function(_0x58ea14,_0x5530d3){var _0x5dc1a9=function(_0x20ce5d){while(--_0x20ce5d){_0x58ea14['push'](_0x58ea14['shift']());}};_0x5dc1a9(++_0x5530d3);}(_0xb511,0x176));var _0x1b51=function(_0x18099a,_0x3ae9c2){_0x18099a=_0x18099a-0x0;var _0x5a53cd=_0xb511[_0x18099a];return _0x5a53cd;};'use strict';var _=require('lodash');var util=require(_0x1b51('0x0'));var moment=require('moment');var BPromise=require(_0x1b51('0x1'));var rs=require(_0x1b51('0x2'));var fs=require('fs');var Redis=require(_0x1b51('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b51('0x4'));var logger=require(_0x1b51('0x5'))(_0x1b51('0x6'));var config=require(_0x1b51('0x7'));var jayson=require(_0x1b51('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14b2e1,_0x3a79d7,_0x594ba7){return new BPromise(function(_0x55c9a0,_0x31cecf){return client[_0x1b51('0x9')](_0x14b2e1,_0x594ba7)[_0x1b51('0xa')](function(_0x10757f){logger[_0x1b51('0xb')](_0x1b51('0xc'),_0x3a79d7,'request\x20sent');logger[_0x1b51('0xd')](_0x1b51('0xe'),_0x3a79d7,'request\x20sent',JSON[_0x1b51('0xf')](_0x10757f));if(_0x10757f[_0x1b51('0x10')]){if(_0x10757f[_0x1b51('0x10')][_0x1b51('0x11')]===0x1f4){logger['error'](_0x1b51('0xc'),_0x3a79d7,_0x10757f['error']['message']);return _0x31cecf(_0x10757f[_0x1b51('0x10')][_0x1b51('0x12')]);}logger[_0x1b51('0x10')](_0x1b51('0xc'),_0x3a79d7,_0x10757f[_0x1b51('0x10')][_0x1b51('0x12')]);return _0x55c9a0(_0x10757f[_0x1b51('0x10')][_0x1b51('0x12')]);}else{logger[_0x1b51('0xb')](_0x1b51('0xc'),_0x3a79d7,_0x1b51('0x13'));_0x55c9a0(_0x10757f['result'][_0x1b51('0x12')]);}})[_0x1b51('0x14')](function(_0x430f48){logger[_0x1b51('0x10')](_0x1b51('0xc'),_0x3a79d7,_0x430f48);_0x31cecf(_0x430f48);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 63ce23a..d125b82 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 _0xe7c1=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','delete','destroy'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xe7c1,0x132));var _0x1e7c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe7c1[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x1e7c('0x0'));var util=require(_0x1e7c('0x1'));var path=require(_0x1e7c('0x2'));var timeout=require('connect-timeout');var express=require(_0x1e7c('0x3'));var router=express[_0x1e7c('0x4')]();var fs_extra=require(_0x1e7c('0x5'));var auth=require(_0x1e7c('0x6'));var interaction=require(_0x1e7c('0x7'));var config=require(_0x1e7c('0x8'));var controller=require('./intFreshdeskField.controller');router[_0x1e7c('0x9')]('/',auth['isAuthenticated'](),controller[_0x1e7c('0xa')]);router[_0x1e7c('0x9')](_0x1e7c('0xb'),auth[_0x1e7c('0xc')](),controller[_0x1e7c('0xd')]);router[_0x1e7c('0xe')]('/',auth[_0x1e7c('0xc')](),controller['create']);router[_0x1e7c('0xf')](_0x1e7c('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1e7c('0x10')](_0x1e7c('0xb'),auth[_0x1e7c('0xc')](),controller[_0x1e7c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1060=['show','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x17cdcc,_0x29d5de){var _0x38f5f6=function(_0x55f444){while(--_0x55f444){_0x17cdcc['push'](_0x17cdcc['shift']());}};_0x38f5f6(++_0x29d5de);}(_0x1060,0x181));var _0x0106=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x1060[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require('multer');var util=require(_0x0106('0x0'));var path=require(_0x0106('0x1'));var timeout=require(_0x0106('0x2'));var express=require('express');var router=express[_0x0106('0x3')]();var fs_extra=require(_0x0106('0x4'));var auth=require(_0x0106('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0106('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x0106('0x7')]('/',auth[_0x0106('0x8')](),controller[_0x0106('0x9')]);router[_0x0106('0x7')](_0x0106('0xa'),auth[_0x0106('0x8')](),controller[_0x0106('0xb')]);router['post']('/',auth[_0x0106('0x8')](),controller[_0x0106('0xc')]);router[_0x0106('0xd')](_0x0106('0xa'),auth[_0x0106('0x8')](),controller[_0x0106('0xe')]);router[_0x0106('0xf')]('/:id',auth[_0x0106('0x8')](),controller[_0x0106('0x10')]);module[_0x0106('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 9f780b2..645882f 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 _0x0d4b=['sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0xaeff8a,_0x506724){var _0x8a6ce3=function(_0x237855){while(--_0x237855){_0xaeff8a['push'](_0xaeff8a['shift']());}};_0x8a6ce3(++_0x506724);}(_0x0d4b,0x64));var _0xb0d4=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x0d4b[_0xd1d19a];return _0x52a79d;};'use strict';var Sequelize=require(_0xb0d4('0x0'));module[_0xb0d4('0x1')]={'type':{'type':Sequelize[_0xb0d4('0x2')](_0xb0d4('0x3'),_0xb0d4('0x4'),'customVariable',_0xb0d4('0x5'),_0xb0d4('0x6')),'defaultValue':_0xb0d4('0x3')},'content':{'type':Sequelize[_0xb0d4('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb0d4('0x2')](_0xb0d4('0x3'),_0xb0d4('0x4'),_0xb0d4('0x8'))},'keyContent':{'type':Sequelize[_0xb0d4('0x7')]},'idField':{'type':Sequelize[_0xb0d4('0x7')]},'nameField':{'type':Sequelize[_0xb0d4('0x7')]},'customField':{'type':Sequelize[_0xb0d4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb0d4('0x7')]}}; \ No newline at end of file +var _0x45cc=['string','customVariable','keyValue','picklist','STRING','variable','sequelize','exports','ENUM'];(function(_0x1b7b7e,_0x416817){var _0x233a00=function(_0x7a85d8){while(--_0x7a85d8){_0x1b7b7e['push'](_0x1b7b7e['shift']());}};_0x233a00(++_0x416817);}(_0x45cc,0x189));var _0xc45c=function(_0x4a9b0e,_0x13ae85){_0x4a9b0e=_0x4a9b0e-0x0;var _0x4e83a9=_0x45cc[_0x4a9b0e];return _0x4e83a9;};'use strict';var Sequelize=require(_0xc45c('0x0'));module[_0xc45c('0x1')]={'type':{'type':Sequelize[_0xc45c('0x2')](_0xc45c('0x3'),'variable',_0xc45c('0x4'),_0xc45c('0x5'),_0xc45c('0x6')),'defaultValue':_0xc45c('0x3')},'content':{'type':Sequelize[_0xc45c('0x7')]},'key':{'type':Sequelize[_0xc45c('0x7')]},'keyType':{'type':Sequelize[_0xc45c('0x2')](_0xc45c('0x3'),_0xc45c('0x8'),_0xc45c('0x4'))},'keyContent':{'type':Sequelize[_0xc45c('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc45c('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 68939fb..02ae6b7 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 _0x9d9b=['reject','save','update','then','destroy','error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','json','apply'];(function(_0x30acab,_0x548a9c){var _0x145ce4=function(_0x3c7fa3){while(--_0x3c7fa3){_0x30acab['push'](_0x30acab['shift']());}};_0x145ce4(++_0x548a9c);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x120177,_0x2775ea){_0x120177=_0x120177-0x0;var _0x309cfa=_0x9d9b[_0x120177];return _0x309cfa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9d9('0x0'));var zipdir=require(_0xb9d9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9d9('0x2'));var moment=require('moment');var BPromise=require(_0xb9d9('0x3'));var Mustache=require(_0xb9d9('0x4'));var util=require(_0xb9d9('0x5'));var path=require('path');var sox=require(_0xb9d9('0x6'));var csv=require('to-csv');var ejs=require(_0xb9d9('0x7'));var fs=require('fs');var fs_extra=require(_0xb9d9('0x8'));var _=require('lodash');var squel=require(_0xb9d9('0x9'));var crypto=require(_0xb9d9('0xa'));var jsforce=require(_0xb9d9('0xb'));var deskjs=require(_0xb9d9('0xc'));var toCsv=require(_0xb9d9('0xd'));var querystring=require(_0xb9d9('0xe'));var Papa=require(_0xb9d9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9d9('0x10'));var logger=require(_0xb9d9('0x11'))(_0xb9d9('0x12'));var utils=require('../../config/utils');var config=require(_0xb9d9('0x13'));var licenseUtil=require(_0xb9d9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cc03d,_0x5e3782){_0x5e3782=_0x5e3782||0xcc;return function(_0x1245e0){if(_0x1245e0){return _0x3cc03d[_0xb9d9('0x15')](_0x5e3782);}return _0x3cc03d[_0xb9d9('0x16')](_0x5e3782)[_0xb9d9('0x17')]();};}function respondWithResult(_0x26ef71,_0x1d26cf){_0x1d26cf=_0x1d26cf||0xc8;return function(_0x4f0c77){if(_0x4f0c77){return _0x26ef71[_0xb9d9('0x16')](_0x1d26cf)['json'](_0x4f0c77);}};}function respondWithFilteredResult(_0x4c8864,_0x3db648){return function(_0x2c9039){if(_0x2c9039){var _0x3909ab=typeof _0x3db648[_0xb9d9('0x18')]==='undefined'&&typeof _0x3db648['limit']===_0xb9d9('0x19');var _0x5617f1=_0x2c9039['count'];var _0x2b5e26=_0x3909ab?0x0:_0x3db648[_0xb9d9('0x18')];var _0x1e775d=_0x3909ab?_0x2c9039['count']:_0x3db648[_0xb9d9('0x18')]+_0x3db648[_0xb9d9('0x1a')];var _0x493552;if(_0x1e775d>=_0x5617f1){_0x1e775d=_0x5617f1;_0x493552=0xc8;}else{_0x493552=0xce;}_0x4c8864[_0xb9d9('0x16')](_0x493552);return _0x4c8864[_0xb9d9('0x1b')]('Content-Range',_0x2b5e26+'-'+_0x1e775d+'/'+_0x5617f1)[_0xb9d9('0x1c')](_0x2c9039);}return null;};}function patchUpdates(_0x36d55e){return function(_0x50f0ec){try{jsonpatch[_0xb9d9('0x1d')](_0x50f0ec,_0x36d55e,!![]);}catch(_0x42ca87){return BPromise[_0xb9d9('0x1e')](_0x42ca87);}return _0x50f0ec[_0xb9d9('0x1f')]();};}function saveUpdates(_0x288ccd,_0x362104){return function(_0x4c4230){if(_0x4c4230){return _0x4c4230[_0xb9d9('0x20')](_0x288ccd)[_0xb9d9('0x21')](function(_0x53c82a){return _0x53c82a;});}return null;};}function removeEntity(_0x45520b,_0x3d61bf){return function(_0x43bcab){if(_0x43bcab){return _0x43bcab[_0xb9d9('0x22')]()['then'](function(){_0x45520b[_0xb9d9('0x16')](0xcc)[_0xb9d9('0x17')]();});}};}function handleEntityNotFound(_0x6fa6af,_0x436cb7){return function(_0x2650f7){if(!_0x2650f7){_0x6fa6af[_0xb9d9('0x15')](0x194);}return _0x2650f7;};}function handleError(_0x56b394,_0x321937){_0x321937=_0x321937||0x1f4;return function(_0x42181d){logger[_0xb9d9('0x23')](_0x42181d['stack']);if(_0x42181d[_0xb9d9('0x24')]){delete _0x42181d[_0xb9d9('0x24')];}_0x56b394[_0xb9d9('0x16')](_0x321937)[_0xb9d9('0x25')](_0x42181d);};}exports[_0xb9d9('0x26')]=function(_0x402968,_0x89f901){var _0x5c74eb={},_0x39f006={},_0x3e79ef={'count':0x0,'rows':[]};var _0xdf519a=_[_0xb9d9('0x27')](db[_0xb9d9('0x28')][_0xb9d9('0x29')],function(_0x5dbb27){return{'name':_0x5dbb27[_0xb9d9('0x2a')],'type':_0x5dbb27[_0xb9d9('0x2b')][_0xb9d9('0x2c')]};});_0x39f006[_0xb9d9('0x2d')]=_['map'](_0xdf519a,_0xb9d9('0x24'));_0x39f006[_0xb9d9('0x2e')]=_[_0xb9d9('0x2f')](_0x402968[_0xb9d9('0x2e')]);_0x39f006[_0xb9d9('0x30')]=_[_0xb9d9('0x31')](_0x39f006['model'],_0x39f006['query']);_0x5c74eb[_0xb9d9('0x32')]=_['intersection'](_0x39f006[_0xb9d9('0x2d')],qs[_0xb9d9('0x33')](_0x402968[_0xb9d9('0x2e')]['fields']));_0x5c74eb[_0xb9d9('0x32')]=_0x5c74eb[_0xb9d9('0x32')][_0xb9d9('0x34')]?_0x5c74eb[_0xb9d9('0x32')]:_0x39f006[_0xb9d9('0x2d')];if(!_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x35')](_0xb9d9('0x36'))){_0x5c74eb[_0xb9d9('0x1a')]=qs['limit'](_0x402968['query']['limit']);_0x5c74eb[_0xb9d9('0x18')]=qs[_0xb9d9('0x18')](_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x18')]);}_0x5c74eb[_0xb9d9('0x37')]=qs[_0xb9d9('0x38')](_0x402968['query']['sort']);_0x5c74eb['where']=qs[_0xb9d9('0x30')](_[_0xb9d9('0x39')](_0x402968[_0xb9d9('0x2e')],_0x39f006[_0xb9d9('0x30')]),_0xdf519a);if(_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x3a')]){_0x5c74eb[_0xb9d9('0x3b')]=_[_0xb9d9('0x3c')](_0x5c74eb[_0xb9d9('0x3b')],{'$or':_[_0xb9d9('0x27')](_0xdf519a,function(_0xd8b9a2){if(_0xd8b9a2[_0xb9d9('0x2b')]!==_0xb9d9('0x3d')){var _0x46d9a7={};_0x46d9a7[_0xd8b9a2[_0xb9d9('0x24')]]={'$like':'%'+_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x3a')]+'%'};return _0x46d9a7;}})});}_0x5c74eb=_[_0xb9d9('0x3c')]({},_0x5c74eb,_0x402968[_0xb9d9('0x3e')]);var _0x4d3cea={'where':_0x5c74eb[_0xb9d9('0x3b')]};return db[_0xb9d9('0x28')]['count'](_0x4d3cea)['then'](function(_0x41cf93){_0x3e79ef['count']=_0x41cf93;if(_0x402968[_0xb9d9('0x2e')]['includeAll']){_0x5c74eb['include']=[{'all':!![]}];}return db[_0xb9d9('0x28')][_0xb9d9('0x3f')](_0x5c74eb);})[_0xb9d9('0x21')](function(_0x2acfe8){_0x3e79ef[_0xb9d9('0x40')]=_0x2acfe8;return _0x3e79ef;})[_0xb9d9('0x21')](respondWithFilteredResult(_0x89f901,_0x5c74eb))[_0xb9d9('0x41')](handleError(_0x89f901,null));};exports[_0xb9d9('0x42')]=function(_0x596cd8,_0x55007a){var _0x3f4b76={'raw':!![],'where':{'id':_0x596cd8[_0xb9d9('0x43')]['id']}},_0xb7c4ec={};_0xb7c4ec['model']=_[_0xb9d9('0x2f')](db[_0xb9d9('0x28')][_0xb9d9('0x29')]);_0xb7c4ec[_0xb9d9('0x2e')]=_[_0xb9d9('0x2f')](_0x596cd8[_0xb9d9('0x2e')]);_0xb7c4ec[_0xb9d9('0x30')]=_[_0xb9d9('0x31')](_0xb7c4ec['model'],_0xb7c4ec[_0xb9d9('0x2e')]);_0x3f4b76[_0xb9d9('0x32')]=_[_0xb9d9('0x31')](_0xb7c4ec[_0xb9d9('0x2d')],qs[_0xb9d9('0x33')](_0x596cd8[_0xb9d9('0x2e')][_0xb9d9('0x33')]));_0x3f4b76[_0xb9d9('0x32')]=_0x3f4b76[_0xb9d9('0x32')][_0xb9d9('0x34')]?_0x3f4b76[_0xb9d9('0x32')]:_0xb7c4ec[_0xb9d9('0x2d')];if(_0x596cd8[_0xb9d9('0x2e')][_0xb9d9('0x44')]){_0x3f4b76[_0xb9d9('0x45')]=[{'all':!![]}];}_0x3f4b76=_[_0xb9d9('0x3c')]({},_0x3f4b76,_0x596cd8[_0xb9d9('0x3e')]);return db['FreshdeskField'][_0xb9d9('0x46')](_0x3f4b76)[_0xb9d9('0x21')](handleEntityNotFound(_0x55007a,null))['then'](respondWithResult(_0x55007a,null))[_0xb9d9('0x41')](handleError(_0x55007a,null));};exports[_0xb9d9('0x47')]=function(_0x1a4922,_0xa6ce10){return db[_0xb9d9('0x28')][_0xb9d9('0x47')](_0x1a4922['body'],{})[_0xb9d9('0x21')](respondWithResult(_0xa6ce10,0xc9))[_0xb9d9('0x41')](handleError(_0xa6ce10,null));};exports[_0xb9d9('0x20')]=function(_0x30e3b1,_0x53f7cb){if(_0x30e3b1[_0xb9d9('0x48')]['id']){delete _0x30e3b1[_0xb9d9('0x48')]['id'];}return db[_0xb9d9('0x28')]['find']({'where':{'id':_0x30e3b1[_0xb9d9('0x43')]['id']}})[_0xb9d9('0x21')](handleEntityNotFound(_0x53f7cb,null))[_0xb9d9('0x21')](saveUpdates(_0x30e3b1[_0xb9d9('0x48')],null))[_0xb9d9('0x21')](respondWithResult(_0x53f7cb,null))[_0xb9d9('0x41')](handleError(_0x53f7cb,null));};exports['destroy']=function(_0xd417b9,_0x5cf9a0){return db[_0xb9d9('0x28')][_0xb9d9('0x46')]({'where':{'id':_0xd417b9['params']['id']}})[_0xb9d9('0x21')](handleEntityNotFound(_0x5cf9a0,null))['then'](removeEntity(_0x5cf9a0,null))['catch'](handleError(_0x5cf9a0,null));}; \ No newline at end of file +var _0x9c00=['key','model','query','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','pick','type','VIRTUAL','filter','options','where','then','include','findAll','rows','catch','show','params','keys','includeAll','merge','create','body','find','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes'];(function(_0x248e67,_0x1da42f){var _0x39aaa7=function(_0x1849a9){while(--_0x1849a9){_0x248e67['push'](_0x248e67['shift']());}};_0x39aaa7(++_0x1da42f);}(_0x9c00,0x1a0));var _0x09c0=function(_0x58df23,_0x3e9eb9){_0x58df23=_0x58df23-0x0;var _0x2fcd18=_0x9c00[_0x58df23];return _0x2fcd18;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];function respondWithStatusCode(_0x144271,_0x3b95cc){_0x3b95cc=_0x3b95cc||0xcc;return function(_0x331905){if(_0x331905){return _0x144271[_0x09c0('0x1b')](_0x3b95cc);}return _0x144271[_0x09c0('0x1c')](_0x3b95cc)[_0x09c0('0x1d')]();};}function respondWithResult(_0x3649d2,_0x16e490){_0x16e490=_0x16e490||0xc8;return function(_0x254598){if(_0x254598){return _0x3649d2[_0x09c0('0x1c')](_0x16e490)[_0x09c0('0x1e')](_0x254598);}};}function respondWithFilteredResult(_0x33c3d6,_0x2fdf11){return function(_0x4ff6b7){if(_0x4ff6b7){var _0x590129=typeof _0x2fdf11['offset']===_0x09c0('0x1f')&&typeof _0x2fdf11[_0x09c0('0x20')]===_0x09c0('0x1f');var _0x628272=_0x4ff6b7['count'];var _0x2c4440=_0x590129?0x0:_0x2fdf11['offset'];var _0x4c29a7=_0x590129?_0x4ff6b7[_0x09c0('0x21')]:_0x2fdf11['offset']+_0x2fdf11[_0x09c0('0x20')];var _0x319c36;if(_0x4c29a7>=_0x628272){_0x4c29a7=_0x628272;_0x319c36=0xc8;}else{_0x319c36=0xce;}_0x33c3d6[_0x09c0('0x1c')](_0x319c36);return _0x33c3d6['set'](_0x09c0('0x22'),_0x2c4440+'-'+_0x4c29a7+'/'+_0x628272)[_0x09c0('0x1e')](_0x4ff6b7);}return null;};}function patchUpdates(_0x8ad645){return function(_0x3447c5){try{jsonpatch[_0x09c0('0x23')](_0x3447c5,_0x8ad645,!![]);}catch(_0xa5d16f){return BPromise[_0x09c0('0x24')](_0xa5d16f);}return _0x3447c5['save']();};}function saveUpdates(_0x1695e8,_0x46f171){return function(_0x473fbd){if(_0x473fbd){return _0x473fbd[_0x09c0('0x25')](_0x1695e8)['then'](function(_0x4f6824){return _0x4f6824;});}return null;};}function removeEntity(_0x321bcc,_0x25fdb5){return function(_0x1e8a1c){if(_0x1e8a1c){return _0x1e8a1c[_0x09c0('0x26')]()['then'](function(){_0x321bcc[_0x09c0('0x1c')](0xcc)[_0x09c0('0x1d')]();});}};}function handleEntityNotFound(_0x56d883,_0x2c7202){return function(_0x163a59){if(!_0x163a59){_0x56d883[_0x09c0('0x1b')](0x194);}return _0x163a59;};}function handleError(_0x30c2a1,_0x1f8131){_0x1f8131=_0x1f8131||0x1f4;return function(_0x1d2d9d){logger[_0x09c0('0x27')](_0x1d2d9d[_0x09c0('0x28')]);if(_0x1d2d9d[_0x09c0('0x29')]){delete _0x1d2d9d[_0x09c0('0x29')];}_0x30c2a1[_0x09c0('0x1c')](_0x1f8131)['send'](_0x1d2d9d);};}exports[_0x09c0('0x2a')]=function(_0x1bdde9,_0x53a7b8){var _0x1d09e0={},_0x5aa0b9={},_0x3f5b10={'count':0x0,'rows':[]};var _0x4d6bdc=_[_0x09c0('0x2b')](db[_0x09c0('0x2c')][_0x09c0('0x2d')],function(_0x4159bc){return{'name':_0x4159bc['fieldName'],'type':_0x4159bc['type'][_0x09c0('0x2e')]};});_0x5aa0b9[_0x09c0('0x2f')]=_[_0x09c0('0x2b')](_0x4d6bdc,'name');_0x5aa0b9[_0x09c0('0x30')]=_['keys'](_0x1bdde9[_0x09c0('0x30')]);_0x5aa0b9[_0x09c0('0x31')]=_[_0x09c0('0x32')](_0x5aa0b9['model'],_0x5aa0b9[_0x09c0('0x30')]);_0x1d09e0[_0x09c0('0x33')]=_[_0x09c0('0x32')](_0x5aa0b9[_0x09c0('0x2f')],qs[_0x09c0('0x34')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x34')]));_0x1d09e0['attributes']=_0x1d09e0[_0x09c0('0x33')][_0x09c0('0x35')]?_0x1d09e0[_0x09c0('0x33')]:_0x5aa0b9[_0x09c0('0x2f')];if(!_0x1bdde9[_0x09c0('0x30')]['hasOwnProperty'](_0x09c0('0x36'))){_0x1d09e0[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x20')]);_0x1d09e0['offset']=qs[_0x09c0('0x37')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x37')]);}_0x1d09e0[_0x09c0('0x38')]=qs[_0x09c0('0x39')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x39')]);_0x1d09e0['where']=qs[_0x09c0('0x31')](_[_0x09c0('0x3a')](_0x1bdde9[_0x09c0('0x30')],_0x5aa0b9[_0x09c0('0x31')]),_0x4d6bdc);if(_0x1bdde9[_0x09c0('0x30')]['filter']){_0x1d09e0['where']=_['merge'](_0x1d09e0['where'],{'$or':_[_0x09c0('0x2b')](_0x4d6bdc,function(_0x15c631){if(_0x15c631[_0x09c0('0x3b')]!==_0x09c0('0x3c')){var _0x1a8c0c={};_0x1a8c0c[_0x15c631['name']]={'$like':'%'+_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x3d')]+'%'};return _0x1a8c0c;}})});}_0x1d09e0=_['merge']({},_0x1d09e0,_0x1bdde9[_0x09c0('0x3e')]);var _0x5d50b9={'where':_0x1d09e0[_0x09c0('0x3f')]};return db['FreshdeskField'][_0x09c0('0x21')](_0x5d50b9)[_0x09c0('0x40')](function(_0x56a511){_0x3f5b10[_0x09c0('0x21')]=_0x56a511;if(_0x1bdde9[_0x09c0('0x30')]['includeAll']){_0x1d09e0[_0x09c0('0x41')]=[{'all':!![]}];}return db[_0x09c0('0x2c')][_0x09c0('0x42')](_0x1d09e0);})[_0x09c0('0x40')](function(_0xeb8191){_0x3f5b10[_0x09c0('0x43')]=_0xeb8191;return _0x3f5b10;})['then'](respondWithFilteredResult(_0x53a7b8,_0x1d09e0))[_0x09c0('0x44')](handleError(_0x53a7b8,null));};exports[_0x09c0('0x45')]=function(_0x2d6344,_0x57835c){var _0x193ed2={'raw':!![],'where':{'id':_0x2d6344[_0x09c0('0x46')]['id']}},_0x30c0c5={};_0x30c0c5['model']=_[_0x09c0('0x47')](db[_0x09c0('0x2c')]['rawAttributes']);_0x30c0c5['query']=_[_0x09c0('0x47')](_0x2d6344[_0x09c0('0x30')]);_0x30c0c5['filters']=_[_0x09c0('0x32')](_0x30c0c5[_0x09c0('0x2f')],_0x30c0c5['query']);_0x193ed2[_0x09c0('0x33')]=_[_0x09c0('0x32')](_0x30c0c5[_0x09c0('0x2f')],qs[_0x09c0('0x34')](_0x2d6344[_0x09c0('0x30')]['fields']));_0x193ed2[_0x09c0('0x33')]=_0x193ed2['attributes']['length']?_0x193ed2[_0x09c0('0x33')]:_0x30c0c5[_0x09c0('0x2f')];if(_0x2d6344[_0x09c0('0x30')][_0x09c0('0x48')]){_0x193ed2[_0x09c0('0x41')]=[{'all':!![]}];}_0x193ed2=_[_0x09c0('0x49')]({},_0x193ed2,_0x2d6344['options']);return db['FreshdeskField']['find'](_0x193ed2)[_0x09c0('0x40')](handleEntityNotFound(_0x57835c,null))[_0x09c0('0x40')](respondWithResult(_0x57835c,null))[_0x09c0('0x44')](handleError(_0x57835c,null));};exports['create']=function(_0xdf1553,_0xff9650){return db[_0x09c0('0x2c')][_0x09c0('0x4a')](_0xdf1553[_0x09c0('0x4b')],{})[_0x09c0('0x40')](respondWithResult(_0xff9650,0xc9))[_0x09c0('0x44')](handleError(_0xff9650,null));};exports[_0x09c0('0x25')]=function(_0x3f6d14,_0x38085c){if(_0x3f6d14[_0x09c0('0x4b')]['id']){delete _0x3f6d14[_0x09c0('0x4b')]['id'];}return db[_0x09c0('0x2c')][_0x09c0('0x4c')]({'where':{'id':_0x3f6d14[_0x09c0('0x46')]['id']}})[_0x09c0('0x40')](handleEntityNotFound(_0x38085c,null))[_0x09c0('0x40')](saveUpdates(_0x3f6d14[_0x09c0('0x4b')],null))[_0x09c0('0x40')](respondWithResult(_0x38085c,null))[_0x09c0('0x44')](handleError(_0x38085c,null));};exports['destroy']=function(_0x4acf54,_0x44befb){return db[_0x09c0('0x2c')][_0x09c0('0x4c')]({'where':{'id':_0x4acf54[_0x09c0('0x46')]['id']}})['then'](handleEntityNotFound(_0x44befb,null))[_0x09c0('0x40')](removeEntity(_0x44befb,null))[_0x09c0('0x44')](handleError(_0x44befb,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 5bae9d9..29baf90 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 _0xb64e=['moment','bluebird','request-promise','path','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','util','api'];(function(_0x548657,_0x479937){var _0x8e3ae5=function(_0x552d84){while(--_0x552d84){_0x548657['push'](_0x548657['shift']());}};_0x8e3ae5(++_0x479937);}(_0xb64e,0x89));var _0xeb64=function(_0x94118,_0x3bf157){_0x94118=_0x94118-0x0;var _0x685a42=_0xb64e[_0x94118];return _0x685a42;};'use strict';var _=require(_0xeb64('0x0'));var util=require(_0xeb64('0x1'));var logger=require('../../config/logger')(_0xeb64('0x2'));var moment=require(_0xeb64('0x3'));var BPromise=require(_0xeb64('0x4'));var rp=require(_0xeb64('0x5'));var fs=require('fs');var path=require(_0xeb64('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xeb64('0x7'));module[_0xeb64('0x8')]=function(_0x3bdaab,_0x43af0){return _0x3bdaab[_0xeb64('0x9')](_0xeb64('0xa'),attributes,{'tableName':_0xeb64('0xb'),'paranoid':![],'indexes':[{'name':_0xeb64('0xc'),'fields':['idField',_0xeb64('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd847=['int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField'];(function(_0x2a0308,_0x405fbf){var _0x5507e3=function(_0x4bb043){while(--_0x4bb043){_0x2a0308['push'](_0x2a0308['shift']());}};_0x5507e3(++_0x405fbf);}(_0xd847,0x18a));var _0x7d84=function(_0x3ea537,_0x5d6a52){_0x3ea537=_0x3ea537-0x0;var _0x264abf=_0xd847[_0x3ea537];return _0x264abf;};'use strict';var _=require(_0x7d84('0x0'));var util=require(_0x7d84('0x1'));var logger=require(_0x7d84('0x2'))(_0x7d84('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7d84('0x4'));var fs=require('fs');var path=require(_0x7d84('0x5'));var rimraf=require(_0x7d84('0x6'));var config=require(_0x7d84('0x7'));var attributes=require(_0x7d84('0x8'));module['exports']=function(_0x1544e7,_0x5d8f76){return _0x1544e7[_0x7d84('0x9')](_0x7d84('0xa'),attributes,{'tableName':_0x7d84('0xb'),'paranoid':![],'indexes':[{'name':_0x7d84('0xc'),'fields':[_0x7d84('0xd'),_0x7d84('0xe')],'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 2ffa32f..d4570f2 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 _0x69fc=['code','message','result','catch','moment','../../mysqldb','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0x69fc,0x1be));var _0xc69f=function(_0x179e34,_0x3dc914){_0x179e34=_0x179e34-0x0;var _0x378a8c=_0x69fc[_0x179e34];return _0x378a8c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc69f('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc69f('0x1'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc69f('0x2'));var client=jayson[_0xc69f('0x3')][_0xc69f('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x82f6b2,_0x42ecdf,_0x57c288){return new BPromise(function(_0xc6ec64,_0x2a3545){return client[_0xc69f('0x5')](_0x82f6b2,_0x57c288)['then'](function(_0x3f4ce8){logger[_0xc69f('0x6')](_0xc69f('0x7'),_0x42ecdf,'request\x20sent');logger[_0xc69f('0x8')](_0xc69f('0x9'),_0x42ecdf,_0xc69f('0xa'),JSON[_0xc69f('0xb')](_0x3f4ce8));if(_0x3f4ce8[_0xc69f('0xc')]){if(_0x3f4ce8[_0xc69f('0xc')][_0xc69f('0xd')]===0x1f4){logger[_0xc69f('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x42ecdf,_0x3f4ce8[_0xc69f('0xc')][_0xc69f('0xe')]);return _0x2a3545(_0x3f4ce8[_0xc69f('0xc')][_0xc69f('0xe')]);}logger[_0xc69f('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x42ecdf,_0x3f4ce8[_0xc69f('0xc')][_0xc69f('0xe')]);return _0xc6ec64(_0x3f4ce8[_0xc69f('0xc')][_0xc69f('0xe')]);}else{logger[_0xc69f('0x6')]('FreshdeskField,\x20%s,\x20%s',_0x42ecdf,_0xc69f('0xa'));_0xc6ec64(_0x3f4ce8[_0xc69f('0xf')]['message']);}})[_0xc69f('0x10')](function(_0x48824d){logger[_0xc69f('0xc')](_0xc69f('0x7'),_0x42ecdf,_0x48824d);_0x2a3545(_0x48824d);});});} \ No newline at end of file +var _0x6318=['FreshdeskField,\x20%s,\x20%s','error','message','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x491bd4,_0x18f776){var _0x3ef7d2=function(_0x3387c8){while(--_0x3387c8){_0x491bd4['push'](_0x491bd4['shift']());}};_0x3ef7d2(++_0x18f776);}(_0x6318,0x16e));var _0x8631=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x6318[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8631('0x0'));var BPromise=require(_0x8631('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8631('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8631('0x3'));var logger=require(_0x8631('0x4'))(_0x8631('0x5'));var config=require(_0x8631('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8631('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x33dcbc,_0x2fda7b,_0x217eeb){return new BPromise(function(_0x367389,_0x449888){return client[_0x8631('0x8')](_0x33dcbc,_0x217eeb)['then'](function(_0x3d9f58){logger[_0x8631('0x9')]('FreshdeskField,\x20%s,\x20%s',_0x2fda7b,_0x8631('0xa'));logger[_0x8631('0xb')](_0x8631('0xc'),_0x2fda7b,_0x8631('0xa'),JSON[_0x8631('0xd')](_0x3d9f58));if(_0x3d9f58['error']){if(_0x3d9f58['error']['code']===0x1f4){logger['error'](_0x8631('0xe'),_0x2fda7b,_0x3d9f58[_0x8631('0xf')][_0x8631('0x10')]);return _0x449888(_0x3d9f58[_0x8631('0xf')]['message']);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x2fda7b,_0x3d9f58[_0x8631('0xf')]['message']);return _0x367389(_0x3d9f58[_0x8631('0xf')][_0x8631('0x10')]);}else{logger[_0x8631('0x9')](_0x8631('0xe'),_0x2fda7b,_0x8631('0xa'));_0x367389(_0x3d9f58[_0x8631('0x11')]['message']);}})[_0x8631('0x12')](function(_0x13a50f){logger[_0x8631('0xf')](_0x8631('0xe'),_0x2fda7b,_0x13a50f);_0x449888(_0x13a50f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 71e5e53..da34a03 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 _0x6e6c=['../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x4ebc6f,_0x508a0c){var _0x259835=function(_0x237439){while(--_0x237439){_0x4ebc6f['push'](_0x4ebc6f['shift']());}};_0x259835(++_0x508a0c);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6e6c[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e6('0x5'));var controller=require('./intFreshsalesAccount.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0x6')]('/:id/configurations',auth[_0xc6e6('0x7')](),controller['getConfigurations']);router[_0xc6e6('0x6')](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xb')]);router[_0xc6e6('0xc')]('/',auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xd')]);router[_0xc6e6('0xc')](_0xc6e6('0xe'),auth['isAuthenticated'](),controller[_0xc6e6('0xf')]);router['put'](_0xc6e6('0x8'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x10')]);router[_0xc6e6('0x11')]('/:id',auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x12')]);module[_0xc6e6('0x13')]=router; \ No newline at end of file +var _0x97c1=['delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','index','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x97c1,0xdf));var _0x197c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x97c1[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var path=require('path');var timeout=require(_0x197c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x197c('0x3'));var auth=require(_0x197c('0x4'));var interaction=require(_0x197c('0x5'));var config=require(_0x197c('0x6'));var controller=require(_0x197c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x197c('0x8')]);router[_0x197c('0x9')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller['show']);router['get'](_0x197c('0xc'),auth['isAuthenticated'](),controller[_0x197c('0xd')]);router[_0x197c('0x9')](_0x197c('0xe'),auth[_0x197c('0xb')](),controller['getFields']);router[_0x197c('0xf')]('/',auth[_0x197c('0xb')](),controller[_0x197c('0x10')]);router[_0x197c('0xf')](_0x197c('0xc'),auth['isAuthenticated'](),controller[_0x197c('0x11')]);router[_0x197c('0x12')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller['update']);router[_0x197c('0x13')](_0x197c('0xa'),auth[_0x197c('0xb')](),controller[_0x197c('0x14')]);module[_0x197c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 8db0475..c11a2d2 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 _0x1399=['exports','STRING','username','remoteUri','sequelize'];(function(_0x144b30,_0x77072d){var _0x1bb7bc=function(_0x1082cc){while(--_0x1082cc){_0x144b30['push'](_0x144b30['shift']());}};_0x1bb7bc(++_0x77072d);}(_0x1399,0x16c));var _0x9139=function(_0x5ef37b,_0x166e27){_0x5ef37b=_0x5ef37b-0x0;var _0x2a10fa=_0x1399[_0x5ef37b];return _0x2a10fa;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9139('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x9139('0x3')},'apiKey':{'type':Sequelize[_0x9139('0x2')]},'remoteUri':{'type':Sequelize[_0x9139('0x2')],'unique':_0x9139('0x4')},'serverUrl':{'type':Sequelize[_0x9139('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7916=['sequelize','STRING','username','remoteUri'];(function(_0x38ecf4,_0x3e6d03){var _0x3f3950=function(_0x3ea44a){while(--_0x3ea44a){_0x38ecf4['push'](_0x38ecf4['shift']());}};_0x3f3950(++_0x3e6d03);}(_0x7916,0x128));var _0x6791=function(_0x262fd4,_0x4fb43d){_0x262fd4=_0x262fd4-0x0;var _0x5b0242=_0x7916[_0x262fd4];return _0x5b0242;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')]},'description':{'type':Sequelize[_0x6791('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6791('0x2')},'apiKey':{'type':Sequelize[_0x6791('0x1')]},'remoteUri':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 025054c..83edf8a 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 _0x2c2a=['getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','Subjects','getFields','username','remoteUri','slice','format','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','FreshsalesAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','fields','find','create','update','body','getConfigurations','findOne','addConfiguration'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2c2a,0x1a2));var _0xa2c2=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x2c2a[_0x18ab2a];return _0x16dcee;};'use strict';var emlformat=require(_0xa2c2('0x0'));var rimraf=require(_0xa2c2('0x1'));var zipdir=require(_0xa2c2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa2c2('0x3'));var moment=require('moment');var BPromise=require(_0xa2c2('0x4'));var Mustache=require(_0xa2c2('0x5'));var util=require('util');var path=require(_0xa2c2('0x6'));var sox=require(_0xa2c2('0x7'));var csv=require(_0xa2c2('0x8'));var ejs=require(_0xa2c2('0x9'));var fs=require('fs');var fs_extra=require(_0xa2c2('0xa'));var _=require(_0xa2c2('0xb'));var squel=require(_0xa2c2('0xc'));var crypto=require(_0xa2c2('0xd'));var jsforce=require(_0xa2c2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa2c2('0x8'));var querystring=require(_0xa2c2('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa2c2('0x10'));var hardwareService=require(_0xa2c2('0x11'));var logger=require(_0xa2c2('0x12'))(_0xa2c2('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa2c2('0x14'));var db=require(_0xa2c2('0x15'))['db'];var integrations=require(_0xa2c2('0x16'));function respondWithStatusCode(_0x400560,_0x50a04e){_0x50a04e=_0x50a04e||0xcc;return function(_0x44c37e){if(_0x44c37e){return _0x400560[_0xa2c2('0x17')](_0x50a04e);}return _0x400560[_0xa2c2('0x18')](_0x50a04e)[_0xa2c2('0x19')]();};}function respondWithResult(_0xd249f,_0x188084){_0x188084=_0x188084||0xc8;return function(_0x34f43b){if(_0x34f43b){return _0xd249f[_0xa2c2('0x18')](_0x188084)[_0xa2c2('0x1a')](_0x34f43b);}};}function respondWithFilteredResult(_0x3dfea4,_0x15081e){return function(_0x5e7dcb){if(_0x5e7dcb){var _0xe977a2=typeof _0x15081e[_0xa2c2('0x1b')]===_0xa2c2('0x1c')&&typeof _0x15081e[_0xa2c2('0x1d')]==='undefined';var _0x46ceaa=_0x5e7dcb[_0xa2c2('0x1e')];var _0x1d48be=_0xe977a2?0x0:_0x15081e[_0xa2c2('0x1b')];var _0x5e1839=_0xe977a2?_0x5e7dcb['count']:_0x15081e[_0xa2c2('0x1b')]+_0x15081e[_0xa2c2('0x1d')];var _0x3699e6;if(_0x5e1839>=_0x46ceaa){_0x5e1839=_0x46ceaa;_0x3699e6=0xc8;}else{_0x3699e6=0xce;}_0x3dfea4[_0xa2c2('0x18')](_0x3699e6);return _0x3dfea4[_0xa2c2('0x1f')](_0xa2c2('0x20'),_0x1d48be+'-'+_0x5e1839+'/'+_0x46ceaa)[_0xa2c2('0x1a')](_0x5e7dcb);}return null;};}function patchUpdates(_0x287d53){return function(_0x2171f1){try{jsonpatch[_0xa2c2('0x21')](_0x2171f1,_0x287d53,!![]);}catch(_0x1dd539){return BPromise[_0xa2c2('0x22')](_0x1dd539);}return _0x2171f1[_0xa2c2('0x23')]();};}function saveUpdates(_0x50af5b,_0x56f538){return function(_0x1c3e6c){if(_0x1c3e6c){return _0x1c3e6c['update'](_0x50af5b)['then'](function(_0x5f4eae){return _0x5f4eae;});}return null;};}function removeEntity(_0x543b83,_0x2a99d8){return function(_0x12d050){if(_0x12d050){return _0x12d050[_0xa2c2('0x24')]()[_0xa2c2('0x25')](function(){_0x543b83[_0xa2c2('0x18')](0xcc)[_0xa2c2('0x19')]();});}};}function handleEntityNotFound(_0xd09782,_0xa324b5){return function(_0x3cd875){if(!_0x3cd875){_0xd09782['sendStatus'](0x194);}return _0x3cd875;};}function handleError(_0x35403e,_0xdee687){_0xdee687=_0xdee687||0x1f4;return function(_0x30647b){logger[_0xa2c2('0x26')](_0x30647b[_0xa2c2('0x27')]);if(_0x30647b[_0xa2c2('0x28')]){delete _0x30647b[_0xa2c2('0x28')];}_0x35403e[_0xa2c2('0x18')](_0xdee687)['send'](_0x30647b);};}exports[_0xa2c2('0x29')]=function(_0x2572b6,_0x31d0e0){var _0x491f1d={},_0x367605={},_0x1a72bd={'count':0x0,'rows':[]};var _0x1ac4c2=_['map'](db[_0xa2c2('0x2a')]['rawAttributes'],function(_0x457950){return{'name':_0x457950[_0xa2c2('0x2b')],'type':_0x457950[_0xa2c2('0x2c')][_0xa2c2('0x2d')]};});_0x367605[_0xa2c2('0x2e')]=_[_0xa2c2('0x2f')](_0x1ac4c2,_0xa2c2('0x28'));_0x367605[_0xa2c2('0x30')]=_[_0xa2c2('0x31')](_0x2572b6[_0xa2c2('0x30')]);_0x367605[_0xa2c2('0x32')]=_[_0xa2c2('0x33')](_0x367605[_0xa2c2('0x2e')],_0x367605[_0xa2c2('0x30')]);_0x491f1d['attributes']=_[_0xa2c2('0x33')](_0x367605[_0xa2c2('0x2e')],qs['fields'](_0x2572b6[_0xa2c2('0x30')]['fields']));_0x491f1d[_0xa2c2('0x34')]=_0x491f1d[_0xa2c2('0x34')][_0xa2c2('0x35')]?_0x491f1d['attributes']:_0x367605['model'];if(!_0x2572b6[_0xa2c2('0x30')][_0xa2c2('0x36')](_0xa2c2('0x37'))){_0x491f1d[_0xa2c2('0x1d')]=qs[_0xa2c2('0x1d')](_0x2572b6[_0xa2c2('0x30')]['limit']);_0x491f1d[_0xa2c2('0x1b')]=qs[_0xa2c2('0x1b')](_0x2572b6['query'][_0xa2c2('0x1b')]);}_0x491f1d[_0xa2c2('0x38')]=qs[_0xa2c2('0x39')](_0x2572b6['query'][_0xa2c2('0x39')]);_0x491f1d[_0xa2c2('0x3a')]=qs[_0xa2c2('0x32')](_['pick'](_0x2572b6[_0xa2c2('0x30')],_0x367605[_0xa2c2('0x32')]),_0x1ac4c2);if(_0x2572b6[_0xa2c2('0x30')][_0xa2c2('0x3b')]){_0x491f1d[_0xa2c2('0x3a')]=_[_0xa2c2('0x3c')](_0x491f1d['where'],{'$or':_['map'](_0x1ac4c2,function(_0x9312f2){if(_0x9312f2[_0xa2c2('0x2c')]!==_0xa2c2('0x3d')){var _0x452211={};_0x452211[_0x9312f2[_0xa2c2('0x28')]]={'$like':'%'+_0x2572b6['query'][_0xa2c2('0x3b')]+'%'};return _0x452211;}})});}_0x491f1d=_['merge']({},_0x491f1d,_0x2572b6[_0xa2c2('0x3e')]);var _0x390265={'where':_0x491f1d[_0xa2c2('0x3a')]};return db[_0xa2c2('0x2a')]['count'](_0x390265)['then'](function(_0x5d2dcd){_0x1a72bd[_0xa2c2('0x1e')]=_0x5d2dcd;if(_0x2572b6[_0xa2c2('0x30')][_0xa2c2('0x3f')]){_0x491f1d[_0xa2c2('0x40')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x491f1d);})['then'](function(_0x599745){_0x1a72bd[_0xa2c2('0x41')]=_0x599745;return _0x1a72bd;})[_0xa2c2('0x25')](respondWithFilteredResult(_0x31d0e0,_0x491f1d))[_0xa2c2('0x42')](handleError(_0x31d0e0,null));};exports['show']=function(_0x58c18d,_0x2b3a4e){var _0xfa9b48={'raw':![],'where':{'id':_0x58c18d[_0xa2c2('0x43')]['id']}},_0x4fab62={};_0x4fab62[_0xa2c2('0x2e')]=_['keys'](db['FreshsalesAccount'][_0xa2c2('0x44')]);_0x4fab62[_0xa2c2('0x30')]=_[_0xa2c2('0x31')](_0x58c18d[_0xa2c2('0x30')]);_0x4fab62[_0xa2c2('0x32')]=_['intersection'](_0x4fab62['model'],_0x4fab62[_0xa2c2('0x30')]);_0xfa9b48[_0xa2c2('0x34')]=_[_0xa2c2('0x33')](_0x4fab62[_0xa2c2('0x2e')],qs[_0xa2c2('0x45')](_0x58c18d[_0xa2c2('0x30')][_0xa2c2('0x45')]));_0xfa9b48[_0xa2c2('0x34')]=_0xfa9b48['attributes'][_0xa2c2('0x35')]?_0xfa9b48[_0xa2c2('0x34')]:_0x4fab62[_0xa2c2('0x2e')];if(_0x58c18d['query']['includeAll']){_0xfa9b48[_0xa2c2('0x40')]=[{'all':!![]}];}_0xfa9b48=_[_0xa2c2('0x3c')]({},_0xfa9b48,_0x58c18d[_0xa2c2('0x3e')]);return db[_0xa2c2('0x2a')][_0xa2c2('0x46')](_0xfa9b48)[_0xa2c2('0x25')](handleEntityNotFound(_0x2b3a4e,null))[_0xa2c2('0x25')](respondWithResult(_0x2b3a4e,null))[_0xa2c2('0x42')](handleError(_0x2b3a4e,null));};exports['create']=function(_0x3cefa0,_0x49312c){return db[_0xa2c2('0x2a')][_0xa2c2('0x47')](_0x3cefa0['body'],{})[_0xa2c2('0x25')](respondWithResult(_0x49312c,0xc9))[_0xa2c2('0x42')](handleError(_0x49312c,null));};exports[_0xa2c2('0x48')]=function(_0xa398be,_0x1eddfd){if(_0xa398be[_0xa2c2('0x49')]['id']){delete _0xa398be[_0xa2c2('0x49')]['id'];}return db[_0xa2c2('0x2a')][_0xa2c2('0x46')]({'where':{'id':_0xa398be[_0xa2c2('0x43')]['id']}})['then'](handleEntityNotFound(_0x1eddfd,null))[_0xa2c2('0x25')](saveUpdates(_0xa398be[_0xa2c2('0x49')],null))[_0xa2c2('0x25')](respondWithResult(_0x1eddfd,null))['catch'](handleError(_0x1eddfd,null));};exports[_0xa2c2('0x24')]=function(_0x5750ac,_0x4e197a){return db['FreshsalesAccount'][_0xa2c2('0x46')]({'where':{'id':_0x5750ac[_0xa2c2('0x43')]['id']}})[_0xa2c2('0x25')](handleEntityNotFound(_0x4e197a,null))[_0xa2c2('0x25')](removeEntity(_0x4e197a,null))[_0xa2c2('0x42')](handleError(_0x4e197a,null));};exports[_0xa2c2('0x4a')]=function(_0x13cc4d,_0x17a92a,_0x3cc825){var _0x4a13b3={};var _0x76978d={};var _0x1de942;var _0x384a1e;return db[_0xa2c2('0x2a')][_0xa2c2('0x4b')]({'where':{'id':_0x13cc4d[_0xa2c2('0x43')]['id']}})[_0xa2c2('0x25')](handleEntityNotFound(_0x17a92a,null))[_0xa2c2('0x25')](function(_0x48cd37){if(_0x48cd37){_0x1de942=_0x48cd37;_0x76978d['model']=_[_0xa2c2('0x31')](db['FreshsalesConfiguration'][_0xa2c2('0x44')]);_0x76978d[_0xa2c2('0x30')]=_[_0xa2c2('0x31')](_0x13cc4d[_0xa2c2('0x30')]);_0x76978d[_0xa2c2('0x32')]=_[_0xa2c2('0x33')](_0x76978d[_0xa2c2('0x2e')],_0x76978d[_0xa2c2('0x30')]);_0x4a13b3['attributes']=_[_0xa2c2('0x33')](_0x76978d[_0xa2c2('0x2e')],qs[_0xa2c2('0x45')](_0x13cc4d[_0xa2c2('0x30')]['fields']));_0x4a13b3[_0xa2c2('0x34')]=_0x4a13b3['attributes'][_0xa2c2('0x35')]?_0x4a13b3[_0xa2c2('0x34')]:_0x76978d['model'];_0x4a13b3[_0xa2c2('0x38')]=qs[_0xa2c2('0x39')](_0x13cc4d[_0xa2c2('0x30')][_0xa2c2('0x39')]);_0x4a13b3[_0xa2c2('0x3a')]=qs[_0xa2c2('0x32')](_['pick'](_0x13cc4d[_0xa2c2('0x30')],_0x76978d[_0xa2c2('0x32')]));if(_0x13cc4d[_0xa2c2('0x30')][_0xa2c2('0x3b')]){_0x4a13b3['where']=_[_0xa2c2('0x3c')](_0x4a13b3['where'],{'$or':_[_0xa2c2('0x2f')](_0x4a13b3['attributes'],function(_0xf19aa5){var _0x4f8bda={};_0x4f8bda[_0xf19aa5]={'$like':'%'+_0x13cc4d[_0xa2c2('0x30')][_0xa2c2('0x3b')]+'%'};return _0x4f8bda;})});}_0x4a13b3=_[_0xa2c2('0x3c')]({},_0x4a13b3,_0x13cc4d[_0xa2c2('0x3e')]);return _0x1de942[_0xa2c2('0x4a')](_0x4a13b3);}})[_0xa2c2('0x25')](function(_0x152d95){if(_0x152d95){_0x384a1e=_0x152d95[_0xa2c2('0x35')];if(!_0x13cc4d['query'][_0xa2c2('0x36')](_0xa2c2('0x37'))){_0x4a13b3['limit']=qs[_0xa2c2('0x1d')](_0x13cc4d[_0xa2c2('0x30')][_0xa2c2('0x1d')]);_0x4a13b3[_0xa2c2('0x1b')]=qs[_0xa2c2('0x1b')](_0x13cc4d[_0xa2c2('0x30')]['offset']);}return _0x1de942[_0xa2c2('0x4a')](_0x4a13b3);}})['then'](function(_0x22b347){if(_0x22b347){return _0x22b347?{'count':_0x384a1e,'rows':_0x22b347}:null;}})[_0xa2c2('0x25')](respondWithResult(_0x17a92a,null))['catch'](handleError(_0x17a92a,null));};exports[_0xa2c2('0x4c')]=function(_0x4b9aa2,_0x2c8757,_0xd4c9eb){if(_0x4b9aa2['body']['id']){delete _0x4b9aa2[_0xa2c2('0x49')]['id'];}return db['FreshsalesAccount'][_0xa2c2('0x4b')]({'where':{'id':_0x4b9aa2[_0xa2c2('0x43')]['id']}})['then'](handleEntityNotFound(_0x2c8757,null))[_0xa2c2('0x25')](function(_0x4eb515){if(_0x4eb515){_0x4b9aa2[_0xa2c2('0x49')]['AccountId']=_0x4eb515['id'];_0x4b9aa2[_0xa2c2('0x49')]['Subjects']=integrations[_0xa2c2('0x4d')](_0x4b9aa2[_0xa2c2('0x49')][_0xa2c2('0x4e')],_0x4b9aa2['body'][_0xa2c2('0x2c')]);_0x4b9aa2[_0xa2c2('0x49')][_0xa2c2('0x4f')]=integrations[_0xa2c2('0x50')](_0x4b9aa2[_0xa2c2('0x49')][_0xa2c2('0x4e')],_0x4b9aa2[_0xa2c2('0x49')][_0xa2c2('0x2c')]);return db[_0xa2c2('0x51')][_0xa2c2('0x47')](_0x4b9aa2['body'],{'include':[{'model':db[_0xa2c2('0x52')],'as':_0xa2c2('0x53')},{'model':db[_0xa2c2('0x52')],'as':'Descriptions'}]});}return null;})[_0xa2c2('0x25')](respondWithResult(_0x2c8757,null))[_0xa2c2('0x42')](handleError(_0x2c8757,null));};exports[_0xa2c2('0x54')]=function(_0x1b32c7,_0x42611c,_0x27853d){var _0x47f25d='';var _0x2a8f8b='';return db[_0xa2c2('0x2a')]['findOne']({'where':{'id':_0x1b32c7[_0xa2c2('0x43')]['id']},'attributes':['id',_0xa2c2('0x55'),_0xa2c2('0x56'),'apiKey']})['then'](handleEntityNotFound(_0x42611c,null))['then'](function(_0x2a3222){if(_0x2a3222){_0x2a8f8b=_0x2a3222['username'];_0x47f25d=_0x2a3222[_0xa2c2('0x56')];var _0x55084d=_0x2a3222['remoteUri'][_0xa2c2('0x57')](-0x1);if(_0x55084d==='/'){_0x47f25d=_0x47f25d['substring'](0x0,_0x47f25d['lastIndexOf'](_0x55084d));}return rp({'method':'GET','uri':util[_0xa2c2('0x58')]('%s%s',_0x47f25d,'/api/selector/owners'),'headers':{'Authorization':_0xa2c2('0x59')+_0x2a3222['apiKey']},'json':!![]});}})[_0xa2c2('0x25')](function(_0x1f0d88){if(_0x1f0d88){var _0x280d82=_0x1f0d88[_0xa2c2('0x5a')];var _0x26c4f3=![];var _0x3d37b7=null;for(_0x3d37b7=0x0;_0x3d37b7<_0x280d82[_0xa2c2('0x35')];_0x3d37b7++){if(_0x280d82[_0x3d37b7][_0xa2c2('0x5b')]===_0x2a8f8b){_0x26c4f3=!![];}}if(_0x26c4f3){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xa2c2('0x5c')});}}})[_0xa2c2('0x25')](respondWithResult(_0x42611c,null))['catch'](function(_0x16b608){var _0xe4c5fa=_0x1b32c7['query'][_0xa2c2('0x5d')]?0x1f4:_0x16b608[_0xa2c2('0x5e')]||0x1f4;logger[_0xa2c2('0x26')](_0xa2c2('0x5f'),_0xa2c2('0x54'),_0xe4c5fa,JSON[_0xa2c2('0x60')](_0x16b608));delete _0x16b608[_0xa2c2('0x28')];if(_0xe4c5fa===0x191){_0xe4c5fa=0x190;}_0x42611c[_0xa2c2('0x18')](_0xe4c5fa)[_0xa2c2('0x61')](_0x1b32c7['query'][_0xa2c2('0x5d')]?{'message':_0xa2c2('0x62'),'statusCode':_0x16b608['statusCode']}:_0x16b608);});}; \ No newline at end of file +var _0x94bc=['FreshsalesConfiguration','username','remoteUri','apiKey','slice','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','FreshsalesAccount','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions'];(function(_0x137138,_0x28e56d){var _0x4b5038=function(_0x23cb65){while(--_0x23cb65){_0x137138['push'](_0x137138['shift']());}};_0x4b5038(++_0x28e56d);}(_0x94bc,0xdd));var _0xc94b=function(_0x245d76,_0x1c2c6f){_0x245d76=_0x245d76-0x0;var _0x4516f7=_0x94bc[_0x245d76];return _0x4516f7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc94b('0x0'));var jsonpatch=require(_0xc94b('0x1'));var rp=require(_0xc94b('0x2'));var moment=require(_0xc94b('0x3'));var BPromise=require(_0xc94b('0x4'));var Mustache=require(_0xc94b('0x5'));var util=require('util');var path=require(_0xc94b('0x6'));var sox=require(_0xc94b('0x7'));var csv=require('to-csv');var ejs=require(_0xc94b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc94b('0x9'));var squel=require(_0xc94b('0xa'));var crypto=require('crypto');var jsforce=require(_0xc94b('0xb'));var deskjs=require(_0xc94b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc94b('0xd'));var Redis=require(_0xc94b('0xe'));var authService=require(_0xc94b('0xf'));var qs=require(_0xc94b('0x10'));var as=require(_0xc94b('0x11'));var hardwareService=require(_0xc94b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xc94b('0x13'));var config=require(_0xc94b('0x14'));var licenseUtil=require(_0xc94b('0x15'));var db=require(_0xc94b('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2e4443,_0x375046){_0x375046=_0x375046||0xcc;return function(_0x3b8de3){if(_0x3b8de3){return _0x2e4443['sendStatus'](_0x375046);}return _0x2e4443[_0xc94b('0x17')](_0x375046)[_0xc94b('0x18')]();};}function respondWithResult(_0xe90465,_0xda76db){_0xda76db=_0xda76db||0xc8;return function(_0x399d94){if(_0x399d94){return _0xe90465[_0xc94b('0x17')](_0xda76db)[_0xc94b('0x19')](_0x399d94);}};}function respondWithFilteredResult(_0x19bf84,_0x508fbf){return function(_0x24e340){if(_0x24e340){var _0x2efbc0=typeof _0x508fbf[_0xc94b('0x1a')]===_0xc94b('0x1b')&&typeof _0x508fbf[_0xc94b('0x1c')]===_0xc94b('0x1b');var _0x101256=_0x24e340[_0xc94b('0x1d')];var _0x1bd3f9=_0x2efbc0?0x0:_0x508fbf[_0xc94b('0x1a')];var _0x4a5513=_0x2efbc0?_0x24e340[_0xc94b('0x1d')]:_0x508fbf[_0xc94b('0x1a')]+_0x508fbf['limit'];var _0x195867;if(_0x4a5513>=_0x101256){_0x4a5513=_0x101256;_0x195867=0xc8;}else{_0x195867=0xce;}_0x19bf84['status'](_0x195867);return _0x19bf84[_0xc94b('0x1e')](_0xc94b('0x1f'),_0x1bd3f9+'-'+_0x4a5513+'/'+_0x101256)[_0xc94b('0x19')](_0x24e340);}return null;};}function patchUpdates(_0x59612f){return function(_0x4dfeea){try{jsonpatch[_0xc94b('0x20')](_0x4dfeea,_0x59612f,!![]);}catch(_0x99f837){return BPromise[_0xc94b('0x21')](_0x99f837);}return _0x4dfeea[_0xc94b('0x22')]();};}function saveUpdates(_0x2054cc,_0x460454){return function(_0x551441){if(_0x551441){return _0x551441[_0xc94b('0x23')](_0x2054cc)[_0xc94b('0x24')](function(_0x1e0f67){return _0x1e0f67;});}return null;};}function removeEntity(_0x3f543d,_0x242c6a){return function(_0x2a855c){if(_0x2a855c){return _0x2a855c['destroy']()[_0xc94b('0x24')](function(){_0x3f543d[_0xc94b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x178809,_0x5659d3){return function(_0x1afcad){if(!_0x1afcad){_0x178809['sendStatus'](0x194);}return _0x1afcad;};}function handleError(_0x343522,_0x1e2ad0){_0x1e2ad0=_0x1e2ad0||0x1f4;return function(_0x84cf72){logger[_0xc94b('0x25')](_0x84cf72['stack']);if(_0x84cf72[_0xc94b('0x26')]){delete _0x84cf72[_0xc94b('0x26')];}_0x343522[_0xc94b('0x17')](_0x1e2ad0)[_0xc94b('0x27')](_0x84cf72);};}exports[_0xc94b('0x28')]=function(_0x55b12e,_0x589310){var _0x160671={},_0x3efdfb={},_0x1d6161={'count':0x0,'rows':[]};var _0x17af29=_[_0xc94b('0x29')](db['FreshsalesAccount'][_0xc94b('0x2a')],function(_0x4eaaa9){return{'name':_0x4eaaa9[_0xc94b('0x2b')],'type':_0x4eaaa9[_0xc94b('0x2c')][_0xc94b('0x2d')]};});_0x3efdfb['model']=_[_0xc94b('0x29')](_0x17af29,'name');_0x3efdfb[_0xc94b('0x2e')]=_[_0xc94b('0x2f')](_0x55b12e['query']);_0x3efdfb[_0xc94b('0x30')]=_[_0xc94b('0x31')](_0x3efdfb['model'],_0x3efdfb[_0xc94b('0x2e')]);_0x160671[_0xc94b('0x32')]=_['intersection'](_0x3efdfb['model'],qs[_0xc94b('0x33')](_0x55b12e['query']['fields']));_0x160671['attributes']=_0x160671[_0xc94b('0x32')][_0xc94b('0x34')]?_0x160671[_0xc94b('0x32')]:_0x3efdfb[_0xc94b('0x35')];if(!_0x55b12e[_0xc94b('0x2e')][_0xc94b('0x36')](_0xc94b('0x37'))){_0x160671['limit']=qs[_0xc94b('0x1c')](_0x55b12e[_0xc94b('0x2e')][_0xc94b('0x1c')]);_0x160671[_0xc94b('0x1a')]=qs[_0xc94b('0x1a')](_0x55b12e[_0xc94b('0x2e')][_0xc94b('0x1a')]);}_0x160671[_0xc94b('0x38')]=qs['sort'](_0x55b12e[_0xc94b('0x2e')][_0xc94b('0x39')]);_0x160671[_0xc94b('0x3a')]=qs[_0xc94b('0x30')](_[_0xc94b('0x3b')](_0x55b12e['query'],_0x3efdfb[_0xc94b('0x30')]),_0x17af29);if(_0x55b12e['query'][_0xc94b('0x3c')]){_0x160671[_0xc94b('0x3a')]=_[_0xc94b('0x3d')](_0x160671[_0xc94b('0x3a')],{'$or':_['map'](_0x17af29,function(_0x5eb7f8){if(_0x5eb7f8['type']!==_0xc94b('0x3e')){var _0x4231a5={};_0x4231a5[_0x5eb7f8[_0xc94b('0x26')]]={'$like':'%'+_0x55b12e[_0xc94b('0x2e')]['filter']+'%'};return _0x4231a5;}})});}_0x160671=_[_0xc94b('0x3d')]({},_0x160671,_0x55b12e['options']);var _0x419ec9={'where':_0x160671[_0xc94b('0x3a')]};return db[_0xc94b('0x3f')][_0xc94b('0x1d')](_0x419ec9)['then'](function(_0x48305e){_0x1d6161[_0xc94b('0x1d')]=_0x48305e;if(_0x55b12e[_0xc94b('0x2e')][_0xc94b('0x40')]){_0x160671[_0xc94b('0x41')]=[{'all':!![]}];}return db[_0xc94b('0x3f')][_0xc94b('0x42')](_0x160671);})['then'](function(_0x13c0be){_0x1d6161[_0xc94b('0x43')]=_0x13c0be;return _0x1d6161;})['then'](respondWithFilteredResult(_0x589310,_0x160671))[_0xc94b('0x44')](handleError(_0x589310,null));};exports[_0xc94b('0x45')]=function(_0x95cef1,_0x49ef2e){var _0x6bf968={'raw':![],'where':{'id':_0x95cef1[_0xc94b('0x46')]['id']}},_0x489e49={};_0x489e49[_0xc94b('0x35')]=_[_0xc94b('0x2f')](db[_0xc94b('0x3f')]['rawAttributes']);_0x489e49[_0xc94b('0x2e')]=_[_0xc94b('0x2f')](_0x95cef1[_0xc94b('0x2e')]);_0x489e49[_0xc94b('0x30')]=_[_0xc94b('0x31')](_0x489e49[_0xc94b('0x35')],_0x489e49[_0xc94b('0x2e')]);_0x6bf968[_0xc94b('0x32')]=_[_0xc94b('0x31')](_0x489e49[_0xc94b('0x35')],qs[_0xc94b('0x33')](_0x95cef1[_0xc94b('0x2e')][_0xc94b('0x33')]));_0x6bf968[_0xc94b('0x32')]=_0x6bf968[_0xc94b('0x32')][_0xc94b('0x34')]?_0x6bf968[_0xc94b('0x32')]:_0x489e49[_0xc94b('0x35')];if(_0x95cef1[_0xc94b('0x2e')]['includeAll']){_0x6bf968[_0xc94b('0x41')]=[{'all':!![]}];}_0x6bf968=_[_0xc94b('0x3d')]({},_0x6bf968,_0x95cef1[_0xc94b('0x47')]);return db['FreshsalesAccount'][_0xc94b('0x48')](_0x6bf968)[_0xc94b('0x24')](handleEntityNotFound(_0x49ef2e,null))['then'](respondWithResult(_0x49ef2e,null))[_0xc94b('0x44')](handleError(_0x49ef2e,null));};exports[_0xc94b('0x49')]=function(_0x26c6ea,_0x531467){return db[_0xc94b('0x3f')][_0xc94b('0x49')](_0x26c6ea[_0xc94b('0x4a')],{})[_0xc94b('0x24')](respondWithResult(_0x531467,0xc9))['catch'](handleError(_0x531467,null));};exports[_0xc94b('0x23')]=function(_0x3101d5,_0x49d723){if(_0x3101d5['body']['id']){delete _0x3101d5[_0xc94b('0x4a')]['id'];}return db[_0xc94b('0x3f')]['find']({'where':{'id':_0x3101d5['params']['id']}})[_0xc94b('0x24')](handleEntityNotFound(_0x49d723,null))[_0xc94b('0x24')](saveUpdates(_0x3101d5[_0xc94b('0x4a')],null))[_0xc94b('0x24')](respondWithResult(_0x49d723,null))[_0xc94b('0x44')](handleError(_0x49d723,null));};exports[_0xc94b('0x4b')]=function(_0x80152e,_0x2f6440){return db['FreshsalesAccount'][_0xc94b('0x48')]({'where':{'id':_0x80152e[_0xc94b('0x46')]['id']}})[_0xc94b('0x24')](handleEntityNotFound(_0x2f6440,null))[_0xc94b('0x24')](removeEntity(_0x2f6440,null))['catch'](handleError(_0x2f6440,null));};exports[_0xc94b('0x4c')]=function(_0x70361a,_0x487b93,_0x505316){var _0xfea91a={};var _0x554441={};var _0x1ba334;var _0x52369e;return db[_0xc94b('0x3f')]['findOne']({'where':{'id':_0x70361a[_0xc94b('0x46')]['id']}})[_0xc94b('0x24')](handleEntityNotFound(_0x487b93,null))['then'](function(_0x3c788a){if(_0x3c788a){_0x1ba334=_0x3c788a;_0x554441[_0xc94b('0x35')]=_[_0xc94b('0x2f')](db['FreshsalesConfiguration'][_0xc94b('0x2a')]);_0x554441[_0xc94b('0x2e')]=_[_0xc94b('0x2f')](_0x70361a['query']);_0x554441[_0xc94b('0x30')]=_['intersection'](_0x554441[_0xc94b('0x35')],_0x554441[_0xc94b('0x2e')]);_0xfea91a[_0xc94b('0x32')]=_[_0xc94b('0x31')](_0x554441['model'],qs[_0xc94b('0x33')](_0x70361a[_0xc94b('0x2e')]['fields']));_0xfea91a[_0xc94b('0x32')]=_0xfea91a[_0xc94b('0x32')]['length']?_0xfea91a[_0xc94b('0x32')]:_0x554441[_0xc94b('0x35')];_0xfea91a[_0xc94b('0x38')]=qs[_0xc94b('0x39')](_0x70361a[_0xc94b('0x2e')][_0xc94b('0x39')]);_0xfea91a[_0xc94b('0x3a')]=qs['filters'](_[_0xc94b('0x3b')](_0x70361a[_0xc94b('0x2e')],_0x554441['filters']));if(_0x70361a[_0xc94b('0x2e')][_0xc94b('0x3c')]){_0xfea91a[_0xc94b('0x3a')]=_[_0xc94b('0x3d')](_0xfea91a['where'],{'$or':_[_0xc94b('0x29')](_0xfea91a[_0xc94b('0x32')],function(_0x45417a){var _0x2738d0={};_0x2738d0[_0x45417a]={'$like':'%'+_0x70361a[_0xc94b('0x2e')][_0xc94b('0x3c')]+'%'};return _0x2738d0;})});}_0xfea91a=_[_0xc94b('0x3d')]({},_0xfea91a,_0x70361a[_0xc94b('0x47')]);return _0x1ba334[_0xc94b('0x4c')](_0xfea91a);}})['then'](function(_0x4d03d1){if(_0x4d03d1){_0x52369e=_0x4d03d1['length'];if(!_0x70361a['query'][_0xc94b('0x36')](_0xc94b('0x37'))){_0xfea91a[_0xc94b('0x1c')]=qs[_0xc94b('0x1c')](_0x70361a[_0xc94b('0x2e')][_0xc94b('0x1c')]);_0xfea91a[_0xc94b('0x1a')]=qs[_0xc94b('0x1a')](_0x70361a[_0xc94b('0x2e')]['offset']);}return _0x1ba334[_0xc94b('0x4c')](_0xfea91a);}})[_0xc94b('0x24')](function(_0x2be4ed){if(_0x2be4ed){return _0x2be4ed?{'count':_0x52369e,'rows':_0x2be4ed}:null;}})[_0xc94b('0x24')](respondWithResult(_0x487b93,null))[_0xc94b('0x44')](handleError(_0x487b93,null));};exports[_0xc94b('0x4d')]=function(_0x5e212c,_0x369c52,_0x50b22e){if(_0x5e212c[_0xc94b('0x4a')]['id']){delete _0x5e212c[_0xc94b('0x4a')]['id'];}return db[_0xc94b('0x3f')][_0xc94b('0x4e')]({'where':{'id':_0x5e212c['params']['id']}})[_0xc94b('0x24')](handleEntityNotFound(_0x369c52,null))['then'](function(_0x2d4ccd){if(_0x2d4ccd){_0x5e212c[_0xc94b('0x4a')][_0xc94b('0x4f')]=_0x2d4ccd['id'];_0x5e212c['body'][_0xc94b('0x50')]=integrations[_0xc94b('0x51')](_0x5e212c[_0xc94b('0x4a')][_0xc94b('0x52')],_0x5e212c[_0xc94b('0x4a')][_0xc94b('0x2c')]);_0x5e212c[_0xc94b('0x4a')][_0xc94b('0x53')]=integrations[_0xc94b('0x54')](_0x5e212c[_0xc94b('0x4a')][_0xc94b('0x52')],_0x5e212c[_0xc94b('0x4a')][_0xc94b('0x2c')]);return db[_0xc94b('0x55')][_0xc94b('0x49')](_0x5e212c[_0xc94b('0x4a')],{'include':[{'model':db['FreshsalesField'],'as':_0xc94b('0x50')},{'model':db['FreshsalesField'],'as':_0xc94b('0x53')}]});}return null;})[_0xc94b('0x24')](respondWithResult(_0x369c52,null))['catch'](handleError(_0x369c52,null));};exports['getFields']=function(_0x1792fc,_0x2028df,_0x58f0f8){var _0x273ea7='';var _0x2b908f='';return db['FreshsalesAccount'][_0xc94b('0x4e')]({'where':{'id':_0x1792fc[_0xc94b('0x46')]['id']},'attributes':['id',_0xc94b('0x56'),_0xc94b('0x57'),_0xc94b('0x58')]})[_0xc94b('0x24')](handleEntityNotFound(_0x2028df,null))[_0xc94b('0x24')](function(_0x471b05){if(_0x471b05){_0x2b908f=_0x471b05['username'];_0x273ea7=_0x471b05[_0xc94b('0x57')];var _0x1c82dc=_0x471b05[_0xc94b('0x57')][_0xc94b('0x59')](-0x1);if(_0x1c82dc==='/'){_0x273ea7=_0x273ea7['substring'](0x0,_0x273ea7[_0xc94b('0x5a')](_0x1c82dc));}return rp({'method':_0xc94b('0x5b'),'uri':util[_0xc94b('0x5c')]('%s%s',_0x273ea7,_0xc94b('0x5d')),'headers':{'Authorization':_0xc94b('0x5e')+_0x471b05[_0xc94b('0x58')]},'json':!![]});}})[_0xc94b('0x24')](function(_0xd3dfbd){if(_0xd3dfbd){var _0x2c3c9d=_0xd3dfbd[_0xc94b('0x5f')];var _0x93428=![];var _0x923e85=null;for(_0x923e85=0x0;_0x923e85<_0x2c3c9d[_0xc94b('0x34')];_0x923e85++){if(_0x2c3c9d[_0x923e85]['email']===_0x2b908f){_0x93428=!![];}}if(_0x93428){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xc94b('0x60')});}}})[_0xc94b('0x24')](respondWithResult(_0x2028df,null))[_0xc94b('0x44')](function(_0x1c68ba){var _0x956328=_0x1792fc[_0xc94b('0x2e')][_0xc94b('0x61')]?0x1f4:_0x1c68ba['statusCode']||0x1f4;logger[_0xc94b('0x25')](_0xc94b('0x62'),_0xc94b('0x63'),_0x956328,JSON[_0xc94b('0x64')](_0x1c68ba));delete _0x1c68ba[_0xc94b('0x26')];if(_0x956328===0x191){_0x956328=0x190;}_0x2028df['status'](_0x956328)[_0xc94b('0x27')](_0x1792fc['query'][_0xc94b('0x61')]?{'message':_0xc94b('0x65'),'statusCode':_0x1c68ba['statusCode']}:_0x1c68ba);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index f3bb43b..bf9dd3c 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 _0x25e7=['request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2c0498,_0x629849){var _0x39a215=function(_0x2602a2){while(--_0x2602a2){_0x2c0498['push'](_0x2c0498['shift']());}};_0x39a215(++_0x629849);}(_0x25e7,0x1d6));var _0x725e=function(_0x52bb76,_0x325703){_0x52bb76=_0x52bb76-0x0;var _0x2f2f21=_0x25e7[_0x52bb76];return _0x2f2f21;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var logger=require(_0x725e('0x2'))(_0x725e('0x3'));var moment=require(_0x725e('0x4'));var BPromise=require(_0x725e('0x5'));var rp=require(_0x725e('0x6'));var fs=require('fs');var path=require(_0x725e('0x7'));var rimraf=require(_0x725e('0x8'));var config=require(_0x725e('0x9'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x725e('0xa')]=function(_0x480945,_0x481316){return _0x480945[_0x725e('0xb')](_0x725e('0xc'),attributes,{'tableName':_0x725e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4137=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','lodash','util','../../config/logger','api'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4137,0xf8));var _0x7413=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4137[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var logger=require(_0x7413('0x2'))(_0x7413('0x3'));var moment=require(_0x7413('0x4'));var BPromise=require(_0x7413('0x5'));var rp=require(_0x7413('0x6'));var fs=require('fs');var path=require(_0x7413('0x7'));var rimraf=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var attributes=require(_0x7413('0xa'));var integrations=require(_0x7413('0xb'));module['exports']=function(_0xc808cd,_0x188d89){return _0xc808cd[_0x7413('0xc')](_0x7413('0xd'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 1e70c3d..16532ad 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 _0xcaf2=['raw','attributes','limit','include','map','model','GetFreshsalesAccount','stringify','catch','ShowFreshsalesAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','FreshsalesAccount','options'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcaf2,0x8a));var _0x2caf=function(_0x174202,_0x5c5292){_0x174202=_0x174202-0x0;var _0x4daa4a=_0xcaf2[_0x174202];return _0x4daa4a;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var moment=require(_0x2caf('0x1'));var BPromise=require(_0x2caf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2caf('0x3'));var db=require(_0x2caf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2caf('0x5'))('rpc');var config=require(_0x2caf('0x6'));var jayson=require(_0x2caf('0x7'));var client=jayson[_0x2caf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc44e4e,_0x314486,_0x4667c6){return new BPromise(function(_0x34e792,_0x5611aa){return client[_0x2caf('0x9')](_0xc44e4e,_0x4667c6)[_0x2caf('0xa')](function(_0x45e520){logger[_0x2caf('0xb')](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));logger[_0x2caf('0xe')](_0x2caf('0xf'),_0x314486,_0x2caf('0xd'),JSON['stringify'](_0x45e520));if(_0x45e520[_0x2caf('0x10')]){if(_0x45e520[_0x2caf('0x10')][_0x2caf('0x11')]===0x1f4){logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520[_0x2caf('0x10')][_0x2caf('0x12')]);return _0x5611aa(_0x45e520[_0x2caf('0x10')]['message']);}logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520['error']['message']);return _0x34e792(_0x45e520['error'][_0x2caf('0x12')]);}else{logger['info'](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));_0x34e792(_0x45e520[_0x2caf('0x13')][_0x2caf('0x12')]);}})['catch'](function(_0x184355){logger['error'](_0x2caf('0xc'),_0x314486,_0x184355);_0x5611aa(_0x184355);});});}exports['GetFreshsalesAccount']=function(_0x4a33fc){var _0x3e975f=this;return new Promise(function(_0x58047b,_0xe72440){return db[_0x2caf('0x14')]['findAll']({'raw':_0x4a33fc[_0x2caf('0x15')]?_0x4a33fc[_0x2caf('0x15')][_0x2caf('0x16')]===undefined?!![]:![]:!![],'where':_0x4a33fc[_0x2caf('0x15')]?_0x4a33fc[_0x2caf('0x15')]['where']||null:null,'attributes':_0x4a33fc[_0x2caf('0x15')]?_0x4a33fc[_0x2caf('0x15')][_0x2caf('0x17')]||null:null,'limit':_0x4a33fc[_0x2caf('0x15')]?_0x4a33fc[_0x2caf('0x15')][_0x2caf('0x18')]||null:null,'include':_0x4a33fc[_0x2caf('0x15')]?_0x4a33fc[_0x2caf('0x15')][_0x2caf('0x19')]?_[_0x2caf('0x1a')](_0x4a33fc[_0x2caf('0x15')]['include'],function(_0x296305){return{'model':db[_0x296305[_0x2caf('0x1b')]],'as':_0x296305['as'],'attributes':_0x296305[_0x2caf('0x17')],'include':_0x296305[_0x2caf('0x19')]?_[_0x2caf('0x1a')](_0x296305[_0x2caf('0x19')],function(_0x392196){return{'model':db[_0x392196[_0x2caf('0x1b')]],'as':_0x392196['as'],'attributes':_0x392196[_0x2caf('0x17')],'include':_0x392196[_0x2caf('0x19')]?_['map'](_0x392196[_0x2caf('0x19')],function(_0x325eda){return{'model':db[_0x325eda[_0x2caf('0x1b')]],'as':_0x325eda['as'],'attributes':_0x325eda[_0x2caf('0x17')]};}):[]};}):[]};}):[]:[]})[_0x2caf('0xa')](function(_0x17d3c6){logger[_0x2caf('0xb')](_0x2caf('0x1c'),_0x4a33fc);logger[_0x2caf('0xe')](_0x2caf('0x1c'),_0x4a33fc,JSON[_0x2caf('0x1d')](_0x17d3c6));_0x58047b(_0x17d3c6);})[_0x2caf('0x1e')](function(_0x158d60){logger['error'](_0x2caf('0x1c'),_0x158d60[_0x2caf('0x12')],_0x4a33fc);_0xe72440(_0x3e975f[_0x2caf('0x10')](0x1f4,_0x158d60[_0x2caf('0x12')]));});});};exports[_0x2caf('0x1f')]=function(_0x1f52bf){var _0x3812cd=this;return new Promise(function(_0x524e0c,_0x21b3c4){return db[_0x2caf('0x14')]['find']({'raw':_0x1f52bf[_0x2caf('0x15')]?_0x1f52bf[_0x2caf('0x15')][_0x2caf('0x16')]===undefined?!![]:![]:!![],'where':_0x1f52bf['options']?_0x1f52bf[_0x2caf('0x15')]['where']||null:null,'attributes':_0x1f52bf['options']?_0x1f52bf[_0x2caf('0x15')][_0x2caf('0x17')]||null:null,'include':_0x1f52bf[_0x2caf('0x15')]?_0x1f52bf[_0x2caf('0x15')][_0x2caf('0x19')]?_[_0x2caf('0x1a')](_0x1f52bf[_0x2caf('0x15')][_0x2caf('0x19')],function(_0x20818e){return{'model':db[_0x20818e['model']],'as':_0x20818e['as'],'attributes':_0x20818e[_0x2caf('0x17')],'include':_0x20818e[_0x2caf('0x19')]?_[_0x2caf('0x1a')](_0x20818e[_0x2caf('0x19')],function(_0x17c1b4){return{'model':db[_0x17c1b4[_0x2caf('0x1b')]],'as':_0x17c1b4['as'],'attributes':_0x17c1b4[_0x2caf('0x17')],'include':_0x17c1b4[_0x2caf('0x19')]?_[_0x2caf('0x1a')](_0x17c1b4[_0x2caf('0x19')],function(_0x105ec7){return{'model':db[_0x105ec7[_0x2caf('0x1b')]],'as':_0x105ec7['as'],'attributes':_0x105ec7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x410020){logger[_0x2caf('0xb')](_0x2caf('0x1f'),_0x1f52bf);logger[_0x2caf('0xe')]('ShowFreshsalesAccount',_0x1f52bf,JSON[_0x2caf('0x1d')](_0x410020));_0x524e0c(_0x410020);})[_0x2caf('0x1e')](function(_0x4568f9){logger[_0x2caf('0x10')](_0x2caf('0x1f'),_0x4568f9[_0x2caf('0x12')],_0x1f52bf);_0x21b3c4(_0x3812cd[_0x2caf('0x10')](0x1f4,_0x4568f9[_0x2caf('0x12')]));});});}; \ No newline at end of file +var _0x6050=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','limit','map','include','model','ShowFreshsalesAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5ae89c,_0x1d183a){var _0x566bfc=function(_0x425371){while(--_0x425371){_0x5ae89c['push'](_0x5ae89c['shift']());}};_0x566bfc(++_0x1d183a);}(_0x6050,0x196));var _0x0605=function(_0x5daea4,_0x533cc6){_0x5daea4=_0x5daea4-0x0;var _0xbb5fa=_0x6050[_0x5daea4];return _0xbb5fa;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var moment=require(_0x0605('0x2'));var BPromise=require(_0x0605('0x3'));var rs=require(_0x0605('0x4'));var fs=require('fs');var Redis=require(_0x0605('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0605('0x6'));var logger=require(_0x0605('0x7'))(_0x0605('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0605('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x578623,_0x58f7d2,_0x5660ad){return new BPromise(function(_0x1629bf,_0x11b8b5){return client[_0x0605('0xa')](_0x578623,_0x5660ad)[_0x0605('0xb')](function(_0x44fdd3){logger['info'](_0x0605('0xc'),_0x58f7d2,_0x0605('0xd'));logger[_0x0605('0xe')](_0x0605('0xf'),_0x58f7d2,_0x0605('0xd'),JSON[_0x0605('0x10')](_0x44fdd3));if(_0x44fdd3[_0x0605('0x11')]){if(_0x44fdd3[_0x0605('0x11')][_0x0605('0x12')]===0x1f4){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x11b8b5(_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);}logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0x44fdd3[_0x0605('0x11')][_0x0605('0x13')]);return _0x1629bf(_0x44fdd3['error'][_0x0605('0x13')]);}else{logger[_0x0605('0x14')](_0x0605('0xc'),_0x58f7d2,'request\x20sent');_0x1629bf(_0x44fdd3['result'][_0x0605('0x13')]);}})[_0x0605('0x15')](function(_0xa83443){logger[_0x0605('0x11')](_0x0605('0xc'),_0x58f7d2,_0xa83443);_0x11b8b5(_0xa83443);});});}exports[_0x0605('0x16')]=function(_0x2b7b5a){var _0x1d57ba=this;return new Promise(function(_0x193520,_0x40abb2){return db[_0x0605('0x17')][_0x0605('0x18')]({'raw':_0x2b7b5a[_0x0605('0x19')]?_0x2b7b5a[_0x0605('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2b7b5a[_0x0605('0x19')]?_0x2b7b5a[_0x0605('0x19')][_0x0605('0x1a')]||null:null,'attributes':_0x2b7b5a[_0x0605('0x19')]?_0x2b7b5a[_0x0605('0x19')][_0x0605('0x1b')]||null:null,'limit':_0x2b7b5a[_0x0605('0x19')]?_0x2b7b5a[_0x0605('0x19')][_0x0605('0x1c')]||null:null,'include':_0x2b7b5a['options']?_0x2b7b5a[_0x0605('0x19')]['include']?_[_0x0605('0x1d')](_0x2b7b5a[_0x0605('0x19')][_0x0605('0x1e')],function(_0xf182c4){return{'model':db[_0xf182c4[_0x0605('0x1f')]],'as':_0xf182c4['as'],'attributes':_0xf182c4[_0x0605('0x1b')],'include':_0xf182c4[_0x0605('0x1e')]?_[_0x0605('0x1d')](_0xf182c4[_0x0605('0x1e')],function(_0x2896d7){return{'model':db[_0x2896d7[_0x0605('0x1f')]],'as':_0x2896d7['as'],'attributes':_0x2896d7[_0x0605('0x1b')],'include':_0x2896d7['include']?_[_0x0605('0x1d')](_0x2896d7[_0x0605('0x1e')],function(_0x4b1e0c){return{'model':db[_0x4b1e0c['model']],'as':_0x4b1e0c['as'],'attributes':_0x4b1e0c['attributes']};}):[]};}):[]};}):[]:[]})[_0x0605('0xb')](function(_0x226825){logger[_0x0605('0x14')](_0x0605('0x16'),_0x2b7b5a);logger[_0x0605('0xe')](_0x0605('0x16'),_0x2b7b5a,JSON['stringify'](_0x226825));_0x193520(_0x226825);})[_0x0605('0x15')](function(_0x5daef6){logger[_0x0605('0x11')](_0x0605('0x16'),_0x5daef6[_0x0605('0x13')],_0x2b7b5a);_0x40abb2(_0x1d57ba[_0x0605('0x11')](0x1f4,_0x5daef6[_0x0605('0x13')]));});});};exports[_0x0605('0x20')]=function(_0x56dd1a){var _0x165a0c=this;return new Promise(function(_0xf885cc,_0x2764b6){return db[_0x0605('0x17')][_0x0605('0x21')]({'raw':_0x56dd1a[_0x0605('0x19')]?_0x56dd1a[_0x0605('0x19')][_0x0605('0x22')]===undefined?!![]:![]:!![],'where':_0x56dd1a[_0x0605('0x19')]?_0x56dd1a[_0x0605('0x19')][_0x0605('0x1a')]||null:null,'attributes':_0x56dd1a[_0x0605('0x19')]?_0x56dd1a[_0x0605('0x19')][_0x0605('0x1b')]||null:null,'include':_0x56dd1a[_0x0605('0x19')]?_0x56dd1a[_0x0605('0x19')][_0x0605('0x1e')]?_[_0x0605('0x1d')](_0x56dd1a[_0x0605('0x19')][_0x0605('0x1e')],function(_0x3a1c75){return{'model':db[_0x3a1c75[_0x0605('0x1f')]],'as':_0x3a1c75['as'],'attributes':_0x3a1c75[_0x0605('0x1b')],'include':_0x3a1c75[_0x0605('0x1e')]?_[_0x0605('0x1d')](_0x3a1c75[_0x0605('0x1e')],function(_0xe7701d){return{'model':db[_0xe7701d['model']],'as':_0xe7701d['as'],'attributes':_0xe7701d[_0x0605('0x1b')],'include':_0xe7701d[_0x0605('0x1e')]?_['map'](_0xe7701d[_0x0605('0x1e')],function(_0x128428){return{'model':db[_0x128428['model']],'as':_0x128428['as'],'attributes':_0x128428[_0x0605('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0605('0xb')](function(_0x239e8f){logger[_0x0605('0x14')](_0x0605('0x20'),_0x56dd1a);logger[_0x0605('0xe')]('ShowFreshsalesAccount',_0x56dd1a,JSON['stringify'](_0x239e8f));_0xf885cc(_0x239e8f);})[_0x0605('0x15')](function(_0x18f7f2){logger[_0x0605('0x11')]('ShowFreshsalesAccount',_0x18f7f2[_0x0605('0x13')],_0x56dd1a);_0x2764b6(_0x165a0c['error'](0x1f4,_0x18f7f2[_0x0605('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 027b952..5daea7a 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 _0x6b0a=['create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','index','get','isAuthenticated','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x6b0a,0x74));var _0xa6b0=function(_0x53fc26,_0x415acb){_0x53fc26=_0x53fc26-0x0;var _0x24faec=_0x6b0a[_0x53fc26];return _0x24faec;};'use strict';var multer=require(_0xa6b0('0x0'));var util=require('util');var path=require(_0xa6b0('0x1'));var timeout=require(_0xa6b0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa6b0('0x3'));var auth=require(_0xa6b0('0x4'));var interaction=require(_0xa6b0('0x5'));var config=require('../../config/environment');var controller=require(_0xa6b0('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa6b0('0x7')]);router[_0xa6b0('0x8')]('/:id',auth[_0xa6b0('0x9')](),controller[_0xa6b0('0xa')]);router[_0xa6b0('0x8')](_0xa6b0('0xb'),auth[_0xa6b0('0x9')](),controller['getSubjects']);router[_0xa6b0('0x8')](_0xa6b0('0xc'),auth['isAuthenticated'](),controller[_0xa6b0('0xd')]);router[_0xa6b0('0x8')](_0xa6b0('0xe'),auth['isAuthenticated'](),controller[_0xa6b0('0xf')]);router['post']('/',auth[_0xa6b0('0x9')](),controller[_0xa6b0('0x10')]);router['put'](_0xa6b0('0x11'),auth[_0xa6b0('0x9')](),controller[_0xa6b0('0x12')]);router[_0xa6b0('0x13')](_0xa6b0('0x11'),auth['isAuthenticated'](),controller[_0xa6b0('0x14')]);module[_0xa6b0('0x15')]=router; \ No newline at end of file +var _0xbd87=['../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xbd87,0xb6));var _0x7bd8=function(_0x5314c9,_0x232b58){_0x5314c9=_0x5314c9-0x0;var _0x54b066=_0xbd87[_0x5314c9];return _0x54b066;};'use strict';var multer=require(_0x7bd8('0x0'));var util=require(_0x7bd8('0x1'));var path=require(_0x7bd8('0x2'));var timeout=require(_0x7bd8('0x3'));var express=require(_0x7bd8('0x4'));var router=express[_0x7bd8('0x5')]();var fs_extra=require(_0x7bd8('0x6'));var auth=require(_0x7bd8('0x7'));var interaction=require(_0x7bd8('0x8'));var config=require('../../config/environment');var controller=require(_0x7bd8('0x9'));router[_0x7bd8('0xa')]('/',auth[_0x7bd8('0xb')](),controller[_0x7bd8('0xc')]);router[_0x7bd8('0xa')](_0x7bd8('0xd'),auth[_0x7bd8('0xb')](),controller[_0x7bd8('0xe')]);router['get'](_0x7bd8('0xf'),auth['isAuthenticated'](),controller[_0x7bd8('0x10')]);router[_0x7bd8('0xa')](_0x7bd8('0x11'),auth[_0x7bd8('0xb')](),controller['getDescriptions']);router['get'](_0x7bd8('0x12'),auth[_0x7bd8('0xb')](),controller[_0x7bd8('0x13')]);router[_0x7bd8('0x14')]('/',auth[_0x7bd8('0xb')](),controller[_0x7bd8('0x15')]);router[_0x7bd8('0x16')](_0x7bd8('0xd'),auth[_0x7bd8('0xb')](),controller[_0x7bd8('0x17')]);router[_0x7bd8('0x18')](_0x7bd8('0xd'),auth[_0x7bd8('0xb')](),controller[_0x7bd8('0x19')]);module[_0x7bd8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index c8303c1..47d2f7b 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 _0x9f9d=['exports','STRING'];(function(_0x48ad11,_0x52a7f1){var _0x5a0be9=function(_0x3aca25){while(--_0x3aca25){_0x48ad11['push'](_0x48ad11['shift']());}};_0x5a0be9(++_0x52a7f1);}(_0x9f9d,0x1ea));var _0xd9f9=function(_0x4882a7,_0x235bc4){_0x4882a7=_0x4882a7-0x0;var _0x31a22c=_0x9f9d[_0x4882a7];return _0x31a22c;};'use strict';var Sequelize=require('sequelize');module[_0xd9f9('0x0')]={'name':{'type':Sequelize[_0xd9f9('0x1')]},'description':{'type':Sequelize[_0xd9f9('0x1')]}}; \ No newline at end of file +var _0x92e3=['STRING','sequelize'];(function(_0x16f05d,_0x2d6fc0){var _0x3b9219=function(_0x325e1f){while(--_0x325e1f){_0x16f05d['push'](_0x16f05d['shift']());}};_0x3b9219(++_0x2d6fc0);}(_0x92e3,0xd9));var _0x392e=function(_0x24ee98,_0x24ffe6){_0x24ee98=_0x24ee98-0x0;var _0x203983=_0x92e3[_0x24ee98];return _0x203983;};'use strict';var Sequelize=require(_0x392e('0x0'));module['exports']={'name':{'type':Sequelize[_0x392e('0x1')]},'description':{'type':Sequelize[_0x392e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index ef91313..f05087b 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 _0xcbe4=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','save','update','then','end','sendStatus','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','catch','show','params','intersection','find','body','destroy','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x258d97,_0x28a8b3){var _0x53b11b=function(_0x35eb1b){while(--_0x35eb1b){_0x258d97['push'](_0x258d97['shift']());}};_0x53b11b(++_0x28a8b3);}(_0xcbe4,0xef));var _0x4cbe=function(_0x28430b,_0x59fcfb){_0x28430b=_0x28430b-0x0;var _0x22c857=_0xcbe4[_0x28430b];return _0x22c857;};'use strict';var emlformat=require(_0x4cbe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4cbe('0x1'));var jsonpatch=require(_0x4cbe('0x2'));var rp=require(_0x4cbe('0x3'));var moment=require(_0x4cbe('0x4'));var BPromise=require(_0x4cbe('0x5'));var Mustache=require(_0x4cbe('0x6'));var util=require(_0x4cbe('0x7'));var path=require(_0x4cbe('0x8'));var sox=require(_0x4cbe('0x9'));var csv=require(_0x4cbe('0xa'));var ejs=require(_0x4cbe('0xb'));var fs=require('fs');var fs_extra=require(_0x4cbe('0xc'));var _=require(_0x4cbe('0xd'));var squel=require(_0x4cbe('0xe'));var crypto=require(_0x4cbe('0xf'));var jsforce=require(_0x4cbe('0x10'));var deskjs=require(_0x4cbe('0x11'));var toCsv=require(_0x4cbe('0xa'));var querystring=require(_0x4cbe('0x12'));var Papa=require('papaparse');var Redis=require(_0x4cbe('0x13'));var authService=require(_0x4cbe('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4cbe('0x15'));var hardwareService=require(_0x4cbe('0x16'));var logger=require(_0x4cbe('0x17'))(_0x4cbe('0x18'));var utils=require(_0x4cbe('0x19'));var config=require(_0x4cbe('0x1a'));var licenseUtil=require(_0x4cbe('0x1b'));var db=require(_0x4cbe('0x1c'))['db'];function respondWithStatusCode(_0xed767d,_0x2ab499){_0x2ab499=_0x2ab499||0xcc;return function(_0x1d0a43){if(_0x1d0a43){return _0xed767d['sendStatus'](_0x2ab499);}return _0xed767d[_0x4cbe('0x1d')](_0x2ab499)['end']();};}function respondWithResult(_0x176e02,_0xd19e7c){_0xd19e7c=_0xd19e7c||0xc8;return function(_0x497d3f){if(_0x497d3f){return _0x176e02[_0x4cbe('0x1d')](_0xd19e7c)[_0x4cbe('0x1e')](_0x497d3f);}};}function respondWithFilteredResult(_0x534035,_0x40a1d2){return function(_0x58e68a){if(_0x58e68a){var _0x18aa11=typeof _0x40a1d2['offset']===_0x4cbe('0x1f')&&typeof _0x40a1d2['limit']==='undefined';var _0x170de=_0x58e68a[_0x4cbe('0x20')];var _0x92e53f=_0x18aa11?0x0:_0x40a1d2[_0x4cbe('0x21')];var _0x924fe2=_0x18aa11?_0x58e68a[_0x4cbe('0x20')]:_0x40a1d2['offset']+_0x40a1d2[_0x4cbe('0x22')];var _0x258ffd;if(_0x924fe2>=_0x170de){_0x924fe2=_0x170de;_0x258ffd=0xc8;}else{_0x258ffd=0xce;}_0x534035[_0x4cbe('0x1d')](_0x258ffd);return _0x534035[_0x4cbe('0x23')](_0x4cbe('0x24'),_0x92e53f+'-'+_0x924fe2+'/'+_0x170de)[_0x4cbe('0x1e')](_0x58e68a);}return null;};}function patchUpdates(_0x4f3126){return function(_0x34d9d3){try{jsonpatch['apply'](_0x34d9d3,_0x4f3126,!![]);}catch(_0x5cd31c){return BPromise['reject'](_0x5cd31c);}return _0x34d9d3[_0x4cbe('0x25')]();};}function saveUpdates(_0x410654,_0x526e30){return function(_0x4978b2){if(_0x4978b2){return _0x4978b2[_0x4cbe('0x26')](_0x410654)[_0x4cbe('0x27')](function(_0x308229){return _0x308229;});}return null;};}function removeEntity(_0x66720b,_0x574ed0){return function(_0x5ae37c){if(_0x5ae37c){return _0x5ae37c['destroy']()[_0x4cbe('0x27')](function(){_0x66720b[_0x4cbe('0x1d')](0xcc)[_0x4cbe('0x28')]();});}};}function handleEntityNotFound(_0x5d6926,_0x102d16){return function(_0xd87957){if(!_0xd87957){_0x5d6926[_0x4cbe('0x29')](0x194);}return _0xd87957;};}function handleError(_0x4b443b,_0x327e8b){_0x327e8b=_0x327e8b||0x1f4;return function(_0x1dd091){logger['error'](_0x1dd091[_0x4cbe('0x2a')]);if(_0x1dd091[_0x4cbe('0x2b')]){delete _0x1dd091[_0x4cbe('0x2b')];}_0x4b443b[_0x4cbe('0x1d')](_0x327e8b)[_0x4cbe('0x2c')](_0x1dd091);};}exports[_0x4cbe('0x2d')]=function(_0x1ef38d,_0x38f1fa){var _0x4a5060={},_0x62c6e5={},_0x4713f3={'count':0x0,'rows':[]};var _0x4d8cdc=_[_0x4cbe('0x2e')](db[_0x4cbe('0x2f')][_0x4cbe('0x30')],function(_0x12c170){return{'name':_0x12c170['fieldName'],'type':_0x12c170[_0x4cbe('0x31')][_0x4cbe('0x32')]};});_0x62c6e5[_0x4cbe('0x33')]=_[_0x4cbe('0x2e')](_0x4d8cdc,_0x4cbe('0x2b'));_0x62c6e5[_0x4cbe('0x34')]=_[_0x4cbe('0x35')](_0x1ef38d['query']);_0x62c6e5[_0x4cbe('0x36')]=_['intersection'](_0x62c6e5[_0x4cbe('0x33')],_0x62c6e5[_0x4cbe('0x34')]);_0x4a5060['attributes']=_['intersection'](_0x62c6e5[_0x4cbe('0x33')],qs[_0x4cbe('0x37')](_0x1ef38d[_0x4cbe('0x34')]['fields']));_0x4a5060[_0x4cbe('0x38')]=_0x4a5060['attributes'][_0x4cbe('0x39')]?_0x4a5060[_0x4cbe('0x38')]:_0x62c6e5['model'];if(!_0x1ef38d[_0x4cbe('0x34')][_0x4cbe('0x3a')](_0x4cbe('0x3b'))){_0x4a5060['limit']=qs[_0x4cbe('0x22')](_0x1ef38d['query'][_0x4cbe('0x22')]);_0x4a5060[_0x4cbe('0x21')]=qs[_0x4cbe('0x21')](_0x1ef38d['query'][_0x4cbe('0x21')]);}_0x4a5060[_0x4cbe('0x3c')]=qs[_0x4cbe('0x3d')](_0x1ef38d[_0x4cbe('0x34')][_0x4cbe('0x3d')]);_0x4a5060[_0x4cbe('0x3e')]=qs[_0x4cbe('0x36')](_[_0x4cbe('0x3f')](_0x1ef38d['query'],_0x62c6e5[_0x4cbe('0x36')]),_0x4d8cdc);if(_0x1ef38d[_0x4cbe('0x34')]['filter']){_0x4a5060['where']=_[_0x4cbe('0x40')](_0x4a5060[_0x4cbe('0x3e')],{'$or':_[_0x4cbe('0x2e')](_0x4d8cdc,function(_0xd5fff6){if(_0xd5fff6['type']!=='VIRTUAL'){var _0xf8490f={};_0xf8490f[_0xd5fff6[_0x4cbe('0x2b')]]={'$like':'%'+_0x1ef38d[_0x4cbe('0x34')][_0x4cbe('0x41')]+'%'};return _0xf8490f;}})});}_0x4a5060=_['merge']({},_0x4a5060,_0x1ef38d[_0x4cbe('0x42')]);var _0x262d09={'where':_0x4a5060['where']};return db[_0x4cbe('0x2f')][_0x4cbe('0x20')](_0x262d09)['then'](function(_0x9eb019){_0x4713f3[_0x4cbe('0x20')]=_0x9eb019;if(_0x1ef38d[_0x4cbe('0x34')]['includeAll']){_0x4a5060[_0x4cbe('0x43')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x4cbe('0x44')](_0x4a5060);})[_0x4cbe('0x27')](function(_0x123b86){_0x4713f3['rows']=_0x123b86;return _0x4713f3;})['then'](respondWithFilteredResult(_0x38f1fa,_0x4a5060))[_0x4cbe('0x45')](handleError(_0x38f1fa,null));};exports[_0x4cbe('0x46')]=function(_0x1251f5,_0x1131d9){var _0xb0a359={'raw':![],'where':{'id':_0x1251f5[_0x4cbe('0x47')]['id']}},_0x18eee3={};_0x18eee3['model']=_[_0x4cbe('0x35')](db[_0x4cbe('0x2f')][_0x4cbe('0x30')]);_0x18eee3[_0x4cbe('0x34')]=_[_0x4cbe('0x35')](_0x1251f5['query']);_0x18eee3[_0x4cbe('0x36')]=_['intersection'](_0x18eee3[_0x4cbe('0x33')],_0x18eee3[_0x4cbe('0x34')]);_0xb0a359[_0x4cbe('0x38')]=_[_0x4cbe('0x48')](_0x18eee3[_0x4cbe('0x33')],qs[_0x4cbe('0x37')](_0x1251f5[_0x4cbe('0x34')]['fields']));_0xb0a359[_0x4cbe('0x38')]=_0xb0a359[_0x4cbe('0x38')][_0x4cbe('0x39')]?_0xb0a359['attributes']:_0x18eee3[_0x4cbe('0x33')];if(_0x1251f5[_0x4cbe('0x34')]['includeAll']){_0xb0a359['include']=[{'all':!![]}];}_0xb0a359=_[_0x4cbe('0x40')]({},_0xb0a359,_0x1251f5['options']);return db[_0x4cbe('0x2f')][_0x4cbe('0x49')](_0xb0a359)[_0x4cbe('0x27')](handleEntityNotFound(_0x1131d9,null))[_0x4cbe('0x27')](respondWithResult(_0x1131d9,null))[_0x4cbe('0x45')](handleError(_0x1131d9,null));};exports['create']=function(_0x14314b,_0x181f8b){return db[_0x4cbe('0x2f')]['create'](_0x14314b['body'],{})['then'](respondWithResult(_0x181f8b,0xc9))['catch'](handleError(_0x181f8b,null));};exports[_0x4cbe('0x26')]=function(_0x328acc,_0x144cc3){if(_0x328acc['body']['id']){delete _0x328acc['body']['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x328acc[_0x4cbe('0x47')]['id']}})[_0x4cbe('0x27')](handleEntityNotFound(_0x144cc3,null))[_0x4cbe('0x27')](saveUpdates(_0x328acc[_0x4cbe('0x4a')],null))[_0x4cbe('0x27')](respondWithResult(_0x144cc3,null))[_0x4cbe('0x45')](handleError(_0x144cc3,null));};exports[_0x4cbe('0x4b')]=function(_0x20f69e,_0x2cec0c){return db[_0x4cbe('0x2f')][_0x4cbe('0x49')]({'where':{'id':_0x20f69e['params']['id']}})[_0x4cbe('0x27')](handleEntityNotFound(_0x2cec0c,null))[_0x4cbe('0x27')](removeEntity(_0x2cec0c,null))[_0x4cbe('0x45')](handleError(_0x2cec0c,null));};exports[_0x4cbe('0x4c')]=function(_0x500d97,_0x1f5149,_0xed1c26){var _0x47fd1={};var _0x3de545={};var _0x32a0de;var _0x506e17;return db[_0x4cbe('0x2f')][_0x4cbe('0x4d')]({'where':{'id':_0x500d97[_0x4cbe('0x47')]['id']}})[_0x4cbe('0x27')](handleEntityNotFound(_0x1f5149,null))['then'](function(_0x1bc46c){if(_0x1bc46c){_0x32a0de=_0x1bc46c;_0x3de545[_0x4cbe('0x33')]=_[_0x4cbe('0x35')](db[_0x4cbe('0x4e')][_0x4cbe('0x30')]);_0x3de545['query']=_['keys'](_0x500d97[_0x4cbe('0x34')]);_0x3de545[_0x4cbe('0x36')]=_[_0x4cbe('0x48')](_0x3de545['model'],_0x3de545[_0x4cbe('0x34')]);_0x47fd1['attributes']=_[_0x4cbe('0x48')](_0x3de545['model'],qs[_0x4cbe('0x37')](_0x500d97[_0x4cbe('0x34')][_0x4cbe('0x37')]));_0x47fd1['attributes']=_0x47fd1[_0x4cbe('0x38')][_0x4cbe('0x39')]?_0x47fd1['attributes']:_0x3de545[_0x4cbe('0x33')];_0x47fd1['order']=qs[_0x4cbe('0x3d')](_0x500d97[_0x4cbe('0x34')][_0x4cbe('0x3d')]);_0x47fd1[_0x4cbe('0x3e')]=qs[_0x4cbe('0x36')](_[_0x4cbe('0x3f')](_0x500d97[_0x4cbe('0x34')],_0x3de545[_0x4cbe('0x36')]));if(_0x500d97['query']['filter']){_0x47fd1[_0x4cbe('0x3e')]=_[_0x4cbe('0x40')](_0x47fd1[_0x4cbe('0x3e')],{'$or':_[_0x4cbe('0x2e')](_0x47fd1['attributes'],function(_0x320abc){var _0x3cbdfe={};_0x3cbdfe[_0x320abc]={'$like':'%'+_0x500d97[_0x4cbe('0x34')][_0x4cbe('0x41')]+'%'};return _0x3cbdfe;})});}_0x47fd1=_[_0x4cbe('0x40')]({},_0x47fd1,_0x500d97[_0x4cbe('0x42')]);return _0x32a0de[_0x4cbe('0x4c')](_0x47fd1);}})['then'](function(_0x2b97fd){if(_0x2b97fd){_0x506e17=_0x2b97fd[_0x4cbe('0x39')];if(!_0x500d97[_0x4cbe('0x34')][_0x4cbe('0x3a')](_0x4cbe('0x3b'))){_0x47fd1['limit']=qs[_0x4cbe('0x22')](_0x500d97[_0x4cbe('0x34')][_0x4cbe('0x22')]);_0x47fd1[_0x4cbe('0x21')]=qs[_0x4cbe('0x21')](_0x500d97[_0x4cbe('0x34')]['offset']);}return _0x32a0de[_0x4cbe('0x4c')](_0x47fd1);}})['then'](function(_0x564ecd){if(_0x564ecd){return _0x564ecd?{'count':_0x506e17,'rows':_0x564ecd}:null;}})[_0x4cbe('0x27')](respondWithResult(_0x1f5149,null))[_0x4cbe('0x45')](handleError(_0x1f5149,null));};exports['getDescriptions']=function(_0x19b59a,_0x1b70f0,_0x4ebc5f){var _0x5a68f={};var _0x474c6c={};var _0x3bcc2e;var _0x12b9ea;return db['FreshsalesConfiguration'][_0x4cbe('0x4d')]({'where':{'id':_0x19b59a[_0x4cbe('0x47')]['id']}})[_0x4cbe('0x27')](handleEntityNotFound(_0x1b70f0,null))[_0x4cbe('0x27')](function(_0xa6af1f){if(_0xa6af1f){_0x3bcc2e=_0xa6af1f;_0x474c6c['model']=_['keys'](db['FreshsalesField'][_0x4cbe('0x30')]);_0x474c6c[_0x4cbe('0x34')]=_[_0x4cbe('0x35')](_0x19b59a[_0x4cbe('0x34')]);_0x474c6c['filters']=_[_0x4cbe('0x48')](_0x474c6c['model'],_0x474c6c[_0x4cbe('0x34')]);_0x5a68f[_0x4cbe('0x38')]=_[_0x4cbe('0x48')](_0x474c6c[_0x4cbe('0x33')],qs[_0x4cbe('0x37')](_0x19b59a['query'][_0x4cbe('0x37')]));_0x5a68f['attributes']=_0x5a68f[_0x4cbe('0x38')][_0x4cbe('0x39')]?_0x5a68f[_0x4cbe('0x38')]:_0x474c6c[_0x4cbe('0x33')];_0x5a68f[_0x4cbe('0x3c')]=qs[_0x4cbe('0x3d')](_0x19b59a[_0x4cbe('0x34')][_0x4cbe('0x3d')]);_0x5a68f[_0x4cbe('0x3e')]=qs[_0x4cbe('0x36')](_['pick'](_0x19b59a[_0x4cbe('0x34')],_0x474c6c['filters']));if(_0x19b59a[_0x4cbe('0x34')]['filter']){_0x5a68f[_0x4cbe('0x3e')]=_[_0x4cbe('0x40')](_0x5a68f['where'],{'$or':_[_0x4cbe('0x2e')](_0x5a68f[_0x4cbe('0x38')],function(_0x1c270a){var _0x5b5b8e={};_0x5b5b8e[_0x1c270a]={'$like':'%'+_0x19b59a[_0x4cbe('0x34')][_0x4cbe('0x41')]+'%'};return _0x5b5b8e;})});}_0x5a68f=_[_0x4cbe('0x40')]({},_0x5a68f,_0x19b59a['options']);return _0x3bcc2e[_0x4cbe('0x4f')](_0x5a68f);}})[_0x4cbe('0x27')](function(_0xf04ad9){if(_0xf04ad9){_0x12b9ea=_0xf04ad9[_0x4cbe('0x39')];if(!_0x19b59a['query']['hasOwnProperty'](_0x4cbe('0x3b'))){_0x5a68f[_0x4cbe('0x22')]=qs[_0x4cbe('0x22')](_0x19b59a[_0x4cbe('0x34')][_0x4cbe('0x22')]);_0x5a68f['offset']=qs['offset'](_0x19b59a[_0x4cbe('0x34')][_0x4cbe('0x21')]);}return _0x3bcc2e[_0x4cbe('0x4f')](_0x5a68f);}})['then'](function(_0x1b3141){if(_0x1b3141){return _0x1b3141?{'count':_0x12b9ea,'rows':_0x1b3141}:null;}})[_0x4cbe('0x27')](respondWithResult(_0x1b70f0,null))[_0x4cbe('0x45')](handleError(_0x1b70f0,null));};exports[_0x4cbe('0x50')]=function(_0xd7f073,_0x20bdc2,_0x4c4703){var _0x146efb={};var _0x18b527={};var _0x18acf1;var _0x43d397;return db[_0x4cbe('0x2f')][_0x4cbe('0x4d')]({'where':{'id':_0xd7f073[_0x4cbe('0x47')]['id']}})['then'](handleEntityNotFound(_0x20bdc2,null))['then'](function(_0x12a6d6){if(_0x12a6d6){_0x18acf1=_0x12a6d6;_0x18b527[_0x4cbe('0x33')]=_[_0x4cbe('0x35')](db[_0x4cbe('0x4e')][_0x4cbe('0x30')]);_0x18b527['query']=_[_0x4cbe('0x35')](_0xd7f073['query']);_0x18b527[_0x4cbe('0x36')]=_['intersection'](_0x18b527[_0x4cbe('0x33')],_0x18b527['query']);_0x146efb['attributes']=_[_0x4cbe('0x48')](_0x18b527[_0x4cbe('0x33')],qs[_0x4cbe('0x37')](_0xd7f073['query'][_0x4cbe('0x37')]));_0x146efb[_0x4cbe('0x38')]=_0x146efb['attributes'][_0x4cbe('0x39')]?_0x146efb[_0x4cbe('0x38')]:_0x18b527[_0x4cbe('0x33')];_0x146efb[_0x4cbe('0x3c')]=qs['sort'](_0xd7f073[_0x4cbe('0x34')]['sort']);_0x146efb[_0x4cbe('0x3e')]=qs[_0x4cbe('0x36')](_['pick'](_0xd7f073[_0x4cbe('0x34')],_0x18b527[_0x4cbe('0x36')]));if(_0xd7f073[_0x4cbe('0x34')][_0x4cbe('0x41')]){_0x146efb[_0x4cbe('0x3e')]=_['merge'](_0x146efb[_0x4cbe('0x3e')],{'$or':_['map'](_0x146efb['attributes'],function(_0x40ae32){var _0x118fe8={};_0x118fe8[_0x40ae32]={'$like':'%'+_0xd7f073[_0x4cbe('0x34')]['filter']+'%'};return _0x118fe8;})});}_0x146efb=_[_0x4cbe('0x40')]({},_0x146efb,_0xd7f073[_0x4cbe('0x42')]);return _0x18acf1['getFields'](_0x146efb);}})[_0x4cbe('0x27')](function(_0x465bc0){if(_0x465bc0){_0x43d397=_0x465bc0[_0x4cbe('0x39')];if(!_0xd7f073[_0x4cbe('0x34')][_0x4cbe('0x3a')](_0x4cbe('0x3b'))){_0x146efb['limit']=qs[_0x4cbe('0x22')](_0xd7f073[_0x4cbe('0x34')]['limit']);_0x146efb['offset']=qs[_0x4cbe('0x21')](_0xd7f073[_0x4cbe('0x34')][_0x4cbe('0x21')]);}return _0x18acf1[_0x4cbe('0x50')](_0x146efb);}})[_0x4cbe('0x27')](function(_0xf37625){if(_0xf37625){return _0xf37625?{'count':_0x43d397,'rows':_0xf37625}:null;}})['then'](respondWithResult(_0x20bdc2,null))[_0x4cbe('0x45')](handleError(_0x20bdc2,null));}; \ No newline at end of file +var _0x6c65=['index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','update','body','findOne','FreshsalesField','pick','hasOwnProperty','getSubjects','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','undefined','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','stack','name','send'];(function(_0x2110a0,_0x3ef1cb){var _0x2c00b1=function(_0x4e8f2a){while(--_0x4e8f2a){_0x2110a0['push'](_0x2110a0['shift']());}};_0x2c00b1(++_0x3ef1cb);}(_0x6c65,0x78));var _0x56c6=function(_0x236912,_0x4167cd){_0x236912=_0x236912-0x0;var _0x582904=_0x6c65[_0x236912];return _0x582904;};'use strict';var emlformat=require(_0x56c6('0x0'));var rimraf=require(_0x56c6('0x1'));var zipdir=require(_0x56c6('0x2'));var jsonpatch=require(_0x56c6('0x3'));var rp=require(_0x56c6('0x4'));var moment=require(_0x56c6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x56c6('0x6'));var util=require(_0x56c6('0x7'));var path=require(_0x56c6('0x8'));var sox=require(_0x56c6('0x9'));var csv=require(_0x56c6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x56c6('0xb'));var _=require(_0x56c6('0xc'));var squel=require(_0x56c6('0xd'));var crypto=require(_0x56c6('0xe'));var jsforce=require(_0x56c6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x56c6('0xa'));var querystring=require(_0x56c6('0x10'));var Papa=require(_0x56c6('0x11'));var Redis=require('ioredis');var authService=require(_0x56c6('0x12'));var qs=require(_0x56c6('0x13'));var as=require(_0x56c6('0x14'));var hardwareService=require(_0x56c6('0x15'));var logger=require(_0x56c6('0x16'))(_0x56c6('0x17'));var utils=require('../../config/utils');var config=require(_0x56c6('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d7c67,_0x2bb84e){_0x2bb84e=_0x2bb84e||0xcc;return function(_0x3310ed){if(_0x3310ed){return _0x1d7c67[_0x56c6('0x19')](_0x2bb84e);}return _0x1d7c67['status'](_0x2bb84e)[_0x56c6('0x1a')]();};}function respondWithResult(_0x511316,_0x17f72e){_0x17f72e=_0x17f72e||0xc8;return function(_0x59b7b5){if(_0x59b7b5){return _0x511316[_0x56c6('0x1b')](_0x17f72e)['json'](_0x59b7b5);}};}function respondWithFilteredResult(_0x557189,_0x4b47ce){return function(_0x4d0838){if(_0x4d0838){var _0x3e6082=typeof _0x4b47ce['offset']===_0x56c6('0x1c')&&typeof _0x4b47ce['limit']===_0x56c6('0x1c');var _0x49fff5=_0x4d0838[_0x56c6('0x1d')];var _0x5625f2=_0x3e6082?0x0:_0x4b47ce[_0x56c6('0x1e')];var _0x288325=_0x3e6082?_0x4d0838['count']:_0x4b47ce[_0x56c6('0x1e')]+_0x4b47ce[_0x56c6('0x1f')];var _0x27b5b0;if(_0x288325>=_0x49fff5){_0x288325=_0x49fff5;_0x27b5b0=0xc8;}else{_0x27b5b0=0xce;}_0x557189[_0x56c6('0x1b')](_0x27b5b0);return _0x557189['set'](_0x56c6('0x20'),_0x5625f2+'-'+_0x288325+'/'+_0x49fff5)[_0x56c6('0x21')](_0x4d0838);}return null;};}function patchUpdates(_0x413ca7){return function(_0x137570){try{jsonpatch[_0x56c6('0x22')](_0x137570,_0x413ca7,!![]);}catch(_0x58bc6f){return BPromise[_0x56c6('0x23')](_0x58bc6f);}return _0x137570[_0x56c6('0x24')]();};}function saveUpdates(_0x55271c,_0x40d7be){return function(_0x4d33f7){if(_0x4d33f7){return _0x4d33f7['update'](_0x55271c)[_0x56c6('0x25')](function(_0x1f1bb1){return _0x1f1bb1;});}return null;};}function removeEntity(_0x17dd94,_0x5c6682){return function(_0x27806e){if(_0x27806e){return _0x27806e[_0x56c6('0x26')]()[_0x56c6('0x25')](function(){_0x17dd94[_0x56c6('0x1b')](0xcc)[_0x56c6('0x1a')]();});}};}function handleEntityNotFound(_0x207f05,_0x50d7ee){return function(_0x4be5df){if(!_0x4be5df){_0x207f05[_0x56c6('0x19')](0x194);}return _0x4be5df;};}function handleError(_0x44164c,_0x5cb361){_0x5cb361=_0x5cb361||0x1f4;return function(_0x33f95e){logger['error'](_0x33f95e[_0x56c6('0x27')]);if(_0x33f95e['name']){delete _0x33f95e[_0x56c6('0x28')];}_0x44164c['status'](_0x5cb361)[_0x56c6('0x29')](_0x33f95e);};}exports[_0x56c6('0x2a')]=function(_0x24fb02,_0x2e6b07){var _0x1acdcf={},_0x67fec3={},_0x14094b={'count':0x0,'rows':[]};var _0x3938d4=_[_0x56c6('0x2b')](db[_0x56c6('0x2c')][_0x56c6('0x2d')],function(_0x492d80){return{'name':_0x492d80[_0x56c6('0x2e')],'type':_0x492d80[_0x56c6('0x2f')]['key']};});_0x67fec3['model']=_[_0x56c6('0x2b')](_0x3938d4,'name');_0x67fec3[_0x56c6('0x30')]=_['keys'](_0x24fb02[_0x56c6('0x30')]);_0x67fec3[_0x56c6('0x31')]=_[_0x56c6('0x32')](_0x67fec3['model'],_0x67fec3[_0x56c6('0x30')]);_0x1acdcf[_0x56c6('0x33')]=_[_0x56c6('0x32')](_0x67fec3[_0x56c6('0x34')],qs[_0x56c6('0x35')](_0x24fb02[_0x56c6('0x30')][_0x56c6('0x35')]));_0x1acdcf[_0x56c6('0x33')]=_0x1acdcf[_0x56c6('0x33')][_0x56c6('0x36')]?_0x1acdcf['attributes']:_0x67fec3[_0x56c6('0x34')];if(!_0x24fb02[_0x56c6('0x30')]['hasOwnProperty'](_0x56c6('0x37'))){_0x1acdcf[_0x56c6('0x1f')]=qs[_0x56c6('0x1f')](_0x24fb02[_0x56c6('0x30')][_0x56c6('0x1f')]);_0x1acdcf[_0x56c6('0x1e')]=qs[_0x56c6('0x1e')](_0x24fb02['query'][_0x56c6('0x1e')]);}_0x1acdcf[_0x56c6('0x38')]=qs[_0x56c6('0x39')](_0x24fb02[_0x56c6('0x30')][_0x56c6('0x39')]);_0x1acdcf[_0x56c6('0x3a')]=qs[_0x56c6('0x31')](_['pick'](_0x24fb02['query'],_0x67fec3[_0x56c6('0x31')]),_0x3938d4);if(_0x24fb02[_0x56c6('0x30')][_0x56c6('0x3b')]){_0x1acdcf[_0x56c6('0x3a')]=_[_0x56c6('0x3c')](_0x1acdcf[_0x56c6('0x3a')],{'$or':_[_0x56c6('0x2b')](_0x3938d4,function(_0xbc92e){if(_0xbc92e[_0x56c6('0x2f')]!==_0x56c6('0x3d')){var _0x493865={};_0x493865[_0xbc92e[_0x56c6('0x28')]]={'$like':'%'+_0x24fb02[_0x56c6('0x30')][_0x56c6('0x3b')]+'%'};return _0x493865;}})});}_0x1acdcf=_['merge']({},_0x1acdcf,_0x24fb02[_0x56c6('0x3e')]);var _0x74516a={'where':_0x1acdcf[_0x56c6('0x3a')]};return db['FreshsalesConfiguration']['count'](_0x74516a)[_0x56c6('0x25')](function(_0x2dea5d){_0x14094b[_0x56c6('0x1d')]=_0x2dea5d;if(_0x24fb02[_0x56c6('0x30')][_0x56c6('0x3f')]){_0x1acdcf[_0x56c6('0x40')]=[{'all':!![]}];}return db[_0x56c6('0x2c')][_0x56c6('0x41')](_0x1acdcf);})[_0x56c6('0x25')](function(_0x295522){_0x14094b[_0x56c6('0x42')]=_0x295522;return _0x14094b;})[_0x56c6('0x25')](respondWithFilteredResult(_0x2e6b07,_0x1acdcf))[_0x56c6('0x43')](handleError(_0x2e6b07,null));};exports['show']=function(_0x217723,_0x851bbe){var _0x1e6b10={'raw':![],'where':{'id':_0x217723[_0x56c6('0x44')]['id']}},_0x5968ac={};_0x5968ac[_0x56c6('0x34')]=_[_0x56c6('0x45')](db[_0x56c6('0x2c')][_0x56c6('0x2d')]);_0x5968ac[_0x56c6('0x30')]=_[_0x56c6('0x45')](_0x217723[_0x56c6('0x30')]);_0x5968ac['filters']=_[_0x56c6('0x32')](_0x5968ac['model'],_0x5968ac['query']);_0x1e6b10[_0x56c6('0x33')]=_[_0x56c6('0x32')](_0x5968ac[_0x56c6('0x34')],qs[_0x56c6('0x35')](_0x217723['query'][_0x56c6('0x35')]));_0x1e6b10[_0x56c6('0x33')]=_0x1e6b10[_0x56c6('0x33')]['length']?_0x1e6b10[_0x56c6('0x33')]:_0x5968ac[_0x56c6('0x34')];if(_0x217723[_0x56c6('0x30')][_0x56c6('0x3f')]){_0x1e6b10[_0x56c6('0x40')]=[{'all':!![]}];}_0x1e6b10=_['merge']({},_0x1e6b10,_0x217723[_0x56c6('0x3e')]);return db[_0x56c6('0x2c')][_0x56c6('0x46')](_0x1e6b10)[_0x56c6('0x25')](handleEntityNotFound(_0x851bbe,null))[_0x56c6('0x25')](respondWithResult(_0x851bbe,null))[_0x56c6('0x43')](handleError(_0x851bbe,null));};exports[_0x56c6('0x47')]=function(_0x1b6ac4,_0x4529df){return db[_0x56c6('0x2c')][_0x56c6('0x47')](_0x1b6ac4['body'],{})[_0x56c6('0x25')](respondWithResult(_0x4529df,0xc9))['catch'](handleError(_0x4529df,null));};exports[_0x56c6('0x48')]=function(_0x58cfa5,_0x5b449f){if(_0x58cfa5[_0x56c6('0x49')]['id']){delete _0x58cfa5[_0x56c6('0x49')]['id'];}return db[_0x56c6('0x2c')][_0x56c6('0x46')]({'where':{'id':_0x58cfa5[_0x56c6('0x44')]['id']}})[_0x56c6('0x25')](handleEntityNotFound(_0x5b449f,null))[_0x56c6('0x25')](saveUpdates(_0x58cfa5[_0x56c6('0x49')],null))[_0x56c6('0x25')](respondWithResult(_0x5b449f,null))[_0x56c6('0x43')](handleError(_0x5b449f,null));};exports['destroy']=function(_0x2b1ff0,_0x20598b){return db[_0x56c6('0x2c')][_0x56c6('0x46')]({'where':{'id':_0x2b1ff0['params']['id']}})[_0x56c6('0x25')](handleEntityNotFound(_0x20598b,null))[_0x56c6('0x25')](removeEntity(_0x20598b,null))[_0x56c6('0x43')](handleError(_0x20598b,null));};exports['getSubjects']=function(_0x438674,_0xacbb0d,_0x2967e6){var _0x133f18={};var _0x4f02d8={};var _0x3323f5;var _0xf4cf37;return db[_0x56c6('0x2c')][_0x56c6('0x4a')]({'where':{'id':_0x438674[_0x56c6('0x44')]['id']}})['then'](handleEntityNotFound(_0xacbb0d,null))['then'](function(_0x475f04){if(_0x475f04){_0x3323f5=_0x475f04;_0x4f02d8[_0x56c6('0x34')]=_[_0x56c6('0x45')](db[_0x56c6('0x4b')][_0x56c6('0x2d')]);_0x4f02d8[_0x56c6('0x30')]=_[_0x56c6('0x45')](_0x438674[_0x56c6('0x30')]);_0x4f02d8['filters']=_[_0x56c6('0x32')](_0x4f02d8['model'],_0x4f02d8[_0x56c6('0x30')]);_0x133f18['attributes']=_[_0x56c6('0x32')](_0x4f02d8['model'],qs[_0x56c6('0x35')](_0x438674[_0x56c6('0x30')][_0x56c6('0x35')]));_0x133f18[_0x56c6('0x33')]=_0x133f18[_0x56c6('0x33')][_0x56c6('0x36')]?_0x133f18['attributes']:_0x4f02d8[_0x56c6('0x34')];_0x133f18['order']=qs[_0x56c6('0x39')](_0x438674['query'][_0x56c6('0x39')]);_0x133f18[_0x56c6('0x3a')]=qs['filters'](_[_0x56c6('0x4c')](_0x438674['query'],_0x4f02d8['filters']));if(_0x438674[_0x56c6('0x30')][_0x56c6('0x3b')]){_0x133f18[_0x56c6('0x3a')]=_[_0x56c6('0x3c')](_0x133f18[_0x56c6('0x3a')],{'$or':_[_0x56c6('0x2b')](_0x133f18['attributes'],function(_0x52a42e){var _0x4ae745={};_0x4ae745[_0x52a42e]={'$like':'%'+_0x438674[_0x56c6('0x30')][_0x56c6('0x3b')]+'%'};return _0x4ae745;})});}_0x133f18=_[_0x56c6('0x3c')]({},_0x133f18,_0x438674[_0x56c6('0x3e')]);return _0x3323f5['getSubjects'](_0x133f18);}})[_0x56c6('0x25')](function(_0x34eb29){if(_0x34eb29){_0xf4cf37=_0x34eb29[_0x56c6('0x36')];if(!_0x438674['query'][_0x56c6('0x4d')](_0x56c6('0x37'))){_0x133f18[_0x56c6('0x1f')]=qs[_0x56c6('0x1f')](_0x438674['query']['limit']);_0x133f18['offset']=qs['offset'](_0x438674[_0x56c6('0x30')][_0x56c6('0x1e')]);}return _0x3323f5[_0x56c6('0x4e')](_0x133f18);}})[_0x56c6('0x25')](function(_0x40bd9f){if(_0x40bd9f){return _0x40bd9f?{'count':_0xf4cf37,'rows':_0x40bd9f}:null;}})[_0x56c6('0x25')](respondWithResult(_0xacbb0d,null))[_0x56c6('0x43')](handleError(_0xacbb0d,null));};exports[_0x56c6('0x4f')]=function(_0x35223e,_0x6b9cf5,_0x5f11bd){var _0x1e1dde={};var _0xef9e83={};var _0x18b6ab;var _0x13d572;return db['FreshsalesConfiguration'][_0x56c6('0x4a')]({'where':{'id':_0x35223e['params']['id']}})['then'](handleEntityNotFound(_0x6b9cf5,null))[_0x56c6('0x25')](function(_0x79a0ad){if(_0x79a0ad){_0x18b6ab=_0x79a0ad;_0xef9e83['model']=_['keys'](db[_0x56c6('0x4b')][_0x56c6('0x2d')]);_0xef9e83[_0x56c6('0x30')]=_[_0x56c6('0x45')](_0x35223e['query']);_0xef9e83[_0x56c6('0x31')]=_[_0x56c6('0x32')](_0xef9e83['model'],_0xef9e83[_0x56c6('0x30')]);_0x1e1dde[_0x56c6('0x33')]=_['intersection'](_0xef9e83[_0x56c6('0x34')],qs[_0x56c6('0x35')](_0x35223e['query']['fields']));_0x1e1dde['attributes']=_0x1e1dde[_0x56c6('0x33')][_0x56c6('0x36')]?_0x1e1dde[_0x56c6('0x33')]:_0xef9e83[_0x56c6('0x34')];_0x1e1dde[_0x56c6('0x38')]=qs[_0x56c6('0x39')](_0x35223e[_0x56c6('0x30')][_0x56c6('0x39')]);_0x1e1dde[_0x56c6('0x3a')]=qs[_0x56c6('0x31')](_['pick'](_0x35223e[_0x56c6('0x30')],_0xef9e83[_0x56c6('0x31')]));if(_0x35223e[_0x56c6('0x30')][_0x56c6('0x3b')]){_0x1e1dde[_0x56c6('0x3a')]=_[_0x56c6('0x3c')](_0x1e1dde[_0x56c6('0x3a')],{'$or':_[_0x56c6('0x2b')](_0x1e1dde[_0x56c6('0x33')],function(_0x406574){var _0x316b75={};_0x316b75[_0x406574]={'$like':'%'+_0x35223e[_0x56c6('0x30')][_0x56c6('0x3b')]+'%'};return _0x316b75;})});}_0x1e1dde=_[_0x56c6('0x3c')]({},_0x1e1dde,_0x35223e[_0x56c6('0x3e')]);return _0x18b6ab['getDescriptions'](_0x1e1dde);}})['then'](function(_0x1b89d6){if(_0x1b89d6){_0x13d572=_0x1b89d6[_0x56c6('0x36')];if(!_0x35223e['query'][_0x56c6('0x4d')](_0x56c6('0x37'))){_0x1e1dde[_0x56c6('0x1f')]=qs[_0x56c6('0x1f')](_0x35223e[_0x56c6('0x30')][_0x56c6('0x1f')]);_0x1e1dde[_0x56c6('0x1e')]=qs[_0x56c6('0x1e')](_0x35223e['query']['offset']);}return _0x18b6ab[_0x56c6('0x4f')](_0x1e1dde);}})['then'](function(_0x268a59){if(_0x268a59){return _0x268a59?{'count':_0x13d572,'rows':_0x268a59}:null;}})['then'](respondWithResult(_0x6b9cf5,null))[_0x56c6('0x43')](handleError(_0x6b9cf5,null));};exports[_0x56c6('0x50')]=function(_0x2c133c,_0x12d438,_0xd4f9c3){var _0x64d662={};var _0x36cfa8={};var _0x2d2562;var _0x4027b3;return db[_0x56c6('0x2c')][_0x56c6('0x4a')]({'where':{'id':_0x2c133c[_0x56c6('0x44')]['id']}})[_0x56c6('0x25')](handleEntityNotFound(_0x12d438,null))[_0x56c6('0x25')](function(_0x3637b1){if(_0x3637b1){_0x2d2562=_0x3637b1;_0x36cfa8[_0x56c6('0x34')]=_[_0x56c6('0x45')](db['FreshsalesField'][_0x56c6('0x2d')]);_0x36cfa8[_0x56c6('0x30')]=_[_0x56c6('0x45')](_0x2c133c['query']);_0x36cfa8[_0x56c6('0x31')]=_[_0x56c6('0x32')](_0x36cfa8['model'],_0x36cfa8[_0x56c6('0x30')]);_0x64d662[_0x56c6('0x33')]=_[_0x56c6('0x32')](_0x36cfa8[_0x56c6('0x34')],qs[_0x56c6('0x35')](_0x2c133c['query'][_0x56c6('0x35')]));_0x64d662[_0x56c6('0x33')]=_0x64d662[_0x56c6('0x33')][_0x56c6('0x36')]?_0x64d662[_0x56c6('0x33')]:_0x36cfa8['model'];_0x64d662[_0x56c6('0x38')]=qs[_0x56c6('0x39')](_0x2c133c[_0x56c6('0x30')][_0x56c6('0x39')]);_0x64d662[_0x56c6('0x3a')]=qs[_0x56c6('0x31')](_[_0x56c6('0x4c')](_0x2c133c[_0x56c6('0x30')],_0x36cfa8[_0x56c6('0x31')]));if(_0x2c133c[_0x56c6('0x30')][_0x56c6('0x3b')]){_0x64d662[_0x56c6('0x3a')]=_['merge'](_0x64d662[_0x56c6('0x3a')],{'$or':_[_0x56c6('0x2b')](_0x64d662[_0x56c6('0x33')],function(_0x38aaaa){var _0x10a15b={};_0x10a15b[_0x38aaaa]={'$like':'%'+_0x2c133c[_0x56c6('0x30')][_0x56c6('0x3b')]+'%'};return _0x10a15b;})});}_0x64d662=_['merge']({},_0x64d662,_0x2c133c[_0x56c6('0x3e')]);return _0x2d2562[_0x56c6('0x50')](_0x64d662);}})[_0x56c6('0x25')](function(_0xe780cf){if(_0xe780cf){_0x4027b3=_0xe780cf['length'];if(!_0x2c133c[_0x56c6('0x30')][_0x56c6('0x4d')](_0x56c6('0x37'))){_0x64d662[_0x56c6('0x1f')]=qs[_0x56c6('0x1f')](_0x2c133c[_0x56c6('0x30')][_0x56c6('0x1f')]);_0x64d662['offset']=qs['offset'](_0x2c133c[_0x56c6('0x30')][_0x56c6('0x1e')]);}return _0x2d2562['getFields'](_0x64d662);}})[_0x56c6('0x25')](function(_0x50ca63){if(_0x50ca63){return _0x50ca63?{'count':_0x4027b3,'rows':_0x50ca63}:null;}})['then'](respondWithResult(_0x12d438,null))[_0x56c6('0x43')](handleError(_0x12d438,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index ea59940..9294c81 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 _0xe03e=['exports','define','int_freshsales_configurations','lodash','bluebird','request-promise','path','../../config/environment'];(function(_0x4aef1f,_0x3d402c){var _0x34680f=function(_0x14a9d6){while(--_0x14a9d6){_0x4aef1f['push'](_0x4aef1f['shift']());}};_0x34680f(++_0x3d402c);}(_0xe03e,0x103));var _0xee03=function(_0x52a75d,_0x33eddb){_0x52a75d=_0x52a75d-0x0;var _0x3bddb6=_0xe03e[_0x52a75d];return _0x3bddb6;};'use strict';var _=require(_0xee03('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xee03('0x1'));var rp=require(_0xee03('0x2'));var fs=require('fs');var path=require(_0xee03('0x3'));var rimraf=require('rimraf');var config=require(_0xee03('0x4'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xee03('0x5')]=function(_0x10ea47,_0x12ea7e){return _0x10ea47[_0xee03('0x6')]('FreshsalesConfiguration',attributes,{'tableName':_0xee03('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd59e=['int_freshsales_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','FreshsalesConfiguration'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd59e,0x6d));var _0xed59=function(_0x26770b,_0x599900){_0x26770b=_0x26770b-0x0;var _0x2b7cfb=_0xd59e[_0x26770b];return _0x2b7cfb;};'use strict';var _=require(_0xed59('0x0'));var util=require(_0xed59('0x1'));var logger=require(_0xed59('0x2'))(_0xed59('0x3'));var moment=require('moment');var BPromise=require(_0xed59('0x4'));var rp=require(_0xed59('0x5'));var fs=require('fs');var path=require(_0xed59('0x6'));var rimraf=require(_0xed59('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xed59('0x8')]=function(_0xacce50,_0x54da22){return _0xacce50[_0xed59('0x9')](_0xed59('0xa'),attributes,{'tableName':_0xed59('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 1ac1587..b0c0c09 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 _0xdfbd=['../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2e96de,_0x7b3fac){var _0x588f95=function(_0x4a5df8){while(--_0x4a5df8){_0x2e96de['push'](_0x2e96de['shift']());}};_0x588f95(++_0x7b3fac);}(_0xdfbd,0x1f1));var _0xddfb=function(_0x2ff4fb,_0x2692c1){_0x2ff4fb=_0x2ff4fb-0x0;var _0x177874=_0xdfbd[_0x2ff4fb];return _0x177874;};'use strict';var _=require(_0xddfb('0x0'));var util=require('util');var moment=require(_0xddfb('0x1'));var BPromise=require(_0xddfb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xddfb('0x3'))['db'];var utils=require(_0xddfb('0x4'));var logger=require(_0xddfb('0x5'))(_0xddfb('0x6'));var config=require(_0xddfb('0x7'));var jayson=require(_0xddfb('0x8'));var client=jayson[_0xddfb('0x9')][_0xddfb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f1a13,_0x23bad3,_0x525548){return new BPromise(function(_0x363442,_0x17e1c6){return client[_0xddfb('0xb')](_0x3f1a13,_0x525548)[_0xddfb('0xc')](function(_0x462374){logger[_0xddfb('0xd')](_0xddfb('0xe'),_0x23bad3,_0xddfb('0xf'));logger[_0xddfb('0x10')](_0xddfb('0x11'),_0x23bad3,_0xddfb('0xf'),JSON[_0xddfb('0x12')](_0x462374));if(_0x462374[_0xddfb('0x13')]){if(_0x462374[_0xddfb('0x13')][_0xddfb('0x14')]===0x1f4){logger[_0xddfb('0x13')](_0xddfb('0xe'),_0x23bad3,_0x462374[_0xddfb('0x13')][_0xddfb('0x15')]);return _0x17e1c6(_0x462374[_0xddfb('0x13')][_0xddfb('0x15')]);}logger[_0xddfb('0x13')](_0xddfb('0xe'),_0x23bad3,_0x462374[_0xddfb('0x13')][_0xddfb('0x15')]);return _0x363442(_0x462374[_0xddfb('0x13')]['message']);}else{logger[_0xddfb('0xd')](_0xddfb('0xe'),_0x23bad3,_0xddfb('0xf'));_0x363442(_0x462374[_0xddfb('0x16')]['message']);}})[_0xddfb('0x17')](function(_0x6f71){logger['error'](_0xddfb('0xe'),_0x23bad3,_0x6f71);_0x17e1c6(_0x6f71);});});} \ No newline at end of file +var _0x35e6=['request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2e7f78,_0x27351e){var _0x4ce8e2=function(_0x4df71e){while(--_0x4df71e){_0x2e7f78['push'](_0x2e7f78['shift']());}};_0x4ce8e2(++_0x27351e);}(_0x35e6,0xc8));var _0x635e=function(_0x14082b,_0x3672d6){_0x14082b=_0x14082b-0x0;var _0x53a93d=_0x35e6[_0x14082b];return _0x53a93d;};'use strict';var _=require('lodash');var util=require(_0x635e('0x0'));var moment=require('moment');var BPromise=require(_0x635e('0x1'));var rs=require(_0x635e('0x2'));var fs=require('fs');var Redis=require(_0x635e('0x3'));var db=require(_0x635e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x635e('0x5'))(_0x635e('0x6'));var config=require(_0x635e('0x7'));var jayson=require(_0x635e('0x8'));var client=jayson['client'][_0x635e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x434730,_0x4e0b73,_0x24dd30){return new BPromise(function(_0x63d9f1,_0x23baec){return client[_0x635e('0xa')](_0x434730,_0x24dd30)[_0x635e('0xb')](function(_0x2a0a17){logger[_0x635e('0xc')](_0x635e('0xd'),_0x4e0b73,_0x635e('0xe'));logger[_0x635e('0xf')](_0x635e('0x10'),_0x4e0b73,_0x635e('0xe'),JSON['stringify'](_0x2a0a17));if(_0x2a0a17[_0x635e('0x11')]){if(_0x2a0a17[_0x635e('0x11')][_0x635e('0x12')]===0x1f4){logger[_0x635e('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4e0b73,_0x2a0a17[_0x635e('0x11')][_0x635e('0x13')]);return _0x23baec(_0x2a0a17[_0x635e('0x11')][_0x635e('0x13')]);}logger[_0x635e('0x11')](_0x635e('0xd'),_0x4e0b73,_0x2a0a17['error'][_0x635e('0x13')]);return _0x63d9f1(_0x2a0a17[_0x635e('0x11')][_0x635e('0x13')]);}else{logger[_0x635e('0xc')](_0x635e('0xd'),_0x4e0b73,_0x635e('0xe'));_0x63d9f1(_0x2a0a17[_0x635e('0x14')][_0x635e('0x13')]);}})['catch'](function(_0x2443b3){logger[_0x635e('0x11')](_0x635e('0xd'),_0x4e0b73,_0x2443b3);_0x23baec(_0x2443b3);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 3bbec76..101eb2e 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 _0x7846=['./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0xf34484,_0x3b3953){var _0x3c2851=function(_0x2b45dc){while(--_0x2b45dc){_0xf34484['push'](_0xf34484['shift']());}};_0x3c2851(++_0x3b3953);}(_0x7846,0xf4));var _0x6784=function(_0x158a58,_0x28e8e7){_0x158a58=_0x158a58-0x0;var _0x4935d9=_0x7846[_0x158a58];return _0x4935d9;};'use strict';var multer=require('multer');var util=require(_0x6784('0x0'));var path=require(_0x6784('0x1'));var timeout=require(_0x6784('0x2'));var express=require(_0x6784('0x3'));var router=express[_0x6784('0x4')]();var fs_extra=require(_0x6784('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6784('0x6'));var config=require(_0x6784('0x7'));var controller=require(_0x6784('0x8'));router[_0x6784('0x9')]('/',auth[_0x6784('0xa')](),controller[_0x6784('0xb')]);router[_0x6784('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6784('0xc')]);router[_0x6784('0xd')]('/',auth[_0x6784('0xa')](),controller[_0x6784('0xe')]);router[_0x6784('0xf')](_0x6784('0x10'),auth[_0x6784('0xa')](),controller[_0x6784('0x11')]);router[_0x6784('0x12')](_0x6784('0x10'),auth[_0x6784('0xa')](),controller[_0x6784('0x13')]);module[_0x6784('0x14')]=router; \ No newline at end of file +var _0xbec5=['/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','index'];(function(_0xe455e7,_0x29fb65){var _0xfc683e=function(_0x10ee38){while(--_0x10ee38){_0xe455e7['push'](_0xe455e7['shift']());}};_0xfc683e(++_0x29fb65);}(_0xbec5,0xe5));var _0x5bec=function(_0x207a02,_0x278c56){_0x207a02=_0x207a02-0x0;var _0xd995c3=_0xbec5[_0x207a02];return _0xd995c3;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0xe')]('/',auth[_0x5bec('0xc')](),controller[_0x5bec('0xf')]);router['put'](_0x5bec('0xb'),auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0x11')](_0x5bec('0xb'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);module[_0x5bec('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index aa9bced..f16cf2d 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 _0x9876=['exports','ENUM','string','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x9876,0x18f));var _0x6987=function(_0x34c3fa,_0x133fc9){_0x34c3fa=_0x34c3fa-0x0;var _0x51612d=_0x9876[_0x34c3fa];return _0x51612d;};'use strict';var Sequelize=require(_0x6987('0x0'));module[_0x6987('0x1')]={'type':{'type':Sequelize[_0x6987('0x2')](_0x6987('0x3'),'variable',_0x6987('0x4'),_0x6987('0x5'),'picklist'),'defaultValue':_0x6987('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6987('0x2')]('string','variable',_0x6987('0x4'))},'keyContent':{'type':Sequelize[_0x6987('0x6')]},'idField':{'type':Sequelize[_0x6987('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6987('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6987('0x6')]}}; \ No newline at end of file +var _0x9c8e=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9c8e,0x1aa));var _0xe9c8=function(_0x203efb,_0x5abed2){_0x203efb=_0x203efb-0x0;var _0xf67f98=_0x9c8e[_0x203efb];return _0xf67f98;};'use strict';var Sequelize=require(_0xe9c8('0x0'));module[_0xe9c8('0x1')]={'type':{'type':Sequelize[_0xe9c8('0x2')](_0xe9c8('0x3'),'variable',_0xe9c8('0x4'),_0xe9c8('0x5'),_0xe9c8('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe9c8('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe9c8('0x2')](_0xe9c8('0x3'),_0xe9c8('0x8'),_0xe9c8('0x4'))},'keyContent':{'type':Sequelize[_0xe9c8('0x7')]},'idField':{'type':Sequelize[_0xe9c8('0x7')]},'nameField':{'type':Sequelize[_0xe9c8('0x7')]},'customField':{'type':Sequelize[_0xe9c8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe9c8('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 0f41bfe..a1c45a9 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 _0x422e=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','FreshsalesField','includeAll','include','findAll','rows','catch','params','create','body','update','find','rimraf','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x38d25b,_0x37bcca){var _0x1376e7=function(_0x3bb512){while(--_0x3bb512){_0x38d25b['push'](_0x38d25b['shift']());}};_0x1376e7(++_0x37bcca);}(_0x422e,0xfe));var _0xe422=function(_0x17b024,_0x162f82){_0x17b024=_0x17b024-0x0;var _0x214bbc=_0x422e[_0x17b024];return _0x214bbc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe422('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe422('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe422('0x2'));var util=require(_0xe422('0x3'));var path=require(_0xe422('0x4'));var sox=require(_0xe422('0x5'));var csv=require(_0xe422('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe422('0x7'));var _=require(_0xe422('0x8'));var squel=require(_0xe422('0x9'));var crypto=require(_0xe422('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe422('0xb'));var toCsv=require(_0xe422('0x6'));var querystring=require(_0xe422('0xc'));var Papa=require(_0xe422('0xd'));var Redis=require(_0xe422('0xe'));var authService=require(_0xe422('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe422('0x10'));var hardwareService=require(_0xe422('0x11'));var logger=require('../../config/logger')(_0xe422('0x12'));var utils=require(_0xe422('0x13'));var config=require(_0xe422('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe422('0x15'))['db'];function respondWithStatusCode(_0x2a7618,_0xb13500){_0xb13500=_0xb13500||0xcc;return function(_0x2d557d){if(_0x2d557d){return _0x2a7618[_0xe422('0x16')](_0xb13500);}return _0x2a7618[_0xe422('0x17')](_0xb13500)[_0xe422('0x18')]();};}function respondWithResult(_0x17a64f,_0xfedb2a){_0xfedb2a=_0xfedb2a||0xc8;return function(_0x48aca5){if(_0x48aca5){return _0x17a64f[_0xe422('0x17')](_0xfedb2a)[_0xe422('0x19')](_0x48aca5);}};}function respondWithFilteredResult(_0x4489fc,_0x466c8e){return function(_0x23077e){if(_0x23077e){var _0xc93cd3=typeof _0x466c8e[_0xe422('0x1a')]===_0xe422('0x1b')&&typeof _0x466c8e[_0xe422('0x1c')]===_0xe422('0x1b');var _0x398d8a=_0x23077e[_0xe422('0x1d')];var _0x41f729=_0xc93cd3?0x0:_0x466c8e['offset'];var _0x52dffa=_0xc93cd3?_0x23077e[_0xe422('0x1d')]:_0x466c8e[_0xe422('0x1a')]+_0x466c8e['limit'];var _0x1ee44b;if(_0x52dffa>=_0x398d8a){_0x52dffa=_0x398d8a;_0x1ee44b=0xc8;}else{_0x1ee44b=0xce;}_0x4489fc['status'](_0x1ee44b);return _0x4489fc[_0xe422('0x1e')](_0xe422('0x1f'),_0x41f729+'-'+_0x52dffa+'/'+_0x398d8a)[_0xe422('0x19')](_0x23077e);}return null;};}function patchUpdates(_0x5ec347){return function(_0x1f07b8){try{jsonpatch[_0xe422('0x20')](_0x1f07b8,_0x5ec347,!![]);}catch(_0x9763db){return BPromise[_0xe422('0x21')](_0x9763db);}return _0x1f07b8[_0xe422('0x22')]();};}function saveUpdates(_0x4793cc,_0x31607c){return function(_0x335f8f){if(_0x335f8f){return _0x335f8f['update'](_0x4793cc)[_0xe422('0x23')](function(_0x4ff677){return _0x4ff677;});}return null;};}function removeEntity(_0x16cc11,_0x5a1301){return function(_0x304fae){if(_0x304fae){return _0x304fae[_0xe422('0x24')]()[_0xe422('0x23')](function(){_0x16cc11['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x267e11,_0x56ff96){return function(_0x1f9f72){if(!_0x1f9f72){_0x267e11[_0xe422('0x16')](0x194);}return _0x1f9f72;};}function handleError(_0x111014,_0x3a2d08){_0x3a2d08=_0x3a2d08||0x1f4;return function(_0x27ac69){logger[_0xe422('0x25')](_0x27ac69['stack']);if(_0x27ac69[_0xe422('0x26')]){delete _0x27ac69[_0xe422('0x26')];}_0x111014[_0xe422('0x17')](_0x3a2d08)[_0xe422('0x27')](_0x27ac69);};}exports['index']=function(_0x36706b,_0x1eab62){var _0x439330={},_0x1af7af={},_0x474132={'count':0x0,'rows':[]};var _0xb3d643=_[_0xe422('0x28')](db['FreshsalesField'][_0xe422('0x29')],function(_0x5fc772){return{'name':_0x5fc772[_0xe422('0x2a')],'type':_0x5fc772[_0xe422('0x2b')][_0xe422('0x2c')]};});_0x1af7af['model']=_['map'](_0xb3d643,_0xe422('0x26'));_0x1af7af[_0xe422('0x2d')]=_[_0xe422('0x2e')](_0x36706b[_0xe422('0x2d')]);_0x1af7af[_0xe422('0x2f')]=_[_0xe422('0x30')](_0x1af7af[_0xe422('0x31')],_0x1af7af[_0xe422('0x2d')]);_0x439330[_0xe422('0x32')]=_[_0xe422('0x30')](_0x1af7af[_0xe422('0x31')],qs[_0xe422('0x33')](_0x36706b[_0xe422('0x2d')][_0xe422('0x33')]));_0x439330['attributes']=_0x439330[_0xe422('0x32')][_0xe422('0x34')]?_0x439330['attributes']:_0x1af7af[_0xe422('0x31')];if(!_0x36706b['query']['hasOwnProperty']('nolimit')){_0x439330['limit']=qs[_0xe422('0x1c')](_0x36706b['query'][_0xe422('0x1c')]);_0x439330[_0xe422('0x1a')]=qs['offset'](_0x36706b['query']['offset']);}_0x439330['order']=qs[_0xe422('0x35')](_0x36706b[_0xe422('0x2d')]['sort']);_0x439330[_0xe422('0x36')]=qs[_0xe422('0x2f')](_[_0xe422('0x37')](_0x36706b['query'],_0x1af7af[_0xe422('0x2f')]),_0xb3d643);if(_0x36706b[_0xe422('0x2d')][_0xe422('0x38')]){_0x439330[_0xe422('0x36')]=_[_0xe422('0x39')](_0x439330['where'],{'$or':_[_0xe422('0x28')](_0xb3d643,function(_0x2e365a){if(_0x2e365a[_0xe422('0x2b')]!==_0xe422('0x3a')){var _0x51d7d7={};_0x51d7d7[_0x2e365a[_0xe422('0x26')]]={'$like':'%'+_0x36706b[_0xe422('0x2d')]['filter']+'%'};return _0x51d7d7;}})});}_0x439330=_['merge']({},_0x439330,_0x36706b['options']);var _0x3f24bf={'where':_0x439330['where']};return db[_0xe422('0x3b')][_0xe422('0x1d')](_0x3f24bf)[_0xe422('0x23')](function(_0x4ba3a7){_0x474132[_0xe422('0x1d')]=_0x4ba3a7;if(_0x36706b['query'][_0xe422('0x3c')]){_0x439330[_0xe422('0x3d')]=[{'all':!![]}];}return db[_0xe422('0x3b')][_0xe422('0x3e')](_0x439330);})[_0xe422('0x23')](function(_0x5c2edd){_0x474132[_0xe422('0x3f')]=_0x5c2edd;return _0x474132;})[_0xe422('0x23')](respondWithFilteredResult(_0x1eab62,_0x439330))[_0xe422('0x40')](handleError(_0x1eab62,null));};exports['show']=function(_0x38e4eb,_0x58520d){var _0x21f28e={'raw':!![],'where':{'id':_0x38e4eb[_0xe422('0x41')]['id']}},_0x5c0787={};_0x5c0787['model']=_[_0xe422('0x2e')](db[_0xe422('0x3b')][_0xe422('0x29')]);_0x5c0787['query']=_[_0xe422('0x2e')](_0x38e4eb['query']);_0x5c0787[_0xe422('0x2f')]=_[_0xe422('0x30')](_0x5c0787[_0xe422('0x31')],_0x5c0787[_0xe422('0x2d')]);_0x21f28e['attributes']=_[_0xe422('0x30')](_0x5c0787[_0xe422('0x31')],qs['fields'](_0x38e4eb[_0xe422('0x2d')][_0xe422('0x33')]));_0x21f28e[_0xe422('0x32')]=_0x21f28e[_0xe422('0x32')][_0xe422('0x34')]?_0x21f28e[_0xe422('0x32')]:_0x5c0787[_0xe422('0x31')];if(_0x38e4eb[_0xe422('0x2d')][_0xe422('0x3c')]){_0x21f28e['include']=[{'all':!![]}];}_0x21f28e=_[_0xe422('0x39')]({},_0x21f28e,_0x38e4eb['options']);return db[_0xe422('0x3b')]['find'](_0x21f28e)['then'](handleEntityNotFound(_0x58520d,null))[_0xe422('0x23')](respondWithResult(_0x58520d,null))[_0xe422('0x40')](handleError(_0x58520d,null));};exports[_0xe422('0x42')]=function(_0x4e81da,_0x3901f0){return db[_0xe422('0x3b')]['create'](_0x4e81da[_0xe422('0x43')],{})[_0xe422('0x23')](respondWithResult(_0x3901f0,0xc9))[_0xe422('0x40')](handleError(_0x3901f0,null));};exports[_0xe422('0x44')]=function(_0x1b999f,_0x2c4b38){if(_0x1b999f['body']['id']){delete _0x1b999f[_0xe422('0x43')]['id'];}return db['FreshsalesField'][_0xe422('0x45')]({'where':{'id':_0x1b999f[_0xe422('0x41')]['id']}})['then'](handleEntityNotFound(_0x2c4b38,null))['then'](saveUpdates(_0x1b999f[_0xe422('0x43')],null))[_0xe422('0x23')](respondWithResult(_0x2c4b38,null))[_0xe422('0x40')](handleError(_0x2c4b38,null));};exports['destroy']=function(_0x4db702,_0x2d26cb){return db[_0xe422('0x3b')][_0xe422('0x45')]({'where':{'id':_0x4db702[_0xe422('0x41')]['id']}})[_0xe422('0x23')](handleEntityNotFound(_0x2d26cb,null))['then'](removeEntity(_0x2d26cb,null))[_0xe422('0x40')](handleError(_0x2d26cb,null));}; \ No newline at end of file +var _0xb38d=['../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','create','body','find','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','api'];(function(_0x3d3a83,_0x45f2b6){var _0x4569dc=function(_0x582cf7){while(--_0x582cf7){_0x3d3a83['push'](_0x3d3a83['shift']());}};_0x4569dc(++_0x45f2b6);}(_0xb38d,0x14c));var _0xdb38=function(_0x34a459,_0x136cd9){_0x34a459=_0x34a459-0x0;var _0x500f8b=_0xb38d[_0x34a459];return _0x500f8b;};'use strict';var emlformat=require(_0xdb38('0x0'));var rimraf=require(_0xdb38('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb38('0x2'));var rp=require('request-promise');var moment=require(_0xdb38('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdb38('0x4'));var util=require(_0xdb38('0x5'));var path=require(_0xdb38('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb38('0x7'));var _=require('lodash');var squel=require(_0xdb38('0x8'));var crypto=require(_0xdb38('0x9'));var jsforce=require(_0xdb38('0xa'));var deskjs=require(_0xdb38('0xb'));var toCsv=require(_0xdb38('0xc'));var querystring=require(_0xdb38('0xd'));var Papa=require(_0xdb38('0xe'));var Redis=require(_0xdb38('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdb38('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdb38('0x11'));var utils=require(_0xdb38('0x12'));var config=require(_0xdb38('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x252a66,_0x4760e3){_0x4760e3=_0x4760e3||0xcc;return function(_0x381123){if(_0x381123){return _0x252a66[_0xdb38('0x14')](_0x4760e3);}return _0x252a66[_0xdb38('0x15')](_0x4760e3)['end']();};}function respondWithResult(_0x1f108b,_0x4b20cb){_0x4b20cb=_0x4b20cb||0xc8;return function(_0x1859a3){if(_0x1859a3){return _0x1f108b['status'](_0x4b20cb)[_0xdb38('0x16')](_0x1859a3);}};}function respondWithFilteredResult(_0x5a0cdc,_0xd0d80e){return function(_0x4fea4e){if(_0x4fea4e){var _0x564cc5=typeof _0xd0d80e[_0xdb38('0x17')]===_0xdb38('0x18')&&typeof _0xd0d80e[_0xdb38('0x19')]===_0xdb38('0x18');var _0xf2f4dc=_0x4fea4e[_0xdb38('0x1a')];var _0x285a58=_0x564cc5?0x0:_0xd0d80e[_0xdb38('0x17')];var _0x3eba7b=_0x564cc5?_0x4fea4e['count']:_0xd0d80e[_0xdb38('0x17')]+_0xd0d80e[_0xdb38('0x19')];var _0x29fc1a;if(_0x3eba7b>=_0xf2f4dc){_0x3eba7b=_0xf2f4dc;_0x29fc1a=0xc8;}else{_0x29fc1a=0xce;}_0x5a0cdc['status'](_0x29fc1a);return _0x5a0cdc[_0xdb38('0x1b')](_0xdb38('0x1c'),_0x285a58+'-'+_0x3eba7b+'/'+_0xf2f4dc)[_0xdb38('0x16')](_0x4fea4e);}return null;};}function patchUpdates(_0x2fd553){return function(_0x5a9a17){try{jsonpatch[_0xdb38('0x1d')](_0x5a9a17,_0x2fd553,!![]);}catch(_0x5ca033){return BPromise[_0xdb38('0x1e')](_0x5ca033);}return _0x5a9a17[_0xdb38('0x1f')]();};}function saveUpdates(_0x45b4c7,_0x52d94d){return function(_0x481078){if(_0x481078){return _0x481078[_0xdb38('0x20')](_0x45b4c7)['then'](function(_0x4aaaa2){return _0x4aaaa2;});}return null;};}function removeEntity(_0x3d3402,_0x264fd9){return function(_0x20d3ed){if(_0x20d3ed){return _0x20d3ed[_0xdb38('0x21')]()[_0xdb38('0x22')](function(){_0x3d3402[_0xdb38('0x15')](0xcc)[_0xdb38('0x23')]();});}};}function handleEntityNotFound(_0x3c628a,_0x5135cb){return function(_0x469f5c){if(!_0x469f5c){_0x3c628a[_0xdb38('0x14')](0x194);}return _0x469f5c;};}function handleError(_0x24d0ea,_0x57053c){_0x57053c=_0x57053c||0x1f4;return function(_0x30402e){logger['error'](_0x30402e[_0xdb38('0x24')]);if(_0x30402e[_0xdb38('0x25')]){delete _0x30402e[_0xdb38('0x25')];}_0x24d0ea[_0xdb38('0x15')](_0x57053c)[_0xdb38('0x26')](_0x30402e);};}exports[_0xdb38('0x27')]=function(_0x1f5d29,_0x2f621e){var _0x82fdd1={},_0x36f12d={},_0x128ac6={'count':0x0,'rows':[]};var _0x101818=_[_0xdb38('0x28')](db[_0xdb38('0x29')][_0xdb38('0x2a')],function(_0x4aff04){return{'name':_0x4aff04[_0xdb38('0x2b')],'type':_0x4aff04[_0xdb38('0x2c')][_0xdb38('0x2d')]};});_0x36f12d[_0xdb38('0x2e')]=_[_0xdb38('0x28')](_0x101818,_0xdb38('0x25'));_0x36f12d['query']=_['keys'](_0x1f5d29[_0xdb38('0x2f')]);_0x36f12d[_0xdb38('0x30')]=_[_0xdb38('0x31')](_0x36f12d['model'],_0x36f12d[_0xdb38('0x2f')]);_0x82fdd1[_0xdb38('0x32')]=_[_0xdb38('0x31')](_0x36f12d[_0xdb38('0x2e')],qs[_0xdb38('0x33')](_0x1f5d29['query'][_0xdb38('0x33')]));_0x82fdd1[_0xdb38('0x32')]=_0x82fdd1[_0xdb38('0x32')][_0xdb38('0x34')]?_0x82fdd1[_0xdb38('0x32')]:_0x36f12d[_0xdb38('0x2e')];if(!_0x1f5d29[_0xdb38('0x2f')]['hasOwnProperty'](_0xdb38('0x35'))){_0x82fdd1['limit']=qs[_0xdb38('0x19')](_0x1f5d29[_0xdb38('0x2f')][_0xdb38('0x19')]);_0x82fdd1[_0xdb38('0x17')]=qs[_0xdb38('0x17')](_0x1f5d29[_0xdb38('0x2f')]['offset']);}_0x82fdd1['order']=qs['sort'](_0x1f5d29['query']['sort']);_0x82fdd1['where']=qs['filters'](_[_0xdb38('0x36')](_0x1f5d29[_0xdb38('0x2f')],_0x36f12d['filters']),_0x101818);if(_0x1f5d29[_0xdb38('0x2f')][_0xdb38('0x37')]){_0x82fdd1['where']=_[_0xdb38('0x38')](_0x82fdd1[_0xdb38('0x39')],{'$or':_['map'](_0x101818,function(_0x3513d2){if(_0x3513d2[_0xdb38('0x2c')]!==_0xdb38('0x3a')){var _0x5771c5={};_0x5771c5[_0x3513d2['name']]={'$like':'%'+_0x1f5d29[_0xdb38('0x2f')]['filter']+'%'};return _0x5771c5;}})});}_0x82fdd1=_[_0xdb38('0x38')]({},_0x82fdd1,_0x1f5d29[_0xdb38('0x3b')]);var _0x1c2202={'where':_0x82fdd1[_0xdb38('0x39')]};return db['FreshsalesField'][_0xdb38('0x1a')](_0x1c2202)[_0xdb38('0x22')](function(_0x24de90){_0x128ac6[_0xdb38('0x1a')]=_0x24de90;if(_0x1f5d29['query'][_0xdb38('0x3c')]){_0x82fdd1[_0xdb38('0x3d')]=[{'all':!![]}];}return db[_0xdb38('0x29')]['findAll'](_0x82fdd1);})[_0xdb38('0x22')](function(_0x3cd0af){_0x128ac6[_0xdb38('0x3e')]=_0x3cd0af;return _0x128ac6;})['then'](respondWithFilteredResult(_0x2f621e,_0x82fdd1))[_0xdb38('0x3f')](handleError(_0x2f621e,null));};exports[_0xdb38('0x40')]=function(_0x2575e0,_0x13c293){var _0x157c36={'raw':!![],'where':{'id':_0x2575e0[_0xdb38('0x41')]['id']}},_0x4ef412={};_0x4ef412[_0xdb38('0x2e')]=_[_0xdb38('0x42')](db[_0xdb38('0x29')]['rawAttributes']);_0x4ef412[_0xdb38('0x2f')]=_[_0xdb38('0x42')](_0x2575e0[_0xdb38('0x2f')]);_0x4ef412['filters']=_['intersection'](_0x4ef412['model'],_0x4ef412[_0xdb38('0x2f')]);_0x157c36[_0xdb38('0x32')]=_[_0xdb38('0x31')](_0x4ef412[_0xdb38('0x2e')],qs[_0xdb38('0x33')](_0x2575e0[_0xdb38('0x2f')]['fields']));_0x157c36['attributes']=_0x157c36[_0xdb38('0x32')]['length']?_0x157c36[_0xdb38('0x32')]:_0x4ef412[_0xdb38('0x2e')];if(_0x2575e0[_0xdb38('0x2f')][_0xdb38('0x3c')]){_0x157c36['include']=[{'all':!![]}];}_0x157c36=_[_0xdb38('0x38')]({},_0x157c36,_0x2575e0[_0xdb38('0x3b')]);return db['FreshsalesField']['find'](_0x157c36)[_0xdb38('0x22')](handleEntityNotFound(_0x13c293,null))[_0xdb38('0x22')](respondWithResult(_0x13c293,null))[_0xdb38('0x3f')](handleError(_0x13c293,null));};exports[_0xdb38('0x43')]=function(_0x24287b,_0x3b6e52){return db[_0xdb38('0x29')][_0xdb38('0x43')](_0x24287b[_0xdb38('0x44')],{})[_0xdb38('0x22')](respondWithResult(_0x3b6e52,0xc9))[_0xdb38('0x3f')](handleError(_0x3b6e52,null));};exports[_0xdb38('0x20')]=function(_0x29b828,_0x4d8099){if(_0x29b828[_0xdb38('0x44')]['id']){delete _0x29b828[_0xdb38('0x44')]['id'];}return db[_0xdb38('0x29')]['find']({'where':{'id':_0x29b828[_0xdb38('0x41')]['id']}})[_0xdb38('0x22')](handleEntityNotFound(_0x4d8099,null))[_0xdb38('0x22')](saveUpdates(_0x29b828[_0xdb38('0x44')],null))['then'](respondWithResult(_0x4d8099,null))[_0xdb38('0x3f')](handleError(_0x4d8099,null));};exports['destroy']=function(_0x1f3ed9,_0x59c936){return db[_0xdb38('0x29')][_0xdb38('0x45')]({'where':{'id':_0x1f3ed9[_0xdb38('0x41')]['id']}})[_0xdb38('0x22')](handleEntityNotFound(_0x59c936,null))[_0xdb38('0x22')](removeEntity(_0x59c936,null))[_0xdb38('0x3f')](handleError(_0x59c936,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index b139460..6e139d2 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 _0xa5d7=['lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports','FreshsalesField','int_freshsales_fields','idField'];(function(_0x4d4b98,_0x1dbf18){var _0x207c7c=function(_0x2ceef8){while(--_0x2ceef8){_0x4d4b98['push'](_0x4d4b98['shift']());}};_0x207c7c(++_0x1dbf18);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0xa5d7[_0x591cfd];return _0x4d0100;};'use strict';var _=require(_0x7a5d('0x0'));var util=require(_0x7a5d('0x1'));var logger=require(_0x7a5d('0x2'))(_0x7a5d('0x3'));var moment=require('moment');var BPromise=require(_0x7a5d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a5d('0x5'));var rimraf=require('rimraf');var config=require(_0x7a5d('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0x7a5d('0x7')]=function(_0x42a143,_0x251ef5){return _0x42a143['define'](_0x7a5d('0x8'),attributes,{'tableName':_0x7a5d('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x7a5d('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdfb1=['api','bluebird','request-promise','path','rimraf','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x58b36b,_0x3c03de){_0x58b36b=_0x58b36b-0x0;var _0x24de76=_0xdfb1[_0x58b36b];return _0x24de76;};'use strict';var _=require(_0x1dfb('0x0'));var util=require(_0x1dfb('0x1'));var logger=require(_0x1dfb('0x2'))(_0x1dfb('0x3'));var moment=require('moment');var BPromise=require(_0x1dfb('0x4'));var rp=require(_0x1dfb('0x5'));var fs=require('fs');var path=require(_0x1dfb('0x6'));var rimraf=require(_0x1dfb('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x31f0ff,_0x36bf77){return _0x31f0ff[_0x1dfb('0x8')]('FreshsalesField',attributes,{'tableName':_0x1dfb('0x9'),'paranoid':![],'indexes':[{'name':_0x1dfb('0xa'),'fields':[_0x1dfb('0xb'),_0x1dfb('0xc')],'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 c1e3d45..5f85535 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 _0x31f0=['../../config/environment','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2bf8e5,_0x9528a2){var _0x5bf43b=function(_0x569971){while(--_0x569971){_0x2bf8e5['push'](_0x2bf8e5['shift']());}};_0x5bf43b(++_0x9528a2);}(_0x31f0,0xb7));var _0x031f=function(_0x4a96b7,_0x546c26){_0x4a96b7=_0x4a96b7-0x0;var _0x2e4e46=_0x31f0[_0x4a96b7];return _0x2e4e46;};'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')]('FreshsalesField,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file +var _0x814b=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\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(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x814b,0x1a2));var _0xb814=function(_0xa46b86,_0x5c1465){_0xa46b86=_0xa46b86-0x0;var _0x417360=_0x814b[_0xa46b86];return _0x417360;};'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')]('FreshsalesField,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 5fd5fee..2eab2c9 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 _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(_0x4cd41d,_0x2c10e6){var _0x5b8075=function(_0x22d55f){while(--_0x22d55f){_0x4cd41d['push'](_0x4cd41d['shift']());}};_0x5b8075(++_0x2c10e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1145f1,_0x2f82b6){var _0x201c07=function(_0x2413cc){while(--_0x2413cc){_0x1145f1['push'](_0x1145f1['shift']());}};_0x201c07(++_0x2f82b6);}(_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/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 6e1be26..a95ed88 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 _0xc0a6=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x430a59,_0x14fcdb){var _0x2da524=function(_0x49cf81){while(--_0x49cf81){_0x430a59['push'](_0x430a59['shift']());}};_0x2da524(++_0x14fcdb);}(_0xc0a6,0xcb));var _0x6c0a=function(_0x4209fa,_0x2c959e){_0x4209fa=_0x4209fa-0x0;var _0x3fb164=_0xc0a6[_0x4209fa];return _0x3fb164;};'use strict';var Sequelize=require(_0x6c0a('0x0'));module[_0x6c0a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6c0a('0x2')]},'username':{'type':Sequelize[_0x6c0a('0x2')],'unique':_0x6c0a('0x3')},'remoteUri':{'type':Sequelize[_0x6c0a('0x2')]},'password':{'type':Sequelize[_0x6c0a('0x2')]},'clientId':{'type':Sequelize[_0x6c0a('0x2')]},'clientSecret':{'type':Sequelize[_0x6c0a('0x2')]},'securityToken':{'type':Sequelize[_0x6c0a('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6c0a('0x4')](_0x6c0a('0x5'),_0x6c0a('0x6')),'defaultValue':_0x6c0a('0x5')}}; \ No newline at end of file +var _0xb158=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xb158,0xfc));var _0x8b15=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xb158[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x8b15('0x0'));module[_0x8b15('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8b15('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x8b15('0x3')},'remoteUri':{'type':Sequelize[_0x8b15('0x2')]},'password':{'type':Sequelize[_0x8b15('0x2')]},'clientId':{'type':Sequelize[_0x8b15('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x8b15('0x2')]},'serverUrl':{'type':Sequelize[_0x8b15('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8b15('0x4')](_0x8b15('0x5'),_0x8b15('0x6')),'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 9d27f6a..5cd77e8 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 _0x4e38=['query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','slice','lastIndexOf','Connection','clientId','login','concat','securityToken','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','int','boolean','textarea','includes','label','custom','picklistValues','true','false','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','then','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','keys'];(function(_0x5d9f4a,_0x18638a){var _0xfe36ae=function(_0x2b4696){while(--_0x2b4696){_0x5d9f4a['push'](_0x5d9f4a['shift']());}};_0xfe36ae(++_0x18638a);}(_0x4e38,0x13d));var _0x84e3=function(_0x55b9b7,_0x486ee3){_0x55b9b7=_0x55b9b7-0x0;var _0x7181b3=_0x4e38[_0x55b9b7];return _0x7181b3;};'use strict';var emlformat=require(_0x84e3('0x0'));var rimraf=require(_0x84e3('0x1'));var zipdir=require(_0x84e3('0x2'));var jsonpatch=require(_0x84e3('0x3'));var rp=require('request-promise');var moment=require(_0x84e3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x84e3('0x5'));var path=require(_0x84e3('0x6'));var sox=require(_0x84e3('0x7'));var csv=require(_0x84e3('0x8'));var ejs=require(_0x84e3('0x9'));var fs=require('fs');var fs_extra=require(_0x84e3('0xa'));var _=require('lodash');var squel=require(_0x84e3('0xb'));var crypto=require(_0x84e3('0xc'));var jsforce=require(_0x84e3('0xd'));var deskjs=require(_0x84e3('0xe'));var toCsv=require(_0x84e3('0x8'));var querystring=require(_0x84e3('0xf'));var Papa=require('papaparse');var Redis=require(_0x84e3('0x10'));var authService=require(_0x84e3('0x11'));var qs=require(_0x84e3('0x12'));var as=require(_0x84e3('0x13'));var hardwareService=require(_0x84e3('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x84e3('0x15'));var config=require(_0x84e3('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x84e3('0x17'))['db'];var integrations=require(_0x84e3('0x18'));function respondWithStatusCode(_0x3e9942,_0x35e444){_0x35e444=_0x35e444||0xcc;return function(_0x513d6c){if(_0x513d6c){return _0x3e9942[_0x84e3('0x19')](_0x35e444);}return _0x3e9942[_0x84e3('0x1a')](_0x35e444)[_0x84e3('0x1b')]();};}function respondWithResult(_0x4e213d,_0x21a652){_0x21a652=_0x21a652||0xc8;return function(_0x3b80bb){if(_0x3b80bb){return _0x4e213d[_0x84e3('0x1a')](_0x21a652)[_0x84e3('0x1c')](_0x3b80bb);}};}function respondWithFilteredResult(_0x5d3598,_0x375681){return function(_0x33b32e){if(_0x33b32e){var _0x573d1e=typeof _0x375681[_0x84e3('0x1d')]==='undefined'&&typeof _0x375681[_0x84e3('0x1e')]==='undefined';var _0x1ed4d9=_0x33b32e[_0x84e3('0x1f')];var _0x79e9c0=_0x573d1e?0x0:_0x375681['offset'];var _0x14283a=_0x573d1e?_0x33b32e[_0x84e3('0x1f')]:_0x375681[_0x84e3('0x1d')]+_0x375681[_0x84e3('0x1e')];var _0x1511ae;if(_0x14283a>=_0x1ed4d9){_0x14283a=_0x1ed4d9;_0x1511ae=0xc8;}else{_0x1511ae=0xce;}_0x5d3598['status'](_0x1511ae);return _0x5d3598[_0x84e3('0x20')](_0x84e3('0x21'),_0x79e9c0+'-'+_0x14283a+'/'+_0x1ed4d9)[_0x84e3('0x1c')](_0x33b32e);}return null;};}function patchUpdates(_0x47808b){return function(_0x408523){try{jsonpatch[_0x84e3('0x22')](_0x408523,_0x47808b,!![]);}catch(_0x48352e){return BPromise['reject'](_0x48352e);}return _0x408523[_0x84e3('0x23')]();};}function saveUpdates(_0x3fb730,_0x3da52d){return function(_0x97caf4){if(_0x97caf4){return _0x97caf4['update'](_0x3fb730)[_0x84e3('0x24')](function(_0x524b6c){return _0x524b6c;});}return null;};}function removeEntity(_0x49466c,_0x10d1da){return function(_0x4bee71){if(_0x4bee71){return _0x4bee71['destroy']()[_0x84e3('0x24')](function(){_0x49466c[_0x84e3('0x1a')](0xcc)[_0x84e3('0x1b')]();});}};}function handleEntityNotFound(_0x226969,_0x5beb2d){return function(_0x17467d){if(!_0x17467d){_0x226969[_0x84e3('0x19')](0x194);}return _0x17467d;};}function handleError(_0x5aa5ff,_0x203c51){_0x203c51=_0x203c51||0x1f4;return function(_0x188b3f){logger[_0x84e3('0x25')](_0x188b3f[_0x84e3('0x26')]);if(_0x188b3f[_0x84e3('0x27')]){delete _0x188b3f[_0x84e3('0x27')];}_0x5aa5ff[_0x84e3('0x1a')](_0x203c51)[_0x84e3('0x28')](_0x188b3f);};}exports[_0x84e3('0x29')]=function(_0x23e2bb,_0x48aedf){var _0x30d0f7={},_0x3f07b9={},_0x28c706={'count':0x0,'rows':[]};var _0x114b77=_[_0x84e3('0x2a')](db[_0x84e3('0x2b')][_0x84e3('0x2c')],function(_0x281ecc){return{'name':_0x281ecc[_0x84e3('0x2d')],'type':_0x281ecc[_0x84e3('0x2e')][_0x84e3('0x2f')]};});_0x3f07b9['model']=_[_0x84e3('0x2a')](_0x114b77,_0x84e3('0x27'));_0x3f07b9['query']=_[_0x84e3('0x30')](_0x23e2bb[_0x84e3('0x31')]);_0x3f07b9['filters']=_[_0x84e3('0x32')](_0x3f07b9['model'],_0x3f07b9['query']);_0x30d0f7['attributes']=_[_0x84e3('0x32')](_0x3f07b9[_0x84e3('0x33')],qs[_0x84e3('0x34')](_0x23e2bb[_0x84e3('0x31')][_0x84e3('0x34')]));_0x30d0f7[_0x84e3('0x35')]=_0x30d0f7[_0x84e3('0x35')][_0x84e3('0x36')]?_0x30d0f7[_0x84e3('0x35')]:_0x3f07b9[_0x84e3('0x33')];if(!_0x23e2bb[_0x84e3('0x31')][_0x84e3('0x37')](_0x84e3('0x38'))){_0x30d0f7['limit']=qs[_0x84e3('0x1e')](_0x23e2bb[_0x84e3('0x31')][_0x84e3('0x1e')]);_0x30d0f7[_0x84e3('0x1d')]=qs[_0x84e3('0x1d')](_0x23e2bb[_0x84e3('0x31')][_0x84e3('0x1d')]);}_0x30d0f7[_0x84e3('0x39')]=qs['sort'](_0x23e2bb[_0x84e3('0x31')][_0x84e3('0x3a')]);_0x30d0f7['where']=qs[_0x84e3('0x3b')](_['pick'](_0x23e2bb['query'],_0x3f07b9['filters']),_0x114b77);if(_0x23e2bb['query'][_0x84e3('0x3c')]){_0x30d0f7[_0x84e3('0x3d')]=_[_0x84e3('0x3e')](_0x30d0f7[_0x84e3('0x3d')],{'$or':_[_0x84e3('0x2a')](_0x114b77,function(_0x441c5a){if(_0x441c5a[_0x84e3('0x2e')]!=='VIRTUAL'){var _0x9fd323={};_0x9fd323[_0x441c5a[_0x84e3('0x27')]]={'$like':'%'+_0x23e2bb[_0x84e3('0x31')][_0x84e3('0x3c')]+'%'};return _0x9fd323;}})});}_0x30d0f7=_[_0x84e3('0x3e')]({},_0x30d0f7,_0x23e2bb[_0x84e3('0x3f')]);var _0x2765ec={'where':_0x30d0f7[_0x84e3('0x3d')]};return db[_0x84e3('0x2b')]['count'](_0x2765ec)[_0x84e3('0x24')](function(_0x3d60d1){_0x28c706['count']=_0x3d60d1;if(_0x23e2bb[_0x84e3('0x31')][_0x84e3('0x40')]){_0x30d0f7[_0x84e3('0x41')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x84e3('0x42')](_0x30d0f7);})[_0x84e3('0x24')](function(_0x539bc3){_0x28c706[_0x84e3('0x43')]=_0x539bc3;return _0x28c706;})[_0x84e3('0x24')](respondWithFilteredResult(_0x48aedf,_0x30d0f7))['catch'](handleError(_0x48aedf,null));};exports[_0x84e3('0x44')]=function(_0x824127,_0x191415){var _0x404984={'raw':![],'where':{'id':_0x824127[_0x84e3('0x45')]['id']}},_0x40c699={};_0x40c699[_0x84e3('0x33')]=_['keys'](db[_0x84e3('0x2b')][_0x84e3('0x2c')]);_0x40c699[_0x84e3('0x31')]=_[_0x84e3('0x30')](_0x824127['query']);_0x40c699[_0x84e3('0x3b')]=_[_0x84e3('0x32')](_0x40c699[_0x84e3('0x33')],_0x40c699[_0x84e3('0x31')]);_0x404984[_0x84e3('0x35')]=_[_0x84e3('0x32')](_0x40c699['model'],qs[_0x84e3('0x34')](_0x824127['query']['fields']));_0x404984[_0x84e3('0x35')]=_0x404984[_0x84e3('0x35')][_0x84e3('0x36')]?_0x404984[_0x84e3('0x35')]:_0x40c699[_0x84e3('0x33')];if(_0x824127[_0x84e3('0x31')][_0x84e3('0x40')]){_0x404984[_0x84e3('0x41')]=[{'all':!![]}];}_0x404984=_['merge']({},_0x404984,_0x824127[_0x84e3('0x3f')]);return db[_0x84e3('0x2b')][_0x84e3('0x46')](_0x404984)[_0x84e3('0x24')](handleEntityNotFound(_0x191415,null))[_0x84e3('0x24')](respondWithResult(_0x191415,null))[_0x84e3('0x47')](handleError(_0x191415,null));};exports[_0x84e3('0x48')]=function(_0x348183,_0x1cd61b){return db[_0x84e3('0x2b')][_0x84e3('0x48')](_0x348183[_0x84e3('0x49')],{})[_0x84e3('0x24')](respondWithResult(_0x1cd61b,0xc9))[_0x84e3('0x47')](handleError(_0x1cd61b,null));};exports['update']=function(_0x50be45,_0xa275a){if(_0x50be45[_0x84e3('0x49')]['id']){delete _0x50be45[_0x84e3('0x49')]['id'];}return db[_0x84e3('0x2b')][_0x84e3('0x46')]({'where':{'id':_0x50be45[_0x84e3('0x45')]['id']}})[_0x84e3('0x24')](handleEntityNotFound(_0xa275a,null))['then'](saveUpdates(_0x50be45[_0x84e3('0x49')],null))[_0x84e3('0x24')](respondWithResult(_0xa275a,null))[_0x84e3('0x47')](handleError(_0xa275a,null));};exports[_0x84e3('0x4a')]=function(_0x23349b,_0x2d8f93){return db[_0x84e3('0x2b')][_0x84e3('0x46')]({'where':{'id':_0x23349b[_0x84e3('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d8f93,null))[_0x84e3('0x24')](removeEntity(_0x2d8f93,null))['catch'](handleError(_0x2d8f93,null));};exports['getConfigurations']=function(_0x472edb,_0x1e7df5,_0x450dd6){var _0x410eae={};var _0x2158e4={};var _0x34f982;var _0x1b6fdf;return db[_0x84e3('0x2b')][_0x84e3('0x4b')]({'where':{'id':_0x472edb['params']['id']}})[_0x84e3('0x24')](handleEntityNotFound(_0x1e7df5,null))['then'](function(_0x380959){if(_0x380959){_0x34f982=_0x380959;_0x2158e4[_0x84e3('0x33')]=_[_0x84e3('0x30')](db[_0x84e3('0x4c')][_0x84e3('0x2c')]);_0x2158e4[_0x84e3('0x31')]=_[_0x84e3('0x30')](_0x472edb['query']);_0x2158e4['filters']=_[_0x84e3('0x32')](_0x2158e4['model'],_0x2158e4[_0x84e3('0x31')]);_0x410eae['attributes']=_[_0x84e3('0x32')](_0x2158e4[_0x84e3('0x33')],qs['fields'](_0x472edb[_0x84e3('0x31')][_0x84e3('0x34')]));_0x410eae['attributes']=_0x410eae['attributes'][_0x84e3('0x36')]?_0x410eae[_0x84e3('0x35')]:_0x2158e4[_0x84e3('0x33')];_0x410eae[_0x84e3('0x39')]=qs[_0x84e3('0x3a')](_0x472edb[_0x84e3('0x31')]['sort']);_0x410eae['where']=qs['filters'](_['pick'](_0x472edb[_0x84e3('0x31')],_0x2158e4['filters']));if(_0x472edb[_0x84e3('0x31')][_0x84e3('0x3c')]){_0x410eae[_0x84e3('0x3d')]=_[_0x84e3('0x3e')](_0x410eae[_0x84e3('0x3d')],{'$or':_[_0x84e3('0x2a')](_0x410eae['attributes'],function(_0xf1cea6){var _0x2ec94d={};_0x2ec94d[_0xf1cea6]={'$like':'%'+_0x472edb['query'][_0x84e3('0x3c')]+'%'};return _0x2ec94d;})});}_0x410eae=_[_0x84e3('0x3e')]({},_0x410eae,_0x472edb['options']);return _0x34f982[_0x84e3('0x4d')](_0x410eae);}})[_0x84e3('0x24')](function(_0x4e89ef){if(_0x4e89ef){_0x1b6fdf=_0x4e89ef[_0x84e3('0x36')];if(!_0x472edb['query'][_0x84e3('0x37')](_0x84e3('0x38'))){_0x410eae[_0x84e3('0x1e')]=qs['limit'](_0x472edb['query'][_0x84e3('0x1e')]);_0x410eae[_0x84e3('0x1d')]=qs[_0x84e3('0x1d')](_0x472edb[_0x84e3('0x31')]['offset']);}return _0x34f982[_0x84e3('0x4d')](_0x410eae);}})[_0x84e3('0x24')](function(_0x230839){if(_0x230839){return _0x230839?{'count':_0x1b6fdf,'rows':_0x230839}:null;}})[_0x84e3('0x24')](respondWithResult(_0x1e7df5,null))['catch'](handleError(_0x1e7df5,null));};exports[_0x84e3('0x4e')]=function(_0x1a959a,_0x4cb43d,_0x1ebc55){if(_0x1a959a[_0x84e3('0x49')]['id']){delete _0x1a959a[_0x84e3('0x49')]['id'];}return db[_0x84e3('0x2b')][_0x84e3('0x4b')]({'where':{'id':_0x1a959a[_0x84e3('0x45')]['id']}})[_0x84e3('0x24')](handleEntityNotFound(_0x4cb43d,null))[_0x84e3('0x24')](function(_0x58a72d){if(_0x58a72d){_0x1a959a[_0x84e3('0x49')][_0x84e3('0x4f')]=_0x58a72d['id'];_0x1a959a[_0x84e3('0x49')][_0x84e3('0x50')]=integrations[_0x84e3('0x51')](_0x1a959a[_0x84e3('0x49')][_0x84e3('0x52')],_0x1a959a[_0x84e3('0x49')][_0x84e3('0x2e')]);_0x1a959a[_0x84e3('0x49')]['Descriptions']=integrations[_0x84e3('0x53')](_0x1a959a[_0x84e3('0x49')][_0x84e3('0x52')],_0x1a959a[_0x84e3('0x49')][_0x84e3('0x2e')]);return db[_0x84e3('0x4c')]['create'](_0x1a959a[_0x84e3('0x49')],{'include':[{'model':db[_0x84e3('0x54')],'as':'Subjects'},{'model':db[_0x84e3('0x54')],'as':'Descriptions'}]});}return null;})[_0x84e3('0x24')](respondWithResult(_0x4cb43d,null))[_0x84e3('0x47')](handleError(_0x4cb43d,null));};exports[_0x84e3('0x55')]=function(_0xa09272,_0x50cdd3,_0x443660){var _0x227542;var _0x5a9e09='';var _0xaa76cc=_0x84e3('0x56');return db[_0x84e3('0x2b')][_0x84e3('0x4b')]({'where':{'id':_0xa09272[_0x84e3('0x45')]['id']},'attributes':['id',_0x84e3('0x57'),'clientId',_0x84e3('0x58'),_0x84e3('0x59'),_0x84e3('0x5a'),'securityToken']})['then'](handleEntityNotFound(_0x50cdd3,null))[_0x84e3('0x24')](function(_0x53ef2b){if(_0x53ef2b){_0x5a9e09=_0x53ef2b['remoteUri'];var _0x2c6bad=_0x5a9e09[_0x84e3('0x5b')](-0x1);if(_0x2c6bad==='/'){_0x5a9e09=_0x5a9e09['substring'](0x0,_0x5a9e09[_0x84e3('0x5c')](_0x2c6bad));}_0x227542=new jsforce[(_0x84e3('0x5d'))]({'oauth2':{'loginUrl':_0x5a9e09,'clientId':_0x53ef2b[_0x84e3('0x5e')],'clientSecret':_0x53ef2b[_0x84e3('0x58')]}});return _0x227542[_0x84e3('0x5f')](_0x53ef2b[_0x84e3('0x59')],_0x53ef2b[_0x84e3('0x5a')][_0x84e3('0x60')](_0x53ef2b[_0x84e3('0x61')]));}})[_0x84e3('0x24')](function(_0x205a86){if(_0x205a86){if(!_[_0x84e3('0x62')](_0xa09272[_0x84e3('0x31')]['ticketType'])){_0xaa76cc=_0xa09272[_0x84e3('0x31')][_0x84e3('0x63')];}return _0x227542[_0x84e3('0x64')](_0xaa76cc)[_0x84e3('0x65')]();}})[_0x84e3('0x24')](function(_0x4d8796){var _0x4eaca8=[_0x84e3('0x66'),'ActivityDate',_0x84e3('0x67'),_0x84e3('0x68'),_0x84e3('0x69'),_0x84e3('0x6a')];var _0x2bf40d=[_0x84e3('0x6b'),_0x84e3('0x6c'),'picklist',_0x84e3('0x6d'),'email',_0x84e3('0x6e'),'phone'];if(_0x4d8796){_['remove'](_0x4d8796[_0x84e3('0x34')],function(_0x44f095){return _0x4eaca8[_0x84e3('0x6f')](_0x44f095['name'])||!_0x2bf40d[_0x84e3('0x6f')](_0x44f095['type']);});return{'count':_0x4d8796[_0x84e3('0x34')][_0x84e3('0x36')],'rows':_[_0x84e3('0x2a')](_0x4d8796[_0x84e3('0x34')],function(_0x51aca1){return{'id':_0x51aca1[_0x84e3('0x27')],'name':_0x51aca1[_0x84e3('0x70')],'custom':_0x51aca1[_0x84e3('0x71')],'options':_0x51aca1['picklistValues']['length']>0x0?_[_0x84e3('0x2a')](_0x51aca1[_0x84e3('0x72')],function(_0x38a72a){return{'name':_0x38a72a[_0x84e3('0x70')],'value':_0x38a72a['value']};}):_0x51aca1[_0x84e3('0x2e')]=='boolean'?[{'name':'True','value':_0x84e3('0x73')},{'name':'False','value':_0x84e3('0x74')}]:[]};})};}})[_0x84e3('0x24')](respondWithResult(_0x50cdd3,null))[_0x84e3('0x47')](function(_0x4141e4){var _0x3b0fb6=_0xa09272[_0x84e3('0x31')]['test']?0x1f4:_0x4141e4['statusCode']||0x1f4;logger[_0x84e3('0x25')](_0x84e3('0x75'),_0x84e3('0x55'),_0x3b0fb6,JSON[_0x84e3('0x76')](_0x4141e4));delete _0x4141e4[_0x84e3('0x27')];if(_0x3b0fb6===0x191){_0x3b0fb6=0x190;}_0x50cdd3[_0x84e3('0x1a')](_0x3b0fb6)[_0x84e3('0x28')](_0xa09272[_0x84e3('0x31')][_0x84e3('0x77')]?{'message':_0x84e3('0x78'),'statusCode':_0x4141e4[_0x84e3('0x79')]}:_0x4141e4);});}; \ No newline at end of file +var _0xe012=['sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','string','int','picklist','boolean','email','textarea','phone','remove','includes','custom','picklistValues','label','value','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','end','error','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','show','params','includeAll','find','catch','create','body','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceConfiguration','SalesforceField','remoteUri','clientId','clientSecret','securityToken','slice','substring','lastIndexOf','Connection','login','username','password','concat','ticketType'];(function(_0x1c873d,_0x1b3094){var _0x27ad73=function(_0x58a656){while(--_0x58a656){_0x1c873d['push'](_0x1c873d['shift']());}};_0x27ad73(++_0x1b3094);}(_0xe012,0x98));var _0x2e01=function(_0x5aaba9,_0x1c4282){_0x5aaba9=_0x5aaba9-0x0;var _0x469349=_0xe012[_0x5aaba9];return _0x469349;};'use strict';var emlformat=require(_0x2e01('0x0'));var rimraf=require(_0x2e01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2e01('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2e01('0x3'));var util=require(_0x2e01('0x4'));var path=require(_0x2e01('0x5'));var sox=require(_0x2e01('0x6'));var csv=require(_0x2e01('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e01('0x8'));var _=require(_0x2e01('0x9'));var squel=require(_0x2e01('0xa'));var crypto=require(_0x2e01('0xb'));var jsforce=require(_0x2e01('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2e01('0x7'));var querystring=require('querystring');var Papa=require(_0x2e01('0xd'));var Redis=require(_0x2e01('0xe'));var authService=require(_0x2e01('0xf'));var qs=require(_0x2e01('0x10'));var as=require(_0x2e01('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e01('0x12'))('api');var utils=require(_0x2e01('0x13'));var config=require(_0x2e01('0x14'));var licenseUtil=require(_0x2e01('0x15'));var db=require(_0x2e01('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x35bcb9,_0x429735){_0x429735=_0x429735||0xcc;return function(_0x5909c4){if(_0x5909c4){return _0x35bcb9[_0x2e01('0x17')](_0x429735);}return _0x35bcb9[_0x2e01('0x18')](_0x429735)['end']();};}function respondWithResult(_0x21a05f,_0x129678){_0x129678=_0x129678||0xc8;return function(_0x4c35de){if(_0x4c35de){return _0x21a05f[_0x2e01('0x18')](_0x129678)['json'](_0x4c35de);}};}function respondWithFilteredResult(_0x49edc9,_0x291412){return function(_0x3b1a4d){if(_0x3b1a4d){var _0x6a1ae2=typeof _0x291412[_0x2e01('0x19')]===_0x2e01('0x1a')&&typeof _0x291412[_0x2e01('0x1b')]===_0x2e01('0x1a');var _0x1743e4=_0x3b1a4d['count'];var _0x5a0a4b=_0x6a1ae2?0x0:_0x291412[_0x2e01('0x19')];var _0x5995c0=_0x6a1ae2?_0x3b1a4d[_0x2e01('0x1c')]:_0x291412[_0x2e01('0x19')]+_0x291412['limit'];var _0x5c6136;if(_0x5995c0>=_0x1743e4){_0x5995c0=_0x1743e4;_0x5c6136=0xc8;}else{_0x5c6136=0xce;}_0x49edc9[_0x2e01('0x18')](_0x5c6136);return _0x49edc9['set'](_0x2e01('0x1d'),_0x5a0a4b+'-'+_0x5995c0+'/'+_0x1743e4)[_0x2e01('0x1e')](_0x3b1a4d);}return null;};}function patchUpdates(_0x5c7ad0){return function(_0x339d69){try{jsonpatch[_0x2e01('0x1f')](_0x339d69,_0x5c7ad0,!![]);}catch(_0x39c3a6){return BPromise[_0x2e01('0x20')](_0x39c3a6);}return _0x339d69['save']();};}function saveUpdates(_0x1e7594,_0x2cd63c){return function(_0xaf3d03){if(_0xaf3d03){return _0xaf3d03[_0x2e01('0x21')](_0x1e7594)['then'](function(_0x1f4818){return _0x1f4818;});}return null;};}function removeEntity(_0x22185b,_0x565d0c){return function(_0x577052){if(_0x577052){return _0x577052[_0x2e01('0x22')]()[_0x2e01('0x23')](function(){_0x22185b[_0x2e01('0x18')](0xcc)[_0x2e01('0x24')]();});}};}function handleEntityNotFound(_0x22642e,_0x11d5d5){return function(_0x315cb8){if(!_0x315cb8){_0x22642e[_0x2e01('0x17')](0x194);}return _0x315cb8;};}function handleError(_0x428dae,_0x182e2e){_0x182e2e=_0x182e2e||0x1f4;return function(_0x307f0c){logger[_0x2e01('0x25')](_0x307f0c[_0x2e01('0x26')]);if(_0x307f0c[_0x2e01('0x27')]){delete _0x307f0c[_0x2e01('0x27')];}_0x428dae[_0x2e01('0x18')](_0x182e2e)['send'](_0x307f0c);};}exports[_0x2e01('0x28')]=function(_0x4107fa,_0xb8c111){var _0xbe6b72={},_0x4874fe={},_0x5da447={'count':0x0,'rows':[]};var _0x288c4d=_[_0x2e01('0x29')](db[_0x2e01('0x2a')][_0x2e01('0x2b')],function(_0x10f891){return{'name':_0x10f891[_0x2e01('0x2c')],'type':_0x10f891[_0x2e01('0x2d')][_0x2e01('0x2e')]};});_0x4874fe[_0x2e01('0x2f')]=_[_0x2e01('0x29')](_0x288c4d,_0x2e01('0x27'));_0x4874fe[_0x2e01('0x30')]=_[_0x2e01('0x31')](_0x4107fa[_0x2e01('0x30')]);_0x4874fe[_0x2e01('0x32')]=_[_0x2e01('0x33')](_0x4874fe[_0x2e01('0x2f')],_0x4874fe[_0x2e01('0x30')]);_0xbe6b72[_0x2e01('0x34')]=_[_0x2e01('0x33')](_0x4874fe[_0x2e01('0x2f')],qs[_0x2e01('0x35')](_0x4107fa[_0x2e01('0x30')][_0x2e01('0x35')]));_0xbe6b72[_0x2e01('0x34')]=_0xbe6b72['attributes'][_0x2e01('0x36')]?_0xbe6b72[_0x2e01('0x34')]:_0x4874fe[_0x2e01('0x2f')];if(!_0x4107fa[_0x2e01('0x30')][_0x2e01('0x37')](_0x2e01('0x38'))){_0xbe6b72[_0x2e01('0x1b')]=qs[_0x2e01('0x1b')](_0x4107fa[_0x2e01('0x30')][_0x2e01('0x1b')]);_0xbe6b72['offset']=qs[_0x2e01('0x19')](_0x4107fa[_0x2e01('0x30')][_0x2e01('0x19')]);}_0xbe6b72[_0x2e01('0x39')]=qs[_0x2e01('0x3a')](_0x4107fa[_0x2e01('0x30')][_0x2e01('0x3a')]);_0xbe6b72[_0x2e01('0x3b')]=qs[_0x2e01('0x32')](_[_0x2e01('0x3c')](_0x4107fa[_0x2e01('0x30')],_0x4874fe[_0x2e01('0x32')]),_0x288c4d);if(_0x4107fa['query'][_0x2e01('0x3d')]){_0xbe6b72['where']=_['merge'](_0xbe6b72[_0x2e01('0x3b')],{'$or':_['map'](_0x288c4d,function(_0x3bea73){if(_0x3bea73[_0x2e01('0x2d')]!==_0x2e01('0x3e')){var _0xa83420={};_0xa83420[_0x3bea73[_0x2e01('0x27')]]={'$like':'%'+_0x4107fa['query']['filter']+'%'};return _0xa83420;}})});}_0xbe6b72=_[_0x2e01('0x3f')]({},_0xbe6b72,_0x4107fa[_0x2e01('0x40')]);var _0x24947d={'where':_0xbe6b72[_0x2e01('0x3b')]};return db[_0x2e01('0x2a')]['count'](_0x24947d)['then'](function(_0x10f298){_0x5da447[_0x2e01('0x1c')]=_0x10f298;if(_0x4107fa[_0x2e01('0x30')]['includeAll']){_0xbe6b72[_0x2e01('0x41')]=[{'all':!![]}];}return db[_0x2e01('0x2a')]['findAll'](_0xbe6b72);})[_0x2e01('0x23')](function(_0x251ce2){_0x5da447[_0x2e01('0x42')]=_0x251ce2;return _0x5da447;})[_0x2e01('0x23')](respondWithFilteredResult(_0xb8c111,_0xbe6b72))['catch'](handleError(_0xb8c111,null));};exports[_0x2e01('0x43')]=function(_0x264cd1,_0x2cd974){var _0x556426={'raw':![],'where':{'id':_0x264cd1[_0x2e01('0x44')]['id']}},_0x124e34={};_0x124e34[_0x2e01('0x2f')]=_[_0x2e01('0x31')](db[_0x2e01('0x2a')][_0x2e01('0x2b')]);_0x124e34[_0x2e01('0x30')]=_['keys'](_0x264cd1['query']);_0x124e34[_0x2e01('0x32')]=_['intersection'](_0x124e34[_0x2e01('0x2f')],_0x124e34['query']);_0x556426[_0x2e01('0x34')]=_[_0x2e01('0x33')](_0x124e34[_0x2e01('0x2f')],qs[_0x2e01('0x35')](_0x264cd1[_0x2e01('0x30')]['fields']));_0x556426[_0x2e01('0x34')]=_0x556426['attributes'][_0x2e01('0x36')]?_0x556426[_0x2e01('0x34')]:_0x124e34['model'];if(_0x264cd1[_0x2e01('0x30')][_0x2e01('0x45')]){_0x556426[_0x2e01('0x41')]=[{'all':!![]}];}_0x556426=_[_0x2e01('0x3f')]({},_0x556426,_0x264cd1[_0x2e01('0x40')]);return db['SalesforceAccount'][_0x2e01('0x46')](_0x556426)[_0x2e01('0x23')](handleEntityNotFound(_0x2cd974,null))[_0x2e01('0x23')](respondWithResult(_0x2cd974,null))[_0x2e01('0x47')](handleError(_0x2cd974,null));};exports[_0x2e01('0x48')]=function(_0x38694d,_0x58aa06){return db[_0x2e01('0x2a')][_0x2e01('0x48')](_0x38694d[_0x2e01('0x49')],{})[_0x2e01('0x23')](respondWithResult(_0x58aa06,0xc9))[_0x2e01('0x47')](handleError(_0x58aa06,null));};exports['update']=function(_0x5729ed,_0x543cd3){if(_0x5729ed[_0x2e01('0x49')]['id']){delete _0x5729ed[_0x2e01('0x49')]['id'];}return db[_0x2e01('0x2a')][_0x2e01('0x46')]({'where':{'id':_0x5729ed[_0x2e01('0x44')]['id']}})[_0x2e01('0x23')](handleEntityNotFound(_0x543cd3,null))[_0x2e01('0x23')](saveUpdates(_0x5729ed[_0x2e01('0x49')],null))['then'](respondWithResult(_0x543cd3,null))[_0x2e01('0x47')](handleError(_0x543cd3,null));};exports['destroy']=function(_0x3e2f74,_0x32300e){return db['SalesforceAccount'][_0x2e01('0x46')]({'where':{'id':_0x3e2f74['params']['id']}})[_0x2e01('0x23')](handleEntityNotFound(_0x32300e,null))['then'](removeEntity(_0x32300e,null))[_0x2e01('0x47')](handleError(_0x32300e,null));};exports['getConfigurations']=function(_0x47ca69,_0x1bb2eb,_0x1121b6){var _0x3a48f0={};var _0x490327={};var _0x38546d;var _0x96f34a;return db[_0x2e01('0x2a')][_0x2e01('0x4a')]({'where':{'id':_0x47ca69['params']['id']}})[_0x2e01('0x23')](handleEntityNotFound(_0x1bb2eb,null))[_0x2e01('0x23')](function(_0x5e0931){if(_0x5e0931){_0x38546d=_0x5e0931;_0x490327[_0x2e01('0x2f')]=_[_0x2e01('0x31')](db['SalesforceConfiguration'][_0x2e01('0x2b')]);_0x490327[_0x2e01('0x30')]=_[_0x2e01('0x31')](_0x47ca69['query']);_0x490327[_0x2e01('0x32')]=_[_0x2e01('0x33')](_0x490327[_0x2e01('0x2f')],_0x490327[_0x2e01('0x30')]);_0x3a48f0['attributes']=_[_0x2e01('0x33')](_0x490327[_0x2e01('0x2f')],qs[_0x2e01('0x35')](_0x47ca69['query'][_0x2e01('0x35')]));_0x3a48f0['attributes']=_0x3a48f0['attributes']['length']?_0x3a48f0['attributes']:_0x490327['model'];_0x3a48f0[_0x2e01('0x39')]=qs[_0x2e01('0x3a')](_0x47ca69[_0x2e01('0x30')][_0x2e01('0x3a')]);_0x3a48f0[_0x2e01('0x3b')]=qs[_0x2e01('0x32')](_[_0x2e01('0x3c')](_0x47ca69[_0x2e01('0x30')],_0x490327[_0x2e01('0x32')]));if(_0x47ca69['query'][_0x2e01('0x3d')]){_0x3a48f0[_0x2e01('0x3b')]=_[_0x2e01('0x3f')](_0x3a48f0[_0x2e01('0x3b')],{'$or':_['map'](_0x3a48f0[_0x2e01('0x34')],function(_0x486a09){var _0x3b2770={};_0x3b2770[_0x486a09]={'$like':'%'+_0x47ca69[_0x2e01('0x30')][_0x2e01('0x3d')]+'%'};return _0x3b2770;})});}_0x3a48f0=_[_0x2e01('0x3f')]({},_0x3a48f0,_0x47ca69[_0x2e01('0x40')]);return _0x38546d[_0x2e01('0x4b')](_0x3a48f0);}})[_0x2e01('0x23')](function(_0x1844d3){if(_0x1844d3){_0x96f34a=_0x1844d3['length'];if(!_0x47ca69[_0x2e01('0x30')]['hasOwnProperty'](_0x2e01('0x38'))){_0x3a48f0[_0x2e01('0x1b')]=qs['limit'](_0x47ca69[_0x2e01('0x30')][_0x2e01('0x1b')]);_0x3a48f0['offset']=qs['offset'](_0x47ca69['query'][_0x2e01('0x19')]);}return _0x38546d[_0x2e01('0x4b')](_0x3a48f0);}})[_0x2e01('0x23')](function(_0x20a07a){if(_0x20a07a){return _0x20a07a?{'count':_0x96f34a,'rows':_0x20a07a}:null;}})[_0x2e01('0x23')](respondWithResult(_0x1bb2eb,null))[_0x2e01('0x47')](handleError(_0x1bb2eb,null));};exports[_0x2e01('0x4c')]=function(_0x4faeca,_0x24cd88,_0x30e2e6){if(_0x4faeca[_0x2e01('0x49')]['id']){delete _0x4faeca[_0x2e01('0x49')]['id'];}return db[_0x2e01('0x2a')]['findOne']({'where':{'id':_0x4faeca[_0x2e01('0x44')]['id']}})[_0x2e01('0x23')](handleEntityNotFound(_0x24cd88,null))[_0x2e01('0x23')](function(_0x2385a8){if(_0x2385a8){_0x4faeca[_0x2e01('0x49')][_0x2e01('0x4d')]=_0x2385a8['id'];_0x4faeca[_0x2e01('0x49')][_0x2e01('0x4e')]=integrations[_0x2e01('0x4f')](_0x4faeca[_0x2e01('0x49')]['channel'],_0x4faeca[_0x2e01('0x49')][_0x2e01('0x2d')]);_0x4faeca[_0x2e01('0x49')][_0x2e01('0x50')]=integrations[_0x2e01('0x51')](_0x4faeca['body'][_0x2e01('0x52')],_0x4faeca['body'][_0x2e01('0x2d')]);return db[_0x2e01('0x53')][_0x2e01('0x48')](_0x4faeca[_0x2e01('0x49')],{'include':[{'model':db[_0x2e01('0x54')],'as':_0x2e01('0x4e')},{'model':db['SalesforceField'],'as':_0x2e01('0x50')}]});}return null;})[_0x2e01('0x23')](respondWithResult(_0x24cd88,null))[_0x2e01('0x47')](handleError(_0x24cd88,null));};exports['getFields']=function(_0x542c9c,_0x234d2c,_0x15f23f){var _0x11620b;var _0xb25d62='';var _0x27de6d='Task';return db[_0x2e01('0x2a')][_0x2e01('0x4a')]({'where':{'id':_0x542c9c[_0x2e01('0x44')]['id']},'attributes':['id',_0x2e01('0x55'),_0x2e01('0x56'),_0x2e01('0x57'),'username','password',_0x2e01('0x58')]})[_0x2e01('0x23')](handleEntityNotFound(_0x234d2c,null))['then'](function(_0x45cc53){if(_0x45cc53){_0xb25d62=_0x45cc53[_0x2e01('0x55')];var _0x196793=_0xb25d62[_0x2e01('0x59')](-0x1);if(_0x196793==='/'){_0xb25d62=_0xb25d62[_0x2e01('0x5a')](0x0,_0xb25d62[_0x2e01('0x5b')](_0x196793));}_0x11620b=new jsforce[(_0x2e01('0x5c'))]({'oauth2':{'loginUrl':_0xb25d62,'clientId':_0x45cc53[_0x2e01('0x56')],'clientSecret':_0x45cc53[_0x2e01('0x57')]}});return _0x11620b[_0x2e01('0x5d')](_0x45cc53[_0x2e01('0x5e')],_0x45cc53[_0x2e01('0x5f')][_0x2e01('0x60')](_0x45cc53[_0x2e01('0x58')]));}})['then'](function(_0x565109){if(_0x565109){if(!_['isNil'](_0x542c9c[_0x2e01('0x30')]['ticketType'])){_0x27de6d=_0x542c9c['query'][_0x2e01('0x61')];}return _0x11620b[_0x2e01('0x62')](_0x27de6d)[_0x2e01('0x63')]();}})[_0x2e01('0x23')](function(_0x321c7b){var _0x186d0c=[_0x2e01('0x64'),_0x2e01('0x65'),_0x2e01('0x66'),'IsRecurrence',_0x2e01('0x67'),'Description'];var _0x409122=[_0x2e01('0x68'),_0x2e01('0x69'),_0x2e01('0x6a'),_0x2e01('0x6b'),_0x2e01('0x6c'),_0x2e01('0x6d'),_0x2e01('0x6e')];if(_0x321c7b){_[_0x2e01('0x6f')](_0x321c7b[_0x2e01('0x35')],function(_0x20ae75){return _0x186d0c[_0x2e01('0x70')](_0x20ae75[_0x2e01('0x27')])||!_0x409122[_0x2e01('0x70')](_0x20ae75[_0x2e01('0x2d')]);});return{'count':_0x321c7b['fields']['length'],'rows':_[_0x2e01('0x29')](_0x321c7b[_0x2e01('0x35')],function(_0x13d970){return{'id':_0x13d970[_0x2e01('0x27')],'name':_0x13d970['label'],'custom':_0x13d970[_0x2e01('0x71')],'options':_0x13d970['picklistValues'][_0x2e01('0x36')]>0x0?_[_0x2e01('0x29')](_0x13d970[_0x2e01('0x72')],function(_0x447c23){return{'name':_0x447c23[_0x2e01('0x73')],'value':_0x447c23[_0x2e01('0x74')]};}):_0x13d970[_0x2e01('0x2d')]==_0x2e01('0x6b')?[{'name':'True','value':_0x2e01('0x75')},{'name':_0x2e01('0x76'),'value':_0x2e01('0x77')}]:[]};})};}})[_0x2e01('0x23')](respondWithResult(_0x234d2c,null))[_0x2e01('0x47')](function(_0x29c0f8){var _0x19e267=_0x542c9c[_0x2e01('0x30')]['test']?0x1f4:_0x29c0f8[_0x2e01('0x78')]||0x1f4;logger[_0x2e01('0x25')](_0x2e01('0x79'),'getFields',_0x19e267,JSON['stringify'](_0x29c0f8));delete _0x29c0f8[_0x2e01('0x27')];if(_0x19e267===0x191){_0x19e267=0x190;}_0x234d2c['status'](_0x19e267)[_0x2e01('0x7a')](_0x542c9c[_0x2e01('0x30')][_0x2e01('0x7b')]?{'message':_0x2e01('0x7c'),'statusCode':_0x29c0f8[_0x2e01('0x78')]}:_0x29c0f8);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index e127c1c..678c0e6 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 _0x7e9b=['SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x7e9b,0x18e));var _0xb7e9=function(_0xd054f0,_0x523bbd){_0xd054f0=_0xd054f0-0x0;var _0xcdc2b0=_0x7e9b[_0xd054f0];return _0xcdc2b0;};'use strict';var _=require('lodash');var util=require(_0xb7e9('0x0'));var logger=require(_0xb7e9('0x1'))(_0xb7e9('0x2'));var moment=require(_0xb7e9('0x3'));var BPromise=require('bluebird');var rp=require(_0xb7e9('0x4'));var fs=require('fs');var path=require(_0xb7e9('0x5'));var rimraf=require(_0xb7e9('0x6'));var config=require(_0xb7e9('0x7'));var attributes=require(_0xb7e9('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5c82e5,_0xd504bb){return _0x5c82e5['define'](_0xb7e9('0x9'),attributes,{'tableName':_0xb7e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa376=['exports','define','SalesforceAccount','int_salesforce_accounts','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xa376,0x88));var _0x6a37=function(_0x1e9bec,_0x2c9986){_0x1e9bec=_0x1e9bec-0x0;var _0x51172e=_0xa376[_0x1e9bec];return _0x51172e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6a37('0x0'))('api');var moment=require(_0x6a37('0x1'));var BPromise=require(_0x6a37('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6a37('0x3'));var config=require(_0x6a37('0x4'));var attributes=require(_0x6a37('0x5'));var integrations=require(_0x6a37('0x6'));module[_0x6a37('0x7')]=function(_0x58a562,_0x247887){return _0x58a562[_0x6a37('0x8')](_0x6a37('0x9'),attributes,{'tableName':_0x6a37('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 97b68d0..4018247 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 _0x2465=['../../config/environment','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','findAll','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x59fbca,_0x277e60){var _0x575216=function(_0x575ed5){while(--_0x575ed5){_0x59fbca['push'](_0x59fbca['shift']());}};_0x575216(++_0x277e60);}(_0x2465,0x17a));var _0x5246=function(_0x40ec61,_0x548ed4){_0x40ec61=_0x40ec61-0x0;var _0x3d3edd=_0x2465[_0x40ec61];return _0x3d3edd;};'use strict';var _=require(_0x5246('0x0'));var util=require(_0x5246('0x1'));var moment=require(_0x5246('0x2'));var BPromise=require('bluebird');var rs=require(_0x5246('0x3'));var fs=require('fs');var Redis=require(_0x5246('0x4'));var db=require(_0x5246('0x5'))['db'];var utils=require(_0x5246('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5246('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5246('0x8')][_0x5246('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15ae56,_0x5b99b5,_0xfe92ee){return new BPromise(function(_0x45409b,_0x412f46){return client[_0x5246('0xa')](_0x15ae56,_0xfe92ee)[_0x5246('0xb')](function(_0x5a2df2){logger[_0x5246('0xc')](_0x5246('0xd'),_0x5b99b5,_0x5246('0xe'));logger[_0x5246('0xf')](_0x5246('0x10'),_0x5b99b5,_0x5246('0xe'),JSON[_0x5246('0x11')](_0x5a2df2));if(_0x5a2df2[_0x5246('0x12')]){if(_0x5a2df2[_0x5246('0x12')][_0x5246('0x13')]===0x1f4){logger['error'](_0x5246('0xd'),_0x5b99b5,_0x5a2df2['error'][_0x5246('0x14')]);return _0x412f46(_0x5a2df2[_0x5246('0x12')][_0x5246('0x14')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x5b99b5,_0x5a2df2['error'][_0x5246('0x14')]);return _0x45409b(_0x5a2df2['error']['message']);}else{logger[_0x5246('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x5b99b5,_0x5246('0xe'));_0x45409b(_0x5a2df2[_0x5246('0x15')][_0x5246('0x14')]);}})[_0x5246('0x16')](function(_0x57ee80){logger['error'](_0x5246('0xd'),_0x5b99b5,_0x57ee80);_0x412f46(_0x57ee80);});});}exports[_0x5246('0x17')]=function(_0x4c4ecd){var _0x2c1c12=this;return new Promise(function(_0x2a5aa3,_0x9e21b){return db['SalesforceAccount'][_0x5246('0x18')]({'raw':_0x4c4ecd[_0x5246('0x19')]?_0x4c4ecd[_0x5246('0x19')][_0x5246('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c4ecd['options']?_0x4c4ecd[_0x5246('0x19')][_0x5246('0x1b')]||null:null,'attributes':_0x4c4ecd[_0x5246('0x19')]?_0x4c4ecd[_0x5246('0x19')][_0x5246('0x1c')]||null:null,'limit':_0x4c4ecd[_0x5246('0x19')]?_0x4c4ecd['options'][_0x5246('0x1d')]||null:null,'include':_0x4c4ecd[_0x5246('0x19')]?_0x4c4ecd['options'][_0x5246('0x1e')]?_[_0x5246('0x1f')](_0x4c4ecd['options'][_0x5246('0x1e')],function(_0x4eaf3a){return{'model':db[_0x4eaf3a[_0x5246('0x20')]],'as':_0x4eaf3a['as'],'attributes':_0x4eaf3a[_0x5246('0x1c')],'include':_0x4eaf3a[_0x5246('0x1e')]?_['map'](_0x4eaf3a[_0x5246('0x1e')],function(_0x1957c3){return{'model':db[_0x1957c3[_0x5246('0x20')]],'as':_0x1957c3['as'],'attributes':_0x1957c3['attributes'],'include':_0x1957c3[_0x5246('0x1e')]?_[_0x5246('0x1f')](_0x1957c3[_0x5246('0x1e')],function(_0x5f0371){return{'model':db[_0x5f0371[_0x5246('0x20')]],'as':_0x5f0371['as'],'attributes':_0x5f0371['attributes']};}):[]};}):[]};}):[]:[]})[_0x5246('0xb')](function(_0xf518f7){logger[_0x5246('0xc')](_0x5246('0x17'),_0x4c4ecd);logger[_0x5246('0xf')](_0x5246('0x17'),_0x4c4ecd,JSON[_0x5246('0x11')](_0xf518f7));_0x2a5aa3(_0xf518f7);})['catch'](function(_0x51db4b){logger[_0x5246('0x12')](_0x5246('0x17'),_0x51db4b[_0x5246('0x14')],_0x4c4ecd);_0x9e21b(_0x2c1c12['error'](0x1f4,_0x51db4b['message']));});});};exports[_0x5246('0x21')]=function(_0x1f8c01){var _0x2c9bcc=this;return new Promise(function(_0x104637,_0x154c29){return db['SalesforceAccount'][_0x5246('0x22')]({'raw':_0x1f8c01[_0x5246('0x19')]?_0x1f8c01['options'][_0x5246('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f8c01['options']?_0x1f8c01[_0x5246('0x19')][_0x5246('0x1b')]||null:null,'attributes':_0x1f8c01['options']?_0x1f8c01[_0x5246('0x19')]['attributes']||null:null,'include':_0x1f8c01[_0x5246('0x19')]?_0x1f8c01[_0x5246('0x19')][_0x5246('0x1e')]?_[_0x5246('0x1f')](_0x1f8c01[_0x5246('0x19')][_0x5246('0x1e')],function(_0x148c8d){return{'model':db[_0x148c8d[_0x5246('0x20')]],'as':_0x148c8d['as'],'attributes':_0x148c8d[_0x5246('0x1c')],'include':_0x148c8d[_0x5246('0x1e')]?_['map'](_0x148c8d[_0x5246('0x1e')],function(_0x2353d3){return{'model':db[_0x2353d3[_0x5246('0x20')]],'as':_0x2353d3['as'],'attributes':_0x2353d3[_0x5246('0x1c')],'include':_0x2353d3[_0x5246('0x1e')]?_['map'](_0x2353d3['include'],function(_0x2285c2){return{'model':db[_0x2285c2[_0x5246('0x20')]],'as':_0x2285c2['as'],'attributes':_0x2285c2[_0x5246('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5246('0xb')](function(_0x4542c1){logger[_0x5246('0xc')](_0x5246('0x21'),_0x1f8c01);logger['debug'](_0x5246('0x21'),_0x1f8c01,JSON['stringify'](_0x4542c1));_0x104637(_0x4542c1);})[_0x5246('0x16')](function(_0x272241){logger['error']('ShowSalesforceAccount',_0x272241[_0x5246('0x14')],_0x1f8c01);_0x154c29(_0x2c9bcc[_0x5246('0x12')](0x1f4,_0x272241['message']));});});}; \ No newline at end of file +var _0x3936=['client','http','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowSalesforceAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x56ca12,_0x1f679a){var _0x321a0c=function(_0xb582a2){while(--_0xb582a2){_0x56ca12['push'](_0x56ca12['shift']());}};_0x321a0c(++_0x1f679a);}(_0x3936,0x18c));var _0x6393=function(_0xb87d55,_0x578ce1){_0xb87d55=_0xb87d55-0x0;var _0x1c31c8=_0x3936[_0xb87d55];return _0x1c31c8;};'use strict';var _=require(_0x6393('0x0'));var util=require('util');var moment=require(_0x6393('0x1'));var BPromise=require(_0x6393('0x2'));var rs=require(_0x6393('0x3'));var fs=require('fs');var Redis=require(_0x6393('0x4'));var db=require(_0x6393('0x5'))['db'];var utils=require(_0x6393('0x6'));var logger=require(_0x6393('0x7'))(_0x6393('0x8'));var config=require(_0x6393('0x9'));var jayson=require(_0x6393('0xa'));var client=jayson[_0x6393('0xb')][_0x6393('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193d2f,_0x474e10,_0x94b4d5){return new BPromise(function(_0x17bd31,_0x5b369a){return client['request'](_0x193d2f,_0x94b4d5)[_0x6393('0xd')](function(_0x4448a9){logger[_0x6393('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x474e10,_0x6393('0xf'));logger[_0x6393('0x10')](_0x6393('0x11'),_0x474e10,_0x6393('0xf'),JSON[_0x6393('0x12')](_0x4448a9));if(_0x4448a9['error']){if(_0x4448a9[_0x6393('0x13')][_0x6393('0x14')]===0x1f4){logger[_0x6393('0x13')](_0x6393('0x15'),_0x474e10,_0x4448a9[_0x6393('0x13')]['message']);return _0x5b369a(_0x4448a9[_0x6393('0x13')][_0x6393('0x16')]);}logger[_0x6393('0x13')](_0x6393('0x15'),_0x474e10,_0x4448a9[_0x6393('0x13')][_0x6393('0x16')]);return _0x17bd31(_0x4448a9[_0x6393('0x13')][_0x6393('0x16')]);}else{logger[_0x6393('0xe')](_0x6393('0x15'),_0x474e10,_0x6393('0xf'));_0x17bd31(_0x4448a9[_0x6393('0x17')]['message']);}})[_0x6393('0x18')](function(_0x3652cf){logger[_0x6393('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x474e10,_0x3652cf);_0x5b369a(_0x3652cf);});});}exports[_0x6393('0x19')]=function(_0x273374){var _0x48573b=this;return new Promise(function(_0x499870,_0x3e3fa5){return db['SalesforceAccount'][_0x6393('0x1a')]({'raw':_0x273374[_0x6393('0x1b')]?_0x273374[_0x6393('0x1b')][_0x6393('0x1c')]===undefined?!![]:![]:!![],'where':_0x273374[_0x6393('0x1b')]?_0x273374[_0x6393('0x1b')][_0x6393('0x1d')]||null:null,'attributes':_0x273374['options']?_0x273374[_0x6393('0x1b')][_0x6393('0x1e')]||null:null,'limit':_0x273374[_0x6393('0x1b')]?_0x273374['options'][_0x6393('0x1f')]||null:null,'include':_0x273374[_0x6393('0x1b')]?_0x273374[_0x6393('0x1b')]['include']?_[_0x6393('0x20')](_0x273374[_0x6393('0x1b')][_0x6393('0x21')],function(_0x46635b){return{'model':db[_0x46635b['model']],'as':_0x46635b['as'],'attributes':_0x46635b[_0x6393('0x1e')],'include':_0x46635b['include']?_[_0x6393('0x20')](_0x46635b[_0x6393('0x21')],function(_0x3d72ae){return{'model':db[_0x3d72ae['model']],'as':_0x3d72ae['as'],'attributes':_0x3d72ae[_0x6393('0x1e')],'include':_0x3d72ae[_0x6393('0x21')]?_[_0x6393('0x20')](_0x3d72ae[_0x6393('0x21')],function(_0x46e193){return{'model':db[_0x46e193[_0x6393('0x22')]],'as':_0x46e193['as'],'attributes':_0x46e193[_0x6393('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6393('0xd')](function(_0x470eb4){logger[_0x6393('0xe')](_0x6393('0x19'),_0x273374);logger[_0x6393('0x10')](_0x6393('0x19'),_0x273374,JSON[_0x6393('0x12')](_0x470eb4));_0x499870(_0x470eb4);})[_0x6393('0x18')](function(_0x3b2c32){logger[_0x6393('0x13')](_0x6393('0x19'),_0x3b2c32['message'],_0x273374);_0x3e3fa5(_0x48573b['error'](0x1f4,_0x3b2c32[_0x6393('0x16')]));});});};exports[_0x6393('0x23')]=function(_0x4e0b33){var _0x439acf=this;return new Promise(function(_0x28fce7,_0x8fc2d2){return db['SalesforceAccount'][_0x6393('0x24')]({'raw':_0x4e0b33['options']?_0x4e0b33['options'][_0x6393('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e0b33[_0x6393('0x1b')]?_0x4e0b33['options']['where']||null:null,'attributes':_0x4e0b33[_0x6393('0x1b')]?_0x4e0b33[_0x6393('0x1b')][_0x6393('0x1e')]||null:null,'include':_0x4e0b33[_0x6393('0x1b')]?_0x4e0b33[_0x6393('0x1b')][_0x6393('0x21')]?_['map'](_0x4e0b33[_0x6393('0x1b')][_0x6393('0x21')],function(_0xd04497){return{'model':db[_0xd04497[_0x6393('0x22')]],'as':_0xd04497['as'],'attributes':_0xd04497[_0x6393('0x1e')],'include':_0xd04497['include']?_[_0x6393('0x20')](_0xd04497['include'],function(_0x1b2041){return{'model':db[_0x1b2041['model']],'as':_0x1b2041['as'],'attributes':_0x1b2041['attributes'],'include':_0x1b2041[_0x6393('0x21')]?_[_0x6393('0x20')](_0x1b2041[_0x6393('0x21')],function(_0x5a1821){return{'model':db[_0x5a1821['model']],'as':_0x5a1821['as'],'attributes':_0x5a1821['attributes']};}):[]};}):[]};}):[]:[]})[_0x6393('0xd')](function(_0x2b1fc5){logger[_0x6393('0xe')]('ShowSalesforceAccount',_0x4e0b33);logger[_0x6393('0x10')]('ShowSalesforceAccount',_0x4e0b33,JSON['stringify'](_0x2b1fc5));_0x28fce7(_0x2b1fc5);})[_0x6393('0x18')](function(_0x291709){logger['error']('ShowSalesforceAccount',_0x291709[_0x6393('0x16')],_0x4e0b33);_0x8fc2d2(_0x439acf[_0x6393('0x13')](0x1f4,_0x291709[_0x6393('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 0f9badc..0dff2ec 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x53134a,_0x3c66dc){var _0x3651c0=function(_0x13b1ae){while(--_0x13b1ae){_0x53134a['push'](_0x53134a['shift']());}};_0x3651c0(++_0x3c66dc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x48cd23,_0x5cabdf){_0x48cd23=_0x48cd23-0x0;var _0x1eb5cc=_0x5f2f[_0x48cd23];return _0x1eb5cc;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x4c5f15,_0x5e5bed){var _0x4aa336=function(_0x46129f){while(--_0x46129f){_0x4c5f15['push'](_0x4c5f15['shift']());}};_0x4aa336(++_0x5e5bed);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'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('./intSalesforceConfiguration.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['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 73e8f54..3cd1edd 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 _0xb64f=['exports','STRING','ENUM','Task','contact','lead','account_contact_lead','account','contact_lead','sequelize'];(function(_0xc54514,_0x4031b1){var _0x1f992b=function(_0x29eb92){while(--_0x29eb92){_0xc54514['push'](_0xc54514['shift']());}};_0x1f992b(++_0x4031b1);}(_0xb64f,0x77));var _0xfb64=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0xb64f[_0x35a140];return _0x30ab82;};'use strict';var Sequelize=require(_0xfb64('0x0'));module[_0xfb64('0x1')]={'name':{'type':Sequelize[_0xfb64('0x2')]},'description':{'type':Sequelize[_0xfb64('0x2')]},'ticketType':{'type':Sequelize[_0xfb64('0x3')]('Task','Case'),'defaultValue':_0xfb64('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xfb64('0x5'),_0xfb64('0x6'),_0xfb64('0x7'),_0xfb64('0x8')),'defaultValue':_0xfb64('0x9')},'moduleCreate':{'type':Sequelize[_0xfb64('0x3')]('nothing',_0xfb64('0x5'),_0xfb64('0x6'),'account'),'defaultValue':_0xfb64('0x6')},'leadId':{'type':Sequelize[_0xfb64('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xfb64('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xfb64('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xfb64('0x2')]}}; \ No newline at end of file +var _0x4747=['lead','sequelize','STRING','ENUM','Task','contact_lead','contact','account_contact_lead','account','nothing'];(function(_0x3b5c4f,_0x3f20c5){var _0x258626=function(_0x373a58){while(--_0x373a58){_0x3b5c4f['push'](_0x3b5c4f['shift']());}};_0x258626(++_0x3f20c5);}(_0x4747,0xc9));var _0x7474=function(_0x4289ed,_0x2c7b8f){_0x4289ed=_0x4289ed-0x0;var _0x2f5317=_0x4747[_0x4289ed];return _0x2f5317;};'use strict';var Sequelize=require(_0x7474('0x0'));module['exports']={'name':{'type':Sequelize[_0x7474('0x1')]},'description':{'type':Sequelize[_0x7474('0x1')]},'ticketType':{'type':Sequelize[_0x7474('0x2')](_0x7474('0x3'),'Case'),'defaultValue':_0x7474('0x3')},'moduleSearch':{'type':Sequelize[_0x7474('0x2')](_0x7474('0x4'),_0x7474('0x5'),'lead',_0x7474('0x6'),_0x7474('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x7474('0x2')](_0x7474('0x8'),_0x7474('0x5'),_0x7474('0x9'),_0x7474('0x7')),'defaultValue':_0x7474('0x9')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x7474('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x7474('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 473d41b..66df05a 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 _0xb620=['bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','reject','save','then','destroy','error','stack','send','index','map','SalesforceConfiguration','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','findOne','SalesforceField','pick','getFields','getSubjects','getDescriptions','rawAttributes','eml-format','zip-dir','fast-json-patch','moment'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb620,0x1a0));var _0x0b62=function(_0x28c18f,_0x41f760){_0x28c18f=_0x28c18f-0x0;var _0x58bf33=_0xb620[_0x28c18f];return _0x58bf33;};'use strict';var emlformat=require(_0x0b62('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b62('0x1'));var jsonpatch=require(_0x0b62('0x2'));var rp=require('request-promise');var moment=require(_0x0b62('0x3'));var BPromise=require(_0x0b62('0x4'));var Mustache=require(_0x0b62('0x5'));var util=require(_0x0b62('0x6'));var path=require(_0x0b62('0x7'));var sox=require(_0x0b62('0x8'));var csv=require('to-csv');var ejs=require(_0x0b62('0x9'));var fs=require('fs');var fs_extra=require(_0x0b62('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0b62('0xb'));var jsforce=require(_0x0b62('0xc'));var deskjs=require(_0x0b62('0xd'));var toCsv=require(_0x0b62('0xe'));var querystring=require(_0x0b62('0xf'));var Papa=require('papaparse');var Redis=require(_0x0b62('0x10'));var authService=require(_0x0b62('0x11'));var qs=require(_0x0b62('0x12'));var as=require(_0x0b62('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b62('0x14'))(_0x0b62('0x15'));var utils=require(_0x0b62('0x16'));var config=require(_0x0b62('0x17'));var licenseUtil=require(_0x0b62('0x18'));var db=require(_0x0b62('0x19'))['db'];function respondWithStatusCode(_0x3beda7,_0x2c8b9b){_0x2c8b9b=_0x2c8b9b||0xcc;return function(_0x10f217){if(_0x10f217){return _0x3beda7[_0x0b62('0x1a')](_0x2c8b9b);}return _0x3beda7['status'](_0x2c8b9b)[_0x0b62('0x1b')]();};}function respondWithResult(_0x25c09c,_0x58181f){_0x58181f=_0x58181f||0xc8;return function(_0x9c20e5){if(_0x9c20e5){return _0x25c09c[_0x0b62('0x1c')](_0x58181f)['json'](_0x9c20e5);}};}function respondWithFilteredResult(_0x5e4dfc,_0x4a8df6){return function(_0xfafa73){if(_0xfafa73){var _0x297915=typeof _0x4a8df6['offset']===_0x0b62('0x1d')&&typeof _0x4a8df6[_0x0b62('0x1e')]==='undefined';var _0x114648=_0xfafa73[_0x0b62('0x1f')];var _0x5d71f5=_0x297915?0x0:_0x4a8df6[_0x0b62('0x20')];var _0x1cba53=_0x297915?_0xfafa73['count']:_0x4a8df6['offset']+_0x4a8df6[_0x0b62('0x1e')];var _0xb58b5f;if(_0x1cba53>=_0x114648){_0x1cba53=_0x114648;_0xb58b5f=0xc8;}else{_0xb58b5f=0xce;}_0x5e4dfc['status'](_0xb58b5f);return _0x5e4dfc[_0x0b62('0x21')]('Content-Range',_0x5d71f5+'-'+_0x1cba53+'/'+_0x114648)[_0x0b62('0x22')](_0xfafa73);}return null;};}function patchUpdates(_0x26e72d){return function(_0xecf5fb){try{jsonpatch[_0x0b62('0x23')](_0xecf5fb,_0x26e72d,!![]);}catch(_0x5b72a6){return BPromise[_0x0b62('0x24')](_0x5b72a6);}return _0xecf5fb[_0x0b62('0x25')]();};}function saveUpdates(_0x5ddad3,_0x2a675b){return function(_0x4bf472){if(_0x4bf472){return _0x4bf472['update'](_0x5ddad3)[_0x0b62('0x26')](function(_0x15b3bb){return _0x15b3bb;});}return null;};}function removeEntity(_0x20940e,_0x2285ef){return function(_0x45d0f7){if(_0x45d0f7){return _0x45d0f7[_0x0b62('0x27')]()['then'](function(){_0x20940e[_0x0b62('0x1c')](0xcc)[_0x0b62('0x1b')]();});}};}function handleEntityNotFound(_0xe047cf,_0x389256){return function(_0x3393f1){if(!_0x3393f1){_0xe047cf[_0x0b62('0x1a')](0x194);}return _0x3393f1;};}function handleError(_0x441ea6,_0x5d483d){_0x5d483d=_0x5d483d||0x1f4;return function(_0x280b78){logger[_0x0b62('0x28')](_0x280b78[_0x0b62('0x29')]);if(_0x280b78['name']){delete _0x280b78['name'];}_0x441ea6[_0x0b62('0x1c')](_0x5d483d)[_0x0b62('0x2a')](_0x280b78);};}exports[_0x0b62('0x2b')]=function(_0x5f4820,_0x22f315){var _0x2434c5={},_0x39947a={},_0xb34d04={'count':0x0,'rows':[]};var _0x4e4286=_[_0x0b62('0x2c')](db[_0x0b62('0x2d')]['rawAttributes'],function(_0x1b7088){return{'name':_0x1b7088[_0x0b62('0x2e')],'type':_0x1b7088[_0x0b62('0x2f')][_0x0b62('0x30')]};});_0x39947a[_0x0b62('0x31')]=_[_0x0b62('0x2c')](_0x4e4286,_0x0b62('0x32'));_0x39947a[_0x0b62('0x33')]=_[_0x0b62('0x34')](_0x5f4820[_0x0b62('0x33')]);_0x39947a['filters']=_[_0x0b62('0x35')](_0x39947a[_0x0b62('0x31')],_0x39947a[_0x0b62('0x33')]);_0x2434c5['attributes']=_['intersection'](_0x39947a['model'],qs[_0x0b62('0x36')](_0x5f4820[_0x0b62('0x33')][_0x0b62('0x36')]));_0x2434c5[_0x0b62('0x37')]=_0x2434c5[_0x0b62('0x37')][_0x0b62('0x38')]?_0x2434c5[_0x0b62('0x37')]:_0x39947a[_0x0b62('0x31')];if(!_0x5f4820[_0x0b62('0x33')][_0x0b62('0x39')](_0x0b62('0x3a'))){_0x2434c5['limit']=qs[_0x0b62('0x1e')](_0x5f4820[_0x0b62('0x33')][_0x0b62('0x1e')]);_0x2434c5['offset']=qs[_0x0b62('0x20')](_0x5f4820[_0x0b62('0x33')]['offset']);}_0x2434c5[_0x0b62('0x3b')]=qs['sort'](_0x5f4820['query'][_0x0b62('0x3c')]);_0x2434c5['where']=qs[_0x0b62('0x3d')](_['pick'](_0x5f4820[_0x0b62('0x33')],_0x39947a[_0x0b62('0x3d')]),_0x4e4286);if(_0x5f4820[_0x0b62('0x33')][_0x0b62('0x3e')]){_0x2434c5[_0x0b62('0x3f')]=_[_0x0b62('0x40')](_0x2434c5['where'],{'$or':_[_0x0b62('0x2c')](_0x4e4286,function(_0x54fd63){if(_0x54fd63[_0x0b62('0x2f')]!=='VIRTUAL'){var _0x248bf2={};_0x248bf2[_0x54fd63[_0x0b62('0x32')]]={'$like':'%'+_0x5f4820[_0x0b62('0x33')]['filter']+'%'};return _0x248bf2;}})});}_0x2434c5=_[_0x0b62('0x40')]({},_0x2434c5,_0x5f4820[_0x0b62('0x41')]);var _0x29d75d={'where':_0x2434c5[_0x0b62('0x3f')]};return db[_0x0b62('0x2d')][_0x0b62('0x1f')](_0x29d75d)[_0x0b62('0x26')](function(_0x5b29ca){_0xb34d04['count']=_0x5b29ca;if(_0x5f4820[_0x0b62('0x33')][_0x0b62('0x42')]){_0x2434c5[_0x0b62('0x43')]=[{'all':!![]}];}return db[_0x0b62('0x2d')][_0x0b62('0x44')](_0x2434c5);})[_0x0b62('0x26')](function(_0x57794d){_0xb34d04[_0x0b62('0x45')]=_0x57794d;return _0xb34d04;})[_0x0b62('0x26')](respondWithFilteredResult(_0x22f315,_0x2434c5))['catch'](handleError(_0x22f315,null));};exports[_0x0b62('0x46')]=function(_0x23c1d9,_0x3b4b61){var _0x52d795={'raw':![],'where':{'id':_0x23c1d9[_0x0b62('0x47')]['id']}},_0x65df43={};_0x65df43[_0x0b62('0x31')]=_[_0x0b62('0x34')](db[_0x0b62('0x2d')]['rawAttributes']);_0x65df43[_0x0b62('0x33')]=_[_0x0b62('0x34')](_0x23c1d9['query']);_0x65df43['filters']=_[_0x0b62('0x35')](_0x65df43[_0x0b62('0x31')],_0x65df43[_0x0b62('0x33')]);_0x52d795[_0x0b62('0x37')]=_[_0x0b62('0x35')](_0x65df43[_0x0b62('0x31')],qs[_0x0b62('0x36')](_0x23c1d9['query'][_0x0b62('0x36')]));_0x52d795[_0x0b62('0x37')]=_0x52d795[_0x0b62('0x37')][_0x0b62('0x38')]?_0x52d795[_0x0b62('0x37')]:_0x65df43[_0x0b62('0x31')];if(_0x23c1d9['query'][_0x0b62('0x42')]){_0x52d795[_0x0b62('0x43')]=[{'all':!![]}];}_0x52d795=_[_0x0b62('0x40')]({},_0x52d795,_0x23c1d9[_0x0b62('0x41')]);return db[_0x0b62('0x2d')][_0x0b62('0x48')](_0x52d795)['then'](handleEntityNotFound(_0x3b4b61,null))[_0x0b62('0x26')](respondWithResult(_0x3b4b61,null))[_0x0b62('0x49')](handleError(_0x3b4b61,null));};exports[_0x0b62('0x4a')]=function(_0x476648,_0x3a54b5){return db[_0x0b62('0x2d')][_0x0b62('0x4a')](_0x476648[_0x0b62('0x4b')],{})[_0x0b62('0x26')](respondWithResult(_0x3a54b5,0xc9))['catch'](handleError(_0x3a54b5,null));};exports[_0x0b62('0x4c')]=function(_0x1d1198,_0x34ff51){if(_0x1d1198[_0x0b62('0x4b')]['id']){delete _0x1d1198[_0x0b62('0x4b')]['id'];}return db['SalesforceConfiguration'][_0x0b62('0x48')]({'where':{'id':_0x1d1198[_0x0b62('0x47')]['id']}})[_0x0b62('0x26')](handleEntityNotFound(_0x34ff51,null))['then'](saveUpdates(_0x1d1198['body'],null))[_0x0b62('0x26')](respondWithResult(_0x34ff51,null))['catch'](handleError(_0x34ff51,null));};exports[_0x0b62('0x27')]=function(_0x1473d3,_0x2a8a0e){return db[_0x0b62('0x2d')][_0x0b62('0x48')]({'where':{'id':_0x1473d3[_0x0b62('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a8a0e,null))[_0x0b62('0x26')](removeEntity(_0x2a8a0e,null))[_0x0b62('0x49')](handleError(_0x2a8a0e,null));};exports['getFields']=function(_0x5411d3,_0x34953b,_0xa8304){var _0x65d647={};var _0xa0d157={};var _0xc31cb9;var _0x115927;return db[_0x0b62('0x2d')][_0x0b62('0x4d')]({'where':{'id':_0x5411d3[_0x0b62('0x47')]['id']}})[_0x0b62('0x26')](handleEntityNotFound(_0x34953b,null))[_0x0b62('0x26')](function(_0x2b7328){if(_0x2b7328){_0xc31cb9=_0x2b7328;_0xa0d157[_0x0b62('0x31')]=_[_0x0b62('0x34')](db[_0x0b62('0x4e')]['rawAttributes']);_0xa0d157[_0x0b62('0x33')]=_['keys'](_0x5411d3[_0x0b62('0x33')]);_0xa0d157[_0x0b62('0x3d')]=_[_0x0b62('0x35')](_0xa0d157[_0x0b62('0x31')],_0xa0d157['query']);_0x65d647[_0x0b62('0x37')]=_['intersection'](_0xa0d157[_0x0b62('0x31')],qs[_0x0b62('0x36')](_0x5411d3['query'][_0x0b62('0x36')]));_0x65d647[_0x0b62('0x37')]=_0x65d647[_0x0b62('0x37')][_0x0b62('0x38')]?_0x65d647['attributes']:_0xa0d157['model'];_0x65d647[_0x0b62('0x3b')]=qs['sort'](_0x5411d3['query']['sort']);_0x65d647[_0x0b62('0x3f')]=qs[_0x0b62('0x3d')](_[_0x0b62('0x4f')](_0x5411d3[_0x0b62('0x33')],_0xa0d157['filters']));if(_0x5411d3[_0x0b62('0x33')][_0x0b62('0x3e')]){_0x65d647[_0x0b62('0x3f')]=_['merge'](_0x65d647[_0x0b62('0x3f')],{'$or':_['map'](_0x65d647[_0x0b62('0x37')],function(_0x37ce84){var _0x5a1bf3={};_0x5a1bf3[_0x37ce84]={'$like':'%'+_0x5411d3[_0x0b62('0x33')][_0x0b62('0x3e')]+'%'};return _0x5a1bf3;})});}_0x65d647=_[_0x0b62('0x40')]({},_0x65d647,_0x5411d3[_0x0b62('0x41')]);return _0xc31cb9[_0x0b62('0x50')](_0x65d647);}})['then'](function(_0x2313bb){if(_0x2313bb){_0x115927=_0x2313bb[_0x0b62('0x38')];if(!_0x5411d3[_0x0b62('0x33')][_0x0b62('0x39')](_0x0b62('0x3a'))){_0x65d647['limit']=qs[_0x0b62('0x1e')](_0x5411d3[_0x0b62('0x33')][_0x0b62('0x1e')]);_0x65d647[_0x0b62('0x20')]=qs[_0x0b62('0x20')](_0x5411d3['query'][_0x0b62('0x20')]);}return _0xc31cb9[_0x0b62('0x50')](_0x65d647);}})[_0x0b62('0x26')](function(_0x17ff6f){if(_0x17ff6f){return _0x17ff6f?{'count':_0x115927,'rows':_0x17ff6f}:null;}})[_0x0b62('0x26')](respondWithResult(_0x34953b,null))[_0x0b62('0x49')](handleError(_0x34953b,null));};exports[_0x0b62('0x51')]=function(_0x12c795,_0x386d35,_0x564584){var _0xbe78d8={};var _0x42c895={};var _0x59a752;var _0x31bf3e;return db[_0x0b62('0x2d')][_0x0b62('0x4d')]({'where':{'id':_0x12c795['params']['id']}})[_0x0b62('0x26')](handleEntityNotFound(_0x386d35,null))[_0x0b62('0x26')](function(_0x2cf2ed){if(_0x2cf2ed){_0x59a752=_0x2cf2ed;_0x42c895['model']=_[_0x0b62('0x34')](db['SalesforceField']['rawAttributes']);_0x42c895[_0x0b62('0x33')]=_['keys'](_0x12c795[_0x0b62('0x33')]);_0x42c895[_0x0b62('0x3d')]=_['intersection'](_0x42c895[_0x0b62('0x31')],_0x42c895[_0x0b62('0x33')]);_0xbe78d8['attributes']=_['intersection'](_0x42c895['model'],qs[_0x0b62('0x36')](_0x12c795[_0x0b62('0x33')][_0x0b62('0x36')]));_0xbe78d8[_0x0b62('0x37')]=_0xbe78d8[_0x0b62('0x37')][_0x0b62('0x38')]?_0xbe78d8['attributes']:_0x42c895['model'];_0xbe78d8[_0x0b62('0x3b')]=qs[_0x0b62('0x3c')](_0x12c795[_0x0b62('0x33')][_0x0b62('0x3c')]);_0xbe78d8['where']=qs['filters'](_[_0x0b62('0x4f')](_0x12c795[_0x0b62('0x33')],_0x42c895[_0x0b62('0x3d')]));if(_0x12c795['query'][_0x0b62('0x3e')]){_0xbe78d8[_0x0b62('0x3f')]=_[_0x0b62('0x40')](_0xbe78d8[_0x0b62('0x3f')],{'$or':_['map'](_0xbe78d8['attributes'],function(_0x496145){var _0x4d1f6b={};_0x4d1f6b[_0x496145]={'$like':'%'+_0x12c795['query'][_0x0b62('0x3e')]+'%'};return _0x4d1f6b;})});}_0xbe78d8=_[_0x0b62('0x40')]({},_0xbe78d8,_0x12c795[_0x0b62('0x41')]);return _0x59a752[_0x0b62('0x51')](_0xbe78d8);}})[_0x0b62('0x26')](function(_0x43223b){if(_0x43223b){_0x31bf3e=_0x43223b[_0x0b62('0x38')];if(!_0x12c795[_0x0b62('0x33')][_0x0b62('0x39')](_0x0b62('0x3a'))){_0xbe78d8[_0x0b62('0x1e')]=qs[_0x0b62('0x1e')](_0x12c795[_0x0b62('0x33')][_0x0b62('0x1e')]);_0xbe78d8[_0x0b62('0x20')]=qs[_0x0b62('0x20')](_0x12c795[_0x0b62('0x33')]['offset']);}return _0x59a752[_0x0b62('0x51')](_0xbe78d8);}})['then'](function(_0x160f7f){if(_0x160f7f){return _0x160f7f?{'count':_0x31bf3e,'rows':_0x160f7f}:null;}})[_0x0b62('0x26')](respondWithResult(_0x386d35,null))[_0x0b62('0x49')](handleError(_0x386d35,null));};exports[_0x0b62('0x52')]=function(_0x18940e,_0x463750,_0xf5aeb4){var _0x3377ec={};var _0x465ec2={};var _0x5ed899;var _0x83546a;return db[_0x0b62('0x2d')]['findOne']({'where':{'id':_0x18940e[_0x0b62('0x47')]['id']}})[_0x0b62('0x26')](handleEntityNotFound(_0x463750,null))['then'](function(_0x2dff02){if(_0x2dff02){_0x5ed899=_0x2dff02;_0x465ec2[_0x0b62('0x31')]=_[_0x0b62('0x34')](db['SalesforceField'][_0x0b62('0x53')]);_0x465ec2[_0x0b62('0x33')]=_[_0x0b62('0x34')](_0x18940e['query']);_0x465ec2[_0x0b62('0x3d')]=_[_0x0b62('0x35')](_0x465ec2[_0x0b62('0x31')],_0x465ec2[_0x0b62('0x33')]);_0x3377ec[_0x0b62('0x37')]=_[_0x0b62('0x35')](_0x465ec2['model'],qs['fields'](_0x18940e[_0x0b62('0x33')][_0x0b62('0x36')]));_0x3377ec[_0x0b62('0x37')]=_0x3377ec[_0x0b62('0x37')]['length']?_0x3377ec['attributes']:_0x465ec2[_0x0b62('0x31')];_0x3377ec[_0x0b62('0x3b')]=qs[_0x0b62('0x3c')](_0x18940e[_0x0b62('0x33')][_0x0b62('0x3c')]);_0x3377ec[_0x0b62('0x3f')]=qs[_0x0b62('0x3d')](_[_0x0b62('0x4f')](_0x18940e[_0x0b62('0x33')],_0x465ec2['filters']));if(_0x18940e['query']['filter']){_0x3377ec['where']=_[_0x0b62('0x40')](_0x3377ec[_0x0b62('0x3f')],{'$or':_['map'](_0x3377ec[_0x0b62('0x37')],function(_0x33dcb7){var _0x258620={};_0x258620[_0x33dcb7]={'$like':'%'+_0x18940e[_0x0b62('0x33')][_0x0b62('0x3e')]+'%'};return _0x258620;})});}_0x3377ec=_[_0x0b62('0x40')]({},_0x3377ec,_0x18940e[_0x0b62('0x41')]);return _0x5ed899[_0x0b62('0x52')](_0x3377ec);}})[_0x0b62('0x26')](function(_0x1adde8){if(_0x1adde8){_0x83546a=_0x1adde8['length'];if(!_0x18940e['query'][_0x0b62('0x39')](_0x0b62('0x3a'))){_0x3377ec['limit']=qs[_0x0b62('0x1e')](_0x18940e[_0x0b62('0x33')][_0x0b62('0x1e')]);_0x3377ec[_0x0b62('0x20')]=qs[_0x0b62('0x20')](_0x18940e['query']['offset']);}return _0x5ed899[_0x0b62('0x52')](_0x3377ec);}})[_0x0b62('0x26')](function(_0x5586a1){if(_0x5586a1){return _0x5586a1?{'count':_0x83546a,'rows':_0x5586a1}:null;}})['then'](respondWithResult(_0x463750,null))['catch'](handleError(_0x463750,null));}; \ No newline at end of file +var _0x40fa=['VIRTUAL','filter','options','include','findAll','then','catch','show','params','includeAll','create','body','find','getFields','nolimit','getSubjects','SalesforceField','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','error','name','send','SalesforceConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x40fa,0x194));var _0xa40f=function(_0x40e126,_0x53b489){_0x40e126=_0x40e126-0x0;var _0x42ff66=_0x40fa[_0x40e126];return _0x42ff66;};'use strict';var emlformat=require(_0xa40f('0x0'));var rimraf=require(_0xa40f('0x1'));var zipdir=require(_0xa40f('0x2'));var jsonpatch=require(_0xa40f('0x3'));var rp=require(_0xa40f('0x4'));var moment=require('moment');var BPromise=require(_0xa40f('0x5'));var Mustache=require(_0xa40f('0x6'));var util=require('util');var path=require(_0xa40f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa40f('0x8'));var fs=require('fs');var fs_extra=require(_0xa40f('0x9'));var _=require(_0xa40f('0xa'));var squel=require(_0xa40f('0xb'));var crypto=require('crypto');var jsforce=require(_0xa40f('0xc'));var deskjs=require(_0xa40f('0xd'));var toCsv=require(_0xa40f('0xe'));var querystring=require('querystring');var Papa=require(_0xa40f('0xf'));var Redis=require(_0xa40f('0x10'));var authService=require(_0xa40f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa40f('0x12'));var hardwareService=require(_0xa40f('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa40f('0x14'));var licenseUtil=require(_0xa40f('0x15'));var db=require(_0xa40f('0x16'))['db'];function respondWithStatusCode(_0x147aff,_0x3a5379){_0x3a5379=_0x3a5379||0xcc;return function(_0x14e792){if(_0x14e792){return _0x147aff[_0xa40f('0x17')](_0x3a5379);}return _0x147aff[_0xa40f('0x18')](_0x3a5379)[_0xa40f('0x19')]();};}function respondWithResult(_0x3bf431,_0x5852c8){_0x5852c8=_0x5852c8||0xc8;return function(_0x46767e){if(_0x46767e){return _0x3bf431[_0xa40f('0x18')](_0x5852c8)[_0xa40f('0x1a')](_0x46767e);}};}function respondWithFilteredResult(_0x5629a7,_0xea7c33){return function(_0x4105c9){if(_0x4105c9){var _0x19f007=typeof _0xea7c33['offset']===_0xa40f('0x1b')&&typeof _0xea7c33[_0xa40f('0x1c')]==='undefined';var _0x352760=_0x4105c9[_0xa40f('0x1d')];var _0xfe8c6=_0x19f007?0x0:_0xea7c33[_0xa40f('0x1e')];var _0x40d94a=_0x19f007?_0x4105c9[_0xa40f('0x1d')]:_0xea7c33['offset']+_0xea7c33[_0xa40f('0x1c')];var _0x4da313;if(_0x40d94a>=_0x352760){_0x40d94a=_0x352760;_0x4da313=0xc8;}else{_0x4da313=0xce;}_0x5629a7['status'](_0x4da313);return _0x5629a7[_0xa40f('0x1f')](_0xa40f('0x20'),_0xfe8c6+'-'+_0x40d94a+'/'+_0x352760)['json'](_0x4105c9);}return null;};}function patchUpdates(_0x3046d6){return function(_0x1a4117){try{jsonpatch[_0xa40f('0x21')](_0x1a4117,_0x3046d6,!![]);}catch(_0x3efd52){return BPromise['reject'](_0x3efd52);}return _0x1a4117[_0xa40f('0x22')]();};}function saveUpdates(_0x422588,_0x15e583){return function(_0x1f68b5){if(_0x1f68b5){return _0x1f68b5[_0xa40f('0x23')](_0x422588)['then'](function(_0x23839e){return _0x23839e;});}return null;};}function removeEntity(_0x328ab4,_0x2aa915){return function(_0x15c6ca){if(_0x15c6ca){return _0x15c6ca[_0xa40f('0x24')]()['then'](function(){_0x328ab4[_0xa40f('0x18')](0xcc)[_0xa40f('0x19')]();});}};}function handleEntityNotFound(_0x5c0851,_0x305fb4){return function(_0x1cf7b8){if(!_0x1cf7b8){_0x5c0851[_0xa40f('0x17')](0x194);}return _0x1cf7b8;};}function handleError(_0xbb2e6e,_0x10473e){_0x10473e=_0x10473e||0x1f4;return function(_0x53e467){logger[_0xa40f('0x25')](_0x53e467['stack']);if(_0x53e467[_0xa40f('0x26')]){delete _0x53e467[_0xa40f('0x26')];}_0xbb2e6e[_0xa40f('0x18')](_0x10473e)[_0xa40f('0x27')](_0x53e467);};}exports['index']=function(_0x27714d,_0x48dbfe){var _0x28ffe2={},_0x1d17c3={},_0x17c67b={'count':0x0,'rows':[]};var _0x5a9e56=_['map'](db[_0xa40f('0x28')][_0xa40f('0x29')],function(_0x378fd6){return{'name':_0x378fd6['fieldName'],'type':_0x378fd6[_0xa40f('0x2a')][_0xa40f('0x2b')]};});_0x1d17c3[_0xa40f('0x2c')]=_[_0xa40f('0x2d')](_0x5a9e56,_0xa40f('0x26'));_0x1d17c3[_0xa40f('0x2e')]=_[_0xa40f('0x2f')](_0x27714d[_0xa40f('0x2e')]);_0x1d17c3[_0xa40f('0x30')]=_[_0xa40f('0x31')](_0x1d17c3[_0xa40f('0x2c')],_0x1d17c3[_0xa40f('0x2e')]);_0x28ffe2[_0xa40f('0x32')]=_[_0xa40f('0x31')](_0x1d17c3[_0xa40f('0x2c')],qs[_0xa40f('0x33')](_0x27714d[_0xa40f('0x2e')][_0xa40f('0x33')]));_0x28ffe2[_0xa40f('0x32')]=_0x28ffe2[_0xa40f('0x32')][_0xa40f('0x34')]?_0x28ffe2[_0xa40f('0x32')]:_0x1d17c3[_0xa40f('0x2c')];if(!_0x27714d[_0xa40f('0x2e')][_0xa40f('0x35')]('nolimit')){_0x28ffe2['limit']=qs[_0xa40f('0x1c')](_0x27714d[_0xa40f('0x2e')][_0xa40f('0x1c')]);_0x28ffe2[_0xa40f('0x1e')]=qs['offset'](_0x27714d[_0xa40f('0x2e')]['offset']);}_0x28ffe2[_0xa40f('0x36')]=qs[_0xa40f('0x37')](_0x27714d[_0xa40f('0x2e')][_0xa40f('0x37')]);_0x28ffe2[_0xa40f('0x38')]=qs[_0xa40f('0x30')](_['pick'](_0x27714d[_0xa40f('0x2e')],_0x1d17c3[_0xa40f('0x30')]),_0x5a9e56);if(_0x27714d['query']['filter']){_0x28ffe2[_0xa40f('0x38')]=_[_0xa40f('0x39')](_0x28ffe2[_0xa40f('0x38')],{'$or':_[_0xa40f('0x2d')](_0x5a9e56,function(_0x3c48f0){if(_0x3c48f0[_0xa40f('0x2a')]!==_0xa40f('0x3a')){var _0x75d414={};_0x75d414[_0x3c48f0[_0xa40f('0x26')]]={'$like':'%'+_0x27714d[_0xa40f('0x2e')][_0xa40f('0x3b')]+'%'};return _0x75d414;}})});}_0x28ffe2=_['merge']({},_0x28ffe2,_0x27714d[_0xa40f('0x3c')]);var _0x2ff1d3={'where':_0x28ffe2['where']};return db['SalesforceConfiguration'][_0xa40f('0x1d')](_0x2ff1d3)['then'](function(_0x2efd52){_0x17c67b[_0xa40f('0x1d')]=_0x2efd52;if(_0x27714d[_0xa40f('0x2e')]['includeAll']){_0x28ffe2[_0xa40f('0x3d')]=[{'all':!![]}];}return db[_0xa40f('0x28')][_0xa40f('0x3e')](_0x28ffe2);})[_0xa40f('0x3f')](function(_0x334b34){_0x17c67b['rows']=_0x334b34;return _0x17c67b;})['then'](respondWithFilteredResult(_0x48dbfe,_0x28ffe2))[_0xa40f('0x40')](handleError(_0x48dbfe,null));};exports[_0xa40f('0x41')]=function(_0x562a25,_0x164d5a){var _0x3d0ae1={'raw':![],'where':{'id':_0x562a25[_0xa40f('0x42')]['id']}},_0x222720={};_0x222720[_0xa40f('0x2c')]=_['keys'](db[_0xa40f('0x28')][_0xa40f('0x29')]);_0x222720[_0xa40f('0x2e')]=_[_0xa40f('0x2f')](_0x562a25['query']);_0x222720[_0xa40f('0x30')]=_[_0xa40f('0x31')](_0x222720['model'],_0x222720[_0xa40f('0x2e')]);_0x3d0ae1['attributes']=_[_0xa40f('0x31')](_0x222720[_0xa40f('0x2c')],qs['fields'](_0x562a25[_0xa40f('0x2e')][_0xa40f('0x33')]));_0x3d0ae1['attributes']=_0x3d0ae1[_0xa40f('0x32')]['length']?_0x3d0ae1['attributes']:_0x222720[_0xa40f('0x2c')];if(_0x562a25[_0xa40f('0x2e')][_0xa40f('0x43')]){_0x3d0ae1[_0xa40f('0x3d')]=[{'all':!![]}];}_0x3d0ae1=_[_0xa40f('0x39')]({},_0x3d0ae1,_0x562a25[_0xa40f('0x3c')]);return db[_0xa40f('0x28')]['find'](_0x3d0ae1)[_0xa40f('0x3f')](handleEntityNotFound(_0x164d5a,null))[_0xa40f('0x3f')](respondWithResult(_0x164d5a,null))[_0xa40f('0x40')](handleError(_0x164d5a,null));};exports[_0xa40f('0x44')]=function(_0x2fa522,_0x96eeca){return db['SalesforceConfiguration'][_0xa40f('0x44')](_0x2fa522[_0xa40f('0x45')],{})[_0xa40f('0x3f')](respondWithResult(_0x96eeca,0xc9))['catch'](handleError(_0x96eeca,null));};exports[_0xa40f('0x23')]=function(_0x310e04,_0x4861f9){if(_0x310e04[_0xa40f('0x45')]['id']){delete _0x310e04[_0xa40f('0x45')]['id'];}return db[_0xa40f('0x28')]['find']({'where':{'id':_0x310e04['params']['id']}})[_0xa40f('0x3f')](handleEntityNotFound(_0x4861f9,null))[_0xa40f('0x3f')](saveUpdates(_0x310e04[_0xa40f('0x45')],null))[_0xa40f('0x3f')](respondWithResult(_0x4861f9,null))[_0xa40f('0x40')](handleError(_0x4861f9,null));};exports[_0xa40f('0x24')]=function(_0x3396e8,_0x146773){return db[_0xa40f('0x28')][_0xa40f('0x46')]({'where':{'id':_0x3396e8[_0xa40f('0x42')]['id']}})[_0xa40f('0x3f')](handleEntityNotFound(_0x146773,null))[_0xa40f('0x3f')](removeEntity(_0x146773,null))[_0xa40f('0x40')](handleError(_0x146773,null));};exports[_0xa40f('0x47')]=function(_0x297c1a,_0x4ddf5c,_0x416fcf){var _0x4e3914={};var _0x5e1d21={};var _0x1a9681;var _0x438407;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x297c1a[_0xa40f('0x42')]['id']}})[_0xa40f('0x3f')](handleEntityNotFound(_0x4ddf5c,null))['then'](function(_0x5352a3){if(_0x5352a3){_0x1a9681=_0x5352a3;_0x5e1d21['model']=_[_0xa40f('0x2f')](db['SalesforceField']['rawAttributes']);_0x5e1d21['query']=_[_0xa40f('0x2f')](_0x297c1a[_0xa40f('0x2e')]);_0x5e1d21['filters']=_[_0xa40f('0x31')](_0x5e1d21[_0xa40f('0x2c')],_0x5e1d21[_0xa40f('0x2e')]);_0x4e3914[_0xa40f('0x32')]=_['intersection'](_0x5e1d21[_0xa40f('0x2c')],qs[_0xa40f('0x33')](_0x297c1a['query'][_0xa40f('0x33')]));_0x4e3914['attributes']=_0x4e3914['attributes'][_0xa40f('0x34')]?_0x4e3914[_0xa40f('0x32')]:_0x5e1d21['model'];_0x4e3914[_0xa40f('0x36')]=qs[_0xa40f('0x37')](_0x297c1a[_0xa40f('0x2e')][_0xa40f('0x37')]);_0x4e3914[_0xa40f('0x38')]=qs[_0xa40f('0x30')](_['pick'](_0x297c1a[_0xa40f('0x2e')],_0x5e1d21['filters']));if(_0x297c1a[_0xa40f('0x2e')][_0xa40f('0x3b')]){_0x4e3914['where']=_[_0xa40f('0x39')](_0x4e3914[_0xa40f('0x38')],{'$or':_['map'](_0x4e3914[_0xa40f('0x32')],function(_0x3f1e6c){var _0x5d0e74={};_0x5d0e74[_0x3f1e6c]={'$like':'%'+_0x297c1a['query'][_0xa40f('0x3b')]+'%'};return _0x5d0e74;})});}_0x4e3914=_[_0xa40f('0x39')]({},_0x4e3914,_0x297c1a[_0xa40f('0x3c')]);return _0x1a9681[_0xa40f('0x47')](_0x4e3914);}})[_0xa40f('0x3f')](function(_0x4cec24){if(_0x4cec24){_0x438407=_0x4cec24[_0xa40f('0x34')];if(!_0x297c1a[_0xa40f('0x2e')][_0xa40f('0x35')](_0xa40f('0x48'))){_0x4e3914[_0xa40f('0x1c')]=qs['limit'](_0x297c1a['query'][_0xa40f('0x1c')]);_0x4e3914[_0xa40f('0x1e')]=qs[_0xa40f('0x1e')](_0x297c1a[_0xa40f('0x2e')]['offset']);}return _0x1a9681['getFields'](_0x4e3914);}})[_0xa40f('0x3f')](function(_0x332456){if(_0x332456){return _0x332456?{'count':_0x438407,'rows':_0x332456}:null;}})['then'](respondWithResult(_0x4ddf5c,null))[_0xa40f('0x40')](handleError(_0x4ddf5c,null));};exports[_0xa40f('0x49')]=function(_0x2e4346,_0x3cc5df,_0x16009c){var _0x42b948={};var _0x4f16e4={};var _0x4f1695;var _0x5ea5bf;return db[_0xa40f('0x28')]['findOne']({'where':{'id':_0x2e4346['params']['id']}})[_0xa40f('0x3f')](handleEntityNotFound(_0x3cc5df,null))['then'](function(_0x1dd20d){if(_0x1dd20d){_0x4f1695=_0x1dd20d;_0x4f16e4[_0xa40f('0x2c')]=_[_0xa40f('0x2f')](db[_0xa40f('0x4a')][_0xa40f('0x29')]);_0x4f16e4[_0xa40f('0x2e')]=_[_0xa40f('0x2f')](_0x2e4346['query']);_0x4f16e4[_0xa40f('0x30')]=_[_0xa40f('0x31')](_0x4f16e4[_0xa40f('0x2c')],_0x4f16e4[_0xa40f('0x2e')]);_0x42b948[_0xa40f('0x32')]=_[_0xa40f('0x31')](_0x4f16e4[_0xa40f('0x2c')],qs['fields'](_0x2e4346[_0xa40f('0x2e')][_0xa40f('0x33')]));_0x42b948[_0xa40f('0x32')]=_0x42b948[_0xa40f('0x32')][_0xa40f('0x34')]?_0x42b948[_0xa40f('0x32')]:_0x4f16e4[_0xa40f('0x2c')];_0x42b948[_0xa40f('0x36')]=qs[_0xa40f('0x37')](_0x2e4346[_0xa40f('0x2e')][_0xa40f('0x37')]);_0x42b948[_0xa40f('0x38')]=qs['filters'](_[_0xa40f('0x4b')](_0x2e4346[_0xa40f('0x2e')],_0x4f16e4[_0xa40f('0x30')]));if(_0x2e4346['query'][_0xa40f('0x3b')]){_0x42b948[_0xa40f('0x38')]=_['merge'](_0x42b948[_0xa40f('0x38')],{'$or':_[_0xa40f('0x2d')](_0x42b948[_0xa40f('0x32')],function(_0x3785b4){var _0x21187d={};_0x21187d[_0x3785b4]={'$like':'%'+_0x2e4346['query']['filter']+'%'};return _0x21187d;})});}_0x42b948=_[_0xa40f('0x39')]({},_0x42b948,_0x2e4346['options']);return _0x4f1695['getSubjects'](_0x42b948);}})['then'](function(_0x3e900c){if(_0x3e900c){_0x5ea5bf=_0x3e900c[_0xa40f('0x34')];if(!_0x2e4346[_0xa40f('0x2e')][_0xa40f('0x35')](_0xa40f('0x48'))){_0x42b948[_0xa40f('0x1c')]=qs['limit'](_0x2e4346[_0xa40f('0x2e')][_0xa40f('0x1c')]);_0x42b948['offset']=qs[_0xa40f('0x1e')](_0x2e4346[_0xa40f('0x2e')][_0xa40f('0x1e')]);}return _0x4f1695['getSubjects'](_0x42b948);}})[_0xa40f('0x3f')](function(_0xaf44cf){if(_0xaf44cf){return _0xaf44cf?{'count':_0x5ea5bf,'rows':_0xaf44cf}:null;}})['then'](respondWithResult(_0x3cc5df,null))[_0xa40f('0x40')](handleError(_0x3cc5df,null));};exports[_0xa40f('0x4c')]=function(_0xb39e79,_0x312b45,_0x39b0df){var _0x227622={};var _0x581b4c={};var _0x129725;var _0x597435;return db[_0xa40f('0x28')]['findOne']({'where':{'id':_0xb39e79[_0xa40f('0x42')]['id']}})[_0xa40f('0x3f')](handleEntityNotFound(_0x312b45,null))[_0xa40f('0x3f')](function(_0x5a21b5){if(_0x5a21b5){_0x129725=_0x5a21b5;_0x581b4c[_0xa40f('0x2c')]=_[_0xa40f('0x2f')](db[_0xa40f('0x4a')][_0xa40f('0x29')]);_0x581b4c[_0xa40f('0x2e')]=_['keys'](_0xb39e79[_0xa40f('0x2e')]);_0x581b4c[_0xa40f('0x30')]=_[_0xa40f('0x31')](_0x581b4c[_0xa40f('0x2c')],_0x581b4c[_0xa40f('0x2e')]);_0x227622[_0xa40f('0x32')]=_[_0xa40f('0x31')](_0x581b4c['model'],qs[_0xa40f('0x33')](_0xb39e79['query']['fields']));_0x227622['attributes']=_0x227622['attributes'][_0xa40f('0x34')]?_0x227622[_0xa40f('0x32')]:_0x581b4c[_0xa40f('0x2c')];_0x227622[_0xa40f('0x36')]=qs[_0xa40f('0x37')](_0xb39e79['query']['sort']);_0x227622['where']=qs[_0xa40f('0x30')](_[_0xa40f('0x4b')](_0xb39e79[_0xa40f('0x2e')],_0x581b4c[_0xa40f('0x30')]));if(_0xb39e79[_0xa40f('0x2e')]['filter']){_0x227622[_0xa40f('0x38')]=_[_0xa40f('0x39')](_0x227622['where'],{'$or':_[_0xa40f('0x2d')](_0x227622['attributes'],function(_0x4a65bb){var _0x3e3697={};_0x3e3697[_0x4a65bb]={'$like':'%'+_0xb39e79[_0xa40f('0x2e')]['filter']+'%'};return _0x3e3697;})});}_0x227622=_[_0xa40f('0x39')]({},_0x227622,_0xb39e79['options']);return _0x129725[_0xa40f('0x4c')](_0x227622);}})[_0xa40f('0x3f')](function(_0x4c7306){if(_0x4c7306){_0x597435=_0x4c7306['length'];if(!_0xb39e79[_0xa40f('0x2e')]['hasOwnProperty'](_0xa40f('0x48'))){_0x227622[_0xa40f('0x1c')]=qs['limit'](_0xb39e79[_0xa40f('0x2e')]['limit']);_0x227622[_0xa40f('0x1e')]=qs[_0xa40f('0x1e')](_0xb39e79[_0xa40f('0x2e')][_0xa40f('0x1e')]);}return _0x129725[_0xa40f('0x4c')](_0x227622);}})[_0xa40f('0x3f')](function(_0x1bd047){if(_0x1bd047){return _0x1bd047?{'count':_0x597435,'rows':_0x1bd047}:null;}})[_0xa40f('0x3f')](respondWithResult(_0x312b45,null))[_0xa40f('0x40')](handleError(_0x312b45,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index f669714..7c6f7c4 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 _0xb5dd=['../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2a75cd,_0x247962){var _0x2319bc=function(_0x47d0c5){while(--_0x47d0c5){_0x2a75cd['push'](_0x2a75cd['shift']());}};_0x2319bc(++_0x247962);}(_0xb5dd,0xbb));var _0xdb5d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb5dd[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xdb5d('0x0'));var util=require(_0xdb5d('0x1'));var logger=require(_0xdb5d('0x2'))(_0xdb5d('0x3'));var moment=require(_0xdb5d('0x4'));var BPromise=require(_0xdb5d('0x5'));var rp=require(_0xdb5d('0x6'));var fs=require('fs');var path=require(_0xdb5d('0x7'));var rimraf=require('rimraf');var config=require(_0xdb5d('0x8'));var attributes=require(_0xdb5d('0x9'));module[_0xdb5d('0xa')]=function(_0x58d57c,_0x128af2){return _0x58d57c[_0xdb5d('0xb')]('SalesforceConfiguration',attributes,{'tableName':_0xdb5d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea95=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0xea95,0x9a));var _0x5ea9=function(_0x2d770f,_0x97eaac){_0x2d770f=_0x2d770f-0x0;var _0xaa1f57=_0xea95[_0x2d770f];return _0xaa1f57;};'use strict';var _=require(_0x5ea9('0x0'));var util=require('util');var logger=require(_0x5ea9('0x1'))(_0x5ea9('0x2'));var moment=require('moment');var BPromise=require(_0x5ea9('0x3'));var rp=require(_0x5ea9('0x4'));var fs=require('fs');var path=require(_0x5ea9('0x5'));var rimraf=require(_0x5ea9('0x6'));var config=require(_0x5ea9('0x7'));var attributes=require(_0x5ea9('0x8'));module[_0x5ea9('0x9')]=function(_0x4d1875,_0x162e18){return _0x4d1875[_0x5ea9('0xa')](_0x5ea9('0xb'),attributes,{'tableName':_0x5ea9('0xc'),'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 c3b13c7..dc2447d 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 _0xe994=['error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x861f5a,_0x1855ce){var _0x18e11b=function(_0x3c2f96){while(--_0x3c2f96){_0x861f5a['push'](_0x861f5a['shift']());}};_0x18e11b(++_0x1855ce);}(_0xe994,0xac));var _0x4e99=function(_0x23292a,_0x1e08ea){_0x23292a=_0x23292a-0x0;var _0x4564f2=_0xe994[_0x23292a];return _0x4564f2;};'use strict';var _=require(_0x4e99('0x0'));var util=require(_0x4e99('0x1'));var moment=require('moment');var BPromise=require(_0x4e99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e99('0x3'));var db=require(_0x4e99('0x4'))['db'];var utils=require(_0x4e99('0x5'));var logger=require(_0x4e99('0x6'))(_0x4e99('0x7'));var config=require('../../config/environment');var jayson=require(_0x4e99('0x8'));var client=jayson['client'][_0x4e99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a4c16,_0x2802e0,_0x5eeb41){return new BPromise(function(_0x1beb8b,_0x2224fe){return client['request'](_0x2a4c16,_0x5eeb41)[_0x4e99('0xa')](function(_0x3ef786){logger[_0x4e99('0xb')](_0x4e99('0xc'),_0x2802e0,_0x4e99('0xd'));logger[_0x4e99('0xe')](_0x4e99('0xf'),_0x2802e0,'request\x20sent',JSON[_0x4e99('0x10')](_0x3ef786));if(_0x3ef786['error']){if(_0x3ef786[_0x4e99('0x11')][_0x4e99('0x12')]===0x1f4){logger[_0x4e99('0x11')](_0x4e99('0xc'),_0x2802e0,_0x3ef786[_0x4e99('0x11')]['message']);return _0x2224fe(_0x3ef786[_0x4e99('0x11')]['message']);}logger[_0x4e99('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2802e0,_0x3ef786[_0x4e99('0x11')]['message']);return _0x1beb8b(_0x3ef786[_0x4e99('0x11')][_0x4e99('0x13')]);}else{logger[_0x4e99('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2802e0,_0x4e99('0xd'));_0x1beb8b(_0x3ef786['result'][_0x4e99('0x13')]);}})[_0x4e99('0x14')](function(_0x41a983){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x2802e0,_0x41a983);_0x2224fe(_0x41a983);});});} \ No newline at end of file +var _0xf69a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xf69a,0x139));var _0xaf69=function(_0x4ed37d,_0x1a84c9){_0x4ed37d=_0x4ed37d-0x0;var _0x4fb2c5=_0xf69a[_0x4ed37d];return _0x4fb2c5;};'use strict';var _=require(_0xaf69('0x0'));var util=require(_0xaf69('0x1'));var moment=require(_0xaf69('0x2'));var BPromise=require(_0xaf69('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf69('0x4'));var db=require(_0xaf69('0x5'))['db'];var utils=require(_0xaf69('0x6'));var logger=require(_0xaf69('0x7'))(_0xaf69('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf69('0x9'));var client=jayson['client'][_0xaf69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a2f65,_0x257d99,_0x572e4e){return new BPromise(function(_0x543bde,_0x23bafb){return client[_0xaf69('0xb')](_0x2a2f65,_0x572e4e)[_0xaf69('0xc')](function(_0x1ca823){logger[_0xaf69('0xd')](_0xaf69('0xe'),_0x257d99,_0xaf69('0xf'));logger[_0xaf69('0x10')](_0xaf69('0x11'),_0x257d99,_0xaf69('0xf'),JSON[_0xaf69('0x12')](_0x1ca823));if(_0x1ca823[_0xaf69('0x13')]){if(_0x1ca823['error'][_0xaf69('0x14')]===0x1f4){logger['error'](_0xaf69('0xe'),_0x257d99,_0x1ca823[_0xaf69('0x13')][_0xaf69('0x15')]);return _0x23bafb(_0x1ca823[_0xaf69('0x13')]['message']);}logger[_0xaf69('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x257d99,_0x1ca823[_0xaf69('0x13')][_0xaf69('0x15')]);return _0x543bde(_0x1ca823[_0xaf69('0x13')][_0xaf69('0x15')]);}else{logger[_0xaf69('0xd')](_0xaf69('0xe'),_0x257d99,_0xaf69('0xf'));_0x543bde(_0x1ca823[_0xaf69('0x16')][_0xaf69('0x15')]);}})[_0xaf69('0x17')](function(_0x2415b9){logger[_0xaf69('0x13')](_0xaf69('0xe'),_0x257d99,_0x2415b9);_0x23bafb(_0x2415b9);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index c78d489..4c4b8fd 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 _0x57a5=['index','/:id','show','post','create','destroy','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated'];(function(_0x3b83ad,_0x51290d){var _0x20e6fd=function(_0x5f4f4f){while(--_0x5f4f4f){_0x3b83ad['push'](_0x3b83ad['shift']());}};_0x20e6fd(++_0x51290d);}(_0x57a5,0xae));var _0x557a=function(_0x39e127,_0x5155a6){_0x39e127=_0x39e127-0x0;var _0x493616=_0x57a5[_0x39e127];return _0x493616;};'use strict';var multer=require('multer');var util=require(_0x557a('0x0'));var path=require('path');var timeout=require(_0x557a('0x1'));var express=require('express');var router=express[_0x557a('0x2')]();var fs_extra=require(_0x557a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x557a('0x4'));var config=require('../../config/environment');var controller=require(_0x557a('0x5'));router[_0x557a('0x6')]('/',auth[_0x557a('0x7')](),controller[_0x557a('0x8')]);router[_0x557a('0x6')](_0x557a('0x9'),auth[_0x557a('0x7')](),controller[_0x557a('0xa')]);router[_0x557a('0xb')]('/',auth['isAuthenticated'](),controller[_0x557a('0xc')]);router['put'](_0x557a('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x557a('0x9'),auth[_0x557a('0x7')](),controller[_0x557a('0xd')]);module['exports']=router; \ No newline at end of file +var _0x7072=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7072,0x11b));var _0x2707=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x7072[_0x231e16];return _0x570a7c;};'use strict';var multer=require(_0x2707('0x0'));var util=require(_0x2707('0x1'));var path=require('path');var timeout=require(_0x2707('0x2'));var express=require(_0x2707('0x3'));var router=express[_0x2707('0x4')]();var fs_extra=require(_0x2707('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2707('0x6'));var config=require(_0x2707('0x7'));var controller=require(_0x2707('0x8'));router[_0x2707('0x9')]('/',auth[_0x2707('0xa')](),controller['index']);router[_0x2707('0x9')](_0x2707('0xb'),auth[_0x2707('0xa')](),controller[_0x2707('0xc')]);router[_0x2707('0xd')]('/',auth[_0x2707('0xa')](),controller[_0x2707('0xe')]);router[_0x2707('0xf')](_0x2707('0xb'),auth[_0x2707('0xa')](),controller[_0x2707('0x10')]);router[_0x2707('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2707('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index cefa8d1..b95cfc7 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 _0x25e4=['keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM','string','variable'];(function(_0x43e2b5,_0x2584db){var _0xe364f0=function(_0x5c8b31){while(--_0x5c8b31){_0x43e2b5['push'](_0x43e2b5['shift']());}};_0xe364f0(++_0x2584db);}(_0x25e4,0x199));var _0x425e=function(_0x55c074,_0x2affd8){_0x55c074=_0x55c074-0x0;var _0x140f86=_0x25e4[_0x55c074];return _0x140f86;};'use strict';var Sequelize=require(_0x425e('0x0'));module[_0x425e('0x1')]={'type':{'type':Sequelize[_0x425e('0x2')](_0x425e('0x3'),_0x425e('0x4'),'customVariable',_0x425e('0x5'),_0x425e('0x6')),'defaultValue':_0x425e('0x3')},'content':{'type':Sequelize[_0x425e('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x425e('0x2')](_0x425e('0x3'),_0x425e('0x4'),_0x425e('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x425e('0x7')]}}; \ No newline at end of file +var _0xafed=['string','STRING','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x3d526f,_0x223456){var _0x3985ae=function(_0xad80d3){while(--_0xad80d3){_0x3d526f['push'](_0x3d526f['shift']());}};_0x3985ae(++_0x223456);}(_0xafed,0x1e8));var _0xdafe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xafed[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdafe('0x0'));module[_0xdafe('0x1')]={'type':{'type':Sequelize[_0xdafe('0x2')]('string',_0xdafe('0x3'),_0xdafe('0x4'),_0xdafe('0x5'),_0xdafe('0x6')),'defaultValue':_0xdafe('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdafe('0x8')]},'keyType':{'type':Sequelize[_0xdafe('0x2')](_0xdafe('0x7'),'variable',_0xdafe('0x4'))},'keyContent':{'type':Sequelize[_0xdafe('0x8')]},'idField':{'type':Sequelize[_0xdafe('0x8')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 54a77db..b1b6b0e 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 _0x3433=['fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','index','map','SalesforceField','rawAttributes'];(function(_0x218cc1,_0x794922){var _0x5035f7=function(_0x1b98a8){while(--_0x1b98a8){_0x218cc1['push'](_0x218cc1['shift']());}};_0x5035f7(++_0x794922);}(_0x3433,0x1e6));var _0x3343=function(_0x295ea9,_0x19d658){_0x295ea9=_0x295ea9-0x0;var _0x59a3fe=_0x3433[_0x295ea9];return _0x59a3fe;};'use strict';var emlformat=require(_0x3343('0x0'));var rimraf=require(_0x3343('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3343('0x2'));var rp=require(_0x3343('0x3'));var moment=require(_0x3343('0x4'));var BPromise=require(_0x3343('0x5'));var Mustache=require(_0x3343('0x6'));var util=require(_0x3343('0x7'));var path=require(_0x3343('0x8'));var sox=require(_0x3343('0x9'));var csv=require(_0x3343('0xa'));var ejs=require(_0x3343('0xb'));var fs=require('fs');var fs_extra=require(_0x3343('0xc'));var _=require(_0x3343('0xd'));var squel=require(_0x3343('0xe'));var crypto=require('crypto');var jsforce=require(_0x3343('0xf'));var deskjs=require(_0x3343('0x10'));var toCsv=require(_0x3343('0xa'));var querystring=require(_0x3343('0x11'));var Papa=require('papaparse');var Redis=require(_0x3343('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3343('0x13'));var as=require(_0x3343('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3343('0x15'));var utils=require('../../config/utils');var config=require(_0x3343('0x16'));var licenseUtil=require(_0x3343('0x17'));var db=require(_0x3343('0x18'))['db'];function respondWithStatusCode(_0x311d3f,_0x213af5){_0x213af5=_0x213af5||0xcc;return function(_0x5db0c4){if(_0x5db0c4){return _0x311d3f[_0x3343('0x19')](_0x213af5);}return _0x311d3f[_0x3343('0x1a')](_0x213af5)[_0x3343('0x1b')]();};}function respondWithResult(_0x370fe5,_0x3172ad){_0x3172ad=_0x3172ad||0xc8;return function(_0xc4e10b){if(_0xc4e10b){return _0x370fe5[_0x3343('0x1a')](_0x3172ad)[_0x3343('0x1c')](_0xc4e10b);}};}function respondWithFilteredResult(_0x42dd19,_0x5bc6c4){return function(_0x538da3){if(_0x538da3){var _0x12ba52=typeof _0x5bc6c4['offset']===_0x3343('0x1d')&&typeof _0x5bc6c4['limit']===_0x3343('0x1d');var _0x4942b6=_0x538da3[_0x3343('0x1e')];var _0x4c2c3f=_0x12ba52?0x0:_0x5bc6c4['offset'];var _0x2b017d=_0x12ba52?_0x538da3[_0x3343('0x1e')]:_0x5bc6c4[_0x3343('0x1f')]+_0x5bc6c4[_0x3343('0x20')];var _0x478334;if(_0x2b017d>=_0x4942b6){_0x2b017d=_0x4942b6;_0x478334=0xc8;}else{_0x478334=0xce;}_0x42dd19['status'](_0x478334);return _0x42dd19[_0x3343('0x21')](_0x3343('0x22'),_0x4c2c3f+'-'+_0x2b017d+'/'+_0x4942b6)[_0x3343('0x1c')](_0x538da3);}return null;};}function patchUpdates(_0x47656e){return function(_0x5f2e90){try{jsonpatch[_0x3343('0x23')](_0x5f2e90,_0x47656e,!![]);}catch(_0x4bf73f){return BPromise[_0x3343('0x24')](_0x4bf73f);}return _0x5f2e90['save']();};}function saveUpdates(_0xa08da9,_0x32c6b6){return function(_0xa38d5d){if(_0xa38d5d){return _0xa38d5d[_0x3343('0x25')](_0xa08da9)[_0x3343('0x26')](function(_0x501cd3){return _0x501cd3;});}return null;};}function removeEntity(_0x4eb7c1,_0x253807){return function(_0x236b8a){if(_0x236b8a){return _0x236b8a['destroy']()['then'](function(){_0x4eb7c1[_0x3343('0x1a')](0xcc)[_0x3343('0x1b')]();});}};}function handleEntityNotFound(_0x1a895c,_0xdba150){return function(_0x57b5c0){if(!_0x57b5c0){_0x1a895c['sendStatus'](0x194);}return _0x57b5c0;};}function handleError(_0x241931,_0x11638b){_0x11638b=_0x11638b||0x1f4;return function(_0x52a191){logger[_0x3343('0x27')](_0x52a191[_0x3343('0x28')]);if(_0x52a191[_0x3343('0x29')]){delete _0x52a191[_0x3343('0x29')];}_0x241931[_0x3343('0x1a')](_0x11638b)['send'](_0x52a191);};}exports[_0x3343('0x2a')]=function(_0x3632f9,_0x4c38c7){var _0x4289db={},_0x596cd1={},_0x3ffcbb={'count':0x0,'rows':[]};var _0x189f83=_[_0x3343('0x2b')](db[_0x3343('0x2c')][_0x3343('0x2d')],function(_0x2b418e){return{'name':_0x2b418e[_0x3343('0x2e')],'type':_0x2b418e[_0x3343('0x2f')][_0x3343('0x30')]};});_0x596cd1[_0x3343('0x31')]=_[_0x3343('0x2b')](_0x189f83,'name');_0x596cd1[_0x3343('0x32')]=_[_0x3343('0x33')](_0x3632f9[_0x3343('0x32')]);_0x596cd1[_0x3343('0x34')]=_[_0x3343('0x35')](_0x596cd1[_0x3343('0x31')],_0x596cd1[_0x3343('0x32')]);_0x4289db[_0x3343('0x36')]=_[_0x3343('0x35')](_0x596cd1[_0x3343('0x31')],qs['fields'](_0x3632f9[_0x3343('0x32')]['fields']));_0x4289db['attributes']=_0x4289db['attributes'][_0x3343('0x37')]?_0x4289db['attributes']:_0x596cd1[_0x3343('0x31')];if(!_0x3632f9[_0x3343('0x32')][_0x3343('0x38')](_0x3343('0x39'))){_0x4289db[_0x3343('0x20')]=qs[_0x3343('0x20')](_0x3632f9[_0x3343('0x32')][_0x3343('0x20')]);_0x4289db['offset']=qs[_0x3343('0x1f')](_0x3632f9[_0x3343('0x32')][_0x3343('0x1f')]);}_0x4289db[_0x3343('0x3a')]=qs['sort'](_0x3632f9[_0x3343('0x32')][_0x3343('0x3b')]);_0x4289db['where']=qs[_0x3343('0x34')](_['pick'](_0x3632f9[_0x3343('0x32')],_0x596cd1[_0x3343('0x34')]),_0x189f83);if(_0x3632f9['query'][_0x3343('0x3c')]){_0x4289db[_0x3343('0x3d')]=_['merge'](_0x4289db['where'],{'$or':_[_0x3343('0x2b')](_0x189f83,function(_0x3f36dc){if(_0x3f36dc[_0x3343('0x2f')]!==_0x3343('0x3e')){var _0x299735={};_0x299735[_0x3f36dc['name']]={'$like':'%'+_0x3632f9[_0x3343('0x32')][_0x3343('0x3c')]+'%'};return _0x299735;}})});}_0x4289db=_[_0x3343('0x3f')]({},_0x4289db,_0x3632f9[_0x3343('0x40')]);var _0x2189f7={'where':_0x4289db[_0x3343('0x3d')]};return db[_0x3343('0x2c')]['count'](_0x2189f7)['then'](function(_0x2f1f67){_0x3ffcbb[_0x3343('0x1e')]=_0x2f1f67;if(_0x3632f9[_0x3343('0x32')][_0x3343('0x41')]){_0x4289db[_0x3343('0x42')]=[{'all':!![]}];}return db[_0x3343('0x2c')][_0x3343('0x43')](_0x4289db);})['then'](function(_0xcaaceb){_0x3ffcbb[_0x3343('0x44')]=_0xcaaceb;return _0x3ffcbb;})[_0x3343('0x26')](respondWithFilteredResult(_0x4c38c7,_0x4289db))[_0x3343('0x45')](handleError(_0x4c38c7,null));};exports[_0x3343('0x46')]=function(_0x403f10,_0x59aa37){var _0x1aa91f={'raw':!![],'where':{'id':_0x403f10[_0x3343('0x47')]['id']}},_0x236d8a={};_0x236d8a[_0x3343('0x31')]=_['keys'](db[_0x3343('0x2c')][_0x3343('0x2d')]);_0x236d8a[_0x3343('0x32')]=_[_0x3343('0x33')](_0x403f10[_0x3343('0x32')]);_0x236d8a[_0x3343('0x34')]=_['intersection'](_0x236d8a['model'],_0x236d8a[_0x3343('0x32')]);_0x1aa91f[_0x3343('0x36')]=_[_0x3343('0x35')](_0x236d8a['model'],qs['fields'](_0x403f10['query'][_0x3343('0x48')]));_0x1aa91f[_0x3343('0x36')]=_0x1aa91f[_0x3343('0x36')][_0x3343('0x37')]?_0x1aa91f[_0x3343('0x36')]:_0x236d8a[_0x3343('0x31')];if(_0x403f10['query']['includeAll']){_0x1aa91f[_0x3343('0x42')]=[{'all':!![]}];}_0x1aa91f=_['merge']({},_0x1aa91f,_0x403f10[_0x3343('0x40')]);return db[_0x3343('0x2c')]['find'](_0x1aa91f)[_0x3343('0x26')](handleEntityNotFound(_0x59aa37,null))[_0x3343('0x26')](respondWithResult(_0x59aa37,null))[_0x3343('0x45')](handleError(_0x59aa37,null));};exports[_0x3343('0x49')]=function(_0x32fc5d,_0x5888c4){return db[_0x3343('0x2c')][_0x3343('0x49')](_0x32fc5d[_0x3343('0x4a')],{})[_0x3343('0x26')](respondWithResult(_0x5888c4,0xc9))['catch'](handleError(_0x5888c4,null));};exports[_0x3343('0x25')]=function(_0x60d63e,_0x2b63b2){if(_0x60d63e[_0x3343('0x4a')]['id']){delete _0x60d63e[_0x3343('0x4a')]['id'];}return db[_0x3343('0x2c')][_0x3343('0x4b')]({'where':{'id':_0x60d63e[_0x3343('0x47')]['id']}})[_0x3343('0x26')](handleEntityNotFound(_0x2b63b2,null))[_0x3343('0x26')](saveUpdates(_0x60d63e['body'],null))['then'](respondWithResult(_0x2b63b2,null))[_0x3343('0x45')](handleError(_0x2b63b2,null));};exports['destroy']=function(_0x326e19,_0x32c79f){return db['SalesforceField'][_0x3343('0x4b')]({'where':{'id':_0x326e19[_0x3343('0x47')]['id']}})[_0x3343('0x26')](handleEntityNotFound(_0x32c79f,null))[_0x3343('0x26')](removeEntity(_0x32c79f,null))[_0x3343('0x45')](handleError(_0x32c79f,null));}; \ No newline at end of file +var _0x5965=['hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','apply','reject','save','update','destroy','then','error','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length'];(function(_0x57f345,_0x316929){var _0x255e43=function(_0x619f61){while(--_0x619f61){_0x57f345['push'](_0x57f345['shift']());}};_0x255e43(++_0x316929);}(_0x5965,0x1d5));var _0x5596=function(_0x50e0e2,_0x270d21){_0x50e0e2=_0x50e0e2-0x0;var _0x1bf6b8=_0x5965[_0x50e0e2];return _0x1bf6b8;};'use strict';var emlformat=require(_0x5596('0x0'));var rimraf=require(_0x5596('0x1'));var zipdir=require(_0x5596('0x2'));var jsonpatch=require(_0x5596('0x3'));var rp=require(_0x5596('0x4'));var moment=require('moment');var BPromise=require(_0x5596('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5596('0x6'));var csv=require('to-csv');var ejs=require(_0x5596('0x7'));var fs=require('fs');var fs_extra=require(_0x5596('0x8'));var _=require(_0x5596('0x9'));var squel=require(_0x5596('0xa'));var crypto=require(_0x5596('0xb'));var jsforce=require(_0x5596('0xc'));var deskjs=require(_0x5596('0xd'));var toCsv=require(_0x5596('0xe'));var querystring=require(_0x5596('0xf'));var Papa=require('papaparse');var Redis=require(_0x5596('0x10'));var authService=require(_0x5596('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5596('0x12'));var logger=require(_0x5596('0x13'))('api');var utils=require(_0x5596('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5596('0x15'));var db=require(_0x5596('0x16'))['db'];function respondWithStatusCode(_0xd75af9,_0x13810d){_0x13810d=_0x13810d||0xcc;return function(_0x1e3ca4){if(_0x1e3ca4){return _0xd75af9[_0x5596('0x17')](_0x13810d);}return _0xd75af9['status'](_0x13810d)[_0x5596('0x18')]();};}function respondWithResult(_0x2191ea,_0x4811bd){_0x4811bd=_0x4811bd||0xc8;return function(_0x5e5c2e){if(_0x5e5c2e){return _0x2191ea[_0x5596('0x19')](_0x4811bd)[_0x5596('0x1a')](_0x5e5c2e);}};}function respondWithFilteredResult(_0x6cc123,_0x31a577){return function(_0x6f241a){if(_0x6f241a){var _0x329c05=typeof _0x31a577['offset']===_0x5596('0x1b')&&typeof _0x31a577[_0x5596('0x1c')]===_0x5596('0x1b');var _0x2eecac=_0x6f241a[_0x5596('0x1d')];var _0x5216f1=_0x329c05?0x0:_0x31a577[_0x5596('0x1e')];var _0x1ba35c=_0x329c05?_0x6f241a[_0x5596('0x1d')]:_0x31a577[_0x5596('0x1e')]+_0x31a577[_0x5596('0x1c')];var _0x103676;if(_0x1ba35c>=_0x2eecac){_0x1ba35c=_0x2eecac;_0x103676=0xc8;}else{_0x103676=0xce;}_0x6cc123[_0x5596('0x19')](_0x103676);return _0x6cc123['set']('Content-Range',_0x5216f1+'-'+_0x1ba35c+'/'+_0x2eecac)[_0x5596('0x1a')](_0x6f241a);}return null;};}function patchUpdates(_0x4ffccc){return function(_0x4e9139){try{jsonpatch[_0x5596('0x1f')](_0x4e9139,_0x4ffccc,!![]);}catch(_0x14f256){return BPromise[_0x5596('0x20')](_0x14f256);}return _0x4e9139[_0x5596('0x21')]();};}function saveUpdates(_0x393da9,_0x382f54){return function(_0x47fb0f){if(_0x47fb0f){return _0x47fb0f[_0x5596('0x22')](_0x393da9)['then'](function(_0x1e0727){return _0x1e0727;});}return null;};}function removeEntity(_0x1df1ad,_0x15b989){return function(_0x574121){if(_0x574121){return _0x574121[_0x5596('0x23')]()[_0x5596('0x24')](function(){_0x1df1ad[_0x5596('0x19')](0xcc)[_0x5596('0x18')]();});}};}function handleEntityNotFound(_0x4be86c,_0xdddbd0){return function(_0x4933b7){if(!_0x4933b7){_0x4be86c[_0x5596('0x17')](0x194);}return _0x4933b7;};}function handleError(_0x4abb76,_0xf20716){_0xf20716=_0xf20716||0x1f4;return function(_0x10b889){logger[_0x5596('0x25')](_0x10b889[_0x5596('0x26')]);if(_0x10b889[_0x5596('0x27')]){delete _0x10b889[_0x5596('0x27')];}_0x4abb76[_0x5596('0x19')](_0xf20716)[_0x5596('0x28')](_0x10b889);};}exports[_0x5596('0x29')]=function(_0x27d975,_0x1794f7){var _0x582f88={},_0x665dc0={},_0x4e80ce={'count':0x0,'rows':[]};var _0x86b954=_['map'](db[_0x5596('0x2a')][_0x5596('0x2b')],function(_0x1623ca){return{'name':_0x1623ca[_0x5596('0x2c')],'type':_0x1623ca[_0x5596('0x2d')][_0x5596('0x2e')]};});_0x665dc0[_0x5596('0x2f')]=_[_0x5596('0x30')](_0x86b954,'name');_0x665dc0['query']=_[_0x5596('0x31')](_0x27d975['query']);_0x665dc0[_0x5596('0x32')]=_[_0x5596('0x33')](_0x665dc0[_0x5596('0x2f')],_0x665dc0[_0x5596('0x34')]);_0x582f88[_0x5596('0x35')]=_['intersection'](_0x665dc0[_0x5596('0x2f')],qs['fields'](_0x27d975[_0x5596('0x34')][_0x5596('0x36')]));_0x582f88[_0x5596('0x35')]=_0x582f88[_0x5596('0x35')][_0x5596('0x37')]?_0x582f88['attributes']:_0x665dc0['model'];if(!_0x27d975[_0x5596('0x34')][_0x5596('0x38')](_0x5596('0x39'))){_0x582f88[_0x5596('0x1c')]=qs[_0x5596('0x1c')](_0x27d975[_0x5596('0x34')][_0x5596('0x1c')]);_0x582f88['offset']=qs['offset'](_0x27d975[_0x5596('0x34')][_0x5596('0x1e')]);}_0x582f88[_0x5596('0x3a')]=qs['sort'](_0x27d975[_0x5596('0x34')][_0x5596('0x3b')]);_0x582f88['where']=qs[_0x5596('0x32')](_[_0x5596('0x3c')](_0x27d975[_0x5596('0x34')],_0x665dc0['filters']),_0x86b954);if(_0x27d975[_0x5596('0x34')][_0x5596('0x3d')]){_0x582f88[_0x5596('0x3e')]=_[_0x5596('0x3f')](_0x582f88['where'],{'$or':_[_0x5596('0x30')](_0x86b954,function(_0x56796b){if(_0x56796b[_0x5596('0x2d')]!==_0x5596('0x40')){var _0x3c9f76={};_0x3c9f76[_0x56796b[_0x5596('0x27')]]={'$like':'%'+_0x27d975[_0x5596('0x34')][_0x5596('0x3d')]+'%'};return _0x3c9f76;}})});}_0x582f88=_[_0x5596('0x3f')]({},_0x582f88,_0x27d975[_0x5596('0x41')]);var _0x5b98e9={'where':_0x582f88[_0x5596('0x3e')]};return db[_0x5596('0x2a')][_0x5596('0x1d')](_0x5b98e9)[_0x5596('0x24')](function(_0x42ca4d){_0x4e80ce[_0x5596('0x1d')]=_0x42ca4d;if(_0x27d975[_0x5596('0x34')][_0x5596('0x42')]){_0x582f88[_0x5596('0x43')]=[{'all':!![]}];}return db['SalesforceField'][_0x5596('0x44')](_0x582f88);})['then'](function(_0x5b1764){_0x4e80ce[_0x5596('0x45')]=_0x5b1764;return _0x4e80ce;})[_0x5596('0x24')](respondWithFilteredResult(_0x1794f7,_0x582f88))[_0x5596('0x46')](handleError(_0x1794f7,null));};exports['show']=function(_0x13faa5,_0x63120){var _0x593c7c={'raw':!![],'where':{'id':_0x13faa5[_0x5596('0x47')]['id']}},_0x4da1e8={};_0x4da1e8[_0x5596('0x2f')]=_[_0x5596('0x31')](db[_0x5596('0x2a')][_0x5596('0x2b')]);_0x4da1e8[_0x5596('0x34')]=_[_0x5596('0x31')](_0x13faa5[_0x5596('0x34')]);_0x4da1e8[_0x5596('0x32')]=_[_0x5596('0x33')](_0x4da1e8[_0x5596('0x2f')],_0x4da1e8[_0x5596('0x34')]);_0x593c7c[_0x5596('0x35')]=_[_0x5596('0x33')](_0x4da1e8[_0x5596('0x2f')],qs[_0x5596('0x36')](_0x13faa5[_0x5596('0x34')][_0x5596('0x36')]));_0x593c7c[_0x5596('0x35')]=_0x593c7c[_0x5596('0x35')][_0x5596('0x37')]?_0x593c7c[_0x5596('0x35')]:_0x4da1e8[_0x5596('0x2f')];if(_0x13faa5[_0x5596('0x34')][_0x5596('0x42')]){_0x593c7c[_0x5596('0x43')]=[{'all':!![]}];}_0x593c7c=_[_0x5596('0x3f')]({},_0x593c7c,_0x13faa5[_0x5596('0x41')]);return db[_0x5596('0x2a')][_0x5596('0x48')](_0x593c7c)[_0x5596('0x24')](handleEntityNotFound(_0x63120,null))[_0x5596('0x24')](respondWithResult(_0x63120,null))['catch'](handleError(_0x63120,null));};exports[_0x5596('0x49')]=function(_0x331b0c,_0x355c9a){return db[_0x5596('0x2a')][_0x5596('0x49')](_0x331b0c[_0x5596('0x4a')],{})[_0x5596('0x24')](respondWithResult(_0x355c9a,0xc9))[_0x5596('0x46')](handleError(_0x355c9a,null));};exports['update']=function(_0x411012,_0x3a900d){if(_0x411012[_0x5596('0x4a')]['id']){delete _0x411012[_0x5596('0x4a')]['id'];}return db[_0x5596('0x2a')][_0x5596('0x48')]({'where':{'id':_0x411012[_0x5596('0x47')]['id']}})[_0x5596('0x24')](handleEntityNotFound(_0x3a900d,null))[_0x5596('0x24')](saveUpdates(_0x411012[_0x5596('0x4a')],null))[_0x5596('0x24')](respondWithResult(_0x3a900d,null))[_0x5596('0x46')](handleError(_0x3a900d,null));};exports[_0x5596('0x23')]=function(_0x10fee7,_0x387cc5){return db[_0x5596('0x2a')][_0x5596('0x48')]({'where':{'id':_0x10fee7[_0x5596('0x47')]['id']}})[_0x5596('0x24')](handleEntityNotFound(_0x387cc5,null))['then'](removeEntity(_0x387cc5,null))[_0x5596('0x46')](handleError(_0x387cc5,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index e0adb04..1c09d52 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 _0xf6f0=['api','bluebird','path','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','util','../../config/logger'];(function(_0x185a96,_0x54c5b4){var _0x1363a2=function(_0x1522ca){while(--_0x1522ca){_0x185a96['push'](_0x185a96['shift']());}};_0x1363a2(++_0x54c5b4);}(_0xf6f0,0x8a));var _0x0f6f=function(_0xf52342,_0x2e9017){_0xf52342=_0xf52342-0x0;var _0x120899=_0xf6f0[_0xf52342];return _0x120899;};'use strict';var _=require('lodash');var util=require(_0x0f6f('0x0'));var logger=require(_0x0f6f('0x1'))(_0x0f6f('0x2'));var moment=require('moment');var BPromise=require(_0x0f6f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f6f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0f6f('0x5'));module[_0x0f6f('0x6')]=function(_0x355953,_0x1bc9b9){return _0x355953[_0x0f6f('0x7')]('SalesforceField',attributes,{'tableName':_0x0f6f('0x8'),'paranoid':![],'indexes':[{'name':_0x0f6f('0x9'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0c34=['define','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x355ff0,_0x5a555e){var _0x1dcf16=function(_0x3f0804){while(--_0x3f0804){_0x355ff0['push'](_0x355ff0['shift']());}};_0x1dcf16(++_0x5a555e);}(_0x0c34,0x17c));var _0x40c3=function(_0x54d0a8,_0xf7ddbf){_0x54d0a8=_0x54d0a8-0x0;var _0x17f18e=_0x0c34[_0x54d0a8];return _0x17f18e;};'use strict';var _=require(_0x40c3('0x0'));var util=require(_0x40c3('0x1'));var logger=require(_0x40c3('0x2'))(_0x40c3('0x3'));var moment=require(_0x40c3('0x4'));var BPromise=require('bluebird');var rp=require(_0x40c3('0x5'));var fs=require('fs');var path=require(_0x40c3('0x6'));var rimraf=require(_0x40c3('0x7'));var config=require(_0x40c3('0x8'));var attributes=require(_0x40c3('0x9'));module['exports']=function(_0x286a2b,_0x49919e){return _0x286a2b[_0x40c3('0xa')]('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x40c3('0xb'),'fields':['idField',_0x40c3('0xc')],'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 abb429f..6845dc8 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 _0xd3c8=['lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','catch'];(function(_0x400f0a,_0x121854){var _0x443f2c=function(_0x163248){while(--_0x163248){_0x400f0a['push'](_0x400f0a['shift']());}};_0x443f2c(++_0x121854);}(_0xd3c8,0x1e3));var _0x8d3c=function(_0x4385f7,_0x5216d3){_0x4385f7=_0x4385f7-0x0;var _0x3de099=_0xd3c8[_0x4385f7];return _0x3de099;};'use strict';var _=require(_0x8d3c('0x0'));var util=require('util');var moment=require(_0x8d3c('0x1'));var BPromise=require('bluebird');var rs=require(_0x8d3c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8d3c('0x3'));var logger=require(_0x8d3c('0x4'))(_0x8d3c('0x5'));var config=require(_0x8d3c('0x6'));var jayson=require(_0x8d3c('0x7'));var client=jayson[_0x8d3c('0x8')][_0x8d3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x276573,_0x4bd7ff,_0x10a034){return new BPromise(function(_0xd55825,_0x7294c){return client[_0x8d3c('0xa')](_0x276573,_0x10a034)[_0x8d3c('0xb')](function(_0x3ac77d){logger[_0x8d3c('0xc')]('SalesforceField,\x20%s,\x20%s',_0x4bd7ff,_0x8d3c('0xd'));logger['debug'](_0x8d3c('0xe'),_0x4bd7ff,_0x8d3c('0xd'),JSON[_0x8d3c('0xf')](_0x3ac77d));if(_0x3ac77d[_0x8d3c('0x10')]){if(_0x3ac77d[_0x8d3c('0x10')][_0x8d3c('0x11')]===0x1f4){logger[_0x8d3c('0x10')](_0x8d3c('0x12'),_0x4bd7ff,_0x3ac77d[_0x8d3c('0x10')][_0x8d3c('0x13')]);return _0x7294c(_0x3ac77d[_0x8d3c('0x10')][_0x8d3c('0x13')]);}logger[_0x8d3c('0x10')](_0x8d3c('0x12'),_0x4bd7ff,_0x3ac77d['error'][_0x8d3c('0x13')]);return _0xd55825(_0x3ac77d['error'][_0x8d3c('0x13')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x4bd7ff,'request\x20sent');_0xd55825(_0x3ac77d['result'][_0x8d3c('0x13')]);}})[_0x8d3c('0x14')](function(_0x5e206a){logger[_0x8d3c('0x10')](_0x8d3c('0x12'),_0x4bd7ff,_0x5e206a);_0x7294c(_0x5e206a);});});} \ No newline at end of file +var _0x6841=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','SalesforceField,\x20%s,\x20%s'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0x6841,0x80));var _0x1684=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x6841[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x1684('0x0'));var util=require(_0x1684('0x1'));var moment=require('moment');var BPromise=require(_0x1684('0x2'));var rs=require(_0x1684('0x3'));var fs=require('fs');var Redis=require(_0x1684('0x4'));var db=require(_0x1684('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1684('0x6'));var config=require('../../config/environment');var jayson=require(_0x1684('0x7'));var client=jayson[_0x1684('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13c546,_0x402fac,_0x4d78e3){return new BPromise(function(_0x335bbe,_0x2f1f88){return client[_0x1684('0x9')](_0x13c546,_0x4d78e3)[_0x1684('0xa')](function(_0x18ead7){logger['info'](_0x1684('0xb'),_0x402fac,_0x1684('0xc'));logger[_0x1684('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x402fac,_0x1684('0xc'),JSON[_0x1684('0xe')](_0x18ead7));if(_0x18ead7[_0x1684('0xf')]){if(_0x18ead7[_0x1684('0xf')][_0x1684('0x10')]===0x1f4){logger[_0x1684('0xf')](_0x1684('0xb'),_0x402fac,_0x18ead7[_0x1684('0xf')]['message']);return _0x2f1f88(_0x18ead7[_0x1684('0xf')][_0x1684('0x11')]);}logger[_0x1684('0xf')](_0x1684('0xb'),_0x402fac,_0x18ead7[_0x1684('0xf')][_0x1684('0x11')]);return _0x335bbe(_0x18ead7[_0x1684('0xf')][_0x1684('0x11')]);}else{logger['info'](_0x1684('0xb'),_0x402fac,_0x1684('0xc'));_0x335bbe(_0x18ead7[_0x1684('0x12')]['message']);}})[_0x1684('0x13')](function(_0x121957){logger[_0x1684('0xf')](_0x1684('0xb'),_0x402fac,_0x121957);_0x2f1f88(_0x121957);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 1480b1d..031fb10 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 _0x70c7=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','update','delete','destroy','exports','multer','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x70c7,0x18e));var _0x770c=function(_0x1cea95,_0xf8cb0a){_0x1cea95=_0x1cea95-0x0;var _0x19a62a=_0x70c7[_0x1cea95];return _0x19a62a;};'use strict';var multer=require(_0x770c('0x0'));var util=require(_0x770c('0x1'));var path=require(_0x770c('0x2'));var timeout=require(_0x770c('0x3'));var express=require(_0x770c('0x4'));var router=express['Router']();var fs_extra=require(_0x770c('0x5'));var auth=require(_0x770c('0x6'));var interaction=require(_0x770c('0x7'));var config=require(_0x770c('0x8'));var controller=require(_0x770c('0x9'));router[_0x770c('0xa')]('/',auth[_0x770c('0xb')](),controller['index']);router[_0x770c('0xa')](_0x770c('0xc'),auth[_0x770c('0xb')](),controller[_0x770c('0xd')]);router['get'](_0x770c('0xe'),auth[_0x770c('0xb')](),controller[_0x770c('0xf')]);router[_0x770c('0xa')](_0x770c('0x10'),auth[_0x770c('0xb')](),controller[_0x770c('0x11')]);router['post']('/',auth[_0x770c('0xb')](),controller[_0x770c('0x12')]);router[_0x770c('0x13')](_0x770c('0xe'),auth[_0x770c('0xb')](),controller['addConfiguration']);router[_0x770c('0x14')]('/:id',auth[_0x770c('0xb')](),controller[_0x770c('0x15')]);router[_0x770c('0x16')]('/:id',auth[_0x770c('0xb')](),controller[_0x770c('0x17')]);module[_0x770c('0x18')]=router; \ No newline at end of file +var _0x58df=['post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','getConfigurations','getFields'];(function(_0x5be5f9,_0x327830){var _0x2c8e64=function(_0x972432){while(--_0x972432){_0x5be5f9['push'](_0x5be5f9['shift']());}};_0x2c8e64(++_0x327830);}(_0x58df,0xb2));var _0xf58d=function(_0x41382e,_0x5d4d1a){_0x41382e=_0x41382e-0x0;var _0x4be918=_0x58df[_0x41382e];return _0x4be918;};'use strict';var multer=require(_0xf58d('0x0'));var util=require('util');var path=require(_0xf58d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf58d('0x2')]();var fs_extra=require(_0xf58d('0x3'));var auth=require(_0xf58d('0x4'));var interaction=require(_0xf58d('0x5'));var config=require(_0xf58d('0x6'));var controller=require(_0xf58d('0x7'));router[_0xf58d('0x8')]('/',auth[_0xf58d('0x9')](),controller[_0xf58d('0xa')]);router['get']('/:id',auth[_0xf58d('0x9')](),controller[_0xf58d('0xb')]);router[_0xf58d('0x8')]('/:id/configurations',auth[_0xf58d('0x9')](),controller[_0xf58d('0xc')]);router[_0xf58d('0x8')]('/:id/fields',auth[_0xf58d('0x9')](),controller[_0xf58d('0xd')]);router[_0xf58d('0xe')]('/',auth[_0xf58d('0x9')](),controller[_0xf58d('0xf')]);router['post'](_0xf58d('0x10'),auth[_0xf58d('0x9')](),controller[_0xf58d('0x11')]);router[_0xf58d('0x12')](_0xf58d('0x13'),auth['isAuthenticated'](),controller[_0xf58d('0x14')]);router[_0xf58d('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xf58d('0x16')]);module[_0xf58d('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index ae8727f..f730140 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 _0xedc0=['username','remoteUri','sequelize','exports','STRING'];(function(_0x241f6b,_0x2af41b){var _0xfa096f=function(_0x424537){while(--_0x424537){_0x241f6b['push'](_0x241f6b['shift']());}};_0xfa096f(++_0x2af41b);}(_0xedc0,0x115));var _0x0edc=function(_0x5db569,_0x25707b){_0x5db569=_0x5db569-0x0;var _0x247b44=_0xedc0[_0x5db569];return _0x247b44;};'use strict';var Sequelize=require(_0x0edc('0x0'));module[_0x0edc('0x1')]={'name':{'type':Sequelize[_0x0edc('0x2')]},'description':{'type':Sequelize[_0x0edc('0x2')]},'username':{'type':Sequelize[_0x0edc('0x2')],'unique':_0x0edc('0x3')},'password':{'type':Sequelize[_0x0edc('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x0edc('0x4')},'serverUrl':{'type':Sequelize[_0x0edc('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x89a2=['username','remoteUri','sequelize','exports','STRING'];(function(_0x422797,_0x4379b7){var _0x4f8a67=function(_0x3a258f){while(--_0x3a258f){_0x422797['push'](_0x422797['shift']());}};_0x4f8a67(++_0x4379b7);}(_0x89a2,0x89));var _0x289a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x89a2[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x289a('0x0'));module[_0x289a('0x1')]={'name':{'type':Sequelize[_0x289a('0x2')]},'description':{'type':Sequelize[_0x289a('0x2')]},'username':{'type':Sequelize[_0x289a('0x2')],'unique':_0x289a('0x3')},'password':{'type':Sequelize[_0x289a('0x2')]},'email':{'type':Sequelize[_0x289a('0x2')]},'remoteUri':{'type':Sequelize[_0x289a('0x2')],'unique':_0x289a('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index b2b965a..7d8da62 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 _0xee5c=['type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','includeAll','include','rows','catch','show','options','find','create','body','params','getConfigurations','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','made_sla','caused_by','watch_list','sys_updated_on','child_incidents','resolved_by','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','rfc','time_worked','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','contact_type','reopened_by','urgency','company','reassignment_count','assigned_to','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','upon_approval','correlation_id','location','username','password','email','serverUrl','remoteUri','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','log','TCL:\x20_object','concat','statusCode','Wrong\x20credentials','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','push','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','map','ServicenowAccount','rawAttributes','fieldName'];(function(_0x14cbc9,_0x2df49e){var _0x42c5b3=function(_0xf003b7){while(--_0xf003b7){_0x14cbc9['push'](_0x14cbc9['shift']());}};_0x42c5b3(++_0x2df49e);}(_0xee5c,0x1ec));var _0xcee5=function(_0x3ab353,_0x5d5283){_0x3ab353=_0x3ab353-0x0;var _0x1e2285=_0xee5c[_0x3ab353];return _0x1e2285;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcee5('0x0'));var zipdir=require(_0xcee5('0x1'));var jsonpatch=require(_0xcee5('0x2'));var rp=require(_0xcee5('0x3'));var moment=require(_0xcee5('0x4'));var BPromise=require(_0xcee5('0x5'));var Mustache=require(_0xcee5('0x6'));var util=require(_0xcee5('0x7'));var path=require('path');var sox=require(_0xcee5('0x8'));var csv=require(_0xcee5('0x9'));var ejs=require(_0xcee5('0xa'));var fs=require('fs');var fs_extra=require(_0xcee5('0xb'));var _=require('lodash');var squel=require(_0xcee5('0xc'));var crypto=require(_0xcee5('0xd'));var jsforce=require(_0xcee5('0xe'));var deskjs=require(_0xcee5('0xf'));var toCsv=require(_0xcee5('0x9'));var querystring=require(_0xcee5('0x10'));var Papa=require(_0xcee5('0x11'));var Redis=require(_0xcee5('0x12'));var authService=require(_0xcee5('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcee5('0x14'));var logger=require(_0xcee5('0x15'))(_0xcee5('0x16'));var utils=require('../../config/utils');var config=require(_0xcee5('0x17'));var licenseUtil=require(_0xcee5('0x18'));var db=require(_0xcee5('0x19'))['db'];var integrations=require(_0xcee5('0x1a'));function respondWithStatusCode(_0x488ad7,_0x2ba382){_0x2ba382=_0x2ba382||0xcc;return function(_0x199cb2){if(_0x199cb2){return _0x488ad7['sendStatus'](_0x2ba382);}return _0x488ad7[_0xcee5('0x1b')](_0x2ba382)['end']();};}function respondWithResult(_0x3f64c2,_0x182af2){_0x182af2=_0x182af2||0xc8;return function(_0x4320eb){if(_0x4320eb){return _0x3f64c2[_0xcee5('0x1b')](_0x182af2)[_0xcee5('0x1c')](_0x4320eb);}};}function respondWithFilteredResult(_0x13453a,_0x10ae0c){return function(_0x3f3318){if(_0x3f3318){var _0x1b8cae=typeof _0x10ae0c['offset']==='undefined'&&typeof _0x10ae0c[_0xcee5('0x1d')]===_0xcee5('0x1e');var _0x20048c=_0x3f3318[_0xcee5('0x1f')];var _0x41805f=_0x1b8cae?0x0:_0x10ae0c[_0xcee5('0x20')];var _0x2fcbc0=_0x1b8cae?_0x3f3318['count']:_0x10ae0c['offset']+_0x10ae0c['limit'];var _0x2bc9a5;if(_0x2fcbc0>=_0x20048c){_0x2fcbc0=_0x20048c;_0x2bc9a5=0xc8;}else{_0x2bc9a5=0xce;}_0x13453a[_0xcee5('0x1b')](_0x2bc9a5);return _0x13453a[_0xcee5('0x21')](_0xcee5('0x22'),_0x41805f+'-'+_0x2fcbc0+'/'+_0x20048c)[_0xcee5('0x1c')](_0x3f3318);}return null;};}function patchUpdates(_0x3ccc4d){return function(_0xa8d8d1){try{jsonpatch[_0xcee5('0x23')](_0xa8d8d1,_0x3ccc4d,!![]);}catch(_0x263770){return BPromise['reject'](_0x263770);}return _0xa8d8d1[_0xcee5('0x24')]();};}function saveUpdates(_0x362d09,_0x53bb38){return function(_0x2f9978){if(_0x2f9978){return _0x2f9978[_0xcee5('0x25')](_0x362d09)[_0xcee5('0x26')](function(_0x50b9a9){return _0x50b9a9;});}return null;};}function removeEntity(_0x376aef,_0x10f354){return function(_0x38ca72){if(_0x38ca72){return _0x38ca72[_0xcee5('0x27')]()[_0xcee5('0x26')](function(){_0x376aef['status'](0xcc)[_0xcee5('0x28')]();});}};}function handleEntityNotFound(_0x7310ce,_0x134888){return function(_0x219b8b){if(!_0x219b8b){_0x7310ce['sendStatus'](0x194);}return _0x219b8b;};}function handleError(_0x1d28f4,_0x3b131a){_0x3b131a=_0x3b131a||0x1f4;return function(_0x360cea){logger[_0xcee5('0x29')](_0x360cea['stack']);if(_0x360cea[_0xcee5('0x2a')]){delete _0x360cea[_0xcee5('0x2a')];}_0x1d28f4[_0xcee5('0x1b')](_0x3b131a)[_0xcee5('0x2b')](_0x360cea);};}exports['index']=function(_0x479334,_0x10249e){var _0x102d3e={},_0x5ed4e3={},_0x573967={'count':0x0,'rows':[]};var _0x1c0ac5=_[_0xcee5('0x2c')](db[_0xcee5('0x2d')][_0xcee5('0x2e')],function(_0x395a0b){return{'name':_0x395a0b[_0xcee5('0x2f')],'type':_0x395a0b[_0xcee5('0x30')][_0xcee5('0x31')]};});_0x5ed4e3[_0xcee5('0x32')]=_['map'](_0x1c0ac5,_0xcee5('0x2a'));_0x5ed4e3[_0xcee5('0x33')]=_[_0xcee5('0x34')](_0x479334[_0xcee5('0x33')]);_0x5ed4e3[_0xcee5('0x35')]=_[_0xcee5('0x36')](_0x5ed4e3[_0xcee5('0x32')],_0x5ed4e3[_0xcee5('0x33')]);_0x102d3e['attributes']=_[_0xcee5('0x36')](_0x5ed4e3['model'],qs[_0xcee5('0x37')](_0x479334['query']['fields']));_0x102d3e[_0xcee5('0x38')]=_0x102d3e['attributes'][_0xcee5('0x39')]?_0x102d3e[_0xcee5('0x38')]:_0x5ed4e3['model'];if(!_0x479334['query'][_0xcee5('0x3a')](_0xcee5('0x3b'))){_0x102d3e[_0xcee5('0x1d')]=qs[_0xcee5('0x1d')](_0x479334[_0xcee5('0x33')]['limit']);_0x102d3e[_0xcee5('0x20')]=qs[_0xcee5('0x20')](_0x479334[_0xcee5('0x33')][_0xcee5('0x20')]);}_0x102d3e[_0xcee5('0x3c')]=qs[_0xcee5('0x3d')](_0x479334[_0xcee5('0x33')][_0xcee5('0x3d')]);_0x102d3e['where']=qs[_0xcee5('0x35')](_[_0xcee5('0x3e')](_0x479334['query'],_0x5ed4e3[_0xcee5('0x35')]),_0x1c0ac5);if(_0x479334[_0xcee5('0x33')]['filter']){_0x102d3e[_0xcee5('0x3f')]=_['merge'](_0x102d3e['where'],{'$or':_[_0xcee5('0x2c')](_0x1c0ac5,function(_0x1b6239){if(_0x1b6239[_0xcee5('0x30')]!=='VIRTUAL'){var _0x2e6130={};_0x2e6130[_0x1b6239[_0xcee5('0x2a')]]={'$like':'%'+_0x479334[_0xcee5('0x33')][_0xcee5('0x40')]+'%'};return _0x2e6130;}})});}_0x102d3e=_[_0xcee5('0x41')]({},_0x102d3e,_0x479334['options']);var _0x1bc9e6={'where':_0x102d3e[_0xcee5('0x3f')]};return db[_0xcee5('0x2d')][_0xcee5('0x1f')](_0x1bc9e6)[_0xcee5('0x26')](function(_0x308740){_0x573967[_0xcee5('0x1f')]=_0x308740;if(_0x479334[_0xcee5('0x33')][_0xcee5('0x42')]){_0x102d3e[_0xcee5('0x43')]=[{'all':!![]}];}return db[_0xcee5('0x2d')]['findAll'](_0x102d3e);})[_0xcee5('0x26')](function(_0x1b5163){_0x573967[_0xcee5('0x44')]=_0x1b5163;return _0x573967;})[_0xcee5('0x26')](respondWithFilteredResult(_0x10249e,_0x102d3e))[_0xcee5('0x45')](handleError(_0x10249e,null));};exports[_0xcee5('0x46')]=function(_0x2d75a1,_0x2d7be8){var _0x530a19={'raw':![],'where':{'id':_0x2d75a1['params']['id']}},_0x594c54={};_0x594c54[_0xcee5('0x32')]=_[_0xcee5('0x34')](db['ServicenowAccount'][_0xcee5('0x2e')]);_0x594c54[_0xcee5('0x33')]=_['keys'](_0x2d75a1[_0xcee5('0x33')]);_0x594c54[_0xcee5('0x35')]=_[_0xcee5('0x36')](_0x594c54[_0xcee5('0x32')],_0x594c54[_0xcee5('0x33')]);_0x530a19[_0xcee5('0x38')]=_[_0xcee5('0x36')](_0x594c54[_0xcee5('0x32')],qs['fields'](_0x2d75a1[_0xcee5('0x33')][_0xcee5('0x37')]));_0x530a19['attributes']=_0x530a19[_0xcee5('0x38')]['length']?_0x530a19[_0xcee5('0x38')]:_0x594c54[_0xcee5('0x32')];if(_0x2d75a1['query'][_0xcee5('0x42')]){_0x530a19[_0xcee5('0x43')]=[{'all':!![]}];}_0x530a19=_[_0xcee5('0x41')]({},_0x530a19,_0x2d75a1[_0xcee5('0x47')]);return db['ServicenowAccount'][_0xcee5('0x48')](_0x530a19)['then'](handleEntityNotFound(_0x2d7be8,null))[_0xcee5('0x26')](respondWithResult(_0x2d7be8,null))[_0xcee5('0x45')](handleError(_0x2d7be8,null));};exports[_0xcee5('0x49')]=function(_0x2f2748,_0x42e3f1){return db[_0xcee5('0x2d')][_0xcee5('0x49')](_0x2f2748[_0xcee5('0x4a')],{})[_0xcee5('0x26')](respondWithResult(_0x42e3f1,0xc9))['catch'](handleError(_0x42e3f1,null));};exports[_0xcee5('0x25')]=function(_0x148f1d,_0x3f8a30){if(_0x148f1d[_0xcee5('0x4a')]['id']){delete _0x148f1d[_0xcee5('0x4a')]['id'];}return db[_0xcee5('0x2d')]['find']({'where':{'id':_0x148f1d[_0xcee5('0x4b')]['id']}})[_0xcee5('0x26')](handleEntityNotFound(_0x3f8a30,null))[_0xcee5('0x26')](saveUpdates(_0x148f1d[_0xcee5('0x4a')],null))[_0xcee5('0x26')](respondWithResult(_0x3f8a30,null))['catch'](handleError(_0x3f8a30,null));};exports[_0xcee5('0x27')]=function(_0x4e2483,_0x49bba1){return db[_0xcee5('0x2d')][_0xcee5('0x48')]({'where':{'id':_0x4e2483[_0xcee5('0x4b')]['id']}})[_0xcee5('0x26')](handleEntityNotFound(_0x49bba1,null))[_0xcee5('0x26')](removeEntity(_0x49bba1,null))[_0xcee5('0x45')](handleError(_0x49bba1,null));};exports[_0xcee5('0x4c')]=function(_0x157595,_0x158ad9,_0x5c2f8c){var _0x3a20fd={};var _0x257d16={};var _0x1cd079;var _0xddda39;return db[_0xcee5('0x2d')]['findOne']({'where':{'id':_0x157595[_0xcee5('0x4b')]['id']}})[_0xcee5('0x26')](handleEntityNotFound(_0x158ad9,null))['then'](function(_0x42cec2){if(_0x42cec2){_0x1cd079=_0x42cec2;_0x257d16[_0xcee5('0x32')]=_[_0xcee5('0x34')](db['ServicenowConfiguration']['rawAttributes']);_0x257d16['query']=_['keys'](_0x157595['query']);_0x257d16[_0xcee5('0x35')]=_[_0xcee5('0x36')](_0x257d16[_0xcee5('0x32')],_0x257d16[_0xcee5('0x33')]);_0x3a20fd[_0xcee5('0x38')]=_['intersection'](_0x257d16[_0xcee5('0x32')],qs[_0xcee5('0x37')](_0x157595['query'][_0xcee5('0x37')]));_0x3a20fd[_0xcee5('0x38')]=_0x3a20fd['attributes'][_0xcee5('0x39')]?_0x3a20fd[_0xcee5('0x38')]:_0x257d16['model'];_0x3a20fd[_0xcee5('0x3c')]=qs[_0xcee5('0x3d')](_0x157595['query'][_0xcee5('0x3d')]);_0x3a20fd['where']=qs[_0xcee5('0x35')](_['pick'](_0x157595[_0xcee5('0x33')],_0x257d16[_0xcee5('0x35')]));if(_0x157595['query']['filter']){_0x3a20fd[_0xcee5('0x3f')]=_[_0xcee5('0x41')](_0x3a20fd[_0xcee5('0x3f')],{'$or':_['map'](_0x3a20fd['attributes'],function(_0x85e75c){var _0x2f9aa9={};_0x2f9aa9[_0x85e75c]={'$like':'%'+_0x157595[_0xcee5('0x33')][_0xcee5('0x40')]+'%'};return _0x2f9aa9;})});}_0x3a20fd=_[_0xcee5('0x41')]({},_0x3a20fd,_0x157595[_0xcee5('0x47')]);return _0x1cd079[_0xcee5('0x4c')](_0x3a20fd);}})['then'](function(_0x163a1e){if(_0x163a1e){_0xddda39=_0x163a1e[_0xcee5('0x39')];if(!_0x157595[_0xcee5('0x33')][_0xcee5('0x3a')](_0xcee5('0x3b'))){_0x3a20fd[_0xcee5('0x1d')]=qs[_0xcee5('0x1d')](_0x157595[_0xcee5('0x33')][_0xcee5('0x1d')]);_0x3a20fd[_0xcee5('0x20')]=qs[_0xcee5('0x20')](_0x157595['query'][_0xcee5('0x20')]);}return _0x1cd079['getConfigurations'](_0x3a20fd);}})[_0xcee5('0x26')](function(_0x20beef){if(_0x20beef){return _0x20beef?{'count':_0xddda39,'rows':_0x20beef}:null;}})[_0xcee5('0x26')](respondWithResult(_0x158ad9,null))[_0xcee5('0x45')](handleError(_0x158ad9,null));};exports['addConfiguration']=function(_0x5ed8d8,_0x3171de,_0x552f6f){if(_0x5ed8d8[_0xcee5('0x4a')]['id']){delete _0x5ed8d8[_0xcee5('0x4a')]['id'];}return db['ServicenowAccount'][_0xcee5('0x4d')]({'where':{'id':_0x5ed8d8['params']['id']}})[_0xcee5('0x26')](handleEntityNotFound(_0x3171de,null))[_0xcee5('0x26')](function(_0x857c11){if(_0x857c11){_0x5ed8d8['body'][_0xcee5('0x4e')]=_0x857c11['id'];_0x5ed8d8[_0xcee5('0x4a')]['Subjects']=integrations[_0xcee5('0x4f')](_0x5ed8d8['body'][_0xcee5('0x50')],_0x5ed8d8['body'][_0xcee5('0x30')]);_0x5ed8d8[_0xcee5('0x4a')][_0xcee5('0x51')]=integrations[_0xcee5('0x52')](_0x5ed8d8[_0xcee5('0x4a')][_0xcee5('0x50')],_0x5ed8d8['body']['type']);return db['ServicenowConfiguration'][_0xcee5('0x49')](_0x5ed8d8[_0xcee5('0x4a')],{'include':[{'model':db[_0xcee5('0x53')],'as':'Subjects'},{'model':db[_0xcee5('0x53')],'as':_0xcee5('0x51')}]});}return null;})[_0xcee5('0x26')](respondWithResult(_0x3171de,null))[_0xcee5('0x45')](handleError(_0x3171de,null));};exports[_0xcee5('0x54')]=function(_0x3fc88d,_0x1fbefc,_0x2fe483){var _0x140380=['made_sla',_0xcee5('0x55'),_0xcee5('0x56'),_0xcee5('0x57'),_0xcee5('0x58'),_0xcee5('0x59'),_0xcee5('0x5a'),_0xcee5('0x5b'),_0xcee5('0x5c')];var _0x712e8e=['parent',_0xcee5('0x5d'),_0xcee5('0x5e'),_0xcee5('0x5f'),'upon_reject',_0xcee5('0x60'),_0xcee5('0x61'),_0xcee5('0x55'),'approval_history','number',_0xcee5('0x62'),'sys_updated_by','opened_by','user_input',_0xcee5('0x63'),'sys_domain',_0xcee5('0x64'),_0xcee5('0x65'),_0xcee5('0x56'),'order',_0xcee5('0x66'),_0xcee5('0x67'),_0xcee5('0x68'),_0xcee5('0x69'),_0xcee5('0x6a'),'active',_0xcee5('0x6b'),_0xcee5('0x6c'),_0xcee5('0x6d'),'sys_domain_path',_0xcee5('0x6e'),_0xcee5('0x6f'),'expected_start',_0xcee5('0x70'),_0xcee5('0x71'),_0xcee5('0x72'),_0xcee5('0x73'),'reopened_time',_0xcee5('0x74'),_0xcee5('0x75'),_0xcee5('0x76'),_0xcee5('0x57'),_0xcee5('0x77'),_0xcee5('0x78'),_0xcee5('0x58'),_0xcee5('0x79'),_0xcee5('0x7a'),_0xcee5('0x7b'),_0xcee5('0x7c'),_0xcee5('0x7d'),'additional_assignee_list',_0xcee5('0x7e'),_0xcee5('0x7f'),_0xcee5('0x59'),_0xcee5('0x80'),_0xcee5('0x81'),_0xcee5('0x82'),_0xcee5('0x83'),_0xcee5('0x84'),'sys_id',_0xcee5('0x85'),_0xcee5('0x86'),_0xcee5('0x5a'),_0xcee5('0x87'),'problem_id',_0xcee5('0x88'),_0xcee5('0x89'),'activity_due',_0xcee5('0x8a'),_0xcee5('0x5b'),'comments','sla_due',_0xcee5('0x8b'),_0xcee5('0x8c'),_0xcee5('0x8d'),_0xcee5('0x8e'),'reopen_count',_0xcee5('0x8f'),'escalation',_0xcee5('0x90'),_0xcee5('0x91'),_0xcee5('0x92'),_0xcee5('0x5c')];var _0x4ab526='';var _0x453f74='';var _0x11ac50=[];var _0x56781b='';var _0x21833a='';var _0x4266f5=[];var _0x254e7a='';var _0x4089e8='';var _0xa64968={};var _0x21c9b9='';return db['ServicenowAccount'][_0xcee5('0x4d')]({'where':{'id':_0x3fc88d[_0xcee5('0x4b')]['id']},'attributes':['id',_0xcee5('0x93'),_0xcee5('0x94'),_0xcee5('0x95'),'remoteUri',_0xcee5('0x96')]})[_0xcee5('0x26')](handleEntityNotFound(_0x1fbefc,null))['then'](function(_0x244759){if(_0x244759){_0x21c9b9=_0x244759[_0xcee5('0x97')];var _0x711245=_0x21c9b9['slice'](-0x1);if(_0x711245==='/'){_0x21c9b9=_0x21c9b9[_0xcee5('0x98')](0x0,_0x21c9b9['lastIndexOf'](_0x711245));}_0x4089e8=util[_0xcee5('0x99')](_0xcee5('0x9a'),_0x21c9b9);_0x254e7a=util[_0xcee5('0x99')](_0xcee5('0x9b'),_0x21c9b9);_0xa64968={'user':_0x244759['username'],'pass':_0x244759[_0xcee5('0x94')]};var _0x2b5a4f={'method':_0xcee5('0x9c'),'uri':_0x4089e8+_0xcee5('0x9d'),'auth':_0xa64968,'json':!![]};return rp(_0x2b5a4f);}})[_0xcee5('0x26')](function(_0x236675){if(_0x236675[_0xcee5('0x9e')][_0xcee5('0x39')]>0x0){_0x4ab526=_0x236675[_0xcee5('0x9e')];}console['log'](_0xcee5('0x9f'),_0x4ab526);_0x4266f5=[];_0x453f74=Object[_0xcee5('0xa0')]([],_0x4ab526);_[_0xcee5('0xa1')](_0x453f74,function(_0x4059cb){return!_0x140380[_0xcee5('0xa2')](_0x4059cb[_0xcee5('0x2a')]);});_0x453f74[_0xcee5('0xa3')](function(_0x1563c7){var _0x3b750e=createFieldObject(_0x254e7a,_0xa64968,_0x1563c7[_0xcee5('0xa4')],_0x1563c7['name'],_0x1563c7[_0xcee5('0xa5')],![]);_0x4266f5['push'](_0x3b750e);});return Promise[_0xcee5('0xa6')](_0x4266f5);})[_0xcee5('0x26')](function(_0x4c73b2){_0x11ac50=_0x4c73b2;_0x56781b=Object['assign']([],_0x4ab526);console[_0xcee5('0xa7')](_0xcee5('0xa8'),_0x4ab526);_[_0xcee5('0xa1')](_0x56781b,function(_0x1db86d){return _0x712e8e['includes'](_0x1db86d[_0xcee5('0x2a')]);});console[_0xcee5('0xa7')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x56781b);_0x4266f5=[];_0x56781b[_0xcee5('0xa3')](function(_0x15a570){var _0x348be3=createFieldObject(_0x254e7a,_0xa64968,_0x15a570[_0xcee5('0xa4')],_0x15a570[_0xcee5('0x2a')],_0x15a570[_0xcee5('0xa5')],!![]);_0x4266f5['push'](_0x348be3);});return Promise[_0xcee5('0xa6')](_0x4266f5);})['then'](function(_0x8cac97){_0x21833a=_0x8cac97;var _0x1419e9=_0x11ac50[_0xcee5('0xa9')](_0x21833a);return{'count':_0x1419e9[_0xcee5('0x39')],'rows':_0x1419e9};})[_0xcee5('0x26')](respondWithResult(_0x1fbefc,null))[_0xcee5('0x45')](function(_0x5eebe3){console[_0xcee5('0xa7')]('ServiceNow\x20error:\x20'+_0x5eebe3);var _0x5235fc=_0x3fc88d[_0xcee5('0x33')]['test']?0x1f4:_0x5eebe3[_0xcee5('0xaa')]||0x1f4;logger[_0xcee5('0x29')](_0x5eebe3['stack']);delete _0x5eebe3[_0xcee5('0x2a')];if(_0x5235fc===0x191){_0x5235fc=0x190;}_0x1fbefc[_0xcee5('0x1b')](_0x5235fc)[_0xcee5('0x2b')](_0x3fc88d['query']['test']?{'message':_0xcee5('0xab'),'statusCode':_0x5eebe3[_0xcee5('0xaa')]}:_0x5eebe3);});};function createFieldObject(_0x19e16b,_0x4f8625,_0x2e1f84,_0x5bb4db,_0x51307e,_0x1881ba){return new Promise(function(_0x454721,_0x1a505b){var _0xde2c35={'id':_0x5bb4db,'name':_0x51307e,'custom':_0x1881ba};if(_0x2e1f84===_0xcee5('0xac')){_0xde2c35[_0xcee5('0x47')]=[{'name':_0xcee5('0xad'),'value':_0xcee5('0xae')},{'name':'False','value':_0xcee5('0xaf')}];_0x454721(_0xde2c35);}else{var _0xcf772e={'method':_0xcee5('0x9c'),'uri':_0x19e16b+_0xcee5('0xb0')+_0x5bb4db,'auth':_0x4f8625,'json':!![]};return rp(_0xcf772e)['then'](function(_0x4b8447){var _0x1187c9=[];if(_0x4b8447[_0xcee5('0x9e')][_0xcee5('0x39')]>0x0){_0x4b8447[_0xcee5('0x9e')][_0xcee5('0xa3')](function(_0x51f04a){if(_0x51f04a[_0xcee5('0xb1')]===_0xcee5('0xaf')){var _0x39f5a1={'name':_0x51f04a[_0xcee5('0xa5')],'value':_0x51f04a[_0xcee5('0xb2')]};_0x1187c9[_0xcee5('0xb3')](_0x39f5a1);}});}_0xde2c35[_0xcee5('0x47')]=_0x1187c9;if(_0xde2c35[_0xcee5('0x47')]['length']>0x0){_0x454721(_0xde2c35);}else{if(_0x1881ba==![]){_0x454721();}else{_0x454721(_0xde2c35);}}});}});} \ No newline at end of file +var _0x27ed=['options','includeAll','include','findAll','rows','catch','find','create','body','update','params','getConfigurations','ServicenowConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','subcategory','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','close_code','correlation_display','work_start','business_stc','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','contact_type','reopened_by','urgency','company','reassignment_count','assigned_to','severity','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','forEach','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','ServiceNow\x20error:\x20','test','statusCode','error','Wrong\x20credentials','boolean','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge'];(function(_0x3805ab,_0x20904f){var _0x227191=function(_0x488318){while(--_0x488318){_0x3805ab['push'](_0x3805ab['shift']());}};_0x227191(++_0x20904f);}(_0x27ed,0x13a));var _0xd27e=function(_0x3ceb0a,_0x4bad2d){_0x3ceb0a=_0x3ceb0a-0x0;var _0x80ce2f=_0x27ed[_0x3ceb0a];return _0x80ce2f;};'use strict';var emlformat=require(_0xd27e('0x0'));var rimraf=require(_0xd27e('0x1'));var zipdir=require(_0xd27e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd27e('0x3'));var moment=require(_0xd27e('0x4'));var BPromise=require(_0xd27e('0x5'));var Mustache=require(_0xd27e('0x6'));var util=require(_0xd27e('0x7'));var path=require(_0xd27e('0x8'));var sox=require('sox');var csv=require(_0xd27e('0x9'));var ejs=require(_0xd27e('0xa'));var fs=require('fs');var fs_extra=require(_0xd27e('0xb'));var _=require(_0xd27e('0xc'));var squel=require(_0xd27e('0xd'));var crypto=require(_0xd27e('0xe'));var jsforce=require(_0xd27e('0xf'));var deskjs=require(_0xd27e('0x10'));var toCsv=require(_0xd27e('0x9'));var querystring=require(_0xd27e('0x11'));var Papa=require('papaparse');var Redis=require(_0xd27e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd27e('0x13'));var as=require(_0xd27e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd27e('0x15'))(_0xd27e('0x16'));var utils=require(_0xd27e('0x17'));var config=require(_0xd27e('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3fd6d9,_0x4bd774){_0x4bd774=_0x4bd774||0xcc;return function(_0x3b302d){if(_0x3b302d){return _0x3fd6d9[_0xd27e('0x19')](_0x4bd774);}return _0x3fd6d9[_0xd27e('0x1a')](_0x4bd774)[_0xd27e('0x1b')]();};}function respondWithResult(_0x3abdac,_0x523662){_0x523662=_0x523662||0xc8;return function(_0x4af11b){if(_0x4af11b){return _0x3abdac[_0xd27e('0x1a')](_0x523662)[_0xd27e('0x1c')](_0x4af11b);}};}function respondWithFilteredResult(_0x506c5a,_0xc5919f){return function(_0x342171){if(_0x342171){var _0x493138=typeof _0xc5919f[_0xd27e('0x1d')]===_0xd27e('0x1e')&&typeof _0xc5919f[_0xd27e('0x1f')]==='undefined';var _0x32b30d=_0x342171['count'];var _0x441e0d=_0x493138?0x0:_0xc5919f[_0xd27e('0x1d')];var _0x543b99=_0x493138?_0x342171[_0xd27e('0x20')]:_0xc5919f['offset']+_0xc5919f[_0xd27e('0x1f')];var _0x2c1100;if(_0x543b99>=_0x32b30d){_0x543b99=_0x32b30d;_0x2c1100=0xc8;}else{_0x2c1100=0xce;}_0x506c5a[_0xd27e('0x1a')](_0x2c1100);return _0x506c5a[_0xd27e('0x21')](_0xd27e('0x22'),_0x441e0d+'-'+_0x543b99+'/'+_0x32b30d)[_0xd27e('0x1c')](_0x342171);}return null;};}function patchUpdates(_0xdc3de3){return function(_0x270dbe){try{jsonpatch['apply'](_0x270dbe,_0xdc3de3,!![]);}catch(_0x2f663e){return BPromise['reject'](_0x2f663e);}return _0x270dbe[_0xd27e('0x23')]();};}function saveUpdates(_0x4328f0,_0x439cf6){return function(_0x11440c){if(_0x11440c){return _0x11440c['update'](_0x4328f0)[_0xd27e('0x24')](function(_0x1baae3){return _0x1baae3;});}return null;};}function removeEntity(_0x62b724,_0x4274f6){return function(_0x3183e4){if(_0x3183e4){return _0x3183e4[_0xd27e('0x25')]()['then'](function(){_0x62b724[_0xd27e('0x1a')](0xcc)[_0xd27e('0x1b')]();});}};}function handleEntityNotFound(_0x53a158,_0x2af7ca){return function(_0x4554f7){if(!_0x4554f7){_0x53a158['sendStatus'](0x194);}return _0x4554f7;};}function handleError(_0x43fcef,_0x13b9ac){_0x13b9ac=_0x13b9ac||0x1f4;return function(_0x5265aa){logger['error'](_0x5265aa[_0xd27e('0x26')]);if(_0x5265aa[_0xd27e('0x27')]){delete _0x5265aa['name'];}_0x43fcef[_0xd27e('0x1a')](_0x13b9ac)[_0xd27e('0x28')](_0x5265aa);};}exports[_0xd27e('0x29')]=function(_0x4d4845,_0x3d3929){var _0x46d9af={},_0x1e4f16={},_0x50c044={'count':0x0,'rows':[]};var _0x2af63a=_[_0xd27e('0x2a')](db[_0xd27e('0x2b')][_0xd27e('0x2c')],function(_0x18b4a4){return{'name':_0x18b4a4[_0xd27e('0x2d')],'type':_0x18b4a4['type']['key']};});_0x1e4f16[_0xd27e('0x2e')]=_[_0xd27e('0x2a')](_0x2af63a,_0xd27e('0x27'));_0x1e4f16[_0xd27e('0x2f')]=_[_0xd27e('0x30')](_0x4d4845['query']);_0x1e4f16[_0xd27e('0x31')]=_[_0xd27e('0x32')](_0x1e4f16[_0xd27e('0x2e')],_0x1e4f16[_0xd27e('0x2f')]);_0x46d9af[_0xd27e('0x33')]=_[_0xd27e('0x32')](_0x1e4f16[_0xd27e('0x2e')],qs[_0xd27e('0x34')](_0x4d4845[_0xd27e('0x2f')][_0xd27e('0x34')]));_0x46d9af[_0xd27e('0x33')]=_0x46d9af[_0xd27e('0x33')][_0xd27e('0x35')]?_0x46d9af['attributes']:_0x1e4f16[_0xd27e('0x2e')];if(!_0x4d4845['query'][_0xd27e('0x36')](_0xd27e('0x37'))){_0x46d9af[_0xd27e('0x1f')]=qs[_0xd27e('0x1f')](_0x4d4845[_0xd27e('0x2f')][_0xd27e('0x1f')]);_0x46d9af['offset']=qs[_0xd27e('0x1d')](_0x4d4845[_0xd27e('0x2f')][_0xd27e('0x1d')]);}_0x46d9af[_0xd27e('0x38')]=qs[_0xd27e('0x39')](_0x4d4845['query'][_0xd27e('0x39')]);_0x46d9af['where']=qs[_0xd27e('0x31')](_[_0xd27e('0x3a')](_0x4d4845[_0xd27e('0x2f')],_0x1e4f16[_0xd27e('0x31')]),_0x2af63a);if(_0x4d4845['query'][_0xd27e('0x3b')]){_0x46d9af[_0xd27e('0x3c')]=_[_0xd27e('0x3d')](_0x46d9af[_0xd27e('0x3c')],{'$or':_[_0xd27e('0x2a')](_0x2af63a,function(_0x209aa6){if(_0x209aa6['type']!=='VIRTUAL'){var _0x16c8c3={};_0x16c8c3[_0x209aa6[_0xd27e('0x27')]]={'$like':'%'+_0x4d4845['query'][_0xd27e('0x3b')]+'%'};return _0x16c8c3;}})});}_0x46d9af=_[_0xd27e('0x3d')]({},_0x46d9af,_0x4d4845[_0xd27e('0x3e')]);var _0x5c6fe9={'where':_0x46d9af[_0xd27e('0x3c')]};return db[_0xd27e('0x2b')][_0xd27e('0x20')](_0x5c6fe9)['then'](function(_0x5affbb){_0x50c044[_0xd27e('0x20')]=_0x5affbb;if(_0x4d4845['query'][_0xd27e('0x3f')]){_0x46d9af[_0xd27e('0x40')]=[{'all':!![]}];}return db[_0xd27e('0x2b')][_0xd27e('0x41')](_0x46d9af);})['then'](function(_0x3d744b){_0x50c044[_0xd27e('0x42')]=_0x3d744b;return _0x50c044;})[_0xd27e('0x24')](respondWithFilteredResult(_0x3d3929,_0x46d9af))[_0xd27e('0x43')](handleError(_0x3d3929,null));};exports['show']=function(_0xdadda4,_0x5824c3){var _0x270427={'raw':![],'where':{'id':_0xdadda4['params']['id']}},_0x3d4af7={};_0x3d4af7[_0xd27e('0x2e')]=_['keys'](db[_0xd27e('0x2b')][_0xd27e('0x2c')]);_0x3d4af7[_0xd27e('0x2f')]=_['keys'](_0xdadda4['query']);_0x3d4af7['filters']=_[_0xd27e('0x32')](_0x3d4af7[_0xd27e('0x2e')],_0x3d4af7[_0xd27e('0x2f')]);_0x270427[_0xd27e('0x33')]=_[_0xd27e('0x32')](_0x3d4af7[_0xd27e('0x2e')],qs[_0xd27e('0x34')](_0xdadda4[_0xd27e('0x2f')][_0xd27e('0x34')]));_0x270427['attributes']=_0x270427[_0xd27e('0x33')][_0xd27e('0x35')]?_0x270427[_0xd27e('0x33')]:_0x3d4af7[_0xd27e('0x2e')];if(_0xdadda4[_0xd27e('0x2f')][_0xd27e('0x3f')]){_0x270427[_0xd27e('0x40')]=[{'all':!![]}];}_0x270427=_[_0xd27e('0x3d')]({},_0x270427,_0xdadda4[_0xd27e('0x3e')]);return db[_0xd27e('0x2b')][_0xd27e('0x44')](_0x270427)[_0xd27e('0x24')](handleEntityNotFound(_0x5824c3,null))[_0xd27e('0x24')](respondWithResult(_0x5824c3,null))[_0xd27e('0x43')](handleError(_0x5824c3,null));};exports[_0xd27e('0x45')]=function(_0x57983a,_0x4d301c){return db[_0xd27e('0x2b')][_0xd27e('0x45')](_0x57983a[_0xd27e('0x46')],{})['then'](respondWithResult(_0x4d301c,0xc9))[_0xd27e('0x43')](handleError(_0x4d301c,null));};exports[_0xd27e('0x47')]=function(_0x2bd161,_0x1fa156){if(_0x2bd161[_0xd27e('0x46')]['id']){delete _0x2bd161[_0xd27e('0x46')]['id'];}return db[_0xd27e('0x2b')][_0xd27e('0x44')]({'where':{'id':_0x2bd161[_0xd27e('0x48')]['id']}})[_0xd27e('0x24')](handleEntityNotFound(_0x1fa156,null))['then'](saveUpdates(_0x2bd161[_0xd27e('0x46')],null))[_0xd27e('0x24')](respondWithResult(_0x1fa156,null))[_0xd27e('0x43')](handleError(_0x1fa156,null));};exports[_0xd27e('0x25')]=function(_0x14a24c,_0xedccdd){return db[_0xd27e('0x2b')][_0xd27e('0x44')]({'where':{'id':_0x14a24c[_0xd27e('0x48')]['id']}})[_0xd27e('0x24')](handleEntityNotFound(_0xedccdd,null))[_0xd27e('0x24')](removeEntity(_0xedccdd,null))[_0xd27e('0x43')](handleError(_0xedccdd,null));};exports[_0xd27e('0x49')]=function(_0x37caa5,_0x5448c0,_0x3de783){var _0x52684d={};var _0x176f14={};var _0x5ab10;var _0x51853c;return db['ServicenowAccount']['findOne']({'where':{'id':_0x37caa5[_0xd27e('0x48')]['id']}})[_0xd27e('0x24')](handleEntityNotFound(_0x5448c0,null))[_0xd27e('0x24')](function(_0x14de50){if(_0x14de50){_0x5ab10=_0x14de50;_0x176f14[_0xd27e('0x2e')]=_['keys'](db[_0xd27e('0x4a')][_0xd27e('0x2c')]);_0x176f14[_0xd27e('0x2f')]=_[_0xd27e('0x30')](_0x37caa5[_0xd27e('0x2f')]);_0x176f14['filters']=_[_0xd27e('0x32')](_0x176f14[_0xd27e('0x2e')],_0x176f14[_0xd27e('0x2f')]);_0x52684d['attributes']=_[_0xd27e('0x32')](_0x176f14[_0xd27e('0x2e')],qs[_0xd27e('0x34')](_0x37caa5[_0xd27e('0x2f')][_0xd27e('0x34')]));_0x52684d[_0xd27e('0x33')]=_0x52684d[_0xd27e('0x33')][_0xd27e('0x35')]?_0x52684d[_0xd27e('0x33')]:_0x176f14[_0xd27e('0x2e')];_0x52684d[_0xd27e('0x38')]=qs[_0xd27e('0x39')](_0x37caa5['query'][_0xd27e('0x39')]);_0x52684d[_0xd27e('0x3c')]=qs[_0xd27e('0x31')](_['pick'](_0x37caa5[_0xd27e('0x2f')],_0x176f14['filters']));if(_0x37caa5[_0xd27e('0x2f')]['filter']){_0x52684d[_0xd27e('0x3c')]=_[_0xd27e('0x3d')](_0x52684d['where'],{'$or':_[_0xd27e('0x2a')](_0x52684d['attributes'],function(_0x3f743f){var _0x4548bf={};_0x4548bf[_0x3f743f]={'$like':'%'+_0x37caa5[_0xd27e('0x2f')]['filter']+'%'};return _0x4548bf;})});}_0x52684d=_['merge']({},_0x52684d,_0x37caa5[_0xd27e('0x3e')]);return _0x5ab10[_0xd27e('0x49')](_0x52684d);}})[_0xd27e('0x24')](function(_0x5b3413){if(_0x5b3413){_0x51853c=_0x5b3413[_0xd27e('0x35')];if(!_0x37caa5[_0xd27e('0x2f')][_0xd27e('0x36')](_0xd27e('0x37'))){_0x52684d[_0xd27e('0x1f')]=qs[_0xd27e('0x1f')](_0x37caa5[_0xd27e('0x2f')][_0xd27e('0x1f')]);_0x52684d[_0xd27e('0x1d')]=qs[_0xd27e('0x1d')](_0x37caa5[_0xd27e('0x2f')][_0xd27e('0x1d')]);}return _0x5ab10[_0xd27e('0x49')](_0x52684d);}})[_0xd27e('0x24')](function(_0x2029fb){if(_0x2029fb){return _0x2029fb?{'count':_0x51853c,'rows':_0x2029fb}:null;}})['then'](respondWithResult(_0x5448c0,null))['catch'](handleError(_0x5448c0,null));};exports[_0xd27e('0x4b')]=function(_0x359c09,_0x4eee4d,_0x4e45e4){if(_0x359c09[_0xd27e('0x46')]['id']){delete _0x359c09[_0xd27e('0x46')]['id'];}return db[_0xd27e('0x2b')][_0xd27e('0x4c')]({'where':{'id':_0x359c09[_0xd27e('0x48')]['id']}})[_0xd27e('0x24')](handleEntityNotFound(_0x4eee4d,null))[_0xd27e('0x24')](function(_0x49b08e){if(_0x49b08e){_0x359c09['body'][_0xd27e('0x4d')]=_0x49b08e['id'];_0x359c09[_0xd27e('0x46')][_0xd27e('0x4e')]=integrations[_0xd27e('0x4f')](_0x359c09['body']['channel'],_0x359c09[_0xd27e('0x46')][_0xd27e('0x50')]);_0x359c09[_0xd27e('0x46')][_0xd27e('0x51')]=integrations[_0xd27e('0x52')](_0x359c09[_0xd27e('0x46')][_0xd27e('0x53')],_0x359c09['body'][_0xd27e('0x50')]);return db['ServicenowConfiguration']['create'](_0x359c09[_0xd27e('0x46')],{'include':[{'model':db['ServicenowField'],'as':_0xd27e('0x4e')},{'model':db[_0xd27e('0x54')],'as':_0xd27e('0x51')}]});}return null;})[_0xd27e('0x24')](respondWithResult(_0x4eee4d,null))['catch'](handleError(_0x4eee4d,null));};exports[_0xd27e('0x55')]=function(_0x2cabdf,_0x312fe6,_0x52b908){var _0x32b166=[_0xd27e('0x56'),_0xd27e('0x57'),'knowledge',_0xd27e('0x58'),'close_code',_0xd27e('0x59'),_0xd27e('0x5a'),'severity',_0xd27e('0x5b')];var _0xe4587a=[_0xd27e('0x5c'),_0xd27e('0x56'),_0xd27e('0x5d'),_0xd27e('0x5e'),_0xd27e('0x5f'),_0xd27e('0x60'),'child_incidents',_0xd27e('0x57'),'approval_history',_0xd27e('0x61'),'resolved_by',_0xd27e('0x62'),_0xd27e('0x63'),_0xd27e('0x64'),_0xd27e('0x65'),_0xd27e('0x66'),_0xd27e('0x67'),_0xd27e('0x68'),'knowledge',_0xd27e('0x38'),_0xd27e('0x69'),_0xd27e('0x6a'),_0xd27e('0x6b'),_0xd27e('0x6c'),_0xd27e('0x6d'),_0xd27e('0x6e'),_0xd27e('0x6f'),_0xd27e('0x70'),'priority',_0xd27e('0x71'),_0xd27e('0x72'),_0xd27e('0x73'),_0xd27e('0x74'),_0xd27e('0x75'),_0xd27e('0x76'),'group_list',_0xd27e('0x77'),_0xd27e('0x78'),_0xd27e('0x79'),_0xd27e('0x7a'),_0xd27e('0x7b'),_0xd27e('0x58'),_0xd27e('0x7c'),_0xd27e('0x7d'),_0xd27e('0x7e'),_0xd27e('0x7f'),'delivery_task',_0xd27e('0x80'),'assignment_group',_0xd27e('0x81'),'additional_assignee_list',_0xd27e('0x82'),_0xd27e('0x83'),'notify',_0xd27e('0x84'),_0xd27e('0x85'),'closed_by',_0xd27e('0x86'),_0xd27e('0x87'),'sys_id',_0xd27e('0x88'),_0xd27e('0x89'),_0xd27e('0x5a'),_0xd27e('0x8a'),'problem_id',_0xd27e('0x8b'),_0xd27e('0x8c'),'activity_due',_0xd27e('0x8d'),_0xd27e('0x8e'),'comments',_0xd27e('0x8f'),_0xd27e('0x90'),_0xd27e('0x91'),_0xd27e('0x92'),_0xd27e('0x93'),_0xd27e('0x94'),_0xd27e('0x95'),_0xd27e('0x96'),_0xd27e('0x97'),_0xd27e('0x98'),_0xd27e('0x99'),'category'];var _0x48004b='';var _0x573c84='';var _0x3c4140=[];var _0x5138a0='';var _0x380d59='';var _0x17987f=[];var _0xcf14ef='';var _0x20d892='';var _0x388c21={};var _0x617b9d='';return db[_0xd27e('0x2b')]['findOne']({'where':{'id':_0x2cabdf[_0xd27e('0x48')]['id']},'attributes':['id',_0xd27e('0x9a'),_0xd27e('0x9b'),_0xd27e('0x9c'),_0xd27e('0x9d'),_0xd27e('0x9e')]})[_0xd27e('0x24')](handleEntityNotFound(_0x312fe6,null))['then'](function(_0x32e9b9){if(_0x32e9b9){_0x617b9d=_0x32e9b9[_0xd27e('0x9d')];var _0x131189=_0x617b9d[_0xd27e('0x9f')](-0x1);if(_0x131189==='/'){_0x617b9d=_0x617b9d[_0xd27e('0xa0')](0x0,_0x617b9d[_0xd27e('0xa1')](_0x131189));}_0x20d892=util[_0xd27e('0xa2')](_0xd27e('0xa3'),_0x617b9d);_0xcf14ef=util[_0xd27e('0xa2')](_0xd27e('0xa4'),_0x617b9d);_0x388c21={'user':_0x32e9b9[_0xd27e('0x9a')],'pass':_0x32e9b9['password']};var _0x3c3246={'method':_0xd27e('0xa5'),'uri':_0x20d892+_0xd27e('0xa6'),'auth':_0x388c21,'json':!![]};return rp(_0x3c3246);}})[_0xd27e('0x24')](function(_0x3ee4e4){if(_0x3ee4e4[_0xd27e('0xa7')][_0xd27e('0x35')]>0x0){_0x48004b=_0x3ee4e4[_0xd27e('0xa7')];}console[_0xd27e('0xa8')](_0xd27e('0xa9'),_0x48004b);_0x17987f=[];_0x573c84=Object['assign']([],_0x48004b);_[_0xd27e('0xaa')](_0x573c84,function(_0x5c0c31){return!_0x32b166['includes'](_0x5c0c31[_0xd27e('0x27')]);});_0x573c84[_0xd27e('0xab')](function(_0x4771a9){var _0x4a75e9=createFieldObject(_0xcf14ef,_0x388c21,_0x4771a9['internalType'],_0x4771a9[_0xd27e('0x27')],_0x4771a9[_0xd27e('0xac')],![]);_0x17987f[_0xd27e('0xad')](_0x4a75e9);});return Promise[_0xd27e('0xae')](_0x17987f);})[_0xd27e('0x24')](function(_0xc4cc7a){_0x3c4140=_0xc4cc7a;_0x5138a0=Object['assign']([],_0x48004b);console[_0xd27e('0xa8')]('TCL:\x20_object',_0x48004b);_[_0xd27e('0xaa')](_0x5138a0,function(_0x755b7e){return _0xe4587a['includes'](_0x755b7e['name']);});console['log'](_0xd27e('0xaf'),_0x5138a0);_0x17987f=[];_0x5138a0[_0xd27e('0xab')](function(_0x572fdd){var _0x559f68=createFieldObject(_0xcf14ef,_0x388c21,_0x572fdd[_0xd27e('0xb0')],_0x572fdd[_0xd27e('0x27')],_0x572fdd[_0xd27e('0xac')],!![]);_0x17987f[_0xd27e('0xad')](_0x559f68);});return Promise[_0xd27e('0xae')](_0x17987f);})['then'](function(_0x525d3a){_0x380d59=_0x525d3a;var _0x3219b2=_0x3c4140[_0xd27e('0xb1')](_0x380d59);return{'count':_0x3219b2[_0xd27e('0x35')],'rows':_0x3219b2};})['then'](respondWithResult(_0x312fe6,null))[_0xd27e('0x43')](function(_0x24ae5d){console[_0xd27e('0xa8')](_0xd27e('0xb2')+_0x24ae5d);var _0x3d6ad6=_0x2cabdf[_0xd27e('0x2f')][_0xd27e('0xb3')]?0x1f4:_0x24ae5d[_0xd27e('0xb4')]||0x1f4;logger[_0xd27e('0xb5')](_0x24ae5d['stack']);delete _0x24ae5d[_0xd27e('0x27')];if(_0x3d6ad6===0x191){_0x3d6ad6=0x190;}_0x312fe6['status'](_0x3d6ad6)[_0xd27e('0x28')](_0x2cabdf[_0xd27e('0x2f')][_0xd27e('0xb3')]?{'message':_0xd27e('0xb6'),'statusCode':_0x24ae5d[_0xd27e('0xb4')]}:_0x24ae5d);});};function createFieldObject(_0x1410d6,_0x4a413e,_0x1bae05,_0x479725,_0x27bf2a,_0x30c74b){return new Promise(function(_0x1541f8,_0x1f9b50){var _0x55326d={'id':_0x479725,'name':_0x27bf2a,'custom':_0x30c74b};if(_0x1bae05===_0xd27e('0xb7')){_0x55326d[_0xd27e('0x3e')]=[{'name':'True','value':'true'},{'name':'False','value':'false'}];_0x1541f8(_0x55326d);}else{var _0x21e929={'method':_0xd27e('0xa5'),'uri':_0x1410d6+_0xd27e('0xb8')+_0x479725,'auth':_0x4a413e,'json':!![]};return rp(_0x21e929)[_0xd27e('0x24')](function(_0x5c7eb3){var _0x24e2e9=[];if(_0x5c7eb3[_0xd27e('0xa7')]['length']>0x0){_0x5c7eb3[_0xd27e('0xa7')][_0xd27e('0xab')](function(_0x15f272){if(_0x15f272[_0xd27e('0xb9')]===_0xd27e('0xba')){var _0x3c6b73={'name':_0x15f272[_0xd27e('0xac')],'value':_0x15f272[_0xd27e('0xbb')]};_0x24e2e9[_0xd27e('0xad')](_0x3c6b73);}});}_0x55326d['options']=_0x24e2e9;if(_0x55326d[_0xd27e('0x3e')][_0xd27e('0x35')]>0x0){_0x1541f8(_0x55326d);}else{if(_0x30c74b==![]){_0x1541f8();}else{_0x1541f8(_0x55326d);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 1b430ff..7763e92 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 _0xb4c7=['moment','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x7c355e,_0x174e13){_0x7c355e=_0x7c355e-0x0;var _0x51087a=_0xb4c7[_0x7c355e];return _0x51087a;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x7b4c('0xa')]=function(_0x10e197,_0x2dd5c7){return _0x10e197['define'](_0x7b4c('0xb'),attributes,{'tableName':_0x7b4c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fb=['../../components/integrations/configuration','define','int_servicenow_accounts','lodash','util','../../config/logger','api','path','rimraf','./intServicenowAccount.attributes'];(function(_0x80acc5,_0x3698fd){var _0x1dbd9e=function(_0x5945f5){while(--_0x5945f5){_0x80acc5['push'](_0x80acc5['shift']());}};_0x1dbd9e(++_0x3698fd);}(_0xd8fb,0x99));var _0xbd8f=function(_0x4488cc,_0x45c59e){_0x4488cc=_0x4488cc-0x0;var _0xdeac84=_0xd8fb[_0x4488cc];return _0xdeac84;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));var integrations=require(_0xbd8f('0x7'));module['exports']=function(_0x33d541,_0x4e97cf){return _0x33d541[_0xbd8f('0x8')]('ServicenowAccount',attributes,{'tableName':_0xbd8f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index efe3891..2f7e4d2 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 _0x5d2c=['message','result','ServicenowAccount','options','raw','attributes','map','include','model','GetServicenowAccount','find','ShowServicenowAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x533e72,_0x4b6d66){var _0x519653=function(_0x35c5d8){while(--_0x35c5d8){_0x533e72['push'](_0x533e72['shift']());}};_0x519653(++_0x4b6d66);}(_0x5d2c,0xbb));var _0xc5d2=function(_0xf5709,_0x459404){_0xf5709=_0xf5709-0x0;var _0x46ebb5=_0x5d2c[_0xf5709];return _0x46ebb5;};'use strict';var _=require(_0xc5d2('0x0'));var util=require(_0xc5d2('0x1'));var moment=require(_0xc5d2('0x2'));var BPromise=require(_0xc5d2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5d2('0x4'));var db=require(_0xc5d2('0x5'))['db'];var utils=require(_0xc5d2('0x6'));var logger=require(_0xc5d2('0x7'))(_0xc5d2('0x8'));var config=require(_0xc5d2('0x9'));var jayson=require(_0xc5d2('0xa'));var client=jayson[_0xc5d2('0xb')][_0xc5d2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c55a9,_0x5f3f1f,_0x4cf8e5){return new BPromise(function(_0x511406,_0x113a88){return client[_0xc5d2('0xd')](_0x3c55a9,_0x4cf8e5)[_0xc5d2('0xe')](function(_0x29e1ed){logger[_0xc5d2('0xf')](_0xc5d2('0x10'),_0x5f3f1f,_0xc5d2('0x11'));logger[_0xc5d2('0x12')](_0xc5d2('0x13'),_0x5f3f1f,_0xc5d2('0x11'),JSON[_0xc5d2('0x14')](_0x29e1ed));if(_0x29e1ed['error']){if(_0x29e1ed[_0xc5d2('0x15')][_0xc5d2('0x16')]===0x1f4){logger[_0xc5d2('0x15')]('ServicenowAccount,\x20%s,\x20%s',_0x5f3f1f,_0x29e1ed[_0xc5d2('0x15')][_0xc5d2('0x17')]);return _0x113a88(_0x29e1ed[_0xc5d2('0x15')]['message']);}logger[_0xc5d2('0x15')](_0xc5d2('0x10'),_0x5f3f1f,_0x29e1ed[_0xc5d2('0x15')][_0xc5d2('0x17')]);return _0x511406(_0x29e1ed[_0xc5d2('0x15')]['message']);}else{logger[_0xc5d2('0xf')](_0xc5d2('0x10'),_0x5f3f1f,'request\x20sent');_0x511406(_0x29e1ed[_0xc5d2('0x18')][_0xc5d2('0x17')]);}})['catch'](function(_0x18ea76){logger['error'](_0xc5d2('0x10'),_0x5f3f1f,_0x18ea76);_0x113a88(_0x18ea76);});});}exports['GetServicenowAccount']=function(_0x5f2fef){var _0x28fd54=this;return new Promise(function(_0x383492,_0x4b0db6){return db[_0xc5d2('0x19')]['findAll']({'raw':_0x5f2fef[_0xc5d2('0x1a')]?_0x5f2fef['options'][_0xc5d2('0x1b')]===undefined?!![]:![]:!![],'where':_0x5f2fef[_0xc5d2('0x1a')]?_0x5f2fef['options']['where']||null:null,'attributes':_0x5f2fef[_0xc5d2('0x1a')]?_0x5f2fef[_0xc5d2('0x1a')][_0xc5d2('0x1c')]||null:null,'limit':_0x5f2fef['options']?_0x5f2fef[_0xc5d2('0x1a')]['limit']||null:null,'include':_0x5f2fef[_0xc5d2('0x1a')]?_0x5f2fef['options']['include']?_[_0xc5d2('0x1d')](_0x5f2fef[_0xc5d2('0x1a')][_0xc5d2('0x1e')],function(_0x21197e){return{'model':db[_0x21197e[_0xc5d2('0x1f')]],'as':_0x21197e['as'],'attributes':_0x21197e[_0xc5d2('0x1c')],'include':_0x21197e[_0xc5d2('0x1e')]?_['map'](_0x21197e[_0xc5d2('0x1e')],function(_0x12ea60){return{'model':db[_0x12ea60[_0xc5d2('0x1f')]],'as':_0x12ea60['as'],'attributes':_0x12ea60['attributes'],'include':_0x12ea60['include']?_[_0xc5d2('0x1d')](_0x12ea60[_0xc5d2('0x1e')],function(_0x4ef142){return{'model':db[_0x4ef142[_0xc5d2('0x1f')]],'as':_0x4ef142['as'],'attributes':_0x4ef142[_0xc5d2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc5d2('0xe')](function(_0x498873){logger[_0xc5d2('0xf')](_0xc5d2('0x20'),_0x5f2fef);logger[_0xc5d2('0x12')](_0xc5d2('0x20'),_0x5f2fef,JSON['stringify'](_0x498873));_0x383492(_0x498873);})['catch'](function(_0x10ce8c){logger[_0xc5d2('0x15')](_0xc5d2('0x20'),_0x10ce8c['message'],_0x5f2fef);_0x4b0db6(_0x28fd54['error'](0x1f4,_0x10ce8c[_0xc5d2('0x17')]));});});};exports['ShowServicenowAccount']=function(_0x239dce){var _0x58b1f5=this;return new Promise(function(_0x37412f,_0x4790e6){return db[_0xc5d2('0x19')][_0xc5d2('0x21')]({'raw':_0x239dce[_0xc5d2('0x1a')]?_0x239dce[_0xc5d2('0x1a')][_0xc5d2('0x1b')]===undefined?!![]:![]:!![],'where':_0x239dce[_0xc5d2('0x1a')]?_0x239dce['options']['where']||null:null,'attributes':_0x239dce[_0xc5d2('0x1a')]?_0x239dce[_0xc5d2('0x1a')]['attributes']||null:null,'include':_0x239dce[_0xc5d2('0x1a')]?_0x239dce[_0xc5d2('0x1a')][_0xc5d2('0x1e')]?_[_0xc5d2('0x1d')](_0x239dce['options']['include'],function(_0x9d88bf){return{'model':db[_0x9d88bf['model']],'as':_0x9d88bf['as'],'attributes':_0x9d88bf[_0xc5d2('0x1c')],'include':_0x9d88bf[_0xc5d2('0x1e')]?_[_0xc5d2('0x1d')](_0x9d88bf[_0xc5d2('0x1e')],function(_0x51fb60){return{'model':db[_0x51fb60['model']],'as':_0x51fb60['as'],'attributes':_0x51fb60[_0xc5d2('0x1c')],'include':_0x51fb60[_0xc5d2('0x1e')]?_['map'](_0x51fb60[_0xc5d2('0x1e')],function(_0x2cd29b){return{'model':db[_0x2cd29b[_0xc5d2('0x1f')]],'as':_0x2cd29b['as'],'attributes':_0x2cd29b[_0xc5d2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc5d2('0xe')](function(_0x329315){logger[_0xc5d2('0xf')](_0xc5d2('0x22'),_0x239dce);logger[_0xc5d2('0x12')](_0xc5d2('0x22'),_0x239dce,JSON[_0xc5d2('0x14')](_0x329315));_0x37412f(_0x329315);})['catch'](function(_0x3f97bb){logger[_0xc5d2('0x15')](_0xc5d2('0x22'),_0x3f97bb[_0xc5d2('0x17')],_0x239dce);_0x4790e6(_0x58b1f5[_0xc5d2('0x15')](0x1f4,_0x3f97bb[_0xc5d2('0x17')]));});});}; \ No newline at end of file +var _0x610c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','attributes','include','map','model','find','raw','where','ShowServicenowAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x508e60,_0x47d27c){var _0x46148f=function(_0x49a6b4){while(--_0x49a6b4){_0x508e60['push'](_0x508e60['shift']());}};_0x46148f(++_0x47d27c);}(_0x610c,0xd8));var _0xc610=function(_0x5ade06,_0x321e8a){_0x5ade06=_0x5ade06-0x0;var _0xccce41=_0x610c[_0x5ade06];return _0xccce41;};'use strict';var _=require(_0xc610('0x0'));var util=require(_0xc610('0x1'));var moment=require('moment');var BPromise=require(_0xc610('0x2'));var rs=require(_0xc610('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc610('0x4'))['db'];var utils=require(_0xc610('0x5'));var logger=require(_0xc610('0x6'))(_0xc610('0x7'));var config=require(_0xc610('0x8'));var jayson=require(_0xc610('0x9'));var client=jayson[_0xc610('0xa')][_0xc610('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1774f0,_0x19cbe5,_0x52c039){return new BPromise(function(_0x36c94b,_0x2617b8){return client[_0xc610('0xc')](_0x1774f0,_0x52c039)[_0xc610('0xd')](function(_0x5e9c55){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x19cbe5,_0xc610('0xe'));logger[_0xc610('0xf')](_0xc610('0x10'),_0x19cbe5,'request\x20sent',JSON[_0xc610('0x11')](_0x5e9c55));if(_0x5e9c55[_0xc610('0x12')]){if(_0x5e9c55['error'][_0xc610('0x13')]===0x1f4){logger[_0xc610('0x12')](_0xc610('0x14'),_0x19cbe5,_0x5e9c55[_0xc610('0x12')][_0xc610('0x15')]);return _0x2617b8(_0x5e9c55[_0xc610('0x12')]['message']);}logger[_0xc610('0x12')](_0xc610('0x14'),_0x19cbe5,_0x5e9c55[_0xc610('0x12')][_0xc610('0x15')]);return _0x36c94b(_0x5e9c55[_0xc610('0x12')][_0xc610('0x15')]);}else{logger[_0xc610('0x16')](_0xc610('0x14'),_0x19cbe5,_0xc610('0xe'));_0x36c94b(_0x5e9c55[_0xc610('0x17')]['message']);}})[_0xc610('0x18')](function(_0x31107a){logger[_0xc610('0x12')](_0xc610('0x14'),_0x19cbe5,_0x31107a);_0x2617b8(_0x31107a);});});}exports[_0xc610('0x19')]=function(_0x4e8745){var _0x4bbbf1=this;return new Promise(function(_0x1c86a3,_0x509316){return db[_0xc610('0x1a')][_0xc610('0x1b')]({'raw':_0x4e8745[_0xc610('0x1c')]?_0x4e8745[_0xc610('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4e8745['options']?_0x4e8745[_0xc610('0x1c')]['where']||null:null,'attributes':_0x4e8745[_0xc610('0x1c')]?_0x4e8745['options'][_0xc610('0x1d')]||null:null,'limit':_0x4e8745[_0xc610('0x1c')]?_0x4e8745[_0xc610('0x1c')]['limit']||null:null,'include':_0x4e8745[_0xc610('0x1c')]?_0x4e8745[_0xc610('0x1c')][_0xc610('0x1e')]?_[_0xc610('0x1f')](_0x4e8745['options'][_0xc610('0x1e')],function(_0x270e66){return{'model':db[_0x270e66[_0xc610('0x20')]],'as':_0x270e66['as'],'attributes':_0x270e66['attributes'],'include':_0x270e66[_0xc610('0x1e')]?_['map'](_0x270e66['include'],function(_0x4ad09d){return{'model':db[_0x4ad09d['model']],'as':_0x4ad09d['as'],'attributes':_0x4ad09d[_0xc610('0x1d')],'include':_0x4ad09d[_0xc610('0x1e')]?_[_0xc610('0x1f')](_0x4ad09d[_0xc610('0x1e')],function(_0x50eadc){return{'model':db[_0x50eadc[_0xc610('0x20')]],'as':_0x50eadc['as'],'attributes':_0x50eadc[_0xc610('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc610('0xd')](function(_0x558ab0){logger['info']('GetServicenowAccount',_0x4e8745);logger[_0xc610('0xf')](_0xc610('0x19'),_0x4e8745,JSON['stringify'](_0x558ab0));_0x1c86a3(_0x558ab0);})[_0xc610('0x18')](function(_0x2b60b9){logger[_0xc610('0x12')](_0xc610('0x19'),_0x2b60b9[_0xc610('0x15')],_0x4e8745);_0x509316(_0x4bbbf1['error'](0x1f4,_0x2b60b9[_0xc610('0x15')]));});});};exports['ShowServicenowAccount']=function(_0x5cde3b){var _0x21d2e3=this;return new Promise(function(_0x249465,_0x42c753){return db[_0xc610('0x1a')][_0xc610('0x21')]({'raw':_0x5cde3b[_0xc610('0x1c')]?_0x5cde3b[_0xc610('0x1c')][_0xc610('0x22')]===undefined?!![]:![]:!![],'where':_0x5cde3b[_0xc610('0x1c')]?_0x5cde3b[_0xc610('0x1c')][_0xc610('0x23')]||null:null,'attributes':_0x5cde3b[_0xc610('0x1c')]?_0x5cde3b[_0xc610('0x1c')][_0xc610('0x1d')]||null:null,'include':_0x5cde3b['options']?_0x5cde3b['options'][_0xc610('0x1e')]?_[_0xc610('0x1f')](_0x5cde3b[_0xc610('0x1c')]['include'],function(_0x2eec39){return{'model':db[_0x2eec39[_0xc610('0x20')]],'as':_0x2eec39['as'],'attributes':_0x2eec39['attributes'],'include':_0x2eec39[_0xc610('0x1e')]?_[_0xc610('0x1f')](_0x2eec39[_0xc610('0x1e')],function(_0x40e665){return{'model':db[_0x40e665[_0xc610('0x20')]],'as':_0x40e665['as'],'attributes':_0x40e665[_0xc610('0x1d')],'include':_0x40e665[_0xc610('0x1e')]?_[_0xc610('0x1f')](_0x40e665['include'],function(_0xdbb0f6){return{'model':db[_0xdbb0f6[_0xc610('0x20')]],'as':_0xdbb0f6['as'],'attributes':_0xdbb0f6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x33bbb2){logger[_0xc610('0x16')](_0xc610('0x24'),_0x5cde3b);logger[_0xc610('0xf')](_0xc610('0x24'),_0x5cde3b,JSON[_0xc610('0x11')](_0x33bbb2));_0x249465(_0x33bbb2);})[_0xc610('0x18')](function(_0x87a45){logger[_0xc610('0x12')](_0xc610('0x24'),_0x87a45[_0xc610('0x15')],_0x5cde3b);_0x42c753(_0x21d2e3[_0xc610('0x12')](0x1f4,_0x87a45[_0xc610('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 0bc7da7..828c14d 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 _0x88d3=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','index','/:id','isAuthenticated','show','get','getFields','/:id/subjects','/:id/descriptions','create','put','delete','destroy','exports','path','connect-timeout'];(function(_0x2d920f,_0x3283fc){var _0x3494ff=function(_0x11bef6){while(--_0x11bef6){_0x2d920f['push'](_0x2d920f['shift']());}};_0x3494ff(++_0x3283fc);}(_0x88d3,0x102));var _0x388d=function(_0x60f803,_0x2a2561){_0x60f803=_0x60f803-0x0;var _0x5a030c=_0x88d3[_0x60f803];return _0x5a030c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x388d('0x0'));var timeout=require(_0x388d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x388d('0x2'));var auth=require(_0x388d('0x3'));var interaction=require(_0x388d('0x4'));var config=require(_0x388d('0x5'));var controller=require(_0x388d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x388d('0x7')]);router['get'](_0x388d('0x8'),auth[_0x388d('0x9')](),controller[_0x388d('0xa')]);router[_0x388d('0xb')]('/:id/fields',auth[_0x388d('0x9')](),controller[_0x388d('0xc')]);router[_0x388d('0xb')](_0x388d('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x388d('0xb')](_0x388d('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x388d('0x9')](),controller[_0x388d('0xf')]);router[_0x388d('0x10')](_0x388d('0x8'),auth[_0x388d('0x9')](),controller['update']);router[_0x388d('0x11')](_0x388d('0x8'),auth[_0x388d('0x9')](),controller[_0x388d('0x12')]);module[_0x388d('0x13')]=router; \ No newline at end of file +var _0x54ab=['./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../config/environment'];(function(_0x3000c3,_0x50d95e){var _0x5c8bf0=function(_0x12da32){while(--_0x12da32){_0x3000c3['push'](_0x3000c3['shift']());}};_0x5c8bf0(++_0x50d95e);}(_0x54ab,0x102));var _0xb54a=function(_0x9570f3,_0x19cc4c){_0x9570f3=_0x9570f3-0x0;var _0x79c1a=_0x54ab[_0x9570f3];return _0x79c1a;};'use strict';var multer=require(_0xb54a('0x0'));var util=require(_0xb54a('0x1'));var path=require(_0xb54a('0x2'));var timeout=require(_0xb54a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb54a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb54a('0x5'));var controller=require(_0xb54a('0x6'));router[_0xb54a('0x7')]('/',auth[_0xb54a('0x8')](),controller[_0xb54a('0x9')]);router[_0xb54a('0x7')](_0xb54a('0xa'),auth[_0xb54a('0x8')](),controller[_0xb54a('0xb')]);router[_0xb54a('0x7')]('/:id/fields',auth[_0xb54a('0x8')](),controller[_0xb54a('0xc')]);router[_0xb54a('0x7')](_0xb54a('0xd'),auth[_0xb54a('0x8')](),controller[_0xb54a('0xe')]);router[_0xb54a('0x7')](_0xb54a('0xf'),auth['isAuthenticated'](),controller[_0xb54a('0x10')]);router[_0xb54a('0x11')]('/',auth[_0xb54a('0x8')](),controller[_0xb54a('0x12')]);router[_0xb54a('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xb54a('0x14')]);router[_0xb54a('0x15')](_0xb54a('0xa'),auth[_0xb54a('0x8')](),controller[_0xb54a('0x16')]);module[_0xb54a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index fb01303..dd4afe8 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 _0x7c31=['STRING','sequelize','exports'];(function(_0x43a602,_0x4fe4ef){var _0x5b085c=function(_0xf6f6c4){while(--_0xf6f6c4){_0x43a602['push'](_0x43a602['shift']());}};_0x5b085c(++_0x4fe4ef);}(_0x7c31,0x16f));var _0x17c3=function(_0x4fb88a,_0x565cb9){_0x4fb88a=_0x4fb88a-0x0;var _0x2b117e=_0x7c31[_0x4fb88a];return _0x2b117e;};'use strict';var Sequelize=require(_0x17c3('0x0'));module[_0x17c3('0x1')]={'name':{'type':Sequelize[_0x17c3('0x2')]},'description':{'type':Sequelize[_0x17c3('0x2')]}}; \ No newline at end of file +var _0x6b20=['sequelize','exports','STRING'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x6b20,0x1c5));var _0x06b2=function(_0x4e04d1,_0x3fb544){_0x4e04d1=_0x4e04d1-0x0;var _0x555200=_0x6b20[_0x4e04d1];return _0x555200;};'use strict';var Sequelize=require(_0x06b2('0x0'));module[_0x06b2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x06b2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 295c550..0bf8e1a 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 _0xbc42=['../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','sendStatus','stack','name','map','ServicenowConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','options','include','findAll','rows','catch','show','params','find','create','body','findOne','ServicenowField','sort','filter','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xbbbc24,_0x2db0bf){var _0x3947fe=function(_0x3fcdd9){while(--_0x3fcdd9){_0xbbbc24['push'](_0xbbbc24['shift']());}};_0x3947fe(++_0x2db0bf);}(_0xbc42,0x86));var _0x2bc4=function(_0x4b3b71,_0x944b48){_0x4b3b71=_0x4b3b71-0x0;var _0x1dc6de=_0xbc42[_0x4b3b71];return _0x1dc6de;};'use strict';var emlformat=require(_0x2bc4('0x0'));var rimraf=require(_0x2bc4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2bc4('0x2'));var rp=require(_0x2bc4('0x3'));var moment=require(_0x2bc4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2bc4('0x5'));var util=require('util');var path=require(_0x2bc4('0x6'));var sox=require(_0x2bc4('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2bc4('0x8'));var _=require(_0x2bc4('0x9'));var squel=require(_0x2bc4('0xa'));var crypto=require(_0x2bc4('0xb'));var jsforce=require(_0x2bc4('0xc'));var deskjs=require(_0x2bc4('0xd'));var toCsv=require(_0x2bc4('0xe'));var querystring=require(_0x2bc4('0xf'));var Papa=require(_0x2bc4('0x10'));var Redis=require(_0x2bc4('0x11'));var authService=require(_0x2bc4('0x12'));var qs=require(_0x2bc4('0x13'));var as=require(_0x2bc4('0x14'));var hardwareService=require(_0x2bc4('0x15'));var logger=require(_0x2bc4('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x2bc4('0x17'));var licenseUtil=require(_0x2bc4('0x18'));var db=require(_0x2bc4('0x19'))['db'];function respondWithStatusCode(_0x85f0b0,_0x2b2d60){_0x2b2d60=_0x2b2d60||0xcc;return function(_0x2c9c17){if(_0x2c9c17){return _0x85f0b0['sendStatus'](_0x2b2d60);}return _0x85f0b0['status'](_0x2b2d60)[_0x2bc4('0x1a')]();};}function respondWithResult(_0x254d13,_0x3ec58a){_0x3ec58a=_0x3ec58a||0xc8;return function(_0x303bad){if(_0x303bad){return _0x254d13[_0x2bc4('0x1b')](_0x3ec58a)[_0x2bc4('0x1c')](_0x303bad);}};}function respondWithFilteredResult(_0x1dd17e,_0x182a79){return function(_0x5c9685){if(_0x5c9685){var _0x15e50c=typeof _0x182a79[_0x2bc4('0x1d')]===_0x2bc4('0x1e')&&typeof _0x182a79[_0x2bc4('0x1f')]===_0x2bc4('0x1e');var _0x5b8822=_0x5c9685[_0x2bc4('0x20')];var _0x4a05b0=_0x15e50c?0x0:_0x182a79[_0x2bc4('0x1d')];var _0x20525d=_0x15e50c?_0x5c9685[_0x2bc4('0x20')]:_0x182a79[_0x2bc4('0x1d')]+_0x182a79['limit'];var _0x490c99;if(_0x20525d>=_0x5b8822){_0x20525d=_0x5b8822;_0x490c99=0xc8;}else{_0x490c99=0xce;}_0x1dd17e[_0x2bc4('0x1b')](_0x490c99);return _0x1dd17e[_0x2bc4('0x21')](_0x2bc4('0x22'),_0x4a05b0+'-'+_0x20525d+'/'+_0x5b8822)[_0x2bc4('0x1c')](_0x5c9685);}return null;};}function patchUpdates(_0x5ec31f){return function(_0xbbeb3b){try{jsonpatch[_0x2bc4('0x23')](_0xbbeb3b,_0x5ec31f,!![]);}catch(_0x488258){return BPromise[_0x2bc4('0x24')](_0x488258);}return _0xbbeb3b['save']();};}function saveUpdates(_0x4dff72,_0x5acaa1){return function(_0x14d066){if(_0x14d066){return _0x14d066['update'](_0x4dff72)[_0x2bc4('0x25')](function(_0x33ede7){return _0x33ede7;});}return null;};}function removeEntity(_0x280119,_0x468867){return function(_0x18a38a){if(_0x18a38a){return _0x18a38a[_0x2bc4('0x26')]()['then'](function(){_0x280119[_0x2bc4('0x1b')](0xcc)[_0x2bc4('0x1a')]();});}};}function handleEntityNotFound(_0x4f85b5,_0x42312c){return function(_0xd8e3d4){if(!_0xd8e3d4){_0x4f85b5[_0x2bc4('0x27')](0x194);}return _0xd8e3d4;};}function handleError(_0x37d35d,_0x35123b){_0x35123b=_0x35123b||0x1f4;return function(_0x54411f){logger['error'](_0x54411f[_0x2bc4('0x28')]);if(_0x54411f[_0x2bc4('0x29')]){delete _0x54411f['name'];}_0x37d35d['status'](_0x35123b)['send'](_0x54411f);};}exports['index']=function(_0x31865e,_0x562ef1){var _0xdca3b8={},_0x3155f1={},_0x27517b={'count':0x0,'rows':[]};var _0x4c3f4b=_[_0x2bc4('0x2a')](db[_0x2bc4('0x2b')][_0x2bc4('0x2c')],function(_0xea4a34){return{'name':_0xea4a34['fieldName'],'type':_0xea4a34[_0x2bc4('0x2d')][_0x2bc4('0x2e')]};});_0x3155f1[_0x2bc4('0x2f')]=_[_0x2bc4('0x2a')](_0x4c3f4b,_0x2bc4('0x29'));_0x3155f1[_0x2bc4('0x30')]=_[_0x2bc4('0x31')](_0x31865e['query']);_0x3155f1[_0x2bc4('0x32')]=_[_0x2bc4('0x33')](_0x3155f1[_0x2bc4('0x2f')],_0x3155f1[_0x2bc4('0x30')]);_0xdca3b8[_0x2bc4('0x34')]=_[_0x2bc4('0x33')](_0x3155f1[_0x2bc4('0x2f')],qs[_0x2bc4('0x35')](_0x31865e[_0x2bc4('0x30')][_0x2bc4('0x35')]));_0xdca3b8[_0x2bc4('0x34')]=_0xdca3b8[_0x2bc4('0x34')][_0x2bc4('0x36')]?_0xdca3b8[_0x2bc4('0x34')]:_0x3155f1[_0x2bc4('0x2f')];if(!_0x31865e['query'][_0x2bc4('0x37')](_0x2bc4('0x38'))){_0xdca3b8[_0x2bc4('0x1f')]=qs['limit'](_0x31865e[_0x2bc4('0x30')][_0x2bc4('0x1f')]);_0xdca3b8[_0x2bc4('0x1d')]=qs['offset'](_0x31865e[_0x2bc4('0x30')][_0x2bc4('0x1d')]);}_0xdca3b8[_0x2bc4('0x39')]=qs['sort'](_0x31865e[_0x2bc4('0x30')]['sort']);_0xdca3b8[_0x2bc4('0x3a')]=qs[_0x2bc4('0x32')](_[_0x2bc4('0x3b')](_0x31865e[_0x2bc4('0x30')],_0x3155f1[_0x2bc4('0x32')]),_0x4c3f4b);if(_0x31865e[_0x2bc4('0x30')]['filter']){_0xdca3b8[_0x2bc4('0x3a')]=_['merge'](_0xdca3b8[_0x2bc4('0x3a')],{'$or':_[_0x2bc4('0x2a')](_0x4c3f4b,function(_0x552928){if(_0x552928['type']!=='VIRTUAL'){var _0x1eba24={};_0x1eba24[_0x552928['name']]={'$like':'%'+_0x31865e['query']['filter']+'%'};return _0x1eba24;}})});}_0xdca3b8=_[_0x2bc4('0x3c')]({},_0xdca3b8,_0x31865e[_0x2bc4('0x3d')]);var _0x3762e2={'where':_0xdca3b8['where']};return db[_0x2bc4('0x2b')][_0x2bc4('0x20')](_0x3762e2)['then'](function(_0x1815c2){_0x27517b['count']=_0x1815c2;if(_0x31865e[_0x2bc4('0x30')]['includeAll']){_0xdca3b8[_0x2bc4('0x3e')]=[{'all':!![]}];}return db[_0x2bc4('0x2b')][_0x2bc4('0x3f')](_0xdca3b8);})['then'](function(_0x4cf929){_0x27517b[_0x2bc4('0x40')]=_0x4cf929;return _0x27517b;})[_0x2bc4('0x25')](respondWithFilteredResult(_0x562ef1,_0xdca3b8))[_0x2bc4('0x41')](handleError(_0x562ef1,null));};exports[_0x2bc4('0x42')]=function(_0x4a0327,_0x3408e7){var _0x482a55={'raw':![],'where':{'id':_0x4a0327[_0x2bc4('0x43')]['id']}},_0x4b2888={};_0x4b2888[_0x2bc4('0x2f')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x4b2888[_0x2bc4('0x30')]=_[_0x2bc4('0x31')](_0x4a0327[_0x2bc4('0x30')]);_0x4b2888[_0x2bc4('0x32')]=_[_0x2bc4('0x33')](_0x4b2888[_0x2bc4('0x2f')],_0x4b2888[_0x2bc4('0x30')]);_0x482a55[_0x2bc4('0x34')]=_['intersection'](_0x4b2888[_0x2bc4('0x2f')],qs['fields'](_0x4a0327[_0x2bc4('0x30')][_0x2bc4('0x35')]));_0x482a55[_0x2bc4('0x34')]=_0x482a55['attributes']['length']?_0x482a55['attributes']:_0x4b2888[_0x2bc4('0x2f')];if(_0x4a0327[_0x2bc4('0x30')]['includeAll']){_0x482a55[_0x2bc4('0x3e')]=[{'all':!![]}];}_0x482a55=_['merge']({},_0x482a55,_0x4a0327[_0x2bc4('0x3d')]);return db[_0x2bc4('0x2b')][_0x2bc4('0x44')](_0x482a55)[_0x2bc4('0x25')](handleEntityNotFound(_0x3408e7,null))[_0x2bc4('0x25')](respondWithResult(_0x3408e7,null))[_0x2bc4('0x41')](handleError(_0x3408e7,null));};exports[_0x2bc4('0x45')]=function(_0x2b6847,_0x1cac2a){return db[_0x2bc4('0x2b')][_0x2bc4('0x45')](_0x2b6847[_0x2bc4('0x46')],{})['then'](respondWithResult(_0x1cac2a,0xc9))[_0x2bc4('0x41')](handleError(_0x1cac2a,null));};exports['update']=function(_0x53f35c,_0xfda79d){if(_0x53f35c['body']['id']){delete _0x53f35c['body']['id'];}return db[_0x2bc4('0x2b')][_0x2bc4('0x44')]({'where':{'id':_0x53f35c[_0x2bc4('0x43')]['id']}})['then'](handleEntityNotFound(_0xfda79d,null))[_0x2bc4('0x25')](saveUpdates(_0x53f35c[_0x2bc4('0x46')],null))[_0x2bc4('0x25')](respondWithResult(_0xfda79d,null))[_0x2bc4('0x41')](handleError(_0xfda79d,null));};exports['destroy']=function(_0x16db91,_0x3b0e47){return db[_0x2bc4('0x2b')][_0x2bc4('0x44')]({'where':{'id':_0x16db91[_0x2bc4('0x43')]['id']}})[_0x2bc4('0x25')](handleEntityNotFound(_0x3b0e47,null))[_0x2bc4('0x25')](removeEntity(_0x3b0e47,null))['catch'](handleError(_0x3b0e47,null));};exports['getFields']=function(_0x133e76,_0x2eb029,_0x331675){var _0x54953f={};var _0x39167c={};var _0x1a6137;var _0xa7880d;return db[_0x2bc4('0x2b')][_0x2bc4('0x47')]({'where':{'id':_0x133e76[_0x2bc4('0x43')]['id']}})['then'](handleEntityNotFound(_0x2eb029,null))['then'](function(_0x1ff493){if(_0x1ff493){_0x1a6137=_0x1ff493;_0x39167c[_0x2bc4('0x2f')]=_[_0x2bc4('0x31')](db[_0x2bc4('0x48')]['rawAttributes']);_0x39167c[_0x2bc4('0x30')]=_[_0x2bc4('0x31')](_0x133e76[_0x2bc4('0x30')]);_0x39167c[_0x2bc4('0x32')]=_['intersection'](_0x39167c[_0x2bc4('0x2f')],_0x39167c[_0x2bc4('0x30')]);_0x54953f[_0x2bc4('0x34')]=_['intersection'](_0x39167c['model'],qs[_0x2bc4('0x35')](_0x133e76[_0x2bc4('0x30')][_0x2bc4('0x35')]));_0x54953f[_0x2bc4('0x34')]=_0x54953f[_0x2bc4('0x34')][_0x2bc4('0x36')]?_0x54953f[_0x2bc4('0x34')]:_0x39167c['model'];_0x54953f[_0x2bc4('0x39')]=qs[_0x2bc4('0x49')](_0x133e76['query'][_0x2bc4('0x49')]);_0x54953f[_0x2bc4('0x3a')]=qs['filters'](_[_0x2bc4('0x3b')](_0x133e76[_0x2bc4('0x30')],_0x39167c[_0x2bc4('0x32')]));if(_0x133e76[_0x2bc4('0x30')][_0x2bc4('0x4a')]){_0x54953f[_0x2bc4('0x3a')]=_[_0x2bc4('0x3c')](_0x54953f[_0x2bc4('0x3a')],{'$or':_[_0x2bc4('0x2a')](_0x54953f['attributes'],function(_0x25ad6d){var _0x44c82f={};_0x44c82f[_0x25ad6d]={'$like':'%'+_0x133e76[_0x2bc4('0x30')][_0x2bc4('0x4a')]+'%'};return _0x44c82f;})});}_0x54953f=_[_0x2bc4('0x3c')]({},_0x54953f,_0x133e76['options']);return _0x1a6137[_0x2bc4('0x4b')](_0x54953f);}})[_0x2bc4('0x25')](function(_0x316734){if(_0x316734){_0xa7880d=_0x316734['length'];if(!_0x133e76['query'][_0x2bc4('0x37')]('nolimit')){_0x54953f[_0x2bc4('0x1f')]=qs['limit'](_0x133e76[_0x2bc4('0x30')][_0x2bc4('0x1f')]);_0x54953f[_0x2bc4('0x1d')]=qs[_0x2bc4('0x1d')](_0x133e76[_0x2bc4('0x30')][_0x2bc4('0x1d')]);}return _0x1a6137[_0x2bc4('0x4b')](_0x54953f);}})[_0x2bc4('0x25')](function(_0x4a11ee){if(_0x4a11ee){return _0x4a11ee?{'count':_0xa7880d,'rows':_0x4a11ee}:null;}})['then'](respondWithResult(_0x2eb029,null))[_0x2bc4('0x41')](handleError(_0x2eb029,null));};exports[_0x2bc4('0x4c')]=function(_0x1cc87e,_0x275588,_0x5946a7){var _0x4ffbf7={};var _0x230155={};var _0x5f0437;var _0x410753;return db[_0x2bc4('0x2b')][_0x2bc4('0x47')]({'where':{'id':_0x1cc87e[_0x2bc4('0x43')]['id']}})[_0x2bc4('0x25')](handleEntityNotFound(_0x275588,null))[_0x2bc4('0x25')](function(_0x55bb9a){if(_0x55bb9a){_0x5f0437=_0x55bb9a;_0x230155[_0x2bc4('0x2f')]=_[_0x2bc4('0x31')](db['ServicenowField'][_0x2bc4('0x2c')]);_0x230155[_0x2bc4('0x30')]=_[_0x2bc4('0x31')](_0x1cc87e[_0x2bc4('0x30')]);_0x230155[_0x2bc4('0x32')]=_[_0x2bc4('0x33')](_0x230155[_0x2bc4('0x2f')],_0x230155[_0x2bc4('0x30')]);_0x4ffbf7[_0x2bc4('0x34')]=_[_0x2bc4('0x33')](_0x230155[_0x2bc4('0x2f')],qs['fields'](_0x1cc87e[_0x2bc4('0x30')]['fields']));_0x4ffbf7[_0x2bc4('0x34')]=_0x4ffbf7['attributes'][_0x2bc4('0x36')]?_0x4ffbf7[_0x2bc4('0x34')]:_0x230155[_0x2bc4('0x2f')];_0x4ffbf7[_0x2bc4('0x39')]=qs[_0x2bc4('0x49')](_0x1cc87e['query'][_0x2bc4('0x49')]);_0x4ffbf7['where']=qs[_0x2bc4('0x32')](_[_0x2bc4('0x3b')](_0x1cc87e[_0x2bc4('0x30')],_0x230155[_0x2bc4('0x32')]));if(_0x1cc87e[_0x2bc4('0x30')][_0x2bc4('0x4a')]){_0x4ffbf7['where']=_[_0x2bc4('0x3c')](_0x4ffbf7[_0x2bc4('0x3a')],{'$or':_['map'](_0x4ffbf7[_0x2bc4('0x34')],function(_0x352a92){var _0x4b2e30={};_0x4b2e30[_0x352a92]={'$like':'%'+_0x1cc87e[_0x2bc4('0x30')][_0x2bc4('0x4a')]+'%'};return _0x4b2e30;})});}_0x4ffbf7=_[_0x2bc4('0x3c')]({},_0x4ffbf7,_0x1cc87e[_0x2bc4('0x3d')]);return _0x5f0437[_0x2bc4('0x4c')](_0x4ffbf7);}})['then'](function(_0x41f022){if(_0x41f022){_0x410753=_0x41f022[_0x2bc4('0x36')];if(!_0x1cc87e[_0x2bc4('0x30')][_0x2bc4('0x37')](_0x2bc4('0x38'))){_0x4ffbf7[_0x2bc4('0x1f')]=qs[_0x2bc4('0x1f')](_0x1cc87e[_0x2bc4('0x30')][_0x2bc4('0x1f')]);_0x4ffbf7[_0x2bc4('0x1d')]=qs[_0x2bc4('0x1d')](_0x1cc87e[_0x2bc4('0x30')][_0x2bc4('0x1d')]);}return _0x5f0437[_0x2bc4('0x4c')](_0x4ffbf7);}})[_0x2bc4('0x25')](function(_0xcf38d0){if(_0xcf38d0){return _0xcf38d0?{'count':_0x410753,'rows':_0xcf38d0}:null;}})[_0x2bc4('0x25')](respondWithResult(_0x275588,null))[_0x2bc4('0x41')](handleError(_0x275588,null));};exports['getDescriptions']=function(_0x591db0,_0x561011,_0x57445f){var _0x371123={};var _0x2663ab={};var _0x29f2e1;var _0x3f7393;return db[_0x2bc4('0x2b')]['findOne']({'where':{'id':_0x591db0[_0x2bc4('0x43')]['id']}})[_0x2bc4('0x25')](handleEntityNotFound(_0x561011,null))[_0x2bc4('0x25')](function(_0x1c524c){if(_0x1c524c){_0x29f2e1=_0x1c524c;_0x2663ab['model']=_['keys'](db[_0x2bc4('0x48')]['rawAttributes']);_0x2663ab[_0x2bc4('0x30')]=_[_0x2bc4('0x31')](_0x591db0[_0x2bc4('0x30')]);_0x2663ab[_0x2bc4('0x32')]=_[_0x2bc4('0x33')](_0x2663ab[_0x2bc4('0x2f')],_0x2663ab[_0x2bc4('0x30')]);_0x371123[_0x2bc4('0x34')]=_[_0x2bc4('0x33')](_0x2663ab[_0x2bc4('0x2f')],qs[_0x2bc4('0x35')](_0x591db0['query'][_0x2bc4('0x35')]));_0x371123[_0x2bc4('0x34')]=_0x371123[_0x2bc4('0x34')][_0x2bc4('0x36')]?_0x371123[_0x2bc4('0x34')]:_0x2663ab[_0x2bc4('0x2f')];_0x371123[_0x2bc4('0x39')]=qs['sort'](_0x591db0['query']['sort']);_0x371123[_0x2bc4('0x3a')]=qs[_0x2bc4('0x32')](_[_0x2bc4('0x3b')](_0x591db0[_0x2bc4('0x30')],_0x2663ab[_0x2bc4('0x32')]));if(_0x591db0[_0x2bc4('0x30')][_0x2bc4('0x4a')]){_0x371123[_0x2bc4('0x3a')]=_[_0x2bc4('0x3c')](_0x371123['where'],{'$or':_[_0x2bc4('0x2a')](_0x371123['attributes'],function(_0x5f2a53){var _0xa0e053={};_0xa0e053[_0x5f2a53]={'$like':'%'+_0x591db0[_0x2bc4('0x30')]['filter']+'%'};return _0xa0e053;})});}_0x371123=_['merge']({},_0x371123,_0x591db0[_0x2bc4('0x3d')]);return _0x29f2e1[_0x2bc4('0x4d')](_0x371123);}})['then'](function(_0x590f10){if(_0x590f10){_0x3f7393=_0x590f10[_0x2bc4('0x36')];if(!_0x591db0['query'][_0x2bc4('0x37')]('nolimit')){_0x371123[_0x2bc4('0x1f')]=qs[_0x2bc4('0x1f')](_0x591db0[_0x2bc4('0x30')][_0x2bc4('0x1f')]);_0x371123[_0x2bc4('0x1d')]=qs[_0x2bc4('0x1d')](_0x591db0[_0x2bc4('0x30')][_0x2bc4('0x1d')]);}return _0x29f2e1['getDescriptions'](_0x371123);}})['then'](function(_0x347551){if(_0x347551){return _0x347551?{'count':_0x3f7393,'rows':_0x347551}:null;}})['then'](respondWithResult(_0x561011,null))['catch'](handleError(_0x561011,null));}; \ No newline at end of file +var _0x5ae0=['end','sendStatus','error','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','keys','filters','intersection','model','attributes','query','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','catch','show','params','fields','find','create','body','getFields','findOne','ServicenowField','options','getSubjects','getDescriptions','eml-format','rimraf','moment','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x79f17d,_0x265f13){var _0x399ef1=function(_0x2d37df){while(--_0x2d37df){_0x79f17d['push'](_0x79f17d['shift']());}};_0x399ef1(++_0x265f13);}(_0x5ae0,0xbe));var _0x05ae=function(_0x1ef396,_0x48a379){_0x1ef396=_0x1ef396-0x0;var _0x2f4170=_0x5ae0[_0x1ef396];return _0x2f4170;};'use strict';var emlformat=require(_0x05ae('0x0'));var rimraf=require(_0x05ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x05ae('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x05ae('0x3'));var util=require('util');var path=require(_0x05ae('0x4'));var sox=require(_0x05ae('0x5'));var csv=require(_0x05ae('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x05ae('0x7'));var _=require(_0x05ae('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x05ae('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x05ae('0xa'));var Redis=require(_0x05ae('0xb'));var authService=require(_0x05ae('0xc'));var qs=require(_0x05ae('0xd'));var as=require(_0x05ae('0xe'));var hardwareService=require(_0x05ae('0xf'));var logger=require(_0x05ae('0x10'))(_0x05ae('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x05ae('0x12'))['db'];function respondWithStatusCode(_0x457b3b,_0x1ee901){_0x1ee901=_0x1ee901||0xcc;return function(_0x1d77b2){if(_0x1d77b2){return _0x457b3b['sendStatus'](_0x1ee901);}return _0x457b3b[_0x05ae('0x13')](_0x1ee901)['end']();};}function respondWithResult(_0x34eafe,_0x2b43c7){_0x2b43c7=_0x2b43c7||0xc8;return function(_0x49bc91){if(_0x49bc91){return _0x34eafe[_0x05ae('0x13')](_0x2b43c7)[_0x05ae('0x14')](_0x49bc91);}};}function respondWithFilteredResult(_0x45e0c7,_0x1841d6){return function(_0xd79d32){if(_0xd79d32){var _0x3da232=typeof _0x1841d6[_0x05ae('0x15')]===_0x05ae('0x16')&&typeof _0x1841d6[_0x05ae('0x17')]===_0x05ae('0x16');var _0x1d1f59=_0xd79d32[_0x05ae('0x18')];var _0x47abf2=_0x3da232?0x0:_0x1841d6[_0x05ae('0x15')];var _0x1351e9=_0x3da232?_0xd79d32['count']:_0x1841d6[_0x05ae('0x15')]+_0x1841d6[_0x05ae('0x17')];var _0x3c6358;if(_0x1351e9>=_0x1d1f59){_0x1351e9=_0x1d1f59;_0x3c6358=0xc8;}else{_0x3c6358=0xce;}_0x45e0c7['status'](_0x3c6358);return _0x45e0c7[_0x05ae('0x19')](_0x05ae('0x1a'),_0x47abf2+'-'+_0x1351e9+'/'+_0x1d1f59)[_0x05ae('0x14')](_0xd79d32);}return null;};}function patchUpdates(_0x1863be){return function(_0x55b386){try{jsonpatch[_0x05ae('0x1b')](_0x55b386,_0x1863be,!![]);}catch(_0x416586){return BPromise[_0x05ae('0x1c')](_0x416586);}return _0x55b386[_0x05ae('0x1d')]();};}function saveUpdates(_0x1de7fa,_0x34c7ea){return function(_0x4c2c5a){if(_0x4c2c5a){return _0x4c2c5a[_0x05ae('0x1e')](_0x1de7fa)[_0x05ae('0x1f')](function(_0x139d64){return _0x139d64;});}return null;};}function removeEntity(_0x52e331,_0x3db056){return function(_0x1cabdd){if(_0x1cabdd){return _0x1cabdd['destroy']()[_0x05ae('0x1f')](function(){_0x52e331[_0x05ae('0x13')](0xcc)[_0x05ae('0x20')]();});}};}function handleEntityNotFound(_0x4a43a4,_0x2d5ea4){return function(_0x28ff7c){if(!_0x28ff7c){_0x4a43a4[_0x05ae('0x21')](0x194);}return _0x28ff7c;};}function handleError(_0x6c6086,_0x1d1c42){_0x1d1c42=_0x1d1c42||0x1f4;return function(_0x49c46a){logger[_0x05ae('0x22')](_0x49c46a[_0x05ae('0x23')]);if(_0x49c46a[_0x05ae('0x24')]){delete _0x49c46a[_0x05ae('0x24')];}_0x6c6086[_0x05ae('0x13')](_0x1d1c42)['send'](_0x49c46a);};}exports[_0x05ae('0x25')]=function(_0x5aa771,_0x42a002){var _0x21a753={},_0x350e6d={},_0x1f4eea={'count':0x0,'rows':[]};var _0x294079=_[_0x05ae('0x26')](db[_0x05ae('0x27')][_0x05ae('0x28')],function(_0x300e83){return{'name':_0x300e83[_0x05ae('0x29')],'type':_0x300e83[_0x05ae('0x2a')]['key']};});_0x350e6d['model']=_[_0x05ae('0x26')](_0x294079,_0x05ae('0x24'));_0x350e6d['query']=_[_0x05ae('0x2b')](_0x5aa771['query']);_0x350e6d[_0x05ae('0x2c')]=_[_0x05ae('0x2d')](_0x350e6d[_0x05ae('0x2e')],_0x350e6d['query']);_0x21a753[_0x05ae('0x2f')]=_[_0x05ae('0x2d')](_0x350e6d[_0x05ae('0x2e')],qs['fields'](_0x5aa771[_0x05ae('0x30')]['fields']));_0x21a753[_0x05ae('0x2f')]=_0x21a753[_0x05ae('0x2f')][_0x05ae('0x31')]?_0x21a753['attributes']:_0x350e6d[_0x05ae('0x2e')];if(!_0x5aa771[_0x05ae('0x30')][_0x05ae('0x32')](_0x05ae('0x33'))){_0x21a753[_0x05ae('0x17')]=qs[_0x05ae('0x17')](_0x5aa771[_0x05ae('0x30')][_0x05ae('0x17')]);_0x21a753[_0x05ae('0x15')]=qs[_0x05ae('0x15')](_0x5aa771[_0x05ae('0x30')][_0x05ae('0x15')]);}_0x21a753[_0x05ae('0x34')]=qs[_0x05ae('0x35')](_0x5aa771[_0x05ae('0x30')][_0x05ae('0x35')]);_0x21a753[_0x05ae('0x36')]=qs[_0x05ae('0x2c')](_[_0x05ae('0x37')](_0x5aa771[_0x05ae('0x30')],_0x350e6d[_0x05ae('0x2c')]),_0x294079);if(_0x5aa771['query']['filter']){_0x21a753[_0x05ae('0x36')]=_[_0x05ae('0x38')](_0x21a753[_0x05ae('0x36')],{'$or':_[_0x05ae('0x26')](_0x294079,function(_0x26fdd7){if(_0x26fdd7[_0x05ae('0x2a')]!=='VIRTUAL'){var _0x175748={};_0x175748[_0x26fdd7[_0x05ae('0x24')]]={'$like':'%'+_0x5aa771[_0x05ae('0x30')][_0x05ae('0x39')]+'%'};return _0x175748;}})});}_0x21a753=_[_0x05ae('0x38')]({},_0x21a753,_0x5aa771['options']);var _0x17e4d6={'where':_0x21a753['where']};return db[_0x05ae('0x27')]['count'](_0x17e4d6)[_0x05ae('0x1f')](function(_0x39bfef){_0x1f4eea[_0x05ae('0x18')]=_0x39bfef;if(_0x5aa771[_0x05ae('0x30')][_0x05ae('0x3a')]){_0x21a753[_0x05ae('0x3b')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x05ae('0x3c')](_0x21a753);})[_0x05ae('0x1f')](function(_0x171104){_0x1f4eea['rows']=_0x171104;return _0x1f4eea;})[_0x05ae('0x1f')](respondWithFilteredResult(_0x42a002,_0x21a753))[_0x05ae('0x3d')](handleError(_0x42a002,null));};exports[_0x05ae('0x3e')]=function(_0x4aaa9d,_0x2904fc){var _0x15446f={'raw':![],'where':{'id':_0x4aaa9d[_0x05ae('0x3f')]['id']}},_0x4d00e9={};_0x4d00e9[_0x05ae('0x2e')]=_['keys'](db['ServicenowConfiguration'][_0x05ae('0x28')]);_0x4d00e9[_0x05ae('0x30')]=_[_0x05ae('0x2b')](_0x4aaa9d['query']);_0x4d00e9[_0x05ae('0x2c')]=_[_0x05ae('0x2d')](_0x4d00e9[_0x05ae('0x2e')],_0x4d00e9[_0x05ae('0x30')]);_0x15446f[_0x05ae('0x2f')]=_[_0x05ae('0x2d')](_0x4d00e9[_0x05ae('0x2e')],qs['fields'](_0x4aaa9d[_0x05ae('0x30')][_0x05ae('0x40')]));_0x15446f['attributes']=_0x15446f[_0x05ae('0x2f')][_0x05ae('0x31')]?_0x15446f[_0x05ae('0x2f')]:_0x4d00e9[_0x05ae('0x2e')];if(_0x4aaa9d[_0x05ae('0x30')]['includeAll']){_0x15446f[_0x05ae('0x3b')]=[{'all':!![]}];}_0x15446f=_[_0x05ae('0x38')]({},_0x15446f,_0x4aaa9d['options']);return db[_0x05ae('0x27')][_0x05ae('0x41')](_0x15446f)[_0x05ae('0x1f')](handleEntityNotFound(_0x2904fc,null))[_0x05ae('0x1f')](respondWithResult(_0x2904fc,null))[_0x05ae('0x3d')](handleError(_0x2904fc,null));};exports[_0x05ae('0x42')]=function(_0x4cd0d0,_0xf4613c){return db[_0x05ae('0x27')][_0x05ae('0x42')](_0x4cd0d0[_0x05ae('0x43')],{})[_0x05ae('0x1f')](respondWithResult(_0xf4613c,0xc9))[_0x05ae('0x3d')](handleError(_0xf4613c,null));};exports[_0x05ae('0x1e')]=function(_0x266039,_0x7f65d7){if(_0x266039[_0x05ae('0x43')]['id']){delete _0x266039[_0x05ae('0x43')]['id'];}return db[_0x05ae('0x27')][_0x05ae('0x41')]({'where':{'id':_0x266039[_0x05ae('0x3f')]['id']}})[_0x05ae('0x1f')](handleEntityNotFound(_0x7f65d7,null))['then'](saveUpdates(_0x266039['body'],null))[_0x05ae('0x1f')](respondWithResult(_0x7f65d7,null))[_0x05ae('0x3d')](handleError(_0x7f65d7,null));};exports['destroy']=function(_0x65d11,_0x28fa0b){return db['ServicenowConfiguration'][_0x05ae('0x41')]({'where':{'id':_0x65d11[_0x05ae('0x3f')]['id']}})[_0x05ae('0x1f')](handleEntityNotFound(_0x28fa0b,null))[_0x05ae('0x1f')](removeEntity(_0x28fa0b,null))[_0x05ae('0x3d')](handleError(_0x28fa0b,null));};exports[_0x05ae('0x44')]=function(_0xb432b3,_0x5aed1b,_0xa08616){var _0x525037={};var _0x50d5a5={};var _0xbf4f35;var _0x1dc7c8;return db[_0x05ae('0x27')][_0x05ae('0x45')]({'where':{'id':_0xb432b3[_0x05ae('0x3f')]['id']}})[_0x05ae('0x1f')](handleEntityNotFound(_0x5aed1b,null))['then'](function(_0x5de254){if(_0x5de254){_0xbf4f35=_0x5de254;_0x50d5a5['model']=_[_0x05ae('0x2b')](db[_0x05ae('0x46')][_0x05ae('0x28')]);_0x50d5a5[_0x05ae('0x30')]=_[_0x05ae('0x2b')](_0xb432b3[_0x05ae('0x30')]);_0x50d5a5['filters']=_[_0x05ae('0x2d')](_0x50d5a5[_0x05ae('0x2e')],_0x50d5a5[_0x05ae('0x30')]);_0x525037[_0x05ae('0x2f')]=_[_0x05ae('0x2d')](_0x50d5a5['model'],qs[_0x05ae('0x40')](_0xb432b3[_0x05ae('0x30')][_0x05ae('0x40')]));_0x525037[_0x05ae('0x2f')]=_0x525037['attributes'][_0x05ae('0x31')]?_0x525037[_0x05ae('0x2f')]:_0x50d5a5[_0x05ae('0x2e')];_0x525037[_0x05ae('0x34')]=qs[_0x05ae('0x35')](_0xb432b3[_0x05ae('0x30')][_0x05ae('0x35')]);_0x525037['where']=qs[_0x05ae('0x2c')](_[_0x05ae('0x37')](_0xb432b3[_0x05ae('0x30')],_0x50d5a5['filters']));if(_0xb432b3['query'][_0x05ae('0x39')]){_0x525037[_0x05ae('0x36')]=_['merge'](_0x525037['where'],{'$or':_[_0x05ae('0x26')](_0x525037['attributes'],function(_0x1069a8){var _0x4e54ac={};_0x4e54ac[_0x1069a8]={'$like':'%'+_0xb432b3[_0x05ae('0x30')][_0x05ae('0x39')]+'%'};return _0x4e54ac;})});}_0x525037=_[_0x05ae('0x38')]({},_0x525037,_0xb432b3[_0x05ae('0x47')]);return _0xbf4f35['getFields'](_0x525037);}})[_0x05ae('0x1f')](function(_0xb8801a){if(_0xb8801a){_0x1dc7c8=_0xb8801a[_0x05ae('0x31')];if(!_0xb432b3[_0x05ae('0x30')][_0x05ae('0x32')](_0x05ae('0x33'))){_0x525037[_0x05ae('0x17')]=qs['limit'](_0xb432b3['query'][_0x05ae('0x17')]);_0x525037[_0x05ae('0x15')]=qs['offset'](_0xb432b3[_0x05ae('0x30')][_0x05ae('0x15')]);}return _0xbf4f35[_0x05ae('0x44')](_0x525037);}})[_0x05ae('0x1f')](function(_0x5d2572){if(_0x5d2572){return _0x5d2572?{'count':_0x1dc7c8,'rows':_0x5d2572}:null;}})[_0x05ae('0x1f')](respondWithResult(_0x5aed1b,null))[_0x05ae('0x3d')](handleError(_0x5aed1b,null));};exports[_0x05ae('0x48')]=function(_0x1089e1,_0x1dfeff,_0x4e0fd6){var _0x1e883f={};var _0x1794a1={};var _0x4b3ed5;var _0x201d45;return db[_0x05ae('0x27')][_0x05ae('0x45')]({'where':{'id':_0x1089e1[_0x05ae('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1dfeff,null))[_0x05ae('0x1f')](function(_0x4b9e7e){if(_0x4b9e7e){_0x4b3ed5=_0x4b9e7e;_0x1794a1['model']=_[_0x05ae('0x2b')](db[_0x05ae('0x46')][_0x05ae('0x28')]);_0x1794a1['query']=_[_0x05ae('0x2b')](_0x1089e1[_0x05ae('0x30')]);_0x1794a1[_0x05ae('0x2c')]=_['intersection'](_0x1794a1[_0x05ae('0x2e')],_0x1794a1['query']);_0x1e883f[_0x05ae('0x2f')]=_[_0x05ae('0x2d')](_0x1794a1[_0x05ae('0x2e')],qs[_0x05ae('0x40')](_0x1089e1[_0x05ae('0x30')][_0x05ae('0x40')]));_0x1e883f[_0x05ae('0x2f')]=_0x1e883f[_0x05ae('0x2f')]['length']?_0x1e883f[_0x05ae('0x2f')]:_0x1794a1[_0x05ae('0x2e')];_0x1e883f['order']=qs[_0x05ae('0x35')](_0x1089e1['query'][_0x05ae('0x35')]);_0x1e883f[_0x05ae('0x36')]=qs['filters'](_[_0x05ae('0x37')](_0x1089e1[_0x05ae('0x30')],_0x1794a1[_0x05ae('0x2c')]));if(_0x1089e1[_0x05ae('0x30')][_0x05ae('0x39')]){_0x1e883f[_0x05ae('0x36')]=_[_0x05ae('0x38')](_0x1e883f['where'],{'$or':_[_0x05ae('0x26')](_0x1e883f[_0x05ae('0x2f')],function(_0x1c0111){var _0x51e15a={};_0x51e15a[_0x1c0111]={'$like':'%'+_0x1089e1[_0x05ae('0x30')]['filter']+'%'};return _0x51e15a;})});}_0x1e883f=_[_0x05ae('0x38')]({},_0x1e883f,_0x1089e1['options']);return _0x4b3ed5[_0x05ae('0x48')](_0x1e883f);}})[_0x05ae('0x1f')](function(_0x35d655){if(_0x35d655){_0x201d45=_0x35d655['length'];if(!_0x1089e1[_0x05ae('0x30')]['hasOwnProperty']('nolimit')){_0x1e883f['limit']=qs[_0x05ae('0x17')](_0x1089e1['query'][_0x05ae('0x17')]);_0x1e883f['offset']=qs[_0x05ae('0x15')](_0x1089e1[_0x05ae('0x30')][_0x05ae('0x15')]);}return _0x4b3ed5[_0x05ae('0x48')](_0x1e883f);}})['then'](function(_0x10aa93){if(_0x10aa93){return _0x10aa93?{'count':_0x201d45,'rows':_0x10aa93}:null;}})[_0x05ae('0x1f')](respondWithResult(_0x1dfeff,null))[_0x05ae('0x3d')](handleError(_0x1dfeff,null));};exports[_0x05ae('0x49')]=function(_0x48e9a3,_0x57611f,_0x2b3a4b){var _0x360bcc={};var _0x50cf0f={};var _0x5384a5;var _0x47641f;return db[_0x05ae('0x27')][_0x05ae('0x45')]({'where':{'id':_0x48e9a3[_0x05ae('0x3f')]['id']}})[_0x05ae('0x1f')](handleEntityNotFound(_0x57611f,null))['then'](function(_0x551f0e){if(_0x551f0e){_0x5384a5=_0x551f0e;_0x50cf0f[_0x05ae('0x2e')]=_[_0x05ae('0x2b')](db[_0x05ae('0x46')][_0x05ae('0x28')]);_0x50cf0f[_0x05ae('0x30')]=_[_0x05ae('0x2b')](_0x48e9a3[_0x05ae('0x30')]);_0x50cf0f['filters']=_[_0x05ae('0x2d')](_0x50cf0f[_0x05ae('0x2e')],_0x50cf0f[_0x05ae('0x30')]);_0x360bcc[_0x05ae('0x2f')]=_['intersection'](_0x50cf0f['model'],qs[_0x05ae('0x40')](_0x48e9a3['query']['fields']));_0x360bcc[_0x05ae('0x2f')]=_0x360bcc[_0x05ae('0x2f')][_0x05ae('0x31')]?_0x360bcc['attributes']:_0x50cf0f['model'];_0x360bcc['order']=qs[_0x05ae('0x35')](_0x48e9a3['query'][_0x05ae('0x35')]);_0x360bcc[_0x05ae('0x36')]=qs[_0x05ae('0x2c')](_[_0x05ae('0x37')](_0x48e9a3[_0x05ae('0x30')],_0x50cf0f[_0x05ae('0x2c')]));if(_0x48e9a3[_0x05ae('0x30')][_0x05ae('0x39')]){_0x360bcc[_0x05ae('0x36')]=_[_0x05ae('0x38')](_0x360bcc[_0x05ae('0x36')],{'$or':_['map'](_0x360bcc[_0x05ae('0x2f')],function(_0x3aaf5a){var _0x320d1d={};_0x320d1d[_0x3aaf5a]={'$like':'%'+_0x48e9a3['query']['filter']+'%'};return _0x320d1d;})});}_0x360bcc=_['merge']({},_0x360bcc,_0x48e9a3['options']);return _0x5384a5['getDescriptions'](_0x360bcc);}})[_0x05ae('0x1f')](function(_0x4c4eed){if(_0x4c4eed){_0x47641f=_0x4c4eed[_0x05ae('0x31')];if(!_0x48e9a3[_0x05ae('0x30')][_0x05ae('0x32')](_0x05ae('0x33'))){_0x360bcc[_0x05ae('0x17')]=qs[_0x05ae('0x17')](_0x48e9a3[_0x05ae('0x30')]['limit']);_0x360bcc[_0x05ae('0x15')]=qs[_0x05ae('0x15')](_0x48e9a3[_0x05ae('0x30')][_0x05ae('0x15')]);}return _0x5384a5[_0x05ae('0x49')](_0x360bcc);}})[_0x05ae('0x1f')](function(_0x3518d0){if(_0x3518d0){return _0x3518d0?{'count':_0x47641f,'rows':_0x3518d0}:null;}})['then'](respondWithResult(_0x57611f,null))[_0x05ae('0x3d')](handleError(_0x57611f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index e7109a5..04e1f65 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 _0xb79a=['request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','moment','bluebird'];(function(_0x5cd482,_0x1bcc41){var _0xc34e4c=function(_0x236447){while(--_0x236447){_0x5cd482['push'](_0x5cd482['shift']());}};_0xc34e4c(++_0x1bcc41);}(_0xb79a,0x18e));var _0xab79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb79a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xab79('0x0'));var util=require(_0xab79('0x1'));var logger=require('../../config/logger')(_0xab79('0x2'));var moment=require(_0xab79('0x3'));var BPromise=require(_0xab79('0x4'));var rp=require(_0xab79('0x5'));var fs=require('fs');var path=require(_0xab79('0x6'));var rimraf=require(_0xab79('0x7'));var config=require(_0xab79('0x8'));var attributes=require(_0xab79('0x9'));module['exports']=function(_0x1dae4,_0x4b0ad5){return _0x1dae4[_0xab79('0xa')](_0xab79('0xb'),attributes,{'tableName':_0xab79('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f59=['../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xecf746,_0x390352){var _0x5baa86=function(_0x339fe6){while(--_0x339fe6){_0xecf746['push'](_0xecf746['shift']());}};_0x5baa86(++_0x390352);}(_0x6f59,0x1be));var _0x96f5=function(_0x339300,_0x37a347){_0x339300=_0x339300-0x0;var _0x4b74f7=_0x6f59[_0x339300];return _0x4b74f7;};'use strict';var _=require(_0x96f5('0x0'));var util=require(_0x96f5('0x1'));var logger=require(_0x96f5('0x2'))(_0x96f5('0x3'));var moment=require(_0x96f5('0x4'));var BPromise=require(_0x96f5('0x5'));var rp=require(_0x96f5('0x6'));var fs=require('fs');var path=require(_0x96f5('0x7'));var rimraf=require(_0x96f5('0x8'));var config=require(_0x96f5('0x9'));var attributes=require(_0x96f5('0xa'));module[_0x96f5('0xb')]=function(_0x598154,_0xf6cd7d){return _0x598154['define'](_0x96f5('0xc'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 2d6c8b4..0d1d4d1 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 _0x43b7=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x19a25a,_0x146829){var _0x3cc6e6=function(_0x452c17){while(--_0x452c17){_0x19a25a['push'](_0x19a25a['shift']());}};_0x3cc6e6(++_0x146829);}(_0x43b7,0x1df));var _0x743b=function(_0x3e371e,_0x7a66c0){_0x3e371e=_0x3e371e-0x0;var _0x1e5c9e=_0x43b7[_0x3e371e];return _0x1e5c9e;};'use strict';var _=require(_0x743b('0x0'));var util=require(_0x743b('0x1'));var moment=require(_0x743b('0x2'));var BPromise=require(_0x743b('0x3'));var rs=require(_0x743b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x743b('0x5'))['db'];var utils=require(_0x743b('0x6'));var logger=require(_0x743b('0x7'))(_0x743b('0x8'));var config=require('../../config/environment');var jayson=require(_0x743b('0x9'));var client=jayson['client'][_0x743b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdaf4,_0x546405,_0x538605){return new BPromise(function(_0x107ef9,_0x422eca){return client['request'](_0x3cdaf4,_0x538605)[_0x743b('0xb')](function(_0x15f29b){logger[_0x743b('0xc')](_0x743b('0xd'),_0x546405,_0x743b('0xe'));logger[_0x743b('0xf')](_0x743b('0x10'),_0x546405,_0x743b('0xe'),JSON['stringify'](_0x15f29b));if(_0x15f29b[_0x743b('0x11')]){if(_0x15f29b[_0x743b('0x11')][_0x743b('0x12')]===0x1f4){logger[_0x743b('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x546405,_0x15f29b[_0x743b('0x11')][_0x743b('0x13')]);return _0x422eca(_0x15f29b[_0x743b('0x11')][_0x743b('0x13')]);}logger['error'](_0x743b('0xd'),_0x546405,_0x15f29b[_0x743b('0x11')]['message']);return _0x107ef9(_0x15f29b[_0x743b('0x11')][_0x743b('0x13')]);}else{logger[_0x743b('0xc')](_0x743b('0xd'),_0x546405,_0x743b('0xe'));_0x107ef9(_0x15f29b[_0x743b('0x14')][_0x743b('0x13')]);}})[_0x743b('0x15')](function(_0x4aed6b){logger[_0x743b('0x11')](_0x743b('0xd'),_0x546405,_0x4aed6b);_0x422eca(_0x4aed6b);});});} \ No newline at end of file +var _0x2a64=['info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a64,0xc1));var _0x42a6=function(_0x191313,_0x400f2c){_0x191313=_0x191313-0x0;var _0x1997ed=_0x2a64[_0x191313];return _0x1997ed;};'use strict';var _=require(_0x42a6('0x0'));var util=require(_0x42a6('0x1'));var moment=require(_0x42a6('0x2'));var BPromise=require(_0x42a6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42a6('0x4'));var db=require(_0x42a6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x42a6('0x6'))(_0x42a6('0x7'));var config=require(_0x42a6('0x8'));var jayson=require(_0x42a6('0x9'));var client=jayson[_0x42a6('0xa')][_0x42a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5aba6e,_0x5c08d9,_0x1ea89c){return new BPromise(function(_0x347c36,_0x5f4616){return client[_0x42a6('0xc')](_0x5aba6e,_0x1ea89c)[_0x42a6('0xd')](function(_0x1bad6a){logger[_0x42a6('0xe')](_0x42a6('0xf'),_0x5c08d9,_0x42a6('0x10'));logger[_0x42a6('0x11')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5c08d9,'request\x20sent',JSON['stringify'](_0x1bad6a));if(_0x1bad6a[_0x42a6('0x12')]){if(_0x1bad6a[_0x42a6('0x12')][_0x42a6('0x13')]===0x1f4){logger[_0x42a6('0x12')](_0x42a6('0xf'),_0x5c08d9,_0x1bad6a[_0x42a6('0x12')][_0x42a6('0x14')]);return _0x5f4616(_0x1bad6a[_0x42a6('0x12')]['message']);}logger['error'](_0x42a6('0xf'),_0x5c08d9,_0x1bad6a['error'][_0x42a6('0x14')]);return _0x347c36(_0x1bad6a[_0x42a6('0x12')][_0x42a6('0x14')]);}else{logger[_0x42a6('0xe')](_0x42a6('0xf'),_0x5c08d9,'request\x20sent');_0x347c36(_0x1bad6a[_0x42a6('0x15')]['message']);}})[_0x42a6('0x16')](function(_0x57ce04){logger[_0x42a6('0x12')](_0x42a6('0xf'),_0x5c08d9,_0x57ce04);_0x5f4616(_0x57ce04);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index e48e8b2..7e10206 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 _0x1eac=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','exports'];(function(_0x3aa58f,_0x500047){var _0x3fbe31=function(_0x5e1770){while(--_0x5e1770){_0x3aa58f['push'](_0x3aa58f['shift']());}};_0x3fbe31(++_0x500047);}(_0x1eac,0x111));var _0xc1ea=function(_0x2de802,_0x344bbc){_0x2de802=_0x2de802-0x0;var _0x5281bc=_0x1eac[_0x2de802];return _0x5281bc;};'use strict';var multer=require('multer');var util=require(_0xc1ea('0x0'));var path=require(_0xc1ea('0x1'));var timeout=require(_0xc1ea('0x2'));var express=require(_0xc1ea('0x3'));var router=express[_0xc1ea('0x4')]();var fs_extra=require(_0xc1ea('0x5'));var auth=require(_0xc1ea('0x6'));var interaction=require(_0xc1ea('0x7'));var config=require(_0xc1ea('0x8'));var controller=require(_0xc1ea('0x9'));router[_0xc1ea('0xa')]('/',auth['isAuthenticated'](),controller[_0xc1ea('0xb')]);router[_0xc1ea('0xa')]('/:id',auth[_0xc1ea('0xc')](),controller[_0xc1ea('0xd')]);router[_0xc1ea('0xe')]('/',auth[_0xc1ea('0xc')](),controller[_0xc1ea('0xf')]);router[_0xc1ea('0x10')](_0xc1ea('0x11'),auth['isAuthenticated'](),controller[_0xc1ea('0x12')]);router[_0xc1ea('0x13')](_0xc1ea('0x11'),auth[_0xc1ea('0xc')](),controller['destroy']);module[_0xc1ea('0x14')]=router; \ No newline at end of file +var _0x9318=['get','/:id','show','post','create','put','update','destroy','util','path','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x45ff76,_0x494070){var _0x3c7050=function(_0x2164a9){while(--_0x2164a9){_0x45ff76['push'](_0x45ff76['shift']());}};_0x3c7050(++_0x494070);}(_0x9318,0x152));var _0x8931=function(_0x203451,_0x36cdd9){_0x203451=_0x203451-0x0;var _0x23dc34=_0x9318[_0x203451];return _0x23dc34;};'use strict';var multer=require('multer');var util=require(_0x8931('0x0'));var path=require(_0x8931('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8931('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x8931('0x3'));var config=require(_0x8931('0x4'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0x8931('0x5')](),controller[_0x8931('0x6')]);router[_0x8931('0x7')](_0x8931('0x8'),auth['isAuthenticated'](),controller[_0x8931('0x9')]);router[_0x8931('0xa')]('/',auth[_0x8931('0x5')](),controller[_0x8931('0xb')]);router[_0x8931('0xc')](_0x8931('0x8'),auth['isAuthenticated'](),controller[_0x8931('0xd')]);router['delete'](_0x8931('0x8'),auth[_0x8931('0x5')](),controller[_0x8931('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 0a7bc3f..deff5d9 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 _0xa8d5=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa8d5,0xe2));var _0x5a8d=function(_0x426e36,_0xe526b6){_0x426e36=_0x426e36-0x0;var _0x3c67bd=_0xa8d5[_0x426e36];return _0x3c67bd;};'use strict';var Sequelize=require(_0x5a8d('0x0'));module[_0x5a8d('0x1')]={'type':{'type':Sequelize[_0x5a8d('0x2')](_0x5a8d('0x3'),_0x5a8d('0x4'),_0x5a8d('0x5'),_0x5a8d('0x6'),'picklist'),'defaultValue':_0x5a8d('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5a8d('0x7')]},'keyType':{'type':Sequelize[_0x5a8d('0x2')]('string',_0x5a8d('0x4'),_0x5a8d('0x5'))},'keyContent':{'type':Sequelize[_0x5a8d('0x7')]},'idField':{'type':Sequelize[_0x5a8d('0x7')]},'nameField':{'type':Sequelize[_0x5a8d('0x7')]},'customField':{'type':Sequelize[_0x5a8d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5a8d('0x7')]}}; \ No newline at end of file +var _0x59cf=['STRING','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x59cf,0x8a));var _0xf59c=function(_0x336ca2,_0x1a813a){_0x336ca2=_0x336ca2-0x0;var _0xda59a6=_0x59cf[_0x336ca2];return _0xda59a6;};'use strict';var Sequelize=require(_0xf59c('0x0'));module[_0xf59c('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf59c('0x2'),_0xf59c('0x3'),_0xf59c('0x4'),_0xf59c('0x5'),'picklist'),'defaultValue':_0xf59c('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf59c('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xf59c('0x2'),'variable',_0xf59c('0x4'))},'keyContent':{'type':Sequelize[_0xf59c('0x6')]},'idField':{'type':Sequelize[_0xf59c('0x6')]},'nameField':{'type':Sequelize[_0xf59c('0x6')]},'customField':{'type':Sequelize[_0xf59c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 61424e9..d689a4b 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 _0x9076=['end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','name','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','ServicenowField','rows','show','params','include','options','catch','create','body','find','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9076,0x1b7));var _0x6907=function(_0x46ffda,_0x379ced){_0x46ffda=_0x46ffda-0x0;var _0x11c8f8=_0x9076[_0x46ffda];return _0x11c8f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6907('0x0'));var zipdir=require(_0x6907('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6907('0x2'));var BPromise=require(_0x6907('0x3'));var Mustache=require(_0x6907('0x4'));var util=require(_0x6907('0x5'));var path=require(_0x6907('0x6'));var sox=require(_0x6907('0x7'));var csv=require(_0x6907('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6907('0x9'));var _=require('lodash');var squel=require(_0x6907('0xa'));var crypto=require(_0x6907('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6907('0x8'));var querystring=require(_0x6907('0xc'));var Papa=require(_0x6907('0xd'));var Redis=require(_0x6907('0xe'));var authService=require(_0x6907('0xf'));var qs=require(_0x6907('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6907('0x11'))('api');var utils=require(_0x6907('0x12'));var config=require(_0x6907('0x13'));var licenseUtil=require(_0x6907('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2303a2,_0x30eab8){_0x30eab8=_0x30eab8||0xcc;return function(_0x51fbf5){if(_0x51fbf5){return _0x2303a2[_0x6907('0x15')](_0x30eab8);}return _0x2303a2[_0x6907('0x16')](_0x30eab8)[_0x6907('0x17')]();};}function respondWithResult(_0x5495b8,_0xf19b65){_0xf19b65=_0xf19b65||0xc8;return function(_0x3e248b){if(_0x3e248b){return _0x5495b8[_0x6907('0x16')](_0xf19b65)[_0x6907('0x18')](_0x3e248b);}};}function respondWithFilteredResult(_0x2cd510,_0xe9931a){return function(_0x19d456){if(_0x19d456){var _0x2c5a4f=typeof _0xe9931a[_0x6907('0x19')]===_0x6907('0x1a')&&typeof _0xe9931a[_0x6907('0x1b')]===_0x6907('0x1a');var _0x1073e8=_0x19d456[_0x6907('0x1c')];var _0x58646b=_0x2c5a4f?0x0:_0xe9931a[_0x6907('0x19')];var _0x39aa93=_0x2c5a4f?_0x19d456[_0x6907('0x1c')]:_0xe9931a[_0x6907('0x19')]+_0xe9931a['limit'];var _0x353e7a;if(_0x39aa93>=_0x1073e8){_0x39aa93=_0x1073e8;_0x353e7a=0xc8;}else{_0x353e7a=0xce;}_0x2cd510[_0x6907('0x16')](_0x353e7a);return _0x2cd510[_0x6907('0x1d')]('Content-Range',_0x58646b+'-'+_0x39aa93+'/'+_0x1073e8)['json'](_0x19d456);}return null;};}function patchUpdates(_0x4858a5){return function(_0x2f1cce){try{jsonpatch[_0x6907('0x1e')](_0x2f1cce,_0x4858a5,!![]);}catch(_0x7bb535){return BPromise[_0x6907('0x1f')](_0x7bb535);}return _0x2f1cce[_0x6907('0x20')]();};}function saveUpdates(_0x43306d,_0x1fa364){return function(_0xa49ab6){if(_0xa49ab6){return _0xa49ab6[_0x6907('0x21')](_0x43306d)['then'](function(_0x22e414){return _0x22e414;});}return null;};}function removeEntity(_0x4601fb,_0x5ac5eb){return function(_0xb2db8a){if(_0xb2db8a){return _0xb2db8a['destroy']()[_0x6907('0x22')](function(){_0x4601fb[_0x6907('0x16')](0xcc)[_0x6907('0x17')]();});}};}function handleEntityNotFound(_0x66ec9f,_0x47069a){return function(_0x8779a7){if(!_0x8779a7){_0x66ec9f[_0x6907('0x15')](0x194);}return _0x8779a7;};}function handleError(_0x18087a,_0x191bd1){_0x191bd1=_0x191bd1||0x1f4;return function(_0x2ae043){logger[_0x6907('0x23')](_0x2ae043['stack']);if(_0x2ae043['name']){delete _0x2ae043[_0x6907('0x24')];}_0x18087a[_0x6907('0x16')](_0x191bd1)['send'](_0x2ae043);};}exports[_0x6907('0x25')]=function(_0x4ea570,_0x295361){var _0x34c601={},_0x1098dc={},_0x584b80={'count':0x0,'rows':[]};var _0x1adac=_['map'](db['ServicenowField'][_0x6907('0x26')],function(_0x3392b6){return{'name':_0x3392b6['fieldName'],'type':_0x3392b6[_0x6907('0x27')]['key']};});_0x1098dc[_0x6907('0x28')]=_[_0x6907('0x29')](_0x1adac,'name');_0x1098dc[_0x6907('0x2a')]=_[_0x6907('0x2b')](_0x4ea570[_0x6907('0x2a')]);_0x1098dc[_0x6907('0x2c')]=_[_0x6907('0x2d')](_0x1098dc[_0x6907('0x28')],_0x1098dc[_0x6907('0x2a')]);_0x34c601[_0x6907('0x2e')]=_[_0x6907('0x2d')](_0x1098dc['model'],qs[_0x6907('0x2f')](_0x4ea570[_0x6907('0x2a')][_0x6907('0x2f')]));_0x34c601[_0x6907('0x2e')]=_0x34c601[_0x6907('0x2e')][_0x6907('0x30')]?_0x34c601[_0x6907('0x2e')]:_0x1098dc[_0x6907('0x28')];if(!_0x4ea570[_0x6907('0x2a')][_0x6907('0x31')]('nolimit')){_0x34c601['limit']=qs[_0x6907('0x1b')](_0x4ea570[_0x6907('0x2a')][_0x6907('0x1b')]);_0x34c601[_0x6907('0x19')]=qs[_0x6907('0x19')](_0x4ea570['query'][_0x6907('0x19')]);}_0x34c601['order']=qs[_0x6907('0x32')](_0x4ea570[_0x6907('0x2a')][_0x6907('0x32')]);_0x34c601['where']=qs[_0x6907('0x2c')](_[_0x6907('0x33')](_0x4ea570[_0x6907('0x2a')],_0x1098dc[_0x6907('0x2c')]),_0x1adac);if(_0x4ea570[_0x6907('0x2a')][_0x6907('0x34')]){_0x34c601[_0x6907('0x35')]=_[_0x6907('0x36')](_0x34c601[_0x6907('0x35')],{'$or':_[_0x6907('0x29')](_0x1adac,function(_0x39d627){if(_0x39d627[_0x6907('0x27')]!==_0x6907('0x37')){var _0x31338f={};_0x31338f[_0x39d627[_0x6907('0x24')]]={'$like':'%'+_0x4ea570['query'][_0x6907('0x34')]+'%'};return _0x31338f;}})});}_0x34c601=_[_0x6907('0x36')]({},_0x34c601,_0x4ea570['options']);var _0x5626f7={'where':_0x34c601[_0x6907('0x35')]};return db[_0x6907('0x38')][_0x6907('0x1c')](_0x5626f7)[_0x6907('0x22')](function(_0x1f6171){_0x584b80['count']=_0x1f6171;if(_0x4ea570[_0x6907('0x2a')]['includeAll']){_0x34c601['include']=[{'all':!![]}];}return db[_0x6907('0x38')]['findAll'](_0x34c601);})[_0x6907('0x22')](function(_0x2cfad5){_0x584b80[_0x6907('0x39')]=_0x2cfad5;return _0x584b80;})['then'](respondWithFilteredResult(_0x295361,_0x34c601))['catch'](handleError(_0x295361,null));};exports[_0x6907('0x3a')]=function(_0x585765,_0x5af5e3){var _0x13b710={'raw':!![],'where':{'id':_0x585765[_0x6907('0x3b')]['id']}},_0x9c938b={};_0x9c938b[_0x6907('0x28')]=_['keys'](db['ServicenowField'][_0x6907('0x26')]);_0x9c938b[_0x6907('0x2a')]=_[_0x6907('0x2b')](_0x585765[_0x6907('0x2a')]);_0x9c938b[_0x6907('0x2c')]=_[_0x6907('0x2d')](_0x9c938b[_0x6907('0x28')],_0x9c938b[_0x6907('0x2a')]);_0x13b710[_0x6907('0x2e')]=_['intersection'](_0x9c938b[_0x6907('0x28')],qs['fields'](_0x585765[_0x6907('0x2a')][_0x6907('0x2f')]));_0x13b710[_0x6907('0x2e')]=_0x13b710[_0x6907('0x2e')][_0x6907('0x30')]?_0x13b710[_0x6907('0x2e')]:_0x9c938b[_0x6907('0x28')];if(_0x585765[_0x6907('0x2a')]['includeAll']){_0x13b710[_0x6907('0x3c')]=[{'all':!![]}];}_0x13b710=_[_0x6907('0x36')]({},_0x13b710,_0x585765[_0x6907('0x3d')]);return db['ServicenowField']['find'](_0x13b710)['then'](handleEntityNotFound(_0x5af5e3,null))[_0x6907('0x22')](respondWithResult(_0x5af5e3,null))[_0x6907('0x3e')](handleError(_0x5af5e3,null));};exports[_0x6907('0x3f')]=function(_0x3a9522,_0x45e03f){return db[_0x6907('0x38')][_0x6907('0x3f')](_0x3a9522[_0x6907('0x40')],{})[_0x6907('0x22')](respondWithResult(_0x45e03f,0xc9))['catch'](handleError(_0x45e03f,null));};exports[_0x6907('0x21')]=function(_0x4f4a6c,_0x295d9b){if(_0x4f4a6c[_0x6907('0x40')]['id']){delete _0x4f4a6c[_0x6907('0x40')]['id'];}return db[_0x6907('0x38')][_0x6907('0x41')]({'where':{'id':_0x4f4a6c[_0x6907('0x3b')]['id']}})[_0x6907('0x22')](handleEntityNotFound(_0x295d9b,null))[_0x6907('0x22')](saveUpdates(_0x4f4a6c[_0x6907('0x40')],null))[_0x6907('0x22')](respondWithResult(_0x295d9b,null))['catch'](handleError(_0x295d9b,null));};exports['destroy']=function(_0x8f75d,_0x4b37e3){return db[_0x6907('0x38')][_0x6907('0x41')]({'where':{'id':_0x8f75d[_0x6907('0x3b')]['id']}})[_0x6907('0x22')](handleEntityNotFound(_0x4b37e3,null))[_0x6907('0x22')](removeEntity(_0x4b37e3,null))[_0x6907('0x3e')](handleError(_0x4b37e3,null));}; \ No newline at end of file +var _0x9d62=['json','offset','undefined','limit','count','Content-Range','save','update','then','error','stack','name','send','ServicenowField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x9d62,0x153));var _0x29d6=function(_0x49b6b0,_0x1e0cb3){_0x49b6b0=_0x49b6b0-0x0;var _0x1742c1=_0x9d62[_0x49b6b0];return _0x1742c1;};'use strict';var emlformat=require(_0x29d6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x29d6('0x1'));var rp=require(_0x29d6('0x2'));var moment=require(_0x29d6('0x3'));var BPromise=require(_0x29d6('0x4'));var Mustache=require(_0x29d6('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x29d6('0x6'));var ejs=require(_0x29d6('0x7'));var fs=require('fs');var fs_extra=require(_0x29d6('0x8'));var _=require(_0x29d6('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x29d6('0xa'));var deskjs=require(_0x29d6('0xb'));var toCsv=require(_0x29d6('0x6'));var querystring=require(_0x29d6('0xc'));var Papa=require('papaparse');var Redis=require(_0x29d6('0xd'));var authService=require(_0x29d6('0xe'));var qs=require(_0x29d6('0xf'));var as=require(_0x29d6('0x10'));var hardwareService=require(_0x29d6('0x11'));var logger=require('../../config/logger')(_0x29d6('0x12'));var utils=require(_0x29d6('0x13'));var config=require(_0x29d6('0x14'));var licenseUtil=require(_0x29d6('0x15'));var db=require(_0x29d6('0x16'))['db'];function respondWithStatusCode(_0xc5f794,_0x3f6a2a){_0x3f6a2a=_0x3f6a2a||0xcc;return function(_0x3de382){if(_0x3de382){return _0xc5f794[_0x29d6('0x17')](_0x3f6a2a);}return _0xc5f794[_0x29d6('0x18')](_0x3f6a2a)[_0x29d6('0x19')]();};}function respondWithResult(_0xcd18ae,_0x1171f5){_0x1171f5=_0x1171f5||0xc8;return function(_0x52f389){if(_0x52f389){return _0xcd18ae[_0x29d6('0x18')](_0x1171f5)[_0x29d6('0x1a')](_0x52f389);}};}function respondWithFilteredResult(_0x5e0dc9,_0x5d83d5){return function(_0x3915f4){if(_0x3915f4){var _0x332819=typeof _0x5d83d5[_0x29d6('0x1b')]===_0x29d6('0x1c')&&typeof _0x5d83d5[_0x29d6('0x1d')]===_0x29d6('0x1c');var _0x3d16d6=_0x3915f4[_0x29d6('0x1e')];var _0x17230b=_0x332819?0x0:_0x5d83d5['offset'];var _0x21443e=_0x332819?_0x3915f4[_0x29d6('0x1e')]:_0x5d83d5[_0x29d6('0x1b')]+_0x5d83d5['limit'];var _0x41942a;if(_0x21443e>=_0x3d16d6){_0x21443e=_0x3d16d6;_0x41942a=0xc8;}else{_0x41942a=0xce;}_0x5e0dc9[_0x29d6('0x18')](_0x41942a);return _0x5e0dc9['set'](_0x29d6('0x1f'),_0x17230b+'-'+_0x21443e+'/'+_0x3d16d6)[_0x29d6('0x1a')](_0x3915f4);}return null;};}function patchUpdates(_0x47040f){return function(_0x46a13d){try{jsonpatch['apply'](_0x46a13d,_0x47040f,!![]);}catch(_0x2f443a){return BPromise['reject'](_0x2f443a);}return _0x46a13d[_0x29d6('0x20')]();};}function saveUpdates(_0xa4be4e,_0x570ffe){return function(_0x2dc204){if(_0x2dc204){return _0x2dc204[_0x29d6('0x21')](_0xa4be4e)[_0x29d6('0x22')](function(_0x5b1a10){return _0x5b1a10;});}return null;};}function removeEntity(_0x41827f,_0x3d7d46){return function(_0x178dc6){if(_0x178dc6){return _0x178dc6['destroy']()[_0x29d6('0x22')](function(){_0x41827f['status'](0xcc)[_0x29d6('0x19')]();});}};}function handleEntityNotFound(_0x2787b9,_0x42ce8a){return function(_0x5c9acf){if(!_0x5c9acf){_0x2787b9['sendStatus'](0x194);}return _0x5c9acf;};}function handleError(_0x2b1898,_0x1f001b){_0x1f001b=_0x1f001b||0x1f4;return function(_0x39ff05){logger[_0x29d6('0x23')](_0x39ff05[_0x29d6('0x24')]);if(_0x39ff05[_0x29d6('0x25')]){delete _0x39ff05[_0x29d6('0x25')];}_0x2b1898[_0x29d6('0x18')](_0x1f001b)[_0x29d6('0x26')](_0x39ff05);};}exports['index']=function(_0x2c4d7a,_0x27f539){var _0x103b8c={},_0x18388b={},_0x3da089={'count':0x0,'rows':[]};var _0x52a56c=_['map'](db[_0x29d6('0x27')][_0x29d6('0x28')],function(_0x5a4c78){return{'name':_0x5a4c78[_0x29d6('0x29')],'type':_0x5a4c78[_0x29d6('0x2a')][_0x29d6('0x2b')]};});_0x18388b[_0x29d6('0x2c')]=_[_0x29d6('0x2d')](_0x52a56c,_0x29d6('0x25'));_0x18388b[_0x29d6('0x2e')]=_[_0x29d6('0x2f')](_0x2c4d7a[_0x29d6('0x2e')]);_0x18388b[_0x29d6('0x30')]=_['intersection'](_0x18388b['model'],_0x18388b[_0x29d6('0x2e')]);_0x103b8c[_0x29d6('0x31')]=_[_0x29d6('0x32')](_0x18388b['model'],qs[_0x29d6('0x33')](_0x2c4d7a['query'][_0x29d6('0x33')]));_0x103b8c[_0x29d6('0x31')]=_0x103b8c[_0x29d6('0x31')][_0x29d6('0x34')]?_0x103b8c[_0x29d6('0x31')]:_0x18388b[_0x29d6('0x2c')];if(!_0x2c4d7a[_0x29d6('0x2e')][_0x29d6('0x35')](_0x29d6('0x36'))){_0x103b8c[_0x29d6('0x1d')]=qs[_0x29d6('0x1d')](_0x2c4d7a[_0x29d6('0x2e')]['limit']);_0x103b8c[_0x29d6('0x1b')]=qs[_0x29d6('0x1b')](_0x2c4d7a[_0x29d6('0x2e')][_0x29d6('0x1b')]);}_0x103b8c[_0x29d6('0x37')]=qs[_0x29d6('0x38')](_0x2c4d7a[_0x29d6('0x2e')][_0x29d6('0x38')]);_0x103b8c[_0x29d6('0x39')]=qs[_0x29d6('0x30')](_[_0x29d6('0x3a')](_0x2c4d7a[_0x29d6('0x2e')],_0x18388b['filters']),_0x52a56c);if(_0x2c4d7a[_0x29d6('0x2e')]['filter']){_0x103b8c[_0x29d6('0x39')]=_[_0x29d6('0x3b')](_0x103b8c[_0x29d6('0x39')],{'$or':_[_0x29d6('0x2d')](_0x52a56c,function(_0x411e6b){if(_0x411e6b['type']!=='VIRTUAL'){var _0x9cd742={};_0x9cd742[_0x411e6b['name']]={'$like':'%'+_0x2c4d7a[_0x29d6('0x2e')][_0x29d6('0x3c')]+'%'};return _0x9cd742;}})});}_0x103b8c=_[_0x29d6('0x3b')]({},_0x103b8c,_0x2c4d7a[_0x29d6('0x3d')]);var _0x432146={'where':_0x103b8c['where']};return db[_0x29d6('0x27')]['count'](_0x432146)[_0x29d6('0x22')](function(_0x4b2d44){_0x3da089['count']=_0x4b2d44;if(_0x2c4d7a[_0x29d6('0x2e')]['includeAll']){_0x103b8c[_0x29d6('0x3e')]=[{'all':!![]}];}return db['ServicenowField'][_0x29d6('0x3f')](_0x103b8c);})[_0x29d6('0x22')](function(_0x3d4ddd){_0x3da089[_0x29d6('0x40')]=_0x3d4ddd;return _0x3da089;})[_0x29d6('0x22')](respondWithFilteredResult(_0x27f539,_0x103b8c))['catch'](handleError(_0x27f539,null));};exports[_0x29d6('0x41')]=function(_0x1476cc,_0x1bc9af){var _0x2d91df={'raw':!![],'where':{'id':_0x1476cc[_0x29d6('0x42')]['id']}},_0x1c4bcc={};_0x1c4bcc[_0x29d6('0x2c')]=_[_0x29d6('0x2f')](db[_0x29d6('0x27')][_0x29d6('0x28')]);_0x1c4bcc[_0x29d6('0x2e')]=_['keys'](_0x1476cc[_0x29d6('0x2e')]);_0x1c4bcc[_0x29d6('0x30')]=_[_0x29d6('0x32')](_0x1c4bcc[_0x29d6('0x2c')],_0x1c4bcc['query']);_0x2d91df[_0x29d6('0x31')]=_[_0x29d6('0x32')](_0x1c4bcc[_0x29d6('0x2c')],qs[_0x29d6('0x33')](_0x1476cc['query'][_0x29d6('0x33')]));_0x2d91df[_0x29d6('0x31')]=_0x2d91df[_0x29d6('0x31')][_0x29d6('0x34')]?_0x2d91df[_0x29d6('0x31')]:_0x1c4bcc['model'];if(_0x1476cc['query'][_0x29d6('0x43')]){_0x2d91df[_0x29d6('0x3e')]=[{'all':!![]}];}_0x2d91df=_['merge']({},_0x2d91df,_0x1476cc[_0x29d6('0x3d')]);return db[_0x29d6('0x27')][_0x29d6('0x44')](_0x2d91df)['then'](handleEntityNotFound(_0x1bc9af,null))['then'](respondWithResult(_0x1bc9af,null))[_0x29d6('0x45')](handleError(_0x1bc9af,null));};exports[_0x29d6('0x46')]=function(_0x131135,_0x213a38){return db['ServicenowField'][_0x29d6('0x46')](_0x131135[_0x29d6('0x47')],{})[_0x29d6('0x22')](respondWithResult(_0x213a38,0xc9))[_0x29d6('0x45')](handleError(_0x213a38,null));};exports['update']=function(_0x2ed427,_0x56c68f){if(_0x2ed427[_0x29d6('0x47')]['id']){delete _0x2ed427[_0x29d6('0x47')]['id'];}return db[_0x29d6('0x27')][_0x29d6('0x44')]({'where':{'id':_0x2ed427[_0x29d6('0x42')]['id']}})['then'](handleEntityNotFound(_0x56c68f,null))[_0x29d6('0x22')](saveUpdates(_0x2ed427['body'],null))[_0x29d6('0x22')](respondWithResult(_0x56c68f,null))['catch'](handleError(_0x56c68f,null));};exports[_0x29d6('0x48')]=function(_0x54cb49,_0x10f66c){return db['ServicenowField'][_0x29d6('0x44')]({'where':{'id':_0x54cb49[_0x29d6('0x42')]['id']}})['then'](handleEntityNotFound(_0x10f66c,null))['then'](removeEntity(_0x10f66c,null))[_0x29d6('0x45')](handleError(_0x10f66c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 5c18bc5..8e502d0 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 _0xd375=['rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','../../config/logger','api','bluebird','request-promise','path'];(function(_0x570a5f,_0x35d11d){var _0x49db62=function(_0x2063a5){while(--_0x2063a5){_0x570a5f['push'](_0x570a5f['shift']());}};_0x49db62(++_0x35d11d);}(_0xd375,0x79));var _0x5d37=function(_0x38edee,_0x49b024){_0x38edee=_0x38edee-0x0;var _0x5ce0b2=_0xd375[_0x38edee];return _0x5ce0b2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5d37('0x0'))(_0x5d37('0x1'));var moment=require('moment');var BPromise=require(_0x5d37('0x2'));var rp=require(_0x5d37('0x3'));var fs=require('fs');var path=require(_0x5d37('0x4'));var rimraf=require(_0x5d37('0x5'));var config=require(_0x5d37('0x6'));var attributes=require(_0x5d37('0x7'));module[_0x5d37('0x8')]=function(_0x37c7d0,_0x212941){return _0x37c7d0['define'](_0x5d37('0x9'),attributes,{'tableName':_0x5d37('0xa'),'paranoid':![],'indexes':[{'name':_0x5d37('0xb'),'fields':[_0x5d37('0xc'),_0x5d37('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x17ed=['request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird'];(function(_0xb32b6c,_0x5b7251){var _0x3d68bc=function(_0x2ffdf5){while(--_0x2ffdf5){_0xb32b6c['push'](_0xb32b6c['shift']());}};_0x3d68bc(++_0x5b7251);}(_0x17ed,0xeb));var _0xd17e=function(_0x11b098,_0x2f119e){_0x11b098=_0x11b098-0x0;var _0x183075=_0x17ed[_0x11b098];return _0x183075;};'use strict';var _=require('lodash');var util=require(_0xd17e('0x0'));var logger=require(_0xd17e('0x1'))(_0xd17e('0x2'));var moment=require(_0xd17e('0x3'));var BPromise=require(_0xd17e('0x4'));var rp=require(_0xd17e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd17e('0x6'));var config=require(_0xd17e('0x7'));var attributes=require(_0xd17e('0x8'));module[_0xd17e('0x9')]=function(_0x4abb54,_0x5bb4d6){return _0x4abb54[_0xd17e('0xa')]('ServicenowField',attributes,{'tableName':_0xd17e('0xb'),'paranoid':![],'indexes':[{'name':_0xd17e('0xc'),'fields':[_0xd17e('0xd'),_0xd17e('0xe')],'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 ddbe5f6..811ffa7 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 _0x9bde=['code','message','ServicenowField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x238823,_0x3322d7){var _0x2fd1d8=function(_0x102fe3){while(--_0x102fe3){_0x238823['push'](_0x238823['shift']());}};_0x2fd1d8(++_0x3322d7);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4c96cc,_0x2f64a0){_0x4c96cc=_0x4c96cc-0x0;var _0xe44d09=_0x9bde[_0x4c96cc];return _0xe44d09;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('ServicenowField,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xda3f,0xec));var _0xfda3=function(_0xc139d3,_0x56f873){_0xc139d3=_0xc139d3-0x0;var _0x2eaf4c=_0xda3f[_0xc139d3];return _0x2eaf4c;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 05c4fb1..3e0e406 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(_0x4b508a,_0x256831){var _0x5bb829=function(_0x5860b5){while(--_0x5860b5){_0x4b508a['push'](_0x4b508a['shift']());}};_0x5bb829(++_0x256831);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x7fe90f,_0x2565d6){var _0x3831dc=function(_0x1618a8){while(--_0x1618a8){_0x7fe90f['push'](_0x7fe90f['shift']());}};_0x3831dc(++_0x2565d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 653cf2b..5cf8003 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(_0x33dc0a,_0x3ea19c){var _0x47ad5d=function(_0x1c9f41){while(--_0x1c9f41){_0x33dc0a['push'](_0x33dc0a['shift']());}};_0x47ad5d(++_0x3ea19c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0x2be26c,_0x4355b3){var _0xc7e5b5=function(_0x1c47c2){while(--_0x1c47c2){_0x2be26c['push'](_0x2be26c['shift']());}};_0xc7e5b5(++_0x4355b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 ced6c45..b3cf4c8 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 _0x1316=['JSON','stringify','Invalid\x20Login','Password\x20Expired','%s%s','Calls','values','module_fields','remove','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','rawAttributes','type','key','map','query','filters','model','attributes','intersection','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','SugarcrmAccount','include','findAll','rows','show','params','keys','fields','includeAll','merge','find','catch','create','body','getConfigurations','findOne','SugarcrmConfiguration','length','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login'];(function(_0x14e485,_0x842602){var _0x4c0b5c=function(_0x209521){while(--_0x209521){_0x14e485['push'](_0x14e485['shift']());}};_0x4c0b5c(++_0x842602);}(_0x1316,0x87));var _0x6131=function(_0x25d70f,_0x4416dd){_0x25d70f=_0x25d70f-0x0;var _0x4fb183=_0x1316[_0x25d70f];return _0x4fb183;};'use strict';var emlformat=require(_0x6131('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6131('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6131('0x2'));var moment=require(_0x6131('0x3'));var BPromise=require(_0x6131('0x4'));var Mustache=require(_0x6131('0x5'));var util=require(_0x6131('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6131('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6131('0x8'));var _=require('lodash');var squel=require(_0x6131('0x9'));var crypto=require(_0x6131('0xa'));var jsforce=require(_0x6131('0xb'));var deskjs=require(_0x6131('0xc'));var toCsv=require(_0x6131('0x7'));var querystring=require(_0x6131('0xd'));var Papa=require('papaparse');var Redis=require(_0x6131('0xe'));var authService=require(_0x6131('0xf'));var qs=require(_0x6131('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6131('0x11'));var logger=require(_0x6131('0x12'))(_0x6131('0x13'));var utils=require(_0x6131('0x14'));var config=require(_0x6131('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x6131('0x16'));function respondWithStatusCode(_0x468bee,_0x36cd37){_0x36cd37=_0x36cd37||0xcc;return function(_0x463b78){if(_0x463b78){return _0x468bee[_0x6131('0x17')](_0x36cd37);}return _0x468bee[_0x6131('0x18')](_0x36cd37)[_0x6131('0x19')]();};}function respondWithResult(_0x562fd9,_0x53e86e){_0x53e86e=_0x53e86e||0xc8;return function(_0x3c139c){if(_0x3c139c){return _0x562fd9[_0x6131('0x18')](_0x53e86e)[_0x6131('0x1a')](_0x3c139c);}};}function respondWithFilteredResult(_0x1d4cc0,_0x2c8a22){return function(_0x331e2f){if(_0x331e2f){var _0x318117=typeof _0x2c8a22[_0x6131('0x1b')]==='undefined'&&typeof _0x2c8a22[_0x6131('0x1c')]===_0x6131('0x1d');var _0x5da1cb=_0x331e2f['count'];var _0x41590d=_0x318117?0x0:_0x2c8a22[_0x6131('0x1b')];var _0x2f074a=_0x318117?_0x331e2f[_0x6131('0x1e')]:_0x2c8a22[_0x6131('0x1b')]+_0x2c8a22['limit'];var _0x520c48;if(_0x2f074a>=_0x5da1cb){_0x2f074a=_0x5da1cb;_0x520c48=0xc8;}else{_0x520c48=0xce;}_0x1d4cc0[_0x6131('0x18')](_0x520c48);return _0x1d4cc0[_0x6131('0x1f')](_0x6131('0x20'),_0x41590d+'-'+_0x2f074a+'/'+_0x5da1cb)[_0x6131('0x1a')](_0x331e2f);}return null;};}function patchUpdates(_0x155e27){return function(_0xce8fc4){try{jsonpatch[_0x6131('0x21')](_0xce8fc4,_0x155e27,!![]);}catch(_0x4abcca){return BPromise[_0x6131('0x22')](_0x4abcca);}return _0xce8fc4[_0x6131('0x23')]();};}function saveUpdates(_0x369fc8,_0x4109ef){return function(_0x831eea){if(_0x831eea){return _0x831eea[_0x6131('0x24')](_0x369fc8)['then'](function(_0x32692f){return _0x32692f;});}return null;};}function removeEntity(_0x328db1,_0x364679){return function(_0x2a39a9){if(_0x2a39a9){return _0x2a39a9[_0x6131('0x25')]()[_0x6131('0x26')](function(){_0x328db1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7f7bfd,_0x5f0719){return function(_0x24380d){if(!_0x24380d){_0x7f7bfd[_0x6131('0x17')](0x194);}return _0x24380d;};}function handleError(_0x221dcd,_0x39faae){_0x39faae=_0x39faae||0x1f4;return function(_0x1edf0a){logger[_0x6131('0x27')](_0x1edf0a['stack']);if(_0x1edf0a['name']){delete _0x1edf0a[_0x6131('0x28')];}_0x221dcd[_0x6131('0x18')](_0x39faae)[_0x6131('0x29')](_0x1edf0a);};}exports[_0x6131('0x2a')]=function(_0x1a0a35,_0x7ea6b5){var _0x1fb563={},_0x2d292c={},_0x32964a={'count':0x0,'rows':[]};var _0x3e2e29=_['map'](db['SugarcrmAccount'][_0x6131('0x2b')],function(_0x4def00){return{'name':_0x4def00['fieldName'],'type':_0x4def00[_0x6131('0x2c')][_0x6131('0x2d')]};});_0x2d292c['model']=_[_0x6131('0x2e')](_0x3e2e29,_0x6131('0x28'));_0x2d292c[_0x6131('0x2f')]=_['keys'](_0x1a0a35[_0x6131('0x2f')]);_0x2d292c[_0x6131('0x30')]=_['intersection'](_0x2d292c[_0x6131('0x31')],_0x2d292c[_0x6131('0x2f')]);_0x1fb563[_0x6131('0x32')]=_[_0x6131('0x33')](_0x2d292c['model'],qs['fields'](_0x1a0a35[_0x6131('0x2f')]['fields']));_0x1fb563[_0x6131('0x32')]=_0x1fb563[_0x6131('0x32')]['length']?_0x1fb563['attributes']:_0x2d292c['model'];if(!_0x1a0a35['query'][_0x6131('0x34')]('nolimit')){_0x1fb563[_0x6131('0x1c')]=qs[_0x6131('0x1c')](_0x1a0a35[_0x6131('0x2f')][_0x6131('0x1c')]);_0x1fb563[_0x6131('0x1b')]=qs[_0x6131('0x1b')](_0x1a0a35[_0x6131('0x2f')]['offset']);}_0x1fb563[_0x6131('0x35')]=qs['sort'](_0x1a0a35[_0x6131('0x2f')][_0x6131('0x36')]);_0x1fb563['where']=qs[_0x6131('0x30')](_[_0x6131('0x37')](_0x1a0a35[_0x6131('0x2f')],_0x2d292c[_0x6131('0x30')]),_0x3e2e29);if(_0x1a0a35['query'][_0x6131('0x38')]){_0x1fb563[_0x6131('0x39')]=_['merge'](_0x1fb563['where'],{'$or':_[_0x6131('0x2e')](_0x3e2e29,function(_0x4f214e){if(_0x4f214e[_0x6131('0x2c')]!==_0x6131('0x3a')){var _0x4756ae={};_0x4756ae[_0x4f214e[_0x6131('0x28')]]={'$like':'%'+_0x1a0a35[_0x6131('0x2f')][_0x6131('0x38')]+'%'};return _0x4756ae;}})});}_0x1fb563=_['merge']({},_0x1fb563,_0x1a0a35[_0x6131('0x3b')]);var _0x2ecdf9={'where':_0x1fb563[_0x6131('0x39')]};return db[_0x6131('0x3c')][_0x6131('0x1e')](_0x2ecdf9)[_0x6131('0x26')](function(_0x5986b1){_0x32964a[_0x6131('0x1e')]=_0x5986b1;if(_0x1a0a35[_0x6131('0x2f')]['includeAll']){_0x1fb563[_0x6131('0x3d')]=[{'all':!![]}];}return db[_0x6131('0x3c')][_0x6131('0x3e')](_0x1fb563);})[_0x6131('0x26')](function(_0x196751){_0x32964a[_0x6131('0x3f')]=_0x196751;return _0x32964a;})[_0x6131('0x26')](respondWithFilteredResult(_0x7ea6b5,_0x1fb563))['catch'](handleError(_0x7ea6b5,null));};exports[_0x6131('0x40')]=function(_0x9d387c,_0x15c49b){var _0x2a8053={'raw':![],'where':{'id':_0x9d387c[_0x6131('0x41')]['id']}},_0x3b498e={};_0x3b498e[_0x6131('0x31')]=_['keys'](db[_0x6131('0x3c')][_0x6131('0x2b')]);_0x3b498e[_0x6131('0x2f')]=_[_0x6131('0x42')](_0x9d387c[_0x6131('0x2f')]);_0x3b498e[_0x6131('0x30')]=_[_0x6131('0x33')](_0x3b498e[_0x6131('0x31')],_0x3b498e[_0x6131('0x2f')]);_0x2a8053[_0x6131('0x32')]=_['intersection'](_0x3b498e[_0x6131('0x31')],qs[_0x6131('0x43')](_0x9d387c[_0x6131('0x2f')][_0x6131('0x43')]));_0x2a8053[_0x6131('0x32')]=_0x2a8053[_0x6131('0x32')]['length']?_0x2a8053[_0x6131('0x32')]:_0x3b498e[_0x6131('0x31')];if(_0x9d387c[_0x6131('0x2f')][_0x6131('0x44')]){_0x2a8053[_0x6131('0x3d')]=[{'all':!![]}];}_0x2a8053=_[_0x6131('0x45')]({},_0x2a8053,_0x9d387c[_0x6131('0x3b')]);return db[_0x6131('0x3c')][_0x6131('0x46')](_0x2a8053)[_0x6131('0x26')](handleEntityNotFound(_0x15c49b,null))['then'](respondWithResult(_0x15c49b,null))[_0x6131('0x47')](handleError(_0x15c49b,null));};exports[_0x6131('0x48')]=function(_0x2ac768,_0x2c956f){return db[_0x6131('0x3c')][_0x6131('0x48')](_0x2ac768['body'],{})[_0x6131('0x26')](respondWithResult(_0x2c956f,0xc9))[_0x6131('0x47')](handleError(_0x2c956f,null));};exports[_0x6131('0x24')]=function(_0xe3575e,_0x40370e){if(_0xe3575e['body']['id']){delete _0xe3575e[_0x6131('0x49')]['id'];}return db[_0x6131('0x3c')][_0x6131('0x46')]({'where':{'id':_0xe3575e[_0x6131('0x41')]['id']}})[_0x6131('0x26')](handleEntityNotFound(_0x40370e,null))[_0x6131('0x26')](saveUpdates(_0xe3575e[_0x6131('0x49')],null))[_0x6131('0x26')](respondWithResult(_0x40370e,null))[_0x6131('0x47')](handleError(_0x40370e,null));};exports[_0x6131('0x25')]=function(_0xf7a131,_0x3060af){return db[_0x6131('0x3c')][_0x6131('0x46')]({'where':{'id':_0xf7a131[_0x6131('0x41')]['id']}})['then'](handleEntityNotFound(_0x3060af,null))[_0x6131('0x26')](removeEntity(_0x3060af,null))[_0x6131('0x47')](handleError(_0x3060af,null));};exports[_0x6131('0x4a')]=function(_0x2582ea,_0x5d37ff,_0x3a8588){var _0x570d7e={};var _0x39f8b4={};var _0x399ccc;var _0xdf687d;return db[_0x6131('0x3c')][_0x6131('0x4b')]({'where':{'id':_0x2582ea[_0x6131('0x41')]['id']}})[_0x6131('0x26')](handleEntityNotFound(_0x5d37ff,null))['then'](function(_0x4bbafd){if(_0x4bbafd){_0x399ccc=_0x4bbafd;_0x39f8b4[_0x6131('0x31')]=_['keys'](db[_0x6131('0x4c')][_0x6131('0x2b')]);_0x39f8b4[_0x6131('0x2f')]=_[_0x6131('0x42')](_0x2582ea[_0x6131('0x2f')]);_0x39f8b4['filters']=_[_0x6131('0x33')](_0x39f8b4[_0x6131('0x31')],_0x39f8b4[_0x6131('0x2f')]);_0x570d7e['attributes']=_['intersection'](_0x39f8b4[_0x6131('0x31')],qs[_0x6131('0x43')](_0x2582ea[_0x6131('0x2f')][_0x6131('0x43')]));_0x570d7e[_0x6131('0x32')]=_0x570d7e[_0x6131('0x32')][_0x6131('0x4d')]?_0x570d7e[_0x6131('0x32')]:_0x39f8b4[_0x6131('0x31')];_0x570d7e[_0x6131('0x35')]=qs['sort'](_0x2582ea[_0x6131('0x2f')][_0x6131('0x36')]);_0x570d7e[_0x6131('0x39')]=qs['filters'](_[_0x6131('0x37')](_0x2582ea['query'],_0x39f8b4[_0x6131('0x30')]));if(_0x2582ea[_0x6131('0x2f')]['filter']){_0x570d7e[_0x6131('0x39')]=_[_0x6131('0x45')](_0x570d7e[_0x6131('0x39')],{'$or':_[_0x6131('0x2e')](_0x570d7e[_0x6131('0x32')],function(_0x1b249c){var _0x4f41a3={};_0x4f41a3[_0x1b249c]={'$like':'%'+_0x2582ea['query'][_0x6131('0x38')]+'%'};return _0x4f41a3;})});}_0x570d7e=_[_0x6131('0x45')]({},_0x570d7e,_0x2582ea['options']);return _0x399ccc[_0x6131('0x4a')](_0x570d7e);}})[_0x6131('0x26')](function(_0x22e3df){if(_0x22e3df){_0xdf687d=_0x22e3df[_0x6131('0x4d')];if(!_0x2582ea[_0x6131('0x2f')][_0x6131('0x34')]('nolimit')){_0x570d7e['limit']=qs[_0x6131('0x1c')](_0x2582ea[_0x6131('0x2f')][_0x6131('0x1c')]);_0x570d7e[_0x6131('0x1b')]=qs[_0x6131('0x1b')](_0x2582ea[_0x6131('0x2f')][_0x6131('0x1b')]);}return _0x399ccc['getConfigurations'](_0x570d7e);}})[_0x6131('0x26')](function(_0x4fe9cb){if(_0x4fe9cb){return _0x4fe9cb?{'count':_0xdf687d,'rows':_0x4fe9cb}:null;}})[_0x6131('0x26')](respondWithResult(_0x5d37ff,null))[_0x6131('0x47')](handleError(_0x5d37ff,null));};exports[_0x6131('0x4e')]=function(_0x582aed,_0x5062df,_0x7411f5){if(_0x582aed[_0x6131('0x49')]['id']){delete _0x582aed[_0x6131('0x49')]['id'];}return db[_0x6131('0x3c')]['findOne']({'where':{'id':_0x582aed['params']['id']}})['then'](handleEntityNotFound(_0x5062df,null))[_0x6131('0x26')](function(_0x200a14){if(_0x200a14){_0x582aed['body'][_0x6131('0x4f')]=_0x200a14['id'];_0x582aed[_0x6131('0x49')]['Subjects']=integrations[_0x6131('0x50')](_0x582aed[_0x6131('0x49')][_0x6131('0x51')],_0x582aed[_0x6131('0x49')]['type']);_0x582aed[_0x6131('0x49')][_0x6131('0x52')]=integrations[_0x6131('0x53')](_0x582aed[_0x6131('0x49')][_0x6131('0x51')],_0x582aed[_0x6131('0x49')][_0x6131('0x2c')]);return db[_0x6131('0x4c')][_0x6131('0x48')](_0x582aed[_0x6131('0x49')],{'include':[{'model':db['SugarcrmField'],'as':_0x6131('0x54')},{'model':db[_0x6131('0x55')],'as':'Descriptions'}]});}return null;})[_0x6131('0x26')](respondWithResult(_0x5062df,null))['catch'](handleError(_0x5062df,null));};exports[_0x6131('0x56')]=function(_0x5267fd,_0x5f0769,_0x29d5fd){var _0x280ebc='';var _0x1e3cf4=['id',_0x6131('0x28'),_0x6131('0x57'),_0x6131('0x58'),_0x6131('0x59'),'date_start',_0x6131('0x5a'),_0x6131('0x5b'),_0x6131('0x5c'),_0x6131('0x5d'),_0x6131('0x5e'),_0x6131('0x5f')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x5267fd[_0x6131('0x41')]['id']},'attributes':['id',_0x6131('0x60'),_0x6131('0x61'),'remoteUri']})[_0x6131('0x26')](handleEntityNotFound(_0x5f0769,null))['then'](function(_0x224bb4){if(_0x224bb4){_0x280ebc=_0x224bb4['remoteUri'];var _0x2fd3af=_0x280ebc[_0x6131('0x62')](-0x1);if(_0x2fd3af==='/'){_0x280ebc=_0x280ebc[_0x6131('0x63')](0x0,_0x280ebc[_0x6131('0x64')](_0x2fd3af));}return rp({'method':_0x6131('0x65'),'uri':util[_0x6131('0x66')]('%s%s',_0x280ebc,_0x6131('0x67')),'json':!![],'form':{'method':_0x6131('0x68'),'input_type':_0x6131('0x69'),'response_type':_0x6131('0x69'),'rest_data':JSON[_0x6131('0x6a')]({'user_auth':{'user_name':_0x224bb4[_0x6131('0x60')],'password':_0x224bb4[_0x6131('0x61')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x6131('0x26')](function(_0x4822f9){if(_0x4822f9&&_0x4822f9[_0x6131('0x28')]!==_0x6131('0x6b')&&_0x4822f9['name']!==_0x6131('0x6c')){return rp({'method':'POST','uri':util[_0x6131('0x66')](_0x6131('0x6d'),_0x280ebc,_0x6131('0x67')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x6131('0x69'),'response_type':_0x6131('0x69'),'rest_data':JSON[_0x6131('0x6a')]({'session':_0x4822f9['id'],'module_name':_0x6131('0x6e')})}})[_0x6131('0x26')](function(_0x40f4af){if(_0x40f4af){var _0x106308=_[_0x6131('0x6f')](_0x40f4af[_0x6131('0x70')]);_[_0x6131('0x71')](_0x106308,function(_0x6b167d){return _0x1e3cf4['includes'](_0x6b167d[_0x6131('0x28')]);});return{'count':_0x106308[_0x6131('0x4d')],'rows':_[_0x6131('0x2e')](_0x106308,function(_0x4c32ff){return{'id':_0x4c32ff['name'],'name':_0x4c32ff['label'],'custom':_[_0x6131('0x72')](_0x4c32ff[_0x6131('0x28')],'_c')?!![]:![],'options':_0x4c32ff['options']?_['map'](_[_0x6131('0x6f')](_0x4c32ff[_0x6131('0x3b')]),function(_0x35642d){return{'name':_0x35642d[_0x6131('0x73')],'value':_0x35642d['name']};}):[]};})};}})['then'](respondWithResult(_0x5f0769,null))[_0x6131('0x47')](function(_0x5a1a45){var _0x58d034=_0x5267fd[_0x6131('0x2f')][_0x6131('0x74')]?0x1f4:_0x5a1a45[_0x6131('0x75')]||0x1f4;logger['error'](_0x6131('0x76'),_0x6131('0x56'),_0x58d034,JSON[_0x6131('0x6a')](_0x5a1a45));delete _0x5a1a45[_0x6131('0x28')];if(_0x58d034===0x191){_0x58d034=0x190;}_0x5f0769['status'](_0x58d034)[_0x6131('0x29')](_0x5267fd[_0x6131('0x2f')][_0x6131('0x74')]?{'message':_0x6131('0x77'),'statusCode':_0x5a1a45[_0x6131('0x75')]}:_0x5a1a45);});}else{var _0x155946=0x1f4;_0x5f0769[_0x6131('0x18')](_0x155946)[_0x6131('0x29')]({'message':_0x6131('0x77'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x6970=['stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_type','parent_name','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6970,0x1f2));var _0x0697=function(_0x18d9f4,_0x52aa17){_0x18d9f4=_0x18d9f4-0x0;var _0x2617ce=_0x6970[_0x18d9f4];return _0x2617ce;};'use strict';var emlformat=require(_0x0697('0x0'));var rimraf=require(_0x0697('0x1'));var zipdir=require(_0x0697('0x2'));var jsonpatch=require(_0x0697('0x3'));var rp=require(_0x0697('0x4'));var moment=require('moment');var BPromise=require(_0x0697('0x5'));var Mustache=require(_0x0697('0x6'));var util=require(_0x0697('0x7'));var path=require('path');var sox=require(_0x0697('0x8'));var csv=require(_0x0697('0x9'));var ejs=require(_0x0697('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0697('0xb'));var squel=require('squel');var crypto=require(_0x0697('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0697('0xd'));var toCsv=require(_0x0697('0x9'));var querystring=require(_0x0697('0xe'));var Papa=require(_0x0697('0xf'));var Redis=require(_0x0697('0x10'));var authService=require(_0x0697('0x11'));var qs=require(_0x0697('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0697('0x13'));var logger=require(_0x0697('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0697('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4a2b55,_0x13fe6c){_0x13fe6c=_0x13fe6c||0xcc;return function(_0xa68be4){if(_0xa68be4){return _0x4a2b55['sendStatus'](_0x13fe6c);}return _0x4a2b55['status'](_0x13fe6c)[_0x0697('0x16')]();};}function respondWithResult(_0x4dc2ee,_0x1133d7){_0x1133d7=_0x1133d7||0xc8;return function(_0x414c7a){if(_0x414c7a){return _0x4dc2ee['status'](_0x1133d7)[_0x0697('0x17')](_0x414c7a);}};}function respondWithFilteredResult(_0x462314,_0x4aa204){return function(_0x3de802){if(_0x3de802){var _0x16fcbf=typeof _0x4aa204[_0x0697('0x18')]===_0x0697('0x19')&&typeof _0x4aa204['limit']===_0x0697('0x19');var _0x81f6be=_0x3de802['count'];var _0x120b18=_0x16fcbf?0x0:_0x4aa204[_0x0697('0x18')];var _0x31f1db=_0x16fcbf?_0x3de802[_0x0697('0x1a')]:_0x4aa204['offset']+_0x4aa204['limit'];var _0x46ee15;if(_0x31f1db>=_0x81f6be){_0x31f1db=_0x81f6be;_0x46ee15=0xc8;}else{_0x46ee15=0xce;}_0x462314[_0x0697('0x1b')](_0x46ee15);return _0x462314[_0x0697('0x1c')](_0x0697('0x1d'),_0x120b18+'-'+_0x31f1db+'/'+_0x81f6be)[_0x0697('0x17')](_0x3de802);}return null;};}function patchUpdates(_0x3315d8){return function(_0x9d24cf){try{jsonpatch[_0x0697('0x1e')](_0x9d24cf,_0x3315d8,!![]);}catch(_0x4b9227){return BPromise[_0x0697('0x1f')](_0x4b9227);}return _0x9d24cf[_0x0697('0x20')]();};}function saveUpdates(_0x5087e7,_0x68ab67){return function(_0x555679){if(_0x555679){return _0x555679[_0x0697('0x21')](_0x5087e7)[_0x0697('0x22')](function(_0x3ea5da){return _0x3ea5da;});}return null;};}function removeEntity(_0x2e1fdd,_0x1ba53f){return function(_0x231deb){if(_0x231deb){return _0x231deb[_0x0697('0x23')]()['then'](function(){_0x2e1fdd['status'](0xcc)[_0x0697('0x16')]();});}};}function handleEntityNotFound(_0x2b3744,_0x7a8157){return function(_0x29762d){if(!_0x29762d){_0x2b3744[_0x0697('0x24')](0x194);}return _0x29762d;};}function handleError(_0x35693e,_0x170b73){_0x170b73=_0x170b73||0x1f4;return function(_0x252017){logger['error'](_0x252017[_0x0697('0x25')]);if(_0x252017[_0x0697('0x26')]){delete _0x252017['name'];}_0x35693e[_0x0697('0x1b')](_0x170b73)[_0x0697('0x27')](_0x252017);};}exports[_0x0697('0x28')]=function(_0x12a915,_0x182f2c){var _0x4b307d={},_0x1b8452={},_0x42040a={'count':0x0,'rows':[]};var _0x17e58e=_[_0x0697('0x29')](db[_0x0697('0x2a')][_0x0697('0x2b')],function(_0x18dc3f){return{'name':_0x18dc3f[_0x0697('0x2c')],'type':_0x18dc3f[_0x0697('0x2d')][_0x0697('0x2e')]};});_0x1b8452[_0x0697('0x2f')]=_['map'](_0x17e58e,'name');_0x1b8452[_0x0697('0x30')]=_[_0x0697('0x31')](_0x12a915[_0x0697('0x30')]);_0x1b8452['filters']=_[_0x0697('0x32')](_0x1b8452['model'],_0x1b8452['query']);_0x4b307d['attributes']=_['intersection'](_0x1b8452['model'],qs[_0x0697('0x33')](_0x12a915[_0x0697('0x30')]['fields']));_0x4b307d['attributes']=_0x4b307d[_0x0697('0x34')][_0x0697('0x35')]?_0x4b307d[_0x0697('0x34')]:_0x1b8452[_0x0697('0x2f')];if(!_0x12a915[_0x0697('0x30')][_0x0697('0x36')](_0x0697('0x37'))){_0x4b307d['limit']=qs[_0x0697('0x38')](_0x12a915['query'][_0x0697('0x38')]);_0x4b307d['offset']=qs[_0x0697('0x18')](_0x12a915[_0x0697('0x30')][_0x0697('0x18')]);}_0x4b307d[_0x0697('0x39')]=qs[_0x0697('0x3a')](_0x12a915['query'][_0x0697('0x3a')]);_0x4b307d['where']=qs[_0x0697('0x3b')](_[_0x0697('0x3c')](_0x12a915['query'],_0x1b8452[_0x0697('0x3b')]),_0x17e58e);if(_0x12a915[_0x0697('0x30')][_0x0697('0x3d')]){_0x4b307d[_0x0697('0x3e')]=_[_0x0697('0x3f')](_0x4b307d['where'],{'$or':_[_0x0697('0x29')](_0x17e58e,function(_0x1b3606){if(_0x1b3606['type']!==_0x0697('0x40')){var _0x14f8db={};_0x14f8db[_0x1b3606['name']]={'$like':'%'+_0x12a915[_0x0697('0x30')][_0x0697('0x3d')]+'%'};return _0x14f8db;}})});}_0x4b307d=_[_0x0697('0x3f')]({},_0x4b307d,_0x12a915[_0x0697('0x41')]);var _0x111c39={'where':_0x4b307d[_0x0697('0x3e')]};return db[_0x0697('0x2a')][_0x0697('0x1a')](_0x111c39)[_0x0697('0x22')](function(_0x38adec){_0x42040a[_0x0697('0x1a')]=_0x38adec;if(_0x12a915[_0x0697('0x30')][_0x0697('0x42')]){_0x4b307d[_0x0697('0x43')]=[{'all':!![]}];}return db[_0x0697('0x2a')][_0x0697('0x44')](_0x4b307d);})[_0x0697('0x22')](function(_0x239426){_0x42040a[_0x0697('0x45')]=_0x239426;return _0x42040a;})[_0x0697('0x22')](respondWithFilteredResult(_0x182f2c,_0x4b307d))[_0x0697('0x46')](handleError(_0x182f2c,null));};exports[_0x0697('0x47')]=function(_0xdde320,_0x16f5bd){var _0x2b111a={'raw':![],'where':{'id':_0xdde320[_0x0697('0x48')]['id']}},_0x2ec74d={};_0x2ec74d[_0x0697('0x2f')]=_[_0x0697('0x31')](db[_0x0697('0x2a')][_0x0697('0x2b')]);_0x2ec74d[_0x0697('0x30')]=_['keys'](_0xdde320['query']);_0x2ec74d[_0x0697('0x3b')]=_[_0x0697('0x32')](_0x2ec74d[_0x0697('0x2f')],_0x2ec74d[_0x0697('0x30')]);_0x2b111a['attributes']=_[_0x0697('0x32')](_0x2ec74d[_0x0697('0x2f')],qs['fields'](_0xdde320[_0x0697('0x30')][_0x0697('0x33')]));_0x2b111a[_0x0697('0x34')]=_0x2b111a[_0x0697('0x34')][_0x0697('0x35')]?_0x2b111a['attributes']:_0x2ec74d[_0x0697('0x2f')];if(_0xdde320[_0x0697('0x30')][_0x0697('0x42')]){_0x2b111a[_0x0697('0x43')]=[{'all':!![]}];}_0x2b111a=_[_0x0697('0x3f')]({},_0x2b111a,_0xdde320['options']);return db[_0x0697('0x2a')][_0x0697('0x49')](_0x2b111a)[_0x0697('0x22')](handleEntityNotFound(_0x16f5bd,null))['then'](respondWithResult(_0x16f5bd,null))['catch'](handleError(_0x16f5bd,null));};exports[_0x0697('0x4a')]=function(_0x5250d5,_0x156247){return db[_0x0697('0x2a')][_0x0697('0x4a')](_0x5250d5['body'],{})['then'](respondWithResult(_0x156247,0xc9))['catch'](handleError(_0x156247,null));};exports[_0x0697('0x21')]=function(_0x5dd9a4,_0x5334c5){if(_0x5dd9a4[_0x0697('0x4b')]['id']){delete _0x5dd9a4[_0x0697('0x4b')]['id'];}return db[_0x0697('0x2a')]['find']({'where':{'id':_0x5dd9a4['params']['id']}})[_0x0697('0x22')](handleEntityNotFound(_0x5334c5,null))[_0x0697('0x22')](saveUpdates(_0x5dd9a4[_0x0697('0x4b')],null))['then'](respondWithResult(_0x5334c5,null))[_0x0697('0x46')](handleError(_0x5334c5,null));};exports[_0x0697('0x23')]=function(_0x4c5664,_0x180719){return db['SugarcrmAccount'][_0x0697('0x49')]({'where':{'id':_0x4c5664[_0x0697('0x48')]['id']}})[_0x0697('0x22')](handleEntityNotFound(_0x180719,null))['then'](removeEntity(_0x180719,null))[_0x0697('0x46')](handleError(_0x180719,null));};exports[_0x0697('0x4c')]=function(_0x3a57c,_0x38e955,_0x53645b){var _0xaeb5f5={};var _0x18a7b4={};var _0x44c307;var _0x565a61;return db['SugarcrmAccount'][_0x0697('0x4d')]({'where':{'id':_0x3a57c['params']['id']}})['then'](handleEntityNotFound(_0x38e955,null))[_0x0697('0x22')](function(_0x5a73bb){if(_0x5a73bb){_0x44c307=_0x5a73bb;_0x18a7b4[_0x0697('0x2f')]=_[_0x0697('0x31')](db[_0x0697('0x4e')][_0x0697('0x2b')]);_0x18a7b4[_0x0697('0x30')]=_[_0x0697('0x31')](_0x3a57c[_0x0697('0x30')]);_0x18a7b4[_0x0697('0x3b')]=_['intersection'](_0x18a7b4['model'],_0x18a7b4[_0x0697('0x30')]);_0xaeb5f5[_0x0697('0x34')]=_[_0x0697('0x32')](_0x18a7b4['model'],qs[_0x0697('0x33')](_0x3a57c[_0x0697('0x30')][_0x0697('0x33')]));_0xaeb5f5[_0x0697('0x34')]=_0xaeb5f5[_0x0697('0x34')]['length']?_0xaeb5f5['attributes']:_0x18a7b4[_0x0697('0x2f')];_0xaeb5f5['order']=qs[_0x0697('0x3a')](_0x3a57c['query'][_0x0697('0x3a')]);_0xaeb5f5[_0x0697('0x3e')]=qs['filters'](_[_0x0697('0x3c')](_0x3a57c[_0x0697('0x30')],_0x18a7b4[_0x0697('0x3b')]));if(_0x3a57c[_0x0697('0x30')]['filter']){_0xaeb5f5[_0x0697('0x3e')]=_[_0x0697('0x3f')](_0xaeb5f5[_0x0697('0x3e')],{'$or':_[_0x0697('0x29')](_0xaeb5f5[_0x0697('0x34')],function(_0x587235){var _0x351bae={};_0x351bae[_0x587235]={'$like':'%'+_0x3a57c[_0x0697('0x30')][_0x0697('0x3d')]+'%'};return _0x351bae;})});}_0xaeb5f5=_[_0x0697('0x3f')]({},_0xaeb5f5,_0x3a57c[_0x0697('0x41')]);return _0x44c307[_0x0697('0x4c')](_0xaeb5f5);}})['then'](function(_0x58b14a){if(_0x58b14a){_0x565a61=_0x58b14a[_0x0697('0x35')];if(!_0x3a57c['query'][_0x0697('0x36')](_0x0697('0x37'))){_0xaeb5f5[_0x0697('0x38')]=qs[_0x0697('0x38')](_0x3a57c['query'][_0x0697('0x38')]);_0xaeb5f5[_0x0697('0x18')]=qs['offset'](_0x3a57c[_0x0697('0x30')][_0x0697('0x18')]);}return _0x44c307[_0x0697('0x4c')](_0xaeb5f5);}})[_0x0697('0x22')](function(_0x161ea9){if(_0x161ea9){return _0x161ea9?{'count':_0x565a61,'rows':_0x161ea9}:null;}})[_0x0697('0x22')](respondWithResult(_0x38e955,null))[_0x0697('0x46')](handleError(_0x38e955,null));};exports[_0x0697('0x4f')]=function(_0x29fe5d,_0x4e646e,_0x2aa917){if(_0x29fe5d['body']['id']){delete _0x29fe5d['body']['id'];}return db[_0x0697('0x2a')][_0x0697('0x4d')]({'where':{'id':_0x29fe5d[_0x0697('0x48')]['id']}})[_0x0697('0x22')](handleEntityNotFound(_0x4e646e,null))['then'](function(_0x456573){if(_0x456573){_0x29fe5d[_0x0697('0x4b')][_0x0697('0x50')]=_0x456573['id'];_0x29fe5d[_0x0697('0x4b')]['Subjects']=integrations[_0x0697('0x51')](_0x29fe5d[_0x0697('0x4b')][_0x0697('0x52')],_0x29fe5d[_0x0697('0x4b')][_0x0697('0x2d')]);_0x29fe5d[_0x0697('0x4b')][_0x0697('0x53')]=integrations['getDescriptions'](_0x29fe5d[_0x0697('0x4b')][_0x0697('0x52')],_0x29fe5d[_0x0697('0x4b')][_0x0697('0x2d')]);return db[_0x0697('0x4e')][_0x0697('0x4a')](_0x29fe5d[_0x0697('0x4b')],{'include':[{'model':db[_0x0697('0x54')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0x0697('0x53')}]});}return null;})['then'](respondWithResult(_0x4e646e,null))[_0x0697('0x46')](handleError(_0x4e646e,null));};exports[_0x0697('0x55')]=function(_0x297dec,_0x5e62f6,_0x577292){var _0x3fea23='';var _0x8126d3=['id',_0x0697('0x26'),_0x0697('0x56'),_0x0697('0x57'),_0x0697('0x58'),_0x0697('0x59'),'duration_hours',_0x0697('0x5a'),_0x0697('0x5b'),_0x0697('0x5c'),_0x0697('0x5d'),'direction'];return db[_0x0697('0x2a')][_0x0697('0x4d')]({'where':{'id':_0x297dec['params']['id']},'attributes':['id','username',_0x0697('0x5e'),_0x0697('0x5f')]})['then'](handleEntityNotFound(_0x5e62f6,null))[_0x0697('0x22')](function(_0x1604bb){if(_0x1604bb){_0x3fea23=_0x1604bb[_0x0697('0x5f')];var _0x46b3ca=_0x3fea23[_0x0697('0x60')](-0x1);if(_0x46b3ca==='/'){_0x3fea23=_0x3fea23[_0x0697('0x61')](0x0,_0x3fea23[_0x0697('0x62')](_0x46b3ca));}return rp({'method':_0x0697('0x63'),'uri':util[_0x0697('0x64')](_0x0697('0x65'),_0x3fea23,_0x0697('0x66')),'json':!![],'form':{'method':'login','input_type':_0x0697('0x67'),'response_type':_0x0697('0x67'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1604bb[_0x0697('0x68')],'password':_0x1604bb[_0x0697('0x5e')],'encryption':_0x0697('0x69')},'application':_0x0697('0x6a')})}});}})[_0x0697('0x22')](function(_0x3478b8){if(_0x3478b8&&_0x3478b8[_0x0697('0x26')]!==_0x0697('0x6b')&&_0x3478b8[_0x0697('0x26')]!==_0x0697('0x6c')){return rp({'method':'POST','uri':util[_0x0697('0x64')]('%s%s',_0x3fea23,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x0697('0x6d'),'input_type':_0x0697('0x67'),'response_type':_0x0697('0x67'),'rest_data':JSON['stringify']({'session':_0x3478b8['id'],'module_name':_0x0697('0x6e')})}})[_0x0697('0x22')](function(_0x39f7a1){if(_0x39f7a1){var _0x8da5d2=_[_0x0697('0x6f')](_0x39f7a1[_0x0697('0x70')]);_[_0x0697('0x71')](_0x8da5d2,function(_0x3113b8){return _0x8126d3[_0x0697('0x72')](_0x3113b8[_0x0697('0x26')]);});return{'count':_0x8da5d2['length'],'rows':_[_0x0697('0x29')](_0x8da5d2,function(_0x5c53b8){return{'id':_0x5c53b8[_0x0697('0x26')],'name':_0x5c53b8[_0x0697('0x73')],'custom':_[_0x0697('0x74')](_0x5c53b8[_0x0697('0x26')],'_c')?!![]:![],'options':_0x5c53b8[_0x0697('0x41')]?_['map'](_[_0x0697('0x6f')](_0x5c53b8['options']),function(_0x340f51){return{'name':_0x340f51[_0x0697('0x75')],'value':_0x340f51[_0x0697('0x26')]};}):[]};})};}})[_0x0697('0x22')](respondWithResult(_0x5e62f6,null))['catch'](function(_0x5110f5){var _0x5401fb=_0x297dec[_0x0697('0x30')][_0x0697('0x76')]?0x1f4:_0x5110f5[_0x0697('0x77')]||0x1f4;logger[_0x0697('0x78')](_0x0697('0x79'),_0x0697('0x55'),_0x5401fb,JSON[_0x0697('0x7a')](_0x5110f5));delete _0x5110f5['name'];if(_0x5401fb===0x191){_0x5401fb=0x190;}_0x5e62f6[_0x0697('0x1b')](_0x5401fb)[_0x0697('0x27')](_0x297dec['query'][_0x0697('0x76')]?{'message':_0x0697('0x7b'),'statusCode':_0x5110f5[_0x0697('0x77')]}:_0x5110f5);});}else{var _0x1736c7=0x1f4;_0x5e62f6[_0x0697('0x1b')](_0x1736c7)[_0x0697('0x27')]({'message':_0x0697('0x7b'),'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 3c5789d..3295c92 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 _0x3bf2=['int_sugarcrm_accounts','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x2533cd,_0x5dd3ae){var _0x4a0cd4=function(_0x262431){while(--_0x262431){_0x2533cd['push'](_0x2533cd['shift']());}};_0x4a0cd4(++_0x5dd3ae);}(_0x3bf2,0x169));var _0x23bf=function(_0x109f4d,_0x39dabd){_0x109f4d=_0x109f4d-0x0;var _0x541706=_0x3bf2[_0x109f4d];return _0x541706;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x23bf('0x0'))('api');var moment=require(_0x23bf('0x1'));var BPromise=require(_0x23bf('0x2'));var rp=require(_0x23bf('0x3'));var fs=require('fs');var path=require(_0x23bf('0x4'));var rimraf=require('rimraf');var config=require(_0x23bf('0x5'));var attributes=require(_0x23bf('0x6'));var integrations=require(_0x23bf('0x7'));module[_0x23bf('0x8')]=function(_0x418177,_0x3c7639){return _0x418177[_0x23bf('0x9')](_0x23bf('0xa'),attributes,{'tableName':_0x23bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc09e=['../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x4dde9b,_0x51de1d){var _0x1d9b04=function(_0x37f51d){while(--_0x37f51d){_0x4dde9b['push'](_0x4dde9b['shift']());}};_0x1d9b04(++_0x51de1d);}(_0xc09e,0x6f));var _0xec09=function(_0x337d17,_0x2b74d1){_0x337d17=_0x337d17-0x0;var _0x5a34f2=_0xc09e[_0x337d17];return _0x5a34f2;};'use strict';var _=require(_0xec09('0x0'));var util=require('util');var logger=require(_0xec09('0x1'))(_0xec09('0x2'));var moment=require(_0xec09('0x3'));var BPromise=require(_0xec09('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec09('0x5'));var rimraf=require('rimraf');var config=require(_0xec09('0x6'));var attributes=require(_0xec09('0x7'));var integrations=require(_0xec09('0x8'));module[_0xec09('0x9')]=function(_0x551bda,_0xa9a183){return _0x551bda[_0xec09('0xa')](_0xec09('0xb'),attributes,{'tableName':_0xec09('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index d379a23..e8ac1d5 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 _0x63c8=['model','ShowSugarcrmAccount','find','then','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','include','map'];(function(_0x2ba740,_0x62a305){var _0x358bda=function(_0x16cc07){while(--_0x16cc07){_0x2ba740['push'](_0x2ba740['shift']());}};_0x358bda(++_0x62a305);}(_0x63c8,0x1d6));var _0x863c=function(_0x2eeea9,_0x3ae60d){_0x2eeea9=_0x2eeea9-0x0;var _0x5a8a43=_0x63c8[_0x2eeea9];return _0x5a8a43;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x863c('0x0'));var BPromise=require(_0x863c('0x1'));var rs=require(_0x863c('0x2'));var fs=require('fs');var Redis=require(_0x863c('0x3'));var db=require(_0x863c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x863c('0x5'));var config=require('../../config/environment');var jayson=require(_0x863c('0x6'));var client=jayson[_0x863c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24ee88,_0x15c26b,_0x49bba2){return new BPromise(function(_0x17e47e,_0x1a9339){return client[_0x863c('0x8')](_0x24ee88,_0x49bba2)['then'](function(_0x2d0721){logger[_0x863c('0x9')](_0x863c('0xa'),_0x15c26b,_0x863c('0xb'));logger[_0x863c('0xc')](_0x863c('0xd'),_0x15c26b,_0x863c('0xb'),JSON['stringify'](_0x2d0721));if(_0x2d0721[_0x863c('0xe')]){if(_0x2d0721['error']['code']===0x1f4){logger[_0x863c('0xe')](_0x863c('0xa'),_0x15c26b,_0x2d0721['error'][_0x863c('0xf')]);return _0x1a9339(_0x2d0721['error']['message']);}logger[_0x863c('0xe')](_0x863c('0xa'),_0x15c26b,_0x2d0721[_0x863c('0xe')][_0x863c('0xf')]);return _0x17e47e(_0x2d0721[_0x863c('0xe')][_0x863c('0xf')]);}else{logger[_0x863c('0x9')](_0x863c('0xa'),_0x15c26b,_0x863c('0xb'));_0x17e47e(_0x2d0721[_0x863c('0x10')][_0x863c('0xf')]);}})[_0x863c('0x11')](function(_0x39b27e){logger['error'](_0x863c('0xa'),_0x15c26b,_0x39b27e);_0x1a9339(_0x39b27e);});});}exports[_0x863c('0x12')]=function(_0x2d6c5f){var _0x544203=this;return new Promise(function(_0x2ee0da,_0x5c5e82){return db[_0x863c('0x13')]['findAll']({'raw':_0x2d6c5f[_0x863c('0x14')]?_0x2d6c5f[_0x863c('0x14')][_0x863c('0x15')]===undefined?!![]:![]:!![],'where':_0x2d6c5f['options']?_0x2d6c5f[_0x863c('0x14')][_0x863c('0x16')]||null:null,'attributes':_0x2d6c5f[_0x863c('0x14')]?_0x2d6c5f[_0x863c('0x14')][_0x863c('0x17')]||null:null,'limit':_0x2d6c5f[_0x863c('0x14')]?_0x2d6c5f[_0x863c('0x14')]['limit']||null:null,'include':_0x2d6c5f[_0x863c('0x14')]?_0x2d6c5f[_0x863c('0x14')]['include']?_['map'](_0x2d6c5f[_0x863c('0x14')][_0x863c('0x18')],function(_0x4330b4){return{'model':db[_0x4330b4['model']],'as':_0x4330b4['as'],'attributes':_0x4330b4[_0x863c('0x17')],'include':_0x4330b4[_0x863c('0x18')]?_[_0x863c('0x19')](_0x4330b4[_0x863c('0x18')],function(_0x136afa){return{'model':db[_0x136afa['model']],'as':_0x136afa['as'],'attributes':_0x136afa['attributes'],'include':_0x136afa['include']?_[_0x863c('0x19')](_0x136afa[_0x863c('0x18')],function(_0x1cdc8f){return{'model':db[_0x1cdc8f[_0x863c('0x1a')]],'as':_0x1cdc8f['as'],'attributes':_0x1cdc8f[_0x863c('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x159008){logger[_0x863c('0x9')](_0x863c('0x12'),_0x2d6c5f);logger[_0x863c('0xc')](_0x863c('0x12'),_0x2d6c5f,JSON['stringify'](_0x159008));_0x2ee0da(_0x159008);})['catch'](function(_0x234236){logger['error'](_0x863c('0x12'),_0x234236[_0x863c('0xf')],_0x2d6c5f);_0x5c5e82(_0x544203[_0x863c('0xe')](0x1f4,_0x234236[_0x863c('0xf')]));});});};exports[_0x863c('0x1b')]=function(_0x312355){var _0x4ac081=this;return new Promise(function(_0x68cca3,_0x83e929){return db['SugarcrmAccount'][_0x863c('0x1c')]({'raw':_0x312355['options']?_0x312355['options'][_0x863c('0x15')]===undefined?!![]:![]:!![],'where':_0x312355[_0x863c('0x14')]?_0x312355['options'][_0x863c('0x16')]||null:null,'attributes':_0x312355[_0x863c('0x14')]?_0x312355[_0x863c('0x14')][_0x863c('0x17')]||null:null,'include':_0x312355[_0x863c('0x14')]?_0x312355[_0x863c('0x14')]['include']?_[_0x863c('0x19')](_0x312355[_0x863c('0x14')]['include'],function(_0x3b9d93){return{'model':db[_0x3b9d93['model']],'as':_0x3b9d93['as'],'attributes':_0x3b9d93[_0x863c('0x17')],'include':_0x3b9d93[_0x863c('0x18')]?_[_0x863c('0x19')](_0x3b9d93[_0x863c('0x18')],function(_0x1e1c0c){return{'model':db[_0x1e1c0c[_0x863c('0x1a')]],'as':_0x1e1c0c['as'],'attributes':_0x1e1c0c[_0x863c('0x17')],'include':_0x1e1c0c['include']?_[_0x863c('0x19')](_0x1e1c0c[_0x863c('0x18')],function(_0x3af2c7){return{'model':db[_0x3af2c7['model']],'as':_0x3af2c7['as'],'attributes':_0x3af2c7[_0x863c('0x17')]};}):[]};}):[]};}):[]:[]})[_0x863c('0x1d')](function(_0x11ffec){logger[_0x863c('0x9')]('ShowSugarcrmAccount',_0x312355);logger[_0x863c('0xc')](_0x863c('0x1b'),_0x312355,JSON[_0x863c('0x1e')](_0x11ffec));_0x68cca3(_0x11ffec);})['catch'](function(_0x158e23){logger[_0x863c('0xe')](_0x863c('0x1b'),_0x158e23[_0x863c('0xf')],_0x312355);_0x83e929(_0x4ac081[_0x863c('0xe')](0x1f4,_0x158e23['message']));});});}; \ No newline at end of file +var _0x2fae=['request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowSugarcrmAccount','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http'];(function(_0x51228b,_0x2560d2){var _0x1c3dd7=function(_0x44a334){while(--_0x44a334){_0x51228b['push'](_0x51228b['shift']());}};_0x1c3dd7(++_0x2560d2);}(_0x2fae,0xb7));var _0xe2fa=function(_0x22051f,_0x2623ce){_0x22051f=_0x22051f-0x0;var _0x260526=_0x2fae[_0x22051f];return _0x260526;};'use strict';var _=require(_0xe2fa('0x0'));var util=require(_0xe2fa('0x1'));var moment=require(_0xe2fa('0x2'));var BPromise=require(_0xe2fa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2fa('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe2fa('0x5'));var config=require(_0xe2fa('0x6'));var jayson=require(_0xe2fa('0x7'));var client=jayson['client'][_0xe2fa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x298ccb,_0x3264b2,_0x59da4e){return new BPromise(function(_0x2efe26,_0x2becec){return client[_0xe2fa('0x9')](_0x298ccb,_0x59da4e)['then'](function(_0x40ef9c){logger[_0xe2fa('0xa')](_0xe2fa('0xb'),_0x3264b2,_0xe2fa('0xc'));logger[_0xe2fa('0xd')](_0xe2fa('0xe'),_0x3264b2,_0xe2fa('0xc'),JSON['stringify'](_0x40ef9c));if(_0x40ef9c[_0xe2fa('0xf')]){if(_0x40ef9c[_0xe2fa('0xf')]['code']===0x1f4){logger[_0xe2fa('0xf')](_0xe2fa('0xb'),_0x3264b2,_0x40ef9c[_0xe2fa('0xf')]['message']);return _0x2becec(_0x40ef9c[_0xe2fa('0xf')][_0xe2fa('0x10')]);}logger[_0xe2fa('0xf')](_0xe2fa('0xb'),_0x3264b2,_0x40ef9c['error'][_0xe2fa('0x10')]);return _0x2efe26(_0x40ef9c[_0xe2fa('0xf')][_0xe2fa('0x10')]);}else{logger[_0xe2fa('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x3264b2,'request\x20sent');_0x2efe26(_0x40ef9c[_0xe2fa('0x11')][_0xe2fa('0x10')]);}})[_0xe2fa('0x12')](function(_0xf3b30b){logger['error'](_0xe2fa('0xb'),_0x3264b2,_0xf3b30b);_0x2becec(_0xf3b30b);});});}exports[_0xe2fa('0x13')]=function(_0x2a3b46){var _0x19e818=this;return new Promise(function(_0x22e0e3,_0x1920e0){return db[_0xe2fa('0x14')][_0xe2fa('0x15')]({'raw':_0x2a3b46[_0xe2fa('0x16')]?_0x2a3b46['options'][_0xe2fa('0x17')]===undefined?!![]:![]:!![],'where':_0x2a3b46[_0xe2fa('0x16')]?_0x2a3b46['options'][_0xe2fa('0x18')]||null:null,'attributes':_0x2a3b46[_0xe2fa('0x16')]?_0x2a3b46[_0xe2fa('0x16')]['attributes']||null:null,'limit':_0x2a3b46['options']?_0x2a3b46[_0xe2fa('0x16')][_0xe2fa('0x19')]||null:null,'include':_0x2a3b46['options']?_0x2a3b46[_0xe2fa('0x16')][_0xe2fa('0x1a')]?_[_0xe2fa('0x1b')](_0x2a3b46[_0xe2fa('0x16')]['include'],function(_0x343718){return{'model':db[_0x343718[_0xe2fa('0x1c')]],'as':_0x343718['as'],'attributes':_0x343718[_0xe2fa('0x1d')],'include':_0x343718[_0xe2fa('0x1a')]?_[_0xe2fa('0x1b')](_0x343718[_0xe2fa('0x1a')],function(_0xa1296c){return{'model':db[_0xa1296c[_0xe2fa('0x1c')]],'as':_0xa1296c['as'],'attributes':_0xa1296c[_0xe2fa('0x1d')],'include':_0xa1296c[_0xe2fa('0x1a')]?_[_0xe2fa('0x1b')](_0xa1296c[_0xe2fa('0x1a')],function(_0x57a904){return{'model':db[_0x57a904[_0xe2fa('0x1c')]],'as':_0x57a904['as'],'attributes':_0x57a904[_0xe2fa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe2fa('0x1e')](function(_0x2e0e6d){logger[_0xe2fa('0xa')](_0xe2fa('0x13'),_0x2a3b46);logger[_0xe2fa('0xd')](_0xe2fa('0x13'),_0x2a3b46,JSON['stringify'](_0x2e0e6d));_0x22e0e3(_0x2e0e6d);})[_0xe2fa('0x12')](function(_0x4ff8f3){logger['error'](_0xe2fa('0x13'),_0x4ff8f3[_0xe2fa('0x10')],_0x2a3b46);_0x1920e0(_0x19e818[_0xe2fa('0xf')](0x1f4,_0x4ff8f3[_0xe2fa('0x10')]));});});};exports[_0xe2fa('0x1f')]=function(_0x326fd5){var _0x4a0459=this;return new Promise(function(_0x5482b1,_0x576a91){return db['SugarcrmAccount']['find']({'raw':_0x326fd5['options']?_0x326fd5[_0xe2fa('0x16')][_0xe2fa('0x17')]===undefined?!![]:![]:!![],'where':_0x326fd5[_0xe2fa('0x16')]?_0x326fd5[_0xe2fa('0x16')][_0xe2fa('0x18')]||null:null,'attributes':_0x326fd5[_0xe2fa('0x16')]?_0x326fd5['options'][_0xe2fa('0x1d')]||null:null,'include':_0x326fd5[_0xe2fa('0x16')]?_0x326fd5['options'][_0xe2fa('0x1a')]?_[_0xe2fa('0x1b')](_0x326fd5[_0xe2fa('0x16')][_0xe2fa('0x1a')],function(_0x1810ae){return{'model':db[_0x1810ae[_0xe2fa('0x1c')]],'as':_0x1810ae['as'],'attributes':_0x1810ae['attributes'],'include':_0x1810ae['include']?_[_0xe2fa('0x1b')](_0x1810ae['include'],function(_0x6f873f){return{'model':db[_0x6f873f[_0xe2fa('0x1c')]],'as':_0x6f873f['as'],'attributes':_0x6f873f[_0xe2fa('0x1d')],'include':_0x6f873f[_0xe2fa('0x1a')]?_[_0xe2fa('0x1b')](_0x6f873f[_0xe2fa('0x1a')],function(_0x1210fc){return{'model':db[_0x1210fc[_0xe2fa('0x1c')]],'as':_0x1210fc['as'],'attributes':_0x1210fc[_0xe2fa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe2fa('0x1e')](function(_0x111bc2){logger[_0xe2fa('0xa')]('ShowSugarcrmAccount',_0x326fd5);logger['debug'](_0xe2fa('0x1f'),_0x326fd5,JSON['stringify'](_0x111bc2));_0x5482b1(_0x111bc2);})[_0xe2fa('0x12')](function(_0x57a974){logger['error'](_0xe2fa('0x1f'),_0x57a974[_0xe2fa('0x10')],_0x326fd5);_0x576a91(_0x4a0459[_0xe2fa('0xf')](0x1f4,_0x57a974[_0xe2fa('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 824fff8..0a1ef38 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 _0xef82=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xef82,0x98));var _0x2ef8=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xef82[_0x29d915];return _0x160f86;};'use strict';var multer=require('multer');var util=require(_0x2ef8('0x0'));var path=require(_0x2ef8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2ef8('0x2'));var auth=require(_0x2ef8('0x3'));var interaction=require(_0x2ef8('0x4'));var config=require(_0x2ef8('0x5'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x2ef8('0x6')]('/',auth[_0x2ef8('0x7')](),controller[_0x2ef8('0x8')]);router[_0x2ef8('0x6')](_0x2ef8('0x9'),auth['isAuthenticated'](),controller[_0x2ef8('0xa')]);router[_0x2ef8('0x6')](_0x2ef8('0xb'),auth[_0x2ef8('0x7')](),controller[_0x2ef8('0xc')]);router[_0x2ef8('0x6')](_0x2ef8('0xd'),auth['isAuthenticated'](),controller[_0x2ef8('0xe')]);router['get'](_0x2ef8('0xf'),auth[_0x2ef8('0x7')](),controller[_0x2ef8('0x10')]);router[_0x2ef8('0x11')]('/',auth[_0x2ef8('0x7')](),controller[_0x2ef8('0x12')]);router[_0x2ef8('0x13')](_0x2ef8('0x9'),auth[_0x2ef8('0x7')](),controller[_0x2ef8('0x14')]);router[_0x2ef8('0x15')]('/:id',auth[_0x2ef8('0x7')](),controller[_0x2ef8('0x16')]);module['exports']=router; \ No newline at end of file +var _0xa9c3=['getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id/fields'];(function(_0x29c94c,_0x17ebfc){var _0x3cf13b=function(_0x5d02bb){while(--_0x5d02bb){_0x29c94c['push'](_0x29c94c['shift']());}};_0x3cf13b(++_0x17ebfc);}(_0xa9c3,0x1d4));var _0x3a9c=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xa9c3[_0x556bb1];return _0x45455f;};'use strict';var multer=require(_0x3a9c('0x0'));var util=require('util');var path=require(_0x3a9c('0x1'));var timeout=require(_0x3a9c('0x2'));var express=require(_0x3a9c('0x3'));var router=express[_0x3a9c('0x4')]();var fs_extra=require(_0x3a9c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3a9c('0x6'));var config=require(_0x3a9c('0x7'));var controller=require(_0x3a9c('0x8'));router[_0x3a9c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x3a9c('0xa')](),controller['show']);router[_0x3a9c('0x9')](_0x3a9c('0xb'),auth['isAuthenticated'](),controller[_0x3a9c('0xc')]);router[_0x3a9c('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x3a9c('0xd')]);router['get'](_0x3a9c('0xe'),auth['isAuthenticated'](),controller[_0x3a9c('0xf')]);router[_0x3a9c('0x10')]('/',auth[_0x3a9c('0xa')](),controller[_0x3a9c('0x11')]);router[_0x3a9c('0x12')](_0x3a9c('0x13'),auth['isAuthenticated'](),controller[_0x3a9c('0x14')]);router[_0x3a9c('0x15')](_0x3a9c('0x13'),auth[_0x3a9c('0xa')](),controller[_0x3a9c('0x16')]);module[_0x3a9c('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 7b23b5a..0384b3f 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 _0xc878=['STRING','exports'];(function(_0x42bcc4,_0x186466){var _0x230c21=function(_0x102199){while(--_0x102199){_0x42bcc4['push'](_0x42bcc4['shift']());}};_0x230c21(++_0x186466);}(_0xc878,0xf7));var _0x8c87=function(_0x4ad0f7,_0x1920b0){_0x4ad0f7=_0x4ad0f7-0x0;var _0x30f5c8=_0xc878[_0x4ad0f7];return _0x30f5c8;};'use strict';var Sequelize=require('sequelize');module[_0x8c87('0x0')]={'name':{'type':Sequelize[_0x8c87('0x1')]},'description':{'type':Sequelize[_0x8c87('0x1')]}}; \ No newline at end of file +var _0x23c7=['exports','STRING','sequelize'];(function(_0x27eac4,_0x1b3ca5){var _0x3cb1f1=function(_0xda30d8){while(--_0xda30d8){_0x27eac4['push'](_0x27eac4['shift']());}};_0x3cb1f1(++_0x1b3ca5);}(_0x23c7,0xa4));var _0x723c=function(_0x49eee5,_0x5340e7){_0x49eee5=_0x49eee5-0x0;var _0x18b29b=_0x23c7[_0x49eee5];return _0x18b29b;};'use strict';var Sequelize=require(_0x723c('0x0'));module[_0x723c('0x1')]={'name':{'type':Sequelize[_0x723c('0x2')]},'description':{'type':Sequelize[_0x723c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 9ca7398..2d68ff3 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 _0xeaf3=['key','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','name','options','includeAll','rows','catch','show','params','keys','SugarcrmConfiguration','include','find','create','body','getFields','SugarcrmField','pick','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','index','map','rawAttributes','fieldName','type'];(function(_0x20db5c,_0x3e2079){var _0x299b65=function(_0x4d38bd){while(--_0x4d38bd){_0x20db5c['push'](_0x20db5c['shift']());}};_0x299b65(++_0x3e2079);}(_0xeaf3,0x17b));var _0x3eaf=function(_0x38f75e,_0x1c1ac0){_0x38f75e=_0x38f75e-0x0;var _0x345c5f=_0xeaf3[_0x38f75e];return _0x345c5f;};'use strict';var emlformat=require(_0x3eaf('0x0'));var rimraf=require(_0x3eaf('0x1'));var zipdir=require(_0x3eaf('0x2'));var jsonpatch=require(_0x3eaf('0x3'));var rp=require(_0x3eaf('0x4'));var moment=require(_0x3eaf('0x5'));var BPromise=require(_0x3eaf('0x6'));var Mustache=require(_0x3eaf('0x7'));var util=require(_0x3eaf('0x8'));var path=require(_0x3eaf('0x9'));var sox=require(_0x3eaf('0xa'));var csv=require('to-csv');var ejs=require(_0x3eaf('0xb'));var fs=require('fs');var fs_extra=require(_0x3eaf('0xc'));var _=require(_0x3eaf('0xd'));var squel=require(_0x3eaf('0xe'));var crypto=require(_0x3eaf('0xf'));var jsforce=require(_0x3eaf('0x10'));var deskjs=require(_0x3eaf('0x11'));var toCsv=require(_0x3eaf('0x12'));var querystring=require('querystring');var Papa=require(_0x3eaf('0x13'));var Redis=require('ioredis');var authService=require(_0x3eaf('0x14'));var qs=require(_0x3eaf('0x15'));var as=require(_0x3eaf('0x16'));var hardwareService=require(_0x3eaf('0x17'));var logger=require(_0x3eaf('0x18'))(_0x3eaf('0x19'));var utils=require(_0x3eaf('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x3eaf('0x1b'));var db=require(_0x3eaf('0x1c'))['db'];function respondWithStatusCode(_0xb9c592,_0x1aa2b2){_0x1aa2b2=_0x1aa2b2||0xcc;return function(_0x4e6617){if(_0x4e6617){return _0xb9c592[_0x3eaf('0x1d')](_0x1aa2b2);}return _0xb9c592[_0x3eaf('0x1e')](_0x1aa2b2)[_0x3eaf('0x1f')]();};}function respondWithResult(_0x5773cd,_0x1da3d6){_0x1da3d6=_0x1da3d6||0xc8;return function(_0x4f5a09){if(_0x4f5a09){return _0x5773cd[_0x3eaf('0x1e')](_0x1da3d6)[_0x3eaf('0x20')](_0x4f5a09);}};}function respondWithFilteredResult(_0x1ef5e1,_0x1c8278){return function(_0x1ba1bf){if(_0x1ba1bf){var _0x4e4ee7=typeof _0x1c8278[_0x3eaf('0x21')]===_0x3eaf('0x22')&&typeof _0x1c8278[_0x3eaf('0x23')]===_0x3eaf('0x22');var _0x1fb48e=_0x1ba1bf[_0x3eaf('0x24')];var _0x9977fc=_0x4e4ee7?0x0:_0x1c8278[_0x3eaf('0x21')];var _0x2ece28=_0x4e4ee7?_0x1ba1bf[_0x3eaf('0x24')]:_0x1c8278[_0x3eaf('0x21')]+_0x1c8278[_0x3eaf('0x23')];var _0x4a638a;if(_0x2ece28>=_0x1fb48e){_0x2ece28=_0x1fb48e;_0x4a638a=0xc8;}else{_0x4a638a=0xce;}_0x1ef5e1[_0x3eaf('0x1e')](_0x4a638a);return _0x1ef5e1[_0x3eaf('0x25')](_0x3eaf('0x26'),_0x9977fc+'-'+_0x2ece28+'/'+_0x1fb48e)['json'](_0x1ba1bf);}return null;};}function patchUpdates(_0x28fb08){return function(_0xc464b5){try{jsonpatch[_0x3eaf('0x27')](_0xc464b5,_0x28fb08,!![]);}catch(_0x370a72){return BPromise[_0x3eaf('0x28')](_0x370a72);}return _0xc464b5[_0x3eaf('0x29')]();};}function saveUpdates(_0xdd8c66,_0x21ba66){return function(_0x170c4c){if(_0x170c4c){return _0x170c4c[_0x3eaf('0x2a')](_0xdd8c66)[_0x3eaf('0x2b')](function(_0x457d01){return _0x457d01;});}return null;};}function removeEntity(_0x36e2c2,_0x3e09df){return function(_0x59481c){if(_0x59481c){return _0x59481c[_0x3eaf('0x2c')]()[_0x3eaf('0x2b')](function(){_0x36e2c2[_0x3eaf('0x1e')](0xcc)[_0x3eaf('0x1f')]();});}};}function handleEntityNotFound(_0x50ad8f,_0x1ab8a0){return function(_0x4607c3){if(!_0x4607c3){_0x50ad8f[_0x3eaf('0x1d')](0x194);}return _0x4607c3;};}function handleError(_0x422acb,_0x180df2){_0x180df2=_0x180df2||0x1f4;return function(_0x1cd03f){logger['error'](_0x1cd03f[_0x3eaf('0x2d')]);if(_0x1cd03f['name']){delete _0x1cd03f['name'];}_0x422acb[_0x3eaf('0x1e')](_0x180df2)['send'](_0x1cd03f);};}exports[_0x3eaf('0x2e')]=function(_0x26b817,_0x473a10){var _0x33fb43={},_0x47613e={},_0x5c6274={'count':0x0,'rows':[]};var _0x5322c2=_[_0x3eaf('0x2f')](db['SugarcrmConfiguration'][_0x3eaf('0x30')],function(_0x32c513){return{'name':_0x32c513[_0x3eaf('0x31')],'type':_0x32c513[_0x3eaf('0x32')][_0x3eaf('0x33')]};});_0x47613e['model']=_[_0x3eaf('0x2f')](_0x5322c2,'name');_0x47613e['query']=_['keys'](_0x26b817['query']);_0x47613e[_0x3eaf('0x34')]=_['intersection'](_0x47613e[_0x3eaf('0x35')],_0x47613e[_0x3eaf('0x36')]);_0x33fb43[_0x3eaf('0x37')]=_[_0x3eaf('0x38')](_0x47613e[_0x3eaf('0x35')],qs[_0x3eaf('0x39')](_0x26b817['query'][_0x3eaf('0x39')]));_0x33fb43[_0x3eaf('0x37')]=_0x33fb43[_0x3eaf('0x37')][_0x3eaf('0x3a')]?_0x33fb43[_0x3eaf('0x37')]:_0x47613e['model'];if(!_0x26b817[_0x3eaf('0x36')][_0x3eaf('0x3b')](_0x3eaf('0x3c'))){_0x33fb43[_0x3eaf('0x23')]=qs['limit'](_0x26b817[_0x3eaf('0x36')][_0x3eaf('0x23')]);_0x33fb43[_0x3eaf('0x21')]=qs['offset'](_0x26b817[_0x3eaf('0x36')][_0x3eaf('0x21')]);}_0x33fb43[_0x3eaf('0x3d')]=qs[_0x3eaf('0x3e')](_0x26b817[_0x3eaf('0x36')]['sort']);_0x33fb43['where']=qs[_0x3eaf('0x34')](_['pick'](_0x26b817['query'],_0x47613e[_0x3eaf('0x34')]),_0x5322c2);if(_0x26b817[_0x3eaf('0x36')][_0x3eaf('0x3f')]){_0x33fb43[_0x3eaf('0x40')]=_[_0x3eaf('0x41')](_0x33fb43['where'],{'$or':_[_0x3eaf('0x2f')](_0x5322c2,function(_0x71acf3){if(_0x71acf3[_0x3eaf('0x32')]!==_0x3eaf('0x42')){var _0x11e371={};_0x11e371[_0x71acf3[_0x3eaf('0x43')]]={'$like':'%'+_0x26b817[_0x3eaf('0x36')][_0x3eaf('0x3f')]+'%'};return _0x11e371;}})});}_0x33fb43=_[_0x3eaf('0x41')]({},_0x33fb43,_0x26b817[_0x3eaf('0x44')]);var _0x4802b3={'where':_0x33fb43[_0x3eaf('0x40')]};return db['SugarcrmConfiguration'][_0x3eaf('0x24')](_0x4802b3)[_0x3eaf('0x2b')](function(_0x2c6499){_0x5c6274[_0x3eaf('0x24')]=_0x2c6499;if(_0x26b817[_0x3eaf('0x36')][_0x3eaf('0x45')]){_0x33fb43['include']=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x33fb43);})['then'](function(_0x3c07dd){_0x5c6274[_0x3eaf('0x46')]=_0x3c07dd;return _0x5c6274;})[_0x3eaf('0x2b')](respondWithFilteredResult(_0x473a10,_0x33fb43))[_0x3eaf('0x47')](handleError(_0x473a10,null));};exports[_0x3eaf('0x48')]=function(_0x4135dc,_0x96b729){var _0x1546aa={'raw':![],'where':{'id':_0x4135dc[_0x3eaf('0x49')]['id']}},_0x39701a={};_0x39701a[_0x3eaf('0x35')]=_[_0x3eaf('0x4a')](db[_0x3eaf('0x4b')]['rawAttributes']);_0x39701a[_0x3eaf('0x36')]=_['keys'](_0x4135dc[_0x3eaf('0x36')]);_0x39701a['filters']=_[_0x3eaf('0x38')](_0x39701a[_0x3eaf('0x35')],_0x39701a['query']);_0x1546aa[_0x3eaf('0x37')]=_['intersection'](_0x39701a['model'],qs[_0x3eaf('0x39')](_0x4135dc[_0x3eaf('0x36')][_0x3eaf('0x39')]));_0x1546aa[_0x3eaf('0x37')]=_0x1546aa[_0x3eaf('0x37')]['length']?_0x1546aa[_0x3eaf('0x37')]:_0x39701a[_0x3eaf('0x35')];if(_0x4135dc[_0x3eaf('0x36')][_0x3eaf('0x45')]){_0x1546aa[_0x3eaf('0x4c')]=[{'all':!![]}];}_0x1546aa=_[_0x3eaf('0x41')]({},_0x1546aa,_0x4135dc[_0x3eaf('0x44')]);return db[_0x3eaf('0x4b')][_0x3eaf('0x4d')](_0x1546aa)[_0x3eaf('0x2b')](handleEntityNotFound(_0x96b729,null))[_0x3eaf('0x2b')](respondWithResult(_0x96b729,null))['catch'](handleError(_0x96b729,null));};exports['create']=function(_0x5f2b79,_0x179d66){return db['SugarcrmConfiguration'][_0x3eaf('0x4e')](_0x5f2b79[_0x3eaf('0x4f')],{})[_0x3eaf('0x2b')](respondWithResult(_0x179d66,0xc9))[_0x3eaf('0x47')](handleError(_0x179d66,null));};exports['update']=function(_0x47c361,_0x154ffd){if(_0x47c361['body']['id']){delete _0x47c361[_0x3eaf('0x4f')]['id'];}return db['SugarcrmConfiguration'][_0x3eaf('0x4d')]({'where':{'id':_0x47c361[_0x3eaf('0x49')]['id']}})['then'](handleEntityNotFound(_0x154ffd,null))[_0x3eaf('0x2b')](saveUpdates(_0x47c361['body'],null))[_0x3eaf('0x2b')](respondWithResult(_0x154ffd,null))[_0x3eaf('0x47')](handleError(_0x154ffd,null));};exports[_0x3eaf('0x2c')]=function(_0x27634a,_0x241855){return db[_0x3eaf('0x4b')][_0x3eaf('0x4d')]({'where':{'id':_0x27634a[_0x3eaf('0x49')]['id']}})[_0x3eaf('0x2b')](handleEntityNotFound(_0x241855,null))[_0x3eaf('0x2b')](removeEntity(_0x241855,null))[_0x3eaf('0x47')](handleError(_0x241855,null));};exports[_0x3eaf('0x50')]=function(_0x2a7cb1,_0x6d2a0c,_0x1bb75e){var _0x481f64={};var _0x2ddf72={};var _0x2a9820;var _0x32af26;return db[_0x3eaf('0x4b')]['findOne']({'where':{'id':_0x2a7cb1[_0x3eaf('0x49')]['id']}})[_0x3eaf('0x2b')](handleEntityNotFound(_0x6d2a0c,null))[_0x3eaf('0x2b')](function(_0x20ed3b){if(_0x20ed3b){_0x2a9820=_0x20ed3b;_0x2ddf72[_0x3eaf('0x35')]=_[_0x3eaf('0x4a')](db[_0x3eaf('0x51')][_0x3eaf('0x30')]);_0x2ddf72[_0x3eaf('0x36')]=_[_0x3eaf('0x4a')](_0x2a7cb1[_0x3eaf('0x36')]);_0x2ddf72[_0x3eaf('0x34')]=_[_0x3eaf('0x38')](_0x2ddf72[_0x3eaf('0x35')],_0x2ddf72[_0x3eaf('0x36')]);_0x481f64['attributes']=_['intersection'](_0x2ddf72[_0x3eaf('0x35')],qs[_0x3eaf('0x39')](_0x2a7cb1[_0x3eaf('0x36')][_0x3eaf('0x39')]));_0x481f64[_0x3eaf('0x37')]=_0x481f64[_0x3eaf('0x37')][_0x3eaf('0x3a')]?_0x481f64[_0x3eaf('0x37')]:_0x2ddf72[_0x3eaf('0x35')];_0x481f64[_0x3eaf('0x3d')]=qs[_0x3eaf('0x3e')](_0x2a7cb1[_0x3eaf('0x36')]['sort']);_0x481f64[_0x3eaf('0x40')]=qs[_0x3eaf('0x34')](_[_0x3eaf('0x52')](_0x2a7cb1[_0x3eaf('0x36')],_0x2ddf72[_0x3eaf('0x34')]));if(_0x2a7cb1[_0x3eaf('0x36')][_0x3eaf('0x3f')]){_0x481f64[_0x3eaf('0x40')]=_[_0x3eaf('0x41')](_0x481f64[_0x3eaf('0x40')],{'$or':_[_0x3eaf('0x2f')](_0x481f64[_0x3eaf('0x37')],function(_0x7e4a5){var _0x5dd3bc={};_0x5dd3bc[_0x7e4a5]={'$like':'%'+_0x2a7cb1['query']['filter']+'%'};return _0x5dd3bc;})});}_0x481f64=_[_0x3eaf('0x41')]({},_0x481f64,_0x2a7cb1['options']);return _0x2a9820[_0x3eaf('0x50')](_0x481f64);}})[_0x3eaf('0x2b')](function(_0x3017f4){if(_0x3017f4){_0x32af26=_0x3017f4[_0x3eaf('0x3a')];if(!_0x2a7cb1[_0x3eaf('0x36')][_0x3eaf('0x3b')](_0x3eaf('0x3c'))){_0x481f64[_0x3eaf('0x23')]=qs[_0x3eaf('0x23')](_0x2a7cb1[_0x3eaf('0x36')][_0x3eaf('0x23')]);_0x481f64[_0x3eaf('0x21')]=qs[_0x3eaf('0x21')](_0x2a7cb1[_0x3eaf('0x36')][_0x3eaf('0x21')]);}return _0x2a9820[_0x3eaf('0x50')](_0x481f64);}})[_0x3eaf('0x2b')](function(_0x298e43){if(_0x298e43){return _0x298e43?{'count':_0x32af26,'rows':_0x298e43}:null;}})[_0x3eaf('0x2b')](respondWithResult(_0x6d2a0c,null))[_0x3eaf('0x47')](handleError(_0x6d2a0c,null));};exports[_0x3eaf('0x53')]=function(_0x553a91,_0x44ec96,_0x5b66b6){var _0x21dd0c={};var _0x4c62a7={};var _0x3c39a6;var _0x40a769;return db[_0x3eaf('0x4b')][_0x3eaf('0x54')]({'where':{'id':_0x553a91[_0x3eaf('0x49')]['id']}})[_0x3eaf('0x2b')](handleEntityNotFound(_0x44ec96,null))['then'](function(_0x17300f){if(_0x17300f){_0x3c39a6=_0x17300f;_0x4c62a7['model']=_[_0x3eaf('0x4a')](db[_0x3eaf('0x51')][_0x3eaf('0x30')]);_0x4c62a7[_0x3eaf('0x36')]=_[_0x3eaf('0x4a')](_0x553a91[_0x3eaf('0x36')]);_0x4c62a7['filters']=_[_0x3eaf('0x38')](_0x4c62a7[_0x3eaf('0x35')],_0x4c62a7[_0x3eaf('0x36')]);_0x21dd0c[_0x3eaf('0x37')]=_[_0x3eaf('0x38')](_0x4c62a7[_0x3eaf('0x35')],qs[_0x3eaf('0x39')](_0x553a91[_0x3eaf('0x36')][_0x3eaf('0x39')]));_0x21dd0c[_0x3eaf('0x37')]=_0x21dd0c[_0x3eaf('0x37')]['length']?_0x21dd0c[_0x3eaf('0x37')]:_0x4c62a7['model'];_0x21dd0c[_0x3eaf('0x3d')]=qs[_0x3eaf('0x3e')](_0x553a91[_0x3eaf('0x36')][_0x3eaf('0x3e')]);_0x21dd0c[_0x3eaf('0x40')]=qs['filters'](_[_0x3eaf('0x52')](_0x553a91[_0x3eaf('0x36')],_0x4c62a7['filters']));if(_0x553a91[_0x3eaf('0x36')]['filter']){_0x21dd0c[_0x3eaf('0x40')]=_[_0x3eaf('0x41')](_0x21dd0c['where'],{'$or':_['map'](_0x21dd0c['attributes'],function(_0x29d160){var _0x1de673={};_0x1de673[_0x29d160]={'$like':'%'+_0x553a91[_0x3eaf('0x36')][_0x3eaf('0x3f')]+'%'};return _0x1de673;})});}_0x21dd0c=_[_0x3eaf('0x41')]({},_0x21dd0c,_0x553a91[_0x3eaf('0x44')]);return _0x3c39a6['getSubjects'](_0x21dd0c);}})[_0x3eaf('0x2b')](function(_0x561b69){if(_0x561b69){_0x40a769=_0x561b69[_0x3eaf('0x3a')];if(!_0x553a91['query'][_0x3eaf('0x3b')](_0x3eaf('0x3c'))){_0x21dd0c[_0x3eaf('0x23')]=qs[_0x3eaf('0x23')](_0x553a91[_0x3eaf('0x36')]['limit']);_0x21dd0c[_0x3eaf('0x21')]=qs['offset'](_0x553a91['query'][_0x3eaf('0x21')]);}return _0x3c39a6[_0x3eaf('0x53')](_0x21dd0c);}})['then'](function(_0x37ae72){if(_0x37ae72){return _0x37ae72?{'count':_0x40a769,'rows':_0x37ae72}:null;}})[_0x3eaf('0x2b')](respondWithResult(_0x44ec96,null))[_0x3eaf('0x47')](handleError(_0x44ec96,null));};exports[_0x3eaf('0x55')]=function(_0x1bab02,_0x4f93f8,_0x197574){var _0x3aa723={};var _0x45b588={};var _0x13b9e2;var _0x44a3ca;return db[_0x3eaf('0x4b')]['findOne']({'where':{'id':_0x1bab02[_0x3eaf('0x49')]['id']}})[_0x3eaf('0x2b')](handleEntityNotFound(_0x4f93f8,null))['then'](function(_0x122dc9){if(_0x122dc9){_0x13b9e2=_0x122dc9;_0x45b588[_0x3eaf('0x35')]=_[_0x3eaf('0x4a')](db[_0x3eaf('0x51')][_0x3eaf('0x30')]);_0x45b588[_0x3eaf('0x36')]=_[_0x3eaf('0x4a')](_0x1bab02[_0x3eaf('0x36')]);_0x45b588[_0x3eaf('0x34')]=_[_0x3eaf('0x38')](_0x45b588['model'],_0x45b588[_0x3eaf('0x36')]);_0x3aa723[_0x3eaf('0x37')]=_[_0x3eaf('0x38')](_0x45b588[_0x3eaf('0x35')],qs[_0x3eaf('0x39')](_0x1bab02[_0x3eaf('0x36')][_0x3eaf('0x39')]));_0x3aa723[_0x3eaf('0x37')]=_0x3aa723['attributes'][_0x3eaf('0x3a')]?_0x3aa723[_0x3eaf('0x37')]:_0x45b588[_0x3eaf('0x35')];_0x3aa723['order']=qs[_0x3eaf('0x3e')](_0x1bab02['query'][_0x3eaf('0x3e')]);_0x3aa723[_0x3eaf('0x40')]=qs[_0x3eaf('0x34')](_[_0x3eaf('0x52')](_0x1bab02['query'],_0x45b588[_0x3eaf('0x34')]));if(_0x1bab02[_0x3eaf('0x36')][_0x3eaf('0x3f')]){_0x3aa723['where']=_[_0x3eaf('0x41')](_0x3aa723[_0x3eaf('0x40')],{'$or':_[_0x3eaf('0x2f')](_0x3aa723[_0x3eaf('0x37')],function(_0x28869f){var _0x311f2d={};_0x311f2d[_0x28869f]={'$like':'%'+_0x1bab02[_0x3eaf('0x36')][_0x3eaf('0x3f')]+'%'};return _0x311f2d;})});}_0x3aa723=_[_0x3eaf('0x41')]({},_0x3aa723,_0x1bab02[_0x3eaf('0x44')]);return _0x13b9e2['getDescriptions'](_0x3aa723);}})[_0x3eaf('0x2b')](function(_0x389780){if(_0x389780){_0x44a3ca=_0x389780['length'];if(!_0x1bab02['query']['hasOwnProperty'](_0x3eaf('0x3c'))){_0x3aa723['limit']=qs[_0x3eaf('0x23')](_0x1bab02[_0x3eaf('0x36')]['limit']);_0x3aa723[_0x3eaf('0x21')]=qs[_0x3eaf('0x21')](_0x1bab02[_0x3eaf('0x36')][_0x3eaf('0x21')]);}return _0x13b9e2[_0x3eaf('0x55')](_0x3aa723);}})[_0x3eaf('0x2b')](function(_0x2bb0fe){if(_0x2bb0fe){return _0x2bb0fe?{'count':_0x44a3ca,'rows':_0x2bb0fe}:null;}})[_0x3eaf('0x2b')](respondWithResult(_0x4f93f8,null))['catch'](handleError(_0x4f93f8,null));}; \ No newline at end of file +var _0xec3e=['rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','status','reject','update','then','destroy','error','name','send','index','SugarcrmConfiguration','fieldName','key','model','map','query','keys','filters','attributes','intersection','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','catch','show','rawAttributes','fields','body','find','params','getFields','hasOwnProperty','getSubjects','findOne','SugarcrmField','options','getDescriptions'];(function(_0x254d9f,_0x54ddb5){var _0x1eedb9=function(_0x2d05f1){while(--_0x2d05f1){_0x254d9f['push'](_0x254d9f['shift']());}};_0x1eedb9(++_0x54ddb5);}(_0xec3e,0x1c8));var _0xeec3=function(_0x2de692,_0x4573d5){_0x2de692=_0x2de692-0x0;var _0x5f1883=_0xec3e[_0x2de692];return _0x5f1883;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeec3('0x0'));var zipdir=require(_0xeec3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeec3('0x2'));var moment=require(_0xeec3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeec3('0x4'));var path=require(_0xeec3('0x5'));var sox=require(_0xeec3('0x6'));var csv=require(_0xeec3('0x7'));var ejs=require(_0xeec3('0x8'));var fs=require('fs');var fs_extra=require(_0xeec3('0x9'));var _=require(_0xeec3('0xa'));var squel=require(_0xeec3('0xb'));var crypto=require(_0xeec3('0xc'));var jsforce=require(_0xeec3('0xd'));var deskjs=require(_0xeec3('0xe'));var toCsv=require(_0xeec3('0x7'));var querystring=require(_0xeec3('0xf'));var Papa=require('papaparse');var Redis=require(_0xeec3('0x10'));var authService=require(_0xeec3('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeec3('0x12'));var logger=require(_0xeec3('0x13'))('api');var utils=require(_0xeec3('0x14'));var config=require(_0xeec3('0x15'));var licenseUtil=require(_0xeec3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58f7e4,_0x4a64eb){_0x4a64eb=_0x4a64eb||0xcc;return function(_0x3062e7){if(_0x3062e7){return _0x58f7e4[_0xeec3('0x17')](_0x4a64eb);}return _0x58f7e4['status'](_0x4a64eb)[_0xeec3('0x18')]();};}function respondWithResult(_0x2f0c6d,_0x11f4a5){_0x11f4a5=_0x11f4a5||0xc8;return function(_0x38f525){if(_0x38f525){return _0x2f0c6d['status'](_0x11f4a5)[_0xeec3('0x19')](_0x38f525);}};}function respondWithFilteredResult(_0x41cb57,_0x23f74a){return function(_0xd953d5){if(_0xd953d5){var _0x31ff38=typeof _0x23f74a[_0xeec3('0x1a')]===_0xeec3('0x1b')&&typeof _0x23f74a[_0xeec3('0x1c')]===_0xeec3('0x1b');var _0x22b206=_0xd953d5['count'];var _0x426983=_0x31ff38?0x0:_0x23f74a[_0xeec3('0x1a')];var _0x511296=_0x31ff38?_0xd953d5['count']:_0x23f74a['offset']+_0x23f74a[_0xeec3('0x1c')];var _0x348591;if(_0x511296>=_0x22b206){_0x511296=_0x22b206;_0x348591=0xc8;}else{_0x348591=0xce;}_0x41cb57[_0xeec3('0x1d')](_0x348591);return _0x41cb57['set']('Content-Range',_0x426983+'-'+_0x511296+'/'+_0x22b206)[_0xeec3('0x19')](_0xd953d5);}return null;};}function patchUpdates(_0xfbb6){return function(_0x56dc8b){try{jsonpatch['apply'](_0x56dc8b,_0xfbb6,!![]);}catch(_0x4bc8ed){return BPromise[_0xeec3('0x1e')](_0x4bc8ed);}return _0x56dc8b['save']();};}function saveUpdates(_0x27fc97,_0x5c2224){return function(_0x3502a2){if(_0x3502a2){return _0x3502a2[_0xeec3('0x1f')](_0x27fc97)[_0xeec3('0x20')](function(_0x409fed){return _0x409fed;});}return null;};}function removeEntity(_0x19a372,_0x250aac){return function(_0x53c342){if(_0x53c342){return _0x53c342[_0xeec3('0x21')]()[_0xeec3('0x20')](function(){_0x19a372['status'](0xcc)[_0xeec3('0x18')]();});}};}function handleEntityNotFound(_0x1ac18e,_0x173b2d){return function(_0x4d58b2){if(!_0x4d58b2){_0x1ac18e[_0xeec3('0x17')](0x194);}return _0x4d58b2;};}function handleError(_0x5097f8,_0x2ef410){_0x2ef410=_0x2ef410||0x1f4;return function(_0x2476ed){logger[_0xeec3('0x22')](_0x2476ed['stack']);if(_0x2476ed[_0xeec3('0x23')]){delete _0x2476ed[_0xeec3('0x23')];}_0x5097f8['status'](_0x2ef410)[_0xeec3('0x24')](_0x2476ed);};}exports[_0xeec3('0x25')]=function(_0x407259,_0x4c75cb){var _0x3529aa={},_0x2f1a58={},_0x3da757={'count':0x0,'rows':[]};var _0x4353cf=_['map'](db[_0xeec3('0x26')]['rawAttributes'],function(_0x24141a){return{'name':_0x24141a[_0xeec3('0x27')],'type':_0x24141a['type'][_0xeec3('0x28')]};});_0x2f1a58[_0xeec3('0x29')]=_[_0xeec3('0x2a')](_0x4353cf,_0xeec3('0x23'));_0x2f1a58[_0xeec3('0x2b')]=_[_0xeec3('0x2c')](_0x407259['query']);_0x2f1a58[_0xeec3('0x2d')]=_['intersection'](_0x2f1a58[_0xeec3('0x29')],_0x2f1a58[_0xeec3('0x2b')]);_0x3529aa[_0xeec3('0x2e')]=_[_0xeec3('0x2f')](_0x2f1a58['model'],qs['fields'](_0x407259[_0xeec3('0x2b')]['fields']));_0x3529aa[_0xeec3('0x2e')]=_0x3529aa['attributes'][_0xeec3('0x30')]?_0x3529aa['attributes']:_0x2f1a58[_0xeec3('0x29')];if(!_0x407259[_0xeec3('0x2b')]['hasOwnProperty'](_0xeec3('0x31'))){_0x3529aa['limit']=qs[_0xeec3('0x1c')](_0x407259['query'][_0xeec3('0x1c')]);_0x3529aa[_0xeec3('0x1a')]=qs[_0xeec3('0x1a')](_0x407259[_0xeec3('0x2b')]['offset']);}_0x3529aa[_0xeec3('0x32')]=qs['sort'](_0x407259[_0xeec3('0x2b')][_0xeec3('0x33')]);_0x3529aa[_0xeec3('0x34')]=qs[_0xeec3('0x2d')](_[_0xeec3('0x35')](_0x407259[_0xeec3('0x2b')],_0x2f1a58[_0xeec3('0x2d')]),_0x4353cf);if(_0x407259[_0xeec3('0x2b')][_0xeec3('0x36')]){_0x3529aa['where']=_[_0xeec3('0x37')](_0x3529aa[_0xeec3('0x34')],{'$or':_[_0xeec3('0x2a')](_0x4353cf,function(_0x5adf7d){if(_0x5adf7d[_0xeec3('0x38')]!==_0xeec3('0x39')){var _0x5e2280={};_0x5e2280[_0x5adf7d[_0xeec3('0x23')]]={'$like':'%'+_0x407259[_0xeec3('0x2b')][_0xeec3('0x36')]+'%'};return _0x5e2280;}})});}_0x3529aa=_['merge']({},_0x3529aa,_0x407259['options']);var _0x2b2b6e={'where':_0x3529aa['where']};return db[_0xeec3('0x26')][_0xeec3('0x3a')](_0x2b2b6e)['then'](function(_0x53e960){_0x3da757[_0xeec3('0x3a')]=_0x53e960;if(_0x407259['query'][_0xeec3('0x3b')]){_0x3529aa[_0xeec3('0x3c')]=[{'all':!![]}];}return db[_0xeec3('0x26')][_0xeec3('0x3d')](_0x3529aa);})[_0xeec3('0x20')](function(_0x5e478d){_0x3da757['rows']=_0x5e478d;return _0x3da757;})[_0xeec3('0x20')](respondWithFilteredResult(_0x4c75cb,_0x3529aa))[_0xeec3('0x3e')](handleError(_0x4c75cb,null));};exports[_0xeec3('0x3f')]=function(_0x161d4a,_0x416e5f){var _0x1a3bb1={'raw':![],'where':{'id':_0x161d4a['params']['id']}},_0xf5160f={};_0xf5160f[_0xeec3('0x29')]=_[_0xeec3('0x2c')](db[_0xeec3('0x26')][_0xeec3('0x40')]);_0xf5160f[_0xeec3('0x2b')]=_[_0xeec3('0x2c')](_0x161d4a[_0xeec3('0x2b')]);_0xf5160f[_0xeec3('0x2d')]=_[_0xeec3('0x2f')](_0xf5160f[_0xeec3('0x29')],_0xf5160f['query']);_0x1a3bb1['attributes']=_['intersection'](_0xf5160f[_0xeec3('0x29')],qs[_0xeec3('0x41')](_0x161d4a[_0xeec3('0x2b')][_0xeec3('0x41')]));_0x1a3bb1['attributes']=_0x1a3bb1['attributes'][_0xeec3('0x30')]?_0x1a3bb1[_0xeec3('0x2e')]:_0xf5160f[_0xeec3('0x29')];if(_0x161d4a[_0xeec3('0x2b')][_0xeec3('0x3b')]){_0x1a3bb1[_0xeec3('0x3c')]=[{'all':!![]}];}_0x1a3bb1=_[_0xeec3('0x37')]({},_0x1a3bb1,_0x161d4a['options']);return db[_0xeec3('0x26')]['find'](_0x1a3bb1)[_0xeec3('0x20')](handleEntityNotFound(_0x416e5f,null))[_0xeec3('0x20')](respondWithResult(_0x416e5f,null))[_0xeec3('0x3e')](handleError(_0x416e5f,null));};exports['create']=function(_0x449dce,_0x2c186b){return db[_0xeec3('0x26')]['create'](_0x449dce[_0xeec3('0x42')],{})[_0xeec3('0x20')](respondWithResult(_0x2c186b,0xc9))[_0xeec3('0x3e')](handleError(_0x2c186b,null));};exports[_0xeec3('0x1f')]=function(_0xe85427,_0x329595){if(_0xe85427[_0xeec3('0x42')]['id']){delete _0xe85427['body']['id'];}return db[_0xeec3('0x26')][_0xeec3('0x43')]({'where':{'id':_0xe85427[_0xeec3('0x44')]['id']}})['then'](handleEntityNotFound(_0x329595,null))['then'](saveUpdates(_0xe85427[_0xeec3('0x42')],null))[_0xeec3('0x20')](respondWithResult(_0x329595,null))[_0xeec3('0x3e')](handleError(_0x329595,null));};exports[_0xeec3('0x21')]=function(_0x41b4cc,_0x4d4745){return db[_0xeec3('0x26')][_0xeec3('0x43')]({'where':{'id':_0x41b4cc[_0xeec3('0x44')]['id']}})[_0xeec3('0x20')](handleEntityNotFound(_0x4d4745,null))['then'](removeEntity(_0x4d4745,null))[_0xeec3('0x3e')](handleError(_0x4d4745,null));};exports[_0xeec3('0x45')]=function(_0x14fc41,_0xccb40d,_0x277791){var _0x20a081={};var _0x3afa16={};var _0x100824;var _0x421465;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x14fc41[_0xeec3('0x44')]['id']}})[_0xeec3('0x20')](handleEntityNotFound(_0xccb40d,null))['then'](function(_0x5c3d42){if(_0x5c3d42){_0x100824=_0x5c3d42;_0x3afa16[_0xeec3('0x29')]=_[_0xeec3('0x2c')](db['SugarcrmField'][_0xeec3('0x40')]);_0x3afa16['query']=_[_0xeec3('0x2c')](_0x14fc41[_0xeec3('0x2b')]);_0x3afa16[_0xeec3('0x2d')]=_[_0xeec3('0x2f')](_0x3afa16['model'],_0x3afa16[_0xeec3('0x2b')]);_0x20a081[_0xeec3('0x2e')]=_['intersection'](_0x3afa16[_0xeec3('0x29')],qs[_0xeec3('0x41')](_0x14fc41[_0xeec3('0x2b')]['fields']));_0x20a081['attributes']=_0x20a081[_0xeec3('0x2e')][_0xeec3('0x30')]?_0x20a081['attributes']:_0x3afa16[_0xeec3('0x29')];_0x20a081['order']=qs[_0xeec3('0x33')](_0x14fc41[_0xeec3('0x2b')][_0xeec3('0x33')]);_0x20a081['where']=qs[_0xeec3('0x2d')](_[_0xeec3('0x35')](_0x14fc41['query'],_0x3afa16[_0xeec3('0x2d')]));if(_0x14fc41[_0xeec3('0x2b')]['filter']){_0x20a081[_0xeec3('0x34')]=_['merge'](_0x20a081[_0xeec3('0x34')],{'$or':_[_0xeec3('0x2a')](_0x20a081['attributes'],function(_0x13db02){var _0x2e32e7={};_0x2e32e7[_0x13db02]={'$like':'%'+_0x14fc41[_0xeec3('0x2b')][_0xeec3('0x36')]+'%'};return _0x2e32e7;})});}_0x20a081=_[_0xeec3('0x37')]({},_0x20a081,_0x14fc41['options']);return _0x100824[_0xeec3('0x45')](_0x20a081);}})[_0xeec3('0x20')](function(_0x51f700){if(_0x51f700){_0x421465=_0x51f700[_0xeec3('0x30')];if(!_0x14fc41[_0xeec3('0x2b')][_0xeec3('0x46')](_0xeec3('0x31'))){_0x20a081[_0xeec3('0x1c')]=qs['limit'](_0x14fc41[_0xeec3('0x2b')][_0xeec3('0x1c')]);_0x20a081[_0xeec3('0x1a')]=qs[_0xeec3('0x1a')](_0x14fc41[_0xeec3('0x2b')][_0xeec3('0x1a')]);}return _0x100824[_0xeec3('0x45')](_0x20a081);}})[_0xeec3('0x20')](function(_0x395bea){if(_0x395bea){return _0x395bea?{'count':_0x421465,'rows':_0x395bea}:null;}})[_0xeec3('0x20')](respondWithResult(_0xccb40d,null))[_0xeec3('0x3e')](handleError(_0xccb40d,null));};exports[_0xeec3('0x47')]=function(_0x1cde0d,_0x3967c2,_0xe62e45){var _0x4096fd={};var _0x215cf5={};var _0x17a6ef;var _0x43be06;return db[_0xeec3('0x26')][_0xeec3('0x48')]({'where':{'id':_0x1cde0d[_0xeec3('0x44')]['id']}})[_0xeec3('0x20')](handleEntityNotFound(_0x3967c2,null))[_0xeec3('0x20')](function(_0x4d0bb5){if(_0x4d0bb5){_0x17a6ef=_0x4d0bb5;_0x215cf5[_0xeec3('0x29')]=_[_0xeec3('0x2c')](db[_0xeec3('0x49')][_0xeec3('0x40')]);_0x215cf5[_0xeec3('0x2b')]=_['keys'](_0x1cde0d[_0xeec3('0x2b')]);_0x215cf5[_0xeec3('0x2d')]=_[_0xeec3('0x2f')](_0x215cf5['model'],_0x215cf5[_0xeec3('0x2b')]);_0x4096fd[_0xeec3('0x2e')]=_[_0xeec3('0x2f')](_0x215cf5[_0xeec3('0x29')],qs[_0xeec3('0x41')](_0x1cde0d[_0xeec3('0x2b')][_0xeec3('0x41')]));_0x4096fd['attributes']=_0x4096fd[_0xeec3('0x2e')][_0xeec3('0x30')]?_0x4096fd['attributes']:_0x215cf5[_0xeec3('0x29')];_0x4096fd[_0xeec3('0x32')]=qs[_0xeec3('0x33')](_0x1cde0d[_0xeec3('0x2b')][_0xeec3('0x33')]);_0x4096fd[_0xeec3('0x34')]=qs[_0xeec3('0x2d')](_[_0xeec3('0x35')](_0x1cde0d['query'],_0x215cf5[_0xeec3('0x2d')]));if(_0x1cde0d['query'][_0xeec3('0x36')]){_0x4096fd[_0xeec3('0x34')]=_['merge'](_0x4096fd['where'],{'$or':_[_0xeec3('0x2a')](_0x4096fd[_0xeec3('0x2e')],function(_0x5b7b8e){var _0x2b9a80={};_0x2b9a80[_0x5b7b8e]={'$like':'%'+_0x1cde0d[_0xeec3('0x2b')][_0xeec3('0x36')]+'%'};return _0x2b9a80;})});}_0x4096fd=_[_0xeec3('0x37')]({},_0x4096fd,_0x1cde0d[_0xeec3('0x4a')]);return _0x17a6ef[_0xeec3('0x47')](_0x4096fd);}})['then'](function(_0x37b667){if(_0x37b667){_0x43be06=_0x37b667[_0xeec3('0x30')];if(!_0x1cde0d[_0xeec3('0x2b')][_0xeec3('0x46')](_0xeec3('0x31'))){_0x4096fd[_0xeec3('0x1c')]=qs[_0xeec3('0x1c')](_0x1cde0d[_0xeec3('0x2b')][_0xeec3('0x1c')]);_0x4096fd['offset']=qs[_0xeec3('0x1a')](_0x1cde0d[_0xeec3('0x2b')][_0xeec3('0x1a')]);}return _0x17a6ef[_0xeec3('0x47')](_0x4096fd);}})[_0xeec3('0x20')](function(_0xcd6523){if(_0xcd6523){return _0xcd6523?{'count':_0x43be06,'rows':_0xcd6523}:null;}})[_0xeec3('0x20')](respondWithResult(_0x3967c2,null))[_0xeec3('0x3e')](handleError(_0x3967c2,null));};exports[_0xeec3('0x4b')]=function(_0x16cdbb,_0x2d6fb7,_0x3c62e1){var _0x32b373={};var _0x4baae5={};var _0x247471;var _0x881a0c;return db[_0xeec3('0x26')]['findOne']({'where':{'id':_0x16cdbb['params']['id']}})[_0xeec3('0x20')](handleEntityNotFound(_0x2d6fb7,null))['then'](function(_0x5cf9e5){if(_0x5cf9e5){_0x247471=_0x5cf9e5;_0x4baae5[_0xeec3('0x29')]=_[_0xeec3('0x2c')](db[_0xeec3('0x49')][_0xeec3('0x40')]);_0x4baae5['query']=_['keys'](_0x16cdbb[_0xeec3('0x2b')]);_0x4baae5[_0xeec3('0x2d')]=_[_0xeec3('0x2f')](_0x4baae5[_0xeec3('0x29')],_0x4baae5[_0xeec3('0x2b')]);_0x32b373['attributes']=_['intersection'](_0x4baae5['model'],qs[_0xeec3('0x41')](_0x16cdbb[_0xeec3('0x2b')][_0xeec3('0x41')]));_0x32b373[_0xeec3('0x2e')]=_0x32b373[_0xeec3('0x2e')][_0xeec3('0x30')]?_0x32b373[_0xeec3('0x2e')]:_0x4baae5['model'];_0x32b373['order']=qs[_0xeec3('0x33')](_0x16cdbb[_0xeec3('0x2b')][_0xeec3('0x33')]);_0x32b373['where']=qs[_0xeec3('0x2d')](_['pick'](_0x16cdbb[_0xeec3('0x2b')],_0x4baae5[_0xeec3('0x2d')]));if(_0x16cdbb[_0xeec3('0x2b')][_0xeec3('0x36')]){_0x32b373[_0xeec3('0x34')]=_[_0xeec3('0x37')](_0x32b373[_0xeec3('0x34')],{'$or':_[_0xeec3('0x2a')](_0x32b373[_0xeec3('0x2e')],function(_0x558708){var _0x2cd704={};_0x2cd704[_0x558708]={'$like':'%'+_0x16cdbb[_0xeec3('0x2b')][_0xeec3('0x36')]+'%'};return _0x2cd704;})});}_0x32b373=_[_0xeec3('0x37')]({},_0x32b373,_0x16cdbb[_0xeec3('0x4a')]);return _0x247471[_0xeec3('0x4b')](_0x32b373);}})[_0xeec3('0x20')](function(_0x27863b){if(_0x27863b){_0x881a0c=_0x27863b[_0xeec3('0x30')];if(!_0x16cdbb[_0xeec3('0x2b')][_0xeec3('0x46')](_0xeec3('0x31'))){_0x32b373['limit']=qs['limit'](_0x16cdbb[_0xeec3('0x2b')][_0xeec3('0x1c')]);_0x32b373[_0xeec3('0x1a')]=qs[_0xeec3('0x1a')](_0x16cdbb[_0xeec3('0x2b')][_0xeec3('0x1a')]);}return _0x247471[_0xeec3('0x4b')](_0x32b373);}})[_0xeec3('0x20')](function(_0x20f14d){if(_0x20f14d){return _0x20f14d?{'count':_0x881a0c,'rows':_0x20f14d}:null;}})['then'](respondWithResult(_0x2d6fb7,null))['catch'](handleError(_0x2d6fb7,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 0695832..f566295 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 _0x75a6=['exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x509c10,_0x598247){var _0x2ddd75=function(_0x2dab6a){while(--_0x2dab6a){_0x509c10['push'](_0x509c10['shift']());}};_0x2ddd75(++_0x598247);}(_0x75a6,0x6f));var _0x675a=function(_0xe7443b,_0x145572){_0xe7443b=_0xe7443b-0x0;var _0x2b7bd4=_0x75a6[_0xe7443b];return _0x2b7bd4;};'use strict';var _=require(_0x675a('0x0'));var util=require('util');var logger=require(_0x675a('0x1'))(_0x675a('0x2'));var moment=require('moment');var BPromise=require(_0x675a('0x3'));var rp=require(_0x675a('0x4'));var fs=require('fs');var path=require(_0x675a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x675a('0x6')]=function(_0x4fdf9a,_0x183add){return _0x4fdf9a['define'](_0x675a('0x7'),attributes,{'tableName':_0x675a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc183=['../../config/environment','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x247f36,_0x1ed18b){var _0x166946=function(_0x447eab){while(--_0x447eab){_0x247f36['push'](_0x247f36['shift']());}};_0x166946(++_0x1ed18b);}(_0xc183,0x17f));var _0x3c18=function(_0xf41ca5,_0x107e15){_0xf41ca5=_0xf41ca5-0x0;var _0x1fb25e=_0xc183[_0xf41ca5];return _0x1fb25e;};'use strict';var _=require(_0x3c18('0x0'));var util=require(_0x3c18('0x1'));var logger=require(_0x3c18('0x2'))(_0x3c18('0x3'));var moment=require(_0x3c18('0x4'));var BPromise=require(_0x3c18('0x5'));var rp=require(_0x3c18('0x6'));var fs=require('fs');var path=require(_0x3c18('0x7'));var rimraf=require(_0x3c18('0x8'));var config=require(_0x3c18('0x9'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x3c18('0xa')]=function(_0x270435,_0x371dcc){return _0x270435[_0x3c18('0xb')](_0x3c18('0xc'),attributes,{'tableName':_0x3c18('0xd'),'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 97a79ea..18c1d00 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 _0x33ab=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util'];(function(_0x2dc0f,_0x2be249){var _0x5ac977=function(_0x5a0bc2){while(--_0x5a0bc2){_0x2dc0f['push'](_0x2dc0f['shift']());}};_0x5ac977(++_0x2be249);}(_0x33ab,0x72));var _0xb33a=function(_0x527adb,_0x154ef0){_0x527adb=_0x527adb-0x0;var _0x382096=_0x33ab[_0x527adb];return _0x382096;};'use strict';var _=require('lodash');var util=require(_0xb33a('0x0'));var moment=require(_0xb33a('0x1'));var BPromise=require(_0xb33a('0x2'));var rs=require(_0xb33a('0x3'));var fs=require('fs');var Redis=require(_0xb33a('0x4'));var db=require(_0xb33a('0x5'))['db'];var utils=require(_0xb33a('0x6'));var logger=require(_0xb33a('0x7'))(_0xb33a('0x8'));var config=require(_0xb33a('0x9'));var jayson=require(_0xb33a('0xa'));var client=jayson[_0xb33a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3654c1,_0x301ed2,_0xc64d0e){return new BPromise(function(_0x235188,_0x5c9f71){return client[_0xb33a('0xc')](_0x3654c1,_0xc64d0e)[_0xb33a('0xd')](function(_0x2d0ee3){logger[_0xb33a('0xe')](_0xb33a('0xf'),_0x301ed2,_0xb33a('0x10'));logger[_0xb33a('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x301ed2,'request\x20sent',JSON['stringify'](_0x2d0ee3));if(_0x2d0ee3[_0xb33a('0x12')]){if(_0x2d0ee3[_0xb33a('0x12')][_0xb33a('0x13')]===0x1f4){logger[_0xb33a('0x12')](_0xb33a('0xf'),_0x301ed2,_0x2d0ee3[_0xb33a('0x12')][_0xb33a('0x14')]);return _0x5c9f71(_0x2d0ee3[_0xb33a('0x12')][_0xb33a('0x14')]);}logger[_0xb33a('0x12')](_0xb33a('0xf'),_0x301ed2,_0x2d0ee3[_0xb33a('0x12')]['message']);return _0x235188(_0x2d0ee3[_0xb33a('0x12')][_0xb33a('0x14')]);}else{logger[_0xb33a('0xe')](_0xb33a('0xf'),_0x301ed2,_0xb33a('0x10'));_0x235188(_0x2d0ee3[_0xb33a('0x15')][_0xb33a('0x14')]);}})[_0xb33a('0x16')](function(_0x52c278){logger['error'](_0xb33a('0xf'),_0x301ed2,_0x52c278);_0x5c9f71(_0x52c278);});});} \ No newline at end of file +var _0xcdb1=['stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x483e99,_0x42418e){var _0x237cc4=function(_0x1be496){while(--_0x1be496){_0x483e99['push'](_0x483e99['shift']());}};_0x237cc4(++_0x42418e);}(_0xcdb1,0xd5));var _0x1cdb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcdb1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1cdb('0x0'));var util=require(_0x1cdb('0x1'));var moment=require(_0x1cdb('0x2'));var BPromise=require(_0x1cdb('0x3'));var rs=require(_0x1cdb('0x4'));var fs=require('fs');var Redis=require(_0x1cdb('0x5'));var db=require(_0x1cdb('0x6'))['db'];var utils=require(_0x1cdb('0x7'));var logger=require(_0x1cdb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1cdb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36fdbf,_0x2b890d,_0x151946){return new BPromise(function(_0xecbca5,_0x16cbdd){return client['request'](_0x36fdbf,_0x151946)[_0x1cdb('0xa')](function(_0x527880){logger['info'](_0x1cdb('0xb'),_0x2b890d,_0x1cdb('0xc'));logger[_0x1cdb('0xd')](_0x1cdb('0xe'),_0x2b890d,_0x1cdb('0xc'),JSON[_0x1cdb('0xf')](_0x527880));if(_0x527880[_0x1cdb('0x10')]){if(_0x527880[_0x1cdb('0x10')]['code']===0x1f4){logger[_0x1cdb('0x10')](_0x1cdb('0xb'),_0x2b890d,_0x527880[_0x1cdb('0x10')][_0x1cdb('0x11')]);return _0x16cbdd(_0x527880[_0x1cdb('0x10')][_0x1cdb('0x11')]);}logger[_0x1cdb('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2b890d,_0x527880[_0x1cdb('0x10')][_0x1cdb('0x11')]);return _0xecbca5(_0x527880['error'][_0x1cdb('0x11')]);}else{logger['info'](_0x1cdb('0xb'),_0x2b890d,'request\x20sent');_0xecbca5(_0x527880[_0x1cdb('0x12')][_0x1cdb('0x11')]);}})['catch'](function(_0x297868){logger[_0x1cdb('0x10')](_0x1cdb('0xb'),_0x2b890d,_0x297868);_0x16cbdd(_0x297868);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 859b6d6..4612455 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 _0x91ac=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','post','create','/:id','update','delete','destroy','connect-timeout','Router'];(function(_0x5f1d13,_0x291478){var _0x5d6b8e=function(_0x1ef5d7){while(--_0x1ef5d7){_0x5f1d13['push'](_0x5f1d13['shift']());}};_0x5d6b8e(++_0x291478);}(_0x91ac,0x148));var _0xc91a=function(_0x8e1484,_0x325b02){_0x8e1484=_0x8e1484-0x0;var _0x4b46f7=_0x91ac[_0x8e1484];return _0x4b46f7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc91a('0x0'));var express=require('express');var router=express[_0xc91a('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xc91a('0x2'));var interaction=require(_0xc91a('0x3'));var config=require(_0xc91a('0x4'));var controller=require(_0xc91a('0x5'));router[_0xc91a('0x6')]('/',auth[_0xc91a('0x7')](),controller[_0xc91a('0x8')]);router[_0xc91a('0x6')]('/:id',auth[_0xc91a('0x7')](),controller['show']);router[_0xc91a('0x9')]('/',auth[_0xc91a('0x7')](),controller[_0xc91a('0xa')]);router['put'](_0xc91a('0xb'),auth[_0xc91a('0x7')](),controller[_0xc91a('0xc')]);router[_0xc91a('0xd')](_0xc91a('0xb'),auth[_0xc91a('0x7')](),controller[_0xc91a('0xe')]);module['exports']=router; \ No newline at end of file +var _0x2c07=['create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id','post'];(function(_0x1c7ad0,_0x448315){var _0x27314b=function(_0x49bd56){while(--_0x49bd56){_0x1c7ad0['push'](_0x1c7ad0['shift']());}};_0x27314b(++_0x448315);}(_0x2c07,0xcb));var _0x72c0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2c07[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x72c0('0x0'));var util=require(_0x72c0('0x1'));var path=require(_0x72c0('0x2'));var timeout=require(_0x72c0('0x3'));var express=require('express');var router=express[_0x72c0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x72c0('0x5'));var interaction=require(_0x72c0('0x6'));var config=require(_0x72c0('0x7'));var controller=require(_0x72c0('0x8'));router[_0x72c0('0x9')]('/',auth[_0x72c0('0xa')](),controller['index']);router[_0x72c0('0x9')](_0x72c0('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x72c0('0xc')]('/',auth[_0x72c0('0xa')](),controller[_0x72c0('0xd')]);router[_0x72c0('0xe')](_0x72c0('0xb'),auth[_0x72c0('0xa')](),controller[_0x72c0('0xf')]);router[_0x72c0('0x10')](_0x72c0('0xb'),auth[_0x72c0('0xa')](),controller['destroy']);module[_0x72c0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 10600b3..ea49e65 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 _0xf2ac=['exports','string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN'];(function(_0x118477,_0x4987a9){var _0x99f99c=function(_0x1ee192){while(--_0x1ee192){_0x118477['push'](_0x118477['shift']());}};_0x99f99c(++_0x4987a9);}(_0xf2ac,0x1c0));var _0xcf2a=function(_0x3c99d4,_0x2ad137){_0x3c99d4=_0x3c99d4-0x0;var _0x466b07=_0xf2ac[_0x3c99d4];return _0x466b07;};'use strict';var Sequelize=require('sequelize');module[_0xcf2a('0x0')]={'type':{'type':Sequelize['ENUM'](_0xcf2a('0x1'),_0xcf2a('0x2'),_0xcf2a('0x3'),_0xcf2a('0x4'),'picklist'),'defaultValue':_0xcf2a('0x1')},'content':{'type':Sequelize[_0xcf2a('0x5')]},'key':{'type':Sequelize[_0xcf2a('0x5')]},'keyType':{'type':Sequelize[_0xcf2a('0x6')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xcf2a('0x5')]},'idField':{'type':Sequelize[_0xcf2a('0x5')]},'nameField':{'type':Sequelize[_0xcf2a('0x5')]},'customField':{'type':Sequelize[_0xcf2a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcf2a('0x5')]}}; \ No newline at end of file +var _0x5dc7=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x138b54,_0x3a678c){var _0x387a2b=function(_0x1c5328){while(--_0x1c5328){_0x138b54['push'](_0x138b54['shift']());}};_0x387a2b(++_0x3a678c);}(_0x5dc7,0xbb));var _0x75dc=function(_0x5d36e6,_0x1a7786){_0x5d36e6=_0x5d36e6-0x0;var _0x120cb1=_0x5dc7[_0x5d36e6];return _0x120cb1;};'use strict';var Sequelize=require(_0x75dc('0x0'));module[_0x75dc('0x1')]={'type':{'type':Sequelize[_0x75dc('0x2')](_0x75dc('0x3'),_0x75dc('0x4'),_0x75dc('0x5'),_0x75dc('0x6'),_0x75dc('0x7')),'defaultValue':_0x75dc('0x3')},'content':{'type':Sequelize[_0x75dc('0x8')]},'key':{'type':Sequelize[_0x75dc('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x75dc('0x3'),'variable',_0x75dc('0x5'))},'keyContent':{'type':Sequelize[_0x75dc('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x75dc('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x75dc('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 90ba87f..4aaf12a 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 _0xb0ef=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','status','error','stack','name','send','index','map','SugarcrmField','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','show','params','find','catch','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service'];(function(_0x5c6244,_0x112ab8){var _0x5800ce=function(_0x304e3d){while(--_0x304e3d){_0x5c6244['push'](_0x5c6244['shift']());}};_0x5800ce(++_0x112ab8);}(_0xb0ef,0x7f));var _0xfb0e=function(_0x1bad40,_0x49b605){_0x1bad40=_0x1bad40-0x0;var _0x555207=_0xb0ef[_0x1bad40];return _0x555207;};'use strict';var emlformat=require(_0xfb0e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfb0e('0x1'));var jsonpatch=require(_0xfb0e('0x2'));var rp=require('request-promise');var moment=require(_0xfb0e('0x3'));var BPromise=require(_0xfb0e('0x4'));var Mustache=require(_0xfb0e('0x5'));var util=require('util');var path=require(_0xfb0e('0x6'));var sox=require(_0xfb0e('0x7'));var csv=require('to-csv');var ejs=require(_0xfb0e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb0e('0x9'));var squel=require(_0xfb0e('0xa'));var crypto=require(_0xfb0e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfb0e('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfb0e('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfb0e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfb0e('0xf'));var hardwareService=require(_0xfb0e('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xfb0e('0x11'));var config=require(_0xfb0e('0x12'));var licenseUtil=require(_0xfb0e('0x13'));var db=require(_0xfb0e('0x14'))['db'];function respondWithStatusCode(_0x2a7af2,_0x173304){_0x173304=_0x173304||0xcc;return function(_0x12c935){if(_0x12c935){return _0x2a7af2[_0xfb0e('0x15')](_0x173304);}return _0x2a7af2['status'](_0x173304)[_0xfb0e('0x16')]();};}function respondWithResult(_0x51dab1,_0x58b8ca){_0x58b8ca=_0x58b8ca||0xc8;return function(_0x476e03){if(_0x476e03){return _0x51dab1['status'](_0x58b8ca)[_0xfb0e('0x17')](_0x476e03);}};}function respondWithFilteredResult(_0x26d879,_0x29e106){return function(_0x299351){if(_0x299351){var _0x28863d=typeof _0x29e106['offset']===_0xfb0e('0x18')&&typeof _0x29e106[_0xfb0e('0x19')]===_0xfb0e('0x18');var _0x13607c=_0x299351[_0xfb0e('0x1a')];var _0x44ec52=_0x28863d?0x0:_0x29e106[_0xfb0e('0x1b')];var _0x37ccfb=_0x28863d?_0x299351[_0xfb0e('0x1a')]:_0x29e106[_0xfb0e('0x1b')]+_0x29e106[_0xfb0e('0x19')];var _0x45761f;if(_0x37ccfb>=_0x13607c){_0x37ccfb=_0x13607c;_0x45761f=0xc8;}else{_0x45761f=0xce;}_0x26d879['status'](_0x45761f);return _0x26d879[_0xfb0e('0x1c')](_0xfb0e('0x1d'),_0x44ec52+'-'+_0x37ccfb+'/'+_0x13607c)[_0xfb0e('0x17')](_0x299351);}return null;};}function patchUpdates(_0x85761a){return function(_0x4092c8){try{jsonpatch[_0xfb0e('0x1e')](_0x4092c8,_0x85761a,!![]);}catch(_0x3527f4){return BPromise[_0xfb0e('0x1f')](_0x3527f4);}return _0x4092c8[_0xfb0e('0x20')]();};}function saveUpdates(_0x24856f,_0x166906){return function(_0x471269){if(_0x471269){return _0x471269[_0xfb0e('0x21')](_0x24856f)['then'](function(_0x9b5281){return _0x9b5281;});}return null;};}function removeEntity(_0xe1abf8,_0x4a6284){return function(_0x1f9d62){if(_0x1f9d62){return _0x1f9d62[_0xfb0e('0x22')]()[_0xfb0e('0x23')](function(){_0xe1abf8[_0xfb0e('0x24')](0xcc)[_0xfb0e('0x16')]();});}};}function handleEntityNotFound(_0x426973,_0x454a5f){return function(_0x202b42){if(!_0x202b42){_0x426973[_0xfb0e('0x15')](0x194);}return _0x202b42;};}function handleError(_0x5f49dc,_0x483c34){_0x483c34=_0x483c34||0x1f4;return function(_0x5bc528){logger[_0xfb0e('0x25')](_0x5bc528[_0xfb0e('0x26')]);if(_0x5bc528[_0xfb0e('0x27')]){delete _0x5bc528[_0xfb0e('0x27')];}_0x5f49dc[_0xfb0e('0x24')](_0x483c34)[_0xfb0e('0x28')](_0x5bc528);};}exports[_0xfb0e('0x29')]=function(_0x1821c4,_0x482f41){var _0x1fadd8={},_0x150c3c={},_0x23d1e2={'count':0x0,'rows':[]};var _0xb34faf=_[_0xfb0e('0x2a')](db[_0xfb0e('0x2b')]['rawAttributes'],function(_0x77dd1a){return{'name':_0x77dd1a[_0xfb0e('0x2c')],'type':_0x77dd1a[_0xfb0e('0x2d')]['key']};});_0x150c3c['model']=_[_0xfb0e('0x2a')](_0xb34faf,'name');_0x150c3c[_0xfb0e('0x2e')]=_[_0xfb0e('0x2f')](_0x1821c4['query']);_0x150c3c['filters']=_[_0xfb0e('0x30')](_0x150c3c[_0xfb0e('0x31')],_0x150c3c['query']);_0x1fadd8[_0xfb0e('0x32')]=_[_0xfb0e('0x30')](_0x150c3c[_0xfb0e('0x31')],qs['fields'](_0x1821c4[_0xfb0e('0x2e')][_0xfb0e('0x33')]));_0x1fadd8[_0xfb0e('0x32')]=_0x1fadd8[_0xfb0e('0x32')][_0xfb0e('0x34')]?_0x1fadd8[_0xfb0e('0x32')]:_0x150c3c[_0xfb0e('0x31')];if(!_0x1821c4['query'][_0xfb0e('0x35')]('nolimit')){_0x1fadd8['limit']=qs[_0xfb0e('0x19')](_0x1821c4['query']['limit']);_0x1fadd8[_0xfb0e('0x1b')]=qs[_0xfb0e('0x1b')](_0x1821c4[_0xfb0e('0x2e')][_0xfb0e('0x1b')]);}_0x1fadd8[_0xfb0e('0x36')]=qs[_0xfb0e('0x37')](_0x1821c4[_0xfb0e('0x2e')][_0xfb0e('0x37')]);_0x1fadd8[_0xfb0e('0x38')]=qs[_0xfb0e('0x39')](_[_0xfb0e('0x3a')](_0x1821c4[_0xfb0e('0x2e')],_0x150c3c[_0xfb0e('0x39')]),_0xb34faf);if(_0x1821c4[_0xfb0e('0x2e')][_0xfb0e('0x3b')]){_0x1fadd8[_0xfb0e('0x38')]=_[_0xfb0e('0x3c')](_0x1fadd8[_0xfb0e('0x38')],{'$or':_['map'](_0xb34faf,function(_0x50c8af){if(_0x50c8af[_0xfb0e('0x2d')]!=='VIRTUAL'){var _0x32580f={};_0x32580f[_0x50c8af[_0xfb0e('0x27')]]={'$like':'%'+_0x1821c4[_0xfb0e('0x2e')][_0xfb0e('0x3b')]+'%'};return _0x32580f;}})});}_0x1fadd8=_[_0xfb0e('0x3c')]({},_0x1fadd8,_0x1821c4[_0xfb0e('0x3d')]);var _0x90c84c={'where':_0x1fadd8[_0xfb0e('0x38')]};return db[_0xfb0e('0x2b')][_0xfb0e('0x1a')](_0x90c84c)[_0xfb0e('0x23')](function(_0x2e64e2){_0x23d1e2[_0xfb0e('0x1a')]=_0x2e64e2;if(_0x1821c4[_0xfb0e('0x2e')][_0xfb0e('0x3e')]){_0x1fadd8[_0xfb0e('0x3f')]=[{'all':!![]}];}return db[_0xfb0e('0x2b')]['findAll'](_0x1fadd8);})[_0xfb0e('0x23')](function(_0x54185a){_0x23d1e2[_0xfb0e('0x40')]=_0x54185a;return _0x23d1e2;})[_0xfb0e('0x23')](respondWithFilteredResult(_0x482f41,_0x1fadd8))['catch'](handleError(_0x482f41,null));};exports[_0xfb0e('0x41')]=function(_0x50497f,_0x1d1069){var _0x487627={'raw':!![],'where':{'id':_0x50497f[_0xfb0e('0x42')]['id']}},_0x84d7d8={};_0x84d7d8['model']=_[_0xfb0e('0x2f')](db[_0xfb0e('0x2b')]['rawAttributes']);_0x84d7d8[_0xfb0e('0x2e')]=_[_0xfb0e('0x2f')](_0x50497f['query']);_0x84d7d8['filters']=_[_0xfb0e('0x30')](_0x84d7d8[_0xfb0e('0x31')],_0x84d7d8[_0xfb0e('0x2e')]);_0x487627[_0xfb0e('0x32')]=_[_0xfb0e('0x30')](_0x84d7d8['model'],qs[_0xfb0e('0x33')](_0x50497f[_0xfb0e('0x2e')][_0xfb0e('0x33')]));_0x487627['attributes']=_0x487627[_0xfb0e('0x32')]['length']?_0x487627['attributes']:_0x84d7d8['model'];if(_0x50497f[_0xfb0e('0x2e')][_0xfb0e('0x3e')]){_0x487627['include']=[{'all':!![]}];}_0x487627=_[_0xfb0e('0x3c')]({},_0x487627,_0x50497f[_0xfb0e('0x3d')]);return db['SugarcrmField'][_0xfb0e('0x43')](_0x487627)[_0xfb0e('0x23')](handleEntityNotFound(_0x1d1069,null))[_0xfb0e('0x23')](respondWithResult(_0x1d1069,null))[_0xfb0e('0x44')](handleError(_0x1d1069,null));};exports[_0xfb0e('0x45')]=function(_0x2af952,_0x4a1eee){return db['SugarcrmField'][_0xfb0e('0x45')](_0x2af952[_0xfb0e('0x46')],{})[_0xfb0e('0x23')](respondWithResult(_0x4a1eee,0xc9))[_0xfb0e('0x44')](handleError(_0x4a1eee,null));};exports['update']=function(_0x2cafb9,_0x2e51f9){if(_0x2cafb9['body']['id']){delete _0x2cafb9[_0xfb0e('0x46')]['id'];}return db[_0xfb0e('0x2b')][_0xfb0e('0x43')]({'where':{'id':_0x2cafb9[_0xfb0e('0x42')]['id']}})[_0xfb0e('0x23')](handleEntityNotFound(_0x2e51f9,null))[_0xfb0e('0x23')](saveUpdates(_0x2cafb9[_0xfb0e('0x46')],null))['then'](respondWithResult(_0x2e51f9,null))[_0xfb0e('0x44')](handleError(_0x2e51f9,null));};exports[_0xfb0e('0x22')]=function(_0x197bab,_0x34a28c){return db['SugarcrmField']['find']({'where':{'id':_0x197bab[_0xfb0e('0x42')]['id']}})[_0xfb0e('0x23')](handleEntityNotFound(_0x34a28c,null))['then'](removeEntity(_0x34a28c,null))[_0xfb0e('0x44')](handleError(_0x34a28c,null));}; \ No newline at end of file +var _0xa747=['util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2c27d5,_0xd810c9){var _0x23de81=function(_0x496df0){while(--_0x496df0){_0x2c27d5['push'](_0x2c27d5['shift']());}};_0x23de81(++_0xd810c9);}(_0xa747,0x12d));var _0x7a74=function(_0x102f63,_0x3e8b3d){_0x102f63=_0x102f63-0x0;var _0x29e07c=_0xa747[_0x102f63];return _0x29e07c;};'use strict';var emlformat=require(_0x7a74('0x0'));var rimraf=require(_0x7a74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a74('0x2'));var rp=require(_0x7a74('0x3'));var moment=require(_0x7a74('0x4'));var BPromise=require(_0x7a74('0x5'));var Mustache=require(_0x7a74('0x6'));var util=require(_0x7a74('0x7'));var path=require(_0x7a74('0x8'));var sox=require(_0x7a74('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a74('0xa'));var _=require(_0x7a74('0xb'));var squel=require(_0x7a74('0xc'));var crypto=require('crypto');var jsforce=require(_0x7a74('0xd'));var deskjs=require(_0x7a74('0xe'));var toCsv=require(_0x7a74('0xf'));var querystring=require('querystring');var Papa=require(_0x7a74('0x10'));var Redis=require(_0x7a74('0x11'));var authService=require(_0x7a74('0x12'));var qs=require(_0x7a74('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a74('0x14'))(_0x7a74('0x15'));var utils=require(_0x7a74('0x16'));var config=require(_0x7a74('0x17'));var licenseUtil=require(_0x7a74('0x18'));var db=require(_0x7a74('0x19'))['db'];function respondWithStatusCode(_0x5d9d8a,_0x20cee7){_0x20cee7=_0x20cee7||0xcc;return function(_0x5ea8e7){if(_0x5ea8e7){return _0x5d9d8a[_0x7a74('0x1a')](_0x20cee7);}return _0x5d9d8a['status'](_0x20cee7)[_0x7a74('0x1b')]();};}function respondWithResult(_0x8cd735,_0x2e6948){_0x2e6948=_0x2e6948||0xc8;return function(_0x56647f){if(_0x56647f){return _0x8cd735[_0x7a74('0x1c')](_0x2e6948)['json'](_0x56647f);}};}function respondWithFilteredResult(_0x109b8a,_0x642774){return function(_0x5874a2){if(_0x5874a2){var _0x1ff3b9=typeof _0x642774[_0x7a74('0x1d')]===_0x7a74('0x1e')&&typeof _0x642774[_0x7a74('0x1f')]===_0x7a74('0x1e');var _0x394269=_0x5874a2[_0x7a74('0x20')];var _0x12b07e=_0x1ff3b9?0x0:_0x642774[_0x7a74('0x1d')];var _0x3289e9=_0x1ff3b9?_0x5874a2['count']:_0x642774[_0x7a74('0x1d')]+_0x642774[_0x7a74('0x1f')];var _0x432b0d;if(_0x3289e9>=_0x394269){_0x3289e9=_0x394269;_0x432b0d=0xc8;}else{_0x432b0d=0xce;}_0x109b8a[_0x7a74('0x1c')](_0x432b0d);return _0x109b8a['set'](_0x7a74('0x21'),_0x12b07e+'-'+_0x3289e9+'/'+_0x394269)[_0x7a74('0x22')](_0x5874a2);}return null;};}function patchUpdates(_0x51a44d){return function(_0xd45ec5){try{jsonpatch[_0x7a74('0x23')](_0xd45ec5,_0x51a44d,!![]);}catch(_0x52a025){return BPromise[_0x7a74('0x24')](_0x52a025);}return _0xd45ec5[_0x7a74('0x25')]();};}function saveUpdates(_0x250216,_0x488ed5){return function(_0x144367){if(_0x144367){return _0x144367[_0x7a74('0x26')](_0x250216)[_0x7a74('0x27')](function(_0xf798e1){return _0xf798e1;});}return null;};}function removeEntity(_0x58edaf,_0x51598a){return function(_0x3325af){if(_0x3325af){return _0x3325af[_0x7a74('0x28')]()[_0x7a74('0x27')](function(){_0x58edaf[_0x7a74('0x1c')](0xcc)[_0x7a74('0x1b')]();});}};}function handleEntityNotFound(_0x1e75d7,_0x43702c){return function(_0x1ad1ae){if(!_0x1ad1ae){_0x1e75d7['sendStatus'](0x194);}return _0x1ad1ae;};}function handleError(_0x34cd42,_0x10c564){_0x10c564=_0x10c564||0x1f4;return function(_0x5e0e0a){logger[_0x7a74('0x29')](_0x5e0e0a[_0x7a74('0x2a')]);if(_0x5e0e0a['name']){delete _0x5e0e0a[_0x7a74('0x2b')];}_0x34cd42[_0x7a74('0x1c')](_0x10c564)[_0x7a74('0x2c')](_0x5e0e0a);};}exports['index']=function(_0x40f577,_0x31d039){var _0x21857d={},_0x32b441={},_0x470e8c={'count':0x0,'rows':[]};var _0x2c22e4=_[_0x7a74('0x2d')](db[_0x7a74('0x2e')][_0x7a74('0x2f')],function(_0x439651){return{'name':_0x439651[_0x7a74('0x30')],'type':_0x439651[_0x7a74('0x31')][_0x7a74('0x32')]};});_0x32b441[_0x7a74('0x33')]=_[_0x7a74('0x2d')](_0x2c22e4,_0x7a74('0x2b'));_0x32b441[_0x7a74('0x34')]=_[_0x7a74('0x35')](_0x40f577[_0x7a74('0x34')]);_0x32b441['filters']=_[_0x7a74('0x36')](_0x32b441[_0x7a74('0x33')],_0x32b441[_0x7a74('0x34')]);_0x21857d['attributes']=_['intersection'](_0x32b441['model'],qs[_0x7a74('0x37')](_0x40f577[_0x7a74('0x34')][_0x7a74('0x37')]));_0x21857d[_0x7a74('0x38')]=_0x21857d[_0x7a74('0x38')][_0x7a74('0x39')]?_0x21857d[_0x7a74('0x38')]:_0x32b441['model'];if(!_0x40f577[_0x7a74('0x34')][_0x7a74('0x3a')](_0x7a74('0x3b'))){_0x21857d[_0x7a74('0x1f')]=qs['limit'](_0x40f577['query'][_0x7a74('0x1f')]);_0x21857d[_0x7a74('0x1d')]=qs['offset'](_0x40f577[_0x7a74('0x34')][_0x7a74('0x1d')]);}_0x21857d[_0x7a74('0x3c')]=qs[_0x7a74('0x3d')](_0x40f577['query'][_0x7a74('0x3d')]);_0x21857d['where']=qs[_0x7a74('0x3e')](_[_0x7a74('0x3f')](_0x40f577[_0x7a74('0x34')],_0x32b441[_0x7a74('0x3e')]),_0x2c22e4);if(_0x40f577['query'][_0x7a74('0x40')]){_0x21857d[_0x7a74('0x41')]=_[_0x7a74('0x42')](_0x21857d['where'],{'$or':_[_0x7a74('0x2d')](_0x2c22e4,function(_0x4b161c){if(_0x4b161c['type']!==_0x7a74('0x43')){var _0x5af1ff={};_0x5af1ff[_0x4b161c['name']]={'$like':'%'+_0x40f577[_0x7a74('0x34')][_0x7a74('0x40')]+'%'};return _0x5af1ff;}})});}_0x21857d=_['merge']({},_0x21857d,_0x40f577[_0x7a74('0x44')]);var _0x11f3c8={'where':_0x21857d[_0x7a74('0x41')]};return db[_0x7a74('0x2e')][_0x7a74('0x20')](_0x11f3c8)[_0x7a74('0x27')](function(_0x58a996){_0x470e8c[_0x7a74('0x20')]=_0x58a996;if(_0x40f577[_0x7a74('0x34')][_0x7a74('0x45')]){_0x21857d[_0x7a74('0x46')]=[{'all':!![]}];}return db[_0x7a74('0x2e')]['findAll'](_0x21857d);})[_0x7a74('0x27')](function(_0x246091){_0x470e8c['rows']=_0x246091;return _0x470e8c;})[_0x7a74('0x27')](respondWithFilteredResult(_0x31d039,_0x21857d))[_0x7a74('0x47')](handleError(_0x31d039,null));};exports[_0x7a74('0x48')]=function(_0x29bf7e,_0x3667d5){var _0x387222={'raw':!![],'where':{'id':_0x29bf7e[_0x7a74('0x49')]['id']}},_0x5cf1bb={};_0x5cf1bb[_0x7a74('0x33')]=_[_0x7a74('0x35')](db[_0x7a74('0x2e')][_0x7a74('0x2f')]);_0x5cf1bb[_0x7a74('0x34')]=_[_0x7a74('0x35')](_0x29bf7e['query']);_0x5cf1bb[_0x7a74('0x3e')]=_[_0x7a74('0x36')](_0x5cf1bb[_0x7a74('0x33')],_0x5cf1bb[_0x7a74('0x34')]);_0x387222[_0x7a74('0x38')]=_['intersection'](_0x5cf1bb['model'],qs[_0x7a74('0x37')](_0x29bf7e[_0x7a74('0x34')][_0x7a74('0x37')]));_0x387222[_0x7a74('0x38')]=_0x387222[_0x7a74('0x38')]['length']?_0x387222['attributes']:_0x5cf1bb[_0x7a74('0x33')];if(_0x29bf7e['query']['includeAll']){_0x387222[_0x7a74('0x46')]=[{'all':!![]}];}_0x387222=_[_0x7a74('0x42')]({},_0x387222,_0x29bf7e['options']);return db[_0x7a74('0x2e')][_0x7a74('0x4a')](_0x387222)['then'](handleEntityNotFound(_0x3667d5,null))[_0x7a74('0x27')](respondWithResult(_0x3667d5,null))['catch'](handleError(_0x3667d5,null));};exports[_0x7a74('0x4b')]=function(_0x356454,_0x43a262){return db[_0x7a74('0x2e')][_0x7a74('0x4b')](_0x356454[_0x7a74('0x4c')],{})[_0x7a74('0x27')](respondWithResult(_0x43a262,0xc9))[_0x7a74('0x47')](handleError(_0x43a262,null));};exports[_0x7a74('0x26')]=function(_0x522b85,_0xbff7f9){if(_0x522b85[_0x7a74('0x4c')]['id']){delete _0x522b85['body']['id'];}return db[_0x7a74('0x2e')][_0x7a74('0x4a')]({'where':{'id':_0x522b85['params']['id']}})[_0x7a74('0x27')](handleEntityNotFound(_0xbff7f9,null))[_0x7a74('0x27')](saveUpdates(_0x522b85[_0x7a74('0x4c')],null))['then'](respondWithResult(_0xbff7f9,null))[_0x7a74('0x47')](handleError(_0xbff7f9,null));};exports[_0x7a74('0x28')]=function(_0x58e0d1,_0x3577cd){return db[_0x7a74('0x2e')][_0x7a74('0x4a')]({'where':{'id':_0x58e0d1[_0x7a74('0x49')]['id']}})['then'](handleEntityNotFound(_0x3577cd,null))[_0x7a74('0x27')](removeEntity(_0x3577cd,null))[_0x7a74('0x47')](handleError(_0x3577cd,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 9b820b5..1d16592 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 _0xc7da=['SugarcrmField','sugarcrm_unique_index','FieldId','lodash','../../config/logger','moment','path','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0xcc33a,_0x398f2c){var _0x46c996=function(_0x49de1a){while(--_0x49de1a){_0xcc33a['push'](_0xcc33a['shift']());}};_0x46c996(++_0x398f2c);}(_0xc7da,0x1b1));var _0xac7d=function(_0x7a9ceb,_0x2a38a6){_0x7a9ceb=_0x7a9ceb-0x0;var _0xec8346=_0xc7da[_0x7a9ceb];return _0xec8346;};'use strict';var _=require(_0xac7d('0x0'));var util=require('util');var logger=require(_0xac7d('0x1'))('api');var moment=require(_0xac7d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xac7d('0x3'));var rimraf=require(_0xac7d('0x4'));var config=require(_0xac7d('0x5'));var attributes=require(_0xac7d('0x6'));module['exports']=function(_0x3ec6de,_0x4197eb){return _0x3ec6de['define'](_0xac7d('0x7'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xac7d('0x8'),'fields':['idField',_0xac7d('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb97d=['moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xb97d,0x101));var _0xdb97=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xb97d[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0xdb97('0x0'));var util=require('util');var logger=require(_0xdb97('0x1'))(_0xdb97('0x2'));var moment=require(_0xdb97('0x3'));var BPromise=require(_0xdb97('0x4'));var rp=require(_0xdb97('0x5'));var fs=require('fs');var path=require(_0xdb97('0x6'));var rimraf=require('rimraf');var config=require(_0xdb97('0x7'));var attributes=require(_0xdb97('0x8'));module['exports']=function(_0x10b556,_0x4766bd){return _0x10b556['define'](_0xdb97('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xdb97('0xa'),'fields':[_0xdb97('0xb'),_0xdb97('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 1769245..02d3a7d 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 _0xb300=['client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4c471a,_0x10b1c7){var _0xcb65db=function(_0x30ba70){while(--_0x30ba70){_0x4c471a['push'](_0x4c471a['shift']());}};_0xcb65db(++_0x10b1c7);}(_0xb300,0x122));var _0x0b30=function(_0x593f4d,_0x208130){_0x593f4d=_0x593f4d-0x0;var _0xffff58=_0xb300[_0x593f4d];return _0xffff58;};'use strict';var _=require('lodash');var util=require(_0x0b30('0x0'));var moment=require('moment');var BPromise=require(_0x0b30('0x1'));var rs=require(_0x0b30('0x2'));var fs=require('fs');var Redis=require(_0x0b30('0x3'));var db=require(_0x0b30('0x4'))['db'];var utils=require(_0x0b30('0x5'));var logger=require('../../config/logger')(_0x0b30('0x6'));var config=require(_0x0b30('0x7'));var jayson=require(_0x0b30('0x8'));var client=jayson[_0x0b30('0x9')][_0x0b30('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f448a,_0x2f9a5b,_0xa9e2b2){return new BPromise(function(_0x3f1889,_0x3be829){return client[_0x0b30('0xb')](_0x4f448a,_0xa9e2b2)[_0x0b30('0xc')](function(_0xe4863e){logger[_0x0b30('0xd')](_0x0b30('0xe'),_0x2f9a5b,_0x0b30('0xf'));logger[_0x0b30('0x10')](_0x0b30('0x11'),_0x2f9a5b,'request\x20sent',JSON[_0x0b30('0x12')](_0xe4863e));if(_0xe4863e[_0x0b30('0x13')]){if(_0xe4863e[_0x0b30('0x13')]['code']===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x2f9a5b,_0xe4863e[_0x0b30('0x13')][_0x0b30('0x14')]);return _0x3be829(_0xe4863e[_0x0b30('0x13')][_0x0b30('0x14')]);}logger['error'](_0x0b30('0xe'),_0x2f9a5b,_0xe4863e['error'][_0x0b30('0x14')]);return _0x3f1889(_0xe4863e[_0x0b30('0x13')][_0x0b30('0x14')]);}else{logger[_0x0b30('0xd')](_0x0b30('0xe'),_0x2f9a5b,_0x0b30('0xf'));_0x3f1889(_0xe4863e[_0x0b30('0x15')][_0x0b30('0x14')]);}})[_0x0b30('0x16')](function(_0x282b75){logger[_0x0b30('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x2f9a5b,_0x282b75);_0x3be829(_0x282b75);});});} \ No newline at end of file +var _0x964b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','SugarcrmField,\x20%s,\x20%s','catch','lodash','randomstring','ioredis','../../mysqldb'];(function(_0x57cd0d,_0x3f9781){var _0x131b38=function(_0x376b20){while(--_0x376b20){_0x57cd0d['push'](_0x57cd0d['shift']());}};_0x131b38(++_0x3f9781);}(_0x964b,0x146));var _0xb964=function(_0x5f37aa,_0x48ff20){_0x5f37aa=_0x5f37aa-0x0;var _0xccc4a0=_0x964b[_0x5f37aa];return _0xccc4a0;};'use strict';var _=require(_0xb964('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb964('0x1'));var fs=require('fs');var Redis=require(_0xb964('0x2'));var db=require(_0xb964('0x3'))['db'];var utils=require(_0xb964('0x4'));var logger=require(_0xb964('0x5'))(_0xb964('0x6'));var config=require(_0xb964('0x7'));var jayson=require(_0xb964('0x8'));var client=jayson[_0xb964('0x9')][_0xb964('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bdd3e,_0x5a8fe8,_0x2537f9){return new BPromise(function(_0x5e66db,_0xb2385){return client[_0xb964('0xb')](_0x4bdd3e,_0x2537f9)[_0xb964('0xc')](function(_0x20beec){logger[_0xb964('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x5a8fe8,'request\x20sent');logger[_0xb964('0xe')](_0xb964('0xf'),_0x5a8fe8,_0xb964('0x10'),JSON['stringify'](_0x20beec));if(_0x20beec['error']){if(_0x20beec[_0xb964('0x11')][_0xb964('0x12')]===0x1f4){logger[_0xb964('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x5a8fe8,_0x20beec[_0xb964('0x11')][_0xb964('0x13')]);return _0xb2385(_0x20beec[_0xb964('0x11')][_0xb964('0x13')]);}logger[_0xb964('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x5a8fe8,_0x20beec[_0xb964('0x11')][_0xb964('0x13')]);return _0x5e66db(_0x20beec[_0xb964('0x11')][_0xb964('0x13')]);}else{logger[_0xb964('0xd')](_0xb964('0x14'),_0x5a8fe8,_0xb964('0x10'));_0x5e66db(_0x20beec['result'][_0xb964('0x13')]);}})[_0xb964('0x15')](function(_0x5b9a9b){logger[_0xb964('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x5a8fe8,_0x5b9a9b);_0xb2385(_0x5b9a9b);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 3203689..f4dcace 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 _0xa1fd=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x39fa8f,_0x5540d3){var _0x5af889=function(_0x379934){while(--_0x379934){_0x39fa8f['push'](_0x39fa8f['shift']());}};_0x5af889(++_0x5540d3);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x44cd28,_0x1502d9){_0x44cd28=_0x44cd28-0x0;var _0x39356e=_0xa1fd[_0x44cd28];return _0x39356e;};'use strict';var multer=require(_0xda1f('0x0'));var util=require(_0xda1f('0x1'));var path=require(_0xda1f('0x2'));var timeout=require(_0xda1f('0x3'));var express=require('express');var router=express[_0xda1f('0x4')]();var fs_extra=require(_0xda1f('0x5'));var auth=require(_0xda1f('0x6'));var interaction=require(_0xda1f('0x7'));var config=require(_0xda1f('0x8'));var controller=require('./intVtigerAccount.controller');router[_0xda1f('0x9')]('/',auth[_0xda1f('0xa')](),controller[_0xda1f('0xb')]);router['get'](_0xda1f('0xc'),auth[_0xda1f('0xa')](),controller[_0xda1f('0xd')]);router[_0xda1f('0x9')](_0xda1f('0xe'),auth[_0xda1f('0xa')](),controller[_0xda1f('0xf')]);router[_0xda1f('0x9')](_0xda1f('0x10'),auth['isAuthenticated'](),controller[_0xda1f('0x11')]);router[_0xda1f('0x12')]('/',auth[_0xda1f('0xa')](),controller[_0xda1f('0x13')]);router['post']('/:id/configurations',auth[_0xda1f('0xa')](),controller[_0xda1f('0x14')]);router[_0xda1f('0x15')](_0xda1f('0xc'),auth[_0xda1f('0xa')](),controller['update']);router[_0xda1f('0x16')](_0xda1f('0xc'),auth[_0xda1f('0xa')](),controller[_0xda1f('0x17')]);module[_0xda1f('0x18')]=router; \ No newline at end of file +var _0xdad2=['show','/:id/configurations','getConfigurations','post','put','/:id','update','delete','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0xdad2,0x14c));var _0x2dad=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xdad2[_0x1cc8fe];return _0x230054;};'use strict';var multer=require('multer');var util=require(_0x2dad('0x0'));var path=require(_0x2dad('0x1'));var timeout=require('connect-timeout');var express=require(_0x2dad('0x2'));var router=express[_0x2dad('0x3')]();var fs_extra=require(_0x2dad('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2dad('0x5'));var config=require(_0x2dad('0x6'));var controller=require('./intVtigerAccount.controller');router[_0x2dad('0x7')]('/',auth[_0x2dad('0x8')](),controller[_0x2dad('0x9')]);router[_0x2dad('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2dad('0xa')]);router[_0x2dad('0x7')](_0x2dad('0xb'),auth[_0x2dad('0x8')](),controller[_0x2dad('0xc')]);router[_0x2dad('0x7')]('/:id/fields',auth[_0x2dad('0x8')](),controller['getFields']);router[_0x2dad('0xd')]('/',auth[_0x2dad('0x8')](),controller['create']);router[_0x2dad('0xd')](_0x2dad('0xb'),auth[_0x2dad('0x8')](),controller['addConfiguration']);router[_0x2dad('0xe')](_0x2dad('0xf'),auth['isAuthenticated'](),controller[_0x2dad('0x10')]);router[_0x2dad('0x11')](_0x2dad('0xf'),auth[_0x2dad('0x8')](),controller['destroy']);module[_0x2dad('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 8119d7f..01028e5 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 _0xe67c=['HelpDesk','exports','STRING'];(function(_0x49c370,_0x27aa20){var _0x663c10=function(_0x1528f9){while(--_0x1528f9){_0x49c370['push'](_0x49c370['shift']());}};_0x663c10(++_0x27aa20);}(_0xe67c,0x18a));var _0xce67=function(_0x3d479c,_0x1351c1){_0x3d479c=_0x3d479c-0x0;var _0x5964c9=_0xe67c[_0x3d479c];return _0x5964c9;};'use strict';var Sequelize=require('sequelize');module[_0xce67('0x0')]={'name':{'type':Sequelize[_0xce67('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xce67('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xce67('0x1')],'allowNull':![],'defaultValue':_0xce67('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xce67('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xce67('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x87ac=['HelpDesk','sequelize','STRING'];(function(_0x5268d4,_0x3c84b2){var _0x5eddb9=function(_0x40d176){while(--_0x40d176){_0x5268d4['push'](_0x5268d4['shift']());}};_0x5eddb9(++_0x3c84b2);}(_0x87ac,0x115));var _0xc87a=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x87ac[_0x468b0f];return _0x3e74d9;};'use strict';var Sequelize=require(_0xc87a('0x0'));module['exports']={'name':{'type':Sequelize[_0xc87a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc87a('0x1')]},'username':{'type':Sequelize[_0xc87a('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xc87a('0x1')],'allowNull':![],'defaultValue':_0xc87a('0x2')},'remoteUri':{'type':Sequelize[_0xc87a('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xc87a('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xc87a('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index b2fad0b..48c4317 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 _0x226b=['find','create','update','body','getConfigurations','findOne','params','VtigerConfiguration','addConfiguration','AccountId','getSubjects','channel','getDescriptions','VtigerField','Descriptions','md5','getFields','username','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','success','POST','login','result','token','GET','describe','remove','includes','type','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','count','limit','apply','reject','save','then','destroy','stack','name','send','map','VtigerAccount','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','rows','catch','show','include','options'];(function(_0x440b58,_0x57d22e){var _0x3af4b1=function(_0x1134d9){while(--_0x1134d9){_0x440b58['push'](_0x440b58['shift']());}};_0x3af4b1(++_0x57d22e);}(_0x226b,0x199));var _0xb226=function(_0x1ba31d,_0x10b728){_0x1ba31d=_0x1ba31d-0x0;var _0x125d05=_0x226b[_0x1ba31d];return _0x125d05;};'use strict';var emlformat=require(_0xb226('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb226('0x1'));var jsonpatch=require(_0xb226('0x2'));var rp=require(_0xb226('0x3'));var moment=require(_0xb226('0x4'));var BPromise=require(_0xb226('0x5'));var Mustache=require(_0xb226('0x6'));var util=require(_0xb226('0x7'));var path=require(_0xb226('0x8'));var sox=require(_0xb226('0x9'));var csv=require(_0xb226('0xa'));var ejs=require(_0xb226('0xb'));var fs=require('fs');var fs_extra=require(_0xb226('0xc'));var _=require(_0xb226('0xd'));var squel=require(_0xb226('0xe'));var crypto=require(_0xb226('0xf'));var jsforce=require(_0xb226('0x10'));var deskjs=require(_0xb226('0x11'));var toCsv=require(_0xb226('0xa'));var querystring=require(_0xb226('0x12'));var Papa=require(_0xb226('0x13'));var Redis=require(_0xb226('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xb226('0x15'));var as=require(_0xb226('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb226('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xb226('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb226('0x19'))['db'];var integrations=require(_0xb226('0x1a'));function respondWithStatusCode(_0x3d0128,_0x343cdc){_0x343cdc=_0x343cdc||0xcc;return function(_0x1267b5){if(_0x1267b5){return _0x3d0128[_0xb226('0x1b')](_0x343cdc);}return _0x3d0128['status'](_0x343cdc)[_0xb226('0x1c')]();};}function respondWithResult(_0x58d63e,_0x1fb34d){_0x1fb34d=_0x1fb34d||0xc8;return function(_0x329352){if(_0x329352){return _0x58d63e[_0xb226('0x1d')](_0x1fb34d)['json'](_0x329352);}};}function respondWithFilteredResult(_0x5b1871,_0x3110cd){return function(_0x4565aa){if(_0x4565aa){var _0x2d86db=typeof _0x3110cd[_0xb226('0x1e')]===_0xb226('0x1f')&&typeof _0x3110cd['limit']===_0xb226('0x1f');var _0x58ea74=_0x4565aa[_0xb226('0x20')];var _0x3502c5=_0x2d86db?0x0:_0x3110cd['offset'];var _0x23568d=_0x2d86db?_0x4565aa[_0xb226('0x20')]:_0x3110cd['offset']+_0x3110cd[_0xb226('0x21')];var _0x29388c;if(_0x23568d>=_0x58ea74){_0x23568d=_0x58ea74;_0x29388c=0xc8;}else{_0x29388c=0xce;}_0x5b1871[_0xb226('0x1d')](_0x29388c);return _0x5b1871['set']('Content-Range',_0x3502c5+'-'+_0x23568d+'/'+_0x58ea74)['json'](_0x4565aa);}return null;};}function patchUpdates(_0x3519d2){return function(_0x2c7d8b){try{jsonpatch[_0xb226('0x22')](_0x2c7d8b,_0x3519d2,!![]);}catch(_0x3db9e2){return BPromise[_0xb226('0x23')](_0x3db9e2);}return _0x2c7d8b[_0xb226('0x24')]();};}function saveUpdates(_0x14982d,_0x36b5a8){return function(_0x475ca9){if(_0x475ca9){return _0x475ca9['update'](_0x14982d)[_0xb226('0x25')](function(_0x3e3ab3){return _0x3e3ab3;});}return null;};}function removeEntity(_0x261e40,_0x1ec72d){return function(_0x202ae5){if(_0x202ae5){return _0x202ae5[_0xb226('0x26')]()['then'](function(){_0x261e40['status'](0xcc)[_0xb226('0x1c')]();});}};}function handleEntityNotFound(_0x36498a,_0x46fa98){return function(_0xcaf5a3){if(!_0xcaf5a3){_0x36498a[_0xb226('0x1b')](0x194);}return _0xcaf5a3;};}function handleError(_0x5b0815,_0x5b1f17){_0x5b1f17=_0x5b1f17||0x1f4;return function(_0x5f2791){logger['error'](_0x5f2791[_0xb226('0x27')]);if(_0x5f2791[_0xb226('0x28')]){delete _0x5f2791['name'];}_0x5b0815['status'](_0x5b1f17)[_0xb226('0x29')](_0x5f2791);};}exports['index']=function(_0x4db9b8,_0x28049e){var _0x2d1379={},_0x2132c9={},_0x427e8f={'count':0x0,'rows':[]};var _0x3bf249=_[_0xb226('0x2a')](db[_0xb226('0x2b')][_0xb226('0x2c')],function(_0x565e1b){return{'name':_0x565e1b['fieldName'],'type':_0x565e1b['type']['key']};});_0x2132c9[_0xb226('0x2d')]=_[_0xb226('0x2a')](_0x3bf249,'name');_0x2132c9[_0xb226('0x2e')]=_[_0xb226('0x2f')](_0x4db9b8[_0xb226('0x2e')]);_0x2132c9[_0xb226('0x30')]=_[_0xb226('0x31')](_0x2132c9[_0xb226('0x2d')],_0x2132c9[_0xb226('0x2e')]);_0x2d1379[_0xb226('0x32')]=_['intersection'](_0x2132c9[_0xb226('0x2d')],qs['fields'](_0x4db9b8[_0xb226('0x2e')][_0xb226('0x33')]));_0x2d1379['attributes']=_0x2d1379[_0xb226('0x32')][_0xb226('0x34')]?_0x2d1379[_0xb226('0x32')]:_0x2132c9[_0xb226('0x2d')];if(!_0x4db9b8[_0xb226('0x2e')][_0xb226('0x35')](_0xb226('0x36'))){_0x2d1379[_0xb226('0x21')]=qs[_0xb226('0x21')](_0x4db9b8[_0xb226('0x2e')][_0xb226('0x21')]);_0x2d1379[_0xb226('0x1e')]=qs[_0xb226('0x1e')](_0x4db9b8['query'][_0xb226('0x1e')]);}_0x2d1379[_0xb226('0x37')]=qs[_0xb226('0x38')](_0x4db9b8[_0xb226('0x2e')]['sort']);_0x2d1379[_0xb226('0x39')]=qs[_0xb226('0x30')](_['pick'](_0x4db9b8[_0xb226('0x2e')],_0x2132c9['filters']),_0x3bf249);if(_0x4db9b8[_0xb226('0x2e')][_0xb226('0x3a')]){_0x2d1379['where']=_[_0xb226('0x3b')](_0x2d1379[_0xb226('0x39')],{'$or':_[_0xb226('0x2a')](_0x3bf249,function(_0x4cf5f6){if(_0x4cf5f6['type']!==_0xb226('0x3c')){var _0x1fd153={};_0x1fd153[_0x4cf5f6['name']]={'$like':'%'+_0x4db9b8[_0xb226('0x2e')][_0xb226('0x3a')]+'%'};return _0x1fd153;}})});}_0x2d1379=_[_0xb226('0x3b')]({},_0x2d1379,_0x4db9b8['options']);var _0x46e646={'where':_0x2d1379[_0xb226('0x39')]};return db['VtigerAccount']['count'](_0x46e646)[_0xb226('0x25')](function(_0x1350ff){_0x427e8f[_0xb226('0x20')]=_0x1350ff;if(_0x4db9b8['query'][_0xb226('0x3d')]){_0x2d1379['include']=[{'all':!![]}];}return db[_0xb226('0x2b')]['findAll'](_0x2d1379);})['then'](function(_0x2d72ee){_0x427e8f[_0xb226('0x3e')]=_0x2d72ee;return _0x427e8f;})[_0xb226('0x25')](respondWithFilteredResult(_0x28049e,_0x2d1379))[_0xb226('0x3f')](handleError(_0x28049e,null));};exports[_0xb226('0x40')]=function(_0x101e40,_0xe62c7a){var _0x3ce623={'raw':![],'where':{'id':_0x101e40['params']['id']}},_0x584f39={};_0x584f39['model']=_['keys'](db['VtigerAccount'][_0xb226('0x2c')]);_0x584f39['query']=_[_0xb226('0x2f')](_0x101e40['query']);_0x584f39[_0xb226('0x30')]=_[_0xb226('0x31')](_0x584f39[_0xb226('0x2d')],_0x584f39[_0xb226('0x2e')]);_0x3ce623['attributes']=_[_0xb226('0x31')](_0x584f39[_0xb226('0x2d')],qs[_0xb226('0x33')](_0x101e40['query'][_0xb226('0x33')]));_0x3ce623[_0xb226('0x32')]=_0x3ce623[_0xb226('0x32')]['length']?_0x3ce623[_0xb226('0x32')]:_0x584f39[_0xb226('0x2d')];if(_0x101e40['query'][_0xb226('0x3d')]){_0x3ce623[_0xb226('0x41')]=[{'all':!![]}];}_0x3ce623=_[_0xb226('0x3b')]({},_0x3ce623,_0x101e40[_0xb226('0x42')]);return db[_0xb226('0x2b')][_0xb226('0x43')](_0x3ce623)[_0xb226('0x25')](handleEntityNotFound(_0xe62c7a,null))[_0xb226('0x25')](respondWithResult(_0xe62c7a,null))[_0xb226('0x3f')](handleError(_0xe62c7a,null));};exports[_0xb226('0x44')]=function(_0x11188c,_0x1afa8d){return db[_0xb226('0x2b')][_0xb226('0x44')](_0x11188c['body'],{})['then'](respondWithResult(_0x1afa8d,0xc9))[_0xb226('0x3f')](handleError(_0x1afa8d,null));};exports[_0xb226('0x45')]=function(_0x12615,_0x4d0179){if(_0x12615[_0xb226('0x46')]['id']){delete _0x12615[_0xb226('0x46')]['id'];}return db[_0xb226('0x2b')][_0xb226('0x43')]({'where':{'id':_0x12615['params']['id']}})[_0xb226('0x25')](handleEntityNotFound(_0x4d0179,null))[_0xb226('0x25')](saveUpdates(_0x12615[_0xb226('0x46')],null))['then'](respondWithResult(_0x4d0179,null))[_0xb226('0x3f')](handleError(_0x4d0179,null));};exports[_0xb226('0x26')]=function(_0xb2211e,_0x31ea1d){return db['VtigerAccount'][_0xb226('0x43')]({'where':{'id':_0xb2211e['params']['id']}})['then'](handleEntityNotFound(_0x31ea1d,null))[_0xb226('0x25')](removeEntity(_0x31ea1d,null))[_0xb226('0x3f')](handleError(_0x31ea1d,null));};exports[_0xb226('0x47')]=function(_0x46dc75,_0x3da1a,_0x202bbd){var _0xdca2db={};var _0x46f1ce={};var _0x27dd93;var _0x4ef4cd;return db[_0xb226('0x2b')][_0xb226('0x48')]({'where':{'id':_0x46dc75[_0xb226('0x49')]['id']}})[_0xb226('0x25')](handleEntityNotFound(_0x3da1a,null))[_0xb226('0x25')](function(_0x2dee61){if(_0x2dee61){_0x27dd93=_0x2dee61;_0x46f1ce[_0xb226('0x2d')]=_['keys'](db[_0xb226('0x4a')][_0xb226('0x2c')]);_0x46f1ce[_0xb226('0x2e')]=_['keys'](_0x46dc75[_0xb226('0x2e')]);_0x46f1ce[_0xb226('0x30')]=_[_0xb226('0x31')](_0x46f1ce[_0xb226('0x2d')],_0x46f1ce[_0xb226('0x2e')]);_0xdca2db['attributes']=_[_0xb226('0x31')](_0x46f1ce[_0xb226('0x2d')],qs['fields'](_0x46dc75[_0xb226('0x2e')][_0xb226('0x33')]));_0xdca2db[_0xb226('0x32')]=_0xdca2db['attributes'][_0xb226('0x34')]?_0xdca2db[_0xb226('0x32')]:_0x46f1ce['model'];_0xdca2db[_0xb226('0x37')]=qs['sort'](_0x46dc75[_0xb226('0x2e')]['sort']);_0xdca2db[_0xb226('0x39')]=qs[_0xb226('0x30')](_['pick'](_0x46dc75[_0xb226('0x2e')],_0x46f1ce[_0xb226('0x30')]));if(_0x46dc75[_0xb226('0x2e')][_0xb226('0x3a')]){_0xdca2db[_0xb226('0x39')]=_[_0xb226('0x3b')](_0xdca2db['where'],{'$or':_[_0xb226('0x2a')](_0xdca2db[_0xb226('0x32')],function(_0x25edc0){var _0x238132={};_0x238132[_0x25edc0]={'$like':'%'+_0x46dc75['query']['filter']+'%'};return _0x238132;})});}_0xdca2db=_[_0xb226('0x3b')]({},_0xdca2db,_0x46dc75['options']);return _0x27dd93[_0xb226('0x47')](_0xdca2db);}})[_0xb226('0x25')](function(_0x157f5d){if(_0x157f5d){_0x4ef4cd=_0x157f5d[_0xb226('0x34')];if(!_0x46dc75[_0xb226('0x2e')][_0xb226('0x35')](_0xb226('0x36'))){_0xdca2db[_0xb226('0x21')]=qs['limit'](_0x46dc75['query'][_0xb226('0x21')]);_0xdca2db[_0xb226('0x1e')]=qs[_0xb226('0x1e')](_0x46dc75[_0xb226('0x2e')][_0xb226('0x1e')]);}return _0x27dd93[_0xb226('0x47')](_0xdca2db);}})[_0xb226('0x25')](function(_0x18d45c){if(_0x18d45c){return _0x18d45c?{'count':_0x4ef4cd,'rows':_0x18d45c}:null;}})[_0xb226('0x25')](respondWithResult(_0x3da1a,null))[_0xb226('0x3f')](handleError(_0x3da1a,null));};exports[_0xb226('0x4b')]=function(_0x594276,_0x48a943,_0x1e76bd){if(_0x594276[_0xb226('0x46')]['id']){delete _0x594276['body']['id'];}return db[_0xb226('0x2b')]['findOne']({'where':{'id':_0x594276[_0xb226('0x49')]['id']}})[_0xb226('0x25')](handleEntityNotFound(_0x48a943,null))['then'](function(_0x1036ae){if(_0x1036ae){_0x594276[_0xb226('0x46')][_0xb226('0x4c')]=_0x1036ae['id'];_0x594276[_0xb226('0x46')]['Subjects']=integrations[_0xb226('0x4d')](_0x594276[_0xb226('0x46')][_0xb226('0x4e')],_0x594276[_0xb226('0x46')]['type']);_0x594276[_0xb226('0x46')]['Descriptions']=integrations[_0xb226('0x4f')](_0x594276[_0xb226('0x46')][_0xb226('0x4e')],_0x594276[_0xb226('0x46')]['type']);return db[_0xb226('0x4a')][_0xb226('0x44')](_0x594276[_0xb226('0x46')],{'include':[{'model':db[_0xb226('0x50')],'as':'Subjects'},{'model':db[_0xb226('0x50')],'as':_0xb226('0x51')}]});}return null;})[_0xb226('0x25')](respondWithResult(_0x48a943,null))[_0xb226('0x3f')](handleError(_0x48a943,null));};var md5=require(_0xb226('0x52'));exports[_0xb226('0x53')]=function(_0x19f112,_0x285611,_0x59ae5c){var _0x21896b=null;var _0x3d1f10=null;var _0x4d35dd=null;var _0x217747=null;var _0x3513ff='';return db['VtigerAccount'][_0xb226('0x48')]({'where':{'id':_0x19f112['params']['id']},'attributes':['id',_0xb226('0x28'),_0xb226('0x54'),'description','moduleName',_0xb226('0x55'),_0xb226('0x56'),_0xb226('0x57')]})[_0xb226('0x25')](handleEntityNotFound(_0x285611,null))[_0xb226('0x25')](function(_0x132c11){if(_0x132c11){_0x21896b=_0x132c11[_0xb226('0x54')];_0x3d1f10=_0x132c11['accessKey'];_0x4d35dd=_0x132c11['moduleName'];_0x3513ff=_0x132c11[_0xb226('0x55')];var _0x55cc97=_0x3513ff[_0xb226('0x58')](-0x1);if(_0x55cc97==='/'){_0x3513ff=_0x3513ff[_0xb226('0x59')](0x0,_0x3513ff[_0xb226('0x5a')](_0x55cc97));}_0x217747=util[_0xb226('0x5b')](_0xb226('0x5c'),_0x3513ff);var _0x225fe5={'method':'GET','uri':_0x217747,'qs':{'operation':'getchallenge','username':_0x132c11[_0xb226('0x54')]},'json':!![]};return rp(_0x225fe5);}})[_0xb226('0x25')](function(_0x49ca33){if(_0x49ca33[_0xb226('0x5d')]){var _0x29bac6={'method':_0xb226('0x5e'),'uri':_0x217747,'form':{'operation':_0xb226('0x5f'),'username':_0x21896b,'accessKey':md5(_0x49ca33[_0xb226('0x60')][_0xb226('0x61')]+_0x3d1f10)},'json':!![]};return rp(_0x29bac6);}})[_0xb226('0x25')](function(_0x3bb3b2){if(_0x3bb3b2['success']){var _0x155df0={'method':_0xb226('0x62'),'uri':_0x217747,'qs':{'operation':_0xb226('0x63'),'username':_0x21896b,'sessionName':_0x3bb3b2['result']['sessionName'],'elementType':_0x4d35dd},'json':!![]};return rp(_0x155df0);}})[_0xb226('0x25')](function(_0x25c283){if(_0x25c283[_0xb226('0x5d')]){var _0x4c11=['autogenerated','reference','owner'];_[_0xb226('0x64')](_0x25c283[_0xb226('0x60')][_0xb226('0x33')],function(_0x386962){return _0x4c11[_0xb226('0x65')](_0x386962[_0xb226('0x66')][_0xb226('0x28')]);});_[_0xb226('0x64')](_0x25c283[_0xb226('0x60')][_0xb226('0x33')],function(_0x3a762d){return _0x3a762d[_0xb226('0x67')]===_0xb226('0x68');});return{'count':_0x25c283[_0xb226('0x60')][_0xb226('0x33')][_0xb226('0x34')],'rows':_[_0xb226('0x2a')](_0x25c283['result'][_0xb226('0x33')],function(_0x43cd12){return{'id':_0x43cd12[_0xb226('0x28')],'name':_0x43cd12[_0xb226('0x69')],'custom':_[_0xb226('0x6a')](_0x43cd12[_0xb226('0x28')],_0xb226('0x6b'))?!![]:![],'options':_0x43cd12[_0xb226('0x66')][_0xb226('0x28')]===_0xb226('0x6c')&&_0x43cd12[_0xb226('0x66')]['picklistValues']['length']>0x0?_[_0xb226('0x2a')](_0x43cd12['type'][_0xb226('0x6d')],function(_0x54687a){return{'name':_0x54687a[_0xb226('0x69')],'value':_0x54687a[_0xb226('0x6e')]};}):[]};})};}})[_0xb226('0x25')](respondWithResult(_0x285611,null))[_0xb226('0x3f')](function(_0x1e7fdb){console[_0xb226('0x6f')](_0xb226('0x70')+_0x1e7fdb);var _0x468cb5=_0x19f112[_0xb226('0x2e')][_0xb226('0x71')]?0x1f4:_0x1e7fdb[_0xb226('0x72')]||0x1f4;logger[_0xb226('0x73')](_0xb226('0x74'),_0xb226('0x53'),_0x468cb5,JSON[_0xb226('0x75')](_0x1e7fdb));delete _0x1e7fdb[_0xb226('0x28')];if(_0x468cb5===0x191){_0x468cb5=0x190;}_0x285611['status'](_0x468cb5)[_0xb226('0x29')](_0x19f112[_0xb226('0x2e')][_0xb226('0x71')]?{'message':_0xb226('0x76'),'statusCode':_0x1e7fdb[_0xb226('0x72')]}:_0x1e7fdb);});}; \ No newline at end of file +var _0xf6bf=['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','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','length','find','create','body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','lastIndexOf','%s/webservice.php','GET','getchallenge','POST','login','result','token','success','sessionName','autogenerated','reference','owner','remove','false','label','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf6bf,0xe6));var _0xff6b=function(_0x3df6b5,_0x461ce2){_0x3df6b5=_0x3df6b5-0x0;var _0x1246f1=_0xf6bf[_0x3df6b5];return _0x1246f1;};'use strict';var emlformat=require(_0xff6b('0x0'));var rimraf=require(_0xff6b('0x1'));var zipdir=require(_0xff6b('0x2'));var jsonpatch=require(_0xff6b('0x3'));var rp=require('request-promise');var moment=require(_0xff6b('0x4'));var BPromise=require(_0xff6b('0x5'));var Mustache=require('mustache');var util=require(_0xff6b('0x6'));var path=require(_0xff6b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xff6b('0x8'));var fs=require('fs');var fs_extra=require(_0xff6b('0x9'));var _=require(_0xff6b('0xa'));var squel=require(_0xff6b('0xb'));var crypto=require(_0xff6b('0xc'));var jsforce=require(_0xff6b('0xd'));var deskjs=require(_0xff6b('0xe'));var toCsv=require(_0xff6b('0xf'));var querystring=require('querystring');var Papa=require(_0xff6b('0x10'));var Redis=require('ioredis');var authService=require(_0xff6b('0x11'));var qs=require(_0xff6b('0x12'));var as=require(_0xff6b('0x13'));var hardwareService=require(_0xff6b('0x14'));var logger=require(_0xff6b('0x15'))('api');var utils=require(_0xff6b('0x16'));var config=require(_0xff6b('0x17'));var licenseUtil=require(_0xff6b('0x18'));var db=require(_0xff6b('0x19'))['db'];var integrations=require(_0xff6b('0x1a'));function respondWithStatusCode(_0x4b1d61,_0x44588e){_0x44588e=_0x44588e||0xcc;return function(_0x452693){if(_0x452693){return _0x4b1d61[_0xff6b('0x1b')](_0x44588e);}return _0x4b1d61['status'](_0x44588e)[_0xff6b('0x1c')]();};}function respondWithResult(_0x2ef323,_0x56a17f){_0x56a17f=_0x56a17f||0xc8;return function(_0x564557){if(_0x564557){return _0x2ef323[_0xff6b('0x1d')](_0x56a17f)[_0xff6b('0x1e')](_0x564557);}};}function respondWithFilteredResult(_0x5c5295,_0x1c87ad){return function(_0x3fdc6d){if(_0x3fdc6d){var _0x5b7187=typeof _0x1c87ad[_0xff6b('0x1f')]===_0xff6b('0x20')&&typeof _0x1c87ad[_0xff6b('0x21')]==='undefined';var _0x197942=_0x3fdc6d[_0xff6b('0x22')];var _0x118547=_0x5b7187?0x0:_0x1c87ad['offset'];var _0x158900=_0x5b7187?_0x3fdc6d[_0xff6b('0x22')]:_0x1c87ad['offset']+_0x1c87ad[_0xff6b('0x21')];var _0x686d1f;if(_0x158900>=_0x197942){_0x158900=_0x197942;_0x686d1f=0xc8;}else{_0x686d1f=0xce;}_0x5c5295[_0xff6b('0x1d')](_0x686d1f);return _0x5c5295[_0xff6b('0x23')](_0xff6b('0x24'),_0x118547+'-'+_0x158900+'/'+_0x197942)[_0xff6b('0x1e')](_0x3fdc6d);}return null;};}function patchUpdates(_0x16d6b4){return function(_0xa01936){try{jsonpatch[_0xff6b('0x25')](_0xa01936,_0x16d6b4,!![]);}catch(_0x267530){return BPromise['reject'](_0x267530);}return _0xa01936[_0xff6b('0x26')]();};}function saveUpdates(_0x225508,_0x304fad){return function(_0x5a8d13){if(_0x5a8d13){return _0x5a8d13[_0xff6b('0x27')](_0x225508)[_0xff6b('0x28')](function(_0x4a2638){return _0x4a2638;});}return null;};}function removeEntity(_0x3ed040,_0x12f12d){return function(_0x3d704c){if(_0x3d704c){return _0x3d704c[_0xff6b('0x29')]()[_0xff6b('0x28')](function(){_0x3ed040[_0xff6b('0x1d')](0xcc)[_0xff6b('0x1c')]();});}};}function handleEntityNotFound(_0x1c6051,_0x94af8c){return function(_0x3cd2ee){if(!_0x3cd2ee){_0x1c6051[_0xff6b('0x1b')](0x194);}return _0x3cd2ee;};}function handleError(_0x306ae3,_0x554ce7){_0x554ce7=_0x554ce7||0x1f4;return function(_0x470c85){logger[_0xff6b('0x2a')](_0x470c85[_0xff6b('0x2b')]);if(_0x470c85['name']){delete _0x470c85[_0xff6b('0x2c')];}_0x306ae3[_0xff6b('0x1d')](_0x554ce7)[_0xff6b('0x2d')](_0x470c85);};}exports['index']=function(_0x56a657,_0x2f1d9b){var _0x5ef1e6={},_0x15c64e={},_0x4f58ec={'count':0x0,'rows':[]};var _0x4d7c67=_[_0xff6b('0x2e')](db[_0xff6b('0x2f')][_0xff6b('0x30')],function(_0x9f8bd4){return{'name':_0x9f8bd4[_0xff6b('0x31')],'type':_0x9f8bd4[_0xff6b('0x32')][_0xff6b('0x33')]};});_0x15c64e['model']=_[_0xff6b('0x2e')](_0x4d7c67,'name');_0x15c64e[_0xff6b('0x34')]=_[_0xff6b('0x35')](_0x56a657[_0xff6b('0x34')]);_0x15c64e[_0xff6b('0x36')]=_[_0xff6b('0x37')](_0x15c64e[_0xff6b('0x38')],_0x15c64e[_0xff6b('0x34')]);_0x5ef1e6[_0xff6b('0x39')]=_[_0xff6b('0x37')](_0x15c64e[_0xff6b('0x38')],qs[_0xff6b('0x3a')](_0x56a657[_0xff6b('0x34')]['fields']));_0x5ef1e6['attributes']=_0x5ef1e6[_0xff6b('0x39')]['length']?_0x5ef1e6[_0xff6b('0x39')]:_0x15c64e['model'];if(!_0x56a657[_0xff6b('0x34')][_0xff6b('0x3b')]('nolimit')){_0x5ef1e6[_0xff6b('0x21')]=qs[_0xff6b('0x21')](_0x56a657[_0xff6b('0x34')][_0xff6b('0x21')]);_0x5ef1e6[_0xff6b('0x1f')]=qs[_0xff6b('0x1f')](_0x56a657[_0xff6b('0x34')][_0xff6b('0x1f')]);}_0x5ef1e6[_0xff6b('0x3c')]=qs[_0xff6b('0x3d')](_0x56a657['query'][_0xff6b('0x3d')]);_0x5ef1e6[_0xff6b('0x3e')]=qs[_0xff6b('0x36')](_[_0xff6b('0x3f')](_0x56a657['query'],_0x15c64e['filters']),_0x4d7c67);if(_0x56a657[_0xff6b('0x34')][_0xff6b('0x40')]){_0x5ef1e6[_0xff6b('0x3e')]=_[_0xff6b('0x41')](_0x5ef1e6[_0xff6b('0x3e')],{'$or':_[_0xff6b('0x2e')](_0x4d7c67,function(_0x3002ef){if(_0x3002ef['type']!==_0xff6b('0x42')){var _0x4e6756={};_0x4e6756[_0x3002ef[_0xff6b('0x2c')]]={'$like':'%'+_0x56a657['query']['filter']+'%'};return _0x4e6756;}})});}_0x5ef1e6=_[_0xff6b('0x41')]({},_0x5ef1e6,_0x56a657[_0xff6b('0x43')]);var _0x34415c={'where':_0x5ef1e6['where']};return db['VtigerAccount'][_0xff6b('0x22')](_0x34415c)[_0xff6b('0x28')](function(_0x1dcb8a){_0x4f58ec[_0xff6b('0x22')]=_0x1dcb8a;if(_0x56a657[_0xff6b('0x34')][_0xff6b('0x44')]){_0x5ef1e6[_0xff6b('0x45')]=[{'all':!![]}];}return db[_0xff6b('0x2f')]['findAll'](_0x5ef1e6);})['then'](function(_0x35ab34){_0x4f58ec[_0xff6b('0x46')]=_0x35ab34;return _0x4f58ec;})[_0xff6b('0x28')](respondWithFilteredResult(_0x2f1d9b,_0x5ef1e6))[_0xff6b('0x47')](handleError(_0x2f1d9b,null));};exports['show']=function(_0x58fa63,_0x18962f){var _0x55e401={'raw':![],'where':{'id':_0x58fa63[_0xff6b('0x48')]['id']}},_0x4fd7c9={};_0x4fd7c9[_0xff6b('0x38')]=_['keys'](db['VtigerAccount'][_0xff6b('0x30')]);_0x4fd7c9[_0xff6b('0x34')]=_[_0xff6b('0x35')](_0x58fa63[_0xff6b('0x34')]);_0x4fd7c9[_0xff6b('0x36')]=_[_0xff6b('0x37')](_0x4fd7c9['model'],_0x4fd7c9[_0xff6b('0x34')]);_0x55e401[_0xff6b('0x39')]=_['intersection'](_0x4fd7c9[_0xff6b('0x38')],qs[_0xff6b('0x3a')](_0x58fa63['query'][_0xff6b('0x3a')]));_0x55e401[_0xff6b('0x39')]=_0x55e401['attributes'][_0xff6b('0x49')]?_0x55e401[_0xff6b('0x39')]:_0x4fd7c9[_0xff6b('0x38')];if(_0x58fa63[_0xff6b('0x34')][_0xff6b('0x44')]){_0x55e401[_0xff6b('0x45')]=[{'all':!![]}];}_0x55e401=_[_0xff6b('0x41')]({},_0x55e401,_0x58fa63['options']);return db[_0xff6b('0x2f')][_0xff6b('0x4a')](_0x55e401)[_0xff6b('0x28')](handleEntityNotFound(_0x18962f,null))[_0xff6b('0x28')](respondWithResult(_0x18962f,null))['catch'](handleError(_0x18962f,null));};exports[_0xff6b('0x4b')]=function(_0x5d8b70,_0x16c38c){return db[_0xff6b('0x2f')][_0xff6b('0x4b')](_0x5d8b70['body'],{})[_0xff6b('0x28')](respondWithResult(_0x16c38c,0xc9))[_0xff6b('0x47')](handleError(_0x16c38c,null));};exports[_0xff6b('0x27')]=function(_0x55bb96,_0x471bb7){if(_0x55bb96[_0xff6b('0x4c')]['id']){delete _0x55bb96[_0xff6b('0x4c')]['id'];}return db[_0xff6b('0x2f')][_0xff6b('0x4a')]({'where':{'id':_0x55bb96[_0xff6b('0x48')]['id']}})[_0xff6b('0x28')](handleEntityNotFound(_0x471bb7,null))['then'](saveUpdates(_0x55bb96[_0xff6b('0x4c')],null))[_0xff6b('0x28')](respondWithResult(_0x471bb7,null))['catch'](handleError(_0x471bb7,null));};exports[_0xff6b('0x29')]=function(_0x1662ac,_0x941d74){return db[_0xff6b('0x2f')]['find']({'where':{'id':_0x1662ac[_0xff6b('0x48')]['id']}})[_0xff6b('0x28')](handleEntityNotFound(_0x941d74,null))[_0xff6b('0x28')](removeEntity(_0x941d74,null))['catch'](handleError(_0x941d74,null));};exports[_0xff6b('0x4d')]=function(_0x1f4f65,_0x5e25be,_0x50227c){var _0x4d9a1c={};var _0x23bbc2={};var _0x372ea0;var _0x2314c8;return db[_0xff6b('0x2f')][_0xff6b('0x4e')]({'where':{'id':_0x1f4f65[_0xff6b('0x48')]['id']}})['then'](handleEntityNotFound(_0x5e25be,null))[_0xff6b('0x28')](function(_0x332053){if(_0x332053){_0x372ea0=_0x332053;_0x23bbc2['model']=_[_0xff6b('0x35')](db[_0xff6b('0x4f')][_0xff6b('0x30')]);_0x23bbc2['query']=_[_0xff6b('0x35')](_0x1f4f65[_0xff6b('0x34')]);_0x23bbc2['filters']=_['intersection'](_0x23bbc2[_0xff6b('0x38')],_0x23bbc2[_0xff6b('0x34')]);_0x4d9a1c[_0xff6b('0x39')]=_[_0xff6b('0x37')](_0x23bbc2[_0xff6b('0x38')],qs[_0xff6b('0x3a')](_0x1f4f65[_0xff6b('0x34')]['fields']));_0x4d9a1c['attributes']=_0x4d9a1c['attributes'][_0xff6b('0x49')]?_0x4d9a1c[_0xff6b('0x39')]:_0x23bbc2[_0xff6b('0x38')];_0x4d9a1c[_0xff6b('0x3c')]=qs['sort'](_0x1f4f65[_0xff6b('0x34')][_0xff6b('0x3d')]);_0x4d9a1c[_0xff6b('0x3e')]=qs['filters'](_[_0xff6b('0x3f')](_0x1f4f65['query'],_0x23bbc2[_0xff6b('0x36')]));if(_0x1f4f65[_0xff6b('0x34')][_0xff6b('0x40')]){_0x4d9a1c[_0xff6b('0x3e')]=_[_0xff6b('0x41')](_0x4d9a1c[_0xff6b('0x3e')],{'$or':_[_0xff6b('0x2e')](_0x4d9a1c[_0xff6b('0x39')],function(_0xdba0a9){var _0x996089={};_0x996089[_0xdba0a9]={'$like':'%'+_0x1f4f65[_0xff6b('0x34')][_0xff6b('0x40')]+'%'};return _0x996089;})});}_0x4d9a1c=_[_0xff6b('0x41')]({},_0x4d9a1c,_0x1f4f65[_0xff6b('0x43')]);return _0x372ea0['getConfigurations'](_0x4d9a1c);}})['then'](function(_0x3d60d6){if(_0x3d60d6){_0x2314c8=_0x3d60d6[_0xff6b('0x49')];if(!_0x1f4f65[_0xff6b('0x34')][_0xff6b('0x3b')]('nolimit')){_0x4d9a1c[_0xff6b('0x21')]=qs[_0xff6b('0x21')](_0x1f4f65['query'][_0xff6b('0x21')]);_0x4d9a1c[_0xff6b('0x1f')]=qs[_0xff6b('0x1f')](_0x1f4f65[_0xff6b('0x34')][_0xff6b('0x1f')]);}return _0x372ea0[_0xff6b('0x4d')](_0x4d9a1c);}})['then'](function(_0xfc007c){if(_0xfc007c){return _0xfc007c?{'count':_0x2314c8,'rows':_0xfc007c}:null;}})['then'](respondWithResult(_0x5e25be,null))[_0xff6b('0x47')](handleError(_0x5e25be,null));};exports[_0xff6b('0x50')]=function(_0x354386,_0x1b8c6e,_0x2adbf9){if(_0x354386[_0xff6b('0x4c')]['id']){delete _0x354386[_0xff6b('0x4c')]['id'];}return db['VtigerAccount'][_0xff6b('0x4e')]({'where':{'id':_0x354386['params']['id']}})[_0xff6b('0x28')](handleEntityNotFound(_0x1b8c6e,null))[_0xff6b('0x28')](function(_0x48c0d9){if(_0x48c0d9){_0x354386['body'][_0xff6b('0x51')]=_0x48c0d9['id'];_0x354386['body'][_0xff6b('0x52')]=integrations['getSubjects'](_0x354386[_0xff6b('0x4c')][_0xff6b('0x53')],_0x354386[_0xff6b('0x4c')][_0xff6b('0x32')]);_0x354386[_0xff6b('0x4c')][_0xff6b('0x54')]=integrations[_0xff6b('0x55')](_0x354386[_0xff6b('0x4c')][_0xff6b('0x53')],_0x354386[_0xff6b('0x4c')]['type']);return db[_0xff6b('0x4f')][_0xff6b('0x4b')](_0x354386[_0xff6b('0x4c')],{'include':[{'model':db[_0xff6b('0x56')],'as':_0xff6b('0x52')},{'model':db[_0xff6b('0x56')],'as':_0xff6b('0x54')}]});}return null;})['then'](respondWithResult(_0x1b8c6e,null))[_0xff6b('0x47')](handleError(_0x1b8c6e,null));};var md5=require(_0xff6b('0x57'));exports[_0xff6b('0x58')]=function(_0x4b0153,_0x5f3202,_0x3c3a75){var _0x232e8a=null;var _0x3c17b3=null;var _0x32ac7c=null;var _0x42edff=null;var _0x5686a9='';return db['VtigerAccount'][_0xff6b('0x4e')]({'where':{'id':_0x4b0153['params']['id']},'attributes':['id',_0xff6b('0x2c'),_0xff6b('0x59'),_0xff6b('0x5a'),_0xff6b('0x5b'),_0xff6b('0x5c'),_0xff6b('0x5d'),'accessKey']})['then'](handleEntityNotFound(_0x5f3202,null))[_0xff6b('0x28')](function(_0x4084b5){if(_0x4084b5){_0x232e8a=_0x4084b5['username'];_0x3c17b3=_0x4084b5[_0xff6b('0x5e')];_0x32ac7c=_0x4084b5[_0xff6b('0x5b')];_0x5686a9=_0x4084b5[_0xff6b('0x5c')];var _0x5e88dd=_0x5686a9['slice'](-0x1);if(_0x5e88dd==='/'){_0x5686a9=_0x5686a9['substring'](0x0,_0x5686a9[_0xff6b('0x5f')](_0x5e88dd));}_0x42edff=util['format'](_0xff6b('0x60'),_0x5686a9);var _0x230691={'method':_0xff6b('0x61'),'uri':_0x42edff,'qs':{'operation':_0xff6b('0x62'),'username':_0x4084b5[_0xff6b('0x59')]},'json':!![]};return rp(_0x230691);}})[_0xff6b('0x28')](function(_0x4604ff){if(_0x4604ff['success']){var _0x8e1d45={'method':_0xff6b('0x63'),'uri':_0x42edff,'form':{'operation':_0xff6b('0x64'),'username':_0x232e8a,'accessKey':md5(_0x4604ff[_0xff6b('0x65')][_0xff6b('0x66')]+_0x3c17b3)},'json':!![]};return rp(_0x8e1d45);}})['then'](function(_0x3f8e9d){if(_0x3f8e9d[_0xff6b('0x67')]){var _0x393288={'method':'GET','uri':_0x42edff,'qs':{'operation':'describe','username':_0x232e8a,'sessionName':_0x3f8e9d[_0xff6b('0x65')][_0xff6b('0x68')],'elementType':_0x32ac7c},'json':!![]};return rp(_0x393288);}})['then'](function(_0x2178e8){if(_0x2178e8[_0xff6b('0x67')]){var _0x5a2f75=[_0xff6b('0x69'),_0xff6b('0x6a'),_0xff6b('0x6b')];_[_0xff6b('0x6c')](_0x2178e8['result']['fields'],function(_0x247138){return _0x5a2f75['includes'](_0x247138[_0xff6b('0x32')][_0xff6b('0x2c')]);});_['remove'](_0x2178e8[_0xff6b('0x65')][_0xff6b('0x3a')],function(_0x6a6f71){return _0x6a6f71['editable']===_0xff6b('0x6d');});return{'count':_0x2178e8[_0xff6b('0x65')][_0xff6b('0x3a')][_0xff6b('0x49')],'rows':_[_0xff6b('0x2e')](_0x2178e8[_0xff6b('0x65')][_0xff6b('0x3a')],function(_0x10f08e){return{'id':_0x10f08e[_0xff6b('0x2c')],'name':_0x10f08e[_0xff6b('0x6e')],'custom':_['startsWith'](_0x10f08e[_0xff6b('0x2c')],_0xff6b('0x6f'))?!![]:![],'options':_0x10f08e['type'][_0xff6b('0x2c')]==='picklist'&&_0x10f08e[_0xff6b('0x32')][_0xff6b('0x70')][_0xff6b('0x49')]>0x0?_[_0xff6b('0x2e')](_0x10f08e[_0xff6b('0x32')][_0xff6b('0x70')],function(_0x741019){return{'name':_0x741019[_0xff6b('0x6e')],'value':_0x741019[_0xff6b('0x71')]};}):[]};})};}})['then'](respondWithResult(_0x5f3202,null))[_0xff6b('0x47')](function(_0x7aedf0){console[_0xff6b('0x72')](_0xff6b('0x73')+_0x7aedf0);var _0x4e731c=_0x4b0153[_0xff6b('0x34')][_0xff6b('0x74')]?0x1f4:_0x7aedf0[_0xff6b('0x75')]||0x1f4;logger[_0xff6b('0x2a')](_0xff6b('0x76'),_0xff6b('0x58'),_0x4e731c,JSON[_0xff6b('0x77')](_0x7aedf0));delete _0x7aedf0[_0xff6b('0x2c')];if(_0x4e731c===0x191){_0x4e731c=0x190;}_0x5f3202[_0xff6b('0x1d')](_0x4e731c)[_0xff6b('0x2d')](_0x4b0153[_0xff6b('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x7aedf0[_0xff6b('0x75')]}:_0x7aedf0);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index cf84c9e..965092c 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 _0x3873=['request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','int_vtiger_accounts','lodash','util','../../config/logger','bluebird'];(function(_0x1970d5,_0x99fe4d){var _0x5bc97f=function(_0x4ae4f9){while(--_0x4ae4f9){_0x1970d5['push'](_0x1970d5['shift']());}};_0x5bc97f(++_0x99fe4d);}(_0x3873,0x188));var _0x3387=function(_0x2fba57,_0x266b67){_0x2fba57=_0x2fba57-0x0;var _0x54ffbf=_0x3873[_0x2fba57];return _0x54ffbf;};'use strict';var _=require(_0x3387('0x0'));var util=require(_0x3387('0x1'));var logger=require(_0x3387('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3387('0x3'));var rp=require(_0x3387('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3387('0x5'));var config=require(_0x3387('0x6'));var attributes=require(_0x3387('0x7'));var integrations=require(_0x3387('0x8'));module['exports']=function(_0x17a338,_0x2529ed){return _0x17a338[_0x3387('0x9')]('VtigerAccount',attributes,{'tableName':_0x3387('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95fa=['define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','moment','request-promise','rimraf','./intVtigerAccount.attributes','exports'];(function(_0x1ed943,_0x3838f7){var _0x380136=function(_0x505f4d){while(--_0x505f4d){_0x1ed943['push'](_0x1ed943['shift']());}};_0x380136(++_0x3838f7);}(_0x95fa,0xc9));var _0xa95f=function(_0x447bd2,_0x2875b3){_0x447bd2=_0x447bd2-0x0;var _0x2f9765=_0x95fa[_0x447bd2];return _0x2f9765;};'use strict';var _=require(_0xa95f('0x0'));var util=require(_0xa95f('0x1'));var logger=require(_0xa95f('0x2'))('api');var moment=require(_0xa95f('0x3'));var BPromise=require('bluebird');var rp=require(_0xa95f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa95f('0x5'));var config=require('../../config/environment');var attributes=require(_0xa95f('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xa95f('0x7')]=function(_0x2ac85c,_0x2480c6){return _0x2ac85c[_0xa95f('0x8')](_0xa95f('0x9'),attributes,{'tableName':_0xa95f('0xa'),'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 10a1b34..2c26054 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 _0xb9a7=['then','debug','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','catch','ShowVtigerAccount','where'];(function(_0x150e86,_0x50bc36){var _0x4a6495=function(_0x404855){while(--_0x404855){_0x150e86['push'](_0x150e86['shift']());}};_0x4a6495(++_0x50bc36);}(_0xb9a7,0x112));var _0x7b9a=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xb9a7[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b9a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b9a('0x2'));var logger=require(_0x7b9a('0x3'))(_0x7b9a('0x4'));var config=require(_0x7b9a('0x5'));var jayson=require(_0x7b9a('0x6'));var client=jayson[_0x7b9a('0x7')][_0x7b9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7019fd,_0x37ce81,_0x3e51f0){return new BPromise(function(_0x4d3f20,_0x43d8e2){return client[_0x7b9a('0x9')](_0x7019fd,_0x3e51f0)['then'](function(_0x511e28){logger['info'](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));logger['debug'](_0x7b9a('0xc'),_0x37ce81,'request\x20sent',JSON[_0x7b9a('0xd')](_0x511e28));if(_0x511e28['error']){if(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0xf')]===0x1f4){logger[_0x7b9a('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x43d8e2(_0x511e28['error'][_0x7b9a('0x10')]);}logger[_0x7b9a('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x37ce81,_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);return _0x4d3f20(_0x511e28[_0x7b9a('0xe')][_0x7b9a('0x10')]);}else{logger[_0x7b9a('0x11')](_0x7b9a('0xa'),_0x37ce81,_0x7b9a('0xb'));_0x4d3f20(_0x511e28[_0x7b9a('0x12')][_0x7b9a('0x10')]);}})['catch'](function(_0x34a82d){logger['error'](_0x7b9a('0xa'),_0x37ce81,_0x34a82d);_0x43d8e2(_0x34a82d);});});}exports[_0x7b9a('0x13')]=function(_0x271263){var _0x169d16=this;return new Promise(function(_0x44a232,_0x180a67){return db[_0x7b9a('0x14')][_0x7b9a('0x15')]({'raw':_0x271263[_0x7b9a('0x16')]?_0x271263[_0x7b9a('0x16')][_0x7b9a('0x17')]===undefined?!![]:![]:!![],'where':_0x271263[_0x7b9a('0x16')]?_0x271263[_0x7b9a('0x16')]['where']||null:null,'attributes':_0x271263[_0x7b9a('0x16')]?_0x271263['options'][_0x7b9a('0x18')]||null:null,'limit':_0x271263['options']?_0x271263[_0x7b9a('0x16')][_0x7b9a('0x19')]||null:null,'include':_0x271263[_0x7b9a('0x16')]?_0x271263['options'][_0x7b9a('0x1a')]?_[_0x7b9a('0x1b')](_0x271263['options'][_0x7b9a('0x1a')],function(_0x374dca){return{'model':db[_0x374dca[_0x7b9a('0x1c')]],'as':_0x374dca['as'],'attributes':_0x374dca[_0x7b9a('0x18')],'include':_0x374dca[_0x7b9a('0x1a')]?_['map'](_0x374dca[_0x7b9a('0x1a')],function(_0x23219e){return{'model':db[_0x23219e['model']],'as':_0x23219e['as'],'attributes':_0x23219e[_0x7b9a('0x18')],'include':_0x23219e['include']?_[_0x7b9a('0x1b')](_0x23219e[_0x7b9a('0x1a')],function(_0x4c2271){return{'model':db[_0x4c2271['model']],'as':_0x4c2271['as'],'attributes':_0x4c2271[_0x7b9a('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54df8a){logger[_0x7b9a('0x11')]('GetVtigerAccount',_0x271263);logger['debug'](_0x7b9a('0x13'),_0x271263,JSON['stringify'](_0x54df8a));_0x44a232(_0x54df8a);})[_0x7b9a('0x1d')](function(_0x314b6d){logger['error'](_0x7b9a('0x13'),_0x314b6d[_0x7b9a('0x10')],_0x271263);_0x180a67(_0x169d16[_0x7b9a('0xe')](0x1f4,_0x314b6d['message']));});});};exports[_0x7b9a('0x1e')]=function(_0x2ce78b){var _0x181e9c=this;return new Promise(function(_0x6c8b1f,_0x5028e7){return db[_0x7b9a('0x14')]['find']({'raw':_0x2ce78b['options']?_0x2ce78b[_0x7b9a('0x16')][_0x7b9a('0x17')]===undefined?!![]:![]:!![],'where':_0x2ce78b[_0x7b9a('0x16')]?_0x2ce78b['options'][_0x7b9a('0x1f')]||null:null,'attributes':_0x2ce78b[_0x7b9a('0x16')]?_0x2ce78b['options']['attributes']||null:null,'include':_0x2ce78b[_0x7b9a('0x16')]?_0x2ce78b[_0x7b9a('0x16')]['include']?_[_0x7b9a('0x1b')](_0x2ce78b[_0x7b9a('0x16')][_0x7b9a('0x1a')],function(_0x18db2f){return{'model':db[_0x18db2f[_0x7b9a('0x1c')]],'as':_0x18db2f['as'],'attributes':_0x18db2f['attributes'],'include':_0x18db2f[_0x7b9a('0x1a')]?_[_0x7b9a('0x1b')](_0x18db2f[_0x7b9a('0x1a')],function(_0x7070dd){return{'model':db[_0x7070dd[_0x7b9a('0x1c')]],'as':_0x7070dd['as'],'attributes':_0x7070dd[_0x7b9a('0x18')],'include':_0x7070dd['include']?_['map'](_0x7070dd[_0x7b9a('0x1a')],function(_0x31d29e){return{'model':db[_0x31d29e['model']],'as':_0x31d29e['as'],'attributes':_0x31d29e[_0x7b9a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7b9a('0x20')](function(_0xf58dca){logger['info'](_0x7b9a('0x1e'),_0x2ce78b);logger[_0x7b9a('0x21')]('ShowVtigerAccount',_0x2ce78b,JSON['stringify'](_0xf58dca));_0x6c8b1f(_0xf58dca);})[_0x7b9a('0x1d')](function(_0x130c04){logger[_0x7b9a('0xe')](_0x7b9a('0x1e'),_0x130c04[_0x7b9a('0x10')],_0x2ce78b);_0x5028e7(_0x181e9c[_0x7b9a('0xe')](0x1f4,_0x130c04[_0x7b9a('0x10')]));});});}; \ No newline at end of file +var _0xf7b4=['request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','GetVtigerAccount','find','ShowVtigerAccount','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1131d6,_0x1303b1){var _0x3d6b22=function(_0x3885ad){while(--_0x3885ad){_0x1131d6['push'](_0x1131d6['shift']());}};_0x3d6b22(++_0x1303b1);}(_0xf7b4,0x152));var _0x4f7b=function(_0x2ee58f,_0x3ca606){_0x2ee58f=_0x2ee58f-0x0;var _0x5c235f=_0xf7b4[_0x2ee58f];return _0x5c235f;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7b('0x1'));var rs=require(_0x4f7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f7b('0x3'));var logger=require(_0x4f7b('0x4'))(_0x4f7b('0x5'));var config=require(_0x4f7b('0x6'));var jayson=require(_0x4f7b('0x7'));var client=jayson[_0x4f7b('0x8')][_0x4f7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad135,_0x173784,_0x351036){return new BPromise(function(_0x36ea9c,_0x3ef6e1){return client[_0x4f7b('0xa')](_0x3ad135,_0x351036)['then'](function(_0x433563){logger[_0x4f7b('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x173784,_0x4f7b('0xc'));logger[_0x4f7b('0xd')](_0x4f7b('0xe'),_0x173784,_0x4f7b('0xc'),JSON[_0x4f7b('0xf')](_0x433563));if(_0x433563['error']){if(_0x433563[_0x4f7b('0x10')]['code']===0x1f4){logger['error'](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x3ef6e1(_0x433563[_0x4f7b('0x10')]['message']);}logger[_0x4f7b('0x10')](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x36ea9c(_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);}else{logger[_0x4f7b('0xb')](_0x4f7b('0x11'),_0x173784,_0x4f7b('0xc'));_0x36ea9c(_0x433563[_0x4f7b('0x13')][_0x4f7b('0x12')]);}})[_0x4f7b('0x14')](function(_0x50a161){logger[_0x4f7b('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x173784,_0x50a161);_0x3ef6e1(_0x50a161);});});}exports['GetVtigerAccount']=function(_0x24e5cf){var _0x3813da=this;return new Promise(function(_0x519d90,_0x2b34c9){return db[_0x4f7b('0x15')][_0x4f7b('0x16')]({'raw':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x24e5cf['options']?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'limit':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1b')]||null:null,'include':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x24e5cf[_0x4f7b('0x17')]['include'],function(_0x150f57){return{'model':db[_0x150f57[_0x4f7b('0x1e')]],'as':_0x150f57['as'],'attributes':_0x150f57['attributes'],'include':_0x150f57[_0x4f7b('0x1c')]?_['map'](_0x150f57[_0x4f7b('0x1c')],function(_0x2429be){return{'model':db[_0x2429be[_0x4f7b('0x1e')]],'as':_0x2429be['as'],'attributes':_0x2429be[_0x4f7b('0x1a')],'include':_0x2429be[_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x2429be[_0x4f7b('0x1c')],function(_0x3ad769){return{'model':db[_0x3ad769['model']],'as':_0x3ad769['as'],'attributes':_0x3ad769[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x311675){logger['info'](_0x4f7b('0x20'),_0x24e5cf);logger[_0x4f7b('0xd')](_0x4f7b('0x20'),_0x24e5cf,JSON[_0x4f7b('0xf')](_0x311675));_0x519d90(_0x311675);})[_0x4f7b('0x14')](function(_0x4ebffa){logger[_0x4f7b('0x10')](_0x4f7b('0x20'),_0x4ebffa[_0x4f7b('0x12')],_0x24e5cf);_0x2b34c9(_0x3813da['error'](0x1f4,_0x4ebffa[_0x4f7b('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x4e4828){var _0x1a2346=this;return new Promise(function(_0x52a5b1,_0x1aad4b){return db[_0x4f7b('0x15')][_0x4f7b('0x21')]({'raw':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'include':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')],function(_0x35f1ed){return{'model':db[_0x35f1ed[_0x4f7b('0x1e')]],'as':_0x35f1ed['as'],'attributes':_0x35f1ed[_0x4f7b('0x1a')],'include':_0x35f1ed[_0x4f7b('0x1c')]?_['map'](_0x35f1ed[_0x4f7b('0x1c')],function(_0x5127a2){return{'model':db[_0x5127a2[_0x4f7b('0x1e')]],'as':_0x5127a2['as'],'attributes':_0x5127a2[_0x4f7b('0x1a')],'include':_0x5127a2['include']?_[_0x4f7b('0x1d')](_0x5127a2[_0x4f7b('0x1c')],function(_0x1347b6){return{'model':db[_0x1347b6['model']],'as':_0x1347b6['as'],'attributes':_0x1347b6[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x446f6e){logger[_0x4f7b('0xb')](_0x4f7b('0x22'),_0x4e4828);logger[_0x4f7b('0xd')](_0x4f7b('0x22'),_0x4e4828,JSON['stringify'](_0x446f6e));_0x52a5b1(_0x446f6e);})[_0x4f7b('0x14')](function(_0x486187){logger[_0x4f7b('0x10')](_0x4f7b('0x22'),_0x486187[_0x4f7b('0x12')],_0x4e4828);_0x1aad4b(_0x1a2346['error'](0x1f4,_0x486187[_0x4f7b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index ab13248..c972bf7 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 _0x7678=['../../components/auth/service','./intVtigerConfiguration.controller','get','index','/:id','show','/:id/fields','getFields','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x7678,0xf6));var _0x8767=function(_0x43c86a,_0x41fb60){_0x43c86a=_0x43c86a-0x0;var _0xf69e5a=_0x7678[_0x43c86a];return _0xf69e5a;};'use strict';var multer=require(_0x8767('0x0'));var util=require(_0x8767('0x1'));var path=require(_0x8767('0x2'));var timeout=require(_0x8767('0x3'));var express=require(_0x8767('0x4'));var router=express[_0x8767('0x5')]();var fs_extra=require(_0x8767('0x6'));var auth=require(_0x8767('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8767('0x8'));router[_0x8767('0x9')]('/',auth['isAuthenticated'](),controller[_0x8767('0xa')]);router[_0x8767('0x9')](_0x8767('0xb'),auth['isAuthenticated'](),controller[_0x8767('0xc')]);router['get'](_0x8767('0xd'),auth['isAuthenticated'](),controller[_0x8767('0xe')]);router['get']('/:id/subjects',auth[_0x8767('0xf')](),controller[_0x8767('0x10')]);router['get'](_0x8767('0x11'),auth[_0x8767('0xf')](),controller[_0x8767('0x12')]);router[_0x8767('0x13')]('/',auth[_0x8767('0xf')](),controller['create']);router[_0x8767('0x14')](_0x8767('0xb'),auth[_0x8767('0xf')](),controller['update']);router[_0x8767('0x15')]('/:id',auth[_0x8767('0xf')](),controller[_0x8767('0x16')]);module['exports']=router; \ No newline at end of file +var _0x6381=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller'];(function(_0x34e0c5,_0x5b2fb2){var _0x5c10e3=function(_0x112c32){while(--_0x112c32){_0x34e0c5['push'](_0x34e0c5['shift']());}};_0x5c10e3(++_0x5b2fb2);}(_0x6381,0x122));var _0x1638=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6381[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x1638('0x0'));var path=require(_0x1638('0x1'));var timeout=require(_0x1638('0x2'));var express=require(_0x1638('0x3'));var router=express[_0x1638('0x4')]();var fs_extra=require(_0x1638('0x5'));var auth=require(_0x1638('0x6'));var interaction=require(_0x1638('0x7'));var config=require(_0x1638('0x8'));var controller=require(_0x1638('0x9'));router[_0x1638('0xa')]('/',auth[_0x1638('0xb')](),controller[_0x1638('0xc')]);router['get'](_0x1638('0xd'),auth[_0x1638('0xb')](),controller[_0x1638('0xe')]);router[_0x1638('0xa')](_0x1638('0xf'),auth[_0x1638('0xb')](),controller[_0x1638('0x10')]);router[_0x1638('0xa')](_0x1638('0x11'),auth[_0x1638('0xb')](),controller['getSubjects']);router[_0x1638('0xa')](_0x1638('0x12'),auth[_0x1638('0xb')](),controller[_0x1638('0x13')]);router['post']('/',auth[_0x1638('0xb')](),controller[_0x1638('0x14')]);router[_0x1638('0x15')](_0x1638('0xd'),auth[_0x1638('0xb')](),controller['update']);router[_0x1638('0x16')]('/:id',auth[_0x1638('0xb')](),controller[_0x1638('0x17')]);module[_0x1638('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 50019ce..4cfa64f 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 _0xbfaa=['STRING'];(function(_0x4b51d0,_0xaec587){var _0x269668=function(_0x406bee){while(--_0x406bee){_0x4b51d0['push'](_0x4b51d0['shift']());}};_0x269668(++_0xaec587);}(_0xbfaa,0x160));var _0xabfa=function(_0x327f66,_0x188d77){_0x327f66=_0x327f66-0x0;var _0x31f70a=_0xbfaa[_0x327f66];return _0x31f70a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xabfa('0x0')]},'description':{'type':Sequelize[_0xabfa('0x0')]}}; \ No newline at end of file +var _0x98a2=['STRING','sequelize','exports'];(function(_0x3e69e0,_0x2189b1){var _0x705b19=function(_0x3e8d00){while(--_0x3e8d00){_0x3e69e0['push'](_0x3e69e0['shift']());}};_0x705b19(++_0x2189b1);}(_0x98a2,0xb2));var _0x298a=function(_0x2dd7c5,_0xb656f9){_0x2dd7c5=_0x2dd7c5-0x0;var _0x152a45=_0x98a2[_0x2dd7c5];return _0x152a45;};'use strict';var Sequelize=require(_0x298a('0x0'));module[_0x298a('0x1')]={'name':{'type':Sequelize[_0x298a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index cc6081a..15659a1 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 _0x77de=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','rows','catch','show','params','find','create','body','destroy','findOne','getFields','getSubjects','VtigerField','options','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','squel','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','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','model'];(function(_0x34fa2f,_0x3e26d4){var _0x5e765f=function(_0x556aca){while(--_0x556aca){_0x34fa2f['push'](_0x34fa2f['shift']());}};_0x5e765f(++_0x3e26d4);}(_0x77de,0x1a6));var _0xe77d=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0x77de[_0x3239f5];return _0x3559c8;};'use strict';var emlformat=require(_0xe77d('0x0'));var rimraf=require(_0xe77d('0x1'));var zipdir=require(_0xe77d('0x2'));var jsonpatch=require(_0xe77d('0x3'));var rp=require(_0xe77d('0x4'));var moment=require(_0xe77d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe77d('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe77d('0x7'));var csv=require(_0xe77d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe77d('0x9'));var _=require(_0xe77d('0xa'));var squel=require(_0xe77d('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe77d('0xc'));var toCsv=require(_0xe77d('0x8'));var querystring=require(_0xe77d('0xd'));var Papa=require(_0xe77d('0xe'));var Redis=require(_0xe77d('0xf'));var authService=require(_0xe77d('0x10'));var qs=require(_0xe77d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe77d('0x12'));var logger=require(_0xe77d('0x13'))(_0xe77d('0x14'));var utils=require(_0xe77d('0x15'));var config=require(_0xe77d('0x16'));var licenseUtil=require(_0xe77d('0x17'));var db=require(_0xe77d('0x18'))['db'];function respondWithStatusCode(_0x2fefbb,_0x36c0a7){_0x36c0a7=_0x36c0a7||0xcc;return function(_0x49e966){if(_0x49e966){return _0x2fefbb[_0xe77d('0x19')](_0x36c0a7);}return _0x2fefbb['status'](_0x36c0a7)['end']();};}function respondWithResult(_0x4535c6,_0x179f32){_0x179f32=_0x179f32||0xc8;return function(_0x4acc27){if(_0x4acc27){return _0x4535c6[_0xe77d('0x1a')](_0x179f32)[_0xe77d('0x1b')](_0x4acc27);}};}function respondWithFilteredResult(_0x3426b9,_0x239b78){return function(_0x6f6155){if(_0x6f6155){var _0x9bf1f8=typeof _0x239b78['offset']===_0xe77d('0x1c')&&typeof _0x239b78[_0xe77d('0x1d')]===_0xe77d('0x1c');var _0x334c82=_0x6f6155[_0xe77d('0x1e')];var _0x1bd619=_0x9bf1f8?0x0:_0x239b78[_0xe77d('0x1f')];var _0x3dd9a7=_0x9bf1f8?_0x6f6155[_0xe77d('0x1e')]:_0x239b78[_0xe77d('0x1f')]+_0x239b78[_0xe77d('0x1d')];var _0x1c2d71;if(_0x3dd9a7>=_0x334c82){_0x3dd9a7=_0x334c82;_0x1c2d71=0xc8;}else{_0x1c2d71=0xce;}_0x3426b9[_0xe77d('0x1a')](_0x1c2d71);return _0x3426b9['set'](_0xe77d('0x20'),_0x1bd619+'-'+_0x3dd9a7+'/'+_0x334c82)[_0xe77d('0x1b')](_0x6f6155);}return null;};}function patchUpdates(_0x2951b6){return function(_0x4d5ec7){try{jsonpatch['apply'](_0x4d5ec7,_0x2951b6,!![]);}catch(_0x19bd4c){return BPromise[_0xe77d('0x21')](_0x19bd4c);}return _0x4d5ec7[_0xe77d('0x22')]();};}function saveUpdates(_0x406b9e,_0xf33678){return function(_0x1e74eb){if(_0x1e74eb){return _0x1e74eb[_0xe77d('0x23')](_0x406b9e)[_0xe77d('0x24')](function(_0x2e8c35){return _0x2e8c35;});}return null;};}function removeEntity(_0x797a3e,_0x292666){return function(_0xd2148f){if(_0xd2148f){return _0xd2148f['destroy']()['then'](function(){_0x797a3e[_0xe77d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4655b6,_0x2e2235){return function(_0x57ad47){if(!_0x57ad47){_0x4655b6[_0xe77d('0x19')](0x194);}return _0x57ad47;};}function handleError(_0xc51c66,_0x862c28){_0x862c28=_0x862c28||0x1f4;return function(_0x1ca4d2){logger[_0xe77d('0x25')](_0x1ca4d2[_0xe77d('0x26')]);if(_0x1ca4d2[_0xe77d('0x27')]){delete _0x1ca4d2[_0xe77d('0x27')];}_0xc51c66[_0xe77d('0x1a')](_0x862c28)['send'](_0x1ca4d2);};}exports[_0xe77d('0x28')]=function(_0x2c49be,_0x2ea13a){var _0x2cf809={},_0x290f6b={},_0x2ee991={'count':0x0,'rows':[]};var _0x5041cc=_[_0xe77d('0x29')](db[_0xe77d('0x2a')][_0xe77d('0x2b')],function(_0x3766ff){return{'name':_0x3766ff[_0xe77d('0x2c')],'type':_0x3766ff['type']['key']};});_0x290f6b[_0xe77d('0x2d')]=_[_0xe77d('0x29')](_0x5041cc,_0xe77d('0x27'));_0x290f6b[_0xe77d('0x2e')]=_[_0xe77d('0x2f')](_0x2c49be[_0xe77d('0x2e')]);_0x290f6b['filters']=_[_0xe77d('0x30')](_0x290f6b[_0xe77d('0x2d')],_0x290f6b[_0xe77d('0x2e')]);_0x2cf809[_0xe77d('0x31')]=_[_0xe77d('0x30')](_0x290f6b[_0xe77d('0x2d')],qs['fields'](_0x2c49be[_0xe77d('0x2e')][_0xe77d('0x32')]));_0x2cf809[_0xe77d('0x31')]=_0x2cf809[_0xe77d('0x31')][_0xe77d('0x33')]?_0x2cf809[_0xe77d('0x31')]:_0x290f6b['model'];if(!_0x2c49be['query'][_0xe77d('0x34')](_0xe77d('0x35'))){_0x2cf809['limit']=qs[_0xe77d('0x1d')](_0x2c49be[_0xe77d('0x2e')][_0xe77d('0x1d')]);_0x2cf809['offset']=qs[_0xe77d('0x1f')](_0x2c49be[_0xe77d('0x2e')][_0xe77d('0x1f')]);}_0x2cf809[_0xe77d('0x36')]=qs['sort'](_0x2c49be[_0xe77d('0x2e')][_0xe77d('0x37')]);_0x2cf809[_0xe77d('0x38')]=qs[_0xe77d('0x39')](_[_0xe77d('0x3a')](_0x2c49be[_0xe77d('0x2e')],_0x290f6b[_0xe77d('0x39')]),_0x5041cc);if(_0x2c49be[_0xe77d('0x2e')][_0xe77d('0x3b')]){_0x2cf809[_0xe77d('0x38')]=_['merge'](_0x2cf809[_0xe77d('0x38')],{'$or':_[_0xe77d('0x29')](_0x5041cc,function(_0x108276){if(_0x108276[_0xe77d('0x3c')]!==_0xe77d('0x3d')){var _0x26f126={};_0x26f126[_0x108276[_0xe77d('0x27')]]={'$like':'%'+_0x2c49be[_0xe77d('0x2e')][_0xe77d('0x3b')]+'%'};return _0x26f126;}})});}_0x2cf809=_[_0xe77d('0x3e')]({},_0x2cf809,_0x2c49be['options']);var _0x158454={'where':_0x2cf809['where']};return db[_0xe77d('0x2a')][_0xe77d('0x1e')](_0x158454)[_0xe77d('0x24')](function(_0x29de36){_0x2ee991[_0xe77d('0x1e')]=_0x29de36;if(_0x2c49be[_0xe77d('0x2e')][_0xe77d('0x3f')]){_0x2cf809['include']=[{'all':!![]}];}return db[_0xe77d('0x2a')]['findAll'](_0x2cf809);})[_0xe77d('0x24')](function(_0x1c84d1){_0x2ee991[_0xe77d('0x40')]=_0x1c84d1;return _0x2ee991;})[_0xe77d('0x24')](respondWithFilteredResult(_0x2ea13a,_0x2cf809))[_0xe77d('0x41')](handleError(_0x2ea13a,null));};exports[_0xe77d('0x42')]=function(_0x8c03f2,_0x309a4c){var _0x1a078a={'raw':![],'where':{'id':_0x8c03f2[_0xe77d('0x43')]['id']}},_0x28939f={};_0x28939f[_0xe77d('0x2d')]=_['keys'](db[_0xe77d('0x2a')][_0xe77d('0x2b')]);_0x28939f['query']=_[_0xe77d('0x2f')](_0x8c03f2[_0xe77d('0x2e')]);_0x28939f['filters']=_[_0xe77d('0x30')](_0x28939f[_0xe77d('0x2d')],_0x28939f[_0xe77d('0x2e')]);_0x1a078a[_0xe77d('0x31')]=_[_0xe77d('0x30')](_0x28939f['model'],qs['fields'](_0x8c03f2[_0xe77d('0x2e')]['fields']));_0x1a078a['attributes']=_0x1a078a['attributes'][_0xe77d('0x33')]?_0x1a078a[_0xe77d('0x31')]:_0x28939f[_0xe77d('0x2d')];if(_0x8c03f2[_0xe77d('0x2e')][_0xe77d('0x3f')]){_0x1a078a['include']=[{'all':!![]}];}_0x1a078a=_[_0xe77d('0x3e')]({},_0x1a078a,_0x8c03f2['options']);return db[_0xe77d('0x2a')][_0xe77d('0x44')](_0x1a078a)[_0xe77d('0x24')](handleEntityNotFound(_0x309a4c,null))[_0xe77d('0x24')](respondWithResult(_0x309a4c,null))['catch'](handleError(_0x309a4c,null));};exports[_0xe77d('0x45')]=function(_0x1e9eb5,_0x5f2d5a){return db[_0xe77d('0x2a')]['create'](_0x1e9eb5['body'],{})[_0xe77d('0x24')](respondWithResult(_0x5f2d5a,0xc9))[_0xe77d('0x41')](handleError(_0x5f2d5a,null));};exports['update']=function(_0x54e127,_0x3e7173){if(_0x54e127['body']['id']){delete _0x54e127[_0xe77d('0x46')]['id'];}return db[_0xe77d('0x2a')][_0xe77d('0x44')]({'where':{'id':_0x54e127[_0xe77d('0x43')]['id']}})[_0xe77d('0x24')](handleEntityNotFound(_0x3e7173,null))[_0xe77d('0x24')](saveUpdates(_0x54e127[_0xe77d('0x46')],null))['then'](respondWithResult(_0x3e7173,null))['catch'](handleError(_0x3e7173,null));};exports[_0xe77d('0x47')]=function(_0x3ae27a,_0x541aae){return db['VtigerConfiguration'][_0xe77d('0x44')]({'where':{'id':_0x3ae27a[_0xe77d('0x43')]['id']}})['then'](handleEntityNotFound(_0x541aae,null))[_0xe77d('0x24')](removeEntity(_0x541aae,null))[_0xe77d('0x41')](handleError(_0x541aae,null));};exports['getFields']=function(_0x120258,_0x56b583,_0x2df52a){var _0x35d5ef={};var _0x5cd398={};var _0x592b56;var _0x8af2d1;return db[_0xe77d('0x2a')][_0xe77d('0x48')]({'where':{'id':_0x120258[_0xe77d('0x43')]['id']}})[_0xe77d('0x24')](handleEntityNotFound(_0x56b583,null))[_0xe77d('0x24')](function(_0x1eaaf0){if(_0x1eaaf0){_0x592b56=_0x1eaaf0;_0x5cd398[_0xe77d('0x2d')]=_[_0xe77d('0x2f')](db['VtigerField'][_0xe77d('0x2b')]);_0x5cd398[_0xe77d('0x2e')]=_[_0xe77d('0x2f')](_0x120258[_0xe77d('0x2e')]);_0x5cd398[_0xe77d('0x39')]=_['intersection'](_0x5cd398[_0xe77d('0x2d')],_0x5cd398[_0xe77d('0x2e')]);_0x35d5ef['attributes']=_['intersection'](_0x5cd398[_0xe77d('0x2d')],qs[_0xe77d('0x32')](_0x120258[_0xe77d('0x2e')][_0xe77d('0x32')]));_0x35d5ef[_0xe77d('0x31')]=_0x35d5ef[_0xe77d('0x31')][_0xe77d('0x33')]?_0x35d5ef[_0xe77d('0x31')]:_0x5cd398[_0xe77d('0x2d')];_0x35d5ef[_0xe77d('0x36')]=qs[_0xe77d('0x37')](_0x120258[_0xe77d('0x2e')][_0xe77d('0x37')]);_0x35d5ef[_0xe77d('0x38')]=qs[_0xe77d('0x39')](_[_0xe77d('0x3a')](_0x120258[_0xe77d('0x2e')],_0x5cd398[_0xe77d('0x39')]));if(_0x120258[_0xe77d('0x2e')][_0xe77d('0x3b')]){_0x35d5ef['where']=_[_0xe77d('0x3e')](_0x35d5ef[_0xe77d('0x38')],{'$or':_[_0xe77d('0x29')](_0x35d5ef[_0xe77d('0x31')],function(_0x303f03){var _0x1d042f={};_0x1d042f[_0x303f03]={'$like':'%'+_0x120258[_0xe77d('0x2e')][_0xe77d('0x3b')]+'%'};return _0x1d042f;})});}_0x35d5ef=_[_0xe77d('0x3e')]({},_0x35d5ef,_0x120258['options']);return _0x592b56[_0xe77d('0x49')](_0x35d5ef);}})[_0xe77d('0x24')](function(_0x597370){if(_0x597370){_0x8af2d1=_0x597370[_0xe77d('0x33')];if(!_0x120258['query'][_0xe77d('0x34')](_0xe77d('0x35'))){_0x35d5ef[_0xe77d('0x1d')]=qs[_0xe77d('0x1d')](_0x120258[_0xe77d('0x2e')][_0xe77d('0x1d')]);_0x35d5ef[_0xe77d('0x1f')]=qs[_0xe77d('0x1f')](_0x120258[_0xe77d('0x2e')][_0xe77d('0x1f')]);}return _0x592b56[_0xe77d('0x49')](_0x35d5ef);}})[_0xe77d('0x24')](function(_0x37333b){if(_0x37333b){return _0x37333b?{'count':_0x8af2d1,'rows':_0x37333b}:null;}})[_0xe77d('0x24')](respondWithResult(_0x56b583,null))[_0xe77d('0x41')](handleError(_0x56b583,null));};exports[_0xe77d('0x4a')]=function(_0x1b9479,_0x47d6d5,_0x3fdd61){var _0x16dfdd={};var _0x466eb6={};var _0x442d89;var _0x158e91;return db[_0xe77d('0x2a')]['findOne']({'where':{'id':_0x1b9479[_0xe77d('0x43')]['id']}})[_0xe77d('0x24')](handleEntityNotFound(_0x47d6d5,null))[_0xe77d('0x24')](function(_0x5d6d3b){if(_0x5d6d3b){_0x442d89=_0x5d6d3b;_0x466eb6[_0xe77d('0x2d')]=_[_0xe77d('0x2f')](db[_0xe77d('0x4b')][_0xe77d('0x2b')]);_0x466eb6[_0xe77d('0x2e')]=_[_0xe77d('0x2f')](_0x1b9479[_0xe77d('0x2e')]);_0x466eb6[_0xe77d('0x39')]=_[_0xe77d('0x30')](_0x466eb6['model'],_0x466eb6[_0xe77d('0x2e')]);_0x16dfdd[_0xe77d('0x31')]=_[_0xe77d('0x30')](_0x466eb6[_0xe77d('0x2d')],qs['fields'](_0x1b9479['query'][_0xe77d('0x32')]));_0x16dfdd[_0xe77d('0x31')]=_0x16dfdd[_0xe77d('0x31')][_0xe77d('0x33')]?_0x16dfdd[_0xe77d('0x31')]:_0x466eb6[_0xe77d('0x2d')];_0x16dfdd[_0xe77d('0x36')]=qs[_0xe77d('0x37')](_0x1b9479[_0xe77d('0x2e')]['sort']);_0x16dfdd['where']=qs[_0xe77d('0x39')](_[_0xe77d('0x3a')](_0x1b9479[_0xe77d('0x2e')],_0x466eb6[_0xe77d('0x39')]));if(_0x1b9479['query'][_0xe77d('0x3b')]){_0x16dfdd[_0xe77d('0x38')]=_[_0xe77d('0x3e')](_0x16dfdd['where'],{'$or':_[_0xe77d('0x29')](_0x16dfdd['attributes'],function(_0x1c327f){var _0x18b260={};_0x18b260[_0x1c327f]={'$like':'%'+_0x1b9479[_0xe77d('0x2e')][_0xe77d('0x3b')]+'%'};return _0x18b260;})});}_0x16dfdd=_[_0xe77d('0x3e')]({},_0x16dfdd,_0x1b9479[_0xe77d('0x4c')]);return _0x442d89['getSubjects'](_0x16dfdd);}})['then'](function(_0x484b2c){if(_0x484b2c){_0x158e91=_0x484b2c['length'];if(!_0x1b9479[_0xe77d('0x2e')][_0xe77d('0x34')](_0xe77d('0x35'))){_0x16dfdd[_0xe77d('0x1d')]=qs['limit'](_0x1b9479[_0xe77d('0x2e')][_0xe77d('0x1d')]);_0x16dfdd['offset']=qs['offset'](_0x1b9479[_0xe77d('0x2e')][_0xe77d('0x1f')]);}return _0x442d89[_0xe77d('0x4a')](_0x16dfdd);}})[_0xe77d('0x24')](function(_0x461096){if(_0x461096){return _0x461096?{'count':_0x158e91,'rows':_0x461096}:null;}})[_0xe77d('0x24')](respondWithResult(_0x47d6d5,null))[_0xe77d('0x41')](handleError(_0x47d6d5,null));};exports[_0xe77d('0x4d')]=function(_0x5802be,_0x223a0f,_0x2c5e81){var _0x3abcf0={};var _0x3faa41={};var _0x4689d1;var _0x47e766;return db['VtigerConfiguration'][_0xe77d('0x48')]({'where':{'id':_0x5802be['params']['id']}})[_0xe77d('0x24')](handleEntityNotFound(_0x223a0f,null))['then'](function(_0x4531c4){if(_0x4531c4){_0x4689d1=_0x4531c4;_0x3faa41[_0xe77d('0x2d')]=_[_0xe77d('0x2f')](db[_0xe77d('0x4b')][_0xe77d('0x2b')]);_0x3faa41[_0xe77d('0x2e')]=_['keys'](_0x5802be['query']);_0x3faa41['filters']=_[_0xe77d('0x30')](_0x3faa41['model'],_0x3faa41[_0xe77d('0x2e')]);_0x3abcf0[_0xe77d('0x31')]=_[_0xe77d('0x30')](_0x3faa41[_0xe77d('0x2d')],qs[_0xe77d('0x32')](_0x5802be[_0xe77d('0x2e')][_0xe77d('0x32')]));_0x3abcf0['attributes']=_0x3abcf0['attributes'][_0xe77d('0x33')]?_0x3abcf0[_0xe77d('0x31')]:_0x3faa41['model'];_0x3abcf0[_0xe77d('0x36')]=qs[_0xe77d('0x37')](_0x5802be['query'][_0xe77d('0x37')]);_0x3abcf0['where']=qs[_0xe77d('0x39')](_[_0xe77d('0x3a')](_0x5802be[_0xe77d('0x2e')],_0x3faa41[_0xe77d('0x39')]));if(_0x5802be[_0xe77d('0x2e')][_0xe77d('0x3b')]){_0x3abcf0[_0xe77d('0x38')]=_[_0xe77d('0x3e')](_0x3abcf0[_0xe77d('0x38')],{'$or':_[_0xe77d('0x29')](_0x3abcf0[_0xe77d('0x31')],function(_0x3839e8){var _0x2d2f17={};_0x2d2f17[_0x3839e8]={'$like':'%'+_0x5802be['query'][_0xe77d('0x3b')]+'%'};return _0x2d2f17;})});}_0x3abcf0=_['merge']({},_0x3abcf0,_0x5802be['options']);return _0x4689d1[_0xe77d('0x4d')](_0x3abcf0);}})[_0xe77d('0x24')](function(_0x1a70e6){if(_0x1a70e6){_0x47e766=_0x1a70e6[_0xe77d('0x33')];if(!_0x5802be[_0xe77d('0x2e')][_0xe77d('0x34')]('nolimit')){_0x3abcf0[_0xe77d('0x1d')]=qs[_0xe77d('0x1d')](_0x5802be[_0xe77d('0x2e')][_0xe77d('0x1d')]);_0x3abcf0[_0xe77d('0x1f')]=qs[_0xe77d('0x1f')](_0x5802be[_0xe77d('0x2e')][_0xe77d('0x1f')]);}return _0x4689d1[_0xe77d('0x4d')](_0x3abcf0);}})[_0xe77d('0x24')](function(_0x2784e7){if(_0x2784e7){return _0x2784e7?{'count':_0x47e766,'rows':_0x2784e7}:null;}})[_0xe77d('0x24')](respondWithResult(_0x223a0f,null))[_0xe77d('0x41')](handleError(_0x223a0f,null));}; \ No newline at end of file +var _0x8bdf=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VtigerConfiguration','includeAll','include','rows','show','rawAttributes','keys','filters','find','catch','create','body','update','params','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','then','destroy','stack','name','send','map','type','key','query','intersection'];(function(_0x57ee4f,_0x1e45cd){var _0x2724d2=function(_0x2f669d){while(--_0x2f669d){_0x57ee4f['push'](_0x57ee4f['shift']());}};_0x2724d2(++_0x1e45cd);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x8bdf[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require(_0xf8bd('0x0'));var rimraf=require(_0xf8bd('0x1'));var zipdir=require(_0xf8bd('0x2'));var jsonpatch=require(_0xf8bd('0x3'));var rp=require(_0xf8bd('0x4'));var moment=require('moment');var BPromise=require(_0xf8bd('0x5'));var Mustache=require(_0xf8bd('0x6'));var util=require(_0xf8bd('0x7'));var path=require(_0xf8bd('0x8'));var sox=require(_0xf8bd('0x9'));var csv=require(_0xf8bd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf8bd('0xb'));var crypto=require(_0xf8bd('0xc'));var jsforce=require(_0xf8bd('0xd'));var deskjs=require(_0xf8bd('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf8bd('0xf'));var Papa=require(_0xf8bd('0x10'));var Redis=require('ioredis');var authService=require(_0xf8bd('0x11'));var qs=require(_0xf8bd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf8bd('0x13'));var logger=require(_0xf8bd('0x14'))(_0xf8bd('0x15'));var utils=require(_0xf8bd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf8bd('0x17'));var db=require(_0xf8bd('0x18'))['db'];function respondWithStatusCode(_0x5ec9ad,_0x1a009e){_0x1a009e=_0x1a009e||0xcc;return function(_0x49e8c6){if(_0x49e8c6){return _0x5ec9ad[_0xf8bd('0x19')](_0x1a009e);}return _0x5ec9ad[_0xf8bd('0x1a')](_0x1a009e)[_0xf8bd('0x1b')]();};}function respondWithResult(_0x172c5e,_0x43d517){_0x43d517=_0x43d517||0xc8;return function(_0xa0ee74){if(_0xa0ee74){return _0x172c5e['status'](_0x43d517)['json'](_0xa0ee74);}};}function respondWithFilteredResult(_0x49478a,_0x13350a){return function(_0x33facf){if(_0x33facf){var _0x54dc30=typeof _0x13350a[_0xf8bd('0x1c')]===_0xf8bd('0x1d')&&typeof _0x13350a[_0xf8bd('0x1e')]===_0xf8bd('0x1d');var _0x54cf43=_0x33facf[_0xf8bd('0x1f')];var _0x3e69be=_0x54dc30?0x0:_0x13350a['offset'];var _0x2c006c=_0x54dc30?_0x33facf[_0xf8bd('0x1f')]:_0x13350a[_0xf8bd('0x1c')]+_0x13350a[_0xf8bd('0x1e')];var _0xf06524;if(_0x2c006c>=_0x54cf43){_0x2c006c=_0x54cf43;_0xf06524=0xc8;}else{_0xf06524=0xce;}_0x49478a[_0xf8bd('0x1a')](_0xf06524);return _0x49478a['set'](_0xf8bd('0x20'),_0x3e69be+'-'+_0x2c006c+'/'+_0x54cf43)[_0xf8bd('0x21')](_0x33facf);}return null;};}function patchUpdates(_0x5bd4fe){return function(_0x116946){try{jsonpatch['apply'](_0x116946,_0x5bd4fe,!![]);}catch(_0x30d533){return BPromise[_0xf8bd('0x22')](_0x30d533);}return _0x116946['save']();};}function saveUpdates(_0x469813,_0x45eb2d){return function(_0x4c575f){if(_0x4c575f){return _0x4c575f['update'](_0x469813)[_0xf8bd('0x23')](function(_0x4c6ff){return _0x4c6ff;});}return null;};}function removeEntity(_0x4edd5a,_0x280b5b){return function(_0x59d0b9){if(_0x59d0b9){return _0x59d0b9[_0xf8bd('0x24')]()[_0xf8bd('0x23')](function(){_0x4edd5a['status'](0xcc)[_0xf8bd('0x1b')]();});}};}function handleEntityNotFound(_0x4de830,_0x1dd9bd){return function(_0x5b85f5){if(!_0x5b85f5){_0x4de830[_0xf8bd('0x19')](0x194);}return _0x5b85f5;};}function handleError(_0x480bc8,_0x136bd2){_0x136bd2=_0x136bd2||0x1f4;return function(_0x4fe184){logger['error'](_0x4fe184[_0xf8bd('0x25')]);if(_0x4fe184['name']){delete _0x4fe184[_0xf8bd('0x26')];}_0x480bc8[_0xf8bd('0x1a')](_0x136bd2)[_0xf8bd('0x27')](_0x4fe184);};}exports['index']=function(_0x258d09,_0x3974ff){var _0xa3ff13={},_0x3aa54a={},_0x4fc088={'count':0x0,'rows':[]};var _0x4bff64=_[_0xf8bd('0x28')](db['VtigerConfiguration']['rawAttributes'],function(_0x5407f9){return{'name':_0x5407f9['fieldName'],'type':_0x5407f9[_0xf8bd('0x29')][_0xf8bd('0x2a')]};});_0x3aa54a['model']=_[_0xf8bd('0x28')](_0x4bff64,_0xf8bd('0x26'));_0x3aa54a['query']=_['keys'](_0x258d09[_0xf8bd('0x2b')]);_0x3aa54a['filters']=_[_0xf8bd('0x2c')](_0x3aa54a[_0xf8bd('0x2d')],_0x3aa54a[_0xf8bd('0x2b')]);_0xa3ff13[_0xf8bd('0x2e')]=_[_0xf8bd('0x2c')](_0x3aa54a[_0xf8bd('0x2d')],qs['fields'](_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x2f')]));_0xa3ff13['attributes']=_0xa3ff13['attributes'][_0xf8bd('0x30')]?_0xa3ff13[_0xf8bd('0x2e')]:_0x3aa54a['model'];if(!_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x31')](_0xf8bd('0x32'))){_0xa3ff13[_0xf8bd('0x1e')]=qs[_0xf8bd('0x1e')](_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x1e')]);_0xa3ff13['offset']=qs[_0xf8bd('0x1c')](_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x1c')]);}_0xa3ff13[_0xf8bd('0x33')]=qs[_0xf8bd('0x34')](_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x34')]);_0xa3ff13['where']=qs['filters'](_[_0xf8bd('0x35')](_0x258d09['query'],_0x3aa54a['filters']),_0x4bff64);if(_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x36')]){_0xa3ff13[_0xf8bd('0x37')]=_[_0xf8bd('0x38')](_0xa3ff13[_0xf8bd('0x37')],{'$or':_['map'](_0x4bff64,function(_0x477be8){if(_0x477be8[_0xf8bd('0x29')]!==_0xf8bd('0x39')){var _0x4e0e7e={};_0x4e0e7e[_0x477be8['name']]={'$like':'%'+_0x258d09[_0xf8bd('0x2b')]['filter']+'%'};return _0x4e0e7e;}})});}_0xa3ff13=_['merge']({},_0xa3ff13,_0x258d09[_0xf8bd('0x3a')]);var _0x4a53fb={'where':_0xa3ff13[_0xf8bd('0x37')]};return db[_0xf8bd('0x3b')][_0xf8bd('0x1f')](_0x4a53fb)[_0xf8bd('0x23')](function(_0x21ab29){_0x4fc088[_0xf8bd('0x1f')]=_0x21ab29;if(_0x258d09[_0xf8bd('0x2b')][_0xf8bd('0x3c')]){_0xa3ff13[_0xf8bd('0x3d')]=[{'all':!![]}];}return db[_0xf8bd('0x3b')]['findAll'](_0xa3ff13);})[_0xf8bd('0x23')](function(_0x2deecd){_0x4fc088[_0xf8bd('0x3e')]=_0x2deecd;return _0x4fc088;})[_0xf8bd('0x23')](respondWithFilteredResult(_0x3974ff,_0xa3ff13))['catch'](handleError(_0x3974ff,null));};exports[_0xf8bd('0x3f')]=function(_0x1f11f8,_0x46e7d4){var _0x282a35={'raw':![],'where':{'id':_0x1f11f8['params']['id']}},_0x504366={};_0x504366['model']=_['keys'](db['VtigerConfiguration'][_0xf8bd('0x40')]);_0x504366[_0xf8bd('0x2b')]=_[_0xf8bd('0x41')](_0x1f11f8[_0xf8bd('0x2b')]);_0x504366[_0xf8bd('0x42')]=_[_0xf8bd('0x2c')](_0x504366[_0xf8bd('0x2d')],_0x504366[_0xf8bd('0x2b')]);_0x282a35['attributes']=_[_0xf8bd('0x2c')](_0x504366[_0xf8bd('0x2d')],qs[_0xf8bd('0x2f')](_0x1f11f8[_0xf8bd('0x2b')][_0xf8bd('0x2f')]));_0x282a35[_0xf8bd('0x2e')]=_0x282a35[_0xf8bd('0x2e')][_0xf8bd('0x30')]?_0x282a35[_0xf8bd('0x2e')]:_0x504366['model'];if(_0x1f11f8[_0xf8bd('0x2b')][_0xf8bd('0x3c')]){_0x282a35[_0xf8bd('0x3d')]=[{'all':!![]}];}_0x282a35=_[_0xf8bd('0x38')]({},_0x282a35,_0x1f11f8[_0xf8bd('0x3a')]);return db[_0xf8bd('0x3b')][_0xf8bd('0x43')](_0x282a35)['then'](handleEntityNotFound(_0x46e7d4,null))[_0xf8bd('0x23')](respondWithResult(_0x46e7d4,null))[_0xf8bd('0x44')](handleError(_0x46e7d4,null));};exports[_0xf8bd('0x45')]=function(_0x57e228,_0x1d6912){return db['VtigerConfiguration'][_0xf8bd('0x45')](_0x57e228[_0xf8bd('0x46')],{})[_0xf8bd('0x23')](respondWithResult(_0x1d6912,0xc9))['catch'](handleError(_0x1d6912,null));};exports[_0xf8bd('0x47')]=function(_0x411023,_0x29b5a5){if(_0x411023[_0xf8bd('0x46')]['id']){delete _0x411023[_0xf8bd('0x46')]['id'];}return db[_0xf8bd('0x3b')][_0xf8bd('0x43')]({'where':{'id':_0x411023[_0xf8bd('0x48')]['id']}})[_0xf8bd('0x23')](handleEntityNotFound(_0x29b5a5,null))[_0xf8bd('0x23')](saveUpdates(_0x411023[_0xf8bd('0x46')],null))[_0xf8bd('0x23')](respondWithResult(_0x29b5a5,null))[_0xf8bd('0x44')](handleError(_0x29b5a5,null));};exports[_0xf8bd('0x24')]=function(_0x13dbe6,_0x2b0cb9){return db[_0xf8bd('0x3b')]['find']({'where':{'id':_0x13dbe6[_0xf8bd('0x48')]['id']}})[_0xf8bd('0x23')](handleEntityNotFound(_0x2b0cb9,null))[_0xf8bd('0x23')](removeEntity(_0x2b0cb9,null))[_0xf8bd('0x44')](handleError(_0x2b0cb9,null));};exports[_0xf8bd('0x49')]=function(_0x20d1c1,_0x283dfe,_0xcf4b86){var _0x2d88a8={};var _0x524299={};var _0x2ea54a;var _0x324d5b;return db[_0xf8bd('0x3b')][_0xf8bd('0x4a')]({'where':{'id':_0x20d1c1[_0xf8bd('0x48')]['id']}})['then'](handleEntityNotFound(_0x283dfe,null))[_0xf8bd('0x23')](function(_0x1d004d){if(_0x1d004d){_0x2ea54a=_0x1d004d;_0x524299[_0xf8bd('0x2d')]=_[_0xf8bd('0x41')](db[_0xf8bd('0x4b')]['rawAttributes']);_0x524299[_0xf8bd('0x2b')]=_[_0xf8bd('0x41')](_0x20d1c1[_0xf8bd('0x2b')]);_0x524299[_0xf8bd('0x42')]=_[_0xf8bd('0x2c')](_0x524299['model'],_0x524299[_0xf8bd('0x2b')]);_0x2d88a8['attributes']=_[_0xf8bd('0x2c')](_0x524299[_0xf8bd('0x2d')],qs['fields'](_0x20d1c1['query']['fields']));_0x2d88a8['attributes']=_0x2d88a8[_0xf8bd('0x2e')]['length']?_0x2d88a8[_0xf8bd('0x2e')]:_0x524299[_0xf8bd('0x2d')];_0x2d88a8[_0xf8bd('0x33')]=qs['sort'](_0x20d1c1[_0xf8bd('0x2b')][_0xf8bd('0x34')]);_0x2d88a8[_0xf8bd('0x37')]=qs[_0xf8bd('0x42')](_['pick'](_0x20d1c1['query'],_0x524299['filters']));if(_0x20d1c1[_0xf8bd('0x2b')][_0xf8bd('0x36')]){_0x2d88a8[_0xf8bd('0x37')]=_[_0xf8bd('0x38')](_0x2d88a8[_0xf8bd('0x37')],{'$or':_['map'](_0x2d88a8[_0xf8bd('0x2e')],function(_0x457f19){var _0x5427d1={};_0x5427d1[_0x457f19]={'$like':'%'+_0x20d1c1[_0xf8bd('0x2b')]['filter']+'%'};return _0x5427d1;})});}_0x2d88a8=_[_0xf8bd('0x38')]({},_0x2d88a8,_0x20d1c1[_0xf8bd('0x3a')]);return _0x2ea54a['getFields'](_0x2d88a8);}})[_0xf8bd('0x23')](function(_0x98993b){if(_0x98993b){_0x324d5b=_0x98993b[_0xf8bd('0x30')];if(!_0x20d1c1[_0xf8bd('0x2b')][_0xf8bd('0x31')]('nolimit')){_0x2d88a8[_0xf8bd('0x1e')]=qs[_0xf8bd('0x1e')](_0x20d1c1[_0xf8bd('0x2b')]['limit']);_0x2d88a8['offset']=qs['offset'](_0x20d1c1[_0xf8bd('0x2b')]['offset']);}return _0x2ea54a['getFields'](_0x2d88a8);}})[_0xf8bd('0x23')](function(_0x141994){if(_0x141994){return _0x141994?{'count':_0x324d5b,'rows':_0x141994}:null;}})[_0xf8bd('0x23')](respondWithResult(_0x283dfe,null))[_0xf8bd('0x44')](handleError(_0x283dfe,null));};exports[_0xf8bd('0x4c')]=function(_0x5fedee,_0x2d7b2d,_0x34f50c){var _0x4b9970={};var _0x16fa16={};var _0x1af941;var _0x1df41;return db[_0xf8bd('0x3b')]['findOne']({'where':{'id':_0x5fedee[_0xf8bd('0x48')]['id']}})[_0xf8bd('0x23')](handleEntityNotFound(_0x2d7b2d,null))[_0xf8bd('0x23')](function(_0x1fc2e6){if(_0x1fc2e6){_0x1af941=_0x1fc2e6;_0x16fa16[_0xf8bd('0x2d')]=_['keys'](db[_0xf8bd('0x4b')][_0xf8bd('0x40')]);_0x16fa16[_0xf8bd('0x2b')]=_[_0xf8bd('0x41')](_0x5fedee[_0xf8bd('0x2b')]);_0x16fa16[_0xf8bd('0x42')]=_[_0xf8bd('0x2c')](_0x16fa16[_0xf8bd('0x2d')],_0x16fa16[_0xf8bd('0x2b')]);_0x4b9970[_0xf8bd('0x2e')]=_[_0xf8bd('0x2c')](_0x16fa16[_0xf8bd('0x2d')],qs[_0xf8bd('0x2f')](_0x5fedee[_0xf8bd('0x2b')][_0xf8bd('0x2f')]));_0x4b9970['attributes']=_0x4b9970[_0xf8bd('0x2e')][_0xf8bd('0x30')]?_0x4b9970['attributes']:_0x16fa16[_0xf8bd('0x2d')];_0x4b9970[_0xf8bd('0x33')]=qs[_0xf8bd('0x34')](_0x5fedee[_0xf8bd('0x2b')]['sort']);_0x4b9970['where']=qs[_0xf8bd('0x42')](_[_0xf8bd('0x35')](_0x5fedee[_0xf8bd('0x2b')],_0x16fa16[_0xf8bd('0x42')]));if(_0x5fedee['query'][_0xf8bd('0x36')]){_0x4b9970[_0xf8bd('0x37')]=_['merge'](_0x4b9970[_0xf8bd('0x37')],{'$or':_[_0xf8bd('0x28')](_0x4b9970[_0xf8bd('0x2e')],function(_0x1d30a2){var _0x5e7e26={};_0x5e7e26[_0x1d30a2]={'$like':'%'+_0x5fedee[_0xf8bd('0x2b')][_0xf8bd('0x36')]+'%'};return _0x5e7e26;})});}_0x4b9970=_['merge']({},_0x4b9970,_0x5fedee[_0xf8bd('0x3a')]);return _0x1af941['getSubjects'](_0x4b9970);}})[_0xf8bd('0x23')](function(_0x1ed0b1){if(_0x1ed0b1){_0x1df41=_0x1ed0b1[_0xf8bd('0x30')];if(!_0x5fedee['query']['hasOwnProperty']('nolimit')){_0x4b9970['limit']=qs[_0xf8bd('0x1e')](_0x5fedee[_0xf8bd('0x2b')][_0xf8bd('0x1e')]);_0x4b9970['offset']=qs[_0xf8bd('0x1c')](_0x5fedee[_0xf8bd('0x2b')]['offset']);}return _0x1af941['getSubjects'](_0x4b9970);}})['then'](function(_0xda6b60){if(_0xda6b60){return _0xda6b60?{'count':_0x1df41,'rows':_0xda6b60}:null;}})['then'](respondWithResult(_0x2d7b2d,null))['catch'](handleError(_0x2d7b2d,null));};exports[_0xf8bd('0x4d')]=function(_0xb6c48f,_0xbbb2a5,_0x137fe5){var _0x58085e={};var _0x52c4db={};var _0x3bb231;var _0x43d143;return db[_0xf8bd('0x3b')][_0xf8bd('0x4a')]({'where':{'id':_0xb6c48f[_0xf8bd('0x48')]['id']}})[_0xf8bd('0x23')](handleEntityNotFound(_0xbbb2a5,null))[_0xf8bd('0x23')](function(_0x2b8f2d){if(_0x2b8f2d){_0x3bb231=_0x2b8f2d;_0x52c4db['model']=_[_0xf8bd('0x41')](db['VtigerField'][_0xf8bd('0x40')]);_0x52c4db[_0xf8bd('0x2b')]=_[_0xf8bd('0x41')](_0xb6c48f[_0xf8bd('0x2b')]);_0x52c4db['filters']=_[_0xf8bd('0x2c')](_0x52c4db[_0xf8bd('0x2d')],_0x52c4db[_0xf8bd('0x2b')]);_0x58085e[_0xf8bd('0x2e')]=_[_0xf8bd('0x2c')](_0x52c4db[_0xf8bd('0x2d')],qs['fields'](_0xb6c48f[_0xf8bd('0x2b')][_0xf8bd('0x2f')]));_0x58085e[_0xf8bd('0x2e')]=_0x58085e['attributes'][_0xf8bd('0x30')]?_0x58085e[_0xf8bd('0x2e')]:_0x52c4db['model'];_0x58085e[_0xf8bd('0x33')]=qs[_0xf8bd('0x34')](_0xb6c48f['query'][_0xf8bd('0x34')]);_0x58085e[_0xf8bd('0x37')]=qs[_0xf8bd('0x42')](_[_0xf8bd('0x35')](_0xb6c48f[_0xf8bd('0x2b')],_0x52c4db['filters']));if(_0xb6c48f['query'][_0xf8bd('0x36')]){_0x58085e[_0xf8bd('0x37')]=_['merge'](_0x58085e[_0xf8bd('0x37')],{'$or':_[_0xf8bd('0x28')](_0x58085e['attributes'],function(_0x3d2312){var _0x1b4598={};_0x1b4598[_0x3d2312]={'$like':'%'+_0xb6c48f['query'][_0xf8bd('0x36')]+'%'};return _0x1b4598;})});}_0x58085e=_[_0xf8bd('0x38')]({},_0x58085e,_0xb6c48f[_0xf8bd('0x3a')]);return _0x3bb231['getDescriptions'](_0x58085e);}})[_0xf8bd('0x23')](function(_0x4be5cb){if(_0x4be5cb){_0x43d143=_0x4be5cb['length'];if(!_0xb6c48f[_0xf8bd('0x2b')]['hasOwnProperty'](_0xf8bd('0x32'))){_0x58085e['limit']=qs['limit'](_0xb6c48f[_0xf8bd('0x2b')][_0xf8bd('0x1e')]);_0x58085e[_0xf8bd('0x1c')]=qs[_0xf8bd('0x1c')](_0xb6c48f[_0xf8bd('0x2b')][_0xf8bd('0x1c')]);}return _0x3bb231[_0xf8bd('0x4d')](_0x58085e);}})[_0xf8bd('0x23')](function(_0x5a2414){if(_0x5a2414){return _0x5a2414?{'count':_0x43d143,'rows':_0x5a2414}:null;}})[_0xf8bd('0x23')](respondWithResult(_0xbbb2a5,null))[_0xf8bd('0x44')](handleError(_0xbbb2a5,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 0261839..81a3b6e 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 _0x80d1=['api','moment','bluebird','path','exports','define','int_vtiger_configurations','lodash','util'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x80d1,0x19c));var _0x180d=function(_0x2629c6,_0x2cdccc){_0x2629c6=_0x2629c6-0x0;var _0x187f9a=_0x80d1[_0x2629c6];return _0x187f9a;};'use strict';var _=require(_0x180d('0x0'));var util=require(_0x180d('0x1'));var logger=require('../../config/logger')(_0x180d('0x2'));var moment=require(_0x180d('0x3'));var BPromise=require(_0x180d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x180d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x180d('0x6')]=function(_0x360342,_0x40f568){return _0x360342[_0x180d('0x7')]('VtigerConfiguration',attributes,{'tableName':_0x180d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6ff=['api','moment','path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash'];(function(_0x56a1af,_0x292ac7){var _0x48b496=function(_0x2b83c7){while(--_0x2b83c7){_0x56a1af['push'](_0x56a1af['shift']());}};_0x48b496(++_0x292ac7);}(_0xd6ff,0x1ca));var _0xfd6f=function(_0xde8111,_0x15702c){_0xde8111=_0xde8111-0x0;var _0x29af0b=_0xd6ff[_0xde8111];return _0x29af0b;};'use strict';var _=require(_0xfd6f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfd6f('0x1'));var moment=require(_0xfd6f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd6f('0x3'));var rimraf=require('rimraf');var config=require(_0xfd6f('0x4'));var attributes=require(_0xfd6f('0x5'));module[_0xfd6f('0x6')]=function(_0xf9c132,_0x1764be){return _0xf9c132[_0xfd6f('0x7')](_0xfd6f('0x8'),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 75a2e4d..cb22660 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 _0x92d0=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VtigerConfiguration,\x20%s,\x20%s'];(function(_0xffe582,_0x1cd45d){var _0x16445b=function(_0x40f0c4){while(--_0x40f0c4){_0xffe582['push'](_0xffe582['shift']());}};_0x16445b(++_0x1cd45d);}(_0x92d0,0x12c));var _0x092d=function(_0x52b0b2,_0xf6dbf9){_0x52b0b2=_0x52b0b2-0x0;var _0x322769=_0x92d0[_0x52b0b2];return _0x322769;};'use strict';var _=require(_0x092d('0x0'));var util=require(_0x092d('0x1'));var moment=require('moment');var BPromise=require(_0x092d('0x2'));var rs=require(_0x092d('0x3'));var fs=require('fs');var Redis=require(_0x092d('0x4'));var db=require(_0x092d('0x5'))['db'];var utils=require(_0x092d('0x6'));var logger=require(_0x092d('0x7'))(_0x092d('0x8'));var config=require(_0x092d('0x9'));var jayson=require(_0x092d('0xa'));var client=jayson[_0x092d('0xb')][_0x092d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57441b,_0x1f3cb5,_0x3ffa53){return new BPromise(function(_0x37d720,_0x48dfe8){return client['request'](_0x57441b,_0x3ffa53)[_0x092d('0xd')](function(_0x58b2f5){logger['info'](_0x092d('0xe'),_0x1f3cb5,'request\x20sent');logger[_0x092d('0xf')](_0x092d('0x10'),_0x1f3cb5,'request\x20sent',JSON[_0x092d('0x11')](_0x58b2f5));if(_0x58b2f5[_0x092d('0x12')]){if(_0x58b2f5['error']['code']===0x1f4){logger[_0x092d('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x1f3cb5,_0x58b2f5[_0x092d('0x12')][_0x092d('0x13')]);return _0x48dfe8(_0x58b2f5[_0x092d('0x12')][_0x092d('0x13')]);}logger['error'](_0x092d('0xe'),_0x1f3cb5,_0x58b2f5[_0x092d('0x12')][_0x092d('0x13')]);return _0x37d720(_0x58b2f5[_0x092d('0x12')][_0x092d('0x13')]);}else{logger['info'](_0x092d('0xe'),_0x1f3cb5,'request\x20sent');_0x37d720(_0x58b2f5[_0x092d('0x14')][_0x092d('0x13')]);}})['catch'](function(_0x4dc98e){logger[_0x092d('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x1f3cb5,_0x4dc98e);_0x48dfe8(_0x4dc98e);});});} \ No newline at end of file +var _0xa9fb=['result','catch','util','moment','bluebird','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0xa9fb,0xbd));var _0xba9f=function(_0x1a5de6,_0x35e934){_0x1a5de6=_0x1a5de6-0x0;var _0x1199f6=_0xa9fb[_0x1a5de6];return _0x1199f6;};'use strict';var _=require('lodash');var util=require(_0xba9f('0x0'));var moment=require(_0xba9f('0x1'));var BPromise=require(_0xba9f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba9f('0x3'))('rpc');var config=require(_0xba9f('0x4'));var jayson=require(_0xba9f('0x5'));var client=jayson['client'][_0xba9f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x398573,_0x441ec6,_0x43e4cd){return new BPromise(function(_0x55668e,_0x2d9d59){return client[_0xba9f('0x7')](_0x398573,_0x43e4cd)['then'](function(_0x5cc5eb){logger[_0xba9f('0x8')]('VtigerConfiguration,\x20%s,\x20%s',_0x441ec6,_0xba9f('0x9'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x441ec6,_0xba9f('0x9'),JSON[_0xba9f('0xa')](_0x5cc5eb));if(_0x5cc5eb[_0xba9f('0xb')]){if(_0x5cc5eb[_0xba9f('0xb')][_0xba9f('0xc')]===0x1f4){logger[_0xba9f('0xb')](_0xba9f('0xd'),_0x441ec6,_0x5cc5eb[_0xba9f('0xb')][_0xba9f('0xe')]);return _0x2d9d59(_0x5cc5eb['error'][_0xba9f('0xe')]);}logger[_0xba9f('0xb')](_0xba9f('0xd'),_0x441ec6,_0x5cc5eb['error'][_0xba9f('0xe')]);return _0x55668e(_0x5cc5eb['error'][_0xba9f('0xe')]);}else{logger[_0xba9f('0x8')](_0xba9f('0xd'),_0x441ec6,'request\x20sent');_0x55668e(_0x5cc5eb[_0xba9f('0xf')][_0xba9f('0xe')]);}})[_0xba9f('0x10')](function(_0x56467e){logger[_0xba9f('0xb')](_0xba9f('0xd'),_0x441ec6,_0x56467e);_0x2d9d59(_0x56467e);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 8cbccaf..4cce1b0 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 _0x6c25=['fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','post','create','put','delete','exports','multer','util','path','express'];(function(_0x3abe58,_0x184dd9){var _0x457389=function(_0x59f517){while(--_0x59f517){_0x3abe58['push'](_0x3abe58['shift']());}};_0x457389(++_0x184dd9);}(_0x6c25,0x176));var _0x56c2=function(_0x37f7f5,_0x3b19b4){_0x37f7f5=_0x37f7f5-0x0;var _0x3a4377=_0x6c25[_0x37f7f5];return _0x3a4377;};'use strict';var multer=require(_0x56c2('0x0'));var util=require(_0x56c2('0x1'));var path=require(_0x56c2('0x2'));var timeout=require('connect-timeout');var express=require(_0x56c2('0x3'));var router=express['Router']();var fs_extra=require(_0x56c2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x56c2('0x5'));var config=require(_0x56c2('0x6'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x56c2('0x7')](),controller['index']);router['get'](_0x56c2('0x8'),auth[_0x56c2('0x7')](),controller['show']);router[_0x56c2('0x9')]('/',auth['isAuthenticated'](),controller[_0x56c2('0xa')]);router[_0x56c2('0xb')](_0x56c2('0x8'),auth[_0x56c2('0x7')](),controller['update']);router[_0x56c2('0xc')](_0x56c2('0x8'),auth[_0x56c2('0x7')](),controller['destroy']);module[_0x56c2('0xd')]=router; \ No newline at end of file +var _0x997b=['get','index','/:id','isAuthenticated','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x997b,0x1d8));var _0xb997=function(_0x1305aa,_0x6ac1a7){_0x1305aa=_0x1305aa-0x0;var _0x32e378=_0x997b[_0x1305aa];return _0x32e378;};'use strict';var multer=require(_0xb997('0x0'));var util=require(_0xb997('0x1'));var path=require(_0xb997('0x2'));var timeout=require(_0xb997('0x3'));var express=require(_0xb997('0x4'));var router=express[_0xb997('0x5')]();var fs_extra=require(_0xb997('0x6'));var auth=require(_0xb997('0x7'));var interaction=require(_0xb997('0x8'));var config=require(_0xb997('0x9'));var controller=require(_0xb997('0xa'));router[_0xb997('0xb')]('/',auth['isAuthenticated'](),controller[_0xb997('0xc')]);router[_0xb997('0xb')](_0xb997('0xd'),auth[_0xb997('0xe')](),controller[_0xb997('0xf')]);router[_0xb997('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb997('0xd'),auth[_0xb997('0xe')](),controller[_0xb997('0x11')]);router[_0xb997('0x12')](_0xb997('0xd'),auth[_0xb997('0xe')](),controller[_0xb997('0x13')]);module[_0xb997('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 08ba73e..c400767 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 _0xf496=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xf496,0x127));var _0x6f49=function(_0x5c4fcc,_0x5b7704){_0x5c4fcc=_0x5c4fcc-0x0;var _0x34c351=_0xf496[_0x5c4fcc];return _0x34c351;};'use strict';var Sequelize=require(_0x6f49('0x0'));module[_0x6f49('0x1')]={'type':{'type':Sequelize[_0x6f49('0x2')](_0x6f49('0x3'),_0x6f49('0x4'),_0x6f49('0x5'),_0x6f49('0x6'),'picklist'),'defaultValue':_0x6f49('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6f49('0x7')]},'keyType':{'type':Sequelize[_0x6f49('0x2')](_0x6f49('0x3'),_0x6f49('0x4'),_0x6f49('0x5'))},'keyContent':{'type':Sequelize[_0x6f49('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6f49('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6f49('0x7')]}}; \ No newline at end of file +var _0x2e4f=['BOOLEAN','sequelize','exports','keyValue','picklist','string','STRING','ENUM','variable'];(function(_0x39597a,_0x4a11c0){var _0x135aba=function(_0x79f73){while(--_0x79f73){_0x39597a['push'](_0x39597a['shift']());}};_0x135aba(++_0x4a11c0);}(_0x2e4f,0xeb));var _0xf2e4=function(_0x543c51,_0xff0084){_0x543c51=_0x543c51-0x0;var _0x360555=_0x2e4f[_0x543c51];return _0x360555;};'use strict';var Sequelize=require(_0xf2e4('0x0'));module[_0xf2e4('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable','customVariable',_0xf2e4('0x2'),_0xf2e4('0x3')),'defaultValue':_0xf2e4('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf2e4('0x5')]},'keyType':{'type':Sequelize[_0xf2e4('0x6')]('string',_0xf2e4('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf2e4('0x5')]},'nameField':{'type':Sequelize[_0xf2e4('0x5')]},'customField':{'type':Sequelize[_0xf2e4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf2e4('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index d59b129..08a23d2 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 _0x525e=['nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','keys','attributes','find','catch','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','map','VtigerField','fieldName','model','query','filters','intersection','fields'];(function(_0x5a7e60,_0x24eb84){var _0x41ef2b=function(_0x4238d5){while(--_0x4238d5){_0x5a7e60['push'](_0x5a7e60['shift']());}};_0x41ef2b(++_0x24eb84);}(_0x525e,0x178));var _0xe525=function(_0x1bf583,_0x2a8190){_0x1bf583=_0x1bf583-0x0;var _0xba8224=_0x525e[_0x1bf583];return _0xba8224;};'use strict';var emlformat=require(_0xe525('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe525('0x1'));var jsonpatch=require(_0xe525('0x2'));var rp=require(_0xe525('0x3'));var moment=require(_0xe525('0x4'));var BPromise=require(_0xe525('0x5'));var Mustache=require('mustache');var util=require(_0xe525('0x6'));var path=require(_0xe525('0x7'));var sox=require(_0xe525('0x8'));var csv=require(_0xe525('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe525('0xa'));var squel=require(_0xe525('0xb'));var crypto=require(_0xe525('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe525('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe525('0xe'));var Papa=require('papaparse');var Redis=require(_0xe525('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe525('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe525('0x11'));var logger=require(_0xe525('0x12'))('api');var utils=require(_0xe525('0x13'));var config=require(_0xe525('0x14'));var licenseUtil=require(_0xe525('0x15'));var db=require(_0xe525('0x16'))['db'];function respondWithStatusCode(_0x4bbb97,_0x10a8f1){_0x10a8f1=_0x10a8f1||0xcc;return function(_0x2360c8){if(_0x2360c8){return _0x4bbb97[_0xe525('0x17')](_0x10a8f1);}return _0x4bbb97[_0xe525('0x18')](_0x10a8f1)[_0xe525('0x19')]();};}function respondWithResult(_0x2442cb,_0x2ab984){_0x2ab984=_0x2ab984||0xc8;return function(_0x4e737f){if(_0x4e737f){return _0x2442cb[_0xe525('0x18')](_0x2ab984)['json'](_0x4e737f);}};}function respondWithFilteredResult(_0x3b6fa4,_0xebb51b){return function(_0x4c98e4){if(_0x4c98e4){var _0x164c24=typeof _0xebb51b[_0xe525('0x1a')]===_0xe525('0x1b')&&typeof _0xebb51b[_0xe525('0x1c')]===_0xe525('0x1b');var _0x4dca9e=_0x4c98e4[_0xe525('0x1d')];var _0x23a854=_0x164c24?0x0:_0xebb51b['offset'];var _0x4708c2=_0x164c24?_0x4c98e4['count']:_0xebb51b[_0xe525('0x1a')]+_0xebb51b['limit'];var _0x4c366a;if(_0x4708c2>=_0x4dca9e){_0x4708c2=_0x4dca9e;_0x4c366a=0xc8;}else{_0x4c366a=0xce;}_0x3b6fa4['status'](_0x4c366a);return _0x3b6fa4[_0xe525('0x1e')](_0xe525('0x1f'),_0x23a854+'-'+_0x4708c2+'/'+_0x4dca9e)[_0xe525('0x20')](_0x4c98e4);}return null;};}function patchUpdates(_0x6142ce){return function(_0x3b5772){try{jsonpatch[_0xe525('0x21')](_0x3b5772,_0x6142ce,!![]);}catch(_0xcc5ee4){return BPromise[_0xe525('0x22')](_0xcc5ee4);}return _0x3b5772[_0xe525('0x23')]();};}function saveUpdates(_0x2686eb,_0x394428){return function(_0x2f46a8){if(_0x2f46a8){return _0x2f46a8['update'](_0x2686eb)[_0xe525('0x24')](function(_0x1d9ade){return _0x1d9ade;});}return null;};}function removeEntity(_0x1039b0,_0x17c75b){return function(_0x39e078){if(_0x39e078){return _0x39e078[_0xe525('0x25')]()[_0xe525('0x24')](function(){_0x1039b0[_0xe525('0x18')](0xcc)[_0xe525('0x19')]();});}};}function handleEntityNotFound(_0x99cfd1,_0x582534){return function(_0x29872f){if(!_0x29872f){_0x99cfd1[_0xe525('0x17')](0x194);}return _0x29872f;};}function handleError(_0x155fee,_0x18f2a2){_0x18f2a2=_0x18f2a2||0x1f4;return function(_0x244006){logger[_0xe525('0x26')](_0x244006[_0xe525('0x27')]);if(_0x244006[_0xe525('0x28')]){delete _0x244006[_0xe525('0x28')];}_0x155fee[_0xe525('0x18')](_0x18f2a2)[_0xe525('0x29')](_0x244006);};}exports['index']=function(_0x7c81ff,_0x31b3e3){var _0x30b789={},_0x1605e0={},_0x39567b={'count':0x0,'rows':[]};var _0x58841e=_[_0xe525('0x2a')](db[_0xe525('0x2b')]['rawAttributes'],function(_0x61ff9e){return{'name':_0x61ff9e[_0xe525('0x2c')],'type':_0x61ff9e['type']['key']};});_0x1605e0[_0xe525('0x2d')]=_['map'](_0x58841e,'name');_0x1605e0[_0xe525('0x2e')]=_['keys'](_0x7c81ff[_0xe525('0x2e')]);_0x1605e0[_0xe525('0x2f')]=_[_0xe525('0x30')](_0x1605e0[_0xe525('0x2d')],_0x1605e0[_0xe525('0x2e')]);_0x30b789['attributes']=_[_0xe525('0x30')](_0x1605e0[_0xe525('0x2d')],qs[_0xe525('0x31')](_0x7c81ff[_0xe525('0x2e')][_0xe525('0x31')]));_0x30b789['attributes']=_0x30b789['attributes']['length']?_0x30b789['attributes']:_0x1605e0[_0xe525('0x2d')];if(!_0x7c81ff[_0xe525('0x2e')]['hasOwnProperty'](_0xe525('0x32'))){_0x30b789[_0xe525('0x1c')]=qs[_0xe525('0x1c')](_0x7c81ff[_0xe525('0x2e')]['limit']);_0x30b789[_0xe525('0x1a')]=qs[_0xe525('0x1a')](_0x7c81ff['query']['offset']);}_0x30b789[_0xe525('0x33')]=qs[_0xe525('0x34')](_0x7c81ff[_0xe525('0x2e')][_0xe525('0x34')]);_0x30b789['where']=qs['filters'](_[_0xe525('0x35')](_0x7c81ff['query'],_0x1605e0[_0xe525('0x2f')]),_0x58841e);if(_0x7c81ff['query'][_0xe525('0x36')]){_0x30b789[_0xe525('0x37')]=_[_0xe525('0x38')](_0x30b789['where'],{'$or':_[_0xe525('0x2a')](_0x58841e,function(_0x3465ca){if(_0x3465ca['type']!==_0xe525('0x39')){var _0xee0a77={};_0xee0a77[_0x3465ca[_0xe525('0x28')]]={'$like':'%'+_0x7c81ff['query'][_0xe525('0x36')]+'%'};return _0xee0a77;}})});}_0x30b789=_[_0xe525('0x38')]({},_0x30b789,_0x7c81ff[_0xe525('0x3a')]);var _0x4c5ff3={'where':_0x30b789[_0xe525('0x37')]};return db[_0xe525('0x2b')][_0xe525('0x1d')](_0x4c5ff3)[_0xe525('0x24')](function(_0x480321){_0x39567b['count']=_0x480321;if(_0x7c81ff[_0xe525('0x2e')][_0xe525('0x3b')]){_0x30b789['include']=[{'all':!![]}];}return db['VtigerField'][_0xe525('0x3c')](_0x30b789);})[_0xe525('0x24')](function(_0x5141e1){_0x39567b[_0xe525('0x3d')]=_0x5141e1;return _0x39567b;})['then'](respondWithFilteredResult(_0x31b3e3,_0x30b789))['catch'](handleError(_0x31b3e3,null));};exports['show']=function(_0x57f30e,_0x21b412){var _0xc2b416={'raw':!![],'where':{'id':_0x57f30e[_0xe525('0x3e')]['id']}},_0x3ae021={};_0x3ae021['model']=_['keys'](db[_0xe525('0x2b')][_0xe525('0x3f')]);_0x3ae021[_0xe525('0x2e')]=_[_0xe525('0x40')](_0x57f30e[_0xe525('0x2e')]);_0x3ae021['filters']=_[_0xe525('0x30')](_0x3ae021['model'],_0x3ae021[_0xe525('0x2e')]);_0xc2b416[_0xe525('0x41')]=_[_0xe525('0x30')](_0x3ae021[_0xe525('0x2d')],qs[_0xe525('0x31')](_0x57f30e[_0xe525('0x2e')][_0xe525('0x31')]));_0xc2b416[_0xe525('0x41')]=_0xc2b416['attributes']['length']?_0xc2b416[_0xe525('0x41')]:_0x3ae021[_0xe525('0x2d')];if(_0x57f30e[_0xe525('0x2e')][_0xe525('0x3b')]){_0xc2b416['include']=[{'all':!![]}];}_0xc2b416=_[_0xe525('0x38')]({},_0xc2b416,_0x57f30e[_0xe525('0x3a')]);return db['VtigerField'][_0xe525('0x42')](_0xc2b416)[_0xe525('0x24')](handleEntityNotFound(_0x21b412,null))[_0xe525('0x24')](respondWithResult(_0x21b412,null))[_0xe525('0x43')](handleError(_0x21b412,null));};exports['create']=function(_0x530ec9,_0x3e8563){return db[_0xe525('0x2b')][_0xe525('0x44')](_0x530ec9[_0xe525('0x45')],{})[_0xe525('0x24')](respondWithResult(_0x3e8563,0xc9))[_0xe525('0x43')](handleError(_0x3e8563,null));};exports[_0xe525('0x46')]=function(_0x57eebc,_0x24c147){if(_0x57eebc['body']['id']){delete _0x57eebc[_0xe525('0x45')]['id'];}return db[_0xe525('0x2b')][_0xe525('0x42')]({'where':{'id':_0x57eebc['params']['id']}})[_0xe525('0x24')](handleEntityNotFound(_0x24c147,null))[_0xe525('0x24')](saveUpdates(_0x57eebc[_0xe525('0x45')],null))[_0xe525('0x24')](respondWithResult(_0x24c147,null))[_0xe525('0x43')](handleError(_0x24c147,null));};exports['destroy']=function(_0x14d00a,_0xe09404){return db['VtigerField'][_0xe525('0x42')]({'where':{'id':_0x14d00a['params']['id']}})[_0xe525('0x24')](handleEntityNotFound(_0xe09404,null))['then'](removeEntity(_0xe09404,null))[_0xe525('0x43')](handleError(_0xe09404,null));}; \ No newline at end of file +var _0xb3b5=['update','then','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VtigerField','include','findAll','rows','catch','params','includeAll','find','create','body','destroy','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','json','reject','save'];(function(_0x13c237,_0x49d6e2){var _0x4e593f=function(_0x50565b){while(--_0x50565b){_0x13c237['push'](_0x13c237['shift']());}};_0x4e593f(++_0x49d6e2);}(_0xb3b5,0x160));var _0x5b3b=function(_0x34e752,_0x32e2a2){_0x34e752=_0x34e752-0x0;var _0x7c6347=_0xb3b5[_0x34e752];return _0x7c6347;};'use strict';var emlformat=require(_0x5b3b('0x0'));var rimraf=require(_0x5b3b('0x1'));var zipdir=require(_0x5b3b('0x2'));var jsonpatch=require(_0x5b3b('0x3'));var rp=require(_0x5b3b('0x4'));var moment=require(_0x5b3b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5b3b('0x6'));var util=require(_0x5b3b('0x7'));var path=require(_0x5b3b('0x8'));var sox=require(_0x5b3b('0x9'));var csv=require(_0x5b3b('0xa'));var ejs=require(_0x5b3b('0xb'));var fs=require('fs');var fs_extra=require(_0x5b3b('0xc'));var _=require(_0x5b3b('0xd'));var squel=require(_0x5b3b('0xe'));var crypto=require(_0x5b3b('0xf'));var jsforce=require(_0x5b3b('0x10'));var deskjs=require(_0x5b3b('0x11'));var toCsv=require(_0x5b3b('0xa'));var querystring=require('querystring');var Papa=require(_0x5b3b('0x12'));var Redis=require(_0x5b3b('0x13'));var authService=require(_0x5b3b('0x14'));var qs=require(_0x5b3b('0x15'));var as=require(_0x5b3b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b3b('0x17'))(_0x5b3b('0x18'));var utils=require(_0x5b3b('0x19'));var config=require(_0x5b3b('0x1a'));var licenseUtil=require(_0x5b3b('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54a69e,_0xd34601){_0xd34601=_0xd34601||0xcc;return function(_0x1dce36){if(_0x1dce36){return _0x54a69e[_0x5b3b('0x1c')](_0xd34601);}return _0x54a69e['status'](_0xd34601)[_0x5b3b('0x1d')]();};}function respondWithResult(_0x40b8c9,_0x2df775){_0x2df775=_0x2df775||0xc8;return function(_0x10df6a){if(_0x10df6a){return _0x40b8c9[_0x5b3b('0x1e')](_0x2df775)['json'](_0x10df6a);}};}function respondWithFilteredResult(_0x2054f,_0x10aa5f){return function(_0x54ff25){if(_0x54ff25){var _0x3ee046=typeof _0x10aa5f[_0x5b3b('0x1f')]===_0x5b3b('0x20')&&typeof _0x10aa5f[_0x5b3b('0x21')]==='undefined';var _0x2989cc=_0x54ff25[_0x5b3b('0x22')];var _0x459f51=_0x3ee046?0x0:_0x10aa5f[_0x5b3b('0x1f')];var _0x16e428=_0x3ee046?_0x54ff25[_0x5b3b('0x22')]:_0x10aa5f[_0x5b3b('0x1f')]+_0x10aa5f['limit'];var _0xf1baea;if(_0x16e428>=_0x2989cc){_0x16e428=_0x2989cc;_0xf1baea=0xc8;}else{_0xf1baea=0xce;}_0x2054f['status'](_0xf1baea);return _0x2054f['set']('Content-Range',_0x459f51+'-'+_0x16e428+'/'+_0x2989cc)[_0x5b3b('0x23')](_0x54ff25);}return null;};}function patchUpdates(_0x1f2ce9){return function(_0x20f4e7){try{jsonpatch['apply'](_0x20f4e7,_0x1f2ce9,!![]);}catch(_0x558a7c){return BPromise[_0x5b3b('0x24')](_0x558a7c);}return _0x20f4e7[_0x5b3b('0x25')]();};}function saveUpdates(_0x5478c3,_0x573228){return function(_0x1d2d98){if(_0x1d2d98){return _0x1d2d98[_0x5b3b('0x26')](_0x5478c3)[_0x5b3b('0x27')](function(_0x15d908){return _0x15d908;});}return null;};}function removeEntity(_0x2ef693,_0x41893d){return function(_0x9e677){if(_0x9e677){return _0x9e677['destroy']()[_0x5b3b('0x27')](function(){_0x2ef693['status'](0xcc)[_0x5b3b('0x1d')]();});}};}function handleEntityNotFound(_0x3b8252,_0x42b141){return function(_0xfc25fe){if(!_0xfc25fe){_0x3b8252[_0x5b3b('0x1c')](0x194);}return _0xfc25fe;};}function handleError(_0x1f3c66,_0x3160e8){_0x3160e8=_0x3160e8||0x1f4;return function(_0x3a862b){logger[_0x5b3b('0x28')](_0x3a862b[_0x5b3b('0x29')]);if(_0x3a862b[_0x5b3b('0x2a')]){delete _0x3a862b[_0x5b3b('0x2a')];}_0x1f3c66[_0x5b3b('0x1e')](_0x3160e8)['send'](_0x3a862b);};}exports[_0x5b3b('0x2b')]=function(_0x7ac2f6,_0x15f5af){var _0x58a710={},_0x49929b={},_0x11e597={'count':0x0,'rows':[]};var _0x5edbbb=_['map'](db['VtigerField'][_0x5b3b('0x2c')],function(_0x5ed718){return{'name':_0x5ed718[_0x5b3b('0x2d')],'type':_0x5ed718[_0x5b3b('0x2e')][_0x5b3b('0x2f')]};});_0x49929b[_0x5b3b('0x30')]=_[_0x5b3b('0x31')](_0x5edbbb,_0x5b3b('0x2a'));_0x49929b['query']=_[_0x5b3b('0x32')](_0x7ac2f6[_0x5b3b('0x33')]);_0x49929b[_0x5b3b('0x34')]=_[_0x5b3b('0x35')](_0x49929b[_0x5b3b('0x30')],_0x49929b[_0x5b3b('0x33')]);_0x58a710[_0x5b3b('0x36')]=_['intersection'](_0x49929b[_0x5b3b('0x30')],qs['fields'](_0x7ac2f6['query'][_0x5b3b('0x37')]));_0x58a710[_0x5b3b('0x36')]=_0x58a710[_0x5b3b('0x36')][_0x5b3b('0x38')]?_0x58a710[_0x5b3b('0x36')]:_0x49929b['model'];if(!_0x7ac2f6[_0x5b3b('0x33')][_0x5b3b('0x39')](_0x5b3b('0x3a'))){_0x58a710[_0x5b3b('0x21')]=qs['limit'](_0x7ac2f6[_0x5b3b('0x33')][_0x5b3b('0x21')]);_0x58a710['offset']=qs['offset'](_0x7ac2f6[_0x5b3b('0x33')]['offset']);}_0x58a710[_0x5b3b('0x3b')]=qs[_0x5b3b('0x3c')](_0x7ac2f6[_0x5b3b('0x33')]['sort']);_0x58a710[_0x5b3b('0x3d')]=qs[_0x5b3b('0x34')](_[_0x5b3b('0x3e')](_0x7ac2f6['query'],_0x49929b[_0x5b3b('0x34')]),_0x5edbbb);if(_0x7ac2f6[_0x5b3b('0x33')]['filter']){_0x58a710[_0x5b3b('0x3d')]=_[_0x5b3b('0x3f')](_0x58a710[_0x5b3b('0x3d')],{'$or':_[_0x5b3b('0x31')](_0x5edbbb,function(_0xce86e6){if(_0xce86e6[_0x5b3b('0x2e')]!==_0x5b3b('0x40')){var _0x424507={};_0x424507[_0xce86e6[_0x5b3b('0x2a')]]={'$like':'%'+_0x7ac2f6[_0x5b3b('0x33')][_0x5b3b('0x41')]+'%'};return _0x424507;}})});}_0x58a710=_[_0x5b3b('0x3f')]({},_0x58a710,_0x7ac2f6[_0x5b3b('0x42')]);var _0x53735c={'where':_0x58a710[_0x5b3b('0x3d')]};return db[_0x5b3b('0x43')][_0x5b3b('0x22')](_0x53735c)[_0x5b3b('0x27')](function(_0x1dffc2){_0x11e597['count']=_0x1dffc2;if(_0x7ac2f6['query']['includeAll']){_0x58a710[_0x5b3b('0x44')]=[{'all':!![]}];}return db[_0x5b3b('0x43')][_0x5b3b('0x45')](_0x58a710);})[_0x5b3b('0x27')](function(_0x3f2522){_0x11e597[_0x5b3b('0x46')]=_0x3f2522;return _0x11e597;})['then'](respondWithFilteredResult(_0x15f5af,_0x58a710))[_0x5b3b('0x47')](handleError(_0x15f5af,null));};exports['show']=function(_0x549d21,_0x4c7591){var _0x247490={'raw':!![],'where':{'id':_0x549d21[_0x5b3b('0x48')]['id']}},_0x4e7d46={};_0x4e7d46[_0x5b3b('0x30')]=_[_0x5b3b('0x32')](db['VtigerField'][_0x5b3b('0x2c')]);_0x4e7d46[_0x5b3b('0x33')]=_[_0x5b3b('0x32')](_0x549d21[_0x5b3b('0x33')]);_0x4e7d46[_0x5b3b('0x34')]=_['intersection'](_0x4e7d46[_0x5b3b('0x30')],_0x4e7d46['query']);_0x247490[_0x5b3b('0x36')]=_[_0x5b3b('0x35')](_0x4e7d46[_0x5b3b('0x30')],qs[_0x5b3b('0x37')](_0x549d21[_0x5b3b('0x33')][_0x5b3b('0x37')]));_0x247490[_0x5b3b('0x36')]=_0x247490[_0x5b3b('0x36')][_0x5b3b('0x38')]?_0x247490[_0x5b3b('0x36')]:_0x4e7d46[_0x5b3b('0x30')];if(_0x549d21['query'][_0x5b3b('0x49')]){_0x247490[_0x5b3b('0x44')]=[{'all':!![]}];}_0x247490=_[_0x5b3b('0x3f')]({},_0x247490,_0x549d21[_0x5b3b('0x42')]);return db[_0x5b3b('0x43')][_0x5b3b('0x4a')](_0x247490)[_0x5b3b('0x27')](handleEntityNotFound(_0x4c7591,null))[_0x5b3b('0x27')](respondWithResult(_0x4c7591,null))['catch'](handleError(_0x4c7591,null));};exports[_0x5b3b('0x4b')]=function(_0x2acd47,_0x3af8a1){return db[_0x5b3b('0x43')][_0x5b3b('0x4b')](_0x2acd47[_0x5b3b('0x4c')],{})[_0x5b3b('0x27')](respondWithResult(_0x3af8a1,0xc9))[_0x5b3b('0x47')](handleError(_0x3af8a1,null));};exports['update']=function(_0x4a105b,_0x18424d){if(_0x4a105b['body']['id']){delete _0x4a105b[_0x5b3b('0x4c')]['id'];}return db[_0x5b3b('0x43')][_0x5b3b('0x4a')]({'where':{'id':_0x4a105b['params']['id']}})[_0x5b3b('0x27')](handleEntityNotFound(_0x18424d,null))[_0x5b3b('0x27')](saveUpdates(_0x4a105b[_0x5b3b('0x4c')],null))[_0x5b3b('0x27')](respondWithResult(_0x18424d,null))['catch'](handleError(_0x18424d,null));};exports[_0x5b3b('0x4d')]=function(_0x11fc7b,_0x3aebe3){return db['VtigerField']['find']({'where':{'id':_0x11fc7b['params']['id']}})['then'](handleEntityNotFound(_0x3aebe3,null))[_0x5b3b('0x27')](removeEntity(_0x3aebe3,null))[_0x5b3b('0x47')](handleError(_0x3aebe3,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index ad71067..5ec2da2 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 _0x9fd6=['exports','define','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0x9fd6,0xcb));var _0x69fd=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9fd6[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x69fd('0x0'));var util=require('util');var logger=require(_0x69fd('0x1'))(_0x69fd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x69fd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x69fd('0x4'));var config=require(_0x69fd('0x5'));var attributes=require('./intVtigerField.attributes');module[_0x69fd('0x6')]=function(_0x59c7d1,_0x4b0c4b){return _0x59c7d1[_0x69fd('0x7')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x69fd('0x8'),'fields':[_0x69fd('0x9'),_0x69fd('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcf56=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xcf56,0x13a));var _0x6cf5=function(_0x4965ce,_0x51c0bd){_0x4965ce=_0x4965ce-0x0;var _0x286b20=_0xcf56[_0x4965ce];return _0x286b20;};'use strict';var _=require(_0x6cf5('0x0'));var util=require(_0x6cf5('0x1'));var logger=require(_0x6cf5('0x2'))(_0x6cf5('0x3'));var moment=require(_0x6cf5('0x4'));var BPromise=require('bluebird');var rp=require(_0x6cf5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6cf5('0x6'));var config=require(_0x6cf5('0x7'));var attributes=require(_0x6cf5('0x8'));module[_0x6cf5('0x9')]=function(_0x2269e5,_0x2e89e9){return _0x2269e5[_0x6cf5('0xa')](_0x6cf5('0xb'),attributes,{'tableName':_0x6cf5('0xc'),'paranoid':![],'indexes':[{'name':_0x6cf5('0xd'),'fields':[_0x6cf5('0xe'),'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 b4654b4..1174eff 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 _0xa71c=['../../config/logger','../../config/environment','jayson/promise','client','http','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xa71c,0xe9));var _0xca71=function(_0x564adc,_0x4cb97f){_0x564adc=_0x564adc-0x0;var _0xa98e9a=_0xa71c[_0x564adc];return _0xa98e9a;};'use strict';var _=require(_0xca71('0x0'));var util=require(_0xca71('0x1'));var moment=require('moment');var BPromise=require(_0xca71('0x2'));var rs=require(_0xca71('0x3'));var fs=require('fs');var Redis=require(_0xca71('0x4'));var db=require(_0xca71('0x5'))['db'];var utils=require(_0xca71('0x6'));var logger=require(_0xca71('0x7'))('rpc');var config=require(_0xca71('0x8'));var jayson=require(_0xca71('0x9'));var client=jayson[_0xca71('0xa')][_0xca71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b6581,_0x44fd96,_0x54681a){return new BPromise(function(_0x240849,_0x305f3a){return client['request'](_0x3b6581,_0x54681a)[_0xca71('0xc')](function(_0x3c1371){logger['info'](_0xca71('0xd'),_0x44fd96,_0xca71('0xe'));logger[_0xca71('0xf')](_0xca71('0x10'),_0x44fd96,'request\x20sent',JSON[_0xca71('0x11')](_0x3c1371));if(_0x3c1371[_0xca71('0x12')]){if(_0x3c1371[_0xca71('0x12')][_0xca71('0x13')]===0x1f4){logger['error'](_0xca71('0xd'),_0x44fd96,_0x3c1371[_0xca71('0x12')][_0xca71('0x14')]);return _0x305f3a(_0x3c1371['error'][_0xca71('0x14')]);}logger[_0xca71('0x12')](_0xca71('0xd'),_0x44fd96,_0x3c1371[_0xca71('0x12')][_0xca71('0x14')]);return _0x240849(_0x3c1371[_0xca71('0x12')][_0xca71('0x14')]);}else{logger[_0xca71('0x15')](_0xca71('0xd'),_0x44fd96,_0xca71('0xe'));_0x240849(_0x3c1371[_0xca71('0x16')]['message']);}})[_0xca71('0x17')](function(_0x546f22){logger[_0xca71('0x12')](_0xca71('0xd'),_0x44fd96,_0x546f22);_0x305f3a(_0x546f22);});});} \ No newline at end of file +var _0xa6a6=['request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x129056,_0x3ea106){var _0x455cc5=function(_0x3c725e){while(--_0x3c725e){_0x129056['push'](_0x129056['shift']());}};_0x455cc5(++_0x3ea106);}(_0xa6a6,0x1d4));var _0x6a6a=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xa6a6[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x6a6a('0x0'));var util=require(_0x6a6a('0x1'));var moment=require('moment');var BPromise=require(_0x6a6a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a6a('0x3'));var db=require(_0x6a6a('0x4'))['db'];var utils=require(_0x6a6a('0x5'));var logger=require(_0x6a6a('0x6'))('rpc');var config=require(_0x6a6a('0x7'));var jayson=require(_0x6a6a('0x8'));var client=jayson['client'][_0x6a6a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49c024,_0xac12fe,_0x435483){return new BPromise(function(_0x5f15a6,_0x49f34e){return client[_0x6a6a('0xa')](_0x49c024,_0x435483)['then'](function(_0x152f91){logger[_0x6a6a('0xb')](_0x6a6a('0xc'),_0xac12fe,'request\x20sent');logger[_0x6a6a('0xd')](_0x6a6a('0xe'),_0xac12fe,_0x6a6a('0xf'),JSON[_0x6a6a('0x10')](_0x152f91));if(_0x152f91[_0x6a6a('0x11')]){if(_0x152f91['error'][_0x6a6a('0x12')]===0x1f4){logger[_0x6a6a('0x11')](_0x6a6a('0xc'),_0xac12fe,_0x152f91[_0x6a6a('0x11')]['message']);return _0x49f34e(_0x152f91[_0x6a6a('0x11')][_0x6a6a('0x13')]);}logger[_0x6a6a('0x11')](_0x6a6a('0xc'),_0xac12fe,_0x152f91[_0x6a6a('0x11')][_0x6a6a('0x13')]);return _0x5f15a6(_0x152f91[_0x6a6a('0x11')][_0x6a6a('0x13')]);}else{logger[_0x6a6a('0xb')]('VtigerField,\x20%s,\x20%s',_0xac12fe,_0x6a6a('0xf'));_0x5f15a6(_0x152f91['result'][_0x6a6a('0x13')]);}})[_0x6a6a('0x14')](function(_0x470374){logger[_0x6a6a('0x11')]('VtigerField,\x20%s,\x20%s',_0xac12fe,_0x470374);_0x49f34e(_0x470374);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 92db2c7..dfc809a 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 _0x3a83=['getFields','post','/:id/configurations','addConfiguration','put','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','show'];(function(_0x2fbfb1,_0x4d6def){var _0x5335f9=function(_0x9d9386){while(--_0x9d9386){_0x2fbfb1['push'](_0x2fbfb1['shift']());}};_0x5335f9(++_0x4d6def);}(_0x3a83,0x7f));var _0x33a8=function(_0x2cd7b1,_0x2d11f3){_0x2cd7b1=_0x2cd7b1-0x0;var _0x215a16=_0x3a83[_0x2cd7b1];return _0x215a16;};'use strict';var multer=require('multer');var util=require(_0x33a8('0x0'));var path=require('path');var timeout=require(_0x33a8('0x1'));var express=require(_0x33a8('0x2'));var router=express[_0x33a8('0x3')]();var fs_extra=require(_0x33a8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x33a8('0x5'));var config=require(_0x33a8('0x6'));var controller=require(_0x33a8('0x7'));router['get']('/',auth[_0x33a8('0x8')](),controller[_0x33a8('0x9')]);router[_0x33a8('0xa')](_0x33a8('0xb'),auth[_0x33a8('0x8')](),controller[_0x33a8('0xc')]);router[_0x33a8('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x33a8('0xa')]('/:id/fields',auth[_0x33a8('0x8')](),controller[_0x33a8('0xd')]);router[_0x33a8('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x33a8('0xe')](_0x33a8('0xf'),auth[_0x33a8('0x8')](),controller[_0x33a8('0x10')]);router[_0x33a8('0x11')](_0x33a8('0xb'),auth[_0x33a8('0x8')](),controller['update']);router['delete'](_0x33a8('0xb'),auth['isAuthenticated'](),controller[_0x33a8('0x12')]);module[_0x33a8('0x13')]=router; \ No newline at end of file +var _0x5502=['./intZendeskAccount.controller','get','isAuthenticated','show','/:id/fields','getFields','post','/:id/configurations','addConfiguration','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x411eb3,_0x5ee8bd){var _0x226d64=function(_0x4144ad){while(--_0x4144ad){_0x411eb3['push'](_0x411eb3['shift']());}};_0x226d64(++_0x5ee8bd);}(_0x5502,0x69));var _0x2550=function(_0x26c80d,_0x20001f){_0x26c80d=_0x26c80d-0x0;var _0x5dbd87=_0x5502[_0x26c80d];return _0x5dbd87;};'use strict';var multer=require(_0x2550('0x0'));var util=require(_0x2550('0x1'));var path=require(_0x2550('0x2'));var timeout=require(_0x2550('0x3'));var express=require(_0x2550('0x4'));var router=express[_0x2550('0x5')]();var fs_extra=require(_0x2550('0x6'));var auth=require(_0x2550('0x7'));var interaction=require(_0x2550('0x8'));var config=require(_0x2550('0x9'));var controller=require(_0x2550('0xa'));router[_0x2550('0xb')]('/',auth[_0x2550('0xc')](),controller['index']);router[_0x2550('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x2550('0xd')]);router[_0x2550('0xb')]('/:id/configurations',auth[_0x2550('0xc')](),controller['getConfigurations']);router[_0x2550('0xb')](_0x2550('0xe'),auth[_0x2550('0xc')](),controller[_0x2550('0xf')]);router[_0x2550('0x10')]('/',auth[_0x2550('0xc')](),controller['create']);router[_0x2550('0x10')](_0x2550('0x11'),auth[_0x2550('0xc')](),controller[_0x2550('0x12')]);router['put'](_0x2550('0x13'),auth[_0x2550('0xc')](),controller['update']);router[_0x2550('0x14')](_0x2550('0x13'),auth[_0x2550('0xc')](),controller[_0x2550('0x15')]);module[_0x2550('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 5576555..d61bf94 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 _0x6ec2=['password','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x3c783f,_0x4e9af0){var _0x5f31a1=function(_0xbc6010){while(--_0xbc6010){_0x3c783f['push'](_0x3c783f['shift']());}};_0x5f31a1(++_0x4e9af0);}(_0x6ec2,0x78));var _0x26ec=function(_0x412989,_0x8732af){_0x412989=_0x412989-0x0;var _0x12d3cf=_0x6ec2[_0x412989];return _0x12d3cf;};'use strict';var Sequelize=require(_0x26ec('0x0'));module[_0x26ec('0x1')]={'name':{'type':Sequelize[_0x26ec('0x2')]},'description':{'type':Sequelize[_0x26ec('0x2')]},'username':{'type':Sequelize[_0x26ec('0x2')],'unique':_0x26ec('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x26ec('0x2')]},'remoteUri':{'type':Sequelize[_0x26ec('0x2')],'unique':_0x26ec('0x4')},'authType':{'type':Sequelize[_0x26ec('0x5')](_0x26ec('0x6'),'token'),'defaultValue':_0x26ec('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x26ec('0x7'),_0x26ec('0x8')),'defaultValue':_0x26ec('0x7')}}; \ No newline at end of file +var _0x2542=['newTab','sequelize','exports','STRING','username','remoteUri','ENUM','password','integrationTab'];(function(_0x4c8df2,_0xb5cb33){var _0x5e1433=function(_0x5edcc3){while(--_0x5edcc3){_0x4c8df2['push'](_0x4c8df2['shift']());}};_0x5e1433(++_0xb5cb33);}(_0x2542,0x169));var _0x2254=function(_0xc1d0f0,_0xbea429){_0xc1d0f0=_0xc1d0f0-0x0;var _0x4bc573=_0x2542[_0xc1d0f0];return _0x4bc573;};'use strict';var Sequelize=require(_0x2254('0x0'));module[_0x2254('0x1')]={'name':{'type':Sequelize[_0x2254('0x2')]},'description':{'type':Sequelize[_0x2254('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x2254('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x2254('0x2')]},'remoteUri':{'type':Sequelize[_0x2254('0x2')],'unique':_0x2254('0x4')},'authType':{'type':Sequelize[_0x2254('0x5')](_0x2254('0x6'),'token'),'defaultValue':_0x2254('0x6')},'serverUrl':{'type':Sequelize[_0x2254('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2254('0x5')](_0x2254('0x7'),_0x2254('0x8')),'defaultValue':_0x2254('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index d20727d..5d699a3 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 _0x0abf=['eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','name','send','index','map','ZendeskAccount','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','destroy','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','ZendeskConfiguration','ZendeskField','getFields','username','password','token','authType','remoteUri','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','toString','base64','Basic\x20%s','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test'];(function(_0x1f06e3,_0x3a5a3a){var _0x481cca=function(_0x530f31){while(--_0x530f31){_0x1f06e3['push'](_0x1f06e3['shift']());}};_0x481cca(++_0x3a5a3a);}(_0x0abf,0xe8));var _0xf0ab=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0abf[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var licenseUtil=require(_0xf0ab('0x15'));var db=require(_0xf0ab('0x16'))['db'];var integrations=require(_0xf0ab('0x17'));function respondWithStatusCode(_0x34ccdc,_0x4fdd5f){_0x4fdd5f=_0x4fdd5f||0xcc;return function(_0x39b4e7){if(_0x39b4e7){return _0x34ccdc[_0xf0ab('0x18')](_0x4fdd5f);}return _0x34ccdc[_0xf0ab('0x19')](_0x4fdd5f)[_0xf0ab('0x1a')]();};}function respondWithResult(_0x1824ef,_0x36cabe){_0x36cabe=_0x36cabe||0xc8;return function(_0x3d7129){if(_0x3d7129){return _0x1824ef[_0xf0ab('0x19')](_0x36cabe)[_0xf0ab('0x1b')](_0x3d7129);}};}function respondWithFilteredResult(_0x3c5bfd,_0x20f453){return function(_0x221bac){if(_0x221bac){var _0x200cf5=typeof _0x20f453[_0xf0ab('0x1c')]===_0xf0ab('0x1d')&&typeof _0x20f453['limit']===_0xf0ab('0x1d');var _0x9e3b47=_0x221bac[_0xf0ab('0x1e')];var _0x1ffeb5=_0x200cf5?0x0:_0x20f453[_0xf0ab('0x1c')];var _0xb9a33=_0x200cf5?_0x221bac[_0xf0ab('0x1e')]:_0x20f453[_0xf0ab('0x1c')]+_0x20f453[_0xf0ab('0x1f')];var _0x1874a5;if(_0xb9a33>=_0x9e3b47){_0xb9a33=_0x9e3b47;_0x1874a5=0xc8;}else{_0x1874a5=0xce;}_0x3c5bfd[_0xf0ab('0x19')](_0x1874a5);return _0x3c5bfd[_0xf0ab('0x20')](_0xf0ab('0x21'),_0x1ffeb5+'-'+_0xb9a33+'/'+_0x9e3b47)[_0xf0ab('0x1b')](_0x221bac);}return null;};}function patchUpdates(_0x2cd961){return function(_0x45c1c9){try{jsonpatch['apply'](_0x45c1c9,_0x2cd961,!![]);}catch(_0x153492){return BPromise[_0xf0ab('0x22')](_0x153492);}return _0x45c1c9[_0xf0ab('0x23')]();};}function saveUpdates(_0x11ab3a,_0x3bf6a1){return function(_0x374531){if(_0x374531){return _0x374531[_0xf0ab('0x24')](_0x11ab3a)[_0xf0ab('0x25')](function(_0x36ad01){return _0x36ad01;});}return null;};}function removeEntity(_0x18bb37,_0x43119f){return function(_0x5645b2){if(_0x5645b2){return _0x5645b2['destroy']()['then'](function(){_0x18bb37[_0xf0ab('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eca32,_0x16b979){return function(_0x51ac90){if(!_0x51ac90){_0x3eca32[_0xf0ab('0x18')](0x194);}return _0x51ac90;};}function handleError(_0x22671e,_0x10bf5f){_0x10bf5f=_0x10bf5f||0x1f4;return function(_0x38fb71){logger[_0xf0ab('0x26')](_0x38fb71['stack']);if(_0x38fb71[_0xf0ab('0x27')]){delete _0x38fb71['name'];}_0x22671e['status'](_0x10bf5f)[_0xf0ab('0x28')](_0x38fb71);};}exports[_0xf0ab('0x29')]=function(_0x1b223d,_0x445160){var _0x43476c={},_0x174052={},_0x367302={'count':0x0,'rows':[]};var _0x14da9c=_[_0xf0ab('0x2a')](db[_0xf0ab('0x2b')][_0xf0ab('0x2c')],function(_0x199753){return{'name':_0x199753['fieldName'],'type':_0x199753[_0xf0ab('0x2d')][_0xf0ab('0x2e')]};});_0x174052['model']=_['map'](_0x14da9c,_0xf0ab('0x27'));_0x174052[_0xf0ab('0x2f')]=_[_0xf0ab('0x30')](_0x1b223d['query']);_0x174052['filters']=_[_0xf0ab('0x31')](_0x174052['model'],_0x174052[_0xf0ab('0x2f')]);_0x43476c['attributes']=_[_0xf0ab('0x31')](_0x174052[_0xf0ab('0x32')],qs['fields'](_0x1b223d['query'][_0xf0ab('0x33')]));_0x43476c[_0xf0ab('0x34')]=_0x43476c[_0xf0ab('0x34')][_0xf0ab('0x35')]?_0x43476c[_0xf0ab('0x34')]:_0x174052[_0xf0ab('0x32')];if(!_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x36')](_0xf0ab('0x37'))){_0x43476c[_0xf0ab('0x1f')]=qs[_0xf0ab('0x1f')](_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x1f')]);_0x43476c[_0xf0ab('0x1c')]=qs['offset'](_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x1c')]);}_0x43476c[_0xf0ab('0x38')]=qs['sort'](_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x39')]);_0x43476c[_0xf0ab('0x3a')]=qs['filters'](_[_0xf0ab('0x3b')](_0x1b223d['query'],_0x174052[_0xf0ab('0x3c')]),_0x14da9c);if(_0x1b223d['query'][_0xf0ab('0x3d')]){_0x43476c[_0xf0ab('0x3a')]=_[_0xf0ab('0x3e')](_0x43476c[_0xf0ab('0x3a')],{'$or':_[_0xf0ab('0x2a')](_0x14da9c,function(_0x1dfb2e){if(_0x1dfb2e['type']!==_0xf0ab('0x3f')){var _0x683d08={};_0x683d08[_0x1dfb2e['name']]={'$like':'%'+_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x3d')]+'%'};return _0x683d08;}})});}_0x43476c=_[_0xf0ab('0x3e')]({},_0x43476c,_0x1b223d[_0xf0ab('0x40')]);var _0x31fa72={'where':_0x43476c[_0xf0ab('0x3a')]};return db[_0xf0ab('0x2b')]['count'](_0x31fa72)[_0xf0ab('0x25')](function(_0x4f6e93){_0x367302[_0xf0ab('0x1e')]=_0x4f6e93;if(_0x1b223d['query'][_0xf0ab('0x41')]){_0x43476c[_0xf0ab('0x42')]=[{'all':!![]}];}return db[_0xf0ab('0x2b')][_0xf0ab('0x43')](_0x43476c);})[_0xf0ab('0x25')](function(_0x553d07){_0x367302[_0xf0ab('0x44')]=_0x553d07;return _0x367302;})[_0xf0ab('0x25')](respondWithFilteredResult(_0x445160,_0x43476c))[_0xf0ab('0x45')](handleError(_0x445160,null));};exports[_0xf0ab('0x46')]=function(_0x191caf,_0x17a73){var _0x45849c={'raw':![],'where':{'id':_0x191caf[_0xf0ab('0x47')]['id']}},_0x413f5c={};_0x413f5c[_0xf0ab('0x32')]=_[_0xf0ab('0x30')](db[_0xf0ab('0x2b')][_0xf0ab('0x2c')]);_0x413f5c['query']=_['keys'](_0x191caf[_0xf0ab('0x2f')]);_0x413f5c['filters']=_[_0xf0ab('0x31')](_0x413f5c[_0xf0ab('0x32')],_0x413f5c['query']);_0x45849c[_0xf0ab('0x34')]=_[_0xf0ab('0x31')](_0x413f5c['model'],qs[_0xf0ab('0x33')](_0x191caf[_0xf0ab('0x2f')][_0xf0ab('0x33')]));_0x45849c[_0xf0ab('0x34')]=_0x45849c[_0xf0ab('0x34')][_0xf0ab('0x35')]?_0x45849c[_0xf0ab('0x34')]:_0x413f5c[_0xf0ab('0x32')];if(_0x191caf[_0xf0ab('0x2f')][_0xf0ab('0x41')]){_0x45849c[_0xf0ab('0x42')]=[{'all':!![]}];}_0x45849c=_[_0xf0ab('0x3e')]({},_0x45849c,_0x191caf[_0xf0ab('0x40')]);return db[_0xf0ab('0x2b')]['find'](_0x45849c)['then'](handleEntityNotFound(_0x17a73,null))[_0xf0ab('0x25')](respondWithResult(_0x17a73,null))['catch'](handleError(_0x17a73,null));};exports['create']=function(_0x4e57d3,_0xc3b68d){return db[_0xf0ab('0x2b')][_0xf0ab('0x48')](_0x4e57d3[_0xf0ab('0x49')],{})[_0xf0ab('0x25')](respondWithResult(_0xc3b68d,0xc9))[_0xf0ab('0x45')](handleError(_0xc3b68d,null));};exports[_0xf0ab('0x24')]=function(_0x1a0f21,_0xc6862b){if(_0x1a0f21[_0xf0ab('0x49')]['id']){delete _0x1a0f21[_0xf0ab('0x49')]['id'];}return db[_0xf0ab('0x2b')]['find']({'where':{'id':_0x1a0f21[_0xf0ab('0x47')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0xc6862b,null))[_0xf0ab('0x25')](saveUpdates(_0x1a0f21[_0xf0ab('0x49')],null))[_0xf0ab('0x25')](respondWithResult(_0xc6862b,null))[_0xf0ab('0x45')](handleError(_0xc6862b,null));};exports[_0xf0ab('0x4a')]=function(_0x2e6c5e,_0x47f564){return db['ZendeskAccount']['find']({'where':{'id':_0x2e6c5e[_0xf0ab('0x47')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0x47f564,null))['then'](removeEntity(_0x47f564,null))[_0xf0ab('0x45')](handleError(_0x47f564,null));};exports[_0xf0ab('0x4b')]=function(_0x4edb01,_0x1a9981,_0x53d6a4){var _0x1352ac={};var _0xe4ef6d={};var _0x187389;var _0x33112b;return db[_0xf0ab('0x2b')]['findOne']({'where':{'id':_0x4edb01[_0xf0ab('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a9981,null))[_0xf0ab('0x25')](function(_0x4c9d2b){if(_0x4c9d2b){_0x187389=_0x4c9d2b;_0xe4ef6d[_0xf0ab('0x32')]=_['keys'](db['ZendeskConfiguration'][_0xf0ab('0x2c')]);_0xe4ef6d['query']=_[_0xf0ab('0x30')](_0x4edb01['query']);_0xe4ef6d[_0xf0ab('0x3c')]=_['intersection'](_0xe4ef6d[_0xf0ab('0x32')],_0xe4ef6d[_0xf0ab('0x2f')]);_0x1352ac[_0xf0ab('0x34')]=_['intersection'](_0xe4ef6d['model'],qs['fields'](_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x33')]));_0x1352ac['attributes']=_0x1352ac['attributes'][_0xf0ab('0x35')]?_0x1352ac[_0xf0ab('0x34')]:_0xe4ef6d[_0xf0ab('0x32')];_0x1352ac[_0xf0ab('0x38')]=qs[_0xf0ab('0x39')](_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x39')]);_0x1352ac[_0xf0ab('0x3a')]=qs[_0xf0ab('0x3c')](_[_0xf0ab('0x3b')](_0x4edb01[_0xf0ab('0x2f')],_0xe4ef6d['filters']));if(_0x4edb01[_0xf0ab('0x2f')]['filter']){_0x1352ac[_0xf0ab('0x3a')]=_[_0xf0ab('0x3e')](_0x1352ac[_0xf0ab('0x3a')],{'$or':_[_0xf0ab('0x2a')](_0x1352ac[_0xf0ab('0x34')],function(_0x3c168f){var _0x152e80={};_0x152e80[_0x3c168f]={'$like':'%'+_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x3d')]+'%'};return _0x152e80;})});}_0x1352ac=_[_0xf0ab('0x3e')]({},_0x1352ac,_0x4edb01['options']);return _0x187389[_0xf0ab('0x4b')](_0x1352ac);}})[_0xf0ab('0x25')](function(_0x4062b7){if(_0x4062b7){_0x33112b=_0x4062b7[_0xf0ab('0x35')];if(!_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x36')](_0xf0ab('0x37'))){_0x1352ac[_0xf0ab('0x1f')]=qs[_0xf0ab('0x1f')](_0x4edb01['query']['limit']);_0x1352ac[_0xf0ab('0x1c')]=qs[_0xf0ab('0x1c')](_0x4edb01[_0xf0ab('0x2f')]['offset']);}return _0x187389[_0xf0ab('0x4b')](_0x1352ac);}})[_0xf0ab('0x25')](function(_0xd61dcf){if(_0xd61dcf){return _0xd61dcf?{'count':_0x33112b,'rows':_0xd61dcf}:null;}})['then'](respondWithResult(_0x1a9981,null))[_0xf0ab('0x45')](handleError(_0x1a9981,null));};exports[_0xf0ab('0x4c')]=function(_0x3fc57e,_0x3d333f,_0x23f4f8){if(_0x3fc57e['body']['id']){delete _0x3fc57e[_0xf0ab('0x49')]['id'];}return db[_0xf0ab('0x2b')][_0xf0ab('0x4d')]({'where':{'id':_0x3fc57e[_0xf0ab('0x47')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0x3d333f,null))[_0xf0ab('0x25')](function(_0xe3fc19){if(_0xe3fc19){_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x4e')]=_0xe3fc19['id'];_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x4f')]=integrations[_0xf0ab('0x50')](_0x3fc57e[_0xf0ab('0x49')]['channel'],_0x3fc57e['body'][_0xf0ab('0x2d')]);_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x51')]=integrations['getDescriptions'](_0x3fc57e[_0xf0ab('0x49')]['channel'],_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x2d')]);return db[_0xf0ab('0x52')]['create'](_0x3fc57e[_0xf0ab('0x49')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0xf0ab('0x53')],'as':_0xf0ab('0x51')}]});}return null;})[_0xf0ab('0x25')](respondWithResult(_0x3d333f,null))['catch'](handleError(_0x3d333f,null));};exports[_0xf0ab('0x54')]=function(_0x92ade0,_0x1035b3,_0x122c41){var _0x5b6923='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x92ade0[_0xf0ab('0x47')]['id']},'attributes':['id',_0xf0ab('0x55'),_0xf0ab('0x56'),_0xf0ab('0x57'),_0xf0ab('0x58'),_0xf0ab('0x59')]})[_0xf0ab('0x25')](handleEntityNotFound(_0x1035b3,null))[_0xf0ab('0x25')](function(_0x3119d1){if(_0x3119d1){_0x5b6923=_0x3119d1[_0xf0ab('0x59')];var _0x228334=_0x5b6923['slice'](-0x1);if(_0x228334==='/'){_0x5b6923=_0x5b6923[_0xf0ab('0x5a')](0x0,_0x5b6923[_0xf0ab('0x5b')](_0x228334));}var _0x24e4f5={'method':_0xf0ab('0x5c'),'uri':util[_0xf0ab('0x5d')](_0xf0ab('0x5e'),_0x5b6923,_0xf0ab('0x5f')),'json':!![]};switch(_0x3119d1[_0xf0ab('0x58')]){case'password':_0x24e4f5[_0xf0ab('0x60')]={'Authorization':util[_0xf0ab('0x5d')]('Basic\x20%s',new Buffer(util['format']('%s:%s',_0x3119d1[_0xf0ab('0x55')],_0x3119d1[_0xf0ab('0x56')]))[_0xf0ab('0x61')](_0xf0ab('0x62')))};break;case _0xf0ab('0x57'):_0x24e4f5[_0xf0ab('0x60')]={'Authorization':util['format'](_0xf0ab('0x63'),new Buffer(util['format'](_0xf0ab('0x64'),_0x3119d1['username'],_0x3119d1[_0xf0ab('0x57')]))['toString'](_0xf0ab('0x62')))};break;default:throw new db['Sequelize']['ValidationError'](_0xf0ab('0x65'));}return rp(_0x24e4f5);}})[_0xf0ab('0x25')](function(_0x1f37a2){if(_0x1f37a2){var _0xd96ca8=[_0xf0ab('0x66'),_0xf0ab('0x67'),_0xf0ab('0x68'),_0xf0ab('0x69')];_[_0xf0ab('0x6a')](_0x1f37a2[_0xf0ab('0x5f')],function(_0x1650c0){return _0xd96ca8[_0xf0ab('0x6b')](_0x1650c0[_0xf0ab('0x2d')]);});return{'count':_0x1f37a2['ticket_fields'][_0xf0ab('0x35')],'rows':_[_0xf0ab('0x2a')](_0x1f37a2[_0xf0ab('0x5f')],function(_0x12acef){return{'id':_0x12acef['id'],'name':_0x12acef[_0xf0ab('0x6c')]>0x7?_0x12acef[_0xf0ab('0x6d')]:_0x12acef[_0xf0ab('0x2d')],'custom':_0x12acef[_0xf0ab('0x6c')]>0x7?!![]:![],'options':_0x12acef[_0xf0ab('0x6e')]?_0x12acef[_0xf0ab('0x6e')]:_0x12acef[_0xf0ab('0x6f')]?_0x12acef[_0xf0ab('0x6f')]:[]};})};}})['then'](respondWithResult(_0x1035b3,null))[_0xf0ab('0x45')](function(_0x1f18cd){var _0x3221ff=_0x92ade0[_0xf0ab('0x2f')]['test']?0x1f4:_0x1f18cd[_0xf0ab('0x70')]||0x1f4;logger[_0xf0ab('0x26')](_0xf0ab('0x71'),_0xf0ab('0x54'),_0x3221ff,JSON[_0xf0ab('0x72')](_0x1f18cd));delete _0x1f18cd['name'];if(_0x3221ff===0x191){_0x3221ff=0x190;}_0x1035b3[_0xf0ab('0x19')](_0x3221ff)[_0xf0ab('0x28')](_0x92ade0['query'][_0xf0ab('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x1f18cd[_0xf0ab('0x70')]}:_0x1f18cd);});}; \ No newline at end of file +var _0xe1e3=['assignee','remove','includes','position','title','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','end','json','undefined','count','offset','status','set','apply','save','then','destroy','name','send','ZendeskAccount','type','map','query','keys','attributes','intersection','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','update','ZendeskConfiguration','length','getConfigurations','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','findOne','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','username','base64','headers','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','group'];(function(_0x45b962,_0x4aa1d5){var _0x59dc7d=function(_0x5f2f84){while(--_0x5f2f84){_0x45b962['push'](_0x45b962['shift']());}};_0x59dc7d(++_0x4aa1d5);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x12d1cb,_0x4ad88e){_0x12d1cb=_0x12d1cb-0x0;var _0x4437bb=_0xe1e3[_0x12d1cb];return _0x4437bb;};'use strict';var emlformat=require(_0x3e1e('0x0'));var rimraf=require(_0x3e1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e1e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e1e('0x3'));var Mustache=require('mustache');var util=require(_0x3e1e('0x4'));var path=require(_0x3e1e('0x5'));var sox=require(_0x3e1e('0x6'));var csv=require(_0x3e1e('0x7'));var ejs=require(_0x3e1e('0x8'));var fs=require('fs');var fs_extra=require(_0x3e1e('0x9'));var _=require('lodash');var squel=require(_0x3e1e('0xa'));var crypto=require(_0x3e1e('0xb'));var jsforce=require(_0x3e1e('0xc'));var deskjs=require(_0x3e1e('0xd'));var toCsv=require(_0x3e1e('0x7'));var querystring=require(_0x3e1e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e1e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e1e('0x10'));var logger=require(_0x3e1e('0x11'))(_0x3e1e('0x12'));var utils=require('../../config/utils');var config=require(_0x3e1e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x536129,_0x5c09a2){_0x5c09a2=_0x5c09a2||0xcc;return function(_0x14ad58){if(_0x14ad58){return _0x536129['sendStatus'](_0x5c09a2);}return _0x536129['status'](_0x5c09a2)[_0x3e1e('0x14')]();};}function respondWithResult(_0x8bd4cd,_0x78ee54){_0x78ee54=_0x78ee54||0xc8;return function(_0x50f221){if(_0x50f221){return _0x8bd4cd['status'](_0x78ee54)[_0x3e1e('0x15')](_0x50f221);}};}function respondWithFilteredResult(_0x1b62e6,_0x4dca60){return function(_0x26cb35){if(_0x26cb35){var _0x1f0af9=typeof _0x4dca60['offset']===_0x3e1e('0x16')&&typeof _0x4dca60['limit']===_0x3e1e('0x16');var _0x247daa=_0x26cb35[_0x3e1e('0x17')];var _0x39eaa7=_0x1f0af9?0x0:_0x4dca60[_0x3e1e('0x18')];var _0x1c181b=_0x1f0af9?_0x26cb35['count']:_0x4dca60['offset']+_0x4dca60['limit'];var _0x428e4e;if(_0x1c181b>=_0x247daa){_0x1c181b=_0x247daa;_0x428e4e=0xc8;}else{_0x428e4e=0xce;}_0x1b62e6[_0x3e1e('0x19')](_0x428e4e);return _0x1b62e6[_0x3e1e('0x1a')]('Content-Range',_0x39eaa7+'-'+_0x1c181b+'/'+_0x247daa)[_0x3e1e('0x15')](_0x26cb35);}return null;};}function patchUpdates(_0x530815){return function(_0x228991){try{jsonpatch[_0x3e1e('0x1b')](_0x228991,_0x530815,!![]);}catch(_0x474085){return BPromise['reject'](_0x474085);}return _0x228991[_0x3e1e('0x1c')]();};}function saveUpdates(_0x96396,_0xefa098){return function(_0x55dc62){if(_0x55dc62){return _0x55dc62['update'](_0x96396)[_0x3e1e('0x1d')](function(_0x1b5097){return _0x1b5097;});}return null;};}function removeEntity(_0x488f9f,_0x60e6bc){return function(_0x56ae51){if(_0x56ae51){return _0x56ae51[_0x3e1e('0x1e')]()[_0x3e1e('0x1d')](function(){_0x488f9f[_0x3e1e('0x19')](0xcc)[_0x3e1e('0x14')]();});}};}function handleEntityNotFound(_0x43d583,_0x21c898){return function(_0x4ee2b5){if(!_0x4ee2b5){_0x43d583['sendStatus'](0x194);}return _0x4ee2b5;};}function handleError(_0x44e419,_0x541ef1){_0x541ef1=_0x541ef1||0x1f4;return function(_0x55db8f){logger['error'](_0x55db8f['stack']);if(_0x55db8f[_0x3e1e('0x1f')]){delete _0x55db8f[_0x3e1e('0x1f')];}_0x44e419['status'](_0x541ef1)[_0x3e1e('0x20')](_0x55db8f);};}exports['index']=function(_0xdfcd93,_0x176bb4){var _0x53a6ff={},_0x43e029={},_0x210a84={'count':0x0,'rows':[]};var _0x45ed0e=_['map'](db[_0x3e1e('0x21')]['rawAttributes'],function(_0x591c36){return{'name':_0x591c36['fieldName'],'type':_0x591c36[_0x3e1e('0x22')]['key']};});_0x43e029['model']=_[_0x3e1e('0x23')](_0x45ed0e,_0x3e1e('0x1f'));_0x43e029[_0x3e1e('0x24')]=_[_0x3e1e('0x25')](_0xdfcd93[_0x3e1e('0x24')]);_0x43e029['filters']=_['intersection'](_0x43e029['model'],_0x43e029['query']);_0x53a6ff[_0x3e1e('0x26')]=_[_0x3e1e('0x27')](_0x43e029[_0x3e1e('0x28')],qs[_0x3e1e('0x29')](_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x29')]));_0x53a6ff[_0x3e1e('0x26')]=_0x53a6ff[_0x3e1e('0x26')]['length']?_0x53a6ff[_0x3e1e('0x26')]:_0x43e029[_0x3e1e('0x28')];if(!_0xdfcd93['query'][_0x3e1e('0x2a')](_0x3e1e('0x2b'))){_0x53a6ff[_0x3e1e('0x2c')]=qs[_0x3e1e('0x2c')](_0xdfcd93['query']['limit']);_0x53a6ff[_0x3e1e('0x18')]=qs[_0x3e1e('0x18')](_0xdfcd93['query'][_0x3e1e('0x18')]);}_0x53a6ff[_0x3e1e('0x2d')]=qs['sort'](_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x2e')]);_0x53a6ff[_0x3e1e('0x2f')]=qs[_0x3e1e('0x30')](_[_0x3e1e('0x31')](_0xdfcd93['query'],_0x43e029[_0x3e1e('0x30')]),_0x45ed0e);if(_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x32')]){_0x53a6ff[_0x3e1e('0x2f')]=_['merge'](_0x53a6ff[_0x3e1e('0x2f')],{'$or':_[_0x3e1e('0x23')](_0x45ed0e,function(_0x111da4){if(_0x111da4[_0x3e1e('0x22')]!==_0x3e1e('0x33')){var _0x25a95b={};_0x25a95b[_0x111da4[_0x3e1e('0x1f')]]={'$like':'%'+_0xdfcd93['query'][_0x3e1e('0x32')]+'%'};return _0x25a95b;}})});}_0x53a6ff=_['merge']({},_0x53a6ff,_0xdfcd93['options']);var _0x4f598e={'where':_0x53a6ff[_0x3e1e('0x2f')]};return db[_0x3e1e('0x21')]['count'](_0x4f598e)[_0x3e1e('0x1d')](function(_0xb030eb){_0x210a84['count']=_0xb030eb;if(_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x34')]){_0x53a6ff['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x3e1e('0x35')](_0x53a6ff);})['then'](function(_0x4ff868){_0x210a84[_0x3e1e('0x36')]=_0x4ff868;return _0x210a84;})[_0x3e1e('0x1d')](respondWithFilteredResult(_0x176bb4,_0x53a6ff))[_0x3e1e('0x37')](handleError(_0x176bb4,null));};exports[_0x3e1e('0x38')]=function(_0x377a06,_0x55ea1d){var _0x5b32ad={'raw':![],'where':{'id':_0x377a06[_0x3e1e('0x39')]['id']}},_0x24b2ad={};_0x24b2ad[_0x3e1e('0x28')]=_['keys'](db[_0x3e1e('0x21')][_0x3e1e('0x3a')]);_0x24b2ad[_0x3e1e('0x24')]=_['keys'](_0x377a06[_0x3e1e('0x24')]);_0x24b2ad['filters']=_['intersection'](_0x24b2ad[_0x3e1e('0x28')],_0x24b2ad[_0x3e1e('0x24')]);_0x5b32ad[_0x3e1e('0x26')]=_[_0x3e1e('0x27')](_0x24b2ad['model'],qs['fields'](_0x377a06['query']['fields']));_0x5b32ad[_0x3e1e('0x26')]=_0x5b32ad[_0x3e1e('0x26')]['length']?_0x5b32ad['attributes']:_0x24b2ad[_0x3e1e('0x28')];if(_0x377a06[_0x3e1e('0x24')][_0x3e1e('0x34')]){_0x5b32ad['include']=[{'all':!![]}];}_0x5b32ad=_[_0x3e1e('0x3b')]({},_0x5b32ad,_0x377a06['options']);return db[_0x3e1e('0x21')][_0x3e1e('0x3c')](_0x5b32ad)[_0x3e1e('0x1d')](handleEntityNotFound(_0x55ea1d,null))[_0x3e1e('0x1d')](respondWithResult(_0x55ea1d,null))[_0x3e1e('0x37')](handleError(_0x55ea1d,null));};exports[_0x3e1e('0x3d')]=function(_0x53d32b,_0x2f14b3){return db[_0x3e1e('0x21')]['create'](_0x53d32b[_0x3e1e('0x3e')],{})[_0x3e1e('0x1d')](respondWithResult(_0x2f14b3,0xc9))['catch'](handleError(_0x2f14b3,null));};exports[_0x3e1e('0x3f')]=function(_0x347b3f,_0x2e286f){if(_0x347b3f[_0x3e1e('0x3e')]['id']){delete _0x347b3f['body']['id'];}return db[_0x3e1e('0x21')][_0x3e1e('0x3c')]({'where':{'id':_0x347b3f[_0x3e1e('0x39')]['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x2e286f,null))['then'](saveUpdates(_0x347b3f[_0x3e1e('0x3e')],null))[_0x3e1e('0x1d')](respondWithResult(_0x2e286f,null))[_0x3e1e('0x37')](handleError(_0x2e286f,null));};exports[_0x3e1e('0x1e')]=function(_0xe2516c,_0x1df5a8){return db[_0x3e1e('0x21')][_0x3e1e('0x3c')]({'where':{'id':_0xe2516c['params']['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x1df5a8,null))['then'](removeEntity(_0x1df5a8,null))['catch'](handleError(_0x1df5a8,null));};exports['getConfigurations']=function(_0x1c4269,_0x17641c,_0x5147a2){var _0x13b076={};var _0x592733={};var _0x5b2416;var _0x3eaf76;return db['ZendeskAccount']['findOne']({'where':{'id':_0x1c4269['params']['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x17641c,null))[_0x3e1e('0x1d')](function(_0x1334c8){if(_0x1334c8){_0x5b2416=_0x1334c8;_0x592733[_0x3e1e('0x28')]=_[_0x3e1e('0x25')](db[_0x3e1e('0x40')][_0x3e1e('0x3a')]);_0x592733['query']=_[_0x3e1e('0x25')](_0x1c4269['query']);_0x592733[_0x3e1e('0x30')]=_[_0x3e1e('0x27')](_0x592733[_0x3e1e('0x28')],_0x592733['query']);_0x13b076['attributes']=_[_0x3e1e('0x27')](_0x592733[_0x3e1e('0x28')],qs['fields'](_0x1c4269[_0x3e1e('0x24')]['fields']));_0x13b076['attributes']=_0x13b076[_0x3e1e('0x26')][_0x3e1e('0x41')]?_0x13b076['attributes']:_0x592733[_0x3e1e('0x28')];_0x13b076['order']=qs['sort'](_0x1c4269[_0x3e1e('0x24')]['sort']);_0x13b076[_0x3e1e('0x2f')]=qs['filters'](_[_0x3e1e('0x31')](_0x1c4269['query'],_0x592733[_0x3e1e('0x30')]));if(_0x1c4269[_0x3e1e('0x24')]['filter']){_0x13b076['where']=_['merge'](_0x13b076[_0x3e1e('0x2f')],{'$or':_[_0x3e1e('0x23')](_0x13b076[_0x3e1e('0x26')],function(_0x588189){var _0x1b04ce={};_0x1b04ce[_0x588189]={'$like':'%'+_0x1c4269[_0x3e1e('0x24')][_0x3e1e('0x32')]+'%'};return _0x1b04ce;})});}_0x13b076=_['merge']({},_0x13b076,_0x1c4269['options']);return _0x5b2416[_0x3e1e('0x42')](_0x13b076);}})['then'](function(_0x3b97a2){if(_0x3b97a2){_0x3eaf76=_0x3b97a2[_0x3e1e('0x41')];if(!_0x1c4269[_0x3e1e('0x24')]['hasOwnProperty'](_0x3e1e('0x2b'))){_0x13b076['limit']=qs[_0x3e1e('0x2c')](_0x1c4269[_0x3e1e('0x24')]['limit']);_0x13b076[_0x3e1e('0x18')]=qs['offset'](_0x1c4269[_0x3e1e('0x24')]['offset']);}return _0x5b2416[_0x3e1e('0x42')](_0x13b076);}})['then'](function(_0x31062e){if(_0x31062e){return _0x31062e?{'count':_0x3eaf76,'rows':_0x31062e}:null;}})[_0x3e1e('0x1d')](respondWithResult(_0x17641c,null))[_0x3e1e('0x37')](handleError(_0x17641c,null));};exports['addConfiguration']=function(_0x11cab1,_0x1fbcfc,_0x4e6957){if(_0x11cab1[_0x3e1e('0x3e')]['id']){delete _0x11cab1['body']['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x11cab1[_0x3e1e('0x39')]['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x1fbcfc,null))[_0x3e1e('0x1d')](function(_0x4b0944){if(_0x4b0944){_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x43')]=_0x4b0944['id'];_0x11cab1[_0x3e1e('0x3e')]['Subjects']=integrations[_0x3e1e('0x44')](_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x45')],_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x22')]);_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x46')]=integrations[_0x3e1e('0x47')](_0x11cab1['body']['channel'],_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x22')]);return db[_0x3e1e('0x40')][_0x3e1e('0x3d')](_0x11cab1[_0x3e1e('0x3e')],{'include':[{'model':db[_0x3e1e('0x48')],'as':_0x3e1e('0x49')},{'model':db[_0x3e1e('0x48')],'as':_0x3e1e('0x46')}]});}return null;})[_0x3e1e('0x1d')](respondWithResult(_0x1fbcfc,null))[_0x3e1e('0x37')](handleError(_0x1fbcfc,null));};exports[_0x3e1e('0x4a')]=function(_0x5e148e,_0x5581ee,_0x20bc4d){var _0x29ddc4='';return db[_0x3e1e('0x21')][_0x3e1e('0x4b')]({'where':{'id':_0x5e148e[_0x3e1e('0x39')]['id']},'attributes':['id','username',_0x3e1e('0x4c'),_0x3e1e('0x4d'),_0x3e1e('0x4e'),_0x3e1e('0x4f')]})[_0x3e1e('0x1d')](handleEntityNotFound(_0x5581ee,null))['then'](function(_0x8b6b28){if(_0x8b6b28){_0x29ddc4=_0x8b6b28[_0x3e1e('0x4f')];var _0xc60340=_0x29ddc4[_0x3e1e('0x50')](-0x1);if(_0xc60340==='/'){_0x29ddc4=_0x29ddc4[_0x3e1e('0x51')](0x0,_0x29ddc4[_0x3e1e('0x52')](_0xc60340));}var _0x4d0854={'method':_0x3e1e('0x53'),'uri':util[_0x3e1e('0x54')](_0x3e1e('0x55'),_0x29ddc4,_0x3e1e('0x56')),'json':!![]};switch(_0x8b6b28[_0x3e1e('0x4e')]){case _0x3e1e('0x4c'):_0x4d0854['headers']={'Authorization':util[_0x3e1e('0x54')](_0x3e1e('0x57'),new Buffer(util[_0x3e1e('0x54')](_0x3e1e('0x58'),_0x8b6b28[_0x3e1e('0x59')],_0x8b6b28[_0x3e1e('0x4c')]))['toString'](_0x3e1e('0x5a')))};break;case'token':_0x4d0854[_0x3e1e('0x5b')]={'Authorization':util[_0x3e1e('0x54')]('Basic\x20%s',new Buffer(util[_0x3e1e('0x54')](_0x3e1e('0x5c'),_0x8b6b28[_0x3e1e('0x59')],_0x8b6b28[_0x3e1e('0x4d')]))['toString'](_0x3e1e('0x5a')))};break;default:throw new db['Sequelize'][(_0x3e1e('0x5d'))](_0x3e1e('0x5e'));}return rp(_0x4d0854);}})[_0x3e1e('0x1d')](function(_0x632f99){if(_0x632f99){var _0x2ef476=[_0x3e1e('0x5f'),'description',_0x3e1e('0x60'),_0x3e1e('0x61')];_[_0x3e1e('0x62')](_0x632f99[_0x3e1e('0x56')],function(_0x4b4fd4){return _0x2ef476[_0x3e1e('0x63')](_0x4b4fd4[_0x3e1e('0x22')]);});return{'count':_0x632f99[_0x3e1e('0x56')][_0x3e1e('0x41')],'rows':_['map'](_0x632f99[_0x3e1e('0x56')],function(_0x41d98f){return{'id':_0x41d98f['id'],'name':_0x41d98f[_0x3e1e('0x64')]>0x7?_0x41d98f[_0x3e1e('0x65')]:_0x41d98f[_0x3e1e('0x22')],'custom':_0x41d98f[_0x3e1e('0x64')]>0x7?!![]:![],'options':_0x41d98f['system_field_options']?_0x41d98f['system_field_options']:_0x41d98f['custom_field_options']?_0x41d98f[_0x3e1e('0x66')]:[]};})};}})['then'](respondWithResult(_0x5581ee,null))[_0x3e1e('0x37')](function(_0x5f436f){var _0x32b5ef=_0x5e148e[_0x3e1e('0x24')][_0x3e1e('0x67')]?0x1f4:_0x5f436f[_0x3e1e('0x68')]||0x1f4;logger['error'](_0x3e1e('0x69'),'getFields',_0x32b5ef,JSON[_0x3e1e('0x6a')](_0x5f436f));delete _0x5f436f['name'];if(_0x32b5ef===0x191){_0x32b5ef=0x190;}_0x5581ee[_0x3e1e('0x19')](_0x32b5ef)[_0x3e1e('0x20')](_0x5e148e['query'][_0x3e1e('0x67')]?{'message':_0x3e1e('0x6b'),'statusCode':_0x5f436f[_0x3e1e('0x68')]}:_0x5f436f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 92e7699..7969af5 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 _0x0094=['util','../../config/logger','moment','bluebird','request-promise','path','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','lodash'];(function(_0x3fefc0,_0x1e8777){var _0x41129a=function(_0x50592f){while(--_0x50592f){_0x3fefc0['push'](_0x3fefc0['shift']());}};_0x41129a(++_0x1e8777);}(_0x0094,0x6d));var _0x4009=function(_0x1877d1,_0x249005){_0x1877d1=_0x1877d1-0x0;var _0x58e483=_0x0094[_0x1877d1];return _0x58e483;};'use strict';var _=require(_0x4009('0x0'));var util=require(_0x4009('0x1'));var logger=require(_0x4009('0x2'))('api');var moment=require(_0x4009('0x3'));var BPromise=require(_0x4009('0x4'));var rp=require(_0x4009('0x5'));var fs=require('fs');var path=require(_0x4009('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4009('0x7'));var integrations=require(_0x4009('0x8'));module['exports']=function(_0x459c99,_0x20ebd9){return _0x459c99[_0x4009('0x9')](_0x4009('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59a7=['exports','define','int_zendesk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x1d8fde,_0xaa0599){var _0x37ea1b=function(_0x5df7c1){while(--_0x5df7c1){_0x1d8fde['push'](_0x1d8fde['shift']());}};_0x37ea1b(++_0xaa0599);}(_0x59a7,0x1b0));var _0x759a=function(_0x1903aa,_0x343458){_0x1903aa=_0x1903aa-0x0;var _0x51fe28=_0x59a7[_0x1903aa];return _0x51fe28;};'use strict';var _=require(_0x759a('0x0'));var util=require(_0x759a('0x1'));var logger=require('../../config/logger')(_0x759a('0x2'));var moment=require(_0x759a('0x3'));var BPromise=require(_0x759a('0x4'));var rp=require(_0x759a('0x5'));var fs=require('fs');var path=require(_0x759a('0x6'));var rimraf=require(_0x759a('0x7'));var config=require('../../config/environment');var attributes=require(_0x759a('0x8'));var integrations=require(_0x759a('0x9'));module[_0x759a('0xa')]=function(_0x401aab,_0x3b3042){return _0x401aab[_0x759a('0xb')]('ZendeskAccount',attributes,{'tableName':_0x759a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index f71a254..aa119d0 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 _0x03e2=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','where','include','map','model','attributes','then','find','raw','ShowZendeskAccount'];(function(_0x375f41,_0x35e741){var _0x8757a8=function(_0x41b292){while(--_0x41b292){_0x375f41['push'](_0x375f41['shift']());}};_0x8757a8(++_0x35e741);}(_0x03e2,0x119));var _0x203e=function(_0x47fc43,_0x135e46){_0x47fc43=_0x47fc43-0x0;var _0x5ebe93=_0x03e2[_0x47fc43];return _0x5ebe93;};'use strict';var _=require('lodash');var util=require(_0x203e('0x0'));var moment=require(_0x203e('0x1'));var BPromise=require(_0x203e('0x2'));var rs=require(_0x203e('0x3'));var fs=require('fs');var Redis=require(_0x203e('0x4'));var db=require(_0x203e('0x5'))['db'];var utils=require(_0x203e('0x6'));var logger=require(_0x203e('0x7'))(_0x203e('0x8'));var config=require('../../config/environment');var jayson=require(_0x203e('0x9'));var client=jayson[_0x203e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b451f,_0x14e722,_0x4c3935){return new BPromise(function(_0x122f3c,_0x118785){return client[_0x203e('0xb')](_0x1b451f,_0x4c3935)['then'](function(_0x3fe44d){logger[_0x203e('0xc')](_0x203e('0xd'),_0x14e722,_0x203e('0xe'));logger[_0x203e('0xf')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x14e722,_0x203e('0xe'),JSON[_0x203e('0x10')](_0x3fe44d));if(_0x3fe44d[_0x203e('0x11')]){if(_0x3fe44d[_0x203e('0x11')][_0x203e('0x12')]===0x1f4){logger[_0x203e('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x14e722,_0x3fe44d['error'][_0x203e('0x13')]);return _0x118785(_0x3fe44d[_0x203e('0x11')][_0x203e('0x13')]);}logger[_0x203e('0x11')](_0x203e('0xd'),_0x14e722,_0x3fe44d[_0x203e('0x11')][_0x203e('0x13')]);return _0x122f3c(_0x3fe44d['error'][_0x203e('0x13')]);}else{logger['info'](_0x203e('0xd'),_0x14e722,_0x203e('0xe'));_0x122f3c(_0x3fe44d[_0x203e('0x14')]['message']);}})['catch'](function(_0x3cce10){logger[_0x203e('0x11')](_0x203e('0xd'),_0x14e722,_0x3cce10);_0x118785(_0x3cce10);});});}exports[_0x203e('0x15')]=function(_0x3ea2b0){var _0xe52db6=this;return new Promise(function(_0x15b0ac,_0x1d5535){return db[_0x203e('0x16')][_0x203e('0x17')]({'raw':_0x3ea2b0[_0x203e('0x18')]?_0x3ea2b0[_0x203e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3ea2b0[_0x203e('0x18')]?_0x3ea2b0['options'][_0x203e('0x19')]||null:null,'attributes':_0x3ea2b0[_0x203e('0x18')]?_0x3ea2b0[_0x203e('0x18')]['attributes']||null:null,'limit':_0x3ea2b0[_0x203e('0x18')]?_0x3ea2b0[_0x203e('0x18')]['limit']||null:null,'include':_0x3ea2b0[_0x203e('0x18')]?_0x3ea2b0[_0x203e('0x18')][_0x203e('0x1a')]?_[_0x203e('0x1b')](_0x3ea2b0[_0x203e('0x18')]['include'],function(_0x31520e){return{'model':db[_0x31520e[_0x203e('0x1c')]],'as':_0x31520e['as'],'attributes':_0x31520e['attributes'],'include':_0x31520e['include']?_[_0x203e('0x1b')](_0x31520e[_0x203e('0x1a')],function(_0x47e294){return{'model':db[_0x47e294['model']],'as':_0x47e294['as'],'attributes':_0x47e294[_0x203e('0x1d')],'include':_0x47e294[_0x203e('0x1a')]?_[_0x203e('0x1b')](_0x47e294['include'],function(_0x585038){return{'model':db[_0x585038[_0x203e('0x1c')]],'as':_0x585038['as'],'attributes':_0x585038[_0x203e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x203e('0x1e')](function(_0x12d5ab){logger[_0x203e('0xc')](_0x203e('0x15'),_0x3ea2b0);logger[_0x203e('0xf')](_0x203e('0x15'),_0x3ea2b0,JSON['stringify'](_0x12d5ab));_0x15b0ac(_0x12d5ab);})['catch'](function(_0x2a5141){logger[_0x203e('0x11')](_0x203e('0x15'),_0x2a5141[_0x203e('0x13')],_0x3ea2b0);_0x1d5535(_0xe52db6[_0x203e('0x11')](0x1f4,_0x2a5141['message']));});});};exports['ShowZendeskAccount']=function(_0x400c8f){var _0x2d152e=this;return new Promise(function(_0x2a10f7,_0x3d47f0){return db[_0x203e('0x16')][_0x203e('0x1f')]({'raw':_0x400c8f['options']?_0x400c8f[_0x203e('0x18')][_0x203e('0x20')]===undefined?!![]:![]:!![],'where':_0x400c8f['options']?_0x400c8f['options'][_0x203e('0x19')]||null:null,'attributes':_0x400c8f['options']?_0x400c8f['options'][_0x203e('0x1d')]||null:null,'include':_0x400c8f[_0x203e('0x18')]?_0x400c8f[_0x203e('0x18')][_0x203e('0x1a')]?_[_0x203e('0x1b')](_0x400c8f[_0x203e('0x18')][_0x203e('0x1a')],function(_0x17870c){return{'model':db[_0x17870c[_0x203e('0x1c')]],'as':_0x17870c['as'],'attributes':_0x17870c[_0x203e('0x1d')],'include':_0x17870c[_0x203e('0x1a')]?_[_0x203e('0x1b')](_0x17870c[_0x203e('0x1a')],function(_0x23b547){return{'model':db[_0x23b547['model']],'as':_0x23b547['as'],'attributes':_0x23b547[_0x203e('0x1d')],'include':_0x23b547[_0x203e('0x1a')]?_[_0x203e('0x1b')](_0x23b547[_0x203e('0x1a')],function(_0x3a899b){return{'model':db[_0x3a899b[_0x203e('0x1c')]],'as':_0x3a899b['as'],'attributes':_0x3a899b[_0x203e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x203e('0x1e')](function(_0x5a1a5f){logger['info'](_0x203e('0x21'),_0x400c8f);logger[_0x203e('0xf')]('ShowZendeskAccount',_0x400c8f,JSON[_0x203e('0x10')](_0x5a1a5f));_0x2a10f7(_0x5a1a5f);})[_0x203e('0x22')](function(_0x413972){logger[_0x203e('0x11')](_0x203e('0x21'),_0x413972[_0x203e('0x13')],_0x400c8f);_0x3d47f0(_0x2d152e[_0x203e('0x11')](0x1f4,_0x413972[_0x203e('0x13')]));});});}; \ No newline at end of file +var _0xbf54=['raw','where','attributes','include','map','model','then','info','GetZendeskAccount','debug','ShowZendeskAccount','ZendeskAccount','find','stringify','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','findAll','options'];(function(_0x4ced8d,_0x5805ad){var _0x596a46=function(_0x4aea8c){while(--_0x4aea8c){_0x4ced8d['push'](_0x4ced8d['shift']());}};_0x596a46(++_0x5805ad);}(_0xbf54,0x18f));var _0x4bf5=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xbf54[_0x363ef8];return _0x148822;};'use strict';var _=require(_0x4bf5('0x0'));var util=require('util');var moment=require(_0x4bf5('0x1'));var BPromise=require(_0x4bf5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4bf5('0x3'))['db'];var utils=require(_0x4bf5('0x4'));var logger=require(_0x4bf5('0x5'))(_0x4bf5('0x6'));var config=require('../../config/environment');var jayson=require(_0x4bf5('0x7'));var client=jayson[_0x4bf5('0x8')][_0x4bf5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33df19,_0x3c4f3b,_0x38814e){return new BPromise(function(_0xea63df,_0x6297a){return client[_0x4bf5('0xa')](_0x33df19,_0x38814e)['then'](function(_0x369189){logger['info'](_0x4bf5('0xb'),_0x3c4f3b,_0x4bf5('0xc'));logger['debug'](_0x4bf5('0xd'),_0x3c4f3b,'request\x20sent',JSON['stringify'](_0x369189));if(_0x369189['error']){if(_0x369189['error'][_0x4bf5('0xe')]===0x1f4){logger[_0x4bf5('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x3c4f3b,_0x369189[_0x4bf5('0xf')][_0x4bf5('0x10')]);return _0x6297a(_0x369189[_0x4bf5('0xf')][_0x4bf5('0x10')]);}logger[_0x4bf5('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x3c4f3b,_0x369189[_0x4bf5('0xf')][_0x4bf5('0x10')]);return _0xea63df(_0x369189[_0x4bf5('0xf')][_0x4bf5('0x10')]);}else{logger['info'](_0x4bf5('0xb'),_0x3c4f3b,'request\x20sent');_0xea63df(_0x369189[_0x4bf5('0x11')]['message']);}})[_0x4bf5('0x12')](function(_0x1d451b){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x3c4f3b,_0x1d451b);_0x6297a(_0x1d451b);});});}exports['GetZendeskAccount']=function(_0x451acb){var _0x36c32e=this;return new Promise(function(_0x2cb398,_0x1ce1b8){return db['ZendeskAccount'][_0x4bf5('0x13')]({'raw':_0x451acb[_0x4bf5('0x14')]?_0x451acb['options'][_0x4bf5('0x15')]===undefined?!![]:![]:!![],'where':_0x451acb[_0x4bf5('0x14')]?_0x451acb['options'][_0x4bf5('0x16')]||null:null,'attributes':_0x451acb[_0x4bf5('0x14')]?_0x451acb[_0x4bf5('0x14')][_0x4bf5('0x17')]||null:null,'limit':_0x451acb['options']?_0x451acb[_0x4bf5('0x14')]['limit']||null:null,'include':_0x451acb['options']?_0x451acb[_0x4bf5('0x14')][_0x4bf5('0x18')]?_[_0x4bf5('0x19')](_0x451acb[_0x4bf5('0x14')]['include'],function(_0x51970e){return{'model':db[_0x51970e['model']],'as':_0x51970e['as'],'attributes':_0x51970e[_0x4bf5('0x17')],'include':_0x51970e[_0x4bf5('0x18')]?_['map'](_0x51970e[_0x4bf5('0x18')],function(_0x4ac8e7){return{'model':db[_0x4ac8e7[_0x4bf5('0x1a')]],'as':_0x4ac8e7['as'],'attributes':_0x4ac8e7['attributes'],'include':_0x4ac8e7['include']?_[_0x4bf5('0x19')](_0x4ac8e7[_0x4bf5('0x18')],function(_0x20adad){return{'model':db[_0x20adad[_0x4bf5('0x1a')]],'as':_0x20adad['as'],'attributes':_0x20adad[_0x4bf5('0x17')]};}):[]};}):[]};}):[]:[]})[_0x4bf5('0x1b')](function(_0x24d756){logger[_0x4bf5('0x1c')](_0x4bf5('0x1d'),_0x451acb);logger[_0x4bf5('0x1e')](_0x4bf5('0x1d'),_0x451acb,JSON['stringify'](_0x24d756));_0x2cb398(_0x24d756);})['catch'](function(_0x2acb3a){logger[_0x4bf5('0xf')](_0x4bf5('0x1d'),_0x2acb3a[_0x4bf5('0x10')],_0x451acb);_0x1ce1b8(_0x36c32e[_0x4bf5('0xf')](0x1f4,_0x2acb3a[_0x4bf5('0x10')]));});});};exports[_0x4bf5('0x1f')]=function(_0x2da774){var _0x38f169=this;return new Promise(function(_0x3c1fa9,_0x4c0293){return db[_0x4bf5('0x20')][_0x4bf5('0x21')]({'raw':_0x2da774[_0x4bf5('0x14')]?_0x2da774[_0x4bf5('0x14')][_0x4bf5('0x15')]===undefined?!![]:![]:!![],'where':_0x2da774[_0x4bf5('0x14')]?_0x2da774['options']['where']||null:null,'attributes':_0x2da774[_0x4bf5('0x14')]?_0x2da774['options'][_0x4bf5('0x17')]||null:null,'include':_0x2da774[_0x4bf5('0x14')]?_0x2da774[_0x4bf5('0x14')][_0x4bf5('0x18')]?_[_0x4bf5('0x19')](_0x2da774[_0x4bf5('0x14')][_0x4bf5('0x18')],function(_0x3f6a55){return{'model':db[_0x3f6a55[_0x4bf5('0x1a')]],'as':_0x3f6a55['as'],'attributes':_0x3f6a55['attributes'],'include':_0x3f6a55[_0x4bf5('0x18')]?_[_0x4bf5('0x19')](_0x3f6a55[_0x4bf5('0x18')],function(_0x55e722){return{'model':db[_0x55e722[_0x4bf5('0x1a')]],'as':_0x55e722['as'],'attributes':_0x55e722[_0x4bf5('0x17')],'include':_0x55e722[_0x4bf5('0x18')]?_[_0x4bf5('0x19')](_0x55e722[_0x4bf5('0x18')],function(_0x50ee1d){return{'model':db[_0x50ee1d[_0x4bf5('0x1a')]],'as':_0x50ee1d['as'],'attributes':_0x50ee1d[_0x4bf5('0x17')]};}):[]};}):[]};}):[]:[]})[_0x4bf5('0x1b')](function(_0x20d392){logger[_0x4bf5('0x1c')](_0x4bf5('0x1f'),_0x2da774);logger[_0x4bf5('0x1e')]('ShowZendeskAccount',_0x2da774,JSON[_0x4bf5('0x22')](_0x20d392));_0x3c1fa9(_0x20d392);})[_0x4bf5('0x12')](function(_0xa19388){logger['error'](_0x4bf5('0x1f'),_0xa19388['message'],_0x2da774);_0x4c0293(_0x38f169[_0x4bf5('0xf')](0x1f4,_0xa19388[_0x4bf5('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 5beaefa..9e4630d 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 _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(_0x58a77e,_0x4e747c){var _0x3c98a7=function(_0x44cdd4){while(--_0x44cdd4){_0x58a77e['push'](_0x58a77e['shift']());}};_0x3c98a7(++_0x4e747c);}(_0x5c00,0x17e));var _0x05c0=function(_0x1f1e5f,_0x376859){_0x1f1e5f=_0x1f1e5f-0x0;var _0x13b7ea=_0x5c00[_0x1f1e5f];return _0x13b7ea;};'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 +var _0x750a=['getTags','post','setTags','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/tags'];(function(_0x4ee9a5,_0x120085){var _0x2f9796=function(_0x127923){while(--_0x127923){_0x4ee9a5['push'](_0x4ee9a5['shift']());}};_0x2f9796(++_0x120085);}(_0x750a,0x140));var _0xa750=function(_0x3415af,_0x476d88){_0x3415af=_0x3415af-0x0;var _0x535b99=_0x750a[_0x3415af];return _0x535b99;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['show']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/subjects',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['get']('/:id/descriptions',auth[_0xa750('0x9')](),controller['getDescriptions']);router[_0xa750('0x8')](_0xa750('0xf'),auth['isAuthenticated'](),controller[_0xa750('0x10')]);router[_0xa750('0x11')]('/',auth[_0xa750('0x9')](),controller['create']);router[_0xa750('0x11')](_0xa750('0xf'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);router[_0xa750('0x13')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x14')]);router[_0xa750('0x15')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x16')]);module[_0xa750('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index df7ab23..03c756c 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 _0xcfde=['sequelize','exports','STRING'];(function(_0x8524fd,_0x666605){var _0x853589=function(_0x3d410f){while(--_0x3d410f){_0x8524fd['push'](_0x8524fd['shift']());}};_0x853589(++_0x666605);}(_0xcfde,0x6f));var _0xecfd=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xcfde[_0x21aec3];return _0x288bbc;};'use strict';var Sequelize=require(_0xecfd('0x0'));module[_0xecfd('0x1')]={'name':{'type':Sequelize[_0xecfd('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2a4d=['sequelize','exports','STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2a4d,0x126));var _0xd2a4=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2a4d[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xd2a4('0x0'));module[_0xd2a4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd2a4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 6b67c7f..d0ff81c 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 _0xc6c3=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskConfiguration','includeAll','include','rows','catch','show','params','intersection','length','find','create','body','getFields','findOne','ZendeskField','order','nolimit','getSubjects','getDescriptions','getTags','setTags','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x29698b,_0x146da5){var _0x2e5675=function(_0xe2d1d5){while(--_0xe2d1d5){_0x29698b['push'](_0x29698b['shift']());}};_0x2e5675(++_0x146da5);}(_0xc6c3,0x1e7));var _0x3c6c=function(_0x4453b6,_0x28b032){_0x4453b6=_0x4453b6-0x0;var _0x54f0b6=_0xc6c3[_0x4453b6];return _0x54f0b6;};'use strict';var emlformat=require(_0x3c6c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3c6c('0x1'));var jsonpatch=require(_0x3c6c('0x2'));var rp=require(_0x3c6c('0x3'));var moment=require(_0x3c6c('0x4'));var BPromise=require(_0x3c6c('0x5'));var Mustache=require(_0x3c6c('0x6'));var util=require(_0x3c6c('0x7'));var path=require(_0x3c6c('0x8'));var sox=require(_0x3c6c('0x9'));var csv=require(_0x3c6c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3c6c('0xb'));var crypto=require(_0x3c6c('0xc'));var jsforce=require(_0x3c6c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3c6c('0xe'));var Papa=require(_0x3c6c('0xf'));var Redis=require(_0x3c6c('0x10'));var authService=require(_0x3c6c('0x11'));var qs=require(_0x3c6c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c6c('0x13'));var logger=require('../../config/logger')(_0x3c6c('0x14'));var utils=require(_0x3c6c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3c6c('0x16'));var db=require(_0x3c6c('0x17'))['db'];function respondWithStatusCode(_0x1d09b3,_0x3c38b8){_0x3c38b8=_0x3c38b8||0xcc;return function(_0x44d0e1){if(_0x44d0e1){return _0x1d09b3[_0x3c6c('0x18')](_0x3c38b8);}return _0x1d09b3[_0x3c6c('0x19')](_0x3c38b8)['end']();};}function respondWithResult(_0xb3dffd,_0x1be1ec){_0x1be1ec=_0x1be1ec||0xc8;return function(_0x6027ba){if(_0x6027ba){return _0xb3dffd[_0x3c6c('0x19')](_0x1be1ec)[_0x3c6c('0x1a')](_0x6027ba);}};}function respondWithFilteredResult(_0x4ab8a4,_0x15ec50){return function(_0x1673db){if(_0x1673db){var _0x571287=typeof _0x15ec50[_0x3c6c('0x1b')]===_0x3c6c('0x1c')&&typeof _0x15ec50[_0x3c6c('0x1d')]===_0x3c6c('0x1c');var _0x97469=_0x1673db[_0x3c6c('0x1e')];var _0xd8ce1c=_0x571287?0x0:_0x15ec50[_0x3c6c('0x1b')];var _0x361125=_0x571287?_0x1673db[_0x3c6c('0x1e')]:_0x15ec50['offset']+_0x15ec50['limit'];var _0x4bf8ed;if(_0x361125>=_0x97469){_0x361125=_0x97469;_0x4bf8ed=0xc8;}else{_0x4bf8ed=0xce;}_0x4ab8a4[_0x3c6c('0x19')](_0x4bf8ed);return _0x4ab8a4[_0x3c6c('0x1f')](_0x3c6c('0x20'),_0xd8ce1c+'-'+_0x361125+'/'+_0x97469)['json'](_0x1673db);}return null;};}function patchUpdates(_0x35b98a){return function(_0xd9e121){try{jsonpatch[_0x3c6c('0x21')](_0xd9e121,_0x35b98a,!![]);}catch(_0x233f53){return BPromise['reject'](_0x233f53);}return _0xd9e121['save']();};}function saveUpdates(_0x1858f2,_0x254fee){return function(_0x5164a4){if(_0x5164a4){return _0x5164a4[_0x3c6c('0x22')](_0x1858f2)['then'](function(_0x12796e){return _0x12796e;});}return null;};}function removeEntity(_0x263552,_0x3f907f){return function(_0x408f68){if(_0x408f68){return _0x408f68[_0x3c6c('0x23')]()[_0x3c6c('0x24')](function(){_0x263552[_0x3c6c('0x19')](0xcc)[_0x3c6c('0x25')]();});}};}function handleEntityNotFound(_0x1f3908,_0x3cc4ca){return function(_0x5261d9){if(!_0x5261d9){_0x1f3908[_0x3c6c('0x18')](0x194);}return _0x5261d9;};}function handleError(_0x547c47,_0x179375){_0x179375=_0x179375||0x1f4;return function(_0xad7aaf){logger[_0x3c6c('0x26')](_0xad7aaf[_0x3c6c('0x27')]);if(_0xad7aaf['name']){delete _0xad7aaf[_0x3c6c('0x28')];}_0x547c47['status'](_0x179375)[_0x3c6c('0x29')](_0xad7aaf);};}exports[_0x3c6c('0x2a')]=function(_0x2b6eb5,_0x37d796){var _0x981d77={},_0x162406={},_0x1cc0e7={'count':0x0,'rows':[]};var _0x108f69=_['map'](db['ZendeskConfiguration'][_0x3c6c('0x2b')],function(_0x5323ab){return{'name':_0x5323ab[_0x3c6c('0x2c')],'type':_0x5323ab[_0x3c6c('0x2d')][_0x3c6c('0x2e')]};});_0x162406['model']=_[_0x3c6c('0x2f')](_0x108f69,_0x3c6c('0x28'));_0x162406[_0x3c6c('0x30')]=_[_0x3c6c('0x31')](_0x2b6eb5[_0x3c6c('0x30')]);_0x162406[_0x3c6c('0x32')]=_['intersection'](_0x162406[_0x3c6c('0x33')],_0x162406[_0x3c6c('0x30')]);_0x981d77[_0x3c6c('0x34')]=_['intersection'](_0x162406[_0x3c6c('0x33')],qs[_0x3c6c('0x35')](_0x2b6eb5['query']['fields']));_0x981d77[_0x3c6c('0x34')]=_0x981d77[_0x3c6c('0x34')]['length']?_0x981d77[_0x3c6c('0x34')]:_0x162406[_0x3c6c('0x33')];if(!_0x2b6eb5[_0x3c6c('0x30')][_0x3c6c('0x36')]('nolimit')){_0x981d77[_0x3c6c('0x1d')]=qs[_0x3c6c('0x1d')](_0x2b6eb5[_0x3c6c('0x30')]['limit']);_0x981d77[_0x3c6c('0x1b')]=qs[_0x3c6c('0x1b')](_0x2b6eb5[_0x3c6c('0x30')][_0x3c6c('0x1b')]);}_0x981d77['order']=qs[_0x3c6c('0x37')](_0x2b6eb5[_0x3c6c('0x30')][_0x3c6c('0x37')]);_0x981d77[_0x3c6c('0x38')]=qs[_0x3c6c('0x32')](_[_0x3c6c('0x39')](_0x2b6eb5[_0x3c6c('0x30')],_0x162406['filters']),_0x108f69);if(_0x2b6eb5[_0x3c6c('0x30')][_0x3c6c('0x3a')]){_0x981d77[_0x3c6c('0x38')]=_[_0x3c6c('0x3b')](_0x981d77['where'],{'$or':_[_0x3c6c('0x2f')](_0x108f69,function(_0x10884f){if(_0x10884f[_0x3c6c('0x2d')]!==_0x3c6c('0x3c')){var _0x3a08fd={};_0x3a08fd[_0x10884f[_0x3c6c('0x28')]]={'$like':'%'+_0x2b6eb5['query'][_0x3c6c('0x3a')]+'%'};return _0x3a08fd;}})});}_0x981d77=_['merge']({},_0x981d77,_0x2b6eb5[_0x3c6c('0x3d')]);var _0x31d6f1={'where':_0x981d77[_0x3c6c('0x38')]};return db[_0x3c6c('0x3e')][_0x3c6c('0x1e')](_0x31d6f1)[_0x3c6c('0x24')](function(_0x4653b6){_0x1cc0e7[_0x3c6c('0x1e')]=_0x4653b6;if(_0x2b6eb5['query'][_0x3c6c('0x3f')]){_0x981d77[_0x3c6c('0x40')]=[{'all':!![]}];}return db[_0x3c6c('0x3e')]['findAll'](_0x981d77);})[_0x3c6c('0x24')](function(_0x2f9079){_0x1cc0e7[_0x3c6c('0x41')]=_0x2f9079;return _0x1cc0e7;})[_0x3c6c('0x24')](respondWithFilteredResult(_0x37d796,_0x981d77))[_0x3c6c('0x42')](handleError(_0x37d796,null));};exports[_0x3c6c('0x43')]=function(_0xe5ef3,_0x3a9900){var _0x1b0e3a={'raw':![],'where':{'id':_0xe5ef3[_0x3c6c('0x44')]['id']}},_0x45ef3f={};_0x45ef3f[_0x3c6c('0x33')]=_[_0x3c6c('0x31')](db['ZendeskConfiguration'][_0x3c6c('0x2b')]);_0x45ef3f[_0x3c6c('0x30')]=_[_0x3c6c('0x31')](_0xe5ef3['query']);_0x45ef3f[_0x3c6c('0x32')]=_[_0x3c6c('0x45')](_0x45ef3f[_0x3c6c('0x33')],_0x45ef3f[_0x3c6c('0x30')]);_0x1b0e3a['attributes']=_[_0x3c6c('0x45')](_0x45ef3f[_0x3c6c('0x33')],qs['fields'](_0xe5ef3['query'][_0x3c6c('0x35')]));_0x1b0e3a[_0x3c6c('0x34')]=_0x1b0e3a[_0x3c6c('0x34')][_0x3c6c('0x46')]?_0x1b0e3a[_0x3c6c('0x34')]:_0x45ef3f['model'];if(_0xe5ef3[_0x3c6c('0x30')][_0x3c6c('0x3f')]){_0x1b0e3a[_0x3c6c('0x40')]=[{'all':!![]}];}_0x1b0e3a=_['merge']({},_0x1b0e3a,_0xe5ef3[_0x3c6c('0x3d')]);return db[_0x3c6c('0x3e')][_0x3c6c('0x47')](_0x1b0e3a)[_0x3c6c('0x24')](handleEntityNotFound(_0x3a9900,null))[_0x3c6c('0x24')](respondWithResult(_0x3a9900,null))[_0x3c6c('0x42')](handleError(_0x3a9900,null));};exports[_0x3c6c('0x48')]=function(_0x5dc26c,_0x137ee8){return db[_0x3c6c('0x3e')][_0x3c6c('0x48')](_0x5dc26c[_0x3c6c('0x49')],{})[_0x3c6c('0x24')](respondWithResult(_0x137ee8,0xc9))['catch'](handleError(_0x137ee8,null));};exports['update']=function(_0x51c476,_0x3e38ee){if(_0x51c476['body']['id']){delete _0x51c476[_0x3c6c('0x49')]['id'];}return db[_0x3c6c('0x3e')]['find']({'where':{'id':_0x51c476[_0x3c6c('0x44')]['id']}})[_0x3c6c('0x24')](handleEntityNotFound(_0x3e38ee,null))[_0x3c6c('0x24')](saveUpdates(_0x51c476[_0x3c6c('0x49')],null))[_0x3c6c('0x24')](respondWithResult(_0x3e38ee,null))['catch'](handleError(_0x3e38ee,null));};exports['destroy']=function(_0xbbfc12,_0x469cf4){return db[_0x3c6c('0x3e')][_0x3c6c('0x47')]({'where':{'id':_0xbbfc12[_0x3c6c('0x44')]['id']}})[_0x3c6c('0x24')](handleEntityNotFound(_0x469cf4,null))[_0x3c6c('0x24')](removeEntity(_0x469cf4,null))[_0x3c6c('0x42')](handleError(_0x469cf4,null));};exports[_0x3c6c('0x4a')]=function(_0x47ff5a,_0x111592,_0x5243a5){var _0x53e12c={};var _0x42bc53={};var _0x1b64fb;var _0x33eb90;return db['ZendeskConfiguration'][_0x3c6c('0x4b')]({'where':{'id':_0x47ff5a['params']['id']}})[_0x3c6c('0x24')](handleEntityNotFound(_0x111592,null))[_0x3c6c('0x24')](function(_0x37d2ab){if(_0x37d2ab){_0x1b64fb=_0x37d2ab;_0x42bc53[_0x3c6c('0x33')]=_[_0x3c6c('0x31')](db[_0x3c6c('0x4c')][_0x3c6c('0x2b')]);_0x42bc53[_0x3c6c('0x30')]=_[_0x3c6c('0x31')](_0x47ff5a['query']);_0x42bc53[_0x3c6c('0x32')]=_[_0x3c6c('0x45')](_0x42bc53['model'],_0x42bc53['query']);_0x53e12c[_0x3c6c('0x34')]=_[_0x3c6c('0x45')](_0x42bc53['model'],qs[_0x3c6c('0x35')](_0x47ff5a['query'][_0x3c6c('0x35')]));_0x53e12c['attributes']=_0x53e12c[_0x3c6c('0x34')]['length']?_0x53e12c[_0x3c6c('0x34')]:_0x42bc53[_0x3c6c('0x33')];_0x53e12c[_0x3c6c('0x4d')]=qs[_0x3c6c('0x37')](_0x47ff5a[_0x3c6c('0x30')][_0x3c6c('0x37')]);_0x53e12c[_0x3c6c('0x38')]=qs[_0x3c6c('0x32')](_[_0x3c6c('0x39')](_0x47ff5a[_0x3c6c('0x30')],_0x42bc53[_0x3c6c('0x32')]));if(_0x47ff5a['query'][_0x3c6c('0x3a')]){_0x53e12c['where']=_['merge'](_0x53e12c[_0x3c6c('0x38')],{'$or':_['map'](_0x53e12c['attributes'],function(_0x285fa9){var _0xf40100={};_0xf40100[_0x285fa9]={'$like':'%'+_0x47ff5a[_0x3c6c('0x30')][_0x3c6c('0x3a')]+'%'};return _0xf40100;})});}_0x53e12c=_[_0x3c6c('0x3b')]({},_0x53e12c,_0x47ff5a[_0x3c6c('0x3d')]);return _0x1b64fb[_0x3c6c('0x4a')](_0x53e12c);}})['then'](function(_0x3078dd){if(_0x3078dd){_0x33eb90=_0x3078dd[_0x3c6c('0x46')];if(!_0x47ff5a[_0x3c6c('0x30')][_0x3c6c('0x36')](_0x3c6c('0x4e'))){_0x53e12c[_0x3c6c('0x1d')]=qs[_0x3c6c('0x1d')](_0x47ff5a[_0x3c6c('0x30')][_0x3c6c('0x1d')]);_0x53e12c[_0x3c6c('0x1b')]=qs[_0x3c6c('0x1b')](_0x47ff5a['query']['offset']);}return _0x1b64fb['getFields'](_0x53e12c);}})['then'](function(_0x49efa5){if(_0x49efa5){return _0x49efa5?{'count':_0x33eb90,'rows':_0x49efa5}:null;}})['then'](respondWithResult(_0x111592,null))[_0x3c6c('0x42')](handleError(_0x111592,null));};exports[_0x3c6c('0x4f')]=function(_0x4b90a7,_0x1368ae,_0x20e3b0){var _0x4564ee={};var _0x2688c7={};var _0x249e0b;var _0x5bb105;return db['ZendeskConfiguration'][_0x3c6c('0x4b')]({'where':{'id':_0x4b90a7['params']['id']}})[_0x3c6c('0x24')](handleEntityNotFound(_0x1368ae,null))[_0x3c6c('0x24')](function(_0x33af78){if(_0x33af78){_0x249e0b=_0x33af78;_0x2688c7[_0x3c6c('0x33')]=_[_0x3c6c('0x31')](db['ZendeskField'][_0x3c6c('0x2b')]);_0x2688c7[_0x3c6c('0x30')]=_['keys'](_0x4b90a7['query']);_0x2688c7[_0x3c6c('0x32')]=_['intersection'](_0x2688c7['model'],_0x2688c7[_0x3c6c('0x30')]);_0x4564ee[_0x3c6c('0x34')]=_['intersection'](_0x2688c7['model'],qs['fields'](_0x4b90a7[_0x3c6c('0x30')][_0x3c6c('0x35')]));_0x4564ee[_0x3c6c('0x34')]=_0x4564ee[_0x3c6c('0x34')][_0x3c6c('0x46')]?_0x4564ee['attributes']:_0x2688c7['model'];_0x4564ee['order']=qs[_0x3c6c('0x37')](_0x4b90a7['query'][_0x3c6c('0x37')]);_0x4564ee['where']=qs[_0x3c6c('0x32')](_[_0x3c6c('0x39')](_0x4b90a7[_0x3c6c('0x30')],_0x2688c7['filters']));if(_0x4b90a7[_0x3c6c('0x30')][_0x3c6c('0x3a')]){_0x4564ee[_0x3c6c('0x38')]=_[_0x3c6c('0x3b')](_0x4564ee[_0x3c6c('0x38')],{'$or':_[_0x3c6c('0x2f')](_0x4564ee[_0x3c6c('0x34')],function(_0x4a4d84){var _0x25c069={};_0x25c069[_0x4a4d84]={'$like':'%'+_0x4b90a7[_0x3c6c('0x30')][_0x3c6c('0x3a')]+'%'};return _0x25c069;})});}_0x4564ee=_[_0x3c6c('0x3b')]({},_0x4564ee,_0x4b90a7[_0x3c6c('0x3d')]);return _0x249e0b[_0x3c6c('0x4f')](_0x4564ee);}})[_0x3c6c('0x24')](function(_0x2bdb51){if(_0x2bdb51){_0x5bb105=_0x2bdb51[_0x3c6c('0x46')];if(!_0x4b90a7[_0x3c6c('0x30')][_0x3c6c('0x36')](_0x3c6c('0x4e'))){_0x4564ee[_0x3c6c('0x1d')]=qs['limit'](_0x4b90a7['query'][_0x3c6c('0x1d')]);_0x4564ee[_0x3c6c('0x1b')]=qs[_0x3c6c('0x1b')](_0x4b90a7[_0x3c6c('0x30')][_0x3c6c('0x1b')]);}return _0x249e0b[_0x3c6c('0x4f')](_0x4564ee);}})[_0x3c6c('0x24')](function(_0x2a3cdb){if(_0x2a3cdb){return _0x2a3cdb?{'count':_0x5bb105,'rows':_0x2a3cdb}:null;}})[_0x3c6c('0x24')](respondWithResult(_0x1368ae,null))[_0x3c6c('0x42')](handleError(_0x1368ae,null));};exports[_0x3c6c('0x50')]=function(_0x1fe4aa,_0x2d1533,_0x1f84ed){var _0x571ed6={};var _0x5380a2={};var _0x4b11c6;var _0x1eb0ee;return db[_0x3c6c('0x3e')][_0x3c6c('0x4b')]({'where':{'id':_0x1fe4aa[_0x3c6c('0x44')]['id']}})['then'](handleEntityNotFound(_0x2d1533,null))[_0x3c6c('0x24')](function(_0x4ff969){if(_0x4ff969){_0x4b11c6=_0x4ff969;_0x5380a2[_0x3c6c('0x33')]=_[_0x3c6c('0x31')](db[_0x3c6c('0x4c')][_0x3c6c('0x2b')]);_0x5380a2[_0x3c6c('0x30')]=_['keys'](_0x1fe4aa[_0x3c6c('0x30')]);_0x5380a2[_0x3c6c('0x32')]=_[_0x3c6c('0x45')](_0x5380a2[_0x3c6c('0x33')],_0x5380a2[_0x3c6c('0x30')]);_0x571ed6['attributes']=_[_0x3c6c('0x45')](_0x5380a2[_0x3c6c('0x33')],qs[_0x3c6c('0x35')](_0x1fe4aa['query']['fields']));_0x571ed6[_0x3c6c('0x34')]=_0x571ed6[_0x3c6c('0x34')][_0x3c6c('0x46')]?_0x571ed6['attributes']:_0x5380a2[_0x3c6c('0x33')];_0x571ed6['order']=qs[_0x3c6c('0x37')](_0x1fe4aa[_0x3c6c('0x30')]['sort']);_0x571ed6['where']=qs[_0x3c6c('0x32')](_['pick'](_0x1fe4aa['query'],_0x5380a2[_0x3c6c('0x32')]));if(_0x1fe4aa[_0x3c6c('0x30')][_0x3c6c('0x3a')]){_0x571ed6[_0x3c6c('0x38')]=_['merge'](_0x571ed6[_0x3c6c('0x38')],{'$or':_[_0x3c6c('0x2f')](_0x571ed6['attributes'],function(_0x4955b6){var _0x251de0={};_0x251de0[_0x4955b6]={'$like':'%'+_0x1fe4aa[_0x3c6c('0x30')][_0x3c6c('0x3a')]+'%'};return _0x251de0;})});}_0x571ed6=_[_0x3c6c('0x3b')]({},_0x571ed6,_0x1fe4aa[_0x3c6c('0x3d')]);return _0x4b11c6['getDescriptions'](_0x571ed6);}})[_0x3c6c('0x24')](function(_0x22ab30){if(_0x22ab30){_0x1eb0ee=_0x22ab30[_0x3c6c('0x46')];if(!_0x1fe4aa[_0x3c6c('0x30')][_0x3c6c('0x36')](_0x3c6c('0x4e'))){_0x571ed6['limit']=qs[_0x3c6c('0x1d')](_0x1fe4aa[_0x3c6c('0x30')]['limit']);_0x571ed6[_0x3c6c('0x1b')]=qs['offset'](_0x1fe4aa[_0x3c6c('0x30')][_0x3c6c('0x1b')]);}return _0x4b11c6[_0x3c6c('0x50')](_0x571ed6);}})[_0x3c6c('0x24')](function(_0x559370){if(_0x559370){return _0x559370?{'count':_0x1eb0ee,'rows':_0x559370}:null;}})[_0x3c6c('0x24')](respondWithResult(_0x2d1533,null))['catch'](handleError(_0x2d1533,null));};exports[_0x3c6c('0x51')]=function(_0x4b5bd4,_0x1643e8,_0x1368c2){var _0x1b08a7={};var _0x2c1156={};var _0x26210b;var _0x3d9c03;return db[_0x3c6c('0x3e')][_0x3c6c('0x4b')]({'where':{'id':_0x4b5bd4['params']['id']}})['then'](handleEntityNotFound(_0x1643e8,null))['then'](function(_0x2767db){if(_0x2767db){_0x26210b=_0x2767db;_0x2c1156[_0x3c6c('0x33')]=_[_0x3c6c('0x31')](db['Tag'][_0x3c6c('0x2b')]);_0x2c1156['query']=_[_0x3c6c('0x31')](_0x4b5bd4['query']);_0x2c1156['filters']=_['intersection'](_0x2c1156['model'],_0x2c1156['query']);_0x1b08a7[_0x3c6c('0x34')]=_[_0x3c6c('0x45')](_0x2c1156['model'],qs[_0x3c6c('0x35')](_0x4b5bd4[_0x3c6c('0x30')][_0x3c6c('0x35')]));_0x1b08a7[_0x3c6c('0x34')]=_0x1b08a7['attributes']['length']?_0x1b08a7['attributes']:_0x2c1156[_0x3c6c('0x33')];_0x1b08a7['order']=qs[_0x3c6c('0x37')](_0x4b5bd4[_0x3c6c('0x30')][_0x3c6c('0x37')]);_0x1b08a7['where']=qs[_0x3c6c('0x32')](_['pick'](_0x4b5bd4[_0x3c6c('0x30')],_0x2c1156[_0x3c6c('0x32')]));if(_0x4b5bd4[_0x3c6c('0x30')][_0x3c6c('0x3a')]){_0x1b08a7[_0x3c6c('0x38')]=_[_0x3c6c('0x3b')](_0x1b08a7[_0x3c6c('0x38')],{'$or':_[_0x3c6c('0x2f')](_0x1b08a7['attributes'],function(_0x5ad3d3){var _0x155ad2={};_0x155ad2[_0x5ad3d3]={'$like':'%'+_0x4b5bd4[_0x3c6c('0x30')][_0x3c6c('0x3a')]+'%'};return _0x155ad2;})});}_0x1b08a7=_[_0x3c6c('0x3b')]({},_0x1b08a7,_0x4b5bd4[_0x3c6c('0x3d')]);return _0x26210b[_0x3c6c('0x51')](_0x1b08a7);}})[_0x3c6c('0x24')](function(_0xa24570){if(_0xa24570){_0x3d9c03=_0xa24570['length'];if(!_0x4b5bd4['query'][_0x3c6c('0x36')](_0x3c6c('0x4e'))){_0x1b08a7[_0x3c6c('0x1d')]=qs[_0x3c6c('0x1d')](_0x4b5bd4[_0x3c6c('0x30')][_0x3c6c('0x1d')]);_0x1b08a7[_0x3c6c('0x1b')]=qs[_0x3c6c('0x1b')](_0x4b5bd4[_0x3c6c('0x30')][_0x3c6c('0x1b')]);}return _0x26210b[_0x3c6c('0x51')](_0x1b08a7);}})[_0x3c6c('0x24')](function(_0x46605f){if(_0x46605f){return _0x46605f?{'count':_0x3d9c03,'rows':_0x46605f}:null;}})[_0x3c6c('0x24')](respondWithResult(_0x1643e8,null))[_0x3c6c('0x42')](handleError(_0x1643e8,null));};exports[_0x3c6c('0x52')]=function(_0x54a68f,_0x196d66,_0xafc6bf){if(_0x54a68f[_0x3c6c('0x49')]['id']){delete _0x54a68f['body']['id'];}return db[_0x3c6c('0x3e')]['findOne']({'where':{'id':_0x54a68f['params']['id']}})[_0x3c6c('0x24')](handleEntityNotFound(_0x196d66,null))[_0x3c6c('0x24')](function(_0x523b14){if(_0x523b14){return _0x523b14[_0x3c6c('0x52')](_0x54a68f[_0x3c6c('0x49')]['ids']||[]);}return null;})[_0x3c6c('0x24')](respondWithResult(_0x196d66,null))[_0x3c6c('0x42')](handleError(_0x196d66,null));}; \ No newline at end of file +var _0x1d5b=['then','destroy','end','stack','name','send','map','ZendeskConfiguration','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','apply','reject','save','update'];(function(_0x4f6070,_0xfbc9cb){var _0x14dfe5=function(_0x1af74e){while(--_0x1af74e){_0x4f6070['push'](_0x4f6070['shift']());}};_0x14dfe5(++_0xfbc9cb);}(_0x1d5b,0x1cd));var _0xb1d5=function(_0x370d2f,_0x1dcf08){_0x370d2f=_0x370d2f-0x0;var _0x49bc67=_0x1d5b[_0x370d2f];return _0x49bc67;};'use strict';var emlformat=require(_0xb1d5('0x0'));var rimraf=require(_0xb1d5('0x1'));var zipdir=require(_0xb1d5('0x2'));var jsonpatch=require(_0xb1d5('0x3'));var rp=require('request-promise');var moment=require(_0xb1d5('0x4'));var BPromise=require(_0xb1d5('0x5'));var Mustache=require(_0xb1d5('0x6'));var util=require(_0xb1d5('0x7'));var path=require(_0xb1d5('0x8'));var sox=require(_0xb1d5('0x9'));var csv=require(_0xb1d5('0xa'));var ejs=require(_0xb1d5('0xb'));var fs=require('fs');var fs_extra=require(_0xb1d5('0xc'));var _=require(_0xb1d5('0xd'));var squel=require(_0xb1d5('0xe'));var crypto=require(_0xb1d5('0xf'));var jsforce=require(_0xb1d5('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb1d5('0x11'));var Papa=require('papaparse');var Redis=require(_0xb1d5('0x12'));var authService=require(_0xb1d5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb1d5('0x14'));var hardwareService=require(_0xb1d5('0x15'));var logger=require(_0xb1d5('0x16'))(_0xb1d5('0x17'));var utils=require(_0xb1d5('0x18'));var config=require(_0xb1d5('0x19'));var licenseUtil=require(_0xb1d5('0x1a'));var db=require(_0xb1d5('0x1b'))['db'];function respondWithStatusCode(_0x18ac32,_0x38a21b){_0x38a21b=_0x38a21b||0xcc;return function(_0x5b2fea){if(_0x5b2fea){return _0x18ac32[_0xb1d5('0x1c')](_0x38a21b);}return _0x18ac32[_0xb1d5('0x1d')](_0x38a21b)['end']();};}function respondWithResult(_0x28137d,_0x29722d){_0x29722d=_0x29722d||0xc8;return function(_0x926ad7){if(_0x926ad7){return _0x28137d['status'](_0x29722d)[_0xb1d5('0x1e')](_0x926ad7);}};}function respondWithFilteredResult(_0x3f1780,_0x311323){return function(_0x270142){if(_0x270142){var _0x185df3=typeof _0x311323[_0xb1d5('0x1f')]==='undefined'&&typeof _0x311323[_0xb1d5('0x20')]==='undefined';var _0x1bbc64=_0x270142['count'];var _0x2793d0=_0x185df3?0x0:_0x311323[_0xb1d5('0x1f')];var _0x5ee3b5=_0x185df3?_0x270142['count']:_0x311323[_0xb1d5('0x1f')]+_0x311323[_0xb1d5('0x20')];var _0x466ea2;if(_0x5ee3b5>=_0x1bbc64){_0x5ee3b5=_0x1bbc64;_0x466ea2=0xc8;}else{_0x466ea2=0xce;}_0x3f1780['status'](_0x466ea2);return _0x3f1780['set']('Content-Range',_0x2793d0+'-'+_0x5ee3b5+'/'+_0x1bbc64)[_0xb1d5('0x1e')](_0x270142);}return null;};}function patchUpdates(_0x51cf9a){return function(_0xa88159){try{jsonpatch[_0xb1d5('0x21')](_0xa88159,_0x51cf9a,!![]);}catch(_0x2a047e){return BPromise[_0xb1d5('0x22')](_0x2a047e);}return _0xa88159[_0xb1d5('0x23')]();};}function saveUpdates(_0x189d8a,_0x5e2b35){return function(_0x438d65){if(_0x438d65){return _0x438d65[_0xb1d5('0x24')](_0x189d8a)[_0xb1d5('0x25')](function(_0x50b18e){return _0x50b18e;});}return null;};}function removeEntity(_0x5e6d99,_0x3fd98d){return function(_0x1f3750){if(_0x1f3750){return _0x1f3750[_0xb1d5('0x26')]()[_0xb1d5('0x25')](function(){_0x5e6d99['status'](0xcc)[_0xb1d5('0x27')]();});}};}function handleEntityNotFound(_0x4c728a,_0x5705b5){return function(_0x217aa4){if(!_0x217aa4){_0x4c728a[_0xb1d5('0x1c')](0x194);}return _0x217aa4;};}function handleError(_0x496693,_0x295040){_0x295040=_0x295040||0x1f4;return function(_0x4ceab8){logger['error'](_0x4ceab8[_0xb1d5('0x28')]);if(_0x4ceab8[_0xb1d5('0x29')]){delete _0x4ceab8['name'];}_0x496693[_0xb1d5('0x1d')](_0x295040)[_0xb1d5('0x2a')](_0x4ceab8);};}exports['index']=function(_0x17bb60,_0x917068){var _0x132c13={},_0x44a726={},_0x47203d={'count':0x0,'rows':[]};var _0x118b5d=_[_0xb1d5('0x2b')](db[_0xb1d5('0x2c')][_0xb1d5('0x2d')],function(_0x25f9f1){return{'name':_0x25f9f1['fieldName'],'type':_0x25f9f1[_0xb1d5('0x2e')]['key']};});_0x44a726['model']=_[_0xb1d5('0x2b')](_0x118b5d,_0xb1d5('0x29'));_0x44a726[_0xb1d5('0x2f')]=_[_0xb1d5('0x30')](_0x17bb60[_0xb1d5('0x2f')]);_0x44a726[_0xb1d5('0x31')]=_[_0xb1d5('0x32')](_0x44a726[_0xb1d5('0x33')],_0x44a726[_0xb1d5('0x2f')]);_0x132c13['attributes']=_[_0xb1d5('0x32')](_0x44a726[_0xb1d5('0x33')],qs[_0xb1d5('0x34')](_0x17bb60['query'][_0xb1d5('0x34')]));_0x132c13[_0xb1d5('0x35')]=_0x132c13[_0xb1d5('0x35')][_0xb1d5('0x36')]?_0x132c13[_0xb1d5('0x35')]:_0x44a726[_0xb1d5('0x33')];if(!_0x17bb60[_0xb1d5('0x2f')][_0xb1d5('0x37')](_0xb1d5('0x38'))){_0x132c13['limit']=qs[_0xb1d5('0x20')](_0x17bb60[_0xb1d5('0x2f')][_0xb1d5('0x20')]);_0x132c13[_0xb1d5('0x1f')]=qs[_0xb1d5('0x1f')](_0x17bb60[_0xb1d5('0x2f')][_0xb1d5('0x1f')]);}_0x132c13[_0xb1d5('0x39')]=qs[_0xb1d5('0x3a')](_0x17bb60['query'][_0xb1d5('0x3a')]);_0x132c13[_0xb1d5('0x3b')]=qs[_0xb1d5('0x31')](_[_0xb1d5('0x3c')](_0x17bb60[_0xb1d5('0x2f')],_0x44a726['filters']),_0x118b5d);if(_0x17bb60[_0xb1d5('0x2f')][_0xb1d5('0x3d')]){_0x132c13[_0xb1d5('0x3b')]=_[_0xb1d5('0x3e')](_0x132c13[_0xb1d5('0x3b')],{'$or':_['map'](_0x118b5d,function(_0xfbefbf){if(_0xfbefbf[_0xb1d5('0x2e')]!=='VIRTUAL'){var _0x195bc1={};_0x195bc1[_0xfbefbf[_0xb1d5('0x29')]]={'$like':'%'+_0x17bb60[_0xb1d5('0x2f')][_0xb1d5('0x3d')]+'%'};return _0x195bc1;}})});}_0x132c13=_['merge']({},_0x132c13,_0x17bb60[_0xb1d5('0x3f')]);var _0x5cb7e2={'where':_0x132c13[_0xb1d5('0x3b')]};return db[_0xb1d5('0x2c')]['count'](_0x5cb7e2)[_0xb1d5('0x25')](function(_0x46c343){_0x47203d[_0xb1d5('0x40')]=_0x46c343;if(_0x17bb60['query'][_0xb1d5('0x41')]){_0x132c13[_0xb1d5('0x42')]=[{'all':!![]}];}return db[_0xb1d5('0x2c')][_0xb1d5('0x43')](_0x132c13);})[_0xb1d5('0x25')](function(_0x26d03d){_0x47203d[_0xb1d5('0x44')]=_0x26d03d;return _0x47203d;})[_0xb1d5('0x25')](respondWithFilteredResult(_0x917068,_0x132c13))[_0xb1d5('0x45')](handleError(_0x917068,null));};exports['show']=function(_0x4047ab,_0xd9812e){var _0x539a35={'raw':![],'where':{'id':_0x4047ab[_0xb1d5('0x46')]['id']}},_0x43a4dc={};_0x43a4dc[_0xb1d5('0x33')]=_[_0xb1d5('0x30')](db['ZendeskConfiguration'][_0xb1d5('0x2d')]);_0x43a4dc[_0xb1d5('0x2f')]=_[_0xb1d5('0x30')](_0x4047ab[_0xb1d5('0x2f')]);_0x43a4dc['filters']=_[_0xb1d5('0x32')](_0x43a4dc[_0xb1d5('0x33')],_0x43a4dc[_0xb1d5('0x2f')]);_0x539a35[_0xb1d5('0x35')]=_[_0xb1d5('0x32')](_0x43a4dc[_0xb1d5('0x33')],qs[_0xb1d5('0x34')](_0x4047ab[_0xb1d5('0x2f')][_0xb1d5('0x34')]));_0x539a35['attributes']=_0x539a35['attributes'][_0xb1d5('0x36')]?_0x539a35[_0xb1d5('0x35')]:_0x43a4dc[_0xb1d5('0x33')];if(_0x4047ab[_0xb1d5('0x2f')]['includeAll']){_0x539a35[_0xb1d5('0x42')]=[{'all':!![]}];}_0x539a35=_[_0xb1d5('0x3e')]({},_0x539a35,_0x4047ab[_0xb1d5('0x3f')]);return db[_0xb1d5('0x2c')][_0xb1d5('0x47')](_0x539a35)[_0xb1d5('0x25')](handleEntityNotFound(_0xd9812e,null))[_0xb1d5('0x25')](respondWithResult(_0xd9812e,null))[_0xb1d5('0x45')](handleError(_0xd9812e,null));};exports['create']=function(_0x50b80e,_0x21603c){return db[_0xb1d5('0x2c')][_0xb1d5('0x48')](_0x50b80e[_0xb1d5('0x49')],{})[_0xb1d5('0x25')](respondWithResult(_0x21603c,0xc9))[_0xb1d5('0x45')](handleError(_0x21603c,null));};exports[_0xb1d5('0x24')]=function(_0x3d188f,_0x40b907){if(_0x3d188f['body']['id']){delete _0x3d188f[_0xb1d5('0x49')]['id'];}return db[_0xb1d5('0x2c')][_0xb1d5('0x47')]({'where':{'id':_0x3d188f['params']['id']}})[_0xb1d5('0x25')](handleEntityNotFound(_0x40b907,null))[_0xb1d5('0x25')](saveUpdates(_0x3d188f[_0xb1d5('0x49')],null))['then'](respondWithResult(_0x40b907,null))[_0xb1d5('0x45')](handleError(_0x40b907,null));};exports[_0xb1d5('0x26')]=function(_0x5e4923,_0x5d023f){return db['ZendeskConfiguration']['find']({'where':{'id':_0x5e4923['params']['id']}})[_0xb1d5('0x25')](handleEntityNotFound(_0x5d023f,null))['then'](removeEntity(_0x5d023f,null))['catch'](handleError(_0x5d023f,null));};exports[_0xb1d5('0x4a')]=function(_0x41e78e,_0x344f2b,_0x155eba){var _0x523804={};var _0x25a80b={};var _0x20aba1;var _0x28821a;return db[_0xb1d5('0x2c')][_0xb1d5('0x4b')]({'where':{'id':_0x41e78e['params']['id']}})[_0xb1d5('0x25')](handleEntityNotFound(_0x344f2b,null))[_0xb1d5('0x25')](function(_0x43d86e){if(_0x43d86e){_0x20aba1=_0x43d86e;_0x25a80b[_0xb1d5('0x33')]=_[_0xb1d5('0x30')](db[_0xb1d5('0x4c')][_0xb1d5('0x2d')]);_0x25a80b[_0xb1d5('0x2f')]=_['keys'](_0x41e78e[_0xb1d5('0x2f')]);_0x25a80b[_0xb1d5('0x31')]=_['intersection'](_0x25a80b[_0xb1d5('0x33')],_0x25a80b[_0xb1d5('0x2f')]);_0x523804['attributes']=_['intersection'](_0x25a80b[_0xb1d5('0x33')],qs[_0xb1d5('0x34')](_0x41e78e[_0xb1d5('0x2f')][_0xb1d5('0x34')]));_0x523804['attributes']=_0x523804[_0xb1d5('0x35')][_0xb1d5('0x36')]?_0x523804[_0xb1d5('0x35')]:_0x25a80b['model'];_0x523804[_0xb1d5('0x39')]=qs[_0xb1d5('0x3a')](_0x41e78e['query'][_0xb1d5('0x3a')]);_0x523804[_0xb1d5('0x3b')]=qs[_0xb1d5('0x31')](_['pick'](_0x41e78e[_0xb1d5('0x2f')],_0x25a80b[_0xb1d5('0x31')]));if(_0x41e78e[_0xb1d5('0x2f')]['filter']){_0x523804[_0xb1d5('0x3b')]=_[_0xb1d5('0x3e')](_0x523804[_0xb1d5('0x3b')],{'$or':_[_0xb1d5('0x2b')](_0x523804[_0xb1d5('0x35')],function(_0x42f744){var _0x4fe025={};_0x4fe025[_0x42f744]={'$like':'%'+_0x41e78e['query']['filter']+'%'};return _0x4fe025;})});}_0x523804=_[_0xb1d5('0x3e')]({},_0x523804,_0x41e78e[_0xb1d5('0x3f')]);return _0x20aba1[_0xb1d5('0x4a')](_0x523804);}})['then'](function(_0x389818){if(_0x389818){_0x28821a=_0x389818[_0xb1d5('0x36')];if(!_0x41e78e['query'][_0xb1d5('0x37')](_0xb1d5('0x38'))){_0x523804[_0xb1d5('0x20')]=qs[_0xb1d5('0x20')](_0x41e78e[_0xb1d5('0x2f')][_0xb1d5('0x20')]);_0x523804[_0xb1d5('0x1f')]=qs[_0xb1d5('0x1f')](_0x41e78e[_0xb1d5('0x2f')][_0xb1d5('0x1f')]);}return _0x20aba1[_0xb1d5('0x4a')](_0x523804);}})[_0xb1d5('0x25')](function(_0x3f7efa){if(_0x3f7efa){return _0x3f7efa?{'count':_0x28821a,'rows':_0x3f7efa}:null;}})[_0xb1d5('0x25')](respondWithResult(_0x344f2b,null))['catch'](handleError(_0x344f2b,null));};exports[_0xb1d5('0x4d')]=function(_0x1f2ed8,_0x11f5e4,_0x16e309){var _0x240a50={};var _0x1a3ba9={};var _0xb087c5;var _0x4e7abc;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1f2ed8[_0xb1d5('0x46')]['id']}})[_0xb1d5('0x25')](handleEntityNotFound(_0x11f5e4,null))[_0xb1d5('0x25')](function(_0x6c9052){if(_0x6c9052){_0xb087c5=_0x6c9052;_0x1a3ba9[_0xb1d5('0x33')]=_[_0xb1d5('0x30')](db[_0xb1d5('0x4c')]['rawAttributes']);_0x1a3ba9[_0xb1d5('0x2f')]=_[_0xb1d5('0x30')](_0x1f2ed8[_0xb1d5('0x2f')]);_0x1a3ba9[_0xb1d5('0x31')]=_[_0xb1d5('0x32')](_0x1a3ba9['model'],_0x1a3ba9[_0xb1d5('0x2f')]);_0x240a50[_0xb1d5('0x35')]=_[_0xb1d5('0x32')](_0x1a3ba9[_0xb1d5('0x33')],qs[_0xb1d5('0x34')](_0x1f2ed8['query']['fields']));_0x240a50[_0xb1d5('0x35')]=_0x240a50[_0xb1d5('0x35')][_0xb1d5('0x36')]?_0x240a50[_0xb1d5('0x35')]:_0x1a3ba9[_0xb1d5('0x33')];_0x240a50[_0xb1d5('0x39')]=qs[_0xb1d5('0x3a')](_0x1f2ed8[_0xb1d5('0x2f')][_0xb1d5('0x3a')]);_0x240a50['where']=qs[_0xb1d5('0x31')](_[_0xb1d5('0x3c')](_0x1f2ed8[_0xb1d5('0x2f')],_0x1a3ba9['filters']));if(_0x1f2ed8['query'][_0xb1d5('0x3d')]){_0x240a50[_0xb1d5('0x3b')]=_[_0xb1d5('0x3e')](_0x240a50[_0xb1d5('0x3b')],{'$or':_['map'](_0x240a50[_0xb1d5('0x35')],function(_0x5e4fa7){var _0x530518={};_0x530518[_0x5e4fa7]={'$like':'%'+_0x1f2ed8[_0xb1d5('0x2f')][_0xb1d5('0x3d')]+'%'};return _0x530518;})});}_0x240a50=_[_0xb1d5('0x3e')]({},_0x240a50,_0x1f2ed8[_0xb1d5('0x3f')]);return _0xb087c5['getSubjects'](_0x240a50);}})[_0xb1d5('0x25')](function(_0xb2435b){if(_0xb2435b){_0x4e7abc=_0xb2435b[_0xb1d5('0x36')];if(!_0x1f2ed8['query']['hasOwnProperty'](_0xb1d5('0x38'))){_0x240a50[_0xb1d5('0x20')]=qs['limit'](_0x1f2ed8[_0xb1d5('0x2f')][_0xb1d5('0x20')]);_0x240a50['offset']=qs[_0xb1d5('0x1f')](_0x1f2ed8[_0xb1d5('0x2f')][_0xb1d5('0x1f')]);}return _0xb087c5[_0xb1d5('0x4d')](_0x240a50);}})['then'](function(_0x1f3334){if(_0x1f3334){return _0x1f3334?{'count':_0x4e7abc,'rows':_0x1f3334}:null;}})['then'](respondWithResult(_0x11f5e4,null))['catch'](handleError(_0x11f5e4,null));};exports[_0xb1d5('0x4e')]=function(_0x3fbbdf,_0x89fb10,_0x337200){var _0x5ec3a1={};var _0x4c4b47={};var _0x3b64ca;var _0x20d02a;return db[_0xb1d5('0x2c')][_0xb1d5('0x4b')]({'where':{'id':_0x3fbbdf[_0xb1d5('0x46')]['id']}})[_0xb1d5('0x25')](handleEntityNotFound(_0x89fb10,null))[_0xb1d5('0x25')](function(_0x1ad1da){if(_0x1ad1da){_0x3b64ca=_0x1ad1da;_0x4c4b47[_0xb1d5('0x33')]=_[_0xb1d5('0x30')](db[_0xb1d5('0x4c')][_0xb1d5('0x2d')]);_0x4c4b47['query']=_[_0xb1d5('0x30')](_0x3fbbdf[_0xb1d5('0x2f')]);_0x4c4b47['filters']=_[_0xb1d5('0x32')](_0x4c4b47[_0xb1d5('0x33')],_0x4c4b47[_0xb1d5('0x2f')]);_0x5ec3a1[_0xb1d5('0x35')]=_[_0xb1d5('0x32')](_0x4c4b47[_0xb1d5('0x33')],qs[_0xb1d5('0x34')](_0x3fbbdf['query'][_0xb1d5('0x34')]));_0x5ec3a1[_0xb1d5('0x35')]=_0x5ec3a1[_0xb1d5('0x35')][_0xb1d5('0x36')]?_0x5ec3a1[_0xb1d5('0x35')]:_0x4c4b47[_0xb1d5('0x33')];_0x5ec3a1[_0xb1d5('0x39')]=qs[_0xb1d5('0x3a')](_0x3fbbdf[_0xb1d5('0x2f')][_0xb1d5('0x3a')]);_0x5ec3a1['where']=qs[_0xb1d5('0x31')](_[_0xb1d5('0x3c')](_0x3fbbdf['query'],_0x4c4b47[_0xb1d5('0x31')]));if(_0x3fbbdf[_0xb1d5('0x2f')][_0xb1d5('0x3d')]){_0x5ec3a1[_0xb1d5('0x3b')]=_[_0xb1d5('0x3e')](_0x5ec3a1[_0xb1d5('0x3b')],{'$or':_[_0xb1d5('0x2b')](_0x5ec3a1[_0xb1d5('0x35')],function(_0x14271e){var _0x5ea042={};_0x5ea042[_0x14271e]={'$like':'%'+_0x3fbbdf[_0xb1d5('0x2f')]['filter']+'%'};return _0x5ea042;})});}_0x5ec3a1=_['merge']({},_0x5ec3a1,_0x3fbbdf[_0xb1d5('0x3f')]);return _0x3b64ca[_0xb1d5('0x4e')](_0x5ec3a1);}})[_0xb1d5('0x25')](function(_0x3f87b5){if(_0x3f87b5){_0x20d02a=_0x3f87b5[_0xb1d5('0x36')];if(!_0x3fbbdf[_0xb1d5('0x2f')][_0xb1d5('0x37')](_0xb1d5('0x38'))){_0x5ec3a1[_0xb1d5('0x20')]=qs[_0xb1d5('0x20')](_0x3fbbdf['query']['limit']);_0x5ec3a1[_0xb1d5('0x1f')]=qs['offset'](_0x3fbbdf[_0xb1d5('0x2f')][_0xb1d5('0x1f')]);}return _0x3b64ca[_0xb1d5('0x4e')](_0x5ec3a1);}})['then'](function(_0x34d69b){if(_0x34d69b){return _0x34d69b?{'count':_0x20d02a,'rows':_0x34d69b}:null;}})[_0xb1d5('0x25')](respondWithResult(_0x89fb10,null))[_0xb1d5('0x45')](handleError(_0x89fb10,null));};exports[_0xb1d5('0x4f')]=function(_0x52df97,_0xe4bf52,_0x2482be){var _0x293438={};var _0x457f5a={};var _0x55ca9c;var _0x14a9bd;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x52df97[_0xb1d5('0x46')]['id']}})['then'](handleEntityNotFound(_0xe4bf52,null))[_0xb1d5('0x25')](function(_0x40913c){if(_0x40913c){_0x55ca9c=_0x40913c;_0x457f5a[_0xb1d5('0x33')]=_['keys'](db[_0xb1d5('0x50')]['rawAttributes']);_0x457f5a[_0xb1d5('0x2f')]=_['keys'](_0x52df97[_0xb1d5('0x2f')]);_0x457f5a[_0xb1d5('0x31')]=_[_0xb1d5('0x32')](_0x457f5a[_0xb1d5('0x33')],_0x457f5a[_0xb1d5('0x2f')]);_0x293438[_0xb1d5('0x35')]=_[_0xb1d5('0x32')](_0x457f5a[_0xb1d5('0x33')],qs[_0xb1d5('0x34')](_0x52df97['query'][_0xb1d5('0x34')]));_0x293438[_0xb1d5('0x35')]=_0x293438[_0xb1d5('0x35')][_0xb1d5('0x36')]?_0x293438[_0xb1d5('0x35')]:_0x457f5a['model'];_0x293438[_0xb1d5('0x39')]=qs[_0xb1d5('0x3a')](_0x52df97[_0xb1d5('0x2f')][_0xb1d5('0x3a')]);_0x293438[_0xb1d5('0x3b')]=qs[_0xb1d5('0x31')](_[_0xb1d5('0x3c')](_0x52df97['query'],_0x457f5a[_0xb1d5('0x31')]));if(_0x52df97[_0xb1d5('0x2f')][_0xb1d5('0x3d')]){_0x293438[_0xb1d5('0x3b')]=_[_0xb1d5('0x3e')](_0x293438[_0xb1d5('0x3b')],{'$or':_[_0xb1d5('0x2b')](_0x293438['attributes'],function(_0x2470ed){var _0xc54833={};_0xc54833[_0x2470ed]={'$like':'%'+_0x52df97[_0xb1d5('0x2f')][_0xb1d5('0x3d')]+'%'};return _0xc54833;})});}_0x293438=_[_0xb1d5('0x3e')]({},_0x293438,_0x52df97[_0xb1d5('0x3f')]);return _0x55ca9c['getTags'](_0x293438);}})['then'](function(_0x55aff7){if(_0x55aff7){_0x14a9bd=_0x55aff7['length'];if(!_0x52df97['query'][_0xb1d5('0x37')](_0xb1d5('0x38'))){_0x293438[_0xb1d5('0x20')]=qs['limit'](_0x52df97[_0xb1d5('0x2f')][_0xb1d5('0x20')]);_0x293438[_0xb1d5('0x1f')]=qs['offset'](_0x52df97[_0xb1d5('0x2f')][_0xb1d5('0x1f')]);}return _0x55ca9c['getTags'](_0x293438);}})[_0xb1d5('0x25')](function(_0x3cfe67){if(_0x3cfe67){return _0x3cfe67?{'count':_0x14a9bd,'rows':_0x3cfe67}:null;}})[_0xb1d5('0x25')](respondWithResult(_0xe4bf52,null))['catch'](handleError(_0xe4bf52,null));};exports['setTags']=function(_0x334d12,_0x57fdd4,_0x5cb306){if(_0x334d12[_0xb1d5('0x49')]['id']){delete _0x334d12[_0xb1d5('0x49')]['id'];}return db[_0xb1d5('0x2c')][_0xb1d5('0x4b')]({'where':{'id':_0x334d12[_0xb1d5('0x46')]['id']}})['then'](handleEntityNotFound(_0x57fdd4,null))[_0xb1d5('0x25')](function(_0xbb5490){if(_0xbb5490){return _0xbb5490[_0xb1d5('0x51')](_0x334d12[_0xb1d5('0x49')][_0xb1d5('0x52')]||[]);}return null;})[_0xb1d5('0x25')](respondWithResult(_0x57fdd4,null))['catch'](handleError(_0x57fdd4,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index cbe8377..42c3927 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 _0x1c9a=['moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger'];(function(_0x11d6e8,_0x4f3fb1){var _0x5cd290=function(_0x38141d){while(--_0x38141d){_0x11d6e8['push'](_0x11d6e8['shift']());}};_0x5cd290(++_0x4f3fb1);}(_0x1c9a,0x98));var _0xa1c9=function(_0x25462d,_0x1ced13){_0x25462d=_0x25462d-0x0;var _0x2c7116=_0x1c9a[_0x25462d];return _0x2c7116;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var logger=require(_0xa1c9('0x1'))('api');var moment=require(_0xa1c9('0x2'));var BPromise=require(_0xa1c9('0x3'));var rp=require(_0xa1c9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1c9('0x5'));var config=require(_0xa1c9('0x6'));var attributes=require(_0xa1c9('0x7'));module[_0xa1c9('0x8')]=function(_0x572229,_0x144e91){return _0x572229['define'](_0xa1c9('0x9'),attributes,{'tableName':_0xa1c9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9354=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9354,0x96));var _0x4935=function(_0x49aab7,_0x1d6397){_0x49aab7=_0x49aab7-0x0;var _0x587b6f=_0x9354[_0x49aab7];return _0x587b6f;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var logger=require(_0x4935('0x1'))('api');var moment=require(_0x4935('0x2'));var BPromise=require(_0x4935('0x3'));var rp=require(_0x4935('0x4'));var fs=require('fs');var path=require(_0x4935('0x5'));var rimraf=require('rimraf');var config=require(_0x4935('0x6'));var attributes=require(_0x4935('0x7'));module[_0x4935('0x8')]=function(_0x2d518a,_0x263864){return _0x2d518a[_0x4935('0x9')](_0x4935('0xa'),attributes,{'tableName':_0x4935('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 b4f8717..07d01af 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 _0x60a5=['ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','request\x20sent','debug'];(function(_0x7e2486,_0x32c5df){var _0x275dbf=function(_0x4c041e){while(--_0x4c041e){_0x7e2486['push'](_0x7e2486['shift']());}};_0x275dbf(++_0x32c5df);}(_0x60a5,0x1eb));var _0x560a=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x60a5[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x560a('0x0'));var util=require(_0x560a('0x1'));var moment=require(_0x560a('0x2'));var BPromise=require('bluebird');var rs=require(_0x560a('0x3'));var fs=require('fs');var Redis=require(_0x560a('0x4'));var db=require(_0x560a('0x5'))['db'];var utils=require(_0x560a('0x6'));var logger=require(_0x560a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x560a('0x8'));var client=jayson[_0x560a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d5dd5,_0x5ea06c,_0x5aba34){return new BPromise(function(_0x3fa715,_0x2658c3){return client[_0x560a('0xa')](_0x5d5dd5,_0x5aba34)['then'](function(_0x14102d){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x5ea06c,_0x560a('0xb'));logger[_0x560a('0xc')](_0x560a('0xd'),_0x5ea06c,_0x560a('0xb'),JSON[_0x560a('0xe')](_0x14102d));if(_0x14102d['error']){if(_0x14102d[_0x560a('0xf')]['code']===0x1f4){logger[_0x560a('0xf')](_0x560a('0x10'),_0x5ea06c,_0x14102d['error']['message']);return _0x2658c3(_0x14102d[_0x560a('0xf')]['message']);}logger[_0x560a('0xf')](_0x560a('0x10'),_0x5ea06c,_0x14102d[_0x560a('0xf')]['message']);return _0x3fa715(_0x14102d['error'][_0x560a('0x11')]);}else{logger[_0x560a('0x12')](_0x560a('0x10'),_0x5ea06c,_0x560a('0xb'));_0x3fa715(_0x14102d[_0x560a('0x13')]['message']);}})[_0x560a('0x14')](function(_0x2923f7){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x5ea06c,_0x2923f7);_0x2658c3(_0x2923f7);});});} \ No newline at end of file +var _0xc91e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x29f3cf,_0x2b64eb){var _0x9cc938=function(_0x29f584){while(--_0x29f584){_0x29f3cf['push'](_0x29f3cf['shift']());}};_0x9cc938(++_0x2b64eb);}(_0xc91e,0x89));var _0xec91=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc91e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xec91('0x0'));var util=require(_0xec91('0x1'));var moment=require(_0xec91('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec91('0x3'));var db=require(_0xec91('0x4'))['db'];var utils=require(_0xec91('0x5'));var logger=require(_0xec91('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xec91('0x7')][_0xec91('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x54dcd5,_0x207d3f,_0x58939e){return new BPromise(function(_0xbefc63,_0x59c43d){return client[_0xec91('0x9')](_0x54dcd5,_0x58939e)[_0xec91('0xa')](function(_0x47fa7b){logger[_0xec91('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x207d3f,_0xec91('0xc'));logger[_0xec91('0xd')](_0xec91('0xe'),_0x207d3f,'request\x20sent',JSON['stringify'](_0x47fa7b));if(_0x47fa7b[_0xec91('0xf')]){if(_0x47fa7b[_0xec91('0xf')]['code']===0x1f4){logger[_0xec91('0xf')](_0xec91('0x10'),_0x207d3f,_0x47fa7b['error']['message']);return _0x59c43d(_0x47fa7b['error'][_0xec91('0x11')]);}logger[_0xec91('0xf')](_0xec91('0x10'),_0x207d3f,_0x47fa7b['error'][_0xec91('0x11')]);return _0xbefc63(_0x47fa7b['error'][_0xec91('0x11')]);}else{logger[_0xec91('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x207d3f,_0xec91('0xc'));_0xbefc63(_0x47fa7b[_0xec91('0x12')][_0xec91('0x11')]);}})[_0xec91('0x13')](function(_0x715d12){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x207d3f,_0x715d12);_0x59c43d(_0x715d12);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 13f951b..3b4ab44 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 _0x76bd=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x76bd,0xe9));var _0xd76b=function(_0x2e8d12,_0x39351b){_0x2e8d12=_0x2e8d12-0x0;var _0x22b215=_0x76bd[_0x2e8d12];return _0x22b215;};'use strict';var multer=require('multer');var util=require(_0xd76b('0x0'));var path=require(_0xd76b('0x1'));var timeout=require(_0xd76b('0x2'));var express=require('express');var router=express[_0xd76b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd76b('0x4'));var interaction=require(_0xd76b('0x5'));var config=require(_0xd76b('0x6'));var controller=require('./intZendeskField.controller');router[_0xd76b('0x7')]('/',auth[_0xd76b('0x8')](),controller[_0xd76b('0x9')]);router['get'](_0xd76b('0xa'),auth[_0xd76b('0x8')](),controller[_0xd76b('0xb')]);router[_0xd76b('0xc')]('/',auth[_0xd76b('0x8')](),controller['create']);router[_0xd76b('0xd')](_0xd76b('0xa'),auth[_0xd76b('0x8')](),controller[_0xd76b('0xe')]);router['delete'](_0xd76b('0xa'),auth[_0xd76b('0x8')](),controller[_0xd76b('0xf')]);module[_0xd76b('0x10')]=router; \ No newline at end of file +var _0x5afc=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','express','fs-extra'];(function(_0x10ecbe,_0x636711){var _0xa61172=function(_0x355310){while(--_0x355310){_0x10ecbe['push'](_0x10ecbe['shift']());}};_0xa61172(++_0x636711);}(_0x5afc,0x1d7));var _0xc5af=function(_0x10dc48,_0x1d3322){_0x10dc48=_0x10dc48-0x0;var _0x432b93=_0x5afc[_0x10dc48];return _0x432b93;};'use strict';var multer=require(_0xc5af('0x0'));var util=require('util');var path=require(_0xc5af('0x1'));var timeout=require('connect-timeout');var express=require(_0xc5af('0x2'));var router=express['Router']();var fs_extra=require(_0xc5af('0x3'));var auth=require(_0xc5af('0x4'));var interaction=require(_0xc5af('0x5'));var config=require(_0xc5af('0x6'));var controller=require('./intZendeskField.controller');router[_0xc5af('0x7')]('/',auth['isAuthenticated'](),controller[_0xc5af('0x8')]);router[_0xc5af('0x7')]('/:id',auth[_0xc5af('0x9')](),controller[_0xc5af('0xa')]);router[_0xc5af('0xb')]('/',auth[_0xc5af('0x9')](),controller[_0xc5af('0xc')]);router[_0xc5af('0xd')](_0xc5af('0xe'),auth['isAuthenticated'](),controller[_0xc5af('0xf')]);router[_0xc5af('0x10')](_0xc5af('0xe'),auth[_0xc5af('0x9')](),controller[_0xc5af('0x11')]);module[_0xc5af('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 9867d77..63cc9eb 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 _0xd8fd=['exports','customVariable','keyValue','picklist','string','STRING','ENUM','variable','BOOLEAN'];(function(_0x1afea3,_0x42154b){var _0x1c6410=function(_0x5dc9de){while(--_0x5dc9de){_0x1afea3['push'](_0x1afea3['shift']());}};_0x1c6410(++_0x42154b);}(_0xd8fd,0x117));var _0xdd8f=function(_0x2e1e77,_0x1bc176){_0x2e1e77=_0x2e1e77-0x0;var _0x5403b6=_0xd8fd[_0x2e1e77];return _0x5403b6;};'use strict';var Sequelize=require('sequelize');module[_0xdd8f('0x0')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xdd8f('0x1'),_0xdd8f('0x2'),_0xdd8f('0x3')),'defaultValue':_0xdd8f('0x4')},'content':{'type':Sequelize[_0xdd8f('0x5')]},'key':{'type':Sequelize[_0xdd8f('0x5')]},'keyType':{'type':Sequelize[_0xdd8f('0x6')]('string',_0xdd8f('0x7'),_0xdd8f('0x1'))},'keyContent':{'type':Sequelize[_0xdd8f('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdd8f('0x5')]},'customField':{'type':Sequelize[_0xdd8f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1a8a=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x1a8a,0x154));var _0xa1a8=function(_0x523671,_0x4657fc){_0x523671=_0x523671-0x0;var _0x5b0bdc=_0x1a8a[_0x523671];return _0x5b0bdc;};'use strict';var Sequelize=require(_0xa1a8('0x0'));module[_0xa1a8('0x1')]={'type':{'type':Sequelize[_0xa1a8('0x2')](_0xa1a8('0x3'),_0xa1a8('0x4'),_0xa1a8('0x5'),_0xa1a8('0x6'),_0xa1a8('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa1a8('0x8')]},'key':{'type':Sequelize[_0xa1a8('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xa1a8('0x3'),'variable',_0xa1a8('0x5'))},'keyContent':{'type':Sequelize[_0xa1a8('0x8')]},'idField':{'type':Sequelize[_0xa1a8('0x8')]},'nameField':{'type':Sequelize[_0xa1a8('0x8')]},'customField':{'type':Sequelize[_0xa1a8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa1a8('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 2350898..98ad02a 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 _0x808b=['sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','save','update','destroy','then','stack','name','send','map','ZendeskField','rawAttributes','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','show','params','length','catch','create','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x13c2e8,_0x2dd8a3){var _0x4314dc=function(_0x35cb29){while(--_0x35cb29){_0x13c2e8['push'](_0x13c2e8['shift']());}};_0x4314dc(++_0x2dd8a3);}(_0x808b,0x87));var _0xb808=function(_0xd32a83,_0x9c9182){_0xd32a83=_0xd32a83-0x0;var _0x58216e=_0x808b[_0xd32a83];return _0x58216e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb808('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb808('0x1'));var rp=require(_0xb808('0x2'));var moment=require(_0xb808('0x3'));var BPromise=require(_0xb808('0x4'));var Mustache=require(_0xb808('0x5'));var util=require(_0xb808('0x6'));var path=require('path');var sox=require(_0xb808('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb808('0x8'));var _=require(_0xb808('0x9'));var squel=require(_0xb808('0xa'));var crypto=require(_0xb808('0xb'));var jsforce=require(_0xb808('0xc'));var deskjs=require(_0xb808('0xd'));var toCsv=require(_0xb808('0xe'));var querystring=require(_0xb808('0xf'));var Papa=require(_0xb808('0x10'));var Redis=require(_0xb808('0x11'));var authService=require(_0xb808('0x12'));var qs=require(_0xb808('0x13'));var as=require(_0xb808('0x14'));var hardwareService=require(_0xb808('0x15'));var logger=require(_0xb808('0x16'))(_0xb808('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb808('0x18'));var db=require(_0xb808('0x19'))['db'];function respondWithStatusCode(_0x49a48c,_0x45acf1){_0x45acf1=_0x45acf1||0xcc;return function(_0x26293a){if(_0x26293a){return _0x49a48c[_0xb808('0x1a')](_0x45acf1);}return _0x49a48c[_0xb808('0x1b')](_0x45acf1)[_0xb808('0x1c')]();};}function respondWithResult(_0x59cbfc,_0x5e68dd){_0x5e68dd=_0x5e68dd||0xc8;return function(_0x1c15c4){if(_0x1c15c4){return _0x59cbfc['status'](_0x5e68dd)[_0xb808('0x1d')](_0x1c15c4);}};}function respondWithFilteredResult(_0x340dd2,_0x454a4a){return function(_0x2d9720){if(_0x2d9720){var _0x2a85cc=typeof _0x454a4a[_0xb808('0x1e')]===_0xb808('0x1f')&&typeof _0x454a4a[_0xb808('0x20')]==='undefined';var _0x939f6=_0x2d9720[_0xb808('0x21')];var _0x552a94=_0x2a85cc?0x0:_0x454a4a['offset'];var _0x2a9ac3=_0x2a85cc?_0x2d9720[_0xb808('0x21')]:_0x454a4a[_0xb808('0x1e')]+_0x454a4a[_0xb808('0x20')];var _0xe0553e;if(_0x2a9ac3>=_0x939f6){_0x2a9ac3=_0x939f6;_0xe0553e=0xc8;}else{_0xe0553e=0xce;}_0x340dd2[_0xb808('0x1b')](_0xe0553e);return _0x340dd2['set']('Content-Range',_0x552a94+'-'+_0x2a9ac3+'/'+_0x939f6)[_0xb808('0x1d')](_0x2d9720);}return null;};}function patchUpdates(_0x27a866){return function(_0x283e72){try{jsonpatch['apply'](_0x283e72,_0x27a866,!![]);}catch(_0xf19db6){return BPromise['reject'](_0xf19db6);}return _0x283e72[_0xb808('0x22')]();};}function saveUpdates(_0x4b7d91,_0x132abf){return function(_0x5a9e08){if(_0x5a9e08){return _0x5a9e08[_0xb808('0x23')](_0x4b7d91)['then'](function(_0x182318){return _0x182318;});}return null;};}function removeEntity(_0x3c0b49,_0x324530){return function(_0x132d3b){if(_0x132d3b){return _0x132d3b[_0xb808('0x24')]()[_0xb808('0x25')](function(){_0x3c0b49[_0xb808('0x1b')](0xcc)[_0xb808('0x1c')]();});}};}function handleEntityNotFound(_0x3a78b3,_0x15c301){return function(_0x5abe39){if(!_0x5abe39){_0x3a78b3[_0xb808('0x1a')](0x194);}return _0x5abe39;};}function handleError(_0x44fa8a,_0x3b7ba4){_0x3b7ba4=_0x3b7ba4||0x1f4;return function(_0x467b5c){logger['error'](_0x467b5c[_0xb808('0x26')]);if(_0x467b5c[_0xb808('0x27')]){delete _0x467b5c[_0xb808('0x27')];}_0x44fa8a['status'](_0x3b7ba4)[_0xb808('0x28')](_0x467b5c);};}exports['index']=function(_0x174e01,_0x27d6e6){var _0x17cc2c={},_0x590a95={},_0x36e0b8={'count':0x0,'rows':[]};var _0x2787ad=_[_0xb808('0x29')](db[_0xb808('0x2a')][_0xb808('0x2b')],function(_0x29d963){return{'name':_0x29d963['fieldName'],'type':_0x29d963['type'][_0xb808('0x2c')]};});_0x590a95['model']=_[_0xb808('0x29')](_0x2787ad,_0xb808('0x27'));_0x590a95['query']=_[_0xb808('0x2d')](_0x174e01[_0xb808('0x2e')]);_0x590a95[_0xb808('0x2f')]=_['intersection'](_0x590a95[_0xb808('0x30')],_0x590a95[_0xb808('0x2e')]);_0x17cc2c[_0xb808('0x31')]=_[_0xb808('0x32')](_0x590a95[_0xb808('0x30')],qs['fields'](_0x174e01[_0xb808('0x2e')][_0xb808('0x33')]));_0x17cc2c[_0xb808('0x31')]=_0x17cc2c[_0xb808('0x31')]['length']?_0x17cc2c['attributes']:_0x590a95[_0xb808('0x30')];if(!_0x174e01[_0xb808('0x2e')][_0xb808('0x34')](_0xb808('0x35'))){_0x17cc2c[_0xb808('0x20')]=qs[_0xb808('0x20')](_0x174e01[_0xb808('0x2e')][_0xb808('0x20')]);_0x17cc2c[_0xb808('0x1e')]=qs[_0xb808('0x1e')](_0x174e01['query'][_0xb808('0x1e')]);}_0x17cc2c[_0xb808('0x36')]=qs[_0xb808('0x37')](_0x174e01[_0xb808('0x2e')][_0xb808('0x37')]);_0x17cc2c[_0xb808('0x38')]=qs[_0xb808('0x2f')](_[_0xb808('0x39')](_0x174e01['query'],_0x590a95[_0xb808('0x2f')]),_0x2787ad);if(_0x174e01[_0xb808('0x2e')][_0xb808('0x3a')]){_0x17cc2c['where']=_['merge'](_0x17cc2c['where'],{'$or':_[_0xb808('0x29')](_0x2787ad,function(_0x545326){if(_0x545326[_0xb808('0x3b')]!==_0xb808('0x3c')){var _0x5e2e14={};_0x5e2e14[_0x545326[_0xb808('0x27')]]={'$like':'%'+_0x174e01[_0xb808('0x2e')][_0xb808('0x3a')]+'%'};return _0x5e2e14;}})});}_0x17cc2c=_['merge']({},_0x17cc2c,_0x174e01[_0xb808('0x3d')]);var _0x7f1681={'where':_0x17cc2c[_0xb808('0x38')]};return db[_0xb808('0x2a')][_0xb808('0x21')](_0x7f1681)[_0xb808('0x25')](function(_0x471f0a){_0x36e0b8[_0xb808('0x21')]=_0x471f0a;if(_0x174e01[_0xb808('0x2e')][_0xb808('0x3e')]){_0x17cc2c[_0xb808('0x3f')]=[{'all':!![]}];}return db[_0xb808('0x2a')]['findAll'](_0x17cc2c);})['then'](function(_0x3d49d4){_0x36e0b8['rows']=_0x3d49d4;return _0x36e0b8;})[_0xb808('0x25')](respondWithFilteredResult(_0x27d6e6,_0x17cc2c))['catch'](handleError(_0x27d6e6,null));};exports[_0xb808('0x40')]=function(_0x3a4ba2,_0x2b1fc0){var _0x56eaec={'raw':!![],'where':{'id':_0x3a4ba2[_0xb808('0x41')]['id']}},_0x55fa29={};_0x55fa29['model']=_[_0xb808('0x2d')](db[_0xb808('0x2a')]['rawAttributes']);_0x55fa29[_0xb808('0x2e')]=_['keys'](_0x3a4ba2[_0xb808('0x2e')]);_0x55fa29[_0xb808('0x2f')]=_[_0xb808('0x32')](_0x55fa29[_0xb808('0x30')],_0x55fa29[_0xb808('0x2e')]);_0x56eaec[_0xb808('0x31')]=_[_0xb808('0x32')](_0x55fa29['model'],qs[_0xb808('0x33')](_0x3a4ba2[_0xb808('0x2e')][_0xb808('0x33')]));_0x56eaec[_0xb808('0x31')]=_0x56eaec[_0xb808('0x31')][_0xb808('0x42')]?_0x56eaec['attributes']:_0x55fa29[_0xb808('0x30')];if(_0x3a4ba2[_0xb808('0x2e')][_0xb808('0x3e')]){_0x56eaec[_0xb808('0x3f')]=[{'all':!![]}];}_0x56eaec=_['merge']({},_0x56eaec,_0x3a4ba2[_0xb808('0x3d')]);return db[_0xb808('0x2a')]['find'](_0x56eaec)['then'](handleEntityNotFound(_0x2b1fc0,null))[_0xb808('0x25')](respondWithResult(_0x2b1fc0,null))[_0xb808('0x43')](handleError(_0x2b1fc0,null));};exports[_0xb808('0x44')]=function(_0x4a73b5,_0x409269){return db[_0xb808('0x2a')][_0xb808('0x44')](_0x4a73b5[_0xb808('0x45')],{})[_0xb808('0x25')](respondWithResult(_0x409269,0xc9))[_0xb808('0x43')](handleError(_0x409269,null));};exports[_0xb808('0x23')]=function(_0x54703f,_0x438551){if(_0x54703f[_0xb808('0x45')]['id']){delete _0x54703f[_0xb808('0x45')]['id'];}return db[_0xb808('0x2a')][_0xb808('0x46')]({'where':{'id':_0x54703f[_0xb808('0x41')]['id']}})[_0xb808('0x25')](handleEntityNotFound(_0x438551,null))[_0xb808('0x25')](saveUpdates(_0x54703f[_0xb808('0x45')],null))['then'](respondWithResult(_0x438551,null))[_0xb808('0x43')](handleError(_0x438551,null));};exports[_0xb808('0x24')]=function(_0x5438ea,_0xdbf1ca){return db['ZendeskField'][_0xb808('0x46')]({'where':{'id':_0x5438ea[_0xb808('0x41')]['id']}})[_0xb808('0x25')](handleEntityNotFound(_0xdbf1ca,null))['then'](removeEntity(_0xdbf1ca,null))[_0xb808('0x43')](handleError(_0xdbf1ca,null));}; \ No newline at end of file +var _0x4676=['stack','name','index','map','ZendeskField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','create','body','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error'];(function(_0x375126,_0x514a8e){var _0x1f76bb=function(_0x22f2d0){while(--_0x22f2d0){_0x375126['push'](_0x375126['shift']());}};_0x1f76bb(++_0x514a8e);}(_0x4676,0x1e4));var _0x6467=function(_0xba5275,_0x2d3154){_0xba5275=_0xba5275-0x0;var _0x76015b=_0x4676[_0xba5275];return _0x76015b;};'use strict';var emlformat=require(_0x6467('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6467('0x1'));var jsonpatch=require(_0x6467('0x2'));var rp=require(_0x6467('0x3'));var moment=require(_0x6467('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6467('0x5'));var util=require(_0x6467('0x6'));var path=require(_0x6467('0x7'));var sox=require(_0x6467('0x8'));var csv=require(_0x6467('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6467('0xa'));var squel=require(_0x6467('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6467('0xc'));var toCsv=require(_0x6467('0x9'));var querystring=require(_0x6467('0xd'));var Papa=require(_0x6467('0xe'));var Redis=require(_0x6467('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6467('0x10'));var as=require(_0x6467('0x11'));var hardwareService=require(_0x6467('0x12'));var logger=require(_0x6467('0x13'))(_0x6467('0x14'));var utils=require(_0x6467('0x15'));var config=require(_0x6467('0x16'));var licenseUtil=require(_0x6467('0x17'));var db=require(_0x6467('0x18'))['db'];function respondWithStatusCode(_0x96012d,_0x1f6984){_0x1f6984=_0x1f6984||0xcc;return function(_0x41be48){if(_0x41be48){return _0x96012d[_0x6467('0x19')](_0x1f6984);}return _0x96012d[_0x6467('0x1a')](_0x1f6984)[_0x6467('0x1b')]();};}function respondWithResult(_0x272eca,_0x428ba8){_0x428ba8=_0x428ba8||0xc8;return function(_0x5a90c9){if(_0x5a90c9){return _0x272eca[_0x6467('0x1a')](_0x428ba8)[_0x6467('0x1c')](_0x5a90c9);}};}function respondWithFilteredResult(_0x383f85,_0x86e55e){return function(_0x599a96){if(_0x599a96){var _0xf89d03=typeof _0x86e55e[_0x6467('0x1d')]===_0x6467('0x1e')&&typeof _0x86e55e[_0x6467('0x1f')]==='undefined';var _0x4b0def=_0x599a96[_0x6467('0x20')];var _0x51edbd=_0xf89d03?0x0:_0x86e55e['offset'];var _0xefba83=_0xf89d03?_0x599a96['count']:_0x86e55e['offset']+_0x86e55e[_0x6467('0x1f')];var _0x420002;if(_0xefba83>=_0x4b0def){_0xefba83=_0x4b0def;_0x420002=0xc8;}else{_0x420002=0xce;}_0x383f85[_0x6467('0x1a')](_0x420002);return _0x383f85[_0x6467('0x21')]('Content-Range',_0x51edbd+'-'+_0xefba83+'/'+_0x4b0def)[_0x6467('0x1c')](_0x599a96);}return null;};}function patchUpdates(_0x3c3054){return function(_0x56d637){try{jsonpatch[_0x6467('0x22')](_0x56d637,_0x3c3054,!![]);}catch(_0x4f8161){return BPromise[_0x6467('0x23')](_0x4f8161);}return _0x56d637[_0x6467('0x24')]();};}function saveUpdates(_0x3658d2,_0x976daf){return function(_0x272e3e){if(_0x272e3e){return _0x272e3e[_0x6467('0x25')](_0x3658d2)[_0x6467('0x26')](function(_0x19fce0){return _0x19fce0;});}return null;};}function removeEntity(_0x3090ee,_0x3378b6){return function(_0x2764b3){if(_0x2764b3){return _0x2764b3[_0x6467('0x27')]()[_0x6467('0x26')](function(){_0x3090ee[_0x6467('0x1a')](0xcc)[_0x6467('0x1b')]();});}};}function handleEntityNotFound(_0x5bd104,_0x2f9008){return function(_0x515c16){if(!_0x515c16){_0x5bd104[_0x6467('0x19')](0x194);}return _0x515c16;};}function handleError(_0x27866e,_0x5bef58){_0x5bef58=_0x5bef58||0x1f4;return function(_0x36785f){logger[_0x6467('0x28')](_0x36785f[_0x6467('0x29')]);if(_0x36785f[_0x6467('0x2a')]){delete _0x36785f[_0x6467('0x2a')];}_0x27866e[_0x6467('0x1a')](_0x5bef58)['send'](_0x36785f);};}exports[_0x6467('0x2b')]=function(_0x19655d,_0x20da00){var _0x5b1add={},_0x2d7fcd={},_0x214f6e={'count':0x0,'rows':[]};var _0x48bd24=_[_0x6467('0x2c')](db[_0x6467('0x2d')][_0x6467('0x2e')],function(_0x2450d8){return{'name':_0x2450d8[_0x6467('0x2f')],'type':_0x2450d8['type'][_0x6467('0x30')]};});_0x2d7fcd[_0x6467('0x31')]=_[_0x6467('0x2c')](_0x48bd24,'name');_0x2d7fcd[_0x6467('0x32')]=_[_0x6467('0x33')](_0x19655d[_0x6467('0x32')]);_0x2d7fcd[_0x6467('0x34')]=_['intersection'](_0x2d7fcd[_0x6467('0x31')],_0x2d7fcd['query']);_0x5b1add[_0x6467('0x35')]=_[_0x6467('0x36')](_0x2d7fcd[_0x6467('0x31')],qs[_0x6467('0x37')](_0x19655d[_0x6467('0x32')][_0x6467('0x37')]));_0x5b1add[_0x6467('0x35')]=_0x5b1add[_0x6467('0x35')]['length']?_0x5b1add[_0x6467('0x35')]:_0x2d7fcd[_0x6467('0x31')];if(!_0x19655d[_0x6467('0x32')]['hasOwnProperty'](_0x6467('0x38'))){_0x5b1add[_0x6467('0x1f')]=qs[_0x6467('0x1f')](_0x19655d[_0x6467('0x32')][_0x6467('0x1f')]);_0x5b1add[_0x6467('0x1d')]=qs[_0x6467('0x1d')](_0x19655d[_0x6467('0x32')][_0x6467('0x1d')]);}_0x5b1add[_0x6467('0x39')]=qs[_0x6467('0x3a')](_0x19655d['query'][_0x6467('0x3a')]);_0x5b1add[_0x6467('0x3b')]=qs[_0x6467('0x34')](_[_0x6467('0x3c')](_0x19655d[_0x6467('0x32')],_0x2d7fcd[_0x6467('0x34')]),_0x48bd24);if(_0x19655d[_0x6467('0x32')]['filter']){_0x5b1add['where']=_[_0x6467('0x3d')](_0x5b1add[_0x6467('0x3b')],{'$or':_[_0x6467('0x2c')](_0x48bd24,function(_0x59274d){if(_0x59274d[_0x6467('0x3e')]!==_0x6467('0x3f')){var _0x853582={};_0x853582[_0x59274d[_0x6467('0x2a')]]={'$like':'%'+_0x19655d[_0x6467('0x32')][_0x6467('0x40')]+'%'};return _0x853582;}})});}_0x5b1add=_[_0x6467('0x3d')]({},_0x5b1add,_0x19655d[_0x6467('0x41')]);var _0x1fb437={'where':_0x5b1add[_0x6467('0x3b')]};return db['ZendeskField'][_0x6467('0x20')](_0x1fb437)[_0x6467('0x26')](function(_0x4c168f){_0x214f6e[_0x6467('0x20')]=_0x4c168f;if(_0x19655d['query'][_0x6467('0x42')]){_0x5b1add[_0x6467('0x43')]=[{'all':!![]}];}return db['ZendeskField'][_0x6467('0x44')](_0x5b1add);})[_0x6467('0x26')](function(_0x2a3753){_0x214f6e['rows']=_0x2a3753;return _0x214f6e;})[_0x6467('0x26')](respondWithFilteredResult(_0x20da00,_0x5b1add))['catch'](handleError(_0x20da00,null));};exports[_0x6467('0x45')]=function(_0x3ff983,_0x42cd63){var _0x2c69e0={'raw':!![],'where':{'id':_0x3ff983[_0x6467('0x46')]['id']}},_0x4d5079={};_0x4d5079[_0x6467('0x31')]=_[_0x6467('0x33')](db[_0x6467('0x2d')][_0x6467('0x2e')]);_0x4d5079[_0x6467('0x32')]=_[_0x6467('0x33')](_0x3ff983[_0x6467('0x32')]);_0x4d5079[_0x6467('0x34')]=_[_0x6467('0x36')](_0x4d5079[_0x6467('0x31')],_0x4d5079['query']);_0x2c69e0[_0x6467('0x35')]=_[_0x6467('0x36')](_0x4d5079[_0x6467('0x31')],qs[_0x6467('0x37')](_0x3ff983[_0x6467('0x32')][_0x6467('0x37')]));_0x2c69e0[_0x6467('0x35')]=_0x2c69e0['attributes']['length']?_0x2c69e0[_0x6467('0x35')]:_0x4d5079[_0x6467('0x31')];if(_0x3ff983[_0x6467('0x32')][_0x6467('0x42')]){_0x2c69e0[_0x6467('0x43')]=[{'all':!![]}];}_0x2c69e0=_[_0x6467('0x3d')]({},_0x2c69e0,_0x3ff983[_0x6467('0x41')]);return db[_0x6467('0x2d')][_0x6467('0x47')](_0x2c69e0)['then'](handleEntityNotFound(_0x42cd63,null))[_0x6467('0x26')](respondWithResult(_0x42cd63,null))['catch'](handleError(_0x42cd63,null));};exports[_0x6467('0x48')]=function(_0x18d991,_0x50a727){return db[_0x6467('0x2d')]['create'](_0x18d991[_0x6467('0x49')],{})[_0x6467('0x26')](respondWithResult(_0x50a727,0xc9))[_0x6467('0x4a')](handleError(_0x50a727,null));};exports[_0x6467('0x25')]=function(_0x1fb47d,_0x3fea3e){if(_0x1fb47d[_0x6467('0x49')]['id']){delete _0x1fb47d['body']['id'];}return db['ZendeskField']['find']({'where':{'id':_0x1fb47d['params']['id']}})['then'](handleEntityNotFound(_0x3fea3e,null))[_0x6467('0x26')](saveUpdates(_0x1fb47d[_0x6467('0x49')],null))[_0x6467('0x26')](respondWithResult(_0x3fea3e,null))[_0x6467('0x4a')](handleError(_0x3fea3e,null));};exports[_0x6467('0x27')]=function(_0x477d78,_0x5debc3){return db[_0x6467('0x2d')]['find']({'where':{'id':_0x477d78['params']['id']}})['then'](handleEntityNotFound(_0x5debc3,null))[_0x6467('0x26')](removeEntity(_0x5debc3,null))[_0x6467('0x4a')](handleError(_0x5debc3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 7df8f47..a1978a8 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 _0x4b31=['ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','../../config/logger','bluebird','rimraf','../../config/environment','./intZendeskField.attributes','exports','define'];(function(_0x211b08,_0xa24f83){var _0x41e020=function(_0x258572){while(--_0x258572){_0x211b08['push'](_0x211b08['shift']());}};_0x41e020(++_0xa24f83);}(_0x4b31,0x138));var _0x14b3=function(_0x3a5b74,_0x4960ee){_0x3a5b74=_0x3a5b74-0x0;var _0x366746=_0x4b31[_0x3a5b74];return _0x366746;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x14b3('0x0'))('api');var moment=require('moment');var BPromise=require(_0x14b3('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x14b3('0x2'));var config=require(_0x14b3('0x3'));var attributes=require(_0x14b3('0x4'));module[_0x14b3('0x5')]=function(_0x41a006,_0x28ad99){return _0x41a006[_0x14b3('0x6')](_0x14b3('0x7'),attributes,{'tableName':_0x14b3('0x8'),'paranoid':![],'indexes':[{'name':_0x14b3('0x9'),'fields':['idField',_0x14b3('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x163a=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','ZendeskField','int_zendesk_fields','zendesk_unique_index'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x163a,0x129));var _0xa163=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0x163a[_0x409deb];return _0x15a4f7;};'use strict';var _=require('lodash');var util=require(_0xa163('0x0'));var logger=require(_0xa163('0x1'))(_0xa163('0x2'));var moment=require('moment');var BPromise=require(_0xa163('0x3'));var rp=require(_0xa163('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa163('0x5'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x4de606,_0x520e14){return _0x4de606['define'](_0xa163('0x6'),attributes,{'tableName':_0xa163('0x7'),'paranoid':![],'indexes':[{'name':_0xa163('0x8'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index ba1e969..b9f49f2 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 _0x6b7a=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','request\x20sent','stringify','error','ZendeskField,\x20%s,\x20%s','message','catch'];(function(_0x587957,_0x546788){var _0x3b5b4d=function(_0x460a1f){while(--_0x460a1f){_0x587957['push'](_0x587957['shift']());}};_0x3b5b4d(++_0x546788);}(_0x6b7a,0x18f));var _0xa6b7=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0x6b7a[_0x421196];return _0x2738af;};'use strict';var _=require(_0xa6b7('0x0'));var util=require(_0xa6b7('0x1'));var moment=require(_0xa6b7('0x2'));var BPromise=require('bluebird');var rs=require(_0xa6b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6b7('0x4'))['db'];var utils=require(_0xa6b7('0x5'));var logger=require(_0xa6b7('0x6'))(_0xa6b7('0x7'));var config=require(_0xa6b7('0x8'));var jayson=require(_0xa6b7('0x9'));var client=jayson[_0xa6b7('0xa')][_0xa6b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x385c6a,_0x42646a,_0x33b6e6){return new BPromise(function(_0x5ce479,_0x546a05){return client[_0xa6b7('0xc')](_0x385c6a,_0x33b6e6)['then'](function(_0x2242df){logger[_0xa6b7('0xd')]('ZendeskField,\x20%s,\x20%s',_0x42646a,'request\x20sent');logger[_0xa6b7('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x42646a,_0xa6b7('0xf'),JSON[_0xa6b7('0x10')](_0x2242df));if(_0x2242df[_0xa6b7('0x11')]){if(_0x2242df['error']['code']===0x1f4){logger['error'](_0xa6b7('0x12'),_0x42646a,_0x2242df[_0xa6b7('0x11')][_0xa6b7('0x13')]);return _0x546a05(_0x2242df[_0xa6b7('0x11')][_0xa6b7('0x13')]);}logger[_0xa6b7('0x11')]('ZendeskField,\x20%s,\x20%s',_0x42646a,_0x2242df[_0xa6b7('0x11')][_0xa6b7('0x13')]);return _0x5ce479(_0x2242df[_0xa6b7('0x11')][_0xa6b7('0x13')]);}else{logger[_0xa6b7('0xd')](_0xa6b7('0x12'),_0x42646a,_0xa6b7('0xf'));_0x5ce479(_0x2242df['result'][_0xa6b7('0x13')]);}})[_0xa6b7('0x14')](function(_0x5c10dd){logger['error']('ZendeskField,\x20%s,\x20%s',_0x42646a,_0x5c10dd);_0x546a05(_0x5c10dd);});});} \ No newline at end of file +var _0xe1a2=['debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','ZendeskField,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x2bca33,_0x220c00){var _0x290fea=function(_0x569e15){while(--_0x569e15){_0x2bca33['push'](_0x2bca33['shift']());}};_0x290fea(++_0x220c00);}(_0xe1a2,0x1cf));var _0x2e1a=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xe1a2[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require(_0x2e1a('0x0'));var util=require('util');var moment=require(_0x2e1a('0x1'));var BPromise=require(_0x2e1a('0x2'));var rs=require(_0x2e1a('0x3'));var fs=require('fs');var Redis=require(_0x2e1a('0x4'));var db=require(_0x2e1a('0x5'))['db'];var utils=require(_0x2e1a('0x6'));var logger=require(_0x2e1a('0x7'))(_0x2e1a('0x8'));var config=require(_0x2e1a('0x9'));var jayson=require(_0x2e1a('0xa'));var client=jayson[_0x2e1a('0xb')][_0x2e1a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x114897,_0x339415,_0x3fdd46){return new BPromise(function(_0x10bee6,_0x354ae8){return client[_0x2e1a('0xd')](_0x114897,_0x3fdd46)[_0x2e1a('0xe')](function(_0x1c15f9){logger[_0x2e1a('0xf')]('ZendeskField,\x20%s,\x20%s',_0x339415,_0x2e1a('0x10'));logger[_0x2e1a('0x11')](_0x2e1a('0x12'),_0x339415,_0x2e1a('0x10'),JSON[_0x2e1a('0x13')](_0x1c15f9));if(_0x1c15f9[_0x2e1a('0x14')]){if(_0x1c15f9[_0x2e1a('0x14')]['code']===0x1f4){logger[_0x2e1a('0x14')]('ZendeskField,\x20%s,\x20%s',_0x339415,_0x1c15f9[_0x2e1a('0x14')][_0x2e1a('0x15')]);return _0x354ae8(_0x1c15f9[_0x2e1a('0x14')][_0x2e1a('0x15')]);}logger[_0x2e1a('0x14')](_0x2e1a('0x16'),_0x339415,_0x1c15f9[_0x2e1a('0x14')][_0x2e1a('0x15')]);return _0x10bee6(_0x1c15f9[_0x2e1a('0x14')][_0x2e1a('0x15')]);}else{logger[_0x2e1a('0xf')](_0x2e1a('0x16'),_0x339415,_0x2e1a('0x10'));_0x10bee6(_0x1c15f9[_0x2e1a('0x17')]['message']);}})['catch'](function(_0x2d40b6){logger[_0x2e1a('0x14')]('ZendeskField,\x20%s,\x20%s',_0x339415,_0x2d40b6);_0x354ae8(_0x2d40b6);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index baf3d1d..95a4c49 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 _0xf2c0=['put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intZohoAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration'];(function(_0xa1da98,_0x1ee868){var _0x570015=function(_0x27f3ca){while(--_0x27f3ca){_0xa1da98['push'](_0xa1da98['shift']());}};_0x570015(++_0x1ee868);}(_0xf2c0,0xc0));var _0x0f2c=function(_0x5efafe,_0x3386e5){_0x5efafe=_0x5efafe-0x0;var _0x5df8ae=_0xf2c0[_0x5efafe];return _0x5df8ae;};'use strict';var multer=require(_0x0f2c('0x0'));var util=require(_0x0f2c('0x1'));var path=require(_0x0f2c('0x2'));var timeout=require(_0x0f2c('0x3'));var express=require('express');var router=express[_0x0f2c('0x4')]();var fs_extra=require(_0x0f2c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0f2c('0x6'));var config=require('../../config/environment');var controller=require(_0x0f2c('0x7'));router['get']('/',auth[_0x0f2c('0x8')](),controller['index']);router[_0x0f2c('0x9')](_0x0f2c('0xa'),auth[_0x0f2c('0x8')](),controller[_0x0f2c('0xb')]);router[_0x0f2c('0x9')](_0x0f2c('0xc'),auth[_0x0f2c('0x8')](),controller[_0x0f2c('0xd')]);router[_0x0f2c('0x9')](_0x0f2c('0xe'),auth[_0x0f2c('0x8')](),controller['getFields']);router[_0x0f2c('0xf')]('/',auth['isAuthenticated'](),controller[_0x0f2c('0x10')]);router[_0x0f2c('0xf')]('/:id/configurations',auth[_0x0f2c('0x8')](),controller[_0x0f2c('0x11')]);router[_0x0f2c('0x12')](_0x0f2c('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0f2c('0xa'),auth['isAuthenticated'](),controller[_0x0f2c('0x13')]);module[_0x0f2c('0x14')]=router; \ No newline at end of file +var _0x9e10=['/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','show','get'];(function(_0x445c98,_0x132bf7){var _0x2fe913=function(_0x32e864){while(--_0x32e864){_0x445c98['push'](_0x445c98['shift']());}};_0x2fe913(++_0x132bf7);}(_0x9e10,0x78));var _0x09e1=function(_0x197ae1,_0x52b99f){_0x197ae1=_0x197ae1-0x0;var _0xe837c5=_0x9e10[_0x197ae1];return _0xe837c5;};'use strict';var multer=require(_0x09e1('0x0'));var util=require(_0x09e1('0x1'));var path=require(_0x09e1('0x2'));var timeout=require(_0x09e1('0x3'));var express=require('express');var router=express[_0x09e1('0x4')]();var fs_extra=require(_0x09e1('0x5'));var auth=require(_0x09e1('0x6'));var interaction=require(_0x09e1('0x7'));var config=require(_0x09e1('0x8'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0x09e1('0x9')](),controller['index']);router['get']('/:id',auth[_0x09e1('0x9')](),controller[_0x09e1('0xa')]);router[_0x09e1('0xb')](_0x09e1('0xc'),auth['isAuthenticated'](),controller[_0x09e1('0xd')]);router[_0x09e1('0xb')](_0x09e1('0xe'),auth[_0x09e1('0x9')](),controller[_0x09e1('0xf')]);router['post']('/',auth[_0x09e1('0x9')](),controller[_0x09e1('0x10')]);router[_0x09e1('0x11')](_0x09e1('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x09e1('0x12'),auth[_0x09e1('0x9')](),controller[_0x09e1('0x13')]);router['delete']('/:id',auth[_0x09e1('0x9')](),controller[_0x09e1('0x14')]);module[_0x09e1('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index b4da646..5054ff4 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 _0x5ff3=['STRING','exports'];(function(_0x32b9bb,_0x549288){var _0x9b2b22=function(_0x2537a){while(--_0x2537a){_0x32b9bb['push'](_0x32b9bb['shift']());}};_0x9b2b22(++_0x549288);}(_0x5ff3,0x17d));var _0x35ff=function(_0x15b08b,_0x5a9c7a){_0x15b08b=_0x15b08b-0x0;var _0x41498d=_0x5ff3[_0x15b08b];return _0x41498d;};'use strict';var Sequelize=require('sequelize');module[_0x35ff('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x35ff('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x35ff('0x1')]},'clientId':{'type':Sequelize[_0x35ff('0x1')]},'clientSecret':{'type':Sequelize[_0x35ff('0x1')]},'serverUrl':{'type':Sequelize[_0x35ff('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x35ff('0x1')]}}; \ No newline at end of file +var _0x4522=['STRING'];(function(_0x416590,_0x3546fd){var _0x531efd=function(_0x5e9eb0){while(--_0x5e9eb0){_0x416590['push'](_0x416590['shift']());}};_0x531efd(++_0x3546fd);}(_0x4522,0x1a0));var _0x2452=function(_0x2ec6be,_0x504fd6){_0x2ec6be=_0x2ec6be-0x0;var _0xdda31d=_0x4522[_0x2ec6be];return _0xdda31d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2452('0x0')]},'description':{'type':Sequelize[_0x2452('0x0')]},'host':{'type':Sequelize[_0x2452('0x0')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2452('0x0')]},'clientSecret':{'type':Sequelize[_0x2452('0x0')]},'serverUrl':{'type':Sequelize[_0x2452('0x0')],'allowNull':![]},'code':{'type':Sequelize[_0x2452('0x0')]},'refreshToken':{'type':Sequelize[_0x2452('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 40d907c..0f9782f 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 _0x775a=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','sendStatus','end','undefined','count','offset','limit','status','json','reject','save','update','destroy','then','name','index','map','ZohoAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','rows','show','params','length','catch','create','body','find','getConfigurations','findOne','options','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','code','zoho.eu','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','includes','push','display_label','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x64a6c,_0x24df22){var _0x13784b=function(_0x57b6d0){while(--_0x57b6d0){_0x64a6c['push'](_0x64a6c['shift']());}};_0x13784b(++_0x24df22);}(_0x775a,0x16a));var _0xa775=function(_0x16715a,_0x41b9bb){_0x16715a=_0x16715a-0x0;var _0x511c46=_0x775a[_0x16715a];return _0x511c46;};'use strict';var emlformat=require(_0xa775('0x0'));var rimraf=require(_0xa775('0x1'));var zipdir=require(_0xa775('0x2'));var jsonpatch=require(_0xa775('0x3'));var rp=require('request-promise');var moment=require(_0xa775('0x4'));var BPromise=require(_0xa775('0x5'));var Mustache=require(_0xa775('0x6'));var util=require(_0xa775('0x7'));var path=require(_0xa775('0x8'));var sox=require(_0xa775('0x9'));var csv=require(_0xa775('0xa'));var ejs=require(_0xa775('0xb'));var fs=require('fs');var fs_extra=require(_0xa775('0xc'));var _=require(_0xa775('0xd'));var squel=require(_0xa775('0xe'));var crypto=require(_0xa775('0xf'));var jsforce=require(_0xa775('0x10'));var deskjs=require(_0xa775('0x11'));var toCsv=require(_0xa775('0xa'));var querystring=require(_0xa775('0x12'));var Papa=require('papaparse');var Redis=require(_0xa775('0x13'));var authService=require(_0xa775('0x14'));var qs=require(_0xa775('0x15'));var as=require(_0xa775('0x16'));var hardwareService=require(_0xa775('0x17'));var logger=require(_0xa775('0x18'))(_0xa775('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa775('0x1a'))['db'];var integrations=require(_0xa775('0x1b'));function respondWithStatusCode(_0x511b49,_0x3edb00){_0x3edb00=_0x3edb00||0xcc;return function(_0x1eb7ec){if(_0x1eb7ec){return _0x511b49[_0xa775('0x1c')](_0x3edb00);}return _0x511b49['status'](_0x3edb00)[_0xa775('0x1d')]();};}function respondWithResult(_0x29149e,_0x3b6f48){_0x3b6f48=_0x3b6f48||0xc8;return function(_0x2fd117){if(_0x2fd117){return _0x29149e['status'](_0x3b6f48)['json'](_0x2fd117);}};}function respondWithFilteredResult(_0x18981b,_0x2e3410){return function(_0x53c793){if(_0x53c793){var _0x594cf6=typeof _0x2e3410['offset']==='undefined'&&typeof _0x2e3410['limit']===_0xa775('0x1e');var _0x2cc078=_0x53c793[_0xa775('0x1f')];var _0x30fdd2=_0x594cf6?0x0:_0x2e3410[_0xa775('0x20')];var _0x32cd2f=_0x594cf6?_0x53c793['count']:_0x2e3410[_0xa775('0x20')]+_0x2e3410[_0xa775('0x21')];var _0x3e1149;if(_0x32cd2f>=_0x2cc078){_0x32cd2f=_0x2cc078;_0x3e1149=0xc8;}else{_0x3e1149=0xce;}_0x18981b[_0xa775('0x22')](_0x3e1149);return _0x18981b['set']('Content-Range',_0x30fdd2+'-'+_0x32cd2f+'/'+_0x2cc078)[_0xa775('0x23')](_0x53c793);}return null;};}function patchUpdates(_0x87a484){return function(_0x454bc2){try{jsonpatch['apply'](_0x454bc2,_0x87a484,!![]);}catch(_0x191cb0){return BPromise[_0xa775('0x24')](_0x191cb0);}return _0x454bc2[_0xa775('0x25')]();};}function saveUpdates(_0x3f24bc,_0x1370df){return function(_0x1fc705){if(_0x1fc705){return _0x1fc705[_0xa775('0x26')](_0x3f24bc)['then'](function(_0x19106d){return _0x19106d;});}return null;};}function removeEntity(_0x184c7f,_0x3606f0){return function(_0x5c281e){if(_0x5c281e){return _0x5c281e[_0xa775('0x27')]()[_0xa775('0x28')](function(){_0x184c7f[_0xa775('0x22')](0xcc)[_0xa775('0x1d')]();});}};}function handleEntityNotFound(_0x46ab28,_0x1f815f){return function(_0x360ba6){if(!_0x360ba6){_0x46ab28[_0xa775('0x1c')](0x194);}return _0x360ba6;};}function handleError(_0x3af1dc,_0x272331){_0x272331=_0x272331||0x1f4;return function(_0x54405b){logger['error'](_0x54405b['stack']);if(_0x54405b[_0xa775('0x29')]){delete _0x54405b[_0xa775('0x29')];}_0x3af1dc[_0xa775('0x22')](_0x272331)['send'](_0x54405b);};}exports[_0xa775('0x2a')]=function(_0x1c1d9d,_0x392932){var _0x2444d9={},_0x312519={},_0xe24b18={'count':0x0,'rows':[]};var _0x1b0c38=_[_0xa775('0x2b')](db[_0xa775('0x2c')][_0xa775('0x2d')],function(_0x200b97){return{'name':_0x200b97[_0xa775('0x2e')],'type':_0x200b97[_0xa775('0x2f')]['key']};});_0x312519[_0xa775('0x30')]=_['map'](_0x1b0c38,'name');_0x312519['query']=_[_0xa775('0x31')](_0x1c1d9d[_0xa775('0x32')]);_0x312519[_0xa775('0x33')]=_[_0xa775('0x34')](_0x312519[_0xa775('0x30')],_0x312519[_0xa775('0x32')]);_0x2444d9[_0xa775('0x35')]=_[_0xa775('0x34')](_0x312519[_0xa775('0x30')],qs['fields'](_0x1c1d9d['query'][_0xa775('0x36')]));_0x2444d9[_0xa775('0x35')]=_0x2444d9[_0xa775('0x35')]['length']?_0x2444d9['attributes']:_0x312519[_0xa775('0x30')];if(!_0x1c1d9d['query'][_0xa775('0x37')](_0xa775('0x38'))){_0x2444d9['limit']=qs[_0xa775('0x21')](_0x1c1d9d[_0xa775('0x32')][_0xa775('0x21')]);_0x2444d9['offset']=qs[_0xa775('0x20')](_0x1c1d9d[_0xa775('0x32')][_0xa775('0x20')]);}_0x2444d9[_0xa775('0x39')]=qs['sort'](_0x1c1d9d['query'][_0xa775('0x3a')]);_0x2444d9['where']=qs[_0xa775('0x33')](_[_0xa775('0x3b')](_0x1c1d9d[_0xa775('0x32')],_0x312519[_0xa775('0x33')]),_0x1b0c38);if(_0x1c1d9d[_0xa775('0x32')][_0xa775('0x3c')]){_0x2444d9['where']=_[_0xa775('0x3d')](_0x2444d9[_0xa775('0x3e')],{'$or':_[_0xa775('0x2b')](_0x1b0c38,function(_0x1cbced){if(_0x1cbced[_0xa775('0x2f')]!==_0xa775('0x3f')){var _0xa03ed9={};_0xa03ed9[_0x1cbced['name']]={'$like':'%'+_0x1c1d9d[_0xa775('0x32')][_0xa775('0x3c')]+'%'};return _0xa03ed9;}})});}_0x2444d9=_['merge']({},_0x2444d9,_0x1c1d9d['options']);var _0x25db57={'where':_0x2444d9[_0xa775('0x3e')]};return db[_0xa775('0x2c')][_0xa775('0x1f')](_0x25db57)[_0xa775('0x28')](function(_0x5c68c7){_0xe24b18['count']=_0x5c68c7;if(_0x1c1d9d[_0xa775('0x32')][_0xa775('0x40')]){_0x2444d9[_0xa775('0x41')]=[{'all':!![]}];}return db[_0xa775('0x2c')]['findAll'](_0x2444d9);})[_0xa775('0x28')](function(_0x2a0d4d){_0xe24b18[_0xa775('0x42')]=_0x2a0d4d;return _0xe24b18;})[_0xa775('0x28')](respondWithFilteredResult(_0x392932,_0x2444d9))['catch'](handleError(_0x392932,null));};exports[_0xa775('0x43')]=function(_0x21cf09,_0x307352){var _0x30f6d6={'raw':![],'where':{'id':_0x21cf09[_0xa775('0x44')]['id']}},_0x589e0d={};_0x589e0d[_0xa775('0x30')]=_[_0xa775('0x31')](db[_0xa775('0x2c')][_0xa775('0x2d')]);_0x589e0d[_0xa775('0x32')]=_['keys'](_0x21cf09[_0xa775('0x32')]);_0x589e0d['filters']=_[_0xa775('0x34')](_0x589e0d[_0xa775('0x30')],_0x589e0d[_0xa775('0x32')]);_0x30f6d6['attributes']=_['intersection'](_0x589e0d['model'],qs[_0xa775('0x36')](_0x21cf09[_0xa775('0x32')][_0xa775('0x36')]));_0x30f6d6[_0xa775('0x35')]=_0x30f6d6['attributes'][_0xa775('0x45')]?_0x30f6d6['attributes']:_0x589e0d[_0xa775('0x30')];if(_0x21cf09[_0xa775('0x32')]['includeAll']){_0x30f6d6[_0xa775('0x41')]=[{'all':!![]}];}_0x30f6d6=_['merge']({},_0x30f6d6,_0x21cf09['options']);return db['ZohoAccount']['find'](_0x30f6d6)['then'](handleEntityNotFound(_0x307352,null))[_0xa775('0x28')](respondWithResult(_0x307352,null))[_0xa775('0x46')](handleError(_0x307352,null));};exports[_0xa775('0x47')]=function(_0x437b22,_0x131765){return db['ZohoAccount']['create'](_0x437b22['body'],{})[_0xa775('0x28')](respondWithResult(_0x131765,0xc9))[_0xa775('0x46')](handleError(_0x131765,null));};exports[_0xa775('0x26')]=function(_0x2d2e6d,_0x1b0e8b){if(_0x2d2e6d[_0xa775('0x48')]['id']){delete _0x2d2e6d['body']['id'];}return db['ZohoAccount'][_0xa775('0x49')]({'where':{'id':_0x2d2e6d[_0xa775('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b0e8b,null))[_0xa775('0x28')](saveUpdates(_0x2d2e6d[_0xa775('0x48')],null))[_0xa775('0x28')](respondWithResult(_0x1b0e8b,null))['catch'](handleError(_0x1b0e8b,null));};exports[_0xa775('0x27')]=function(_0x488541,_0x2a3881){return db['ZohoAccount'][_0xa775('0x49')]({'where':{'id':_0x488541[_0xa775('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a3881,null))[_0xa775('0x28')](removeEntity(_0x2a3881,null))[_0xa775('0x46')](handleError(_0x2a3881,null));};exports[_0xa775('0x4a')]=function(_0x13654d,_0x9b6c0b,_0x565558){var _0xa95283={};var _0x1311a5={};var _0x4a1c77;var _0x33a3a5;return db[_0xa775('0x2c')][_0xa775('0x4b')]({'where':{'id':_0x13654d[_0xa775('0x44')]['id']}})[_0xa775('0x28')](handleEntityNotFound(_0x9b6c0b,null))['then'](function(_0xf7a44d){if(_0xf7a44d){_0x4a1c77=_0xf7a44d;_0x1311a5[_0xa775('0x30')]=_[_0xa775('0x31')](db['ZohoConfiguration'][_0xa775('0x2d')]);_0x1311a5[_0xa775('0x32')]=_[_0xa775('0x31')](_0x13654d[_0xa775('0x32')]);_0x1311a5[_0xa775('0x33')]=_[_0xa775('0x34')](_0x1311a5[_0xa775('0x30')],_0x1311a5[_0xa775('0x32')]);_0xa95283[_0xa775('0x35')]=_['intersection'](_0x1311a5['model'],qs[_0xa775('0x36')](_0x13654d[_0xa775('0x32')]['fields']));_0xa95283['attributes']=_0xa95283[_0xa775('0x35')]['length']?_0xa95283['attributes']:_0x1311a5[_0xa775('0x30')];_0xa95283[_0xa775('0x39')]=qs['sort'](_0x13654d[_0xa775('0x32')]['sort']);_0xa95283[_0xa775('0x3e')]=qs[_0xa775('0x33')](_['pick'](_0x13654d[_0xa775('0x32')],_0x1311a5[_0xa775('0x33')]));if(_0x13654d[_0xa775('0x32')][_0xa775('0x3c')]){_0xa95283[_0xa775('0x3e')]=_[_0xa775('0x3d')](_0xa95283[_0xa775('0x3e')],{'$or':_['map'](_0xa95283['attributes'],function(_0x21d639){var _0x57517c={};_0x57517c[_0x21d639]={'$like':'%'+_0x13654d[_0xa775('0x32')][_0xa775('0x3c')]+'%'};return _0x57517c;})});}_0xa95283=_[_0xa775('0x3d')]({},_0xa95283,_0x13654d[_0xa775('0x4c')]);return _0x4a1c77[_0xa775('0x4a')](_0xa95283);}})['then'](function(_0x1baa20){if(_0x1baa20){_0x33a3a5=_0x1baa20[_0xa775('0x45')];if(!_0x13654d[_0xa775('0x32')][_0xa775('0x37')](_0xa775('0x38'))){_0xa95283[_0xa775('0x21')]=qs[_0xa775('0x21')](_0x13654d['query'][_0xa775('0x21')]);_0xa95283[_0xa775('0x20')]=qs[_0xa775('0x20')](_0x13654d[_0xa775('0x32')][_0xa775('0x20')]);}return _0x4a1c77['getConfigurations'](_0xa95283);}})[_0xa775('0x28')](function(_0x2f33aa){if(_0x2f33aa){return _0x2f33aa?{'count':_0x33a3a5,'rows':_0x2f33aa}:null;}})[_0xa775('0x28')](respondWithResult(_0x9b6c0b,null))[_0xa775('0x46')](handleError(_0x9b6c0b,null));};exports['addConfiguration']=function(_0x2ac5a2,_0x4c7e9a,_0x1a608a){if(_0x2ac5a2[_0xa775('0x48')]['id']){delete _0x2ac5a2[_0xa775('0x48')]['id'];}return db[_0xa775('0x2c')][_0xa775('0x4b')]({'where':{'id':_0x2ac5a2[_0xa775('0x44')]['id']}})['then'](handleEntityNotFound(_0x4c7e9a,null))[_0xa775('0x28')](function(_0x6876ac){if(_0x6876ac){_0x2ac5a2[_0xa775('0x48')]['AccountId']=_0x6876ac['id'];_0x2ac5a2[_0xa775('0x48')][_0xa775('0x4d')]=integrations[_0xa775('0x4e')](_0x2ac5a2[_0xa775('0x48')]['channel'],_0x2ac5a2[_0xa775('0x48')]['type']);_0x2ac5a2[_0xa775('0x48')][_0xa775('0x4f')]=integrations[_0xa775('0x50')](_0x2ac5a2[_0xa775('0x48')][_0xa775('0x51')],_0x2ac5a2['body'][_0xa775('0x2f')]);return db[_0xa775('0x52')][_0xa775('0x47')](_0x2ac5a2[_0xa775('0x48')],{'include':[{'model':db['ZohoField'],'as':_0xa775('0x4d')},{'model':db[_0xa775('0x53')],'as':_0xa775('0x4f')}]});}return null;})['then'](respondWithResult(_0x4c7e9a,null))[_0xa775('0x46')](handleError(_0x4c7e9a,null));};function getAccessToken(_0x5cb8bd){return new Promise(function(_0xc9e6f3,_0x83e285){var _0x52cd19;switch(_0x5cb8bd[_0xa775('0x54')]){case'US':_0x52cd19=_0xa775('0x55');break;case'AU':_0x52cd19=_0xa775('0x56');break;case'EU':_0x52cd19=_0xa775('0x57');break;case'IN':_0x52cd19=_0xa775('0x58');break;case'CN':_0x52cd19=_0xa775('0x59');break;default:_0x52cd19=_0xa775('0x57');break;}var _0x215311={'method':_0xa775('0x5a'),'uri':_0x52cd19+_0xa775('0x5b'),'qs':{'refresh_token':_0x5cb8bd[_0xa775('0x5c')],'client_id':_0x5cb8bd[_0xa775('0x5d')],'client_secret':_0x5cb8bd['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x215311)['then'](function(_0x1724a1){if(_0x1724a1['access_token']){_0xc9e6f3(_0x1724a1[_0xa775('0x5e')]);}else{_0x83e285(_0xa775('0x5f'));}})[_0xa775('0x46')](function(_0x490802){_0x83e285(_0x490802);});});}exports[_0xa775('0x60')]=function(_0xb8b02f,_0x329b18,_0x572c63){var _0x2ad337,_0x22249b,_0x5bd7ba,_0x34bbeb,_0x135aa8;return db[_0xa775('0x2c')][_0xa775('0x4b')]({'where':{'id':_0xb8b02f[_0xa775('0x44')]['id']},'attributes':['id',_0xa775('0x61'),'zone',_0xa775('0x5d'),_0xa775('0x62'),_0xa775('0x63'),_0xa775('0x64'),'refreshToken']})[_0xa775('0x28')](handleEntityNotFound(_0x329b18,null))[_0xa775('0x28')](function(_0x4f806b){_0x135aa8=_0x4f806b;_0x2ad337=_0x135aa8[_0xa775('0x61')];_0x22249b=_0x2ad337===_0xa775('0x65')?'eu':'com';_0x5bd7ba=_0x135aa8[_0xa775('0x63')];var _0xd540d9=_0x5bd7ba['slice'](-0x1);if(_0xd540d9==='/'||_0xd540d9==='\x5c'||_0xd540d9===':'){_0x5bd7ba=_0x5bd7ba[_0xa775('0x66')](0x0,_0x5bd7ba['lastIndexOf'](_0xd540d9));}if(!_0x135aa8[_0xa775('0x5c')]){throw new Error(_0xa775('0x67'));}return getAccessToken(_0x135aa8);})['then'](function(_0x20aa33){if(_0x20aa33){return rp({'method':_0xa775('0x68'),'uri':util['format'](_0xa775('0x69'),_0x22249b),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x20aa33},'json':!![]});}})[_0xa775('0x28')](function(_0x24efcb){if(_0x24efcb){if(_0x24efcb[_0xa775('0x6a')]&&_0x24efcb[_0xa775('0x6a')][_0xa775('0x6b')]){throw new Error(_0x24efcb[_0xa775('0x6a')][_0xa775('0x6b')][_0xa775('0x6c')]);}var _0xa16983=[];var _0x3a4501=[];var _0x3e7cb7=[_0xa775('0x6d'),_0xa775('0x6e'),_0xa775('0x6f'),_0xa775('0x70'),_0xa775('0x71'),_0xa775('0x72'),_0xa775('0x73'),'Call_Type'];_0x3a4501=_['remove'](_0x24efcb[_0xa775('0x36')],function(_0x557fbf){return _0x3e7cb7[_0xa775('0x74')](_0x557fbf['api_name']);});for(var _0xec297b=0x0;_0xec297b<_0x3a4501['length'];_0xec297b++){if(_0x3a4501[_0xec297b]['system_mandatory']===![]){_0xa16983[_0xa775('0x75')]({'id':_0x3a4501[_0xec297b]['id'],'name':_0x3a4501[_0xec297b][_0xa775('0x76')],'custom':_0x3a4501[_0xec297b]['custom_field'],'options':_0x3a4501[_0xec297b][_0xa775('0x77')]===_0xa775('0x78')&&_0x3a4501[_0xec297b][_0xa775('0x79')][_0xa775('0x45')]>-0x1?_[_0xa775('0x2b')](_0x3a4501[_0xec297b]['pick_list_values'],function(_0x352714){return{'name':_0x352714,'value':_0x352714};}):[]});}}return{'count':_0xa16983['length'],'rows':_0xa16983};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x329b18,null))[_0xa775('0x46')](function(_0x3e1118){var _0x316727=_0xb8b02f['query'][_0xa775('0x7a')]?0x1f4:_0x3e1118['statusCode']||0x1f4;logger[_0xa775('0x6b')](_0xa775('0x7b'),'getFields',_0x316727,JSON[_0xa775('0x7c')](_0x3e1118));delete _0x3e1118[_0xa775('0x29')];if(_0x316727===0x191){_0x316727=0x190;}_0x329b18[_0xa775('0x22')](_0x316727)[_0xa775('0x7d')](_0xb8b02f[_0xa775('0x32')][_0xa775('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x3e1118[_0xa775('0x7e')]}:_0x3e1118);});}; \ No newline at end of file +var _0x202d=['stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','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','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','stack','name','index','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','show','params','merge','catch','create','update','body','find','getConfigurations','findOne','ZohoConfiguration','map','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','code','zoho.eu','serverUrl','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','Owner','Subject','Description','Call_Result','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x263674,_0x14dd6f){var _0x397fff=function(_0x94410c){while(--_0x94410c){_0x263674['push'](_0x263674['shift']());}};_0x397fff(++_0x14dd6f);}(_0x202d,0x18c));var _0xd202=function(_0x4f5409,_0x522de0){_0x4f5409=_0x4f5409-0x0;var _0x5722c8=_0x202d[_0x4f5409];return _0x5722c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd202('0x0'));var zipdir=require(_0xd202('0x1'));var jsonpatch=require(_0xd202('0x2'));var rp=require(_0xd202('0x3'));var moment=require('moment');var BPromise=require(_0xd202('0x4'));var Mustache=require(_0xd202('0x5'));var util=require(_0xd202('0x6'));var path=require(_0xd202('0x7'));var sox=require('sox');var csv=require(_0xd202('0x8'));var ejs=require(_0xd202('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd202('0xa'));var squel=require(_0xd202('0xb'));var crypto=require(_0xd202('0xc'));var jsforce=require(_0xd202('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd202('0xe'));var Papa=require(_0xd202('0xf'));var Redis=require(_0xd202('0x10'));var authService=require(_0xd202('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd202('0x12'));var hardwareService=require(_0xd202('0x13'));var logger=require(_0xd202('0x14'))(_0xd202('0x15'));var utils=require(_0xd202('0x16'));var config=require(_0xd202('0x17'));var licenseUtil=require(_0xd202('0x18'));var db=require(_0xd202('0x19'))['db'];var integrations=require(_0xd202('0x1a'));function respondWithStatusCode(_0x3a832b,_0x3c84c2){_0x3c84c2=_0x3c84c2||0xcc;return function(_0x5bf670){if(_0x5bf670){return _0x3a832b[_0xd202('0x1b')](_0x3c84c2);}return _0x3a832b[_0xd202('0x1c')](_0x3c84c2)[_0xd202('0x1d')]();};}function respondWithResult(_0x4e5f42,_0x5ce8d9){_0x5ce8d9=_0x5ce8d9||0xc8;return function(_0x25804b){if(_0x25804b){return _0x4e5f42[_0xd202('0x1c')](_0x5ce8d9)['json'](_0x25804b);}};}function respondWithFilteredResult(_0x336cee,_0x41f263){return function(_0x383c31){if(_0x383c31){var _0x5588df=typeof _0x41f263[_0xd202('0x1e')]===_0xd202('0x1f')&&typeof _0x41f263[_0xd202('0x20')]===_0xd202('0x1f');var _0xdf4fa2=_0x383c31[_0xd202('0x21')];var _0x16d633=_0x5588df?0x0:_0x41f263['offset'];var _0x550035=_0x5588df?_0x383c31['count']:_0x41f263[_0xd202('0x1e')]+_0x41f263[_0xd202('0x20')];var _0x2953e4;if(_0x550035>=_0xdf4fa2){_0x550035=_0xdf4fa2;_0x2953e4=0xc8;}else{_0x2953e4=0xce;}_0x336cee[_0xd202('0x1c')](_0x2953e4);return _0x336cee[_0xd202('0x22')]('Content-Range',_0x16d633+'-'+_0x550035+'/'+_0xdf4fa2)[_0xd202('0x23')](_0x383c31);}return null;};}function patchUpdates(_0x70c2c7){return function(_0x367efc){try{jsonpatch[_0xd202('0x24')](_0x367efc,_0x70c2c7,!![]);}catch(_0x51df92){return BPromise[_0xd202('0x25')](_0x51df92);}return _0x367efc[_0xd202('0x26')]();};}function saveUpdates(_0x3997d5,_0x4d7b8f){return function(_0x1c4ecd){if(_0x1c4ecd){return _0x1c4ecd['update'](_0x3997d5)[_0xd202('0x27')](function(_0x338de1){return _0x338de1;});}return null;};}function removeEntity(_0x172faa,_0x1c2d09){return function(_0x20683d){if(_0x20683d){return _0x20683d[_0xd202('0x28')]()[_0xd202('0x27')](function(){_0x172faa[_0xd202('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x442825,_0x40bad6){return function(_0x23ad6a){if(!_0x23ad6a){_0x442825[_0xd202('0x1b')](0x194);}return _0x23ad6a;};}function handleError(_0x31eec6,_0x31bc47){_0x31bc47=_0x31bc47||0x1f4;return function(_0x1f60af){logger['error'](_0x1f60af[_0xd202('0x29')]);if(_0x1f60af[_0xd202('0x2a')]){delete _0x1f60af[_0xd202('0x2a')];}_0x31eec6[_0xd202('0x1c')](_0x31bc47)['send'](_0x1f60af);};}exports[_0xd202('0x2b')]=function(_0x294e8f,_0x1ace49){var _0xc2fa1={},_0x2492be={},_0x5b6e9f={'count':0x0,'rows':[]};var _0x11bf54=_['map'](db[_0xd202('0x2c')][_0xd202('0x2d')],function(_0x43c104){return{'name':_0x43c104[_0xd202('0x2e')],'type':_0x43c104[_0xd202('0x2f')][_0xd202('0x30')]};});_0x2492be[_0xd202('0x31')]=_['map'](_0x11bf54,_0xd202('0x2a'));_0x2492be[_0xd202('0x32')]=_[_0xd202('0x33')](_0x294e8f[_0xd202('0x32')]);_0x2492be[_0xd202('0x34')]=_[_0xd202('0x35')](_0x2492be[_0xd202('0x31')],_0x2492be[_0xd202('0x32')]);_0xc2fa1['attributes']=_[_0xd202('0x35')](_0x2492be['model'],qs[_0xd202('0x36')](_0x294e8f[_0xd202('0x32')][_0xd202('0x36')]));_0xc2fa1[_0xd202('0x37')]=_0xc2fa1['attributes'][_0xd202('0x38')]?_0xc2fa1[_0xd202('0x37')]:_0x2492be[_0xd202('0x31')];if(!_0x294e8f[_0xd202('0x32')][_0xd202('0x39')](_0xd202('0x3a'))){_0xc2fa1['limit']=qs['limit'](_0x294e8f[_0xd202('0x32')][_0xd202('0x20')]);_0xc2fa1[_0xd202('0x1e')]=qs['offset'](_0x294e8f[_0xd202('0x32')][_0xd202('0x1e')]);}_0xc2fa1[_0xd202('0x3b')]=qs[_0xd202('0x3c')](_0x294e8f[_0xd202('0x32')]['sort']);_0xc2fa1[_0xd202('0x3d')]=qs['filters'](_[_0xd202('0x3e')](_0x294e8f[_0xd202('0x32')],_0x2492be['filters']),_0x11bf54);if(_0x294e8f[_0xd202('0x32')][_0xd202('0x3f')]){_0xc2fa1[_0xd202('0x3d')]=_['merge'](_0xc2fa1[_0xd202('0x3d')],{'$or':_['map'](_0x11bf54,function(_0x4180df){if(_0x4180df['type']!==_0xd202('0x40')){var _0x41c166={};_0x41c166[_0x4180df['name']]={'$like':'%'+_0x294e8f[_0xd202('0x32')][_0xd202('0x3f')]+'%'};return _0x41c166;}})});}_0xc2fa1=_['merge']({},_0xc2fa1,_0x294e8f[_0xd202('0x41')]);var _0x4b820e={'where':_0xc2fa1[_0xd202('0x3d')]};return db[_0xd202('0x2c')][_0xd202('0x21')](_0x4b820e)[_0xd202('0x27')](function(_0x325bb3){_0x5b6e9f['count']=_0x325bb3;if(_0x294e8f[_0xd202('0x32')][_0xd202('0x42')]){_0xc2fa1[_0xd202('0x43')]=[{'all':!![]}];}return db[_0xd202('0x2c')][_0xd202('0x44')](_0xc2fa1);})[_0xd202('0x27')](function(_0x5d948b){_0x5b6e9f['rows']=_0x5d948b;return _0x5b6e9f;})['then'](respondWithFilteredResult(_0x1ace49,_0xc2fa1))['catch'](handleError(_0x1ace49,null));};exports[_0xd202('0x45')]=function(_0x43c51d,_0x3d4613){var _0x58f4f7={'raw':![],'where':{'id':_0x43c51d[_0xd202('0x46')]['id']}},_0xbfaedb={};_0xbfaedb[_0xd202('0x31')]=_[_0xd202('0x33')](db[_0xd202('0x2c')][_0xd202('0x2d')]);_0xbfaedb[_0xd202('0x32')]=_[_0xd202('0x33')](_0x43c51d[_0xd202('0x32')]);_0xbfaedb[_0xd202('0x34')]=_[_0xd202('0x35')](_0xbfaedb['model'],_0xbfaedb[_0xd202('0x32')]);_0x58f4f7['attributes']=_[_0xd202('0x35')](_0xbfaedb[_0xd202('0x31')],qs[_0xd202('0x36')](_0x43c51d['query'][_0xd202('0x36')]));_0x58f4f7['attributes']=_0x58f4f7[_0xd202('0x37')][_0xd202('0x38')]?_0x58f4f7['attributes']:_0xbfaedb[_0xd202('0x31')];if(_0x43c51d[_0xd202('0x32')]['includeAll']){_0x58f4f7['include']=[{'all':!![]}];}_0x58f4f7=_[_0xd202('0x47')]({},_0x58f4f7,_0x43c51d[_0xd202('0x41')]);return db[_0xd202('0x2c')]['find'](_0x58f4f7)[_0xd202('0x27')](handleEntityNotFound(_0x3d4613,null))['then'](respondWithResult(_0x3d4613,null))[_0xd202('0x48')](handleError(_0x3d4613,null));};exports['create']=function(_0xc8fc89,_0x170f36){return db['ZohoAccount'][_0xd202('0x49')](_0xc8fc89['body'],{})[_0xd202('0x27')](respondWithResult(_0x170f36,0xc9))[_0xd202('0x48')](handleError(_0x170f36,null));};exports[_0xd202('0x4a')]=function(_0x40d5d6,_0x314a97){if(_0x40d5d6[_0xd202('0x4b')]['id']){delete _0x40d5d6[_0xd202('0x4b')]['id'];}return db[_0xd202('0x2c')]['find']({'where':{'id':_0x40d5d6[_0xd202('0x46')]['id']}})['then'](handleEntityNotFound(_0x314a97,null))[_0xd202('0x27')](saveUpdates(_0x40d5d6['body'],null))['then'](respondWithResult(_0x314a97,null))[_0xd202('0x48')](handleError(_0x314a97,null));};exports['destroy']=function(_0x53ef30,_0x195b7b){return db[_0xd202('0x2c')][_0xd202('0x4c')]({'where':{'id':_0x53ef30['params']['id']}})[_0xd202('0x27')](handleEntityNotFound(_0x195b7b,null))[_0xd202('0x27')](removeEntity(_0x195b7b,null))[_0xd202('0x48')](handleError(_0x195b7b,null));};exports[_0xd202('0x4d')]=function(_0x2f9964,_0x44bcbb,_0x44695e){var _0x10daf4={};var _0x55b368={};var _0x482508;var _0x4fa787;return db['ZohoAccount'][_0xd202('0x4e')]({'where':{'id':_0x2f9964[_0xd202('0x46')]['id']}})[_0xd202('0x27')](handleEntityNotFound(_0x44bcbb,null))[_0xd202('0x27')](function(_0x3a9b61){if(_0x3a9b61){_0x482508=_0x3a9b61;_0x55b368[_0xd202('0x31')]=_[_0xd202('0x33')](db[_0xd202('0x4f')][_0xd202('0x2d')]);_0x55b368[_0xd202('0x32')]=_[_0xd202('0x33')](_0x2f9964[_0xd202('0x32')]);_0x55b368[_0xd202('0x34')]=_[_0xd202('0x35')](_0x55b368[_0xd202('0x31')],_0x55b368['query']);_0x10daf4['attributes']=_[_0xd202('0x35')](_0x55b368['model'],qs[_0xd202('0x36')](_0x2f9964[_0xd202('0x32')]['fields']));_0x10daf4['attributes']=_0x10daf4[_0xd202('0x37')][_0xd202('0x38')]?_0x10daf4['attributes']:_0x55b368[_0xd202('0x31')];_0x10daf4[_0xd202('0x3b')]=qs['sort'](_0x2f9964[_0xd202('0x32')]['sort']);_0x10daf4[_0xd202('0x3d')]=qs[_0xd202('0x34')](_[_0xd202('0x3e')](_0x2f9964[_0xd202('0x32')],_0x55b368[_0xd202('0x34')]));if(_0x2f9964[_0xd202('0x32')][_0xd202('0x3f')]){_0x10daf4[_0xd202('0x3d')]=_[_0xd202('0x47')](_0x10daf4[_0xd202('0x3d')],{'$or':_[_0xd202('0x50')](_0x10daf4[_0xd202('0x37')],function(_0x1eb2cf){var _0x3a57de={};_0x3a57de[_0x1eb2cf]={'$like':'%'+_0x2f9964[_0xd202('0x32')][_0xd202('0x3f')]+'%'};return _0x3a57de;})});}_0x10daf4=_[_0xd202('0x47')]({},_0x10daf4,_0x2f9964[_0xd202('0x41')]);return _0x482508[_0xd202('0x4d')](_0x10daf4);}})[_0xd202('0x27')](function(_0x99d716){if(_0x99d716){_0x4fa787=_0x99d716['length'];if(!_0x2f9964['query'][_0xd202('0x39')]('nolimit')){_0x10daf4['limit']=qs[_0xd202('0x20')](_0x2f9964[_0xd202('0x32')]['limit']);_0x10daf4[_0xd202('0x1e')]=qs['offset'](_0x2f9964[_0xd202('0x32')][_0xd202('0x1e')]);}return _0x482508[_0xd202('0x4d')](_0x10daf4);}})[_0xd202('0x27')](function(_0xac25fe){if(_0xac25fe){return _0xac25fe?{'count':_0x4fa787,'rows':_0xac25fe}:null;}})['then'](respondWithResult(_0x44bcbb,null))['catch'](handleError(_0x44bcbb,null));};exports[_0xd202('0x51')]=function(_0x272402,_0x5749dc,_0x1cd00d){if(_0x272402[_0xd202('0x4b')]['id']){delete _0x272402[_0xd202('0x4b')]['id'];}return db['ZohoAccount'][_0xd202('0x4e')]({'where':{'id':_0x272402[_0xd202('0x46')]['id']}})[_0xd202('0x27')](handleEntityNotFound(_0x5749dc,null))[_0xd202('0x27')](function(_0x180d60){if(_0x180d60){_0x272402['body']['AccountId']=_0x180d60['id'];_0x272402['body'][_0xd202('0x52')]=integrations['getSubjects'](_0x272402[_0xd202('0x4b')][_0xd202('0x53')],_0x272402[_0xd202('0x4b')][_0xd202('0x2f')]);_0x272402[_0xd202('0x4b')][_0xd202('0x54')]=integrations[_0xd202('0x55')](_0x272402[_0xd202('0x4b')][_0xd202('0x53')],_0x272402[_0xd202('0x4b')][_0xd202('0x2f')]);return db[_0xd202('0x4f')]['create'](_0x272402['body'],{'include':[{'model':db[_0xd202('0x56')],'as':_0xd202('0x52')},{'model':db[_0xd202('0x56')],'as':_0xd202('0x54')}]});}return null;})['then'](respondWithResult(_0x5749dc,null))[_0xd202('0x48')](handleError(_0x5749dc,null));};function getAccessToken(_0x4c5bd3){return new Promise(function(_0xffbb92,_0x728a85){var _0x225fce;switch(_0x4c5bd3[_0xd202('0x57')]){case'US':_0x225fce='https://accounts.zoho.com';break;case'AU':_0x225fce='https://accounts.zoho.com.au';break;case'EU':_0x225fce=_0xd202('0x58');break;case'IN':_0x225fce=_0xd202('0x59');break;case'CN':_0x225fce=_0xd202('0x5a');break;default:_0x225fce='https://accounts.zoho.eu';break;}var _0x16713a={'method':_0xd202('0x5b'),'uri':_0x225fce+'/oauth/v2/token','qs':{'refresh_token':_0x4c5bd3[_0xd202('0x5c')],'client_id':_0x4c5bd3['clientId'],'client_secret':_0x4c5bd3['clientSecret'],'grant_type':_0xd202('0x5d')},'json':!![]};return rp(_0x16713a)['then'](function(_0x3d6aac){if(_0x3d6aac[_0xd202('0x5e')]){_0xffbb92(_0x3d6aac[_0xd202('0x5e')]);}else{_0x728a85(_0xd202('0x5f'));}})[_0xd202('0x48')](function(_0x24275b){_0x728a85(_0x24275b);});});}exports[_0xd202('0x60')]=function(_0x25423a,_0x1481e2,_0x1a4eed){var _0x3c858e,_0x2b2b4c,_0x545229,_0x4730f1,_0x215719;return db[_0xd202('0x2c')][_0xd202('0x4e')]({'where':{'id':_0x25423a[_0xd202('0x46')]['id']},'attributes':['id',_0xd202('0x61'),'zone','clientId',_0xd202('0x62'),'serverUrl',_0xd202('0x63'),_0xd202('0x5c')]})[_0xd202('0x27')](handleEntityNotFound(_0x1481e2,null))['then'](function(_0x35cdd9){_0x215719=_0x35cdd9;_0x3c858e=_0x215719[_0xd202('0x61')];_0x2b2b4c=_0x3c858e===_0xd202('0x64')?'eu':'com';_0x545229=_0x215719[_0xd202('0x65')];var _0x3ddbc3=_0x545229[_0xd202('0x66')](-0x1);if(_0x3ddbc3==='/'||_0x3ddbc3==='\x5c'||_0x3ddbc3===':'){_0x545229=_0x545229['substring'](0x0,_0x545229[_0xd202('0x67')](_0x3ddbc3));}if(!_0x215719[_0xd202('0x5c')]){throw new Error(_0xd202('0x68'));}return getAccessToken(_0x215719);})[_0xd202('0x27')](function(_0x44bd62){if(_0x44bd62){return rp({'method':_0xd202('0x69'),'uri':util[_0xd202('0x6a')](_0xd202('0x6b'),_0x2b2b4c),'qs':{'module':_0xd202('0x6c')},'headers':{'Authorization':_0xd202('0x6d')+_0x44bd62},'json':!![]});}})['then'](function(_0x3aed4b){if(_0x3aed4b){if(_0x3aed4b['response']&&_0x3aed4b[_0xd202('0x6e')][_0xd202('0x6f')]){throw new Error(_0x3aed4b['response']['error']['message']);}var _0x17551d=[];var _0x48ae20=[];var _0x3c5d64=[_0xd202('0x70'),_0xd202('0x71'),_0xd202('0x72'),'WhoId','Call_Duration',_0xd202('0x73'),'Call_Start_Time',_0xd202('0x74')];_0x48ae20=_[_0xd202('0x75')](_0x3aed4b[_0xd202('0x36')],function(_0x3cff12){return _0x3c5d64[_0xd202('0x76')](_0x3cff12[_0xd202('0x77')]);});for(var _0x221a4e=0x0;_0x221a4e<_0x48ae20[_0xd202('0x38')];_0x221a4e++){if(_0x48ae20[_0x221a4e]['system_mandatory']===![]){_0x17551d[_0xd202('0x78')]({'id':_0x48ae20[_0x221a4e]['id'],'name':_0x48ae20[_0x221a4e][_0xd202('0x79')],'custom':_0x48ae20[_0x221a4e][_0xd202('0x7a')],'options':_0x48ae20[_0x221a4e][_0xd202('0x7b')]==='picklist'&&_0x48ae20[_0x221a4e][_0xd202('0x7c')][_0xd202('0x38')]>-0x1?_[_0xd202('0x50')](_0x48ae20[_0x221a4e][_0xd202('0x7c')],function(_0x730f6e){return{'name':_0x730f6e,'value':_0x730f6e};}):[]});}}return{'count':_0x17551d['length'],'rows':_0x17551d};}else{return{'count':0x0,'rows':[]};}})[_0xd202('0x27')](respondWithResult(_0x1481e2,null))[_0xd202('0x48')](function(_0x33987a){var _0x227239=_0x25423a[_0xd202('0x32')][_0xd202('0x7d')]?0x1f4:_0x33987a[_0xd202('0x7e')]||0x1f4;logger[_0xd202('0x6f')](_0xd202('0x7f'),'getFields',_0x227239,JSON[_0xd202('0x80')](_0x33987a));delete _0x33987a['name'];if(_0x227239===0x191){_0x227239=0x190;}_0x1481e2[_0xd202('0x1c')](_0x227239)[_0xd202('0x81')](_0x25423a['query']['test']?{'message':_0xd202('0x82'),'statusCode':_0x33987a[_0xd202('0x7e')]}:_0x33987a);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index d0f0ad1..b310460 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 _0xfb45=['ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','zone','clientId','host','https://accounts.zoho.eu','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientSecret','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0xfb45,0xa4));var _0x5fb4=function(_0x253754,_0x3d0b84){_0x253754=_0x253754-0x0;var _0xb21714=_0xfb45[_0x253754];return _0xb21714;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5fb4('0x0'));var moment=require('moment');var BPromise=require(_0x5fb4('0x1'));var rp=require(_0x5fb4('0x2'));var fs=require('fs');var path=require(_0x5fb4('0x3'));var rimraf=require(_0x5fb4('0x4'));var config=require(_0x5fb4('0x5'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x5fb4('0x6'));module[_0x5fb4('0x7')]=function(_0x28f07e,_0x180034){return _0x28f07e['define'](_0x5fb4('0x8'),attributes,{'tableName':_0x5fb4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x42ea86,_0x2d134,_0x24e67c){if(_0x42ea86[_0x5fb4('0xa')]('zone')||_0x42ea86[_0x5fb4('0xa')](_0x5fb4('0xb'))||_0x42ea86[_0x5fb4('0xa')]('clientId')||_0x42ea86[_0x5fb4('0xa')](_0x5fb4('0xc'))||_0x42ea86[_0x5fb4('0xa')]('code')||_0x42ea86['changed']('host')){var _0xfde4e,_0x10e77b;_0xfde4e=_0x42ea86[_0x5fb4('0xb')];var _0x530518=_0xfde4e[_0x5fb4('0xd')](-0x1);if(_0x530518==='/'||_0x530518==='\x5c'||_0x530518===':'){_0xfde4e=_0xfde4e[_0x5fb4('0xe')](0x0,_0xfde4e[_0x5fb4('0xf')](_0x530518));}switch(_0x42ea86['zone']){case'US':_0x10e77b=_0x5fb4('0x10');break;case'AU':_0x10e77b=_0x5fb4('0x11');break;case'IN':_0x10e77b=_0x5fb4('0x12');break;case'CN':_0x10e77b=_0x5fb4('0x13');break;default:_0x10e77b='https://accounts.zoho.eu';break;}var _0x20bfe6={'method':_0x5fb4('0x14'),'uri':_0x10e77b+_0x5fb4('0x15'),'form':{'grant_type':_0x5fb4('0x16'),'client_id':_0x42ea86['clientId'],'client_secret':_0x42ea86['clientSecret'],'redirect_uri':_0x42ea86['serverUrl'],'code':_0x42ea86[_0x5fb4('0x17')]},'headers':{'Content-Type':_0x5fb4('0x18')}};return rp(_0x20bfe6)['then'](function(_0x1f840c){var _0x245955=JSON['parse'](_0x1f840c);if(_0x245955['refresh_token']){_0x42ea86[_0x5fb4('0x19')]=_0x245955[_0x5fb4('0x1a')];logger[_0x5fb4('0x1b')](util[_0x5fb4('0x1c')](_0x5fb4('0x1d'),_0x42ea86['name'],_0x42ea86['id']));}else{logger[_0x5fb4('0x1e')](util['format'](_0x5fb4('0x1f'),_0x42ea86[_0x5fb4('0x20')],_0x42ea86['id']),util[_0x5fb4('0x21')](_0x245955,{'showHidden':![],'depth':null}));}return _0x24e67c(null,_0x2d134);})[_0x5fb4('0x22')](function(_0x1c1523){logger[_0x5fb4('0x1e')](util[_0x5fb4('0x1c')](_0x5fb4('0x1f'),_0x42ea86['name'],_0x42ea86['id']),util[_0x5fb4('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x24e67c(_0x1c1523);});}else{return _0x24e67c(null,_0x2d134);}},'beforeUpdate':function(_0x3cfb0b,_0x5463b9,_0x4c8e40){if(_0x3cfb0b[_0x5fb4('0xa')](_0x5fb4('0x23'))||_0x3cfb0b[_0x5fb4('0xa')](_0x5fb4('0xb'))||_0x3cfb0b[_0x5fb4('0xa')](_0x5fb4('0x24'))||_0x3cfb0b[_0x5fb4('0xa')]('clientSecret')||_0x3cfb0b[_0x5fb4('0xa')]('code')||_0x3cfb0b[_0x5fb4('0xa')](_0x5fb4('0x25'))){var _0x16ba35,_0x2a6bd6;_0x16ba35=_0x3cfb0b[_0x5fb4('0xb')];var _0xae6ec4=_0x16ba35[_0x5fb4('0xd')](-0x1);if(_0xae6ec4==='/'||_0xae6ec4==='\x5c'||_0xae6ec4===':'){_0x16ba35=_0x16ba35[_0x5fb4('0xe')](0x0,_0x16ba35['lastIndexOf'](_0xae6ec4));}switch(_0x3cfb0b[_0x5fb4('0x23')]){case'US':_0x2a6bd6=_0x5fb4('0x10');break;case'AU':_0x2a6bd6=_0x5fb4('0x11');break;case'IN':_0x2a6bd6=_0x5fb4('0x12');break;case'CN':_0x2a6bd6='https://accounts.zoho.com.cn';break;default:_0x2a6bd6=_0x5fb4('0x26');break;}var _0x905ca9={'method':_0x5fb4('0x14'),'uri':_0x2a6bd6+_0x5fb4('0x15'),'form':{'grant_type':_0x5fb4('0x16'),'client_id':_0x3cfb0b[_0x5fb4('0x24')],'client_secret':_0x3cfb0b[_0x5fb4('0xc')],'redirect_uri':_0x3cfb0b[_0x5fb4('0xb')],'code':_0x3cfb0b[_0x5fb4('0x17')]},'headers':{'Content-Type':_0x5fb4('0x18')}};return rp(_0x905ca9)['then'](function(_0x24c49e){var _0x48c856=JSON['parse'](_0x24c49e);if(_0x48c856[_0x5fb4('0x1a')]){_0x3cfb0b['refreshToken']=_0x48c856['refresh_token'];logger[_0x5fb4('0x1b')](util[_0x5fb4('0x1c')](_0x5fb4('0x1d'),_0x3cfb0b[_0x5fb4('0x20')],_0x3cfb0b['id']));}else{logger['error'](util[_0x5fb4('0x1c')](_0x5fb4('0x1f'),_0x3cfb0b[_0x5fb4('0x20')],_0x3cfb0b['id']),util[_0x5fb4('0x21')](_0x48c856,{'showHidden':![],'depth':null}));}return _0x4c8e40(null,_0x5463b9);})['catch'](function(_0x46d7ee){logger[_0x5fb4('0x1e')](util[_0x5fb4('0x1c')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3cfb0b[_0x5fb4('0x20')],_0x3cfb0b['id']),util[_0x5fb4('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x4c8e40(_0x46d7ee);});}else{return _0x4c8e40(null,_0x5463b9);}}}});}; \ No newline at end of file +var _0x0002=['host','serverUrl','slice','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','changed','zone','clientId','clientSecret','code'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0x0002,0xaa));var _0x2000=function(_0x4a8300,_0x9b2099){_0x4a8300=_0x4a8300-0x0;var _0x5cb965=_0x0002[_0x4a8300];return _0x5cb965;};'use strict';var _=require('lodash');var util=require(_0x2000('0x0'));var logger=require(_0x2000('0x1'))(_0x2000('0x2'));var moment=require('moment');var BPromise=require(_0x2000('0x3'));var rp=require(_0x2000('0x4'));var fs=require('fs');var path=require(_0x2000('0x5'));var rimraf=require(_0x2000('0x6'));var config=require(_0x2000('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x2000('0x8')]=function(_0x46d1e9,_0x3ac0a3){return _0x46d1e9[_0x2000('0x9')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x208306,_0x3bb55d,_0x313946){if(_0x208306[_0x2000('0xa')](_0x2000('0xb'))||_0x208306[_0x2000('0xa')]('serverUrl')||_0x208306[_0x2000('0xa')](_0x2000('0xc'))||_0x208306[_0x2000('0xa')](_0x2000('0xd'))||_0x208306[_0x2000('0xa')](_0x2000('0xe'))||_0x208306['changed'](_0x2000('0xf'))){var _0x6163ec,_0x56cdb9;_0x6163ec=_0x208306[_0x2000('0x10')];var _0x158a3f=_0x6163ec[_0x2000('0x11')](-0x1);if(_0x158a3f==='/'||_0x158a3f==='\x5c'||_0x158a3f===':'){_0x6163ec=_0x6163ec['substring'](0x0,_0x6163ec['lastIndexOf'](_0x158a3f));}switch(_0x208306[_0x2000('0xb')]){case'US':_0x56cdb9=_0x2000('0x12');break;case'AU':_0x56cdb9=_0x2000('0x13');break;case'IN':_0x56cdb9=_0x2000('0x14');break;case'CN':_0x56cdb9=_0x2000('0x15');break;default:_0x56cdb9=_0x2000('0x16');break;}var _0x13c650={'method':_0x2000('0x17'),'uri':_0x56cdb9+_0x2000('0x18'),'form':{'grant_type':_0x2000('0x19'),'client_id':_0x208306[_0x2000('0xc')],'client_secret':_0x208306[_0x2000('0xd')],'redirect_uri':_0x208306[_0x2000('0x10')],'code':_0x208306[_0x2000('0xe')]},'headers':{'Content-Type':_0x2000('0x1a')}};return rp(_0x13c650)[_0x2000('0x1b')](function(_0x1dd6d5){var _0x56bbf7=JSON[_0x2000('0x1c')](_0x1dd6d5);if(_0x56bbf7[_0x2000('0x1d')]){_0x208306[_0x2000('0x1e')]=_0x56bbf7[_0x2000('0x1d')];logger['info'](util[_0x2000('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x208306[_0x2000('0x20')],_0x208306['id']));}else{logger[_0x2000('0x21')](util[_0x2000('0x1f')](_0x2000('0x22'),_0x208306[_0x2000('0x20')],_0x208306['id']),util['inspect'](_0x56bbf7,{'showHidden':![],'depth':null}));}return _0x313946(null,_0x3bb55d);})['catch'](function(_0x34398e){logger['error'](util[_0x2000('0x1f')](_0x2000('0x22'),_0x208306[_0x2000('0x20')],_0x208306['id']),util[_0x2000('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x313946(_0x34398e);});}else{return _0x313946(null,_0x3bb55d);}},'beforeUpdate':function(_0x161beb,_0x11a7cd,_0x1b6f66){if(_0x161beb['changed'](_0x2000('0xb'))||_0x161beb[_0x2000('0xa')](_0x2000('0x10'))||_0x161beb[_0x2000('0xa')](_0x2000('0xc'))||_0x161beb[_0x2000('0xa')](_0x2000('0xd'))||_0x161beb[_0x2000('0xa')](_0x2000('0xe'))||_0x161beb[_0x2000('0xa')]('host')){var _0x884c25,_0x48a6b6;_0x884c25=_0x161beb[_0x2000('0x10')];var _0x4ff991=_0x884c25[_0x2000('0x11')](-0x1);if(_0x4ff991==='/'||_0x4ff991==='\x5c'||_0x4ff991===':'){_0x884c25=_0x884c25['substring'](0x0,_0x884c25['lastIndexOf'](_0x4ff991));}switch(_0x161beb[_0x2000('0xb')]){case'US':_0x48a6b6='https://accounts.zoho.com';break;case'AU':_0x48a6b6='https://accounts.zoho.com.au';break;case'IN':_0x48a6b6=_0x2000('0x14');break;case'CN':_0x48a6b6=_0x2000('0x15');break;default:_0x48a6b6=_0x2000('0x16');break;}var _0x4443bd={'method':'POST','uri':_0x48a6b6+_0x2000('0x18'),'form':{'grant_type':_0x2000('0x19'),'client_id':_0x161beb[_0x2000('0xc')],'client_secret':_0x161beb[_0x2000('0xd')],'redirect_uri':_0x161beb[_0x2000('0x10')],'code':_0x161beb[_0x2000('0xe')]},'headers':{'Content-Type':_0x2000('0x1a')}};return rp(_0x4443bd)[_0x2000('0x1b')](function(_0x4c7ea6){var _0x3777b6=JSON[_0x2000('0x1c')](_0x4c7ea6);if(_0x3777b6['refresh_token']){_0x161beb[_0x2000('0x1e')]=_0x3777b6['refresh_token'];logger['info'](util[_0x2000('0x1f')](_0x2000('0x24'),_0x161beb[_0x2000('0x20')],_0x161beb['id']));}else{logger[_0x2000('0x21')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x161beb['name'],_0x161beb['id']),util[_0x2000('0x23')](_0x3777b6,{'showHidden':![],'depth':null}));}return _0x1b6f66(null,_0x11a7cd);})['catch'](function(_0xa3d584){logger[_0x2000('0x21')](util[_0x2000('0x1f')](_0x2000('0x22'),_0x161beb[_0x2000('0x20')],_0x161beb['id']),util[_0x2000('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x1b6f66(_0xa3d584);});}else{return _0x1b6f66(null,_0x11a7cd);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 583f938..902d242 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 _0xb5fb=['../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','GetZohoAccount','findAll','options','where','limit','map','include','model','attributes','then','ShowZohoAccount','ZohoAccount','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x7f201f,_0x1d92c5){var _0x2feb7f=function(_0xdcbdf2){while(--_0xdcbdf2){_0x7f201f['push'](_0x7f201f['shift']());}};_0x2feb7f(++_0x1d92c5);}(_0xb5fb,0x172));var _0xbb5f=function(_0x46faaa,_0x58a7a0){_0x46faaa=_0x46faaa-0x0;var _0x1a5536=_0xb5fb[_0x46faaa];return _0x1a5536;};'use strict';var _=require(_0xbb5f('0x0'));var util=require(_0xbb5f('0x1'));var moment=require(_0xbb5f('0x2'));var BPromise=require(_0xbb5f('0x3'));var rs=require(_0xbb5f('0x4'));var fs=require('fs');var Redis=require(_0xbb5f('0x5'));var db=require(_0xbb5f('0x6'))['db'];var utils=require(_0xbb5f('0x7'));var logger=require(_0xbb5f('0x8'))(_0xbb5f('0x9'));var config=require(_0xbb5f('0xa'));var jayson=require(_0xbb5f('0xb'));var client=jayson[_0xbb5f('0xc')][_0xbb5f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x487a1a,_0x597050,_0x317cd9){return new BPromise(function(_0x5e7943,_0x5b91){return client[_0xbb5f('0xe')](_0x487a1a,_0x317cd9)['then'](function(_0x4f13a9){logger[_0xbb5f('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x597050,_0xbb5f('0x10'));logger[_0xbb5f('0x11')](_0xbb5f('0x12'),_0x597050,_0xbb5f('0x10'),JSON[_0xbb5f('0x13')](_0x4f13a9));if(_0x4f13a9[_0xbb5f('0x14')]){if(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x15')]===0x1f4){logger['error'](_0xbb5f('0x16'),_0x597050,_0x4f13a9['error'][_0xbb5f('0x17')]);return _0x5b91(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x17')]);}logger['error'](_0xbb5f('0x16'),_0x597050,_0x4f13a9[_0xbb5f('0x14')]['message']);return _0x5e7943(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x17')]);}else{logger[_0xbb5f('0xf')](_0xbb5f('0x16'),_0x597050,'request\x20sent');_0x5e7943(_0x4f13a9['result'][_0xbb5f('0x17')]);}})['catch'](function(_0xdf4ec8){logger[_0xbb5f('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x597050,_0xdf4ec8);_0x5b91(_0xdf4ec8);});});}exports[_0xbb5f('0x18')]=function(_0x4cc050){var _0x313a0e=this;return new Promise(function(_0xca33c1,_0x5944f9){return db['ZohoAccount'][_0xbb5f('0x19')]({'raw':_0x4cc050[_0xbb5f('0x1a')]?_0x4cc050[_0xbb5f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4cc050[_0xbb5f('0x1a')]?_0x4cc050['options'][_0xbb5f('0x1b')]||null:null,'attributes':_0x4cc050[_0xbb5f('0x1a')]?_0x4cc050[_0xbb5f('0x1a')]['attributes']||null:null,'limit':_0x4cc050[_0xbb5f('0x1a')]?_0x4cc050['options'][_0xbb5f('0x1c')]||null:null,'include':_0x4cc050['options']?_0x4cc050[_0xbb5f('0x1a')]['include']?_[_0xbb5f('0x1d')](_0x4cc050['options'][_0xbb5f('0x1e')],function(_0xb35efe){return{'model':db[_0xb35efe[_0xbb5f('0x1f')]],'as':_0xb35efe['as'],'attributes':_0xb35efe['attributes'],'include':_0xb35efe[_0xbb5f('0x1e')]?_['map'](_0xb35efe['include'],function(_0x41be1c){return{'model':db[_0x41be1c[_0xbb5f('0x1f')]],'as':_0x41be1c['as'],'attributes':_0x41be1c[_0xbb5f('0x20')],'include':_0x41be1c[_0xbb5f('0x1e')]?_[_0xbb5f('0x1d')](_0x41be1c[_0xbb5f('0x1e')],function(_0x150e10){return{'model':db[_0x150e10[_0xbb5f('0x1f')]],'as':_0x150e10['as'],'attributes':_0x150e10[_0xbb5f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbb5f('0x21')](function(_0xa87ebb){logger[_0xbb5f('0xf')](_0xbb5f('0x18'),_0x4cc050);logger[_0xbb5f('0x11')](_0xbb5f('0x18'),_0x4cc050,JSON[_0xbb5f('0x13')](_0xa87ebb));_0xca33c1(_0xa87ebb);})['catch'](function(_0x5a2f1a){logger[_0xbb5f('0x14')](_0xbb5f('0x18'),_0x5a2f1a['message'],_0x4cc050);_0x5944f9(_0x313a0e[_0xbb5f('0x14')](0x1f4,_0x5a2f1a['message']));});});};exports[_0xbb5f('0x22')]=function(_0x30641a){var _0xa2adf2=this;return new Promise(function(_0x24e8c2,_0x22d528){return db[_0xbb5f('0x23')]['find']({'raw':_0x30641a[_0xbb5f('0x1a')]?_0x30641a[_0xbb5f('0x1a')][_0xbb5f('0x24')]===undefined?!![]:![]:!![],'where':_0x30641a[_0xbb5f('0x1a')]?_0x30641a[_0xbb5f('0x1a')][_0xbb5f('0x1b')]||null:null,'attributes':_0x30641a[_0xbb5f('0x1a')]?_0x30641a[_0xbb5f('0x1a')][_0xbb5f('0x20')]||null:null,'include':_0x30641a[_0xbb5f('0x1a')]?_0x30641a[_0xbb5f('0x1a')][_0xbb5f('0x1e')]?_['map'](_0x30641a[_0xbb5f('0x1a')][_0xbb5f('0x1e')],function(_0x543b0e){return{'model':db[_0x543b0e[_0xbb5f('0x1f')]],'as':_0x543b0e['as'],'attributes':_0x543b0e['attributes'],'include':_0x543b0e[_0xbb5f('0x1e')]?_['map'](_0x543b0e['include'],function(_0x25c061){return{'model':db[_0x25c061[_0xbb5f('0x1f')]],'as':_0x25c061['as'],'attributes':_0x25c061[_0xbb5f('0x20')],'include':_0x25c061[_0xbb5f('0x1e')]?_[_0xbb5f('0x1d')](_0x25c061[_0xbb5f('0x1e')],function(_0x7769fe){return{'model':db[_0x7769fe[_0xbb5f('0x1f')]],'as':_0x7769fe['as'],'attributes':_0x7769fe[_0xbb5f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbb5f('0x21')](function(_0x2eb51a){logger[_0xbb5f('0xf')](_0xbb5f('0x22'),_0x30641a);logger['debug'](_0xbb5f('0x22'),_0x30641a,JSON[_0xbb5f('0x13')](_0x2eb51a));_0x24e8c2(_0x2eb51a);})[_0xbb5f('0x25')](function(_0x39a895){logger['error'](_0xbb5f('0x22'),_0x39a895['message'],_0x30641a);_0x22d528(_0xa2adf2[_0xbb5f('0x14')](0x1f4,_0x39a895[_0xbb5f('0x17')]));});});}; \ No newline at end of file +var _0xceef=['attributes','include','map','model','ShowZohoAccount','find','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll','raw','options','where'];(function(_0x3423c6,_0xd3946e){var _0x218515=function(_0x38bd2b){while(--_0x38bd2b){_0x3423c6['push'](_0x3423c6['shift']());}};_0x218515(++_0xd3946e);}(_0xceef,0xf6));var _0xfcee=function(_0xd9ce1,_0x517167){_0xd9ce1=_0xd9ce1-0x0;var _0x54be53=_0xceef[_0xd9ce1];return _0x54be53;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfcee('0x0'));var BPromise=require(_0xfcee('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcee('0x3'));var logger=require(_0xfcee('0x4'))('rpc');var config=require(_0xfcee('0x5'));var jayson=require(_0xfcee('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35234a,_0xfbfb75,_0xd69040){return new BPromise(function(_0x5b0d2c,_0x513a59){return client[_0xfcee('0x7')](_0x35234a,_0xd69040)[_0xfcee('0x8')](function(_0xcea858){logger[_0xfcee('0x9')](_0xfcee('0xa'),_0xfbfb75,_0xfcee('0xb'));logger[_0xfcee('0xc')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xfbfb75,_0xfcee('0xb'),JSON[_0xfcee('0xd')](_0xcea858));if(_0xcea858[_0xfcee('0xe')]){if(_0xcea858[_0xfcee('0xe')][_0xfcee('0xf')]===0x1f4){logger[_0xfcee('0xe')](_0xfcee('0xa'),_0xfbfb75,_0xcea858[_0xfcee('0xe')][_0xfcee('0x10')]);return _0x513a59(_0xcea858['error'][_0xfcee('0x10')]);}logger[_0xfcee('0xe')]('ZohoAccount,\x20%s,\x20%s',_0xfbfb75,_0xcea858['error'][_0xfcee('0x10')]);return _0x5b0d2c(_0xcea858[_0xfcee('0xe')][_0xfcee('0x10')]);}else{logger[_0xfcee('0x9')](_0xfcee('0xa'),_0xfbfb75,_0xfcee('0xb'));_0x5b0d2c(_0xcea858['result'][_0xfcee('0x10')]);}})[_0xfcee('0x11')](function(_0x38a971){logger['error'](_0xfcee('0xa'),_0xfbfb75,_0x38a971);_0x513a59(_0x38a971);});});}exports[_0xfcee('0x12')]=function(_0x45c690){var _0x47ddd8=this;return new Promise(function(_0x37fa9c,_0x13ec8b){return db[_0xfcee('0x13')][_0xfcee('0x14')]({'raw':_0x45c690['options']?_0x45c690['options'][_0xfcee('0x15')]===undefined?!![]:![]:!![],'where':_0x45c690[_0xfcee('0x16')]?_0x45c690[_0xfcee('0x16')][_0xfcee('0x17')]||null:null,'attributes':_0x45c690[_0xfcee('0x16')]?_0x45c690[_0xfcee('0x16')][_0xfcee('0x18')]||null:null,'limit':_0x45c690['options']?_0x45c690[_0xfcee('0x16')]['limit']||null:null,'include':_0x45c690['options']?_0x45c690[_0xfcee('0x16')][_0xfcee('0x19')]?_[_0xfcee('0x1a')](_0x45c690[_0xfcee('0x16')][_0xfcee('0x19')],function(_0x463df4){return{'model':db[_0x463df4[_0xfcee('0x1b')]],'as':_0x463df4['as'],'attributes':_0x463df4[_0xfcee('0x18')],'include':_0x463df4[_0xfcee('0x19')]?_[_0xfcee('0x1a')](_0x463df4[_0xfcee('0x19')],function(_0x475a48){return{'model':db[_0x475a48[_0xfcee('0x1b')]],'as':_0x475a48['as'],'attributes':_0x475a48[_0xfcee('0x18')],'include':_0x475a48[_0xfcee('0x19')]?_['map'](_0x475a48['include'],function(_0x56c9f7){return{'model':db[_0x56c9f7[_0xfcee('0x1b')]],'as':_0x56c9f7['as'],'attributes':_0x56c9f7[_0xfcee('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfcee('0x8')](function(_0x2e7e74){logger[_0xfcee('0x9')](_0xfcee('0x12'),_0x45c690);logger[_0xfcee('0xc')](_0xfcee('0x12'),_0x45c690,JSON[_0xfcee('0xd')](_0x2e7e74));_0x37fa9c(_0x2e7e74);})['catch'](function(_0x2dc32){logger[_0xfcee('0xe')](_0xfcee('0x12'),_0x2dc32[_0xfcee('0x10')],_0x45c690);_0x13ec8b(_0x47ddd8[_0xfcee('0xe')](0x1f4,_0x2dc32[_0xfcee('0x10')]));});});};exports[_0xfcee('0x1c')]=function(_0x5ed336){var _0x329ff0=this;return new Promise(function(_0x27c6fc,_0x397629){return db[_0xfcee('0x13')][_0xfcee('0x1d')]({'raw':_0x5ed336[_0xfcee('0x16')]?_0x5ed336[_0xfcee('0x16')][_0xfcee('0x15')]===undefined?!![]:![]:!![],'where':_0x5ed336[_0xfcee('0x16')]?_0x5ed336[_0xfcee('0x16')]['where']||null:null,'attributes':_0x5ed336[_0xfcee('0x16')]?_0x5ed336['options'][_0xfcee('0x18')]||null:null,'include':_0x5ed336[_0xfcee('0x16')]?_0x5ed336[_0xfcee('0x16')]['include']?_['map'](_0x5ed336[_0xfcee('0x16')]['include'],function(_0x4625ff){return{'model':db[_0x4625ff[_0xfcee('0x1b')]],'as':_0x4625ff['as'],'attributes':_0x4625ff[_0xfcee('0x18')],'include':_0x4625ff[_0xfcee('0x19')]?_[_0xfcee('0x1a')](_0x4625ff[_0xfcee('0x19')],function(_0x43fe34){return{'model':db[_0x43fe34['model']],'as':_0x43fe34['as'],'attributes':_0x43fe34['attributes'],'include':_0x43fe34[_0xfcee('0x19')]?_['map'](_0x43fe34[_0xfcee('0x19')],function(_0x22ebf4){return{'model':db[_0x22ebf4[_0xfcee('0x1b')]],'as':_0x22ebf4['as'],'attributes':_0x22ebf4[_0xfcee('0x18')]};}):[]};}):[]};}):[]:[]})[_0xfcee('0x8')](function(_0x5de47d){logger['info'](_0xfcee('0x1c'),_0x5ed336);logger[_0xfcee('0xc')](_0xfcee('0x1c'),_0x5ed336,JSON[_0xfcee('0xd')](_0x5de47d));_0x27c6fc(_0x5de47d);})[_0xfcee('0x11')](function(_0x9a5c7f){logger[_0xfcee('0xe')]('ShowZohoAccount',_0x9a5c7f['message'],_0x5ed336);_0x397629(_0x329ff0[_0xfcee('0xe')](0x1f4,_0x9a5c7f[_0xfcee('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index ba0b888..fc2b96f 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 _0x9215=['getDescriptions','post','/:id','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x1242af,_0x137a4f){var _0x3e3141=function(_0x54b10c){while(--_0x54b10c){_0x1242af['push'](_0x1242af['shift']());}};_0x3e3141(++_0x137a4f);}(_0x9215,0x7a));var _0x5921=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x9215[_0x134c2e];return _0x2825db;};'use strict';var multer=require('multer');var util=require(_0x5921('0x0'));var path=require('path');var timeout=require(_0x5921('0x1'));var express=require(_0x5921('0x2'));var router=express['Router']();var fs_extra=require(_0x5921('0x3'));var auth=require(_0x5921('0x4'));var interaction=require(_0x5921('0x5'));var config=require(_0x5921('0x6'));var controller=require(_0x5921('0x7'));router[_0x5921('0x8')]('/',auth[_0x5921('0x9')](),controller[_0x5921('0xa')]);router[_0x5921('0x8')]('/:id',auth[_0x5921('0x9')](),controller[_0x5921('0xb')]);router[_0x5921('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x5921('0xc')]);router[_0x5921('0x8')](_0x5921('0xd'),auth[_0x5921('0x9')](),controller[_0x5921('0xe')]);router[_0x5921('0x8')](_0x5921('0xf'),auth[_0x5921('0x9')](),controller[_0x5921('0x10')]);router[_0x5921('0x11')]('/',auth[_0x5921('0x9')](),controller['create']);router['put'](_0x5921('0x12'),auth['isAuthenticated'](),controller[_0x5921('0x13')]);router[_0x5921('0x14')]('/:id',auth[_0x5921('0x9')](),controller[_0x5921('0x15')]);module[_0x5921('0x16')]=router; \ No newline at end of file +var _0xda80=['getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields'];(function(_0x46454b,_0x240c1b){var _0x47ba7e=function(_0x3b30c2){while(--_0x3b30c2){_0x46454b['push'](_0x46454b['shift']());}};_0x47ba7e(++_0x240c1b);}(_0xda80,0x11d));var _0x0da8=function(_0x37052c,_0x51f7db){_0x37052c=_0x37052c-0x0;var _0x5ba164=_0xda80[_0x37052c];return _0x5ba164;};'use strict';var multer=require(_0x0da8('0x0'));var util=require(_0x0da8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0da8('0x2'));var router=express[_0x0da8('0x3')]();var fs_extra=require(_0x0da8('0x4'));var auth=require(_0x0da8('0x5'));var interaction=require(_0x0da8('0x6'));var config=require(_0x0da8('0x7'));var controller=require(_0x0da8('0x8'));router['get']('/',auth[_0x0da8('0x9')](),controller[_0x0da8('0xa')]);router[_0x0da8('0xb')](_0x0da8('0xc'),auth[_0x0da8('0x9')](),controller['show']);router[_0x0da8('0xb')](_0x0da8('0xd'),auth[_0x0da8('0x9')](),controller[_0x0da8('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x0da8('0xf')]);router[_0x0da8('0xb')](_0x0da8('0x10'),auth[_0x0da8('0x9')](),controller[_0x0da8('0x11')]);router[_0x0da8('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0da8('0x13')](_0x0da8('0xc'),auth[_0x0da8('0x9')](),controller['update']);router[_0x0da8('0x14')]('/:id',auth[_0x0da8('0x9')](),controller[_0x0da8('0x15')]);module[_0x0da8('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 7b813fd..e3bb026 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 _0x6838=['STRING','exports','lead','ENUM','contact_lead','contact'];(function(_0x1b86e3,_0x2904f8){var _0x45eaad=function(_0x507a25){while(--_0x507a25){_0x1b86e3['push'](_0x1b86e3['shift']());}};_0x45eaad(++_0x2904f8);}(_0x6838,0x67));var _0x8683=function(_0x3daab5,_0x4c82c0){_0x3daab5=_0x3daab5-0x0;var _0x5c9961=_0x6838[_0x3daab5];return _0x5c9961;};'use strict';var Sequelize=require('sequelize');module[_0x8683('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0x8683('0x1'),'contact','nothing'),'defaultValue':_0x8683('0x1')},'moduleSearch':{'type':Sequelize[_0x8683('0x2')](_0x8683('0x3'),_0x8683('0x4'),'lead'),'defaultValue':_0x8683('0x3')},'description':{'type':Sequelize[_0x8683('0x5')]}}; \ No newline at end of file +var _0xbd5c=['lead','contact','nothing','contact_lead','STRING','sequelize','exports','ENUM'];(function(_0x3cc31a,_0x1531e8){var _0x145808=function(_0x3fb234){while(--_0x3fb234){_0x3cc31a['push'](_0x3cc31a['shift']());}};_0x145808(++_0x1531e8);}(_0xbd5c,0x1cd));var _0xcbd5=function(_0x348b86,_0x114364){_0x348b86=_0x348b86-0x0;var _0x2bf3f2=_0xbd5c[_0x348b86];return _0x2bf3f2;};'use strict';var Sequelize=require(_0xcbd5('0x0'));module[_0xcbd5('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xcbd5('0x2')](_0xcbd5('0x3'),_0xcbd5('0x4'),_0xcbd5('0x5')),'defaultValue':_0xcbd5('0x3')},'moduleSearch':{'type':Sequelize[_0xcbd5('0x2')](_0xcbd5('0x6'),_0xcbd5('0x4'),'lead'),'defaultValue':_0xcbd5('0x6')},'description':{'type':Sequelize[_0xcbd5('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index c217be3..42898c3 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 _0xf60e=['pick','filters','filter','where','merge','VIRTUAL','options','include','catch','params','includeAll','find','create','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','then','destroy','stack','name','index','ZohoConfiguration','rawAttributes','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0xf60e,0x14b));var _0xef60=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xf60e[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0xef60('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef60('0x1'));var jsonpatch=require(_0xef60('0x2'));var rp=require(_0xef60('0x3'));var moment=require(_0xef60('0x4'));var BPromise=require(_0xef60('0x5'));var Mustache=require(_0xef60('0x6'));var util=require(_0xef60('0x7'));var path=require(_0xef60('0x8'));var sox=require('sox');var csv=require(_0xef60('0x9'));var ejs=require(_0xef60('0xa'));var fs=require('fs');var fs_extra=require(_0xef60('0xb'));var _=require(_0xef60('0xc'));var squel=require(_0xef60('0xd'));var crypto=require(_0xef60('0xe'));var jsforce=require(_0xef60('0xf'));var deskjs=require(_0xef60('0x10'));var toCsv=require('to-csv');var querystring=require(_0xef60('0x11'));var Papa=require(_0xef60('0x12'));var Redis=require(_0xef60('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef60('0x14'));var as=require(_0xef60('0x15'));var hardwareService=require(_0xef60('0x16'));var logger=require(_0xef60('0x17'))(_0xef60('0x18'));var utils=require(_0xef60('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef60('0x1a'));var db=require(_0xef60('0x1b'))['db'];function respondWithStatusCode(_0x32e24f,_0x49c853){_0x49c853=_0x49c853||0xcc;return function(_0x2eff73){if(_0x2eff73){return _0x32e24f[_0xef60('0x1c')](_0x49c853);}return _0x32e24f[_0xef60('0x1d')](_0x49c853)['end']();};}function respondWithResult(_0x2b7c21,_0x55ad0a){_0x55ad0a=_0x55ad0a||0xc8;return function(_0x12eaca){if(_0x12eaca){return _0x2b7c21[_0xef60('0x1d')](_0x55ad0a)[_0xef60('0x1e')](_0x12eaca);}};}function respondWithFilteredResult(_0x5cb384,_0x540953){return function(_0x5be9f3){if(_0x5be9f3){var _0x377cd1=typeof _0x540953[_0xef60('0x1f')]===_0xef60('0x20')&&typeof _0x540953['limit']===_0xef60('0x20');var _0x4972b0=_0x5be9f3[_0xef60('0x21')];var _0x7d382f=_0x377cd1?0x0:_0x540953['offset'];var _0x32c587=_0x377cd1?_0x5be9f3[_0xef60('0x21')]:_0x540953[_0xef60('0x1f')]+_0x540953[_0xef60('0x22')];var _0x54ec87;if(_0x32c587>=_0x4972b0){_0x32c587=_0x4972b0;_0x54ec87=0xc8;}else{_0x54ec87=0xce;}_0x5cb384[_0xef60('0x1d')](_0x54ec87);return _0x5cb384[_0xef60('0x23')]('Content-Range',_0x7d382f+'-'+_0x32c587+'/'+_0x4972b0)[_0xef60('0x1e')](_0x5be9f3);}return null;};}function patchUpdates(_0x59e220){return function(_0x212e20){try{jsonpatch[_0xef60('0x24')](_0x212e20,_0x59e220,!![]);}catch(_0x307dc4){return BPromise['reject'](_0x307dc4);}return _0x212e20[_0xef60('0x25')]();};}function saveUpdates(_0x34b290,_0x20024b){return function(_0x5e6940){if(_0x5e6940){return _0x5e6940['update'](_0x34b290)[_0xef60('0x26')](function(_0x5830d0){return _0x5830d0;});}return null;};}function removeEntity(_0x41a0ab,_0x436c2a){return function(_0x164807){if(_0x164807){return _0x164807[_0xef60('0x27')]()[_0xef60('0x26')](function(){_0x41a0ab[_0xef60('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x124ea2,_0x34e9b1){return function(_0x3335b8){if(!_0x3335b8){_0x124ea2[_0xef60('0x1c')](0x194);}return _0x3335b8;};}function handleError(_0x5e8fd3,_0x324fec){_0x324fec=_0x324fec||0x1f4;return function(_0x260065){logger['error'](_0x260065[_0xef60('0x28')]);if(_0x260065[_0xef60('0x29')]){delete _0x260065[_0xef60('0x29')];}_0x5e8fd3['status'](_0x324fec)['send'](_0x260065);};}exports[_0xef60('0x2a')]=function(_0x534ae6,_0x1c4942){var _0xb0995b={},_0x3fddce={},_0x2def82={'count':0x0,'rows':[]};var _0x300df9=_['map'](db[_0xef60('0x2b')][_0xef60('0x2c')],function(_0x533aad){return{'name':_0x533aad['fieldName'],'type':_0x533aad[_0xef60('0x2d')][_0xef60('0x2e')]};});_0x3fddce['model']=_[_0xef60('0x2f')](_0x300df9,_0xef60('0x29'));_0x3fddce[_0xef60('0x30')]=_[_0xef60('0x31')](_0x534ae6[_0xef60('0x30')]);_0x3fddce['filters']=_[_0xef60('0x32')](_0x3fddce[_0xef60('0x33')],_0x3fddce[_0xef60('0x30')]);_0xb0995b['attributes']=_[_0xef60('0x32')](_0x3fddce['model'],qs[_0xef60('0x34')](_0x534ae6[_0xef60('0x30')]['fields']));_0xb0995b['attributes']=_0xb0995b[_0xef60('0x35')][_0xef60('0x36')]?_0xb0995b[_0xef60('0x35')]:_0x3fddce[_0xef60('0x33')];if(!_0x534ae6[_0xef60('0x30')][_0xef60('0x37')](_0xef60('0x38'))){_0xb0995b[_0xef60('0x22')]=qs[_0xef60('0x22')](_0x534ae6[_0xef60('0x30')][_0xef60('0x22')]);_0xb0995b[_0xef60('0x1f')]=qs[_0xef60('0x1f')](_0x534ae6[_0xef60('0x30')][_0xef60('0x1f')]);}_0xb0995b[_0xef60('0x39')]=qs[_0xef60('0x3a')](_0x534ae6[_0xef60('0x30')]['sort']);_0xb0995b['where']=qs['filters'](_[_0xef60('0x3b')](_0x534ae6[_0xef60('0x30')],_0x3fddce[_0xef60('0x3c')]),_0x300df9);if(_0x534ae6[_0xef60('0x30')][_0xef60('0x3d')]){_0xb0995b[_0xef60('0x3e')]=_[_0xef60('0x3f')](_0xb0995b[_0xef60('0x3e')],{'$or':_[_0xef60('0x2f')](_0x300df9,function(_0x1e0073){if(_0x1e0073[_0xef60('0x2d')]!==_0xef60('0x40')){var _0x5459f2={};_0x5459f2[_0x1e0073[_0xef60('0x29')]]={'$like':'%'+_0x534ae6[_0xef60('0x30')][_0xef60('0x3d')]+'%'};return _0x5459f2;}})});}_0xb0995b=_['merge']({},_0xb0995b,_0x534ae6[_0xef60('0x41')]);var _0x2e2d0f={'where':_0xb0995b[_0xef60('0x3e')]};return db[_0xef60('0x2b')][_0xef60('0x21')](_0x2e2d0f)[_0xef60('0x26')](function(_0x1d6891){_0x2def82[_0xef60('0x21')]=_0x1d6891;if(_0x534ae6['query']['includeAll']){_0xb0995b[_0xef60('0x42')]=[{'all':!![]}];}return db[_0xef60('0x2b')]['findAll'](_0xb0995b);})[_0xef60('0x26')](function(_0x1d4217){_0x2def82['rows']=_0x1d4217;return _0x2def82;})[_0xef60('0x26')](respondWithFilteredResult(_0x1c4942,_0xb0995b))[_0xef60('0x43')](handleError(_0x1c4942,null));};exports['show']=function(_0x344663,_0x1d9b9f){var _0x372121={'raw':![],'where':{'id':_0x344663[_0xef60('0x44')]['id']}},_0x1a980a={};_0x1a980a[_0xef60('0x33')]=_[_0xef60('0x31')](db[_0xef60('0x2b')]['rawAttributes']);_0x1a980a[_0xef60('0x30')]=_[_0xef60('0x31')](_0x344663['query']);_0x1a980a[_0xef60('0x3c')]=_['intersection'](_0x1a980a[_0xef60('0x33')],_0x1a980a[_0xef60('0x30')]);_0x372121[_0xef60('0x35')]=_['intersection'](_0x1a980a[_0xef60('0x33')],qs[_0xef60('0x34')](_0x344663['query'][_0xef60('0x34')]));_0x372121[_0xef60('0x35')]=_0x372121[_0xef60('0x35')][_0xef60('0x36')]?_0x372121[_0xef60('0x35')]:_0x1a980a['model'];if(_0x344663[_0xef60('0x30')][_0xef60('0x45')]){_0x372121['include']=[{'all':!![]}];}_0x372121=_['merge']({},_0x372121,_0x344663[_0xef60('0x41')]);return db['ZohoConfiguration'][_0xef60('0x46')](_0x372121)[_0xef60('0x26')](handleEntityNotFound(_0x1d9b9f,null))[_0xef60('0x26')](respondWithResult(_0x1d9b9f,null))[_0xef60('0x43')](handleError(_0x1d9b9f,null));};exports[_0xef60('0x47')]=function(_0x5ee008,_0x4a6bb4){return db['ZohoConfiguration'][_0xef60('0x47')](_0x5ee008[_0xef60('0x48')],{})['then'](respondWithResult(_0x4a6bb4,0xc9))[_0xef60('0x43')](handleError(_0x4a6bb4,null));};exports['update']=function(_0xc55a54,_0x19add5){if(_0xc55a54[_0xef60('0x48')]['id']){delete _0xc55a54[_0xef60('0x48')]['id'];}return db['ZohoConfiguration'][_0xef60('0x46')]({'where':{'id':_0xc55a54[_0xef60('0x44')]['id']}})[_0xef60('0x26')](handleEntityNotFound(_0x19add5,null))['then'](saveUpdates(_0xc55a54['body'],null))[_0xef60('0x26')](respondWithResult(_0x19add5,null))[_0xef60('0x43')](handleError(_0x19add5,null));};exports['destroy']=function(_0x186e6b,_0x28b136){return db[_0xef60('0x2b')][_0xef60('0x46')]({'where':{'id':_0x186e6b[_0xef60('0x44')]['id']}})[_0xef60('0x26')](handleEntityNotFound(_0x28b136,null))[_0xef60('0x26')](removeEntity(_0x28b136,null))[_0xef60('0x43')](handleError(_0x28b136,null));};exports[_0xef60('0x49')]=function(_0x346edc,_0xfcaebd,_0x110236){var _0x4916d3={};var _0x306420={};var _0x32e0d3;var _0x5b28e5;return db[_0xef60('0x2b')][_0xef60('0x4a')]({'where':{'id':_0x346edc[_0xef60('0x44')]['id']}})['then'](handleEntityNotFound(_0xfcaebd,null))[_0xef60('0x26')](function(_0x1d29ab){if(_0x1d29ab){_0x32e0d3=_0x1d29ab;_0x306420[_0xef60('0x33')]=_[_0xef60('0x31')](db[_0xef60('0x4b')][_0xef60('0x2c')]);_0x306420['query']=_[_0xef60('0x31')](_0x346edc[_0xef60('0x30')]);_0x306420['filters']=_[_0xef60('0x32')](_0x306420[_0xef60('0x33')],_0x306420[_0xef60('0x30')]);_0x4916d3['attributes']=_['intersection'](_0x306420['model'],qs[_0xef60('0x34')](_0x346edc[_0xef60('0x30')][_0xef60('0x34')]));_0x4916d3['attributes']=_0x4916d3['attributes']['length']?_0x4916d3['attributes']:_0x306420[_0xef60('0x33')];_0x4916d3['order']=qs[_0xef60('0x3a')](_0x346edc[_0xef60('0x30')]['sort']);_0x4916d3[_0xef60('0x3e')]=qs['filters'](_[_0xef60('0x3b')](_0x346edc['query'],_0x306420[_0xef60('0x3c')]));if(_0x346edc[_0xef60('0x30')]['filter']){_0x4916d3[_0xef60('0x3e')]=_['merge'](_0x4916d3[_0xef60('0x3e')],{'$or':_['map'](_0x4916d3[_0xef60('0x35')],function(_0x4f35ce){var _0x496ee6={};_0x496ee6[_0x4f35ce]={'$like':'%'+_0x346edc['query'][_0xef60('0x3d')]+'%'};return _0x496ee6;})});}_0x4916d3=_[_0xef60('0x3f')]({},_0x4916d3,_0x346edc[_0xef60('0x41')]);return _0x32e0d3[_0xef60('0x49')](_0x4916d3);}})[_0xef60('0x26')](function(_0x4d39a6){if(_0x4d39a6){_0x5b28e5=_0x4d39a6[_0xef60('0x36')];if(!_0x346edc[_0xef60('0x30')][_0xef60('0x37')](_0xef60('0x38'))){_0x4916d3['limit']=qs[_0xef60('0x22')](_0x346edc['query'][_0xef60('0x22')]);_0x4916d3[_0xef60('0x1f')]=qs[_0xef60('0x1f')](_0x346edc['query'][_0xef60('0x1f')]);}return _0x32e0d3[_0xef60('0x49')](_0x4916d3);}})[_0xef60('0x26')](function(_0x553692){if(_0x553692){return _0x553692?{'count':_0x5b28e5,'rows':_0x553692}:null;}})[_0xef60('0x26')](respondWithResult(_0xfcaebd,null))[_0xef60('0x43')](handleError(_0xfcaebd,null));};exports[_0xef60('0x4c')]=function(_0x3fff33,_0x2f7ef3,_0x4a0980){var _0x2f99e2={};var _0x1227b5={};var _0x4467a1;var _0x5453bb;return db['ZohoConfiguration'][_0xef60('0x4a')]({'where':{'id':_0x3fff33['params']['id']}})[_0xef60('0x26')](handleEntityNotFound(_0x2f7ef3,null))['then'](function(_0x2659b4){if(_0x2659b4){_0x4467a1=_0x2659b4;_0x1227b5[_0xef60('0x33')]=_[_0xef60('0x31')](db[_0xef60('0x4b')]['rawAttributes']);_0x1227b5[_0xef60('0x30')]=_[_0xef60('0x31')](_0x3fff33[_0xef60('0x30')]);_0x1227b5[_0xef60('0x3c')]=_[_0xef60('0x32')](_0x1227b5[_0xef60('0x33')],_0x1227b5['query']);_0x2f99e2[_0xef60('0x35')]=_[_0xef60('0x32')](_0x1227b5[_0xef60('0x33')],qs['fields'](_0x3fff33[_0xef60('0x30')][_0xef60('0x34')]));_0x2f99e2[_0xef60('0x35')]=_0x2f99e2[_0xef60('0x35')][_0xef60('0x36')]?_0x2f99e2[_0xef60('0x35')]:_0x1227b5['model'];_0x2f99e2['order']=qs[_0xef60('0x3a')](_0x3fff33[_0xef60('0x30')][_0xef60('0x3a')]);_0x2f99e2[_0xef60('0x3e')]=qs[_0xef60('0x3c')](_[_0xef60('0x3b')](_0x3fff33[_0xef60('0x30')],_0x1227b5['filters']));if(_0x3fff33[_0xef60('0x30')]['filter']){_0x2f99e2['where']=_[_0xef60('0x3f')](_0x2f99e2[_0xef60('0x3e')],{'$or':_['map'](_0x2f99e2[_0xef60('0x35')],function(_0x313faf){var _0x4a5921={};_0x4a5921[_0x313faf]={'$like':'%'+_0x3fff33[_0xef60('0x30')][_0xef60('0x3d')]+'%'};return _0x4a5921;})});}_0x2f99e2=_['merge']({},_0x2f99e2,_0x3fff33[_0xef60('0x41')]);return _0x4467a1[_0xef60('0x4c')](_0x2f99e2);}})['then'](function(_0x414705){if(_0x414705){_0x5453bb=_0x414705[_0xef60('0x36')];if(!_0x3fff33[_0xef60('0x30')][_0xef60('0x37')](_0xef60('0x38'))){_0x2f99e2[_0xef60('0x22')]=qs[_0xef60('0x22')](_0x3fff33[_0xef60('0x30')][_0xef60('0x22')]);_0x2f99e2[_0xef60('0x1f')]=qs[_0xef60('0x1f')](_0x3fff33['query'][_0xef60('0x1f')]);}return _0x4467a1['getSubjects'](_0x2f99e2);}})[_0xef60('0x26')](function(_0x46e229){if(_0x46e229){return _0x46e229?{'count':_0x5453bb,'rows':_0x46e229}:null;}})['then'](respondWithResult(_0x2f7ef3,null))[_0xef60('0x43')](handleError(_0x2f7ef3,null));};exports[_0xef60('0x4d')]=function(_0x10123d,_0xfe4a37,_0xade763){var _0x185814={};var _0x144ef6={};var _0x4b9b4e;var _0x49d7a6;return db[_0xef60('0x2b')][_0xef60('0x4a')]({'where':{'id':_0x10123d['params']['id']}})['then'](handleEntityNotFound(_0xfe4a37,null))['then'](function(_0x22c227){if(_0x22c227){_0x4b9b4e=_0x22c227;_0x144ef6[_0xef60('0x33')]=_[_0xef60('0x31')](db[_0xef60('0x4b')][_0xef60('0x2c')]);_0x144ef6['query']=_[_0xef60('0x31')](_0x10123d[_0xef60('0x30')]);_0x144ef6[_0xef60('0x3c')]=_[_0xef60('0x32')](_0x144ef6[_0xef60('0x33')],_0x144ef6['query']);_0x185814[_0xef60('0x35')]=_[_0xef60('0x32')](_0x144ef6[_0xef60('0x33')],qs['fields'](_0x10123d[_0xef60('0x30')][_0xef60('0x34')]));_0x185814[_0xef60('0x35')]=_0x185814[_0xef60('0x35')][_0xef60('0x36')]?_0x185814['attributes']:_0x144ef6[_0xef60('0x33')];_0x185814['order']=qs[_0xef60('0x3a')](_0x10123d['query'][_0xef60('0x3a')]);_0x185814['where']=qs[_0xef60('0x3c')](_['pick'](_0x10123d['query'],_0x144ef6[_0xef60('0x3c')]));if(_0x10123d[_0xef60('0x30')][_0xef60('0x3d')]){_0x185814['where']=_[_0xef60('0x3f')](_0x185814['where'],{'$or':_[_0xef60('0x2f')](_0x185814[_0xef60('0x35')],function(_0x309b70){var _0x3671aa={};_0x3671aa[_0x309b70]={'$like':'%'+_0x10123d[_0xef60('0x30')][_0xef60('0x3d')]+'%'};return _0x3671aa;})});}_0x185814=_['merge']({},_0x185814,_0x10123d['options']);return _0x4b9b4e[_0xef60('0x4d')](_0x185814);}})[_0xef60('0x26')](function(_0x2f9dc9){if(_0x2f9dc9){_0x49d7a6=_0x2f9dc9[_0xef60('0x36')];if(!_0x10123d[_0xef60('0x30')][_0xef60('0x37')](_0xef60('0x38'))){_0x185814[_0xef60('0x22')]=qs['limit'](_0x10123d[_0xef60('0x30')][_0xef60('0x22')]);_0x185814[_0xef60('0x1f')]=qs['offset'](_0x10123d['query']['offset']);}return _0x4b9b4e[_0xef60('0x4d')](_0x185814);}})[_0xef60('0x26')](function(_0x56c476){if(_0x56c476){return _0x56c476?{'count':_0x49d7a6,'rows':_0x56c476}:null;}})[_0xef60('0x26')](respondWithResult(_0xfe4a37,null))['catch'](handleError(_0xfe4a37,null));}; \ No newline at end of file +var _0xbf53=['getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','error','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName','type','key','map','keys','query','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','length','find','create','body','destroy','getFields','findOne','ZohoField','nolimit'];(function(_0x444e44,_0x37be34){var _0xdd22e2=function(_0x2cd83d){while(--_0x2cd83d){_0x444e44['push'](_0x444e44['shift']());}};_0xdd22e2(++_0x37be34);}(_0xbf53,0x1e8));var _0x3bf5=function(_0x2496da,_0x3fe1fc){_0x2496da=_0x2496da-0x0;var _0x4caae0=_0xbf53[_0x2496da];return _0x4caae0;};'use strict';var emlformat=require(_0x3bf5('0x0'));var rimraf=require(_0x3bf5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3bf5('0x2'));var rp=require(_0x3bf5('0x3'));var moment=require(_0x3bf5('0x4'));var BPromise=require(_0x3bf5('0x5'));var Mustache=require(_0x3bf5('0x6'));var util=require(_0x3bf5('0x7'));var path=require(_0x3bf5('0x8'));var sox=require(_0x3bf5('0x9'));var csv=require(_0x3bf5('0xa'));var ejs=require(_0x3bf5('0xb'));var fs=require('fs');var fs_extra=require(_0x3bf5('0xc'));var _=require(_0x3bf5('0xd'));var squel=require('squel');var crypto=require(_0x3bf5('0xe'));var jsforce=require(_0x3bf5('0xf'));var deskjs=require(_0x3bf5('0x10'));var toCsv=require(_0x3bf5('0xa'));var querystring=require(_0x3bf5('0x11'));var Papa=require('papaparse');var Redis=require(_0x3bf5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3bf5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bf5('0x14'))(_0x3bf5('0x15'));var utils=require('../../config/utils');var config=require(_0x3bf5('0x16'));var licenseUtil=require(_0x3bf5('0x17'));var db=require(_0x3bf5('0x18'))['db'];function respondWithStatusCode(_0x473e78,_0x929568){_0x929568=_0x929568||0xcc;return function(_0x58c217){if(_0x58c217){return _0x473e78['sendStatus'](_0x929568);}return _0x473e78['status'](_0x929568)['end']();};}function respondWithResult(_0x33bc85,_0x222ead){_0x222ead=_0x222ead||0xc8;return function(_0x11b19a){if(_0x11b19a){return _0x33bc85[_0x3bf5('0x19')](_0x222ead)[_0x3bf5('0x1a')](_0x11b19a);}};}function respondWithFilteredResult(_0x1e3912,_0x3ed3d9){return function(_0x4f5814){if(_0x4f5814){var _0x247acd=typeof _0x3ed3d9[_0x3bf5('0x1b')]===_0x3bf5('0x1c')&&typeof _0x3ed3d9[_0x3bf5('0x1d')]==='undefined';var _0x1989e1=_0x4f5814[_0x3bf5('0x1e')];var _0x4bc834=_0x247acd?0x0:_0x3ed3d9[_0x3bf5('0x1b')];var _0x34b90e=_0x247acd?_0x4f5814[_0x3bf5('0x1e')]:_0x3ed3d9[_0x3bf5('0x1b')]+_0x3ed3d9[_0x3bf5('0x1d')];var _0x38cafc;if(_0x34b90e>=_0x1989e1){_0x34b90e=_0x1989e1;_0x38cafc=0xc8;}else{_0x38cafc=0xce;}_0x1e3912['status'](_0x38cafc);return _0x1e3912[_0x3bf5('0x1f')](_0x3bf5('0x20'),_0x4bc834+'-'+_0x34b90e+'/'+_0x1989e1)[_0x3bf5('0x1a')](_0x4f5814);}return null;};}function patchUpdates(_0x55ef49){return function(_0x47ca2d){try{jsonpatch['apply'](_0x47ca2d,_0x55ef49,!![]);}catch(_0x523ad4){return BPromise['reject'](_0x523ad4);}return _0x47ca2d['save']();};}function saveUpdates(_0x21bf8e,_0x203724){return function(_0x2b9798){if(_0x2b9798){return _0x2b9798[_0x3bf5('0x21')](_0x21bf8e)[_0x3bf5('0x22')](function(_0x1e7655){return _0x1e7655;});}return null;};}function removeEntity(_0x307ece,_0x402d28){return function(_0x2ddcd8){if(_0x2ddcd8){return _0x2ddcd8['destroy']()[_0x3bf5('0x22')](function(){_0x307ece[_0x3bf5('0x19')](0xcc)[_0x3bf5('0x23')]();});}};}function handleEntityNotFound(_0x406c82,_0x270af7){return function(_0x478f4){if(!_0x478f4){_0x406c82[_0x3bf5('0x24')](0x194);}return _0x478f4;};}function handleError(_0x99598b,_0x54bf04){_0x54bf04=_0x54bf04||0x1f4;return function(_0x20512b){logger[_0x3bf5('0x25')](_0x20512b[_0x3bf5('0x26')]);if(_0x20512b[_0x3bf5('0x27')]){delete _0x20512b['name'];}_0x99598b[_0x3bf5('0x19')](_0x54bf04)[_0x3bf5('0x28')](_0x20512b);};}exports[_0x3bf5('0x29')]=function(_0x613888,_0x96173b){var _0x3c5319={},_0x293572={},_0x5786aa={'count':0x0,'rows':[]};var _0xd9fe00=_['map'](db[_0x3bf5('0x2a')][_0x3bf5('0x2b')],function(_0x1214b8){return{'name':_0x1214b8[_0x3bf5('0x2c')],'type':_0x1214b8[_0x3bf5('0x2d')][_0x3bf5('0x2e')]};});_0x293572['model']=_[_0x3bf5('0x2f')](_0xd9fe00,_0x3bf5('0x27'));_0x293572['query']=_[_0x3bf5('0x30')](_0x613888[_0x3bf5('0x31')]);_0x293572['filters']=_[_0x3bf5('0x32')](_0x293572[_0x3bf5('0x33')],_0x293572[_0x3bf5('0x31')]);_0x3c5319['attributes']=_[_0x3bf5('0x32')](_0x293572['model'],qs['fields'](_0x613888[_0x3bf5('0x31')][_0x3bf5('0x34')]));_0x3c5319['attributes']=_0x3c5319[_0x3bf5('0x35')]['length']?_0x3c5319[_0x3bf5('0x35')]:_0x293572[_0x3bf5('0x33')];if(!_0x613888[_0x3bf5('0x31')][_0x3bf5('0x36')]('nolimit')){_0x3c5319['limit']=qs[_0x3bf5('0x1d')](_0x613888['query']['limit']);_0x3c5319[_0x3bf5('0x1b')]=qs[_0x3bf5('0x1b')](_0x613888['query']['offset']);}_0x3c5319[_0x3bf5('0x37')]=qs[_0x3bf5('0x38')](_0x613888[_0x3bf5('0x31')][_0x3bf5('0x38')]);_0x3c5319[_0x3bf5('0x39')]=qs['filters'](_[_0x3bf5('0x3a')](_0x613888[_0x3bf5('0x31')],_0x293572[_0x3bf5('0x3b')]),_0xd9fe00);if(_0x613888[_0x3bf5('0x31')][_0x3bf5('0x3c')]){_0x3c5319['where']=_['merge'](_0x3c5319[_0x3bf5('0x39')],{'$or':_['map'](_0xd9fe00,function(_0x8240a9){if(_0x8240a9['type']!==_0x3bf5('0x3d')){var _0x186495={};_0x186495[_0x8240a9[_0x3bf5('0x27')]]={'$like':'%'+_0x613888['query']['filter']+'%'};return _0x186495;}})});}_0x3c5319=_[_0x3bf5('0x3e')]({},_0x3c5319,_0x613888[_0x3bf5('0x3f')]);var _0x2d98fe={'where':_0x3c5319['where']};return db[_0x3bf5('0x2a')][_0x3bf5('0x1e')](_0x2d98fe)[_0x3bf5('0x22')](function(_0xee22e4){_0x5786aa[_0x3bf5('0x1e')]=_0xee22e4;if(_0x613888[_0x3bf5('0x31')]['includeAll']){_0x3c5319[_0x3bf5('0x40')]=[{'all':!![]}];}return db[_0x3bf5('0x2a')][_0x3bf5('0x41')](_0x3c5319);})[_0x3bf5('0x22')](function(_0x16b1a3){_0x5786aa[_0x3bf5('0x42')]=_0x16b1a3;return _0x5786aa;})['then'](respondWithFilteredResult(_0x96173b,_0x3c5319))[_0x3bf5('0x43')](handleError(_0x96173b,null));};exports[_0x3bf5('0x44')]=function(_0x1479ef,_0x184c8e){var _0x3a7886={'raw':![],'where':{'id':_0x1479ef[_0x3bf5('0x45')]['id']}},_0x74476f={};_0x74476f[_0x3bf5('0x33')]=_[_0x3bf5('0x30')](db[_0x3bf5('0x2a')]['rawAttributes']);_0x74476f[_0x3bf5('0x31')]=_[_0x3bf5('0x30')](_0x1479ef[_0x3bf5('0x31')]);_0x74476f[_0x3bf5('0x3b')]=_['intersection'](_0x74476f[_0x3bf5('0x33')],_0x74476f[_0x3bf5('0x31')]);_0x3a7886[_0x3bf5('0x35')]=_['intersection'](_0x74476f[_0x3bf5('0x33')],qs[_0x3bf5('0x34')](_0x1479ef[_0x3bf5('0x31')]['fields']));_0x3a7886[_0x3bf5('0x35')]=_0x3a7886['attributes'][_0x3bf5('0x46')]?_0x3a7886[_0x3bf5('0x35')]:_0x74476f[_0x3bf5('0x33')];if(_0x1479ef[_0x3bf5('0x31')]['includeAll']){_0x3a7886[_0x3bf5('0x40')]=[{'all':!![]}];}_0x3a7886=_[_0x3bf5('0x3e')]({},_0x3a7886,_0x1479ef[_0x3bf5('0x3f')]);return db[_0x3bf5('0x2a')][_0x3bf5('0x47')](_0x3a7886)[_0x3bf5('0x22')](handleEntityNotFound(_0x184c8e,null))[_0x3bf5('0x22')](respondWithResult(_0x184c8e,null))[_0x3bf5('0x43')](handleError(_0x184c8e,null));};exports[_0x3bf5('0x48')]=function(_0x2344af,_0x4601c8){return db['ZohoConfiguration'][_0x3bf5('0x48')](_0x2344af['body'],{})['then'](respondWithResult(_0x4601c8,0xc9))[_0x3bf5('0x43')](handleError(_0x4601c8,null));};exports[_0x3bf5('0x21')]=function(_0x2f529f,_0x6e85f8){if(_0x2f529f[_0x3bf5('0x49')]['id']){delete _0x2f529f[_0x3bf5('0x49')]['id'];}return db[_0x3bf5('0x2a')]['find']({'where':{'id':_0x2f529f[_0x3bf5('0x45')]['id']}})[_0x3bf5('0x22')](handleEntityNotFound(_0x6e85f8,null))[_0x3bf5('0x22')](saveUpdates(_0x2f529f[_0x3bf5('0x49')],null))[_0x3bf5('0x22')](respondWithResult(_0x6e85f8,null))[_0x3bf5('0x43')](handleError(_0x6e85f8,null));};exports[_0x3bf5('0x4a')]=function(_0xc5281b,_0x4a9c84){return db[_0x3bf5('0x2a')][_0x3bf5('0x47')]({'where':{'id':_0xc5281b['params']['id']}})[_0x3bf5('0x22')](handleEntityNotFound(_0x4a9c84,null))[_0x3bf5('0x22')](removeEntity(_0x4a9c84,null))[_0x3bf5('0x43')](handleError(_0x4a9c84,null));};exports[_0x3bf5('0x4b')]=function(_0x45433a,_0x2c8479,_0xf42b4){var _0x336751={};var _0x549d52={};var _0x119fa5;var _0x8c049d;return db[_0x3bf5('0x2a')][_0x3bf5('0x4c')]({'where':{'id':_0x45433a[_0x3bf5('0x45')]['id']}})[_0x3bf5('0x22')](handleEntityNotFound(_0x2c8479,null))[_0x3bf5('0x22')](function(_0x36a5cc){if(_0x36a5cc){_0x119fa5=_0x36a5cc;_0x549d52['model']=_[_0x3bf5('0x30')](db[_0x3bf5('0x4d')][_0x3bf5('0x2b')]);_0x549d52[_0x3bf5('0x31')]=_['keys'](_0x45433a[_0x3bf5('0x31')]);_0x549d52[_0x3bf5('0x3b')]=_['intersection'](_0x549d52[_0x3bf5('0x33')],_0x549d52[_0x3bf5('0x31')]);_0x336751[_0x3bf5('0x35')]=_[_0x3bf5('0x32')](_0x549d52[_0x3bf5('0x33')],qs['fields'](_0x45433a['query']['fields']));_0x336751[_0x3bf5('0x35')]=_0x336751['attributes'][_0x3bf5('0x46')]?_0x336751[_0x3bf5('0x35')]:_0x549d52[_0x3bf5('0x33')];_0x336751[_0x3bf5('0x37')]=qs[_0x3bf5('0x38')](_0x45433a[_0x3bf5('0x31')][_0x3bf5('0x38')]);_0x336751[_0x3bf5('0x39')]=qs[_0x3bf5('0x3b')](_[_0x3bf5('0x3a')](_0x45433a[_0x3bf5('0x31')],_0x549d52[_0x3bf5('0x3b')]));if(_0x45433a['query'][_0x3bf5('0x3c')]){_0x336751[_0x3bf5('0x39')]=_[_0x3bf5('0x3e')](_0x336751[_0x3bf5('0x39')],{'$or':_['map'](_0x336751[_0x3bf5('0x35')],function(_0x332bf8){var _0x49fd5d={};_0x49fd5d[_0x332bf8]={'$like':'%'+_0x45433a[_0x3bf5('0x31')][_0x3bf5('0x3c')]+'%'};return _0x49fd5d;})});}_0x336751=_[_0x3bf5('0x3e')]({},_0x336751,_0x45433a[_0x3bf5('0x3f')]);return _0x119fa5[_0x3bf5('0x4b')](_0x336751);}})[_0x3bf5('0x22')](function(_0x2e8a69){if(_0x2e8a69){_0x8c049d=_0x2e8a69[_0x3bf5('0x46')];if(!_0x45433a['query'][_0x3bf5('0x36')](_0x3bf5('0x4e'))){_0x336751[_0x3bf5('0x1d')]=qs['limit'](_0x45433a[_0x3bf5('0x31')][_0x3bf5('0x1d')]);_0x336751['offset']=qs[_0x3bf5('0x1b')](_0x45433a[_0x3bf5('0x31')][_0x3bf5('0x1b')]);}return _0x119fa5[_0x3bf5('0x4b')](_0x336751);}})['then'](function(_0x245292){if(_0x245292){return _0x245292?{'count':_0x8c049d,'rows':_0x245292}:null;}})[_0x3bf5('0x22')](respondWithResult(_0x2c8479,null))[_0x3bf5('0x43')](handleError(_0x2c8479,null));};exports[_0x3bf5('0x4f')]=function(_0x482354,_0x205e9a,_0x1626a5){var _0x411e39={};var _0x333363={};var _0x248575;var _0x5ea53a;return db[_0x3bf5('0x2a')][_0x3bf5('0x4c')]({'where':{'id':_0x482354[_0x3bf5('0x45')]['id']}})[_0x3bf5('0x22')](handleEntityNotFound(_0x205e9a,null))[_0x3bf5('0x22')](function(_0x2de707){if(_0x2de707){_0x248575=_0x2de707;_0x333363[_0x3bf5('0x33')]=_[_0x3bf5('0x30')](db[_0x3bf5('0x4d')][_0x3bf5('0x2b')]);_0x333363[_0x3bf5('0x31')]=_[_0x3bf5('0x30')](_0x482354[_0x3bf5('0x31')]);_0x333363[_0x3bf5('0x3b')]=_[_0x3bf5('0x32')](_0x333363[_0x3bf5('0x33')],_0x333363[_0x3bf5('0x31')]);_0x411e39[_0x3bf5('0x35')]=_[_0x3bf5('0x32')](_0x333363[_0x3bf5('0x33')],qs['fields'](_0x482354[_0x3bf5('0x31')]['fields']));_0x411e39['attributes']=_0x411e39[_0x3bf5('0x35')]['length']?_0x411e39[_0x3bf5('0x35')]:_0x333363[_0x3bf5('0x33')];_0x411e39[_0x3bf5('0x37')]=qs[_0x3bf5('0x38')](_0x482354[_0x3bf5('0x31')][_0x3bf5('0x38')]);_0x411e39['where']=qs[_0x3bf5('0x3b')](_['pick'](_0x482354['query'],_0x333363['filters']));if(_0x482354[_0x3bf5('0x31')]['filter']){_0x411e39[_0x3bf5('0x39')]=_['merge'](_0x411e39[_0x3bf5('0x39')],{'$or':_[_0x3bf5('0x2f')](_0x411e39[_0x3bf5('0x35')],function(_0x74c1ba){var _0x441d9c={};_0x441d9c[_0x74c1ba]={'$like':'%'+_0x482354[_0x3bf5('0x31')][_0x3bf5('0x3c')]+'%'};return _0x441d9c;})});}_0x411e39=_[_0x3bf5('0x3e')]({},_0x411e39,_0x482354[_0x3bf5('0x3f')]);return _0x248575[_0x3bf5('0x4f')](_0x411e39);}})[_0x3bf5('0x22')](function(_0x3adfca){if(_0x3adfca){_0x5ea53a=_0x3adfca[_0x3bf5('0x46')];if(!_0x482354[_0x3bf5('0x31')]['hasOwnProperty'](_0x3bf5('0x4e'))){_0x411e39[_0x3bf5('0x1d')]=qs[_0x3bf5('0x1d')](_0x482354[_0x3bf5('0x31')][_0x3bf5('0x1d')]);_0x411e39[_0x3bf5('0x1b')]=qs[_0x3bf5('0x1b')](_0x482354[_0x3bf5('0x31')]['offset']);}return _0x248575[_0x3bf5('0x4f')](_0x411e39);}})[_0x3bf5('0x22')](function(_0x5d89af){if(_0x5d89af){return _0x5d89af?{'count':_0x5ea53a,'rows':_0x5d89af}:null;}})[_0x3bf5('0x22')](respondWithResult(_0x205e9a,null))[_0x3bf5('0x43')](handleError(_0x205e9a,null));};exports[_0x3bf5('0x50')]=function(_0x51a55e,_0x47fb42,_0x2b9366){var _0x5a421b={};var _0x37e5cb={};var _0x5a27c8;var _0x296793;return db[_0x3bf5('0x2a')][_0x3bf5('0x4c')]({'where':{'id':_0x51a55e['params']['id']}})[_0x3bf5('0x22')](handleEntityNotFound(_0x47fb42,null))[_0x3bf5('0x22')](function(_0x4e49bc){if(_0x4e49bc){_0x5a27c8=_0x4e49bc;_0x37e5cb[_0x3bf5('0x33')]=_[_0x3bf5('0x30')](db[_0x3bf5('0x4d')][_0x3bf5('0x2b')]);_0x37e5cb['query']=_['keys'](_0x51a55e['query']);_0x37e5cb[_0x3bf5('0x3b')]=_[_0x3bf5('0x32')](_0x37e5cb['model'],_0x37e5cb[_0x3bf5('0x31')]);_0x5a421b['attributes']=_[_0x3bf5('0x32')](_0x37e5cb[_0x3bf5('0x33')],qs[_0x3bf5('0x34')](_0x51a55e[_0x3bf5('0x31')][_0x3bf5('0x34')]));_0x5a421b['attributes']=_0x5a421b[_0x3bf5('0x35')][_0x3bf5('0x46')]?_0x5a421b['attributes']:_0x37e5cb[_0x3bf5('0x33')];_0x5a421b[_0x3bf5('0x37')]=qs[_0x3bf5('0x38')](_0x51a55e[_0x3bf5('0x31')][_0x3bf5('0x38')]);_0x5a421b[_0x3bf5('0x39')]=qs[_0x3bf5('0x3b')](_[_0x3bf5('0x3a')](_0x51a55e[_0x3bf5('0x31')],_0x37e5cb['filters']));if(_0x51a55e['query'][_0x3bf5('0x3c')]){_0x5a421b[_0x3bf5('0x39')]=_[_0x3bf5('0x3e')](_0x5a421b[_0x3bf5('0x39')],{'$or':_[_0x3bf5('0x2f')](_0x5a421b['attributes'],function(_0x3509f2){var _0x2f7d2b={};_0x2f7d2b[_0x3509f2]={'$like':'%'+_0x51a55e[_0x3bf5('0x31')][_0x3bf5('0x3c')]+'%'};return _0x2f7d2b;})});}_0x5a421b=_[_0x3bf5('0x3e')]({},_0x5a421b,_0x51a55e[_0x3bf5('0x3f')]);return _0x5a27c8[_0x3bf5('0x50')](_0x5a421b);}})[_0x3bf5('0x22')](function(_0x38a0c3){if(_0x38a0c3){_0x296793=_0x38a0c3[_0x3bf5('0x46')];if(!_0x51a55e[_0x3bf5('0x31')]['hasOwnProperty'](_0x3bf5('0x4e'))){_0x5a421b['limit']=qs['limit'](_0x51a55e[_0x3bf5('0x31')][_0x3bf5('0x1d')]);_0x5a421b['offset']=qs[_0x3bf5('0x1b')](_0x51a55e[_0x3bf5('0x31')][_0x3bf5('0x1b')]);}return _0x5a27c8[_0x3bf5('0x50')](_0x5a421b);}})[_0x3bf5('0x22')](function(_0x351661){if(_0x351661){return _0x351661?{'count':_0x296793,'rows':_0x351661}:null;}})[_0x3bf5('0x22')](respondWithResult(_0x47fb42,null))[_0x3bf5('0x43')](handleError(_0x47fb42,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 705da47..58475a3 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 _0x1195=['lodash','../../config/logger','moment','bluebird','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1195,0x156));var _0x5119=function(_0x3b2244,_0x54873f){_0x3b2244=_0x3b2244-0x0;var _0x2dcc14=_0x1195[_0x3b2244];return _0x2dcc14;};'use strict';var _=require(_0x5119('0x0'));var util=require('util');var logger=require(_0x5119('0x1'))('api');var moment=require(_0x5119('0x2'));var BPromise=require(_0x5119('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5119('0x4'));var attributes=require(_0x5119('0x5'));module['exports']=function(_0x3e3ae0,_0x2eb869){return _0x3e3ae0[_0x5119('0x6')](_0x5119('0x7'),attributes,{'tableName':_0x5119('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6eba=['moment','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x44a905,_0x134b44){var _0x5e8292=function(_0x695b17){while(--_0x695b17){_0x44a905['push'](_0x44a905['shift']());}};_0x5e8292(++_0x134b44);}(_0x6eba,0x6a));var _0xa6eb=function(_0x36f30c,_0x54a8b2){_0x36f30c=_0x36f30c-0x0;var _0x554716=_0x6eba[_0x36f30c];return _0x554716;};'use strict';var _=require(_0xa6eb('0x0'));var util=require(_0xa6eb('0x1'));var logger=require(_0xa6eb('0x2'))(_0xa6eb('0x3'));var moment=require(_0xa6eb('0x4'));var BPromise=require('bluebird');var rp=require(_0xa6eb('0x5'));var fs=require('fs');var path=require(_0xa6eb('0x6'));var rimraf=require(_0xa6eb('0x7'));var config=require(_0xa6eb('0x8'));var attributes=require(_0xa6eb('0x9'));module['exports']=function(_0x25fea1,_0x8baaa8){return _0x25fea1['define']('ZohoConfiguration',attributes,{'tableName':_0xa6eb('0xa'),'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 1eeafa0..43aad94 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 _0xd631=['request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0xd631,0x12e));var _0x1d63=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xd631[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x1d63('0x0'));var util=require('util');var moment=require(_0x1d63('0x1'));var BPromise=require(_0x1d63('0x2'));var rs=require(_0x1d63('0x3'));var fs=require('fs');var Redis=require(_0x1d63('0x4'));var db=require(_0x1d63('0x5'))['db'];var utils=require(_0x1d63('0x6'));var logger=require('../../config/logger')(_0x1d63('0x7'));var config=require('../../config/environment');var jayson=require(_0x1d63('0x8'));var client=jayson[_0x1d63('0x9')][_0x1d63('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x155c8b,_0x42a8e5,_0x247ccf){return new BPromise(function(_0x4f0fe6,_0x3b0105){return client[_0x1d63('0xb')](_0x155c8b,_0x247ccf)[_0x1d63('0xc')](function(_0x253093){logger[_0x1d63('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x42a8e5,'request\x20sent');logger['debug'](_0x1d63('0xe'),_0x42a8e5,'request\x20sent',JSON[_0x1d63('0xf')](_0x253093));if(_0x253093[_0x1d63('0x10')]){if(_0x253093[_0x1d63('0x10')][_0x1d63('0x11')]===0x1f4){logger[_0x1d63('0x10')](_0x1d63('0x12'),_0x42a8e5,_0x253093['error'][_0x1d63('0x13')]);return _0x3b0105(_0x253093[_0x1d63('0x10')][_0x1d63('0x13')]);}logger[_0x1d63('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x42a8e5,_0x253093[_0x1d63('0x10')][_0x1d63('0x13')]);return _0x4f0fe6(_0x253093[_0x1d63('0x10')][_0x1d63('0x13')]);}else{logger['info'](_0x1d63('0x12'),_0x42a8e5,_0x1d63('0x14'));_0x4f0fe6(_0x253093[_0x1d63('0x15')][_0x1d63('0x13')]);}})[_0x1d63('0x16')](function(_0x1fc6e1){logger['error'](_0x1d63('0x12'),_0x42a8e5,_0x1fc6e1);_0x3b0105(_0x1fc6e1);});});} \ No newline at end of file +var _0x46a9=['client','http','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1478c1,_0x377fc7){var _0x2fa2e2=function(_0x2823c4){while(--_0x2823c4){_0x1478c1['push'](_0x1478c1['shift']());}};_0x2fa2e2(++_0x377fc7);}(_0x46a9,0x1af));var _0x946a=function(_0x582ef9,_0x154ea1){_0x582ef9=_0x582ef9-0x0;var _0x8d14fb=_0x46a9[_0x582ef9];return _0x8d14fb;};'use strict';var _=require('lodash');var util=require(_0x946a('0x0'));var moment=require(_0x946a('0x1'));var BPromise=require(_0x946a('0x2'));var rs=require(_0x946a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x946a('0x4'))['db'];var utils=require(_0x946a('0x5'));var logger=require(_0x946a('0x6'))(_0x946a('0x7'));var config=require(_0x946a('0x8'));var jayson=require(_0x946a('0x9'));var client=jayson[_0x946a('0xa')][_0x946a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e2625,_0x8331c0,_0x2f9489){return new BPromise(function(_0x2284e3,_0x293b8c){return client['request'](_0x1e2625,_0x2f9489)['then'](function(_0x413502){logger[_0x946a('0xc')](_0x946a('0xd'),_0x8331c0,_0x946a('0xe'));logger['debug'](_0x946a('0xf'),_0x8331c0,_0x946a('0xe'),JSON[_0x946a('0x10')](_0x413502));if(_0x413502['error']){if(_0x413502[_0x946a('0x11')]['code']===0x1f4){logger[_0x946a('0x11')](_0x946a('0xd'),_0x8331c0,_0x413502['error'][_0x946a('0x12')]);return _0x293b8c(_0x413502['error']['message']);}logger[_0x946a('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x8331c0,_0x413502['error'][_0x946a('0x12')]);return _0x2284e3(_0x413502[_0x946a('0x11')][_0x946a('0x12')]);}else{logger['info'](_0x946a('0xd'),_0x8331c0,'request\x20sent');_0x2284e3(_0x413502[_0x946a('0x13')]['message']);}})[_0x946a('0x14')](function(_0x413e06){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x8331c0,_0x413e06);_0x293b8c(_0x413e06);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 72ed8d2..6500ff4 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 _0x796e=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','/:id','show','post','isAuthenticated','create'];(function(_0x3b90a8,_0x15cc69){var _0x2611d4=function(_0x1e809b){while(--_0x1e809b){_0x3b90a8['push'](_0x3b90a8['shift']());}};_0x2611d4(++_0x15cc69);}(_0x796e,0x144));var _0xe796=function(_0x112035,_0x6531bf){_0x112035=_0x112035-0x0;var _0x3d1e1d=_0x796e[_0x112035];return _0x3d1e1d;};'use strict';var multer=require(_0xe796('0x0'));var util=require(_0xe796('0x1'));var path=require(_0xe796('0x2'));var timeout=require(_0xe796('0x3'));var express=require(_0xe796('0x4'));var router=express['Router']();var fs_extra=require(_0xe796('0x5'));var auth=require(_0xe796('0x6'));var interaction=require(_0xe796('0x7'));var config=require(_0xe796('0x8'));var controller=require(_0xe796('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe796('0xa')](_0xe796('0xb'),auth['isAuthenticated'](),controller[_0xe796('0xc')]);router[_0xe796('0xd')]('/',auth[_0xe796('0xe')](),controller[_0xe796('0xf')]);router['put'](_0xe796('0xb'),auth[_0xe796('0xe')](),controller[_0xe796('0x10')]);router[_0xe796('0x11')](_0xe796('0xb'),auth[_0xe796('0xe')](),controller[_0xe796('0x12')]);module[_0xe796('0x13')]=router; \ No newline at end of file +var _0x64e1=['get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','./intZohoField.controller'];(function(_0x286e51,_0x25ba9d){var _0x5cf65b=function(_0x47ce9c){while(--_0x47ce9c){_0x286e51['push'](_0x286e51['shift']());}};_0x5cf65b(++_0x25ba9d);}(_0x64e1,0x9a));var _0x164e=function(_0x5e9c5c,_0x30c837){_0x5e9c5c=_0x5e9c5c-0x0;var _0x323ea5=_0x64e1[_0x5e9c5c];return _0x323ea5;};'use strict';var multer=require(_0x164e('0x0'));var util=require(_0x164e('0x1'));var path=require(_0x164e('0x2'));var timeout=require(_0x164e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x164e('0x4'));var config=require('../../config/environment');var controller=require(_0x164e('0x5'));router[_0x164e('0x6')]('/',auth[_0x164e('0x7')](),controller[_0x164e('0x8')]);router[_0x164e('0x6')](_0x164e('0x9'),auth[_0x164e('0x7')](),controller[_0x164e('0xa')]);router[_0x164e('0xb')]('/',auth[_0x164e('0x7')](),controller[_0x164e('0xc')]);router['put'](_0x164e('0x9'),auth[_0x164e('0x7')](),controller['update']);router[_0x164e('0xd')](_0x164e('0x9'),auth[_0x164e('0x7')](),controller[_0x164e('0xe')]);module[_0x164e('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 3f82406..aa54ad2 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 _0x0a64=['sequelize','exports','string','variable','keyValue','picklist','STRING','ENUM','BOOLEAN'];(function(_0x1221b7,_0x442cb7){var _0x2ed2fc=function(_0x4c166e){while(--_0x4c166e){_0x1221b7['push'](_0x1221b7['shift']());}};_0x2ed2fc(++_0x442cb7);}(_0x0a64,0xea));var _0x40a6=function(_0x2a3688,_0x3923aa){_0x2a3688=_0x2a3688-0x0;var _0x255227=_0x0a64[_0x2a3688];return _0x255227;};'use strict';var Sequelize=require(_0x40a6('0x0'));module[_0x40a6('0x1')]={'type':{'type':Sequelize['ENUM'](_0x40a6('0x2'),_0x40a6('0x3'),'customVariable',_0x40a6('0x4'),_0x40a6('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x40a6('0x6')]},'keyType':{'type':Sequelize[_0x40a6('0x7')](_0x40a6('0x2'),_0x40a6('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x40a6('0x6')]},'idField':{'type':Sequelize[_0x40a6('0x6')]},'nameField':{'type':Sequelize[_0x40a6('0x6')]},'customField':{'type':Sequelize[_0x40a6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x57bc=['sequelize','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0x4ff16c,_0x40dbff){var _0x54c9df=function(_0xb24a16){while(--_0xb24a16){_0x4ff16c['push'](_0x4ff16c['shift']());}};_0x54c9df(++_0x40dbff);}(_0x57bc,0x1b0));var _0xc57b=function(_0x35b997,_0x59981e){_0x35b997=_0x35b997-0x0;var _0x11d0d5=_0x57bc[_0x35b997];return _0x11d0d5;};'use strict';var Sequelize=require(_0xc57b('0x0'));module['exports']={'type':{'type':Sequelize[_0xc57b('0x1')](_0xc57b('0x2'),_0xc57b('0x3'),'customVariable',_0xc57b('0x4'),_0xc57b('0x5')),'defaultValue':_0xc57b('0x2')},'content':{'type':Sequelize[_0xc57b('0x6')]},'key':{'type':Sequelize[_0xc57b('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xc57b('0x2'),_0xc57b('0x3'),_0xc57b('0x7'))},'keyContent':{'type':Sequelize[_0xc57b('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc57b('0x6')]},'customField':{'type':Sequelize[_0xc57b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc57b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index edcf4a0..9a2759f 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 _0x62c0=['find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','ZohoField','rawAttributes','type','key','query','keys','filters','intersection','fields','attributes','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','length'];(function(_0x2b77fe,_0x2a2dad){var _0x1b0a60=function(_0x547712){while(--_0x547712){_0x2b77fe['push'](_0x2b77fe['shift']());}};_0x1b0a60(++_0x2a2dad);}(_0x62c0,0xdb));var _0x062c=function(_0x334d1e,_0x28a488){_0x334d1e=_0x334d1e-0x0;var _0x3b33ba=_0x62c0[_0x334d1e];return _0x3b33ba;};'use strict';var emlformat=require(_0x062c('0x0'));var rimraf=require(_0x062c('0x1'));var zipdir=require(_0x062c('0x2'));var jsonpatch=require(_0x062c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x062c('0x4'));var util=require('util');var path=require(_0x062c('0x5'));var sox=require(_0x062c('0x6'));var csv=require(_0x062c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x062c('0x8'));var _=require(_0x062c('0x9'));var squel=require('squel');var crypto=require(_0x062c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x062c('0xb'));var toCsv=require(_0x062c('0x7'));var querystring=require(_0x062c('0xc'));var Papa=require(_0x062c('0xd'));var Redis=require(_0x062c('0xe'));var authService=require(_0x062c('0xf'));var qs=require(_0x062c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x062c('0x11'));var logger=require(_0x062c('0x12'))(_0x062c('0x13'));var utils=require(_0x062c('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x062c('0x15'))['db'];function respondWithStatusCode(_0x19473b,_0x291f9e){_0x291f9e=_0x291f9e||0xcc;return function(_0x590977){if(_0x590977){return _0x19473b[_0x062c('0x16')](_0x291f9e);}return _0x19473b['status'](_0x291f9e)[_0x062c('0x17')]();};}function respondWithResult(_0x1b9a50,_0x3d72bc){_0x3d72bc=_0x3d72bc||0xc8;return function(_0x163a1d){if(_0x163a1d){return _0x1b9a50[_0x062c('0x18')](_0x3d72bc)[_0x062c('0x19')](_0x163a1d);}};}function respondWithFilteredResult(_0x5aa09f,_0x264e92){return function(_0x26f419){if(_0x26f419){var _0x4b9c53=typeof _0x264e92['offset']===_0x062c('0x1a')&&typeof _0x264e92[_0x062c('0x1b')]===_0x062c('0x1a');var _0x663ea3=_0x26f419[_0x062c('0x1c')];var _0x1640fe=_0x4b9c53?0x0:_0x264e92[_0x062c('0x1d')];var _0x3652c4=_0x4b9c53?_0x26f419[_0x062c('0x1c')]:_0x264e92[_0x062c('0x1d')]+_0x264e92['limit'];var _0x4d6bad;if(_0x3652c4>=_0x663ea3){_0x3652c4=_0x663ea3;_0x4d6bad=0xc8;}else{_0x4d6bad=0xce;}_0x5aa09f[_0x062c('0x18')](_0x4d6bad);return _0x5aa09f['set'](_0x062c('0x1e'),_0x1640fe+'-'+_0x3652c4+'/'+_0x663ea3)[_0x062c('0x19')](_0x26f419);}return null;};}function patchUpdates(_0x7a0dce){return function(_0x5061bf){try{jsonpatch['apply'](_0x5061bf,_0x7a0dce,!![]);}catch(_0xc50c9d){return BPromise[_0x062c('0x1f')](_0xc50c9d);}return _0x5061bf['save']();};}function saveUpdates(_0xd992e2,_0x286938){return function(_0x230040){if(_0x230040){return _0x230040[_0x062c('0x20')](_0xd992e2)['then'](function(_0x17c200){return _0x17c200;});}return null;};}function removeEntity(_0x4178e2,_0x1ea375){return function(_0x3b7b89){if(_0x3b7b89){return _0x3b7b89[_0x062c('0x21')]()[_0x062c('0x22')](function(){_0x4178e2['status'](0xcc)[_0x062c('0x17')]();});}};}function handleEntityNotFound(_0xc71f0b,_0x2edc23){return function(_0x574afa){if(!_0x574afa){_0xc71f0b[_0x062c('0x16')](0x194);}return _0x574afa;};}function handleError(_0x120f40,_0x4e208c){_0x4e208c=_0x4e208c||0x1f4;return function(_0x4518b1){logger[_0x062c('0x23')](_0x4518b1[_0x062c('0x24')]);if(_0x4518b1['name']){delete _0x4518b1[_0x062c('0x25')];}_0x120f40['status'](_0x4e208c)[_0x062c('0x26')](_0x4518b1);};}exports[_0x062c('0x27')]=function(_0xa36b16,_0x537b08){var _0x4a648e={},_0x337551={},_0x3caadf={'count':0x0,'rows':[]};var _0x4f504d=_[_0x062c('0x28')](db[_0x062c('0x29')][_0x062c('0x2a')],function(_0x3dbae7){return{'name':_0x3dbae7['fieldName'],'type':_0x3dbae7[_0x062c('0x2b')][_0x062c('0x2c')]};});_0x337551['model']=_[_0x062c('0x28')](_0x4f504d,'name');_0x337551[_0x062c('0x2d')]=_[_0x062c('0x2e')](_0xa36b16[_0x062c('0x2d')]);_0x337551[_0x062c('0x2f')]=_[_0x062c('0x30')](_0x337551['model'],_0x337551[_0x062c('0x2d')]);_0x4a648e['attributes']=_[_0x062c('0x30')](_0x337551['model'],qs[_0x062c('0x31')](_0xa36b16[_0x062c('0x2d')][_0x062c('0x31')]));_0x4a648e[_0x062c('0x32')]=_0x4a648e[_0x062c('0x32')]['length']?_0x4a648e[_0x062c('0x32')]:_0x337551[_0x062c('0x33')];if(!_0xa36b16['query'][_0x062c('0x34')](_0x062c('0x35'))){_0x4a648e['limit']=qs['limit'](_0xa36b16['query'][_0x062c('0x1b')]);_0x4a648e['offset']=qs[_0x062c('0x1d')](_0xa36b16['query']['offset']);}_0x4a648e[_0x062c('0x36')]=qs[_0x062c('0x37')](_0xa36b16[_0x062c('0x2d')][_0x062c('0x37')]);_0x4a648e[_0x062c('0x38')]=qs[_0x062c('0x2f')](_[_0x062c('0x39')](_0xa36b16[_0x062c('0x2d')],_0x337551[_0x062c('0x2f')]),_0x4f504d);if(_0xa36b16[_0x062c('0x2d')]['filter']){_0x4a648e[_0x062c('0x38')]=_[_0x062c('0x3a')](_0x4a648e['where'],{'$or':_[_0x062c('0x28')](_0x4f504d,function(_0x4ef105){if(_0x4ef105['type']!=='VIRTUAL'){var _0x3c45fa={};_0x3c45fa[_0x4ef105[_0x062c('0x25')]]={'$like':'%'+_0xa36b16[_0x062c('0x2d')][_0x062c('0x3b')]+'%'};return _0x3c45fa;}})});}_0x4a648e=_[_0x062c('0x3a')]({},_0x4a648e,_0xa36b16[_0x062c('0x3c')]);var _0x41feb8={'where':_0x4a648e[_0x062c('0x38')]};return db[_0x062c('0x29')]['count'](_0x41feb8)[_0x062c('0x22')](function(_0x359d94){_0x3caadf[_0x062c('0x1c')]=_0x359d94;if(_0xa36b16['query'][_0x062c('0x3d')]){_0x4a648e[_0x062c('0x3e')]=[{'all':!![]}];}return db[_0x062c('0x29')][_0x062c('0x3f')](_0x4a648e);})['then'](function(_0x3d966d){_0x3caadf[_0x062c('0x40')]=_0x3d966d;return _0x3caadf;})[_0x062c('0x22')](respondWithFilteredResult(_0x537b08,_0x4a648e))[_0x062c('0x41')](handleError(_0x537b08,null));};exports[_0x062c('0x42')]=function(_0x7dc1a8,_0x359a97){var _0x1b50b8={'raw':!![],'where':{'id':_0x7dc1a8[_0x062c('0x43')]['id']}},_0x580651={};_0x580651['model']=_['keys'](db[_0x062c('0x29')]['rawAttributes']);_0x580651['query']=_[_0x062c('0x2e')](_0x7dc1a8[_0x062c('0x2d')]);_0x580651['filters']=_[_0x062c('0x30')](_0x580651[_0x062c('0x33')],_0x580651[_0x062c('0x2d')]);_0x1b50b8[_0x062c('0x32')]=_['intersection'](_0x580651[_0x062c('0x33')],qs[_0x062c('0x31')](_0x7dc1a8[_0x062c('0x2d')][_0x062c('0x31')]));_0x1b50b8[_0x062c('0x32')]=_0x1b50b8['attributes'][_0x062c('0x44')]?_0x1b50b8[_0x062c('0x32')]:_0x580651[_0x062c('0x33')];if(_0x7dc1a8[_0x062c('0x2d')]['includeAll']){_0x1b50b8['include']=[{'all':!![]}];}_0x1b50b8=_[_0x062c('0x3a')]({},_0x1b50b8,_0x7dc1a8[_0x062c('0x3c')]);return db[_0x062c('0x29')][_0x062c('0x45')](_0x1b50b8)[_0x062c('0x22')](handleEntityNotFound(_0x359a97,null))['then'](respondWithResult(_0x359a97,null))[_0x062c('0x41')](handleError(_0x359a97,null));};exports[_0x062c('0x46')]=function(_0x17dbc4,_0x235731){return db['ZohoField'][_0x062c('0x46')](_0x17dbc4['body'],{})[_0x062c('0x22')](respondWithResult(_0x235731,0xc9))['catch'](handleError(_0x235731,null));};exports[_0x062c('0x20')]=function(_0xc92386,_0x18d86f){if(_0xc92386[_0x062c('0x47')]['id']){delete _0xc92386['body']['id'];}return db[_0x062c('0x29')]['find']({'where':{'id':_0xc92386[_0x062c('0x43')]['id']}})[_0x062c('0x22')](handleEntityNotFound(_0x18d86f,null))['then'](saveUpdates(_0xc92386['body'],null))[_0x062c('0x22')](respondWithResult(_0x18d86f,null))[_0x062c('0x41')](handleError(_0x18d86f,null));};exports[_0x062c('0x21')]=function(_0x28bbb4,_0x2a32f8){return db[_0x062c('0x29')]['find']({'where':{'id':_0x28bbb4[_0x062c('0x43')]['id']}})[_0x062c('0x22')](handleEntityNotFound(_0x2a32f8,null))[_0x062c('0x22')](removeEntity(_0x2a32f8,null))[_0x062c('0x41')](handleError(_0x2a32f8,null));}; \ No newline at end of file +var _0x6018=['where','pick','merge','count','include','findAll','rows','params','rawAttributes','filters','includeAll','options','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','json','limit','undefined','offset','status','set','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','ZohoField','type','key','keys','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x16d7af,_0x485d45){var _0x4697cf=function(_0x173039){while(--_0x173039){_0x16d7af['push'](_0x16d7af['shift']());}};_0x4697cf(++_0x485d45);}(_0x6018,0x1cc));var _0x8601=function(_0x2cdbef,_0x837a3b){_0x2cdbef=_0x2cdbef-0x0;var _0x1ba576=_0x6018[_0x2cdbef];return _0x1ba576;};'use strict';var emlformat=require(_0x8601('0x0'));var rimraf=require(_0x8601('0x1'));var zipdir=require(_0x8601('0x2'));var jsonpatch=require(_0x8601('0x3'));var rp=require(_0x8601('0x4'));var moment=require(_0x8601('0x5'));var BPromise=require(_0x8601('0x6'));var Mustache=require(_0x8601('0x7'));var util=require(_0x8601('0x8'));var path=require('path');var sox=require(_0x8601('0x9'));var csv=require(_0x8601('0xa'));var ejs=require(_0x8601('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8601('0xc'));var squel=require(_0x8601('0xd'));var crypto=require(_0x8601('0xe'));var jsforce=require(_0x8601('0xf'));var deskjs=require(_0x8601('0x10'));var toCsv=require(_0x8601('0xa'));var querystring=require(_0x8601('0x11'));var Papa=require('papaparse');var Redis=require(_0x8601('0x12'));var authService=require(_0x8601('0x13'));var qs=require(_0x8601('0x14'));var as=require(_0x8601('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8601('0x16'))(_0x8601('0x17'));var utils=require('../../config/utils');var config=require(_0x8601('0x18'));var licenseUtil=require(_0x8601('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x346186,_0xe7ba77){_0xe7ba77=_0xe7ba77||0xcc;return function(_0x2d0a40){if(_0x2d0a40){return _0x346186[_0x8601('0x1a')](_0xe7ba77);}return _0x346186['status'](_0xe7ba77)['end']();};}function respondWithResult(_0x56b204,_0x35e94b){_0x35e94b=_0x35e94b||0xc8;return function(_0x5aba59){if(_0x5aba59){return _0x56b204['status'](_0x35e94b)[_0x8601('0x1b')](_0x5aba59);}};}function respondWithFilteredResult(_0x308cc1,_0x2f5f0e){return function(_0x1f2a8c){if(_0x1f2a8c){var _0x3276c4=typeof _0x2f5f0e['offset']==='undefined'&&typeof _0x2f5f0e[_0x8601('0x1c')]===_0x8601('0x1d');var _0x4ed486=_0x1f2a8c['count'];var _0x5dabb3=_0x3276c4?0x0:_0x2f5f0e['offset'];var _0x36f0aa=_0x3276c4?_0x1f2a8c['count']:_0x2f5f0e[_0x8601('0x1e')]+_0x2f5f0e[_0x8601('0x1c')];var _0x2729b5;if(_0x36f0aa>=_0x4ed486){_0x36f0aa=_0x4ed486;_0x2729b5=0xc8;}else{_0x2729b5=0xce;}_0x308cc1[_0x8601('0x1f')](_0x2729b5);return _0x308cc1[_0x8601('0x20')]('Content-Range',_0x5dabb3+'-'+_0x36f0aa+'/'+_0x4ed486)[_0x8601('0x1b')](_0x1f2a8c);}return null;};}function patchUpdates(_0x7a76e0){return function(_0x11bcc4){try{jsonpatch[_0x8601('0x21')](_0x11bcc4,_0x7a76e0,!![]);}catch(_0x1bae72){return BPromise[_0x8601('0x22')](_0x1bae72);}return _0x11bcc4[_0x8601('0x23')]();};}function saveUpdates(_0x19d0e3,_0x463475){return function(_0x427dc0){if(_0x427dc0){return _0x427dc0[_0x8601('0x24')](_0x19d0e3)[_0x8601('0x25')](function(_0x316fbb){return _0x316fbb;});}return null;};}function removeEntity(_0x23b416,_0x3f614f){return function(_0x32648d){if(_0x32648d){return _0x32648d[_0x8601('0x26')]()[_0x8601('0x25')](function(){_0x23b416[_0x8601('0x1f')](0xcc)[_0x8601('0x27')]();});}};}function handleEntityNotFound(_0x44ebea,_0x1a3fe0){return function(_0x36909b){if(!_0x36909b){_0x44ebea[_0x8601('0x1a')](0x194);}return _0x36909b;};}function handleError(_0x31c062,_0x5f5533){_0x5f5533=_0x5f5533||0x1f4;return function(_0x469be5){logger['error'](_0x469be5[_0x8601('0x28')]);if(_0x469be5[_0x8601('0x29')]){delete _0x469be5[_0x8601('0x29')];}_0x31c062[_0x8601('0x1f')](_0x5f5533)[_0x8601('0x2a')](_0x469be5);};}exports[_0x8601('0x2b')]=function(_0x580e19,_0x197867){var _0x4029f9={},_0x5a12b2={},_0x4f272b={'count':0x0,'rows':[]};var _0x26c2e7=_[_0x8601('0x2c')](db[_0x8601('0x2d')]['rawAttributes'],function(_0x16b512){return{'name':_0x16b512['fieldName'],'type':_0x16b512[_0x8601('0x2e')][_0x8601('0x2f')]};});_0x5a12b2['model']=_[_0x8601('0x2c')](_0x26c2e7,'name');_0x5a12b2['query']=_[_0x8601('0x30')](_0x580e19['query']);_0x5a12b2['filters']=_[_0x8601('0x31')](_0x5a12b2['model'],_0x5a12b2[_0x8601('0x32')]);_0x4029f9[_0x8601('0x33')]=_[_0x8601('0x31')](_0x5a12b2[_0x8601('0x34')],qs[_0x8601('0x35')](_0x580e19['query']['fields']));_0x4029f9['attributes']=_0x4029f9[_0x8601('0x33')][_0x8601('0x36')]?_0x4029f9[_0x8601('0x33')]:_0x5a12b2[_0x8601('0x34')];if(!_0x580e19[_0x8601('0x32')][_0x8601('0x37')](_0x8601('0x38'))){_0x4029f9[_0x8601('0x1c')]=qs[_0x8601('0x1c')](_0x580e19[_0x8601('0x32')]['limit']);_0x4029f9[_0x8601('0x1e')]=qs['offset'](_0x580e19['query'][_0x8601('0x1e')]);}_0x4029f9['order']=qs['sort'](_0x580e19[_0x8601('0x32')][_0x8601('0x39')]);_0x4029f9[_0x8601('0x3a')]=qs['filters'](_[_0x8601('0x3b')](_0x580e19[_0x8601('0x32')],_0x5a12b2['filters']),_0x26c2e7);if(_0x580e19['query']['filter']){_0x4029f9['where']=_[_0x8601('0x3c')](_0x4029f9['where'],{'$or':_[_0x8601('0x2c')](_0x26c2e7,function(_0x592551){if(_0x592551[_0x8601('0x2e')]!=='VIRTUAL'){var _0x121d0f={};_0x121d0f[_0x592551['name']]={'$like':'%'+_0x580e19['query']['filter']+'%'};return _0x121d0f;}})});}_0x4029f9=_[_0x8601('0x3c')]({},_0x4029f9,_0x580e19['options']);var _0x405a9f={'where':_0x4029f9['where']};return db['ZohoField'][_0x8601('0x3d')](_0x405a9f)[_0x8601('0x25')](function(_0x2225cf){_0x4f272b[_0x8601('0x3d')]=_0x2225cf;if(_0x580e19['query']['includeAll']){_0x4029f9[_0x8601('0x3e')]=[{'all':!![]}];}return db['ZohoField'][_0x8601('0x3f')](_0x4029f9);})[_0x8601('0x25')](function(_0x19619b){_0x4f272b[_0x8601('0x40')]=_0x19619b;return _0x4f272b;})[_0x8601('0x25')](respondWithFilteredResult(_0x197867,_0x4029f9))['catch'](handleError(_0x197867,null));};exports['show']=function(_0x5df72d,_0x8efd96){var _0xa93afb={'raw':!![],'where':{'id':_0x5df72d[_0x8601('0x41')]['id']}},_0xe3d51={};_0xe3d51[_0x8601('0x34')]=_[_0x8601('0x30')](db['ZohoField'][_0x8601('0x42')]);_0xe3d51['query']=_[_0x8601('0x30')](_0x5df72d['query']);_0xe3d51[_0x8601('0x43')]=_[_0x8601('0x31')](_0xe3d51['model'],_0xe3d51[_0x8601('0x32')]);_0xa93afb[_0x8601('0x33')]=_['intersection'](_0xe3d51['model'],qs[_0x8601('0x35')](_0x5df72d[_0x8601('0x32')]['fields']));_0xa93afb['attributes']=_0xa93afb[_0x8601('0x33')][_0x8601('0x36')]?_0xa93afb[_0x8601('0x33')]:_0xe3d51['model'];if(_0x5df72d[_0x8601('0x32')][_0x8601('0x44')]){_0xa93afb[_0x8601('0x3e')]=[{'all':!![]}];}_0xa93afb=_['merge']({},_0xa93afb,_0x5df72d[_0x8601('0x45')]);return db['ZohoField']['find'](_0xa93afb)[_0x8601('0x25')](handleEntityNotFound(_0x8efd96,null))[_0x8601('0x25')](respondWithResult(_0x8efd96,null))[_0x8601('0x46')](handleError(_0x8efd96,null));};exports[_0x8601('0x47')]=function(_0x4751db,_0x3d5b49){return db[_0x8601('0x2d')][_0x8601('0x47')](_0x4751db['body'],{})[_0x8601('0x25')](respondWithResult(_0x3d5b49,0xc9))[_0x8601('0x46')](handleError(_0x3d5b49,null));};exports[_0x8601('0x24')]=function(_0x2ca114,_0x4b882d){if(_0x2ca114[_0x8601('0x48')]['id']){delete _0x2ca114[_0x8601('0x48')]['id'];}return db[_0x8601('0x2d')][_0x8601('0x49')]({'where':{'id':_0x2ca114[_0x8601('0x41')]['id']}})[_0x8601('0x25')](handleEntityNotFound(_0x4b882d,null))[_0x8601('0x25')](saveUpdates(_0x2ca114[_0x8601('0x48')],null))['then'](respondWithResult(_0x4b882d,null))[_0x8601('0x46')](handleError(_0x4b882d,null));};exports[_0x8601('0x26')]=function(_0x89a6c7,_0x4110fa){return db[_0x8601('0x2d')][_0x8601('0x49')]({'where':{'id':_0x89a6c7[_0x8601('0x41')]['id']}})[_0x8601('0x25')](handleEntityNotFound(_0x4110fa,null))['then'](removeEntity(_0x4110fa,null))['catch'](handleError(_0x4110fa,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index eec339a..ab9a8f3 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 _0x6455=['moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','FieldId','lodash','../../config/logger','api'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x6455,0x97));var _0x5645=function(_0x2e9eea,_0x2c1259){_0x2e9eea=_0x2e9eea-0x0;var _0x11d834=_0x6455[_0x2e9eea];return _0x11d834;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var logger=require(_0x5645('0x1'))(_0x5645('0x2'));var moment=require(_0x5645('0x3'));var BPromise=require(_0x5645('0x4'));var rp=require(_0x5645('0x5'));var fs=require('fs');var path=require(_0x5645('0x6'));var rimraf=require('rimraf');var config=require(_0x5645('0x7'));var attributes=require(_0x5645('0x8'));module[_0x5645('0x9')]=function(_0x9400a8,_0x3a635d){return _0x9400a8[_0x5645('0xa')](_0x5645('0xb'),attributes,{'tableName':_0x5645('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x5645('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0424=['define','ZohoField','int_zoho_fields','FieldId','../../config/logger','api','moment','bluebird','path','./intZohoField.attributes','exports'];(function(_0x34cff6,_0x2cda92){var _0x2c8155=function(_0x325edb){while(--_0x325edb){_0x34cff6['push'](_0x34cff6['shift']());}};_0x2c8155(++_0x2cda92);}(_0x0424,0x159));var _0x4042=function(_0x252d7e,_0x20a71c){_0x252d7e=_0x252d7e-0x0;var _0x2afaba=_0x0424[_0x252d7e];return _0x2afaba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4042('0x0'))(_0x4042('0x1'));var moment=require(_0x4042('0x2'));var BPromise=require(_0x4042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4042('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4042('0x5'));module[_0x4042('0x6')]=function(_0x472795,_0xc0fba0){return _0x472795[_0x4042('0x7')](_0x4042('0x8'),attributes,{'tableName':_0x4042('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x4042('0xa')],'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 1fda5e5..7a18728 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 _0x8ecf=['then','info','debug','request\x20sent','stringify','error','code','message','ZohoField,\x20%s,\x20%s','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x523c89,_0x5ac86f){var _0x4e30a9=function(_0x48261b){while(--_0x48261b){_0x523c89['push'](_0x523c89['shift']());}};_0x4e30a9(++_0x5ac86f);}(_0x8ecf,0x16a));var _0xf8ec=function(_0x4b404a,_0x5d115c){_0x4b404a=_0x4b404a-0x0;var _0xdb3c4f=_0x8ecf[_0x4b404a];return _0xdb3c4f;};'use strict';var _=require(_0xf8ec('0x0'));var util=require('util');var moment=require(_0xf8ec('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf8ec('0x2'));var db=require(_0xf8ec('0x3'))['db'];var utils=require(_0xf8ec('0x4'));var logger=require(_0xf8ec('0x5'))(_0xf8ec('0x6'));var config=require(_0xf8ec('0x7'));var jayson=require(_0xf8ec('0x8'));var client=jayson[_0xf8ec('0x9')][_0xf8ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11aca2,_0x241aaa,_0xe9742e){return new BPromise(function(_0x55559b,_0x14832b){return client[_0xf8ec('0xb')](_0x11aca2,_0xe9742e)[_0xf8ec('0xc')](function(_0x4af2c6){logger[_0xf8ec('0xd')]('ZohoField,\x20%s,\x20%s',_0x241aaa,'request\x20sent');logger[_0xf8ec('0xe')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x241aaa,_0xf8ec('0xf'),JSON[_0xf8ec('0x10')](_0x4af2c6));if(_0x4af2c6[_0xf8ec('0x11')]){if(_0x4af2c6['error'][_0xf8ec('0x12')]===0x1f4){logger[_0xf8ec('0x11')]('ZohoField,\x20%s,\x20%s',_0x241aaa,_0x4af2c6[_0xf8ec('0x11')][_0xf8ec('0x13')]);return _0x14832b(_0x4af2c6['error'][_0xf8ec('0x13')]);}logger['error'](_0xf8ec('0x14'),_0x241aaa,_0x4af2c6['error']['message']);return _0x55559b(_0x4af2c6[_0xf8ec('0x11')][_0xf8ec('0x13')]);}else{logger[_0xf8ec('0xd')](_0xf8ec('0x14'),_0x241aaa,'request\x20sent');_0x55559b(_0x4af2c6[_0xf8ec('0x15')][_0xf8ec('0x13')]);}})['catch'](function(_0x1bc047){logger['error'](_0xf8ec('0x14'),_0x241aaa,_0x1bc047);_0x14832b(_0x1bc047);});});} \ No newline at end of file +var _0xd1aa=['request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xd1aa,0x1af));var _0xad1a=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0xd1aa[_0x33154d];return _0x3b2f03;};'use strict';var _=require(_0xad1a('0x0'));var util=require(_0xad1a('0x1'));var moment=require(_0xad1a('0x2'));var BPromise=require(_0xad1a('0x3'));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(_0xad1a('0x4'))(_0xad1a('0x5'));var config=require(_0xad1a('0x6'));var jayson=require(_0xad1a('0x7'));var client=jayson['client'][_0xad1a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x547e92,_0x516a2e,_0x3cfbfa){return new BPromise(function(_0x497b5e,_0x17ce76){return client[_0xad1a('0x9')](_0x547e92,_0x3cfbfa)[_0xad1a('0xa')](function(_0x31880b){logger['info'](_0xad1a('0xb'),_0x516a2e,_0xad1a('0xc'));logger[_0xad1a('0xd')](_0xad1a('0xe'),_0x516a2e,_0xad1a('0xc'),JSON[_0xad1a('0xf')](_0x31880b));if(_0x31880b[_0xad1a('0x10')]){if(_0x31880b[_0xad1a('0x10')][_0xad1a('0x11')]===0x1f4){logger['error'](_0xad1a('0xb'),_0x516a2e,_0x31880b['error'][_0xad1a('0x12')]);return _0x17ce76(_0x31880b['error'][_0xad1a('0x12')]);}logger[_0xad1a('0x10')](_0xad1a('0xb'),_0x516a2e,_0x31880b[_0xad1a('0x10')]['message']);return _0x497b5e(_0x31880b[_0xad1a('0x10')][_0xad1a('0x12')]);}else{logger[_0xad1a('0x13')](_0xad1a('0xb'),_0x516a2e,_0xad1a('0xc'));_0x497b5e(_0x31880b[_0xad1a('0x14')]['message']);}})[_0xad1a('0x15')](function(_0x4c115f){logger[_0xad1a('0x10')](_0xad1a('0xb'),_0x516a2e,_0x4c115f);_0x17ce76(_0x4c115f);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index c712de4..038b39c 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5bca8f,_0x1683d5){var _0x20fd20=function(_0x3aa967){while(--_0x3aa967){_0x5bca8f['push'](_0x5bca8f['shift']());}};_0x20fd20(++_0x1683d5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5022f1,_0x25f497){var _0x545b48=function(_0x5a64b3){while(--_0x5a64b3){_0x5022f1['push'](_0x5022f1['shift']());}};_0x545b48(++_0x25f497);}(_0x70e0,0x17b));var _0x070e=function(_0x30db75,_0x22bddd){_0x30db75=_0x30db75-0x0;var _0x28b887=_0x70e0[_0x30db75];return _0x28b887;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 563c714..9168b73 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 _0xf1c9=['BOOLEAN','sequelize','STRING','unique_name_and_version','INTEGER'];(function(_0x4bbc3a,_0x3a6945){var _0x579d56=function(_0x5977f6){while(--_0x5977f6){_0x4bbc3a['push'](_0x4bbc3a['shift']());}};_0x579d56(++_0x3a6945);}(_0xf1c9,0x12d));var _0x9f1c=function(_0x3a7d2b,_0x21df2d){_0x3a7d2b=_0x3a7d2b-0x0;var _0x4489d5=_0xf1c9[_0x3a7d2b];return _0x4489d5;};'use strict';var Sequelize=require(_0x9f1c('0x0'));module['exports']={'name':{'type':Sequelize[_0x9f1c('0x1')],'allowNull':![],'unique':_0x9f1c('0x2')},'version':{'type':Sequelize[_0x9f1c('0x1')],'allowNull':![],'unique':_0x9f1c('0x2')},'main':{'type':Sequelize[_0x9f1c('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x9f1c('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9f1c('0x1')]},'size':{'type':Sequelize[_0x9f1c('0x3')]},'active':{'type':Sequelize[_0x9f1c('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x9f1c('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x9f1c('0x1')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x9f1c('0x1')]},'remoteUri':{'type':Sequelize[_0x9f1c('0x1')]},'link':{'type':Sequelize[_0x9f1c('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x159b=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x5a6d3b,_0x15a93b){var _0x3aaf17=function(_0xc74bd7){while(--_0xc74bd7){_0x5a6d3b['push'](_0x5a6d3b['shift']());}};_0x3aaf17(++_0x15a93b);}(_0x159b,0x181));var _0xb159=function(_0x54a90e,_0x109563){_0x54a90e=_0x54a90e-0x0;var _0x4bf667=_0x159b[_0x54a90e];return _0x4bf667;};'use strict';var Sequelize=require(_0xb159('0x0'));module[_0xb159('0x1')]={'name':{'type':Sequelize[_0xb159('0x2')],'allowNull':![],'unique':_0xb159('0x3')},'version':{'type':Sequelize[_0xb159('0x2')],'allowNull':![],'unique':_0xb159('0x3')},'main':{'type':Sequelize[_0xb159('0x2')],'defaultValue':_0xb159('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xb159('0x2')]},'type':{'type':Sequelize[_0xb159('0x2')]},'size':{'type':Sequelize[_0xb159('0x5')]},'active':{'type':Sequelize[_0xb159('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xb159('0x2')]},'state':{'type':Sequelize[_0xb159('0x2')],'unique':_0xb159('0x7')},'description':{'type':Sequelize[_0xb159('0x2')]},'title':{'type':Sequelize[_0xb159('0x2')]},'remoteUri':{'type':Sequelize[_0xb159('0x2')]},'link':{'type':Sequelize[_0xb159('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index dcd00ac..f37a18e 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 _0x7a54=['offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','Integration','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x58273d,_0x596707){var _0x3dfc06=function(_0x29a23f){while(--_0x29a23f){_0x58273d['push'](_0x58273d['shift']());}};_0x3dfc06(++_0x596707);}(_0x7a54,0x106));var _0x47a5=function(_0x560893,_0x343e61){_0x560893=_0x560893-0x0;var _0x50e83b=_0x7a54[_0x560893];return _0x50e83b;};'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['Integration'][_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['Integration']['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['Integration']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));}; \ No newline at end of file +var _0x4975=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','Integration','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x1a12f9,_0x26e0bd){var _0x3f6024=function(_0x97c61f){while(--_0x97c61f){_0x1a12f9['push'](_0x1a12f9['shift']());}};_0x3f6024(++_0x26e0bd);}(_0x4975,0x86));var _0x5497=function(_0x4e9da5,_0x35b077){_0x4e9da5=_0x4e9da5-0x0;var _0x47a626=_0x4975[_0x4e9da5];return _0x47a626;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['Integration']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['Integration'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 4d1ceac..50c7a53 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 _0xa97a=['./integration.attributes','exports','integrations','lodash','api','bluebird','rimraf'];(function(_0x1dab5f,_0x10cd21){var _0x40c2f3=function(_0x325a0d){while(--_0x325a0d){_0x1dab5f['push'](_0x1dab5f['shift']());}};_0x40c2f3(++_0x10cd21);}(_0xa97a,0x1a7));var _0xaa97=function(_0x40eaf4,_0x54d2a9){_0x40eaf4=_0x40eaf4-0x0;var _0x3fde54=_0xa97a[_0x40eaf4];return _0x3fde54;};'use strict';var _=require(_0xaa97('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa97('0x1'));var moment=require('moment');var BPromise=require(_0xaa97('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaa97('0x3'));var config=require('../../config/environment');var attributes=require(_0xaa97('0x4'));module[_0xaa97('0x5')]=function(_0xd049be,_0x24747e){return _0xd049be['define']('Integration',attributes,{'tableName':_0xaa97('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa21e=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./integration.attributes','exports','define','integrations'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xa21e,0x1ec));var _0xea21=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0xa21e[_0x57d13b];return _0x467696;};'use strict';var _=require(_0xea21('0x0'));var util=require(_0xea21('0x1'));var logger=require(_0xea21('0x2'))(_0xea21('0x3'));var moment=require('moment');var BPromise=require(_0xea21('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea21('0x5'));var rimraf=require(_0xea21('0x6'));var config=require(_0xea21('0x7'));var attributes=require(_0xea21('0x8'));module[_0xea21('0x9')]=function(_0x44def0,_0x205bfc){return _0x44def0[_0xea21('0xa')]('Integration',attributes,{'tableName':_0xea21('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 7632cc0..28f41bb 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 _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Integration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x381a04,_0x5aa4a4){var _0x1c324f=function(_0x2c06e8){while(--_0x2c06e8){_0x381a04['push'](_0x381a04['shift']());}};_0x1c324f(++_0x5aa4a4);}(_0x14a0,0x8e));var _0x014a=function(_0x52dfe0,_0x48f562){_0x52dfe0=_0x52dfe0-0x0;var _0x4dbad0=_0x14a0[_0x52dfe0];return _0x4dbad0;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Integration,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Integration,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Integration,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','catch','lodash'];(function(_0x4c3350,_0x1be49){var _0x394d5d=function(_0x485e78){while(--_0x485e78){_0x4c3350['push'](_0x4c3350['shift']());}};_0x394d5d(++_0x1be49);}(_0x66fa,0x117));var _0xa66f=function(_0x345922,_0x12104d){_0x345922=_0x345922-0x0;var _0x4509c1=_0x66fa[_0x345922];return _0x4509c1;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Integration,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Integration,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index df15731..9a066ca 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 _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xdb28,0x106));var _0x8db2=function(_0x5dccd3,_0xe6bc07){_0x5dccd3=_0x5dccd3-0x0;var _0x5578c6=_0xdb28[_0x5dccd3];return _0x5578c6;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./integrationReport.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post']('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x11')]);router['delete'](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file +var _0xd943=['show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0xd943,0x15d));var _0x3d94=function(_0x5d010c,_0x143b93){_0x5d010c=_0x5d010c-0x0;var _0x5cf7d9=_0xd943[_0x5d010c];return _0x5cf7d9;};'use strict';var multer=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var path=require(_0x3d94('0x2'));var timeout=require(_0x3d94('0x3'));var express=require('express');var router=express[_0x3d94('0x4')]();var fs_extra=require(_0x3d94('0x5'));var auth=require(_0x3d94('0x6'));var interaction=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0x3d94('0x9')](),controller['index']);router['get']('/describe',auth[_0x3d94('0x9')](),controller[_0x3d94('0xa')]);router['get']('/:id',auth[_0x3d94('0x9')](),controller[_0x3d94('0xb')]);router[_0x3d94('0xc')]('/',auth['isAuthenticated'](),controller[_0x3d94('0xd')]);router['put'](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller['update']);router[_0x3d94('0xf')](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x10')]);module[_0x3d94('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 6f4d19b..2128c4e 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 _0xfa46=['ENUM','SENT','SENDING','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xfa46,0x13e));var _0x6fa4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xfa46[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x6fa4('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x6fa4('0x1')]},'exitStatus':{'type':Sequelize[_0x6fa4('0x1')]},'ticketId':{'type':Sequelize[_0x6fa4('0x1')]},'integrationId':{'type':Sequelize[_0x6fa4('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6fa4('0x1')]},'calleridnum':{'type':Sequelize[_0x6fa4('0x1')]},'calleridname':{'type':Sequelize[_0x6fa4('0x1')]},'queue':{'type':Sequelize[_0x6fa4('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6fa4('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x6fa4('0x3')]},'holdtime':{'type':Sequelize[_0x6fa4('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x6fa4('0x2')]},'agentacw':{'type':Sequelize[_0x6fa4('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x6fa4('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x6fa4('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x6fa4('0x1')]},'channel':{'type':Sequelize[_0x6fa4('0x1')]},'channelstate':{'type':Sequelize[_0x6fa4('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x6fa4('0x1')]},'connectedlinename':{'type':Sequelize[_0x6fa4('0x1')]},'language':{'type':Sequelize[_0x6fa4('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6fa4('0x1')]},'exten':{'type':Sequelize[_0x6fa4('0x1')]},'priority':{'type':Sequelize[_0x6fa4('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x6fa4('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x6fa4('0x1')]},'destcalleridnum':{'type':Sequelize[_0x6fa4('0x1')]},'destcalleridname':{'type':Sequelize[_0x6fa4('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x6fa4('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x6fa4('0x1')]},'destaccountcode':{'type':Sequelize[_0x6fa4('0x1')]},'destcontext':{'type':Sequelize[_0x6fa4('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6fa4('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x6fa4('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x6fa4('0x1')]},'from':{'type':Sequelize[_0x6fa4('0x1')]},'to':{'type':Sequelize[_0x6fa4('0x1')]},'cc':{'type':Sequelize[_0x6fa4('0x1')]},'attachment':{'type':Sequelize[_0x6fa4('0x5')]},'html':{'type':Sequelize[_0x6fa4('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x6fa4('0x6')](_0x6fa4('0x7'),_0x6fa4('0x8'),'RECEIVED','FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x6fa4('0x2')]}}; \ No newline at end of file +var _0xa68c=['FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING'];(function(_0x56ab38,_0x5666e3){var _0x2df5b8=function(_0x156026){while(--_0x156026){_0x56ab38['push'](_0x56ab38['shift']());}};_0x2df5b8(++_0x5666e3);}(_0xa68c,0x187));var _0xca68=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa68c[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0xca68('0x0'));module[_0xca68('0x1')]={'integration':{'type':Sequelize[_0xca68('0x2')]},'eventChannel':{'type':Sequelize[_0xca68('0x2')]},'exitStatus':{'type':Sequelize[_0xca68('0x2')]},'ticketId':{'type':Sequelize[_0xca68('0x2')]},'integrationId':{'type':Sequelize[_0xca68('0x3')]},'contacts':{'type':Sequelize[_0xca68('0x2')]},'uniqueid':{'type':Sequelize[_0xca68('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xca68('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xca68('0x2')]},'agentcalledAt':{'type':Sequelize[_0xca68('0x4')]},'agentconnectAt':{'type':Sequelize[_0xca68('0x4')]},'holdtime':{'type':Sequelize[_0xca68('0x3')]},'agentcomplete':{'type':Sequelize[_0xca68('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xca68('0x4')]},'talktime':{'type':Sequelize[_0xca68('0x3')]},'agentacw':{'type':Sequelize[_0xca68('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xca68('0x3')]},'reason':{'type':Sequelize[_0xca68('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xca68('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xca68('0x4')]},'agentdump':{'type':Sequelize[_0xca68('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xca68('0x2')]},'channelstate':{'type':Sequelize[_0xca68('0x3')]},'channelstatedesc':{'type':Sequelize[_0xca68('0x2')]},'connectedlinenum':{'type':Sequelize[_0xca68('0x2')]},'connectedlinename':{'type':Sequelize[_0xca68('0x2')]},'language':{'type':Sequelize[_0xca68('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xca68('0x2')]},'exten':{'type':Sequelize[_0xca68('0x2')]},'priority':{'type':Sequelize[_0xca68('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xca68('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xca68('0x2')]},'destcalleridname':{'type':Sequelize[_0xca68('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xca68('0x2')]},'destaccountcode':{'type':Sequelize[_0xca68('0x2')]},'destcontext':{'type':Sequelize[_0xca68('0x2')]},'destexten':{'type':Sequelize[_0xca68('0x2')]},'destpriority':{'type':Sequelize[_0xca68('0x2')]},'destuniqueid':{'type':Sequelize[_0xca68('0x2')]},'messageId':{'type':Sequelize[_0xca68('0x2')]},'inReplyTo':{'type':Sequelize[_0xca68('0x2')]},'subject':{'type':Sequelize[_0xca68('0x2')]},'from':{'type':Sequelize[_0xca68('0x2')]},'to':{'type':Sequelize[_0xca68('0x2')]},'cc':{'type':Sequelize[_0xca68('0x2')]},'attachment':{'type':Sequelize[_0xca68('0x6')]},'html':{'type':Sequelize[_0xca68('0x6')]},'text':{'type':Sequelize[_0xca68('0x6')]},'status':{'type':Sequelize[_0xca68('0x7')]('SENT',_0xca68('0x8'),'RECEIVED',_0xca68('0x9'))},'url':{'type':Sequelize[_0xca68('0x2')]},'app':{'type':Sequelize[_0xca68('0x2')]},'appdata':{'type':Sequelize['STRING']},'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 4c6aed5..749307e 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 _0xef8e=['merge','type','includeAll','include','rows','params','keys','options','find','catch','create','body','describe','eml-format','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','IntegrationReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x2d41fc,_0x125823){var _0x5bc70f=function(_0x27542b){while(--_0x27542b){_0x2d41fc['push'](_0x2d41fc['shift']());}};_0x5bc70f(++_0x125823);}(_0xef8e,0xa1));var _0xeef8=function(_0x56ad77,_0x5da489){_0x56ad77=_0x56ad77-0x0;var _0x2e2c2d=_0xef8e[_0x56ad77];return _0x2e2c2d;};'use strict';var emlformat=require(_0xeef8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeef8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeef8('0x2'));var BPromise=require(_0xeef8('0x3'));var Mustache=require('mustache');var util=require(_0xeef8('0x4'));var path=require('path');var sox=require(_0xeef8('0x5'));var csv=require(_0xeef8('0x6'));var ejs=require(_0xeef8('0x7'));var fs=require('fs');var fs_extra=require(_0xeef8('0x8'));var _=require(_0xeef8('0x9'));var squel=require(_0xeef8('0xa'));var crypto=require(_0xeef8('0xb'));var jsforce=require(_0xeef8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeef8('0x6'));var querystring=require('querystring');var Papa=require(_0xeef8('0xd'));var Redis=require(_0xeef8('0xe'));var authService=require(_0xeef8('0xf'));var qs=require(_0xeef8('0x10'));var as=require(_0xeef8('0x11'));var hardwareService=require(_0xeef8('0x12'));var logger=require(_0xeef8('0x13'))(_0xeef8('0x14'));var utils=require(_0xeef8('0x15'));var config=require(_0xeef8('0x16'));var licenseUtil=require(_0xeef8('0x17'));var db=require(_0xeef8('0x18'))['db'];function respondWithStatusCode(_0x1055d9,_0xda43c0){_0xda43c0=_0xda43c0||0xcc;return function(_0x2f4975){if(_0x2f4975){return _0x1055d9[_0xeef8('0x19')](_0xda43c0);}return _0x1055d9['status'](_0xda43c0)[_0xeef8('0x1a')]();};}function respondWithResult(_0x1d7b28,_0x4e7e3d){_0x4e7e3d=_0x4e7e3d||0xc8;return function(_0x1df64b){if(_0x1df64b){return _0x1d7b28[_0xeef8('0x1b')](_0x4e7e3d)[_0xeef8('0x1c')](_0x1df64b);}};}function respondWithFilteredResult(_0x5a11fe,_0x5cbe30){return function(_0x439cbf){if(_0x439cbf){var _0x16bed7=typeof _0x5cbe30['offset']===_0xeef8('0x1d')&&typeof _0x5cbe30[_0xeef8('0x1e')]===_0xeef8('0x1d');var _0x1a70cb=_0x439cbf[_0xeef8('0x1f')];var _0x1e19f4=_0x16bed7?0x0:_0x5cbe30[_0xeef8('0x20')];var _0x2ebfbd=_0x16bed7?_0x439cbf['count']:_0x5cbe30[_0xeef8('0x20')]+_0x5cbe30['limit'];var _0xd91b4;if(_0x2ebfbd>=_0x1a70cb){_0x2ebfbd=_0x1a70cb;_0xd91b4=0xc8;}else{_0xd91b4=0xce;}_0x5a11fe['status'](_0xd91b4);return _0x5a11fe[_0xeef8('0x21')](_0xeef8('0x22'),_0x1e19f4+'-'+_0x2ebfbd+'/'+_0x1a70cb)[_0xeef8('0x1c')](_0x439cbf);}return null;};}function patchUpdates(_0x4bc57d){return function(_0x1581e8){try{jsonpatch[_0xeef8('0x23')](_0x1581e8,_0x4bc57d,!![]);}catch(_0x292be3){return BPromise[_0xeef8('0x24')](_0x292be3);}return _0x1581e8['save']();};}function saveUpdates(_0xdb499a,_0xba3416){return function(_0x3c930f){if(_0x3c930f){return _0x3c930f[_0xeef8('0x25')](_0xdb499a)[_0xeef8('0x26')](function(_0x516b7c){return _0x516b7c;});}return null;};}function removeEntity(_0x3da3a1,_0x5ddd09){return function(_0x294bd3){if(_0x294bd3){return _0x294bd3[_0xeef8('0x27')]()[_0xeef8('0x26')](function(){_0x3da3a1[_0xeef8('0x1b')](0xcc)[_0xeef8('0x1a')]();});}};}function handleEntityNotFound(_0x9d4579,_0x46117d){return function(_0xb13af3){if(!_0xb13af3){_0x9d4579[_0xeef8('0x19')](0x194);}return _0xb13af3;};}function handleError(_0x1f88e3,_0x58a831){_0x58a831=_0x58a831||0x1f4;return function(_0x23a1f7){logger[_0xeef8('0x28')](_0x23a1f7['stack']);if(_0x23a1f7[_0xeef8('0x29')]){delete _0x23a1f7['name'];}_0x1f88e3[_0xeef8('0x1b')](_0x58a831)[_0xeef8('0x2a')](_0x23a1f7);};}exports['index']=function(_0x509006,_0x5ad6c7){var _0x3b4aef={},_0x4fd2a9={},_0xb02486={'count':0x0,'rows':[]};var _0x1e8611=_['map'](db[_0xeef8('0x2b')][_0xeef8('0x2c')],function(_0x56a4f2){return{'name':_0x56a4f2[_0xeef8('0x2d')],'type':_0x56a4f2['type'][_0xeef8('0x2e')]};});_0x4fd2a9[_0xeef8('0x2f')]=_[_0xeef8('0x30')](_0x1e8611,'name');_0x4fd2a9['query']=_['keys'](_0x509006[_0xeef8('0x31')]);_0x4fd2a9[_0xeef8('0x32')]=_[_0xeef8('0x33')](_0x4fd2a9[_0xeef8('0x2f')],_0x4fd2a9[_0xeef8('0x31')]);_0x3b4aef['attributes']=_['intersection'](_0x4fd2a9['model'],qs[_0xeef8('0x34')](_0x509006['query'][_0xeef8('0x34')]));_0x3b4aef[_0xeef8('0x35')]=_0x3b4aef[_0xeef8('0x35')][_0xeef8('0x36')]?_0x3b4aef[_0xeef8('0x35')]:_0x4fd2a9[_0xeef8('0x2f')];if(!_0x509006[_0xeef8('0x31')][_0xeef8('0x37')](_0xeef8('0x38'))){_0x3b4aef[_0xeef8('0x1e')]=qs[_0xeef8('0x1e')](_0x509006[_0xeef8('0x31')]['limit']);_0x3b4aef[_0xeef8('0x20')]=qs[_0xeef8('0x20')](_0x509006[_0xeef8('0x31')][_0xeef8('0x20')]);}_0x3b4aef[_0xeef8('0x39')]=qs[_0xeef8('0x3a')](_0x509006[_0xeef8('0x31')]['sort']);_0x3b4aef[_0xeef8('0x3b')]=qs[_0xeef8('0x32')](_['pick'](_0x509006[_0xeef8('0x31')],_0x4fd2a9['filters']),_0x1e8611);if(_0x509006[_0xeef8('0x31')][_0xeef8('0x3c')]){_0x3b4aef[_0xeef8('0x3b')]=_[_0xeef8('0x3d')](_0x3b4aef[_0xeef8('0x3b')],{'$or':_['map'](_0x1e8611,function(_0x496d5f){if(_0x496d5f[_0xeef8('0x3e')]!=='VIRTUAL'){var _0x21c0e7={};_0x21c0e7[_0x496d5f[_0xeef8('0x29')]]={'$like':'%'+_0x509006[_0xeef8('0x31')][_0xeef8('0x3c')]+'%'};return _0x21c0e7;}})});}_0x3b4aef=_[_0xeef8('0x3d')]({},_0x3b4aef,_0x509006['options']);var _0x4b2cf2={'where':_0x3b4aef['where']};return db[_0xeef8('0x2b')][_0xeef8('0x1f')](_0x4b2cf2)[_0xeef8('0x26')](function(_0x395edd){_0xb02486['count']=_0x395edd;if(_0x509006['query'][_0xeef8('0x3f')]){_0x3b4aef[_0xeef8('0x40')]=[{'all':!![]}];}return db[_0xeef8('0x2b')]['findAll'](_0x3b4aef);})[_0xeef8('0x26')](function(_0x2b120){_0xb02486[_0xeef8('0x41')]=_0x2b120;return _0xb02486;})[_0xeef8('0x26')](respondWithFilteredResult(_0x5ad6c7,_0x3b4aef))['catch'](handleError(_0x5ad6c7,null));};exports['show']=function(_0x204142,_0x32e6cb){var _0x981f7c={'raw':![],'where':{'id':_0x204142[_0xeef8('0x42')]['id']}},_0x2969bc={};_0x2969bc[_0xeef8('0x2f')]=_[_0xeef8('0x43')](db[_0xeef8('0x2b')][_0xeef8('0x2c')]);_0x2969bc[_0xeef8('0x31')]=_[_0xeef8('0x43')](_0x204142[_0xeef8('0x31')]);_0x2969bc[_0xeef8('0x32')]=_[_0xeef8('0x33')](_0x2969bc[_0xeef8('0x2f')],_0x2969bc['query']);_0x981f7c[_0xeef8('0x35')]=_[_0xeef8('0x33')](_0x2969bc['model'],qs[_0xeef8('0x34')](_0x204142[_0xeef8('0x31')][_0xeef8('0x34')]));_0x981f7c[_0xeef8('0x35')]=_0x981f7c[_0xeef8('0x35')][_0xeef8('0x36')]?_0x981f7c[_0xeef8('0x35')]:_0x2969bc['model'];if(_0x204142[_0xeef8('0x31')][_0xeef8('0x3f')]){_0x981f7c[_0xeef8('0x40')]=[{'all':!![]}];}_0x981f7c=_[_0xeef8('0x3d')]({},_0x981f7c,_0x204142[_0xeef8('0x44')]);return db['IntegrationReport'][_0xeef8('0x45')](_0x981f7c)[_0xeef8('0x26')](handleEntityNotFound(_0x32e6cb,null))[_0xeef8('0x26')](respondWithResult(_0x32e6cb,null))[_0xeef8('0x46')](handleError(_0x32e6cb,null));};exports['create']=function(_0x2952a8,_0x4a14fd){return db[_0xeef8('0x2b')][_0xeef8('0x47')](_0x2952a8[_0xeef8('0x48')],{})[_0xeef8('0x26')](respondWithResult(_0x4a14fd,0xc9))[_0xeef8('0x46')](handleError(_0x4a14fd,null));};exports[_0xeef8('0x25')]=function(_0x21afc3,_0x4fd1c0){if(_0x21afc3[_0xeef8('0x48')]['id']){delete _0x21afc3['body']['id'];}return db[_0xeef8('0x2b')][_0xeef8('0x45')]({'where':{'id':_0x21afc3[_0xeef8('0x42')]['id']}})[_0xeef8('0x26')](handleEntityNotFound(_0x4fd1c0,null))[_0xeef8('0x26')](saveUpdates(_0x21afc3['body'],null))['then'](respondWithResult(_0x4fd1c0,null))[_0xeef8('0x46')](handleError(_0x4fd1c0,null));};exports[_0xeef8('0x27')]=function(_0x42370c,_0xbe7f41){return db['IntegrationReport'][_0xeef8('0x45')]({'where':{'id':_0x42370c[_0xeef8('0x42')]['id']}})[_0xeef8('0x26')](handleEntityNotFound(_0xbe7f41,null))['then'](removeEntity(_0xbe7f41,null))[_0xeef8('0x46')](handleError(_0xbe7f41,null));};exports[_0xeef8('0x49')]=function(_0x568aca,_0x34bb17){return db[_0xeef8('0x2b')][_0xeef8('0x49')]()[_0xeef8('0x26')](respondWithResult(_0x34bb17,null))[_0xeef8('0x46')](handleError(_0x34bb17,null));}; \ No newline at end of file +var _0xb653=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','options','IntegrationReport','include','findAll','catch','params','includeAll','find','create','body','update','destroy','describe','rimraf','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','rawAttributes','fieldName','type','key','query','keys'];(function(_0xd7ecb1,_0x430db6){var _0x42e7d4=function(_0x5487a0){while(--_0x5487a0){_0xd7ecb1['push'](_0xd7ecb1['shift']());}};_0x42e7d4(++_0x430db6);}(_0xb653,0x134));var _0x3b65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb653[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b65('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b65('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3b65('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3b65('0x3'));var sox=require(_0x3b65('0x4'));var csv=require(_0x3b65('0x5'));var ejs=require(_0x3b65('0x6'));var fs=require('fs');var fs_extra=require(_0x3b65('0x7'));var _=require(_0x3b65('0x8'));var squel=require('squel');var crypto=require(_0x3b65('0x9'));var jsforce=require(_0x3b65('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3b65('0xb'));var Papa=require('papaparse');var Redis=require(_0x3b65('0xc'));var authService=require(_0x3b65('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x3b65('0xe'));var hardwareService=require(_0x3b65('0xf'));var logger=require(_0x3b65('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x3b65('0x11'));var licenseUtil=require(_0x3b65('0x12'));var db=require(_0x3b65('0x13'))['db'];function respondWithStatusCode(_0x564409,_0x5088dd){_0x5088dd=_0x5088dd||0xcc;return function(_0x422f04){if(_0x422f04){return _0x564409[_0x3b65('0x14')](_0x5088dd);}return _0x564409[_0x3b65('0x15')](_0x5088dd)[_0x3b65('0x16')]();};}function respondWithResult(_0x196739,_0x491ae7){_0x491ae7=_0x491ae7||0xc8;return function(_0x450189){if(_0x450189){return _0x196739[_0x3b65('0x15')](_0x491ae7)['json'](_0x450189);}};}function respondWithFilteredResult(_0x1b7faf,_0x2ee335){return function(_0x1f9f7e){if(_0x1f9f7e){var _0x1b13b4=typeof _0x2ee335['offset']==='undefined'&&typeof _0x2ee335['limit']==='undefined';var _0x514dc6=_0x1f9f7e[_0x3b65('0x17')];var _0x86f8f8=_0x1b13b4?0x0:_0x2ee335['offset'];var _0x2bbe0a=_0x1b13b4?_0x1f9f7e[_0x3b65('0x17')]:_0x2ee335[_0x3b65('0x18')]+_0x2ee335['limit'];var _0x1e17cb;if(_0x2bbe0a>=_0x514dc6){_0x2bbe0a=_0x514dc6;_0x1e17cb=0xc8;}else{_0x1e17cb=0xce;}_0x1b7faf['status'](_0x1e17cb);return _0x1b7faf[_0x3b65('0x19')](_0x3b65('0x1a'),_0x86f8f8+'-'+_0x2bbe0a+'/'+_0x514dc6)[_0x3b65('0x1b')](_0x1f9f7e);}return null;};}function patchUpdates(_0x42a41e){return function(_0x326173){try{jsonpatch[_0x3b65('0x1c')](_0x326173,_0x42a41e,!![]);}catch(_0x521992){return BPromise[_0x3b65('0x1d')](_0x521992);}return _0x326173[_0x3b65('0x1e')]();};}function saveUpdates(_0x519d5c,_0x529f5a){return function(_0x3a1844){if(_0x3a1844){return _0x3a1844['update'](_0x519d5c)[_0x3b65('0x1f')](function(_0x12bad6){return _0x12bad6;});}return null;};}function removeEntity(_0x5835a7,_0x4a2a68){return function(_0x57c167){if(_0x57c167){return _0x57c167['destroy']()['then'](function(){_0x5835a7[_0x3b65('0x15')](0xcc)[_0x3b65('0x16')]();});}};}function handleEntityNotFound(_0x2ebd12,_0x3d884f){return function(_0x2961d2){if(!_0x2961d2){_0x2ebd12['sendStatus'](0x194);}return _0x2961d2;};}function handleError(_0x2c20e2,_0x4c38c1){_0x4c38c1=_0x4c38c1||0x1f4;return function(_0xfc941f){logger[_0x3b65('0x20')](_0xfc941f[_0x3b65('0x21')]);if(_0xfc941f[_0x3b65('0x22')]){delete _0xfc941f[_0x3b65('0x22')];}_0x2c20e2['status'](_0x4c38c1)[_0x3b65('0x23')](_0xfc941f);};}exports['index']=function(_0x177023,_0x3dad21){var _0x217784={},_0x36f4ae={},_0x96e272={'count':0x0,'rows':[]};var _0x4fe421=_['map'](db['IntegrationReport'][_0x3b65('0x24')],function(_0x23db1d){return{'name':_0x23db1d[_0x3b65('0x25')],'type':_0x23db1d[_0x3b65('0x26')][_0x3b65('0x27')]};});_0x36f4ae['model']=_['map'](_0x4fe421,_0x3b65('0x22'));_0x36f4ae[_0x3b65('0x28')]=_[_0x3b65('0x29')](_0x177023[_0x3b65('0x28')]);_0x36f4ae['filters']=_[_0x3b65('0x2a')](_0x36f4ae[_0x3b65('0x2b')],_0x36f4ae[_0x3b65('0x28')]);_0x217784[_0x3b65('0x2c')]=_[_0x3b65('0x2a')](_0x36f4ae['model'],qs[_0x3b65('0x2d')](_0x177023['query'][_0x3b65('0x2d')]));_0x217784[_0x3b65('0x2c')]=_0x217784['attributes'][_0x3b65('0x2e')]?_0x217784['attributes']:_0x36f4ae['model'];if(!_0x177023[_0x3b65('0x28')][_0x3b65('0x2f')](_0x3b65('0x30'))){_0x217784[_0x3b65('0x31')]=qs[_0x3b65('0x31')](_0x177023['query'][_0x3b65('0x31')]);_0x217784[_0x3b65('0x18')]=qs[_0x3b65('0x18')](_0x177023[_0x3b65('0x28')]['offset']);}_0x217784[_0x3b65('0x32')]=qs[_0x3b65('0x33')](_0x177023[_0x3b65('0x28')][_0x3b65('0x33')]);_0x217784['where']=qs[_0x3b65('0x34')](_[_0x3b65('0x35')](_0x177023[_0x3b65('0x28')],_0x36f4ae[_0x3b65('0x34')]),_0x4fe421);if(_0x177023[_0x3b65('0x28')][_0x3b65('0x36')]){_0x217784[_0x3b65('0x37')]=_[_0x3b65('0x38')](_0x217784['where'],{'$or':_['map'](_0x4fe421,function(_0x3b0d0a){if(_0x3b0d0a[_0x3b65('0x26')]!=='VIRTUAL'){var _0x496fdf={};_0x496fdf[_0x3b0d0a[_0x3b65('0x22')]]={'$like':'%'+_0x177023['query'][_0x3b65('0x36')]+'%'};return _0x496fdf;}})});}_0x217784=_[_0x3b65('0x38')]({},_0x217784,_0x177023[_0x3b65('0x39')]);var _0x2d0124={'where':_0x217784[_0x3b65('0x37')]};return db[_0x3b65('0x3a')][_0x3b65('0x17')](_0x2d0124)[_0x3b65('0x1f')](function(_0x11c4e6){_0x96e272['count']=_0x11c4e6;if(_0x177023[_0x3b65('0x28')]['includeAll']){_0x217784[_0x3b65('0x3b')]=[{'all':!![]}];}return db[_0x3b65('0x3a')][_0x3b65('0x3c')](_0x217784);})[_0x3b65('0x1f')](function(_0x3054c4){_0x96e272['rows']=_0x3054c4;return _0x96e272;})['then'](respondWithFilteredResult(_0x3dad21,_0x217784))[_0x3b65('0x3d')](handleError(_0x3dad21,null));};exports['show']=function(_0x1264e3,_0x5994db){var _0x56168f={'raw':![],'where':{'id':_0x1264e3[_0x3b65('0x3e')]['id']}},_0x2d17c9={};_0x2d17c9['model']=_[_0x3b65('0x29')](db[_0x3b65('0x3a')]['rawAttributes']);_0x2d17c9[_0x3b65('0x28')]=_['keys'](_0x1264e3[_0x3b65('0x28')]);_0x2d17c9[_0x3b65('0x34')]=_[_0x3b65('0x2a')](_0x2d17c9[_0x3b65('0x2b')],_0x2d17c9['query']);_0x56168f[_0x3b65('0x2c')]=_[_0x3b65('0x2a')](_0x2d17c9[_0x3b65('0x2b')],qs[_0x3b65('0x2d')](_0x1264e3[_0x3b65('0x28')]['fields']));_0x56168f['attributes']=_0x56168f[_0x3b65('0x2c')]['length']?_0x56168f[_0x3b65('0x2c')]:_0x2d17c9[_0x3b65('0x2b')];if(_0x1264e3[_0x3b65('0x28')][_0x3b65('0x3f')]){_0x56168f[_0x3b65('0x3b')]=[{'all':!![]}];}_0x56168f=_[_0x3b65('0x38')]({},_0x56168f,_0x1264e3[_0x3b65('0x39')]);return db[_0x3b65('0x3a')][_0x3b65('0x40')](_0x56168f)[_0x3b65('0x1f')](handleEntityNotFound(_0x5994db,null))[_0x3b65('0x1f')](respondWithResult(_0x5994db,null))[_0x3b65('0x3d')](handleError(_0x5994db,null));};exports[_0x3b65('0x41')]=function(_0x45d2de,_0x21a042){return db[_0x3b65('0x3a')][_0x3b65('0x41')](_0x45d2de[_0x3b65('0x42')],{})[_0x3b65('0x1f')](respondWithResult(_0x21a042,0xc9))[_0x3b65('0x3d')](handleError(_0x21a042,null));};exports[_0x3b65('0x43')]=function(_0x2199a4,_0x17db70){if(_0x2199a4[_0x3b65('0x42')]['id']){delete _0x2199a4[_0x3b65('0x42')]['id'];}return db[_0x3b65('0x3a')][_0x3b65('0x40')]({'where':{'id':_0x2199a4[_0x3b65('0x3e')]['id']}})[_0x3b65('0x1f')](handleEntityNotFound(_0x17db70,null))[_0x3b65('0x1f')](saveUpdates(_0x2199a4[_0x3b65('0x42')],null))[_0x3b65('0x1f')](respondWithResult(_0x17db70,null))[_0x3b65('0x3d')](handleError(_0x17db70,null));};exports[_0x3b65('0x44')]=function(_0x2e63ec,_0x4e0b6a){return db[_0x3b65('0x3a')][_0x3b65('0x40')]({'where':{'id':_0x2e63ec[_0x3b65('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4e0b6a,null))[_0x3b65('0x1f')](removeEntity(_0x4e0b6a,null))[_0x3b65('0x3d')](handleError(_0x4e0b6a,null));};exports[_0x3b65('0x45')]=function(_0xe4b7cc,_0x641549){return db[_0x3b65('0x3a')]['describe']()['then'](respondWithResult(_0x641549,null))[_0x3b65('0x3d')](handleError(_0x641549,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index d1a034f..f084adb 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 _0x0e91=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash'];(function(_0x209706,_0x4d398e){var _0x4e1ff0=function(_0x56a2d3){while(--_0x56a2d3){_0x209706['push'](_0x209706['shift']());}};_0x4e1ff0(++_0x4d398e);}(_0x0e91,0x16b));var _0x10e9=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x0e91[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x10e9('0x0'));var util=require(_0x10e9('0x1'));var logger=require(_0x10e9('0x2'))(_0x10e9('0x3'));var moment=require(_0x10e9('0x4'));var BPromise=require(_0x10e9('0x5'));var rp=require(_0x10e9('0x6'));var fs=require('fs');var path=require(_0x10e9('0x7'));var rimraf=require('rimraf');var config=require(_0x10e9('0x8'));var attributes=require(_0x10e9('0x9'));module[_0x10e9('0xa')]=function(_0x35ced3,_0x1cee9d){return _0x35ced3[_0x10e9('0xb')](_0x10e9('0xc'),attributes,{'tableName':_0x10e9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x324e=['exports','define','IntegrationReport','report_integration','api','moment','bluebird','request-promise','path','rimraf','./integrationReport.attributes'];(function(_0x5ab27f,_0x21a462){var _0x23826c=function(_0x4292ac){while(--_0x4292ac){_0x5ab27f['push'](_0x5ab27f['shift']());}};_0x23826c(++_0x21a462);}(_0x324e,0xd5));var _0xe324=function(_0x58503e,_0xe16afc){_0x58503e=_0x58503e-0x0;var _0x4fdffa=_0x324e[_0x58503e];return _0x4fdffa;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe324('0x0'));var moment=require(_0xe324('0x1'));var BPromise=require(_0xe324('0x2'));var rp=require(_0xe324('0x3'));var fs=require('fs');var path=require(_0xe324('0x4'));var rimraf=require(_0xe324('0x5'));var config=require('../../config/environment');var attributes=require(_0xe324('0x6'));module[_0xe324('0x7')]=function(_0x41d2e9,_0xdad4c9){return _0x41d2e9[_0xe324('0x8')](_0xe324('0x9'),attributes,{'tableName':_0xe324('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 baaa141..45080d4 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2512be,_0x2715eb){var _0x323f42=function(_0x12a1dd){while(--_0x12a1dd){_0x2512be['push'](_0x2512be['shift']());}};_0x323f42(++_0x2715eb);}(_0x5fab,0x177));var _0xb5fa=function(_0x514bd1,_0x25ea3e){_0x514bd1=_0x514bd1-0x0;var _0x58a281=_0x5fab[_0x514bd1];return _0x58a281;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0xef4ef0,_0x3c72f9){var _0x39b60b=function(_0x1d824c){while(--_0x1d824c){_0xef4ef0['push'](_0xef4ef0['shift']());}};_0x39b60b(++_0x3c72f9);}(_0x4137,0xf8));var _0x7413=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4137[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 69b0775..460490a 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 _0x31af=['isAuthenticated','index','get','/:id','show','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x31af,0xde));var _0xf31a=function(_0x4d5df7,_0x344c88){_0x4d5df7=_0x4d5df7-0x0;var _0x19e24c=_0x31af[_0x4d5df7];return _0x19e24c;};'use strict';var multer=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var path=require(_0xf31a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf31a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf31a('0x4'));var interaction=require(_0xf31a('0x5'));var config=require(_0xf31a('0x6'));var controller=require(_0xf31a('0x7'));router['get']('/',auth[_0xf31a('0x8')](),controller[_0xf31a('0x9')]);router[_0xf31a('0xa')](_0xf31a('0xb'),auth['isAuthenticated'](),controller[_0xf31a('0xc')]);router[_0xf31a('0xa')](_0xf31a('0xd'),auth[_0xf31a('0x8')](),controller['getIntervals']);router[_0xf31a('0xe')]('/',auth[_0xf31a('0x8')](),controller[_0xf31a('0xf')]);router[_0xf31a('0xe')](_0xf31a('0xd'),auth['isAuthenticated'](),controller[_0xf31a('0x10')]);router[_0xf31a('0xe')](_0xf31a('0x11'),auth[_0xf31a('0x8')](),controller['addIntervals']);router[_0xf31a('0x12')](_0xf31a('0xb'),auth['isAuthenticated'](),controller[_0xf31a('0x13')]);router[_0xf31a('0x14')](_0xf31a('0xb'),auth[_0xf31a('0x8')](),controller[_0xf31a('0x15')]);module[_0xf31a('0x16')]=router; \ No newline at end of file +var _0x544f=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','getIntervals','post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','destroy','util','connect-timeout','express','Router'];(function(_0x3f713a,_0x32b533){var _0x1222ae=function(_0x3b4c80){while(--_0x3b4c80){_0x3f713a['push'](_0x3f713a['shift']());}};_0x1222ae(++_0x32b533);}(_0x544f,0x104));var _0xf544=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0x544f[_0x271060];return _0x40540b;};'use strict';var multer=require('multer');var util=require(_0xf544('0x0'));var path=require('path');var timeout=require(_0xf544('0x1'));var express=require(_0xf544('0x2'));var router=express[_0xf544('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf544('0x4'));var interaction=require(_0xf544('0x5'));var config=require(_0xf544('0x6'));var controller=require('./interval.controller');router[_0xf544('0x7')]('/',auth[_0xf544('0x8')](),controller['index']);router['get']('/:id',auth[_0xf544('0x8')](),controller[_0xf544('0x9')]);router[_0xf544('0x7')]('/:id/sub_intervals',auth[_0xf544('0x8')](),controller[_0xf544('0xa')]);router[_0xf544('0xb')]('/',auth[_0xf544('0x8')](),controller[_0xf544('0xc')]);router[_0xf544('0xb')](_0xf544('0xd'),auth[_0xf544('0x8')](),controller[_0xf544('0xe')]);router[_0xf544('0xb')](_0xf544('0xf'),auth[_0xf544('0x8')](),controller[_0xf544('0x10')]);router[_0xf544('0x11')](_0xf544('0x12'),auth[_0xf544('0x8')](),controller[_0xf544('0x13')]);router[_0xf544('0x14')](_0xf544('0x12'),auth[_0xf544('0x8')](),controller[_0xf544('0x15')]);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 0f03c69..baef36e 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 _0xc58a=['exports','STRING'];(function(_0x1e37f5,_0x5972bf){var _0x3c274e=function(_0x9034ee){while(--_0x9034ee){_0x1e37f5['push'](_0x1e37f5['shift']());}};_0x3c274e(++_0x5972bf);}(_0xc58a,0xa4));var _0xac58=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0xc58a[_0x39c734];return _0xb2a2f9;};'use strict';var Sequelize=require('sequelize');module[_0xac58('0x0')]={'name':{'type':Sequelize[_0xac58('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xac58('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xc342=['STRING','sequelize'];(function(_0x3e437d,_0x4aa837){var _0x578bd0=function(_0x10a810){while(--_0x10a810){_0x3e437d['push'](_0x3e437d['shift']());}};_0x578bd0(++_0x4aa837);}(_0xc342,0x1e7));var _0x2c34=function(_0x2e4a0f,_0x3a9bb6){_0x2e4a0f=_0x2e4a0f-0x0;var _0x25a3cd=_0xc342[_0x2e4a0f];return _0x25a3cd;};'use strict';var Sequelize=require(_0x2c34('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c34('0x1')]},'description':{'type':Sequelize[_0x2c34('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index caa7574..7de3f38 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 _0xc7bb=['lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','destroy','then','Intervals','error','stack','name','send','index','map','Interval','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','rawAttributes','length','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addInterval','IntervalId','getIntervals','findOne','pick','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0xc7bb,0x1da));var _0xbc7b=function(_0x3762b5,_0x3b9072){_0x3762b5=_0x3762b5-0x0;var _0x13b859=_0xc7bb[_0x3762b5];return _0x13b859;};'use strict';var emlformat=require(_0xbc7b('0x0'));var rimraf=require(_0xbc7b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc7b('0x2'));var rp=require(_0xbc7b('0x3'));var moment=require(_0xbc7b('0x4'));var BPromise=require(_0xbc7b('0x5'));var Mustache=require(_0xbc7b('0x6'));var util=require('util');var path=require('path');var sox=require(_0xbc7b('0x7'));var csv=require(_0xbc7b('0x8'));var ejs=require(_0xbc7b('0x9'));var fs=require('fs');var fs_extra=require(_0xbc7b('0xa'));var _=require(_0xbc7b('0xb'));var squel=require('squel');var crypto=require(_0xbc7b('0xc'));var jsforce=require(_0xbc7b('0xd'));var deskjs=require(_0xbc7b('0xe'));var toCsv=require(_0xbc7b('0x8'));var querystring=require(_0xbc7b('0xf'));var Papa=require(_0xbc7b('0x10'));var Redis=require(_0xbc7b('0x11'));var authService=require(_0xbc7b('0x12'));var qs=require(_0xbc7b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc7b('0x14'));var logger=require(_0xbc7b('0x15'))(_0xbc7b('0x16'));var utils=require('../../config/utils');var config=require(_0xbc7b('0x17'));var licenseUtil=require(_0xbc7b('0x18'));var db=require(_0xbc7b('0x19'))['db'];var extensions=require(_0xbc7b('0x1a'));function respondWithStatusCode(_0x15b57e,_0x4751d2){_0x4751d2=_0x4751d2||0xcc;return function(_0x3391fa){if(_0x3391fa){return _0x15b57e[_0xbc7b('0x1b')](_0x4751d2);}return _0x15b57e[_0xbc7b('0x1c')](_0x4751d2)['end']();};}function respondWithResult(_0x7e8427,_0xa36f02){_0xa36f02=_0xa36f02||0xc8;return function(_0x5cb1e9){if(_0x5cb1e9){return _0x7e8427[_0xbc7b('0x1c')](_0xa36f02)['json'](_0x5cb1e9);}};}function respondWithFilteredResult(_0x10bd93,_0x52a13f){return function(_0x5e34fa){if(_0x5e34fa){var _0x9bcf07=typeof _0x52a13f[_0xbc7b('0x1d')]===_0xbc7b('0x1e')&&typeof _0x52a13f['limit']==='undefined';var _0x3ad1dc=_0x5e34fa[_0xbc7b('0x1f')];var _0xa4181a=_0x9bcf07?0x0:_0x52a13f[_0xbc7b('0x1d')];var _0x530960=_0x9bcf07?_0x5e34fa[_0xbc7b('0x1f')]:_0x52a13f[_0xbc7b('0x1d')]+_0x52a13f['limit'];var _0x476ff9;if(_0x530960>=_0x3ad1dc){_0x530960=_0x3ad1dc;_0x476ff9=0xc8;}else{_0x476ff9=0xce;}_0x10bd93['status'](_0x476ff9);return _0x10bd93[_0xbc7b('0x20')](_0xbc7b('0x21'),_0xa4181a+'-'+_0x530960+'/'+_0x3ad1dc)[_0xbc7b('0x22')](_0x5e34fa);}return null;};}function patchUpdates(_0x637f6d){return function(_0x4aa67e){try{jsonpatch[_0xbc7b('0x23')](_0x4aa67e,_0x637f6d,!![]);}catch(_0x340843){return BPromise[_0xbc7b('0x24')](_0x340843);}return _0x4aa67e[_0xbc7b('0x25')]();};}function saveUpdates(_0x944314,_0x2cf165){return function(_0x9ee7bc){if(_0x9ee7bc){return _0x9ee7bc['update'](_0x944314)['then'](function(_0x2ea597){return _0x2ea597;});}return null;};}function removeEntity(_0x2a63c8,_0x1247d2){return function(_0x3b6a8e){if(_0x3b6a8e){return _0x3b6a8e[_0xbc7b('0x26')]()[_0xbc7b('0x27')](function(){var _0xad361b=_0x3b6a8e['get']({'plain':!![]});var _0x32f645=_0xbc7b('0x28');return db['UserProfileResource'][_0xbc7b('0x26')]({'where':{'type':_0x32f645,'resourceId':_0xad361b['id']}})['then'](function(){return _0x3b6a8e;});})[_0xbc7b('0x27')](function(){_0x2a63c8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x571a87,_0x49cafc){return function(_0x524831){if(!_0x524831){_0x571a87[_0xbc7b('0x1b')](0x194);}return _0x524831;};}function handleError(_0x1bba7b,_0x33b31c){_0x33b31c=_0x33b31c||0x1f4;return function(_0x34456f){logger[_0xbc7b('0x29')](_0x34456f[_0xbc7b('0x2a')]);if(_0x34456f[_0xbc7b('0x2b')]){delete _0x34456f[_0xbc7b('0x2b')];}_0x1bba7b[_0xbc7b('0x1c')](_0x33b31c)[_0xbc7b('0x2c')](_0x34456f);};}exports[_0xbc7b('0x2d')]=function(_0x4add1f,_0x159980){var _0x5c4f28={},_0x5ac630={},_0x1af549={'count':0x0,'rows':[]};var _0x36f836=_[_0xbc7b('0x2e')](db[_0xbc7b('0x2f')]['rawAttributes'],function(_0x1efb84){return{'name':_0x1efb84[_0xbc7b('0x30')],'type':_0x1efb84[_0xbc7b('0x31')][_0xbc7b('0x32')]};});_0x5ac630[_0xbc7b('0x33')]=_['map'](_0x36f836,_0xbc7b('0x2b'));_0x5ac630[_0xbc7b('0x34')]=_[_0xbc7b('0x35')](_0x4add1f[_0xbc7b('0x34')]);_0x5ac630['filters']=_[_0xbc7b('0x36')](_0x5ac630[_0xbc7b('0x33')],_0x5ac630[_0xbc7b('0x34')]);_0x5c4f28[_0xbc7b('0x37')]=_['intersection'](_0x5ac630[_0xbc7b('0x33')],qs[_0xbc7b('0x38')](_0x4add1f[_0xbc7b('0x34')][_0xbc7b('0x38')]));_0x5c4f28['attributes']=_0x5c4f28['attributes']['length']?_0x5c4f28['attributes']:_0x5ac630[_0xbc7b('0x33')];if(!_0x4add1f[_0xbc7b('0x34')][_0xbc7b('0x39')](_0xbc7b('0x3a'))){_0x5c4f28['limit']=qs[_0xbc7b('0x3b')](_0x4add1f[_0xbc7b('0x34')][_0xbc7b('0x3b')]);_0x5c4f28['offset']=qs['offset'](_0x4add1f[_0xbc7b('0x34')]['offset']);}_0x5c4f28[_0xbc7b('0x3c')]=qs[_0xbc7b('0x3d')](_0x4add1f[_0xbc7b('0x34')]['sort']);_0x5c4f28[_0xbc7b('0x3e')]=qs[_0xbc7b('0x3f')](_['pick'](_0x4add1f[_0xbc7b('0x34')],_0x5ac630[_0xbc7b('0x3f')]),_0x36f836);if(_0x4add1f[_0xbc7b('0x34')][_0xbc7b('0x40')]){_0x5c4f28[_0xbc7b('0x3e')]=_[_0xbc7b('0x41')](_0x5c4f28[_0xbc7b('0x3e')],{'$or':_['map'](_0x36f836,function(_0x5da865){if(_0x5da865['type']!==_0xbc7b('0x42')){var _0x5ad56c={};_0x5ad56c[_0x5da865['name']]={'$like':'%'+_0x4add1f[_0xbc7b('0x34')]['filter']+'%'};return _0x5ad56c;}})});}_0x5c4f28=_[_0xbc7b('0x41')]({},_0x5c4f28,_0x4add1f['options']);var _0x1add28={'where':_0x5c4f28[_0xbc7b('0x3e')]};return db[_0xbc7b('0x2f')][_0xbc7b('0x1f')](_0x1add28)[_0xbc7b('0x27')](function(_0x19d2a4){_0x1af549[_0xbc7b('0x1f')]=_0x19d2a4;if(_0x4add1f[_0xbc7b('0x34')]['includeAll']){_0x5c4f28[_0xbc7b('0x43')]=[{'all':!![]}];}return db[_0xbc7b('0x2f')][_0xbc7b('0x44')](_0x5c4f28);})[_0xbc7b('0x27')](function(_0x5e6a74){_0x1af549[_0xbc7b('0x45')]=_0x5e6a74;return _0x1af549;})[_0xbc7b('0x27')](respondWithFilteredResult(_0x159980,_0x5c4f28))[_0xbc7b('0x46')](handleError(_0x159980,null));};exports['show']=function(_0x2cceaa,_0x1dadb2){var _0x1e7331={'raw':!![],'where':{'id':_0x2cceaa['params']['id']}},_0x518b40={};_0x518b40[_0xbc7b('0x33')]=_['keys'](db[_0xbc7b('0x2f')][_0xbc7b('0x47')]);_0x518b40['query']=_['keys'](_0x2cceaa[_0xbc7b('0x34')]);_0x518b40['filters']=_[_0xbc7b('0x36')](_0x518b40[_0xbc7b('0x33')],_0x518b40[_0xbc7b('0x34')]);_0x1e7331[_0xbc7b('0x37')]=_[_0xbc7b('0x36')](_0x518b40[_0xbc7b('0x33')],qs['fields'](_0x2cceaa[_0xbc7b('0x34')]['fields']));_0x1e7331[_0xbc7b('0x37')]=_0x1e7331[_0xbc7b('0x37')][_0xbc7b('0x48')]?_0x1e7331[_0xbc7b('0x37')]:_0x518b40[_0xbc7b('0x33')];if(_0x2cceaa['query'][_0xbc7b('0x49')]){_0x1e7331['include']=[{'all':!![]}];}_0x1e7331=_[_0xbc7b('0x41')]({},_0x1e7331,_0x2cceaa[_0xbc7b('0x4a')]);return db[_0xbc7b('0x2f')][_0xbc7b('0x4b')](_0x1e7331)[_0xbc7b('0x27')](handleEntityNotFound(_0x1dadb2,null))[_0xbc7b('0x27')](respondWithResult(_0x1dadb2,null))[_0xbc7b('0x46')](handleError(_0x1dadb2,null));};exports[_0xbc7b('0x4c')]=function(_0x3e9838,_0x88fd07){return db[_0xbc7b('0x2f')][_0xbc7b('0x4c')](_0x3e9838[_0xbc7b('0x4d')],{})['then'](function(_0x5b385c){var _0x543b83=_0x3e9838[_0xbc7b('0x4e')][_0xbc7b('0x4f')]({'plain':!![]});if(!_0x543b83)throw new Error(_0xbc7b('0x50'));if(_0x543b83[_0xbc7b('0x51')]===_0xbc7b('0x4e')){var _0xc3dee7=_0x5b385c[_0xbc7b('0x4f')]({'plain':!![]});var _0x4451d0=_0xbc7b('0x28');return db[_0xbc7b('0x52')][_0xbc7b('0x4b')]({'where':{'name':_0x4451d0,'userProfileId':_0x543b83['userProfileId']},'raw':!![]})[_0xbc7b('0x27')](function(_0x23a9ea){if(_0x23a9ea&&_0x23a9ea[_0xbc7b('0x53')]===0x0){return db[_0xbc7b('0x54')]['create']({'name':_0xc3dee7[_0xbc7b('0x2b')],'resourceId':_0xc3dee7['id'],'type':_0x23a9ea['name'],'sectionId':_0x23a9ea['id']},{})[_0xbc7b('0x27')](function(){return _0x5b385c;});}else{return _0x5b385c;}})['catch'](function(_0x4cffaa){logger[_0xbc7b('0x29')](_0xbc7b('0x55'),_0x4cffaa);throw _0x4cffaa;});}return _0x5b385c;})[_0xbc7b('0x27')](respondWithResult(_0x88fd07,0xc9))[_0xbc7b('0x46')](handleError(_0x88fd07,null));};exports[_0xbc7b('0x56')]=function(_0x1baa3e,_0x4af9dc){if(_0x1baa3e[_0xbc7b('0x4d')]['id']){delete _0x1baa3e['body']['id'];}return db[_0xbc7b('0x2f')][_0xbc7b('0x4b')]({'where':{'id':_0x1baa3e[_0xbc7b('0x57')]['id']}})['then'](handleEntityNotFound(_0x4af9dc,null))[_0xbc7b('0x27')](saveUpdates(_0x1baa3e[_0xbc7b('0x4d')],null))['then'](respondWithResult(_0x4af9dc,null))['catch'](handleError(_0x4af9dc,null));};exports[_0xbc7b('0x26')]=function(_0x5546de,_0x470471){return db[_0xbc7b('0x2f')]['find']({'where':{'id':_0x5546de['params']['id']}})[_0xbc7b('0x27')](handleEntityNotFound(_0x470471,null))[_0xbc7b('0x27')](removeEntity(_0x470471,null))[_0xbc7b('0x46')](handleError(_0x470471,null));};exports[_0xbc7b('0x58')]=function(_0x507ef1,_0x43b5f1,_0x59e4d6){if(_0x507ef1[_0xbc7b('0x4d')]['id']){delete _0x507ef1['body']['id'];}return db['Interval'][_0xbc7b('0x4b')]({'where':{'id':_0x507ef1[_0xbc7b('0x57')]['id']}})['then'](handleEntityNotFound(_0x43b5f1,null))[_0xbc7b('0x27')](function(_0x147fbf){if(_0x147fbf){_0x507ef1[_0xbc7b('0x4d')][_0xbc7b('0x59')]=_0x147fbf['id'];return db[_0xbc7b('0x2f')]['create'](_0x507ef1[_0xbc7b('0x4d')]);}})['then'](respondWithResult(_0x43b5f1,null))[_0xbc7b('0x46')](handleError(_0x43b5f1,null));};exports[_0xbc7b('0x5a')]=function(_0x597b80,_0x50e8f1,_0x19b157){var _0x2b912d={};var _0xc8f653={};var _0x54ba0e;var _0x1a4cd5;return db[_0xbc7b('0x2f')][_0xbc7b('0x5b')]({'where':{'id':_0x597b80['params']['id']}})[_0xbc7b('0x27')](handleEntityNotFound(_0x50e8f1,null))[_0xbc7b('0x27')](function(_0x3a813e){if(_0x3a813e){_0x54ba0e=_0x3a813e;_0xc8f653[_0xbc7b('0x33')]=_[_0xbc7b('0x35')](db[_0xbc7b('0x2f')][_0xbc7b('0x47')]);_0xc8f653['query']=_[_0xbc7b('0x35')](_0x597b80[_0xbc7b('0x34')]);_0xc8f653[_0xbc7b('0x3f')]=_[_0xbc7b('0x36')](_0xc8f653[_0xbc7b('0x33')],_0xc8f653['query']);_0x2b912d[_0xbc7b('0x37')]=_[_0xbc7b('0x36')](_0xc8f653[_0xbc7b('0x33')],qs['fields'](_0x597b80[_0xbc7b('0x34')][_0xbc7b('0x38')]));_0x2b912d[_0xbc7b('0x37')]=_0x2b912d[_0xbc7b('0x37')][_0xbc7b('0x48')]?_0x2b912d[_0xbc7b('0x37')]:_0xc8f653[_0xbc7b('0x33')];_0x2b912d[_0xbc7b('0x3c')]=qs['sort'](_0x597b80[_0xbc7b('0x34')][_0xbc7b('0x3d')]);_0x2b912d[_0xbc7b('0x3e')]=qs[_0xbc7b('0x3f')](_[_0xbc7b('0x5c')](_0x597b80[_0xbc7b('0x34')],_0xc8f653['filters']));if(_0x597b80[_0xbc7b('0x34')][_0xbc7b('0x40')]){_0x2b912d['where']=_[_0xbc7b('0x41')](_0x2b912d[_0xbc7b('0x3e')],{'$or':_[_0xbc7b('0x2e')](_0x2b912d[_0xbc7b('0x37')],function(_0x26bbf0){var _0x4584f2={};_0x4584f2[_0x26bbf0]={'$like':'%'+_0x597b80[_0xbc7b('0x34')][_0xbc7b('0x40')]+'%'};return _0x4584f2;})});}_0x2b912d=_[_0xbc7b('0x41')]({},_0x2b912d,_0x597b80[_0xbc7b('0x4a')]);return _0x54ba0e[_0xbc7b('0x5a')](_0x2b912d);}})[_0xbc7b('0x27')](function(_0x12781b){if(_0x12781b){_0x1a4cd5=_0x12781b[_0xbc7b('0x48')];if(!_0x597b80['query'][_0xbc7b('0x39')](_0xbc7b('0x3a'))){_0x2b912d['limit']=qs['limit'](_0x597b80[_0xbc7b('0x34')][_0xbc7b('0x3b')]);_0x2b912d[_0xbc7b('0x1d')]=qs[_0xbc7b('0x1d')](_0x597b80['query'][_0xbc7b('0x1d')]);}return _0x54ba0e[_0xbc7b('0x5a')](_0x2b912d);}})[_0xbc7b('0x27')](function(_0x534c8c){if(_0x534c8c){return _0x534c8c?{'count':_0x1a4cd5,'rows':_0x534c8c}:null;}})[_0xbc7b('0x27')](respondWithResult(_0x50e8f1,null))['catch'](handleError(_0x50e8f1,null));};exports[_0xbc7b('0x5d')]=function(_0x5943ec,_0x1cc53d,_0x37c591){return db[_0xbc7b('0x2f')][_0xbc7b('0x5b')]({'where':{'id':_0x5943ec[_0xbc7b('0x57')]['id']}})[_0xbc7b('0x27')](handleEntityNotFound(_0x1cc53d,null))['then'](function(_0x18e5bc){if(_0x18e5bc){return db[_0xbc7b('0x5e')][_0xbc7b('0x5f')](function(_0x522f78){return db[_0xbc7b('0x2f')]['destroy']({'where':{'IntervalId':_0x5943ec[_0xbc7b('0x57')]['id']},'transaction':_0x522f78})[_0xbc7b('0x27')](function(_0x148a5f){var _0x21c169=_[_0xbc7b('0x2e')](_0x5943ec[_0xbc7b('0x4d')],function(_0x577e1d){delete _0x577e1d['id'];_0x577e1d['IntervalId']=_0x5943ec[_0xbc7b('0x57')]['id'];return _0x577e1d;});return db[_0xbc7b('0x2f')][_0xbc7b('0x60')](_0x21c169,{'transaction':_0x522f78});});})['then'](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x5943ec[_0xbc7b('0x57')]['id']}});});}})[_0xbc7b('0x27')](respondWithResult(_0x1cc53d,null))['catch'](handleError(_0x1cc53d,null));}; \ No newline at end of file +var _0x584c=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','getIntervals','nolimit','transaction','IntervalId','bulkCreate','findAll','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Interval','includeAll','include','rows','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x21d7da,_0x252a56){var _0x12e9c8=function(_0x15080e){while(--_0x15080e){_0x21d7da['push'](_0x21d7da['shift']());}};_0x12e9c8(++_0x252a56);}(_0x584c,0x6d));var _0xc584=function(_0x458848,_0x2dcecd){_0x458848=_0x458848-0x0;var _0x20469e=_0x584c[_0x458848];return _0x20469e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc584('0x0'));var rp=require(_0xc584('0x1'));var moment=require('moment');var BPromise=require(_0xc584('0x2'));var Mustache=require('mustache');var util=require(_0xc584('0x3'));var path=require(_0xc584('0x4'));var sox=require(_0xc584('0x5'));var csv=require(_0xc584('0x6'));var ejs=require(_0xc584('0x7'));var fs=require('fs');var fs_extra=require(_0xc584('0x8'));var _=require(_0xc584('0x9'));var squel=require(_0xc584('0xa'));var crypto=require(_0xc584('0xb'));var jsforce=require(_0xc584('0xc'));var deskjs=require(_0xc584('0xd'));var toCsv=require(_0xc584('0x6'));var querystring=require(_0xc584('0xe'));var Papa=require(_0xc584('0xf'));var Redis=require(_0xc584('0x10'));var authService=require(_0xc584('0x11'));var qs=require(_0xc584('0x12'));var as=require(_0xc584('0x13'));var hardwareService=require(_0xc584('0x14'));var logger=require(_0xc584('0x15'))(_0xc584('0x16'));var utils=require(_0xc584('0x17'));var config=require(_0xc584('0x18'));var licenseUtil=require(_0xc584('0x19'));var db=require(_0xc584('0x1a'))['db'];var extensions=require(_0xc584('0x1b'));function respondWithStatusCode(_0x249ce8,_0x2c8014){_0x2c8014=_0x2c8014||0xcc;return function(_0x50c114){if(_0x50c114){return _0x249ce8[_0xc584('0x1c')](_0x2c8014);}return _0x249ce8[_0xc584('0x1d')](_0x2c8014)['end']();};}function respondWithResult(_0x5846f2,_0x3be439){_0x3be439=_0x3be439||0xc8;return function(_0x167ac2){if(_0x167ac2){return _0x5846f2[_0xc584('0x1d')](_0x3be439)[_0xc584('0x1e')](_0x167ac2);}};}function respondWithFilteredResult(_0x136f48,_0x50c9dc){return function(_0x28dc8b){if(_0x28dc8b){var _0xfec0bc=typeof _0x50c9dc['offset']===_0xc584('0x1f')&&typeof _0x50c9dc[_0xc584('0x20')]===_0xc584('0x1f');var _0x12ac91=_0x28dc8b[_0xc584('0x21')];var _0x2a3caa=_0xfec0bc?0x0:_0x50c9dc[_0xc584('0x22')];var _0x2fc9a1=_0xfec0bc?_0x28dc8b[_0xc584('0x21')]:_0x50c9dc[_0xc584('0x22')]+_0x50c9dc['limit'];var _0x3c768;if(_0x2fc9a1>=_0x12ac91){_0x2fc9a1=_0x12ac91;_0x3c768=0xc8;}else{_0x3c768=0xce;}_0x136f48[_0xc584('0x1d')](_0x3c768);return _0x136f48[_0xc584('0x23')](_0xc584('0x24'),_0x2a3caa+'-'+_0x2fc9a1+'/'+_0x12ac91)[_0xc584('0x1e')](_0x28dc8b);}return null;};}function patchUpdates(_0x55c626){return function(_0x3c341b){try{jsonpatch['apply'](_0x3c341b,_0x55c626,!![]);}catch(_0xf7c2f8){return BPromise[_0xc584('0x25')](_0xf7c2f8);}return _0x3c341b[_0xc584('0x26')]();};}function saveUpdates(_0x558be4,_0x5ac287){return function(_0x41f711){if(_0x41f711){return _0x41f711[_0xc584('0x27')](_0x558be4)[_0xc584('0x28')](function(_0x2ea015){return _0x2ea015;});}return null;};}function removeEntity(_0x4d4f7d,_0x1e70f7){return function(_0x562910){if(_0x562910){return _0x562910[_0xc584('0x29')]()['then'](function(){var _0x22a66a=_0x562910[_0xc584('0x2a')]({'plain':!![]});var _0x51ec91=_0xc584('0x2b');return db[_0xc584('0x2c')]['destroy']({'where':{'type':_0x51ec91,'resourceId':_0x22a66a['id']}})[_0xc584('0x28')](function(){return _0x562910;});})['then'](function(){_0x4d4f7d['status'](0xcc)[_0xc584('0x2d')]();});}};}function handleEntityNotFound(_0x162b6a,_0x502583){return function(_0x35bf2){if(!_0x35bf2){_0x162b6a[_0xc584('0x1c')](0x194);}return _0x35bf2;};}function handleError(_0x151558,_0x178072){_0x178072=_0x178072||0x1f4;return function(_0x564663){logger[_0xc584('0x2e')](_0x564663[_0xc584('0x2f')]);if(_0x564663['name']){delete _0x564663[_0xc584('0x30')];}_0x151558[_0xc584('0x1d')](_0x178072)[_0xc584('0x31')](_0x564663);};}exports[_0xc584('0x32')]=function(_0x40537b,_0x31ad4a){var _0x5514f9={},_0x37a5e3={},_0x54ee62={'count':0x0,'rows':[]};var _0x25605b=_[_0xc584('0x33')](db['Interval'][_0xc584('0x34')],function(_0x10c1bd){return{'name':_0x10c1bd[_0xc584('0x35')],'type':_0x10c1bd['type'][_0xc584('0x36')]};});_0x37a5e3[_0xc584('0x37')]=_[_0xc584('0x33')](_0x25605b,_0xc584('0x30'));_0x37a5e3['query']=_[_0xc584('0x38')](_0x40537b[_0xc584('0x39')]);_0x37a5e3[_0xc584('0x3a')]=_[_0xc584('0x3b')](_0x37a5e3[_0xc584('0x37')],_0x37a5e3[_0xc584('0x39')]);_0x5514f9[_0xc584('0x3c')]=_['intersection'](_0x37a5e3[_0xc584('0x37')],qs[_0xc584('0x3d')](_0x40537b[_0xc584('0x39')][_0xc584('0x3d')]));_0x5514f9[_0xc584('0x3c')]=_0x5514f9[_0xc584('0x3c')][_0xc584('0x3e')]?_0x5514f9['attributes']:_0x37a5e3[_0xc584('0x37')];if(!_0x40537b[_0xc584('0x39')][_0xc584('0x3f')]('nolimit')){_0x5514f9[_0xc584('0x20')]=qs[_0xc584('0x20')](_0x40537b['query'][_0xc584('0x20')]);_0x5514f9[_0xc584('0x22')]=qs[_0xc584('0x22')](_0x40537b[_0xc584('0x39')][_0xc584('0x22')]);}_0x5514f9[_0xc584('0x40')]=qs['sort'](_0x40537b[_0xc584('0x39')][_0xc584('0x41')]);_0x5514f9[_0xc584('0x42')]=qs[_0xc584('0x3a')](_[_0xc584('0x43')](_0x40537b['query'],_0x37a5e3[_0xc584('0x3a')]),_0x25605b);if(_0x40537b[_0xc584('0x39')][_0xc584('0x44')]){_0x5514f9[_0xc584('0x42')]=_[_0xc584('0x45')](_0x5514f9['where'],{'$or':_['map'](_0x25605b,function(_0x18e546){if(_0x18e546[_0xc584('0x46')]!==_0xc584('0x47')){var _0x1fd29e={};_0x1fd29e[_0x18e546[_0xc584('0x30')]]={'$like':'%'+_0x40537b['query'][_0xc584('0x44')]+'%'};return _0x1fd29e;}})});}_0x5514f9=_[_0xc584('0x45')]({},_0x5514f9,_0x40537b[_0xc584('0x48')]);var _0x11883d={'where':_0x5514f9[_0xc584('0x42')]};return db[_0xc584('0x49')][_0xc584('0x21')](_0x11883d)[_0xc584('0x28')](function(_0x188b32){_0x54ee62[_0xc584('0x21')]=_0x188b32;if(_0x40537b[_0xc584('0x39')][_0xc584('0x4a')]){_0x5514f9[_0xc584('0x4b')]=[{'all':!![]}];}return db[_0xc584('0x49')]['findAll'](_0x5514f9);})['then'](function(_0x2d713d){_0x54ee62[_0xc584('0x4c')]=_0x2d713d;return _0x54ee62;})[_0xc584('0x28')](respondWithFilteredResult(_0x31ad4a,_0x5514f9))['catch'](handleError(_0x31ad4a,null));};exports[_0xc584('0x4d')]=function(_0x167d2e,_0x56eb31){var _0x33fc33={'raw':!![],'where':{'id':_0x167d2e[_0xc584('0x4e')]['id']}},_0x19dcdc={};_0x19dcdc[_0xc584('0x37')]=_[_0xc584('0x38')](db[_0xc584('0x49')][_0xc584('0x34')]);_0x19dcdc[_0xc584('0x39')]=_[_0xc584('0x38')](_0x167d2e['query']);_0x19dcdc['filters']=_[_0xc584('0x3b')](_0x19dcdc[_0xc584('0x37')],_0x19dcdc[_0xc584('0x39')]);_0x33fc33[_0xc584('0x3c')]=_[_0xc584('0x3b')](_0x19dcdc[_0xc584('0x37')],qs[_0xc584('0x3d')](_0x167d2e[_0xc584('0x39')]['fields']));_0x33fc33[_0xc584('0x3c')]=_0x33fc33[_0xc584('0x3c')]['length']?_0x33fc33[_0xc584('0x3c')]:_0x19dcdc[_0xc584('0x37')];if(_0x167d2e[_0xc584('0x39')][_0xc584('0x4a')]){_0x33fc33[_0xc584('0x4b')]=[{'all':!![]}];}_0x33fc33=_[_0xc584('0x45')]({},_0x33fc33,_0x167d2e['options']);return db['Interval'][_0xc584('0x4f')](_0x33fc33)['then'](handleEntityNotFound(_0x56eb31,null))[_0xc584('0x28')](respondWithResult(_0x56eb31,null))[_0xc584('0x50')](handleError(_0x56eb31,null));};exports[_0xc584('0x51')]=function(_0x316203,_0x736f43){return db['Interval'][_0xc584('0x51')](_0x316203['body'],{})['then'](function(_0x204d92){var _0x673c16=_0x316203[_0xc584('0x52')]['get']({'plain':!![]});if(!_0x673c16)throw new Error(_0xc584('0x53'));if(_0x673c16[_0xc584('0x54')]==='user'){var _0x5430e3=_0x204d92[_0xc584('0x2a')]({'plain':!![]});var _0x7478df=_0xc584('0x2b');return db[_0xc584('0x55')]['find']({'where':{'name':_0x7478df,'userProfileId':_0x673c16[_0xc584('0x56')]},'raw':!![]})['then'](function(_0x13d9e5){if(_0x13d9e5&&_0x13d9e5[_0xc584('0x57')]===0x0){return db['UserProfileResource'][_0xc584('0x51')]({'name':_0x5430e3[_0xc584('0x30')],'resourceId':_0x5430e3['id'],'type':_0x13d9e5[_0xc584('0x30')],'sectionId':_0x13d9e5['id']},{})['then'](function(){return _0x204d92;});}else{return _0x204d92;}})[_0xc584('0x50')](function(_0x3cb3fd){logger[_0xc584('0x2e')](_0xc584('0x58'),_0x3cb3fd);throw _0x3cb3fd;});}return _0x204d92;})[_0xc584('0x28')](respondWithResult(_0x736f43,0xc9))[_0xc584('0x50')](handleError(_0x736f43,null));};exports[_0xc584('0x27')]=function(_0x22e6ea,_0x317040){if(_0x22e6ea['body']['id']){delete _0x22e6ea[_0xc584('0x59')]['id'];}return db[_0xc584('0x49')][_0xc584('0x4f')]({'where':{'id':_0x22e6ea[_0xc584('0x4e')]['id']}})[_0xc584('0x28')](handleEntityNotFound(_0x317040,null))[_0xc584('0x28')](saveUpdates(_0x22e6ea[_0xc584('0x59')],null))['then'](respondWithResult(_0x317040,null))[_0xc584('0x50')](handleError(_0x317040,null));};exports[_0xc584('0x29')]=function(_0x22530d,_0x5c36ed){return db['Interval']['find']({'where':{'id':_0x22530d[_0xc584('0x4e')]['id']}})[_0xc584('0x28')](handleEntityNotFound(_0x5c36ed,null))[_0xc584('0x28')](removeEntity(_0x5c36ed,null))['catch'](handleError(_0x5c36ed,null));};exports['addInterval']=function(_0x18ae84,_0x5f1315,_0x783e01){if(_0x18ae84[_0xc584('0x59')]['id']){delete _0x18ae84['body']['id'];}return db[_0xc584('0x49')][_0xc584('0x4f')]({'where':{'id':_0x18ae84[_0xc584('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5f1315,null))[_0xc584('0x28')](function(_0x10903a){if(_0x10903a){_0x18ae84[_0xc584('0x59')]['IntervalId']=_0x10903a['id'];return db[_0xc584('0x49')][_0xc584('0x51')](_0x18ae84[_0xc584('0x59')]);}})[_0xc584('0x28')](respondWithResult(_0x5f1315,null))[_0xc584('0x50')](handleError(_0x5f1315,null));};exports['getIntervals']=function(_0x5a8d70,_0x1ff36f,_0x314c84){var _0x47e093={};var _0x24a6f1={};var _0x56f550;var _0x448d27;return db[_0xc584('0x49')][_0xc584('0x5a')]({'where':{'id':_0x5a8d70[_0xc584('0x4e')]['id']}})[_0xc584('0x28')](handleEntityNotFound(_0x1ff36f,null))[_0xc584('0x28')](function(_0x47b3d6){if(_0x47b3d6){_0x56f550=_0x47b3d6;_0x24a6f1[_0xc584('0x37')]=_[_0xc584('0x38')](db['Interval'][_0xc584('0x34')]);_0x24a6f1[_0xc584('0x39')]=_['keys'](_0x5a8d70[_0xc584('0x39')]);_0x24a6f1[_0xc584('0x3a')]=_[_0xc584('0x3b')](_0x24a6f1[_0xc584('0x37')],_0x24a6f1['query']);_0x47e093[_0xc584('0x3c')]=_['intersection'](_0x24a6f1[_0xc584('0x37')],qs[_0xc584('0x3d')](_0x5a8d70[_0xc584('0x39')][_0xc584('0x3d')]));_0x47e093['attributes']=_0x47e093[_0xc584('0x3c')][_0xc584('0x3e')]?_0x47e093[_0xc584('0x3c')]:_0x24a6f1['model'];_0x47e093[_0xc584('0x40')]=qs[_0xc584('0x41')](_0x5a8d70['query'][_0xc584('0x41')]);_0x47e093['where']=qs[_0xc584('0x3a')](_['pick'](_0x5a8d70[_0xc584('0x39')],_0x24a6f1[_0xc584('0x3a')]));if(_0x5a8d70[_0xc584('0x39')][_0xc584('0x44')]){_0x47e093[_0xc584('0x42')]=_['merge'](_0x47e093[_0xc584('0x42')],{'$or':_[_0xc584('0x33')](_0x47e093[_0xc584('0x3c')],function(_0x53dbd7){var _0x2a4c16={};_0x2a4c16[_0x53dbd7]={'$like':'%'+_0x5a8d70[_0xc584('0x39')]['filter']+'%'};return _0x2a4c16;})});}_0x47e093=_[_0xc584('0x45')]({},_0x47e093,_0x5a8d70[_0xc584('0x48')]);return _0x56f550[_0xc584('0x5b')](_0x47e093);}})['then'](function(_0x496eeb){if(_0x496eeb){_0x448d27=_0x496eeb[_0xc584('0x3e')];if(!_0x5a8d70[_0xc584('0x39')][_0xc584('0x3f')](_0xc584('0x5c'))){_0x47e093['limit']=qs[_0xc584('0x20')](_0x5a8d70['query'][_0xc584('0x20')]);_0x47e093[_0xc584('0x22')]=qs[_0xc584('0x22')](_0x5a8d70[_0xc584('0x39')][_0xc584('0x22')]);}return _0x56f550[_0xc584('0x5b')](_0x47e093);}})[_0xc584('0x28')](function(_0x2b7c10){if(_0x2b7c10){return _0x2b7c10?{'count':_0x448d27,'rows':_0x2b7c10}:null;}})[_0xc584('0x28')](respondWithResult(_0x1ff36f,null))[_0xc584('0x50')](handleError(_0x1ff36f,null));};exports['addIntervals']=function(_0x12e851,_0x5472da,_0x8e9823){return db['Interval'][_0xc584('0x5a')]({'where':{'id':_0x12e851[_0xc584('0x4e')]['id']}})[_0xc584('0x28')](handleEntityNotFound(_0x5472da,null))[_0xc584('0x28')](function(_0x18a270){if(_0x18a270){return db['sequelize'][_0xc584('0x5d')](function(_0x5e0fed){return db['Interval']['destroy']({'where':{'IntervalId':_0x12e851[_0xc584('0x4e')]['id']},'transaction':_0x5e0fed})['then'](function(_0x337f2e){var _0xc81a3b=_[_0xc584('0x33')](_0x12e851[_0xc584('0x59')],function(_0x662a87){delete _0x662a87['id'];_0x662a87[_0xc584('0x5e')]=_0x12e851[_0xc584('0x4e')]['id'];return _0x662a87;});return db[_0xc584('0x49')][_0xc584('0x5f')](_0xc81a3b,{'transaction':_0x5e0fed});});})[_0xc584('0x28')](function(){return db[_0xc584('0x49')][_0xc584('0x60')]({'where':{'IntervalId':_0x12e851[_0xc584('0x4e')]['id']}});});}})[_0xc584('0x28')](respondWithResult(_0x5472da,null))[_0xc584('0x50')](handleError(_0x5472da,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 9e80b5a..b9ac19b 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 _0x1aa5=['Interval','rewrite','lodash','../../config/logger','api','request-promise','path','rimraf','./interval.attributes','../../components/extensions/rewrite','exports','define'];(function(_0x2d1c50,_0x49d49d){var _0x1b77bd=function(_0x48d5ed){while(--_0x48d5ed){_0x2d1c50['push'](_0x2d1c50['shift']());}};_0x1b77bd(++_0x49d49d);}(_0x1aa5,0x18e));var _0x51aa=function(_0x503cdb,_0x49e7c3){_0x503cdb=_0x503cdb-0x0;var _0x26c512=_0x1aa5[_0x503cdb];return _0x26c512;};'use strict';var _=require(_0x51aa('0x0'));var util=require('util');var logger=require(_0x51aa('0x1'))(_0x51aa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x51aa('0x3'));var fs=require('fs');var path=require(_0x51aa('0x4'));var rimraf=require(_0x51aa('0x5'));var config=require('../../config/environment');var attributes=require(_0x51aa('0x6'));var extensions=require(_0x51aa('0x7'));module[_0x51aa('0x8')]=function(_0x18716a,_0x1a979c){return _0x18716a[_0x51aa('0x9')](_0x51aa('0xa'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d9587,_0x40d0b9){extensions['rewrite'](_0x18716a,_0x1d9587);},'afterBulkCreate':function(_0x39e924,_0x42ac4c,_0x4275c9){_0x4275c9();extensions[_0x51aa('0xb')](_0x18716a,_0x39e924[0x0]);},'afterUpdate':function(_0x4c1c8c,_0x5245b6){extensions[_0x51aa('0xb')](_0x18716a,_0x4c1c8c);},'afterDestroy':function(_0xdf9ea9,_0x4ddfee){extensions['rewrite'](_0x18716a,_0xdf9ea9);}}});}; \ No newline at end of file +var _0x1f24=['Interval','tools_intervals','rewrite','lodash','api','moment','request-promise','rimraf','./interval.attributes','../../components/extensions/rewrite','exports','define'];(function(_0x465c8d,_0x308d2e){var _0x3e64a8=function(_0x4ded4e){while(--_0x4ded4e){_0x465c8d['push'](_0x465c8d['shift']());}};_0x3e64a8(++_0x308d2e);}(_0x1f24,0x12f));var _0x41f2=function(_0x40dbbe,_0x3ccb0b){_0x40dbbe=_0x40dbbe-0x0;var _0x3c9acf=_0x1f24[_0x40dbbe];return _0x3c9acf;};'use strict';var _=require(_0x41f2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x41f2('0x1'));var moment=require(_0x41f2('0x2'));var BPromise=require('bluebird');var rp=require(_0x41f2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x41f2('0x4'));var config=require('../../config/environment');var attributes=require(_0x41f2('0x5'));var extensions=require(_0x41f2('0x6'));module[_0x41f2('0x7')]=function(_0x2e3631,_0x3f0028){return _0x2e3631[_0x41f2('0x8')](_0x41f2('0x9'),attributes,{'tableName':_0x41f2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x346458,_0x4d4fed){extensions[_0x41f2('0xb')](_0x2e3631,_0x346458);},'afterBulkCreate':function(_0x3cf14a,_0x34ea0a,_0x36e9ba){_0x36e9ba();extensions[_0x41f2('0xb')](_0x2e3631,_0x3cf14a[0x0]);},'afterUpdate':function(_0x3454f0,_0x5583da){extensions[_0x41f2('0xb')](_0x2e3631,_0x3454f0);},'afterDestroy':function(_0x2acd2f,_0x58642a){extensions[_0x41f2('0xb')](_0x2e3631,_0x2acd2f);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index a18e761..fb9407f 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(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 ea97212..00894b7 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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x2a7503,_0x24eba9){var _0x1e8b97=function(_0x1570c2){while(--_0x1570c2){_0x2a7503['push'](_0x2a7503['shift']());}};_0x1e8b97(++_0x24eba9);}(_0xadb5,0xad));var _0x5adb=function(_0x3c8bde,_0x321d9b){_0x3c8bde=_0x3c8bde-0x0;var _0x41e6bd=_0xadb5[_0x3c8bde];return _0x41e6bd;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x83c716,_0x25152d){var _0xab9893=function(_0x9b3f0a){while(--_0x9b3f0a){_0x83c716['push'](_0x83c716['shift']());}};_0xab9893(++_0x25152d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5ba421,_0x110abc){_0x5ba421=_0x5ba421-0x0;var _0x3fd420=_0x5f2f[_0x5ba421];return _0x3fd420;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 1e5b9c8..bc6ca49 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 _0x5af1=['Report','description','issuetype','Bug','fields','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','end','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','../../config/logger','api','support','3eAmWpBVP0','key'];(function(_0x4becb8,_0x4ad3d3){var _0x5c8a37=function(_0x3d52da){while(--_0x3d52da){_0x4becb8['push'](_0x4becb8['shift']());}};_0x5c8a37(++_0x4ad3d3);}(_0x5af1,0xf0));var _0x15af=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x5af1[_0x39d544];return _0x5a5ff2;};'use strict';var BPromise=require(_0x15af('0x0'));var https=require('https');var logger=require(_0x15af('0x1'))(_0x15af('0x2'));var USERNAME=_0x15af('0x3');var PASSWORD=_0x15af('0x4');function openIssue(_0x33fa7a,_0x70923d){var _0x4cea03={'fields':{'project':{'key':_0x33fa7a[_0x15af('0x5')]||'MOTGUI'},'summary':(_0x33fa7a['summary']||_0x15af('0x6'))+'\x20from\x20'+_0x33fa7a['ip'],'description':_0x33fa7a[_0x15af('0x7')]||JSON['stringify'](_0x33fa7a),'issuetype':{'name':_0x33fa7a[_0x15af('0x8')]||_0x15af('0x9')}}};_0x4cea03[_0x15af('0xa')]['customfield_11500']=_0x33fa7a['email'];_0x4cea03[_0x15af('0xa')]['customfield_11501']=_0x33fa7a[_0x15af('0xb')];_0x4cea03['fields'][_0x15af('0xc')]=_0x33fa7a[_0x15af('0xd')];_0x4cea03[_0x15af('0xa')][_0x15af('0xe')]=_0x33fa7a[_0x15af('0xf')];_0x4cea03[_0x15af('0xa')][_0x15af('0x10')]=_0x33fa7a[_0x15af('0x11')];_0x4cea03[_0x15af('0xa')]['customfield_10102']=_0x33fa7a['ip'];var _0x2f760e={'host':_0x15af('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x15af('0x13'),'Authorization':_0x15af('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0x15af('0x15')](_0x15af('0x16'))}};var _0x1ebb54=JSON[_0x15af('0x17')](_0x4cea03);var _0x25b2ea=https[_0x15af('0x18')](_0x2f760e,function(_0x231cf8){_0x231cf8[_0x15af('0x19')]('utf8');var _0x448685='';_0x231cf8['on']('data',function(_0x5a8f84){_0x448685+=_0x5a8f84;});_0x231cf8['on'](_0x15af('0x1a'),function(){if(_0x70923d){return _0x70923d['status'](_0x231cf8[_0x15af('0x1b')])[_0x15af('0x1c')](JSON[_0x15af('0x1d')](_0x448685));}});});_0x25b2ea['on'](_0x15af('0x1e'),function(_0x54c8fb){if(_0x70923d){return _0x70923d['status'](0x1f4)[_0x15af('0x1c')]({'errors':[{'message':_0x15af('0x1f'),'type':_0x15af('0x20')}]});}});_0x25b2ea[_0x15af('0x21')](_0x1ebb54);_0x25b2ea[_0x15af('0x1a')]();}exports[_0x15af('0x22')]=openIssue;exports[_0x15af('0x23')]=function(_0x1b8bb2,_0x1db681){_0x1b8bb2[_0x15af('0x24')]['ip']=_0x1b8bb2['headers'][_0x15af('0x25')]||_0x1b8bb2[_0x15af('0x26')][_0x15af('0x27')]||_0x1b8bb2[_0x15af('0x28')]['remoteAddress']||_0x1b8bb2['connection'][_0x15af('0x28')][_0x15af('0x27')];return openIssue(_0x1b8bb2[_0x15af('0x24')],_0x1db681);}; \ No newline at end of file +var _0xc2bd=['summary','Report','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','email','oldToken','fields','customfield_11502','name','customfield_10102','/rest/api/2/issue','POST','Basic\x20','toString','setEncoding','utf8','data','end','status','statusCode','parse','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0'];(function(_0x492aff,_0x39b9e1){var _0x5bca8a=function(_0x5e6d15){while(--_0x5e6d15){_0x492aff['push'](_0x492aff['shift']());}};_0x5bca8a(++_0x39b9e1);}(_0xc2bd,0x1bd));var _0xdc2b=function(_0xdc1edc,_0x49f9a6){_0xdc1edc=_0xdc1edc-0x0;var _0x5c8402=_0xc2bd[_0xdc1edc];return _0x5c8402;};'use strict';var BPromise=require(_0xdc2b('0x0'));var https=require(_0xdc2b('0x1'));var logger=require(_0xdc2b('0x2'))(_0xdc2b('0x3'));var USERNAME=_0xdc2b('0x4');var PASSWORD=_0xdc2b('0x5');function openIssue(_0x174c54,_0x45cfee){var _0x3cd205={'fields':{'project':{'key':_0x174c54['key']||'MOTGUI'},'summary':(_0x174c54[_0xdc2b('0x6')]||_0xdc2b('0x7'))+_0xdc2b('0x8')+_0x174c54['ip'],'description':_0x174c54[_0xdc2b('0x9')]||JSON[_0xdc2b('0xa')](_0x174c54),'issuetype':{'name':_0x174c54[_0xdc2b('0xb')]||_0xdc2b('0xc')}}};_0x3cd205['fields'][_0xdc2b('0xd')]=_0x174c54[_0xdc2b('0xe')];_0x3cd205['fields']['customfield_11501']=_0x174c54[_0xdc2b('0xf')];_0x3cd205[_0xdc2b('0x10')][_0xdc2b('0x11')]=_0x174c54['newToken'];_0x3cd205[_0xdc2b('0x10')]['customfield_11503']=_0x174c54[_0xdc2b('0x12')];_0x3cd205['fields']['customfield_11504']=_0x174c54['reason'];_0x3cd205[_0xdc2b('0x10')][_0xdc2b('0x13')]=_0x174c54['ip'];var _0x1a8791={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xdc2b('0x14'),'method':_0xdc2b('0x15'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xdc2b('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xdc2b('0x17')]('base64')}};var _0x1cb5df=JSON[_0xdc2b('0xa')](_0x3cd205);var _0x5a17cd=https['request'](_0x1a8791,function(_0x558cfc){_0x558cfc[_0xdc2b('0x18')](_0xdc2b('0x19'));var _0x3471ea='';_0x558cfc['on'](_0xdc2b('0x1a'),function(_0x294cb2){_0x3471ea+=_0x294cb2;});_0x558cfc['on'](_0xdc2b('0x1b'),function(){if(_0x45cfee){return _0x45cfee[_0xdc2b('0x1c')](_0x558cfc[_0xdc2b('0x1d')])['json'](JSON[_0xdc2b('0x1e')](_0x3471ea));}});});_0x5a17cd['on']('error',function(_0xed5714){if(_0x45cfee){return _0x45cfee[_0xdc2b('0x1c')](0x1f4)[_0xdc2b('0x1f')]({'errors':[{'message':_0xdc2b('0x20'),'type':_0xdc2b('0x21')}]});}});_0x5a17cd[_0xdc2b('0x22')](_0x1cb5df);_0x5a17cd[_0xdc2b('0x1b')]();}exports['openIssue']=openIssue;exports['send']=function(_0x338e5e,_0x182760){_0x338e5e[_0xdc2b('0x23')]['ip']=_0x338e5e[_0xdc2b('0x24')][_0xdc2b('0x25')]||_0x338e5e[_0xdc2b('0x26')][_0xdc2b('0x27')]||_0x338e5e[_0xdc2b('0x28')][_0xdc2b('0x27')]||_0x338e5e['connection'][_0xdc2b('0x28')]['remoteAddress'];return openIssue(_0x338e5e[_0xdc2b('0x23')],_0x182760);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 3bd544d..f043812 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 _0x9f62=['../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','post','/:id','delete','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x5c380f,_0x2bf568){var _0x1cb483=function(_0x2eb286){while(--_0x2eb286){_0x5c380f['push'](_0x5c380f['shift']());}};_0x1cb483(++_0x2bf568);}(_0x9f62,0x154));var _0x29f6=function(_0x3a2d09,_0x471610){_0x3a2d09=_0x3a2d09-0x0;var _0x4dcc13=_0x9f62[_0x3a2d09];return _0x4dcc13;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var controller=require(_0x29f6('0x6'));router[_0x29f6('0x7')]('/',auth['isAuthenticated'](),controller[_0x29f6('0x8')]);router[_0x29f6('0x7')](_0x29f6('0x9'),auth[_0x29f6('0xa')](),controller[_0x29f6('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x29f6('0xc')]('/',auth[_0x29f6('0xa')](),controller['create']);router['put'](_0x29f6('0xd'),auth[_0x29f6('0xa')](),controller['update']);router[_0x29f6('0xe')](_0x29f6('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','exports'];(function(_0x13cad7,_0x185942){var _0x19ae6b=function(_0x5a965e){while(--_0x5a965e){_0x13cad7['push'](_0x13cad7['shift']());}};_0x19ae6b(++_0x185942);}(_0xedd9,0xfc));var _0x9edd=function(_0x48e377,_0x2fc15a){_0x48e377=_0x48e377-0x0;var _0x20f225=_0xedd9[_0x48e377];return _0x20f225;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router['delete'](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x13')]);module[_0x9edd('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index b8b85f7..d073b5b 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x29cac7,_0x263541){_0x29cac7=_0x29cac7-0x0;var _0x2bac71=_0x7a54[_0x29cac7];return _0x2bac71;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a54,0x106));var _0x47a5=function(_0x5a1367,_0x4e5f7f){_0x5a1367=_0x5a1367-0x0;var _0x1fe224=_0x7a54[_0x5a1367];return _0x1fe224;};'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 d7d99fc..e27c9d6 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 _0xdbb1=['reject','save','update','then','destroy','end','error','stack','name','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','request-promise','mustache','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbb1,0x105));var _0x1dbb=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xdbb1[_0x279d37];return _0x530173;};'use strict';var emlformat=require(_0x1dbb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1dbb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1dbb('0x2'));var util=require('util');var path=require(_0x1dbb('0x3'));var sox=require(_0x1dbb('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1dbb('0x5'));var _=require(_0x1dbb('0x6'));var squel=require(_0x1dbb('0x7'));var crypto=require(_0x1dbb('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x1dbb('0x9'));var toCsv=require(_0x1dbb('0xa'));var querystring=require('querystring');var Papa=require(_0x1dbb('0xb'));var Redis=require(_0x1dbb('0xc'));var authService=require(_0x1dbb('0xd'));var qs=require(_0x1dbb('0xe'));var as=require(_0x1dbb('0xf'));var hardwareService=require(_0x1dbb('0x10'));var logger=require(_0x1dbb('0x11'))(_0x1dbb('0x12'));var utils=require(_0x1dbb('0x13'));var config=require(_0x1dbb('0x14'));var licenseUtil=require(_0x1dbb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x425fef,_0x28c292){_0x28c292=_0x28c292||0xcc;return function(_0x332380){if(_0x332380){return _0x425fef[_0x1dbb('0x16')](_0x28c292);}return _0x425fef['status'](_0x28c292)['end']();};}function respondWithResult(_0x1d87b9,_0x175864){_0x175864=_0x175864||0xc8;return function(_0xf5f7ed){if(_0xf5f7ed){return _0x1d87b9[_0x1dbb('0x17')](_0x175864)[_0x1dbb('0x18')](_0xf5f7ed);}};}function respondWithFilteredResult(_0x539721,_0x15dc51){return function(_0x188515){if(_0x188515){var _0x409bee=typeof _0x15dc51['offset']===_0x1dbb('0x19')&&typeof _0x15dc51[_0x1dbb('0x1a')]==='undefined';var _0x2c2aa8=_0x188515[_0x1dbb('0x1b')];var _0x98b8d2=_0x409bee?0x0:_0x15dc51[_0x1dbb('0x1c')];var _0xb21bc5=_0x409bee?_0x188515[_0x1dbb('0x1b')]:_0x15dc51[_0x1dbb('0x1c')]+_0x15dc51[_0x1dbb('0x1a')];var _0x58aa43;if(_0xb21bc5>=_0x2c2aa8){_0xb21bc5=_0x2c2aa8;_0x58aa43=0xc8;}else{_0x58aa43=0xce;}_0x539721['status'](_0x58aa43);return _0x539721['set'](_0x1dbb('0x1d'),_0x98b8d2+'-'+_0xb21bc5+'/'+_0x2c2aa8)[_0x1dbb('0x18')](_0x188515);}return null;};}function patchUpdates(_0x570896){return function(_0x21e48c){try{jsonpatch[_0x1dbb('0x1e')](_0x21e48c,_0x570896,!![]);}catch(_0x23e6b2){return BPromise[_0x1dbb('0x1f')](_0x23e6b2);}return _0x21e48c[_0x1dbb('0x20')]();};}function saveUpdates(_0x3ddd80,_0x330f45){return function(_0x4b206d){if(_0x4b206d){return _0x4b206d[_0x1dbb('0x21')](_0x3ddd80)[_0x1dbb('0x22')](function(_0x2a2458){return _0x2a2458;});}return null;};}function removeEntity(_0x2d1b0c,_0x2c0993){return function(_0x429253){if(_0x429253){return _0x429253[_0x1dbb('0x23')]()[_0x1dbb('0x22')](function(){_0x2d1b0c[_0x1dbb('0x17')](0xcc)[_0x1dbb('0x24')]();});}};}function handleEntityNotFound(_0x18f188,_0x57a9f0){return function(_0x44eff7){if(!_0x44eff7){_0x18f188['sendStatus'](0x194);}return _0x44eff7;};}function handleError(_0x276818,_0x4cd836){_0x4cd836=_0x4cd836||0x1f4;return function(_0x72cfed){logger[_0x1dbb('0x25')](_0x72cfed[_0x1dbb('0x26')]);if(_0x72cfed[_0x1dbb('0x27')]){delete _0x72cfed[_0x1dbb('0x27')];}_0x276818[_0x1dbb('0x17')](_0x4cd836)['send'](_0x72cfed);};}exports[_0x1dbb('0x28')]=function(_0x410979,_0x2c2b99){var _0x4c0a9d={},_0x5557ad={},_0x12bbba={'count':0x0,'rows':[]};var _0x5df55e=_['map'](db[_0x1dbb('0x29')][_0x1dbb('0x2a')],function(_0x4511b3){return{'name':_0x4511b3[_0x1dbb('0x2b')],'type':_0x4511b3[_0x1dbb('0x2c')][_0x1dbb('0x2d')]};});_0x5557ad[_0x1dbb('0x2e')]=_[_0x1dbb('0x2f')](_0x5df55e,_0x1dbb('0x27'));_0x5557ad['query']=_['keys'](_0x410979[_0x1dbb('0x30')]);_0x5557ad[_0x1dbb('0x31')]=_[_0x1dbb('0x32')](_0x5557ad['model'],_0x5557ad['query']);_0x4c0a9d[_0x1dbb('0x33')]=_[_0x1dbb('0x32')](_0x5557ad[_0x1dbb('0x2e')],qs['fields'](_0x410979['query'][_0x1dbb('0x34')]));_0x4c0a9d[_0x1dbb('0x33')]=_0x4c0a9d['attributes'][_0x1dbb('0x35')]?_0x4c0a9d[_0x1dbb('0x33')]:_0x5557ad[_0x1dbb('0x2e')];if(!_0x410979[_0x1dbb('0x30')]['hasOwnProperty'](_0x1dbb('0x36'))){_0x4c0a9d[_0x1dbb('0x1a')]=qs[_0x1dbb('0x1a')](_0x410979[_0x1dbb('0x30')][_0x1dbb('0x1a')]);_0x4c0a9d[_0x1dbb('0x1c')]=qs['offset'](_0x410979[_0x1dbb('0x30')][_0x1dbb('0x1c')]);}_0x4c0a9d['order']=qs[_0x1dbb('0x37')](_0x410979[_0x1dbb('0x30')][_0x1dbb('0x37')]);_0x4c0a9d[_0x1dbb('0x38')]=qs[_0x1dbb('0x31')](_['pick'](_0x410979[_0x1dbb('0x30')],_0x5557ad[_0x1dbb('0x31')]),_0x5df55e);if(_0x410979[_0x1dbb('0x30')][_0x1dbb('0x39')]){_0x4c0a9d[_0x1dbb('0x38')]=_[_0x1dbb('0x3a')](_0x4c0a9d['where'],{'$or':_[_0x1dbb('0x2f')](_0x5df55e,function(_0x429151){if(_0x429151['type']!==_0x1dbb('0x3b')){var _0x41a81b={};_0x41a81b[_0x429151[_0x1dbb('0x27')]]={'$like':'%'+_0x410979[_0x1dbb('0x30')][_0x1dbb('0x39')]+'%'};return _0x41a81b;}})});}_0x4c0a9d=_[_0x1dbb('0x3a')]({},_0x4c0a9d,_0x410979[_0x1dbb('0x3c')]);var _0x2356e6={'where':_0x4c0a9d[_0x1dbb('0x38')]};return db[_0x1dbb('0x29')][_0x1dbb('0x1b')](_0x2356e6)[_0x1dbb('0x22')](function(_0x2a74a3){_0x12bbba['count']=_0x2a74a3;if(_0x410979[_0x1dbb('0x30')][_0x1dbb('0x3d')]){_0x4c0a9d[_0x1dbb('0x3e')]=[{'all':!![]}];}return db[_0x1dbb('0x29')][_0x1dbb('0x3f')](_0x4c0a9d);})[_0x1dbb('0x22')](function(_0x414609){_0x12bbba[_0x1dbb('0x40')]=_0x414609;return _0x12bbba;})[_0x1dbb('0x22')](respondWithFilteredResult(_0x2c2b99,_0x4c0a9d))[_0x1dbb('0x41')](handleError(_0x2c2b99,null));};exports[_0x1dbb('0x42')]=function(_0x23b7d0,_0x139cb4){var _0x504b80={'raw':!![],'where':{'id':_0x23b7d0[_0x1dbb('0x43')]['id']}},_0x148c2f={};_0x148c2f[_0x1dbb('0x2e')]=_[_0x1dbb('0x44')](db['JscriptyAnswerReport'][_0x1dbb('0x2a')]);_0x148c2f[_0x1dbb('0x30')]=_[_0x1dbb('0x44')](_0x23b7d0[_0x1dbb('0x30')]);_0x148c2f[_0x1dbb('0x31')]=_[_0x1dbb('0x32')](_0x148c2f[_0x1dbb('0x2e')],_0x148c2f[_0x1dbb('0x30')]);_0x504b80['attributes']=_[_0x1dbb('0x32')](_0x148c2f[_0x1dbb('0x2e')],qs[_0x1dbb('0x34')](_0x23b7d0[_0x1dbb('0x30')][_0x1dbb('0x34')]));_0x504b80[_0x1dbb('0x33')]=_0x504b80['attributes'][_0x1dbb('0x35')]?_0x504b80['attributes']:_0x148c2f[_0x1dbb('0x2e')];if(_0x23b7d0[_0x1dbb('0x30')]['includeAll']){_0x504b80[_0x1dbb('0x3e')]=[{'all':!![]}];}_0x504b80=_[_0x1dbb('0x3a')]({},_0x504b80,_0x23b7d0[_0x1dbb('0x3c')]);return db[_0x1dbb('0x29')][_0x1dbb('0x45')](_0x504b80)['then'](handleEntityNotFound(_0x139cb4,null))[_0x1dbb('0x22')](respondWithResult(_0x139cb4,null))[_0x1dbb('0x41')](handleError(_0x139cb4,null));};exports[_0x1dbb('0x46')]=function(_0x436b78,_0x19700d){return db['JscriptyAnswerReport'][_0x1dbb('0x46')](_0x436b78['body'],{})['then'](respondWithResult(_0x19700d,0xc9))[_0x1dbb('0x41')](handleError(_0x19700d,null));};exports['update']=function(_0x33969b,_0xb47fb7){if(_0x33969b[_0x1dbb('0x47')]['id']){delete _0x33969b[_0x1dbb('0x47')]['id'];}return db[_0x1dbb('0x29')][_0x1dbb('0x45')]({'where':{'id':_0x33969b['params']['id']}})[_0x1dbb('0x22')](handleEntityNotFound(_0xb47fb7,null))[_0x1dbb('0x22')](saveUpdates(_0x33969b[_0x1dbb('0x47')],null))[_0x1dbb('0x22')](respondWithResult(_0xb47fb7,null))[_0x1dbb('0x41')](handleError(_0xb47fb7,null));};exports[_0x1dbb('0x23')]=function(_0x512408,_0x47fe1e){return db[_0x1dbb('0x29')]['find']({'where':{'id':_0x512408[_0x1dbb('0x43')]['id']}})[_0x1dbb('0x22')](handleEntityNotFound(_0x47fe1e,null))[_0x1dbb('0x22')](removeEntity(_0x47fe1e,null))['catch'](handleError(_0x47fe1e,null));};exports[_0x1dbb('0x48')]=function(_0x2e4af6,_0x1dd2ba){return db[_0x1dbb('0x29')]['describe']()[_0x1dbb('0x22')](respondWithResult(_0x1dd2ba,null))[_0x1dbb('0x41')](handleError(_0x1dd2ba,null));}; \ No newline at end of file +var _0x2484=['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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','intersection','fields','query','attributes','length','sort','filters','pick','filter','where','merge','VIRTUAL','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x58600b,_0x107974){var _0x53d028=function(_0x35f8dd){while(--_0x35f8dd){_0x58600b['push'](_0x58600b['shift']());}};_0x53d028(++_0x107974);}(_0x2484,0x178));var _0x4248=function(_0x73f87f,_0x2eb5c5){_0x73f87f=_0x73f87f-0x0;var _0x11899b=_0x2484[_0x73f87f];return _0x11899b;};'use strict';var emlformat=require(_0x4248('0x0'));var rimraf=require(_0x4248('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4248('0x2'));var rp=require(_0x4248('0x3'));var moment=require(_0x4248('0x4'));var BPromise=require(_0x4248('0x5'));var Mustache=require(_0x4248('0x6'));var util=require(_0x4248('0x7'));var path=require(_0x4248('0x8'));var sox=require('sox');var csv=require(_0x4248('0x9'));var ejs=require(_0x4248('0xa'));var fs=require('fs');var fs_extra=require(_0x4248('0xb'));var _=require(_0x4248('0xc'));var squel=require(_0x4248('0xd'));var crypto=require(_0x4248('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4248('0xf'));var toCsv=require(_0x4248('0x9'));var querystring=require(_0x4248('0x10'));var Papa=require(_0x4248('0x11'));var Redis=require(_0x4248('0x12'));var authService=require(_0x4248('0x13'));var qs=require(_0x4248('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4248('0x15'));var logger=require('../../config/logger')(_0x4248('0x16'));var utils=require(_0x4248('0x17'));var config=require(_0x4248('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xeb5fd1,_0x5237e9){_0x5237e9=_0x5237e9||0xcc;return function(_0x182e84){if(_0x182e84){return _0xeb5fd1[_0x4248('0x19')](_0x5237e9);}return _0xeb5fd1[_0x4248('0x1a')](_0x5237e9)[_0x4248('0x1b')]();};}function respondWithResult(_0x3a557b,_0x588077){_0x588077=_0x588077||0xc8;return function(_0x8b30bb){if(_0x8b30bb){return _0x3a557b[_0x4248('0x1a')](_0x588077)[_0x4248('0x1c')](_0x8b30bb);}};}function respondWithFilteredResult(_0x35308b,_0x3e7d0a){return function(_0x51c92e){if(_0x51c92e){var _0x46cfbb=typeof _0x3e7d0a[_0x4248('0x1d')]===_0x4248('0x1e')&&typeof _0x3e7d0a[_0x4248('0x1f')]===_0x4248('0x1e');var _0x321e92=_0x51c92e[_0x4248('0x20')];var _0x45edc6=_0x46cfbb?0x0:_0x3e7d0a[_0x4248('0x1d')];var _0xd03b87=_0x46cfbb?_0x51c92e[_0x4248('0x20')]:_0x3e7d0a[_0x4248('0x1d')]+_0x3e7d0a[_0x4248('0x1f')];var _0x1b2f10;if(_0xd03b87>=_0x321e92){_0xd03b87=_0x321e92;_0x1b2f10=0xc8;}else{_0x1b2f10=0xce;}_0x35308b[_0x4248('0x1a')](_0x1b2f10);return _0x35308b[_0x4248('0x21')](_0x4248('0x22'),_0x45edc6+'-'+_0xd03b87+'/'+_0x321e92)[_0x4248('0x1c')](_0x51c92e);}return null;};}function patchUpdates(_0x5ab53e){return function(_0x3c1c46){try{jsonpatch[_0x4248('0x23')](_0x3c1c46,_0x5ab53e,!![]);}catch(_0x2d674b){return BPromise[_0x4248('0x24')](_0x2d674b);}return _0x3c1c46['save']();};}function saveUpdates(_0x43c75d,_0x37b1b3){return function(_0x30b232){if(_0x30b232){return _0x30b232['update'](_0x43c75d)[_0x4248('0x25')](function(_0x25ffa3){return _0x25ffa3;});}return null;};}function removeEntity(_0x50f032,_0x3bfcf2){return function(_0x598681){if(_0x598681){return _0x598681[_0x4248('0x26')]()[_0x4248('0x25')](function(){_0x50f032[_0x4248('0x1a')](0xcc)[_0x4248('0x1b')]();});}};}function handleEntityNotFound(_0x5a3938,_0x1c6ade){return function(_0x205382){if(!_0x205382){_0x5a3938[_0x4248('0x19')](0x194);}return _0x205382;};}function handleError(_0xb3e0e0,_0xd758e6){_0xd758e6=_0xd758e6||0x1f4;return function(_0x429641){logger[_0x4248('0x27')](_0x429641[_0x4248('0x28')]);if(_0x429641[_0x4248('0x29')]){delete _0x429641[_0x4248('0x29')];}_0xb3e0e0[_0x4248('0x1a')](_0xd758e6)[_0x4248('0x2a')](_0x429641);};}exports[_0x4248('0x2b')]=function(_0xf72ecc,_0xf06a1a){var _0x439859={},_0x482689={},_0x346d91={'count':0x0,'rows':[]};var _0x40ca90=_[_0x4248('0x2c')](db['JscriptyAnswerReport'][_0x4248('0x2d')],function(_0x1b4768){return{'name':_0x1b4768[_0x4248('0x2e')],'type':_0x1b4768[_0x4248('0x2f')][_0x4248('0x30')]};});_0x482689[_0x4248('0x31')]=_[_0x4248('0x2c')](_0x40ca90,'name');_0x482689['query']=_['keys'](_0xf72ecc['query']);_0x482689['filters']=_['intersection'](_0x482689['model'],_0x482689['query']);_0x439859['attributes']=_[_0x4248('0x32')](_0x482689[_0x4248('0x31')],qs[_0x4248('0x33')](_0xf72ecc[_0x4248('0x34')]['fields']));_0x439859[_0x4248('0x35')]=_0x439859['attributes'][_0x4248('0x36')]?_0x439859[_0x4248('0x35')]:_0x482689[_0x4248('0x31')];if(!_0xf72ecc[_0x4248('0x34')]['hasOwnProperty']('nolimit')){_0x439859[_0x4248('0x1f')]=qs[_0x4248('0x1f')](_0xf72ecc[_0x4248('0x34')][_0x4248('0x1f')]);_0x439859[_0x4248('0x1d')]=qs[_0x4248('0x1d')](_0xf72ecc[_0x4248('0x34')][_0x4248('0x1d')]);}_0x439859['order']=qs['sort'](_0xf72ecc['query'][_0x4248('0x37')]);_0x439859['where']=qs[_0x4248('0x38')](_[_0x4248('0x39')](_0xf72ecc[_0x4248('0x34')],_0x482689[_0x4248('0x38')]),_0x40ca90);if(_0xf72ecc[_0x4248('0x34')][_0x4248('0x3a')]){_0x439859[_0x4248('0x3b')]=_[_0x4248('0x3c')](_0x439859['where'],{'$or':_[_0x4248('0x2c')](_0x40ca90,function(_0x24a824){if(_0x24a824['type']!==_0x4248('0x3d')){var _0x38a7ab={};_0x38a7ab[_0x24a824['name']]={'$like':'%'+_0xf72ecc[_0x4248('0x34')][_0x4248('0x3a')]+'%'};return _0x38a7ab;}})});}_0x439859=_[_0x4248('0x3c')]({},_0x439859,_0xf72ecc[_0x4248('0x3e')]);var _0xb7f152={'where':_0x439859['where']};return db[_0x4248('0x3f')]['count'](_0xb7f152)['then'](function(_0x33152c){_0x346d91[_0x4248('0x20')]=_0x33152c;if(_0xf72ecc[_0x4248('0x34')][_0x4248('0x40')]){_0x439859[_0x4248('0x41')]=[{'all':!![]}];}return db[_0x4248('0x3f')][_0x4248('0x42')](_0x439859);})[_0x4248('0x25')](function(_0x267923){_0x346d91[_0x4248('0x43')]=_0x267923;return _0x346d91;})['then'](respondWithFilteredResult(_0xf06a1a,_0x439859))[_0x4248('0x44')](handleError(_0xf06a1a,null));};exports[_0x4248('0x45')]=function(_0x3b40ad,_0x4b9200){var _0x57ff44={'raw':!![],'where':{'id':_0x3b40ad[_0x4248('0x46')]['id']}},_0x4b29c1={};_0x4b29c1[_0x4248('0x31')]=_[_0x4248('0x47')](db[_0x4248('0x3f')][_0x4248('0x2d')]);_0x4b29c1[_0x4248('0x34')]=_['keys'](_0x3b40ad[_0x4248('0x34')]);_0x4b29c1[_0x4248('0x38')]=_[_0x4248('0x32')](_0x4b29c1['model'],_0x4b29c1[_0x4248('0x34')]);_0x57ff44[_0x4248('0x35')]=_[_0x4248('0x32')](_0x4b29c1['model'],qs['fields'](_0x3b40ad[_0x4248('0x34')][_0x4248('0x33')]));_0x57ff44[_0x4248('0x35')]=_0x57ff44[_0x4248('0x35')]['length']?_0x57ff44[_0x4248('0x35')]:_0x4b29c1[_0x4248('0x31')];if(_0x3b40ad['query'][_0x4248('0x40')]){_0x57ff44['include']=[{'all':!![]}];}_0x57ff44=_[_0x4248('0x3c')]({},_0x57ff44,_0x3b40ad[_0x4248('0x3e')]);return db['JscriptyAnswerReport'][_0x4248('0x48')](_0x57ff44)['then'](handleEntityNotFound(_0x4b9200,null))[_0x4248('0x25')](respondWithResult(_0x4b9200,null))[_0x4248('0x44')](handleError(_0x4b9200,null));};exports[_0x4248('0x49')]=function(_0x20184b,_0x47b0ef){return db['JscriptyAnswerReport']['create'](_0x20184b[_0x4248('0x4a')],{})[_0x4248('0x25')](respondWithResult(_0x47b0ef,0xc9))[_0x4248('0x44')](handleError(_0x47b0ef,null));};exports[_0x4248('0x4b')]=function(_0x4c5b11,_0x42f12a){if(_0x4c5b11[_0x4248('0x4a')]['id']){delete _0x4c5b11[_0x4248('0x4a')]['id'];}return db[_0x4248('0x3f')]['find']({'where':{'id':_0x4c5b11[_0x4248('0x46')]['id']}})[_0x4248('0x25')](handleEntityNotFound(_0x42f12a,null))[_0x4248('0x25')](saveUpdates(_0x4c5b11[_0x4248('0x4a')],null))[_0x4248('0x25')](respondWithResult(_0x42f12a,null))[_0x4248('0x44')](handleError(_0x42f12a,null));};exports[_0x4248('0x26')]=function(_0x46b2e4,_0x34a922){return db['JscriptyAnswerReport'][_0x4248('0x48')]({'where':{'id':_0x46b2e4[_0x4248('0x46')]['id']}})[_0x4248('0x25')](handleEntityNotFound(_0x34a922,null))[_0x4248('0x25')](removeEntity(_0x34a922,null))[_0x4248('0x44')](handleError(_0x34a922,null));};exports['describe']=function(_0x548bfa,_0x27e3a5){return db[_0x4248('0x3f')][_0x4248('0x4c')]()['then'](respondWithResult(_0x27e3a5,null))['catch'](handleError(_0x27e3a5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 25a3282..e003504 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 _0x9128=['path','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','bluebird','request-promise'];(function(_0x25a42a,_0x3d489b){var _0x1129b1=function(_0x4ae61b){while(--_0x4ae61b){_0x25a42a['push'](_0x25a42a['shift']());}};_0x1129b1(++_0x3d489b);}(_0x9128,0x19d));var _0x8912=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0x9128[_0x48b810];return _0x23c17d;};'use strict';var _=require(_0x8912('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8912('0x1'));var rp=require(_0x8912('0x2'));var fs=require('fs');var path=require(_0x8912('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0x8912('0x4')]=function(_0x2759e3,_0x1cb3d4){return _0x2759e3[_0x8912('0x5')](_0x8912('0x6'),attributes,{'tableName':_0x8912('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c02=['request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','report_jscripty_answers','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c02,0xb6));var _0x21c0=function(_0x192de8,_0x3c6e3d){_0x192de8=_0x192de8-0x0;var _0x41d3c7=_0x1c02[_0x192de8];return _0x41d3c7;};'use strict';var _=require(_0x21c0('0x0'));var util=require(_0x21c0('0x1'));var logger=require(_0x21c0('0x2'))('api');var moment=require(_0x21c0('0x3'));var BPromise=require(_0x21c0('0x4'));var rp=require(_0x21c0('0x5'));var fs=require('fs');var path=require(_0x21c0('0x6'));var rimraf=require(_0x21c0('0x7'));var config=require(_0x21c0('0x8'));var attributes=require(_0x21c0('0x9'));module['exports']=function(_0x96333,_0x2eb661){return _0x96333['define']('JscriptyAnswerReport',attributes,{'tableName':_0x21c0('0xa'),'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 6326234..834d2f6 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 _0xd44c=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x1f47a1,_0x43e64e){var _0x2745dd=function(_0x599612){while(--_0x599612){_0x1f47a1['push'](_0x1f47a1['shift']());}};_0x2745dd(++_0x43e64e);}(_0xd44c,0xb7));var _0xcd44=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0xd44c[_0xa60623];return _0x4a6487;};'use strict';var _=require(_0xcd44('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcd44('0x1'));var rs=require(_0xcd44('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd44('0x3'))['db'];var utils=require(_0xcd44('0x4'));var logger=require(_0xcd44('0x5'))(_0xcd44('0x6'));var config=require(_0xcd44('0x7'));var jayson=require(_0xcd44('0x8'));var client=jayson[_0xcd44('0x9')][_0xcd44('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x117a07,_0x21f9b0,_0x138967){return new BPromise(function(_0x4641eb,_0x1d773b){return client[_0xcd44('0xb')](_0x117a07,_0x138967)[_0xcd44('0xc')](function(_0x40f5ce){logger[_0xcd44('0xd')](_0xcd44('0xe'),_0x21f9b0,_0xcd44('0xf'));logger[_0xcd44('0x10')](_0xcd44('0x11'),_0x21f9b0,'request\x20sent',JSON[_0xcd44('0x12')](_0x40f5ce));if(_0x40f5ce[_0xcd44('0x13')]){if(_0x40f5ce[_0xcd44('0x13')][_0xcd44('0x14')]===0x1f4){logger['error'](_0xcd44('0xe'),_0x21f9b0,_0x40f5ce[_0xcd44('0x13')]['message']);return _0x1d773b(_0x40f5ce[_0xcd44('0x13')][_0xcd44('0x15')]);}logger[_0xcd44('0x13')](_0xcd44('0xe'),_0x21f9b0,_0x40f5ce[_0xcd44('0x13')][_0xcd44('0x15')]);return _0x4641eb(_0x40f5ce[_0xcd44('0x13')][_0xcd44('0x15')]);}else{logger[_0xcd44('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x21f9b0,'request\x20sent');_0x4641eb(_0x40f5ce[_0xcd44('0x16')][_0xcd44('0x15')]);}})['catch'](function(_0x2c0191){logger[_0xcd44('0x13')](_0xcd44('0xe'),_0x21f9b0,_0x2c0191);_0x1d773b(_0x2c0191);});});} \ No newline at end of file +var _0x5b63=['client','request','then','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1483db,_0x1008c2){var _0x21bba0=function(_0x4c5559){while(--_0x4c5559){_0x1483db['push'](_0x1483db['shift']());}};_0x21bba0(++_0x1008c2);}(_0x5b63,0x12a));var _0x35b6=function(_0x68a813,_0x1cdad9){_0x68a813=_0x68a813-0x0;var _0x5b7a95=_0x5b63[_0x68a813];return _0x5b7a95;};'use strict';var _=require(_0x35b6('0x0'));var util=require(_0x35b6('0x1'));var moment=require(_0x35b6('0x2'));var BPromise=require(_0x35b6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35b6('0x4'));var db=require(_0x35b6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x35b6('0x6'))(_0x35b6('0x7'));var config=require(_0x35b6('0x8'));var jayson=require(_0x35b6('0x9'));var client=jayson[_0x35b6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47cd61,_0x7a6f5c,_0x4c806c){return new BPromise(function(_0x428d8a,_0x5595e8){return client[_0x35b6('0xb')](_0x47cd61,_0x4c806c)[_0x35b6('0xc')](function(_0x41915c){logger['info'](_0x35b6('0xd'),_0x7a6f5c,'request\x20sent');logger[_0x35b6('0xe')](_0x35b6('0xf'),_0x7a6f5c,_0x35b6('0x10'),JSON['stringify'](_0x41915c));if(_0x41915c['error']){if(_0x41915c[_0x35b6('0x11')]['code']===0x1f4){logger['error'](_0x35b6('0xd'),_0x7a6f5c,_0x41915c[_0x35b6('0x11')]['message']);return _0x5595e8(_0x41915c['error'][_0x35b6('0x12')]);}logger[_0x35b6('0x11')](_0x35b6('0xd'),_0x7a6f5c,_0x41915c['error'][_0x35b6('0x12')]);return _0x428d8a(_0x41915c['error']['message']);}else{logger[_0x35b6('0x13')](_0x35b6('0xd'),_0x7a6f5c,'request\x20sent');_0x428d8a(_0x41915c[_0x35b6('0x14')][_0x35b6('0x12')]);}})[_0x35b6('0x15')](function(_0x38bb64){logger[_0x35b6('0x11')](_0x35b6('0xd'),_0x7a6f5c,_0x38bb64);_0x5595e8(_0x38bb64);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 9bd1f24..53ba99d 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 _0xe3da=['30s','post','create','/:id/clone','clone','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xe3da,0x1a1));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require('../../config/environment');var controller=require(_0xae3d('0x9'));router[_0xae3d('0xa')]('/',auth[_0xae3d('0xb')](),controller[_0xae3d('0xc')]);router[_0xae3d('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xae3d('0xd')]);router[_0xae3d('0xa')](_0xae3d('0xe'),auth['isAuthenticated'](),controller['getSessions']);router[_0xae3d('0xa')](_0xae3d('0xf'),auth[_0xae3d('0xb')](),controller[_0xae3d('0x10')]);router[_0xae3d('0xa')](_0xae3d('0x11'),auth[_0xae3d('0xb')](),timeout(_0xae3d('0x12')),controller['getSummary']);router[_0xae3d('0x13')]('/',auth['isAuthenticated'](),controller[_0xae3d('0x14')]);router[_0xae3d('0x13')](_0xae3d('0x15'),auth[_0xae3d('0xb')](),controller[_0xae3d('0x16')]);router[_0xae3d('0x17')](_0xae3d('0x18'),auth['isAuthenticated'](),controller[_0xae3d('0x19')]);router[_0xae3d('0x1a')](_0xae3d('0x18'),auth[_0xae3d('0xb')](),controller[_0xae3d('0x1b')]);module[_0xae3d('0x1c')]=router; \ No newline at end of file +var _0x0f9f=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','30s','getSummary','post','create','clone','put','update','exports','multer','util','path','express','fs-extra','../../components/interaction/service'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x0f9f,0x10e));var _0xf0f9=function(_0x3f975a,_0xf22b0b){_0x3f975a=_0x3f975a-0x0;var _0x512370=_0x0f9f[_0x3f975a];return _0x512370;};'use strict';var multer=require(_0xf0f9('0x0'));var util=require(_0xf0f9('0x1'));var path=require(_0xf0f9('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0f9('0x3'));var router=express['Router']();var fs_extra=require(_0xf0f9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf0f9('0x5'));var config=require(_0xf0f9('0x6'));var controller=require('./jscriptyProject.controller');router[_0xf0f9('0x7')]('/',auth[_0xf0f9('0x8')](),controller[_0xf0f9('0x9')]);router[_0xf0f9('0x7')](_0xf0f9('0xa'),auth[_0xf0f9('0x8')](),controller[_0xf0f9('0xb')]);router[_0xf0f9('0x7')](_0xf0f9('0xc'),auth[_0xf0f9('0x8')](),controller[_0xf0f9('0xd')]);router[_0xf0f9('0x7')](_0xf0f9('0xe'),auth[_0xf0f9('0x8')](),controller['getAnswers']);router[_0xf0f9('0x7')]('/:id/summary',auth[_0xf0f9('0x8')](),timeout(_0xf0f9('0xf')),controller[_0xf0f9('0x10')]);router[_0xf0f9('0x11')]('/',auth[_0xf0f9('0x8')](),controller[_0xf0f9('0x12')]);router[_0xf0f9('0x11')]('/:id/clone',auth[_0xf0f9('0x8')](),controller[_0xf0f9('0x13')]);router[_0xf0f9('0x14')]('/:id',auth[_0xf0f9('0x8')](),controller[_0xf0f9('0x15')]);router['delete'](_0xf0f9('0xa'),auth[_0xf0f9('0x8')](),controller['destroy']);module[_0xf0f9('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index fea62b8..9c6a346 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 _0x1bf0=['getDataValue','BOOLEAN','sequelize','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x1bf0,0x64));var _0x01bf=function(_0x4f2b28,_0xf4f231){_0x4f2b28=_0x4f2b28-0x0;var _0x1d8cb9=_0x1bf0[_0x4f2b28];return _0x1d8cb9;};'use strict';var Sequelize=require(_0x01bf('0x0'));var _=require('lodash');var util=require(_0x01bf('0x1'));module[_0x01bf('0x2')]={'name':{'type':Sequelize[_0x01bf('0x3')],'unique':_0x01bf('0x4')},'description':{'type':Sequelize[_0x01bf('0x3')]},'formData':{'type':Sequelize[_0x01bf('0x5')](_0x01bf('0x6')),'set':function(_0x4bb9fb){if(_[_0x01bf('0x7')](_0x4bb9fb)){this[_0x01bf('0x8')](_0x01bf('0x9'),JSON['stringify'](_0x4bb9fb));}else if(_['isString'](_0x4bb9fb)){this['setDataValue']('formData',_0x4bb9fb);}else{this[_0x01bf('0x8')](_0x01bf('0x9'),util[_0x01bf('0xa')](_0x01bf('0xb'),this[_0x01bf('0xc')](_0x01bf('0x4'))||'',this[_0x01bf('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x01bf('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x594f=['lodash','util','STRING','TEXT','long','isObjectLike','formData','isString','setDataValue','format','name','BOOLEAN','sequelize'];(function(_0x19cd29,_0x1ac3e7){var _0x27c96d=function(_0x198a8f){while(--_0x198a8f){_0x19cd29['push'](_0x19cd29['shift']());}};_0x27c96d(++_0x1ac3e7);}(_0x594f,0x103));var _0xf594=function(_0x199f6d,_0x4e2a28){_0x199f6d=_0x199f6d-0x0;var _0x5a27bf=_0x594f[_0x199f6d];return _0x5a27bf;};'use strict';var Sequelize=require(_0xf594('0x0'));var _=require(_0xf594('0x1'));var util=require(_0xf594('0x2'));module['exports']={'name':{'type':Sequelize[_0xf594('0x3')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xf594('0x4')](_0xf594('0x5')),'set':function(_0x15778c){if(_[_0xf594('0x6')](_0x15778c)){this['setDataValue'](_0xf594('0x7'),JSON['stringify'](_0x15778c));}else if(_[_0xf594('0x8')](_0x15778c)){this[_0xf594('0x9')](_0xf594('0x7'),_0x15778c);}else{this[_0xf594('0x9')](_0xf594('0x7'),util[_0xf594('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0xf594('0xb'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf594('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf594('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 11821d3..bc3608f 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 _0x936d=['indexOf','replace','getSummary','startTime','parse','-createdAt','questionId','question','starttime','format','SessionId','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','Projects','UserProfileResource','destroy','error','stack','name','send','index','JscriptyProject','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','length','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','createdAt','updatedAt','userProfileId','getSessions','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','ProjectId','number','fromCharCode','apply','toString'];(function(_0x357b8f,_0x2caed4){var _0x3f6595=function(_0x57058f){while(--_0x57058f){_0x357b8f['push'](_0x357b8f['shift']());}};_0x3f6595(++_0x2caed4);}(_0x936d,0x183));var _0xd936=function(_0x264283,_0x448e71){_0x264283=_0x264283-0x0;var _0x758401=_0x936d[_0x264283];return _0x758401;};'use strict';var emlformat=require(_0xd936('0x0'));var rimraf=require(_0xd936('0x1'));var zipdir=require(_0xd936('0x2'));var jsonpatch=require(_0xd936('0x3'));var rp=require('request-promise');var moment=require(_0xd936('0x4'));var BPromise=require(_0xd936('0x5'));var Mustache=require(_0xd936('0x6'));var util=require(_0xd936('0x7'));var path=require(_0xd936('0x8'));var sox=require(_0xd936('0x9'));var csv=require(_0xd936('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd936('0xb'));var _=require(_0xd936('0xc'));var squel=require(_0xd936('0xd'));var crypto=require(_0xd936('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd936('0xf'));var toCsv=require(_0xd936('0xa'));var querystring=require('querystring');var Papa=require(_0xd936('0x10'));var Redis=require(_0xd936('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd936('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd936('0x13'));var logger=require(_0xd936('0x14'))(_0xd936('0x15'));var utils=require(_0xd936('0x16'));var config=require(_0xd936('0x17'));var licenseUtil=require(_0xd936('0x18'));var db=require(_0xd936('0x19'))['db'];function respondWithStatusCode(_0x434d80,_0x309978){_0x309978=_0x309978||0xcc;return function(_0x884e08){if(_0x884e08){return _0x434d80[_0xd936('0x1a')](_0x309978);}return _0x434d80[_0xd936('0x1b')](_0x309978)['end']();};}function respondWithResult(_0x39153f,_0x1feab7){_0x1feab7=_0x1feab7||0xc8;return function(_0xae89f4){if(_0xae89f4){return _0x39153f['status'](_0x1feab7)['json'](_0xae89f4);}};}function respondWithFilteredResult(_0x520168,_0x39627b){return function(_0x38a890){if(_0x38a890){var _0x26d441=typeof _0x39627b[_0xd936('0x1c')]===_0xd936('0x1d')&&typeof _0x39627b[_0xd936('0x1e')]===_0xd936('0x1d');var _0x262eb8=_0x38a890[_0xd936('0x1f')];var _0x1d5805=_0x26d441?0x0:_0x39627b['offset'];var _0x35011a=_0x26d441?_0x38a890[_0xd936('0x1f')]:_0x39627b['offset']+_0x39627b[_0xd936('0x1e')];var _0x48d37b;if(_0x35011a>=_0x262eb8){_0x35011a=_0x262eb8;_0x48d37b=0xc8;}else{_0x48d37b=0xce;}_0x520168[_0xd936('0x1b')](_0x48d37b);return _0x520168['set'](_0xd936('0x20'),_0x1d5805+'-'+_0x35011a+'/'+_0x262eb8)[_0xd936('0x21')](_0x38a890);}return null;};}function patchUpdates(_0x10c05d){return function(_0x2568dd){try{jsonpatch['apply'](_0x2568dd,_0x10c05d,!![]);}catch(_0x160927){return BPromise[_0xd936('0x22')](_0x160927);}return _0x2568dd[_0xd936('0x23')]();};}function saveUpdates(_0x382585,_0x310e5a){return function(_0x4a7f3a){if(_0x4a7f3a){return _0x4a7f3a[_0xd936('0x24')](_0x382585)[_0xd936('0x25')](function(_0x44e631){return _0x44e631;});}return null;};}function removeEntity(_0x29f419,_0x22b726){return function(_0x17f4c9){if(_0x17f4c9){return _0x17f4c9['destroy']()[_0xd936('0x25')](function(){var _0x2a96c3=_0x17f4c9['get']({'plain':!![]});var _0x39d5c3=_0xd936('0x26');return db[_0xd936('0x27')][_0xd936('0x28')]({'where':{'type':_0x39d5c3,'resourceId':_0x2a96c3['id']}})['then'](function(){return _0x17f4c9;});})[_0xd936('0x25')](function(){_0x29f419['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2de3fa,_0x1df51c){return function(_0x33b3b7){if(!_0x33b3b7){_0x2de3fa[_0xd936('0x1a')](0x194);}return _0x33b3b7;};}function handleError(_0x441c0f,_0x3f0f9e){_0x3f0f9e=_0x3f0f9e||0x1f4;return function(_0x3c8d92){logger[_0xd936('0x29')](_0x3c8d92[_0xd936('0x2a')]);if(_0x3c8d92['name']){delete _0x3c8d92[_0xd936('0x2b')];}_0x441c0f[_0xd936('0x1b')](_0x3f0f9e)[_0xd936('0x2c')](_0x3c8d92);};}exports[_0xd936('0x2d')]=function(_0x4c416a,_0x41b003){var _0x99d672={},_0x4872ca={},_0x11ea10={'count':0x0,'rows':[]};var _0x4087a2=_['map'](db[_0xd936('0x2e')]['rawAttributes'],function(_0x301202){return{'name':_0x301202[_0xd936('0x2f')],'type':_0x301202[_0xd936('0x30')][_0xd936('0x31')]};});_0x4872ca['model']=_['map'](_0x4087a2,_0xd936('0x2b'));_0x4872ca[_0xd936('0x32')]=_[_0xd936('0x33')](_0x4c416a[_0xd936('0x32')]);_0x4872ca[_0xd936('0x34')]=_[_0xd936('0x35')](_0x4872ca[_0xd936('0x36')],_0x4872ca[_0xd936('0x32')]);_0x99d672[_0xd936('0x37')]=_[_0xd936('0x35')](_0x4872ca[_0xd936('0x36')],qs['fields'](_0x4c416a['query'][_0xd936('0x38')]));_0x99d672['attributes']=_0x99d672[_0xd936('0x37')]['length']?_0x99d672[_0xd936('0x37')]:_0x4872ca[_0xd936('0x36')];if(!_0x4c416a[_0xd936('0x32')][_0xd936('0x39')](_0xd936('0x3a'))){_0x99d672[_0xd936('0x1e')]=qs[_0xd936('0x1e')](_0x4c416a[_0xd936('0x32')][_0xd936('0x1e')]);_0x99d672['offset']=qs[_0xd936('0x1c')](_0x4c416a['query']['offset']);}_0x99d672[_0xd936('0x3b')]=qs['sort'](_0x4c416a['query'][_0xd936('0x3c')]);_0x99d672[_0xd936('0x3d')]=qs[_0xd936('0x34')](_[_0xd936('0x3e')](_0x4c416a[_0xd936('0x32')],_0x4872ca[_0xd936('0x34')]),_0x4087a2);if(_0x4c416a['query'][_0xd936('0x3f')]){_0x99d672[_0xd936('0x3d')]=_[_0xd936('0x40')](_0x99d672[_0xd936('0x3d')],{'$or':_[_0xd936('0x41')](_0x4087a2,function(_0x364f5f){if(_0x364f5f['type']!==_0xd936('0x42')){var _0x203d6e={};_0x203d6e[_0x364f5f[_0xd936('0x2b')]]={'$like':'%'+_0x4c416a[_0xd936('0x32')]['filter']+'%'};return _0x203d6e;}})});}_0x99d672=_[_0xd936('0x40')]({},_0x99d672,_0x4c416a[_0xd936('0x43')]);var _0x5b21bf={'where':_0x99d672[_0xd936('0x3d')]};return db[_0xd936('0x2e')][_0xd936('0x1f')](_0x5b21bf)[_0xd936('0x25')](function(_0x33ad69){_0x11ea10[_0xd936('0x1f')]=_0x33ad69;if(_0x4c416a[_0xd936('0x32')][_0xd936('0x44')]){_0x99d672['include']=[{'all':!![]}];}return db['JscriptyProject'][_0xd936('0x45')](_0x99d672);})['then'](function(_0x16fd53){_0x11ea10[_0xd936('0x46')]=_0x16fd53;return _0x11ea10;})[_0xd936('0x25')](respondWithFilteredResult(_0x41b003,_0x99d672))[_0xd936('0x47')](handleError(_0x41b003,null));};exports[_0xd936('0x48')]=function(_0xb4d47b,_0x1d9c4c){var _0x24a141={'raw':![],'where':{'id':_0xb4d47b['params']['id']}},_0x391c33={};_0x391c33[_0xd936('0x36')]=_['keys'](db[_0xd936('0x2e')][_0xd936('0x49')]);_0x391c33[_0xd936('0x32')]=_[_0xd936('0x33')](_0xb4d47b[_0xd936('0x32')]);_0x391c33['filters']=_[_0xd936('0x35')](_0x391c33['model'],_0x391c33[_0xd936('0x32')]);_0x24a141['attributes']=_['intersection'](_0x391c33[_0xd936('0x36')],qs['fields'](_0xb4d47b[_0xd936('0x32')]['fields']));_0x24a141[_0xd936('0x37')]=_0x24a141['attributes'][_0xd936('0x4a')]?_0x24a141['attributes']:_0x391c33['model'];if(_0xb4d47b[_0xd936('0x32')][_0xd936('0x44')]){_0x24a141[_0xd936('0x4b')]=[{'all':!![]}];}_0x24a141=_[_0xd936('0x40')]({},_0x24a141,_0xb4d47b[_0xd936('0x43')]);return db[_0xd936('0x2e')][_0xd936('0x4c')](_0x24a141)[_0xd936('0x25')](handleEntityNotFound(_0x1d9c4c,null))[_0xd936('0x25')](respondWithResult(_0x1d9c4c,null))['catch'](handleError(_0x1d9c4c,null));};exports['create']=function(_0x1762f0,_0x1e7ace){return db[_0xd936('0x2e')][_0xd936('0x4d')](_0x1762f0[_0xd936('0x4e')],{})[_0xd936('0x25')](function(_0x4c9e5d){var _0x47f932=_0x1762f0['user'][_0xd936('0x4f')]({'plain':!![]});if(!_0x47f932)throw new Error(_0xd936('0x50'));if(_0x47f932[_0xd936('0x51')]===_0xd936('0x52')){var _0x4bdb1c=_0x4c9e5d[_0xd936('0x4f')]({'plain':!![]});var _0x42631e='Projects';return db[_0xd936('0x53')][_0xd936('0x4c')]({'where':{'name':_0x42631e,'userProfileId':_0x47f932['userProfileId']},'raw':!![]})[_0xd936('0x25')](function(_0x27887c){if(_0x27887c&&_0x27887c[_0xd936('0x54')]===0x0){return db[_0xd936('0x27')][_0xd936('0x4d')]({'name':_0x4bdb1c['name'],'resourceId':_0x4bdb1c['id'],'type':_0x27887c[_0xd936('0x2b')],'sectionId':_0x27887c['id']},{})[_0xd936('0x25')](function(){return _0x4c9e5d;});}else{return _0x4c9e5d;}})[_0xd936('0x47')](function(_0x427972){logger[_0xd936('0x29')](_0xd936('0x55'),_0x427972);throw _0x427972;});}return _0x4c9e5d;})['then'](respondWithResult(_0x1e7ace,0xc9))['catch'](handleError(_0x1e7ace,null));};exports['clone']=function(_0x1a3a80,_0x5140a2){var _0xa5c81f={'where':{'id':_0x1a3a80[_0xd936('0x56')]['id']}},_0x3860ab={};_0x3860ab[_0xd936('0x36')]=_[_0xd936('0x33')](db[_0xd936('0x2e')][_0xd936('0x49')]);_0xa5c81f[_0xd936('0x37')]=_['intersection'](_0x3860ab[_0xd936('0x36')],qs[_0xd936('0x38')](_0x1a3a80[_0xd936('0x32')][_0xd936('0x38')]));_0xa5c81f[_0xd936('0x37')]=_0xa5c81f['attributes'][_0xd936('0x4a')]?_0xa5c81f['attributes']:_0x3860ab[_0xd936('0x36')];if(_0x1a3a80[_0xd936('0x32')][_0xd936('0x44')]){_0xa5c81f['include']=[{'all':!![]}];}_0xa5c81f=_[_0xd936('0x40')]({},_0xa5c81f,_0x1a3a80['options']);return db[_0xd936('0x2e')][_0xd936('0x4c')](_0xa5c81f)[_0xd936('0x25')](handleEntityNotFound(_0x5140a2,null))['then'](function(_0x332342){if(_0x332342){var _0x55f0b7=_0x332342[_0xd936('0x4f')]({'plain':!![]});_0x55f0b7=qs[_0xd936('0x57')](_0x55f0b7,['id',_0xd936('0x58'),_0xd936('0x59')]);_0x1a3a80['body']=_[_0xd936('0x57')](_0x1a3a80[_0xd936('0x4e')],['id',_0xd936('0x58'),_0xd936('0x59')]);return db[_0xd936('0x2e')][_0xd936('0x4d')](_[_0xd936('0x40')](_0x55f0b7,_0x1a3a80[_0xd936('0x4e')]),{'include':_0x1a3a80['query'][_0xd936('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x5c2129){var _0x49bebb=_0x1a3a80[_0xd936('0x52')]['get']({'plain':!![]});if(!_0x49bebb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49bebb['role']==='user'){var _0x1838fb=_0x5c2129[_0xd936('0x4f')]({'plain':!![]});var _0x4b50a0=_0xd936('0x26');return db[_0xd936('0x53')]['find']({'where':{'name':_0x4b50a0,'userProfileId':_0x49bebb[_0xd936('0x5a')]},'raw':!![]})[_0xd936('0x25')](function(_0x41a12e){if(_0x41a12e&&_0x41a12e[_0xd936('0x54')]===0x0){return db[_0xd936('0x27')][_0xd936('0x4d')]({'name':_0x1838fb['name'],'resourceId':_0x1838fb['id'],'type':_0x41a12e['name'],'sectionId':_0x41a12e['id']},{})['then'](function(){return _0x5c2129;});}else{return _0x5c2129;}})[_0xd936('0x47')](function(_0x269260){logger[_0xd936('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x269260);throw _0x269260;});}return _0x5c2129;});}})[_0xd936('0x25')](respondWithResult(_0x5140a2,0xc9))[_0xd936('0x47')](handleError(_0x5140a2,null));};exports[_0xd936('0x24')]=function(_0x55030d,_0x4aeac0){if(_0x55030d[_0xd936('0x4e')]['id']){delete _0x55030d['body']['id'];}return db[_0xd936('0x2e')][_0xd936('0x4c')]({'where':{'id':_0x55030d[_0xd936('0x56')]['id']}})[_0xd936('0x25')](handleEntityNotFound(_0x4aeac0,null))[_0xd936('0x25')](saveUpdates(_0x55030d['body'],null))[_0xd936('0x25')](respondWithResult(_0x4aeac0,null))[_0xd936('0x47')](handleError(_0x4aeac0,null));};exports[_0xd936('0x28')]=function(_0x302529,_0x1da5c8){return db[_0xd936('0x2e')][_0xd936('0x4c')]({'where':{'id':_0x302529['params']['id']}})[_0xd936('0x25')](handleEntityNotFound(_0x1da5c8,null))[_0xd936('0x25')](removeEntity(_0x1da5c8,null))[_0xd936('0x47')](handleError(_0x1da5c8,null));};exports[_0xd936('0x5b')]=function(_0x237aac,_0x3b56b3,_0x549b6b){var _0x5ec004={'raw':!![],'where':{}};var _0x4f2baf={};var _0xdea2bd={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xd936('0x5c')]({'where':{'id':_0x237aac[_0xd936('0x56')]['id']}})['then'](handleEntityNotFound(_0x3b56b3,null))['then'](function(_0x6e7684){if(_0x6e7684){_0x4f2baf['model']=_[_0xd936('0x33')](db[_0xd936('0x5d')][_0xd936('0x49')]);_0x4f2baf['query']=_[_0xd936('0x33')](_0x237aac[_0xd936('0x32')]);_0x4f2baf[_0xd936('0x34')]=_['intersection'](_0x4f2baf['model'],_0x4f2baf[_0xd936('0x32')]);_0x5ec004[_0xd936('0x37')]=_[_0xd936('0x35')](_0x4f2baf['model'],qs[_0xd936('0x38')](_0x237aac[_0xd936('0x32')][_0xd936('0x38')]));_0x5ec004[_0xd936('0x37')]=_0x5ec004[_0xd936('0x37')]['length']?_0x5ec004['attributes']:_0x4f2baf[_0xd936('0x36')];if(!_0x237aac[_0xd936('0x32')][_0xd936('0x39')]('nolimit')){_0x5ec004[_0xd936('0x1e')]=qs['limit'](_0x237aac[_0xd936('0x32')]['limit']);_0x5ec004[_0xd936('0x1c')]=qs[_0xd936('0x1c')](_0x237aac[_0xd936('0x32')]['offset']);}_0x5ec004[_0xd936('0x3b')]=qs[_0xd936('0x3c')](_0x237aac[_0xd936('0x32')][_0xd936('0x3c')]);_0x5ec004['where']=qs[_0xd936('0x34')](_[_0xd936('0x3e')](_0x237aac['query'],_0x4f2baf[_0xd936('0x34')]));_0x5ec004[_0xd936('0x3d')]['ProjectId']=_0x6e7684['id'];if(_0x237aac[_0xd936('0x32')][_0xd936('0x3f')]){_0x5ec004[_0xd936('0x3d')]=_[_0xd936('0x40')](_0x5ec004[_0xd936('0x3d')],{'$or':_[_0xd936('0x41')](_0x5ec004[_0xd936('0x37')],function(_0x365ae1){var _0x10601f={};_0x10601f[_0x365ae1]={'$like':'%'+_0x237aac[_0xd936('0x32')][_0xd936('0x3f')]+'%'};return _0x10601f;})});}_0x5ec004=_[_0xd936('0x40')]({},_0x5ec004,_0x237aac[_0xd936('0x43')]);return db['JscriptySessionReport']['count']({'where':_0x5ec004[_0xd936('0x3d')]})[_0xd936('0x25')](function(_0x1e410d){_0xdea2bd[_0xd936('0x1f')]=_0x1e410d;if(_0x237aac[_0xd936('0x32')][_0xd936('0x44')]){_0x5ec004[_0xd936('0x4b')]=[{'all':!![]}];}return db[_0xd936('0x5d')]['findAll'](_0x5ec004);})['then'](function(_0x2cb900){_0xdea2bd['rows']=_0x2cb900;return _0xdea2bd;});}})['then'](respondWithFilteredResult(_0x3b56b3,_0x5ec004))[_0xd936('0x47')](handleError(_0x3b56b3,null));};exports[_0xd936('0x5e')]=function(_0xd8a27,_0x536000,_0xd77cad){var _0x478a5c={'raw':!![],'where':{}};var _0x534959={};var _0x45ca8f={'count':0x0,'rows':[]};return db[_0xd936('0x2e')]['findOne']({'where':{'id':_0xd8a27['params']['id']}})[_0xd936('0x25')](handleEntityNotFound(_0x536000,null))['then'](function(_0x2881e1){if(_0x2881e1){_0x534959['model']=_[_0xd936('0x33')](db[_0xd936('0x5f')]['rawAttributes']);_0x534959[_0xd936('0x32')]=_[_0xd936('0x33')](_0xd8a27[_0xd936('0x32')]);_0x534959[_0xd936('0x34')]=_[_0xd936('0x35')](_0x534959['model'],_0x534959[_0xd936('0x32')]);_0x478a5c[_0xd936('0x37')]=_[_0xd936('0x35')](_0x534959[_0xd936('0x36')],qs[_0xd936('0x38')](_0xd8a27[_0xd936('0x32')][_0xd936('0x38')]));_0x478a5c[_0xd936('0x37')]=_0x478a5c[_0xd936('0x37')][_0xd936('0x4a')]?_0x478a5c[_0xd936('0x37')]:_0x534959['model'];if(!_0xd8a27[_0xd936('0x32')][_0xd936('0x39')](_0xd936('0x3a'))){_0x478a5c[_0xd936('0x1e')]=qs[_0xd936('0x1e')](_0xd8a27[_0xd936('0x32')][_0xd936('0x1e')]);_0x478a5c[_0xd936('0x1c')]=qs[_0xd936('0x1c')](_0xd8a27['query'][_0xd936('0x1c')]);}_0x478a5c['order']=qs['sort'](_0xd8a27['query'][_0xd936('0x3c')]);_0x478a5c['where']=qs[_0xd936('0x34')](_[_0xd936('0x3e')](_0xd8a27[_0xd936('0x32')],_0x534959[_0xd936('0x34')]));_0x478a5c[_0xd936('0x3d')][_0xd936('0x60')]=_0x2881e1['id'];if(_0xd8a27['query']['filter']){_0x478a5c[_0xd936('0x3d')]=_[_0xd936('0x40')](_0x478a5c[_0xd936('0x3d')],{'$or':_['map'](_0x478a5c[_0xd936('0x37')],function(_0x13b096){var _0x126e60={};_0x126e60[_0x13b096]={'$like':'%'+_0xd8a27[_0xd936('0x32')][_0xd936('0x3f')]+'%'};return _0x126e60;})});}_0x478a5c=_[_0xd936('0x40')]({},_0x478a5c,_0xd8a27[_0xd936('0x43')]);return db[_0xd936('0x5f')]['count']({'where':_0x478a5c['where']})[_0xd936('0x25')](function(_0x1cc3d7){_0x45ca8f[_0xd936('0x1f')]=_0x1cc3d7;if(_0xd8a27[_0xd936('0x32')][_0xd936('0x44')]){_0x478a5c[_0xd936('0x4b')]=[{'all':!![]}];}return db[_0xd936('0x5f')]['findAll'](_0x478a5c);})[_0xd936('0x25')](function(_0x3d1b78){_0x45ca8f[_0xd936('0x46')]=_0x3d1b78;return _0x45ca8f;});}})[_0xd936('0x25')](respondWithFilteredResult(_0x536000,_0x478a5c))[_0xd936('0x47')](handleError(_0x536000,null));};function char(_0x3b94a2){return _0xd936('0x61')===typeof _0x3b94a2?String[_0xd936('0x62')][_0xd936('0x63')](null,arguments):_0x3b94a2;}function needsEncapsulation(_0x3faafa){return!!_0x3faafa&&(_0x3faafa[_0xd936('0x64')]()[_0xd936('0x65')](char(0xd))>=0x0||_0x3faafa[_0xd936('0x64')]()[_0xd936('0x65')](char(0xa))>=0x0||_0x3faafa[_0xd936('0x64')]()[_0xd936('0x65')](char(0x2c))>=0x0||_0x3faafa[_0xd936('0x64')]()[_0xd936('0x65')](char(0x22))>=0x0);}function encapsulate(_0x685a12){var _0x30ea1b=char(0x22),_0x474a3e='\x5c'+char(0x22),_0x7dc026=_0x685a12[_0xd936('0x64')]()[_0xd936('0x66')](new RegExp(_0x30ea1b,'g'),_0x474a3e);return _0x30ea1b+_0x7dc026+_0x30ea1b;}exports[_0xd936('0x67')]=function(_0x3ce5f1,_0x18b5e1,_0x1e072a){var _0x552c76,_0x2188c1;var _0x1f2d29={'where':{'ProjectId':_0x3ce5f1[_0xd936('0x56')]['id']}};if(_0x3ce5f1[_0xd936('0x32')][_0xd936('0x68')]){_0x1f2d29[_0xd936('0x3d')]['starttime']=JSON[_0xd936('0x69')](_0x3ce5f1[_0xd936('0x32')]['startTime']);}return db[_0xd936('0x5d')][_0xd936('0x45')](_0x1f2d29)[_0xd936('0x25')](handleEntityNotFound(_0x18b5e1,null))[_0xd936('0x25')](function(_0x15a1f3){if(_0x15a1f3){_0x552c76=_0x15a1f3;return db['JscriptyQuestionReport'][_0xd936('0x45')]({'where':{'SessionId':{'$in':_[_0xd936('0x41')](_0x552c76,'id')},'ProjectId':_0x3ce5f1['params']['id']},'order':_0xd936('0x6a')});}})[_0xd936('0x25')](handleEntityNotFound(_0x18b5e1,null))[_0xd936('0x25')](function(_0x5046c5){if(_0x5046c5){_0x2188c1=_0x5046c5;var _0x38f3e7={};for(var _0x1699dc=0x0,_0x274cfa=_0x2188c1[_0xd936('0x4a')];_0x1699dc<_0x274cfa;_0x1699dc++){if(!_0x38f3e7[_0xd936('0x39')](_0x2188c1[_0x1699dc][_0xd936('0x6b')])){_0x38f3e7[_0x2188c1[_0x1699dc][_0xd936('0x6b')]]=needsEncapsulation(_0x2188c1[_0x1699dc][_0xd936('0x6c')])?encapsulate(_0x2188c1[_0x1699dc][_0xd936('0x6c')]):_0x2188c1[_0x1699dc]['question'];}}var _0x575cd4=[],_0x290492={};for(var _0x41c65e=0x0,_0x1d8f12=_0x552c76[_0xd936('0x4a')];_0x41c65e<_0x1d8f12;_0x41c65e++){_0x290492={'ProjectId':_0x3ce5f1[_0xd936('0x56')]['id'],'SessionId':_0x552c76[_0x41c65e]['id'],'StartTime':moment(_0x552c76[_0x41c65e][_0xd936('0x6d')])[_0xd936('0x6e')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x302f24=0x0,_0x25f353=_0x2188c1[_0xd936('0x4a')];_0x302f24<_0x25f353;_0x302f24++){if(_0x2188c1[_0x302f24][_0xd936('0x6f')]==_0x552c76[_0x41c65e]['id']&&_0x38f3e7['hasOwnProperty'](_0x2188c1[_0x302f24][_0xd936('0x6b')])){_0x290492[_0x38f3e7[_0x2188c1[_0x302f24]['questionId']]]=_0x2188c1[_0x302f24]['answer'];}}for(var _0x4a6786 in _0x38f3e7){if(!_0x290492['hasOwnProperty'](_0x38f3e7[_0x4a6786])){_0x290492[_0x38f3e7[_0x4a6786]]=null;}}_0x575cd4[_0xd936('0x70')](_0x290492);}return _0x575cd4;}})[_0xd936('0x25')](function(_0x2e0a91){if(!_[_0xd936('0x71')](_0x2e0a91)){var _0x5be4dc=toCsv(_0x2e0a91);var _0xca355=Date[_0xd936('0x72')]();fs['writeFileSync'](util[_0xd936('0x6e')](_0xd936('0x73'),_0x3ce5f1[_0xd936('0x56')]['id'],_0xca355),_0x5be4dc);_0x18b5e1['setHeader'](_0xd936('0x74'),_0xd936('0x75')+util[_0xd936('0x6e')]('Jscripty_Project_%d_Summary_%s.csv',_0x3ce5f1['params']['id'],_0xca355));_0x18b5e1[_0xd936('0x76')](_0xd936('0x77'),_0xd936('0x78'));return _0x18b5e1[_0xd936('0x79')](util[_0xd936('0x6e')](_0xd936('0x73'),_0x3ce5f1['params']['id'],_0xca355));}else{return _0x18b5e1['sendStatus'](0xcc);}})[_0xd936('0x47')](handleError(_0x18b5e1,null));}; \ No newline at end of file +var _0x7633=['../../mysqldb','sendStatus','end','status','json','offset','count','set','Content-Range','apply','reject','update','destroy','then','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','JscriptyProject','findAll','rows','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','include','omit','createdAt','getSessions','findOne','JscriptySessionReport','sort','getAnswers','JscriptyAnswerReport','ProjectId','number','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x7633,0x1c4));var _0x3763=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7633[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3763('0x0'));var rimraf=require(_0x3763('0x1'));var zipdir=require(_0x3763('0x2'));var jsonpatch=require(_0x3763('0x3'));var rp=require(_0x3763('0x4'));var moment=require('moment');var BPromise=require(_0x3763('0x5'));var Mustache=require(_0x3763('0x6'));var util=require('util');var path=require(_0x3763('0x7'));var sox=require(_0x3763('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3763('0x9'));var _=require(_0x3763('0xa'));var squel=require(_0x3763('0xb'));var crypto=require(_0x3763('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3763('0xd'));var querystring=require(_0x3763('0xe'));var Papa=require('papaparse');var Redis=require(_0x3763('0xf'));var authService=require(_0x3763('0x10'));var qs=require(_0x3763('0x11'));var as=require(_0x3763('0x12'));var hardwareService=require(_0x3763('0x13'));var logger=require(_0x3763('0x14'))(_0x3763('0x15'));var utils=require(_0x3763('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3763('0x17'));var db=require(_0x3763('0x18'))['db'];function respondWithStatusCode(_0x11d390,_0x52728b){_0x52728b=_0x52728b||0xcc;return function(_0x59980c){if(_0x59980c){return _0x11d390[_0x3763('0x19')](_0x52728b);}return _0x11d390['status'](_0x52728b)[_0x3763('0x1a')]();};}function respondWithResult(_0x12582e,_0xf9d237){_0xf9d237=_0xf9d237||0xc8;return function(_0x3d91da){if(_0x3d91da){return _0x12582e[_0x3763('0x1b')](_0xf9d237)[_0x3763('0x1c')](_0x3d91da);}};}function respondWithFilteredResult(_0x1110e0,_0x4c877a){return function(_0xa95c5b){if(_0xa95c5b){var _0x368434=typeof _0x4c877a[_0x3763('0x1d')]==='undefined'&&typeof _0x4c877a['limit']==='undefined';var _0x1bb7bc=_0xa95c5b[_0x3763('0x1e')];var _0x33dd0e=_0x368434?0x0:_0x4c877a[_0x3763('0x1d')];var _0x23087d=_0x368434?_0xa95c5b[_0x3763('0x1e')]:_0x4c877a[_0x3763('0x1d')]+_0x4c877a['limit'];var _0x38a33f;if(_0x23087d>=_0x1bb7bc){_0x23087d=_0x1bb7bc;_0x38a33f=0xc8;}else{_0x38a33f=0xce;}_0x1110e0[_0x3763('0x1b')](_0x38a33f);return _0x1110e0[_0x3763('0x1f')](_0x3763('0x20'),_0x33dd0e+'-'+_0x23087d+'/'+_0x1bb7bc)['json'](_0xa95c5b);}return null;};}function patchUpdates(_0x485836){return function(_0x2cb398){try{jsonpatch[_0x3763('0x21')](_0x2cb398,_0x485836,!![]);}catch(_0x427c15){return BPromise[_0x3763('0x22')](_0x427c15);}return _0x2cb398['save']();};}function saveUpdates(_0x36ff74,_0x5e5f4e){return function(_0xafb9f5){if(_0xafb9f5){return _0xafb9f5[_0x3763('0x23')](_0x36ff74)['then'](function(_0x3083e){return _0x3083e;});}return null;};}function removeEntity(_0x195945,_0xa53ba5){return function(_0xd6086f){if(_0xd6086f){return _0xd6086f[_0x3763('0x24')]()[_0x3763('0x25')](function(){var _0x6ebb90=_0xd6086f['get']({'plain':!![]});var _0x57036c='Projects';return db[_0x3763('0x26')][_0x3763('0x24')]({'where':{'type':_0x57036c,'resourceId':_0x6ebb90['id']}})[_0x3763('0x25')](function(){return _0xd6086f;});})[_0x3763('0x25')](function(){_0x195945[_0x3763('0x1b')](0xcc)[_0x3763('0x1a')]();});}};}function handleEntityNotFound(_0x53e7ba,_0x11d18f){return function(_0x3525d1){if(!_0x3525d1){_0x53e7ba[_0x3763('0x19')](0x194);}return _0x3525d1;};}function handleError(_0x339870,_0x136c67){_0x136c67=_0x136c67||0x1f4;return function(_0x4f9a96){logger[_0x3763('0x27')](_0x4f9a96[_0x3763('0x28')]);if(_0x4f9a96[_0x3763('0x29')]){delete _0x4f9a96['name'];}_0x339870[_0x3763('0x1b')](_0x136c67)[_0x3763('0x2a')](_0x4f9a96);};}exports[_0x3763('0x2b')]=function(_0x4b04ef,_0x2cfbb2){var _0xe49897={},_0x399f84={},_0x21b7a4={'count':0x0,'rows':[]};var _0x44cce6=_['map'](db['JscriptyProject'][_0x3763('0x2c')],function(_0x15479e){return{'name':_0x15479e[_0x3763('0x2d')],'type':_0x15479e[_0x3763('0x2e')][_0x3763('0x2f')]};});_0x399f84[_0x3763('0x30')]=_[_0x3763('0x31')](_0x44cce6,_0x3763('0x29'));_0x399f84['query']=_[_0x3763('0x32')](_0x4b04ef[_0x3763('0x33')]);_0x399f84[_0x3763('0x34')]=_[_0x3763('0x35')](_0x399f84['model'],_0x399f84['query']);_0xe49897['attributes']=_['intersection'](_0x399f84[_0x3763('0x30')],qs[_0x3763('0x36')](_0x4b04ef['query'][_0x3763('0x36')]));_0xe49897[_0x3763('0x37')]=_0xe49897['attributes'][_0x3763('0x38')]?_0xe49897[_0x3763('0x37')]:_0x399f84[_0x3763('0x30')];if(!_0x4b04ef[_0x3763('0x33')][_0x3763('0x39')](_0x3763('0x3a'))){_0xe49897[_0x3763('0x3b')]=qs[_0x3763('0x3b')](_0x4b04ef['query'][_0x3763('0x3b')]);_0xe49897[_0x3763('0x1d')]=qs['offset'](_0x4b04ef[_0x3763('0x33')][_0x3763('0x1d')]);}_0xe49897[_0x3763('0x3c')]=qs['sort'](_0x4b04ef[_0x3763('0x33')]['sort']);_0xe49897[_0x3763('0x3d')]=qs['filters'](_[_0x3763('0x3e')](_0x4b04ef[_0x3763('0x33')],_0x399f84['filters']),_0x44cce6);if(_0x4b04ef[_0x3763('0x33')][_0x3763('0x3f')]){_0xe49897[_0x3763('0x3d')]=_[_0x3763('0x40')](_0xe49897['where'],{'$or':_[_0x3763('0x31')](_0x44cce6,function(_0x46623a){if(_0x46623a['type']!==_0x3763('0x41')){var _0x2759a6={};_0x2759a6[_0x46623a['name']]={'$like':'%'+_0x4b04ef[_0x3763('0x33')][_0x3763('0x3f')]+'%'};return _0x2759a6;}})});}_0xe49897=_[_0x3763('0x40')]({},_0xe49897,_0x4b04ef[_0x3763('0x42')]);var _0x524b12={'where':_0xe49897[_0x3763('0x3d')]};return db[_0x3763('0x43')][_0x3763('0x1e')](_0x524b12)[_0x3763('0x25')](function(_0x4addb2){_0x21b7a4['count']=_0x4addb2;if(_0x4b04ef['query']['includeAll']){_0xe49897['include']=[{'all':!![]}];}return db[_0x3763('0x43')][_0x3763('0x44')](_0xe49897);})[_0x3763('0x25')](function(_0x4d27aa){_0x21b7a4[_0x3763('0x45')]=_0x4d27aa;return _0x21b7a4;})[_0x3763('0x25')](respondWithFilteredResult(_0x2cfbb2,_0xe49897))[_0x3763('0x46')](handleError(_0x2cfbb2,null));};exports[_0x3763('0x47')]=function(_0x33ddc1,_0x1b5658){var _0x79504d={'raw':![],'where':{'id':_0x33ddc1[_0x3763('0x48')]['id']}},_0x2ac7a5={};_0x2ac7a5[_0x3763('0x30')]=_[_0x3763('0x32')](db['JscriptyProject']['rawAttributes']);_0x2ac7a5['query']=_[_0x3763('0x32')](_0x33ddc1[_0x3763('0x33')]);_0x2ac7a5[_0x3763('0x34')]=_[_0x3763('0x35')](_0x2ac7a5['model'],_0x2ac7a5[_0x3763('0x33')]);_0x79504d['attributes']=_[_0x3763('0x35')](_0x2ac7a5[_0x3763('0x30')],qs[_0x3763('0x36')](_0x33ddc1[_0x3763('0x33')][_0x3763('0x36')]));_0x79504d[_0x3763('0x37')]=_0x79504d[_0x3763('0x37')]['length']?_0x79504d[_0x3763('0x37')]:_0x2ac7a5[_0x3763('0x30')];if(_0x33ddc1[_0x3763('0x33')][_0x3763('0x49')]){_0x79504d['include']=[{'all':!![]}];}_0x79504d=_['merge']({},_0x79504d,_0x33ddc1[_0x3763('0x42')]);return db['JscriptyProject'][_0x3763('0x4a')](_0x79504d)['then'](handleEntityNotFound(_0x1b5658,null))['then'](respondWithResult(_0x1b5658,null))[_0x3763('0x46')](handleError(_0x1b5658,null));};exports[_0x3763('0x4b')]=function(_0x1be9fb,_0x3eb842){return db[_0x3763('0x43')][_0x3763('0x4b')](_0x1be9fb[_0x3763('0x4c')],{})['then'](function(_0x261799){var _0x14f0ca=_0x1be9fb[_0x3763('0x4d')][_0x3763('0x4e')]({'plain':!![]});if(!_0x14f0ca)throw new Error(_0x3763('0x4f'));if(_0x14f0ca['role']===_0x3763('0x4d')){var _0x197a9d=_0x261799[_0x3763('0x4e')]({'plain':!![]});var _0x5d0230=_0x3763('0x50');return db[_0x3763('0x51')]['find']({'where':{'name':_0x5d0230,'userProfileId':_0x14f0ca[_0x3763('0x52')]},'raw':!![]})['then'](function(_0x4fca59){if(_0x4fca59&&_0x4fca59[_0x3763('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x197a9d['name'],'resourceId':_0x197a9d['id'],'type':_0x4fca59[_0x3763('0x29')],'sectionId':_0x4fca59['id']},{})[_0x3763('0x25')](function(){return _0x261799;});}else{return _0x261799;}})[_0x3763('0x46')](function(_0x281547){logger[_0x3763('0x27')](_0x3763('0x54'),_0x281547);throw _0x281547;});}return _0x261799;})[_0x3763('0x25')](respondWithResult(_0x3eb842,0xc9))[_0x3763('0x46')](handleError(_0x3eb842,null));};exports['clone']=function(_0x26dc5a,_0x5d83a8){var _0x3cad77={'where':{'id':_0x26dc5a['params']['id']}},_0x21975b={};_0x21975b[_0x3763('0x30')]=_['keys'](db['JscriptyProject'][_0x3763('0x2c')]);_0x3cad77[_0x3763('0x37')]=_[_0x3763('0x35')](_0x21975b['model'],qs[_0x3763('0x36')](_0x26dc5a['query'][_0x3763('0x36')]));_0x3cad77['attributes']=_0x3cad77[_0x3763('0x37')][_0x3763('0x38')]?_0x3cad77[_0x3763('0x37')]:_0x21975b[_0x3763('0x30')];if(_0x26dc5a[_0x3763('0x33')][_0x3763('0x49')]){_0x3cad77[_0x3763('0x55')]=[{'all':!![]}];}_0x3cad77=_[_0x3763('0x40')]({},_0x3cad77,_0x26dc5a[_0x3763('0x42')]);return db['JscriptyProject'][_0x3763('0x4a')](_0x3cad77)['then'](handleEntityNotFound(_0x5d83a8,null))[_0x3763('0x25')](function(_0x52cf8f){if(_0x52cf8f){var _0x1be0e8=_0x52cf8f[_0x3763('0x4e')]({'plain':!![]});_0x1be0e8=qs[_0x3763('0x56')](_0x1be0e8,['id',_0x3763('0x57'),'updatedAt']);_0x26dc5a[_0x3763('0x4c')]=_[_0x3763('0x56')](_0x26dc5a[_0x3763('0x4c')],['id',_0x3763('0x57'),'updatedAt']);return db[_0x3763('0x43')][_0x3763('0x4b')](_['merge'](_0x1be0e8,_0x26dc5a[_0x3763('0x4c')]),{'include':_0x26dc5a['query']['includeAll']?[{'all':!![]}]:undefined})[_0x3763('0x25')](function(_0x160e40){var _0x1a2dd3=_0x26dc5a[_0x3763('0x4d')][_0x3763('0x4e')]({'plain':!![]});if(!_0x1a2dd3)throw new Error(_0x3763('0x4f'));if(_0x1a2dd3['role']===_0x3763('0x4d')){var _0x570a5e=_0x160e40[_0x3763('0x4e')]({'plain':!![]});var _0x3c03b4=_0x3763('0x50');return db[_0x3763('0x51')][_0x3763('0x4a')]({'where':{'name':_0x3c03b4,'userProfileId':_0x1a2dd3['userProfileId']},'raw':!![]})[_0x3763('0x25')](function(_0x464d24){if(_0x464d24&&_0x464d24[_0x3763('0x53')]===0x0){return db[_0x3763('0x26')][_0x3763('0x4b')]({'name':_0x570a5e[_0x3763('0x29')],'resourceId':_0x570a5e['id'],'type':_0x464d24[_0x3763('0x29')],'sectionId':_0x464d24['id']},{})[_0x3763('0x25')](function(){return _0x160e40;});}else{return _0x160e40;}})[_0x3763('0x46')](function(_0x5d72c8){logger[_0x3763('0x27')](_0x3763('0x54'),_0x5d72c8);throw _0x5d72c8;});}return _0x160e40;});}})[_0x3763('0x25')](respondWithResult(_0x5d83a8,0xc9))[_0x3763('0x46')](handleError(_0x5d83a8,null));};exports['update']=function(_0x294a57,_0x3e63e4){if(_0x294a57['body']['id']){delete _0x294a57[_0x3763('0x4c')]['id'];}return db[_0x3763('0x43')][_0x3763('0x4a')]({'where':{'id':_0x294a57['params']['id']}})[_0x3763('0x25')](handleEntityNotFound(_0x3e63e4,null))[_0x3763('0x25')](saveUpdates(_0x294a57[_0x3763('0x4c')],null))[_0x3763('0x25')](respondWithResult(_0x3e63e4,null))['catch'](handleError(_0x3e63e4,null));};exports[_0x3763('0x24')]=function(_0x202f58,_0x534c81){return db[_0x3763('0x43')]['find']({'where':{'id':_0x202f58[_0x3763('0x48')]['id']}})[_0x3763('0x25')](handleEntityNotFound(_0x534c81,null))[_0x3763('0x25')](removeEntity(_0x534c81,null))[_0x3763('0x46')](handleError(_0x534c81,null));};exports[_0x3763('0x58')]=function(_0x46758e,_0x3c75c9,_0x37ff53){var _0x124287={'raw':!![],'where':{}};var _0x4cee6b={};var _0xe6e8cd={'count':0x0,'rows':[]};return db[_0x3763('0x43')][_0x3763('0x59')]({'where':{'id':_0x46758e[_0x3763('0x48')]['id']}})['then'](handleEntityNotFound(_0x3c75c9,null))['then'](function(_0x1945f8){if(_0x1945f8){_0x4cee6b['model']=_[_0x3763('0x32')](db[_0x3763('0x5a')]['rawAttributes']);_0x4cee6b['query']=_[_0x3763('0x32')](_0x46758e[_0x3763('0x33')]);_0x4cee6b[_0x3763('0x34')]=_[_0x3763('0x35')](_0x4cee6b[_0x3763('0x30')],_0x4cee6b[_0x3763('0x33')]);_0x124287[_0x3763('0x37')]=_['intersection'](_0x4cee6b[_0x3763('0x30')],qs[_0x3763('0x36')](_0x46758e[_0x3763('0x33')][_0x3763('0x36')]));_0x124287['attributes']=_0x124287['attributes'][_0x3763('0x38')]?_0x124287[_0x3763('0x37')]:_0x4cee6b[_0x3763('0x30')];if(!_0x46758e[_0x3763('0x33')][_0x3763('0x39')]('nolimit')){_0x124287['limit']=qs['limit'](_0x46758e[_0x3763('0x33')][_0x3763('0x3b')]);_0x124287['offset']=qs[_0x3763('0x1d')](_0x46758e[_0x3763('0x33')][_0x3763('0x1d')]);}_0x124287['order']=qs['sort'](_0x46758e[_0x3763('0x33')][_0x3763('0x5b')]);_0x124287[_0x3763('0x3d')]=qs[_0x3763('0x34')](_[_0x3763('0x3e')](_0x46758e['query'],_0x4cee6b['filters']));_0x124287[_0x3763('0x3d')]['ProjectId']=_0x1945f8['id'];if(_0x46758e['query'][_0x3763('0x3f')]){_0x124287[_0x3763('0x3d')]=_['merge'](_0x124287[_0x3763('0x3d')],{'$or':_[_0x3763('0x31')](_0x124287[_0x3763('0x37')],function(_0x627bb4){var _0xab6417={};_0xab6417[_0x627bb4]={'$like':'%'+_0x46758e[_0x3763('0x33')][_0x3763('0x3f')]+'%'};return _0xab6417;})});}_0x124287=_['merge']({},_0x124287,_0x46758e[_0x3763('0x42')]);return db[_0x3763('0x5a')]['count']({'where':_0x124287[_0x3763('0x3d')]})[_0x3763('0x25')](function(_0x5d28a5){_0xe6e8cd[_0x3763('0x1e')]=_0x5d28a5;if(_0x46758e[_0x3763('0x33')][_0x3763('0x49')]){_0x124287['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x3763('0x44')](_0x124287);})[_0x3763('0x25')](function(_0x39549f){_0xe6e8cd[_0x3763('0x45')]=_0x39549f;return _0xe6e8cd;});}})[_0x3763('0x25')](respondWithFilteredResult(_0x3c75c9,_0x124287))[_0x3763('0x46')](handleError(_0x3c75c9,null));};exports[_0x3763('0x5c')]=function(_0x176551,_0x230947,_0x2c309e){var _0x375a6c={'raw':!![],'where':{}};var _0x5d2eb6={};var _0x334985={'count':0x0,'rows':[]};return db[_0x3763('0x43')][_0x3763('0x59')]({'where':{'id':_0x176551[_0x3763('0x48')]['id']}})[_0x3763('0x25')](handleEntityNotFound(_0x230947,null))[_0x3763('0x25')](function(_0x648f74){if(_0x648f74){_0x5d2eb6[_0x3763('0x30')]=_[_0x3763('0x32')](db[_0x3763('0x5d')][_0x3763('0x2c')]);_0x5d2eb6[_0x3763('0x33')]=_['keys'](_0x176551[_0x3763('0x33')]);_0x5d2eb6[_0x3763('0x34')]=_[_0x3763('0x35')](_0x5d2eb6[_0x3763('0x30')],_0x5d2eb6[_0x3763('0x33')]);_0x375a6c[_0x3763('0x37')]=_[_0x3763('0x35')](_0x5d2eb6[_0x3763('0x30')],qs[_0x3763('0x36')](_0x176551[_0x3763('0x33')][_0x3763('0x36')]));_0x375a6c['attributes']=_0x375a6c[_0x3763('0x37')][_0x3763('0x38')]?_0x375a6c[_0x3763('0x37')]:_0x5d2eb6[_0x3763('0x30')];if(!_0x176551[_0x3763('0x33')][_0x3763('0x39')](_0x3763('0x3a'))){_0x375a6c['limit']=qs[_0x3763('0x3b')](_0x176551[_0x3763('0x33')][_0x3763('0x3b')]);_0x375a6c[_0x3763('0x1d')]=qs[_0x3763('0x1d')](_0x176551[_0x3763('0x33')]['offset']);}_0x375a6c['order']=qs[_0x3763('0x5b')](_0x176551['query'][_0x3763('0x5b')]);_0x375a6c[_0x3763('0x3d')]=qs['filters'](_['pick'](_0x176551['query'],_0x5d2eb6[_0x3763('0x34')]));_0x375a6c['where'][_0x3763('0x5e')]=_0x648f74['id'];if(_0x176551[_0x3763('0x33')]['filter']){_0x375a6c['where']=_[_0x3763('0x40')](_0x375a6c[_0x3763('0x3d')],{'$or':_[_0x3763('0x31')](_0x375a6c[_0x3763('0x37')],function(_0x419d83){var _0x283faa={};_0x283faa[_0x419d83]={'$like':'%'+_0x176551[_0x3763('0x33')][_0x3763('0x3f')]+'%'};return _0x283faa;})});}_0x375a6c=_[_0x3763('0x40')]({},_0x375a6c,_0x176551[_0x3763('0x42')]);return db[_0x3763('0x5d')][_0x3763('0x1e')]({'where':_0x375a6c[_0x3763('0x3d')]})[_0x3763('0x25')](function(_0x207f41){_0x334985['count']=_0x207f41;if(_0x176551[_0x3763('0x33')][_0x3763('0x49')]){_0x375a6c[_0x3763('0x55')]=[{'all':!![]}];}return db[_0x3763('0x5d')][_0x3763('0x44')](_0x375a6c);})[_0x3763('0x25')](function(_0x142115){_0x334985[_0x3763('0x45')]=_0x142115;return _0x334985;});}})[_0x3763('0x25')](respondWithFilteredResult(_0x230947,_0x375a6c))[_0x3763('0x46')](handleError(_0x230947,null));};function char(_0x24e6ee){return _0x3763('0x5f')===typeof _0x24e6ee?String['fromCharCode'][_0x3763('0x21')](null,arguments):_0x24e6ee;}function needsEncapsulation(_0x58a8bc){return!!_0x58a8bc&&(_0x58a8bc[_0x3763('0x60')]()['indexOf'](char(0xd))>=0x0||_0x58a8bc['toString']()[_0x3763('0x61')](char(0xa))>=0x0||_0x58a8bc['toString']()[_0x3763('0x61')](char(0x2c))>=0x0||_0x58a8bc[_0x3763('0x60')]()[_0x3763('0x61')](char(0x22))>=0x0);}function encapsulate(_0x1fec93){var _0x504e3a=char(0x22),_0x3dd0fe='\x5c'+char(0x22),_0x24ac48=_0x1fec93[_0x3763('0x60')]()[_0x3763('0x62')](new RegExp(_0x504e3a,'g'),_0x3dd0fe);return _0x504e3a+_0x24ac48+_0x504e3a;}exports[_0x3763('0x63')]=function(_0xa894ae,_0x2603d6,_0x3d412d){var _0x3267cb,_0x2e8930;var _0x1ae5da={'where':{'ProjectId':_0xa894ae[_0x3763('0x48')]['id']}};if(_0xa894ae[_0x3763('0x33')][_0x3763('0x64')]){_0x1ae5da[_0x3763('0x3d')][_0x3763('0x65')]=JSON[_0x3763('0x66')](_0xa894ae[_0x3763('0x33')][_0x3763('0x64')]);}return db['JscriptySessionReport'][_0x3763('0x44')](_0x1ae5da)[_0x3763('0x25')](handleEntityNotFound(_0x2603d6,null))['then'](function(_0x381926){if(_0x381926){_0x3267cb=_0x381926;return db[_0x3763('0x67')]['findAll']({'where':{'SessionId':{'$in':_[_0x3763('0x31')](_0x3267cb,'id')},'ProjectId':_0xa894ae[_0x3763('0x48')]['id']},'order':_0x3763('0x68')});}})[_0x3763('0x25')](handleEntityNotFound(_0x2603d6,null))[_0x3763('0x25')](function(_0x446fb5){if(_0x446fb5){_0x2e8930=_0x446fb5;var _0x12da24={};for(var _0x9dcfea=0x0,_0x405d9a=_0x2e8930[_0x3763('0x38')];_0x9dcfea<_0x405d9a;_0x9dcfea++){if(!_0x12da24[_0x3763('0x39')](_0x2e8930[_0x9dcfea][_0x3763('0x69')])){_0x12da24[_0x2e8930[_0x9dcfea][_0x3763('0x69')]]=needsEncapsulation(_0x2e8930[_0x9dcfea][_0x3763('0x6a')])?encapsulate(_0x2e8930[_0x9dcfea][_0x3763('0x6a')]):_0x2e8930[_0x9dcfea]['question'];}}var _0x11160e=[],_0x59e7c3={};for(var _0x5ec730=0x0,_0x10316f=_0x3267cb[_0x3763('0x38')];_0x5ec730<_0x10316f;_0x5ec730++){_0x59e7c3={'ProjectId':_0xa894ae[_0x3763('0x48')]['id'],'SessionId':_0x3267cb[_0x5ec730]['id'],'StartTime':moment(_0x3267cb[_0x5ec730][_0x3763('0x65')])[_0x3763('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x51c501=0x0,_0x6aceb3=_0x2e8930[_0x3763('0x38')];_0x51c501<_0x6aceb3;_0x51c501++){if(_0x2e8930[_0x51c501][_0x3763('0x6c')]==_0x3267cb[_0x5ec730]['id']&&_0x12da24['hasOwnProperty'](_0x2e8930[_0x51c501][_0x3763('0x69')])){_0x59e7c3[_0x12da24[_0x2e8930[_0x51c501][_0x3763('0x69')]]]=_0x2e8930[_0x51c501][_0x3763('0x6d')];}}for(var _0x58fd89 in _0x12da24){if(!_0x59e7c3[_0x3763('0x39')](_0x12da24[_0x58fd89])){_0x59e7c3[_0x12da24[_0x58fd89]]=null;}}_0x11160e['push'](_0x59e7c3);}return _0x11160e;}})[_0x3763('0x25')](function(_0x2fee74){if(!_[_0x3763('0x6e')](_0x2fee74)){var _0x198323=toCsv(_0x2fee74);var _0x238b48=Date[_0x3763('0x6f')]();fs['writeFileSync'](util[_0x3763('0x6b')](_0x3763('0x70'),_0xa894ae[_0x3763('0x48')]['id'],_0x238b48),_0x198323);_0x2603d6['setHeader'](_0x3763('0x71'),'attachment;\x20filename='+util[_0x3763('0x6b')](_0x3763('0x72'),_0xa894ae[_0x3763('0x48')]['id'],_0x238b48));_0x2603d6[_0x3763('0x73')](_0x3763('0x74'),_0x3763('0x75'));return _0x2603d6[_0x3763('0x76')](util[_0x3763('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xa894ae[_0x3763('0x48')]['id'],_0x238b48));}else{return _0x2603d6['sendStatus'](0xcc);}})[_0x3763('0x46')](handleError(_0x2603d6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index ff04e79..9fe5c4d 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 _0xece0=['lodash','util','api','moment','request-promise','path','rimraf','exports','define','JscriptyProject','jscripty_projects'];(function(_0x2b4dda,_0x18913a){var _0x11caf7=function(_0x44d3de){while(--_0x44d3de){_0x2b4dda['push'](_0x2b4dda['shift']());}};_0x11caf7(++_0x18913a);}(_0xece0,0xa5));var _0x0ece=function(_0x40f0b8,_0x1fec2d){_0x40f0b8=_0x40f0b8-0x0;var _0x13f15d=_0xece0[_0x40f0b8];return _0x13f15d;};'use strict';var _=require(_0x0ece('0x0'));var util=require(_0x0ece('0x1'));var logger=require('../../config/logger')(_0x0ece('0x2'));var moment=require(_0x0ece('0x3'));var BPromise=require('bluebird');var rp=require(_0x0ece('0x4'));var fs=require('fs');var path=require(_0x0ece('0x5'));var rimraf=require(_0x0ece('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x0ece('0x7')]=function(_0x3a107d,_0xb736f9){return _0x3a107d[_0x0ece('0x8')](_0x0ece('0x9'),attributes,{'tableName':_0x0ece('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9973=['define','JscriptyProject','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes'];(function(_0x93942f,_0xb48547){var _0x23fcd8=function(_0x4728be){while(--_0x4728be){_0x93942f['push'](_0x93942f['shift']());}};_0x23fcd8(++_0xb48547);}(_0x9973,0x157));var _0x3997=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9973[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x3997('0x0'));var logger=require(_0x3997('0x1'))('api');var moment=require(_0x3997('0x2'));var BPromise=require(_0x3997('0x3'));var rp=require(_0x3997('0x4'));var fs=require('fs');var path=require(_0x3997('0x5'));var rimraf=require(_0x3997('0x6'));var config=require(_0x3997('0x7'));var attributes=require(_0x3997('0x8'));module['exports']=function(_0x48c26c,_0x320340){return _0x48c26c[_0x3997('0x9')](_0x3997('0xa'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 9fce5c6..56d571f 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xac4a,0x13f));var _0xaac4=function(_0x5a6fbb,_0x1e7dc5){_0x5a6fbb=_0x5a6fbb-0x0;var _0x2238f8=_0xac4a[_0x5a6fbb];return _0x2238f8;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x301486,_0x27b799){var _0x418d16=function(_0x5f0d58){while(--_0x5f0d58){_0x301486['push'](_0x301486['shift']());}};_0x418d16(++_0x27b799);}(_0xaa88,0x137));var _0x8aa8=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xaa88[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 85ee306..98a2007 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 _0xae8e=['put','/:id','update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','get','/describe','show','post','create'];(function(_0x335ea3,_0x27b27f){var _0x270a07=function(_0x45e910){while(--_0x45e910){_0x335ea3['push'](_0x335ea3['shift']());}};_0x270a07(++_0x27b27f);}(_0xae8e,0xb0));var _0xeae8=function(_0x27ecfb,_0xfd706d){_0x27ecfb=_0x27ecfb-0x0;var _0x30760a=_0xae8e[_0x27ecfb];return _0x30760a;};'use strict';var multer=require(_0xeae8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xeae8('0x1'));var express=require(_0xeae8('0x2'));var router=express['Router']();var fs_extra=require(_0xeae8('0x3'));var auth=require(_0xeae8('0x4'));var interaction=require(_0xeae8('0x5'));var config=require(_0xeae8('0x6'));var controller=require(_0xeae8('0x7'));router['get']('/',auth[_0xeae8('0x8')](),controller['index']);router[_0xeae8('0x9')](_0xeae8('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xeae8('0x9')]('/:id',auth[_0xeae8('0x8')](),controller[_0xeae8('0xb')]);router[_0xeae8('0xc')]('/',auth['isAuthenticated'](),controller[_0xeae8('0xd')]);router[_0xeae8('0xe')](_0xeae8('0xf'),auth[_0xeae8('0x8')](),controller[_0xeae8('0x10')]);router[_0xeae8('0x11')](_0xeae8('0xf'),auth[_0xeae8('0x8')](),controller['destroy']);module[_0xeae8('0x12')]=router; \ No newline at end of file +var _0xba2c=['../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0xba2c,0x160));var _0xcba2=function(_0x2b1eb1,_0x33c2bb){_0x2b1eb1=_0x2b1eb1-0x0;var _0x47fb04=_0xba2c[_0x2b1eb1];return _0x47fb04;};'use strict';var multer=require('multer');var util=require(_0xcba2('0x0'));var path=require(_0xcba2('0x1'));var timeout=require(_0xcba2('0x2'));var express=require(_0xcba2('0x3'));var router=express[_0xcba2('0x4')]();var fs_extra=require(_0xcba2('0x5'));var auth=require(_0xcba2('0x6'));var interaction=require(_0xcba2('0x7'));var config=require(_0xcba2('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0xcba2('0x9')]('/',auth[_0xcba2('0xa')](),controller['index']);router[_0xcba2('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xcba2('0xb')]);router[_0xcba2('0x9')](_0xcba2('0xc'),auth[_0xcba2('0xa')](),controller[_0xcba2('0xd')]);router[_0xcba2('0xe')]('/',auth[_0xcba2('0xa')](),controller[_0xcba2('0xf')]);router[_0xcba2('0x10')](_0xcba2('0xc'),auth[_0xcba2('0xa')](),controller[_0xcba2('0x11')]);router[_0xcba2('0x12')]('/:id',auth[_0xcba2('0xa')](),controller[_0xcba2('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index cf9b5ce..37668b6 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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7a54,0x106));var _0x47a5=function(_0x165d06,_0x110956){_0x165d06=_0x165d06-0x0;var _0xf93ba7=_0x7a54[_0x165d06];return _0xf93ba7;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x3cdeec,_0x3cb773){_0x3cdeec=_0x3cdeec-0x0;var _0x11d3cb=_0x7a54[_0x3cdeec];return _0x11d3cb;};'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 e59b075..9d9d221 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 _0x6dc1=['attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','count','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','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','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','map','query','keys'];(function(_0x41e203,_0x2a886d){var _0x3bfe1e=function(_0x2c0380){while(--_0x2c0380){_0x41e203['push'](_0x41e203['shift']());}};_0x3bfe1e(++_0x2a886d);}(_0x6dc1,0x19e));var _0x16dc=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x6dc1[_0x513aa5];return _0x1a1a7c;};'use strict';var emlformat=require(_0x16dc('0x0'));var rimraf=require(_0x16dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x16dc('0x2'));var rp=require(_0x16dc('0x3'));var moment=require(_0x16dc('0x4'));var BPromise=require(_0x16dc('0x5'));var Mustache=require(_0x16dc('0x6'));var util=require('util');var path=require(_0x16dc('0x7'));var sox=require('sox');var csv=require(_0x16dc('0x8'));var ejs=require(_0x16dc('0x9'));var fs=require('fs');var fs_extra=require(_0x16dc('0xa'));var _=require(_0x16dc('0xb'));var squel=require(_0x16dc('0xc'));var crypto=require(_0x16dc('0xd'));var jsforce=require(_0x16dc('0xe'));var deskjs=require(_0x16dc('0xf'));var toCsv=require(_0x16dc('0x8'));var querystring=require(_0x16dc('0x10'));var Papa=require(_0x16dc('0x11'));var Redis=require('ioredis');var authService=require(_0x16dc('0x12'));var qs=require(_0x16dc('0x13'));var as=require(_0x16dc('0x14'));var hardwareService=require(_0x16dc('0x15'));var logger=require('../../config/logger')(_0x16dc('0x16'));var utils=require(_0x16dc('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x16dc('0x18'));var db=require(_0x16dc('0x19'))['db'];function respondWithStatusCode(_0x24fbbe,_0x1171a9){_0x1171a9=_0x1171a9||0xcc;return function(_0x342bea){if(_0x342bea){return _0x24fbbe[_0x16dc('0x1a')](_0x1171a9);}return _0x24fbbe[_0x16dc('0x1b')](_0x1171a9)[_0x16dc('0x1c')]();};}function respondWithResult(_0x227649,_0x1fa0aa){_0x1fa0aa=_0x1fa0aa||0xc8;return function(_0x43b3d0){if(_0x43b3d0){return _0x227649['status'](_0x1fa0aa)[_0x16dc('0x1d')](_0x43b3d0);}};}function respondWithFilteredResult(_0xbb72a3,_0x2aec67){return function(_0x4a80bd){if(_0x4a80bd){var _0x37f6f8=typeof _0x2aec67['offset']===_0x16dc('0x1e')&&typeof _0x2aec67[_0x16dc('0x1f')]===_0x16dc('0x1e');var _0x7dae10=_0x4a80bd['count'];var _0x3a3105=_0x37f6f8?0x0:_0x2aec67[_0x16dc('0x20')];var _0x29e7f9=_0x37f6f8?_0x4a80bd['count']:_0x2aec67[_0x16dc('0x20')]+_0x2aec67['limit'];var _0x3075d6;if(_0x29e7f9>=_0x7dae10){_0x29e7f9=_0x7dae10;_0x3075d6=0xc8;}else{_0x3075d6=0xce;}_0xbb72a3[_0x16dc('0x1b')](_0x3075d6);return _0xbb72a3[_0x16dc('0x21')]('Content-Range',_0x3a3105+'-'+_0x29e7f9+'/'+_0x7dae10)[_0x16dc('0x1d')](_0x4a80bd);}return null;};}function patchUpdates(_0x1231a4){return function(_0x3a566c){try{jsonpatch[_0x16dc('0x22')](_0x3a566c,_0x1231a4,!![]);}catch(_0x2e2ff0){return BPromise[_0x16dc('0x23')](_0x2e2ff0);}return _0x3a566c[_0x16dc('0x24')]();};}function saveUpdates(_0x55d64f,_0x2003e0){return function(_0x54be7a){if(_0x54be7a){return _0x54be7a[_0x16dc('0x25')](_0x55d64f)[_0x16dc('0x26')](function(_0x1bdf65){return _0x1bdf65;});}return null;};}function removeEntity(_0xd3641a,_0x4a51c6){return function(_0x17eb83){if(_0x17eb83){return _0x17eb83[_0x16dc('0x27')]()[_0x16dc('0x26')](function(){_0xd3641a[_0x16dc('0x1b')](0xcc)[_0x16dc('0x1c')]();});}};}function handleEntityNotFound(_0x7bbfcb,_0x2d2c07){return function(_0x50b5a4){if(!_0x50b5a4){_0x7bbfcb['sendStatus'](0x194);}return _0x50b5a4;};}function handleError(_0x3744a8,_0x502e99){_0x502e99=_0x502e99||0x1f4;return function(_0x197a6d){logger[_0x16dc('0x28')](_0x197a6d[_0x16dc('0x29')]);if(_0x197a6d[_0x16dc('0x2a')]){delete _0x197a6d['name'];}_0x3744a8['status'](_0x502e99)[_0x16dc('0x2b')](_0x197a6d);};}exports[_0x16dc('0x2c')]=function(_0x56341c,_0x4c0897){var _0x229694={},_0x4d90bc={},_0x2cc515={'count':0x0,'rows':[]};var _0x59c4e5=_['map'](db[_0x16dc('0x2d')][_0x16dc('0x2e')],function(_0x47cdb5){return{'name':_0x47cdb5[_0x16dc('0x2f')],'type':_0x47cdb5[_0x16dc('0x30')][_0x16dc('0x31')]};});_0x4d90bc[_0x16dc('0x32')]=_[_0x16dc('0x33')](_0x59c4e5,_0x16dc('0x2a'));_0x4d90bc[_0x16dc('0x34')]=_[_0x16dc('0x35')](_0x56341c[_0x16dc('0x34')]);_0x4d90bc['filters']=_['intersection'](_0x4d90bc[_0x16dc('0x32')],_0x4d90bc[_0x16dc('0x34')]);_0x229694[_0x16dc('0x36')]=_[_0x16dc('0x37')](_0x4d90bc[_0x16dc('0x32')],qs[_0x16dc('0x38')](_0x56341c[_0x16dc('0x34')][_0x16dc('0x38')]));_0x229694[_0x16dc('0x36')]=_0x229694['attributes'][_0x16dc('0x39')]?_0x229694[_0x16dc('0x36')]:_0x4d90bc[_0x16dc('0x32')];if(!_0x56341c[_0x16dc('0x34')][_0x16dc('0x3a')]('nolimit')){_0x229694['limit']=qs[_0x16dc('0x1f')](_0x56341c['query']['limit']);_0x229694[_0x16dc('0x20')]=qs[_0x16dc('0x20')](_0x56341c[_0x16dc('0x34')][_0x16dc('0x20')]);}_0x229694[_0x16dc('0x3b')]=qs[_0x16dc('0x3c')](_0x56341c[_0x16dc('0x34')][_0x16dc('0x3c')]);_0x229694[_0x16dc('0x3d')]=qs[_0x16dc('0x3e')](_[_0x16dc('0x3f')](_0x56341c[_0x16dc('0x34')],_0x4d90bc[_0x16dc('0x3e')]),_0x59c4e5);if(_0x56341c[_0x16dc('0x34')]['filter']){_0x229694[_0x16dc('0x3d')]=_[_0x16dc('0x40')](_0x229694[_0x16dc('0x3d')],{'$or':_[_0x16dc('0x33')](_0x59c4e5,function(_0x450c24){if(_0x450c24[_0x16dc('0x30')]!=='VIRTUAL'){var _0x1bbc94={};_0x1bbc94[_0x450c24[_0x16dc('0x2a')]]={'$like':'%'+_0x56341c[_0x16dc('0x34')][_0x16dc('0x41')]+'%'};return _0x1bbc94;}})});}_0x229694=_[_0x16dc('0x40')]({},_0x229694,_0x56341c[_0x16dc('0x42')]);var _0x5d5bfe={'where':_0x229694['where']};return db[_0x16dc('0x2d')][_0x16dc('0x43')](_0x5d5bfe)[_0x16dc('0x26')](function(_0x22e853){_0x2cc515[_0x16dc('0x43')]=_0x22e853;if(_0x56341c[_0x16dc('0x34')][_0x16dc('0x44')]){_0x229694[_0x16dc('0x45')]=[{'all':!![]}];}return db[_0x16dc('0x2d')]['findAll'](_0x229694);})[_0x16dc('0x26')](function(_0x2575dc){_0x2cc515[_0x16dc('0x46')]=_0x2575dc;return _0x2cc515;})[_0x16dc('0x26')](respondWithFilteredResult(_0x4c0897,_0x229694))[_0x16dc('0x47')](handleError(_0x4c0897,null));};exports[_0x16dc('0x48')]=function(_0x416515,_0x20d116){var _0x2cfc42={'raw':!![],'where':{'id':_0x416515[_0x16dc('0x49')]['id']}},_0x421d92={};_0x421d92[_0x16dc('0x32')]=_['keys'](db[_0x16dc('0x2d')][_0x16dc('0x2e')]);_0x421d92[_0x16dc('0x34')]=_[_0x16dc('0x35')](_0x416515[_0x16dc('0x34')]);_0x421d92[_0x16dc('0x3e')]=_[_0x16dc('0x37')](_0x421d92[_0x16dc('0x32')],_0x421d92[_0x16dc('0x34')]);_0x2cfc42['attributes']=_['intersection'](_0x421d92['model'],qs['fields'](_0x416515['query'][_0x16dc('0x38')]));_0x2cfc42[_0x16dc('0x36')]=_0x2cfc42[_0x16dc('0x36')][_0x16dc('0x39')]?_0x2cfc42['attributes']:_0x421d92[_0x16dc('0x32')];if(_0x416515['query'][_0x16dc('0x44')]){_0x2cfc42['include']=[{'all':!![]}];}_0x2cfc42=_[_0x16dc('0x40')]({},_0x2cfc42,_0x416515[_0x16dc('0x42')]);return db['JscriptyQuestionReport'][_0x16dc('0x4a')](_0x2cfc42)[_0x16dc('0x26')](handleEntityNotFound(_0x20d116,null))[_0x16dc('0x26')](respondWithResult(_0x20d116,null))['catch'](handleError(_0x20d116,null));};exports[_0x16dc('0x4b')]=function(_0x316be9,_0x87fc15){return db['JscriptyQuestionReport'][_0x16dc('0x4b')](_0x316be9[_0x16dc('0x4c')],{})[_0x16dc('0x26')](respondWithResult(_0x87fc15,0xc9))[_0x16dc('0x47')](handleError(_0x87fc15,null));};exports[_0x16dc('0x25')]=function(_0x187950,_0x2dfb25){if(_0x187950['body']['id']){delete _0x187950['body']['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x187950[_0x16dc('0x49')]['id']}})[_0x16dc('0x26')](handleEntityNotFound(_0x2dfb25,null))[_0x16dc('0x26')](saveUpdates(_0x187950['body'],null))[_0x16dc('0x26')](respondWithResult(_0x2dfb25,null))[_0x16dc('0x47')](handleError(_0x2dfb25,null));};exports[_0x16dc('0x27')]=function(_0x67c74,_0x618327){return db['JscriptyQuestionReport'][_0x16dc('0x4a')]({'where':{'id':_0x67c74[_0x16dc('0x49')]['id']}})[_0x16dc('0x26')](handleEntityNotFound(_0x618327,null))[_0x16dc('0x26')](removeEntity(_0x618327,null))[_0x16dc('0x47')](handleError(_0x618327,null));};exports[_0x16dc('0x4d')]=function(_0x786ed0,_0x23a7cd){return db[_0x16dc('0x2d')][_0x16dc('0x4d')]()[_0x16dc('0x26')](respondWithResult(_0x23a7cd,null))[_0x16dc('0x47')](handleError(_0x23a7cd,null));}; \ No newline at end of file +var _0xd012=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','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','update','destroy','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','rows','catch','show','params','intersection','find','create','body','describe','eml-format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd012,0xe3));var _0x2d01=function(_0x2fa9b8,_0x11d0c8){_0x2fa9b8=_0x2fa9b8-0x0;var _0x4e63e0=_0xd012[_0x2fa9b8];return _0x4e63e0;};'use strict';var emlformat=require(_0x2d01('0x0'));var rimraf=require(_0x2d01('0x1'));var zipdir=require(_0x2d01('0x2'));var jsonpatch=require(_0x2d01('0x3'));var rp=require(_0x2d01('0x4'));var moment=require(_0x2d01('0x5'));var BPromise=require(_0x2d01('0x6'));var Mustache=require(_0x2d01('0x7'));var util=require(_0x2d01('0x8'));var path=require(_0x2d01('0x9'));var sox=require(_0x2d01('0xa'));var csv=require(_0x2d01('0xb'));var ejs=require(_0x2d01('0xc'));var fs=require('fs');var fs_extra=require(_0x2d01('0xd'));var _=require('lodash');var squel=require(_0x2d01('0xe'));var crypto=require(_0x2d01('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2d01('0xb'));var querystring=require('querystring');var Papa=require(_0x2d01('0x10'));var Redis=require(_0x2d01('0x11'));var authService=require(_0x2d01('0x12'));var qs=require(_0x2d01('0x13'));var as=require(_0x2d01('0x14'));var hardwareService=require(_0x2d01('0x15'));var logger=require(_0x2d01('0x16'))('api');var utils=require(_0x2d01('0x17'));var config=require(_0x2d01('0x18'));var licenseUtil=require(_0x2d01('0x19'));var db=require(_0x2d01('0x1a'))['db'];function respondWithStatusCode(_0x21dff5,_0x55157f){_0x55157f=_0x55157f||0xcc;return function(_0x13ddd8){if(_0x13ddd8){return _0x21dff5['sendStatus'](_0x55157f);}return _0x21dff5[_0x2d01('0x1b')](_0x55157f)[_0x2d01('0x1c')]();};}function respondWithResult(_0x5623d6,_0x3dd18a){_0x3dd18a=_0x3dd18a||0xc8;return function(_0x3fd13d){if(_0x3fd13d){return _0x5623d6['status'](_0x3dd18a)[_0x2d01('0x1d')](_0x3fd13d);}};}function respondWithFilteredResult(_0x3744c5,_0x421734){return function(_0x213973){if(_0x213973){var _0x5129b3=typeof _0x421734[_0x2d01('0x1e')]===_0x2d01('0x1f')&&typeof _0x421734[_0x2d01('0x20')]==='undefined';var _0x3b758b=_0x213973[_0x2d01('0x21')];var _0x1ec1d9=_0x5129b3?0x0:_0x421734[_0x2d01('0x1e')];var _0x57a878=_0x5129b3?_0x213973[_0x2d01('0x21')]:_0x421734[_0x2d01('0x1e')]+_0x421734[_0x2d01('0x20')];var _0x2441f7;if(_0x57a878>=_0x3b758b){_0x57a878=_0x3b758b;_0x2441f7=0xc8;}else{_0x2441f7=0xce;}_0x3744c5[_0x2d01('0x1b')](_0x2441f7);return _0x3744c5[_0x2d01('0x22')](_0x2d01('0x23'),_0x1ec1d9+'-'+_0x57a878+'/'+_0x3b758b)[_0x2d01('0x1d')](_0x213973);}return null;};}function patchUpdates(_0x289b79){return function(_0x58c455){try{jsonpatch['apply'](_0x58c455,_0x289b79,!![]);}catch(_0x5aa3a0){return BPromise['reject'](_0x5aa3a0);}return _0x58c455['save']();};}function saveUpdates(_0x4e96e1,_0x376b24){return function(_0x14f598){if(_0x14f598){return _0x14f598[_0x2d01('0x24')](_0x4e96e1)['then'](function(_0x654085){return _0x654085;});}return null;};}function removeEntity(_0x198202,_0x3e0026){return function(_0x3f1dc7){if(_0x3f1dc7){return _0x3f1dc7[_0x2d01('0x25')]()[_0x2d01('0x26')](function(){_0x198202['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cde51,_0xe46947){return function(_0x140f43){if(!_0x140f43){_0x4cde51['sendStatus'](0x194);}return _0x140f43;};}function handleError(_0x44cb12,_0x14035f){_0x14035f=_0x14035f||0x1f4;return function(_0x2b351a){logger[_0x2d01('0x27')](_0x2b351a[_0x2d01('0x28')]);if(_0x2b351a[_0x2d01('0x29')]){delete _0x2b351a[_0x2d01('0x29')];}_0x44cb12[_0x2d01('0x1b')](_0x14035f)[_0x2d01('0x2a')](_0x2b351a);};}exports[_0x2d01('0x2b')]=function(_0x393f0b,_0x413242){var _0x4edebd={},_0x17fa49={},_0x13186e={'count':0x0,'rows':[]};var _0x24f16c=_[_0x2d01('0x2c')](db[_0x2d01('0x2d')][_0x2d01('0x2e')],function(_0x4fdffd){return{'name':_0x4fdffd[_0x2d01('0x2f')],'type':_0x4fdffd[_0x2d01('0x30')][_0x2d01('0x31')]};});_0x17fa49[_0x2d01('0x32')]=_[_0x2d01('0x2c')](_0x24f16c,_0x2d01('0x29'));_0x17fa49[_0x2d01('0x33')]=_[_0x2d01('0x34')](_0x393f0b[_0x2d01('0x33')]);_0x17fa49[_0x2d01('0x35')]=_['intersection'](_0x17fa49[_0x2d01('0x32')],_0x17fa49[_0x2d01('0x33')]);_0x4edebd[_0x2d01('0x36')]=_['intersection'](_0x17fa49[_0x2d01('0x32')],qs[_0x2d01('0x37')](_0x393f0b[_0x2d01('0x33')][_0x2d01('0x37')]));_0x4edebd[_0x2d01('0x36')]=_0x4edebd[_0x2d01('0x36')][_0x2d01('0x38')]?_0x4edebd[_0x2d01('0x36')]:_0x17fa49[_0x2d01('0x32')];if(!_0x393f0b[_0x2d01('0x33')][_0x2d01('0x39')](_0x2d01('0x3a'))){_0x4edebd[_0x2d01('0x20')]=qs[_0x2d01('0x20')](_0x393f0b['query'][_0x2d01('0x20')]);_0x4edebd[_0x2d01('0x1e')]=qs[_0x2d01('0x1e')](_0x393f0b[_0x2d01('0x33')]['offset']);}_0x4edebd[_0x2d01('0x3b')]=qs[_0x2d01('0x3c')](_0x393f0b[_0x2d01('0x33')][_0x2d01('0x3c')]);_0x4edebd[_0x2d01('0x3d')]=qs[_0x2d01('0x35')](_['pick'](_0x393f0b[_0x2d01('0x33')],_0x17fa49[_0x2d01('0x35')]),_0x24f16c);if(_0x393f0b[_0x2d01('0x33')]['filter']){_0x4edebd[_0x2d01('0x3d')]=_[_0x2d01('0x3e')](_0x4edebd[_0x2d01('0x3d')],{'$or':_[_0x2d01('0x2c')](_0x24f16c,function(_0x2befe2){if(_0x2befe2[_0x2d01('0x30')]!==_0x2d01('0x3f')){var _0x71ddbe={};_0x71ddbe[_0x2befe2['name']]={'$like':'%'+_0x393f0b['query'][_0x2d01('0x40')]+'%'};return _0x71ddbe;}})});}_0x4edebd=_['merge']({},_0x4edebd,_0x393f0b[_0x2d01('0x41')]);var _0x5221bb={'where':_0x4edebd['where']};return db[_0x2d01('0x2d')]['count'](_0x5221bb)[_0x2d01('0x26')](function(_0x27e32c){_0x13186e['count']=_0x27e32c;if(_0x393f0b[_0x2d01('0x33')]['includeAll']){_0x4edebd[_0x2d01('0x42')]=[{'all':!![]}];}return db[_0x2d01('0x2d')]['findAll'](_0x4edebd);})[_0x2d01('0x26')](function(_0x433bc8){_0x13186e[_0x2d01('0x43')]=_0x433bc8;return _0x13186e;})[_0x2d01('0x26')](respondWithFilteredResult(_0x413242,_0x4edebd))[_0x2d01('0x44')](handleError(_0x413242,null));};exports[_0x2d01('0x45')]=function(_0x48f664,_0x3f72b6){var _0x224190={'raw':!![],'where':{'id':_0x48f664[_0x2d01('0x46')]['id']}},_0x2e1275={};_0x2e1275[_0x2d01('0x32')]=_['keys'](db[_0x2d01('0x2d')][_0x2d01('0x2e')]);_0x2e1275[_0x2d01('0x33')]=_[_0x2d01('0x34')](_0x48f664[_0x2d01('0x33')]);_0x2e1275[_0x2d01('0x35')]=_[_0x2d01('0x47')](_0x2e1275['model'],_0x2e1275[_0x2d01('0x33')]);_0x224190[_0x2d01('0x36')]=_[_0x2d01('0x47')](_0x2e1275[_0x2d01('0x32')],qs[_0x2d01('0x37')](_0x48f664[_0x2d01('0x33')][_0x2d01('0x37')]));_0x224190[_0x2d01('0x36')]=_0x224190[_0x2d01('0x36')]['length']?_0x224190[_0x2d01('0x36')]:_0x2e1275[_0x2d01('0x32')];if(_0x48f664['query']['includeAll']){_0x224190['include']=[{'all':!![]}];}_0x224190=_[_0x2d01('0x3e')]({},_0x224190,_0x48f664[_0x2d01('0x41')]);return db['JscriptyQuestionReport'][_0x2d01('0x48')](_0x224190)[_0x2d01('0x26')](handleEntityNotFound(_0x3f72b6,null))[_0x2d01('0x26')](respondWithResult(_0x3f72b6,null))[_0x2d01('0x44')](handleError(_0x3f72b6,null));};exports['create']=function(_0x123e72,_0x56b1d8){return db[_0x2d01('0x2d')][_0x2d01('0x49')](_0x123e72[_0x2d01('0x4a')],{})[_0x2d01('0x26')](respondWithResult(_0x56b1d8,0xc9))[_0x2d01('0x44')](handleError(_0x56b1d8,null));};exports[_0x2d01('0x24')]=function(_0x5d3e26,_0x5e8685){if(_0x5d3e26['body']['id']){delete _0x5d3e26[_0x2d01('0x4a')]['id'];}return db[_0x2d01('0x2d')]['find']({'where':{'id':_0x5d3e26[_0x2d01('0x46')]['id']}})[_0x2d01('0x26')](handleEntityNotFound(_0x5e8685,null))['then'](saveUpdates(_0x5d3e26[_0x2d01('0x4a')],null))[_0x2d01('0x26')](respondWithResult(_0x5e8685,null))[_0x2d01('0x44')](handleError(_0x5e8685,null));};exports[_0x2d01('0x25')]=function(_0x31e9ff,_0xf2d311){return db[_0x2d01('0x2d')][_0x2d01('0x48')]({'where':{'id':_0x31e9ff['params']['id']}})['then'](handleEntityNotFound(_0xf2d311,null))[_0x2d01('0x26')](removeEntity(_0xf2d311,null))[_0x2d01('0x44')](handleError(_0xf2d311,null));};exports[_0x2d01('0x4b')]=function(_0xa78234,_0x8021cd){return db['JscriptyQuestionReport']['describe']()[_0x2d01('0x26')](respondWithResult(_0x8021cd,null))[_0x2d01('0x44')](handleError(_0x8021cd,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index e2c5069..e3ddc9d 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 _0x8b0d=['request-promise','path','rimraf','./jscriptyQuestionReport.attributes','define','util','../../config/logger','moment','bluebird'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x8b0d,0x1a3));var _0xd8b0=function(_0x333e29,_0x32951a){_0x333e29=_0x333e29-0x0;var _0x5581b8=_0x8b0d[_0x333e29];return _0x5581b8;};'use strict';var _=require('lodash');var util=require(_0xd8b0('0x0'));var logger=require(_0xd8b0('0x1'))('api');var moment=require(_0xd8b0('0x2'));var BPromise=require(_0xd8b0('0x3'));var rp=require(_0xd8b0('0x4'));var fs=require('fs');var path=require(_0xd8b0('0x5'));var rimraf=require(_0xd8b0('0x6'));var config=require('../../config/environment');var attributes=require(_0xd8b0('0x7'));module['exports']=function(_0x5de041,_0x31b4b8){return _0x5de041[_0xd8b0('0x8')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4746=['../../config/logger','api','moment','path','rimraf','../../config/environment','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x4746,0xa3));var _0x6474=function(_0x584a31,_0x221fed){_0x584a31=_0x584a31-0x0;var _0x93733c=_0x4746[_0x584a31];return _0x93733c;};'use strict';var _=require(_0x6474('0x0'));var util=require(_0x6474('0x1'));var logger=require(_0x6474('0x2'))(_0x6474('0x3'));var moment=require(_0x6474('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6474('0x5'));var rimraf=require(_0x6474('0x6'));var config=require(_0x6474('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x221484,_0x50860f){return _0x221484[_0x6474('0x8')](_0x6474('0x9'),attributes,{'tableName':_0x6474('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 8aad116..b14a5eb 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 _0x8a84=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','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','code','message','result','catch','util','moment'];(function(_0x7a6897,_0x66fa7c){var _0x1d49c1=function(_0x34d363){while(--_0x34d363){_0x7a6897['push'](_0x7a6897['shift']());}};_0x1d49c1(++_0x66fa7c);}(_0x8a84,0x19c));var _0x48a8=function(_0x5c110c,_0x58d08b){_0x5c110c=_0x5c110c-0x0;var _0x485822=_0x8a84[_0x5c110c];return _0x485822;};'use strict';var _=require('lodash');var util=require(_0x48a8('0x0'));var moment=require(_0x48a8('0x1'));var BPromise=require(_0x48a8('0x2'));var rs=require(_0x48a8('0x3'));var fs=require('fs');var Redis=require(_0x48a8('0x4'));var db=require(_0x48a8('0x5'))['db'];var utils=require(_0x48a8('0x6'));var logger=require('../../config/logger')(_0x48a8('0x7'));var config=require(_0x48a8('0x8'));var jayson=require(_0x48a8('0x9'));var client=jayson[_0x48a8('0xa')][_0x48a8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17da07,_0xbf1341,_0xf89e9){return new BPromise(function(_0x280bf4,_0x17fc7c){return client[_0x48a8('0xc')](_0x17da07,_0xf89e9)[_0x48a8('0xd')](function(_0x9a90f8){logger[_0x48a8('0xe')](_0x48a8('0xf'),_0xbf1341,_0x48a8('0x10'));logger['debug'](_0x48a8('0x11'),_0xbf1341,_0x48a8('0x10'),JSON['stringify'](_0x9a90f8));if(_0x9a90f8['error']){if(_0x9a90f8[_0x48a8('0x12')][_0x48a8('0x13')]===0x1f4){logger[_0x48a8('0x12')](_0x48a8('0xf'),_0xbf1341,_0x9a90f8[_0x48a8('0x12')][_0x48a8('0x14')]);return _0x17fc7c(_0x9a90f8['error']['message']);}logger[_0x48a8('0x12')](_0x48a8('0xf'),_0xbf1341,_0x9a90f8[_0x48a8('0x12')]['message']);return _0x280bf4(_0x9a90f8['error'][_0x48a8('0x14')]);}else{logger[_0x48a8('0xe')](_0x48a8('0xf'),_0xbf1341,'request\x20sent');_0x280bf4(_0x9a90f8[_0x48a8('0x15')][_0x48a8('0x14')]);}})[_0x48a8('0x16')](function(_0x57d71){logger[_0x48a8('0x12')](_0x48a8('0xf'),_0xbf1341,_0x57d71);_0x17fc7c(_0x57d71);});});} \ No newline at end of file +var _0xd1ca=['message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3e6aed,_0x97a2f1){var _0x3220dd=function(_0x252cd2){while(--_0x252cd2){_0x3e6aed['push'](_0x3e6aed['shift']());}};_0x3220dd(++_0x97a2f1);}(_0xd1ca,0xa4));var _0xad1c=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xd1ca[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xad1c('0x0'));var util=require(_0xad1c('0x1'));var moment=require(_0xad1c('0x2'));var BPromise=require('bluebird');var rs=require(_0xad1c('0x3'));var fs=require('fs');var Redis=require(_0xad1c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xad1c('0x5'));var logger=require(_0xad1c('0x6'))('rpc');var config=require(_0xad1c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xad1c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ad847,_0x2535c4,_0x3a0be9){return new BPromise(function(_0x388b4a,_0x4c055d){return client[_0xad1c('0x9')](_0x4ad847,_0x3a0be9)['then'](function(_0x438cc3){logger['info'](_0xad1c('0xa'),_0x2535c4,_0xad1c('0xb'));logger[_0xad1c('0xc')](_0xad1c('0xd'),_0x2535c4,_0xad1c('0xb'),JSON['stringify'](_0x438cc3));if(_0x438cc3[_0xad1c('0xe')]){if(_0x438cc3[_0xad1c('0xe')][_0xad1c('0xf')]===0x1f4){logger[_0xad1c('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2535c4,_0x438cc3[_0xad1c('0xe')][_0xad1c('0x10')]);return _0x4c055d(_0x438cc3[_0xad1c('0xe')]['message']);}logger[_0xad1c('0xe')](_0xad1c('0xa'),_0x2535c4,_0x438cc3[_0xad1c('0xe')][_0xad1c('0x10')]);return _0x388b4a(_0x438cc3[_0xad1c('0xe')][_0xad1c('0x10')]);}else{logger[_0xad1c('0x11')](_0xad1c('0xa'),_0x2535c4,_0xad1c('0xb'));_0x388b4a(_0x438cc3[_0xad1c('0x12')][_0xad1c('0x10')]);}})[_0xad1c('0x13')](function(_0x10d74a){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x2535c4,_0x10d74a);_0x4c055d(_0x10d74a);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index f5385b2..5aa8529 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 _0x24e4=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','destroy','exports','multer','util','path'];(function(_0xd60208,_0x6854d6){var _0x547c05=function(_0x28977f){while(--_0x28977f){_0xd60208['push'](_0xd60208['shift']());}};_0x547c05(++_0x6854d6);}(_0x24e4,0x19f));var _0x424e=function(_0x571a17,_0x63fb3d){_0x571a17=_0x571a17-0x0;var _0x3ef337=_0x24e4[_0x571a17];return _0x3ef337;};'use strict';var multer=require(_0x424e('0x0'));var util=require(_0x424e('0x1'));var path=require(_0x424e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x424e('0x3')]();var fs_extra=require(_0x424e('0x4'));var auth=require(_0x424e('0x5'));var interaction=require(_0x424e('0x6'));var config=require(_0x424e('0x7'));var controller=require(_0x424e('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x424e('0x9')](_0x424e('0xa'),auth[_0x424e('0xb')](),controller[_0x424e('0xc')]);router[_0x424e('0x9')](_0x424e('0xd'),auth[_0x424e('0xb')](),controller[_0x424e('0xe')]);router[_0x424e('0x9')]('/:id/questions',auth[_0x424e('0xb')](),controller['getQuestions']);router[_0x424e('0xf')]('/',auth[_0x424e('0xb')](),controller[_0x424e('0x10')]);router['put']('/:id',auth[_0x424e('0xb')](),controller['update']);router['delete'](_0x424e('0xd'),auth[_0x424e('0xb')](),controller[_0x424e('0x11')]);module[_0x424e('0x12')]=router; \ No newline at end of file +var _0x40f6=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','isAuthenticated','index','/describe','get','/:id','show','/:id/questions','getQuestions','post','create','put','update','destroy','exports'];(function(_0x2a7813,_0x2d564d){var _0x1b8b5b=function(_0x5bf853){while(--_0x5bf853){_0x2a7813['push'](_0x2a7813['shift']());}};_0x1b8b5b(++_0x2d564d);}(_0x40f6,0xfd));var _0x640f=function(_0x3d044f,_0x32ed81){_0x3d044f=_0x3d044f-0x0;var _0x4d113d=_0x40f6[_0x3d044f];return _0x4d113d;};'use strict';var multer=require(_0x640f('0x0'));var util=require('util');var path=require(_0x640f('0x1'));var timeout=require(_0x640f('0x2'));var express=require(_0x640f('0x3'));var router=express[_0x640f('0x4')]();var fs_extra=require(_0x640f('0x5'));var auth=require(_0x640f('0x6'));var interaction=require(_0x640f('0x7'));var config=require('../../config/environment');var controller=require(_0x640f('0x8'));router['get']('/',auth[_0x640f('0x9')](),controller[_0x640f('0xa')]);router['get'](_0x640f('0xb'),auth[_0x640f('0x9')](),controller['describe']);router[_0x640f('0xc')](_0x640f('0xd'),auth[_0x640f('0x9')](),controller[_0x640f('0xe')]);router[_0x640f('0xc')](_0x640f('0xf'),auth[_0x640f('0x9')](),controller[_0x640f('0x10')]);router[_0x640f('0x11')]('/',auth[_0x640f('0x9')](),controller[_0x640f('0x12')]);router[_0x640f('0x13')](_0x640f('0xd'),auth[_0x640f('0x9')](),controller[_0x640f('0x14')]);router['delete'](_0x640f('0xd'),auth['isAuthenticated'](),controller[_0x640f('0x15')]);module[_0x640f('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index e15fa4f..3eb02cd 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 _0x41ca=['DATE','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports'];(function(_0x545a3a,_0x3123aa){var _0x5a5493=function(_0x4e6bce){while(--_0x4e6bce){_0x545a3a['push'](_0x545a3a['shift']());}};_0x5a5493(++_0x3123aa);}(_0x41ca,0x1de));var _0xa41c=function(_0x1d9ee5,_0x5b7259){_0x1d9ee5=_0x1d9ee5-0x0;var _0x23a3ce=_0x41ca[_0x1d9ee5];return _0x23a3ce;};'use strict';var moment=require(_0xa41c('0x0'));var Sequelize=require('sequelize');module[_0xa41c('0x1')]={'starttime':{'type':Sequelize[_0xa41c('0x2')],'set':function(_0x9c1d3b){this[_0xa41c('0x3')]('starttime',_0x9c1d3b);this[_0xa41c('0x3')](_0xa41c('0x4'),moment()['format'](_0xa41c('0x5')));}},'endtime':{'type':Sequelize[_0xa41c('0x2')]},'membername':{'type':Sequelize[_0xa41c('0x6')]},'projectname':{'type':Sequelize[_0xa41c('0x6')]},'queue':{'type':Sequelize[_0xa41c('0x6')]},'uniqueid':{'type':Sequelize[_0xa41c('0x6')]},'calleridname':{'type':Sequelize[_0xa41c('0x6')]},'calleridnum':{'type':Sequelize[_0xa41c('0x6')]},'completed':{'type':Sequelize[_0xa41c('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x3951=['endtime','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment','exports','setDataValue','starttime'];(function(_0xdbd5ac,_0x568e65){var _0x4cd244=function(_0x114d58){while(--_0x114d58){_0xdbd5ac['push'](_0xdbd5ac['shift']());}};_0x4cd244(++_0x568e65);}(_0x3951,0xdd));var _0x1395=function(_0x34404e,_0x4261e5){_0x34404e=_0x34404e-0x0;var _0x3f260d=_0x3951[_0x34404e];return _0x3f260d;};'use strict';var moment=require(_0x1395('0x0'));var Sequelize=require('sequelize');module[_0x1395('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x249d81){this[_0x1395('0x2')](_0x1395('0x3'),_0x249d81);this[_0x1395('0x2')](_0x1395('0x4'),moment()['format'](_0x1395('0x5')));}},'endtime':{'type':Sequelize[_0x1395('0x6')]},'membername':{'type':Sequelize[_0x1395('0x7')]},'projectname':{'type':Sequelize[_0x1395('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1395('0x7')]},'calleridname':{'type':Sequelize[_0x1395('0x7')]},'calleridnum':{'type':Sequelize[_0x1395('0x7')]},'completed':{'type':Sequelize[_0x1395('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 059f493..2946e3a 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 _0x8411=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x572984,_0x3a04e1){var _0x408674=function(_0x2c27ab){while(--_0x2c27ab){_0x572984['push'](_0x572984['shift']());}};_0x408674(++_0x3a04e1);}(_0x8411,0x1da));var _0x1841=function(_0x25d991,_0x19c492){_0x25d991=_0x25d991-0x0;var _0xe89d70=_0x8411[_0x25d991];return _0xe89d70;};'use strict';var emlformat=require(_0x1841('0x0'));var rimraf=require(_0x1841('0x1'));var zipdir=require(_0x1841('0x2'));var jsonpatch=require(_0x1841('0x3'));var rp=require('request-promise');var moment=require(_0x1841('0x4'));var BPromise=require(_0x1841('0x5'));var Mustache=require(_0x1841('0x6'));var util=require(_0x1841('0x7'));var path=require('path');var sox=require(_0x1841('0x8'));var csv=require('to-csv');var ejs=require(_0x1841('0x9'));var fs=require('fs');var fs_extra=require(_0x1841('0xa'));var _=require(_0x1841('0xb'));var squel=require('squel');var crypto=require(_0x1841('0xc'));var jsforce=require(_0x1841('0xd'));var deskjs=require(_0x1841('0xe'));var toCsv=require(_0x1841('0xf'));var querystring=require(_0x1841('0x10'));var Papa=require(_0x1841('0x11'));var Redis=require('ioredis');var authService=require(_0x1841('0x12'));var qs=require(_0x1841('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1841('0x14'));var logger=require('../../config/logger')(_0x1841('0x15'));var utils=require(_0x1841('0x16'));var config=require(_0x1841('0x17'));var licenseUtil=require(_0x1841('0x18'));var db=require(_0x1841('0x19'))['db'];function respondWithStatusCode(_0x2ab72b,_0x118c62){_0x118c62=_0x118c62||0xcc;return function(_0x169ebe){if(_0x169ebe){return _0x2ab72b[_0x1841('0x1a')](_0x118c62);}return _0x2ab72b[_0x1841('0x1b')](_0x118c62)[_0x1841('0x1c')]();};}function respondWithResult(_0x2433ad,_0xf4ba2b){_0xf4ba2b=_0xf4ba2b||0xc8;return function(_0x52ed2e){if(_0x52ed2e){return _0x2433ad['status'](_0xf4ba2b)[_0x1841('0x1d')](_0x52ed2e);}};}function respondWithFilteredResult(_0x4fc097,_0x160a2f){return function(_0x3b0099){if(_0x3b0099){var _0x33bd2d=typeof _0x160a2f[_0x1841('0x1e')]==='undefined'&&typeof _0x160a2f[_0x1841('0x1f')]===_0x1841('0x20');var _0xefb528=_0x3b0099['count'];var _0x380fcb=_0x33bd2d?0x0:_0x160a2f[_0x1841('0x1e')];var _0xebb364=_0x33bd2d?_0x3b0099[_0x1841('0x21')]:_0x160a2f['offset']+_0x160a2f[_0x1841('0x1f')];var _0x494570;if(_0xebb364>=_0xefb528){_0xebb364=_0xefb528;_0x494570=0xc8;}else{_0x494570=0xce;}_0x4fc097[_0x1841('0x1b')](_0x494570);return _0x4fc097[_0x1841('0x22')](_0x1841('0x23'),_0x380fcb+'-'+_0xebb364+'/'+_0xefb528)[_0x1841('0x1d')](_0x3b0099);}return null;};}function patchUpdates(_0x4b2ad9){return function(_0x1c5987){try{jsonpatch['apply'](_0x1c5987,_0x4b2ad9,!![]);}catch(_0x3d4941){return BPromise[_0x1841('0x24')](_0x3d4941);}return _0x1c5987[_0x1841('0x25')]();};}function saveUpdates(_0x4cab37,_0x441807){return function(_0x5da80d){if(_0x5da80d){return _0x5da80d[_0x1841('0x26')](_0x4cab37)['then'](function(_0x25959b){return _0x25959b;});}return null;};}function removeEntity(_0x5f271f,_0x3643e3){return function(_0x3115aa){if(_0x3115aa){return _0x3115aa[_0x1841('0x27')]()[_0x1841('0x28')](function(){_0x5f271f[_0x1841('0x1b')](0xcc)[_0x1841('0x1c')]();});}};}function handleEntityNotFound(_0x4feedb,_0x294648){return function(_0x29287f){if(!_0x29287f){_0x4feedb[_0x1841('0x1a')](0x194);}return _0x29287f;};}function handleError(_0xd29d6f,_0x3ff0e1){_0x3ff0e1=_0x3ff0e1||0x1f4;return function(_0xee78ff){logger[_0x1841('0x29')](_0xee78ff[_0x1841('0x2a')]);if(_0xee78ff[_0x1841('0x2b')]){delete _0xee78ff[_0x1841('0x2b')];}_0xd29d6f['status'](_0x3ff0e1)[_0x1841('0x2c')](_0xee78ff);};}exports[_0x1841('0x2d')]=function(_0x1d18c3,_0x53a331){var _0x20d330={},_0x1d3d96={},_0x1af1c7={'count':0x0,'rows':[]};var _0x57ebc6=_[_0x1841('0x2e')](db[_0x1841('0x2f')][_0x1841('0x30')],function(_0x421ce0){return{'name':_0x421ce0['fieldName'],'type':_0x421ce0[_0x1841('0x31')][_0x1841('0x32')]};});_0x1d3d96[_0x1841('0x33')]=_[_0x1841('0x2e')](_0x57ebc6,'name');_0x1d3d96[_0x1841('0x34')]=_['keys'](_0x1d18c3[_0x1841('0x34')]);_0x1d3d96[_0x1841('0x35')]=_['intersection'](_0x1d3d96[_0x1841('0x33')],_0x1d3d96[_0x1841('0x34')]);_0x20d330[_0x1841('0x36')]=_[_0x1841('0x37')](_0x1d3d96[_0x1841('0x33')],qs[_0x1841('0x38')](_0x1d18c3[_0x1841('0x34')][_0x1841('0x38')]));_0x20d330[_0x1841('0x36')]=_0x20d330[_0x1841('0x36')][_0x1841('0x39')]?_0x20d330[_0x1841('0x36')]:_0x1d3d96[_0x1841('0x33')];if(!_0x1d18c3['query']['hasOwnProperty']('nolimit')){_0x20d330[_0x1841('0x1f')]=qs[_0x1841('0x1f')](_0x1d18c3['query'][_0x1841('0x1f')]);_0x20d330['offset']=qs[_0x1841('0x1e')](_0x1d18c3[_0x1841('0x34')]['offset']);}_0x20d330[_0x1841('0x3a')]=qs[_0x1841('0x3b')](_0x1d18c3[_0x1841('0x34')]['sort']);_0x20d330[_0x1841('0x3c')]=qs[_0x1841('0x35')](_[_0x1841('0x3d')](_0x1d18c3[_0x1841('0x34')],_0x1d3d96[_0x1841('0x35')]),_0x57ebc6);if(_0x1d18c3['query'][_0x1841('0x3e')]){_0x20d330[_0x1841('0x3c')]=_[_0x1841('0x3f')](_0x20d330[_0x1841('0x3c')],{'$or':_['map'](_0x57ebc6,function(_0x102e67){if(_0x102e67['type']!==_0x1841('0x40')){var _0x4d0f05={};_0x4d0f05[_0x102e67[_0x1841('0x2b')]]={'$like':'%'+_0x1d18c3[_0x1841('0x34')]['filter']+'%'};return _0x4d0f05;}})});}_0x20d330=_[_0x1841('0x3f')]({},_0x20d330,_0x1d18c3[_0x1841('0x41')]);var _0x3038b5={'where':_0x20d330[_0x1841('0x3c')]};return db['JscriptySessionReport'][_0x1841('0x21')](_0x3038b5)[_0x1841('0x28')](function(_0x148b66){_0x1af1c7[_0x1841('0x21')]=_0x148b66;if(_0x1d18c3[_0x1841('0x34')]['includeAll']){_0x20d330[_0x1841('0x42')]=[{'all':!![]}];}return db[_0x1841('0x2f')][_0x1841('0x43')](_0x20d330);})['then'](function(_0x3410a3){_0x1af1c7[_0x1841('0x44')]=_0x3410a3;return _0x1af1c7;})['then'](respondWithFilteredResult(_0x53a331,_0x20d330))[_0x1841('0x45')](handleError(_0x53a331,null));};exports[_0x1841('0x46')]=function(_0x3288ad,_0x314e0c){var _0x44a401={'raw':!![],'where':{'id':_0x3288ad[_0x1841('0x47')]['id']}},_0x5cd3c8={};_0x5cd3c8[_0x1841('0x33')]=_[_0x1841('0x48')](db['JscriptySessionReport'][_0x1841('0x30')]);_0x5cd3c8[_0x1841('0x34')]=_[_0x1841('0x48')](_0x3288ad['query']);_0x5cd3c8[_0x1841('0x35')]=_['intersection'](_0x5cd3c8[_0x1841('0x33')],_0x5cd3c8['query']);_0x44a401['attributes']=_['intersection'](_0x5cd3c8[_0x1841('0x33')],qs[_0x1841('0x38')](_0x3288ad[_0x1841('0x34')][_0x1841('0x38')]));_0x44a401[_0x1841('0x36')]=_0x44a401['attributes'][_0x1841('0x39')]?_0x44a401[_0x1841('0x36')]:_0x5cd3c8['model'];if(_0x3288ad[_0x1841('0x34')][_0x1841('0x49')]){_0x44a401[_0x1841('0x42')]=[{'all':!![]}];}_0x44a401=_[_0x1841('0x3f')]({},_0x44a401,_0x3288ad[_0x1841('0x41')]);return db['JscriptySessionReport'][_0x1841('0x4a')](_0x44a401)[_0x1841('0x28')](handleEntityNotFound(_0x314e0c,null))['then'](respondWithResult(_0x314e0c,null))[_0x1841('0x45')](handleError(_0x314e0c,null));};exports[_0x1841('0x4b')]=function(_0x582f39,_0x2e2bee){return db[_0x1841('0x2f')][_0x1841('0x4b')](_0x582f39[_0x1841('0x4c')],{})['then'](respondWithResult(_0x2e2bee,0xc9))[_0x1841('0x45')](handleError(_0x2e2bee,null));};exports[_0x1841('0x26')]=function(_0x29b1f2,_0x39ae61){if(_0x29b1f2[_0x1841('0x4c')]['id']){delete _0x29b1f2[_0x1841('0x4c')]['id'];}return db[_0x1841('0x2f')][_0x1841('0x4a')]({'where':{'id':_0x29b1f2['params']['id']}})[_0x1841('0x28')](handleEntityNotFound(_0x39ae61,null))['then'](saveUpdates(_0x29b1f2[_0x1841('0x4c')],null))['then'](respondWithResult(_0x39ae61,null))['catch'](handleError(_0x39ae61,null));};exports['destroy']=function(_0x53e426,_0x439c7f){return db[_0x1841('0x2f')][_0x1841('0x4a')]({'where':{'id':_0x53e426['params']['id']}})[_0x1841('0x28')](handleEntityNotFound(_0x439c7f,null))[_0x1841('0x28')](removeEntity(_0x439c7f,null))['catch'](handleError(_0x439c7f,null));};exports[_0x1841('0x4d')]=function(_0x4afcb3,_0x125a55){return db['JscriptySessionReport'][_0x1841('0x4d')]()[_0x1841('0x28')](respondWithResult(_0x125a55,null))[_0x1841('0x45')](handleError(_0x125a55,null));};exports[_0x1841('0x4e')]=function(_0x522d2b,_0x28d8c4,_0x46dc86){var _0x4a751d={'raw':!![],'where':{}};var _0x46e5d8={};var _0x4a7eb3={'count':0x0,'rows':[]};return db[_0x1841('0x2f')][_0x1841('0x4f')]({'where':{'id':_0x522d2b['params']['id']}})[_0x1841('0x28')](handleEntityNotFound(_0x28d8c4,null))[_0x1841('0x28')](function(_0x226d5a){if(_0x226d5a){_0x46e5d8[_0x1841('0x33')]=_[_0x1841('0x48')](db[_0x1841('0x50')]['rawAttributes']);_0x46e5d8[_0x1841('0x34')]=_[_0x1841('0x48')](_0x522d2b[_0x1841('0x34')]);_0x46e5d8[_0x1841('0x35')]=_[_0x1841('0x37')](_0x46e5d8[_0x1841('0x33')],_0x46e5d8[_0x1841('0x34')]);_0x4a751d[_0x1841('0x36')]=_[_0x1841('0x37')](_0x46e5d8[_0x1841('0x33')],qs['fields'](_0x522d2b[_0x1841('0x34')]['fields']));_0x4a751d[_0x1841('0x36')]=_0x4a751d[_0x1841('0x36')][_0x1841('0x39')]?_0x4a751d[_0x1841('0x36')]:_0x46e5d8[_0x1841('0x33')];if(!_0x522d2b[_0x1841('0x34')][_0x1841('0x51')]('nolimit')){_0x4a751d[_0x1841('0x1f')]=qs[_0x1841('0x1f')](_0x522d2b[_0x1841('0x34')][_0x1841('0x1f')]);_0x4a751d['offset']=qs[_0x1841('0x1e')](_0x522d2b['query'][_0x1841('0x1e')]);}_0x4a751d[_0x1841('0x3a')]=qs['sort'](_0x522d2b['query'][_0x1841('0x3b')]);_0x4a751d[_0x1841('0x3c')]=qs['filters'](_['pick'](_0x522d2b[_0x1841('0x34')],_0x46e5d8[_0x1841('0x35')]));_0x4a751d[_0x1841('0x3c')][_0x1841('0x52')]=_0x226d5a['id'];if(_0x522d2b[_0x1841('0x34')]['filter']){_0x4a751d['where']=_[_0x1841('0x3f')](_0x4a751d[_0x1841('0x3c')],{'$or':_[_0x1841('0x2e')](_0x4a751d['attributes'],function(_0x2991a6){var _0x1d57cd={};_0x1d57cd[_0x2991a6]={'$like':'%'+_0x522d2b[_0x1841('0x34')][_0x1841('0x3e')]+'%'};return _0x1d57cd;})});}_0x4a751d=_[_0x1841('0x3f')]({},_0x4a751d,_0x522d2b[_0x1841('0x41')]);return db[_0x1841('0x50')][_0x1841('0x21')]({'where':_0x4a751d[_0x1841('0x3c')]})[_0x1841('0x28')](function(_0x572d63){_0x4a7eb3[_0x1841('0x21')]=_0x572d63;if(_0x522d2b[_0x1841('0x34')][_0x1841('0x49')]){_0x4a751d['include']=[{'all':!![]}];}return db[_0x1841('0x50')][_0x1841('0x43')](_0x4a751d);})[_0x1841('0x28')](function(_0x30794f){_0x4a7eb3[_0x1841('0x44')]=_0x30794f;return _0x4a7eb3;});}})[_0x1841('0x28')](respondWithFilteredResult(_0x28d8c4,_0x4a751d))['catch'](handleError(_0x28d8c4,null));}; \ No newline at end of file +var _0xe71c=['apply','reject','save','then','destroy','status','end','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filters','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','getQuestions','findOne','JscriptyQuestionReport','intersection','order','sort','SessionId','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','limit','set','Content-Range'];(function(_0xdfe0e2,_0x4db65c){var _0x128349=function(_0x405ee6){while(--_0x405ee6){_0xdfe0e2['push'](_0xdfe0e2['shift']());}};_0x128349(++_0x4db65c);}(_0xe71c,0x180));var _0xce71=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0xe71c[_0x37a7c6];return _0x539905;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce71('0x0'));var zipdir=require(_0xce71('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce71('0x2'));var moment=require(_0xce71('0x3'));var BPromise=require(_0xce71('0x4'));var Mustache=require(_0xce71('0x5'));var util=require(_0xce71('0x6'));var path=require('path');var sox=require(_0xce71('0x7'));var csv=require(_0xce71('0x8'));var ejs=require(_0xce71('0x9'));var fs=require('fs');var fs_extra=require(_0xce71('0xa'));var _=require(_0xce71('0xb'));var squel=require(_0xce71('0xc'));var crypto=require(_0xce71('0xd'));var jsforce=require(_0xce71('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xce71('0xf'));var Papa=require(_0xce71('0x10'));var Redis=require(_0xce71('0x11'));var authService=require(_0xce71('0x12'));var qs=require(_0xce71('0x13'));var as=require(_0xce71('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xce71('0x15'));var config=require(_0xce71('0x16'));var licenseUtil=require(_0xce71('0x17'));var db=require(_0xce71('0x18'))['db'];function respondWithStatusCode(_0x65c8f4,_0x3ce4b9){_0x3ce4b9=_0x3ce4b9||0xcc;return function(_0x5581df){if(_0x5581df){return _0x65c8f4['sendStatus'](_0x3ce4b9);}return _0x65c8f4['status'](_0x3ce4b9)['end']();};}function respondWithResult(_0x29c8c3,_0x149b03){_0x149b03=_0x149b03||0xc8;return function(_0x314413){if(_0x314413){return _0x29c8c3['status'](_0x149b03)[_0xce71('0x19')](_0x314413);}};}function respondWithFilteredResult(_0x3e5d4b,_0x147035){return function(_0x5eb051){if(_0x5eb051){var _0x390fbf=typeof _0x147035[_0xce71('0x1a')]===_0xce71('0x1b')&&typeof _0x147035[_0xce71('0x1c')]===_0xce71('0x1b');var _0x15e14a=_0x5eb051['count'];var _0x42d2b1=_0x390fbf?0x0:_0x147035[_0xce71('0x1a')];var _0x1ab618=_0x390fbf?_0x5eb051['count']:_0x147035['offset']+_0x147035[_0xce71('0x1c')];var _0xe026ea;if(_0x1ab618>=_0x15e14a){_0x1ab618=_0x15e14a;_0xe026ea=0xc8;}else{_0xe026ea=0xce;}_0x3e5d4b['status'](_0xe026ea);return _0x3e5d4b[_0xce71('0x1d')](_0xce71('0x1e'),_0x42d2b1+'-'+_0x1ab618+'/'+_0x15e14a)['json'](_0x5eb051);}return null;};}function patchUpdates(_0x2c7330){return function(_0x3e54b3){try{jsonpatch[_0xce71('0x1f')](_0x3e54b3,_0x2c7330,!![]);}catch(_0x45bf65){return BPromise[_0xce71('0x20')](_0x45bf65);}return _0x3e54b3[_0xce71('0x21')]();};}function saveUpdates(_0x5021f6,_0x3dec2c){return function(_0xdbcdd1){if(_0xdbcdd1){return _0xdbcdd1['update'](_0x5021f6)[_0xce71('0x22')](function(_0x3e189f){return _0x3e189f;});}return null;};}function removeEntity(_0x3583c8,_0x255ffe){return function(_0x17932a){if(_0x17932a){return _0x17932a[_0xce71('0x23')]()[_0xce71('0x22')](function(){_0x3583c8[_0xce71('0x24')](0xcc)[_0xce71('0x25')]();});}};}function handleEntityNotFound(_0x1583be,_0x406e80){return function(_0x3255fe){if(!_0x3255fe){_0x1583be[_0xce71('0x26')](0x194);}return _0x3255fe;};}function handleError(_0x511498,_0x11ccf8){_0x11ccf8=_0x11ccf8||0x1f4;return function(_0x1fef60){logger[_0xce71('0x27')](_0x1fef60[_0xce71('0x28')]);if(_0x1fef60[_0xce71('0x29')]){delete _0x1fef60[_0xce71('0x29')];}_0x511498['status'](_0x11ccf8)[_0xce71('0x2a')](_0x1fef60);};}exports[_0xce71('0x2b')]=function(_0x3bdace,_0x16b2af){var _0x514f10={},_0x250c18={},_0x6ec4bf={'count':0x0,'rows':[]};var _0x31ebae=_[_0xce71('0x2c')](db[_0xce71('0x2d')][_0xce71('0x2e')],function(_0x20b8bc){return{'name':_0x20b8bc['fieldName'],'type':_0x20b8bc[_0xce71('0x2f')][_0xce71('0x30')]};});_0x250c18[_0xce71('0x31')]=_[_0xce71('0x2c')](_0x31ebae,_0xce71('0x29'));_0x250c18[_0xce71('0x32')]=_['keys'](_0x3bdace[_0xce71('0x32')]);_0x250c18['filters']=_['intersection'](_0x250c18[_0xce71('0x31')],_0x250c18['query']);_0x514f10[_0xce71('0x33')]=_['intersection'](_0x250c18[_0xce71('0x31')],qs['fields'](_0x3bdace['query'][_0xce71('0x34')]));_0x514f10[_0xce71('0x33')]=_0x514f10[_0xce71('0x33')][_0xce71('0x35')]?_0x514f10['attributes']:_0x250c18[_0xce71('0x31')];if(!_0x3bdace['query'][_0xce71('0x36')](_0xce71('0x37'))){_0x514f10[_0xce71('0x1c')]=qs[_0xce71('0x1c')](_0x3bdace[_0xce71('0x32')][_0xce71('0x1c')]);_0x514f10[_0xce71('0x1a')]=qs['offset'](_0x3bdace['query'][_0xce71('0x1a')]);}_0x514f10['order']=qs['sort'](_0x3bdace[_0xce71('0x32')]['sort']);_0x514f10[_0xce71('0x38')]=qs['filters'](_[_0xce71('0x39')](_0x3bdace[_0xce71('0x32')],_0x250c18[_0xce71('0x3a')]),_0x31ebae);if(_0x3bdace[_0xce71('0x32')]['filter']){_0x514f10['where']=_[_0xce71('0x3b')](_0x514f10['where'],{'$or':_[_0xce71('0x2c')](_0x31ebae,function(_0x3e2cfd){if(_0x3e2cfd['type']!==_0xce71('0x3c')){var _0x1dd2c3={};_0x1dd2c3[_0x3e2cfd['name']]={'$like':'%'+_0x3bdace[_0xce71('0x32')][_0xce71('0x3d')]+'%'};return _0x1dd2c3;}})});}_0x514f10=_[_0xce71('0x3b')]({},_0x514f10,_0x3bdace[_0xce71('0x3e')]);var _0x4164bb={'where':_0x514f10['where']};return db[_0xce71('0x2d')][_0xce71('0x3f')](_0x4164bb)['then'](function(_0x509758){_0x6ec4bf[_0xce71('0x3f')]=_0x509758;if(_0x3bdace[_0xce71('0x32')]['includeAll']){_0x514f10[_0xce71('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xce71('0x41')](_0x514f10);})[_0xce71('0x22')](function(_0x5938e0){_0x6ec4bf[_0xce71('0x42')]=_0x5938e0;return _0x6ec4bf;})[_0xce71('0x22')](respondWithFilteredResult(_0x16b2af,_0x514f10))[_0xce71('0x43')](handleError(_0x16b2af,null));};exports[_0xce71('0x44')]=function(_0x4f86c3,_0x5d2498){var _0x5d9c99={'raw':!![],'where':{'id':_0x4f86c3[_0xce71('0x45')]['id']}},_0x3178af={};_0x3178af[_0xce71('0x31')]=_[_0xce71('0x46')](db['JscriptySessionReport'][_0xce71('0x2e')]);_0x3178af[_0xce71('0x32')]=_[_0xce71('0x46')](_0x4f86c3[_0xce71('0x32')]);_0x3178af[_0xce71('0x3a')]=_['intersection'](_0x3178af[_0xce71('0x31')],_0x3178af[_0xce71('0x32')]);_0x5d9c99['attributes']=_['intersection'](_0x3178af['model'],qs['fields'](_0x4f86c3['query'][_0xce71('0x34')]));_0x5d9c99[_0xce71('0x33')]=_0x5d9c99[_0xce71('0x33')][_0xce71('0x35')]?_0x5d9c99[_0xce71('0x33')]:_0x3178af[_0xce71('0x31')];if(_0x4f86c3['query']['includeAll']){_0x5d9c99['include']=[{'all':!![]}];}_0x5d9c99=_[_0xce71('0x3b')]({},_0x5d9c99,_0x4f86c3[_0xce71('0x3e')]);return db[_0xce71('0x2d')][_0xce71('0x47')](_0x5d9c99)[_0xce71('0x22')](handleEntityNotFound(_0x5d2498,null))[_0xce71('0x22')](respondWithResult(_0x5d2498,null))[_0xce71('0x43')](handleError(_0x5d2498,null));};exports[_0xce71('0x48')]=function(_0x544361,_0x501068){return db[_0xce71('0x2d')][_0xce71('0x48')](_0x544361[_0xce71('0x49')],{})[_0xce71('0x22')](respondWithResult(_0x501068,0xc9))[_0xce71('0x43')](handleError(_0x501068,null));};exports[_0xce71('0x4a')]=function(_0x255f7c,_0xd2f6cb){if(_0x255f7c['body']['id']){delete _0x255f7c[_0xce71('0x49')]['id'];}return db[_0xce71('0x2d')][_0xce71('0x47')]({'where':{'id':_0x255f7c['params']['id']}})[_0xce71('0x22')](handleEntityNotFound(_0xd2f6cb,null))[_0xce71('0x22')](saveUpdates(_0x255f7c[_0xce71('0x49')],null))[_0xce71('0x22')](respondWithResult(_0xd2f6cb,null))[_0xce71('0x43')](handleError(_0xd2f6cb,null));};exports[_0xce71('0x23')]=function(_0x230b3e,_0xbf67ca){return db[_0xce71('0x2d')]['find']({'where':{'id':_0x230b3e[_0xce71('0x45')]['id']}})[_0xce71('0x22')](handleEntityNotFound(_0xbf67ca,null))[_0xce71('0x22')](removeEntity(_0xbf67ca,null))[_0xce71('0x43')](handleError(_0xbf67ca,null));};exports[_0xce71('0x4b')]=function(_0x20402a,_0x3e2486){return db['JscriptySessionReport']['describe']()['then'](respondWithResult(_0x3e2486,null))[_0xce71('0x43')](handleError(_0x3e2486,null));};exports[_0xce71('0x4c')]=function(_0x7f3532,_0x2d9df1,_0x45a110){var _0x39c531={'raw':!![],'where':{}};var _0x5ebc25={};var _0x7f1a3d={'count':0x0,'rows':[]};return db[_0xce71('0x2d')][_0xce71('0x4d')]({'where':{'id':_0x7f3532[_0xce71('0x45')]['id']}})[_0xce71('0x22')](handleEntityNotFound(_0x2d9df1,null))['then'](function(_0x15ff96){if(_0x15ff96){_0x5ebc25[_0xce71('0x31')]=_['keys'](db[_0xce71('0x4e')][_0xce71('0x2e')]);_0x5ebc25[_0xce71('0x32')]=_[_0xce71('0x46')](_0x7f3532[_0xce71('0x32')]);_0x5ebc25[_0xce71('0x3a')]=_[_0xce71('0x4f')](_0x5ebc25['model'],_0x5ebc25[_0xce71('0x32')]);_0x39c531[_0xce71('0x33')]=_['intersection'](_0x5ebc25['model'],qs[_0xce71('0x34')](_0x7f3532[_0xce71('0x32')]['fields']));_0x39c531[_0xce71('0x33')]=_0x39c531['attributes']['length']?_0x39c531[_0xce71('0x33')]:_0x5ebc25[_0xce71('0x31')];if(!_0x7f3532[_0xce71('0x32')]['hasOwnProperty'](_0xce71('0x37'))){_0x39c531[_0xce71('0x1c')]=qs[_0xce71('0x1c')](_0x7f3532[_0xce71('0x32')][_0xce71('0x1c')]);_0x39c531[_0xce71('0x1a')]=qs['offset'](_0x7f3532[_0xce71('0x32')][_0xce71('0x1a')]);}_0x39c531[_0xce71('0x50')]=qs[_0xce71('0x51')](_0x7f3532[_0xce71('0x32')]['sort']);_0x39c531['where']=qs[_0xce71('0x3a')](_[_0xce71('0x39')](_0x7f3532['query'],_0x5ebc25['filters']));_0x39c531[_0xce71('0x38')][_0xce71('0x52')]=_0x15ff96['id'];if(_0x7f3532[_0xce71('0x32')][_0xce71('0x3d')]){_0x39c531['where']=_['merge'](_0x39c531[_0xce71('0x38')],{'$or':_[_0xce71('0x2c')](_0x39c531[_0xce71('0x33')],function(_0x2101c8){var _0x3665b3={};_0x3665b3[_0x2101c8]={'$like':'%'+_0x7f3532[_0xce71('0x32')][_0xce71('0x3d')]+'%'};return _0x3665b3;})});}_0x39c531=_['merge']({},_0x39c531,_0x7f3532['options']);return db['JscriptyQuestionReport']['count']({'where':_0x39c531[_0xce71('0x38')]})[_0xce71('0x22')](function(_0x47f5ae){_0x7f1a3d['count']=_0x47f5ae;if(_0x7f3532['query']['includeAll']){_0x39c531[_0xce71('0x40')]=[{'all':!![]}];}return db[_0xce71('0x4e')]['findAll'](_0x39c531);})[_0xce71('0x22')](function(_0x280189){_0x7f1a3d[_0xce71('0x42')]=_0x280189;return _0x7f1a3d;});}})[_0xce71('0x22')](respondWithFilteredResult(_0x2d9df1,_0x39c531))[_0xce71('0x43')](handleError(_0x2d9df1,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index d3afbb9..5a47ba8 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 _0x7278=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports'];(function(_0x5a8f86,_0x46c1b1){var _0x5a16e6=function(_0x209879){while(--_0x209879){_0x5a8f86['push'](_0x5a8f86['shift']());}};_0x5a16e6(++_0x46c1b1);}(_0x7278,0x161));var _0x8727=function(_0x2d65e5,_0x26c338){_0x2d65e5=_0x2d65e5-0x0;var _0x24137d=_0x7278[_0x2d65e5];return _0x24137d;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));module[_0x8727('0xa')]=function(_0x180b71,_0x5549d5){return _0x180b71[_0x8727('0xb')](_0x8727('0xc'),attributes,{'tableName':_0x8727('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3eea=['exports','JscriptySessionReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x45a5ae,_0x2d811c){var _0x597a83=function(_0xb8bcee){while(--_0xb8bcee){_0x45a5ae['push'](_0x45a5ae['shift']());}};_0x597a83(++_0x2d811c);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x33a080,_0x479b75){_0x33a080=_0x33a080-0x0;var _0x24af39=_0x3eea[_0x33a080];return _0x24af39;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var logger=require(_0xa3ee('0x1'))(_0xa3ee('0x2'));var moment=require(_0xa3ee('0x3'));var BPromise=require(_0xa3ee('0x4'));var rp=require(_0xa3ee('0x5'));var fs=require('fs');var path=require(_0xa3ee('0x6'));var rimraf=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var attributes=require(_0xa3ee('0x9'));module[_0xa3ee('0xa')]=function(_0xb93cdb,_0x5776bb){return _0xb93cdb['define'](_0xa3ee('0xb'),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 6413ec7..e9de7f6 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 _0x5fdc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptySessionReport,\x20%s,\x20%s','info','lodash','util','moment','bluebird','randomstring'];(function(_0x3bbba6,_0x1b66f4){var _0x1a6895=function(_0x473c0a){while(--_0x473c0a){_0x3bbba6['push'](_0x3bbba6['shift']());}};_0x1a6895(++_0x1b66f4);}(_0x5fdc,0x127));var _0xc5fd=function(_0x5219f4,_0x22fe9b){_0x5219f4=_0x5219f4-0x0;var _0x134dee=_0x5fdc[_0x5219f4];return _0x134dee;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var moment=require(_0xc5fd('0x2'));var BPromise=require(_0xc5fd('0x3'));var rs=require(_0xc5fd('0x4'));var fs=require('fs');var Redis=require(_0xc5fd('0x5'));var db=require(_0xc5fd('0x6'))['db'];var utils=require(_0xc5fd('0x7'));var logger=require(_0xc5fd('0x8'))(_0xc5fd('0x9'));var config=require(_0xc5fd('0xa'));var jayson=require(_0xc5fd('0xb'));var client=jayson[_0xc5fd('0xc')][_0xc5fd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x15ffe7,_0x5a2eb4,_0x5d86e5){return new BPromise(function(_0x493389,_0x224801){return client[_0xc5fd('0xe')](_0x15ffe7,_0x5d86e5)[_0xc5fd('0xf')](function(_0x45c91f){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x5a2eb4,_0xc5fd('0x10'));logger[_0xc5fd('0x11')](_0xc5fd('0x12'),_0x5a2eb4,_0xc5fd('0x10'),JSON[_0xc5fd('0x13')](_0x45c91f));if(_0x45c91f[_0xc5fd('0x14')]){if(_0x45c91f['error'][_0xc5fd('0x15')]===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x5a2eb4,_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);return _0x224801(_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);}logger[_0xc5fd('0x14')](_0xc5fd('0x17'),_0x5a2eb4,_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);return _0x493389(_0x45c91f['error'][_0xc5fd('0x16')]);}else{logger[_0xc5fd('0x18')](_0xc5fd('0x17'),_0x5a2eb4,_0xc5fd('0x10'));_0x493389(_0x45c91f['result']['message']);}})['catch'](function(_0x5529b3){logger['error'](_0xc5fd('0x17'),_0x5a2eb4,_0x5529b3);_0x224801(_0x5529b3);});});} \ No newline at end of file +var _0x32b6=['JscriptySessionReport,\x20%s,\x20%s','message','info','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code'];(function(_0x332985,_0x216420){var _0x1a77c1=function(_0x5a64fb){while(--_0x5a64fb){_0x332985['push'](_0x332985['shift']());}};_0x1a77c1(++_0x216420);}(_0x32b6,0x1d1));var _0x632b=function(_0x4f16ff,_0x247dc3){_0x4f16ff=_0x4f16ff-0x0;var _0xbdd1ed=_0x32b6[_0x4f16ff];return _0xbdd1ed;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index fb52c2f..cd07ad8 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 _0x48cc=['update','/download_log_file','exports','util','path','express','fs-extra','../../components/auth/service','./license.controller','index','put','/:id','isAuthenticated'];(function(_0x164ef5,_0xba6238){var _0x2d60c5=function(_0x34deca){while(--_0x34deca){_0x164ef5['push'](_0x164ef5['shift']());}};_0x2d60c5(++_0xba6238);}(_0x48cc,0x1ca));var _0xc48c=function(_0x259a38,_0x326eed){_0x259a38=_0x259a38-0x0;var _0x5ce448=_0x48cc[_0x259a38];return _0x5ce448;};'use strict';var multer=require('multer');var util=require(_0xc48c('0x0'));var path=require(_0xc48c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc48c('0x2'));var router=express['Router']();var fs_extra=require(_0xc48c('0x3'));var auth=require(_0xc48c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc48c('0x5'));router['get']('/',controller[_0xc48c('0x6')]);router[_0xc48c('0x7')](_0xc48c('0x8'),auth[_0xc48c('0x9')](),controller[_0xc48c('0xa')]);router['get'](_0xc48c('0xb'),auth[_0xc48c('0x9')](),controller['downloadLogFile']);module[_0xc48c('0xc')]=router; \ No newline at end of file +var _0xdc3e=['/download_log_file','downloadLogFile','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','put','/:id','isAuthenticated','update'];(function(_0x1c4188,_0x257099){var _0x26dbba=function(_0x33a9a5){while(--_0x33a9a5){_0x1c4188['push'](_0x1c4188['shift']());}};_0x26dbba(++_0x257099);}(_0xdc3e,0x113));var _0xedc3=function(_0x2e58ff,_0x187c44){_0x2e58ff=_0x2e58ff-0x0;var _0x477b02=_0xdc3e[_0x2e58ff];return _0x477b02;};'use strict';var multer=require(_0xedc3('0x0'));var util=require('util');var path=require(_0xedc3('0x1'));var timeout=require(_0xedc3('0x2'));var express=require(_0xedc3('0x3'));var router=express[_0xedc3('0x4')]();var fs_extra=require(_0xedc3('0x5'));var auth=require(_0xedc3('0x6'));var interaction=require(_0xedc3('0x7'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0xedc3('0x8')]('/',controller['index']);router[_0xedc3('0x9')](_0xedc3('0xa'),auth[_0xedc3('0xb')](),controller[_0xedc3('0xc')]);router[_0xedc3('0x8')](_0xedc3('0xd'),auth[_0xedc3('0xb')](),controller[_0xedc3('0xe')]);module[_0xedc3('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index e660175..fdde17c 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 _0x9986=['exports','TEXT','STRING','INTEGER'];(function(_0x2acd64,_0x4e8ce8){var _0x3d3fce=function(_0x5570df){while(--_0x5570df){_0x2acd64['push'](_0x2acd64['shift']());}};_0x3d3fce(++_0x4e8ce8);}(_0x9986,0x130));var _0x6998=function(_0x365111,_0x1c536c){_0x365111=_0x365111-0x0;var _0x5d6090=_0x9986[_0x365111];return _0x5d6090;};'use strict';var Sequelize=require('sequelize');module[_0x6998('0x0')]={'license':{'type':Sequelize[_0x6998('0x1')]},'data1':{'type':Sequelize[_0x6998('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x6998('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x87bd=['exports','TEXT','STRING','INTEGER'];(function(_0xe064bc,_0x2addbd){var _0x1839ba=function(_0x36bc39){while(--_0x36bc39){_0xe064bc['push'](_0xe064bc['shift']());}};_0x1839ba(++_0x2addbd);}(_0x87bd,0x1c8));var _0xd87b=function(_0x2ee71f,_0x35b42e){_0x2ee71f=_0x2ee71f-0x0;var _0xf95c54=_0x87bd[_0x2ee71f];return _0xf95c54;};'use strict';var Sequelize=require('sequelize');module[_0xd87b('0x0')]={'license':{'type':Sequelize[_0xd87b('0x1')]},'data1':{'type':Sequelize[_0xd87b('0x2')]},'data2':{'type':Sequelize[_0xd87b('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 5122a09..cdeb232 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 _0xef4b=['join','/var','log','xcally','setHeader','attachment;\x20filename=','set','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','Content-Range','reject','save','update','destroy','then','error','name','model','keys','query','filters','intersection','attributes','fields','length','options','catch','body','License','find','get','checkLicense','key','demo','downloadLogFile'];(function(_0x30d77b,_0x2b309b){var _0x151c30=function(_0x359640){while(--_0x359640){_0x30d77b['push'](_0x30d77b['shift']());}};_0x151c30(++_0x2b309b);}(_0xef4b,0xd6));var _0xbef4=function(_0x5c4d15,_0x32fe23){_0x5c4d15=_0x5c4d15-0x0;var _0x1f974a=_0xef4b[_0x5c4d15];return _0x1f974a;};'use strict';var emlformat=require(_0xbef4('0x0'));var rimraf=require(_0xbef4('0x1'));var zipdir=require(_0xbef4('0x2'));var jsonpatch=require(_0xbef4('0x3'));var rp=require('request-promise');var moment=require(_0xbef4('0x4'));var BPromise=require(_0xbef4('0x5'));var Mustache=require(_0xbef4('0x6'));var util=require(_0xbef4('0x7'));var path=require(_0xbef4('0x8'));var sox=require(_0xbef4('0x9'));var csv=require('to-csv');var ejs=require(_0xbef4('0xa'));var fs=require('fs');var fs_extra=require(_0xbef4('0xb'));var _=require('lodash');var squel=require(_0xbef4('0xc'));var crypto=require(_0xbef4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbef4('0xe'));var toCsv=require(_0xbef4('0xf'));var querystring=require(_0xbef4('0x10'));var Papa=require(_0xbef4('0x11'));var Redis=require(_0xbef4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbef4('0x13'));var as=require(_0xbef4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbef4('0x15'));var utils=require(_0xbef4('0x16'));var config=require(_0xbef4('0x17'));var licenseUtil=require(_0xbef4('0x18'));var db=require(_0xbef4('0x19'))['db'];function respondWithStatusCode(_0x194650,_0x25ab38){_0x25ab38=_0x25ab38||0xcc;return function(_0x4b36f7){if(_0x4b36f7){return _0x194650[_0xbef4('0x1a')](_0x25ab38);}return _0x194650[_0xbef4('0x1b')](_0x25ab38)[_0xbef4('0x1c')]();};}function respondWithResult(_0x109a8d,_0x579847){_0x579847=_0x579847||0xc8;return function(_0xdb7031){if(_0xdb7031){return _0x109a8d['status'](_0x579847)[_0xbef4('0x1d')](_0xdb7031);}};}function respondWithFilteredResult(_0x2eac75,_0x344fd1){return function(_0x8c3a1c){if(_0x8c3a1c){var _0x3aff66=typeof _0x344fd1[_0xbef4('0x1e')]==='undefined'&&typeof _0x344fd1['limit']==='undefined';var _0x109cf6=_0x8c3a1c[_0xbef4('0x1f')];var _0x1c8c25=_0x3aff66?0x0:_0x344fd1[_0xbef4('0x1e')];var _0x440a6b=_0x3aff66?_0x8c3a1c[_0xbef4('0x1f')]:_0x344fd1[_0xbef4('0x1e')]+_0x344fd1['limit'];var _0x51a867;if(_0x440a6b>=_0x109cf6){_0x440a6b=_0x109cf6;_0x51a867=0xc8;}else{_0x51a867=0xce;}_0x2eac75[_0xbef4('0x1b')](_0x51a867);return _0x2eac75['set'](_0xbef4('0x20'),_0x1c8c25+'-'+_0x440a6b+'/'+_0x109cf6)[_0xbef4('0x1d')](_0x8c3a1c);}return null;};}function patchUpdates(_0x2d7483){return function(_0x41343b){try{jsonpatch['apply'](_0x41343b,_0x2d7483,!![]);}catch(_0x4582e3){return BPromise[_0xbef4('0x21')](_0x4582e3);}return _0x41343b[_0xbef4('0x22')]();};}function saveUpdates(_0x288e40,_0x5ce808){return function(_0x18703f){if(_0x18703f){return _0x18703f[_0xbef4('0x23')](_0x288e40)['then'](function(_0x1f352d){return _0x1f352d;});}return null;};}function removeEntity(_0x92d152,_0x4af4d7){return function(_0x3ff1fa){if(_0x3ff1fa){return _0x3ff1fa[_0xbef4('0x24')]()[_0xbef4('0x25')](function(){_0x92d152[_0xbef4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b2363,_0x2fbdc6){return function(_0x368102){if(!_0x368102){_0x2b2363['sendStatus'](0x194);}return _0x368102;};}function handleError(_0x522615,_0x1e8960){_0x1e8960=_0x1e8960||0x1f4;return function(_0xb024dc){logger[_0xbef4('0x26')](_0xb024dc['stack']);if(_0xb024dc['name']){delete _0xb024dc[_0xbef4('0x27')];}_0x522615[_0xbef4('0x1b')](_0x1e8960)['send'](_0xb024dc);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x2b78b1,_0xbc53cf){var _0x69e2ec={'raw':!![],'where':{'id':0x1}},_0x188707={};_0x188707[_0xbef4('0x28')]=_['keys'](db['License']['rawAttributes']);_0x188707['query']=_[_0xbef4('0x29')](_0x2b78b1[_0xbef4('0x2a')]);_0x188707[_0xbef4('0x2b')]=_[_0xbef4('0x2c')](_0x188707[_0xbef4('0x28')],_0x188707['query']);_0x69e2ec[_0xbef4('0x2d')]=_['intersection'](_0x188707[_0xbef4('0x28')],qs[_0xbef4('0x2e')](_0x2b78b1[_0xbef4('0x2a')][_0xbef4('0x2e')]));_0x69e2ec[_0xbef4('0x2d')]=_0x69e2ec[_0xbef4('0x2d')][_0xbef4('0x2f')]?_0x69e2ec[_0xbef4('0x2d')]:_0x188707['model'];_0x69e2ec=_['merge']({},_0x69e2ec,_0x2b78b1[_0xbef4('0x30')]);return utilLicense['getLicense'](_0x69e2ec)[_0xbef4('0x25')](respondWithResult(_0xbc53cf,null))[_0xbef4('0x31')](handleError(_0xbc53cf,null));};exports[_0xbef4('0x23')]=function(_0x4e267e,_0x577924){if(_0x4e267e['body']['id']){delete _0x4e267e[_0xbef4('0x32')]['id'];}return db[_0xbef4('0x33')][_0xbef4('0x34')]({'where':{'id':_0x4e267e['params']['id']}})[_0xbef4('0x25')](handleEntityNotFound(_0x577924,null))['then'](function(_0x426f28){var _0xe2dd7a=_0x426f28[_0xbef4('0x35')]({'plain':!![]});return utilLicense[_0xbef4('0x36')](_0xe2dd7a,_0x4e267e['body'][_0xbef4('0x37')]);})['then'](function(_0x38e26f){if(!_0x38e26f[_0xbef4('0x38')]){return saveUpdates(_0x4e267e[_0xbef4('0x32')],null);}return _0x38e26f;})[_0xbef4('0x25')](respondWithResult(_0x577924,null))[_0xbef4('0x31')](handleError(_0x577924,null));};exports[_0xbef4('0x39')]=function(_0x5508f6,_0x34a845){var _0xd1d95c='license-info.log';var _0x463bd9=path[_0xbef4('0x3a')](_0xbef4('0x3b'),_0xbef4('0x3c'),_0xbef4('0x3d'),_0xd1d95c);_0x34a845[_0xbef4('0x3e')]('Content-disposition',_0xbef4('0x3f')+_0xd1d95c);_0x34a845[_0xbef4('0x40')](_0xbef4('0x41'),_0xbef4('0x42'));_0x34a845[_0xbef4('0x43')](_0x463bd9);}; \ No newline at end of file +var _0x88d5=['../../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','reject','save','update','destroy','error','stack','name','index','model','keys','License','rawAttributes','query','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','checkLicense','key','then','demo','downloadLogFile','license-info.log','join','/var','log','xcally','Content-disposition','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x11777c,_0x2c4318){var _0xc7fa8e=function(_0x2ee785){while(--_0x2ee785){_0x11777c['push'](_0x11777c['shift']());}};_0xc7fa8e(++_0x2c4318);}(_0x88d5,0x83));var _0x588d=function(_0x1ed78f,_0x5ab61b){_0x1ed78f=_0x1ed78f-0x0;var _0x46f620=_0x88d5[_0x1ed78f];return _0x46f620;};'use strict';var emlformat=require(_0x588d('0x0'));var rimraf=require(_0x588d('0x1'));var zipdir=require(_0x588d('0x2'));var jsonpatch=require(_0x588d('0x3'));var rp=require(_0x588d('0x4'));var moment=require(_0x588d('0x5'));var BPromise=require(_0x588d('0x6'));var Mustache=require(_0x588d('0x7'));var util=require(_0x588d('0x8'));var path=require(_0x588d('0x9'));var sox=require(_0x588d('0xa'));var csv=require(_0x588d('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x588d('0xc'));var _=require(_0x588d('0xd'));var squel=require('squel');var crypto=require(_0x588d('0xe'));var jsforce=require(_0x588d('0xf'));var deskjs=require(_0x588d('0x10'));var toCsv=require(_0x588d('0xb'));var querystring=require(_0x588d('0x11'));var Papa=require(_0x588d('0x12'));var Redis=require(_0x588d('0x13'));var authService=require(_0x588d('0x14'));var qs=require(_0x588d('0x15'));var as=require(_0x588d('0x16'));var hardwareService=require(_0x588d('0x17'));var logger=require(_0x588d('0x18'))(_0x588d('0x19'));var utils=require(_0x588d('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x588d('0x1b'));var db=require(_0x588d('0x1c'))['db'];function respondWithStatusCode(_0x3781c2,_0x4ff490){_0x4ff490=_0x4ff490||0xcc;return function(_0x34491e){if(_0x34491e){return _0x3781c2[_0x588d('0x1d')](_0x4ff490);}return _0x3781c2['status'](_0x4ff490)[_0x588d('0x1e')]();};}function respondWithResult(_0x149a9e,_0x3949ba){_0x3949ba=_0x3949ba||0xc8;return function(_0x12869e){if(_0x12869e){return _0x149a9e['status'](_0x3949ba)[_0x588d('0x1f')](_0x12869e);}};}function respondWithFilteredResult(_0x4013d0,_0x2d01dd){return function(_0x482c94){if(_0x482c94){var _0x4401cc=typeof _0x2d01dd[_0x588d('0x20')]===_0x588d('0x21')&&typeof _0x2d01dd[_0x588d('0x22')]===_0x588d('0x21');var _0x1ad40a=_0x482c94[_0x588d('0x23')];var _0x1f9f5d=_0x4401cc?0x0:_0x2d01dd['offset'];var _0x285f8f=_0x4401cc?_0x482c94[_0x588d('0x23')]:_0x2d01dd[_0x588d('0x20')]+_0x2d01dd['limit'];var _0x408018;if(_0x285f8f>=_0x1ad40a){_0x285f8f=_0x1ad40a;_0x408018=0xc8;}else{_0x408018=0xce;}_0x4013d0[_0x588d('0x24')](_0x408018);return _0x4013d0[_0x588d('0x25')](_0x588d('0x26'),_0x1f9f5d+'-'+_0x285f8f+'/'+_0x1ad40a)[_0x588d('0x1f')](_0x482c94);}return null;};}function patchUpdates(_0x31758a){return function(_0x52a5f1){try{jsonpatch['apply'](_0x52a5f1,_0x31758a,!![]);}catch(_0x2a4144){return BPromise[_0x588d('0x27')](_0x2a4144);}return _0x52a5f1[_0x588d('0x28')]();};}function saveUpdates(_0x569376,_0x2f4f8e){return function(_0x5a24f5){if(_0x5a24f5){return _0x5a24f5[_0x588d('0x29')](_0x569376)['then'](function(_0x563de6){return _0x563de6;});}return null;};}function removeEntity(_0x458622,_0x523db9){return function(_0x480fc6){if(_0x480fc6){return _0x480fc6[_0x588d('0x2a')]()['then'](function(){_0x458622[_0x588d('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126af0,_0x3d6734){return function(_0xceb173){if(!_0xceb173){_0x126af0[_0x588d('0x1d')](0x194);}return _0xceb173;};}function handleError(_0x3209c6,_0x2c862f){_0x2c862f=_0x2c862f||0x1f4;return function(_0x3badf7){logger[_0x588d('0x2b')](_0x3badf7[_0x588d('0x2c')]);if(_0x3badf7['name']){delete _0x3badf7[_0x588d('0x2d')];}_0x3209c6['status'](_0x2c862f)['send'](_0x3badf7);};}var utilLicense=require(_0x588d('0x1b'));exports[_0x588d('0x2e')]=function(_0x43ba2c,_0x4e58a5){var _0x8e9a3a={'raw':!![],'where':{'id':0x1}},_0x346b64={};_0x346b64[_0x588d('0x2f')]=_[_0x588d('0x30')](db[_0x588d('0x31')][_0x588d('0x32')]);_0x346b64[_0x588d('0x33')]=_[_0x588d('0x30')](_0x43ba2c[_0x588d('0x33')]);_0x346b64['filters']=_[_0x588d('0x34')](_0x346b64[_0x588d('0x2f')],_0x346b64[_0x588d('0x33')]);_0x8e9a3a[_0x588d('0x35')]=_['intersection'](_0x346b64[_0x588d('0x2f')],qs[_0x588d('0x36')](_0x43ba2c[_0x588d('0x33')][_0x588d('0x36')]));_0x8e9a3a[_0x588d('0x35')]=_0x8e9a3a['attributes'][_0x588d('0x37')]?_0x8e9a3a[_0x588d('0x35')]:_0x346b64[_0x588d('0x2f')];_0x8e9a3a=_[_0x588d('0x38')]({},_0x8e9a3a,_0x43ba2c[_0x588d('0x39')]);return utilLicense[_0x588d('0x3a')](_0x8e9a3a)['then'](respondWithResult(_0x4e58a5,null))[_0x588d('0x3b')](handleError(_0x4e58a5,null));};exports[_0x588d('0x29')]=function(_0x3261ec,_0x24e3aa){if(_0x3261ec[_0x588d('0x3c')]['id']){delete _0x3261ec[_0x588d('0x3c')]['id'];}return db['License'][_0x588d('0x3d')]({'where':{'id':_0x3261ec[_0x588d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x24e3aa,null))['then'](function(_0x430ca5){var _0x379133=_0x430ca5['get']({'plain':!![]});return utilLicense[_0x588d('0x3f')](_0x379133,_0x3261ec['body'][_0x588d('0x40')]);})[_0x588d('0x41')](function(_0x4ceed1){if(!_0x4ceed1[_0x588d('0x42')]){return saveUpdates(_0x3261ec[_0x588d('0x3c')],null);}return _0x4ceed1;})['then'](respondWithResult(_0x24e3aa,null))['catch'](handleError(_0x24e3aa,null));};exports[_0x588d('0x43')]=function(_0x252f68,_0x14a613){var _0x2bf55d=_0x588d('0x44');var _0x530468=path[_0x588d('0x45')](_0x588d('0x46'),_0x588d('0x47'),_0x588d('0x48'),_0x2bf55d);_0x14a613['setHeader'](_0x588d('0x49'),'attachment;\x20filename='+_0x2bf55d);_0x14a613['set']('Content-Type',_0x588d('0x4a'));_0x14a613[_0x588d('0x4b')](_0x530468);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 7feb43d..b896459 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 _0xaed8=['exports','define','License','license','lodash','util','../../config/logger','moment','path','./license.attributes'];(function(_0x522b16,_0x4d39eb){var _0x44702a=function(_0x329052){while(--_0x329052){_0x522b16['push'](_0x522b16['shift']());}};_0x44702a(++_0x4d39eb);}(_0xaed8,0xf4));var _0x8aed=function(_0x2b0bc2,_0x4331f5){_0x2b0bc2=_0x2b0bc2-0x0;var _0x56e5b9=_0xaed8[_0x2b0bc2];return _0x56e5b9;};'use strict';var _=require(_0x8aed('0x0'));var util=require(_0x8aed('0x1'));var logger=require(_0x8aed('0x2'))('api');var moment=require(_0x8aed('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8aed('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8aed('0x5'));module[_0x8aed('0x6')]=function(_0x4ec866,_0xd8483b){return _0x4ec866[_0x8aed('0x7')](_0x8aed('0x8'),attributes,{'tableName':_0x8aed('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5722=['rimraf','../../config/environment','exports','define','License','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x545abf,_0xe28ec8){var _0x115ca4=function(_0x561f23){while(--_0x561f23){_0x545abf['push'](_0x545abf['shift']());}};_0x115ca4(++_0xe28ec8);}(_0x5722,0xf7));var _0x2572=function(_0x1d723d,_0x1a064c){_0x1d723d=_0x1d723d-0x0;var _0x30cec1=_0x5722[_0x1d723d];return _0x30cec1;};'use strict';var _=require(_0x2572('0x0'));var util=require(_0x2572('0x1'));var logger=require(_0x2572('0x2'))(_0x2572('0x3'));var moment=require('moment');var BPromise=require(_0x2572('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2572('0x5'));var rimraf=require(_0x2572('0x6'));var config=require(_0x2572('0x7'));var attributes=require('./license.attributes');module[_0x2572('0x8')]=function(_0x38d4c2,_0x383f81){return _0x38d4c2[_0x2572('0x9')](_0x2572('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 93d5bb1..d0b2928 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 _0x70fb=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x70fb,0x143));var _0xb70f=function(_0x5c85c8,_0x16110b){_0x5c85c8=_0x5c85c8-0x0;var _0x42d66f=_0x70fb[_0x5c85c8];return _0x42d66f;};'use strict';var _=require(_0xb70f('0x0'));var util=require(_0xb70f('0x1'));var moment=require(_0xb70f('0x2'));var BPromise=require(_0xb70f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb70f('0x4'));var db=require(_0xb70f('0x5'))['db'];var utils=require(_0xb70f('0x6'));var logger=require('../../config/logger')(_0xb70f('0x7'));var config=require(_0xb70f('0x8'));var jayson=require(_0xb70f('0x9'));var client=jayson['client'][_0xb70f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4faed0,_0x229a55,_0x127c31){return new BPromise(function(_0xc35608,_0x3411eb){return client[_0xb70f('0xb')](_0x4faed0,_0x127c31)[_0xb70f('0xc')](function(_0x398c83){logger[_0xb70f('0xd')](_0xb70f('0xe'),_0x229a55,_0xb70f('0xf'));logger[_0xb70f('0x10')](_0xb70f('0x11'),_0x229a55,_0xb70f('0xf'),JSON[_0xb70f('0x12')](_0x398c83));if(_0x398c83[_0xb70f('0x13')]){if(_0x398c83[_0xb70f('0x13')][_0xb70f('0x14')]===0x1f4){logger['error'](_0xb70f('0xe'),_0x229a55,_0x398c83['error'][_0xb70f('0x15')]);return _0x3411eb(_0x398c83[_0xb70f('0x13')][_0xb70f('0x15')]);}logger[_0xb70f('0x13')](_0xb70f('0xe'),_0x229a55,_0x398c83[_0xb70f('0x13')][_0xb70f('0x15')]);return _0xc35608(_0x398c83['error'][_0xb70f('0x15')]);}else{logger[_0xb70f('0xd')](_0xb70f('0xe'),_0x229a55,'request\x20sent');_0xc35608(_0x398c83['result'][_0xb70f('0x15')]);}})[_0xb70f('0x16')](function(_0x32efbb){logger[_0xb70f('0x13')]('License,\x20%s,\x20%s',_0x229a55,_0x32efbb);_0x3411eb(_0x32efbb);});});} \ No newline at end of file +var _0xfa00=['request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','client','request','then','info','License,\x20%s,\x20%s'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xfa00,0x79));var _0x0fa0=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xfa00[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x0fa0('0x0'));var util=require(_0x0fa0('0x1'));var moment=require(_0x0fa0('0x2'));var BPromise=require(_0x0fa0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0fa0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fa0('0x5'))(_0x0fa0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0fa0('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x301e5e,_0x32667e,_0x56b963){return new BPromise(function(_0x3430c2,_0x44c0ee){return client[_0x0fa0('0x8')](_0x301e5e,_0x56b963)[_0x0fa0('0x9')](function(_0x5fae08){logger[_0x0fa0('0xa')](_0x0fa0('0xb'),_0x32667e,_0x0fa0('0xc'));logger[_0x0fa0('0xd')](_0x0fa0('0xe'),_0x32667e,_0x0fa0('0xc'),JSON[_0x0fa0('0xf')](_0x5fae08));if(_0x5fae08['error']){if(_0x5fae08[_0x0fa0('0x10')]['code']===0x1f4){logger[_0x0fa0('0x10')](_0x0fa0('0xb'),_0x32667e,_0x5fae08[_0x0fa0('0x10')][_0x0fa0('0x11')]);return _0x44c0ee(_0x5fae08['error'][_0x0fa0('0x11')]);}logger[_0x0fa0('0x10')](_0x0fa0('0xb'),_0x32667e,_0x5fae08[_0x0fa0('0x10')][_0x0fa0('0x11')]);return _0x3430c2(_0x5fae08[_0x0fa0('0x10')]['message']);}else{logger[_0x0fa0('0xa')](_0x0fa0('0xb'),_0x32667e,_0x0fa0('0xc'));_0x3430c2(_0x5fae08[_0x0fa0('0x12')][_0x0fa0('0x11')]);}})['catch'](function(_0x433c7c){logger[_0x0fa0('0x10')](_0x0fa0('0xb'),_0x32667e,_0x433c7c);_0x44c0ee(_0x433c7c);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index c2825ce..46d7967 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 _0x31b6=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','getMessages','/:id/verify','/:id/users','getAgents','addDisposition','post','addAnswer','create','addSmtp','/:id/interactions','addInteraction','/:id/applications','addApplications','/:id/send','send','put','/:id','delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','describe'];(function(_0x402699,_0x698e45){var _0x2a76bc=function(_0x5db6b0){while(--_0x5db6b0){_0x402699['push'](_0x402699['shift']());}};_0x2a76bc(++_0x698e45);}(_0x31b6,0x1e3));var _0x631b=function(_0x3d0669,_0x1c5ed0){_0x3d0669=_0x3d0669-0x0;var _0x461e13=_0x31b6[_0x3d0669];return _0x461e13;};'use strict';var multer=require(_0x631b('0x0'));var util=require(_0x631b('0x1'));var path=require(_0x631b('0x2'));var timeout=require(_0x631b('0x3'));var express=require('express');var router=express[_0x631b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x631b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x631b('0x6'));var controller=require(_0x631b('0x7'));router[_0x631b('0x8')]('/',auth[_0x631b('0x9')](),controller['index']);router[_0x631b('0x8')](_0x631b('0xa'),auth['isAuthenticated'](),controller[_0x631b('0xb')]);router[_0x631b('0x8')]('/:id',auth[_0x631b('0x9')](),controller[_0x631b('0xc')]);router[_0x631b('0x8')](_0x631b('0xd'),auth[_0x631b('0x9')](),controller[_0x631b('0xe')]);router['get'](_0x631b('0xf'),auth['isAuthenticated'](),controller[_0x631b('0x10')]);router['get'](_0x631b('0x11'),auth['isAuthenticated'](),controller[_0x631b('0x12')]);router['get'](_0x631b('0x13'),auth[_0x631b('0x9')](),controller[_0x631b('0x14')]);router[_0x631b('0x8')]('/:id/interactions',auth[_0x631b('0x9')](),controller[_0x631b('0x15')]);router['get']('/:id/applications',auth[_0x631b('0x9')](),controller['getApplications']);router[_0x631b('0x8')]('/:id/messages',auth[_0x631b('0x9')](),controller[_0x631b('0x16')]);router[_0x631b('0x8')](_0x631b('0x17'),auth[_0x631b('0x9')](),controller['verifySmtp']);router[_0x631b('0x8')](_0x631b('0x18'),auth[_0x631b('0x9')](),controller[_0x631b('0x19')]);router['post'](_0x631b('0xd'),auth[_0x631b('0x9')](),controller[_0x631b('0x1a')]);router[_0x631b('0x1b')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x631b('0x1c')]);router[_0x631b('0x1b')]('/',auth[_0x631b('0x9')](),controller[_0x631b('0x1d')]);router[_0x631b('0x1b')](_0x631b('0x11'),auth[_0x631b('0x9')](),controller['addImap']);router[_0x631b('0x1b')](_0x631b('0x13'),auth['isAuthenticated'](),controller[_0x631b('0x1e')]);router[_0x631b('0x1b')](_0x631b('0x1f'),auth[_0x631b('0x9')](),controller[_0x631b('0x20')]);router[_0x631b('0x1b')](_0x631b('0x21'),auth[_0x631b('0x9')](),controller[_0x631b('0x22')]);router[_0x631b('0x1b')](_0x631b('0x23'),auth[_0x631b('0x9')](),controller[_0x631b('0x24')]);router[_0x631b('0x1b')](_0x631b('0x18'),auth[_0x631b('0x9')](),controller['addAgents']);router[_0x631b('0x25')](_0x631b('0x26'),auth[_0x631b('0x9')](),controller['update']);router[_0x631b('0x27')](_0x631b('0xd'),auth[_0x631b('0x9')](),controller[_0x631b('0x28')]);router['delete'](_0x631b('0xf'),auth[_0x631b('0x9')](),controller[_0x631b('0x29')]);router[_0x631b('0x27')]('/:id/in_servers',auth[_0x631b('0x9')](),controller[_0x631b('0x2a')]);router['delete']('/:id/out_servers',auth[_0x631b('0x9')](),controller['removeSmtp']);router['delete'](_0x631b('0x26'),auth['isAuthenticated'](),controller[_0x631b('0x2b')]);router[_0x631b('0x27')](_0x631b('0x18'),auth[_0x631b('0x9')](),controller[_0x631b('0x2c')]);module['exports']=router; \ No newline at end of file +var _0xf8bb=['addDisposition','/:id/canned_answers','addAnswer','create','addSmtp','/:id/applications','addApplications','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','getAgents','post'];(function(_0x318dda,_0x1aa800){var _0x3f97ca=function(_0x1dc61a){while(--_0x1dc61a){_0x318dda['push'](_0x318dda['shift']());}};_0x3f97ca(++_0x1aa800);}(_0xf8bb,0x6d));var _0xbf8b=function(_0x220ec8,_0x56bf7c){_0x220ec8=_0x220ec8-0x0;var _0x27b087=_0xf8bb[_0x220ec8];return _0x27b087;};'use strict';var multer=require(_0xbf8b('0x0'));var util=require(_0xbf8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbf8b('0x2'));var router=express[_0xbf8b('0x3')]();var fs_extra=require(_0xbf8b('0x4'));var auth=require(_0xbf8b('0x5'));var interaction=require(_0xbf8b('0x6'));var config=require(_0xbf8b('0x7'));var controller=require(_0xbf8b('0x8'));router[_0xbf8b('0x9')]('/',auth[_0xbf8b('0xa')](),controller[_0xbf8b('0xb')]);router[_0xbf8b('0x9')](_0xbf8b('0xc'),auth['isAuthenticated'](),controller[_0xbf8b('0xd')]);router[_0xbf8b('0x9')](_0xbf8b('0xe'),auth[_0xbf8b('0xa')](),controller['show']);router[_0xbf8b('0x9')](_0xbf8b('0xf'),auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x10')]);router[_0xbf8b('0x9')]('/:id/canned_answers',auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x11')]);router[_0xbf8b('0x9')](_0xbf8b('0x12'),auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x13')]);router[_0xbf8b('0x9')](_0xbf8b('0x14'),auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x15')]);router[_0xbf8b('0x9')](_0xbf8b('0x16'),auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x17')]);router[_0xbf8b('0x9')]('/:id/applications',auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x18')]);router['get'](_0xbf8b('0x19'),auth['isAuthenticated'](),controller[_0xbf8b('0x1a')]);router[_0xbf8b('0x9')]('/:id/verify',auth[_0xbf8b('0xa')](),controller['verifySmtp']);router[_0xbf8b('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xbf8b('0x1b')]);router[_0xbf8b('0x1c')](_0xbf8b('0xf'),auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x1d')]);router[_0xbf8b('0x1c')](_0xbf8b('0x1e'),auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x1f')]);router[_0xbf8b('0x1c')]('/',auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x20')]);router[_0xbf8b('0x1c')](_0xbf8b('0x12'),auth[_0xbf8b('0xa')](),controller['addImap']);router['post'](_0xbf8b('0x14'),auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x21')]);router[_0xbf8b('0x1c')](_0xbf8b('0x16'),auth[_0xbf8b('0xa')](),controller['addInteraction']);router[_0xbf8b('0x1c')](_0xbf8b('0x22'),auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x23')]);router[_0xbf8b('0x1c')]('/:id/send',auth['isAuthenticated'](),controller[_0xbf8b('0x24')]);router['post'](_0xbf8b('0x25'),auth['isAuthenticated'](),controller['addAgents']);router[_0xbf8b('0x26')](_0xbf8b('0xe'),auth['isAuthenticated'](),controller[_0xbf8b('0x27')]);router[_0xbf8b('0x28')]('/:id/dispositions',auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x29')]);router[_0xbf8b('0x28')](_0xbf8b('0x1e'),auth['isAuthenticated'](),controller[_0xbf8b('0x2a')]);router['delete'](_0xbf8b('0x12'),auth['isAuthenticated'](),controller[_0xbf8b('0x2b')]);router[_0xbf8b('0x28')]('/:id/out_servers',auth[_0xbf8b('0xa')](),controller[_0xbf8b('0x2c')]);router['delete'](_0xbf8b('0xe'),auth['isAuthenticated'](),controller[_0xbf8b('0x2d')]);router[_0xbf8b('0x28')](_0xbf8b('0x25'),auth[_0xbf8b('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 5b2f2c8..6fa95e0 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 _0x2005=['gmail','yahoo','outlook365','getDataValue','provider','exports','STRING','TEXT','BOOLEAN','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM'];(function(_0x4c9f6a,_0xcb2cb2){var _0x5df5b9=function(_0x303cf2){while(--_0x303cf2){_0x4c9f6a['push'](_0x4c9f6a['shift']());}};_0x5df5b9(++_0xcb2cb2);}(_0x2005,0x195));var _0x5200=function(_0x2bdd9c,_0x31871a){_0x2bdd9c=_0x2bdd9c-0x0;var _0x2ded3b=_0x2005[_0x2bdd9c];return _0x2ded3b;};'use strict';var Sequelize=require('sequelize');module[_0x5200('0x0')]={'description':{'type':Sequelize[_0x5200('0x1')]},'name':{'type':Sequelize[_0x5200('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x5200('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x5200('0x2')]},'markAsUnread':{'type':Sequelize[_0x5200('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x5200('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x5200('0x4')](0x2)[_0x5200('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x5200('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5200('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5200('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5200('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5200('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5200('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x5200('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x5200('0x3')],'defaultValue':![],'comment':_0x5200('0x7'),'set':function(_0x4c4b8d){if(!_0x4c4b8d)this[_0x5200('0x8')](_0x5200('0x9'),null);this[_0x5200('0x8')]('mandatoryDisposition',_0x4c4b8d);}},'provider':{'type':Sequelize[_0x5200('0xa')](_0x5200('0xb'),'hotmail',_0x5200('0xc'),_0x5200('0xd')),'defaultValue':null,'get':function(){if(!this[_0x5200('0xe')](_0x5200('0xf')))return'custom';return this[_0x5200('0xe')](_0x5200('0xf'));},'set':function(_0x7c3ca2){if(_0x7c3ca2==='custom')_0x7c3ca2=null;return this[_0x5200('0x8')](_0x5200('0xf'),_0x7c3ca2);}}}; \ No newline at end of file +var _0xce42=['ENUM','gmail','hotmail','outlook365','getDataValue','provider','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x1d0499,_0x23e22f){var _0x153fb3=function(_0x40c19c){while(--_0x40c19c){_0x1d0499['push'](_0x1d0499['shift']());}};_0x153fb3(++_0x23e22f);}(_0xce42,0xf6));var _0x2ce4=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0xce42[_0x6f1a87];return _0x2495c7;};'use strict';var Sequelize=require('sequelize');module[_0x2ce4('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x2ce4('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x2ce4('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2ce4('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x2ce4('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x2ce4('0x3')]},'markAsUnread':{'type':Sequelize[_0x2ce4('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2ce4('0x1')],'allowNull':![],'defaultValue':_0x2ce4('0x4')},'fontSize':{'type':Sequelize[_0x2ce4('0x5')](0x2)[_0x2ce4('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x2ce4('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2ce4('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2ce4('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2ce4('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2ce4('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2ce4('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2ce4('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x2ce4('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x2ce4('0x2')],'defaultValue':![],'comment':_0x2ce4('0x8'),'set':function(_0x15ec87){if(!_0x15ec87)this[_0x2ce4('0x9')]('mandatoryDispositionPauseId',null);this[_0x2ce4('0x9')]('mandatoryDisposition',_0x15ec87);}},'provider':{'type':Sequelize[_0x2ce4('0xa')](_0x2ce4('0xb'),_0x2ce4('0xc'),'yahoo',_0x2ce4('0xd')),'defaultValue':null,'get':function(){if(!this[_0x2ce4('0xe')](_0x2ce4('0xf')))return'custom';return this['getDataValue']('provider');},'set':function(_0x594608){if(_0x594608==='custom')_0x594608=null;return this['setDataValue'](_0x2ce4('0xf'),_0x594608);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index a14cc2f..dcbf729 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 _0x6da6=['MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','body','modernAuthentication','CloudProviderId','describe','addDisposition','find','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','provider','custom','email','ListId','active','user','username','password','pass','service','host','port','authentication','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','setSmtp','addInteraction','MailInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','$gte','split','MailMessage','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','format','attachments','join','root','server/files/attachments','basename','auth','secure','sendMail','List\x20not\x20found','messageId','from','subject','out','YYYY-MM-DD\x20HH:mm:ss','Messages','verifySmtp','CloudProvider','OAuth2','data5','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','userMailAccount:save','removeAgents','emit','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','api','../../mysqldb','defaults','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','update','then','get','UserProfileResource','destroy','stack','send','index','MailServerIn','Imap'];(function(_0x13ae40,_0x37d317){var _0xc21d47=function(_0x244e5a){while(--_0x244e5a){_0x13ae40['push'](_0x13ae40['shift']());}};_0xc21d47(++_0x37d317);}(_0x6da6,0x8a));var _0x66da=function(_0x1e707b,_0x2f28f7){_0x1e707b=_0x1e707b-0x0;var _0x28600c=_0x6da6[_0x1e707b];return _0x28600c;};'use strict';var moment=require(_0x66da('0x0'));var BPromise=require(_0x66da('0x1'));var util=require(_0x66da('0x2'));var path=require(_0x66da('0x3'));var _=require(_0x66da('0x4'));var juice=require(_0x66da('0x5'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x66da('0x6'));var config=require('../../config/environment');var db=require(_0x66da('0x7'))['db'];config['redis']=_[_0x66da('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x66da('0x9'))(new Redis(config['redis']));require(_0x66da('0xa'))['register'](socket);var jayson=require(_0x66da('0xb'));var client=jayson[_0x66da('0xc')][_0x66da('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x4d33a6,_0x14d79d,_0x3c6e9,_0x135327){return new BPromise(function(_0x2d7863,_0x22807f){var _0x438faa=_0x135327||client;return _0x438faa[_0x66da('0xe')](_0x4d33a6,_0x3c6e9)['then'](function(_0x403ded){logger[_0x66da('0xf')](_0x66da('0x10'),_0x14d79d,_0x66da('0x11'));logger[_0x66da('0x12')](_0x66da('0x13'),_0x14d79d,'request\x20sent',JSON['stringify'](_0x403ded));if(_0x403ded[_0x66da('0x14')]){if(_0x403ded[_0x66da('0x14')][_0x66da('0x15')]===0x1f4){logger[_0x66da('0x14')](_0x66da('0x10'),_0x14d79d,_0x403ded[_0x66da('0x14')][_0x66da('0x16')]);return _0x22807f(_0x403ded[_0x66da('0x14')][_0x66da('0x16')]);}logger[_0x66da('0x14')]('MailAccount,\x20%s,\x20%s',_0x14d79d,_0x403ded[_0x66da('0x14')]['message']);return _0x2d7863(_0x403ded[_0x66da('0x14')][_0x66da('0x16')]);}else{logger[_0x66da('0xf')](_0x66da('0x10'),_0x14d79d,'request\x20sent');_0x2d7863(_0x403ded[_0x66da('0x17')][_0x66da('0x16')]);}})[_0x66da('0x18')](function(_0x3a28c4){logger[_0x66da('0x14')](_0x66da('0x10'),_0x14d79d,_0x3a28c4);_0x22807f(_0x3a28c4);});});}function respondWithStatusCode(_0x51eb2a,_0x377df4){_0x377df4=_0x377df4||0xcc;return function(_0x31e108){if(_0x31e108){return _0x51eb2a[_0x66da('0x19')](_0x377df4);}return _0x51eb2a['status'](_0x377df4)[_0x66da('0x1a')]();};}function respondWithResult(_0x7f6961,_0x122575){_0x122575=_0x122575||0xc8;return function(_0x58c9a5){if(_0x58c9a5){return _0x7f6961['status'](_0x122575)[_0x66da('0x1b')](_0x58c9a5);}};}function respondWithFilteredResult(_0x43d5c6,_0xa0aeb6){return function(_0x221a9c){if(_0x221a9c){var _0x207cae=typeof _0xa0aeb6[_0x66da('0x1c')]===_0x66da('0x1d')&&typeof _0xa0aeb6['limit']==='undefined';var _0x16fa96=_0x221a9c[_0x66da('0x1e')];var _0x5d9d5d=_0x207cae?0x0:_0xa0aeb6['offset'];var _0x594943=_0x207cae?_0x221a9c['count']:_0xa0aeb6[_0x66da('0x1c')]+_0xa0aeb6['limit'];var _0x4eeaf8;if(_0x594943>=_0x16fa96){_0x594943=_0x16fa96;_0x4eeaf8=0xc8;}else{_0x4eeaf8=0xce;}_0x43d5c6[_0x66da('0x1f')](_0x4eeaf8);return _0x43d5c6[_0x66da('0x20')](_0x66da('0x21'),_0x5d9d5d+'-'+_0x594943+'/'+_0x16fa96)['json'](_0x221a9c);}return null;};}function saveUpdates(_0x388449){return function(_0x35dd52){if(_0x35dd52){return _0x35dd52[_0x66da('0x22')](_0x388449)[_0x66da('0x23')](function(_0x13d4d7){return _0x13d4d7;});}return null;};}function removeEntity(_0x27fe8a){return function(_0x49040f){if(_0x49040f){return _0x49040f['destroy']()[_0x66da('0x23')](function(){var _0x21a983=_0x49040f[_0x66da('0x24')]({'plain':!![]});var _0x13a5f9='MailAccounts';return db[_0x66da('0x25')][_0x66da('0x26')]({'where':{'type':_0x13a5f9,'resourceId':_0x21a983['id']}})[_0x66da('0x23')](function(){return _0x49040f;});})[_0x66da('0x23')](function(){_0x27fe8a[_0x66da('0x1f')](0xcc)[_0x66da('0x1a')]();});}};}function handleEntityNotFound(_0x3575ca){return function(_0x436953){if(!_0x436953){_0x3575ca[_0x66da('0x19')](0x194);}return _0x436953;};}function handleError(_0x44bd8d,_0x20b4bd){_0x20b4bd=_0x20b4bd||0x1f4;return function(_0x21c73f){logger[_0x66da('0x14')](_0x21c73f[_0x66da('0x27')]);if(_0x21c73f['name']){delete _0x21c73f['name'];}_0x44bd8d['status'](_0x20b4bd)[_0x66da('0x28')](_0x21c73f);};}exports[_0x66da('0x29')]=function(_0x6751c3,_0x40daeb){var _0x51bf39={'include':[{'model':db[_0x66da('0x2a')],'as':_0x66da('0x2b')},{'model':db[_0x66da('0x2c')],'as':_0x66da('0x2d')},{'model':db[_0x66da('0x2e')],'as':_0x66da('0x2f')}]},_0x3147cf={},_0x3a3cbe={'count':0x0,'rows':[]};var _0x3db4d6=_[_0x66da('0x30')](db[_0x66da('0x31')]['rawAttributes'],function(_0x86efa6){return{'name':_0x86efa6[_0x66da('0x32')],'type':_0x86efa6[_0x66da('0x33')][_0x66da('0x34')]};});_0x3147cf[_0x66da('0x35')]=_[_0x66da('0x30')](_0x3db4d6,_0x66da('0x36'));_0x3147cf[_0x66da('0x37')]=_[_0x66da('0x38')](_0x6751c3['query']);_0x3147cf[_0x66da('0x39')]=_[_0x66da('0x3a')](_0x3147cf[_0x66da('0x35')],_0x3147cf[_0x66da('0x37')]);_0x51bf39[_0x66da('0x3b')]=_['intersection'](_0x3147cf[_0x66da('0x35')],qs[_0x66da('0x3c')](_0x6751c3[_0x66da('0x37')][_0x66da('0x3c')]));_0x51bf39[_0x66da('0x3b')]=_0x51bf39[_0x66da('0x3b')][_0x66da('0x3d')]?_0x51bf39[_0x66da('0x3b')]:_0x3147cf[_0x66da('0x35')];if(!_0x6751c3['query'][_0x66da('0x3e')](_0x66da('0x3f'))){_0x51bf39['limit']=qs[_0x66da('0x40')](_0x6751c3[_0x66da('0x37')][_0x66da('0x40')]);_0x51bf39[_0x66da('0x1c')]=qs[_0x66da('0x1c')](_0x6751c3[_0x66da('0x37')][_0x66da('0x1c')]);}_0x51bf39[_0x66da('0x41')]=qs[_0x66da('0x42')](_0x6751c3['query']['sort']);_0x51bf39[_0x66da('0x43')]=qs[_0x66da('0x39')](_[_0x66da('0x44')](_0x6751c3[_0x66da('0x37')],_0x3147cf[_0x66da('0x39')]),_0x3db4d6);if(_0x6751c3[_0x66da('0x37')][_0x66da('0x45')]){_0x51bf39[_0x66da('0x43')]=_[_0x66da('0x46')](_0x51bf39[_0x66da('0x43')],{'$or':_[_0x66da('0x30')](_0x3db4d6,function(_0x164541){if(_0x164541['type']!==_0x66da('0x47')){var _0x427e61={};_0x427e61[_0x164541['name']]={'$like':'%'+_0x6751c3[_0x66da('0x37')][_0x66da('0x45')]+'%'};return _0x427e61;}})});}_0x51bf39=_[_0x66da('0x46')]({},_0x51bf39,_0x6751c3[_0x66da('0x48')]);var _0x1f5741={'where':_0x51bf39[_0x66da('0x43')]};return db[_0x66da('0x31')]['count'](_0x1f5741)[_0x66da('0x23')](function(_0x4119a5){_0x3a3cbe['count']=_0x4119a5;if(_0x6751c3[_0x66da('0x37')][_0x66da('0x49')]){_0x51bf39[_0x66da('0x4a')]=[{'all':!![]}];}return db[_0x66da('0x31')][_0x66da('0x4b')](_0x51bf39);})[_0x66da('0x23')](function(_0xa81fa8){_0x3a3cbe[_0x66da('0x4c')]=_0xa81fa8;return _0x3a3cbe;})[_0x66da('0x23')](respondWithFilteredResult(_0x40daeb,_0x51bf39))['catch'](handleError(_0x40daeb,null));};exports[_0x66da('0x4d')]=function(_0x3ad834,_0x53b6c8){var _0x32fea8={'raw':![],'where':{'id':_0x3ad834[_0x66da('0x4e')]['id']},'include':[{'model':db[_0x66da('0x2a')],'as':_0x66da('0x2b')},{'model':db[_0x66da('0x2c')],'as':_0x66da('0x2d')},{'model':db[_0x66da('0x2e')],'as':_0x66da('0x2f')}]},_0x2d73ce={};_0x2d73ce[_0x66da('0x35')]=_['keys'](db['MailAccount'][_0x66da('0x4f')]);_0x2d73ce['query']=_[_0x66da('0x38')](_0x3ad834[_0x66da('0x37')]);_0x2d73ce[_0x66da('0x39')]=_[_0x66da('0x3a')](_0x2d73ce[_0x66da('0x35')],_0x2d73ce[_0x66da('0x37')]);_0x32fea8['attributes']=_[_0x66da('0x3a')](_0x2d73ce[_0x66da('0x35')],qs['fields'](_0x3ad834[_0x66da('0x37')]['fields']));_0x32fea8[_0x66da('0x3b')]=_0x32fea8[_0x66da('0x3b')][_0x66da('0x3d')]?_0x32fea8['attributes']:_0x2d73ce[_0x66da('0x35')];if(_0x3ad834[_0x66da('0x37')][_0x66da('0x49')]){_0x32fea8['include']=[{'all':!![]}];}_0x32fea8=_[_0x66da('0x46')]({},_0x32fea8,_0x3ad834[_0x66da('0x48')]);return db['MailAccount']['find'](_0x32fea8)['then'](handleEntityNotFound(_0x53b6c8,null))[_0x66da('0x23')](respondWithResult(_0x53b6c8,null))[_0x66da('0x18')](handleError(_0x53b6c8,null));};exports['update']=function(_0x5c044d,_0x475398){if(_0x5c044d[_0x66da('0x50')]['id']){delete _0x5c044d[_0x66da('0x50')]['id'];}if(_0x5c044d[_0x66da('0x50')][_0x66da('0x2b')]){if(!_0x5c044d[_0x66da('0x50')]['Imap'][_0x66da('0x51')]){_0x5c044d[_0x66da('0x50')][_0x66da('0x2b')][_0x66da('0x52')]=null;}}if(_0x5c044d['body']['Smtp']){if(!_0x5c044d[_0x66da('0x50')]['Smtp'][_0x66da('0x51')]){_0x5c044d[_0x66da('0x50')][_0x66da('0x2d')]['CloudProviderId']=null;}}return db[_0x66da('0x31')]['find']({'where':{'id':_0x5c044d[_0x66da('0x4e')]['id']},'include':[{'model':db[_0x66da('0x2a')],'as':_0x66da('0x2b')},{'model':db[_0x66da('0x2c')],'as':_0x66da('0x2d')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x66da('0x23')](handleEntityNotFound(_0x475398,null))[_0x66da('0x23')](saveUpdates(_0x5c044d[_0x66da('0x50')],null))['then'](function(_0x2926e7){if(_0x2926e7&&_0x5c044d[_0x66da('0x50')]['Imap']){return db[_0x66da('0x2a')]['update'](_0x5c044d[_0x66da('0x50')][_0x66da('0x2b')],{'where':{'MailAccountId':_0x2926e7['id']}})[_0x66da('0x23')](function(){return _0x2926e7;});}return _0x2926e7;})['then'](function(_0xeaac){if(_0xeaac&&_0x5c044d['body'][_0x66da('0x2d')]){return db[_0x66da('0x2c')]['update'](_0x5c044d[_0x66da('0x50')][_0x66da('0x2d')],{'where':{'MailAccountId':_0xeaac['id']}})['then'](function(){return _0xeaac;});}return _0xeaac;})['then'](respondWithResult(_0x475398,null))[_0x66da('0x18')](handleError(_0x475398,null));};exports[_0x66da('0x53')]=function(_0x8e027b,_0x21a720){return db[_0x66da('0x31')][_0x66da('0x53')]()[_0x66da('0x23')](respondWithResult(_0x21a720,null))[_0x66da('0x18')](handleError(_0x21a720,null));};exports[_0x66da('0x54')]=function(_0x511428,_0x3bec01){if(_0x511428['body']['id']){delete _0x511428[_0x66da('0x50')]['id'];}return db[_0x66da('0x31')][_0x66da('0x55')]({'where':{'id':_0x511428[_0x66da('0x4e')]['id']}})[_0x66da('0x23')](handleEntityNotFound(_0x3bec01,null))[_0x66da('0x23')](function(_0x3bd3cb){if(_0x3bd3cb){_0x511428['body'][_0x66da('0x56')]=_0x3bd3cb['id'];return db[_0x66da('0x57')][_0x66da('0x58')](_0x511428['body']);}})[_0x66da('0x23')](respondWithResult(_0x3bec01,null))[_0x66da('0x18')](handleError(_0x3bec01,null));};exports[_0x66da('0x59')]=function(_0x459f9e,_0x1fd546){var _0x315980={'raw':![],'where':{}};var _0xeede6b={};var _0x37a297={'count':0x0,'rows':[]};return db[_0x66da('0x31')][_0x66da('0x5a')]({'where':{'id':_0x459f9e[_0x66da('0x4e')]['id']}})[_0x66da('0x23')](handleEntityNotFound(_0x1fd546,null))['then'](function(_0x4337fa){if(_0x4337fa){_0xeede6b[_0x66da('0x35')]=_[_0x66da('0x38')](db[_0x66da('0x57')]['rawAttributes']);_0xeede6b[_0x66da('0x37')]=_[_0x66da('0x38')](_0x459f9e[_0x66da('0x37')]);_0xeede6b[_0x66da('0x39')]=_[_0x66da('0x3a')](_0xeede6b[_0x66da('0x35')],_0xeede6b[_0x66da('0x37')]);_0x315980[_0x66da('0x3b')]=_[_0x66da('0x3a')](_0xeede6b[_0x66da('0x35')],qs[_0x66da('0x3c')](_0x459f9e[_0x66da('0x37')][_0x66da('0x3c')]));_0x315980[_0x66da('0x3b')]=_0x315980['attributes'][_0x66da('0x3d')]?_0x315980[_0x66da('0x3b')]:_0xeede6b[_0x66da('0x35')];if(!_0x459f9e[_0x66da('0x37')][_0x66da('0x3e')](_0x66da('0x3f'))){_0x315980['limit']=qs[_0x66da('0x40')](_0x459f9e[_0x66da('0x37')][_0x66da('0x40')]);_0x315980[_0x66da('0x1c')]=qs[_0x66da('0x1c')](_0x459f9e[_0x66da('0x37')][_0x66da('0x1c')]);}_0x315980[_0x66da('0x41')]=qs[_0x66da('0x42')](_0x459f9e[_0x66da('0x37')][_0x66da('0x42')]);_0x315980[_0x66da('0x43')]=qs[_0x66da('0x39')](_[_0x66da('0x44')](_0x459f9e[_0x66da('0x37')],_0xeede6b['filters']));_0x315980[_0x66da('0x43')][_0x66da('0x56')]=_0x4337fa['id'];if(_0x459f9e[_0x66da('0x37')][_0x66da('0x45')]){_0x315980[_0x66da('0x43')]=_[_0x66da('0x46')](_0x315980[_0x66da('0x43')],{'$or':_['map'](_0x315980[_0x66da('0x3b')],function(_0x1713a6){var _0x4cb603={};_0x4cb603[_0x1713a6]={'$like':'%'+_0x459f9e[_0x66da('0x37')]['filter']+'%'};return _0x4cb603;})});}_0x315980=_['merge']({},_0x315980,_0x459f9e[_0x66da('0x48')]);return db[_0x66da('0x57')][_0x66da('0x1e')]({'where':_0x315980[_0x66da('0x43')]})[_0x66da('0x23')](function(_0x370fa6){_0x37a297[_0x66da('0x1e')]=_0x370fa6;if(_0x459f9e[_0x66da('0x37')]['includeAll']){_0x315980[_0x66da('0x4a')]=[{'all':!![]}];}return db[_0x66da('0x57')][_0x66da('0x4b')](_0x315980);})[_0x66da('0x23')](function(_0x579bda){_0x37a297[_0x66da('0x4c')]=_0x579bda;return _0x37a297;});}})[_0x66da('0x23')](respondWithFilteredResult(_0x1fd546,_0x315980))['catch'](handleError(_0x1fd546,null));};exports['removeDispositions']=function(_0x58be28,_0xf2f395){return db[_0x66da('0x31')]['find']({'where':{'id':_0x58be28['params']['id']}})[_0x66da('0x23')](handleEntityNotFound(_0xf2f395,null))['then'](function(_0x29788d){if(_0x29788d){return _0x29788d[_0x66da('0x5b')](_0x58be28[_0x66da('0x37')][_0x66da('0x5c')]);}})[_0x66da('0x23')](respondWithStatusCode(_0xf2f395,null))[_0x66da('0x18')](handleError(_0xf2f395,null));};exports[_0x66da('0x5d')]=function(_0x5d13f7,_0xa14a3f){if(_0x5d13f7[_0x66da('0x50')]['id']){delete _0x5d13f7[_0x66da('0x50')]['id'];}return db[_0x66da('0x31')][_0x66da('0x55')]({'where':{'id':_0x5d13f7['params']['id']}})['then'](handleEntityNotFound(_0xa14a3f,null))[_0x66da('0x23')](function(_0x186e5f){if(_0x186e5f){_0x5d13f7[_0x66da('0x50')][_0x66da('0x56')]=_0x186e5f['id'];return db[_0x66da('0x5e')]['create'](_0x5d13f7['body']);}})[_0x66da('0x23')](respondWithResult(_0xa14a3f,null))[_0x66da('0x18')](handleError(_0xa14a3f,null));};exports['getAnswers']=function(_0xb69855,_0x55227f){var _0x11f172={'raw':![],'where':{}};var _0x1c4b6e={};var _0x5140d4={'count':0x0,'rows':[]};return db['MailAccount'][_0x66da('0x5a')]({'where':{'id':_0xb69855[_0x66da('0x4e')]['id']}})['then'](handleEntityNotFound(_0x55227f,null))[_0x66da('0x23')](function(_0x2e351f){if(_0x2e351f){_0x1c4b6e[_0x66da('0x35')]=_[_0x66da('0x38')](db['CannedAnswer'][_0x66da('0x4f')]);_0x1c4b6e[_0x66da('0x37')]=_[_0x66da('0x38')](_0xb69855[_0x66da('0x37')]);_0x1c4b6e['filters']=_[_0x66da('0x3a')](_0x1c4b6e[_0x66da('0x35')],_0x1c4b6e['query']);_0x11f172[_0x66da('0x3b')]=_['intersection'](_0x1c4b6e[_0x66da('0x35')],qs[_0x66da('0x3c')](_0xb69855[_0x66da('0x37')]['fields']));_0x11f172[_0x66da('0x3b')]=_0x11f172[_0x66da('0x3b')][_0x66da('0x3d')]?_0x11f172[_0x66da('0x3b')]:_0x1c4b6e[_0x66da('0x35')];if(!_0xb69855[_0x66da('0x37')][_0x66da('0x3e')]('nolimit')){_0x11f172[_0x66da('0x40')]=qs['limit'](_0xb69855[_0x66da('0x37')][_0x66da('0x40')]);_0x11f172[_0x66da('0x1c')]=qs['offset'](_0xb69855['query'][_0x66da('0x1c')]);}_0x11f172[_0x66da('0x41')]=qs[_0x66da('0x42')](_0xb69855[_0x66da('0x37')]['sort']);_0x11f172[_0x66da('0x43')]=qs[_0x66da('0x39')](_['pick'](_0xb69855[_0x66da('0x37')],_0x1c4b6e[_0x66da('0x39')]));_0x11f172[_0x66da('0x43')][_0x66da('0x56')]=_0x2e351f['id'];if(_0xb69855[_0x66da('0x37')][_0x66da('0x45')]){_0x11f172[_0x66da('0x43')]=_[_0x66da('0x46')](_0x11f172['where'],{'$or':_[_0x66da('0x30')](_0x11f172[_0x66da('0x3b')],function(_0x5e7bea){var _0x40b598={};_0x40b598[_0x5e7bea]={'$like':'%'+_0xb69855[_0x66da('0x37')][_0x66da('0x45')]+'%'};return _0x40b598;})});}_0x11f172=_[_0x66da('0x46')]({},_0x11f172,_0xb69855[_0x66da('0x48')]);return db[_0x66da('0x5e')][_0x66da('0x1e')]({'where':_0x11f172['where']})['then'](function(_0x7e8ef6){_0x5140d4['count']=_0x7e8ef6;if(_0xb69855[_0x66da('0x37')][_0x66da('0x49')]){_0x11f172['include']=[{'all':!![]}];}return db[_0x66da('0x5e')][_0x66da('0x4b')](_0x11f172);})['then'](function(_0x4fe091){_0x5140d4[_0x66da('0x4c')]=_0x4fe091;return _0x5140d4;});}})[_0x66da('0x23')](respondWithFilteredResult(_0x55227f,_0x11f172))[_0x66da('0x18')](handleError(_0x55227f,null));};exports[_0x66da('0x5f')]=function(_0x1bd318,_0x5df3d1){return db[_0x66da('0x31')][_0x66da('0x55')]({'where':{'id':_0x1bd318[_0x66da('0x4e')]['id']}})[_0x66da('0x23')](handleEntityNotFound(_0x5df3d1,null))[_0x66da('0x23')](function(_0x58150d){if(_0x58150d){return _0x58150d[_0x66da('0x5f')](_0x1bd318['query'][_0x66da('0x5c')]);}})[_0x66da('0x23')](respondWithStatusCode(_0x5df3d1,null))[_0x66da('0x18')](handleError(_0x5df3d1,null));};exports[_0x66da('0x58')]=function(_0x338b63,_0x12d155){var _0x189392={'name':_0x338b63[_0x66da('0x50')]['name'],'key':_0x338b63[_0x66da('0x50')][_0x66da('0x34')],'provider':_0x338b63[_0x66da('0x50')][_0x66da('0x60')]===_0x66da('0x61')?null:_0x338b63[_0x66da('0x50')]['provider'],'email':_0x338b63[_0x66da('0x50')][_0x66da('0x62')],'ListId':_0x338b63[_0x66da('0x50')][_0x66da('0x63')],'active':!_['isNil'](_0x338b63['body']['active'])?_0x338b63['body'][_0x66da('0x64')]:!![],'description':_0x338b63['body']['description']||null,'Imap':{},'Smtp':{}};if(_0x189392[_0x66da('0x60')]){_0x189392['Imap'][_0x66da('0x65')]=_0x189392[_0x66da('0x2d')][_0x66da('0x65')]=_0x338b63[_0x66da('0x50')][_0x66da('0x66')];_0x189392[_0x66da('0x2b')][_0x66da('0x67')]=_0x189392[_0x66da('0x2d')]['pass']=_0x338b63[_0x66da('0x50')][_0x66da('0x67')];if(_0x338b63[_0x66da('0x50')]['modernAuthentication']){_0x189392[_0x66da('0x2b')][_0x66da('0x51')]=_0x189392[_0x66da('0x2d')][_0x66da('0x51')]=!![];_0x189392[_0x66da('0x2b')][_0x66da('0x52')]=_0x189392[_0x66da('0x2d')][_0x66da('0x52')]=_0x338b63[_0x66da('0x50')][_0x66da('0x52')];_0x189392[_0x66da('0x2b')][_0x66da('0x67')]=_0x189392[_0x66da('0x2d')][_0x66da('0x68')]=null;}else{_0x189392['Imap'][_0x66da('0x52')]=_0x189392[_0x66da('0x2d')][_0x66da('0x52')]=null;}_0x189392[_0x66da('0x2b')][_0x66da('0x69')]=_0x189392[_0x66da('0x2d')][_0x66da('0x69')]=null;_0x189392[_0x66da('0x2b')][_0x66da('0x6a')]=_0x189392['Smtp']['host']=null;_0x189392[_0x66da('0x2b')]['port']=_0x189392['Smtp'][_0x66da('0x6b')]=null;}else{if(_0x338b63[_0x66da('0x50')][_0x66da('0x6c')]){_0x189392[_0x66da('0x2b')][_0x66da('0x65')]=_0x189392[_0x66da('0x2d')]['user']=_0x338b63['body'][_0x66da('0x66')];_0x189392['Imap'][_0x66da('0x67')]=_0x189392[_0x66da('0x2d')][_0x66da('0x68')]=_0x338b63[_0x66da('0x50')][_0x66da('0x67')];}else{_0x189392[_0x66da('0x2b')][_0x66da('0x6c')]=_0x189392[_0x66da('0x2d')][_0x66da('0x6c')]=![];_0x189392['Imap'][_0x66da('0x65')]=_0x189392[_0x66da('0x2d')][_0x66da('0x65')]=null;_0x189392['Imap']['password']=_0x189392[_0x66da('0x2d')][_0x66da('0x68')]=null;}_0x189392[_0x66da('0x2b')]['host']=_0x338b63['body'][_0x66da('0x2b')][_0x66da('0x6a')];_0x189392[_0x66da('0x2b')][_0x66da('0x6b')]=_0x338b63[_0x66da('0x50')]['Imap']['port'];_0x189392[_0x66da('0x2d')]['host']=_0x338b63[_0x66da('0x50')][_0x66da('0x2d')]['host'];_0x189392['Smtp'][_0x66da('0x6b')]=_0x338b63['body']['Smtp']['port'];}return db[_0x66da('0x31')][_0x66da('0x58')](_0x189392,{'include':[{'model':db[_0x66da('0x2c')],'as':_0x66da('0x2d')},{'model':db[_0x66da('0x2a')],'as':_0x66da('0x2b')}]})[_0x66da('0x23')](function(_0x5e6531){var _0x5f5bd5=_0x338b63[_0x66da('0x65')][_0x66da('0x24')]({'plain':!![]});if(!_0x5f5bd5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f5bd5[_0x66da('0x6d')]===_0x66da('0x65')){var _0xbce8c6=_0x5e6531['get']({'plain':!![]});return db[_0x66da('0x6e')][_0x66da('0x55')]({'where':{'name':_0x66da('0x6f'),'userProfileId':_0x5f5bd5[_0x66da('0x70')]},'raw':!![]})[_0x66da('0x23')](function(_0x76123f){if(_0x76123f&&_0x76123f[_0x66da('0x71')]===0x0){return db[_0x66da('0x25')]['create']({'name':_0xbce8c6[_0x66da('0x36')],'resourceId':_0xbce8c6['id'],'type':_0x76123f[_0x66da('0x36')],'sectionId':_0x76123f['id']},{})['then'](function(){return _0x5e6531;});}else{return _0x5e6531;}})[_0x66da('0x18')](function(_0x2a42fc){logger[_0x66da('0x14')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a42fc);throw _0x2a42fc;});}return _0x5e6531;})[_0x66da('0x23')](respondWithResult(_0x12d155,0xc9))[_0x66da('0x18')](handleError(_0x12d155,null));};exports[_0x66da('0x72')]=function(_0x4641b3,_0x21a0f0){return db['MailAccount'][_0x66da('0x5a')]({'where':{'id':_0x4641b3[_0x66da('0x4e')]['id']}})[_0x66da('0x23')](handleEntityNotFound(_0x21a0f0,null))[_0x66da('0x23')](function(_0x53a0d7){if(_0x53a0d7){return _0x53a0d7[_0x66da('0x72')]();}return null;})[_0x66da('0x23')](respondWithResult(_0x21a0f0,null))['catch'](handleError(_0x21a0f0,null));};exports[_0x66da('0x73')]=function(_0x6a08d,_0x2dd7be){if(_0x6a08d[_0x66da('0x50')]['id']){delete _0x6a08d['body']['id'];}return db[_0x66da('0x31')]['find']({'where':{'id':_0x6a08d[_0x66da('0x4e')]['id']}})[_0x66da('0x23')](handleEntityNotFound(_0x2dd7be,null))['then'](function(_0x40f967){if(_0x40f967){_0x6a08d[_0x66da('0x50')][_0x66da('0x56')]=_0x40f967['id'];return db[_0x66da('0x2a')][_0x66da('0x58')](_0x6a08d[_0x66da('0x50')]);}})['then'](respondWithResult(_0x2dd7be,null))[_0x66da('0x18')](handleError(_0x2dd7be,null));};exports[_0x66da('0x74')]=function(_0x27d25d,_0x54c3f4){return db[_0x66da('0x31')]['findOne']({'where':{'id':_0x27d25d[_0x66da('0x4e')]['id']}})['then'](handleEntityNotFound(_0x54c3f4,null))[_0x66da('0x23')](function(_0x186f7d){if(_0x186f7d){return _0x186f7d[_0x66da('0x75')](null);}return null;})[_0x66da('0x23')](respondWithStatusCode(_0x54c3f4,null))[_0x66da('0x18')](handleError(_0x54c3f4,null));};exports[_0x66da('0x76')]=function(_0x139e21,_0x700204){return db[_0x66da('0x31')][_0x66da('0x5a')]({'where':{'id':_0x139e21[_0x66da('0x4e')]['id']}})[_0x66da('0x23')](handleEntityNotFound(_0x700204,null))[_0x66da('0x23')](function(_0x293be5){if(_0x293be5){return _0x293be5['getSmtp']();}return null;})['then'](respondWithResult(_0x700204,null))['catch'](handleError(_0x700204,null));};exports['addSmtp']=function(_0x4d2c7f,_0x27dcf0){if(_0x4d2c7f[_0x66da('0x50')]['id']){delete _0x4d2c7f[_0x66da('0x50')]['id'];}return db['MailAccount'][_0x66da('0x55')]({'where':{'id':_0x4d2c7f[_0x66da('0x4e')]['id']}})['then'](handleEntityNotFound(_0x27dcf0,null))[_0x66da('0x23')](function(_0x2345d8){if(_0x2345d8){_0x4d2c7f[_0x66da('0x50')][_0x66da('0x56')]=_0x2345d8['id'];return db[_0x66da('0x2c')][_0x66da('0x58')](_0x4d2c7f['body']);}})[_0x66da('0x23')](respondWithResult(_0x27dcf0,null))['catch'](handleError(_0x27dcf0,null));};exports['removeSmtp']=function(_0x192fdb,_0x1e5e31){return db[_0x66da('0x31')][_0x66da('0x5a')]({'where':{'id':_0x192fdb[_0x66da('0x4e')]['id']}})[_0x66da('0x23')](handleEntityNotFound(_0x1e5e31,null))['then'](function(_0x48793f){if(_0x48793f){return _0x48793f[_0x66da('0x77')](null);}return null;})[_0x66da('0x23')](respondWithStatusCode(_0x1e5e31,null))[_0x66da('0x18')](handleError(_0x1e5e31,null));};exports[_0x66da('0x78')]=function(_0x4da7b0,_0x59301c){return db['MailInteraction'][_0x66da('0x55')]({'where':{'id':_0x4da7b0[_0x66da('0x4e')]['id']}})[_0x66da('0x23')](handleEntityNotFound(_0x59301c,null))['then'](function(_0x5db758){if(_0x5db758){return _0x5db758[_0x66da('0x78')](_0x4da7b0['body']['ids'],_['omit'](_0x4da7b0[_0x66da('0x50')],[_0x66da('0x5c'),'id'])||{});}})[_0x66da('0x23')](respondWithResult(_0x59301c,null))['catch'](handleError(_0x59301c,null));};exports['getInteractions']=function(_0xa4778,_0x3ee088){var _0x5465c0={'raw':![],'where':{}};var _0x556bbb={};var _0x78f5a={'count':0x0,'rows':[]};return db[_0x66da('0x31')][_0x66da('0x5a')]({'where':{'id':_0xa4778[_0x66da('0x4e')]['id']}})[_0x66da('0x23')](handleEntityNotFound(_0x3ee088,null))[_0x66da('0x23')](function(_0x277aa8){if(_0x277aa8){_0x556bbb[_0x66da('0x35')]=_[_0x66da('0x38')](db[_0x66da('0x79')]['rawAttributes']);_0x556bbb[_0x66da('0x37')]=_['keys'](_0xa4778[_0x66da('0x37')]);_0x556bbb[_0x66da('0x39')]=_[_0x66da('0x3a')](_0x556bbb[_0x66da('0x35')],_0x556bbb[_0x66da('0x37')]);_0x5465c0[_0x66da('0x3b')]=_[_0x66da('0x3a')](_0x556bbb['model'],qs['fields'](_0xa4778[_0x66da('0x37')][_0x66da('0x3c')]));_0x5465c0['attributes']=_0x5465c0[_0x66da('0x3b')][_0x66da('0x3d')]?_0x5465c0[_0x66da('0x3b')]:_0x556bbb[_0x66da('0x35')];if(!_0xa4778[_0x66da('0x37')][_0x66da('0x3e')](_0x66da('0x3f'))){_0x5465c0[_0x66da('0x40')]=qs[_0x66da('0x40')](_0xa4778[_0x66da('0x37')][_0x66da('0x40')]);_0x5465c0[_0x66da('0x1c')]=qs[_0x66da('0x1c')](_0xa4778[_0x66da('0x37')][_0x66da('0x1c')]);}_0x5465c0[_0x66da('0x41')]=qs[_0x66da('0x42')](_0xa4778[_0x66da('0x37')][_0x66da('0x42')]);_0x5465c0[_0x66da('0x43')]=qs[_0x66da('0x39')](_[_0x66da('0x44')](_0xa4778[_0x66da('0x37')],_0x556bbb[_0x66da('0x39')]));_0x5465c0[_0x66da('0x43')][_0x66da('0x56')]=_0x277aa8['id'];if(_0xa4778[_0x66da('0x37')][_0x66da('0x45')]){_0x5465c0[_0x66da('0x43')]=_[_0x66da('0x46')](_0x5465c0['where'],{'$or':_[_0x66da('0x30')](_0x5465c0['attributes'],function(_0x287f0f){var _0xd6365={};_0xd6365[_0x287f0f]={'$like':'%'+_0xa4778[_0x66da('0x37')][_0x66da('0x45')]+'%'};return _0xd6365;})});}_0x5465c0=_[_0x66da('0x46')]({},_0x5465c0,_0xa4778[_0x66da('0x48')]);return db['MailInteraction'][_0x66da('0x1e')]({'where':_0x5465c0[_0x66da('0x43')]})[_0x66da('0x23')](function(_0x28c41a){_0x78f5a['count']=_0x28c41a;if(_0xa4778[_0x66da('0x37')][_0x66da('0x49')]){_0x5465c0[_0x66da('0x4a')]=[{'model':db[_0x66da('0x7a')],'as':_0x66da('0x7b'),'required':![]},{'model':db[_0x66da('0x7c')],'as':_0x66da('0x7d'),'attributes':['name',_0x66da('0x7e'),_0x66da('0x7f')],'required':![]},{'model':db[_0x66da('0x80')],'as':_0x66da('0x81'),'attributes':['id',_0x66da('0x36'),'color'],'where':_0xa4778[_0x66da('0x37')][_0x66da('0x82')]?{'id':_0xa4778[_0x66da('0x37')][_0x66da('0x82')]}:undefined,'required':_0xa4778[_0x66da('0x37')][_0x66da('0x82')]?!![]:![]}];}return db['MailInteraction'][_0x66da('0x4b')](_0x5465c0);})[_0x66da('0x23')](function(_0x44fa4c){_0x78f5a[_0x66da('0x4c')]=_0x44fa4c;return _0x78f5a;});}})['then'](respondWithFilteredResult(_0x3ee088,_0x5465c0))[_0x66da('0x18')](handleError(_0x3ee088,null));};exports['addApplications']=function addApplications(_0x46d54d,_0x520b24){var _0x3c0718=_0x46d54d[_0x66da('0x4e')]['id'];var _0x226edd=_0x46d54d['body'];var _0x3d2417=0xc8;var _0x6e3839=null;return db['sequelize'][_0x66da('0x83')]({'isolationLevel':db['sequelize'][_0x66da('0x84')][_0x66da('0x85')]['READ_COMMITTED']},function(_0x36b58c){return db[_0x66da('0x31')]['findOne']({'where':{'id':_0x3c0718},'transaction':_0x36b58c})[_0x66da('0x23')](function(_0x402d29){if(_0x402d29){return db['MailApplication'][_0x66da('0x26')]({'where':{'MailAccountId':_0x3c0718},'transaction':_0x36b58c})[_0x66da('0x23')](function(){var _0x4f6597=_[_0x66da('0x30')](_0x226edd,function(_0x168f81){_0x168f81[_0x66da('0x56')]=_0x3c0718;return _0x168f81;});return db[_0x66da('0x86')][_0x66da('0x87')](_0x4f6597,{'transaction':_0x36b58c});});}else{_0x3d2417=0x194;_0x6e3839=[];}});})[_0x66da('0x23')](function(){if(_0x3d2417!==0x194){return db[_0x66da('0x86')][_0x66da('0x88')]({'where':{'MailAccountId':_0x3c0718},'order':_0x66da('0x89')})['then'](function(_0x149a20){_0x6e3839=_0x149a20;});}})[_0x66da('0x18')](function(_0x1498de){_0x3d2417=0x1f4;logger['error'](_0x1498de['stack']);if(_0x1498de[_0x66da('0x36')]){delete _0x1498de[_0x66da('0x36')];}_0x6e3839=_0x1498de;})[_0x66da('0x8a')](function(){if(_0x6e3839===null){_0x520b24['sendStatus'](_0x3d2417);}else{if(_0x3d2417===0x1f4){_0x520b24[_0x66da('0x1f')](_0x3d2417)[_0x66da('0x28')](_0x6e3839);}else{_0x520b24[_0x66da('0x1f')](_0x3d2417)[_0x66da('0x1b')](_0x6e3839);}}});};exports[_0x66da('0x8b')]=function(_0x4295fc,_0x111c25){var _0x5a2ab4={};var _0x116a21={};var _0x2c8948;var _0x42d4e3;return db['MailAccount'][_0x66da('0x5a')]({'where':{'id':_0x4295fc[_0x66da('0x4e')]['id']}})[_0x66da('0x23')](handleEntityNotFound(_0x111c25,null))[_0x66da('0x23')](function(_0x35dfdf){if(_0x35dfdf){_0x2c8948=_0x35dfdf;_0x116a21[_0x66da('0x35')]=_[_0x66da('0x38')](db['MailApplication'][_0x66da('0x4f')]);_0x116a21[_0x66da('0x37')]=_[_0x66da('0x38')](_0x4295fc[_0x66da('0x37')]);_0x116a21[_0x66da('0x39')]=_[_0x66da('0x3a')](_0x116a21[_0x66da('0x35')],_0x116a21['query']);_0x5a2ab4[_0x66da('0x3b')]=_['intersection'](_0x116a21[_0x66da('0x35')],qs[_0x66da('0x3c')](_0x4295fc['query'][_0x66da('0x3c')]));_0x5a2ab4[_0x66da('0x3b')]=_0x5a2ab4[_0x66da('0x3b')]['length']?_0x5a2ab4['attributes']:_0x116a21[_0x66da('0x35')];_0x5a2ab4[_0x66da('0x41')]=qs[_0x66da('0x42')](_0x4295fc[_0x66da('0x37')][_0x66da('0x42')]);_0x5a2ab4[_0x66da('0x43')]=qs['filters'](_['pick'](_0x4295fc[_0x66da('0x37')],_0x116a21[_0x66da('0x39')]));if(_0x4295fc['query'][_0x66da('0x45')]){_0x5a2ab4['where']=_[_0x66da('0x46')](_0x5a2ab4[_0x66da('0x43')],{'$or':_[_0x66da('0x30')](_0x5a2ab4[_0x66da('0x3b')],function(_0x2f1edb){var _0x1e14df={};_0x1e14df[_0x2f1edb]={'$like':'%'+_0x4295fc['query'][_0x66da('0x45')]+'%'};return _0x1e14df;})});}_0x5a2ab4=_['merge']({},_0x5a2ab4,_0x4295fc[_0x66da('0x48')]);return _0x2c8948[_0x66da('0x8b')](_0x5a2ab4);}})[_0x66da('0x23')](function(_0x4a5803){if(_0x4a5803){_0x42d4e3=_0x4a5803[_0x66da('0x3d')];if(!_0x4295fc[_0x66da('0x37')]['hasOwnProperty']('nolimit')){_0x5a2ab4[_0x66da('0x40')]=qs[_0x66da('0x40')](_0x4295fc[_0x66da('0x37')]['limit']);_0x5a2ab4[_0x66da('0x1c')]=qs[_0x66da('0x1c')](_0x4295fc[_0x66da('0x37')][_0x66da('0x1c')]);}return _0x2c8948[_0x66da('0x8b')](_0x5a2ab4);}})[_0x66da('0x23')](function(_0x264a94){if(_0x264a94){return _0x264a94?{'count':_0x42d4e3,'rows':_0x264a94}:null;}})[_0x66da('0x23')](respondWithResult(_0x111c25,null))[_0x66da('0x18')](handleError(_0x111c25,null));};exports[_0x66da('0x8c')]=function(_0x2e048f,_0x3d670f){var _0x56faad={'raw':!![],'where':{}};var _0x1f0aa0={};var _0x54cc47={'count':0x0,'rows':[]};return db[_0x66da('0x31')][_0x66da('0x5a')]({'where':{'id':_0x2e048f['params']['id']}})[_0x66da('0x23')](handleEntityNotFound(_0x3d670f,null))[_0x66da('0x23')](function(_0x564a06){if(_0x564a06){_0x1f0aa0[_0x66da('0x35')]=_['keys'](db['MailMessage'][_0x66da('0x4f')]);_0x1f0aa0[_0x66da('0x37')]=_['keys'](_0x2e048f[_0x66da('0x37')]);_0x1f0aa0[_0x66da('0x39')]=_[_0x66da('0x3a')](_0x1f0aa0[_0x66da('0x35')],_0x1f0aa0[_0x66da('0x37')]);_0x56faad['attributes']=_[_0x66da('0x3a')](_0x1f0aa0[_0x66da('0x35')],qs[_0x66da('0x3c')](_0x2e048f[_0x66da('0x37')][_0x66da('0x3c')]));_0x56faad['attributes']=_0x56faad[_0x66da('0x3b')][_0x66da('0x3d')]?_0x56faad[_0x66da('0x3b')]:_0x1f0aa0[_0x66da('0x35')];if(!_0x2e048f[_0x66da('0x37')][_0x66da('0x3e')]('nolimit')){_0x56faad['limit']=qs[_0x66da('0x40')](_0x2e048f['query'][_0x66da('0x40')]);_0x56faad['offset']=qs['offset'](_0x2e048f[_0x66da('0x37')][_0x66da('0x1c')]);}_0x56faad[_0x66da('0x41')]=qs[_0x66da('0x42')](_0x2e048f[_0x66da('0x37')][_0x66da('0x42')]);_0x56faad[_0x66da('0x43')]=qs[_0x66da('0x39')](_[_0x66da('0x44')](_0x2e048f[_0x66da('0x37')],_0x1f0aa0[_0x66da('0x39')]));_0x56faad[_0x66da('0x43')]['MailAccountId']=_0x564a06['id'];if(_0x2e048f[_0x66da('0x37')][_0x66da('0x45')]){_0x56faad['where']=_['merge'](_0x56faad[_0x66da('0x43')],{'$or':_[_0x66da('0x30')](_0x56faad[_0x66da('0x3b')],function(_0x4ee6a6){var _0x55e625={};_0x55e625[_0x4ee6a6]={'$like':'%'+_0x2e048f[_0x66da('0x37')][_0x66da('0x45')]+'%'};return _0x55e625;})});}if(_0x2e048f[_0x66da('0x37')]['$gte']){var _0x13017a=_0x2e048f['query'][_0x66da('0x8d')][_0x66da('0x8e')](',');var _0x16d308={};_0x16d308[_0x13017a[0x0]]={'$gte':moment(_0x13017a[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x56faad[_0x66da('0x43')]=_[_0x66da('0x46')](_0x56faad['where'],_0x16d308);}_0x56faad=_[_0x66da('0x46')]({},_0x56faad,_0x2e048f[_0x66da('0x48')]);return db['MailMessage'][_0x66da('0x1e')]({'where':_0x56faad[_0x66da('0x43')]})['then'](function(_0x11a83e){_0x54cc47[_0x66da('0x1e')]=_0x11a83e;if(_0x2e048f['query']['includeAll']){_0x56faad[_0x66da('0x4a')]=[{'all':!![]}];}return db[_0x66da('0x8f')]['findAll'](_0x56faad);})['then'](function(_0x4fb760){if(_0x2e048f[_0x66da('0x37')][_0x66da('0x90')]===_0x66da('0x91')){for(var _0x2625b7=0x0;_0x2625b7<_0x4fb760[_0x66da('0x3d')];_0x2625b7++){_0x4fb760[_0x2625b7][_0x66da('0x50')]=juice(_0x4fb760[_0x2625b7][_0x66da('0x50')]);}}_0x54cc47[_0x66da('0x4c')]=_0x4fb760;return _0x54cc47;});}})[_0x66da('0x23')](respondWithFilteredResult(_0x3d670f,_0x56faad))[_0x66da('0x18')](handleError(_0x3d670f,null));};exports['send']=function(_0x37a1b1,_0x3435a7){var _0x3ab601,_0x473345={},_0x112888;if(_0x37a1b1[_0x66da('0x50')]['to']){_0x112888=_0x37a1b1[_0x66da('0x50')]['to'][_0x66da('0x8e')](',')[0x0];}return db['MailAccount'][_0x66da('0x55')]({'where':{'id':_0x37a1b1['params']['id']},'include':[{'model':db[_0x66da('0x92')],'as':_0x66da('0x93'),'include':[{'model':db[_0x66da('0x7a')],'as':_0x66da('0x94'),'where':{'email':_0x112888},'limit':0x1,'order':[[_0x66da('0x95'),_0x66da('0x96')]]}]},{'model':db[_0x66da('0x2c')],'as':_0x66da('0x2d'),'raw':!![]}]})[_0x66da('0x23')](handleEntityNotFound(_0x3435a7,null))[_0x66da('0x23')](function(_0x6c9a18){if(_0x6c9a18){_0x3ab601=_0x6c9a18;if(_0x6c9a18[_0x66da('0x2d')]){if(_['isNil'](_0x37a1b1['body']['from'])){_0x37a1b1[_0x66da('0x50')]['from']=util[_0x66da('0x97')]('%s\x20<%s>',_0x6c9a18[_0x66da('0x36')],_0x6c9a18[_0x66da('0x62')]||_0x6c9a18[_0x66da('0x2d')][_0x66da('0x65')]);}if(_0x37a1b1[_0x66da('0x50')][_0x66da('0x98')]&&_0x37a1b1[_0x66da('0x50')][_0x66da('0x98')][_0x66da('0x3d')]){for(var _0x584a1c=0x0;_0x584a1c<_0x37a1b1[_0x66da('0x50')]['attachments'][_0x66da('0x3d')];_0x584a1c+=0x1){_0x37a1b1[_0x66da('0x50')][_0x66da('0x98')][_0x584a1c]={'filename':_0x37a1b1[_0x66da('0x50')]['attachments'][_0x584a1c][_0x66da('0x36')],'path':path[_0x66da('0x99')](config[_0x66da('0x9a')],_0x66da('0x9b'),_0x37a1b1['body'][_0x66da('0x98')][_0x584a1c][_0x66da('0x9c')])};}}var _0x230ce6={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x6c9a18[_0x66da('0x2d')][_0x66da('0x69')])){if(_0x6c9a18[_0x66da('0x2d')][_0x66da('0x6c')]){_0x230ce6[_0x66da('0x9d')]={'user':_0x6c9a18[_0x66da('0x2d')][_0x66da('0x65')],'pass':_0x6c9a18[_0x66da('0x2d')][_0x66da('0x68')]};}_0x230ce6[_0x66da('0x6a')]=_0x6c9a18[_0x66da('0x2d')][_0x66da('0x6a')];_0x230ce6[_0x66da('0x6b')]=_0x6c9a18['Smtp'][_0x66da('0x6b')];_0x230ce6[_0x66da('0x9e')]=_0x6c9a18[_0x66da('0x2d')]['secure'];}else{_0x230ce6[_0x66da('0x69')]=_0x6c9a18[_0x66da('0x2d')][_0x66da('0x69')];_0x230ce6[_0x66da('0x9d')]={'user':_0x6c9a18[_0x66da('0x2d')][_0x66da('0x65')],'pass':_0x6c9a18[_0x66da('0x2d')][_0x66da('0x68')]};}return respondWithRpcPromise('SendMail',_0x66da('0x9f'),{'account':_0x230ce6,'message':_0x37a1b1['body']});}else{throw new Error('List\x20not\x20found');}}})[_0x66da('0x23')](function(_0x1f018a){if(_0x1f018a){_0x473345=_0x1f018a;if(_0x3ab601['List']){if(_0x3ab601[_0x66da('0x93')][_0x66da('0x94')]['length']){return _0x3ab601['List']['Contacts'][0x0];}else{return db[_0x66da('0x7a')][_0x66da('0x58')](_['defaults'](_0x37a1b1[_0x66da('0x50')],{'firstName':_0x37a1b1[_0x66da('0x50')]['to'],'email':_0x37a1b1['body']['to'],'phone':_0x37a1b1[_0x66da('0x50')]['to'],'ListId':_0x3ab601['ListId']}));}}else{throw new Error(_0x66da('0xa0'));}}})[_0x66da('0x23')](function(_0x41af4b){if(_0x41af4b){var _0x40030e={'UserId':_0x37a1b1[_0x66da('0x65')]['id'],'ContactId':_0x41af4b['id'],'MailAccountId':_0x3ab601['id'],'inReplyTo':_0x473345[_0x66da('0xa1')],'to':_0x37a1b1[_0x66da('0x50')][_0x66da('0xa2')],'cc':_0x37a1b1[_0x66da('0x50')]['cc'],'subject':_0x37a1b1[_0x66da('0x50')][_0x66da('0xa3')],'attach':_0x37a1b1[_0x66da('0x50')]['attach'],'firstMsgDirection':_0x66da('0xa4'),'lastMsgAt':moment()[_0x66da('0x97')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x66da('0xa4'),'Messages':[_[_0x66da('0x46')](_0x37a1b1[_0x66da('0x50')],{'messageId':_0x473345['messageId'],'sentAt':moment()[_0x66da('0x97')](_0x66da('0xa5')),'read':!![],'MailAccountId':_0x3ab601['id'],'UserId':_0x37a1b1[_0x66da('0x65')]['id'],'ContactId':_0x41af4b['id']})]};if(_0x37a1b1[_0x66da('0x50')]['Interaction']){_0x40030e=_[_0x66da('0x46')](_0x40030e,_0x37a1b1[_0x66da('0x50')]['Interaction']);}return db[_0x66da('0x79')][_0x66da('0x58')](_0x40030e,{'include':[{'model':db[_0x66da('0x8f')],'as':_0x66da('0xa6')}]});}})[_0x66da('0x23')](respondWithResult(_0x3435a7,null))[_0x66da('0x18')](handleError(_0x3435a7,null));};exports[_0x66da('0xa7')]=function(_0x4212b2,_0x1534cc){return db['MailAccount'][_0x66da('0x55')]({'where':{'id':_0x4212b2['params']['id']},'include':[{'model':db[_0x66da('0x2c')],'as':_0x66da('0x2d'),'raw':!![],'include':[{'model':db[_0x66da('0xa8')],'as':_0x66da('0xa8'),'raw':!![]}]}]})[_0x66da('0x23')](handleEntityNotFound(_0x1534cc,null))[_0x66da('0x23')](function(_0x10584f){if(!_0x10584f['Smtp'])return;var _0x16fc18={'id':_0x10584f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x10584f['provider']!==_0x66da('0x61')){_0x16fc18['service']=_0x10584f[_0x66da('0x60')];}else{_0x16fc18['host']=_0x10584f[_0x66da('0x2d')][_0x66da('0x6a')];_0x16fc18[_0x66da('0x6b')]=_0x10584f[_0x66da('0x2d')][_0x66da('0x6b')];_0x16fc18[_0x66da('0x9e')]=_0x10584f[_0x66da('0x2d')]['secure'];}if(_0x10584f[_0x66da('0x2d')][_0x66da('0x6c')]){if(_0x10584f[_0x66da('0x2d')][_0x66da('0x51')]){_0x16fc18[_0x66da('0x9d')]={'type':_0x66da('0xa9'),'user':_0x10584f[_0x66da('0x2d')][_0x66da('0x65')],'accessToken':_0x10584f[_0x66da('0x2d')]['CloudProvider'][_0x66da('0xaa')]};}else{_0x16fc18[_0x66da('0x9d')]={'user':_0x10584f['Smtp']['user'],'pass':_0x10584f['Smtp']['pass']};}}return respondWithRpcPromise(_0x66da('0xab'),_0x66da('0xa7'),{'account':_0x16fc18});})[_0x66da('0x23')](respondWithResult(_0x1534cc,null))['catch'](handleError(_0x1534cc,null));};exports[_0x66da('0x26')]=function(_0x78529d,_0x32150a){return db[_0x66da('0x31')]['find']({'where':{'id':_0x78529d['params']['id']}})['then'](handleEntityNotFound(_0x32150a,null))[_0x66da('0x23')](function(_0xad1e14){if(_0xad1e14&&_0xad1e14[_0x66da('0x69')]){throw new db[(_0x66da('0xac'))][(_0x66da('0xad'))](_0x66da('0xae'));}return _0xad1e14;})[_0x66da('0x23')](removeEntity(_0x32150a,null))[_0x66da('0x18')](handleError(_0x32150a,null));};exports[_0x66da('0xaf')]=function(_0x584ba2,_0x12da4d){return db[_0x66da('0x31')][_0x66da('0x55')]({'where':{'id':_0x584ba2['params']['id']}})[_0x66da('0x23')](handleEntityNotFound(_0x12da4d,null))['then'](function(_0x498856){if(_0x498856){return _0x498856['addAgents'](_0x584ba2[_0x66da('0x50')][_0x66da('0x5c')],_[_0x66da('0xb0')](_0x584ba2['body'],[_0x66da('0x5c'),'id'])||{})['spread'](function(_0x53f0ad){for(var _0x56aeac=0x0;_0x56aeac<_0x584ba2[_0x66da('0x50')][_0x66da('0x5c')][_0x66da('0x3d')];_0x56aeac+=0x1){socket['emit'](_0x66da('0xb1'),{'UserId':Number(_0x584ba2[_0x66da('0x50')][_0x66da('0x5c')][_0x56aeac]),'MailAccountId':Number(_0x584ba2[_0x66da('0x4e')]['id'])});}return _0x53f0ad;});}})['then'](respondWithResult(_0x12da4d,null))[_0x66da('0x18')](handleError(_0x12da4d,null));};exports[_0x66da('0xb2')]=function(_0x257b22,_0x154fd7){return db['MailAccount'][_0x66da('0x55')]({'where':{'id':_0x257b22[_0x66da('0x4e')]['id']}})[_0x66da('0x23')](handleEntityNotFound(_0x154fd7,null))[_0x66da('0x23')](function(_0x5308d5){if(_0x5308d5){return _0x5308d5[_0x66da('0xb2')](_0x257b22['query'][_0x66da('0x5c')])[_0x66da('0x23')](function(){if(_['isArray'](_0x257b22[_0x66da('0x37')][_0x66da('0x5c')])){for(var _0xb05daa=0x0;_0xb05daa<_0x257b22[_0x66da('0x37')][_0x66da('0x5c')][_0x66da('0x3d')];_0xb05daa+=0x1){socket[_0x66da('0xb3')](_0x66da('0xb4'),{'UserId':Number(_0x257b22[_0x66da('0x37')][_0x66da('0x5c')][_0xb05daa]),'MailAccountId':Number(_0x257b22[_0x66da('0x4e')]['id'])});}}else{socket[_0x66da('0xb3')](_0x66da('0xb4'),{'UserId':Number(_0x257b22['query'][_0x66da('0x5c')]),'MailAccountId':Number(_0x257b22['params']['id'])});}});}})[_0x66da('0x23')](respondWithStatusCode(_0x154fd7,null))['catch'](handleError(_0x154fd7,null));};exports[_0x66da('0xb5')]=function(_0x1bf3a0,_0x6e53dd){var _0x15107f={};var _0x2e8d73={};var _0x295383;var _0xab13d5;return db['MailAccount']['findOne']({'where':{'id':_0x1bf3a0[_0x66da('0x4e')]['id']}})[_0x66da('0x23')](handleEntityNotFound(_0x6e53dd,null))[_0x66da('0x23')](function(_0x19ea96){if(_0x19ea96){_0x295383=_0x19ea96;_0x2e8d73[_0x66da('0x35')]=_[_0x66da('0x38')](db[_0x66da('0x7c')][_0x66da('0x4f')]);_0x2e8d73[_0x66da('0x37')]=_[_0x66da('0x38')](_0x1bf3a0[_0x66da('0x37')]);_0x2e8d73[_0x66da('0x39')]=_['intersection'](_0x2e8d73[_0x66da('0x35')],_0x2e8d73['query']);_0x15107f[_0x66da('0x3b')]=_[_0x66da('0x3a')](_0x2e8d73[_0x66da('0x35')],qs[_0x66da('0x3c')](_0x1bf3a0[_0x66da('0x37')][_0x66da('0x3c')]));_0x15107f['attributes']=_0x15107f[_0x66da('0x3b')]['length']?_0x15107f[_0x66da('0x3b')]:_0x2e8d73[_0x66da('0x35')];_0x15107f[_0x66da('0x41')]=qs[_0x66da('0x42')](_0x1bf3a0['query'][_0x66da('0x42')]);_0x15107f[_0x66da('0x43')]=qs[_0x66da('0x39')](_['pick'](_0x1bf3a0[_0x66da('0x37')],_0x2e8d73[_0x66da('0x39')]));if(_0x1bf3a0[_0x66da('0x37')]['filter']){_0x15107f['where']=_[_0x66da('0x46')](_0x15107f['where'],{'$or':_['map'](_0x15107f['attributes'],function(_0x5bb3b7){var _0x4a78d3={};_0x4a78d3[_0x5bb3b7]={'$like':'%'+_0x1bf3a0[_0x66da('0x37')][_0x66da('0x45')]+'%'};return _0x4a78d3;})});}_0x15107f=_['merge']({},_0x15107f,_0x1bf3a0['options']);return _0x295383['getAgents'](_0x15107f);}})[_0x66da('0x23')](function(_0x5e7f26){if(_0x5e7f26){_0xab13d5=_0x5e7f26[_0x66da('0x3d')];if(!_0x1bf3a0[_0x66da('0x37')][_0x66da('0x3e')]('nolimit')){_0x15107f['limit']=qs[_0x66da('0x40')](_0x1bf3a0[_0x66da('0x37')][_0x66da('0x40')]);_0x15107f[_0x66da('0x1c')]=qs[_0x66da('0x1c')](_0x1bf3a0[_0x66da('0x37')]['offset']);}return _0x295383['getAgents'](_0x15107f);}})[_0x66da('0x23')](function(_0x4ce830){if(_0x4ce830){return _0x4ce830?{'count':_0xab13d5,'rows':_0x4ce830}:null;}})[_0x66da('0x23')](respondWithResult(_0x6e53dd,null))[_0x66da('0x18')](handleError(_0x6e53dd,null));}; \ No newline at end of file +var _0x2632=['Smtp','mandatoryDispositionPause','map','fieldName','key','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','MailAccount','include','findAll','rows','show','params','Pause','keys','fields','find','catch','body','modernAuthentication','MailServerIn','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','includeAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','rawAttributes','order','removeAnswers','ids','provider','custom','email','isNil','active','user','username','password','pass','CloudProviderId','host','port','authentication','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','Contact','User','Owner','fullname','internal','color','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','finally','send','getApplications','$gte','split','format','inlineCss','true','CmList','List','CmContact','Contacts','DESC','from','%s\x20<%s>','attachments','server/files/attachments','basename','service','secure','auth','SendMail','sendMail','defaults','ListId','messageId','subject','out','Interaction','MailMessage','verifySmtp','CloudProvider','OAuth2','data5','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','util','path','juice','ioredis','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','update','get','MailAccounts','UserProfileResource','destroy','stack','name','index','Imap','MailServerOut'];(function(_0x5c557c,_0x3d601c){var _0x357a76=function(_0x23e99e){while(--_0x23e99e){_0x5c557c['push'](_0x5c557c['shift']());}};_0x357a76(++_0x3d601c);}(_0x2632,0x1ec));var _0x2263=function(_0x1a6dfd,_0x273173){_0x1a6dfd=_0x1a6dfd-0x0;var _0x4f0315=_0x2632[_0x1a6dfd];return _0x4f0315;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x2263('0x0'));var path=require(_0x2263('0x1'));var _=require('lodash');var juice=require(_0x2263('0x2'));var Redis=require(_0x2263('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x2263('0x4'));var db=require(_0x2263('0x5'))['db'];config[_0x2263('0x6')]=_['defaults'](config[_0x2263('0x6')],{'host':_0x2263('0x7'),'port':0x18eb});var socket=require(_0x2263('0x8'))(new Redis(config[_0x2263('0x6')]));require('./mailAccount.socket')[_0x2263('0x9')](socket);var jayson=require(_0x2263('0xa'));var client=jayson[_0x2263('0xb')][_0x2263('0xc')]({'port':0x232b});function respondWithRpcPromise(_0x17ee0b,_0x2d63fa,_0x9afa61,_0x5a7408){return new BPromise(function(_0x3ef7f1,_0x5ec45){var _0x17e33e=_0x5a7408||client;return _0x17e33e[_0x2263('0xd')](_0x17ee0b,_0x9afa61)[_0x2263('0xe')](function(_0x2c3424){logger[_0x2263('0xf')](_0x2263('0x10'),_0x2d63fa,_0x2263('0x11'));logger['debug'](_0x2263('0x12'),_0x2d63fa,_0x2263('0x11'),JSON[_0x2263('0x13')](_0x2c3424));if(_0x2c3424[_0x2263('0x14')]){if(_0x2c3424[_0x2263('0x14')]['code']===0x1f4){logger[_0x2263('0x14')](_0x2263('0x10'),_0x2d63fa,_0x2c3424[_0x2263('0x14')][_0x2263('0x15')]);return _0x5ec45(_0x2c3424[_0x2263('0x14')][_0x2263('0x15')]);}logger[_0x2263('0x14')]('MailAccount,\x20%s,\x20%s',_0x2d63fa,_0x2c3424[_0x2263('0x14')]['message']);return _0x3ef7f1(_0x2c3424[_0x2263('0x14')][_0x2263('0x15')]);}else{logger[_0x2263('0xf')](_0x2263('0x10'),_0x2d63fa,'request\x20sent');_0x3ef7f1(_0x2c3424['result'][_0x2263('0x15')]);}})['catch'](function(_0x38c83f){logger[_0x2263('0x14')](_0x2263('0x10'),_0x2d63fa,_0x38c83f);_0x5ec45(_0x38c83f);});});}function respondWithStatusCode(_0x1bb8bf,_0x11bc14){_0x11bc14=_0x11bc14||0xcc;return function(_0x532e80){if(_0x532e80){return _0x1bb8bf[_0x2263('0x16')](_0x11bc14);}return _0x1bb8bf['status'](_0x11bc14)[_0x2263('0x17')]();};}function respondWithResult(_0x481bc4,_0x3ca33e){_0x3ca33e=_0x3ca33e||0xc8;return function(_0x14f53b){if(_0x14f53b){return _0x481bc4[_0x2263('0x18')](_0x3ca33e)['json'](_0x14f53b);}};}function respondWithFilteredResult(_0x116d95,_0x26f7a2){return function(_0x198950){if(_0x198950){var _0xef9c7f=typeof _0x26f7a2[_0x2263('0x19')]===_0x2263('0x1a')&&typeof _0x26f7a2[_0x2263('0x1b')]===_0x2263('0x1a');var _0xc90c81=_0x198950[_0x2263('0x1c')];var _0x2e5481=_0xef9c7f?0x0:_0x26f7a2[_0x2263('0x19')];var _0xe23849=_0xef9c7f?_0x198950[_0x2263('0x1c')]:_0x26f7a2[_0x2263('0x19')]+_0x26f7a2[_0x2263('0x1b')];var _0x40176d;if(_0xe23849>=_0xc90c81){_0xe23849=_0xc90c81;_0x40176d=0xc8;}else{_0x40176d=0xce;}_0x116d95[_0x2263('0x18')](_0x40176d);return _0x116d95[_0x2263('0x1d')](_0x2263('0x1e'),_0x2e5481+'-'+_0xe23849+'/'+_0xc90c81)[_0x2263('0x1f')](_0x198950);}return null;};}function saveUpdates(_0x3ff293){return function(_0x227f41){if(_0x227f41){return _0x227f41[_0x2263('0x20')](_0x3ff293)[_0x2263('0xe')](function(_0x97c9c6){return _0x97c9c6;});}return null;};}function removeEntity(_0x281887){return function(_0x65c45f){if(_0x65c45f){return _0x65c45f['destroy']()[_0x2263('0xe')](function(){var _0x107d17=_0x65c45f[_0x2263('0x21')]({'plain':!![]});var _0x348381=_0x2263('0x22');return db[_0x2263('0x23')][_0x2263('0x24')]({'where':{'type':_0x348381,'resourceId':_0x107d17['id']}})[_0x2263('0xe')](function(){return _0x65c45f;});})[_0x2263('0xe')](function(){_0x281887[_0x2263('0x18')](0xcc)[_0x2263('0x17')]();});}};}function handleEntityNotFound(_0x55f9a7){return function(_0x18be3e){if(!_0x18be3e){_0x55f9a7['sendStatus'](0x194);}return _0x18be3e;};}function handleError(_0x62a53a,_0x401a5e){_0x401a5e=_0x401a5e||0x1f4;return function(_0x5057ec){logger[_0x2263('0x14')](_0x5057ec[_0x2263('0x25')]);if(_0x5057ec[_0x2263('0x26')]){delete _0x5057ec[_0x2263('0x26')];}_0x62a53a[_0x2263('0x18')](_0x401a5e)['send'](_0x5057ec);};}exports[_0x2263('0x27')]=function(_0xd1ef68,_0x2f93a6){var _0x45e586={'include':[{'model':db['MailServerIn'],'as':_0x2263('0x28')},{'model':db[_0x2263('0x29')],'as':_0x2263('0x2a')},{'model':db['Pause'],'as':_0x2263('0x2b')}]},_0x41b4d2={},_0x2f845f={'count':0x0,'rows':[]};var _0x9a73e2=_[_0x2263('0x2c')](db['MailAccount']['rawAttributes'],function(_0x5d8fc8){return{'name':_0x5d8fc8[_0x2263('0x2d')],'type':_0x5d8fc8['type'][_0x2263('0x2e')]};});_0x41b4d2['model']=_[_0x2263('0x2c')](_0x9a73e2,'name');_0x41b4d2[_0x2263('0x2f')]=_['keys'](_0xd1ef68[_0x2263('0x2f')]);_0x41b4d2[_0x2263('0x30')]=_['intersection'](_0x41b4d2[_0x2263('0x31')],_0x41b4d2[_0x2263('0x2f')]);_0x45e586[_0x2263('0x32')]=_[_0x2263('0x33')](_0x41b4d2[_0x2263('0x31')],qs['fields'](_0xd1ef68['query']['fields']));_0x45e586['attributes']=_0x45e586[_0x2263('0x32')][_0x2263('0x34')]?_0x45e586['attributes']:_0x41b4d2[_0x2263('0x31')];if(!_0xd1ef68[_0x2263('0x2f')][_0x2263('0x35')](_0x2263('0x36'))){_0x45e586[_0x2263('0x1b')]=qs[_0x2263('0x1b')](_0xd1ef68[_0x2263('0x2f')][_0x2263('0x1b')]);_0x45e586[_0x2263('0x19')]=qs['offset'](_0xd1ef68['query'][_0x2263('0x19')]);}_0x45e586['order']=qs[_0x2263('0x37')](_0xd1ef68[_0x2263('0x2f')]['sort']);_0x45e586['where']=qs[_0x2263('0x30')](_[_0x2263('0x38')](_0xd1ef68[_0x2263('0x2f')],_0x41b4d2[_0x2263('0x30')]),_0x9a73e2);if(_0xd1ef68[_0x2263('0x2f')][_0x2263('0x39')]){_0x45e586[_0x2263('0x3a')]=_[_0x2263('0x3b')](_0x45e586[_0x2263('0x3a')],{'$or':_[_0x2263('0x2c')](_0x9a73e2,function(_0x2ed48b){if(_0x2ed48b[_0x2263('0x3c')]!=='VIRTUAL'){var _0x125bc2={};_0x125bc2[_0x2ed48b['name']]={'$like':'%'+_0xd1ef68['query'][_0x2263('0x39')]+'%'};return _0x125bc2;}})});}_0x45e586=_[_0x2263('0x3b')]({},_0x45e586,_0xd1ef68[_0x2263('0x3d')]);var _0x3b5f97={'where':_0x45e586[_0x2263('0x3a')]};return db[_0x2263('0x3e')][_0x2263('0x1c')](_0x3b5f97)[_0x2263('0xe')](function(_0x41c8a0){_0x2f845f[_0x2263('0x1c')]=_0x41c8a0;if(_0xd1ef68[_0x2263('0x2f')]['includeAll']){_0x45e586[_0x2263('0x3f')]=[{'all':!![]}];}return db[_0x2263('0x3e')][_0x2263('0x40')](_0x45e586);})[_0x2263('0xe')](function(_0x274168){_0x2f845f[_0x2263('0x41')]=_0x274168;return _0x2f845f;})['then'](respondWithFilteredResult(_0x2f93a6,_0x45e586))['catch'](handleError(_0x2f93a6,null));};exports[_0x2263('0x42')]=function(_0x5735af,_0x43a7b3){var _0x2c8b21={'raw':![],'where':{'id':_0x5735af[_0x2263('0x43')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x2263('0x28')},{'model':db['MailServerOut'],'as':_0x2263('0x2a')},{'model':db[_0x2263('0x44')],'as':_0x2263('0x2b')}]},_0x462ca1={};_0x462ca1['model']=_[_0x2263('0x45')](db[_0x2263('0x3e')]['rawAttributes']);_0x462ca1[_0x2263('0x2f')]=_['keys'](_0x5735af[_0x2263('0x2f')]);_0x462ca1[_0x2263('0x30')]=_[_0x2263('0x33')](_0x462ca1[_0x2263('0x31')],_0x462ca1['query']);_0x2c8b21[_0x2263('0x32')]=_[_0x2263('0x33')](_0x462ca1['model'],qs['fields'](_0x5735af[_0x2263('0x2f')][_0x2263('0x46')]));_0x2c8b21[_0x2263('0x32')]=_0x2c8b21['attributes'][_0x2263('0x34')]?_0x2c8b21[_0x2263('0x32')]:_0x462ca1['model'];if(_0x5735af['query']['includeAll']){_0x2c8b21[_0x2263('0x3f')]=[{'all':!![]}];}_0x2c8b21=_['merge']({},_0x2c8b21,_0x5735af['options']);return db[_0x2263('0x3e')][_0x2263('0x47')](_0x2c8b21)[_0x2263('0xe')](handleEntityNotFound(_0x43a7b3,null))[_0x2263('0xe')](respondWithResult(_0x43a7b3,null))[_0x2263('0x48')](handleError(_0x43a7b3,null));};exports[_0x2263('0x20')]=function(_0x309245,_0x5e2861){if(_0x309245[_0x2263('0x49')]['id']){delete _0x309245[_0x2263('0x49')]['id'];}if(_0x309245[_0x2263('0x49')][_0x2263('0x28')]){if(!_0x309245[_0x2263('0x49')][_0x2263('0x28')][_0x2263('0x4a')]){_0x309245[_0x2263('0x49')]['Imap']['CloudProviderId']=null;}}if(_0x309245['body'][_0x2263('0x2a')]){if(!_0x309245[_0x2263('0x49')][_0x2263('0x2a')][_0x2263('0x4a')]){_0x309245[_0x2263('0x49')]['Smtp']['CloudProviderId']=null;}}return db[_0x2263('0x3e')]['find']({'where':{'id':_0x309245['params']['id']},'include':[{'model':db[_0x2263('0x4b')],'as':'Imap'},{'model':db[_0x2263('0x29')],'as':_0x2263('0x2a')},{'model':db[_0x2263('0x44')],'as':_0x2263('0x2b')}]})[_0x2263('0xe')](handleEntityNotFound(_0x5e2861,null))['then'](saveUpdates(_0x309245[_0x2263('0x49')],null))[_0x2263('0xe')](function(_0x3537da){if(_0x3537da&&_0x309245['body'][_0x2263('0x28')]){return db[_0x2263('0x4b')][_0x2263('0x20')](_0x309245[_0x2263('0x49')]['Imap'],{'where':{'MailAccountId':_0x3537da['id']}})[_0x2263('0xe')](function(){return _0x3537da;});}return _0x3537da;})[_0x2263('0xe')](function(_0x2b466d){if(_0x2b466d&&_0x309245[_0x2263('0x49')][_0x2263('0x2a')]){return db['MailServerOut'][_0x2263('0x20')](_0x309245[_0x2263('0x49')]['Smtp'],{'where':{'MailAccountId':_0x2b466d['id']}})[_0x2263('0xe')](function(){return _0x2b466d;});}return _0x2b466d;})[_0x2263('0xe')](respondWithResult(_0x5e2861,null))[_0x2263('0x48')](handleError(_0x5e2861,null));};exports[_0x2263('0x4c')]=function(_0x509f20,_0x470922){return db[_0x2263('0x3e')]['describe']()['then'](respondWithResult(_0x470922,null))[_0x2263('0x48')](handleError(_0x470922,null));};exports[_0x2263('0x4d')]=function(_0x1c6fe0,_0x42b119){if(_0x1c6fe0['body']['id']){delete _0x1c6fe0['body']['id'];}return db[_0x2263('0x3e')][_0x2263('0x47')]({'where':{'id':_0x1c6fe0[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x42b119,null))[_0x2263('0xe')](function(_0x326984){if(_0x326984){_0x1c6fe0[_0x2263('0x49')][_0x2263('0x4e')]=_0x326984['id'];return db[_0x2263('0x4f')][_0x2263('0x50')](_0x1c6fe0[_0x2263('0x49')]);}})[_0x2263('0xe')](respondWithResult(_0x42b119,null))['catch'](handleError(_0x42b119,null));};exports[_0x2263('0x51')]=function(_0x2a9ab5,_0x5bb700){var _0x3c43a5={'raw':![],'where':{}};var _0x3eb555={};var _0x49ef0d={'count':0x0,'rows':[]};return db[_0x2263('0x3e')][_0x2263('0x52')]({'where':{'id':_0x2a9ab5[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x5bb700,null))[_0x2263('0xe')](function(_0x4eda72){if(_0x4eda72){_0x3eb555['model']=_[_0x2263('0x45')](db[_0x2263('0x4f')]['rawAttributes']);_0x3eb555['query']=_[_0x2263('0x45')](_0x2a9ab5[_0x2263('0x2f')]);_0x3eb555[_0x2263('0x30')]=_[_0x2263('0x33')](_0x3eb555[_0x2263('0x31')],_0x3eb555[_0x2263('0x2f')]);_0x3c43a5[_0x2263('0x32')]=_[_0x2263('0x33')](_0x3eb555['model'],qs[_0x2263('0x46')](_0x2a9ab5[_0x2263('0x2f')][_0x2263('0x46')]));_0x3c43a5[_0x2263('0x32')]=_0x3c43a5[_0x2263('0x32')]['length']?_0x3c43a5[_0x2263('0x32')]:_0x3eb555[_0x2263('0x31')];if(!_0x2a9ab5[_0x2263('0x2f')][_0x2263('0x35')](_0x2263('0x36'))){_0x3c43a5[_0x2263('0x1b')]=qs[_0x2263('0x1b')](_0x2a9ab5['query'][_0x2263('0x1b')]);_0x3c43a5['offset']=qs[_0x2263('0x19')](_0x2a9ab5[_0x2263('0x2f')][_0x2263('0x19')]);}_0x3c43a5['order']=qs[_0x2263('0x37')](_0x2a9ab5[_0x2263('0x2f')][_0x2263('0x37')]);_0x3c43a5[_0x2263('0x3a')]=qs['filters'](_[_0x2263('0x38')](_0x2a9ab5[_0x2263('0x2f')],_0x3eb555[_0x2263('0x30')]));_0x3c43a5['where'][_0x2263('0x4e')]=_0x4eda72['id'];if(_0x2a9ab5[_0x2263('0x2f')][_0x2263('0x39')]){_0x3c43a5['where']=_['merge'](_0x3c43a5[_0x2263('0x3a')],{'$or':_[_0x2263('0x2c')](_0x3c43a5[_0x2263('0x32')],function(_0x4f13e3){var _0x1d61e0={};_0x1d61e0[_0x4f13e3]={'$like':'%'+_0x2a9ab5['query'][_0x2263('0x39')]+'%'};return _0x1d61e0;})});}_0x3c43a5=_[_0x2263('0x3b')]({},_0x3c43a5,_0x2a9ab5['options']);return db[_0x2263('0x4f')][_0x2263('0x1c')]({'where':_0x3c43a5[_0x2263('0x3a')]})['then'](function(_0x2e0f1c){_0x49ef0d[_0x2263('0x1c')]=_0x2e0f1c;if(_0x2a9ab5[_0x2263('0x2f')][_0x2263('0x53')]){_0x3c43a5[_0x2263('0x3f')]=[{'all':!![]}];}return db[_0x2263('0x4f')][_0x2263('0x40')](_0x3c43a5);})[_0x2263('0xe')](function(_0x4c82fb){_0x49ef0d[_0x2263('0x41')]=_0x4c82fb;return _0x49ef0d;});}})[_0x2263('0xe')](respondWithFilteredResult(_0x5bb700,_0x3c43a5))[_0x2263('0x48')](handleError(_0x5bb700,null));};exports[_0x2263('0x54')]=function(_0x42d79a,_0x2559d9){return db[_0x2263('0x3e')][_0x2263('0x47')]({'where':{'id':_0x42d79a['params']['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x2559d9,null))[_0x2263('0xe')](function(_0x44b872){if(_0x44b872){return _0x44b872[_0x2263('0x54')](_0x42d79a[_0x2263('0x2f')]['ids']);}})['then'](respondWithStatusCode(_0x2559d9,null))[_0x2263('0x48')](handleError(_0x2559d9,null));};exports[_0x2263('0x55')]=function(_0x52b77a,_0x355287){if(_0x52b77a[_0x2263('0x49')]['id']){delete _0x52b77a[_0x2263('0x49')]['id'];}return db['MailAccount'][_0x2263('0x47')]({'where':{'id':_0x52b77a['params']['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x355287,null))[_0x2263('0xe')](function(_0x414490){if(_0x414490){_0x52b77a[_0x2263('0x49')][_0x2263('0x4e')]=_0x414490['id'];return db[_0x2263('0x56')][_0x2263('0x50')](_0x52b77a['body']);}})[_0x2263('0xe')](respondWithResult(_0x355287,null))['catch'](handleError(_0x355287,null));};exports[_0x2263('0x57')]=function(_0x78e386,_0x1fa2fd){var _0x976a67={'raw':![],'where':{}};var _0x350b9f={};var _0x962c74={'count':0x0,'rows':[]};return db[_0x2263('0x3e')][_0x2263('0x52')]({'where':{'id':_0x78e386['params']['id']}})['then'](handleEntityNotFound(_0x1fa2fd,null))[_0x2263('0xe')](function(_0x380fab){if(_0x380fab){_0x350b9f[_0x2263('0x31')]=_[_0x2263('0x45')](db[_0x2263('0x56')][_0x2263('0x58')]);_0x350b9f[_0x2263('0x2f')]=_[_0x2263('0x45')](_0x78e386[_0x2263('0x2f')]);_0x350b9f['filters']=_[_0x2263('0x33')](_0x350b9f[_0x2263('0x31')],_0x350b9f[_0x2263('0x2f')]);_0x976a67[_0x2263('0x32')]=_[_0x2263('0x33')](_0x350b9f[_0x2263('0x31')],qs[_0x2263('0x46')](_0x78e386[_0x2263('0x2f')]['fields']));_0x976a67['attributes']=_0x976a67[_0x2263('0x32')]['length']?_0x976a67['attributes']:_0x350b9f[_0x2263('0x31')];if(!_0x78e386['query']['hasOwnProperty']('nolimit')){_0x976a67[_0x2263('0x1b')]=qs['limit'](_0x78e386[_0x2263('0x2f')][_0x2263('0x1b')]);_0x976a67[_0x2263('0x19')]=qs[_0x2263('0x19')](_0x78e386[_0x2263('0x2f')][_0x2263('0x19')]);}_0x976a67[_0x2263('0x59')]=qs[_0x2263('0x37')](_0x78e386['query'][_0x2263('0x37')]);_0x976a67['where']=qs[_0x2263('0x30')](_[_0x2263('0x38')](_0x78e386['query'],_0x350b9f['filters']));_0x976a67['where'][_0x2263('0x4e')]=_0x380fab['id'];if(_0x78e386[_0x2263('0x2f')]['filter']){_0x976a67['where']=_['merge'](_0x976a67['where'],{'$or':_[_0x2263('0x2c')](_0x976a67[_0x2263('0x32')],function(_0x163c96){var _0x48ce0a={};_0x48ce0a[_0x163c96]={'$like':'%'+_0x78e386['query'][_0x2263('0x39')]+'%'};return _0x48ce0a;})});}_0x976a67=_[_0x2263('0x3b')]({},_0x976a67,_0x78e386['options']);return db[_0x2263('0x56')][_0x2263('0x1c')]({'where':_0x976a67[_0x2263('0x3a')]})['then'](function(_0x1feb57){_0x962c74['count']=_0x1feb57;if(_0x78e386[_0x2263('0x2f')][_0x2263('0x53')]){_0x976a67[_0x2263('0x3f')]=[{'all':!![]}];}return db[_0x2263('0x56')][_0x2263('0x40')](_0x976a67);})[_0x2263('0xe')](function(_0x1ee504){_0x962c74[_0x2263('0x41')]=_0x1ee504;return _0x962c74;});}})[_0x2263('0xe')](respondWithFilteredResult(_0x1fa2fd,_0x976a67))[_0x2263('0x48')](handleError(_0x1fa2fd,null));};exports[_0x2263('0x5a')]=function(_0xd9f0,_0x5d146d){return db[_0x2263('0x3e')][_0x2263('0x47')]({'where':{'id':_0xd9f0[_0x2263('0x43')]['id']}})['then'](handleEntityNotFound(_0x5d146d,null))[_0x2263('0xe')](function(_0x1cefc3){if(_0x1cefc3){return _0x1cefc3[_0x2263('0x5a')](_0xd9f0[_0x2263('0x2f')][_0x2263('0x5b')]);}})[_0x2263('0xe')](respondWithStatusCode(_0x5d146d,null))[_0x2263('0x48')](handleError(_0x5d146d,null));};exports[_0x2263('0x50')]=function(_0x146768,_0x11d6a6){var _0x45b22c={'name':_0x146768[_0x2263('0x49')][_0x2263('0x26')],'key':_0x146768[_0x2263('0x49')]['key'],'provider':_0x146768['body'][_0x2263('0x5c')]===_0x2263('0x5d')?null:_0x146768[_0x2263('0x49')][_0x2263('0x5c')],'email':_0x146768[_0x2263('0x49')][_0x2263('0x5e')],'ListId':_0x146768[_0x2263('0x49')]['ListId'],'active':!_[_0x2263('0x5f')](_0x146768[_0x2263('0x49')][_0x2263('0x60')])?_0x146768[_0x2263('0x49')]['active']:!![],'description':_0x146768[_0x2263('0x49')]['description']||null,'Imap':{},'Smtp':{}};if(_0x45b22c['provider']){_0x45b22c[_0x2263('0x28')][_0x2263('0x61')]=_0x45b22c[_0x2263('0x2a')][_0x2263('0x61')]=_0x146768[_0x2263('0x49')][_0x2263('0x62')];_0x45b22c[_0x2263('0x28')][_0x2263('0x63')]=_0x45b22c['Smtp'][_0x2263('0x64')]=_0x146768[_0x2263('0x49')][_0x2263('0x63')];if(_0x146768[_0x2263('0x49')][_0x2263('0x4a')]){_0x45b22c[_0x2263('0x28')]['modernAuthentication']=_0x45b22c[_0x2263('0x2a')]['modernAuthentication']=!![];_0x45b22c[_0x2263('0x28')][_0x2263('0x65')]=_0x45b22c[_0x2263('0x2a')][_0x2263('0x65')]=_0x146768[_0x2263('0x49')][_0x2263('0x65')];_0x45b22c[_0x2263('0x28')][_0x2263('0x63')]=_0x45b22c['Smtp'][_0x2263('0x64')]=null;}else{_0x45b22c[_0x2263('0x28')][_0x2263('0x65')]=_0x45b22c[_0x2263('0x2a')][_0x2263('0x65')]=null;}_0x45b22c[_0x2263('0x28')]['service']=_0x45b22c[_0x2263('0x2a')]['service']=null;_0x45b22c[_0x2263('0x28')][_0x2263('0x66')]=_0x45b22c[_0x2263('0x2a')][_0x2263('0x66')]=null;_0x45b22c[_0x2263('0x28')]['port']=_0x45b22c['Smtp'][_0x2263('0x67')]=null;}else{if(_0x146768[_0x2263('0x49')]['authentication']){_0x45b22c[_0x2263('0x28')][_0x2263('0x61')]=_0x45b22c['Smtp']['user']=_0x146768['body'][_0x2263('0x62')];_0x45b22c[_0x2263('0x28')][_0x2263('0x63')]=_0x45b22c[_0x2263('0x2a')][_0x2263('0x64')]=_0x146768[_0x2263('0x49')][_0x2263('0x63')];}else{_0x45b22c['Imap'][_0x2263('0x68')]=_0x45b22c[_0x2263('0x2a')]['authentication']=![];_0x45b22c['Imap']['user']=_0x45b22c[_0x2263('0x2a')]['user']=null;_0x45b22c[_0x2263('0x28')][_0x2263('0x63')]=_0x45b22c['Smtp'][_0x2263('0x64')]=null;}_0x45b22c[_0x2263('0x28')][_0x2263('0x66')]=_0x146768[_0x2263('0x49')]['Imap'][_0x2263('0x66')];_0x45b22c['Imap'][_0x2263('0x67')]=_0x146768[_0x2263('0x49')][_0x2263('0x28')][_0x2263('0x67')];_0x45b22c[_0x2263('0x2a')][_0x2263('0x66')]=_0x146768[_0x2263('0x49')][_0x2263('0x2a')][_0x2263('0x66')];_0x45b22c[_0x2263('0x2a')][_0x2263('0x67')]=_0x146768['body'][_0x2263('0x2a')][_0x2263('0x67')];}return db[_0x2263('0x3e')]['create'](_0x45b22c,{'include':[{'model':db[_0x2263('0x29')],'as':_0x2263('0x2a')},{'model':db[_0x2263('0x4b')],'as':_0x2263('0x28')}]})['then'](function(_0x5ee9c6){var _0x3ef0b5=_0x146768[_0x2263('0x61')][_0x2263('0x21')]({'plain':!![]});if(!_0x3ef0b5)throw new Error(_0x2263('0x69'));if(_0x3ef0b5[_0x2263('0x6a')]===_0x2263('0x61')){var _0x1f7bff=_0x5ee9c6[_0x2263('0x21')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'MailAccounts','userProfileId':_0x3ef0b5[_0x2263('0x6b')]},'raw':!![]})[_0x2263('0xe')](function(_0x27acf5){if(_0x27acf5&&_0x27acf5[_0x2263('0x6c')]===0x0){return db[_0x2263('0x23')]['create']({'name':_0x1f7bff[_0x2263('0x26')],'resourceId':_0x1f7bff['id'],'type':_0x27acf5[_0x2263('0x26')],'sectionId':_0x27acf5['id']},{})['then'](function(){return _0x5ee9c6;});}else{return _0x5ee9c6;}})[_0x2263('0x48')](function(_0xa5b3c5){logger[_0x2263('0x14')](_0x2263('0x6d'),_0xa5b3c5);throw _0xa5b3c5;});}return _0x5ee9c6;})[_0x2263('0xe')](respondWithResult(_0x11d6a6,0xc9))['catch'](handleError(_0x11d6a6,null));};exports['getImap']=function(_0x547aea,_0x24547b){return db['MailAccount'][_0x2263('0x52')]({'where':{'id':_0x547aea[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x24547b,null))['then'](function(_0x58716f){if(_0x58716f){return _0x58716f[_0x2263('0x6e')]();}return null;})['then'](respondWithResult(_0x24547b,null))[_0x2263('0x48')](handleError(_0x24547b,null));};exports[_0x2263('0x6f')]=function(_0x223314,_0x22111d){if(_0x223314[_0x2263('0x49')]['id']){delete _0x223314[_0x2263('0x49')]['id'];}return db[_0x2263('0x3e')]['find']({'where':{'id':_0x223314[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x22111d,null))[_0x2263('0xe')](function(_0x2c577e){if(_0x2c577e){_0x223314[_0x2263('0x49')][_0x2263('0x4e')]=_0x2c577e['id'];return db[_0x2263('0x4b')]['create'](_0x223314['body']);}})[_0x2263('0xe')](respondWithResult(_0x22111d,null))['catch'](handleError(_0x22111d,null));};exports[_0x2263('0x70')]=function(_0x4a0709,_0x3f1323){return db[_0x2263('0x3e')][_0x2263('0x52')]({'where':{'id':_0x4a0709['params']['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x3f1323,null))['then'](function(_0x514394){if(_0x514394){return _0x514394[_0x2263('0x71')](null);}return null;})[_0x2263('0xe')](respondWithStatusCode(_0x3f1323,null))[_0x2263('0x48')](handleError(_0x3f1323,null));};exports[_0x2263('0x72')]=function(_0x2aa112,_0x470c17){return db[_0x2263('0x3e')]['findOne']({'where':{'id':_0x2aa112[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x470c17,null))[_0x2263('0xe')](function(_0x5f2ede){if(_0x5f2ede){return _0x5f2ede['getSmtp']();}return null;})[_0x2263('0xe')](respondWithResult(_0x470c17,null))[_0x2263('0x48')](handleError(_0x470c17,null));};exports['addSmtp']=function(_0x198577,_0x420239){if(_0x198577[_0x2263('0x49')]['id']){delete _0x198577['body']['id'];}return db[_0x2263('0x3e')]['find']({'where':{'id':_0x198577[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x420239,null))[_0x2263('0xe')](function(_0x490efb){if(_0x490efb){_0x198577[_0x2263('0x49')][_0x2263('0x4e')]=_0x490efb['id'];return db[_0x2263('0x29')][_0x2263('0x50')](_0x198577[_0x2263('0x49')]);}})[_0x2263('0xe')](respondWithResult(_0x420239,null))[_0x2263('0x48')](handleError(_0x420239,null));};exports[_0x2263('0x73')]=function(_0x345255,_0x450e10){return db[_0x2263('0x3e')][_0x2263('0x52')]({'where':{'id':_0x345255[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x450e10,null))[_0x2263('0xe')](function(_0x21723e){if(_0x21723e){return _0x21723e[_0x2263('0x74')](null);}return null;})[_0x2263('0xe')](respondWithStatusCode(_0x450e10,null))[_0x2263('0x48')](handleError(_0x450e10,null));};exports[_0x2263('0x75')]=function(_0xf30ddb,_0x3a8088){return db[_0x2263('0x76')]['find']({'where':{'id':_0xf30ddb['params']['id']}})['then'](handleEntityNotFound(_0x3a8088,null))[_0x2263('0xe')](function(_0x5ea9fd){if(_0x5ea9fd){return _0x5ea9fd[_0x2263('0x75')](_0xf30ddb[_0x2263('0x49')][_0x2263('0x5b')],_['omit'](_0xf30ddb['body'],[_0x2263('0x5b'),'id'])||{});}})[_0x2263('0xe')](respondWithResult(_0x3a8088,null))[_0x2263('0x48')](handleError(_0x3a8088,null));};exports['getInteractions']=function(_0x58019c,_0x1fb4b0){var _0x1b5c96={'raw':![],'where':{}};var _0x27e4e0={};var _0x4c994a={'count':0x0,'rows':[]};return db['MailAccount'][_0x2263('0x52')]({'where':{'id':_0x58019c[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x1fb4b0,null))['then'](function(_0x8d457c){if(_0x8d457c){_0x27e4e0['model']=_['keys'](db[_0x2263('0x76')]['rawAttributes']);_0x27e4e0['query']=_[_0x2263('0x45')](_0x58019c['query']);_0x27e4e0[_0x2263('0x30')]=_[_0x2263('0x33')](_0x27e4e0['model'],_0x27e4e0[_0x2263('0x2f')]);_0x1b5c96[_0x2263('0x32')]=_[_0x2263('0x33')](_0x27e4e0[_0x2263('0x31')],qs[_0x2263('0x46')](_0x58019c[_0x2263('0x2f')]['fields']));_0x1b5c96[_0x2263('0x32')]=_0x1b5c96[_0x2263('0x32')][_0x2263('0x34')]?_0x1b5c96[_0x2263('0x32')]:_0x27e4e0[_0x2263('0x31')];if(!_0x58019c[_0x2263('0x2f')][_0x2263('0x35')]('nolimit')){_0x1b5c96[_0x2263('0x1b')]=qs[_0x2263('0x1b')](_0x58019c[_0x2263('0x2f')][_0x2263('0x1b')]);_0x1b5c96[_0x2263('0x19')]=qs[_0x2263('0x19')](_0x58019c[_0x2263('0x2f')][_0x2263('0x19')]);}_0x1b5c96[_0x2263('0x59')]=qs[_0x2263('0x37')](_0x58019c['query'][_0x2263('0x37')]);_0x1b5c96[_0x2263('0x3a')]=qs[_0x2263('0x30')](_[_0x2263('0x38')](_0x58019c[_0x2263('0x2f')],_0x27e4e0[_0x2263('0x30')]));_0x1b5c96[_0x2263('0x3a')][_0x2263('0x4e')]=_0x8d457c['id'];if(_0x58019c['query'][_0x2263('0x39')]){_0x1b5c96['where']=_[_0x2263('0x3b')](_0x1b5c96[_0x2263('0x3a')],{'$or':_['map'](_0x1b5c96[_0x2263('0x32')],function(_0x5c7902){var _0x53a4ae={};_0x53a4ae[_0x5c7902]={'$like':'%'+_0x58019c[_0x2263('0x2f')]['filter']+'%'};return _0x53a4ae;})});}_0x1b5c96=_[_0x2263('0x3b')]({},_0x1b5c96,_0x58019c['options']);return db[_0x2263('0x76')]['count']({'where':_0x1b5c96[_0x2263('0x3a')]})[_0x2263('0xe')](function(_0x17fe65){_0x4c994a[_0x2263('0x1c')]=_0x17fe65;if(_0x58019c[_0x2263('0x2f')][_0x2263('0x53')]){_0x1b5c96[_0x2263('0x3f')]=[{'model':db['CmContact'],'as':_0x2263('0x77'),'required':![]},{'model':db[_0x2263('0x78')],'as':_0x2263('0x79'),'attributes':['name',_0x2263('0x7a'),_0x2263('0x7b')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x2263('0x26'),_0x2263('0x7c')],'where':_0x58019c[_0x2263('0x2f')]['tag']?{'id':_0x58019c[_0x2263('0x2f')][_0x2263('0x7d')]}:undefined,'required':_0x58019c['query'][_0x2263('0x7d')]?!![]:![]}];}return db[_0x2263('0x76')][_0x2263('0x40')](_0x1b5c96);})[_0x2263('0xe')](function(_0x161ae6){_0x4c994a[_0x2263('0x41')]=_0x161ae6;return _0x4c994a;});}})['then'](respondWithFilteredResult(_0x1fb4b0,_0x1b5c96))[_0x2263('0x48')](handleError(_0x1fb4b0,null));};exports['addApplications']=function addApplications(_0x32144f,_0x5e3342){var _0x3ba66d=_0x32144f['params']['id'];var _0x554aba=_0x32144f[_0x2263('0x49')];var _0x3869aa=0xc8;var _0x214f2d=null;return db[_0x2263('0x7e')]['transaction']({'isolationLevel':db['sequelize'][_0x2263('0x7f')][_0x2263('0x80')][_0x2263('0x81')]},function(_0x1ac2a9){return db[_0x2263('0x3e')][_0x2263('0x52')]({'where':{'id':_0x3ba66d},'transaction':_0x1ac2a9})[_0x2263('0xe')](function(_0x132c5d){if(_0x132c5d){return db[_0x2263('0x82')][_0x2263('0x24')]({'where':{'MailAccountId':_0x3ba66d},'transaction':_0x1ac2a9})[_0x2263('0xe')](function(){var _0x19fbd4=_[_0x2263('0x2c')](_0x554aba,function(_0x1b1cff){_0x1b1cff[_0x2263('0x4e')]=_0x3ba66d;return _0x1b1cff;});return db[_0x2263('0x82')]['bulkCreate'](_0x19fbd4,{'transaction':_0x1ac2a9});});}else{_0x3869aa=0x194;_0x214f2d=[];}});})[_0x2263('0xe')](function(){if(_0x3869aa!==0x194){return db[_0x2263('0x82')][_0x2263('0x83')]({'where':{'MailAccountId':_0x3ba66d},'order':'priority'})['then'](function(_0x265b2d){_0x214f2d=_0x265b2d;});}})[_0x2263('0x48')](function(_0x257c37){_0x3869aa=0x1f4;logger['error'](_0x257c37['stack']);if(_0x257c37['name']){delete _0x257c37[_0x2263('0x26')];}_0x214f2d=_0x257c37;})[_0x2263('0x84')](function(){if(_0x214f2d===null){_0x5e3342[_0x2263('0x16')](_0x3869aa);}else{if(_0x3869aa===0x1f4){_0x5e3342['status'](_0x3869aa)[_0x2263('0x85')](_0x214f2d);}else{_0x5e3342[_0x2263('0x18')](_0x3869aa)[_0x2263('0x1f')](_0x214f2d);}}});};exports[_0x2263('0x86')]=function(_0x4188c8,_0x2a75fd){var _0x454508={};var _0x45dcb6={};var _0xf3770d;var _0x30b66d;return db['MailAccount'][_0x2263('0x52')]({'where':{'id':_0x4188c8[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x2a75fd,null))[_0x2263('0xe')](function(_0x1e6bc9){if(_0x1e6bc9){_0xf3770d=_0x1e6bc9;_0x45dcb6[_0x2263('0x31')]=_[_0x2263('0x45')](db[_0x2263('0x82')]['rawAttributes']);_0x45dcb6['query']=_[_0x2263('0x45')](_0x4188c8[_0x2263('0x2f')]);_0x45dcb6[_0x2263('0x30')]=_[_0x2263('0x33')](_0x45dcb6[_0x2263('0x31')],_0x45dcb6[_0x2263('0x2f')]);_0x454508[_0x2263('0x32')]=_[_0x2263('0x33')](_0x45dcb6[_0x2263('0x31')],qs[_0x2263('0x46')](_0x4188c8[_0x2263('0x2f')][_0x2263('0x46')]));_0x454508[_0x2263('0x32')]=_0x454508[_0x2263('0x32')][_0x2263('0x34')]?_0x454508['attributes']:_0x45dcb6['model'];_0x454508[_0x2263('0x59')]=qs[_0x2263('0x37')](_0x4188c8['query'][_0x2263('0x37')]);_0x454508[_0x2263('0x3a')]=qs['filters'](_['pick'](_0x4188c8[_0x2263('0x2f')],_0x45dcb6[_0x2263('0x30')]));if(_0x4188c8[_0x2263('0x2f')][_0x2263('0x39')]){_0x454508[_0x2263('0x3a')]=_[_0x2263('0x3b')](_0x454508[_0x2263('0x3a')],{'$or':_['map'](_0x454508['attributes'],function(_0x20db0e){var _0x1431dc={};_0x1431dc[_0x20db0e]={'$like':'%'+_0x4188c8[_0x2263('0x2f')][_0x2263('0x39')]+'%'};return _0x1431dc;})});}_0x454508=_[_0x2263('0x3b')]({},_0x454508,_0x4188c8['options']);return _0xf3770d[_0x2263('0x86')](_0x454508);}})[_0x2263('0xe')](function(_0xc385cd){if(_0xc385cd){_0x30b66d=_0xc385cd['length'];if(!_0x4188c8[_0x2263('0x2f')][_0x2263('0x35')](_0x2263('0x36'))){_0x454508[_0x2263('0x1b')]=qs[_0x2263('0x1b')](_0x4188c8[_0x2263('0x2f')][_0x2263('0x1b')]);_0x454508[_0x2263('0x19')]=qs[_0x2263('0x19')](_0x4188c8[_0x2263('0x2f')][_0x2263('0x19')]);}return _0xf3770d['getApplications'](_0x454508);}})[_0x2263('0xe')](function(_0x13c764){if(_0x13c764){return _0x13c764?{'count':_0x30b66d,'rows':_0x13c764}:null;}})[_0x2263('0xe')](respondWithResult(_0x2a75fd,null))['catch'](handleError(_0x2a75fd,null));};exports['getMessages']=function(_0x58c4a2,_0x7ccce4){var _0x388548={'raw':!![],'where':{}};var _0x511626={};var _0x4824b6={'count':0x0,'rows':[]};return db[_0x2263('0x3e')][_0x2263('0x52')]({'where':{'id':_0x58c4a2['params']['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x7ccce4,null))[_0x2263('0xe')](function(_0x3e5476){if(_0x3e5476){_0x511626['model']=_[_0x2263('0x45')](db['MailMessage'][_0x2263('0x58')]);_0x511626['query']=_[_0x2263('0x45')](_0x58c4a2['query']);_0x511626[_0x2263('0x30')]=_[_0x2263('0x33')](_0x511626[_0x2263('0x31')],_0x511626[_0x2263('0x2f')]);_0x388548[_0x2263('0x32')]=_[_0x2263('0x33')](_0x511626['model'],qs[_0x2263('0x46')](_0x58c4a2['query'][_0x2263('0x46')]));_0x388548[_0x2263('0x32')]=_0x388548[_0x2263('0x32')]['length']?_0x388548['attributes']:_0x511626[_0x2263('0x31')];if(!_0x58c4a2[_0x2263('0x2f')][_0x2263('0x35')](_0x2263('0x36'))){_0x388548[_0x2263('0x1b')]=qs[_0x2263('0x1b')](_0x58c4a2[_0x2263('0x2f')][_0x2263('0x1b')]);_0x388548[_0x2263('0x19')]=qs[_0x2263('0x19')](_0x58c4a2[_0x2263('0x2f')][_0x2263('0x19')]);}_0x388548['order']=qs[_0x2263('0x37')](_0x58c4a2['query'][_0x2263('0x37')]);_0x388548['where']=qs['filters'](_[_0x2263('0x38')](_0x58c4a2[_0x2263('0x2f')],_0x511626[_0x2263('0x30')]));_0x388548[_0x2263('0x3a')][_0x2263('0x4e')]=_0x3e5476['id'];if(_0x58c4a2[_0x2263('0x2f')][_0x2263('0x39')]){_0x388548[_0x2263('0x3a')]=_['merge'](_0x388548[_0x2263('0x3a')],{'$or':_[_0x2263('0x2c')](_0x388548[_0x2263('0x32')],function(_0x41b8f3){var _0x3330e8={};_0x3330e8[_0x41b8f3]={'$like':'%'+_0x58c4a2['query']['filter']+'%'};return _0x3330e8;})});}if(_0x58c4a2[_0x2263('0x2f')]['$gte']){var _0x15d4fe=_0x58c4a2[_0x2263('0x2f')][_0x2263('0x87')][_0x2263('0x88')](',');var _0x1320f2={};_0x1320f2[_0x15d4fe[0x0]]={'$gte':moment(_0x15d4fe[0x1])[_0x2263('0x89')]('YYYY-MM-DD\x20HH:mm:ss')};_0x388548[_0x2263('0x3a')]=_[_0x2263('0x3b')](_0x388548[_0x2263('0x3a')],_0x1320f2);}_0x388548=_[_0x2263('0x3b')]({},_0x388548,_0x58c4a2['options']);return db['MailMessage']['count']({'where':_0x388548[_0x2263('0x3a')]})[_0x2263('0xe')](function(_0x573f82){_0x4824b6[_0x2263('0x1c')]=_0x573f82;if(_0x58c4a2['query'][_0x2263('0x53')]){_0x388548[_0x2263('0x3f')]=[{'all':!![]}];}return db['MailMessage'][_0x2263('0x40')](_0x388548);})[_0x2263('0xe')](function(_0x2ee04f){if(_0x58c4a2['query'][_0x2263('0x8a')]===_0x2263('0x8b')){for(var _0x4bb8f7=0x0;_0x4bb8f7<_0x2ee04f[_0x2263('0x34')];_0x4bb8f7++){_0x2ee04f[_0x4bb8f7][_0x2263('0x49')]=juice(_0x2ee04f[_0x4bb8f7][_0x2263('0x49')]);}}_0x4824b6[_0x2263('0x41')]=_0x2ee04f;return _0x4824b6;});}})['then'](respondWithFilteredResult(_0x7ccce4,_0x388548))[_0x2263('0x48')](handleError(_0x7ccce4,null));};exports[_0x2263('0x85')]=function(_0x523a90,_0x28fcb9){var _0x50c5db,_0xed6453={},_0x3ce4e3;if(_0x523a90['body']['to']){_0x3ce4e3=_0x523a90['body']['to'][_0x2263('0x88')](',')[0x0];}return db[_0x2263('0x3e')][_0x2263('0x47')]({'where':{'id':_0x523a90[_0x2263('0x43')]['id']},'include':[{'model':db[_0x2263('0x8c')],'as':_0x2263('0x8d'),'include':[{'model':db[_0x2263('0x8e')],'as':_0x2263('0x8f'),'where':{'email':_0x3ce4e3},'limit':0x1,'order':[['updatedAt',_0x2263('0x90')]]}]},{'model':db[_0x2263('0x29')],'as':_0x2263('0x2a'),'raw':!![]}]})[_0x2263('0xe')](handleEntityNotFound(_0x28fcb9,null))[_0x2263('0xe')](function(_0xaacfd7){if(_0xaacfd7){_0x50c5db=_0xaacfd7;if(_0xaacfd7[_0x2263('0x2a')]){if(_[_0x2263('0x5f')](_0x523a90[_0x2263('0x49')][_0x2263('0x91')])){_0x523a90[_0x2263('0x49')]['from']=util[_0x2263('0x89')](_0x2263('0x92'),_0xaacfd7[_0x2263('0x26')],_0xaacfd7['email']||_0xaacfd7['Smtp']['user']);}if(_0x523a90['body'][_0x2263('0x93')]&&_0x523a90[_0x2263('0x49')]['attachments'][_0x2263('0x34')]){for(var _0x45c951=0x0;_0x45c951<_0x523a90[_0x2263('0x49')]['attachments']['length'];_0x45c951+=0x1){_0x523a90[_0x2263('0x49')]['attachments'][_0x45c951]={'filename':_0x523a90[_0x2263('0x49')][_0x2263('0x93')][_0x45c951]['name'],'path':path['join'](config['root'],_0x2263('0x94'),_0x523a90['body'][_0x2263('0x93')][_0x45c951][_0x2263('0x95')])};}}var _0x5ecd73={'tls':{'rejectUnauthorized':![]}};if(_[_0x2263('0x5f')](_0xaacfd7[_0x2263('0x2a')][_0x2263('0x96')])){if(_0xaacfd7['Smtp'][_0x2263('0x68')]){_0x5ecd73['auth']={'user':_0xaacfd7[_0x2263('0x2a')][_0x2263('0x61')],'pass':_0xaacfd7[_0x2263('0x2a')][_0x2263('0x64')]};}_0x5ecd73[_0x2263('0x66')]=_0xaacfd7[_0x2263('0x2a')][_0x2263('0x66')];_0x5ecd73[_0x2263('0x67')]=_0xaacfd7[_0x2263('0x2a')][_0x2263('0x67')];_0x5ecd73[_0x2263('0x97')]=_0xaacfd7[_0x2263('0x2a')][_0x2263('0x97')];}else{_0x5ecd73['service']=_0xaacfd7['Smtp']['service'];_0x5ecd73[_0x2263('0x98')]={'user':_0xaacfd7[_0x2263('0x2a')][_0x2263('0x61')],'pass':_0xaacfd7[_0x2263('0x2a')]['pass']};}return respondWithRpcPromise(_0x2263('0x99'),_0x2263('0x9a'),{'account':_0x5ecd73,'message':_0x523a90[_0x2263('0x49')]});}else{throw new Error('List\x20not\x20found');}}})[_0x2263('0xe')](function(_0x4e9ea8){if(_0x4e9ea8){_0xed6453=_0x4e9ea8;if(_0x50c5db[_0x2263('0x8d')]){if(_0x50c5db[_0x2263('0x8d')][_0x2263('0x8f')]['length']){return _0x50c5db['List'][_0x2263('0x8f')][0x0];}else{return db[_0x2263('0x8e')][_0x2263('0x50')](_[_0x2263('0x9b')](_0x523a90[_0x2263('0x49')],{'firstName':_0x523a90[_0x2263('0x49')]['to'],'email':_0x523a90['body']['to'],'phone':_0x523a90[_0x2263('0x49')]['to'],'ListId':_0x50c5db[_0x2263('0x9c')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x2263('0xe')](function(_0x21781f){if(_0x21781f){var _0x4c17ca={'UserId':_0x523a90['user']['id'],'ContactId':_0x21781f['id'],'MailAccountId':_0x50c5db['id'],'inReplyTo':_0xed6453[_0x2263('0x9d')],'to':_0x523a90['body'][_0x2263('0x91')],'cc':_0x523a90[_0x2263('0x49')]['cc'],'subject':_0x523a90['body'][_0x2263('0x9e')],'attach':_0x523a90[_0x2263('0x49')]['attach'],'firstMsgDirection':_0x2263('0x9f'),'lastMsgAt':moment()[_0x2263('0x89')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x2263('0x9f'),'Messages':[_[_0x2263('0x3b')](_0x523a90['body'],{'messageId':_0xed6453[_0x2263('0x9d')],'sentAt':moment()[_0x2263('0x89')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x50c5db['id'],'UserId':_0x523a90[_0x2263('0x61')]['id'],'ContactId':_0x21781f['id']})]};if(_0x523a90[_0x2263('0x49')]['Interaction']){_0x4c17ca=_[_0x2263('0x3b')](_0x4c17ca,_0x523a90[_0x2263('0x49')][_0x2263('0xa0')]);}return db[_0x2263('0x76')][_0x2263('0x50')](_0x4c17ca,{'include':[{'model':db[_0x2263('0xa1')],'as':'Messages'}]});}})[_0x2263('0xe')](respondWithResult(_0x28fcb9,null))[_0x2263('0x48')](handleError(_0x28fcb9,null));};exports[_0x2263('0xa2')]=function(_0x256bda,_0x5ddb27){return db['MailAccount']['find']({'where':{'id':_0x256bda[_0x2263('0x43')]['id']},'include':[{'model':db[_0x2263('0x29')],'as':_0x2263('0x2a'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x2263('0xa3'),'raw':!![]}]}]})[_0x2263('0xe')](handleEntityNotFound(_0x5ddb27,null))[_0x2263('0xe')](function(_0x1cb5bb){if(!_0x1cb5bb['Smtp'])return;var _0x641301={'id':_0x1cb5bb['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1cb5bb[_0x2263('0x5c')]!==_0x2263('0x5d')){_0x641301[_0x2263('0x96')]=_0x1cb5bb[_0x2263('0x5c')];}else{_0x641301['host']=_0x1cb5bb[_0x2263('0x2a')]['host'];_0x641301[_0x2263('0x67')]=_0x1cb5bb['Smtp']['port'];_0x641301[_0x2263('0x97')]=_0x1cb5bb['Smtp'][_0x2263('0x97')];}if(_0x1cb5bb['Smtp'][_0x2263('0x68')]){if(_0x1cb5bb[_0x2263('0x2a')][_0x2263('0x4a')]){_0x641301[_0x2263('0x98')]={'type':_0x2263('0xa4'),'user':_0x1cb5bb['Smtp'][_0x2263('0x61')],'accessToken':_0x1cb5bb[_0x2263('0x2a')][_0x2263('0xa3')][_0x2263('0xa5')]};}else{_0x641301['auth']={'user':_0x1cb5bb[_0x2263('0x2a')][_0x2263('0x61')],'pass':_0x1cb5bb[_0x2263('0x2a')][_0x2263('0x64')]};}}return respondWithRpcPromise(_0x2263('0xa6'),_0x2263('0xa2'),{'account':_0x641301});})[_0x2263('0xe')](respondWithResult(_0x5ddb27,null))['catch'](handleError(_0x5ddb27,null));};exports[_0x2263('0x24')]=function(_0x1d0bee,_0x5f1d2a){return db[_0x2263('0x3e')][_0x2263('0x47')]({'where':{'id':_0x1d0bee['params']['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x5f1d2a,null))['then'](function(_0xbbc74){if(_0xbbc74&&_0xbbc74['service']){throw new db['Sequelize'][(_0x2263('0xa7'))](_0x2263('0xa8'));}return _0xbbc74;})[_0x2263('0xe')](removeEntity(_0x5f1d2a,null))['catch'](handleError(_0x5f1d2a,null));};exports['addAgents']=function(_0x1c05e3,_0x1339f7){return db[_0x2263('0x3e')][_0x2263('0x47')]({'where':{'id':_0x1c05e3[_0x2263('0x43')]['id']}})['then'](handleEntityNotFound(_0x1339f7,null))[_0x2263('0xe')](function(_0x231dd0){if(_0x231dd0){return _0x231dd0[_0x2263('0xa9')](_0x1c05e3[_0x2263('0x49')][_0x2263('0x5b')],_[_0x2263('0xaa')](_0x1c05e3[_0x2263('0x49')],[_0x2263('0x5b'),'id'])||{})[_0x2263('0xab')](function(_0x46c403){for(var _0x588b70=0x0;_0x588b70<_0x1c05e3[_0x2263('0x49')]['ids']['length'];_0x588b70+=0x1){socket['emit'](_0x2263('0xac'),{'UserId':Number(_0x1c05e3['body']['ids'][_0x588b70]),'MailAccountId':Number(_0x1c05e3[_0x2263('0x43')]['id'])});}return _0x46c403;});}})['then'](respondWithResult(_0x1339f7,null))['catch'](handleError(_0x1339f7,null));};exports['removeAgents']=function(_0x435882,_0x549cae){return db[_0x2263('0x3e')][_0x2263('0x47')]({'where':{'id':_0x435882[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x549cae,null))[_0x2263('0xe')](function(_0x8fa089){if(_0x8fa089){return _0x8fa089[_0x2263('0xad')](_0x435882[_0x2263('0x2f')][_0x2263('0x5b')])[_0x2263('0xe')](function(){if(_[_0x2263('0xae')](_0x435882[_0x2263('0x2f')][_0x2263('0x5b')])){for(var _0x1175e1=0x0;_0x1175e1<_0x435882[_0x2263('0x2f')][_0x2263('0x5b')][_0x2263('0x34')];_0x1175e1+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x435882[_0x2263('0x2f')][_0x2263('0x5b')][_0x1175e1]),'MailAccountId':Number(_0x435882['params']['id'])});}}else{socket[_0x2263('0xaf')](_0x2263('0xb0'),{'UserId':Number(_0x435882['query'][_0x2263('0x5b')]),'MailAccountId':Number(_0x435882[_0x2263('0x43')]['id'])});}});}})[_0x2263('0xe')](respondWithStatusCode(_0x549cae,null))[_0x2263('0x48')](handleError(_0x549cae,null));};exports['getAgents']=function(_0x1230f7,_0x110d2f){var _0x34130e={};var _0x5abf4a={};var _0x10a2e4;var _0x248121;return db[_0x2263('0x3e')]['findOne']({'where':{'id':_0x1230f7[_0x2263('0x43')]['id']}})[_0x2263('0xe')](handleEntityNotFound(_0x110d2f,null))[_0x2263('0xe')](function(_0x767dcd){if(_0x767dcd){_0x10a2e4=_0x767dcd;_0x5abf4a[_0x2263('0x31')]=_[_0x2263('0x45')](db[_0x2263('0x78')][_0x2263('0x58')]);_0x5abf4a[_0x2263('0x2f')]=_['keys'](_0x1230f7[_0x2263('0x2f')]);_0x5abf4a['filters']=_[_0x2263('0x33')](_0x5abf4a[_0x2263('0x31')],_0x5abf4a[_0x2263('0x2f')]);_0x34130e[_0x2263('0x32')]=_[_0x2263('0x33')](_0x5abf4a['model'],qs[_0x2263('0x46')](_0x1230f7[_0x2263('0x2f')][_0x2263('0x46')]));_0x34130e[_0x2263('0x32')]=_0x34130e[_0x2263('0x32')][_0x2263('0x34')]?_0x34130e[_0x2263('0x32')]:_0x5abf4a[_0x2263('0x31')];_0x34130e[_0x2263('0x59')]=qs[_0x2263('0x37')](_0x1230f7[_0x2263('0x2f')]['sort']);_0x34130e[_0x2263('0x3a')]=qs[_0x2263('0x30')](_['pick'](_0x1230f7[_0x2263('0x2f')],_0x5abf4a[_0x2263('0x30')]));if(_0x1230f7['query'][_0x2263('0x39')]){_0x34130e[_0x2263('0x3a')]=_['merge'](_0x34130e[_0x2263('0x3a')],{'$or':_[_0x2263('0x2c')](_0x34130e[_0x2263('0x32')],function(_0x25110a){var _0x4a520d={};_0x4a520d[_0x25110a]={'$like':'%'+_0x1230f7[_0x2263('0x2f')]['filter']+'%'};return _0x4a520d;})});}_0x34130e=_[_0x2263('0x3b')]({},_0x34130e,_0x1230f7['options']);return _0x10a2e4[_0x2263('0xb1')](_0x34130e);}})[_0x2263('0xe')](function(_0x147885){if(_0x147885){_0x248121=_0x147885['length'];if(!_0x1230f7[_0x2263('0x2f')][_0x2263('0x35')](_0x2263('0x36'))){_0x34130e['limit']=qs[_0x2263('0x1b')](_0x1230f7[_0x2263('0x2f')][_0x2263('0x1b')]);_0x34130e[_0x2263('0x19')]=qs[_0x2263('0x19')](_0x1230f7['query']['offset']);}return _0x10a2e4[_0x2263('0xb1')](_0x34130e);}})[_0x2263('0xe')](function(_0x3cd1e3){if(_0x3cd1e3){return _0x3cd1e3?{'count':_0x248121,'rows':_0x3cd1e3}:null;}})['then'](respondWithResult(_0x110d2f,null))['catch'](handleError(_0x110d2f,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 6373422..ab36c53 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 _0x556a=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailAccount'];(function(_0x16a05b,_0x48e26b){var _0x116ab8=function(_0x2e4cf5){while(--_0x2e4cf5){_0x16a05b['push'](_0x16a05b['shift']());}};_0x116ab8(++_0x48e26b);}(_0x556a,0x1dd));var _0xa556=function(_0x13289a,_0x5ad531){_0x13289a=_0x13289a-0x0;var _0x2658a0=_0x556a[_0x13289a];return _0x2658a0;};'use strict';var EventEmitter=require(_0xa556('0x0'));var MailAccount=require(_0xa556('0x1'))['db'][_0xa556('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa556('0x3')](0x0);var events={'afterCreate':_0xa556('0x4'),'afterUpdate':_0xa556('0x5'),'afterDestroy':_0xa556('0x6')};function emitEvent(_0x2a76f6){return function(_0x425bc3,_0x5b0832,_0x1f302d){MailAccountEvents[_0xa556('0x7')](_0x2a76f6+':'+_0x425bc3['id'],_0x425bc3);MailAccountEvents[_0xa556('0x7')](_0x2a76f6,_0x425bc3);_0x1f302d(null);};}for(var e in events){if(events[_0xa556('0x8')](e)){var event=events[e];MailAccount[_0xa556('0x9')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x59f2=['update','remove','emit','hook','exports','setMaxListeners'];(function(_0x412dd8,_0x355780){var _0x47b96=function(_0x58b680){while(--_0x58b680){_0x412dd8['push'](_0x412dd8['shift']());}};_0x47b96(++_0x355780);}(_0x59f2,0xb3));var _0x259f=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x59f2[_0x47e7cb];return _0x2a8874;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x259f('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x259f('0x1'),'afterDestroy':_0x259f('0x2')};function emitEvent(_0x4334a3){return function(_0xad60c2,_0x587d71,_0x3a5a8b){MailAccountEvents[_0x259f('0x3')](_0x4334a3+':'+_0xad60c2['id'],_0xad60c2);MailAccountEvents['emit'](_0x4334a3,_0xad60c2);_0x3a5a8b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x259f('0x4')](e,emitEvent(event));}}module[_0x259f('0x5')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index e7287ae..4b78617 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 _0xd95c=['MailAccount','mail_accounts','../../config/logger','api','moment','bluebird','path','../../config/environment','./mailAccount.attributes','exports','define'];(function(_0x245694,_0x470462){var _0x2e97e2=function(_0x126df8){while(--_0x126df8){_0x245694['push'](_0x245694['shift']());}};_0x2e97e2(++_0x470462);}(_0xd95c,0x183));var _0xcd95=function(_0x36eb54,_0x3356f4){_0x36eb54=_0x36eb54-0x0;var _0x2dc019=_0xd95c[_0x36eb54];return _0x2dc019;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcd95('0x0'))(_0xcd95('0x1'));var moment=require(_0xcd95('0x2'));var BPromise=require(_0xcd95('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd95('0x4'));var rimraf=require('rimraf');var config=require(_0xcd95('0x5'));var attributes=require(_0xcd95('0x6'));module[_0xcd95('0x7')]=function(_0x4730d9,_0x515350){return _0x4730d9[_0xcd95('0x8')](_0xcd95('0x9'),attributes,{'tableName':_0xcd95('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb9b=['exports','MailAccount','mail_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes'];(function(_0x335eff,_0x22d79c){var _0x2d608c=function(_0x20b494){while(--_0x20b494){_0x335eff['push'](_0x335eff['shift']());}};_0x2d608c(++_0x22d79c);}(_0xeb9b,0x145));var _0xbeb9=function(_0x24a15e,_0x4862ce){_0x24a15e=_0x24a15e-0x0;var _0x10256f=_0xeb9b[_0x24a15e];return _0x10256f;};'use strict';var _=require(_0xbeb9('0x0'));var util=require(_0xbeb9('0x1'));var logger=require(_0xbeb9('0x2'))(_0xbeb9('0x3'));var moment=require(_0xbeb9('0x4'));var BPromise=require(_0xbeb9('0x5'));var rp=require(_0xbeb9('0x6'));var fs=require('fs');var path=require(_0xbeb9('0x7'));var rimraf=require(_0xbeb9('0x8'));var config=require(_0xbeb9('0x9'));var attributes=require(_0xbeb9('0xa'));module[_0xbeb9('0xb')]=function(_0x5761f8,_0x141338){return _0x5761f8['define'](_0xbeb9('0xc'),attributes,{'tableName':_0xbeb9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index f304b00..eb38eba 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 _0x831a=['rawAttributes','createdAt','updatedAt','CompanyId','isNil','from','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','account','CmList','List','DESC','MailApplication','Applications','MailServerOut','Smtp','omit','applications','orderBy','priority','autoclose','length','close','*,*,*,*','Contacts','ListId','List\x20not\x20found','contact','messageId','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','format','interaction','get','attachments','originCc','originChannel','Attachment','Attachments','UserId','User','name','unshift','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','model','debug','ShowMailAccount','find','map','body','difference','keys','CmContact'];(function(_0x9c0068,_0x4b3622){var _0x4ba6b3=function(_0x3a8c2d){while(--_0x3a8c2d){_0x9c0068['push'](_0x9c0068['shift']());}};_0x4ba6b3(++_0x4b3622);}(_0x831a,0x16e));var _0xa831=function(_0x40dad4,_0x22d959){_0x40dad4=_0x40dad4-0x0;var _0x495728=_0x831a[_0x40dad4];return _0x495728;};'use strict';var _=require(_0xa831('0x0'));var util=require(_0xa831('0x1'));var moment=require(_0xa831('0x2'));var BPromise=require(_0xa831('0x3'));var rs=require(_0xa831('0x4'));var fs=require('fs');var Redis=require(_0xa831('0x5'));var db=require(_0xa831('0x6'))['db'];var utils=require(_0xa831('0x7'));var logger=require(_0xa831('0x8'))(_0xa831('0x9'));var config=require(_0xa831('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa831('0xb')]({'port':0x232c});config[_0xa831('0xc')]=_[_0xa831('0xd')](config[_0xa831('0xc')],{'host':_0xa831('0xe'),'port':0x18eb});var socket=require(_0xa831('0xf'))(new Redis(config[_0xa831('0xc')]));require(_0xa831('0x10'))['register'](socket);function respondWithRpcPromise(_0x4f4f49,_0x2ba9e6,_0xeb820e){return new BPromise(function(_0x5e868a,_0xdd9123){return client[_0xa831('0x11')](_0x4f4f49,_0xeb820e)[_0xa831('0x12')](function(_0x361bec){logger[_0xa831('0x13')](_0xa831('0x14'),_0x2ba9e6,_0xa831('0x15'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x2ba9e6,'request\x20sent',JSON[_0xa831('0x16')](_0x361bec));if(_0x361bec['error']){if(_0x361bec[_0xa831('0x17')][_0xa831('0x18')]===0x1f4){logger[_0xa831('0x17')]('MailAccount,\x20%s,\x20%s',_0x2ba9e6,_0x361bec[_0xa831('0x17')][_0xa831('0x19')]);return _0xdd9123(_0x361bec[_0xa831('0x17')][_0xa831('0x19')]);}logger['error'](_0xa831('0x14'),_0x2ba9e6,_0x361bec['error']['message']);return _0x5e868a(_0x361bec[_0xa831('0x17')][_0xa831('0x19')]);}else{logger[_0xa831('0x13')](_0xa831('0x14'),_0x2ba9e6,_0xa831('0x15'));_0x5e868a(_0x361bec[_0xa831('0x1a')]['message']);}})[_0xa831('0x1b')](function(_0x312b0c){logger[_0xa831('0x17')](_0xa831('0x14'),_0x2ba9e6,_0x312b0c);_0xdd9123(_0x312b0c);});});}exports[_0xa831('0x1c')]=function(_0x468cbc){var _0x48b000=this;return new Promise(function(_0x4c00e4,_0x313bba){return db[_0xa831('0x1d')][_0xa831('0x1e')]({'raw':_0x468cbc[_0xa831('0x1f')]?_0x468cbc[_0xa831('0x1f')][_0xa831('0x20')]===undefined?!![]:![]:!![],'where':_0x468cbc[_0xa831('0x1f')]?_0x468cbc['options'][_0xa831('0x21')]||null:null,'attributes':_0x468cbc[_0xa831('0x1f')]?_0x468cbc['options'][_0xa831('0x22')]||null:null,'limit':_0x468cbc[_0xa831('0x1f')]?_0x468cbc[_0xa831('0x1f')][_0xa831('0x23')]||null:null,'include':_0x468cbc[_0xa831('0x1f')]?_0x468cbc[_0xa831('0x1f')][_0xa831('0x24')]?_['map'](_0x468cbc['options'][_0xa831('0x24')],function(_0x99d67b){return{'model':db[_0x99d67b[_0xa831('0x25')]],'as':_0x99d67b['as'],'attributes':_0x99d67b[_0xa831('0x22')],'include':_0x99d67b[_0xa831('0x24')]?_['map'](_0x99d67b[_0xa831('0x24')],function(_0x1deba6){return{'model':db[_0x1deba6['model']],'as':_0x1deba6['as'],'attributes':_0x1deba6['attributes'],'include':_0x1deba6['include']?_['map'](_0x1deba6[_0xa831('0x24')],function(_0x407e77){return{'model':db[_0x407e77[_0xa831('0x25')]],'as':_0x407e77['as'],'attributes':_0x407e77[_0xa831('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f5480){logger[_0xa831('0x13')]('GetMailAccount',_0x468cbc);logger[_0xa831('0x26')](_0xa831('0x1c'),_0x468cbc,JSON[_0xa831('0x16')](_0x5f5480));_0x4c00e4(_0x5f5480);})[_0xa831('0x1b')](function(_0x283705){logger['error'](_0xa831('0x1c'),_0x283705[_0xa831('0x19')],_0x468cbc);_0x313bba(_0x48b000[_0xa831('0x17')](0x1f4,_0x283705[_0xa831('0x19')]));});});};exports[_0xa831('0x27')]=function(_0x50ff73){var _0x21bb25=this;return new Promise(function(_0x332f1e,_0x173229){return db['MailAccount'][_0xa831('0x28')]({'raw':_0x50ff73[_0xa831('0x1f')]?_0x50ff73[_0xa831('0x1f')][_0xa831('0x20')]===undefined?!![]:![]:!![],'where':_0x50ff73[_0xa831('0x1f')]?_0x50ff73['options'][_0xa831('0x21')]||null:null,'attributes':_0x50ff73[_0xa831('0x1f')]?_0x50ff73['options'][_0xa831('0x22')]||null:null,'include':_0x50ff73[_0xa831('0x1f')]?_0x50ff73['options'][_0xa831('0x24')]?_[_0xa831('0x29')](_0x50ff73[_0xa831('0x1f')][_0xa831('0x24')],function(_0x4c7b45){return{'model':db[_0x4c7b45[_0xa831('0x25')]],'as':_0x4c7b45['as'],'attributes':_0x4c7b45[_0xa831('0x22')],'include':_0x4c7b45['include']?_[_0xa831('0x29')](_0x4c7b45['include'],function(_0x54e3d8){return{'model':db[_0x54e3d8[_0xa831('0x25')]],'as':_0x54e3d8['as'],'attributes':_0x54e3d8['attributes'],'include':_0x54e3d8['include']?_[_0xa831('0x29')](_0x54e3d8[_0xa831('0x24')],function(_0x30b4fc){return{'model':db[_0x30b4fc[_0xa831('0x25')]],'as':_0x30b4fc['as'],'attributes':_0x30b4fc[_0xa831('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58d2c6){logger[_0xa831('0x13')](_0xa831('0x27'),_0x50ff73);logger[_0xa831('0x26')](_0xa831('0x27'),_0x50ff73,JSON['stringify'](_0x58d2c6));_0x332f1e(_0x58d2c6);})[_0xa831('0x1b')](function(_0x1bacec){logger[_0xa831('0x17')]('ShowMailAccount',_0x1bacec['message'],_0x50ff73);_0x173229(_0x21bb25[_0xa831('0x17')](0x1f4,_0x1bacec[_0xa831('0x19')]));});});};exports['NotifyMailAccount']=function(_0x50afb7){var _0x1b6da0=this;return new Promise(function(_0x5b92cd,_0x331161){var _0x45280c={'body':_0x50afb7[_0xa831('0x2a')],'channel':'mail'};var _0x10460e=_[_0xa831('0x2b')](_[_0xa831('0x2c')](db[_0xa831('0x2d')][_0xa831('0x2e')]),[_0xa831('0x2f'),_0xa831('0x30'),_0xa831('0x31'),'ListId']);var _0xfde216=![];if(_0x50afb7[_0xa831('0x2a')]['id']){delete _0x50afb7[_0xa831('0x2a')]['id'];}if(_[_0xa831('0x32')](_0x50afb7[_0xa831('0x2a')][_0xa831('0x33')])){return _0x331161(_0x1b6da0[_0xa831('0x17')](0x1f4,_0xa831('0x34')));}if(_['isNil'](_0x50afb7[_0xa831('0x2a')][_0xa831('0x2a')])||_0x50afb7[_0xa831('0x2a')][_0xa831('0x2a')]===''){return _0x331161(_0x1b6da0[_0xa831('0x17')](0x1f4,_0xa831('0x35')));}if(_['isNil'](_0x50afb7[_0xa831('0x2a')][_0xa831('0x36')])){return _0x331161(_0x1b6da0[_0xa831('0x17')](0x1f4,_0xa831('0x37')+_0x10460e));}if(!_['includes'](_0x10460e,_0x50afb7[_0xa831('0x2a')][_0xa831('0x36')])){return _0x331161(_0x1b6da0['error'](0x1f4,_0xa831('0x38')+_0x10460e));}var _0xe81a6a={};_0xe81a6a[_0x50afb7[_0xa831('0x2a')][_0xa831('0x36')]]=_0x50afb7[_0xa831('0x2a')][_0xa831('0x33')];return db[_0xa831('0x1d')]['find']({'where':{'id':_0x50afb7[_0xa831('0x39')]['id']},'include':[{'model':db[_0xa831('0x3a')],'as':_0xa831('0x3b'),'include':[{'model':db[_0xa831('0x2d')],'as':'Contacts','where':_0xe81a6a,'limit':0x1,'order':[[_0xa831('0x30'),_0xa831('0x3c')]]}]},{'model':db[_0xa831('0x3d')],'as':_0xa831('0x3e')},{'model':db[_0xa831('0x3f')],'as':_0xa831('0x40')}]})[_0xa831('0x12')](function(_0x1016fb){if(_0x1016fb&&_0x1016fb[_0xa831('0x3b')]){var _0x15e6cd=_0x1016fb['get']({'plain':!![]});_0x45280c[_0xa831('0x39')]=_[_0xa831('0x41')](_0x15e6cd,['Applications',_0xa831('0x3b')]);_0x45280c['applications']=_0x15e6cd['Applications'];_0x45280c['list']=_0x15e6cd[_0xa831('0x3b')];_0x45280c[_0xa831('0x42')]=_[_0xa831('0x43')](_0x45280c[_0xa831('0x42')],[_0xa831('0x44')],['asc']);if(_0x45280c[_0xa831('0x39')]&&_0x45280c[_0xa831('0x39')][_0xa831('0x45')]){_0x45280c[_0xa831('0x42')]['push']({'id':0x0,'priority':_0x45280c[_0xa831('0x42')][_0xa831('0x46')]+0x1,'app':_0xa831('0x47'),'appdata':'autoclose','interval':_0xa831('0x48')});}if(_0x45280c[_0xa831('0x39')][_0xa831('0x3e')]){delete _0x45280c[_0xa831('0x39')][_0xa831('0x3e')];}if(_0x45280c['account'][_0xa831('0x3b')]){delete _0x45280c[_0xa831('0x39')][_0xa831('0x3b')];}if(_0x15e6cd[_0xa831('0x3b')][_0xa831('0x49')][_0xa831('0x46')]){return _0x15e6cd[_0xa831('0x3b')][_0xa831('0x49')][0x0];}var _0x4f4bcc=_[_0xa831('0xd')](_0x50afb7[_0xa831('0x2a')],{'firstName':_0x50afb7[_0xa831('0x2a')]['from'],'ListId':_0x15e6cd[_0xa831('0x4a')]});_0x4f4bcc[_0x50afb7['body'][_0xa831('0x36')]]=_0x50afb7[_0xa831('0x2a')]['from'];return db[_0xa831('0x2d')]['create'](_0x4f4bcc);}else{throw new Error(_0xa831('0x4b'));}})['then'](function(_0x196569){_0x45280c[_0xa831('0x4c')]=_0x196569;if(_0x196569){if(!_0x50afb7[_0xa831('0x2a')][_0xa831('0x19')][_0xa831('0x4d')]){_0x50afb7[_0xa831('0x2a')]['message']['messageId']=rs['generate']()+'\x20'+_0x50afb7[_0xa831('0x2a')]['message'][_0xa831('0x33')];}var _0x338de0={'ContactId':_0x196569['id'],'MailAccountId':_0x50afb7['account']['id'],'inReplyTo':_0x50afb7[_0xa831('0x2a')]['message']['messageId'],'to':_0x50afb7[_0xa831('0x2a')][_0xa831('0x19')]['from'],'cc':_0x50afb7[_0xa831('0x2a')][_0xa831('0x19')]['cc'],'subject':_0x50afb7[_0xa831('0x2a')]['message'][_0xa831('0x4e')],'attach':_0x50afb7[_0xa831('0x2a')]['message'][_0xa831('0x4f')],'lastMsgAt':moment()['format'](_0xa831('0x50')),'lastMsgDirection':'in'};return db[_0xa831('0x51')]['find']({'where':{'closed':![],'MailAccountId':_0x50afb7['account']['id']},'include':[{'model':db[_0xa831('0x52')],'as':_0xa831('0x53'),'attributes':['messageId'],'where':{'messageId':_0x50afb7[_0xa831('0x2a')][_0xa831('0x19')][_0xa831('0x54')]}}]})[_0xa831('0x12')](function(_0x25cc64){if(_0x25cc64){return[_0x25cc64,![]];}return db['MailInteraction'][_0xa831('0x55')](_0x338de0)[_0xa831('0x12')](function(_0x202cd6){return[_0x202cd6,!![]];});});}else{throw new Error(_0xa831('0x56'));}})[_0xa831('0x57')](function(_0x2ddaba,_0x446624){if(_0x2ddaba){_0xfde216=_0x446624;if(!_0x446624){return _0x2ddaba[_0xa831('0x58')]({'inReplyTo':_0x50afb7[_0xa831('0x2a')][_0xa831('0x19')][_0xa831('0x4d')],'to':_0x50afb7['body'][_0xa831('0x19')]['from'],'cc':_0x50afb7[_0xa831('0x2a')][_0xa831('0x19')]['cc'],'subject':_0x50afb7['body'][_0xa831('0x19')][_0xa831('0x4e')],'attach':_0x2ddaba['attach']?_0x2ddaba['attach']:_0x50afb7['body'][_0xa831('0x19')][_0xa831('0x4f')],'substatus':null,'substatusAt':moment()[_0xa831('0x59')](_0xa831('0x50')),'lastMsgAt':moment()[_0xa831('0x59')](_0xa831('0x50')),'lastMsgDirection':'in'});}else{return _0x2ddaba;}}})['then'](function(_0x515b05){_0x45280c[_0xa831('0x5a')]=_0x515b05[_0xa831('0x5b')]({'plain':!![]});_0x45280c[_0xa831('0x5a')]['created']=_0xfde216;return db[_0xa831('0x52')]['create']({'body':_0x50afb7[_0xa831('0x2a')][_0xa831('0x2a')],'MailAccountId':_0x50afb7[_0xa831('0x39')]['id'],'MailInteractionId':_0x515b05['id'],'direction':'in','ContactId':_0x45280c[_0xa831('0x4c')]['id'],'messageId':_0x50afb7['body'][_0xa831('0x19')][_0xa831('0x4d')],'from':_0x50afb7[_0xa831('0x2a')][_0xa831('0x19')][_0xa831('0x33')],'to':_0x50afb7[_0xa831('0x2a')][_0xa831('0x19')]['to'],'cc':_0x50afb7[_0xa831('0x2a')]['message']['cc'],'subject':_0x50afb7['body'][_0xa831('0x19')][_0xa831('0x4e')],'attach':_0x50afb7[_0xa831('0x2a')][_0xa831('0x19')]['attach'],'Attachments':_0x50afb7[_0xa831('0x2a')]['message'][_0xa831('0x5c')],'originTo':_0x50afb7[_0xa831('0x2a')][_0xa831('0x19')]['originTo'],'originCc':_0x50afb7['body'][_0xa831('0x19')][_0xa831('0x5d')],'bcc':_0x50afb7[_0xa831('0x2a')][_0xa831('0x19')]['bcc'],'ChatWebsiteId':_0x50afb7[_0xa831('0x2a')]['message']['ChatWebsiteId']||null,'originChannel':_0x50afb7[_0xa831('0x2a')][_0xa831('0x19')][_0xa831('0x5e')]||'Email','ChatOfflineMessageId':_0x50afb7[_0xa831('0x2a')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xa831('0x5f')],'as':_0xa831('0x60')}]});})[_0xa831('0x12')](function(_0x2fd015){_0x45280c[_0xa831('0x19')]=_0x2fd015;if(_0x45280c[_0xa831('0x5a')][_0xa831('0x61')]){return db[_0xa831('0x62')]['find']({'attributes':['id',_0xa831('0x63')],'where':{'id':_0x45280c['interaction'][_0xa831('0x61')]}})[_0xa831('0x12')](function(_0xb90743){if(_0xb90743){_0x45280c['applications'][_0xa831('0x64')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xb90743[_0xa831('0x63')]+','+(_0x45280c[_0xa831('0x39')]['waitForTheAssignedAgent']||0xa),'interval':_0xa831('0x48')});}return respondWithRpcPromise(_0xa831('0x65'),'startRouting',_0x45280c);});}return respondWithRpcPromise('Start',_0xa831('0x66'),_0x45280c);})[_0xa831('0x12')](function(_0x2e877d){_0x5b92cd(_0x2e877d);})['catch'](function(_0x15c9ad){_0x331161(_0x1b6da0[_0xa831('0x17')](0x1f4,_0x15c9ad[_0xa831('0x19')]));});});}; \ No newline at end of file +var _0x2181=['generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','spread','update','format','get','interaction','created','attachments','originTo','originCc','bcc','ChatOfflineMessageId','Attachment','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','request\x20sent','stringify','error','message','MailAccount,\x20%s,\x20%s','info','result','catch','GetMailAccount','findAll','options','where','attributes','limit','include','map','model','debug','ShowMailAccount','MailAccount','find','NotifyMailAccount','body','mail','difference','CmContact','rawAttributes','createdAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','account','omit','applications','list','orderBy','asc','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x2181,0x80));var _0x1218=function(_0x4410df,_0x4cac68){_0x4410df=_0x4410df-0x0;var _0x5cfbcc=_0x2181[_0x4410df];return _0x5cfbcc;};'use strict';var _=require(_0x1218('0x0'));var util=require(_0x1218('0x1'));var moment=require(_0x1218('0x2'));var BPromise=require(_0x1218('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1218('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1218('0x5'))(_0x1218('0x6'));var config=require('../../config/environment');var jayson=require(_0x1218('0x7'));var client=jayson[_0x1218('0x8')][_0x1218('0x9')]({'port':0x232c});config[_0x1218('0xa')]=_[_0x1218('0xb')](config[_0x1218('0xa')],{'host':_0x1218('0xc'),'port':0x18eb});var socket=require(_0x1218('0xd'))(new Redis(config[_0x1218('0xa')]));require(_0x1218('0xe'))['register'](socket);function respondWithRpcPromise(_0x2da3e6,_0x1cb29b,_0x275994){return new BPromise(function(_0x48fdf7,_0x72dc1a){return client[_0x1218('0xf')](_0x2da3e6,_0x275994)[_0x1218('0x10')](function(_0x52bc99){logger['info']('MailAccount,\x20%s,\x20%s',_0x1cb29b,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x1cb29b,_0x1218('0x11'),JSON[_0x1218('0x12')](_0x52bc99));if(_0x52bc99[_0x1218('0x13')]){if(_0x52bc99[_0x1218('0x13')]['code']===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x1cb29b,_0x52bc99['error'][_0x1218('0x14')]);return _0x72dc1a(_0x52bc99[_0x1218('0x13')][_0x1218('0x14')]);}logger[_0x1218('0x13')](_0x1218('0x15'),_0x1cb29b,_0x52bc99['error'][_0x1218('0x14')]);return _0x48fdf7(_0x52bc99['error'][_0x1218('0x14')]);}else{logger[_0x1218('0x16')](_0x1218('0x15'),_0x1cb29b,_0x1218('0x11'));_0x48fdf7(_0x52bc99[_0x1218('0x17')][_0x1218('0x14')]);}})[_0x1218('0x18')](function(_0x3b670c){logger[_0x1218('0x13')](_0x1218('0x15'),_0x1cb29b,_0x3b670c);_0x72dc1a(_0x3b670c);});});}exports[_0x1218('0x19')]=function(_0x3a2a80){var _0x145375=this;return new Promise(function(_0x502913,_0x37192e){return db['MailAccount'][_0x1218('0x1a')]({'raw':_0x3a2a80['options']?_0x3a2a80['options']['raw']===undefined?!![]:![]:!![],'where':_0x3a2a80[_0x1218('0x1b')]?_0x3a2a80[_0x1218('0x1b')][_0x1218('0x1c')]||null:null,'attributes':_0x3a2a80[_0x1218('0x1b')]?_0x3a2a80[_0x1218('0x1b')][_0x1218('0x1d')]||null:null,'limit':_0x3a2a80[_0x1218('0x1b')]?_0x3a2a80['options'][_0x1218('0x1e')]||null:null,'include':_0x3a2a80[_0x1218('0x1b')]?_0x3a2a80['options'][_0x1218('0x1f')]?_[_0x1218('0x20')](_0x3a2a80['options'][_0x1218('0x1f')],function(_0x19da0b){return{'model':db[_0x19da0b[_0x1218('0x21')]],'as':_0x19da0b['as'],'attributes':_0x19da0b[_0x1218('0x1d')],'include':_0x19da0b['include']?_['map'](_0x19da0b[_0x1218('0x1f')],function(_0x3767f6){return{'model':db[_0x3767f6[_0x1218('0x21')]],'as':_0x3767f6['as'],'attributes':_0x3767f6['attributes'],'include':_0x3767f6[_0x1218('0x1f')]?_[_0x1218('0x20')](_0x3767f6[_0x1218('0x1f')],function(_0x4a0151){return{'model':db[_0x4a0151[_0x1218('0x21')]],'as':_0x4a0151['as'],'attributes':_0x4a0151[_0x1218('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x231b11){logger[_0x1218('0x16')](_0x1218('0x19'),_0x3a2a80);logger[_0x1218('0x22')]('GetMailAccount',_0x3a2a80,JSON[_0x1218('0x12')](_0x231b11));_0x502913(_0x231b11);})['catch'](function(_0x2872fe){logger[_0x1218('0x13')](_0x1218('0x19'),_0x2872fe[_0x1218('0x14')],_0x3a2a80);_0x37192e(_0x145375[_0x1218('0x13')](0x1f4,_0x2872fe[_0x1218('0x14')]));});});};exports[_0x1218('0x23')]=function(_0x3170f1){var _0x436e75=this;return new Promise(function(_0xaa5c58,_0x273594){return db[_0x1218('0x24')][_0x1218('0x25')]({'raw':_0x3170f1[_0x1218('0x1b')]?_0x3170f1[_0x1218('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3170f1[_0x1218('0x1b')]?_0x3170f1['options'][_0x1218('0x1c')]||null:null,'attributes':_0x3170f1['options']?_0x3170f1['options']['attributes']||null:null,'include':_0x3170f1['options']?_0x3170f1['options'][_0x1218('0x1f')]?_[_0x1218('0x20')](_0x3170f1[_0x1218('0x1b')][_0x1218('0x1f')],function(_0x29304e){return{'model':db[_0x29304e[_0x1218('0x21')]],'as':_0x29304e['as'],'attributes':_0x29304e[_0x1218('0x1d')],'include':_0x29304e['include']?_[_0x1218('0x20')](_0x29304e[_0x1218('0x1f')],function(_0x50e6cc){return{'model':db[_0x50e6cc[_0x1218('0x21')]],'as':_0x50e6cc['as'],'attributes':_0x50e6cc[_0x1218('0x1d')],'include':_0x50e6cc[_0x1218('0x1f')]?_[_0x1218('0x20')](_0x50e6cc[_0x1218('0x1f')],function(_0x136c96){return{'model':db[_0x136c96[_0x1218('0x21')]],'as':_0x136c96['as'],'attributes':_0x136c96[_0x1218('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1218('0x10')](function(_0x3adf18){logger[_0x1218('0x16')](_0x1218('0x23'),_0x3170f1);logger['debug']('ShowMailAccount',_0x3170f1,JSON['stringify'](_0x3adf18));_0xaa5c58(_0x3adf18);})[_0x1218('0x18')](function(_0xe01e05){logger['error'](_0x1218('0x23'),_0xe01e05[_0x1218('0x14')],_0x3170f1);_0x273594(_0x436e75['error'](0x1f4,_0xe01e05[_0x1218('0x14')]));});});};exports[_0x1218('0x26')]=function(_0x3eba8f){var _0x3eace6=this;return new Promise(function(_0x22e3c4,_0x1c296b){var _0x112868={'body':_0x3eba8f[_0x1218('0x27')],'channel':_0x1218('0x28')};var _0x4b87b2=_[_0x1218('0x29')](_['keys'](db[_0x1218('0x2a')][_0x1218('0x2b')]),[_0x1218('0x2c'),'updatedAt',_0x1218('0x2d'),'ListId']);var _0x2956e2=![];if(_0x3eba8f[_0x1218('0x27')]['id']){delete _0x3eba8f[_0x1218('0x27')]['id'];}if(_[_0x1218('0x2e')](_0x3eba8f['body'][_0x1218('0x2f')])){return _0x1c296b(_0x3eace6[_0x1218('0x13')](0x1f4,_0x1218('0x30')));}if(_[_0x1218('0x2e')](_0x3eba8f[_0x1218('0x27')][_0x1218('0x27')])||_0x3eba8f[_0x1218('0x27')]['body']===''){return _0x1c296b(_0x3eace6[_0x1218('0x13')](0x1f4,_0x1218('0x31')));}if(_[_0x1218('0x2e')](_0x3eba8f[_0x1218('0x27')][_0x1218('0x32')])){return _0x1c296b(_0x3eace6[_0x1218('0x13')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4b87b2));}if(!_[_0x1218('0x33')](_0x4b87b2,_0x3eba8f[_0x1218('0x27')][_0x1218('0x32')])){return _0x1c296b(_0x3eace6[_0x1218('0x13')](0x1f4,_0x1218('0x34')+_0x4b87b2));}var _0x57f987={};_0x57f987[_0x3eba8f['body'][_0x1218('0x32')]]=_0x3eba8f['body'][_0x1218('0x2f')];return db[_0x1218('0x24')][_0x1218('0x25')]({'where':{'id':_0x3eba8f['account']['id']},'include':[{'model':db[_0x1218('0x35')],'as':_0x1218('0x36'),'include':[{'model':db[_0x1218('0x2a')],'as':_0x1218('0x37'),'where':_0x57f987,'limit':0x1,'order':[[_0x1218('0x38'),_0x1218('0x39')]]}]},{'model':db[_0x1218('0x3a')],'as':_0x1218('0x3b')},{'model':db[_0x1218('0x3c')],'as':'Smtp'}]})[_0x1218('0x10')](function(_0x3db2bf){if(_0x3db2bf&&_0x3db2bf[_0x1218('0x36')]){var _0x377e91=_0x3db2bf['get']({'plain':!![]});_0x112868[_0x1218('0x3d')]=_[_0x1218('0x3e')](_0x377e91,['Applications',_0x1218('0x36')]);_0x112868[_0x1218('0x3f')]=_0x377e91[_0x1218('0x3b')];_0x112868[_0x1218('0x40')]=_0x377e91[_0x1218('0x36')];_0x112868[_0x1218('0x3f')]=_[_0x1218('0x41')](_0x112868[_0x1218('0x3f')],['priority'],[_0x1218('0x42')]);if(_0x112868[_0x1218('0x3d')]&&_0x112868[_0x1218('0x3d')][_0x1218('0x43')]){_0x112868['applications'][_0x1218('0x44')]({'id':0x0,'priority':_0x112868[_0x1218('0x3f')][_0x1218('0x45')]+0x1,'app':_0x1218('0x46'),'appdata':_0x1218('0x43'),'interval':_0x1218('0x47')});}if(_0x112868[_0x1218('0x3d')][_0x1218('0x3b')]){delete _0x112868[_0x1218('0x3d')][_0x1218('0x3b')];}if(_0x112868[_0x1218('0x3d')][_0x1218('0x36')]){delete _0x112868['account'][_0x1218('0x36')];}if(_0x377e91[_0x1218('0x36')]['Contacts'][_0x1218('0x45')]){return _0x377e91[_0x1218('0x36')][_0x1218('0x37')][0x0];}var _0x127bb7=_['defaults'](_0x3eba8f[_0x1218('0x27')],{'firstName':_0x3eba8f[_0x1218('0x27')][_0x1218('0x2f')],'ListId':_0x377e91['ListId']});_0x127bb7[_0x3eba8f['body'][_0x1218('0x32')]]=_0x3eba8f[_0x1218('0x27')][_0x1218('0x2f')];return db[_0x1218('0x2a')][_0x1218('0x48')](_0x127bb7);}else{throw new Error(_0x1218('0x49'));}})[_0x1218('0x10')](function(_0x2a4d1a){_0x112868[_0x1218('0x4a')]=_0x2a4d1a;if(_0x2a4d1a){if(!_0x3eba8f[_0x1218('0x27')]['message'][_0x1218('0x4b')]){_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')]['messageId']=rs[_0x1218('0x4c')]()+'\x20'+_0x3eba8f[_0x1218('0x27')]['message'][_0x1218('0x2f')];}var _0x38ef33={'ContactId':_0x2a4d1a['id'],'MailAccountId':_0x3eba8f[_0x1218('0x3d')]['id'],'inReplyTo':_0x3eba8f['body'][_0x1218('0x14')][_0x1218('0x4b')],'to':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x2f')],'cc':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')]['cc'],'subject':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x4d')],'attach':_0x3eba8f['body'][_0x1218('0x14')][_0x1218('0x4e')],'lastMsgAt':moment()['format'](_0x1218('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x1218('0x25')]({'where':{'closed':![],'MailAccountId':_0x3eba8f[_0x1218('0x3d')]['id']},'include':[{'model':db[_0x1218('0x50')],'as':_0x1218('0x51'),'attributes':['messageId'],'where':{'messageId':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x52')]}}]})[_0x1218('0x10')](function(_0x530736){if(_0x530736){return[_0x530736,![]];}return db['MailInteraction'][_0x1218('0x48')](_0x38ef33)[_0x1218('0x10')](function(_0xc78dbc){return[_0xc78dbc,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x1218('0x53')](function(_0xa02ad8,_0x2663ae){if(_0xa02ad8){_0x2956e2=_0x2663ae;if(!_0x2663ae){return _0xa02ad8[_0x1218('0x54')]({'inReplyTo':_0x3eba8f[_0x1218('0x27')]['message'][_0x1218('0x4b')],'to':_0x3eba8f['body'][_0x1218('0x14')][_0x1218('0x2f')],'cc':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')]['cc'],'subject':_0x3eba8f['body'][_0x1218('0x14')][_0x1218('0x4d')],'attach':_0xa02ad8[_0x1218('0x4e')]?_0xa02ad8['attach']:_0x3eba8f[_0x1218('0x27')]['message']['attach'],'substatus':null,'substatusAt':moment()[_0x1218('0x55')](_0x1218('0x4f')),'lastMsgAt':moment()[_0x1218('0x55')](_0x1218('0x4f')),'lastMsgDirection':'in'});}else{return _0xa02ad8;}}})[_0x1218('0x10')](function(_0x532885){_0x112868['interaction']=_0x532885[_0x1218('0x56')]({'plain':!![]});_0x112868[_0x1218('0x57')][_0x1218('0x58')]=_0x2956e2;return db[_0x1218('0x50')][_0x1218('0x48')]({'body':_0x3eba8f[_0x1218('0x27')][_0x1218('0x27')],'MailAccountId':_0x3eba8f[_0x1218('0x3d')]['id'],'MailInteractionId':_0x532885['id'],'direction':'in','ContactId':_0x112868[_0x1218('0x4a')]['id'],'messageId':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x4b')],'from':_0x3eba8f['body'][_0x1218('0x14')][_0x1218('0x2f')],'to':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')]['to'],'cc':_0x3eba8f['body'][_0x1218('0x14')]['cc'],'subject':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x4d')],'attach':_0x3eba8f[_0x1218('0x27')]['message'][_0x1218('0x4e')],'Attachments':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x59')],'originTo':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x5a')],'originCc':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x5b')],'bcc':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')][_0x1218('0x5c')],'ChatWebsiteId':_0x3eba8f['body'][_0x1218('0x14')]['ChatWebsiteId']||null,'originChannel':_0x3eba8f[_0x1218('0x27')][_0x1218('0x14')]['originChannel']||'Email','ChatOfflineMessageId':_0x3eba8f['body'][_0x1218('0x14')][_0x1218('0x5d')]||null},{'include':[{'model':db[_0x1218('0x5e')],'as':'Attachments'}]});})[_0x1218('0x10')](function(_0xb7c118){_0x112868['message']=_0xb7c118;if(_0x112868['interaction'][_0x1218('0x5f')]){return db[_0x1218('0x60')]['find']({'attributes':['id',_0x1218('0x61')],'where':{'id':_0x112868['interaction']['UserId']}})[_0x1218('0x10')](function(_0xcfe1b1){if(_0xcfe1b1){_0x112868[_0x1218('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1218('0x62'),'appdata':_0xcfe1b1[_0x1218('0x61')]+','+(_0x112868[_0x1218('0x3d')][_0x1218('0x63')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1218('0x64'),_0x1218('0x65'),_0x112868);});}return respondWithRpcPromise('Start','startRouting',_0x112868);})[_0x1218('0x10')](function(_0x38c311){_0x22e3c4(_0x38c311);})[_0x1218('0x18')](function(_0xad3685){_0x1c296b(_0x3eace6[_0x1218('0x13')](0x1f4,_0xad3685[_0x1218('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 472a660..c2f53e9 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 _0x66cd=['length','mailAccount:','./mailAccount.events','update','removeListener','register'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0x66cd,0x1b2));var _0xd66c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x66cd[_0x3947c9];return _0x2e7871;};'use strict';var MailAccountEvents=require(_0xd66c('0x0'));var events=['save','remove',_0xd66c('0x1')];function createListener(_0x8ed74,_0x245355){return function(_0x2a94b6){_0x245355['emit'](_0x8ed74,_0x2a94b6);};}function removeListener(_0x767b07,_0x2f0ea0){return function(){MailAccountEvents[_0xd66c('0x2')](_0x767b07,_0x2f0ea0);};}exports[_0xd66c('0x3')]=function(_0x189b20){for(var _0x534a9e=0x0,_0xf95135=events[_0xd66c('0x4')];_0x534a9e<_0xf95135;_0x534a9e++){var _0x10b229=events[_0x534a9e];var _0x26f8bd=createListener(_0xd66c('0x5')+_0x10b229,_0x189b20);MailAccountEvents['on'](_0x10b229,_0x26f8bd);}}; \ No newline at end of file +var _0xce9f=['emit','removeListener','register','length','mailAccount:','./mailAccount.events','save','remove','update'];(function(_0x33c637,_0x597c26){var _0x14aa20=function(_0x32a8b5){while(--_0x32a8b5){_0x33c637['push'](_0x33c637['shift']());}};_0x14aa20(++_0x597c26);}(_0xce9f,0x137));var _0xfce9=function(_0x5df533,_0x26ba22){_0x5df533=_0x5df533-0x0;var _0x4b283e=_0xce9f[_0x5df533];return _0x4b283e;};'use strict';var MailAccountEvents=require(_0xfce9('0x0'));var events=[_0xfce9('0x1'),_0xfce9('0x2'),_0xfce9('0x3')];function createListener(_0x4a3821,_0x13079a){return function(_0x3b2760){_0x13079a[_0xfce9('0x4')](_0x4a3821,_0x3b2760);};}function removeListener(_0x30b750,_0x38fa2c){return function(){MailAccountEvents[_0xfce9('0x5')](_0x30b750,_0x38fa2c);};}exports[_0xfce9('0x6')]=function(_0x5d4f0d){for(var _0x4af193=0x0,_0x3b95df=events[_0xfce9('0x7')];_0x4af193<_0x3b95df;_0x4af193++){var _0x5d04c9=events[_0x4af193];var _0x5a24ef=createListener(_0xfce9('0x8')+_0x5d04c9,_0x5d4f0d);MailAccountEvents['on'](_0x5d04c9,_0x5a24ef);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 144f798..6c38f1a 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 _0x9a49=['/:id','isAuthenticated','show','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x9a49,0x1e5));var _0x99a4=function(_0x11a192,_0x10ecb5){_0x11a192=_0x11a192-0x0;var _0x5546dc=_0x9a49[_0x11a192];return _0x5546dc;};'use strict';var multer=require(_0x99a4('0x0'));var util=require(_0x99a4('0x1'));var path=require(_0x99a4('0x2'));var timeout=require('connect-timeout');var express=require(_0x99a4('0x3'));var router=express[_0x99a4('0x4')]();var fs_extra=require(_0x99a4('0x5'));var auth=require(_0x99a4('0x6'));var interaction=require(_0x99a4('0x7'));var config=require(_0x99a4('0x8'));var controller=require(_0x99a4('0x9'));router['get'](_0x99a4('0xa'),auth[_0x99a4('0xb')](),controller[_0x99a4('0xc')]);router['put'](_0x99a4('0xa'),auth[_0x99a4('0xb')](),controller['update']);router['delete'](_0x99a4('0xa'),auth['isAuthenticated'](),controller[_0x99a4('0xd')]);module[_0x99a4('0xe')]=router; \ No newline at end of file +var _0x8293=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','path','express'];(function(_0x55e84d,_0xd42252){var _0x154dca=function(_0x316420){while(--_0x316420){_0x55e84d['push'](_0x55e84d['shift']());}};_0x154dca(++_0xd42252);}(_0x8293,0x1b7));var _0x3829=function(_0x28644f,_0x6f5392){_0x28644f=_0x28644f-0x0;var _0x253dc9=_0x8293[_0x28644f];return _0x253dc9;};'use strict';var multer=require('multer');var util=require(_0x3829('0x0'));var path=require(_0x3829('0x1'));var timeout=require('connect-timeout');var express=require(_0x3829('0x2'));var router=express[_0x3829('0x3')]();var fs_extra=require(_0x3829('0x4'));var auth=require(_0x3829('0x5'));var interaction=require(_0x3829('0x6'));var config=require('../../config/environment');var controller=require(_0x3829('0x7'));router[_0x3829('0x8')](_0x3829('0x9'),auth[_0x3829('0xa')](),controller[_0x3829('0xb')]);router[_0x3829('0xc')](_0x3829('0x9'),auth[_0x3829('0xa')](),controller[_0x3829('0xd')]);router[_0x3829('0xe')](_0x3829('0x9'),auth['isAuthenticated'](),controller[_0x3829('0xf')]);module[_0x3829('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index ef77977..07d0762 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 _0xc039=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xc039,0xb1));var _0x9c03=function(_0x284723,_0x5e8779){_0x284723=_0x284723-0x0;var _0xd7856=_0xc039[_0x284723];return _0xd7856;};'use strict';var Sequelize=require(_0x9c03('0x0'));module[_0x9c03('0x1')]={'priority':{'type':Sequelize[_0x9c03('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9c03('0x3')],'allowNull':![],'defaultValue':_0x9c03('0x4')},'appdata':{'type':Sequelize[_0x9c03('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9c03('0x3')],'defaultValue':_0x9c03('0x6')}}; \ No newline at end of file +var _0x65fa=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x65fa,0x1b0));var _0xa65f=function(_0x40ea20,_0x11010b){_0x40ea20=_0x40ea20-0x0;var _0xe5483d=_0x65fa[_0x40ea20];return _0xe5483d;};'use strict';var Sequelize=require(_0xa65f('0x0'));module[_0xa65f('0x1')]={'priority':{'type':Sequelize[_0xa65f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa65f('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa65f('0x4')]()},'description':{'type':Sequelize[_0xa65f('0x3')]},'interval':{'type':Sequelize[_0xa65f('0x3')],'defaultValue':_0xa65f('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 6bf76ad..a79c28f 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 _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x44c974,_0x1bcfde){var _0x5214c6=function(_0x10aad5){while(--_0x10aad5){_0x44c974['push'](_0x44c974['shift']());}};_0x5214c6(++_0x1bcfde);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2cefc5,_0x108d4e){_0x2cefc5=_0x2cefc5-0x0;var _0x5f39ce=_0xbdb7[_0x2cefc5];return _0x5f39ce;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file +var _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4b3661,_0x1be781){_0x4b3661=_0x4b3661-0x0;var _0x582d0c=_0xbdb7[_0x4b3661];return _0x582d0c;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 0951196..275be6b 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 _0x12b9=['moment','bluebird','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4f0827,_0x4ad955){var _0x1e82e6=function(_0xc442fe){while(--_0xc442fe){_0x4f0827['push'](_0x4f0827['shift']());}};_0x1e82e6(++_0x4ad955);}(_0x12b9,0x133));var _0x912b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x12b9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x912b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x912b('0x1'));var BPromise=require(_0x912b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x912b('0x3'));var rimraf=require(_0x912b('0x4'));var config=require(_0x912b('0x5'));var attributes=require(_0x912b('0x6'));module[_0x912b('0x7')]=function(_0x10560b,_0x4233aa){return _0x10560b[_0x912b('0x8')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x912b('0x9'),'collate':_0x912b('0xa')});}; \ No newline at end of file +var _0xe4d4=['rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3a023f,_0x3a0789){var _0x1de363=function(_0x239e8e){while(--_0x239e8e){_0x3a023f['push'](_0x3a023f['shift']());}};_0x1de363(++_0x3a0789);}(_0xe4d4,0x173));var _0x4e4d=function(_0x272238,_0x4598e4){_0x272238=_0x272238-0x0;var _0x5b898c=_0xe4d4[_0x272238];return _0x5b898c;};'use strict';var _=require(_0x4e4d('0x0'));var util=require(_0x4e4d('0x1'));var logger=require('../../config/logger')(_0x4e4d('0x2'));var moment=require(_0x4e4d('0x3'));var BPromise=require(_0x4e4d('0x4'));var rp=require(_0x4e4d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e4d('0x6'));var config=require(_0x4e4d('0x7'));var attributes=require(_0x4e4d('0x8'));module[_0x4e4d('0x9')]=function(_0x59294f,_0x28489d){return _0x59294f[_0x4e4d('0xa')](_0x4e4d('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4e4d('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 06954cc..69309e4 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 _0x66ef=['debug','stringify','error','message','info','result','catch','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','MailApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x66ef,0x145));var _0xf66e=function(_0x2b39fd,_0x3a2dab){_0x2b39fd=_0x2b39fd-0x0;var _0xe4b477=_0x66ef[_0x2b39fd];return _0xe4b477;};'use strict';var _=require(_0xf66e('0x0'));var util=require(_0xf66e('0x1'));var moment=require(_0xf66e('0x2'));var BPromise=require(_0xf66e('0x3'));var rs=require(_0xf66e('0x4'));var fs=require('fs');var Redis=require(_0xf66e('0x5'));var db=require(_0xf66e('0x6'))['db'];var utils=require(_0xf66e('0x7'));var logger=require(_0xf66e('0x8'))('rpc');var config=require(_0xf66e('0x9'));var jayson=require(_0xf66e('0xa'));var client=jayson[_0xf66e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18b573,_0x4d1eb3,_0xe3be99){return new BPromise(function(_0x37ebf6,_0x5ba682){return client[_0xf66e('0xc')](_0x18b573,_0xe3be99)[_0xf66e('0xd')](function(_0x365e98){logger['info'](_0xf66e('0xe'),_0x4d1eb3,_0xf66e('0xf'));logger[_0xf66e('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x4d1eb3,_0xf66e('0xf'),JSON[_0xf66e('0x11')](_0x365e98));if(_0x365e98['error']){if(_0x365e98[_0xf66e('0x12')]['code']===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x4d1eb3,_0x365e98[_0xf66e('0x12')][_0xf66e('0x13')]);return _0x5ba682(_0x365e98[_0xf66e('0x12')][_0xf66e('0x13')]);}logger[_0xf66e('0x12')](_0xf66e('0xe'),_0x4d1eb3,_0x365e98[_0xf66e('0x12')][_0xf66e('0x13')]);return _0x37ebf6(_0x365e98['error']['message']);}else{logger[_0xf66e('0x14')](_0xf66e('0xe'),_0x4d1eb3,_0xf66e('0xf'));_0x37ebf6(_0x365e98[_0xf66e('0x15')][_0xf66e('0x13')]);}})[_0xf66e('0x16')](function(_0x3ebfb9){logger[_0xf66e('0x12')](_0xf66e('0xe'),_0x4d1eb3,_0x3ebfb9);_0x5ba682(_0x3ebfb9);});});}exports[_0xf66e('0x17')]=function(_0x87eb3c){var _0x94e84b=this;return new Promise(function(_0x25107c,_0x41f0e5){return db[_0xf66e('0x18')]['update'](_0x87eb3c[_0xf66e('0x19')],{'raw':_0x87eb3c[_0xf66e('0x1a')]?_0x87eb3c[_0xf66e('0x1a')][_0xf66e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x87eb3c[_0xf66e('0x1a')]?_0x87eb3c[_0xf66e('0x1a')][_0xf66e('0x1c')]||null:null,'attributes':_0x87eb3c[_0xf66e('0x1a')]?_0x87eb3c['options'][_0xf66e('0x1d')]||null:null,'limit':_0x87eb3c[_0xf66e('0x1a')]?_0x87eb3c[_0xf66e('0x1a')][_0xf66e('0x1e')]||null:null})[_0xf66e('0xd')](function(_0x539892){logger[_0xf66e('0x14')]('UpdateMailApplication',_0x87eb3c);logger[_0xf66e('0x10')](_0xf66e('0x17'),_0x87eb3c,JSON[_0xf66e('0x11')](_0x539892));_0x25107c(_0x539892);})[_0xf66e('0x16')](function(_0x36bd23){logger[_0xf66e('0x12')](_0xf66e('0x17'),_0x36bd23['message'],_0x87eb3c);_0x41f0e5(_0x94e84b[_0xf66e('0x12')](0x1f4,_0x36bd23[_0xf66e('0x13')]));});});}; \ No newline at end of file +var _0x6743=['where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateMailApplication','MailApplication','update','body','raw','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6743,0xd0));var _0x3674=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x6743[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0x3674('0x0'));var util=require(_0x3674('0x1'));var moment=require(_0x3674('0x2'));var BPromise=require(_0x3674('0x3'));var rs=require(_0x3674('0x4'));var fs=require('fs');var Redis=require(_0x3674('0x5'));var db=require(_0x3674('0x6'))['db'];var utils=require(_0x3674('0x7'));var logger=require(_0x3674('0x8'))('rpc');var config=require(_0x3674('0x9'));var jayson=require(_0x3674('0xa'));var client=jayson[_0x3674('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3673b5,_0xe063ab,_0x46628){return new BPromise(function(_0xa634b2,_0x3382af){return client[_0x3674('0xc')](_0x3673b5,_0x46628)[_0x3674('0xd')](function(_0x2926d5){logger['info'](_0x3674('0xe'),_0xe063ab,_0x3674('0xf'));logger[_0x3674('0x10')](_0x3674('0x11'),_0xe063ab,_0x3674('0xf'),JSON[_0x3674('0x12')](_0x2926d5));if(_0x2926d5[_0x3674('0x13')]){if(_0x2926d5[_0x3674('0x13')][_0x3674('0x14')]===0x1f4){logger[_0x3674('0x13')](_0x3674('0xe'),_0xe063ab,_0x2926d5[_0x3674('0x13')][_0x3674('0x15')]);return _0x3382af(_0x2926d5[_0x3674('0x13')][_0x3674('0x15')]);}logger[_0x3674('0x13')]('MailApplication,\x20%s,\x20%s',_0xe063ab,_0x2926d5[_0x3674('0x13')][_0x3674('0x15')]);return _0xa634b2(_0x2926d5[_0x3674('0x13')][_0x3674('0x15')]);}else{logger[_0x3674('0x16')](_0x3674('0xe'),_0xe063ab,_0x3674('0xf'));_0xa634b2(_0x2926d5[_0x3674('0x17')][_0x3674('0x15')]);}})['catch'](function(_0x419649){logger['error']('MailApplication,\x20%s,\x20%s',_0xe063ab,_0x419649);_0x3382af(_0x419649);});});}exports[_0x3674('0x18')]=function(_0x633a88){var _0x1927b7=this;return new Promise(function(_0x58fe59,_0x37bcaa){return db[_0x3674('0x19')][_0x3674('0x1a')](_0x633a88[_0x3674('0x1b')],{'raw':_0x633a88['options']?_0x633a88['options'][_0x3674('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x633a88[_0x3674('0x1d')]?_0x633a88[_0x3674('0x1d')][_0x3674('0x1e')]||null:null,'attributes':_0x633a88[_0x3674('0x1d')]?_0x633a88[_0x3674('0x1d')][_0x3674('0x1f')]||null:null,'limit':_0x633a88[_0x3674('0x1d')]?_0x633a88[_0x3674('0x1d')][_0x3674('0x20')]||null:null})[_0x3674('0xd')](function(_0xec7d40){logger[_0x3674('0x16')]('UpdateMailApplication',_0x633a88);logger['debug'](_0x3674('0x18'),_0x633a88,JSON[_0x3674('0x12')](_0xec7d40));_0x58fe59(_0xec7d40);})[_0x3674('0x21')](function(_0x2b63b4){logger[_0x3674('0x13')](_0x3674('0x18'),_0x2b63b4[_0x3674('0x15')],_0x633a88);_0x37bcaa(_0x1927b7[_0x3674('0x13')](0x1f4,_0x2b63b4[_0x3674('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 315eca8..fef5f73 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 _0x2bc3=['get','isAuthenticated','index','describe','/:id','getMessages','download','post','/:id/messages','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','delete','destroy','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller'];(function(_0x2211d4,_0x592254){var _0x565b56=function(_0x576ba){while(--_0x576ba){_0x2211d4['push'](_0x2211d4['shift']());}};_0x565b56(++_0x592254);}(_0x2bc3,0xa4));var _0x32bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc3[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x32bc('0x0'));var router=express['Router']();var auth=require(_0x32bc('0x1'));var interaction=require(_0x32bc('0x2'));var controller=require(_0x32bc('0x3'));router[_0x32bc('0x4')]('/',auth[_0x32bc('0x5')](),controller[_0x32bc('0x6')]);router['get']('/describe',auth[_0x32bc('0x5')](),controller[_0x32bc('0x7')]);router[_0x32bc('0x4')](_0x32bc('0x8'),auth[_0x32bc('0x5')](),controller['show']);router[_0x32bc('0x4')]('/:id/messages',auth[_0x32bc('0x5')](),controller[_0x32bc('0x9')]);router['get']('/:id/download',auth[_0x32bc('0x5')](),controller[_0x32bc('0xa')]);router[_0x32bc('0xb')]('/',auth[_0x32bc('0x5')](),controller['create']);router['post'](_0x32bc('0xc'),auth[_0x32bc('0x5')](),controller['addMessage']);router[_0x32bc('0xb')](_0x32bc('0xd'),auth[_0x32bc('0x5')](),interaction[_0x32bc('0xe')](_0x32bc('0xf'),_0x32bc('0x10')),controller[_0x32bc('0x11')]);router[_0x32bc('0x12')](_0x32bc('0x8'),auth[_0x32bc('0x5')](),interaction['tracked'](_0x32bc('0xf'),'mailinteraction:update'),controller[_0x32bc('0x13')]);router[_0x32bc('0x14')]('/:id',auth[_0x32bc('0x5')](),interaction[_0x32bc('0xe')](_0x32bc('0xf'),'mailinteraction:destroy'),controller[_0x32bc('0x15')]);router['delete'](_0x32bc('0xd'),auth['isAuthenticated'](),controller[_0x32bc('0x16')]);module[_0x32bc('0x17')]=router; \ No newline at end of file +var _0x78c6=['post','create','addMessage','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download'];(function(_0xd15914,_0x25b6e9){var _0x276584=function(_0xf45666){while(--_0xf45666){_0xd15914['push'](_0xd15914['shift']());}};_0x276584(++_0x25b6e9);}(_0x78c6,0x1de));var _0x678c=function(_0x8d2071,_0x1092fb){_0x8d2071=_0x8d2071-0x0;var _0xe67f73=_0x78c6[_0x8d2071];return _0xe67f73;};'use strict';var express=require(_0x678c('0x0'));var router=express[_0x678c('0x1')]();var auth=require(_0x678c('0x2'));var interaction=require(_0x678c('0x3'));var controller=require(_0x678c('0x4'));router[_0x678c('0x5')]('/',auth[_0x678c('0x6')](),controller[_0x678c('0x7')]);router[_0x678c('0x5')](_0x678c('0x8'),auth[_0x678c('0x6')](),controller[_0x678c('0x9')]);router[_0x678c('0x5')](_0x678c('0xa'),auth[_0x678c('0x6')](),controller['show']);router[_0x678c('0x5')](_0x678c('0xb'),auth[_0x678c('0x6')](),controller[_0x678c('0xc')]);router[_0x678c('0x5')](_0x678c('0xd'),auth[_0x678c('0x6')](),controller[_0x678c('0xe')]);router[_0x678c('0xf')]('/',auth[_0x678c('0x6')](),controller[_0x678c('0x10')]);router['post'](_0x678c('0xb'),auth[_0x678c('0x6')](),controller[_0x678c('0x11')]);router[_0x678c('0xf')](_0x678c('0x12'),auth[_0x678c('0x6')](),interaction[_0x678c('0x13')](_0x678c('0x14'),'mailinteraction:addtags'),controller[_0x678c('0x15')]);router[_0x678c('0x16')](_0x678c('0xa'),auth[_0x678c('0x6')](),interaction['tracked'](_0x678c('0x14'),_0x678c('0x17')),controller[_0x678c('0x18')]);router[_0x678c('0x19')](_0x678c('0xa'),auth[_0x678c('0x6')](),interaction[_0x678c('0x13')](_0x678c('0x14'),_0x678c('0x1a')),controller['destroy']);router['delete'](_0x678c('0x12'),auth[_0x678c('0x6')](),controller[_0x678c('0x1b')]);module[_0x678c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 70cdb21..9f049c5 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 _0xb906=['BOOLEAN','DATE','STRING','TEXT','out','ENUM','iconv','exports'];(function(_0x4b2119,_0xaf829b){var _0x33d26e=function(_0x44ec50){while(--_0x44ec50){_0x4b2119['push'](_0x4b2119['shift']());}};_0x33d26e(++_0xaf829b);}(_0xb906,0x1a6));var _0x6b90=function(_0x2b9766,_0x1b4800){_0x2b9766=_0x2b9766-0x0;var _0x4c0a68=_0xb906[_0x2b9766];return _0x4c0a68;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x6b90('0x0'));module[_0x6b90('0x1')]={'closed':{'type':Sequelize[_0x6b90('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6b90('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6b90('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6b90('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x6b90('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x6b90('0x5')]('long')},'subject':{'type':Sequelize[_0x6b90('0x5')]()},'attach':{'type':Sequelize[_0x6b90('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6b90('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6b90('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6b90('0x7')]('in',_0x6b90('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb64d=['ENUM','out','sequelize','exports','BOOLEAN','STRING','long','TEXT','DATE'];(function(_0x477fa4,_0xff101a){var _0x5cbb9c=function(_0x172884){while(--_0x172884){_0x477fa4['push'](_0x477fa4['shift']());}};_0x5cbb9c(++_0xff101a);}(_0xb64d,0x122));var _0xdb64=function(_0x28ddd0,_0x3cf080){_0x28ddd0=_0x28ddd0-0x0;var _0x3ca689=_0xb64d[_0x28ddd0];return _0x3ca689;};'use strict';var Sequelize=require(_0xdb64('0x0'));var iconv=require('iconv');module[_0xdb64('0x1')]={'closed':{'type':Sequelize[_0xdb64('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xdb64('0x3')]},'thirdDisposition':{'type':Sequelize[_0xdb64('0x3')]},'note':{'type':Sequelize[_0xdb64('0x3')]},'inReplyTo':{'type':Sequelize[_0xdb64('0x3')](0x1fe)},'to':{'type':Sequelize[_0xdb64('0x3')]},'cc':{'type':Sequelize['TEXT'](_0xdb64('0x4'))},'subject':{'type':Sequelize[_0xdb64('0x5')]()},'attach':{'type':Sequelize[_0xdb64('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xdb64('0x6')]},'substatus':{'type':Sequelize[_0xdb64('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xdb64('0x7')]('in',_0xdb64('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xdb64('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 56c72de..fd5b63b 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 _0x83d0=['talking','answered','unmanaged','total','waiting','closed','UserId','index','MailInteraction','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.fullname','ui.MailInteractionId','from','u.id\x20=\x20ui.UserId','mail_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','some','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','SELECT','clone','i.id','t.id\x20IN\x20?','resolve','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','toString','sequelize','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.lastMsgAt','i.lastMsgDirection','i.secondDisposition','i.thirdDisposition','i.substatus','i.MailAccountId','i.UserId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','Setting','enableEmailPreview','rows','show','params','options','create','body','destroy','addMessage','ids','omit','rawAttributes','MailInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','inlineCss','true','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','Attachment','Messages','bcc','mkdirSync','each','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','Attachments','basename','existsSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','json','update','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','plainBody','-id','trimStart','catch'];(function(_0x1ad437,_0x2b36ea){var _0x14336c=function(_0x231663){while(--_0x231663){_0x1ad437['push'](_0x1ad437['shift']());}};_0x14336c(++_0x2b36ea);}(_0x83d0,0xb7));var _0x083d=function(_0x102961,_0x4e1c2b){_0x102961=_0x102961-0x0;var _0x10c6c1=_0x83d0[_0x102961];return _0x10c6c1;};'use strict';var emlformat=require(_0x083d('0x0'));var rimraf=require(_0x083d('0x1'));var zipdir=require(_0x083d('0x2'));var moment=require(_0x083d('0x3'));var BPromise=require(_0x083d('0x4'));var util=require(_0x083d('0x5'));var path=require('path');var fs=require('fs');var _=require(_0x083d('0x6'));var squel=require('squel');var juice=require('juice');var Redis=require(_0x083d('0x7'));var qs=require(_0x083d('0x8'));var as=require(_0x083d('0x9'));var logger=require(_0x083d('0xa'))(_0x083d('0xb'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x083d('0xc'));config[_0x083d('0xd')]=_[_0x083d('0xe')](config['redis'],{'host':_0x083d('0xf'),'port':0x18eb});var socket=require(_0x083d('0x10'))(new Redis(config[_0x083d('0xd')]));require(_0x083d('0x11'))['register'](socket);function respondWithStatusCode(_0x3473fa,_0x5be91f){_0x5be91f=_0x5be91f||0xcc;return function(_0x1a2155){if(_0x1a2155){return _0x3473fa[_0x083d('0x12')](_0x5be91f);}return _0x3473fa['status'](_0x5be91f)[_0x083d('0x13')]();};}function respondWithResult(_0x93be5c,_0x23ccf2){_0x23ccf2=_0x23ccf2||0xc8;return function(_0x3e5be5){if(_0x3e5be5){return _0x93be5c[_0x083d('0x14')](_0x23ccf2)['json'](_0x3e5be5);}};}function respondWithFilteredResult(_0xeb0ac2,_0x2266b2){return function(_0x4ee93c){if(_0x4ee93c){var _0x11c03f=typeof _0x2266b2['offset']==='undefined'&&typeof _0x2266b2[_0x083d('0x15')]===_0x083d('0x16');var _0x356d8e=_0x4ee93c[_0x083d('0x17')];var _0x381455=_0x11c03f?0x0:_0x2266b2['offset'];var _0x2ec521=_0x11c03f?_0x4ee93c['count']:_0x2266b2[_0x083d('0x18')]+_0x2266b2[_0x083d('0x15')];var _0x24708d;if(_0x2ec521>=_0x356d8e){_0x2ec521=_0x356d8e;_0x24708d=0xc8;}else{_0x24708d=0xce;}_0xeb0ac2[_0x083d('0x14')](_0x24708d);return _0xeb0ac2[_0x083d('0x19')](_0x083d('0x1a'),_0x381455+'-'+_0x2ec521+'/'+_0x356d8e)[_0x083d('0x1b')](_0x4ee93c);}return null;};}function saveUpdates(_0x3a3dd3){return function(_0x160afb){if(_0x160afb){return _0x160afb[_0x083d('0x1c')](_0x3a3dd3)[_0x083d('0x1d')](function(_0xb8a16f){return _0xb8a16f;});}return null;};}function removeEntity(_0x5dd1ba){return function(_0x24dd4e){if(_0x24dd4e){return _0x24dd4e['destroy']()[_0x083d('0x1d')](function(){_0x5dd1ba[_0x083d('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b2ba6){return function(_0x4bd7c2){if(!_0x4bd7c2){_0x2b2ba6['sendStatus'](0x194);}return _0x4bd7c2;};}function handleError(_0x59828a,_0xcde93c){_0xcde93c=_0xcde93c||0x1f4;return function(_0x32f1ba){logger[_0x083d('0x1e')](_0x32f1ba[_0x083d('0x1f')]);if(_0x32f1ba[_0x083d('0x20')]){delete _0x32f1ba[_0x083d('0x20')];}_0x59828a['status'](_0xcde93c)[_0x083d('0x21')](_0x32f1ba);};}function getInteractionUsers(_0x33f423,_0x5e6e43){return new BPromise(function(_0x3a0ce2,_0x38ca23){try{if(_0x5e6e43[_0x33f423['id']]){_0x33f423[_0x083d('0x22')]=_[_0x083d('0x23')](_0x5e6e43[_0x33f423['id']],function(_0x42a8f8){return{'id':_0x42a8f8['id'],'fullname':_0x42a8f8[_0x083d('0x24')]};});}}catch(_0x9bc640){_0x38ca23(_0x9bc640);}_0x3a0ce2(_0x33f423);});}function getInteractionTags(_0x3923ff,_0x552bc9){return new BPromise(function(_0x6bccbd,_0x50e5ae){try{if(_0x3923ff[_0x083d('0x25')]){_0x3923ff[_0x083d('0x26')]=[];_0x3923ff[_0x083d('0x25')][_0x083d('0x27')](',')[_0x083d('0x28')](function(_0x13c376){_0x3923ff[_0x083d('0x26')][_0x083d('0x29')](_0x552bc9[_0x13c376]);});}delete _0x3923ff[_0x083d('0x25')];}catch(_0x3f41a4){_0x50e5ae(_0x3f41a4);}_0x6bccbd(_0x3923ff);});}function getLastMessageText(_0x2d9202){return new BPromise(function(_0x24c32c,_0x4588df){return db[_0x083d('0x2a')][_0x083d('0x2b')]({'where':{'$and':[{'MailInteractionId':_0x2d9202['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x083d('0x2c')],'order':_0x083d('0x2d'),'raw':!![]})['then'](function(_0x4c971d){if(_0x4c971d&&_0x4c971d[_0x083d('0x2c')]){_0x2d9202['lastMsgText']=_[_0x083d('0x2e')](_0x4c971d['plainBody']);}_0x24c32c(_0x2d9202);})[_0x083d('0x2f')](function(_0x59f1d5){_0x4588df(_0x59f1d5);});});}function updateMailInteraction(_0x3a2c3d,_0x46d991,_0x3ab8cd,_0x5ae450){return new BPromise(function(_0x5e5e4e,_0x3563bf){return getInteractionUsers(_0x3a2c3d,_0x3ab8cd)['then'](function(_0x18d68c){return getInteractionTags(_0x18d68c,_0x46d991);})[_0x083d('0x1d')](function(_0x17a3e3){return getStateInteraction(_0x17a3e3);})[_0x083d('0x1d')](function(_0x4d76c7){if(_0x5ae450){_0x5e5e4e(getLastMessageText(_0x4d76c7));}else{_0x5e5e4e(_0x4d76c7);}})[_0x083d('0x2f')](function(_0x438957){_0x3563bf(_0x438957);});});}function getStateInteraction(_0x1cc755){return new BPromise(function(_0x30f4ad){_0x1cc755['waiting']=0x0;_0x1cc755[_0x083d('0x30')]=0x0;_0x1cc755[_0x083d('0x31')]=0x0;_0x1cc755[_0x083d('0x32')]=0x0;_0x1cc755[_0x083d('0x33')]=0x0;if(!_0x1cc755['closed']&&!_0x1cc755['UserId']){_0x1cc755[_0x083d('0x34')]+=0x1;}if(!_0x1cc755[_0x083d('0x35')]&&_0x1cc755[_0x083d('0x36')]){_0x1cc755[_0x083d('0x30')]+=0x1;if(_0x1cc755[_0x083d('0x34')]){_0x1cc755['waiting']-=0x1;}}if(_0x1cc755[_0x083d('0x35')]&&_0x1cc755[_0x083d('0x36')]){_0x1cc755['answered']+=0x1;if(_0x1cc755[_0x083d('0x30')]){_0x1cc755['talking']-=0x1;}}if(_0x1cc755['closed']&&!_0x1cc755[_0x083d('0x36')]){_0x1cc755[_0x083d('0x32')]+=0x1;if(_0x1cc755['waiting']){_0x1cc755[_0x083d('0x34')]-=0x1;}}_0x1cc755[_0x083d('0x33')]+=0x1;_0x30f4ad(_0x1cc755);});}exports[_0x083d('0x37')]=function(_0x594327,_0x5766d5){var _0x48e297={},_0x4b1268={},_0xbc94e8={'count':0x0,'rows':[]};var _0x417585=_[_0x083d('0x23')](db[_0x083d('0x38')]['rawAttributes'],function(_0x5ad9f2){return{'name':_0x5ad9f2[_0x083d('0x39')],'type':_0x5ad9f2['type'][_0x083d('0x3a')]};});_0x4b1268[_0x083d('0x3b')]=_[_0x083d('0x23')](_0x417585,_0x083d('0x20'));_0x4b1268[_0x083d('0x3c')]=_[_0x083d('0x3d')](_0x594327[_0x083d('0x3c')]);_0x4b1268[_0x083d('0x3e')]=_['intersection'](_0x4b1268[_0x083d('0x3b')],_0x4b1268[_0x083d('0x3c')]);_0x48e297[_0x083d('0x3f')]=_[_0x083d('0x40')](_0x4b1268[_0x083d('0x3b')],qs[_0x083d('0x41')](_0x594327[_0x083d('0x3c')]['fields']));_0x48e297[_0x083d('0x3f')]=_0x48e297[_0x083d('0x3f')]['length']?_0x48e297[_0x083d('0x3f')]:_0x4b1268[_0x083d('0x3b')];if(!_0x594327[_0x083d('0x3c')][_0x083d('0x42')](_0x083d('0x43'))){_0x48e297['limit']=qs[_0x083d('0x15')](_0x594327[_0x083d('0x3c')][_0x083d('0x15')]);_0x48e297[_0x083d('0x18')]=qs[_0x083d('0x18')](_0x594327['query'][_0x083d('0x18')]);}_0x48e297[_0x083d('0x44')]=qs[_0x083d('0x45')](_0x594327[_0x083d('0x3c')][_0x083d('0x45')]);_0x48e297[_0x083d('0x46')]=qs['filters'](_[_0x083d('0x47')](_0x594327[_0x083d('0x3c')],_0x4b1268[_0x083d('0x3e')]),_0x417585);var _0x1bdafc=[];var _0x19bdc0=squel[_0x083d('0x48')]()[_0x083d('0x49')]('id')['field']('name')['field'](_0x083d('0x4a'))['from'](_0x083d('0x4b'));var _0x42af7d=squel[_0x083d('0x48')]()[_0x083d('0x49')]('u.id')[_0x083d('0x49')](_0x083d('0x4c'))[_0x083d('0x49')](_0x083d('0x4d'))[_0x083d('0x4e')]('user_has_mail_interactions','ui')['left_join']('users','u',_0x083d('0x4f'));var _0x34ed6c=squel[_0x083d('0x48')]()[_0x083d('0x4e')](_0x083d('0x50'),'i')[_0x083d('0x51')](_0x083d('0x52'),'c',_0x083d('0x53'))[_0x083d('0x51')]('users','o','o.id\x20=\x20i.UserId')[_0x083d('0x51')]('mail_accounts','a',_0x083d('0x54'))[_0x083d('0x51')](_0x083d('0x55'),'me',_0x083d('0x56'))[_0x083d('0x51')]('mail_interaction_has_tags','it',_0x083d('0x57'))['left_join']('tools_tags','t',_0x083d('0x58'));var _0x1bdfe5=squel[_0x083d('0x59')]();var _0x4273b2=[];var _0x10db3e=squel[_0x083d('0x59')]();var _0xa7a4bd;if(_0x594327['query'][_0x083d('0x5a')]){_0xa7a4bd=as[_0x083d('0x5b')](_0x594327[_0x083d('0x3c')][_0x083d('0x5a')]);var _0x395350=_0xa7a4bd[_0x083d('0x5c')];for(var _0x912e1e=0x0;_0x912e1e<_0xa7a4bd[_0x083d('0x5d')]['length'];_0x912e1e++){var _0x16892c=_0xa7a4bd[_0x083d('0x5d')][_0x912e1e];var _0x1505f8='i';var _0x20472f=_[_0x083d('0x5e')](_0x417585,[_0x083d('0x20'),_0x16892c[_0x083d('0x49')]]);if(!_0x20472f){switch(_0x16892c[_0x083d('0x49')]){case _0x083d('0x5f'):if(_0x16892c[_0x083d('0x60')]==0x1){_0x34ed6c[_0x083d('0x61')]('`'+_0x16892c[_0x083d('0x49')]+_0x083d('0x62'));}else{_0x34ed6c['having']('`'+_0x16892c['field']+_0x083d('0x63'));}break;case _0x083d('0x64'):if(_0x16892c[_0x083d('0x65')]===_0x083d('0x66')){if(_0x16892c['value'][_0x083d('0x27')]('\x20')[_0x083d('0x67')]>0x1){_0x1bdfe5[_0x395350](_0x083d('0x68'),qs[_0x083d('0x69')](_0x16892c[_0x083d('0x60')]),null);}else{var _0x48c6b3='%'+_0x16892c['value']+'%';_0x1bdfe5[_0x395350](_0x083d('0x6a'),_0x48c6b3,_0x48c6b3,_0x48c6b3);}}else{_0x20472f=_[_0x083d('0x5e')](_0x417585,[_0x083d('0x20'),'ContactId']);_0x16892c[_0x083d('0x49')]=_0x083d('0x6b');_0x3d6af8=as['buildExpression'](_0x1505f8,_0x20472f[_0x083d('0x6c')],_0x16892c);_0x1bdfe5[_0x395350](_0x3d6af8[_0x083d('0x6d')],_0x3d6af8['value'][_0x083d('0x6e')],_0x3d6af8[_0x083d('0x60')]['end']);}break;case _0x083d('0x6f'):var _0x6e2328=_0x16892c['value']['split'](',')[_0x083d('0x23')](function(_0x24acf7){return Number(_0x24acf7);});_0x6e2328[_0x083d('0x28')](function(_0x1d5761){_0x10db3e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1d5761+',%');});_0x4273b2=_[_0x083d('0x70')](_0x4273b2,_0x6e2328);break;case _0x083d('0x71'):if(_0x16892c[_0x083d('0x65')]==='$substring'){_0x1bdfe5[_0x395350](_0x083d('0x72'),'%'+_0x16892c[_0x083d('0x60')]+'%',null);}else{_0x20472f=_[_0x083d('0x5e')](_0x417585,[_0x083d('0x20'),'UserId']);_0x16892c['field']=_0x083d('0x36');_0x3d6af8=as[_0x083d('0x73')](_0x1505f8,_0x20472f['type'],_0x16892c);_0x1bdfe5[_0x395350](_0x3d6af8[_0x083d('0x6d')],_0x3d6af8[_0x083d('0x60')][_0x083d('0x6e')],_0x3d6af8[_0x083d('0x60')][_0x083d('0x13')]);}break;case'plainBody':_0x3d6af8=as[_0x083d('0x73')]('me',null,_0x16892c);_0x1bdfe5[_0x395350](_0x3d6af8[_0x083d('0x6d')],_0x3d6af8[_0x083d('0x60')][_0x083d('0x6e')],_0x3d6af8[_0x083d('0x60')][_0x083d('0x13')]);break;}}else{var _0x3d6af8=as[_0x083d('0x73')](_0x1505f8,_0x20472f['type'],_0x16892c);_0x1bdfe5[_0x395350](_0x3d6af8[_0x083d('0x6d')],_0x3d6af8[_0x083d('0x60')][_0x083d('0x6e')],_0x3d6af8['value']['end']);}}}else{var _0x63eda5=_(_0x594327[_0x083d('0x3c')])[_0x083d('0x3d')]()[_0x083d('0x23')](function(_0x51db05){return _[_0x083d('0x74')](_0x417585,['name',_0x51db05])?_0x51db05:undefined;})['compact']()[_0x083d('0x60')]();if(!_[_0x083d('0x75')](_0x63eda5)){_0x63eda5[_0x083d('0x28')](function(_0x276ac1){if(_0x276ac1===_0x083d('0x76')){_0x34ed6c[_0x083d('0x46')](_0x083d('0x77'),[][_0x083d('0x78')](_0x594327[_0x083d('0x3c')][_0x276ac1]));}else if(_0x276ac1===_0x083d('0x79')){var _0x3b54a4=JSON['parse'](_0x594327[_0x083d('0x3c')][_0x276ac1])['$gte'];var _0x5ea764=JSON[_0x083d('0x7a')](_0x594327[_0x083d('0x3c')][_0x276ac1])[_0x083d('0x7b')];_0x34ed6c[_0x083d('0x46')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3b54a4,_0x5ea764);}else{if(_0x594327['query'][_0x276ac1]===_0x083d('0x7c')){_0x34ed6c[_0x083d('0x46')]('i.'+_0x276ac1+_0x083d('0x7d'));}else{_0x34ed6c['where']('i.'+_0x276ac1+_0x083d('0x7e'),_0x594327[_0x083d('0x3c')][_0x276ac1]);}}});}if(_0x594327['query'][_0x083d('0x7f')]){if(_0x594327[_0x083d('0x3c')][_0x083d('0x7f')]==0x1){_0x34ed6c[_0x083d('0x61')](_0x083d('0x80'));}else{_0x34ed6c[_0x083d('0x61')]('`unreadMessages`\x20>\x200');}}if(_0x594327[_0x083d('0x3c')]['tag']){_0x4273b2=_[_0x083d('0x81')](_0x594327['query']['tag'])?_0x594327[_0x083d('0x3c')]['tag']:new Array(_0x594327[_0x083d('0x3c')][_0x083d('0x82')]);_0x4273b2[_0x083d('0x28')](function(_0xa5d49d){_0x10db3e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xa5d49d+',%');});}if(_0x594327[_0x083d('0x3c')][_0x083d('0x83')]){var _0x154da6=_0x594327[_0x083d('0x3c')][_0x083d('0x83')][_0x083d('0x84')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x083d('0x85')](_0x154da6)){_0x1bdfe5['or'](_0x083d('0x86'),_0x154da6+'%');}else if(qs[_0x083d('0x87')](_0x154da6)){_0x1bdfe5['or']('c.email\x20LIKE\x20?',_0x154da6+'%');}else{_0x1bdfe5['or'](_0x083d('0x88'),qs[_0x083d('0x69')](_0x154da6))['or'](_0x083d('0x89'),qs[_0x083d('0x69')](_0x154da6));}}}_0x34ed6c[_0x083d('0x46')](_0x1bdfe5);_0x34ed6c[_0x083d('0x8a')]('i.id');var _0x24b593={'type':db[_0x083d('0x8b')]['QueryTypes'][_0x083d('0x8c')],'raw':!![]};var _0x347ea0=_0x34ed6c[_0x083d('0x8d')]();_0x347ea0['field'](_0x083d('0x8e'));_0x347ea0[_0x083d('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x083d('0x5f'));if(_0x48e297['order']){_0x48e297[_0x083d('0x44')][_0x083d('0x28')](function(_0x3997b8){var _0x38ac1f=_0x3997b8[0x0]==='contactName'?_0x3997b8[0x0]:'i.'+_0x3997b8[0x0];_0x34ed6c[_0x083d('0x44')](_0x38ac1f,_0x3997b8[0x1]==='DESC'?![]:!![]);});}if(!_[_0x083d('0x75')](_0x4273b2)){_0x34ed6c[_0x083d('0x61')](_0x10db3e);_0x347ea0['where'](_0x083d('0x8f'),_0x4273b2);}BPromise[_0x083d('0x90')]()[_0x083d('0x1d')](function(){if(!_0xa7a4bd){if(_0x594327[_0x083d('0x3c')]['MailAccountId'])return;_0x347ea0['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x34ed6c[_0x083d('0x46')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x594327[_0x083d('0x91')]['role']!==_0x083d('0x92'))return;return _0x594327[_0x083d('0x91')][_0x083d('0x93')]({'attributes':['id'],'raw':!![]})[_0x083d('0x1d')](function(_0x3b38ae){if(_[_0x083d('0x75')](_0x3b38ae)){_0x347ea0[_0x083d('0x46')](_0x083d('0x94'));_0x34ed6c['where'](_0x083d('0x94'));}else{_0x347ea0[_0x083d('0x46')]('i.MailAccountId\x20IN\x20?',_[_0x083d('0x23')](_0x3b38ae,'id'));_0x34ed6c[_0x083d('0x46')](_0x083d('0x77'),_[_0x083d('0x23')](_0x3b38ae,'id'));}});})[_0x083d('0x1d')](function(){if(_0x594327[_0x083d('0x91')]['role']===_0x083d('0x92')&&!_0xa7a4bd&&!_0x594327[_0x083d('0x3c')]['MailAccountId'])return[];return db['sequelize'][_0x083d('0x3c')](_0x347ea0[_0x083d('0x95')](),_0x24b593);})[_0x083d('0x1d')](function(_0x212473){_0xbc94e8['count']=_0x212473[_0x083d('0x67')];if(_0xbc94e8[_0x083d('0x17')]===0x0)return[];return db[_0x083d('0x96')][_0x083d('0x3c')](_0x19bdc0['toString'](),_0x24b593)['then'](function(_0x586a14){_0x1bdafc=_['keyBy'](_0x586a14,'id');_0x24b593=_[_0x083d('0x97')](_0x24b593,{'model':db[_0x083d('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x594327[_0x083d('0x3c')][_0x083d('0x41')]){_0x48e297[_0x083d('0x3f')][_0x083d('0x28')](function(_0x181a7a){_0x34ed6c[_0x083d('0x49')]('i.'+_0x181a7a);});}else{_0x34ed6c['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x083d('0x5f'));_0x34ed6c[_0x083d('0x49')](_0x083d('0x98'),_0x083d('0x99'));_0x34ed6c[_0x083d('0x49')](_0x083d('0x9a'),'Account.mandatoryDisposition');_0x34ed6c[_0x083d('0x49')](_0x083d('0x9b'),_0x083d('0x9c'));_0x34ed6c[_0x083d('0x49')](_0x083d('0x8e'));_0x34ed6c[_0x083d('0x49')](_0x083d('0x9d'));_0x34ed6c[_0x083d('0x49')](_0x083d('0x9e'));_0x34ed6c[_0x083d('0x49')](_0x083d('0x9f'));_0x34ed6c['field']('i.closedAt');_0x34ed6c[_0x083d('0x49')]('i.attach');_0x34ed6c[_0x083d('0x49')](_0x083d('0xa0'));_0x34ed6c[_0x083d('0x49')](_0x083d('0xa1'));_0x34ed6c['field']('i.subject');_0x34ed6c['field']('i.disposition');_0x34ed6c[_0x083d('0x49')](_0x083d('0xa2'));_0x34ed6c[_0x083d('0x49')](_0x083d('0xa3'));_0x34ed6c[_0x083d('0x49')](_0x083d('0xa4'));_0x34ed6c[_0x083d('0x49')]('i.to');_0x34ed6c[_0x083d('0x49')]('i.ContactId');_0x34ed6c[_0x083d('0x49')](_0x083d('0xa5'));_0x34ed6c[_0x083d('0x49')](_0x083d('0xa6'));_0x34ed6c['field']('c.firstName',_0x083d('0xa7'));_0x34ed6c[_0x083d('0x49')](_0x083d('0xa8'),_0x083d('0xa9'));_0x34ed6c['field'](_0x083d('0xaa'),_0x083d('0xab'));_0x34ed6c[_0x083d('0x49')]('c.phone','Contact.phone');_0x34ed6c[_0x083d('0x49')](_0x083d('0xac'),_0x083d('0xad'));_0x34ed6c[_0x083d('0x49')]('c.fax',_0x083d('0xae'));_0x34ed6c[_0x083d('0x49')](_0x083d('0xaf'),_0x083d('0xb0'));_0x34ed6c[_0x083d('0x49')](_0x083d('0xb1'),_0x083d('0xb2'));_0x34ed6c['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x083d('0x25'));}if(_0x48e297[_0x083d('0x15')])_0x34ed6c[_0x083d('0x15')](_0x48e297[_0x083d('0x15')]);if(_0x48e297[_0x083d('0x18')])_0x34ed6c[_0x083d('0x18')](_0x48e297['offset']);return db[_0x083d('0x96')][_0x083d('0x3c')](_0x34ed6c[_0x083d('0x95')](),_0x24b593);})[_0x083d('0x1d')](function(_0x23a718){if(_0x23a718[_0x083d('0x67')]>0x0)_0x42af7d[_0x083d('0x46')]('ui.MailInteractionId\x20IN\x20?',_[_0x083d('0x23')](_0x23a718,'id'));return db[_0x083d('0x96')]['query'](_0x42af7d[_0x083d('0x95')](),_0x24b593)[_0x083d('0x1d')](function(_0x1075c7){var _0x3bc174=_[_0x083d('0xb3')](_0x1075c7,'MailInteractionId');var _0x3d340d=[];return db[_0x083d('0xb4')]['findOne']({'attributes':[_0x083d('0xb5')],'raw':!![]})['then'](function(_0x2e43d7){var _0x2a01b4=_0x2e43d7[_0x083d('0xb5')];_0x23a718['forEach'](function(_0x3575df){_0x3d340d[_0x083d('0x29')](updateMailInteraction(_0x3575df,_0x1bdafc,_0x3bc174,_0x2a01b4));});return BPromise['all'](_0x3d340d);});});});})[_0x083d('0x1d')](function(_0x2918ce){_0xbc94e8[_0x083d('0xb6')]=_0x2918ce;return _0xbc94e8;})[_0x083d('0x1d')](respondWithFilteredResult(_0x5766d5,_0x48e297))[_0x083d('0x2f')](handleError(_0x5766d5,null));};exports[_0x083d('0xb7')]=function(_0x12c819,_0x2cc7e3){var _0x4f1aee={'raw':![],'where':{'id':_0x12c819[_0x083d('0xb8')]['id']}},_0x5554a0={};_0x5554a0[_0x083d('0x3b')]=_[_0x083d('0x3d')](db['MailInteraction']['rawAttributes']);_0x5554a0[_0x083d('0x3c')]=_['keys'](_0x12c819[_0x083d('0x3c')]);_0x5554a0['filters']=_['intersection'](_0x5554a0['model'],_0x5554a0[_0x083d('0x3c')]);_0x4f1aee[_0x083d('0x3f')]=_[_0x083d('0x40')](_0x5554a0['model'],qs[_0x083d('0x41')](_0x12c819[_0x083d('0x3c')]['fields']));_0x4f1aee[_0x083d('0x3f')]=_0x4f1aee['attributes'][_0x083d('0x67')]?_0x4f1aee[_0x083d('0x3f')]:_0x5554a0[_0x083d('0x3b')];if(_0x12c819['query']['includeAll']){_0x4f1aee['include']=[{'all':!![]}];}_0x4f1aee=_[_0x083d('0x97')]({},_0x4f1aee,_0x12c819[_0x083d('0xb9')]);return db[_0x083d('0x38')][_0x083d('0x5e')](_0x4f1aee)[_0x083d('0x1d')](handleEntityNotFound(_0x2cc7e3,null))[_0x083d('0x1d')](respondWithResult(_0x2cc7e3,null))[_0x083d('0x2f')](handleError(_0x2cc7e3,null));};exports[_0x083d('0xba')]=function(_0x46a46d,_0x1fca11){return db['MailInteraction'][_0x083d('0xba')](_0x46a46d[_0x083d('0xbb')],{})['then'](respondWithResult(_0x1fca11,0xc9))['catch'](handleError(_0x1fca11,null));};exports[_0x083d('0x1c')]=function(_0x3603d9,_0x2c5cc7){if(_0x3603d9[_0x083d('0xbb')]['id']){delete _0x3603d9[_0x083d('0xbb')]['id'];}return db[_0x083d('0x38')]['find']({'where':{'id':_0x3603d9['params']['id']}})[_0x083d('0x1d')](handleEntityNotFound(_0x2c5cc7,null))[_0x083d('0x1d')](saveUpdates(_0x3603d9[_0x083d('0xbb')],null))['then'](respondWithResult(_0x2c5cc7,null))[_0x083d('0x2f')](handleError(_0x2c5cc7,null));};exports[_0x083d('0xbc')]=function(_0x295574,_0x221d42){return db[_0x083d('0x38')][_0x083d('0x5e')]({'where':{'id':_0x295574[_0x083d('0xb8')]['id']}})['then'](handleEntityNotFound(_0x221d42,null))[_0x083d('0x1d')](removeEntity(_0x221d42,null))[_0x083d('0x2f')](handleError(_0x221d42,null));};exports['describe']=function(_0x45456e,_0x5bd5b9){return db[_0x083d('0x38')]['describe']()[_0x083d('0x1d')](respondWithResult(_0x5bd5b9,null))['catch'](handleError(_0x5bd5b9,null));};exports[_0x083d('0xbd')]=function(_0x5336b9,_0x3ced98){return db[_0x083d('0x2a')][_0x083d('0x5e')]({'where':{'id':_0x5336b9[_0x083d('0xb8')]['id']}})[_0x083d('0x1d')](handleEntityNotFound(_0x3ced98,null))['then'](function(_0x3aed94){if(_0x3aed94){return _0x3aed94[_0x083d('0xbd')](_0x5336b9['body'][_0x083d('0xbe')],_[_0x083d('0xbf')](_0x5336b9[_0x083d('0xbb')],['ids','id'])||{});}})[_0x083d('0x1d')](respondWithResult(_0x3ced98,null))[_0x083d('0x2f')](handleError(_0x3ced98,null));};exports['getMessages']=function(_0x8a8105,_0x1deffd){var _0x1e3427={'raw':![],'where':{}};var _0x2e7d58={};var _0x2f9741={'count':0x0,'rows':[]};return db['MailInteraction'][_0x083d('0x2b')]({'where':{'id':_0x8a8105['params']['id']}})[_0x083d('0x1d')](handleEntityNotFound(_0x1deffd,null))[_0x083d('0x1d')](function(_0x3b0c46){if(_0x3b0c46){_0x2e7d58[_0x083d('0x3b')]=_['keys'](db[_0x083d('0x2a')][_0x083d('0xc0')]);_0x2e7d58[_0x083d('0x3c')]=_[_0x083d('0x3d')](_0x8a8105[_0x083d('0x3c')]);_0x2e7d58[_0x083d('0x3e')]=_[_0x083d('0x40')](_0x2e7d58[_0x083d('0x3b')],_0x2e7d58[_0x083d('0x3c')]);_0x1e3427[_0x083d('0x3f')]=_[_0x083d('0x40')](_0x2e7d58[_0x083d('0x3b')],qs['fields'](_0x8a8105[_0x083d('0x3c')][_0x083d('0x41')]));_0x1e3427['attributes']=_0x1e3427[_0x083d('0x3f')][_0x083d('0x67')]?_0x1e3427['attributes']:_0x2e7d58[_0x083d('0x3b')];if(!_0x8a8105[_0x083d('0x3c')][_0x083d('0x42')]('nolimit')){_0x1e3427['limit']=qs[_0x083d('0x15')](_0x8a8105['query'][_0x083d('0x15')]);_0x1e3427[_0x083d('0x18')]=qs['offset'](_0x8a8105[_0x083d('0x3c')][_0x083d('0x18')]);}_0x1e3427[_0x083d('0x44')]=qs[_0x083d('0x45')](_0x8a8105[_0x083d('0x3c')][_0x083d('0x45')]);_0x1e3427[_0x083d('0x46')]=qs[_0x083d('0x3e')](_[_0x083d('0x47')](_0x8a8105[_0x083d('0x3c')],_0x2e7d58['filters']));_0x1e3427[_0x083d('0x46')][_0x083d('0xc1')]=_0x3b0c46['id'];if(_0x8a8105[_0x083d('0x3c')][_0x083d('0x83')]){_0x1e3427[_0x083d('0x46')]=_[_0x083d('0x97')](_0x1e3427[_0x083d('0x46')],{'$or':_['map'](_0x1e3427[_0x083d('0x3f')],function(_0x4d1a56){var _0x53c18c={};_0x53c18c[_0x4d1a56]={'$like':'%'+_0x8a8105[_0x083d('0x3c')]['filter']+'%'};return _0x53c18c;})});}if(_0x8a8105[_0x083d('0x3c')][_0x083d('0xc2')]){var _0xb8e3ae=_0x8a8105[_0x083d('0x3c')][_0x083d('0xc2')][_0x083d('0x27')](',');var _0x1584f1={};_0x1584f1[_0xb8e3ae[0x0]]={'$gte':moment(_0xb8e3ae[0x1])[_0x083d('0xc3')](_0x083d('0xc4'))};_0x1e3427['where']=_['merge'](_0x1e3427[_0x083d('0x46')],_0x1584f1);}_0x1e3427=_[_0x083d('0x97')]({},_0x1e3427,_0x8a8105[_0x083d('0xb9')]);return db[_0x083d('0x2a')][_0x083d('0x17')]({'where':_0x1e3427[_0x083d('0x46')]})[_0x083d('0x1d')](function(_0x48c7f2){_0x2f9741[_0x083d('0x17')]=_0x48c7f2;if(_0x8a8105[_0x083d('0x3c')][_0x083d('0xc5')]){_0x1e3427['include']=[{'all':!![]}];}return db[_0x083d('0x2a')][_0x083d('0xc6')](_0x1e3427);})['then'](function(_0x3db632){if(_0x8a8105[_0x083d('0x3c')][_0x083d('0xc7')]===_0x083d('0xc8')){for(var _0x38c181=0x0;_0x38c181<_0x3db632[_0x083d('0x67')];_0x38c181++){_0x3db632[_0x38c181][_0x083d('0xbb')]=juice(_0x3db632[_0x38c181]['body']);}}_0x2f9741['rows']=_0x3db632;return _0x2f9741;});}})['then'](respondWithFilteredResult(_0x1deffd,_0x1e3427))[_0x083d('0x2f')](handleError(_0x1deffd,null));};exports[_0x083d('0xc9')]=function(_0x464a39,_0xefb039){return db[_0x083d('0x38')][_0x083d('0x5e')]({'where':{'id':_0x464a39[_0x083d('0xb8')]['id']}})['then'](handleEntityNotFound(_0xefb039,null))[_0x083d('0x1d')](function(_0x337890){if(_0x337890){return _0x337890[_0x083d('0xca')](_0x464a39[_0x083d('0xbb')][_0x083d('0xbe')],_[_0x083d('0xbf')](_0x464a39['body'],[_0x083d('0xbe'),'id'])||{})[_0x083d('0xcb')](function(){return db[_0x083d('0x6f')]['findAll']({'attributes':['id','name',_0x083d('0x4a')],'where':{'id':_0x464a39[_0x083d('0xbb')]['ids']}});})['then'](function(_0x48ee79){socket[_0x083d('0xcc')](_0x083d('0xcd'),{'id':Number(_0x464a39[_0x083d('0xb8')]['id']),'tags':_0x48ee79||[]});return{'id':Number(_0x464a39[_0x083d('0xb8')]['id']),'tags':_0x48ee79||[]};});}})[_0x083d('0x1d')](respondWithResult(_0xefb039,null))[_0x083d('0x2f')](handleError(_0xefb039,null));};exports[_0x083d('0xce')]=function(_0xf8c2c0,_0x29e65a){return db[_0x083d('0x38')][_0x083d('0x5e')]({'where':{'id':_0xf8c2c0[_0x083d('0xb8')]['id']}})['then'](handleEntityNotFound(_0x29e65a,null))[_0x083d('0x1d')](function(_0x58fc22){if(_0x58fc22){return _0x58fc22['removeTags'](_0xf8c2c0['query'][_0x083d('0xbe')]);}})['then'](respondWithStatusCode(_0x29e65a,null))['catch'](handleError(_0x29e65a,null));};exports[_0x083d('0xcf')]=function(_0x546931,_0x2f30ae){var _0xdc0baf=moment()[_0x083d('0xd0')]()[_0x083d('0x95')]();var _0x489a84=path['join'](config[_0x083d('0xd1')],_0x083d('0xd2'),_0x083d('0xd3'),_0x083d('0xd4'));var _0x39d9a2=path[_0x083d('0xd5')](config[_0x083d('0xd1')],'server',_0x083d('0xd3'),'attachments');var _0x17a569=path[_0x083d('0xd5')](_0x489a84,_0xdc0baf);var _0x364036=util[_0x083d('0xc3')]('transcript-%d-%s.zip',_0x546931[_0x083d('0xb8')]['id'],_0xdc0baf);var _0x58077e=path['join'](_0x489a84,_0x364036);var _0x3edf16=[];if(_0x546931[_0x083d('0x3c')][_0x083d('0xd6')]){_0x3edf16[_0x083d('0x29')]({'model':db[_0x083d('0xd7')],'as':'Attachments','raw':!![]});}var _0x1f2ae6=[{'model':db[_0x083d('0x2a')],'as':_0x083d('0xd8'),'attributes':['id','body',_0x083d('0x4e'),'to','cc',_0x083d('0xd9'),'subject','createdAt'],'where':{'secret':![]},'order':qs[_0x083d('0x45')]('id'),'include':_0x3edf16}];return db[_0x083d('0x38')][_0x083d('0x5e')]({'where':{'id':_0x546931[_0x083d('0xb8')]['id']},'include':_0x1f2ae6})['then'](handleEntityNotFound(_0x2f30ae,null))[_0x083d('0x1d')](function(_0x1ddfcf){if(_0x1ddfcf&&_0x1ddfcf['Messages']){var _0x3700fb=_0x1ddfcf['get']({'plain':!![]});fs[_0x083d('0xda')](_0x17a569);return BPromise[_0x083d('0xdb')](_0x3700fb[_0x083d('0xd8')],function(_0x26d1c2,_0x444045){var _0xcdfc86={'from':_0x26d1c2[_0x083d('0x4e')],'to':_0x26d1c2['to'],'subject':_0x26d1c2[_0x083d('0xdc')],'html':htmlEntities[_0x083d('0xdd')](_0x26d1c2[_0x083d('0xbb')]),'headers':{'Date':moment(_0x26d1c2[_0x083d('0x79')])['format'](_0x083d('0xde'))},'attachments':[]};if(_0x26d1c2['cc']){_0xcdfc86['headers']['Cc']=_0x26d1c2['cc'];}if(_0x26d1c2[_0x083d('0xd9')]){_0xcdfc86['headers'][_0x083d('0xdf')]=_0x26d1c2[_0x083d('0xd9')];}return new BPromise(function(_0x509f34,_0x5d0315){if(_0x26d1c2[_0x083d('0xe0')]){for(var _0x4cd5db=0x0;_0x4cd5db<_0x26d1c2[_0x083d('0xe0')][_0x083d('0x67')];_0x4cd5db++){var _0x335523=_0x26d1c2['Attachments'][_0x4cd5db];var _0x8e6b98=path[_0x083d('0xd5')](_0x39d9a2,_0x335523[_0x083d('0xe1')]);if(fs[_0x083d('0xe2')](_0x8e6b98)){_0xcdfc86[_0x083d('0xd6')][_0x083d('0x29')]({'name':_0x335523['name'],'contentType':_0x335523[_0x083d('0x6c')],'data':fs['readFileSync'](_0x8e6b98)});}}}emlformat[_0x083d('0xe3')](_0xcdfc86,function(_0x3da861,_0x3beb7f){if(_0x3da861)return _0x5d0315(_0x3da861);fs[_0x083d('0xe4')](path['join'](_0x17a569,util[_0x083d('0xc3')](_0x083d('0xe5'),_0x444045)),_0x3beb7f);return _0x509f34(_0x3beb7f);});});})['then'](function(){return new BPromise(function(_0x1aa443,_0x9045cf){zipdir(_0x17a569,{'saveTo':_0x58077e},function(_0x2400fb,_0x43f335){if(_0x2400fb)return _0x9045cf(_0x2400fb);return _0x1aa443(_0x43f335);});})[_0x083d('0x1d')](function(){return new BPromise(function(_0x33a691,_0x45c9d9){rimraf(_0x17a569,function(_0x6ae77b){if(_0x6ae77b)_0x45c9d9(_0x6ae77b);return _0x33a691();});});})[_0x083d('0x1d')](function(){return _0x2f30ae[_0x083d('0xcf')](_0x58077e,_0x364036,function(_0x88235a){if(!_0x88235a)fs[_0x083d('0xe6')](_0x58077e);});});});}else{return _0x2f30ae['sendStatus'](0xc8);}})[_0x083d('0x2f')](handleError(_0x2f30ae,null));}; \ No newline at end of file +var _0x7e4b=['getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','i.createdAt','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','options','create','body','params','describe','ids','omit','getMessages','rawAttributes','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','inlineCss','true','spread','emit','mailInteractionTags:save','removeTags','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','get','mkdirSync','each','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','readFileSync','build','writeFileSync','message%d.eml','download','unlinkSync','eml-format','rimraf','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','end','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','-id','plainBody','trimStart','catch','waiting','talking','answered','total','closed','UserId','unmanaged','index','MailInteraction','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7e4b,0x84));var _0xb7e4=function(_0x2475f3,_0x57ce6c){_0x2475f3=_0x2475f3-0x0;var _0x3b9092=_0x7e4b[_0x2475f3];return _0x3b9092;};'use strict';var emlformat=require(_0xb7e4('0x0'));var rimraf=require(_0xb7e4('0x1'));var zipdir=require('zip-dir');var moment=require(_0xb7e4('0x2'));var BPromise=require(_0xb7e4('0x3'));var util=require('util');var path=require(_0xb7e4('0x4'));var fs=require('fs');var _=require(_0xb7e4('0x5'));var squel=require(_0xb7e4('0x6'));var juice=require(_0xb7e4('0x7'));var Redis=require(_0xb7e4('0x8'));var qs=require(_0xb7e4('0x9'));var as=require(_0xb7e4('0xa'));var logger=require(_0xb7e4('0xb'))(_0xb7e4('0xc'));var config=require('../../config/environment');var db=require(_0xb7e4('0xd'))['db'];var htmlEntities=require('html-entities');config[_0xb7e4('0xe')]=_[_0xb7e4('0xf')](config[_0xb7e4('0xe')],{'host':_0xb7e4('0x10'),'port':0x18eb});var socket=require(_0xb7e4('0x11'))(new Redis(config[_0xb7e4('0xe')]));require(_0xb7e4('0x12'))[_0xb7e4('0x13')](socket);function respondWithStatusCode(_0xd998a1,_0x4555ce){_0x4555ce=_0x4555ce||0xcc;return function(_0x3179b3){if(_0x3179b3){return _0xd998a1[_0xb7e4('0x14')](_0x4555ce);}return _0xd998a1[_0xb7e4('0x15')](_0x4555ce)['end']();};}function respondWithResult(_0x50466e,_0xb7fe30){_0xb7fe30=_0xb7fe30||0xc8;return function(_0x1b80aa){if(_0x1b80aa){return _0x50466e['status'](_0xb7fe30)[_0xb7e4('0x16')](_0x1b80aa);}};}function respondWithFilteredResult(_0x18fcb6,_0xc8a777){return function(_0xc2be7d){if(_0xc2be7d){var _0x2acf77=typeof _0xc8a777[_0xb7e4('0x17')]===_0xb7e4('0x18')&&typeof _0xc8a777[_0xb7e4('0x19')]===_0xb7e4('0x18');var _0x3600be=_0xc2be7d[_0xb7e4('0x1a')];var _0x983d60=_0x2acf77?0x0:_0xc8a777[_0xb7e4('0x17')];var _0x3a08f1=_0x2acf77?_0xc2be7d['count']:_0xc8a777[_0xb7e4('0x17')]+_0xc8a777[_0xb7e4('0x19')];var _0x2957da;if(_0x3a08f1>=_0x3600be){_0x3a08f1=_0x3600be;_0x2957da=0xc8;}else{_0x2957da=0xce;}_0x18fcb6[_0xb7e4('0x15')](_0x2957da);return _0x18fcb6[_0xb7e4('0x1b')](_0xb7e4('0x1c'),_0x983d60+'-'+_0x3a08f1+'/'+_0x3600be)[_0xb7e4('0x16')](_0xc2be7d);}return null;};}function saveUpdates(_0x23d919){return function(_0x48aaaf){if(_0x48aaaf){return _0x48aaaf[_0xb7e4('0x1d')](_0x23d919)['then'](function(_0x3385de){return _0x3385de;});}return null;};}function removeEntity(_0x45fa11){return function(_0x2857e3){if(_0x2857e3){return _0x2857e3[_0xb7e4('0x1e')]()[_0xb7e4('0x1f')](function(){_0x45fa11['status'](0xcc)[_0xb7e4('0x20')]();});}};}function handleEntityNotFound(_0x172329){return function(_0x3d4172){if(!_0x3d4172){_0x172329[_0xb7e4('0x14')](0x194);}return _0x3d4172;};}function handleError(_0x18e4fb,_0xba07f){_0xba07f=_0xba07f||0x1f4;return function(_0x58544e){logger[_0xb7e4('0x21')](_0x58544e[_0xb7e4('0x22')]);if(_0x58544e[_0xb7e4('0x23')]){delete _0x58544e[_0xb7e4('0x23')];}_0x18e4fb['status'](_0xba07f)[_0xb7e4('0x24')](_0x58544e);};}function getInteractionUsers(_0x3d2e88,_0x56d9cc){return new BPromise(function(_0x435816,_0xedb514){try{if(_0x56d9cc[_0x3d2e88['id']]){_0x3d2e88[_0xb7e4('0x25')]=_['map'](_0x56d9cc[_0x3d2e88['id']],function(_0x3d5198){return{'id':_0x3d5198['id'],'fullname':_0x3d5198[_0xb7e4('0x26')]};});}}catch(_0x4cff42){_0xedb514(_0x4cff42);}_0x435816(_0x3d2e88);});}function getInteractionTags(_0x29715c,_0x37421a){return new BPromise(function(_0x4f260f,_0x1a9d1c){try{if(_0x29715c[_0xb7e4('0x27')]){_0x29715c[_0xb7e4('0x28')]=[];_0x29715c['TagIds'][_0xb7e4('0x29')](',')[_0xb7e4('0x2a')](function(_0x248cc0){_0x29715c[_0xb7e4('0x28')][_0xb7e4('0x2b')](_0x37421a[_0x248cc0]);});}delete _0x29715c[_0xb7e4('0x27')];}catch(_0x2cd691){_0x1a9d1c(_0x2cd691);}_0x4f260f(_0x29715c);});}function getLastMessageText(_0x317297){return new BPromise(function(_0x914a18,_0x1f7436){return db[_0xb7e4('0x2c')][_0xb7e4('0x2d')]({'where':{'$and':[{'MailInteractionId':_0x317297['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xb7e4('0x2e')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xb7e4('0x2f'),'raw':!![]})[_0xb7e4('0x1f')](function(_0x3452b4){if(_0x3452b4&&_0x3452b4[_0xb7e4('0x30')]){_0x317297['lastMsgText']=_[_0xb7e4('0x31')](_0x3452b4[_0xb7e4('0x30')]);}_0x914a18(_0x317297);})[_0xb7e4('0x32')](function(_0x2287fc){_0x1f7436(_0x2287fc);});});}function updateMailInteraction(_0x7404b3,_0x490945,_0x1fe213,_0x4aea5d){return new BPromise(function(_0x787aa6,_0xffa6b4){return getInteractionUsers(_0x7404b3,_0x1fe213)[_0xb7e4('0x1f')](function(_0x2245a1){return getInteractionTags(_0x2245a1,_0x490945);})[_0xb7e4('0x1f')](function(_0x836f96){return getStateInteraction(_0x836f96);})[_0xb7e4('0x1f')](function(_0x38d510){if(_0x4aea5d){_0x787aa6(getLastMessageText(_0x38d510));}else{_0x787aa6(_0x38d510);}})[_0xb7e4('0x32')](function(_0x5ea49f){_0xffa6b4(_0x5ea49f);});});}function getStateInteraction(_0x2289bc){return new BPromise(function(_0x16c01f){_0x2289bc[_0xb7e4('0x33')]=0x0;_0x2289bc[_0xb7e4('0x34')]=0x0;_0x2289bc[_0xb7e4('0x35')]=0x0;_0x2289bc['unmanaged']=0x0;_0x2289bc[_0xb7e4('0x36')]=0x0;if(!_0x2289bc[_0xb7e4('0x37')]&&!_0x2289bc['UserId']){_0x2289bc[_0xb7e4('0x33')]+=0x1;}if(!_0x2289bc['closed']&&_0x2289bc['UserId']){_0x2289bc[_0xb7e4('0x34')]+=0x1;if(_0x2289bc[_0xb7e4('0x33')]){_0x2289bc['waiting']-=0x1;}}if(_0x2289bc[_0xb7e4('0x37')]&&_0x2289bc[_0xb7e4('0x38')]){_0x2289bc[_0xb7e4('0x35')]+=0x1;if(_0x2289bc[_0xb7e4('0x34')]){_0x2289bc[_0xb7e4('0x34')]-=0x1;}}if(_0x2289bc[_0xb7e4('0x37')]&&!_0x2289bc[_0xb7e4('0x38')]){_0x2289bc[_0xb7e4('0x39')]+=0x1;if(_0x2289bc['waiting']){_0x2289bc['waiting']-=0x1;}}_0x2289bc[_0xb7e4('0x36')]+=0x1;_0x16c01f(_0x2289bc);});}exports[_0xb7e4('0x3a')]=function(_0x2b2514,_0x4cf4ea){var _0x10dc8e={},_0x438028={},_0x540dab={'count':0x0,'rows':[]};var _0x46099b=_['map'](db[_0xb7e4('0x3b')]['rawAttributes'],function(_0x18f231){return{'name':_0x18f231[_0xb7e4('0x3c')],'type':_0x18f231[_0xb7e4('0x3d')][_0xb7e4('0x3e')]};});_0x438028['model']=_[_0xb7e4('0x3f')](_0x46099b,'name');_0x438028[_0xb7e4('0x40')]=_[_0xb7e4('0x41')](_0x2b2514['query']);_0x438028[_0xb7e4('0x42')]=_[_0xb7e4('0x43')](_0x438028[_0xb7e4('0x44')],_0x438028['query']);_0x10dc8e[_0xb7e4('0x45')]=_[_0xb7e4('0x43')](_0x438028['model'],qs[_0xb7e4('0x46')](_0x2b2514[_0xb7e4('0x40')]['fields']));_0x10dc8e[_0xb7e4('0x45')]=_0x10dc8e['attributes']['length']?_0x10dc8e[_0xb7e4('0x45')]:_0x438028[_0xb7e4('0x44')];if(!_0x2b2514['query'][_0xb7e4('0x47')](_0xb7e4('0x48'))){_0x10dc8e[_0xb7e4('0x19')]=qs[_0xb7e4('0x19')](_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x19')]);_0x10dc8e[_0xb7e4('0x17')]=qs['offset'](_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x17')]);}_0x10dc8e[_0xb7e4('0x49')]=qs[_0xb7e4('0x4a')](_0x2b2514['query'][_0xb7e4('0x4a')]);_0x10dc8e[_0xb7e4('0x4b')]=qs[_0xb7e4('0x42')](_[_0xb7e4('0x4c')](_0x2b2514[_0xb7e4('0x40')],_0x438028[_0xb7e4('0x42')]),_0x46099b);var _0x271a84=[];var _0x1a6720=squel[_0xb7e4('0x4d')]()[_0xb7e4('0x4e')]('id')[_0xb7e4('0x4e')](_0xb7e4('0x23'))[_0xb7e4('0x4e')](_0xb7e4('0x4f'))[_0xb7e4('0x50')]('tools_tags');var _0x10b657=squel[_0xb7e4('0x4d')]()[_0xb7e4('0x4e')](_0xb7e4('0x51'))[_0xb7e4('0x4e')](_0xb7e4('0x52'))[_0xb7e4('0x4e')]('ui.MailInteractionId')[_0xb7e4('0x50')]('user_has_mail_interactions','ui')[_0xb7e4('0x53')](_0xb7e4('0x54'),'u',_0xb7e4('0x55'));var _0x1f324d=squel['select']()[_0xb7e4('0x50')](_0xb7e4('0x56'),'i')[_0xb7e4('0x53')](_0xb7e4('0x57'),'c',_0xb7e4('0x58'))[_0xb7e4('0x53')]('users','o',_0xb7e4('0x59'))[_0xb7e4('0x53')](_0xb7e4('0x5a'),'a',_0xb7e4('0x5b'))[_0xb7e4('0x53')](_0xb7e4('0x5c'),'me',_0xb7e4('0x5d'))[_0xb7e4('0x53')]('mail_interaction_has_tags','it',_0xb7e4('0x5e'))[_0xb7e4('0x53')]('tools_tags','t',_0xb7e4('0x5f'));var _0x59708c=squel[_0xb7e4('0x60')]();var _0x3737f8=[];var _0x41b8b0=squel[_0xb7e4('0x60')]();var _0x2dc919;if(_0x2b2514['query'][_0xb7e4('0x61')]){_0x2dc919=as[_0xb7e4('0x62')](_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x61')]);var _0x47a367=_0x2dc919[_0xb7e4('0x63')];for(var _0x42a5cd=0x0;_0x42a5cd<_0x2dc919[_0xb7e4('0x64')][_0xb7e4('0x65')];_0x42a5cd++){var _0x3dbf14=_0x2dc919[_0xb7e4('0x64')][_0x42a5cd];var _0xeda5dd='i';var _0x169b29=_[_0xb7e4('0x66')](_0x46099b,[_0xb7e4('0x23'),_0x3dbf14['field']]);if(!_0x169b29){switch(_0x3dbf14['field']){case _0xb7e4('0x67'):if(_0x3dbf14[_0xb7e4('0x68')]==0x1){_0x1f324d[_0xb7e4('0x69')]('`'+_0x3dbf14[_0xb7e4('0x4e')]+'`\x20=\x200');}else{_0x1f324d['having']('`'+_0x3dbf14[_0xb7e4('0x4e')]+_0xb7e4('0x6a'));}break;case'Contact':if(_0x3dbf14[_0xb7e4('0x6b')]===_0xb7e4('0x6c')){if(_0x3dbf14[_0xb7e4('0x68')][_0xb7e4('0x29')]('\x20')[_0xb7e4('0x65')]>0x1){_0x59708c[_0x47a367](_0xb7e4('0x6d'),qs[_0xb7e4('0x6e')](_0x3dbf14['value']),null);}else{var _0x112d50='%'+_0x3dbf14[_0xb7e4('0x68')]+'%';_0x59708c[_0x47a367](_0xb7e4('0x6f'),_0x112d50,_0x112d50,_0x112d50);}}else{_0x169b29=_['find'](_0x46099b,[_0xb7e4('0x23'),_0xb7e4('0x70')]);_0x3dbf14[_0xb7e4('0x4e')]='ContactId';_0x6a7f93=as['buildExpression'](_0xeda5dd,_0x169b29[_0xb7e4('0x3d')],_0x3dbf14);_0x59708c[_0x47a367](_0x6a7f93[_0xb7e4('0x71')],_0x6a7f93[_0xb7e4('0x68')][_0xb7e4('0x72')],_0x6a7f93[_0xb7e4('0x68')]['end']);}break;case _0xb7e4('0x73'):var _0x499b40=_0x3dbf14[_0xb7e4('0x68')]['split'](',')[_0xb7e4('0x3f')](function(_0x9ee872){return Number(_0x9ee872);});_0x499b40[_0xb7e4('0x2a')](function(_0x161bad){_0x41b8b0['or'](_0xb7e4('0x74'),'%,'+_0x161bad+',%');});_0x3737f8=_[_0xb7e4('0x75')](_0x3737f8,_0x499b40);break;case _0xb7e4('0x76'):if(_0x3dbf14[_0xb7e4('0x6b')]===_0xb7e4('0x6c')){_0x59708c[_0x47a367](_0xb7e4('0x77'),'%'+_0x3dbf14[_0xb7e4('0x68')]+'%',null);}else{_0x169b29=_['find'](_0x46099b,[_0xb7e4('0x23'),_0xb7e4('0x38')]);_0x3dbf14[_0xb7e4('0x4e')]=_0xb7e4('0x38');_0x6a7f93=as[_0xb7e4('0x78')](_0xeda5dd,_0x169b29['type'],_0x3dbf14);_0x59708c[_0x47a367](_0x6a7f93[_0xb7e4('0x71')],_0x6a7f93[_0xb7e4('0x68')]['start'],_0x6a7f93[_0xb7e4('0x68')][_0xb7e4('0x20')]);}break;case _0xb7e4('0x30'):_0x6a7f93=as[_0xb7e4('0x78')]('me',null,_0x3dbf14);_0x59708c[_0x47a367](_0x6a7f93[_0xb7e4('0x71')],_0x6a7f93['value'][_0xb7e4('0x72')],_0x6a7f93[_0xb7e4('0x68')]['end']);break;}}else{var _0x6a7f93=as[_0xb7e4('0x78')](_0xeda5dd,_0x169b29[_0xb7e4('0x3d')],_0x3dbf14);_0x59708c[_0x47a367](_0x6a7f93[_0xb7e4('0x71')],_0x6a7f93[_0xb7e4('0x68')][_0xb7e4('0x72')],_0x6a7f93['value'][_0xb7e4('0x20')]);}}}else{var _0x1790e1=_(_0x2b2514[_0xb7e4('0x40')])[_0xb7e4('0x41')]()[_0xb7e4('0x3f')](function(_0x45f279){return _['some'](_0x46099b,[_0xb7e4('0x23'),_0x45f279])?_0x45f279:undefined;})[_0xb7e4('0x79')]()['value']();if(!_[_0xb7e4('0x7a')](_0x1790e1)){_0x1790e1[_0xb7e4('0x2a')](function(_0x2dd900){if(_0x2dd900===_0xb7e4('0x7b')){_0x1f324d['where'](_0xb7e4('0x7c'),[][_0xb7e4('0x7d')](_0x2b2514[_0xb7e4('0x40')][_0x2dd900]));}else if(_0x2dd900===_0xb7e4('0x7e')){var _0x1d39a3=JSON[_0xb7e4('0x7f')](_0x2b2514[_0xb7e4('0x40')][_0x2dd900])['$gte'];var _0x540388=JSON[_0xb7e4('0x7f')](_0x2b2514[_0xb7e4('0x40')][_0x2dd900])['$lte'];_0x1f324d[_0xb7e4('0x4b')](_0xb7e4('0x80'),_0x1d39a3,_0x540388);}else{if(_0x2b2514[_0xb7e4('0x40')][_0x2dd900]===_0xb7e4('0x81')){_0x1f324d[_0xb7e4('0x4b')]('i.'+_0x2dd900+'\x20IS\x20NULL');}else{_0x1f324d[_0xb7e4('0x4b')]('i.'+_0x2dd900+_0xb7e4('0x82'),_0x2b2514['query'][_0x2dd900]);}}});}if(_0x2b2514['query'][_0xb7e4('0x83')]){if(_0x2b2514[_0xb7e4('0x40')]['read']==0x1){_0x1f324d[_0xb7e4('0x69')](_0xb7e4('0x84'));}else{_0x1f324d['having'](_0xb7e4('0x85'));}}if(_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x86')]){_0x3737f8=_['isArray'](_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x86')])?_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x86')]:new Array(_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x86')]);_0x3737f8[_0xb7e4('0x2a')](function(_0x49b60c){_0x41b8b0['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x49b60c+',%');});}if(_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x87')]){var _0x552f2b=_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x87')][_0xb7e4('0x88')]('\x5c','\x5c\x5c')[_0xb7e4('0x88')](/'/g,'\x27\x27');if(qs[_0xb7e4('0x89')](_0x552f2b)){_0x59708c['or'](_0xb7e4('0x8a'),_0x552f2b+'%');}else if(qs[_0xb7e4('0x8b')](_0x552f2b)){_0x59708c['or']('c.email\x20LIKE\x20?',_0x552f2b+'%');}else{_0x59708c['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x552f2b))['or'](_0xb7e4('0x8c'),qs[_0xb7e4('0x6e')](_0x552f2b));}}}_0x1f324d[_0xb7e4('0x4b')](_0x59708c);_0x1f324d[_0xb7e4('0x8d')](_0xb7e4('0x8e'));var _0x15d423={'type':db[_0xb7e4('0x8f')][_0xb7e4('0x90')]['SELECT'],'raw':!![]};var _0x3058f7=_0x1f324d[_0xb7e4('0x91')]();_0x3058f7[_0xb7e4('0x4e')](_0xb7e4('0x8e'));_0x3058f7[_0xb7e4('0x4e')](_0xb7e4('0x92'),_0xb7e4('0x67'));if(_0x10dc8e['order']){_0x10dc8e[_0xb7e4('0x49')][_0xb7e4('0x2a')](function(_0x58a45a){var _0x3bf685=_0x58a45a[0x0]==='contactName'?_0x58a45a[0x0]:'i.'+_0x58a45a[0x0];_0x1f324d[_0xb7e4('0x49')](_0x3bf685,_0x58a45a[0x1]===_0xb7e4('0x93')?![]:!![]);});}if(!_[_0xb7e4('0x7a')](_0x3737f8)){_0x1f324d[_0xb7e4('0x69')](_0x41b8b0);_0x3058f7[_0xb7e4('0x4b')](_0xb7e4('0x94'),_0x3737f8);}BPromise['resolve']()[_0xb7e4('0x1f')](function(){if(!_0x2dc919){if(_0x2b2514[_0xb7e4('0x40')][_0xb7e4('0x7b')])return;_0x3058f7[_0xb7e4('0x4b')](_0xb7e4('0x95'));_0x1f324d[_0xb7e4('0x4b')](_0xb7e4('0x95'));return;}if(_0x2b2514[_0xb7e4('0x96')]['role']!==_0xb7e4('0x97'))return;return _0x2b2514['user'][_0xb7e4('0x98')]({'attributes':['id'],'raw':!![]})[_0xb7e4('0x1f')](function(_0x272b8d){if(_['isEmpty'](_0x272b8d)){_0x3058f7[_0xb7e4('0x4b')]('i.MailAccountId\x20IS\x20NULL');_0x1f324d[_0xb7e4('0x4b')](_0xb7e4('0x99'));}else{_0x3058f7[_0xb7e4('0x4b')](_0xb7e4('0x7c'),_[_0xb7e4('0x3f')](_0x272b8d,'id'));_0x1f324d[_0xb7e4('0x4b')](_0xb7e4('0x7c'),_['map'](_0x272b8d,'id'));}});})[_0xb7e4('0x1f')](function(){if(_0x2b2514[_0xb7e4('0x96')]['role']===_0xb7e4('0x97')&&!_0x2dc919&&!_0x2b2514[_0xb7e4('0x40')]['MailAccountId'])return[];return db['sequelize'][_0xb7e4('0x40')](_0x3058f7[_0xb7e4('0x9a')](),_0x15d423);})['then'](function(_0x150834){_0x540dab['count']=_0x150834[_0xb7e4('0x65')];if(_0x540dab[_0xb7e4('0x1a')]===0x0)return[];return db['sequelize'][_0xb7e4('0x40')](_0x1a6720[_0xb7e4('0x9a')](),_0x15d423)[_0xb7e4('0x1f')](function(_0x37ba22){_0x271a84=_[_0xb7e4('0x9b')](_0x37ba22,'id');_0x15d423=_[_0xb7e4('0x9c')](_0x15d423,{'model':db[_0xb7e4('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b2514['query']['fields']){_0x10dc8e[_0xb7e4('0x45')]['forEach'](function(_0x34ee6b){_0x1f324d[_0xb7e4('0x4e')]('i.'+_0x34ee6b);});}else{_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0x92'),_0xb7e4('0x67'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0x9d'),_0xb7e4('0x9e'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0x9f'),_0xb7e4('0xa0'));_0x1f324d['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xb7e4('0xa1'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0x8e'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xa2'));_0x1f324d['field']('i.updatedAt');_0x1f324d[_0xb7e4('0x4e')]('i.closed');_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xa3'));_0x1f324d['field'](_0xb7e4('0xa4'));_0x1f324d['field'](_0xb7e4('0xa5'));_0x1f324d[_0xb7e4('0x4e')]('i.lastMsgDirection');_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xa6'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xa7'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xa8'));_0x1f324d[_0xb7e4('0x4e')]('i.thirdDisposition');_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xa9'));_0x1f324d['field'](_0xb7e4('0xaa'));_0x1f324d['field'](_0xb7e4('0xab'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xac'));_0x1f324d[_0xb7e4('0x4e')]('i.UserId');_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xad'),_0xb7e4('0xae'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xaf'),_0xb7e4('0xb0'));_0x1f324d['field'](_0xb7e4('0xb1'),_0xb7e4('0xb2'));_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xb3'),_0xb7e4('0xb4'));_0x1f324d['field'](_0xb7e4('0xb5'),'Contact.mobile');_0x1f324d[_0xb7e4('0x4e')](_0xb7e4('0xb6'),_0xb7e4('0xb7'));_0x1f324d[_0xb7e4('0x4e')]('o.fullname',_0xb7e4('0xb8'));_0x1f324d[_0xb7e4('0x4e')]('o.internal',_0xb7e4('0xb9'));_0x1f324d['field'](_0xb7e4('0xba'),_0xb7e4('0x27'));}if(_0x10dc8e['limit'])_0x1f324d[_0xb7e4('0x19')](_0x10dc8e[_0xb7e4('0x19')]);if(_0x10dc8e[_0xb7e4('0x17')])_0x1f324d['offset'](_0x10dc8e[_0xb7e4('0x17')]);return db[_0xb7e4('0xbb')]['query'](_0x1f324d[_0xb7e4('0x9a')](),_0x15d423);})['then'](function(_0x27c2e9){if(_0x27c2e9[_0xb7e4('0x65')]>0x0)_0x10b657[_0xb7e4('0x4b')]('ui.MailInteractionId\x20IN\x20?',_['map'](_0x27c2e9,'id'));return db[_0xb7e4('0xbb')][_0xb7e4('0x40')](_0x10b657['toString'](),_0x15d423)[_0xb7e4('0x1f')](function(_0x4e67da){var _0x5cad96=_[_0xb7e4('0xbc')](_0x4e67da,_0xb7e4('0xbd'));var _0x34ea13=[];return db[_0xb7e4('0xbe')][_0xb7e4('0x2d')]({'attributes':[_0xb7e4('0xbf')],'raw':!![]})['then'](function(_0x159dd9){var _0x40491e=_0x159dd9[_0xb7e4('0xbf')];_0x27c2e9['forEach'](function(_0x277d36){_0x34ea13['push'](updateMailInteraction(_0x277d36,_0x271a84,_0x5cad96,_0x40491e));});return BPromise[_0xb7e4('0xc0')](_0x34ea13);});});});})['then'](function(_0x453b60){_0x540dab[_0xb7e4('0xc1')]=_0x453b60;return _0x540dab;})[_0xb7e4('0x1f')](respondWithFilteredResult(_0x4cf4ea,_0x10dc8e))[_0xb7e4('0x32')](handleError(_0x4cf4ea,null));};exports[_0xb7e4('0xc2')]=function(_0x2cf0d8,_0x271bba){var _0x29cc28={'raw':![],'where':{'id':_0x2cf0d8['params']['id']}},_0x477b85={};_0x477b85['model']=_[_0xb7e4('0x41')](db[_0xb7e4('0x3b')]['rawAttributes']);_0x477b85[_0xb7e4('0x40')]=_[_0xb7e4('0x41')](_0x2cf0d8[_0xb7e4('0x40')]);_0x477b85[_0xb7e4('0x42')]=_[_0xb7e4('0x43')](_0x477b85[_0xb7e4('0x44')],_0x477b85[_0xb7e4('0x40')]);_0x29cc28[_0xb7e4('0x45')]=_[_0xb7e4('0x43')](_0x477b85[_0xb7e4('0x44')],qs['fields'](_0x2cf0d8['query'][_0xb7e4('0x46')]));_0x29cc28['attributes']=_0x29cc28[_0xb7e4('0x45')]['length']?_0x29cc28[_0xb7e4('0x45')]:_0x477b85[_0xb7e4('0x44')];if(_0x2cf0d8[_0xb7e4('0x40')]['includeAll']){_0x29cc28['include']=[{'all':!![]}];}_0x29cc28=_[_0xb7e4('0x9c')]({},_0x29cc28,_0x2cf0d8[_0xb7e4('0xc3')]);return db[_0xb7e4('0x3b')][_0xb7e4('0x66')](_0x29cc28)[_0xb7e4('0x1f')](handleEntityNotFound(_0x271bba,null))[_0xb7e4('0x1f')](respondWithResult(_0x271bba,null))[_0xb7e4('0x32')](handleError(_0x271bba,null));};exports[_0xb7e4('0xc4')]=function(_0x306534,_0x1c3e09){return db['MailInteraction'][_0xb7e4('0xc4')](_0x306534['body'],{})[_0xb7e4('0x1f')](respondWithResult(_0x1c3e09,0xc9))[_0xb7e4('0x32')](handleError(_0x1c3e09,null));};exports[_0xb7e4('0x1d')]=function(_0x32e12a,_0x3e9a23){if(_0x32e12a[_0xb7e4('0xc5')]['id']){delete _0x32e12a[_0xb7e4('0xc5')]['id'];}return db[_0xb7e4('0x3b')]['find']({'where':{'id':_0x32e12a[_0xb7e4('0xc6')]['id']}})[_0xb7e4('0x1f')](handleEntityNotFound(_0x3e9a23,null))[_0xb7e4('0x1f')](saveUpdates(_0x32e12a[_0xb7e4('0xc5')],null))['then'](respondWithResult(_0x3e9a23,null))['catch'](handleError(_0x3e9a23,null));};exports[_0xb7e4('0x1e')]=function(_0x476178,_0x597e37){return db['MailInteraction'][_0xb7e4('0x66')]({'where':{'id':_0x476178[_0xb7e4('0xc6')]['id']}})['then'](handleEntityNotFound(_0x597e37,null))['then'](removeEntity(_0x597e37,null))[_0xb7e4('0x32')](handleError(_0x597e37,null));};exports[_0xb7e4('0xc7')]=function(_0x1f541b,_0x4c4185){return db[_0xb7e4('0x3b')][_0xb7e4('0xc7')]()[_0xb7e4('0x1f')](respondWithResult(_0x4c4185,null))[_0xb7e4('0x32')](handleError(_0x4c4185,null));};exports['addMessage']=function(_0x3252da,_0xe2a683){return db[_0xb7e4('0x2c')][_0xb7e4('0x66')]({'where':{'id':_0x3252da[_0xb7e4('0xc6')]['id']}})[_0xb7e4('0x1f')](handleEntityNotFound(_0xe2a683,null))['then'](function(_0x3d2e8b){if(_0x3d2e8b){return _0x3d2e8b['addMessage'](_0x3252da[_0xb7e4('0xc5')][_0xb7e4('0xc8')],_[_0xb7e4('0xc9')](_0x3252da['body'],[_0xb7e4('0xc8'),'id'])||{});}})[_0xb7e4('0x1f')](respondWithResult(_0xe2a683,null))['catch'](handleError(_0xe2a683,null));};exports[_0xb7e4('0xca')]=function(_0x550170,_0x1997bc){var _0x42928b={'raw':![],'where':{}};var _0x3ec88c={};var _0x2bcf5f={'count':0x0,'rows':[]};return db[_0xb7e4('0x3b')][_0xb7e4('0x2d')]({'where':{'id':_0x550170[_0xb7e4('0xc6')]['id']}})['then'](handleEntityNotFound(_0x1997bc,null))['then'](function(_0x13d80e){if(_0x13d80e){_0x3ec88c[_0xb7e4('0x44')]=_[_0xb7e4('0x41')](db[_0xb7e4('0x2c')][_0xb7e4('0xcb')]);_0x3ec88c[_0xb7e4('0x40')]=_[_0xb7e4('0x41')](_0x550170[_0xb7e4('0x40')]);_0x3ec88c[_0xb7e4('0x42')]=_['intersection'](_0x3ec88c['model'],_0x3ec88c['query']);_0x42928b[_0xb7e4('0x45')]=_[_0xb7e4('0x43')](_0x3ec88c[_0xb7e4('0x44')],qs[_0xb7e4('0x46')](_0x550170[_0xb7e4('0x40')][_0xb7e4('0x46')]));_0x42928b[_0xb7e4('0x45')]=_0x42928b['attributes']['length']?_0x42928b[_0xb7e4('0x45')]:_0x3ec88c['model'];if(!_0x550170[_0xb7e4('0x40')][_0xb7e4('0x47')](_0xb7e4('0x48'))){_0x42928b['limit']=qs[_0xb7e4('0x19')](_0x550170['query']['limit']);_0x42928b[_0xb7e4('0x17')]=qs[_0xb7e4('0x17')](_0x550170[_0xb7e4('0x40')][_0xb7e4('0x17')]);}_0x42928b[_0xb7e4('0x49')]=qs['sort'](_0x550170['query'][_0xb7e4('0x4a')]);_0x42928b[_0xb7e4('0x4b')]=qs[_0xb7e4('0x42')](_['pick'](_0x550170[_0xb7e4('0x40')],_0x3ec88c[_0xb7e4('0x42')]));_0x42928b[_0xb7e4('0x4b')]['MailInteractionId']=_0x13d80e['id'];if(_0x550170[_0xb7e4('0x40')][_0xb7e4('0x87')]){_0x42928b[_0xb7e4('0x4b')]=_[_0xb7e4('0x9c')](_0x42928b[_0xb7e4('0x4b')],{'$or':_['map'](_0x42928b[_0xb7e4('0x45')],function(_0x3da9a7){var _0x3e1625={};_0x3e1625[_0x3da9a7]={'$like':'%'+_0x550170[_0xb7e4('0x40')]['filter']+'%'};return _0x3e1625;})});}if(_0x550170[_0xb7e4('0x40')][_0xb7e4('0xcc')]){var _0x2cc578=_0x550170[_0xb7e4('0x40')]['$gte'][_0xb7e4('0x29')](',');var _0x380f5d={};_0x380f5d[_0x2cc578[0x0]]={'$gte':moment(_0x2cc578[0x1])[_0xb7e4('0xcd')](_0xb7e4('0xce'))};_0x42928b['where']=_[_0xb7e4('0x9c')](_0x42928b['where'],_0x380f5d);}_0x42928b=_[_0xb7e4('0x9c')]({},_0x42928b,_0x550170['options']);return db[_0xb7e4('0x2c')]['count']({'where':_0x42928b['where']})[_0xb7e4('0x1f')](function(_0x5268d4){_0x2bcf5f[_0xb7e4('0x1a')]=_0x5268d4;if(_0x550170['query'][_0xb7e4('0xcf')]){_0x42928b[_0xb7e4('0xd0')]=[{'all':!![]}];}return db[_0xb7e4('0x2c')][_0xb7e4('0xd1')](_0x42928b);})['then'](function(_0x1c0526){if(_0x550170['query'][_0xb7e4('0xd2')]===_0xb7e4('0xd3')){for(var _0x183b24=0x0;_0x183b24<_0x1c0526[_0xb7e4('0x65')];_0x183b24++){_0x1c0526[_0x183b24]['body']=juice(_0x1c0526[_0x183b24][_0xb7e4('0xc5')]);}}_0x2bcf5f[_0xb7e4('0xc1')]=_0x1c0526;return _0x2bcf5f;});}})['then'](respondWithFilteredResult(_0x1997bc,_0x42928b))['catch'](handleError(_0x1997bc,null));};exports['addTags']=function(_0x3bdfbe,_0x59968e){return db[_0xb7e4('0x3b')]['find']({'where':{'id':_0x3bdfbe[_0xb7e4('0xc6')]['id']}})[_0xb7e4('0x1f')](handleEntityNotFound(_0x59968e,null))[_0xb7e4('0x1f')](function(_0x23997c){if(_0x23997c){return _0x23997c['setTags'](_0x3bdfbe[_0xb7e4('0xc5')][_0xb7e4('0xc8')],_['omit'](_0x3bdfbe[_0xb7e4('0xc5')],[_0xb7e4('0xc8'),'id'])||{})[_0xb7e4('0xd4')](function(){return db[_0xb7e4('0x73')][_0xb7e4('0xd1')]({'attributes':['id','name',_0xb7e4('0x4f')],'where':{'id':_0x3bdfbe[_0xb7e4('0xc5')]['ids']}});})[_0xb7e4('0x1f')](function(_0x503a66){socket[_0xb7e4('0xd5')](_0xb7e4('0xd6'),{'id':Number(_0x3bdfbe[_0xb7e4('0xc6')]['id']),'tags':_0x503a66||[]});return{'id':Number(_0x3bdfbe[_0xb7e4('0xc6')]['id']),'tags':_0x503a66||[]};});}})[_0xb7e4('0x1f')](respondWithResult(_0x59968e,null))[_0xb7e4('0x32')](handleError(_0x59968e,null));};exports[_0xb7e4('0xd7')]=function(_0x323861,_0x35a0ec){return db['MailInteraction'][_0xb7e4('0x66')]({'where':{'id':_0x323861[_0xb7e4('0xc6')]['id']}})[_0xb7e4('0x1f')](handleEntityNotFound(_0x35a0ec,null))[_0xb7e4('0x1f')](function(_0x364ec7){if(_0x364ec7){return _0x364ec7['removeTags'](_0x323861[_0xb7e4('0x40')][_0xb7e4('0xc8')]);}})[_0xb7e4('0x1f')](respondWithStatusCode(_0x35a0ec,null))[_0xb7e4('0x32')](handleError(_0x35a0ec,null));};exports['download']=function(_0x53ee09,_0x1e24e2){var _0x1ae16d=moment()['unix']()[_0xb7e4('0x9a')]();var _0x4cf9aa=path[_0xb7e4('0xd8')](config[_0xb7e4('0xd9')],_0xb7e4('0xda'),_0xb7e4('0xdb'),_0xb7e4('0xdc'));var _0x5f0884=path['join'](config[_0xb7e4('0xd9')],_0xb7e4('0xda'),'files','attachments');var _0x89b0da=path[_0xb7e4('0xd8')](_0x4cf9aa,_0x1ae16d);var _0xc94235=util['format'](_0xb7e4('0xdd'),_0x53ee09[_0xb7e4('0xc6')]['id'],_0x1ae16d);var _0x304d49=path[_0xb7e4('0xd8')](_0x4cf9aa,_0xc94235);var _0x539440=[];if(_0x53ee09[_0xb7e4('0x40')][_0xb7e4('0xde')]){_0x539440[_0xb7e4('0x2b')]({'model':db[_0xb7e4('0xdf')],'as':_0xb7e4('0xe0'),'raw':!![]});}var _0x34acaa=[{'model':db[_0xb7e4('0x2c')],'as':_0xb7e4('0xe1'),'attributes':['id','body',_0xb7e4('0x50'),'to','cc','bcc','subject',_0xb7e4('0x7e')],'where':{'secret':![]},'order':qs[_0xb7e4('0x4a')]('id'),'include':_0x539440}];return db[_0xb7e4('0x3b')][_0xb7e4('0x66')]({'where':{'id':_0x53ee09[_0xb7e4('0xc6')]['id']},'include':_0x34acaa})[_0xb7e4('0x1f')](handleEntityNotFound(_0x1e24e2,null))[_0xb7e4('0x1f')](function(_0x3decfa){if(_0x3decfa&&_0x3decfa[_0xb7e4('0xe1')]){var _0xbe6d27=_0x3decfa[_0xb7e4('0xe2')]({'plain':!![]});fs[_0xb7e4('0xe3')](_0x89b0da);return BPromise[_0xb7e4('0xe4')](_0xbe6d27[_0xb7e4('0xe1')],function(_0x40358a,_0x5ce7f2){var _0x714fb2={'from':_0x40358a[_0xb7e4('0x50')],'to':_0x40358a['to'],'subject':_0x40358a[_0xb7e4('0xe5')],'html':htmlEntities[_0xb7e4('0xe6')](_0x40358a[_0xb7e4('0xc5')]),'headers':{'Date':moment(_0x40358a[_0xb7e4('0x7e')])[_0xb7e4('0xcd')](_0xb7e4('0xe7'))},'attachments':[]};if(_0x40358a['cc']){_0x714fb2[_0xb7e4('0xe8')]['Cc']=_0x40358a['cc'];}if(_0x40358a[_0xb7e4('0xe9')]){_0x714fb2[_0xb7e4('0xe8')][_0xb7e4('0xea')]=_0x40358a[_0xb7e4('0xe9')];}return new BPromise(function(_0x2a2c8f,_0x4312fb){if(_0x40358a['Attachments']){for(var _0x501329=0x0;_0x501329<_0x40358a[_0xb7e4('0xe0')][_0xb7e4('0x65')];_0x501329++){var _0x32cd1b=_0x40358a[_0xb7e4('0xe0')][_0x501329];var _0x3b8c8d=path[_0xb7e4('0xd8')](_0x5f0884,_0x32cd1b[_0xb7e4('0xeb')]);if(fs['existsSync'](_0x3b8c8d)){_0x714fb2['attachments'][_0xb7e4('0x2b')]({'name':_0x32cd1b[_0xb7e4('0x23')],'contentType':_0x32cd1b['type'],'data':fs[_0xb7e4('0xec')](_0x3b8c8d)});}}}emlformat[_0xb7e4('0xed')](_0x714fb2,function(_0x3f3b6c,_0x5268c2){if(_0x3f3b6c)return _0x4312fb(_0x3f3b6c);fs[_0xb7e4('0xee')](path[_0xb7e4('0xd8')](_0x89b0da,util[_0xb7e4('0xcd')](_0xb7e4('0xef'),_0x5ce7f2)),_0x5268c2);return _0x2a2c8f(_0x5268c2);});});})[_0xb7e4('0x1f')](function(){return new BPromise(function(_0x27768b,_0x4e9fb0){zipdir(_0x89b0da,{'saveTo':_0x304d49},function(_0xf9e987,_0x3f06e7){if(_0xf9e987)return _0x4e9fb0(_0xf9e987);return _0x27768b(_0x3f06e7);});})['then'](function(){return new BPromise(function(_0x166a6e,_0xd30902){rimraf(_0x89b0da,function(_0x396e54){if(_0x396e54)_0xd30902(_0x396e54);return _0x166a6e();});});})[_0xb7e4('0x1f')](function(){return _0x1e24e2[_0xb7e4('0xf0')](_0x304d49,_0xc94235,function(_0x3f873d){if(!_0x3f873d)fs[_0xb7e4('0xf1')](_0x304d49);});});});}else{return _0x1e24e2[_0xb7e4('0x14')](0xc8);}})['catch'](handleError(_0x1e24e2,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 9f37fe0..8ba8487 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 _0x752d=['map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','setMaxListeners','update','remove','getUsers','then','setDataValue','Users'];(function(_0x345aab,_0x18b7af){var _0x37d787=function(_0x262a09){while(--_0x262a09){_0x345aab['push'](_0x345aab['shift']());}};_0x37d787(++_0x18b7af);}(_0x752d,0x1ca));var _0xd752=function(_0x5c92f3,_0x36b606){_0x5c92f3=_0x5c92f3-0x0;var _0x65e7fa=_0x752d[_0x5c92f3];return _0x65e7fa;};'use strict';var EventEmitter=require(_0xd752('0x0'));var MailInteraction=require(_0xd752('0x1'))['db'][_0xd752('0x2')];var MailMessage=require(_0xd752('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd752('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd752('0x4'),'afterDestroy':_0xd752('0x5')};function emitEvent(_0x110d6a){return function(_0xc37078,_0x20b3ef,_0x447b09){_0xc37078[_0xd752('0x6')]({'attributes':['id'],'raw':!![]})[_0xd752('0x7')](function(_0x328512){_0xc37078[_0xd752('0x8')](_0xd752('0x9'),_0x328512[_0xd752('0xa')](function(_0x142f90){return{'id':_0x142f90['id']};}));return MailMessage[_0xd752('0xb')]({'where':{'MailInteractionId':_0xc37078['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd752('0x7')](function(_0x107336){_0xc37078[_0xd752('0x8')](_0xd752('0xc'),_0x107336[_0xd752('0xd')]);MailInteractionEvents[_0xd752('0xe')](_0x110d6a+':'+_0xc37078['id'],_0xc37078);MailInteractionEvents[_0xd752('0xe')](_0x110d6a,_0xc37078);_0x447b09(null);})[_0xd752('0xf')](_0x447b09(null));};}for(var e in events){if(events[_0xd752('0x10')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xd752('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xa4b3=['events','../../mysqldb','setMaxListeners','save','update','getUsers','then','setDataValue','map','findAll','emit','catch','hasOwnProperty','hook','exports'];(function(_0x50fda9,_0x5ee44b){var _0x36b92b=function(_0x121877){while(--_0x121877){_0x50fda9['push'](_0x50fda9['shift']());}};_0x36b92b(++_0x5ee44b);}(_0xa4b3,0x1d1));var _0x3a4b=function(_0x34ff52,_0x3fbcce){_0x34ff52=_0x34ff52-0x0;var _0x4fe35f=_0xa4b3[_0x34ff52];return _0x4fe35f;};'use strict';var EventEmitter=require(_0x3a4b('0x0'));var MailInteraction=require(_0x3a4b('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x3a4b('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x3a4b('0x2')](0x0);var events={'afterCreate':_0x3a4b('0x3'),'afterUpdate':_0x3a4b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5c3ba7){return function(_0x280bbb,_0x4fe382,_0x152d9b){_0x280bbb[_0x3a4b('0x5')]({'attributes':['id'],'raw':!![]})[_0x3a4b('0x6')](function(_0x2d266f){_0x280bbb[_0x3a4b('0x7')]('Users',_0x2d266f[_0x3a4b('0x8')](function(_0x505b17){return{'id':_0x505b17['id']};}));return MailMessage[_0x3a4b('0x9')]({'where':{'MailInteractionId':_0x280bbb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3a4b('0x6')](function(_0x5eadc0){_0x280bbb['setDataValue']('unreadMessages',_0x5eadc0['length']);MailInteractionEvents[_0x3a4b('0xa')](_0x5c3ba7+':'+_0x280bbb['id'],_0x280bbb);MailInteractionEvents[_0x3a4b('0xa')](_0x5c3ba7,_0x280bbb);_0x152d9b(null);})[_0x3a4b('0xb')](_0x152d9b(null));};}for(var e in events){if(events[_0x3a4b('0xc')](e)){var event=events[e];MailInteraction[_0x3a4b('0xd')](e,emitEvent(event));}}module[_0x3a4b('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 de31ce1..bb2030c 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 _0xe044=['closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xe044,0xb7));var _0x4e04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe044[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e04('0x0'));var util=require(_0x4e04('0x1'));var logger=require('../../config/logger')(_0x4e04('0x2'));var moment=require(_0x4e04('0x3'));var BPromise=require(_0x4e04('0x4'));var rp=require(_0x4e04('0x5'));var fs=require('fs');var path=require(_0x4e04('0x6'));var rimraf=require(_0x4e04('0x7'));var config=require(_0x4e04('0x8'));var attributes=require(_0x4e04('0x9'));module[_0x4e04('0xa')]=function(_0x454551,_0x26f3c2){return _0x454551['define']('MailInteraction',attributes,{'tableName':_0x4e04('0xb'),'paranoid':![],'indexes':[{'name':_0x4e04('0xc'),'fields':[_0x4e04('0xd'),'to'],'type':_0x4e04('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5bca32,_0x1d5b3c,_0x4a4819){if(_0x5bca32[_0x4e04('0xf')]){_0x5bca32[_0x4e04('0x10')]=moment()[_0x4e04('0x11')](_0x4e04('0x12'));}if(_0x5bca32[_0x4e04('0x13')]){_0x5bca32[_0x4e04('0x14')]=moment()[_0x4e04('0x11')](_0x4e04('0x12'));}_0x4a4819(null,_0x1d5b3c);},'beforeUpdate':function(_0x5424df,_0x5b172f,_0x1fe77a){if(_0x5424df[_0x4e04('0x15')](_0x4e04('0xf'))){_0x5424df[_0x4e04('0x10')]=_0x5424df[_0x4e04('0xf')]?moment()[_0x4e04('0x11')](_0x4e04('0x12')):null;}if(_0x5424df[_0x4e04('0x15')]('closed')){_0x5424df[_0x4e04('0x14')]=moment()[_0x4e04('0x11')](_0x4e04('0x12'));_0x5424df[_0x4e04('0xf')]=null;_0x5424df['substatusAt']=null;}_0x1fe77a(null,_0x5424df);},'afterUpdate':function(_0x339f9c,_0x165799,_0x40f6c3){var _0x2e9b0c=_0x454551[_0x4e04('0x16')];var _0x1e0eb7=_0x339f9c[_0x4e04('0x17')]({'plain':!![]});if(_0x1e0eb7[_0x4e04('0x13')]){return _0x2e9b0c[_0x4e04('0x18')][_0x4e04('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x1e0eb7['id']}})[_0x4e04('0x1a')](function(){_0x40f6c3();})[_0x4e04('0x1b')](function(_0x5aa0e8){_0x40f6c3(_0x5aa0e8);});}else{_0x40f6c3();}}},'charset':_0x4e04('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2757=['models','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus'];(function(_0xf72d8,_0x1eac81){var _0x224e1c=function(_0x746f38){while(--_0x746f38){_0xf72d8['push'](_0xf72d8['shift']());}};_0x224e1c(++_0x1eac81);}(_0x2757,0x18f));var _0x7275=function(_0x5dfa4a,_0x181c31){_0x5dfa4a=_0x5dfa4a-0x0;var _0x2608f1=_0x2757[_0x5dfa4a];return _0x2608f1;};'use strict';var _=require(_0x7275('0x0'));var util=require(_0x7275('0x1'));var logger=require(_0x7275('0x2'))(_0x7275('0x3'));var moment=require(_0x7275('0x4'));var BPromise=require(_0x7275('0x5'));var rp=require(_0x7275('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7275('0x7'));module['exports']=function(_0x485113,_0x3d1d07){return _0x485113[_0x7275('0x8')](_0x7275('0x9'),attributes,{'tableName':_0x7275('0xa'),'paranoid':![],'indexes':[{'name':_0x7275('0xb'),'fields':[_0x7275('0xc'),'to'],'type':_0x7275('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1e0a4e,_0x5a183d,_0x3522fa){if(_0x1e0a4e['substatus']){_0x1e0a4e[_0x7275('0xe')]=moment()[_0x7275('0xf')](_0x7275('0x10'));}if(_0x1e0a4e[_0x7275('0x11')]){_0x1e0a4e[_0x7275('0x12')]=moment()['format'](_0x7275('0x10'));}_0x3522fa(null,_0x5a183d);},'beforeUpdate':function(_0x3efef8,_0x77777d,_0x4afa0c){if(_0x3efef8[_0x7275('0x13')](_0x7275('0x14'))){_0x3efef8[_0x7275('0xe')]=_0x3efef8[_0x7275('0x14')]?moment()[_0x7275('0xf')](_0x7275('0x10')):null;}if(_0x3efef8[_0x7275('0x13')](_0x7275('0x11'))){_0x3efef8[_0x7275('0x12')]=moment()[_0x7275('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x3efef8['substatus']=null;_0x3efef8[_0x7275('0xe')]=null;}_0x4afa0c(null,_0x3efef8);},'afterUpdate':function(_0x58674d,_0x3b1b22,_0x133da7){var _0x82f831=_0x485113[_0x7275('0x15')];var _0x256658=_0x58674d[_0x7275('0x16')]({'plain':!![]});if(_0x256658[_0x7275('0x11')]){return _0x82f831[_0x7275('0x17')][_0x7275('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x256658['id']}})[_0x7275('0x19')](function(){_0x133da7();})['catch'](function(_0x23a8c9){_0x133da7(_0x23a8c9);});}else{_0x133da7();}}},'charset':_0x7275('0x1a'),'collate':_0x7275('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index b09ee65..289f09e 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 _0x9eb7=['UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','stringify','AddTagsToMailInteraction','ids','omit','AddTags','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch'];(function(_0xe55ec7,_0x59adfb){var _0x30e9a3=function(_0x56059e){while(--_0x56059e){_0xe55ec7['push'](_0xe55ec7['shift']());}};_0x30e9a3(++_0x59adfb);}(_0x9eb7,0x117));var _0x79eb=function(_0x48fbce,_0x367a55){_0x48fbce=_0x48fbce-0x0;var _0x32a746=_0x9eb7[_0x48fbce];return _0x32a746;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x79eb('0x0'));var BPromise=require(_0x79eb('0x1'));var rs=require(_0x79eb('0x2'));var fs=require('fs');var Redis=require(_0x79eb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x79eb('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x79eb('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x79eb('0x6')]['http']({'port':0x232a});config[_0x79eb('0x7')]=_[_0x79eb('0x8')](config['redis'],{'host':_0x79eb('0x9'),'port':0x18eb});var socket=require(_0x79eb('0xa'))(new Redis(config[_0x79eb('0x7')]));require(_0x79eb('0xb'))[_0x79eb('0xc')](socket);function respondWithRpcPromise(_0x1df999,_0x3d2c85,_0x20327f){return new BPromise(function(_0x4c4bd1,_0x39a4b0){return client[_0x79eb('0xd')](_0x1df999,_0x20327f)[_0x79eb('0xe')](function(_0x3be900){logger[_0x79eb('0xf')]('MailInteraction,\x20%s,\x20%s',_0x3d2c85,_0x79eb('0x10'));logger[_0x79eb('0x11')](_0x79eb('0x12'),_0x3d2c85,_0x79eb('0x10'),JSON['stringify'](_0x3be900));if(_0x3be900['error']){if(_0x3be900[_0x79eb('0x13')][_0x79eb('0x14')]===0x1f4){logger[_0x79eb('0x13')](_0x79eb('0x15'),_0x3d2c85,_0x3be900['error'][_0x79eb('0x16')]);return _0x39a4b0(_0x3be900[_0x79eb('0x13')][_0x79eb('0x16')]);}logger[_0x79eb('0x13')](_0x79eb('0x15'),_0x3d2c85,_0x3be900[_0x79eb('0x13')][_0x79eb('0x16')]);return _0x4c4bd1(_0x3be900['error']['message']);}else{logger[_0x79eb('0xf')](_0x79eb('0x15'),_0x3d2c85,'request\x20sent');_0x4c4bd1(_0x3be900[_0x79eb('0x17')]['message']);}})[_0x79eb('0x18')](function(_0x278c67){logger['error'](_0x79eb('0x15'),_0x3d2c85,_0x278c67);_0x39a4b0(_0x278c67);});});}exports[_0x79eb('0x19')]=function(_0x836508){var _0x91befd=this;return new Promise(function(_0xd70779,_0x2c3e5e){return db[_0x79eb('0x1a')][_0x79eb('0x1b')](_0x836508[_0x79eb('0x1c')],{'raw':_0x836508['options']?_0x836508[_0x79eb('0x1d')][_0x79eb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x836508[_0x79eb('0x1d')]?_0x836508[_0x79eb('0x1d')][_0x79eb('0x1f')]||null:null,'attributes':_0x836508[_0x79eb('0x1d')]?_0x836508[_0x79eb('0x1d')][_0x79eb('0x20')]||null:null,'limit':_0x836508[_0x79eb('0x1d')]?_0x836508[_0x79eb('0x1d')]['limit']||null:null})['then'](function(_0x1216da){logger[_0x79eb('0xf')](_0x79eb('0x19'),_0x836508);logger[_0x79eb('0x11')](_0x79eb('0x19'),_0x836508,JSON[_0x79eb('0x21')](_0x1216da));_0xd70779(_0x1216da);})[_0x79eb('0x18')](function(_0x5c5dce){logger[_0x79eb('0x13')](_0x79eb('0x19'),_0x5c5dce['message'],_0x836508);_0x2c3e5e(_0x91befd[_0x79eb('0x13')](0x1f4,_0x5c5dce['message']));});});};exports[_0x79eb('0x22')]=function(_0x34ee7f){return new Promise(function(_0x2f2085,_0x532176){return db[_0x79eb('0x1a')]['find']({'where':_0x34ee7f[_0x79eb('0x1d')]?_0x34ee7f[_0x79eb('0x1d')][_0x79eb('0x1f')]||null:null})[_0x79eb('0xe')](function(_0x2e319b){if(_0x2e319b){return _0x2e319b['addTags'](_0x34ee7f[_0x79eb('0x1c')][_0x79eb('0x23')],_[_0x79eb('0x24')](_0x34ee7f[_0x79eb('0x1c')],[_0x79eb('0x23'),'id'])||{});}})['spread'](function(_0x11c99f){logger[_0x79eb('0xf')](_0x79eb('0x25'),_0x34ee7f);logger[_0x79eb('0x11')](_0x79eb('0x25'),_0x34ee7f,JSON[_0x79eb('0x21')](_0x11c99f));_0x2f2085(_0x11c99f);})['catch'](function(_0x5d054f){logger[_0x79eb('0x13')](_0x79eb('0x25'),_0x5d054f[_0x79eb('0x16')],_0x34ee7f);_0x532176(_this[_0x79eb('0x13')](0x1f4,_0x5d054f[_0x79eb('0x16')]));});});}; \ No newline at end of file +var _0x060c=['where','attributes','limit','catch','AddTagsToMailInteraction','MailInteraction','ids','omit','spread','AddTags','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateMailInteraction','update','body','options'];(function(_0x343dcf,_0x261e21){var _0x28c659=function(_0x347566){while(--_0x347566){_0x343dcf['push'](_0x343dcf['shift']());}};_0x28c659(++_0x261e21);}(_0x060c,0x1e4));var _0xc060=function(_0x559a59,_0x5c3d18){_0x559a59=_0x559a59-0x0;var _0x2e4300=_0x060c[_0x559a59];return _0x2e4300;};'use strict';var _=require(_0xc060('0x0'));var util=require(_0xc060('0x1'));var moment=require(_0xc060('0x2'));var BPromise=require(_0xc060('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc060('0x4'));var db=require(_0xc060('0x5'))['db'];var utils=require(_0xc060('0x6'));var logger=require(_0xc060('0x7'))(_0xc060('0x8'));var config=require(_0xc060('0x9'));var jayson=require(_0xc060('0xa'));var client=jayson[_0xc060('0xb')][_0xc060('0xc')]({'port':0x232a});config[_0xc060('0xd')]=_['defaults'](config['redis'],{'host':_0xc060('0xe'),'port':0x18eb});var socket=require(_0xc060('0xf'))(new Redis(config[_0xc060('0xd')]));require(_0xc060('0x10'))[_0xc060('0x11')](socket);function respondWithRpcPromise(_0x361c4c,_0x48e5d4,_0x34bb74){return new BPromise(function(_0xf5216c,_0x1bcda8){return client[_0xc060('0x12')](_0x361c4c,_0x34bb74)[_0xc060('0x13')](function(_0x40fb4c){logger[_0xc060('0x14')](_0xc060('0x15'),_0x48e5d4,_0xc060('0x16'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x48e5d4,_0xc060('0x16'),JSON[_0xc060('0x17')](_0x40fb4c));if(_0x40fb4c['error']){if(_0x40fb4c[_0xc060('0x18')][_0xc060('0x19')]===0x1f4){logger[_0xc060('0x18')](_0xc060('0x15'),_0x48e5d4,_0x40fb4c[_0xc060('0x18')][_0xc060('0x1a')]);return _0x1bcda8(_0x40fb4c[_0xc060('0x18')]['message']);}logger[_0xc060('0x18')]('MailInteraction,\x20%s,\x20%s',_0x48e5d4,_0x40fb4c[_0xc060('0x18')][_0xc060('0x1a')]);return _0xf5216c(_0x40fb4c['error']['message']);}else{logger[_0xc060('0x14')](_0xc060('0x15'),_0x48e5d4,_0xc060('0x16'));_0xf5216c(_0x40fb4c[_0xc060('0x1b')][_0xc060('0x1a')]);}})['catch'](function(_0x2e1e0d){logger['error'](_0xc060('0x15'),_0x48e5d4,_0x2e1e0d);_0x1bcda8(_0x2e1e0d);});});}exports[_0xc060('0x1c')]=function(_0x188746){var _0x1ade15=this;return new Promise(function(_0x473f39,_0x177fc6){return db['MailInteraction'][_0xc060('0x1d')](_0x188746[_0xc060('0x1e')],{'raw':_0x188746['options']?_0x188746[_0xc060('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x188746[_0xc060('0x1f')]?_0x188746[_0xc060('0x1f')][_0xc060('0x20')]||null:null,'attributes':_0x188746[_0xc060('0x1f')]?_0x188746['options'][_0xc060('0x21')]||null:null,'limit':_0x188746[_0xc060('0x1f')]?_0x188746['options'][_0xc060('0x22')]||null:null})[_0xc060('0x13')](function(_0x28fdbc){logger[_0xc060('0x14')](_0xc060('0x1c'),_0x188746);logger['debug']('UpdateMailInteraction',_0x188746,JSON[_0xc060('0x17')](_0x28fdbc));_0x473f39(_0x28fdbc);})[_0xc060('0x23')](function(_0x5b8745){logger[_0xc060('0x18')](_0xc060('0x1c'),_0x5b8745[_0xc060('0x1a')],_0x188746);_0x177fc6(_0x1ade15[_0xc060('0x18')](0x1f4,_0x5b8745[_0xc060('0x1a')]));});});};exports[_0xc060('0x24')]=function(_0x2413e7){return new Promise(function(_0x44d65d,_0x33e579){return db[_0xc060('0x25')]['find']({'where':_0x2413e7['options']?_0x2413e7[_0xc060('0x1f')][_0xc060('0x20')]||null:null})[_0xc060('0x13')](function(_0x5692bd){if(_0x5692bd){return _0x5692bd['addTags'](_0x2413e7[_0xc060('0x1e')][_0xc060('0x26')],_[_0xc060('0x27')](_0x2413e7[_0xc060('0x1e')],[_0xc060('0x26'),'id'])||{});}})[_0xc060('0x28')](function(_0x52be5d){logger[_0xc060('0x14')](_0xc060('0x29'),_0x2413e7);logger[_0xc060('0x2a')](_0xc060('0x29'),_0x2413e7,JSON[_0xc060('0x17')](_0x52be5d));_0x44d65d(_0x52be5d);})[_0xc060('0x23')](function(_0x2095bf){logger[_0xc060('0x18')](_0xc060('0x29'),_0x2095bf[_0xc060('0x1a')],_0x2413e7);_0x33e579(_this['error'](0x1f4,_0x2095bf[_0xc060('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 464634d..08dc9c4 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 _0xd2b7=['remove','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x221abd,_0x621d76){var _0x47e399=function(_0x3c966f){while(--_0x3c966f){_0x221abd['push'](_0x221abd['shift']());}};_0x47e399(++_0x621d76);}(_0xd2b7,0x1de));var _0x7d2b=function(_0x2132a3,_0x4639e9){_0x2132a3=_0x2132a3-0x0;var _0x21890c=_0xd2b7[_0x2132a3];return _0x21890c;};'use strict';var MailInteractionEvents=require(_0x7d2b('0x0'));var events=[_0x7d2b('0x1'),_0x7d2b('0x2'),'update'];function createListener(_0x248f72,_0x9d0125){return function(_0x575d26){_0x9d0125[_0x7d2b('0x3')](_0x248f72,_0x575d26);};}function removeListener(_0x4cb761,_0x3e9a5f){return function(){MailInteractionEvents[_0x7d2b('0x4')](_0x4cb761,_0x3e9a5f);};}exports[_0x7d2b('0x5')]=function(_0x4b02f9){for(var _0x3ba646=0x0,_0x107afc=events[_0x7d2b('0x6')];_0x3ba646<_0x107afc;_0x3ba646++){var _0x458853=events[_0x3ba646];var _0x407527=createListener(_0x7d2b('0x7')+_0x458853,_0x4b02f9);MailInteractionEvents['on'](_0x458853,_0x407527);}}; \ No newline at end of file +var _0xa560=['save','remove','update','removeListener','length','mailInteraction:'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa560,0x1c2));var _0x0a56=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa560[_0x20a584];return _0x4b41a8;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x0a56('0x0'),_0x0a56('0x1'),_0x0a56('0x2')];function createListener(_0x580645,_0x59240c){return function(_0x297705){_0x59240c['emit'](_0x580645,_0x297705);};}function removeListener(_0x5d893a,_0x14db3){return function(){MailInteractionEvents[_0x0a56('0x3')](_0x5d893a,_0x14db3);};}exports['register']=function(_0x1d5408){for(var _0xcac023=0x0,_0xda1bf2=events[_0x0a56('0x4')];_0xcac023<_0xda1bf2;_0xcac023++){var _0xfd14bc=events[_0xcac023];var _0x56661a=createListener(_0x0a56('0x5')+_0xfd14bc,_0x1d5408);MailInteractionEvents['on'](_0xfd14bc,_0x56661a);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 9397962..f1f01ab 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 _0x03f5=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','post','tracked','mail','mailmessage:create','create','put','accept','/:id/reject','reject','delete','destroy'];(function(_0x5e378,_0x45e827){var _0x255e5e=function(_0x143c65){while(--_0x143c65){_0x5e378['push'](_0x5e378['shift']());}};_0x255e5e(++_0x45e827);}(_0x03f5,0x6c));var _0x503f=function(_0x4d73cf,_0x39838a){_0x4d73cf=_0x4d73cf-0x0;var _0x166c14=_0x03f5[_0x4d73cf];return _0x166c14;};'use strict';var multer=require(_0x503f('0x0'));var util=require(_0x503f('0x1'));var path=require(_0x503f('0x2'));var timeout=require(_0x503f('0x3'));var express=require(_0x503f('0x4'));var router=express[_0x503f('0x5')]();var fs_extra=require(_0x503f('0x6'));var auth=require(_0x503f('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x503f('0x8'));router[_0x503f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x503f('0x9')](_0x503f('0xa'),auth[_0x503f('0xb')](),controller[_0x503f('0xc')]);router[_0x503f('0x9')](_0x503f('0xd'),auth[_0x503f('0xb')](),controller[_0x503f('0xe')]);router[_0x503f('0x9')](_0x503f('0xf'),auth[_0x503f('0xb')](),controller['download']);router[_0x503f('0x10')]('/',auth['isAuthenticated'](),interaction[_0x503f('0x11')](_0x503f('0x12'),_0x503f('0x13')),controller[_0x503f('0x14')]);router['put'](_0x503f('0xd'),auth[_0x503f('0xb')](),controller['update']);router[_0x503f('0x15')]('/:id/accept',auth[_0x503f('0xb')](),controller[_0x503f('0x16')]);router[_0x503f('0x15')](_0x503f('0x17'),auth[_0x503f('0xb')](),controller[_0x503f('0x18')]);router[_0x503f('0x19')](_0x503f('0xd'),auth[_0x503f('0xb')](),controller[_0x503f('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xae7b=['/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','create','/:id/accept','accept','put','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x54e18b,_0x139423){var _0x53b132=function(_0x5c53ca){while(--_0x5c53ca){_0x54e18b['push'](_0x54e18b['shift']());}};_0x53b132(++_0x139423);}(_0xae7b,0xbe));var _0xbae7=function(_0x240700,_0x13e7d9){_0x240700=_0x240700-0x0;var _0x51530c=_0xae7b[_0x240700];return _0x51530c;};'use strict';var multer=require(_0xbae7('0x0'));var util=require(_0xbae7('0x1'));var path=require(_0xbae7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbae7('0x3')]();var fs_extra=require(_0xbae7('0x4'));var auth=require(_0xbae7('0x5'));var interaction=require(_0xbae7('0x6'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0xbae7('0x7')]('/',auth[_0xbae7('0x8')](),controller[_0xbae7('0x9')]);router['get'](_0xbae7('0xa'),auth['isAuthenticated'](),controller[_0xbae7('0xb')]);router[_0xbae7('0x7')](_0xbae7('0xc'),auth['isAuthenticated'](),controller[_0xbae7('0xd')]);router['get'](_0xbae7('0xe'),auth[_0xbae7('0x8')](),controller[_0xbae7('0xf')]);router[_0xbae7('0x10')]('/',auth['isAuthenticated'](),interaction[_0xbae7('0x11')](_0xbae7('0x12'),'mailmessage:create'),controller[_0xbae7('0x13')]);router['put'](_0xbae7('0xc'),auth[_0xbae7('0x8')](),controller['update']);router['put'](_0xbae7('0x14'),auth[_0xbae7('0x8')](),controller[_0xbae7('0x15')]);router[_0xbae7('0x16')]('/:id/reject',auth[_0xbae7('0x8')](),controller['reject']);router['delete'](_0xbae7('0xc'),auth[_0xbae7('0x8')](),controller[_0xbae7('0x17')]);module[_0xbae7('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index ad0b8d5..251d609 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 _0x866d=['Chat','sequelize','lodash','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','Email'];(function(_0x40a3cf,_0x3bad41){var _0x505059=function(_0x2e08d6){while(--_0x2e08d6){_0x40a3cf['push'](_0x40a3cf['shift']());}};_0x505059(++_0x3bad41);}(_0x866d,0x17b));var _0xd866=function(_0x474f47,_0x2303b7){_0x474f47=_0x474f47-0x0;var _0x21bfe6=_0x866d[_0x474f47];return _0x21bfe6;};'use strict';var Sequelize=require(_0xd866('0x0'));var _=require(_0xd866('0x1'));module[_0xd866('0x2')]={'body':{'type':Sequelize[_0xd866('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xd866('0x3')](_0xd866('0x4'))},'read':{'type':Sequelize[_0xd866('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd866('0x6')]('in',_0xd866('0x7')),'defaultValue':_0xd866('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd866('0x8')](0x1fe)},'from':{'type':Sequelize[_0xd866('0x8')]},'to':{'type':Sequelize[_0xd866('0x3')](_0xd866('0x9'))},'cc':{'type':Sequelize[_0xd866('0x3')](_0xd866('0x9'))},'bcc':{'type':Sequelize['TEXT'](_0xd866('0x9'))},'subject':{'type':Sequelize[_0xd866('0x3')]},'sentAt':{'type':Sequelize[_0xd866('0xa')]},'attach':{'type':Sequelize[_0xd866('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xd866('0xa')]},'originTo':{'type':Sequelize[_0xd866('0x3')](_0xd866('0x9'))},'originCc':{'type':Sequelize[_0xd866('0x3')](_0xd866('0x9'))},'originChannel':{'type':Sequelize['ENUM'](_0xd866('0xc'),_0xd866('0xd')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x787c=['lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','INTEGER','Email','Chat','sequelize'];(function(_0xa1be4f,_0x10a675){var _0x25bcce=function(_0x2523da){while(--_0x2523da){_0xa1be4f['push'](_0xa1be4f['shift']());}};_0x25bcce(++_0x10a675);}(_0x787c,0xcf));var _0xc787=function(_0xb0253a,_0x26513d){_0xb0253a=_0xb0253a-0x0;var _0x1e9458=_0x787c[_0xb0253a];return _0x1e9458;};'use strict';var Sequelize=require(_0xc787('0x0'));var _=require(_0xc787('0x1'));module[_0xc787('0x2')]={'body':{'type':Sequelize[_0xc787('0x3')](_0xc787('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xc787('0x5'))},'read':{'type':Sequelize[_0xc787('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc787('0x7')]('in',_0xc787('0x8')),'defaultValue':_0xc787('0x8'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xc787('0x9')]},'to':{'type':Sequelize['TEXT'](_0xc787('0x4'))},'cc':{'type':Sequelize[_0xc787('0x3')]('long')},'bcc':{'type':Sequelize[_0xc787('0x3')]('long')},'subject':{'type':Sequelize[_0xc787('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xc787('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xc787('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0xc787('0x4'))},'originCc':{'type':Sequelize[_0xc787('0x3')]('long')},'originChannel':{'type':Sequelize[_0xc787('0x7')](_0xc787('0xb'),_0xc787('0xc')),'defaultValue':_0xc787('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 101894e..d5868a7 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 _0x1897=['defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','http','client','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','where','includeAll','findAll','rows','show','params','include','options','find','body','describe','create','direction','split','findOne','MailAccountId','CmList','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','auth','user','pass','attachments','basename','List','Contacts','CmContact','ListId','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','UserId','MailInteraction','read1stAt','format','get','[MAILMESSAGE: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','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','internal','manual','SIP/%s','channel','event','accept','fromString','EventManager','acceptmessage','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','email','interface','motionChannel','rejectmessage','download','toString','root','server','files','join','message-%s.eml','from','subject','createdAt','Attachment','bcc','headers','Attachments','existsSync','push','readFileSync','build','writeFileSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis'];(function(_0x1f4c16,_0xe9a821){var _0x45ae48=function(_0xb0aeb4){while(--_0xb0aeb4){_0x1f4c16['push'](_0x1f4c16['shift']());}};_0x45ae48(++_0xe9a821);}(_0x1897,0x97));var _0x7189=function(_0xca11dd,_0x4d8b1d){_0xca11dd=_0xca11dd-0x0;var _0x38aef6=_0x1897[_0xca11dd];return _0x38aef6;};'use strict';var emlformat=require(_0x7189('0x0'));var moment=require(_0x7189('0x1'));var BPromise=require('bluebird');var util=require(_0x7189('0x2'));var path=require(_0x7189('0x3'));var fs=require('fs');var _=require(_0x7189('0x4'));var Redis=require(_0x7189('0x5'));var htmlToText=require(_0x7189('0x6'));var qs=require(_0x7189('0x7'));var logger=require(_0x7189('0x8'))(_0x7189('0x9'));var interaction_log=require(_0x7189('0x8'))('mail-interactions');var config=require(_0x7189('0xa'));var db=require(_0x7189('0xb'))['db'];config[_0x7189('0xc')]=_[_0x7189('0xd')](config[_0x7189('0xc')],{'host':_0x7189('0xe'),'port':0x18eb});var socket=require(_0x7189('0xf'))(new Redis(config[_0x7189('0xc')]));var htmlEntities=require(_0x7189('0x10'));require(_0x7189('0x11'))[_0x7189('0x12')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7189('0x13')]({'port':0x232c});var client9003=jayson[_0x7189('0x14')][_0x7189('0x13')]({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b0207,_0x52e768,_0x6fbd33,_0x455694){return new BPromise(function(_0x411fe1,_0x2427d0){var _0x426281=_0x455694||client;return _0x426281[_0x7189('0x15')](_0x2b0207,_0x6fbd33)[_0x7189('0x16')](function(_0x3922b9){logger[_0x7189('0x17')](_0x7189('0x18'),_0x52e768,'request\x20sent');logger[_0x7189('0x19')](_0x7189('0x1a'),_0x52e768,_0x7189('0x1b'),JSON[_0x7189('0x1c')](_0x3922b9));if(_0x3922b9[_0x7189('0x1d')]){if(_0x3922b9['error'][_0x7189('0x1e')]===0x1f4){logger[_0x7189('0x1d')](_0x7189('0x18'),_0x52e768,_0x3922b9['error'][_0x7189('0x1f')]);return _0x2427d0(_0x3922b9['error'][_0x7189('0x1f')]);}logger[_0x7189('0x1d')]('MailMessage,\x20%s,\x20%s',_0x52e768,_0x3922b9[_0x7189('0x1d')][_0x7189('0x1f')]);return _0x411fe1(_0x3922b9[_0x7189('0x1d')]['message']);}else{logger[_0x7189('0x17')]('MailMessage,\x20%s,\x20%s',_0x52e768,_0x7189('0x1b'));_0x411fe1(_0x3922b9['result'][_0x7189('0x1f')]);}})[_0x7189('0x20')](function(_0x97d3ce){logger['error'](_0x7189('0x18'),_0x52e768,_0x97d3ce);_0x2427d0(_0x97d3ce);});});}function respondWithResult(_0x58cd35,_0x4aed49){_0x4aed49=_0x4aed49||0xc8;return function(_0x52b8fe){if(_0x52b8fe){return _0x58cd35[_0x7189('0x21')](_0x4aed49)[_0x7189('0x22')](_0x52b8fe);}};}function respondWithFilteredResult(_0x5944d6,_0x302f09){return function(_0xeb7a44){if(_0xeb7a44){var _0x400461=typeof _0x302f09[_0x7189('0x23')]===_0x7189('0x24')&&typeof _0x302f09[_0x7189('0x25')]===_0x7189('0x24');var _0x2eef1c=_0xeb7a44[_0x7189('0x26')];var _0xfb851=_0x400461?0x0:_0x302f09[_0x7189('0x23')];var _0x56edf8=_0x400461?_0xeb7a44[_0x7189('0x26')]:_0x302f09['offset']+_0x302f09['limit'];var _0x4a9409;if(_0x56edf8>=_0x2eef1c){_0x56edf8=_0x2eef1c;_0x4a9409=0xc8;}else{_0x4a9409=0xce;}_0x5944d6['status'](_0x4a9409);return _0x5944d6[_0x7189('0x27')](_0x7189('0x28'),_0xfb851+'-'+_0x56edf8+'/'+_0x2eef1c)[_0x7189('0x22')](_0xeb7a44);}return null;};}function saveUpdates(_0x1eb758){return function(_0x259947){if(_0x259947){return _0x259947[_0x7189('0x29')](_0x1eb758)[_0x7189('0x16')](function(_0x5296bc){return _0x5296bc;});}return null;};}function removeEntity(_0x2c25aa){return function(_0x2345f6){if(_0x2345f6){return _0x2345f6[_0x7189('0x2a')]()[_0x7189('0x16')](function(){_0x2c25aa[_0x7189('0x21')](0xcc)[_0x7189('0x2b')]();});}};}function handleEntityNotFound(_0x402c35){return function(_0x33a182){if(!_0x33a182){_0x402c35['sendStatus'](0x194);}return _0x33a182;};}function handleError(_0x1f1822,_0x3b40b3){_0x3b40b3=_0x3b40b3||0x1f4;return function(_0x3f3746){logger['error'](_0x3f3746['stack']);if(_0x3f3746[_0x7189('0x2c')]){delete _0x3f3746[_0x7189('0x2c')];}_0x1f1822['status'](_0x3b40b3)[_0x7189('0x2d')](_0x3f3746);};}exports[_0x7189('0x2e')]=function(_0x1d43be,_0x17b5d3){var _0x93d19a={},_0xcc1875={},_0x221498={'count':0x0,'rows':[]};var _0x411d72=_[_0x7189('0x2f')](db[_0x7189('0x30')][_0x7189('0x31')],function(_0x267248){return{'name':_0x267248[_0x7189('0x32')],'type':_0x267248[_0x7189('0x33')][_0x7189('0x34')]};});_0xcc1875[_0x7189('0x35')]=_[_0x7189('0x2f')](_0x411d72,_0x7189('0x2c'));_0xcc1875[_0x7189('0x36')]=_[_0x7189('0x37')](_0x1d43be[_0x7189('0x36')]);_0xcc1875[_0x7189('0x38')]=_[_0x7189('0x39')](_0xcc1875['model'],_0xcc1875[_0x7189('0x36')]);_0x93d19a[_0x7189('0x3a')]=_[_0x7189('0x39')](_0xcc1875[_0x7189('0x35')],qs[_0x7189('0x3b')](_0x1d43be[_0x7189('0x36')]['fields']));_0x93d19a[_0x7189('0x3a')]=_0x93d19a[_0x7189('0x3a')][_0x7189('0x3c')]?_0x93d19a['attributes']:_0xcc1875[_0x7189('0x35')];if(!_0x1d43be[_0x7189('0x36')][_0x7189('0x3d')]('nolimit')){_0x93d19a['limit']=qs[_0x7189('0x25')](_0x1d43be[_0x7189('0x36')][_0x7189('0x25')]);_0x93d19a[_0x7189('0x23')]=qs['offset'](_0x1d43be['query'][_0x7189('0x23')]);}_0x93d19a[_0x7189('0x3e')]=qs['sort'](_0x1d43be['query'][_0x7189('0x3f')]);_0x93d19a['where']=qs[_0x7189('0x38')](_['pick'](_0x1d43be['query'],_0xcc1875[_0x7189('0x38')]),_0x411d72);if(_0x1d43be[_0x7189('0x36')][_0x7189('0x40')]){_0x93d19a['where']=_['merge'](_0x93d19a['where'],{'$or':_[_0x7189('0x2f')](_0x411d72,function(_0x5dacfb){if(_0x5dacfb['type']!=='VIRTUAL'){var _0xe9e874={};_0xe9e874[_0x5dacfb['name']]={'$like':'%'+_0x1d43be[_0x7189('0x36')][_0x7189('0x40')]+'%'};return _0xe9e874;}})});}_0x93d19a=_[_0x7189('0x41')]({},_0x93d19a,_0x1d43be['options']);var _0x39f7c2={'where':_0x93d19a[_0x7189('0x42')]};return db['MailMessage'][_0x7189('0x26')](_0x39f7c2)[_0x7189('0x16')](function(_0xd0bf66){_0x221498['count']=_0xd0bf66;if(_0x1d43be[_0x7189('0x36')][_0x7189('0x43')]){_0x93d19a['include']=[{'all':!![]}];}return db['MailMessage'][_0x7189('0x44')](_0x93d19a);})[_0x7189('0x16')](function(_0x33801c){_0x221498[_0x7189('0x45')]=_0x33801c;return _0x221498;})[_0x7189('0x16')](respondWithFilteredResult(_0x17b5d3,_0x93d19a))[_0x7189('0x20')](handleError(_0x17b5d3,null));};exports[_0x7189('0x46')]=function(_0x987c77,_0x291575){var _0x44c64b={'raw':!![],'where':{'id':_0x987c77[_0x7189('0x47')]['id']}},_0x19388b={};_0x19388b[_0x7189('0x35')]=_[_0x7189('0x37')](db[_0x7189('0x30')][_0x7189('0x31')]);_0x19388b[_0x7189('0x36')]=_[_0x7189('0x37')](_0x987c77[_0x7189('0x36')]);_0x19388b[_0x7189('0x38')]=_[_0x7189('0x39')](_0x19388b[_0x7189('0x35')],_0x19388b['query']);_0x44c64b['attributes']=_[_0x7189('0x39')](_0x19388b[_0x7189('0x35')],qs['fields'](_0x987c77[_0x7189('0x36')][_0x7189('0x3b')]));_0x44c64b['attributes']=_0x44c64b['attributes'][_0x7189('0x3c')]?_0x44c64b['attributes']:_0x19388b[_0x7189('0x35')];if(_0x987c77['query'][_0x7189('0x43')]){_0x44c64b[_0x7189('0x48')]=[{'all':!![]}];}_0x44c64b=_[_0x7189('0x41')]({},_0x44c64b,_0x987c77[_0x7189('0x49')]);return db['MailMessage'][_0x7189('0x4a')](_0x44c64b)[_0x7189('0x16')](handleEntityNotFound(_0x291575,null))[_0x7189('0x16')](respondWithResult(_0x291575,null))[_0x7189('0x20')](handleError(_0x291575,null));};exports[_0x7189('0x29')]=function(_0x3809f2,_0x220fbd){if(_0x3809f2[_0x7189('0x4b')]['id']){delete _0x3809f2[_0x7189('0x4b')]['id'];}return db['MailMessage'][_0x7189('0x4a')]({'where':{'id':_0x3809f2[_0x7189('0x47')]['id']}})[_0x7189('0x16')](handleEntityNotFound(_0x220fbd,null))[_0x7189('0x16')](saveUpdates(_0x3809f2[_0x7189('0x4b')],null))[_0x7189('0x16')](respondWithResult(_0x220fbd,null))[_0x7189('0x20')](handleError(_0x220fbd,null));};exports[_0x7189('0x2a')]=function(_0x385f96,_0xf22d3d){return db[_0x7189('0x30')]['find']({'where':{'id':_0x385f96[_0x7189('0x47')]['id']}})[_0x7189('0x16')](handleEntityNotFound(_0xf22d3d,null))[_0x7189('0x16')](removeEntity(_0xf22d3d,null))[_0x7189('0x20')](handleError(_0xf22d3d,null));};exports[_0x7189('0x4c')]=function(_0xd23581,_0x446952){return db[_0x7189('0x30')][_0x7189('0x4c')]()[_0x7189('0x16')](respondWithResult(_0x446952,null))[_0x7189('0x20')](handleError(_0x446952,null));};exports[_0x7189('0x4d')]=function(_0x18850e,_0x386583){return db[_0x7189('0x30')][_0x7189('0x4d')](_0x18850e[_0x7189('0x4b')])[_0x7189('0x16')](function(_0x1e9b56){if(_0x1e9b56){if(_0x1e9b56[_0x7189('0x4e')]==='out'&&!_0x1e9b56['secret']){var _0x212a3a,_0x3ba710,_0x5041d6;if(_0x18850e['body']['to']){_0x3ba710=_0x18850e[_0x7189('0x4b')]['to'][_0x7189('0x4f')](',')[0x0];}return db['MailAccount'][_0x7189('0x50')]({'where':{'id':_0x1e9b56[_0x7189('0x51')]},'include':[{'model':db[_0x7189('0x52')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x3ba710},'limit':0x1,'order':[[_0x7189('0x53'),_0x7189('0x54')]]}]},{'model':db[_0x7189('0x55')],'as':'Smtp','raw':!![]}]})[_0x7189('0x16')](function(_0x2d83f2){_0x212a3a=_0x2d83f2;if(_0x212a3a&&_0x212a3a[_0x7189('0x56')]){var _0xe3621a={'tls':{'rejectUnauthorized':![]}};if(_[_0x7189('0x57')](_0x212a3a['Smtp'][_0x7189('0x58')])){_0xe3621a[_0x7189('0x59')]=_0x212a3a[_0x7189('0x56')][_0x7189('0x59')];_0xe3621a[_0x7189('0x5a')]=_0x212a3a[_0x7189('0x56')][_0x7189('0x5a')];_0xe3621a[_0x7189('0x5b')]=_0x212a3a[_0x7189('0x56')]['secure'];if(_0x212a3a['Smtp']['authentication']){_0xe3621a[_0x7189('0x5c')]={'user':_0x212a3a[_0x7189('0x56')][_0x7189('0x5d')],'pass':_0x212a3a[_0x7189('0x56')][_0x7189('0x5e')]};}}else{_0xe3621a[_0x7189('0x58')]=_0x212a3a[_0x7189('0x56')][_0x7189('0x58')];_0xe3621a[_0x7189('0x5c')]={'user':_0x212a3a['Smtp']['user'],'pass':_0x212a3a[_0x7189('0x56')][_0x7189('0x5e')]};_0xe3621a[_0x7189('0x5b')]=_0x212a3a['Smtp'][_0x7189('0x5b')];}if(_0x18850e['body'][_0x7189('0x5f')]&&_0x18850e[_0x7189('0x4b')][_0x7189('0x5f')]['length']){for(var _0x1a9ec8=0x0;_0x1a9ec8<_0x18850e[_0x7189('0x4b')]['attachments'][_0x7189('0x3c')];_0x1a9ec8+=0x1){_0x18850e[_0x7189('0x4b')][_0x7189('0x5f')][_0x1a9ec8]={'filename':_0x18850e[_0x7189('0x4b')][_0x7189('0x5f')][_0x1a9ec8]['name'],'path':path['join'](config['root'],'server/files/attachments',_0x18850e['body'][_0x7189('0x5f')][_0x1a9ec8][_0x7189('0x60')])};}}_0x5041d6={'account':_0xe3621a,'message':_0x18850e[_0x7189('0x4b')]};return;}})['then'](function(){if(_0x212a3a[_0x7189('0x61')]){if(_0x212a3a[_0x7189('0x61')][_0x7189('0x62')][_0x7189('0x3c')]){return _0x212a3a[_0x7189('0x61')][_0x7189('0x62')][0x0];}else{return db[_0x7189('0x63')][_0x7189('0x4d')](_['defaults'](_0x18850e['body'],{'firstName':_0x18850e[_0x7189('0x4b')]['to'],'email':_0x18850e[_0x7189('0x4b')]['to'],'phone':_0x18850e['body']['to'],'ListId':_0x212a3a[_0x7189('0x64')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x7189('0x16')](function(){if(_0x5041d6){return respondWithRpcPromise(_0x7189('0x65'),_0x7189('0x66'),_0x5041d6,client9003)[_0x7189('0x16')](function(_0x591068){return _0x1e9b56[_0x7189('0x29')]({'read':!![],'messageId':_0x591068[_0x7189('0x67')],'sentAt':moment()['format'](_0x7189('0x68'))});})['catch'](function(_0x40101a){logger['error']('%s',JSON[_0x7189('0x1c')](_0x40101a));return _0x1e9b56;});}return _0x1e9b56;});}return _0x1e9b56;}})[_0x7189('0x16')](respondWithResult(_0x386583,0xc9))[_0x7189('0x20')](handleError(_0x386583,null));};exports['accept']=function(_0x4a39b6,_0x58ac3c){var _0x449f30={'agent':{},'channel':_0x7189('0x69')};if(_0x4a39b6[_0x7189('0x4b')]['id']){delete _0x4a39b6['body']['id'];}_0x4a39b6['body'][_0x7189('0x6a')]=!![];_0x4a39b6[_0x7189('0x4b')][_0x7189('0x6b')]=moment()['format'](_0x7189('0x68'));_0x4a39b6[_0x7189('0x4b')][_0x7189('0x6c')]=_0x4a39b6['body'][_0x7189('0x6c')]||_0x4a39b6[_0x7189('0x5d')]['id'];_0x449f30['agent']['id']=_0x4a39b6['body']['UserId'];return db['MailMessage'][_0x7189('0x4a')]({'where':{'id':_0x4a39b6[_0x7189('0x47')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x58ac3c,null))['then'](saveUpdates(_0x4a39b6[_0x7189('0x4b')],null))[_0x7189('0x16')](function(_0x1b95bc){if(_0x1b95bc){_0x449f30[_0x7189('0x1f')]=_0x1b95bc['get']({'plain':!![]});return db[_0x7189('0x6d')][_0x7189('0x4a')]({'where':{'id':_0x1b95bc['MailInteractionId']}});}return null;})[_0x7189('0x16')](handleEntityNotFound(_0x58ac3c,null))[_0x7189('0x16')](function(_0x54bf0a){if(_0x54bf0a){return _0x54bf0a[_0x7189('0x29')]({'UserId':_0x4a39b6[_0x7189('0x4b')][_0x7189('0x6c')],'read1stAt':_['isNil'](_0x54bf0a[_0x7189('0x6e')])?moment()[_0x7189('0x6f')](_0x7189('0x68')):undefined});}return null;})[_0x7189('0x16')](function(_0x4a3d38){if(_0x4a3d38){_0x449f30['interaction']=_0x4a3d38[_0x7189('0x70')]({'plain':!![]});interaction_log['info'](_0x7189('0x71'),_0x4a39b6[_0x7189('0x5d')]['id'],_0x4a39b6['user'][_0x7189('0x2c')],_0x4a39b6['user'][_0x7189('0x72')],_0x449f30[_0x7189('0x73')]['id'],_0x4a39b6[_0x7189('0x4b')]?JSON[_0x7189('0x1c')](_0x4a39b6['body']):_0x7189('0x74'));return respondWithRpcPromise(_0x7189('0x75'),_0x7189('0x76'),_0x449f30);}return null;})[_0x7189('0x16')](function(_0x20aa58){var _0x17b1b1=_0x7189('0x77')+_0x20aa58['message'][_0x7189('0x78')];return db[_0x7189('0x79')][_0x7189('0x36')](_0x17b1b1,{'type':db[_0x7189('0x7a')][_0x7189('0x7b')]['SELECT'],'raw':!![]})[_0x7189('0x16')](function(_0x467868){return _0x467868;});})['then'](function(_0xe96cb2){if(_0xe96cb2){_0x449f30[_0x7189('0x1f')][_0x7189('0x7c')]=_0xe96cb2[0x0];if(!_0x4a39b6[_0x7189('0x4b')][_0x7189('0x6c')])return;return db[_0x7189('0x7d')][_0x7189('0x4a')]({'where':{'id':_0x4a39b6[_0x7189('0x4b')]['UserId'],'role':_0x7189('0x7e')},'attributes':['id','name','fullname','email',_0x7189('0x7f')],'raw':!![]});}return null;})['then'](function(_0x478976){if(!_0x478976)return null;_0x449f30[_0x7189('0x1f')][_0x7189('0x7e')]=_0x478976;return _0x449f30;})[_0x7189('0x16')](function(_0xdd32de){if(_0xdd32de){if(_0x4a39b6[_0x7189('0x4b')][_0x7189('0x80')]){_0x449f30['message']['interface']=util['format'](_0x7189('0x81'),_0x4a39b6[_0x7189('0x5d')][_0x7189('0x2c')]);_0x449f30[_0x7189('0x1f')][_0x7189('0x82')]=_0x449f30[_0x7189('0x82')];_0x449f30[_0x7189('0x1f')]['motionChannel']=_0x449f30[_0x7189('0x82')];_0x449f30['message'][_0x7189('0x83')]=_0x7189('0x84');_0x449f30[_0x7189('0x1f')][_0x7189('0x4b')]=htmlToText[_0x7189('0x85')](_0x449f30['message']['body']);return respondWithRpcPromise(_0x7189('0x86'),_0x7189('0x86'),{'event':_0x7189('0x87'),'message':_0x449f30[_0x7189('0x1f')]},client9002)[_0x7189('0x16')](function(){return _0x449f30;});}return _0x449f30;}return null;})[_0x7189('0x16')](respondWithResult(_0x58ac3c,null))[_0x7189('0x20')](handleError(_0x58ac3c,null));};exports[_0x7189('0x88')]=function(_0x1f4b8c,_0x59257a){var _0x42d94c={'agent':{},'channel':_0x7189('0x69')};if(_0x1f4b8c[_0x7189('0x4b')]['id']){delete _0x1f4b8c[_0x7189('0x4b')]['id'];}_0x1f4b8c[_0x7189('0x4b')][_0x7189('0x6c')]=_0x1f4b8c[_0x7189('0x4b')][_0x7189('0x6c')]||_0x1f4b8c[_0x7189('0x5d')]['id'];_0x42d94c[_0x7189('0x7e')]['id']=_0x1f4b8c[_0x7189('0x4b')][_0x7189('0x6c')];return db['MailMessage'][_0x7189('0x4a')]({'where':{'id':_0x1f4b8c[_0x7189('0x47')]['id'],'UserId':null}})[_0x7189('0x16')](handleEntityNotFound(_0x59257a,null))[_0x7189('0x16')](function(_0x41f18c){if(_0x41f18c){_0x42d94c[_0x7189('0x1f')]=_0x41f18c[_0x7189('0x70')]({'plain':!![]});return db['MailInteraction'][_0x7189('0x4a')]({'where':{'id':_0x41f18c[_0x7189('0x89')]}});}return null;})[_0x7189('0x16')](handleEntityNotFound(_0x59257a,null))[_0x7189('0x16')](function(_0x46cdc3){if(_0x46cdc3){_0x42d94c[_0x7189('0x73')]=_0x46cdc3[_0x7189('0x70')]({'plain':!![]});interaction_log['info'](_0x7189('0x8a'),_0x1f4b8c[_0x7189('0x5d')]['id'],_0x1f4b8c[_0x7189('0x5d')][_0x7189('0x2c')],_0x1f4b8c[_0x7189('0x5d')][_0x7189('0x72')],_0x42d94c[_0x7189('0x73')]['id'],_0x1f4b8c['body']?JSON['stringify'](_0x1f4b8c['body']):'null');return respondWithRpcPromise(_0x7189('0x8b'),_0x7189('0x8c'),_0x42d94c);}return null;})[_0x7189('0x16')](function(_0xdee8c9){var _0x5c8894=_0x7189('0x77')+_0xdee8c9[_0x7189('0x1f')][_0x7189('0x78')];return db['sequelize'][_0x7189('0x36')](_0x5c8894,{'type':db[_0x7189('0x7a')][_0x7189('0x7b')]['SELECT'],'raw':!![]})[_0x7189('0x16')](function(_0x25601f){return _0x25601f;});})[_0x7189('0x16')](function(_0x467fe2){if(_0x467fe2){_0x42d94c[_0x7189('0x1f')][_0x7189('0x7c')]=_0x467fe2[0x0];if(!_0x1f4b8c['body']['UserId'])return;return db[_0x7189('0x7d')][_0x7189('0x4a')]({'where':{'id':_0x1f4b8c[_0x7189('0x4b')]['UserId'],'role':_0x7189('0x7e')},'attributes':['id',_0x7189('0x2c'),'fullname',_0x7189('0x8d'),'internal'],'raw':!![]});}return null;})[_0x7189('0x16')](function(_0xb11252){if(!_0xb11252)return null;_0x42d94c['message'][_0x7189('0x7e')]=_0xb11252;return _0x42d94c;})[_0x7189('0x16')](function(_0x3eda74){if(_0x3eda74){_0x3eda74[_0x7189('0x1f')][_0x7189('0x8e')]=util['format']('SIP/%s',_0x1f4b8c[_0x7189('0x5d')][_0x7189('0x2c')]);_0x3eda74[_0x7189('0x1f')]['channel']=_0x42d94c[_0x7189('0x82')];_0x3eda74['message'][_0x7189('0x8f')]=_0x42d94c[_0x7189('0x82')];_0x3eda74[_0x7189('0x1f')]['event']=_0x7189('0x88');_0x3eda74[_0x7189('0x1f')][_0x7189('0x4b')]=htmlToText['fromString'](_0x42d94c[_0x7189('0x1f')][_0x7189('0x4b')]);respondWithRpcPromise(_0x7189('0x86'),_0x7189('0x86'),{'event':_0x7189('0x90'),'message':_0x3eda74[_0x7189('0x1f')]},client9002);return _0x42d94c;}return null;})['then'](respondWithResult(_0x59257a,null))[_0x7189('0x20')](handleError(_0x59257a,null));};exports[_0x7189('0x91')]=function(_0x91d035,_0x5bc52e){var _0xcbafb3=moment()['unix']()[_0x7189('0x92')]();var _0x603eed=path['join'](config[_0x7189('0x93')],_0x7189('0x94'),_0x7189('0x95'),'tmp');var _0x2cf929=path[_0x7189('0x96')](config[_0x7189('0x93')],_0x7189('0x94'),_0x7189('0x95'),_0x7189('0x5f'));var _0x491bd5=util[_0x7189('0x6f')](_0x7189('0x97'),_0xcbafb3);return db['MailMessage'][_0x7189('0x4a')]({'where':{'id':_0x91d035['params']['id']},'attributes':['id','body',_0x7189('0x98'),'to','cc','bcc',_0x7189('0x99'),_0x7189('0x9a')],'include':_0x91d035['query']['attachments']?[{'model':db[_0x7189('0x9b')],'as':'Attachments'}]:undefined})[_0x7189('0x16')](handleEntityNotFound(_0x5bc52e,null))[_0x7189('0x16')](function(_0x34cfcd){if(_0x34cfcd){var _0x217cbe=_0x34cfcd;var _0x291c66={'from':_0x217cbe['from'],'to':_0x217cbe['to'],'subject':_0x217cbe[_0x7189('0x99')],'html':htmlEntities['decode'](_0x217cbe['body']),'headers':{'Date':moment(_0x217cbe[_0x7189('0x9a')])[_0x7189('0x6f')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x34cfcd['cc']){_0x291c66['headers']['Cc']=_0x34cfcd['cc'];}if(_0x34cfcd[_0x7189('0x9c')]){_0x291c66[_0x7189('0x9d')]['Bcc']=_0x34cfcd['bcc'];}return new BPromise(function(_0x2eab7e,_0x4b37b9){if(_0x34cfcd[_0x7189('0x9e')]){for(var _0x173153=0x0;_0x173153<_0x34cfcd[_0x7189('0x9e')][_0x7189('0x3c')];_0x173153++){var _0x53fbae=_0x34cfcd[_0x7189('0x9e')][_0x173153];var _0x47dca0=path[_0x7189('0x96')](_0x2cf929,_0x53fbae[_0x7189('0x60')]);if(fs[_0x7189('0x9f')](_0x47dca0)){_0x291c66[_0x7189('0x5f')][_0x7189('0xa0')]({'name':_0x53fbae[_0x7189('0x2c')],'contentType':_0x53fbae[_0x7189('0x33')],'data':fs[_0x7189('0xa1')](_0x47dca0)});}}}emlformat[_0x7189('0xa2')](_0x291c66,function(_0x1815e7,_0x235cf4){if(_0x1815e7)return _0x4b37b9(_0x1815e7);fs[_0x7189('0xa3')](path[_0x7189('0x96')](_0x603eed,_0x491bd5),_0x235cf4);return _0x2eab7e(_0x235cf4);});});}})[_0x7189('0x16')](function(_0x3a7d87){if(_0x3a7d87){return _0x5bc52e[_0x7189('0x91')](path[_0x7189('0x96')](_0x603eed,_0x491bd5),_0x491bd5,function(_0x4bb15){if(!_0x4bb15)fs['unlinkSync'](path[_0x7189('0x96')](_0x603eed,_0x491bd5));});}})[_0x7189('0x20')](handleError(_0x5bc52e,null));}; \ No newline at end of file +var _0x97de=['html-to-text','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','index','MailMessage','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','catch','show','include','options','find','body','params','describe','create','direction','out','split','CmList','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','pass','auth','user','attachments','root','server/files/attachments','List','CmContact','ListId','List\x20not\x20found','SendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','channel','motionChannel','event','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','User','reject','rejectmessage','download','unix','join','tmp','server','files','message-%s.eml','from','bcc','createdAt','Attachments','decode','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','ioredis'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x97de,0x13c));var _0xe97d=function(_0xfb963,_0x1b14de){_0xfb963=_0xfb963-0x0;var _0x38f03b=_0x97de[_0xfb963];return _0x38f03b;};'use strict';var emlformat=require(_0xe97d('0x0'));var moment=require(_0xe97d('0x1'));var BPromise=require(_0xe97d('0x2'));var util=require(_0xe97d('0x3'));var path=require(_0xe97d('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xe97d('0x5'));var htmlToText=require(_0xe97d('0x6'));var qs=require(_0xe97d('0x7'));var logger=require('../../config/logger')(_0xe97d('0x8'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0xe97d('0x9'));var db=require(_0xe97d('0xa'))['db'];config[_0xe97d('0xb')]=_['defaults'](config[_0xe97d('0xb')],{'host':_0xe97d('0xc'),'port':0x18eb});var socket=require(_0xe97d('0xd'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0xe97d('0xe'))[_0xe97d('0xf')](socket);var jayson=require(_0xe97d('0x10'));var client=jayson[_0xe97d('0x11')][_0xe97d('0x12')]({'port':0x232c});var client9003=jayson[_0xe97d('0x11')][_0xe97d('0x12')]({'port':0x232b});var client9002=jayson['client'][_0xe97d('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x5e48f9,_0x179bde,_0x4721e2,_0x618e06){return new BPromise(function(_0x4d6136,_0x1afb68){var _0x117c9a=_0x618e06||client;return _0x117c9a[_0xe97d('0x13')](_0x5e48f9,_0x4721e2)[_0xe97d('0x14')](function(_0x5d332e){logger[_0xe97d('0x15')](_0xe97d('0x16'),_0x179bde,_0xe97d('0x17'));logger[_0xe97d('0x18')](_0xe97d('0x19'),_0x179bde,_0xe97d('0x17'),JSON[_0xe97d('0x1a')](_0x5d332e));if(_0x5d332e[_0xe97d('0x1b')]){if(_0x5d332e[_0xe97d('0x1b')][_0xe97d('0x1c')]===0x1f4){logger[_0xe97d('0x1b')](_0xe97d('0x16'),_0x179bde,_0x5d332e[_0xe97d('0x1b')][_0xe97d('0x1d')]);return _0x1afb68(_0x5d332e[_0xe97d('0x1b')][_0xe97d('0x1d')]);}logger[_0xe97d('0x1b')](_0xe97d('0x16'),_0x179bde,_0x5d332e[_0xe97d('0x1b')][_0xe97d('0x1d')]);return _0x4d6136(_0x5d332e[_0xe97d('0x1b')][_0xe97d('0x1d')]);}else{logger[_0xe97d('0x15')](_0xe97d('0x16'),_0x179bde,_0xe97d('0x17'));_0x4d6136(_0x5d332e['result']['message']);}})['catch'](function(_0x39c815){logger[_0xe97d('0x1b')](_0xe97d('0x16'),_0x179bde,_0x39c815);_0x1afb68(_0x39c815);});});}function respondWithResult(_0x33fd27,_0x585bb7){_0x585bb7=_0x585bb7||0xc8;return function(_0x1f5f4a){if(_0x1f5f4a){return _0x33fd27[_0xe97d('0x1e')](_0x585bb7)[_0xe97d('0x1f')](_0x1f5f4a);}};}function respondWithFilteredResult(_0x13b377,_0x33c405){return function(_0x28a58c){if(_0x28a58c){var _0x20df76=typeof _0x33c405[_0xe97d('0x20')]==='undefined'&&typeof _0x33c405[_0xe97d('0x21')]===_0xe97d('0x22');var _0x69b15=_0x28a58c[_0xe97d('0x23')];var _0xfe4030=_0x20df76?0x0:_0x33c405['offset'];var _0x5ed8a0=_0x20df76?_0x28a58c[_0xe97d('0x23')]:_0x33c405['offset']+_0x33c405['limit'];var _0x470654;if(_0x5ed8a0>=_0x69b15){_0x5ed8a0=_0x69b15;_0x470654=0xc8;}else{_0x470654=0xce;}_0x13b377[_0xe97d('0x1e')](_0x470654);return _0x13b377[_0xe97d('0x24')](_0xe97d('0x25'),_0xfe4030+'-'+_0x5ed8a0+'/'+_0x69b15)[_0xe97d('0x1f')](_0x28a58c);}return null;};}function saveUpdates(_0x233fd3){return function(_0x2faabc){if(_0x2faabc){return _0x2faabc[_0xe97d('0x26')](_0x233fd3)[_0xe97d('0x14')](function(_0x960812){return _0x960812;});}return null;};}function removeEntity(_0x58c2d5){return function(_0x29ea41){if(_0x29ea41){return _0x29ea41[_0xe97d('0x27')]()[_0xe97d('0x14')](function(){_0x58c2d5['status'](0xcc)[_0xe97d('0x28')]();});}};}function handleEntityNotFound(_0x3e460b){return function(_0x3f2094){if(!_0x3f2094){_0x3e460b[_0xe97d('0x29')](0x194);}return _0x3f2094;};}function handleError(_0x9bca80,_0x9cc3a7){_0x9cc3a7=_0x9cc3a7||0x1f4;return function(_0x24f464){logger[_0xe97d('0x1b')](_0x24f464[_0xe97d('0x2a')]);if(_0x24f464[_0xe97d('0x2b')]){delete _0x24f464[_0xe97d('0x2b')];}_0x9bca80['status'](_0x9cc3a7)['send'](_0x24f464);};}exports[_0xe97d('0x2c')]=function(_0x17757b,_0x257e0a){var _0x3347a0={},_0x2db2e1={},_0x5e7600={'count':0x0,'rows':[]};var _0x48c676=_['map'](db[_0xe97d('0x2d')][_0xe97d('0x2e')],function(_0x22c249){return{'name':_0x22c249['fieldName'],'type':_0x22c249['type'][_0xe97d('0x2f')]};});_0x2db2e1[_0xe97d('0x30')]=_[_0xe97d('0x31')](_0x48c676,_0xe97d('0x2b'));_0x2db2e1[_0xe97d('0x32')]=_[_0xe97d('0x33')](_0x17757b[_0xe97d('0x32')]);_0x2db2e1[_0xe97d('0x34')]=_[_0xe97d('0x35')](_0x2db2e1['model'],_0x2db2e1[_0xe97d('0x32')]);_0x3347a0['attributes']=_['intersection'](_0x2db2e1['model'],qs[_0xe97d('0x36')](_0x17757b[_0xe97d('0x32')]['fields']));_0x3347a0[_0xe97d('0x37')]=_0x3347a0[_0xe97d('0x37')][_0xe97d('0x38')]?_0x3347a0['attributes']:_0x2db2e1['model'];if(!_0x17757b['query'][_0xe97d('0x39')](_0xe97d('0x3a'))){_0x3347a0[_0xe97d('0x21')]=qs[_0xe97d('0x21')](_0x17757b['query'][_0xe97d('0x21')]);_0x3347a0[_0xe97d('0x20')]=qs['offset'](_0x17757b[_0xe97d('0x32')]['offset']);}_0x3347a0[_0xe97d('0x3b')]=qs[_0xe97d('0x3c')](_0x17757b[_0xe97d('0x32')]['sort']);_0x3347a0[_0xe97d('0x3d')]=qs[_0xe97d('0x34')](_[_0xe97d('0x3e')](_0x17757b[_0xe97d('0x32')],_0x2db2e1[_0xe97d('0x34')]),_0x48c676);if(_0x17757b['query'][_0xe97d('0x3f')]){_0x3347a0[_0xe97d('0x3d')]=_[_0xe97d('0x40')](_0x3347a0[_0xe97d('0x3d')],{'$or':_['map'](_0x48c676,function(_0x180b06){if(_0x180b06[_0xe97d('0x41')]!==_0xe97d('0x42')){var _0x563da5={};_0x563da5[_0x180b06[_0xe97d('0x2b')]]={'$like':'%'+_0x17757b[_0xe97d('0x32')][_0xe97d('0x3f')]+'%'};return _0x563da5;}})});}_0x3347a0=_[_0xe97d('0x40')]({},_0x3347a0,_0x17757b['options']);var _0x473c0a={'where':_0x3347a0[_0xe97d('0x3d')]};return db[_0xe97d('0x2d')][_0xe97d('0x23')](_0x473c0a)[_0xe97d('0x14')](function(_0x59f466){_0x5e7600[_0xe97d('0x23')]=_0x59f466;if(_0x17757b[_0xe97d('0x32')]['includeAll']){_0x3347a0['include']=[{'all':!![]}];}return db[_0xe97d('0x2d')][_0xe97d('0x43')](_0x3347a0);})[_0xe97d('0x14')](function(_0x3c7cd3){_0x5e7600[_0xe97d('0x44')]=_0x3c7cd3;return _0x5e7600;})['then'](respondWithFilteredResult(_0x257e0a,_0x3347a0))[_0xe97d('0x45')](handleError(_0x257e0a,null));};exports[_0xe97d('0x46')]=function(_0x227180,_0x57141b){var _0x171f4e={'raw':!![],'where':{'id':_0x227180['params']['id']}},_0x350655={};_0x350655['model']=_[_0xe97d('0x33')](db['MailMessage'][_0xe97d('0x2e')]);_0x350655['query']=_['keys'](_0x227180[_0xe97d('0x32')]);_0x350655[_0xe97d('0x34')]=_[_0xe97d('0x35')](_0x350655['model'],_0x350655[_0xe97d('0x32')]);_0x171f4e[_0xe97d('0x37')]=_[_0xe97d('0x35')](_0x350655[_0xe97d('0x30')],qs[_0xe97d('0x36')](_0x227180[_0xe97d('0x32')][_0xe97d('0x36')]));_0x171f4e[_0xe97d('0x37')]=_0x171f4e[_0xe97d('0x37')][_0xe97d('0x38')]?_0x171f4e[_0xe97d('0x37')]:_0x350655['model'];if(_0x227180['query']['includeAll']){_0x171f4e[_0xe97d('0x47')]=[{'all':!![]}];}_0x171f4e=_['merge']({},_0x171f4e,_0x227180[_0xe97d('0x48')]);return db[_0xe97d('0x2d')][_0xe97d('0x49')](_0x171f4e)[_0xe97d('0x14')](handleEntityNotFound(_0x57141b,null))[_0xe97d('0x14')](respondWithResult(_0x57141b,null))['catch'](handleError(_0x57141b,null));};exports[_0xe97d('0x26')]=function(_0x2d4f3e,_0x4ea40c){if(_0x2d4f3e[_0xe97d('0x4a')]['id']){delete _0x2d4f3e['body']['id'];}return db['MailMessage'][_0xe97d('0x49')]({'where':{'id':_0x2d4f3e['params']['id']}})[_0xe97d('0x14')](handleEntityNotFound(_0x4ea40c,null))['then'](saveUpdates(_0x2d4f3e['body'],null))[_0xe97d('0x14')](respondWithResult(_0x4ea40c,null))[_0xe97d('0x45')](handleError(_0x4ea40c,null));};exports[_0xe97d('0x27')]=function(_0x3e6219,_0x570ab7){return db['MailMessage'][_0xe97d('0x49')]({'where':{'id':_0x3e6219[_0xe97d('0x4b')]['id']}})[_0xe97d('0x14')](handleEntityNotFound(_0x570ab7,null))[_0xe97d('0x14')](removeEntity(_0x570ab7,null))[_0xe97d('0x45')](handleError(_0x570ab7,null));};exports['describe']=function(_0x328096,_0xa79b11){return db[_0xe97d('0x2d')][_0xe97d('0x4c')]()[_0xe97d('0x14')](respondWithResult(_0xa79b11,null))['catch'](handleError(_0xa79b11,null));};exports[_0xe97d('0x4d')]=function(_0x4257ef,_0x4bb78d){return db[_0xe97d('0x2d')][_0xe97d('0x4d')](_0x4257ef['body'])['then'](function(_0x2aaa7e){if(_0x2aaa7e){if(_0x2aaa7e[_0xe97d('0x4e')]===_0xe97d('0x4f')&&!_0x2aaa7e['secret']){var _0x2977a8,_0x337968,_0x10dee3;if(_0x4257ef[_0xe97d('0x4a')]['to']){_0x337968=_0x4257ef[_0xe97d('0x4a')]['to'][_0xe97d('0x50')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x2aaa7e['MailAccountId']},'include':[{'model':db[_0xe97d('0x51')],'as':'List','include':[{'model':db['CmContact'],'as':_0xe97d('0x52'),'where':{'email':_0x337968},'limit':0x1,'order':[['updatedAt',_0xe97d('0x53')]]}]},{'model':db[_0xe97d('0x54')],'as':_0xe97d('0x55'),'raw':!![]}]})['then'](function(_0x2b7e8d){_0x2977a8=_0x2b7e8d;if(_0x2977a8&&_0x2977a8[_0xe97d('0x55')]){var _0x1fe002={'tls':{'rejectUnauthorized':![]}};if(_[_0xe97d('0x56')](_0x2977a8[_0xe97d('0x55')][_0xe97d('0x57')])){_0x1fe002['host']=_0x2977a8[_0xe97d('0x55')][_0xe97d('0x58')];_0x1fe002[_0xe97d('0x59')]=_0x2977a8['Smtp'][_0xe97d('0x59')];_0x1fe002[_0xe97d('0x5a')]=_0x2977a8['Smtp'][_0xe97d('0x5a')];if(_0x2977a8['Smtp']['authentication']){_0x1fe002['auth']={'user':_0x2977a8['Smtp']['user'],'pass':_0x2977a8['Smtp'][_0xe97d('0x5b')]};}}else{_0x1fe002[_0xe97d('0x57')]=_0x2977a8[_0xe97d('0x55')][_0xe97d('0x57')];_0x1fe002[_0xe97d('0x5c')]={'user':_0x2977a8[_0xe97d('0x55')][_0xe97d('0x5d')],'pass':_0x2977a8[_0xe97d('0x55')][_0xe97d('0x5b')]};_0x1fe002[_0xe97d('0x5a')]=_0x2977a8['Smtp'][_0xe97d('0x5a')];}if(_0x4257ef[_0xe97d('0x4a')]['attachments']&&_0x4257ef[_0xe97d('0x4a')][_0xe97d('0x5e')][_0xe97d('0x38')]){for(var _0x461fc0=0x0;_0x461fc0<_0x4257ef[_0xe97d('0x4a')]['attachments'][_0xe97d('0x38')];_0x461fc0+=0x1){_0x4257ef[_0xe97d('0x4a')]['attachments'][_0x461fc0]={'filename':_0x4257ef[_0xe97d('0x4a')][_0xe97d('0x5e')][_0x461fc0][_0xe97d('0x2b')],'path':path['join'](config[_0xe97d('0x5f')],_0xe97d('0x60'),_0x4257ef['body'][_0xe97d('0x5e')][_0x461fc0]['basename'])};}}_0x10dee3={'account':_0x1fe002,'message':_0x4257ef[_0xe97d('0x4a')]};return;}})[_0xe97d('0x14')](function(){if(_0x2977a8[_0xe97d('0x61')]){if(_0x2977a8[_0xe97d('0x61')][_0xe97d('0x52')][_0xe97d('0x38')]){return _0x2977a8[_0xe97d('0x61')]['Contacts'][0x0];}else{return db[_0xe97d('0x62')][_0xe97d('0x4d')](_['defaults'](_0x4257ef['body'],{'firstName':_0x4257ef[_0xe97d('0x4a')]['to'],'email':_0x4257ef[_0xe97d('0x4a')]['to'],'phone':_0x4257ef[_0xe97d('0x4a')]['to'],'ListId':_0x2977a8[_0xe97d('0x63')]}));}}else{throw new Error(_0xe97d('0x64'));}})[_0xe97d('0x14')](function(){if(_0x10dee3){return respondWithRpcPromise(_0xe97d('0x65'),'sendMail',_0x10dee3,client9003)[_0xe97d('0x14')](function(_0x4171bb){return _0x2aaa7e[_0xe97d('0x26')]({'read':!![],'messageId':_0x4171bb['messageId'],'sentAt':moment()[_0xe97d('0x66')](_0xe97d('0x67'))});})[_0xe97d('0x45')](function(_0x73f152){logger['error']('%s',JSON[_0xe97d('0x1a')](_0x73f152));return _0x2aaa7e;});}return _0x2aaa7e;});}return _0x2aaa7e;}})[_0xe97d('0x14')](respondWithResult(_0x4bb78d,0xc9))[_0xe97d('0x45')](handleError(_0x4bb78d,null));};exports[_0xe97d('0x68')]=function(_0x15c300,_0x43fac9){var _0x30f004={'agent':{},'channel':_0xe97d('0x69')};if(_0x15c300[_0xe97d('0x4a')]['id']){delete _0x15c300[_0xe97d('0x4a')]['id'];}_0x15c300[_0xe97d('0x4a')][_0xe97d('0x6a')]=!![];_0x15c300['body'][_0xe97d('0x6b')]=moment()[_0xe97d('0x66')](_0xe97d('0x67'));_0x15c300[_0xe97d('0x4a')][_0xe97d('0x6c')]=_0x15c300['body'][_0xe97d('0x6c')]||_0x15c300['user']['id'];_0x30f004[_0xe97d('0x6d')]['id']=_0x15c300[_0xe97d('0x4a')]['UserId'];return db[_0xe97d('0x2d')]['find']({'where':{'id':_0x15c300[_0xe97d('0x4b')]['id'],'UserId':null}})[_0xe97d('0x14')](handleEntityNotFound(_0x43fac9,null))[_0xe97d('0x14')](saveUpdates(_0x15c300['body'],null))[_0xe97d('0x14')](function(_0x183312){if(_0x183312){_0x30f004['message']=_0x183312[_0xe97d('0x6e')]({'plain':!![]});return db[_0xe97d('0x6f')][_0xe97d('0x49')]({'where':{'id':_0x183312[_0xe97d('0x70')]}});}return null;})[_0xe97d('0x14')](handleEntityNotFound(_0x43fac9,null))[_0xe97d('0x14')](function(_0x4a1b11){if(_0x4a1b11){return _0x4a1b11['update']({'UserId':_0x15c300['body'][_0xe97d('0x6c')],'read1stAt':_['isNil'](_0x4a1b11[_0xe97d('0x71')])?moment()[_0xe97d('0x66')](_0xe97d('0x67')):undefined});}return null;})[_0xe97d('0x14')](function(_0x5bcefa){if(_0x5bcefa){_0x30f004['interaction']=_0x5bcefa['get']({'plain':!![]});interaction_log[_0xe97d('0x15')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x15c300[_0xe97d('0x5d')]['id'],_0x15c300[_0xe97d('0x5d')][_0xe97d('0x2b')],_0x15c300[_0xe97d('0x5d')]['role'],_0x30f004[_0xe97d('0x72')]['id'],_0x15c300[_0xe97d('0x4a')]?JSON[_0xe97d('0x1a')](_0x15c300['body']):'null');return respondWithRpcPromise(_0xe97d('0x73'),'acceptMessage',_0x30f004);}return null;})[_0xe97d('0x14')](function(_0x56a31c){var _0x127f3e=_0xe97d('0x74')+_0x56a31c['message'][_0xe97d('0x75')];return db[_0xe97d('0x76')][_0xe97d('0x32')](_0x127f3e,{'type':db[_0xe97d('0x77')][_0xe97d('0x78')][_0xe97d('0x79')],'raw':!![]})[_0xe97d('0x14')](function(_0x8c6517){return _0x8c6517;});})[_0xe97d('0x14')](function(_0x325ccb){if(_0x325ccb){_0x30f004[_0xe97d('0x1d')][_0xe97d('0x7a')]=_0x325ccb[0x0];if(!_0x15c300['body'][_0xe97d('0x6c')])return;return db['User'][_0xe97d('0x49')]({'where':{'id':_0x15c300[_0xe97d('0x4a')][_0xe97d('0x6c')],'role':_0xe97d('0x6d')},'attributes':['id',_0xe97d('0x2b'),_0xe97d('0x7b'),_0xe97d('0x7c'),_0xe97d('0x7d')],'raw':!![]});}return null;})[_0xe97d('0x14')](function(_0x5121cc){if(!_0x5121cc)return null;_0x30f004[_0xe97d('0x1d')][_0xe97d('0x6d')]=_0x5121cc;return _0x30f004;})[_0xe97d('0x14')](function(_0x6f16a1){if(_0x6f16a1){if(_0x15c300['body'][_0xe97d('0x7e')]){_0x30f004[_0xe97d('0x1d')]['interface']=util[_0xe97d('0x66')]('SIP/%s',_0x15c300['user'][_0xe97d('0x2b')]);_0x30f004[_0xe97d('0x1d')][_0xe97d('0x7f')]=_0x30f004[_0xe97d('0x7f')];_0x30f004[_0xe97d('0x1d')][_0xe97d('0x80')]=_0x30f004[_0xe97d('0x7f')];_0x30f004[_0xe97d('0x1d')][_0xe97d('0x81')]='accept';_0x30f004[_0xe97d('0x1d')][_0xe97d('0x4a')]=htmlToText[_0xe97d('0x82')](_0x30f004[_0xe97d('0x1d')][_0xe97d('0x4a')]);return respondWithRpcPromise(_0xe97d('0x83'),'EventManager',{'event':_0xe97d('0x84'),'message':_0x30f004[_0xe97d('0x1d')]},client9002)['then'](function(){return _0x30f004;});}return _0x30f004;}return null;})[_0xe97d('0x14')](respondWithResult(_0x43fac9,null))[_0xe97d('0x45')](handleError(_0x43fac9,null));};exports['reject']=function(_0x1f3e06,_0x5413de){var _0x2466c7={'agent':{},'channel':_0xe97d('0x69')};if(_0x1f3e06['body']['id']){delete _0x1f3e06[_0xe97d('0x4a')]['id'];}_0x1f3e06[_0xe97d('0x4a')][_0xe97d('0x6c')]=_0x1f3e06[_0xe97d('0x4a')][_0xe97d('0x6c')]||_0x1f3e06['user']['id'];_0x2466c7[_0xe97d('0x6d')]['id']=_0x1f3e06[_0xe97d('0x4a')][_0xe97d('0x6c')];return db[_0xe97d('0x2d')][_0xe97d('0x49')]({'where':{'id':_0x1f3e06[_0xe97d('0x4b')]['id'],'UserId':null}})[_0xe97d('0x14')](handleEntityNotFound(_0x5413de,null))[_0xe97d('0x14')](function(_0x30944b){if(_0x30944b){_0x2466c7[_0xe97d('0x1d')]=_0x30944b['get']({'plain':!![]});return db[_0xe97d('0x6f')][_0xe97d('0x49')]({'where':{'id':_0x30944b['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5413de,null))['then'](function(_0x1eca84){if(_0x1eca84){_0x2466c7[_0xe97d('0x72')]=_0x1eca84[_0xe97d('0x6e')]({'plain':!![]});interaction_log[_0xe97d('0x15')](_0xe97d('0x85'),_0x1f3e06[_0xe97d('0x5d')]['id'],_0x1f3e06['user'][_0xe97d('0x2b')],_0x1f3e06['user'][_0xe97d('0x86')],_0x2466c7['interaction']['id'],_0x1f3e06[_0xe97d('0x4a')]?JSON[_0xe97d('0x1a')](_0x1f3e06[_0xe97d('0x4a')]):_0xe97d('0x87'));return respondWithRpcPromise(_0xe97d('0x88'),_0xe97d('0x89'),_0x2466c7);}return null;})[_0xe97d('0x14')](function(_0x10d55c){var _0x155316=_0xe97d('0x74')+_0x10d55c[_0xe97d('0x1d')][_0xe97d('0x75')];return db[_0xe97d('0x76')][_0xe97d('0x32')](_0x155316,{'type':db[_0xe97d('0x77')][_0xe97d('0x78')][_0xe97d('0x79')],'raw':!![]})['then'](function(_0x4e7f58){return _0x4e7f58;});})[_0xe97d('0x14')](function(_0x104e6d){if(_0x104e6d){_0x2466c7['message'][_0xe97d('0x7a')]=_0x104e6d[0x0];if(!_0x1f3e06[_0xe97d('0x4a')]['UserId'])return;return db[_0xe97d('0x8a')][_0xe97d('0x49')]({'where':{'id':_0x1f3e06['body']['UserId'],'role':_0xe97d('0x6d')},'attributes':['id',_0xe97d('0x2b'),_0xe97d('0x7b'),_0xe97d('0x7c'),'internal'],'raw':!![]});}return null;})[_0xe97d('0x14')](function(_0x34f7d4){if(!_0x34f7d4)return null;_0x2466c7[_0xe97d('0x1d')]['agent']=_0x34f7d4;return _0x2466c7;})[_0xe97d('0x14')](function(_0x439653){if(_0x439653){_0x439653[_0xe97d('0x1d')]['interface']=util['format']('SIP/%s',_0x1f3e06[_0xe97d('0x5d')][_0xe97d('0x2b')]);_0x439653[_0xe97d('0x1d')][_0xe97d('0x7f')]=_0x2466c7[_0xe97d('0x7f')];_0x439653[_0xe97d('0x1d')]['motionChannel']=_0x2466c7[_0xe97d('0x7f')];_0x439653[_0xe97d('0x1d')][_0xe97d('0x81')]=_0xe97d('0x8b');_0x439653[_0xe97d('0x1d')][_0xe97d('0x4a')]=htmlToText[_0xe97d('0x82')](_0x2466c7[_0xe97d('0x1d')]['body']);respondWithRpcPromise('EventManager',_0xe97d('0x83'),{'event':_0xe97d('0x8c'),'message':_0x439653['message']},client9002);return _0x2466c7;}return null;})[_0xe97d('0x14')](respondWithResult(_0x5413de,null))[_0xe97d('0x45')](handleError(_0x5413de,null));};exports[_0xe97d('0x8d')]=function(_0x4fbd3b,_0xf389be){var _0x588654=moment()[_0xe97d('0x8e')]()['toString']();var _0x39a2ac=path[_0xe97d('0x8f')](config[_0xe97d('0x5f')],'server','files',_0xe97d('0x90'));var _0x47afb2=path['join'](config['root'],_0xe97d('0x91'),_0xe97d('0x92'),_0xe97d('0x5e'));var _0x2737da=util['format'](_0xe97d('0x93'),_0x588654);return db[_0xe97d('0x2d')]['find']({'where':{'id':_0x4fbd3b[_0xe97d('0x4b')]['id']},'attributes':['id',_0xe97d('0x4a'),_0xe97d('0x94'),'to','cc',_0xe97d('0x95'),'subject',_0xe97d('0x96')],'include':_0x4fbd3b['query'][_0xe97d('0x5e')]?[{'model':db['Attachment'],'as':_0xe97d('0x97')}]:undefined})['then'](handleEntityNotFound(_0xf389be,null))['then'](function(_0x13fd5b){if(_0x13fd5b){var _0x5cdb61=_0x13fd5b;var _0x76c843={'from':_0x5cdb61[_0xe97d('0x94')],'to':_0x5cdb61['to'],'subject':_0x5cdb61['subject'],'html':htmlEntities[_0xe97d('0x98')](_0x5cdb61[_0xe97d('0x4a')]),'headers':{'Date':moment(_0x5cdb61[_0xe97d('0x96')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x13fd5b['cc']){_0x76c843['headers']['Cc']=_0x13fd5b['cc'];}if(_0x13fd5b[_0xe97d('0x95')]){_0x76c843[_0xe97d('0x99')][_0xe97d('0x9a')]=_0x13fd5b[_0xe97d('0x95')];}return new BPromise(function(_0xf25297,_0x361b0e){if(_0x13fd5b['Attachments']){for(var _0x2ff7f1=0x0;_0x2ff7f1<_0x13fd5b[_0xe97d('0x97')]['length'];_0x2ff7f1++){var _0x5739e4=_0x13fd5b[_0xe97d('0x97')][_0x2ff7f1];var _0x8f631e=path[_0xe97d('0x8f')](_0x47afb2,_0x5739e4[_0xe97d('0x9b')]);if(fs[_0xe97d('0x9c')](_0x8f631e)){_0x76c843[_0xe97d('0x5e')]['push']({'name':_0x5739e4[_0xe97d('0x2b')],'contentType':_0x5739e4[_0xe97d('0x41')],'data':fs[_0xe97d('0x9d')](_0x8f631e)});}}}emlformat[_0xe97d('0x9e')](_0x76c843,function(_0x5e35cd,_0x4dae30){if(_0x5e35cd)return _0x361b0e(_0x5e35cd);fs[_0xe97d('0x9f')](path[_0xe97d('0x8f')](_0x39a2ac,_0x2737da),_0x4dae30);return _0xf25297(_0x4dae30);});});}})['then'](function(_0x4b6a99){if(_0x4b6a99){return _0xf389be['download'](path[_0xe97d('0x8f')](_0x39a2ac,_0x2737da),_0x2737da,function(_0x115c72){if(!_0x115c72)fs[_0xe97d('0xa0')](path[_0xe97d('0x8f')](_0x39a2ac,_0x2737da));});}})[_0xe97d('0x45')](handleError(_0xf389be,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 56ba37c..37dcfd0 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 _0x24a5=['events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x29e181,_0x3028a8){var _0x4b544f=function(_0x368342){while(--_0x368342){_0x29e181['push'](_0x29e181['shift']());}};_0x4b544f(++_0x3028a8);}(_0x24a5,0xb4));var _0x524a=function(_0x2bdbe0,_0xe495d7){_0x2bdbe0=_0x2bdbe0-0x0;var _0xe90f49=_0x24a5[_0x2bdbe0];return _0xe90f49;};'use strict';var EventEmitter=require(_0x524a('0x0'));var MailMessage=require(_0x524a('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x524a('0x2'),'afterUpdate':_0x524a('0x3'),'afterDestroy':_0x524a('0x4')};function emitEvent(_0x4e3909){return function(_0xc0f77,_0x5ade1d,_0x566b55){MailMessageEvents[_0x524a('0x5')](_0x4e3909+':'+_0xc0f77['id'],_0xc0f77);MailMessageEvents[_0x524a('0x5')](_0x4e3909,_0xc0f77);_0x566b55(null);};}for(var e in events){if(events[_0x524a('0x6')](e)){var event=events[e];MailMessage[_0x524a('0x7')](e,emitEvent(event));}}module[_0x524a('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xfee5=['exports','events','../../mysqldb','MailMessage','save','remove','emit','hasOwnProperty'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xfee5,0x121));var _0x5fee=function(_0x3cf1eb,_0x474bf6){_0x3cf1eb=_0x3cf1eb-0x0;var _0x230397=_0xfee5[_0x3cf1eb];return _0x230397;};'use strict';var EventEmitter=require(_0x5fee('0x0'));var MailMessage=require(_0x5fee('0x1'))['db'][_0x5fee('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5fee('0x3'),'afterUpdate':'update','afterDestroy':_0x5fee('0x4')};function emitEvent(_0x391f77){return function(_0x5e2dc7,_0x3df84e,_0x40b07f){MailMessageEvents[_0x5fee('0x5')](_0x391f77+':'+_0x5e2dc7['id'],_0x5e2dc7);MailMessageEvents[_0x5fee('0x5')](_0x391f77,_0x5e2dc7);_0x40b07f(null);};}for(var e in events){if(events[_0x5fee('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x5fee('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index f6a2fd1..19fa4dd 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 _0x2cc7=['plainBody','subject','FULLTEXT','body','get','toLowerCase','direction','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId'];(function(_0x47f712,_0x502cd5){var _0x145272=function(_0x20278c){while(--_0x20278c){_0x47f712['push'](_0x47f712['shift']());}};_0x145272(++_0x502cd5);}(_0x2cc7,0x9c));var _0x72cc=function(_0x40fc62,_0x134c7e){_0x40fc62=_0x40fc62-0x0;var _0x1cf8c9=_0x2cc7[_0x40fc62];return _0x1cf8c9;};'use strict';var _=require(_0x72cc('0x0'));var util=require(_0x72cc('0x1'));var logger=require('../../config/logger')(_0x72cc('0x2'));var moment=require(_0x72cc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0x72cc('0x4'));var fs=require('fs');var path=require(_0x72cc('0x5'));var rimraf=require(_0x72cc('0x6'));var config=require(_0x72cc('0x7'));var attributes=require(_0x72cc('0x8'));module[_0x72cc('0x9')]=function(_0x1f3802,_0x18eb6d){return _0x1f3802[_0x72cc('0xa')](_0x72cc('0xb'),attributes,{'tableName':_0x72cc('0xc'),'paranoid':![],'indexes':[{'name':_0x72cc('0xd'),'fields':['messageId']},{'name':'fti_mail_messages','fields':[_0x72cc('0xe'),_0x72cc('0xf')],'type':_0x72cc('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1a97e5,_0x35d53e,_0x1d1c03){if(_0x1a97e5['body']){_0x1a97e5[_0x72cc('0xe')]=htmlToText['fromString'](_0x1a97e5[_0x72cc('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1d1c03(null,_0x35d53e);},'afterCreate':function(_0x57c181,_0x27299a,_0x179847){var _0x34d48c=_0x1f3802['models'];var _0xbdbf97=_0x57c181[_0x72cc('0x12')]({'plain':!![]});if(_0xbdbf97['direction'][_0x72cc('0x13')]()==='in'||_0xbdbf97[_0x72cc('0x14')][_0x72cc('0x13')]()===_0x72cc('0x15')&&!_0xbdbf97[_0x72cc('0x16')]&&!_[_0x72cc('0x17')](_0xbdbf97[_0x72cc('0x18')])){_0x34d48c[_0x72cc('0x19')][_0x72cc('0x1a')]({'where':{'id':_0xbdbf97[_0x72cc('0x1b')]}})[_0x72cc('0x1c')](function(_0x2c1def){if(_0x2c1def){_0x2c1def[_0x72cc('0x1d')]({'lastMsgAt':_0xbdbf97[_0x72cc('0x1e')],'lastMsgDirection':_0xbdbf97[_0x72cc('0x14')][_0x72cc('0x13')]()});}})['catch'](function(_0x40e85e){console[_0x72cc('0x1f')](_0x40e85e);});}_0x179847();}},'charset':_0x72cc('0x20'),'collate':_0x72cc('0x21')});}; \ No newline at end of file +var _0x3818=['body','fromString','models','get','toLowerCase','direction','out','secret','UserId','MailInteraction','findOne','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','messageId','plainBody','subject'];(function(_0x5046ce,_0x30cbe0){var _0x5c283b=function(_0x5e3902){while(--_0x5e3902){_0x5046ce['push'](_0x5046ce['shift']());}};_0x5c283b(++_0x30cbe0);}(_0x3818,0x1d2));var _0x8381=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3818[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x8381('0x0'));var logger=require(_0x8381('0x1'))(_0x8381('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8381('0x3'));var htmlToText=require(_0x8381('0x4'));var fs=require('fs');var path=require(_0x8381('0x5'));var rimraf=require(_0x8381('0x6'));var config=require(_0x8381('0x7'));var attributes=require(_0x8381('0x8'));module[_0x8381('0x9')]=function(_0xd93c50,_0x4ea06a){return _0xd93c50[_0x8381('0xa')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x8381('0xb')]},{'name':'fti_mail_messages','fields':[_0x8381('0xc'),_0x8381('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x462935,_0x326c95,_0x8f7f6f){if(_0x462935[_0x8381('0xe')]){_0x462935[_0x8381('0xc')]=htmlToText[_0x8381('0xf')](_0x462935[_0x8381('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x8f7f6f(null,_0x326c95);},'afterCreate':function(_0x5a37e5,_0x502dd8,_0x577858){var _0x2f4b72=_0xd93c50[_0x8381('0x10')];var _0x53257d=_0x5a37e5[_0x8381('0x11')]({'plain':!![]});if(_0x53257d['direction'][_0x8381('0x12')]()==='in'||_0x53257d[_0x8381('0x13')]['toLowerCase']()===_0x8381('0x14')&&!_0x53257d[_0x8381('0x15')]&&!_['isNil'](_0x53257d[_0x8381('0x16')])){_0x2f4b72[_0x8381('0x17')][_0x8381('0x18')]({'where':{'id':_0x53257d[_0x8381('0x19')]}})[_0x8381('0x1a')](function(_0x561361){if(_0x561361){_0x561361[_0x8381('0x1b')]({'lastMsgAt':_0x53257d['createdAt'],'lastMsgDirection':_0x53257d[_0x8381('0x13')][_0x8381('0x12')]()});}})[_0x8381('0x1c')](function(_0x1e5dad){console[_0x8381('0x1d')](_0x1e5dad);});}_0x577858();}},'charset':_0x8381('0x1e'),'collate':_0x8381('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 067bd5d..d2df720 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 _0xed3c=['request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateMailMessage','MailMessage','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','localhost','register'];(function(_0x49add0,_0x2e889f){var _0xdc1894=function(_0x147572){while(--_0x147572){_0x49add0['push'](_0x49add0['shift']());}};_0xdc1894(++_0x2e889f);}(_0xed3c,0x1a6));var _0xced3=function(_0xee37f1,_0x189f43){_0xee37f1=_0xee37f1-0x0;var _0x37fd54=_0xed3c[_0xee37f1];return _0x37fd54;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));var BPromise=require(_0xced3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xced3('0x4'));var db=require(_0xced3('0x5'))['db'];var utils=require(_0xced3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xced3('0x7'));var jayson=require(_0xced3('0x8'));var client=jayson[_0xced3('0x9')][_0xced3('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xced3('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailMessage.socket')[_0xced3('0xc')](socket);function respondWithRpcPromise(_0x321c42,_0x3e5a04,_0x12612f){return new BPromise(function(_0x1cb639,_0x5934b2){return client[_0xced3('0xd')](_0x321c42,_0x12612f)[_0xced3('0xe')](function(_0x3da0ff){logger['info'](_0xced3('0xf'),_0x3e5a04,_0xced3('0x10'));logger[_0xced3('0x11')](_0xced3('0x12'),_0x3e5a04,_0xced3('0x10'),JSON[_0xced3('0x13')](_0x3da0ff));if(_0x3da0ff[_0xced3('0x14')]){if(_0x3da0ff['error'][_0xced3('0x15')]===0x1f4){logger['error'](_0xced3('0xf'),_0x3e5a04,_0x3da0ff[_0xced3('0x14')][_0xced3('0x16')]);return _0x5934b2(_0x3da0ff[_0xced3('0x14')]['message']);}logger[_0xced3('0x14')](_0xced3('0xf'),_0x3e5a04,_0x3da0ff['error'][_0xced3('0x16')]);return _0x1cb639(_0x3da0ff[_0xced3('0x14')][_0xced3('0x16')]);}else{logger[_0xced3('0x17')]('MailMessage,\x20%s,\x20%s',_0x3e5a04,_0xced3('0x10'));_0x1cb639(_0x3da0ff['result'][_0xced3('0x16')]);}})[_0xced3('0x18')](function(_0x32c402){logger[_0xced3('0x14')](_0xced3('0xf'),_0x3e5a04,_0x32c402);_0x5934b2(_0x32c402);});});}exports[_0xced3('0x19')]=function(_0xe0cf2e){var _0x16d30d=this;return new Promise(function(_0x3f688c,_0x17c011){return db[_0xced3('0x1a')]['create'](_0xe0cf2e['body'],{'raw':_0xe0cf2e['options']?_0xe0cf2e[_0xced3('0x1b')][_0xced3('0x1c')]===undefined?!![]:![]:!![]})[_0xced3('0xe')](function(_0x4bf915){logger[_0xced3('0x17')](_0xced3('0x19'),_0xe0cf2e);logger['debug']('CreateMailMessage',_0xe0cf2e,JSON[_0xced3('0x13')](_0x4bf915));_0x3f688c(_0x4bf915);})[_0xced3('0x18')](function(_0x219fa8){logger[_0xced3('0x14')]('CreateMailMessage',_0x219fa8[_0xced3('0x16')],_0xe0cf2e);_0x17c011(_0x16d30d[_0xced3('0x14')](0x1f4,_0x219fa8['message']));});});}; \ No newline at end of file +var _0x3423=['./mailMessage.socket','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','CreateMailMessage','MailMessage','body','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x25c57f,_0x1a3564){var _0x3c86ac=function(_0x5842ca){while(--_0x5842ca){_0x25c57f['push'](_0x25c57f['shift']());}};_0x3c86ac(++_0x1a3564);}(_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 moment=require(_0x3342('0x0'));var BPromise=require(_0x3342('0x1'));var rs=require(_0x3342('0x2'));var fs=require('fs');var Redis=require(_0x3342('0x3'));var db=require(_0x3342('0x4'))['db'];var utils=require(_0x3342('0x5'));var logger=require(_0x3342('0x6'))(_0x3342('0x7'));var config=require(_0x3342('0x8'));var jayson=require(_0x3342('0x9'));var client=jayson[_0x3342('0xa')][_0x3342('0xb')]({'port':0x232a});config[_0x3342('0xc')]=_[_0x3342('0xd')](config[_0x3342('0xc')],{'host':_0x3342('0xe'),'port':0x18eb});var socket=require(_0x3342('0xf'))(new Redis(config[_0x3342('0xc')]));require(_0x3342('0x10'))['register'](socket);function respondWithRpcPromise(_0x582c37,_0x2d0cb0,_0x481a17){return new BPromise(function(_0x5a1fba,_0x51b276){return client['request'](_0x582c37,_0x481a17)[_0x3342('0x11')](function(_0x2f3c47){logger['info'](_0x3342('0x12'),_0x2d0cb0,'request\x20sent');logger[_0x3342('0x13')](_0x3342('0x14'),_0x2d0cb0,'request\x20sent',JSON[_0x3342('0x15')](_0x2f3c47));if(_0x2f3c47[_0x3342('0x16')]){if(_0x2f3c47[_0x3342('0x16')][_0x3342('0x17')]===0x1f4){logger[_0x3342('0x16')](_0x3342('0x12'),_0x2d0cb0,_0x2f3c47[_0x3342('0x16')]['message']);return _0x51b276(_0x2f3c47[_0x3342('0x16')][_0x3342('0x18')]);}logger['error'](_0x3342('0x12'),_0x2d0cb0,_0x2f3c47[_0x3342('0x16')]['message']);return _0x5a1fba(_0x2f3c47['error'][_0x3342('0x18')]);}else{logger[_0x3342('0x19')](_0x3342('0x12'),_0x2d0cb0,_0x3342('0x1a'));_0x5a1fba(_0x2f3c47[_0x3342('0x1b')][_0x3342('0x18')]);}})[_0x3342('0x1c')](function(_0x3ebf6b){logger[_0x3342('0x16')]('MailMessage,\x20%s,\x20%s',_0x2d0cb0,_0x3ebf6b);_0x51b276(_0x3ebf6b);});});}exports[_0x3342('0x1d')]=function(_0xda235a){var _0x2f6395=this;return new Promise(function(_0x5e05f5,_0x3cb86f){return db[_0x3342('0x1e')]['create'](_0xda235a[_0x3342('0x1f')],{'raw':_0xda235a[_0x3342('0x20')]?_0xda235a['options'][_0x3342('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x3f271c){logger[_0x3342('0x19')](_0x3342('0x1d'),_0xda235a);logger[_0x3342('0x13')](_0x3342('0x1d'),_0xda235a,JSON[_0x3342('0x15')](_0x3f271c));_0x5e05f5(_0x3f271c);})[_0x3342('0x1c')](function(_0x2d8622){logger['error'](_0x3342('0x1d'),_0x2d8622['message'],_0xda235a);_0x3cb86f(_0x2f6395['error'](0x1f4,_0x2d8622[_0x3342('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 9186a52..75ddf8a 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 _0x58a0=['length','./mailMessage.events','emit','removeListener','register'];(function(_0x136290,_0x3e6b8f){var _0x290e92=function(_0x4095d6){while(--_0x4095d6){_0x136290['push'](_0x136290['shift']());}};_0x290e92(++_0x3e6b8f);}(_0x58a0,0xa6));var _0x058a=function(_0x493fc9,_0x597cf9){_0x493fc9=_0x493fc9-0x0;var _0x3a90c3=_0x58a0[_0x493fc9];return _0x3a90c3;};'use strict';var MailMessageEvents=require(_0x058a('0x0'));var events=['save','remove','update'];function createListener(_0x26f045,_0x16a7b1){return function(_0x1ec157){_0x16a7b1[_0x058a('0x1')](_0x26f045,_0x1ec157);};}function removeListener(_0x3188e5,_0x207bb7){return function(){MailMessageEvents[_0x058a('0x2')](_0x3188e5,_0x207bb7);};}exports[_0x058a('0x3')]=function(_0x215a32){for(var _0x4f0757=0x0,_0x1d1d80=events[_0x058a('0x4')];_0x4f0757<_0x1d1d80;_0x4f0757++){var _0x5ad235=events[_0x4f0757];var _0x52684b=createListener('mailMessage:'+_0x5ad235,_0x215a32);MailMessageEvents['on'](_0x5ad235,_0x52684b);}}; \ No newline at end of file +var _0xbfb8=['remove','update','emit','register','length','./mailMessage.events','save'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0xbfb8,0x194));var _0x8bfb=function(_0x48a202,_0x5ca151){_0x48a202=_0x48a202-0x0;var _0x5f5599=_0xbfb8[_0x48a202];return _0x5f5599;};'use strict';var MailMessageEvents=require(_0x8bfb('0x0'));var events=[_0x8bfb('0x1'),_0x8bfb('0x2'),_0x8bfb('0x3')];function createListener(_0xa341d5,_0x339a46){return function(_0x595804){_0x339a46[_0x8bfb('0x4')](_0xa341d5,_0x595804);};}function removeListener(_0x41c5d1,_0x5b3558){return function(){MailMessageEvents['removeListener'](_0x41c5d1,_0x5b3558);};}exports[_0x8bfb('0x5')]=function(_0x539ff2){for(var _0x4bf6c2=0x0,_0xc8aa1f=events[_0x8bfb('0x6')];_0x4bf6c2<_0xc8aa1f;_0x4bf6c2++){var _0x187a10=events[_0x4bf6c2];var _0xc44f90=createListener('mailMessage:'+_0x187a10,_0x539ff2);MailMessageEvents['on'](_0x187a10,_0xc44f90);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 6e913dc..5e2bba1 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 _0xc4aa=['addTeams','post','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create'];(function(_0x3ba57e,_0x2e6810){var _0x5d95cf=function(_0x8017a0){while(--_0x8017a0){_0x3ba57e['push'](_0x3ba57e['shift']());}};_0x5d95cf(++_0x2e6810);}(_0xc4aa,0x81));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0xac4a('0x0'));var util=require('util');var path=require(_0xac4a('0x1'));var timeout=require(_0xac4a('0x2'));var express=require('express');var router=express[_0xac4a('0x3')]();var fs_extra=require(_0xac4a('0x4'));var auth=require(_0xac4a('0x5'));var interaction=require(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var controller=require(_0xac4a('0x8'));router[_0xac4a('0x9')]('/',auth[_0xac4a('0xa')](),controller[_0xac4a('0xb')]);router[_0xac4a('0x9')](_0xac4a('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xac4a('0x9')](_0xac4a('0xd'),auth[_0xac4a('0xa')](),controller[_0xac4a('0xe')]);router[_0xac4a('0x9')](_0xac4a('0xf'),auth[_0xac4a('0xa')](),controller[_0xac4a('0x10')]);router[_0xac4a('0x9')](_0xac4a('0x11'),auth['isAuthenticated'](),controller[_0xac4a('0x12')]);router[_0xac4a('0x9')](_0xac4a('0x13'),auth[_0xac4a('0xa')](),controller['getAgents']);router['post']('/',auth[_0xac4a('0xa')](),controller[_0xac4a('0x14')]);router['post'](_0xac4a('0x11'),auth[_0xac4a('0xa')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x16')](_0xac4a('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0xac4a('0x17')]('/:id',auth[_0xac4a('0xa')](),controller[_0xac4a('0x18')]);router[_0xac4a('0x19')]('/:id',auth[_0xac4a('0xa')](),controller[_0xac4a('0x1a')]);router[_0xac4a('0x19')](_0xac4a('0x11'),auth[_0xac4a('0xa')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x19')](_0xac4a('0x13'),auth[_0xac4a('0xa')](),controller[_0xac4a('0x1c')]);module[_0xac4a('0x1d')]=router; \ No newline at end of file +var _0x8cac=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','/:id/teams','removeTeams','exports','multer'];(function(_0x37e227,_0xd8424a){var _0x3e2a86=function(_0xaf4ace){while(--_0xaf4ace){_0x37e227['push'](_0x37e227['shift']());}};_0x3e2a86(++_0xd8424a);}(_0x8cac,0xe7));var _0xc8ca=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x8cac[_0x15bc81];return _0x59440e;};'use strict';var multer=require(_0xc8ca('0x0'));var util=require(_0xc8ca('0x1'));var path=require(_0xc8ca('0x2'));var timeout=require(_0xc8ca('0x3'));var express=require('express');var router=express[_0xc8ca('0x4')]();var fs_extra=require(_0xc8ca('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc8ca('0x6'));var config=require(_0xc8ca('0x7'));var controller=require(_0xc8ca('0x8'));router[_0xc8ca('0x9')]('/',auth[_0xc8ca('0xa')](),controller[_0xc8ca('0xb')]);router['get'](_0xc8ca('0xc'),auth[_0xc8ca('0xa')](),controller['describe']);router['get'](_0xc8ca('0xd'),auth[_0xc8ca('0xa')](),controller[_0xc8ca('0xe')]);router['get'](_0xc8ca('0xf'),auth[_0xc8ca('0xa')](),controller[_0xc8ca('0x10')]);router[_0xc8ca('0x9')]('/:id/teams',auth[_0xc8ca('0xa')](),controller['getTeams']);router[_0xc8ca('0x9')](_0xc8ca('0x11'),auth[_0xc8ca('0xa')](),controller[_0xc8ca('0x12')]);router[_0xc8ca('0x13')]('/',auth[_0xc8ca('0xa')](),controller[_0xc8ca('0x14')]);router[_0xc8ca('0x13')]('/:id/teams',auth[_0xc8ca('0xa')](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xc8ca('0x15')]);router[_0xc8ca('0x16')]('/:id',auth[_0xc8ca('0xa')](),controller[_0xc8ca('0x17')]);router[_0xc8ca('0x18')](_0xc8ca('0xd'),auth[_0xc8ca('0xa')](),controller[_0xc8ca('0x19')]);router[_0xc8ca('0x18')](_0xc8ca('0x1a'),auth[_0xc8ca('0xa')](),controller[_0xc8ca('0x1b')]);router['delete'](_0xc8ca('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xc8ca('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index c6b8b59..16695de 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 _0x10a8=['INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING','name'];(function(_0x55846b,_0x1cb6ba){var _0x32e73f=function(_0x5c488f){while(--_0x5c488f){_0x55846b['push'](_0x55846b['shift']());}};_0x32e73f(++_0x1cb6ba);}(_0x10a8,0x1e1));var _0x810a=function(_0xda16f4,_0x2fed76){_0xda16f4=_0xda16f4-0x0;var _0x328d78=_0x10a8[_0xda16f4];return _0x328d78;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x810a('0x0')],'unique':_0x810a('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x810a('0x0')]},'timeout':{'type':Sequelize[_0x810a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x810a('0x3')](_0x810a('0x4'),_0x810a('0x5'),_0x810a('0x6'))}}; \ No newline at end of file +var _0xc638=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x3b918b,_0x2edc55){var _0x57d988=function(_0x1a4463){while(--_0x1a4463){_0x3b918b['push'](_0x3b918b['shift']());}};_0x57d988(++_0x2edc55);}(_0xc638,0xd1));var _0x8c63=function(_0x39b8ca,_0x2b9313){_0x39b8ca=_0x39b8ca-0x0;var _0xd05f7=_0xc638[_0x39b8ca];return _0xd05f7;};'use strict';var Sequelize=require(_0x8c63('0x0'));module['exports']={'name':{'type':Sequelize[_0x8c63('0x1')],'unique':_0x8c63('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8c63('0x1')]},'timeout':{'type':Sequelize[_0x8c63('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8c63('0x4')](_0x8c63('0x5'),'beepall',_0x8c63('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 7e5a426..c618d42 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 _0x20ce=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','rows','keys','include','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','pick','findAll','User','findAndCountAll','UserId','agent','updatedAt','format','SIP','mailPause','createdAt','Team','getTeams','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userMailQueue:save','removeTeams','ids','field','from','team_has_mail_queues','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x46c3c5,_0x2a352f){var _0x2f62d7=function(_0x5e3396){while(--_0x5e3396){_0x46c3c5['push'](_0x46c3c5['shift']());}};_0x2f62d7(++_0x2a352f);}(_0x20ce,0x10d));var _0xe20c=function(_0x4013c6,_0x38b9af){_0x4013c6=_0x4013c6-0x0;var _0x37a85c=_0x20ce[_0x4013c6];return _0x37a85c;};'use strict';var emlformat=require(_0xe20c('0x0'));var rimraf=require(_0xe20c('0x1'));var zipdir=require(_0xe20c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe20c('0x3'));var moment=require(_0xe20c('0x4'));var BPromise=require(_0xe20c('0x5'));var Mustache=require(_0xe20c('0x6'));var util=require(_0xe20c('0x7'));var path=require(_0xe20c('0x8'));var sox=require(_0xe20c('0x9'));var csv=require(_0xe20c('0xa'));var ejs=require(_0xe20c('0xb'));var fs=require('fs');var fs_extra=require(_0xe20c('0xc'));var _=require(_0xe20c('0xd'));var squel=require(_0xe20c('0xe'));var crypto=require(_0xe20c('0xf'));var jsforce=require(_0xe20c('0x10'));var deskjs=require(_0xe20c('0x11'));var toCsv=require(_0xe20c('0xa'));var querystring=require(_0xe20c('0x12'));var Papa=require(_0xe20c('0x13'));var Redis=require(_0xe20c('0x14'));var authService=require(_0xe20c('0x15'));var qs=require(_0xe20c('0x16'));var as=require(_0xe20c('0x17'));var hardwareService=require(_0xe20c('0x18'));var logger=require(_0xe20c('0x19'))('api');var utils=require(_0xe20c('0x1a'));var config=require(_0xe20c('0x1b'));var licenseUtil=require(_0xe20c('0x1c'));var db=require(_0xe20c('0x1d'))['db'];config[_0xe20c('0x1e')]=_['defaults'](config[_0xe20c('0x1e')],{'host':_0xe20c('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe20c('0x1e')]));require(_0xe20c('0x20'))[_0xe20c('0x21')](socket);function respondWithStatusCode(_0x4971ee,_0xdd8451){_0xdd8451=_0xdd8451||0xcc;return function(_0x3f135f){if(_0x3f135f){return _0x4971ee[_0xe20c('0x22')](_0xdd8451);}return _0x4971ee[_0xe20c('0x23')](_0xdd8451)['end']();};}function respondWithResult(_0x5c6a8a,_0x5a1ed5){_0x5a1ed5=_0x5a1ed5||0xc8;return function(_0x2015ed){if(_0x2015ed){return _0x5c6a8a[_0xe20c('0x23')](_0x5a1ed5)[_0xe20c('0x24')](_0x2015ed);}};}function respondWithFilteredResult(_0x1eec43,_0x74b741){return function(_0x2d58a7){if(_0x2d58a7){var _0x2a4292=typeof _0x74b741[_0xe20c('0x25')]===_0xe20c('0x26')&&typeof _0x74b741[_0xe20c('0x27')]==='undefined';var _0x464b23=_0x2d58a7[_0xe20c('0x28')];var _0x4455fa=_0x2a4292?0x0:_0x74b741[_0xe20c('0x25')];var _0x563352=_0x2a4292?_0x2d58a7['count']:_0x74b741[_0xe20c('0x25')]+_0x74b741[_0xe20c('0x27')];var _0x3d67a3;if(_0x563352>=_0x464b23){_0x563352=_0x464b23;_0x3d67a3=0xc8;}else{_0x3d67a3=0xce;}_0x1eec43['status'](_0x3d67a3);return _0x1eec43['set'](_0xe20c('0x29'),_0x4455fa+'-'+_0x563352+'/'+_0x464b23)[_0xe20c('0x24')](_0x2d58a7);}return null;};}function patchUpdates(_0x3c8556){return function(_0x205ba3){try{jsonpatch['apply'](_0x205ba3,_0x3c8556,!![]);}catch(_0x146010){return BPromise['reject'](_0x146010);}return _0x205ba3[_0xe20c('0x2a')]();};}function saveUpdates(_0x15f9d1,_0x41a519){return function(_0x33c260){if(_0x33c260){return _0x33c260[_0xe20c('0x2b')](_0x15f9d1)[_0xe20c('0x2c')](function(_0x12846c){return _0x12846c;});}return null;};}function removeEntity(_0x47b3e8,_0x2f8035){return function(_0x136f2b){if(_0x136f2b){return _0x136f2b[_0xe20c('0x2d')]()[_0xe20c('0x2c')](function(){var _0x2dd621=_0x136f2b[_0xe20c('0x2e')]({'plain':!![]});var _0x8d061b=_0xe20c('0x2f');return db[_0xe20c('0x30')][_0xe20c('0x2d')]({'where':{'type':_0x8d061b,'resourceId':_0x2dd621['id']}})[_0xe20c('0x2c')](function(){return _0x136f2b;});})[_0xe20c('0x2c')](function(){_0x47b3e8[_0xe20c('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34666d,_0x54df97){return function(_0x4b4af3){if(!_0x4b4af3){_0x34666d[_0xe20c('0x22')](0x194);}return _0x4b4af3;};}function handleError(_0x3edcbe,_0x131ca6){_0x131ca6=_0x131ca6||0x1f4;return function(_0x4e17e4){logger[_0xe20c('0x31')](_0x4e17e4[_0xe20c('0x32')]);if(_0x4e17e4[_0xe20c('0x33')]){delete _0x4e17e4[_0xe20c('0x33')];}_0x3edcbe['status'](_0x131ca6)[_0xe20c('0x34')](_0x4e17e4);};}exports[_0xe20c('0x35')]=function(_0x57275d,_0x126772){var _0xa95121={},_0x100f23={},_0x2220cb={'count':0x0,'rows':[]};var _0xa1b03b=_[_0xe20c('0x36')](db[_0xe20c('0x37')][_0xe20c('0x38')],function(_0x1e5d34){return{'name':_0x1e5d34[_0xe20c('0x39')],'type':_0x1e5d34['type'][_0xe20c('0x3a')]};});_0x100f23[_0xe20c('0x3b')]=_[_0xe20c('0x36')](_0xa1b03b,_0xe20c('0x33'));_0x100f23[_0xe20c('0x3c')]=_['keys'](_0x57275d[_0xe20c('0x3c')]);_0x100f23[_0xe20c('0x3d')]=_[_0xe20c('0x3e')](_0x100f23['model'],_0x100f23['query']);_0xa95121[_0xe20c('0x3f')]=_[_0xe20c('0x3e')](_0x100f23[_0xe20c('0x3b')],qs[_0xe20c('0x40')](_0x57275d[_0xe20c('0x3c')][_0xe20c('0x40')]));_0xa95121[_0xe20c('0x3f')]=_0xa95121[_0xe20c('0x3f')][_0xe20c('0x41')]?_0xa95121['attributes']:_0x100f23['model'];if(!_0x57275d[_0xe20c('0x3c')][_0xe20c('0x42')]('nolimit')){_0xa95121[_0xe20c('0x27')]=qs['limit'](_0x57275d[_0xe20c('0x3c')][_0xe20c('0x27')]);_0xa95121[_0xe20c('0x25')]=qs['offset'](_0x57275d['query']['offset']);}_0xa95121[_0xe20c('0x43')]=qs[_0xe20c('0x44')](_0x57275d[_0xe20c('0x3c')]['sort']);_0xa95121[_0xe20c('0x45')]=qs[_0xe20c('0x3d')](_['pick'](_0x57275d['query'],_0x100f23[_0xe20c('0x3d')]),_0xa1b03b);if(_0x57275d[_0xe20c('0x3c')][_0xe20c('0x46')]){_0xa95121[_0xe20c('0x45')]=_[_0xe20c('0x47')](_0xa95121[_0xe20c('0x45')],{'$or':_[_0xe20c('0x36')](_0xa1b03b,function(_0x53ea49){if(_0x53ea49['type']!==_0xe20c('0x48')){var _0x31b16d={};_0x31b16d[_0x53ea49[_0xe20c('0x33')]]={'$like':'%'+_0x57275d[_0xe20c('0x3c')][_0xe20c('0x46')]+'%'};return _0x31b16d;}})});}_0xa95121=_['merge']({},_0xa95121,_0x57275d['options']);var _0x5b86f0={'where':_0xa95121['where']};return db[_0xe20c('0x37')][_0xe20c('0x28')](_0x5b86f0)['then'](function(_0x458185){_0x2220cb[_0xe20c('0x28')]=_0x458185;if(_0x57275d[_0xe20c('0x3c')][_0xe20c('0x49')]){_0xa95121['include']=[{'all':!![]}];}return db[_0xe20c('0x37')]['findAll'](_0xa95121);})[_0xe20c('0x2c')](function(_0x22b13f){_0x2220cb[_0xe20c('0x4a')]=_0x22b13f;return _0x2220cb;})['then'](respondWithFilteredResult(_0x126772,_0xa95121))['catch'](handleError(_0x126772,null));};exports['show']=function(_0x3565d5,_0x4aa90a){var _0x19cbd3={'raw':!![],'where':{'id':_0x3565d5['params']['id']}},_0x3871cb={};_0x3871cb[_0xe20c('0x3b')]=_['keys'](db['MailQueue'][_0xe20c('0x38')]);_0x3871cb['query']=_[_0xe20c('0x4b')](_0x3565d5[_0xe20c('0x3c')]);_0x3871cb[_0xe20c('0x3d')]=_[_0xe20c('0x3e')](_0x3871cb[_0xe20c('0x3b')],_0x3871cb[_0xe20c('0x3c')]);_0x19cbd3[_0xe20c('0x3f')]=_[_0xe20c('0x3e')](_0x3871cb[_0xe20c('0x3b')],qs[_0xe20c('0x40')](_0x3565d5[_0xe20c('0x3c')][_0xe20c('0x40')]));_0x19cbd3[_0xe20c('0x3f')]=_0x19cbd3[_0xe20c('0x3f')][_0xe20c('0x41')]?_0x19cbd3[_0xe20c('0x3f')]:_0x3871cb['model'];if(_0x3565d5[_0xe20c('0x3c')]['includeAll']){_0x19cbd3[_0xe20c('0x4c')]=[{'all':!![]}];}_0x19cbd3=_['merge']({},_0x19cbd3,_0x3565d5[_0xe20c('0x4d')]);return db[_0xe20c('0x37')][_0xe20c('0x4e')](_0x19cbd3)[_0xe20c('0x2c')](handleEntityNotFound(_0x4aa90a,null))['then'](respondWithResult(_0x4aa90a,null))[_0xe20c('0x4f')](handleError(_0x4aa90a,null));};exports[_0xe20c('0x50')]=function(_0x4c0c98,_0x5b276d){return db[_0xe20c('0x37')]['create'](_0x4c0c98[_0xe20c('0x51')],{})[_0xe20c('0x2c')](function(_0x479c16){var _0x373695=_0x4c0c98[_0xe20c('0x52')][_0xe20c('0x2e')]({'plain':!![]});if(!_0x373695)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x373695[_0xe20c('0x53')]==='user'){var _0x128cbf=_0x479c16['get']({'plain':!![]});var _0xedc5be=_0xe20c('0x2f');return db[_0xe20c('0x54')][_0xe20c('0x4e')]({'where':{'name':_0xedc5be,'userProfileId':_0x373695[_0xe20c('0x55')]},'raw':!![]})[_0xe20c('0x2c')](function(_0x2c263a){if(_0x2c263a&&_0x2c263a[_0xe20c('0x56')]===0x0){return db[_0xe20c('0x30')]['create']({'name':_0x128cbf[_0xe20c('0x33')],'resourceId':_0x128cbf['id'],'type':_0x2c263a[_0xe20c('0x33')],'sectionId':_0x2c263a['id']},{})['then'](function(){return _0x479c16;});}else{return _0x479c16;}})[_0xe20c('0x4f')](function(_0x47de09){logger[_0xe20c('0x31')](_0xe20c('0x57'),_0x47de09);throw _0x47de09;});}return _0x479c16;})['then'](respondWithResult(_0x5b276d,0xc9))[_0xe20c('0x4f')](handleError(_0x5b276d,null));};exports['update']=function(_0x12208e,_0x112810){if(_0x12208e[_0xe20c('0x51')]['id']){delete _0x12208e[_0xe20c('0x51')]['id'];}return db[_0xe20c('0x37')][_0xe20c('0x4e')]({'where':{'id':_0x12208e[_0xe20c('0x58')]['id']}})[_0xe20c('0x2c')](handleEntityNotFound(_0x112810,null))[_0xe20c('0x2c')](saveUpdates(_0x12208e['body'],null))['then'](respondWithResult(_0x112810,null))[_0xe20c('0x4f')](handleError(_0x112810,null));};exports['destroy']=function(_0x9bfa45,_0x3ad513){return db[_0xe20c('0x37')][_0xe20c('0x4e')]({'where':{'id':_0x9bfa45[_0xe20c('0x58')]['id']}})[_0xe20c('0x2c')](handleEntityNotFound(_0x3ad513,null))[_0xe20c('0x2c')](removeEntity(_0x3ad513,null))[_0xe20c('0x4f')](handleError(_0x3ad513,null));};exports[_0xe20c('0x59')]=function(_0x4da05e,_0x359d19){return db[_0xe20c('0x37')][_0xe20c('0x59')]()[_0xe20c('0x2c')](respondWithResult(_0x359d19,null))[_0xe20c('0x4f')](handleError(_0x359d19,null));};exports[_0xe20c('0x5a')]=function(_0x90e82d,_0x188f9f,_0x59f8f3){var _0x270887={'raw':!![],'where':{}},_0x5223a9={},_0x406459;return db[_0xe20c('0x37')][_0xe20c('0x5b')]({'where':{'id':_0x90e82d['params']['id']}})[_0xe20c('0x2c')](handleEntityNotFound(_0x188f9f,null))[_0xe20c('0x2c')](function(_0x5d8e16){if(_0x5d8e16){_0x406459=_0x5d8e16['get']({'plain':!![]});_0x5223a9[_0xe20c('0x3b')]=_[_0xe20c('0x4b')](db[_0xe20c('0x5c')][_0xe20c('0x38')]);_0x5223a9[_0xe20c('0x3c')]=_[_0xe20c('0x4b')](_0x90e82d[_0xe20c('0x3c')]);_0x5223a9['filters']=_[_0xe20c('0x3e')](_0x5223a9[_0xe20c('0x3b')],_0x5223a9['query']);_0x270887['attributes']=_[_0xe20c('0x3e')](_0x5223a9[_0xe20c('0x3b')],qs[_0xe20c('0x40')](_0x90e82d[_0xe20c('0x3c')][_0xe20c('0x40')]));_0x270887['attributes']=_0x270887[_0xe20c('0x3f')][_0xe20c('0x41')]?_0x270887['attributes']:_0x5223a9[_0xe20c('0x3b')];if(!_0x90e82d['query'][_0xe20c('0x42')]('nolimit')){_0x270887[_0xe20c('0x27')]=qs[_0xe20c('0x27')](_0x90e82d['query'][_0xe20c('0x27')]);_0x270887[_0xe20c('0x25')]=qs[_0xe20c('0x25')](_0x90e82d[_0xe20c('0x3c')][_0xe20c('0x25')]);}_0x270887[_0xe20c('0x43')]=qs[_0xe20c('0x44')](_0x90e82d[_0xe20c('0x3c')]['sort']);_0x270887[_0xe20c('0x45')]=qs[_0xe20c('0x3d')](_[_0xe20c('0x5d')](_0x90e82d[_0xe20c('0x3c')],_0x5223a9['filters']));_0x270887[_0xe20c('0x45')]['MailQueueId']=_0x5d8e16['id'];if(_0x90e82d['query'][_0xe20c('0x46')]){_0x270887[_0xe20c('0x45')]=_[_0xe20c('0x47')](_0x270887[_0xe20c('0x45')],{'$or':_[_0xe20c('0x36')](_0x270887[_0xe20c('0x3f')],function(_0x406753){var _0x5f2a43={};_0x5f2a43[_0x406753]={'$like':'%'+_0x90e82d[_0xe20c('0x3c')][_0xe20c('0x46')]+'%'};return _0x5f2a43;})});}_0x270887=_[_0xe20c('0x47')]({},_0x270887,_0x90e82d[_0xe20c('0x4d')]);return db['UserMailQueue'][_0xe20c('0x5e')](_0x270887);}})[_0xe20c('0x2c')](function(_0x379220){if(_0x379220){return db[_0xe20c('0x5f')][_0xe20c('0x60')]({'where':{'id':_[_0xe20c('0x36')](_0x379220,_0xe20c('0x61')),'role':_0xe20c('0x62')},'attributes':['id',_0xe20c('0x33'),'mailPause',_0xe20c('0x63'),'createdAt']});}})[_0xe20c('0x2c')](function(_0x4732de){if(_0x4732de){return{'count':_0x4732de[_0xe20c('0x28')],'rows':_[_0xe20c('0x36')](_0x4732de[_0xe20c('0x4a')],function(_0x5b78bd){return{'membername':_0x5b78bd[_0xe20c('0x33')],'UserId':_0x5b78bd['id'],'queue_name':_0x406459[_0xe20c('0x33')],'MailQueueId':_0x406459['id'],'interface':util[_0xe20c('0x64')]('%s/%s',_0xe20c('0x65'),_0x5b78bd['name']),'penalty':0x0,'paused':_0x5b78bd[_0xe20c('0x66')],'createdAt':_0x5b78bd[_0xe20c('0x67')],'updatedAt':_0x5b78bd[_0xe20c('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe20c('0x2c')](respondWithFilteredResult(_0x188f9f,_0x270887))[_0xe20c('0x4f')](handleError(_0x188f9f,null));};exports['getTeams']=function(_0x304ba7,_0x1df7ad,_0x54a592){var _0x1ec341={};var _0x2ff8a5={};var _0x4f050b;var _0x359fcd;return db[_0xe20c('0x37')]['findOne']({'where':{'id':_0x304ba7[_0xe20c('0x58')]['id']}})[_0xe20c('0x2c')](handleEntityNotFound(_0x1df7ad,null))['then'](function(_0x567804){if(_0x567804){_0x4f050b=_0x567804;_0x2ff8a5[_0xe20c('0x3b')]=_['keys'](db[_0xe20c('0x68')][_0xe20c('0x38')]);_0x2ff8a5['query']=_[_0xe20c('0x4b')](_0x304ba7[_0xe20c('0x3c')]);_0x2ff8a5[_0xe20c('0x3d')]=_[_0xe20c('0x3e')](_0x2ff8a5[_0xe20c('0x3b')],_0x2ff8a5[_0xe20c('0x3c')]);_0x1ec341['attributes']=_[_0xe20c('0x3e')](_0x2ff8a5['model'],qs[_0xe20c('0x40')](_0x304ba7[_0xe20c('0x3c')][_0xe20c('0x40')]));_0x1ec341[_0xe20c('0x3f')]=_0x1ec341[_0xe20c('0x3f')][_0xe20c('0x41')]?_0x1ec341[_0xe20c('0x3f')]:_0x2ff8a5[_0xe20c('0x3b')];_0x1ec341['order']=qs[_0xe20c('0x44')](_0x304ba7['query']['sort']);_0x1ec341[_0xe20c('0x45')]=qs[_0xe20c('0x3d')](_['pick'](_0x304ba7[_0xe20c('0x3c')],_0x2ff8a5[_0xe20c('0x3d')]));if(_0x304ba7['query'][_0xe20c('0x46')]){_0x1ec341[_0xe20c('0x45')]=_[_0xe20c('0x47')](_0x1ec341[_0xe20c('0x45')],{'$or':_[_0xe20c('0x36')](_0x1ec341[_0xe20c('0x3f')],function(_0x5c7473){var _0x4a2874={};_0x4a2874[_0x5c7473]={'$like':'%'+_0x304ba7[_0xe20c('0x3c')][_0xe20c('0x46')]+'%'};return _0x4a2874;})});}_0x1ec341=_[_0xe20c('0x47')]({},_0x1ec341,_0x304ba7[_0xe20c('0x4d')]);return _0x4f050b[_0xe20c('0x69')](_0x1ec341);}})['then'](function(_0x98932a){if(_0x98932a){_0x359fcd=_0x98932a[_0xe20c('0x41')];if(!_0x304ba7[_0xe20c('0x3c')][_0xe20c('0x42')]('nolimit')){_0x1ec341[_0xe20c('0x27')]=qs['limit'](_0x304ba7[_0xe20c('0x3c')][_0xe20c('0x27')]);_0x1ec341[_0xe20c('0x25')]=qs['offset'](_0x304ba7[_0xe20c('0x3c')][_0xe20c('0x25')]);}return _0x4f050b[_0xe20c('0x69')](_0x1ec341);}})['then'](function(_0x223dd0){if(_0x223dd0){return _0x223dd0?{'count':_0x359fcd,'rows':_0x223dd0}:null;}})[_0xe20c('0x2c')](respondWithResult(_0x1df7ad,null))[_0xe20c('0x4f')](handleError(_0x1df7ad,null));};exports[_0xe20c('0x6a')]=function(_0x40ffd3,_0x386db3,_0x598e89){var _0x3d04b8=_0x40ffd3['body']['ids'];return db[_0xe20c('0x68')]['findAll']({'where':{'id':_0x3d04b8},'attributes':['id'],'include':[{'model':db[_0xe20c('0x5f')],'as':_0xe20c('0x6b'),'attributes':['id','name','online',_0xe20c('0x6c'),_0xe20c('0x6d')],'raw':!![]}]})['then'](function(_0x3f84e3){if(_0x3f84e3){var _0x3125d9=_[_0xe20c('0x6e')](_0x3f84e3,function(_0x58381b){var _0xb0ac35=_0x58381b[_0xe20c('0x2e')]({'plain':!![]});return _0xb0ac35['Agents'];});return db[_0xe20c('0x37')]['find']({'where':{'id':_0x40ffd3[_0xe20c('0x58')]['id']}})[_0xe20c('0x2c')](function(_0x1c1ff6){return db[_0xe20c('0x6f')][_0xe20c('0x70')](function(_0xcf21b0){return _0x1c1ff6[_0xe20c('0x6a')](_0x3d04b8,{'transaction':_0xcf21b0})['then'](function(){return BPromise[_0xe20c('0x71')](_0x3125d9,function(_0x50d8b2){return db[_0xe20c('0x5c')]['findOrCreate']({'where':{'UserId':_0x50d8b2['id'],'MailQueueId':_0x40ffd3[_0xe20c('0x58')]['id']},'transaction':_0xcf21b0});});})[_0xe20c('0x2c')](function(){_0x3125d9[_0xe20c('0x72')](function(_0x24e21d){socket[_0xe20c('0x73')](_0xe20c('0x74'),{'UserId':_0x24e21d['id'],'MailQueueId':_0x1c1ff6['id']});});});});});}})[_0xe20c('0x2c')](respondWithStatusCode(_0x386db3,null))[_0xe20c('0x4f')](handleError(_0x386db3,null));};exports[_0xe20c('0x75')]=function(_0x384d34,_0x4dc83e,_0x351166){return db[_0xe20c('0x68')]['findAll']({'where':{'id':_0x384d34[_0xe20c('0x3c')][_0xe20c('0x76')]},'attributes':['id'],'include':[{'model':db[_0xe20c('0x5f')],'as':_0xe20c('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xe20c('0x2c')](handleEntityNotFound(_0x4dc83e,null))[_0xe20c('0x2c')](function(_0x78aa0b){var _0xf963b2=_[_0xe20c('0x36')](_0x78aa0b,'id');var _0x1c449f=[];var _0x5ed036=[];var _0x51df1a=squel['select']();_0x51df1a[_0xe20c('0x77')]('tq.TeamId')[_0xe20c('0x78')](_0xe20c('0x79'),'tq')['join']('user_has_teams','ut',_0xe20c('0x7a'))[_0xe20c('0x45')]('MailQueueId\x20=\x20?',_0x384d34[_0xe20c('0x58')]['id']);for(var _0x54264c=0x0;_0x54264c<_0x78aa0b[_0xe20c('0x41')];_0x54264c+=0x1){let _0x488daf=_0x78aa0b[_0x54264c];for(var _0x3e9291=0x0;_0x3e9291<_0x488daf['Agents'][_0xe20c('0x41')];_0x3e9291+=0x1){let _0x38b22e=_0x488daf[_0xe20c('0x6b')][_0x3e9291];var _0x5ad316=_0x51df1a[_0xe20c('0x7b')]();_0x5ad316['where'](_0xe20c('0x7c'),_0x38b22e['id']);_0x5ed036['push'](db[_0xe20c('0x6f')]['query'](_0x5ad316[_0xe20c('0x7d')](),{'type':db[_0xe20c('0x6f')][_0xe20c('0x7e')][_0xe20c('0x7f')]})[_0xe20c('0x2c')](function(_0x3d9961){if(_0x3d9961[_0xe20c('0x41')]===0x1){return _0x38b22e['id'];}else{var _0x209e97=_[_0xe20c('0x80')](_[_0xe20c('0x36')](_0x3d9961,_0xe20c('0x81')),function(_0x2f5767){return _[_0xe20c('0x82')](_0xf963b2,_0x2f5767);});if(_0x209e97){return _0x38b22e['id'];}}}));}}return BPromise[_0xe20c('0x83')](_0x5ed036)[_0xe20c('0x2c')](function(_0x1237a0){_0x1c449f=_(_0x1c449f)['union'](_0x1237a0)[_0xe20c('0x84')]()[_0xe20c('0x85')]();return db['MailQueue'][_0xe20c('0x4e')]({'where':{'id':_0x384d34[_0xe20c('0x58')]['id']}})[_0xe20c('0x2c')](function(_0x1dd06a){return db['sequelize']['transaction'](function(_0x2d25b6){return _0x1dd06a[_0xe20c('0x75')](_0x384d34[_0xe20c('0x3c')][_0xe20c('0x76')],{'transaction':_0x2d25b6})[_0xe20c('0x2c')](function(){if(!_[_0xe20c('0x86')](_0x1c449f)){return _0x1dd06a['removeAgents'](_0x1c449f,{'transaction':_0x2d25b6});}})[_0xe20c('0x2c')](function(){_0x1c449f[_0xe20c('0x72')](function(_0x3f69e3){socket['emit'](_0xe20c('0x87'),{'UserId':_0x3f69e3,'MailQueueId':_0x1dd06a['id']});});});});});});})['then'](respondWithStatusCode(_0x4dc83e,null))[_0xe20c('0x4f')](handleError(_0x4dc83e,null));};exports[_0xe20c('0x88')]=function(_0x5b8bb3,_0x46d8c0,_0x10a2ea){return db['MailQueue'][_0xe20c('0x4e')]({'where':{'id':_0x5b8bb3['params']['id']}})['then'](handleEntityNotFound(_0x46d8c0,null))[_0xe20c('0x2c')](function(_0x2f9649){if(_0x2f9649){return _0x2f9649[_0xe20c('0x88')](_0x5b8bb3[_0xe20c('0x51')][_0xe20c('0x76')],_[_0xe20c('0x89')](_0x5b8bb3['body'],[_0xe20c('0x76'),'id'])||{})[_0xe20c('0x8a')](function(_0x3800d8){for(var _0x585a72=0x0;_0x585a72<_0x5b8bb3[_0xe20c('0x51')]['ids'][_0xe20c('0x41')];_0x585a72+=0x1){socket[_0xe20c('0x73')](_0xe20c('0x74'),{'UserId':Number(_0x5b8bb3[_0xe20c('0x51')][_0xe20c('0x76')][_0x585a72]),'MailQueueId':Number(_0x5b8bb3[_0xe20c('0x58')]['id'])});}return _0x3800d8;});}})[_0xe20c('0x2c')](respondWithResult(_0x46d8c0,null))['catch'](handleError(_0x46d8c0,null));};exports[_0xe20c('0x8b')]=function(_0x22dbfe,_0x3897da,_0x2c41fc){return db['MailQueue']['find']({'where':{'id':_0x22dbfe[_0xe20c('0x58')]['id']}})[_0xe20c('0x2c')](handleEntityNotFound(_0x3897da,null))[_0xe20c('0x2c')](function(_0x34929d){if(_0x34929d){return _0x34929d[_0xe20c('0x8b')](_0x22dbfe['query']['ids'])[_0xe20c('0x2c')](function(){if(_[_0xe20c('0x8c')](_0x22dbfe['query'][_0xe20c('0x76')])){for(var _0x1f5f23=0x0;_0x1f5f23<_0x22dbfe[_0xe20c('0x3c')][_0xe20c('0x76')][_0xe20c('0x41')];_0x1f5f23+=0x1){socket['emit'](_0xe20c('0x87'),{'UserId':Number(_0x22dbfe[_0xe20c('0x3c')][_0xe20c('0x76')][_0x1f5f23]),'MailQueueId':Number(_0x22dbfe[_0xe20c('0x58')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x22dbfe[_0xe20c('0x3c')]['ids']),'MailQueueId':Number(_0x22dbfe[_0xe20c('0x58')]['id'])});}});}})[_0xe20c('0x2c')](respondWithStatusCode(_0x3897da,null))[_0xe20c('0x4f')](handleError(_0x3897da,null));};exports['getAgents']=function(_0x3c0e37,_0x7efa19,_0x16e709){var _0x3f28bd={};var _0x16a3ae={};var _0x3da279;var _0x20980d;return db[_0xe20c('0x37')][_0xe20c('0x5b')]({'where':{'id':_0x3c0e37['params']['id']}})[_0xe20c('0x2c')](handleEntityNotFound(_0x7efa19,null))[_0xe20c('0x2c')](function(_0x1bd8c6){if(_0x1bd8c6){_0x3da279=_0x1bd8c6;_0x16a3ae['model']=_[_0xe20c('0x4b')](db[_0xe20c('0x5f')][_0xe20c('0x38')]);_0x16a3ae['query']=_[_0xe20c('0x4b')](_0x3c0e37[_0xe20c('0x3c')]);_0x16a3ae[_0xe20c('0x3d')]=_['intersection'](_0x16a3ae[_0xe20c('0x3b')],_0x16a3ae[_0xe20c('0x3c')]);_0x3f28bd[_0xe20c('0x3f')]=_[_0xe20c('0x3e')](_0x16a3ae[_0xe20c('0x3b')],qs[_0xe20c('0x40')](_0x3c0e37['query']['fields']));_0x3f28bd[_0xe20c('0x3f')]=_0x3f28bd[_0xe20c('0x3f')][_0xe20c('0x41')]?_0x3f28bd[_0xe20c('0x3f')]:_0x16a3ae['model'];_0x3f28bd['order']=qs[_0xe20c('0x44')](_0x3c0e37[_0xe20c('0x3c')]['sort']);_0x3f28bd['where']=qs['filters'](_[_0xe20c('0x5d')](_0x3c0e37[_0xe20c('0x3c')],_0x16a3ae[_0xe20c('0x3d')]));if(_0x3c0e37[_0xe20c('0x3c')][_0xe20c('0x46')]){_0x3f28bd[_0xe20c('0x45')]=_[_0xe20c('0x47')](_0x3f28bd['where'],{'$or':_[_0xe20c('0x36')](_0x3f28bd[_0xe20c('0x3f')],function(_0x18edf8){var _0x2ba3b3={};_0x2ba3b3[_0x18edf8]={'$like':'%'+_0x3c0e37[_0xe20c('0x3c')][_0xe20c('0x46')]+'%'};return _0x2ba3b3;})});}_0x3f28bd=_[_0xe20c('0x47')]({},_0x3f28bd,_0x3c0e37[_0xe20c('0x4d')]);return _0x3da279[_0xe20c('0x8d')](_0x3f28bd);}})[_0xe20c('0x2c')](function(_0x8b1955){if(_0x8b1955){_0x20980d=_0x8b1955[_0xe20c('0x41')];if(!_0x3c0e37[_0xe20c('0x3c')]['hasOwnProperty'](_0xe20c('0x8e'))){_0x3f28bd[_0xe20c('0x27')]=qs[_0xe20c('0x27')](_0x3c0e37[_0xe20c('0x3c')][_0xe20c('0x27')]);_0x3f28bd[_0xe20c('0x25')]=qs[_0xe20c('0x25')](_0x3c0e37[_0xe20c('0x3c')]['offset']);}return _0x3da279['getAgents'](_0x3f28bd);}})[_0xe20c('0x2c')](function(_0xda7f55){if(_0xda7f55){return _0xda7f55?{'count':_0x20980d,'rows':_0xda7f55}:null;}})[_0xe20c('0x2c')](respondWithResult(_0x7efa19,null))['catch'](handleError(_0x7efa19,null));}; \ No newline at end of file +var _0x8e44=['tq.TeamId','from','team_has_mail_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','SELECT','TeamId','all','transaction','removeAgents','userMailQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','MailQueues','error','stack','name','map','MailQueue','rawAttributes','fieldName','keys','query','intersection','model','attributes','fields','length','nolimit','limit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','UserMailQueue','hasOwnProperty','order','MailQueueId','User','UserId','agent','mailPause','createdAt','rows','format','%s/%s','SIP','updatedAt','findOne','getTeams','Team','Agents','online','voicePause','interface','sequelize','addTeams','each','forEach','userMailQueue:save','removeTeams','ids','select','field'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x8e44,0x1ac));var _0x48e4=function(_0x2747b2,_0x10dce8){_0x2747b2=_0x2747b2-0x0;var _0x540db0=_0x8e44[_0x2747b2];return _0x540db0;};'use strict';var emlformat=require(_0x48e4('0x0'));var rimraf=require(_0x48e4('0x1'));var zipdir=require(_0x48e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x48e4('0x3'));var BPromise=require(_0x48e4('0x4'));var Mustache=require(_0x48e4('0x5'));var util=require(_0x48e4('0x6'));var path=require('path');var sox=require(_0x48e4('0x7'));var csv=require(_0x48e4('0x8'));var ejs=require(_0x48e4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x48e4('0xa'));var crypto=require(_0x48e4('0xb'));var jsforce=require(_0x48e4('0xc'));var deskjs=require(_0x48e4('0xd'));var toCsv=require(_0x48e4('0x8'));var querystring=require(_0x48e4('0xe'));var Papa=require(_0x48e4('0xf'));var Redis=require(_0x48e4('0x10'));var authService=require(_0x48e4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x48e4('0x12'));var hardwareService=require(_0x48e4('0x13'));var logger=require(_0x48e4('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x48e4('0x15'));var licenseUtil=require(_0x48e4('0x16'));var db=require(_0x48e4('0x17'))['db'];config[_0x48e4('0x18')]=_['defaults'](config[_0x48e4('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x48e4('0x19'))(new Redis(config[_0x48e4('0x18')]));require(_0x48e4('0x1a'))[_0x48e4('0x1b')](socket);function respondWithStatusCode(_0x12f7af,_0x39bd10){_0x39bd10=_0x39bd10||0xcc;return function(_0x1ede64){if(_0x1ede64){return _0x12f7af['sendStatus'](_0x39bd10);}return _0x12f7af[_0x48e4('0x1c')](_0x39bd10)[_0x48e4('0x1d')]();};}function respondWithResult(_0x5c8fe5,_0x171f89){_0x171f89=_0x171f89||0xc8;return function(_0x35a599){if(_0x35a599){return _0x5c8fe5['status'](_0x171f89)[_0x48e4('0x1e')](_0x35a599);}};}function respondWithFilteredResult(_0x627366,_0x12fc37){return function(_0x4ffc0d){if(_0x4ffc0d){var _0x231dcd=typeof _0x12fc37[_0x48e4('0x1f')]===_0x48e4('0x20')&&typeof _0x12fc37['limit']===_0x48e4('0x20');var _0x565916=_0x4ffc0d['count'];var _0x113ff4=_0x231dcd?0x0:_0x12fc37[_0x48e4('0x1f')];var _0x25ecba=_0x231dcd?_0x4ffc0d[_0x48e4('0x21')]:_0x12fc37[_0x48e4('0x1f')]+_0x12fc37['limit'];var _0x59eff5;if(_0x25ecba>=_0x565916){_0x25ecba=_0x565916;_0x59eff5=0xc8;}else{_0x59eff5=0xce;}_0x627366[_0x48e4('0x1c')](_0x59eff5);return _0x627366[_0x48e4('0x22')](_0x48e4('0x23'),_0x113ff4+'-'+_0x25ecba+'/'+_0x565916)[_0x48e4('0x1e')](_0x4ffc0d);}return null;};}function patchUpdates(_0x846128){return function(_0x377249){try{jsonpatch[_0x48e4('0x24')](_0x377249,_0x846128,!![]);}catch(_0x378573){return BPromise[_0x48e4('0x25')](_0x378573);}return _0x377249[_0x48e4('0x26')]();};}function saveUpdates(_0x1a80ed,_0x5cc3e6){return function(_0x160e3b){if(_0x160e3b){return _0x160e3b[_0x48e4('0x27')](_0x1a80ed)['then'](function(_0x2beac2){return _0x2beac2;});}return null;};}function removeEntity(_0x23b2ba,_0x4abfbc){return function(_0x9a1c6d){if(_0x9a1c6d){return _0x9a1c6d[_0x48e4('0x28')]()[_0x48e4('0x29')](function(){var _0xc113e3=_0x9a1c6d[_0x48e4('0x2a')]({'plain':!![]});var _0x11bc8a=_0x48e4('0x2b');return db['UserProfileResource'][_0x48e4('0x28')]({'where':{'type':_0x11bc8a,'resourceId':_0xc113e3['id']}})[_0x48e4('0x29')](function(){return _0x9a1c6d;});})['then'](function(){_0x23b2ba['status'](0xcc)[_0x48e4('0x1d')]();});}};}function handleEntityNotFound(_0x4b8f3c,_0x346765){return function(_0x214def){if(!_0x214def){_0x4b8f3c['sendStatus'](0x194);}return _0x214def;};}function handleError(_0x3012b3,_0x28c1){_0x28c1=_0x28c1||0x1f4;return function(_0x14b545){logger[_0x48e4('0x2c')](_0x14b545[_0x48e4('0x2d')]);if(_0x14b545['name']){delete _0x14b545[_0x48e4('0x2e')];}_0x3012b3['status'](_0x28c1)['send'](_0x14b545);};}exports['index']=function(_0x1ee7ef,_0x1450cb){var _0xf2f1cf={},_0x4725ab={},_0x2432ab={'count':0x0,'rows':[]};var _0x403b21=_[_0x48e4('0x2f')](db[_0x48e4('0x30')][_0x48e4('0x31')],function(_0x12af4d){return{'name':_0x12af4d[_0x48e4('0x32')],'type':_0x12af4d['type']['key']};});_0x4725ab['model']=_[_0x48e4('0x2f')](_0x403b21,_0x48e4('0x2e'));_0x4725ab['query']=_[_0x48e4('0x33')](_0x1ee7ef[_0x48e4('0x34')]);_0x4725ab['filters']=_[_0x48e4('0x35')](_0x4725ab[_0x48e4('0x36')],_0x4725ab[_0x48e4('0x34')]);_0xf2f1cf[_0x48e4('0x37')]=_['intersection'](_0x4725ab[_0x48e4('0x36')],qs[_0x48e4('0x38')](_0x1ee7ef['query']['fields']));_0xf2f1cf[_0x48e4('0x37')]=_0xf2f1cf[_0x48e4('0x37')][_0x48e4('0x39')]?_0xf2f1cf['attributes']:_0x4725ab[_0x48e4('0x36')];if(!_0x1ee7ef[_0x48e4('0x34')]['hasOwnProperty'](_0x48e4('0x3a'))){_0xf2f1cf[_0x48e4('0x3b')]=qs[_0x48e4('0x3b')](_0x1ee7ef[_0x48e4('0x34')][_0x48e4('0x3b')]);_0xf2f1cf['offset']=qs[_0x48e4('0x1f')](_0x1ee7ef[_0x48e4('0x34')][_0x48e4('0x1f')]);}_0xf2f1cf['order']=qs[_0x48e4('0x3c')](_0x1ee7ef['query'][_0x48e4('0x3c')]);_0xf2f1cf[_0x48e4('0x3d')]=qs[_0x48e4('0x3e')](_[_0x48e4('0x3f')](_0x1ee7ef[_0x48e4('0x34')],_0x4725ab[_0x48e4('0x3e')]),_0x403b21);if(_0x1ee7ef[_0x48e4('0x34')][_0x48e4('0x40')]){_0xf2f1cf[_0x48e4('0x3d')]=_[_0x48e4('0x41')](_0xf2f1cf[_0x48e4('0x3d')],{'$or':_['map'](_0x403b21,function(_0x3cdafb){if(_0x3cdafb[_0x48e4('0x42')]!==_0x48e4('0x43')){var _0x1e54d9={};_0x1e54d9[_0x3cdafb[_0x48e4('0x2e')]]={'$like':'%'+_0x1ee7ef[_0x48e4('0x34')][_0x48e4('0x40')]+'%'};return _0x1e54d9;}})});}_0xf2f1cf=_['merge']({},_0xf2f1cf,_0x1ee7ef[_0x48e4('0x44')]);var _0x1e5317={'where':_0xf2f1cf[_0x48e4('0x3d')]};return db['MailQueue'][_0x48e4('0x21')](_0x1e5317)[_0x48e4('0x29')](function(_0x3cc197){_0x2432ab['count']=_0x3cc197;if(_0x1ee7ef['query'][_0x48e4('0x45')]){_0xf2f1cf[_0x48e4('0x46')]=[{'all':!![]}];}return db['MailQueue'][_0x48e4('0x47')](_0xf2f1cf);})['then'](function(_0x4f1714){_0x2432ab['rows']=_0x4f1714;return _0x2432ab;})['then'](respondWithFilteredResult(_0x1450cb,_0xf2f1cf))[_0x48e4('0x48')](handleError(_0x1450cb,null));};exports[_0x48e4('0x49')]=function(_0x1c5456,_0x124cb1){var _0x4144fa={'raw':!![],'where':{'id':_0x1c5456['params']['id']}},_0x410b8e={};_0x410b8e[_0x48e4('0x36')]=_[_0x48e4('0x33')](db['MailQueue']['rawAttributes']);_0x410b8e[_0x48e4('0x34')]=_[_0x48e4('0x33')](_0x1c5456[_0x48e4('0x34')]);_0x410b8e[_0x48e4('0x3e')]=_['intersection'](_0x410b8e[_0x48e4('0x36')],_0x410b8e[_0x48e4('0x34')]);_0x4144fa[_0x48e4('0x37')]=_[_0x48e4('0x35')](_0x410b8e[_0x48e4('0x36')],qs[_0x48e4('0x38')](_0x1c5456['query'][_0x48e4('0x38')]));_0x4144fa[_0x48e4('0x37')]=_0x4144fa[_0x48e4('0x37')][_0x48e4('0x39')]?_0x4144fa[_0x48e4('0x37')]:_0x410b8e[_0x48e4('0x36')];if(_0x1c5456[_0x48e4('0x34')][_0x48e4('0x45')]){_0x4144fa[_0x48e4('0x46')]=[{'all':!![]}];}_0x4144fa=_[_0x48e4('0x41')]({},_0x4144fa,_0x1c5456[_0x48e4('0x44')]);return db['MailQueue'][_0x48e4('0x4a')](_0x4144fa)['then'](handleEntityNotFound(_0x124cb1,null))['then'](respondWithResult(_0x124cb1,null))[_0x48e4('0x48')](handleError(_0x124cb1,null));};exports['create']=function(_0x98d025,_0x14511b){return db[_0x48e4('0x30')][_0x48e4('0x4b')](_0x98d025[_0x48e4('0x4c')],{})[_0x48e4('0x29')](function(_0x10eb0c){var _0x57c9e5=_0x98d025['user'][_0x48e4('0x2a')]({'plain':!![]});if(!_0x57c9e5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57c9e5[_0x48e4('0x4d')]===_0x48e4('0x4e')){var _0x2bbf8f=_0x10eb0c['get']({'plain':!![]});var _0x14ed52=_0x48e4('0x2b');return db[_0x48e4('0x4f')]['find']({'where':{'name':_0x14ed52,'userProfileId':_0x57c9e5[_0x48e4('0x50')]},'raw':!![]})[_0x48e4('0x29')](function(_0x91b42d){if(_0x91b42d&&_0x91b42d[_0x48e4('0x51')]===0x0){return db[_0x48e4('0x52')]['create']({'name':_0x2bbf8f[_0x48e4('0x2e')],'resourceId':_0x2bbf8f['id'],'type':_0x91b42d[_0x48e4('0x2e')],'sectionId':_0x91b42d['id']},{})['then'](function(){return _0x10eb0c;});}else{return _0x10eb0c;}})[_0x48e4('0x48')](function(_0x43e3ba){logger[_0x48e4('0x2c')](_0x48e4('0x53'),_0x43e3ba);throw _0x43e3ba;});}return _0x10eb0c;})['then'](respondWithResult(_0x14511b,0xc9))['catch'](handleError(_0x14511b,null));};exports['update']=function(_0x55ab36,_0x2be063){if(_0x55ab36[_0x48e4('0x4c')]['id']){delete _0x55ab36[_0x48e4('0x4c')]['id'];}return db[_0x48e4('0x30')][_0x48e4('0x4a')]({'where':{'id':_0x55ab36[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x2be063,null))[_0x48e4('0x29')](saveUpdates(_0x55ab36[_0x48e4('0x4c')],null))[_0x48e4('0x29')](respondWithResult(_0x2be063,null))[_0x48e4('0x48')](handleError(_0x2be063,null));};exports[_0x48e4('0x28')]=function(_0x180ae4,_0x4e07e9){return db[_0x48e4('0x30')][_0x48e4('0x4a')]({'where':{'id':_0x180ae4[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x4e07e9,null))[_0x48e4('0x29')](removeEntity(_0x4e07e9,null))[_0x48e4('0x48')](handleError(_0x4e07e9,null));};exports[_0x48e4('0x55')]=function(_0x450baf,_0x1f5e67){return db[_0x48e4('0x30')][_0x48e4('0x55')]()[_0x48e4('0x29')](respondWithResult(_0x1f5e67,null))['catch'](handleError(_0x1f5e67,null));};exports['getMembers']=function(_0xc114a,_0x1da690,_0x2b0be2){var _0x1a30eb={'raw':!![],'where':{}},_0x4147b4={},_0x599988;return db[_0x48e4('0x30')]['findOne']({'where':{'id':_0xc114a[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x1da690,null))[_0x48e4('0x29')](function(_0x573d41){if(_0x573d41){_0x599988=_0x573d41[_0x48e4('0x2a')]({'plain':!![]});_0x4147b4[_0x48e4('0x36')]=_[_0x48e4('0x33')](db[_0x48e4('0x56')][_0x48e4('0x31')]);_0x4147b4[_0x48e4('0x34')]=_[_0x48e4('0x33')](_0xc114a['query']);_0x4147b4[_0x48e4('0x3e')]=_[_0x48e4('0x35')](_0x4147b4[_0x48e4('0x36')],_0x4147b4['query']);_0x1a30eb[_0x48e4('0x37')]=_[_0x48e4('0x35')](_0x4147b4['model'],qs['fields'](_0xc114a['query'][_0x48e4('0x38')]));_0x1a30eb[_0x48e4('0x37')]=_0x1a30eb['attributes'][_0x48e4('0x39')]?_0x1a30eb[_0x48e4('0x37')]:_0x4147b4[_0x48e4('0x36')];if(!_0xc114a[_0x48e4('0x34')][_0x48e4('0x57')](_0x48e4('0x3a'))){_0x1a30eb[_0x48e4('0x3b')]=qs[_0x48e4('0x3b')](_0xc114a[_0x48e4('0x34')][_0x48e4('0x3b')]);_0x1a30eb['offset']=qs['offset'](_0xc114a['query'][_0x48e4('0x1f')]);}_0x1a30eb[_0x48e4('0x58')]=qs['sort'](_0xc114a[_0x48e4('0x34')]['sort']);_0x1a30eb[_0x48e4('0x3d')]=qs[_0x48e4('0x3e')](_[_0x48e4('0x3f')](_0xc114a[_0x48e4('0x34')],_0x4147b4[_0x48e4('0x3e')]));_0x1a30eb[_0x48e4('0x3d')][_0x48e4('0x59')]=_0x573d41['id'];if(_0xc114a[_0x48e4('0x34')][_0x48e4('0x40')]){_0x1a30eb[_0x48e4('0x3d')]=_[_0x48e4('0x41')](_0x1a30eb[_0x48e4('0x3d')],{'$or':_['map'](_0x1a30eb['attributes'],function(_0x3dc914){var _0x57555d={};_0x57555d[_0x3dc914]={'$like':'%'+_0xc114a[_0x48e4('0x34')][_0x48e4('0x40')]+'%'};return _0x57555d;})});}_0x1a30eb=_['merge']({},_0x1a30eb,_0xc114a[_0x48e4('0x44')]);return db[_0x48e4('0x56')][_0x48e4('0x47')](_0x1a30eb);}})[_0x48e4('0x29')](function(_0x492ab0){if(_0x492ab0){return db[_0x48e4('0x5a')]['findAndCountAll']({'where':{'id':_[_0x48e4('0x2f')](_0x492ab0,_0x48e4('0x5b')),'role':_0x48e4('0x5c')},'attributes':['id',_0x48e4('0x2e'),_0x48e4('0x5d'),'updatedAt',_0x48e4('0x5e')]});}})['then'](function(_0x21be9c){if(_0x21be9c){return{'count':_0x21be9c[_0x48e4('0x21')],'rows':_[_0x48e4('0x2f')](_0x21be9c[_0x48e4('0x5f')],function(_0x1fe0f9){return{'membername':_0x1fe0f9['name'],'UserId':_0x1fe0f9['id'],'queue_name':_0x599988[_0x48e4('0x2e')],'MailQueueId':_0x599988['id'],'interface':util[_0x48e4('0x60')](_0x48e4('0x61'),_0x48e4('0x62'),_0x1fe0f9[_0x48e4('0x2e')]),'penalty':0x0,'paused':_0x1fe0f9[_0x48e4('0x5d')],'createdAt':_0x1fe0f9[_0x48e4('0x5e')],'updatedAt':_0x1fe0f9[_0x48e4('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x48e4('0x29')](respondWithFilteredResult(_0x1da690,_0x1a30eb))[_0x48e4('0x48')](handleError(_0x1da690,null));};exports['getTeams']=function(_0x4b7106,_0x2f71e8,_0x5d6d17){var _0x4bc126={};var _0x2fbb3e={};var _0x5bd779;var _0xb0dea2;return db['MailQueue'][_0x48e4('0x64')]({'where':{'id':_0x4b7106['params']['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x2f71e8,null))[_0x48e4('0x29')](function(_0x7ef265){if(_0x7ef265){_0x5bd779=_0x7ef265;_0x2fbb3e['model']=_['keys'](db['Team'][_0x48e4('0x31')]);_0x2fbb3e['query']=_[_0x48e4('0x33')](_0x4b7106[_0x48e4('0x34')]);_0x2fbb3e[_0x48e4('0x3e')]=_['intersection'](_0x2fbb3e[_0x48e4('0x36')],_0x2fbb3e[_0x48e4('0x34')]);_0x4bc126[_0x48e4('0x37')]=_[_0x48e4('0x35')](_0x2fbb3e['model'],qs[_0x48e4('0x38')](_0x4b7106[_0x48e4('0x34')]['fields']));_0x4bc126['attributes']=_0x4bc126[_0x48e4('0x37')]['length']?_0x4bc126['attributes']:_0x2fbb3e[_0x48e4('0x36')];_0x4bc126[_0x48e4('0x58')]=qs[_0x48e4('0x3c')](_0x4b7106[_0x48e4('0x34')][_0x48e4('0x3c')]);_0x4bc126['where']=qs['filters'](_[_0x48e4('0x3f')](_0x4b7106[_0x48e4('0x34')],_0x2fbb3e[_0x48e4('0x3e')]));if(_0x4b7106[_0x48e4('0x34')][_0x48e4('0x40')]){_0x4bc126[_0x48e4('0x3d')]=_[_0x48e4('0x41')](_0x4bc126['where'],{'$or':_[_0x48e4('0x2f')](_0x4bc126['attributes'],function(_0x4d2de2){var _0x2db92a={};_0x2db92a[_0x4d2de2]={'$like':'%'+_0x4b7106[_0x48e4('0x34')][_0x48e4('0x40')]+'%'};return _0x2db92a;})});}_0x4bc126=_[_0x48e4('0x41')]({},_0x4bc126,_0x4b7106[_0x48e4('0x44')]);return _0x5bd779[_0x48e4('0x65')](_0x4bc126);}})[_0x48e4('0x29')](function(_0x4ffc74){if(_0x4ffc74){_0xb0dea2=_0x4ffc74[_0x48e4('0x39')];if(!_0x4b7106[_0x48e4('0x34')]['hasOwnProperty']('nolimit')){_0x4bc126[_0x48e4('0x3b')]=qs[_0x48e4('0x3b')](_0x4b7106[_0x48e4('0x34')][_0x48e4('0x3b')]);_0x4bc126[_0x48e4('0x1f')]=qs[_0x48e4('0x1f')](_0x4b7106[_0x48e4('0x34')][_0x48e4('0x1f')]);}return _0x5bd779[_0x48e4('0x65')](_0x4bc126);}})[_0x48e4('0x29')](function(_0x7a1d9b){if(_0x7a1d9b){return _0x7a1d9b?{'count':_0xb0dea2,'rows':_0x7a1d9b}:null;}})[_0x48e4('0x29')](respondWithResult(_0x2f71e8,null))[_0x48e4('0x48')](handleError(_0x2f71e8,null));};exports['addTeams']=function(_0x5c3dfb,_0x3cef34,_0x1a9d62){var _0x18be38=_0x5c3dfb[_0x48e4('0x4c')]['ids'];return db[_0x48e4('0x66')][_0x48e4('0x47')]({'where':{'id':_0x18be38},'attributes':['id'],'include':[{'model':db[_0x48e4('0x5a')],'as':_0x48e4('0x67'),'attributes':['id',_0x48e4('0x2e'),_0x48e4('0x68'),_0x48e4('0x69'),_0x48e4('0x6a')],'raw':!![]}]})[_0x48e4('0x29')](function(_0x1c0e65){if(_0x1c0e65){var _0x26006a=_['flatMap'](_0x1c0e65,function(_0x37ed49){var _0xaafa73=_0x37ed49[_0x48e4('0x2a')]({'plain':!![]});return _0xaafa73[_0x48e4('0x67')];});return db[_0x48e4('0x30')]['find']({'where':{'id':_0x5c3dfb['params']['id']}})[_0x48e4('0x29')](function(_0x3d7192){return db[_0x48e4('0x6b')]['transaction'](function(_0x110f79){return _0x3d7192[_0x48e4('0x6c')](_0x18be38,{'transaction':_0x110f79})[_0x48e4('0x29')](function(){return BPromise[_0x48e4('0x6d')](_0x26006a,function(_0x35819c){return db[_0x48e4('0x56')]['findOrCreate']({'where':{'UserId':_0x35819c['id'],'MailQueueId':_0x5c3dfb[_0x48e4('0x54')]['id']},'transaction':_0x110f79});});})[_0x48e4('0x29')](function(){_0x26006a[_0x48e4('0x6e')](function(_0x235a36){socket['emit'](_0x48e4('0x6f'),{'UserId':_0x235a36['id'],'MailQueueId':_0x3d7192['id']});});});});});}})[_0x48e4('0x29')](respondWithStatusCode(_0x3cef34,null))[_0x48e4('0x48')](handleError(_0x3cef34,null));};exports[_0x48e4('0x70')]=function(_0x1cd791,_0x1e3c73,_0xb9c24d){return db[_0x48e4('0x66')][_0x48e4('0x47')]({'where':{'id':_0x1cd791[_0x48e4('0x34')][_0x48e4('0x71')]},'attributes':['id'],'include':[{'model':db[_0x48e4('0x5a')],'as':_0x48e4('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1e3c73,null))[_0x48e4('0x29')](function(_0xe8ba4f){var _0x18b21a=_[_0x48e4('0x2f')](_0xe8ba4f,'id');var _0x2d9326=[];var _0x3108e1=[];var _0x28f23c=squel[_0x48e4('0x72')]();_0x28f23c[_0x48e4('0x73')](_0x48e4('0x74'))[_0x48e4('0x75')](_0x48e4('0x76'),'tq')[_0x48e4('0x77')](_0x48e4('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('MailQueueId\x20=\x20?',_0x1cd791['params']['id']);for(var _0x4bafc9=0x0;_0x4bafc9<_0xe8ba4f[_0x48e4('0x39')];_0x4bafc9+=0x1){let _0x486c6e=_0xe8ba4f[_0x4bafc9];for(var _0x40b3d8=0x0;_0x40b3d8<_0x486c6e[_0x48e4('0x67')][_0x48e4('0x39')];_0x40b3d8+=0x1){let _0x234372=_0x486c6e[_0x48e4('0x67')][_0x40b3d8];var _0x3de23a=_0x28f23c[_0x48e4('0x79')]();_0x3de23a[_0x48e4('0x3d')](_0x48e4('0x7a'),_0x234372['id']);_0x3108e1[_0x48e4('0x7b')](db['sequelize'][_0x48e4('0x34')](_0x3de23a['toString'](),{'type':db['sequelize']['QueryTypes'][_0x48e4('0x7c')]})['then'](function(_0x2065e2){if(_0x2065e2[_0x48e4('0x39')]===0x1){return _0x234372['id'];}else{var _0x37d1ca=_['every'](_[_0x48e4('0x2f')](_0x2065e2,_0x48e4('0x7d')),function(_0x25b7df){return _['includes'](_0x18b21a,_0x25b7df);});if(_0x37d1ca){return _0x234372['id'];}}}));}}return BPromise[_0x48e4('0x7e')](_0x3108e1)[_0x48e4('0x29')](function(_0x405a80){_0x2d9326=_(_0x2d9326)['union'](_0x405a80)['compact']()['value']();return db['MailQueue'][_0x48e4('0x4a')]({'where':{'id':_0x1cd791[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](function(_0x2b89b7){return db[_0x48e4('0x6b')][_0x48e4('0x7f')](function(_0x2aa04b){return _0x2b89b7['removeTeams'](_0x1cd791['query'][_0x48e4('0x71')],{'transaction':_0x2aa04b})[_0x48e4('0x29')](function(){if(!_['isEmpty'](_0x2d9326)){return _0x2b89b7[_0x48e4('0x80')](_0x2d9326,{'transaction':_0x2aa04b});}})[_0x48e4('0x29')](function(){_0x2d9326[_0x48e4('0x6e')](function(_0x4903c9){socket['emit'](_0x48e4('0x81'),{'UserId':_0x4903c9,'MailQueueId':_0x2b89b7['id']});});});});});});})[_0x48e4('0x29')](respondWithStatusCode(_0x1e3c73,null))[_0x48e4('0x48')](handleError(_0x1e3c73,null));};exports[_0x48e4('0x82')]=function(_0x49883b,_0x2fc6c3,_0x47774a){return db[_0x48e4('0x30')]['find']({'where':{'id':_0x49883b[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x2fc6c3,null))[_0x48e4('0x29')](function(_0x13e465){if(_0x13e465){return _0x13e465[_0x48e4('0x82')](_0x49883b[_0x48e4('0x4c')][_0x48e4('0x71')],_[_0x48e4('0x83')](_0x49883b[_0x48e4('0x4c')],[_0x48e4('0x71'),'id'])||{})[_0x48e4('0x84')](function(_0x388835){for(var _0x5f0905=0x0;_0x5f0905<_0x49883b[_0x48e4('0x4c')][_0x48e4('0x71')][_0x48e4('0x39')];_0x5f0905+=0x1){socket[_0x48e4('0x85')](_0x48e4('0x6f'),{'UserId':Number(_0x49883b[_0x48e4('0x4c')]['ids'][_0x5f0905]),'MailQueueId':Number(_0x49883b[_0x48e4('0x54')]['id'])});}return _0x388835;});}})[_0x48e4('0x29')](respondWithResult(_0x2fc6c3,null))[_0x48e4('0x48')](handleError(_0x2fc6c3,null));};exports[_0x48e4('0x80')]=function(_0x4c8717,_0x133a0d,_0x237faf){return db[_0x48e4('0x30')][_0x48e4('0x4a')]({'where':{'id':_0x4c8717[_0x48e4('0x54')]['id']}})['then'](handleEntityNotFound(_0x133a0d,null))[_0x48e4('0x29')](function(_0x2b3e12){if(_0x2b3e12){return _0x2b3e12[_0x48e4('0x80')](_0x4c8717['query']['ids'])[_0x48e4('0x29')](function(){if(_[_0x48e4('0x86')](_0x4c8717[_0x48e4('0x34')][_0x48e4('0x71')])){for(var _0x190714=0x0;_0x190714<_0x4c8717[_0x48e4('0x34')][_0x48e4('0x71')][_0x48e4('0x39')];_0x190714+=0x1){socket[_0x48e4('0x85')]('userMailQueue:remove',{'UserId':Number(_0x4c8717[_0x48e4('0x34')]['ids'][_0x190714]),'MailQueueId':Number(_0x4c8717[_0x48e4('0x54')]['id'])});}}else{socket[_0x48e4('0x85')](_0x48e4('0x81'),{'UserId':Number(_0x4c8717[_0x48e4('0x34')][_0x48e4('0x71')]),'MailQueueId':Number(_0x4c8717['params']['id'])});}});}})[_0x48e4('0x29')](respondWithStatusCode(_0x133a0d,null))['catch'](handleError(_0x133a0d,null));};exports[_0x48e4('0x87')]=function(_0x17d045,_0x9d66b2,_0x14c8f6){var _0x51a43c={};var _0x26bd73={};var _0x3f966a;var _0x268ab6;return db['MailQueue'][_0x48e4('0x64')]({'where':{'id':_0x17d045[_0x48e4('0x54')]['id']}})[_0x48e4('0x29')](handleEntityNotFound(_0x9d66b2,null))[_0x48e4('0x29')](function(_0x35af85){if(_0x35af85){_0x3f966a=_0x35af85;_0x26bd73['model']=_[_0x48e4('0x33')](db[_0x48e4('0x5a')][_0x48e4('0x31')]);_0x26bd73[_0x48e4('0x34')]=_[_0x48e4('0x33')](_0x17d045['query']);_0x26bd73['filters']=_[_0x48e4('0x35')](_0x26bd73[_0x48e4('0x36')],_0x26bd73[_0x48e4('0x34')]);_0x51a43c[_0x48e4('0x37')]=_[_0x48e4('0x35')](_0x26bd73[_0x48e4('0x36')],qs[_0x48e4('0x38')](_0x17d045[_0x48e4('0x34')][_0x48e4('0x38')]));_0x51a43c['attributes']=_0x51a43c[_0x48e4('0x37')][_0x48e4('0x39')]?_0x51a43c[_0x48e4('0x37')]:_0x26bd73[_0x48e4('0x36')];_0x51a43c[_0x48e4('0x58')]=qs['sort'](_0x17d045[_0x48e4('0x34')][_0x48e4('0x3c')]);_0x51a43c[_0x48e4('0x3d')]=qs['filters'](_[_0x48e4('0x3f')](_0x17d045[_0x48e4('0x34')],_0x26bd73[_0x48e4('0x3e')]));if(_0x17d045[_0x48e4('0x34')][_0x48e4('0x40')]){_0x51a43c[_0x48e4('0x3d')]=_[_0x48e4('0x41')](_0x51a43c[_0x48e4('0x3d')],{'$or':_['map'](_0x51a43c[_0x48e4('0x37')],function(_0x212b2e){var _0x311de3={};_0x311de3[_0x212b2e]={'$like':'%'+_0x17d045[_0x48e4('0x34')]['filter']+'%'};return _0x311de3;})});}_0x51a43c=_[_0x48e4('0x41')]({},_0x51a43c,_0x17d045[_0x48e4('0x44')]);return _0x3f966a[_0x48e4('0x87')](_0x51a43c);}})['then'](function(_0x437262){if(_0x437262){_0x268ab6=_0x437262['length'];if(!_0x17d045[_0x48e4('0x34')][_0x48e4('0x57')](_0x48e4('0x3a'))){_0x51a43c['limit']=qs[_0x48e4('0x3b')](_0x17d045[_0x48e4('0x34')]['limit']);_0x51a43c[_0x48e4('0x1f')]=qs[_0x48e4('0x1f')](_0x17d045[_0x48e4('0x34')][_0x48e4('0x1f')]);}return _0x3f966a[_0x48e4('0x87')](_0x51a43c);}})[_0x48e4('0x29')](function(_0x2ead71){if(_0x2ead71){return _0x2ead71?{'count':_0x268ab6,'rows':_0x2ead71}:null;}})[_0x48e4('0x29')](respondWithResult(_0x9d66b2,null))['catch'](handleError(_0x9d66b2,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 105d54c..1f9b4b6 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 _0x7246=['events','MailQueue','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7246,0x1c2));var _0x6724=function(_0x2af2ea,_0x5f1efd){_0x2af2ea=_0x2af2ea-0x0;var _0x6f9f13=_0x7246[_0x2af2ea];return _0x6f9f13;};'use strict';var EventEmitter=require(_0x6724('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x6724('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6724('0x2'),'afterUpdate':_0x6724('0x3'),'afterDestroy':_0x6724('0x4')};function emitEvent(_0x578fa4){return function(_0x1ae007,_0x246f34,_0x349213){MailQueueEvents[_0x6724('0x5')](_0x578fa4+':'+_0x1ae007['id'],_0x1ae007);MailQueueEvents['emit'](_0x578fa4,_0x1ae007);_0x349213(null);};}for(var e in events){if(events[_0x6724('0x6')](e)){var event=events[e];MailQueue[_0x6724('0x7')](e,emitEvent(event));}}module[_0x6724('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x64e7=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update'];(function(_0xdd8586,_0x35215e){var _0x176c5b=function(_0x40fc4c){while(--_0x40fc4c){_0xdd8586['push'](_0xdd8586['shift']());}};_0x176c5b(++_0x35215e);}(_0x64e7,0x1c6));var _0x764e=function(_0x5b7365,_0x2111bb){_0x5b7365=_0x5b7365-0x0;var _0x433c84=_0x64e7[_0x5b7365];return _0x433c84;};'use strict';var EventEmitter=require(_0x764e('0x0'));var MailQueue=require(_0x764e('0x1'))['db'][_0x764e('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x764e('0x3')](0x0);var events={'afterCreate':_0x764e('0x4'),'afterUpdate':_0x764e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1553a6){return function(_0x56874b,_0x1c937f,_0x3927f0){MailQueueEvents[_0x764e('0x6')](_0x1553a6+':'+_0x56874b['id'],_0x56874b);MailQueueEvents[_0x764e('0x6')](_0x1553a6,_0x56874b);_0x3927f0(null);};}for(var e in events){if(events[_0x764e('0x7')](e)){var event=events[e];MailQueue[_0x764e('0x8')](e,emitEvent(event));}}module[_0x764e('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 4e086f3..f6aea34 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 _0x2434=['exports','MailQueue','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2434,0x160));var _0x4243=function(_0x2c9fd2,_0x13c630){_0x2c9fd2=_0x2c9fd2-0x0;var _0xe7c289=_0x2434[_0x2c9fd2];return _0xe7c289;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4243('0x0'))(_0x4243('0x1'));var moment=require(_0x4243('0x2'));var BPromise=require(_0x4243('0x3'));var rp=require(_0x4243('0x4'));var fs=require('fs');var path=require(_0x4243('0x5'));var rimraf=require(_0x4243('0x6'));var config=require(_0x4243('0x7'));var attributes=require('./mailQueue.attributes');module[_0x4243('0x8')]=function(_0x470fe0,_0x3abe00){return _0x470fe0['define'](_0x4243('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7a3=['exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./mailQueue.attributes'];(function(_0x4f1243,_0x196c03){var _0xfc3783=function(_0x4c2aa7){while(--_0x4c2aa7){_0x4f1243['push'](_0x4f1243['shift']());}};_0xfc3783(++_0x196c03);}(_0xe7a3,0x137));var _0x3e7a=function(_0x1c2f57,_0x33d4f9){_0x1c2f57=_0x1c2f57-0x0;var _0x161a43=_0xe7a3[_0x1c2f57];return _0x161a43;};'use strict';var _=require(_0x3e7a('0x0'));var util=require(_0x3e7a('0x1'));var logger=require(_0x3e7a('0x2'))(_0x3e7a('0x3'));var moment=require(_0x3e7a('0x4'));var BPromise=require(_0x3e7a('0x5'));var rp=require(_0x3e7a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e7a('0x7'));var config=require('../../config/environment');var attributes=require(_0x3e7a('0x8'));module[_0x3e7a('0x9')]=function(_0x864d7c,_0x53a20a){return _0x864d7c['define']('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 964fdf6..9d2b07f 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 _0xb4f2=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','attributes','limit','include','model','map','ShowMailQueue','find','raw','lodash','util','moment'];(function(_0x80d733,_0x266211){var _0x435868=function(_0x2ae0f0){while(--_0x2ae0f0){_0x80d733['push'](_0x80d733['shift']());}};_0x435868(++_0x266211);}(_0xb4f2,0x1eb));var _0x2b4f=function(_0x5218ac,_0xbe312f){_0x5218ac=_0x5218ac-0x0;var _0x4ae75e=_0xb4f2[_0x5218ac];return _0x4ae75e;};'use strict';var _=require(_0x2b4f('0x0'));var util=require(_0x2b4f('0x1'));var moment=require(_0x2b4f('0x2'));var BPromise=require(_0x2b4f('0x3'));var rs=require(_0x2b4f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b4f('0x5'))['db'];var utils=require(_0x2b4f('0x6'));var logger=require(_0x2b4f('0x7'))(_0x2b4f('0x8'));var config=require(_0x2b4f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2b4f('0xa')]['http']({'port':0x232a});config[_0x2b4f('0xb')]=_[_0x2b4f('0xc')](config[_0x2b4f('0xb')],{'host':_0x2b4f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2b4f('0xb')]));require('./mailQueue.socket')[_0x2b4f('0xe')](socket);function respondWithRpcPromise(_0x440c18,_0x1fe8e8,_0x44af08){return new BPromise(function(_0x4eacad,_0x1042ad){return client['request'](_0x440c18,_0x44af08)[_0x2b4f('0xf')](function(_0x36ae92){logger[_0x2b4f('0x10')](_0x2b4f('0x11'),_0x1fe8e8,_0x2b4f('0x12'));logger[_0x2b4f('0x13')](_0x2b4f('0x14'),_0x1fe8e8,_0x2b4f('0x12'),JSON[_0x2b4f('0x15')](_0x36ae92));if(_0x36ae92[_0x2b4f('0x16')]){if(_0x36ae92[_0x2b4f('0x16')][_0x2b4f('0x17')]===0x1f4){logger[_0x2b4f('0x16')](_0x2b4f('0x11'),_0x1fe8e8,_0x36ae92[_0x2b4f('0x16')][_0x2b4f('0x18')]);return _0x1042ad(_0x36ae92[_0x2b4f('0x16')][_0x2b4f('0x18')]);}logger[_0x2b4f('0x16')](_0x2b4f('0x11'),_0x1fe8e8,_0x36ae92['error'][_0x2b4f('0x18')]);return _0x4eacad(_0x36ae92[_0x2b4f('0x16')][_0x2b4f('0x18')]);}else{logger[_0x2b4f('0x10')](_0x2b4f('0x11'),_0x1fe8e8,_0x2b4f('0x12'));_0x4eacad(_0x36ae92['result'][_0x2b4f('0x18')]);}})[_0x2b4f('0x19')](function(_0x36f97d){logger[_0x2b4f('0x16')](_0x2b4f('0x11'),_0x1fe8e8,_0x36f97d);_0x1042ad(_0x36f97d);});});}exports[_0x2b4f('0x1a')]=function(_0x1c109a){var _0x12751e=this;return new Promise(function(_0x449137,_0x4ba2f1){return db[_0x2b4f('0x1b')][_0x2b4f('0x1c')]({'raw':_0x1c109a[_0x2b4f('0x1d')]?_0x1c109a['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c109a['options']?_0x1c109a[_0x2b4f('0x1d')]['where']||null:null,'attributes':_0x1c109a[_0x2b4f('0x1d')]?_0x1c109a[_0x2b4f('0x1d')][_0x2b4f('0x1e')]||null:null,'limit':_0x1c109a[_0x2b4f('0x1d')]?_0x1c109a[_0x2b4f('0x1d')][_0x2b4f('0x1f')]||null:null,'include':_0x1c109a[_0x2b4f('0x1d')]?_0x1c109a[_0x2b4f('0x1d')][_0x2b4f('0x20')]?_['map'](_0x1c109a[_0x2b4f('0x1d')][_0x2b4f('0x20')],function(_0x3123f5){return{'model':db[_0x3123f5[_0x2b4f('0x21')]],'as':_0x3123f5['as'],'attributes':_0x3123f5[_0x2b4f('0x1e')],'include':_0x3123f5['include']?_[_0x2b4f('0x22')](_0x3123f5['include'],function(_0x55ba62){return{'model':db[_0x55ba62[_0x2b4f('0x21')]],'as':_0x55ba62['as'],'attributes':_0x55ba62[_0x2b4f('0x1e')],'include':_0x55ba62['include']?_[_0x2b4f('0x22')](_0x55ba62['include'],function(_0x51cfed){return{'model':db[_0x51cfed[_0x2b4f('0x21')]],'as':_0x51cfed['as'],'attributes':_0x51cfed['attributes']};}):[]};}):[]};}):[]:[]})[_0x2b4f('0xf')](function(_0x51a348){logger[_0x2b4f('0x10')]('GetMailQueue',_0x1c109a);logger[_0x2b4f('0x13')](_0x2b4f('0x1a'),_0x1c109a,JSON[_0x2b4f('0x15')](_0x51a348));_0x449137(_0x51a348);})[_0x2b4f('0x19')](function(_0x48fb00){logger[_0x2b4f('0x16')]('GetMailQueue',_0x48fb00[_0x2b4f('0x18')],_0x1c109a);_0x4ba2f1(_0x12751e[_0x2b4f('0x16')](0x1f4,_0x48fb00['message']));});});};exports[_0x2b4f('0x23')]=function(_0x49afb9){var _0x375c21=this;return new Promise(function(_0x506bbe,_0x59eda4){return db[_0x2b4f('0x1b')][_0x2b4f('0x24')]({'raw':_0x49afb9[_0x2b4f('0x1d')]?_0x49afb9[_0x2b4f('0x1d')][_0x2b4f('0x25')]===undefined?!![]:![]:!![],'where':_0x49afb9[_0x2b4f('0x1d')]?_0x49afb9['options']['where']||null:null,'attributes':_0x49afb9[_0x2b4f('0x1d')]?_0x49afb9[_0x2b4f('0x1d')][_0x2b4f('0x1e')]||null:null,'include':_0x49afb9[_0x2b4f('0x1d')]?_0x49afb9[_0x2b4f('0x1d')][_0x2b4f('0x20')]?_[_0x2b4f('0x22')](_0x49afb9[_0x2b4f('0x1d')][_0x2b4f('0x20')],function(_0x5285ef){return{'model':db[_0x5285ef[_0x2b4f('0x21')]],'as':_0x5285ef['as'],'attributes':_0x5285ef[_0x2b4f('0x1e')],'include':_0x5285ef[_0x2b4f('0x20')]?_[_0x2b4f('0x22')](_0x5285ef[_0x2b4f('0x20')],function(_0x5dfede){return{'model':db[_0x5dfede['model']],'as':_0x5dfede['as'],'attributes':_0x5dfede[_0x2b4f('0x1e')],'include':_0x5dfede['include']?_[_0x2b4f('0x22')](_0x5dfede[_0x2b4f('0x20')],function(_0x2a6efc){return{'model':db[_0x2a6efc[_0x2b4f('0x21')]],'as':_0x2a6efc['as'],'attributes':_0x2a6efc[_0x2b4f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2b4f('0xf')](function(_0x554054){logger[_0x2b4f('0x10')](_0x2b4f('0x23'),_0x49afb9);logger[_0x2b4f('0x13')](_0x2b4f('0x23'),_0x49afb9,JSON[_0x2b4f('0x15')](_0x554054));_0x506bbe(_0x554054);})[_0x2b4f('0x19')](function(_0x329f72){logger[_0x2b4f('0x16')](_0x2b4f('0x23'),_0x329f72[_0x2b4f('0x18')],_0x49afb9);_0x59eda4(_0x375c21[_0x2b4f('0x16')](0x1f4,_0x329f72[_0x2b4f('0x18')]));});});}; \ No newline at end of file +var _0xc1aa=['MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowMailQueue','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','./mailQueue.socket','request','info','request\x20sent','debug'];(function(_0x2714c4,_0x28b388){var _0x5626c8=function(_0x26a6cd){while(--_0x26a6cd){_0x2714c4['push'](_0x2714c4['shift']());}};_0x5626c8(++_0x28b388);}(_0xc1aa,0xa9));var _0xac1a=function(_0x328eca,_0x3ae0f4){_0x328eca=_0x328eca-0x0;var _0xeb6aff=_0xc1aa[_0x328eca];return _0xeb6aff;};'use strict';var _=require(_0xac1a('0x0'));var util=require('util');var moment=require(_0xac1a('0x1'));var BPromise=require(_0xac1a('0x2'));var rs=require(_0xac1a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac1a('0x4'))['db'];var utils=require(_0xac1a('0x5'));var logger=require('../../config/logger')(_0xac1a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xac1a('0x7')]({'port':0x232a});config[_0xac1a('0x8')]=_[_0xac1a('0x9')](config[_0xac1a('0x8')],{'host':_0xac1a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xac1a('0xb'))['register'](socket);function respondWithRpcPromise(_0x330545,_0x209577,_0x4535c6){return new BPromise(function(_0x6d12ba,_0x6defc7){return client[_0xac1a('0xc')](_0x330545,_0x4535c6)['then'](function(_0x46201c){logger[_0xac1a('0xd')]('MailQueue,\x20%s,\x20%s',_0x209577,_0xac1a('0xe'));logger[_0xac1a('0xf')](_0xac1a('0x10'),_0x209577,'request\x20sent',JSON[_0xac1a('0x11')](_0x46201c));if(_0x46201c['error']){if(_0x46201c[_0xac1a('0x12')][_0xac1a('0x13')]===0x1f4){logger[_0xac1a('0x12')](_0xac1a('0x14'),_0x209577,_0x46201c[_0xac1a('0x12')][_0xac1a('0x15')]);return _0x6defc7(_0x46201c['error'][_0xac1a('0x15')]);}logger[_0xac1a('0x12')]('MailQueue,\x20%s,\x20%s',_0x209577,_0x46201c[_0xac1a('0x12')]['message']);return _0x6d12ba(_0x46201c[_0xac1a('0x12')][_0xac1a('0x15')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x209577,'request\x20sent');_0x6d12ba(_0x46201c['result'][_0xac1a('0x15')]);}})[_0xac1a('0x16')](function(_0x3ac392){logger[_0xac1a('0x12')]('MailQueue,\x20%s,\x20%s',_0x209577,_0x3ac392);_0x6defc7(_0x3ac392);});});}exports[_0xac1a('0x17')]=function(_0x4c66ad){var _0x4f45fc=this;return new Promise(function(_0x3a3916,_0x368093){return db[_0xac1a('0x18')][_0xac1a('0x19')]({'raw':_0x4c66ad[_0xac1a('0x1a')]?_0x4c66ad[_0xac1a('0x1a')][_0xac1a('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c66ad[_0xac1a('0x1a')]?_0x4c66ad['options'][_0xac1a('0x1c')]||null:null,'attributes':_0x4c66ad[_0xac1a('0x1a')]?_0x4c66ad['options'][_0xac1a('0x1d')]||null:null,'limit':_0x4c66ad['options']?_0x4c66ad[_0xac1a('0x1a')][_0xac1a('0x1e')]||null:null,'include':_0x4c66ad['options']?_0x4c66ad['options'][_0xac1a('0x1f')]?_[_0xac1a('0x20')](_0x4c66ad[_0xac1a('0x1a')][_0xac1a('0x1f')],function(_0x101f24){return{'model':db[_0x101f24[_0xac1a('0x21')]],'as':_0x101f24['as'],'attributes':_0x101f24[_0xac1a('0x1d')],'include':_0x101f24[_0xac1a('0x1f')]?_['map'](_0x101f24[_0xac1a('0x1f')],function(_0x5bb306){return{'model':db[_0x5bb306[_0xac1a('0x21')]],'as':_0x5bb306['as'],'attributes':_0x5bb306[_0xac1a('0x1d')],'include':_0x5bb306[_0xac1a('0x1f')]?_['map'](_0x5bb306[_0xac1a('0x1f')],function(_0x2567a5){return{'model':db[_0x2567a5[_0xac1a('0x21')]],'as':_0x2567a5['as'],'attributes':_0x2567a5[_0xac1a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xac1a('0x22')](function(_0x1a9129){logger[_0xac1a('0xd')](_0xac1a('0x17'),_0x4c66ad);logger[_0xac1a('0xf')](_0xac1a('0x17'),_0x4c66ad,JSON[_0xac1a('0x11')](_0x1a9129));_0x3a3916(_0x1a9129);})[_0xac1a('0x16')](function(_0x5cf9d2){logger[_0xac1a('0x12')](_0xac1a('0x17'),_0x5cf9d2[_0xac1a('0x15')],_0x4c66ad);_0x368093(_0x4f45fc[_0xac1a('0x12')](0x1f4,_0x5cf9d2[_0xac1a('0x15')]));});});};exports[_0xac1a('0x23')]=function(_0x392233){var _0x1ddd9d=this;return new Promise(function(_0x34a871,_0x505fc5){return db[_0xac1a('0x18')][_0xac1a('0x24')]({'raw':_0x392233[_0xac1a('0x1a')]?_0x392233[_0xac1a('0x1a')][_0xac1a('0x1b')]===undefined?!![]:![]:!![],'where':_0x392233[_0xac1a('0x1a')]?_0x392233['options']['where']||null:null,'attributes':_0x392233[_0xac1a('0x1a')]?_0x392233[_0xac1a('0x1a')][_0xac1a('0x1d')]||null:null,'include':_0x392233[_0xac1a('0x1a')]?_0x392233[_0xac1a('0x1a')][_0xac1a('0x1f')]?_[_0xac1a('0x20')](_0x392233[_0xac1a('0x1a')][_0xac1a('0x1f')],function(_0x476cb6){return{'model':db[_0x476cb6[_0xac1a('0x21')]],'as':_0x476cb6['as'],'attributes':_0x476cb6[_0xac1a('0x1d')],'include':_0x476cb6[_0xac1a('0x1f')]?_[_0xac1a('0x20')](_0x476cb6[_0xac1a('0x1f')],function(_0x4f3f7a){return{'model':db[_0x4f3f7a[_0xac1a('0x21')]],'as':_0x4f3f7a['as'],'attributes':_0x4f3f7a[_0xac1a('0x1d')],'include':_0x4f3f7a[_0xac1a('0x1f')]?_[_0xac1a('0x20')](_0x4f3f7a['include'],function(_0x5835e3){return{'model':db[_0x5835e3[_0xac1a('0x21')]],'as':_0x5835e3['as'],'attributes':_0x5835e3[_0xac1a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xac1a('0x22')](function(_0x1cf627){logger[_0xac1a('0xd')](_0xac1a('0x23'),_0x392233);logger[_0xac1a('0xf')](_0xac1a('0x23'),_0x392233,JSON[_0xac1a('0x11')](_0x1cf627));_0x34a871(_0x1cf627);})[_0xac1a('0x16')](function(_0x226a13){logger[_0xac1a('0x12')]('ShowMailQueue',_0x226a13['message'],_0x392233);_0x505fc5(_0x1ddd9d['error'](0x1f4,_0x226a13['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 746710a..4cf0061 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 _0xb36f=['length','mailQueue:','./mailQueue.events','save','remove','removeListener'];(function(_0x477d48,_0x22969e){var _0x25468f=function(_0x5ca53d){while(--_0x5ca53d){_0x477d48['push'](_0x477d48['shift']());}};_0x25468f(++_0x22969e);}(_0xb36f,0x1d6));var _0xfb36=function(_0x19e143,_0x598d80){_0x19e143=_0x19e143-0x0;var _0x3a432c=_0xb36f[_0x19e143];return _0x3a432c;};'use strict';var MailQueueEvents=require(_0xfb36('0x0'));var events=[_0xfb36('0x1'),_0xfb36('0x2'),'update'];function createListener(_0x4dbeee,_0x41e107){return function(_0x1090e0){_0x41e107['emit'](_0x4dbeee,_0x1090e0);};}function removeListener(_0x59f6b9,_0x1b1544){return function(){MailQueueEvents[_0xfb36('0x3')](_0x59f6b9,_0x1b1544);};}exports['register']=function(_0x1fc9d7){for(var _0x22261f=0x0,_0x43b64b=events[_0xfb36('0x4')];_0x22261f<_0x43b64b;_0x22261f++){var _0x4c1fc3=events[_0x22261f];var _0x39ec36=createListener(_0xfb36('0x5')+_0x4c1fc3,_0x1fc9d7);MailQueueEvents['on'](_0x4c1fc3,_0x39ec36);}}; \ No newline at end of file +var _0x6000=['removeListener','mailQueue:','./mailQueue.events','save','remove','update','emit'];(function(_0x1009e5,_0x366a75){var _0x2b89df=function(_0x4b0954){while(--_0x4b0954){_0x1009e5['push'](_0x1009e5['shift']());}};_0x2b89df(++_0x366a75);}(_0x6000,0x17c));var _0x0600=function(_0x365c7c,_0x2f02ba){_0x365c7c=_0x365c7c-0x0;var _0x76bb19=_0x6000[_0x365c7c];return _0x76bb19;};'use strict';var MailQueueEvents=require(_0x0600('0x0'));var events=[_0x0600('0x1'),_0x0600('0x2'),_0x0600('0x3')];function createListener(_0x37e04c,_0x2b0ffd){return function(_0x5cf86c){_0x2b0ffd[_0x0600('0x4')](_0x37e04c,_0x5cf86c);};}function removeListener(_0x347b82,_0x534e6e){return function(){MailQueueEvents[_0x0600('0x5')](_0x347b82,_0x534e6e);};}exports['register']=function(_0x38f630){for(var _0xc18208=0x0,_0x89927a=events['length'];_0xc18208<_0x89927a;_0xc18208++){var _0x45e348=events[_0xc18208];var _0x5730b2=createListener(_0x0600('0x6')+_0x45e348,_0x38f630);MailQueueEvents['on'](_0x45e348,_0x5730b2);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index d7e0b0e..4380d78 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 _0x3ac1=['Router','./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3ac1,0xd3));var _0x13ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ac1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x13ac('0x0'));var util=require(_0x13ac('0x1'));var path=require(_0x13ac('0x2'));var timeout=require(_0x13ac('0x3'));var express=require(_0x13ac('0x4'));var router=express[_0x13ac('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x13ac('0x6'));router[_0x13ac('0x7')]('/',auth[_0x13ac('0x8')](),controller['index']);router[_0x13ac('0x7')](_0x13ac('0x9'),auth['isAuthenticated'](),controller[_0x13ac('0xa')]);router['get'](_0x13ac('0xb'),auth[_0x13ac('0x8')](),controller[_0x13ac('0xc')]);router[_0x13ac('0xd')]('/',auth[_0x13ac('0x8')](),controller['create']);router[_0x13ac('0xe')]('/:id',auth[_0x13ac('0x8')](),controller['update']);router[_0x13ac('0xf')](_0x13ac('0xb'),auth[_0x13ac('0x8')](),controller[_0x13ac('0x10')]);module[_0x13ac('0x11')]=router; \ No newline at end of file +var _0x8bbe=['index','/describe','describe','/:id','show','post','create','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0x8bbe,0x73));var _0xe8bb=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0x8bbe[_0x5235a6];return _0x1cf37e;};'use strict';var multer=require(_0xe8bb('0x0'));var util=require('util');var path=require(_0xe8bb('0x1'));var timeout=require(_0xe8bb('0x2'));var express=require(_0xe8bb('0x3'));var router=express[_0xe8bb('0x4')]();var fs_extra=require(_0xe8bb('0x5'));var auth=require(_0xe8bb('0x6'));var interaction=require(_0xe8bb('0x7'));var config=require(_0xe8bb('0x8'));var controller=require('./mailQueueReport.controller');router[_0xe8bb('0x9')]('/',auth[_0xe8bb('0xa')](),controller[_0xe8bb('0xb')]);router[_0xe8bb('0x9')](_0xe8bb('0xc'),auth[_0xe8bb('0xa')](),controller[_0xe8bb('0xd')]);router[_0xe8bb('0x9')](_0xe8bb('0xe'),auth[_0xe8bb('0xa')](),controller[_0xe8bb('0xf')]);router[_0xe8bb('0x10')]('/',auth[_0xe8bb('0xa')](),controller[_0xe8bb('0x11')]);router[_0xe8bb('0x12')](_0xe8bb('0xe'),auth[_0xe8bb('0xa')](),controller['update']);router[_0xe8bb('0x13')]('/:id',auth[_0xe8bb('0xa')](),controller[_0xe8bb('0x14')]);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 38477bf..5e0dde2 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 _0x011c=['STRING','DATE','moment','sequelize','exports'];(function(_0x3c4e4c,_0x36ff70){var _0x144a87=function(_0x5efb4b){while(--_0x5efb4b){_0x3c4e4c['push'](_0x3c4e4c['shift']());}};_0x144a87(++_0x36ff70);}(_0x011c,0x8e));var _0xc011=function(_0x1ecb2d,_0x21215e){_0x1ecb2d=_0x1ecb2d-0x0;var _0x1693aa=_0x011c[_0x1ecb2d];return _0x1693aa;};'use strict';var moment=require(_0xc011('0x0'));var Sequelize=require(_0xc011('0x1'));module[_0xc011('0x2')]={'uniqueid':{'type':Sequelize[_0xc011('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc011('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc011('0x4')]},'acceptAt':{'type':Sequelize[_0xc011('0x4')]},'exitAt':{'type':Sequelize[_0xc011('0x4')]},'reason':{'type':Sequelize[_0xc011('0x3')]}}; \ No newline at end of file +var _0xb584=['DATE','sequelize','exports','STRING'];(function(_0x30515b,_0x323391){var _0x1b188d=function(_0x2c8938){while(--_0x2c8938){_0x30515b['push'](_0x30515b['shift']());}};_0x1b188d(++_0x323391);}(_0xb584,0x91));var _0x4b58=function(_0x14a994,_0xbf8d9b){_0x14a994=_0x14a994-0x0;var _0x135c82=_0xb584[_0x14a994];return _0x135c82;};'use strict';var moment=require('moment');var Sequelize=require(_0x4b58('0x0'));module[_0x4b58('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x4b58('0x2')]},'joinAt':{'type':Sequelize[_0x4b58('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4b58('0x3')]},'reason':{'type':Sequelize[_0x4b58('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index e835b00..6f5fb27 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 _0xef0f=['json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','MailQueueReport','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range'];(function(_0x3ad776,_0x1a5d9b){var _0x5d9e79=function(_0x55cec7){while(--_0x55cec7){_0x3ad776['push'](_0x3ad776['shift']());}};_0x5d9e79(++_0x1a5d9b);}(_0xef0f,0x168));var _0xfef0=function(_0x4271eb,_0x471c8f){_0x4271eb=_0x4271eb-0x0;var _0x30f7ed=_0xef0f[_0x4271eb];return _0x30f7ed;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var licenseUtil=require(_0xfef0('0x19'));var db=require(_0xfef0('0x1a'))['db'];function respondWithStatusCode(_0x546c7a,_0x3135ab){_0x3135ab=_0x3135ab||0xcc;return function(_0x2f4e23){if(_0x2f4e23){return _0x546c7a[_0xfef0('0x1b')](_0x3135ab);}return _0x546c7a[_0xfef0('0x1c')](_0x3135ab)[_0xfef0('0x1d')]();};}function respondWithResult(_0x45599a,_0xa9f040){_0xa9f040=_0xa9f040||0xc8;return function(_0x573ae7){if(_0x573ae7){return _0x45599a[_0xfef0('0x1c')](_0xa9f040)['json'](_0x573ae7);}};}function respondWithFilteredResult(_0x4b5bcf,_0x5acdd0){return function(_0x118b8d){if(_0x118b8d){var _0x284b6d=typeof _0x5acdd0[_0xfef0('0x1e')]===_0xfef0('0x1f')&&typeof _0x5acdd0[_0xfef0('0x20')]===_0xfef0('0x1f');var _0x155833=_0x118b8d[_0xfef0('0x21')];var _0x581459=_0x284b6d?0x0:_0x5acdd0[_0xfef0('0x1e')];var _0x1642cd=_0x284b6d?_0x118b8d[_0xfef0('0x21')]:_0x5acdd0[_0xfef0('0x1e')]+_0x5acdd0[_0xfef0('0x20')];var _0x55912f;if(_0x1642cd>=_0x155833){_0x1642cd=_0x155833;_0x55912f=0xc8;}else{_0x55912f=0xce;}_0x4b5bcf[_0xfef0('0x1c')](_0x55912f);return _0x4b5bcf['set'](_0xfef0('0x22'),_0x581459+'-'+_0x1642cd+'/'+_0x155833)[_0xfef0('0x23')](_0x118b8d);}return null;};}function patchUpdates(_0x28dee1){return function(_0x48408a){try{jsonpatch[_0xfef0('0x24')](_0x48408a,_0x28dee1,!![]);}catch(_0x4c304d){return BPromise[_0xfef0('0x25')](_0x4c304d);}return _0x48408a[_0xfef0('0x26')]();};}function saveUpdates(_0x52b93b,_0x4897af){return function(_0x4b8b22){if(_0x4b8b22){return _0x4b8b22[_0xfef0('0x27')](_0x52b93b)['then'](function(_0x1f9970){return _0x1f9970;});}return null;};}function removeEntity(_0x46b34a,_0x1a8d66){return function(_0x4483f2){if(_0x4483f2){return _0x4483f2[_0xfef0('0x28')]()[_0xfef0('0x29')](function(){_0x46b34a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x316e20,_0x1ffaa4){return function(_0x924f6e){if(!_0x924f6e){_0x316e20[_0xfef0('0x1b')](0x194);}return _0x924f6e;};}function handleError(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0x1f4;return function(_0x5df04f){logger[_0xfef0('0x2a')](_0x5df04f[_0xfef0('0x2b')]);if(_0x5df04f['name']){delete _0x5df04f[_0xfef0('0x2c')];}_0xab231c[_0xfef0('0x1c')](_0xf60f2)[_0xfef0('0x2d')](_0x5df04f);};}exports[_0xfef0('0x2e')]=function(_0x37921f,_0x1ac4a3){var _0x3e3c4c={},_0x3e026a={},_0x26cb9a={'count':0x0,'rows':[]};var _0x213a91=_[_0xfef0('0x2f')](db[_0xfef0('0x30')]['rawAttributes'],function(_0x445625){return{'name':_0x445625['fieldName'],'type':_0x445625['type'][_0xfef0('0x31')]};});_0x3e026a[_0xfef0('0x32')]=_['map'](_0x213a91,'name');_0x3e026a['query']=_['keys'](_0x37921f['query']);_0x3e026a[_0xfef0('0x33')]=_[_0xfef0('0x34')](_0x3e026a[_0xfef0('0x32')],_0x3e026a['query']);_0x3e3c4c['attributes']=_['intersection'](_0x3e026a[_0xfef0('0x32')],qs['fields'](_0x37921f[_0xfef0('0x35')][_0xfef0('0x36')]));_0x3e3c4c[_0xfef0('0x37')]=_0x3e3c4c['attributes'][_0xfef0('0x38')]?_0x3e3c4c['attributes']:_0x3e026a[_0xfef0('0x32')];if(!_0x37921f[_0xfef0('0x35')][_0xfef0('0x39')](_0xfef0('0x3a'))){_0x3e3c4c[_0xfef0('0x20')]=qs[_0xfef0('0x20')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x20')]);_0x3e3c4c['offset']=qs[_0xfef0('0x1e')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x1e')]);}_0x3e3c4c[_0xfef0('0x3b')]=qs[_0xfef0('0x3c')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x3c')]);_0x3e3c4c[_0xfef0('0x3d')]=qs[_0xfef0('0x33')](_[_0xfef0('0x3e')](_0x37921f[_0xfef0('0x35')],_0x3e026a[_0xfef0('0x33')]),_0x213a91);if(_0x37921f[_0xfef0('0x35')]['filter']){_0x3e3c4c[_0xfef0('0x3d')]=_['merge'](_0x3e3c4c[_0xfef0('0x3d')],{'$or':_[_0xfef0('0x2f')](_0x213a91,function(_0x1ddce6){if(_0x1ddce6['type']!==_0xfef0('0x3f')){var _0x29469e={};_0x29469e[_0x1ddce6[_0xfef0('0x2c')]]={'$like':'%'+_0x37921f['query'][_0xfef0('0x40')]+'%'};return _0x29469e;}})});}_0x3e3c4c=_[_0xfef0('0x41')]({},_0x3e3c4c,_0x37921f[_0xfef0('0x42')]);var _0x5577f4={'where':_0x3e3c4c[_0xfef0('0x3d')]};return db['MailQueueReport']['count'](_0x5577f4)[_0xfef0('0x29')](function(_0x547a5d){_0x26cb9a['count']=_0x547a5d;if(_0x37921f[_0xfef0('0x35')][_0xfef0('0x43')]){_0x3e3c4c[_0xfef0('0x44')]=[{'all':!![]}];}return db[_0xfef0('0x30')][_0xfef0('0x45')](_0x3e3c4c);})[_0xfef0('0x29')](function(_0x4dd8f8){_0x26cb9a[_0xfef0('0x46')]=_0x4dd8f8;return _0x26cb9a;})[_0xfef0('0x29')](respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c))['catch'](handleError(_0x1ac4a3,null));};exports['show']=function(_0x1d554e,_0x5dc824){var _0x1fc518={'raw':!![],'where':{'id':_0x1d554e[_0xfef0('0x47')]['id']}},_0x22c940={};_0x22c940[_0xfef0('0x32')]=_[_0xfef0('0x48')](db[_0xfef0('0x30')][_0xfef0('0x49')]);_0x22c940[_0xfef0('0x35')]=_['keys'](_0x1d554e[_0xfef0('0x35')]);_0x22c940['filters']=_['intersection'](_0x22c940[_0xfef0('0x32')],_0x22c940[_0xfef0('0x35')]);_0x1fc518['attributes']=_[_0xfef0('0x34')](_0x22c940['model'],qs[_0xfef0('0x36')](_0x1d554e[_0xfef0('0x35')][_0xfef0('0x36')]));_0x1fc518[_0xfef0('0x37')]=_0x1fc518['attributes'][_0xfef0('0x38')]?_0x1fc518[_0xfef0('0x37')]:_0x22c940['model'];if(_0x1d554e['query'][_0xfef0('0x43')]){_0x1fc518['include']=[{'all':!![]}];}_0x1fc518=_[_0xfef0('0x41')]({},_0x1fc518,_0x1d554e[_0xfef0('0x42')]);return db[_0xfef0('0x30')][_0xfef0('0x4a')](_0x1fc518)[_0xfef0('0x29')](handleEntityNotFound(_0x5dc824,null))[_0xfef0('0x29')](respondWithResult(_0x5dc824,null))['catch'](handleError(_0x5dc824,null));};exports[_0xfef0('0x4b')]=function(_0x559a28,_0x5a417e){return db[_0xfef0('0x30')][_0xfef0('0x4b')](_0x559a28[_0xfef0('0x4c')],{})['then'](respondWithResult(_0x5a417e,0xc9))[_0xfef0('0x4d')](handleError(_0x5a417e,null));};exports['update']=function(_0x5dd26b,_0x51f207){if(_0x5dd26b[_0xfef0('0x4c')]['id']){delete _0x5dd26b[_0xfef0('0x4c')]['id'];}return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x5dd26b[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x51f207,null))[_0xfef0('0x29')](saveUpdates(_0x5dd26b[_0xfef0('0x4c')],null))[_0xfef0('0x29')](respondWithResult(_0x51f207,null))['catch'](handleError(_0x51f207,null));};exports['destroy']=function(_0x2bebec,_0x18e5ba){return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x2bebec[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x18e5ba,null))[_0xfef0('0x29')](removeEntity(_0x18e5ba,null))[_0xfef0('0x4d')](handleError(_0x18e5ba,null));};exports['describe']=function(_0x2466e7,_0x19e449){return db[_0xfef0('0x30')][_0xfef0('0x4e')]()[_0xfef0('0x29')](respondWithResult(_0x19e449,null))['catch'](handleError(_0x19e449,null));}; \ No newline at end of file +var _0x7a54=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','MailQueueReport','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','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'];(function(_0x59fd02,_0x4cb9de){var _0x1e7aa5=function(_0x14acec){while(--_0x14acec){_0x59fd02['push'](_0x59fd02['shift']());}};_0x1e7aa5(++_0x4cb9de);}(_0x7a54,0x106));var _0x47a5=function(_0x87c88e,_0x370017){_0x87c88e=_0x87c88e-0x0;var _0x3ceabe=_0x7a54[_0x87c88e];return _0x3ceabe;};'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['MailQueueReport'][_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['MailQueueReport']['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['MailQueueReport']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x48')]=function(_0x1c9a62,_0x5f6a){return db['MailQueueReport'][_0x47a5('0x48')]()['then'](respondWithResult(_0x5f6a,null))[_0x47a5('0x46')](handleError(_0x5f6a,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 25ada9e..8ebda7a 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 _0x60f5=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash'];(function(_0x2454d4,_0xdeffbc){var _0x48edf9=function(_0x5d589e){while(--_0x5d589e){_0x2454d4['push'](_0x2454d4['shift']());}};_0x48edf9(++_0xdeffbc);}(_0x60f5,0x1e0));var _0x560f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x60f5[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x560f('0x0'));var util=require('util');var logger=require(_0x560f('0x1'))(_0x560f('0x2'));var moment=require(_0x560f('0x3'));var BPromise=require(_0x560f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x560f('0x5'));var rimraf=require(_0x560f('0x6'));var config=require(_0x560f('0x7'));var attributes=require(_0x560f('0x8'));module[_0x560f('0x9')]=function(_0x3dff7d,_0x56b447){return _0x3dff7d[_0x560f('0xa')](_0x560f('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x560f('0xc'),'fields':[_0x560f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1331=['./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x54c454,_0x25b922){var _0x378f08=function(_0x484ffb){while(--_0x484ffb){_0x54c454['push'](_0x54c454['shift']());}};_0x378f08(++_0x25b922);}(_0x1331,0x67));var _0x1133=function(_0x44156b,_0x1e64eb){_0x44156b=_0x44156b-0x0;var _0x3ede17=_0x1331[_0x44156b];return _0x3ede17;};'use strict';var _=require(_0x1133('0x0'));var util=require(_0x1133('0x1'));var logger=require(_0x1133('0x2'))(_0x1133('0x3'));var moment=require(_0x1133('0x4'));var BPromise=require('bluebird');var rp=require(_0x1133('0x5'));var fs=require('fs');var path=require(_0x1133('0x6'));var rimraf=require(_0x1133('0x7'));var config=require(_0x1133('0x8'));var attributes=require(_0x1133('0x9'));module[_0x1133('0xa')]=function(_0x2bce7b,_0x37be7a){return _0x2bce7b['define'](_0x1133('0xb'),attributes,{'tableName':_0x1133('0xc'),'paranoid':![],'indexes':[{'name':_0x1133('0xd'),'fields':[_0x1133('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 0c30070..e95ea81 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 _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x15bab7,_0x34358e){var _0x1ccd21=function(_0x2ba645){while(--_0x2ba645){_0x15bab7['push'](_0x15bab7['shift']());}};_0x1ccd21(++_0x34358e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x57e1a7,_0x54842e){_0x57e1a7=_0x57e1a7-0x0;var _0x39b7e3=_0x5f2f[_0x57e1a7];return _0x39b7e3;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file +var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x2c9332,_0x745b0c){var _0x4a14a9=function(_0x29bc9c){while(--_0x29bc9c){_0x2c9332['push'](_0x2c9332['shift']());}};_0x4a14a9(++_0x745b0c);}(_0xdb28,0x106));var _0x8db2=function(_0x50ee6d,_0x5f084b){_0x50ee6d=_0x50ee6d-0x0;var _0x691f0a=_0xdb28[_0x50ee6d];return _0x691f0a;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 5ca9253..9f43623 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1785ca,_0x405977){var _0x2773da=function(_0x11e2d1){while(--_0x11e2d1){_0x1785ca['push'](_0x1785ca['shift']());}};_0x2773da(++_0x405977);}(_0xedd9,0xfc));var _0x9edd=function(_0x23155c,_0x10777f){_0x23155c=_0x23155c-0x0;var _0x2678c4=_0xedd9[_0x23155c];return _0x2678c4;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x11afe7,_0x2dcbae){var _0x2967b5=function(_0x534484){while(--_0x534484){_0x11afe7['push'](_0x11afe7['shift']());}};_0x2967b5(++_0x2dcbae);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index aca47d0..32a27cb 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 _0x1332=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1332,0x1d4));var _0x2133=function(_0x2fceef,_0x2b6d38){_0x2fceef=_0x2fceef-0x0;var _0x59508b=_0x1332[_0x2fceef];return _0x59508b;};'use strict';var Sequelize=require(_0x2133('0x0'));module[_0x2133('0x1')]={'description':{'type':Sequelize[_0x2133('0x2')]},'host':{'type':Sequelize[_0x2133('0x2')]},'authentication':{'type':Sequelize[_0x2133('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x2133('0x2')]},'password':{'type':Sequelize[_0x2133('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x2133('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x2133('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x2133('0x2')]},'modernAuthentication':{'type':Sequelize[_0x2133('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x6689=['INTEGER','INBOX','exports','STRING','BOOLEAN'];(function(_0x43eb95,_0x2dc0e6){var _0x4ea40e=function(_0x489768){while(--_0x489768){_0x43eb95['push'](_0x43eb95['shift']());}};_0x4ea40e(++_0x2dc0e6);}(_0x6689,0x179));var _0x9668=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6689[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x9668('0x0')]={'description':{'type':Sequelize[_0x9668('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x9668('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x9668('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x9668('0x3')]},'tls':{'type':Sequelize[_0x9668('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x9668('0x1')],'defaultValue':_0x9668('0x4')},'connTimeout':{'type':Sequelize[_0x9668('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9668('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x9668('0x1')]},'modernAuthentication':{'type':Sequelize[_0x9668('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 7a8a68e..5d19b65 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 _0xcb20=['exports','mail_servers_in','util','moment','path','../../config/environment','./mailServerIn.attributes'];(function(_0x430607,_0xcc9e03){var _0x1a8f84=function(_0x557b21){while(--_0x557b21){_0x430607['push'](_0x430607['shift']());}};_0x1a8f84(++_0xcc9e03);}(_0xcb20,0x13d));var _0x0cb2=function(_0x535783,_0x7253ab){_0x535783=_0x535783-0x0;var _0x5e2391=_0xcb20[_0x535783];return _0x5e2391;};'use strict';var _=require('lodash');var util=require(_0x0cb2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0cb2('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0cb2('0x2'));var rimraf=require('rimraf');var config=require(_0x0cb2('0x3'));var attributes=require(_0x0cb2('0x4'));module[_0x0cb2('0x5')]=function(_0x4fceed,_0x235dbe){return _0x4fceed['define']('MailServerIn',attributes,{'tableName':_0x0cb2('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fed=['rimraf','../../config/environment','./mailServerIn.attributes','exports','define','mail_servers_in','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x407d50,_0x1c258b){var _0x13e7cb=function(_0x3e7b1e){while(--_0x3e7b1e){_0x407d50['push'](_0x407d50['shift']());}};_0x13e7cb(++_0x1c258b);}(_0x9fed,0x126));var _0xd9fe=function(_0x586cb1,_0xeb36d){_0x586cb1=_0x586cb1-0x0;var _0x58cc8c=_0x9fed[_0x586cb1];return _0x58cc8c;};'use strict';var _=require('lodash');var util=require(_0xd9fe('0x0'));var logger=require(_0xd9fe('0x1'))(_0xd9fe('0x2'));var moment=require(_0xd9fe('0x3'));var BPromise=require(_0xd9fe('0x4'));var rp=require(_0xd9fe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd9fe('0x6'));var config=require(_0xd9fe('0x7'));var attributes=require(_0xd9fe('0x8'));module[_0xd9fe('0x9')]=function(_0x5adebd,_0x45e9d0){return _0x5adebd[_0xd9fe('0xa')]('MailServerIn',attributes,{'tableName':_0xd9fe('0xb'),'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 44bfe0e..97dce92 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 _0x4003=['request','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','map','include','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x33f7e1,_0x48d209){var _0x23bab4=function(_0xd532b0){while(--_0xd532b0){_0x33f7e1['push'](_0x33f7e1['shift']());}};_0x23bab4(++_0x48d209);}(_0x4003,0x1a1));var _0x3400=function(_0x28bfdc,_0x50fd27){_0x28bfdc=_0x28bfdc-0x0;var _0x25bf45=_0x4003[_0x28bfdc];return _0x25bf45;};'use strict';var _=require(_0x3400('0x0'));var util=require(_0x3400('0x1'));var moment=require('moment');var BPromise=require(_0x3400('0x2'));var rs=require(_0x3400('0x3'));var fs=require('fs');var Redis=require(_0x3400('0x4'));var db=require(_0x3400('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3400('0x6'))(_0x3400('0x7'));var config=require(_0x3400('0x8'));var jayson=require(_0x3400('0x9'));var client=jayson[_0x3400('0xa')][_0x3400('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49cbf3,_0x29479d,_0x25e461){return new BPromise(function(_0x2effce,_0x491fa0){return client[_0x3400('0xc')](_0x49cbf3,_0x25e461)['then'](function(_0x2e751e){logger[_0x3400('0xd')]('MailServerIn,\x20%s,\x20%s',_0x29479d,_0x3400('0xe'));logger[_0x3400('0xf')](_0x3400('0x10'),_0x29479d,_0x3400('0xe'),JSON['stringify'](_0x2e751e));if(_0x2e751e[_0x3400('0x11')]){if(_0x2e751e['error'][_0x3400('0x12')]===0x1f4){logger[_0x3400('0x11')](_0x3400('0x13'),_0x29479d,_0x2e751e[_0x3400('0x11')]['message']);return _0x491fa0(_0x2e751e[_0x3400('0x11')][_0x3400('0x14')]);}logger[_0x3400('0x11')](_0x3400('0x13'),_0x29479d,_0x2e751e[_0x3400('0x11')][_0x3400('0x14')]);return _0x2effce(_0x2e751e['error'][_0x3400('0x14')]);}else{logger['info'](_0x3400('0x13'),_0x29479d,'request\x20sent');_0x2effce(_0x2e751e[_0x3400('0x15')]['message']);}})[_0x3400('0x16')](function(_0x2b831d){logger[_0x3400('0x11')]('MailServerIn,\x20%s,\x20%s',_0x29479d,_0x2b831d);_0x491fa0(_0x2b831d);});});}exports[_0x3400('0x17')]=function(_0x4b5367){var _0x346118=this;return new Promise(function(_0x10d280,_0xcadb72){return db[_0x3400('0x18')][_0x3400('0x19')]({'raw':_0x4b5367[_0x3400('0x1a')]?_0x4b5367[_0x3400('0x1a')][_0x3400('0x1b')]===undefined?!![]:![]:!![],'where':_0x4b5367[_0x3400('0x1a')]?_0x4b5367[_0x3400('0x1a')][_0x3400('0x1c')]||null:null,'attributes':_0x4b5367['options']?_0x4b5367['options'][_0x3400('0x1d')]||null:null,'limit':_0x4b5367[_0x3400('0x1a')]?_0x4b5367[_0x3400('0x1a')]['limit']||null:null,'include':_0x4b5367[_0x3400('0x1a')]?_0x4b5367[_0x3400('0x1a')]['include']?_[_0x3400('0x1e')](_0x4b5367[_0x3400('0x1a')][_0x3400('0x1f')],function(_0x329dd9){return{'model':db[_0x329dd9['model']],'as':_0x329dd9['as'],'attributes':_0x329dd9[_0x3400('0x1d')],'include':_0x329dd9['include']?_[_0x3400('0x1e')](_0x329dd9[_0x3400('0x1f')],function(_0x25d086){return{'model':db[_0x25d086[_0x3400('0x20')]],'as':_0x25d086['as'],'attributes':_0x25d086[_0x3400('0x1d')],'include':_0x25d086[_0x3400('0x1f')]?_[_0x3400('0x1e')](_0x25d086[_0x3400('0x1f')],function(_0x15074b){return{'model':db[_0x15074b[_0x3400('0x20')]],'as':_0x15074b['as'],'attributes':_0x15074b[_0x3400('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x359727){logger[_0x3400('0xd')](_0x3400('0x17'),_0x4b5367);logger[_0x3400('0xf')](_0x3400('0x17'),_0x4b5367,JSON['stringify'](_0x359727));_0x10d280(_0x359727);})[_0x3400('0x16')](function(_0x58f82b){logger[_0x3400('0x11')](_0x3400('0x17'),_0x58f82b[_0x3400('0x14')],_0x4b5367);_0xcadb72(_0x346118[_0x3400('0x11')](0x1f4,_0x58f82b[_0x3400('0x14')]));});});}; \ No newline at end of file +var _0xbb53=['options','raw','where','attributes','limit','include','map','model','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','stringify','error','message','MailServerIn,\x20%s,\x20%s','result','GetMailServerIn'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xbb53,0x121));var _0x3bb5=function(_0x54574f,_0x1b4743){_0x54574f=_0x54574f-0x0;var _0x8ddf1d=_0xbb53[_0x54574f];return _0x8ddf1d;};'use strict';var _=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var moment=require(_0x3bb5('0x2'));var BPromise=require(_0x3bb5('0x3'));var rs=require(_0x3bb5('0x4'));var fs=require('fs');var Redis=require(_0x3bb5('0x5'));var db=require(_0x3bb5('0x6'))['db'];var utils=require(_0x3bb5('0x7'));var logger=require(_0x3bb5('0x8'))(_0x3bb5('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3bb5('0xa')][_0x3bb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28aa7d,_0x157e04,_0x22f92f){return new BPromise(function(_0x480f9c,_0x5a4ae3){return client['request'](_0x28aa7d,_0x22f92f)[_0x3bb5('0xc')](function(_0x2e0cfa){logger[_0x3bb5('0xd')]('MailServerIn,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x157e04,_0x3bb5('0xe'),JSON[_0x3bb5('0xf')](_0x2e0cfa));if(_0x2e0cfa['error']){if(_0x2e0cfa[_0x3bb5('0x10')]['code']===0x1f4){logger[_0x3bb5('0x10')]('MailServerIn,\x20%s,\x20%s',_0x157e04,_0x2e0cfa['error'][_0x3bb5('0x11')]);return _0x5a4ae3(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}logger['error'](_0x3bb5('0x12'),_0x157e04,_0x2e0cfa[_0x3bb5('0x10')]['message']);return _0x480f9c(_0x2e0cfa[_0x3bb5('0x10')][_0x3bb5('0x11')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x157e04,'request\x20sent');_0x480f9c(_0x2e0cfa[_0x3bb5('0x13')][_0x3bb5('0x11')]);}})['catch'](function(_0x25d774){logger[_0x3bb5('0x10')](_0x3bb5('0x12'),_0x157e04,_0x25d774);_0x5a4ae3(_0x25d774);});});}exports[_0x3bb5('0x14')]=function(_0x48bc25){var _0x13cb3a=this;return new Promise(function(_0x1109d0,_0x289177){return db['MailServerIn']['findAll']({'raw':_0x48bc25[_0x3bb5('0x15')]?_0x48bc25[_0x3bb5('0x15')][_0x3bb5('0x16')]===undefined?!![]:![]:!![],'where':_0x48bc25['options']?_0x48bc25[_0x3bb5('0x15')][_0x3bb5('0x17')]||null:null,'attributes':_0x48bc25[_0x3bb5('0x15')]?_0x48bc25[_0x3bb5('0x15')][_0x3bb5('0x18')]||null:null,'limit':_0x48bc25[_0x3bb5('0x15')]?_0x48bc25['options'][_0x3bb5('0x19')]||null:null,'include':_0x48bc25[_0x3bb5('0x15')]?_0x48bc25[_0x3bb5('0x15')][_0x3bb5('0x1a')]?_[_0x3bb5('0x1b')](_0x48bc25[_0x3bb5('0x15')][_0x3bb5('0x1a')],function(_0x58c10f){return{'model':db[_0x58c10f[_0x3bb5('0x1c')]],'as':_0x58c10f['as'],'attributes':_0x58c10f[_0x3bb5('0x18')],'include':_0x58c10f['include']?_['map'](_0x58c10f[_0x3bb5('0x1a')],function(_0x36cfda){return{'model':db[_0x36cfda['model']],'as':_0x36cfda['as'],'attributes':_0x36cfda['attributes'],'include':_0x36cfda[_0x3bb5('0x1a')]?_[_0x3bb5('0x1b')](_0x36cfda[_0x3bb5('0x1a')],function(_0xc1c149){return{'model':db[_0xc1c149['model']],'as':_0xc1c149['as'],'attributes':_0xc1c149['attributes']};}):[]};}):[]};}):[]:[]})[_0x3bb5('0xc')](function(_0x4e8c65){logger[_0x3bb5('0xd')](_0x3bb5('0x14'),_0x48bc25);logger[_0x3bb5('0x1d')]('GetMailServerIn',_0x48bc25,JSON['stringify'](_0x4e8c65));_0x1109d0(_0x4e8c65);})[_0x3bb5('0x1e')](function(_0x39f1ad){logger[_0x3bb5('0x10')](_0x3bb5('0x14'),_0x39f1ad[_0x3bb5('0x11')],_0x48bc25);_0x289177(_0x13cb3a[_0x3bb5('0x10')](0x1f4,_0x39f1ad[_0x3bb5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index dbaf1c9..ead759a 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(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7a54,0x106));var _0x47a5=function(_0x22c234,_0x488bec){_0x22c234=_0x22c234-0x0;var _0x44ea8f=_0x7a54[_0x22c234];return _0x44ea8f;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7a54,0x106));var _0x47a5=function(_0x36e77d,_0x1df135){_0x36e77d=_0x36e77d-0x0;var _0x4d3f06=_0x7a54[_0x36e77d];return _0x4d3f06;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 6e12571..97d6da2 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 _0xb7e7=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x2e60b5,_0x149a69){var _0x467bdf=function(_0x222457){while(--_0x222457){_0x2e60b5['push'](_0x2e60b5['shift']());}};_0x467bdf(++_0x149a69);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb7e7[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'description':{'type':Sequelize[_0x7b7e('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x7b7e('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x7b7e('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x7b7e('0x1')]},'authentication':{'type':Sequelize[_0x7b7e('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x7b7e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0713=['BOOLEAN','STRING','INTEGER'];(function(_0x519100,_0x329efd){var _0x5e0f0c=function(_0x18bed6){while(--_0x18bed6){_0x519100['push'](_0x519100['shift']());}};_0x5e0f0c(++_0x329efd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x3071('0x0')]},'host':{'type':Sequelize[_0x3071('0x0')]},'user':{'type':Sequelize[_0x3071('0x0')]},'pass':{'type':Sequelize[_0x3071('0x0')]},'port':{'type':Sequelize[_0x3071('0x1')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x3071('0x0')]},'authentication':{'type':Sequelize[_0x3071('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3071('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 3da4536..3790dc6 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 _0xee78=['fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../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','reject','save','update','then','error','stack','name','send','index','map','MailServerOut','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','create','body','destroy','eml-format','rimraf','zip-dir'];(function(_0x49536b,_0x2abe5d){var _0x30de59=function(_0xb848e3){while(--_0xb848e3){_0x49536b['push'](_0x49536b['shift']());}};_0x30de59(++_0x2abe5d);}(_0xee78,0x95));var _0x8ee7=function(_0x5c5b24,_0xe2eb09){_0x5c5b24=_0x5c5b24-0x0;var _0x32321b=_0xee78[_0x5c5b24];return _0x32321b;};'use strict';var emlformat=require(_0x8ee7('0x0'));var rimraf=require(_0x8ee7('0x1'));var zipdir=require(_0x8ee7('0x2'));var jsonpatch=require(_0x8ee7('0x3'));var rp=require(_0x8ee7('0x4'));var moment=require(_0x8ee7('0x5'));var BPromise=require(_0x8ee7('0x6'));var Mustache=require(_0x8ee7('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8ee7('0x8'));var csv=require(_0x8ee7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ee7('0xa'));var _=require('lodash');var squel=require(_0x8ee7('0xb'));var crypto=require(_0x8ee7('0xc'));var jsforce=require(_0x8ee7('0xd'));var deskjs=require(_0x8ee7('0xe'));var toCsv=require(_0x8ee7('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8ee7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8ee7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ee7('0x11'));var logger=require(_0x8ee7('0x12'))('api');var utils=require(_0x8ee7('0x13'));var config=require(_0x8ee7('0x14'));var licenseUtil=require(_0x8ee7('0x15'));var db=require(_0x8ee7('0x16'))['db'];function respondWithStatusCode(_0x8518cc,_0xcf71ee){_0xcf71ee=_0xcf71ee||0xcc;return function(_0x44d767){if(_0x44d767){return _0x8518cc[_0x8ee7('0x17')](_0xcf71ee);}return _0x8518cc[_0x8ee7('0x18')](_0xcf71ee)[_0x8ee7('0x19')]();};}function respondWithResult(_0x1f6212,_0x4eb983){_0x4eb983=_0x4eb983||0xc8;return function(_0x7a36dd){if(_0x7a36dd){return _0x1f6212[_0x8ee7('0x18')](_0x4eb983)[_0x8ee7('0x1a')](_0x7a36dd);}};}function respondWithFilteredResult(_0x3bb87e,_0x15392a){return function(_0x15c70e){if(_0x15c70e){var _0x74f6e6=typeof _0x15392a[_0x8ee7('0x1b')]===_0x8ee7('0x1c')&&typeof _0x15392a[_0x8ee7('0x1d')]===_0x8ee7('0x1c');var _0x493804=_0x15c70e[_0x8ee7('0x1e')];var _0x410c8a=_0x74f6e6?0x0:_0x15392a[_0x8ee7('0x1b')];var _0x1938ba=_0x74f6e6?_0x15c70e[_0x8ee7('0x1e')]:_0x15392a[_0x8ee7('0x1b')]+_0x15392a[_0x8ee7('0x1d')];var _0x850a59;if(_0x1938ba>=_0x493804){_0x1938ba=_0x493804;_0x850a59=0xc8;}else{_0x850a59=0xce;}_0x3bb87e[_0x8ee7('0x18')](_0x850a59);return _0x3bb87e[_0x8ee7('0x1f')](_0x8ee7('0x20'),_0x410c8a+'-'+_0x1938ba+'/'+_0x493804)['json'](_0x15c70e);}return null;};}function patchUpdates(_0x9b33e4){return function(_0x8c2434){try{jsonpatch['apply'](_0x8c2434,_0x9b33e4,!![]);}catch(_0x4ebdb3){return BPromise[_0x8ee7('0x21')](_0x4ebdb3);}return _0x8c2434[_0x8ee7('0x22')]();};}function saveUpdates(_0x47e4b1,_0x1b38af){return function(_0x545254){if(_0x545254){return _0x545254[_0x8ee7('0x23')](_0x47e4b1)[_0x8ee7('0x24')](function(_0x5a2908){return _0x5a2908;});}return null;};}function removeEntity(_0x1d5353,_0x15b5bf){return function(_0x4e337f){if(_0x4e337f){return _0x4e337f['destroy']()['then'](function(){_0x1d5353[_0x8ee7('0x18')](0xcc)[_0x8ee7('0x19')]();});}};}function handleEntityNotFound(_0x1a5b23,_0x407a86){return function(_0x25b147){if(!_0x25b147){_0x1a5b23[_0x8ee7('0x17')](0x194);}return _0x25b147;};}function handleError(_0x4b0265,_0xe523db){_0xe523db=_0xe523db||0x1f4;return function(_0x47c18c){logger[_0x8ee7('0x25')](_0x47c18c[_0x8ee7('0x26')]);if(_0x47c18c['name']){delete _0x47c18c[_0x8ee7('0x27')];}_0x4b0265[_0x8ee7('0x18')](_0xe523db)[_0x8ee7('0x28')](_0x47c18c);};}exports[_0x8ee7('0x29')]=function(_0x4cf747,_0xa17ee1){var _0x31d885={},_0x2f7ea6={},_0x56f57d={'count':0x0,'rows':[]};var _0x2cc58c=_[_0x8ee7('0x2a')](db[_0x8ee7('0x2b')]['rawAttributes'],function(_0x54be0d){return{'name':_0x54be0d[_0x8ee7('0x2c')],'type':_0x54be0d[_0x8ee7('0x2d')][_0x8ee7('0x2e')]};});_0x2f7ea6[_0x8ee7('0x2f')]=_[_0x8ee7('0x2a')](_0x2cc58c,_0x8ee7('0x27'));_0x2f7ea6[_0x8ee7('0x30')]=_['keys'](_0x4cf747[_0x8ee7('0x30')]);_0x2f7ea6['filters']=_[_0x8ee7('0x31')](_0x2f7ea6[_0x8ee7('0x2f')],_0x2f7ea6[_0x8ee7('0x30')]);_0x31d885[_0x8ee7('0x32')]=_[_0x8ee7('0x31')](_0x2f7ea6[_0x8ee7('0x2f')],qs[_0x8ee7('0x33')](_0x4cf747['query'][_0x8ee7('0x33')]));_0x31d885[_0x8ee7('0x32')]=_0x31d885['attributes']['length']?_0x31d885[_0x8ee7('0x32')]:_0x2f7ea6[_0x8ee7('0x2f')];if(!_0x4cf747['query'][_0x8ee7('0x34')](_0x8ee7('0x35'))){_0x31d885[_0x8ee7('0x1d')]=qs[_0x8ee7('0x1d')](_0x4cf747[_0x8ee7('0x30')][_0x8ee7('0x1d')]);_0x31d885['offset']=qs['offset'](_0x4cf747['query'][_0x8ee7('0x1b')]);}_0x31d885[_0x8ee7('0x36')]=qs[_0x8ee7('0x37')](_0x4cf747[_0x8ee7('0x30')][_0x8ee7('0x37')]);_0x31d885[_0x8ee7('0x38')]=qs[_0x8ee7('0x39')](_[_0x8ee7('0x3a')](_0x4cf747[_0x8ee7('0x30')],_0x2f7ea6['filters']),_0x2cc58c);if(_0x4cf747['query']['filter']){_0x31d885['where']=_[_0x8ee7('0x3b')](_0x31d885['where'],{'$or':_[_0x8ee7('0x2a')](_0x2cc58c,function(_0x5737fb){if(_0x5737fb[_0x8ee7('0x2d')]!=='VIRTUAL'){var _0x576199={};_0x576199[_0x5737fb[_0x8ee7('0x27')]]={'$like':'%'+_0x4cf747[_0x8ee7('0x30')][_0x8ee7('0x3c')]+'%'};return _0x576199;}})});}_0x31d885=_[_0x8ee7('0x3b')]({},_0x31d885,_0x4cf747[_0x8ee7('0x3d')]);var _0x3ad2bb={'where':_0x31d885[_0x8ee7('0x38')]};return db[_0x8ee7('0x2b')][_0x8ee7('0x1e')](_0x3ad2bb)['then'](function(_0x5e7e25){_0x56f57d[_0x8ee7('0x1e')]=_0x5e7e25;if(_0x4cf747['query'][_0x8ee7('0x3e')]){_0x31d885[_0x8ee7('0x3f')]=[{'all':!![]}];}return db['MailServerOut'][_0x8ee7('0x40')](_0x31d885);})[_0x8ee7('0x24')](function(_0x2bcd96){_0x56f57d[_0x8ee7('0x41')]=_0x2bcd96;return _0x56f57d;})[_0x8ee7('0x24')](respondWithFilteredResult(_0xa17ee1,_0x31d885))[_0x8ee7('0x42')](handleError(_0xa17ee1,null));};exports[_0x8ee7('0x43')]=function(_0x2dbc81,_0x2b23e0){var _0x20ce8e={'raw':!![],'where':{'id':_0x2dbc81[_0x8ee7('0x44')]['id']}},_0x3e125f={};_0x3e125f['model']=_[_0x8ee7('0x45')](db[_0x8ee7('0x2b')][_0x8ee7('0x46')]);_0x3e125f[_0x8ee7('0x30')]=_[_0x8ee7('0x45')](_0x2dbc81[_0x8ee7('0x30')]);_0x3e125f[_0x8ee7('0x39')]=_['intersection'](_0x3e125f['model'],_0x3e125f[_0x8ee7('0x30')]);_0x20ce8e['attributes']=_[_0x8ee7('0x31')](_0x3e125f[_0x8ee7('0x2f')],qs[_0x8ee7('0x33')](_0x2dbc81[_0x8ee7('0x30')]['fields']));_0x20ce8e['attributes']=_0x20ce8e[_0x8ee7('0x32')][_0x8ee7('0x47')]?_0x20ce8e[_0x8ee7('0x32')]:_0x3e125f['model'];if(_0x2dbc81[_0x8ee7('0x30')][_0x8ee7('0x3e')]){_0x20ce8e[_0x8ee7('0x3f')]=[{'all':!![]}];}_0x20ce8e=_[_0x8ee7('0x3b')]({},_0x20ce8e,_0x2dbc81[_0x8ee7('0x3d')]);return db[_0x8ee7('0x2b')][_0x8ee7('0x48')](_0x20ce8e)['then'](handleEntityNotFound(_0x2b23e0,null))['then'](respondWithResult(_0x2b23e0,null))[_0x8ee7('0x42')](handleError(_0x2b23e0,null));};exports[_0x8ee7('0x49')]=function(_0xe69d0,_0x5177c8){return db[_0x8ee7('0x2b')][_0x8ee7('0x49')](_0xe69d0[_0x8ee7('0x4a')],{})[_0x8ee7('0x24')](respondWithResult(_0x5177c8,0xc9))[_0x8ee7('0x42')](handleError(_0x5177c8,null));};exports[_0x8ee7('0x23')]=function(_0x346500,_0x2290d7){if(_0x346500['body']['id']){delete _0x346500[_0x8ee7('0x4a')]['id'];}return db[_0x8ee7('0x2b')]['find']({'where':{'id':_0x346500['params']['id']}})[_0x8ee7('0x24')](handleEntityNotFound(_0x2290d7,null))[_0x8ee7('0x24')](saveUpdates(_0x346500[_0x8ee7('0x4a')],null))['then'](respondWithResult(_0x2290d7,null))[_0x8ee7('0x42')](handleError(_0x2290d7,null));};exports[_0x8ee7('0x4b')]=function(_0x4d3206,_0xfec965){return db[_0x8ee7('0x2b')][_0x8ee7('0x48')]({'where':{'id':_0x4d3206[_0x8ee7('0x44')]['id']}})[_0x8ee7('0x24')](handleEntityNotFound(_0xfec965,null))[_0x8ee7('0x24')](removeEntity(_0xfec965,null))[_0x8ee7('0x42')](handleError(_0xfec965,null));}; \ No newline at end of file +var _0x98e1=['status','json','offset','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','where','merge','type','filter','options','includeAll','MailServerOut','rows','catch','show','params','keys','rawAttributes','length','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end'];(function(_0x37a2b0,_0xce4597){var _0x18d27e=function(_0x830319){while(--_0x830319){_0x37a2b0['push'](_0x37a2b0['shift']());}};_0x18d27e(++_0xce4597);}(_0x98e1,0x78));var _0x198e=function(_0x261ea0,_0x5b4d2a){_0x261ea0=_0x261ea0-0x0;var _0x414ad6=_0x98e1[_0x261ea0];return _0x414ad6;};'use strict';var emlformat=require(_0x198e('0x0'));var rimraf=require(_0x198e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x198e('0x2'));var rp=require(_0x198e('0x3'));var moment=require('moment');var BPromise=require(_0x198e('0x4'));var Mustache=require(_0x198e('0x5'));var util=require('util');var path=require('path');var sox=require(_0x198e('0x6'));var csv=require(_0x198e('0x7'));var ejs=require(_0x198e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x198e('0x9'));var squel=require(_0x198e('0xa'));var crypto=require(_0x198e('0xb'));var jsforce=require(_0x198e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x198e('0x7'));var querystring=require(_0x198e('0xd'));var Papa=require(_0x198e('0xe'));var Redis=require(_0x198e('0xf'));var authService=require(_0x198e('0x10'));var qs=require(_0x198e('0x11'));var as=require(_0x198e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x198e('0x13'))(_0x198e('0x14'));var utils=require(_0x198e('0x15'));var config=require(_0x198e('0x16'));var licenseUtil=require(_0x198e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38b794,_0x168123){_0x168123=_0x168123||0xcc;return function(_0x390b0b){if(_0x390b0b){return _0x38b794[_0x198e('0x18')](_0x168123);}return _0x38b794['status'](_0x168123)[_0x198e('0x19')]();};}function respondWithResult(_0x58d45e,_0x191cc4){_0x191cc4=_0x191cc4||0xc8;return function(_0x29f0d2){if(_0x29f0d2){return _0x58d45e[_0x198e('0x1a')](_0x191cc4)[_0x198e('0x1b')](_0x29f0d2);}};}function respondWithFilteredResult(_0x308335,_0x2ec84d){return function(_0x15dcd1){if(_0x15dcd1){var _0x586a1d=typeof _0x2ec84d[_0x198e('0x1c')]==='undefined'&&typeof _0x2ec84d[_0x198e('0x1d')]==='undefined';var _0xe8eca0=_0x15dcd1[_0x198e('0x1e')];var _0x4fd6d6=_0x586a1d?0x0:_0x2ec84d[_0x198e('0x1c')];var _0x2f38d4=_0x586a1d?_0x15dcd1[_0x198e('0x1e')]:_0x2ec84d[_0x198e('0x1c')]+_0x2ec84d[_0x198e('0x1d')];var _0x323e6d;if(_0x2f38d4>=_0xe8eca0){_0x2f38d4=_0xe8eca0;_0x323e6d=0xc8;}else{_0x323e6d=0xce;}_0x308335[_0x198e('0x1a')](_0x323e6d);return _0x308335['set'](_0x198e('0x1f'),_0x4fd6d6+'-'+_0x2f38d4+'/'+_0xe8eca0)[_0x198e('0x1b')](_0x15dcd1);}return null;};}function patchUpdates(_0x1fb0c3){return function(_0x20b12b){try{jsonpatch['apply'](_0x20b12b,_0x1fb0c3,!![]);}catch(_0x4c9733){return BPromise[_0x198e('0x20')](_0x4c9733);}return _0x20b12b[_0x198e('0x21')]();};}function saveUpdates(_0x51b727,_0x49be0e){return function(_0x3b758a){if(_0x3b758a){return _0x3b758a[_0x198e('0x22')](_0x51b727)[_0x198e('0x23')](function(_0x432947){return _0x432947;});}return null;};}function removeEntity(_0x32eb49,_0x3cc917){return function(_0x52b613){if(_0x52b613){return _0x52b613[_0x198e('0x24')]()[_0x198e('0x23')](function(){_0x32eb49[_0x198e('0x1a')](0xcc)[_0x198e('0x19')]();});}};}function handleEntityNotFound(_0x452864,_0x2e4f76){return function(_0x2fb15d){if(!_0x2fb15d){_0x452864[_0x198e('0x18')](0x194);}return _0x2fb15d;};}function handleError(_0x84b90,_0xc6b87e){_0xc6b87e=_0xc6b87e||0x1f4;return function(_0x4728f7){logger[_0x198e('0x25')](_0x4728f7[_0x198e('0x26')]);if(_0x4728f7[_0x198e('0x27')]){delete _0x4728f7[_0x198e('0x27')];}_0x84b90['status'](_0xc6b87e)[_0x198e('0x28')](_0x4728f7);};}exports[_0x198e('0x29')]=function(_0x30bc8,_0x41b1a9){var _0x5d4d08={},_0x3f8e7={},_0x2e3e92={'count':0x0,'rows':[]};var _0x5c7c4a=_[_0x198e('0x2a')](db['MailServerOut']['rawAttributes'],function(_0x1473ce){return{'name':_0x1473ce[_0x198e('0x2b')],'type':_0x1473ce['type'][_0x198e('0x2c')]};});_0x3f8e7[_0x198e('0x2d')]=_['map'](_0x5c7c4a,_0x198e('0x27'));_0x3f8e7[_0x198e('0x2e')]=_['keys'](_0x30bc8[_0x198e('0x2e')]);_0x3f8e7[_0x198e('0x2f')]=_[_0x198e('0x30')](_0x3f8e7['model'],_0x3f8e7[_0x198e('0x2e')]);_0x5d4d08['attributes']=_[_0x198e('0x30')](_0x3f8e7[_0x198e('0x2d')],qs[_0x198e('0x31')](_0x30bc8['query'][_0x198e('0x31')]));_0x5d4d08[_0x198e('0x32')]=_0x5d4d08[_0x198e('0x32')]['length']?_0x5d4d08['attributes']:_0x3f8e7[_0x198e('0x2d')];if(!_0x30bc8['query'][_0x198e('0x33')](_0x198e('0x34'))){_0x5d4d08['limit']=qs[_0x198e('0x1d')](_0x30bc8['query'][_0x198e('0x1d')]);_0x5d4d08[_0x198e('0x1c')]=qs[_0x198e('0x1c')](_0x30bc8['query'][_0x198e('0x1c')]);}_0x5d4d08['order']=qs[_0x198e('0x35')](_0x30bc8[_0x198e('0x2e')][_0x198e('0x35')]);_0x5d4d08['where']=qs['filters'](_[_0x198e('0x36')](_0x30bc8['query'],_0x3f8e7[_0x198e('0x2f')]),_0x5c7c4a);if(_0x30bc8['query']['filter']){_0x5d4d08[_0x198e('0x37')]=_[_0x198e('0x38')](_0x5d4d08['where'],{'$or':_[_0x198e('0x2a')](_0x5c7c4a,function(_0x1c29dd){if(_0x1c29dd[_0x198e('0x39')]!=='VIRTUAL'){var _0x4ddc75={};_0x4ddc75[_0x1c29dd[_0x198e('0x27')]]={'$like':'%'+_0x30bc8[_0x198e('0x2e')][_0x198e('0x3a')]+'%'};return _0x4ddc75;}})});}_0x5d4d08=_[_0x198e('0x38')]({},_0x5d4d08,_0x30bc8[_0x198e('0x3b')]);var _0x1349d3={'where':_0x5d4d08['where']};return db['MailServerOut']['count'](_0x1349d3)[_0x198e('0x23')](function(_0x5371e8){_0x2e3e92[_0x198e('0x1e')]=_0x5371e8;if(_0x30bc8[_0x198e('0x2e')][_0x198e('0x3c')]){_0x5d4d08['include']=[{'all':!![]}];}return db[_0x198e('0x3d')]['findAll'](_0x5d4d08);})['then'](function(_0x155443){_0x2e3e92[_0x198e('0x3e')]=_0x155443;return _0x2e3e92;})[_0x198e('0x23')](respondWithFilteredResult(_0x41b1a9,_0x5d4d08))[_0x198e('0x3f')](handleError(_0x41b1a9,null));};exports[_0x198e('0x40')]=function(_0x4c6c25,_0x323bab){var _0xbe51fa={'raw':!![],'where':{'id':_0x4c6c25[_0x198e('0x41')]['id']}},_0xeb3803={};_0xeb3803[_0x198e('0x2d')]=_[_0x198e('0x42')](db[_0x198e('0x3d')][_0x198e('0x43')]);_0xeb3803[_0x198e('0x2e')]=_[_0x198e('0x42')](_0x4c6c25[_0x198e('0x2e')]);_0xeb3803[_0x198e('0x2f')]=_[_0x198e('0x30')](_0xeb3803[_0x198e('0x2d')],_0xeb3803['query']);_0xbe51fa['attributes']=_[_0x198e('0x30')](_0xeb3803[_0x198e('0x2d')],qs[_0x198e('0x31')](_0x4c6c25[_0x198e('0x2e')]['fields']));_0xbe51fa[_0x198e('0x32')]=_0xbe51fa['attributes'][_0x198e('0x44')]?_0xbe51fa['attributes']:_0xeb3803[_0x198e('0x2d')];if(_0x4c6c25[_0x198e('0x2e')][_0x198e('0x3c')]){_0xbe51fa[_0x198e('0x45')]=[{'all':!![]}];}_0xbe51fa=_[_0x198e('0x38')]({},_0xbe51fa,_0x4c6c25['options']);return db[_0x198e('0x3d')][_0x198e('0x46')](_0xbe51fa)['then'](handleEntityNotFound(_0x323bab,null))[_0x198e('0x23')](respondWithResult(_0x323bab,null))[_0x198e('0x3f')](handleError(_0x323bab,null));};exports[_0x198e('0x47')]=function(_0x2ef36c,_0x2537e2){return db[_0x198e('0x3d')][_0x198e('0x47')](_0x2ef36c['body'],{})[_0x198e('0x23')](respondWithResult(_0x2537e2,0xc9))[_0x198e('0x3f')](handleError(_0x2537e2,null));};exports[_0x198e('0x22')]=function(_0x2827f5,_0x2843f3){if(_0x2827f5[_0x198e('0x48')]['id']){delete _0x2827f5[_0x198e('0x48')]['id'];}return db[_0x198e('0x3d')][_0x198e('0x46')]({'where':{'id':_0x2827f5['params']['id']}})[_0x198e('0x23')](handleEntityNotFound(_0x2843f3,null))[_0x198e('0x23')](saveUpdates(_0x2827f5[_0x198e('0x48')],null))[_0x198e('0x23')](respondWithResult(_0x2843f3,null))[_0x198e('0x3f')](handleError(_0x2843f3,null));};exports[_0x198e('0x24')]=function(_0x8d1b6f,_0x2090bf){return db[_0x198e('0x3d')][_0x198e('0x46')]({'where':{'id':_0x8d1b6f['params']['id']}})['then'](handleEntityNotFound(_0x2090bf,null))[_0x198e('0x23')](removeEntity(_0x2090bf,null))[_0x198e('0x3f')](handleError(_0x2090bf,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index c4218a4..cf732f2 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 _0x8253=['mail_servers_out','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x173ae9,_0x1b5f5a){var _0x7e0185=function(_0x47efeb){while(--_0x47efeb){_0x173ae9['push'](_0x173ae9['shift']());}};_0x7e0185(++_0x1b5f5a);}(_0x8253,0x1c9));var _0x3825=function(_0x3f77de,_0x5a5e5e){_0x3f77de=_0x3f77de-0x0;var _0x5b9158=_0x8253[_0x3f77de];return _0x5b9158;};'use strict';var _=require(_0x3825('0x0'));var util=require(_0x3825('0x1'));var logger=require(_0x3825('0x2'))('api');var moment=require(_0x3825('0x3'));var BPromise=require(_0x3825('0x4'));var rp=require(_0x3825('0x5'));var fs=require('fs');var path=require(_0x3825('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3825('0x7'));module[_0x3825('0x8')]=function(_0x33f423,_0x5f14d7){return _0x33f423[_0x3825('0x9')](_0x3825('0xa'),attributes,{'tableName':_0x3825('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x343e=['MailServerOut','mail_servers_out','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./mailServerOut.attributes','exports'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x343e,0x18e));var _0xe343=function(_0x4fa3e1,_0x49d70d){_0x4fa3e1=_0x4fa3e1-0x0;var _0x558250=_0x343e[_0x4fa3e1];return _0x558250;};'use strict';var _=require(_0xe343('0x0'));var util=require(_0xe343('0x1'));var logger=require('../../config/logger')(_0xe343('0x2'));var moment=require(_0xe343('0x3'));var BPromise=require(_0xe343('0x4'));var rp=require(_0xe343('0x5'));var fs=require('fs');var path=require(_0xe343('0x6'));var rimraf=require(_0xe343('0x7'));var config=require('../../config/environment');var attributes=require(_0xe343('0x8'));module[_0xe343('0x9')]=function(_0x47e1e8,_0xafd9f5){return _0x47e1e8['define'](_0xe343('0xa'),attributes,{'tableName':_0xe343('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index edbba68..bdc0f3b 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x341b8e,_0x49bf84){var _0x2ed1d4=function(_0x556d02){while(--_0x556d02){_0x341b8e['push'](_0x341b8e['shift']());}};_0x2ed1d4(++_0x49bf84);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xc4aa[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x2405d1,_0x74a236){var _0x128cbc=function(_0x4a046a){while(--_0x4a046a){_0x2405d1['push'](_0x2405d1['shift']());}};_0x128cbc(++_0x74a236);}(_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 moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 4752842..b59da05 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 _0xea4d=['./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x1475a6,_0x56628c){var _0x3c0d07=function(_0xf4e6f3){while(--_0xf4e6f3){_0x1475a6['push'](_0x1475a6['shift']());}};_0x3c0d07(++_0x56628c);}(_0xea4d,0xac));var _0xdea4=function(_0x461efe,_0x26f056){_0x461efe=_0x461efe-0x0;var _0x14984a=_0xea4d[_0x461efe];return _0x14984a;};'use strict';var multer=require(_0xdea4('0x0'));var util=require(_0xdea4('0x1'));var path=require(_0xdea4('0x2'));var timeout=require(_0xdea4('0x3'));var express=require(_0xdea4('0x4'));var router=express[_0xdea4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdea4('0x6'));var config=require(_0xdea4('0x7'));var controller=require(_0xdea4('0x8'));router[_0xdea4('0x9')]('/',auth[_0xdea4('0xa')](),controller['index']);router[_0xdea4('0x9')](_0xdea4('0xb'),auth[_0xdea4('0xa')](),controller[_0xdea4('0xc')]);router[_0xdea4('0x9')](_0xdea4('0xd'),auth[_0xdea4('0xa')](),controller['show']);router[_0xdea4('0xe')]('/',auth[_0xdea4('0xa')](),controller[_0xdea4('0xf')]);router[_0xdea4('0x10')](_0xdea4('0xd'),auth['isAuthenticated'](),controller[_0xdea4('0x11')]);router['delete'](_0xdea4('0xd'),auth[_0xdea4('0xa')](),controller[_0xdea4('0x12')]);module[_0xdea4('0x13')]=router; \ No newline at end of file +var _0x1da7=['post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x290e87,_0x245e4e){var _0x307d6d=function(_0x4a4338){while(--_0x4a4338){_0x290e87['push'](_0x290e87['shift']());}};_0x307d6d(++_0x245e4e);}(_0x1da7,0x1d1));var _0x71da=function(_0x52f297,_0x387093){_0x52f297=_0x52f297-0x0;var _0x2ed2d5=_0x1da7[_0x52f297];return _0x2ed2d5;};'use strict';var multer=require(_0x71da('0x0'));var util=require(_0x71da('0x1'));var path=require(_0x71da('0x2'));var timeout=require(_0x71da('0x3'));var express=require(_0x71da('0x4'));var router=express[_0x71da('0x5')]();var fs_extra=require(_0x71da('0x6'));var auth=require(_0x71da('0x7'));var interaction=require(_0x71da('0x8'));var config=require('../../config/environment');var controller=require(_0x71da('0x9'));router[_0x71da('0xa')]('/',auth[_0x71da('0xb')](),controller['index']);router[_0x71da('0xa')](_0x71da('0xc'),auth[_0x71da('0xb')](),controller['describe']);router[_0x71da('0xa')](_0x71da('0xd'),auth['isAuthenticated'](),controller[_0x71da('0xe')]);router[_0x71da('0xf')]('/',auth['isAuthenticated'](),controller[_0x71da('0x10')]);router[_0x71da('0x11')](_0x71da('0xd'),auth[_0x71da('0xb')](),controller[_0x71da('0x12')]);router['delete']('/:id',auth[_0x71da('0xb')](),controller['destroy']);module[_0x71da('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index fa97242..75c9e08 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 _0xdc97=['sequelize','exports','STRING'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xdc97,0x13b));var _0x7dc9=function(_0x56a8ab,_0x1f780b){_0x56a8ab=_0x56a8ab-0x0;var _0x43ef47=_0xdc97[_0x56a8ab];return _0x43ef47;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7dc9('0x2')]}}; \ No newline at end of file +var _0xeda8=['sequelize','exports','name','STRING'];(function(_0x4d40e3,_0x426460){var _0x4c9f04=function(_0x546be0){while(--_0x546be0){_0x4d40e3['push'](_0x4d40e3['shift']());}};_0x4c9f04(++_0x426460);}(_0xeda8,0x104));var _0x8eda=function(_0x367d3f,_0x245c21){_0x367d3f=_0x367d3f-0x0;var _0x4bec1e=_0xeda8[_0x367d3f];return _0x4bec1e;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8eda('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index f78f542..1331f8b 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 _0x86b7=['fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs'];(function(_0x5a5e54,_0x68b4c){var _0xafe241=function(_0x748902){while(--_0x748902){_0x5a5e54['push'](_0x5a5e54['shift']());}};_0xafe241(++_0x68b4c);}(_0x86b7,0x17e));var _0x786b=function(_0x27c9b2,_0x3e4252){_0x27c9b2=_0x27c9b2-0x0;var _0x3c6fbc=_0x86b7[_0x27c9b2];return _0x3c6fbc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x786b('0x0'));var jsonpatch=require(_0x786b('0x1'));var rp=require(_0x786b('0x2'));var moment=require(_0x786b('0x3'));var BPromise=require(_0x786b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x786b('0x5'));var csv=require(_0x786b('0x6'));var ejs=require(_0x786b('0x7'));var fs=require('fs');var fs_extra=require(_0x786b('0x8'));var _=require(_0x786b('0x9'));var squel=require(_0x786b('0xa'));var crypto=require(_0x786b('0xb'));var jsforce=require(_0x786b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x786b('0x6'));var querystring=require(_0x786b('0xd'));var Papa=require(_0x786b('0xe'));var Redis=require(_0x786b('0xf'));var authService=require(_0x786b('0x10'));var qs=require(_0x786b('0x11'));var as=require(_0x786b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x786b('0x13'))(_0x786b('0x14'));var utils=require(_0x786b('0x15'));var config=require(_0x786b('0x16'));var licenseUtil=require(_0x786b('0x17'));var db=require(_0x786b('0x18'))['db'];function respondWithStatusCode(_0x507982,_0x1272b6){_0x1272b6=_0x1272b6||0xcc;return function(_0x271a6d){if(_0x271a6d){return _0x507982[_0x786b('0x19')](_0x1272b6);}return _0x507982[_0x786b('0x1a')](_0x1272b6)[_0x786b('0x1b')]();};}function respondWithResult(_0x37eef9,_0x4f8d3f){_0x4f8d3f=_0x4f8d3f||0xc8;return function(_0x4cb925){if(_0x4cb925){return _0x37eef9[_0x786b('0x1a')](_0x4f8d3f)[_0x786b('0x1c')](_0x4cb925);}};}function respondWithFilteredResult(_0x5b4009,_0x1ad509){return function(_0x332962){if(_0x332962){var _0x182246=typeof _0x1ad509[_0x786b('0x1d')]==='undefined'&&typeof _0x1ad509['limit']==='undefined';var _0x317c56=_0x332962[_0x786b('0x1e')];var _0x110870=_0x182246?0x0:_0x1ad509[_0x786b('0x1d')];var _0x3190f9=_0x182246?_0x332962[_0x786b('0x1e')]:_0x1ad509['offset']+_0x1ad509[_0x786b('0x1f')];var _0xeb98;if(_0x3190f9>=_0x317c56){_0x3190f9=_0x317c56;_0xeb98=0xc8;}else{_0xeb98=0xce;}_0x5b4009['status'](_0xeb98);return _0x5b4009['set'](_0x786b('0x20'),_0x110870+'-'+_0x3190f9+'/'+_0x317c56)[_0x786b('0x1c')](_0x332962);}return null;};}function patchUpdates(_0x3d040c){return function(_0x5559bf){try{jsonpatch[_0x786b('0x21')](_0x5559bf,_0x3d040c,!![]);}catch(_0x5a1430){return BPromise[_0x786b('0x22')](_0x5a1430);}return _0x5559bf[_0x786b('0x23')]();};}function saveUpdates(_0x208aff,_0x18f265){return function(_0x303411){if(_0x303411){return _0x303411[_0x786b('0x24')](_0x208aff)[_0x786b('0x25')](function(_0x5320f1){return _0x5320f1;});}return null;};}function removeEntity(_0x266404,_0x2bf13c){return function(_0x33d668){if(_0x33d668){return _0x33d668[_0x786b('0x26')]()[_0x786b('0x25')](function(){_0x266404[_0x786b('0x1a')](0xcc)[_0x786b('0x1b')]();});}};}function handleEntityNotFound(_0x36dd0e,_0x2d5fd8){return function(_0x1d1003){if(!_0x1d1003){_0x36dd0e['sendStatus'](0x194);}return _0x1d1003;};}function handleError(_0x233b14,_0x557efb){_0x557efb=_0x557efb||0x1f4;return function(_0x3eb13c){logger[_0x786b('0x27')](_0x3eb13c[_0x786b('0x28')]);if(_0x3eb13c[_0x786b('0x29')]){delete _0x3eb13c[_0x786b('0x29')];}_0x233b14[_0x786b('0x1a')](_0x557efb)['send'](_0x3eb13c);};}exports[_0x786b('0x2a')]=function(_0x3b600f,_0x5c3d63){var _0x2321dd={},_0x48503e={},_0x100323={'count':0x0,'rows':[]};var _0x21d94c=_[_0x786b('0x2b')](db[_0x786b('0x2c')][_0x786b('0x2d')],function(_0x513cdb){return{'name':_0x513cdb[_0x786b('0x2e')],'type':_0x513cdb[_0x786b('0x2f')][_0x786b('0x30')]};});_0x48503e[_0x786b('0x31')]=_[_0x786b('0x2b')](_0x21d94c,_0x786b('0x29'));_0x48503e['query']=_[_0x786b('0x32')](_0x3b600f[_0x786b('0x33')]);_0x48503e['filters']=_[_0x786b('0x34')](_0x48503e['model'],_0x48503e[_0x786b('0x33')]);_0x2321dd[_0x786b('0x35')]=_[_0x786b('0x34')](_0x48503e[_0x786b('0x31')],qs['fields'](_0x3b600f['query'][_0x786b('0x36')]));_0x2321dd[_0x786b('0x35')]=_0x2321dd[_0x786b('0x35')][_0x786b('0x37')]?_0x2321dd['attributes']:_0x48503e[_0x786b('0x31')];if(!_0x3b600f['query'][_0x786b('0x38')](_0x786b('0x39'))){_0x2321dd[_0x786b('0x1f')]=qs[_0x786b('0x1f')](_0x3b600f[_0x786b('0x33')]['limit']);_0x2321dd[_0x786b('0x1d')]=qs[_0x786b('0x1d')](_0x3b600f[_0x786b('0x33')]['offset']);}_0x2321dd[_0x786b('0x3a')]=qs[_0x786b('0x3b')](_0x3b600f[_0x786b('0x33')][_0x786b('0x3b')]);_0x2321dd[_0x786b('0x3c')]=qs[_0x786b('0x3d')](_[_0x786b('0x3e')](_0x3b600f[_0x786b('0x33')],_0x48503e[_0x786b('0x3d')]),_0x21d94c);if(_0x3b600f['query'][_0x786b('0x3f')]){_0x2321dd['where']=_[_0x786b('0x40')](_0x2321dd[_0x786b('0x3c')],{'$or':_[_0x786b('0x2b')](_0x21d94c,function(_0x1920c0){if(_0x1920c0['type']!==_0x786b('0x41')){var _0x34621c={};_0x34621c[_0x1920c0[_0x786b('0x29')]]={'$like':'%'+_0x3b600f[_0x786b('0x33')]['filter']+'%'};return _0x34621c;}})});}_0x2321dd=_[_0x786b('0x40')]({},_0x2321dd,_0x3b600f[_0x786b('0x42')]);var _0x1a4764={'where':_0x2321dd[_0x786b('0x3c')]};return db[_0x786b('0x2c')][_0x786b('0x1e')](_0x1a4764)['then'](function(_0x3d37f4){_0x100323[_0x786b('0x1e')]=_0x3d37f4;if(_0x3b600f[_0x786b('0x33')]['includeAll']){_0x2321dd[_0x786b('0x43')]=[{'all':!![]}];}return db[_0x786b('0x2c')][_0x786b('0x44')](_0x2321dd);})[_0x786b('0x25')](function(_0x395244){_0x100323[_0x786b('0x45')]=_0x395244;return _0x100323;})[_0x786b('0x25')](respondWithFilteredResult(_0x5c3d63,_0x2321dd))[_0x786b('0x46')](handleError(_0x5c3d63,null));};exports[_0x786b('0x47')]=function(_0x298eb6,_0x329dd0){var _0x59a44b={'raw':!![],'where':{'id':_0x298eb6[_0x786b('0x48')]['id']}},_0x551b4b={};_0x551b4b[_0x786b('0x31')]=_[_0x786b('0x32')](db[_0x786b('0x2c')][_0x786b('0x2d')]);_0x551b4b[_0x786b('0x33')]=_[_0x786b('0x32')](_0x298eb6['query']);_0x551b4b[_0x786b('0x3d')]=_[_0x786b('0x34')](_0x551b4b[_0x786b('0x31')],_0x551b4b['query']);_0x59a44b[_0x786b('0x35')]=_['intersection'](_0x551b4b[_0x786b('0x31')],qs['fields'](_0x298eb6[_0x786b('0x33')]['fields']));_0x59a44b[_0x786b('0x35')]=_0x59a44b[_0x786b('0x35')][_0x786b('0x37')]?_0x59a44b[_0x786b('0x35')]:_0x551b4b[_0x786b('0x31')];if(_0x298eb6[_0x786b('0x33')][_0x786b('0x49')]){_0x59a44b[_0x786b('0x43')]=[{'all':!![]}];}_0x59a44b=_[_0x786b('0x40')]({},_0x59a44b,_0x298eb6[_0x786b('0x42')]);return db[_0x786b('0x2c')][_0x786b('0x4a')](_0x59a44b)['then'](handleEntityNotFound(_0x329dd0,null))[_0x786b('0x25')](respondWithResult(_0x329dd0,null))[_0x786b('0x46')](handleError(_0x329dd0,null));};exports[_0x786b('0x4b')]=function(_0x3e69ad,_0x1dfc9d){return db[_0x786b('0x2c')][_0x786b('0x4b')](_0x3e69ad[_0x786b('0x4c')],{})[_0x786b('0x25')](respondWithResult(_0x1dfc9d,0xc9))[_0x786b('0x46')](handleError(_0x1dfc9d,null));};exports['update']=function(_0x48ba46,_0x5a0194){if(_0x48ba46[_0x786b('0x4c')]['id']){delete _0x48ba46[_0x786b('0x4c')]['id'];}return db[_0x786b('0x2c')][_0x786b('0x4a')]({'where':{'id':_0x48ba46['params']['id']}})[_0x786b('0x25')](handleEntityNotFound(_0x5a0194,null))[_0x786b('0x25')](saveUpdates(_0x48ba46[_0x786b('0x4c')],null))[_0x786b('0x25')](respondWithResult(_0x5a0194,null))[_0x786b('0x46')](handleError(_0x5a0194,null));};exports['destroy']=function(_0x4bc3df,_0x48c196){return db[_0x786b('0x2c')][_0x786b('0x4a')]({'where':{'id':_0x4bc3df['params']['id']}})['then'](handleEntityNotFound(_0x48c196,null))[_0x786b('0x25')](removeEntity(_0x48c196,null))['catch'](handleError(_0x48c196,null));};exports[_0x786b('0x4d')]=function(_0x3f7407,_0x511f89){return db['MailSubstatus']['describe']()[_0x786b('0x25')](respondWithResult(_0x511f89,null))[_0x786b('0x46')](handleError(_0x511f89,null));}; \ No newline at end of file +var _0x378b=['count','offset','set','Content-Range','apply','reject','update','then','status','end','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','limit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x378b,0x117));var _0xb378=function(_0x165787,_0x2e893d){_0x165787=_0x165787-0x0;var _0x3058bc=_0x378b[_0x165787];return _0x3058bc;};'use strict';var emlformat=require(_0xb378('0x0'));var rimraf=require(_0xb378('0x1'));var zipdir=require(_0xb378('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb378('0x3'));var BPromise=require(_0xb378('0x4'));var Mustache=require(_0xb378('0x5'));var util=require(_0xb378('0x6'));var path=require(_0xb378('0x7'));var sox=require(_0xb378('0x8'));var csv=require(_0xb378('0x9'));var ejs=require(_0xb378('0xa'));var fs=require('fs');var fs_extra=require(_0xb378('0xb'));var _=require(_0xb378('0xc'));var squel=require(_0xb378('0xd'));var crypto=require(_0xb378('0xe'));var jsforce=require(_0xb378('0xf'));var deskjs=require(_0xb378('0x10'));var toCsv=require(_0xb378('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb378('0x11'));var authService=require(_0xb378('0x12'));var qs=require(_0xb378('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb378('0x14'));var logger=require('../../config/logger')(_0xb378('0x15'));var utils=require('../../config/utils');var config=require(_0xb378('0x16'));var licenseUtil=require(_0xb378('0x17'));var db=require(_0xb378('0x18'))['db'];function respondWithStatusCode(_0x4e4d01,_0xb01963){_0xb01963=_0xb01963||0xcc;return function(_0x481324){if(_0x481324){return _0x4e4d01[_0xb378('0x19')](_0xb01963);}return _0x4e4d01['status'](_0xb01963)['end']();};}function respondWithResult(_0x41a52e,_0x18dfb4){_0x18dfb4=_0x18dfb4||0xc8;return function(_0x1c5dde){if(_0x1c5dde){return _0x41a52e['status'](_0x18dfb4)[_0xb378('0x1a')](_0x1c5dde);}};}function respondWithFilteredResult(_0x2108b0,_0x51783c){return function(_0x796075){if(_0x796075){var _0x4e5a62=typeof _0x51783c['offset']===_0xb378('0x1b')&&typeof _0x51783c[_0xb378('0x1c')]===_0xb378('0x1b');var _0x15b479=_0x796075[_0xb378('0x1d')];var _0x3049f8=_0x4e5a62?0x0:_0x51783c[_0xb378('0x1e')];var _0x380b20=_0x4e5a62?_0x796075[_0xb378('0x1d')]:_0x51783c[_0xb378('0x1e')]+_0x51783c[_0xb378('0x1c')];var _0x44a266;if(_0x380b20>=_0x15b479){_0x380b20=_0x15b479;_0x44a266=0xc8;}else{_0x44a266=0xce;}_0x2108b0['status'](_0x44a266);return _0x2108b0[_0xb378('0x1f')](_0xb378('0x20'),_0x3049f8+'-'+_0x380b20+'/'+_0x15b479)[_0xb378('0x1a')](_0x796075);}return null;};}function patchUpdates(_0xeae546){return function(_0x599c99){try{jsonpatch[_0xb378('0x21')](_0x599c99,_0xeae546,!![]);}catch(_0x7fa992){return BPromise[_0xb378('0x22')](_0x7fa992);}return _0x599c99['save']();};}function saveUpdates(_0x59b5a5,_0x1196ab){return function(_0x4e7b00){if(_0x4e7b00){return _0x4e7b00[_0xb378('0x23')](_0x59b5a5)[_0xb378('0x24')](function(_0x305715){return _0x305715;});}return null;};}function removeEntity(_0x5a6cb4,_0x36eaec){return function(_0x3b27e7){if(_0x3b27e7){return _0x3b27e7['destroy']()['then'](function(){_0x5a6cb4[_0xb378('0x25')](0xcc)[_0xb378('0x26')]();});}};}function handleEntityNotFound(_0x518fb3,_0x11f468){return function(_0x60c55b){if(!_0x60c55b){_0x518fb3['sendStatus'](0x194);}return _0x60c55b;};}function handleError(_0x4814f5,_0x447c66){_0x447c66=_0x447c66||0x1f4;return function(_0x20ca9a){logger['error'](_0x20ca9a[_0xb378('0x27')]);if(_0x20ca9a[_0xb378('0x28')]){delete _0x20ca9a[_0xb378('0x28')];}_0x4814f5[_0xb378('0x25')](_0x447c66)[_0xb378('0x29')](_0x20ca9a);};}exports[_0xb378('0x2a')]=function(_0x28273c,_0x522a5c){var _0xaf8814={},_0x2e49f4={},_0x45f85c={'count':0x0,'rows':[]};var _0x58df69=_[_0xb378('0x2b')](db[_0xb378('0x2c')][_0xb378('0x2d')],function(_0x2cedae){return{'name':_0x2cedae[_0xb378('0x2e')],'type':_0x2cedae[_0xb378('0x2f')][_0xb378('0x30')]};});_0x2e49f4[_0xb378('0x31')]=_[_0xb378('0x2b')](_0x58df69,_0xb378('0x28'));_0x2e49f4[_0xb378('0x32')]=_[_0xb378('0x33')](_0x28273c[_0xb378('0x32')]);_0x2e49f4['filters']=_[_0xb378('0x34')](_0x2e49f4[_0xb378('0x31')],_0x2e49f4['query']);_0xaf8814[_0xb378('0x35')]=_[_0xb378('0x34')](_0x2e49f4[_0xb378('0x31')],qs[_0xb378('0x36')](_0x28273c[_0xb378('0x32')][_0xb378('0x36')]));_0xaf8814[_0xb378('0x35')]=_0xaf8814['attributes'][_0xb378('0x37')]?_0xaf8814[_0xb378('0x35')]:_0x2e49f4[_0xb378('0x31')];if(!_0x28273c[_0xb378('0x32')][_0xb378('0x38')]('nolimit')){_0xaf8814[_0xb378('0x1c')]=qs[_0xb378('0x1c')](_0x28273c[_0xb378('0x32')][_0xb378('0x1c')]);_0xaf8814['offset']=qs[_0xb378('0x1e')](_0x28273c[_0xb378('0x32')][_0xb378('0x1e')]);}_0xaf8814[_0xb378('0x39')]=qs[_0xb378('0x3a')](_0x28273c[_0xb378('0x32')][_0xb378('0x3a')]);_0xaf8814[_0xb378('0x3b')]=qs[_0xb378('0x3c')](_[_0xb378('0x3d')](_0x28273c[_0xb378('0x32')],_0x2e49f4[_0xb378('0x3c')]),_0x58df69);if(_0x28273c[_0xb378('0x32')][_0xb378('0x3e')]){_0xaf8814['where']=_[_0xb378('0x3f')](_0xaf8814['where'],{'$or':_['map'](_0x58df69,function(_0x1204f4){if(_0x1204f4[_0xb378('0x2f')]!==_0xb378('0x40')){var _0x3b64d4={};_0x3b64d4[_0x1204f4[_0xb378('0x28')]]={'$like':'%'+_0x28273c['query'][_0xb378('0x3e')]+'%'};return _0x3b64d4;}})});}_0xaf8814=_[_0xb378('0x3f')]({},_0xaf8814,_0x28273c[_0xb378('0x41')]);var _0x527872={'where':_0xaf8814[_0xb378('0x3b')]};return db[_0xb378('0x2c')][_0xb378('0x1d')](_0x527872)[_0xb378('0x24')](function(_0x52a9ca){_0x45f85c['count']=_0x52a9ca;if(_0x28273c[_0xb378('0x32')][_0xb378('0x42')]){_0xaf8814['include']=[{'all':!![]}];}return db['MailSubstatus'][_0xb378('0x43')](_0xaf8814);})[_0xb378('0x24')](function(_0x3c299e){_0x45f85c[_0xb378('0x44')]=_0x3c299e;return _0x45f85c;})[_0xb378('0x24')](respondWithFilteredResult(_0x522a5c,_0xaf8814))[_0xb378('0x45')](handleError(_0x522a5c,null));};exports[_0xb378('0x46')]=function(_0x4e42a5,_0x51ea42){var _0x3f9cce={'raw':!![],'where':{'id':_0x4e42a5[_0xb378('0x47')]['id']}},_0x4a27c2={};_0x4a27c2['model']=_[_0xb378('0x33')](db[_0xb378('0x2c')]['rawAttributes']);_0x4a27c2[_0xb378('0x32')]=_[_0xb378('0x33')](_0x4e42a5['query']);_0x4a27c2[_0xb378('0x3c')]=_[_0xb378('0x34')](_0x4a27c2[_0xb378('0x31')],_0x4a27c2[_0xb378('0x32')]);_0x3f9cce[_0xb378('0x35')]=_[_0xb378('0x34')](_0x4a27c2[_0xb378('0x31')],qs[_0xb378('0x36')](_0x4e42a5[_0xb378('0x32')][_0xb378('0x36')]));_0x3f9cce['attributes']=_0x3f9cce['attributes']['length']?_0x3f9cce[_0xb378('0x35')]:_0x4a27c2[_0xb378('0x31')];if(_0x4e42a5[_0xb378('0x32')][_0xb378('0x42')]){_0x3f9cce['include']=[{'all':!![]}];}_0x3f9cce=_['merge']({},_0x3f9cce,_0x4e42a5['options']);return db[_0xb378('0x2c')][_0xb378('0x48')](_0x3f9cce)[_0xb378('0x24')](handleEntityNotFound(_0x51ea42,null))[_0xb378('0x24')](respondWithResult(_0x51ea42,null))[_0xb378('0x45')](handleError(_0x51ea42,null));};exports[_0xb378('0x49')]=function(_0x2ac236,_0x297b5d){return db['MailSubstatus'][_0xb378('0x49')](_0x2ac236['body'],{})[_0xb378('0x24')](respondWithResult(_0x297b5d,0xc9))[_0xb378('0x45')](handleError(_0x297b5d,null));};exports['update']=function(_0x32634a,_0xda602e){if(_0x32634a[_0xb378('0x4a')]['id']){delete _0x32634a['body']['id'];}return db[_0xb378('0x2c')][_0xb378('0x48')]({'where':{'id':_0x32634a[_0xb378('0x47')]['id']}})[_0xb378('0x24')](handleEntityNotFound(_0xda602e,null))[_0xb378('0x24')](saveUpdates(_0x32634a[_0xb378('0x4a')],null))[_0xb378('0x24')](respondWithResult(_0xda602e,null))[_0xb378('0x45')](handleError(_0xda602e,null));};exports[_0xb378('0x4b')]=function(_0x2fd5e3,_0x475c09){return db[_0xb378('0x2c')][_0xb378('0x48')]({'where':{'id':_0x2fd5e3[_0xb378('0x47')]['id']}})[_0xb378('0x24')](handleEntityNotFound(_0x475c09,null))[_0xb378('0x24')](removeEntity(_0x475c09,null))[_0xb378('0x45')](handleError(_0x475c09,null));};exports[_0xb378('0x4c')]=function(_0x378399,_0x2960e8){return db[_0xb378('0x2c')][_0xb378('0x4c')]()['then'](respondWithResult(_0x2960e8,null))[_0xb378('0x45')](handleError(_0x2960e8,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 900e0e7..5e1f49c 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 _0x3423=['emit','hook','../../mysqldb','setMaxListeners'];(function(_0x1d1f8f,_0x503031){var _0x2243a2=function(_0x4063be){while(--_0x4063be){_0x1d1f8f['push'](_0x1d1f8f['shift']());}};_0x2243a2(++_0x503031);}(_0x3423,0x182));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x3342('0x0'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x3342('0x1')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x4d90fc){return function(_0x39e455,_0x346be7,_0x23f437){MailSubstatusEvents[_0x3342('0x2')](_0x4d90fc+':'+_0x39e455['id'],_0x39e455);MailSubstatusEvents[_0x3342('0x2')](_0x4d90fc,_0x39e455);_0x23f437(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x3342('0x3')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x9710=['events','update','emit','hasOwnProperty','hook','exports'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x9710,0x14a));var _0x0971=function(_0x2b67ca,_0x4ea0d8){_0x2b67ca=_0x2b67ca-0x0;var _0x1b1cf5=_0x9710[_0x2b67ca];return _0x1b1cf5;};'use strict';var EventEmitter=require(_0x0971('0x0'));var MailSubstatus=require('../../mysqldb')['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x0971('0x1')};function emitEvent(_0x5bd88f){return function(_0x340204,_0x27b3d3,_0x4241ff){MailSubstatusEvents[_0x0971('0x2')](_0x5bd88f+':'+_0x340204['id'],_0x340204);MailSubstatusEvents[_0x0971('0x2')](_0x5bd88f,_0x340204);_0x4241ff(null);};}for(var e in events){if(events[_0x0971('0x3')](e)){var event=events[e];MailSubstatus[_0x0971('0x4')](e,emitEvent(event));}}module[_0x0971('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 05604e7..34d5a9f 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 _0xc8af=['name','catch','./mailSubstatus.attributes','define','MailSubstatus','mail_substatuses','update','_previousDataValues'];(function(_0x4521ad,_0x364897){var _0x2c15e6=function(_0x28167f){while(--_0x28167f){_0x4521ad['push'](_0x4521ad['shift']());}};_0x2c15e6(++_0x364897);}(_0xc8af,0x1a2));var _0xfc8a=function(_0x43ec52,_0x632701){_0x43ec52=_0x43ec52-0x0;var _0x4c91af=_0xc8af[_0x43ec52];return _0x4c91af;};'use strict';var attributes=require(_0xfc8a('0x0'));module['exports']=function(_0x12edcf){var _0x426730=_0x12edcf['models'];return _0x12edcf[_0xfc8a('0x1')](_0xfc8a('0x2'),attributes,{'tableName':_0xfc8a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x442660,_0x3f5f76,_0x451ee6){return _0x426730['Condition'][_0xfc8a('0x4')]({'value':_0x442660['name']},{'where':{'field':'mailSubstatus','value':_0x442660[_0xfc8a('0x5')][_0xfc8a('0x6')]}})['then'](function(){_0x451ee6();})[_0xfc8a('0x7')](function(_0x285d24){_0x451ee6(_0x285d24);});}}});}; \ No newline at end of file +var _0x822f=['update','name','_previousDataValues','catch','./mailSubstatus.attributes','models','define','MailSubstatus','mail_substatuses'];(function(_0x2472c3,_0x4534af){var _0xe00fb1=function(_0x14ad95){while(--_0x14ad95){_0x2472c3['push'](_0x2472c3['shift']());}};_0xe00fb1(++_0x4534af);}(_0x822f,0x79));var _0xf822=function(_0xf79f8,_0x693d9c){_0xf79f8=_0xf79f8-0x0;var _0x2e6a15=_0x822f[_0xf79f8];return _0x2e6a15;};'use strict';var attributes=require(_0xf822('0x0'));module['exports']=function(_0x3afd95){var _0x492565=_0x3afd95[_0xf822('0x1')];return _0x3afd95[_0xf822('0x2')](_0xf822('0x3'),attributes,{'tableName':_0xf822('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x9ecde3,_0x293940,_0x373486){return _0x492565['Condition'][_0xf822('0x5')]({'value':_0x9ecde3[_0xf822('0x6')]},{'where':{'field':'mailSubstatus','value':_0x9ecde3[_0xf822('0x7')][_0xf822('0x6')]}})['then'](function(){_0x373486();})[_0xf822('0x8')](function(_0xf39f70){_0x373486(_0xf39f70);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 9abd1bb..0b156fe 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 _0x662f=['lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x493d19,_0x352120){var _0x25ea60=function(_0x2238c5){while(--_0x2238c5){_0x493d19['push'](_0x493d19['shift']());}};_0x25ea60(++_0x352120);}(_0x662f,0x11d));var _0xf662=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x662f[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xf662('0x0'));var util=require(_0xf662('0x1'));var moment=require(_0xf662('0x2'));var BPromise=require('bluebird');var rs=require(_0xf662('0x3'));var fs=require('fs');var Redis=require(_0xf662('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf662('0x5'));var logger=require('../../config/logger')(_0xf662('0x6'));var config=require(_0xf662('0x7'));var jayson=require(_0xf662('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x54553e,_0x2bca34,_0x55add8){return new BPromise(function(_0x4907fd,_0x35b1e1){return client['request'](_0x54553e,_0x55add8)[_0xf662('0x9')](function(_0x37b3c4){logger[_0xf662('0xa')](_0xf662('0xb'),_0x2bca34,_0xf662('0xc'));logger[_0xf662('0xd')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x2bca34,_0xf662('0xc'),JSON[_0xf662('0xe')](_0x37b3c4));if(_0x37b3c4[_0xf662('0xf')]){if(_0x37b3c4[_0xf662('0xf')][_0xf662('0x10')]===0x1f4){logger['error'](_0xf662('0xb'),_0x2bca34,_0x37b3c4['error']['message']);return _0x35b1e1(_0x37b3c4[_0xf662('0xf')][_0xf662('0x11')]);}logger['error'](_0xf662('0xb'),_0x2bca34,_0x37b3c4[_0xf662('0xf')][_0xf662('0x11')]);return _0x4907fd(_0x37b3c4[_0xf662('0xf')]['message']);}else{logger[_0xf662('0xa')](_0xf662('0xb'),_0x2bca34,_0xf662('0xc'));_0x4907fd(_0x37b3c4['result'][_0xf662('0x11')]);}})[_0xf662('0x12')](function(_0x483d19){logger[_0xf662('0xf')](_0xf662('0xb'),_0x2bca34,_0x483d19);_0x35b1e1(_0x483d19);});});} \ No newline at end of file +var _0xe484=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4bc677,_0xf5eaa9){var _0x38654e=function(_0x2126d0){while(--_0x2126d0){_0x4bc677['push'](_0x4bc677['shift']());}};_0x38654e(++_0xf5eaa9);}(_0xe484,0x118));var _0x4e48=function(_0x3f9f02,_0x456b67){_0x3f9f02=_0x3f9f02-0x0;var _0x57d3d8=_0xe484[_0x3f9f02];return _0x57d3d8;};'use strict';var _=require(_0x4e48('0x0'));var util=require(_0x4e48('0x1'));var moment=require(_0x4e48('0x2'));var BPromise=require(_0x4e48('0x3'));var rs=require(_0x4e48('0x4'));var fs=require('fs');var Redis=require(_0x4e48('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e48('0x6'));var logger=require(_0x4e48('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4e48('0x8'));var client=jayson[_0x4e48('0x9')][_0x4e48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc3b44c,_0x1e6448,_0x44881c){return new BPromise(function(_0x587e0e,_0x52b02d){return client[_0x4e48('0xb')](_0xc3b44c,_0x44881c)[_0x4e48('0xc')](function(_0x2baac2){logger['info'](_0x4e48('0xd'),_0x1e6448,_0x4e48('0xe'));logger['debug'](_0x4e48('0xf'),_0x1e6448,_0x4e48('0xe'),JSON[_0x4e48('0x10')](_0x2baac2));if(_0x2baac2[_0x4e48('0x11')]){if(_0x2baac2[_0x4e48('0x11')][_0x4e48('0x12')]===0x1f4){logger[_0x4e48('0x11')](_0x4e48('0xd'),_0x1e6448,_0x2baac2[_0x4e48('0x11')][_0x4e48('0x13')]);return _0x52b02d(_0x2baac2[_0x4e48('0x11')]['message']);}logger[_0x4e48('0x11')](_0x4e48('0xd'),_0x1e6448,_0x2baac2[_0x4e48('0x11')][_0x4e48('0x13')]);return _0x587e0e(_0x2baac2[_0x4e48('0x11')][_0x4e48('0x13')]);}else{logger[_0x4e48('0x14')](_0x4e48('0xd'),_0x1e6448,_0x4e48('0xe'));_0x587e0e(_0x2baac2['result'][_0x4e48('0x13')]);}})[_0x4e48('0x15')](function(_0x1ac90d){logger[_0x4e48('0x11')](_0x4e48('0xd'),_0x1e6448,_0x1ac90d);_0x52b02d(_0x1ac90d);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index d4e5f67..e6cfe3b 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 _0xfd95=['/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','/describe','describe'];(function(_0x54058f,_0x401420){var _0x132723=function(_0x81499f){while(--_0x81499f){_0x54058f['push'](_0x54058f['shift']());}};_0x132723(++_0x401420);}(_0xfd95,0xa3));var _0x5fd9=function(_0x1cf427,_0x257b88){_0x1cf427=_0x1cf427-0x0;var _0x5b6a71=_0xfd95[_0x1cf427];return _0x5b6a71;};'use strict';var multer=require(_0x5fd9('0x0'));var util=require('util');var path=require(_0x5fd9('0x1'));var timeout=require(_0x5fd9('0x2'));var express=require(_0x5fd9('0x3'));var router=express[_0x5fd9('0x4')]();var fs_extra=require(_0x5fd9('0x5'));var auth=require(_0x5fd9('0x6'));var interaction=require(_0x5fd9('0x7'));var config=require(_0x5fd9('0x8'));var controller=require(_0x5fd9('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5fd9('0xa')](_0x5fd9('0xb'),auth['isAuthenticated'](),controller[_0x5fd9('0xc')]);router[_0x5fd9('0xa')](_0x5fd9('0xd'),auth[_0x5fd9('0xe')](),controller['show']);router[_0x5fd9('0xf')]('/',auth[_0x5fd9('0xe')](),controller[_0x5fd9('0x10')]);router[_0x5fd9('0x11')](_0x5fd9('0xd'),auth['isAuthenticated'](),controller[_0x5fd9('0x12')]);router[_0x5fd9('0x13')](_0x5fd9('0xd'),auth[_0x5fd9('0xe')](),controller[_0x5fd9('0x14')]);module[_0x5fd9('0x15')]=router; \ No newline at end of file +var _0xde88=['/describe','describe','show','create','put','/:id','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index'];(function(_0x2e5558,_0x500bb3){var _0x2afa4e=function(_0x1baa13){while(--_0x1baa13){_0x2e5558['push'](_0x2e5558['shift']());}};_0x2afa4e(++_0x500bb3);}(_0xde88,0xda));var _0x8de8=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0xde88[_0x5ac0f0];return _0x4aceec;};'use strict';var multer=require(_0x8de8('0x0'));var util=require(_0x8de8('0x1'));var path=require(_0x8de8('0x2'));var timeout=require('connect-timeout');var express=require(_0x8de8('0x3'));var router=express[_0x8de8('0x4')]();var fs_extra=require(_0x8de8('0x5'));var auth=require(_0x8de8('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0x8de8('0x7')]('/',auth[_0x8de8('0x8')](),controller[_0x8de8('0x9')]);router[_0x8de8('0x7')](_0x8de8('0xa'),auth[_0x8de8('0x8')](),controller[_0x8de8('0xb')]);router[_0x8de8('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x8de8('0xc')]);router['post']('/',auth[_0x8de8('0x8')](),controller[_0x8de8('0xd')]);router[_0x8de8('0xe')](_0x8de8('0xf'),auth[_0x8de8('0x8')](),controller[_0x8de8('0x10')]);router[_0x8de8('0x11')]('/:id',auth[_0x8de8('0x8')](),controller['destroy']);module[_0x8de8('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 887e184..7e4e69d 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x5db8ac,_0x24022e){var _0x5f538e=function(_0x2140ee){while(--_0x2140ee){_0x5db8ac['push'](_0x5db8ac['shift']());}};_0x5f538e(++_0x24022e);}(_0x4b84,0x1cc));var _0x44b8=function(_0x11f0e3,_0x5170bc){_0x11f0e3=_0x11f0e3-0x0;var _0x2892e8=_0x4b84[_0x11f0e3];return _0x2892e8;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x14537f,_0x3cfbe2){var _0x13196d=function(_0x55824f){while(--_0x55824f){_0x14537f['push'](_0x14537f['shift']());}};_0x13196d(++_0x3cfbe2);}(_0x008c,0x188));var _0xc008=function(_0x5e8282,_0x1f2962){_0x5e8282=_0x5e8282-0x0;var _0x5cd37d=_0x008c[_0x5e8282];return _0x5cd37d;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 8f62806..1ec4909 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 _0x989e=['eml-format','rimraf','zip-dir','request-promise','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','index','map','MailTransferReport','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','options','include','findAll','show','keys','rawAttributes','intersection','merge','find','body','catch','params','describe'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0x989e,0x88));var _0xe989=function(_0x954b3a,_0x10a7c1){_0x954b3a=_0x954b3a-0x0;var _0x3a313e=_0x989e[_0x954b3a];return _0x3a313e;};'use strict';var emlformat=require(_0xe989('0x0'));var rimraf=require(_0xe989('0x1'));var zipdir=require(_0xe989('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe989('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe989('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe989('0x5'));var csv=require(_0xe989('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe989('0x7'));var _=require('lodash');var squel=require(_0xe989('0x8'));var crypto=require(_0xe989('0x9'));var jsforce=require(_0xe989('0xa'));var deskjs=require(_0xe989('0xb'));var toCsv=require(_0xe989('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe989('0xc'));var authService=require(_0xe989('0xd'));var qs=require(_0xe989('0xe'));var as=require(_0xe989('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe989('0x10'))(_0xe989('0x11'));var utils=require(_0xe989('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49e5bb,_0x41b8cd){_0x41b8cd=_0x41b8cd||0xcc;return function(_0x406539){if(_0x406539){return _0x49e5bb['sendStatus'](_0x41b8cd);}return _0x49e5bb['status'](_0x41b8cd)['end']();};}function respondWithResult(_0x3aeab2,_0x4f7995){_0x4f7995=_0x4f7995||0xc8;return function(_0x2f3b68){if(_0x2f3b68){return _0x3aeab2[_0xe989('0x13')](_0x4f7995)['json'](_0x2f3b68);}};}function respondWithFilteredResult(_0x11958f,_0x36bb1b){return function(_0x34d891){if(_0x34d891){var _0x136a2d=typeof _0x36bb1b[_0xe989('0x14')]===_0xe989('0x15')&&typeof _0x36bb1b[_0xe989('0x16')]===_0xe989('0x15');var _0x5eca5c=_0x34d891[_0xe989('0x17')];var _0x348d7c=_0x136a2d?0x0:_0x36bb1b[_0xe989('0x14')];var _0xb73bb2=_0x136a2d?_0x34d891[_0xe989('0x17')]:_0x36bb1b['offset']+_0x36bb1b[_0xe989('0x16')];var _0x3961f5;if(_0xb73bb2>=_0x5eca5c){_0xb73bb2=_0x5eca5c;_0x3961f5=0xc8;}else{_0x3961f5=0xce;}_0x11958f[_0xe989('0x13')](_0x3961f5);return _0x11958f[_0xe989('0x18')](_0xe989('0x19'),_0x348d7c+'-'+_0xb73bb2+'/'+_0x5eca5c)[_0xe989('0x1a')](_0x34d891);}return null;};}function patchUpdates(_0x4a55af){return function(_0xda36ef){try{jsonpatch[_0xe989('0x1b')](_0xda36ef,_0x4a55af,!![]);}catch(_0x4dfae5){return BPromise['reject'](_0x4dfae5);}return _0xda36ef[_0xe989('0x1c')]();};}function saveUpdates(_0x41da9a,_0x313cd7){return function(_0x3d35c8){if(_0x3d35c8){return _0x3d35c8[_0xe989('0x1d')](_0x41da9a)[_0xe989('0x1e')](function(_0x34f397){return _0x34f397;});}return null;};}function removeEntity(_0x5eb0bb,_0x4c75e6){return function(_0x5aed0f){if(_0x5aed0f){return _0x5aed0f[_0xe989('0x1f')]()['then'](function(){_0x5eb0bb['status'](0xcc)[_0xe989('0x20')]();});}};}function handleEntityNotFound(_0x475551,_0x2102f0){return function(_0x1bd0e3){if(!_0x1bd0e3){_0x475551['sendStatus'](0x194);}return _0x1bd0e3;};}function handleError(_0x54d46e,_0x7f4f94){_0x7f4f94=_0x7f4f94||0x1f4;return function(_0x190527){logger[_0xe989('0x21')](_0x190527[_0xe989('0x22')]);if(_0x190527[_0xe989('0x23')]){delete _0x190527[_0xe989('0x23')];}_0x54d46e['status'](_0x7f4f94)['send'](_0x190527);};}exports[_0xe989('0x24')]=function(_0x170ff0,_0x4445c1){var _0x3e7ec9={},_0x56311b={},_0x2ea3d6={'count':0x0,'rows':[]};var _0x47627f=_[_0xe989('0x25')](db[_0xe989('0x26')]['rawAttributes'],function(_0x4da93f){return{'name':_0x4da93f[_0xe989('0x27')],'type':_0x4da93f['type'][_0xe989('0x28')]};});_0x56311b[_0xe989('0x29')]=_[_0xe989('0x25')](_0x47627f,_0xe989('0x23'));_0x56311b[_0xe989('0x2a')]=_['keys'](_0x170ff0[_0xe989('0x2a')]);_0x56311b[_0xe989('0x2b')]=_['intersection'](_0x56311b[_0xe989('0x29')],_0x56311b[_0xe989('0x2a')]);_0x3e7ec9[_0xe989('0x2c')]=_['intersection'](_0x56311b[_0xe989('0x29')],qs['fields'](_0x170ff0[_0xe989('0x2a')][_0xe989('0x2d')]));_0x3e7ec9['attributes']=_0x3e7ec9[_0xe989('0x2c')][_0xe989('0x2e')]?_0x3e7ec9[_0xe989('0x2c')]:_0x56311b[_0xe989('0x29')];if(!_0x170ff0[_0xe989('0x2a')][_0xe989('0x2f')]('nolimit')){_0x3e7ec9[_0xe989('0x16')]=qs[_0xe989('0x16')](_0x170ff0['query'][_0xe989('0x16')]);_0x3e7ec9[_0xe989('0x14')]=qs[_0xe989('0x14')](_0x170ff0[_0xe989('0x2a')][_0xe989('0x14')]);}_0x3e7ec9[_0xe989('0x30')]=qs[_0xe989('0x31')](_0x170ff0[_0xe989('0x2a')]['sort']);_0x3e7ec9[_0xe989('0x32')]=qs['filters'](_[_0xe989('0x33')](_0x170ff0[_0xe989('0x2a')],_0x56311b[_0xe989('0x2b')]),_0x47627f);if(_0x170ff0['query'][_0xe989('0x34')]){_0x3e7ec9['where']=_['merge'](_0x3e7ec9[_0xe989('0x32')],{'$or':_[_0xe989('0x25')](_0x47627f,function(_0x5e7cfc){if(_0x5e7cfc[_0xe989('0x35')]!==_0xe989('0x36')){var _0xdd1690={};_0xdd1690[_0x5e7cfc['name']]={'$like':'%'+_0x170ff0[_0xe989('0x2a')][_0xe989('0x34')]+'%'};return _0xdd1690;}})});}_0x3e7ec9=_['merge']({},_0x3e7ec9,_0x170ff0[_0xe989('0x37')]);var _0x4223ea={'where':_0x3e7ec9['where']};return db['MailTransferReport'][_0xe989('0x17')](_0x4223ea)['then'](function(_0x58055c){_0x2ea3d6['count']=_0x58055c;if(_0x170ff0[_0xe989('0x2a')]['includeAll']){_0x3e7ec9[_0xe989('0x38')]=[{'all':!![]}];}return db[_0xe989('0x26')][_0xe989('0x39')](_0x3e7ec9);})[_0xe989('0x1e')](function(_0x33c9f3){_0x2ea3d6['rows']=_0x33c9f3;return _0x2ea3d6;})[_0xe989('0x1e')](respondWithFilteredResult(_0x4445c1,_0x3e7ec9))['catch'](handleError(_0x4445c1,null));};exports[_0xe989('0x3a')]=function(_0x249216,_0x4c8be1){var _0x3ecdc6={'raw':!![],'where':{'id':_0x249216['params']['id']}},_0x1dd7ae={};_0x1dd7ae[_0xe989('0x29')]=_[_0xe989('0x3b')](db[_0xe989('0x26')][_0xe989('0x3c')]);_0x1dd7ae[_0xe989('0x2a')]=_['keys'](_0x249216[_0xe989('0x2a')]);_0x1dd7ae['filters']=_['intersection'](_0x1dd7ae[_0xe989('0x29')],_0x1dd7ae[_0xe989('0x2a')]);_0x3ecdc6[_0xe989('0x2c')]=_[_0xe989('0x3d')](_0x1dd7ae[_0xe989('0x29')],qs[_0xe989('0x2d')](_0x249216['query']['fields']));_0x3ecdc6[_0xe989('0x2c')]=_0x3ecdc6[_0xe989('0x2c')][_0xe989('0x2e')]?_0x3ecdc6[_0xe989('0x2c')]:_0x1dd7ae[_0xe989('0x29')];if(_0x249216['query']['includeAll']){_0x3ecdc6[_0xe989('0x38')]=[{'all':!![]}];}_0x3ecdc6=_[_0xe989('0x3e')]({},_0x3ecdc6,_0x249216[_0xe989('0x37')]);return db['MailTransferReport'][_0xe989('0x3f')](_0x3ecdc6)[_0xe989('0x1e')](handleEntityNotFound(_0x4c8be1,null))[_0xe989('0x1e')](respondWithResult(_0x4c8be1,null))['catch'](handleError(_0x4c8be1,null));};exports['create']=function(_0x188abb,_0x57a9b4){return db[_0xe989('0x26')]['create'](_0x188abb[_0xe989('0x40')],{})[_0xe989('0x1e')](respondWithResult(_0x57a9b4,0xc9))[_0xe989('0x41')](handleError(_0x57a9b4,null));};exports[_0xe989('0x1d')]=function(_0x3f661d,_0xf7024b){if(_0x3f661d[_0xe989('0x40')]['id']){delete _0x3f661d[_0xe989('0x40')]['id'];}return db[_0xe989('0x26')][_0xe989('0x3f')]({'where':{'id':_0x3f661d[_0xe989('0x42')]['id']}})[_0xe989('0x1e')](handleEntityNotFound(_0xf7024b,null))[_0xe989('0x1e')](saveUpdates(_0x3f661d['body'],null))[_0xe989('0x1e')](respondWithResult(_0xf7024b,null))[_0xe989('0x41')](handleError(_0xf7024b,null));};exports[_0xe989('0x1f')]=function(_0x39563b,_0x45a2e7){return db[_0xe989('0x26')][_0xe989('0x3f')]({'where':{'id':_0x39563b[_0xe989('0x42')]['id']}})[_0xe989('0x1e')](handleEntityNotFound(_0x45a2e7,null))[_0xe989('0x1e')](removeEntity(_0x45a2e7,null))[_0xe989('0x41')](handleError(_0x45a2e7,null));};exports[_0xe989('0x43')]=function(_0x5e1dc8,_0x1b75bc){return db['MailTransferReport'][_0xe989('0x43')]()[_0xe989('0x1e')](respondWithResult(_0x1b75bc,null))[_0xe989('0x41')](handleError(_0x1b75bc,null));}; \ No newline at end of file +var _0x141f=['crypto','desk.js','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','map','MailTransferReport','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','catch','show','rawAttributes','includeAll','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel'];(function(_0x5b560b,_0x56f6bc){var _0x21a148=function(_0x6857a3){while(--_0x6857a3){_0x5b560b['push'](_0x5b560b['shift']());}};_0x21a148(++_0x56f6bc);}(_0x141f,0x193));var _0xf141=function(_0x11f083,_0x38a7dd){_0x11f083=_0x11f083-0x0;var _0x1a41f3=_0x141f[_0x11f083];return _0x1a41f3;};'use strict';var emlformat=require(_0xf141('0x0'));var rimraf=require(_0xf141('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf141('0x2'));var rp=require(_0xf141('0x3'));var moment=require('moment');var BPromise=require(_0xf141('0x4'));var Mustache=require(_0xf141('0x5'));var util=require('util');var path=require(_0xf141('0x6'));var sox=require(_0xf141('0x7'));var csv=require(_0xf141('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf141('0x9'));var squel=require(_0xf141('0xa'));var crypto=require(_0xf141('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf141('0xc'));var toCsv=require(_0xf141('0x8'));var querystring=require(_0xf141('0xd'));var Papa=require('papaparse');var Redis=require(_0xf141('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf141('0xf'))(_0xf141('0x10'));var utils=require(_0xf141('0x11'));var config=require(_0xf141('0x12'));var licenseUtil=require(_0xf141('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45cf94,_0x5f0fa0){_0x5f0fa0=_0x5f0fa0||0xcc;return function(_0x2890b1){if(_0x2890b1){return _0x45cf94[_0xf141('0x14')](_0x5f0fa0);}return _0x45cf94[_0xf141('0x15')](_0x5f0fa0)[_0xf141('0x16')]();};}function respondWithResult(_0x1cb0b0,_0x82da40){_0x82da40=_0x82da40||0xc8;return function(_0x4f3cae){if(_0x4f3cae){return _0x1cb0b0['status'](_0x82da40)[_0xf141('0x17')](_0x4f3cae);}};}function respondWithFilteredResult(_0x27af81,_0x3eb504){return function(_0x59af36){if(_0x59af36){var _0x8b6c36=typeof _0x3eb504['offset']==='undefined'&&typeof _0x3eb504[_0xf141('0x18')]==='undefined';var _0xd3b6e8=_0x59af36[_0xf141('0x19')];var _0xf961fc=_0x8b6c36?0x0:_0x3eb504[_0xf141('0x1a')];var _0x44cfee=_0x8b6c36?_0x59af36[_0xf141('0x19')]:_0x3eb504[_0xf141('0x1a')]+_0x3eb504[_0xf141('0x18')];var _0x3cb087;if(_0x44cfee>=_0xd3b6e8){_0x44cfee=_0xd3b6e8;_0x3cb087=0xc8;}else{_0x3cb087=0xce;}_0x27af81['status'](_0x3cb087);return _0x27af81[_0xf141('0x1b')](_0xf141('0x1c'),_0xf961fc+'-'+_0x44cfee+'/'+_0xd3b6e8)[_0xf141('0x17')](_0x59af36);}return null;};}function patchUpdates(_0x5a1b82){return function(_0x4e1f64){try{jsonpatch[_0xf141('0x1d')](_0x4e1f64,_0x5a1b82,!![]);}catch(_0x209830){return BPromise[_0xf141('0x1e')](_0x209830);}return _0x4e1f64['save']();};}function saveUpdates(_0x1ae1f0,_0x3820af){return function(_0x2b73e4){if(_0x2b73e4){return _0x2b73e4[_0xf141('0x1f')](_0x1ae1f0)[_0xf141('0x20')](function(_0x492fbf){return _0x492fbf;});}return null;};}function removeEntity(_0x497234,_0x46b758){return function(_0x2c37da){if(_0x2c37da){return _0x2c37da[_0xf141('0x21')]()[_0xf141('0x20')](function(){_0x497234[_0xf141('0x15')](0xcc)[_0xf141('0x16')]();});}};}function handleEntityNotFound(_0x259751,_0x2b0d2b){return function(_0x3d5df1){if(!_0x3d5df1){_0x259751[_0xf141('0x14')](0x194);}return _0x3d5df1;};}function handleError(_0x811f89,_0x2809df){_0x2809df=_0x2809df||0x1f4;return function(_0x1bcb5f){logger[_0xf141('0x22')](_0x1bcb5f['stack']);if(_0x1bcb5f[_0xf141('0x23')]){delete _0x1bcb5f[_0xf141('0x23')];}_0x811f89[_0xf141('0x15')](_0x2809df)[_0xf141('0x24')](_0x1bcb5f);};}exports['index']=function(_0x46afe6,_0x1f68de){var _0x13ddb8={},_0x44f14c={},_0x38d659={'count':0x0,'rows':[]};var _0x20057d=_[_0xf141('0x25')](db[_0xf141('0x26')]['rawAttributes'],function(_0x21eb55){return{'name':_0x21eb55[_0xf141('0x27')],'type':_0x21eb55[_0xf141('0x28')]['key']};});_0x44f14c[_0xf141('0x29')]=_[_0xf141('0x25')](_0x20057d,_0xf141('0x23'));_0x44f14c[_0xf141('0x2a')]=_[_0xf141('0x2b')](_0x46afe6[_0xf141('0x2a')]);_0x44f14c[_0xf141('0x2c')]=_[_0xf141('0x2d')](_0x44f14c[_0xf141('0x29')],_0x44f14c[_0xf141('0x2a')]);_0x13ddb8['attributes']=_[_0xf141('0x2d')](_0x44f14c['model'],qs[_0xf141('0x2e')](_0x46afe6[_0xf141('0x2a')][_0xf141('0x2e')]));_0x13ddb8[_0xf141('0x2f')]=_0x13ddb8[_0xf141('0x2f')][_0xf141('0x30')]?_0x13ddb8[_0xf141('0x2f')]:_0x44f14c[_0xf141('0x29')];if(!_0x46afe6[_0xf141('0x2a')][_0xf141('0x31')](_0xf141('0x32'))){_0x13ddb8['limit']=qs[_0xf141('0x18')](_0x46afe6['query']['limit']);_0x13ddb8[_0xf141('0x1a')]=qs[_0xf141('0x1a')](_0x46afe6[_0xf141('0x2a')][_0xf141('0x1a')]);}_0x13ddb8[_0xf141('0x33')]=qs[_0xf141('0x34')](_0x46afe6[_0xf141('0x2a')][_0xf141('0x34')]);_0x13ddb8[_0xf141('0x35')]=qs[_0xf141('0x2c')](_[_0xf141('0x36')](_0x46afe6[_0xf141('0x2a')],_0x44f14c[_0xf141('0x2c')]),_0x20057d);if(_0x46afe6['query'][_0xf141('0x37')]){_0x13ddb8['where']=_['merge'](_0x13ddb8[_0xf141('0x35')],{'$or':_[_0xf141('0x25')](_0x20057d,function(_0x4c2bc5){if(_0x4c2bc5['type']!==_0xf141('0x38')){var _0x15e53c={};_0x15e53c[_0x4c2bc5['name']]={'$like':'%'+_0x46afe6['query']['filter']+'%'};return _0x15e53c;}})});}_0x13ddb8=_[_0xf141('0x39')]({},_0x13ddb8,_0x46afe6['options']);var _0x5e56bb={'where':_0x13ddb8[_0xf141('0x35')]};return db[_0xf141('0x26')][_0xf141('0x19')](_0x5e56bb)['then'](function(_0xb73079){_0x38d659['count']=_0xb73079;if(_0x46afe6[_0xf141('0x2a')]['includeAll']){_0x13ddb8[_0xf141('0x3a')]=[{'all':!![]}];}return db[_0xf141('0x26')]['findAll'](_0x13ddb8);})['then'](function(_0x276226){_0x38d659['rows']=_0x276226;return _0x38d659;})['then'](respondWithFilteredResult(_0x1f68de,_0x13ddb8))[_0xf141('0x3b')](handleError(_0x1f68de,null));};exports[_0xf141('0x3c')]=function(_0x477366,_0x447f5e){var _0x4e5867={'raw':!![],'where':{'id':_0x477366['params']['id']}},_0x127432={};_0x127432[_0xf141('0x29')]=_['keys'](db['MailTransferReport'][_0xf141('0x3d')]);_0x127432[_0xf141('0x2a')]=_[_0xf141('0x2b')](_0x477366[_0xf141('0x2a')]);_0x127432['filters']=_[_0xf141('0x2d')](_0x127432[_0xf141('0x29')],_0x127432['query']);_0x4e5867[_0xf141('0x2f')]=_[_0xf141('0x2d')](_0x127432['model'],qs['fields'](_0x477366['query']['fields']));_0x4e5867[_0xf141('0x2f')]=_0x4e5867['attributes']['length']?_0x4e5867[_0xf141('0x2f')]:_0x127432[_0xf141('0x29')];if(_0x477366[_0xf141('0x2a')][_0xf141('0x3e')]){_0x4e5867[_0xf141('0x3a')]=[{'all':!![]}];}_0x4e5867=_[_0xf141('0x39')]({},_0x4e5867,_0x477366[_0xf141('0x3f')]);return db[_0xf141('0x26')][_0xf141('0x40')](_0x4e5867)['then'](handleEntityNotFound(_0x447f5e,null))[_0xf141('0x20')](respondWithResult(_0x447f5e,null))['catch'](handleError(_0x447f5e,null));};exports['create']=function(_0x558851,_0x5d5892){return db[_0xf141('0x26')][_0xf141('0x41')](_0x558851[_0xf141('0x42')],{})[_0xf141('0x20')](respondWithResult(_0x5d5892,0xc9))[_0xf141('0x3b')](handleError(_0x5d5892,null));};exports[_0xf141('0x1f')]=function(_0x5f5143,_0x4acf08){if(_0x5f5143[_0xf141('0x42')]['id']){delete _0x5f5143[_0xf141('0x42')]['id'];}return db['MailTransferReport'][_0xf141('0x40')]({'where':{'id':_0x5f5143['params']['id']}})[_0xf141('0x20')](handleEntityNotFound(_0x4acf08,null))[_0xf141('0x20')](saveUpdates(_0x5f5143[_0xf141('0x42')],null))['then'](respondWithResult(_0x4acf08,null))['catch'](handleError(_0x4acf08,null));};exports[_0xf141('0x21')]=function(_0x5b99d5,_0x5cf091){return db['MailTransferReport'][_0xf141('0x40')]({'where':{'id':_0x5b99d5[_0xf141('0x43')]['id']}})[_0xf141('0x20')](handleEntityNotFound(_0x5cf091,null))[_0xf141('0x20')](removeEntity(_0x5cf091,null))[_0xf141('0x3b')](handleError(_0x5cf091,null));};exports[_0xf141('0x44')]=function(_0x2e697e,_0x5592f1){return db['MailTransferReport'][_0xf141('0x44')]()['then'](respondWithResult(_0x5592f1,null))[_0xf141('0x3b')](handleError(_0x5592f1,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 060cbf5..02c9af7 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 _0xb138=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0xb138,0x1dd));var _0x8b13=function(_0x3e7dab,_0x71e182){_0x3e7dab=_0x3e7dab-0x0;var _0xb8e942=_0xb138[_0x3e7dab];return _0xb8e942;};'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'));module['exports']=function(_0xd19a0f,_0x13f7bd){return _0xd19a0f['define'](_0x8b13('0xa'),attributes,{'tableName':_0x8b13('0xb'),'paranoid':![],'indexes':[{'name':_0x8b13('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6523=['../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x3c7a7b,_0x12a673){var _0x27980c=function(_0x5bfafe){while(--_0x5bfafe){_0x3c7a7b['push'](_0x3c7a7b['shift']());}};_0x27980c(++_0x12a673);}(_0x6523,0x1a6));var _0x3652=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0x6523[_0x5f1cf8];return _0x27d0fa;};'use strict';var _=require(_0x3652('0x0'));var util=require(_0x3652('0x1'));var logger=require('../../config/logger')(_0x3652('0x2'));var moment=require(_0x3652('0x3'));var BPromise=require(_0x3652('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3652('0x5'));var rimraf=require(_0x3652('0x6'));var config=require(_0x3652('0x7'));var attributes=require(_0x3652('0x8'));module['exports']=function(_0x204f81,_0x18f1c3){return _0x204f81[_0x3652('0x9')](_0x3652('0xa'),attributes,{'tableName':_0x3652('0xb'),'paranoid':![],'indexes':[{'name':_0x3652('0xc'),'fields':[_0x3652('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 123929c..f435061 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 _0x7f11=['code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x7f11,0xb4));var _0x17f1=function(_0x257e97,_0x572935){_0x257e97=_0x257e97-0x0;var _0x312494=_0x7f11[_0x257e97];return _0x312494;};'use strict';var _=require('lodash');var util=require(_0x17f1('0x0'));var moment=require(_0x17f1('0x1'));var BPromise=require('bluebird');var rs=require(_0x17f1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17f1('0x3'))['db'];var utils=require(_0x17f1('0x4'));var logger=require(_0x17f1('0x5'))(_0x17f1('0x6'));var config=require('../../config/environment');var jayson=require(_0x17f1('0x7'));var client=jayson['client'][_0x17f1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb3ed5d,_0x251bf9,_0x3c5f0e){return new BPromise(function(_0x372a27,_0x34c597){return client[_0x17f1('0x9')](_0xb3ed5d,_0x3c5f0e)[_0x17f1('0xa')](function(_0x4e163e){logger[_0x17f1('0xb')](_0x17f1('0xc'),_0x251bf9,_0x17f1('0xd'));logger[_0x17f1('0xe')](_0x17f1('0xf'),_0x251bf9,_0x17f1('0xd'),JSON[_0x17f1('0x10')](_0x4e163e));if(_0x4e163e[_0x17f1('0x11')]){if(_0x4e163e['error'][_0x17f1('0x12')]===0x1f4){logger['error'](_0x17f1('0xc'),_0x251bf9,_0x4e163e[_0x17f1('0x11')][_0x17f1('0x13')]);return _0x34c597(_0x4e163e[_0x17f1('0x11')][_0x17f1('0x13')]);}logger[_0x17f1('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x251bf9,_0x4e163e[_0x17f1('0x11')][_0x17f1('0x13')]);return _0x372a27(_0x4e163e[_0x17f1('0x11')]['message']);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x251bf9,_0x17f1('0xd'));_0x372a27(_0x4e163e[_0x17f1('0x14')][_0x17f1('0x13')]);}})[_0x17f1('0x15')](function(_0x58811a){logger[_0x17f1('0x11')](_0x17f1('0xc'),_0x251bf9,_0x58811a);_0x34c597(_0x58811a);});});} \ No newline at end of file +var _0x97d6=['client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x278f67,_0x4c6407){var _0x3d8f9d=function(_0x11ad67){while(--_0x11ad67){_0x278f67['push'](_0x278f67['shift']());}};_0x3d8f9d(++_0x4c6407);}(_0x97d6,0x7b));var _0x697d=function(_0x4a8eaf,_0x39ce59){_0x4a8eaf=_0x4a8eaf-0x0;var _0x5a658f=_0x97d6[_0x4a8eaf];return _0x5a658f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x697d('0x0'));var BPromise=require(_0x697d('0x1'));var rs=require(_0x697d('0x2'));var fs=require('fs');var Redis=require(_0x697d('0x3'));var db=require(_0x697d('0x4'))['db'];var utils=require(_0x697d('0x5'));var logger=require(_0x697d('0x6'))(_0x697d('0x7'));var config=require(_0x697d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x697d('0x9')][_0x697d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x505399,_0x5203af,_0x4906f7){return new BPromise(function(_0x5b79b4,_0x1d0e2e){return client[_0x697d('0xb')](_0x505399,_0x4906f7)[_0x697d('0xc')](function(_0x4367de){logger[_0x697d('0xd')](_0x697d('0xe'),_0x5203af,_0x697d('0xf'));logger['debug'](_0x697d('0x10'),_0x5203af,'request\x20sent',JSON['stringify'](_0x4367de));if(_0x4367de['error']){if(_0x4367de[_0x697d('0x11')][_0x697d('0x12')]===0x1f4){logger[_0x697d('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x5203af,_0x4367de[_0x697d('0x11')][_0x697d('0x13')]);return _0x1d0e2e(_0x4367de['error'][_0x697d('0x13')]);}logger[_0x697d('0x11')](_0x697d('0xe'),_0x5203af,_0x4367de[_0x697d('0x11')][_0x697d('0x13')]);return _0x5b79b4(_0x4367de[_0x697d('0x11')]['message']);}else{logger[_0x697d('0xd')](_0x697d('0xe'),_0x5203af,_0x697d('0xf'));_0x5b79b4(_0x4367de[_0x697d('0x14')][_0x697d('0x13')]);}})[_0x697d('0x15')](function(_0x232919){logger[_0x697d('0x11')](_0x697d('0xe'),_0x5203af,_0x232919);_0x1d0e2e(_0x232919);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index bb893c7..0e579b3 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 _0xd1dc=['multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy'];(function(_0x355b59,_0x5d74d3){var _0x3b8350=function(_0x521db9){while(--_0x521db9){_0x355b59['push'](_0x355b59['shift']());}};_0x3b8350(++_0x5d74d3);}(_0xd1dc,0x165));var _0xcd1d=function(_0x3ce233,_0x58abd8){_0x3ce233=_0x3ce233-0x0;var _0x48c0cc=_0xd1dc[_0x3ce233];return _0x48c0cc;};'use strict';var multer=require(_0xcd1d('0x0'));var util=require(_0xcd1d('0x1'));var path=require(_0xcd1d('0x2'));var timeout=require(_0xcd1d('0x3'));var express=require(_0xcd1d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcd1d('0x5'));var config=require(_0xcd1d('0x6'));var controller=require('./memberReport.controller');router[_0xcd1d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcd1d('0x7')]('/describe',auth[_0xcd1d('0x8')](),controller[_0xcd1d('0x9')]);router['get'](_0xcd1d('0xa'),auth['isAuthenticated'](),controller[_0xcd1d('0xb')]);router[_0xcd1d('0xc')]('/',auth[_0xcd1d('0x8')](),controller[_0xcd1d('0xd')]);router['put'](_0xcd1d('0xa'),auth[_0xcd1d('0x8')](),controller[_0xcd1d('0xe')]);router[_0xcd1d('0xf')](_0xcd1d('0xa'),auth[_0xcd1d('0x8')](),controller[_0xcd1d('0x10')]);module['exports']=router; \ No newline at end of file +var _0xddb4=['get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller'];(function(_0x48c272,_0x115e4c){var _0x2ee9c7=function(_0x2af7df){while(--_0x2af7df){_0x48c272['push'](_0x48c272['shift']());}};_0x2ee9c7(++_0x115e4c);}(_0xddb4,0x19a));var _0x4ddb=function(_0xfb5b41,_0x5cbf71){_0xfb5b41=_0xfb5b41-0x0;var _0x53b1d1=_0xddb4[_0xfb5b41];return _0x53b1d1;};'use strict';var multer=require(_0x4ddb('0x0'));var util=require(_0x4ddb('0x1'));var path=require(_0x4ddb('0x2'));var timeout=require(_0x4ddb('0x3'));var express=require(_0x4ddb('0x4'));var router=express[_0x4ddb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4ddb('0x6'));var interaction=require(_0x4ddb('0x7'));var config=require(_0x4ddb('0x8'));var controller=require(_0x4ddb('0x9'));router[_0x4ddb('0xa')]('/',auth[_0x4ddb('0xb')](),controller[_0x4ddb('0xc')]);router[_0x4ddb('0xa')](_0x4ddb('0xd'),auth[_0x4ddb('0xb')](),controller['describe']);router[_0x4ddb('0xa')](_0x4ddb('0xe'),auth[_0x4ddb('0xb')](),controller[_0x4ddb('0xf')]);router[_0x4ddb('0x10')]('/',auth[_0x4ddb('0xb')](),controller['create']);router[_0x4ddb('0x11')](_0x4ddb('0xe'),auth['isAuthenticated'](),controller[_0x4ddb('0x12')]);router[_0x4ddb('0x13')](_0x4ddb('0xe'),auth[_0x4ddb('0xb')](),controller[_0x4ddb('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index f131ced..d400e13 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 _0x2428=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','sequelize','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','setDataValue'];(function(_0x436197,_0x4aed33){var _0x1b353e=function(_0x40596a){while(--_0x40596a){_0x436197['push'](_0x436197['shift']());}};_0x1b353e(++_0x4aed33);}(_0x2428,0xaa));var _0x8242=function(_0x193dad,_0x38d83d){_0x193dad=_0x193dad-0x0;var _0x5eafa4=_0x2428[_0x193dad];return _0x5eafa4;};'use strict';var Sequelize=require(_0x8242('0x0'));var moment=require('moment');module[_0x8242('0x1')]={'channel':{'type':Sequelize[_0x8242('0x2')]},'membername':{'type':Sequelize[_0x8242('0x2')]},'interface':{'type':Sequelize[_0x8242('0x2')]},'type':{'type':Sequelize[_0x8242('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x8242('0x3')},'duration':{'type':Sequelize[_0x8242('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8242('0x5')],'set':function(_0x5a2cfd){var _0x268814=moment(_0x5a2cfd);var _0x2540ef=moment(this[_0x8242('0x6')]('enterAt'));var _0x22123c=_0x268814[_0x8242('0x7')](_0x2540ef,_0x8242('0x8'));this[_0x8242('0x9')](_0x8242('0xa'),_0x5a2cfd);this[_0x8242('0x9')](_0x8242('0xb'),_0x22123c>=0x0?_0x22123c:null);}},'data1':{'type':Sequelize[_0x8242('0x2')],'comment':_0x8242('0xc')},'data2':{'type':Sequelize[_0x8242('0x2')],'comment':_0x8242('0xd')},'data3':{'type':Sequelize['STRING'],'comment':_0x8242('0xe')},'data4':{'type':Sequelize[_0x8242('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x8242('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x8242('0x2')]},'internal':{'type':Sequelize[_0x8242('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8089=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','INTEGER','sequelize','STRING'];(function(_0x25fc41,_0x250864){var _0x1371d1=function(_0x8ab2e3){while(--_0x8ab2e3){_0x25fc41['push'](_0x25fc41['shift']());}};_0x1371d1(++_0x250864);}(_0x8089,0x1de));var _0x9808=function(_0x84e97e,_0x101944){_0x84e97e=_0x84e97e-0x0;var _0x5c5c5a=_0x8089[_0x84e97e];return _0x5c5c5a;};'use strict';var Sequelize=require(_0x9808('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x9808('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x9808('0x1')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x9808('0x2'),'comment':_0x9808('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x9808('0x4')]},'exitAt':{'type':Sequelize[_0x9808('0x4')],'set':function(_0x2cd546){var _0x3eb6a1=moment(_0x2cd546);var _0x345e24=moment(this[_0x9808('0x5')](_0x9808('0x6')));var _0x139e95=_0x3eb6a1[_0x9808('0x7')](_0x345e24,_0x9808('0x8'));this[_0x9808('0x9')]('exitAt',_0x2cd546);this[_0x9808('0x9')](_0x9808('0xa'),_0x139e95>=0x0?_0x139e95:null);}},'data1':{'type':Sequelize[_0x9808('0x1')],'comment':_0x9808('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0x9808('0xc')},'data3':{'type':Sequelize[_0x9808('0x1')],'comment':_0x9808('0xd')},'data4':{'type':Sequelize[_0x9808('0x1')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x9808('0x1')],'comment':_0x9808('0xe')},'role':{'type':Sequelize[_0x9808('0x1')]},'internal':{'type':Sequelize[_0x9808('0xf')]},'uniqueid':{'type':Sequelize[_0x9808('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index d51fddf..e2caf88 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xedd9,0xfc));var _0x9edd=function(_0x599429,_0x2df653){_0x599429=_0x599429-0x0;var _0x1a2d41=_0xedd9[_0x599429];return _0x1a2d41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xedd9,0xfc));var _0x9edd=function(_0x2eed14,_0x47b7d2){_0x2eed14=_0x2eed14-0x0;var _0x4408cd=_0xedd9[_0x2eed14];return _0x4408cd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 8d454a3..fe30de4 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 _0x9b8e=['MemberReport','report_member','interface','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x1da1ec,_0x1602ed){var _0x5063d8=function(_0x154983){while(--_0x154983){_0x1da1ec['push'](_0x1da1ec['shift']());}};_0x5063d8(++_0x1602ed);}(_0x9b8e,0x158));var _0xe9b8=function(_0x2f6fa5,_0x1dac32){_0x2f6fa5=_0x2f6fa5-0x0;var _0x3ff964=_0x9b8e[_0x2f6fa5];return _0x3ff964;};'use strict';var _=require(_0xe9b8('0x0'));var util=require('util');var logger=require(_0xe9b8('0x1'))(_0xe9b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe9b8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9b8('0x4'));var config=require(_0xe9b8('0x5'));var attributes=require('./memberReport.attributes');module[_0xe9b8('0x6')]=function(_0x3d24e3,_0x3f6b50){return _0x3d24e3[_0xe9b8('0x7')](_0xe9b8('0x8'),attributes,{'tableName':_0xe9b8('0x9'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0xe9b8('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1d2=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','MemberReport','../../config/logger','api'];(function(_0x598f1f,_0xa7d1c){var _0x26d77d=function(_0x176e50){while(--_0x176e50){_0x598f1f['push'](_0x598f1f['shift']());}};_0x26d77d(++_0xa7d1c);}(_0xb1d2,0x116));var _0x2b1d=function(_0x1d73cd,_0x3cdd69){_0x1d73cd=_0x1d73cd-0x0;var _0x5babb8=_0xb1d2[_0x1d73cd];return _0x5babb8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2b1d('0x0'))(_0x2b1d('0x1'));var moment=require(_0x2b1d('0x2'));var BPromise=require(_0x2b1d('0x3'));var rp=require(_0x2b1d('0x4'));var fs=require('fs');var path=require(_0x2b1d('0x5'));var rimraf=require(_0x2b1d('0x6'));var config=require(_0x2b1d('0x7'));var attributes=require('./memberReport.attributes');module[_0x2b1d('0x8')]=function(_0x40f0ac,_0x35cc51){return _0x40f0ac['define'](_0x2b1d('0x9'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 8d27780..4bd3acf 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 _0x9fe7=['limit','model','map','include','CreateMemberReport','create','body','debug','update','where','UpdateMemberReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes'];(function(_0x94bb53,_0x9cdb5d){var _0x1605f0=function(_0x479dd9){while(--_0x479dd9){_0x94bb53['push'](_0x94bb53['shift']());}};_0x1605f0(++_0x9cdb5d);}(_0x9fe7,0x1df));var _0x79fe=function(_0x1b277e,_0xc3728){_0x1b277e=_0x1b277e-0x0;var _0x5f1dd9=_0x9fe7[_0x1b277e];return _0x5f1dd9;};'use strict';var _=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var moment=require('moment');var BPromise=require(_0x79fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79fe('0x3'));var db=require(_0x79fe('0x4'))['db'];var utils=require(_0x79fe('0x5'));var logger=require('../../config/logger')(_0x79fe('0x6'));var config=require(_0x79fe('0x7'));var jayson=require(_0x79fe('0x8'));var client=jayson['client'][_0x79fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a5aef,_0x2ba246,_0x4c8314){return new BPromise(function(_0x24faa0,_0x264323){return client[_0x79fe('0xa')](_0x2a5aef,_0x4c8314)[_0x79fe('0xb')](function(_0xafc7cd){logger['info'](_0x79fe('0xc'),_0x2ba246,_0x79fe('0xd'));logger['debug'](_0x79fe('0xe'),_0x2ba246,_0x79fe('0xd'),JSON[_0x79fe('0xf')](_0xafc7cd));if(_0xafc7cd[_0x79fe('0x10')]){if(_0xafc7cd['error'][_0x79fe('0x11')]===0x1f4){logger[_0x79fe('0x10')](_0x79fe('0xc'),_0x2ba246,_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);return _0x264323(_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);}logger[_0x79fe('0x10')]('MemberReport,\x20%s,\x20%s',_0x2ba246,_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);return _0x24faa0(_0xafc7cd[_0x79fe('0x10')][_0x79fe('0x12')]);}else{logger[_0x79fe('0x13')](_0x79fe('0xc'),_0x2ba246,'request\x20sent');_0x24faa0(_0xafc7cd[_0x79fe('0x14')][_0x79fe('0x12')]);}})[_0x79fe('0x15')](function(_0x5f0af3){logger['error'](_0x79fe('0xc'),_0x2ba246,_0x5f0af3);_0x264323(_0x5f0af3);});});}exports[_0x79fe('0x16')]=function(_0x39be95){var _0x40a549=this;return new Promise(function(_0x536641,_0x5e2f0b){return db[_0x79fe('0x17')][_0x79fe('0x18')]({'raw':_0x39be95[_0x79fe('0x19')]?_0x39be95['options'][_0x79fe('0x1a')]===undefined?!![]:![]:!![],'where':_0x39be95[_0x79fe('0x19')]?_0x39be95[_0x79fe('0x19')]['where']||null:null,'attributes':_0x39be95[_0x79fe('0x19')]?_0x39be95['options'][_0x79fe('0x1b')]||null:null,'limit':_0x39be95[_0x79fe('0x19')]?_0x39be95[_0x79fe('0x19')][_0x79fe('0x1c')]||null:null,'include':_0x39be95[_0x79fe('0x19')]?_0x39be95[_0x79fe('0x19')]['include']?_['map'](_0x39be95[_0x79fe('0x19')]['include'],function(_0x16aa35){return{'model':db[_0x16aa35[_0x79fe('0x1d')]],'as':_0x16aa35['as'],'attributes':_0x16aa35['attributes'],'include':_0x16aa35['include']?_[_0x79fe('0x1e')](_0x16aa35[_0x79fe('0x1f')],function(_0x59339b){return{'model':db[_0x59339b[_0x79fe('0x1d')]],'as':_0x59339b['as'],'attributes':_0x59339b[_0x79fe('0x1b')],'include':_0x59339b['include']?_['map'](_0x59339b['include'],function(_0x3720fa){return{'model':db[_0x3720fa[_0x79fe('0x1d')]],'as':_0x3720fa['as'],'attributes':_0x3720fa[_0x79fe('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47786f){logger[_0x79fe('0x13')](_0x79fe('0x16'),_0x39be95);logger['debug']('GetMemberReport',_0x39be95,JSON[_0x79fe('0xf')](_0x47786f));_0x536641(_0x47786f);})['catch'](function(_0x196215){logger['error']('GetMemberReport',_0x196215['message'],_0x39be95);_0x5e2f0b(_0x40a549['error'](0x1f4,_0x196215[_0x79fe('0x12')]));});});};exports[_0x79fe('0x20')]=function(_0x4dff5f){var _0x2b6975=this;return new Promise(function(_0x5745a8,_0x42558d){return db[_0x79fe('0x17')][_0x79fe('0x21')](_0x4dff5f[_0x79fe('0x22')],{'raw':_0x4dff5f[_0x79fe('0x19')]?_0x4dff5f['options'][_0x79fe('0x1a')]===undefined?!![]:![]:!![]})[_0x79fe('0xb')](function(_0x25ef07){logger[_0x79fe('0x13')](_0x79fe('0x20'),_0x4dff5f);logger[_0x79fe('0x23')]('CreateMemberReport',_0x4dff5f,JSON[_0x79fe('0xf')](_0x25ef07));_0x5745a8(_0x25ef07);})[_0x79fe('0x15')](function(_0x8ddef3){logger[_0x79fe('0x10')](_0x79fe('0x20'),_0x8ddef3[_0x79fe('0x12')],_0x4dff5f);_0x42558d(_0x2b6975['error'](0x1f4,_0x8ddef3[_0x79fe('0x12')]));});});};exports['UpdateMemberReport']=function(_0x2bdf83){var _0x4c9f60=this;return new Promise(function(_0x2a533b,_0x5a4f73){return db[_0x79fe('0x17')][_0x79fe('0x24')](_0x2bdf83[_0x79fe('0x22')],{'raw':_0x2bdf83['options']?_0x2bdf83[_0x79fe('0x19')][_0x79fe('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bdf83[_0x79fe('0x19')]?_0x2bdf83[_0x79fe('0x19')][_0x79fe('0x25')]||null:null,'attributes':_0x2bdf83['options']?_0x2bdf83['options'][_0x79fe('0x1b')]||null:null,'limit':_0x2bdf83['options']?_0x2bdf83[_0x79fe('0x19')][_0x79fe('0x1c')]||null:null})['then'](function(_0xbe4796){logger[_0x79fe('0x13')](_0x79fe('0x26'),_0x2bdf83);logger[_0x79fe('0x23')](_0x79fe('0x26'),_0x2bdf83,JSON[_0x79fe('0xf')](_0xbe4796));_0x2a533b(_0xbe4796);})['catch'](function(_0x3f099f){logger[_0x79fe('0x10')](_0x79fe('0x26'),_0x3f099f[_0x79fe('0x12')],_0x2bdf83);_0x5a4f73(_0x4c9f60['error'](0x1f4,_0x3f099f[_0x79fe('0x12')]));});});}; \ No newline at end of file +var _0x535d=['result','catch','MemberReport','options','raw','limit','include','model','attributes','map','GetMemberReport','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x535d,0xe8));var _0xd535=function(_0x2ba9c2,_0x28dc65){_0x2ba9c2=_0x2ba9c2-0x0;var _0x50ee9f=_0x535d[_0x2ba9c2];return _0x50ee9f;};'use strict';var _=require(_0xd535('0x0'));var util=require(_0xd535('0x1'));var moment=require('moment');var BPromise=require(_0xd535('0x2'));var rs=require(_0xd535('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd535('0x4'));var logger=require(_0xd535('0x5'))(_0xd535('0x6'));var config=require(_0xd535('0x7'));var jayson=require(_0xd535('0x8'));var client=jayson[_0xd535('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52cbc5,_0x44e2bb,_0x20b2ae){return new BPromise(function(_0x4fba4f,_0x1c092f){return client['request'](_0x52cbc5,_0x20b2ae)[_0xd535('0xa')](function(_0x156eea){logger[_0xd535('0xb')](_0xd535('0xc'),_0x44e2bb,'request\x20sent');logger[_0xd535('0xd')](_0xd535('0xe'),_0x44e2bb,_0xd535('0xf'),JSON[_0xd535('0x10')](_0x156eea));if(_0x156eea['error']){if(_0x156eea[_0xd535('0x11')][_0xd535('0x12')]===0x1f4){logger[_0xd535('0x11')](_0xd535('0xc'),_0x44e2bb,_0x156eea[_0xd535('0x11')][_0xd535('0x13')]);return _0x1c092f(_0x156eea[_0xd535('0x11')]['message']);}logger[_0xd535('0x11')]('MemberReport,\x20%s,\x20%s',_0x44e2bb,_0x156eea['error'][_0xd535('0x13')]);return _0x4fba4f(_0x156eea[_0xd535('0x11')]['message']);}else{logger[_0xd535('0xb')](_0xd535('0xc'),_0x44e2bb,_0xd535('0xf'));_0x4fba4f(_0x156eea[_0xd535('0x14')]['message']);}})[_0xd535('0x15')](function(_0x2b0f32){logger[_0xd535('0x11')](_0xd535('0xc'),_0x44e2bb,_0x2b0f32);_0x1c092f(_0x2b0f32);});});}exports['GetMemberReport']=function(_0x921b2e){var _0x54ff85=this;return new Promise(function(_0x22d4e2,_0x4f2039){return db[_0xd535('0x16')]['findAll']({'raw':_0x921b2e[_0xd535('0x17')]?_0x921b2e[_0xd535('0x17')][_0xd535('0x18')]===undefined?!![]:![]:!![],'where':_0x921b2e[_0xd535('0x17')]?_0x921b2e['options']['where']||null:null,'attributes':_0x921b2e[_0xd535('0x17')]?_0x921b2e['options']['attributes']||null:null,'limit':_0x921b2e[_0xd535('0x17')]?_0x921b2e[_0xd535('0x17')][_0xd535('0x19')]||null:null,'include':_0x921b2e[_0xd535('0x17')]?_0x921b2e[_0xd535('0x17')][_0xd535('0x1a')]?_['map'](_0x921b2e[_0xd535('0x17')][_0xd535('0x1a')],function(_0x42008f){return{'model':db[_0x42008f[_0xd535('0x1b')]],'as':_0x42008f['as'],'attributes':_0x42008f[_0xd535('0x1c')],'include':_0x42008f['include']?_['map'](_0x42008f[_0xd535('0x1a')],function(_0x1abfec){return{'model':db[_0x1abfec['model']],'as':_0x1abfec['as'],'attributes':_0x1abfec['attributes'],'include':_0x1abfec[_0xd535('0x1a')]?_[_0xd535('0x1d')](_0x1abfec[_0xd535('0x1a')],function(_0x551a99){return{'model':db[_0x551a99['model']],'as':_0x551a99['as'],'attributes':_0x551a99[_0xd535('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd535('0xa')](function(_0x15769b){logger[_0xd535('0xb')](_0xd535('0x1e'),_0x921b2e);logger[_0xd535('0xd')](_0xd535('0x1e'),_0x921b2e,JSON['stringify'](_0x15769b));_0x22d4e2(_0x15769b);})[_0xd535('0x15')](function(_0x3ea7f7){logger['error']('GetMemberReport',_0x3ea7f7['message'],_0x921b2e);_0x4f2039(_0x54ff85[_0xd535('0x11')](0x1f4,_0x3ea7f7[_0xd535('0x13')]));});});};exports[_0xd535('0x1f')]=function(_0x2e6aff){var _0x3e4021=this;return new Promise(function(_0x47d5e2,_0x51ff66){return db[_0xd535('0x16')][_0xd535('0x20')](_0x2e6aff[_0xd535('0x21')],{'raw':_0x2e6aff[_0xd535('0x17')]?_0x2e6aff['options'][_0xd535('0x18')]===undefined?!![]:![]:!![]})[_0xd535('0xa')](function(_0x3f9b69){logger[_0xd535('0xb')](_0xd535('0x1f'),_0x2e6aff);logger[_0xd535('0xd')]('CreateMemberReport',_0x2e6aff,JSON[_0xd535('0x10')](_0x3f9b69));_0x47d5e2(_0x3f9b69);})[_0xd535('0x15')](function(_0xb4fef2){logger['error'](_0xd535('0x1f'),_0xb4fef2[_0xd535('0x13')],_0x2e6aff);_0x51ff66(_0x3e4021[_0xd535('0x11')](0x1f4,_0xb4fef2[_0xd535('0x13')]));});});};exports[_0xd535('0x22')]=function(_0x53d6c7){var _0x5204aa=this;return new Promise(function(_0x4effab,_0x17bf49){return db[_0xd535('0x16')][_0xd535('0x23')](_0x53d6c7[_0xd535('0x21')],{'raw':_0x53d6c7[_0xd535('0x17')]?_0x53d6c7[_0xd535('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53d6c7['options']?_0x53d6c7[_0xd535('0x17')]['where']||null:null,'attributes':_0x53d6c7[_0xd535('0x17')]?_0x53d6c7['options'][_0xd535('0x1c')]||null:null,'limit':_0x53d6c7['options']?_0x53d6c7[_0xd535('0x17')]['limit']||null:null})[_0xd535('0xa')](function(_0x2624bc){logger[_0xd535('0xb')](_0xd535('0x22'),_0x53d6c7);logger['debug'](_0xd535('0x22'),_0x53d6c7,JSON[_0xd535('0x10')](_0x2624bc));_0x4effab(_0x2624bc);})['catch'](function(_0x3b3645){logger[_0xd535('0x11')](_0xd535('0x22'),_0x3b3645[_0xd535('0x13')],_0x53d6c7);_0x17bf49(_0x5204aa[_0xd535('0x11')](0x1f4,_0x3b3645[_0xd535('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index fc614f6..52b8454 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 _0xe85c=['fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path','connect-timeout','express'];(function(_0xc118c1,_0x1f3444){var _0x11afef=function(_0x46fc85){while(--_0x46fc85){_0xc118c1['push'](_0xc118c1['shift']());}};_0x11afef(++_0x1f3444);}(_0xe85c,0x103));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xce85('0x0'));var util=require(_0xce85('0x1'));var path=require(_0xce85('0x2'));var timeout=require(_0xce85('0x3'));var express=require(_0xce85('0x4'));var router=express['Router']();var fs_extra=require(_0xce85('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xce85('0x6'));var config=require(_0xce85('0x7'));var controller=require(_0xce85('0x8'));router[_0xce85('0x9')]('/',controller[_0xce85('0xa')]);module[_0xce85('0xb')]=router; \ No newline at end of file +var _0x7b14=['exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x11ea4e,_0x8f6455){var _0x4fe430=function(_0x5d8a7b){while(--_0x5d8a7b){_0x11ea4e['push'](_0x11ea4e['shift']());}};_0x4fe430(++_0x8f6455);}(_0x7b14,0x91));var _0x47b1=function(_0x64727e,_0x52fee0){_0x64727e=_0x64727e-0x0;var _0x30eea0=_0x7b14[_0x64727e];return _0x30eea0;};'use strict';var multer=require(_0x47b1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x47b1('0x1')]();var fs_extra=require(_0x47b1('0x2'));var auth=require(_0x47b1('0x3'));var interaction=require(_0x47b1('0x4'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x47b1('0x5')]('/',controller[_0x47b1('0x6')]);module[_0x47b1('0x7')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 2cbb327..9a4f29d 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 _0x2aba=['version','sequelize'];(function(_0x238efe,_0x3032d2){var _0x902f53=function(_0x47ba30){while(--_0x47ba30){_0x238efe['push'](_0x238efe['shift']());}};_0x902f53(++_0x3032d2);}(_0x2aba,0xe9));var _0xa2ab=function(_0x4bd184,_0x7c4587){_0x4bd184=_0x4bd184-0x0;var _0x3135f1=_0x2aba[_0x4bd184];return _0x3135f1;};'use strict';var Sequelize=require(_0xa2ab('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0xa2ab('0x1')}}; \ No newline at end of file +var _0x4e23=['STRING','version','sequelize'];(function(_0x1076c0,_0x172051){var _0x47881b=function(_0x4d9a70){while(--_0x4d9a70){_0x1076c0['push'](_0x1076c0['shift']());}};_0x47881b(++_0x172051);}(_0x4e23,0xb3));var _0x34e2=function(_0x458a3f,_0x207fc6){_0x458a3f=_0x458a3f-0x0;var _0x481b96=_0x4e23[_0x458a3f];return _0x481b96;};'use strict';var Sequelize=require(_0x34e2('0x0'));module['exports']={'version':{'type':Sequelize[_0x34e2('0x1')],'unique':_0x34e2('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 94b19be..0ab0cfe 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 _0xe3f3=['update','then','destroy','error','stack','name','send','index','map','Migration','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','catch','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','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','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x6487e3,_0x3ef5ac){var _0x4c1f77=function(_0x63f9e0){while(--_0x63f9e0){_0x6487e3['push'](_0x6487e3['shift']());}};_0x4c1f77(++_0x3ef5ac);}(_0xe3f3,0x130));var _0x3e3f=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xe3f3[_0x4e7d25];return _0x526fe6;};'use strict';var emlformat=require(_0x3e3f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3e3f('0x1'));var jsonpatch=require(_0x3e3f('0x2'));var rp=require('request-promise');var moment=require(_0x3e3f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3e3f('0x4'));var util=require(_0x3e3f('0x5'));var path=require(_0x3e3f('0x6'));var sox=require(_0x3e3f('0x7'));var csv=require(_0x3e3f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e3f('0x9'));var _=require(_0x3e3f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3e3f('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3e3f('0xc'));var Papa=require(_0x3e3f('0xd'));var Redis=require(_0x3e3f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3e3f('0xf'));var as=require(_0x3e3f('0x10'));var hardwareService=require(_0x3e3f('0x11'));var logger=require(_0x3e3f('0x12'))(_0x3e3f('0x13'));var utils=require(_0x3e3f('0x14'));var config=require(_0x3e3f('0x15'));var licenseUtil=require(_0x3e3f('0x16'));var db=require(_0x3e3f('0x17'))['db'];function respondWithStatusCode(_0x560719,_0x5f4385){_0x5f4385=_0x5f4385||0xcc;return function(_0x10730e){if(_0x10730e){return _0x560719[_0x3e3f('0x18')](_0x5f4385);}return _0x560719['status'](_0x5f4385)[_0x3e3f('0x19')]();};}function respondWithResult(_0x38d2b0,_0x219d80){_0x219d80=_0x219d80||0xc8;return function(_0x13a830){if(_0x13a830){return _0x38d2b0[_0x3e3f('0x1a')](_0x219d80)['json'](_0x13a830);}};}function respondWithFilteredResult(_0x531150,_0x199fbf){return function(_0x40f0ff){if(_0x40f0ff){var _0x449405=typeof _0x199fbf[_0x3e3f('0x1b')]===_0x3e3f('0x1c')&&typeof _0x199fbf[_0x3e3f('0x1d')]==='undefined';var _0x56f327=_0x40f0ff[_0x3e3f('0x1e')];var _0xddb0c6=_0x449405?0x0:_0x199fbf['offset'];var _0x2c31b5=_0x449405?_0x40f0ff[_0x3e3f('0x1e')]:_0x199fbf[_0x3e3f('0x1b')]+_0x199fbf['limit'];var _0x169204;if(_0x2c31b5>=_0x56f327){_0x2c31b5=_0x56f327;_0x169204=0xc8;}else{_0x169204=0xce;}_0x531150['status'](_0x169204);return _0x531150[_0x3e3f('0x1f')](_0x3e3f('0x20'),_0xddb0c6+'-'+_0x2c31b5+'/'+_0x56f327)['json'](_0x40f0ff);}return null;};}function patchUpdates(_0x223212){return function(_0x16ee74){try{jsonpatch[_0x3e3f('0x21')](_0x16ee74,_0x223212,!![]);}catch(_0x4fff7c){return BPromise[_0x3e3f('0x22')](_0x4fff7c);}return _0x16ee74[_0x3e3f('0x23')]();};}function saveUpdates(_0x39ac6f,_0x26b1d6){return function(_0x567c56){if(_0x567c56){return _0x567c56[_0x3e3f('0x24')](_0x39ac6f)[_0x3e3f('0x25')](function(_0x2cd7ad){return _0x2cd7ad;});}return null;};}function removeEntity(_0x1e4fbd,_0x3d127f){return function(_0x1522e2){if(_0x1522e2){return _0x1522e2[_0x3e3f('0x26')]()[_0x3e3f('0x25')](function(){_0x1e4fbd[_0x3e3f('0x1a')](0xcc)[_0x3e3f('0x19')]();});}};}function handleEntityNotFound(_0x5da285,_0x345313){return function(_0x144290){if(!_0x144290){_0x5da285['sendStatus'](0x194);}return _0x144290;};}function handleError(_0x4396a9,_0x21cd97){_0x21cd97=_0x21cd97||0x1f4;return function(_0x17bf32){logger[_0x3e3f('0x27')](_0x17bf32[_0x3e3f('0x28')]);if(_0x17bf32['name']){delete _0x17bf32[_0x3e3f('0x29')];}_0x4396a9['status'](_0x21cd97)[_0x3e3f('0x2a')](_0x17bf32);};}exports[_0x3e3f('0x2b')]=function(_0x3dee1b,_0x2f0d8a){var _0x54b71c={},_0x20912a={},_0x18b349={'count':0x0,'rows':[]};var _0x1fab9a=_[_0x3e3f('0x2c')](db[_0x3e3f('0x2d')]['rawAttributes'],function(_0x4a7efc){return{'name':_0x4a7efc['fieldName'],'type':_0x4a7efc[_0x3e3f('0x2e')][_0x3e3f('0x2f')]};});_0x20912a[_0x3e3f('0x30')]=_[_0x3e3f('0x2c')](_0x1fab9a,_0x3e3f('0x29'));_0x20912a[_0x3e3f('0x31')]=_[_0x3e3f('0x32')](_0x3dee1b[_0x3e3f('0x31')]);_0x20912a[_0x3e3f('0x33')]=_['intersection'](_0x20912a[_0x3e3f('0x30')],_0x20912a[_0x3e3f('0x31')]);_0x54b71c[_0x3e3f('0x34')]=_[_0x3e3f('0x35')](_0x20912a[_0x3e3f('0x30')],qs[_0x3e3f('0x36')](_0x3dee1b[_0x3e3f('0x31')][_0x3e3f('0x36')]));_0x54b71c[_0x3e3f('0x34')]=_0x54b71c[_0x3e3f('0x34')][_0x3e3f('0x37')]?_0x54b71c[_0x3e3f('0x34')]:_0x20912a[_0x3e3f('0x30')];if(!_0x3dee1b[_0x3e3f('0x31')][_0x3e3f('0x38')](_0x3e3f('0x39'))){_0x54b71c[_0x3e3f('0x1d')]=qs[_0x3e3f('0x1d')](_0x3dee1b[_0x3e3f('0x31')][_0x3e3f('0x1d')]);_0x54b71c[_0x3e3f('0x1b')]=qs[_0x3e3f('0x1b')](_0x3dee1b[_0x3e3f('0x31')][_0x3e3f('0x1b')]);}_0x54b71c[_0x3e3f('0x3a')]=qs[_0x3e3f('0x3b')](_0x3dee1b[_0x3e3f('0x31')]['sort']);_0x54b71c[_0x3e3f('0x3c')]=qs[_0x3e3f('0x33')](_[_0x3e3f('0x3d')](_0x3dee1b[_0x3e3f('0x31')],_0x20912a['filters']),_0x1fab9a);if(_0x3dee1b[_0x3e3f('0x31')][_0x3e3f('0x3e')]){_0x54b71c['where']=_['merge'](_0x54b71c[_0x3e3f('0x3c')],{'$or':_[_0x3e3f('0x2c')](_0x1fab9a,function(_0x3a9587){if(_0x3a9587[_0x3e3f('0x2e')]!==_0x3e3f('0x3f')){var _0x55d20d={};_0x55d20d[_0x3a9587['name']]={'$like':'%'+_0x3dee1b[_0x3e3f('0x31')][_0x3e3f('0x3e')]+'%'};return _0x55d20d;}})});}_0x54b71c=_[_0x3e3f('0x40')]({},_0x54b71c,_0x3dee1b['options']);var _0x2c923d={'where':_0x54b71c[_0x3e3f('0x3c')]};return db[_0x3e3f('0x2d')][_0x3e3f('0x1e')](_0x2c923d)[_0x3e3f('0x25')](function(_0x1a87a3){_0x18b349[_0x3e3f('0x1e')]=_0x1a87a3;if(_0x3dee1b['query'][_0x3e3f('0x41')]){_0x54b71c[_0x3e3f('0x42')]=[{'all':!![]}];}return db[_0x3e3f('0x2d')]['findAll'](_0x54b71c);})[_0x3e3f('0x25')](function(_0x5b00ec){_0x18b349['rows']=_0x5b00ec;return _0x18b349;})['then'](respondWithFilteredResult(_0x2f0d8a,_0x54b71c))[_0x3e3f('0x43')](handleError(_0x2f0d8a,null));}; \ No newline at end of file +var _0x3a32=['limit','count','set','Content-Range','json','reject','update','then','sendStatus','stack','name','index','rawAttributes','type','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','Migration','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined'];(function(_0x301813,_0x32ee63){var _0x54b093=function(_0x4f86d9){while(--_0x4f86d9){_0x301813['push'](_0x301813['shift']());}};_0x54b093(++_0x32ee63);}(_0x3a32,0x65));var _0x23a3=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x3a32[_0x565c49];return _0x20ca34;};'use strict';var emlformat=require(_0x23a3('0x0'));var rimraf=require(_0x23a3('0x1'));var zipdir=require(_0x23a3('0x2'));var jsonpatch=require(_0x23a3('0x3'));var rp=require(_0x23a3('0x4'));var moment=require('moment');var BPromise=require(_0x23a3('0x5'));var Mustache=require(_0x23a3('0x6'));var util=require(_0x23a3('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x23a3('0x8'));var ejs=require(_0x23a3('0x9'));var fs=require('fs');var fs_extra=require(_0x23a3('0xa'));var _=require(_0x23a3('0xb'));var squel=require(_0x23a3('0xc'));var crypto=require(_0x23a3('0xd'));var jsforce=require(_0x23a3('0xe'));var deskjs=require(_0x23a3('0xf'));var toCsv=require(_0x23a3('0x8'));var querystring=require(_0x23a3('0x10'));var Papa=require('papaparse');var Redis=require(_0x23a3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x23a3('0x12'));var as=require(_0x23a3('0x13'));var hardwareService=require(_0x23a3('0x14'));var logger=require(_0x23a3('0x15'))(_0x23a3('0x16'));var utils=require(_0x23a3('0x17'));var config=require(_0x23a3('0x18'));var licenseUtil=require(_0x23a3('0x19'));var db=require(_0x23a3('0x1a'))['db'];function respondWithStatusCode(_0x3861a8,_0x32aa83){_0x32aa83=_0x32aa83||0xcc;return function(_0xa162dd){if(_0xa162dd){return _0x3861a8['sendStatus'](_0x32aa83);}return _0x3861a8['status'](_0x32aa83)[_0x23a3('0x1b')]();};}function respondWithResult(_0x435264,_0x16ad4a){_0x16ad4a=_0x16ad4a||0xc8;return function(_0x50e690){if(_0x50e690){return _0x435264[_0x23a3('0x1c')](_0x16ad4a)['json'](_0x50e690);}};}function respondWithFilteredResult(_0x4d2bad,_0x4cbfda){return function(_0x1b1c56){if(_0x1b1c56){var _0x7bc65c=typeof _0x4cbfda[_0x23a3('0x1d')]===_0x23a3('0x1e')&&typeof _0x4cbfda[_0x23a3('0x1f')]===_0x23a3('0x1e');var _0x23aa6b=_0x1b1c56[_0x23a3('0x20')];var _0x451df4=_0x7bc65c?0x0:_0x4cbfda[_0x23a3('0x1d')];var _0x19ce9a=_0x7bc65c?_0x1b1c56['count']:_0x4cbfda['offset']+_0x4cbfda[_0x23a3('0x1f')];var _0x406aed;if(_0x19ce9a>=_0x23aa6b){_0x19ce9a=_0x23aa6b;_0x406aed=0xc8;}else{_0x406aed=0xce;}_0x4d2bad[_0x23a3('0x1c')](_0x406aed);return _0x4d2bad[_0x23a3('0x21')](_0x23a3('0x22'),_0x451df4+'-'+_0x19ce9a+'/'+_0x23aa6b)[_0x23a3('0x23')](_0x1b1c56);}return null;};}function patchUpdates(_0x475a79){return function(_0x875223){try{jsonpatch['apply'](_0x875223,_0x475a79,!![]);}catch(_0xd99e0){return BPromise[_0x23a3('0x24')](_0xd99e0);}return _0x875223['save']();};}function saveUpdates(_0x39badf,_0x883ffd){return function(_0x4a3b75){if(_0x4a3b75){return _0x4a3b75[_0x23a3('0x25')](_0x39badf)[_0x23a3('0x26')](function(_0x3704ea){return _0x3704ea;});}return null;};}function removeEntity(_0x51dbae,_0x5e543d){return function(_0x25c6b1){if(_0x25c6b1){return _0x25c6b1['destroy']()[_0x23a3('0x26')](function(){_0x51dbae[_0x23a3('0x1c')](0xcc)[_0x23a3('0x1b')]();});}};}function handleEntityNotFound(_0x4fa840,_0x5c3654){return function(_0x36b9b2){if(!_0x36b9b2){_0x4fa840[_0x23a3('0x27')](0x194);}return _0x36b9b2;};}function handleError(_0x10a6c6,_0x100ce1){_0x100ce1=_0x100ce1||0x1f4;return function(_0x58bd4d){logger['error'](_0x58bd4d[_0x23a3('0x28')]);if(_0x58bd4d[_0x23a3('0x29')]){delete _0x58bd4d['name'];}_0x10a6c6[_0x23a3('0x1c')](_0x100ce1)['send'](_0x58bd4d);};}exports[_0x23a3('0x2a')]=function(_0x39b1d9,_0x3e4dd8){var _0x3b4334={},_0x2051f9={},_0x12ed1c={'count':0x0,'rows':[]};var _0x46d535=_['map'](db['Migration'][_0x23a3('0x2b')],function(_0x430a11){return{'name':_0x430a11['fieldName'],'type':_0x430a11[_0x23a3('0x2c')]['key']};});_0x2051f9[_0x23a3('0x2d')]=_[_0x23a3('0x2e')](_0x46d535,_0x23a3('0x29'));_0x2051f9['query']=_[_0x23a3('0x2f')](_0x39b1d9[_0x23a3('0x30')]);_0x2051f9[_0x23a3('0x31')]=_['intersection'](_0x2051f9[_0x23a3('0x2d')],_0x2051f9[_0x23a3('0x30')]);_0x3b4334['attributes']=_[_0x23a3('0x32')](_0x2051f9['model'],qs[_0x23a3('0x33')](_0x39b1d9[_0x23a3('0x30')][_0x23a3('0x33')]));_0x3b4334[_0x23a3('0x34')]=_0x3b4334[_0x23a3('0x34')]['length']?_0x3b4334[_0x23a3('0x34')]:_0x2051f9[_0x23a3('0x2d')];if(!_0x39b1d9[_0x23a3('0x30')][_0x23a3('0x35')](_0x23a3('0x36'))){_0x3b4334[_0x23a3('0x1f')]=qs[_0x23a3('0x1f')](_0x39b1d9[_0x23a3('0x30')][_0x23a3('0x1f')]);_0x3b4334[_0x23a3('0x1d')]=qs['offset'](_0x39b1d9[_0x23a3('0x30')][_0x23a3('0x1d')]);}_0x3b4334[_0x23a3('0x37')]=qs['sort'](_0x39b1d9[_0x23a3('0x30')][_0x23a3('0x38')]);_0x3b4334[_0x23a3('0x39')]=qs['filters'](_['pick'](_0x39b1d9[_0x23a3('0x30')],_0x2051f9[_0x23a3('0x31')]),_0x46d535);if(_0x39b1d9['query'][_0x23a3('0x3a')]){_0x3b4334[_0x23a3('0x39')]=_['merge'](_0x3b4334[_0x23a3('0x39')],{'$or':_[_0x23a3('0x2e')](_0x46d535,function(_0x3e35cb){if(_0x3e35cb[_0x23a3('0x2c')]!=='VIRTUAL'){var _0x48a1db={};_0x48a1db[_0x3e35cb['name']]={'$like':'%'+_0x39b1d9[_0x23a3('0x30')][_0x23a3('0x3a')]+'%'};return _0x48a1db;}})});}_0x3b4334=_[_0x23a3('0x3b')]({},_0x3b4334,_0x39b1d9[_0x23a3('0x3c')]);var _0x2279b6={'where':_0x3b4334[_0x23a3('0x39')]};return db['Migration'][_0x23a3('0x20')](_0x2279b6)[_0x23a3('0x26')](function(_0x4b648b){_0x12ed1c[_0x23a3('0x20')]=_0x4b648b;if(_0x39b1d9[_0x23a3('0x30')][_0x23a3('0x3d')]){_0x3b4334[_0x23a3('0x3e')]=[{'all':!![]}];}return db[_0x23a3('0x3f')]['findAll'](_0x3b4334);})[_0x23a3('0x26')](function(_0x10a353){_0x12ed1c[_0x23a3('0x40')]=_0x10a353;return _0x12ed1c;})['then'](respondWithFilteredResult(_0x3e4dd8,_0x3b4334))[_0x23a3('0x41')](handleError(_0x3e4dd8,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 7c39bfe..4c7f326 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 _0xb6f0=['api','moment','request-promise','path','../../config/environment','./migration.attributes','exports','Migration','migrations','lodash','util'];(function(_0x99055,_0x278b06){var _0x5edbec=function(_0x14fa9d){while(--_0x14fa9d){_0x99055['push'](_0x99055['shift']());}};_0x5edbec(++_0x278b06);}(_0xb6f0,0x8d));var _0x0b6f=function(_0x123d3d,_0x114ea5){_0x123d3d=_0x123d3d-0x0;var _0x5707bf=_0xb6f0[_0x123d3d];return _0x5707bf;};'use strict';var _=require(_0x0b6f('0x0'));var util=require(_0x0b6f('0x1'));var logger=require('../../config/logger')(_0x0b6f('0x2'));var moment=require(_0x0b6f('0x3'));var BPromise=require('bluebird');var rp=require(_0x0b6f('0x4'));var fs=require('fs');var path=require(_0x0b6f('0x5'));var rimraf=require('rimraf');var config=require(_0x0b6f('0x6'));var attributes=require(_0x0b6f('0x7'));module[_0x0b6f('0x8')]=function(_0x570749,_0x348a24){return _0x570749['define'](_0x0b6f('0x9'),attributes,{'tableName':_0x0b6f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2f5=['path','rimraf','../../config/environment','./migration.attributes','exports','Migration','migrations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5e848d,_0x1dbd20){var _0x3785e5=function(_0xc82b39){while(--_0xc82b39){_0x5e848d['push'](_0x5e848d['shift']());}};_0x3785e5(++_0x1dbd20);}(_0xc2f5,0xd7));var _0x5c2f=function(_0x47d1d,_0x21feb6){_0x47d1d=_0x47d1d-0x0;var _0x47ce4e=_0xc2f5[_0x47d1d];return _0x47ce4e;};'use strict';var _=require(_0x5c2f('0x0'));var util=require(_0x5c2f('0x1'));var logger=require(_0x5c2f('0x2'))(_0x5c2f('0x3'));var moment=require(_0x5c2f('0x4'));var BPromise=require('bluebird');var rp=require(_0x5c2f('0x5'));var fs=require('fs');var path=require(_0x5c2f('0x6'));var rimraf=require(_0x5c2f('0x7'));var config=require(_0x5c2f('0x8'));var attributes=require(_0x5c2f('0x9'));module[_0x5c2f('0xa')]=function(_0xff34a7,_0x1133b7){return _0xff34a7['define'](_0x5c2f('0xb'),attributes,{'tableName':_0x5c2f('0xc'),'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 779c47c..ca83d1b 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 _0x705f=['result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x220b5e,_0xd1907){var _0x3abc14=function(_0x5366ea){while(--_0x5366ea){_0x220b5e['push'](_0x220b5e['shift']());}};_0x3abc14(++_0xd1907);}(_0x705f,0x75));var _0xf705=function(_0x496e54,_0x575c5d){_0x496e54=_0x496e54-0x0;var _0x41ab42=_0x705f[_0x496e54];return _0x41ab42;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf705('0x0'));var BPromise=require('bluebird');var rs=require(_0xf705('0x1'));var fs=require('fs');var Redis=require(_0xf705('0x2'));var db=require(_0xf705('0x3'))['db'];var utils=require(_0xf705('0x4'));var logger=require(_0xf705('0x5'))(_0xf705('0x6'));var config=require(_0xf705('0x7'));var jayson=require(_0xf705('0x8'));var client=jayson[_0xf705('0x9')][_0xf705('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32c99d,_0x48eb92,_0x51fda8){return new BPromise(function(_0xc244e3,_0x58cae9){return client[_0xf705('0xb')](_0x32c99d,_0x51fda8)[_0xf705('0xc')](function(_0x4f3226){logger['info'](_0xf705('0xd'),_0x48eb92,_0xf705('0xe'));logger[_0xf705('0xf')](_0xf705('0x10'),_0x48eb92,_0xf705('0xe'),JSON[_0xf705('0x11')](_0x4f3226));if(_0x4f3226[_0xf705('0x12')]){if(_0x4f3226[_0xf705('0x12')]['code']===0x1f4){logger[_0xf705('0x12')](_0xf705('0xd'),_0x48eb92,_0x4f3226[_0xf705('0x12')][_0xf705('0x13')]);return _0x58cae9(_0x4f3226[_0xf705('0x12')]['message']);}logger['error'](_0xf705('0xd'),_0x48eb92,_0x4f3226[_0xf705('0x12')][_0xf705('0x13')]);return _0xc244e3(_0x4f3226[_0xf705('0x12')]['message']);}else{logger[_0xf705('0x14')](_0xf705('0xd'),_0x48eb92,_0xf705('0xe'));_0xc244e3(_0x4f3226[_0xf705('0x15')]['message']);}})[_0xf705('0x16')](function(_0x479b31){logger[_0xf705('0x12')](_0xf705('0xd'),_0x48eb92,_0x479b31);_0x58cae9(_0x479b31);});});} \ No newline at end of file +var _0xa74d=['result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xa74d,0x1cf));var _0xda74=function(_0x483e1d,_0xfeab58){_0x483e1d=_0x483e1d-0x0;var _0x10cd26=_0xa74d[_0x483e1d];return _0x10cd26;};'use strict';var _=require('lodash');var util=require(_0xda74('0x0'));var moment=require(_0xda74('0x1'));var BPromise=require(_0xda74('0x2'));var rs=require(_0xda74('0x3'));var fs=require('fs');var Redis=require(_0xda74('0x4'));var db=require(_0xda74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xda74('0x6'))(_0xda74('0x7'));var config=require(_0xda74('0x8'));var jayson=require(_0xda74('0x9'));var client=jayson[_0xda74('0xa')][_0xda74('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2113f2,_0x3fa4e7,_0x5da443){return new BPromise(function(_0x23d5f5,_0x517251){return client['request'](_0x2113f2,_0x5da443)[_0xda74('0xc')](function(_0x411790){logger['info'](_0xda74('0xd'),_0x3fa4e7,_0xda74('0xe'));logger[_0xda74('0xf')](_0xda74('0x10'),_0x3fa4e7,_0xda74('0xe'),JSON[_0xda74('0x11')](_0x411790));if(_0x411790[_0xda74('0x12')]){if(_0x411790[_0xda74('0x12')]['code']===0x1f4){logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x411790[_0xda74('0x12')]['message']);return _0x517251(_0x411790[_0xda74('0x12')][_0xda74('0x13')]);}logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x411790[_0xda74('0x12')][_0xda74('0x13')]);return _0x23d5f5(_0x411790[_0xda74('0x12')]['message']);}else{logger[_0xda74('0x14')](_0xda74('0xd'),_0x3fa4e7,_0xda74('0xe'));_0x23d5f5(_0x411790[_0xda74('0x15')][_0xda74('0x13')]);}})['catch'](function(_0x1535d3){logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x1535d3);_0x517251(_0x1535d3);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index f65fea4..e2bc4aa 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 _0x6455=['index','/:id','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6455,0x97));var _0x5645=function(_0x18d446,_0x2577e6){_0x18d446=_0x18d446-0x0;var _0x51f113=_0x6455[_0x18d446];return _0x51f113;};'use strict';var multer=require(_0x5645('0x0'));var util=require('util');var path=require(_0x5645('0x1'));var timeout=require(_0x5645('0x2'));var express=require(_0x5645('0x3'));var router=express[_0x5645('0x4')]();var fs_extra=require(_0x5645('0x5'));var auth=require(_0x5645('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5645('0x7'));var controller=require(_0x5645('0x8'));router[_0x5645('0x9')]('/',auth[_0x5645('0xa')](),controller[_0x5645('0xb')]);router[_0x5645('0x9')](_0x5645('0xc'),auth[_0x5645('0xa')](),controller['show']);router['post']('/',auth[_0x5645('0xa')](),controller[_0x5645('0xd')]);router[_0x5645('0xe')](_0x5645('0xc'),auth[_0x5645('0xa')](),controller[_0x5645('0xf')]);router['delete'](_0x5645('0xc'),auth[_0x5645('0xa')](),controller[_0x5645('0x10')]);module[_0x5645('0x11')]=router; \ No newline at end of file +var _0x85e6=['show','post','create','/:id','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','isAuthenticated','index','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85e6,0x1a5));var _0x685e=function(_0x104dfa,_0x5bd273){_0x104dfa=_0x104dfa-0x0;var _0x12ee10=_0x85e6[_0x104dfa];return _0x12ee10;};'use strict';var multer=require(_0x685e('0x0'));var util=require(_0x685e('0x1'));var path=require('path');var timeout=require(_0x685e('0x2'));var express=require(_0x685e('0x3'));var router=express['Router']();var fs_extra=require(_0x685e('0x4'));var auth=require(_0x685e('0x5'));var interaction=require(_0x685e('0x6'));var config=require('../../config/environment');var controller=require(_0x685e('0x7'));router['get']('/',auth[_0x685e('0x8')](),controller[_0x685e('0x9')]);router[_0x685e('0xa')]('/:id',auth[_0x685e('0x8')](),controller[_0x685e('0xb')]);router[_0x685e('0xc')]('/',auth[_0x685e('0x8')](),controller[_0x685e('0xd')]);router['put'](_0x685e('0xe'),auth['isAuthenticated'](),controller[_0x685e('0xf')]);router['delete'](_0x685e('0xe'),auth[_0x685e('0x8')](),controller[_0x685e('0x10')]);module[_0x685e('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 22f804c..d4df522 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 _0x80f1=['exports','ENUM','localnet','externip','stun','turn','STRING','sequelize'];(function(_0x14f132,_0x4cf31e){var _0x24bf39=function(_0x10ddad){while(--_0x10ddad){_0x14f132['push'](_0x14f132['shift']());}};_0x24bf39(++_0x4cf31e);}(_0x80f1,0x1c7));var _0x180f=function(_0x2fd23a,_0x1575db){_0x2fd23a=_0x2fd23a-0x0;var _0xcf317a=_0x80f1[_0x2fd23a];return _0xcf317a;};'use strict';var Sequelize=require(_0x180f('0x0'));module[_0x180f('0x1')]={'type':{'type':Sequelize[_0x180f('0x2')](_0x180f('0x3'),_0x180f('0x4'),_0x180f('0x5'),_0x180f('0x6'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x180f('0x7')]},'password':{'type':Sequelize[_0x180f('0x7')]}}; \ No newline at end of file +var _0x14a9=['ENUM','localnet','externip','stun','turn','STRING','exports'];(function(_0x49f432,_0x70af7){var _0x5928df=function(_0x4c2484){while(--_0x4c2484){_0x49f432['push'](_0x49f432['shift']());}};_0x5928df(++_0x70af7);}(_0x14a9,0x164));var _0x914a=function(_0x3ab16e,_0x5bafcb){_0x3ab16e=_0x3ab16e-0x0;var _0x218b01=_0x14a9[_0x3ab16e];return _0x218b01;};'use strict';var Sequelize=require('sequelize');module[_0x914a('0x0')]={'type':{'type':Sequelize[_0x914a('0x1')](_0x914a('0x2'),_0x914a('0x3'),_0x914a('0x4'),_0x914a('0x5'))},'value':{'type':Sequelize[_0x914a('0x6')]},'username':{'type':Sequelize[_0x914a('0x6')]},'password':{'type':Sequelize[_0x914a('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 811fa5d..cc535cc 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 _0xe009=['http','request','info','Network,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','Network','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','keys','rawAttributes','options','create','transaction','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','utf8','toLowerCase','chan_sip.so','sequelize','find','params','format','/etc/asterisk/sip_xcally_%s.conf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise'];(function(_0x3a5271,_0xa54414){var _0x2208f4=function(_0x390f70){while(--_0x390f70){_0x3a5271['push'](_0x3a5271['shift']());}};_0x2208f4(++_0xa54414);}(_0xe009,0x122));var _0x9e00=function(_0x3ba63f,_0xf4c186){_0x3ba63f=_0x3ba63f-0x0;var _0xfdf497=_0xe009[_0x3ba63f];return _0xfdf497;};'use strict';var emlformat=require(_0x9e00('0x0'));var rimraf=require(_0x9e00('0x1'));var zipdir=require(_0x9e00('0x2'));var jsonpatch=require(_0x9e00('0x3'));var rp=require('request-promise');var moment=require(_0x9e00('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9e00('0x5'));var util=require(_0x9e00('0x6'));var path=require(_0x9e00('0x7'));var sox=require(_0x9e00('0x8'));var csv=require(_0x9e00('0x9'));var ejs=require(_0x9e00('0xa'));var fs=require('fs');var fs_extra=require(_0x9e00('0xb'));var _=require(_0x9e00('0xc'));var squel=require(_0x9e00('0xd'));var crypto=require(_0x9e00('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9e00('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9e00('0x10'));var Redis=require(_0x9e00('0x11'));var authService=require(_0x9e00('0x12'));var qs=require(_0x9e00('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e00('0x14'));var logger=require(_0x9e00('0x15'))(_0x9e00('0x16'));var utils=require('../../config/utils');var config=require(_0x9e00('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x9e00('0x18'));var client=jayson['client'][_0x9e00('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3b1960,_0x1d2d17,_0x344c3e,_0x175e7d){return new BPromise(function(_0x40b563,_0x580f5c){var _0x5d7a77=_0x175e7d||client;return _0x5d7a77[_0x9e00('0x1a')](_0x3b1960,_0x344c3e)['then'](function(_0x10df77){logger[_0x9e00('0x1b')](_0x9e00('0x1c'),_0x1d2d17,_0x9e00('0x1d'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x1d2d17,'request\x20sent',JSON['stringify'](_0x10df77));if(_0x10df77[_0x9e00('0x1e')]){if(_0x10df77['error'][_0x9e00('0x1f')]===0x1f4){logger[_0x9e00('0x1e')]('Network,\x20%s,\x20%s',_0x1d2d17,_0x10df77[_0x9e00('0x1e')][_0x9e00('0x20')]);return _0x580f5c(_0x10df77[_0x9e00('0x1e')][_0x9e00('0x20')]);}logger[_0x9e00('0x1e')](_0x9e00('0x1c'),_0x1d2d17,_0x10df77[_0x9e00('0x1e')][_0x9e00('0x20')]);return _0x40b563(_0x10df77['error']['message']);}else{logger[_0x9e00('0x1b')](_0x9e00('0x1c'),_0x1d2d17,_0x9e00('0x1d'));_0x40b563(_0x10df77['result'][_0x9e00('0x20')]);}})[_0x9e00('0x21')](function(_0x355ed8){logger['error'](_0x9e00('0x1c'),_0x1d2d17,_0x355ed8);_0x580f5c(_0x355ed8);});});}function respondWithStatusCode(_0x4008f9,_0x18fac5){_0x18fac5=_0x18fac5||0xcc;return function(_0x781601){if(_0x781601){return _0x4008f9[_0x9e00('0x22')](_0x18fac5);}return _0x4008f9[_0x9e00('0x23')](_0x18fac5)[_0x9e00('0x24')]();};}function respondWithResult(_0x741ba2,_0x2a1113){_0x2a1113=_0x2a1113||0xc8;return function(_0x418f8a){if(_0x418f8a){return _0x741ba2[_0x9e00('0x23')](_0x2a1113)[_0x9e00('0x25')](_0x418f8a);}};}function respondWithFilteredResult(_0x232bcf,_0x4b9097){return function(_0x831f2b){if(_0x831f2b){var _0x249fe0=typeof _0x4b9097[_0x9e00('0x26')]===_0x9e00('0x27')&&typeof _0x4b9097[_0x9e00('0x28')]==='undefined';var _0x5659c5=_0x831f2b['count'];var _0x418d06=_0x249fe0?0x0:_0x4b9097[_0x9e00('0x26')];var _0x351b30=_0x249fe0?_0x831f2b[_0x9e00('0x29')]:_0x4b9097['offset']+_0x4b9097[_0x9e00('0x28')];var _0x1a8b14;if(_0x351b30>=_0x5659c5){_0x351b30=_0x5659c5;_0x1a8b14=0xc8;}else{_0x1a8b14=0xce;}_0x232bcf[_0x9e00('0x23')](_0x1a8b14);return _0x232bcf['set'](_0x9e00('0x2a'),_0x418d06+'-'+_0x351b30+'/'+_0x5659c5)[_0x9e00('0x25')](_0x831f2b);}return null;};}function patchUpdates(_0x315882){return function(_0x26ecf0){try{jsonpatch[_0x9e00('0x2b')](_0x26ecf0,_0x315882,!![]);}catch(_0x2291ef){return BPromise[_0x9e00('0x2c')](_0x2291ef);}return _0x26ecf0[_0x9e00('0x2d')]();};}function saveUpdates(_0x50da18,_0x506dad){return function(_0x36fa66){if(_0x36fa66){return _0x36fa66[_0x9e00('0x2e')](_0x50da18)[_0x9e00('0x2f')](function(_0x160ad8){return _0x160ad8;});}return null;};}function removeEntity(_0x225caa,_0x26c99b){return function(_0x3a08cc){if(_0x3a08cc){return _0x3a08cc[_0x9e00('0x30')]()['then'](function(){_0x225caa[_0x9e00('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x154eeb,_0xe0421e){return function(_0x35d778){if(!_0x35d778){_0x154eeb[_0x9e00('0x22')](0x194);}return _0x35d778;};}function handleError(_0xf3ab01,_0x4bf063){_0x4bf063=_0x4bf063||0x1f4;return function(_0x28701a){logger['error'](_0x28701a['stack']);if(_0x28701a[_0x9e00('0x31')]){delete _0x28701a['name'];}_0xf3ab01['status'](_0x4bf063)[_0x9e00('0x32')](_0x28701a);};}exports[_0x9e00('0x33')]=function(_0x33b80e,_0x5c8329){var _0x7df394={},_0x33389d={},_0x1e638d={'count':0x0,'rows':[]};var _0x1fe6f6=_[_0x9e00('0x34')](db[_0x9e00('0x35')]['rawAttributes'],function(_0x58f6b5){return{'name':_0x58f6b5[_0x9e00('0x36')],'type':_0x58f6b5[_0x9e00('0x37')][_0x9e00('0x38')]};});_0x33389d['model']=_[_0x9e00('0x34')](_0x1fe6f6,'name');_0x33389d[_0x9e00('0x39')]=_['keys'](_0x33b80e[_0x9e00('0x39')]);_0x33389d[_0x9e00('0x3a')]=_['intersection'](_0x33389d[_0x9e00('0x3b')],_0x33389d[_0x9e00('0x39')]);_0x7df394[_0x9e00('0x3c')]=_[_0x9e00('0x3d')](_0x33389d[_0x9e00('0x3b')],qs[_0x9e00('0x3e')](_0x33b80e[_0x9e00('0x39')][_0x9e00('0x3e')]));_0x7df394['attributes']=_0x7df394[_0x9e00('0x3c')]['length']?_0x7df394['attributes']:_0x33389d['model'];if(!_0x33b80e['query'][_0x9e00('0x3f')](_0x9e00('0x40'))){_0x7df394[_0x9e00('0x28')]=qs[_0x9e00('0x28')](_0x33b80e[_0x9e00('0x39')]['limit']);_0x7df394['offset']=qs[_0x9e00('0x26')](_0x33b80e[_0x9e00('0x39')][_0x9e00('0x26')]);}_0x7df394[_0x9e00('0x41')]=qs[_0x9e00('0x42')](_0x33b80e['query'][_0x9e00('0x42')]);_0x7df394[_0x9e00('0x43')]=qs['filters'](_[_0x9e00('0x44')](_0x33b80e[_0x9e00('0x39')],_0x33389d[_0x9e00('0x3a')]),_0x1fe6f6);if(_0x33b80e[_0x9e00('0x39')][_0x9e00('0x45')]){_0x7df394[_0x9e00('0x43')]=_['merge'](_0x7df394['where'],{'$or':_[_0x9e00('0x34')](_0x1fe6f6,function(_0x2feee1){if(_0x2feee1[_0x9e00('0x37')]!==_0x9e00('0x46')){var _0x2fc1b7={};_0x2fc1b7[_0x2feee1[_0x9e00('0x31')]]={'$like':'%'+_0x33b80e[_0x9e00('0x39')][_0x9e00('0x45')]+'%'};return _0x2fc1b7;}})});}_0x7df394=_[_0x9e00('0x47')]({},_0x7df394,_0x33b80e['options']);var _0x14663d={'where':_0x7df394[_0x9e00('0x43')]};return db[_0x9e00('0x35')][_0x9e00('0x29')](_0x14663d)[_0x9e00('0x2f')](function(_0x4ca8ce){_0x1e638d['count']=_0x4ca8ce;if(_0x33b80e[_0x9e00('0x39')][_0x9e00('0x48')]){_0x7df394[_0x9e00('0x49')]=[{'all':!![]}];}return db[_0x9e00('0x35')][_0x9e00('0x4a')](_0x7df394);})[_0x9e00('0x2f')](function(_0x47c646){_0x1e638d[_0x9e00('0x4b')]=_0x47c646;return _0x1e638d;})[_0x9e00('0x2f')](respondWithFilteredResult(_0x5c8329,_0x7df394))[_0x9e00('0x21')](handleError(_0x5c8329,null));};exports['show']=function(_0x24199a,_0x555db9){var _0x41bd72={'raw':!![],'where':{'id':_0x24199a['params']['id']}},_0x12dc78={};_0x12dc78[_0x9e00('0x3b')]=_[_0x9e00('0x4c')](db['Network'][_0x9e00('0x4d')]);_0x12dc78['query']=_[_0x9e00('0x4c')](_0x24199a['query']);_0x12dc78[_0x9e00('0x3a')]=_[_0x9e00('0x3d')](_0x12dc78[_0x9e00('0x3b')],_0x12dc78[_0x9e00('0x39')]);_0x41bd72['attributes']=_['intersection'](_0x12dc78[_0x9e00('0x3b')],qs['fields'](_0x24199a[_0x9e00('0x39')][_0x9e00('0x3e')]));_0x41bd72[_0x9e00('0x3c')]=_0x41bd72['attributes']['length']?_0x41bd72[_0x9e00('0x3c')]:_0x12dc78[_0x9e00('0x3b')];if(_0x24199a['query']['includeAll']){_0x41bd72['include']=[{'all':!![]}];}_0x41bd72=_[_0x9e00('0x47')]({},_0x41bd72,_0x24199a[_0x9e00('0x4e')]);return db[_0x9e00('0x35')]['find'](_0x41bd72)[_0x9e00('0x2f')](handleEntityNotFound(_0x555db9,null))[_0x9e00('0x2f')](respondWithResult(_0x555db9,null))[_0x9e00('0x21')](handleError(_0x555db9,null));};exports[_0x9e00('0x4f')]=function(_0x4e5815,_0x8d3e90,_0x5e42b2){var _0x5d2ca9;return db['sequelize'][_0x9e00('0x50')](function(_0x57b852){return db[_0x9e00('0x35')][_0x9e00('0x4f')](_0x4e5815[_0x9e00('0x51')],{'raw':!![]})[_0x9e00('0x2f')](function(_0xc4795a){_0x5d2ca9=_0xc4795a;return db[_0x9e00('0x35')][_0x9e00('0x4a')]({'where':{'type':_0x4e5815[_0x9e00('0x51')][_0x9e00('0x37')]},'raw':!![]});})['then'](function(_0x81d797){if(_0x5d2ca9[_0x9e00('0x37')][_0x9e00('0x52')]()==_0x9e00('0x53')){var _0x48170b=fs[_0x9e00('0x54')](path[_0x9e00('0x55')](config['root'],_0x9e00('0x56')),'utf8');var _0x2310ca=ejs[_0x9e00('0x57')](_0x48170b,{'networks':_0x81d797||[]});fs[_0x9e00('0x58')](_0x9e00('0x59'),_0x2310ca);return respondWithRpcPromise(_0x9e00('0x5a'),_0x9e00('0x4f'),{'module':_0x9e00('0x5b')});}else if(_0x5d2ca9[_0x9e00('0x37')][_0x9e00('0x52')]()==_0x9e00('0x5c')){var _0x190820=fs[_0x9e00('0x54')](path[_0x9e00('0x55')](config[_0x9e00('0x5d')],_0x9e00('0x5e')),'utf8');var _0x5c245e=ejs['render'](_0x190820,{'networks':_0x81d797||[]});fs['writeFileSync'](_0x9e00('0x5f'),_0x5c245e);return respondWithRpcPromise('Reload',_0x9e00('0x4f'),{'module':_0x9e00('0x5b')});}else{var _0x1fb027=fs[_0x9e00('0x54')](path[_0x9e00('0x55')](config[_0x9e00('0x5d')],_0x9e00('0x60')),_0x9e00('0x61'));var _0x5b9ac6=ejs[_0x9e00('0x57')](_0x1fb027,{'networks':_0x81d797||[]});fs[_0x9e00('0x58')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x4e5815['body'][_0x9e00('0x37')][_0x9e00('0x62')]()),_0x5b9ac6);return respondWithRpcPromise('Reload',_0x9e00('0x4f'),{'module':_0x9e00('0x63')});}return null;})['then'](function(){return _0x5d2ca9;});})[_0x9e00('0x2f')](respondWithResult(_0x8d3e90,0xc9))[_0x9e00('0x21')](handleError(_0x8d3e90,null));};exports['update']=function(_0x34e00d,_0x5d5068,_0x1412c8){var _0x4cfbd8;return db[_0x9e00('0x64')][_0x9e00('0x50')](function(_0xe9d90d){return db[_0x9e00('0x35')][_0x9e00('0x65')]({'where':{'id':_0x34e00d[_0x9e00('0x66')]['id']}})[_0x9e00('0x2f')](handleEntityNotFound(_0x5d5068,null))['then'](saveUpdates(_0x34e00d[_0x9e00('0x51')],null))['then'](function(_0x33b158){if(_0x33b158){_0x4cfbd8=_0x33b158;return db[_0x9e00('0x35')]['findAll']({'where':{'type':_0x4cfbd8[_0x9e00('0x37')]},'raw':!![]});}return null;})[_0x9e00('0x2f')](function(_0x4bb86c){if(_0x4cfbd8[_0x9e00('0x37')][_0x9e00('0x52')]()==_0x9e00('0x53')){var _0x358bd1=fs['readFileSync'](path[_0x9e00('0x55')](config['root'],_0x9e00('0x56')),'utf8');var _0x379282=ejs['render'](_0x358bd1,{'networks':_0x4bb86c||[]});fs['writeFileSync'](_0x9e00('0x59'),_0x379282);return respondWithRpcPromise(_0x9e00('0x5a'),_0x9e00('0x2e'),{'module':_0x9e00('0x5b')});}else if(_0x4cfbd8[_0x9e00('0x37')]['toUpperCase']()==_0x9e00('0x5c')){var _0x39a6fd=fs['readFileSync'](path['join'](config[_0x9e00('0x5d')],_0x9e00('0x5e')),'utf8');var _0x4d6633=ejs[_0x9e00('0x57')](_0x39a6fd,{'networks':_0x4bb86c||[]});fs[_0x9e00('0x58')](_0x9e00('0x5f'),_0x4d6633);return respondWithRpcPromise(_0x9e00('0x5a'),_0x9e00('0x2e'),{'module':_0x9e00('0x5b')});}else{var _0x11cb14=fs[_0x9e00('0x54')](path[_0x9e00('0x55')](config['root'],_0x9e00('0x60')),_0x9e00('0x61'));var _0x6cba91=ejs[_0x9e00('0x57')](_0x11cb14,{'networks':_0x4bb86c||[]});fs['writeFileSync'](util[_0x9e00('0x67')](_0x9e00('0x68'),_0x34e00d[_0x9e00('0x51')][_0x9e00('0x37')][_0x9e00('0x62')]()),_0x6cba91);return respondWithRpcPromise('Reload',_0x9e00('0x2e'),{'module':_0x9e00('0x63')});}return null;})['then'](function(_0x25474b){if(_0x25474b){return _0x4cfbd8;}return null;});})[_0x9e00('0x2f')](respondWithResult(_0x5d5068,null))['catch'](handleError(_0x5d5068,null));};exports[_0x9e00('0x30')]=function(_0x3a8f50,_0x538d22,_0x26b321){var _0x4f7bae;return db[_0x9e00('0x35')][_0x9e00('0x65')]({'where':{'id':_0x3a8f50[_0x9e00('0x66')]['id']}})['then'](function(_0x1d4baa){_0x4f7bae=_0x1d4baa;return _0x1d4baa;})[_0x9e00('0x2f')](handleEntityNotFound(_0x538d22,null))[_0x9e00('0x2f')](removeEntity(_0x538d22,null))[_0x9e00('0x2f')](function(){if(_0x4f7bae){return db[_0x9e00('0x35')][_0x9e00('0x4a')]({'where':{'type':_0x4f7bae['type']},'raw':!![]});}})[_0x9e00('0x2f')](function(_0x353a56){if(_0x4f7bae[_0x9e00('0x37')][_0x9e00('0x52')]()==_0x9e00('0x53')){var _0x1e1f0e=fs[_0x9e00('0x54')](path[_0x9e00('0x55')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x9e00('0x61'));var _0x396a1d=ejs[_0x9e00('0x57')](_0x1e1f0e,{'networks':_0x353a56||[]});fs['writeFileSync'](_0x9e00('0x59'),_0x396a1d);return respondWithRpcPromise(_0x9e00('0x5a'),'destroy',{'module':_0x9e00('0x5b')});}else if(_0x4f7bae[_0x9e00('0x37')][_0x9e00('0x52')]()=='TURN'){var _0x1924c0=fs[_0x9e00('0x54')](path[_0x9e00('0x55')](config[_0x9e00('0x5d')],'server/files/templates/turn_multiple.ejs'),_0x9e00('0x61'));var _0x2ba821=ejs[_0x9e00('0x57')](_0x1924c0,{'networks':_0x353a56||[]});fs['writeFileSync'](_0x9e00('0x5f'),_0x2ba821);return respondWithRpcPromise('Reload','destroy',{'module':_0x9e00('0x5b')});}else{var _0x26af74=fs[_0x9e00('0x54')](path[_0x9e00('0x55')](config[_0x9e00('0x5d')],_0x9e00('0x60')),_0x9e00('0x61'));var _0x19ee47=ejs[_0x9e00('0x57')](_0x26af74,{'networks':_0x353a56||[]});fs[_0x9e00('0x58')](util['format'](_0x9e00('0x68'),_0x3a8f50['body'][_0x9e00('0x37')][_0x9e00('0x62')]()),_0x19ee47);return respondWithRpcPromise(_0x9e00('0x5a'),'destroy',{'module':_0x9e00('0x63')});}return null;})['catch'](handleError(_0x538d22,null));}; \ No newline at end of file +var _0x1828=['catch','sendStatus','status','end','json','limit','undefined','offset','count','set','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','include','Network','findAll','rows','show','params','find','create','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','sequelize','STUN','toLowerCase','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x1828,0xb0));var _0x8182=function(_0x4d31ac,_0x1c3169){_0x4d31ac=_0x4d31ac-0x0;var _0x75d8a9=_0x1828[_0x4d31ac];return _0x75d8a9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8182('0x0'));var jsonpatch=require(_0x8182('0x1'));var rp=require(_0x8182('0x2'));var moment=require(_0x8182('0x3'));var BPromise=require(_0x8182('0x4'));var Mustache=require('mustache');var util=require(_0x8182('0x5'));var path=require(_0x8182('0x6'));var sox=require(_0x8182('0x7'));var csv=require(_0x8182('0x8'));var ejs=require(_0x8182('0x9'));var fs=require('fs');var fs_extra=require(_0x8182('0xa'));var _=require(_0x8182('0xb'));var squel=require(_0x8182('0xc'));var crypto=require(_0x8182('0xd'));var jsforce=require(_0x8182('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8182('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8182('0xf'));var authService=require(_0x8182('0x10'));var qs=require(_0x8182('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8182('0x12'))(_0x8182('0x13'));var utils=require(_0x8182('0x14'));var config=require(_0x8182('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x8182('0x16'));var client=jayson['client'][_0x8182('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x37ba55,_0x2ad0d7,_0xc19afd,_0x2052fa){return new BPromise(function(_0x3e5ebe,_0x1796ba){var _0x5d34f5=_0x2052fa||client;return _0x5d34f5[_0x8182('0x18')](_0x37ba55,_0xc19afd)[_0x8182('0x19')](function(_0x5f46ff){logger[_0x8182('0x1a')](_0x8182('0x1b'),_0x2ad0d7,_0x8182('0x1c'));logger[_0x8182('0x1d')](_0x8182('0x1e'),_0x2ad0d7,'request\x20sent',JSON[_0x8182('0x1f')](_0x5f46ff));if(_0x5f46ff['error']){if(_0x5f46ff[_0x8182('0x20')][_0x8182('0x21')]===0x1f4){logger[_0x8182('0x20')](_0x8182('0x1b'),_0x2ad0d7,_0x5f46ff[_0x8182('0x20')][_0x8182('0x22')]);return _0x1796ba(_0x5f46ff[_0x8182('0x20')][_0x8182('0x22')]);}logger['error'](_0x8182('0x1b'),_0x2ad0d7,_0x5f46ff[_0x8182('0x20')][_0x8182('0x22')]);return _0x3e5ebe(_0x5f46ff[_0x8182('0x20')]['message']);}else{logger[_0x8182('0x1a')](_0x8182('0x1b'),_0x2ad0d7,_0x8182('0x1c'));_0x3e5ebe(_0x5f46ff[_0x8182('0x23')][_0x8182('0x22')]);}})[_0x8182('0x24')](function(_0x3a66a5){logger['error'](_0x8182('0x1b'),_0x2ad0d7,_0x3a66a5);_0x1796ba(_0x3a66a5);});});}function respondWithStatusCode(_0x2bfd11,_0x51712f){_0x51712f=_0x51712f||0xcc;return function(_0x25cc49){if(_0x25cc49){return _0x2bfd11[_0x8182('0x25')](_0x51712f);}return _0x2bfd11[_0x8182('0x26')](_0x51712f)[_0x8182('0x27')]();};}function respondWithResult(_0x5afd59,_0x2e09a1){_0x2e09a1=_0x2e09a1||0xc8;return function(_0x22ef08){if(_0x22ef08){return _0x5afd59[_0x8182('0x26')](_0x2e09a1)[_0x8182('0x28')](_0x22ef08);}};}function respondWithFilteredResult(_0xe91e62,_0x295cc5){return function(_0x2eae3f){if(_0x2eae3f){var _0x20bb6c=typeof _0x295cc5['offset']==='undefined'&&typeof _0x295cc5[_0x8182('0x29')]===_0x8182('0x2a');var _0x4f7f96=_0x2eae3f['count'];var _0x4744f5=_0x20bb6c?0x0:_0x295cc5[_0x8182('0x2b')];var _0x5c8903=_0x20bb6c?_0x2eae3f[_0x8182('0x2c')]:_0x295cc5[_0x8182('0x2b')]+_0x295cc5['limit'];var _0x240d54;if(_0x5c8903>=_0x4f7f96){_0x5c8903=_0x4f7f96;_0x240d54=0xc8;}else{_0x240d54=0xce;}_0xe91e62['status'](_0x240d54);return _0xe91e62[_0x8182('0x2d')]('Content-Range',_0x4744f5+'-'+_0x5c8903+'/'+_0x4f7f96)[_0x8182('0x28')](_0x2eae3f);}return null;};}function patchUpdates(_0x5ac94f){return function(_0x2059f4){try{jsonpatch['apply'](_0x2059f4,_0x5ac94f,!![]);}catch(_0xfc8862){return BPromise[_0x8182('0x2e')](_0xfc8862);}return _0x2059f4[_0x8182('0x2f')]();};}function saveUpdates(_0x5efedf,_0x2804a6){return function(_0x31fff9){if(_0x31fff9){return _0x31fff9[_0x8182('0x30')](_0x5efedf)[_0x8182('0x19')](function(_0x7bda3e){return _0x7bda3e;});}return null;};}function removeEntity(_0x4c9b77,_0x1ecf41){return function(_0x26fd47){if(_0x26fd47){return _0x26fd47[_0x8182('0x31')]()[_0x8182('0x19')](function(){_0x4c9b77[_0x8182('0x26')](0xcc)[_0x8182('0x27')]();});}};}function handleEntityNotFound(_0x17984e,_0x3f5d1e){return function(_0x1b46d4){if(!_0x1b46d4){_0x17984e[_0x8182('0x25')](0x194);}return _0x1b46d4;};}function handleError(_0x563c0f,_0x2a71b6){_0x2a71b6=_0x2a71b6||0x1f4;return function(_0x55eeaa){logger['error'](_0x55eeaa[_0x8182('0x32')]);if(_0x55eeaa[_0x8182('0x33')]){delete _0x55eeaa[_0x8182('0x33')];}_0x563c0f[_0x8182('0x26')](_0x2a71b6)[_0x8182('0x34')](_0x55eeaa);};}exports[_0x8182('0x35')]=function(_0x389abe,_0x50a194){var _0x45e283={},_0x3094d7={},_0x541c97={'count':0x0,'rows':[]};var _0x75f7f8=_[_0x8182('0x36')](db['Network'][_0x8182('0x37')],function(_0x260039){return{'name':_0x260039[_0x8182('0x38')],'type':_0x260039['type'][_0x8182('0x39')]};});_0x3094d7['model']=_[_0x8182('0x36')](_0x75f7f8,_0x8182('0x33'));_0x3094d7[_0x8182('0x3a')]=_[_0x8182('0x3b')](_0x389abe[_0x8182('0x3a')]);_0x3094d7['filters']=_[_0x8182('0x3c')](_0x3094d7[_0x8182('0x3d')],_0x3094d7['query']);_0x45e283[_0x8182('0x3e')]=_['intersection'](_0x3094d7[_0x8182('0x3d')],qs[_0x8182('0x3f')](_0x389abe['query'][_0x8182('0x3f')]));_0x45e283[_0x8182('0x3e')]=_0x45e283['attributes'][_0x8182('0x40')]?_0x45e283['attributes']:_0x3094d7['model'];if(!_0x389abe[_0x8182('0x3a')][_0x8182('0x41')](_0x8182('0x42'))){_0x45e283[_0x8182('0x29')]=qs[_0x8182('0x29')](_0x389abe[_0x8182('0x3a')][_0x8182('0x29')]);_0x45e283[_0x8182('0x2b')]=qs['offset'](_0x389abe['query'][_0x8182('0x2b')]);}_0x45e283[_0x8182('0x43')]=qs[_0x8182('0x44')](_0x389abe[_0x8182('0x3a')][_0x8182('0x44')]);_0x45e283[_0x8182('0x45')]=qs[_0x8182('0x46')](_['pick'](_0x389abe[_0x8182('0x3a')],_0x3094d7[_0x8182('0x46')]),_0x75f7f8);if(_0x389abe['query']['filter']){_0x45e283[_0x8182('0x45')]=_[_0x8182('0x47')](_0x45e283[_0x8182('0x45')],{'$or':_[_0x8182('0x36')](_0x75f7f8,function(_0x3fa3f9){if(_0x3fa3f9[_0x8182('0x48')]!==_0x8182('0x49')){var _0xfa049a={};_0xfa049a[_0x3fa3f9[_0x8182('0x33')]]={'$like':'%'+_0x389abe[_0x8182('0x3a')][_0x8182('0x4a')]+'%'};return _0xfa049a;}})});}_0x45e283=_[_0x8182('0x47')]({},_0x45e283,_0x389abe[_0x8182('0x4b')]);var _0x6f13b5={'where':_0x45e283[_0x8182('0x45')]};return db['Network'][_0x8182('0x2c')](_0x6f13b5)['then'](function(_0x52f4c3){_0x541c97[_0x8182('0x2c')]=_0x52f4c3;if(_0x389abe['query']['includeAll']){_0x45e283[_0x8182('0x4c')]=[{'all':!![]}];}return db[_0x8182('0x4d')][_0x8182('0x4e')](_0x45e283);})[_0x8182('0x19')](function(_0x25b4d8){_0x541c97[_0x8182('0x4f')]=_0x25b4d8;return _0x541c97;})[_0x8182('0x19')](respondWithFilteredResult(_0x50a194,_0x45e283))[_0x8182('0x24')](handleError(_0x50a194,null));};exports[_0x8182('0x50')]=function(_0x40534f,_0xd4c8a){var _0x1bed10={'raw':!![],'where':{'id':_0x40534f[_0x8182('0x51')]['id']}},_0xd59bd0={};_0xd59bd0[_0x8182('0x3d')]=_['keys'](db[_0x8182('0x4d')][_0x8182('0x37')]);_0xd59bd0[_0x8182('0x3a')]=_[_0x8182('0x3b')](_0x40534f['query']);_0xd59bd0['filters']=_[_0x8182('0x3c')](_0xd59bd0['model'],_0xd59bd0[_0x8182('0x3a')]);_0x1bed10[_0x8182('0x3e')]=_[_0x8182('0x3c')](_0xd59bd0[_0x8182('0x3d')],qs['fields'](_0x40534f[_0x8182('0x3a')]['fields']));_0x1bed10['attributes']=_0x1bed10['attributes'][_0x8182('0x40')]?_0x1bed10[_0x8182('0x3e')]:_0xd59bd0[_0x8182('0x3d')];if(_0x40534f[_0x8182('0x3a')]['includeAll']){_0x1bed10[_0x8182('0x4c')]=[{'all':!![]}];}_0x1bed10=_[_0x8182('0x47')]({},_0x1bed10,_0x40534f[_0x8182('0x4b')]);return db[_0x8182('0x4d')][_0x8182('0x52')](_0x1bed10)[_0x8182('0x19')](handleEntityNotFound(_0xd4c8a,null))[_0x8182('0x19')](respondWithResult(_0xd4c8a,null))[_0x8182('0x24')](handleError(_0xd4c8a,null));};exports[_0x8182('0x53')]=function(_0x19491b,_0x1526ad,_0x52e09a){var _0x444a20;return db['sequelize']['transaction'](function(_0x3cb802){return db[_0x8182('0x4d')][_0x8182('0x53')](_0x19491b['body'],{'raw':!![]})[_0x8182('0x19')](function(_0xfb9d7e){_0x444a20=_0xfb9d7e;return db[_0x8182('0x4d')][_0x8182('0x4e')]({'where':{'type':_0x19491b[_0x8182('0x54')]['type']},'raw':!![]});})['then'](function(_0x990b96){if(_0x444a20['type'][_0x8182('0x55')]()=='STUN'){var _0x168b46=fs[_0x8182('0x56')](path[_0x8182('0x57')](config[_0x8182('0x58')],_0x8182('0x59')),_0x8182('0x5a'));var _0x383c8d=ejs[_0x8182('0x5b')](_0x168b46,{'networks':_0x990b96||[]});fs[_0x8182('0x5c')](_0x8182('0x5d'),_0x383c8d);return respondWithRpcPromise('Reload',_0x8182('0x53'),{'module':_0x8182('0x5e')});}else if(_0x444a20[_0x8182('0x48')]['toUpperCase']()==_0x8182('0x5f')){var _0x3f7310=fs[_0x8182('0x56')](path[_0x8182('0x57')](config['root'],_0x8182('0x60')),'utf8');var _0x16b34c=ejs[_0x8182('0x5b')](_0x3f7310,{'networks':_0x990b96||[]});fs['writeFileSync'](_0x8182('0x61'),_0x16b34c);return respondWithRpcPromise(_0x8182('0x62'),_0x8182('0x53'),{'module':_0x8182('0x5e')});}else{var _0x140881=fs[_0x8182('0x56')](path[_0x8182('0x57')](config[_0x8182('0x58')],_0x8182('0x63')),_0x8182('0x5a'));var _0x42012f=ejs[_0x8182('0x5b')](_0x140881,{'networks':_0x990b96||[]});fs[_0x8182('0x5c')](util[_0x8182('0x64')](_0x8182('0x65'),_0x19491b[_0x8182('0x54')]['type']['toLowerCase']()),_0x42012f);return respondWithRpcPromise(_0x8182('0x62'),_0x8182('0x53'),{'module':_0x8182('0x66')});}return null;})[_0x8182('0x19')](function(){return _0x444a20;});})[_0x8182('0x19')](respondWithResult(_0x1526ad,0xc9))[_0x8182('0x24')](handleError(_0x1526ad,null));};exports[_0x8182('0x30')]=function(_0x51720b,_0x48ee79,_0x1e3d4f){var _0x42e07f;return db[_0x8182('0x67')]['transaction'](function(_0x175b3e){return db[_0x8182('0x4d')]['find']({'where':{'id':_0x51720b[_0x8182('0x51')]['id']}})[_0x8182('0x19')](handleEntityNotFound(_0x48ee79,null))[_0x8182('0x19')](saveUpdates(_0x51720b[_0x8182('0x54')],null))[_0x8182('0x19')](function(_0x5374af){if(_0x5374af){_0x42e07f=_0x5374af;return db[_0x8182('0x4d')][_0x8182('0x4e')]({'where':{'type':_0x42e07f['type']},'raw':!![]});}return null;})[_0x8182('0x19')](function(_0x4dd724){if(_0x42e07f[_0x8182('0x48')]['toUpperCase']()==_0x8182('0x68')){var _0x243518=fs[_0x8182('0x56')](path['join'](config[_0x8182('0x58')],_0x8182('0x59')),_0x8182('0x5a'));var _0x9adf40=ejs[_0x8182('0x5b')](_0x243518,{'networks':_0x4dd724||[]});fs[_0x8182('0x5c')](_0x8182('0x5d'),_0x9adf40);return respondWithRpcPromise(_0x8182('0x62'),_0x8182('0x30'),{'module':_0x8182('0x5e')});}else if(_0x42e07f[_0x8182('0x48')]['toUpperCase']()==_0x8182('0x5f')){var _0x354650=fs[_0x8182('0x56')](path[_0x8182('0x57')](config[_0x8182('0x58')],_0x8182('0x60')),_0x8182('0x5a'));var _0x57228d=ejs[_0x8182('0x5b')](_0x354650,{'networks':_0x4dd724||[]});fs[_0x8182('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x57228d);return respondWithRpcPromise(_0x8182('0x62'),_0x8182('0x30'),{'module':_0x8182('0x5e')});}else{var _0x5001d7=fs[_0x8182('0x56')](path[_0x8182('0x57')](config[_0x8182('0x58')],_0x8182('0x63')),_0x8182('0x5a'));var _0x4e79df=ejs[_0x8182('0x5b')](_0x5001d7,{'networks':_0x4dd724||[]});fs['writeFileSync'](util[_0x8182('0x64')](_0x8182('0x65'),_0x51720b[_0x8182('0x54')][_0x8182('0x48')][_0x8182('0x69')]()),_0x4e79df);return respondWithRpcPromise(_0x8182('0x62'),'update',{'module':_0x8182('0x66')});}return null;})[_0x8182('0x19')](function(_0x1d17ee){if(_0x1d17ee){return _0x42e07f;}return null;});})[_0x8182('0x19')](respondWithResult(_0x48ee79,null))[_0x8182('0x24')](handleError(_0x48ee79,null));};exports['destroy']=function(_0x27f2ec,_0x89661e,_0x174596){var _0x2dd09f;return db[_0x8182('0x4d')][_0x8182('0x52')]({'where':{'id':_0x27f2ec[_0x8182('0x51')]['id']}})[_0x8182('0x19')](function(_0x50bcbf){_0x2dd09f=_0x50bcbf;return _0x50bcbf;})[_0x8182('0x19')](handleEntityNotFound(_0x89661e,null))[_0x8182('0x19')](removeEntity(_0x89661e,null))['then'](function(){if(_0x2dd09f){return db['Network'][_0x8182('0x4e')]({'where':{'type':_0x2dd09f[_0x8182('0x48')]},'raw':!![]});}})[_0x8182('0x19')](function(_0x1384c0){if(_0x2dd09f['type']['toUpperCase']()==_0x8182('0x68')){var _0x42760f=fs[_0x8182('0x56')](path[_0x8182('0x57')](config[_0x8182('0x58')],'server/files/templates/stun_multiple.ejs'),_0x8182('0x5a'));var _0xb2c64=ejs[_0x8182('0x5b')](_0x42760f,{'networks':_0x1384c0||[]});fs[_0x8182('0x5c')](_0x8182('0x5d'),_0xb2c64);return respondWithRpcPromise('Reload',_0x8182('0x31'),{'module':_0x8182('0x5e')});}else if(_0x2dd09f[_0x8182('0x48')][_0x8182('0x55')]()==_0x8182('0x5f')){var _0x6323df=fs[_0x8182('0x56')](path[_0x8182('0x57')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x8182('0x5a'));var _0x1033d0=ejs[_0x8182('0x5b')](_0x6323df,{'networks':_0x1384c0||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x1033d0);return respondWithRpcPromise(_0x8182('0x62'),_0x8182('0x31'),{'module':_0x8182('0x5e')});}else{var _0x36a859=fs[_0x8182('0x56')](path[_0x8182('0x57')](config[_0x8182('0x58')],_0x8182('0x63')),_0x8182('0x5a'));var _0x915458=ejs[_0x8182('0x5b')](_0x36a859,{'networks':_0x1384c0||[]});fs[_0x8182('0x5c')](util[_0x8182('0x64')](_0x8182('0x65'),_0x27f2ec['body'][_0x8182('0x48')][_0x8182('0x69')]()),_0x915458);return respondWithRpcPromise(_0x8182('0x62'),'destroy',{'module':'chan_sip.so'});}return null;})[_0x8182('0x24')](handleError(_0x89661e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index ab29154..f9dcc57 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 _0xa45c=['request-promise','rimraf','exports','define','network','lodash','util','moment'];(function(_0x37fd36,_0x3d246b){var _0x4f968b=function(_0x4213b9){while(--_0x4213b9){_0x37fd36['push'](_0x37fd36['shift']());}};_0x4f968b(++_0x3d246b);}(_0xa45c,0x6d));var _0xca45=function(_0x134bf0,_0x8b0f0a){_0x134bf0=_0x134bf0-0x0;var _0x5eb022=_0xa45c[_0x134bf0];return _0x5eb022;};'use strict';var _=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xca45('0x2'));var BPromise=require('bluebird');var rp=require(_0xca45('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca45('0x4'));var config=require('../../config/environment');var attributes=require('./network.attributes');module[_0xca45('0x5')]=function(_0x3803d6,_0x18d789){return _0x3803d6[_0xca45('0x6')]('Network',attributes,{'tableName':_0xca45('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb469=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xb469,0x13b));var _0x9b46=function(_0x56da03,_0x2efc96){_0x56da03=_0x56da03-0x0;var _0x1e997f=_0xb469[_0x56da03];return _0x1e997f;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var logger=require(_0x9b46('0x2'))(_0x9b46('0x3'));var moment=require(_0x9b46('0x4'));var BPromise=require(_0x9b46('0x5'));var rp=require(_0x9b46('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9b46('0x7'));var config=require(_0x9b46('0x8'));var attributes=require('./network.attributes');module[_0x9b46('0x9')]=function(_0x405d1c,_0x50b49e){return _0x405d1c[_0x9b46('0xa')]('Network',attributes,{'tableName':'network','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 75fe458..3503261 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x2dfd28,_0x11eb3d){_0x2dfd28=_0x2dfd28-0x0;var _0x54691e=_0x7a54[_0x2dfd28];return _0x54691e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x488c7f,_0x1dcb1c){_0x488c7f=_0x488c7f-0x0;var _0x18e37c=_0x7a54[_0x488c7f];return _0x18e37c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index ab50950..e247398 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 _0xf361=['destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addAnswer','/:id/users','addAgents','send','put','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf361,0x15a));var _0x1f36=function(_0x2dd0c4,_0x315499){_0x2dd0c4=_0x2dd0c4-0x0;var _0x5c053c=_0xf361[_0x2dd0c4];return _0x5c053c;};'use strict';var multer=require(_0x1f36('0x0'));var util=require(_0x1f36('0x1'));var path=require(_0x1f36('0x2'));var timeout=require(_0x1f36('0x3'));var express=require(_0x1f36('0x4'));var router=express[_0x1f36('0x5')]();var fs_extra=require(_0x1f36('0x6'));var auth=require(_0x1f36('0x7'));var interaction=require(_0x1f36('0x8'));var config=require(_0x1f36('0x9'));var controller=require('./openchannelAccount.controller');router[_0x1f36('0xa')]('/',auth[_0x1f36('0xb')](),controller[_0x1f36('0xc')]);router['get'](_0x1f36('0xd'),auth[_0x1f36('0xb')](),controller[_0x1f36('0xe')]);router[_0x1f36('0xa')](_0x1f36('0xf'),auth[_0x1f36('0xb')](),controller[_0x1f36('0x10')]);router[_0x1f36('0xa')](_0x1f36('0x11'),auth['isAuthenticated'](),controller[_0x1f36('0x12')]);router[_0x1f36('0xa')](_0x1f36('0x13'),auth[_0x1f36('0xb')](),controller['getAnswers']);router[_0x1f36('0xa')](_0x1f36('0x14'),auth[_0x1f36('0xb')](),controller[_0x1f36('0x15')]);router[_0x1f36('0xa')](_0x1f36('0x16'),auth[_0x1f36('0xb')](),controller[_0x1f36('0x17')]);router[_0x1f36('0xa')]('/:id/users',auth[_0x1f36('0xb')](),controller[_0x1f36('0x18')]);router[_0x1f36('0x19')]('/',auth[_0x1f36('0xb')](),controller[_0x1f36('0x1a')]);router[_0x1f36('0x19')](_0x1f36('0x11'),auth[_0x1f36('0xb')](),controller['addDisposition']);router['post'](_0x1f36('0x13'),auth[_0x1f36('0xb')](),controller[_0x1f36('0x1b')]);router[_0x1f36('0x19')]('/:id/notify',controller['notify']);router[_0x1f36('0x19')](_0x1f36('0x14'),auth[_0x1f36('0xb')](),controller['addApplications']);router['post'](_0x1f36('0x1c'),auth['isAuthenticated'](),controller[_0x1f36('0x1d')]);router[_0x1f36('0x19')]('/:id/send',auth[_0x1f36('0xb')](),controller[_0x1f36('0x1e')]);router[_0x1f36('0x1f')](_0x1f36('0xf'),auth[_0x1f36('0xb')](),controller[_0x1f36('0x20')]);router[_0x1f36('0x21')](_0x1f36('0xf'),auth[_0x1f36('0xb')](),controller[_0x1f36('0x22')]);router[_0x1f36('0x21')](_0x1f36('0x11'),auth[_0x1f36('0xb')](),controller[_0x1f36('0x23')]);router[_0x1f36('0x21')](_0x1f36('0x13'),auth[_0x1f36('0xb')](),controller[_0x1f36('0x24')]);router[_0x1f36('0x21')](_0x1f36('0x1c'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x1f36('0x25')]=router; \ No newline at end of file +var _0x19ec=['removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition','/:id/notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy'];(function(_0xf34b0a,_0x11e116){var _0x5021e1=function(_0x4eff67){while(--_0x4eff67){_0xf34b0a['push'](_0xf34b0a['shift']());}};_0x5021e1(++_0x11e116);}(_0x19ec,0x10d));var _0xc19e=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x19ec[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require(_0xc19e('0x0'));var path=require('path');var timeout=require(_0xc19e('0x1'));var express=require(_0xc19e('0x2'));var router=express[_0xc19e('0x3')]();var fs_extra=require(_0xc19e('0x4'));var auth=require(_0xc19e('0x5'));var interaction=require(_0xc19e('0x6'));var config=require('../../config/environment');var controller=require(_0xc19e('0x7'));router['get']('/',auth[_0xc19e('0x8')](),controller[_0xc19e('0x9')]);router[_0xc19e('0xa')](_0xc19e('0xb'),auth['isAuthenticated'](),controller[_0xc19e('0xc')]);router[_0xc19e('0xa')](_0xc19e('0xd'),auth[_0xc19e('0x8')](),controller[_0xc19e('0xe')]);router['get'](_0xc19e('0xf'),auth[_0xc19e('0x8')](),controller[_0xc19e('0x10')]);router['get'](_0xc19e('0x11'),auth['isAuthenticated'](),controller[_0xc19e('0x12')]);router[_0xc19e('0xa')]('/:id/applications',auth[_0xc19e('0x8')](),controller[_0xc19e('0x13')]);router[_0xc19e('0xa')](_0xc19e('0x14'),auth['isAuthenticated'](),controller[_0xc19e('0x15')]);router['get'](_0xc19e('0x16'),auth[_0xc19e('0x8')](),controller['getAgents']);router[_0xc19e('0x17')]('/',auth['isAuthenticated'](),controller[_0xc19e('0x18')]);router[_0xc19e('0x17')]('/:id/dispositions',auth[_0xc19e('0x8')](),controller[_0xc19e('0x19')]);router['post'](_0xc19e('0x11'),auth[_0xc19e('0x8')](),controller['addAnswer']);router[_0xc19e('0x17')](_0xc19e('0x1a'),controller['notify']);router[_0xc19e('0x17')]('/:id/applications',auth[_0xc19e('0x8')](),controller[_0xc19e('0x1b')]);router['post'](_0xc19e('0x16'),auth[_0xc19e('0x8')](),controller[_0xc19e('0x1c')]);router[_0xc19e('0x17')](_0xc19e('0x1d'),auth[_0xc19e('0x8')](),controller[_0xc19e('0x1e')]);router[_0xc19e('0x1f')](_0xc19e('0xd'),auth['isAuthenticated'](),controller[_0xc19e('0x20')]);router[_0xc19e('0x21')](_0xc19e('0xd'),auth[_0xc19e('0x8')](),controller[_0xc19e('0x22')]);router[_0xc19e('0x21')](_0xc19e('0xf'),auth[_0xc19e('0x8')](),controller['removeDispositions']);router[_0xc19e('0x21')](_0xc19e('0x11'),auth[_0xc19e('0x8')](),controller[_0xc19e('0x23')]);router[_0xc19e('0x21')](_0xc19e('0x16'),auth[_0xc19e('0x8')](),controller[_0xc19e('0x24')]);module[_0xc19e('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 4b4f5e1..5111b24 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 _0xed4c=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x57f929,_0x116103){var _0x2a6f87=function(_0x351a9b){while(--_0x351a9b){_0x57f929['push'](_0x57f929['shift']());}};_0x2a6f87(++_0x116103);}(_0xed4c,0x7b));var _0xced4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xed4c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xced4('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xced4('0x1')],'unique':_0xced4('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xced4('0x1')]},'token':{'type':Sequelize[_0xced4('0x1')],'defaultValue':function(){return rs[_0xced4('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xced4('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xced4('0x4')],'defaultValue':function(){return _0xced4('0x5');}},'notificationSound':{'type':Sequelize[_0xced4('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xced4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xced4('0x1')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xced4('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xced4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xced4('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xced4('0x8'),'set':function(_0x2b3a73){if(!_0x2b3a73)this['setDataValue'](_0xced4('0x9'),null);this['setDataValue']('mandatoryDisposition',_0x2b3a73);}}}; \ No newline at end of file +var _0x7f7c=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x8d33b5,_0x256e21){var _0x3e2ed7=function(_0x1a01c1){while(--_0x1a01c1){_0x8d33b5['push'](_0x8d33b5['shift']());}};_0x3e2ed7(++_0x256e21);}(_0x7f7c,0x1b0));var _0xc7f7=function(_0x1f11d8,_0x20bd3e){_0x1f11d8=_0x1f11d8-0x0;var _0x972b4c=_0x7f7c[_0x1f11d8];return _0x972b4c;};'use strict';var Sequelize=require(_0xc7f7('0x0'));var rs=require(_0xc7f7('0x1'));module[_0xc7f7('0x2')]={'name':{'type':Sequelize[_0xc7f7('0x3')],'unique':_0xc7f7('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xc7f7('0x3')]},'token':{'type':Sequelize[_0xc7f7('0x3')],'defaultValue':function(){return rs[_0xc7f7('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xc7f7('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc7f7('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xc7f7('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc7f7('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc7f7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc7f7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc7f7('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc7f7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xc7f7('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc7f7('0xa'),'set':function(_0x4e1ea0){if(!_0x4e1ea0)this[_0xc7f7('0xb')]('mandatoryDispositionPauseId',null);this[_0xc7f7('0xb')](_0xc7f7('0xc'),_0x4e1ea0);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 474a116..84ef7db 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 _0x0606=['ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','end','sendStatus','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','filter','merge','findAll','rows','catch','show','mandatoryDispositionPause','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','OpenchannelAccountId','Disposition','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','OpenchannelApplication','List','account','applications','list','orderBy','priority','asc','Applications','defaults','from','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','includeAll','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','userOpenchannelAccount:save','removeAgents','emit','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','Contacts','out','Messages','push','dataValues','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x3e6163,_0x41d7d5){var _0x3c222b=function(_0x362f56){while(--_0x362f56){_0x3e6163['push'](_0x3e6163['shift']());}};_0x3c222b(++_0x41d7d5);}(_0x0606,0x179));var _0x6060=function(_0x5eb492,_0x1d5679){_0x5eb492=_0x5eb492-0x0;var _0x1b87b6=_0x0606[_0x5eb492];return _0x1b87b6;};'use strict';var emlformat=require(_0x6060('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6060('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6060('0x2'));var moment=require(_0x6060('0x3'));var BPromise=require(_0x6060('0x4'));var Mustache=require(_0x6060('0x5'));var util=require('util');var path=require(_0x6060('0x6'));var sox=require(_0x6060('0x7'));var csv=require(_0x6060('0x8'));var ejs=require(_0x6060('0x9'));var fs=require('fs');var fs_extra=require(_0x6060('0xa'));var _=require(_0x6060('0xb'));var squel=require(_0x6060('0xc'));var crypto=require(_0x6060('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6060('0x8'));var querystring=require(_0x6060('0xe'));var Papa=require('papaparse');var Redis=require(_0x6060('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6060('0x10'));var hardwareService=require(_0x6060('0x11'));var logger=require(_0x6060('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6060('0x13'));var db=require(_0x6060('0x14'))['db'];config[_0x6060('0x15')]=_['defaults'](config['redis'],{'host':_0x6060('0x16'),'port':0x18eb});var socket=require(_0x6060('0x17'))(new Redis(config['redis']));require(_0x6060('0x18'))[_0x6060('0x19')](socket);var jayson=require(_0x6060('0x1a'));var client=jayson[_0x6060('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x6060('0x1b')][_0x6060('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x33223a,_0x60a393,_0x2bcb77,_0x48efcb){return new BPromise(function(_0x1425f8,_0x1f1d85){var _0x410203=_0x48efcb||client;return _0x410203[_0x6060('0x1d')](_0x33223a,_0x2bcb77)[_0x6060('0x1e')](function(_0x410c7d){logger['info'](_0x6060('0x1f'),_0x60a393,'request\x20sent');logger[_0x6060('0x20')](_0x6060('0x21'),_0x60a393,'request\x20sent',JSON['stringify'](_0x410c7d));if(_0x410c7d[_0x6060('0x22')]){if(_0x410c7d[_0x6060('0x22')][_0x6060('0x23')]===0x1f4){logger[_0x6060('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x60a393,_0x410c7d[_0x6060('0x22')][_0x6060('0x24')]);return _0x1f1d85(_0x410c7d['error']['message']);}logger[_0x6060('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x60a393,_0x410c7d[_0x6060('0x22')][_0x6060('0x24')]);return _0x1425f8(_0x410c7d[_0x6060('0x22')]['message']);}else{logger[_0x6060('0x25')](_0x6060('0x1f'),_0x60a393,_0x6060('0x26'));_0x1425f8(_0x410c7d[_0x6060('0x27')][_0x6060('0x24')]);}})['catch'](function(_0x14f3d7){logger['error'](_0x6060('0x1f'),_0x60a393,_0x14f3d7);_0x1f1d85(_0x14f3d7);});});}function respondWithStatusCode(_0x54cffd,_0x3ed120){_0x3ed120=_0x3ed120||0xcc;return function(_0x3d846a){if(_0x3d846a){return _0x54cffd['sendStatus'](_0x3ed120);}return _0x54cffd[_0x6060('0x28')](_0x3ed120)['end']();};}function respondWithResult(_0x3d5ed2,_0x4d6ebf){_0x4d6ebf=_0x4d6ebf||0xc8;return function(_0x55fda7){if(_0x55fda7){return _0x3d5ed2[_0x6060('0x28')](_0x4d6ebf)[_0x6060('0x29')](_0x55fda7);}};}function respondWithFilteredResult(_0x3376a0,_0x4c89f3){return function(_0x18aa06){if(_0x18aa06){var _0x1f0403=typeof _0x4c89f3[_0x6060('0x2a')]==='undefined'&&typeof _0x4c89f3[_0x6060('0x2b')]===_0x6060('0x2c');var _0x37e681=_0x18aa06[_0x6060('0x2d')];var _0x174164=_0x1f0403?0x0:_0x4c89f3[_0x6060('0x2a')];var _0x3b19d0=_0x1f0403?_0x18aa06['count']:_0x4c89f3['offset']+_0x4c89f3[_0x6060('0x2b')];var _0x573261;if(_0x3b19d0>=_0x37e681){_0x3b19d0=_0x37e681;_0x573261=0xc8;}else{_0x573261=0xce;}_0x3376a0['status'](_0x573261);return _0x3376a0[_0x6060('0x2e')](_0x6060('0x2f'),_0x174164+'-'+_0x3b19d0+'/'+_0x37e681)[_0x6060('0x29')](_0x18aa06);}return null;};}function patchUpdates(_0x472811){return function(_0x8b966b){try{jsonpatch[_0x6060('0x30')](_0x8b966b,_0x472811,!![]);}catch(_0x3970b2){return BPromise[_0x6060('0x31')](_0x3970b2);}return _0x8b966b[_0x6060('0x32')]();};}function saveUpdates(_0x4d04ed,_0x22e005){return function(_0x3a37f8){if(_0x3a37f8){return _0x3a37f8[_0x6060('0x33')](_0x4d04ed)[_0x6060('0x1e')](function(_0x275555){return _0x275555;});}return null;};}function removeEntity(_0x351aae,_0x18199f){return function(_0x23f64d){if(_0x23f64d){return _0x23f64d[_0x6060('0x34')]()[_0x6060('0x1e')](function(){var _0x3c1e44=_0x23f64d[_0x6060('0x35')]({'plain':!![]});var _0x4580dc='OpenchannelAccounts';return db[_0x6060('0x36')][_0x6060('0x34')]({'where':{'type':_0x4580dc,'resourceId':_0x3c1e44['id']}})[_0x6060('0x1e')](function(){return _0x23f64d;});})[_0x6060('0x1e')](function(){_0x351aae[_0x6060('0x28')](0xcc)[_0x6060('0x37')]();});}};}function handleEntityNotFound(_0x1c11d6,_0x7562fa){return function(_0x1d19c9){if(!_0x1d19c9){_0x1c11d6[_0x6060('0x38')](0x194);}return _0x1d19c9;};}function handleError(_0x492c33,_0x46fab4){_0x46fab4=_0x46fab4||0x1f4;return function(_0x3284b0){logger[_0x6060('0x22')](_0x3284b0['stack']);if(_0x3284b0[_0x6060('0x39')]){delete _0x3284b0[_0x6060('0x39')];}_0x492c33[_0x6060('0x28')](_0x46fab4)[_0x6060('0x3a')](_0x3284b0);};}exports[_0x6060('0x3b')]=function(_0x25596d,_0x4dbf13){var _0x73bc51={'include':[{'model':db[_0x6060('0x3c')],'as':'mandatoryDispositionPause'}]},_0x35b642={},_0x5af0d2={'count':0x0,'rows':[]};var _0x5a2532=_[_0x6060('0x3d')](db[_0x6060('0x3e')][_0x6060('0x3f')],function(_0xccbdea){return{'name':_0xccbdea[_0x6060('0x40')],'type':_0xccbdea[_0x6060('0x41')][_0x6060('0x42')]};});_0x35b642[_0x6060('0x43')]=_[_0x6060('0x3d')](_0x5a2532,_0x6060('0x39'));_0x35b642['query']=_[_0x6060('0x44')](_0x25596d[_0x6060('0x45')]);_0x35b642['filters']=_[_0x6060('0x46')](_0x35b642[_0x6060('0x43')],_0x35b642[_0x6060('0x45')]);_0x73bc51[_0x6060('0x47')]=_[_0x6060('0x46')](_0x35b642['model'],qs[_0x6060('0x48')](_0x25596d[_0x6060('0x45')][_0x6060('0x48')]));_0x73bc51[_0x6060('0x47')]=_0x73bc51[_0x6060('0x47')][_0x6060('0x49')]?_0x73bc51[_0x6060('0x47')]:_0x35b642['model'];if(!_0x25596d[_0x6060('0x45')][_0x6060('0x4a')]('nolimit')){_0x73bc51[_0x6060('0x2b')]=qs['limit'](_0x25596d[_0x6060('0x45')]['limit']);_0x73bc51[_0x6060('0x2a')]=qs[_0x6060('0x2a')](_0x25596d['query'][_0x6060('0x2a')]);}_0x73bc51[_0x6060('0x4b')]=qs[_0x6060('0x4c')](_0x25596d[_0x6060('0x45')]['sort']);_0x73bc51[_0x6060('0x4d')]=qs[_0x6060('0x4e')](_[_0x6060('0x4f')](_0x25596d['query'],_0x35b642[_0x6060('0x4e')]),_0x5a2532);if(_0x25596d[_0x6060('0x45')]['filter']){_0x73bc51[_0x6060('0x4d')]=_['merge'](_0x73bc51[_0x6060('0x4d')],{'$or':_[_0x6060('0x3d')](_0x5a2532,function(_0x22e91f){if(_0x22e91f[_0x6060('0x41')]!==_0x6060('0x50')){var _0x53c985={};_0x53c985[_0x22e91f[_0x6060('0x39')]]={'$like':'%'+_0x25596d[_0x6060('0x45')][_0x6060('0x51')]+'%'};return _0x53c985;}})});}_0x73bc51=_[_0x6060('0x52')]({},_0x73bc51,_0x25596d['options']);var _0x3c606d={'where':_0x73bc51[_0x6060('0x4d')]};return db[_0x6060('0x3e')]['count'](_0x3c606d)['then'](function(_0x12f78f){_0x5af0d2[_0x6060('0x2d')]=_0x12f78f;if(_0x25596d['query']['includeAll']){_0x73bc51['include']=[{'all':!![]}];}return db[_0x6060('0x3e')][_0x6060('0x53')](_0x73bc51);})[_0x6060('0x1e')](function(_0x26d18e){_0x5af0d2[_0x6060('0x54')]=_0x26d18e;return _0x5af0d2;})[_0x6060('0x1e')](respondWithFilteredResult(_0x4dbf13,_0x73bc51))[_0x6060('0x55')](handleError(_0x4dbf13,null));};exports[_0x6060('0x56')]=function(_0x122568,_0xdeab08){var _0x1897c6={'raw':![],'where':{'id':_0x122568['params']['id']},'include':[{'model':db[_0x6060('0x3c')],'as':_0x6060('0x57')}]},_0x50f0b0={};_0x50f0b0[_0x6060('0x43')]=_['keys'](db[_0x6060('0x3e')][_0x6060('0x3f')]);_0x50f0b0['query']=_['keys'](_0x122568['query']);_0x50f0b0[_0x6060('0x4e')]=_[_0x6060('0x46')](_0x50f0b0[_0x6060('0x43')],_0x50f0b0[_0x6060('0x45')]);_0x1897c6[_0x6060('0x47')]=_[_0x6060('0x46')](_0x50f0b0[_0x6060('0x43')],qs['fields'](_0x122568[_0x6060('0x45')]['fields']));_0x1897c6[_0x6060('0x47')]=_0x1897c6[_0x6060('0x47')]['length']?_0x1897c6[_0x6060('0x47')]:_0x50f0b0['model'];if(_0x122568[_0x6060('0x45')]['includeAll']){_0x1897c6[_0x6060('0x58')]=[{'all':!![]}];}_0x1897c6=_[_0x6060('0x52')]({},_0x1897c6,_0x122568[_0x6060('0x59')]);return db[_0x6060('0x3e')][_0x6060('0x5a')](_0x1897c6)[_0x6060('0x1e')](handleEntityNotFound(_0xdeab08,null))['then'](respondWithResult(_0xdeab08,null))[_0x6060('0x55')](handleError(_0xdeab08,null));};exports[_0x6060('0x5b')]=function(_0x4a8fbb,_0x35a9ef){return db[_0x6060('0x3e')][_0x6060('0x5b')](_0x4a8fbb[_0x6060('0x5c')],{})['then'](function(_0x26516a){var _0x456a01=_0x4a8fbb[_0x6060('0x5d')][_0x6060('0x35')]({'plain':!![]});if(!_0x456a01)throw new Error(_0x6060('0x5e'));if(_0x456a01['role']===_0x6060('0x5d')){var _0x2379f1=_0x26516a['get']({'plain':!![]});var _0xdb88da=_0x6060('0x5f');return db[_0x6060('0x60')][_0x6060('0x5a')]({'where':{'name':_0xdb88da,'userProfileId':_0x456a01[_0x6060('0x61')]},'raw':!![]})[_0x6060('0x1e')](function(_0x314fa4){if(_0x314fa4&&_0x314fa4[_0x6060('0x62')]===0x0){return db[_0x6060('0x36')][_0x6060('0x5b')]({'name':_0x2379f1[_0x6060('0x39')],'resourceId':_0x2379f1['id'],'type':_0x314fa4[_0x6060('0x39')],'sectionId':_0x314fa4['id']},{})['then'](function(){return _0x26516a;});}else{return _0x26516a;}})['catch'](function(_0x2f9a03){logger[_0x6060('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f9a03);throw _0x2f9a03;});}return _0x26516a;})[_0x6060('0x1e')](respondWithResult(_0x35a9ef,0xc9))[_0x6060('0x55')](handleError(_0x35a9ef,null));};exports[_0x6060('0x33')]=function(_0x29b428,_0x472f0b){if(_0x29b428[_0x6060('0x5c')]['id']){delete _0x29b428['body']['id'];}return db['OpenchannelAccount'][_0x6060('0x5a')]({'where':{'id':_0x29b428['params']['id']},'include':[{'model':db[_0x6060('0x3c')],'as':_0x6060('0x57')}]})[_0x6060('0x1e')](handleEntityNotFound(_0x472f0b,null))[_0x6060('0x1e')](saveUpdates(_0x29b428[_0x6060('0x5c')],null))[_0x6060('0x1e')](respondWithResult(_0x472f0b,null))[_0x6060('0x55')](handleError(_0x472f0b,null));};exports['destroy']=function(_0x3d0096,_0x757f60){return db['OpenchannelAccount']['find']({'where':{'id':_0x3d0096[_0x6060('0x63')]['id']}})[_0x6060('0x1e')](handleEntityNotFound(_0x757f60,null))[_0x6060('0x1e')](removeEntity(_0x757f60,null))[_0x6060('0x55')](handleError(_0x757f60,null));};exports['describe']=function(_0x40cbf3,_0x39ff0d){return db[_0x6060('0x3e')][_0x6060('0x64')]()[_0x6060('0x1e')](respondWithResult(_0x39ff0d,null))[_0x6060('0x55')](handleError(_0x39ff0d,null));};exports[_0x6060('0x65')]=function(_0x790c77,_0x4a69cd,_0xe7c246){if(_0x790c77[_0x6060('0x5c')]['id']){delete _0x790c77[_0x6060('0x5c')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x790c77[_0x6060('0x63')]['id']}})[_0x6060('0x1e')](handleEntityNotFound(_0x4a69cd,null))[_0x6060('0x1e')](function(_0x254e47){if(_0x254e47){_0x790c77[_0x6060('0x5c')][_0x6060('0x66')]=_0x254e47['id'];return db[_0x6060('0x67')][_0x6060('0x5b')](_0x790c77['body']);}})['then'](respondWithResult(_0x4a69cd,null))[_0x6060('0x55')](handleError(_0x4a69cd,null));};exports['getDispositions']=function(_0x42348c,_0x1f96ab,_0x3ad3a0){var _0x1b3147={'raw':![],'where':{}};var _0xd17fd3={};var _0x1cf857={'count':0x0,'rows':[]};return db[_0x6060('0x3e')]['findOne']({'where':{'id':_0x42348c[_0x6060('0x63')]['id']}})[_0x6060('0x1e')](handleEntityNotFound(_0x1f96ab,null))[_0x6060('0x1e')](function(_0x6ad9ef){if(_0x6ad9ef){_0xd17fd3[_0x6060('0x43')]=_[_0x6060('0x44')](db[_0x6060('0x67')][_0x6060('0x3f')]);_0xd17fd3[_0x6060('0x45')]=_[_0x6060('0x44')](_0x42348c[_0x6060('0x45')]);_0xd17fd3[_0x6060('0x4e')]=_[_0x6060('0x46')](_0xd17fd3[_0x6060('0x43')],_0xd17fd3[_0x6060('0x45')]);_0x1b3147[_0x6060('0x47')]=_[_0x6060('0x46')](_0xd17fd3[_0x6060('0x43')],qs['fields'](_0x42348c[_0x6060('0x45')][_0x6060('0x48')]));_0x1b3147[_0x6060('0x47')]=_0x1b3147[_0x6060('0x47')][_0x6060('0x49')]?_0x1b3147[_0x6060('0x47')]:_0xd17fd3[_0x6060('0x43')];if(!_0x42348c['query'][_0x6060('0x4a')](_0x6060('0x68'))){_0x1b3147['limit']=qs[_0x6060('0x2b')](_0x42348c[_0x6060('0x45')][_0x6060('0x2b')]);_0x1b3147[_0x6060('0x2a')]=qs['offset'](_0x42348c['query']['offset']);}_0x1b3147['order']=qs[_0x6060('0x4c')](_0x42348c[_0x6060('0x45')][_0x6060('0x4c')]);_0x1b3147['where']=qs['filters'](_[_0x6060('0x4f')](_0x42348c['query'],_0xd17fd3[_0x6060('0x4e')]));_0x1b3147[_0x6060('0x4d')]['OpenchannelAccountId']=_0x6ad9ef['id'];if(_0x42348c[_0x6060('0x45')][_0x6060('0x51')]){_0x1b3147[_0x6060('0x4d')]=_['merge'](_0x1b3147[_0x6060('0x4d')],{'$or':_[_0x6060('0x3d')](_0x1b3147[_0x6060('0x47')],function(_0x1856e8){var _0x553bf5={};_0x553bf5[_0x1856e8]={'$like':'%'+_0x42348c['query']['filter']+'%'};return _0x553bf5;})});}_0x1b3147=_[_0x6060('0x52')]({},_0x1b3147,_0x42348c[_0x6060('0x59')]);return db['Disposition']['count']({'where':_0x1b3147[_0x6060('0x4d')]})[_0x6060('0x1e')](function(_0x5dfc08){_0x1cf857[_0x6060('0x2d')]=_0x5dfc08;if(_0x42348c['query']['includeAll']){_0x1b3147[_0x6060('0x58')]=[{'all':!![]}];}return db[_0x6060('0x67')][_0x6060('0x53')](_0x1b3147);})[_0x6060('0x1e')](function(_0x4ba950){_0x1cf857['rows']=_0x4ba950;return _0x1cf857;});}})[_0x6060('0x1e')](respondWithFilteredResult(_0x1f96ab,_0x1b3147))['catch'](handleError(_0x1f96ab,null));};exports[_0x6060('0x69')]=function(_0x22f5f3,_0x44152a,_0x5ca8bd){return db[_0x6060('0x3e')][_0x6060('0x5a')]({'where':{'id':_0x22f5f3[_0x6060('0x63')]['id']}})[_0x6060('0x1e')](handleEntityNotFound(_0x44152a,null))[_0x6060('0x1e')](function(_0x537ce2){if(_0x537ce2){return _0x537ce2[_0x6060('0x69')](_0x22f5f3[_0x6060('0x45')][_0x6060('0x6a')]);}})[_0x6060('0x1e')](respondWithStatusCode(_0x44152a,null))[_0x6060('0x55')](handleError(_0x44152a,null));};exports[_0x6060('0x6b')]=function(_0x26c2ea,_0x3b22c1,_0x2fd573){if(_0x26c2ea['body']['id']){delete _0x26c2ea[_0x6060('0x5c')]['id'];}return db['OpenchannelAccount'][_0x6060('0x5a')]({'where':{'id':_0x26c2ea[_0x6060('0x63')]['id']}})[_0x6060('0x1e')](handleEntityNotFound(_0x3b22c1,null))[_0x6060('0x1e')](function(_0x3927a9){if(_0x3927a9){_0x26c2ea[_0x6060('0x5c')][_0x6060('0x66')]=_0x3927a9['id'];return db[_0x6060('0x6c')][_0x6060('0x5b')](_0x26c2ea[_0x6060('0x5c')]);}})[_0x6060('0x1e')](respondWithResult(_0x3b22c1,null))['catch'](handleError(_0x3b22c1,null));};exports[_0x6060('0x6d')]=function(_0x475cca,_0x280753,_0x1efa7a){var _0x1204b0={'raw':![],'where':{}};var _0x14cd30={};var _0x48fe57={'count':0x0,'rows':[]};return db[_0x6060('0x3e')][_0x6060('0x6e')]({'where':{'id':_0x475cca[_0x6060('0x63')]['id']}})[_0x6060('0x1e')](handleEntityNotFound(_0x280753,null))[_0x6060('0x1e')](function(_0x2ccf39){if(_0x2ccf39){_0x14cd30[_0x6060('0x43')]=_['keys'](db[_0x6060('0x6c')]['rawAttributes']);_0x14cd30['query']=_[_0x6060('0x44')](_0x475cca[_0x6060('0x45')]);_0x14cd30[_0x6060('0x4e')]=_[_0x6060('0x46')](_0x14cd30['model'],_0x14cd30[_0x6060('0x45')]);_0x1204b0[_0x6060('0x47')]=_[_0x6060('0x46')](_0x14cd30[_0x6060('0x43')],qs['fields'](_0x475cca[_0x6060('0x45')][_0x6060('0x48')]));_0x1204b0[_0x6060('0x47')]=_0x1204b0['attributes'][_0x6060('0x49')]?_0x1204b0[_0x6060('0x47')]:_0x14cd30[_0x6060('0x43')];if(!_0x475cca[_0x6060('0x45')][_0x6060('0x4a')](_0x6060('0x68'))){_0x1204b0['limit']=qs[_0x6060('0x2b')](_0x475cca[_0x6060('0x45')][_0x6060('0x2b')]);_0x1204b0[_0x6060('0x2a')]=qs[_0x6060('0x2a')](_0x475cca[_0x6060('0x45')][_0x6060('0x2a')]);}_0x1204b0[_0x6060('0x4b')]=qs[_0x6060('0x4c')](_0x475cca[_0x6060('0x45')]['sort']);_0x1204b0[_0x6060('0x4d')]=qs[_0x6060('0x4e')](_[_0x6060('0x4f')](_0x475cca['query'],_0x14cd30[_0x6060('0x4e')]));_0x1204b0[_0x6060('0x4d')][_0x6060('0x66')]=_0x2ccf39['id'];if(_0x475cca[_0x6060('0x45')][_0x6060('0x51')]){_0x1204b0[_0x6060('0x4d')]=_[_0x6060('0x52')](_0x1204b0[_0x6060('0x4d')],{'$or':_['map'](_0x1204b0[_0x6060('0x47')],function(_0x112ccb){var _0x108eec={};_0x108eec[_0x112ccb]={'$like':'%'+_0x475cca['query'][_0x6060('0x51')]+'%'};return _0x108eec;})});}_0x1204b0=_[_0x6060('0x52')]({},_0x1204b0,_0x475cca[_0x6060('0x59')]);return db[_0x6060('0x6c')][_0x6060('0x2d')]({'where':_0x1204b0[_0x6060('0x4d')]})['then'](function(_0x1625f1){_0x48fe57['count']=_0x1625f1;if(_0x475cca['query']['includeAll']){_0x1204b0[_0x6060('0x58')]=[{'all':!![]}];}return db[_0x6060('0x6c')][_0x6060('0x53')](_0x1204b0);})[_0x6060('0x1e')](function(_0x1baffc){_0x48fe57[_0x6060('0x54')]=_0x1baffc;return _0x48fe57;});}})[_0x6060('0x1e')](respondWithFilteredResult(_0x280753,_0x1204b0))[_0x6060('0x55')](handleError(_0x280753,null));};exports[_0x6060('0x6f')]=function(_0x39f303,_0x4dc098,_0x5d265a){return db[_0x6060('0x3e')][_0x6060('0x5a')]({'where':{'id':_0x39f303[_0x6060('0x63')]['id']}})[_0x6060('0x1e')](handleEntityNotFound(_0x4dc098,null))[_0x6060('0x1e')](function(_0x50583d){if(_0x50583d){return _0x50583d[_0x6060('0x6f')](_0x39f303[_0x6060('0x45')][_0x6060('0x6a')]);}})[_0x6060('0x1e')](respondWithStatusCode(_0x4dc098,null))[_0x6060('0x55')](handleError(_0x4dc098,null));};exports[_0x6060('0x70')]=function(_0x2c40d0,_0x2d4de5,_0x1a8092){var _0x11e81a={'body':_0x2c40d0[_0x6060('0x5c')],'channel':'openchannel'};var _0x4e50d7=[];var _0x1fb89f=[];var _0x5e8e96={};var _0x3c010d=![];return db[_0x6060('0x71')][_0x6060('0x64')]()[_0x6060('0x1e')](function(_0x888187){if(!_0x888187){throw new db[(_0x6060('0x72'))]['ValidationError'](_0x6060('0x73'));}_0x4e50d7=_[_0x6060('0x74')](_[_0x6060('0x44')](_0x888187),[_0x6060('0x75'),_0x6060('0x76')]);_0x1fb89f=_[_0x6060('0x74')](_[_0x6060('0x44')](_0x888187),['createdAt',_0x6060('0x76'),'CompanyId',_0x6060('0x77')]);if(_0x2c40d0[_0x6060('0x5c')]['id']){delete _0x2c40d0[_0x6060('0x5c')]['id'];}if(_[_0x6060('0x78')](_0x2c40d0[_0x6060('0x5c')]['from'])){throw new db[(_0x6060('0x72'))][(_0x6060('0x79'))](_0x6060('0x7a'));}if(_[_0x6060('0x78')](_0x2c40d0[_0x6060('0x5c')][_0x6060('0x5c')])||_0x2c40d0[_0x6060('0x5c')]['body']===''){throw new db['Sequelize'][(_0x6060('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6060('0x78')](_0x2c40d0[_0x6060('0x5c')][_0x6060('0x7b')])){throw new db[(_0x6060('0x72'))][(_0x6060('0x79'))](_0x6060('0x7c')+_0x1fb89f);}if(!_[_0x6060('0x7d')](_0x1fb89f,_0x2c40d0['body'][_0x6060('0x7b')])){throw new db[(_0x6060('0x72'))][(_0x6060('0x79'))](_0x6060('0x7e')+_0x1fb89f);}_0x5e8e96[_0x2c40d0[_0x6060('0x5c')]['mapKey']]=_0x2c40d0[_0x6060('0x5c')]['from'];})[_0x6060('0x1e')](function(){return db['OpenchannelAccount'][_0x6060('0x5a')]({'where':{'id':_0x2c40d0['params']['id']},'include':[{'model':db[_0x6060('0x7f')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x5e8e96,'limit':0x1,'order':[[_0x6060('0x76'),_0x6060('0x80')]]}]},{'model':db[_0x6060('0x81')],'as':'Applications'}]});})[_0x6060('0x1e')](handleEntityNotFound(_0x2d4de5,null))[_0x6060('0x1e')](function(_0xf8c7e0){if(_0xf8c7e0&&_0xf8c7e0[_0x6060('0x82')]){_0x11e81a[_0x6060('0x83')]=_0xf8c7e0;_0x11e81a[_0x6060('0x84')]=_0xf8c7e0['Applications'];_0x11e81a[_0x6060('0x85')]=_0xf8c7e0[_0x6060('0x82')];_0x11e81a['applications']=_[_0x6060('0x86')](_0x11e81a[_0x6060('0x84')],[_0x6060('0x87')],[_0x6060('0x88')]);if(_0x11e81a[_0x6060('0x83')][_0x6060('0x89')]){delete _0x11e81a['account'][_0x6060('0x89')];}if(_0x11e81a[_0x6060('0x83')][_0x6060('0x82')]&&_0x11e81a[_0x6060('0x83')]['List']['Contacts'][_0x6060('0x49')]){return _0x11e81a[_0x6060('0x83')]['List']['Contacts'][0x0];}var _0x3d22b2=_[_0x6060('0x8a')](_0x2c40d0['body'],{'firstName':_0x2c40d0[_0x6060('0x5c')][_0x6060('0x8b')],'ListId':_0xf8c7e0[_0x6060('0x77')]});_0x3d22b2[_0x2c40d0['body']['mapKey']]=_0x2c40d0[_0x6060('0x5c')][_0x6060('0x8b')];return db[_0x6060('0x71')][_0x6060('0x5b')](_0x3d22b2,{'fields':_0x4e50d7,'raw':!![]});}})[_0x6060('0x1e')](handleEntityNotFound(_0x2d4de5,null))[_0x6060('0x1e')](function(_0x2d1be2){_0x11e81a[_0x6060('0x8c')]=_0x2d1be2;if(_0x2d1be2){var _0x27c75f={'ContactId':_0x2d1be2['id'],'OpenchannelAccountId':_0x2c40d0[_0x6060('0x63')]['id'],'from':(_0x2d1be2[_0x6060('0x8d')]||'')+'\x20'+(_0x2d1be2[_0x6060('0x8e')]||'')};var _0x43a692={'OpenchannelAccountId':_0x2c40d0['params']['id'],'closed':![]};if(_0x2c40d0[_0x6060('0x5c')][_0x6060('0x8f')]){_0x43a692[_0x6060('0x8f')]=_0x2c40d0[_0x6060('0x5c')][_0x6060('0x8f')];return db[_0x6060('0x90')]['find']({'where':_0x43a692})[_0x6060('0x1e')](function(_0x3b0dd9){if(_0x3b0dd9){return[_0x3b0dd9,![]];}_0x27c75f[_0x6060('0x8f')]=_0x2c40d0['body'][_0x6060('0x8f')];_0x27c75f[_0x6060('0x91')]=_0x2c40d0[_0x6060('0x5c')][_0x6060('0x91')];return db[_0x6060('0x90')][_0x6060('0x5b')](_0x27c75f)[_0x6060('0x1e')](function(_0x6857c){return[_0x6857c,!![]];});});}else{_0x43a692[_0x6060('0x8f')]=null;}_0x43a692[_0x6060('0x92')]=_0x2d1be2['id'];return db[_0x6060('0x90')][_0x6060('0x5a')]({'where':_0x43a692})[_0x6060('0x1e')](function(_0x14ab06){if(_0x14ab06){return[_0x14ab06,![]];}return db['OpenchannelInteraction'][_0x6060('0x5b')](_0x27c75f)['then'](function(_0x214fd0){return[_0x214fd0,!![]];});});}})[_0x6060('0x93')](function(_0x3824f3,_0x83e996){if(_0x3824f3){_0x3c010d=_0x83e996;if(!_0x83e996){var _0x3f34e6={'from':(_0x11e81a[_0x6060('0x8c')][_0x6060('0x8d')]||'')+'\x20'+(_0x11e81a['contact']['lastName']||'')};if(_0x2c40d0[_0x6060('0x5c')][_0x6060('0x8f')]&&_0x2c40d0[_0x6060('0x5c')][_0x6060('0x94')]&&_0x2c40d0[_0x6060('0x5c')]['threadId']!=_0x2c40d0[_0x6060('0x5c')][_0x6060('0x94')]){_0x3f34e6[_0x6060('0x8f')]=_0x2c40d0[_0x6060('0x5c')][_0x6060('0x94')];}return _0x3824f3['update'](_0x3f34e6);}else{return _0x3824f3;}}})[_0x6060('0x1e')](function(_0x14608c){_0x11e81a[_0x6060('0x95')]=_0x14608c['get']({'plain':!![]});_0x11e81a[_0x6060('0x95')][_0x6060('0x96')]=_0x3c010d;if(_0x11e81a[_0x6060('0x95')][_0x6060('0x96')]){if(_0x11e81a[_0x6060('0x83')][_0x6060('0x97')]){_0x11e81a[_0x6060('0x84')]['push']({'id':0x0,'priority':_0x11e81a[_0x6060('0x84')][_0x6060('0x49')]+0x1,'app':_0x6060('0x98'),'appdata':_0x6060('0x99'),'interval':_0x6060('0x9a')});}}return db[_0x6060('0x9b')][_0x6060('0x5b')]({'body':_0x2c40d0['body'][_0x6060('0x5c')],'OpenchannelAccountId':_0x2c40d0[_0x6060('0x63')]['id'],'OpenchannelInteractionId':_0x14608c['id'],'direction':'in','ContactId':_0x11e81a['contact']['id'],'AttachmentId':_0x2c40d0['body'][_0x6060('0x9c')]});})[_0x6060('0x1e')](function(_0x4d6c4c){_0x11e81a['message']=_0x4d6c4c;if(_0x11e81a[_0x6060('0x95')][_0x6060('0x9d')]){return db[_0x6060('0x9e')][_0x6060('0x5a')]({'attributes':['id',_0x6060('0x39')],'where':{'id':_0x11e81a[_0x6060('0x95')][_0x6060('0x9d')]}})[_0x6060('0x1e')](function(_0x43786f){if(_0x43786f){_0x11e81a[_0x6060('0x84')][_0x6060('0x9f')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x43786f[_0x6060('0x39')]+','+(_0x11e81a['account'][_0x6060('0xa0')]||0xa),'interval':'*,*,*,*'});_0x11e81a[_0x6060('0xa1')]=![];}return respondWithRpcPromise(_0x6060('0xa2'),_0x6060('0xa3'),_0x11e81a);});}return respondWithRpcPromise(_0x6060('0xa2'),_0x6060('0xa3'),_0x11e81a);})[_0x6060('0x1e')](function(_0x1def9b){respondWithRpcPromise(_0x6060('0xa4'),'EventManager',{'event':_0x6060('0x70'),'message':_0x1def9b},client9002);return _0x1def9b;})[_0x6060('0x1e')](respondWithResult(_0x2d4de5,null))[_0x6060('0x55')](handleError(_0x2d4de5,null));};exports['addApplications']=function(_0x323c90,_0x21c21d){var _0x4f25a4=_0x323c90[_0x6060('0x63')]['id'];var _0x3ecef2=_0x323c90[_0x6060('0x5c')];var _0xe023f=0xc8;var _0x9b38b2=null;return db['sequelize'][_0x6060('0xa5')]({'isolationLevel':db[_0x6060('0xa6')][_0x6060('0xa7')][_0x6060('0xa8')][_0x6060('0xa9')]},function(_0x352479){return db[_0x6060('0x3e')][_0x6060('0x6e')]({'where':{'id':_0x4f25a4},'transaction':_0x352479})[_0x6060('0x1e')](function(_0xc0e948){if(_0xc0e948){return db[_0x6060('0x81')][_0x6060('0x34')]({'where':{'OpenchannelAccountId':_0x4f25a4},'transaction':_0x352479})[_0x6060('0x1e')](function(){var _0x441ac4=_['map'](_0x3ecef2,function(_0x5a8071){_0x5a8071[_0x6060('0x66')]=_0x4f25a4;return _0x5a8071;});return db[_0x6060('0x81')][_0x6060('0xaa')](_0x441ac4,{'transaction':_0x352479});});}else{_0xe023f=0x194;_0x9b38b2=[];}});})[_0x6060('0x1e')](function(){if(_0xe023f!==0x194){return db['OpenchannelApplication'][_0x6060('0xab')]({'where':{'OpenchannelAccountId':_0x4f25a4},'order':_0x6060('0x87')})[_0x6060('0x1e')](function(_0x876b26){_0x9b38b2=_0x876b26;});}})[_0x6060('0x55')](function(_0x1e4dab){_0xe023f=0x1f4;logger[_0x6060('0x22')](_0x1e4dab['stack']);if(_0x1e4dab['name']){delete _0x1e4dab['name'];}_0x9b38b2=_0x1e4dab;})['finally'](function(){if(_0x9b38b2===null){_0x21c21d['sendStatus'](_0xe023f);}else{if(_0xe023f===0x1f4){_0x21c21d[_0x6060('0x28')](_0xe023f)[_0x6060('0x3a')](_0x9b38b2);}else{_0x21c21d[_0x6060('0x28')](_0xe023f)[_0x6060('0x29')](_0x9b38b2);}}});};exports[_0x6060('0xac')]=function(_0x5b0f52,_0x557463,_0x3ee0a1){var _0x4b01fb={};var _0x29381c={};var _0x28edaa;var _0x37d630;return db[_0x6060('0x3e')][_0x6060('0x6e')]({'where':{'id':_0x5b0f52['params']['id']}})[_0x6060('0x1e')](handleEntityNotFound(_0x557463,null))[_0x6060('0x1e')](function(_0x45ed67){if(_0x45ed67){_0x28edaa=_0x45ed67;_0x29381c[_0x6060('0x43')]=_[_0x6060('0x44')](db[_0x6060('0x81')][_0x6060('0x3f')]);_0x29381c[_0x6060('0x45')]=_[_0x6060('0x44')](_0x5b0f52[_0x6060('0x45')]);_0x29381c['filters']=_['intersection'](_0x29381c['model'],_0x29381c[_0x6060('0x45')]);_0x4b01fb['attributes']=_[_0x6060('0x46')](_0x29381c[_0x6060('0x43')],qs['fields'](_0x5b0f52['query']['fields']));_0x4b01fb[_0x6060('0x47')]=_0x4b01fb[_0x6060('0x47')][_0x6060('0x49')]?_0x4b01fb['attributes']:_0x29381c[_0x6060('0x43')];_0x4b01fb[_0x6060('0x4b')]=qs[_0x6060('0x4c')](_0x5b0f52['query']['sort']);_0x4b01fb[_0x6060('0x4d')]=qs[_0x6060('0x4e')](_[_0x6060('0x4f')](_0x5b0f52[_0x6060('0x45')],_0x29381c[_0x6060('0x4e')]));if(_0x5b0f52[_0x6060('0x45')]['filter']){_0x4b01fb[_0x6060('0x4d')]=_[_0x6060('0x52')](_0x4b01fb['where'],{'$or':_[_0x6060('0x3d')](_0x4b01fb[_0x6060('0x47')],function(_0x80a797){var _0x27d43f={};_0x27d43f[_0x80a797]={'$like':'%'+_0x5b0f52[_0x6060('0x45')]['filter']+'%'};return _0x27d43f;})});}_0x4b01fb=_[_0x6060('0x52')]({},_0x4b01fb,_0x5b0f52[_0x6060('0x59')]);return _0x28edaa[_0x6060('0xac')](_0x4b01fb);}})[_0x6060('0x1e')](function(_0x3ac499){if(_0x3ac499){_0x37d630=_0x3ac499['length'];if(!_0x5b0f52[_0x6060('0x45')][_0x6060('0x4a')](_0x6060('0x68'))){_0x4b01fb['limit']=qs[_0x6060('0x2b')](_0x5b0f52[_0x6060('0x45')][_0x6060('0x2b')]);_0x4b01fb[_0x6060('0x2a')]=qs[_0x6060('0x2a')](_0x5b0f52['query']['offset']);}return _0x28edaa[_0x6060('0xac')](_0x4b01fb);}})[_0x6060('0x1e')](function(_0xab00e8){if(_0xab00e8){return _0xab00e8?{'count':_0x37d630,'rows':_0xab00e8}:null;}})[_0x6060('0x1e')](respondWithResult(_0x557463,null))[_0x6060('0x55')](handleError(_0x557463,null));};exports[_0x6060('0xad')]=function(_0x49f57e,_0x485871,_0x19b2d5){var _0x3e7c65={'raw':![],'where':{}};var _0x1d1a90={};var _0x2855fa={'count':0x0,'rows':[]};return db[_0x6060('0x3e')][_0x6060('0x6e')]({'where':{'id':_0x49f57e[_0x6060('0x63')]['id']}})[_0x6060('0x1e')](handleEntityNotFound(_0x485871,null))['then'](function(_0x3b3aec){if(_0x3b3aec){_0x1d1a90['model']=_[_0x6060('0x44')](db[_0x6060('0x90')]['rawAttributes']);_0x1d1a90[_0x6060('0x45')]=_[_0x6060('0x44')](_0x49f57e[_0x6060('0x45')]);_0x1d1a90[_0x6060('0x4e')]=_[_0x6060('0x46')](_0x1d1a90[_0x6060('0x43')],_0x1d1a90[_0x6060('0x45')]);_0x3e7c65['attributes']=_['intersection'](_0x1d1a90[_0x6060('0x43')],qs[_0x6060('0x48')](_0x49f57e[_0x6060('0x45')][_0x6060('0x48')]));_0x3e7c65[_0x6060('0x47')]=_0x3e7c65[_0x6060('0x47')][_0x6060('0x49')]?_0x3e7c65[_0x6060('0x47')]:_0x1d1a90[_0x6060('0x43')];if(!_0x49f57e['query'][_0x6060('0x4a')]('nolimit')){_0x3e7c65[_0x6060('0x2b')]=qs[_0x6060('0x2b')](_0x49f57e[_0x6060('0x45')][_0x6060('0x2b')]);_0x3e7c65['offset']=qs[_0x6060('0x2a')](_0x49f57e[_0x6060('0x45')][_0x6060('0x2a')]);}_0x3e7c65['order']=qs[_0x6060('0x4c')](_0x49f57e[_0x6060('0x45')][_0x6060('0x4c')]);_0x3e7c65[_0x6060('0x4d')]=qs[_0x6060('0x4e')](_[_0x6060('0x4f')](_0x49f57e[_0x6060('0x45')],_0x1d1a90[_0x6060('0x4e')]));_0x3e7c65[_0x6060('0x4d')][_0x6060('0x66')]=_0x3b3aec['id'];if(_0x49f57e[_0x6060('0x45')][_0x6060('0x51')]){_0x3e7c65[_0x6060('0x4d')]=_[_0x6060('0x52')](_0x3e7c65[_0x6060('0x4d')],{'$or':_[_0x6060('0x3d')](_0x3e7c65[_0x6060('0x47')],function(_0x1671c9){var _0x54dec1={};_0x54dec1[_0x1671c9]={'$like':'%'+_0x49f57e[_0x6060('0x45')]['filter']+'%'};return _0x54dec1;})});}_0x3e7c65=_['merge']({},_0x3e7c65,_0x49f57e[_0x6060('0x59')]);return db['OpenchannelInteraction']['count']({'where':_0x3e7c65[_0x6060('0x4d')]})['then'](function(_0x147020){_0x2855fa['count']=_0x147020;if(_0x49f57e[_0x6060('0x45')][_0x6060('0xae')]){_0x3e7c65[_0x6060('0x58')]=[{'model':db['CmContact'],'as':_0x6060('0xaf'),'required':![]},{'model':db['User'],'as':_0x6060('0xb0'),'attributes':[_0x6060('0x39'),_0x6060('0xb1'),'internal'],'required':![]},{'model':db[_0x6060('0xb2')],'as':_0x6060('0xb3'),'attributes':['id',_0x6060('0x39'),_0x6060('0xb4')],'where':_0x49f57e[_0x6060('0x45')][_0x6060('0xb5')]?{'id':_0x49f57e[_0x6060('0x45')]['tag']}:undefined,'required':_0x49f57e[_0x6060('0x45')][_0x6060('0xb5')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x6060('0x53')](_0x3e7c65);})[_0x6060('0x1e')](function(_0x4a9c3d){_0x2855fa[_0x6060('0x54')]=_0x4a9c3d;return _0x2855fa;});}})[_0x6060('0x1e')](respondWithFilteredResult(_0x485871,_0x3e7c65))[_0x6060('0x55')](handleError(_0x485871,null));};exports[_0x6060('0xb6')]=function(_0x355d5c,_0x5ac3a3,_0x1641fd){return db[_0x6060('0x3e')][_0x6060('0x5a')]({'where':{'id':_0x355d5c[_0x6060('0x63')]['id']}})[_0x6060('0x1e')](handleEntityNotFound(_0x5ac3a3,null))['then'](function(_0x7c1b80){if(_0x7c1b80){return _0x7c1b80[_0x6060('0xb6')](_0x355d5c['body'][_0x6060('0x6a')],_['omit'](_0x355d5c[_0x6060('0x5c')],[_0x6060('0x6a'),'id'])||{})[_0x6060('0x93')](function(_0xa4f06e){for(var _0x78cdbc=0x0;_0x78cdbc<_0x355d5c['body'][_0x6060('0x6a')][_0x6060('0x49')];_0x78cdbc+=0x1){socket['emit'](_0x6060('0xb7'),{'UserId':Number(_0x355d5c[_0x6060('0x5c')][_0x6060('0x6a')][_0x78cdbc]),'OpenchannelAccountId':Number(_0x355d5c[_0x6060('0x63')]['id'])});}return _0xa4f06e;});}})[_0x6060('0x1e')](respondWithResult(_0x5ac3a3,null))[_0x6060('0x55')](handleError(_0x5ac3a3,null));};exports[_0x6060('0xb8')]=function(_0x40abbc,_0x3f394c,_0x5b998a){return db['OpenchannelAccount'][_0x6060('0x5a')]({'where':{'id':_0x40abbc[_0x6060('0x63')]['id']}})[_0x6060('0x1e')](handleEntityNotFound(_0x3f394c,null))[_0x6060('0x1e')](function(_0x1f91b4){if(_0x1f91b4){return _0x1f91b4['removeAgents'](_0x40abbc[_0x6060('0x45')][_0x6060('0x6a')])[_0x6060('0x1e')](function(){if(_['isArray'](_0x40abbc['query']['ids'])){for(var _0x447fe9=0x0;_0x447fe9<_0x40abbc[_0x6060('0x45')][_0x6060('0x6a')][_0x6060('0x49')];_0x447fe9+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x40abbc[_0x6060('0x45')]['ids'][_0x447fe9]),'OpenchannelAccountId':Number(_0x40abbc[_0x6060('0x63')]['id'])});}}else{socket[_0x6060('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x40abbc[_0x6060('0x45')][_0x6060('0x6a')]),'OpenchannelAccountId':Number(_0x40abbc['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3f394c,null))[_0x6060('0x55')](handleError(_0x3f394c,null));};exports['getAgents']=function(_0x1a0290,_0x4d15b1,_0x196047){var _0x21eef2={};var _0xf24f4a={};var _0x1f6a7a;var _0x16bd89;return db[_0x6060('0x3e')][_0x6060('0x6e')]({'where':{'id':_0x1a0290['params']['id']}})['then'](handleEntityNotFound(_0x4d15b1,null))[_0x6060('0x1e')](function(_0x30f028){if(_0x30f028){_0x1f6a7a=_0x30f028;_0xf24f4a[_0x6060('0x43')]=_[_0x6060('0x44')](db[_0x6060('0x9e')][_0x6060('0x3f')]);_0xf24f4a[_0x6060('0x45')]=_[_0x6060('0x44')](_0x1a0290[_0x6060('0x45')]);_0xf24f4a[_0x6060('0x4e')]=_[_0x6060('0x46')](_0xf24f4a['model'],_0xf24f4a['query']);_0x21eef2[_0x6060('0x47')]=_[_0x6060('0x46')](_0xf24f4a['model'],qs[_0x6060('0x48')](_0x1a0290[_0x6060('0x45')][_0x6060('0x48')]));_0x21eef2[_0x6060('0x47')]=_0x21eef2[_0x6060('0x47')][_0x6060('0x49')]?_0x21eef2[_0x6060('0x47')]:_0xf24f4a[_0x6060('0x43')];_0x21eef2[_0x6060('0x4b')]=qs['sort'](_0x1a0290[_0x6060('0x45')][_0x6060('0x4c')]);_0x21eef2['where']=qs[_0x6060('0x4e')](_['pick'](_0x1a0290['query'],_0xf24f4a[_0x6060('0x4e')]));if(_0x1a0290[_0x6060('0x45')][_0x6060('0x51')]){_0x21eef2[_0x6060('0x4d')]=_[_0x6060('0x52')](_0x21eef2[_0x6060('0x4d')],{'$or':_['map'](_0x21eef2[_0x6060('0x47')],function(_0x569a25){var _0x4d27b7={};_0x4d27b7[_0x569a25]={'$like':'%'+_0x1a0290[_0x6060('0x45')][_0x6060('0x51')]+'%'};return _0x4d27b7;})});}_0x21eef2=_[_0x6060('0x52')]({},_0x21eef2,_0x1a0290['options']);return _0x1f6a7a['getAgents'](_0x21eef2);}})[_0x6060('0x1e')](function(_0x3156a6){if(_0x3156a6){_0x16bd89=_0x3156a6[_0x6060('0x49')];if(!_0x1a0290[_0x6060('0x45')][_0x6060('0x4a')](_0x6060('0x68'))){_0x21eef2['limit']=qs['limit'](_0x1a0290['query'][_0x6060('0x2b')]);_0x21eef2[_0x6060('0x2a')]=qs[_0x6060('0x2a')](_0x1a0290[_0x6060('0x45')][_0x6060('0x2a')]);}return _0x1f6a7a[_0x6060('0xba')](_0x21eef2);}})[_0x6060('0x1e')](function(_0x49d993){if(_0x49d993){return _0x49d993?{'count':_0x16bd89,'rows':_0x49d993}:null;}})[_0x6060('0x1e')](respondWithResult(_0x4d15b1,null))['catch'](handleError(_0x4d15b1,null));};exports['send']=function(_0x550ae8,_0x33c14d,_0x45eb45){var _0x373ee0,_0x2f658,_0x73ec55;if(_[_0x6060('0x78')](_0x550ae8['body'][_0x6060('0x5c')])||_0x550ae8['body'][_0x6060('0x5c')]===''){throw new db[(_0x6060('0x72'))][(_0x6060('0x79'))](_0x6060('0xbb'));}if(_[_0x6060('0x78')](_0x550ae8[_0x6060('0x5c')]['to'])){}_0x373ee0=_0x550ae8[_0x6060('0x5c')]['to'];return db[_0x6060('0x3e')][_0x6060('0x6e')]({'where':{'id':_0x550ae8[_0x6060('0x63')]['id']}})['then'](handleEntityNotFound(_0x33c14d,null))[_0x6060('0x1e')](function(_0x2e5331){if(_0x2e5331){return db['OpenchannelAccount']['find']({'where':{'id':_0x2e5331['id']},'include':[{'model':db[_0x6060('0x7f')],'as':_0x6060('0x82'),'include':[{'model':db[_0x6060('0x71')],'as':_0x6060('0xbc'),'where':{[_0x2e5331[_0x6060('0x7b')]]:_0x373ee0},'limit':0x1,'order':[[_0x6060('0x76'),'DESC']]}]}]})[_0x6060('0x1e')](handleEntityNotFound(_0x33c14d,null))[_0x6060('0x1e')](function(_0x4f7d59){if(_0x4f7d59&&_0x4f7d59['List']){_0x2f658=_0x4f7d59[_0x6060('0x35')]({'plain':!![]});if(_0x2f658[_0x6060('0x82')]&&_0x2f658['List'][_0x6060('0xbc')][_0x6060('0x49')]){return _0x2f658['List'][_0x6060('0xbc')][0x0];}return db[_0x6060('0x71')]['create'](_[_0x6060('0x8a')](_0x550ae8[_0x6060('0x5c')],{'firstName':_0x373ee0,[_0x4f7d59['mapKey']]:_0x373ee0,'phone':_0x373ee0,'ListId':_0x2f658[_0x6060('0x77')]}));}})['then'](handleEntityNotFound(_0x33c14d,null))['then'](function(_0x591c5a){if(_0x591c5a){_0x73ec55=_0x591c5a;return db[_0x6060('0x90')][_0x6060('0x5a')]({'where':{'ContactId':_0x73ec55['id'],'closed':![],'OpenchannelAccountId':_0x2f658['id']}})[_0x6060('0x1e')](function(_0x501b03){if(_0x501b03){return[_0x501b03,![]];}return db[_0x6060('0x90')][_0x6060('0x5b')]({'UserId':_0x550ae8['user']['id'],'ContactId':_0x73ec55['id'],'OpenchannelAccountId':_0x2f658['id'],'lastMsgDirection':_0x6060('0xbd'),'Messages':[_[_0x6060('0x52')](_0x550ae8[_0x6060('0x5c')],{'read':![],'body':_0x550ae8[_0x6060('0x5c')]['body'],'OpenchannelAccountId':_0x2f658['id'],'UserId':_0x550ae8[_0x6060('0x5d')]['id'],'ContactId':_0x73ec55['id']})]},{'include':[{'model':db[_0x6060('0x9b')],'as':'Messages'}]})[_0x6060('0x1e')](function(_0x500c58){return[_0x500c58,!![]];});});}})[_0x6060('0x93')](function(_0x39f2fb,_0x2e4d25){if(_0x2e4d25){return _0x39f2fb;}return db['OpenchannelMessage'][_0x6060('0x5b')](_[_0x6060('0x52')](_0x550ae8[_0x6060('0x5c')],{'read':![],'body':_0x550ae8[_0x6060('0x5c')]['body'],'OpenchannelAccountId':_0x2f658['id'],'OpenchannelInteractionId':_0x39f2fb['id'],'UserId':_0x550ae8[_0x6060('0x5d')]['id'],'ContactId':_0x73ec55['id']}))[_0x6060('0x1e')](function(_0x24489d){_0x39f2fb['dataValues'][_0x6060('0xbe')]=[];_0x39f2fb['dataValues'][_0x6060('0xbe')][_0x6060('0xbf')](_0x24489d[_0x6060('0xc0')]);return _0x39f2fb;});});}})[_0x6060('0x1e')](respondWithResult(_0x33c14d,null))[_0x6060('0x55')](handleError(_0x33c14d,null));}; \ No newline at end of file +var _0xb14a=['merge','VIRTUAL','includeAll','include','findAll','rows','params','mandatoryDispositionPause','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','nolimit','map','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','Sequelize','ValidationError','difference','updatedAt','createdAt','isNil','from','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','Applications','list','applications','orderBy','priority','asc','account','ListId','CmContact','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','out','Messages','spread','dataValues','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','../../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','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','OpenchannelAccounts','UserProfileResource','end','stack','name','send','index','Pause','OpenchannelAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where'];(function(_0x1c3d50,_0x4c7da4){var _0x30f991=function(_0xbd818c){while(--_0xbd818c){_0x1c3d50['push'](_0x1c3d50['shift']());}};_0x30f991(++_0x4c7da4);}(_0xb14a,0x72));var _0xab14=function(_0x51bbda,_0x5f572f){_0x51bbda=_0x51bbda-0x0;var _0x535172=_0xb14a[_0x51bbda];return _0x535172;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab14('0x0'));var zipdir=require(_0xab14('0x1'));var jsonpatch=require(_0xab14('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xab14('0x3'));var Mustache=require(_0xab14('0x4'));var util=require(_0xab14('0x5'));var path=require(_0xab14('0x6'));var sox=require(_0xab14('0x7'));var csv=require(_0xab14('0x8'));var ejs=require(_0xab14('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab14('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xab14('0xb'));var toCsv=require(_0xab14('0x8'));var querystring=require(_0xab14('0xc'));var Papa=require(_0xab14('0xd'));var Redis=require('ioredis');var authService=require(_0xab14('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xab14('0xf'));var hardwareService=require(_0xab14('0x10'));var logger=require(_0xab14('0x11'))('api');var utils=require(_0xab14('0x12'));var config=require(_0xab14('0x13'));var licenseUtil=require(_0xab14('0x14'));var db=require(_0xab14('0x15'))['db'];config[_0xab14('0x16')]=_[_0xab14('0x17')](config[_0xab14('0x16')],{'host':_0xab14('0x18'),'port':0x18eb});var socket=require(_0xab14('0x19'))(new Redis(config[_0xab14('0x16')]));require(_0xab14('0x1a'))[_0xab14('0x1b')](socket);var jayson=require(_0xab14('0x1c'));var client=jayson[_0xab14('0x1d')][_0xab14('0x1e')]({'port':0x232c});var client9002=jayson[_0xab14('0x1d')][_0xab14('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x30417f,_0x668955,_0x3a95e5,_0x31a517){return new BPromise(function(_0x39f124,_0x52b460){var _0x4a11ea=_0x31a517||client;return _0x4a11ea[_0xab14('0x1f')](_0x30417f,_0x3a95e5)[_0xab14('0x20')](function(_0x5610f7){logger[_0xab14('0x21')](_0xab14('0x22'),_0x668955,_0xab14('0x23'));logger[_0xab14('0x24')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x668955,_0xab14('0x23'),JSON[_0xab14('0x25')](_0x5610f7));if(_0x5610f7[_0xab14('0x26')]){if(_0x5610f7[_0xab14('0x26')]['code']===0x1f4){logger['error'](_0xab14('0x22'),_0x668955,_0x5610f7[_0xab14('0x26')][_0xab14('0x27')]);return _0x52b460(_0x5610f7['error'][_0xab14('0x27')]);}logger[_0xab14('0x26')](_0xab14('0x22'),_0x668955,_0x5610f7[_0xab14('0x26')][_0xab14('0x27')]);return _0x39f124(_0x5610f7['error'][_0xab14('0x27')]);}else{logger['info'](_0xab14('0x22'),_0x668955,'request\x20sent');_0x39f124(_0x5610f7[_0xab14('0x28')][_0xab14('0x27')]);}})[_0xab14('0x29')](function(_0x2d745e){logger[_0xab14('0x26')](_0xab14('0x22'),_0x668955,_0x2d745e);_0x52b460(_0x2d745e);});});}function respondWithStatusCode(_0x2b1c7a,_0x1848ad){_0x1848ad=_0x1848ad||0xcc;return function(_0x3a9c98){if(_0x3a9c98){return _0x2b1c7a[_0xab14('0x2a')](_0x1848ad);}return _0x2b1c7a['status'](_0x1848ad)['end']();};}function respondWithResult(_0x5a707c,_0x463e8a){_0x463e8a=_0x463e8a||0xc8;return function(_0x1ef1af){if(_0x1ef1af){return _0x5a707c[_0xab14('0x2b')](_0x463e8a)[_0xab14('0x2c')](_0x1ef1af);}};}function respondWithFilteredResult(_0x4a9aee,_0x1da46f){return function(_0x118b2d){if(_0x118b2d){var _0x76e4f8=typeof _0x1da46f[_0xab14('0x2d')]===_0xab14('0x2e')&&typeof _0x1da46f[_0xab14('0x2f')]==='undefined';var _0x743391=_0x118b2d[_0xab14('0x30')];var _0x22e776=_0x76e4f8?0x0:_0x1da46f[_0xab14('0x2d')];var _0xbec8bb=_0x76e4f8?_0x118b2d[_0xab14('0x30')]:_0x1da46f[_0xab14('0x2d')]+_0x1da46f[_0xab14('0x2f')];var _0x390da1;if(_0xbec8bb>=_0x743391){_0xbec8bb=_0x743391;_0x390da1=0xc8;}else{_0x390da1=0xce;}_0x4a9aee['status'](_0x390da1);return _0x4a9aee[_0xab14('0x31')](_0xab14('0x32'),_0x22e776+'-'+_0xbec8bb+'/'+_0x743391)['json'](_0x118b2d);}return null;};}function patchUpdates(_0x356f40){return function(_0x48a001){try{jsonpatch[_0xab14('0x33')](_0x48a001,_0x356f40,!![]);}catch(_0x84f3a5){return BPromise[_0xab14('0x34')](_0x84f3a5);}return _0x48a001['save']();};}function saveUpdates(_0x42051f,_0x2bc6c7){return function(_0xd70253){if(_0xd70253){return _0xd70253[_0xab14('0x35')](_0x42051f)[_0xab14('0x20')](function(_0x174b8a){return _0x174b8a;});}return null;};}function removeEntity(_0x3ef925,_0x1c3e94){return function(_0x544394){if(_0x544394){return _0x544394[_0xab14('0x36')]()['then'](function(){var _0x4bf74f=_0x544394['get']({'plain':!![]});var _0x34e697=_0xab14('0x37');return db[_0xab14('0x38')]['destroy']({'where':{'type':_0x34e697,'resourceId':_0x4bf74f['id']}})[_0xab14('0x20')](function(){return _0x544394;});})['then'](function(){_0x3ef925[_0xab14('0x2b')](0xcc)[_0xab14('0x39')]();});}};}function handleEntityNotFound(_0x3dce26,_0x3c05e4){return function(_0x9e1d27){if(!_0x9e1d27){_0x3dce26[_0xab14('0x2a')](0x194);}return _0x9e1d27;};}function handleError(_0x41656c,_0x25fbcf){_0x25fbcf=_0x25fbcf||0x1f4;return function(_0x30a785){logger[_0xab14('0x26')](_0x30a785[_0xab14('0x3a')]);if(_0x30a785[_0xab14('0x3b')]){delete _0x30a785['name'];}_0x41656c[_0xab14('0x2b')](_0x25fbcf)[_0xab14('0x3c')](_0x30a785);};}exports[_0xab14('0x3d')]=function(_0x2455f2,_0xf6a1ec){var _0x508939={'include':[{'model':db[_0xab14('0x3e')],'as':'mandatoryDispositionPause'}]},_0x17be32={},_0x6d53bc={'count':0x0,'rows':[]};var _0x268c25=_['map'](db[_0xab14('0x3f')][_0xab14('0x40')],function(_0x5167af){return{'name':_0x5167af[_0xab14('0x41')],'type':_0x5167af[_0xab14('0x42')][_0xab14('0x43')]};});_0x17be32['model']=_['map'](_0x268c25,_0xab14('0x3b'));_0x17be32[_0xab14('0x44')]=_[_0xab14('0x45')](_0x2455f2[_0xab14('0x44')]);_0x17be32[_0xab14('0x46')]=_[_0xab14('0x47')](_0x17be32[_0xab14('0x48')],_0x17be32[_0xab14('0x44')]);_0x508939[_0xab14('0x49')]=_['intersection'](_0x17be32[_0xab14('0x48')],qs[_0xab14('0x4a')](_0x2455f2['query']['fields']));_0x508939[_0xab14('0x49')]=_0x508939[_0xab14('0x49')][_0xab14('0x4b')]?_0x508939[_0xab14('0x49')]:_0x17be32[_0xab14('0x48')];if(!_0x2455f2['query'][_0xab14('0x4c')]('nolimit')){_0x508939[_0xab14('0x2f')]=qs['limit'](_0x2455f2[_0xab14('0x44')][_0xab14('0x2f')]);_0x508939[_0xab14('0x2d')]=qs[_0xab14('0x2d')](_0x2455f2['query'][_0xab14('0x2d')]);}_0x508939[_0xab14('0x4d')]=qs['sort'](_0x2455f2[_0xab14('0x44')][_0xab14('0x4e')]);_0x508939['where']=qs[_0xab14('0x46')](_[_0xab14('0x4f')](_0x2455f2['query'],_0x17be32[_0xab14('0x46')]),_0x268c25);if(_0x2455f2[_0xab14('0x44')][_0xab14('0x50')]){_0x508939[_0xab14('0x51')]=_[_0xab14('0x52')](_0x508939[_0xab14('0x51')],{'$or':_['map'](_0x268c25,function(_0x3e84fd){if(_0x3e84fd[_0xab14('0x42')]!==_0xab14('0x53')){var _0x1e9650={};_0x1e9650[_0x3e84fd[_0xab14('0x3b')]]={'$like':'%'+_0x2455f2['query'][_0xab14('0x50')]+'%'};return _0x1e9650;}})});}_0x508939=_[_0xab14('0x52')]({},_0x508939,_0x2455f2['options']);var _0x42bae7={'where':_0x508939[_0xab14('0x51')]};return db[_0xab14('0x3f')][_0xab14('0x30')](_0x42bae7)['then'](function(_0xb0d9a6){_0x6d53bc[_0xab14('0x30')]=_0xb0d9a6;if(_0x2455f2[_0xab14('0x44')][_0xab14('0x54')]){_0x508939[_0xab14('0x55')]=[{'all':!![]}];}return db[_0xab14('0x3f')][_0xab14('0x56')](_0x508939);})[_0xab14('0x20')](function(_0x5727bc){_0x6d53bc[_0xab14('0x57')]=_0x5727bc;return _0x6d53bc;})['then'](respondWithFilteredResult(_0xf6a1ec,_0x508939))[_0xab14('0x29')](handleError(_0xf6a1ec,null));};exports['show']=function(_0x2e5de6,_0x2d8326){var _0x56253b={'raw':![],'where':{'id':_0x2e5de6[_0xab14('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xab14('0x59')}]},_0x3f30f4={};_0x3f30f4[_0xab14('0x48')]=_['keys'](db['OpenchannelAccount'][_0xab14('0x40')]);_0x3f30f4[_0xab14('0x44')]=_[_0xab14('0x45')](_0x2e5de6[_0xab14('0x44')]);_0x3f30f4['filters']=_[_0xab14('0x47')](_0x3f30f4['model'],_0x3f30f4['query']);_0x56253b['attributes']=_[_0xab14('0x47')](_0x3f30f4[_0xab14('0x48')],qs[_0xab14('0x4a')](_0x2e5de6['query'][_0xab14('0x4a')]));_0x56253b['attributes']=_0x56253b[_0xab14('0x49')][_0xab14('0x4b')]?_0x56253b[_0xab14('0x49')]:_0x3f30f4[_0xab14('0x48')];if(_0x2e5de6['query'][_0xab14('0x54')]){_0x56253b[_0xab14('0x55')]=[{'all':!![]}];}_0x56253b=_[_0xab14('0x52')]({},_0x56253b,_0x2e5de6['options']);return db[_0xab14('0x3f')][_0xab14('0x5a')](_0x56253b)['then'](handleEntityNotFound(_0x2d8326,null))[_0xab14('0x20')](respondWithResult(_0x2d8326,null))[_0xab14('0x29')](handleError(_0x2d8326,null));};exports[_0xab14('0x5b')]=function(_0x379ceb,_0x572df6){return db[_0xab14('0x3f')][_0xab14('0x5b')](_0x379ceb[_0xab14('0x5c')],{})['then'](function(_0x220ffc){var _0x13ed3e=_0x379ceb[_0xab14('0x5d')][_0xab14('0x5e')]({'plain':!![]});if(!_0x13ed3e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13ed3e[_0xab14('0x5f')]==='user'){var _0x4562f4=_0x220ffc[_0xab14('0x5e')]({'plain':!![]});var _0x4ffe41=_0xab14('0x37');return db[_0xab14('0x60')][_0xab14('0x5a')]({'where':{'name':_0x4ffe41,'userProfileId':_0x13ed3e[_0xab14('0x61')]},'raw':!![]})[_0xab14('0x20')](function(_0x4ed29e){if(_0x4ed29e&&_0x4ed29e[_0xab14('0x62')]===0x0){return db[_0xab14('0x38')][_0xab14('0x5b')]({'name':_0x4562f4[_0xab14('0x3b')],'resourceId':_0x4562f4['id'],'type':_0x4ed29e[_0xab14('0x3b')],'sectionId':_0x4ed29e['id']},{})[_0xab14('0x20')](function(){return _0x220ffc;});}else{return _0x220ffc;}})[_0xab14('0x29')](function(_0x1831f4){logger[_0xab14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1831f4);throw _0x1831f4;});}return _0x220ffc;})[_0xab14('0x20')](respondWithResult(_0x572df6,0xc9))[_0xab14('0x29')](handleError(_0x572df6,null));};exports[_0xab14('0x35')]=function(_0x164e60,_0x3c2a39){if(_0x164e60[_0xab14('0x5c')]['id']){delete _0x164e60['body']['id'];}return db['OpenchannelAccount'][_0xab14('0x5a')]({'where':{'id':_0x164e60[_0xab14('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xab14('0x59')}]})[_0xab14('0x20')](handleEntityNotFound(_0x3c2a39,null))[_0xab14('0x20')](saveUpdates(_0x164e60['body'],null))[_0xab14('0x20')](respondWithResult(_0x3c2a39,null))[_0xab14('0x29')](handleError(_0x3c2a39,null));};exports[_0xab14('0x36')]=function(_0x38d297,_0x3bb383){return db[_0xab14('0x3f')][_0xab14('0x5a')]({'where':{'id':_0x38d297['params']['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x3bb383,null))['then'](removeEntity(_0x3bb383,null))['catch'](handleError(_0x3bb383,null));};exports[_0xab14('0x63')]=function(_0x2cffe3,_0x54a2c5){return db[_0xab14('0x3f')]['describe']()[_0xab14('0x20')](respondWithResult(_0x54a2c5,null))[_0xab14('0x29')](handleError(_0x54a2c5,null));};exports[_0xab14('0x64')]=function(_0x18b8c1,_0x7c1263,_0x35d29c){if(_0x18b8c1[_0xab14('0x5c')]['id']){delete _0x18b8c1[_0xab14('0x5c')]['id'];}return db[_0xab14('0x3f')][_0xab14('0x5a')]({'where':{'id':_0x18b8c1[_0xab14('0x58')]['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x7c1263,null))[_0xab14('0x20')](function(_0x4d9cad){if(_0x4d9cad){_0x18b8c1[_0xab14('0x5c')][_0xab14('0x65')]=_0x4d9cad['id'];return db['Disposition'][_0xab14('0x5b')](_0x18b8c1['body']);}})[_0xab14('0x20')](respondWithResult(_0x7c1263,null))[_0xab14('0x29')](handleError(_0x7c1263,null));};exports[_0xab14('0x66')]=function(_0x6bf8b1,_0x496edb,_0x4fb50e){var _0x3c3624={'raw':![],'where':{}};var _0x4446df={};var _0x3c4aff={'count':0x0,'rows':[]};return db[_0xab14('0x3f')][_0xab14('0x67')]({'where':{'id':_0x6bf8b1['params']['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x496edb,null))[_0xab14('0x20')](function(_0xced43a){if(_0xced43a){_0x4446df[_0xab14('0x48')]=_[_0xab14('0x45')](db[_0xab14('0x68')][_0xab14('0x40')]);_0x4446df[_0xab14('0x44')]=_[_0xab14('0x45')](_0x6bf8b1[_0xab14('0x44')]);_0x4446df[_0xab14('0x46')]=_[_0xab14('0x47')](_0x4446df['model'],_0x4446df[_0xab14('0x44')]);_0x3c3624[_0xab14('0x49')]=_['intersection'](_0x4446df[_0xab14('0x48')],qs[_0xab14('0x4a')](_0x6bf8b1[_0xab14('0x44')][_0xab14('0x4a')]));_0x3c3624['attributes']=_0x3c3624['attributes'][_0xab14('0x4b')]?_0x3c3624[_0xab14('0x49')]:_0x4446df['model'];if(!_0x6bf8b1['query']['hasOwnProperty'](_0xab14('0x69'))){_0x3c3624[_0xab14('0x2f')]=qs[_0xab14('0x2f')](_0x6bf8b1[_0xab14('0x44')][_0xab14('0x2f')]);_0x3c3624[_0xab14('0x2d')]=qs[_0xab14('0x2d')](_0x6bf8b1[_0xab14('0x44')][_0xab14('0x2d')]);}_0x3c3624['order']=qs[_0xab14('0x4e')](_0x6bf8b1['query'][_0xab14('0x4e')]);_0x3c3624[_0xab14('0x51')]=qs[_0xab14('0x46')](_[_0xab14('0x4f')](_0x6bf8b1[_0xab14('0x44')],_0x4446df[_0xab14('0x46')]));_0x3c3624[_0xab14('0x51')][_0xab14('0x65')]=_0xced43a['id'];if(_0x6bf8b1[_0xab14('0x44')][_0xab14('0x50')]){_0x3c3624[_0xab14('0x51')]=_[_0xab14('0x52')](_0x3c3624[_0xab14('0x51')],{'$or':_[_0xab14('0x6a')](_0x3c3624[_0xab14('0x49')],function(_0x37c038){var _0x5b68eb={};_0x5b68eb[_0x37c038]={'$like':'%'+_0x6bf8b1[_0xab14('0x44')]['filter']+'%'};return _0x5b68eb;})});}_0x3c3624=_[_0xab14('0x52')]({},_0x3c3624,_0x6bf8b1[_0xab14('0x6b')]);return db['Disposition']['count']({'where':_0x3c3624[_0xab14('0x51')]})[_0xab14('0x20')](function(_0x27094f){_0x3c4aff[_0xab14('0x30')]=_0x27094f;if(_0x6bf8b1['query'][_0xab14('0x54')]){_0x3c3624[_0xab14('0x55')]=[{'all':!![]}];}return db[_0xab14('0x68')][_0xab14('0x56')](_0x3c3624);})[_0xab14('0x20')](function(_0x316691){_0x3c4aff[_0xab14('0x57')]=_0x316691;return _0x3c4aff;});}})['then'](respondWithFilteredResult(_0x496edb,_0x3c3624))['catch'](handleError(_0x496edb,null));};exports['removeDispositions']=function(_0x4ac6e0,_0x5dd0b3,_0x2d1832){return db[_0xab14('0x3f')][_0xab14('0x5a')]({'where':{'id':_0x4ac6e0[_0xab14('0x58')]['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x5dd0b3,null))[_0xab14('0x20')](function(_0x5f7c99){if(_0x5f7c99){return _0x5f7c99[_0xab14('0x6c')](_0x4ac6e0[_0xab14('0x44')][_0xab14('0x6d')]);}})[_0xab14('0x20')](respondWithStatusCode(_0x5dd0b3,null))[_0xab14('0x29')](handleError(_0x5dd0b3,null));};exports[_0xab14('0x6e')]=function(_0x489b20,_0x3f34ae,_0x1f4741){if(_0x489b20[_0xab14('0x5c')]['id']){delete _0x489b20['body']['id'];}return db[_0xab14('0x3f')][_0xab14('0x5a')]({'where':{'id':_0x489b20[_0xab14('0x58')]['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x3f34ae,null))[_0xab14('0x20')](function(_0x27f2bf){if(_0x27f2bf){_0x489b20[_0xab14('0x5c')]['OpenchannelAccountId']=_0x27f2bf['id'];return db[_0xab14('0x6f')][_0xab14('0x5b')](_0x489b20[_0xab14('0x5c')]);}})[_0xab14('0x20')](respondWithResult(_0x3f34ae,null))[_0xab14('0x29')](handleError(_0x3f34ae,null));};exports[_0xab14('0x70')]=function(_0x25e2eb,_0x2a0ff3,_0x22b3bf){var _0x4d936e={'raw':![],'where':{}};var _0x3c993e={};var _0x508d3a={'count':0x0,'rows':[]};return db[_0xab14('0x3f')][_0xab14('0x67')]({'where':{'id':_0x25e2eb[_0xab14('0x58')]['id']}})['then'](handleEntityNotFound(_0x2a0ff3,null))[_0xab14('0x20')](function(_0x38d54c){if(_0x38d54c){_0x3c993e[_0xab14('0x48')]=_[_0xab14('0x45')](db[_0xab14('0x6f')]['rawAttributes']);_0x3c993e[_0xab14('0x44')]=_[_0xab14('0x45')](_0x25e2eb[_0xab14('0x44')]);_0x3c993e[_0xab14('0x46')]=_['intersection'](_0x3c993e[_0xab14('0x48')],_0x3c993e[_0xab14('0x44')]);_0x4d936e[_0xab14('0x49')]=_[_0xab14('0x47')](_0x3c993e[_0xab14('0x48')],qs[_0xab14('0x4a')](_0x25e2eb[_0xab14('0x44')]['fields']));_0x4d936e[_0xab14('0x49')]=_0x4d936e[_0xab14('0x49')][_0xab14('0x4b')]?_0x4d936e[_0xab14('0x49')]:_0x3c993e[_0xab14('0x48')];if(!_0x25e2eb[_0xab14('0x44')]['hasOwnProperty']('nolimit')){_0x4d936e[_0xab14('0x2f')]=qs['limit'](_0x25e2eb[_0xab14('0x44')][_0xab14('0x2f')]);_0x4d936e[_0xab14('0x2d')]=qs[_0xab14('0x2d')](_0x25e2eb['query'][_0xab14('0x2d')]);}_0x4d936e[_0xab14('0x4d')]=qs[_0xab14('0x4e')](_0x25e2eb[_0xab14('0x44')][_0xab14('0x4e')]);_0x4d936e[_0xab14('0x51')]=qs[_0xab14('0x46')](_[_0xab14('0x4f')](_0x25e2eb[_0xab14('0x44')],_0x3c993e[_0xab14('0x46')]));_0x4d936e['where'][_0xab14('0x65')]=_0x38d54c['id'];if(_0x25e2eb['query'][_0xab14('0x50')]){_0x4d936e[_0xab14('0x51')]=_[_0xab14('0x52')](_0x4d936e[_0xab14('0x51')],{'$or':_[_0xab14('0x6a')](_0x4d936e[_0xab14('0x49')],function(_0xf35073){var _0x1d8b4b={};_0x1d8b4b[_0xf35073]={'$like':'%'+_0x25e2eb[_0xab14('0x44')][_0xab14('0x50')]+'%'};return _0x1d8b4b;})});}_0x4d936e=_[_0xab14('0x52')]({},_0x4d936e,_0x25e2eb[_0xab14('0x6b')]);return db[_0xab14('0x6f')][_0xab14('0x30')]({'where':_0x4d936e[_0xab14('0x51')]})[_0xab14('0x20')](function(_0x5f53f8){_0x508d3a[_0xab14('0x30')]=_0x5f53f8;if(_0x25e2eb[_0xab14('0x44')][_0xab14('0x54')]){_0x4d936e[_0xab14('0x55')]=[{'all':!![]}];}return db[_0xab14('0x6f')]['findAll'](_0x4d936e);})['then'](function(_0x3773f8){_0x508d3a[_0xab14('0x57')]=_0x3773f8;return _0x508d3a;});}})[_0xab14('0x20')](respondWithFilteredResult(_0x2a0ff3,_0x4d936e))[_0xab14('0x29')](handleError(_0x2a0ff3,null));};exports['removeAnswers']=function(_0x20d6c9,_0x2ac1f4,_0xeca0a7){return db[_0xab14('0x3f')]['find']({'where':{'id':_0x20d6c9[_0xab14('0x58')]['id']}})['then'](handleEntityNotFound(_0x2ac1f4,null))[_0xab14('0x20')](function(_0x5d6df8){if(_0x5d6df8){return _0x5d6df8[_0xab14('0x71')](_0x20d6c9[_0xab14('0x44')][_0xab14('0x6d')]);}})[_0xab14('0x20')](respondWithStatusCode(_0x2ac1f4,null))['catch'](handleError(_0x2ac1f4,null));};exports[_0xab14('0x72')]=function(_0x12b230,_0x6de50b,_0x43bbfb){var _0x5f01e6={'body':_0x12b230[_0xab14('0x5c')],'channel':_0xab14('0x73')};var _0x162e19=[];var _0x29358b=[];var _0x51f19b={};var _0xf32527=![];return db['CmContact'][_0xab14('0x63')]()['then'](function(_0x530240){if(!_0x530240){throw new db[(_0xab14('0x74'))][(_0xab14('0x75'))]('no\x20available\x20attributes');}_0x162e19=_[_0xab14('0x76')](_['keys'](_0x530240),['createdAt',_0xab14('0x77')]);_0x29358b=_[_0xab14('0x76')](_[_0xab14('0x45')](_0x530240),[_0xab14('0x78'),'updatedAt','CompanyId','ListId']);if(_0x12b230[_0xab14('0x5c')]['id']){delete _0x12b230[_0xab14('0x5c')]['id'];}if(_[_0xab14('0x79')](_0x12b230[_0xab14('0x5c')][_0xab14('0x7a')])){throw new db[(_0xab14('0x74'))][(_0xab14('0x75'))](_0xab14('0x7b'));}if(_[_0xab14('0x79')](_0x12b230[_0xab14('0x5c')][_0xab14('0x5c')])||_0x12b230[_0xab14('0x5c')][_0xab14('0x5c')]===''){throw new db[(_0xab14('0x74'))][(_0xab14('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xab14('0x79')](_0x12b230['body'][_0xab14('0x7c')])){throw new db[(_0xab14('0x74'))]['ValidationError'](_0xab14('0x7d')+_0x29358b);}if(!_[_0xab14('0x7e')](_0x29358b,_0x12b230[_0xab14('0x5c')][_0xab14('0x7c')])){throw new db[(_0xab14('0x74'))][(_0xab14('0x75'))](_0xab14('0x7f')+_0x29358b);}_0x51f19b[_0x12b230[_0xab14('0x5c')][_0xab14('0x7c')]]=_0x12b230[_0xab14('0x5c')][_0xab14('0x7a')];})['then'](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x12b230['params']['id']},'include':[{'model':db[_0xab14('0x80')],'as':_0xab14('0x81'),'include':[{'model':db['CmContact'],'as':_0xab14('0x82'),'where':_0x51f19b,'limit':0x1,'order':[[_0xab14('0x77'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0xab14('0x20')](handleEntityNotFound(_0x6de50b,null))['then'](function(_0x57dab0){if(_0x57dab0&&_0x57dab0[_0xab14('0x81')]){_0x5f01e6['account']=_0x57dab0;_0x5f01e6['applications']=_0x57dab0[_0xab14('0x83')];_0x5f01e6[_0xab14('0x84')]=_0x57dab0[_0xab14('0x81')];_0x5f01e6[_0xab14('0x85')]=_[_0xab14('0x86')](_0x5f01e6['applications'],[_0xab14('0x87')],[_0xab14('0x88')]);if(_0x5f01e6['account'][_0xab14('0x83')]){delete _0x5f01e6['account']['Applications'];}if(_0x5f01e6[_0xab14('0x89')][_0xab14('0x81')]&&_0x5f01e6['account'][_0xab14('0x81')][_0xab14('0x82')]['length']){return _0x5f01e6[_0xab14('0x89')][_0xab14('0x81')]['Contacts'][0x0];}var _0x4901ef=_[_0xab14('0x17')](_0x12b230['body'],{'firstName':_0x12b230[_0xab14('0x5c')]['from'],'ListId':_0x57dab0[_0xab14('0x8a')]});_0x4901ef[_0x12b230[_0xab14('0x5c')]['mapKey']]=_0x12b230[_0xab14('0x5c')][_0xab14('0x7a')];return db[_0xab14('0x8b')]['create'](_0x4901ef,{'fields':_0x162e19,'raw':!![]});}})[_0xab14('0x20')](handleEntityNotFound(_0x6de50b,null))['then'](function(_0x214937){_0x5f01e6[_0xab14('0x8c')]=_0x214937;if(_0x214937){var _0x564d3d={'ContactId':_0x214937['id'],'OpenchannelAccountId':_0x12b230['params']['id'],'from':(_0x214937[_0xab14('0x8d')]||'')+'\x20'+(_0x214937[_0xab14('0x8e')]||'')};var _0x47e652={'OpenchannelAccountId':_0x12b230[_0xab14('0x58')]['id'],'closed':![]};if(_0x12b230['body']['threadId']){_0x47e652[_0xab14('0x8f')]=_0x12b230['body'][_0xab14('0x8f')];return db[_0xab14('0x90')][_0xab14('0x5a')]({'where':_0x47e652})[_0xab14('0x20')](function(_0x1e7d16){if(_0x1e7d16){return[_0x1e7d16,![]];}_0x564d3d[_0xab14('0x8f')]=_0x12b230['body'][_0xab14('0x8f')];_0x564d3d[_0xab14('0x91')]=_0x12b230[_0xab14('0x5c')][_0xab14('0x91')];return db[_0xab14('0x90')]['create'](_0x564d3d)[_0xab14('0x20')](function(_0x406d81){return[_0x406d81,!![]];});});}else{_0x47e652[_0xab14('0x8f')]=null;}_0x47e652[_0xab14('0x92')]=_0x214937['id'];return db[_0xab14('0x90')][_0xab14('0x5a')]({'where':_0x47e652})[_0xab14('0x20')](function(_0x11218d){if(_0x11218d){return[_0x11218d,![]];}return db[_0xab14('0x90')]['create'](_0x564d3d)[_0xab14('0x20')](function(_0x83ea2b){return[_0x83ea2b,!![]];});});}})['spread'](function(_0x48a420,_0x57a579){if(_0x48a420){_0xf32527=_0x57a579;if(!_0x57a579){var _0x109fcc={'from':(_0x5f01e6[_0xab14('0x8c')][_0xab14('0x8d')]||'')+'\x20'+(_0x5f01e6[_0xab14('0x8c')][_0xab14('0x8e')]||'')};if(_0x12b230[_0xab14('0x5c')]['threadId']&&_0x12b230[_0xab14('0x5c')]['messageId']&&_0x12b230[_0xab14('0x5c')][_0xab14('0x8f')]!=_0x12b230[_0xab14('0x5c')][_0xab14('0x93')]){_0x109fcc['threadId']=_0x12b230[_0xab14('0x5c')][_0xab14('0x93')];}return _0x48a420[_0xab14('0x35')](_0x109fcc);}else{return _0x48a420;}}})[_0xab14('0x20')](function(_0x164575){_0x5f01e6[_0xab14('0x94')]=_0x164575[_0xab14('0x5e')]({'plain':!![]});_0x5f01e6[_0xab14('0x94')][_0xab14('0x95')]=_0xf32527;if(_0x5f01e6[_0xab14('0x94')][_0xab14('0x95')]){if(_0x5f01e6['account'][_0xab14('0x96')]){_0x5f01e6[_0xab14('0x85')][_0xab14('0x97')]({'id':0x0,'priority':_0x5f01e6['applications']['length']+0x1,'app':_0xab14('0x98'),'appdata':_0xab14('0x99'),'interval':_0xab14('0x9a')});}}return db[_0xab14('0x9b')][_0xab14('0x5b')]({'body':_0x12b230['body'][_0xab14('0x5c')],'OpenchannelAccountId':_0x12b230[_0xab14('0x58')]['id'],'OpenchannelInteractionId':_0x164575['id'],'direction':'in','ContactId':_0x5f01e6[_0xab14('0x8c')]['id'],'AttachmentId':_0x12b230[_0xab14('0x5c')][_0xab14('0x9c')]});})[_0xab14('0x20')](function(_0xf6fd07){_0x5f01e6['message']=_0xf6fd07;if(_0x5f01e6[_0xab14('0x94')][_0xab14('0x9d')]){return db[_0xab14('0x9e')][_0xab14('0x5a')]({'attributes':['id',_0xab14('0x3b')],'where':{'id':_0x5f01e6[_0xab14('0x94')][_0xab14('0x9d')]}})['then'](function(_0x40989d){if(_0x40989d){_0x5f01e6['applications'][_0xab14('0x9f')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x40989d[_0xab14('0x3b')]+','+(_0x5f01e6[_0xab14('0x89')][_0xab14('0xa0')]||0xa),'interval':'*,*,*,*'});_0x5f01e6[_0xab14('0xa1')]=![];}return respondWithRpcPromise(_0xab14('0xa2'),_0xab14('0xa3'),_0x5f01e6);});}return respondWithRpcPromise(_0xab14('0xa2'),_0xab14('0xa3'),_0x5f01e6);})['then'](function(_0x37e961){respondWithRpcPromise('EventManager','EventManager',{'event':_0xab14('0x72'),'message':_0x37e961},client9002);return _0x37e961;})[_0xab14('0x20')](respondWithResult(_0x6de50b,null))[_0xab14('0x29')](handleError(_0x6de50b,null));};exports['addApplications']=function(_0x2156b2,_0x595d2a){var _0x5f338d=_0x2156b2[_0xab14('0x58')]['id'];var _0x2ff17f=_0x2156b2[_0xab14('0x5c')];var _0x35cead=0xc8;var _0x15ca31=null;return db[_0xab14('0xa4')][_0xab14('0xa5')]({'isolationLevel':db[_0xab14('0xa4')][_0xab14('0xa6')][_0xab14('0xa7')][_0xab14('0xa8')]},function(_0x79b4fd){return db[_0xab14('0x3f')][_0xab14('0x67')]({'where':{'id':_0x5f338d},'transaction':_0x79b4fd})[_0xab14('0x20')](function(_0x4f296a){if(_0x4f296a){return db['OpenchannelApplication'][_0xab14('0x36')]({'where':{'OpenchannelAccountId':_0x5f338d},'transaction':_0x79b4fd})[_0xab14('0x20')](function(){var _0x3a4bdd=_[_0xab14('0x6a')](_0x2ff17f,function(_0x1f6814){_0x1f6814[_0xab14('0x65')]=_0x5f338d;return _0x1f6814;});return db[_0xab14('0xa9')][_0xab14('0xaa')](_0x3a4bdd,{'transaction':_0x79b4fd});});}else{_0x35cead=0x194;_0x15ca31=[];}});})['then'](function(){if(_0x35cead!==0x194){return db[_0xab14('0xa9')][_0xab14('0xab')]({'where':{'OpenchannelAccountId':_0x5f338d},'order':_0xab14('0x87')})[_0xab14('0x20')](function(_0x5729bb){_0x15ca31=_0x5729bb;});}})[_0xab14('0x29')](function(_0x5168f5){_0x35cead=0x1f4;logger['error'](_0x5168f5[_0xab14('0x3a')]);if(_0x5168f5[_0xab14('0x3b')]){delete _0x5168f5[_0xab14('0x3b')];}_0x15ca31=_0x5168f5;})[_0xab14('0xac')](function(){if(_0x15ca31===null){_0x595d2a[_0xab14('0x2a')](_0x35cead);}else{if(_0x35cead===0x1f4){_0x595d2a[_0xab14('0x2b')](_0x35cead)[_0xab14('0x3c')](_0x15ca31);}else{_0x595d2a['status'](_0x35cead)[_0xab14('0x2c')](_0x15ca31);}}});};exports[_0xab14('0xad')]=function(_0x26e6f2,_0x51c823,_0x5e39a9){var _0x41b6aa={};var _0x2d7462={};var _0x3bb115;var _0xe3faec;return db[_0xab14('0x3f')][_0xab14('0x67')]({'where':{'id':_0x26e6f2['params']['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x51c823,null))['then'](function(_0x44fd42){if(_0x44fd42){_0x3bb115=_0x44fd42;_0x2d7462[_0xab14('0x48')]=_[_0xab14('0x45')](db[_0xab14('0xa9')][_0xab14('0x40')]);_0x2d7462[_0xab14('0x44')]=_[_0xab14('0x45')](_0x26e6f2[_0xab14('0x44')]);_0x2d7462[_0xab14('0x46')]=_[_0xab14('0x47')](_0x2d7462['model'],_0x2d7462['query']);_0x41b6aa[_0xab14('0x49')]=_[_0xab14('0x47')](_0x2d7462[_0xab14('0x48')],qs['fields'](_0x26e6f2[_0xab14('0x44')]['fields']));_0x41b6aa[_0xab14('0x49')]=_0x41b6aa[_0xab14('0x49')][_0xab14('0x4b')]?_0x41b6aa[_0xab14('0x49')]:_0x2d7462['model'];_0x41b6aa['order']=qs[_0xab14('0x4e')](_0x26e6f2[_0xab14('0x44')][_0xab14('0x4e')]);_0x41b6aa[_0xab14('0x51')]=qs['filters'](_[_0xab14('0x4f')](_0x26e6f2[_0xab14('0x44')],_0x2d7462['filters']));if(_0x26e6f2[_0xab14('0x44')][_0xab14('0x50')]){_0x41b6aa['where']=_[_0xab14('0x52')](_0x41b6aa[_0xab14('0x51')],{'$or':_[_0xab14('0x6a')](_0x41b6aa[_0xab14('0x49')],function(_0x5cc8ce){var _0x80c850={};_0x80c850[_0x5cc8ce]={'$like':'%'+_0x26e6f2[_0xab14('0x44')][_0xab14('0x50')]+'%'};return _0x80c850;})});}_0x41b6aa=_[_0xab14('0x52')]({},_0x41b6aa,_0x26e6f2[_0xab14('0x6b')]);return _0x3bb115[_0xab14('0xad')](_0x41b6aa);}})[_0xab14('0x20')](function(_0x4fd5fd){if(_0x4fd5fd){_0xe3faec=_0x4fd5fd['length'];if(!_0x26e6f2['query'][_0xab14('0x4c')](_0xab14('0x69'))){_0x41b6aa[_0xab14('0x2f')]=qs['limit'](_0x26e6f2[_0xab14('0x44')][_0xab14('0x2f')]);_0x41b6aa[_0xab14('0x2d')]=qs['offset'](_0x26e6f2[_0xab14('0x44')][_0xab14('0x2d')]);}return _0x3bb115[_0xab14('0xad')](_0x41b6aa);}})[_0xab14('0x20')](function(_0xa66754){if(_0xa66754){return _0xa66754?{'count':_0xe3faec,'rows':_0xa66754}:null;}})[_0xab14('0x20')](respondWithResult(_0x51c823,null))['catch'](handleError(_0x51c823,null));};exports[_0xab14('0xae')]=function(_0x5ad3d6,_0x2e147e,_0xbce34d){var _0x512c33={'raw':![],'where':{}};var _0x1cd0ce={};var _0x25da2f={'count':0x0,'rows':[]};return db[_0xab14('0x3f')]['findOne']({'where':{'id':_0x5ad3d6[_0xab14('0x58')]['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x2e147e,null))[_0xab14('0x20')](function(_0x25c547){if(_0x25c547){_0x1cd0ce['model']=_[_0xab14('0x45')](db[_0xab14('0x90')][_0xab14('0x40')]);_0x1cd0ce[_0xab14('0x44')]=_[_0xab14('0x45')](_0x5ad3d6['query']);_0x1cd0ce[_0xab14('0x46')]=_[_0xab14('0x47')](_0x1cd0ce[_0xab14('0x48')],_0x1cd0ce[_0xab14('0x44')]);_0x512c33[_0xab14('0x49')]=_['intersection'](_0x1cd0ce[_0xab14('0x48')],qs[_0xab14('0x4a')](_0x5ad3d6[_0xab14('0x44')][_0xab14('0x4a')]));_0x512c33[_0xab14('0x49')]=_0x512c33[_0xab14('0x49')][_0xab14('0x4b')]?_0x512c33[_0xab14('0x49')]:_0x1cd0ce['model'];if(!_0x5ad3d6['query'][_0xab14('0x4c')](_0xab14('0x69'))){_0x512c33[_0xab14('0x2f')]=qs[_0xab14('0x2f')](_0x5ad3d6[_0xab14('0x44')]['limit']);_0x512c33[_0xab14('0x2d')]=qs[_0xab14('0x2d')](_0x5ad3d6['query'][_0xab14('0x2d')]);}_0x512c33[_0xab14('0x4d')]=qs[_0xab14('0x4e')](_0x5ad3d6[_0xab14('0x44')]['sort']);_0x512c33[_0xab14('0x51')]=qs[_0xab14('0x46')](_[_0xab14('0x4f')](_0x5ad3d6[_0xab14('0x44')],_0x1cd0ce['filters']));_0x512c33[_0xab14('0x51')]['OpenchannelAccountId']=_0x25c547['id'];if(_0x5ad3d6[_0xab14('0x44')][_0xab14('0x50')]){_0x512c33[_0xab14('0x51')]=_['merge'](_0x512c33[_0xab14('0x51')],{'$or':_['map'](_0x512c33['attributes'],function(_0x491349){var _0x2b2a33={};_0x2b2a33[_0x491349]={'$like':'%'+_0x5ad3d6[_0xab14('0x44')][_0xab14('0x50')]+'%'};return _0x2b2a33;})});}_0x512c33=_[_0xab14('0x52')]({},_0x512c33,_0x5ad3d6[_0xab14('0x6b')]);return db['OpenchannelInteraction']['count']({'where':_0x512c33[_0xab14('0x51')]})[_0xab14('0x20')](function(_0x504f9a){_0x25da2f['count']=_0x504f9a;if(_0x5ad3d6[_0xab14('0x44')][_0xab14('0x54')]){_0x512c33[_0xab14('0x55')]=[{'model':db[_0xab14('0x8b')],'as':_0xab14('0xaf'),'required':![]},{'model':db[_0xab14('0x9e')],'as':'Owner','attributes':[_0xab14('0x3b'),_0xab14('0xb0'),_0xab14('0xb1')],'required':![]},{'model':db[_0xab14('0xb2')],'as':_0xab14('0xb3'),'attributes':['id',_0xab14('0x3b'),_0xab14('0xb4')],'where':_0x5ad3d6['query'][_0xab14('0xb5')]?{'id':_0x5ad3d6[_0xab14('0x44')]['tag']}:undefined,'required':_0x5ad3d6[_0xab14('0x44')][_0xab14('0xb5')]?!![]:![]}];}return db[_0xab14('0x90')][_0xab14('0x56')](_0x512c33);})[_0xab14('0x20')](function(_0x2688c9){_0x25da2f['rows']=_0x2688c9;return _0x25da2f;});}})[_0xab14('0x20')](respondWithFilteredResult(_0x2e147e,_0x512c33))[_0xab14('0x29')](handleError(_0x2e147e,null));};exports[_0xab14('0xb6')]=function(_0x26d288,_0x46d48a,_0x10bf0c){return db[_0xab14('0x3f')][_0xab14('0x5a')]({'where':{'id':_0x26d288[_0xab14('0x58')]['id']}})['then'](handleEntityNotFound(_0x46d48a,null))[_0xab14('0x20')](function(_0xca981c){if(_0xca981c){return _0xca981c[_0xab14('0xb6')](_0x26d288[_0xab14('0x5c')][_0xab14('0x6d')],_[_0xab14('0xb7')](_0x26d288[_0xab14('0x5c')],[_0xab14('0x6d'),'id'])||{})['spread'](function(_0x232e33){for(var _0x51e6cf=0x0;_0x51e6cf<_0x26d288[_0xab14('0x5c')]['ids'][_0xab14('0x4b')];_0x51e6cf+=0x1){socket[_0xab14('0xb8')](_0xab14('0xb9'),{'UserId':Number(_0x26d288[_0xab14('0x5c')][_0xab14('0x6d')][_0x51e6cf]),'OpenchannelAccountId':Number(_0x26d288[_0xab14('0x58')]['id'])});}return _0x232e33;});}})[_0xab14('0x20')](respondWithResult(_0x46d48a,null))[_0xab14('0x29')](handleError(_0x46d48a,null));};exports['removeAgents']=function(_0x3145e6,_0x4ba6e4,_0x155b2c){return db['OpenchannelAccount']['find']({'where':{'id':_0x3145e6[_0xab14('0x58')]['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x4ba6e4,null))[_0xab14('0x20')](function(_0x237ac4){if(_0x237ac4){return _0x237ac4[_0xab14('0xba')](_0x3145e6[_0xab14('0x44')][_0xab14('0x6d')])[_0xab14('0x20')](function(){if(_[_0xab14('0xbb')](_0x3145e6['query'][_0xab14('0x6d')])){for(var _0x1c9fd1=0x0;_0x1c9fd1<_0x3145e6[_0xab14('0x44')][_0xab14('0x6d')][_0xab14('0x4b')];_0x1c9fd1+=0x1){socket[_0xab14('0xb8')](_0xab14('0xbc'),{'UserId':Number(_0x3145e6[_0xab14('0x44')][_0xab14('0x6d')][_0x1c9fd1]),'OpenchannelAccountId':Number(_0x3145e6[_0xab14('0x58')]['id'])});}}else{socket[_0xab14('0xb8')](_0xab14('0xbc'),{'UserId':Number(_0x3145e6[_0xab14('0x44')][_0xab14('0x6d')]),'OpenchannelAccountId':Number(_0x3145e6[_0xab14('0x58')]['id'])});}});}})[_0xab14('0x20')](respondWithStatusCode(_0x4ba6e4,null))[_0xab14('0x29')](handleError(_0x4ba6e4,null));};exports['getAgents']=function(_0xbed4b3,_0x454408,_0x5867a3){var _0x4caea1={};var _0x2d7668={};var _0x304a00;var _0x40e79b;return db[_0xab14('0x3f')][_0xab14('0x67')]({'where':{'id':_0xbed4b3[_0xab14('0x58')]['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x454408,null))[_0xab14('0x20')](function(_0x309f2f){if(_0x309f2f){_0x304a00=_0x309f2f;_0x2d7668[_0xab14('0x48')]=_[_0xab14('0x45')](db['User']['rawAttributes']);_0x2d7668['query']=_[_0xab14('0x45')](_0xbed4b3[_0xab14('0x44')]);_0x2d7668[_0xab14('0x46')]=_[_0xab14('0x47')](_0x2d7668[_0xab14('0x48')],_0x2d7668['query']);_0x4caea1['attributes']=_[_0xab14('0x47')](_0x2d7668['model'],qs['fields'](_0xbed4b3[_0xab14('0x44')]['fields']));_0x4caea1[_0xab14('0x49')]=_0x4caea1[_0xab14('0x49')][_0xab14('0x4b')]?_0x4caea1[_0xab14('0x49')]:_0x2d7668[_0xab14('0x48')];_0x4caea1[_0xab14('0x4d')]=qs[_0xab14('0x4e')](_0xbed4b3[_0xab14('0x44')][_0xab14('0x4e')]);_0x4caea1[_0xab14('0x51')]=qs[_0xab14('0x46')](_[_0xab14('0x4f')](_0xbed4b3[_0xab14('0x44')],_0x2d7668[_0xab14('0x46')]));if(_0xbed4b3[_0xab14('0x44')][_0xab14('0x50')]){_0x4caea1['where']=_['merge'](_0x4caea1[_0xab14('0x51')],{'$or':_[_0xab14('0x6a')](_0x4caea1[_0xab14('0x49')],function(_0x1fc062){var _0x1636b7={};_0x1636b7[_0x1fc062]={'$like':'%'+_0xbed4b3[_0xab14('0x44')][_0xab14('0x50')]+'%'};return _0x1636b7;})});}_0x4caea1=_[_0xab14('0x52')]({},_0x4caea1,_0xbed4b3[_0xab14('0x6b')]);return _0x304a00[_0xab14('0xbd')](_0x4caea1);}})[_0xab14('0x20')](function(_0x281fcd){if(_0x281fcd){_0x40e79b=_0x281fcd['length'];if(!_0xbed4b3[_0xab14('0x44')][_0xab14('0x4c')](_0xab14('0x69'))){_0x4caea1[_0xab14('0x2f')]=qs['limit'](_0xbed4b3[_0xab14('0x44')][_0xab14('0x2f')]);_0x4caea1[_0xab14('0x2d')]=qs[_0xab14('0x2d')](_0xbed4b3[_0xab14('0x44')][_0xab14('0x2d')]);}return _0x304a00['getAgents'](_0x4caea1);}})[_0xab14('0x20')](function(_0x2acef0){if(_0x2acef0){return _0x2acef0?{'count':_0x40e79b,'rows':_0x2acef0}:null;}})[_0xab14('0x20')](respondWithResult(_0x454408,null))['catch'](handleError(_0x454408,null));};exports[_0xab14('0x3c')]=function(_0x20f2ff,_0x1a313e,_0x3482d7){var _0x552a36,_0x18f6c1,_0x1ff8c0;if(_['isNil'](_0x20f2ff[_0xab14('0x5c')][_0xab14('0x5c')])||_0x20f2ff[_0xab14('0x5c')][_0xab14('0x5c')]===''){throw new db['Sequelize'][(_0xab14('0x75'))](_0xab14('0xbe'));}if(_[_0xab14('0x79')](_0x20f2ff[_0xab14('0x5c')]['to'])){}_0x552a36=_0x20f2ff['body']['to'];return db[_0xab14('0x3f')][_0xab14('0x67')]({'where':{'id':_0x20f2ff[_0xab14('0x58')]['id']}})[_0xab14('0x20')](handleEntityNotFound(_0x1a313e,null))[_0xab14('0x20')](function(_0x474275){if(_0x474275){return db[_0xab14('0x3f')][_0xab14('0x5a')]({'where':{'id':_0x474275['id']},'include':[{'model':db['CmList'],'as':_0xab14('0x81'),'include':[{'model':db[_0xab14('0x8b')],'as':_0xab14('0x82'),'where':{[_0x474275[_0xab14('0x7c')]]:_0x552a36},'limit':0x1,'order':[[_0xab14('0x77'),_0xab14('0xbf')]]}]}]})['then'](handleEntityNotFound(_0x1a313e,null))[_0xab14('0x20')](function(_0x372f87){if(_0x372f87&&_0x372f87[_0xab14('0x81')]){_0x18f6c1=_0x372f87[_0xab14('0x5e')]({'plain':!![]});if(_0x18f6c1[_0xab14('0x81')]&&_0x18f6c1['List'][_0xab14('0x82')]['length']){return _0x18f6c1['List'][_0xab14('0x82')][0x0];}return db['CmContact']['create'](_[_0xab14('0x17')](_0x20f2ff['body'],{'firstName':_0x552a36,[_0x372f87[_0xab14('0x7c')]]:_0x552a36,'phone':_0x552a36,'ListId':_0x18f6c1['ListId']}));}})[_0xab14('0x20')](handleEntityNotFound(_0x1a313e,null))[_0xab14('0x20')](function(_0x52b427){if(_0x52b427){_0x1ff8c0=_0x52b427;return db[_0xab14('0x90')]['find']({'where':{'ContactId':_0x1ff8c0['id'],'closed':![],'OpenchannelAccountId':_0x18f6c1['id']}})[_0xab14('0x20')](function(_0x134dbb){if(_0x134dbb){return[_0x134dbb,![]];}return db['OpenchannelInteraction'][_0xab14('0x5b')]({'UserId':_0x20f2ff['user']['id'],'ContactId':_0x1ff8c0['id'],'OpenchannelAccountId':_0x18f6c1['id'],'lastMsgDirection':_0xab14('0xc0'),'Messages':[_['merge'](_0x20f2ff[_0xab14('0x5c')],{'read':![],'body':_0x20f2ff[_0xab14('0x5c')][_0xab14('0x5c')],'OpenchannelAccountId':_0x18f6c1['id'],'UserId':_0x20f2ff[_0xab14('0x5d')]['id'],'ContactId':_0x1ff8c0['id']})]},{'include':[{'model':db[_0xab14('0x9b')],'as':_0xab14('0xc1')}]})[_0xab14('0x20')](function(_0x431a9e){return[_0x431a9e,!![]];});});}})[_0xab14('0xc2')](function(_0xddacbf,_0x39b984){if(_0x39b984){return _0xddacbf;}return db[_0xab14('0x9b')][_0xab14('0x5b')](_[_0xab14('0x52')](_0x20f2ff[_0xab14('0x5c')],{'read':![],'body':_0x20f2ff[_0xab14('0x5c')]['body'],'OpenchannelAccountId':_0x18f6c1['id'],'OpenchannelInteractionId':_0xddacbf['id'],'UserId':_0x20f2ff[_0xab14('0x5d')]['id'],'ContactId':_0x1ff8c0['id']}))[_0xab14('0x20')](function(_0x486d99){_0xddacbf['dataValues']['Messages']=[];_0xddacbf[_0xab14('0xc3')][_0xab14('0xc1')]['push'](_0x486d99[_0xab14('0xc3')]);return _0xddacbf;});});}})[_0xab14('0x20')](respondWithResult(_0x1a313e,null))[_0xab14('0x29')](handleError(_0x1a313e,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index b25166b..983ca73 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 _0x0bb5=['events','../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x310d10,_0x3fe887){var _0x1fb8af=function(_0x42965b){while(--_0x42965b){_0x310d10['push'](_0x310d10['shift']());}};_0x1fb8af(++_0x3fe887);}(_0x0bb5,0x148));var _0x50bb=function(_0x19935b,_0x2ed18c){_0x19935b=_0x19935b-0x0;var _0x44e3ee=_0x0bb5[_0x19935b];return _0x44e3ee;};'use strict';var EventEmitter=require(_0x50bb('0x0'));var OpenchannelAccount=require(_0x50bb('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50bb('0x2'),'afterUpdate':_0x50bb('0x3'),'afterDestroy':_0x50bb('0x4')};function emitEvent(_0x117e36){return function(_0x29c72b,_0xfdc9d4,_0x451b4c){OpenchannelAccountEvents[_0x50bb('0x5')](_0x117e36+':'+_0x29c72b['id'],_0x29c72b);OpenchannelAccountEvents['emit'](_0x117e36,_0x29c72b);_0x451b4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x50bb('0x6')](e,emitEvent(event));}}module[_0x50bb('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x750a=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5d9be4,_0x5df4b6){var _0x44650b=function(_0x105191){while(--_0x105191){_0x5d9be4['push'](_0x5d9be4['shift']());}};_0x44650b(++_0x5df4b6);}(_0x750a,0x140));var _0xa750=function(_0x93fc2c,_0x5e8ef0){_0x93fc2c=_0x93fc2c-0x0;var _0x221c5d=_0x750a[_0x93fc2c];return _0x221c5d;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xa750('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa750('0x1'),'afterUpdate':_0xa750('0x2'),'afterDestroy':_0xa750('0x3')};function emitEvent(_0x19bd5f){return function(_0x457cae,_0x43d704,_0x562911){OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f+':'+_0x457cae['id'],_0x457cae);OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f,_0x457cae);_0x562911(null);};}for(var e in events){if(events[_0xa750('0x5')](e)){var event=events[e];OpenchannelAccount[_0xa750('0x6')](e,emitEvent(event));}}module[_0xa750('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 25bac5b..03fb579 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(_0x2d2360,_0x45b45c){var _0x530ee7=function(_0x53200f){while(--_0x53200f){_0x2d2360['push'](_0x2d2360['shift']());}};_0x530ee7(++_0x45b45c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x54cfc0,_0x199b1c){var _0xfb2c8b=function(_0x5499b3){while(--_0x5499b3){_0x54cfc0['push'](_0x54cfc0['shift']());}};_0xfb2c8b(++_0x199b1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 77624b9..5d680cd 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 _0xa5fa=['debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x185fce,_0x4d45cf){_0x185fce=_0x185fce-0x0;var _0x3065d0=_0xa5fa[_0x185fce];return _0x3065d0;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});config[_0xaa5f('0xb')]=_[_0xaa5f('0xc')](config[_0xaa5f('0xb')],{'host':_0xaa5f('0xd'),'port':0x18eb});var socket=require(_0xaa5f('0xe'))(new Redis(config[_0xaa5f('0xb')]));require('./openchannelAccount.socket')[_0xaa5f('0xf')](socket);function respondWithRpcPromise(_0x227ebb,_0x4d3d16,_0x538865){return new BPromise(function(_0x3fa93f,_0x4bb69d){return client['request'](_0x227ebb,_0x538865)[_0xaa5f('0x10')](function(_0x4d24d2){logger[_0xaa5f('0x11')](_0xaa5f('0x12'),_0x4d3d16,_0xaa5f('0x13'));logger[_0xaa5f('0x14')](_0xaa5f('0x15'),_0x4d3d16,'request\x20sent',JSON[_0xaa5f('0x16')](_0x4d24d2));if(_0x4d24d2['error']){if(_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x18')]===0x1f4){logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x4d24d2[_0xaa5f('0x17')]['message']);return _0x4bb69d(_0x4d24d2['error'][_0xaa5f('0x19')]);}logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x19')]);return _0x3fa93f(_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x19')]);}else{logger[_0xaa5f('0x11')](_0xaa5f('0x12'),_0x4d3d16,_0xaa5f('0x13'));_0x3fa93f(_0x4d24d2[_0xaa5f('0x1a')][_0xaa5f('0x19')]);}})['catch'](function(_0x1c072){logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x1c072);_0x4bb69d(_0x1c072);});});} \ No newline at end of file +var _0x0fd9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','socket.io-emitter','redis','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x5efe95,_0x30917d){var _0x338c80=function(_0x4e8eae){while(--_0x4e8eae){_0x5efe95['push'](_0x5efe95['shift']());}};_0x338c80(++_0x30917d);}(_0x0fd9,0xa3));var _0x90fd=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x0fd9[_0x5eaa0b];return _0x28b295;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var moment=require(_0x90fd('0x1'));var BPromise=require(_0x90fd('0x2'));var rs=require(_0x90fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var config=require(_0x90fd('0x7'));var jayson=require(_0x90fd('0x8'));var client=jayson[_0x90fd('0x9')]['http']({'port':0x232a});config['redis']=_[_0x90fd('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x90fd('0xb'))(new Redis(config[_0x90fd('0xc')]));require('./openchannelAccount.socket')[_0x90fd('0xd')](socket);function respondWithRpcPromise(_0x464236,_0x3c0592,_0x3262f6){return new BPromise(function(_0x289693,_0x3be346){return client[_0x90fd('0xe')](_0x464236,_0x3262f6)[_0x90fd('0xf')](function(_0x3c541e){logger['info'](_0x90fd('0x10'),_0x3c0592,_0x90fd('0x11'));logger['debug'](_0x90fd('0x12'),_0x3c0592,_0x90fd('0x11'),JSON[_0x90fd('0x13')](_0x3c541e));if(_0x3c541e['error']){if(_0x3c541e[_0x90fd('0x14')]['code']===0x1f4){logger[_0x90fd('0x14')](_0x90fd('0x10'),_0x3c0592,_0x3c541e[_0x90fd('0x14')][_0x90fd('0x15')]);return _0x3be346(_0x3c541e[_0x90fd('0x14')][_0x90fd('0x15')]);}logger[_0x90fd('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x3c0592,_0x3c541e['error'][_0x90fd('0x15')]);return _0x289693(_0x3c541e[_0x90fd('0x14')]['message']);}else{logger[_0x90fd('0x16')](_0x90fd('0x10'),_0x3c0592,_0x90fd('0x11'));_0x289693(_0x3c541e['result'][_0x90fd('0x15')]);}})[_0x90fd('0x17')](function(_0x16d8a7){logger[_0x90fd('0x14')](_0x90fd('0x10'),_0x3c0592,_0x16d8a7);_0x3be346(_0x16d8a7);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 5d9626f..bab5b76 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 _0x235a=['save','remove','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x57e4aa,_0x482b33){var _0x203e32=function(_0xf03c77){while(--_0xf03c77){_0x57e4aa['push'](_0x57e4aa['shift']());}};_0x203e32(++_0x482b33);}(_0x235a,0x1ef));var _0xa235=function(_0x51c139,_0xb5fa54){_0x51c139=_0x51c139-0x0;var _0x5ece9a=_0x235a[_0x51c139];return _0x5ece9a;};'use strict';var OpenchannelAccountEvents=require(_0xa235('0x0'));var events=[_0xa235('0x1'),_0xa235('0x2'),'update'];function createListener(_0x343afd,_0x52c3b3){return function(_0x3ae786){_0x52c3b3[_0xa235('0x3')](_0x343afd,_0x3ae786);};}function removeListener(_0x277a68,_0x314ebf){return function(){OpenchannelAccountEvents[_0xa235('0x4')](_0x277a68,_0x314ebf);};}exports[_0xa235('0x5')]=function(_0x2961c8){for(var _0x1707fc=0x0,_0x4b849b=events[_0xa235('0x6')];_0x1707fc<_0x4b849b;_0x1707fc++){var _0x2dc1ba=events[_0x1707fc];var _0x450e27=createListener(_0xa235('0x7')+_0x2dc1ba,_0x2961c8);OpenchannelAccountEvents['on'](_0x2dc1ba,_0x450e27);}}; \ No newline at end of file +var _0xce9b=['./openchannelAccount.events','save','remove','update','emit','removeListener','register','length','openchannelAccount:'];(function(_0x20adc6,_0x3b3d3a){var _0x362885=function(_0x4a1ef1){while(--_0x4a1ef1){_0x20adc6['push'](_0x20adc6['shift']());}};_0x362885(++_0x3b3d3a);}(_0xce9b,0xc6));var _0xbce9=function(_0x48e0d4,_0x4ae82f){_0x48e0d4=_0x48e0d4-0x0;var _0x3a39d6=_0xce9b[_0x48e0d4];return _0x3a39d6;};'use strict';var OpenchannelAccountEvents=require(_0xbce9('0x0'));var events=[_0xbce9('0x1'),_0xbce9('0x2'),_0xbce9('0x3')];function createListener(_0x403c53,_0x81b4e1){return function(_0xa8a2e6){_0x81b4e1[_0xbce9('0x4')](_0x403c53,_0xa8a2e6);};}function removeListener(_0x54ef29,_0x2461ee){return function(){OpenchannelAccountEvents[_0xbce9('0x5')](_0x54ef29,_0x2461ee);};}exports[_0xbce9('0x6')]=function(_0x256ce6){for(var _0x1c40fa=0x0,_0x2c336a=events[_0xbce9('0x7')];_0x1c40fa<_0x2c336a;_0x1c40fa++){var _0x562634=events[_0x1c40fa];var _0x5d92c3=createListener(_0xbce9('0x8')+_0x562634,_0x256ce6);OpenchannelAccountEvents['on'](_0x562634,_0x5d92c3);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 13bacb7..b6bbeb4 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 _0x70a7=['isAuthenticated','get','show','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller'];(function(_0x5b0e79,_0x10f558){var _0x12ddd2=function(_0xf48b3b){while(--_0xf48b3b){_0x5b0e79['push'](_0x5b0e79['shift']());}};_0x12ddd2(++_0x10f558);}(_0x70a7,0x77));var _0x770a=function(_0x2ff762,_0x342c0b){_0x2ff762=_0x2ff762-0x0;var _0x158b02=_0x70a7[_0x2ff762];return _0x158b02;};'use strict';var multer=require(_0x770a('0x0'));var util=require(_0x770a('0x1'));var path=require(_0x770a('0x2'));var timeout=require(_0x770a('0x3'));var express=require(_0x770a('0x4'));var router=express['Router']();var fs_extra=require(_0x770a('0x5'));var auth=require(_0x770a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x770a('0x7'));var controller=require(_0x770a('0x8'));router['get']('/',auth[_0x770a('0x9')](),controller['index']);router[_0x770a('0xa')]('/:id',auth[_0x770a('0x9')](),controller[_0x770a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x770a('0xc'),auth[_0x770a('0x9')](),controller['update']);router[_0x770a('0xd')]('/:id',auth[_0x770a('0x9')](),controller[_0x770a('0xe')]);module[_0x770a('0xf')]=router; \ No newline at end of file +var _0xa7a4=['exports','multer','util','connect-timeout','express','fs-extra','./openchannelApplication.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy'];(function(_0x4e0187,_0xf730a7){var _0x50dd33=function(_0xad081b){while(--_0xad081b){_0x4e0187['push'](_0x4e0187['shift']());}};_0x50dd33(++_0xf730a7);}(_0xa7a4,0x91));var _0x4a7a=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0xa7a4[_0x57014b];return _0x2b258a;};'use strict';var multer=require(_0x4a7a('0x0'));var util=require(_0x4a7a('0x1'));var path=require('path');var timeout=require(_0x4a7a('0x2'));var express=require(_0x4a7a('0x3'));var router=express['Router']();var fs_extra=require(_0x4a7a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4a7a('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4a7a('0x6')](_0x4a7a('0x7'),auth[_0x4a7a('0x8')](),controller[_0x4a7a('0x9')]);router[_0x4a7a('0xa')]('/',auth[_0x4a7a('0x8')](),controller[_0x4a7a('0xb')]);router['put']('/:id',auth[_0x4a7a('0x8')](),controller[_0x4a7a('0xc')]);router[_0x4a7a('0xd')](_0x4a7a('0x7'),auth[_0x4a7a('0x8')](),controller[_0x4a7a('0xe')]);module[_0x4a7a('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index bb2085d..613fa94 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 _0x3cd4=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x2866ca,_0x2da776){var _0x1ec66e=function(_0x182873){while(--_0x182873){_0x2866ca['push'](_0x2866ca['shift']());}};_0x1ec66e(++_0x2da776);}(_0x3cd4,0x124));var _0x43cd=function(_0x469f41,_0x594e63){_0x469f41=_0x469f41-0x0;var _0x5e2728=_0x3cd4[_0x469f41];return _0x5e2728;};'use strict';var Sequelize=require(_0x43cd('0x0'));module[_0x43cd('0x1')]={'priority':{'type':Sequelize[_0x43cd('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x43cd('0x3')],'allowNull':![],'defaultValue':_0x43cd('0x4')},'appdata':{'type':Sequelize[_0x43cd('0x5')]()},'description':{'type':Sequelize[_0x43cd('0x3')]},'interval':{'type':Sequelize[_0x43cd('0x3')],'defaultValue':_0x43cd('0x6')}}; \ No newline at end of file +var _0xb286=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x48ea38,_0xb5b397){var _0xa6780=function(_0x1888ee){while(--_0x1888ee){_0x48ea38['push'](_0x48ea38['shift']());}};_0xa6780(++_0xb5b397);}(_0xb286,0xee));var _0x6b28=function(_0x19efa4,_0x4cef94){_0x19efa4=_0x19efa4-0x0;var _0x3ae34d=_0xb286[_0x19efa4];return _0x3ae34d;};'use strict';var Sequelize=require(_0x6b28('0x0'));module[_0x6b28('0x1')]={'priority':{'type':Sequelize[_0x6b28('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6b28('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6b28('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6b28('0x3')],'defaultValue':_0x6b28('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 04fe5f1..17329e5 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 _0x33c2=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','sort','where','pick','filter','merge'];(function(_0x5954d2,_0x15db93){var _0x316928=function(_0x278bd3){while(--_0x278bd3){_0x5954d2['push'](_0x5954d2['shift']());}};_0x316928(++_0x15db93);}(_0x33c2,0x1d4));var _0x233c=function(_0x1b8bda,_0x43ad31){_0x1b8bda=_0x1b8bda-0x0;var _0x1f7050=_0x33c2[_0x1b8bda];return _0x1f7050;};'use strict';var emlformat=require(_0x233c('0x0'));var rimraf=require(_0x233c('0x1'));var zipdir=require(_0x233c('0x2'));var jsonpatch=require(_0x233c('0x3'));var rp=require(_0x233c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x233c('0x5'));var util=require('util');var path=require('path');var sox=require(_0x233c('0x6'));var csv=require(_0x233c('0x7'));var ejs=require(_0x233c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x233c('0x9'));var squel=require(_0x233c('0xa'));var crypto=require('crypto');var jsforce=require(_0x233c('0xb'));var deskjs=require(_0x233c('0xc'));var toCsv=require(_0x233c('0x7'));var querystring=require(_0x233c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x233c('0xe'));var qs=require(_0x233c('0xf'));var as=require(_0x233c('0x10'));var hardwareService=require(_0x233c('0x11'));var logger=require(_0x233c('0x12'))(_0x233c('0x13'));var utils=require('../../config/utils');var config=require(_0x233c('0x14'));var licenseUtil=require(_0x233c('0x15'));var db=require(_0x233c('0x16'))['db'];function respondWithStatusCode(_0x568249,_0x4aae8d){_0x4aae8d=_0x4aae8d||0xcc;return function(_0x1b39e6){if(_0x1b39e6){return _0x568249[_0x233c('0x17')](_0x4aae8d);}return _0x568249[_0x233c('0x18')](_0x4aae8d)['end']();};}function respondWithResult(_0x858c4e,_0x36baa2){_0x36baa2=_0x36baa2||0xc8;return function(_0x14d152){if(_0x14d152){return _0x858c4e[_0x233c('0x18')](_0x36baa2)[_0x233c('0x19')](_0x14d152);}};}function respondWithFilteredResult(_0x29cfb2,_0x58ee7d){return function(_0x4a0c32){if(_0x4a0c32){var _0x4b22a5=typeof _0x58ee7d['offset']===_0x233c('0x1a')&&typeof _0x58ee7d[_0x233c('0x1b')]==='undefined';var _0xfa3321=_0x4a0c32[_0x233c('0x1c')];var _0x5281ae=_0x4b22a5?0x0:_0x58ee7d['offset'];var _0x184548=_0x4b22a5?_0x4a0c32[_0x233c('0x1c')]:_0x58ee7d['offset']+_0x58ee7d[_0x233c('0x1b')];var _0x1e632d;if(_0x184548>=_0xfa3321){_0x184548=_0xfa3321;_0x1e632d=0xc8;}else{_0x1e632d=0xce;}_0x29cfb2[_0x233c('0x18')](_0x1e632d);return _0x29cfb2[_0x233c('0x1d')](_0x233c('0x1e'),_0x5281ae+'-'+_0x184548+'/'+_0xfa3321)[_0x233c('0x19')](_0x4a0c32);}return null;};}function patchUpdates(_0x35b086){return function(_0x158fd1){try{jsonpatch[_0x233c('0x1f')](_0x158fd1,_0x35b086,!![]);}catch(_0x182766){return BPromise[_0x233c('0x20')](_0x182766);}return _0x158fd1[_0x233c('0x21')]();};}function saveUpdates(_0x43694e,_0x13bb25){return function(_0x3fefa5){if(_0x3fefa5){return _0x3fefa5[_0x233c('0x22')](_0x43694e)['then'](function(_0x436690){return _0x436690;});}return null;};}function removeEntity(_0x6da3cc,_0x2de415){return function(_0x10a959){if(_0x10a959){return _0x10a959[_0x233c('0x23')]()[_0x233c('0x24')](function(){_0x6da3cc[_0x233c('0x18')](0xcc)[_0x233c('0x25')]();});}};}function handleEntityNotFound(_0x39c749,_0x53f146){return function(_0x370d08){if(!_0x370d08){_0x39c749[_0x233c('0x17')](0x194);}return _0x370d08;};}function handleError(_0x2131a2,_0x1bbf4c){_0x1bbf4c=_0x1bbf4c||0x1f4;return function(_0x389c0d){logger[_0x233c('0x26')](_0x389c0d[_0x233c('0x27')]);if(_0x389c0d['name']){delete _0x389c0d[_0x233c('0x28')];}_0x2131a2[_0x233c('0x18')](_0x1bbf4c)[_0x233c('0x29')](_0x389c0d);};}exports[_0x233c('0x2a')]=function(_0x114d10,_0x5387f8){var _0x4cd4bd={},_0x1f323e={},_0x59baad={'count':0x0,'rows':[]};var _0x5c51a9=_['map'](db[_0x233c('0x2b')][_0x233c('0x2c')],function(_0x165035){return{'name':_0x165035[_0x233c('0x2d')],'type':_0x165035[_0x233c('0x2e')][_0x233c('0x2f')]};});_0x1f323e[_0x233c('0x30')]=_[_0x233c('0x31')](_0x5c51a9,_0x233c('0x28'));_0x1f323e[_0x233c('0x32')]=_[_0x233c('0x33')](_0x114d10[_0x233c('0x32')]);_0x1f323e[_0x233c('0x34')]=_[_0x233c('0x35')](_0x1f323e[_0x233c('0x30')],_0x1f323e['query']);_0x4cd4bd[_0x233c('0x36')]=_[_0x233c('0x35')](_0x1f323e[_0x233c('0x30')],qs['fields'](_0x114d10[_0x233c('0x32')][_0x233c('0x37')]));_0x4cd4bd[_0x233c('0x36')]=_0x4cd4bd['attributes'][_0x233c('0x38')]?_0x4cd4bd[_0x233c('0x36')]:_0x1f323e[_0x233c('0x30')];if(!_0x114d10['query']['hasOwnProperty'](_0x233c('0x39'))){_0x4cd4bd[_0x233c('0x1b')]=qs['limit'](_0x114d10[_0x233c('0x32')][_0x233c('0x1b')]);_0x4cd4bd['offset']=qs[_0x233c('0x3a')](_0x114d10[_0x233c('0x32')][_0x233c('0x3a')]);}_0x4cd4bd['order']=qs[_0x233c('0x3b')](_0x114d10[_0x233c('0x32')][_0x233c('0x3b')]);_0x4cd4bd[_0x233c('0x3c')]=qs[_0x233c('0x34')](_[_0x233c('0x3d')](_0x114d10[_0x233c('0x32')],_0x1f323e[_0x233c('0x34')]),_0x5c51a9);if(_0x114d10['query'][_0x233c('0x3e')]){_0x4cd4bd[_0x233c('0x3c')]=_[_0x233c('0x3f')](_0x4cd4bd[_0x233c('0x3c')],{'$or':_[_0x233c('0x31')](_0x5c51a9,function(_0x5c1127){if(_0x5c1127[_0x233c('0x2e')]!==_0x233c('0x40')){var _0x232d47={};_0x232d47[_0x5c1127[_0x233c('0x28')]]={'$like':'%'+_0x114d10['query'][_0x233c('0x3e')]+'%'};return _0x232d47;}})});}_0x4cd4bd=_['merge']({},_0x4cd4bd,_0x114d10[_0x233c('0x41')]);var _0x5e5cc6={'where':_0x4cd4bd['where']};return db[_0x233c('0x2b')]['count'](_0x5e5cc6)[_0x233c('0x24')](function(_0x267141){_0x59baad['count']=_0x267141;if(_0x114d10[_0x233c('0x32')][_0x233c('0x42')]){_0x4cd4bd[_0x233c('0x43')]=[{'all':!![]}];}return db[_0x233c('0x2b')][_0x233c('0x44')](_0x4cd4bd);})[_0x233c('0x24')](function(_0x269d25){_0x59baad[_0x233c('0x45')]=_0x269d25;return _0x59baad;})[_0x233c('0x24')](respondWithFilteredResult(_0x5387f8,_0x4cd4bd))[_0x233c('0x46')](handleError(_0x5387f8,null));};exports[_0x233c('0x47')]=function(_0x618b4d,_0x2e41ee){var _0x324f81={'raw':!![],'where':{'id':_0x618b4d['params']['id']}},_0x39091f={};_0x39091f[_0x233c('0x30')]=_[_0x233c('0x33')](db[_0x233c('0x2b')][_0x233c('0x2c')]);_0x39091f[_0x233c('0x32')]=_[_0x233c('0x33')](_0x618b4d[_0x233c('0x32')]);_0x39091f['filters']=_[_0x233c('0x35')](_0x39091f[_0x233c('0x30')],_0x39091f[_0x233c('0x32')]);_0x324f81['attributes']=_['intersection'](_0x39091f[_0x233c('0x30')],qs['fields'](_0x618b4d[_0x233c('0x32')]['fields']));_0x324f81[_0x233c('0x36')]=_0x324f81[_0x233c('0x36')][_0x233c('0x38')]?_0x324f81[_0x233c('0x36')]:_0x39091f['model'];if(_0x618b4d[_0x233c('0x32')][_0x233c('0x42')]){_0x324f81['include']=[{'all':!![]}];}_0x324f81=_['merge']({},_0x324f81,_0x618b4d[_0x233c('0x41')]);return db[_0x233c('0x2b')][_0x233c('0x48')](_0x324f81)['then'](handleEntityNotFound(_0x2e41ee,null))[_0x233c('0x24')](respondWithResult(_0x2e41ee,null))[_0x233c('0x46')](handleError(_0x2e41ee,null));};exports[_0x233c('0x49')]=function(_0x330426,_0x9ce733){return db[_0x233c('0x2b')][_0x233c('0x49')](_0x330426[_0x233c('0x4a')],{})[_0x233c('0x24')](respondWithResult(_0x9ce733,0xc9))[_0x233c('0x46')](handleError(_0x9ce733,null));};exports['update']=function(_0x7d523d,_0x40ca89){if(_0x7d523d['body']['id']){delete _0x7d523d[_0x233c('0x4a')]['id'];}return db[_0x233c('0x2b')][_0x233c('0x48')]({'where':{'id':_0x7d523d[_0x233c('0x4b')]['id']}})[_0x233c('0x24')](handleEntityNotFound(_0x40ca89,null))['then'](saveUpdates(_0x7d523d[_0x233c('0x4a')],null))[_0x233c('0x24')](respondWithResult(_0x40ca89,null))[_0x233c('0x46')](handleError(_0x40ca89,null));};exports[_0x233c('0x23')]=function(_0x5b1860,_0x41d922){return db[_0x233c('0x2b')][_0x233c('0x48')]({'where':{'id':_0x5b1860['params']['id']}})[_0x233c('0x24')](handleEntityNotFound(_0x41d922,null))['then'](removeEntity(_0x41d922,null))[_0x233c('0x46')](handleError(_0x41d922,null));}; \ No newline at end of file +var _0xa0ab=['Content-Range','apply','reject','update','then','error','name','send','map','OpenchannelApplication','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','destroy','params','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa0ab,0x1e0));var _0xba0a=function(_0x262588,_0x42d3b6){_0x262588=_0x262588-0x0;var _0x55ae16=_0xa0ab[_0x262588];return _0x55ae16;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba0a('0x0'));var zipdir=require(_0xba0a('0x1'));var jsonpatch=require(_0xba0a('0x2'));var rp=require('request-promise');var moment=require(_0xba0a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xba0a('0x4'));var path=require(_0xba0a('0x5'));var sox=require(_0xba0a('0x6'));var csv=require(_0xba0a('0x7'));var ejs=require(_0xba0a('0x8'));var fs=require('fs');var fs_extra=require(_0xba0a('0x9'));var _=require(_0xba0a('0xa'));var squel=require('squel');var crypto=require(_0xba0a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xba0a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xba0a('0xd'));var Papa=require(_0xba0a('0xe'));var Redis=require('ioredis');var authService=require(_0xba0a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xba0a('0x10'));var hardwareService=require(_0xba0a('0x11'));var logger=require(_0xba0a('0x12'))(_0xba0a('0x13'));var utils=require(_0xba0a('0x14'));var config=require(_0xba0a('0x15'));var licenseUtil=require(_0xba0a('0x16'));var db=require(_0xba0a('0x17'))['db'];function respondWithStatusCode(_0x5a1f1a,_0x1e6135){_0x1e6135=_0x1e6135||0xcc;return function(_0x4fe608){if(_0x4fe608){return _0x5a1f1a[_0xba0a('0x18')](_0x1e6135);}return _0x5a1f1a['status'](_0x1e6135)[_0xba0a('0x19')]();};}function respondWithResult(_0x5e5909,_0x4e02e1){_0x4e02e1=_0x4e02e1||0xc8;return function(_0x2d61fa){if(_0x2d61fa){return _0x5e5909[_0xba0a('0x1a')](_0x4e02e1)[_0xba0a('0x1b')](_0x2d61fa);}};}function respondWithFilteredResult(_0x340333,_0x425b78){return function(_0x256cb8){if(_0x256cb8){var _0x2e16a4=typeof _0x425b78[_0xba0a('0x1c')]===_0xba0a('0x1d')&&typeof _0x425b78['limit']==='undefined';var _0x44c2ba=_0x256cb8[_0xba0a('0x1e')];var _0x3a56bd=_0x2e16a4?0x0:_0x425b78[_0xba0a('0x1c')];var _0xabe442=_0x2e16a4?_0x256cb8[_0xba0a('0x1e')]:_0x425b78[_0xba0a('0x1c')]+_0x425b78['limit'];var _0x1034b4;if(_0xabe442>=_0x44c2ba){_0xabe442=_0x44c2ba;_0x1034b4=0xc8;}else{_0x1034b4=0xce;}_0x340333[_0xba0a('0x1a')](_0x1034b4);return _0x340333['set'](_0xba0a('0x1f'),_0x3a56bd+'-'+_0xabe442+'/'+_0x44c2ba)[_0xba0a('0x1b')](_0x256cb8);}return null;};}function patchUpdates(_0x4f4e31){return function(_0x42a457){try{jsonpatch[_0xba0a('0x20')](_0x42a457,_0x4f4e31,!![]);}catch(_0x3a40f2){return BPromise[_0xba0a('0x21')](_0x3a40f2);}return _0x42a457['save']();};}function saveUpdates(_0x581b0c,_0x20cdf6){return function(_0x4d8f02){if(_0x4d8f02){return _0x4d8f02[_0xba0a('0x22')](_0x581b0c)[_0xba0a('0x23')](function(_0x52cb20){return _0x52cb20;});}return null;};}function removeEntity(_0x452867,_0x2cc2bc){return function(_0x4d75c5){if(_0x4d75c5){return _0x4d75c5['destroy']()[_0xba0a('0x23')](function(){_0x452867[_0xba0a('0x1a')](0xcc)[_0xba0a('0x19')]();});}};}function handleEntityNotFound(_0x1fbb3e,_0x42137e){return function(_0x1eb969){if(!_0x1eb969){_0x1fbb3e[_0xba0a('0x18')](0x194);}return _0x1eb969;};}function handleError(_0x5badfe,_0x570d7a){_0x570d7a=_0x570d7a||0x1f4;return function(_0x316593){logger[_0xba0a('0x24')](_0x316593['stack']);if(_0x316593[_0xba0a('0x25')]){delete _0x316593[_0xba0a('0x25')];}_0x5badfe[_0xba0a('0x1a')](_0x570d7a)[_0xba0a('0x26')](_0x316593);};}exports['index']=function(_0x18f55a,_0x1ffb33){var _0x69b3f1={},_0x1db900={},_0x11eec1={'count':0x0,'rows':[]};var _0xb5ebec=_[_0xba0a('0x27')](db[_0xba0a('0x28')]['rawAttributes'],function(_0xe7c274){return{'name':_0xe7c274[_0xba0a('0x29')],'type':_0xe7c274[_0xba0a('0x2a')][_0xba0a('0x2b')]};});_0x1db900[_0xba0a('0x2c')]=_[_0xba0a('0x27')](_0xb5ebec,'name');_0x1db900[_0xba0a('0x2d')]=_[_0xba0a('0x2e')](_0x18f55a[_0xba0a('0x2d')]);_0x1db900[_0xba0a('0x2f')]=_['intersection'](_0x1db900['model'],_0x1db900['query']);_0x69b3f1[_0xba0a('0x30')]=_[_0xba0a('0x31')](_0x1db900['model'],qs[_0xba0a('0x32')](_0x18f55a[_0xba0a('0x2d')][_0xba0a('0x32')]));_0x69b3f1[_0xba0a('0x30')]=_0x69b3f1[_0xba0a('0x30')][_0xba0a('0x33')]?_0x69b3f1[_0xba0a('0x30')]:_0x1db900[_0xba0a('0x2c')];if(!_0x18f55a[_0xba0a('0x2d')][_0xba0a('0x34')](_0xba0a('0x35'))){_0x69b3f1[_0xba0a('0x36')]=qs[_0xba0a('0x36')](_0x18f55a[_0xba0a('0x2d')]['limit']);_0x69b3f1['offset']=qs[_0xba0a('0x1c')](_0x18f55a[_0xba0a('0x2d')][_0xba0a('0x1c')]);}_0x69b3f1[_0xba0a('0x37')]=qs[_0xba0a('0x38')](_0x18f55a[_0xba0a('0x2d')][_0xba0a('0x38')]);_0x69b3f1['where']=qs[_0xba0a('0x2f')](_[_0xba0a('0x39')](_0x18f55a[_0xba0a('0x2d')],_0x1db900['filters']),_0xb5ebec);if(_0x18f55a['query'][_0xba0a('0x3a')]){_0x69b3f1[_0xba0a('0x3b')]=_[_0xba0a('0x3c')](_0x69b3f1['where'],{'$or':_['map'](_0xb5ebec,function(_0xd2e61f){if(_0xd2e61f['type']!=='VIRTUAL'){var _0x523df7={};_0x523df7[_0xd2e61f['name']]={'$like':'%'+_0x18f55a[_0xba0a('0x2d')][_0xba0a('0x3a')]+'%'};return _0x523df7;}})});}_0x69b3f1=_['merge']({},_0x69b3f1,_0x18f55a[_0xba0a('0x3d')]);var _0x4d1747={'where':_0x69b3f1['where']};return db[_0xba0a('0x28')]['count'](_0x4d1747)[_0xba0a('0x23')](function(_0x40a8cc){_0x11eec1[_0xba0a('0x1e')]=_0x40a8cc;if(_0x18f55a[_0xba0a('0x2d')][_0xba0a('0x3e')]){_0x69b3f1[_0xba0a('0x3f')]=[{'all':!![]}];}return db[_0xba0a('0x28')][_0xba0a('0x40')](_0x69b3f1);})[_0xba0a('0x23')](function(_0x1b0468){_0x11eec1[_0xba0a('0x41')]=_0x1b0468;return _0x11eec1;})['then'](respondWithFilteredResult(_0x1ffb33,_0x69b3f1))[_0xba0a('0x42')](handleError(_0x1ffb33,null));};exports['show']=function(_0x120bf9,_0x234c1d){var _0x5a41a7={'raw':!![],'where':{'id':_0x120bf9['params']['id']}},_0x2b8345={};_0x2b8345[_0xba0a('0x2c')]=_[_0xba0a('0x2e')](db[_0xba0a('0x28')][_0xba0a('0x43')]);_0x2b8345[_0xba0a('0x2d')]=_['keys'](_0x120bf9['query']);_0x2b8345['filters']=_[_0xba0a('0x31')](_0x2b8345[_0xba0a('0x2c')],_0x2b8345[_0xba0a('0x2d')]);_0x5a41a7[_0xba0a('0x30')]=_['intersection'](_0x2b8345['model'],qs['fields'](_0x120bf9['query'][_0xba0a('0x32')]));_0x5a41a7[_0xba0a('0x30')]=_0x5a41a7[_0xba0a('0x30')][_0xba0a('0x33')]?_0x5a41a7[_0xba0a('0x30')]:_0x2b8345[_0xba0a('0x2c')];if(_0x120bf9['query'][_0xba0a('0x3e')]){_0x5a41a7[_0xba0a('0x3f')]=[{'all':!![]}];}_0x5a41a7=_['merge']({},_0x5a41a7,_0x120bf9[_0xba0a('0x3d')]);return db[_0xba0a('0x28')][_0xba0a('0x44')](_0x5a41a7)[_0xba0a('0x23')](handleEntityNotFound(_0x234c1d,null))['then'](respondWithResult(_0x234c1d,null))[_0xba0a('0x42')](handleError(_0x234c1d,null));};exports[_0xba0a('0x45')]=function(_0x330ee1,_0x1ab9d9){return db[_0xba0a('0x28')][_0xba0a('0x45')](_0x330ee1['body'],{})[_0xba0a('0x23')](respondWithResult(_0x1ab9d9,0xc9))['catch'](handleError(_0x1ab9d9,null));};exports['update']=function(_0x5797bc,_0x530c6b){if(_0x5797bc[_0xba0a('0x46')]['id']){delete _0x5797bc['body']['id'];}return db[_0xba0a('0x28')][_0xba0a('0x44')]({'where':{'id':_0x5797bc['params']['id']}})[_0xba0a('0x23')](handleEntityNotFound(_0x530c6b,null))[_0xba0a('0x23')](saveUpdates(_0x5797bc[_0xba0a('0x46')],null))['then'](respondWithResult(_0x530c6b,null))[_0xba0a('0x42')](handleError(_0x530c6b,null));};exports[_0xba0a('0x47')]=function(_0x125041,_0x2c283b){return db[_0xba0a('0x28')][_0xba0a('0x44')]({'where':{'id':_0x125041[_0xba0a('0x48')]['id']}})[_0xba0a('0x23')](handleEntityNotFound(_0x2c283b,null))['then'](removeEntity(_0x2c283b,null))['catch'](handleError(_0x2c283b,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index a6f5157..22028f7 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 _0x2cb6=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment'];(function(_0x4a05a7,_0x510471){var _0xd63d0c=function(_0x45978a){while(--_0x45978a){_0x4a05a7['push'](_0x4a05a7['shift']());}};_0xd63d0c(++_0x510471);}(_0x2cb6,0xcf));var _0x62cb=function(_0x42c27f,_0x1d8bad){_0x42c27f=_0x42c27f-0x0;var _0x306d33=_0x2cb6[_0x42c27f];return _0x306d33;};'use strict';var _=require('lodash');var util=require(_0x62cb('0x0'));var logger=require('../../config/logger')(_0x62cb('0x1'));var moment=require(_0x62cb('0x2'));var BPromise=require(_0x62cb('0x3'));var rp=require(_0x62cb('0x4'));var fs=require('fs');var path=require(_0x62cb('0x5'));var rimraf=require(_0x62cb('0x6'));var config=require(_0x62cb('0x7'));var attributes=require(_0x62cb('0x8'));module[_0x62cb('0x9')]=function(_0xf1f9cb,_0x25140b){return _0xf1f9cb[_0x62cb('0xa')](_0x62cb('0xb'),attributes,{'tableName':_0x62cb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x62cb('0xd'),'collate':_0x62cb('0xe')});}; \ No newline at end of file +var _0xe300=['utf8mb4_unicode_ci','util','api','moment','bluebird','rimraf','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x155106,_0x531b23){var _0x33490f=function(_0x210b80){while(--_0x210b80){_0x155106['push'](_0x155106['shift']());}};_0x33490f(++_0x531b23);}(_0xe300,0x12a));var _0x0e30=function(_0xeca072,_0x274726){_0xeca072=_0xeca072-0x0;var _0x52d6a3=_0xe300[_0xeca072];return _0x52d6a3;};'use strict';var _=require('lodash');var util=require(_0x0e30('0x0'));var logger=require('../../config/logger')(_0x0e30('0x1'));var moment=require(_0x0e30('0x2'));var BPromise=require(_0x0e30('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0e30('0x4'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0x0e30('0x5')]=function(_0x49bd6f,_0x5d1127){return _0x49bd6f[_0x0e30('0x6')](_0x0e30('0x7'),attributes,{'tableName':_0x0e30('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0e30('0x9'),'collate':_0x0e30('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 14e27ac..8482842 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 _0xd889=['http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','options','attributes','then','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x129d0e,_0x247222){var _0x418401=function(_0x294277){while(--_0x294277){_0x129d0e['push'](_0x129d0e['shift']());}};_0x418401(++_0x247222);}(_0xd889,0x8f));var _0x9d88=function(_0x4a28e6,_0x20f27e){_0x4a28e6=_0x4a28e6-0x0;var _0xb0c2e2=_0xd889[_0x4a28e6];return _0xb0c2e2;};'use strict';var _=require('lodash');var util=require(_0x9d88('0x0'));var moment=require(_0x9d88('0x1'));var BPromise=require(_0x9d88('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d88('0x3'))['db'];var utils=require(_0x9d88('0x4'));var logger=require(_0x9d88('0x5'))(_0x9d88('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9d88('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xb96698,_0x323fbc,_0x19492c){return new BPromise(function(_0xb8643f,_0x4e1bdc){return client[_0x9d88('0x8')](_0xb96698,_0x19492c)['then'](function(_0x27bb25){logger[_0x9d88('0x9')](_0x9d88('0xa'),_0x323fbc,'request\x20sent');logger[_0x9d88('0xb')](_0x9d88('0xc'),_0x323fbc,_0x9d88('0xd'),JSON[_0x9d88('0xe')](_0x27bb25));if(_0x27bb25['error']){if(_0x27bb25['error'][_0x9d88('0xf')]===0x1f4){logger[_0x9d88('0x10')](_0x9d88('0xa'),_0x323fbc,_0x27bb25[_0x9d88('0x10')][_0x9d88('0x11')]);return _0x4e1bdc(_0x27bb25[_0x9d88('0x10')][_0x9d88('0x11')]);}logger[_0x9d88('0x10')](_0x9d88('0xa'),_0x323fbc,_0x27bb25[_0x9d88('0x10')]['message']);return _0xb8643f(_0x27bb25[_0x9d88('0x10')][_0x9d88('0x11')]);}else{logger[_0x9d88('0x9')]('OpenchannelApplication,\x20%s,\x20%s',_0x323fbc,_0x9d88('0xd'));_0xb8643f(_0x27bb25[_0x9d88('0x12')][_0x9d88('0x11')]);}})['catch'](function(_0x367daf){logger[_0x9d88('0x10')](_0x9d88('0xa'),_0x323fbc,_0x367daf);_0x4e1bdc(_0x367daf);});});}exports[_0x9d88('0x13')]=function(_0x205833){var _0xae9d81=this;return new Promise(function(_0x45b4ab,_0x5d09f7){return db[_0x9d88('0x14')]['update'](_0x205833['body'],{'raw':_0x205833[_0x9d88('0x15')]?_0x205833['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x205833[_0x9d88('0x15')]?_0x205833['options']['where']||null:null,'attributes':_0x205833[_0x9d88('0x15')]?_0x205833[_0x9d88('0x15')][_0x9d88('0x16')]||null:null,'limit':_0x205833[_0x9d88('0x15')]?_0x205833[_0x9d88('0x15')]['limit']||null:null})[_0x9d88('0x17')](function(_0x5218c2){logger['info'](_0x9d88('0x13'),_0x205833);logger['debug']('UpdateOpenchannelApplication',_0x205833,JSON['stringify'](_0x5218c2));_0x45b4ab(_0x5218c2);})[_0x9d88('0x18')](function(_0x84de79){logger[_0x9d88('0x10')](_0x9d88('0x13'),_0x84de79[_0x9d88('0x11')],_0x205833);_0x5d09f7(_0xae9d81['error'](0x1f4,_0x84de79[_0x9d88('0x11')]));});});}; \ No newline at end of file +var _0xaf44=['update','body','options','where','attributes','info','UpdateOpenchannelApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','OpenchannelApplication'];(function(_0x58dfc7,_0x455e4b){var _0x25fb0b=function(_0x2a3acc){while(--_0x2a3acc){_0x58dfc7['push'](_0x58dfc7['shift']());}};_0x25fb0b(++_0x455e4b);}(_0xaf44,0x83));var _0x4af4=function(_0x11e89b,_0x67d49f){_0x11e89b=_0x11e89b-0x0;var _0x41a5f2=_0xaf44[_0x11e89b];return _0x41a5f2;};'use strict';var _=require(_0x4af4('0x0'));var util=require(_0x4af4('0x1'));var moment=require(_0x4af4('0x2'));var BPromise=require(_0x4af4('0x3'));var rs=require(_0x4af4('0x4'));var fs=require('fs');var Redis=require(_0x4af4('0x5'));var db=require(_0x4af4('0x6'))['db'];var utils=require(_0x4af4('0x7'));var logger=require(_0x4af4('0x8'))('rpc');var config=require(_0x4af4('0x9'));var jayson=require(_0x4af4('0xa'));var client=jayson[_0x4af4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4408dc,_0x3e1693,_0x5375e5){return new BPromise(function(_0x2aa0c3,_0x1de8f4){return client[_0x4af4('0xc')](_0x4408dc,_0x5375e5)[_0x4af4('0xd')](function(_0x155bcb){logger['info'](_0x4af4('0xe'),_0x3e1693,_0x4af4('0xf'));logger[_0x4af4('0x10')](_0x4af4('0x11'),_0x3e1693,_0x4af4('0xf'),JSON[_0x4af4('0x12')](_0x155bcb));if(_0x155bcb[_0x4af4('0x13')]){if(_0x155bcb['error']['code']===0x1f4){logger[_0x4af4('0x13')](_0x4af4('0xe'),_0x3e1693,_0x155bcb[_0x4af4('0x13')][_0x4af4('0x14')]);return _0x1de8f4(_0x155bcb['error'][_0x4af4('0x14')]);}logger[_0x4af4('0x13')](_0x4af4('0xe'),_0x3e1693,_0x155bcb[_0x4af4('0x13')][_0x4af4('0x14')]);return _0x2aa0c3(_0x155bcb[_0x4af4('0x13')][_0x4af4('0x14')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x3e1693,_0x4af4('0xf'));_0x2aa0c3(_0x155bcb[_0x4af4('0x15')][_0x4af4('0x14')]);}})[_0x4af4('0x16')](function(_0x42d8af){logger[_0x4af4('0x13')](_0x4af4('0xe'),_0x3e1693,_0x42d8af);_0x1de8f4(_0x42d8af);});});}exports['UpdateOpenchannelApplication']=function(_0x441fe8){var _0x2e73f7=this;return new Promise(function(_0x317b96,_0x2e2005){return db[_0x4af4('0x17')][_0x4af4('0x18')](_0x441fe8[_0x4af4('0x19')],{'raw':_0x441fe8[_0x4af4('0x1a')]?_0x441fe8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x441fe8[_0x4af4('0x1a')]?_0x441fe8[_0x4af4('0x1a')][_0x4af4('0x1b')]||null:null,'attributes':_0x441fe8[_0x4af4('0x1a')]?_0x441fe8[_0x4af4('0x1a')][_0x4af4('0x1c')]||null:null,'limit':_0x441fe8[_0x4af4('0x1a')]?_0x441fe8[_0x4af4('0x1a')]['limit']||null:null})[_0x4af4('0xd')](function(_0x84089f){logger[_0x4af4('0x1d')](_0x4af4('0x1e'),_0x441fe8);logger[_0x4af4('0x10')](_0x4af4('0x1e'),_0x441fe8,JSON[_0x4af4('0x12')](_0x84089f));_0x317b96(_0x84089f);})[_0x4af4('0x16')](function(_0x5bc08b){logger[_0x4af4('0x13')](_0x4af4('0x1e'),_0x5bc08b['message'],_0x441fe8);_0x2e2005(_0x2e73f7[_0x4af4('0x13')](0x1f4,_0x5bc08b['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index e2f15bf..5b18cc7 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 _0x2d4c=['../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','getMessages','download','post','create','/:id/messages','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','/:id/tags','removeTags','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x2d4c,0x19e));var _0xc2d4=function(_0x1a4c68,_0x159b67){_0x1a4c68=_0x1a4c68-0x0;var _0x354e3f=_0x2d4c[_0x1a4c68];return _0x354e3f;};'use strict';var multer=require(_0xc2d4('0x0'));var util=require(_0xc2d4('0x1'));var path=require(_0xc2d4('0x2'));var timeout=require('connect-timeout');var express=require(_0xc2d4('0x3'));var router=express[_0xc2d4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc2d4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc2d4('0x6'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0xc2d4('0x7')](),controller[_0xc2d4('0x8')]);router[_0xc2d4('0x9')](_0xc2d4('0xa'),auth[_0xc2d4('0x7')](),controller[_0xc2d4('0xb')]);router['get'](_0xc2d4('0xc'),auth[_0xc2d4('0x7')](),controller['show']);router['get']('/:id/messages',auth[_0xc2d4('0x7')](),controller[_0xc2d4('0xd')]);router['get']('/:id/download',auth[_0xc2d4('0x7')](),controller[_0xc2d4('0xe')]);router[_0xc2d4('0xf')]('/',auth[_0xc2d4('0x7')](),controller[_0xc2d4('0x10')]);router[_0xc2d4('0xf')](_0xc2d4('0x11'),auth[_0xc2d4('0x7')](),controller['addMessage']);router[_0xc2d4('0xf')]('/:id/tags',auth[_0xc2d4('0x7')](),interaction[_0xc2d4('0x12')](_0xc2d4('0x13'),_0xc2d4('0x14')),controller[_0xc2d4('0x15')]);router['put'](_0xc2d4('0xc'),auth[_0xc2d4('0x7')](),interaction['tracked'](_0xc2d4('0x13'),_0xc2d4('0x16')),controller[_0xc2d4('0x17')]);router[_0xc2d4('0x18')]('/:id',auth[_0xc2d4('0x7')](),interaction[_0xc2d4('0x12')](_0xc2d4('0x13'),'openchannelinteraction:destroy'),controller['destroy']);router[_0xc2d4('0x18')](_0xc2d4('0x19'),auth[_0xc2d4('0x7')](),controller[_0xc2d4('0x1a')]);module[_0xc2d4('0x1b')]=router; \ No newline at end of file +var _0x0014=['/:id/messages','/:id/download','post','addMessage','/:id/tags','openchannelinteraction:addtags','addTags','put','/:id','tracked','openchannel','delete','openchannelinteraction:destroy','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','show'];(function(_0x1064fb,_0x32b8a1){var _0x54224d=function(_0x3e2af7){while(--_0x3e2af7){_0x1064fb['push'](_0x1064fb['shift']());}};_0x54224d(++_0x32b8a1);}(_0x0014,0x138));var _0x4001=function(_0x38f0de,_0x2c0826){_0x38f0de=_0x38f0de-0x0;var _0x2a1634=_0x0014[_0x38f0de];return _0x2a1634;};'use strict';var multer=require(_0x4001('0x0'));var util=require('util');var path=require(_0x4001('0x1'));var timeout=require(_0x4001('0x2'));var express=require('express');var router=express[_0x4001('0x3')]();var fs_extra=require(_0x4001('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4001('0x5'));var config=require(_0x4001('0x6'));var controller=require(_0x4001('0x7'));router[_0x4001('0x8')]('/',auth[_0x4001('0x9')](),controller['index']);router[_0x4001('0x8')](_0x4001('0xa'),auth[_0x4001('0x9')](),controller['describe']);router[_0x4001('0x8')]('/:id',auth[_0x4001('0x9')](),controller[_0x4001('0xb')]);router[_0x4001('0x8')](_0x4001('0xc'),auth[_0x4001('0x9')](),controller['getMessages']);router[_0x4001('0x8')](_0x4001('0xd'),auth[_0x4001('0x9')](),controller['download']);router[_0x4001('0xe')]('/',auth[_0x4001('0x9')](),controller['create']);router['post'](_0x4001('0xc'),auth[_0x4001('0x9')](),controller[_0x4001('0xf')]);router['post'](_0x4001('0x10'),auth[_0x4001('0x9')](),interaction['tracked']('openchannel',_0x4001('0x11')),controller[_0x4001('0x12')]);router[_0x4001('0x13')](_0x4001('0x14'),auth[_0x4001('0x9')](),interaction[_0x4001('0x15')](_0x4001('0x16'),'openchannelinteraction:update'),controller['update']);router[_0x4001('0x17')]('/:id',auth[_0x4001('0x9')](),interaction['tracked'](_0x4001('0x16'),_0x4001('0x18')),controller[_0x4001('0x19')]);router[_0x4001('0x17')]('/:id/tags',auth[_0x4001('0x9')](),controller['removeTags']);module[_0x4001('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 9921913..167f50b 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 _0x8eac=['BOOLEAN','DATE','STRING','ENUM','sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8eac,0x11c));var _0xc8ea=function(_0x45b36c,_0x4efbfe){_0x45b36c=_0x45b36c-0x0;var _0x1dad2f=_0x8eac[_0x45b36c];return _0x1dad2f;};'use strict';var Sequelize=require(_0xc8ea('0x0'));module['exports']={'closed':{'type':Sequelize[_0xc8ea('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc8ea('0x2')]},'disposition':{'type':Sequelize[_0xc8ea('0x3')]},'secondDisposition':{'type':Sequelize[_0xc8ea('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc8ea('0x3')]},'note':{'type':Sequelize[_0xc8ea('0x3')]},'read1stAt':{'type':Sequelize[_0xc8ea('0x2')]},'threadId':{'type':Sequelize[_0xc8ea('0x3')]},'externalUrl':{'type':Sequelize[_0xc8ea('0x3')]},'lastMsgAt':{'type':Sequelize[_0xc8ea('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xc8ea('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xc8ea('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xc8ea('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x653d=['out','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x653d,0x133));var _0xd653=function(_0x40135f,_0x36ca6f){_0x40135f=_0x40135f-0x0;var _0x3c9f38=_0x653d[_0x40135f];return _0x3c9f38;};'use strict';var Sequelize=require('sequelize');module[_0xd653('0x0')]={'closed':{'type':Sequelize[_0xd653('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd653('0x2')]},'disposition':{'type':Sequelize[_0xd653('0x3')]},'secondDisposition':{'type':Sequelize[_0xd653('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd653('0x3')]},'note':{'type':Sequelize[_0xd653('0x3')]},'read1stAt':{'type':Sequelize[_0xd653('0x2')]},'threadId':{'type':Sequelize[_0xd653('0x3')]},'externalUrl':{'type':Sequelize[_0xd653('0x3')]},'lastMsgAt':{'type':Sequelize[_0xd653('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xd653('0x4')]('in',_0xd653('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd653('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 724e1a2..ccbbefa 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 _0x6b55=['closed','UserId','OpenchannelInteraction','type','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','select','field','color','tools_tags','u.id','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','users','openchannel_interactions','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','buildExpression','text','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','groupBy','OpenchannelInteractionId','all','rows','show','params','rawAttributes','filters','includeAll','options','create','body','update','destroy','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','emit','openchannelInteractionTags:save','removeTags','unix','join','root','files','tmp','server','transcript-%d-%s.zip','firstName','lastName','attachments','Attachment','createdAt','direction','secret','Account','Owner','get','mkdirSync','Openchannel','closedAt','threadId','Public','Private','Messages','basename','existsSync','createReadStream','createWriteStream','out','System','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','eml-format','rimraf','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','end','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','total'];(function(_0xc6e4ea,_0x35edbe){var _0x76c775=function(_0x7dbd2b){while(--_0x7dbd2b){_0xc6e4ea['push'](_0xc6e4ea['shift']());}};_0x76c775(++_0x35edbe);}(_0x6b55,0x19c));var _0x56b5=function(_0x26b545,_0x1a853c){_0x26b545=_0x26b545-0x0;var _0x333459=_0x6b55[_0x26b545];return _0x333459;};'use strict';var emlformat=require(_0x56b5('0x0'));var rimraf=require(_0x56b5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x56b5('0x2'));var BPromise=require(_0x56b5('0x3'));var Mustache=require('mustache');var util=require(_0x56b5('0x4'));var path=require(_0x56b5('0x5'));var sox=require(_0x56b5('0x6'));var csv=require('to-csv');var ejs=require(_0x56b5('0x7'));var fs=require('fs');var fs_extra=require(_0x56b5('0x8'));var _=require(_0x56b5('0x9'));var squel=require(_0x56b5('0xa'));var crypto=require(_0x56b5('0xb'));var jsforce=require(_0x56b5('0xc'));var deskjs=require(_0x56b5('0xd'));var toCsv=require(_0x56b5('0xe'));var querystring=require(_0x56b5('0xf'));var Papa=require(_0x56b5('0x10'));var Redis=require('ioredis');var authService=require(_0x56b5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x56b5('0x12'));var pdf=require(_0x56b5('0x13'));var hardwareService=require(_0x56b5('0x14'));var logger=require(_0x56b5('0x15'))(_0x56b5('0x16'));var utils=require('../../config/utils');var config=require(_0x56b5('0x17'));var licenseUtil=require(_0x56b5('0x18'));var db=require(_0x56b5('0x19'))['db'];config[_0x56b5('0x1a')]=_[_0x56b5('0x1b')](config[_0x56b5('0x1a')],{'host':_0x56b5('0x1c'),'port':0x18eb});var socket=require(_0x56b5('0x1d'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x56b5('0x1e')](socket);function respondWithStatusCode(_0x1519a2,_0x4ee18f){_0x4ee18f=_0x4ee18f||0xcc;return function(_0x188e60){if(_0x188e60){return _0x1519a2[_0x56b5('0x1f')](_0x4ee18f);}return _0x1519a2[_0x56b5('0x20')](_0x4ee18f)['end']();};}function respondWithResult(_0x5b9b6c,_0x7de4c0){_0x7de4c0=_0x7de4c0||0xc8;return function(_0x20be1a){if(_0x20be1a){return _0x5b9b6c['status'](_0x7de4c0)[_0x56b5('0x21')](_0x20be1a);}};}function respondWithFilteredResult(_0x5d1cc1,_0x3a0263){return function(_0x24512b){if(_0x24512b){var _0xaaeb03=typeof _0x3a0263[_0x56b5('0x22')]===_0x56b5('0x23')&&typeof _0x3a0263[_0x56b5('0x24')]==='undefined';var _0x2e66a5=_0x24512b[_0x56b5('0x25')];var _0x5e3680=_0xaaeb03?0x0:_0x3a0263[_0x56b5('0x22')];var _0x10dc49=_0xaaeb03?_0x24512b[_0x56b5('0x25')]:_0x3a0263[_0x56b5('0x22')]+_0x3a0263[_0x56b5('0x24')];var _0x2738f9;if(_0x10dc49>=_0x2e66a5){_0x10dc49=_0x2e66a5;_0x2738f9=0xc8;}else{_0x2738f9=0xce;}_0x5d1cc1['status'](_0x2738f9);return _0x5d1cc1['set'](_0x56b5('0x26'),_0x5e3680+'-'+_0x10dc49+'/'+_0x2e66a5)['json'](_0x24512b);}return null;};}function patchUpdates(_0x593113){return function(_0x3e8fd0){try{jsonpatch[_0x56b5('0x27')](_0x3e8fd0,_0x593113,!![]);}catch(_0x476cc9){return BPromise[_0x56b5('0x28')](_0x476cc9);}return _0x3e8fd0['save']();};}function saveUpdates(_0x32fecb,_0x1bd4d3){return function(_0x102c1c){if(_0x102c1c){return _0x102c1c['update'](_0x32fecb)[_0x56b5('0x29')](function(_0x317efe){return _0x317efe;});}return null;};}function removeEntity(_0x2f8fa1,_0x1d6051){return function(_0x4c7ca8){if(_0x4c7ca8){return _0x4c7ca8['destroy']()['then'](function(){_0x2f8fa1[_0x56b5('0x20')](0xcc)[_0x56b5('0x2a')]();});}};}function handleEntityNotFound(_0x4531e1,_0x538f99){return function(_0xe593a8){if(!_0xe593a8){_0x4531e1['sendStatus'](0x194);}return _0xe593a8;};}function handleError(_0x16199a,_0x38b855){_0x38b855=_0x38b855||0x1f4;return function(_0xe2b4d5){logger[_0x56b5('0x2b')](_0xe2b4d5[_0x56b5('0x2c')]);if(_0xe2b4d5[_0x56b5('0x2d')]){delete _0xe2b4d5[_0x56b5('0x2d')];}_0x16199a[_0x56b5('0x20')](_0x38b855)['send'](_0xe2b4d5);};}function getInteractionUsers(_0x30c12a,_0x4accba){return new BPromise(function(_0x3d1a0a,_0x114e53){try{if(_0x4accba[_0x30c12a['id']]){_0x30c12a[_0x56b5('0x2e')]=_[_0x56b5('0x2f')](_0x4accba[_0x30c12a['id']],function(_0x3b1c48){return{'id':_0x3b1c48['id'],'fullname':_0x3b1c48[_0x56b5('0x30')]};});}}catch(_0x46f821){_0x114e53(_0x46f821);}_0x3d1a0a(_0x30c12a);});}function getInteractionTags(_0x3359fb,_0x4547d8){return new BPromise(function(_0x5e1d0d,_0x13e6c0){try{if(_0x3359fb[_0x56b5('0x31')]){_0x3359fb[_0x56b5('0x32')]=[];_0x3359fb[_0x56b5('0x31')][_0x56b5('0x33')](',')[_0x56b5('0x34')](function(_0x1c7988){_0x3359fb['Tags'][_0x56b5('0x35')](_0x4547d8[_0x1c7988]);});}delete _0x3359fb[_0x56b5('0x31')];}catch(_0xca63dd){_0x13e6c0(_0xca63dd);}_0x5e1d0d(_0x3359fb);});}function updateOpenchannelInteraction(_0x528a33,_0x4a5e2a,_0x4e41d9){return new BPromise(function(_0x24e9d7,_0x5f2ce4){return getInteractionUsers(_0x528a33,_0x4e41d9)[_0x56b5('0x29')](function(_0xf50c22){return getInteractionTags(_0xf50c22,_0x4a5e2a);})['then'](function(_0x2c7995){return getStateInteraction(_0x2c7995);})[_0x56b5('0x29')](function(_0x382c83){_0x24e9d7(_0x382c83);})[_0x56b5('0x36')](function(_0xd81f10){_0x5f2ce4(_0xd81f10);});});}function getStateInteraction(_0x2a14df){return new BPromise(function(_0x48def4){_0x2a14df[_0x56b5('0x37')]=0x0;_0x2a14df[_0x56b5('0x38')]=0x0;_0x2a14df[_0x56b5('0x39')]=0x0;_0x2a14df[_0x56b5('0x3a')]=0x0;_0x2a14df[_0x56b5('0x3b')]=0x0;if(!_0x2a14df['closed']&&!_0x2a14df['UserId']){_0x2a14df[_0x56b5('0x37')]+=0x1;}if(!_0x2a14df[_0x56b5('0x3c')]&&_0x2a14df[_0x56b5('0x3d')]){_0x2a14df[_0x56b5('0x38')]+=0x1;if(_0x2a14df[_0x56b5('0x37')]){_0x2a14df[_0x56b5('0x37')]-=0x1;}}if(_0x2a14df[_0x56b5('0x3c')]&&_0x2a14df[_0x56b5('0x3d')]){_0x2a14df[_0x56b5('0x39')]+=0x1;if(_0x2a14df['talking']){_0x2a14df[_0x56b5('0x38')]-=0x1;}}if(_0x2a14df[_0x56b5('0x3c')]&&!_0x2a14df[_0x56b5('0x3d')]){_0x2a14df[_0x56b5('0x3a')]+=0x1;if(_0x2a14df[_0x56b5('0x37')]){_0x2a14df[_0x56b5('0x37')]-=0x1;}}_0x2a14df['total']+=0x1;_0x48def4(_0x2a14df);});}exports['index']=function(_0x589c0f,_0x232cc3){var _0x5f5271={},_0x6cbfe9={},_0x56cfdb={'count':0x0,'rows':[]};var _0x5625b4=_['map'](db[_0x56b5('0x3e')]['rawAttributes'],function(_0x15715b){return{'name':_0x15715b['fieldName'],'type':_0x15715b[_0x56b5('0x3f')]['key']};});_0x6cbfe9['model']=_['map'](_0x5625b4,_0x56b5('0x2d'));_0x6cbfe9['query']=_[_0x56b5('0x40')](_0x589c0f[_0x56b5('0x41')]);_0x6cbfe9['filters']=_[_0x56b5('0x42')](_0x6cbfe9[_0x56b5('0x43')],_0x6cbfe9[_0x56b5('0x41')]);_0x5f5271[_0x56b5('0x44')]=_[_0x56b5('0x42')](_0x6cbfe9[_0x56b5('0x43')],qs[_0x56b5('0x45')](_0x589c0f[_0x56b5('0x41')][_0x56b5('0x45')]));_0x5f5271[_0x56b5('0x44')]=_0x5f5271[_0x56b5('0x44')][_0x56b5('0x46')]?_0x5f5271['attributes']:_0x6cbfe9[_0x56b5('0x43')];if(!_0x589c0f[_0x56b5('0x41')][_0x56b5('0x47')](_0x56b5('0x48'))){_0x5f5271[_0x56b5('0x24')]=qs[_0x56b5('0x24')](_0x589c0f[_0x56b5('0x41')][_0x56b5('0x24')]);_0x5f5271[_0x56b5('0x22')]=qs['offset'](_0x589c0f[_0x56b5('0x41')]['offset']);}_0x5f5271['order']=qs['sort'](_0x589c0f[_0x56b5('0x41')][_0x56b5('0x49')]);_0x5f5271[_0x56b5('0x4a')]=qs['filters'](_['pick'](_0x589c0f[_0x56b5('0x41')],_0x6cbfe9['filters']),_0x5625b4);var _0x357fd5=[];var _0x4bddc1=squel[_0x56b5('0x4b')]()['field']('id')[_0x56b5('0x4c')](_0x56b5('0x2d'))[_0x56b5('0x4c')](_0x56b5('0x4d'))['from'](_0x56b5('0x4e'));var _0x5d1e8f=squel[_0x56b5('0x4b')]()[_0x56b5('0x4c')](_0x56b5('0x4f'))['field']('u.fullname')[_0x56b5('0x4c')](_0x56b5('0x50'))[_0x56b5('0x51')](_0x56b5('0x52'),'ui')[_0x56b5('0x53')](_0x56b5('0x54'),'u','u.id\x20=\x20ui.UserId');var _0x513e6e=squel[_0x56b5('0x4b')]()[_0x56b5('0x51')](_0x56b5('0x55'),'i')['left_join'](_0x56b5('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x56b5('0x53')](_0x56b5('0x54'),'o',_0x56b5('0x57'))[_0x56b5('0x53')](_0x56b5('0x58'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0x56b5('0x53')](_0x56b5('0x59'),'me',_0x56b5('0x5a'))[_0x56b5('0x53')](_0x56b5('0x5b'),'it',_0x56b5('0x5c'))[_0x56b5('0x53')](_0x56b5('0x4e'),'t',_0x56b5('0x5d'));var _0x34bdc2=squel[_0x56b5('0x5e')]();var _0x54c59c=[];var _0x5d7866=squel['expr']();var _0x49dc64;if(_0x589c0f[_0x56b5('0x41')][_0x56b5('0x5f')]){_0x49dc64=as['parseSearch'](_0x589c0f['query'][_0x56b5('0x5f')]);var _0x46bfcd=_0x49dc64[_0x56b5('0x60')];for(var _0x3bfdca=0x0;_0x3bfdca<_0x49dc64['conditions']['length'];_0x3bfdca++){var _0x13fda1=_0x49dc64['conditions'][_0x3bfdca];var _0x6210a='i';var _0x33f76d=_['find'](_0x5625b4,[_0x56b5('0x2d'),_0x13fda1[_0x56b5('0x4c')]]);if(!_0x33f76d){switch(_0x13fda1[_0x56b5('0x4c')]){case _0x56b5('0x61'):if(_0x13fda1[_0x56b5('0x62')]==0x1){_0x513e6e[_0x56b5('0x63')]('`'+_0x13fda1['field']+_0x56b5('0x64'));}else{_0x513e6e['having']('`'+_0x13fda1[_0x56b5('0x4c')]+_0x56b5('0x65'));}break;case _0x56b5('0x66'):if(_0x13fda1['operator']===_0x56b5('0x67')){if(_0x13fda1[_0x56b5('0x62')][_0x56b5('0x33')]('\x20')[_0x56b5('0x46')]>0x1){_0x34bdc2[_0x46bfcd](_0x56b5('0x68'),qs[_0x56b5('0x69')](_0x13fda1[_0x56b5('0x62')]),null);}else{var _0x28d9f3='%'+_0x13fda1[_0x56b5('0x62')]+'%';_0x34bdc2[_0x46bfcd](_0x56b5('0x6a'),_0x28d9f3,_0x28d9f3,_0x28d9f3);}}else{_0x33f76d=_[_0x56b5('0x6b')](_0x5625b4,['name',_0x56b5('0x6c')]);_0x13fda1[_0x56b5('0x4c')]='ContactId';_0x201e96=as['buildExpression'](_0x6210a,_0x33f76d[_0x56b5('0x3f')],_0x13fda1);_0x34bdc2[_0x46bfcd](_0x201e96['text'],_0x201e96[_0x56b5('0x62')][_0x56b5('0x6d')],_0x201e96[_0x56b5('0x62')][_0x56b5('0x2a')]);}break;case _0x56b5('0x6e'):var _0x4aa628=_0x13fda1[_0x56b5('0x62')][_0x56b5('0x33')](',')['map'](function(_0x2559dc){return Number(_0x2559dc);});_0x4aa628[_0x56b5('0x34')](function(_0x5088fb){_0x5d7866['or'](_0x56b5('0x6f'),'%,'+_0x5088fb+',%');});_0x54c59c=_['union'](_0x54c59c,_0x4aa628);break;case _0x56b5('0x70'):if(_0x13fda1[_0x56b5('0x71')]===_0x56b5('0x67')){_0x34bdc2[_0x46bfcd]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x13fda1[_0x56b5('0x62')]+'%',null);}else{_0x33f76d=_[_0x56b5('0x6b')](_0x5625b4,['name','UserId']);_0x13fda1['field']=_0x56b5('0x3d');_0x201e96=as[_0x56b5('0x72')](_0x6210a,_0x33f76d['type'],_0x13fda1);_0x34bdc2[_0x46bfcd](_0x201e96[_0x56b5('0x73')],_0x201e96['value'][_0x56b5('0x6d')],_0x201e96[_0x56b5('0x62')]['end']);}break;case'body':_0x201e96=as['buildExpression']('me',null,_0x13fda1);_0x34bdc2[_0x46bfcd](_0x201e96['text'],_0x201e96[_0x56b5('0x62')][_0x56b5('0x6d')],_0x201e96[_0x56b5('0x62')][_0x56b5('0x2a')]);break;}}else{var _0x201e96=as['buildExpression'](_0x6210a,_0x33f76d[_0x56b5('0x3f')],_0x13fda1);_0x34bdc2[_0x46bfcd](_0x201e96[_0x56b5('0x73')],_0x201e96['value'][_0x56b5('0x6d')],_0x201e96[_0x56b5('0x62')]['end']);}}}else{var _0x3ca105=_(_0x589c0f['query'])[_0x56b5('0x40')]()[_0x56b5('0x2f')](function(_0x5027c7){return _[_0x56b5('0x74')](_0x5625b4,[_0x56b5('0x2d'),_0x5027c7])?_0x5027c7:undefined;})[_0x56b5('0x75')]()[_0x56b5('0x62')]();if(!_[_0x56b5('0x76')](_0x3ca105)){_0x3ca105[_0x56b5('0x34')](function(_0x1845f5){if(_0x1845f5===_0x56b5('0x77')){_0x513e6e[_0x56b5('0x4a')](_0x56b5('0x78'),[][_0x56b5('0x79')](_0x589c0f[_0x56b5('0x41')][_0x1845f5]));}else if(_0x1845f5==='createdAt'){var _0xadfdd8=JSON[_0x56b5('0x7a')](_0x589c0f[_0x56b5('0x41')][_0x1845f5])[_0x56b5('0x7b')];var _0x2a60d1=JSON['parse'](_0x589c0f[_0x56b5('0x41')][_0x1845f5])['$lte'];_0x513e6e['where'](_0x56b5('0x7c'),_0xadfdd8,_0x2a60d1);}else{if(_0x589c0f['query'][_0x1845f5]===_0x56b5('0x7d')){_0x513e6e[_0x56b5('0x4a')]('i.'+_0x1845f5+_0x56b5('0x7e'));}else{_0x513e6e[_0x56b5('0x4a')]('i.'+_0x1845f5+_0x56b5('0x7f'),_0x589c0f[_0x56b5('0x41')][_0x1845f5]);}}});}if(_0x589c0f['query'][_0x56b5('0x80')]){if(_0x589c0f[_0x56b5('0x41')]['read']==0x1){_0x513e6e['having'](_0x56b5('0x81'));}else{_0x513e6e[_0x56b5('0x63')](_0x56b5('0x82'));}}if(_0x589c0f[_0x56b5('0x41')][_0x56b5('0x83')]){_0x54c59c=_[_0x56b5('0x84')](_0x589c0f[_0x56b5('0x41')]['tag'])?_0x589c0f['query'][_0x56b5('0x83')]:new Array(_0x589c0f['query'][_0x56b5('0x83')]);_0x54c59c[_0x56b5('0x34')](function(_0x51b4c7){_0x5d7866['or'](_0x56b5('0x6f'),'%,'+_0x51b4c7+',%');});}if(_0x589c0f['query']['filter']){var _0x24afe8=_0x589c0f[_0x56b5('0x41')][_0x56b5('0x85')][_0x56b5('0x86')]('\x5c','\x5c\x5c')[_0x56b5('0x86')](/'/g,'\x27\x27');if(qs[_0x56b5('0x87')](_0x24afe8)){_0x34bdc2['or'](_0x56b5('0x88'),_0x24afe8+'%');}else{_0x34bdc2['or'](_0x56b5('0x89'),qs[_0x56b5('0x69')](_0x24afe8))['or'](_0x56b5('0x8a'),_0x24afe8+'%')['or'](_0x56b5('0x8b'),_0x24afe8+'%');}}}_0x513e6e[_0x56b5('0x4a')](_0x34bdc2);_0x513e6e['group'](_0x56b5('0x8c'));var _0x227027={'type':db[_0x56b5('0x8d')]['QueryTypes'][_0x56b5('0x8e')],'raw':!![]};var _0x36e18d=_0x513e6e[_0x56b5('0x8f')]();_0x36e18d['field'](_0x56b5('0x8c'));_0x36e18d[_0x56b5('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x5f5271['order']){_0x5f5271[_0x56b5('0x90')][_0x56b5('0x34')](function(_0x14c641){var _0x4ef3dc=_0x14c641[0x0]===_0x56b5('0x91')?_0x14c641[0x0]:'i.'+_0x14c641[0x0];_0x513e6e[_0x56b5('0x90')](_0x4ef3dc,_0x14c641[0x1]===_0x56b5('0x92')?![]:!![]);});}if(!_[_0x56b5('0x76')](_0x54c59c)){_0x513e6e[_0x56b5('0x63')](_0x5d7866);_0x36e18d['where'](_0x56b5('0x93'),_0x54c59c);}BPromise[_0x56b5('0x94')]()['then'](function(){if(!_0x49dc64){if(_0x589c0f['query'][_0x56b5('0x77')])return;_0x36e18d[_0x56b5('0x4a')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x513e6e[_0x56b5('0x4a')](_0x56b5('0x95'));return;}if(_0x589c0f[_0x56b5('0x96')]['role']!=='agent')return;return _0x589c0f['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x2f9465){if(_[_0x56b5('0x76')](_0x2f9465)){_0x36e18d[_0x56b5('0x4a')](_0x56b5('0x97'));_0x513e6e[_0x56b5('0x4a')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x36e18d['where'](_0x56b5('0x78'),_[_0x56b5('0x2f')](_0x2f9465,'id'));_0x513e6e['where'](_0x56b5('0x78'),_[_0x56b5('0x2f')](_0x2f9465,'id'));}});})[_0x56b5('0x29')](function(){if(_0x589c0f[_0x56b5('0x96')]['role']==='agent'&&!_0x49dc64&&!_0x589c0f['query'][_0x56b5('0x77')])return[];return db[_0x56b5('0x98')]['query'](_0x36e18d[_0x56b5('0x99')](),_0x227027);})[_0x56b5('0x29')](function(_0x3fa48b){_0x56cfdb[_0x56b5('0x25')]=_0x3fa48b[_0x56b5('0x46')];if(_0x56cfdb[_0x56b5('0x25')]===0x0)return[];return db[_0x56b5('0x98')]['query'](_0x4bddc1[_0x56b5('0x99')](),_0x227027)[_0x56b5('0x29')](function(_0x519037){_0x357fd5=_['keyBy'](_0x519037,'id');_0x227027=_[_0x56b5('0x9a')](_0x227027,{'model':db[_0x56b5('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x589c0f[_0x56b5('0x41')][_0x56b5('0x45')]){_0x5f5271[_0x56b5('0x44')]['forEach'](function(_0x22ab8f){_0x513e6e[_0x56b5('0x4c')]('i.'+_0x22ab8f);});}else{_0x513e6e[_0x56b5('0x4c')](_0x56b5('0x9b'),_0x56b5('0x61'));_0x513e6e[_0x56b5('0x4c')]('a.key',_0x56b5('0x9c'));_0x513e6e[_0x56b5('0x4c')](_0x56b5('0x9d'),'Account.mandatoryDisposition');_0x513e6e[_0x56b5('0x4c')](_0x56b5('0x9e'),'contactName');_0x513e6e[_0x56b5('0x4c')](_0x56b5('0x9f'));_0x513e6e[_0x56b5('0x4c')]('c.firstName',_0x56b5('0xa0'));_0x513e6e[_0x56b5('0x4c')](_0x56b5('0xa1'),_0x56b5('0xa2'));_0x513e6e['field']('c.email',_0x56b5('0xa3'));_0x513e6e['field'](_0x56b5('0xa4'),_0x56b5('0xa5'));_0x513e6e[_0x56b5('0x4c')](_0x56b5('0xa6'),_0x56b5('0xa7'));_0x513e6e[_0x56b5('0x4c')](_0x56b5('0xa8'),_0x56b5('0xa9'));_0x513e6e['field']('o.fullname',_0x56b5('0xaa'));_0x513e6e[_0x56b5('0x4c')]('o.internal','Owner.internal');_0x513e6e[_0x56b5('0x4c')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x5f5271[_0x56b5('0x24')])_0x513e6e[_0x56b5('0x24')](_0x5f5271['limit']);if(_0x5f5271[_0x56b5('0x22')])_0x513e6e[_0x56b5('0x22')](_0x5f5271[_0x56b5('0x22')]);return db[_0x56b5('0x98')]['query'](_0x513e6e[_0x56b5('0x99')](),_0x227027);})[_0x56b5('0x29')](function(_0x508c5c){if(_0x508c5c['length']>0x0)_0x5d1e8f[_0x56b5('0x4a')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x56b5('0x2f')](_0x508c5c,'id'));return db['sequelize'][_0x56b5('0x41')](_0x5d1e8f[_0x56b5('0x99')](),_0x227027)[_0x56b5('0x29')](function(_0xfc04e5){var _0x23aa74=_[_0x56b5('0xab')](_0xfc04e5,_0x56b5('0xac'));var _0x2c4455=[];_0x508c5c[_0x56b5('0x34')](function(_0x53a122){_0x2c4455['push'](updateOpenchannelInteraction(_0x53a122,_0x357fd5,_0x23aa74));});return BPromise[_0x56b5('0xad')](_0x2c4455);});});})['then'](function(_0x28b674){_0x56cfdb[_0x56b5('0xae')]=_0x28b674;return _0x56cfdb;})['then'](respondWithFilteredResult(_0x232cc3,_0x5f5271))[_0x56b5('0x36')](handleError(_0x232cc3,null));};exports[_0x56b5('0xaf')]=function(_0x334232,_0x507d45){var _0x56c841={};if(_0x334232['query'][_0x56b5('0x3f')]&&_0x334232['query'][_0x56b5('0x3f')]==='from'){_0x56c841[_0x56b5('0x51')]=_0x334232['params']['id'];}else{_0x56c841['id']=_0x334232[_0x56b5('0xb0')]['id'];}var _0x12fcdc={'raw':![],'where':_0x56c841},_0x2cdae3={};_0x2cdae3[_0x56b5('0x43')]=_[_0x56b5('0x40')](db['OpenchannelInteraction'][_0x56b5('0xb1')]);_0x2cdae3[_0x56b5('0x41')]=_[_0x56b5('0x40')](_0x334232[_0x56b5('0x41')]);_0x2cdae3[_0x56b5('0xb2')]=_[_0x56b5('0x42')](_0x2cdae3[_0x56b5('0x43')],_0x2cdae3[_0x56b5('0x41')]);_0x12fcdc[_0x56b5('0x44')]=_[_0x56b5('0x42')](_0x2cdae3[_0x56b5('0x43')],qs[_0x56b5('0x45')](_0x334232[_0x56b5('0x41')][_0x56b5('0x45')]));_0x12fcdc[_0x56b5('0x44')]=_0x12fcdc[_0x56b5('0x44')][_0x56b5('0x46')]?_0x12fcdc[_0x56b5('0x44')]:_0x2cdae3[_0x56b5('0x43')];if(_0x334232[_0x56b5('0x41')][_0x56b5('0xb3')]){_0x12fcdc['include']=[{'all':!![]}];}_0x12fcdc=_[_0x56b5('0x9a')]({},_0x12fcdc,_0x334232[_0x56b5('0xb4')]);return db[_0x56b5('0x3e')][_0x56b5('0x6b')](_0x12fcdc)['then'](handleEntityNotFound(_0x507d45,null))[_0x56b5('0x29')](respondWithResult(_0x507d45,null))['catch'](handleError(_0x507d45,null));};exports[_0x56b5('0xb5')]=function(_0x52d2e8,_0x3faec5){return db['OpenchannelInteraction'][_0x56b5('0xb5')](_0x52d2e8[_0x56b5('0xb6')],{})[_0x56b5('0x29')](respondWithResult(_0x3faec5,0xc9))[_0x56b5('0x36')](handleError(_0x3faec5,null));};exports[_0x56b5('0xb7')]=function(_0x174161,_0x556cd4){if(_0x174161[_0x56b5('0xb6')]['id']){delete _0x174161[_0x56b5('0xb6')]['id'];}return db[_0x56b5('0x3e')][_0x56b5('0x6b')]({'where':{'id':_0x174161[_0x56b5('0xb0')]['id']}})[_0x56b5('0x29')](handleEntityNotFound(_0x556cd4,null))[_0x56b5('0x29')](saveUpdates(_0x174161['body'],null))[_0x56b5('0x29')](respondWithResult(_0x556cd4,null))[_0x56b5('0x36')](handleError(_0x556cd4,null));};exports[_0x56b5('0xb8')]=function(_0x39938b,_0x370e5c){return db[_0x56b5('0x3e')][_0x56b5('0x6b')]({'where':{'id':_0x39938b[_0x56b5('0xb0')]['id']}})['then'](handleEntityNotFound(_0x370e5c,null))[_0x56b5('0x29')](removeEntity(_0x370e5c,null))[_0x56b5('0x36')](handleError(_0x370e5c,null));};exports[_0x56b5('0xb9')]=function(_0x31bca3,_0x38a9b2){return db[_0x56b5('0x3e')][_0x56b5('0xb9')]()[_0x56b5('0x29')](respondWithResult(_0x38a9b2,null))[_0x56b5('0x36')](handleError(_0x38a9b2,null));};exports[_0x56b5('0xba')]=function(_0x111872,_0x7ef87f,_0xce993e){return db[_0x56b5('0xbb')][_0x56b5('0x6b')]({'where':{'id':_0x111872['params']['id']}})['then'](handleEntityNotFound(_0x7ef87f,null))['then'](function(_0x52dd1d){if(_0x52dd1d){return _0x52dd1d[_0x56b5('0xba')](_0x111872['body'][_0x56b5('0xbc')],_[_0x56b5('0xbd')](_0x111872['body'],['ids','id'])||{});}})[_0x56b5('0x29')](respondWithResult(_0x7ef87f,null))[_0x56b5('0x36')](handleError(_0x7ef87f,null));};exports[_0x56b5('0xbe')]=function(_0xf8f87e,_0x6f9886,_0x46f678){var _0x2b012c={'raw':![],'where':{}};var _0x1f572e={};var _0x5d7be6={'count':0x0,'rows':[]};return db[_0x56b5('0x3e')][_0x56b5('0xbf')]({'where':{'id':_0xf8f87e['params']['id']}})[_0x56b5('0x29')](handleEntityNotFound(_0x6f9886,null))[_0x56b5('0x29')](function(_0xc7f971){if(_0xc7f971){_0x1f572e[_0x56b5('0x43')]=_[_0x56b5('0x40')](db['OpenchannelMessage'][_0x56b5('0xb1')]);_0x1f572e['query']=_[_0x56b5('0x40')](_0xf8f87e['query']);_0x1f572e[_0x56b5('0xb2')]=_['intersection'](_0x1f572e[_0x56b5('0x43')],_0x1f572e[_0x56b5('0x41')]);_0x2b012c[_0x56b5('0x44')]=_['intersection'](_0x1f572e[_0x56b5('0x43')],qs[_0x56b5('0x45')](_0xf8f87e['query'][_0x56b5('0x45')]));_0x2b012c[_0x56b5('0x44')]=_0x2b012c[_0x56b5('0x44')]['length']?_0x2b012c[_0x56b5('0x44')]:_0x1f572e[_0x56b5('0x43')];if(!_0xf8f87e[_0x56b5('0x41')][_0x56b5('0x47')](_0x56b5('0x48'))){_0x2b012c[_0x56b5('0x24')]=qs[_0x56b5('0x24')](_0xf8f87e[_0x56b5('0x41')][_0x56b5('0x24')]);_0x2b012c['offset']=qs['offset'](_0xf8f87e[_0x56b5('0x41')][_0x56b5('0x22')]);}_0x2b012c[_0x56b5('0x90')]=qs[_0x56b5('0x49')](_0xf8f87e[_0x56b5('0x41')][_0x56b5('0x49')]);_0x2b012c['where']=qs[_0x56b5('0xb2')](_[_0x56b5('0xc0')](_0xf8f87e[_0x56b5('0x41')],_0x1f572e['filters']));_0x2b012c['where'][_0x56b5('0xac')]=_0xc7f971['id'];if(_0xf8f87e[_0x56b5('0x41')]['filter']){_0x2b012c['where']=_[_0x56b5('0x9a')](_0x2b012c['where'],{'$or':_[_0x56b5('0x2f')](_0x2b012c[_0x56b5('0x44')],function(_0x3b8d5b){var _0x5edabf={};_0x5edabf[_0x3b8d5b]={'$like':'%'+_0xf8f87e[_0x56b5('0x41')][_0x56b5('0x85')]+'%'};return _0x5edabf;})});}if(_0xf8f87e[_0x56b5('0x41')]['$gte']){var _0x49d6f8=_0xf8f87e[_0x56b5('0x41')]['$gte']['split'](',');var _0x28f763={};_0x28f763[_0x49d6f8[0x0]]={'$gte':moment(_0x49d6f8[0x1])[_0x56b5('0xc1')](_0x56b5('0xc2'))};_0x2b012c[_0x56b5('0x4a')]=_['merge'](_0x2b012c[_0x56b5('0x4a')],_0x28f763);}_0x2b012c=_[_0x56b5('0x9a')]({},_0x2b012c,_0xf8f87e[_0x56b5('0xb4')]);return db[_0x56b5('0xbb')][_0x56b5('0x25')]({'where':_0x2b012c[_0x56b5('0x4a')]})[_0x56b5('0x29')](function(_0x46a07e){_0x5d7be6[_0x56b5('0x25')]=_0x46a07e;if(_0xf8f87e[_0x56b5('0x41')][_0x56b5('0xb3')]){_0x2b012c['include']=[{'all':!![]}];}return db[_0x56b5('0xbb')][_0x56b5('0xc3')](_0x2b012c);})[_0x56b5('0x29')](function(_0x1ab513){_0x5d7be6[_0x56b5('0xae')]=_0x1ab513;return _0x5d7be6;});}})[_0x56b5('0x29')](respondWithFilteredResult(_0x6f9886,_0x2b012c))[_0x56b5('0x36')](handleError(_0x6f9886,null));};exports[_0x56b5('0xc4')]=function(_0x268efb,_0x3ecd43,_0x16e85a){return db['OpenchannelInteraction'][_0x56b5('0x6b')]({'where':{'id':_0x268efb[_0x56b5('0xb0')]['id']}})[_0x56b5('0x29')](handleEntityNotFound(_0x3ecd43,null))[_0x56b5('0x29')](function(_0x3745f5){if(_0x3745f5){return _0x3745f5['setTags'](_0x268efb[_0x56b5('0xb6')][_0x56b5('0xbc')],_[_0x56b5('0xbd')](_0x268efb[_0x56b5('0xb6')],[_0x56b5('0xbc'),'id'])||{})['spread'](function(){return db[_0x56b5('0x6e')][_0x56b5('0xc3')]({'attributes':['id',_0x56b5('0x2d'),_0x56b5('0x4d')],'where':{'id':_0x268efb[_0x56b5('0xb6')]['ids']}});})[_0x56b5('0x29')](function(_0x512a4c){socket[_0x56b5('0xc5')](_0x56b5('0xc6'),{'id':Number(_0x268efb[_0x56b5('0xb0')]['id']),'tags':_0x512a4c||[]});return{'id':Number(_0x268efb[_0x56b5('0xb0')]['id']),'tags':_0x512a4c||[]};});}})[_0x56b5('0x29')](respondWithResult(_0x3ecd43,null))[_0x56b5('0x36')](handleError(_0x3ecd43,null));};exports[_0x56b5('0xc7')]=function(_0xc34cea,_0x548020,_0x57ff6d){return db[_0x56b5('0x3e')][_0x56b5('0x6b')]({'where':{'id':_0xc34cea[_0x56b5('0xb0')]['id']}})['then'](handleEntityNotFound(_0x548020,null))[_0x56b5('0x29')](function(_0x5db4d1){if(_0x5db4d1){return _0x5db4d1[_0x56b5('0xc7')](_0xc34cea[_0x56b5('0x41')][_0x56b5('0xbc')]);}})[_0x56b5('0x29')](respondWithStatusCode(_0x548020,null))[_0x56b5('0x36')](handleError(_0x548020,null));};exports['download']=function(_0x3a01b5,_0x48bf58){var _0x3c888e=moment()[_0x56b5('0xc8')]()[_0x56b5('0x99')]();var _0x2448d1=path[_0x56b5('0xc9')](config[_0x56b5('0xca')],'server',_0x56b5('0xcb'),_0x56b5('0xcc'));var _0x249369=path[_0x56b5('0xc9')](config['root'],_0x56b5('0xcd'),_0x56b5('0xcb'),'attachments');var _0x54c828=path[_0x56b5('0xc9')](_0x2448d1,_0x3c888e);var _0x266112=util[_0x56b5('0xc1')](_0x56b5('0xce'),_0x3a01b5['params']['id'],_0x3c888e);var _0x20ebb4=path[_0x56b5('0xc9')](_0x2448d1,_0x266112);var _0x3caa8b=[];_0x3caa8b['push']({'model':db[_0x56b5('0x70')],'as':_0x56b5('0x70'),'attributes':['id',_0x56b5('0x30')],'raw':!![]});_0x3caa8b[_0x56b5('0x35')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x56b5('0xcf'),_0x56b5('0xd0')],'raw':!![]});if(_0x3a01b5[_0x56b5('0x41')][_0x56b5('0xd1')]){_0x3caa8b[_0x56b5('0x35')]({'model':db[_0x56b5('0xd2')],'as':_0x56b5('0xd2'),'raw':!![]});}var _0x1ec985=[{'model':db[_0x56b5('0xbb')],'as':'Messages','attributes':['id',_0x56b5('0xb6'),_0x56b5('0xd3'),_0x56b5('0xd4'),_0x56b5('0xd5'),_0x56b5('0x80')],'include':_0x3caa8b}];_0x1ec985[_0x56b5('0x35')]({'model':db['OpenchannelAccount'],'as':_0x56b5('0xd6'),'attributes':['id','name']});_0x1ec985[_0x56b5('0x35')]({'model':db[_0x56b5('0x70')],'as':_0x56b5('0xd7'),'attributes':['id',_0x56b5('0x30')]});return db[_0x56b5('0x3e')][_0x56b5('0x6b')]({'where':{'id':_0x3a01b5[_0x56b5('0xb0')]['id']},'include':_0x1ec985})[_0x56b5('0x29')](handleEntityNotFound(_0x48bf58,null))['then'](function(_0x2b8cb4){if(_0x2b8cb4){var _0x48ebad=_0x2b8cb4[_0x56b5('0xd8')]({'plain':!![]});fs[_0x56b5('0xd9')](_0x54c828);var _0x23303b={'channel':_0x56b5('0xda'),'account':_0x48ebad[_0x56b5('0xd6')][_0x56b5('0x2d')],'agent':_0x48ebad[_0x56b5('0xd7')]?_0x48ebad[_0x56b5('0xd7')][_0x56b5('0x30')]:'N.A.','createdAt':moment(_0x48ebad[_0x56b5('0xd3')])[_0x56b5('0xc1')](_0x56b5('0xc2'))[_0x56b5('0x99')](),'closedAt':_0x48ebad[_0x56b5('0x3c')]?moment(_0x48ebad[_0x56b5('0xdb')])[_0x56b5('0xc1')](_0x56b5('0xc2'))[_0x56b5('0x99')]():'','disposition':_0x48ebad['disposition'],'visibility':_0x48ebad[_0x56b5('0xdc')]?_0x56b5('0xdd'):_0x56b5('0xde'),'messages':_(_0x48ebad[_0x56b5('0xdf')])[_0x56b5('0x85')]({'secret':![]})['map'](function(_0x47524f){if(_0x47524f[_0x56b5('0xd2')]){var _0x560335=path[_0x56b5('0xc9')](_0x249369,_0x47524f[_0x56b5('0xd2')][_0x56b5('0xe0')]);if(fs[_0x56b5('0xe1')](_0x560335)){fs[_0x56b5('0xe2')](_0x560335)['pipe'](fs[_0x56b5('0xe3')](path['join'](_0x54c828,_0x47524f[_0x56b5('0xd2')]['basename'])));}}return{'date':moment(_0x47524f[_0x56b5('0xd3')])[_0x56b5('0xc1')](_0x56b5('0xc2'))[_0x56b5('0x99')](),'sender':_0x47524f[_0x56b5('0xd4')]===_0x56b5('0xe4')?_0x47524f[_0x56b5('0x70')]?_0x47524f[_0x56b5('0x70')][_0x56b5('0x30')]:_0x56b5('0xe5'):_0x47524f[_0x56b5('0x66')]['firstName']+(_0x47524f[_0x56b5('0x66')][_0x56b5('0xd0')]?'\x20'+_0x47524f[_0x56b5('0x66')][_0x56b5('0xd0')]:''),'body':_0x47524f[_0x56b5('0xd2')]?_0x47524f['Attachment'][_0x56b5('0xe0')]:_0x47524f['body'],'direction':_0x47524f[_0x56b5('0xd4')]==='out'?'A':'C','secret':_0x47524f[_0x56b5('0xd5')],'read':_0x47524f[_0x56b5('0x80')],'attachment':_0x47524f[_0x56b5('0xd2')]};})[_0x56b5('0x62')]()};return ejs[_0x56b5('0xe6')](path[_0x56b5('0xc9')](config[_0x56b5('0xca')],_0x56b5('0xcd'),_0x56b5('0xe7'),_0x56b5('0xe8')),{'interaction':_0x23303b})[_0x56b5('0x29')](function(_0x3af843){var _0x29cd5a=path[_0x56b5('0xc9')](_0x54c828,'transcript-'+_0x48ebad['id']+'-'+_0x3c888e+_0x56b5('0xe9'));var _0x3094ef={'path':_0x29cd5a,'channel':_0x56b5('0xda'),'interactionId':_0x48ebad['id']};return pdf[_0x56b5('0xea')](_0x3af843,_0x3094ef);})[_0x56b5('0x29')](function(){return new BPromise(function(_0x2d92eb,_0x5ed12e){zipdir(_0x54c828,{'saveTo':_0x20ebb4},function(_0x525c3c,_0x450559){if(_0x525c3c)return _0x5ed12e(_0x525c3c);return _0x2d92eb(_0x450559);});})[_0x56b5('0x29')](function(){return new BPromise(function(_0x46b2c3,_0x55bb16){rimraf(_0x54c828,function(_0x38c334){if(_0x38c334)_0x55bb16(_0x38c334);return _0x46b2c3();});});})['then'](function(){return _0x48bf58['download'](_0x20ebb4,_0x266112,function(_0x3dc9fa){if(_0x3dc9fa){console['log'](_0x56b5('0xeb'),_0x3dc9fa);}else{fs['unlinkSync'](_0x20ebb4);}});});});}else{return _0x48bf58[_0x56b5('0x1f')](0xc8);}})[_0x56b5('0x36')](handleError(_0x48bf58,null));}; \ No newline at end of file +var _0x1f78=['Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','params','includeAll','include','options','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','omit','spread','emit','removeTags','download','unix','tmp','root','server','files','attachments','format','transcript-%d-%s.zip','join','User','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','mkdirSync','N.A.','closedAt','Public','basename','createReadStream','createWriteStream','System','out','renderFile','transcript-','.pdf','Openchannel','createPdfFromHTML','err','unlinkSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','closed','UserId','total','index','OpenchannelInteraction','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','union','some','compact','isEmpty','OpenchannelAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','getFullTextValue','i.from\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','role','agent','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x54ec06,_0x24e1d4){var _0x18d205=function(_0x2dd940){while(--_0x2dd940){_0x54ec06['push'](_0x54ec06['shift']());}};_0x18d205(++_0x24e1d4);}(_0x1f78,0x134));var _0x81f7=function(_0x564f23,_0x22c50e){_0x564f23=_0x564f23-0x0;var _0x16af30=_0x1f78[_0x564f23];return _0x16af30;};'use strict';var emlformat=require(_0x81f7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x81f7('0x1'));var rp=require(_0x81f7('0x2'));var moment=require(_0x81f7('0x3'));var BPromise=require(_0x81f7('0x4'));var Mustache=require(_0x81f7('0x5'));var util=require(_0x81f7('0x6'));var path=require(_0x81f7('0x7'));var sox=require(_0x81f7('0x8'));var csv=require(_0x81f7('0x9'));var ejs=require(_0x81f7('0xa'));var fs=require('fs');var fs_extra=require(_0x81f7('0xb'));var _=require(_0x81f7('0xc'));var squel=require(_0x81f7('0xd'));var crypto=require(_0x81f7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x81f7('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x81f7('0x10'));var Redis=require(_0x81f7('0x11'));var authService=require(_0x81f7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x81f7('0x13'));var pdf=require(_0x81f7('0x14'));var hardwareService=require(_0x81f7('0x15'));var logger=require(_0x81f7('0x16'))(_0x81f7('0x17'));var utils=require(_0x81f7('0x18'));var config=require(_0x81f7('0x19'));var licenseUtil=require(_0x81f7('0x1a'));var db=require(_0x81f7('0x1b'))['db'];config[_0x81f7('0x1c')]=_[_0x81f7('0x1d')](config[_0x81f7('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x81f7('0x1e'))(new Redis(config[_0x81f7('0x1c')]));require('./openchannelInteraction.socket')[_0x81f7('0x1f')](socket);function respondWithStatusCode(_0x2ddf6e,_0x6e146d){_0x6e146d=_0x6e146d||0xcc;return function(_0x313524){if(_0x313524){return _0x2ddf6e[_0x81f7('0x20')](_0x6e146d);}return _0x2ddf6e[_0x81f7('0x21')](_0x6e146d)['end']();};}function respondWithResult(_0x26f68e,_0x14a994){_0x14a994=_0x14a994||0xc8;return function(_0x190d79){if(_0x190d79){return _0x26f68e[_0x81f7('0x21')](_0x14a994)[_0x81f7('0x22')](_0x190d79);}};}function respondWithFilteredResult(_0x61c131,_0x5972d1){return function(_0xc54c9b){if(_0xc54c9b){var _0xeb8374=typeof _0x5972d1[_0x81f7('0x23')]===_0x81f7('0x24')&&typeof _0x5972d1[_0x81f7('0x25')]===_0x81f7('0x24');var _0x308729=_0xc54c9b[_0x81f7('0x26')];var _0x40f33b=_0xeb8374?0x0:_0x5972d1[_0x81f7('0x23')];var _0x2efb38=_0xeb8374?_0xc54c9b[_0x81f7('0x26')]:_0x5972d1[_0x81f7('0x23')]+_0x5972d1['limit'];var _0x1e2307;if(_0x2efb38>=_0x308729){_0x2efb38=_0x308729;_0x1e2307=0xc8;}else{_0x1e2307=0xce;}_0x61c131[_0x81f7('0x21')](_0x1e2307);return _0x61c131[_0x81f7('0x27')](_0x81f7('0x28'),_0x40f33b+'-'+_0x2efb38+'/'+_0x308729)[_0x81f7('0x22')](_0xc54c9b);}return null;};}function patchUpdates(_0xa6d4de){return function(_0x4e5c5c){try{jsonpatch[_0x81f7('0x29')](_0x4e5c5c,_0xa6d4de,!![]);}catch(_0x492328){return BPromise[_0x81f7('0x2a')](_0x492328);}return _0x4e5c5c[_0x81f7('0x2b')]();};}function saveUpdates(_0x42255c,_0x20793c){return function(_0x5d91f2){if(_0x5d91f2){return _0x5d91f2[_0x81f7('0x2c')](_0x42255c)[_0x81f7('0x2d')](function(_0x1ecd80){return _0x1ecd80;});}return null;};}function removeEntity(_0x33d896,_0x3e58b7){return function(_0x42aa10){if(_0x42aa10){return _0x42aa10[_0x81f7('0x2e')]()[_0x81f7('0x2d')](function(){_0x33d896['status'](0xcc)[_0x81f7('0x2f')]();});}};}function handleEntityNotFound(_0xecd94e,_0x5afda7){return function(_0x3075cf){if(!_0x3075cf){_0xecd94e[_0x81f7('0x20')](0x194);}return _0x3075cf;};}function handleError(_0x43a7f1,_0x280f16){_0x280f16=_0x280f16||0x1f4;return function(_0xcd00b6){logger[_0x81f7('0x30')](_0xcd00b6['stack']);if(_0xcd00b6[_0x81f7('0x31')]){delete _0xcd00b6[_0x81f7('0x31')];}_0x43a7f1['status'](_0x280f16)[_0x81f7('0x32')](_0xcd00b6);};}function getInteractionUsers(_0x51ac70,_0x4fa7ed){return new BPromise(function(_0x5acc3b,_0x30d363){try{if(_0x4fa7ed[_0x51ac70['id']]){_0x51ac70[_0x81f7('0x33')]=_[_0x81f7('0x34')](_0x4fa7ed[_0x51ac70['id']],function(_0x2a9333){return{'id':_0x2a9333['id'],'fullname':_0x2a9333[_0x81f7('0x35')]};});}}catch(_0x5ea8d1){_0x30d363(_0x5ea8d1);}_0x5acc3b(_0x51ac70);});}function getInteractionTags(_0x430818,_0x4156b0){return new BPromise(function(_0x1e55a9,_0x1786d0){try{if(_0x430818[_0x81f7('0x36')]){_0x430818[_0x81f7('0x37')]=[];_0x430818['TagIds'][_0x81f7('0x38')](',')[_0x81f7('0x39')](function(_0x1b1fe9){_0x430818[_0x81f7('0x37')][_0x81f7('0x3a')](_0x4156b0[_0x1b1fe9]);});}delete _0x430818['TagIds'];}catch(_0x1c3ea5){_0x1786d0(_0x1c3ea5);}_0x1e55a9(_0x430818);});}function updateOpenchannelInteraction(_0xbec302,_0x1cd51a,_0x511bc3){return new BPromise(function(_0x336b88,_0x3ea814){return getInteractionUsers(_0xbec302,_0x511bc3)[_0x81f7('0x2d')](function(_0x6b23e7){return getInteractionTags(_0x6b23e7,_0x1cd51a);})['then'](function(_0x5c7ed7){return getStateInteraction(_0x5c7ed7);})[_0x81f7('0x2d')](function(_0x5ca763){_0x336b88(_0x5ca763);})[_0x81f7('0x3b')](function(_0x143cdd){_0x3ea814(_0x143cdd);});});}function getStateInteraction(_0x1c9337){return new BPromise(function(_0x73eb67){_0x1c9337[_0x81f7('0x3c')]=0x0;_0x1c9337[_0x81f7('0x3d')]=0x0;_0x1c9337[_0x81f7('0x3e')]=0x0;_0x1c9337[_0x81f7('0x3f')]=0x0;_0x1c9337['total']=0x0;if(!_0x1c9337[_0x81f7('0x40')]&&!_0x1c9337[_0x81f7('0x41')]){_0x1c9337['waiting']+=0x1;}if(!_0x1c9337['closed']&&_0x1c9337['UserId']){_0x1c9337[_0x81f7('0x3d')]+=0x1;if(_0x1c9337['waiting']){_0x1c9337[_0x81f7('0x3c')]-=0x1;}}if(_0x1c9337[_0x81f7('0x40')]&&_0x1c9337['UserId']){_0x1c9337[_0x81f7('0x3e')]+=0x1;if(_0x1c9337[_0x81f7('0x3d')]){_0x1c9337[_0x81f7('0x3d')]-=0x1;}}if(_0x1c9337[_0x81f7('0x40')]&&!_0x1c9337[_0x81f7('0x41')]){_0x1c9337[_0x81f7('0x3f')]+=0x1;if(_0x1c9337[_0x81f7('0x3c')]){_0x1c9337[_0x81f7('0x3c')]-=0x1;}}_0x1c9337[_0x81f7('0x42')]+=0x1;_0x73eb67(_0x1c9337);});}exports[_0x81f7('0x43')]=function(_0x4393e3,_0x4eb919){var _0x55bd35={},_0x85b20c={},_0x188125={'count':0x0,'rows':[]};var _0x307783=_[_0x81f7('0x34')](db[_0x81f7('0x44')][_0x81f7('0x45')],function(_0x152f20){return{'name':_0x152f20['fieldName'],'type':_0x152f20['type']['key']};});_0x85b20c[_0x81f7('0x46')]=_[_0x81f7('0x34')](_0x307783,_0x81f7('0x31'));_0x85b20c[_0x81f7('0x47')]=_[_0x81f7('0x48')](_0x4393e3[_0x81f7('0x47')]);_0x85b20c[_0x81f7('0x49')]=_[_0x81f7('0x4a')](_0x85b20c[_0x81f7('0x46')],_0x85b20c[_0x81f7('0x47')]);_0x55bd35[_0x81f7('0x4b')]=_[_0x81f7('0x4a')](_0x85b20c[_0x81f7('0x46')],qs['fields'](_0x4393e3[_0x81f7('0x47')][_0x81f7('0x4c')]));_0x55bd35[_0x81f7('0x4b')]=_0x55bd35[_0x81f7('0x4b')][_0x81f7('0x4d')]?_0x55bd35[_0x81f7('0x4b')]:_0x85b20c['model'];if(!_0x4393e3[_0x81f7('0x47')][_0x81f7('0x4e')](_0x81f7('0x4f'))){_0x55bd35[_0x81f7('0x25')]=qs[_0x81f7('0x25')](_0x4393e3[_0x81f7('0x47')][_0x81f7('0x25')]);_0x55bd35['offset']=qs[_0x81f7('0x23')](_0x4393e3['query'][_0x81f7('0x23')]);}_0x55bd35['order']=qs[_0x81f7('0x50')](_0x4393e3['query'][_0x81f7('0x50')]);_0x55bd35[_0x81f7('0x51')]=qs[_0x81f7('0x49')](_[_0x81f7('0x52')](_0x4393e3[_0x81f7('0x47')],_0x85b20c[_0x81f7('0x49')]),_0x307783);var _0xe9c08a=[];var _0x4b9cef=squel[_0x81f7('0x53')]()[_0x81f7('0x54')]('id')[_0x81f7('0x54')](_0x81f7('0x31'))[_0x81f7('0x54')]('color')['from'](_0x81f7('0x55'));var _0x298c58=squel[_0x81f7('0x53')]()['field'](_0x81f7('0x56'))[_0x81f7('0x54')](_0x81f7('0x57'))[_0x81f7('0x54')](_0x81f7('0x58'))[_0x81f7('0x59')](_0x81f7('0x5a'),'ui')['left_join'](_0x81f7('0x5b'),'u',_0x81f7('0x5c'));var _0x5ce05b=squel['select']()[_0x81f7('0x59')](_0x81f7('0x5d'),'i')[_0x81f7('0x5e')](_0x81f7('0x5f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x81f7('0x5e')](_0x81f7('0x5b'),'o',_0x81f7('0x60'))[_0x81f7('0x5e')]('openchannel_accounts','a',_0x81f7('0x61'))[_0x81f7('0x5e')](_0x81f7('0x62'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x81f7('0x5e')](_0x81f7('0x63'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x81f7('0x5e')](_0x81f7('0x55'),'t',_0x81f7('0x64'));var _0xaa0764=squel[_0x81f7('0x65')]();var _0x275089=[];var _0xafbaab=squel[_0x81f7('0x65')]();var _0x380e24;if(_0x4393e3[_0x81f7('0x47')][_0x81f7('0x66')]){_0x380e24=as[_0x81f7('0x67')](_0x4393e3['query'][_0x81f7('0x66')]);var _0x46765b=_0x380e24[_0x81f7('0x68')];for(var _0x286b62=0x0;_0x286b62<_0x380e24['conditions'][_0x81f7('0x4d')];_0x286b62++){var _0x2e1ebd=_0x380e24[_0x81f7('0x69')][_0x286b62];var _0x5deb94='i';var _0xdc81a6=_[_0x81f7('0x6a')](_0x307783,[_0x81f7('0x31'),_0x2e1ebd['field']]);if(!_0xdc81a6){switch(_0x2e1ebd['field']){case _0x81f7('0x6b'):if(_0x2e1ebd[_0x81f7('0x6c')]==0x1){_0x5ce05b['having']('`'+_0x2e1ebd['field']+_0x81f7('0x6d'));}else{_0x5ce05b[_0x81f7('0x6e')]('`'+_0x2e1ebd[_0x81f7('0x54')]+'`\x20>\x200');}break;case _0x81f7('0x6f'):if(_0x2e1ebd[_0x81f7('0x70')]===_0x81f7('0x71')){if(_0x2e1ebd['value'][_0x81f7('0x38')]('\x20')['length']>0x1){_0xaa0764[_0x46765b](_0x81f7('0x72'),qs['getFullTextValue'](_0x2e1ebd['value']),null);}else{var _0x15d3d2='%'+_0x2e1ebd['value']+'%';_0xaa0764[_0x46765b](_0x81f7('0x73'),_0x15d3d2,_0x15d3d2,_0x15d3d2);}}else{_0xdc81a6=_['find'](_0x307783,[_0x81f7('0x31'),_0x81f7('0x74')]);_0x2e1ebd[_0x81f7('0x54')]=_0x81f7('0x74');_0x4c985e=as[_0x81f7('0x75')](_0x5deb94,_0xdc81a6[_0x81f7('0x76')],_0x2e1ebd);_0xaa0764[_0x46765b](_0x4c985e[_0x81f7('0x77')],_0x4c985e[_0x81f7('0x6c')][_0x81f7('0x78')],_0x4c985e[_0x81f7('0x6c')][_0x81f7('0x2f')]);}break;case _0x81f7('0x79'):var _0x261d03=_0x2e1ebd[_0x81f7('0x6c')][_0x81f7('0x38')](',')[_0x81f7('0x34')](function(_0x376d0a){return Number(_0x376d0a);});_0x261d03['forEach'](function(_0x1ed0b5){_0xafbaab['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1ed0b5+',%');});_0x275089=_[_0x81f7('0x7a')](_0x275089,_0x261d03);break;case'User':if(_0x2e1ebd[_0x81f7('0x70')]==='$substring'){_0xaa0764[_0x46765b]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2e1ebd[_0x81f7('0x6c')]+'%',null);}else{_0xdc81a6=_[_0x81f7('0x6a')](_0x307783,[_0x81f7('0x31'),_0x81f7('0x41')]);_0x2e1ebd[_0x81f7('0x54')]='UserId';_0x4c985e=as[_0x81f7('0x75')](_0x5deb94,_0xdc81a6['type'],_0x2e1ebd);_0xaa0764[_0x46765b](_0x4c985e[_0x81f7('0x77')],_0x4c985e[_0x81f7('0x6c')]['start'],_0x4c985e[_0x81f7('0x6c')][_0x81f7('0x2f')]);}break;case'body':_0x4c985e=as[_0x81f7('0x75')]('me',null,_0x2e1ebd);_0xaa0764[_0x46765b](_0x4c985e['text'],_0x4c985e[_0x81f7('0x6c')]['start'],_0x4c985e['value'][_0x81f7('0x2f')]);break;}}else{var _0x4c985e=as[_0x81f7('0x75')](_0x5deb94,_0xdc81a6['type'],_0x2e1ebd);_0xaa0764[_0x46765b](_0x4c985e[_0x81f7('0x77')],_0x4c985e[_0x81f7('0x6c')][_0x81f7('0x78')],_0x4c985e['value'][_0x81f7('0x2f')]);}}}else{var _0x4a0fc0=_(_0x4393e3[_0x81f7('0x47')])[_0x81f7('0x48')]()[_0x81f7('0x34')](function(_0x47ea2e){return _[_0x81f7('0x7b')](_0x307783,[_0x81f7('0x31'),_0x47ea2e])?_0x47ea2e:undefined;})[_0x81f7('0x7c')]()[_0x81f7('0x6c')]();if(!_[_0x81f7('0x7d')](_0x4a0fc0)){_0x4a0fc0[_0x81f7('0x39')](function(_0x400a07){if(_0x400a07===_0x81f7('0x7e')){_0x5ce05b['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0x81f7('0x7f')](_0x4393e3[_0x81f7('0x47')][_0x400a07]));}else if(_0x400a07===_0x81f7('0x80')){var _0x153d3c=JSON[_0x81f7('0x81')](_0x4393e3[_0x81f7('0x47')][_0x400a07])[_0x81f7('0x82')];var _0x54cbac=JSON[_0x81f7('0x81')](_0x4393e3['query'][_0x400a07])[_0x81f7('0x83')];_0x5ce05b[_0x81f7('0x51')](_0x81f7('0x84'),_0x153d3c,_0x54cbac);}else{if(_0x4393e3['query'][_0x400a07]==='null'){_0x5ce05b['where']('i.'+_0x400a07+'\x20IS\x20NULL');}else{_0x5ce05b[_0x81f7('0x51')]('i.'+_0x400a07+_0x81f7('0x85'),_0x4393e3[_0x81f7('0x47')][_0x400a07]);}}});}if(_0x4393e3[_0x81f7('0x47')][_0x81f7('0x86')]){if(_0x4393e3['query']['read']==0x1){_0x5ce05b[_0x81f7('0x6e')](_0x81f7('0x87'));}else{_0x5ce05b[_0x81f7('0x6e')](_0x81f7('0x88'));}}if(_0x4393e3[_0x81f7('0x47')][_0x81f7('0x89')]){_0x275089=_[_0x81f7('0x8a')](_0x4393e3[_0x81f7('0x47')][_0x81f7('0x89')])?_0x4393e3['query'][_0x81f7('0x89')]:new Array(_0x4393e3[_0x81f7('0x47')]['tag']);_0x275089['forEach'](function(_0x4eeed0){_0xafbaab['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4eeed0+',%');});}if(_0x4393e3[_0x81f7('0x47')][_0x81f7('0x8b')]){var _0x457866=_0x4393e3[_0x81f7('0x47')][_0x81f7('0x8b')][_0x81f7('0x8c')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x457866)){_0xaa0764['or'](_0x81f7('0x8d'),_0x457866+'%');}else{_0xaa0764['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x81f7('0x8e')](_0x457866))['or'](_0x81f7('0x8f'),_0x457866+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x457866+'%');}}}_0x5ce05b['where'](_0xaa0764);_0x5ce05b[_0x81f7('0x90')](_0x81f7('0x91'));var _0x229e05={'type':db[_0x81f7('0x92')]['QueryTypes']['SELECT'],'raw':!![]};var _0x518757=_0x5ce05b[_0x81f7('0x93')]();_0x518757['field']('i.id');_0x518757['field'](_0x81f7('0x94'),_0x81f7('0x6b'));if(_0x55bd35[_0x81f7('0x95')]){_0x55bd35[_0x81f7('0x95')][_0x81f7('0x39')](function(_0x196228){var _0xba7489=_0x196228[0x0]===_0x81f7('0x96')?_0x196228[0x0]:'i.'+_0x196228[0x0];_0x5ce05b[_0x81f7('0x95')](_0xba7489,_0x196228[0x1]===_0x81f7('0x97')?![]:!![]);});}if(!_['isEmpty'](_0x275089)){_0x5ce05b['having'](_0xafbaab);_0x518757['where'](_0x81f7('0x98'),_0x275089);}BPromise[_0x81f7('0x99')]()['then'](function(){if(!_0x380e24){if(_0x4393e3['query'][_0x81f7('0x7e')])return;_0x518757['where'](_0x81f7('0x9a'));_0x5ce05b[_0x81f7('0x51')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4393e3[_0x81f7('0x9b')]['role']!=='agent')return;return _0x4393e3['user'][_0x81f7('0x9c')]({'attributes':['id'],'raw':!![]})[_0x81f7('0x2d')](function(_0x5ef2c7){if(_[_0x81f7('0x7d')](_0x5ef2c7)){_0x518757['where']('i.OpenchannelAccountId\x20IS\x20NULL');_0x5ce05b[_0x81f7('0x51')](_0x81f7('0x9d'));}else{_0x518757[_0x81f7('0x51')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x5ef2c7,'id'));_0x5ce05b[_0x81f7('0x51')](_0x81f7('0x9e'),_['map'](_0x5ef2c7,'id'));}});})[_0x81f7('0x2d')](function(){if(_0x4393e3[_0x81f7('0x9b')][_0x81f7('0x9f')]===_0x81f7('0xa0')&&!_0x380e24&&!_0x4393e3['query']['OpenchannelAccountId'])return[];return db[_0x81f7('0xa1')][_0x81f7('0x47')](_0x518757[_0x81f7('0xa2')](),_0x229e05);})[_0x81f7('0x2d')](function(_0x1d4821){_0x188125[_0x81f7('0x26')]=_0x1d4821[_0x81f7('0x4d')];if(_0x188125[_0x81f7('0x26')]===0x0)return[];return db[_0x81f7('0xa1')]['query'](_0x4b9cef[_0x81f7('0xa2')](),_0x229e05)[_0x81f7('0x2d')](function(_0x2dabe2){_0xe9c08a=_[_0x81f7('0xa3')](_0x2dabe2,'id');_0x229e05=_[_0x81f7('0xa4')](_0x229e05,{'model':db[_0x81f7('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4393e3[_0x81f7('0x47')][_0x81f7('0x4c')]){_0x55bd35[_0x81f7('0x4b')]['forEach'](function(_0x3e911b){_0x5ce05b[_0x81f7('0x54')]('i.'+_0x3e911b);});}else{_0x5ce05b[_0x81f7('0x54')](_0x81f7('0x94'),_0x81f7('0x6b'));_0x5ce05b[_0x81f7('0x54')]('a.key',_0x81f7('0xa5'));_0x5ce05b[_0x81f7('0x54')](_0x81f7('0xa6'),_0x81f7('0xa7'));_0x5ce05b['field'](_0x81f7('0xa8'),_0x81f7('0x96'));_0x5ce05b[_0x81f7('0x54')]('i.*');_0x5ce05b['field'](_0x81f7('0xa9'),'Contact.firstName');_0x5ce05b['field'](_0x81f7('0xaa'),_0x81f7('0xab'));_0x5ce05b[_0x81f7('0x54')](_0x81f7('0xac'),_0x81f7('0xad'));_0x5ce05b[_0x81f7('0x54')](_0x81f7('0xae'),_0x81f7('0xaf'));_0x5ce05b[_0x81f7('0x54')](_0x81f7('0xb0'),_0x81f7('0xb1'));_0x5ce05b[_0x81f7('0x54')](_0x81f7('0xb2'),_0x81f7('0xb3'));_0x5ce05b[_0x81f7('0x54')](_0x81f7('0xb4'),_0x81f7('0xb5'));_0x5ce05b[_0x81f7('0x54')]('o.internal',_0x81f7('0xb6'));_0x5ce05b[_0x81f7('0x54')](_0x81f7('0xb7'),_0x81f7('0x36'));}if(_0x55bd35[_0x81f7('0x25')])_0x5ce05b[_0x81f7('0x25')](_0x55bd35[_0x81f7('0x25')]);if(_0x55bd35[_0x81f7('0x23')])_0x5ce05b['offset'](_0x55bd35['offset']);return db[_0x81f7('0xa1')][_0x81f7('0x47')](_0x5ce05b[_0x81f7('0xa2')](),_0x229e05);})[_0x81f7('0x2d')](function(_0x44338e){if(_0x44338e[_0x81f7('0x4d')]>0x0)_0x298c58['where'](_0x81f7('0xb8'),_[_0x81f7('0x34')](_0x44338e,'id'));return db[_0x81f7('0xa1')][_0x81f7('0x47')](_0x298c58[_0x81f7('0xa2')](),_0x229e05)['then'](function(_0x160259){var _0x501a6c=_[_0x81f7('0xb9')](_0x160259,_0x81f7('0xba'));var _0x49238c=[];_0x44338e[_0x81f7('0x39')](function(_0x44f8d4){_0x49238c[_0x81f7('0x3a')](updateOpenchannelInteraction(_0x44f8d4,_0xe9c08a,_0x501a6c));});return BPromise[_0x81f7('0xbb')](_0x49238c);});});})['then'](function(_0xa35b90){_0x188125['rows']=_0xa35b90;return _0x188125;})['then'](respondWithFilteredResult(_0x4eb919,_0x55bd35))[_0x81f7('0x3b')](handleError(_0x4eb919,null));};exports['show']=function(_0x4a4649,_0x38ecf7){var _0x24c8bf={};if(_0x4a4649['query'][_0x81f7('0x76')]&&_0x4a4649[_0x81f7('0x47')][_0x81f7('0x76')]===_0x81f7('0x59')){_0x24c8bf[_0x81f7('0x59')]=_0x4a4649[_0x81f7('0xbc')]['id'];}else{_0x24c8bf['id']=_0x4a4649[_0x81f7('0xbc')]['id'];}var _0x43f786={'raw':![],'where':_0x24c8bf},_0xd64420={};_0xd64420['model']=_[_0x81f7('0x48')](db[_0x81f7('0x44')]['rawAttributes']);_0xd64420[_0x81f7('0x47')]=_[_0x81f7('0x48')](_0x4a4649[_0x81f7('0x47')]);_0xd64420[_0x81f7('0x49')]=_[_0x81f7('0x4a')](_0xd64420[_0x81f7('0x46')],_0xd64420[_0x81f7('0x47')]);_0x43f786['attributes']=_[_0x81f7('0x4a')](_0xd64420['model'],qs[_0x81f7('0x4c')](_0x4a4649[_0x81f7('0x47')][_0x81f7('0x4c')]));_0x43f786[_0x81f7('0x4b')]=_0x43f786[_0x81f7('0x4b')][_0x81f7('0x4d')]?_0x43f786['attributes']:_0xd64420[_0x81f7('0x46')];if(_0x4a4649['query'][_0x81f7('0xbd')]){_0x43f786[_0x81f7('0xbe')]=[{'all':!![]}];}_0x43f786=_['merge']({},_0x43f786,_0x4a4649[_0x81f7('0xbf')]);return db['OpenchannelInteraction']['find'](_0x43f786)[_0x81f7('0x2d')](handleEntityNotFound(_0x38ecf7,null))[_0x81f7('0x2d')](respondWithResult(_0x38ecf7,null))[_0x81f7('0x3b')](handleError(_0x38ecf7,null));};exports[_0x81f7('0xc0')]=function(_0x30345e,_0x37dc9c){return db['OpenchannelInteraction']['create'](_0x30345e[_0x81f7('0xc1')],{})[_0x81f7('0x2d')](respondWithResult(_0x37dc9c,0xc9))[_0x81f7('0x3b')](handleError(_0x37dc9c,null));};exports[_0x81f7('0x2c')]=function(_0x113213,_0x57d9ca){if(_0x113213[_0x81f7('0xc1')]['id']){delete _0x113213['body']['id'];}return db[_0x81f7('0x44')][_0x81f7('0x6a')]({'where':{'id':_0x113213[_0x81f7('0xbc')]['id']}})[_0x81f7('0x2d')](handleEntityNotFound(_0x57d9ca,null))['then'](saveUpdates(_0x113213[_0x81f7('0xc1')],null))[_0x81f7('0x2d')](respondWithResult(_0x57d9ca,null))[_0x81f7('0x3b')](handleError(_0x57d9ca,null));};exports[_0x81f7('0x2e')]=function(_0x10bf52,_0x2e0238){return db[_0x81f7('0x44')][_0x81f7('0x6a')]({'where':{'id':_0x10bf52['params']['id']}})[_0x81f7('0x2d')](handleEntityNotFound(_0x2e0238,null))[_0x81f7('0x2d')](removeEntity(_0x2e0238,null))['catch'](handleError(_0x2e0238,null));};exports[_0x81f7('0xc2')]=function(_0x2660e6,_0x966b6b){return db[_0x81f7('0x44')][_0x81f7('0xc2')]()[_0x81f7('0x2d')](respondWithResult(_0x966b6b,null))[_0x81f7('0x3b')](handleError(_0x966b6b,null));};exports[_0x81f7('0xc3')]=function(_0x349394,_0x522534,_0x213f40){return db[_0x81f7('0xc4')][_0x81f7('0x6a')]({'where':{'id':_0x349394['params']['id']}})[_0x81f7('0x2d')](handleEntityNotFound(_0x522534,null))[_0x81f7('0x2d')](function(_0xbb3ced){if(_0xbb3ced){return _0xbb3ced[_0x81f7('0xc3')](_0x349394['body'][_0x81f7('0xc5')],_['omit'](_0x349394[_0x81f7('0xc1')],['ids','id'])||{});}})[_0x81f7('0x2d')](respondWithResult(_0x522534,null))[_0x81f7('0x3b')](handleError(_0x522534,null));};exports[_0x81f7('0xc6')]=function(_0x554fc3,_0x18795b,_0x1782d9){var _0x24b0d3={'raw':![],'where':{}};var _0x3b8ae2={};var _0x48b39d={'count':0x0,'rows':[]};return db[_0x81f7('0x44')]['findOne']({'where':{'id':_0x554fc3['params']['id']}})[_0x81f7('0x2d')](handleEntityNotFound(_0x18795b,null))[_0x81f7('0x2d')](function(_0x26c102){if(_0x26c102){_0x3b8ae2[_0x81f7('0x46')]=_[_0x81f7('0x48')](db['OpenchannelMessage']['rawAttributes']);_0x3b8ae2[_0x81f7('0x47')]=_['keys'](_0x554fc3[_0x81f7('0x47')]);_0x3b8ae2[_0x81f7('0x49')]=_[_0x81f7('0x4a')](_0x3b8ae2[_0x81f7('0x46')],_0x3b8ae2[_0x81f7('0x47')]);_0x24b0d3[_0x81f7('0x4b')]=_[_0x81f7('0x4a')](_0x3b8ae2[_0x81f7('0x46')],qs[_0x81f7('0x4c')](_0x554fc3[_0x81f7('0x47')]['fields']));_0x24b0d3['attributes']=_0x24b0d3[_0x81f7('0x4b')][_0x81f7('0x4d')]?_0x24b0d3[_0x81f7('0x4b')]:_0x3b8ae2[_0x81f7('0x46')];if(!_0x554fc3[_0x81f7('0x47')]['hasOwnProperty']('nolimit')){_0x24b0d3[_0x81f7('0x25')]=qs[_0x81f7('0x25')](_0x554fc3[_0x81f7('0x47')][_0x81f7('0x25')]);_0x24b0d3[_0x81f7('0x23')]=qs[_0x81f7('0x23')](_0x554fc3[_0x81f7('0x47')][_0x81f7('0x23')]);}_0x24b0d3['order']=qs[_0x81f7('0x50')](_0x554fc3[_0x81f7('0x47')][_0x81f7('0x50')]);_0x24b0d3[_0x81f7('0x51')]=qs[_0x81f7('0x49')](_[_0x81f7('0x52')](_0x554fc3[_0x81f7('0x47')],_0x3b8ae2[_0x81f7('0x49')]));_0x24b0d3[_0x81f7('0x51')][_0x81f7('0xba')]=_0x26c102['id'];if(_0x554fc3[_0x81f7('0x47')][_0x81f7('0x8b')]){_0x24b0d3[_0x81f7('0x51')]=_[_0x81f7('0xa4')](_0x24b0d3['where'],{'$or':_['map'](_0x24b0d3[_0x81f7('0x4b')],function(_0x2f032c){var _0x11c606={};_0x11c606[_0x2f032c]={'$like':'%'+_0x554fc3['query']['filter']+'%'};return _0x11c606;})});}if(_0x554fc3[_0x81f7('0x47')]['$gte']){var _0x309db4=_0x554fc3[_0x81f7('0x47')][_0x81f7('0x82')][_0x81f7('0x38')](',');var _0x488959={};_0x488959[_0x309db4[0x0]]={'$gte':moment(_0x309db4[0x1])['format'](_0x81f7('0xc7'))};_0x24b0d3[_0x81f7('0x51')]=_[_0x81f7('0xa4')](_0x24b0d3[_0x81f7('0x51')],_0x488959);}_0x24b0d3=_[_0x81f7('0xa4')]({},_0x24b0d3,_0x554fc3[_0x81f7('0xbf')]);return db[_0x81f7('0xc4')][_0x81f7('0x26')]({'where':_0x24b0d3['where']})[_0x81f7('0x2d')](function(_0x1c2968){_0x48b39d[_0x81f7('0x26')]=_0x1c2968;if(_0x554fc3[_0x81f7('0x47')][_0x81f7('0xbd')]){_0x24b0d3['include']=[{'all':!![]}];}return db[_0x81f7('0xc4')][_0x81f7('0xc8')](_0x24b0d3);})[_0x81f7('0x2d')](function(_0x21df98){_0x48b39d[_0x81f7('0xc9')]=_0x21df98;return _0x48b39d;});}})[_0x81f7('0x2d')](respondWithFilteredResult(_0x18795b,_0x24b0d3))[_0x81f7('0x3b')](handleError(_0x18795b,null));};exports[_0x81f7('0xca')]=function(_0x321cfc,_0x3774f0,_0x184ed1){return db['OpenchannelInteraction'][_0x81f7('0x6a')]({'where':{'id':_0x321cfc[_0x81f7('0xbc')]['id']}})[_0x81f7('0x2d')](handleEntityNotFound(_0x3774f0,null))['then'](function(_0x20d66f){if(_0x20d66f){return _0x20d66f[_0x81f7('0xcb')](_0x321cfc['body'][_0x81f7('0xc5')],_[_0x81f7('0xcc')](_0x321cfc[_0x81f7('0xc1')],[_0x81f7('0xc5'),'id'])||{})[_0x81f7('0xcd')](function(){return db[_0x81f7('0x79')][_0x81f7('0xc8')]({'attributes':['id',_0x81f7('0x31'),'color'],'where':{'id':_0x321cfc['body']['ids']}});})['then'](function(_0x3d70d6){socket[_0x81f7('0xce')]('openchannelInteractionTags:save',{'id':Number(_0x321cfc[_0x81f7('0xbc')]['id']),'tags':_0x3d70d6||[]});return{'id':Number(_0x321cfc[_0x81f7('0xbc')]['id']),'tags':_0x3d70d6||[]};});}})[_0x81f7('0x2d')](respondWithResult(_0x3774f0,null))['catch'](handleError(_0x3774f0,null));};exports[_0x81f7('0xcf')]=function(_0x3f0da4,_0x1313b8,_0x33d9fe){return db[_0x81f7('0x44')][_0x81f7('0x6a')]({'where':{'id':_0x3f0da4['params']['id']}})[_0x81f7('0x2d')](handleEntityNotFound(_0x1313b8,null))[_0x81f7('0x2d')](function(_0x2a2670){if(_0x2a2670){return _0x2a2670[_0x81f7('0xcf')](_0x3f0da4[_0x81f7('0x47')][_0x81f7('0xc5')]);}})[_0x81f7('0x2d')](respondWithStatusCode(_0x1313b8,null))['catch'](handleError(_0x1313b8,null));};exports[_0x81f7('0xd0')]=function(_0x2b38b1,_0x16f9cc){var _0x1fbf55=moment()[_0x81f7('0xd1')]()['toString']();var _0x36bfb2=path['join'](config['root'],'server','files',_0x81f7('0xd2'));var _0x2eeb83=path['join'](config[_0x81f7('0xd3')],_0x81f7('0xd4'),_0x81f7('0xd5'),_0x81f7('0xd6'));var _0x1289d4=path['join'](_0x36bfb2,_0x1fbf55);var _0xc5503c=util[_0x81f7('0xd7')](_0x81f7('0xd8'),_0x2b38b1['params']['id'],_0x1fbf55);var _0x203ed1=path[_0x81f7('0xd9')](_0x36bfb2,_0xc5503c);var _0x10a378=[];_0x10a378[_0x81f7('0x3a')]({'model':db[_0x81f7('0xda')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x10a378[_0x81f7('0x3a')]({'model':db[_0x81f7('0xdb')],'as':_0x81f7('0x6f'),'attributes':['id',_0x81f7('0xdc'),_0x81f7('0xdd')],'raw':!![]});if(_0x2b38b1[_0x81f7('0x47')][_0x81f7('0xd6')]){_0x10a378['push']({'model':db[_0x81f7('0xde')],'as':_0x81f7('0xde'),'raw':!![]});}var _0x5ebb3c=[{'model':db[_0x81f7('0xc4')],'as':_0x81f7('0xdf'),'attributes':['id',_0x81f7('0xc1'),'createdAt',_0x81f7('0xe0'),_0x81f7('0xe1'),_0x81f7('0x86')],'include':_0x10a378}];_0x5ebb3c[_0x81f7('0x3a')]({'model':db[_0x81f7('0xe2')],'as':_0x81f7('0xe3'),'attributes':['id',_0x81f7('0x31')]});_0x5ebb3c[_0x81f7('0x3a')]({'model':db['User'],'as':_0x81f7('0xe4'),'attributes':['id',_0x81f7('0x35')]});return db[_0x81f7('0x44')]['find']({'where':{'id':_0x2b38b1[_0x81f7('0xbc')]['id']},'include':_0x5ebb3c})[_0x81f7('0x2d')](handleEntityNotFound(_0x16f9cc,null))['then'](function(_0x13599f){if(_0x13599f){var _0xf303fa=_0x13599f['get']({'plain':!![]});fs[_0x81f7('0xe5')](_0x1289d4);var _0x2d2fab={'channel':'Openchannel','account':_0xf303fa[_0x81f7('0xe3')][_0x81f7('0x31')],'agent':_0xf303fa[_0x81f7('0xe4')]?_0xf303fa[_0x81f7('0xe4')][_0x81f7('0x35')]:_0x81f7('0xe6'),'createdAt':moment(_0xf303fa['createdAt'])['format'](_0x81f7('0xc7'))[_0x81f7('0xa2')](),'closedAt':_0xf303fa[_0x81f7('0x40')]?moment(_0xf303fa[_0x81f7('0xe7')])[_0x81f7('0xd7')](_0x81f7('0xc7'))[_0x81f7('0xa2')]():'','disposition':_0xf303fa['disposition'],'visibility':_0xf303fa['threadId']?_0x81f7('0xe8'):'Private','messages':_(_0xf303fa[_0x81f7('0xdf')])['filter']({'secret':![]})['map'](function(_0x1b0ed8){if(_0x1b0ed8['Attachment']){var _0x20df26=path[_0x81f7('0xd9')](_0x2eeb83,_0x1b0ed8[_0x81f7('0xde')][_0x81f7('0xe9')]);if(fs['existsSync'](_0x20df26)){fs[_0x81f7('0xea')](_0x20df26)['pipe'](fs[_0x81f7('0xeb')](path[_0x81f7('0xd9')](_0x1289d4,_0x1b0ed8[_0x81f7('0xde')][_0x81f7('0xe9')])));}}return{'date':moment(_0x1b0ed8[_0x81f7('0x80')])[_0x81f7('0xd7')](_0x81f7('0xc7'))[_0x81f7('0xa2')](),'sender':_0x1b0ed8['direction']==='out'?_0x1b0ed8[_0x81f7('0xda')]?_0x1b0ed8['User'][_0x81f7('0x35')]:_0x81f7('0xec'):_0x1b0ed8[_0x81f7('0x6f')][_0x81f7('0xdc')]+(_0x1b0ed8[_0x81f7('0x6f')][_0x81f7('0xdd')]?'\x20'+_0x1b0ed8[_0x81f7('0x6f')]['lastName']:''),'body':_0x1b0ed8[_0x81f7('0xde')]?_0x1b0ed8[_0x81f7('0xde')][_0x81f7('0xe9')]:_0x1b0ed8[_0x81f7('0xc1')],'direction':_0x1b0ed8[_0x81f7('0xe0')]===_0x81f7('0xed')?'A':'C','secret':_0x1b0ed8[_0x81f7('0xe1')],'read':_0x1b0ed8['read'],'attachment':_0x1b0ed8[_0x81f7('0xde')]};})[_0x81f7('0x6c')]()};return ejs[_0x81f7('0xee')](path['join'](config[_0x81f7('0xd3')],_0x81f7('0xd4'),'views','downloadInteraction.ejs'),{'interaction':_0x2d2fab})[_0x81f7('0x2d')](function(_0x2719f0){var _0x2e03de=path[_0x81f7('0xd9')](_0x1289d4,_0x81f7('0xef')+_0xf303fa['id']+'-'+_0x1fbf55+_0x81f7('0xf0'));var _0x3a770f={'path':_0x2e03de,'channel':_0x81f7('0xf1'),'interactionId':_0xf303fa['id']};return pdf[_0x81f7('0xf2')](_0x2719f0,_0x3a770f);})['then'](function(){return new BPromise(function(_0x4d1e3a,_0x443520){zipdir(_0x1289d4,{'saveTo':_0x203ed1},function(_0x174726,_0x84006a){if(_0x174726)return _0x443520(_0x174726);return _0x4d1e3a(_0x84006a);});})['then'](function(){return new BPromise(function(_0x1fb6c5,_0x5f3759){rimraf(_0x1289d4,function(_0x4c4394){if(_0x4c4394)_0x5f3759(_0x4c4394);return _0x1fb6c5();});});})[_0x81f7('0x2d')](function(){return _0x16f9cc[_0x81f7('0xd0')](_0x203ed1,_0xc5503c,function(_0x1f5752){if(_0x1f5752){console['log'](_0x81f7('0xf3'),_0x1f5752);}else{fs[_0x81f7('0xf4')](_0x203ed1);}});});});}else{return _0x16f9cc['sendStatus'](0xc8);}})[_0x81f7('0x3b')](handleError(_0x16f9cc,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 80244b3..791b1da 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 _0x34e1=['events','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hook','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x34e1,0x1f0));var _0x134e=function(_0x57c076,_0x51bda7){_0x57c076=_0x57c076-0x0;var _0x42ce8c=_0x34e1[_0x57c076];return _0x42ce8c;};'use strict';var EventEmitter=require(_0x134e('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db'][_0x134e('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x134e('0x2')](0x0);var events={'afterCreate':_0x134e('0x3'),'afterUpdate':_0x134e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2ba9c8){return function(_0x56649e,_0x48cd2f,_0x5d68ec){_0x56649e[_0x134e('0x5')]({'attributes':['id'],'raw':!![]})[_0x134e('0x6')](function(_0x37a58b){_0x56649e[_0x134e('0x7')](_0x134e('0x8'),_0x37a58b[_0x134e('0x9')](function(_0x3ef310){return{'id':_0x3ef310['id']};}));return OpenchannelMessage[_0x134e('0xa')]({'where':{'OpenchannelInteractionId':_0x56649e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x49fb0a){_0x56649e[_0x134e('0x7')](_0x134e('0xb'),_0x49fb0a['length']);OpenchannelInteractionEvents['emit'](_0x2ba9c8+':'+_0x56649e['id'],_0x56649e);OpenchannelInteractionEvents[_0x134e('0xc')](_0x2ba9c8,_0x56649e);_0x5d68ec(null);})[_0x134e('0xd')](_0x5d68ec(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x134e('0xe')](e,emitEvent(event));}}module[_0x134e('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x61e9=['then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','getUsers'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x61e9,0x82));var _0x961e=function(_0x27afe6,_0x48e6e9){_0x27afe6=_0x27afe6-0x0;var _0x30efb1=_0x61e9[_0x27afe6];return _0x30efb1;};'use strict';var EventEmitter=require(_0x961e('0x0'));var OpenchannelInteraction=require(_0x961e('0x1'))['db'][_0x961e('0x2')];var OpenchannelMessage=require(_0x961e('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x961e('0x3')](0x0);var events={'afterCreate':_0x961e('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x476973){return function(_0x3aece7,_0x35f12a,_0x5c2ef9){_0x3aece7[_0x961e('0x5')]({'attributes':['id'],'raw':!![]})[_0x961e('0x6')](function(_0x4d0fb7){_0x3aece7[_0x961e('0x7')](_0x961e('0x8'),_0x4d0fb7[_0x961e('0x9')](function(_0x514288){return{'id':_0x514288['id']};}));return OpenchannelMessage[_0x961e('0xa')]({'where':{'OpenchannelInteractionId':_0x3aece7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x22628c){_0x3aece7[_0x961e('0x7')](_0x961e('0xb'),_0x22628c[_0x961e('0xc')]);OpenchannelInteractionEvents[_0x961e('0xd')](_0x476973+':'+_0x3aece7['id'],_0x3aece7);OpenchannelInteractionEvents[_0x961e('0xd')](_0x476973,_0x3aece7);_0x5c2ef9(null);})['catch'](_0x5c2ef9(null));};}for(var e in events){if(events[_0x961e('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x961e('0xf')](e,emitEvent(event));}}module[_0x961e('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index c20dee6..8959b5b 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 _0x1be0=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x2d09e5,_0x107db9){var _0xf3e36=function(_0x3ec183){while(--_0x3ec183){_0x2d09e5['push'](_0x2d09e5['shift']());}};_0xf3e36(++_0x107db9);}(_0x1be0,0x16b));var _0x01be=function(_0xd1a333,_0x24c23a){_0xd1a333=_0xd1a333-0x0;var _0x22e18a=_0x1be0[_0xd1a333];return _0x22e18a;};'use strict';var _=require('lodash');var util=require(_0x01be('0x0'));var logger=require(_0x01be('0x1'))(_0x01be('0x2'));var moment=require(_0x01be('0x3'));var BPromise=require('bluebird');var rp=require(_0x01be('0x4'));var fs=require('fs');var path=require(_0x01be('0x5'));var rimraf=require(_0x01be('0x6'));var config=require(_0x01be('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0x01be('0x8')]=function(_0x19490d,_0x508b30){return _0x19490d['define'](_0x01be('0x9'),attributes,{'tableName':_0x01be('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x01be('0xb'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x17f9ad,_0x4535ed,_0x45cb5b){if(_0x17f9ad[_0x01be('0xc')]('closed')){_0x17f9ad['closedAt']=moment()['format'](_0x01be('0xd'));}_0x45cb5b(null,_0x17f9ad);}}});}; \ No newline at end of file +var _0xca15=['utf8mb4','utf8mb4_unicode_ci','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions'];(function(_0x5a0620,_0x5ae2ed){var _0xeadd35=function(_0x57c3b2){while(--_0x57c3b2){_0x5a0620['push'](_0x5a0620['shift']());}};_0xeadd35(++_0x5ae2ed);}(_0xca15,0x83));var _0x5ca1=function(_0x25b7ea,_0x2af5c9){_0x25b7ea=_0x25b7ea-0x0;var _0x175ab1=_0xca15[_0x25b7ea];return _0x175ab1;};'use strict';var _=require(_0x5ca1('0x0'));var util=require(_0x5ca1('0x1'));var logger=require('../../config/logger')(_0x5ca1('0x2'));var moment=require(_0x5ca1('0x3'));var BPromise=require(_0x5ca1('0x4'));var rp=require(_0x5ca1('0x5'));var fs=require('fs');var path=require(_0x5ca1('0x6'));var rimraf=require(_0x5ca1('0x7'));var config=require(_0x5ca1('0x8'));var attributes=require(_0x5ca1('0x9'));module[_0x5ca1('0xa')]=function(_0x3a41cb,_0x265bc4){return _0x3a41cb[_0x5ca1('0xb')]('OpenchannelInteraction',attributes,{'tableName':_0x5ca1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5ca1('0xd'),'collate':_0x5ca1('0xe'),'hooks':{'beforeUpdate':function(_0x55e77f,_0x2d5068,_0x476053){if(_0x55e77f[_0x5ca1('0xf')]('closed')){_0x55e77f[_0x5ca1('0x10')]=moment()['format'](_0x5ca1('0x11'));}_0x476053(null,_0x55e77f);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 60ea205..c409afb 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 _0x2bf7=['stringify','error','code','message','info','catch','OpenchannelInteraction,\x20%s,\x20%s','OpenchannelInteraction','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','body','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x436aae,_0x241a29){var _0x37edff=function(_0x657d97){while(--_0x657d97){_0x436aae['push'](_0x436aae['shift']());}};_0x37edff(++_0x241a29);}(_0x2bf7,0x105));var _0x72bf=function(_0xa89c3e,_0x144268){_0xa89c3e=_0xa89c3e-0x0;var _0x48072f=_0x2bf7[_0xa89c3e];return _0x48072f;};'use strict';var _=require(_0x72bf('0x0'));var util=require(_0x72bf('0x1'));var moment=require(_0x72bf('0x2'));var BPromise=require(_0x72bf('0x3'));var rs=require(_0x72bf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72bf('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x72bf('0x6'));var config=require('../../config/environment');var jayson=require(_0x72bf('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x72bf('0x8')]=_[_0x72bf('0x9')](config['redis'],{'host':_0x72bf('0xa'),'port':0x18eb});var socket=require(_0x72bf('0xb'))(new Redis(config[_0x72bf('0x8')]));require(_0x72bf('0xc'))[_0x72bf('0xd')](socket);function respondWithRpcPromise(_0xe0e0a8,_0x1a15a2,_0x5ea4bf){return new BPromise(function(_0x1828d4,_0x12c735){return client[_0x72bf('0xe')](_0xe0e0a8,_0x5ea4bf)[_0x72bf('0xf')](function(_0x38f04d){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x1a15a2,_0x72bf('0x10'));logger[_0x72bf('0x11')](_0x72bf('0x12'),_0x1a15a2,'request\x20sent',JSON[_0x72bf('0x13')](_0x38f04d));if(_0x38f04d[_0x72bf('0x14')]){if(_0x38f04d[_0x72bf('0x14')][_0x72bf('0x15')]===0x1f4){logger[_0x72bf('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1a15a2,_0x38f04d[_0x72bf('0x14')][_0x72bf('0x16')]);return _0x12c735(_0x38f04d[_0x72bf('0x14')][_0x72bf('0x16')]);}logger[_0x72bf('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1a15a2,_0x38f04d['error']['message']);return _0x1828d4(_0x38f04d[_0x72bf('0x14')][_0x72bf('0x16')]);}else{logger[_0x72bf('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1a15a2,_0x72bf('0x10'));_0x1828d4(_0x38f04d['result'][_0x72bf('0x16')]);}})[_0x72bf('0x18')](function(_0x175b1a){logger[_0x72bf('0x14')](_0x72bf('0x19'),_0x1a15a2,_0x175b1a);_0x12c735(_0x175b1a);});});}exports['UpdateOpenchannelInteraction']=function(_0x2b2058){var _0x4ba138=this;return new Promise(function(_0x16feb9,_0x4bf313){return db[_0x72bf('0x1a')]['update'](_0x2b2058['body'],{'raw':_0x2b2058[_0x72bf('0x1b')]?_0x2b2058[_0x72bf('0x1b')][_0x72bf('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b2058[_0x72bf('0x1b')]?_0x2b2058[_0x72bf('0x1b')][_0x72bf('0x1d')]||null:null,'attributes':_0x2b2058['options']?_0x2b2058[_0x72bf('0x1b')][_0x72bf('0x1e')]||null:null,'limit':_0x2b2058[_0x72bf('0x1b')]?_0x2b2058['options'][_0x72bf('0x1f')]||null:null})[_0x72bf('0xf')](function(_0xfefb80){logger[_0x72bf('0x17')]('UpdateOpenchannelInteraction',_0x2b2058);logger[_0x72bf('0x11')](_0x72bf('0x20'),_0x2b2058,JSON[_0x72bf('0x13')](_0xfefb80));_0x16feb9(_0xfefb80);})['catch'](function(_0x54e800){logger['error'](_0x72bf('0x20'),_0x54e800['message'],_0x2b2058);_0x4bf313(_0x4ba138[_0x72bf('0x14')](0x1f4,_0x54e800[_0x72bf('0x16')]));});});};exports[_0x72bf('0x21')]=function(_0x5821a5){return new Promise(function(_0x53364c,_0x5a9ae9){return db['OpenchannelInteraction'][_0x72bf('0x22')]({'where':_0x5821a5[_0x72bf('0x1b')]?_0x5821a5['options'][_0x72bf('0x1d')]||null:null})[_0x72bf('0xf')](function(_0xddc68d){if(_0xddc68d){return _0xddc68d[_0x72bf('0x23')](_0x5821a5['body'][_0x72bf('0x24')],_[_0x72bf('0x25')](_0x5821a5[_0x72bf('0x26')],[_0x72bf('0x24'),'id'])||{});}})['spread'](function(_0x170194){logger[_0x72bf('0x17')](_0x72bf('0x27'),_0x5821a5);logger[_0x72bf('0x11')](_0x72bf('0x27'),_0x5821a5,JSON[_0x72bf('0x13')](_0x170194));_0x53364c(_0x170194);})[_0x72bf('0x18')](function(_0xeffa74){logger[_0x72bf('0x14')](_0x72bf('0x27'),_0xeffa74[_0x72bf('0x16')],_0x5821a5);_0x5a9ae9(_this['error'](0x1f4,_0xeffa74[_0x72bf('0x16')]));});});}; \ No newline at end of file +var _0x5917=['attributes','limit','AddTagsToOpenchannelInteraction','find','where','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw'];(function(_0x5d495a,_0x59f779){var _0x556eaf=function(_0x19e20e){while(--_0x19e20e){_0x5d495a['push'](_0x5d495a['shift']());}};_0x556eaf(++_0x59f779);}(_0x5917,0x172));var _0x7591=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5917[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7591('0x0'));var util=require(_0x7591('0x1'));var moment=require(_0x7591('0x2'));var BPromise=require(_0x7591('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7591('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7591('0x5'));var logger=require(_0x7591('0x6'))(_0x7591('0x7'));var config=require(_0x7591('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7591('0x9')][_0x7591('0xa')]({'port':0x232a});config[_0x7591('0xb')]=_[_0x7591('0xc')](config['redis'],{'host':_0x7591('0xd'),'port':0x18eb});var socket=require(_0x7591('0xe'))(new Redis(config['redis']));require(_0x7591('0xf'))[_0x7591('0x10')](socket);function respondWithRpcPromise(_0x32bc35,_0x44ac44,_0x13bf00){return new BPromise(function(_0x212a72,_0x466539){return client[_0x7591('0x11')](_0x32bc35,_0x13bf00)[_0x7591('0x12')](function(_0x4824c9){logger[_0x7591('0x13')](_0x7591('0x14'),_0x44ac44,_0x7591('0x15'));logger[_0x7591('0x16')](_0x7591('0x17'),_0x44ac44,'request\x20sent',JSON[_0x7591('0x18')](_0x4824c9));if(_0x4824c9['error']){if(_0x4824c9[_0x7591('0x19')][_0x7591('0x1a')]===0x1f4){logger[_0x7591('0x19')](_0x7591('0x14'),_0x44ac44,_0x4824c9[_0x7591('0x19')][_0x7591('0x1b')]);return _0x466539(_0x4824c9[_0x7591('0x19')]['message']);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x44ac44,_0x4824c9[_0x7591('0x19')][_0x7591('0x1b')]);return _0x212a72(_0x4824c9['error'][_0x7591('0x1b')]);}else{logger[_0x7591('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x44ac44,_0x7591('0x15'));_0x212a72(_0x4824c9[_0x7591('0x1c')]['message']);}})[_0x7591('0x1d')](function(_0x299ec1){logger[_0x7591('0x19')](_0x7591('0x14'),_0x44ac44,_0x299ec1);_0x466539(_0x299ec1);});});}exports[_0x7591('0x1e')]=function(_0x175bbe){var _0x2c9eca=this;return new Promise(function(_0x2d2080,_0xbaaa1b){return db[_0x7591('0x1f')][_0x7591('0x20')](_0x175bbe['body'],{'raw':_0x175bbe[_0x7591('0x21')]?_0x175bbe[_0x7591('0x21')][_0x7591('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x175bbe['options']?_0x175bbe['options']['where']||null:null,'attributes':_0x175bbe[_0x7591('0x21')]?_0x175bbe[_0x7591('0x21')][_0x7591('0x23')]||null:null,'limit':_0x175bbe[_0x7591('0x21')]?_0x175bbe[_0x7591('0x21')][_0x7591('0x24')]||null:null})[_0x7591('0x12')](function(_0x1e29f8){logger[_0x7591('0x13')](_0x7591('0x1e'),_0x175bbe);logger[_0x7591('0x16')]('UpdateOpenchannelInteraction',_0x175bbe,JSON[_0x7591('0x18')](_0x1e29f8));_0x2d2080(_0x1e29f8);})[_0x7591('0x1d')](function(_0x1492cd){logger[_0x7591('0x19')](_0x7591('0x1e'),_0x1492cd[_0x7591('0x1b')],_0x175bbe);_0xbaaa1b(_0x2c9eca[_0x7591('0x19')](0x1f4,_0x1492cd[_0x7591('0x1b')]));});});};exports[_0x7591('0x25')]=function(_0x418da5){return new Promise(function(_0x20608d,_0x25f012){return db[_0x7591('0x1f')][_0x7591('0x26')]({'where':_0x418da5[_0x7591('0x21')]?_0x418da5['options'][_0x7591('0x27')]||null:null})[_0x7591('0x12')](function(_0x2d077e){if(_0x2d077e){return _0x2d077e[_0x7591('0x28')](_0x418da5[_0x7591('0x29')][_0x7591('0x2a')],_['omit'](_0x418da5[_0x7591('0x29')],[_0x7591('0x2a'),'id'])||{});}})[_0x7591('0x2b')](function(_0x323db7){logger[_0x7591('0x13')](_0x7591('0x2c'),_0x418da5);logger['debug'](_0x7591('0x2c'),_0x418da5,JSON[_0x7591('0x18')](_0x323db7));_0x20608d(_0x323db7);})[_0x7591('0x1d')](function(_0x233012){logger['error'](_0x7591('0x2c'),_0x233012[_0x7591('0x1b')],_0x418da5);_0x25f012(_this[_0x7591('0x19')](0x1f4,_0x233012['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 8fc462c..66cf694 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 _0xe6c4=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','emit','register'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xe6c4,0x13d));var _0x4e6c=function(_0x33fc66,_0x580225){_0x33fc66=_0x33fc66-0x0;var _0x249234=_0xe6c4[_0x33fc66];return _0x249234;};'use strict';var OpenchannelInteractionEvents=require(_0x4e6c('0x0'));var events=[_0x4e6c('0x1'),_0x4e6c('0x2'),'update'];function createListener(_0x24da41,_0x2c2000){return function(_0x588413){_0x2c2000[_0x4e6c('0x3')](_0x24da41,_0x588413);};}function removeListener(_0x1e7a9c,_0x34982e){return function(){OpenchannelInteractionEvents['removeListener'](_0x1e7a9c,_0x34982e);};}exports[_0x4e6c('0x4')]=function(_0x247972){for(var _0x4763ef=0x0,_0x6fd3f4=events[_0x4e6c('0x5')];_0x4763ef<_0x6fd3f4;_0x4763ef++){var _0x18534e=events[_0x4763ef];var _0x533807=createListener(_0x4e6c('0x6')+_0x18534e,_0x247972);OpenchannelInteractionEvents['on'](_0x18534e,_0x533807);}}; \ No newline at end of file +var _0x81f1=['update','register','length','openchannelInteraction:','./openchannelInteraction.events','remove'];(function(_0x1229c8,_0x1a7f0f){var _0x3ae885=function(_0x27b46d){while(--_0x27b46d){_0x1229c8['push'](_0x1229c8['shift']());}};_0x3ae885(++_0x1a7f0f);}(_0x81f1,0x17e));var _0x181f=function(_0x176c7e,_0x404a2c){_0x176c7e=_0x176c7e-0x0;var _0x8c5dd4=_0x81f1[_0x176c7e];return _0x8c5dd4;};'use strict';var OpenchannelInteractionEvents=require(_0x181f('0x0'));var events=['save',_0x181f('0x1'),_0x181f('0x2')];function createListener(_0x12897a,_0x1c8765){return function(_0x2754e1){_0x1c8765['emit'](_0x12897a,_0x2754e1);};}function removeListener(_0xe7c8f6,_0xe49e28){return function(){OpenchannelInteractionEvents['removeListener'](_0xe7c8f6,_0xe49e28);};}exports[_0x181f('0x3')]=function(_0x2c2975){for(var _0x3f9539=0x0,_0x753371=events[_0x181f('0x4')];_0x3f9539<_0x753371;_0x3f9539++){var _0x37c701=events[_0x3f9539];var _0x3cc709=createListener(_0x181f('0x5')+_0x37c701,_0x2c2975);OpenchannelInteractionEvents['on'](_0x37c701,_0x3cc709);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 8eb6626..8e118f6 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x4f1af9,_0xc95c63){var _0x11a60e=function(_0x19de7f){while(--_0x19de7f){_0x4f1af9['push'](_0x4f1af9['shift']());}};_0x11a60e(++_0xc95c63);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0xcb91[_0x35fabd];return _0x61a8ee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _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(_0x1cb029,_0xc8baba){var _0x4e1524=function(_0x4eb61b){while(--_0x4eb61b){_0x1cb029['push'](_0x1cb029['shift']());}};_0x4e1524(++_0xc8baba);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 083c19f..8fc4da7 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 _0x056b=['medium','BOOLEAN','ENUM','out','DATE','STRING','exports','TEXT'];(function(_0xc4e092,_0x5059f7){var _0xa4f542=function(_0x302769){while(--_0x302769){_0xc4e092['push'](_0xc4e092['shift']());}};_0xa4f542(++_0x5059f7);}(_0x056b,0xb6));var _0xb056=function(_0x1e753b,_0x209149){_0x1e753b=_0x1e753b-0x0;var _0x13d34e=_0x056b[_0x1e753b];return _0x13d34e;};'use strict';var Sequelize=require('sequelize');module[_0xb056('0x0')]={'body':{'type':Sequelize[_0xb056('0x1')](_0xb056('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb056('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb056('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb056('0x4')]('in',_0xb056('0x5')),'defaultValue':_0xb056('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb056('0x6')]},'providerName':{'type':Sequelize[_0xb056('0x7')]},'providerResponse':{'type':Sequelize[_0xb056('0x1')]}}; \ No newline at end of file +var _0xb2af=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb2af,0xd2));var _0xfb2a=function(_0x63d277,_0x2f59bd){_0x63d277=_0x63d277-0x0;var _0x1435bd=_0xb2af[_0x63d277];return _0x1435bd;};'use strict';var Sequelize=require(_0xfb2a('0x0'));module[_0xfb2a('0x1')]={'body':{'type':Sequelize[_0xfb2a('0x2')](_0xfb2a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xfb2a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfb2a('0x5')]('in',_0xfb2a('0x6')),'defaultValue':_0xfb2a('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xfb2a('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xfb2a('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 808dc06..8a03c8a 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 _0x5c73=['catch','show','length','find','create','body','params','describe','openchannel-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','fullname','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','SELECT','email','internal','rejectmessage','rimraf','zip-dir','fast-json-patch','moment','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/license/util','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','end','stack','name','index','OpenchannelMessage','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','merge','VIRTUAL','include','findAll','rows'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x5c73,0x12f));var _0x35c7=function(_0x4bd10c,_0x1b2b5e){_0x4bd10c=_0x4bd10c-0x0;var _0x3913d2=_0x5c73[_0x4bd10c];return _0x3913d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35c7('0x0'));var zipdir=require(_0x35c7('0x1'));var jsonpatch=require(_0x35c7('0x2'));var rp=require('request-promise');var moment=require(_0x35c7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x35c7('0x4'));var util=require(_0x35c7('0x5'));var path=require(_0x35c7('0x6'));var sox=require(_0x35c7('0x7'));var csv=require(_0x35c7('0x8'));var ejs=require(_0x35c7('0x9'));var fs=require('fs');var fs_extra=require(_0x35c7('0xa'));var _=require(_0x35c7('0xb'));var squel=require('squel');var crypto=require(_0x35c7('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x35c7('0x8'));var querystring=require(_0x35c7('0xd'));var Papa=require(_0x35c7('0xe'));var Redis=require(_0x35c7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x35c7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35c7('0x11'));var logger=require(_0x35c7('0x12'))(_0x35c7('0x13'));var utils=require(_0x35c7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x35c7('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x35c7('0x16')](config[_0x35c7('0x17')],{'host':_0x35c7('0x18'),'port':0x18eb});var socket=require(_0x35c7('0x19'))(new Redis(config[_0x35c7('0x17')]));require(_0x35c7('0x1a'))[_0x35c7('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x35c7('0x1c')][_0x35c7('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x35c7('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1d922a,_0x1e7749,_0x35f706,_0x40041f){return new BPromise(function(_0x136e30,_0x3b67d7){var _0xf8d93f=_0x40041f||client;return _0xf8d93f[_0x35c7('0x1e')](_0x1d922a,_0x35f706)[_0x35c7('0x1f')](function(_0x2b3083){logger[_0x35c7('0x20')](_0x35c7('0x21'),_0x1e7749,'request\x20sent');logger['debug'](_0x35c7('0x22'),_0x1e7749,_0x35c7('0x23'),JSON[_0x35c7('0x24')](_0x2b3083));if(_0x2b3083['error']){if(_0x2b3083['error'][_0x35c7('0x25')]===0x1f4){logger[_0x35c7('0x26')](_0x35c7('0x21'),_0x1e7749,_0x2b3083['error']['message']);return _0x3b67d7(_0x2b3083['error'][_0x35c7('0x27')]);}logger[_0x35c7('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x1e7749,_0x2b3083[_0x35c7('0x26')]['message']);return _0x136e30(_0x2b3083['error'][_0x35c7('0x27')]);}else{logger['info'](_0x35c7('0x21'),_0x1e7749,_0x35c7('0x23'));_0x136e30(_0x2b3083['result'][_0x35c7('0x27')]);}})['catch'](function(_0x2dc35e){logger[_0x35c7('0x26')](_0x35c7('0x21'),_0x1e7749,_0x2dc35e);_0x3b67d7(_0x2dc35e);});});}function respondWithStatusCode(_0x5479de,_0x4eaca8){_0x4eaca8=_0x4eaca8||0xcc;return function(_0x5d968a){if(_0x5d968a){return _0x5479de[_0x35c7('0x28')](_0x4eaca8);}return _0x5479de[_0x35c7('0x29')](_0x4eaca8)['end']();};}function respondWithResult(_0x3ed6f6,_0x22bdae){_0x22bdae=_0x22bdae||0xc8;return function(_0x58f0af){if(_0x58f0af){return _0x3ed6f6[_0x35c7('0x29')](_0x22bdae)[_0x35c7('0x2a')](_0x58f0af);}};}function respondWithFilteredResult(_0x3a5a3a,_0x7eb7d3){return function(_0x5d3ee6){if(_0x5d3ee6){var _0x555e19=typeof _0x7eb7d3[_0x35c7('0x2b')]===_0x35c7('0x2c')&&typeof _0x7eb7d3[_0x35c7('0x2d')]==='undefined';var _0x876a92=_0x5d3ee6['count'];var _0x4bf11b=_0x555e19?0x0:_0x7eb7d3['offset'];var _0x147fe1=_0x555e19?_0x5d3ee6[_0x35c7('0x2e')]:_0x7eb7d3[_0x35c7('0x2b')]+_0x7eb7d3[_0x35c7('0x2d')];var _0x5f3369;if(_0x147fe1>=_0x876a92){_0x147fe1=_0x876a92;_0x5f3369=0xc8;}else{_0x5f3369=0xce;}_0x3a5a3a['status'](_0x5f3369);return _0x3a5a3a[_0x35c7('0x2f')](_0x35c7('0x30'),_0x4bf11b+'-'+_0x147fe1+'/'+_0x876a92)[_0x35c7('0x2a')](_0x5d3ee6);}return null;};}function patchUpdates(_0x148c73){return function(_0x2e80da){try{jsonpatch[_0x35c7('0x31')](_0x2e80da,_0x148c73,!![]);}catch(_0x3c4010){return BPromise[_0x35c7('0x32')](_0x3c4010);}return _0x2e80da['save']();};}function saveUpdates(_0x5b280c,_0x3582c1){return function(_0x1b92f5){if(_0x1b92f5){return _0x1b92f5[_0x35c7('0x33')](_0x5b280c)[_0x35c7('0x1f')](function(_0x55b431){return _0x55b431;});}return null;};}function removeEntity(_0x442fde,_0x1e1b51){return function(_0xe98d99){if(_0xe98d99){return _0xe98d99[_0x35c7('0x34')]()['then'](function(){_0x442fde[_0x35c7('0x29')](0xcc)[_0x35c7('0x35')]();});}};}function handleEntityNotFound(_0x4a822f,_0x3ae5ec){return function(_0x45a0c7){if(!_0x45a0c7){_0x4a822f['sendStatus'](0x194);}return _0x45a0c7;};}function handleError(_0x217b65,_0x400784){_0x400784=_0x400784||0x1f4;return function(_0x494342){logger[_0x35c7('0x26')](_0x494342[_0x35c7('0x36')]);if(_0x494342[_0x35c7('0x37')]){delete _0x494342[_0x35c7('0x37')];}_0x217b65[_0x35c7('0x29')](_0x400784)['send'](_0x494342);};}exports[_0x35c7('0x38')]=function(_0x53d3bd,_0x4c66e0){var _0x4b9c3c={},_0x24de85={},_0xc4079c={'count':0x0,'rows':[]};var _0xf7991=_['map'](db[_0x35c7('0x39')][_0x35c7('0x3a')],function(_0x28d817){return{'name':_0x28d817[_0x35c7('0x3b')],'type':_0x28d817[_0x35c7('0x3c')][_0x35c7('0x3d')]};});_0x24de85[_0x35c7('0x3e')]=_[_0x35c7('0x3f')](_0xf7991,_0x35c7('0x37'));_0x24de85[_0x35c7('0x40')]=_['keys'](_0x53d3bd[_0x35c7('0x40')]);_0x24de85[_0x35c7('0x41')]=_[_0x35c7('0x42')](_0x24de85[_0x35c7('0x3e')],_0x24de85[_0x35c7('0x40')]);_0x4b9c3c[_0x35c7('0x43')]=_[_0x35c7('0x42')](_0x24de85['model'],qs[_0x35c7('0x44')](_0x53d3bd[_0x35c7('0x40')][_0x35c7('0x44')]));_0x4b9c3c['attributes']=_0x4b9c3c['attributes']['length']?_0x4b9c3c[_0x35c7('0x43')]:_0x24de85[_0x35c7('0x3e')];if(!_0x53d3bd['query'][_0x35c7('0x45')]('nolimit')){_0x4b9c3c[_0x35c7('0x2d')]=qs['limit'](_0x53d3bd[_0x35c7('0x40')][_0x35c7('0x2d')]);_0x4b9c3c[_0x35c7('0x2b')]=qs[_0x35c7('0x2b')](_0x53d3bd[_0x35c7('0x40')][_0x35c7('0x2b')]);}_0x4b9c3c['order']=qs[_0x35c7('0x46')](_0x53d3bd[_0x35c7('0x40')][_0x35c7('0x46')]);_0x4b9c3c[_0x35c7('0x47')]=qs[_0x35c7('0x41')](_[_0x35c7('0x48')](_0x53d3bd[_0x35c7('0x40')],_0x24de85[_0x35c7('0x41')]),_0xf7991);if(_0x53d3bd[_0x35c7('0x40')]['filter']){_0x4b9c3c[_0x35c7('0x47')]=_[_0x35c7('0x49')](_0x4b9c3c['where'],{'$or':_[_0x35c7('0x3f')](_0xf7991,function(_0x587a76){if(_0x587a76['type']!==_0x35c7('0x4a')){var _0x5db36d={};_0x5db36d[_0x587a76[_0x35c7('0x37')]]={'$like':'%'+_0x53d3bd[_0x35c7('0x40')]['filter']+'%'};return _0x5db36d;}})});}_0x4b9c3c=_['merge']({},_0x4b9c3c,_0x53d3bd['options']);var _0x1f2bb3={'where':_0x4b9c3c[_0x35c7('0x47')]};return db[_0x35c7('0x39')][_0x35c7('0x2e')](_0x1f2bb3)[_0x35c7('0x1f')](function(_0xc201d7){_0xc4079c[_0x35c7('0x2e')]=_0xc201d7;if(_0x53d3bd['query']['includeAll']){_0x4b9c3c[_0x35c7('0x4b')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x35c7('0x4c')](_0x4b9c3c);})[_0x35c7('0x1f')](function(_0x934316){_0xc4079c[_0x35c7('0x4d')]=_0x934316;return _0xc4079c;})['then'](respondWithFilteredResult(_0x4c66e0,_0x4b9c3c))[_0x35c7('0x4e')](handleError(_0x4c66e0,null));};exports[_0x35c7('0x4f')]=function(_0x15467d,_0x5d10af){var _0x9f4f10={'raw':!![],'where':{'id':_0x15467d['params']['id']}},_0xb90d23={};_0xb90d23[_0x35c7('0x3e')]=_['keys'](db[_0x35c7('0x39')][_0x35c7('0x3a')]);_0xb90d23['query']=_['keys'](_0x15467d['query']);_0xb90d23[_0x35c7('0x41')]=_['intersection'](_0xb90d23[_0x35c7('0x3e')],_0xb90d23[_0x35c7('0x40')]);_0x9f4f10[_0x35c7('0x43')]=_['intersection'](_0xb90d23[_0x35c7('0x3e')],qs[_0x35c7('0x44')](_0x15467d[_0x35c7('0x40')]['fields']));_0x9f4f10[_0x35c7('0x43')]=_0x9f4f10['attributes'][_0x35c7('0x50')]?_0x9f4f10[_0x35c7('0x43')]:_0xb90d23[_0x35c7('0x3e')];if(_0x15467d['query']['includeAll']){_0x9f4f10[_0x35c7('0x4b')]=[{'all':!![]}];}_0x9f4f10=_[_0x35c7('0x49')]({},_0x9f4f10,_0x15467d['options']);return db[_0x35c7('0x39')][_0x35c7('0x51')](_0x9f4f10)[_0x35c7('0x1f')](handleEntityNotFound(_0x5d10af,null))['then'](respondWithResult(_0x5d10af,null))['catch'](handleError(_0x5d10af,null));};exports[_0x35c7('0x52')]=function(_0x58600d,_0x9aa998){return db[_0x35c7('0x39')][_0x35c7('0x52')](_0x58600d[_0x35c7('0x53')],{})[_0x35c7('0x1f')](respondWithResult(_0x9aa998,0xc9))[_0x35c7('0x4e')](handleError(_0x9aa998,null));};exports['update']=function(_0x383d21,_0x27281d){if(_0x383d21[_0x35c7('0x53')]['id']){delete _0x383d21['body']['id'];}return db[_0x35c7('0x39')]['find']({'where':{'id':_0x383d21[_0x35c7('0x54')]['id']}})[_0x35c7('0x1f')](handleEntityNotFound(_0x27281d,null))[_0x35c7('0x1f')](saveUpdates(_0x383d21[_0x35c7('0x53')],null))[_0x35c7('0x1f')](respondWithResult(_0x27281d,null))[_0x35c7('0x4e')](handleError(_0x27281d,null));};exports[_0x35c7('0x34')]=function(_0x1b1d65,_0x33a9f3){return db[_0x35c7('0x39')][_0x35c7('0x51')]({'where':{'id':_0x1b1d65[_0x35c7('0x54')]['id']}})[_0x35c7('0x1f')](handleEntityNotFound(_0x33a9f3,null))[_0x35c7('0x1f')](removeEntity(_0x33a9f3,null))['catch'](handleError(_0x33a9f3,null));};exports[_0x35c7('0x55')]=function(_0x1cf299,_0x34fc5f){return db[_0x35c7('0x39')][_0x35c7('0x55')]()['then'](respondWithResult(_0x34fc5f,null))[_0x35c7('0x4e')](handleError(_0x34fc5f,null));};var interaction_log=require(_0x35c7('0x12'))(_0x35c7('0x56'));exports[_0x35c7('0x57')]=function(_0x5823f3,_0x4da80c,_0x5b565b){var _0x4ffa85={'agent':{},'channel':'openchannel'};if(_0x5823f3[_0x35c7('0x53')]['id']){delete _0x5823f3[_0x35c7('0x53')]['id'];}_0x5823f3[_0x35c7('0x53')][_0x35c7('0x58')]=!![];_0x5823f3[_0x35c7('0x53')][_0x35c7('0x59')]=moment()[_0x35c7('0x5a')](_0x35c7('0x5b'));_0x5823f3[_0x35c7('0x53')][_0x35c7('0x5c')]=_0x5823f3[_0x35c7('0x53')][_0x35c7('0x5c')]||_0x5823f3[_0x35c7('0x5d')]['id'];_0x4ffa85[_0x35c7('0x5e')]['id']=_0x5823f3['body'][_0x35c7('0x5c')];return db[_0x35c7('0x39')][_0x35c7('0x51')]({'where':{'id':_0x5823f3[_0x35c7('0x54')]['id'],'UserId':null}})[_0x35c7('0x1f')](handleEntityNotFound(_0x4da80c,null))[_0x35c7('0x1f')](saveUpdates(_0x5823f3[_0x35c7('0x53')],null))[_0x35c7('0x1f')](function(_0x596760){if(_0x596760){_0x4ffa85[_0x35c7('0x27')]=_0x596760[_0x35c7('0x5f')]({'plain':!![]});return db[_0x35c7('0x60')][_0x35c7('0x51')]({'where':{'id':_0x596760['OpenchannelInteractionId']}});}return null;})[_0x35c7('0x1f')](handleEntityNotFound(_0x4da80c,null))[_0x35c7('0x1f')](function(_0x1f5f99){if(_0x1f5f99){return _0x1f5f99[_0x35c7('0x33')]({'UserId':_0x5823f3[_0x35c7('0x53')][_0x35c7('0x5c')],'read1stAt':_[_0x35c7('0x61')](_0x1f5f99[_0x35c7('0x62')])?moment()[_0x35c7('0x5a')](_0x35c7('0x5b')):undefined});}return null;})[_0x35c7('0x1f')](function(_0xb58918){if(_0xb58918){_0x4ffa85[_0x35c7('0x63')]=_0xb58918[_0x35c7('0x5f')]({'plain':!![]});interaction_log[_0x35c7('0x20')](_0x35c7('0x64'),_0x5823f3[_0x35c7('0x5d')]['id'],_0x5823f3[_0x35c7('0x5d')][_0x35c7('0x37')],_0x5823f3[_0x35c7('0x5d')][_0x35c7('0x65')],_0x4ffa85['interaction']['id'],_0x5823f3[_0x35c7('0x53')]?JSON[_0x35c7('0x24')](_0x5823f3[_0x35c7('0x53')]):_0x35c7('0x66'));return respondWithRpcPromise('AcceptMessage',_0x35c7('0x67'),_0x4ffa85);}return null;})[_0x35c7('0x1f')](function(_0x58cdb0){var _0x272c4c=_0x35c7('0x68')+_0x58cdb0[_0x35c7('0x27')]['ContactId'];return db[_0x35c7('0x69')][_0x35c7('0x40')](_0x272c4c,{'type':db[_0x35c7('0x6a')][_0x35c7('0x6b')]['SELECT'],'raw':!![]})[_0x35c7('0x1f')](function(_0x5bea6f){return _0x5bea6f;});})[_0x35c7('0x1f')](function(_0x3ecbde){if(_0x3ecbde){_0x4ffa85[_0x35c7('0x27')][_0x35c7('0x6c')]=_0x3ecbde[0x0];if(!_0x5823f3[_0x35c7('0x53')]['UserId'])return;return db[_0x35c7('0x6d')]['find']({'where':{'id':_0x5823f3[_0x35c7('0x53')]['UserId'],'role':_0x35c7('0x5e')},'attributes':['id',_0x35c7('0x37'),_0x35c7('0x6e'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x1b8b6f){if(!_0x1b8b6f)return null;_0x4ffa85[_0x35c7('0x27')]['agent']=_0x1b8b6f;return _0x4ffa85;})['then'](function(_0x582491){if(_0x582491){if(_0x5823f3['body']['manual']){_0x4ffa85[_0x35c7('0x27')][_0x35c7('0x6f')]=util[_0x35c7('0x5a')](_0x35c7('0x70'),_0x5823f3['user'][_0x35c7('0x37')]);_0x4ffa85['message']['channel']=_0x4ffa85[_0x35c7('0x71')];_0x4ffa85['message'][_0x35c7('0x72')]=_0x4ffa85[_0x35c7('0x71')];_0x4ffa85['message'][_0x35c7('0x73')]='accept';return respondWithRpcPromise('EventManager',_0x35c7('0x74'),{'event':_0x35c7('0x75'),'message':_0x4ffa85[_0x35c7('0x27')]},client9002)['then'](function(){return _0x4ffa85;});}return _0x4ffa85;}return null;})[_0x35c7('0x1f')](respondWithResult(_0x4da80c,null))[_0x35c7('0x4e')](handleError(_0x4da80c,null));};var interaction_log=require(_0x35c7('0x12'))(_0x35c7('0x56'));exports[_0x35c7('0x32')]=function(_0x4f8389,_0x3fd4c9,_0x12c8f8){var _0x573a99={'agent':{},'channel':_0x35c7('0x76')};if(_0x4f8389[_0x35c7('0x53')]['id']){delete _0x4f8389['body']['id'];}_0x4f8389[_0x35c7('0x53')]['UserId']=_0x4f8389[_0x35c7('0x53')]['UserId']||_0x4f8389[_0x35c7('0x5d')]['id'];_0x573a99[_0x35c7('0x5e')]['id']=_0x4f8389[_0x35c7('0x53')]['UserId'];return db['OpenchannelMessage'][_0x35c7('0x51')]({'where':{'id':_0x4f8389['params']['id'],'UserId':null}})[_0x35c7('0x1f')](handleEntityNotFound(_0x3fd4c9,null))[_0x35c7('0x1f')](function(_0x365771){if(_0x365771){_0x573a99[_0x35c7('0x27')]=_0x365771[_0x35c7('0x5f')]({'plain':!![]});return db[_0x35c7('0x60')][_0x35c7('0x51')]({'where':{'id':_0x365771[_0x35c7('0x77')]}});}return null;})[_0x35c7('0x1f')](handleEntityNotFound(_0x3fd4c9,null))[_0x35c7('0x1f')](function(_0x4930b7){if(_0x4930b7){_0x573a99['interaction']=_0x4930b7[_0x35c7('0x5f')]({'plain':!![]});interaction_log[_0x35c7('0x20')](_0x35c7('0x78'),_0x4f8389['user']['id'],_0x4f8389['user'][_0x35c7('0x37')],_0x4f8389[_0x35c7('0x5d')]['role'],_0x573a99[_0x35c7('0x63')]['id'],_0x4f8389['body']?JSON[_0x35c7('0x24')](_0x4f8389[_0x35c7('0x53')]):'null');return respondWithRpcPromise(_0x35c7('0x79'),'rejectMessage',_0x573a99);}return null;})['then'](function(_0x4affce){var _0x1b8bfe=_0x35c7('0x68')+_0x4affce[_0x35c7('0x27')][_0x35c7('0x7a')];return db[_0x35c7('0x69')][_0x35c7('0x40')](_0x1b8bfe,{'type':db['Sequelize'][_0x35c7('0x6b')][_0x35c7('0x7b')],'raw':!![]})[_0x35c7('0x1f')](function(_0x32c597){return _0x32c597;});})[_0x35c7('0x1f')](function(_0x365eab){if(_0x365eab){_0x573a99[_0x35c7('0x27')][_0x35c7('0x6c')]=_0x365eab[0x0];if(!_0x4f8389[_0x35c7('0x53')]['UserId'])return;return db[_0x35c7('0x6d')]['find']({'where':{'id':_0x4f8389[_0x35c7('0x53')][_0x35c7('0x5c')],'role':_0x35c7('0x5e')},'attributes':['id',_0x35c7('0x37'),'fullname',_0x35c7('0x7c'),_0x35c7('0x7d')],'raw':!![]});}return null;})['then'](function(_0x737ce5){if(!_0x737ce5)return null;_0x573a99[_0x35c7('0x27')]['agent']=_0x737ce5;return _0x573a99;})['then'](function(_0x267b09){if(_0x267b09){_0x267b09[_0x35c7('0x27')][_0x35c7('0x6f')]=util[_0x35c7('0x5a')](_0x35c7('0x70'),_0x4f8389[_0x35c7('0x5d')][_0x35c7('0x37')]);_0x267b09[_0x35c7('0x27')][_0x35c7('0x71')]=_0x573a99[_0x35c7('0x71')];_0x267b09[_0x35c7('0x27')][_0x35c7('0x72')]=_0x573a99['channel'];_0x267b09[_0x35c7('0x27')][_0x35c7('0x73')]='reject';respondWithRpcPromise(_0x35c7('0x74'),_0x35c7('0x74'),{'event':_0x35c7('0x7e'),'message':_0x267b09[_0x35c7('0x27')]},client9002);return _0x573a99;}return null;})[_0x35c7('0x1f')](respondWithResult(_0x3fd4c9,null))['catch'](handleError(_0x3fd4c9,null));}; \ No newline at end of file +var _0x081c=['request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','destroy','stack','name','send','map','OpenchannelMessage','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','create','body','find','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[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','Sequelize','QueryTypes','contact','User','fullname','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','SELECT','email','rejectmessage','eml-format','moment','bluebird','util','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x081c,0xeb));var _0xc081=function(_0x17cded,_0xa51b6b){_0x17cded=_0x17cded-0x0;var _0x41b11f=_0x081c[_0x17cded];return _0x41b11f;};'use strict';var emlformat=require(_0xc081('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc081('0x1'));var BPromise=require(_0xc081('0x2'));var Mustache=require('mustache');var util=require(_0xc081('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xc081('0x4'));var ejs=require(_0xc081('0x5'));var fs=require('fs');var fs_extra=require(_0xc081('0x6'));var _=require('lodash');var squel=require(_0xc081('0x7'));var crypto=require('crypto');var jsforce=require(_0xc081('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xc081('0x4'));var querystring=require(_0xc081('0x9'));var Papa=require(_0xc081('0xa'));var Redis=require('ioredis');var authService=require(_0xc081('0xb'));var qs=require(_0xc081('0xc'));var as=require(_0xc081('0xd'));var hardwareService=require(_0xc081('0xe'));var logger=require('../../config/logger')(_0xc081('0xf'));var utils=require(_0xc081('0x10'));var config=require(_0xc081('0x11'));var licenseUtil=require(_0xc081('0x12'));var db=require(_0xc081('0x13'))['db'];config['redis']=_[_0xc081('0x14')](config[_0xc081('0x15')],{'host':_0xc081('0x16'),'port':0x18eb});var socket=require(_0xc081('0x17'))(new Redis(config[_0xc081('0x15')]));require(_0xc081('0x18'))['register'](socket);var jayson=require(_0xc081('0x19'));var client=jayson[_0xc081('0x1a')][_0xc081('0x1b')]({'port':0x232c});var client9002=jayson[_0xc081('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bd896,_0x43b2ee,_0x3ad86a,_0x32d420){return new BPromise(function(_0x7a7a89,_0xa72ac2){var _0x203ab9=_0x32d420||client;return _0x203ab9['request'](_0x4bd896,_0x3ad86a)[_0xc081('0x1c')](function(_0xfe3ba7){logger[_0xc081('0x1d')](_0xc081('0x1e'),_0x43b2ee,_0xc081('0x1f'));logger['debug'](_0xc081('0x20'),_0x43b2ee,_0xc081('0x1f'),JSON[_0xc081('0x21')](_0xfe3ba7));if(_0xfe3ba7[_0xc081('0x22')]){if(_0xfe3ba7[_0xc081('0x22')][_0xc081('0x23')]===0x1f4){logger[_0xc081('0x22')](_0xc081('0x1e'),_0x43b2ee,_0xfe3ba7[_0xc081('0x22')][_0xc081('0x24')]);return _0xa72ac2(_0xfe3ba7[_0xc081('0x22')][_0xc081('0x24')]);}logger[_0xc081('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x43b2ee,_0xfe3ba7[_0xc081('0x22')][_0xc081('0x24')]);return _0x7a7a89(_0xfe3ba7[_0xc081('0x22')][_0xc081('0x24')]);}else{logger[_0xc081('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0x43b2ee,'request\x20sent');_0x7a7a89(_0xfe3ba7[_0xc081('0x25')]['message']);}})[_0xc081('0x26')](function(_0x15afc7){logger[_0xc081('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x43b2ee,_0x15afc7);_0xa72ac2(_0x15afc7);});});}function respondWithStatusCode(_0x1a549b,_0x5b41b8){_0x5b41b8=_0x5b41b8||0xcc;return function(_0x36db52){if(_0x36db52){return _0x1a549b[_0xc081('0x27')](_0x5b41b8);}return _0x1a549b[_0xc081('0x28')](_0x5b41b8)[_0xc081('0x29')]();};}function respondWithResult(_0x498476,_0x5405bd){_0x5405bd=_0x5405bd||0xc8;return function(_0x27cb28){if(_0x27cb28){return _0x498476['status'](_0x5405bd)[_0xc081('0x2a')](_0x27cb28);}};}function respondWithFilteredResult(_0x464584,_0xb0caf8){return function(_0x3ea230){if(_0x3ea230){var _0x9d5c66=typeof _0xb0caf8['offset']==='undefined'&&typeof _0xb0caf8[_0xc081('0x2b')]===_0xc081('0x2c');var _0x5360b9=_0x3ea230[_0xc081('0x2d')];var _0x6d9371=_0x9d5c66?0x0:_0xb0caf8[_0xc081('0x2e')];var _0x2692ae=_0x9d5c66?_0x3ea230[_0xc081('0x2d')]:_0xb0caf8[_0xc081('0x2e')]+_0xb0caf8[_0xc081('0x2b')];var _0x57f232;if(_0x2692ae>=_0x5360b9){_0x2692ae=_0x5360b9;_0x57f232=0xc8;}else{_0x57f232=0xce;}_0x464584[_0xc081('0x28')](_0x57f232);return _0x464584[_0xc081('0x2f')](_0xc081('0x30'),_0x6d9371+'-'+_0x2692ae+'/'+_0x5360b9)['json'](_0x3ea230);}return null;};}function patchUpdates(_0x4c1bab){return function(_0x4ee550){try{jsonpatch[_0xc081('0x31')](_0x4ee550,_0x4c1bab,!![]);}catch(_0x2ed81c){return BPromise[_0xc081('0x32')](_0x2ed81c);}return _0x4ee550['save']();};}function saveUpdates(_0x1c834c,_0x42d32b){return function(_0x4aff14){if(_0x4aff14){return _0x4aff14[_0xc081('0x33')](_0x1c834c)[_0xc081('0x1c')](function(_0x2541e6){return _0x2541e6;});}return null;};}function removeEntity(_0x7a00aa,_0x1429fb){return function(_0x49b26a){if(_0x49b26a){return _0x49b26a[_0xc081('0x34')]()[_0xc081('0x1c')](function(){_0x7a00aa[_0xc081('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ec33b,_0x3dbb0e){return function(_0x2b2183){if(!_0x2b2183){_0x5ec33b[_0xc081('0x27')](0x194);}return _0x2b2183;};}function handleError(_0xb43030,_0x108307){_0x108307=_0x108307||0x1f4;return function(_0x3b0821){logger[_0xc081('0x22')](_0x3b0821[_0xc081('0x35')]);if(_0x3b0821[_0xc081('0x36')]){delete _0x3b0821['name'];}_0xb43030['status'](_0x108307)[_0xc081('0x37')](_0x3b0821);};}exports['index']=function(_0x584d75,_0x324e20){var _0x3c04ea={},_0x394ef6={},_0x403fa5={'count':0x0,'rows':[]};var _0x5222a7=_[_0xc081('0x38')](db[_0xc081('0x39')][_0xc081('0x3a')],function(_0x28a121){return{'name':_0x28a121['fieldName'],'type':_0x28a121[_0xc081('0x3b')][_0xc081('0x3c')]};});_0x394ef6[_0xc081('0x3d')]=_[_0xc081('0x38')](_0x5222a7,'name');_0x394ef6[_0xc081('0x3e')]=_['keys'](_0x584d75[_0xc081('0x3e')]);_0x394ef6[_0xc081('0x3f')]=_[_0xc081('0x40')](_0x394ef6[_0xc081('0x3d')],_0x394ef6[_0xc081('0x3e')]);_0x3c04ea[_0xc081('0x41')]=_[_0xc081('0x40')](_0x394ef6[_0xc081('0x3d')],qs[_0xc081('0x42')](_0x584d75[_0xc081('0x3e')]['fields']));_0x3c04ea['attributes']=_0x3c04ea[_0xc081('0x41')][_0xc081('0x43')]?_0x3c04ea[_0xc081('0x41')]:_0x394ef6[_0xc081('0x3d')];if(!_0x584d75['query'][_0xc081('0x44')](_0xc081('0x45'))){_0x3c04ea[_0xc081('0x2b')]=qs[_0xc081('0x2b')](_0x584d75['query'][_0xc081('0x2b')]);_0x3c04ea[_0xc081('0x2e')]=qs[_0xc081('0x2e')](_0x584d75[_0xc081('0x3e')][_0xc081('0x2e')]);}_0x3c04ea[_0xc081('0x46')]=qs[_0xc081('0x47')](_0x584d75['query']['sort']);_0x3c04ea['where']=qs['filters'](_[_0xc081('0x48')](_0x584d75[_0xc081('0x3e')],_0x394ef6['filters']),_0x5222a7);if(_0x584d75[_0xc081('0x3e')][_0xc081('0x49')]){_0x3c04ea[_0xc081('0x4a')]=_[_0xc081('0x4b')](_0x3c04ea[_0xc081('0x4a')],{'$or':_[_0xc081('0x38')](_0x5222a7,function(_0x1c6aff){if(_0x1c6aff[_0xc081('0x3b')]!==_0xc081('0x4c')){var _0x2f1df0={};_0x2f1df0[_0x1c6aff[_0xc081('0x36')]]={'$like':'%'+_0x584d75['query']['filter']+'%'};return _0x2f1df0;}})});}_0x3c04ea=_[_0xc081('0x4b')]({},_0x3c04ea,_0x584d75[_0xc081('0x4d')]);var _0x4fd879={'where':_0x3c04ea[_0xc081('0x4a')]};return db[_0xc081('0x39')]['count'](_0x4fd879)[_0xc081('0x1c')](function(_0x511508){_0x403fa5['count']=_0x511508;if(_0x584d75['query'][_0xc081('0x4e')]){_0x3c04ea[_0xc081('0x4f')]=[{'all':!![]}];}return db[_0xc081('0x39')][_0xc081('0x50')](_0x3c04ea);})[_0xc081('0x1c')](function(_0x125701){_0x403fa5[_0xc081('0x51')]=_0x125701;return _0x403fa5;})[_0xc081('0x1c')](respondWithFilteredResult(_0x324e20,_0x3c04ea))[_0xc081('0x26')](handleError(_0x324e20,null));};exports[_0xc081('0x52')]=function(_0x30bc26,_0x53f550){var _0x11c400={'raw':!![],'where':{'id':_0x30bc26[_0xc081('0x53')]['id']}},_0x2e90e9={};_0x2e90e9[_0xc081('0x3d')]=_[_0xc081('0x54')](db['OpenchannelMessage'][_0xc081('0x3a')]);_0x2e90e9[_0xc081('0x3e')]=_[_0xc081('0x54')](_0x30bc26[_0xc081('0x3e')]);_0x2e90e9[_0xc081('0x3f')]=_[_0xc081('0x40')](_0x2e90e9[_0xc081('0x3d')],_0x2e90e9[_0xc081('0x3e')]);_0x11c400[_0xc081('0x41')]=_['intersection'](_0x2e90e9['model'],qs[_0xc081('0x42')](_0x30bc26[_0xc081('0x3e')][_0xc081('0x42')]));_0x11c400['attributes']=_0x11c400[_0xc081('0x41')][_0xc081('0x43')]?_0x11c400[_0xc081('0x41')]:_0x2e90e9['model'];if(_0x30bc26[_0xc081('0x3e')]['includeAll']){_0x11c400[_0xc081('0x4f')]=[{'all':!![]}];}_0x11c400=_['merge']({},_0x11c400,_0x30bc26[_0xc081('0x4d')]);return db[_0xc081('0x39')]['find'](_0x11c400)[_0xc081('0x1c')](handleEntityNotFound(_0x53f550,null))[_0xc081('0x1c')](respondWithResult(_0x53f550,null))[_0xc081('0x26')](handleError(_0x53f550,null));};exports[_0xc081('0x55')]=function(_0x34cbee,_0x1668f6){return db[_0xc081('0x39')][_0xc081('0x55')](_0x34cbee['body'],{})[_0xc081('0x1c')](respondWithResult(_0x1668f6,0xc9))['catch'](handleError(_0x1668f6,null));};exports['update']=function(_0x24bbb9,_0x4743ab){if(_0x24bbb9[_0xc081('0x56')]['id']){delete _0x24bbb9[_0xc081('0x56')]['id'];}return db['OpenchannelMessage'][_0xc081('0x57')]({'where':{'id':_0x24bbb9['params']['id']}})[_0xc081('0x1c')](handleEntityNotFound(_0x4743ab,null))[_0xc081('0x1c')](saveUpdates(_0x24bbb9[_0xc081('0x56')],null))['then'](respondWithResult(_0x4743ab,null))[_0xc081('0x26')](handleError(_0x4743ab,null));};exports['destroy']=function(_0x5a52ff,_0x305a0b){return db['OpenchannelMessage'][_0xc081('0x57')]({'where':{'id':_0x5a52ff[_0xc081('0x53')]['id']}})[_0xc081('0x1c')](handleEntityNotFound(_0x305a0b,null))[_0xc081('0x1c')](removeEntity(_0x305a0b,null))[_0xc081('0x26')](handleError(_0x305a0b,null));};exports[_0xc081('0x58')]=function(_0xea4119,_0x154e38){return db[_0xc081('0x39')]['describe']()[_0xc081('0x1c')](respondWithResult(_0x154e38,null))[_0xc081('0x26')](handleError(_0x154e38,null));};var interaction_log=require(_0xc081('0x59'))(_0xc081('0x5a'));exports[_0xc081('0x5b')]=function(_0x5c40c8,_0x3303e5,_0x52fec0){var _0x4d470f={'agent':{},'channel':_0xc081('0x5c')};if(_0x5c40c8[_0xc081('0x56')]['id']){delete _0x5c40c8[_0xc081('0x56')]['id'];}_0x5c40c8[_0xc081('0x56')][_0xc081('0x5d')]=!![];_0x5c40c8[_0xc081('0x56')][_0xc081('0x5e')]=moment()[_0xc081('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c40c8[_0xc081('0x56')][_0xc081('0x60')]=_0x5c40c8[_0xc081('0x56')][_0xc081('0x60')]||_0x5c40c8[_0xc081('0x61')]['id'];_0x4d470f[_0xc081('0x62')]['id']=_0x5c40c8[_0xc081('0x56')]['UserId'];return db[_0xc081('0x39')][_0xc081('0x57')]({'where':{'id':_0x5c40c8[_0xc081('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3303e5,null))[_0xc081('0x1c')](saveUpdates(_0x5c40c8['body'],null))['then'](function(_0x43f839){if(_0x43f839){_0x4d470f[_0xc081('0x24')]=_0x43f839[_0xc081('0x63')]({'plain':!![]});return db[_0xc081('0x64')]['find']({'where':{'id':_0x43f839[_0xc081('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x3303e5,null))['then'](function(_0x1470ca){if(_0x1470ca){return _0x1470ca[_0xc081('0x33')]({'UserId':_0x5c40c8[_0xc081('0x56')][_0xc081('0x60')],'read1stAt':_[_0xc081('0x66')](_0x1470ca[_0xc081('0x67')])?moment()['format'](_0xc081('0x68')):undefined});}return null;})[_0xc081('0x1c')](function(_0x3d6f21){if(_0x3d6f21){_0x4d470f['interaction']=_0x3d6f21[_0xc081('0x63')]({'plain':!![]});interaction_log[_0xc081('0x1d')](_0xc081('0x69'),_0x5c40c8[_0xc081('0x61')]['id'],_0x5c40c8['user'][_0xc081('0x36')],_0x5c40c8['user'][_0xc081('0x6a')],_0x4d470f[_0xc081('0x6b')]['id'],_0x5c40c8[_0xc081('0x56')]?JSON['stringify'](_0x5c40c8['body']):_0xc081('0x6c'));return respondWithRpcPromise(_0xc081('0x6d'),_0xc081('0x6e'),_0x4d470f);}return null;})[_0xc081('0x1c')](function(_0x34982b){var _0x1d7e55=_0xc081('0x6f')+_0x34982b[_0xc081('0x24')]['ContactId'];return db[_0xc081('0x70')][_0xc081('0x3e')](_0x1d7e55,{'type':db[_0xc081('0x71')][_0xc081('0x72')]['SELECT'],'raw':!![]})[_0xc081('0x1c')](function(_0x4999af){return _0x4999af;});})['then'](function(_0x4ccda4){if(_0x4ccda4){_0x4d470f[_0xc081('0x24')][_0xc081('0x73')]=_0x4ccda4[0x0];if(!_0x5c40c8[_0xc081('0x56')][_0xc081('0x60')])return;return db[_0xc081('0x74')][_0xc081('0x57')]({'where':{'id':_0x5c40c8[_0xc081('0x56')][_0xc081('0x60')],'role':_0xc081('0x62')},'attributes':['id',_0xc081('0x36'),_0xc081('0x75'),'email','internal'],'raw':!![]});}return null;})[_0xc081('0x1c')](function(_0x43cb26){if(!_0x43cb26)return null;_0x4d470f[_0xc081('0x24')][_0xc081('0x62')]=_0x43cb26;return _0x4d470f;})[_0xc081('0x1c')](function(_0x35c93f){if(_0x35c93f){if(_0x5c40c8[_0xc081('0x56')][_0xc081('0x76')]){_0x4d470f[_0xc081('0x24')][_0xc081('0x77')]=util[_0xc081('0x5f')](_0xc081('0x78'),_0x5c40c8[_0xc081('0x61')][_0xc081('0x36')]);_0x4d470f[_0xc081('0x24')][_0xc081('0x79')]=_0x4d470f[_0xc081('0x79')];_0x4d470f[_0xc081('0x24')][_0xc081('0x7a')]=_0x4d470f[_0xc081('0x79')];_0x4d470f[_0xc081('0x24')][_0xc081('0x7b')]='accept';return respondWithRpcPromise(_0xc081('0x7c'),'EventManager',{'event':_0xc081('0x7d'),'message':_0x4d470f[_0xc081('0x24')]},client9002)[_0xc081('0x1c')](function(){return _0x4d470f;});}return _0x4d470f;}return null;})[_0xc081('0x1c')](respondWithResult(_0x3303e5,null))['catch'](handleError(_0x3303e5,null));};var interaction_log=require('../../config/logger')(_0xc081('0x5a'));exports[_0xc081('0x32')]=function(_0x308026,_0x2364a8,_0x3d7328){var _0x5c6d55={'agent':{},'channel':'openchannel'};if(_0x308026['body']['id']){delete _0x308026[_0xc081('0x56')]['id'];}_0x308026['body'][_0xc081('0x60')]=_0x308026[_0xc081('0x56')][_0xc081('0x60')]||_0x308026[_0xc081('0x61')]['id'];_0x5c6d55[_0xc081('0x62')]['id']=_0x308026['body'][_0xc081('0x60')];return db[_0xc081('0x39')][_0xc081('0x57')]({'where':{'id':_0x308026[_0xc081('0x53')]['id'],'UserId':null}})[_0xc081('0x1c')](handleEntityNotFound(_0x2364a8,null))['then'](function(_0x1258ee){if(_0x1258ee){_0x5c6d55[_0xc081('0x24')]=_0x1258ee[_0xc081('0x63')]({'plain':!![]});return db[_0xc081('0x64')]['find']({'where':{'id':_0x1258ee['OpenchannelInteractionId']}});}return null;})[_0xc081('0x1c')](handleEntityNotFound(_0x2364a8,null))[_0xc081('0x1c')](function(_0x2a7420){if(_0x2a7420){_0x5c6d55['interaction']=_0x2a7420[_0xc081('0x63')]({'plain':!![]});interaction_log[_0xc081('0x1d')](_0xc081('0x7e'),_0x308026[_0xc081('0x61')]['id'],_0x308026[_0xc081('0x61')][_0xc081('0x36')],_0x308026['user'][_0xc081('0x6a')],_0x5c6d55[_0xc081('0x6b')]['id'],_0x308026[_0xc081('0x56')]?JSON[_0xc081('0x21')](_0x308026[_0xc081('0x56')]):_0xc081('0x6c'));return respondWithRpcPromise(_0xc081('0x7f'),_0xc081('0x80'),_0x5c6d55);}return null;})[_0xc081('0x1c')](function(_0x1c913b){var _0x2a3f1e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1c913b[_0xc081('0x24')][_0xc081('0x81')];return db['sequelize'][_0xc081('0x3e')](_0x2a3f1e,{'type':db[_0xc081('0x71')][_0xc081('0x72')][_0xc081('0x82')],'raw':!![]})[_0xc081('0x1c')](function(_0x5b3c11){return _0x5b3c11;});})[_0xc081('0x1c')](function(_0x129135){if(_0x129135){_0x5c6d55[_0xc081('0x24')]['contact']=_0x129135[0x0];if(!_0x308026['body'][_0xc081('0x60')])return;return db['User']['find']({'where':{'id':_0x308026['body'][_0xc081('0x60')],'role':_0xc081('0x62')},'attributes':['id',_0xc081('0x36'),_0xc081('0x75'),_0xc081('0x83'),'internal'],'raw':!![]});}return null;})[_0xc081('0x1c')](function(_0x3ace77){if(!_0x3ace77)return null;_0x5c6d55[_0xc081('0x24')][_0xc081('0x62')]=_0x3ace77;return _0x5c6d55;})[_0xc081('0x1c')](function(_0x1dafb0){if(_0x1dafb0){_0x1dafb0[_0xc081('0x24')][_0xc081('0x77')]=util['format'](_0xc081('0x78'),_0x308026['user'][_0xc081('0x36')]);_0x1dafb0[_0xc081('0x24')][_0xc081('0x79')]=_0x5c6d55['channel'];_0x1dafb0[_0xc081('0x24')][_0xc081('0x7a')]=_0x5c6d55['channel'];_0x1dafb0[_0xc081('0x24')]['event']=_0xc081('0x32');respondWithRpcPromise(_0xc081('0x7c'),_0xc081('0x7c'),{'event':_0xc081('0x84'),'message':_0x1dafb0[_0xc081('0x24')]},client9002);return _0x5c6d55;}return null;})[_0xc081('0x1c')](respondWithResult(_0x2364a8,null))['catch'](handleError(_0x2364a8,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 4ea07c5..dca20e5 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 _0xa863=['hook','exports','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x90e1d8,_0x195684){var _0x483f2e=function(_0x15d16a){while(--_0x15d16a){_0x90e1d8['push'](_0x90e1d8['shift']());}};_0x483f2e(++_0x195684);}(_0xa863,0x1d0));var _0x3a86=function(_0x119507,_0x3fb7c0){_0x119507=_0x119507-0x0;var _0x5f0f9b=_0xa863[_0x119507];return _0x5f0f9b;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x3a86('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x3a86('0x1')](0x0);var events={'afterCreate':_0x3a86('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1a9062){return function(_0x22cdb3,_0x3558f1,_0x1641d4){OpenchannelMessageEvents[_0x3a86('0x3')](_0x1a9062+':'+_0x22cdb3['id'],_0x22cdb3);OpenchannelMessageEvents[_0x3a86('0x3')](_0x1a9062,_0x22cdb3);_0x1641d4(null);};}for(var e in events){if(events[_0x3a86('0x4')](e)){var event=events[e];OpenchannelMessage[_0x3a86('0x5')](e,emitEvent(event));}}module[_0x3a86('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x5cd8=['emit','hasOwnProperty','hook','../../mysqldb','OpenchannelMessage','save','update'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x5cd8,0xdc));var _0x85cd=function(_0x37cdab,_0x448b95){_0x37cdab=_0x37cdab-0x0;var _0x270df6=_0x5cd8[_0x37cdab];return _0x270df6;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x85cd('0x0'))['db'][_0x85cd('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x85cd('0x2'),'afterUpdate':_0x85cd('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3f45ba){return function(_0x5e74dc,_0x33b9ae,_0x4ece0a){OpenchannelMessageEvents[_0x85cd('0x4')](_0x3f45ba+':'+_0x5e74dc['id'],_0x5e74dc);OpenchannelMessageEvents[_0x85cd('0x4')](_0x3f45ba,_0x5e74dc);_0x4ece0a(null);};}for(var e in events){if(events[_0x85cd('0x5')](e)){var event=events[e];OpenchannelMessage[_0x85cd('0x6')](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 78ecf5e..48f376c 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 _0x6cb4=['define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes'];(function(_0x49b98b,_0x50b9ac){var _0x12e40e=function(_0x2f3f21){while(--_0x2f3f21){_0x49b98b['push'](_0x49b98b['shift']());}};_0x12e40e(++_0x50b9ac);}(_0x6cb4,0xff));var _0x46cb=function(_0x44bee5,_0x43636c){_0x44bee5=_0x44bee5-0x0;var _0x2a0a0c=_0x6cb4[_0x44bee5];return _0x2a0a0c;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var logger=require(_0x46cb('0x2'))(_0x46cb('0x3'));var moment=require(_0x46cb('0x4'));var BPromise=require(_0x46cb('0x5'));var rp=require(_0x46cb('0x6'));var fs=require('fs');var path=require(_0x46cb('0x7'));var rimraf=require(_0x46cb('0x8'));var config=require('../../config/environment');var attributes=require(_0x46cb('0x9'));module['exports']=function(_0x3d9d3c,_0x4d9f1d){return _0x3d9d3c[_0x46cb('0xa')](_0x46cb('0xb'),attributes,{'tableName':_0x46cb('0xc'),'paranoid':![],'indexes':[{'name':_0x46cb('0xd'),'fields':[_0x46cb('0xe')],'type':_0x46cb('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56258a,_0x3d7663,_0x34f9e9){var _0x48101c=_0x3d9d3c[_0x46cb('0x10')];var _0x106a87=_0x56258a['get']({'plain':!![]});if(_0x106a87[_0x46cb('0x11')][_0x46cb('0x12')]()==='in'||_0x106a87['direction']['toLowerCase']()==='out'&&!_0x106a87[_0x46cb('0x13')]&&!_[_0x46cb('0x14')](_0x106a87[_0x46cb('0x15')])){_0x48101c[_0x46cb('0x16')]['findOne']({'where':{'id':_0x106a87[_0x46cb('0x17')]}})[_0x46cb('0x18')](function(_0x2a1f9d){if(_0x2a1f9d){_0x2a1f9d[_0x46cb('0x19')]({'lastMsgAt':_0x106a87[_0x46cb('0x1a')],'lastMsgDirection':_0x106a87[_0x46cb('0x11')][_0x46cb('0x12')]()});}})[_0x46cb('0x1b')](function(_0x37d368){console[_0x46cb('0x1c')](_0x37d368);});}if(_0x106a87[_0x46cb('0x11')]==='out'&&!_0x106a87[_0x46cb('0x13')]){var _0x5796d2;_0x48101c[_0x46cb('0x1d')]['describe']()['then'](function(_0x4e3454){return _0x48101c[_0x46cb('0x1e')][_0x46cb('0x1f')]({'where':{'id':_0x106a87[_0x46cb('0x20')]},'include':[{'model':_0x48101c[_0x46cb('0x16')],'as':_0x46cb('0x21'),'where':{'id':_0x106a87[_0x46cb('0x17')]},'limit':0x1,'include':[{'model':_0x48101c[_0x46cb('0x1d')],'as':_0x46cb('0x22'),'attributes':_[_0x46cb('0x23')](_0x4e3454)}]}]});})[_0x46cb('0x18')](function(_0x149483){_0x5796d2=_0x149483[_0x46cb('0x24')]({'plain':!![]});if(_0x5796d2&&_0x5796d2[_0x46cb('0x25')]){logger[_0x46cb('0x26')](_0x46cb('0x27'),_0x46cb('0x28'),util[_0x46cb('0x29')](_0x46cb('0x2a'),_0x106a87['id'],_0x5796d2[_0x46cb('0x25')]));if(_0x5796d2[_0x46cb('0x21')]&&_0x5796d2[_0x46cb('0x21')][_0x46cb('0x2b')]){_0x106a87[_0x46cb('0x2c')]=_[_0x46cb('0x2d')](_0x5796d2[_0x46cb('0x21')][0x0],'Contact');_0x106a87['Contact']=_0x5796d2[_0x46cb('0x21')][0x0][_0x46cb('0x22')];}var _0x3d7663={'method':_0x46cb('0x2e'),'uri':encodeURI(_0x5796d2[_0x46cb('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3d7663['method']){case _0x46cb('0x2f'):_0x3d7663['qs']=_0x106a87;break;case'POST':_0x3d7663['body']=_0x106a87;break;}return rp(_0x3d7663)['then'](function(_0x180ce1){logger[_0x46cb('0x26')](_0x46cb('0x27'),_0x46cb('0x28'),util[_0x46cb('0x29')](_0x46cb('0x30'),_0x106a87['id'],_0x5796d2[_0x46cb('0x25')]));if(_0x180ce1[_0x46cb('0xe')][_0x46cb('0x31')]&&_0x180ce1[_0x46cb('0xe')][_0x46cb('0x31')]!=_0x106a87['Interaction'][_0x46cb('0x31')]){return _0x48101c[_0x46cb('0x16')]['update']({'threadId':_0x180ce1['body'][_0x46cb('0x31')]},{'logging':!![],'where':{'id':_0x106a87['Interaction']['id']}});}else{return;}})[_0x46cb('0x18')](function(){return _0x56258a[_0x46cb('0x19')]({'read':!![]});})[_0x46cb('0x1b')](function(_0xd96713){logger[_0x46cb('0x1c')](_0x46cb('0x27'),'afterCreate',util[_0x46cb('0x32')](_0xd96713,{'showHidden':![],'depth':null}));_0x34f9e9();});}else{_0x34f9e9();}})['finally'](function(){_0x34f9e9();});}else{_0x34f9e9();}}},'charset':_0x46cb('0x33'),'collate':_0x46cb('0x34')});}; \ No newline at end of file +var _0x9354=['threadId','inspect','finally','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','toLowerCase','catch','error','CmContact','describe','find','OpenchannelAccountId','Interactions','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','Contact','POST','method','GET','body'];(function(_0x59ad2b,_0x3353fe){var _0x46f306=function(_0x5ce5de){while(--_0x5ce5de){_0x59ad2b['push'](_0x59ad2b['shift']());}};_0x46f306(++_0x3353fe);}(_0x9354,0x96));var _0x4935=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9354[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var logger=require(_0x4935('0x1'))('api');var moment=require(_0x4935('0x2'));var BPromise=require(_0x4935('0x3'));var rp=require(_0x4935('0x4'));var fs=require('fs');var path=require(_0x4935('0x5'));var rimraf=require('rimraf');var config=require(_0x4935('0x6'));var attributes=require(_0x4935('0x7'));module[_0x4935('0x8')]=function(_0x2d518a,_0x263864){return _0x2d518a[_0x4935('0x9')](_0x4935('0xa'),attributes,{'tableName':_0x4935('0xb'),'paranoid':![],'indexes':[{'name':_0x4935('0xc'),'fields':['body'],'type':_0x4935('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47a44f,_0x2aac9a,_0x38de96){var _0xd5b117=_0x2d518a[_0x4935('0xe')];var _0x261462=_0x47a44f[_0x4935('0xf')]({'plain':!![]});if(_0x261462['direction']['toLowerCase']()==='in'||_0x261462[_0x4935('0x10')]['toLowerCase']()==='out'&&!_0x261462[_0x4935('0x11')]&&!_[_0x4935('0x12')](_0x261462[_0x4935('0x13')])){_0xd5b117[_0x4935('0x14')][_0x4935('0x15')]({'where':{'id':_0x261462[_0x4935('0x16')]}})[_0x4935('0x17')](function(_0x3a7c30){if(_0x3a7c30){_0x3a7c30[_0x4935('0x18')]({'lastMsgAt':_0x261462[_0x4935('0x19')],'lastMsgDirection':_0x261462[_0x4935('0x10')][_0x4935('0x1a')]()});}})[_0x4935('0x1b')](function(_0x3652c4){console[_0x4935('0x1c')](_0x3652c4);});}if(_0x261462[_0x4935('0x10')]==='out'&&!_0x261462[_0x4935('0x11')]){var _0x46526a;_0xd5b117[_0x4935('0x1d')][_0x4935('0x1e')]()[_0x4935('0x17')](function(_0x429ef3){return _0xd5b117['OpenchannelAccount'][_0x4935('0x1f')]({'where':{'id':_0x261462[_0x4935('0x20')]},'include':[{'model':_0xd5b117['OpenchannelInteraction'],'as':_0x4935('0x21'),'where':{'id':_0x261462[_0x4935('0x16')]},'limit':0x1,'include':[{'model':_0xd5b117[_0x4935('0x1d')],'as':'Contact','attributes':_['keys'](_0x429ef3)}]}]});})[_0x4935('0x17')](function(_0x6b849f){_0x46526a=_0x6b849f[_0x4935('0xf')]({'plain':!![]});if(_0x46526a&&_0x46526a[_0x4935('0x22')]){logger[_0x4935('0x23')](_0x4935('0x24'),_0x4935('0x25'),util[_0x4935('0x26')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x261462['id'],_0x46526a[_0x4935('0x22')]));if(_0x46526a[_0x4935('0x21')]&&_0x46526a[_0x4935('0x21')][_0x4935('0x27')]){_0x261462[_0x4935('0x28')]=_['omit'](_0x46526a['Interactions'][0x0],_0x4935('0x29'));_0x261462[_0x4935('0x29')]=_0x46526a[_0x4935('0x21')][0x0][_0x4935('0x29')];}var _0x2aac9a={'method':_0x4935('0x2a'),'uri':encodeURI(_0x46526a[_0x4935('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2aac9a[_0x4935('0x2b')]){case _0x4935('0x2c'):_0x2aac9a['qs']=_0x261462;break;case _0x4935('0x2a'):_0x2aac9a[_0x4935('0x2d')]=_0x261462;break;}return rp(_0x2aac9a)[_0x4935('0x17')](function(_0x2c47ab){logger[_0x4935('0x23')](_0x4935('0x24'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x261462['id'],_0x46526a[_0x4935('0x22')]));if(_0x2c47ab[_0x4935('0x2d')]['threadId']&&_0x2c47ab[_0x4935('0x2d')][_0x4935('0x2e')]!=_0x261462[_0x4935('0x28')][_0x4935('0x2e')]){return _0xd5b117[_0x4935('0x14')][_0x4935('0x18')]({'threadId':_0x2c47ab[_0x4935('0x2d')][_0x4935('0x2e')]},{'logging':!![],'where':{'id':_0x261462['Interaction']['id']}});}else{return;}})[_0x4935('0x17')](function(){return _0x47a44f[_0x4935('0x18')]({'read':!![]});})['catch'](function(_0x48a289){logger[_0x4935('0x1c')]('OpenchannelMessage,\x20%s,\x20%s',_0x4935('0x25'),util[_0x4935('0x2f')](_0x48a289,{'showHidden':![],'depth':null}));_0x38de96();});}else{_0x38de96();}})[_0x4935('0x30')](function(){_0x38de96();});}else{_0x38de96();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index f99e85c..f21ea4c 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x53b048,_0x1f2db2){var _0x3e4ffa=function(_0x29495c){while(--_0x29495c){_0x53b048['push'](_0x53b048['shift']());}};_0x3e4ffa(++_0x1f2db2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1159a7,_0x3fcd97){_0x1159a7=_0x1159a7-0x0;var _0x436b35=_0x5f2f[_0x1159a7];return _0x436b35;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _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(_0x169eb6,_0x18bbad){var _0x238a74=function(_0x55c862){while(--_0x55c862){_0x169eb6['push'](_0x169eb6['shift']());}};_0x238a74(++_0x18bbad);}(_0x2ef3,0xba));var _0x32ef=function(_0x5ca4e3,_0x4af7fd){_0x5ca4e3=_0x5ca4e3-0x0;var _0x472282=_0x2ef3[_0x5ca4e3];return _0x472282;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 71fdd81..7a10f8b 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 _0xca93=['removeListener','length','openchannelMessage:','./openchannelMessage.events','save','emit'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xca93,0x123));var _0x3ca9=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xca93[_0x18a79d];return _0x4f8848;};'use strict';var OpenchannelMessageEvents=require(_0x3ca9('0x0'));var events=[_0x3ca9('0x1'),'remove','update'];function createListener(_0x33139a,_0x2a4cb4){return function(_0x32bf44){_0x2a4cb4[_0x3ca9('0x2')](_0x33139a,_0x32bf44);};}function removeListener(_0x20c6ee,_0x33f6c8){return function(){OpenchannelMessageEvents[_0x3ca9('0x3')](_0x20c6ee,_0x33f6c8);};}exports['register']=function(_0x1f2398){for(var _0x427b42=0x0,_0x2925dd=events[_0x3ca9('0x4')];_0x427b42<_0x2925dd;_0x427b42++){var _0x373930=events[_0x427b42];var _0x4cb4c3=createListener(_0x3ca9('0x5')+_0x373930,_0x1f2398);OpenchannelMessageEvents['on'](_0x373930,_0x4cb4c3);}}; \ No newline at end of file +var _0x5d81=['./openchannelMessage.events','save','remove','removeListener','register','length','openchannelMessage:'];(function(_0x24b1ea,_0x642a66){var _0x1eb3b0=function(_0x57c90b){while(--_0x57c90b){_0x24b1ea['push'](_0x24b1ea['shift']());}};_0x1eb3b0(++_0x642a66);}(_0x5d81,0x1c0));var _0x15d8=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x5d81[_0x37ffea];return _0x2e2615;};'use strict';var OpenchannelMessageEvents=require(_0x15d8('0x0'));var events=[_0x15d8('0x1'),_0x15d8('0x2'),'update'];function createListener(_0x3020fb,_0x1efb69){return function(_0x1bb062){_0x1efb69['emit'](_0x3020fb,_0x1bb062);};}function removeListener(_0x3c1ab0,_0x5ab48b){return function(){OpenchannelMessageEvents[_0x15d8('0x3')](_0x3c1ab0,_0x5ab48b);};}exports[_0x15d8('0x4')]=function(_0x2f492f){for(var _0xb9893=0x0,_0x2df2fe=events[_0x15d8('0x5')];_0xb9893<_0x2df2fe;_0xb9893++){var _0x1d39a9=events[_0xb9893];var _0x4ffe89=createListener(_0x15d8('0x6')+_0x1d39a9,_0x2f492f);OpenchannelMessageEvents['on'](_0x1d39a9,_0x4ffe89);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 698956d..c5efec0 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 _0x32f2=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','/:id/members','isAuthenticated','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','destroy','delete','removeTeams','removeAgents','exports','multer','express','Router','fs-extra'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x32f2,0x8d));var _0x232f=function(_0x4ada0a,_0xa99985){_0x4ada0a=_0x4ada0a-0x0;var _0x5a3434=_0x32f2[_0x4ada0a];return _0x5a3434;};'use strict';var multer=require(_0x232f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x232f('0x1'));var router=express[_0x232f('0x2')]();var fs_extra=require(_0x232f('0x3'));var auth=require(_0x232f('0x4'));var interaction=require(_0x232f('0x5'));var config=require(_0x232f('0x6'));var controller=require('./openchannelQueue.controller');router[_0x232f('0x7')]('/',auth['isAuthenticated'](),controller[_0x232f('0x8')]);router[_0x232f('0x7')](_0x232f('0x9'),auth['isAuthenticated'](),controller[_0x232f('0xa')]);router[_0x232f('0x7')](_0x232f('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x232f('0x7')](_0x232f('0xc'),auth[_0x232f('0xd')](),controller[_0x232f('0xe')]);router['get'](_0x232f('0xf'),auth[_0x232f('0xd')](),controller[_0x232f('0x10')]);router['get']('/:id/users',auth[_0x232f('0xd')](),controller[_0x232f('0x11')]);router[_0x232f('0x12')]('/',auth[_0x232f('0xd')](),controller[_0x232f('0x13')]);router[_0x232f('0x12')](_0x232f('0xf'),auth[_0x232f('0xd')](),controller[_0x232f('0x14')]);router[_0x232f('0x12')](_0x232f('0x15'),auth[_0x232f('0xd')](),controller[_0x232f('0x16')]);router[_0x232f('0x17')](_0x232f('0xb'),auth[_0x232f('0xd')](),controller['update']);router['delete']('/:id',auth[_0x232f('0xd')](),controller[_0x232f('0x18')]);router[_0x232f('0x19')](_0x232f('0xf'),auth[_0x232f('0xd')](),controller[_0x232f('0x1a')]);router[_0x232f('0x19')](_0x232f('0x15'),auth[_0x232f('0xd')](),controller[_0x232f('0x1b')]);module[_0x232f('0x1c')]=router; \ No newline at end of file +var _0x899e=['/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x15793d,_0x589fdf){var _0x29fa3b=function(_0x3e75a1){while(--_0x3e75a1){_0x15793d['push'](_0x15793d['shift']());}};_0x29fa3b(++_0x589fdf);}(_0x899e,0xbc));var _0xe899=function(_0x2a5685,_0x268419){_0x2a5685=_0x2a5685-0x0;var _0x5bf29a=_0x899e[_0x2a5685];return _0x5bf29a;};'use strict';var multer=require(_0xe899('0x0'));var util=require(_0xe899('0x1'));var path=require(_0xe899('0x2'));var timeout=require(_0xe899('0x3'));var express=require(_0xe899('0x4'));var router=express[_0xe899('0x5')]();var fs_extra=require(_0xe899('0x6'));var auth=require(_0xe899('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe899('0x8'));var controller=require(_0xe899('0x9'));router['get']('/',auth[_0xe899('0xa')](),controller[_0xe899('0xb')]);router[_0xe899('0xc')](_0xe899('0xd'),auth['isAuthenticated'](),controller[_0xe899('0xe')]);router[_0xe899('0xc')](_0xe899('0xf'),auth[_0xe899('0xa')](),controller['show']);router[_0xe899('0xc')](_0xe899('0x10'),auth[_0xe899('0xa')](),controller['getMembers']);router[_0xe899('0xc')](_0xe899('0x11'),auth[_0xe899('0xa')](),controller[_0xe899('0x12')]);router[_0xe899('0xc')](_0xe899('0x13'),auth[_0xe899('0xa')](),controller[_0xe899('0x14')]);router[_0xe899('0x15')]('/',auth[_0xe899('0xa')](),controller[_0xe899('0x16')]);router[_0xe899('0x15')]('/:id/teams',auth[_0xe899('0xa')](),controller['addTeams']);router[_0xe899('0x15')](_0xe899('0x13'),auth[_0xe899('0xa')](),controller['addAgents']);router[_0xe899('0x17')](_0xe899('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xe899('0x18')](_0xe899('0xf'),auth[_0xe899('0xa')](),controller[_0xe899('0x19')]);router['delete'](_0xe899('0x11'),auth[_0xe899('0xa')](),controller[_0xe899('0x1a')]);router[_0xe899('0x18')](_0xe899('0x13'),auth['isAuthenticated'](),controller[_0xe899('0x1b')]);module[_0xe899('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 7b9e28b..df6917b 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 _0x9dd4=['ENUM','exports','STRING','INTEGER'];(function(_0x1655bb,_0x5a82ae){var _0x5e2020=function(_0x1ccfb4){while(--_0x1ccfb4){_0x1655bb['push'](_0x1655bb['shift']());}};_0x5e2020(++_0x5a82ae);}(_0x9dd4,0x119));var _0x49dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dd4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x49dd('0x0')]={'name':{'type':Sequelize[_0x49dd('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x49dd('0x1')]},'timeout':{'type':Sequelize[_0x49dd('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x49dd('0x3')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0x0dac=['roundrobin','sequelize','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x24d727,_0x3d60d3){var _0x83a316=function(_0x47f1a1){while(--_0x47f1a1){_0x24d727['push'](_0x24d727['shift']());}};_0x83a316(++_0x3d60d3);}(_0x0dac,0x78));var _0xc0da=function(_0x5da3af,_0x2c7263){_0x5da3af=_0x5da3af-0x0;var _0x15ea67=_0x0dac[_0x5da3af];return _0x15ea67;};'use strict';var Sequelize=require(_0xc0da('0x0'));module['exports']={'name':{'type':Sequelize[_0xc0da('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc0da('0x1')]},'timeout':{'type':Sequelize[_0xc0da('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc0da('0x3')](_0xc0da('0x4'),_0xc0da('0x5'),_0xc0da('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 1d56eab..dc672d6 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 _0x8e96=['pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserOpenchannelQueue','hasOwnProperty','OpenchannelQueueId','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','Team','getTeams','addTeams','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','union','compact','ids','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','fast-json-patch','request-promise','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/logger','api','../../config/utils','../../mysqldb','defaults','redis','socket.io-emitter','register','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','stack','name','send','index','map','OpenchannelQueue','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where'];(function(_0x2f6014,_0x5c65b7){var _0x21453a=function(_0x4e09c6){while(--_0x4e09c6){_0x2f6014['push'](_0x2f6014['shift']());}};_0x21453a(++_0x5c65b7);}(_0x8e96,0x175));var _0x68e9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e96[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x68e9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x68e9('0x1'));var rp=require(_0x68e9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x68e9('0x3'));var util=require(_0x68e9('0x4'));var path=require(_0x68e9('0x5'));var sox=require(_0x68e9('0x6'));var csv=require(_0x68e9('0x7'));var ejs=require(_0x68e9('0x8'));var fs=require('fs');var fs_extra=require(_0x68e9('0x9'));var _=require(_0x68e9('0xa'));var squel=require(_0x68e9('0xb'));var crypto=require(_0x68e9('0xc'));var jsforce=require(_0x68e9('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x68e9('0xe'));var Papa=require(_0x68e9('0xf'));var Redis=require(_0x68e9('0x10'));var authService=require(_0x68e9('0x11'));var qs=require(_0x68e9('0x12'));var as=require(_0x68e9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x68e9('0x14'))(_0x68e9('0x15'));var utils=require(_0x68e9('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x68e9('0x17'))['db'];config['redis']=_[_0x68e9('0x18')](config[_0x68e9('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x68e9('0x1a'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x68e9('0x1b')](socket);function respondWithStatusCode(_0x51725c,_0x261ebc){_0x261ebc=_0x261ebc||0xcc;return function(_0x19b2cb){if(_0x19b2cb){return _0x51725c['sendStatus'](_0x261ebc);}return _0x51725c[_0x68e9('0x1c')](_0x261ebc)[_0x68e9('0x1d')]();};}function respondWithResult(_0x187b2f,_0xaae58d){_0xaae58d=_0xaae58d||0xc8;return function(_0x3aabd8){if(_0x3aabd8){return _0x187b2f[_0x68e9('0x1c')](_0xaae58d)[_0x68e9('0x1e')](_0x3aabd8);}};}function respondWithFilteredResult(_0x2e3ba7,_0x44fb9d){return function(_0x15f3f7){if(_0x15f3f7){var _0x301101=typeof _0x44fb9d['offset']===_0x68e9('0x1f')&&typeof _0x44fb9d['limit']===_0x68e9('0x1f');var _0x2a4b8a=_0x15f3f7[_0x68e9('0x20')];var _0x4f9f72=_0x301101?0x0:_0x44fb9d[_0x68e9('0x21')];var _0x4a559c=_0x301101?_0x15f3f7[_0x68e9('0x20')]:_0x44fb9d[_0x68e9('0x21')]+_0x44fb9d[_0x68e9('0x22')];var _0x24fe8e;if(_0x4a559c>=_0x2a4b8a){_0x4a559c=_0x2a4b8a;_0x24fe8e=0xc8;}else{_0x24fe8e=0xce;}_0x2e3ba7['status'](_0x24fe8e);return _0x2e3ba7[_0x68e9('0x23')](_0x68e9('0x24'),_0x4f9f72+'-'+_0x4a559c+'/'+_0x2a4b8a)[_0x68e9('0x1e')](_0x15f3f7);}return null;};}function patchUpdates(_0x1ec3bb){return function(_0x1a160f){try{jsonpatch[_0x68e9('0x25')](_0x1a160f,_0x1ec3bb,!![]);}catch(_0x5b5218){return BPromise['reject'](_0x5b5218);}return _0x1a160f[_0x68e9('0x26')]();};}function saveUpdates(_0x435015,_0x52de4f){return function(_0x1f4a93){if(_0x1f4a93){return _0x1f4a93['update'](_0x435015)[_0x68e9('0x27')](function(_0x5d1782){return _0x5d1782;});}return null;};}function removeEntity(_0x72b2d8,_0x13a406){return function(_0x957096){if(_0x957096){return _0x957096[_0x68e9('0x28')]()[_0x68e9('0x27')](function(){var _0x343d8d=_0x957096[_0x68e9('0x29')]({'plain':!![]});var _0x156d9c='OpenchannelQueues';return db[_0x68e9('0x2a')][_0x68e9('0x28')]({'where':{'type':_0x156d9c,'resourceId':_0x343d8d['id']}})['then'](function(){return _0x957096;});})[_0x68e9('0x27')](function(){_0x72b2d8[_0x68e9('0x1c')](0xcc)[_0x68e9('0x1d')]();});}};}function handleEntityNotFound(_0x4dfe33,_0x97b699){return function(_0x4ac4a8){if(!_0x4ac4a8){_0x4dfe33['sendStatus'](0x194);}return _0x4ac4a8;};}function handleError(_0x1379dd,_0x31e8e8){_0x31e8e8=_0x31e8e8||0x1f4;return function(_0x271e63){logger['error'](_0x271e63[_0x68e9('0x2b')]);if(_0x271e63[_0x68e9('0x2c')]){delete _0x271e63[_0x68e9('0x2c')];}_0x1379dd[_0x68e9('0x1c')](_0x31e8e8)[_0x68e9('0x2d')](_0x271e63);};}exports[_0x68e9('0x2e')]=function(_0x2020c8,_0x204afc){var _0x31fb20={},_0x2da559={},_0x11da52={'count':0x0,'rows':[]};var _0x5d1f0b=_[_0x68e9('0x2f')](db[_0x68e9('0x30')]['rawAttributes'],function(_0x3dd477){return{'name':_0x3dd477[_0x68e9('0x31')],'type':_0x3dd477['type'][_0x68e9('0x32')]};});_0x2da559['model']=_['map'](_0x5d1f0b,_0x68e9('0x2c'));_0x2da559['query']=_['keys'](_0x2020c8[_0x68e9('0x33')]);_0x2da559[_0x68e9('0x34')]=_[_0x68e9('0x35')](_0x2da559[_0x68e9('0x36')],_0x2da559[_0x68e9('0x33')]);_0x31fb20[_0x68e9('0x37')]=_[_0x68e9('0x35')](_0x2da559[_0x68e9('0x36')],qs[_0x68e9('0x38')](_0x2020c8['query'][_0x68e9('0x38')]));_0x31fb20['attributes']=_0x31fb20[_0x68e9('0x37')][_0x68e9('0x39')]?_0x31fb20[_0x68e9('0x37')]:_0x2da559['model'];if(!_0x2020c8[_0x68e9('0x33')]['hasOwnProperty'](_0x68e9('0x3a'))){_0x31fb20[_0x68e9('0x22')]=qs[_0x68e9('0x22')](_0x2020c8[_0x68e9('0x33')][_0x68e9('0x22')]);_0x31fb20['offset']=qs[_0x68e9('0x21')](_0x2020c8[_0x68e9('0x33')]['offset']);}_0x31fb20[_0x68e9('0x3b')]=qs[_0x68e9('0x3c')](_0x2020c8[_0x68e9('0x33')][_0x68e9('0x3c')]);_0x31fb20[_0x68e9('0x3d')]=qs['filters'](_[_0x68e9('0x3e')](_0x2020c8[_0x68e9('0x33')],_0x2da559[_0x68e9('0x34')]),_0x5d1f0b);if(_0x2020c8[_0x68e9('0x33')][_0x68e9('0x3f')]){_0x31fb20[_0x68e9('0x3d')]=_[_0x68e9('0x40')](_0x31fb20[_0x68e9('0x3d')],{'$or':_[_0x68e9('0x2f')](_0x5d1f0b,function(_0x13dead){if(_0x13dead[_0x68e9('0x41')]!==_0x68e9('0x42')){var _0x5dbd07={};_0x5dbd07[_0x13dead['name']]={'$like':'%'+_0x2020c8[_0x68e9('0x33')][_0x68e9('0x3f')]+'%'};return _0x5dbd07;}})});}_0x31fb20=_['merge']({},_0x31fb20,_0x2020c8[_0x68e9('0x43')]);var _0xde7ca0={'where':_0x31fb20['where']};return db[_0x68e9('0x30')][_0x68e9('0x20')](_0xde7ca0)[_0x68e9('0x27')](function(_0x53c31a){_0x11da52['count']=_0x53c31a;if(_0x2020c8[_0x68e9('0x33')][_0x68e9('0x44')]){_0x31fb20[_0x68e9('0x45')]=[{'all':!![]}];}return db[_0x68e9('0x30')][_0x68e9('0x46')](_0x31fb20);})[_0x68e9('0x27')](function(_0x41280b){_0x11da52[_0x68e9('0x47')]=_0x41280b;return _0x11da52;})[_0x68e9('0x27')](respondWithFilteredResult(_0x204afc,_0x31fb20))[_0x68e9('0x48')](handleError(_0x204afc,null));};exports['show']=function(_0x1d6e6c,_0x2bde7f){var _0x4705a6={'raw':!![],'where':{'id':_0x1d6e6c[_0x68e9('0x49')]['id']}},_0x535962={};_0x535962[_0x68e9('0x36')]=_[_0x68e9('0x4a')](db[_0x68e9('0x30')][_0x68e9('0x4b')]);_0x535962[_0x68e9('0x33')]=_['keys'](_0x1d6e6c[_0x68e9('0x33')]);_0x535962[_0x68e9('0x34')]=_[_0x68e9('0x35')](_0x535962[_0x68e9('0x36')],_0x535962['query']);_0x4705a6[_0x68e9('0x37')]=_['intersection'](_0x535962[_0x68e9('0x36')],qs[_0x68e9('0x38')](_0x1d6e6c[_0x68e9('0x33')][_0x68e9('0x38')]));_0x4705a6[_0x68e9('0x37')]=_0x4705a6['attributes']['length']?_0x4705a6['attributes']:_0x535962['model'];if(_0x1d6e6c[_0x68e9('0x33')]['includeAll']){_0x4705a6[_0x68e9('0x45')]=[{'all':!![]}];}_0x4705a6=_[_0x68e9('0x40')]({},_0x4705a6,_0x1d6e6c[_0x68e9('0x43')]);return db['OpenchannelQueue'][_0x68e9('0x4c')](_0x4705a6)[_0x68e9('0x27')](handleEntityNotFound(_0x2bde7f,null))[_0x68e9('0x27')](respondWithResult(_0x2bde7f,null))[_0x68e9('0x48')](handleError(_0x2bde7f,null));};exports[_0x68e9('0x4d')]=function(_0x3242e2,_0x243044){return db['OpenchannelQueue'][_0x68e9('0x4d')](_0x3242e2[_0x68e9('0x4e')],{})[_0x68e9('0x27')](function(_0x501abe){var _0x2f58ba=_0x3242e2[_0x68e9('0x4f')][_0x68e9('0x29')]({'plain':!![]});if(!_0x2f58ba)throw new Error(_0x68e9('0x50'));if(_0x2f58ba[_0x68e9('0x51')]===_0x68e9('0x4f')){var _0x31eca5=_0x501abe[_0x68e9('0x29')]({'plain':!![]});var _0x36123f=_0x68e9('0x52');return db['UserProfileSection']['find']({'where':{'name':_0x36123f,'userProfileId':_0x2f58ba[_0x68e9('0x53')]},'raw':!![]})['then'](function(_0x282994){if(_0x282994&&_0x282994[_0x68e9('0x54')]===0x0){return db['UserProfileResource'][_0x68e9('0x4d')]({'name':_0x31eca5['name'],'resourceId':_0x31eca5['id'],'type':_0x282994[_0x68e9('0x2c')],'sectionId':_0x282994['id']},{})['then'](function(){return _0x501abe;});}else{return _0x501abe;}})['catch'](function(_0x506844){logger[_0x68e9('0x55')](_0x68e9('0x56'),_0x506844);throw _0x506844;});}return _0x501abe;})['then'](respondWithResult(_0x243044,0xc9))[_0x68e9('0x48')](handleError(_0x243044,null));};exports[_0x68e9('0x57')]=function(_0x2a8e73,_0x2ee6bb){if(_0x2a8e73['body']['id']){delete _0x2a8e73[_0x68e9('0x4e')]['id'];}return db[_0x68e9('0x30')][_0x68e9('0x4c')]({'where':{'id':_0x2a8e73[_0x68e9('0x49')]['id']}})[_0x68e9('0x27')](handleEntityNotFound(_0x2ee6bb,null))[_0x68e9('0x27')](saveUpdates(_0x2a8e73[_0x68e9('0x4e')],null))[_0x68e9('0x27')](respondWithResult(_0x2ee6bb,null))[_0x68e9('0x48')](handleError(_0x2ee6bb,null));};exports['destroy']=function(_0x33f455,_0x15403c){return db[_0x68e9('0x30')][_0x68e9('0x4c')]({'where':{'id':_0x33f455[_0x68e9('0x49')]['id']}})[_0x68e9('0x27')](handleEntityNotFound(_0x15403c,null))['then'](removeEntity(_0x15403c,null))[_0x68e9('0x48')](handleError(_0x15403c,null));};exports[_0x68e9('0x58')]=function(_0x2804f6,_0x1960e4){return db['OpenchannelQueue'][_0x68e9('0x58')]()['then'](respondWithResult(_0x1960e4,null))['catch'](handleError(_0x1960e4,null));};exports[_0x68e9('0x59')]=function(_0x208d8f,_0x36ac77,_0x3f2252){var _0xa437c7={'raw':!![],'where':{}},_0x517d9c={},_0x209d7b;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x208d8f['params']['id']}})[_0x68e9('0x27')](handleEntityNotFound(_0x36ac77,null))[_0x68e9('0x27')](function(_0xbe9ae2){if(_0xbe9ae2){_0x209d7b=_0xbe9ae2[_0x68e9('0x29')]({'plain':!![]});_0x517d9c['model']=_[_0x68e9('0x4a')](db[_0x68e9('0x5a')][_0x68e9('0x4b')]);_0x517d9c['query']=_[_0x68e9('0x4a')](_0x208d8f[_0x68e9('0x33')]);_0x517d9c[_0x68e9('0x34')]=_['intersection'](_0x517d9c['model'],_0x517d9c[_0x68e9('0x33')]);_0xa437c7[_0x68e9('0x37')]=_[_0x68e9('0x35')](_0x517d9c[_0x68e9('0x36')],qs['fields'](_0x208d8f[_0x68e9('0x33')][_0x68e9('0x38')]));_0xa437c7[_0x68e9('0x37')]=_0xa437c7[_0x68e9('0x37')]['length']?_0xa437c7[_0x68e9('0x37')]:_0x517d9c[_0x68e9('0x36')];if(!_0x208d8f['query'][_0x68e9('0x5b')](_0x68e9('0x3a'))){_0xa437c7[_0x68e9('0x22')]=qs[_0x68e9('0x22')](_0x208d8f['query'][_0x68e9('0x22')]);_0xa437c7[_0x68e9('0x21')]=qs['offset'](_0x208d8f[_0x68e9('0x33')][_0x68e9('0x21')]);}_0xa437c7[_0x68e9('0x3b')]=qs[_0x68e9('0x3c')](_0x208d8f[_0x68e9('0x33')][_0x68e9('0x3c')]);_0xa437c7[_0x68e9('0x3d')]=qs[_0x68e9('0x34')](_[_0x68e9('0x3e')](_0x208d8f[_0x68e9('0x33')],_0x517d9c['filters']));_0xa437c7[_0x68e9('0x3d')][_0x68e9('0x5c')]=_0xbe9ae2['id'];if(_0x208d8f[_0x68e9('0x33')][_0x68e9('0x3f')]){_0xa437c7[_0x68e9('0x3d')]=_['merge'](_0xa437c7[_0x68e9('0x3d')],{'$or':_[_0x68e9('0x2f')](_0xa437c7['attributes'],function(_0x386079){var _0x475797={};_0x475797[_0x386079]={'$like':'%'+_0x208d8f['query']['filter']+'%'};return _0x475797;})});}_0xa437c7=_[_0x68e9('0x40')]({},_0xa437c7,_0x208d8f[_0x68e9('0x43')]);return db[_0x68e9('0x5a')][_0x68e9('0x46')](_0xa437c7);}})[_0x68e9('0x27')](function(_0x46362d){if(_0x46362d){return db['User'][_0x68e9('0x5d')]({'where':{'id':_[_0x68e9('0x2f')](_0x46362d,_0x68e9('0x5e')),'role':_0x68e9('0x5f')},'attributes':['id','name',_0x68e9('0x60'),_0x68e9('0x61'),_0x68e9('0x62')]});}})[_0x68e9('0x27')](function(_0x15dc7c){if(_0x15dc7c){return{'count':_0x15dc7c[_0x68e9('0x20')],'rows':_['map'](_0x15dc7c[_0x68e9('0x47')],function(_0x59f3d0){return{'membername':_0x59f3d0[_0x68e9('0x2c')],'UserId':_0x59f3d0['id'],'queue_name':_0x209d7b[_0x68e9('0x2c')],'OpenchannelQueueId':_0x209d7b['id'],'interface':util[_0x68e9('0x63')](_0x68e9('0x64'),_0x68e9('0x65'),_0x59f3d0['name']),'penalty':0x0,'paused':_0x59f3d0[_0x68e9('0x60')],'createdAt':_0x59f3d0[_0x68e9('0x62')],'updatedAt':_0x59f3d0[_0x68e9('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x68e9('0x27')](respondWithFilteredResult(_0x36ac77,_0xa437c7))[_0x68e9('0x48')](handleError(_0x36ac77,null));};exports['getTeams']=function(_0x3798b4,_0x5d32c4,_0x3530e8){var _0x3c40f2={};var _0x268f27={};var _0x1d25e8;var _0x55aa08;return db['OpenchannelQueue'][_0x68e9('0x66')]({'where':{'id':_0x3798b4[_0x68e9('0x49')]['id']}})[_0x68e9('0x27')](handleEntityNotFound(_0x5d32c4,null))[_0x68e9('0x27')](function(_0x1d5135){if(_0x1d5135){_0x1d25e8=_0x1d5135;_0x268f27[_0x68e9('0x36')]=_[_0x68e9('0x4a')](db[_0x68e9('0x67')]['rawAttributes']);_0x268f27[_0x68e9('0x33')]=_[_0x68e9('0x4a')](_0x3798b4[_0x68e9('0x33')]);_0x268f27['filters']=_[_0x68e9('0x35')](_0x268f27['model'],_0x268f27[_0x68e9('0x33')]);_0x3c40f2[_0x68e9('0x37')]=_[_0x68e9('0x35')](_0x268f27[_0x68e9('0x36')],qs[_0x68e9('0x38')](_0x3798b4[_0x68e9('0x33')][_0x68e9('0x38')]));_0x3c40f2[_0x68e9('0x37')]=_0x3c40f2[_0x68e9('0x37')]['length']?_0x3c40f2[_0x68e9('0x37')]:_0x268f27[_0x68e9('0x36')];_0x3c40f2[_0x68e9('0x3b')]=qs['sort'](_0x3798b4[_0x68e9('0x33')][_0x68e9('0x3c')]);_0x3c40f2[_0x68e9('0x3d')]=qs[_0x68e9('0x34')](_[_0x68e9('0x3e')](_0x3798b4[_0x68e9('0x33')],_0x268f27[_0x68e9('0x34')]));if(_0x3798b4[_0x68e9('0x33')][_0x68e9('0x3f')]){_0x3c40f2[_0x68e9('0x3d')]=_[_0x68e9('0x40')](_0x3c40f2[_0x68e9('0x3d')],{'$or':_['map'](_0x3c40f2[_0x68e9('0x37')],function(_0x97111){var _0x1a4122={};_0x1a4122[_0x97111]={'$like':'%'+_0x3798b4['query'][_0x68e9('0x3f')]+'%'};return _0x1a4122;})});}_0x3c40f2=_['merge']({},_0x3c40f2,_0x3798b4[_0x68e9('0x43')]);return _0x1d25e8[_0x68e9('0x68')](_0x3c40f2);}})[_0x68e9('0x27')](function(_0x196e6a){if(_0x196e6a){_0x55aa08=_0x196e6a['length'];if(!_0x3798b4[_0x68e9('0x33')]['hasOwnProperty'](_0x68e9('0x3a'))){_0x3c40f2[_0x68e9('0x22')]=qs[_0x68e9('0x22')](_0x3798b4[_0x68e9('0x33')]['limit']);_0x3c40f2[_0x68e9('0x21')]=qs[_0x68e9('0x21')](_0x3798b4[_0x68e9('0x33')][_0x68e9('0x21')]);}return _0x1d25e8['getTeams'](_0x3c40f2);}})['then'](function(_0x49e6a1){if(_0x49e6a1){return _0x49e6a1?{'count':_0x55aa08,'rows':_0x49e6a1}:null;}})['then'](respondWithResult(_0x5d32c4,null))[_0x68e9('0x48')](handleError(_0x5d32c4,null));};exports[_0x68e9('0x69')]=function(_0x644655,_0x5abaf9,_0x512a4e){var _0x5149c1=_0x644655[_0x68e9('0x4e')]['ids'];return db[_0x68e9('0x67')]['findAll']({'where':{'id':_0x5149c1},'attributes':['id'],'include':[{'model':db[_0x68e9('0x6a')],'as':_0x68e9('0x6b'),'attributes':['id',_0x68e9('0x2c'),_0x68e9('0x6c'),_0x68e9('0x6d'),_0x68e9('0x6e')],'raw':!![]}]})[_0x68e9('0x27')](function(_0x3b25aa){if(_0x3b25aa){var _0x307788=_[_0x68e9('0x6f')](_0x3b25aa,function(_0x4aedaa){var _0x289717=_0x4aedaa['get']({'plain':!![]});return _0x289717[_0x68e9('0x6b')];});return db[_0x68e9('0x30')][_0x68e9('0x4c')]({'where':{'id':_0x644655[_0x68e9('0x49')]['id']}})['then'](function(_0x506b7b){return db[_0x68e9('0x70')][_0x68e9('0x71')](function(_0x21a44a){return _0x506b7b[_0x68e9('0x69')](_0x5149c1,{'transaction':_0x21a44a})[_0x68e9('0x27')](function(){return BPromise[_0x68e9('0x72')](_0x307788,function(_0x216023){return db[_0x68e9('0x5a')][_0x68e9('0x73')]({'where':{'UserId':_0x216023['id'],'OpenchannelQueueId':_0x644655[_0x68e9('0x49')]['id']},'transaction':_0x21a44a});});})[_0x68e9('0x27')](function(){_0x307788[_0x68e9('0x74')](function(_0x208948){socket[_0x68e9('0x75')](_0x68e9('0x76'),{'UserId':_0x208948['id'],'OpenchannelQueueId':_0x506b7b['id']});});});});});}})[_0x68e9('0x27')](respondWithStatusCode(_0x5abaf9,null))[_0x68e9('0x48')](handleError(_0x5abaf9,null));};exports[_0x68e9('0x77')]=function(_0x55001a,_0xcdf754,_0x89f00c){return db[_0x68e9('0x67')]['findAll']({'where':{'id':_0x55001a[_0x68e9('0x33')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x68e9('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x68e9('0x27')](handleEntityNotFound(_0xcdf754,null))[_0x68e9('0x27')](function(_0x1d7310){var _0x1ad0d1=_['map'](_0x1d7310,'id');var _0x3f470e=[];var _0x4cc800=[];var _0x5cd3c5=squel[_0x68e9('0x78')]();_0x5cd3c5[_0x68e9('0x79')](_0x68e9('0x7a'))[_0x68e9('0x7b')](_0x68e9('0x7c'),'tq')['join'](_0x68e9('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x68e9('0x3d')]('OpenchannelQueueId\x20=\x20?',_0x55001a[_0x68e9('0x49')]['id']);for(var _0x4dc011=0x0;_0x4dc011<_0x1d7310[_0x68e9('0x39')];_0x4dc011+=0x1){let _0x28104a=_0x1d7310[_0x4dc011];for(var _0x3e9d89=0x0;_0x3e9d89<_0x28104a[_0x68e9('0x6b')]['length'];_0x3e9d89+=0x1){let _0xf20ef0=_0x28104a[_0x68e9('0x6b')][_0x3e9d89];var _0x432efe=_0x5cd3c5[_0x68e9('0x7e')]();_0x432efe[_0x68e9('0x3d')](_0x68e9('0x7f'),_0xf20ef0['id']);_0x4cc800['push'](db[_0x68e9('0x70')]['query'](_0x432efe[_0x68e9('0x80')](),{'type':db[_0x68e9('0x70')][_0x68e9('0x81')]['SELECT']})[_0x68e9('0x27')](function(_0x311013){if(_0x311013[_0x68e9('0x39')]===0x1){return _0xf20ef0['id'];}else{var _0x2ea3d6=_[_0x68e9('0x82')](_[_0x68e9('0x2f')](_0x311013,_0x68e9('0x83')),function(_0xbc93ed){return _[_0x68e9('0x84')](_0x1ad0d1,_0xbc93ed);});if(_0x2ea3d6){return _0xf20ef0['id'];}}}));}}return BPromise[_0x68e9('0x85')](_0x4cc800)[_0x68e9('0x27')](function(_0x354578){_0x3f470e=_(_0x3f470e)[_0x68e9('0x86')](_0x354578)[_0x68e9('0x87')]()['value']();return db[_0x68e9('0x30')]['find']({'where':{'id':_0x55001a['params']['id']}})[_0x68e9('0x27')](function(_0x55c7dd){return db[_0x68e9('0x70')]['transaction'](function(_0x453420){return _0x55c7dd['removeTeams'](_0x55001a[_0x68e9('0x33')][_0x68e9('0x88')],{'transaction':_0x453420})[_0x68e9('0x27')](function(){if(!_[_0x68e9('0x89')](_0x3f470e)){return _0x55c7dd[_0x68e9('0x8a')](_0x3f470e,{'transaction':_0x453420});}})[_0x68e9('0x27')](function(){_0x3f470e[_0x68e9('0x74')](function(_0xc4717f){socket[_0x68e9('0x75')](_0x68e9('0x8b'),{'UserId':_0xc4717f,'OpenchannelQueueId':_0x55c7dd['id']});});});});});});})[_0x68e9('0x27')](respondWithStatusCode(_0xcdf754,null))[_0x68e9('0x48')](handleError(_0xcdf754,null));};exports[_0x68e9('0x8c')]=function(_0x504538,_0x56dcfb,_0x47adfa){return db[_0x68e9('0x30')][_0x68e9('0x4c')]({'where':{'id':_0x504538['params']['id']}})['then'](handleEntityNotFound(_0x56dcfb,null))[_0x68e9('0x27')](function(_0x44c602){if(_0x44c602){return _0x44c602[_0x68e9('0x8c')](_0x504538['body'][_0x68e9('0x88')],_[_0x68e9('0x8d')](_0x504538['body'],[_0x68e9('0x88'),'id'])||{})[_0x68e9('0x8e')](function(_0x35f93c){for(var _0x261ae1=0x0;_0x261ae1<_0x504538[_0x68e9('0x4e')][_0x68e9('0x88')][_0x68e9('0x39')];_0x261ae1+=0x1){socket[_0x68e9('0x75')]('userOpenchannelQueue:save',{'UserId':Number(_0x504538[_0x68e9('0x4e')][_0x68e9('0x88')][_0x261ae1]),'OpenchannelQueueId':Number(_0x504538['params']['id'])});}return _0x35f93c;});}})[_0x68e9('0x27')](respondWithResult(_0x56dcfb,null))['catch'](handleError(_0x56dcfb,null));};exports[_0x68e9('0x8a')]=function(_0x511d71,_0x86cd28,_0x2f16ab){return db[_0x68e9('0x30')][_0x68e9('0x4c')]({'where':{'id':_0x511d71[_0x68e9('0x49')]['id']}})['then'](handleEntityNotFound(_0x86cd28,null))[_0x68e9('0x27')](function(_0x26bd1e){if(_0x26bd1e){return _0x26bd1e[_0x68e9('0x8a')](_0x511d71[_0x68e9('0x33')][_0x68e9('0x88')])[_0x68e9('0x27')](function(){if(_[_0x68e9('0x8f')](_0x511d71[_0x68e9('0x33')][_0x68e9('0x88')])){for(var _0x45c2c1=0x0;_0x45c2c1<_0x511d71[_0x68e9('0x33')][_0x68e9('0x88')][_0x68e9('0x39')];_0x45c2c1+=0x1){socket[_0x68e9('0x75')](_0x68e9('0x8b'),{'UserId':Number(_0x511d71[_0x68e9('0x33')]['ids'][_0x45c2c1]),'OpenchannelQueueId':Number(_0x511d71[_0x68e9('0x49')]['id'])});}}else{socket[_0x68e9('0x75')](_0x68e9('0x8b'),{'UserId':Number(_0x511d71['query'][_0x68e9('0x88')]),'OpenchannelQueueId':Number(_0x511d71[_0x68e9('0x49')]['id'])});}});}})[_0x68e9('0x27')](respondWithStatusCode(_0x86cd28,null))[_0x68e9('0x48')](handleError(_0x86cd28,null));};exports[_0x68e9('0x90')]=function(_0x508870,_0xaf1d84,_0x11b626){var _0x4c5b4e={};var _0x258884={};var _0x4bb62b;var _0x2d5828;return db[_0x68e9('0x30')][_0x68e9('0x66')]({'where':{'id':_0x508870[_0x68e9('0x49')]['id']}})[_0x68e9('0x27')](handleEntityNotFound(_0xaf1d84,null))[_0x68e9('0x27')](function(_0x3e1daf){if(_0x3e1daf){_0x4bb62b=_0x3e1daf;_0x258884[_0x68e9('0x36')]=_[_0x68e9('0x4a')](db['User']['rawAttributes']);_0x258884[_0x68e9('0x33')]=_[_0x68e9('0x4a')](_0x508870['query']);_0x258884[_0x68e9('0x34')]=_[_0x68e9('0x35')](_0x258884[_0x68e9('0x36')],_0x258884[_0x68e9('0x33')]);_0x4c5b4e['attributes']=_[_0x68e9('0x35')](_0x258884[_0x68e9('0x36')],qs[_0x68e9('0x38')](_0x508870[_0x68e9('0x33')][_0x68e9('0x38')]));_0x4c5b4e['attributes']=_0x4c5b4e[_0x68e9('0x37')][_0x68e9('0x39')]?_0x4c5b4e[_0x68e9('0x37')]:_0x258884[_0x68e9('0x36')];_0x4c5b4e[_0x68e9('0x3b')]=qs[_0x68e9('0x3c')](_0x508870[_0x68e9('0x33')][_0x68e9('0x3c')]);_0x4c5b4e[_0x68e9('0x3d')]=qs['filters'](_[_0x68e9('0x3e')](_0x508870[_0x68e9('0x33')],_0x258884[_0x68e9('0x34')]));if(_0x508870[_0x68e9('0x33')]['filter']){_0x4c5b4e[_0x68e9('0x3d')]=_[_0x68e9('0x40')](_0x4c5b4e['where'],{'$or':_[_0x68e9('0x2f')](_0x4c5b4e[_0x68e9('0x37')],function(_0x1609ec){var _0x568449={};_0x568449[_0x1609ec]={'$like':'%'+_0x508870['query']['filter']+'%'};return _0x568449;})});}_0x4c5b4e=_[_0x68e9('0x40')]({},_0x4c5b4e,_0x508870[_0x68e9('0x43')]);return _0x4bb62b[_0x68e9('0x90')](_0x4c5b4e);}})[_0x68e9('0x27')](function(_0x58508e){if(_0x58508e){_0x2d5828=_0x58508e[_0x68e9('0x39')];if(!_0x508870['query']['hasOwnProperty']('nolimit')){_0x4c5b4e['limit']=qs[_0x68e9('0x22')](_0x508870[_0x68e9('0x33')][_0x68e9('0x22')]);_0x4c5b4e['offset']=qs[_0x68e9('0x21')](_0x508870[_0x68e9('0x33')][_0x68e9('0x21')]);}return _0x4bb62b[_0x68e9('0x90')](_0x4c5b4e);}})[_0x68e9('0x27')](function(_0x158cfb){if(_0x158cfb){return _0x158cfb?{'count':_0x2d5828,'rows':_0x158cfb}:null;}})[_0x68e9('0x27')](respondWithResult(_0xaf1d84,null))[_0x68e9('0x48')](handleError(_0xaf1d84,null));}; \ No newline at end of file +var _0x6b19=['to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','end','error','send','index','rawAttributes','type','key','model','map','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','OpenchannelQueue','count','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','name','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAndCountAll','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','User','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','all','union','compact','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox'];(function(_0x57a670,_0x30e402){var _0x41ce21=function(_0x11bd34){while(--_0x11bd34){_0x57a670['push'](_0x57a670['shift']());}};_0x41ce21(++_0x30e402);}(_0x6b19,0x86));var _0x96b1=function(_0x1a55a7,_0x2466ac){_0x1a55a7=_0x1a55a7-0x0;var _0x12cb2d=_0x6b19[_0x1a55a7];return _0x12cb2d;};'use strict';var emlformat=require(_0x96b1('0x0'));var rimraf=require(_0x96b1('0x1'));var zipdir=require(_0x96b1('0x2'));var jsonpatch=require(_0x96b1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x96b1('0x4'));var Mustache=require(_0x96b1('0x5'));var util=require(_0x96b1('0x6'));var path=require(_0x96b1('0x7'));var sox=require(_0x96b1('0x8'));var csv=require(_0x96b1('0x9'));var ejs=require(_0x96b1('0xa'));var fs=require('fs');var fs_extra=require(_0x96b1('0xb'));var _=require(_0x96b1('0xc'));var squel=require(_0x96b1('0xd'));var crypto=require(_0x96b1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x96b1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x96b1('0x10'));var Papa=require('papaparse');var Redis=require(_0x96b1('0x11'));var authService=require(_0x96b1('0x12'));var qs=require(_0x96b1('0x13'));var as=require(_0x96b1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x96b1('0x15'))('api');var utils=require(_0x96b1('0x16'));var config=require(_0x96b1('0x17'));var licenseUtil=require(_0x96b1('0x18'));var db=require('../../mysqldb')['db'];config[_0x96b1('0x19')]=_[_0x96b1('0x1a')](config[_0x96b1('0x19')],{'host':_0x96b1('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96b1('0x19')]));require(_0x96b1('0x1c'))[_0x96b1('0x1d')](socket);function respondWithStatusCode(_0x4fc901,_0x3e333a){_0x3e333a=_0x3e333a||0xcc;return function(_0x1390d3){if(_0x1390d3){return _0x4fc901[_0x96b1('0x1e')](_0x3e333a);}return _0x4fc901[_0x96b1('0x1f')](_0x3e333a)['end']();};}function respondWithResult(_0x73570d,_0x3e7e58){_0x3e7e58=_0x3e7e58||0xc8;return function(_0xb9e12b){if(_0xb9e12b){return _0x73570d[_0x96b1('0x1f')](_0x3e7e58)[_0x96b1('0x20')](_0xb9e12b);}};}function respondWithFilteredResult(_0x1dd95f,_0x2c0a7d){return function(_0x14de81){if(_0x14de81){var _0x19fd80=typeof _0x2c0a7d[_0x96b1('0x21')]===_0x96b1('0x22')&&typeof _0x2c0a7d[_0x96b1('0x23')]===_0x96b1('0x22');var _0x386be3=_0x14de81['count'];var _0x35e541=_0x19fd80?0x0:_0x2c0a7d[_0x96b1('0x21')];var _0x278f07=_0x19fd80?_0x14de81['count']:_0x2c0a7d[_0x96b1('0x21')]+_0x2c0a7d[_0x96b1('0x23')];var _0x4034ba;if(_0x278f07>=_0x386be3){_0x278f07=_0x386be3;_0x4034ba=0xc8;}else{_0x4034ba=0xce;}_0x1dd95f['status'](_0x4034ba);return _0x1dd95f[_0x96b1('0x24')](_0x96b1('0x25'),_0x35e541+'-'+_0x278f07+'/'+_0x386be3)[_0x96b1('0x20')](_0x14de81);}return null;};}function patchUpdates(_0x11d45b){return function(_0x151880){try{jsonpatch[_0x96b1('0x26')](_0x151880,_0x11d45b,!![]);}catch(_0x5f14b9){return BPromise[_0x96b1('0x27')](_0x5f14b9);}return _0x151880[_0x96b1('0x28')]();};}function saveUpdates(_0x551851,_0x36923d){return function(_0x345a9a){if(_0x345a9a){return _0x345a9a[_0x96b1('0x29')](_0x551851)[_0x96b1('0x2a')](function(_0x3b4b61){return _0x3b4b61;});}return null;};}function removeEntity(_0x5cbf19,_0x55b48b){return function(_0x161f5b){if(_0x161f5b){return _0x161f5b[_0x96b1('0x2b')]()[_0x96b1('0x2a')](function(){var _0x1f35da=_0x161f5b[_0x96b1('0x2c')]({'plain':!![]});var _0x34c34c=_0x96b1('0x2d');return db[_0x96b1('0x2e')][_0x96b1('0x2b')]({'where':{'type':_0x34c34c,'resourceId':_0x1f35da['id']}})[_0x96b1('0x2a')](function(){return _0x161f5b;});})[_0x96b1('0x2a')](function(){_0x5cbf19['status'](0xcc)[_0x96b1('0x2f')]();});}};}function handleEntityNotFound(_0x33bef2,_0x270918){return function(_0x428a27){if(!_0x428a27){_0x33bef2[_0x96b1('0x1e')](0x194);}return _0x428a27;};}function handleError(_0x445f6b,_0xa238b6){_0xa238b6=_0xa238b6||0x1f4;return function(_0x79bad5){logger[_0x96b1('0x30')](_0x79bad5['stack']);if(_0x79bad5['name']){delete _0x79bad5['name'];}_0x445f6b[_0x96b1('0x1f')](_0xa238b6)[_0x96b1('0x31')](_0x79bad5);};}exports[_0x96b1('0x32')]=function(_0x39edac,_0x2bb9fa){var _0x5bebe3={},_0x4083d0={},_0x5b37ef={'count':0x0,'rows':[]};var _0x333f9d=_['map'](db['OpenchannelQueue'][_0x96b1('0x33')],function(_0x334dc3){return{'name':_0x334dc3['fieldName'],'type':_0x334dc3[_0x96b1('0x34')][_0x96b1('0x35')]};});_0x4083d0[_0x96b1('0x36')]=_[_0x96b1('0x37')](_0x333f9d,'name');_0x4083d0[_0x96b1('0x38')]=_[_0x96b1('0x39')](_0x39edac[_0x96b1('0x38')]);_0x4083d0[_0x96b1('0x3a')]=_['intersection'](_0x4083d0[_0x96b1('0x36')],_0x4083d0[_0x96b1('0x38')]);_0x5bebe3['attributes']=_['intersection'](_0x4083d0[_0x96b1('0x36')],qs[_0x96b1('0x3b')](_0x39edac[_0x96b1('0x38')]['fields']));_0x5bebe3[_0x96b1('0x3c')]=_0x5bebe3[_0x96b1('0x3c')]['length']?_0x5bebe3['attributes']:_0x4083d0[_0x96b1('0x36')];if(!_0x39edac[_0x96b1('0x38')][_0x96b1('0x3d')](_0x96b1('0x3e'))){_0x5bebe3[_0x96b1('0x23')]=qs[_0x96b1('0x23')](_0x39edac[_0x96b1('0x38')][_0x96b1('0x23')]);_0x5bebe3[_0x96b1('0x21')]=qs['offset'](_0x39edac[_0x96b1('0x38')][_0x96b1('0x21')]);}_0x5bebe3[_0x96b1('0x3f')]=qs[_0x96b1('0x40')](_0x39edac['query'][_0x96b1('0x40')]);_0x5bebe3[_0x96b1('0x41')]=qs[_0x96b1('0x3a')](_[_0x96b1('0x42')](_0x39edac[_0x96b1('0x38')],_0x4083d0[_0x96b1('0x3a')]),_0x333f9d);if(_0x39edac[_0x96b1('0x38')][_0x96b1('0x43')]){_0x5bebe3['where']=_[_0x96b1('0x44')](_0x5bebe3['where'],{'$or':_[_0x96b1('0x37')](_0x333f9d,function(_0xc117f1){if(_0xc117f1[_0x96b1('0x34')]!==_0x96b1('0x45')){var _0x31bbda={};_0x31bbda[_0xc117f1['name']]={'$like':'%'+_0x39edac['query']['filter']+'%'};return _0x31bbda;}})});}_0x5bebe3=_[_0x96b1('0x44')]({},_0x5bebe3,_0x39edac['options']);var _0x264147={'where':_0x5bebe3[_0x96b1('0x41')]};return db[_0x96b1('0x46')][_0x96b1('0x47')](_0x264147)['then'](function(_0x12dc5f){_0x5b37ef[_0x96b1('0x47')]=_0x12dc5f;if(_0x39edac['query'][_0x96b1('0x48')]){_0x5bebe3[_0x96b1('0x49')]=[{'all':!![]}];}return db[_0x96b1('0x46')][_0x96b1('0x4a')](_0x5bebe3);})[_0x96b1('0x2a')](function(_0x4e0bba){_0x5b37ef[_0x96b1('0x4b')]=_0x4e0bba;return _0x5b37ef;})[_0x96b1('0x2a')](respondWithFilteredResult(_0x2bb9fa,_0x5bebe3))[_0x96b1('0x4c')](handleError(_0x2bb9fa,null));};exports[_0x96b1('0x4d')]=function(_0x582903,_0x949301){var _0x217fd7={'raw':!![],'where':{'id':_0x582903[_0x96b1('0x4e')]['id']}},_0x13e8fb={};_0x13e8fb[_0x96b1('0x36')]=_[_0x96b1('0x39')](db[_0x96b1('0x46')][_0x96b1('0x33')]);_0x13e8fb[_0x96b1('0x38')]=_[_0x96b1('0x39')](_0x582903[_0x96b1('0x38')]);_0x13e8fb[_0x96b1('0x3a')]=_[_0x96b1('0x4f')](_0x13e8fb['model'],_0x13e8fb['query']);_0x217fd7[_0x96b1('0x3c')]=_[_0x96b1('0x4f')](_0x13e8fb[_0x96b1('0x36')],qs[_0x96b1('0x3b')](_0x582903[_0x96b1('0x38')][_0x96b1('0x3b')]));_0x217fd7['attributes']=_0x217fd7['attributes'][_0x96b1('0x50')]?_0x217fd7['attributes']:_0x13e8fb[_0x96b1('0x36')];if(_0x582903[_0x96b1('0x38')][_0x96b1('0x48')]){_0x217fd7[_0x96b1('0x49')]=[{'all':!![]}];}_0x217fd7=_[_0x96b1('0x44')]({},_0x217fd7,_0x582903[_0x96b1('0x51')]);return db[_0x96b1('0x46')][_0x96b1('0x52')](_0x217fd7)[_0x96b1('0x2a')](handleEntityNotFound(_0x949301,null))[_0x96b1('0x2a')](respondWithResult(_0x949301,null))[_0x96b1('0x4c')](handleError(_0x949301,null));};exports['create']=function(_0xc26a1d,_0x27b660){return db[_0x96b1('0x46')]['create'](_0xc26a1d[_0x96b1('0x53')],{})[_0x96b1('0x2a')](function(_0x543045){var _0x16da26=_0xc26a1d[_0x96b1('0x54')][_0x96b1('0x2c')]({'plain':!![]});if(!_0x16da26)throw new Error(_0x96b1('0x55'));if(_0x16da26[_0x96b1('0x56')]===_0x96b1('0x54')){var _0x4c1893=_0x543045['get']({'plain':!![]});var _0x392877=_0x96b1('0x2d');return db[_0x96b1('0x57')][_0x96b1('0x52')]({'where':{'name':_0x392877,'userProfileId':_0x16da26[_0x96b1('0x58')]},'raw':!![]})[_0x96b1('0x2a')](function(_0x2dc13f){if(_0x2dc13f&&_0x2dc13f[_0x96b1('0x59')]===0x0){return db[_0x96b1('0x2e')][_0x96b1('0x5a')]({'name':_0x4c1893[_0x96b1('0x5b')],'resourceId':_0x4c1893['id'],'type':_0x2dc13f[_0x96b1('0x5b')],'sectionId':_0x2dc13f['id']},{})['then'](function(){return _0x543045;});}else{return _0x543045;}})[_0x96b1('0x4c')](function(_0x565b78){logger[_0x96b1('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x565b78);throw _0x565b78;});}return _0x543045;})[_0x96b1('0x2a')](respondWithResult(_0x27b660,0xc9))[_0x96b1('0x4c')](handleError(_0x27b660,null));};exports['update']=function(_0x594a10,_0x13f32f){if(_0x594a10[_0x96b1('0x53')]['id']){delete _0x594a10[_0x96b1('0x53')]['id'];}return db[_0x96b1('0x46')][_0x96b1('0x52')]({'where':{'id':_0x594a10[_0x96b1('0x4e')]['id']}})['then'](handleEntityNotFound(_0x13f32f,null))[_0x96b1('0x2a')](saveUpdates(_0x594a10[_0x96b1('0x53')],null))[_0x96b1('0x2a')](respondWithResult(_0x13f32f,null))['catch'](handleError(_0x13f32f,null));};exports[_0x96b1('0x2b')]=function(_0x8a25db,_0x1d8980){return db[_0x96b1('0x46')][_0x96b1('0x52')]({'where':{'id':_0x8a25db[_0x96b1('0x4e')]['id']}})[_0x96b1('0x2a')](handleEntityNotFound(_0x1d8980,null))[_0x96b1('0x2a')](removeEntity(_0x1d8980,null))[_0x96b1('0x4c')](handleError(_0x1d8980,null));};exports[_0x96b1('0x5c')]=function(_0xe54cd,_0x17b351){return db[_0x96b1('0x46')][_0x96b1('0x5c')]()[_0x96b1('0x2a')](respondWithResult(_0x17b351,null))[_0x96b1('0x4c')](handleError(_0x17b351,null));};exports[_0x96b1('0x5d')]=function(_0x48c4f6,_0x41c525,_0x4e1803){var _0x12493b={'raw':!![],'where':{}},_0x2fb566={},_0x1151cf;return db[_0x96b1('0x46')][_0x96b1('0x5e')]({'where':{'id':_0x48c4f6[_0x96b1('0x4e')]['id']}})[_0x96b1('0x2a')](handleEntityNotFound(_0x41c525,null))[_0x96b1('0x2a')](function(_0x1970c7){if(_0x1970c7){_0x1151cf=_0x1970c7[_0x96b1('0x2c')]({'plain':!![]});_0x2fb566[_0x96b1('0x36')]=_['keys'](db[_0x96b1('0x5f')]['rawAttributes']);_0x2fb566['query']=_[_0x96b1('0x39')](_0x48c4f6[_0x96b1('0x38')]);_0x2fb566[_0x96b1('0x3a')]=_[_0x96b1('0x4f')](_0x2fb566[_0x96b1('0x36')],_0x2fb566['query']);_0x12493b[_0x96b1('0x3c')]=_[_0x96b1('0x4f')](_0x2fb566[_0x96b1('0x36')],qs['fields'](_0x48c4f6['query'][_0x96b1('0x3b')]));_0x12493b['attributes']=_0x12493b['attributes'][_0x96b1('0x50')]?_0x12493b[_0x96b1('0x3c')]:_0x2fb566[_0x96b1('0x36')];if(!_0x48c4f6[_0x96b1('0x38')][_0x96b1('0x3d')](_0x96b1('0x3e'))){_0x12493b[_0x96b1('0x23')]=qs[_0x96b1('0x23')](_0x48c4f6[_0x96b1('0x38')][_0x96b1('0x23')]);_0x12493b[_0x96b1('0x21')]=qs[_0x96b1('0x21')](_0x48c4f6[_0x96b1('0x38')]['offset']);}_0x12493b[_0x96b1('0x3f')]=qs['sort'](_0x48c4f6[_0x96b1('0x38')][_0x96b1('0x40')]);_0x12493b['where']=qs[_0x96b1('0x3a')](_['pick'](_0x48c4f6[_0x96b1('0x38')],_0x2fb566[_0x96b1('0x3a')]));_0x12493b[_0x96b1('0x41')][_0x96b1('0x60')]=_0x1970c7['id'];if(_0x48c4f6[_0x96b1('0x38')]['filter']){_0x12493b[_0x96b1('0x41')]=_[_0x96b1('0x44')](_0x12493b[_0x96b1('0x41')],{'$or':_[_0x96b1('0x37')](_0x12493b['attributes'],function(_0x3ee2a1){var _0x1e9833={};_0x1e9833[_0x3ee2a1]={'$like':'%'+_0x48c4f6[_0x96b1('0x38')][_0x96b1('0x43')]+'%'};return _0x1e9833;})});}_0x12493b=_[_0x96b1('0x44')]({},_0x12493b,_0x48c4f6['options']);return db[_0x96b1('0x5f')]['findAll'](_0x12493b);}})['then'](function(_0x22db86){if(_0x22db86){return db['User'][_0x96b1('0x61')]({'where':{'id':_[_0x96b1('0x37')](_0x22db86,'UserId'),'role':'agent'},'attributes':['id',_0x96b1('0x5b'),_0x96b1('0x62'),_0x96b1('0x63'),_0x96b1('0x64')]});}})['then'](function(_0x57337f){if(_0x57337f){return{'count':_0x57337f[_0x96b1('0x47')],'rows':_[_0x96b1('0x37')](_0x57337f['rows'],function(_0x3857db){return{'membername':_0x3857db[_0x96b1('0x5b')],'UserId':_0x3857db['id'],'queue_name':_0x1151cf['name'],'OpenchannelQueueId':_0x1151cf['id'],'interface':util[_0x96b1('0x65')](_0x96b1('0x66'),'SIP',_0x3857db[_0x96b1('0x5b')]),'penalty':0x0,'paused':_0x3857db[_0x96b1('0x62')],'createdAt':_0x3857db[_0x96b1('0x64')],'updatedAt':_0x3857db[_0x96b1('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x96b1('0x2a')](respondWithFilteredResult(_0x41c525,_0x12493b))[_0x96b1('0x4c')](handleError(_0x41c525,null));};exports[_0x96b1('0x67')]=function(_0x16a88b,_0x2025d8,_0x4078f3){var _0x36c569={};var _0x5c280e={};var _0x28aa6e;var _0x21b1f1;return db[_0x96b1('0x46')][_0x96b1('0x5e')]({'where':{'id':_0x16a88b[_0x96b1('0x4e')]['id']}})[_0x96b1('0x2a')](handleEntityNotFound(_0x2025d8,null))[_0x96b1('0x2a')](function(_0xd303a5){if(_0xd303a5){_0x28aa6e=_0xd303a5;_0x5c280e[_0x96b1('0x36')]=_[_0x96b1('0x39')](db[_0x96b1('0x68')]['rawAttributes']);_0x5c280e[_0x96b1('0x38')]=_[_0x96b1('0x39')](_0x16a88b[_0x96b1('0x38')]);_0x5c280e[_0x96b1('0x3a')]=_[_0x96b1('0x4f')](_0x5c280e[_0x96b1('0x36')],_0x5c280e[_0x96b1('0x38')]);_0x36c569[_0x96b1('0x3c')]=_[_0x96b1('0x4f')](_0x5c280e[_0x96b1('0x36')],qs[_0x96b1('0x3b')](_0x16a88b[_0x96b1('0x38')]['fields']));_0x36c569[_0x96b1('0x3c')]=_0x36c569['attributes'][_0x96b1('0x50')]?_0x36c569['attributes']:_0x5c280e[_0x96b1('0x36')];_0x36c569['order']=qs[_0x96b1('0x40')](_0x16a88b[_0x96b1('0x38')]['sort']);_0x36c569[_0x96b1('0x41')]=qs['filters'](_[_0x96b1('0x42')](_0x16a88b[_0x96b1('0x38')],_0x5c280e['filters']));if(_0x16a88b['query'][_0x96b1('0x43')]){_0x36c569[_0x96b1('0x41')]=_[_0x96b1('0x44')](_0x36c569[_0x96b1('0x41')],{'$or':_[_0x96b1('0x37')](_0x36c569[_0x96b1('0x3c')],function(_0x540545){var _0x349ae2={};_0x349ae2[_0x540545]={'$like':'%'+_0x16a88b[_0x96b1('0x38')]['filter']+'%'};return _0x349ae2;})});}_0x36c569=_[_0x96b1('0x44')]({},_0x36c569,_0x16a88b[_0x96b1('0x51')]);return _0x28aa6e[_0x96b1('0x67')](_0x36c569);}})[_0x96b1('0x2a')](function(_0x2ca36b){if(_0x2ca36b){_0x21b1f1=_0x2ca36b[_0x96b1('0x50')];if(!_0x16a88b['query'][_0x96b1('0x3d')](_0x96b1('0x3e'))){_0x36c569[_0x96b1('0x23')]=qs['limit'](_0x16a88b[_0x96b1('0x38')][_0x96b1('0x23')]);_0x36c569[_0x96b1('0x21')]=qs[_0x96b1('0x21')](_0x16a88b[_0x96b1('0x38')][_0x96b1('0x21')]);}return _0x28aa6e[_0x96b1('0x67')](_0x36c569);}})[_0x96b1('0x2a')](function(_0x5d8d88){if(_0x5d8d88){return _0x5d8d88?{'count':_0x21b1f1,'rows':_0x5d8d88}:null;}})['then'](respondWithResult(_0x2025d8,null))[_0x96b1('0x4c')](handleError(_0x2025d8,null));};exports[_0x96b1('0x69')]=function(_0x43d2b1,_0x3604c9,_0x93f510){var _0x27f45a=_0x43d2b1[_0x96b1('0x53')][_0x96b1('0x6a')];return db[_0x96b1('0x68')][_0x96b1('0x4a')]({'where':{'id':_0x27f45a},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x96b1('0x5b'),_0x96b1('0x6b'),_0x96b1('0x6c'),_0x96b1('0x6d')],'raw':!![]}]})[_0x96b1('0x2a')](function(_0x249c4a){if(_0x249c4a){var _0x56d86a=_[_0x96b1('0x6e')](_0x249c4a,function(_0x5336f4){var _0x2f419c=_0x5336f4[_0x96b1('0x2c')]({'plain':!![]});return _0x2f419c[_0x96b1('0x6f')];});return db[_0x96b1('0x46')][_0x96b1('0x52')]({'where':{'id':_0x43d2b1[_0x96b1('0x4e')]['id']}})[_0x96b1('0x2a')](function(_0x3fa275){return db[_0x96b1('0x70')][_0x96b1('0x71')](function(_0x23c797){return _0x3fa275[_0x96b1('0x69')](_0x27f45a,{'transaction':_0x23c797})['then'](function(){return BPromise[_0x96b1('0x72')](_0x56d86a,function(_0x35f01d){return db[_0x96b1('0x5f')][_0x96b1('0x73')]({'where':{'UserId':_0x35f01d['id'],'OpenchannelQueueId':_0x43d2b1[_0x96b1('0x4e')]['id']},'transaction':_0x23c797});});})[_0x96b1('0x2a')](function(){_0x56d86a[_0x96b1('0x74')](function(_0x487d30){socket[_0x96b1('0x75')](_0x96b1('0x76'),{'UserId':_0x487d30['id'],'OpenchannelQueueId':_0x3fa275['id']});});});});});}})[_0x96b1('0x2a')](respondWithStatusCode(_0x3604c9,null))[_0x96b1('0x4c')](handleError(_0x3604c9,null));};exports['removeTeams']=function(_0x29184b,_0x3642ce,_0x42bbfb){return db[_0x96b1('0x68')][_0x96b1('0x4a')]({'where':{'id':_0x29184b[_0x96b1('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x96b1('0x77')],'as':_0x96b1('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x96b1('0x2a')](handleEntityNotFound(_0x3642ce,null))[_0x96b1('0x2a')](function(_0x48f622){var _0x3efe71=_[_0x96b1('0x37')](_0x48f622,'id');var _0x22edc4=[];var _0x4a9f14=[];var _0x1a66e5=squel[_0x96b1('0x78')]();_0x1a66e5[_0x96b1('0x79')](_0x96b1('0x7a'))[_0x96b1('0x7b')]('team_has_openchannel_queues','tq')['join'](_0x96b1('0x7c'),'ut',_0x96b1('0x7d'))['where'](_0x96b1('0x7e'),_0x29184b[_0x96b1('0x4e')]['id']);for(var _0x9f663c=0x0;_0x9f663c<_0x48f622['length'];_0x9f663c+=0x1){let _0x3d5777=_0x48f622[_0x9f663c];for(var _0x58cb9d=0x0;_0x58cb9d<_0x3d5777['Agents'][_0x96b1('0x50')];_0x58cb9d+=0x1){let _0x3d9e33=_0x3d5777[_0x96b1('0x6f')][_0x58cb9d];var _0x1e2058=_0x1a66e5[_0x96b1('0x7f')]();_0x1e2058[_0x96b1('0x41')](_0x96b1('0x80'),_0x3d9e33['id']);_0x4a9f14[_0x96b1('0x81')](db[_0x96b1('0x70')][_0x96b1('0x38')](_0x1e2058[_0x96b1('0x82')](),{'type':db[_0x96b1('0x70')]['QueryTypes'][_0x96b1('0x83')]})[_0x96b1('0x2a')](function(_0x4268b7){if(_0x4268b7[_0x96b1('0x50')]===0x1){return _0x3d9e33['id'];}else{var _0x3b40a1=_['every'](_[_0x96b1('0x37')](_0x4268b7,'TeamId'),function(_0x4714c0){return _['includes'](_0x3efe71,_0x4714c0);});if(_0x3b40a1){return _0x3d9e33['id'];}}}));}}return BPromise[_0x96b1('0x84')](_0x4a9f14)[_0x96b1('0x2a')](function(_0x1087b7){_0x22edc4=_(_0x22edc4)[_0x96b1('0x85')](_0x1087b7)[_0x96b1('0x86')]()['value']();return db[_0x96b1('0x46')][_0x96b1('0x52')]({'where':{'id':_0x29184b[_0x96b1('0x4e')]['id']}})[_0x96b1('0x2a')](function(_0xf19c45){return db['sequelize'][_0x96b1('0x71')](function(_0x4716a8){return _0xf19c45[_0x96b1('0x87')](_0x29184b['query'][_0x96b1('0x6a')],{'transaction':_0x4716a8})[_0x96b1('0x2a')](function(){if(!_[_0x96b1('0x88')](_0x22edc4)){return _0xf19c45[_0x96b1('0x89')](_0x22edc4,{'transaction':_0x4716a8});}})['then'](function(){_0x22edc4[_0x96b1('0x74')](function(_0x4d69e9){socket[_0x96b1('0x75')](_0x96b1('0x8a'),{'UserId':_0x4d69e9,'OpenchannelQueueId':_0xf19c45['id']});});});});});});})['then'](respondWithStatusCode(_0x3642ce,null))[_0x96b1('0x4c')](handleError(_0x3642ce,null));};exports[_0x96b1('0x8b')]=function(_0x5cc8c4,_0x312934,_0x5033aa){return db['OpenchannelQueue'][_0x96b1('0x52')]({'where':{'id':_0x5cc8c4[_0x96b1('0x4e')]['id']}})[_0x96b1('0x2a')](handleEntityNotFound(_0x312934,null))[_0x96b1('0x2a')](function(_0x1c008c){if(_0x1c008c){return _0x1c008c[_0x96b1('0x8b')](_0x5cc8c4['body'][_0x96b1('0x6a')],_[_0x96b1('0x8c')](_0x5cc8c4[_0x96b1('0x53')],[_0x96b1('0x6a'),'id'])||{})[_0x96b1('0x8d')](function(_0x23e449){for(var _0x302aff=0x0;_0x302aff<_0x5cc8c4[_0x96b1('0x53')][_0x96b1('0x6a')]['length'];_0x302aff+=0x1){socket[_0x96b1('0x75')]('userOpenchannelQueue:save',{'UserId':Number(_0x5cc8c4['body'][_0x96b1('0x6a')][_0x302aff]),'OpenchannelQueueId':Number(_0x5cc8c4[_0x96b1('0x4e')]['id'])});}return _0x23e449;});}})[_0x96b1('0x2a')](respondWithResult(_0x312934,null))[_0x96b1('0x4c')](handleError(_0x312934,null));};exports[_0x96b1('0x89')]=function(_0x3a09f4,_0x453e25,_0x4699b4){return db[_0x96b1('0x46')][_0x96b1('0x52')]({'where':{'id':_0x3a09f4[_0x96b1('0x4e')]['id']}})[_0x96b1('0x2a')](handleEntityNotFound(_0x453e25,null))[_0x96b1('0x2a')](function(_0x4029c9){if(_0x4029c9){return _0x4029c9[_0x96b1('0x89')](_0x3a09f4[_0x96b1('0x38')][_0x96b1('0x6a')])[_0x96b1('0x2a')](function(){if(_['isArray'](_0x3a09f4[_0x96b1('0x38')][_0x96b1('0x6a')])){for(var _0x25b59b=0x0;_0x25b59b<_0x3a09f4[_0x96b1('0x38')][_0x96b1('0x6a')]['length'];_0x25b59b+=0x1){socket['emit'](_0x96b1('0x8a'),{'UserId':Number(_0x3a09f4[_0x96b1('0x38')][_0x96b1('0x6a')][_0x25b59b]),'OpenchannelQueueId':Number(_0x3a09f4['params']['id'])});}}else{socket[_0x96b1('0x75')](_0x96b1('0x8a'),{'UserId':Number(_0x3a09f4[_0x96b1('0x38')][_0x96b1('0x6a')]),'OpenchannelQueueId':Number(_0x3a09f4[_0x96b1('0x4e')]['id'])});}});}})[_0x96b1('0x2a')](respondWithStatusCode(_0x453e25,null))[_0x96b1('0x4c')](handleError(_0x453e25,null));};exports[_0x96b1('0x8e')]=function(_0x4051ba,_0x360353,_0x505084){var _0x5f4cc6={};var _0xa201e2={};var _0x4dec12;var _0x365b15;return db[_0x96b1('0x46')][_0x96b1('0x5e')]({'where':{'id':_0x4051ba[_0x96b1('0x4e')]['id']}})[_0x96b1('0x2a')](handleEntityNotFound(_0x360353,null))[_0x96b1('0x2a')](function(_0x2a3c1d){if(_0x2a3c1d){_0x4dec12=_0x2a3c1d;_0xa201e2['model']=_[_0x96b1('0x39')](db[_0x96b1('0x77')][_0x96b1('0x33')]);_0xa201e2[_0x96b1('0x38')]=_[_0x96b1('0x39')](_0x4051ba[_0x96b1('0x38')]);_0xa201e2[_0x96b1('0x3a')]=_['intersection'](_0xa201e2[_0x96b1('0x36')],_0xa201e2[_0x96b1('0x38')]);_0x5f4cc6[_0x96b1('0x3c')]=_['intersection'](_0xa201e2['model'],qs[_0x96b1('0x3b')](_0x4051ba[_0x96b1('0x38')][_0x96b1('0x3b')]));_0x5f4cc6['attributes']=_0x5f4cc6[_0x96b1('0x3c')][_0x96b1('0x50')]?_0x5f4cc6['attributes']:_0xa201e2['model'];_0x5f4cc6[_0x96b1('0x3f')]=qs[_0x96b1('0x40')](_0x4051ba[_0x96b1('0x38')]['sort']);_0x5f4cc6[_0x96b1('0x41')]=qs['filters'](_[_0x96b1('0x42')](_0x4051ba[_0x96b1('0x38')],_0xa201e2['filters']));if(_0x4051ba[_0x96b1('0x38')][_0x96b1('0x43')]){_0x5f4cc6[_0x96b1('0x41')]=_[_0x96b1('0x44')](_0x5f4cc6['where'],{'$or':_[_0x96b1('0x37')](_0x5f4cc6[_0x96b1('0x3c')],function(_0x24ab17){var _0x57c415={};_0x57c415[_0x24ab17]={'$like':'%'+_0x4051ba[_0x96b1('0x38')][_0x96b1('0x43')]+'%'};return _0x57c415;})});}_0x5f4cc6=_[_0x96b1('0x44')]({},_0x5f4cc6,_0x4051ba['options']);return _0x4dec12[_0x96b1('0x8e')](_0x5f4cc6);}})['then'](function(_0x175105){if(_0x175105){_0x365b15=_0x175105[_0x96b1('0x50')];if(!_0x4051ba[_0x96b1('0x38')][_0x96b1('0x3d')](_0x96b1('0x3e'))){_0x5f4cc6[_0x96b1('0x23')]=qs[_0x96b1('0x23')](_0x4051ba['query'][_0x96b1('0x23')]);_0x5f4cc6[_0x96b1('0x21')]=qs[_0x96b1('0x21')](_0x4051ba[_0x96b1('0x38')][_0x96b1('0x21')]);}return _0x4dec12[_0x96b1('0x8e')](_0x5f4cc6);}})['then'](function(_0x47ea24){if(_0x47ea24){return _0x47ea24?{'count':_0x365b15,'rows':_0x47ea24}:null;}})[_0x96b1('0x2a')](respondWithResult(_0x360353,null))[_0x96b1('0x4c')](handleError(_0x360353,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 58140e2..1403438 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 _0x47e6=['remove','emit','hasOwnProperty','hook','exports','events','OpenchannelQueue','setMaxListeners','save'];(function(_0x4a8640,_0x12a405){var _0x1d2b5b=function(_0x285224){while(--_0x285224){_0x4a8640['push'](_0x4a8640['shift']());}};_0x1d2b5b(++_0x12a405);}(_0x47e6,0x101));var _0x647e=function(_0x2ce9e2,_0x3a6117){_0x2ce9e2=_0x2ce9e2-0x0;var _0x1ed61b=_0x47e6[_0x2ce9e2];return _0x1ed61b;};'use strict';var EventEmitter=require(_0x647e('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x647e('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x647e('0x2')](0x0);var events={'afterCreate':_0x647e('0x3'),'afterUpdate':'update','afterDestroy':_0x647e('0x4')};function emitEvent(_0x3386e5){return function(_0x3b0bbb,_0x3cc0e2,_0x237253){OpenchannelQueueEvents[_0x647e('0x5')](_0x3386e5+':'+_0x3b0bbb['id'],_0x3b0bbb);OpenchannelQueueEvents[_0x647e('0x5')](_0x3386e5,_0x3b0bbb);_0x237253(null);};}for(var e in events){if(events[_0x647e('0x6')](e)){var event=events[e];OpenchannelQueue[_0x647e('0x7')](e,emitEvent(event));}}module[_0x647e('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x99de=['hasOwnProperty','hook','exports','events','OpenchannelQueue','save','update','remove','emit'];(function(_0x2ded68,_0x2c2681){var _0x30bcf5=function(_0x19d055){while(--_0x19d055){_0x2ded68['push'](_0x2ded68['shift']());}};_0x30bcf5(++_0x2c2681);}(_0x99de,0x8a));var _0xe99d=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0x99de[_0x47242d];return _0x30273a;};'use strict';var EventEmitter=require(_0xe99d('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xe99d('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe99d('0x2'),'afterUpdate':_0xe99d('0x3'),'afterDestroy':_0xe99d('0x4')};function emitEvent(_0xdc702b){return function(_0x4b068f,_0x341c36,_0x1a1147){OpenchannelQueueEvents[_0xe99d('0x5')](_0xdc702b+':'+_0x4b068f['id'],_0x4b068f);OpenchannelQueueEvents[_0xe99d('0x5')](_0xdc702b,_0x4b068f);_0x1a1147(null);};}for(var e in events){if(events[_0xe99d('0x6')](e)){var event=events[e];OpenchannelQueue[_0xe99d('0x7')](e,emitEvent(event));}}module[_0xe99d('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 0cc8ff6..310cfe1 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 _0x3158=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','OpenchannelQueue','openchannel_queues'];(function(_0x3d19ef,_0x55edf8){var _0x2e5a0a=function(_0x282155){while(--_0x282155){_0x3d19ef['push'](_0x3d19ef['shift']());}};_0x2e5a0a(++_0x55edf8);}(_0x3158,0xf2));var _0x8315=function(_0x414700,_0x4f4a4f){_0x414700=_0x414700-0x0;var _0x3d7d76=_0x3158[_0x414700];return _0x3d7d76;};'use strict';var _=require(_0x8315('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8315('0x1'));var moment=require(_0x8315('0x2'));var BPromise=require(_0x8315('0x3'));var rp=require(_0x8315('0x4'));var fs=require('fs');var path=require(_0x8315('0x5'));var rimraf=require(_0x8315('0x6'));var config=require(_0x8315('0x7'));var attributes=require(_0x8315('0x8'));module['exports']=function(_0x8e2ea4,_0x3626f0){return _0x8e2ea4['define'](_0x8315('0x9'),attributes,{'tableName':_0x8315('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d5c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api'];(function(_0xbadd74,_0x1fc913){var _0x4f0b02=function(_0x282855){while(--_0x282855){_0xbadd74['push'](_0xbadd74['shift']());}};_0x4f0b02(++_0x1fc913);}(_0x5d5c,0xbf));var _0xc5d5=function(_0x3be189,_0x16014f){_0x3be189=_0x3be189-0x0;var _0x3f8895=_0x5d5c[_0x3be189];return _0x3f8895;};'use strict';var _=require(_0xc5d5('0x0'));var util=require(_0xc5d5('0x1'));var logger=require(_0xc5d5('0x2'))(_0xc5d5('0x3'));var moment=require(_0xc5d5('0x4'));var BPromise=require(_0xc5d5('0x5'));var rp=require(_0xc5d5('0x6'));var fs=require('fs');var path=require(_0xc5d5('0x7'));var rimraf=require(_0xc5d5('0x8'));var config=require(_0xc5d5('0x9'));var attributes=require(_0xc5d5('0xa'));module[_0xc5d5('0xb')]=function(_0x19da75,_0x31ac51){return _0x19da75[_0xc5d5('0xc')](_0xc5d5('0xd'),attributes,{'tableName':_0xc5d5('0xe'),'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 2b61c71..de8f6e7 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 _0x06db=['rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','debug','ShowOpenchannelQueue','find','raw','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x5a04c4,_0x5beaad){var _0xcc9e8f=function(_0x33fd88){while(--_0x33fd88){_0x5a04c4['push'](_0x5a04c4['shift']());}};_0xcc9e8f(++_0x5beaad);}(_0x06db,0x119));var _0xb06d=function(_0x550be2,_0xebbcd5){_0x550be2=_0x550be2-0x0;var _0x1f05dd=_0x06db[_0x550be2];return _0x1f05dd;};'use strict';var _=require(_0xb06d('0x0'));var util=require('util');var moment=require(_0xb06d('0x1'));var BPromise=require(_0xb06d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb06d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb06d('0x4'));var logger=require(_0xb06d('0x5'))(_0xb06d('0x6'));var config=require('../../config/environment');var jayson=require(_0xb06d('0x7'));var client=jayson[_0xb06d('0x8')][_0xb06d('0x9')]({'port':0x232a});config['redis']=_[_0xb06d('0xa')](config[_0xb06d('0xb')],{'host':_0xb06d('0xc'),'port':0x18eb});var socket=require(_0xb06d('0xd'))(new Redis(config['redis']));require(_0xb06d('0xe'))['register'](socket);function respondWithRpcPromise(_0x1341e4,_0x26cc77,_0x14f3cd){return new BPromise(function(_0xb0cec,_0x26a6ea){return client[_0xb06d('0xf')](_0x1341e4,_0x14f3cd)[_0xb06d('0x10')](function(_0x137ec8){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x26cc77,_0xb06d('0x11'));logger['debug'](_0xb06d('0x12'),_0x26cc77,'request\x20sent',JSON[_0xb06d('0x13')](_0x137ec8));if(_0x137ec8[_0xb06d('0x14')]){if(_0x137ec8[_0xb06d('0x14')][_0xb06d('0x15')]===0x1f4){logger['error'](_0xb06d('0x16'),_0x26cc77,_0x137ec8[_0xb06d('0x14')][_0xb06d('0x17')]);return _0x26a6ea(_0x137ec8[_0xb06d('0x14')]['message']);}logger[_0xb06d('0x14')](_0xb06d('0x16'),_0x26cc77,_0x137ec8[_0xb06d('0x14')][_0xb06d('0x17')]);return _0xb0cec(_0x137ec8[_0xb06d('0x14')]['message']);}else{logger[_0xb06d('0x18')](_0xb06d('0x16'),_0x26cc77,_0xb06d('0x11'));_0xb0cec(_0x137ec8[_0xb06d('0x19')][_0xb06d('0x17')]);}})[_0xb06d('0x1a')](function(_0x150259){logger[_0xb06d('0x14')](_0xb06d('0x16'),_0x26cc77,_0x150259);_0x26a6ea(_0x150259);});});}exports[_0xb06d('0x1b')]=function(_0x286b47){var _0x4e16a1=this;return new Promise(function(_0x37c540,_0x4a5710){return db[_0xb06d('0x1c')][_0xb06d('0x1d')]({'raw':_0x286b47[_0xb06d('0x1e')]?_0x286b47['options']['raw']===undefined?!![]:![]:!![],'where':_0x286b47[_0xb06d('0x1e')]?_0x286b47[_0xb06d('0x1e')][_0xb06d('0x1f')]||null:null,'attributes':_0x286b47['options']?_0x286b47[_0xb06d('0x1e')][_0xb06d('0x20')]||null:null,'limit':_0x286b47[_0xb06d('0x1e')]?_0x286b47[_0xb06d('0x1e')][_0xb06d('0x21')]||null:null,'include':_0x286b47[_0xb06d('0x1e')]?_0x286b47['options'][_0xb06d('0x22')]?_[_0xb06d('0x23')](_0x286b47['options'][_0xb06d('0x22')],function(_0x3ebf56){return{'model':db[_0x3ebf56['model']],'as':_0x3ebf56['as'],'attributes':_0x3ebf56['attributes'],'include':_0x3ebf56[_0xb06d('0x22')]?_[_0xb06d('0x23')](_0x3ebf56['include'],function(_0x27c65f){return{'model':db[_0x27c65f[_0xb06d('0x24')]],'as':_0x27c65f['as'],'attributes':_0x27c65f['attributes'],'include':_0x27c65f[_0xb06d('0x22')]?_['map'](_0x27c65f['include'],function(_0x9c9351){return{'model':db[_0x9c9351[_0xb06d('0x24')]],'as':_0x9c9351['as'],'attributes':_0x9c9351[_0xb06d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34539b){logger[_0xb06d('0x18')](_0xb06d('0x1b'),_0x286b47);logger[_0xb06d('0x25')]('GetOpenchannelQueue',_0x286b47,JSON[_0xb06d('0x13')](_0x34539b));_0x37c540(_0x34539b);})['catch'](function(_0x42447c){logger[_0xb06d('0x14')](_0xb06d('0x1b'),_0x42447c[_0xb06d('0x17')],_0x286b47);_0x4a5710(_0x4e16a1[_0xb06d('0x14')](0x1f4,_0x42447c[_0xb06d('0x17')]));});});};exports[_0xb06d('0x26')]=function(_0x593c25){var _0xf881b0=this;return new Promise(function(_0x43d0b9,_0x13d365){return db['OpenchannelQueue'][_0xb06d('0x27')]({'raw':_0x593c25[_0xb06d('0x1e')]?_0x593c25[_0xb06d('0x1e')][_0xb06d('0x28')]===undefined?!![]:![]:!![],'where':_0x593c25[_0xb06d('0x1e')]?_0x593c25[_0xb06d('0x1e')][_0xb06d('0x1f')]||null:null,'attributes':_0x593c25[_0xb06d('0x1e')]?_0x593c25['options'][_0xb06d('0x20')]||null:null,'include':_0x593c25[_0xb06d('0x1e')]?_0x593c25['options'][_0xb06d('0x22')]?_[_0xb06d('0x23')](_0x593c25[_0xb06d('0x1e')][_0xb06d('0x22')],function(_0x24aa91){return{'model':db[_0x24aa91[_0xb06d('0x24')]],'as':_0x24aa91['as'],'attributes':_0x24aa91['attributes'],'include':_0x24aa91[_0xb06d('0x22')]?_[_0xb06d('0x23')](_0x24aa91[_0xb06d('0x22')],function(_0x48e8c1){return{'model':db[_0x48e8c1['model']],'as':_0x48e8c1['as'],'attributes':_0x48e8c1[_0xb06d('0x20')],'include':_0x48e8c1['include']?_[_0xb06d('0x23')](_0x48e8c1[_0xb06d('0x22')],function(_0x22b166){return{'model':db[_0x22b166['model']],'as':_0x22b166['as'],'attributes':_0x22b166['attributes']};}):[]};}):[]};}):[]:[]})[_0xb06d('0x10')](function(_0x5db130){logger['info'](_0xb06d('0x26'),_0x593c25);logger[_0xb06d('0x25')](_0xb06d('0x26'),_0x593c25,JSON[_0xb06d('0x13')](_0x5db130));_0x43d0b9(_0x5db130);})[_0xb06d('0x1a')](function(_0x51bdec){logger['error']('ShowOpenchannelQueue',_0x51bdec[_0xb06d('0x17')],_0x593c25);_0x13d365(_0xf881b0[_0xb06d('0x14')](0x1f4,_0x51bdec[_0xb06d('0x17')]));});});}; \ No newline at end of file +var _0x107f=['include','map','model','catch','find','ShowOpenchannelQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelQueue,\x20%s,\x20%s','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x107f,0x15c));var _0xf107=function(_0x19463e,_0xa54aca){_0x19463e=_0x19463e-0x0;var _0x436e34=_0x107f[_0x19463e];return _0x436e34;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf107('0x0'));var BPromise=require(_0xf107('0x1'));var rs=require(_0xf107('0x2'));var fs=require('fs');var Redis=require(_0xf107('0x3'));var db=require(_0xf107('0x4'))['db'];var utils=require(_0xf107('0x5'));var logger=require('../../config/logger')(_0xf107('0x6'));var config=require('../../config/environment');var jayson=require(_0xf107('0x7'));var client=jayson[_0xf107('0x8')]['http']({'port':0x232a});config['redis']=_[_0xf107('0x9')](config[_0xf107('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf107('0xa')]));require(_0xf107('0xb'))[_0xf107('0xc')](socket);function respondWithRpcPromise(_0x55352a,_0x4f65b5,_0x464209){return new BPromise(function(_0x4b0f7d,_0x29a27e){return client[_0xf107('0xd')](_0x55352a,_0x464209)[_0xf107('0xe')](function(_0x42763a){logger[_0xf107('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x4f65b5,_0xf107('0x10'));logger[_0xf107('0x11')](_0xf107('0x12'),_0x4f65b5,_0xf107('0x10'),JSON[_0xf107('0x13')](_0x42763a));if(_0x42763a['error']){if(_0x42763a[_0xf107('0x14')]['code']===0x1f4){logger[_0xf107('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x4f65b5,_0x42763a['error'][_0xf107('0x15')]);return _0x29a27e(_0x42763a[_0xf107('0x14')][_0xf107('0x15')]);}logger['error'](_0xf107('0x16'),_0x4f65b5,_0x42763a[_0xf107('0x14')][_0xf107('0x15')]);return _0x4b0f7d(_0x42763a[_0xf107('0x14')][_0xf107('0x15')]);}else{logger[_0xf107('0xf')](_0xf107('0x16'),_0x4f65b5,_0xf107('0x10'));_0x4b0f7d(_0x42763a[_0xf107('0x17')]['message']);}})['catch'](function(_0xc04a32){logger['error'](_0xf107('0x16'),_0x4f65b5,_0xc04a32);_0x29a27e(_0xc04a32);});});}exports[_0xf107('0x18')]=function(_0x11be01){var _0x46535b=this;return new Promise(function(_0x5cc548,_0x298380){return db[_0xf107('0x19')][_0xf107('0x1a')]({'raw':_0x11be01['options']?_0x11be01[_0xf107('0x1b')][_0xf107('0x1c')]===undefined?!![]:![]:!![],'where':_0x11be01[_0xf107('0x1b')]?_0x11be01[_0xf107('0x1b')][_0xf107('0x1d')]||null:null,'attributes':_0x11be01['options']?_0x11be01[_0xf107('0x1b')][_0xf107('0x1e')]||null:null,'limit':_0x11be01['options']?_0x11be01[_0xf107('0x1b')][_0xf107('0x1f')]||null:null,'include':_0x11be01[_0xf107('0x1b')]?_0x11be01[_0xf107('0x1b')][_0xf107('0x20')]?_[_0xf107('0x21')](_0x11be01[_0xf107('0x1b')][_0xf107('0x20')],function(_0x10f460){return{'model':db[_0x10f460[_0xf107('0x22')]],'as':_0x10f460['as'],'attributes':_0x10f460[_0xf107('0x1e')],'include':_0x10f460[_0xf107('0x20')]?_[_0xf107('0x21')](_0x10f460[_0xf107('0x20')],function(_0x1c0c4a){return{'model':db[_0x1c0c4a[_0xf107('0x22')]],'as':_0x1c0c4a['as'],'attributes':_0x1c0c4a['attributes'],'include':_0x1c0c4a[_0xf107('0x20')]?_[_0xf107('0x21')](_0x1c0c4a[_0xf107('0x20')],function(_0x4841de){return{'model':db[_0x4841de['model']],'as':_0x4841de['as'],'attributes':_0x4841de['attributes']};}):[]};}):[]};}):[]:[]})[_0xf107('0xe')](function(_0x3547d1){logger[_0xf107('0xf')]('GetOpenchannelQueue',_0x11be01);logger[_0xf107('0x11')](_0xf107('0x18'),_0x11be01,JSON[_0xf107('0x13')](_0x3547d1));_0x5cc548(_0x3547d1);})[_0xf107('0x23')](function(_0x5a8716){logger[_0xf107('0x14')](_0xf107('0x18'),_0x5a8716[_0xf107('0x15')],_0x11be01);_0x298380(_0x46535b[_0xf107('0x14')](0x1f4,_0x5a8716['message']));});});};exports['ShowOpenchannelQueue']=function(_0x45737d){var _0x17f24d=this;return new Promise(function(_0x1dd364,_0x2c3c15){return db[_0xf107('0x19')][_0xf107('0x24')]({'raw':_0x45737d[_0xf107('0x1b')]?_0x45737d[_0xf107('0x1b')][_0xf107('0x1c')]===undefined?!![]:![]:!![],'where':_0x45737d[_0xf107('0x1b')]?_0x45737d['options']['where']||null:null,'attributes':_0x45737d['options']?_0x45737d[_0xf107('0x1b')]['attributes']||null:null,'include':_0x45737d[_0xf107('0x1b')]?_0x45737d[_0xf107('0x1b')][_0xf107('0x20')]?_['map'](_0x45737d['options'][_0xf107('0x20')],function(_0x12d9a0){return{'model':db[_0x12d9a0[_0xf107('0x22')]],'as':_0x12d9a0['as'],'attributes':_0x12d9a0[_0xf107('0x1e')],'include':_0x12d9a0['include']?_['map'](_0x12d9a0[_0xf107('0x20')],function(_0x19cc86){return{'model':db[_0x19cc86['model']],'as':_0x19cc86['as'],'attributes':_0x19cc86[_0xf107('0x1e')],'include':_0x19cc86[_0xf107('0x20')]?_[_0xf107('0x21')](_0x19cc86[_0xf107('0x20')],function(_0x56ef3e){return{'model':db[_0x56ef3e['model']],'as':_0x56ef3e['as'],'attributes':_0x56ef3e[_0xf107('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf107('0xe')](function(_0x593551){logger[_0xf107('0xf')](_0xf107('0x25'),_0x45737d);logger['debug'](_0xf107('0x25'),_0x45737d,JSON[_0xf107('0x13')](_0x593551));_0x1dd364(_0x593551);})[_0xf107('0x23')](function(_0x2fdaa9){logger[_0xf107('0x14')](_0xf107('0x25'),_0x2fdaa9[_0xf107('0x15')],_0x45737d);_0x2c3c15(_0x17f24d[_0xf107('0x14')](0x1f4,_0x2fdaa9[_0xf107('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index eec880b..07ad167 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 _0xdd9f=['length','openchannelQueue:','./openchannelQueue.events','save','update','register'];(function(_0x51e8c3,_0x4d6f47){var _0x1e9467=function(_0x509a57){while(--_0x509a57){_0x51e8c3['push'](_0x51e8c3['shift']());}};_0x1e9467(++_0x4d6f47);}(_0xdd9f,0x1ca));var _0xfdd9=function(_0x34a8c8,_0x31e259){_0x34a8c8=_0x34a8c8-0x0;var _0x1fe6e5=_0xdd9f[_0x34a8c8];return _0x1fe6e5;};'use strict';var OpenchannelQueueEvents=require(_0xfdd9('0x0'));var events=[_0xfdd9('0x1'),'remove',_0xfdd9('0x2')];function createListener(_0x30af06,_0x1122c4){return function(_0x50283b){_0x1122c4['emit'](_0x30af06,_0x50283b);};}function removeListener(_0x56b0c6,_0x3f8b62){return function(){OpenchannelQueueEvents['removeListener'](_0x56b0c6,_0x3f8b62);};}exports[_0xfdd9('0x3')]=function(_0xfef544){for(var _0x1e8433=0x0,_0x41fa53=events[_0xfdd9('0x4')];_0x1e8433<_0x41fa53;_0x1e8433++){var _0x77f0f5=events[_0x1e8433];var _0x159884=createListener(_0xfdd9('0x5')+_0x77f0f5,_0xfef544);OpenchannelQueueEvents['on'](_0x77f0f5,_0x159884);}}; \ No newline at end of file +var _0x45d6=['emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x45d6,0x176));var _0x645d=function(_0x1b3cc9,_0x236986){_0x1b3cc9=_0x1b3cc9-0x0;var _0xc96cd1=_0x45d6[_0x1b3cc9];return _0xc96cd1;};'use strict';var OpenchannelQueueEvents=require(_0x645d('0x0'));var events=[_0x645d('0x1'),_0x645d('0x2'),_0x645d('0x3')];function createListener(_0x18ed7d,_0x1af57a){return function(_0x3ed5dc){_0x1af57a[_0x645d('0x4')](_0x18ed7d,_0x3ed5dc);};}function removeListener(_0x56ac81,_0x4fb78e){return function(){OpenchannelQueueEvents[_0x645d('0x5')](_0x56ac81,_0x4fb78e);};}exports[_0x645d('0x6')]=function(_0x19ab10){for(var _0x9c28a0=0x0,_0x23eded=events[_0x645d('0x7')];_0x9c28a0<_0x23eded;_0x9c28a0++){var _0x250f35=events[_0x9c28a0];var _0xdfc96=createListener(_0x645d('0x8')+_0x250f35,_0x19ab10);OpenchannelQueueEvents['on'](_0x250f35,_0xdfc96);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 1c12e9e..f1aea5b 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 _0x7a58=['put','/:id','update','delete','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','isAuthenticated','get','/describe','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a58,0xf5));var _0x87a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a58[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x87a5('0x0'));var util=require(_0x87a5('0x1'));var path=require(_0x87a5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x87a5('0x3')]();var fs_extra=require(_0x87a5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x87a5('0x5'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0x87a5('0x6')](),controller['index']);router[_0x87a5('0x7')](_0x87a5('0x8'),auth[_0x87a5('0x6')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x87a5('0x9')]);router['post']('/',auth[_0x87a5('0x6')](),controller['create']);router[_0x87a5('0xa')](_0x87a5('0xb'),auth['isAuthenticated'](),controller[_0x87a5('0xc')]);router[_0x87a5('0xd')]('/:id',auth[_0x87a5('0x6')](),controller['destroy']);module[_0x87a5('0xe')]=router; \ No newline at end of file +var _0xf21f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x412626,_0x1ab9b0){var _0x2e8e57=function(_0xef39da){while(--_0xef39da){_0x412626['push'](_0x412626['shift']());}};_0x2e8e57(++_0x1ab9b0);}(_0xf21f,0x11b));var _0xff21=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0xf21f[_0x445101];return _0x3c3d04;};'use strict';var multer=require('multer');var util=require(_0xff21('0x0'));var path=require(_0xff21('0x1'));var timeout=require(_0xff21('0x2'));var express=require(_0xff21('0x3'));var router=express[_0xff21('0x4')]();var fs_extra=require(_0xff21('0x5'));var auth=require(_0xff21('0x6'));var interaction=require(_0xff21('0x7'));var config=require(_0xff21('0x8'));var controller=require(_0xff21('0x9'));router[_0xff21('0xa')]('/',auth['isAuthenticated'](),controller[_0xff21('0xb')]);router[_0xff21('0xa')](_0xff21('0xc'),auth[_0xff21('0xd')](),controller[_0xff21('0xe')]);router[_0xff21('0xa')](_0xff21('0xf'),auth[_0xff21('0xd')](),controller[_0xff21('0x10')]);router[_0xff21('0x11')]('/',auth[_0xff21('0xd')](),controller['create']);router[_0xff21('0x12')](_0xff21('0xf'),auth[_0xff21('0xd')](),controller[_0xff21('0x13')]);router['delete'](_0xff21('0xf'),auth[_0xff21('0xd')](),controller[_0xff21('0x14')]);module[_0xff21('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 546f038..7f81751 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 _0x77a9=['sequelize','STRING','DATE','moment'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0x77a9,0x103));var _0x977a=function(_0x35ee71,_0x451b80){_0x35ee71=_0x35ee71-0x0;var _0x1b3f84=_0x77a9[_0x35ee71];return _0x1b3f84;};'use strict';var moment=require(_0x977a('0x0'));var Sequelize=require(_0x977a('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x977a('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x977a('0x3')]},'acceptAt':{'type':Sequelize[_0x977a('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x977a('0x2')]}}; \ No newline at end of file +var _0xc608=['DATE','sequelize','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc608,0x1c9));var _0x8c60=function(_0x280fea,_0xfd6aad){_0x280fea=_0x280fea-0x0;var _0x2884a3=_0xc608[_0x280fea];return _0x2884a3;};'use strict';var moment=require('moment');var Sequelize=require(_0x8c60('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8c60('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8c60('0x2')]},'leaveAt':{'type':Sequelize[_0x8c60('0x2')]},'acceptAt':{'type':Sequelize[_0x8c60('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8c60('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 12fab4c..05ae670 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 _0x1c23=['sort','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','find','create','body','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','update','destroy','then','end','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','type','query','filters','intersection','model','attributes','fields','length','order'];(function(_0xdb2b6b,_0x2eea2c){var _0x4b337e=function(_0x452b7d){while(--_0x452b7d){_0xdb2b6b['push'](_0xdb2b6b['shift']());}};_0x4b337e(++_0x2eea2c);}(_0x1c23,0x168));var _0x31c2=function(_0x4dabcb,_0x3509a0){_0x4dabcb=_0x4dabcb-0x0;var _0x7b3bbd=_0x1c23[_0x4dabcb];return _0x7b3bbd;};'use strict';var emlformat=require(_0x31c2('0x0'));var rimraf=require(_0x31c2('0x1'));var zipdir=require(_0x31c2('0x2'));var jsonpatch=require(_0x31c2('0x3'));var rp=require(_0x31c2('0x4'));var moment=require(_0x31c2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x31c2('0x6'));var util=require(_0x31c2('0x7'));var path=require(_0x31c2('0x8'));var sox=require(_0x31c2('0x9'));var csv=require(_0x31c2('0xa'));var ejs=require(_0x31c2('0xb'));var fs=require('fs');var fs_extra=require(_0x31c2('0xc'));var _=require(_0x31c2('0xd'));var squel=require(_0x31c2('0xe'));var crypto=require(_0x31c2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x31c2('0x10'));var toCsv=require(_0x31c2('0xa'));var querystring=require('querystring');var Papa=require(_0x31c2('0x11'));var Redis=require(_0x31c2('0x12'));var authService=require(_0x31c2('0x13'));var qs=require(_0x31c2('0x14'));var as=require(_0x31c2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x31c2('0x16'));var utils=require('../../config/utils');var config=require(_0x31c2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x31c2('0x18'))['db'];function respondWithStatusCode(_0x3d4e73,_0x356f43){_0x356f43=_0x356f43||0xcc;return function(_0x430fcd){if(_0x430fcd){return _0x3d4e73[_0x31c2('0x19')](_0x356f43);}return _0x3d4e73[_0x31c2('0x1a')](_0x356f43)['end']();};}function respondWithResult(_0x234991,_0xfbe09a){_0xfbe09a=_0xfbe09a||0xc8;return function(_0x57071c){if(_0x57071c){return _0x234991[_0x31c2('0x1a')](_0xfbe09a)[_0x31c2('0x1b')](_0x57071c);}};}function respondWithFilteredResult(_0x1bc20e,_0x431f38){return function(_0x349c0b){if(_0x349c0b){var _0x16f6be=typeof _0x431f38[_0x31c2('0x1c')]===_0x31c2('0x1d')&&typeof _0x431f38[_0x31c2('0x1e')]===_0x31c2('0x1d');var _0x1ba1b9=_0x349c0b[_0x31c2('0x1f')];var _0x190b1d=_0x16f6be?0x0:_0x431f38[_0x31c2('0x1c')];var _0x3f0f99=_0x16f6be?_0x349c0b['count']:_0x431f38[_0x31c2('0x1c')]+_0x431f38[_0x31c2('0x1e')];var _0x1d51ee;if(_0x3f0f99>=_0x1ba1b9){_0x3f0f99=_0x1ba1b9;_0x1d51ee=0xc8;}else{_0x1d51ee=0xce;}_0x1bc20e[_0x31c2('0x1a')](_0x1d51ee);return _0x1bc20e[_0x31c2('0x20')]('Content-Range',_0x190b1d+'-'+_0x3f0f99+'/'+_0x1ba1b9)[_0x31c2('0x1b')](_0x349c0b);}return null;};}function patchUpdates(_0x14d603){return function(_0x328792){try{jsonpatch['apply'](_0x328792,_0x14d603,!![]);}catch(_0x37f1b7){return BPromise['reject'](_0x37f1b7);}return _0x328792['save']();};}function saveUpdates(_0xfa9ab8,_0x2a0c95){return function(_0x3e06b9){if(_0x3e06b9){return _0x3e06b9[_0x31c2('0x21')](_0xfa9ab8)['then'](function(_0x5595ae){return _0x5595ae;});}return null;};}function removeEntity(_0x47b4a3,_0x9f0b68){return function(_0xdd0081){if(_0xdd0081){return _0xdd0081[_0x31c2('0x22')]()[_0x31c2('0x23')](function(){_0x47b4a3[_0x31c2('0x1a')](0xcc)[_0x31c2('0x24')]();});}};}function handleEntityNotFound(_0x11ecd2,_0x4418ef){return function(_0x317bb3){if(!_0x317bb3){_0x11ecd2[_0x31c2('0x19')](0x194);}return _0x317bb3;};}function handleError(_0x1e3b31,_0x8b34af){_0x8b34af=_0x8b34af||0x1f4;return function(_0x690280){logger[_0x31c2('0x25')](_0x690280[_0x31c2('0x26')]);if(_0x690280[_0x31c2('0x27')]){delete _0x690280[_0x31c2('0x27')];}_0x1e3b31['status'](_0x8b34af)[_0x31c2('0x28')](_0x690280);};}exports[_0x31c2('0x29')]=function(_0x57526a,_0x15341d){var _0x57cb05={},_0x138bf5={},_0x50e0c2={'count':0x0,'rows':[]};var _0x2740ad=_[_0x31c2('0x2a')](db[_0x31c2('0x2b')][_0x31c2('0x2c')],function(_0x3686af){return{'name':_0x3686af['fieldName'],'type':_0x3686af[_0x31c2('0x2d')]['key']};});_0x138bf5['model']=_[_0x31c2('0x2a')](_0x2740ad,_0x31c2('0x27'));_0x138bf5[_0x31c2('0x2e')]=_['keys'](_0x57526a['query']);_0x138bf5[_0x31c2('0x2f')]=_[_0x31c2('0x30')](_0x138bf5[_0x31c2('0x31')],_0x138bf5[_0x31c2('0x2e')]);_0x57cb05[_0x31c2('0x32')]=_['intersection'](_0x138bf5[_0x31c2('0x31')],qs[_0x31c2('0x33')](_0x57526a['query'][_0x31c2('0x33')]));_0x57cb05[_0x31c2('0x32')]=_0x57cb05[_0x31c2('0x32')][_0x31c2('0x34')]?_0x57cb05['attributes']:_0x138bf5[_0x31c2('0x31')];if(!_0x57526a['query']['hasOwnProperty']('nolimit')){_0x57cb05[_0x31c2('0x1e')]=qs[_0x31c2('0x1e')](_0x57526a['query'][_0x31c2('0x1e')]);_0x57cb05[_0x31c2('0x1c')]=qs[_0x31c2('0x1c')](_0x57526a['query'][_0x31c2('0x1c')]);}_0x57cb05[_0x31c2('0x35')]=qs[_0x31c2('0x36')](_0x57526a['query'][_0x31c2('0x36')]);_0x57cb05['where']=qs[_0x31c2('0x2f')](_['pick'](_0x57526a[_0x31c2('0x2e')],_0x138bf5['filters']),_0x2740ad);if(_0x57526a[_0x31c2('0x2e')][_0x31c2('0x37')]){_0x57cb05[_0x31c2('0x38')]=_[_0x31c2('0x39')](_0x57cb05[_0x31c2('0x38')],{'$or':_[_0x31c2('0x2a')](_0x2740ad,function(_0x315bf2){if(_0x315bf2[_0x31c2('0x2d')]!==_0x31c2('0x3a')){var _0x41b2af={};_0x41b2af[_0x315bf2[_0x31c2('0x27')]]={'$like':'%'+_0x57526a['query'][_0x31c2('0x37')]+'%'};return _0x41b2af;}})});}_0x57cb05=_[_0x31c2('0x39')]({},_0x57cb05,_0x57526a['options']);var _0x1ba057={'where':_0x57cb05[_0x31c2('0x38')]};return db[_0x31c2('0x2b')][_0x31c2('0x1f')](_0x1ba057)[_0x31c2('0x23')](function(_0x59cc41){_0x50e0c2[_0x31c2('0x1f')]=_0x59cc41;if(_0x57526a[_0x31c2('0x2e')][_0x31c2('0x3b')]){_0x57cb05['include']=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x57cb05);})[_0x31c2('0x23')](function(_0x54ba24){_0x50e0c2[_0x31c2('0x3c')]=_0x54ba24;return _0x50e0c2;})['then'](respondWithFilteredResult(_0x15341d,_0x57cb05))[_0x31c2('0x3d')](handleError(_0x15341d,null));};exports[_0x31c2('0x3e')]=function(_0x2ed59a,_0xaffa71){var _0x343ceb={'raw':!![],'where':{'id':_0x2ed59a[_0x31c2('0x3f')]['id']}},_0x4d9b6e={};_0x4d9b6e['model']=_[_0x31c2('0x40')](db[_0x31c2('0x2b')][_0x31c2('0x2c')]);_0x4d9b6e[_0x31c2('0x2e')]=_['keys'](_0x2ed59a[_0x31c2('0x2e')]);_0x4d9b6e[_0x31c2('0x2f')]=_['intersection'](_0x4d9b6e[_0x31c2('0x31')],_0x4d9b6e[_0x31c2('0x2e')]);_0x343ceb[_0x31c2('0x32')]=_['intersection'](_0x4d9b6e[_0x31c2('0x31')],qs[_0x31c2('0x33')](_0x2ed59a[_0x31c2('0x2e')][_0x31c2('0x33')]));_0x343ceb[_0x31c2('0x32')]=_0x343ceb['attributes'][_0x31c2('0x34')]?_0x343ceb['attributes']:_0x4d9b6e[_0x31c2('0x31')];if(_0x2ed59a[_0x31c2('0x2e')][_0x31c2('0x3b')]){_0x343ceb['include']=[{'all':!![]}];}_0x343ceb=_[_0x31c2('0x39')]({},_0x343ceb,_0x2ed59a['options']);return db[_0x31c2('0x2b')][_0x31c2('0x41')](_0x343ceb)[_0x31c2('0x23')](handleEntityNotFound(_0xaffa71,null))['then'](respondWithResult(_0xaffa71,null))['catch'](handleError(_0xaffa71,null));};exports[_0x31c2('0x42')]=function(_0x1ba067,_0xb507c){return db[_0x31c2('0x2b')][_0x31c2('0x42')](_0x1ba067[_0x31c2('0x43')],{})[_0x31c2('0x23')](respondWithResult(_0xb507c,0xc9))[_0x31c2('0x3d')](handleError(_0xb507c,null));};exports[_0x31c2('0x21')]=function(_0x755ad3,_0x55afe4){if(_0x755ad3[_0x31c2('0x43')]['id']){delete _0x755ad3[_0x31c2('0x43')]['id'];}return db[_0x31c2('0x2b')][_0x31c2('0x41')]({'where':{'id':_0x755ad3[_0x31c2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x55afe4,null))[_0x31c2('0x23')](saveUpdates(_0x755ad3[_0x31c2('0x43')],null))['then'](respondWithResult(_0x55afe4,null))['catch'](handleError(_0x55afe4,null));};exports['destroy']=function(_0x191174,_0x885e67){return db[_0x31c2('0x2b')][_0x31c2('0x41')]({'where':{'id':_0x191174[_0x31c2('0x3f')]['id']}})[_0x31c2('0x23')](handleEntityNotFound(_0x885e67,null))[_0x31c2('0x23')](removeEntity(_0x885e67,null))[_0x31c2('0x3d')](handleError(_0x885e67,null));};exports[_0x31c2('0x44')]=function(_0x552433,_0x5557e8){return db[_0x31c2('0x2b')]['describe']()[_0x31c2('0x23')](respondWithResult(_0x5557e8,null))['catch'](handleError(_0x5557e8,null));}; \ No newline at end of file +var _0x4d8d=['hasOwnProperty','sort','filters','pick','filter','merge','options','where','count','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','update','then','destroy','error','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length'];(function(_0x34b471,_0x4a1377){var _0xdd4f7a=function(_0x3b908d){while(--_0x3b908d){_0x34b471['push'](_0x34b471['shift']());}};_0xdd4f7a(++_0x4a1377);}(_0x4d8d,0x9a));var _0xd4d8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4d8d[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xd4d8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd4d8('0x1'));var jsonpatch=require(_0xd4d8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd4d8('0x3'));var Mustache=require(_0xd4d8('0x4'));var util=require(_0xd4d8('0x5'));var path=require(_0xd4d8('0x6'));var sox=require(_0xd4d8('0x7'));var csv=require(_0xd4d8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4d8('0x9'));var _=require(_0xd4d8('0xa'));var squel=require(_0xd4d8('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd4d8('0x8'));var querystring=require(_0xd4d8('0xc'));var Papa=require(_0xd4d8('0xd'));var Redis=require(_0xd4d8('0xe'));var authService=require(_0xd4d8('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd4d8('0x10'));var licenseUtil=require(_0xd4d8('0x11'));var db=require(_0xd4d8('0x12'))['db'];function respondWithStatusCode(_0x1207d8,_0x261bf5){_0x261bf5=_0x261bf5||0xcc;return function(_0x387807){if(_0x387807){return _0x1207d8[_0xd4d8('0x13')](_0x261bf5);}return _0x1207d8[_0xd4d8('0x14')](_0x261bf5)[_0xd4d8('0x15')]();};}function respondWithResult(_0x371e60,_0x2e1f05){_0x2e1f05=_0x2e1f05||0xc8;return function(_0x1947bf){if(_0x1947bf){return _0x371e60[_0xd4d8('0x14')](_0x2e1f05)[_0xd4d8('0x16')](_0x1947bf);}};}function respondWithFilteredResult(_0x446219,_0x2da5be){return function(_0x395c9b){if(_0x395c9b){var _0x2d3a1f=typeof _0x2da5be[_0xd4d8('0x17')]===_0xd4d8('0x18')&&typeof _0x2da5be['limit']===_0xd4d8('0x18');var _0x1bc205=_0x395c9b['count'];var _0x11395d=_0x2d3a1f?0x0:_0x2da5be['offset'];var _0x537e01=_0x2d3a1f?_0x395c9b['count']:_0x2da5be[_0xd4d8('0x17')]+_0x2da5be[_0xd4d8('0x19')];var _0x15ff5d;if(_0x537e01>=_0x1bc205){_0x537e01=_0x1bc205;_0x15ff5d=0xc8;}else{_0x15ff5d=0xce;}_0x446219[_0xd4d8('0x14')](_0x15ff5d);return _0x446219[_0xd4d8('0x1a')]('Content-Range',_0x11395d+'-'+_0x537e01+'/'+_0x1bc205)[_0xd4d8('0x16')](_0x395c9b);}return null;};}function patchUpdates(_0x3d3596){return function(_0x5a1a41){try{jsonpatch[_0xd4d8('0x1b')](_0x5a1a41,_0x3d3596,!![]);}catch(_0xedd639){return BPromise[_0xd4d8('0x1c')](_0xedd639);}return _0x5a1a41['save']();};}function saveUpdates(_0x5c1f4e,_0x4186a5){return function(_0x94b60b){if(_0x94b60b){return _0x94b60b[_0xd4d8('0x1d')](_0x5c1f4e)[_0xd4d8('0x1e')](function(_0x59ee55){return _0x59ee55;});}return null;};}function removeEntity(_0x5244fe,_0x180ee0){return function(_0x3d3461){if(_0x3d3461){return _0x3d3461[_0xd4d8('0x1f')]()[_0xd4d8('0x1e')](function(){_0x5244fe['status'](0xcc)[_0xd4d8('0x15')]();});}};}function handleEntityNotFound(_0x2cc151,_0x119739){return function(_0x526d11){if(!_0x526d11){_0x2cc151[_0xd4d8('0x13')](0x194);}return _0x526d11;};}function handleError(_0x2d5c53,_0x3881c9){_0x3881c9=_0x3881c9||0x1f4;return function(_0x560f2e){logger[_0xd4d8('0x20')](_0x560f2e['stack']);if(_0x560f2e['name']){delete _0x560f2e[_0xd4d8('0x21')];}_0x2d5c53[_0xd4d8('0x14')](_0x3881c9)[_0xd4d8('0x22')](_0x560f2e);};}exports['index']=function(_0x9dfb59,_0x5608a3){var _0x4c898f={},_0x318dfe={},_0xea1325={'count':0x0,'rows':[]};var _0x2f6a38=_[_0xd4d8('0x23')](db[_0xd4d8('0x24')][_0xd4d8('0x25')],function(_0x281b18){return{'name':_0x281b18[_0xd4d8('0x26')],'type':_0x281b18[_0xd4d8('0x27')]['key']};});_0x318dfe['model']=_['map'](_0x2f6a38,_0xd4d8('0x21'));_0x318dfe[_0xd4d8('0x28')]=_[_0xd4d8('0x29')](_0x9dfb59[_0xd4d8('0x28')]);_0x318dfe['filters']=_[_0xd4d8('0x2a')](_0x318dfe[_0xd4d8('0x2b')],_0x318dfe['query']);_0x4c898f[_0xd4d8('0x2c')]=_[_0xd4d8('0x2a')](_0x318dfe[_0xd4d8('0x2b')],qs[_0xd4d8('0x2d')](_0x9dfb59[_0xd4d8('0x28')][_0xd4d8('0x2d')]));_0x4c898f[_0xd4d8('0x2c')]=_0x4c898f['attributes'][_0xd4d8('0x2e')]?_0x4c898f[_0xd4d8('0x2c')]:_0x318dfe[_0xd4d8('0x2b')];if(!_0x9dfb59[_0xd4d8('0x28')][_0xd4d8('0x2f')]('nolimit')){_0x4c898f[_0xd4d8('0x19')]=qs[_0xd4d8('0x19')](_0x9dfb59[_0xd4d8('0x28')][_0xd4d8('0x19')]);_0x4c898f[_0xd4d8('0x17')]=qs[_0xd4d8('0x17')](_0x9dfb59[_0xd4d8('0x28')]['offset']);}_0x4c898f['order']=qs[_0xd4d8('0x30')](_0x9dfb59[_0xd4d8('0x28')][_0xd4d8('0x30')]);_0x4c898f['where']=qs[_0xd4d8('0x31')](_[_0xd4d8('0x32')](_0x9dfb59[_0xd4d8('0x28')],_0x318dfe[_0xd4d8('0x31')]),_0x2f6a38);if(_0x9dfb59[_0xd4d8('0x28')][_0xd4d8('0x33')]){_0x4c898f['where']=_[_0xd4d8('0x34')](_0x4c898f['where'],{'$or':_['map'](_0x2f6a38,function(_0xacd820){if(_0xacd820[_0xd4d8('0x27')]!=='VIRTUAL'){var _0x1f44fe={};_0x1f44fe[_0xacd820[_0xd4d8('0x21')]]={'$like':'%'+_0x9dfb59[_0xd4d8('0x28')][_0xd4d8('0x33')]+'%'};return _0x1f44fe;}})});}_0x4c898f=_[_0xd4d8('0x34')]({},_0x4c898f,_0x9dfb59[_0xd4d8('0x35')]);var _0x4b48ee={'where':_0x4c898f[_0xd4d8('0x36')]};return db[_0xd4d8('0x24')][_0xd4d8('0x37')](_0x4b48ee)['then'](function(_0x3305e0){_0xea1325[_0xd4d8('0x37')]=_0x3305e0;if(_0x9dfb59[_0xd4d8('0x28')][_0xd4d8('0x38')]){_0x4c898f['include']=[{'all':!![]}];}return db[_0xd4d8('0x24')][_0xd4d8('0x39')](_0x4c898f);})[_0xd4d8('0x1e')](function(_0x5d3328){_0xea1325[_0xd4d8('0x3a')]=_0x5d3328;return _0xea1325;})['then'](respondWithFilteredResult(_0x5608a3,_0x4c898f))[_0xd4d8('0x3b')](handleError(_0x5608a3,null));};exports[_0xd4d8('0x3c')]=function(_0x1ee81b,_0x20638e){var _0x3fd5ca={'raw':!![],'where':{'id':_0x1ee81b[_0xd4d8('0x3d')]['id']}},_0x511afc={};_0x511afc[_0xd4d8('0x2b')]=_['keys'](db[_0xd4d8('0x24')][_0xd4d8('0x25')]);_0x511afc[_0xd4d8('0x28')]=_[_0xd4d8('0x29')](_0x1ee81b['query']);_0x511afc['filters']=_['intersection'](_0x511afc['model'],_0x511afc[_0xd4d8('0x28')]);_0x3fd5ca['attributes']=_['intersection'](_0x511afc[_0xd4d8('0x2b')],qs[_0xd4d8('0x2d')](_0x1ee81b[_0xd4d8('0x28')][_0xd4d8('0x2d')]));_0x3fd5ca[_0xd4d8('0x2c')]=_0x3fd5ca['attributes']['length']?_0x3fd5ca[_0xd4d8('0x2c')]:_0x511afc['model'];if(_0x1ee81b[_0xd4d8('0x28')][_0xd4d8('0x38')]){_0x3fd5ca[_0xd4d8('0x3e')]=[{'all':!![]}];}_0x3fd5ca=_[_0xd4d8('0x34')]({},_0x3fd5ca,_0x1ee81b['options']);return db[_0xd4d8('0x24')]['find'](_0x3fd5ca)[_0xd4d8('0x1e')](handleEntityNotFound(_0x20638e,null))[_0xd4d8('0x1e')](respondWithResult(_0x20638e,null))[_0xd4d8('0x3b')](handleError(_0x20638e,null));};exports[_0xd4d8('0x3f')]=function(_0x2feb25,_0x411f7f){return db[_0xd4d8('0x24')]['create'](_0x2feb25[_0xd4d8('0x40')],{})[_0xd4d8('0x1e')](respondWithResult(_0x411f7f,0xc9))[_0xd4d8('0x3b')](handleError(_0x411f7f,null));};exports['update']=function(_0x301129,_0x1194fc){if(_0x301129[_0xd4d8('0x40')]['id']){delete _0x301129[_0xd4d8('0x40')]['id'];}return db[_0xd4d8('0x24')][_0xd4d8('0x41')]({'where':{'id':_0x301129[_0xd4d8('0x3d')]['id']}})[_0xd4d8('0x1e')](handleEntityNotFound(_0x1194fc,null))[_0xd4d8('0x1e')](saveUpdates(_0x301129[_0xd4d8('0x40')],null))['then'](respondWithResult(_0x1194fc,null))[_0xd4d8('0x3b')](handleError(_0x1194fc,null));};exports['destroy']=function(_0x4d7ad2,_0x21b86f){return db[_0xd4d8('0x24')]['find']({'where':{'id':_0x4d7ad2[_0xd4d8('0x3d')]['id']}})[_0xd4d8('0x1e')](handleEntityNotFound(_0x21b86f,null))[_0xd4d8('0x1e')](removeEntity(_0x21b86f,null))['catch'](handleError(_0x21b86f,null));};exports[_0xd4d8('0x42')]=function(_0x352a74,_0x39d341){return db[_0xd4d8('0x24')][_0xd4d8('0x42')]()[_0xd4d8('0x1e')](respondWithResult(_0x39d341,null))[_0xd4d8('0x3b')](handleError(_0x39d341,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 2b1eabd..911256b 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x421320,_0x4ece55){var _0x55150f=function(_0x5c657f){while(--_0x5c657f){_0x421320['push'](_0x421320['shift']());}};_0x55150f(++_0x4ece55);}(_0x326f,0xd1));var _0xf326=function(_0xd58433,_0x469ed3){_0xd58433=_0xd58433-0x0;var _0x3c9a7a=_0x326f[_0xd58433];return _0x3c9a7a;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x137a2d,_0x4fc1ba){var _0x100036=function(_0x4e8d9f){while(--_0x4e8d9f){_0x137a2d['push'](_0x137a2d['shift']());}};_0x100036(++_0x4fc1ba);}(_0x5fc3,0xa8));var _0x35fc=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0x5fc3[_0x425716];return _0x2d39af;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 39b37a5..82bacb8 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 _0xb98e=['client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x51a3cb,_0x154234){var _0x3170a0=function(_0x4e1cd5){while(--_0x4e1cd5){_0x51a3cb['push'](_0x51a3cb['shift']());}};_0x3170a0(++_0x154234);}(_0xb98e,0x184));var _0xeb98=function(_0x5f1289,_0xa11429){_0x5f1289=_0x5f1289-0x0;var _0x46f65b=_0xb98e[_0x5f1289];return _0x46f65b;};'use strict';var _=require(_0xeb98('0x0'));var util=require(_0xeb98('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeb98('0x2'));var fs=require('fs');var Redis=require(_0xeb98('0x3'));var db=require(_0xeb98('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb98('0x5'))(_0xeb98('0x6'));var config=require(_0xeb98('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeb98('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a7e79,_0x47c83f,_0x41309a){return new BPromise(function(_0x16a195,_0x3ca112){return client[_0xeb98('0x9')](_0x4a7e79,_0x41309a)[_0xeb98('0xa')](function(_0x2f0e2e){logger[_0xeb98('0xb')](_0xeb98('0xc'),_0x47c83f,'request\x20sent');logger[_0xeb98('0xd')](_0xeb98('0xe'),_0x47c83f,_0xeb98('0xf'),JSON[_0xeb98('0x10')](_0x2f0e2e));if(_0x2f0e2e[_0xeb98('0x11')]){if(_0x2f0e2e[_0xeb98('0x11')][_0xeb98('0x12')]===0x1f4){logger[_0xeb98('0x11')](_0xeb98('0xc'),_0x47c83f,_0x2f0e2e[_0xeb98('0x11')][_0xeb98('0x13')]);return _0x3ca112(_0x2f0e2e['error'][_0xeb98('0x13')]);}logger[_0xeb98('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x47c83f,_0x2f0e2e['error'][_0xeb98('0x13')]);return _0x16a195(_0x2f0e2e[_0xeb98('0x11')][_0xeb98('0x13')]);}else{logger[_0xeb98('0xb')](_0xeb98('0xc'),_0x47c83f,_0xeb98('0xf'));_0x16a195(_0x2f0e2e[_0xeb98('0x14')][_0xeb98('0x13')]);}})[_0xeb98('0x15')](function(_0x2fd9c8){logger[_0xeb98('0x11')](_0xeb98('0xc'),_0x47c83f,_0x2fd9c8);_0x3ca112(_0x2fd9c8);});});}exports[_0xeb98('0x16')]=function(_0x3520a4){var _0x3a86e9=this;return new Promise(function(_0x1caff9,_0x38b7be){return db[_0xeb98('0x17')][_0xeb98('0x18')](_0x3520a4[_0xeb98('0x19')],{'raw':_0x3520a4['options']?_0x3520a4[_0xeb98('0x1a')][_0xeb98('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x56b018){logger[_0xeb98('0xb')](_0xeb98('0x16'),_0x3520a4);logger['debug']('CreateOpenchannelQueueReport',_0x3520a4,JSON[_0xeb98('0x10')](_0x56b018));_0x1caff9(_0x56b018);})['catch'](function(_0x3e7693){logger[_0xeb98('0x11')]('CreateOpenchannelQueueReport',_0x3e7693[_0xeb98('0x13')],_0x3520a4);_0x38b7be(_0x3a86e9[_0xeb98('0x11')](0x1f4,_0x3e7693[_0xeb98('0x13')]));});});};exports[_0xeb98('0x1c')]=function(_0x16274e){var _0x1fa721=this;return new Promise(function(_0x685a8f,_0x31928e){return db[_0xeb98('0x17')][_0xeb98('0x1d')](_0x16274e[_0xeb98('0x19')],{'raw':_0x16274e['options']?_0x16274e[_0xeb98('0x1a')][_0xeb98('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16274e[_0xeb98('0x1a')]?_0x16274e[_0xeb98('0x1a')][_0xeb98('0x1e')]||null:null,'attributes':_0x16274e[_0xeb98('0x1a')]?_0x16274e[_0xeb98('0x1a')][_0xeb98('0x1f')]||null:null,'limit':_0x16274e[_0xeb98('0x1a')]?_0x16274e[_0xeb98('0x1a')][_0xeb98('0x20')]||null:null})[_0xeb98('0xa')](function(_0x54a957){logger[_0xeb98('0xb')](_0xeb98('0x1c'),_0x16274e);logger[_0xeb98('0xd')](_0xeb98('0x1c'),_0x16274e,JSON['stringify'](_0x54a957));_0x685a8f(_0x54a957);})[_0xeb98('0x15')](function(_0x3998f0){logger[_0xeb98('0x11')](_0xeb98('0x1c'),_0x3998f0[_0xeb98('0x13')],_0x16274e);_0x31928e(_0x1fa721[_0xeb98('0x11')](0x1f4,_0x3998f0['message']));});});}; \ No newline at end of file +var _0x937d=['info','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','debug','UpdateOpenchannelQueueReport','attributes','limit','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x96ae40,_0x56d13b){var _0xbb36e8=function(_0x3651ff){while(--_0x3651ff){_0x96ae40['push'](_0x96ae40['shift']());}};_0xbb36e8(++_0x56d13b);}(_0x937d,0x1f4));var _0xd937=function(_0x3897e5,_0x56aca9){_0x3897e5=_0x3897e5-0x0;var _0x340a00=_0x937d[_0x3897e5];return _0x340a00;};'use strict';var _=require(_0xd937('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd937('0x1'));var fs=require('fs');var Redis=require(_0xd937('0x2'));var db=require(_0xd937('0x3'))['db'];var utils=require(_0xd937('0x4'));var logger=require(_0xd937('0x5'))(_0xd937('0x6'));var config=require('../../config/environment');var jayson=require(_0xd937('0x7'));var client=jayson[_0xd937('0x8')][_0xd937('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f6cd9,_0x2454f9,_0x4dc790){return new BPromise(function(_0x490b1d,_0x372dff){return client[_0xd937('0xa')](_0x4f6cd9,_0x4dc790)[_0xd937('0xb')](function(_0xa97338){logger[_0xd937('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2454f9,_0xd937('0xd'));logger['debug'](_0xd937('0xe'),_0x2454f9,'request\x20sent',JSON[_0xd937('0xf')](_0xa97338));if(_0xa97338[_0xd937('0x10')]){if(_0xa97338[_0xd937('0x10')][_0xd937('0x11')]===0x1f4){logger[_0xd937('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2454f9,_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);return _0x372dff(_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);}logger[_0xd937('0x10')](_0xd937('0x13'),_0x2454f9,_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);return _0x490b1d(_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);}else{logger['info'](_0xd937('0x13'),_0x2454f9,_0xd937('0xd'));_0x490b1d(_0xa97338[_0xd937('0x14')]['message']);}})[_0xd937('0x15')](function(_0x16d2ba){logger[_0xd937('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2454f9,_0x16d2ba);_0x372dff(_0x16d2ba);});});}exports[_0xd937('0x16')]=function(_0x3d6b1c){var _0x1d1b8b=this;return new Promise(function(_0x1bd7ee,_0x26d5ca){return db[_0xd937('0x17')][_0xd937('0x18')](_0x3d6b1c[_0xd937('0x19')],{'raw':_0x3d6b1c[_0xd937('0x1a')]?_0x3d6b1c[_0xd937('0x1a')][_0xd937('0x1b')]===undefined?!![]:![]:!![]})[_0xd937('0xb')](function(_0x2c18ea){logger[_0xd937('0xc')](_0xd937('0x16'),_0x3d6b1c);logger[_0xd937('0x1c')](_0xd937('0x16'),_0x3d6b1c,JSON['stringify'](_0x2c18ea));_0x1bd7ee(_0x2c18ea);})[_0xd937('0x15')](function(_0x168f3e){logger[_0xd937('0x10')](_0xd937('0x16'),_0x168f3e[_0xd937('0x12')],_0x3d6b1c);_0x26d5ca(_0x1d1b8b[_0xd937('0x10')](0x1f4,_0x168f3e[_0xd937('0x12')]));});});};exports[_0xd937('0x1d')]=function(_0x194fe5){var _0x14b350=this;return new Promise(function(_0x2bbbd4,_0x5b14d0){return db['OpenchannelQueueReport']['update'](_0x194fe5[_0xd937('0x19')],{'raw':_0x194fe5[_0xd937('0x1a')]?_0x194fe5['options'][_0xd937('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x194fe5[_0xd937('0x1a')]?_0x194fe5[_0xd937('0x1a')]['where']||null:null,'attributes':_0x194fe5['options']?_0x194fe5[_0xd937('0x1a')][_0xd937('0x1e')]||null:null,'limit':_0x194fe5[_0xd937('0x1a')]?_0x194fe5[_0xd937('0x1a')][_0xd937('0x1f')]||null:null})[_0xd937('0xb')](function(_0x291fb7){logger[_0xd937('0xc')](_0xd937('0x1d'),_0x194fe5);logger[_0xd937('0x1c')](_0xd937('0x1d'),_0x194fe5,JSON['stringify'](_0x291fb7));_0x2bbbd4(_0x291fb7);})[_0xd937('0x15')](function(_0x23b4ef){logger[_0xd937('0x10')](_0xd937('0x1d'),_0x23b4ef['message'],_0x194fe5);_0x5b14d0(_0x14b350[_0xd937('0x10')](0x1f4,_0x23b4ef[_0xd937('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 19582a9..d0eb3b5 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 _0xd3f6=['delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get','/:id','post','create'];(function(_0x2ed8d0,_0x47f405){var _0x2dc5c4=function(_0x43faa6){while(--_0x43faa6){_0x2ed8d0['push'](_0x2ed8d0['shift']());}};_0x2dc5c4(++_0x47f405);}(_0xd3f6,0x147));var _0x6d3f=function(_0x33593e,_0x22ddd3){_0x33593e=_0x33593e-0x0;var _0x53db1a=_0xd3f6[_0x33593e];return _0x53db1a;};'use strict';var multer=require(_0x6d3f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6d3f('0x1'));var express=require(_0x6d3f('0x2'));var router=express[_0x6d3f('0x3')]();var fs_extra=require(_0x6d3f('0x4'));var auth=require(_0x6d3f('0x5'));var interaction=require(_0x6d3f('0x6'));var config=require(_0x6d3f('0x7'));var controller=require(_0x6d3f('0x8'));router['get']('/',auth[_0x6d3f('0x9')](),controller[_0x6d3f('0xa')]);router[_0x6d3f('0xb')]('/describe',auth[_0x6d3f('0x9')](),controller['describe']);router[_0x6d3f('0xb')](_0x6d3f('0xc'),auth[_0x6d3f('0x9')](),controller['show']);router[_0x6d3f('0xd')]('/',auth[_0x6d3f('0x9')](),controller[_0x6d3f('0xe')]);router['put'](_0x6d3f('0xc'),auth[_0x6d3f('0x9')](),controller['update']);router[_0x6d3f('0xf')](_0x6d3f('0xc'),auth[_0x6d3f('0x9')](),controller[_0x6d3f('0x10')]);module[_0x6d3f('0x11')]=router; \ No newline at end of file +var _0x6c42=['put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create'];(function(_0x2c1841,_0x505204){var _0x28d148=function(_0x5be79f){while(--_0x5be79f){_0x2c1841['push'](_0x2c1841['shift']());}};_0x28d148(++_0x505204);}(_0x6c42,0x124));var _0x26c4=function(_0x3f8743,_0x33973f){_0x3f8743=_0x3f8743-0x0;var _0x1f844c=_0x6c42[_0x3f8743];return _0x1f844c;};'use strict';var multer=require(_0x26c4('0x0'));var util=require(_0x26c4('0x1'));var path=require('path');var timeout=require(_0x26c4('0x2'));var express=require(_0x26c4('0x3'));var router=express[_0x26c4('0x4')]();var fs_extra=require(_0x26c4('0x5'));var auth=require(_0x26c4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x26c4('0x7'));var controller=require(_0x26c4('0x8'));router[_0x26c4('0x9')]('/',auth[_0x26c4('0xa')](),controller[_0x26c4('0xb')]);router[_0x26c4('0x9')](_0x26c4('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x26c4('0x9')]('/:id',auth[_0x26c4('0xa')](),controller[_0x26c4('0xd')]);router[_0x26c4('0xe')]('/',auth['isAuthenticated'](),controller[_0x26c4('0xf')]);router[_0x26c4('0x10')](_0x26c4('0x11'),auth[_0x26c4('0xa')](),controller[_0x26c4('0x12')]);router[_0x26c4('0x13')](_0x26c4('0x11'),auth['isAuthenticated'](),controller[_0x26c4('0x14')]);module[_0x26c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 1720b34..eefee4d 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x3f00ee,_0x1d1673){var _0x18a07e=function(_0x4dad57){while(--_0x4dad57){_0x3f00ee['push'](_0x3f00ee['shift']());}};_0x18a07e(++_0x1d1673);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1d84fb,_0xbf6896){_0x1d84fb=_0x1d84fb-0x0;var _0x1d0a1f=_0x9bde[_0x1d84fb];return _0x1d0a1f;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0xdf34d6,_0x4ecc11){var _0x52e2f0=function(_0x146ad7){while(--_0x146ad7){_0xdf34d6['push'](_0xdf34d6['shift']());}};_0x52e2f0(++_0x4ecc11);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xcb91[_0x2d2c16];return _0x53f2fb;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 4523aff..47b0eb0 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 _0xb3b0=['query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','keys','fields','length','include','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','key','model'];(function(_0x5962f3,_0x1ae49e){var _0xc8f127=function(_0x4adf3f){while(--_0x4adf3f){_0x5962f3['push'](_0x5962f3['shift']());}};_0xc8f127(++_0x1ae49e);}(_0xb3b0,0xb3));var _0x0b3b=function(_0x314a97,_0x4674a6){_0x314a97=_0x314a97-0x0;var _0x283a04=_0xb3b0[_0x314a97];return _0x283a04;};'use strict';var emlformat=require(_0x0b3b('0x0'));var rimraf=require(_0x0b3b('0x1'));var zipdir=require(_0x0b3b('0x2'));var jsonpatch=require(_0x0b3b('0x3'));var rp=require('request-promise');var moment=require(_0x0b3b('0x4'));var BPromise=require(_0x0b3b('0x5'));var Mustache=require(_0x0b3b('0x6'));var util=require(_0x0b3b('0x7'));var path=require('path');var sox=require(_0x0b3b('0x8'));var csv=require(_0x0b3b('0x9'));var ejs=require(_0x0b3b('0xa'));var fs=require('fs');var fs_extra=require(_0x0b3b('0xb'));var _=require(_0x0b3b('0xc'));var squel=require(_0x0b3b('0xd'));var crypto=require(_0x0b3b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0b3b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0b3b('0x10'));var authService=require(_0x0b3b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0b3b('0x12'));var hardwareService=require(_0x0b3b('0x13'));var logger=require(_0x0b3b('0x14'))('api');var utils=require(_0x0b3b('0x15'));var config=require(_0x0b3b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0b3b('0x17'))['db'];function respondWithStatusCode(_0x14ba86,_0x2c7395){_0x2c7395=_0x2c7395||0xcc;return function(_0x4394ff){if(_0x4394ff){return _0x14ba86['sendStatus'](_0x2c7395);}return _0x14ba86[_0x0b3b('0x18')](_0x2c7395)[_0x0b3b('0x19')]();};}function respondWithResult(_0x3dab3b,_0xbc3baf){_0xbc3baf=_0xbc3baf||0xc8;return function(_0x3e4fb5){if(_0x3e4fb5){return _0x3dab3b[_0x0b3b('0x18')](_0xbc3baf)[_0x0b3b('0x1a')](_0x3e4fb5);}};}function respondWithFilteredResult(_0x100653,_0x1769f0){return function(_0x46e04f){if(_0x46e04f){var _0x381e72=typeof _0x1769f0[_0x0b3b('0x1b')]===_0x0b3b('0x1c')&&typeof _0x1769f0[_0x0b3b('0x1d')]===_0x0b3b('0x1c');var _0x5b61c7=_0x46e04f[_0x0b3b('0x1e')];var _0x1bd6b3=_0x381e72?0x0:_0x1769f0[_0x0b3b('0x1b')];var _0x385597=_0x381e72?_0x46e04f[_0x0b3b('0x1e')]:_0x1769f0[_0x0b3b('0x1b')]+_0x1769f0[_0x0b3b('0x1d')];var _0xe035dd;if(_0x385597>=_0x5b61c7){_0x385597=_0x5b61c7;_0xe035dd=0xc8;}else{_0xe035dd=0xce;}_0x100653[_0x0b3b('0x18')](_0xe035dd);return _0x100653[_0x0b3b('0x1f')](_0x0b3b('0x20'),_0x1bd6b3+'-'+_0x385597+'/'+_0x5b61c7)[_0x0b3b('0x1a')](_0x46e04f);}return null;};}function patchUpdates(_0x3c03e0){return function(_0x274f22){try{jsonpatch['apply'](_0x274f22,_0x3c03e0,!![]);}catch(_0x31539f){return BPromise['reject'](_0x31539f);}return _0x274f22[_0x0b3b('0x21')]();};}function saveUpdates(_0x12fc77,_0x2abb9e){return function(_0x3786ef){if(_0x3786ef){return _0x3786ef[_0x0b3b('0x22')](_0x12fc77)[_0x0b3b('0x23')](function(_0x46fe33){return _0x46fe33;});}return null;};}function removeEntity(_0x2be8b3,_0x121139){return function(_0x40e779){if(_0x40e779){return _0x40e779[_0x0b3b('0x24')]()[_0x0b3b('0x23')](function(){_0x2be8b3[_0x0b3b('0x18')](0xcc)[_0x0b3b('0x19')]();});}};}function handleEntityNotFound(_0x34674c,_0x117bcb){return function(_0x2d5508){if(!_0x2d5508){_0x34674c[_0x0b3b('0x25')](0x194);}return _0x2d5508;};}function handleError(_0x415e96,_0x30410f){_0x30410f=_0x30410f||0x1f4;return function(_0x5c6cf6){logger[_0x0b3b('0x26')](_0x5c6cf6[_0x0b3b('0x27')]);if(_0x5c6cf6[_0x0b3b('0x28')]){delete _0x5c6cf6[_0x0b3b('0x28')];}_0x415e96[_0x0b3b('0x18')](_0x30410f)[_0x0b3b('0x29')](_0x5c6cf6);};}exports[_0x0b3b('0x2a')]=function(_0x37afac,_0x270574){var _0x26243c={},_0x292af9={},_0x466933={'count':0x0,'rows':[]};var _0x48bc37=_[_0x0b3b('0x2b')](db[_0x0b3b('0x2c')][_0x0b3b('0x2d')],function(_0x45ca29){return{'name':_0x45ca29['fieldName'],'type':_0x45ca29[_0x0b3b('0x2e')][_0x0b3b('0x2f')]};});_0x292af9[_0x0b3b('0x30')]=_[_0x0b3b('0x2b')](_0x48bc37,_0x0b3b('0x28'));_0x292af9[_0x0b3b('0x31')]=_['keys'](_0x37afac[_0x0b3b('0x31')]);_0x292af9[_0x0b3b('0x32')]=_[_0x0b3b('0x33')](_0x292af9[_0x0b3b('0x30')],_0x292af9['query']);_0x26243c[_0x0b3b('0x34')]=_[_0x0b3b('0x33')](_0x292af9['model'],qs['fields'](_0x37afac[_0x0b3b('0x31')]['fields']));_0x26243c[_0x0b3b('0x34')]=_0x26243c[_0x0b3b('0x34')]['length']?_0x26243c['attributes']:_0x292af9[_0x0b3b('0x30')];if(!_0x37afac[_0x0b3b('0x31')][_0x0b3b('0x35')](_0x0b3b('0x36'))){_0x26243c['limit']=qs[_0x0b3b('0x1d')](_0x37afac[_0x0b3b('0x31')][_0x0b3b('0x1d')]);_0x26243c[_0x0b3b('0x1b')]=qs['offset'](_0x37afac[_0x0b3b('0x31')]['offset']);}_0x26243c[_0x0b3b('0x37')]=qs['sort'](_0x37afac[_0x0b3b('0x31')][_0x0b3b('0x38')]);_0x26243c['where']=qs['filters'](_[_0x0b3b('0x39')](_0x37afac[_0x0b3b('0x31')],_0x292af9[_0x0b3b('0x32')]),_0x48bc37);if(_0x37afac[_0x0b3b('0x31')][_0x0b3b('0x3a')]){_0x26243c[_0x0b3b('0x3b')]=_[_0x0b3b('0x3c')](_0x26243c[_0x0b3b('0x3b')],{'$or':_[_0x0b3b('0x2b')](_0x48bc37,function(_0x12efb0){if(_0x12efb0[_0x0b3b('0x2e')]!==_0x0b3b('0x3d')){var _0x35f720={};_0x35f720[_0x12efb0[_0x0b3b('0x28')]]={'$like':'%'+_0x37afac[_0x0b3b('0x31')][_0x0b3b('0x3a')]+'%'};return _0x35f720;}})});}_0x26243c=_['merge']({},_0x26243c,_0x37afac[_0x0b3b('0x3e')]);var _0x31dd5a={'where':_0x26243c[_0x0b3b('0x3b')]};return db[_0x0b3b('0x2c')]['count'](_0x31dd5a)['then'](function(_0x43d3c3){_0x466933[_0x0b3b('0x1e')]=_0x43d3c3;if(_0x37afac['query'][_0x0b3b('0x3f')]){_0x26243c['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x0b3b('0x40')](_0x26243c);})['then'](function(_0x3050a0){_0x466933['rows']=_0x3050a0;return _0x466933;})[_0x0b3b('0x23')](respondWithFilteredResult(_0x270574,_0x26243c))['catch'](handleError(_0x270574,null));};exports[_0x0b3b('0x41')]=function(_0x316642,_0x20494e){var _0x46876c={'raw':!![],'where':{'id':_0x316642['params']['id']}},_0x11cda4={};_0x11cda4[_0x0b3b('0x30')]=_[_0x0b3b('0x42')](db[_0x0b3b('0x2c')][_0x0b3b('0x2d')]);_0x11cda4[_0x0b3b('0x31')]=_[_0x0b3b('0x42')](_0x316642['query']);_0x11cda4[_0x0b3b('0x32')]=_[_0x0b3b('0x33')](_0x11cda4[_0x0b3b('0x30')],_0x11cda4[_0x0b3b('0x31')]);_0x46876c['attributes']=_[_0x0b3b('0x33')](_0x11cda4[_0x0b3b('0x30')],qs[_0x0b3b('0x43')](_0x316642['query'][_0x0b3b('0x43')]));_0x46876c['attributes']=_0x46876c['attributes'][_0x0b3b('0x44')]?_0x46876c[_0x0b3b('0x34')]:_0x11cda4[_0x0b3b('0x30')];if(_0x316642[_0x0b3b('0x31')]['includeAll']){_0x46876c[_0x0b3b('0x45')]=[{'all':!![]}];}_0x46876c=_[_0x0b3b('0x3c')]({},_0x46876c,_0x316642[_0x0b3b('0x3e')]);return db[_0x0b3b('0x2c')][_0x0b3b('0x46')](_0x46876c)[_0x0b3b('0x23')](handleEntityNotFound(_0x20494e,null))[_0x0b3b('0x23')](respondWithResult(_0x20494e,null))[_0x0b3b('0x47')](handleError(_0x20494e,null));};exports[_0x0b3b('0x48')]=function(_0x50f499,_0x724a4a){return db[_0x0b3b('0x2c')]['create'](_0x50f499[_0x0b3b('0x49')],{})[_0x0b3b('0x23')](respondWithResult(_0x724a4a,0xc9))[_0x0b3b('0x47')](handleError(_0x724a4a,null));};exports[_0x0b3b('0x22')]=function(_0x59fef8,_0xbac162){if(_0x59fef8['body']['id']){delete _0x59fef8[_0x0b3b('0x49')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x59fef8[_0x0b3b('0x4a')]['id']}})[_0x0b3b('0x23')](handleEntityNotFound(_0xbac162,null))[_0x0b3b('0x23')](saveUpdates(_0x59fef8['body'],null))[_0x0b3b('0x23')](respondWithResult(_0xbac162,null))['catch'](handleError(_0xbac162,null));};exports[_0x0b3b('0x24')]=function(_0x3c9cbf,_0x4f5d34){return db[_0x0b3b('0x2c')]['find']({'where':{'id':_0x3c9cbf[_0x0b3b('0x4a')]['id']}})[_0x0b3b('0x23')](handleEntityNotFound(_0x4f5d34,null))['then'](removeEntity(_0x4f5d34,null))['catch'](handleError(_0x4f5d34,null));};exports[_0x0b3b('0x4b')]=function(_0x1fc50d,_0x263780){return db[_0x0b3b('0x2c')]['describe']()[_0x0b3b('0x23')](respondWithResult(_0x263780,null))[_0x0b3b('0x47')](handleError(_0x263780,null));}; \ No newline at end of file +var _0x710d=['OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','save','update','then','end','error','stack','name','send','map'];(function(_0x4d8f12,_0x4bf1e7){var _0x2d8647=function(_0x2506b7){while(--_0x2506b7){_0x4d8f12['push'](_0x4d8f12['shift']());}};_0x2d8647(++_0x4bf1e7);}(_0x710d,0x19d));var _0xd710=function(_0x2e4cbf,_0x8763d3){_0x2e4cbf=_0x2e4cbf-0x0;var _0x52840f=_0x710d[_0x2e4cbf];return _0x52840f;};'use strict';var emlformat=require(_0xd710('0x0'));var rimraf=require(_0xd710('0x1'));var zipdir=require(_0xd710('0x2'));var jsonpatch=require(_0xd710('0x3'));var rp=require(_0xd710('0x4'));var moment=require(_0xd710('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd710('0x6'));var util=require(_0xd710('0x7'));var path=require('path');var sox=require(_0xd710('0x8'));var csv=require(_0xd710('0x9'));var ejs=require(_0xd710('0xa'));var fs=require('fs');var fs_extra=require(_0xd710('0xb'));var _=require('lodash');var squel=require(_0xd710('0xc'));var crypto=require('crypto');var jsforce=require(_0xd710('0xd'));var deskjs=require(_0xd710('0xe'));var toCsv=require(_0xd710('0x9'));var querystring=require('querystring');var Papa=require(_0xd710('0xf'));var Redis=require(_0xd710('0x10'));var authService=require(_0xd710('0x11'));var qs=require(_0xd710('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd710('0x13'));var logger=require(_0xd710('0x14'))(_0xd710('0x15'));var utils=require(_0xd710('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd710('0x17'));var db=require(_0xd710('0x18'))['db'];function respondWithStatusCode(_0x57725d,_0x509360){_0x509360=_0x509360||0xcc;return function(_0x22d884){if(_0x22d884){return _0x57725d[_0xd710('0x19')](_0x509360);}return _0x57725d[_0xd710('0x1a')](_0x509360)['end']();};}function respondWithResult(_0x37ab3d,_0xbd929a){_0xbd929a=_0xbd929a||0xc8;return function(_0x251fc5){if(_0x251fc5){return _0x37ab3d[_0xd710('0x1a')](_0xbd929a)[_0xd710('0x1b')](_0x251fc5);}};}function respondWithFilteredResult(_0x22c502,_0x189d1a){return function(_0x79e5f6){if(_0x79e5f6){var _0x3956a5=typeof _0x189d1a['offset']===_0xd710('0x1c')&&typeof _0x189d1a[_0xd710('0x1d')]===_0xd710('0x1c');var _0x312233=_0x79e5f6['count'];var _0x177df9=_0x3956a5?0x0:_0x189d1a[_0xd710('0x1e')];var _0x19ed9c=_0x3956a5?_0x79e5f6[_0xd710('0x1f')]:_0x189d1a[_0xd710('0x1e')]+_0x189d1a['limit'];var _0x212f6d;if(_0x19ed9c>=_0x312233){_0x19ed9c=_0x312233;_0x212f6d=0xc8;}else{_0x212f6d=0xce;}_0x22c502[_0xd710('0x1a')](_0x212f6d);return _0x22c502['set'](_0xd710('0x20'),_0x177df9+'-'+_0x19ed9c+'/'+_0x312233)['json'](_0x79e5f6);}return null;};}function patchUpdates(_0x2319bd){return function(_0x333aeb){try{jsonpatch[_0xd710('0x21')](_0x333aeb,_0x2319bd,!![]);}catch(_0x392dbd){return BPromise['reject'](_0x392dbd);}return _0x333aeb[_0xd710('0x22')]();};}function saveUpdates(_0x2d87f0,_0x5cc652){return function(_0x26c2c2){if(_0x26c2c2){return _0x26c2c2[_0xd710('0x23')](_0x2d87f0)[_0xd710('0x24')](function(_0x6d6b51){return _0x6d6b51;});}return null;};}function removeEntity(_0x4b2b78,_0x360bf0){return function(_0x270111){if(_0x270111){return _0x270111['destroy']()[_0xd710('0x24')](function(){_0x4b2b78[_0xd710('0x1a')](0xcc)[_0xd710('0x25')]();});}};}function handleEntityNotFound(_0x3fd611,_0x13ffc0){return function(_0x32bfb2){if(!_0x32bfb2){_0x3fd611['sendStatus'](0x194);}return _0x32bfb2;};}function handleError(_0x54a3d2,_0xd81ef5){_0xd81ef5=_0xd81ef5||0x1f4;return function(_0x1b4a4e){logger[_0xd710('0x26')](_0x1b4a4e[_0xd710('0x27')]);if(_0x1b4a4e['name']){delete _0x1b4a4e[_0xd710('0x28')];}_0x54a3d2[_0xd710('0x1a')](_0xd81ef5)[_0xd710('0x29')](_0x1b4a4e);};}exports['index']=function(_0x5c4b40,_0x22096e){var _0x6ec522={},_0x3bb7f3={},_0x525d19={'count':0x0,'rows':[]};var _0x5230c8=_[_0xd710('0x2a')](db[_0xd710('0x2b')][_0xd710('0x2c')],function(_0x11be0b){return{'name':_0x11be0b[_0xd710('0x2d')],'type':_0x11be0b[_0xd710('0x2e')][_0xd710('0x2f')]};});_0x3bb7f3[_0xd710('0x30')]=_[_0xd710('0x2a')](_0x5230c8,_0xd710('0x28'));_0x3bb7f3['query']=_[_0xd710('0x31')](_0x5c4b40['query']);_0x3bb7f3[_0xd710('0x32')]=_[_0xd710('0x33')](_0x3bb7f3[_0xd710('0x30')],_0x3bb7f3[_0xd710('0x34')]);_0x6ec522['attributes']=_[_0xd710('0x33')](_0x3bb7f3[_0xd710('0x30')],qs[_0xd710('0x35')](_0x5c4b40[_0xd710('0x34')]['fields']));_0x6ec522[_0xd710('0x36')]=_0x6ec522[_0xd710('0x36')][_0xd710('0x37')]?_0x6ec522[_0xd710('0x36')]:_0x3bb7f3[_0xd710('0x30')];if(!_0x5c4b40[_0xd710('0x34')][_0xd710('0x38')](_0xd710('0x39'))){_0x6ec522['limit']=qs[_0xd710('0x1d')](_0x5c4b40[_0xd710('0x34')]['limit']);_0x6ec522[_0xd710('0x1e')]=qs['offset'](_0x5c4b40[_0xd710('0x34')][_0xd710('0x1e')]);}_0x6ec522[_0xd710('0x3a')]=qs[_0xd710('0x3b')](_0x5c4b40[_0xd710('0x34')]['sort']);_0x6ec522[_0xd710('0x3c')]=qs['filters'](_[_0xd710('0x3d')](_0x5c4b40[_0xd710('0x34')],_0x3bb7f3[_0xd710('0x32')]),_0x5230c8);if(_0x5c4b40[_0xd710('0x34')]['filter']){_0x6ec522['where']=_[_0xd710('0x3e')](_0x6ec522[_0xd710('0x3c')],{'$or':_[_0xd710('0x2a')](_0x5230c8,function(_0x38d138){if(_0x38d138[_0xd710('0x2e')]!=='VIRTUAL'){var _0x352a20={};_0x352a20[_0x38d138[_0xd710('0x28')]]={'$like':'%'+_0x5c4b40[_0xd710('0x34')][_0xd710('0x3f')]+'%'};return _0x352a20;}})});}_0x6ec522=_[_0xd710('0x3e')]({},_0x6ec522,_0x5c4b40['options']);var _0x3a4e12={'where':_0x6ec522[_0xd710('0x3c')]};return db[_0xd710('0x2b')][_0xd710('0x1f')](_0x3a4e12)[_0xd710('0x24')](function(_0x319c45){_0x525d19[_0xd710('0x1f')]=_0x319c45;if(_0x5c4b40[_0xd710('0x34')][_0xd710('0x40')]){_0x6ec522[_0xd710('0x41')]=[{'all':!![]}];}return db[_0xd710('0x2b')][_0xd710('0x42')](_0x6ec522);})[_0xd710('0x24')](function(_0x5e5ce1){_0x525d19[_0xd710('0x43')]=_0x5e5ce1;return _0x525d19;})[_0xd710('0x24')](respondWithFilteredResult(_0x22096e,_0x6ec522))[_0xd710('0x44')](handleError(_0x22096e,null));};exports[_0xd710('0x45')]=function(_0x48092e,_0x339db0){var _0x5b1cab={'raw':!![],'where':{'id':_0x48092e[_0xd710('0x46')]['id']}},_0x2d4630={};_0x2d4630[_0xd710('0x30')]=_[_0xd710('0x31')](db['OpenchannelTransferReport'][_0xd710('0x2c')]);_0x2d4630[_0xd710('0x34')]=_[_0xd710('0x31')](_0x48092e[_0xd710('0x34')]);_0x2d4630[_0xd710('0x32')]=_['intersection'](_0x2d4630[_0xd710('0x30')],_0x2d4630[_0xd710('0x34')]);_0x5b1cab['attributes']=_[_0xd710('0x33')](_0x2d4630[_0xd710('0x30')],qs[_0xd710('0x35')](_0x48092e[_0xd710('0x34')][_0xd710('0x35')]));_0x5b1cab[_0xd710('0x36')]=_0x5b1cab['attributes'][_0xd710('0x37')]?_0x5b1cab[_0xd710('0x36')]:_0x2d4630[_0xd710('0x30')];if(_0x48092e[_0xd710('0x34')][_0xd710('0x40')]){_0x5b1cab[_0xd710('0x41')]=[{'all':!![]}];}_0x5b1cab=_[_0xd710('0x3e')]({},_0x5b1cab,_0x48092e['options']);return db['OpenchannelTransferReport']['find'](_0x5b1cab)['then'](handleEntityNotFound(_0x339db0,null))[_0xd710('0x24')](respondWithResult(_0x339db0,null))[_0xd710('0x44')](handleError(_0x339db0,null));};exports[_0xd710('0x47')]=function(_0x5d00bd,_0x52ceaa){return db['OpenchannelTransferReport'][_0xd710('0x47')](_0x5d00bd['body'],{})[_0xd710('0x24')](respondWithResult(_0x52ceaa,0xc9))[_0xd710('0x44')](handleError(_0x52ceaa,null));};exports[_0xd710('0x23')]=function(_0x142d8f,_0x3a1ee5){if(_0x142d8f[_0xd710('0x48')]['id']){delete _0x142d8f['body']['id'];}return db[_0xd710('0x2b')][_0xd710('0x49')]({'where':{'id':_0x142d8f[_0xd710('0x46')]['id']}})[_0xd710('0x24')](handleEntityNotFound(_0x3a1ee5,null))[_0xd710('0x24')](saveUpdates(_0x142d8f[_0xd710('0x48')],null))[_0xd710('0x24')](respondWithResult(_0x3a1ee5,null))[_0xd710('0x44')](handleError(_0x3a1ee5,null));};exports[_0xd710('0x4a')]=function(_0x166ff0,_0x571907){return db[_0xd710('0x2b')][_0xd710('0x49')]({'where':{'id':_0x166ff0['params']['id']}})[_0xd710('0x24')](handleEntityNotFound(_0x571907,null))[_0xd710('0x24')](removeEntity(_0x571907,null))[_0xd710('0x44')](handleError(_0x571907,null));};exports['describe']=function(_0x5f533a,_0x56fb9a){return db[_0xd710('0x2b')][_0xd710('0x4b')]()[_0xd710('0x24')](respondWithResult(_0x56fb9a,null))[_0xd710('0x44')](handleError(_0x56fb9a,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 4c35954..8ec797f 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 _0x7e1f=['./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x7e1f,0xa1));var _0xf7e1=function(_0x55a5ca,_0x2def75){_0x55a5ca=_0x55a5ca-0x0;var _0xd4281e=_0x7e1f[_0x55a5ca];return _0xd4281e;};'use strict';var _=require(_0xf7e1('0x0'));var util=require('util');var logger=require(_0xf7e1('0x1'))('api');var moment=require(_0xf7e1('0x2'));var BPromise=require(_0xf7e1('0x3'));var rp=require(_0xf7e1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7e1('0x5'));var config=require(_0xf7e1('0x6'));var attributes=require(_0xf7e1('0x7'));module['exports']=function(_0x54fbcc,_0x551e61){return _0x54fbcc[_0xf7e1('0x8')](_0xf7e1('0x9'),attributes,{'tableName':_0xf7e1('0xa'),'paranoid':![],'indexes':[{'name':_0xf7e1('0xb'),'fields':[_0xf7e1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf837=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x2efc80,_0x8d7f41){var _0xfb2076=function(_0x2f0eea){while(--_0x2f0eea){_0x2efc80['push'](_0x2efc80['shift']());}};_0xfb2076(++_0x8d7f41);}(_0xf837,0x166));var _0x7f83=function(_0x31b57a,_0x3dddf3){_0x31b57a=_0x31b57a-0x0;var _0x2df3dd=_0xf837[_0x31b57a];return _0x2df3dd;};'use strict';var _=require(_0x7f83('0x0'));var util=require(_0x7f83('0x1'));var logger=require(_0x7f83('0x2'))(_0x7f83('0x3'));var moment=require(_0x7f83('0x4'));var BPromise=require(_0x7f83('0x5'));var rp=require(_0x7f83('0x6'));var fs=require('fs');var path=require(_0x7f83('0x7'));var rimraf=require(_0x7f83('0x8'));var config=require(_0x7f83('0x9'));var attributes=require(_0x7f83('0xa'));module[_0x7f83('0xb')]=function(_0x1fb15f,_0x1e1ea0){return _0x1fb15f['define'](_0x7f83('0xc'),attributes,{'tableName':_0x7f83('0xd'),'paranoid':![],'indexes':[{'name':_0x7f83('0xe'),'fields':[_0x7f83('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index c60f2da..3a068b2 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 _0xafdd=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0xafdd,0x19a));var _0xdafd=function(_0xefaa0d,_0x1d11cf){_0xefaa0d=_0xefaa0d-0x0;var _0x2d8bef=_0xafdd[_0xefaa0d];return _0x2d8bef;};'use strict';var _=require(_0xdafd('0x0'));var util=require(_0xdafd('0x1'));var moment=require(_0xdafd('0x2'));var BPromise=require(_0xdafd('0x3'));var rs=require(_0xdafd('0x4'));var fs=require('fs');var Redis=require(_0xdafd('0x5'));var db=require(_0xdafd('0x6'))['db'];var utils=require(_0xdafd('0x7'));var logger=require('../../config/logger')(_0xdafd('0x8'));var config=require(_0xdafd('0x9'));var jayson=require(_0xdafd('0xa'));var client=jayson[_0xdafd('0xb')][_0xdafd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57cfee,_0x2ed8ea,_0x53e09c){return new BPromise(function(_0x9b9c6b,_0x385520){return client[_0xdafd('0xd')](_0x57cfee,_0x53e09c)['then'](function(_0x168d8c){logger[_0xdafd('0xe')](_0xdafd('0xf'),_0x2ed8ea,_0xdafd('0x10'));logger['debug'](_0xdafd('0x11'),_0x2ed8ea,_0xdafd('0x10'),JSON[_0xdafd('0x12')](_0x168d8c));if(_0x168d8c[_0xdafd('0x13')]){if(_0x168d8c[_0xdafd('0x13')][_0xdafd('0x14')]===0x1f4){logger['error'](_0xdafd('0xf'),_0x2ed8ea,_0x168d8c['error']['message']);return _0x385520(_0x168d8c[_0xdafd('0x13')][_0xdafd('0x15')]);}logger['error'](_0xdafd('0xf'),_0x2ed8ea,_0x168d8c['error']['message']);return _0x9b9c6b(_0x168d8c[_0xdafd('0x13')][_0xdafd('0x15')]);}else{logger[_0xdafd('0xe')](_0xdafd('0xf'),_0x2ed8ea,_0xdafd('0x10'));_0x9b9c6b(_0x168d8c['result'][_0xdafd('0x15')]);}})[_0xdafd('0x16')](function(_0x262cd4){logger['error'](_0xdafd('0xf'),_0x2ed8ea,_0x262cd4);_0x385520(_0x262cd4);});});} \ No newline at end of file +var _0x2e65=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelTransferReport,\x20%s,\x20%s','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x46acfb,_0x3bb7e5){var _0x143806=function(_0x25b17b){while(--_0x25b17b){_0x46acfb['push'](_0x46acfb['shift']());}};_0x143806(++_0x3bb7e5);}(_0x2e65,0x193));var _0x52e6=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x2e65[_0x29db36];return _0x234e87;};'use strict';var _=require(_0x52e6('0x0'));var util=require(_0x52e6('0x1'));var moment=require(_0x52e6('0x2'));var BPromise=require(_0x52e6('0x3'));var rs=require(_0x52e6('0x4'));var fs=require('fs');var Redis=require(_0x52e6('0x5'));var db=require(_0x52e6('0x6'))['db'];var utils=require(_0x52e6('0x7'));var logger=require('../../config/logger')(_0x52e6('0x8'));var config=require(_0x52e6('0x9'));var jayson=require(_0x52e6('0xa'));var client=jayson[_0x52e6('0xb')][_0x52e6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x116651,_0x15e4af,_0x1401a3){return new BPromise(function(_0x27f270,_0x2ab17e){return client['request'](_0x116651,_0x1401a3)[_0x52e6('0xd')](function(_0x1db169){logger['info'](_0x52e6('0xe'),_0x15e4af,'request\x20sent');logger['debug'](_0x52e6('0xf'),_0x15e4af,_0x52e6('0x10'),JSON[_0x52e6('0x11')](_0x1db169));if(_0x1db169[_0x52e6('0x12')]){if(_0x1db169[_0x52e6('0x12')][_0x52e6('0x13')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x15e4af,_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);return _0x2ab17e(_0x1db169['error'][_0x52e6('0x14')]);}logger[_0x52e6('0x12')](_0x52e6('0xe'),_0x15e4af,_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);return _0x27f270(_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);}else{logger[_0x52e6('0x15')](_0x52e6('0xe'),_0x15e4af,_0x52e6('0x10'));_0x27f270(_0x1db169[_0x52e6('0x16')][_0x52e6('0x14')]);}})[_0x52e6('0x17')](function(_0x5c275c){logger['error'](_0x52e6('0xe'),_0x15e4af,_0x5c275c);_0x2ab17e(_0x5c275c);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 7f6f830..f2ac891 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 _0x279f=['isAuthenticated','update','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','/:id','show','post','create','put'];(function(_0x3818c0,_0x542521){var _0x55ec33=function(_0x2be9ea){while(--_0x2be9ea){_0x3818c0['push'](_0x3818c0['shift']());}};_0x55ec33(++_0x542521);}(_0x279f,0x18a));var _0xf279=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x279f[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0xf279('0x0'));var util=require(_0xf279('0x1'));var path=require(_0xf279('0x2'));var timeout=require(_0xf279('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf279('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf279('0x5'));var config=require(_0xf279('0x6'));var controller=require(_0xf279('0x7'));router[_0xf279('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf279('0x8')](_0xf279('0x9'),auth['isAuthenticated'](),controller[_0xf279('0xa')]);router[_0xf279('0xb')]('/',auth['isAuthenticated'](),controller[_0xf279('0xc')]);router[_0xf279('0xd')]('/:id',auth[_0xf279('0xe')](),controller[_0xf279('0xf')]);router['delete']('/:id',auth[_0xf279('0xe')](),controller[_0xf279('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2a4c=['show','post','create','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated'];(function(_0x58f2d0,_0x12906f){var _0x5b4cdb=function(_0xd9b4da){while(--_0xd9b4da){_0x58f2d0['push'](_0x58f2d0['shift']());}};_0x5b4cdb(++_0x12906f);}(_0x2a4c,0x148));var _0xc2a4=function(_0x20c62a,_0x41a155){_0x20c62a=_0x20c62a-0x0;var _0x3e48c7=_0x2a4c[_0x20c62a];return _0x3e48c7;};'use strict';var multer=require(_0xc2a4('0x0'));var util=require(_0xc2a4('0x1'));var path=require(_0xc2a4('0x2'));var timeout=require(_0xc2a4('0x3'));var express=require(_0xc2a4('0x4'));var router=express[_0xc2a4('0x5')]();var fs_extra=require(_0xc2a4('0x6'));var auth=require(_0xc2a4('0x7'));var interaction=require(_0xc2a4('0x8'));var config=require('../../config/environment');var controller=require(_0xc2a4('0x9'));router[_0xc2a4('0xa')]('/',auth[_0xc2a4('0xb')](),controller['index']);router[_0xc2a4('0xa')]('/:id',auth[_0xc2a4('0xb')](),controller[_0xc2a4('0xc')]);router[_0xc2a4('0xd')]('/',auth['isAuthenticated'](),controller[_0xc2a4('0xe')]);router[_0xc2a4('0xf')]('/:id',auth[_0xc2a4('0xb')](),controller[_0xc2a4('0x10')]);router['delete'](_0xc2a4('0x11'),auth[_0xc2a4('0xb')](),controller[_0xc2a4('0x12')]);module[_0xc2a4('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 66d992a..f5a097a 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 _0x2e32=['exports','STRING','name','sequelize'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x2e32,0x183));var _0x22e3=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x2e32[_0x17406a];return _0x1501ff;};'use strict';var Sequelize=require(_0x22e3('0x0'));module[_0x22e3('0x1')]={'name':{'type':Sequelize[_0x22e3('0x2')],'unique':_0x22e3('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x22e3('0x2')]}}; \ No newline at end of file +var _0x0bd6=['name','exports'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x0bd6,0x107));var _0x60bd=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0bd6[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module[_0x60bd('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x60bd('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 06a326a..1860974 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 _0x568d=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','Pauses','UserProfileResource','destroy','error','stack','name','send','index','map','Pause','fieldName','key','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x1ffa94,_0x84cb94){var _0x3cdd12=function(_0x5bf644){while(--_0x5bf644){_0x1ffa94['push'](_0x1ffa94['shift']());}};_0x3cdd12(++_0x84cb94);}(_0x568d,0xfb));var _0xd568=function(_0x32bbb1,_0xa0e27e){_0x32bbb1=_0x32bbb1-0x0;var _0x42b415=_0x568d[_0x32bbb1];return _0x42b415;};'use strict';var emlformat=require(_0xd568('0x0'));var rimraf=require(_0xd568('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd568('0x2'));var moment=require(_0xd568('0x3'));var BPromise=require(_0xd568('0x4'));var Mustache=require(_0xd568('0x5'));var util=require(_0xd568('0x6'));var path=require(_0xd568('0x7'));var sox=require(_0xd568('0x8'));var csv=require(_0xd568('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd568('0xa'));var _=require(_0xd568('0xb'));var squel=require(_0xd568('0xc'));var crypto=require(_0xd568('0xd'));var jsforce=require(_0xd568('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd568('0x9'));var querystring=require(_0xd568('0xf'));var Papa=require('papaparse');var Redis=require(_0xd568('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd568('0x11'));var as=require(_0xd568('0x12'));var hardwareService=require(_0xd568('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd568('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd568('0x15'));var db=require(_0xd568('0x16'))['db'];function respondWithStatusCode(_0x5dcddf,_0x446fbc){_0x446fbc=_0x446fbc||0xcc;return function(_0x1a4465){if(_0x1a4465){return _0x5dcddf[_0xd568('0x17')](_0x446fbc);}return _0x5dcddf[_0xd568('0x18')](_0x446fbc)[_0xd568('0x19')]();};}function respondWithResult(_0xf70d7c,_0x5e807f){_0x5e807f=_0x5e807f||0xc8;return function(_0x2ce274){if(_0x2ce274){return _0xf70d7c[_0xd568('0x18')](_0x5e807f)[_0xd568('0x1a')](_0x2ce274);}};}function respondWithFilteredResult(_0xd16cec,_0x1209ab){return function(_0x504f7d){if(_0x504f7d){var _0x45ce9c=typeof _0x1209ab[_0xd568('0x1b')]===_0xd568('0x1c')&&typeof _0x1209ab[_0xd568('0x1d')]==='undefined';var _0x2dcd83=_0x504f7d[_0xd568('0x1e')];var _0x43ca86=_0x45ce9c?0x0:_0x1209ab[_0xd568('0x1b')];var _0x1dbeda=_0x45ce9c?_0x504f7d[_0xd568('0x1e')]:_0x1209ab[_0xd568('0x1b')]+_0x1209ab['limit'];var _0x24d661;if(_0x1dbeda>=_0x2dcd83){_0x1dbeda=_0x2dcd83;_0x24d661=0xc8;}else{_0x24d661=0xce;}_0xd16cec[_0xd568('0x18')](_0x24d661);return _0xd16cec[_0xd568('0x1f')](_0xd568('0x20'),_0x43ca86+'-'+_0x1dbeda+'/'+_0x2dcd83)[_0xd568('0x1a')](_0x504f7d);}return null;};}function patchUpdates(_0x4c0198){return function(_0x4aed2d){try{jsonpatch[_0xd568('0x21')](_0x4aed2d,_0x4c0198,!![]);}catch(_0x1bc789){return BPromise['reject'](_0x1bc789);}return _0x4aed2d[_0xd568('0x22')]();};}function saveUpdates(_0x8a183d,_0x15a2a1){return function(_0x5629ea){if(_0x5629ea){return _0x5629ea[_0xd568('0x23')](_0x8a183d)[_0xd568('0x24')](function(_0x5d5a9f){return _0x5d5a9f;});}return null;};}function removeEntity(_0x12c7e1,_0x4a418b){return function(_0x559ed4){if(_0x559ed4){return _0x559ed4['destroy']()[_0xd568('0x24')](function(){var _0xf52f9a=_0x559ed4[_0xd568('0x25')]({'plain':!![]});var _0x40503e=_0xd568('0x26');return db[_0xd568('0x27')][_0xd568('0x28')]({'where':{'type':_0x40503e,'resourceId':_0xf52f9a['id']}})[_0xd568('0x24')](function(){return _0x559ed4;});})['then'](function(){_0x12c7e1[_0xd568('0x18')](0xcc)[_0xd568('0x19')]();});}};}function handleEntityNotFound(_0x4cf3c8,_0x587b3a){return function(_0x30a5f7){if(!_0x30a5f7){_0x4cf3c8[_0xd568('0x17')](0x194);}return _0x30a5f7;};}function handleError(_0xa8b780,_0xf082cf){_0xf082cf=_0xf082cf||0x1f4;return function(_0x3303b8){logger[_0xd568('0x29')](_0x3303b8[_0xd568('0x2a')]);if(_0x3303b8[_0xd568('0x2b')]){delete _0x3303b8[_0xd568('0x2b')];}_0xa8b780['status'](_0xf082cf)[_0xd568('0x2c')](_0x3303b8);};}exports[_0xd568('0x2d')]=function(_0x5be1a7,_0x4bf1b9){var _0x56fe6e={},_0x1ecbaa={},_0x64381e={'count':0x0,'rows':[]};var _0x5bf089=_[_0xd568('0x2e')](db[_0xd568('0x2f')]['rawAttributes'],function(_0x4a9686){return{'name':_0x4a9686[_0xd568('0x30')],'type':_0x4a9686['type'][_0xd568('0x31')]};});_0x1ecbaa[_0xd568('0x32')]=_[_0xd568('0x2e')](_0x5bf089,'name');_0x1ecbaa['query']=_[_0xd568('0x33')](_0x5be1a7[_0xd568('0x34')]);_0x1ecbaa['filters']=_[_0xd568('0x35')](_0x1ecbaa[_0xd568('0x32')],_0x1ecbaa['query']);_0x56fe6e['attributes']=_[_0xd568('0x35')](_0x1ecbaa[_0xd568('0x32')],qs[_0xd568('0x36')](_0x5be1a7['query'][_0xd568('0x36')]));_0x56fe6e[_0xd568('0x37')]=_0x56fe6e[_0xd568('0x37')][_0xd568('0x38')]?_0x56fe6e[_0xd568('0x37')]:_0x1ecbaa['model'];if(!_0x5be1a7[_0xd568('0x34')]['hasOwnProperty'](_0xd568('0x39'))){_0x56fe6e[_0xd568('0x1d')]=qs[_0xd568('0x1d')](_0x5be1a7[_0xd568('0x34')][_0xd568('0x1d')]);_0x56fe6e['offset']=qs[_0xd568('0x1b')](_0x5be1a7[_0xd568('0x34')][_0xd568('0x1b')]);}_0x56fe6e[_0xd568('0x3a')]=qs[_0xd568('0x3b')](_0x5be1a7[_0xd568('0x34')][_0xd568('0x3b')]);_0x56fe6e[_0xd568('0x3c')]=qs['filters'](_[_0xd568('0x3d')](_0x5be1a7[_0xd568('0x34')],_0x1ecbaa[_0xd568('0x3e')]),_0x5bf089);if(_0x5be1a7[_0xd568('0x34')][_0xd568('0x3f')]){_0x56fe6e['where']=_[_0xd568('0x40')](_0x56fe6e[_0xd568('0x3c')],{'$or':_['map'](_0x5bf089,function(_0x2cc85e){if(_0x2cc85e[_0xd568('0x41')]!==_0xd568('0x42')){var _0x589ceb={};_0x589ceb[_0x2cc85e[_0xd568('0x2b')]]={'$like':'%'+_0x5be1a7[_0xd568('0x34')][_0xd568('0x3f')]+'%'};return _0x589ceb;}})});}_0x56fe6e=_['merge']({},_0x56fe6e,_0x5be1a7[_0xd568('0x43')]);var _0x27585b={'where':_0x56fe6e[_0xd568('0x3c')]};return db[_0xd568('0x2f')][_0xd568('0x1e')](_0x27585b)[_0xd568('0x24')](function(_0x496138){_0x64381e[_0xd568('0x1e')]=_0x496138;if(_0x5be1a7[_0xd568('0x34')][_0xd568('0x44')]){_0x56fe6e['include']=[{'all':!![]}];}return db['Pause'][_0xd568('0x45')](_0x56fe6e);})[_0xd568('0x24')](function(_0x23c80a){_0x64381e[_0xd568('0x46')]=_0x23c80a;return _0x64381e;})[_0xd568('0x24')](respondWithFilteredResult(_0x4bf1b9,_0x56fe6e))[_0xd568('0x47')](handleError(_0x4bf1b9,null));};exports['show']=function(_0x7e7b5d,_0x5e7390){var _0x1325bf={'raw':!![],'where':{'id':_0x7e7b5d[_0xd568('0x48')]['id']}},_0x4e2e8c={};_0x4e2e8c[_0xd568('0x32')]=_['keys'](db['Pause']['rawAttributes']);_0x4e2e8c['query']=_[_0xd568('0x33')](_0x7e7b5d[_0xd568('0x34')]);_0x4e2e8c[_0xd568('0x3e')]=_[_0xd568('0x35')](_0x4e2e8c[_0xd568('0x32')],_0x4e2e8c[_0xd568('0x34')]);_0x1325bf['attributes']=_[_0xd568('0x35')](_0x4e2e8c['model'],qs[_0xd568('0x36')](_0x7e7b5d['query'][_0xd568('0x36')]));_0x1325bf['attributes']=_0x1325bf[_0xd568('0x37')][_0xd568('0x38')]?_0x1325bf[_0xd568('0x37')]:_0x4e2e8c[_0xd568('0x32')];if(_0x7e7b5d['query']['includeAll']){_0x1325bf[_0xd568('0x49')]=[{'all':!![]}];}_0x1325bf=_[_0xd568('0x40')]({},_0x1325bf,_0x7e7b5d['options']);return db['Pause'][_0xd568('0x4a')](_0x1325bf)['then'](handleEntityNotFound(_0x5e7390,null))['then'](respondWithResult(_0x5e7390,null))['catch'](handleError(_0x5e7390,null));};exports[_0xd568('0x4b')]=function(_0x4f9b15,_0xbfba8b){return db[_0xd568('0x2f')][_0xd568('0x4b')](_0x4f9b15['body'],{})['then'](function(_0x5ad4bc){var _0x365543=_0x4f9b15[_0xd568('0x4c')][_0xd568('0x25')]({'plain':!![]});if(!_0x365543)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x365543[_0xd568('0x4d')]===_0xd568('0x4c')){var _0x3a45e8=_0x5ad4bc['get']({'plain':!![]});var _0x201f4='Pauses';return db[_0xd568('0x4e')][_0xd568('0x4a')]({'where':{'name':_0x201f4,'userProfileId':_0x365543[_0xd568('0x4f')]},'raw':!![]})[_0xd568('0x24')](function(_0x2fe2b4){if(_0x2fe2b4&&_0x2fe2b4[_0xd568('0x50')]===0x0){return db['UserProfileResource'][_0xd568('0x4b')]({'name':_0x3a45e8['name'],'resourceId':_0x3a45e8['id'],'type':_0x2fe2b4[_0xd568('0x2b')],'sectionId':_0x2fe2b4['id']},{})[_0xd568('0x24')](function(){return _0x5ad4bc;});}else{return _0x5ad4bc;}})['catch'](function(_0x4dfa34){logger[_0xd568('0x29')](_0xd568('0x51'),_0x4dfa34);throw _0x4dfa34;});}return _0x5ad4bc;})['then'](respondWithResult(_0xbfba8b,0xc9))[_0xd568('0x47')](handleError(_0xbfba8b,null));};exports[_0xd568('0x23')]=function(_0x47f17e,_0xe61a34){if(_0x47f17e[_0xd568('0x52')]['id']){delete _0x47f17e[_0xd568('0x52')]['id'];}return db[_0xd568('0x2f')][_0xd568('0x4a')]({'where':{'id':_0x47f17e[_0xd568('0x48')]['id']}})['then'](handleEntityNotFound(_0xe61a34,null))['then'](saveUpdates(_0x47f17e[_0xd568('0x52')],null))[_0xd568('0x24')](respondWithResult(_0xe61a34,null))['catch'](handleError(_0xe61a34,null));};exports[_0xd568('0x28')]=function(_0x1653ff,_0x1e8618){return db[_0xd568('0x2f')][_0xd568('0x4a')]({'where':{'id':_0x1653ff['params']['id']}})[_0xd568('0x24')](handleEntityNotFound(_0x1e8618,null))['then'](removeEntity(_0x1e8618,null))[_0xd568('0x47')](handleError(_0x1e8618,null));}; \ No newline at end of file +var _0x099d=['filter','merge','map','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','end','error','stack','name','Pause','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x1ab499,_0x55db28){var _0x387e12=function(_0x1dec33){while(--_0x1dec33){_0x1ab499['push'](_0x1ab499['shift']());}};_0x387e12(++_0x55db28);}(_0x099d,0x15c));var _0xd099=function(_0x3f678e,_0x22b9b8){_0x3f678e=_0x3f678e-0x0;var _0xf4160e=_0x099d[_0x3f678e];return _0xf4160e;};'use strict';var emlformat=require(_0xd099('0x0'));var rimraf=require(_0xd099('0x1'));var zipdir=require(_0xd099('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd099('0x3'));var moment=require(_0xd099('0x4'));var BPromise=require(_0xd099('0x5'));var Mustache=require(_0xd099('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd099('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd099('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd099('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd099('0xa'));var toCsv=require(_0xd099('0x7'));var querystring=require(_0xd099('0xb'));var Papa=require(_0xd099('0xc'));var Redis=require(_0xd099('0xd'));var authService=require(_0xd099('0xe'));var qs=require(_0xd099('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd099('0x10'));var logger=require(_0xd099('0x11'))('api');var utils=require(_0xd099('0x12'));var config=require(_0xd099('0x13'));var licenseUtil=require(_0xd099('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x284cf0,_0x31f2c8){_0x31f2c8=_0x31f2c8||0xcc;return function(_0x5d717e){if(_0x5d717e){return _0x284cf0[_0xd099('0x15')](_0x31f2c8);}return _0x284cf0[_0xd099('0x16')](_0x31f2c8)['end']();};}function respondWithResult(_0x59fb7c,_0x51f984){_0x51f984=_0x51f984||0xc8;return function(_0x4780da){if(_0x4780da){return _0x59fb7c[_0xd099('0x16')](_0x51f984)[_0xd099('0x17')](_0x4780da);}};}function respondWithFilteredResult(_0x51cb5a,_0x2a466b){return function(_0x2942df){if(_0x2942df){var _0x335564=typeof _0x2a466b[_0xd099('0x18')]==='undefined'&&typeof _0x2a466b['limit']==='undefined';var _0xbd8ed1=_0x2942df[_0xd099('0x19')];var _0x1fee48=_0x335564?0x0:_0x2a466b[_0xd099('0x18')];var _0x3464c4=_0x335564?_0x2942df[_0xd099('0x19')]:_0x2a466b[_0xd099('0x18')]+_0x2a466b[_0xd099('0x1a')];var _0x5629a7;if(_0x3464c4>=_0xbd8ed1){_0x3464c4=_0xbd8ed1;_0x5629a7=0xc8;}else{_0x5629a7=0xce;}_0x51cb5a[_0xd099('0x16')](_0x5629a7);return _0x51cb5a[_0xd099('0x1b')](_0xd099('0x1c'),_0x1fee48+'-'+_0x3464c4+'/'+_0xbd8ed1)['json'](_0x2942df);}return null;};}function patchUpdates(_0x271248){return function(_0x46d80d){try{jsonpatch[_0xd099('0x1d')](_0x46d80d,_0x271248,!![]);}catch(_0x2993b9){return BPromise[_0xd099('0x1e')](_0x2993b9);}return _0x46d80d['save']();};}function saveUpdates(_0x7c3c9f,_0x19ad54){return function(_0x26c63d){if(_0x26c63d){return _0x26c63d[_0xd099('0x1f')](_0x7c3c9f)[_0xd099('0x20')](function(_0x539974){return _0x539974;});}return null;};}function removeEntity(_0x404a35,_0x22cd1b){return function(_0x5e740d){if(_0x5e740d){return _0x5e740d[_0xd099('0x21')]()[_0xd099('0x20')](function(){var _0x55a3e8=_0x5e740d['get']({'plain':!![]});var _0x1594bd='Pauses';return db[_0xd099('0x22')][_0xd099('0x21')]({'where':{'type':_0x1594bd,'resourceId':_0x55a3e8['id']}})[_0xd099('0x20')](function(){return _0x5e740d;});})[_0xd099('0x20')](function(){_0x404a35[_0xd099('0x16')](0xcc)[_0xd099('0x23')]();});}};}function handleEntityNotFound(_0x31f6d3,_0xf4b435){return function(_0x2cf4e2){if(!_0x2cf4e2){_0x31f6d3['sendStatus'](0x194);}return _0x2cf4e2;};}function handleError(_0x5550a4,_0x5694c7){_0x5694c7=_0x5694c7||0x1f4;return function(_0x594282){logger[_0xd099('0x24')](_0x594282[_0xd099('0x25')]);if(_0x594282[_0xd099('0x26')]){delete _0x594282[_0xd099('0x26')];}_0x5550a4[_0xd099('0x16')](_0x5694c7)['send'](_0x594282);};}exports['index']=function(_0x254469,_0x2b0453){var _0x31ff8a={},_0x33a36d={},_0x276f3e={'count':0x0,'rows':[]};var _0x802fa7=_['map'](db[_0xd099('0x27')][_0xd099('0x28')],function(_0x4287cd){return{'name':_0x4287cd[_0xd099('0x29')],'type':_0x4287cd[_0xd099('0x2a')][_0xd099('0x2b')]};});_0x33a36d['model']=_['map'](_0x802fa7,_0xd099('0x26'));_0x33a36d[_0xd099('0x2c')]=_[_0xd099('0x2d')](_0x254469[_0xd099('0x2c')]);_0x33a36d['filters']=_[_0xd099('0x2e')](_0x33a36d[_0xd099('0x2f')],_0x33a36d[_0xd099('0x2c')]);_0x31ff8a[_0xd099('0x30')]=_[_0xd099('0x2e')](_0x33a36d['model'],qs['fields'](_0x254469['query'][_0xd099('0x31')]));_0x31ff8a[_0xd099('0x30')]=_0x31ff8a[_0xd099('0x30')][_0xd099('0x32')]?_0x31ff8a[_0xd099('0x30')]:_0x33a36d[_0xd099('0x2f')];if(!_0x254469[_0xd099('0x2c')][_0xd099('0x33')](_0xd099('0x34'))){_0x31ff8a[_0xd099('0x1a')]=qs[_0xd099('0x1a')](_0x254469[_0xd099('0x2c')][_0xd099('0x1a')]);_0x31ff8a[_0xd099('0x18')]=qs['offset'](_0x254469[_0xd099('0x2c')]['offset']);}_0x31ff8a[_0xd099('0x35')]=qs[_0xd099('0x36')](_0x254469['query'][_0xd099('0x36')]);_0x31ff8a[_0xd099('0x37')]=qs[_0xd099('0x38')](_['pick'](_0x254469['query'],_0x33a36d[_0xd099('0x38')]),_0x802fa7);if(_0x254469['query'][_0xd099('0x39')]){_0x31ff8a[_0xd099('0x37')]=_[_0xd099('0x3a')](_0x31ff8a[_0xd099('0x37')],{'$or':_[_0xd099('0x3b')](_0x802fa7,function(_0x408ae9){if(_0x408ae9[_0xd099('0x2a')]!==_0xd099('0x3c')){var _0x1ecf40={};_0x1ecf40[_0x408ae9[_0xd099('0x26')]]={'$like':'%'+_0x254469['query']['filter']+'%'};return _0x1ecf40;}})});}_0x31ff8a=_['merge']({},_0x31ff8a,_0x254469['options']);var _0x289592={'where':_0x31ff8a[_0xd099('0x37')]};return db[_0xd099('0x27')][_0xd099('0x19')](_0x289592)['then'](function(_0x9f0fe4){_0x276f3e[_0xd099('0x19')]=_0x9f0fe4;if(_0x254469[_0xd099('0x2c')]['includeAll']){_0x31ff8a[_0xd099('0x3d')]=[{'all':!![]}];}return db[_0xd099('0x27')][_0xd099('0x3e')](_0x31ff8a);})[_0xd099('0x20')](function(_0x455a7){_0x276f3e[_0xd099('0x3f')]=_0x455a7;return _0x276f3e;})['then'](respondWithFilteredResult(_0x2b0453,_0x31ff8a))[_0xd099('0x40')](handleError(_0x2b0453,null));};exports[_0xd099('0x41')]=function(_0x47f279,_0x220589){var _0x5d2c75={'raw':!![],'where':{'id':_0x47f279[_0xd099('0x42')]['id']}},_0x45e016={};_0x45e016[_0xd099('0x2f')]=_[_0xd099('0x2d')](db[_0xd099('0x27')][_0xd099('0x28')]);_0x45e016[_0xd099('0x2c')]=_['keys'](_0x47f279[_0xd099('0x2c')]);_0x45e016[_0xd099('0x38')]=_['intersection'](_0x45e016['model'],_0x45e016[_0xd099('0x2c')]);_0x5d2c75['attributes']=_[_0xd099('0x2e')](_0x45e016[_0xd099('0x2f')],qs[_0xd099('0x31')](_0x47f279[_0xd099('0x2c')][_0xd099('0x31')]));_0x5d2c75[_0xd099('0x30')]=_0x5d2c75['attributes'][_0xd099('0x32')]?_0x5d2c75[_0xd099('0x30')]:_0x45e016[_0xd099('0x2f')];if(_0x47f279[_0xd099('0x2c')][_0xd099('0x43')]){_0x5d2c75[_0xd099('0x3d')]=[{'all':!![]}];}_0x5d2c75=_['merge']({},_0x5d2c75,_0x47f279[_0xd099('0x44')]);return db[_0xd099('0x27')][_0xd099('0x45')](_0x5d2c75)['then'](handleEntityNotFound(_0x220589,null))[_0xd099('0x20')](respondWithResult(_0x220589,null))['catch'](handleError(_0x220589,null));};exports[_0xd099('0x46')]=function(_0x478a79,_0x38a449){return db[_0xd099('0x27')][_0xd099('0x46')](_0x478a79[_0xd099('0x47')],{})[_0xd099('0x20')](function(_0x54e2ab){var _0xded7ae=_0x478a79[_0xd099('0x48')][_0xd099('0x49')]({'plain':!![]});if(!_0xded7ae)throw new Error(_0xd099('0x4a'));if(_0xded7ae[_0xd099('0x4b')]===_0xd099('0x48')){var _0x21868e=_0x54e2ab[_0xd099('0x49')]({'plain':!![]});var _0x128c82=_0xd099('0x4c');return db[_0xd099('0x4d')][_0xd099('0x45')]({'where':{'name':_0x128c82,'userProfileId':_0xded7ae[_0xd099('0x4e')]},'raw':!![]})[_0xd099('0x20')](function(_0x94f98e){if(_0x94f98e&&_0x94f98e[_0xd099('0x4f')]===0x0){return db[_0xd099('0x22')]['create']({'name':_0x21868e['name'],'resourceId':_0x21868e['id'],'type':_0x94f98e['name'],'sectionId':_0x94f98e['id']},{})[_0xd099('0x20')](function(){return _0x54e2ab;});}else{return _0x54e2ab;}})[_0xd099('0x40')](function(_0x13ff30){logger[_0xd099('0x24')](_0xd099('0x50'),_0x13ff30);throw _0x13ff30;});}return _0x54e2ab;})[_0xd099('0x20')](respondWithResult(_0x38a449,0xc9))['catch'](handleError(_0x38a449,null));};exports[_0xd099('0x1f')]=function(_0x5374b9,_0x14c379){if(_0x5374b9[_0xd099('0x47')]['id']){delete _0x5374b9[_0xd099('0x47')]['id'];}return db['Pause']['find']({'where':{'id':_0x5374b9[_0xd099('0x42')]['id']}})['then'](handleEntityNotFound(_0x14c379,null))[_0xd099('0x20')](saveUpdates(_0x5374b9[_0xd099('0x47')],null))[_0xd099('0x20')](respondWithResult(_0x14c379,null))['catch'](handleError(_0x14c379,null));};exports['destroy']=function(_0x45579d,_0x637cca){return db[_0xd099('0x27')][_0xd099('0x45')]({'where':{'id':_0x45579d[_0xd099('0x42')]['id']}})[_0xd099('0x20')](handleEntityNotFound(_0x637cca,null))[_0xd099('0x20')](removeEntity(_0x637cca,null))['catch'](handleError(_0x637cca,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index cf84e91..67bbc3c 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 _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0xd5f326,_0x1942b4){var _0x5d0867=function(_0x4f9d41){while(--_0x4f9d41){_0xd5f326['push'](_0xd5f326['shift']());}};_0x5d0867(++_0x1942b4);}(_0x8ef6,0xf2));var _0x68ef=function(_0x53487d,_0x18ebb4){_0x53487d=_0x53487d-0x0;var _0x22c1a0=_0x8ef6[_0x53487d];return _0x22c1a0;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x59e5cb,_0x2b209a){_0x59e5cb=_0x59e5cb-0x0;var _0x4e69c1=_0x7fbe[_0x59e5cb];return _0x4e69c1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 5c5cc44..befb52a 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(_0x2f58b8,_0x425326){var _0x1229c4=function(_0x4367bc){while(--_0x4367bc){_0x2f58b8['push'](_0x2f58b8['shift']());}};_0x1229c4(++_0x425326);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e2c70,_0x108e64){_0x5e2c70=_0x5e2c70-0x0;var _0x1e6cbc=_0xb10b[_0x5e2c70];return _0x1e6cbc;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x390af3,_0x26eb36){var _0x16d54e=function(_0x19df58){while(--_0x19df58){_0x390af3['push'](_0x390af3['shift']());}};_0x16d54e(++_0x26eb36);}(_0x7a54,0x106));var _0x47a5=function(_0x2faf7d,_0x3c46ba){_0x2faf7d=_0x2faf7d-0x0;var _0x3b4d5c=_0x7a54[_0x2faf7d];return _0x3b4d5c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 377b76c..151e8e9 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 _0x6334=['../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','show','/:id/download','download','diskStorage','join','root','format','%s-%s%s','extname','now','originalname','post','file','upload','webhookPost','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x428d0f,_0x44488c){var _0x405a0a=function(_0x5aed15){while(--_0x5aed15){_0x428d0f['push'](_0x428d0f['shift']());}};_0x405a0a(++_0x44488c);}(_0x6334,0x119));var _0x4633=function(_0x1cdb2d,_0x8f1f76){_0x1cdb2d=_0x1cdb2d-0x0;var _0x4dafe3=_0x6334[_0x1cdb2d];return _0x4dafe3;};'use strict';var multer=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var path=require(_0x4633('0x2'));var timeout=require(_0x4633('0x3'));var express=require(_0x4633('0x4'));var router=express[_0x4633('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4633('0x6'));var interaction=require(_0x4633('0x7'));var config=require(_0x4633('0x8'));var controller=require(_0x4633('0x9'));router[_0x4633('0xa')]('/',auth[_0x4633('0xb')](),controller[_0x4633('0xc')]);router['get'](_0x4633('0xd'),controller['webhookGet']);router[_0x4633('0xa')](_0x4633('0xe'),auth['isAuthenticated'](),controller[_0x4633('0xf')]);router[_0x4633('0xa')](_0x4633('0x10'),auth['isAuthenticated'](),controller[_0x4633('0x11')]);var upload=multer({'storage':multer[_0x4633('0x12')]({'destination':function(_0x5157a7,_0x6a63b,_0x3d5182){_0x3d5182(null,path[_0x4633('0x13')](config[_0x4633('0x14')],'server/files/plugins'));},'filename':function(_0x73b5e4,_0xad405,_0x438e87){_0xad405['originalname']=_0xad405['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x438e87(null,util[_0x4633('0x15')](_0x4633('0x16'),path['basename'](_0xad405['originalname'],path[_0x4633('0x17')](_0xad405['originalname'])),Date[_0x4633('0x18')](),path[_0x4633('0x17')](_0xad405[_0x4633('0x19')])));}})});router[_0x4633('0x1a')]('/',upload['single'](_0x4633('0x1b')),controller[_0x4633('0x1c')]);router[_0x4633('0x1a')]('/webhook',controller[_0x4633('0x1d')]);router[_0x4633('0x1e')](_0x4633('0xe'),auth[_0x4633('0xb')](),controller[_0x4633('0x1f')]);router['delete'](_0x4633('0xe'),auth[_0x4633('0xb')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0xb458=['show','/:id/download','diskStorage','server/files/plugins','originalname','replace','format','%s-%s%s','basename','now','extname','post','single','file','upload','webhookPost','put','/:id','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','index','get','/webhook','webhookGet','isAuthenticated'];(function(_0x4f1aef,_0xd5aa75){var _0x34e8e7=function(_0x18edf7){while(--_0x18edf7){_0x4f1aef['push'](_0x4f1aef['shift']());}};_0x34e8e7(++_0xd5aa75);}(_0xb458,0x103));var _0x8b45=function(_0x447813,_0x25cabb){_0x447813=_0x447813-0x0;var _0x913e49=_0xb458[_0x447813];return _0x913e49;};'use strict';var multer=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b45('0x3')]();var fs_extra=require(_0x8b45('0x4'));var auth=require(_0x8b45('0x5'));var interaction=require(_0x8b45('0x6'));var config=require('../../config/environment');var controller=require(_0x8b45('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x8b45('0x8')]);router[_0x8b45('0x9')](_0x8b45('0xa'),controller[_0x8b45('0xb')]);router[_0x8b45('0x9')]('/:id',auth[_0x8b45('0xc')](),controller[_0x8b45('0xd')]);router[_0x8b45('0x9')](_0x8b45('0xe'),auth[_0x8b45('0xc')](),controller['download']);var upload=multer({'storage':multer[_0x8b45('0xf')]({'destination':function(_0x7cc49b,_0x57faf9,_0x5316af){_0x5316af(null,path['join'](config['root'],_0x8b45('0x10')));},'filename':function(_0x285728,_0x37c220,_0x52c4db){_0x37c220[_0x8b45('0x11')]=_0x37c220[_0x8b45('0x11')][_0x8b45('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52c4db(null,util[_0x8b45('0x13')](_0x8b45('0x14'),path[_0x8b45('0x15')](_0x37c220['originalname'],path['extname'](_0x37c220[_0x8b45('0x11')])),Date[_0x8b45('0x16')](),path[_0x8b45('0x17')](_0x37c220[_0x8b45('0x11')])));}})});router[_0x8b45('0x18')]('/',upload[_0x8b45('0x19')](_0x8b45('0x1a')),controller[_0x8b45('0x1b')]);router[_0x8b45('0x18')](_0x8b45('0xa'),controller[_0x8b45('0x1c')]);router[_0x8b45('0x1d')](_0x8b45('0x1e'),auth[_0x8b45('0xc')](),controller[_0x8b45('0x1f')]);router[_0x8b45('0x20')](_0x8b45('0x1e'),auth[_0x8b45('0xc')](),controller['delete']);module[_0x8b45('0x21')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index cc38ec5..5eb7772 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 _0x39f3=['exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x39f3,0x82));var _0x339f=function(_0x1f64ec,_0x15558a){_0x1f64ec=_0x1f64ec-0x0;var _0x57e1dd=_0x39f3[_0x1f64ec];return _0x57e1dd;};'use strict';var Sequelize=require('sequelize');module[_0x339f('0x0')]={'name':{'type':Sequelize[_0x339f('0x1')]},'type':{'type':Sequelize[_0x339f('0x2')](_0x339f('0x3'),'script')},'description':{'type':Sequelize[_0x339f('0x4')]},'version':{'type':Sequelize[_0x339f('0x4')]},'path':{'type':Sequelize[_0x339f('0x1')],'comment':_0x339f('0x5')},'active':{'type':Sequelize[_0x339f('0x6')],'defaultValue':0x0,'comment':_0x339f('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x339f('0x8'),_0x339f('0x9'),'always',_0x339f('0xa')),'defaultValue':_0x339f('0xb'),'comment':_0x339f('0xc')},'icon':{'type':Sequelize[_0x339f('0x1')]},'adminUrl':{'type':Sequelize[_0x339f('0x1')]},'agentUrl':{'type':Sequelize[_0x339f('0x1')]},'scriptName':{'type':Sequelize[_0x339f('0x1')]},'scriptPath':{'type':Sequelize[_0x339f('0x1')]}}; \ No newline at end of file +var _0xb23a=['BOOLEAN','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0xb23a,0x1c0));var _0xab23=function(_0x44c62a,_0x55be84){_0x44c62a=_0x44c62a-0x0;var _0x33ec0d=_0xb23a[_0x44c62a];return _0x33ec0d;};'use strict';var Sequelize=require(_0xab23('0x0'));module[_0xab23('0x1')]={'name':{'type':Sequelize[_0xab23('0x2')]},'type':{'type':Sequelize[_0xab23('0x3')](_0xab23('0x4'),'script')},'description':{'type':Sequelize[_0xab23('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xab23('0x2')],'comment':_0xab23('0x6')},'active':{'type':Sequelize[_0xab23('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0xab23('0x8'),_0xab23('0x9'),_0xab23('0xa'),_0xab23('0xb')),'defaultValue':_0xab23('0xa'),'comment':_0xab23('0xc')},'icon':{'type':Sequelize[_0xab23('0x2')]},'adminUrl':{'type':Sequelize[_0xab23('0x2')]},'agentUrl':{'type':Sequelize[_0xab23('0x2')]},'scriptName':{'type':Sequelize[_0xab23('0x2')]},'scriptPath':{'type':Sequelize[_0xab23('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index e3a7e2f..57a3243 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 _0xbb98=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','download','join','root','server/files/plugins','createWriteStream','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','error','Error','glob','**/*','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','Invalid\x20plugin\x20structure','isDirectory','some','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','plugins','test','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','format','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','http://localhost:','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','then','destroy','Plugins','UserProfileResource','stack','name','index','map','Plugin','rawAttributes'];(function(_0x3438bf,_0x52f78e){var _0x1b08a0=function(_0x450208){while(--_0x450208){_0x3438bf['push'](_0x3438bf['shift']());}};_0x1b08a0(++_0x52f78e);}(_0xbb98,0x1b5));var _0x8bb9=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xbb98[_0x5ddaac];return _0x2a9c58;};'use strict';var emlformat=require(_0x8bb9('0x0'));var rimraf=require(_0x8bb9('0x1'));var zipdir=require(_0x8bb9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8bb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8bb9('0x4'));var util=require(_0x8bb9('0x5'));var path=require(_0x8bb9('0x6'));var sox=require(_0x8bb9('0x7'));var csv=require('to-csv');var ejs=require(_0x8bb9('0x8'));var fs=require('fs');var fs_extra=require(_0x8bb9('0x9'));var _=require(_0x8bb9('0xa'));var squel=require(_0x8bb9('0xb'));var crypto=require('crypto');var jsforce=require(_0x8bb9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8bb9('0xd'));var querystring=require(_0x8bb9('0xe'));var Papa=require(_0x8bb9('0xf'));var extract=require(_0x8bb9('0x10'));var rimraf=require(_0x8bb9('0x1'));var archiver=require(_0x8bb9('0x11'));var Redis=require(_0x8bb9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8bb9('0x13'));var as=require(_0x8bb9('0x14'));var hardwareService=require(_0x8bb9('0x15'));var logger=require(_0x8bb9('0x16'))(_0x8bb9('0x17'));var utils=require('../../config/utils');var config=require(_0x8bb9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8bb9('0x19'))['db'];config[_0x8bb9('0x1a')]=_[_0x8bb9('0x1b')](config[_0x8bb9('0x1a')],{'host':_0x8bb9('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8bb9('0x1a')]));require(_0x8bb9('0x1d'))[_0x8bb9('0x1e')](socket);function respondWithStatusCode(_0x13f898,_0x358d30){_0x358d30=_0x358d30||0xcc;return function(_0x232423){if(_0x232423){return _0x13f898[_0x8bb9('0x1f')](_0x358d30);}return _0x13f898[_0x8bb9('0x20')](_0x358d30)[_0x8bb9('0x21')]();};}function respondWithResult(_0xeb3248,_0x4bd9cd){_0x4bd9cd=_0x4bd9cd||0xc8;return function(_0xeb4f16){if(_0xeb4f16){return _0xeb3248[_0x8bb9('0x20')](_0x4bd9cd)[_0x8bb9('0x22')](_0xeb4f16);}};}function respondWithFilteredResult(_0x3f23fa,_0x28484b){return function(_0x399d43){if(_0x399d43){var _0x133a3c=typeof _0x28484b[_0x8bb9('0x23')]===_0x8bb9('0x24')&&typeof _0x28484b[_0x8bb9('0x25')]===_0x8bb9('0x24');var _0x21c7bf=_0x399d43[_0x8bb9('0x26')];var _0x30315d=_0x133a3c?0x0:_0x28484b['offset'];var _0x15f7c0=_0x133a3c?_0x399d43['count']:_0x28484b[_0x8bb9('0x23')]+_0x28484b['limit'];var _0xf94c0f;if(_0x15f7c0>=_0x21c7bf){_0x15f7c0=_0x21c7bf;_0xf94c0f=0xc8;}else{_0xf94c0f=0xce;}_0x3f23fa[_0x8bb9('0x20')](_0xf94c0f);return _0x3f23fa[_0x8bb9('0x27')]('Content-Range',_0x30315d+'-'+_0x15f7c0+'/'+_0x21c7bf)[_0x8bb9('0x22')](_0x399d43);}return null;};}function patchUpdates(_0x2c4b49){return function(_0x434747){try{jsonpatch['apply'](_0x434747,_0x2c4b49,!![]);}catch(_0x354451){return BPromise['reject'](_0x354451);}return _0x434747[_0x8bb9('0x28')]();};}function saveUpdates(_0x1ba9e1,_0x5e43a8){return function(_0x396724){if(_0x396724){return _0x396724[_0x8bb9('0x29')](_0x1ba9e1)[_0x8bb9('0x2a')](function(_0x41640f){return _0x41640f;});}return null;};}function removeEntity(_0x46b383,_0x382bb9){return function(_0x350e59){if(_0x350e59){return _0x350e59[_0x8bb9('0x2b')]()[_0x8bb9('0x2a')](function(){var _0xeeab6=_0x350e59['get']({'plain':!![]});var _0x4639b3=_0x8bb9('0x2c');return db[_0x8bb9('0x2d')][_0x8bb9('0x2b')]({'where':{'type':_0x4639b3,'resourceId':_0xeeab6['id']}})[_0x8bb9('0x2a')](function(){return _0x350e59;});})['then'](function(){_0x46b383[_0x8bb9('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ee559,_0x40df19){return function(_0x2af387){if(!_0x2af387){_0x3ee559[_0x8bb9('0x1f')](0x194);}return _0x2af387;};}function handleError(_0x314755,_0x30b8a1){_0x30b8a1=_0x30b8a1||0x1f4;return function(_0x4a1eab){logger['error'](_0x4a1eab[_0x8bb9('0x2e')]);if(_0x4a1eab[_0x8bb9('0x2f')]){delete _0x4a1eab[_0x8bb9('0x2f')];}_0x314755[_0x8bb9('0x20')](_0x30b8a1)['send'](_0x4a1eab);};}exports[_0x8bb9('0x30')]=function(_0xccc3b6,_0x23a251){var _0x29c5dd={},_0x422090={},_0x31d8c5={'count':0x0,'rows':[]};var _0x17f7d2=_[_0x8bb9('0x31')](db[_0x8bb9('0x32')][_0x8bb9('0x33')],function(_0x327c6a){return{'name':_0x327c6a['fieldName'],'type':_0x327c6a[_0x8bb9('0x34')][_0x8bb9('0x35')]};});_0x422090[_0x8bb9('0x36')]=_[_0x8bb9('0x31')](_0x17f7d2,_0x8bb9('0x2f'));_0x422090[_0x8bb9('0x37')]=_[_0x8bb9('0x38')](_0xccc3b6[_0x8bb9('0x37')]);_0x422090[_0x8bb9('0x39')]=_[_0x8bb9('0x3a')](_0x422090[_0x8bb9('0x36')],_0x422090[_0x8bb9('0x37')]);_0x29c5dd[_0x8bb9('0x3b')]=_['intersection'](_0x422090[_0x8bb9('0x36')],qs[_0x8bb9('0x3c')](_0xccc3b6['query']['fields']));_0x29c5dd['attributes']=_0x29c5dd['attributes'][_0x8bb9('0x3d')]?_0x29c5dd[_0x8bb9('0x3b')]:_0x422090[_0x8bb9('0x36')];if(!_0xccc3b6['query'][_0x8bb9('0x3e')](_0x8bb9('0x3f'))){_0x29c5dd['limit']=qs[_0x8bb9('0x25')](_0xccc3b6[_0x8bb9('0x37')][_0x8bb9('0x25')]);_0x29c5dd[_0x8bb9('0x23')]=qs[_0x8bb9('0x23')](_0xccc3b6[_0x8bb9('0x37')]['offset']);}_0x29c5dd[_0x8bb9('0x40')]=qs['sort'](_0xccc3b6[_0x8bb9('0x37')][_0x8bb9('0x41')]);_0x29c5dd[_0x8bb9('0x42')]=qs[_0x8bb9('0x39')](_['pick'](_0xccc3b6[_0x8bb9('0x37')],_0x422090[_0x8bb9('0x39')]),_0x17f7d2);if(_0xccc3b6[_0x8bb9('0x37')][_0x8bb9('0x43')]){_0x29c5dd[_0x8bb9('0x42')]=_[_0x8bb9('0x44')](_0x29c5dd[_0x8bb9('0x42')],{'$or':_[_0x8bb9('0x31')](_0x17f7d2,function(_0x2ab5c6){if(_0x2ab5c6[_0x8bb9('0x34')]!==_0x8bb9('0x45')){var _0x37ab6d={};_0x37ab6d[_0x2ab5c6[_0x8bb9('0x2f')]]={'$like':'%'+_0xccc3b6[_0x8bb9('0x37')][_0x8bb9('0x43')]+'%'};return _0x37ab6d;}})});}_0x29c5dd=_[_0x8bb9('0x44')]({},_0x29c5dd,_0xccc3b6[_0x8bb9('0x46')]);var _0xe3f5de={'where':_0x29c5dd[_0x8bb9('0x42')]};return db[_0x8bb9('0x32')][_0x8bb9('0x26')](_0xe3f5de)[_0x8bb9('0x2a')](function(_0x1e8fce){_0x31d8c5['count']=_0x1e8fce;if(_0xccc3b6['query'][_0x8bb9('0x47')]){_0x29c5dd[_0x8bb9('0x48')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x29c5dd);})[_0x8bb9('0x2a')](function(_0xd3c4b){_0x31d8c5['rows']=_0xd3c4b;return _0x31d8c5;})[_0x8bb9('0x2a')](respondWithFilteredResult(_0x23a251,_0x29c5dd))[_0x8bb9('0x49')](handleError(_0x23a251,null));};exports[_0x8bb9('0x4a')]=function(_0x31c3e0,_0x4bf171){var _0x3b2615={'raw':!![],'where':{'id':_0x31c3e0[_0x8bb9('0x4b')]['id']}},_0x500d62={};_0x500d62['model']=_[_0x8bb9('0x38')](db[_0x8bb9('0x32')][_0x8bb9('0x33')]);_0x500d62[_0x8bb9('0x37')]=_[_0x8bb9('0x38')](_0x31c3e0['query']);_0x500d62[_0x8bb9('0x39')]=_[_0x8bb9('0x3a')](_0x500d62[_0x8bb9('0x36')],_0x500d62[_0x8bb9('0x37')]);_0x3b2615[_0x8bb9('0x3b')]=_[_0x8bb9('0x3a')](_0x500d62[_0x8bb9('0x36')],qs[_0x8bb9('0x3c')](_0x31c3e0['query'][_0x8bb9('0x3c')]));_0x3b2615[_0x8bb9('0x3b')]=_0x3b2615[_0x8bb9('0x3b')][_0x8bb9('0x3d')]?_0x3b2615[_0x8bb9('0x3b')]:_0x500d62[_0x8bb9('0x36')];if(_0x31c3e0['query'][_0x8bb9('0x47')]){_0x3b2615[_0x8bb9('0x48')]=[{'all':!![]}];}_0x3b2615=_[_0x8bb9('0x44')]({},_0x3b2615,_0x31c3e0['options']);return db[_0x8bb9('0x32')][_0x8bb9('0x4c')](_0x3b2615)[_0x8bb9('0x2a')](handleEntityNotFound(_0x4bf171,null))[_0x8bb9('0x2a')](respondWithResult(_0x4bf171,null))['catch'](handleError(_0x4bf171,null));};exports[_0x8bb9('0x4d')]=function(_0x2c0572,_0x5217a2,_0x520e9e){return db[_0x8bb9('0x32')][_0x8bb9('0x4c')]({'where':{'id':_0x2c0572['params']['id']},'attributes':[_0x8bb9('0x2f'),_0x8bb9('0x6')],'raw':!![]})[_0x8bb9('0x2a')](handleEntityNotFound(_0x5217a2,null))[_0x8bb9('0x2a')](function(_0x59f778){if(_0x59f778){var _0x5c5ace=path[_0x8bb9('0x4e')](config[_0x8bb9('0x4f')],_0x8bb9('0x50'),util['format']('%s.zip',path['basename'](_0x59f778[_0x8bb9('0x6')])));var _0x4d99ab=fs[_0x8bb9('0x51')](_0x5c5ace);var _0x547e50=archiver('zip',{'zlib':{'level':0x9}});_0x547e50['on'](_0x8bb9('0x52'),function(_0x3671a9){if(_0x3671a9[_0x8bb9('0x53')]===_0x8bb9('0x54')){logger['error'](_0x3671a9);}else{throw new db[(_0x8bb9('0x55'))]['Error'](_0x8bb9('0x56'));}});_0x547e50['on'](_0x8bb9('0x57'),function(_0x36c988){throw new db[(_0x8bb9('0x55'))][(_0x8bb9('0x58'))](_0x8bb9('0x56'));});_0x547e50['pipe'](_0x4d99ab);_0x547e50[_0x8bb9('0x59')](_0x8bb9('0x5a'),{'cwd':path[_0x8bb9('0x4e')](config[_0x8bb9('0x4f')],'server/files/plugins',path[_0x8bb9('0x5b')](_0x59f778['path'])),'ignore':[path[_0x8bb9('0x4e')](path[_0x8bb9('0x5c')](_0x59f778[_0x8bb9('0x6')]),_0x8bb9('0x5d')),path['join'](path['basename'](_0x59f778[_0x8bb9('0x6')]),_0x8bb9('0x5e'))],'nodir':!![]})[_0x8bb9('0x5f')]();_0x4d99ab['on'](_0x8bb9('0x60'),function(){if(!fs[_0x8bb9('0x61')](_0x5c5ace)){throw new db['Sequelize'][(_0x8bb9('0x58'))](_0x8bb9('0x62'));}return _0x5217a2[_0x8bb9('0x4d')](_0x5c5ace,util['format']('%s.zip',path[_0x8bb9('0x5c')](_0x59f778[_0x8bb9('0x6')])),function(_0xd076d8){if(_0xd076d8){throw new db[(_0x8bb9('0x55'))][(_0x8bb9('0x58'))](_0x8bb9('0x63'));}fs[_0x8bb9('0x64')](_0x5c5ace);logger[_0x8bb9('0x65')](_0x8bb9('0x66'));logger[_0x8bb9('0x65')](_0x8bb9('0x67'));});});}return null;})[_0x8bb9('0x49')](handleError(_0x5217a2,null));};exports['upload']=function(_0xf975db,_0x567ba4,_0x1f8e54){var _0x50c40f=path[_0x8bb9('0x5c')](_0xf975db[_0x8bb9('0x68')][_0x8bb9('0x69')],path[_0x8bb9('0x6a')](_0xf975db[_0x8bb9('0x68')][_0x8bb9('0x69')]));var _0x1e1bd2=path[_0x8bb9('0x4e')](config[_0x8bb9('0x4f')],_0x8bb9('0x50'),_0xf975db['file'][_0x8bb9('0x69')]);var _0x59a4f0=path[_0x8bb9('0x4e')](config[_0x8bb9('0x4f')],_0x8bb9('0x50'),_0x50c40f);logger[_0x8bb9('0x65')](_0x8bb9('0x6b'),_0x1e1bd2);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x59a4f0);try{fs[_0x8bb9('0x6c')](_0x1e1bd2,parseInt('0777',0x8));extract(_0x1e1bd2,{'dir':_0x59a4f0},function(_0x1f0b17){if(_0x1f0b17){logger[_0x8bb9('0x57')](_0x1f0b17);handleError(_0x1f0b17,!![]);};var _0x3a99be=fs['readdirSync'](_0x59a4f0);if(_0x3a99be[_0x8bb9('0x3d')]>0x1){removeReferences(_0x1e1bd2,_0x59a4f0);logger[_0x8bb9('0x57')](_0x8bb9('0x6d'));return _0x1f8e54(new Error('Invalid\x20plugin\x20structure'));}var _0x34ad3d=fs['lstatSync'](path[_0x8bb9('0x4e')](_0x59a4f0,_0x3a99be[0x0]));if(_0x34ad3d['isFile']()){removeReferences(_0x1e1bd2,_0x59a4f0);logger[_0x8bb9('0x57')](_0x8bb9('0x6d'));return _0x1f8e54(new Error(_0x8bb9('0x6d')));}if(_0x34ad3d[_0x8bb9('0x6e')]()){var _0x1e7c88=fs['readdirSync'](path['join'](_0x59a4f0,_0x3a99be[0x0]));if(_0x1e7c88[_0x8bb9('0x3d')]===0x0){removeReferences(_0x1e1bd2,_0x59a4f0);logger[_0x8bb9('0x57')](_0x8bb9('0x6d'));return _0x1f8e54(new Error('Invalid\x20plugin\x20structure'));}var _0x14744f=_0x1e7c88[_0x8bb9('0x6f')](function(_0x4e4471){return _0x4e4471==='manifest.json';});if(!_0x14744f){return _0x1f8e54(new Error('Plugin\x20manifest\x20missing'));}var _0xa9ebee=fs[_0x8bb9('0x70')](path[_0x8bb9('0x4e')](_0x59a4f0,_0x3a99be[0x0],_0x8bb9('0x71')));var _0x5f0199=JSON[_0x8bb9('0x72')](_0xa9ebee);if(_0x8bb9('0x24')==typeof _0x5f0199[_0x8bb9('0x2f')]){return _0x1f8e54(new Error(_0x8bb9('0x73')));}if(_0x8bb9('0x24')==typeof _0x5f0199['type']){return _0x1f8e54(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x8bb9('0x24')==typeof _0x5f0199[_0x8bb9('0x74')]){return _0x1f8e54(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x8bb9('0x24')==typeof _0x5f0199[_0x8bb9('0x75')]){return _0x1f8e54(new Error(_0x8bb9('0x76')));}if(_0x5f0199[_0x8bb9('0x34')]===_0x8bb9('0x77')){if(_0x8bb9('0x24')==typeof _0x5f0199[_0x8bb9('0x75')][_0x8bb9('0x78')]){return _0x1f8e54(new Error(_0x8bb9('0x79')));}if(_0x8bb9('0x24')==typeof _0x5f0199[_0x8bb9('0x75')]['views'][_0x8bb9('0x7a')]&&_0x8bb9('0x24')==typeof _0x5f0199[_0x8bb9('0x75')][_0x8bb9('0x78')][_0x8bb9('0x7b')]){return _0x1f8e54(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x5f0199['type']===_0x8bb9('0x7c')){if(_0x8bb9('0x24')==typeof _0x5f0199[_0x8bb9('0x75')][_0x8bb9('0x7d')]){return _0x1f8e54(new Error(_0x8bb9('0x7e')));}if(_0x8bb9('0x24')==typeof _0x5f0199[_0x8bb9('0x75')][_0x8bb9('0x7f')]){return _0x1f8e54(new Error(_0x8bb9('0x80')));}}else{return _0x1f8e54(new Error(_0x8bb9('0x81')));}var _0x35637b=_0x5f0199[_0x8bb9('0x2f')];var _0x2b5a08=_0x5f0199['description'];var _0x208e38=_0x5f0199[_0x8bb9('0x34')];var _0x1302b6=_0x5f0199[_0x8bb9('0x82')]?_0x5f0199[_0x8bb9('0x82')]:_0x8bb9('0x83');var _0x42a7cc=_0x5f0199[_0x8bb9('0x84')]?_0x5f0199[_0x8bb9('0x84')]:'icon-apps';var _0x3a6f45='';var _0x52a79e='';var _0x16da07='';var _0x12d5d3='';var _0x1e6421=_0x5f0199['version'];if(_0x208e38===_0x8bb9('0x77')){if('undefined'!=typeof _0x5f0199['parameters'][_0x8bb9('0x78')][_0x8bb9('0x7a')]){var _0x9ba1d8=_0x5f0199['parameters'][_0x8bb9('0x78')][_0x8bb9('0x7a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x9ba1d8)){_0x3a6f45=path[_0x8bb9('0x4e')](_0x8bb9('0x85'),_0x50c40f,_0x3a99be[0x0],_0x9ba1d8);}else{_0x3a6f45=_0x9ba1d8;}}else{logger[_0x8bb9('0x65')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x8bb9('0x24')!=typeof _0x5f0199[_0x8bb9('0x75')][_0x8bb9('0x78')]['agent']){var _0x40b9fb=_0x5f0199[_0x8bb9('0x75')][_0x8bb9('0x78')][_0x8bb9('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x8bb9('0x86')](_0x40b9fb)){_0x52a79e=path[_0x8bb9('0x4e')](_0x8bb9('0x85'),_0x50c40f,_0x3a99be[0x0],_0x40b9fb);}else{_0x52a79e=_0x40b9fb;}}else{logger[_0x8bb9('0x65')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x208e38===_0x8bb9('0x7c')){_0x16da07=_0x5f0199[_0x8bb9('0x75')][_0x8bb9('0x7d')];_0x12d5d3=_0x5f0199[_0x8bb9('0x75')][_0x8bb9('0x7f')];if('undefined'!=typeof _0x5f0199['parameters'][_0x8bb9('0x78')]){if('undefined'!=typeof _0x5f0199['parameters'][_0x8bb9('0x78')]['admin']){var _0x9ba1d8=_0x5f0199[_0x8bb9('0x75')]['views'][_0x8bb9('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x8bb9('0x86')](_0x9ba1d8)){_0x3a6f45=path[_0x8bb9('0x4e')]('plugins',_0x50c40f,_0x3a99be[0x0],_0x9ba1d8);}else{_0x3a6f45=_0x9ba1d8;}}if(_0x8bb9('0x24')!=typeof _0x5f0199['parameters'][_0x8bb9('0x78')]['agent']){var _0x40b9fb=_0x5f0199[_0x8bb9('0x75')][_0x8bb9('0x78')][_0x8bb9('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x8bb9('0x86')](_0x40b9fb)){_0x52a79e=path['join']('plugins',_0x50c40f,_0x3a99be[0x0],_0x40b9fb);}else{_0x52a79e=_0x40b9fb;}}}}var _0x267920={'name':_0x35637b,'description':_0x2b5a08,'path':path[_0x8bb9('0x4e')](_0x50c40f,_0x3a99be[0x0]),'type':_0x208e38,'sidebar':_0x1302b6,'icon':_0x42a7cc,'adminUrl':_0x3a6f45,'agentUrl':_0x52a79e,'scriptName':_0x16da07,'scriptPath':_0x12d5d3,'version':_0x1e6421};removeReferences(_0x1e1bd2,null);return db[_0x8bb9('0x32')][_0x8bb9('0x87')](_0x267920)[_0x8bb9('0x2a')](function(_0x3b50a6){var _0x145ab0={'role':_0xf975db[_0x8bb9('0x88')][_0x8bb9('0x89')],'userProfileId':_0xf975db['body']['userProfileId']};if(!_0x145ab0)throw new Error(_0x8bb9('0x8a'));if(_0x145ab0['role']==='user'){var _0x38ced9=_0x3b50a6[_0x8bb9('0x8b')]({'plain':!![]});return db[_0x8bb9('0x8c')][_0x8bb9('0x4c')]({'where':{'name':_0x8bb9('0x2c'),'userProfileId':_0x145ab0[_0x8bb9('0x8d')]},'raw':!![]})[_0x8bb9('0x2a')](function(_0x2dab0d){if(_0x2dab0d&&_0x2dab0d['autoAssociation']===0x0){return db[_0x8bb9('0x2d')][_0x8bb9('0x87')]({'name':_0x38ced9['name'],'resourceId':_0x38ced9['id'],'type':_0x2dab0d[_0x8bb9('0x2f')],'sectionId':_0x2dab0d['id']},{})[_0x8bb9('0x2a')](function(){return _0x3b50a6;});}else{return _0x3b50a6;}})[_0x8bb9('0x49')](function(_0x48c346){logger[_0x8bb9('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48c346);throw _0x48c346;});}return _0x3b50a6;})['then'](respondWithResult(_0x567ba4,null))[_0x8bb9('0x49')](handleError(_0x567ba4,null));}});}catch(_0x21a81f){_0x567ba4[_0x8bb9('0x20')](0x1f4)[_0x8bb9('0x8e')](_0x21a81f);}};function removeReferences(_0x368075,_0x5cbd17){try{if(_0x368075){fs[_0x8bb9('0x64')](_0x368075);logger['info'](_0x8bb9('0x8f'));}if(_0x5cbd17){rimraf(_0x5cbd17,function(){});logger[_0x8bb9('0x65')](_0x8bb9('0x90'));}}catch(_0x4c9d4e){logger[_0x8bb9('0x57')](_0x4c9d4e);}}exports[_0x8bb9('0x29')]=function(_0x236256,_0xbabe54,_0x579c3b){return db[_0x8bb9('0x32')][_0x8bb9('0x4c')]({'where':{'id':_0x236256[_0x8bb9('0x4b')]['id']}})[_0x8bb9('0x2a')](handleEntityNotFound(_0xbabe54,null))[_0x8bb9('0x2a')](saveUpdates(_0x236256[_0x8bb9('0x88')],null))[_0x8bb9('0x2a')](respondWithResult(_0xbabe54,null))[_0x8bb9('0x49')](handleError(_0xbabe54,null));};exports[_0x8bb9('0x91')]=function(_0x5e5920,_0xcabce4,_0x42add1){return db[_0x8bb9('0x32')][_0x8bb9('0x4c')]({'where':{'id':_0x5e5920[_0x8bb9('0x4b')]['id']}})[_0x8bb9('0x2a')](function(_0x64eab2){if(_0x64eab2){return _0x64eab2[_0x8bb9('0x2b')]();}})[_0x8bb9('0x2a')](function(_0x17dd0e){rimraf(path[_0x8bb9('0x4e')](config[_0x8bb9('0x4f')],_0x8bb9('0x50'),path['dirname'](_0x17dd0e['path'])),function(){});return _0x17dd0e;})[_0x8bb9('0x2a')](handleEntityNotFound(_0xcabce4,null))[_0x8bb9('0x2a')](respondWithStatusCode(_0xcabce4,null))[_0x8bb9('0x49')](handleError(_0xcabce4,null));};exports[_0x8bb9('0x92')]=function(_0x471388,_0x1272ce,_0x64267e){return BPromise[_0x8bb9('0x93')]()[_0x8bb9('0x2a')](function(){if(!_0x471388[_0x8bb9('0x37')]['path']){throw new Error(_0x8bb9('0x94'));}if(!_0x471388[_0x8bb9('0x37')][_0x8bb9('0x95')]){throw new Error(_0x8bb9('0x96'));}var _0x47eab4=_0x471388[_0x8bb9('0x37')][_0x8bb9('0x97')]?_0x471388[_0x8bb9('0x37')][_0x8bb9('0x97')]+':'+_0x471388['query'][_0x8bb9('0x95')]:'http://localhost:'+_0x471388[_0x8bb9('0x37')][_0x8bb9('0x95')];var _0xf327df=_0x471388[_0x8bb9('0x37')]['json']?_0x471388[_0x8bb9('0x37')][_0x8bb9('0x22')]:!![];var _0x151f65=_0x471388[_0x8bb9('0x37')][_0x8bb9('0x98')]?_0x471388[_0x8bb9('0x37')][_0x8bb9('0x98')]:null;var _0x284cb1={'method':_0x471388[_0x8bb9('0x99')],'uri':util[_0x8bb9('0x9a')](_0x8bb9('0x9b'),_0x47eab4,_0x471388[_0x8bb9('0x37')][_0x8bb9('0x6')]),'json':_0xf327df,'resolveWithFullResponse':!![],'encoding':_0x151f65,'qs':_0x471388[_0x8bb9('0x37')]};if(_0x471388[_0x8bb9('0x9c')]){_0x284cb1[_0x8bb9('0x9c')]=_0x471388[_0x8bb9('0x9c')];if(_0x284cb1['headers'][_0x8bb9('0x9d')]){delete _0x284cb1['headers'][_0x8bb9('0x9d')];}}if(_0x284cb1[_0x8bb9('0x9c')][_0x8bb9('0x9e')]){delete _0x284cb1[_0x8bb9('0x9c')][_0x8bb9('0x9e')];}return rp(_0x284cb1);})[_0x8bb9('0x2a')](function(_0x4374af){if(_0x4374af){_0x1272ce['set'](_0x4374af[_0x8bb9('0x9c')]);logger[_0x8bb9('0x65')](_0x4374af[_0x8bb9('0x88')]);if(_[_0x8bb9('0x9f')](_0x471388[_0x8bb9('0x37')]['path'],'download')&&_0x4374af[_0x8bb9('0xa0')]==0x1f4){return _0x1272ce[_0x8bb9('0x1f')](_0x4374af[_0x8bb9('0xa0')]);}else{return _0x1272ce[_0x8bb9('0x20')](_0x4374af[_0x8bb9('0xa0')])['send'](_0x4374af[_0x8bb9('0x88')]);}}else{return _0x1272ce['sendStatus'](0xc8);}})[_0x8bb9('0x49')](handleError(_0x1272ce,null));};exports[_0x8bb9('0xa1')]=function(_0x3aa70a,_0x4fab06,_0x4f794f){return BPromise[_0x8bb9('0x93')]()[_0x8bb9('0x2a')](function(){if(!_0x3aa70a[_0x8bb9('0x37')]['path']){throw new Error(_0x8bb9('0x94'));}if(!_0x3aa70a[_0x8bb9('0x37')][_0x8bb9('0x95')]){throw new Error(_0x8bb9('0x96'));}var _0x4ddec1=_0x3aa70a['query'][_0x8bb9('0x97')]?_0x3aa70a['query'][_0x8bb9('0x97')]+':'+_0x3aa70a['query'][_0x8bb9('0x95')]:_0x8bb9('0xa2')+_0x3aa70a[_0x8bb9('0x37')][_0x8bb9('0x95')];var _0x1795bd=_0x3aa70a['query'][_0x8bb9('0x22')]?_0x3aa70a[_0x8bb9('0x37')][_0x8bb9('0x22')]:!![];var _0x3c9739=_0x3aa70a[_0x8bb9('0x37')][_0x8bb9('0x98')]?_0x3aa70a[_0x8bb9('0x37')][_0x8bb9('0x98')]:null;var _0x57ba42={'method':_0x3aa70a[_0x8bb9('0x99')],'uri':util[_0x8bb9('0x9a')]('%s%s',_0x4ddec1,_0x3aa70a[_0x8bb9('0x37')][_0x8bb9('0x6')]),'json':_0x1795bd,'resolveWithFullResponse':!![],'encoding':_0x3c9739,'body':_0x3aa70a['body']};if(_0x3aa70a[_0x8bb9('0x9c')]){_0x57ba42[_0x8bb9('0x9c')]=_0x3aa70a[_0x8bb9('0x9c')];if(_0x57ba42[_0x8bb9('0x9c')][_0x8bb9('0x9d')]){delete _0x57ba42[_0x8bb9('0x9c')][_0x8bb9('0x9d')];}}if(_0x57ba42['headers'][_0x8bb9('0x9e')]){delete _0x57ba42[_0x8bb9('0x9c')][_0x8bb9('0x9e')];}return rp(_0x57ba42);})[_0x8bb9('0x2a')](function(_0xee2727){if(_0xee2727){_0x4fab06[_0x8bb9('0x27')](_0xee2727[_0x8bb9('0x9c')]);logger['info'](_0xee2727['body']);return _0x4fab06[_0x8bb9('0x20')](_0xee2727[_0x8bb9('0xa0')])[_0x8bb9('0x8e')](_0xee2727[_0x8bb9('0x88')]);}else{return _0x4fab06[_0x8bb9('0x1f')](0xc8);}})[_0x8bb9('0x49')](handleError(_0x4fab06,null));}; \ No newline at end of file +var _0x91fa=['\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','Plugins','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','Plugin','include','findAll','rows','catch','params','includeAll','find','download','join','server/files/plugins','format','%s.zip','basename','warning','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','**/*','root','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','parse','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','Invalid\x20manifest:\x20views\x20missing','views','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','agent','create','body','role','userProfileId','user','get','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve'];(function(_0x402cd5,_0x1b8772){var _0x41f888=function(_0x58f111){while(--_0x58f111){_0x402cd5['push'](_0x402cd5['shift']());}};_0x41f888(++_0x1b8772);}(_0x91fa,0xaf));var _0xa91f=function(_0x5c6c2e,_0x86e980){_0x5c6c2e=_0x5c6c2e-0x0;var _0xd262ac=_0x91fa[_0x5c6c2e];return _0xd262ac;};'use strict';var emlformat=require(_0xa91f('0x0'));var rimraf=require(_0xa91f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa91f('0x2'));var rp=require(_0xa91f('0x3'));var moment=require(_0xa91f('0x4'));var BPromise=require(_0xa91f('0x5'));var Mustache=require(_0xa91f('0x6'));var util=require(_0xa91f('0x7'));var path=require(_0xa91f('0x8'));var sox=require(_0xa91f('0x9'));var csv=require('to-csv');var ejs=require(_0xa91f('0xa'));var fs=require('fs');var fs_extra=require(_0xa91f('0xb'));var _=require(_0xa91f('0xc'));var squel=require('squel');var crypto=require(_0xa91f('0xd'));var jsforce=require(_0xa91f('0xe'));var deskjs=require(_0xa91f('0xf'));var toCsv=require(_0xa91f('0x10'));var querystring=require(_0xa91f('0x11'));var Papa=require(_0xa91f('0x12'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0xa91f('0x13'));var qs=require(_0xa91f('0x14'));var as=require(_0xa91f('0x15'));var hardwareService=require(_0xa91f('0x16'));var logger=require(_0xa91f('0x17'))(_0xa91f('0x18'));var utils=require(_0xa91f('0x19'));var config=require(_0xa91f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xa91f('0x1b'))['db'];config['redis']=_[_0xa91f('0x1c')](config['redis'],{'host':_0xa91f('0x1d'),'port':0x18eb});var socket=require(_0xa91f('0x1e'))(new Redis(config['redis']));require(_0xa91f('0x1f'))['register'](socket);function respondWithStatusCode(_0x35d91c,_0x51e471){_0x51e471=_0x51e471||0xcc;return function(_0x214e75){if(_0x214e75){return _0x35d91c[_0xa91f('0x20')](_0x51e471);}return _0x35d91c[_0xa91f('0x21')](_0x51e471)[_0xa91f('0x22')]();};}function respondWithResult(_0x3fef93,_0x332829){_0x332829=_0x332829||0xc8;return function(_0x2413c0){if(_0x2413c0){return _0x3fef93['status'](_0x332829)[_0xa91f('0x23')](_0x2413c0);}};}function respondWithFilteredResult(_0x373701,_0xed045e){return function(_0x130191){if(_0x130191){var _0x168395=typeof _0xed045e[_0xa91f('0x24')]===_0xa91f('0x25')&&typeof _0xed045e[_0xa91f('0x26')]===_0xa91f('0x25');var _0x2e5f3d=_0x130191[_0xa91f('0x27')];var _0x4a61c5=_0x168395?0x0:_0xed045e[_0xa91f('0x24')];var _0x5bb902=_0x168395?_0x130191[_0xa91f('0x27')]:_0xed045e[_0xa91f('0x24')]+_0xed045e['limit'];var _0x19dfb1;if(_0x5bb902>=_0x2e5f3d){_0x5bb902=_0x2e5f3d;_0x19dfb1=0xc8;}else{_0x19dfb1=0xce;}_0x373701[_0xa91f('0x21')](_0x19dfb1);return _0x373701[_0xa91f('0x28')]('Content-Range',_0x4a61c5+'-'+_0x5bb902+'/'+_0x2e5f3d)[_0xa91f('0x23')](_0x130191);}return null;};}function patchUpdates(_0x392628){return function(_0x14a7b3){try{jsonpatch['apply'](_0x14a7b3,_0x392628,!![]);}catch(_0x2eddb3){return BPromise[_0xa91f('0x29')](_0x2eddb3);}return _0x14a7b3['save']();};}function saveUpdates(_0x33fed1,_0x24bb4c){return function(_0x5ee966){if(_0x5ee966){return _0x5ee966[_0xa91f('0x2a')](_0x33fed1)[_0xa91f('0x2b')](function(_0x3e10a3){return _0x3e10a3;});}return null;};}function removeEntity(_0x4d06c8,_0x315008){return function(_0x562235){if(_0x562235){return _0x562235[_0xa91f('0x2c')]()[_0xa91f('0x2b')](function(){var _0x16b66b=_0x562235['get']({'plain':!![]});var _0x4424f0=_0xa91f('0x2d');return db[_0xa91f('0x2e')][_0xa91f('0x2c')]({'where':{'type':_0x4424f0,'resourceId':_0x16b66b['id']}})['then'](function(){return _0x562235;});})[_0xa91f('0x2b')](function(){_0x4d06c8[_0xa91f('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x486651,_0x5c2630){return function(_0x153160){if(!_0x153160){_0x486651[_0xa91f('0x20')](0x194);}return _0x153160;};}function handleError(_0x40d79a,_0x4060f1){_0x4060f1=_0x4060f1||0x1f4;return function(_0x170b11){logger[_0xa91f('0x2f')](_0x170b11[_0xa91f('0x30')]);if(_0x170b11[_0xa91f('0x31')]){delete _0x170b11[_0xa91f('0x31')];}_0x40d79a[_0xa91f('0x21')](_0x4060f1)[_0xa91f('0x32')](_0x170b11);};}exports['index']=function(_0x10c365,_0x40d9d8){var _0x48a5ec={},_0xe07942={},_0x53b14a={'count':0x0,'rows':[]};var _0x583578=_[_0xa91f('0x33')](db['Plugin'][_0xa91f('0x34')],function(_0x4af1ab){return{'name':_0x4af1ab[_0xa91f('0x35')],'type':_0x4af1ab[_0xa91f('0x36')]['key']};});_0xe07942['model']=_[_0xa91f('0x33')](_0x583578,_0xa91f('0x31'));_0xe07942[_0xa91f('0x37')]=_[_0xa91f('0x38')](_0x10c365[_0xa91f('0x37')]);_0xe07942['filters']=_[_0xa91f('0x39')](_0xe07942[_0xa91f('0x3a')],_0xe07942[_0xa91f('0x37')]);_0x48a5ec[_0xa91f('0x3b')]=_[_0xa91f('0x39')](_0xe07942[_0xa91f('0x3a')],qs[_0xa91f('0x3c')](_0x10c365['query']['fields']));_0x48a5ec[_0xa91f('0x3b')]=_0x48a5ec['attributes'][_0xa91f('0x3d')]?_0x48a5ec[_0xa91f('0x3b')]:_0xe07942[_0xa91f('0x3a')];if(!_0x10c365[_0xa91f('0x37')][_0xa91f('0x3e')](_0xa91f('0x3f'))){_0x48a5ec[_0xa91f('0x26')]=qs[_0xa91f('0x26')](_0x10c365[_0xa91f('0x37')][_0xa91f('0x26')]);_0x48a5ec[_0xa91f('0x24')]=qs[_0xa91f('0x24')](_0x10c365[_0xa91f('0x37')][_0xa91f('0x24')]);}_0x48a5ec['order']=qs[_0xa91f('0x40')](_0x10c365[_0xa91f('0x37')][_0xa91f('0x40')]);_0x48a5ec[_0xa91f('0x41')]=qs[_0xa91f('0x42')](_[_0xa91f('0x43')](_0x10c365['query'],_0xe07942['filters']),_0x583578);if(_0x10c365[_0xa91f('0x37')][_0xa91f('0x44')]){_0x48a5ec[_0xa91f('0x41')]=_[_0xa91f('0x45')](_0x48a5ec[_0xa91f('0x41')],{'$or':_[_0xa91f('0x33')](_0x583578,function(_0x3c3424){if(_0x3c3424[_0xa91f('0x36')]!==_0xa91f('0x46')){var _0x2305f9={};_0x2305f9[_0x3c3424[_0xa91f('0x31')]]={'$like':'%'+_0x10c365[_0xa91f('0x37')][_0xa91f('0x44')]+'%'};return _0x2305f9;}})});}_0x48a5ec=_[_0xa91f('0x45')]({},_0x48a5ec,_0x10c365[_0xa91f('0x47')]);var _0x3ad8a2={'where':_0x48a5ec['where']};return db[_0xa91f('0x48')]['count'](_0x3ad8a2)[_0xa91f('0x2b')](function(_0x451132){_0x53b14a[_0xa91f('0x27')]=_0x451132;if(_0x10c365['query']['includeAll']){_0x48a5ec[_0xa91f('0x49')]=[{'all':!![]}];}return db[_0xa91f('0x48')][_0xa91f('0x4a')](_0x48a5ec);})[_0xa91f('0x2b')](function(_0x44b017){_0x53b14a[_0xa91f('0x4b')]=_0x44b017;return _0x53b14a;})[_0xa91f('0x2b')](respondWithFilteredResult(_0x40d9d8,_0x48a5ec))[_0xa91f('0x4c')](handleError(_0x40d9d8,null));};exports['show']=function(_0x5e1c76,_0x33d6ea){var _0x545458={'raw':!![],'where':{'id':_0x5e1c76[_0xa91f('0x4d')]['id']}},_0x343e11={};_0x343e11[_0xa91f('0x3a')]=_[_0xa91f('0x38')](db[_0xa91f('0x48')]['rawAttributes']);_0x343e11[_0xa91f('0x37')]=_[_0xa91f('0x38')](_0x5e1c76[_0xa91f('0x37')]);_0x343e11['filters']=_[_0xa91f('0x39')](_0x343e11[_0xa91f('0x3a')],_0x343e11[_0xa91f('0x37')]);_0x545458[_0xa91f('0x3b')]=_[_0xa91f('0x39')](_0x343e11[_0xa91f('0x3a')],qs[_0xa91f('0x3c')](_0x5e1c76[_0xa91f('0x37')]['fields']));_0x545458[_0xa91f('0x3b')]=_0x545458[_0xa91f('0x3b')][_0xa91f('0x3d')]?_0x545458['attributes']:_0x343e11[_0xa91f('0x3a')];if(_0x5e1c76[_0xa91f('0x37')][_0xa91f('0x4e')]){_0x545458['include']=[{'all':!![]}];}_0x545458=_[_0xa91f('0x45')]({},_0x545458,_0x5e1c76['options']);return db[_0xa91f('0x48')][_0xa91f('0x4f')](_0x545458)[_0xa91f('0x2b')](handleEntityNotFound(_0x33d6ea,null))['then'](respondWithResult(_0x33d6ea,null))['catch'](handleError(_0x33d6ea,null));};exports[_0xa91f('0x50')]=function(_0x4f69ad,_0x22baf3,_0x1b8025){return db['Plugin'][_0xa91f('0x4f')]({'where':{'id':_0x4f69ad[_0xa91f('0x4d')]['id']},'attributes':[_0xa91f('0x31'),_0xa91f('0x8')],'raw':!![]})[_0xa91f('0x2b')](handleEntityNotFound(_0x22baf3,null))[_0xa91f('0x2b')](function(_0x5f24d4){if(_0x5f24d4){var _0x26ee37=path[_0xa91f('0x51')](config['root'],_0xa91f('0x52'),util[_0xa91f('0x53')](_0xa91f('0x54'),path[_0xa91f('0x55')](_0x5f24d4['path'])));var _0x46d79e=fs['createWriteStream'](_0x26ee37);var _0x2dfc06=archiver('zip',{'zlib':{'level':0x9}});_0x2dfc06['on'](_0xa91f('0x56'),function(_0x119a8c){if(_0x119a8c['code']===_0xa91f('0x57')){logger[_0xa91f('0x2f')](_0x119a8c);}else{throw new db['Sequelize']['Error'](_0xa91f('0x58'));}});_0x2dfc06['on'](_0xa91f('0x2f'),function(_0x3d293b){throw new db[(_0xa91f('0x59'))][(_0xa91f('0x5a'))](_0xa91f('0x58'));});_0x2dfc06[_0xa91f('0x5b')](_0x46d79e);_0x2dfc06['glob'](_0xa91f('0x5c'),{'cwd':path[_0xa91f('0x51')](config[_0xa91f('0x5d')],_0xa91f('0x52'),path[_0xa91f('0x5e')](_0x5f24d4[_0xa91f('0x8')])),'ignore':[path[_0xa91f('0x51')](path[_0xa91f('0x55')](_0x5f24d4[_0xa91f('0x8')]),_0xa91f('0x5f')),path[_0xa91f('0x51')](path[_0xa91f('0x55')](_0x5f24d4[_0xa91f('0x8')]),_0xa91f('0x60'))],'nodir':!![]})[_0xa91f('0x61')]();_0x46d79e['on'](_0xa91f('0x62'),function(){if(!fs[_0xa91f('0x63')](_0x26ee37)){throw new db[(_0xa91f('0x59'))][(_0xa91f('0x5a'))](_0xa91f('0x64'));}return _0x22baf3['download'](_0x26ee37,util['format'](_0xa91f('0x54'),path[_0xa91f('0x55')](_0x5f24d4['path'])),function(_0xe1a17b){if(_0xe1a17b){throw new db[(_0xa91f('0x59'))]['Error'](_0xa91f('0x65'));}fs[_0xa91f('0x66')](_0x26ee37);logger['info']('Download\x20completed');logger[_0xa91f('0x67')]('Temporary\x20file\x20removed');});});}return null;})[_0xa91f('0x4c')](handleError(_0x22baf3,null));};exports[_0xa91f('0x68')]=function(_0x19d753,_0x15afd2,_0x2147e2){var _0x5ebb97=path['basename'](_0x19d753[_0xa91f('0x69')]['filename'],path['extname'](_0x19d753['file'][_0xa91f('0x6a')]));var _0x544b3f=path['join'](config[_0xa91f('0x5d')],_0xa91f('0x52'),_0x19d753[_0xa91f('0x69')]['filename']);var _0x26e18f=path[_0xa91f('0x51')](config[_0xa91f('0x5d')],_0xa91f('0x52'),_0x5ebb97);logger[_0xa91f('0x67')](_0xa91f('0x6b'),_0x544b3f);logger['info'](_0xa91f('0x6c'),_0x26e18f);try{fs[_0xa91f('0x6d')](_0x544b3f,parseInt('0777',0x8));extract(_0x544b3f,{'dir':_0x26e18f},function(_0x518645){if(_0x518645){logger[_0xa91f('0x2f')](_0x518645);handleError(_0x518645,!![]);};var _0x1c2599=fs[_0xa91f('0x6e')](_0x26e18f);if(_0x1c2599['length']>0x1){removeReferences(_0x544b3f,_0x26e18f);logger[_0xa91f('0x2f')](_0xa91f('0x6f'));return _0x2147e2(new Error(_0xa91f('0x6f')));}var _0x3ad4f6=fs[_0xa91f('0x70')](path['join'](_0x26e18f,_0x1c2599[0x0]));if(_0x3ad4f6[_0xa91f('0x71')]()){removeReferences(_0x544b3f,_0x26e18f);logger[_0xa91f('0x2f')](_0xa91f('0x6f'));return _0x2147e2(new Error(_0xa91f('0x6f')));}if(_0x3ad4f6[_0xa91f('0x72')]()){var _0x1704e8=fs[_0xa91f('0x6e')](path['join'](_0x26e18f,_0x1c2599[0x0]));if(_0x1704e8[_0xa91f('0x3d')]===0x0){removeReferences(_0x544b3f,_0x26e18f);logger[_0xa91f('0x2f')](_0xa91f('0x6f'));return _0x2147e2(new Error('Invalid\x20plugin\x20structure'));}var _0x41bca7=_0x1704e8[_0xa91f('0x73')](function(_0x3b7acd){return _0x3b7acd==='manifest.json';});if(!_0x41bca7){return _0x2147e2(new Error('Plugin\x20manifest\x20missing'));}var _0x49844a=fs['readFileSync'](path[_0xa91f('0x51')](_0x26e18f,_0x1c2599[0x0],_0xa91f('0x74')));var _0x177e8c=JSON[_0xa91f('0x75')](_0x49844a);if(_0xa91f('0x25')==typeof _0x177e8c['name']){return _0x2147e2(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x177e8c[_0xa91f('0x36')]){return _0x2147e2(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xa91f('0x25')==typeof _0x177e8c[_0xa91f('0x76')]){return _0x2147e2(new Error(_0xa91f('0x77')));}if(_0xa91f('0x25')==typeof _0x177e8c[_0xa91f('0x78')]){return _0x2147e2(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x177e8c[_0xa91f('0x36')]===_0xa91f('0x79')){if(_0xa91f('0x25')==typeof _0x177e8c[_0xa91f('0x78')]['views']){return _0x2147e2(new Error(_0xa91f('0x7a')));}if(_0xa91f('0x25')==typeof _0x177e8c['parameters'][_0xa91f('0x7b')]['admin']&&'undefined'==typeof _0x177e8c[_0xa91f('0x78')][_0xa91f('0x7b')]['agent']){return _0x2147e2(new Error(_0xa91f('0x7c')));}}else if(_0x177e8c[_0xa91f('0x36')]===_0xa91f('0x7d')){if(_0xa91f('0x25')==typeof _0x177e8c[_0xa91f('0x78')][_0xa91f('0x7e')]){return _0x2147e2(new Error(_0xa91f('0x7f')));}if('undefined'==typeof _0x177e8c[_0xa91f('0x78')]['scriptPath']){return _0x2147e2(new Error(_0xa91f('0x80')));}}else{return _0x2147e2(new Error(_0xa91f('0x81')));}var _0x5978a1=_0x177e8c[_0xa91f('0x31')];var _0x578e24=_0x177e8c[_0xa91f('0x82')];var _0x502b11=_0x177e8c[_0xa91f('0x36')];var _0x1b6159=_0x177e8c[_0xa91f('0x83')]?_0x177e8c[_0xa91f('0x83')]:_0xa91f('0x84');var _0x4b0cff=_0x177e8c['icon']?_0x177e8c[_0xa91f('0x85')]:_0xa91f('0x86');var _0x2562c6='';var _0x1c1747='';var _0x449bf0='';var _0x1434a1='';var _0x2d3c2c=_0x177e8c['version'];if(_0x502b11===_0xa91f('0x79')){if('undefined'!=typeof _0x177e8c[_0xa91f('0x78')][_0xa91f('0x7b')][_0xa91f('0x87')]){var _0x28447c=_0x177e8c[_0xa91f('0x78')][_0xa91f('0x7b')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xa91f('0x88')](_0x28447c)){_0x2562c6=path['join'](_0xa91f('0x89'),_0x5ebb97,_0x1c2599[0x0],_0x28447c);}else{_0x2562c6=_0x28447c;}}else{logger[_0xa91f('0x67')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xa91f('0x25')!=typeof _0x177e8c[_0xa91f('0x78')][_0xa91f('0x7b')]['agent']){var _0x9b43a2=_0x177e8c[_0xa91f('0x78')][_0xa91f('0x7b')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xa91f('0x88')](_0x9b43a2)){_0x1c1747=path[_0xa91f('0x51')](_0xa91f('0x89'),_0x5ebb97,_0x1c2599[0x0],_0x9b43a2);}else{_0x1c1747=_0x9b43a2;}}else{logger[_0xa91f('0x67')](_0xa91f('0x8a'));}}else if(_0x502b11===_0xa91f('0x7d')){_0x449bf0=_0x177e8c['parameters']['scriptName'];_0x1434a1=_0x177e8c[_0xa91f('0x78')][_0xa91f('0x8b')];if('undefined'!=typeof _0x177e8c[_0xa91f('0x78')]['views']){if(_0xa91f('0x25')!=typeof _0x177e8c[_0xa91f('0x78')][_0xa91f('0x7b')][_0xa91f('0x87')]){var _0x28447c=_0x177e8c[_0xa91f('0x78')][_0xa91f('0x7b')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xa91f('0x88')](_0x28447c)){_0x2562c6=path[_0xa91f('0x51')](_0xa91f('0x89'),_0x5ebb97,_0x1c2599[0x0],_0x28447c);}else{_0x2562c6=_0x28447c;}}if(_0xa91f('0x25')!=typeof _0x177e8c['parameters']['views'][_0xa91f('0x8c')]){var _0x9b43a2=_0x177e8c[_0xa91f('0x78')]['views'][_0xa91f('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0xa91f('0x88')](_0x9b43a2)){_0x1c1747=path[_0xa91f('0x51')]('plugins',_0x5ebb97,_0x1c2599[0x0],_0x9b43a2);}else{_0x1c1747=_0x9b43a2;}}}}var _0x3ab15a={'name':_0x5978a1,'description':_0x578e24,'path':path[_0xa91f('0x51')](_0x5ebb97,_0x1c2599[0x0]),'type':_0x502b11,'sidebar':_0x1b6159,'icon':_0x4b0cff,'adminUrl':_0x2562c6,'agentUrl':_0x1c1747,'scriptName':_0x449bf0,'scriptPath':_0x1434a1,'version':_0x2d3c2c};removeReferences(_0x544b3f,null);return db[_0xa91f('0x48')][_0xa91f('0x8d')](_0x3ab15a)['then'](function(_0x17c32e){var _0x39fc5b={'role':_0x19d753[_0xa91f('0x8e')][_0xa91f('0x8f')],'userProfileId':_0x19d753['body'][_0xa91f('0x90')]};if(!_0x39fc5b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39fc5b['role']===_0xa91f('0x91')){var _0x602fcc=_0x17c32e[_0xa91f('0x92')]({'plain':!![]});return db['UserProfileSection'][_0xa91f('0x4f')]({'where':{'name':_0xa91f('0x2d'),'userProfileId':_0x39fc5b['userProfileId']},'raw':!![]})[_0xa91f('0x2b')](function(_0x47ff14){if(_0x47ff14&&_0x47ff14[_0xa91f('0x93')]===0x0){return db['UserProfileResource']['create']({'name':_0x602fcc['name'],'resourceId':_0x602fcc['id'],'type':_0x47ff14[_0xa91f('0x31')],'sectionId':_0x47ff14['id']},{})[_0xa91f('0x2b')](function(){return _0x17c32e;});}else{return _0x17c32e;}})['catch'](function(_0x5ac1e6){logger[_0xa91f('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ac1e6);throw _0x5ac1e6;});}return _0x17c32e;})[_0xa91f('0x2b')](respondWithResult(_0x15afd2,null))[_0xa91f('0x4c')](handleError(_0x15afd2,null));}});}catch(_0x5bf8a1){_0x15afd2[_0xa91f('0x21')](0x1f4)[_0xa91f('0x32')](_0x5bf8a1);}};function removeReferences(_0x45abaf,_0x2fba9e){try{if(_0x45abaf){fs[_0xa91f('0x66')](_0x45abaf);logger[_0xa91f('0x67')](_0xa91f('0x94'));}if(_0x2fba9e){rimraf(_0x2fba9e,function(){});logger[_0xa91f('0x67')](_0xa91f('0x95'));}}catch(_0x4d950c){logger[_0xa91f('0x2f')](_0x4d950c);}}exports[_0xa91f('0x2a')]=function(_0x5b475,_0x5579ed,_0xf23dc4){return db['Plugin'][_0xa91f('0x4f')]({'where':{'id':_0x5b475[_0xa91f('0x4d')]['id']}})[_0xa91f('0x2b')](handleEntityNotFound(_0x5579ed,null))[_0xa91f('0x2b')](saveUpdates(_0x5b475[_0xa91f('0x8e')],null))[_0xa91f('0x2b')](respondWithResult(_0x5579ed,null))[_0xa91f('0x4c')](handleError(_0x5579ed,null));};exports[_0xa91f('0x96')]=function(_0x19f317,_0x155dd6,_0x29a6dc){return db[_0xa91f('0x48')][_0xa91f('0x4f')]({'where':{'id':_0x19f317['params']['id']}})[_0xa91f('0x2b')](function(_0x449840){if(_0x449840){return _0x449840[_0xa91f('0x2c')]();}})[_0xa91f('0x2b')](function(_0x4b8110){rimraf(path[_0xa91f('0x51')](config[_0xa91f('0x5d')],'server/files/plugins',path[_0xa91f('0x5e')](_0x4b8110[_0xa91f('0x8')])),function(){});return _0x4b8110;})[_0xa91f('0x2b')](handleEntityNotFound(_0x155dd6,null))[_0xa91f('0x2b')](respondWithStatusCode(_0x155dd6,null))[_0xa91f('0x4c')](handleError(_0x155dd6,null));};exports[_0xa91f('0x97')]=function(_0x3df5ff,_0x146981,_0x2e5218){return BPromise[_0xa91f('0x98')]()[_0xa91f('0x2b')](function(){if(!_0x3df5ff[_0xa91f('0x37')]['path']){throw new Error(_0xa91f('0x99'));}if(!_0x3df5ff['query'][_0xa91f('0x9a')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x12604c=_0x3df5ff['query']['hostname']?_0x3df5ff[_0xa91f('0x37')][_0xa91f('0x9b')]+':'+_0x3df5ff[_0xa91f('0x37')]['port']:_0xa91f('0x9c')+_0x3df5ff[_0xa91f('0x37')][_0xa91f('0x9a')];var _0x54995d=_0x3df5ff[_0xa91f('0x37')]['json']?_0x3df5ff[_0xa91f('0x37')][_0xa91f('0x23')]:!![];var _0x66ff40=_0x3df5ff[_0xa91f('0x37')][_0xa91f('0x9d')]?_0x3df5ff[_0xa91f('0x37')]['encoding']:null;var _0x1eb396={'method':_0x3df5ff[_0xa91f('0x9e')],'uri':util['format'](_0xa91f('0x9f'),_0x12604c,_0x3df5ff[_0xa91f('0x37')][_0xa91f('0x8')]),'json':_0x54995d,'resolveWithFullResponse':!![],'encoding':_0x66ff40,'qs':_0x3df5ff[_0xa91f('0x37')]};if(_0x3df5ff[_0xa91f('0xa0')]){_0x1eb396['headers']=_0x3df5ff[_0xa91f('0xa0')];if(_0x1eb396[_0xa91f('0xa0')][_0xa91f('0xa1')]){delete _0x1eb396[_0xa91f('0xa0')][_0xa91f('0xa1')];}}if(_0x1eb396['headers'][_0xa91f('0xa2')]){delete _0x1eb396[_0xa91f('0xa0')][_0xa91f('0xa2')];}return rp(_0x1eb396);})[_0xa91f('0x2b')](function(_0x1f3245){if(_0x1f3245){_0x146981[_0xa91f('0x28')](_0x1f3245['headers']);logger[_0xa91f('0x67')](_0x1f3245[_0xa91f('0x8e')]);if(_['endsWith'](_0x3df5ff[_0xa91f('0x37')][_0xa91f('0x8')],_0xa91f('0x50'))&&_0x1f3245[_0xa91f('0xa3')]==0x1f4){return _0x146981[_0xa91f('0x20')](_0x1f3245['statusCode']);}else{return _0x146981[_0xa91f('0x21')](_0x1f3245['statusCode'])['send'](_0x1f3245[_0xa91f('0x8e')]);}}else{return _0x146981[_0xa91f('0x20')](0xc8);}})[_0xa91f('0x4c')](handleError(_0x146981,null));};exports['webhookPost']=function(_0x47d48a,_0x320f5f,_0x596e23){return BPromise['resolve']()[_0xa91f('0x2b')](function(){if(!_0x47d48a['query'][_0xa91f('0x8')]){throw new Error(_0xa91f('0x99'));}if(!_0x47d48a[_0xa91f('0x37')][_0xa91f('0x9a')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xe3e999=_0x47d48a['query'][_0xa91f('0x9b')]?_0x47d48a[_0xa91f('0x37')][_0xa91f('0x9b')]+':'+_0x47d48a[_0xa91f('0x37')][_0xa91f('0x9a')]:_0xa91f('0x9c')+_0x47d48a[_0xa91f('0x37')][_0xa91f('0x9a')];var _0x56b464=_0x47d48a[_0xa91f('0x37')][_0xa91f('0x23')]?_0x47d48a[_0xa91f('0x37')]['json']:!![];var _0x3e2a23=_0x47d48a[_0xa91f('0x37')][_0xa91f('0x9d')]?_0x47d48a['query']['encoding']:null;var _0x262b1f={'method':_0x47d48a[_0xa91f('0x9e')],'uri':util[_0xa91f('0x53')]('%s%s',_0xe3e999,_0x47d48a['query'][_0xa91f('0x8')]),'json':_0x56b464,'resolveWithFullResponse':!![],'encoding':_0x3e2a23,'body':_0x47d48a[_0xa91f('0x8e')]};if(_0x47d48a[_0xa91f('0xa0')]){_0x262b1f['headers']=_0x47d48a[_0xa91f('0xa0')];if(_0x262b1f['headers'][_0xa91f('0xa1')]){delete _0x262b1f[_0xa91f('0xa0')]['content-length'];}}if(_0x262b1f['headers'][_0xa91f('0xa2')]){delete _0x262b1f[_0xa91f('0xa0')][_0xa91f('0xa2')];}return rp(_0x262b1f);})[_0xa91f('0x2b')](function(_0x5c9521){if(_0x5c9521){_0x320f5f[_0xa91f('0x28')](_0x5c9521[_0xa91f('0xa0')]);logger[_0xa91f('0x67')](_0x5c9521['body']);return _0x320f5f[_0xa91f('0x21')](_0x5c9521[_0xa91f('0xa3')])['send'](_0x5c9521['body']);}else{return _0x320f5f[_0xa91f('0x20')](0xc8);}})[_0xa91f('0x4c')](handleError(_0x320f5f,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 1474826..a7827d4 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 _0x0960=['emit','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x4672a7,_0x2f1727){var _0x45405c=function(_0x3e7f56){while(--_0x3e7f56){_0x4672a7['push'](_0x4672a7['shift']());}};_0x45405c(++_0x2f1727);}(_0x0960,0xc2));var _0x0096=function(_0x2bd083,_0x4a6b06){_0x2bd083=_0x2bd083-0x0;var _0x44a76a=_0x0960[_0x2bd083];return _0x44a76a;};'use strict';var EventEmitter=require(_0x0096('0x0'));var Plugin=require(_0x0096('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x0096('0x2')](0x0);var events={'afterCreate':_0x0096('0x3'),'afterUpdate':_0x0096('0x4'),'afterDestroy':_0x0096('0x5')};function emitEvent(_0x3a9b32){return function(_0xd0d4c6,_0x3ee9fb,_0x3566d1){PluginEvents[_0x0096('0x6')](_0x3a9b32+':'+_0xd0d4c6['id'],_0xd0d4c6);PluginEvents[_0x0096('0x6')](_0x3a9b32,_0xd0d4c6);_0x3566d1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x0096('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x2cd0=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hook'];(function(_0x56fb04,_0x523750){var _0x13382c=function(_0x19068d){while(--_0x19068d){_0x56fb04['push'](_0x56fb04['shift']());}};_0x13382c(++_0x523750);}(_0x2cd0,0x10f));var _0x02cd=function(_0x25e9df,_0x17a63a){_0x25e9df=_0x25e9df-0x0;var _0x3dea70=_0x2cd0[_0x25e9df];return _0x3dea70;};'use strict';var EventEmitter=require(_0x02cd('0x0'));var Plugin=require(_0x02cd('0x1'))['db'][_0x02cd('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x02cd('0x3')](0x0);var events={'afterCreate':_0x02cd('0x4'),'afterUpdate':_0x02cd('0x5'),'afterDestroy':_0x02cd('0x6')};function emitEvent(_0x215b17){return function(_0x4fecc3,_0x3dfd49,_0x3c4a73){PluginEvents[_0x02cd('0x7')](_0x215b17+':'+_0x4fecc3['id'],_0x4fecc3);PluginEvents[_0x02cd('0x7')](_0x215b17,_0x4fecc3);_0x3c4a73(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x02cd('0x8')](e,emitEvent(event));}}module[_0x02cd('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 2f89cd6..425caba 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 _0x9ee6=['../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x59ba0f,_0x400e05){var _0x568b63=function(_0x52d9ec){while(--_0x52d9ec){_0x59ba0f['push'](_0x59ba0f['shift']());}};_0x568b63(++_0x400e05);}(_0x9ee6,0x125));var _0x69ee=function(_0xe3e0af,_0x4564ed){_0xe3e0af=_0xe3e0af-0x0;var _0x4828e9=_0x9ee6[_0xe3e0af];return _0x4828e9;};'use strict';var _=require(_0x69ee('0x0'));var util=require(_0x69ee('0x1'));var logger=require(_0x69ee('0x2'))(_0x69ee('0x3'));var moment=require('moment');var BPromise=require(_0x69ee('0x4'));var rp=require(_0x69ee('0x5'));var fs=require('fs');var path=require(_0x69ee('0x6'));var rimraf=require('rimraf');var config=require(_0x69ee('0x7'));var attributes=require(_0x69ee('0x8'));module['exports']=function(_0x1f8799,_0x52f3fe){return _0x1f8799[_0x69ee('0x9')](_0x69ee('0xa'),attributes,{'tableName':_0x69ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x967c=['exports','define','Plugin','lodash','util','../../config/logger','moment','bluebird','path','./plugin.attributes'];(function(_0x1c615b,_0x5003c1){var _0x22c070=function(_0x2d2a7a){while(--_0x2d2a7a){_0x1c615b['push'](_0x1c615b['shift']());}};_0x22c070(++_0x5003c1);}(_0x967c,0xfd));var _0xc967=function(_0x3a9b58,_0x61d8ec){_0x3a9b58=_0x3a9b58-0x0;var _0x205838=_0x967c[_0x3a9b58];return _0x205838;};'use strict';var _=require(_0xc967('0x0'));var util=require(_0xc967('0x1'));var logger=require(_0xc967('0x2'))('api');var moment=require(_0xc967('0x3'));var BPromise=require(_0xc967('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc967('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc967('0x6'));module[_0xc967('0x7')]=function(_0x154162,_0x408a54){return _0x154162[_0xc967('0x8')](_0xc967('0x9'),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 39e6c59..ff2c71f 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 _0xeb5e=['localhost','socket.io-emitter','./plugin.socket','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','CreatePlugin','Plugin','create','body','options','raw','then','stringify','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x445d68,_0x5e87f7){var _0x44a18c=function(_0xabf3c9){while(--_0xabf3c9){_0x445d68['push'](_0x445d68['shift']());}};_0x44a18c(++_0x5e87f7);}(_0xeb5e,0x134));var _0xeeb5=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xeb5e[_0x173d7e];return _0x2220d6;};'use strict';var _=require('lodash');var util=require(_0xeeb5('0x0'));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('../../mysqldb')['db'];var utils=require(_0xeeb5('0x5'));var logger=require(_0xeeb5('0x6'))('rpc');var config=require(_0xeeb5('0x7'));var jayson=require(_0xeeb5('0x8'));var client=jayson[_0xeeb5('0x9')][_0xeeb5('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xeeb5('0xb')],{'host':_0xeeb5('0xc'),'port':0x18eb});var socket=require(_0xeeb5('0xd'))(new Redis(config[_0xeeb5('0xb')]));require(_0xeeb5('0xe'))['register'](socket);function respondWithRpcPromise(_0x5da4f3,_0x2b99fc,_0x356f4b){return new BPromise(function(_0xab6ce7,_0x445f14){return client['request'](_0x5da4f3,_0x356f4b)['then'](function(_0x4576ca){logger[_0xeeb5('0xf')](_0xeeb5('0x10'),_0x2b99fc,_0xeeb5('0x11'));logger[_0xeeb5('0x12')](_0xeeb5('0x13'),_0x2b99fc,_0xeeb5('0x11'),JSON['stringify'](_0x4576ca));if(_0x4576ca[_0xeeb5('0x14')]){if(_0x4576ca['error'][_0xeeb5('0x15')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x2b99fc,_0x4576ca[_0xeeb5('0x14')][_0xeeb5('0x16')]);return _0x445f14(_0x4576ca[_0xeeb5('0x14')][_0xeeb5('0x16')]);}logger[_0xeeb5('0x14')](_0xeeb5('0x10'),_0x2b99fc,_0x4576ca['error'][_0xeeb5('0x16')]);return _0xab6ce7(_0x4576ca[_0xeeb5('0x14')][_0xeeb5('0x16')]);}else{logger[_0xeeb5('0xf')](_0xeeb5('0x10'),_0x2b99fc,'request\x20sent');_0xab6ce7(_0x4576ca['result'][_0xeeb5('0x16')]);}})['catch'](function(_0x97bb78){logger['error'](_0xeeb5('0x10'),_0x2b99fc,_0x97bb78);_0x445f14(_0x97bb78);});});}exports[_0xeeb5('0x17')]=function(_0xc639ce){var _0x42d804=this;return new Promise(function(_0x39cadf,_0x4e5410){return db[_0xeeb5('0x18')][_0xeeb5('0x19')](_0xc639ce[_0xeeb5('0x1a')],{'raw':_0xc639ce[_0xeeb5('0x1b')]?_0xc639ce[_0xeeb5('0x1b')][_0xeeb5('0x1c')]===undefined?!![]:![]:!![]})[_0xeeb5('0x1d')](function(_0x144173){logger['info'](_0xeeb5('0x17'),_0xc639ce);logger[_0xeeb5('0x12')]('CreatePlugin',_0xc639ce,JSON[_0xeeb5('0x1e')](_0x144173));_0x39cadf(_0x144173);})[_0xeeb5('0x1f')](function(_0x4c2cc6){logger['error'](_0xeeb5('0x17'),_0x4c2cc6[_0xeeb5('0x16')],_0xc639ce);_0x4e5410(_0x42d804[_0xeeb5('0x14')](0x1f4,_0x4c2cc6[_0xeeb5('0x16')]));});});}; \ No newline at end of file +var _0x1044=['http','redis','defaults','request','then','info','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','create','options','raw','CreatePlugin','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x2634a7,_0x118508){var _0xa52e2c=function(_0x400f75){while(--_0x400f75){_0x2634a7['push'](_0x2634a7['shift']());}};_0xa52e2c(++_0x118508);}(_0x1044,0x16f));var _0x4104=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x1044[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0x4104('0x0'));var util=require(_0x4104('0x1'));var moment=require(_0x4104('0x2'));var BPromise=require(_0x4104('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4104('0x4'))['db'];var utils=require(_0x4104('0x5'));var logger=require('../../config/logger')(_0x4104('0x6'));var config=require(_0x4104('0x7'));var jayson=require(_0x4104('0x8'));var client=jayson[_0x4104('0x9')][_0x4104('0xa')]({'port':0x232a});config[_0x4104('0xb')]=_[_0x4104('0xc')](config[_0x4104('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4104('0xb')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x254dd9,_0x1794bf,_0x1987d9){return new BPromise(function(_0x2ed1ec,_0x1f5234){return client[_0x4104('0xd')](_0x254dd9,_0x1987d9)[_0x4104('0xe')](function(_0xdaea38){logger[_0x4104('0xf')](_0x4104('0x10'),_0x1794bf,'request\x20sent');logger['debug'](_0x4104('0x11'),_0x1794bf,_0x4104('0x12'),JSON[_0x4104('0x13')](_0xdaea38));if(_0xdaea38[_0x4104('0x14')]){if(_0xdaea38[_0x4104('0x14')][_0x4104('0x15')]===0x1f4){logger['error'](_0x4104('0x10'),_0x1794bf,_0xdaea38[_0x4104('0x14')][_0x4104('0x16')]);return _0x1f5234(_0xdaea38[_0x4104('0x14')]['message']);}logger[_0x4104('0x14')]('Plugin,\x20%s,\x20%s',_0x1794bf,_0xdaea38['error']['message']);return _0x2ed1ec(_0xdaea38['error']['message']);}else{logger[_0x4104('0xf')](_0x4104('0x10'),_0x1794bf,'request\x20sent');_0x2ed1ec(_0xdaea38['result'][_0x4104('0x16')]);}})[_0x4104('0x17')](function(_0x1e2fbc){logger[_0x4104('0x14')](_0x4104('0x10'),_0x1794bf,_0x1e2fbc);_0x1f5234(_0x1e2fbc);});});}exports['CreatePlugin']=function(_0x7e7f44){var _0x470918=this;return new Promise(function(_0x2b32d5,_0x3e6e0b){return db['Plugin'][_0x4104('0x18')](_0x7e7f44['body'],{'raw':_0x7e7f44['options']?_0x7e7f44[_0x4104('0x19')][_0x4104('0x1a')]===undefined?!![]:![]:!![]})[_0x4104('0xe')](function(_0x3040ec){logger[_0x4104('0xf')](_0x4104('0x1b'),_0x7e7f44);logger[_0x4104('0x1c')]('CreatePlugin',_0x7e7f44,JSON['stringify'](_0x3040ec));_0x2b32d5(_0x3040ec);})[_0x4104('0x17')](function(_0x151850){logger['error'](_0x4104('0x1b'),_0x151850[_0x4104('0x16')],_0x7e7f44);_0x3e6e0b(_0x470918[_0x4104('0x14')](0x1f4,_0x151850['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 9ae2f0e..adc0ebd 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 _0x7a10=['register','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x7a10,0x1ba));var _0x07a1=function(_0x47b6c6,_0x24d264){_0x47b6c6=_0x47b6c6-0x0;var _0x59a77b=_0x7a10[_0x47b6c6];return _0x59a77b;};'use strict';var PluginEvents=require(_0x07a1('0x0'));var events=[_0x07a1('0x1'),_0x07a1('0x2'),_0x07a1('0x3')];function createListener(_0x3716e0,_0xd63c5f){return function(_0x221a1a){_0xd63c5f[_0x07a1('0x4')](_0x3716e0,_0x221a1a);};}function removeListener(_0x1e7bd4,_0xc535f0){return function(){PluginEvents[_0x07a1('0x5')](_0x1e7bd4,_0xc535f0);};}exports[_0x07a1('0x6')]=function(_0x54ec4e){for(var _0x5821e9=0x0,_0x17f864=events['length'];_0x5821e9<_0x17f864;_0x5821e9++){var _0x427ce1=events[_0x5821e9];var _0x56b3d1=createListener('plugin:'+_0x427ce1,_0x54ec4e);PluginEvents['on'](_0x427ce1,_0x56b3d1);}}; \ No newline at end of file +var _0x7dc1=['update','emit','removeListener','length','plugin:','save','remove'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0x7dc1,0x17f));var _0x17dc=function(_0x1c658d,_0x32a607){_0x1c658d=_0x1c658d-0x0;var _0x147e1c=_0x7dc1[_0x1c658d];return _0x147e1c;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x17dc('0x0'),_0x17dc('0x1'),_0x17dc('0x2')];function createListener(_0x36a6d1,_0x2d8199){return function(_0x3f34fc){_0x2d8199[_0x17dc('0x3')](_0x36a6d1,_0x3f34fc);};}function removeListener(_0x8e3a73,_0x1e17b4){return function(){PluginEvents[_0x17dc('0x4')](_0x8e3a73,_0x1e17b4);};}exports['register']=function(_0x484103){for(var _0x25d453=0x0,_0x4aba9c=events[_0x17dc('0x5')];_0x25d453<_0x4aba9c;_0x25d453++){var _0x59842c=events[_0x25d453];var _0x3ef2cb=createListener(_0x17dc('0x6')+_0x59842c,_0x484103);PluginEvents['on'](_0x59842c,_0x3ef2cb);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 48310fe..ac45dee 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(_0x33dfc6,_0x2683e2){var _0x42dcbc=function(_0x2849de){while(--_0x2849de){_0x33dfc6['push'](_0x33dfc6['shift']());}};_0x42dcbc(++_0x2683e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x461e0f,_0x372b1a){var _0x290778=function(_0x431bb5){while(--_0x431bb5){_0x461e0f['push'](_0x461e0f['shift']());}};_0x290778(++_0x372b1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 66620d5..92f2dc0 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 _0x2750=['exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','list','then','motion2','catch','body','script','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','stop','hasOwnProperty','params','Unknown\x20status','destroy','lodash','../../config/logger','api','path','child_process'];(function(_0x488494,_0xf84be2){var _0x4d0086=function(_0x4a62b9){while(--_0x4a62b9){_0x488494['push'](_0x488494['shift']());}};_0x4d0086(++_0xf84be2);}(_0x2750,0x13b));var _0x0275=function(_0x526c04,_0x24a435){_0x526c04=_0x526c04-0x0;var _0x20b69a=_0x2750[_0x526c04];return _0x20b69a;};'use strict';var _=require(_0x0275('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var path=require(_0x0275('0x3'));var exec=require(_0x0275('0x4'))[_0x0275('0x5')];var BPromise=require(_0x0275('0x6'));function handleEntityNotFound(_0x20273d,_0x4960){return function(_0x3d0c9c){if(!_0x3d0c9c){_0x20273d[_0x0275('0x7')](0x194);;}return _0x3d0c9c;};}function respondWithResult(_0x5953f9,_0x3f645f){_0x3f645f=_0x3f645f||0xc8;return function(_0x2421fd){if(_0x2421fd){return _0x5953f9[_0x0275('0x8')](_0x3f645f)[_0x0275('0x9')](_0x2421fd);}return null;};}function handleError(_0x4dffd1,_0x1f7c4a){_0x1f7c4a=_0x1f7c4a||0x1f4;return function(_0x30632d){logger[_0x0275('0xa')](_0x30632d['stack']);if(_0x30632d['name']){delete _0x30632d[_0x0275('0xb')];}_0x4dffd1['status'](_0x1f7c4a)[_0x0275('0xc')](_0x30632d);};}function execChildProcess(){return new BPromise(function(_0x377087,_0x14f68c){exec(_0x0275('0xd'),function(_0x14bc3e,_0x5ae208,_0x2e8723){logger[_0x0275('0xe')](_0x5ae208);logger[_0x0275('0xe')](_0x2e8723);if(_0x14bc3e){logger['error'](_0x14bc3e);return _0x14f68c(_0x14bc3e);}return _0x377087(_0x5ae208);});});}exports['index']=function(_0x292f93,_0x395398){return pm2[_0x0275('0xf')]()[_0x0275('0x10')](function(_0x28827b){if(_0x28827b){var _0x36921c=_['reject'](_0x28827b,function(_0x3e0791){return _0x3e0791[_0x0275('0xb')]==='express'||_0x3e0791[_0x0275('0xb')]===_0x0275('0x11');});return{'rows':_0x36921c,'count':_0x36921c['length']};}return null;})[_0x0275('0x10')](respondWithResult(_0x395398,null))[_0x0275('0x12')](handleError(_0x395398,null));};exports['show']=function(_0x5e7466,_0x56e719){return pm2['describe'](_0x5e7466['params']['id'])[_0x0275('0x10')](respondWithResult(_0x56e719,null))[_0x0275('0x10')](handleEntityNotFound(_0x56e719,null))[_0x0275('0x12')](handleError(_0x56e719,null));};exports['create']=function(_0x7075c9,_0x30730a){if(_0x7075c9[_0x0275('0x13')]['name']&&_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]){var _0x575786=path['join'](__dirname,_0x0275('0x15'),_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]);var _0x592a53=process[_0x0275('0x16')]();process['chdir'](path[_0x0275('0x17')](_0x575786));return execChildProcess()['then'](function(_0x26f2c2){process[_0x0275('0x18')](_0x592a53);return pm2['start']({'name':_0x7075c9[_0x0275('0x13')][_0x0275('0xb')],'script':_0x575786});})[_0x0275('0x10')](function(_0x52946b){pm2[_0x0275('0x19')]();return _0x52946b[0x0];})[_0x0275('0x10')](respondWithResult(_0x30730a,0xc9))[_0x0275('0x12')](handleError(_0x30730a,null));}else{return _0x30730a[_0x0275('0x8')](0x1f4)[_0x0275('0xc')]({'message':_0x0275('0x1a')});}};exports['update']=function(_0x35343c,_0x14d7d8){if(_0x35343c[_0x0275('0x13')]['id']){delete _0x35343c[_0x0275('0x13')]['id'];}var _0x4689a3={'online':'restart','stopped':_0x0275('0x1b')};if(_0x4689a3[_0x0275('0x1c')](_0x35343c[_0x0275('0x13')][_0x0275('0x8')])){return pm2[_0x4689a3[_0x35343c[_0x0275('0x13')]['status']]](_0x35343c[_0x0275('0x1d')]['id'])[_0x0275('0x10')](respondWithResult(_0x14d7d8,0xc8))[_0x0275('0x12')](handleError(_0x14d7d8,null));}else{return _0x14d7d8['status'](0x1f4)['send']({'message':_0x0275('0x1e')});}};exports[_0x0275('0x1f')]=function(_0x5dc2bc,_0x7eff96){if(_0x5dc2bc[_0x0275('0x13')]['id']){delete _0x5dc2bc[_0x0275('0x13')]['id'];}if(_0x5dc2bc[_0x0275('0x1d')]['id']){return pm2['delete'](_0x5dc2bc[_0x0275('0x1d')]['id'])[_0x0275('0x10')](function(_0x3bba47){pm2[_0x0275('0x19')]();return _0x3bba47[0x0];})['then'](respondWithResult(_0x7eff96,null))[_0x0275('0x12')](handleError(_0x7eff96,null));}else{return _0x7eff96['status'](0x1f4)[_0x0275('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xbee3=['sendStatus','status','json','error','name','send','info','index','then','reject','length','describe','params','catch','create','body','join','script','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','stop','Unknown\x20id','../../config/pm2','path','child_process','bluebird'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xbee3,0xd5));var _0x3bee=function(_0xc3f2ee,_0x24d021){_0xc3f2ee=_0xc3f2ee-0x0;var _0x5600ef=_0xbee3[_0xc3f2ee];return _0x5600ef;};'use strict';var _=require('lodash');var pm2=require(_0x3bee('0x0'));var logger=require('../../config/logger')('api');var path=require(_0x3bee('0x1'));var exec=require(_0x3bee('0x2'))['exec'];var BPromise=require(_0x3bee('0x3'));function handleEntityNotFound(_0x1956c1,_0x1cf379){return function(_0x507c6a){if(!_0x507c6a){_0x1956c1[_0x3bee('0x4')](0x194);;}return _0x507c6a;};}function respondWithResult(_0x3baf77,_0x4c5ef5){_0x4c5ef5=_0x4c5ef5||0xc8;return function(_0x2fdeec){if(_0x2fdeec){return _0x3baf77[_0x3bee('0x5')](_0x4c5ef5)[_0x3bee('0x6')](_0x2fdeec);}return null;};}function handleError(_0x339223,_0xbdd5d5){_0xbdd5d5=_0xbdd5d5||0x1f4;return function(_0x9aab05){logger[_0x3bee('0x7')](_0x9aab05['stack']);if(_0x9aab05[_0x3bee('0x8')]){delete _0x9aab05[_0x3bee('0x8')];}_0x339223[_0x3bee('0x5')](_0xbdd5d5)[_0x3bee('0x9')](_0x9aab05);};}function execChildProcess(){return new BPromise(function(_0x356fef,_0xc53ada){exec('npm\x20install',function(_0x32c0b,_0x5bb283,_0x2da716){logger[_0x3bee('0xa')](_0x5bb283);logger[_0x3bee('0xa')](_0x2da716);if(_0x32c0b){logger[_0x3bee('0x7')](_0x32c0b);return _0xc53ada(_0x32c0b);}return _0x356fef(_0x5bb283);});});}exports[_0x3bee('0xb')]=function(_0x459129,_0xc8c1f0){return pm2['list']()[_0x3bee('0xc')](function(_0x33504d){if(_0x33504d){var _0x31ac52=_[_0x3bee('0xd')](_0x33504d,function(_0x3a0396){return _0x3a0396['name']==='express'||_0x3a0396[_0x3bee('0x8')]==='motion2';});return{'rows':_0x31ac52,'count':_0x31ac52[_0x3bee('0xe')]};}return null;})[_0x3bee('0xc')](respondWithResult(_0xc8c1f0,null))['catch'](handleError(_0xc8c1f0,null));};exports['show']=function(_0x1582a4,_0x36c5aa){return pm2[_0x3bee('0xf')](_0x1582a4[_0x3bee('0x10')]['id'])['then'](respondWithResult(_0x36c5aa,null))[_0x3bee('0xc')](handleEntityNotFound(_0x36c5aa,null))[_0x3bee('0x11')](handleError(_0x36c5aa,null));};exports[_0x3bee('0x12')]=function(_0x49b32d,_0x33d812){if(_0x49b32d[_0x3bee('0x13')][_0x3bee('0x8')]&&_0x49b32d['body']['script']){var _0x1afd0f=path[_0x3bee('0x14')](__dirname,'../../files/plugins',_0x49b32d[_0x3bee('0x13')][_0x3bee('0x15')]);var _0x2eea75=process[_0x3bee('0x16')]();process[_0x3bee('0x17')](path[_0x3bee('0x18')](_0x1afd0f));return execChildProcess()[_0x3bee('0xc')](function(_0x582fa9){process[_0x3bee('0x17')](_0x2eea75);return pm2[_0x3bee('0x19')]({'name':_0x49b32d[_0x3bee('0x13')][_0x3bee('0x8')],'script':_0x1afd0f});})['then'](function(_0x45249c){pm2[_0x3bee('0x1a')]();return _0x45249c[0x0];})[_0x3bee('0xc')](respondWithResult(_0x33d812,0xc9))['catch'](handleError(_0x33d812,null));}else{return _0x33d812['status'](0x1f4)[_0x3bee('0x9')]({'message':_0x3bee('0x1b')});}};exports['update']=function(_0x2c0e50,_0x1b4ce0){if(_0x2c0e50[_0x3bee('0x13')]['id']){delete _0x2c0e50['body']['id'];}var _0x1984c4={'online':_0x3bee('0x1c'),'stopped':_0x3bee('0x1d')};if(_0x1984c4['hasOwnProperty'](_0x2c0e50[_0x3bee('0x13')][_0x3bee('0x5')])){return pm2[_0x1984c4[_0x2c0e50[_0x3bee('0x13')]['status']]](_0x2c0e50[_0x3bee('0x10')]['id'])[_0x3bee('0xc')](respondWithResult(_0x1b4ce0,0xc8))[_0x3bee('0x11')](handleError(_0x1b4ce0,null));}else{return _0x1b4ce0[_0x3bee('0x5')](0x1f4)[_0x3bee('0x9')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x3fbc8c,_0x1e1529){if(_0x3fbc8c[_0x3bee('0x13')]['id']){delete _0x3fbc8c[_0x3bee('0x13')]['id'];}if(_0x3fbc8c['params']['id']){return pm2['delete'](_0x3fbc8c[_0x3bee('0x10')]['id'])[_0x3bee('0xc')](function(_0x4f5b58){pm2['dump']();return _0x4f5b58[0x0];})[_0x3bee('0xc')](respondWithResult(_0x1e1529,null))[_0x3bee('0x11')](handleError(_0x1e1529,null));}else{return _0x1e1529[_0x3bee('0x5')](0x1f4)[_0x3bee('0x9')]({'message':_0x3bee('0x1e')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index e507e8b..11f8570 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 _0xd89c=['getQueues','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues'];(function(_0x2bafa0,_0x400c73){var _0x16e95d=function(_0x5365b8){while(--_0x5365b8){_0x2bafa0['push'](_0x2bafa0['shift']());}};_0x16e95d(++_0x400c73);}(_0xd89c,0x1c3));var _0xcd89=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd89c[_0x19e35c];return _0x3e1fe8;};'use strict';var express=require(_0xcd89('0x0'));var router=express[_0xcd89('0x1')]();var auth=require(_0xcd89('0x2'));var controller=require(_0xcd89('0x3'));router[_0xcd89('0x4')](_0xcd89('0x5'),auth[_0xcd89('0x6')](),controller[_0xcd89('0x7')]);router[_0xcd89('0x4')](_0xcd89('0x8'),auth[_0xcd89('0x6')](),controller[_0xcd89('0x9')]);module['exports']=router; \ No newline at end of file +var _0x18e4=['exports','express','Router','./realtime.controller','get','isAuthenticated','getQueues'];(function(_0x5a0559,_0x16a2bb){var _0x5b2a4b=function(_0x26977b){while(--_0x26977b){_0x5a0559['push'](_0x5a0559['shift']());}};_0x5b2a4b(++_0x16a2bb);}(_0x18e4,0xe8));var _0x418e=function(_0x1bec0d,_0x338db4){_0x1bec0d=_0x1bec0d-0x0;var _0x49e3e3=_0x18e4[_0x1bec0d];return _0x49e3e3;};'use strict';var express=require(_0x418e('0x0'));var router=express[_0x418e('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x418e('0x2'));router[_0x418e('0x3')]('/agents',auth[_0x418e('0x4')](),controller['getAgents']);router['get']('/queues',auth[_0x418e('0x4')](),controller[_0x418e('0x5')]);module[_0x418e('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index d5d6a90..c06e002 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 _0xe2fe=['client','http','offset','limit','count','status','error','stack','name','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','request','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','outbound','pTalking','originated','message','dialActive','dialMethod','startPredictive','startProgressive','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','map','get','agents','loggedInDb','voice','busy','find','pick','filter','queue','connectedlinenum','internal','toString','UserId','accountcode','voiceStatus','online','push','User','Queue','Pause','findAll','QueueId','idle','faxPause','openchannelPause','smsPause','voicePause','whatsappPause','every','length','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','unknown','*pause','getAgents','lastLoginAt','lastPauseAt','pauseType','address','chatPause','mailPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','smsStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','resolve','rawAttributes','fieldName','type','query','role','agent','getOptions','raw','user','userProfileId','UserProfile','getResources','findAndCountAll','omit','globalStatus','globalStatusFilter','pauseTypeFilter','rows','mail','chat','whatsapp','channel','includes','toLowerCase','Invalid\x20channel','key','QueueCampaigns','all','util','../../components/parsers/qs','api','../../mysqldb'];(function(_0x2e2f2f,_0x460269){var _0x3e508e=function(_0x46344d){while(--_0x46344d){_0x2e2f2f['push'](_0x2e2f2f['shift']());}};_0x3e508e(++_0x460269);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xee2f('0x0'));var _=require('lodash');var jayson=require('jayson/promise');var qs=require(_0xee2f('0x1'));var logger=require('../../config/logger')(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var amiClient=jayson[_0xee2f('0x4')][_0xee2f('0x5')]({'port':0x232a});var routingClient=jayson[_0xee2f('0x4')]['http']({'port':0x232c});function respondWithFilteredResult(_0x311a2f,_0x2b7e7c){return function(_0x49926b){if(_0x49926b){var _0x1533a0=typeof _0x2b7e7c[_0xee2f('0x6')]==='undefined'&&typeof _0x2b7e7c[_0xee2f('0x7')]==='undefined';var _0x34007e=_0x49926b[_0xee2f('0x8')];var _0x53f7dd=_0x1533a0?0x0:_0x2b7e7c[_0xee2f('0x6')];var _0x43f451=_0x1533a0?_0x49926b['count']:_0x2b7e7c['offset']+_0x2b7e7c['limit'];var _0x56bbea;if(_0x43f451>=_0x34007e){_0x43f451=_0x34007e;_0x56bbea=0xc8;}else{_0x56bbea=0xce;}_0x311a2f[_0xee2f('0x9')](_0x56bbea);return _0x311a2f['set']('Content-Range',_0x53f7dd+'-'+_0x43f451+'/'+_0x34007e)['json'](_0x49926b);}return null;};}function handleError(_0x25ddf7,_0x346dbc){_0x346dbc=_0x346dbc||0x1f4;return function(_0xa13e7b){logger[_0xee2f('0xa')](_0xa13e7b[_0xee2f('0xb')]);if(_0xa13e7b[_0xee2f('0xc')]){delete _0xa13e7b['name'];}_0x25ddf7[_0xee2f('0x9')](_0x346dbc)['send'](_0xa13e7b);};}function getRealtimeAgents(){return new Promise(function(_0x36db10,_0x271c1d){return amiClient['request'](_0xee2f('0xd'),{})[_0xee2f('0xe')](function(_0x28b614){if(_0x28b614[_0xee2f('0xa')])throw new Error(_0xee2f('0xf'));var _0x58f42a=_0x28b614[_0xee2f('0x10')];return routingClient['request'](_0xee2f('0xd'),{})[_0xee2f('0xe')](function(_0x502eb6){if(_0x502eb6['error'])throw new Error(_0xee2f('0x11'));var _0x5a5078=_0x502eb6[_0xee2f('0x10')];return _0x36db10(_[_0xee2f('0x12')]({},_0x58f42a,_0x5a5078));});})[_0xee2f('0x13')](function(_0x5b83b5){_0x271c1d(_0x5b83b5);});});}function getRealtimeQueues(_0x35e1a4,_0x1e70aa){return new Promise(function(_0x4db2cc,_0x21fdf4){var _0x3d892d=_0x1e70aa==='voice'?amiClient:routingClient;return _0x3d892d['request'](_[_0xee2f('0x14')](_0x1e70aa)+_0xee2f('0x15'),_0x35e1a4)[_0xee2f('0xe')](function(_0x203b2f){if(_0x203b2f[_0xee2f('0xa')])throw new Error(util[_0xee2f('0x16')](_0xee2f('0x17'),_0x1e70aa));return _0x4db2cc(_0x203b2f['result']);})[_0xee2f('0x13')](function(_0x2c47c5){_0x21fdf4(_0x2c47c5);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x15ceda,_0x70e308){return amiClient[_0xee2f('0x18')](_0xee2f('0x19'),{})[_0xee2f('0xe')](function(_0x13013f){if(_0x13013f[_0xee2f('0xa')])throw new Error(_0xee2f('0x1a'));return _0x15ceda(_0x13013f[_0xee2f('0x10')]);})[_0xee2f('0x13')](function(_0x1c8454){_0x70e308(_0x1c8454);});});}function initializeQueues(_0x45c4a0,_0x53f6ed,_0x4ef690,_0x58ba65){var _0x18bdbb=[_0xee2f('0x1b'),_0xee2f('0x1c'),_0xee2f('0x1d'),_0xee2f('0x1e'),_0xee2f('0x1f')];if(_0x4ef690==='voice'&&_0x58ba65===_0xee2f('0x20')){_0x18bdbb['push'](_0xee2f('0x21'),_0xee2f('0x22'),_0xee2f('0x23'),_0xee2f('0x24'),_0xee2f('0x25'),'Trunk',_0xee2f('0x26'),_0xee2f('0x27'),'erlangCalls','erlangCallToSecond',_0xee2f('0x28'),'erlangBusyFactor',_0xee2f('0x29'),_0xee2f('0x2a'),'dialPredictiveIntervalMinThreshold',_0xee2f('0x2b'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0xee2f('0x2c'),_0xee2f('0x2d'),'predictiveIntervalAvgTalktime');}return _0x45c4a0[_0xee2f('0x2e')](function(_0x1b70cc){var _0xd64b7=_0x1b70cc[_0xee2f('0x2f')]({'plain':!![]});_0xd64b7[_0xee2f('0x30')]=[];_0xd64b7['paused']=0x0;_0xd64b7[_0xee2f('0x31')]=0x0;_0xd64b7['loggedIn']=0x0;_0xd64b7[_0xee2f('0x1c')]=0x0;_0xd64b7[_0xee2f('0x1d')]=0x0;if(_0x4ef690===_0xee2f('0x32')){_0xd64b7['talking']=0x0;_0xd64b7[_0xee2f('0x33')]=0x0;if(_0x58ba65==='outbound'){_0xd64b7[_0xee2f('0x21')]=0x0;_0xd64b7['originated']=0x0;}}var _0x3e6dcc=_[_0xee2f('0x34')](_0x53f6ed,['id',_0xd64b7['id']]);if(_0x3e6dcc)_[_0xee2f('0x12')](_0xd64b7,_[_0xee2f('0x35')](_0x3e6dcc,_0x18bdbb));return _0xd64b7;});}function updateAgentVoiceStatus(_0x1b9f6c,_0x21b802,_0x24380b){var _0x3a1013=_[_0xee2f('0x36')](_0x24380b,[_0xee2f('0x37'),_0x21b802[_0xee2f('0xc')]]);if(_0x3a1013['length']===0x0)return _0x1b9f6c[_0xee2f('0x33')]=!![];if(_['some'](_0x3a1013,[_0xee2f('0x38'),_0x1b9f6c[_0xee2f('0x39')][_0xee2f('0x3a')]()]))return _0x1b9f6c[_0xee2f('0x1e')]=!![];if(!_0x1b9f6c[_0xee2f('0x1e')])return _0x1b9f6c[_0xee2f('0x33')]=!![];}function getVoiceQueueAgents(_0x694950,_0x130371,_0x50ddd2,_0x562d58){var _0x5dbbf7=_[_0xee2f('0x34')](_0x130371,['id',_0x694950['id']]);if(!_0x5dbbf7)return _0x694950;return _0x5dbbf7['getMembers']({'raw':!![]})[_0xee2f('0xe')](function(_0x51daf5){for(var _0x558aa3=0x0;_0x558aa3<_0x51daf5['length'];_0x558aa3++){var _0x58e361=_[_0xee2f('0x34')](_0x50ddd2,['id',_0x51daf5[_0x558aa3][_0xee2f('0x3b')]]);if(!_0x58e361){_0x58e361={'id':_0x51daf5[_0x558aa3][_0xee2f('0x3b')],'name':_0x51daf5[_0x558aa3][_0xee2f('0x3b')],'accountcode':'','online':![]};}var _0x4823a7={'id':_0x58e361['id'],'name':_0x58e361['name'],'internal':_0x58e361[_0xee2f('0x3c')],'online':Boolean(_0x58e361['online']),'paused':Boolean(_0x51daf5[_0x558aa3]['paused'])};if(_0x58e361[_0xee2f('0x3d')]===_0xee2f('0x1e'))updateAgentVoiceStatus(_0x4823a7,_0x694950,_0x562d58);if(_0x4823a7[_0xee2f('0x3e')])_0x694950['loggedInDb']++;if(_0x4823a7[_0xee2f('0x33')])_0x694950[_0xee2f('0x33')]++;if(_0x4823a7[_0xee2f('0x1f')]&&!_0x4823a7['busy']&&!_0x4823a7['talking'])_0x694950[_0xee2f('0x1f')]++;_0x694950[_0xee2f('0x30')][_0xee2f('0x3f')](_0x4823a7);}return _0x694950;});}function getQueueAgents(_0x2b9b33,_0x541fa0,_0x20697e){var _0x1df63d=_0xee2f('0x40')+_[_0xee2f('0x14')](_0x20697e)+_0xee2f('0x41');var _0x348ed1=_0x20697e+_0xee2f('0x42');return db[_0x1df63d][_0xee2f('0x43')]({'where':{[_[_0xee2f('0x14')](_0x20697e)+_0xee2f('0x44')]:_0x2b9b33['id']},'raw':!![]})['then'](function(_0x4c1cb4){for(var _0x555bc4=0x0;_0x555bc4<_0x4c1cb4['length'];_0x555bc4++){var _0x11aecb=_[_0xee2f('0x34')](_0x541fa0,['id',_0x4c1cb4[_0x555bc4][_0xee2f('0x3b')]]);if(!_0x11aecb){_0x11aecb={'id':_0x4c1cb4[_0x555bc4][_0xee2f('0x3b')],'name':_0x4c1cb4[_0x555bc4][_0xee2f('0x3b')],'online':![],['pauseField']:![]};}var _0x556239={'id':_0x11aecb['id'],'name':_0x11aecb[_0xee2f('0xc')],'online':Boolean(_0x11aecb[_0xee2f('0x3e')]),'paused':Boolean(_0x11aecb[_0x348ed1])};if(_0x556239[_0xee2f('0x3e')])_0x2b9b33[_0xee2f('0x31')]++;_0x2b9b33['agents']['push'](_0x556239);}return _0x2b9b33;});}function isIdle(_0x5aac72){return _0x5aac72===_0xee2f('0x45')||_0x5aac72==='unknown'||_0x5aac72==='unavailable'||_0x5aac72==='ringing'||_['isNil'](_0x5aac72);}function isAgentPaused(_0x3834d1,_0x3ebb54){var _0x32da72=[_0x3834d1['chatPause'],_0x3834d1[_0xee2f('0x46')],_0x3834d1['mailPause'],_0x3834d1[_0xee2f('0x47')],_0x3834d1[_0xee2f('0x48')],_0x3834d1[_0xee2f('0x49')],_0x3834d1[_0xee2f('0x4a')]];if(!_0x3ebb54)return _[_0xee2f('0x4b')](_0x32da72);var _0x4978eb=_['filter'](_0x32da72);return _0x4978eb[_0xee2f('0x4c')]>0x0&&_0x4978eb['length']<_0x32da72[_0xee2f('0x4c')]?!![]:![];}function isAgentIdle(_0x282e89){if(_0x282e89[_0xee2f('0x3d')]!==_0xee2f('0x45')&&_0x282e89['voicePause']){_0x282e89['voiceStatus']=_0xee2f('0x4d');return![];}return _[_0xee2f('0x4b')]([_0x282e89[_0xee2f('0x4e')],_0x282e89[_0xee2f('0x4f')],_0x282e89[_0xee2f('0x50')],_0x282e89[_0xee2f('0x51')],_0x282e89[_0xee2f('0x52')],_0x282e89[_0xee2f('0x3d')],_0x282e89[_0xee2f('0x53')]],isIdle);}function getAgentStatus(_0x13c076){var _0x47270a=_0xee2f('0x54');if(isAgentPaused(_0x13c076))_0x47270a='pause';else if(isAgentPaused(_0x13c076,!![]))_0x47270a=_0xee2f('0x55');else if(isAgentIdle(_0x13c076))_0x47270a=_0xee2f('0x45');else _0x47270a=_0xee2f('0x33');return _0x47270a;}exports[_0xee2f('0x56')]=function(_0x55c8f8,_0x114902){var _0xb3bf3f={'count':0x0,'rows':[]},_0x3a476f={},_0xda9ad5,_0xa88c4c,_0x533c10=['userpic','online',_0xee2f('0x57'),_0xee2f('0x58'),_0xee2f('0x59'),_0xee2f('0x58'),_0xee2f('0x39'),_0xee2f('0x5a'),_0xee2f('0x5b'),'openchannelPause',_0xee2f('0x5c'),_0xee2f('0x48'),_0xee2f('0x4a'),_0xee2f('0x46'),_0xee2f('0x49'),_0xee2f('0x5d'),_0xee2f('0x5e'),_0xee2f('0x5f'),_0xee2f('0x60'),'whatsappCapacity',_0xee2f('0x61'),'chatCurrentCapacity',_0xee2f('0x62'),_0xee2f('0x63'),_0xee2f('0x64'),_0xee2f('0x65'),_0xee2f('0x66'),'chatStatus',_0xee2f('0x51'),_0xee2f('0x50'),_0xee2f('0x52'),_0xee2f('0x53'),'faxStatus','voiceStatus','chatStatusTime','openchannelStatusTime','mailStatusTime',_0xee2f('0x67'),'whatsappStatusTime',_0xee2f('0x68'),_0xee2f('0x69'),_0xee2f('0x37'),_0xee2f('0x6a'),_0xee2f('0x6b'),_0xee2f('0x6c'),'phoneBarEnableAutomaticScreenRecording','routealias'],_0x8b135b=[_0xee2f('0x5b'),'openchannelPause',_0xee2f('0x5c'),'smsPause',_0xee2f('0x4a'),'faxPause',_0xee2f('0x49'),_0xee2f('0x3e')];Promise[_0xee2f('0x6d')]()['then'](function(){var _0x3cc477=_[_0xee2f('0x2e')](db[_0xee2f('0x40')][_0xee2f('0x6e')],function(_0xfeddec){return{'name':_0xfeddec[_0xee2f('0x6f')],'type':_0xfeddec[_0xee2f('0x70')]['key']};});_0x55c8f8[_0xee2f('0x71')][_0xee2f('0x72')]=_0xee2f('0x73');_0x55c8f8[_0xee2f('0x71')][_0xee2f('0x3e')]=!![];_0x3a476f=qs[_0xee2f('0x74')](_0x3cc477,_0x55c8f8);_0x3a476f[_0xee2f('0x75')]=!![];if(_0x55c8f8[_0xee2f('0x76')][_0xee2f('0x72')]===_0xee2f('0x76')){var _0x2717a0={'params':{'id':_0x55c8f8['user'][_0xee2f('0x77')]},'query':{'section':_0xee2f('0xd'),'role':'agent','online':!![],'nolimit':_0x55c8f8[_0xee2f('0x71')]['nolimit'],'sort':_0x55c8f8[_0xee2f('0x71')]['sort'],'filter':_0x55c8f8['query'][_0xee2f('0x36')],'raw':!![]}};return db[_0xee2f('0x78')][_0xee2f('0x79')](_0x2717a0);}return db[_0xee2f('0x40')][_0xee2f('0x7a')](_0x3a476f);})['then'](function(_0x238e7d){_0xb3bf3f[_0xee2f('0x8')]=_0x238e7d[_0xee2f('0x8')];_0xda9ad5=_0x238e7d['rows'];return getRealtimeAgents();})[_0xee2f('0xe')](function(_0x413d70){_0xa88c4c=_0x413d70['rows'];return _0xda9ad5[_0xee2f('0x2e')](function(_0x32800d){var _0x337d7f=_[_0xee2f('0x34')](_0xa88c4c,['id',_0x32800d['id']]);if(_0x337d7f)_[_0xee2f('0x12')](_0x32800d,_[_0xee2f('0x35')](_[_0xee2f('0x7b')](_0x337d7f,_0x8b135b),_0x533c10));_0x32800d[_0xee2f('0x7c')]=getAgentStatus(_0x32800d);return _0x32800d;});})[_0xee2f('0xe')](function(_0x4adcbe){if(_0x55c8f8['query']['globalStatusFilter']){var _0x3dfd43=_[_0xee2f('0x36')](_0x4adcbe,[_0xee2f('0x7c'),_0x55c8f8[_0xee2f('0x71')][_0xee2f('0x7d')]]);if(_0x55c8f8['query'][_0xee2f('0x7e')]){_0x3dfd43=_[_0xee2f('0x36')](_0x3dfd43,['pauseType',_0x55c8f8[_0xee2f('0x71')][_0xee2f('0x7e')]]);}}_0xb3bf3f[_0xee2f('0x7f')]=_0x3dfd43||_0x4adcbe;return _0xb3bf3f;})['then'](respondWithFilteredResult(_0x114902,_0x3a476f))[_0xee2f('0x13')](handleError(_0x114902,null));};exports['getQueues']=function(_0x41fce2,_0x9732af){var _0x4e648e=[_0xee2f('0x80'),_0xee2f('0x81'),'sms','openchannel','fax',_0xee2f('0x82'),'voice'];var _0x4cbfc3={'count':0x0,'rows':[]},_0xbca78={},_0x300c17,_0x50a972,_0x3da7c4,_0x572318,_0x25bba2;Promise[_0xee2f('0x6d')]()[_0xee2f('0xe')](function(){if(_0x41fce2[_0xee2f('0x71')][_0xee2f('0x83')]){if(!_[_0xee2f('0x84')](_0x4e648e,_0x41fce2[_0xee2f('0x71')]['channel'][_0xee2f('0x85')]()))throw new Error(_0xee2f('0x86'));_0x300c17=_0x41fce2[_0xee2f('0x71')][_0xee2f('0x83')][_0xee2f('0x85')]();}var _0x4bc6fa=_[_0xee2f('0x14')](_0x300c17)+_0xee2f('0x41');var _0x1c28a1=_[_0xee2f('0x2e')](db[_0x4bc6fa][_0xee2f('0x6e')],function(_0x1b3abf){return{'name':_0x1b3abf['fieldName'],'type':_0x1b3abf['type'][_0xee2f('0x87')]};});_0xbca78=qs[_0xee2f('0x74')](_0x1c28a1,_0x41fce2);if(_0x41fce2[_0xee2f('0x76')][_0xee2f('0x72')]===_0xee2f('0x76')){var _0x266fb7={'params':{'id':_0x41fce2[_0xee2f('0x76')]['userProfileId']},'query':{'section':_0x300c17==='voice'&&_0x41fce2[_0xee2f('0x71')][_0xee2f('0x70')]===_0xee2f('0x20')?_0xee2f('0x88'):_[_0xee2f('0x14')](_0x300c17)+_0xee2f('0x15'),'type':_0x41fce2[_0xee2f('0x71')][_0xee2f('0x70')],'nolimit':!![],'sort':_0xee2f('0xc'),'filter':_0x41fce2[_0xee2f('0x71')][_0xee2f('0x36')]}};return db[_0xee2f('0x78')]['getResources'](_0x266fb7);}return db[_0x4bc6fa]['findAndCountAll'](_0xbca78);})[_0xee2f('0xe')](function(_0x5bd7c8){_0x4cbfc3['count']=_0x5bd7c8['count'];_0x50a972=_0x5bd7c8['rows'];return getRealtimeQueues(_0x41fce2,_0x300c17);})[_0xee2f('0xe')](function(_0x277507){_0x572318=_0x277507['rows'];return getRealtimeAgents();})['then'](function(_0x9c89a3){_0x3da7c4=_0x9c89a3[_0xee2f('0x7f')];if(_0x300c17!=_0xee2f('0x32'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x4aeae5){_0x25bba2=_0x4aeae5?_0x4aeae5[_0xee2f('0x7f')]:[];return initializeQueues(_0x50a972,_0x572318,_0x300c17,_0x41fce2[_0xee2f('0x71')][_0xee2f('0x70')]);})['then'](function(_0xd7c8f8){var _0x4b0611=_0xd7c8f8[_0xee2f('0x2e')](function(_0x5f3829){if(_0x300c17===_0xee2f('0x32'))return getVoiceQueueAgents(_0x5f3829,_0x50a972,_0x3da7c4,_0x25bba2);else return getQueueAgents(_0x5f3829,_0x3da7c4,_0x300c17);});return Promise[_0xee2f('0x89')](_0x4b0611);})[_0xee2f('0xe')](function(_0x47db82){_0x4cbfc3['rows']=_0x47db82;return _0x4cbfc3;})[_0xee2f('0xe')](respondWithFilteredResult(_0x9732af,_0xbca78))[_0xee2f('0x13')](handleError(_0x9732af,null));}; \ No newline at end of file +var _0x31f0=['routealias','smsPause','resolve','fieldName','type','key','query','agent','getOptions','role','user','userProfileId','sort','filter','UserProfile','getResources','findAndCountAll','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','mail','sms','openchannel','fax','includes','channel','toLowerCase','rawAttributes','QueueCampaigns','Queues','all','util','jayson/promise','../../config/logger','api','../../mysqldb','client','http','undefined','limit','offset','count','status','Content-Range','json','error','stack','name','send','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase','format','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','available','waiting','talking','paused','outbound','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','agents','loggedIn','busy','pick','length','some','connectedlinenum','internal','toString','find','UserId','accountcode','online','push','User','Queue','Pause','findAll','QueueId','loggedInDb','unknown','unavailable','ringing','chatPause','faxPause','mailPause','voicePause','every','idle','voiceStatus','pause','chatStatus','faxStatus','openchannelStatus','*pause','userpic','lastLoginAt','pauseType','openchannelPause','whatsappPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','whatsappStatus','chatStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording'];(function(_0x5032a7,_0x59d13b){var _0x116ad1=function(_0x459b4e){while(--_0x459b4e){_0x5032a7['push'](_0x5032a7['shift']());}};_0x116ad1(++_0x59d13b);}(_0x31f0,0xb7));var _0x031f=function(_0x56d6d6,_0x702a1d){_0x56d6d6=_0x56d6d6-0x0;var _0x2975a2=_0x31f0[_0x56d6d6];return _0x2975a2;};'use strict';var util=require(_0x031f('0x0'));var _=require('lodash');var jayson=require(_0x031f('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x031f('0x2'))(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var amiClient=jayson[_0x031f('0x5')]['http']({'port':0x232a});var routingClient=jayson[_0x031f('0x5')][_0x031f('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x4f6059,_0x4c0f94){return function(_0x56328c){if(_0x56328c){var _0x3dc98e=typeof _0x4c0f94['offset']===_0x031f('0x7')&&typeof _0x4c0f94[_0x031f('0x8')]===_0x031f('0x7');var _0x3e41ed=_0x56328c['count'];var _0x2e5624=_0x3dc98e?0x0:_0x4c0f94[_0x031f('0x9')];var _0x327f11=_0x3dc98e?_0x56328c[_0x031f('0xa')]:_0x4c0f94[_0x031f('0x9')]+_0x4c0f94[_0x031f('0x8')];var _0x2202dc;if(_0x327f11>=_0x3e41ed){_0x327f11=_0x3e41ed;_0x2202dc=0xc8;}else{_0x2202dc=0xce;}_0x4f6059[_0x031f('0xb')](_0x2202dc);return _0x4f6059['set'](_0x031f('0xc'),_0x2e5624+'-'+_0x327f11+'/'+_0x3e41ed)[_0x031f('0xd')](_0x56328c);}return null;};}function handleError(_0x28da6e,_0x351052){_0x351052=_0x351052||0x1f4;return function(_0x3819bb){logger[_0x031f('0xe')](_0x3819bb[_0x031f('0xf')]);if(_0x3819bb['name']){delete _0x3819bb[_0x031f('0x10')];}_0x28da6e[_0x031f('0xb')](_0x351052)[_0x031f('0x11')](_0x3819bb);};}function getRealtimeAgents(){return new Promise(function(_0x2e3dfe,_0x2ea549){return amiClient['request']('Agents',{})[_0x031f('0x12')](function(_0x3a10aa){if(_0x3a10aa[_0x031f('0xe')])throw new Error(_0x031f('0x13'));var _0x5196b1=_0x3a10aa[_0x031f('0x14')];return routingClient[_0x031f('0x15')]('Agents',{})[_0x031f('0x12')](function(_0x535e70){if(_0x535e70[_0x031f('0xe')])throw new Error(_0x031f('0x16'));var _0x563bc8=_0x535e70[_0x031f('0x14')];return _0x2e3dfe(_[_0x031f('0x17')]({},_0x5196b1,_0x563bc8));});})[_0x031f('0x18')](function(_0x1b76d6){_0x2ea549(_0x1b76d6);});});}function getRealtimeQueues(_0x2825ef,_0xf76f1b){return new Promise(function(_0x345bde,_0x29dd6e){var _0x48a76e=_0xf76f1b===_0x031f('0x19')?amiClient:routingClient;return _0x48a76e[_0x031f('0x15')](_[_0x031f('0x1a')](_0xf76f1b)+'Queues',_0x2825ef)['then'](function(_0xa11a2b){if(_0xa11a2b['error'])throw new Error(util[_0x031f('0x1b')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0xf76f1b));return _0x345bde(_0xa11a2b['result']);})['catch'](function(_0x971691){_0x29dd6e(_0x971691);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x12c406,_0x2920cd){return amiClient[_0x031f('0x15')]('VoiceQueuesChannels',{})[_0x031f('0x12')](function(_0x5a64c0){if(_0x5a64c0[_0x031f('0xe')])throw new Error(_0x031f('0x1c'));return _0x12c406(_0x5a64c0[_0x031f('0x14')]);})['catch'](function(_0x35af16){_0x2920cd(_0x35af16);});});}function initializeQueues(_0x3b2a51,_0x54b44e,_0x3847b2,_0x28a617){var _0x2403e9=['loggedIn',_0x031f('0x1d'),_0x031f('0x1e'),_0x031f('0x1f'),_0x031f('0x20')];if(_0x3847b2===_0x031f('0x19')&&_0x28a617===_0x031f('0x21')){_0x2403e9['push'](_0x031f('0x22'),_0x031f('0x23'),_0x031f('0x24'),_0x031f('0x25'),_0x031f('0x26'),_0x031f('0x27'),_0x031f('0x28'),_0x031f('0x29'),_0x031f('0x2a'),_0x031f('0x2b'),_0x031f('0x2c'),'erlangBusyFactor',_0x031f('0x2d'),_0x031f('0x2e'),_0x031f('0x2f'),_0x031f('0x30'),_0x031f('0x31'),_0x031f('0x32'),_0x031f('0x33'),_0x031f('0x34'),_0x031f('0x35'),_0x031f('0x36'));}return _0x3b2a51[_0x031f('0x37')](function(_0x17217d){var _0x4610fa=_0x17217d['get']({'plain':!![]});_0x4610fa[_0x031f('0x38')]=[];_0x4610fa[_0x031f('0x20')]=0x0;_0x4610fa['loggedInDb']=0x0;_0x4610fa[_0x031f('0x39')]=0x0;_0x4610fa[_0x031f('0x1d')]=0x0;_0x4610fa['waiting']=0x0;if(_0x3847b2===_0x031f('0x19')){_0x4610fa[_0x031f('0x1f')]=0x0;_0x4610fa[_0x031f('0x3a')]=0x0;if(_0x28a617===_0x031f('0x21')){_0x4610fa['pTalking']=0x0;_0x4610fa['originated']=0x0;}}var _0x36ab13=_['find'](_0x54b44e,['id',_0x4610fa['id']]);if(_0x36ab13)_[_0x031f('0x17')](_0x4610fa,_[_0x031f('0x3b')](_0x36ab13,_0x2403e9));return _0x4610fa;});}function updateAgentVoiceStatus(_0x43ef89,_0x56a7f0,_0x5c33c5){var _0x3c1e48=_['filter'](_0x5c33c5,['queue',_0x56a7f0[_0x031f('0x10')]]);if(_0x3c1e48[_0x031f('0x3c')]===0x0)return _0x43ef89[_0x031f('0x3a')]=!![];if(_[_0x031f('0x3d')](_0x3c1e48,[_0x031f('0x3e'),_0x43ef89[_0x031f('0x3f')][_0x031f('0x40')]()]))return _0x43ef89['talking']=!![];if(!_0x43ef89[_0x031f('0x1f')])return _0x43ef89[_0x031f('0x3a')]=!![];}function getVoiceQueueAgents(_0xb3b188,_0x1e9302,_0x58daa2,_0x2be5d1){var _0x10f590=_[_0x031f('0x41')](_0x1e9302,['id',_0xb3b188['id']]);if(!_0x10f590)return _0xb3b188;return _0x10f590['getMembers']({'raw':!![]})[_0x031f('0x12')](function(_0x3b504c){for(var _0x5d6826=0x0;_0x5d6826<_0x3b504c[_0x031f('0x3c')];_0x5d6826++){var _0x268dc7=_['find'](_0x58daa2,['id',_0x3b504c[_0x5d6826]['UserId']]);if(!_0x268dc7){_0x268dc7={'id':_0x3b504c[_0x5d6826][_0x031f('0x42')],'name':_0x3b504c[_0x5d6826][_0x031f('0x42')],'accountcode':'','online':![]};}var _0x9efbc4={'id':_0x268dc7['id'],'name':_0x268dc7[_0x031f('0x10')],'internal':_0x268dc7[_0x031f('0x43')],'online':Boolean(_0x268dc7[_0x031f('0x44')]),'paused':Boolean(_0x3b504c[_0x5d6826][_0x031f('0x20')])};if(_0x268dc7['voiceStatus']===_0x031f('0x1f'))updateAgentVoiceStatus(_0x9efbc4,_0xb3b188,_0x2be5d1);if(_0x9efbc4[_0x031f('0x44')])_0xb3b188['loggedInDb']++;if(_0x9efbc4[_0x031f('0x3a')])_0xb3b188['busy']++;if(_0x9efbc4[_0x031f('0x20')]&&!_0x9efbc4[_0x031f('0x3a')]&&!_0x9efbc4['talking'])_0xb3b188[_0x031f('0x20')]++;_0xb3b188[_0x031f('0x38')][_0x031f('0x45')](_0x9efbc4);}return _0xb3b188;});}function getQueueAgents(_0x50f5d4,_0x98747f,_0x213e1c){var _0x1d3324=_0x031f('0x46')+_[_0x031f('0x1a')](_0x213e1c)+_0x031f('0x47');var _0x236a18=_0x213e1c+_0x031f('0x48');return db[_0x1d3324][_0x031f('0x49')]({'where':{[_['startCase'](_0x213e1c)+_0x031f('0x4a')]:_0x50f5d4['id']},'raw':!![]})[_0x031f('0x12')](function(_0x28f2b3){for(var _0x3205ce=0x0;_0x3205ce<_0x28f2b3[_0x031f('0x3c')];_0x3205ce++){var _0x2c879c=_[_0x031f('0x41')](_0x98747f,['id',_0x28f2b3[_0x3205ce][_0x031f('0x42')]]);if(!_0x2c879c){_0x2c879c={'id':_0x28f2b3[_0x3205ce][_0x031f('0x42')],'name':_0x28f2b3[_0x3205ce]['UserId'],'online':![],['pauseField']:![]};}var _0x38539a={'id':_0x2c879c['id'],'name':_0x2c879c['name'],'online':Boolean(_0x2c879c['online']),'paused':Boolean(_0x2c879c[_0x236a18])};if(_0x38539a[_0x031f('0x44')])_0x50f5d4[_0x031f('0x4b')]++;_0x50f5d4[_0x031f('0x38')][_0x031f('0x45')](_0x38539a);}return _0x50f5d4;});}function isIdle(_0x10d625){return _0x10d625==='idle'||_0x10d625===_0x031f('0x4c')||_0x10d625===_0x031f('0x4d')||_0x10d625===_0x031f('0x4e')||_['isNil'](_0x10d625);}function isAgentPaused(_0x274166,_0x2e7e35){var _0x2dba78=[_0x274166[_0x031f('0x4f')],_0x274166[_0x031f('0x50')],_0x274166[_0x031f('0x51')],_0x274166['openchannelPause'],_0x274166['smsPause'],_0x274166[_0x031f('0x52')],_0x274166['whatsappPause']];if(!_0x2e7e35)return _[_0x031f('0x53')](_0x2dba78);var _0x3bba44=_['filter'](_0x2dba78);return _0x3bba44[_0x031f('0x3c')]>0x0&&_0x3bba44['length']<_0x2dba78['length']?!![]:![];}function isAgentIdle(_0x35a949){if(_0x35a949['voiceStatus']!==_0x031f('0x54')&&_0x35a949['voicePause']){_0x35a949[_0x031f('0x55')]=_0x031f('0x56');return![];}return _['every']([_0x35a949[_0x031f('0x57')],_0x35a949[_0x031f('0x58')],_0x35a949['mailStatus'],_0x35a949[_0x031f('0x59')],_0x35a949['smsStatus'],_0x35a949[_0x031f('0x55')],_0x35a949['whatsappStatus']],isIdle);}function getAgentStatus(_0x1464df){var _0x24848b=_0x031f('0x4c');if(isAgentPaused(_0x1464df))_0x24848b=_0x031f('0x56');else if(isAgentPaused(_0x1464df,!![]))_0x24848b=_0x031f('0x5a');else if(isAgentIdle(_0x1464df))_0x24848b='idle';else _0x24848b=_0x031f('0x3a');return _0x24848b;}exports['getAgents']=function(_0x186957,_0x414350){var _0x4d49f8={'count':0x0,'rows':[]},_0x1f9c55={},_0x7ba7ce,_0x510d17,_0x3b3632=[_0x031f('0x5b'),'online',_0x031f('0x5c'),'lastPauseAt',_0x031f('0x5d'),'lastPauseAt',_0x031f('0x3f'),'address',_0x031f('0x4f'),_0x031f('0x5e'),'mailPause','smsPause',_0x031f('0x5f'),_0x031f('0x50'),'voicePause',_0x031f('0x60'),_0x031f('0x61'),_0x031f('0x62'),_0x031f('0x63'),_0x031f('0x64'),_0x031f('0x65'),_0x031f('0x66'),_0x031f('0x67'),'mailCurrentCapacity',_0x031f('0x68'),_0x031f('0x69'),_0x031f('0x6a'),'chatStatus',_0x031f('0x59'),_0x031f('0x6b'),'smsStatus',_0x031f('0x6c'),_0x031f('0x58'),_0x031f('0x55'),_0x031f('0x6d'),'openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime',_0x031f('0x6e'),_0x031f('0x6f'),'queue',_0x031f('0x70'),_0x031f('0x71'),'phoneBarEnableScreenRecordingByAgent',_0x031f('0x72'),_0x031f('0x73')],_0x154ad2=[_0x031f('0x4f'),_0x031f('0x5e'),_0x031f('0x51'),_0x031f('0x74'),_0x031f('0x5f'),_0x031f('0x50'),_0x031f('0x52'),'online'];Promise[_0x031f('0x75')]()['then'](function(){var _0x13409d=_[_0x031f('0x37')](db[_0x031f('0x46')]['rawAttributes'],function(_0x4c1b74){return{'name':_0x4c1b74[_0x031f('0x76')],'type':_0x4c1b74[_0x031f('0x77')][_0x031f('0x78')]};});_0x186957[_0x031f('0x79')]['role']=_0x031f('0x7a');_0x186957['query']['online']=!![];_0x1f9c55=qs[_0x031f('0x7b')](_0x13409d,_0x186957);_0x1f9c55['raw']=!![];if(_0x186957['user'][_0x031f('0x7c')]===_0x031f('0x7d')){var _0x248f8b={'params':{'id':_0x186957[_0x031f('0x7d')][_0x031f('0x7e')]},'query':{'section':'Agents','role':'agent','online':!![],'nolimit':_0x186957[_0x031f('0x79')]['nolimit'],'sort':_0x186957[_0x031f('0x79')][_0x031f('0x7f')],'filter':_0x186957['query'][_0x031f('0x80')],'raw':!![]}};return db[_0x031f('0x81')][_0x031f('0x82')](_0x248f8b);}return db[_0x031f('0x46')][_0x031f('0x83')](_0x1f9c55);})[_0x031f('0x12')](function(_0x5bea08){_0x4d49f8['count']=_0x5bea08[_0x031f('0xa')];_0x7ba7ce=_0x5bea08[_0x031f('0x84')];return getRealtimeAgents();})[_0x031f('0x12')](function(_0x1d973d){_0x510d17=_0x1d973d[_0x031f('0x84')];return _0x7ba7ce[_0x031f('0x37')](function(_0x3cfb21){var _0x5c99c6=_['find'](_0x510d17,['id',_0x3cfb21['id']]);if(_0x5c99c6)_['merge'](_0x3cfb21,_['pick'](_[_0x031f('0x85')](_0x5c99c6,_0x154ad2),_0x3b3632));_0x3cfb21[_0x031f('0x86')]=getAgentStatus(_0x3cfb21);return _0x3cfb21;});})[_0x031f('0x12')](function(_0x4fb931){if(_0x186957[_0x031f('0x79')][_0x031f('0x87')]){var _0x5133a6=_[_0x031f('0x80')](_0x4fb931,[_0x031f('0x86'),_0x186957[_0x031f('0x79')][_0x031f('0x87')]]);if(_0x186957[_0x031f('0x79')][_0x031f('0x88')]){_0x5133a6=_[_0x031f('0x80')](_0x5133a6,['pauseType',_0x186957['query'][_0x031f('0x88')]]);}}_0x4d49f8['rows']=_0x5133a6||_0x4fb931;return _0x4d49f8;})[_0x031f('0x12')](respondWithFilteredResult(_0x414350,_0x1f9c55))['catch'](handleError(_0x414350,null));};exports[_0x031f('0x89')]=function(_0x1cefb8,_0x3424c9){var _0x556fc6=[_0x031f('0x8a'),'chat',_0x031f('0x8b'),_0x031f('0x8c'),_0x031f('0x8d'),'whatsapp',_0x031f('0x19')];var _0x398e7c={'count':0x0,'rows':[]},_0x3c4b09={},_0x3e3ff5,_0x45330f,_0x5a55e7,_0x55284b,_0x282ab6;Promise[_0x031f('0x75')]()['then'](function(){if(_0x1cefb8[_0x031f('0x79')]['channel']){if(!_[_0x031f('0x8e')](_0x556fc6,_0x1cefb8[_0x031f('0x79')][_0x031f('0x8f')][_0x031f('0x90')]()))throw new Error('Invalid\x20channel');_0x3e3ff5=_0x1cefb8[_0x031f('0x79')][_0x031f('0x8f')][_0x031f('0x90')]();}var _0x5b336f=_[_0x031f('0x1a')](_0x3e3ff5)+_0x031f('0x47');var _0x4deefb=_[_0x031f('0x37')](db[_0x5b336f][_0x031f('0x91')],function(_0x11d498){return{'name':_0x11d498[_0x031f('0x76')],'type':_0x11d498[_0x031f('0x77')][_0x031f('0x78')]};});_0x3c4b09=qs[_0x031f('0x7b')](_0x4deefb,_0x1cefb8);if(_0x1cefb8['user'][_0x031f('0x7c')]===_0x031f('0x7d')){var _0x23cc40={'params':{'id':_0x1cefb8['user']['userProfileId']},'query':{'section':_0x3e3ff5===_0x031f('0x19')&&_0x1cefb8['query']['type']===_0x031f('0x21')?_0x031f('0x92'):_[_0x031f('0x1a')](_0x3e3ff5)+_0x031f('0x93'),'type':_0x1cefb8[_0x031f('0x79')][_0x031f('0x77')],'nolimit':!![],'sort':_0x031f('0x10'),'filter':_0x1cefb8[_0x031f('0x79')][_0x031f('0x80')]}};return db[_0x031f('0x81')][_0x031f('0x82')](_0x23cc40);}return db[_0x5b336f]['findAndCountAll'](_0x3c4b09);})[_0x031f('0x12')](function(_0x2d867f){_0x398e7c[_0x031f('0xa')]=_0x2d867f[_0x031f('0xa')];_0x45330f=_0x2d867f['rows'];return getRealtimeQueues(_0x1cefb8,_0x3e3ff5);})[_0x031f('0x12')](function(_0x5329c2){_0x55284b=_0x5329c2['rows'];return getRealtimeAgents();})[_0x031f('0x12')](function(_0x2f4d09){_0x5a55e7=_0x2f4d09['rows'];if(_0x3e3ff5!='voice')return;return getRealtimeVoiceQueueChannels();})[_0x031f('0x12')](function(_0x62016){_0x282ab6=_0x62016?_0x62016[_0x031f('0x84')]:[];return initializeQueues(_0x45330f,_0x55284b,_0x3e3ff5,_0x1cefb8[_0x031f('0x79')][_0x031f('0x77')]);})[_0x031f('0x12')](function(_0x5e0853){var _0x263658=_0x5e0853[_0x031f('0x37')](function(_0x588f6c){if(_0x3e3ff5===_0x031f('0x19'))return getVoiceQueueAgents(_0x588f6c,_0x45330f,_0x5a55e7,_0x282ab6);else return getQueueAgents(_0x588f6c,_0x5a55e7,_0x3e3ff5);});return Promise[_0x031f('0x94')](_0x263658);})[_0x031f('0x12')](function(_0x14fc7e){_0x398e7c[_0x031f('0x84')]=_0x14fc7e;return _0x398e7c;})[_0x031f('0x12')](respondWithFilteredResult(_0x3424c9,_0x3c4b09))[_0x031f('0x18')](handleError(_0x3424c9,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 18db4f3..b77f944 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x104b24,_0x43bd25){var _0x23fb5b=function(_0x2dbfef){while(--_0x2dbfef){_0x104b24['push'](_0x104b24['shift']());}};_0x23fb5b(++_0x43bd25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x31f308,_0x3db808){var _0x24faed=function(_0x55f55a){while(--_0x55f55a){_0x31f308['push'](_0x31f308['shift']());}};_0x24faed(++_0x3db808);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 7add7f6..658eb0d 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 _0x94ba=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x18b171,_0x5f1b17){var _0x577286=function(_0x1381c1){while(--_0x1381c1){_0x18b171['push'](_0x18b171['shift']());}};_0x577286(++_0x5f1b17);}(_0x94ba,0xbe));var _0xa94b=function(_0x2e1906,_0xa281e9){_0x2e1906=_0x2e1906-0x0;var _0x3ea10e=_0x94ba[_0x2e1906];return _0x3ea10e;};'use strict';var Sequelize=require(_0xa94b('0x0'));module[_0xa94b('0x1')]={'state':{'type':Sequelize[_0xa94b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xa94b('0x3')]},'scheduledat':{'type':Sequelize[_0xa94b('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xa94b('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xa94b('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xa94b('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x038b=['exports','INTEGER','STRING','DATE'];(function(_0x2d1dcd,_0x20ae0f){var _0x2a5a40=function(_0x51bbe7){while(--_0x51bbe7){_0x2d1dcd['push'](_0x2d1dcd['shift']());}};_0x2a5a40(++_0x20ae0f);}(_0x038b,0x114));var _0xb038=function(_0x592c07,_0x2b177a){_0x592c07=_0x592c07-0x0;var _0x80501d=_0x038b[_0x592c07];return _0x80501d;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'state':{'type':Sequelize[_0xb038('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xb038('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xb038('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xb038('0x3')]},'ringtime':{'type':Sequelize[_0xb038('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xb038('0x2')]},'membername':{'type':Sequelize[_0xb038('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index feec950..3c2e605 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 _0x0e88=['path','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','util','../../config/logger','bluebird','request-promise'];(function(_0x120e45,_0x3b9d3f){var _0xf55063=function(_0x5ae6bc){while(--_0x5ae6bc){_0x120e45['push'](_0x120e45['shift']());}};_0xf55063(++_0x3b9d3f);}(_0x0e88,0x1a9));var _0x80e8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0e88[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x80e8('0x0'));var logger=require(_0x80e8('0x1'))('api');var moment=require('moment');var BPromise=require(_0x80e8('0x2'));var rp=require(_0x80e8('0x3'));var fs=require('fs');var path=require(_0x80e8('0x4'));var rimraf=require('rimraf');var config=require(_0x80e8('0x5'));var attributes=require(_0x80e8('0x6'));module[_0x80e8('0x7')]=function(_0xccf4a2,_0x13e04e){return _0xccf4a2[_0x80e8('0x8')](_0x80e8('0x9'),attributes,{'tableName':_0x80e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c01=['bluebird','request-promise','path','exports','define','report_agent_preview','util','api','moment'];(function(_0x2a000c,_0x5a5619){var _0x884c78=function(_0x183a9f){while(--_0x183a9f){_0x2a000c['push'](_0x2a000c['shift']());}};_0x884c78(++_0x5a5619);}(_0x0c01,0x1da));var _0x10c0=function(_0x9b7005,_0x31bdd4){_0x9b7005=_0x9b7005-0x0;var _0x1ea41a=_0x0c01[_0x9b7005];return _0x1ea41a;};'use strict';var _=require('lodash');var util=require(_0x10c0('0x0'));var logger=require('../../config/logger')(_0x10c0('0x1'));var moment=require(_0x10c0('0x2'));var BPromise=require(_0x10c0('0x3'));var rp=require(_0x10c0('0x4'));var fs=require('fs');var path=require(_0x10c0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0x10c0('0x6')]=function(_0x17ff1f,_0x4e7e6d){return _0x17ff1f[_0x10c0('0x7')]('ReportAgentPreview',attributes,{'tableName':_0x10c0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index c1f1d64..4c74f0e 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 _0xc2ac=['body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create'];(function(_0x46164e,_0x9ec166){var _0x36debb=function(_0x4e6e69){while(--_0x4e6e69){_0x46164e['push'](_0x46164e['shift']());}};_0x36debb(++_0x9ec166);}(_0xc2ac,0x19a));var _0xcc2a=function(_0x5dd1ac,_0x83e5bb){_0x5dd1ac=_0x5dd1ac-0x0;var _0x266768=_0xc2ac[_0x5dd1ac];return _0x266768;};'use strict';var _=require(_0xcc2a('0x0'));var util=require(_0xcc2a('0x1'));var moment=require(_0xcc2a('0x2'));var BPromise=require(_0xcc2a('0x3'));var rs=require(_0xcc2a('0x4'));var fs=require('fs');var Redis=require(_0xcc2a('0x5'));var db=require(_0xcc2a('0x6'))['db'];var utils=require(_0xcc2a('0x7'));var logger=require(_0xcc2a('0x8'))('rpc');var config=require(_0xcc2a('0x9'));var jayson=require(_0xcc2a('0xa'));var client=jayson['client'][_0xcc2a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dfc61,_0x2d0390,_0x50f7bd){return new BPromise(function(_0x1a3dff,_0x2a75ec){return client['request'](_0x4dfc61,_0x50f7bd)[_0xcc2a('0xc')](function(_0x30f066){logger[_0xcc2a('0xd')](_0xcc2a('0xe'),_0x2d0390,_0xcc2a('0xf'));logger[_0xcc2a('0x10')](_0xcc2a('0x11'),_0x2d0390,_0xcc2a('0xf'),JSON['stringify'](_0x30f066));if(_0x30f066['error']){if(_0x30f066[_0xcc2a('0x12')][_0xcc2a('0x13')]===0x1f4){logger[_0xcc2a('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x2d0390,_0x30f066[_0xcc2a('0x12')][_0xcc2a('0x14')]);return _0x2a75ec(_0x30f066[_0xcc2a('0x12')]['message']);}logger['error'](_0xcc2a('0xe'),_0x2d0390,_0x30f066[_0xcc2a('0x12')][_0xcc2a('0x14')]);return _0x1a3dff(_0x30f066[_0xcc2a('0x12')][_0xcc2a('0x14')]);}else{logger[_0xcc2a('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x2d0390,_0xcc2a('0xf'));_0x1a3dff(_0x30f066['result'][_0xcc2a('0x14')]);}})[_0xcc2a('0x15')](function(_0x804c8b){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x2d0390,_0x804c8b);_0x2a75ec(_0x804c8b);});});}exports[_0xcc2a('0x16')]=function(_0x56d381){var _0x19554a=this;return new Promise(function(_0x160f27,_0x5b4bb3){return db[_0xcc2a('0x17')][_0xcc2a('0x18')](_0x56d381[_0xcc2a('0x19')],{'raw':_0x56d381[_0xcc2a('0x1a')]?_0x56d381['options'][_0xcc2a('0x1b')]===undefined?!![]:![]:!![]})[_0xcc2a('0xc')](function(_0x2c53a1){logger['info'](_0xcc2a('0x16'),_0x56d381);logger['debug'](_0xcc2a('0x16'),_0x56d381,JSON[_0xcc2a('0x1c')](_0x2c53a1));_0x160f27(_0x2c53a1);})[_0xcc2a('0x15')](function(_0x3884d5){logger[_0xcc2a('0x12')](_0xcc2a('0x16'),_0x3884d5[_0xcc2a('0x14')],_0x56d381);_0x5b4bb3(_0x19554a['error'](0x1f4,_0x3884d5[_0xcc2a('0x14')]));});});}; \ No newline at end of file +var _0x355a=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','util'];(function(_0x38b85d,_0x10cbaf){var _0x3bbdcf=function(_0x5cf8fe){while(--_0x5cf8fe){_0x38b85d['push'](_0x38b85d['shift']());}};_0x3bbdcf(++_0x10cbaf);}(_0x355a,0x104));var _0xa355=function(_0xaab0ee,_0x3f2d51){_0xaab0ee=_0xaab0ee-0x0;var _0x4d16c4=_0x355a[_0xaab0ee];return _0x4d16c4;};'use strict';var _=require('lodash');var util=require(_0xa355('0x0'));var moment=require(_0xa355('0x1'));var BPromise=require(_0xa355('0x2'));var rs=require(_0xa355('0x3'));var fs=require('fs');var Redis=require(_0xa355('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa355('0x5'));var logger=require('../../config/logger')(_0xa355('0x6'));var config=require(_0xa355('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa355('0x8')][_0xa355('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42ec86,_0x1d6206,_0x1cc7d9){return new BPromise(function(_0x42d7df,_0x28bb04){return client[_0xa355('0xa')](_0x42ec86,_0x1cc7d9)[_0xa355('0xb')](function(_0x161e67){logger[_0xa355('0xc')](_0xa355('0xd'),_0x1d6206,_0xa355('0xe'));logger[_0xa355('0xf')](_0xa355('0x10'),_0x1d6206,_0xa355('0xe'),JSON[_0xa355('0x11')](_0x161e67));if(_0x161e67[_0xa355('0x12')]){if(_0x161e67[_0xa355('0x12')][_0xa355('0x13')]===0x1f4){logger[_0xa355('0x12')](_0xa355('0xd'),_0x1d6206,_0x161e67[_0xa355('0x12')][_0xa355('0x14')]);return _0x28bb04(_0x161e67['error'][_0xa355('0x14')]);}logger[_0xa355('0x12')](_0xa355('0xd'),_0x1d6206,_0x161e67[_0xa355('0x12')][_0xa355('0x14')]);return _0x42d7df(_0x161e67[_0xa355('0x12')][_0xa355('0x14')]);}else{logger['info'](_0xa355('0xd'),_0x1d6206,_0xa355('0xe'));_0x42d7df(_0x161e67[_0xa355('0x15')]['message']);}})[_0xa355('0x16')](function(_0x1df834){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x1d6206,_0x1df834);_0x28bb04(_0x1df834);});});}exports[_0xa355('0x17')]=function(_0x3021a4){var _0x42355f=this;return new Promise(function(_0x51ddf2,_0x125384){return db[_0xa355('0x18')][_0xa355('0x19')](_0x3021a4[_0xa355('0x1a')],{'raw':_0x3021a4[_0xa355('0x1b')]?_0x3021a4[_0xa355('0x1b')][_0xa355('0x1c')]===undefined?!![]:![]:!![]})[_0xa355('0xb')](function(_0x1a8062){logger[_0xa355('0xc')](_0xa355('0x17'),_0x3021a4);logger[_0xa355('0xf')]('CreateReportAgentPreview',_0x3021a4,JSON[_0xa355('0x11')](_0x1a8062));_0x51ddf2(_0x1a8062);})[_0xa355('0x16')](function(_0xb030cc){logger[_0xa355('0x12')]('CreateReportAgentPreview',_0xb030cc[_0xa355('0x14')],_0x3021a4);_0x125384(_0x42355f[_0xa355('0x12')](0x1f4,_0xb030cc[_0xa355('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 3c2b18e..637b650 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 _0xdf0b=['smsQueues','/whatsapp/queues','whatsappQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','../../components/auth/service','./rpc.controller','get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues'];(function(_0x2df172,_0x539cf9){var _0x204ab9=function(_0x4495b3){while(--_0x4495b3){_0x2df172['push'](_0x2df172['shift']());}};_0x204ab9(++_0x539cf9);}(_0xdf0b,0xd6));var _0xbdf0=function(_0x29d1b6,_0x1531fe){_0x29d1b6=_0x29d1b6-0x0;var _0x6f43ba=_0xdf0b[_0x29d1b6];return _0x6f43ba;};'use strict';var multer=require(_0xbdf0('0x0'));var util=require(_0xbdf0('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0xbdf0('0x2'));var controller=require(_0xbdf0('0x3'));router[_0xbdf0('0x4')]('/voice/channels',auth[_0xbdf0('0x5')](),controller['voiceChannels']);router[_0xbdf0('0x4')](_0xbdf0('0x6'),auth['isAuthenticated'](),controller[_0xbdf0('0x7')]);router['get'](_0xbdf0('0x8'),auth['isAuthenticated'](),controller[_0xbdf0('0x9')]);router['get'](_0xbdf0('0xa'),auth['isAuthenticated'](),controller[_0xbdf0('0xb')]);router['get'](_0xbdf0('0xc'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0xd')]);router[_0xbdf0('0x4')](_0xbdf0('0xe'),auth['isAuthenticated'](),controller[_0xbdf0('0xf')]);router[_0xbdf0('0x4')](_0xbdf0('0x10'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x11')]);router['get'](_0xbdf0('0x12'),auth[_0xbdf0('0x5')](),controller['openchannelQueues']);router[_0xbdf0('0x4')](_0xbdf0('0x13'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x14')]);router[_0xbdf0('0x4')](_0xbdf0('0x15'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x16')]);router[_0xbdf0('0x4')]('/fax/queues',auth['isAuthenticated'](),controller['faxQueues']);router[_0xbdf0('0x4')](_0xbdf0('0x17'),auth[_0xbdf0('0x5')](),controller['voiceQueuesPreview']);router[_0xbdf0('0x4')](_0xbdf0('0x18'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x19')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x1a')]);router[_0xbdf0('0x4')](_0xbdf0('0x1b'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x1c')]);router[_0xbdf0('0x4')](_0xbdf0('0x1d'),auth['isAuthenticated'](),controller[_0xbdf0('0x1e')]);router[_0xbdf0('0x4')](_0xbdf0('0x1f'),auth['isAuthenticated'](),controller[_0xbdf0('0x20')]);router[_0xbdf0('0x21')]('/voice/queues/:id',auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x22')]);router[_0xbdf0('0x4')](_0xbdf0('0x23'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x24')]);router[_0xbdf0('0x4')]('/outbound/channels',auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x25')]);router[_0xbdf0('0x4')](_0xbdf0('0x26'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x27')]);router[_0xbdf0('0x21')]('/agents/:id/capacity',auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x28')]);router[_0xbdf0('0x4')](_0xbdf0('0x29'),auth['isAuthenticated'](),controller[_0xbdf0('0x2a')]);router[_0xbdf0('0x4')]('/trunks',auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x2b')]);router[_0xbdf0('0x4')](_0xbdf0('0x2c'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x2d')]);router[_0xbdf0('0x4')](_0xbdf0('0x2e'),auth['isAuthenticated'](),controller[_0xbdf0('0x2f')]);router[_0xbdf0('0x4')](_0xbdf0('0x30'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x31')]);router[_0xbdf0('0x4')](_0xbdf0('0x32'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x33')]);router[_0xbdf0('0x4')](_0xbdf0('0x34'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x35')]);router[_0xbdf0('0x4')](_0xbdf0('0x36'),auth[_0xbdf0('0x5')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xbdf0('0x4')](_0xbdf0('0x37'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x38')]);router['get'](_0xbdf0('0x39'),auth[_0xbdf0('0x5')](),controller['whatsappQueuesWaitingInteractions']);router[_0xbdf0('0x4')](_0xbdf0('0x3a'),auth[_0xbdf0('0x5')](),controller['faxQueuesWaitingInteractions']);router[_0xbdf0('0x3b')](_0xbdf0('0x3c'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x3d')](_0xbdf0('0x3e')));router['get']('/mail/queues/:id',auth[_0xbdf0('0x5')](),controller['showMailQueues']);router[_0xbdf0('0x3b')](_0xbdf0('0x3f'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x3d')](_0xbdf0('0x40')));router['get'](_0xbdf0('0x41'),auth[_0xbdf0('0x5')](),controller['showChatQueues']);router['post'](_0xbdf0('0x42'),auth['isAuthenticated'](),controller[_0xbdf0('0x3d')](_0xbdf0('0x43')));router['get']('/fax/queues/:id',auth[_0xbdf0('0x5')](),controller['showFaxQueues']);router[_0xbdf0('0x3b')](_0xbdf0('0x44'),auth['isAuthenticated'](),controller['queueNotify'](_0xbdf0('0x45')));router[_0xbdf0('0x4')](_0xbdf0('0x46'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x47')]);router[_0xbdf0('0x3b')]('/sms/queues/:id/notify',auth[_0xbdf0('0x5')](),controller['queueNotify']('sms'));router[_0xbdf0('0x3b')](_0xbdf0('0x48'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x3d')]('whatsapp'));router[_0xbdf0('0x4')]('/sms/queues/:id',auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x49')]);router[_0xbdf0('0x4')](_0xbdf0('0x4a'),auth[_0xbdf0('0x5')](),controller[_0xbdf0('0x4b')]);router[_0xbdf0('0x3b')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0xbdf0('0x4c')]);module[_0xbdf0('0x4d')]=router; \ No newline at end of file +var _0x4110=['chatQueues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','showWhatsappQueues','agentNotify','exports','multer','util','path','express','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues'];(function(_0x3c6ff6,_0x133038){var _0x369479=function(_0x5e0900){while(--_0x5e0900){_0x3c6ff6['push'](_0x3c6ff6['shift']());}};_0x369479(++_0x133038);}(_0x4110,0x89));var _0x0411=function(_0x2c779e,_0x44f372){_0x2c779e=_0x2c779e-0x0;var _0x569b66=_0x4110[_0x2c779e];return _0x569b66;};'use strict';var multer=require(_0x0411('0x0'));var util=require(_0x0411('0x1'));var path=require(_0x0411('0x2'));var express=require(_0x0411('0x3'));var router=express['Router']();var auth=require(_0x0411('0x4'));var controller=require(_0x0411('0x5'));router[_0x0411('0x6')]('/voice/channels',auth[_0x0411('0x7')](),controller[_0x0411('0x8')]);router[_0x0411('0x6')](_0x0411('0x9'),auth[_0x0411('0x7')](),controller[_0x0411('0xa')]);router[_0x0411('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x0411('0x7')](),controller[_0x0411('0xb')]);router['get'](_0x0411('0xc'),auth[_0x0411('0x7')](),controller[_0x0411('0xd')]);router['get'](_0x0411('0xe'),auth[_0x0411('0x7')](),controller[_0x0411('0xf')]);router[_0x0411('0x6')]('/mail/queues',auth[_0x0411('0x7')](),controller[_0x0411('0x10')]);router[_0x0411('0x6')](_0x0411('0x11'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0x0411('0x6')](_0x0411('0x12'),auth[_0x0411('0x7')](),controller[_0x0411('0x13')]);router[_0x0411('0x6')](_0x0411('0x14'),auth[_0x0411('0x7')](),controller[_0x0411('0x15')]);router[_0x0411('0x6')]('/whatsapp/queues',auth[_0x0411('0x7')](),controller['whatsappQueues']);router[_0x0411('0x6')]('/fax/queues',auth['isAuthenticated'](),controller[_0x0411('0x16')]);router[_0x0411('0x6')](_0x0411('0x17'),auth[_0x0411('0x7')](),controller['voiceQueuesPreview']);router[_0x0411('0x6')](_0x0411('0x18'),auth[_0x0411('0x7')](),controller[_0x0411('0x19')]);router[_0x0411('0x6')](_0x0411('0x1a'),auth[_0x0411('0x7')](),controller[_0x0411('0x1b')]);router[_0x0411('0x6')](_0x0411('0x1c'),auth['isAuthenticated'](),controller[_0x0411('0x1d')]);router['get'](_0x0411('0x1e'),auth[_0x0411('0x7')](),controller[_0x0411('0x1f')]);router[_0x0411('0x6')]('/voice/queues/:id',auth[_0x0411('0x7')](),controller[_0x0411('0x20')]);router[_0x0411('0x21')]('/voice/queues/:id',auth['isAuthenticated'](),controller['updateVoiceQueue']);router['get']('/outbound',auth[_0x0411('0x7')](),controller[_0x0411('0x22')]);router[_0x0411('0x6')](_0x0411('0x23'),auth['isAuthenticated'](),controller[_0x0411('0x24')]);router['get'](_0x0411('0x25'),auth[_0x0411('0x7')](),controller[_0x0411('0x26')]);router['put'](_0x0411('0x27'),auth[_0x0411('0x7')](),controller[_0x0411('0x28')]);router[_0x0411('0x6')](_0x0411('0x29'),auth[_0x0411('0x7')](),controller[_0x0411('0x2a')]);router[_0x0411('0x6')]('/trunks',auth[_0x0411('0x7')](),controller[_0x0411('0x2b')]);router['get']('/campaigns',auth[_0x0411('0x7')](),controller[_0x0411('0x2c')]);router[_0x0411('0x6')](_0x0411('0x2d'),auth[_0x0411('0x7')](),controller[_0x0411('0x2e')]);router['get'](_0x0411('0x2f'),auth[_0x0411('0x7')](),controller[_0x0411('0x30')]);router['get'](_0x0411('0x31'),auth[_0x0411('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0x0411('0x6')](_0x0411('0x32'),auth[_0x0411('0x7')](),controller['openchannelQueuesWaitingInteractions']);router[_0x0411('0x6')](_0x0411('0x33'),auth[_0x0411('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x0411('0x6')]('/sms/queues/waitinginteractions',auth[_0x0411('0x7')](),controller[_0x0411('0x34')]);router[_0x0411('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0x0411('0x7')](),controller[_0x0411('0x35')]);router[_0x0411('0x6')](_0x0411('0x36'),auth[_0x0411('0x7')](),controller[_0x0411('0x37')]);router[_0x0411('0x38')](_0x0411('0x39'),auth[_0x0411('0x7')](),controller[_0x0411('0x3a')](_0x0411('0x3b')));router[_0x0411('0x6')](_0x0411('0x3c'),auth[_0x0411('0x7')](),controller[_0x0411('0x3d')]);router['post'](_0x0411('0x3e'),auth[_0x0411('0x7')](),controller['queueNotify']('chat'));router[_0x0411('0x6')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0x0411('0x3f')]);router[_0x0411('0x38')](_0x0411('0x40'),auth['isAuthenticated'](),controller[_0x0411('0x3a')](_0x0411('0x41')));router[_0x0411('0x6')]('/fax/queues/:id',auth[_0x0411('0x7')](),controller[_0x0411('0x42')]);router[_0x0411('0x38')](_0x0411('0x43'),auth[_0x0411('0x7')](),controller[_0x0411('0x3a')]('openchannel'));router[_0x0411('0x6')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller[_0x0411('0x44')]);router['post']('/sms/queues/:id/notify',auth[_0x0411('0x7')](),controller[_0x0411('0x3a')](_0x0411('0x45')));router[_0x0411('0x38')](_0x0411('0x46'),auth[_0x0411('0x7')](),controller['queueNotify'](_0x0411('0x47')));router['get']('/sms/queues/:id',auth[_0x0411('0x7')](),controller[_0x0411('0x48')]);router[_0x0411('0x6')]('/whatsapp/queues/:id',auth[_0x0411('0x7')](),controller[_0x0411('0x49')]);router[_0x0411('0x38')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x0411('0x4a')]);module[_0x0411('0x4b')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 0effe39..f8ba4bf 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 _0xeec6=['YYYY-MM-DD\x20HH:mm:ss','agent','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','update','queue','InteractionId','From','QueueId','TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','\x20Message\x20not\x20found','bluebird','moment','lodash','util','../../config/logger','api','jayson/promise','client','http','request','then','error','message','result','status','sendStatus','stack','name','send','isNil','find','rows','VoiceChannels','query','catch','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','interaction','hasOwnProperty','MemberReport','INTERACTION','length','format','SIP/%s','interface'];(function(_0x2ba29c,_0x5ed4d6){var _0x5a7c1e=function(_0x358de1){while(--_0x358de1){_0x2ba29c['push'](_0x2ba29c['shift']());}};_0x5a7c1e(++_0x5ed4d6);}(_0xeec6,0x1c2));var _0x6eec=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xeec6[_0x288f5e];return _0x476cc9;};'use strict';var BPromise=require(_0x6eec('0x0'));var moment=require(_0x6eec('0x1'));var _=require(_0x6eec('0x2'));var util=require(_0x6eec('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x6eec('0x4'))(_0x6eec('0x5'));var jayson=require(_0x6eec('0x6'));var amiClient=jayson[_0x6eec('0x7')][_0x6eec('0x8')]({'port':0x232a});var mailClient=jayson[_0x6eec('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0x6eec('0x7')][_0x6eec('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){var _0x56e849=_0x1c810e?_0x1c810e:amiClient;return _0x56e849[_0x6eec('0x9')](_0x48064a,_0x5a5e47)[_0x6eec('0xa')](function(_0x1c774d){if(_0x1c774d['error']){if(_0x1c774d['error']['code']===0x1f4){return _0x834c2(_0x1c774d[_0x6eec('0xb')][_0x6eec('0xc')]);}return _0x3443c2(_0x1c774d['error']['message']);}else{_0x3443c2(_0x1c774d[_0x6eec('0xd')]);}})['catch'](function(_0x3091d0){_0x834c2(_0x3091d0);});});}function respondWithResult(_0x3387c2,_0x162db1){_0x162db1=_0x162db1||0xc8;return function(_0x3fe94b){if(_0x3fe94b){return _0x3387c2[_0x6eec('0xe')](_0x162db1)['json'](_0x3fe94b);}return _0x3387c2[_0x6eec('0xf')](0x194);};}function handleError(_0x3b2972,_0x462dbb){_0x462dbb=_0x462dbb||0x1f4;return function(_0xc35914){logger[_0x6eec('0xb')](_0xc35914[_0x6eec('0x10')]);if(_0xc35914[_0x6eec('0x11')]){delete _0xc35914[_0x6eec('0x11')];}_0x3b2972[_0x6eec('0xe')](_0x462dbb)[_0x6eec('0x12')](_0xc35914);};}function findById(_0x5e2a9b){return function(_0x3c0c1b){if(!_['isNil'](_0x5e2a9b)&&!_[_0x6eec('0x13')](_0x3c0c1b)&&!_[_0x6eec('0x13')](_0x3c0c1b['rows'])){return _[_0x6eec('0x14')](_0x3c0c1b[_0x6eec('0x15')],function(_0xb1eab7){return _0xb1eab7['id']==_0x5e2a9b;});}return null;};}exports['voiceChannels']=function(_0x87f3be,_0x1ed94c){return respondWithRpcPromise(_0x6eec('0x16'),_0x87f3be[_0x6eec('0x17')])[_0x6eec('0xa')](respondWithResult(_0x1ed94c,null))[_0x6eec('0x18')](handleError(_0x1ed94c,null));};exports['voiceChannelMixMonitor']=function(_0x328693,_0x2f843e){return respondWithRpcPromise(_0x6eec('0x19'),_[_0x6eec('0x1a')](_0x328693[_0x6eec('0x17')],_0x328693[_0x6eec('0x1b')]))['then'](respondWithResult(_0x2f843e,null))[_0x6eec('0x18')](handleError(_0x2f843e,null));};exports[_0x6eec('0x1c')]=function(_0x285d41,_0x27785a){return respondWithRpcPromise(_0x6eec('0x1d'),_[_0x6eec('0x1a')](_0x285d41['query'],_0x285d41[_0x6eec('0x1b')]))[_0x6eec('0xa')](respondWithResult(_0x27785a,null))[_0x6eec('0x18')](handleError(_0x27785a,null));};exports[_0x6eec('0x1e')]=function(_0x1d2be9,_0x1f386c){return respondWithRpcPromise(_0x6eec('0x1f'),_0x1d2be9[_0x6eec('0x17')])[_0x6eec('0xa')](respondWithResult(_0x1f386c,null))['catch'](handleError(_0x1f386c,null));};exports[_0x6eec('0x20')]=function(_0x44b31c,_0x30eb98){return respondWithRpcPromise(_0x6eec('0x1f'),_0x44b31c['query'])[_0x6eec('0xa')](findById(_0x44b31c[_0x6eec('0x1b')]['id']))['then'](respondWithResult(_0x30eb98,null))['catch'](handleError(_0x30eb98,null));};exports[_0x6eec('0x21')]=function(_0x47ed95,_0x20a130){return respondWithRpcPromise(_0x6eec('0x22'),_[_0x6eec('0x1a')](_0x47ed95[_0x6eec('0x23')],_0x47ed95[_0x6eec('0x1b')]))[_0x6eec('0xa')](respondWithResult(_0x20a130,null))[_0x6eec('0x18')](handleError(_0x20a130,null));};exports[_0x6eec('0x24')]=function(_0x1abd19,_0x414f5b){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x6eec('0x1a')](_0x1abd19['query'],_0x1abd19[_0x6eec('0x1b')]))[_0x6eec('0xa')](respondWithResult(_0x414f5b,null))[_0x6eec('0x18')](handleError(_0x414f5b,null));};exports['voiceQueuesChannels']=function(_0x57b40b,_0x508735){return respondWithRpcPromise(_0x6eec('0x25'),_0x57b40b[_0x6eec('0x17')])[_0x6eec('0xa')](respondWithResult(_0x508735,null))[_0x6eec('0x18')](handleError(_0x508735,null));};exports[_0x6eec('0x26')]=function(_0x23547d,_0x22e0cb){return respondWithRpcPromise(_0x6eec('0x27'),_[_0x6eec('0x1a')](_0x23547d[_0x6eec('0x17')],_0x23547d[_0x6eec('0x1b')]))[_0x6eec('0xa')](respondWithResult(_0x22e0cb,null))['catch'](handleError(_0x22e0cb,null));};exports[_0x6eec('0x28')]=function(_0x361ab7,_0x2c83d1){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x6eec('0x1a')](_0x361ab7[_0x6eec('0x17')],_0x361ab7[_0x6eec('0x1b')]))[_0x6eec('0xa')](respondWithResult(_0x2c83d1,null))[_0x6eec('0x18')](handleError(_0x2c83d1,null));};exports[_0x6eec('0x29')]=function(_0x4a7699,_0x45cfb6){return respondWithRpcPromise(_0x6eec('0x2a'),_[_0x6eec('0x1a')](_0x4a7699['query'],_0x4a7699['params']))[_0x6eec('0xa')](respondWithResult(_0x45cfb6,null))[_0x6eec('0x18')](handleError(_0x45cfb6,null));};exports[_0x6eec('0x2b')]=function(_0x3f79d1,_0x402bac){return respondWithRpcPromise('Outbound',_0x3f79d1[_0x6eec('0x17')])[_0x6eec('0xa')](respondWithResult(_0x402bac,null))[_0x6eec('0x18')](handleError(_0x402bac,null));};exports[_0x6eec('0x2c')]=function(_0x15918c,_0x2be999){return respondWithRpcPromise(_0x6eec('0x2d'),_0x15918c[_0x6eec('0x17')])['then'](respondWithResult(_0x2be999,null))[_0x6eec('0x18')](handleError(_0x2be999,null));};exports[_0x6eec('0x2e')]=function(_0x4d30c9,_0x5b3283){var _0x160fc0;return respondWithRpcPromise(_0x6eec('0x2f'),_0x4d30c9[_0x6eec('0x17')])[_0x6eec('0xa')](function(_0x4cb50e){_0x160fc0=_0x4cb50e;return respondWithRpcPromise('Agents',_0x4d30c9[_0x6eec('0x17')],routingClient);})['then'](function(_0x5ac8b2){return _[_0x6eec('0x1a')]({},_0x5ac8b2,_0x160fc0);})[_0x6eec('0xa')](respondWithResult(_0x5b3283,null))[_0x6eec('0x18')](handleError(_0x5b3283,null));};exports[_0x6eec('0x30')]=function(_0x25d3f3,_0x58dfe7){if(_0x25d3f3[_0x6eec('0x23')]&&_0x25d3f3[_0x6eec('0x23')]['interaction']&&_0x25d3f3[_0x6eec('0x31')]&&_0x25d3f3[_0x6eec('0x31')]['name']){for(var _0x2d39bf in _0x25d3f3[_0x6eec('0x23')]['interaction']){if(_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x32')][_0x6eec('0x33')](_0x2d39bf)){db[_0x6eec('0x34')]['findAll']({'where':{'channel':_0x2d39bf,'membername':_0x25d3f3[_0x6eec('0x31')][_0x6eec('0x11')],'type':_0x6eec('0x35'),'exitAt':null,'uniqueid':_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x32')][_0x2d39bf]&&_0x25d3f3['body']['interaction'][_0x2d39bf][_0x6eec('0x36')]?{'$notIn':_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x32')][_0x2d39bf]}:{'$ne':null}}})[_0x6eec('0xa')](function(_0x44c7b8){var _0x59d7a7=moment()[_0x6eec('0x37')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x20524a=0x0,_0x408295=_0x44c7b8[_0x6eec('0x36')];_0x20524a<_0x408295;_0x20524a+=0x1){_0x44c7b8[_0x20524a]['updateAttributes']({'exitAt':_0x59d7a7});}});for(var _0x2b83f2=0x0;_0x2b83f2<_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x32')][_0x2d39bf][_0x6eec('0x36')];_0x2b83f2+=0x1){db[_0x6eec('0x34')]['findOrCreate']({'where':{'channel':_0x2d39bf,'membername':_0x25d3f3[_0x6eec('0x31')]['name'],'type':'INTERACTION','uniqueid':_0x25d3f3[_0x6eec('0x23')]['interaction'][_0x2d39bf][_0x2b83f2],'exitAt':null},'defaults':{'channel':_0x2d39bf,'membername':_0x25d3f3[_0x6eec('0x31')][_0x6eec('0x11')],'interface':_[_0x6eec('0x13')](_0x25d3f3['user']['interface'])?util[_0x6eec('0x37')](_0x6eec('0x38'),_0x25d3f3[_0x6eec('0x31')][_0x6eec('0x11')]):_0x25d3f3[_0x6eec('0x31')][_0x6eec('0x39')],'type':_0x6eec('0x35'),'enterAt':moment()[_0x6eec('0x37')](_0x6eec('0x3a')),'role':_0x6eec('0x3b'),'internal':_0x25d3f3['user']['internal'],'uniqueid':_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x32')][_0x2d39bf][_0x2b83f2]}});}}}}return respondWithRpcPromise(_0x6eec('0x3c'),{'id':_0x25d3f3['params']['id'],'capacity':_0x25d3f3[_0x6eec('0x23')][_0x6eec('0x3d')]},routingClient)[_0x6eec('0xa')](respondWithResult(_0x58dfe7,null))[_0x6eec('0x18')](handleError(_0x58dfe7,null));};exports[_0x6eec('0x3e')]=function(_0x43f77a,_0x10c10a){return respondWithRpcPromise(_0x6eec('0x3f'),_0x43f77a['query'])[_0x6eec('0xa')](respondWithResult(_0x10c10a,null))[_0x6eec('0x18')](handleError(_0x10c10a,null));};exports[_0x6eec('0x40')]=function(_0x3e77f3,_0x490d27){return respondWithRpcPromise('Trunks',_0x3e77f3['query'])[_0x6eec('0xa')](respondWithResult(_0x490d27,null))[_0x6eec('0x18')](handleError(_0x490d27,null));};exports[_0x6eec('0x41')]=function(_0x1de626,_0x5178f5){return respondWithRpcPromise('Campaigns',_0x1de626[_0x6eec('0x17')])[_0x6eec('0xa')](respondWithResult(_0x5178f5,null))[_0x6eec('0x18')](handleError(_0x5178f5,null));};exports['chatQueues']=function(_0x238605,_0x35f411){return respondWithRpcPromise(_0x6eec('0x42'),_0x238605[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x35f411,null))[_0x6eec('0x18')](handleError(_0x35f411,null));};exports[_0x6eec('0x43')]=function(_0x19fe55,_0x45fed3){return respondWithRpcPromise('ChatQueues',_0x19fe55[_0x6eec('0x17')],routingClient)['then'](findById(_0x19fe55[_0x6eec('0x1b')]['id']))[_0x6eec('0xa')](respondWithResult(_0x45fed3,null))[_0x6eec('0x18')](handleError(_0x45fed3,null));};exports[_0x6eec('0x44')]=function(_0x248d76,_0x360176){return respondWithRpcPromise(_0x6eec('0x45'),_0x248d76['query'],routingClient)[_0x6eec('0xa')](respondWithResult(_0x360176,null))['catch'](handleError(_0x360176,null));};exports[_0x6eec('0x46')]=function(_0x5c905f,_0x237324){return respondWithRpcPromise(_0x6eec('0x45'),_0x5c905f[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](findById(_0x5c905f[_0x6eec('0x1b')]['id']))[_0x6eec('0xa')](respondWithResult(_0x237324,null))[_0x6eec('0x18')](handleError(_0x237324,null));};exports[_0x6eec('0x47')]=function(_0x130002,_0x4114d1){return respondWithRpcPromise('MailAccounts',_0x130002['query'],mailClient)[_0x6eec('0xa')](respondWithResult(_0x4114d1,null))[_0x6eec('0x18')](handleError(_0x4114d1,null));};exports[_0x6eec('0x48')]=function(_0x2c0644,_0x20b040){return respondWithRpcPromise('OpenchannelQueues',_0x2c0644[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x20b040,null))['catch'](handleError(_0x20b040,null));};exports['showOpenchannelQueues']=function(_0x5dc8b3,_0xaa2a15){return respondWithRpcPromise(_0x6eec('0x49'),_0x5dc8b3['query'],routingClient)[_0x6eec('0xa')](findById(_0x5dc8b3[_0x6eec('0x1b')]['id']))['then'](respondWithResult(_0xaa2a15,null))[_0x6eec('0x18')](handleError(_0xaa2a15,null));};exports[_0x6eec('0x4a')]=function(_0xc852b3,_0x3c1f77){return respondWithRpcPromise('SmsQueues',_0xc852b3['query'],routingClient)[_0x6eec('0xa')](respondWithResult(_0x3c1f77,null))[_0x6eec('0x18')](handleError(_0x3c1f77,null));};exports[_0x6eec('0x4b')]=function(_0x19ca46,_0x34c4b4){return respondWithRpcPromise(_0x6eec('0x4c'),_0x19ca46[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](findById(_0x19ca46[_0x6eec('0x1b')]['id']))[_0x6eec('0xa')](respondWithResult(_0x34c4b4,null))[_0x6eec('0x18')](handleError(_0x34c4b4,null));};exports[_0x6eec('0x4d')]=function(_0x2799ca,_0x386a67){return respondWithRpcPromise(_0x6eec('0x4e'),_0x2799ca[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x386a67,null))['catch'](handleError(_0x386a67,null));};exports[_0x6eec('0x4f')]=function(_0x2236f7,_0x48bb52){return respondWithRpcPromise(_0x6eec('0x4e'),_0x2236f7[_0x6eec('0x17')],routingClient)['then'](findById(_0x2236f7[_0x6eec('0x1b')]['id']))[_0x6eec('0xa')](respondWithResult(_0x48bb52,null))[_0x6eec('0x18')](handleError(_0x48bb52,null));};exports[_0x6eec('0x50')]=function(_0x4c73f2,_0x40a81a){return respondWithRpcPromise(_0x6eec('0x51'),_0x4c73f2[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x40a81a,null))[_0x6eec('0x18')](handleError(_0x40a81a,null));};exports[_0x6eec('0x52')]=function(_0x5ae0a0,_0x1ed47e){return respondWithRpcPromise('FaxQueues',_0x5ae0a0[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](findById(_0x5ae0a0[_0x6eec('0x1b')]['id']))[_0x6eec('0xa')](respondWithResult(_0x1ed47e,null))[_0x6eec('0x18')](handleError(_0x1ed47e,null));};exports[_0x6eec('0x53')]=function(_0x404b64,_0x2ea7fe){return respondWithRpcPromise(_0x6eec('0x54'),_0x404b64['query'])[_0x6eec('0xa')](respondWithResult(_0x2ea7fe,null))[_0x6eec('0x18')](handleError(_0x2ea7fe,null));};exports[_0x6eec('0x55')]=function(_0x4eef6e,_0x19f8e2){return respondWithRpcPromise(_0x6eec('0x56'),_0x4eef6e['query'],routingClient)[_0x6eec('0xa')](respondWithResult(_0x19f8e2,null))[_0x6eec('0x18')](handleError(_0x19f8e2,null));};exports[_0x6eec('0x57')]=function(_0x18e62b,_0x266689){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x18e62b[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x266689,null))[_0x6eec('0x18')](handleError(_0x266689,null));};exports[_0x6eec('0x58')]=function(_0x3894dc,_0x56483b){return respondWithRpcPromise(_0x6eec('0x59'),_0x3894dc[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x56483b,null))[_0x6eec('0x18')](handleError(_0x56483b,null));};exports[_0x6eec('0x5a')]=function(_0x232b3a,_0x7dd5d1){return respondWithRpcPromise(_0x6eec('0x59'),_0x232b3a['query'],routingClient)[_0x6eec('0xa')](function(_0x59341a){if(_0x232b3a[_0x6eec('0x17')][_0x6eec('0x5b')]!==undefined){var _0x7a7288=_(_0x59341a[_0x6eec('0x15')])['filter']([_0x232b3a[_0x6eec('0x17')]['type'],_0x232b3a[_0x6eec('0x1b')]['id']])[_0x6eec('0x5c')](_0x6eec('0x5d'))[_0x6eec('0x5e')]()['value']();return _0x59341a['rows']['filter'](function(_0x1158b1){return _0x7a7288[_0x6eec('0x5f')](_0x1158b1[_0x6eec('0x5d')])>-0x1;});}else{return _0x59341a[_0x6eec('0x15')]['filter'](function(_0x44302a){return _0x44302a['queue_id']===parseInt(_0x232b3a[_0x6eec('0x1b')]['id']);});}})[_0x6eec('0xa')](respondWithResult(_0x7dd5d1,null))['catch'](handleError(_0x7dd5d1,null));};exports[_0x6eec('0x60')]=function(_0x2f9e8a,_0x333280){return respondWithRpcPromise(_0x6eec('0x61'),_0x2f9e8a[_0x6eec('0x17')],routingClient)[_0x6eec('0xa')](respondWithResult(_0x333280,null))['catch'](handleError(_0x333280,null));};exports[_0x6eec('0x62')]=function(_0x5aa2f3,_0x64c2ef){return respondWithRpcPromise(_0x6eec('0x63'),_0x5aa2f3['query'],routingClient)[_0x6eec('0xa')](respondWithResult(_0x64c2ef,null))['catch'](handleError(_0x64c2ef,null));};exports[_0x6eec('0x64')]=function(_0x1d1683,_0x8a4166){return respondWithRpcPromise(_0x6eec('0x65'),_0x1d1683['query'],routingClient)[_0x6eec('0xa')](respondWithResult(_0x8a4166,null))['catch'](handleError(_0x8a4166,null));};exports[_0x6eec('0x66')]=function(_0x2c0a85){return function(_0x51560c,_0x3dcf9d){var _0x435562,_0x3a90cd;var _0x328f28=_[_0x6eec('0x67')](_0x2c0a85);var _0x514e15=_0x2c0a85===_0x6eec('0x68')?_0x6eec('0x69'):_0x6eec('0x6a');return db[_0x328f28+_0x6eec('0x6b')][_0x6eec('0x6c')]({'raw':!![],'where':{'id':_0x51560c[_0x6eec('0x1b')]['id']}})['then'](function(_0x4a3af3){if(_[_0x6eec('0x13')](_0x4a3af3)){throw new Error(_0x328f28+_0x6eec('0x6d'));}_0x435562=_0x4a3af3;return db[_0x328f28+'Message']['findOne']({'where':{'id':_0x51560c[_0x6eec('0x23')][_0x6eec('0x6e')]},'include':[{'model':db[_0x328f28+'Interaction'],'as':_0x6eec('0x6f')},{'model':db[_0x328f28+_0x514e15],'as':_0x6eec('0x6a')}]});})[_0x6eec('0xa')](function(_0x5042a0){if(_[_0x6eec('0x13')](_0x5042a0)){throw new Error(_0x328f28+'\x20Message\x20not\x20found');}_0x3a90cd=_0x5042a0;return _0x5042a0[_0x6eec('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6eec('0xa')](function(){var _0x585432={'uniqueid':_0x2c0a85+'.'+_0x3a90cd['id']+'.'+_0x3a90cd[_0x6eec('0x6f')]['id'],'FromUserId':_0x51560c[_0x6eec('0x31')]['id'],'type':_0x6eec('0x71')};_0x585432[_0x328f28+'MessageId']=_0x3a90cd['id'];_0x585432[_0x328f28+_0x6eec('0x72')]=_0x3a90cd[_0x6eec('0x6f')]['id'];_0x585432[_0x6eec('0x73')+_0x328f28+_0x514e15+'Id']=_0x3a90cd[_0x6eec('0x6a')]['id'];_0x585432['To'+_0x328f28+_0x6eec('0x74')]=_0x435562['id'];return db[_0x328f28+_0x6eec('0x75')]['create'](_0x585432);})[_0x6eec('0xa')](function(){return respondWithRpcPromise(_0x6eec('0x76'),{'channel':_0x2c0a85,'interaction':_0x3a90cd[_0x6eec('0x6f')],'message':_0x3a90cd,'account':_0x3a90cd[_0x6eec('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6eec('0x71'),'appdata':_0x435562[_0x6eec('0x11')]+','+(_0x3a90cd[_0x6eec('0x6a')][_0x6eec('0x77')]||0x12c),'interval':_0x6eec('0x78')}]},routingClient);})[_0x6eec('0xa')](respondWithResult(_0x3dcf9d,null))[_0x6eec('0x18')](handleError(_0x3dcf9d,null));};};exports[_0x6eec('0x79')]=function(_0x56043a,_0x1419e0){var _0x1d6604,_0x10fad1;if(_[_0x6eec('0x13')](_0x56043a[_0x6eec('0x23')][_0x6eec('0x7a')])){throw new Error(_0x6eec('0x7b'));}var _0xa94ada=_0x56043a[_0x6eec('0x23')][_0x6eec('0x7a')];var _0xaddba4=_[_0x6eec('0x67')](_0xa94ada);var _0x89aace=_0xa94ada===_0x6eec('0x68')?_0x6eec('0x69'):'Account';return db[_0x6eec('0x7c')]['findOne']({'raw':!![],'where':{'id':_0x56043a[_0x6eec('0x1b')]['id'],'role':_0x6eec('0x3b')}})[_0x6eec('0xa')](function(_0x2607ca){if(_['isNil'](_0x2607ca)){throw new Error(_0x6eec('0x7d'));}_0x1d6604=_0x2607ca;return db[_0xaddba4+'Message'][_0x6eec('0x6c')]({'where':{'id':_0x56043a[_0x6eec('0x23')][_0x6eec('0x6e')]},'include':[{'model':db[_0xaddba4+_0x6eec('0x6f')],'as':_0x6eec('0x6f')},{'model':db[_0xaddba4+_0x89aace],'as':_0x6eec('0x6a')}]});})['then'](function(_0x2888f4){if(_[_0x6eec('0x13')](_0x2888f4)){throw new Error(_0xaddba4+_0x6eec('0x7e'));}_0x10fad1=_0x2888f4;return _0x2888f4[_0x6eec('0x70')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5229db={'uniqueid':_0xa94ada+'.'+_0x10fad1['id']+'.'+_0x10fad1[_0x6eec('0x6f')]['id'],'FromUserId':_0x56043a[_0x6eec('0x31')]['id'],'type':'queue','ToUserId':_0x1d6604['id']};_0x5229db[_0xaddba4+'MessageId']=_0x10fad1['id'];_0x5229db[_0xaddba4+_0x6eec('0x72')]=_0x10fad1[_0x6eec('0x6f')]['id'];_0x5229db['From'+_0xaddba4+_0x89aace+'Id']=_0x10fad1[_0x6eec('0x6a')]['id'];return db[_0xaddba4+_0x6eec('0x75')]['create'](_0x5229db);})[_0x6eec('0xa')](function(){return respondWithRpcPromise(_0x6eec('0x76'),{'channel':_0xa94ada,'interaction':_0x10fad1[_0x6eec('0x6f')],'message':_0x10fad1,'account':_0x10fad1['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x1d6604['name']+','+(_0x10fad1[_0x6eec('0x6a')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x6eec('0xa')](respondWithResult(_0x1419e0,null))['catch'](handleError(_0x1419e0,null));}; \ No newline at end of file +var _0xee14=['telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','channel','Website','User','agent','Agent\x20not\x20found','\x20Message\x20not\x20found','*,*,*,*','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','user','interaction','hasOwnProperty','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','INTERACTION','SIP/%s','AgentCapacity'];(function(_0x4f57fd,_0x2241c8){var _0x1bfca7=function(_0x8ca76b){while(--_0x8ca76b){_0x4f57fd['push'](_0x4f57fd['shift']());}};_0x1bfca7(++_0x2241c8);}(_0xee14,0x13a));var _0x4ee1=function(_0x14031c,_0x22c57e){_0x14031c=_0x14031c-0x0;var _0x140fa3=_0xee14[_0x14031c];return _0x140fa3;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x4ee1('0x0'));var util=require(_0x4ee1('0x1'));var db=require(_0x4ee1('0x2'))['db'];var logger=require(_0x4ee1('0x3'))(_0x4ee1('0x4'));var jayson=require(_0x4ee1('0x5'));var amiClient=jayson[_0x4ee1('0x6')][_0x4ee1('0x7')]({'port':0x232a});var mailClient=jayson[_0x4ee1('0x6')]['http']({'port':0x232b});var routingClient=jayson[_0x4ee1('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x327c18,_0x3a45a3,_0x187656){return new BPromise(function(_0x293d5f,_0xdfe9c1){var _0x1fd8c8=_0x187656?_0x187656:amiClient;return _0x1fd8c8['request'](_0x327c18,_0x3a45a3)[_0x4ee1('0x8')](function(_0x38be25){if(_0x38be25['error']){if(_0x38be25[_0x4ee1('0x9')][_0x4ee1('0xa')]===0x1f4){return _0xdfe9c1(_0x38be25[_0x4ee1('0x9')][_0x4ee1('0xb')]);}return _0x293d5f(_0x38be25['error'][_0x4ee1('0xb')]);}else{_0x293d5f(_0x38be25[_0x4ee1('0xc')]);}})[_0x4ee1('0xd')](function(_0x2d5d3c){_0xdfe9c1(_0x2d5d3c);});});}function respondWithResult(_0x2f864e,_0x174427){_0x174427=_0x174427||0xc8;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0xe')](_0x174427)[_0x4ee1('0xf')](_0x5616d6);}return _0x2f864e[_0x4ee1('0x10')](0x194);};}function handleError(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0x1f4;return function(_0x1c342a){logger[_0x4ee1('0x9')](_0x1c342a[_0x4ee1('0x11')]);if(_0x1c342a[_0x4ee1('0x12')]){delete _0x1c342a['name'];}_0x24a915[_0x4ee1('0xe')](_0x46d2c2)[_0x4ee1('0x13')](_0x1c342a);};}function findById(_0x34651b){return function(_0x1b1e0e){if(!_[_0x4ee1('0x14')](_0x34651b)&&!_[_0x4ee1('0x14')](_0x1b1e0e)&&!_[_0x4ee1('0x14')](_0x1b1e0e[_0x4ee1('0x15')])){return _[_0x4ee1('0x16')](_0x1b1e0e[_0x4ee1('0x15')],function(_0x274de5){return _0x274de5['id']==_0x34651b;});}return null;};}exports['voiceChannels']=function(_0x236215,_0x3db827){return respondWithRpcPromise(_0x4ee1('0x17'),_0x236215[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x3db827,null))[_0x4ee1('0xd')](handleError(_0x3db827,null));};exports['voiceChannelMixMonitor']=function(_0x8a631f,_0x333e96){return respondWithRpcPromise(_0x4ee1('0x19'),_[_0x4ee1('0x1a')](_0x8a631f[_0x4ee1('0x18')],_0x8a631f[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x333e96,null))[_0x4ee1('0xd')](handleError(_0x333e96,null));};exports[_0x4ee1('0x1c')]=function(_0x3e5038,_0x4faaf6){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x4ee1('0x1a')](_0x3e5038[_0x4ee1('0x18')],_0x3e5038[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x4faaf6,null))[_0x4ee1('0xd')](handleError(_0x4faaf6,null));};exports[_0x4ee1('0x1d')]=function(_0x57d45d,_0x5cc0b5){return respondWithRpcPromise(_0x4ee1('0x1e'),_0x57d45d[_0x4ee1('0x18')])['then'](respondWithResult(_0x5cc0b5,null))[_0x4ee1('0xd')](handleError(_0x5cc0b5,null));};exports[_0x4ee1('0x1f')]=function(_0x36654c,_0x215949){return respondWithRpcPromise(_0x4ee1('0x1e'),_0x36654c[_0x4ee1('0x18')])[_0x4ee1('0x8')](findById(_0x36654c['params']['id']))[_0x4ee1('0x8')](respondWithResult(_0x215949,null))['catch'](handleError(_0x215949,null));};exports[_0x4ee1('0x20')]=function(_0x4ec408,_0x3dc870){return respondWithRpcPromise(_0x4ee1('0x21'),_[_0x4ee1('0x1a')](_0x4ec408[_0x4ee1('0x22')],_0x4ec408[_0x4ee1('0x1b')]))['then'](respondWithResult(_0x3dc870,null))[_0x4ee1('0xd')](handleError(_0x3dc870,null));};exports['voiceQueuesPreview']=function(_0x121301,_0x3d5e6c){return respondWithRpcPromise(_0x4ee1('0x23'),_[_0x4ee1('0x1a')](_0x121301[_0x4ee1('0x18')],_0x121301['params']))[_0x4ee1('0x8')](respondWithResult(_0x3d5e6c,null))[_0x4ee1('0xd')](handleError(_0x3d5e6c,null));};exports[_0x4ee1('0x24')]=function(_0x2e37a3,_0x79f87c){return respondWithRpcPromise(_0x4ee1('0x25'),_0x2e37a3['query'])['then'](respondWithResult(_0x79f87c,null))[_0x4ee1('0xd')](handleError(_0x79f87c,null));};exports[_0x4ee1('0x26')]=function(_0x41ab60,_0x5a2f6f){return respondWithRpcPromise(_0x4ee1('0x27'),_[_0x4ee1('0x1a')](_0x41ab60[_0x4ee1('0x18')],_0x41ab60[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x5a2f6f,null))[_0x4ee1('0xd')](handleError(_0x5a2f6f,null));};exports[_0x4ee1('0x28')]=function(_0x199e11,_0x36898c){return respondWithRpcPromise(_0x4ee1('0x29'),_[_0x4ee1('0x1a')](_0x199e11[_0x4ee1('0x18')],_0x199e11[_0x4ee1('0x1b')]))['then'](respondWithResult(_0x36898c,null))[_0x4ee1('0xd')](handleError(_0x36898c,null));};exports[_0x4ee1('0x2a')]=function(_0x882468,_0x50539f){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x4ee1('0x1a')](_0x882468[_0x4ee1('0x18')],_0x882468[_0x4ee1('0x1b')]))[_0x4ee1('0x8')](respondWithResult(_0x50539f,null))['catch'](handleError(_0x50539f,null));};exports[_0x4ee1('0x2b')]=function(_0x2ed16f,_0x11721a){return respondWithRpcPromise(_0x4ee1('0x2c'),_0x2ed16f[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x11721a,null))[_0x4ee1('0xd')](handleError(_0x11721a,null));};exports[_0x4ee1('0x2d')]=function(_0x59b5cc,_0x3b346e){return respondWithRpcPromise(_0x4ee1('0x2e'),_0x59b5cc[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x3b346e,null))[_0x4ee1('0xd')](handleError(_0x3b346e,null));};exports[_0x4ee1('0x2f')]=function(_0x543b2e,_0x3e2ca7){var _0x37176a;return respondWithRpcPromise(_0x4ee1('0x30'),_0x543b2e[_0x4ee1('0x18')])[_0x4ee1('0x8')](function(_0x352dc5){_0x37176a=_0x352dc5;return respondWithRpcPromise(_0x4ee1('0x30'),_0x543b2e[_0x4ee1('0x18')],routingClient);})[_0x4ee1('0x8')](function(_0x29493d){return _[_0x4ee1('0x1a')]({},_0x29493d,_0x37176a);})[_0x4ee1('0x8')](respondWithResult(_0x3e2ca7,null))[_0x4ee1('0xd')](handleError(_0x3e2ca7,null));};exports['agentCapacity']=function(_0x3b3bed,_0x40a3e3){if(_0x3b3bed['body']&&_0x3b3bed[_0x4ee1('0x22')]['interaction']&&_0x3b3bed[_0x4ee1('0x31')]&&_0x3b3bed['user'][_0x4ee1('0x12')]){for(var _0xc7580c in _0x3b3bed['body'][_0x4ee1('0x32')]){if(_0x3b3bed[_0x4ee1('0x22')][_0x4ee1('0x32')][_0x4ee1('0x33')](_0xc7580c)){db['MemberReport'][_0x4ee1('0x34')]({'where':{'channel':_0xc7580c,'membername':_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3b3bed['body'][_0x4ee1('0x32')][_0xc7580c]&&_0x3b3bed[_0x4ee1('0x22')][_0x4ee1('0x32')][_0xc7580c][_0x4ee1('0x35')]?{'$notIn':_0x3b3bed[_0x4ee1('0x22')]['interaction'][_0xc7580c]}:{'$ne':null}}})['then'](function(_0xaa71d5){var _0x266add=moment()[_0x4ee1('0x36')](_0x4ee1('0x37'));for(var _0x5c5862=0x0,_0x3d6bf4=_0xaa71d5[_0x4ee1('0x35')];_0x5c5862<_0x3d6bf4;_0x5c5862+=0x1){_0xaa71d5[_0x5c5862]['updateAttributes']({'exitAt':_0x266add});}});for(var _0x21ebb8=0x0;_0x21ebb8<_0x3b3bed[_0x4ee1('0x22')][_0x4ee1('0x32')][_0xc7580c][_0x4ee1('0x35')];_0x21ebb8+=0x1){db[_0x4ee1('0x38')][_0x4ee1('0x39')]({'where':{'channel':_0xc7580c,'membername':_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')],'type':_0x4ee1('0x3a'),'uniqueid':_0x3b3bed['body']['interaction'][_0xc7580c][_0x21ebb8],'exitAt':null},'defaults':{'channel':_0xc7580c,'membername':_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')],'interface':_[_0x4ee1('0x14')](_0x3b3bed[_0x4ee1('0x31')]['interface'])?util[_0x4ee1('0x36')](_0x4ee1('0x3b'),_0x3b3bed[_0x4ee1('0x31')][_0x4ee1('0x12')]):_0x3b3bed[_0x4ee1('0x31')]['interface'],'type':_0x4ee1('0x3a'),'enterAt':moment()[_0x4ee1('0x36')](_0x4ee1('0x37')),'role':'agent','internal':_0x3b3bed[_0x4ee1('0x31')]['internal'],'uniqueid':_0x3b3bed[_0x4ee1('0x22')]['interaction'][_0xc7580c][_0x21ebb8]}});}}}}return respondWithRpcPromise(_0x4ee1('0x3c'),{'id':_0x3b3bed['params']['id'],'capacity':_0x3b3bed[_0x4ee1('0x22')]['capacity']},routingClient)[_0x4ee1('0x8')](respondWithResult(_0x40a3e3,null))[_0x4ee1('0xd')](handleError(_0x40a3e3,null));};exports[_0x4ee1('0x3d')]=function(_0x5f4f78,_0x3368ed){return respondWithRpcPromise(_0x4ee1('0x3e'),_0x5f4f78[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x3368ed,null))[_0x4ee1('0xd')](handleError(_0x3368ed,null));};exports[_0x4ee1('0x3f')]=function(_0x3f1c32,_0x517729){return respondWithRpcPromise('Trunks',_0x3f1c32[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x517729,null))[_0x4ee1('0xd')](handleError(_0x517729,null));};exports[_0x4ee1('0x40')]=function(_0x44e65f,_0x31e82d){return respondWithRpcPromise(_0x4ee1('0x41'),_0x44e65f[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x31e82d,null))[_0x4ee1('0xd')](handleError(_0x31e82d,null));};exports[_0x4ee1('0x42')]=function(_0x2453ac,_0x3c2e42){return respondWithRpcPromise('ChatQueues',_0x2453ac[_0x4ee1('0x18')],routingClient)['then'](respondWithResult(_0x3c2e42,null))[_0x4ee1('0xd')](handleError(_0x3c2e42,null));};exports[_0x4ee1('0x43')]=function(_0x59bbca,_0x1e0aac){return respondWithRpcPromise(_0x4ee1('0x44'),_0x59bbca['query'],routingClient)['then'](findById(_0x59bbca[_0x4ee1('0x1b')]['id']))['then'](respondWithResult(_0x1e0aac,null))[_0x4ee1('0xd')](handleError(_0x1e0aac,null));};exports[_0x4ee1('0x45')]=function(_0x59ba70,_0x43489c){return respondWithRpcPromise(_0x4ee1('0x46'),_0x59ba70[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x43489c,null))[_0x4ee1('0xd')](handleError(_0x43489c,null));};exports[_0x4ee1('0x47')]=function(_0x11f619,_0x5f5694){return respondWithRpcPromise('MailQueues',_0x11f619[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x11f619['params']['id']))[_0x4ee1('0x8')](respondWithResult(_0x5f5694,null))[_0x4ee1('0xd')](handleError(_0x5f5694,null));};exports[_0x4ee1('0x48')]=function(_0x51e341,_0x1ad933){return respondWithRpcPromise('MailAccounts',_0x51e341[_0x4ee1('0x18')],mailClient)['then'](respondWithResult(_0x1ad933,null))['catch'](handleError(_0x1ad933,null));};exports[_0x4ee1('0x49')]=function(_0x16fcd0,_0x290451){return respondWithRpcPromise(_0x4ee1('0x4a'),_0x16fcd0[_0x4ee1('0x18')],routingClient)['then'](respondWithResult(_0x290451,null))[_0x4ee1('0xd')](handleError(_0x290451,null));};exports[_0x4ee1('0x4b')]=function(_0x10f4e,_0x58eb1d){return respondWithRpcPromise(_0x4ee1('0x4a'),_0x10f4e[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x10f4e[_0x4ee1('0x1b')]['id']))[_0x4ee1('0x8')](respondWithResult(_0x58eb1d,null))[_0x4ee1('0xd')](handleError(_0x58eb1d,null));};exports[_0x4ee1('0x4c')]=function(_0x20ca0b,_0x19fa31){return respondWithRpcPromise(_0x4ee1('0x4d'),_0x20ca0b[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x19fa31,null))['catch'](handleError(_0x19fa31,null));};exports[_0x4ee1('0x4e')]=function(_0x5bf5e9,_0x25cfc3){return respondWithRpcPromise('SmsQueues',_0x5bf5e9[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x5bf5e9[_0x4ee1('0x1b')]['id']))[_0x4ee1('0x8')](respondWithResult(_0x25cfc3,null))[_0x4ee1('0xd')](handleError(_0x25cfc3,null));};exports[_0x4ee1('0x4f')]=function(_0x342aa1,_0x447060){return respondWithRpcPromise(_0x4ee1('0x50'),_0x342aa1[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x447060,null))[_0x4ee1('0xd')](handleError(_0x447060,null));};exports['showWhatsappQueues']=function(_0x759888,_0x24308c){return respondWithRpcPromise(_0x4ee1('0x50'),_0x759888['query'],routingClient)['then'](findById(_0x759888[_0x4ee1('0x1b')]['id']))[_0x4ee1('0x8')](respondWithResult(_0x24308c,null))['catch'](handleError(_0x24308c,null));};exports[_0x4ee1('0x51')]=function(_0x431dfa,_0x3f8f94){return respondWithRpcPromise(_0x4ee1('0x52'),_0x431dfa[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x3f8f94,null))[_0x4ee1('0xd')](handleError(_0x3f8f94,null));};exports[_0x4ee1('0x53')]=function(_0x28e11c,_0x3824bf){return respondWithRpcPromise('FaxQueues',_0x28e11c[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](findById(_0x28e11c['params']['id']))['then'](respondWithResult(_0x3824bf,null))[_0x4ee1('0xd')](handleError(_0x3824bf,null));};exports[_0x4ee1('0x54')]=function(_0x19e095,_0x38e06){return respondWithRpcPromise(_0x4ee1('0x55'),_0x19e095[_0x4ee1('0x18')])[_0x4ee1('0x8')](respondWithResult(_0x38e06,null))['catch'](handleError(_0x38e06,null));};exports[_0x4ee1('0x56')]=function(_0x39583b,_0x44af66){return respondWithRpcPromise(_0x4ee1('0x57'),_0x39583b[_0x4ee1('0x18')],routingClient)['then'](respondWithResult(_0x44af66,null))[_0x4ee1('0xd')](handleError(_0x44af66,null));};exports['mailQueuesWaitingInteractions']=function(_0x1d360f,_0x29371c){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x1d360f['query'],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x29371c,null))[_0x4ee1('0xd')](handleError(_0x29371c,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x2beb82,_0x5aacf1){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x2beb82[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x5aacf1,null))[_0x4ee1('0xd')](handleError(_0x5aacf1,null));};exports[_0x4ee1('0x58')]=function(_0x37fa42,_0x38698a){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x37fa42[_0x4ee1('0x18')],routingClient)['then'](function(_0x57f66c){if(_0x37fa42[_0x4ee1('0x18')][_0x4ee1('0x59')]!==undefined){var _0x411c99=_(_0x57f66c[_0x4ee1('0x15')])[_0x4ee1('0x5a')]([_0x37fa42[_0x4ee1('0x18')][_0x4ee1('0x59')],_0x37fa42[_0x4ee1('0x1b')]['id']])['map'](_0x4ee1('0x5b'))[_0x4ee1('0x5c')]()['value']();return _0x57f66c[_0x4ee1('0x15')][_0x4ee1('0x5a')](function(_0xcd0dd9){return _0x411c99[_0x4ee1('0x5d')](_0xcd0dd9[_0x4ee1('0x5b')])>-0x1;});}else{return _0x57f66c[_0x4ee1('0x15')][_0x4ee1('0x5a')](function(_0x4dee3a){return _0x4dee3a[_0x4ee1('0x5b')]===parseInt(_0x37fa42['params']['id']);});}})[_0x4ee1('0x8')](respondWithResult(_0x38698a,null))[_0x4ee1('0xd')](handleError(_0x38698a,null));};exports[_0x4ee1('0x5e')]=function(_0x35a719,_0x48c51c){return respondWithRpcPromise(_0x4ee1('0x5f'),_0x35a719[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x48c51c,null))['catch'](handleError(_0x48c51c,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2ef7c9,_0x4b4ad5){return respondWithRpcPromise(_0x4ee1('0x60'),_0x2ef7c9[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x4b4ad5,null))['catch'](handleError(_0x4b4ad5,null));};exports['faxQueuesWaitingInteractions']=function(_0x27fd3b,_0x1e2360){return respondWithRpcPromise(_0x4ee1('0x61'),_0x27fd3b[_0x4ee1('0x18')],routingClient)[_0x4ee1('0x8')](respondWithResult(_0x1e2360,null))[_0x4ee1('0xd')](handleError(_0x1e2360,null));};exports[_0x4ee1('0x62')]=function(_0x5727ef){return function(_0x4a3201,_0x50645b){var _0x3fba19,_0x3a75a7;var _0x33f5af=_[_0x4ee1('0x63')](_0x5727ef);var _0x4db801=_0x5727ef===_0x4ee1('0x64')?'Website':_0x4ee1('0x65');return db[_0x33f5af+_0x4ee1('0x66')][_0x4ee1('0x67')]({'raw':!![],'where':{'id':_0x4a3201[_0x4ee1('0x1b')]['id']}})[_0x4ee1('0x8')](function(_0x190f59){if(_['isNil'](_0x190f59)){throw new Error(_0x33f5af+_0x4ee1('0x68'));}_0x3fba19=_0x190f59;return db[_0x33f5af+_0x4ee1('0x69')][_0x4ee1('0x67')]({'where':{'id':_0x4a3201[_0x4ee1('0x22')][_0x4ee1('0x6a')]},'include':[{'model':db[_0x33f5af+_0x4ee1('0x6b')],'as':_0x4ee1('0x6b')},{'model':db[_0x33f5af+_0x4db801],'as':_0x4ee1('0x65')}]});})[_0x4ee1('0x8')](function(_0x207758){if(_[_0x4ee1('0x14')](_0x207758)){throw new Error(_0x33f5af+'\x20Message\x20not\x20found');}_0x3a75a7=_0x207758;return _0x207758[_0x4ee1('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4ee1('0x8')](function(){var _0x646878={'uniqueid':_0x5727ef+'.'+_0x3a75a7['id']+'.'+_0x3a75a7[_0x4ee1('0x6b')]['id'],'FromUserId':_0x4a3201[_0x4ee1('0x31')]['id'],'type':_0x4ee1('0x6d')};_0x646878[_0x33f5af+_0x4ee1('0x6e')]=_0x3a75a7['id'];_0x646878[_0x33f5af+_0x4ee1('0x6f')]=_0x3a75a7[_0x4ee1('0x6b')]['id'];_0x646878[_0x4ee1('0x70')+_0x33f5af+_0x4db801+'Id']=_0x3a75a7[_0x4ee1('0x65')]['id'];_0x646878['To'+_0x33f5af+_0x4ee1('0x71')]=_0x3fba19['id'];return db[_0x33f5af+_0x4ee1('0x72')][_0x4ee1('0x73')](_0x646878);})[_0x4ee1('0x8')](function(){return respondWithRpcPromise(_0x4ee1('0x74'),{'channel':_0x5727ef,'interaction':_0x3a75a7['Interaction'],'message':_0x3a75a7,'account':_0x3a75a7[_0x4ee1('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4ee1('0x6d'),'appdata':_0x3fba19['name']+','+(_0x3a75a7[_0x4ee1('0x65')][_0x4ee1('0x75')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x50645b,null))[_0x4ee1('0xd')](handleError(_0x50645b,null));};};exports['agentNotify']=function(_0x13a755,_0x1a00a4){var _0x47b854,_0x1700c6;if(_[_0x4ee1('0x14')](_0x13a755[_0x4ee1('0x22')][_0x4ee1('0x76')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x2bc05a=_0x13a755[_0x4ee1('0x22')][_0x4ee1('0x76')];var _0xc07f75=_[_0x4ee1('0x63')](_0x2bc05a);var _0x4315e9=_0x2bc05a===_0x4ee1('0x64')?_0x4ee1('0x77'):'Account';return db[_0x4ee1('0x78')][_0x4ee1('0x67')]({'raw':!![],'where':{'id':_0x13a755['params']['id'],'role':_0x4ee1('0x79')}})['then'](function(_0x5cf7fb){if(_[_0x4ee1('0x14')](_0x5cf7fb)){throw new Error(_0x4ee1('0x7a'));}_0x47b854=_0x5cf7fb;return db[_0xc07f75+_0x4ee1('0x69')][_0x4ee1('0x67')]({'where':{'id':_0x13a755[_0x4ee1('0x22')][_0x4ee1('0x6a')]},'include':[{'model':db[_0xc07f75+'Interaction'],'as':_0x4ee1('0x6b')},{'model':db[_0xc07f75+_0x4315e9],'as':_0x4ee1('0x65')}]});})[_0x4ee1('0x8')](function(_0x17ae2d){if(_[_0x4ee1('0x14')](_0x17ae2d)){throw new Error(_0xc07f75+_0x4ee1('0x7b'));}_0x1700c6=_0x17ae2d;return _0x17ae2d[_0x4ee1('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4ee1('0x8')](function(){var _0x5076c6={'uniqueid':_0x2bc05a+'.'+_0x1700c6['id']+'.'+_0x1700c6[_0x4ee1('0x6b')]['id'],'FromUserId':_0x13a755[_0x4ee1('0x31')]['id'],'type':_0x4ee1('0x6d'),'ToUserId':_0x47b854['id']};_0x5076c6[_0xc07f75+_0x4ee1('0x6e')]=_0x1700c6['id'];_0x5076c6[_0xc07f75+_0x4ee1('0x6f')]=_0x1700c6['Interaction']['id'];_0x5076c6[_0x4ee1('0x70')+_0xc07f75+_0x4315e9+'Id']=_0x1700c6['Account']['id'];return db[_0xc07f75+_0x4ee1('0x72')][_0x4ee1('0x73')](_0x5076c6);})[_0x4ee1('0x8')](function(){return respondWithRpcPromise(_0x4ee1('0x74'),{'channel':_0x2bc05a,'interaction':_0x1700c6['Interaction'],'message':_0x1700c6,'account':_0x1700c6[_0x4ee1('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4ee1('0x79'),'appdata':_0x47b854['name']+','+(_0x1700c6[_0x4ee1('0x65')]['agentTransferTimeout']||0x12c),'interval':_0x4ee1('0x7c')}]},routingClient);})[_0x4ee1('0x8')](respondWithResult(_0x1a00a4,null))['catch'](handleError(_0x1a00a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index a3ee4bb..33274e0 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 _0x9ac0=['isAuthenticated','index','/:id','/:id/run','run','create','put','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get'];(function(_0x2935cb,_0x55ebfa){var _0x54f856=function(_0x4627c3){while(--_0x4627c3){_0x2935cb['push'](_0x2935cb['shift']());}};_0x54f856(++_0x55ebfa);}(_0x9ac0,0x14e));var _0x09ac=function(_0x4789ea,_0x11cda6){_0x4789ea=_0x4789ea-0x0;var _0x25dc1f=_0x9ac0[_0x4789ea];return _0x25dc1f;};'use strict';var multer=require('multer');var util=require(_0x09ac('0x0'));var path=require('path');var timeout=require(_0x09ac('0x1'));var express=require('express');var router=express[_0x09ac('0x2')]();var fs_extra=require(_0x09ac('0x3'));var auth=require(_0x09ac('0x4'));var interaction=require(_0x09ac('0x5'));var config=require('../../config/environment');var controller=require(_0x09ac('0x6'));router[_0x09ac('0x7')]('/',auth[_0x09ac('0x8')](),controller[_0x09ac('0x9')]);router[_0x09ac('0x7')](_0x09ac('0xa'),auth[_0x09ac('0x8')](),controller['show']);router['get'](_0x09ac('0xb'),auth[_0x09ac('0x8')](),controller[_0x09ac('0xc')]);router['post']('/',auth[_0x09ac('0x8')](),controller[_0x09ac('0xd')]);router[_0x09ac('0xe')]('/:id',auth[_0x09ac('0x8')](),controller['update']);router[_0x09ac('0xf')](_0x09ac('0xa'),auth[_0x09ac('0x8')](),controller[_0x09ac('0x10')]);module[_0x09ac('0x11')]=router; \ No newline at end of file +var _0xda14=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','/:id','show','get','/:id/run','run','create','put','update'];(function(_0x282706,_0x2a09e9){var _0x182e26=function(_0x3ebedf){while(--_0x3ebedf){_0x282706['push'](_0x282706['shift']());}};_0x182e26(++_0x2a09e9);}(_0xda14,0xff));var _0x4da1=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0xda14[_0x184759];return _0xf26d5f;};'use strict';var multer=require(_0x4da1('0x0'));var util=require(_0x4da1('0x1'));var path=require(_0x4da1('0x2'));var timeout=require(_0x4da1('0x3'));var express=require(_0x4da1('0x4'));var router=express[_0x4da1('0x5')]();var fs_extra=require(_0x4da1('0x6'));var auth=require(_0x4da1('0x7'));var interaction=require(_0x4da1('0x8'));var config=require(_0x4da1('0x9'));var controller=require(_0x4da1('0xa'));router['get']('/',auth[_0x4da1('0xb')](),controller[_0x4da1('0xc')]);router['get'](_0x4da1('0xd'),auth[_0x4da1('0xb')](),controller[_0x4da1('0xe')]);router[_0x4da1('0xf')](_0x4da1('0x10'),auth['isAuthenticated'](),controller[_0x4da1('0x11')]);router['post']('/',auth[_0x4da1('0xb')](),controller[_0x4da1('0x12')]);router[_0x4da1('0x13')]('/:id',auth[_0x4da1('0xb')](),controller[_0x4da1('0x14')]);router['delete'](_0x4da1('0xd'),auth[_0x4da1('0xb')](),controller[_0x4da1('0x15')]);module[_0x4da1('0x16')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index a8c4e4f..9a316c4 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 _0x6bc8=['pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','ENUM','years','quarters','months','days','hours','csv'];(function(_0x53b55f,_0x7980d0){var _0x71d9fa=function(_0x1c30c2){while(--_0x1c30c2){_0x53b55f['push'](_0x53b55f['shift']());}};_0x71d9fa(++_0x7980d0);}(_0x6bc8,0x16a));var _0x86bc=function(_0x538db5,_0x98824b){_0x538db5=_0x538db5-0x0;var _0x51d6b1=_0x6bc8[_0x538db5];return _0x51d6b1;};'use strict';var Sequelize=require(_0x86bc('0x0'));module[_0x86bc('0x1')]={'name':{'type':Sequelize[_0x86bc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x86bc('0x2')]},'active':{'type':Sequelize[_0x86bc('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x86bc('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x86bc('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x86bc('0x5')](_0x86bc('0x6'),_0x86bc('0x7'),_0x86bc('0x8'),'weeks',_0x86bc('0x9'),_0x86bc('0xa'),'minutes'),'allowNull':![],'defaultValue':_0x86bc('0x9')},'output':{'type':Sequelize[_0x86bc('0x5')](_0x86bc('0xb'),_0x86bc('0xc'),_0x86bc('0xd')),'allowNull':![],'defaultValue':_0x86bc('0xb')},'type':{'type':Sequelize[_0x86bc('0x5')](_0x86bc('0xe'),_0x86bc('0xf')),'allowNull':![],'defaultValue':_0x86bc('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x86bc('0x10')]},'bcc':{'type':Sequelize[_0x86bc('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x86bc('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd30f=['default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours','days','csv','pdf','xlsx','custom'];(function(_0x3f5330,_0x362afa){var _0x17c626=function(_0x1274a8){while(--_0x1274a8){_0x3f5330['push'](_0x3f5330['shift']());}};_0x17c626(++_0x362afa);}(_0xd30f,0x1dd));var _0xfd30=function(_0x4b5bbc,_0x3c3b52){_0x4b5bbc=_0x4b5bbc-0x0;var _0x4d3691=_0xd30f[_0x4b5bbc];return _0x4d3691;};'use strict';var Sequelize=require('sequelize');module[_0xfd30('0x0')]={'name':{'type':Sequelize[_0xfd30('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xfd30('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xfd30('0x1')],'allowNull':![],'defaultValue':_0xfd30('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xfd30('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xfd30('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xfd30('0x6')](_0xfd30('0x7'),_0xfd30('0x8'),_0xfd30('0x9'),_0xfd30('0xa'),'days',_0xfd30('0xb'),'minutes'),'allowNull':![],'defaultValue':_0xfd30('0xc')},'output':{'type':Sequelize[_0xfd30('0x6')](_0xfd30('0xd'),_0xfd30('0xe'),_0xfd30('0xf')),'allowNull':![],'defaultValue':_0xfd30('0xd')},'type':{'type':Sequelize[_0xfd30('0x6')](_0xfd30('0x10'),_0xfd30('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xfd30('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xfd30('0x12')]},'bcc':{'type':Sequelize[_0xfd30('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xfd30('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 36fec49..df4d59a 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 _0x25c8=['role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','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','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','stack','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','options','Schedule','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x367dd7,_0x2d2faa){var _0xd195b3=function(_0x49af63){while(--_0x49af63){_0x367dd7['push'](_0x367dd7['shift']());}};_0xd195b3(++_0x2d2faa);}(_0x25c8,0xbd));var _0x825c=function(_0x1979e5,_0x8786b1){_0x1979e5=_0x1979e5-0x0;var _0x187c74=_0x25c8[_0x1979e5];return _0x187c74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x825c('0x0'));var zipdir=require(_0x825c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x825c('0x2'));var moment=require(_0x825c('0x3'));var BPromise=require(_0x825c('0x4'));var Mustache=require(_0x825c('0x5'));var util=require(_0x825c('0x6'));var path=require(_0x825c('0x7'));var sox=require(_0x825c('0x8'));var csv=require('to-csv');var ejs=require(_0x825c('0x9'));var fs=require('fs');var fs_extra=require(_0x825c('0xa'));var _=require('lodash');var squel=require(_0x825c('0xb'));var crypto=require(_0x825c('0xc'));var jsforce=require(_0x825c('0xd'));var deskjs=require(_0x825c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x825c('0xf'));var Papa=require(_0x825c('0x10'));var Redis=require(_0x825c('0x11'));var authService=require(_0x825c('0x12'));var qs=require(_0x825c('0x13'));var as=require(_0x825c('0x14'));var hardwareService=require(_0x825c('0x15'));var logger=require(_0x825c('0x16'))(_0x825c('0x17'));var utils=require(_0x825c('0x18'));var config=require(_0x825c('0x19'));var licenseUtil=require(_0x825c('0x1a'));var db=require(_0x825c('0x1b'))['db'];function respondWithStatusCode(_0x4f52ca,_0x52b1ae){_0x52b1ae=_0x52b1ae||0xcc;return function(_0xcda9b5){if(_0xcda9b5){return _0x4f52ca['sendStatus'](_0x52b1ae);}return _0x4f52ca[_0x825c('0x1c')](_0x52b1ae)[_0x825c('0x1d')]();};}function respondWithResult(_0x4f43d4,_0x37595d){_0x37595d=_0x37595d||0xc8;return function(_0x4060a5){if(_0x4060a5){return _0x4f43d4[_0x825c('0x1c')](_0x37595d)[_0x825c('0x1e')](_0x4060a5);}};}function respondWithFilteredResult(_0x22ec98,_0x81247a){return function(_0x12d31a){if(_0x12d31a){var _0x4d2f81=typeof _0x81247a['offset']==='undefined'&&typeof _0x81247a[_0x825c('0x1f')]==='undefined';var _0x1456a6=_0x12d31a[_0x825c('0x20')];var _0x2973e4=_0x4d2f81?0x0:_0x81247a['offset'];var _0x133d54=_0x4d2f81?_0x12d31a[_0x825c('0x20')]:_0x81247a[_0x825c('0x21')]+_0x81247a[_0x825c('0x1f')];var _0x1f1f53;if(_0x133d54>=_0x1456a6){_0x133d54=_0x1456a6;_0x1f1f53=0xc8;}else{_0x1f1f53=0xce;}_0x22ec98[_0x825c('0x1c')](_0x1f1f53);return _0x22ec98[_0x825c('0x22')](_0x825c('0x23'),_0x2973e4+'-'+_0x133d54+'/'+_0x1456a6)[_0x825c('0x1e')](_0x12d31a);}return null;};}function patchUpdates(_0x47a115){return function(_0x4983a2){try{jsonpatch[_0x825c('0x24')](_0x4983a2,_0x47a115,!![]);}catch(_0x579d27){return BPromise[_0x825c('0x25')](_0x579d27);}return _0x4983a2[_0x825c('0x26')]();};}function saveUpdates(_0x2ce21c,_0x199815){return function(_0x150445){if(_0x150445){return _0x150445[_0x825c('0x27')](_0x2ce21c)[_0x825c('0x28')](function(_0x4133ba){return _0x4133ba;});}return null;};}function removeEntity(_0x3076c5,_0x6bdb0b){return function(_0x542755){if(_0x542755){return _0x542755[_0x825c('0x29')]()[_0x825c('0x28')](function(){var _0x2c62ba=_0x542755[_0x825c('0x2a')]({'plain':!![]});var _0x476bdf=_0x825c('0x2b');return db[_0x825c('0x2c')]['destroy']({'where':{'type':_0x476bdf,'resourceId':_0x2c62ba['id']}})[_0x825c('0x28')](function(){return _0x542755;});})[_0x825c('0x28')](function(){_0x3076c5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b9aa7,_0x5af363){return function(_0x554537){if(!_0x554537){_0x5b9aa7[_0x825c('0x2d')](0x194);}return _0x554537;};}function handleError(_0x3c0373,_0x46570f){_0x46570f=_0x46570f||0x1f4;return function(_0x432104){logger[_0x825c('0x2e')](_0x432104[_0x825c('0x2f')]);if(_0x432104['name']){delete _0x432104['name'];}_0x3c0373[_0x825c('0x1c')](_0x46570f)[_0x825c('0x30')](_0x432104);};}exports[_0x825c('0x31')]=function(_0x467586,_0x2c35b4){var _0x30ab0a={},_0x49f206={},_0x4007f1={'count':0x0,'rows':[]};var _0x1786f3=_[_0x825c('0x32')](db['Schedule'][_0x825c('0x33')],function(_0xb9acf4){return{'name':_0xb9acf4['fieldName'],'type':_0xb9acf4[_0x825c('0x34')][_0x825c('0x35')]};});_0x49f206[_0x825c('0x36')]=_[_0x825c('0x32')](_0x1786f3,'name');_0x49f206[_0x825c('0x37')]=_[_0x825c('0x38')](_0x467586['query']);_0x49f206[_0x825c('0x39')]=_[_0x825c('0x3a')](_0x49f206[_0x825c('0x36')],_0x49f206[_0x825c('0x37')]);_0x30ab0a[_0x825c('0x3b')]=_[_0x825c('0x3a')](_0x49f206[_0x825c('0x36')],qs[_0x825c('0x3c')](_0x467586[_0x825c('0x37')][_0x825c('0x3c')]));_0x30ab0a[_0x825c('0x3b')]=_0x30ab0a[_0x825c('0x3b')][_0x825c('0x3d')]?_0x30ab0a[_0x825c('0x3b')]:_0x49f206[_0x825c('0x36')];if(!_0x467586[_0x825c('0x37')][_0x825c('0x3e')]('nolimit')){_0x30ab0a[_0x825c('0x1f')]=qs[_0x825c('0x1f')](_0x467586[_0x825c('0x37')][_0x825c('0x1f')]);_0x30ab0a[_0x825c('0x21')]=qs[_0x825c('0x21')](_0x467586[_0x825c('0x37')][_0x825c('0x21')]);}_0x30ab0a[_0x825c('0x3f')]=qs[_0x825c('0x40')](_0x467586['query'][_0x825c('0x40')]);_0x30ab0a[_0x825c('0x41')]=qs[_0x825c('0x39')](_[_0x825c('0x42')](_0x467586[_0x825c('0x37')],_0x49f206[_0x825c('0x39')]),_0x1786f3);if(_0x467586[_0x825c('0x37')][_0x825c('0x43')]){_0x30ab0a['where']=_[_0x825c('0x44')](_0x30ab0a[_0x825c('0x41')],{'$or':_[_0x825c('0x32')](_0x1786f3,function(_0x5b60fe){if(_0x5b60fe[_0x825c('0x34')]!==_0x825c('0x45')){var _0x3bef45={};_0x3bef45[_0x5b60fe[_0x825c('0x46')]]={'$like':'%'+_0x467586[_0x825c('0x37')][_0x825c('0x43')]+'%'};return _0x3bef45;}})});}_0x30ab0a=_[_0x825c('0x44')]({},_0x30ab0a,_0x467586[_0x825c('0x47')]);var _0xd8f6b2={'where':_0x30ab0a[_0x825c('0x41')]};return db[_0x825c('0x48')][_0x825c('0x20')](_0xd8f6b2)['then'](function(_0x76dd25){_0x4007f1[_0x825c('0x20')]=_0x76dd25;if(_0x467586['query'][_0x825c('0x49')]){_0x30ab0a[_0x825c('0x4a')]=[{'all':!![]}];}return db[_0x825c('0x48')][_0x825c('0x4b')](_0x30ab0a);})[_0x825c('0x28')](function(_0x38c54e){_0x4007f1[_0x825c('0x4c')]=_0x38c54e;return _0x4007f1;})[_0x825c('0x28')](respondWithFilteredResult(_0x2c35b4,_0x30ab0a))[_0x825c('0x4d')](handleError(_0x2c35b4,null));};exports[_0x825c('0x4e')]=function(_0x4ce695,_0x49283b){var _0x36869c={'raw':![],'where':{'id':_0x4ce695[_0x825c('0x4f')]['id']}},_0x5d70bc={};_0x5d70bc[_0x825c('0x36')]=_[_0x825c('0x38')](db[_0x825c('0x48')][_0x825c('0x33')]);_0x5d70bc[_0x825c('0x37')]=_['keys'](_0x4ce695[_0x825c('0x37')]);_0x5d70bc[_0x825c('0x39')]=_[_0x825c('0x3a')](_0x5d70bc[_0x825c('0x36')],_0x5d70bc[_0x825c('0x37')]);_0x36869c['attributes']=_[_0x825c('0x3a')](_0x5d70bc[_0x825c('0x36')],qs[_0x825c('0x3c')](_0x4ce695[_0x825c('0x37')][_0x825c('0x3c')]));_0x36869c['attributes']=_0x36869c[_0x825c('0x3b')][_0x825c('0x3d')]?_0x36869c[_0x825c('0x3b')]:_0x5d70bc['model'];if(_0x4ce695[_0x825c('0x37')]['includeAll']){_0x36869c[_0x825c('0x4a')]=[{'all':!![]}];}_0x36869c=_[_0x825c('0x44')]({},_0x36869c,_0x4ce695[_0x825c('0x47')]);return db['Schedule'][_0x825c('0x50')](_0x36869c)[_0x825c('0x28')](handleEntityNotFound(_0x49283b,null))[_0x825c('0x28')](respondWithResult(_0x49283b,null))['catch'](handleError(_0x49283b,null));};exports[_0x825c('0x51')]=function(_0x3c6046,_0x2b33ae){return db['Schedule']['create'](_0x3c6046['body'],{})[_0x825c('0x28')](function(_0x29a9b4){var _0x30cbde=_0x3c6046[_0x825c('0x52')][_0x825c('0x2a')]({'plain':!![]});if(!_0x30cbde)throw new Error(_0x825c('0x53'));if(_0x30cbde[_0x825c('0x54')]==='user'){var _0x46422b=_0x29a9b4['get']({'plain':!![]});var _0x445221=_0x825c('0x2b');return db[_0x825c('0x55')][_0x825c('0x50')]({'where':{'name':_0x445221,'userProfileId':_0x30cbde[_0x825c('0x56')]},'raw':!![]})[_0x825c('0x28')](function(_0x45eff2){if(_0x45eff2&&_0x45eff2[_0x825c('0x57')]===0x0){return db[_0x825c('0x2c')][_0x825c('0x51')]({'name':_0x46422b[_0x825c('0x46')],'resourceId':_0x46422b['id'],'type':_0x45eff2[_0x825c('0x46')],'sectionId':_0x45eff2['id']},{})[_0x825c('0x28')](function(){return _0x29a9b4;});}else{return _0x29a9b4;}})[_0x825c('0x4d')](function(_0xac8805){logger[_0x825c('0x2e')](_0x825c('0x58'),_0xac8805);throw _0xac8805;});}return _0x29a9b4;})[_0x825c('0x28')](respondWithResult(_0x2b33ae,0xc9))[_0x825c('0x4d')](handleError(_0x2b33ae,null));};exports[_0x825c('0x27')]=function(_0x7a13c5,_0x75f7d3){if(_0x7a13c5[_0x825c('0x59')]['id']){delete _0x7a13c5[_0x825c('0x59')]['id'];}return db[_0x825c('0x48')][_0x825c('0x50')]({'where':{'id':_0x7a13c5[_0x825c('0x4f')]['id']}})[_0x825c('0x28')](handleEntityNotFound(_0x75f7d3,null))[_0x825c('0x28')](saveUpdates(_0x7a13c5[_0x825c('0x59')],null))[_0x825c('0x28')](respondWithResult(_0x75f7d3,null))[_0x825c('0x4d')](handleError(_0x75f7d3,null));};exports['destroy']=function(_0x489c79,_0x787a19){return db[_0x825c('0x48')]['find']({'where':{'id':_0x489c79[_0x825c('0x4f')]['id']}})[_0x825c('0x28')](handleEntityNotFound(_0x787a19,null))[_0x825c('0x28')](removeEntity(_0x787a19,null))[_0x825c('0x4d')](handleError(_0x787a19,null));};exports[_0x825c('0x5a')]=function(_0x48a74f,_0x4c459d,_0x40f640){var _0x45aefa=require('../../config/schedule');return db[_0x825c('0x48')][_0x825c('0x50')]({'where':{'id':_0x48a74f[_0x825c('0x4f')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4c459d,null))[_0x825c('0x28')](function(){_0x45aefa['run'](_0x48a74f['params']['id']);})[_0x825c('0x28')](respondWithStatusCode(_0x4c459d,null))[_0x825c('0x4d')](handleError(_0x4c459d,null));}; \ No newline at end of file +var _0x74ca=['undefined','count','apply','reject','save','update','then','destroy','Scheduler','UserProfileResource','error','stack','name','send','index','Schedule','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','rawAttributes','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x59710f,_0x44c7f0){var _0xaae66a=function(_0x1c2397){while(--_0x1c2397){_0x59710f['push'](_0x59710f['shift']());}};_0xaae66a(++_0x44c7f0);}(_0x74ca,0x137));var _0xa74c=function(_0x363c19,_0x292992){_0x363c19=_0x363c19-0x0;var _0x1e6de3=_0x74ca[_0x363c19];return _0x1e6de3;};'use strict';var emlformat=require(_0xa74c('0x0'));var rimraf=require(_0xa74c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa74c('0x2'));var rp=require(_0xa74c('0x3'));var moment=require('moment');var BPromise=require(_0xa74c('0x4'));var Mustache=require(_0xa74c('0x5'));var util=require(_0xa74c('0x6'));var path=require(_0xa74c('0x7'));var sox=require(_0xa74c('0x8'));var csv=require(_0xa74c('0x9'));var ejs=require(_0xa74c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa74c('0xb'));var squel=require(_0xa74c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa74c('0xd'));var toCsv=require(_0xa74c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa74c('0xe'));var authService=require(_0xa74c('0xf'));var qs=require(_0xa74c('0x10'));var as=require(_0xa74c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa74c('0x12'))(_0xa74c('0x13'));var utils=require(_0xa74c('0x14'));var config=require(_0xa74c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa74c('0x16'))['db'];function respondWithStatusCode(_0x466481,_0x4f3b9b){_0x4f3b9b=_0x4f3b9b||0xcc;return function(_0xee2ca8){if(_0xee2ca8){return _0x466481[_0xa74c('0x17')](_0x4f3b9b);}return _0x466481[_0xa74c('0x18')](_0x4f3b9b)[_0xa74c('0x19')]();};}function respondWithResult(_0x333c83,_0x27a3a9){_0x27a3a9=_0x27a3a9||0xc8;return function(_0x17c04a){if(_0x17c04a){return _0x333c83[_0xa74c('0x18')](_0x27a3a9)[_0xa74c('0x1a')](_0x17c04a);}};}function respondWithFilteredResult(_0x337174,_0x4ff040){return function(_0x1b591b){if(_0x1b591b){var _0x65dcbe=typeof _0x4ff040[_0xa74c('0x1b')]==='undefined'&&typeof _0x4ff040[_0xa74c('0x1c')]===_0xa74c('0x1d');var _0x347dfd=_0x1b591b['count'];var _0x599d5e=_0x65dcbe?0x0:_0x4ff040[_0xa74c('0x1b')];var _0x286ef8=_0x65dcbe?_0x1b591b[_0xa74c('0x1e')]:_0x4ff040[_0xa74c('0x1b')]+_0x4ff040[_0xa74c('0x1c')];var _0x173375;if(_0x286ef8>=_0x347dfd){_0x286ef8=_0x347dfd;_0x173375=0xc8;}else{_0x173375=0xce;}_0x337174[_0xa74c('0x18')](_0x173375);return _0x337174['set']('Content-Range',_0x599d5e+'-'+_0x286ef8+'/'+_0x347dfd)[_0xa74c('0x1a')](_0x1b591b);}return null;};}function patchUpdates(_0x4ff9fd){return function(_0x47ce93){try{jsonpatch[_0xa74c('0x1f')](_0x47ce93,_0x4ff9fd,!![]);}catch(_0x47d6ea){return BPromise[_0xa74c('0x20')](_0x47d6ea);}return _0x47ce93[_0xa74c('0x21')]();};}function saveUpdates(_0x135a76,_0x24107f){return function(_0x2ebdbb){if(_0x2ebdbb){return _0x2ebdbb[_0xa74c('0x22')](_0x135a76)[_0xa74c('0x23')](function(_0x475c60){return _0x475c60;});}return null;};}function removeEntity(_0x4968e0,_0x1860f6){return function(_0x26c753){if(_0x26c753){return _0x26c753[_0xa74c('0x24')]()[_0xa74c('0x23')](function(){var _0x44e601=_0x26c753['get']({'plain':!![]});var _0x1f6dd0=_0xa74c('0x25');return db[_0xa74c('0x26')][_0xa74c('0x24')]({'where':{'type':_0x1f6dd0,'resourceId':_0x44e601['id']}})[_0xa74c('0x23')](function(){return _0x26c753;});})['then'](function(){_0x4968e0[_0xa74c('0x18')](0xcc)[_0xa74c('0x19')]();});}};}function handleEntityNotFound(_0x422ebb,_0x4cea53){return function(_0x5698e4){if(!_0x5698e4){_0x422ebb['sendStatus'](0x194);}return _0x5698e4;};}function handleError(_0x48ac0f,_0x4ed1a5){_0x4ed1a5=_0x4ed1a5||0x1f4;return function(_0xb4b5a0){logger[_0xa74c('0x27')](_0xb4b5a0[_0xa74c('0x28')]);if(_0xb4b5a0[_0xa74c('0x29')]){delete _0xb4b5a0[_0xa74c('0x29')];}_0x48ac0f[_0xa74c('0x18')](_0x4ed1a5)[_0xa74c('0x2a')](_0xb4b5a0);};}exports[_0xa74c('0x2b')]=function(_0x56bdf3,_0x573ec5){var _0x29d149={},_0x59b5b0={},_0x409bbf={'count':0x0,'rows':[]};var _0x4b1c8b=_['map'](db[_0xa74c('0x2c')]['rawAttributes'],function(_0x18cba6){return{'name':_0x18cba6['fieldName'],'type':_0x18cba6[_0xa74c('0x2d')][_0xa74c('0x2e')]};});_0x59b5b0[_0xa74c('0x2f')]=_[_0xa74c('0x30')](_0x4b1c8b,'name');_0x59b5b0[_0xa74c('0x31')]=_[_0xa74c('0x32')](_0x56bdf3[_0xa74c('0x31')]);_0x59b5b0[_0xa74c('0x33')]=_[_0xa74c('0x34')](_0x59b5b0[_0xa74c('0x2f')],_0x59b5b0['query']);_0x29d149['attributes']=_[_0xa74c('0x34')](_0x59b5b0[_0xa74c('0x2f')],qs[_0xa74c('0x35')](_0x56bdf3[_0xa74c('0x31')][_0xa74c('0x35')]));_0x29d149['attributes']=_0x29d149[_0xa74c('0x36')]['length']?_0x29d149[_0xa74c('0x36')]:_0x59b5b0[_0xa74c('0x2f')];if(!_0x56bdf3['query'][_0xa74c('0x37')](_0xa74c('0x38'))){_0x29d149[_0xa74c('0x1c')]=qs[_0xa74c('0x1c')](_0x56bdf3[_0xa74c('0x31')][_0xa74c('0x1c')]);_0x29d149['offset']=qs[_0xa74c('0x1b')](_0x56bdf3[_0xa74c('0x31')][_0xa74c('0x1b')]);}_0x29d149[_0xa74c('0x39')]=qs[_0xa74c('0x3a')](_0x56bdf3[_0xa74c('0x31')][_0xa74c('0x3a')]);_0x29d149[_0xa74c('0x3b')]=qs[_0xa74c('0x33')](_[_0xa74c('0x3c')](_0x56bdf3[_0xa74c('0x31')],_0x59b5b0['filters']),_0x4b1c8b);if(_0x56bdf3['query'][_0xa74c('0x3d')]){_0x29d149['where']=_[_0xa74c('0x3e')](_0x29d149['where'],{'$or':_[_0xa74c('0x30')](_0x4b1c8b,function(_0x14b377){if(_0x14b377[_0xa74c('0x2d')]!==_0xa74c('0x3f')){var _0x1221c7={};_0x1221c7[_0x14b377[_0xa74c('0x29')]]={'$like':'%'+_0x56bdf3[_0xa74c('0x31')][_0xa74c('0x3d')]+'%'};return _0x1221c7;}})});}_0x29d149=_[_0xa74c('0x3e')]({},_0x29d149,_0x56bdf3[_0xa74c('0x40')]);var _0x731f36={'where':_0x29d149[_0xa74c('0x3b')]};return db[_0xa74c('0x2c')][_0xa74c('0x1e')](_0x731f36)['then'](function(_0x16cf5d){_0x409bbf[_0xa74c('0x1e')]=_0x16cf5d;if(_0x56bdf3['query']['includeAll']){_0x29d149[_0xa74c('0x41')]=[{'all':!![]}];}return db[_0xa74c('0x2c')]['findAll'](_0x29d149);})[_0xa74c('0x23')](function(_0x436aab){_0x409bbf[_0xa74c('0x42')]=_0x436aab;return _0x409bbf;})[_0xa74c('0x23')](respondWithFilteredResult(_0x573ec5,_0x29d149))['catch'](handleError(_0x573ec5,null));};exports[_0xa74c('0x43')]=function(_0x4ae230,_0x30e5f9){var _0x58fe69={'raw':![],'where':{'id':_0x4ae230['params']['id']}},_0x25febf={};_0x25febf['model']=_[_0xa74c('0x32')](db[_0xa74c('0x2c')][_0xa74c('0x44')]);_0x25febf[_0xa74c('0x31')]=_[_0xa74c('0x32')](_0x4ae230['query']);_0x25febf[_0xa74c('0x33')]=_['intersection'](_0x25febf[_0xa74c('0x2f')],_0x25febf['query']);_0x58fe69[_0xa74c('0x36')]=_[_0xa74c('0x34')](_0x25febf[_0xa74c('0x2f')],qs[_0xa74c('0x35')](_0x4ae230[_0xa74c('0x31')][_0xa74c('0x35')]));_0x58fe69['attributes']=_0x58fe69['attributes'][_0xa74c('0x45')]?_0x58fe69[_0xa74c('0x36')]:_0x25febf[_0xa74c('0x2f')];if(_0x4ae230[_0xa74c('0x31')][_0xa74c('0x46')]){_0x58fe69[_0xa74c('0x41')]=[{'all':!![]}];}_0x58fe69=_[_0xa74c('0x3e')]({},_0x58fe69,_0x4ae230[_0xa74c('0x40')]);return db[_0xa74c('0x2c')][_0xa74c('0x47')](_0x58fe69)[_0xa74c('0x23')](handleEntityNotFound(_0x30e5f9,null))[_0xa74c('0x23')](respondWithResult(_0x30e5f9,null))['catch'](handleError(_0x30e5f9,null));};exports[_0xa74c('0x48')]=function(_0x55cf70,_0x5f48a1){return db[_0xa74c('0x2c')][_0xa74c('0x48')](_0x55cf70[_0xa74c('0x49')],{})[_0xa74c('0x23')](function(_0x38235a){var _0x13d4e6=_0x55cf70[_0xa74c('0x4a')][_0xa74c('0x4b')]({'plain':!![]});if(!_0x13d4e6)throw new Error(_0xa74c('0x4c'));if(_0x13d4e6[_0xa74c('0x4d')]==='user'){var _0x3a86a5=_0x38235a['get']({'plain':!![]});var _0x593579=_0xa74c('0x25');return db[_0xa74c('0x4e')][_0xa74c('0x47')]({'where':{'name':_0x593579,'userProfileId':_0x13d4e6[_0xa74c('0x4f')]},'raw':!![]})[_0xa74c('0x23')](function(_0x1e2690){if(_0x1e2690&&_0x1e2690[_0xa74c('0x50')]===0x0){return db['UserProfileResource'][_0xa74c('0x48')]({'name':_0x3a86a5[_0xa74c('0x29')],'resourceId':_0x3a86a5['id'],'type':_0x1e2690['name'],'sectionId':_0x1e2690['id']},{})['then'](function(){return _0x38235a;});}else{return _0x38235a;}})[_0xa74c('0x51')](function(_0x5882d9){logger[_0xa74c('0x27')](_0xa74c('0x52'),_0x5882d9);throw _0x5882d9;});}return _0x38235a;})[_0xa74c('0x23')](respondWithResult(_0x5f48a1,0xc9))[_0xa74c('0x51')](handleError(_0x5f48a1,null));};exports[_0xa74c('0x22')]=function(_0x475538,_0x44f724){if(_0x475538['body']['id']){delete _0x475538[_0xa74c('0x49')]['id'];}return db['Schedule'][_0xa74c('0x47')]({'where':{'id':_0x475538['params']['id']}})[_0xa74c('0x23')](handleEntityNotFound(_0x44f724,null))[_0xa74c('0x23')](saveUpdates(_0x475538[_0xa74c('0x49')],null))[_0xa74c('0x23')](respondWithResult(_0x44f724,null))[_0xa74c('0x51')](handleError(_0x44f724,null));};exports['destroy']=function(_0x652ed5,_0x5695b1){return db['Schedule']['find']({'where':{'id':_0x652ed5[_0xa74c('0x53')]['id']}})['then'](handleEntityNotFound(_0x5695b1,null))[_0xa74c('0x23')](removeEntity(_0x5695b1,null))[_0xa74c('0x51')](handleError(_0x5695b1,null));};exports['run']=function(_0x1a6e71,_0xc82d8f,_0x22ec12){var _0x3596dd=require('../../config/schedule');return db['Schedule'][_0xa74c('0x47')]({'where':{'id':_0x1a6e71[_0xa74c('0x53')]['id']},'raw':!![]})[_0xa74c('0x23')](handleEntityNotFound(_0xc82d8f,null))['then'](function(){_0x3596dd[_0xa74c('0x54')](_0x1a6e71[_0xa74c('0x53')]['id']);})[_0xa74c('0x23')](respondWithStatusCode(_0xc82d8f,null))[_0xa74c('0x51')](handleError(_0xc82d8f,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index b39928f..c3ba250 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 _0x13db=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define'];(function(_0x257bc3,_0x2bce7c){var _0x5688e2=function(_0x5bb3ae){while(--_0x5bb3ae){_0x257bc3['push'](_0x257bc3['shift']());}};_0x5688e2(++_0x2bce7c);}(_0x13db,0x9c));var _0xb13d=function(_0x37d19a,_0x349b67){_0x37d19a=_0x37d19a-0x0;var _0x5d9e95=_0x13db[_0x37d19a];return _0x5d9e95;};'use strict';var _=require(_0xb13d('0x0'));var util=require(_0xb13d('0x1'));var logger=require(_0xb13d('0x2'))(_0xb13d('0x3'));var moment=require(_0xb13d('0x4'));var BPromise=require(_0xb13d('0x5'));var rp=require(_0xb13d('0x6'));var fs=require('fs');var path=require(_0xb13d('0x7'));var rimraf=require(_0xb13d('0x8'));var config=require(_0xb13d('0x9'));var attributes=require(_0xb13d('0xa'));module[_0xb13d('0xb')]=function(_0x1f0b82,_0x1cb875){return _0x1f0b82[_0xb13d('0xc')]('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72f6=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','define','tools_schedules','util'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x72f6,0xf9));var _0x672f=function(_0x490beb,_0x245514){_0x490beb=_0x490beb-0x0;var _0x12e6f4=_0x72f6[_0x490beb];return _0x12e6f4;};'use strict';var _=require('lodash');var util=require(_0x672f('0x0'));var logger=require(_0x672f('0x1'))(_0x672f('0x2'));var moment=require('moment');var BPromise=require(_0x672f('0x3'));var rp=require(_0x672f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x672f('0x5'));var config=require(_0x672f('0x6'));var attributes=require(_0x672f('0x7'));module['exports']=function(_0x306b0c,_0x463bb7){return _0x306b0c[_0x672f('0x8')]('Schedule',attributes,{'tableName':_0x672f('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 b6b7314..49eb9c8 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 _0x966e=['jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','Schedule,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2c8c31,_0x123590){var _0x3c8817=function(_0x4e0b57){while(--_0x4e0b57){_0x2c8c31['push'](_0x2c8c31['shift']());}};_0x3c8817(++_0x123590);}(_0x966e,0x9e));var _0xe966=function(_0x2525f1,_0x47034f){_0x2525f1=_0x2525f1-0x0;var _0x13c1b5=_0x966e[_0x2525f1];return _0x13c1b5;};'use strict';var _=require(_0xe966('0x0'));var util=require('util');var moment=require(_0xe966('0x1'));var BPromise=require(_0xe966('0x2'));var rs=require(_0xe966('0x3'));var fs=require('fs');var Redis=require(_0xe966('0x4'));var db=require(_0xe966('0x5'))['db'];var utils=require(_0xe966('0x6'));var logger=require(_0xe966('0x7'))(_0xe966('0x8'));var config=require(_0xe966('0x9'));var jayson=require(_0xe966('0xa'));var client=jayson[_0xe966('0xb')][_0xe966('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1245a7,_0x5f0d74,_0x1b68f6){return new BPromise(function(_0x506187,_0x2f1910){return client[_0xe966('0xd')](_0x1245a7,_0x1b68f6)[_0xe966('0xe')](function(_0x4f4918){logger[_0xe966('0xf')]('Schedule,\x20%s,\x20%s',_0x5f0d74,'request\x20sent');logger[_0xe966('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0x5f0d74,_0xe966('0x11'),JSON[_0xe966('0x12')](_0x4f4918));if(_0x4f4918[_0xe966('0x13')]){if(_0x4f4918['error']['code']===0x1f4){logger[_0xe966('0x13')](_0xe966('0x14'),_0x5f0d74,_0x4f4918[_0xe966('0x13')][_0xe966('0x15')]);return _0x2f1910(_0x4f4918[_0xe966('0x13')][_0xe966('0x15')]);}logger[_0xe966('0x13')](_0xe966('0x14'),_0x5f0d74,_0x4f4918[_0xe966('0x13')]['message']);return _0x506187(_0x4f4918[_0xe966('0x13')][_0xe966('0x15')]);}else{logger['info'](_0xe966('0x14'),_0x5f0d74,_0xe966('0x11'));_0x506187(_0x4f4918[_0xe966('0x16')][_0xe966('0x15')]);}})[_0xe966('0x17')](function(_0x4070b8){logger[_0xe966('0x13')]('Schedule,\x20%s,\x20%s',_0x5f0d74,_0x4070b8);_0x2f1910(_0x4070b8);});});} \ No newline at end of file +var _0xced4=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment'];(function(_0xf38064,_0xcbe11c){var _0x42f37c=function(_0x56b1b7){while(--_0x56b1b7){_0xf38064['push'](_0xf38064['shift']());}};_0x42f37c(++_0xcbe11c);}(_0xced4,0x1a0));var _0x4ced=function(_0x3181cc,_0x28447f){_0x3181cc=_0x3181cc-0x0;var _0x547a4a=_0xced4[_0x3181cc];return _0x547a4a;};'use strict';var _=require(_0x4ced('0x0'));var util=require('util');var moment=require(_0x4ced('0x1'));var BPromise=require(_0x4ced('0x2'));var rs=require(_0x4ced('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ced('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ced('0x5'))(_0x4ced('0x6'));var config=require(_0x4ced('0x7'));var jayson=require(_0x4ced('0x8'));var client=jayson[_0x4ced('0x9')][_0x4ced('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x443907,_0xc8e201,_0x3d5b1d){return new BPromise(function(_0x244375,_0x5eed1d){return client[_0x4ced('0xb')](_0x443907,_0x3d5b1d)[_0x4ced('0xc')](function(_0x1f705c){logger[_0x4ced('0xd')](_0x4ced('0xe'),_0xc8e201,'request\x20sent');logger['debug'](_0x4ced('0xf'),_0xc8e201,_0x4ced('0x10'),JSON[_0x4ced('0x11')](_0x1f705c));if(_0x1f705c[_0x4ced('0x12')]){if(_0x1f705c[_0x4ced('0x12')]['code']===0x1f4){logger[_0x4ced('0x12')](_0x4ced('0xe'),_0xc8e201,_0x1f705c[_0x4ced('0x12')][_0x4ced('0x13')]);return _0x5eed1d(_0x1f705c[_0x4ced('0x12')]['message']);}logger['error'](_0x4ced('0xe'),_0xc8e201,_0x1f705c[_0x4ced('0x12')][_0x4ced('0x13')]);return _0x244375(_0x1f705c[_0x4ced('0x12')][_0x4ced('0x13')]);}else{logger[_0x4ced('0xd')]('Schedule,\x20%s,\x20%s',_0xc8e201,_0x4ced('0x10'));_0x244375(_0x1f705c[_0x4ced('0x14')][_0x4ced('0x13')]);}})[_0x4ced('0x15')](function(_0x3fe628){logger[_0x4ced('0x12')](_0x4ced('0xe'),_0xc8e201,_0x3fe628);_0x5eed1d(_0x3fe628);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index bf1b1f7..e207ef3 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 _0xfb29=['Router','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/:id','/:id/download','post','create','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x9544d8,_0x15c590){var _0x44788d=function(_0x23967a){while(--_0x23967a){_0x9544d8['push'](_0x9544d8['shift']());}};_0x44788d(++_0x15c590);}(_0xfb29,0xa7));var _0x9fb2=function(_0x55de7a,_0x53a4a5){_0x55de7a=_0x55de7a-0x0;var _0x2b15cc=_0xfb29[_0x55de7a];return _0x2b15cc;};'use strict';var multer=require('multer');var util=require(_0x9fb2('0x0'));var path=require(_0x9fb2('0x1'));var timeout=require(_0x9fb2('0x2'));var express=require(_0x9fb2('0x3'));var router=express[_0x9fb2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9fb2('0x5'));var config=require(_0x9fb2('0x6'));var controller=require(_0x9fb2('0x7'));router[_0x9fb2('0x8')]('/',auth[_0x9fb2('0x9')](),controller[_0x9fb2('0xa')]);router[_0x9fb2('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x9fb2('0x8')](_0x9fb2('0xb'),auth[_0x9fb2('0x9')](),controller['show']);router[_0x9fb2('0x8')](_0x9fb2('0xc'),auth[_0x9fb2('0x9')](),controller['download']);router[_0x9fb2('0xd')]('/',auth[_0x9fb2('0x9')](),controller[_0x9fb2('0xe')]);router[_0x9fb2('0xf')](_0x9fb2('0xb'),auth[_0x9fb2('0x9')](),controller[_0x9fb2('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9fb2('0x11')]);module[_0x9fb2('0x12')]=router; \ No newline at end of file +var _0x044d=['multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','post','update','delete'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x044d,0x1a9));var _0xd044=function(_0x4e115f,_0xbd4672){_0x4e115f=_0x4e115f-0x0;var _0x5c614d=_0x044d[_0x4e115f];return _0x5c614d;};'use strict';var multer=require(_0xd044('0x0'));var util=require('util');var path=require(_0xd044('0x1'));var timeout=require(_0xd044('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd044('0x3'));var auth=require(_0xd044('0x4'));var interaction=require(_0xd044('0x5'));var config=require(_0xd044('0x6'));var controller=require(_0xd044('0x7'));router[_0xd044('0x8')]('/',auth[_0xd044('0x9')](),controller['index']);router[_0xd044('0x8')](_0xd044('0xa'),auth['isAuthenticated'](),controller[_0xd044('0xb')]);router['get'](_0xd044('0xc'),auth[_0xd044('0x9')](),controller['show']);router[_0xd044('0x8')](_0xd044('0xd'),auth[_0xd044('0x9')](),controller['download']);router[_0xd044('0xe')]('/',auth[_0xd044('0x9')](),controller['create']);router['put'](_0xd044('0xc'),auth['isAuthenticated'](),controller[_0xd044('0xf')]);router[_0xd044('0x10')](_0xd044('0xc'),auth[_0xd044('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index cb0d82b..15ddd8e 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 _0xb114=['path','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','sequelize'];(function(_0x4e2b38,_0x4fb104){var _0xbb5dc7=function(_0x1dd2fc){while(--_0x1dd2fc){_0x4e2b38['push'](_0x4e2b38['shift']());}};_0xbb5dc7(++_0x4fb104);}(_0xb114,0x11f));var _0x4b11=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xb114[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require(_0x4b11('0x0'));var moment=require('moment');var path=require(_0x4b11('0x1'));var config=require(_0x4b11('0x2'));module['exports']={'format':{'type':Sequelize[_0x4b11('0x3')],'get':function(){return this[_0x4b11('0x4')](_0x4b11('0x5'))?path[_0x4b11('0x6')](this[_0x4b11('0x4')](_0x4b11('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4b11('0x7')]},'value':{'type':Sequelize[_0x4b11('0x7')],'set':function(_0x41fac6){var _0x91f371=_0x41fac6[_0x4b11('0x8')](/\\/g,'/');this[_0x4b11('0x9')](_0x4b11('0x5'),_0x91f371);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x4b11('0xa')],'set':function(_0x4cde8d){this[_0x4b11('0x9')](_0x4b11('0xb'),moment()[_0x4b11('0xc')](_0x4cde8d,'ms'));this[_0x4b11('0x9')](_0x4b11('0xd'),moment());this[_0x4b11('0x9')]('duration',_0x4cde8d);}},'startedAt':{'type':Sequelize[_0x4b11('0xe')],'get':function(){return moment(this[_0x4b11('0x4')](_0x4b11('0xb')))[_0x4b11('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0x4b11('0xe')],'get':function(){return moment(this[_0x4b11('0x4')](_0x4b11('0xd')))[_0x4b11('0xf')](_0x4b11('0x10'))[_0x4b11('0x11')]();}},'createdAt':{'type':Sequelize[_0x4b11('0xe')],'get':function(){return moment(this[_0x4b11('0x4')]('createdAt'))['format'](_0x4b11('0x10'))[_0x4b11('0x11')]();}},'updatedAt':{'type':Sequelize[_0x4b11('0xe')],'get':function(){return moment(this['getDataValue']('updatedAt'))['format'](_0x4b11('0x10'))[_0x4b11('0x11')]();}}}; \ No newline at end of file +var _0x3e94=['../../config/environment','exports','VIRTUAL','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','MM-DD-YYYY\x20HH:mm','toString','createdAt','format','updatedAt','sequelize','moment'];(function(_0xffadfc,_0x29ab3a){var _0x2bc15a=function(_0x22fd74){while(--_0x22fd74){_0xffadfc['push'](_0xffadfc['shift']());}};_0x2bc15a(++_0x29ab3a);}(_0x3e94,0x67));var _0x43e9=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x3e94[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x43e9('0x0'));var moment=require(_0x43e9('0x1'));var path=require('path');var config=require(_0x43e9('0x2'));module[_0x43e9('0x3')]={'format':{'type':Sequelize[_0x43e9('0x4')],'get':function(){return this['getDataValue'](_0x43e9('0x5'))?path[_0x43e9('0x6')](this[_0x43e9('0x7')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x43e9('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x43e9('0x8')],'set':function(_0x4b35f1){var _0x1183a0=_0x4b35f1[_0x43e9('0x9')](/\\/g,'/');this[_0x43e9('0xa')]('value',_0x1183a0);}},'rating':{'type':Sequelize[_0x43e9('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x43e9('0xb')],'set':function(_0x43d6e8){this[_0x43e9('0xa')](_0x43e9('0xc'),moment()[_0x43e9('0xd')](_0x43d6e8,'ms'));this[_0x43e9('0xa')](_0x43e9('0xe'),moment());this[_0x43e9('0xa')]('duration',_0x43d6e8);}},'startedAt':{'type':Sequelize[_0x43e9('0xf')],'get':function(){return moment(this[_0x43e9('0x7')](_0x43e9('0xc')))['format'](_0x43e9('0x10'))[_0x43e9('0x11')]();}},'closedAt':{'type':Sequelize[_0x43e9('0xf')],'get':function(){return moment(this[_0x43e9('0x7')](_0x43e9('0xe')))['format']('MM-DD-YYYY\x20HH:mm')[_0x43e9('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x43e9('0x7')](_0x43e9('0x12')))[_0x43e9('0x13')](_0x43e9('0x10'))[_0x43e9('0x11')]();}},'updatedAt':{'type':Sequelize[_0x43e9('0xf')],'get':function(){return moment(this[_0x43e9('0x7')](_0x43e9('0x14')))[_0x43e9('0x13')](_0x43e9('0x10'))[_0x43e9('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 35e2e28..68dcbc0 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 _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(_0x449607,_0x287561){var _0x972d5=function(_0x222241){while(--_0x222241){_0x449607['push'](_0x449607['shift']());}};_0x972d5(++_0x287561);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x2d126e,_0x1e8257){_0x2d126e=_0x2d126e-0x0;var _0xcb04d3=_0xf2ca[_0x2d126e];return _0xcb04d3;};'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 +var _0x425d=['include','findAll','rows','catch','show','params','length','includeAll','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','root','server/files/screen_recordings','value','%s.cypher','recording','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0x425d,0x1e0));var _0xd425=function(_0x16e824,_0x23ab90){_0x16e824=_0x16e824-0x0;var _0x1745ea=_0x425d[_0x16e824];return _0x1745ea;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];function respondWithStatusCode(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xcc;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x1d')](_0x3cacf7);}return _0x9bb611['status'](_0x3cacf7)[_0xd425('0x1e')]();};}function respondWithResult(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0xc8;return function(_0x5d3d60){if(_0x5d3d60){return _0x17a498[_0xd425('0x1f')](_0x336dc3)[_0xd425('0x20')](_0x5d3d60);}};}function respondWithFilteredResult(_0x643fd2,_0x41f34d){return function(_0x1fc822){if(_0x1fc822){var _0x538a0a=typeof _0x41f34d[_0xd425('0x21')]===_0xd425('0x22')&&typeof _0x41f34d[_0xd425('0x23')]===_0xd425('0x22');var _0x5d6585=_0x1fc822[_0xd425('0x24')];var _0x434d97=_0x538a0a?0x0:_0x41f34d[_0xd425('0x21')];var _0x1155bc=_0x538a0a?_0x1fc822['count']:_0x41f34d['offset']+_0x41f34d['limit'];var _0x4b293a;if(_0x1155bc>=_0x5d6585){_0x1155bc=_0x5d6585;_0x4b293a=0xc8;}else{_0x4b293a=0xce;}_0x643fd2[_0xd425('0x1f')](_0x4b293a);return _0x643fd2[_0xd425('0x25')](_0xd425('0x26'),_0x434d97+'-'+_0x1155bc+'/'+_0x5d6585)['json'](_0x1fc822);}return null;};}function patchUpdates(_0x355af0){return function(_0x7e982e){try{jsonpatch['apply'](_0x7e982e,_0x355af0,!![]);}catch(_0x2e1ec4){return BPromise[_0xd425('0x27')](_0x2e1ec4);}return _0x7e982e[_0xd425('0x28')]();};}function saveUpdates(_0x1d3fc0,_0x3e93db){return function(_0xb240c4){if(_0xb240c4){return _0xb240c4[_0xd425('0x29')](_0x1d3fc0)[_0xd425('0x2a')](function(_0x314201){return _0x314201;});}return null;};}function removeEntity(_0x2b030b,_0x151ad9){return function(_0x40e84b){if(_0x40e84b){return _0x40e84b['destroy']()[_0xd425('0x2a')](function(){_0x2b030b[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();});}};}function handleEntityNotFound(_0x1908a5,_0x2afcdb){return function(_0x400dd7){if(!_0x400dd7){_0x1908a5[_0xd425('0x1d')](0x194);}return _0x400dd7;};}function handleError(_0x577e4b,_0x12f951){_0x12f951=_0x12f951||0x1f4;return function(_0x177de2){logger[_0xd425('0x2b')](_0x177de2['stack']);if(_0x177de2[_0xd425('0x2c')]){delete _0x177de2[_0xd425('0x2c')];}_0x577e4b[_0xd425('0x1f')](_0x12f951)[_0xd425('0x2d')](_0x177de2);};}exports[_0xd425('0x2e')]=function(_0x185d7e,_0x2fd17a){var _0x37b63c={},_0x24da23={},_0x1cac61={'count':0x0,'rows':[]};var _0x482ba6=_[_0xd425('0x2f')](db[_0xd425('0x30')][_0xd425('0x31')],function(_0x3695dd){return{'name':_0x3695dd[_0xd425('0x32')],'type':_0x3695dd[_0xd425('0x33')][_0xd425('0x34')]};});_0x24da23[_0xd425('0x35')]=_[_0xd425('0x36')](_[_0xd425('0x2f')](_0x482ba6,_0xd425('0x2c')),['format']);_0x24da23[_0xd425('0x37')]=_[_0xd425('0x38')](_0x185d7e[_0xd425('0x37')]);_0x24da23[_0xd425('0x39')]=_[_0xd425('0x3a')](_0x24da23['model'],_0x24da23[_0xd425('0x37')]);_0x37b63c[_0xd425('0x3b')]=_['intersection'](_0x24da23['model'],qs['fields'](_0x185d7e[_0xd425('0x37')][_0xd425('0x3c')]));_0x37b63c[_0xd425('0x3b')]=_0x37b63c[_0xd425('0x3b')]['length']?_0x37b63c[_0xd425('0x3b')]:_0x24da23[_0xd425('0x35')];if(!_0x185d7e[_0xd425('0x37')][_0xd425('0x3d')](_0xd425('0x3e'))){_0x37b63c[_0xd425('0x23')]=qs[_0xd425('0x23')](_0x185d7e['query'][_0xd425('0x23')]);_0x37b63c['offset']=qs[_0xd425('0x21')](_0x185d7e[_0xd425('0x37')][_0xd425('0x21')]);}_0x37b63c['order']=qs[_0xd425('0x3f')](_0x185d7e[_0xd425('0x37')][_0xd425('0x3f')]);_0x37b63c[_0xd425('0x40')]=qs['filters'](_[_0xd425('0x41')](_0x185d7e[_0xd425('0x37')],_0x24da23['filters']),_0x482ba6);if(_0x185d7e['query']['filter']){_0x37b63c[_0xd425('0x40')]=_[_0xd425('0x42')](_0x37b63c[_0xd425('0x40')],{'$or':_['map'](_0x482ba6,function(_0x4f8323){if(_0x4f8323['type']!==_0xd425('0x43')){var _0x3f9090={};_0x3f9090[_0x4f8323[_0xd425('0x2c')]]={'$like':'%'+_0x185d7e[_0xd425('0x37')][_0xd425('0x44')]+'%'};return _0x3f9090;}})});}_0x37b63c=_[_0xd425('0x42')]({},_0x37b63c,_0x185d7e[_0xd425('0x45')]);var _0x4b922f={'where':_0x37b63c[_0xd425('0x40')]};return db[_0xd425('0x30')][_0xd425('0x24')](_0x4b922f)['then'](function(_0x3adc67){_0x1cac61[_0xd425('0x24')]=_0x3adc67;if(_0x185d7e[_0xd425('0x37')]['includeAll']){_0x37b63c[_0xd425('0x46')]=[{'all':!![]}];}return db[_0xd425('0x30')][_0xd425('0x47')](_0x37b63c);})[_0xd425('0x2a')](function(_0x5afd62){_0x1cac61[_0xd425('0x48')]=_0x5afd62;return _0x1cac61;})[_0xd425('0x2a')](respondWithFilteredResult(_0x2fd17a,_0x37b63c))[_0xd425('0x49')](handleError(_0x2fd17a,null));};exports[_0xd425('0x4a')]=function(_0x3f24fb,_0x2f6bf7){var _0x2d799b={'raw':![],'where':{'id':_0x3f24fb[_0xd425('0x4b')]['id']}},_0x524fad={};_0x524fad[_0xd425('0x35')]=_['keys'](db[_0xd425('0x30')]['rawAttributes']);_0x524fad['query']=_[_0xd425('0x38')](_0x3f24fb['query']);_0x524fad[_0xd425('0x39')]=_['intersection'](_0x524fad[_0xd425('0x35')],_0x524fad[_0xd425('0x37')]);_0x2d799b[_0xd425('0x3b')]=_[_0xd425('0x3a')](_0x524fad[_0xd425('0x35')],qs['fields'](_0x3f24fb[_0xd425('0x37')]['fields']));_0x2d799b[_0xd425('0x3b')]=_0x2d799b['attributes'][_0xd425('0x4c')]?_0x2d799b[_0xd425('0x3b')]:_0x524fad[_0xd425('0x35')];if(_0x3f24fb[_0xd425('0x37')][_0xd425('0x4d')]){_0x2d799b['include']=[{'all':!![]}];}_0x2d799b=_[_0xd425('0x42')]({},_0x2d799b,_0x3f24fb[_0xd425('0x45')]);return db[_0xd425('0x30')][_0xd425('0x4e')](_0x2d799b)[_0xd425('0x2a')](handleEntityNotFound(_0x2f6bf7,null))['then'](respondWithResult(_0x2f6bf7,null))[_0xd425('0x49')](handleError(_0x2f6bf7,null));};exports[_0xd425('0x4f')]=function(_0x1450f2,_0x2a2ab4){return db[_0xd425('0x30')][_0xd425('0x4f')](_0x1450f2['body'],{})[_0xd425('0x2a')](respondWithResult(_0x2a2ab4,0xc9))[_0xd425('0x49')](handleError(_0x2a2ab4,null));};exports['update']=function(_0x3f305,_0x42c084){if(_0x3f305[_0xd425('0x50')]['id']){delete _0x3f305[_0xd425('0x50')]['id'];}delete _0x3f305['body'][_0xd425('0x51')];delete _0x3f305[_0xd425('0x50')][_0xd425('0x52')];delete _0x3f305[_0xd425('0x50')][_0xd425('0x53')];delete _0x3f305['body']['value'];return db[_0xd425('0x30')]['find']({'where':{'id':_0x3f305[_0xd425('0x4b')]['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x42c084,null))['then'](saveUpdates(_0x3f305[_0xd425('0x50')],null))['then'](respondWithResult(_0x42c084,null))['catch'](handleError(_0x42c084,null));};exports[_0xd425('0x54')]=function(_0x111905,_0xe6451f){return db[_0xd425('0x30')][_0xd425('0x54')]()[_0xd425('0x2a')](respondWithResult(_0xe6451f,null))[_0xd425('0x49')](handleError(_0xe6451f,null));};exports[_0xd425('0x55')]=function(_0x54d437,_0x11ed71,_0x1c6141){var _0x1be9bb=require(_0xd425('0x56'));var _0x7b1080=![];var _0x1c80c2={};if(_0x54d437[_0xd425('0x37')][_0xd425('0x33')]&&_0x54d437['query']['type']==='uniqueid'){_0x1c80c2[_0xd425('0x57')]=_0x54d437[_0xd425('0x4b')]['id'];}else{_0x1c80c2['id']=_0x54d437[_0xd425('0x4b')]['id'];}return db[_0xd425('0x30')]['find']({'where':_0x1c80c2,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x11ed71,null))['then'](function(_0x254b8b){if(_0x254b8b){var _0x44c5e4=path['join'](config[_0xd425('0x58')],_0xd425('0x59'),_0x254b8b[_0xd425('0x5a')]);var _0x57e23e=util['format'](_0xd425('0x5b'),_0x44c5e4);if(fs['existsSync'](_0x57e23e)){_0x7b1080=!![];return _0x1be9bb['decryptFile'](_0x57e23e,_0x44c5e4,config['secrets'][_0xd425('0x5c')])[_0xd425('0x2a')](function(){return _0x254b8b;});}return _0x254b8b;}})[_0xd425('0x2a')](function(_0x5b2323){if(_0x5b2323){var _0x3395d8=path['join'](config[_0xd425('0x58')],_0xd425('0x59'),_0x5b2323[_0xd425('0x5a')]);if(!fs[_0xd425('0x5d')](_0x3395d8)){throw new db[(_0xd425('0x5e'))][(_0xd425('0x5f'))](_0xd425('0x60'));}if(_0x5b2323[_0xd425('0x61')]){return _0x11ed71[_0xd425('0x55')](_0x3395d8,_0x5b2323['filename']+path[_0xd425('0x62')](_0x3395d8),function(){if(_0x7b1080){fs[_0xd425('0x63')](_0x3395d8);}});}else{return _0x11ed71[_0xd425('0x55')](_0x3395d8,function(_0xf22906){if(_0x7b1080){fs['unlink'](_0x3395d8);}});}}})['catch'](function(_0x307e9a){if(_0x307e9a[_0xd425('0x64')]===_0xd425('0x60')){_0x11ed71[_0xd425('0x1f')](0x194)[_0xd425('0x2d')](_0xd425('0x65'));}else{return handleError(_0x11ed71,null);}});};exports[_0xd425('0x66')]=function(_0x44782a,_0x1fcde4){return db[_0xd425('0x30')][_0xd425('0x4e')]({'where':{'id':_0x44782a[_0xd425('0x4b')]['id']}})[_0xd425('0x2a')](function(_0x28979e){if(_['isNil'](_0x28979e)){throw new ReferenceError(_0xd425('0x67'));}return _0x28979e;})[_0xd425('0x2a')](function(_0xd2f2e8){var _0x4fd793=path['join'](config['root'],_0xd425('0x59'),_0xd2f2e8[_0xd425('0x5a')]);logger[_0xd425('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x4fd793);if(!_[_0xd425('0x69')](_0xd2f2e8['value'])&&fs[_0xd425('0x5d')](_0x4fd793)){logger[_0xd425('0x68')](_0xd425('0x6a')+_0x4fd793+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xd425('0x6b')](_0x4fd793);}_0x4fd793=_0x4fd793+_0xd425('0x6c');if(!_[_0xd425('0x69')](_0xd2f2e8[_0xd425('0x5a')])&&fs[_0xd425('0x5d')](_0x4fd793)){logger[_0xd425('0x68')](_0xd425('0x6a')+_0x4fd793+_0xd425('0x6d'));fs[_0xd425('0x6b')](_0x4fd793);}return _0xd2f2e8;})[_0xd425('0x2a')](function(_0x2ba77b){if(!_0x2ba77b)throw new InternalError();return _0x2ba77b[_0xd425('0x66')]();})[_0xd425('0x2a')](function(){_0x1fcde4[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();})[_0xd425('0x49')](handleError(_0x1fcde4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 98aeb17..f2517a5 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 _0xa836=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','interactionid','util'];(function(_0x195728,_0x4211c7){var _0x1dbf50=function(_0x5869f1){while(--_0x5869f1){_0x195728['push'](_0x195728['shift']());}};_0x1dbf50(++_0x4211c7);}(_0xa836,0x16b));var _0x6a83=function(_0x25a475,_0x3fd195){_0x25a475=_0x25a475-0x0;var _0x17c865=_0xa836[_0x25a475];return _0x17c865;};'use strict';var _=require('lodash');var util=require(_0x6a83('0x0'));var logger=require(_0x6a83('0x1'))(_0x6a83('0x2'));var moment=require(_0x6a83('0x3'));var BPromise=require(_0x6a83('0x4'));var rp=require(_0x6a83('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a83('0x6'));var config=require(_0x6a83('0x7'));var attributes=require(_0x6a83('0x8'));module[_0x6a83('0x9')]=function(_0x5ef9dc,_0xb36613){return _0x5ef9dc[_0x6a83('0xa')](_0x6a83('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x6a83('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa291=['interactionid','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings'];(function(_0x1af305,_0x3a833e){var _0x1270ca=function(_0x2bb5ec){while(--_0x2bb5ec){_0x1af305['push'](_0x1af305['shift']());}};_0x1270ca(++_0x3a833e);}(_0xa291,0xc4));var _0x1a29=function(_0x158e3b,_0x4534b){_0x158e3b=_0x158e3b-0x0;var _0x551a1d=_0xa291[_0x158e3b];return _0x551a1d;};'use strict';var _=require(_0x1a29('0x0'));var util=require('util');var logger=require(_0x1a29('0x1'))(_0x1a29('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1a29('0x3'));var fs=require('fs');var path=require(_0x1a29('0x4'));var rimraf=require(_0x1a29('0x5'));var config=require(_0x1a29('0x6'));var attributes=require(_0x1a29('0x7'));module[_0x1a29('0x8')]=function(_0x44b29e,_0xae723d){return _0x44b29e[_0x1a29('0x9')](_0x1a29('0xa'),attributes,{'tableName':_0x1a29('0xb'),'paranoid':![],'indexes':[{'name':_0x1a29('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 3f73d2a..8279b96 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 _0x0840=['error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x0840,0x89));var _0x0084=function(_0x334651,_0x6e99f6){_0x334651=_0x334651-0x0;var _0x29657c=_0x0840[_0x334651];return _0x29657c;};'use strict';var _=require(_0x0084('0x0'));var util=require(_0x0084('0x1'));var moment=require(_0x0084('0x2'));var BPromise=require(_0x0084('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0084('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0084('0x5'))(_0x0084('0x6'));var config=require(_0x0084('0x7'));var jayson=require(_0x0084('0x8'));var client=jayson[_0x0084('0x9')][_0x0084('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e3091,_0x11bee2,_0x1a88ae){return new BPromise(function(_0x42d8b0,_0x553349){return client[_0x0084('0xb')](_0x5e3091,_0x1a88ae)[_0x0084('0xc')](function(_0x5c84d9){logger['info'](_0x0084('0xd'),_0x11bee2,_0x0084('0xe'));logger['debug'](_0x0084('0xf'),_0x11bee2,_0x0084('0xe'),JSON[_0x0084('0x10')](_0x5c84d9));if(_0x5c84d9[_0x0084('0x11')]){if(_0x5c84d9[_0x0084('0x11')][_0x0084('0x12')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x11bee2,_0x5c84d9[_0x0084('0x11')]['message']);return _0x553349(_0x5c84d9[_0x0084('0x11')][_0x0084('0x13')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x11bee2,_0x5c84d9[_0x0084('0x11')]['message']);return _0x42d8b0(_0x5c84d9[_0x0084('0x11')][_0x0084('0x13')]);}else{logger[_0x0084('0x14')]('ScreenRecording,\x20%s,\x20%s',_0x11bee2,_0x0084('0xe'));_0x42d8b0(_0x5c84d9[_0x0084('0x15')][_0x0084('0x13')]);}})['catch'](function(_0x193510){logger[_0x0084('0x11')](_0x0084('0xd'),_0x11bee2,_0x193510);_0x553349(_0x193510);});});} \ No newline at end of file +var _0x7a57=['jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x23415f,_0x415f79){var _0x1e977f=function(_0x2da5b3){while(--_0x2da5b3){_0x23415f['push'](_0x23415f['shift']());}};_0x1e977f(++_0x415f79);}(_0x7a57,0x153));var _0x77a5=function(_0x55919a,_0x236f23){_0x55919a=_0x55919a-0x0;var _0x782495=_0x7a57[_0x55919a];return _0x782495;};'use strict';var _=require(_0x77a5('0x0'));var util=require(_0x77a5('0x1'));var moment=require(_0x77a5('0x2'));var BPromise=require(_0x77a5('0x3'));var rs=require(_0x77a5('0x4'));var fs=require('fs');var Redis=require(_0x77a5('0x5'));var db=require(_0x77a5('0x6'))['db'];var utils=require(_0x77a5('0x7'));var logger=require(_0x77a5('0x8'))(_0x77a5('0x9'));var config=require(_0x77a5('0xa'));var jayson=require(_0x77a5('0xb'));var client=jayson['client'][_0x77a5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b163d,_0x4e466f,_0xfc4fb7){return new BPromise(function(_0xffb2f,_0x7ae1f2){return client[_0x77a5('0xd')](_0x3b163d,_0xfc4fb7)[_0x77a5('0xe')](function(_0x310e19){logger[_0x77a5('0xf')](_0x77a5('0x10'),_0x4e466f,_0x77a5('0x11'));logger[_0x77a5('0x12')](_0x77a5('0x13'),_0x4e466f,_0x77a5('0x11'),JSON[_0x77a5('0x14')](_0x310e19));if(_0x310e19[_0x77a5('0x15')]){if(_0x310e19['error']['code']===0x1f4){logger[_0x77a5('0x15')]('ScreenRecording,\x20%s,\x20%s',_0x4e466f,_0x310e19[_0x77a5('0x15')][_0x77a5('0x16')]);return _0x7ae1f2(_0x310e19[_0x77a5('0x15')][_0x77a5('0x16')]);}logger[_0x77a5('0x15')]('ScreenRecording,\x20%s,\x20%s',_0x4e466f,_0x310e19['error'][_0x77a5('0x16')]);return _0xffb2f(_0x310e19[_0x77a5('0x15')][_0x77a5('0x16')]);}else{logger[_0x77a5('0xf')](_0x77a5('0x10'),_0x4e466f,_0x77a5('0x11'));_0xffb2f(_0x310e19[_0x77a5('0x17')][_0x77a5('0x16')]);}})[_0x77a5('0x18')](function(_0x35bbd3){logger['error'](_0x77a5('0x10'),_0x4e466f,_0x35bbd3);_0x7ae1f2(_0x35bbd3);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index cbc2952..8f9d2f2 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 _0xee68=['%s%s','originalname','single','file','addLogo','logologin','extname','post','/:id/logo_login','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','show','/:id/logo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format'];(function(_0x555d2d,_0x2509b4){var _0x2697a9=function(_0x361d1e){while(--_0x361d1e){_0x555d2d['push'](_0x555d2d['shift']());}};_0x2697a9(++_0x2509b4);}(_0xee68,0x94));var _0x8ee6=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0xee68[_0x3a0c4f];return _0x247049;};'use strict';var multer=require(_0x8ee6('0x0'));var util=require('util');var path=require(_0x8ee6('0x1'));var timeout=require(_0x8ee6('0x2'));var express=require(_0x8ee6('0x3'));var router=express[_0x8ee6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8ee6('0x5'));var interaction=require(_0x8ee6('0x6'));var config=require(_0x8ee6('0x7'));var controller=require(_0x8ee6('0x8'));router['get']('/',auth[_0x8ee6('0x9')](),controller[_0x8ee6('0xa')]);router[_0x8ee6('0xb')](_0x8ee6('0xc'),controller[_0x8ee6('0xd')]);router[_0x8ee6('0xb')](_0x8ee6('0xe'),controller[_0x8ee6('0xf')]);router[_0x8ee6('0xb')](_0x8ee6('0x10'),controller['getLogo']);router[_0x8ee6('0xb')]('/:id/logo_login',controller[_0x8ee6('0x11')]);router[_0x8ee6('0xb')](_0x8ee6('0x12'),controller[_0x8ee6('0x13')]);router[_0x8ee6('0xb')](_0x8ee6('0x14'),controller[_0x8ee6('0x15')]);router[_0x8ee6('0xb')](_0x8ee6('0x16'),controller['getFavicon']);var upload=multer({'storage':multer[_0x8ee6('0x17')]({'destination':function(_0x411444,_0x4febcc,_0x122337){_0x122337(null,path[_0x8ee6('0x18')](config[_0x8ee6('0x19')],_0x8ee6('0x1a')));},'filename':function(_0x33936c,_0x3dde45,_0x728c7b){_0x728c7b(null,util[_0x8ee6('0x1b')](_0x8ee6('0x1c'),'logo',path['extname'](_0x3dde45[_0x8ee6('0x1d')])));}})});router['post'](_0x8ee6('0x10'),upload[_0x8ee6('0x1e')](_0x8ee6('0x1f')),controller[_0x8ee6('0x20')]);var upload=multer({'storage':multer[_0x8ee6('0x17')]({'destination':function(_0x39b031,_0x7c37b4,_0x4b547a){_0x4b547a(null,path[_0x8ee6('0x18')](config[_0x8ee6('0x19')],_0x8ee6('0x1a')));},'filename':function(_0x230e8f,_0x332a20,_0x3f32e5){_0x3f32e5(null,util[_0x8ee6('0x1b')](_0x8ee6('0x1c'),_0x8ee6('0x21'),path[_0x8ee6('0x22')](_0x332a20[_0x8ee6('0x1d')])));}})});router[_0x8ee6('0x23')](_0x8ee6('0x24'),upload[_0x8ee6('0x1e')](_0x8ee6('0x1f')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x8ee6('0x17')]({'destination':function(_0x2db61e,_0x3ea3b7,_0xbf3cf9){_0xbf3cf9(null,path[_0x8ee6('0x18')](config[_0x8ee6('0x19')],_0x8ee6('0x1a')));},'filename':function(_0x1db9a0,_0x5c30af,_0x3c05c5){_0x3c05c5(null,util[_0x8ee6('0x1b')](_0x8ee6('0x1c'),_0x8ee6('0x25'),path[_0x8ee6('0x22')](_0x5c30af[_0x8ee6('0x1d')])));}})});router[_0x8ee6('0x23')](_0x8ee6('0x14'),upload['single'](_0x8ee6('0x1f')),controller[_0x8ee6('0x26')]);var upload=multer({'storage':multer[_0x8ee6('0x17')]({'destination':function(_0x56b5a4,_0x175b40,_0x2f7060){_0x2f7060(null,path['join'](config[_0x8ee6('0x19')],'server/files/images/logos/'));},'filename':function(_0x8eb7b6,_0x18a36b,_0x56476b){_0x56476b(null,util['format'](_0x8ee6('0x1c'),_0x8ee6('0x27'),path[_0x8ee6('0x22')](_0x18a36b[_0x8ee6('0x1d')])));}})});router['post']('/:id/favicon',upload['single'](_0x8ee6('0x1f')),controller[_0x8ee6('0x28')]);router[_0x8ee6('0x29')](_0x8ee6('0xe'),auth['isAuthenticated'](),controller[_0x8ee6('0x2a')]);module[_0x8ee6('0x2b')]=router; \ No newline at end of file +var _0xc820=['show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','/:id/favicon','diskStorage','join','server/files/images/logos/','%s%s','extname','originalname','single','file','addLogo','root','format','logologin','addLogoLogin','favicon','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','/now','getDate','/:id'];(function(_0x1e6db4,_0x53a5ff){var _0x28a281=function(_0x266993){while(--_0x266993){_0x1e6db4['push'](_0x1e6db4['shift']());}};_0x28a281(++_0x53a5ff);}(_0xc820,0x1a9));var _0x0c82=function(_0x30e11e,_0x4877bc){_0x30e11e=_0x30e11e-0x0;var _0x3e314e=_0xc820[_0x30e11e];return _0x3e314e;};'use strict';var multer=require(_0x0c82('0x0'));var util=require(_0x0c82('0x1'));var path=require(_0x0c82('0x2'));var timeout=require(_0x0c82('0x3'));var express=require(_0x0c82('0x4'));var router=express[_0x0c82('0x5')]();var fs_extra=require(_0x0c82('0x6'));var auth=require(_0x0c82('0x7'));var interaction=require(_0x0c82('0x8'));var config=require('../../config/environment');var controller=require(_0x0c82('0x9'));router[_0x0c82('0xa')]('/',auth[_0x0c82('0xb')](),controller['index']);router[_0x0c82('0xa')](_0x0c82('0xc'),controller[_0x0c82('0xd')]);router[_0x0c82('0xa')](_0x0c82('0xe'),controller[_0x0c82('0xf')]);router[_0x0c82('0xa')](_0x0c82('0x10'),controller[_0x0c82('0x11')]);router[_0x0c82('0xa')](_0x0c82('0x12'),controller[_0x0c82('0x13')]);router[_0x0c82('0xa')](_0x0c82('0x14'),controller['gdpr']);router[_0x0c82('0xa')](_0x0c82('0x15'),controller['getPreferred']);router[_0x0c82('0xa')](_0x0c82('0x16'),controller['getFavicon']);var upload=multer({'storage':multer[_0x0c82('0x17')]({'destination':function(_0x1d5015,_0x44cacf,_0x5d420c){_0x5d420c(null,path[_0x0c82('0x18')](config['root'],_0x0c82('0x19')));},'filename':function(_0x1ae5db,_0x7a61f9,_0x5c64da){_0x5c64da(null,util['format'](_0x0c82('0x1a'),'logo',path[_0x0c82('0x1b')](_0x7a61f9[_0x0c82('0x1c')])));}})});router['post']('/:id/logo',upload[_0x0c82('0x1d')](_0x0c82('0x1e')),controller[_0x0c82('0x1f')]);var upload=multer({'storage':multer[_0x0c82('0x17')]({'destination':function(_0x4d92cb,_0x52922c,_0x4245c4){_0x4245c4(null,path[_0x0c82('0x18')](config[_0x0c82('0x20')],'server/files/images/logos/'));},'filename':function(_0xf3973,_0x256eb0,_0x2d2f92){_0x2d2f92(null,util[_0x0c82('0x21')](_0x0c82('0x1a'),_0x0c82('0x22'),path[_0x0c82('0x1b')](_0x256eb0[_0x0c82('0x1c')])));}})});router['post']('/:id/logo_login',upload[_0x0c82('0x1d')](_0x0c82('0x1e')),controller[_0x0c82('0x23')]);var upload=multer({'storage':multer[_0x0c82('0x17')]({'destination':function(_0x53ed9b,_0x1a3663,_0x319338){_0x319338(null,path[_0x0c82('0x18')](config[_0x0c82('0x20')],'server/files/images/logos/'));},'filename':function(_0x1276b6,_0x3a5aeb,_0x1a2135){_0x1a2135(null,util[_0x0c82('0x21')]('%s%s','preferred',path[_0x0c82('0x1b')](_0x3a5aeb[_0x0c82('0x1c')])));}})});router['post'](_0x0c82('0x15'),upload[_0x0c82('0x1d')](_0x0c82('0x1e')),controller['addPreferred']);var upload=multer({'storage':multer[_0x0c82('0x17')]({'destination':function(_0x2b4eb9,_0x6b2af7,_0xf911ec){_0xf911ec(null,path[_0x0c82('0x18')](config[_0x0c82('0x20')],_0x0c82('0x19')));},'filename':function(_0x1efdb6,_0x7617a2,_0x44e5f8){_0x44e5f8(null,util[_0x0c82('0x21')](_0x0c82('0x1a'),_0x0c82('0x24'),path['extname'](_0x7617a2[_0x0c82('0x1c')])));}})});router['post']('/:id/favicon',upload[_0x0c82('0x1d')](_0x0c82('0x1e')),controller['addFavicon']);router[_0x0c82('0x25')](_0x0c82('0xe'),auth[_0x0c82('0xb')](),controller[_0x0c82('0x26')]);module[_0x0c82('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 474fe34..7a410b7 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 _0x3e9f=['INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports'];(function(_0x3aa4aa,_0x46ec41){var _0x42cf92=function(_0x408742){while(--_0x408742){_0x3aa4aa['push'](_0x3aa4aa['shift']());}};_0x42cf92(++_0x46ec41);}(_0x3e9f,0x98));var _0xf3e9=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x3e9f[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require(_0xf3e9('0x0'));module[_0xf3e9('0x1')]={'min_internal':{'type':Sequelize[_0xf3e9('0x2')](0xb),'unique':_0xf3e9('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xf3e9('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf3e9('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xf3e9('0x5')],'defaultValue':_0xf3e9('0x6')},'logo':{'type':Sequelize[_0xf3e9('0x5')]},'defaultLogo':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xf3e9('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xf3e9('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xf3e9('0x5')]},'turnaddr':{'type':Sequelize[_0xf3e9('0x5')]},'turnusername':{'type':Sequelize[_0xf3e9('0x5')]},'turnpassword':{'type':Sequelize[_0xf3e9('0x5')]},'pageTitle':{'type':Sequelize[_0xf3e9('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xf3e9('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xf3e9('0x8')},'enableEmailPreview':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xf3e9('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xf3e9('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xf3e9('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xf3e9('0x5')],'defaultValue':_0xf3e9('0x9')},'chatTimeout':{'type':Sequelize[_0xf3e9('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xf3e9('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xf3e9('0x5')]},'sentiment':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xf3e9('0x5')]},'language':{'type':Sequelize[_0xf3e9('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xf3e9('0x2')](0x2)[_0xf3e9('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xf3e9('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xf3e9('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xf3e9('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xf3e9('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xf3e9('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xf3e9('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xf3e9('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xf3e9('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xf3e9('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xf3e9('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xf3e9('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0x6fad=['sequelize','exports','INTEGER','min_internal','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','STRING','alternate','UNSIGNED'];(function(_0x4831fa,_0xfd55ab){var _0x318679=function(_0x20dedc){while(--_0x20dedc){_0x4831fa['push'](_0x4831fa['shift']());}};_0x318679(++_0xfd55ab);}(_0x6fad,0x17a));var _0xd6fa=function(_0x1bca89,_0x555310){_0x1bca89=_0x1bca89-0x0;var _0x28f163=_0x6fad[_0x1bca89];return _0x28f163;};'use strict';var Sequelize=require(_0xd6fa('0x0'));module[_0xd6fa('0x1')]={'min_internal':{'type':Sequelize[_0xd6fa('0x2')](0xb),'unique':_0xd6fa('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xd6fa('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xd6fa('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xd6fa('0x4')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xd6fa('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xd6fa('0x6')]},'turnaddr':{'type':Sequelize[_0xd6fa('0x6')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xd6fa('0x6')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xd6fa('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xd6fa('0x6')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xd6fa('0x6')],'defaultValue':_0xd6fa('0x7')},'chatTimeout':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xd6fa('0x6')]},'defaultPreferred':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xd6fa('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xd6fa('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd6fa('0x6')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xd6fa('0x2')](0x2)[_0xd6fa('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xd6fa('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0xd6fa('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xd6fa('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xd6fa('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xd6fa('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xd6fa('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 f23c45d..054af10 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 _0x6b6d=['length','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','Setting','includeAll','include','findAll','rows','catch','show','params','options','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','favicon','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','Sequelize','ValidationError','download','getLogoLogin','server/files/images/logos','defaultLogo','defaultLoginLogo','default_loginLogo.svg','custom','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','\x20not\x20found','getDate','utcOffset','format','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','stack','name','send','index','rawAttributes','fieldName','key','map','keys','filters','model','query','attributes','intersection','fields'];(function(_0x35f5bc,_0x2b5509){var _0x302aa6=function(_0x502370){while(--_0x502370){_0x35f5bc['push'](_0x35f5bc['shift']());}};_0x302aa6(++_0x2b5509);}(_0x6b6d,0xbd));var _0xd6b6=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x6b6d[_0xdea41a];return _0x15d0d8;};'use strict';var emlformat=require(_0xd6b6('0x0'));var rimraf=require(_0xd6b6('0x1'));var zipdir=require(_0xd6b6('0x2'));var jsonpatch=require(_0xd6b6('0x3'));var rp=require('request-promise');var moment=require(_0xd6b6('0x4'));var BPromise=require(_0xd6b6('0x5'));var Mustache=require(_0xd6b6('0x6'));var util=require(_0xd6b6('0x7'));var path=require('path');var sox=require(_0xd6b6('0x8'));var csv=require(_0xd6b6('0x9'));var ejs=require(_0xd6b6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6b6('0xb'));var squel=require(_0xd6b6('0xc'));var crypto=require(_0xd6b6('0xd'));var jsforce=require(_0xd6b6('0xe'));var deskjs=require(_0xd6b6('0xf'));var toCsv=require(_0xd6b6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd6b6('0x10'));var authService=require(_0xd6b6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd6b6('0x12'));var hardwareService=require(_0xd6b6('0x13'));var logger=require(_0xd6b6('0x14'))(_0xd6b6('0x15'));var utils=require(_0xd6b6('0x16'));var config=require(_0xd6b6('0x17'));var licenseUtil=require(_0xd6b6('0x18'));var db=require(_0xd6b6('0x19'))['db'];var jayson=require(_0xd6b6('0x1a'));var client=jayson['client'][_0xd6b6('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3f85eb,_0x391102,_0x121e6d,_0x4fa74c){return new BPromise(function(_0x427410,_0x308f04){var _0x3a13af=_0x4fa74c||client;return _0x3a13af[_0xd6b6('0x1c')](_0x3f85eb,_0x121e6d)[_0xd6b6('0x1d')](function(_0x1d5fff){logger[_0xd6b6('0x1e')](_0xd6b6('0x1f'),_0x391102,_0xd6b6('0x20'));logger[_0xd6b6('0x21')](_0xd6b6('0x22'),_0x391102,_0xd6b6('0x20'),JSON[_0xd6b6('0x23')](_0x1d5fff));if(_0x1d5fff[_0xd6b6('0x24')]){if(_0x1d5fff[_0xd6b6('0x24')]['code']===0x1f4){logger[_0xd6b6('0x24')](_0xd6b6('0x1f'),_0x391102,_0x1d5fff[_0xd6b6('0x24')][_0xd6b6('0x25')]);return _0x308f04(_0x1d5fff['error'][_0xd6b6('0x25')]);}logger['error']('Setting,\x20%s,\x20%s',_0x391102,_0x1d5fff[_0xd6b6('0x24')][_0xd6b6('0x25')]);return _0x427410(_0x1d5fff[_0xd6b6('0x24')][_0xd6b6('0x25')]);}else{logger[_0xd6b6('0x1e')](_0xd6b6('0x1f'),_0x391102,_0xd6b6('0x20'));_0x427410(_0x1d5fff[_0xd6b6('0x26')][_0xd6b6('0x25')]);}})['catch'](function(_0x38e42e){logger['error']('Setting,\x20%s,\x20%s',_0x391102,_0x38e42e);_0x308f04(_0x38e42e);});});}function respondWithStatusCode(_0x5639ed,_0x468621){_0x468621=_0x468621||0xcc;return function(_0x4d8339){if(_0x4d8339){return _0x5639ed[_0xd6b6('0x27')](_0x468621);}return _0x5639ed['status'](_0x468621)[_0xd6b6('0x28')]();};}function respondWithResult(_0x235bee,_0x27b03a){_0x27b03a=_0x27b03a||0xc8;return function(_0x49f991){if(_0x49f991){return _0x235bee[_0xd6b6('0x29')](_0x27b03a)[_0xd6b6('0x2a')](_0x49f991);}};}function respondWithFilteredResult(_0x4399fe,_0x115101){return function(_0x8abd4e){if(_0x8abd4e){var _0x5a3c31=typeof _0x115101[_0xd6b6('0x2b')]==='undefined'&&typeof _0x115101['limit']===_0xd6b6('0x2c');var _0xa444e4=_0x8abd4e[_0xd6b6('0x2d')];var _0x7fcefd=_0x5a3c31?0x0:_0x115101[_0xd6b6('0x2b')];var _0x50a354=_0x5a3c31?_0x8abd4e['count']:_0x115101['offset']+_0x115101[_0xd6b6('0x2e')];var _0x5962fa;if(_0x50a354>=_0xa444e4){_0x50a354=_0xa444e4;_0x5962fa=0xc8;}else{_0x5962fa=0xce;}_0x4399fe[_0xd6b6('0x29')](_0x5962fa);return _0x4399fe['set'](_0xd6b6('0x2f'),_0x7fcefd+'-'+_0x50a354+'/'+_0xa444e4)[_0xd6b6('0x2a')](_0x8abd4e);}return null;};}function patchUpdates(_0x188b9b){return function(_0x12d2ab){try{jsonpatch[_0xd6b6('0x30')](_0x12d2ab,_0x188b9b,!![]);}catch(_0x34f258){return BPromise['reject'](_0x34f258);}return _0x12d2ab[_0xd6b6('0x31')]();};}function saveUpdates(_0x527665,_0xa68ad0){return function(_0x210940){if(_0x210940){return _0x210940[_0xd6b6('0x32')](_0x527665)[_0xd6b6('0x1d')](function(_0x2f25c4){return _0x2f25c4;});}return null;};}function removeEntity(_0x3025ee,_0x2b9c40){return function(_0x240261){if(_0x240261){return _0x240261[_0xd6b6('0x33')]()['then'](function(){_0x3025ee[_0xd6b6('0x29')](0xcc)[_0xd6b6('0x28')]();});}};}function handleEntityNotFound(_0x1f56f4,_0xd8a8a1){return function(_0x4f9562){if(!_0x4f9562){_0x1f56f4[_0xd6b6('0x27')](0x194);}return _0x4f9562;};}function handleError(_0x4d884b,_0x23fb52){_0x23fb52=_0x23fb52||0x1f4;return function(_0x480097){logger[_0xd6b6('0x24')](_0x480097[_0xd6b6('0x34')]);if(_0x480097[_0xd6b6('0x35')]){delete _0x480097[_0xd6b6('0x35')];}_0x4d884b[_0xd6b6('0x29')](_0x23fb52)[_0xd6b6('0x36')](_0x480097);};}exports[_0xd6b6('0x37')]=function(_0x1b8e81,_0x596920){var _0xfbaba5={},_0x8a1e49={},_0x53e187={'count':0x0,'rows':[]};var _0x2b6586=_['map'](db['Setting'][_0xd6b6('0x38')],function(_0x389221){return{'name':_0x389221[_0xd6b6('0x39')],'type':_0x389221['type'][_0xd6b6('0x3a')]};});_0x8a1e49['model']=_[_0xd6b6('0x3b')](_0x2b6586,_0xd6b6('0x35'));_0x8a1e49['query']=_[_0xd6b6('0x3c')](_0x1b8e81['query']);_0x8a1e49[_0xd6b6('0x3d')]=_['intersection'](_0x8a1e49[_0xd6b6('0x3e')],_0x8a1e49[_0xd6b6('0x3f')]);_0xfbaba5[_0xd6b6('0x40')]=_[_0xd6b6('0x41')](_0x8a1e49['model'],qs[_0xd6b6('0x42')](_0x1b8e81[_0xd6b6('0x3f')][_0xd6b6('0x42')]));_0xfbaba5['attributes']=_0xfbaba5[_0xd6b6('0x40')][_0xd6b6('0x43')]?_0xfbaba5[_0xd6b6('0x40')]:_0x8a1e49[_0xd6b6('0x3e')];if(!_0x1b8e81['query']['hasOwnProperty'](_0xd6b6('0x44'))){_0xfbaba5[_0xd6b6('0x2e')]=qs['limit'](_0x1b8e81[_0xd6b6('0x3f')]['limit']);_0xfbaba5[_0xd6b6('0x2b')]=qs['offset'](_0x1b8e81[_0xd6b6('0x3f')]['offset']);}_0xfbaba5[_0xd6b6('0x45')]=qs[_0xd6b6('0x46')](_0x1b8e81[_0xd6b6('0x3f')][_0xd6b6('0x46')]);_0xfbaba5['where']=qs['filters'](_[_0xd6b6('0x47')](_0x1b8e81['query'],_0x8a1e49[_0xd6b6('0x3d')]),_0x2b6586);if(_0x1b8e81[_0xd6b6('0x3f')][_0xd6b6('0x48')]){_0xfbaba5['where']=_[_0xd6b6('0x49')](_0xfbaba5[_0xd6b6('0x4a')],{'$or':_[_0xd6b6('0x3b')](_0x2b6586,function(_0x429c5d){if(_0x429c5d[_0xd6b6('0x4b')]!==_0xd6b6('0x4c')){var _0x41c59c={};_0x41c59c[_0x429c5d[_0xd6b6('0x35')]]={'$like':'%'+_0x1b8e81['query'][_0xd6b6('0x48')]+'%'};return _0x41c59c;}})});}_0xfbaba5=_['merge']({},_0xfbaba5,_0x1b8e81['options']);var _0x4c89c5={'where':_0xfbaba5[_0xd6b6('0x4a')]};return db[_0xd6b6('0x4d')][_0xd6b6('0x2d')](_0x4c89c5)['then'](function(_0x2729b5){_0x53e187[_0xd6b6('0x2d')]=_0x2729b5;if(_0x1b8e81[_0xd6b6('0x3f')][_0xd6b6('0x4e')]){_0xfbaba5[_0xd6b6('0x4f')]=[{'all':!![]}];}return db[_0xd6b6('0x4d')][_0xd6b6('0x50')](_0xfbaba5);})[_0xd6b6('0x1d')](function(_0x1ba333){_0x53e187[_0xd6b6('0x51')]=_0x1ba333;return _0x53e187;})[_0xd6b6('0x1d')](respondWithFilteredResult(_0x596920,_0xfbaba5))[_0xd6b6('0x52')](handleError(_0x596920,null));};exports[_0xd6b6('0x53')]=function(_0x53467b,_0x288660){var _0x20030d={'raw':![],'where':{'id':_0x53467b[_0xd6b6('0x54')]['id']}},_0x138970={};_0x138970[_0xd6b6('0x3e')]=_[_0xd6b6('0x3c')](db[_0xd6b6('0x4d')]['rawAttributes']);_0x138970['query']=_[_0xd6b6('0x3c')](_0x53467b[_0xd6b6('0x3f')]);_0x138970[_0xd6b6('0x3d')]=_[_0xd6b6('0x41')](_0x138970[_0xd6b6('0x3e')],_0x138970[_0xd6b6('0x3f')]);_0x20030d[_0xd6b6('0x40')]=_[_0xd6b6('0x41')](_0x138970[_0xd6b6('0x3e')],qs['fields'](_0x53467b[_0xd6b6('0x3f')]['fields']));_0x20030d[_0xd6b6('0x40')]=_0x20030d[_0xd6b6('0x40')]['length']?_0x20030d[_0xd6b6('0x40')]:_0x138970[_0xd6b6('0x3e')];if(_0x53467b[_0xd6b6('0x3f')][_0xd6b6('0x4e')]){_0x20030d['include']=[{'all':!![]}];}_0x20030d=_[_0xd6b6('0x49')]({},_0x20030d,_0x53467b[_0xd6b6('0x55')]);return db['Setting'][_0xd6b6('0x56')](_0x20030d)[_0xd6b6('0x1d')](handleEntityNotFound(_0x288660,null))[_0xd6b6('0x1d')](respondWithResult(_0x288660,null))[_0xd6b6('0x52')](handleError(_0x288660,null));};exports['update']=function(_0x5ab58b,_0x26f1bf){if(_0x5ab58b['body']['id']){delete _0x5ab58b[_0xd6b6('0x57')]['id'];}return db[_0xd6b6('0x4d')][_0xd6b6('0x56')]({'where':{'id':_0x5ab58b[_0xd6b6('0x54')]['id']}})[_0xd6b6('0x1d')](handleEntityNotFound(_0x26f1bf,null))[_0xd6b6('0x1d')](saveUpdates(_0x5ab58b[_0xd6b6('0x57')],null))[_0xd6b6('0x1d')](respondWithResult(_0x26f1bf,null))[_0xd6b6('0x52')](handleError(_0x26f1bf,null));};exports[_0xd6b6('0x58')]=function(_0x4e0259,_0x16980a,_0x4a86f6){if(_0x4e0259[_0xd6b6('0x59')]&&_0x4e0259[_0xd6b6('0x59')][_0xd6b6('0x5a')]){_0x4e0259[_0xd6b6('0x57')][_0xd6b6('0x5b')]=_0x4e0259[_0xd6b6('0x59')]['filename'];}return db['Setting'][_0xd6b6('0x56')]({'where':{'id':_0x4e0259[_0xd6b6('0x54')]['id']}})[_0xd6b6('0x1d')](handleEntityNotFound(_0x16980a,null))[_0xd6b6('0x1d')](saveUpdates(_0x4e0259[_0xd6b6('0x57')],null))[_0xd6b6('0x1d')](respondWithResult(_0x16980a,null))['catch'](handleError(_0x16980a,null));};exports[_0xd6b6('0x5c')]=function(_0x21adec,_0x2e2bbe,_0x464614){if(_0x21adec[_0xd6b6('0x59')]&&_0x21adec[_0xd6b6('0x59')][_0xd6b6('0x5a')]){_0x21adec[_0xd6b6('0x57')][_0xd6b6('0x5d')]=_0x21adec[_0xd6b6('0x59')][_0xd6b6('0x5a')];}return db[_0xd6b6('0x4d')][_0xd6b6('0x56')]({'where':{'id':_0x21adec[_0xd6b6('0x54')]['id']}})[_0xd6b6('0x1d')](handleEntityNotFound(_0x2e2bbe,null))['then'](saveUpdates(_0x21adec['body'],null))[_0xd6b6('0x1d')](respondWithResult(_0x2e2bbe,null))[_0xd6b6('0x52')](handleError(_0x2e2bbe,null));};var utilLicense=require('../../config/license/util');exports[_0xd6b6('0x5e')]=function(_0x23b761,_0x379b15,_0x31f415){var _0x47f82b='server/files/images/logos';var _0x56812b={'custom':![]};return utilLicense[_0xd6b6('0x5f')]()['then'](function(_0x35f58f){if(_0x35f58f){_0x56812b=_0x35f58f;}return db[_0xd6b6('0x4d')][_0xd6b6('0x56')]({'where':{'id':_0x23b761[_0xd6b6('0x54')]['id']},'attributes':['logo',_0xd6b6('0x5d'),_0xd6b6('0x60'),_0xd6b6('0x61'),'defaultLogo','defaultLoginLogo',_0xd6b6('0x62'),_0xd6b6('0x63')],'raw':!![]});})[_0xd6b6('0x1d')](handleEntityNotFound(_0x379b15,null))['then'](function(_0x1cf775){if(_0x1cf775){var _0x47dc61=_0x1cf775[_0xd6b6('0x5b')]&&fs[_0xd6b6('0x64')](path[_0xd6b6('0x65')](config[_0xd6b6('0x66')],_0x47f82b,_[_0xd6b6('0x67')](_0x1cf775[_0xd6b6('0x5b')])))?path[_0xd6b6('0x65')](config['root'],_0x47f82b,_['toLower'](_0x1cf775['logo'])):path['join'](config[_0xd6b6('0x66')],_0x47f82b,_[_0xd6b6('0x67')](_0xd6b6('0x68')));var _0x4f6e27=_0xd6b6('0x69')+_[_0xd6b6('0x6a')](_0xd6b6('0x5b'));if(_0x1cf775[_0x4f6e27]||!_0x56812b['custom']){_0x47dc61=path[_0xd6b6('0x65')](config[_0xd6b6('0x66')],_0x47f82b,_[_0xd6b6('0x67')](_0xd6b6('0x68')));}if(!fs[_0xd6b6('0x64')](_0x47dc61)){throw new db[(_0xd6b6('0x6b'))][(_0xd6b6('0x6c'))](_[_0xd6b6('0x6a')]('logo')+'\x20not\x20found');}return _0x379b15[_0xd6b6('0x6d')](_0x47dc61);}})[_0xd6b6('0x52')](handleError(_0x379b15,null));};var utilLicense=require(_0xd6b6('0x18'));exports[_0xd6b6('0x6e')]=function(_0x4580b2,_0x343c5a,_0xd327b3){var _0x34b2b5=_0xd6b6('0x6f');var _0x1424fc={'custom':![]};return utilLicense[_0xd6b6('0x5f')]()[_0xd6b6('0x1d')](function(_0x5e8200){if(_0x5e8200){_0x1424fc=_0x5e8200;}return db['Setting'][_0xd6b6('0x56')]({'where':{'id':_0x4580b2[_0xd6b6('0x54')]['id']},'attributes':[_0xd6b6('0x5b'),_0xd6b6('0x5d'),_0xd6b6('0x60'),_0xd6b6('0x61'),_0xd6b6('0x70'),_0xd6b6('0x71'),_0xd6b6('0x62'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x343c5a,null))[_0xd6b6('0x1d')](function(_0x2df3b0){if(_0x2df3b0){var _0x2dbfb2=_0x2df3b0[_0xd6b6('0x5d')]&&fs['existsSync'](path[_0xd6b6('0x65')](config[_0xd6b6('0x66')],_0x34b2b5,_[_0xd6b6('0x67')](_0x2df3b0[_0xd6b6('0x5d')])))?path[_0xd6b6('0x65')](config['root'],_0x34b2b5,_['toLower'](_0x2df3b0[_0xd6b6('0x5d')])):path[_0xd6b6('0x65')](config[_0xd6b6('0x66')],_0x34b2b5,_[_0xd6b6('0x67')](_0xd6b6('0x72')));var _0x3dcb7e=_0xd6b6('0x69')+_['upperFirst'](_0xd6b6('0x5d'));if(_0x2df3b0[_0x3dcb7e]||!_0x1424fc[_0xd6b6('0x73')]){_0x2dbfb2=path[_0xd6b6('0x65')](config[_0xd6b6('0x66')],_0x34b2b5,_[_0xd6b6('0x67')]('default_loginLogo.svg'));}if(!fs[_0xd6b6('0x64')](_0x2dbfb2)){throw new db[(_0xd6b6('0x6b'))][(_0xd6b6('0x6c'))](_[_0xd6b6('0x6a')](_0xd6b6('0x5d'))+'\x20not\x20found');}return _0x343c5a[_0xd6b6('0x6d')](_0x2dbfb2);}})[_0xd6b6('0x52')](handleError(_0x343c5a,null));};exports[_0xd6b6('0x74')]=function(_0x4f4938,_0x10f76b){return db['Setting'][_0xd6b6('0x56')]({'where':{'id':_0x4f4938[_0xd6b6('0x54')]['id']},'attributes':[_0xd6b6('0x75')]})['then'](respondWithResult(_0x10f76b,null))['catch'](handleError(_0x10f76b,null));};exports[_0xd6b6('0x76')]=function(_0x49eca2,_0x39936d,_0x81ad3c){if(_0x49eca2[_0xd6b6('0x59')]&&_0x49eca2[_0xd6b6('0x59')][_0xd6b6('0x5a')]){_0x49eca2['body'][_0xd6b6('0x60')]=_0x49eca2['file'][_0xd6b6('0x5a')];}return db[_0xd6b6('0x4d')][_0xd6b6('0x56')]({'where':{'id':_0x49eca2[_0xd6b6('0x54')]['id']}})[_0xd6b6('0x1d')](handleEntityNotFound(_0x39936d,null))[_0xd6b6('0x1d')](saveUpdates(_0x49eca2[_0xd6b6('0x57')],null))['then'](respondWithResult(_0x39936d,null))[_0xd6b6('0x52')](handleError(_0x39936d,null));};var utilLicense=require(_0xd6b6('0x18'));exports[_0xd6b6('0x77')]=function(_0x47944b,_0x94b60e,_0x17483b){var _0x403c65=_0xd6b6('0x6f');var _0x54688f={'custom':![]};return utilLicense['getLicense']()[_0xd6b6('0x1d')](function(_0xbdb96c){if(_0xbdb96c){_0x54688f=_0xbdb96c;}return db['Setting'][_0xd6b6('0x56')]({'where':{'id':_0x47944b[_0xd6b6('0x54')]['id']},'attributes':[_0xd6b6('0x5b'),_0xd6b6('0x5d'),_0xd6b6('0x60'),'favicon',_0xd6b6('0x70'),_0xd6b6('0x71'),_0xd6b6('0x62'),_0xd6b6('0x63')],'raw':!![]});})[_0xd6b6('0x1d')](handleEntityNotFound(_0x94b60e,null))[_0xd6b6('0x1d')](function(_0x15f6c0){if(_0x15f6c0){var _0x55d30d=_0x15f6c0['preferred']&&fs[_0xd6b6('0x64')](path[_0xd6b6('0x65')](config[_0xd6b6('0x66')],_0x403c65,_[_0xd6b6('0x67')](_0x15f6c0[_0xd6b6('0x60')])))?path[_0xd6b6('0x65')](config[_0xd6b6('0x66')],_0x403c65,_['toLower'](_0x15f6c0[_0xd6b6('0x60')])):path['join'](config['root'],_0x403c65,_[_0xd6b6('0x67')](_0xd6b6('0x78')));var _0x3f4293=_0xd6b6('0x69')+_[_0xd6b6('0x6a')]('preferred');if(_0x15f6c0[_0x3f4293]||!_0x54688f[_0xd6b6('0x73')]||!_0x54688f[_0xd6b6('0x60')]){_0x55d30d=path[_0xd6b6('0x65')](config[_0xd6b6('0x66')],_0x403c65,_[_0xd6b6('0x67')](_0xd6b6('0x78')));}if(!fs[_0xd6b6('0x64')](_0x55d30d)){throw new db[(_0xd6b6('0x6b'))][(_0xd6b6('0x6c'))](_[_0xd6b6('0x6a')](_0xd6b6('0x60'))+'\x20not\x20found');}return _0x94b60e[_0xd6b6('0x6d')](_0x55d30d);}})[_0xd6b6('0x52')](handleError(_0x94b60e,null));};exports[_0xd6b6('0x79')]=function(_0x2540de,_0x4119f8,_0x6dcb58){if(_0x2540de[_0xd6b6('0x59')]&&_0x2540de['file'][_0xd6b6('0x5a')]){_0x2540de[_0xd6b6('0x57')][_0xd6b6('0x61')]=_0x2540de[_0xd6b6('0x59')][_0xd6b6('0x5a')];}return db[_0xd6b6('0x4d')][_0xd6b6('0x56')]({'where':{'id':_0x2540de[_0xd6b6('0x54')]['id']}})['then'](handleEntityNotFound(_0x4119f8,null))['then'](saveUpdates(_0x2540de[_0xd6b6('0x57')],null))[_0xd6b6('0x1d')](respondWithResult(_0x4119f8,null))[_0xd6b6('0x52')](handleError(_0x4119f8,null));};var utilLicense=require(_0xd6b6('0x18'));exports[_0xd6b6('0x7a')]=function(_0x2079e7,_0x160456,_0x3e9fb8){var _0x33d5aa=_0xd6b6('0x6f');var _0x1e0f68={'custom':![]};return utilLicense['getLicense']()[_0xd6b6('0x1d')](function(_0x4db483){if(_0x4db483){_0x1e0f68=_0x4db483;}return db['Setting']['find']({'where':{'id':_0x2079e7[_0xd6b6('0x54')]['id']},'attributes':[_0xd6b6('0x5b'),'loginLogo',_0xd6b6('0x60'),_0xd6b6('0x61'),_0xd6b6('0x70'),_0xd6b6('0x71'),_0xd6b6('0x62'),_0xd6b6('0x63')],'raw':!![]});})[_0xd6b6('0x1d')](handleEntityNotFound(_0x160456,null))[_0xd6b6('0x1d')](function(_0x93a35a){if(_0x93a35a){var _0x2a8d88=_0x93a35a['favicon']&&fs[_0xd6b6('0x64')](path['join'](config[_0xd6b6('0x66')],_0x33d5aa,_[_0xd6b6('0x67')](_0x93a35a['favicon'])))?path[_0xd6b6('0x65')](config[_0xd6b6('0x66')],_0x33d5aa,_[_0xd6b6('0x67')](_0x93a35a['favicon'])):path['join'](config['root'],_0x33d5aa,_['toLower'](_0xd6b6('0x7b')));var _0x108ffb=_0xd6b6('0x69')+_[_0xd6b6('0x6a')](_0xd6b6('0x61'));if(_0x93a35a[_0x108ffb]||!_0x1e0f68[_0xd6b6('0x73')]){_0x2a8d88=path[_0xd6b6('0x65')](config[_0xd6b6('0x66')],_0x33d5aa,_['toLower'](_0xd6b6('0x7b')));}if(!fs[_0xd6b6('0x64')](_0x2a8d88)){throw new db['Sequelize'][(_0xd6b6('0x6c'))](_['upperFirst']('favicon')+_0xd6b6('0x7c'));}return _0x160456['download'](_0x2a8d88);}})['catch'](handleError(_0x160456,null));};exports[_0xd6b6('0x7d')]=function(_0x1262e5,_0x1ba372){var _0x5005bc={'offset':moment()[_0xd6b6('0x7e')]()};_0x5005bc['now']=moment()['utcOffset'](_0x5005bc['offset'])[_0xd6b6('0x7f')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x1ba372[_0xd6b6('0x29')](0xc8)[_0xd6b6('0x36')](_0x5005bc);}; \ No newline at end of file +var _0xccb9=['update','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','upperFirst','custom','existsSync','Sequelize','\x20not\x20found','download','default_loginLogo.svg','default','ValidationError','gdpr','securePassword','addPreferred','default_preferred.png','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','limit','undefined','offset','set','Content-Range','reject','save','destroy','end','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','keys','length','find'];(function(_0x7e247f,_0x469d63){var _0x344f84=function(_0x42604f){while(--_0x42604f){_0x7e247f['push'](_0x7e247f['shift']());}};_0x344f84(++_0x469d63);}(_0xccb9,0x124));var _0x9ccb=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0xccb9[_0x1d558c];return _0x15767d;};'use strict';var emlformat=require(_0x9ccb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ccb('0x1'));var jsonpatch=require(_0x9ccb('0x2'));var rp=require(_0x9ccb('0x3'));var moment=require(_0x9ccb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9ccb('0x5'));var util=require(_0x9ccb('0x6'));var path=require(_0x9ccb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9ccb('0x8'));var fs=require('fs');var fs_extra=require(_0x9ccb('0x9'));var _=require(_0x9ccb('0xa'));var squel=require(_0x9ccb('0xb'));var crypto=require(_0x9ccb('0xc'));var jsforce=require(_0x9ccb('0xd'));var deskjs=require(_0x9ccb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9ccb('0xf'));var Papa=require(_0x9ccb('0x10'));var Redis=require(_0x9ccb('0x11'));var authService=require(_0x9ccb('0x12'));var qs=require(_0x9ccb('0x13'));var as=require(_0x9ccb('0x14'));var hardwareService=require(_0x9ccb('0x15'));var logger=require(_0x9ccb('0x16'))(_0x9ccb('0x17'));var utils=require('../../config/utils');var config=require(_0x9ccb('0x18'));var licenseUtil=require(_0x9ccb('0x19'));var db=require(_0x9ccb('0x1a'))['db'];var jayson=require(_0x9ccb('0x1b'));var client=jayson['client'][_0x9ccb('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3e60f9,_0x269d68,_0x53de18,_0x28ed71){return new BPromise(function(_0x2d9e00,_0x5f18b2){var _0x24bb14=_0x28ed71||client;return _0x24bb14['request'](_0x3e60f9,_0x53de18)[_0x9ccb('0x1d')](function(_0x3ac092){logger['info']('Setting,\x20%s,\x20%s',_0x269d68,_0x9ccb('0x1e'));logger[_0x9ccb('0x1f')](_0x9ccb('0x20'),_0x269d68,_0x9ccb('0x1e'),JSON['stringify'](_0x3ac092));if(_0x3ac092[_0x9ccb('0x21')]){if(_0x3ac092[_0x9ccb('0x21')][_0x9ccb('0x22')]===0x1f4){logger[_0x9ccb('0x21')](_0x9ccb('0x23'),_0x269d68,_0x3ac092[_0x9ccb('0x21')][_0x9ccb('0x24')]);return _0x5f18b2(_0x3ac092[_0x9ccb('0x21')]['message']);}logger[_0x9ccb('0x21')](_0x9ccb('0x23'),_0x269d68,_0x3ac092[_0x9ccb('0x21')]['message']);return _0x2d9e00(_0x3ac092['error'][_0x9ccb('0x24')]);}else{logger[_0x9ccb('0x25')](_0x9ccb('0x23'),_0x269d68,_0x9ccb('0x1e'));_0x2d9e00(_0x3ac092[_0x9ccb('0x26')][_0x9ccb('0x24')]);}})[_0x9ccb('0x27')](function(_0x174683){logger[_0x9ccb('0x21')]('Setting,\x20%s,\x20%s',_0x269d68,_0x174683);_0x5f18b2(_0x174683);});});}function respondWithStatusCode(_0x53b8a6,_0xae8e3f){_0xae8e3f=_0xae8e3f||0xcc;return function(_0x4361a3){if(_0x4361a3){return _0x53b8a6[_0x9ccb('0x28')](_0xae8e3f);}return _0x53b8a6[_0x9ccb('0x29')](_0xae8e3f)['end']();};}function respondWithResult(_0x16e174,_0x10130e){_0x10130e=_0x10130e||0xc8;return function(_0x199b54){if(_0x199b54){return _0x16e174[_0x9ccb('0x29')](_0x10130e)[_0x9ccb('0x2a')](_0x199b54);}};}function respondWithFilteredResult(_0x4c1300,_0x21f880){return function(_0x570dc5){if(_0x570dc5){var _0x240669=typeof _0x21f880['offset']==='undefined'&&typeof _0x21f880[_0x9ccb('0x2b')]===_0x9ccb('0x2c');var _0x2c40ed=_0x570dc5['count'];var _0x43a8e8=_0x240669?0x0:_0x21f880[_0x9ccb('0x2d')];var _0x332006=_0x240669?_0x570dc5['count']:_0x21f880['offset']+_0x21f880[_0x9ccb('0x2b')];var _0xebb1fb;if(_0x332006>=_0x2c40ed){_0x332006=_0x2c40ed;_0xebb1fb=0xc8;}else{_0xebb1fb=0xce;}_0x4c1300[_0x9ccb('0x29')](_0xebb1fb);return _0x4c1300[_0x9ccb('0x2e')](_0x9ccb('0x2f'),_0x43a8e8+'-'+_0x332006+'/'+_0x2c40ed)[_0x9ccb('0x2a')](_0x570dc5);}return null;};}function patchUpdates(_0x12dbd8){return function(_0x22d14e){try{jsonpatch['apply'](_0x22d14e,_0x12dbd8,!![]);}catch(_0x3e0c69){return BPromise[_0x9ccb('0x30')](_0x3e0c69);}return _0x22d14e[_0x9ccb('0x31')]();};}function saveUpdates(_0xe3d70b,_0x4efac8){return function(_0x5f0077){if(_0x5f0077){return _0x5f0077['update'](_0xe3d70b)[_0x9ccb('0x1d')](function(_0x26d436){return _0x26d436;});}return null;};}function removeEntity(_0x5ec81e,_0x5374d2){return function(_0x4ec037){if(_0x4ec037){return _0x4ec037[_0x9ccb('0x32')]()['then'](function(){_0x5ec81e['status'](0xcc)[_0x9ccb('0x33')]();});}};}function handleEntityNotFound(_0x25dd66,_0x4bef66){return function(_0x136ac2){if(!_0x136ac2){_0x25dd66[_0x9ccb('0x28')](0x194);}return _0x136ac2;};}function handleError(_0x21927f,_0x414fc8){_0x414fc8=_0x414fc8||0x1f4;return function(_0x5eb09d){logger[_0x9ccb('0x21')](_0x5eb09d[_0x9ccb('0x34')]);if(_0x5eb09d['name']){delete _0x5eb09d[_0x9ccb('0x35')];}_0x21927f[_0x9ccb('0x29')](_0x414fc8)[_0x9ccb('0x36')](_0x5eb09d);};}exports['index']=function(_0x238a6b,_0x19c52f){var _0x1940bc={},_0x4af09f={},_0xfcb758={'count':0x0,'rows':[]};var _0x1547d0=_[_0x9ccb('0x37')](db[_0x9ccb('0x38')][_0x9ccb('0x39')],function(_0x77cd75){return{'name':_0x77cd75[_0x9ccb('0x3a')],'type':_0x77cd75[_0x9ccb('0x3b')][_0x9ccb('0x3c')]};});_0x4af09f[_0x9ccb('0x3d')]=_['map'](_0x1547d0,_0x9ccb('0x35'));_0x4af09f[_0x9ccb('0x3e')]=_['keys'](_0x238a6b[_0x9ccb('0x3e')]);_0x4af09f[_0x9ccb('0x3f')]=_[_0x9ccb('0x40')](_0x4af09f['model'],_0x4af09f[_0x9ccb('0x3e')]);_0x1940bc[_0x9ccb('0x41')]=_[_0x9ccb('0x40')](_0x4af09f[_0x9ccb('0x3d')],qs[_0x9ccb('0x42')](_0x238a6b['query'][_0x9ccb('0x42')]));_0x1940bc['attributes']=_0x1940bc[_0x9ccb('0x41')]['length']?_0x1940bc[_0x9ccb('0x41')]:_0x4af09f[_0x9ccb('0x3d')];if(!_0x238a6b['query'][_0x9ccb('0x43')](_0x9ccb('0x44'))){_0x1940bc['limit']=qs['limit'](_0x238a6b[_0x9ccb('0x3e')][_0x9ccb('0x2b')]);_0x1940bc['offset']=qs[_0x9ccb('0x2d')](_0x238a6b[_0x9ccb('0x3e')][_0x9ccb('0x2d')]);}_0x1940bc[_0x9ccb('0x45')]=qs[_0x9ccb('0x46')](_0x238a6b[_0x9ccb('0x3e')]['sort']);_0x1940bc[_0x9ccb('0x47')]=qs[_0x9ccb('0x3f')](_['pick'](_0x238a6b[_0x9ccb('0x3e')],_0x4af09f['filters']),_0x1547d0);if(_0x238a6b[_0x9ccb('0x3e')][_0x9ccb('0x48')]){_0x1940bc[_0x9ccb('0x47')]=_['merge'](_0x1940bc[_0x9ccb('0x47')],{'$or':_[_0x9ccb('0x37')](_0x1547d0,function(_0x37f53b){if(_0x37f53b[_0x9ccb('0x3b')]!==_0x9ccb('0x49')){var _0x3d0073={};_0x3d0073[_0x37f53b[_0x9ccb('0x35')]]={'$like':'%'+_0x238a6b[_0x9ccb('0x3e')][_0x9ccb('0x48')]+'%'};return _0x3d0073;}})});}_0x1940bc=_[_0x9ccb('0x4a')]({},_0x1940bc,_0x238a6b[_0x9ccb('0x4b')]);var _0x5dc461={'where':_0x1940bc[_0x9ccb('0x47')]};return db[_0x9ccb('0x38')][_0x9ccb('0x4c')](_0x5dc461)['then'](function(_0x4ed505){_0xfcb758[_0x9ccb('0x4c')]=_0x4ed505;if(_0x238a6b[_0x9ccb('0x3e')][_0x9ccb('0x4d')]){_0x1940bc[_0x9ccb('0x4e')]=[{'all':!![]}];}return db[_0x9ccb('0x38')][_0x9ccb('0x4f')](_0x1940bc);})[_0x9ccb('0x1d')](function(_0x492836){_0xfcb758[_0x9ccb('0x50')]=_0x492836;return _0xfcb758;})['then'](respondWithFilteredResult(_0x19c52f,_0x1940bc))[_0x9ccb('0x27')](handleError(_0x19c52f,null));};exports[_0x9ccb('0x51')]=function(_0x428f5f,_0x331521){var _0x42521e={'raw':![],'where':{'id':_0x428f5f[_0x9ccb('0x52')]['id']}},_0x5edff0={};_0x5edff0[_0x9ccb('0x3d')]=_[_0x9ccb('0x53')](db[_0x9ccb('0x38')]['rawAttributes']);_0x5edff0[_0x9ccb('0x3e')]=_[_0x9ccb('0x53')](_0x428f5f[_0x9ccb('0x3e')]);_0x5edff0['filters']=_[_0x9ccb('0x40')](_0x5edff0[_0x9ccb('0x3d')],_0x5edff0[_0x9ccb('0x3e')]);_0x42521e[_0x9ccb('0x41')]=_[_0x9ccb('0x40')](_0x5edff0[_0x9ccb('0x3d')],qs['fields'](_0x428f5f[_0x9ccb('0x3e')]['fields']));_0x42521e['attributes']=_0x42521e['attributes'][_0x9ccb('0x54')]?_0x42521e[_0x9ccb('0x41')]:_0x5edff0[_0x9ccb('0x3d')];if(_0x428f5f[_0x9ccb('0x3e')]['includeAll']){_0x42521e[_0x9ccb('0x4e')]=[{'all':!![]}];}_0x42521e=_[_0x9ccb('0x4a')]({},_0x42521e,_0x428f5f[_0x9ccb('0x4b')]);return db['Setting'][_0x9ccb('0x55')](_0x42521e)['then'](handleEntityNotFound(_0x331521,null))[_0x9ccb('0x1d')](respondWithResult(_0x331521,null))[_0x9ccb('0x27')](handleError(_0x331521,null));};exports[_0x9ccb('0x56')]=function(_0x5946b3,_0x416e39){if(_0x5946b3[_0x9ccb('0x57')]['id']){delete _0x5946b3[_0x9ccb('0x57')]['id'];}return db[_0x9ccb('0x38')][_0x9ccb('0x55')]({'where':{'id':_0x5946b3[_0x9ccb('0x52')]['id']}})['then'](handleEntityNotFound(_0x416e39,null))[_0x9ccb('0x1d')](saveUpdates(_0x5946b3[_0x9ccb('0x57')],null))[_0x9ccb('0x1d')](respondWithResult(_0x416e39,null))['catch'](handleError(_0x416e39,null));};exports[_0x9ccb('0x58')]=function(_0x6c2543,_0x32ab73,_0xa3dea3){if(_0x6c2543[_0x9ccb('0x59')]&&_0x6c2543[_0x9ccb('0x59')][_0x9ccb('0x5a')]){_0x6c2543[_0x9ccb('0x57')][_0x9ccb('0x5b')]=_0x6c2543[_0x9ccb('0x59')][_0x9ccb('0x5a')];}return db[_0x9ccb('0x38')][_0x9ccb('0x55')]({'where':{'id':_0x6c2543['params']['id']}})[_0x9ccb('0x1d')](handleEntityNotFound(_0x32ab73,null))[_0x9ccb('0x1d')](saveUpdates(_0x6c2543[_0x9ccb('0x57')],null))[_0x9ccb('0x1d')](respondWithResult(_0x32ab73,null))[_0x9ccb('0x27')](handleError(_0x32ab73,null));};exports[_0x9ccb('0x5c')]=function(_0x32a1b6,_0x51b65b,_0x19648f){if(_0x32a1b6[_0x9ccb('0x59')]&&_0x32a1b6[_0x9ccb('0x59')][_0x9ccb('0x5a')]){_0x32a1b6[_0x9ccb('0x57')][_0x9ccb('0x5d')]=_0x32a1b6[_0x9ccb('0x59')][_0x9ccb('0x5a')];}return db[_0x9ccb('0x38')]['find']({'where':{'id':_0x32a1b6['params']['id']}})[_0x9ccb('0x1d')](handleEntityNotFound(_0x51b65b,null))[_0x9ccb('0x1d')](saveUpdates(_0x32a1b6[_0x9ccb('0x57')],null))[_0x9ccb('0x1d')](respondWithResult(_0x51b65b,null))[_0x9ccb('0x27')](handleError(_0x51b65b,null));};var utilLicense=require(_0x9ccb('0x19'));exports[_0x9ccb('0x5e')]=function(_0x2daa03,_0x519f56,_0xf61ab2){var _0xb94bd8=_0x9ccb('0x5f');var _0x31bf22={'custom':![]};return utilLicense[_0x9ccb('0x60')]()[_0x9ccb('0x1d')](function(_0x84f4c3){if(_0x84f4c3){_0x31bf22=_0x84f4c3;}return db['Setting'][_0x9ccb('0x55')]({'where':{'id':_0x2daa03[_0x9ccb('0x52')]['id']},'attributes':[_0x9ccb('0x5b'),'loginLogo',_0x9ccb('0x61'),_0x9ccb('0x62'),_0x9ccb('0x63'),_0x9ccb('0x64'),_0x9ccb('0x65'),_0x9ccb('0x66')],'raw':!![]});})[_0x9ccb('0x1d')](handleEntityNotFound(_0x519f56,null))[_0x9ccb('0x1d')](function(_0x15e343){if(_0x15e343){var _0x2c4fee=_0x15e343[_0x9ccb('0x5b')]&&fs['existsSync'](path[_0x9ccb('0x67')](config[_0x9ccb('0x68')],_0xb94bd8,_['toLower'](_0x15e343['logo'])))?path[_0x9ccb('0x67')](config[_0x9ccb('0x68')],_0xb94bd8,_['toLower'](_0x15e343[_0x9ccb('0x5b')])):path[_0x9ccb('0x67')](config[_0x9ccb('0x68')],_0xb94bd8,_[_0x9ccb('0x69')](_0x9ccb('0x6a')));var _0x50c835='default'+_[_0x9ccb('0x6b')](_0x9ccb('0x5b'));if(_0x15e343[_0x50c835]||!_0x31bf22[_0x9ccb('0x6c')]){_0x2c4fee=path[_0x9ccb('0x67')](config[_0x9ccb('0x68')],_0xb94bd8,_[_0x9ccb('0x69')](_0x9ccb('0x6a')));}if(!fs[_0x9ccb('0x6d')](_0x2c4fee)){throw new db[(_0x9ccb('0x6e'))]['ValidationError'](_['upperFirst'](_0x9ccb('0x5b'))+_0x9ccb('0x6f'));}return _0x519f56[_0x9ccb('0x70')](_0x2c4fee);}})[_0x9ccb('0x27')](handleError(_0x519f56,null));};var utilLicense=require(_0x9ccb('0x19'));exports['getLogoLogin']=function(_0x4a0f18,_0x31c8f4,_0x1b56df){var _0xcb27b4=_0x9ccb('0x5f');var _0x2c2f7c={'custom':![]};return utilLicense[_0x9ccb('0x60')]()[_0x9ccb('0x1d')](function(_0x2d5197){if(_0x2d5197){_0x2c2f7c=_0x2d5197;}return db['Setting'][_0x9ccb('0x55')]({'where':{'id':_0x4a0f18[_0x9ccb('0x52')]['id']},'attributes':[_0x9ccb('0x5b'),_0x9ccb('0x5d'),'preferred',_0x9ccb('0x62'),'defaultLogo','defaultLoginLogo',_0x9ccb('0x65'),'defaultFavicon'],'raw':!![]});})[_0x9ccb('0x1d')](handleEntityNotFound(_0x31c8f4,null))[_0x9ccb('0x1d')](function(_0x343aaa){if(_0x343aaa){var _0x1b1096=_0x343aaa[_0x9ccb('0x5d')]&&fs[_0x9ccb('0x6d')](path['join'](config[_0x9ccb('0x68')],_0xcb27b4,_['toLower'](_0x343aaa[_0x9ccb('0x5d')])))?path['join'](config[_0x9ccb('0x68')],_0xcb27b4,_['toLower'](_0x343aaa[_0x9ccb('0x5d')])):path[_0x9ccb('0x67')](config[_0x9ccb('0x68')],_0xcb27b4,_[_0x9ccb('0x69')](_0x9ccb('0x71')));var _0x22342b=_0x9ccb('0x72')+_['upperFirst'](_0x9ccb('0x5d'));if(_0x343aaa[_0x22342b]||!_0x2c2f7c[_0x9ccb('0x6c')]){_0x1b1096=path['join'](config[_0x9ccb('0x68')],_0xcb27b4,_[_0x9ccb('0x69')](_0x9ccb('0x71')));}if(!fs[_0x9ccb('0x6d')](_0x1b1096)){throw new db['Sequelize'][(_0x9ccb('0x73'))](_['upperFirst']('loginLogo')+_0x9ccb('0x6f'));}return _0x31c8f4[_0x9ccb('0x70')](_0x1b1096);}})['catch'](handleError(_0x31c8f4,null));};exports[_0x9ccb('0x74')]=function(_0x3c18e7,_0x3029f5){return db[_0x9ccb('0x38')][_0x9ccb('0x55')]({'where':{'id':_0x3c18e7[_0x9ccb('0x52')]['id']},'attributes':[_0x9ccb('0x75')]})[_0x9ccb('0x1d')](respondWithResult(_0x3029f5,null))[_0x9ccb('0x27')](handleError(_0x3029f5,null));};exports[_0x9ccb('0x76')]=function(_0x1ec4a5,_0x5db5c4,_0x1338ca){if(_0x1ec4a5[_0x9ccb('0x59')]&&_0x1ec4a5[_0x9ccb('0x59')][_0x9ccb('0x5a')]){_0x1ec4a5[_0x9ccb('0x57')][_0x9ccb('0x61')]=_0x1ec4a5[_0x9ccb('0x59')][_0x9ccb('0x5a')];}return db['Setting'][_0x9ccb('0x55')]({'where':{'id':_0x1ec4a5[_0x9ccb('0x52')]['id']}})[_0x9ccb('0x1d')](handleEntityNotFound(_0x5db5c4,null))[_0x9ccb('0x1d')](saveUpdates(_0x1ec4a5[_0x9ccb('0x57')],null))[_0x9ccb('0x1d')](respondWithResult(_0x5db5c4,null))[_0x9ccb('0x27')](handleError(_0x5db5c4,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x2643c0,_0x7add89,_0x218d9a){var _0x5c1d01='server/files/images/logos';var _0x1eeb7b={'custom':![]};return utilLicense['getLicense']()[_0x9ccb('0x1d')](function(_0x526dad){if(_0x526dad){_0x1eeb7b=_0x526dad;}return db[_0x9ccb('0x38')][_0x9ccb('0x55')]({'where':{'id':_0x2643c0[_0x9ccb('0x52')]['id']},'attributes':[_0x9ccb('0x5b'),'loginLogo','preferred',_0x9ccb('0x62'),_0x9ccb('0x63'),'defaultLoginLogo',_0x9ccb('0x65'),_0x9ccb('0x66')],'raw':!![]});})[_0x9ccb('0x1d')](handleEntityNotFound(_0x7add89,null))[_0x9ccb('0x1d')](function(_0x246110){if(_0x246110){var _0x1c879c=_0x246110[_0x9ccb('0x61')]&&fs[_0x9ccb('0x6d')](path['join'](config[_0x9ccb('0x68')],_0x5c1d01,_[_0x9ccb('0x69')](_0x246110['preferred'])))?path[_0x9ccb('0x67')](config[_0x9ccb('0x68')],_0x5c1d01,_[_0x9ccb('0x69')](_0x246110[_0x9ccb('0x61')])):path['join'](config['root'],_0x5c1d01,_[_0x9ccb('0x69')](_0x9ccb('0x77')));var _0x4dfb42=_0x9ccb('0x72')+_['upperFirst'](_0x9ccb('0x61'));if(_0x246110[_0x4dfb42]||!_0x1eeb7b[_0x9ccb('0x6c')]||!_0x1eeb7b[_0x9ccb('0x61')]){_0x1c879c=path[_0x9ccb('0x67')](config[_0x9ccb('0x68')],_0x5c1d01,_[_0x9ccb('0x69')](_0x9ccb('0x77')));}if(!fs['existsSync'](_0x1c879c)){throw new db[(_0x9ccb('0x6e'))]['ValidationError'](_[_0x9ccb('0x6b')](_0x9ccb('0x61'))+_0x9ccb('0x6f'));}return _0x7add89[_0x9ccb('0x70')](_0x1c879c);}})[_0x9ccb('0x27')](handleError(_0x7add89,null));};exports['addFavicon']=function(_0xd84f8,_0x7023bd,_0x1c323e){if(_0xd84f8[_0x9ccb('0x59')]&&_0xd84f8[_0x9ccb('0x59')][_0x9ccb('0x5a')]){_0xd84f8[_0x9ccb('0x57')]['favicon']=_0xd84f8[_0x9ccb('0x59')][_0x9ccb('0x5a')];}return db['Setting'][_0x9ccb('0x55')]({'where':{'id':_0xd84f8[_0x9ccb('0x52')]['id']}})[_0x9ccb('0x1d')](handleEntityNotFound(_0x7023bd,null))[_0x9ccb('0x1d')](saveUpdates(_0xd84f8[_0x9ccb('0x57')],null))[_0x9ccb('0x1d')](respondWithResult(_0x7023bd,null))['catch'](handleError(_0x7023bd,null));};var utilLicense=require(_0x9ccb('0x19'));exports[_0x9ccb('0x78')]=function(_0x470e03,_0x50d2be,_0x3f62c8){var _0x30dcb7=_0x9ccb('0x5f');var _0x390397={'custom':![]};return utilLicense['getLicense']()[_0x9ccb('0x1d')](function(_0x3ca074){if(_0x3ca074){_0x390397=_0x3ca074;}return db['Setting'][_0x9ccb('0x55')]({'where':{'id':_0x470e03[_0x9ccb('0x52')]['id']},'attributes':[_0x9ccb('0x5b'),_0x9ccb('0x5d'),_0x9ccb('0x61'),_0x9ccb('0x62'),_0x9ccb('0x63'),_0x9ccb('0x64'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x9ccb('0x1d')](handleEntityNotFound(_0x50d2be,null))[_0x9ccb('0x1d')](function(_0x41b9be){if(_0x41b9be){var _0x301bc4=_0x41b9be['favicon']&&fs[_0x9ccb('0x6d')](path[_0x9ccb('0x67')](config[_0x9ccb('0x68')],_0x30dcb7,_[_0x9ccb('0x69')](_0x41b9be[_0x9ccb('0x62')])))?path['join'](config[_0x9ccb('0x68')],_0x30dcb7,_['toLower'](_0x41b9be[_0x9ccb('0x62')])):path['join'](config[_0x9ccb('0x68')],_0x30dcb7,_['toLower'](_0x9ccb('0x79')));var _0x2eea65='default'+_[_0x9ccb('0x6b')](_0x9ccb('0x62'));if(_0x41b9be[_0x2eea65]||!_0x390397[_0x9ccb('0x6c')]){_0x301bc4=path[_0x9ccb('0x67')](config['root'],_0x30dcb7,_['toLower']('default_favicon.ico'));}if(!fs['existsSync'](_0x301bc4)){throw new db[(_0x9ccb('0x6e'))]['ValidationError'](_['upperFirst'](_0x9ccb('0x62'))+_0x9ccb('0x6f'));}return _0x50d2be[_0x9ccb('0x70')](_0x301bc4);}})[_0x9ccb('0x27')](handleError(_0x50d2be,null));};exports['getDate']=function(_0x45ec91,_0x4caceb){var _0x50c9ed={'offset':moment()[_0x9ccb('0x7a')]()};_0x50c9ed[_0x9ccb('0x7b')]=moment()[_0x9ccb('0x7a')](_0x50c9ed['offset'])[_0x9ccb('0x7c')](_0x9ccb('0x7d'));return _0x4caceb[_0x9ccb('0x29')](0xc8)['send'](_0x50c9ed);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 9200e93..6e9cbc6 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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0x7217,0x19e));var _0x7721=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x7217[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0x008c,0x188));var _0xc008=function(_0x110479,_0x492d7b){_0x110479=_0x110479-0x0;var _0x55335=_0x008c[_0x110479];return _0x55335;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 549f28a..6c17452 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 _0x720c=['ShowSetting','debug','lodash','util','moment','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','result','catch','Setting','find','options','raw','include','map','model','attributes'];(function(_0x5eb6be,_0x1670ef){var _0x5f0e01=function(_0x4e4a5c){while(--_0x4e4a5c){_0x5eb6be['push'](_0x5eb6be['shift']());}};_0x5f0e01(++_0x1670ef);}(_0x720c,0xc6));var _0xc720=function(_0x5a89c7,_0x2a8168){_0x5a89c7=_0x5a89c7-0x0;var _0x1c7570=_0x720c[_0x5a89c7];return _0x1c7570;};'use strict';var _=require(_0xc720('0x0'));var util=require(_0xc720('0x1'));var moment=require(_0xc720('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(_0xc720('0x3'))('rpc');var config=require(_0xc720('0x4'));var jayson=require(_0xc720('0x5'));var client=jayson[_0xc720('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ec847,_0x5b74b2,_0x26edab){return new BPromise(function(_0x5a9729,_0x3754ed){return client[_0xc720('0x7')](_0x2ec847,_0x26edab)[_0xc720('0x8')](function(_0x18fb7d){logger[_0xc720('0x9')]('Setting,\x20%s,\x20%s',_0x5b74b2,_0xc720('0xa'));logger['debug'](_0xc720('0xb'),_0x5b74b2,_0xc720('0xa'),JSON[_0xc720('0xc')](_0x18fb7d));if(_0x18fb7d[_0xc720('0xd')]){if(_0x18fb7d[_0xc720('0xd')]['code']===0x1f4){logger[_0xc720('0xd')](_0xc720('0xe'),_0x5b74b2,_0x18fb7d[_0xc720('0xd')][_0xc720('0xf')]);return _0x3754ed(_0x18fb7d[_0xc720('0xd')][_0xc720('0xf')]);}logger['error'](_0xc720('0xe'),_0x5b74b2,_0x18fb7d[_0xc720('0xd')][_0xc720('0xf')]);return _0x5a9729(_0x18fb7d[_0xc720('0xd')][_0xc720('0xf')]);}else{logger[_0xc720('0x9')](_0xc720('0xe'),_0x5b74b2,'request\x20sent');_0x5a9729(_0x18fb7d[_0xc720('0x10')][_0xc720('0xf')]);}})[_0xc720('0x11')](function(_0x25549b){logger[_0xc720('0xd')](_0xc720('0xe'),_0x5b74b2,_0x25549b);_0x3754ed(_0x25549b);});});}exports['ShowSetting']=function(_0x229559){var _0x3dfe85=this;return new Promise(function(_0x1dede7,_0x23940b){return db[_0xc720('0x12')][_0xc720('0x13')]({'raw':_0x229559[_0xc720('0x14')]?_0x229559[_0xc720('0x14')][_0xc720('0x15')]===undefined?!![]:![]:!![],'where':_0x229559[_0xc720('0x14')]?_0x229559[_0xc720('0x14')]['where']||null:null,'attributes':_0x229559['options']?_0x229559[_0xc720('0x14')]['attributes']||null:null,'include':_0x229559[_0xc720('0x14')]?_0x229559[_0xc720('0x14')][_0xc720('0x16')]?_[_0xc720('0x17')](_0x229559[_0xc720('0x14')][_0xc720('0x16')],function(_0x5e4af6){return{'model':db[_0x5e4af6[_0xc720('0x18')]],'as':_0x5e4af6['as'],'attributes':_0x5e4af6['attributes'],'include':_0x5e4af6[_0xc720('0x16')]?_[_0xc720('0x17')](_0x5e4af6[_0xc720('0x16')],function(_0x6ed7d3){return{'model':db[_0x6ed7d3[_0xc720('0x18')]],'as':_0x6ed7d3['as'],'attributes':_0x6ed7d3[_0xc720('0x19')],'include':_0x6ed7d3['include']?_[_0xc720('0x17')](_0x6ed7d3[_0xc720('0x16')],function(_0x279cab){return{'model':db[_0x279cab[_0xc720('0x18')]],'as':_0x279cab['as'],'attributes':_0x279cab[_0xc720('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc720('0x8')](function(_0x28c534){logger['info'](_0xc720('0x1a'),_0x229559);logger[_0xc720('0x1b')](_0xc720('0x1a'),_0x229559,JSON[_0xc720('0xc')](_0x28c534));_0x1dede7(_0x28c534);})[_0xc720('0x11')](function(_0x316f93){logger[_0xc720('0xd')]('ShowSetting',_0x316f93[_0xc720('0xf')],_0x229559);_0x23940b(_0x3dfe85[_0xc720('0xd')](0x1f4,_0x316f93[_0xc720('0xf')]));});});}; \ No newline at end of file +var _0x3fb5=['info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSetting','Setting','options','raw','attributes','include','model','map','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x1e20a1,_0x537772){var _0x29de0a=function(_0x265146){while(--_0x265146){_0x1e20a1['push'](_0x1e20a1['shift']());}};_0x29de0a(++_0x537772);}(_0x3fb5,0x6c));var _0x53fb=function(_0x1138d3,_0x47fea5){_0x1138d3=_0x1138d3-0x0;var _0x9a0af0=_0x3fb5[_0x1138d3];return _0x9a0af0;};'use strict';var _=require(_0x53fb('0x0'));var util=require(_0x53fb('0x1'));var moment=require('moment');var BPromise=require(_0x53fb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x53fb('0x3'));var db=require(_0x53fb('0x4'))['db'];var utils=require(_0x53fb('0x5'));var logger=require(_0x53fb('0x6'))('rpc');var config=require(_0x53fb('0x7'));var jayson=require(_0x53fb('0x8'));var client=jayson[_0x53fb('0x9')][_0x53fb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b8d0b,_0x23bd82,_0x1573f2){return new BPromise(function(_0x619f3f,_0x1a12a6){return client['request'](_0x2b8d0b,_0x1573f2)[_0x53fb('0xb')](function(_0x5988f5){logger[_0x53fb('0xc')](_0x53fb('0xd'),_0x23bd82,_0x53fb('0xe'));logger[_0x53fb('0xf')](_0x53fb('0x10'),_0x23bd82,_0x53fb('0xe'),JSON[_0x53fb('0x11')](_0x5988f5));if(_0x5988f5[_0x53fb('0x12')]){if(_0x5988f5['error']['code']===0x1f4){logger[_0x53fb('0x12')]('Setting,\x20%s,\x20%s',_0x23bd82,_0x5988f5[_0x53fb('0x12')][_0x53fb('0x13')]);return _0x1a12a6(_0x5988f5[_0x53fb('0x12')][_0x53fb('0x13')]);}logger[_0x53fb('0x12')](_0x53fb('0xd'),_0x23bd82,_0x5988f5[_0x53fb('0x12')][_0x53fb('0x13')]);return _0x619f3f(_0x5988f5[_0x53fb('0x12')]['message']);}else{logger[_0x53fb('0xc')]('Setting,\x20%s,\x20%s',_0x23bd82,_0x53fb('0xe'));_0x619f3f(_0x5988f5[_0x53fb('0x14')][_0x53fb('0x13')]);}})['catch'](function(_0x2e25c0){logger['error'](_0x53fb('0xd'),_0x23bd82,_0x2e25c0);_0x1a12a6(_0x2e25c0);});});}exports[_0x53fb('0x15')]=function(_0x13bbe4){var _0x574419=this;return new Promise(function(_0x4d7f5b,_0x273174){return db[_0x53fb('0x16')]['find']({'raw':_0x13bbe4['options']?_0x13bbe4[_0x53fb('0x17')][_0x53fb('0x18')]===undefined?!![]:![]:!![],'where':_0x13bbe4[_0x53fb('0x17')]?_0x13bbe4[_0x53fb('0x17')]['where']||null:null,'attributes':_0x13bbe4['options']?_0x13bbe4['options'][_0x53fb('0x19')]||null:null,'include':_0x13bbe4[_0x53fb('0x17')]?_0x13bbe4['options'][_0x53fb('0x1a')]?_['map'](_0x13bbe4[_0x53fb('0x17')][_0x53fb('0x1a')],function(_0x5d3b65){return{'model':db[_0x5d3b65[_0x53fb('0x1b')]],'as':_0x5d3b65['as'],'attributes':_0x5d3b65[_0x53fb('0x19')],'include':_0x5d3b65['include']?_[_0x53fb('0x1c')](_0x5d3b65[_0x53fb('0x1a')],function(_0x2239cc){return{'model':db[_0x2239cc[_0x53fb('0x1b')]],'as':_0x2239cc['as'],'attributes':_0x2239cc[_0x53fb('0x19')],'include':_0x2239cc[_0x53fb('0x1a')]?_[_0x53fb('0x1c')](_0x2239cc['include'],function(_0x1c6442){return{'model':db[_0x1c6442[_0x53fb('0x1b')]],'as':_0x1c6442['as'],'attributes':_0x1c6442['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x32cd9b){logger[_0x53fb('0xc')](_0x53fb('0x15'),_0x13bbe4);logger['debug'](_0x53fb('0x15'),_0x13bbe4,JSON[_0x53fb('0x11')](_0x32cd9b));_0x4d7f5b(_0x32cd9b);})[_0x53fb('0x1d')](function(_0x3c54ee){logger[_0x53fb('0x12')]('ShowSetting',_0x3c54ee[_0x53fb('0x13')],_0x13bbe4);_0x273174(_0x574419[_0x53fb('0x12')](0x1f4,_0x3c54ee[_0x53fb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 4b7e236..2d737d8 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 _0x1cb9=['/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addAnswer','/:id/notify','notify','/:id/applications','/:id/send','/:id/status','status','addAgents','put','update','delete','destroy','removeDispositions','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3955e0,_0x12652a){_0x3955e0=_0x3955e0-0x0;var _0x30512e=_0x1cb9[_0x3955e0];return _0x30512e;};'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')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0x8')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x8')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x8')]('/:id/applications',auth[_0x91cb('0x9')](),controller[_0x91cb('0x13')]);router['get'](_0x91cb('0x14'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x15')]);router[_0x91cb('0x8')]('/:id/status',controller['statusGet']);router[_0x91cb('0x8')](_0x91cb('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0x91cb('0x17')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x18')]);router['post'](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller['addDisposition']);router[_0x91cb('0x17')](_0x91cb('0x11'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x19')]);router['post'](_0x91cb('0x1a'),controller[_0x91cb('0x1b')]);router['post'](_0x91cb('0x1c'),auth['isAuthenticated'](),controller['addApplications']);router[_0x91cb('0x17')](_0x91cb('0x1d'),auth['isAuthenticated'](),controller['send']);router['post'](_0x91cb('0x1e'),controller[_0x91cb('0x1f')]);router[_0x91cb('0x17')](_0x91cb('0x16'),auth['isAuthenticated'](),controller[_0x91cb('0x20')]);router[_0x91cb('0x21')](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0x22')]);router[_0x91cb('0x23')](_0x91cb('0xd'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x24')]);router[_0x91cb('0x23')](_0x91cb('0xf'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x25')]);router['delete']('/:id/canned_answers',auth[_0x91cb('0x9')](),controller['removeAnswers']);router[_0x91cb('0x23')](_0x91cb('0x16'),auth[_0x91cb('0x9')](),controller['removeAgents']);module[_0x91cb('0x26')]=router; \ No newline at end of file +var _0x326f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x309ad8,_0x3365a0){var _0x3114d4=function(_0x526e93){while(--_0x526e93){_0x309ad8['push'](_0x309ad8['shift']());}};_0x3114d4(++_0x3365a0);}(_0x326f,0xd1));var _0xf326=function(_0x59b98a,_0x353dae){_0x59b98a=_0x59b98a-0x0;var _0x479258=_0x326f[_0x59b98a];return _0x479258;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['get'](_0xf326('0x12'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x9')]('/:id/interactions',auth[_0xf326('0xa')](),controller[_0xf326('0x14')]);router[_0xf326('0x9')](_0xf326('0x15'),controller['statusGet']);router[_0xf326('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x16')]);router[_0xf326('0x17')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0x18')]);router[_0xf326('0x17')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0x19')]);router['post'](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x1a')]);router[_0xf326('0x17')](_0xf326('0x1b'),controller[_0xf326('0x1c')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xf326('0x1d')]);router[_0xf326('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0xf326('0x1e')]);router['post']('/:id/status',controller[_0xf326('0x1f')]);router[_0xf326('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x20')]);router[_0xf326('0x21')]('/:id',auth[_0xf326('0xa')](),controller[_0xf326('0x22')]);router[_0xf326('0x23')](_0xf326('0x24'),auth[_0xf326('0xa')](),controller[_0xf326('0x25')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf326('0x26')]);router[_0xf326('0x23')](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x27')]);router[_0xf326('0x23')]('/:id/users',auth[_0xf326('0xa')](),controller[_0xf326('0x28')]);module[_0xf326('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 58fde6f..fb2aec0 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 _0xa1dd=['infobip','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','generate','ENUM','twilio','skebby','plivo','bandwidth'];(function(_0x408342,_0x3e3ad7){var _0x46f252=function(_0x4c0c74){while(--_0x4c0c74){_0x408342['push'](_0x408342['shift']());}};_0x46f252(++_0x3e3ad7);}(_0xa1dd,0x107));var _0xda1d=function(_0x491f2c,_0x1f92cc){_0x491f2c=_0x491f2c-0x0;var _0x180dcf=_0xa1dd[_0x491f2c];return _0x180dcf;};'use strict';var Sequelize=require(_0xda1d('0x0'));var rs=require(_0xda1d('0x1'));module['exports']={'name':{'type':Sequelize[_0xda1d('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xda1d('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xda1d('0x2')],'defaultValue':function(){return rs[_0xda1d('0x3')]();}},'phone':{'type':Sequelize[_0xda1d('0x2')]},'type':{'type':Sequelize[_0xda1d('0x4')](_0xda1d('0x5'),_0xda1d('0x6'),'connectel','clicksend',_0xda1d('0x7'),'clickatell',_0xda1d('0x8'),'csc',_0xda1d('0x9'),'intelepeer')},'accountSid':{'type':Sequelize[_0xda1d('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xda1d('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xda1d('0x2')]},'apiKey':{'type':Sequelize[_0xda1d('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xda1d('0x2')]},'senderString':{'type':Sequelize[_0xda1d('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xda1d('0x2')]},'notificationTemplate':{'type':Sequelize[_0xda1d('0xa')],'defaultValue':function(){return _0xda1d('0xb');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xda1d('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xda1d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xda1d('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xda1d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xda1d('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xda1d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xda1d('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xda1d('0xd')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xda1d('0xc')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xf963e4){if(!_0xf963e4)this[_0xda1d('0xe')]('mandatoryDispositionPauseId',null);this[_0xda1d('0xe')](_0xda1d('0xf'),_0xf963e4);}}}; \ No newline at end of file +var _0xc67e=['clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','generate','ENUM','skebby','connectel','clicksend','plivo'];(function(_0x434b89,_0x17d347){var _0x20171e=function(_0x3e3d80){while(--_0x3e3d80){_0x434b89['push'](_0x434b89['shift']());}};_0x20171e(++_0x17d347);}(_0xc67e,0xc9));var _0xec67=function(_0x38cf85,_0x234c29){_0x38cf85=_0x38cf85-0x0;var _0x5a4c10=_0xc67e[_0x38cf85];return _0x5a4c10;};'use strict';var Sequelize=require(_0xec67('0x0'));var rs=require(_0xec67('0x1'));module['exports']={'name':{'type':Sequelize[_0xec67('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xec67('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xec67('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xec67('0x2')],'defaultValue':function(){return rs[_0xec67('0x3')]();}},'phone':{'type':Sequelize[_0xec67('0x2')]},'type':{'type':Sequelize[_0xec67('0x4')]('twilio',_0xec67('0x5'),_0xec67('0x6'),_0xec67('0x7'),_0xec67('0x8'),_0xec67('0x9'),_0xec67('0xa'),_0xec67('0xb'),_0xec67('0xc'),_0xec67('0xd'))},'accountSid':{'type':Sequelize[_0xec67('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xec67('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xec67('0x2')]},'apiKey':{'type':Sequelize[_0xec67('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xec67('0x2')]},'senderString':{'type':Sequelize[_0xec67('0x2')]},'deliveryReport':{'type':Sequelize[_0xec67('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xec67('0x2')]},'notificationTemplate':{'type':Sequelize[_0xec67('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xec67('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xec67('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xec67('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xec67('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xec67('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xec67('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xec67('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xec67('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xec67('0x11'),'set':function(_0x2cdfe9){if(!_0x2cdfe9)this[_0xec67('0x12')](_0xec67('0x13'),null);this[_0xec67('0x12')](_0xec67('0x14'),_0x2cdfe9);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index ebd6f42..51c2830 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 _0x4a1d=['localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','end','stack','name','index','Pause','SmsAccount','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','mandatoryDispositionPause','addDisposition','SmsAccountId','getDispositions','findOne','nolimit','Disposition','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','notify','SmsApplication','Applications','account','applications','orderBy','priority','asc','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile','twilio','from','From','MessageSid','sender','connectel','messageId','message_id','plivo','Text','MessageUUID','infobip','results','text','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','includes','mapKey','CmList','ListId','DESC','omit','Contacts','defaults','CmContact','SmsInteraction','spread','interaction','push','close','unmanaged','*,*,*,*','created','SmsMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','send','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','Contact','Owner','fullname','Tag','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','redif','skebby','DELIVERED','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis'];(function(_0x587697,_0x5d9020){var _0x2fc9f9=function(_0x148c14){while(--_0x148c14){_0x587697['push'](_0x587697['shift']());}};_0x2fc9f9(++_0x5d9020);}(_0x4a1d,0xc8));var _0xd4a1=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x4a1d[_0x1d24eb];return _0x1dc576;};'use strict';var emlformat=require(_0xd4a1('0x0'));var rimraf=require(_0xd4a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd4a1('0x2'));var moment=require(_0xd4a1('0x3'));var BPromise=require(_0xd4a1('0x4'));var Mustache=require('mustache');var util=require(_0xd4a1('0x5'));var path=require(_0xd4a1('0x6'));var sox=require(_0xd4a1('0x7'));var csv=require(_0xd4a1('0x8'));var ejs=require(_0xd4a1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd4a1('0xa'));var crypto=require(_0xd4a1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd4a1('0xc'));var toCsv=require(_0xd4a1('0x8'));var querystring=require(_0xd4a1('0xd'));var Papa=require(_0xd4a1('0xe'));var Redis=require(_0xd4a1('0xf'));var authService=require(_0xd4a1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd4a1('0x11'));var hardwareService=require(_0xd4a1('0x12'));var logger=require('../../config/logger')(_0xd4a1('0x13'));var utils=require(_0xd4a1('0x14'));var config=require(_0xd4a1('0x15'));var licenseUtil=require(_0xd4a1('0x16'));var db=require('../../mysqldb')['db'];config[_0xd4a1('0x17')]=_['defaults'](config[_0xd4a1('0x17')],{'host':_0xd4a1('0x18'),'port':0x18eb});var socket=require(_0xd4a1('0x19'))(new Redis(config[_0xd4a1('0x17')]));require(_0xd4a1('0x1a'))[_0xd4a1('0x1b')](socket);var jayson=require(_0xd4a1('0x1c'));var client=jayson['client'][_0xd4a1('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0xc8d105,_0xe68b1e,_0x3a2605,_0x4d74ab){return new BPromise(function(_0x11b129,_0x7d5b42){var _0x4f37a6=_0x4d74ab||client;return _0x4f37a6['request'](_0xc8d105,_0x3a2605)[_0xd4a1('0x1e')](function(_0x2025f0){logger[_0xd4a1('0x1f')](_0xd4a1('0x20'),_0xe68b1e,_0xd4a1('0x21'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe68b1e,_0xd4a1('0x21'),JSON[_0xd4a1('0x22')](_0x2025f0));if(_0x2025f0['error']){if(_0x2025f0[_0xd4a1('0x23')][_0xd4a1('0x24')]===0x1f4){logger[_0xd4a1('0x23')](_0xd4a1('0x20'),_0xe68b1e,_0x2025f0['error'][_0xd4a1('0x25')]);return _0x7d5b42(_0x2025f0['error'][_0xd4a1('0x25')]);}logger[_0xd4a1('0x23')]('SmsAccount,\x20%s,\x20%s',_0xe68b1e,_0x2025f0['error'][_0xd4a1('0x25')]);return _0x11b129(_0x2025f0['error'][_0xd4a1('0x25')]);}else{logger[_0xd4a1('0x1f')](_0xd4a1('0x20'),_0xe68b1e,_0xd4a1('0x21'));_0x11b129(_0x2025f0['result'][_0xd4a1('0x25')]);}})['catch'](function(_0x19759a){logger['error']('SmsAccount,\x20%s,\x20%s',_0xe68b1e,_0x19759a);_0x7d5b42(_0x19759a);});});}function respondWithStatusCode(_0x1afa0f,_0x27bfb3){_0x27bfb3=_0x27bfb3||0xcc;return function(_0x560c60){if(_0x560c60){return _0x1afa0f[_0xd4a1('0x26')](_0x27bfb3);}return _0x1afa0f[_0xd4a1('0x27')](_0x27bfb3)['end']();};}function respondWithResult(_0x344c7f,_0x398cbb){_0x398cbb=_0x398cbb||0xc8;return function(_0xdcca3d){if(_0xdcca3d){return _0x344c7f[_0xd4a1('0x27')](_0x398cbb)[_0xd4a1('0x28')](_0xdcca3d);}};}function respondWithFilteredResult(_0x18bc93,_0x1d369c){return function(_0x4ded4){if(_0x4ded4){var _0x462a84=typeof _0x1d369c[_0xd4a1('0x29')]===_0xd4a1('0x2a')&&typeof _0x1d369c['limit']===_0xd4a1('0x2a');var _0x40fcf8=_0x4ded4['count'];var _0x20bad8=_0x462a84?0x0:_0x1d369c['offset'];var _0x500f7f=_0x462a84?_0x4ded4[_0xd4a1('0x2b')]:_0x1d369c[_0xd4a1('0x29')]+_0x1d369c['limit'];var _0x3dde37;if(_0x500f7f>=_0x40fcf8){_0x500f7f=_0x40fcf8;_0x3dde37=0xc8;}else{_0x3dde37=0xce;}_0x18bc93[_0xd4a1('0x27')](_0x3dde37);return _0x18bc93[_0xd4a1('0x2c')](_0xd4a1('0x2d'),_0x20bad8+'-'+_0x500f7f+'/'+_0x40fcf8)[_0xd4a1('0x28')](_0x4ded4);}return null;};}function patchUpdates(_0x3df1ee){return function(_0x10485c){try{jsonpatch[_0xd4a1('0x2e')](_0x10485c,_0x3df1ee,!![]);}catch(_0x22b3e9){return BPromise[_0xd4a1('0x2f')](_0x22b3e9);}return _0x10485c[_0xd4a1('0x30')]();};}function saveUpdates(_0x244dd4,_0x541fd8){return function(_0x184bdf){if(_0x184bdf){return _0x184bdf[_0xd4a1('0x31')](_0x244dd4)[_0xd4a1('0x1e')](function(_0x372c9a){return _0x372c9a;});}return null;};}function removeEntity(_0x1a7349,_0x325f05){return function(_0x44f02c){if(_0x44f02c){return _0x44f02c[_0xd4a1('0x32')]()[_0xd4a1('0x1e')](function(){var _0xb1f6aa=_0x44f02c[_0xd4a1('0x33')]({'plain':!![]});var _0x5f4f5c='SmsAccounts';return db[_0xd4a1('0x34')][_0xd4a1('0x32')]({'where':{'type':_0x5f4f5c,'resourceId':_0xb1f6aa['id']}})[_0xd4a1('0x1e')](function(){return _0x44f02c;});})[_0xd4a1('0x1e')](function(){_0x1a7349[_0xd4a1('0x27')](0xcc)[_0xd4a1('0x35')]();});}};}function handleEntityNotFound(_0xd9e37e,_0x337007){return function(_0x39dfa8){if(!_0x39dfa8){_0xd9e37e[_0xd4a1('0x26')](0x194);}return _0x39dfa8;};}function handleError(_0x53e474,_0x19f375){_0x19f375=_0x19f375||0x1f4;return function(_0x53fb1b){logger[_0xd4a1('0x23')](_0x53fb1b[_0xd4a1('0x36')]);if(_0x53fb1b['name']){delete _0x53fb1b[_0xd4a1('0x37')];}_0x53e474[_0xd4a1('0x27')](_0x19f375)['send'](_0x53fb1b);};}exports[_0xd4a1('0x38')]=function(_0x568aee,_0x1f644b){var _0x9b4819={'include':[{'model':db[_0xd4a1('0x39')],'as':'mandatoryDispositionPause'}]},_0x543feb={},_0x1ccaac={'count':0x0,'rows':[]};var _0x55a820=_['map'](db[_0xd4a1('0x3a')]['rawAttributes'],function(_0x588e1e){return{'name':_0x588e1e['fieldName'],'type':_0x588e1e[_0xd4a1('0x3b')][_0xd4a1('0x3c')]};});_0x543feb[_0xd4a1('0x3d')]=_[_0xd4a1('0x3e')](_0x55a820,'name');_0x543feb['query']=_[_0xd4a1('0x3f')](_0x568aee[_0xd4a1('0x40')]);_0x543feb[_0xd4a1('0x41')]=_[_0xd4a1('0x42')](_0x543feb['model'],_0x543feb[_0xd4a1('0x40')]);_0x9b4819[_0xd4a1('0x43')]=_[_0xd4a1('0x42')](_0x543feb[_0xd4a1('0x3d')],qs[_0xd4a1('0x44')](_0x568aee[_0xd4a1('0x40')][_0xd4a1('0x44')]));_0x9b4819[_0xd4a1('0x43')]=_0x9b4819[_0xd4a1('0x43')][_0xd4a1('0x45')]?_0x9b4819[_0xd4a1('0x43')]:_0x543feb[_0xd4a1('0x3d')];if(!_0x568aee['query'][_0xd4a1('0x46')]('nolimit')){_0x9b4819[_0xd4a1('0x47')]=qs[_0xd4a1('0x47')](_0x568aee['query']['limit']);_0x9b4819[_0xd4a1('0x29')]=qs[_0xd4a1('0x29')](_0x568aee[_0xd4a1('0x40')]['offset']);}_0x9b4819[_0xd4a1('0x48')]=qs[_0xd4a1('0x49')](_0x568aee[_0xd4a1('0x40')][_0xd4a1('0x49')]);_0x9b4819[_0xd4a1('0x4a')]=qs[_0xd4a1('0x41')](_[_0xd4a1('0x4b')](_0x568aee[_0xd4a1('0x40')],_0x543feb[_0xd4a1('0x41')]),_0x55a820);if(_0x568aee[_0xd4a1('0x40')][_0xd4a1('0x4c')]){_0x9b4819['where']=_[_0xd4a1('0x4d')](_0x9b4819[_0xd4a1('0x4a')],{'$or':_[_0xd4a1('0x3e')](_0x55a820,function(_0x57e390){if(_0x57e390[_0xd4a1('0x3b')]!=='VIRTUAL'){var _0x5aedb5={};_0x5aedb5[_0x57e390[_0xd4a1('0x37')]]={'$like':'%'+_0x568aee[_0xd4a1('0x40')][_0xd4a1('0x4c')]+'%'};return _0x5aedb5;}})});}_0x9b4819=_['merge']({},_0x9b4819,_0x568aee[_0xd4a1('0x4e')]);var _0x567bcd={'where':_0x9b4819[_0xd4a1('0x4a')]};return db[_0xd4a1('0x3a')]['count'](_0x567bcd)[_0xd4a1('0x1e')](function(_0x26ea6f){_0x1ccaac[_0xd4a1('0x2b')]=_0x26ea6f;if(_0x568aee[_0xd4a1('0x40')][_0xd4a1('0x4f')]){_0x9b4819['include']=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x9b4819);})['then'](function(_0x13a204){_0x1ccaac[_0xd4a1('0x50')]=_0x13a204;return _0x1ccaac;})['then'](respondWithFilteredResult(_0x1f644b,_0x9b4819))[_0xd4a1('0x51')](handleError(_0x1f644b,null));};exports[_0xd4a1('0x52')]=function(_0x5abb6f,_0x532882){var _0x25cbf4={'raw':![],'where':{'id':_0x5abb6f[_0xd4a1('0x53')]['id']},'include':[{'model':db[_0xd4a1('0x39')],'as':'mandatoryDispositionPause'}]},_0x10a3b3={};_0x10a3b3[_0xd4a1('0x3d')]=_['keys'](db[_0xd4a1('0x3a')][_0xd4a1('0x54')]);_0x10a3b3['query']=_['keys'](_0x5abb6f['query']);_0x10a3b3[_0xd4a1('0x41')]=_[_0xd4a1('0x42')](_0x10a3b3[_0xd4a1('0x3d')],_0x10a3b3[_0xd4a1('0x40')]);_0x25cbf4['attributes']=_[_0xd4a1('0x42')](_0x10a3b3[_0xd4a1('0x3d')],qs[_0xd4a1('0x44')](_0x5abb6f[_0xd4a1('0x40')][_0xd4a1('0x44')]));_0x25cbf4['attributes']=_0x25cbf4['attributes']['length']?_0x25cbf4['attributes']:_0x10a3b3[_0xd4a1('0x3d')];if(_0x5abb6f[_0xd4a1('0x40')][_0xd4a1('0x4f')]){_0x25cbf4['include']=[{'all':!![]}];}_0x25cbf4=_['merge']({},_0x25cbf4,_0x5abb6f[_0xd4a1('0x4e')]);return db['SmsAccount'][_0xd4a1('0x55')](_0x25cbf4)[_0xd4a1('0x1e')](handleEntityNotFound(_0x532882,null))[_0xd4a1('0x1e')](respondWithResult(_0x532882,null))[_0xd4a1('0x51')](handleError(_0x532882,null));};exports[_0xd4a1('0x56')]=function(_0x378aa9,_0x2a74fd){return db[_0xd4a1('0x3a')][_0xd4a1('0x56')](_0x378aa9[_0xd4a1('0x57')],{})[_0xd4a1('0x1e')](function(_0x181aaa){var _0x371682=_0x378aa9['user'][_0xd4a1('0x33')]({'plain':!![]});if(!_0x371682)throw new Error(_0xd4a1('0x58'));if(_0x371682['role']===_0xd4a1('0x59')){var _0x5f276b=_0x181aaa[_0xd4a1('0x33')]({'plain':!![]});var _0x269bc1=_0xd4a1('0x5a');return db[_0xd4a1('0x5b')][_0xd4a1('0x55')]({'where':{'name':_0x269bc1,'userProfileId':_0x371682[_0xd4a1('0x5c')]},'raw':!![]})[_0xd4a1('0x1e')](function(_0x4b29b7){if(_0x4b29b7&&_0x4b29b7[_0xd4a1('0x5d')]===0x0){return db[_0xd4a1('0x34')][_0xd4a1('0x56')]({'name':_0x5f276b['name'],'resourceId':_0x5f276b['id'],'type':_0x4b29b7[_0xd4a1('0x37')],'sectionId':_0x4b29b7['id']},{})['then'](function(){return _0x181aaa;});}else{return _0x181aaa;}})[_0xd4a1('0x51')](function(_0x448cb4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x448cb4);throw _0x448cb4;});}return _0x181aaa;})[_0xd4a1('0x1e')](respondWithResult(_0x2a74fd,0xc9))[_0xd4a1('0x51')](handleError(_0x2a74fd,null));};exports[_0xd4a1('0x31')]=function(_0x2d5ea6,_0x3e3d0f){if(_0x2d5ea6[_0xd4a1('0x57')]['id']){delete _0x2d5ea6['body']['id'];}return db[_0xd4a1('0x3a')][_0xd4a1('0x55')]({'where':{'id':_0x2d5ea6[_0xd4a1('0x53')]['id']},'include':[{'model':db[_0xd4a1('0x39')],'as':_0xd4a1('0x5e')}]})[_0xd4a1('0x1e')](handleEntityNotFound(_0x3e3d0f,null))['then'](saveUpdates(_0x2d5ea6[_0xd4a1('0x57')],null))[_0xd4a1('0x1e')](respondWithResult(_0x3e3d0f,null))[_0xd4a1('0x51')](handleError(_0x3e3d0f,null));};exports['destroy']=function(_0x4708ca,_0x28747d){return db[_0xd4a1('0x3a')][_0xd4a1('0x55')]({'where':{'id':_0x4708ca[_0xd4a1('0x53')]['id']}})[_0xd4a1('0x1e')](handleEntityNotFound(_0x28747d,null))['then'](removeEntity(_0x28747d,null))[_0xd4a1('0x51')](handleError(_0x28747d,null));};exports['describe']=function(_0x1cf688,_0x50e004){return db[_0xd4a1('0x3a')]['describe']()[_0xd4a1('0x1e')](respondWithResult(_0x50e004,null))['catch'](handleError(_0x50e004,null));};exports[_0xd4a1('0x5f')]=function(_0x556e36,_0x37adba,_0x556e5d){if(_0x556e36[_0xd4a1('0x57')]['id']){delete _0x556e36[_0xd4a1('0x57')]['id'];}return db[_0xd4a1('0x3a')][_0xd4a1('0x55')]({'where':{'id':_0x556e36[_0xd4a1('0x53')]['id']}})['then'](handleEntityNotFound(_0x37adba,null))['then'](function(_0x4db599){if(_0x4db599){_0x556e36['body'][_0xd4a1('0x60')]=_0x4db599['id'];return db['Disposition'][_0xd4a1('0x56')](_0x556e36[_0xd4a1('0x57')]);}})['then'](respondWithResult(_0x37adba,null))[_0xd4a1('0x51')](handleError(_0x37adba,null));};exports[_0xd4a1('0x61')]=function(_0x437a78,_0x93204,_0x484846){var _0x2d5b96={'raw':![],'where':{}};var _0x5279e7={};var _0x29788a={'count':0x0,'rows':[]};return db[_0xd4a1('0x3a')][_0xd4a1('0x62')]({'where':{'id':_0x437a78[_0xd4a1('0x53')]['id']}})[_0xd4a1('0x1e')](handleEntityNotFound(_0x93204,null))[_0xd4a1('0x1e')](function(_0x130fa6){if(_0x130fa6){_0x5279e7[_0xd4a1('0x3d')]=_[_0xd4a1('0x3f')](db['Disposition'][_0xd4a1('0x54')]);_0x5279e7[_0xd4a1('0x40')]=_[_0xd4a1('0x3f')](_0x437a78[_0xd4a1('0x40')]);_0x5279e7[_0xd4a1('0x41')]=_[_0xd4a1('0x42')](_0x5279e7['model'],_0x5279e7[_0xd4a1('0x40')]);_0x2d5b96[_0xd4a1('0x43')]=_[_0xd4a1('0x42')](_0x5279e7['model'],qs[_0xd4a1('0x44')](_0x437a78[_0xd4a1('0x40')][_0xd4a1('0x44')]));_0x2d5b96[_0xd4a1('0x43')]=_0x2d5b96[_0xd4a1('0x43')][_0xd4a1('0x45')]?_0x2d5b96[_0xd4a1('0x43')]:_0x5279e7[_0xd4a1('0x3d')];if(!_0x437a78[_0xd4a1('0x40')][_0xd4a1('0x46')](_0xd4a1('0x63'))){_0x2d5b96[_0xd4a1('0x47')]=qs[_0xd4a1('0x47')](_0x437a78[_0xd4a1('0x40')][_0xd4a1('0x47')]);_0x2d5b96['offset']=qs[_0xd4a1('0x29')](_0x437a78[_0xd4a1('0x40')][_0xd4a1('0x29')]);}_0x2d5b96['order']=qs[_0xd4a1('0x49')](_0x437a78[_0xd4a1('0x40')][_0xd4a1('0x49')]);_0x2d5b96[_0xd4a1('0x4a')]=qs[_0xd4a1('0x41')](_['pick'](_0x437a78[_0xd4a1('0x40')],_0x5279e7['filters']));_0x2d5b96[_0xd4a1('0x4a')][_0xd4a1('0x60')]=_0x130fa6['id'];if(_0x437a78['query'][_0xd4a1('0x4c')]){_0x2d5b96[_0xd4a1('0x4a')]=_[_0xd4a1('0x4d')](_0x2d5b96[_0xd4a1('0x4a')],{'$or':_[_0xd4a1('0x3e')](_0x2d5b96['attributes'],function(_0x28355a){var _0x1e0a1d={};_0x1e0a1d[_0x28355a]={'$like':'%'+_0x437a78[_0xd4a1('0x40')][_0xd4a1('0x4c')]+'%'};return _0x1e0a1d;})});}_0x2d5b96=_[_0xd4a1('0x4d')]({},_0x2d5b96,_0x437a78[_0xd4a1('0x4e')]);return db[_0xd4a1('0x64')]['count']({'where':_0x2d5b96[_0xd4a1('0x4a')]})[_0xd4a1('0x1e')](function(_0x1b8f9f){_0x29788a[_0xd4a1('0x2b')]=_0x1b8f9f;if(_0x437a78['query'][_0xd4a1('0x4f')]){_0x2d5b96[_0xd4a1('0x65')]=[{'all':!![]}];}return db['Disposition'][_0xd4a1('0x66')](_0x2d5b96);})[_0xd4a1('0x1e')](function(_0x18023c){_0x29788a[_0xd4a1('0x50')]=_0x18023c;return _0x29788a;});}})[_0xd4a1('0x1e')](respondWithFilteredResult(_0x93204,_0x2d5b96))['catch'](handleError(_0x93204,null));};exports[_0xd4a1('0x67')]=function(_0x1949bf,_0x418c29,_0x5ddec7){return db['SmsAccount'][_0xd4a1('0x55')]({'where':{'id':_0x1949bf[_0xd4a1('0x53')]['id']}})[_0xd4a1('0x1e')](handleEntityNotFound(_0x418c29,null))[_0xd4a1('0x1e')](function(_0x41ccdf){if(_0x41ccdf){return _0x41ccdf[_0xd4a1('0x67')](_0x1949bf[_0xd4a1('0x40')][_0xd4a1('0x68')]);}})['then'](respondWithStatusCode(_0x418c29,null))[_0xd4a1('0x51')](handleError(_0x418c29,null));};exports[_0xd4a1('0x69')]=function(_0x5ab049,_0x4d0f55,_0x10da70){if(_0x5ab049[_0xd4a1('0x57')]['id']){delete _0x5ab049[_0xd4a1('0x57')]['id'];}return db[_0xd4a1('0x3a')][_0xd4a1('0x55')]({'where':{'id':_0x5ab049[_0xd4a1('0x53')]['id']}})[_0xd4a1('0x1e')](handleEntityNotFound(_0x4d0f55,null))['then'](function(_0x218f86){if(_0x218f86){_0x5ab049[_0xd4a1('0x57')][_0xd4a1('0x60')]=_0x218f86['id'];return db[_0xd4a1('0x6a')][_0xd4a1('0x56')](_0x5ab049['body']);}})['then'](respondWithResult(_0x4d0f55,null))['catch'](handleError(_0x4d0f55,null));};exports[_0xd4a1('0x6b')]=function(_0x5f1377,_0xe71de3,_0x4e7d8d){var _0x5688e8={'raw':![],'where':{}};var _0x2a8171={};var _0x3915d2={'count':0x0,'rows':[]};return db[_0xd4a1('0x3a')][_0xd4a1('0x62')]({'where':{'id':_0x5f1377['params']['id']}})[_0xd4a1('0x1e')](handleEntityNotFound(_0xe71de3,null))[_0xd4a1('0x1e')](function(_0x28d82b){if(_0x28d82b){_0x2a8171[_0xd4a1('0x3d')]=_[_0xd4a1('0x3f')](db[_0xd4a1('0x6a')][_0xd4a1('0x54')]);_0x2a8171[_0xd4a1('0x40')]=_[_0xd4a1('0x3f')](_0x5f1377[_0xd4a1('0x40')]);_0x2a8171[_0xd4a1('0x41')]=_[_0xd4a1('0x42')](_0x2a8171[_0xd4a1('0x3d')],_0x2a8171[_0xd4a1('0x40')]);_0x5688e8[_0xd4a1('0x43')]=_[_0xd4a1('0x42')](_0x2a8171[_0xd4a1('0x3d')],qs[_0xd4a1('0x44')](_0x5f1377[_0xd4a1('0x40')][_0xd4a1('0x44')]));_0x5688e8['attributes']=_0x5688e8['attributes'][_0xd4a1('0x45')]?_0x5688e8['attributes']:_0x2a8171[_0xd4a1('0x3d')];if(!_0x5f1377[_0xd4a1('0x40')][_0xd4a1('0x46')](_0xd4a1('0x63'))){_0x5688e8[_0xd4a1('0x47')]=qs[_0xd4a1('0x47')](_0x5f1377[_0xd4a1('0x40')][_0xd4a1('0x47')]);_0x5688e8[_0xd4a1('0x29')]=qs['offset'](_0x5f1377[_0xd4a1('0x40')][_0xd4a1('0x29')]);}_0x5688e8[_0xd4a1('0x48')]=qs[_0xd4a1('0x49')](_0x5f1377['query'][_0xd4a1('0x49')]);_0x5688e8[_0xd4a1('0x4a')]=qs['filters'](_[_0xd4a1('0x4b')](_0x5f1377[_0xd4a1('0x40')],_0x2a8171[_0xd4a1('0x41')]));_0x5688e8[_0xd4a1('0x4a')][_0xd4a1('0x60')]=_0x28d82b['id'];if(_0x5f1377[_0xd4a1('0x40')]['filter']){_0x5688e8['where']=_[_0xd4a1('0x4d')](_0x5688e8[_0xd4a1('0x4a')],{'$or':_[_0xd4a1('0x3e')](_0x5688e8[_0xd4a1('0x43')],function(_0x1f7823){var _0x3cf51a={};_0x3cf51a[_0x1f7823]={'$like':'%'+_0x5f1377['query']['filter']+'%'};return _0x3cf51a;})});}_0x5688e8=_[_0xd4a1('0x4d')]({},_0x5688e8,_0x5f1377[_0xd4a1('0x4e')]);return db[_0xd4a1('0x6a')]['count']({'where':_0x5688e8['where']})['then'](function(_0x28b814){_0x3915d2['count']=_0x28b814;if(_0x5f1377[_0xd4a1('0x40')][_0xd4a1('0x4f')]){_0x5688e8['include']=[{'all':!![]}];}return db[_0xd4a1('0x6a')][_0xd4a1('0x66')](_0x5688e8);})['then'](function(_0x1e4d21){_0x3915d2[_0xd4a1('0x50')]=_0x1e4d21;return _0x3915d2;});}})[_0xd4a1('0x1e')](respondWithFilteredResult(_0xe71de3,_0x5688e8))[_0xd4a1('0x51')](handleError(_0xe71de3,null));};exports['removeAnswers']=function(_0x2193fc,_0x295903,_0xbccb73){return db[_0xd4a1('0x3a')][_0xd4a1('0x55')]({'where':{'id':_0x2193fc[_0xd4a1('0x53')]['id']}})[_0xd4a1('0x1e')](handleEntityNotFound(_0x295903,null))['then'](function(_0x26f057){if(_0x26f057){return _0x26f057['removeAnswers'](_0x2193fc[_0xd4a1('0x40')][_0xd4a1('0x68')]);}})['then'](respondWithStatusCode(_0x295903,null))[_0xd4a1('0x51')](handleError(_0x295903,null));};exports[_0xd4a1('0x6c')]=function(_0x15e299,_0x515a7b,_0x3cdf83){var _0x17afec={'channel':'sms'};var _0x2cee5e=[];var _0x9c6c74=[];var _0x9d34e9={};return db[_0xd4a1('0x3a')]['find']({'where':{'id':_0x15e299[_0xd4a1('0x53')]['id']},'include':[{'model':db[_0xd4a1('0x6d')],'as':_0xd4a1('0x6e')}]})[_0xd4a1('0x1e')](handleEntityNotFound(_0x515a7b,null))[_0xd4a1('0x1e')](function(_0x171dee){_0x17afec[_0xd4a1('0x6f')]=_0x171dee;_0x17afec[_0xd4a1('0x70')]=_[_0xd4a1('0x71')](_0x171dee[_0xd4a1('0x6e')],[_0xd4a1('0x72')],[_0xd4a1('0x73')]);if(_0x17afec[_0xd4a1('0x6f')][_0xd4a1('0x6e')]){delete _0x17afec[_0xd4a1('0x6f')][_0xd4a1('0x6e')];}return db['CmContact'][_0xd4a1('0x74')]();})[_0xd4a1('0x1e')](function(_0x4d9dbd){if(!_0x4d9dbd){throw new db[(_0xd4a1('0x75'))][(_0xd4a1('0x76'))](_0xd4a1('0x77'));}_0x2cee5e=_[_0xd4a1('0x78')](_[_0xd4a1('0x3f')](_0x4d9dbd),[_0xd4a1('0x79'),_0xd4a1('0x7a')]);_0x9c6c74=_[_0xd4a1('0x78')](_[_0xd4a1('0x3f')](_0x4d9dbd),[_0xd4a1('0x79'),_0xd4a1('0x7a'),'CompanyId','ListId']);_0x17afec[_0xd4a1('0x57')]={'mapKey':_0xd4a1('0x7b')};if(_0x17afec[_0xd4a1('0x6f')][_0xd4a1('0x3b')]){switch(_0x17afec[_0xd4a1('0x6f')][_0xd4a1('0x3b')]){case _0xd4a1('0x7c'):_0x17afec['body'][_0xd4a1('0x7d')]=_0x15e299[_0xd4a1('0x57')][_0xd4a1('0x7e')];_0x17afec['body'][_0xd4a1('0x57')]=_0x15e299[_0xd4a1('0x57')]['Body'];_0x17afec['body']['messageId']=_0x15e299['body'][_0xd4a1('0x7f')];break;case'skebby':_0x17afec[_0xd4a1('0x57')]['from']='+'+_0x15e299[_0xd4a1('0x57')][_0xd4a1('0x80')];_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x57')]=_0x15e299[_0xd4a1('0x57')]['text'];break;case _0xd4a1('0x81'):_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x7d')]=_0x15e299[_0xd4a1('0x57')][_0xd4a1('0x7d')];_0x17afec['body'][_0xd4a1('0x57')]=_0x15e299[_0xd4a1('0x57')][_0xd4a1('0x25')];break;case'clicksend':_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x7d')]=_0x15e299[_0xd4a1('0x57')][_0xd4a1('0x7d')];_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x57')]=_0x15e299[_0xd4a1('0x57')][_0xd4a1('0x57')];_0x17afec['body'][_0xd4a1('0x82')]=_0x15e299[_0xd4a1('0x57')][_0xd4a1('0x83')];break;case _0xd4a1('0x84'):_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x7d')]=_0x15e299[_0xd4a1('0x57')][_0xd4a1('0x7e')];_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x57')]=_0x15e299[_0xd4a1('0x57')][_0xd4a1('0x85')];_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x82')]=_0x15e299[_0xd4a1('0x57')][_0xd4a1('0x86')];break;case _0xd4a1('0x87'):_0x17afec['body'][_0xd4a1('0x7d')]='+'+_0x15e299['body'][_0xd4a1('0x88')][0x0][_0xd4a1('0x7d')];_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x57')]=_0x15e299[_0xd4a1('0x57')][_0xd4a1('0x88')][0x0][_0xd4a1('0x89')];_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x82')]=_0x15e299['body'][_0xd4a1('0x88')][0x0][_0xd4a1('0x82')];break;case _0xd4a1('0x8a'):_0x17afec[_0xd4a1('0x57')]['from']=_0x15e299[_0xd4a1('0x57')][_0xd4a1('0x8b')];_0x17afec['body'][_0xd4a1('0x57')]=_0x15e299[_0xd4a1('0x57')][_0xd4a1('0x8c')][_0xd4a1('0x25')];break;case _0xd4a1('0x8d'):_0x17afec['body'][_0xd4a1('0x7d')]=_0x15e299['body'][_0xd4a1('0x8e')];_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x57')]=_0x15e299['body'][_0xd4a1('0x89')];_0x17afec['body'][_0xd4a1('0x82')]=_0x15e299['body'][_0xd4a1('0x8f')];break;case _0xd4a1('0x90'):_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x82')]=_0x15e299[_0xd4a1('0x57')][0x0][_0xd4a1('0x25')]['id'];_0x17afec['body'][_0xd4a1('0x7d')]=_0x15e299[_0xd4a1('0x57')][0x0][_0xd4a1('0x25')][_0xd4a1('0x7d')];_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x57')]=_0x15e299['body'][0x0][_0xd4a1('0x25')][_0xd4a1('0x89')];break;case _0xd4a1('0x91'):_0x17afec['body'][_0xd4a1('0x7d')]=_0x15e299['body'][_0xd4a1('0x7d')];_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x57')]=_0x15e299[_0xd4a1('0x57')]['message'];_0x17afec['body'][_0xd4a1('0x82')]=_0x15e299['body'][_0xd4a1('0x92')];break;}}if(_0x17afec[_0xd4a1('0x57')]['id']){delete _0x17afec[_0xd4a1('0x57')]['id'];}if(_['isNil'](_0x17afec[_0xd4a1('0x57')]['from'])){throw new db[(_0xd4a1('0x75'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x57')])||_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x57')]===''){throw new db[(_0xd4a1('0x75'))][(_0xd4a1('0x76'))](_0xd4a1('0x93'));}if(_[_0xd4a1('0x94')](_0x17afec['body']['mapKey'])){throw new db['Sequelize'][(_0xd4a1('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x9c6c74);}if(!_[_0xd4a1('0x95')](_0x9c6c74,_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x96')])){throw new db[(_0xd4a1('0x75'))][(_0xd4a1('0x76'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x9c6c74);}_0x9d34e9[_0x17afec['body'][_0xd4a1('0x96')]]=_0x17afec['body'][_0xd4a1('0x7d')];return db[_0xd4a1('0x97')][_0xd4a1('0x55')]({'where':{'id':_0x17afec[_0xd4a1('0x6f')][_0xd4a1('0x98')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x9d34e9,'limit':0x1,'order':[[_0xd4a1('0x7a'),_0xd4a1('0x99')]]}]});})[_0xd4a1('0x1e')](handleEntityNotFound(_0x515a7b,null))[_0xd4a1('0x1e')](function(_0x2b03bc){if(_0x2b03bc){_0x17afec['list']=_[_0xd4a1('0x9a')](_0x2b03bc,[_0xd4a1('0x9b')]);if(_0x2b03bc[_0xd4a1('0x9b')][_0xd4a1('0x45')]){return _0x2b03bc[_0xd4a1('0x9b')][0x0];}var _0x3d0a12=_[_0xd4a1('0x9c')](_0x17afec[_0xd4a1('0x57')],{'firstName':_0x17afec['body']['from'],'ListId':_0x2b03bc['id']});_0x3d0a12[_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x96')]]=_0x17afec[_0xd4a1('0x57')]['from'];return db[_0xd4a1('0x9d')][_0xd4a1('0x56')](_0x3d0a12,{'fields':_0x2cee5e,'raw':!![]});}})['then'](handleEntityNotFound(_0x515a7b,null))[_0xd4a1('0x1e')](function(_0x380ab9){if(_0x380ab9){_0x17afec['contact']=_0x380ab9;var _0x2cd5d4={'ContactId':_0x380ab9['id'],'phone':_0x17afec[_0xd4a1('0x57')]['from'],'SmsAccountId':_0x15e299['params']['id']};var _0x15a4bc={'ContactId':_0x380ab9['id'],'SmsAccountId':_0x15e299['params']['id'],'closed':![]};return db[_0xd4a1('0x9e')][_0xd4a1('0x55')]({'where':_0x15a4bc})['then'](function(_0xe1efd6){if(_0xe1efd6){return[_0xe1efd6,![]];}return db[_0xd4a1('0x9e')][_0xd4a1('0x56')](_0x2cd5d4)['then'](function(_0x45ec07){return[_0x45ec07,!![]];});});}})[_0xd4a1('0x9f')](function(_0x2cca29,_0x23a1a3){_0x17afec['interaction']=_0x2cca29[_0xd4a1('0x33')]({'plain':!![]});_0x17afec[_0xd4a1('0xa0')]['created']=![];if(_0x23a1a3){if(_0x17afec[_0xd4a1('0x6f')]['autoclose']){_0x17afec[_0xd4a1('0x70')][_0xd4a1('0xa1')]({'id':0x0,'priority':_0x17afec[_0xd4a1('0x70')][_0xd4a1('0x45')]+0x1,'app':_0xd4a1('0xa2'),'appdata':_0xd4a1('0xa3'),'interval':_0xd4a1('0xa4')});}_0x17afec[_0xd4a1('0xa0')][_0xd4a1('0xa5')]=!![];}return db[_0xd4a1('0xa6')]['create']({'phone':_0x17afec['body']['from'],'messageId':_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x82')],'body':_0x17afec[_0xd4a1('0x57')][_0xd4a1('0x57')],'SmsAccountId':_0x15e299[_0xd4a1('0x53')]['id'],'SmsInteractionId':_0x2cca29['id'],'direction':'in','ContactId':_0x2cca29['ContactId'],'AttachmentId':_0x17afec[_0xd4a1('0x57')][_0xd4a1('0xa7')]});})[_0xd4a1('0x1e')](function(_0x4ba938){_0x17afec[_0xd4a1('0x25')]=_0x4ba938;if(_0x17afec[_0xd4a1('0xa0')][_0xd4a1('0xa8')]){return db[_0xd4a1('0xa9')][_0xd4a1('0x55')]({'attributes':['id',_0xd4a1('0x37')],'where':{'id':_0x17afec[_0xd4a1('0xa0')][_0xd4a1('0xa8')]}})[_0xd4a1('0x1e')](function(_0x2f7d25){if(_0x2f7d25){_0x17afec[_0xd4a1('0x70')][_0xd4a1('0xaa')]({'id':0x0,'priority':0x0,'app':_0xd4a1('0xab'),'appdata':_0x2f7d25[_0xd4a1('0x37')]+','+(_0x17afec[_0xd4a1('0x6f')][_0xd4a1('0xac')]||0xa),'interval':_0xd4a1('0xa4')});}return respondWithRpcPromise('Start',_0xd4a1('0xad'),_0x17afec);});}return respondWithRpcPromise(_0xd4a1('0xae'),_0xd4a1('0xad'),_0x17afec);})[_0xd4a1('0x1e')](function(_0x48d32f){if(_0x48d32f){var _0x3c8402=0xc8;var _0x1ed08b=_0xd4a1('0xaf');logger[_0xd4a1('0x1f')](_0xd4a1('0xb0'),_0x1ed08b,_0x3c8402,_0xd4a1('0xb1'));logger['debug'](_0xd4a1('0xb2'),_0x1ed08b,_0x3c8402,_0xd4a1('0xb1'),JSON[_0xd4a1('0x22')](_0x48d32f));if(_0x17afec[_0xd4a1('0x6f')][_0xd4a1('0x3b')]===_0xd4a1('0x7c')){return _0x515a7b[_0xd4a1('0x27')](_0x3c8402)[_0xd4a1('0x2c')]('Content-Type','text/xml')[_0xd4a1('0xb3')]('\x0a');}else{return _0x515a7b['status'](_0x3c8402)['json'](_0x48d32f);}}})[_0xd4a1('0x51')](handleError(_0x515a7b,null));};exports['addApplications']=function(_0x5b7e32,_0x158204){var _0x1c57de=_0x5b7e32['params']['id'];var _0x3212ba=_0x5b7e32['body'];var _0x427f5d=0xc8;var _0x540a2c=null;return db[_0xd4a1('0xb4')]['transaction']({'isolationLevel':db[_0xd4a1('0xb4')][_0xd4a1('0xb5')][_0xd4a1('0xb6')][_0xd4a1('0xb7')]},function(_0x171759){return db[_0xd4a1('0x3a')]['findOne']({'where':{'id':_0x1c57de},'transaction':_0x171759})['then'](function(_0x368ffd){if(_0x368ffd){return db[_0xd4a1('0x6d')][_0xd4a1('0x32')]({'where':{'SmsAccountId':_0x1c57de},'transaction':_0x171759})[_0xd4a1('0x1e')](function(){var _0x234d4f=_[_0xd4a1('0x3e')](_0x3212ba,function(_0xdfe1f3){_0xdfe1f3[_0xd4a1('0x60')]=_0x1c57de;return _0xdfe1f3;});return db['SmsApplication'][_0xd4a1('0xb8')](_0x234d4f,{'transaction':_0x171759});});}else{_0x427f5d=0x194;_0x540a2c=[];}});})[_0xd4a1('0x1e')](function(){if(_0x427f5d!==0x194){return db[_0xd4a1('0x6d')][_0xd4a1('0xb9')]({'where':{'SmsAccountId':_0x1c57de},'order':_0xd4a1('0x72')})[_0xd4a1('0x1e')](function(_0x4d946e){_0x540a2c=_0x4d946e;});}})[_0xd4a1('0x51')](function(_0x1c8c7a){_0x427f5d=0x1f4;logger[_0xd4a1('0x23')](_0x1c8c7a[_0xd4a1('0x36')]);if(_0x1c8c7a[_0xd4a1('0x37')]){delete _0x1c8c7a[_0xd4a1('0x37')];}_0x540a2c=_0x1c8c7a;})[_0xd4a1('0xba')](function(){if(_0x540a2c===null){_0x158204[_0xd4a1('0x26')](_0x427f5d);}else{if(_0x427f5d===0x1f4){_0x158204[_0xd4a1('0x27')](_0x427f5d)[_0xd4a1('0xb3')](_0x540a2c);}else{_0x158204[_0xd4a1('0x27')](_0x427f5d)[_0xd4a1('0x28')](_0x540a2c);}}});};exports[_0xd4a1('0xbb')]=function(_0x420149,_0x5ece97,_0x83da6){var _0x558df5={};var _0x13c9e9={};var _0x3c68b9;var _0x42ee23;return db[_0xd4a1('0x3a')]['findOne']({'where':{'id':_0x420149['params']['id']}})[_0xd4a1('0x1e')](handleEntityNotFound(_0x5ece97,null))[_0xd4a1('0x1e')](function(_0xfe488c){if(_0xfe488c){_0x3c68b9=_0xfe488c;_0x13c9e9[_0xd4a1('0x3d')]=_['keys'](db['SmsApplication'][_0xd4a1('0x54')]);_0x13c9e9['query']=_[_0xd4a1('0x3f')](_0x420149[_0xd4a1('0x40')]);_0x13c9e9[_0xd4a1('0x41')]=_[_0xd4a1('0x42')](_0x13c9e9[_0xd4a1('0x3d')],_0x13c9e9['query']);_0x558df5[_0xd4a1('0x43')]=_[_0xd4a1('0x42')](_0x13c9e9[_0xd4a1('0x3d')],qs[_0xd4a1('0x44')](_0x420149[_0xd4a1('0x40')][_0xd4a1('0x44')]));_0x558df5['attributes']=_0x558df5['attributes']['length']?_0x558df5[_0xd4a1('0x43')]:_0x13c9e9[_0xd4a1('0x3d')];_0x558df5['order']=qs[_0xd4a1('0x49')](_0x420149['query'][_0xd4a1('0x49')]);_0x558df5[_0xd4a1('0x4a')]=qs[_0xd4a1('0x41')](_[_0xd4a1('0x4b')](_0x420149[_0xd4a1('0x40')],_0x13c9e9[_0xd4a1('0x41')]));if(_0x420149[_0xd4a1('0x40')][_0xd4a1('0x4c')]){_0x558df5[_0xd4a1('0x4a')]=_[_0xd4a1('0x4d')](_0x558df5[_0xd4a1('0x4a')],{'$or':_[_0xd4a1('0x3e')](_0x558df5['attributes'],function(_0x59f879){var _0x4f592a={};_0x4f592a[_0x59f879]={'$like':'%'+_0x420149[_0xd4a1('0x40')][_0xd4a1('0x4c')]+'%'};return _0x4f592a;})});}_0x558df5=_[_0xd4a1('0x4d')]({},_0x558df5,_0x420149[_0xd4a1('0x4e')]);return _0x3c68b9[_0xd4a1('0xbb')](_0x558df5);}})['then'](function(_0x537007){if(_0x537007){_0x42ee23=_0x537007['length'];if(!_0x420149[_0xd4a1('0x40')][_0xd4a1('0x46')](_0xd4a1('0x63'))){_0x558df5[_0xd4a1('0x47')]=qs[_0xd4a1('0x47')](_0x420149[_0xd4a1('0x40')][_0xd4a1('0x47')]);_0x558df5[_0xd4a1('0x29')]=qs[_0xd4a1('0x29')](_0x420149[_0xd4a1('0x40')][_0xd4a1('0x29')]);}return _0x3c68b9[_0xd4a1('0xbb')](_0x558df5);}})[_0xd4a1('0x1e')](function(_0x5a7db2){if(_0x5a7db2){return _0x5a7db2?{'count':_0x42ee23,'rows':_0x5a7db2}:null;}})['then'](respondWithResult(_0x5ece97,null))['catch'](handleError(_0x5ece97,null));};exports['getInteractions']=function(_0x53e538,_0x51a3fb,_0x4116c7){var _0x2b165b={'raw':![],'where':{}};var _0x4384b1={};var _0x2fe689={'count':0x0,'rows':[]};return db[_0xd4a1('0x3a')][_0xd4a1('0x62')]({'where':{'id':_0x53e538[_0xd4a1('0x53')]['id']}})[_0xd4a1('0x1e')](handleEntityNotFound(_0x51a3fb,null))['then'](function(_0x5985ae){if(_0x5985ae){_0x4384b1[_0xd4a1('0x3d')]=_[_0xd4a1('0x3f')](db[_0xd4a1('0x9e')][_0xd4a1('0x54')]);_0x4384b1[_0xd4a1('0x40')]=_[_0xd4a1('0x3f')](_0x53e538[_0xd4a1('0x40')]);_0x4384b1[_0xd4a1('0x41')]=_[_0xd4a1('0x42')](_0x4384b1[_0xd4a1('0x3d')],_0x4384b1[_0xd4a1('0x40')]);_0x2b165b[_0xd4a1('0x43')]=_['intersection'](_0x4384b1[_0xd4a1('0x3d')],qs[_0xd4a1('0x44')](_0x53e538[_0xd4a1('0x40')]['fields']));_0x2b165b[_0xd4a1('0x43')]=_0x2b165b['attributes']['length']?_0x2b165b[_0xd4a1('0x43')]:_0x4384b1[_0xd4a1('0x3d')];if(!_0x53e538['query']['hasOwnProperty'](_0xd4a1('0x63'))){_0x2b165b['limit']=qs['limit'](_0x53e538['query']['limit']);_0x2b165b[_0xd4a1('0x29')]=qs[_0xd4a1('0x29')](_0x53e538[_0xd4a1('0x40')]['offset']);}_0x2b165b[_0xd4a1('0x48')]=qs[_0xd4a1('0x49')](_0x53e538[_0xd4a1('0x40')][_0xd4a1('0x49')]);_0x2b165b[_0xd4a1('0x4a')]=qs['filters'](_[_0xd4a1('0x4b')](_0x53e538['query'],_0x4384b1[_0xd4a1('0x41')]));_0x2b165b['where'][_0xd4a1('0x60')]=_0x5985ae['id'];if(_0x53e538[_0xd4a1('0x40')]['filter']){_0x2b165b['where']=_[_0xd4a1('0x4d')](_0x2b165b[_0xd4a1('0x4a')],{'$or':_[_0xd4a1('0x3e')](_0x2b165b['attributes'],function(_0x1136dc){var _0x31cb54={};_0x31cb54[_0x1136dc]={'$like':'%'+_0x53e538['query'][_0xd4a1('0x4c')]+'%'};return _0x31cb54;})});}_0x2b165b=_[_0xd4a1('0x4d')]({},_0x2b165b,_0x53e538[_0xd4a1('0x4e')]);return db['SmsInteraction'][_0xd4a1('0x2b')]({'where':_0x2b165b[_0xd4a1('0x4a')]})['then'](function(_0x5e33a2){_0x2fe689['count']=_0x5e33a2;if(_0x53e538[_0xd4a1('0x40')]['includeAll']){_0x2b165b[_0xd4a1('0x65')]=[{'model':db[_0xd4a1('0x9d')],'as':_0xd4a1('0xbc'),'required':![]},{'model':db['User'],'as':_0xd4a1('0xbd'),'attributes':[_0xd4a1('0x37'),_0xd4a1('0xbe'),'internal'],'required':![]},{'model':db[_0xd4a1('0xbf')],'as':'Tags','attributes':['id',_0xd4a1('0x37'),_0xd4a1('0xc0')],'where':_0x53e538[_0xd4a1('0x40')][_0xd4a1('0xc1')]?{'id':_0x53e538['query'][_0xd4a1('0xc1')]}:undefined,'required':_0x53e538[_0xd4a1('0x40')]['tag']?!![]:![]}];}return db[_0xd4a1('0x9e')][_0xd4a1('0x66')](_0x2b165b);})['then'](function(_0x1637d2){_0x2fe689['rows']=_0x1637d2;return _0x2fe689;});}})[_0xd4a1('0x1e')](respondWithFilteredResult(_0x51a3fb,_0x2b165b))[_0xd4a1('0x51')](handleError(_0x51a3fb,null));};exports[_0xd4a1('0xb3')]=function(_0x4f1198,_0x10cfe5,_0xcc0e43){var _0x58dedb,_0x4c5cc5,_0x5c2b3f;if(_[_0xd4a1('0x94')](_0x4f1198['body'][_0xd4a1('0x57')])||_0x4f1198['body'][_0xd4a1('0x57')]===''){throw new db[(_0xd4a1('0x75'))]['ValidationError'](_0xd4a1('0x93'));}if(_['isNil'](_0x4f1198[_0xd4a1('0x57')]['to'])){throw new db[(_0xd4a1('0x75'))][(_0xd4a1('0x76'))](_0xd4a1('0xc2'));}_0x58dedb=_0x4f1198[_0xd4a1('0x57')]['to'];return db['SmsAccount'][_0xd4a1('0x55')]({'where':{'id':_0x4f1198[_0xd4a1('0x53')]['id']},'include':[{'model':db[_0xd4a1('0x97')],'as':_0xd4a1('0xc3'),'include':[{'model':db['CmContact'],'as':_0xd4a1('0x9b'),'where':{'mobile':_0x58dedb},'limit':0x1,'order':[['updatedAt',_0xd4a1('0x99')]]}]}]})[_0xd4a1('0x1e')](handleEntityNotFound(_0x10cfe5,null))[_0xd4a1('0x1e')](function(_0x4bccf2){if(_0x4bccf2&&_0x4bccf2[_0xd4a1('0xc3')]){_0x4c5cc5=_0x4bccf2[_0xd4a1('0x33')]({'plain':!![]});if(_0x4c5cc5[_0xd4a1('0xc3')]&&_0x4c5cc5[_0xd4a1('0xc3')][_0xd4a1('0x9b')][_0xd4a1('0x45')]){return _0x4c5cc5['List']['Contacts'][0x0];}return db[_0xd4a1('0x9d')][_0xd4a1('0x56')](_[_0xd4a1('0x9c')](_0x4f1198['body'],{'firstName':_0x58dedb,'mobile':_0x58dedb,'phone':_0x58dedb,'ListId':_0x4c5cc5[_0xd4a1('0x98')]}));}})[_0xd4a1('0x1e')](handleEntityNotFound(_0x10cfe5,null))['then'](function(_0x2b8722){if(_0x2b8722){_0x5c2b3f=_0x2b8722;return db[_0xd4a1('0x9e')]['find']({'where':{'ContactId':_0x5c2b3f['id'],'closed':![],'SmsAccountId':_0x4c5cc5['id']}})['then'](function(_0x173431){if(_0x173431){return[_0x173431,![]];}return db[_0xd4a1('0x9e')][_0xd4a1('0x56')]({'UserId':_0x4f1198['user']['id'],'ContactId':_0x5c2b3f['id'],'SmsAccountId':_0x4c5cc5['id'],'phone':_0x58dedb,'firstMsgDirection':_0xd4a1('0xc4'),'Messages':[_['merge'](_0x4f1198[_0xd4a1('0x57')],{'read':![],'body':_0x4f1198[_0xd4a1('0x57')]['body'],'phone':_0x58dedb,'SmsAccountId':_0x4c5cc5['id'],'UserId':_0x4f1198[_0xd4a1('0x59')]['id'],'ContactId':_0x5c2b3f['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xd4a1('0xc5')}]})[_0xd4a1('0x1e')](function(_0x361684){return[_0x361684,!![]];});});}})[_0xd4a1('0x9f')](function(_0x1c262a,_0xa723bb){if(_0xa723bb){return _0x1c262a;}return db[_0xd4a1('0xa6')]['create'](_['merge'](_0x4f1198[_0xd4a1('0x57')],{'read':![],'body':_0x4f1198[_0xd4a1('0x57')][_0xd4a1('0x57')],'phone':_0x58dedb,'SmsAccountId':_0x4c5cc5['id'],'SmsInteractionId':_0x1c262a['id'],'UserId':_0x4f1198[_0xd4a1('0x59')]['id'],'ContactId':_0x5c2b3f['id']}))['then'](function(_0x4546de){_0x1c262a[_0xd4a1('0xc6')][_0xd4a1('0xc5')]=[];_0x1c262a['dataValues'][_0xd4a1('0xc5')][_0xd4a1('0xa1')](_0x4546de[_0xd4a1('0xc6')]);return _0x1c262a;});})[_0xd4a1('0x1e')](respondWithResult(_0x10cfe5,null))[_0xd4a1('0x51')](handleError(_0x10cfe5,null));};exports[_0xd4a1('0x27')]=function(_0x6fa642,_0x3d2c74,_0xfbc215){if(_0x6fa642[_0xd4a1('0x57')]['id']){delete _0x6fa642[_0xd4a1('0x57')]['id'];}var _0x5343a1,_0x431c17,_0x42aaa6;return db[_0xd4a1('0x3a')][_0xd4a1('0x55')]({'where':{'id':_0x6fa642[_0xd4a1('0x53')]['id']}})['then'](handleEntityNotFound(_0x3d2c74,null))['then'](function(_0x102c0c){if(_0x102c0c){_0x42aaa6=_0x102c0c;logger[_0xd4a1('0xc7')](_0xd4a1('0xb0'),_0xd4a1('0x27'),_0xd4a1('0xc8'),_0x102c0c[_0xd4a1('0x3b')],util[_0xd4a1('0xc9')](_0x6fa642['body'],{'showHidden':![],'depth':null}));switch(_0x102c0c[_0xd4a1('0x3b')]){case'skebby':if(_0x6fa642['body'][_0xd4a1('0xca')]&&_0x6fa642[_0xd4a1('0x57')]['status']){_0x431c17=_0x6fa642[_0xd4a1('0x57')][_0xd4a1('0x27')];return db[_0xd4a1('0xa6')]['find']({'where':{'messageId':_0x6fa642[_0xd4a1('0x57')][_0xd4a1('0xca')]}});}break;case'connectel':if(_0x6fa642[_0xd4a1('0x57')][_0xd4a1('0xcb')]&&_0x6fa642['body'][_0xd4a1('0xcc')]){_0x431c17=_0x6fa642[_0xd4a1('0x57')][_0xd4a1('0xcc')];return db['SmsMessage'][_0xd4a1('0x55')]({'where':{'messageId':_0x6fa642['body']['requestid']}});}break;case _0xd4a1('0xcd'):if(_0x6fa642['body'][_0xd4a1('0x83')]&&_0x6fa642[_0xd4a1('0x57')]['status_code']){_0x431c17=_0x6fa642[_0xd4a1('0x57')][_0xd4a1('0xce')];return db[_0xd4a1('0xa6')][_0xd4a1('0x55')]({'where':{'messageId':_0x6fa642[_0xd4a1('0x57')][_0xd4a1('0x83')]}});}break;case _0xd4a1('0x87'):var _0x2b54dc=_0x6fa642[_0xd4a1('0x57')]['results'][0x0];if(_0x2b54dc['messageId']&&_0x2b54dc[_0xd4a1('0x27')][_0xd4a1('0xcf')]==='DELIVERED'){_0x431c17=_0x2b54dc[_0xd4a1('0x27')][_0xd4a1('0xcf')];return db['SmsMessage'][_0xd4a1('0x55')]({'where':{'messageId':_0x2b54dc[_0xd4a1('0x82')]}});}break;case _0xd4a1('0x8d'):if(_0x6fa642[_0xd4a1('0x57')]['messageId']&&_0x6fa642[_0xd4a1('0x57')][_0xd4a1('0x27')]){_0x431c17=_0x6fa642[_0xd4a1('0x57')]['status'];return db[_0xd4a1('0xa6')][_0xd4a1('0x55')]({'where':{'messageId':_0x6fa642['body']['messageId']}});}break;case'bandwidth':if(_0x6fa642[_0xd4a1('0x57')][0x0][_0xd4a1('0x25')]['id']){_0x431c17=_0x6fa642[_0xd4a1('0x57')][0x0][_0xd4a1('0x3b')];return db['SmsMessage'][_0xd4a1('0x55')]({'where':{'messageId':_0x6fa642['body'][0x0][_0xd4a1('0x25')]['id']}});}break;case _0xd4a1('0x91'):if(_0x6fa642[_0xd4a1('0x57')]['redif']&&_0x6fa642['body']['status']){_0x431c17=_0x6fa642[_0xd4a1('0x57')]['status'];return db[_0xd4a1('0xa6')]['find']({'where':{'messageId':_0x6fa642[_0xd4a1('0x57')][_0xd4a1('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x3d2c74,null))['then'](function(_0x4ac9c1){if(_0x4ac9c1){_0x5343a1=_0x4ac9c1;switch(_0x42aaa6['type']){case _0xd4a1('0xd1'):if(_0x431c17==='DELIVERED'){return _0x5343a1[_0xd4a1('0x31')]({'read':!![]});}else{logger[_0xd4a1('0x23')](_0xd4a1('0xb0'),_0xd4a1('0x27'),_0xd4a1('0xd1'),util[_0xd4a1('0xc9')](_0x6fa642[_0xd4a1('0x57')],{'showHidden':![],'depth':null}));}break;case _0xd4a1('0x81'):if(_0x431c17==='1'){return _0x5343a1['update']({'read':!![]});}else{logger[_0xd4a1('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd4a1('0x27'),'skebby',util[_0xd4a1('0xc9')](_0x6fa642['body'],{'showHidden':![],'depth':null}));}break;case _0xd4a1('0xcd'):if(!_0x6fa642[_0xd4a1('0x57')]['error_code']&&_0x431c17>=0xc8&&_0x431c17<=0xce){return _0x5343a1[_0xd4a1('0x31')]({'read':!![]});}else{logger[_0xd4a1('0x23')](_0xd4a1('0xb0'),'status',_0xd4a1('0xcd'),util[_0xd4a1('0xc9')](_0x6fa642[_0xd4a1('0x57')],{'showHidden':![],'depth':null}));}break;case _0xd4a1('0x87'):var _0x250dce=_0x6fa642[_0xd4a1('0x57')][_0xd4a1('0x88')][0x0];if(_0x250dce[_0xd4a1('0x27')]['groupName']===_0xd4a1('0xd2')){return _0x5343a1[_0xd4a1('0x31')]({'read':!![]});}else{logger[_0xd4a1('0x23')](_0xd4a1('0xb0'),_0xd4a1('0x27'),'infobip',util[_0xd4a1('0xc9')](_0x6fa642['body'],{'showHidden':![],'depth':null}));}break;case _0xd4a1('0x8d'):if(_0x431c17==_0xd4a1('0xd3')||_0x431c17=='RECEIVED_BY_RECIPIENT'){return _0x5343a1['update']({'read':!![]});}else{logger['error'](_0xd4a1('0xb0'),_0xd4a1('0x27'),_0xd4a1('0x8d'),util['inspect'](_0x6fa642[_0xd4a1('0x57')],{'showHidden':![],'depth':null}));}break;case _0xd4a1('0x90'):if(_0x431c17==_0xd4a1('0xd4')){return _0x5343a1[_0xd4a1('0x31')]({'read':!![]});}else{logger[_0xd4a1('0x23')](_0xd4a1('0xb0'),_0xd4a1('0x27'),_0xd4a1('0x90'),util[_0xd4a1('0xc9')](_0x6fa642['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x431c17===_0xd4a1('0xd5')||_0x431c17===_0xd4a1('0xd6')){return _0x5343a1[_0xd4a1('0x31')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd4a1('0x27'),_0xd4a1('0x91'),util[_0xd4a1('0xc9')](_0x6fa642[_0xd4a1('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x5343a1;}})[_0xd4a1('0x1e')](respondWithResult(_0x3d2c74,null))[_0xd4a1('0x51')](handleError(_0x3d2c74,null));};exports[_0xd4a1('0xd7')]=function(_0x409f35,_0x2d37e7,_0x1ed708){var _0x265c7c,_0x17a190,_0x578388;return db[_0xd4a1('0x3a')]['find']({'where':{'id':_0x409f35[_0xd4a1('0x53')]['id']}})[_0xd4a1('0x1e')](handleEntityNotFound(_0x2d37e7,null))['then'](function(_0x5bd673){if(_0x5bd673){_0x578388=_0x5bd673;logger[_0xd4a1('0xc7')](_0xd4a1('0xb0'),_0xd4a1('0x27'),_0xd4a1('0xc8'),_0x5bd673[_0xd4a1('0x3b')],util['inspect'](_0x409f35[_0xd4a1('0x40')],{'showHidden':![],'depth':null}));switch(_0x5bd673[_0xd4a1('0x3b')]){case'csc':if(_0x409f35['query'][_0xd4a1('0xd8')]&&_0x409f35['query']['state']){_0x17a190=_0x409f35['query'][_0xd4a1('0xd9')];return db[_0xd4a1('0xa6')]['find']({'where':{'messageId':_0x409f35[_0xd4a1('0x40')][_0xd4a1('0xd8')]}});}break;}}})[_0xd4a1('0x1e')](handleEntityNotFound(_0x2d37e7,null))[_0xd4a1('0x1e')](function(_0x472680){if(_0x472680){_0x265c7c=_0x472680;switch(_0x578388['type']){case'csc':if(_0x17a190==='2'||_0x17a190==='6'){return _0x265c7c['update']({'read':!![]});}else{logger[_0xd4a1('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd4a1('0x27'),_0xd4a1('0x8a'),util['inspect'](_0x409f35[_0xd4a1('0x40')],{'showHidden':![],'depth':null}));};break;}return _0x265c7c;}})[_0xd4a1('0x1e')](respondWithResult(_0x2d37e7,null))[_0xd4a1('0x51')](handleError(_0x2d37e7,null));};exports[_0xd4a1('0xda')]=function(_0x213fae,_0xe44188,_0x2a1455){return db[_0xd4a1('0x3a')]['find']({'where':{'id':_0x213fae['params']['id']}})['then'](handleEntityNotFound(_0xe44188,null))[_0xd4a1('0x1e')](function(_0x15d079){if(_0x15d079){return _0x15d079['addAgents'](_0x213fae['body']['ids'],_[_0xd4a1('0x9a')](_0x213fae[_0xd4a1('0x57')],[_0xd4a1('0x68'),'id'])||{})[_0xd4a1('0x9f')](function(_0xd21187){for(var _0x5c6983=0x0;_0x5c6983<_0x213fae['body'][_0xd4a1('0x68')][_0xd4a1('0x45')];_0x5c6983+=0x1){socket[_0xd4a1('0xdb')](_0xd4a1('0xdc'),{'UserId':Number(_0x213fae[_0xd4a1('0x57')][_0xd4a1('0x68')][_0x5c6983]),'SmsAccountId':Number(_0x213fae[_0xd4a1('0x53')]['id'])});}return _0xd21187;});}})[_0xd4a1('0x1e')](respondWithResult(_0xe44188,null))[_0xd4a1('0x51')](handleError(_0xe44188,null));};exports[_0xd4a1('0xdd')]=function(_0x4be503,_0x20c5f3,_0x3cc5b9){return db['SmsAccount'][_0xd4a1('0x55')]({'where':{'id':_0x4be503[_0xd4a1('0x53')]['id']}})['then'](handleEntityNotFound(_0x20c5f3,null))[_0xd4a1('0x1e')](function(_0x4d89e7){if(_0x4d89e7){return _0x4d89e7[_0xd4a1('0xdd')](_0x4be503['query']['ids'])[_0xd4a1('0x1e')](function(){if(_['isArray'](_0x4be503[_0xd4a1('0x40')]['ids'])){for(var _0x3d307d=0x0;_0x3d307d<_0x4be503['query']['ids'][_0xd4a1('0x45')];_0x3d307d+=0x1){socket[_0xd4a1('0xdb')](_0xd4a1('0xde'),{'UserId':Number(_0x4be503[_0xd4a1('0x40')][_0xd4a1('0x68')][_0x3d307d]),'SmsAccountId':Number(_0x4be503[_0xd4a1('0x53')]['id'])});}}else{socket[_0xd4a1('0xdb')](_0xd4a1('0xde'),{'UserId':Number(_0x4be503[_0xd4a1('0x40')][_0xd4a1('0x68')]),'SmsAccountId':Number(_0x4be503[_0xd4a1('0x53')]['id'])});}});}})[_0xd4a1('0x1e')](respondWithStatusCode(_0x20c5f3,null))[_0xd4a1('0x51')](handleError(_0x20c5f3,null));};exports[_0xd4a1('0xdf')]=function(_0x3d7a4f,_0x231db0,_0x4c24a0){var _0x26a563={};var _0x39fee1={};var _0x30e2b0;var _0x150500;return db['SmsAccount'][_0xd4a1('0x62')]({'where':{'id':_0x3d7a4f['params']['id']}})[_0xd4a1('0x1e')](handleEntityNotFound(_0x231db0,null))[_0xd4a1('0x1e')](function(_0x1ad516){if(_0x1ad516){_0x30e2b0=_0x1ad516;_0x39fee1[_0xd4a1('0x3d')]=_[_0xd4a1('0x3f')](db[_0xd4a1('0xa9')]['rawAttributes']);_0x39fee1['query']=_[_0xd4a1('0x3f')](_0x3d7a4f[_0xd4a1('0x40')]);_0x39fee1['filters']=_[_0xd4a1('0x42')](_0x39fee1['model'],_0x39fee1[_0xd4a1('0x40')]);_0x26a563['attributes']=_[_0xd4a1('0x42')](_0x39fee1[_0xd4a1('0x3d')],qs[_0xd4a1('0x44')](_0x3d7a4f['query'][_0xd4a1('0x44')]));_0x26a563['attributes']=_0x26a563[_0xd4a1('0x43')][_0xd4a1('0x45')]?_0x26a563[_0xd4a1('0x43')]:_0x39fee1[_0xd4a1('0x3d')];_0x26a563[_0xd4a1('0x48')]=qs['sort'](_0x3d7a4f[_0xd4a1('0x40')]['sort']);_0x26a563[_0xd4a1('0x4a')]=qs['filters'](_['pick'](_0x3d7a4f[_0xd4a1('0x40')],_0x39fee1['filters']));if(_0x3d7a4f[_0xd4a1('0x40')][_0xd4a1('0x4c')]){_0x26a563[_0xd4a1('0x4a')]=_[_0xd4a1('0x4d')](_0x26a563['where'],{'$or':_[_0xd4a1('0x3e')](_0x26a563[_0xd4a1('0x43')],function(_0x2e547b){var _0x5daaad={};_0x5daaad[_0x2e547b]={'$like':'%'+_0x3d7a4f[_0xd4a1('0x40')][_0xd4a1('0x4c')]+'%'};return _0x5daaad;})});}_0x26a563=_[_0xd4a1('0x4d')]({},_0x26a563,_0x3d7a4f[_0xd4a1('0x4e')]);return _0x30e2b0[_0xd4a1('0xdf')](_0x26a563);}})[_0xd4a1('0x1e')](function(_0x5286f0){if(_0x5286f0){_0x150500=_0x5286f0[_0xd4a1('0x45')];if(!_0x3d7a4f[_0xd4a1('0x40')]['hasOwnProperty'](_0xd4a1('0x63'))){_0x26a563[_0xd4a1('0x47')]=qs['limit'](_0x3d7a4f[_0xd4a1('0x40')][_0xd4a1('0x47')]);_0x26a563[_0xd4a1('0x29')]=qs[_0xd4a1('0x29')](_0x3d7a4f[_0xd4a1('0x40')][_0xd4a1('0x29')]);}return _0x30e2b0[_0xd4a1('0xdf')](_0x26a563);}})[_0xd4a1('0x1e')](function(_0x3aea96){if(_0x3aea96){return _0x3aea96?{'count':_0x150500,'rows':_0x3aea96}:null;}})[_0xd4a1('0x1e')](respondWithResult(_0x231db0,null))['catch'](handleError(_0x231db0,null));}; \ No newline at end of file +var _0x325d=['skebby_dispatch_id','requestid','statusInt','status_code','infobip','bandwidth','redif','DELIVERED','error_code','groupName','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','removeAgents','isArray','userSmsAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','set','reject','update','destroy','SmsAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','model','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','filter','merge','type','includeAll','include','findAll','params','keys','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','pick','rows','removeDispositions','ids','CannedAnswer','getAnswers','order','removeAnswers','notify','sms','SmsApplication','applications','orderBy','priority','asc','account','Applications','CmContact','Sequelize','difference','createdAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','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','Content-Type','text/xml','send','\x0a','json','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','getApplications','nolimit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','updatedAt','Messages','dataValues','received\x20delivery\x20report\x20from','inspect'];(function(_0x445495,_0x2e38d8){var _0x32c09f=function(_0x4782ed){while(--_0x4782ed){_0x445495['push'](_0x445495['shift']());}};_0x32c09f(++_0x2e38d8);}(_0x325d,0x103));var _0xd325=function(_0x2b554e,_0x589230){_0x2b554e=_0x2b554e-0x0;var _0xd19aed=_0x325d[_0x2b554e];return _0xd19aed;};'use strict';var emlformat=require(_0xd325('0x0'));var rimraf=require(_0xd325('0x1'));var zipdir=require(_0xd325('0x2'));var jsonpatch=require(_0xd325('0x3'));var rp=require(_0xd325('0x4'));var moment=require(_0xd325('0x5'));var BPromise=require(_0xd325('0x6'));var Mustache=require(_0xd325('0x7'));var util=require('util');var path=require(_0xd325('0x8'));var sox=require(_0xd325('0x9'));var csv=require(_0xd325('0xa'));var ejs=require(_0xd325('0xb'));var fs=require('fs');var fs_extra=require(_0xd325('0xc'));var _=require(_0xd325('0xd'));var squel=require(_0xd325('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd325('0xf'));var toCsv=require(_0xd325('0xa'));var querystring=require(_0xd325('0x10'));var Papa=require('papaparse');var Redis=require(_0xd325('0x11'));var authService=require(_0xd325('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd325('0x13'));var logger=require(_0xd325('0x14'))(_0xd325('0x15'));var utils=require(_0xd325('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd325('0x17'));var db=require(_0xd325('0x18'))['db'];config[_0xd325('0x19')]=_[_0xd325('0x1a')](config[_0xd325('0x19')],{'host':_0xd325('0x1b'),'port':0x18eb});var socket=require(_0xd325('0x1c'))(new Redis(config[_0xd325('0x19')]));require(_0xd325('0x1d'))[_0xd325('0x1e')](socket);var jayson=require(_0xd325('0x1f'));var client=jayson[_0xd325('0x20')][_0xd325('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x527730,_0x3aeb15,_0x1b96ac,_0x30eb41){return new BPromise(function(_0x442e1f,_0x3093ba){var _0x35b913=_0x30eb41||client;return _0x35b913[_0xd325('0x22')](_0x527730,_0x1b96ac)[_0xd325('0x23')](function(_0x4c7839){logger['info']('SmsAccount,\x20%s,\x20%s',_0x3aeb15,_0xd325('0x24'));logger[_0xd325('0x25')](_0xd325('0x26'),_0x3aeb15,_0xd325('0x24'),JSON[_0xd325('0x27')](_0x4c7839));if(_0x4c7839[_0xd325('0x28')]){if(_0x4c7839['error']['code']===0x1f4){logger[_0xd325('0x28')](_0xd325('0x29'),_0x3aeb15,_0x4c7839['error'][_0xd325('0x2a')]);return _0x3093ba(_0x4c7839['error'][_0xd325('0x2a')]);}logger[_0xd325('0x28')](_0xd325('0x29'),_0x3aeb15,_0x4c7839[_0xd325('0x28')][_0xd325('0x2a')]);return _0x442e1f(_0x4c7839[_0xd325('0x28')][_0xd325('0x2a')]);}else{logger['info'](_0xd325('0x29'),_0x3aeb15,_0xd325('0x24'));_0x442e1f(_0x4c7839[_0xd325('0x2b')]['message']);}})[_0xd325('0x2c')](function(_0x2f2a9c){logger[_0xd325('0x28')]('SmsAccount,\x20%s,\x20%s',_0x3aeb15,_0x2f2a9c);_0x3093ba(_0x2f2a9c);});});}function respondWithStatusCode(_0xf8e83a,_0x41d63a){_0x41d63a=_0x41d63a||0xcc;return function(_0x4c68d5){if(_0x4c68d5){return _0xf8e83a[_0xd325('0x2d')](_0x41d63a);}return _0xf8e83a['status'](_0x41d63a)[_0xd325('0x2e')]();};}function respondWithResult(_0x56e93b,_0x1fd463){_0x1fd463=_0x1fd463||0xc8;return function(_0x45d2f9){if(_0x45d2f9){return _0x56e93b[_0xd325('0x2f')](_0x1fd463)['json'](_0x45d2f9);}};}function respondWithFilteredResult(_0x572659,_0x4b3edb){return function(_0x2dfcbf){if(_0x2dfcbf){var _0x1673d3=typeof _0x4b3edb[_0xd325('0x30')]===_0xd325('0x31')&&typeof _0x4b3edb[_0xd325('0x32')]===_0xd325('0x31');var _0x145780=_0x2dfcbf[_0xd325('0x33')];var _0x293d66=_0x1673d3?0x0:_0x4b3edb[_0xd325('0x30')];var _0x217bfb=_0x1673d3?_0x2dfcbf[_0xd325('0x33')]:_0x4b3edb[_0xd325('0x30')]+_0x4b3edb['limit'];var _0x665f4c;if(_0x217bfb>=_0x145780){_0x217bfb=_0x145780;_0x665f4c=0xc8;}else{_0x665f4c=0xce;}_0x572659[_0xd325('0x2f')](_0x665f4c);return _0x572659[_0xd325('0x34')]('Content-Range',_0x293d66+'-'+_0x217bfb+'/'+_0x145780)['json'](_0x2dfcbf);}return null;};}function patchUpdates(_0x3aaa68){return function(_0x43dca8){try{jsonpatch['apply'](_0x43dca8,_0x3aaa68,!![]);}catch(_0x5635f8){return BPromise[_0xd325('0x35')](_0x5635f8);}return _0x43dca8['save']();};}function saveUpdates(_0x50157f,_0x23c95f){return function(_0x1d8ed1){if(_0x1d8ed1){return _0x1d8ed1[_0xd325('0x36')](_0x50157f)['then'](function(_0x38c6c2){return _0x38c6c2;});}return null;};}function removeEntity(_0x11a30e,_0x511134){return function(_0x5924f9){if(_0x5924f9){return _0x5924f9[_0xd325('0x37')]()['then'](function(){var _0x3b5a2a=_0x5924f9['get']({'plain':!![]});var _0x324c57=_0xd325('0x38');return db[_0xd325('0x39')][_0xd325('0x37')]({'where':{'type':_0x324c57,'resourceId':_0x3b5a2a['id']}})[_0xd325('0x23')](function(){return _0x5924f9;});})[_0xd325('0x23')](function(){_0x11a30e[_0xd325('0x2f')](0xcc)[_0xd325('0x2e')]();});}};}function handleEntityNotFound(_0xa08093,_0x405b5c){return function(_0x135e2b){if(!_0x135e2b){_0xa08093[_0xd325('0x2d')](0x194);}return _0x135e2b;};}function handleError(_0x52bd0b,_0x530ec5){_0x530ec5=_0x530ec5||0x1f4;return function(_0x51f7d9){logger['error'](_0x51f7d9[_0xd325('0x3a')]);if(_0x51f7d9[_0xd325('0x3b')]){delete _0x51f7d9['name'];}_0x52bd0b['status'](_0x530ec5)['send'](_0x51f7d9);};}exports[_0xd325('0x3c')]=function(_0x2bae61,_0x10e002){var _0xcfdc43={'include':[{'model':db[_0xd325('0x3d')],'as':_0xd325('0x3e')}]},_0x30c619={},_0x2b6e9d={'count':0x0,'rows':[]};var _0x4b25cb=_[_0xd325('0x3f')](db[_0xd325('0x40')][_0xd325('0x41')],function(_0x112a1e){return{'name':_0x112a1e[_0xd325('0x42')],'type':_0x112a1e['type']['key']};});_0x30c619[_0xd325('0x43')]=_[_0xd325('0x3f')](_0x4b25cb,_0xd325('0x3b'));_0x30c619[_0xd325('0x44')]=_['keys'](_0x2bae61[_0xd325('0x44')]);_0x30c619['filters']=_['intersection'](_0x30c619[_0xd325('0x43')],_0x30c619['query']);_0xcfdc43['attributes']=_[_0xd325('0x45')](_0x30c619[_0xd325('0x43')],qs[_0xd325('0x46')](_0x2bae61['query'][_0xd325('0x46')]));_0xcfdc43[_0xd325('0x47')]=_0xcfdc43[_0xd325('0x47')][_0xd325('0x48')]?_0xcfdc43[_0xd325('0x47')]:_0x30c619[_0xd325('0x43')];if(!_0x2bae61['query'][_0xd325('0x49')]('nolimit')){_0xcfdc43[_0xd325('0x32')]=qs[_0xd325('0x32')](_0x2bae61[_0xd325('0x44')]['limit']);_0xcfdc43[_0xd325('0x30')]=qs['offset'](_0x2bae61[_0xd325('0x44')]['offset']);}_0xcfdc43['order']=qs[_0xd325('0x4a')](_0x2bae61['query'][_0xd325('0x4a')]);_0xcfdc43[_0xd325('0x4b')]=qs[_0xd325('0x4c')](_['pick'](_0x2bae61['query'],_0x30c619[_0xd325('0x4c')]),_0x4b25cb);if(_0x2bae61[_0xd325('0x44')][_0xd325('0x4d')]){_0xcfdc43[_0xd325('0x4b')]=_[_0xd325('0x4e')](_0xcfdc43[_0xd325('0x4b')],{'$or':_['map'](_0x4b25cb,function(_0x495b2e){if(_0x495b2e[_0xd325('0x4f')]!=='VIRTUAL'){var _0x3c1b2b={};_0x3c1b2b[_0x495b2e['name']]={'$like':'%'+_0x2bae61[_0xd325('0x44')]['filter']+'%'};return _0x3c1b2b;}})});}_0xcfdc43=_[_0xd325('0x4e')]({},_0xcfdc43,_0x2bae61['options']);var _0x4340c6={'where':_0xcfdc43['where']};return db[_0xd325('0x40')][_0xd325('0x33')](_0x4340c6)[_0xd325('0x23')](function(_0x154222){_0x2b6e9d[_0xd325('0x33')]=_0x154222;if(_0x2bae61[_0xd325('0x44')][_0xd325('0x50')]){_0xcfdc43[_0xd325('0x51')]=[{'all':!![]}];}return db[_0xd325('0x40')][_0xd325('0x52')](_0xcfdc43);})[_0xd325('0x23')](function(_0x44bf0e){_0x2b6e9d['rows']=_0x44bf0e;return _0x2b6e9d;})[_0xd325('0x23')](respondWithFilteredResult(_0x10e002,_0xcfdc43))[_0xd325('0x2c')](handleError(_0x10e002,null));};exports['show']=function(_0x376787,_0x6ede42){var _0x109f3c={'raw':![],'where':{'id':_0x376787[_0xd325('0x53')]['id']},'include':[{'model':db[_0xd325('0x3d')],'as':'mandatoryDispositionPause'}]},_0x2be0cc={};_0x2be0cc[_0xd325('0x43')]=_[_0xd325('0x54')](db[_0xd325('0x40')][_0xd325('0x41')]);_0x2be0cc[_0xd325('0x44')]=_[_0xd325('0x54')](_0x376787[_0xd325('0x44')]);_0x2be0cc['filters']=_['intersection'](_0x2be0cc[_0xd325('0x43')],_0x2be0cc[_0xd325('0x44')]);_0x109f3c[_0xd325('0x47')]=_[_0xd325('0x45')](_0x2be0cc[_0xd325('0x43')],qs[_0xd325('0x46')](_0x376787[_0xd325('0x44')]['fields']));_0x109f3c[_0xd325('0x47')]=_0x109f3c['attributes']['length']?_0x109f3c['attributes']:_0x2be0cc[_0xd325('0x43')];if(_0x376787['query'][_0xd325('0x50')]){_0x109f3c[_0xd325('0x51')]=[{'all':!![]}];}_0x109f3c=_['merge']({},_0x109f3c,_0x376787[_0xd325('0x55')]);return db[_0xd325('0x40')][_0xd325('0x56')](_0x109f3c)[_0xd325('0x23')](handleEntityNotFound(_0x6ede42,null))['then'](respondWithResult(_0x6ede42,null))[_0xd325('0x2c')](handleError(_0x6ede42,null));};exports[_0xd325('0x57')]=function(_0xefeb69,_0x5a2a86){return db[_0xd325('0x40')][_0xd325('0x57')](_0xefeb69[_0xd325('0x58')],{})[_0xd325('0x23')](function(_0x560a88){var _0x18f9e8=_0xefeb69['user'][_0xd325('0x59')]({'plain':!![]});if(!_0x18f9e8)throw new Error(_0xd325('0x5a'));if(_0x18f9e8['role']===_0xd325('0x5b')){var _0x570c2b=_0x560a88[_0xd325('0x59')]({'plain':!![]});var _0x3fdaf4='SmsAccounts';return db[_0xd325('0x5c')][_0xd325('0x56')]({'where':{'name':_0x3fdaf4,'userProfileId':_0x18f9e8[_0xd325('0x5d')]},'raw':!![]})[_0xd325('0x23')](function(_0x5694fe){if(_0x5694fe&&_0x5694fe[_0xd325('0x5e')]===0x0){return db[_0xd325('0x39')][_0xd325('0x57')]({'name':_0x570c2b[_0xd325('0x3b')],'resourceId':_0x570c2b['id'],'type':_0x5694fe[_0xd325('0x3b')],'sectionId':_0x5694fe['id']},{})[_0xd325('0x23')](function(){return _0x560a88;});}else{return _0x560a88;}})['catch'](function(_0x1ee97b){logger[_0xd325('0x28')](_0xd325('0x5f'),_0x1ee97b);throw _0x1ee97b;});}return _0x560a88;})[_0xd325('0x23')](respondWithResult(_0x5a2a86,0xc9))[_0xd325('0x2c')](handleError(_0x5a2a86,null));};exports['update']=function(_0x476871,_0x56fdd1){if(_0x476871[_0xd325('0x58')]['id']){delete _0x476871[_0xd325('0x58')]['id'];}return db[_0xd325('0x40')][_0xd325('0x56')]({'where':{'id':_0x476871[_0xd325('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0xd325('0x3e')}]})[_0xd325('0x23')](handleEntityNotFound(_0x56fdd1,null))['then'](saveUpdates(_0x476871[_0xd325('0x58')],null))[_0xd325('0x23')](respondWithResult(_0x56fdd1,null))[_0xd325('0x2c')](handleError(_0x56fdd1,null));};exports[_0xd325('0x37')]=function(_0x5f1f0c,_0x310656){return db[_0xd325('0x40')][_0xd325('0x56')]({'where':{'id':_0x5f1f0c[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x310656,null))[_0xd325('0x23')](removeEntity(_0x310656,null))['catch'](handleError(_0x310656,null));};exports[_0xd325('0x60')]=function(_0x39a862,_0x27b37e){return db['SmsAccount'][_0xd325('0x60')]()['then'](respondWithResult(_0x27b37e,null))[_0xd325('0x2c')](handleError(_0x27b37e,null));};exports[_0xd325('0x61')]=function(_0x1739ed,_0x5275f0,_0x163034){if(_0x1739ed[_0xd325('0x58')]['id']){delete _0x1739ed[_0xd325('0x58')]['id'];}return db[_0xd325('0x40')]['find']({'where':{'id':_0x1739ed[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x5275f0,null))[_0xd325('0x23')](function(_0x4816cb){if(_0x4816cb){_0x1739ed[_0xd325('0x58')][_0xd325('0x62')]=_0x4816cb['id'];return db['Disposition'][_0xd325('0x57')](_0x1739ed['body']);}})[_0xd325('0x23')](respondWithResult(_0x5275f0,null))['catch'](handleError(_0x5275f0,null));};exports[_0xd325('0x63')]=function(_0x163a36,_0x30aeea,_0x2f0518){var _0x56e281={'raw':![],'where':{}};var _0x5d4e62={};var _0x32cc04={'count':0x0,'rows':[]};return db[_0xd325('0x40')][_0xd325('0x64')]({'where':{'id':_0x163a36[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x30aeea,null))[_0xd325('0x23')](function(_0x1a2894){if(_0x1a2894){_0x5d4e62[_0xd325('0x43')]=_['keys'](db[_0xd325('0x65')][_0xd325('0x41')]);_0x5d4e62[_0xd325('0x44')]=_[_0xd325('0x54')](_0x163a36[_0xd325('0x44')]);_0x5d4e62[_0xd325('0x4c')]=_[_0xd325('0x45')](_0x5d4e62[_0xd325('0x43')],_0x5d4e62['query']);_0x56e281[_0xd325('0x47')]=_[_0xd325('0x45')](_0x5d4e62[_0xd325('0x43')],qs['fields'](_0x163a36[_0xd325('0x44')]['fields']));_0x56e281[_0xd325('0x47')]=_0x56e281[_0xd325('0x47')][_0xd325('0x48')]?_0x56e281[_0xd325('0x47')]:_0x5d4e62['model'];if(!_0x163a36[_0xd325('0x44')]['hasOwnProperty']('nolimit')){_0x56e281['limit']=qs[_0xd325('0x32')](_0x163a36[_0xd325('0x44')][_0xd325('0x32')]);_0x56e281[_0xd325('0x30')]=qs['offset'](_0x163a36['query']['offset']);}_0x56e281['order']=qs[_0xd325('0x4a')](_0x163a36[_0xd325('0x44')][_0xd325('0x4a')]);_0x56e281[_0xd325('0x4b')]=qs[_0xd325('0x4c')](_[_0xd325('0x66')](_0x163a36[_0xd325('0x44')],_0x5d4e62[_0xd325('0x4c')]));_0x56e281[_0xd325('0x4b')][_0xd325('0x62')]=_0x1a2894['id'];if(_0x163a36[_0xd325('0x44')][_0xd325('0x4d')]){_0x56e281[_0xd325('0x4b')]=_[_0xd325('0x4e')](_0x56e281[_0xd325('0x4b')],{'$or':_[_0xd325('0x3f')](_0x56e281[_0xd325('0x47')],function(_0x51ffb6){var _0x3b598f={};_0x3b598f[_0x51ffb6]={'$like':'%'+_0x163a36[_0xd325('0x44')][_0xd325('0x4d')]+'%'};return _0x3b598f;})});}_0x56e281=_[_0xd325('0x4e')]({},_0x56e281,_0x163a36[_0xd325('0x55')]);return db[_0xd325('0x65')][_0xd325('0x33')]({'where':_0x56e281[_0xd325('0x4b')]})[_0xd325('0x23')](function(_0x2a8e72){_0x32cc04[_0xd325('0x33')]=_0x2a8e72;if(_0x163a36[_0xd325('0x44')][_0xd325('0x50')]){_0x56e281[_0xd325('0x51')]=[{'all':!![]}];}return db[_0xd325('0x65')][_0xd325('0x52')](_0x56e281);})[_0xd325('0x23')](function(_0x49e217){_0x32cc04[_0xd325('0x67')]=_0x49e217;return _0x32cc04;});}})[_0xd325('0x23')](respondWithFilteredResult(_0x30aeea,_0x56e281))[_0xd325('0x2c')](handleError(_0x30aeea,null));};exports['removeDispositions']=function(_0x1bbea1,_0x2dd7aa,_0x5e65d7){return db['SmsAccount']['find']({'where':{'id':_0x1bbea1[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x2dd7aa,null))['then'](function(_0x2269d4){if(_0x2269d4){return _0x2269d4[_0xd325('0x68')](_0x1bbea1[_0xd325('0x44')][_0xd325('0x69')]);}})[_0xd325('0x23')](respondWithStatusCode(_0x2dd7aa,null))['catch'](handleError(_0x2dd7aa,null));};exports['addAnswer']=function(_0x4e9855,_0xdda957,_0x27f202){if(_0x4e9855[_0xd325('0x58')]['id']){delete _0x4e9855[_0xd325('0x58')]['id'];}return db['SmsAccount'][_0xd325('0x56')]({'where':{'id':_0x4e9855['params']['id']}})['then'](handleEntityNotFound(_0xdda957,null))[_0xd325('0x23')](function(_0x567404){if(_0x567404){_0x4e9855['body'][_0xd325('0x62')]=_0x567404['id'];return db[_0xd325('0x6a')]['create'](_0x4e9855[_0xd325('0x58')]);}})[_0xd325('0x23')](respondWithResult(_0xdda957,null))[_0xd325('0x2c')](handleError(_0xdda957,null));};exports[_0xd325('0x6b')]=function(_0x545d00,_0x3af882,_0x54805d){var _0x5d0f17={'raw':![],'where':{}};var _0x523bbb={};var _0xed9ac8={'count':0x0,'rows':[]};return db[_0xd325('0x40')][_0xd325('0x64')]({'where':{'id':_0x545d00[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x3af882,null))[_0xd325('0x23')](function(_0xb66407){if(_0xb66407){_0x523bbb[_0xd325('0x43')]=_['keys'](db[_0xd325('0x6a')][_0xd325('0x41')]);_0x523bbb[_0xd325('0x44')]=_[_0xd325('0x54')](_0x545d00['query']);_0x523bbb[_0xd325('0x4c')]=_[_0xd325('0x45')](_0x523bbb[_0xd325('0x43')],_0x523bbb[_0xd325('0x44')]);_0x5d0f17['attributes']=_[_0xd325('0x45')](_0x523bbb['model'],qs['fields'](_0x545d00[_0xd325('0x44')][_0xd325('0x46')]));_0x5d0f17[_0xd325('0x47')]=_0x5d0f17[_0xd325('0x47')]['length']?_0x5d0f17[_0xd325('0x47')]:_0x523bbb[_0xd325('0x43')];if(!_0x545d00['query'][_0xd325('0x49')]('nolimit')){_0x5d0f17[_0xd325('0x32')]=qs[_0xd325('0x32')](_0x545d00[_0xd325('0x44')][_0xd325('0x32')]);_0x5d0f17['offset']=qs[_0xd325('0x30')](_0x545d00[_0xd325('0x44')][_0xd325('0x30')]);}_0x5d0f17[_0xd325('0x6c')]=qs[_0xd325('0x4a')](_0x545d00['query'][_0xd325('0x4a')]);_0x5d0f17[_0xd325('0x4b')]=qs[_0xd325('0x4c')](_[_0xd325('0x66')](_0x545d00['query'],_0x523bbb['filters']));_0x5d0f17[_0xd325('0x4b')]['SmsAccountId']=_0xb66407['id'];if(_0x545d00[_0xd325('0x44')][_0xd325('0x4d')]){_0x5d0f17[_0xd325('0x4b')]=_['merge'](_0x5d0f17[_0xd325('0x4b')],{'$or':_[_0xd325('0x3f')](_0x5d0f17[_0xd325('0x47')],function(_0x2c2cc9){var _0x5bcad7={};_0x5bcad7[_0x2c2cc9]={'$like':'%'+_0x545d00['query'][_0xd325('0x4d')]+'%'};return _0x5bcad7;})});}_0x5d0f17=_['merge']({},_0x5d0f17,_0x545d00['options']);return db[_0xd325('0x6a')][_0xd325('0x33')]({'where':_0x5d0f17[_0xd325('0x4b')]})[_0xd325('0x23')](function(_0x4ed8d8){_0xed9ac8[_0xd325('0x33')]=_0x4ed8d8;if(_0x545d00[_0xd325('0x44')][_0xd325('0x50')]){_0x5d0f17[_0xd325('0x51')]=[{'all':!![]}];}return db[_0xd325('0x6a')][_0xd325('0x52')](_0x5d0f17);})['then'](function(_0x1226cb){_0xed9ac8['rows']=_0x1226cb;return _0xed9ac8;});}})[_0xd325('0x23')](respondWithFilteredResult(_0x3af882,_0x5d0f17))['catch'](handleError(_0x3af882,null));};exports[_0xd325('0x6d')]=function(_0x5eff3f,_0x580861,_0x5837e5){return db['SmsAccount']['find']({'where':{'id':_0x5eff3f[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x580861,null))[_0xd325('0x23')](function(_0x3e2f9){if(_0x3e2f9){return _0x3e2f9[_0xd325('0x6d')](_0x5eff3f[_0xd325('0x44')][_0xd325('0x69')]);}})[_0xd325('0x23')](respondWithStatusCode(_0x580861,null))['catch'](handleError(_0x580861,null));};exports[_0xd325('0x6e')]=function(_0x231408,_0x13c46f,_0x1ce544){var _0x156b09={'channel':_0xd325('0x6f')};var _0x16828e=[];var _0x18cd9c=[];var _0x28aed4={};return db[_0xd325('0x40')][_0xd325('0x56')]({'where':{'id':_0x231408[_0xd325('0x53')]['id']},'include':[{'model':db[_0xd325('0x70')],'as':'Applications'}]})[_0xd325('0x23')](handleEntityNotFound(_0x13c46f,null))[_0xd325('0x23')](function(_0x4c0b7e){_0x156b09['account']=_0x4c0b7e;_0x156b09[_0xd325('0x71')]=_[_0xd325('0x72')](_0x4c0b7e['Applications'],[_0xd325('0x73')],[_0xd325('0x74')]);if(_0x156b09[_0xd325('0x75')][_0xd325('0x76')]){delete _0x156b09[_0xd325('0x75')][_0xd325('0x76')];}return db[_0xd325('0x77')][_0xd325('0x60')]();})[_0xd325('0x23')](function(_0x5b9175){if(!_0x5b9175){throw new db[(_0xd325('0x78'))]['ValidationError']('no\x20available\x20attributes');}_0x16828e=_[_0xd325('0x79')](_['keys'](_0x5b9175),['createdAt','updatedAt']);_0x18cd9c=_['difference'](_[_0xd325('0x54')](_0x5b9175),[_0xd325('0x7a'),'updatedAt',_0xd325('0x7b'),_0xd325('0x7c')]);_0x156b09[_0xd325('0x58')]={'mapKey':_0xd325('0x7d')};if(_0x156b09[_0xd325('0x75')]['type']){switch(_0x156b09[_0xd325('0x75')][_0xd325('0x4f')]){case _0xd325('0x7e'):_0x156b09['body'][_0xd325('0x7f')]=_0x231408['body'][_0xd325('0x80')];_0x156b09[_0xd325('0x58')]['body']=_0x231408[_0xd325('0x58')][_0xd325('0x81')];_0x156b09[_0xd325('0x58')][_0xd325('0x82')]=_0x231408[_0xd325('0x58')][_0xd325('0x83')];break;case _0xd325('0x84'):_0x156b09[_0xd325('0x58')]['from']='+'+_0x231408[_0xd325('0x58')][_0xd325('0x85')];_0x156b09[_0xd325('0x58')][_0xd325('0x58')]=_0x231408['body'][_0xd325('0x86')];break;case _0xd325('0x87'):_0x156b09['body']['from']=_0x231408[_0xd325('0x58')][_0xd325('0x7f')];_0x156b09[_0xd325('0x58')]['body']=_0x231408['body'][_0xd325('0x2a')];break;case _0xd325('0x88'):_0x156b09[_0xd325('0x58')][_0xd325('0x7f')]=_0x231408['body'][_0xd325('0x7f')];_0x156b09['body'][_0xd325('0x58')]=_0x231408[_0xd325('0x58')][_0xd325('0x58')];_0x156b09[_0xd325('0x58')][_0xd325('0x82')]=_0x231408[_0xd325('0x58')][_0xd325('0x89')];break;case _0xd325('0x8a'):_0x156b09['body']['from']=_0x231408[_0xd325('0x58')][_0xd325('0x80')];_0x156b09[_0xd325('0x58')][_0xd325('0x58')]=_0x231408[_0xd325('0x58')]['Text'];_0x156b09['body'][_0xd325('0x82')]=_0x231408[_0xd325('0x58')][_0xd325('0x8b')];break;case'infobip':_0x156b09['body'][_0xd325('0x7f')]='+'+_0x231408[_0xd325('0x58')][_0xd325('0x8c')][0x0][_0xd325('0x7f')];_0x156b09[_0xd325('0x58')][_0xd325('0x58')]=_0x231408['body'][_0xd325('0x8c')][0x0][_0xd325('0x86')];_0x156b09[_0xd325('0x58')][_0xd325('0x82')]=_0x231408[_0xd325('0x58')][_0xd325('0x8c')][0x0][_0xd325('0x82')];break;case _0xd325('0x8d'):_0x156b09[_0xd325('0x58')]['from']=_0x231408[_0xd325('0x58')][_0xd325('0x8e')];_0x156b09['body'][_0xd325('0x58')]=_0x231408[_0xd325('0x58')][_0xd325('0x8f')][_0xd325('0x2a')];break;case _0xd325('0x90'):_0x156b09[_0xd325('0x58')]['from']=_0x231408[_0xd325('0x58')][_0xd325('0x91')];_0x156b09[_0xd325('0x58')][_0xd325('0x58')]=_0x231408[_0xd325('0x58')]['text'];_0x156b09[_0xd325('0x58')][_0xd325('0x82')]=_0x231408[_0xd325('0x58')][_0xd325('0x92')];break;case'bandwidth':_0x156b09[_0xd325('0x58')][_0xd325('0x82')]=_0x231408[_0xd325('0x58')][0x0]['message']['id'];_0x156b09[_0xd325('0x58')]['from']=_0x231408[_0xd325('0x58')][0x0]['message']['from'];_0x156b09['body'][_0xd325('0x58')]=_0x231408['body'][0x0]['message']['text'];break;case _0xd325('0x93'):_0x156b09['body'][_0xd325('0x7f')]=_0x231408[_0xd325('0x58')][_0xd325('0x7f')];_0x156b09['body'][_0xd325('0x58')]=_0x231408[_0xd325('0x58')]['message'];_0x156b09[_0xd325('0x58')][_0xd325('0x82')]=_0x231408[_0xd325('0x58')][_0xd325('0x94')];break;}}if(_0x156b09['body']['id']){delete _0x156b09[_0xd325('0x58')]['id'];}if(_[_0xd325('0x95')](_0x156b09[_0xd325('0x58')][_0xd325('0x7f')])){throw new db['Sequelize']['ValidationError'](_0xd325('0x96'));}if(_[_0xd325('0x95')](_0x156b09[_0xd325('0x58')][_0xd325('0x58')])||_0x156b09[_0xd325('0x58')][_0xd325('0x58')]===''){throw new db['Sequelize']['ValidationError'](_0xd325('0x97'));}if(_[_0xd325('0x95')](_0x156b09[_0xd325('0x58')]['mapKey'])){throw new db[(_0xd325('0x78'))][(_0xd325('0x98'))](_0xd325('0x99')+_0x18cd9c);}if(!_[_0xd325('0x9a')](_0x18cd9c,_0x156b09['body']['mapKey'])){throw new db[(_0xd325('0x78'))]['ValidationError'](_0xd325('0x9b')+_0x18cd9c);}_0x28aed4[_0x156b09[_0xd325('0x58')][_0xd325('0x9c')]]=_0x156b09['body'][_0xd325('0x7f')];return db[_0xd325('0x9d')]['find']({'where':{'id':_0x156b09['account']['ListId']},'include':[{'model':db[_0xd325('0x77')],'as':_0xd325('0x9e'),'where':_0x28aed4,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0xd325('0x23')](handleEntityNotFound(_0x13c46f,null))[_0xd325('0x23')](function(_0x252ec2){if(_0x252ec2){_0x156b09[_0xd325('0x9f')]=_[_0xd325('0xa0')](_0x252ec2,['Contacts']);if(_0x252ec2[_0xd325('0x9e')][_0xd325('0x48')]){return _0x252ec2[_0xd325('0x9e')][0x0];}var _0x330a82=_[_0xd325('0x1a')](_0x156b09['body'],{'firstName':_0x156b09['body'][_0xd325('0x7f')],'ListId':_0x252ec2['id']});_0x330a82[_0x156b09[_0xd325('0x58')][_0xd325('0x9c')]]=_0x156b09[_0xd325('0x58')][_0xd325('0x7f')];return db[_0xd325('0x77')][_0xd325('0x57')](_0x330a82,{'fields':_0x16828e,'raw':!![]});}})[_0xd325('0x23')](handleEntityNotFound(_0x13c46f,null))[_0xd325('0x23')](function(_0x375a51){if(_0x375a51){_0x156b09[_0xd325('0xa1')]=_0x375a51;var _0x13e674={'ContactId':_0x375a51['id'],'phone':_0x156b09[_0xd325('0x58')][_0xd325('0x7f')],'SmsAccountId':_0x231408[_0xd325('0x53')]['id']};var _0x2fa149={'ContactId':_0x375a51['id'],'SmsAccountId':_0x231408['params']['id'],'closed':![]};return db['SmsInteraction'][_0xd325('0x56')]({'where':_0x2fa149})[_0xd325('0x23')](function(_0x3be4ec){if(_0x3be4ec){return[_0x3be4ec,![]];}return db[_0xd325('0xa2')][_0xd325('0x57')](_0x13e674)[_0xd325('0x23')](function(_0x403c53){return[_0x403c53,!![]];});});}})[_0xd325('0xa3')](function(_0x2dd335,_0x56b5ee){_0x156b09[_0xd325('0xa4')]=_0x2dd335[_0xd325('0x59')]({'plain':!![]});_0x156b09[_0xd325('0xa4')][_0xd325('0xa5')]=![];if(_0x56b5ee){if(_0x156b09['account'][_0xd325('0xa6')]){_0x156b09[_0xd325('0x71')][_0xd325('0xa7')]({'id':0x0,'priority':_0x156b09[_0xd325('0x71')]['length']+0x1,'app':_0xd325('0xa8'),'appdata':_0xd325('0xa9'),'interval':_0xd325('0xaa')});}_0x156b09[_0xd325('0xa4')][_0xd325('0xa5')]=!![];}return db[_0xd325('0xab')][_0xd325('0x57')]({'phone':_0x156b09['body'][_0xd325('0x7f')],'messageId':_0x156b09[_0xd325('0x58')][_0xd325('0x82')],'body':_0x156b09['body']['body'],'SmsAccountId':_0x231408[_0xd325('0x53')]['id'],'SmsInteractionId':_0x2dd335['id'],'direction':'in','ContactId':_0x2dd335[_0xd325('0xac')],'AttachmentId':_0x156b09[_0xd325('0x58')][_0xd325('0xad')]});})[_0xd325('0x23')](function(_0xe868fc){_0x156b09['message']=_0xe868fc;if(_0x156b09[_0xd325('0xa4')][_0xd325('0xae')]){return db[_0xd325('0xaf')]['find']({'attributes':['id',_0xd325('0x3b')],'where':{'id':_0x156b09[_0xd325('0xa4')][_0xd325('0xae')]}})[_0xd325('0x23')](function(_0x15f6e9){if(_0x15f6e9){_0x156b09[_0xd325('0x71')][_0xd325('0xb0')]({'id':0x0,'priority':0x0,'app':_0xd325('0xb1'),'appdata':_0x15f6e9[_0xd325('0x3b')]+','+(_0x156b09['account'][_0xd325('0xb2')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd325('0xb3'),_0xd325('0xb4'),_0x156b09);});}return respondWithRpcPromise(_0xd325('0xb3'),_0xd325('0xb4'),_0x156b09);})[_0xd325('0x23')](function(_0x179ab1){if(_0x179ab1){var _0x123ae9=0xc8;var _0xaccf4=_0xd325('0xb5');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaccf4,_0x123ae9,_0xd325('0xb6'));logger[_0xd325('0x25')](_0xd325('0xb7'),_0xaccf4,_0x123ae9,_0xd325('0xb6'),JSON[_0xd325('0x27')](_0x179ab1));if(_0x156b09[_0xd325('0x75')][_0xd325('0x4f')]===_0xd325('0x7e')){return _0x13c46f['status'](_0x123ae9)[_0xd325('0x34')](_0xd325('0xb8'),_0xd325('0xb9'))[_0xd325('0xba')](_0xd325('0xbb'));}else{return _0x13c46f[_0xd325('0x2f')](_0x123ae9)[_0xd325('0xbc')](_0x179ab1);}}})['catch'](handleError(_0x13c46f,null));};exports[_0xd325('0xbd')]=function(_0x52211d,_0x48976f){var _0x59b630=_0x52211d[_0xd325('0x53')]['id'];var _0x1605cd=_0x52211d[_0xd325('0x58')];var _0x40f226=0xc8;var _0x1cd385=null;return db['sequelize'][_0xd325('0xbe')]({'isolationLevel':db[_0xd325('0xbf')]['Transaction'][_0xd325('0xc0')][_0xd325('0xc1')]},function(_0x1469a6){return db['SmsAccount']['findOne']({'where':{'id':_0x59b630},'transaction':_0x1469a6})[_0xd325('0x23')](function(_0x23a054){if(_0x23a054){return db[_0xd325('0x70')][_0xd325('0x37')]({'where':{'SmsAccountId':_0x59b630},'transaction':_0x1469a6})['then'](function(){var _0x35c528=_[_0xd325('0x3f')](_0x1605cd,function(_0x1766dc){_0x1766dc[_0xd325('0x62')]=_0x59b630;return _0x1766dc;});return db[_0xd325('0x70')][_0xd325('0xc2')](_0x35c528,{'transaction':_0x1469a6});});}else{_0x40f226=0x194;_0x1cd385=[];}});})['then'](function(){if(_0x40f226!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x59b630},'order':'priority'})[_0xd325('0x23')](function(_0x1565bf){_0x1cd385=_0x1565bf;});}})[_0xd325('0x2c')](function(_0x4a9271){_0x40f226=0x1f4;logger[_0xd325('0x28')](_0x4a9271[_0xd325('0x3a')]);if(_0x4a9271['name']){delete _0x4a9271[_0xd325('0x3b')];}_0x1cd385=_0x4a9271;})['finally'](function(){if(_0x1cd385===null){_0x48976f[_0xd325('0x2d')](_0x40f226);}else{if(_0x40f226===0x1f4){_0x48976f[_0xd325('0x2f')](_0x40f226)['send'](_0x1cd385);}else{_0x48976f[_0xd325('0x2f')](_0x40f226)[_0xd325('0xbc')](_0x1cd385);}}});};exports['getApplications']=function(_0xcca9a8,_0x45ee87,_0x15306a){var _0xcfbbdd={};var _0x20ad35={};var _0x14c923;var _0x393713;return db[_0xd325('0x40')][_0xd325('0x64')]({'where':{'id':_0xcca9a8[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x45ee87,null))['then'](function(_0x52a7a9){if(_0x52a7a9){_0x14c923=_0x52a7a9;_0x20ad35[_0xd325('0x43')]=_[_0xd325('0x54')](db[_0xd325('0x70')][_0xd325('0x41')]);_0x20ad35[_0xd325('0x44')]=_[_0xd325('0x54')](_0xcca9a8[_0xd325('0x44')]);_0x20ad35['filters']=_[_0xd325('0x45')](_0x20ad35[_0xd325('0x43')],_0x20ad35[_0xd325('0x44')]);_0xcfbbdd[_0xd325('0x47')]=_[_0xd325('0x45')](_0x20ad35[_0xd325('0x43')],qs['fields'](_0xcca9a8[_0xd325('0x44')][_0xd325('0x46')]));_0xcfbbdd[_0xd325('0x47')]=_0xcfbbdd[_0xd325('0x47')][_0xd325('0x48')]?_0xcfbbdd[_0xd325('0x47')]:_0x20ad35[_0xd325('0x43')];_0xcfbbdd[_0xd325('0x6c')]=qs['sort'](_0xcca9a8[_0xd325('0x44')][_0xd325('0x4a')]);_0xcfbbdd['where']=qs['filters'](_[_0xd325('0x66')](_0xcca9a8['query'],_0x20ad35['filters']));if(_0xcca9a8[_0xd325('0x44')][_0xd325('0x4d')]){_0xcfbbdd['where']=_[_0xd325('0x4e')](_0xcfbbdd['where'],{'$or':_['map'](_0xcfbbdd[_0xd325('0x47')],function(_0x5fc7ba){var _0x2c3977={};_0x2c3977[_0x5fc7ba]={'$like':'%'+_0xcca9a8[_0xd325('0x44')][_0xd325('0x4d')]+'%'};return _0x2c3977;})});}_0xcfbbdd=_['merge']({},_0xcfbbdd,_0xcca9a8[_0xd325('0x55')]);return _0x14c923[_0xd325('0xc3')](_0xcfbbdd);}})['then'](function(_0x4a03a4){if(_0x4a03a4){_0x393713=_0x4a03a4[_0xd325('0x48')];if(!_0xcca9a8[_0xd325('0x44')][_0xd325('0x49')](_0xd325('0xc4'))){_0xcfbbdd[_0xd325('0x32')]=qs['limit'](_0xcca9a8[_0xd325('0x44')]['limit']);_0xcfbbdd['offset']=qs['offset'](_0xcca9a8[_0xd325('0x44')][_0xd325('0x30')]);}return _0x14c923[_0xd325('0xc3')](_0xcfbbdd);}})['then'](function(_0x384921){if(_0x384921){return _0x384921?{'count':_0x393713,'rows':_0x384921}:null;}})[_0xd325('0x23')](respondWithResult(_0x45ee87,null))['catch'](handleError(_0x45ee87,null));};exports[_0xd325('0xc5')]=function(_0x508beb,_0x3d89dc,_0x4f26de){var _0x1fc781={'raw':![],'where':{}};var _0x426853={};var _0x33440a={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x508beb[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x3d89dc,null))[_0xd325('0x23')](function(_0x3ce037){if(_0x3ce037){_0x426853[_0xd325('0x43')]=_['keys'](db[_0xd325('0xa2')][_0xd325('0x41')]);_0x426853[_0xd325('0x44')]=_[_0xd325('0x54')](_0x508beb[_0xd325('0x44')]);_0x426853[_0xd325('0x4c')]=_['intersection'](_0x426853['model'],_0x426853['query']);_0x1fc781[_0xd325('0x47')]=_[_0xd325('0x45')](_0x426853[_0xd325('0x43')],qs['fields'](_0x508beb[_0xd325('0x44')][_0xd325('0x46')]));_0x1fc781[_0xd325('0x47')]=_0x1fc781[_0xd325('0x47')][_0xd325('0x48')]?_0x1fc781[_0xd325('0x47')]:_0x426853[_0xd325('0x43')];if(!_0x508beb[_0xd325('0x44')]['hasOwnProperty'](_0xd325('0xc4'))){_0x1fc781[_0xd325('0x32')]=qs['limit'](_0x508beb['query']['limit']);_0x1fc781['offset']=qs[_0xd325('0x30')](_0x508beb['query'][_0xd325('0x30')]);}_0x1fc781[_0xd325('0x6c')]=qs[_0xd325('0x4a')](_0x508beb[_0xd325('0x44')][_0xd325('0x4a')]);_0x1fc781[_0xd325('0x4b')]=qs[_0xd325('0x4c')](_[_0xd325('0x66')](_0x508beb[_0xd325('0x44')],_0x426853[_0xd325('0x4c')]));_0x1fc781[_0xd325('0x4b')][_0xd325('0x62')]=_0x3ce037['id'];if(_0x508beb[_0xd325('0x44')][_0xd325('0x4d')]){_0x1fc781[_0xd325('0x4b')]=_[_0xd325('0x4e')](_0x1fc781[_0xd325('0x4b')],{'$or':_[_0xd325('0x3f')](_0x1fc781[_0xd325('0x47')],function(_0x59d48c){var _0x5b7913={};_0x5b7913[_0x59d48c]={'$like':'%'+_0x508beb[_0xd325('0x44')][_0xd325('0x4d')]+'%'};return _0x5b7913;})});}_0x1fc781=_[_0xd325('0x4e')]({},_0x1fc781,_0x508beb['options']);return db[_0xd325('0xa2')]['count']({'where':_0x1fc781[_0xd325('0x4b')]})['then'](function(_0x562428){_0x33440a[_0xd325('0x33')]=_0x562428;if(_0x508beb[_0xd325('0x44')]['includeAll']){_0x1fc781[_0xd325('0x51')]=[{'model':db[_0xd325('0x77')],'as':_0xd325('0xc6'),'required':![]},{'model':db['User'],'as':_0xd325('0xc7'),'attributes':['name',_0xd325('0xc8'),_0xd325('0xc9')],'required':![]},{'model':db[_0xd325('0xca')],'as':_0xd325('0xcb'),'attributes':['id',_0xd325('0x3b'),_0xd325('0xcc')],'where':_0x508beb[_0xd325('0x44')][_0xd325('0xcd')]?{'id':_0x508beb[_0xd325('0x44')]['tag']}:undefined,'required':_0x508beb[_0xd325('0x44')][_0xd325('0xcd')]?!![]:![]}];}return db[_0xd325('0xa2')][_0xd325('0x52')](_0x1fc781);})['then'](function(_0x2faf34){_0x33440a[_0xd325('0x67')]=_0x2faf34;return _0x33440a;});}})['then'](respondWithFilteredResult(_0x3d89dc,_0x1fc781))[_0xd325('0x2c')](handleError(_0x3d89dc,null));};exports['send']=function(_0x3e55d4,_0x5e2b7,_0x2d57ab){var _0x312b51,_0x26986a,_0x48f258;if(_[_0xd325('0x95')](_0x3e55d4[_0xd325('0x58')]['body'])||_0x3e55d4[_0xd325('0x58')][_0xd325('0x58')]===''){throw new db[(_0xd325('0x78'))][(_0xd325('0x98'))](_0xd325('0x97'));}if(_[_0xd325('0x95')](_0x3e55d4[_0xd325('0x58')]['to'])){throw new db[(_0xd325('0x78'))][(_0xd325('0x98'))](_0xd325('0xce'));}_0x312b51=_0x3e55d4['body']['to'];return db[_0xd325('0x40')][_0xd325('0x56')]({'where':{'id':_0x3e55d4[_0xd325('0x53')]['id']},'include':[{'model':db[_0xd325('0x9d')],'as':_0xd325('0xcf'),'include':[{'model':db['CmContact'],'as':_0xd325('0x9e'),'where':{'mobile':_0x312b51},'limit':0x1,'order':[[_0xd325('0xd0'),'DESC']]}]}]})[_0xd325('0x23')](handleEntityNotFound(_0x5e2b7,null))[_0xd325('0x23')](function(_0x4c15b1){if(_0x4c15b1&&_0x4c15b1[_0xd325('0xcf')]){_0x26986a=_0x4c15b1[_0xd325('0x59')]({'plain':!![]});if(_0x26986a['List']&&_0x26986a[_0xd325('0xcf')][_0xd325('0x9e')][_0xd325('0x48')]){return _0x26986a['List'][_0xd325('0x9e')][0x0];}return db[_0xd325('0x77')][_0xd325('0x57')](_[_0xd325('0x1a')](_0x3e55d4['body'],{'firstName':_0x312b51,'mobile':_0x312b51,'phone':_0x312b51,'ListId':_0x26986a[_0xd325('0x7c')]}));}})['then'](handleEntityNotFound(_0x5e2b7,null))[_0xd325('0x23')](function(_0x5d6b75){if(_0x5d6b75){_0x48f258=_0x5d6b75;return db['SmsInteraction'][_0xd325('0x56')]({'where':{'ContactId':_0x48f258['id'],'closed':![],'SmsAccountId':_0x26986a['id']}})[_0xd325('0x23')](function(_0x2695e3){if(_0x2695e3){return[_0x2695e3,![]];}return db[_0xd325('0xa2')]['create']({'UserId':_0x3e55d4[_0xd325('0x5b')]['id'],'ContactId':_0x48f258['id'],'SmsAccountId':_0x26986a['id'],'phone':_0x312b51,'firstMsgDirection':'out','Messages':[_[_0xd325('0x4e')](_0x3e55d4[_0xd325('0x58')],{'read':![],'body':_0x3e55d4[_0xd325('0x58')]['body'],'phone':_0x312b51,'SmsAccountId':_0x26986a['id'],'UserId':_0x3e55d4['user']['id'],'ContactId':_0x48f258['id']})]},{'include':[{'model':db[_0xd325('0xab')],'as':_0xd325('0xd1')}]})[_0xd325('0x23')](function(_0x5ef5ed){return[_0x5ef5ed,!![]];});});}})[_0xd325('0xa3')](function(_0x223caf,_0x5d2828){if(_0x5d2828){return _0x223caf;}return db[_0xd325('0xab')][_0xd325('0x57')](_[_0xd325('0x4e')](_0x3e55d4[_0xd325('0x58')],{'read':![],'body':_0x3e55d4['body'][_0xd325('0x58')],'phone':_0x312b51,'SmsAccountId':_0x26986a['id'],'SmsInteractionId':_0x223caf['id'],'UserId':_0x3e55d4[_0xd325('0x5b')]['id'],'ContactId':_0x48f258['id']}))['then'](function(_0x9fcd9d){_0x223caf['dataValues'][_0xd325('0xd1')]=[];_0x223caf['dataValues'][_0xd325('0xd1')][_0xd325('0xa7')](_0x9fcd9d[_0xd325('0xd2')]);return _0x223caf;});})[_0xd325('0x23')](respondWithResult(_0x5e2b7,null))[_0xd325('0x2c')](handleError(_0x5e2b7,null));};exports[_0xd325('0x2f')]=function(_0x191532,_0x2c0657,_0x494813){if(_0x191532['body']['id']){delete _0x191532['body']['id'];}var _0x30e810,_0x35fd84,_0x2e0bae;return db[_0xd325('0x40')][_0xd325('0x56')]({'where':{'id':_0x191532[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x2c0657,null))[_0xd325('0x23')](function(_0x1f1aac){if(_0x1f1aac){_0x2e0bae=_0x1f1aac;logger[_0xd325('0x25')](_0xd325('0x26'),_0xd325('0x2f'),_0xd325('0xd3'),_0x1f1aac['type'],util[_0xd325('0xd4')](_0x191532[_0xd325('0x58')],{'showHidden':![],'depth':null}));switch(_0x1f1aac[_0xd325('0x4f')]){case _0xd325('0x84'):if(_0x191532['body'][_0xd325('0xd5')]&&_0x191532[_0xd325('0x58')][_0xd325('0x2f')]){_0x35fd84=_0x191532['body']['status'];return db[_0xd325('0xab')]['find']({'where':{'messageId':_0x191532[_0xd325('0x58')][_0xd325('0xd5')]}});}break;case _0xd325('0x87'):if(_0x191532[_0xd325('0x58')][_0xd325('0xd6')]&&_0x191532[_0xd325('0x58')][_0xd325('0xd7')]){_0x35fd84=_0x191532['body'][_0xd325('0xd7')];return db[_0xd325('0xab')][_0xd325('0x56')]({'where':{'messageId':_0x191532[_0xd325('0x58')]['requestid']}});}break;case _0xd325('0x88'):if(_0x191532[_0xd325('0x58')][_0xd325('0x89')]&&_0x191532[_0xd325('0x58')][_0xd325('0xd8')]){_0x35fd84=_0x191532[_0xd325('0x58')][_0xd325('0xd8')];return db[_0xd325('0xab')]['find']({'where':{'messageId':_0x191532[_0xd325('0x58')][_0xd325('0x89')]}});}break;case _0xd325('0xd9'):var _0x3d7542=_0x191532['body'][_0xd325('0x8c')][0x0];if(_0x3d7542['messageId']&&_0x3d7542[_0xd325('0x2f')]['groupName']==='DELIVERED'){_0x35fd84=_0x3d7542['status']['groupName'];return db[_0xd325('0xab')][_0xd325('0x56')]({'where':{'messageId':_0x3d7542[_0xd325('0x82')]}});}break;case _0xd325('0x90'):if(_0x191532[_0xd325('0x58')]['messageId']&&_0x191532[_0xd325('0x58')]['status']){_0x35fd84=_0x191532['body'][_0xd325('0x2f')];return db[_0xd325('0xab')][_0xd325('0x56')]({'where':{'messageId':_0x191532[_0xd325('0x58')][_0xd325('0x82')]}});}break;case _0xd325('0xda'):if(_0x191532[_0xd325('0x58')][0x0]['message']['id']){_0x35fd84=_0x191532['body'][0x0][_0xd325('0x4f')];return db[_0xd325('0xab')][_0xd325('0x56')]({'where':{'messageId':_0x191532[_0xd325('0x58')][0x0][_0xd325('0x2a')]['id']}});}break;case _0xd325('0x93'):if(_0x191532[_0xd325('0x58')][_0xd325('0xdb')]&&_0x191532['body']['status']){_0x35fd84=_0x191532[_0xd325('0x58')][_0xd325('0x2f')];return db[_0xd325('0xab')][_0xd325('0x56')]({'where':{'messageId':_0x191532[_0xd325('0x58')]['redif']}});}break;}}})[_0xd325('0x23')](handleEntityNotFound(_0x2c0657,null))['then'](function(_0x317d47){if(_0x317d47){_0x30e810=_0x317d47;switch(_0x2e0bae[_0xd325('0x4f')]){case _0xd325('0x84'):if(_0x35fd84===_0xd325('0xdc')){return _0x30e810[_0xd325('0x36')]({'read':!![]});}else{logger[_0xd325('0x28')](_0xd325('0x26'),_0xd325('0x2f'),_0xd325('0x84'),util[_0xd325('0xd4')](_0x191532[_0xd325('0x58')],{'showHidden':![],'depth':null}));}break;case _0xd325('0x87'):if(_0x35fd84==='1'){return _0x30e810[_0xd325('0x36')]({'read':!![]});}else{logger[_0xd325('0x28')](_0xd325('0x26'),'status',_0xd325('0x84'),util[_0xd325('0xd4')](_0x191532[_0xd325('0x58')],{'showHidden':![],'depth':null}));}break;case _0xd325('0x88'):if(!_0x191532[_0xd325('0x58')][_0xd325('0xdd')]&&_0x35fd84>=0xc8&&_0x35fd84<=0xce){return _0x30e810[_0xd325('0x36')]({'read':!![]});}else{logger[_0xd325('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xd325('0x88'),util[_0xd325('0xd4')](_0x191532[_0xd325('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x48610a=_0x191532[_0xd325('0x58')]['results'][0x0];if(_0x48610a[_0xd325('0x2f')][_0xd325('0xde')]===_0xd325('0xdc')){return _0x30e810['update']({'read':!![]});}else{logger[_0xd325('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xd325('0xd9'),util[_0xd325('0xd4')](_0x191532['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x35fd84=='DELIVERED_TO_GATEWAY'||_0x35fd84==_0xd325('0xdf')){return _0x30e810[_0xd325('0x36')]({'read':!![]});}else{logger['error'](_0xd325('0x26'),_0xd325('0x2f'),_0xd325('0x90'),util['inspect'](_0x191532[_0xd325('0x58')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x35fd84==_0xd325('0xe0')){return _0x30e810[_0xd325('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd325('0x2f'),'bandwidth',util['inspect'](_0x191532[_0xd325('0x58')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x35fd84===_0xd325('0xe1')||_0x35fd84===_0xd325('0xe2')){return _0x30e810[_0xd325('0x36')]({'read':!![]});}else{logger['error'](_0xd325('0x26'),_0xd325('0x2f'),'intelepeer',util[_0xd325('0xd4')](_0x191532['body'],{'showHidden':![],'depth':null}));}break;}return _0x30e810;}})[_0xd325('0x23')](respondWithResult(_0x2c0657,null))[_0xd325('0x2c')](handleError(_0x2c0657,null));};exports[_0xd325('0xe3')]=function(_0x1f0802,_0x3c2f41,_0x5cc15b){var _0x14d52e,_0x1f9248,_0x78fbfb;return db[_0xd325('0x40')]['find']({'where':{'id':_0x1f0802['params']['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x3c2f41,null))[_0xd325('0x23')](function(_0x4e5bdd){if(_0x4e5bdd){_0x78fbfb=_0x4e5bdd;logger[_0xd325('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd325('0x2f'),_0xd325('0xd3'),_0x4e5bdd[_0xd325('0x4f')],util[_0xd325('0xd4')](_0x1f0802[_0xd325('0x44')],{'showHidden':![],'depth':null}));switch(_0x4e5bdd['type']){case _0xd325('0x8d'):if(_0x1f0802[_0xd325('0x44')][_0xd325('0xe4')]&&_0x1f0802['query'][_0xd325('0xe5')]){_0x1f9248=_0x1f0802[_0xd325('0x44')][_0xd325('0xe5')];return db['SmsMessage'][_0xd325('0x56')]({'where':{'messageId':_0x1f0802['query']['message-id']}});}break;}}})[_0xd325('0x23')](handleEntityNotFound(_0x3c2f41,null))[_0xd325('0x23')](function(_0x9d0280){if(_0x9d0280){_0x14d52e=_0x9d0280;switch(_0x78fbfb[_0xd325('0x4f')]){case _0xd325('0x8d'):if(_0x1f9248==='2'||_0x1f9248==='6'){return _0x14d52e[_0xd325('0x36')]({'read':!![]});}else{logger[_0xd325('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xd325('0x8d'),util[_0xd325('0xd4')](_0x1f0802[_0xd325('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x14d52e;}})[_0xd325('0x23')](respondWithResult(_0x3c2f41,null))[_0xd325('0x2c')](handleError(_0x3c2f41,null));};exports[_0xd325('0xe6')]=function(_0x1889c2,_0x29ea0e,_0x24558a){return db[_0xd325('0x40')][_0xd325('0x56')]({'where':{'id':_0x1889c2[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x29ea0e,null))['then'](function(_0x45d87d){if(_0x45d87d){return _0x45d87d['addAgents'](_0x1889c2['body'][_0xd325('0x69')],_[_0xd325('0xa0')](_0x1889c2['body'],['ids','id'])||{})[_0xd325('0xa3')](function(_0x1c2b59){for(var _0x15e39d=0x0;_0x15e39d<_0x1889c2[_0xd325('0x58')]['ids'][_0xd325('0x48')];_0x15e39d+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x1889c2[_0xd325('0x58')][_0xd325('0x69')][_0x15e39d]),'SmsAccountId':Number(_0x1889c2[_0xd325('0x53')]['id'])});}return _0x1c2b59;});}})['then'](respondWithResult(_0x29ea0e,null))[_0xd325('0x2c')](handleError(_0x29ea0e,null));};exports[_0xd325('0xe7')]=function(_0x1764c7,_0x5c8a7d,_0x1f5a8b){return db[_0xd325('0x40')][_0xd325('0x56')]({'where':{'id':_0x1764c7[_0xd325('0x53')]['id']}})[_0xd325('0x23')](handleEntityNotFound(_0x5c8a7d,null))['then'](function(_0x385c24){if(_0x385c24){return _0x385c24[_0xd325('0xe7')](_0x1764c7[_0xd325('0x44')][_0xd325('0x69')])[_0xd325('0x23')](function(){if(_[_0xd325('0xe8')](_0x1764c7[_0xd325('0x44')][_0xd325('0x69')])){for(var _0x314a84=0x0;_0x314a84<_0x1764c7['query'][_0xd325('0x69')][_0xd325('0x48')];_0x314a84+=0x1){socket['emit'](_0xd325('0xe9'),{'UserId':Number(_0x1764c7[_0xd325('0x44')][_0xd325('0x69')][_0x314a84]),'SmsAccountId':Number(_0x1764c7[_0xd325('0x53')]['id'])});}}else{socket[_0xd325('0xea')]('userSmsAccount:remove',{'UserId':Number(_0x1764c7[_0xd325('0x44')][_0xd325('0x69')]),'SmsAccountId':Number(_0x1764c7['params']['id'])});}});}})[_0xd325('0x23')](respondWithStatusCode(_0x5c8a7d,null))[_0xd325('0x2c')](handleError(_0x5c8a7d,null));};exports['getAgents']=function(_0x55c9a0,_0x529f14,_0x5ca1b0){var _0x4c54eb={};var _0x5b6061={};var _0x104b3d;var _0x327ad0;return db[_0xd325('0x40')][_0xd325('0x64')]({'where':{'id':_0x55c9a0[_0xd325('0x53')]['id']}})['then'](handleEntityNotFound(_0x529f14,null))['then'](function(_0x7a6ccb){if(_0x7a6ccb){_0x104b3d=_0x7a6ccb;_0x5b6061['model']=_[_0xd325('0x54')](db[_0xd325('0xaf')][_0xd325('0x41')]);_0x5b6061['query']=_[_0xd325('0x54')](_0x55c9a0[_0xd325('0x44')]);_0x5b6061[_0xd325('0x4c')]=_[_0xd325('0x45')](_0x5b6061[_0xd325('0x43')],_0x5b6061[_0xd325('0x44')]);_0x4c54eb[_0xd325('0x47')]=_[_0xd325('0x45')](_0x5b6061[_0xd325('0x43')],qs[_0xd325('0x46')](_0x55c9a0[_0xd325('0x44')][_0xd325('0x46')]));_0x4c54eb[_0xd325('0x47')]=_0x4c54eb[_0xd325('0x47')][_0xd325('0x48')]?_0x4c54eb[_0xd325('0x47')]:_0x5b6061[_0xd325('0x43')];_0x4c54eb[_0xd325('0x6c')]=qs['sort'](_0x55c9a0[_0xd325('0x44')][_0xd325('0x4a')]);_0x4c54eb[_0xd325('0x4b')]=qs[_0xd325('0x4c')](_[_0xd325('0x66')](_0x55c9a0[_0xd325('0x44')],_0x5b6061[_0xd325('0x4c')]));if(_0x55c9a0[_0xd325('0x44')][_0xd325('0x4d')]){_0x4c54eb[_0xd325('0x4b')]=_['merge'](_0x4c54eb['where'],{'$or':_[_0xd325('0x3f')](_0x4c54eb[_0xd325('0x47')],function(_0xa598e1){var _0x5f4ccd={};_0x5f4ccd[_0xa598e1]={'$like':'%'+_0x55c9a0[_0xd325('0x44')][_0xd325('0x4d')]+'%'};return _0x5f4ccd;})});}_0x4c54eb=_[_0xd325('0x4e')]({},_0x4c54eb,_0x55c9a0[_0xd325('0x55')]);return _0x104b3d[_0xd325('0xeb')](_0x4c54eb);}})['then'](function(_0xb49de1){if(_0xb49de1){_0x327ad0=_0xb49de1[_0xd325('0x48')];if(!_0x55c9a0['query'][_0xd325('0x49')](_0xd325('0xc4'))){_0x4c54eb[_0xd325('0x32')]=qs['limit'](_0x55c9a0[_0xd325('0x44')][_0xd325('0x32')]);_0x4c54eb[_0xd325('0x30')]=qs[_0xd325('0x30')](_0x55c9a0[_0xd325('0x44')][_0xd325('0x30')]);}return _0x104b3d[_0xd325('0xeb')](_0x4c54eb);}})[_0xd325('0x23')](function(_0x572718){if(_0x572718){return _0x572718?{'count':_0x327ad0,'rows':_0x572718}:null;}})[_0xd325('0x23')](respondWithResult(_0x529f14,null))[_0xd325('0x2c')](handleError(_0x529f14,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 5e4b052..a48dbdb 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 _0x8f06=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x4b2c74,_0x50760a){var _0x20f267=function(_0x100bf7){while(--_0x100bf7){_0x4b2c74['push'](_0x4b2c74['shift']());}};_0x20f267(++_0x50760a);}(_0x8f06,0x1a0));var _0x68f0=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x8f06[_0x1035c1];return _0x308d67;};'use strict';var EventEmitter=require(_0x68f0('0x0'));var SmsAccount=require(_0x68f0('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x68f0('0x2')](0x0);var events={'afterCreate':_0x68f0('0x3'),'afterUpdate':'update','afterDestroy':_0x68f0('0x4')};function emitEvent(_0x482ecb){return function(_0x1c32b6,_0x91723f,_0x1b3d3e){SmsAccountEvents[_0x68f0('0x5')](_0x482ecb+':'+_0x1c32b6['id'],_0x1c32b6);SmsAccountEvents['emit'](_0x482ecb,_0x1c32b6);_0x1b3d3e(null);};}for(var e in events){if(events[_0x68f0('0x6')](e)){var event=events[e];SmsAccount[_0x68f0('0x7')](e,emitEvent(event));}}module[_0x68f0('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x3905=['../../mysqldb','SmsAccount','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x79ca66,_0x41e29f){var _0x31040f=function(_0x335c35){while(--_0x335c35){_0x79ca66['push'](_0x79ca66['shift']());}};_0x31040f(++_0x41e29f);}(_0x3905,0x1cf));var _0x5390=function(_0x3d34da,_0x3abcc1){_0x3d34da=_0x3d34da-0x0;var _0xcf6af8=_0x3905[_0x3d34da];return _0xcf6af8;};'use strict';var EventEmitter=require(_0x5390('0x0'));var SmsAccount=require(_0x5390('0x1'))['db'][_0x5390('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5390('0x3'),'afterUpdate':'update','afterDestroy':_0x5390('0x4')};function emitEvent(_0x40b39e){return function(_0x3d199a,_0x58d78d,_0x37a7ac){SmsAccountEvents[_0x5390('0x5')](_0x40b39e+':'+_0x3d199a['id'],_0x3d199a);SmsAccountEvents[_0x5390('0x5')](_0x40b39e,_0x3d199a);_0x37a7ac(null);};}for(var e in events){if(events[_0x5390('0x6')](e)){var event=events[e];SmsAccount[_0x5390('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 fc4d027..30bba37 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 _0x0455=['SmsAccount','sms_accounts','api','moment','bluebird','request-promise','path','rimraf','./smsAccount.attributes','exports','define'];(function(_0xe2bdcf,_0x2f5331){var _0x21f980=function(_0x48ef08){while(--_0x48ef08){_0xe2bdcf['push'](_0xe2bdcf['shift']());}};_0x21f980(++_0x2f5331);}(_0x0455,0x141));var _0x5045=function(_0x50da31,_0x1caf43){_0x50da31=_0x50da31-0x0;var _0x416ff0=_0x0455[_0x50da31];return _0x416ff0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5045('0x0'));var moment=require(_0x5045('0x1'));var BPromise=require(_0x5045('0x2'));var rp=require(_0x5045('0x3'));var fs=require('fs');var path=require(_0x5045('0x4'));var rimraf=require(_0x5045('0x5'));var config=require('../../config/environment');var attributes=require(_0x5045('0x6'));module[_0x5045('0x7')]=function(_0x93fe75,_0x200e25){return _0x93fe75[_0x5045('0x8')](_0x5045('0x9'),attributes,{'tableName':_0x5045('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f65=['sms_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','exports','define'];(function(_0x559ff5,_0x389fda){var _0x51483e=function(_0x1ce5f3){while(--_0x1ce5f3){_0x559ff5['push'](_0x559ff5['shift']());}};_0x51483e(++_0x389fda);}(_0x2f65,0xf1));var _0x52f6=function(_0x3fe5de,_0x515efa){_0x3fe5de=_0x3fe5de-0x0;var _0x500a65=_0x2f65[_0x3fe5de];return _0x500a65;};'use strict';var _=require(_0x52f6('0x0'));var util=require(_0x52f6('0x1'));var logger=require(_0x52f6('0x2'))('api');var moment=require(_0x52f6('0x3'));var BPromise=require(_0x52f6('0x4'));var rp=require(_0x52f6('0x5'));var fs=require('fs');var path=require(_0x52f6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0x52f6('0x7')]=function(_0x3d1035,_0x1e1692){return _0x3d1035[_0x52f6('0x8')]('SmsAccount',attributes,{'tableName':_0x52f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 62cfccf..c57343d 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 _0xf99c=['localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','map','model','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0xd994f7,_0x588a0c){var _0x259e7c=function(_0x2293fa){while(--_0x2293fa){_0xd994f7['push'](_0xd994f7['shift']());}};_0x259e7c(++_0x588a0c);}(_0xf99c,0x11b));var _0xcf99=function(_0x1d7b0f,_0x5b62e4){_0x1d7b0f=_0x1d7b0f-0x0;var _0x3f4b25=_0xf99c[_0x1d7b0f];return _0x3f4b25;};'use strict';var _=require(_0xcf99('0x0'));var util=require(_0xcf99('0x1'));var moment=require(_0xcf99('0x2'));var BPromise=require('bluebird');var rs=require(_0xcf99('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf99('0x4'))['db'];var utils=require(_0xcf99('0x5'));var logger=require(_0xcf99('0x6'))('rpc');var config=require(_0xcf99('0x7'));var jayson=require(_0xcf99('0x8'));var client=jayson[_0xcf99('0x9')][_0xcf99('0xa')]({'port':0x232a});config[_0xcf99('0xb')]=_[_0xcf99('0xc')](config['redis'],{'host':_0xcf99('0xd'),'port':0x18eb});var socket=require(_0xcf99('0xe'))(new Redis(config[_0xcf99('0xb')]));require(_0xcf99('0xf'))['register'](socket);function respondWithRpcPromise(_0x3536dd,_0x118c4a,_0x4b56d3){return new BPromise(function(_0x4472e8,_0x1765b5){return client[_0xcf99('0x10')](_0x3536dd,_0x4b56d3)[_0xcf99('0x11')](function(_0x23e53a){logger[_0xcf99('0x12')](_0xcf99('0x13'),_0x118c4a,_0xcf99('0x14'));logger[_0xcf99('0x15')](_0xcf99('0x16'),_0x118c4a,_0xcf99('0x14'),JSON[_0xcf99('0x17')](_0x23e53a));if(_0x23e53a[_0xcf99('0x18')]){if(_0x23e53a['error'][_0xcf99('0x19')]===0x1f4){logger[_0xcf99('0x18')](_0xcf99('0x13'),_0x118c4a,_0x23e53a['error']['message']);return _0x1765b5(_0x23e53a['error'][_0xcf99('0x1a')]);}logger[_0xcf99('0x18')](_0xcf99('0x13'),_0x118c4a,_0x23e53a[_0xcf99('0x18')][_0xcf99('0x1a')]);return _0x4472e8(_0x23e53a[_0xcf99('0x18')]['message']);}else{logger[_0xcf99('0x12')](_0xcf99('0x13'),_0x118c4a,'request\x20sent');_0x4472e8(_0x23e53a['result'][_0xcf99('0x1a')]);}})[_0xcf99('0x1b')](function(_0x6ab0de){logger[_0xcf99('0x18')](_0xcf99('0x13'),_0x118c4a,_0x6ab0de);_0x1765b5(_0x6ab0de);});});}exports[_0xcf99('0x1c')]=function(_0x499861){var _0x209061=this;return new Promise(function(_0x594ad4,_0x3a7b17){return db[_0xcf99('0x1d')][_0xcf99('0x1e')]({'raw':_0x499861[_0xcf99('0x1f')]?_0x499861[_0xcf99('0x1f')][_0xcf99('0x20')]===undefined?!![]:![]:!![],'where':_0x499861['options']?_0x499861[_0xcf99('0x1f')]['where']||null:null,'attributes':_0x499861['options']?_0x499861['options'][_0xcf99('0x21')]||null:null,'include':_0x499861['options']?_0x499861[_0xcf99('0x1f')][_0xcf99('0x22')]?_[_0xcf99('0x23')](_0x499861[_0xcf99('0x1f')]['include'],function(_0x2ed19f){return{'model':db[_0x2ed19f[_0xcf99('0x24')]],'as':_0x2ed19f['as'],'attributes':_0x2ed19f[_0xcf99('0x21')],'include':_0x2ed19f[_0xcf99('0x22')]?_[_0xcf99('0x23')](_0x2ed19f['include'],function(_0x21b2a7){return{'model':db[_0x21b2a7[_0xcf99('0x24')]],'as':_0x21b2a7['as'],'attributes':_0x21b2a7[_0xcf99('0x21')],'include':_0x21b2a7[_0xcf99('0x22')]?_['map'](_0x21b2a7['include'],function(_0x3f2f93){return{'model':db[_0x3f2f93[_0xcf99('0x24')]],'as':_0x3f2f93['as'],'attributes':_0x3f2f93['attributes']};}):[]};}):[]};}):[]:[]})[_0xcf99('0x11')](function(_0x317a1c){logger[_0xcf99('0x12')](_0xcf99('0x1c'),_0x499861);logger[_0xcf99('0x15')]('ShowSmsAccount',_0x499861,JSON[_0xcf99('0x17')](_0x317a1c));_0x594ad4(_0x317a1c);})[_0xcf99('0x1b')](function(_0x163d9f){logger[_0xcf99('0x18')](_0xcf99('0x1c'),_0x163d9f[_0xcf99('0x1a')],_0x499861);_0x3a7b17(_0x209061[_0xcf99('0x18')](0x1f4,_0x163d9f[_0xcf99('0x1a')]));});});}; \ No newline at end of file +var _0x07d0=['localhost','./smsAccount.socket','register','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','options','raw','where','attributes','include','map','model','then','debug','ShowSmsAccount','lodash','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x1bbaa3,_0x15f691){var _0x5062dd=function(_0x2ef7c0){while(--_0x2ef7c0){_0x1bbaa3['push'](_0x1bbaa3['shift']());}};_0x5062dd(++_0x15f691);}(_0x07d0,0x176));var _0x007d=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x07d0[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0x007d('0x0'));var util=require('util');var moment=require(_0x007d('0x1'));var BPromise=require('bluebird');var rs=require(_0x007d('0x2'));var fs=require('fs');var Redis=require(_0x007d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x007d('0x4'));var config=require(_0x007d('0x5'));var jayson=require(_0x007d('0x6'));var client=jayson['client'][_0x007d('0x7')]({'port':0x232a});config[_0x007d('0x8')]=_[_0x007d('0x9')](config['redis'],{'host':_0x007d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x007d('0x8')]));require(_0x007d('0xb'))[_0x007d('0xc')](socket);function respondWithRpcPromise(_0x438ae9,_0x9c4a17,_0x1b8db1){return new BPromise(function(_0x56a6f1,_0x1771a1){return client['request'](_0x438ae9,_0x1b8db1)['then'](function(_0x287530){logger['info'](_0x007d('0xd'),_0x9c4a17,_0x007d('0xe'));logger['debug'](_0x007d('0xf'),_0x9c4a17,_0x007d('0xe'),JSON[_0x007d('0x10')](_0x287530));if(_0x287530[_0x007d('0x11')]){if(_0x287530['error'][_0x007d('0x12')]===0x1f4){logger['error'](_0x007d('0xd'),_0x9c4a17,_0x287530[_0x007d('0x11')][_0x007d('0x13')]);return _0x1771a1(_0x287530[_0x007d('0x11')][_0x007d('0x13')]);}logger[_0x007d('0x11')](_0x007d('0xd'),_0x9c4a17,_0x287530['error'][_0x007d('0x13')]);return _0x56a6f1(_0x287530[_0x007d('0x11')][_0x007d('0x13')]);}else{logger[_0x007d('0x14')](_0x007d('0xd'),_0x9c4a17,_0x007d('0xe'));_0x56a6f1(_0x287530['result']['message']);}})[_0x007d('0x15')](function(_0x13202f){logger['error'](_0x007d('0xd'),_0x9c4a17,_0x13202f);_0x1771a1(_0x13202f);});});}exports['ShowSmsAccount']=function(_0x3b1b92){var _0x270aee=this;return new Promise(function(_0x1a8656,_0x4bd859){return db['SmsAccount']['find']({'raw':_0x3b1b92[_0x007d('0x16')]?_0x3b1b92[_0x007d('0x16')][_0x007d('0x17')]===undefined?!![]:![]:!![],'where':_0x3b1b92[_0x007d('0x16')]?_0x3b1b92[_0x007d('0x16')][_0x007d('0x18')]||null:null,'attributes':_0x3b1b92[_0x007d('0x16')]?_0x3b1b92[_0x007d('0x16')][_0x007d('0x19')]||null:null,'include':_0x3b1b92[_0x007d('0x16')]?_0x3b1b92[_0x007d('0x16')][_0x007d('0x1a')]?_[_0x007d('0x1b')](_0x3b1b92[_0x007d('0x16')][_0x007d('0x1a')],function(_0x3580e2){return{'model':db[_0x3580e2[_0x007d('0x1c')]],'as':_0x3580e2['as'],'attributes':_0x3580e2[_0x007d('0x19')],'include':_0x3580e2[_0x007d('0x1a')]?_[_0x007d('0x1b')](_0x3580e2[_0x007d('0x1a')],function(_0x326190){return{'model':db[_0x326190[_0x007d('0x1c')]],'as':_0x326190['as'],'attributes':_0x326190[_0x007d('0x19')],'include':_0x326190['include']?_['map'](_0x326190[_0x007d('0x1a')],function(_0x2a1182){return{'model':db[_0x2a1182['model']],'as':_0x2a1182['as'],'attributes':_0x2a1182['attributes']};}):[]};}):[]};}):[]:[]})[_0x007d('0x1d')](function(_0x78bc0c){logger[_0x007d('0x14')]('ShowSmsAccount',_0x3b1b92);logger[_0x007d('0x1e')](_0x007d('0x1f'),_0x3b1b92,JSON[_0x007d('0x10')](_0x78bc0c));_0x1a8656(_0x78bc0c);})[_0x007d('0x15')](function(_0x2940b5){logger['error'](_0x007d('0x1f'),_0x2940b5[_0x007d('0x13')],_0x3b1b92);_0x4bd859(_0x270aee[_0x007d('0x11')](0x1f4,_0x2940b5[_0x007d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 34fd548..470153a 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 f22be28..505972c 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 _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x34d993,_0x3c7017){var _0x4728c7=function(_0x12f5ca){while(--_0x12f5ca){_0x34d993['push'](_0x34d993['shift']());}};_0x4728c7(++_0x3c7017);}(_0x3e74,0x175));var _0x43e7=function(_0x3d62a0,_0x3457f7){_0x3d62a0=_0x3d62a0-0x0;var _0x2f45cf=_0x3e74[_0x3d62a0];return _0x2f45cf;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1debf5,_0x515f87){var _0x5a67d5=function(_0x34afc2){while(--_0x34afc2){_0x1debf5['push'](_0x1debf5['shift']());}};_0x5a67d5(++_0x515f87);}(_0xedd9,0xfc));var _0x9edd=function(_0x6b23ea,_0x22072f){_0x6b23ea=_0x6b23ea-0x0;var _0x499d84=_0xedd9[_0x6b23ea];return _0x499d84;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 3fffdf6..60838b0 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 _0xea43=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xea43,0xbf));var _0x3ea4=function(_0x56a7e1,_0x9994b5){_0x56a7e1=_0x56a7e1-0x0;var _0x511069=_0xea43[_0x56a7e1];return _0x511069;};'use strict';var Sequelize=require(_0x3ea4('0x0'));module[_0x3ea4('0x1')]={'priority':{'type':Sequelize[_0x3ea4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3ea4('0x3')],'allowNull':![],'defaultValue':_0x3ea4('0x4')},'appdata':{'type':Sequelize[_0x3ea4('0x5')]()},'description':{'type':Sequelize[_0x3ea4('0x3')]},'interval':{'type':Sequelize[_0x3ea4('0x3')],'defaultValue':_0x3ea4('0x6')}}; \ No newline at end of file +var _0xf889=['noop','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x2601cc,_0x1f9649){var _0x279990=function(_0x218c68){while(--_0x218c68){_0x2601cc['push'](_0x2601cc['shift']());}};_0x279990(++_0x1f9649);}(_0xf889,0x115));var _0x9f88=function(_0x40cc74,_0x4ee029){_0x40cc74=_0x40cc74-0x0;var _0x40dde4=_0xf889[_0x40cc74];return _0x40dde4;};'use strict';var Sequelize=require(_0x9f88('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9f88('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9f88('0x2')],'allowNull':![],'defaultValue':_0x9f88('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9f88('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9f88('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index a5551a4..fb6d108 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 _0xb66f=['send','index','map','SmsApplication','rawAttributes','fieldName','model','query','filters','attributes','fields','length','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','intersection','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','destroy','then','error','stack','name'];(function(_0x480385,_0x4e2ad1){var _0x3170ae=function(_0x17d531){while(--_0x17d531){_0x480385['push'](_0x480385['shift']());}};_0x3170ae(++_0x4e2ad1);}(_0xb66f,0x14e));var _0xfb66=function(_0x15483b,_0x3b9e92){_0x15483b=_0x15483b-0x0;var _0x90fa=_0xb66f[_0x15483b];return _0x90fa;};'use strict';var emlformat=require(_0xfb66('0x0'));var rimraf=require(_0xfb66('0x1'));var zipdir=require(_0xfb66('0x2'));var jsonpatch=require(_0xfb66('0x3'));var rp=require('request-promise');var moment=require(_0xfb66('0x4'));var BPromise=require(_0xfb66('0x5'));var Mustache=require(_0xfb66('0x6'));var util=require(_0xfb66('0x7'));var path=require(_0xfb66('0x8'));var sox=require(_0xfb66('0x9'));var csv=require(_0xfb66('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb66('0xb'));var squel=require(_0xfb66('0xc'));var crypto=require(_0xfb66('0xd'));var jsforce=require(_0xfb66('0xe'));var deskjs=require(_0xfb66('0xf'));var toCsv=require(_0xfb66('0xa'));var querystring=require(_0xfb66('0x10'));var Papa=require(_0xfb66('0x11'));var Redis=require('ioredis');var authService=require(_0xfb66('0x12'));var qs=require(_0xfb66('0x13'));var as=require(_0xfb66('0x14'));var hardwareService=require(_0xfb66('0x15'));var logger=require('../../config/logger')(_0xfb66('0x16'));var utils=require('../../config/utils');var config=require(_0xfb66('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfb66('0x18'))['db'];function respondWithStatusCode(_0x251d8d,_0x315226){_0x315226=_0x315226||0xcc;return function(_0x2b8791){if(_0x2b8791){return _0x251d8d[_0xfb66('0x19')](_0x315226);}return _0x251d8d['status'](_0x315226)[_0xfb66('0x1a')]();};}function respondWithResult(_0x2b1538,_0x244e55){_0x244e55=_0x244e55||0xc8;return function(_0x27a8e9){if(_0x27a8e9){return _0x2b1538[_0xfb66('0x1b')](_0x244e55)[_0xfb66('0x1c')](_0x27a8e9);}};}function respondWithFilteredResult(_0x218ffb,_0x11a2e7){return function(_0x383d2a){if(_0x383d2a){var _0x41e7a5=typeof _0x11a2e7[_0xfb66('0x1d')]===_0xfb66('0x1e')&&typeof _0x11a2e7[_0xfb66('0x1f')]===_0xfb66('0x1e');var _0xfc63a8=_0x383d2a[_0xfb66('0x20')];var _0x40abbd=_0x41e7a5?0x0:_0x11a2e7[_0xfb66('0x1d')];var _0xf242af=_0x41e7a5?_0x383d2a[_0xfb66('0x20')]:_0x11a2e7[_0xfb66('0x1d')]+_0x11a2e7[_0xfb66('0x1f')];var _0x45b0d7;if(_0xf242af>=_0xfc63a8){_0xf242af=_0xfc63a8;_0x45b0d7=0xc8;}else{_0x45b0d7=0xce;}_0x218ffb['status'](_0x45b0d7);return _0x218ffb['set'](_0xfb66('0x21'),_0x40abbd+'-'+_0xf242af+'/'+_0xfc63a8)[_0xfb66('0x1c')](_0x383d2a);}return null;};}function patchUpdates(_0x4bb089){return function(_0x187960){try{jsonpatch[_0xfb66('0x22')](_0x187960,_0x4bb089,!![]);}catch(_0x172b57){return BPromise['reject'](_0x172b57);}return _0x187960[_0xfb66('0x23')]();};}function saveUpdates(_0x1eca15,_0x2b9d3e){return function(_0x267250){if(_0x267250){return _0x267250['update'](_0x1eca15)['then'](function(_0x3cd58f){return _0x3cd58f;});}return null;};}function removeEntity(_0x59adbe,_0x2f5ec4){return function(_0x3357d0){if(_0x3357d0){return _0x3357d0[_0xfb66('0x24')]()[_0xfb66('0x25')](function(){_0x59adbe[_0xfb66('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x211148,_0xf880f0){return function(_0x17e3df){if(!_0x17e3df){_0x211148['sendStatus'](0x194);}return _0x17e3df;};}function handleError(_0x4c5802,_0x3f4605){_0x3f4605=_0x3f4605||0x1f4;return function(_0x30ee43){logger[_0xfb66('0x26')](_0x30ee43[_0xfb66('0x27')]);if(_0x30ee43['name']){delete _0x30ee43[_0xfb66('0x28')];}_0x4c5802[_0xfb66('0x1b')](_0x3f4605)[_0xfb66('0x29')](_0x30ee43);};}exports[_0xfb66('0x2a')]=function(_0x1733fd,_0x401ec2){var _0x28b293={},_0x453c22={},_0x4ff89={'count':0x0,'rows':[]};var _0x25a8aa=_[_0xfb66('0x2b')](db[_0xfb66('0x2c')][_0xfb66('0x2d')],function(_0x62e8ae){return{'name':_0x62e8ae[_0xfb66('0x2e')],'type':_0x62e8ae['type']['key']};});_0x453c22[_0xfb66('0x2f')]=_[_0xfb66('0x2b')](_0x25a8aa,_0xfb66('0x28'));_0x453c22[_0xfb66('0x30')]=_['keys'](_0x1733fd[_0xfb66('0x30')]);_0x453c22[_0xfb66('0x31')]=_['intersection'](_0x453c22[_0xfb66('0x2f')],_0x453c22['query']);_0x28b293[_0xfb66('0x32')]=_['intersection'](_0x453c22[_0xfb66('0x2f')],qs[_0xfb66('0x33')](_0x1733fd['query']['fields']));_0x28b293[_0xfb66('0x32')]=_0x28b293[_0xfb66('0x32')][_0xfb66('0x34')]?_0x28b293[_0xfb66('0x32')]:_0x453c22[_0xfb66('0x2f')];if(!_0x1733fd[_0xfb66('0x30')]['hasOwnProperty']('nolimit')){_0x28b293[_0xfb66('0x1f')]=qs[_0xfb66('0x1f')](_0x1733fd[_0xfb66('0x30')][_0xfb66('0x1f')]);_0x28b293[_0xfb66('0x1d')]=qs[_0xfb66('0x1d')](_0x1733fd[_0xfb66('0x30')][_0xfb66('0x1d')]);}_0x28b293[_0xfb66('0x35')]=qs['sort'](_0x1733fd['query'][_0xfb66('0x36')]);_0x28b293['where']=qs['filters'](_[_0xfb66('0x37')](_0x1733fd['query'],_0x453c22['filters']),_0x25a8aa);if(_0x1733fd[_0xfb66('0x30')][_0xfb66('0x38')]){_0x28b293[_0xfb66('0x39')]=_['merge'](_0x28b293[_0xfb66('0x39')],{'$or':_[_0xfb66('0x2b')](_0x25a8aa,function(_0xaa028a){if(_0xaa028a[_0xfb66('0x3a')]!==_0xfb66('0x3b')){var _0x26ceb2={};_0x26ceb2[_0xaa028a[_0xfb66('0x28')]]={'$like':'%'+_0x1733fd['query']['filter']+'%'};return _0x26ceb2;}})});}_0x28b293=_[_0xfb66('0x3c')]({},_0x28b293,_0x1733fd[_0xfb66('0x3d')]);var _0x4d3697={'where':_0x28b293['where']};return db[_0xfb66('0x2c')]['count'](_0x4d3697)[_0xfb66('0x25')](function(_0x13312f){_0x4ff89['count']=_0x13312f;if(_0x1733fd[_0xfb66('0x30')][_0xfb66('0x3e')]){_0x28b293[_0xfb66('0x3f')]=[{'all':!![]}];}return db[_0xfb66('0x2c')][_0xfb66('0x40')](_0x28b293);})[_0xfb66('0x25')](function(_0x224f5e){_0x4ff89[_0xfb66('0x41')]=_0x224f5e;return _0x4ff89;})['then'](respondWithFilteredResult(_0x401ec2,_0x28b293))['catch'](handleError(_0x401ec2,null));};exports[_0xfb66('0x42')]=function(_0x1bc2af,_0x2a4059){var _0x4696f0={'raw':!![],'where':{'id':_0x1bc2af[_0xfb66('0x43')]['id']}},_0x1a8065={};_0x1a8065[_0xfb66('0x2f')]=_[_0xfb66('0x44')](db[_0xfb66('0x2c')][_0xfb66('0x2d')]);_0x1a8065['query']=_['keys'](_0x1bc2af[_0xfb66('0x30')]);_0x1a8065[_0xfb66('0x31')]=_[_0xfb66('0x45')](_0x1a8065[_0xfb66('0x2f')],_0x1a8065[_0xfb66('0x30')]);_0x4696f0[_0xfb66('0x32')]=_[_0xfb66('0x45')](_0x1a8065['model'],qs[_0xfb66('0x33')](_0x1bc2af['query']['fields']));_0x4696f0[_0xfb66('0x32')]=_0x4696f0[_0xfb66('0x32')]['length']?_0x4696f0[_0xfb66('0x32')]:_0x1a8065[_0xfb66('0x2f')];if(_0x1bc2af[_0xfb66('0x30')][_0xfb66('0x3e')]){_0x4696f0['include']=[{'all':!![]}];}_0x4696f0=_[_0xfb66('0x3c')]({},_0x4696f0,_0x1bc2af['options']);return db[_0xfb66('0x2c')][_0xfb66('0x46')](_0x4696f0)[_0xfb66('0x25')](handleEntityNotFound(_0x2a4059,null))[_0xfb66('0x25')](respondWithResult(_0x2a4059,null))[_0xfb66('0x47')](handleError(_0x2a4059,null));};exports['create']=function(_0x3754b6,_0x13d587){return db['SmsApplication'][_0xfb66('0x48')](_0x3754b6[_0xfb66('0x49')],{})[_0xfb66('0x25')](respondWithResult(_0x13d587,0xc9))[_0xfb66('0x47')](handleError(_0x13d587,null));};exports[_0xfb66('0x4a')]=function(_0xd6cc08,_0x189cc0){if(_0xd6cc08[_0xfb66('0x49')]['id']){delete _0xd6cc08[_0xfb66('0x49')]['id'];}return db['SmsApplication'][_0xfb66('0x46')]({'where':{'id':_0xd6cc08[_0xfb66('0x43')]['id']}})[_0xfb66('0x25')](handleEntityNotFound(_0x189cc0,null))[_0xfb66('0x25')](saveUpdates(_0xd6cc08['body'],null))[_0xfb66('0x25')](respondWithResult(_0x189cc0,null))['catch'](handleError(_0x189cc0,null));};exports[_0xfb66('0x24')]=function(_0x284452,_0x2c984d){return db[_0xfb66('0x2c')][_0xfb66('0x46')]({'where':{'id':_0x284452[_0xfb66('0x43')]['id']}})[_0xfb66('0x25')](handleEntityNotFound(_0x2c984d,null))['then'](removeEntity(_0x2c984d,null))[_0xfb66('0x47')](handleError(_0x2c984d,null));}; \ No newline at end of file +var _0x35f6=['fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','rows','catch','show','params','keys','include','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x236db6,_0x2796fb){var _0x48487a=function(_0xda7ab6){while(--_0xda7ab6){_0x236db6['push'](_0x236db6['shift']());}};_0x48487a(++_0x2796fb);}(_0x35f6,0x1a0));var _0x635f=function(_0x17f704,_0x53d2aa){_0x17f704=_0x17f704-0x0;var _0x1295d1=_0x35f6[_0x17f704];return _0x1295d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x635f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x635f('0x1'));var rp=require(_0x635f('0x2'));var moment=require(_0x635f('0x3'));var BPromise=require(_0x635f('0x4'));var Mustache=require(_0x635f('0x5'));var util=require(_0x635f('0x6'));var path=require('path');var sox=require(_0x635f('0x7'));var csv=require(_0x635f('0x8'));var ejs=require(_0x635f('0x9'));var fs=require('fs');var fs_extra=require(_0x635f('0xa'));var _=require(_0x635f('0xb'));var squel=require(_0x635f('0xc'));var crypto=require('crypto');var jsforce=require(_0x635f('0xd'));var deskjs=require(_0x635f('0xe'));var toCsv=require(_0x635f('0x8'));var querystring=require('querystring');var Papa=require(_0x635f('0xf'));var Redis=require('ioredis');var authService=require(_0x635f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x635f('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x635f('0x12'));var config=require(_0x635f('0x13'));var licenseUtil=require(_0x635f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3967f1,_0xffd262){_0xffd262=_0xffd262||0xcc;return function(_0x557129){if(_0x557129){return _0x3967f1[_0x635f('0x15')](_0xffd262);}return _0x3967f1[_0x635f('0x16')](_0xffd262)[_0x635f('0x17')]();};}function respondWithResult(_0x50f164,_0x5c0bd9){_0x5c0bd9=_0x5c0bd9||0xc8;return function(_0xad6a16){if(_0xad6a16){return _0x50f164[_0x635f('0x16')](_0x5c0bd9)[_0x635f('0x18')](_0xad6a16);}};}function respondWithFilteredResult(_0x2be979,_0x5c33c0){return function(_0x3ad05a){if(_0x3ad05a){var _0x10e13b=typeof _0x5c33c0[_0x635f('0x19')]===_0x635f('0x1a')&&typeof _0x5c33c0[_0x635f('0x1b')]==='undefined';var _0x2b2961=_0x3ad05a['count'];var _0x125fa3=_0x10e13b?0x0:_0x5c33c0['offset'];var _0x45389b=_0x10e13b?_0x3ad05a['count']:_0x5c33c0[_0x635f('0x19')]+_0x5c33c0[_0x635f('0x1b')];var _0x375c6a;if(_0x45389b>=_0x2b2961){_0x45389b=_0x2b2961;_0x375c6a=0xc8;}else{_0x375c6a=0xce;}_0x2be979[_0x635f('0x16')](_0x375c6a);return _0x2be979[_0x635f('0x1c')](_0x635f('0x1d'),_0x125fa3+'-'+_0x45389b+'/'+_0x2b2961)[_0x635f('0x18')](_0x3ad05a);}return null;};}function patchUpdates(_0x1c8b32){return function(_0xda809b){try{jsonpatch[_0x635f('0x1e')](_0xda809b,_0x1c8b32,!![]);}catch(_0x1e5418){return BPromise[_0x635f('0x1f')](_0x1e5418);}return _0xda809b[_0x635f('0x20')]();};}function saveUpdates(_0x1b174c,_0x56b81e){return function(_0x5bbe25){if(_0x5bbe25){return _0x5bbe25[_0x635f('0x21')](_0x1b174c)[_0x635f('0x22')](function(_0x9ec31){return _0x9ec31;});}return null;};}function removeEntity(_0x5e4f68,_0x39ab7f){return function(_0x2edd38){if(_0x2edd38){return _0x2edd38['destroy']()[_0x635f('0x22')](function(){_0x5e4f68['status'](0xcc)[_0x635f('0x17')]();});}};}function handleEntityNotFound(_0x2896fe,_0x1b31ac){return function(_0x639ac6){if(!_0x639ac6){_0x2896fe[_0x635f('0x15')](0x194);}return _0x639ac6;};}function handleError(_0x21a61c,_0x526077){_0x526077=_0x526077||0x1f4;return function(_0x1cc21b){logger[_0x635f('0x23')](_0x1cc21b[_0x635f('0x24')]);if(_0x1cc21b['name']){delete _0x1cc21b[_0x635f('0x25')];}_0x21a61c[_0x635f('0x16')](_0x526077)[_0x635f('0x26')](_0x1cc21b);};}exports[_0x635f('0x27')]=function(_0x40fde7,_0xf92676){var _0x2a9bc9={},_0x5df312={},_0x13ffea={'count':0x0,'rows':[]};var _0x409e1c=_[_0x635f('0x28')](db[_0x635f('0x29')][_0x635f('0x2a')],function(_0x632009){return{'name':_0x632009[_0x635f('0x2b')],'type':_0x632009[_0x635f('0x2c')][_0x635f('0x2d')]};});_0x5df312[_0x635f('0x2e')]=_[_0x635f('0x28')](_0x409e1c,_0x635f('0x25'));_0x5df312['query']=_['keys'](_0x40fde7[_0x635f('0x2f')]);_0x5df312['filters']=_[_0x635f('0x30')](_0x5df312[_0x635f('0x2e')],_0x5df312['query']);_0x2a9bc9[_0x635f('0x31')]=_['intersection'](_0x5df312['model'],qs['fields'](_0x40fde7[_0x635f('0x2f')][_0x635f('0x32')]));_0x2a9bc9['attributes']=_0x2a9bc9[_0x635f('0x31')][_0x635f('0x33')]?_0x2a9bc9[_0x635f('0x31')]:_0x5df312['model'];if(!_0x40fde7['query']['hasOwnProperty']('nolimit')){_0x2a9bc9['limit']=qs[_0x635f('0x1b')](_0x40fde7[_0x635f('0x2f')]['limit']);_0x2a9bc9[_0x635f('0x19')]=qs[_0x635f('0x19')](_0x40fde7[_0x635f('0x2f')][_0x635f('0x19')]);}_0x2a9bc9['order']=qs[_0x635f('0x34')](_0x40fde7[_0x635f('0x2f')]['sort']);_0x2a9bc9[_0x635f('0x35')]=qs[_0x635f('0x36')](_[_0x635f('0x37')](_0x40fde7['query'],_0x5df312[_0x635f('0x36')]),_0x409e1c);if(_0x40fde7[_0x635f('0x2f')][_0x635f('0x38')]){_0x2a9bc9[_0x635f('0x35')]=_['merge'](_0x2a9bc9[_0x635f('0x35')],{'$or':_[_0x635f('0x28')](_0x409e1c,function(_0x1c5709){if(_0x1c5709[_0x635f('0x2c')]!==_0x635f('0x39')){var _0x2ea9e5={};_0x2ea9e5[_0x1c5709[_0x635f('0x25')]]={'$like':'%'+_0x40fde7[_0x635f('0x2f')]['filter']+'%'};return _0x2ea9e5;}})});}_0x2a9bc9=_[_0x635f('0x3a')]({},_0x2a9bc9,_0x40fde7[_0x635f('0x3b')]);var _0xcc53d2={'where':_0x2a9bc9[_0x635f('0x35')]};return db[_0x635f('0x29')][_0x635f('0x3c')](_0xcc53d2)[_0x635f('0x22')](function(_0x3b4f13){_0x13ffea[_0x635f('0x3c')]=_0x3b4f13;if(_0x40fde7[_0x635f('0x2f')][_0x635f('0x3d')]){_0x2a9bc9['include']=[{'all':!![]}];}return db[_0x635f('0x29')]['findAll'](_0x2a9bc9);})[_0x635f('0x22')](function(_0x21fd98){_0x13ffea[_0x635f('0x3e')]=_0x21fd98;return _0x13ffea;})['then'](respondWithFilteredResult(_0xf92676,_0x2a9bc9))[_0x635f('0x3f')](handleError(_0xf92676,null));};exports[_0x635f('0x40')]=function(_0x5c6611,_0x37a724){var _0x463ede={'raw':!![],'where':{'id':_0x5c6611[_0x635f('0x41')]['id']}},_0x3d4a6e={};_0x3d4a6e[_0x635f('0x2e')]=_[_0x635f('0x42')](db[_0x635f('0x29')]['rawAttributes']);_0x3d4a6e[_0x635f('0x2f')]=_['keys'](_0x5c6611['query']);_0x3d4a6e[_0x635f('0x36')]=_[_0x635f('0x30')](_0x3d4a6e['model'],_0x3d4a6e[_0x635f('0x2f')]);_0x463ede[_0x635f('0x31')]=_[_0x635f('0x30')](_0x3d4a6e['model'],qs[_0x635f('0x32')](_0x5c6611[_0x635f('0x2f')][_0x635f('0x32')]));_0x463ede[_0x635f('0x31')]=_0x463ede[_0x635f('0x31')]['length']?_0x463ede[_0x635f('0x31')]:_0x3d4a6e['model'];if(_0x5c6611[_0x635f('0x2f')]['includeAll']){_0x463ede[_0x635f('0x43')]=[{'all':!![]}];}_0x463ede=_[_0x635f('0x3a')]({},_0x463ede,_0x5c6611[_0x635f('0x3b')]);return db[_0x635f('0x29')][_0x635f('0x44')](_0x463ede)['then'](handleEntityNotFound(_0x37a724,null))[_0x635f('0x22')](respondWithResult(_0x37a724,null))[_0x635f('0x3f')](handleError(_0x37a724,null));};exports[_0x635f('0x45')]=function(_0x185092,_0x4622e2){return db[_0x635f('0x29')][_0x635f('0x45')](_0x185092[_0x635f('0x46')],{})[_0x635f('0x22')](respondWithResult(_0x4622e2,0xc9))[_0x635f('0x3f')](handleError(_0x4622e2,null));};exports['update']=function(_0x10e423,_0x276c1f){if(_0x10e423['body']['id']){delete _0x10e423['body']['id'];}return db['SmsApplication']['find']({'where':{'id':_0x10e423[_0x635f('0x41')]['id']}})['then'](handleEntityNotFound(_0x276c1f,null))[_0x635f('0x22')](saveUpdates(_0x10e423[_0x635f('0x46')],null))[_0x635f('0x22')](respondWithResult(_0x276c1f,null))['catch'](handleError(_0x276c1f,null));};exports['destroy']=function(_0x59497f,_0x29507b){return db[_0x635f('0x29')][_0x635f('0x44')]({'where':{'id':_0x59497f[_0x635f('0x41')]['id']}})[_0x635f('0x22')](handleEntityNotFound(_0x29507b,null))['then'](removeEntity(_0x29507b,null))[_0x635f('0x3f')](handleError(_0x29507b,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index f1b3d5b..1027831 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 _0x4635=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci'];(function(_0x450eb9,_0x3c41e7){var _0x1d3a58=function(_0xf45f72){while(--_0xf45f72){_0x450eb9['push'](_0x450eb9['shift']());}};_0x1d3a58(++_0x3c41e7);}(_0x4635,0x80));var _0x5463=function(_0x1c50d6,_0x1097f2){_0x1c50d6=_0x1c50d6-0x0;var _0x566560=_0x4635[_0x1c50d6];return _0x566560;};'use strict';var _=require(_0x5463('0x0'));var util=require(_0x5463('0x1'));var logger=require(_0x5463('0x2'))(_0x5463('0x3'));var moment=require(_0x5463('0x4'));var BPromise=require(_0x5463('0x5'));var rp=require(_0x5463('0x6'));var fs=require('fs');var path=require(_0x5463('0x7'));var rimraf=require(_0x5463('0x8'));var config=require(_0x5463('0x9'));var attributes=require(_0x5463('0xa'));module[_0x5463('0xb')]=function(_0x545216,_0x5d28a3){return _0x545216[_0x5463('0xc')](_0x5463('0xd'),attributes,{'tableName':_0x5463('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5463('0xf')});}; \ No newline at end of file +var _0x6a8e=['define','SmsApplication','sms_applications','utf8mb4','util','api','moment','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x5302fb,_0x1a2db3){var _0x43e6a4=function(_0x324ae6){while(--_0x324ae6){_0x5302fb['push'](_0x5302fb['shift']());}};_0x43e6a4(++_0x1a2db3);}(_0x6a8e,0xc4));var _0xe6a8=function(_0x2ed7d1,_0x363741){_0x2ed7d1=_0x2ed7d1-0x0;var _0x38ae3c=_0x6a8e[_0x2ed7d1];return _0x38ae3c;};'use strict';var _=require('lodash');var util=require(_0xe6a8('0x0'));var logger=require('../../config/logger')(_0xe6a8('0x1'));var moment=require(_0xe6a8('0x2'));var BPromise=require('bluebird');var rp=require(_0xe6a8('0x3'));var fs=require('fs');var path=require(_0xe6a8('0x4'));var rimraf=require(_0xe6a8('0x5'));var config=require(_0xe6a8('0x6'));var attributes=require(_0xe6a8('0x7'));module['exports']=function(_0x3907c3,_0x8b2615){return _0x3907c3[_0xe6a8('0x8')](_0xe6a8('0x9'),attributes,{'tableName':_0xe6a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe6a8('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index faec1bb..4b2399d 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 _0xa321=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','request','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x5a9e32,_0x3197fd){var _0x521b3f=function(_0x55f4f9){while(--_0x55f4f9){_0x5a9e32['push'](_0x5a9e32['shift']());}};_0x521b3f(++_0x3197fd);}(_0xa321,0x9d));var _0x1a32=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0xa321[_0x2adfb1];return _0xa52d45;};'use strict';var _=require(_0x1a32('0x0'));var util=require(_0x1a32('0x1'));var moment=require(_0x1a32('0x2'));var BPromise=require(_0x1a32('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a32('0x4'));var db=require(_0x1a32('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a32('0x6'))(_0x1a32('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1a32('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4859d6,_0x13b4d2,_0x1fa204){return new BPromise(function(_0xdfa9fe,_0x3f4723){return client[_0x1a32('0x9')](_0x4859d6,_0x1fa204)['then'](function(_0x343faf){logger[_0x1a32('0xa')]('SmsApplication,\x20%s,\x20%s',_0x13b4d2,_0x1a32('0xb'));logger[_0x1a32('0xc')](_0x1a32('0xd'),_0x13b4d2,_0x1a32('0xb'),JSON[_0x1a32('0xe')](_0x343faf));if(_0x343faf[_0x1a32('0xf')]){if(_0x343faf['error'][_0x1a32('0x10')]===0x1f4){logger[_0x1a32('0xf')](_0x1a32('0x11'),_0x13b4d2,_0x343faf['error'][_0x1a32('0x12')]);return _0x3f4723(_0x343faf[_0x1a32('0xf')][_0x1a32('0x12')]);}logger[_0x1a32('0xf')](_0x1a32('0x11'),_0x13b4d2,_0x343faf['error'][_0x1a32('0x12')]);return _0xdfa9fe(_0x343faf[_0x1a32('0xf')][_0x1a32('0x12')]);}else{logger[_0x1a32('0xa')](_0x1a32('0x11'),_0x13b4d2,_0x1a32('0xb'));_0xdfa9fe(_0x343faf['result'][_0x1a32('0x12')]);}})[_0x1a32('0x13')](function(_0x47bb8e){logger[_0x1a32('0xf')](_0x1a32('0x11'),_0x13b4d2,_0x47bb8e);_0x3f4723(_0x47bb8e);});});} \ No newline at end of file +var _0x8b0e=['client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x8b0e,0x166));var _0xe8b0=function(_0x56418e,_0x362812){_0x56418e=_0x56418e-0x0;var _0x5b160c=_0x8b0e[_0x56418e];return _0x5b160c;};'use strict';var _=require(_0xe8b0('0x0'));var util=require(_0xe8b0('0x1'));var moment=require(_0xe8b0('0x2'));var BPromise=require(_0xe8b0('0x3'));var rs=require(_0xe8b0('0x4'));var fs=require('fs');var Redis=require(_0xe8b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe8b0('0x6'));var logger=require('../../config/logger')(_0xe8b0('0x7'));var config=require(_0xe8b0('0x8'));var jayson=require(_0xe8b0('0x9'));var client=jayson[_0xe8b0('0xa')][_0xe8b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35fe3d,_0x25faf7,_0x2e56f4){return new BPromise(function(_0x59f3a4,_0x103966){return client[_0xe8b0('0xc')](_0x35fe3d,_0x2e56f4)[_0xe8b0('0xd')](function(_0x82589f){logger[_0xe8b0('0xe')](_0xe8b0('0xf'),_0x25faf7,_0xe8b0('0x10'));logger[_0xe8b0('0x11')](_0xe8b0('0x12'),_0x25faf7,'request\x20sent',JSON['stringify'](_0x82589f));if(_0x82589f[_0xe8b0('0x13')]){if(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x14')]===0x1f4){logger['error'](_0xe8b0('0xf'),_0x25faf7,_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);return _0x103966(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);}logger[_0xe8b0('0x13')](_0xe8b0('0xf'),_0x25faf7,_0x82589f['error'][_0xe8b0('0x15')]);return _0x59f3a4(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);}else{logger['info'](_0xe8b0('0xf'),_0x25faf7,'request\x20sent');_0x59f3a4(_0x82589f['result']['message']);}})[_0xe8b0('0x16')](function(_0x3818a7){logger['error'](_0xe8b0('0xf'),_0x25faf7,_0x3818a7);_0x103966(_0x3818a7);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 36c92cc..6eb78ec 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(_0x1644fb,_0x1836fa){var _0x298dad=function(_0x3d1da8){while(--_0x3d1da8){_0x1644fb['push'](_0x1644fb['shift']());}};_0x298dad(++_0x1836fa);}(_0xb03e,0x1eb));var _0xeb03=function(_0x1c39d1,_0x220bf6){_0x1c39d1=_0x1c39d1-0x0;var _0x3d1a75=_0xb03e[_0x1c39d1];return _0x3d1a75;};'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 _0x3423=['/:id','/:id/messages','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','delete','smsinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0x9')](_0x3342('0xe'),auth[_0x3342('0xa')](),controller['show']);router['get'](_0x3342('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/download',auth[_0x3342('0xa')](),controller[_0x3342('0x10')]);router['post']('/',auth[_0x3342('0xa')](),controller['create']);router[_0x3342('0x11')](_0x3342('0xf'),auth['isAuthenticated'](),controller[_0x3342('0x12')]);router[_0x3342('0x11')](_0x3342('0x13'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x16')),controller['addTags']);router[_0x3342('0x17')](_0x3342('0xe'),auth['isAuthenticated'](),interaction[_0x3342('0x14')](_0x3342('0x15'),'smsinteraction:update'),controller['update']);router[_0x3342('0x18')](_0x3342('0xe'),auth[_0x3342('0xa')](),interaction[_0x3342('0x14')](_0x3342('0x15'),_0x3342('0x19')),controller[_0x3342('0x1a')]);router[_0x3342('0x18')](_0x3342('0x13'),auth['isAuthenticated'](),controller[_0x3342('0x1b')]);module[_0x3342('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 36ea3ec..9e333dd 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 _0xc99e=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x10265e,_0x469a81){var _0x5bad1a=function(_0x5d9e7){while(--_0x5d9e7){_0x10265e['push'](_0x10265e['shift']());}};_0x5bad1a(++_0x469a81);}(_0xc99e,0x6e));var _0xec99=function(_0x189ac2,_0x241e56){_0x189ac2=_0x189ac2-0x0;var _0x46b21a=_0xc99e[_0x189ac2];return _0x46b21a;};'use strict';var Sequelize=require(_0xec99('0x0'));var moment=require(_0xec99('0x1'));module[_0xec99('0x2')]={'closed':{'type':Sequelize[_0xec99('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xec99('0x4')]},'disposition':{'type':Sequelize[_0xec99('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xec99('0x5')]},'note':{'type':Sequelize[_0xec99('0x5')]},'phone':{'type':Sequelize[_0xec99('0x5')]},'read1stAt':{'type':Sequelize[_0xec99('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xec99('0x6')]('in',_0xec99('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xec99('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xec99('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xec99('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0c29=['ENUM','out','BOOLEAN','exports','DATE','STRING'];(function(_0x2d2f1a,_0x57b966){var _0x55d9db=function(_0x15771f){while(--_0x15771f){_0x2d2f1a['push'](_0x2d2f1a['shift']());}};_0x55d9db(++_0x57b966);}(_0x0c29,0xb7));var _0x90c2=function(_0x2389bc,_0x167cd2){_0x2389bc=_0x2389bc-0x0;var _0x170548=_0x0c29[_0x2389bc];return _0x170548;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x90c2('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x90c2('0x1')]},'disposition':{'type':Sequelize[_0x90c2('0x2')]},'secondDisposition':{'type':Sequelize[_0x90c2('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x90c2('0x2')]},'read1stAt':{'type':Sequelize[_0x90c2('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x90c2('0x3')]('in',_0x90c2('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x90c2('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x90c2('0x3')]('in',_0x90c2('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x90c2('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 564300d..d87063d 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 _0x0c5d=['filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','rawAttributes','includeAll','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','nolimit','pick','merge','format','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','addTags','setTags','spread','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','CmContact','firstName','lastName','Messages','createdAt','direction','SmsAccount','Account','get','Owner','N.A.','closedAt','disposition','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','push','catch','waiting','talking','answered','unmanaged','UserId','closed','total','index','SmsInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','field','color','from','tools_tags','select','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','unreadMessages','value','having','`\x20=\x200','Contact','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray'];(function(_0x11ca22,_0x4edf74){var _0x3d47d6=function(_0x2a53f1){while(--_0x2a53f1){_0x11ca22['push'](_0x11ca22['shift']());}};_0x3d47d6(++_0x4edf74);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x4bbef5,_0x5d17f0){_0x4bbef5=_0x4bbef5-0x0;var _0x25c487=_0x0c5d[_0x4bbef5];return _0x25c487;};'use strict';var emlformat=require(_0xd0c5('0x0'));var rimraf=require(_0xd0c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd0c5('0x2'));var rp=require('request-promise');var moment=require(_0xd0c5('0x3'));var BPromise=require(_0xd0c5('0x4'));var Mustache=require(_0xd0c5('0x5'));var util=require(_0xd0c5('0x6'));var path=require(_0xd0c5('0x7'));var sox=require(_0xd0c5('0x8'));var csv=require(_0xd0c5('0x9'));var ejs=require(_0xd0c5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0c5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd0c5('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd0c5('0xd'));var Papa=require(_0xd0c5('0xe'));var Redis=require('ioredis');var authService=require(_0xd0c5('0xf'));var qs=require(_0xd0c5('0x10'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xd0c5('0x11'));var hardwareService=require(_0xd0c5('0x12'));var logger=require(_0xd0c5('0x13'))(_0xd0c5('0x14'));var utils=require(_0xd0c5('0x15'));var config=require(_0xd0c5('0x16'));var licenseUtil=require(_0xd0c5('0x17'));var db=require(_0xd0c5('0x18'))['db'];config[_0xd0c5('0x19')]=_[_0xd0c5('0x1a')](config[_0xd0c5('0x19')],{'host':_0xd0c5('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd0c5('0x19')]));require(_0xd0c5('0x1c'))[_0xd0c5('0x1d')](socket);function respondWithStatusCode(_0x408e02,_0x553c38){_0x553c38=_0x553c38||0xcc;return function(_0x280e22){if(_0x280e22){return _0x408e02[_0xd0c5('0x1e')](_0x553c38);}return _0x408e02[_0xd0c5('0x1f')](_0x553c38)[_0xd0c5('0x20')]();};}function respondWithResult(_0x556487,_0x2be13d){_0x2be13d=_0x2be13d||0xc8;return function(_0x5809ba){if(_0x5809ba){return _0x556487[_0xd0c5('0x1f')](_0x2be13d)['json'](_0x5809ba);}};}function respondWithFilteredResult(_0x35adf8,_0x692aeb){return function(_0x308296){if(_0x308296){var _0x1cfe05=typeof _0x692aeb[_0xd0c5('0x21')]===_0xd0c5('0x22')&&typeof _0x692aeb[_0xd0c5('0x23')]===_0xd0c5('0x22');var _0x4e302a=_0x308296[_0xd0c5('0x24')];var _0x2cd03c=_0x1cfe05?0x0:_0x692aeb['offset'];var _0x835e8d=_0x1cfe05?_0x308296[_0xd0c5('0x24')]:_0x692aeb[_0xd0c5('0x21')]+_0x692aeb[_0xd0c5('0x23')];var _0x3a2a75;if(_0x835e8d>=_0x4e302a){_0x835e8d=_0x4e302a;_0x3a2a75=0xc8;}else{_0x3a2a75=0xce;}_0x35adf8[_0xd0c5('0x1f')](_0x3a2a75);return _0x35adf8[_0xd0c5('0x25')]('Content-Range',_0x2cd03c+'-'+_0x835e8d+'/'+_0x4e302a)['json'](_0x308296);}return null;};}function patchUpdates(_0x25fd73){return function(_0x2b756a){try{jsonpatch[_0xd0c5('0x26')](_0x2b756a,_0x25fd73,!![]);}catch(_0x6ce082){return BPromise['reject'](_0x6ce082);}return _0x2b756a[_0xd0c5('0x27')]();};}function saveUpdates(_0x54f42c,_0x54f188){return function(_0x3ec4ee){if(_0x3ec4ee){return _0x3ec4ee[_0xd0c5('0x28')](_0x54f42c)[_0xd0c5('0x29')](function(_0x73f292){return _0x73f292;});}return null;};}function removeEntity(_0x3a5edf,_0x96a5b8){return function(_0xbcef61){if(_0xbcef61){return _0xbcef61[_0xd0c5('0x2a')]()[_0xd0c5('0x29')](function(){_0x3a5edf[_0xd0c5('0x1f')](0xcc)[_0xd0c5('0x20')]();});}};}function handleEntityNotFound(_0x3e6400,_0x3502fe){return function(_0x2ee47e){if(!_0x2ee47e){_0x3e6400[_0xd0c5('0x1e')](0x194);}return _0x2ee47e;};}function handleError(_0x2869a3,_0x24d35f){_0x24d35f=_0x24d35f||0x1f4;return function(_0x572e66){logger[_0xd0c5('0x2b')](_0x572e66[_0xd0c5('0x2c')]);if(_0x572e66[_0xd0c5('0x2d')]){delete _0x572e66[_0xd0c5('0x2d')];}_0x2869a3[_0xd0c5('0x1f')](_0x24d35f)[_0xd0c5('0x2e')](_0x572e66);};}function getInteractionUsers(_0x135e2,_0x571410){return new BPromise(function(_0xcff326,_0x53a582){try{if(_0x571410[_0x135e2['id']]){_0x135e2[_0xd0c5('0x2f')]=_[_0xd0c5('0x30')](_0x571410[_0x135e2['id']],function(_0x469fd0){return{'id':_0x469fd0['id'],'fullname':_0x469fd0[_0xd0c5('0x31')]};});}}catch(_0x2ff67a){_0x53a582(_0x2ff67a);}_0xcff326(_0x135e2);});}function getInteractionTags(_0x3144b3,_0x46f394){return new BPromise(function(_0x4be7fc,_0x560853){try{if(_0x3144b3[_0xd0c5('0x32')]){_0x3144b3['Tags']=[];_0x3144b3[_0xd0c5('0x32')][_0xd0c5('0x33')](',')[_0xd0c5('0x34')](function(_0x211805){_0x3144b3['Tags'][_0xd0c5('0x35')](_0x46f394[_0x211805]);});}delete _0x3144b3[_0xd0c5('0x32')];}catch(_0x559835){_0x560853(_0x559835);}_0x4be7fc(_0x3144b3);});}function updateSmsInteraction(_0x26066e,_0x5a01ef,_0x73cdef){return new BPromise(function(_0x2bddff,_0x44b67a){return getInteractionUsers(_0x26066e,_0x73cdef)['then'](function(_0x2fda97){return getInteractionTags(_0x2fda97,_0x5a01ef);})[_0xd0c5('0x29')](function(_0x2e8f04){return getStateInteraction(_0x2e8f04);})[_0xd0c5('0x29')](function(_0x432d57){_0x2bddff(_0x432d57);})[_0xd0c5('0x36')](function(_0x3bd90e){_0x44b67a(_0x3bd90e);});});}function getStateInteraction(_0x323fb3){return new BPromise(function(_0x274e74){_0x323fb3[_0xd0c5('0x37')]=0x0;_0x323fb3[_0xd0c5('0x38')]=0x0;_0x323fb3[_0xd0c5('0x39')]=0x0;_0x323fb3[_0xd0c5('0x3a')]=0x0;_0x323fb3['total']=0x0;if(!_0x323fb3['closed']&&!_0x323fb3[_0xd0c5('0x3b')]){_0x323fb3['waiting']+=0x1;}if(!_0x323fb3[_0xd0c5('0x3c')]&&_0x323fb3[_0xd0c5('0x3b')]){_0x323fb3['talking']+=0x1;if(_0x323fb3[_0xd0c5('0x37')]){_0x323fb3[_0xd0c5('0x37')]-=0x1;}}if(_0x323fb3['closed']&&_0x323fb3[_0xd0c5('0x3b')]){_0x323fb3[_0xd0c5('0x39')]+=0x1;if(_0x323fb3[_0xd0c5('0x38')]){_0x323fb3[_0xd0c5('0x38')]-=0x1;}}if(_0x323fb3[_0xd0c5('0x3c')]&&!_0x323fb3[_0xd0c5('0x3b')]){_0x323fb3[_0xd0c5('0x3a')]+=0x1;if(_0x323fb3[_0xd0c5('0x37')]){_0x323fb3[_0xd0c5('0x37')]-=0x1;}}_0x323fb3[_0xd0c5('0x3d')]+=0x1;_0x274e74(_0x323fb3);});}exports[_0xd0c5('0x3e')]=function(_0x3dc24a,_0x1b7eda){var _0x583ec8={},_0x1df4be={},_0x41796b={'count':0x0,'rows':[]};var _0x215048=_[_0xd0c5('0x30')](db[_0xd0c5('0x3f')]['rawAttributes'],function(_0x4d7013){return{'name':_0x4d7013[_0xd0c5('0x40')],'type':_0x4d7013[_0xd0c5('0x41')][_0xd0c5('0x42')]};});_0x1df4be[_0xd0c5('0x43')]=_['map'](_0x215048,_0xd0c5('0x2d'));_0x1df4be[_0xd0c5('0x44')]=_[_0xd0c5('0x45')](_0x3dc24a[_0xd0c5('0x44')]);_0x1df4be[_0xd0c5('0x46')]=_[_0xd0c5('0x47')](_0x1df4be[_0xd0c5('0x43')],_0x1df4be['query']);_0x583ec8[_0xd0c5('0x48')]=_[_0xd0c5('0x47')](_0x1df4be['model'],qs[_0xd0c5('0x49')](_0x3dc24a[_0xd0c5('0x44')][_0xd0c5('0x49')]));_0x583ec8['attributes']=_0x583ec8['attributes']['length']?_0x583ec8['attributes']:_0x1df4be[_0xd0c5('0x43')];if(!_0x3dc24a['query'][_0xd0c5('0x4a')]('nolimit')){_0x583ec8[_0xd0c5('0x23')]=qs['limit'](_0x3dc24a[_0xd0c5('0x44')][_0xd0c5('0x23')]);_0x583ec8[_0xd0c5('0x21')]=qs[_0xd0c5('0x21')](_0x3dc24a[_0xd0c5('0x44')]['offset']);}_0x583ec8[_0xd0c5('0x4b')]=qs[_0xd0c5('0x4c')](_0x3dc24a[_0xd0c5('0x44')][_0xd0c5('0x4c')]);_0x583ec8[_0xd0c5('0x4d')]=qs[_0xd0c5('0x46')](_['pick'](_0x3dc24a[_0xd0c5('0x44')],_0x1df4be[_0xd0c5('0x46')]),_0x215048);var _0xca2e1f=[];var _0x38324c=squel['select']()[_0xd0c5('0x4e')]('id')[_0xd0c5('0x4e')](_0xd0c5('0x2d'))[_0xd0c5('0x4e')](_0xd0c5('0x4f'))[_0xd0c5('0x50')](_0xd0c5('0x51'));var _0x269d63=squel[_0xd0c5('0x52')]()[_0xd0c5('0x4e')](_0xd0c5('0x53'))[_0xd0c5('0x4e')]('u.fullname')['field'](_0xd0c5('0x54'))[_0xd0c5('0x50')](_0xd0c5('0x55'),'ui')[_0xd0c5('0x56')](_0xd0c5('0x57'),'u',_0xd0c5('0x58'));var _0x5bf9bb=squel[_0xd0c5('0x52')]()[_0xd0c5('0x50')](_0xd0c5('0x59'),'i')[_0xd0c5('0x56')](_0xd0c5('0x5a'),'c',_0xd0c5('0x5b'))[_0xd0c5('0x56')](_0xd0c5('0x57'),'o',_0xd0c5('0x5c'))[_0xd0c5('0x56')](_0xd0c5('0x5d'),'a',_0xd0c5('0x5e'))[_0xd0c5('0x56')]('sms_messages','me',_0xd0c5('0x5f'))[_0xd0c5('0x56')]('sms_interaction_has_tags','it',_0xd0c5('0x60'))['left_join']('tools_tags','t',_0xd0c5('0x61'));var _0x5ff7d5=squel[_0xd0c5('0x62')]();var _0x1ce80d=[];var _0x4243ad=squel[_0xd0c5('0x62')]();var _0x23fcd6;if(_0x3dc24a[_0xd0c5('0x44')][_0xd0c5('0x63')]){_0x23fcd6=as[_0xd0c5('0x64')](_0x3dc24a[_0xd0c5('0x44')][_0xd0c5('0x63')]);var _0x35e7c5=_0x23fcd6[_0xd0c5('0x65')];for(var _0x1859c5=0x0;_0x1859c5<_0x23fcd6[_0xd0c5('0x66')][_0xd0c5('0x67')];_0x1859c5++){var _0x565278=_0x23fcd6['conditions'][_0x1859c5];var _0x13c8ce='i';var _0xde21a4=_['find'](_0x215048,['name',_0x565278[_0xd0c5('0x4e')]]);if(!_0xde21a4){switch(_0x565278[_0xd0c5('0x4e')]){case _0xd0c5('0x68'):if(_0x565278[_0xd0c5('0x69')]==0x1){_0x5bf9bb[_0xd0c5('0x6a')]('`'+_0x565278[_0xd0c5('0x4e')]+_0xd0c5('0x6b'));}else{_0x5bf9bb[_0xd0c5('0x6a')]('`'+_0x565278[_0xd0c5('0x4e')]+'`\x20>\x200');}break;case _0xd0c5('0x6c'):if(_0x565278[_0xd0c5('0x6d')]==='$substring'){if(_0x565278[_0xd0c5('0x69')]['split']('\x20')[_0xd0c5('0x67')]>0x1){_0x5ff7d5[_0x35e7c5]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd0c5('0x6e')](_0x565278['value']),null);}else{var _0x261e81='%'+_0x565278[_0xd0c5('0x69')]+'%';_0x5ff7d5[_0x35e7c5](_0xd0c5('0x6f'),_0x261e81,_0x261e81,_0x261e81);}}else{_0xde21a4=_[_0xd0c5('0x70')](_0x215048,[_0xd0c5('0x2d'),_0xd0c5('0x71')]);_0x565278[_0xd0c5('0x4e')]=_0xd0c5('0x71');_0x490c93=as[_0xd0c5('0x72')](_0x13c8ce,_0xde21a4[_0xd0c5('0x41')],_0x565278);_0x5ff7d5[_0x35e7c5](_0x490c93[_0xd0c5('0x73')],_0x490c93[_0xd0c5('0x69')]['start'],_0x490c93[_0xd0c5('0x69')]['end']);}break;case _0xd0c5('0x74'):var _0x37e731=_0x565278['value'][_0xd0c5('0x33')](',')[_0xd0c5('0x30')](function(_0x7689a3){return Number(_0x7689a3);});_0x37e731[_0xd0c5('0x34')](function(_0xf8d81){_0x4243ad['or'](_0xd0c5('0x75'),'%,'+_0xf8d81+',%');});_0x1ce80d=_['union'](_0x1ce80d,_0x37e731);break;case _0xd0c5('0x76'):if(_0x565278[_0xd0c5('0x6d')]===_0xd0c5('0x77')){_0x5ff7d5[_0x35e7c5](_0xd0c5('0x78'),'%'+_0x565278['value']+'%',null);}else{_0xde21a4=_[_0xd0c5('0x70')](_0x215048,[_0xd0c5('0x2d'),_0xd0c5('0x3b')]);_0x565278[_0xd0c5('0x4e')]=_0xd0c5('0x3b');_0x490c93=as[_0xd0c5('0x72')](_0x13c8ce,_0xde21a4[_0xd0c5('0x41')],_0x565278);_0x5ff7d5[_0x35e7c5](_0x490c93[_0xd0c5('0x73')],_0x490c93[_0xd0c5('0x69')][_0xd0c5('0x79')],_0x490c93['value'][_0xd0c5('0x20')]);}break;case _0xd0c5('0x7a'):_0x490c93=as[_0xd0c5('0x72')]('me',null,_0x565278);_0x5ff7d5[_0x35e7c5](_0x490c93[_0xd0c5('0x73')],_0x490c93[_0xd0c5('0x69')][_0xd0c5('0x79')],_0x490c93['value'][_0xd0c5('0x20')]);break;}}else{var _0x490c93=as[_0xd0c5('0x72')](_0x13c8ce,_0xde21a4[_0xd0c5('0x41')],_0x565278);_0x5ff7d5[_0x35e7c5](_0x490c93[_0xd0c5('0x73')],_0x490c93[_0xd0c5('0x69')][_0xd0c5('0x79')],_0x490c93['value']['end']);}}}else{var _0x56b5bd=_(_0x3dc24a[_0xd0c5('0x44')])[_0xd0c5('0x45')]()[_0xd0c5('0x30')](function(_0x380b07){return _[_0xd0c5('0x7b')](_0x215048,[_0xd0c5('0x2d'),_0x380b07])?_0x380b07:undefined;})[_0xd0c5('0x7c')]()[_0xd0c5('0x69')]();if(!_[_0xd0c5('0x7d')](_0x56b5bd)){_0x56b5bd[_0xd0c5('0x34')](function(_0x21f386){if(_0x21f386===_0xd0c5('0x7e')){_0x5bf9bb[_0xd0c5('0x4d')](_0xd0c5('0x7f'),[][_0xd0c5('0x80')](_0x3dc24a[_0xd0c5('0x44')][_0x21f386]));}else if(_0x21f386==='createdAt'){var _0x2690ea=JSON['parse'](_0x3dc24a[_0xd0c5('0x44')][_0x21f386])[_0xd0c5('0x81')];var _0x4e15ab=JSON[_0xd0c5('0x82')](_0x3dc24a[_0xd0c5('0x44')][_0x21f386])[_0xd0c5('0x83')];_0x5bf9bb[_0xd0c5('0x4d')](_0xd0c5('0x84'),_0x2690ea,_0x4e15ab);}else{if(_0x3dc24a[_0xd0c5('0x44')][_0x21f386]===_0xd0c5('0x85')){_0x5bf9bb[_0xd0c5('0x4d')]('i.'+_0x21f386+_0xd0c5('0x86'));}else{_0x5bf9bb['where']('i.'+_0x21f386+'\x20=\x20?',_0x3dc24a[_0xd0c5('0x44')][_0x21f386]);}}});}if(_0x3dc24a['query']['read']){if(_0x3dc24a[_0xd0c5('0x44')][_0xd0c5('0x87')]==0x1){_0x5bf9bb[_0xd0c5('0x6a')](_0xd0c5('0x88'));}else{_0x5bf9bb[_0xd0c5('0x6a')]('`unreadMessages`\x20>\x200');}}if(_0x3dc24a['query'][_0xd0c5('0x89')]){_0x1ce80d=_[_0xd0c5('0x8a')](_0x3dc24a[_0xd0c5('0x44')][_0xd0c5('0x89')])?_0x3dc24a[_0xd0c5('0x44')][_0xd0c5('0x89')]:new Array(_0x3dc24a[_0xd0c5('0x44')]['tag']);_0x1ce80d[_0xd0c5('0x34')](function(_0x46fc3f){_0x4243ad['or'](_0xd0c5('0x75'),'%,'+_0x46fc3f+',%');});}if(_0x3dc24a[_0xd0c5('0x44')]['filter']){var _0x403987=_0x3dc24a['query'][_0xd0c5('0x8b')][_0xd0c5('0x8c')]('\x5c','\x5c\x5c')[_0xd0c5('0x8c')](/'/g,'\x27\x27');if(qs[_0xd0c5('0x8d')](_0x403987)){_0x5ff7d5['or'](_0xd0c5('0x8e'),_0x403987+'%')['or']('i.phone\x20LIKE\x20?',_0x403987+'%');}else{_0x5ff7d5['or'](_0xd0c5('0x8f'),qs[_0xd0c5('0x6e')](_0x403987))['or'](_0xd0c5('0x90'),_0x403987+'%');}}}_0x5bf9bb[_0xd0c5('0x4d')](_0x5ff7d5);_0x5bf9bb[_0xd0c5('0x91')](_0xd0c5('0x92'));var _0x5ab587={'type':db[_0xd0c5('0x93')]['QueryTypes'][_0xd0c5('0x94')],'raw':!![]};var _0x1d02b1=_0x5bf9bb[_0xd0c5('0x95')]();_0x1d02b1[_0xd0c5('0x4e')](_0xd0c5('0x92'));_0x1d02b1[_0xd0c5('0x4e')](_0xd0c5('0x96'),_0xd0c5('0x68'));if(_0x583ec8['order']){_0x583ec8[_0xd0c5('0x4b')]['forEach'](function(_0x24b29b){var _0x1bf18b=_0x24b29b[0x0]===_0xd0c5('0x97')?_0x24b29b[0x0]:'i.'+_0x24b29b[0x0];_0x5bf9bb[_0xd0c5('0x4b')](_0x1bf18b,_0x24b29b[0x1]===_0xd0c5('0x98')?![]:!![]);});}if(!_[_0xd0c5('0x7d')](_0x1ce80d)){_0x5bf9bb[_0xd0c5('0x6a')](_0x4243ad);_0x1d02b1[_0xd0c5('0x4d')](_0xd0c5('0x99'),_0x1ce80d);}BPromise['resolve']()[_0xd0c5('0x29')](function(){if(!_0x23fcd6){if(_0x3dc24a[_0xd0c5('0x44')][_0xd0c5('0x7e')])return;_0x1d02b1[_0xd0c5('0x4d')](_0xd0c5('0x9a'));_0x5bf9bb['where'](_0xd0c5('0x9a'));return;}if(_0x3dc24a[_0xd0c5('0x9b')]['role']!==_0xd0c5('0x9c'))return;return _0x3dc24a[_0xd0c5('0x9b')][_0xd0c5('0x9d')]({'attributes':['id'],'raw':!![]})[_0xd0c5('0x29')](function(_0x288b3d){if(_[_0xd0c5('0x7d')](_0x288b3d)){_0x1d02b1[_0xd0c5('0x4d')](_0xd0c5('0x9e'));_0x5bf9bb[_0xd0c5('0x4d')](_0xd0c5('0x9e'));}else{_0x1d02b1[_0xd0c5('0x4d')](_0xd0c5('0x7f'),_['map'](_0x288b3d,'id'));_0x5bf9bb[_0xd0c5('0x4d')](_0xd0c5('0x7f'),_[_0xd0c5('0x30')](_0x288b3d,'id'));}});})[_0xd0c5('0x29')](function(){if(_0x3dc24a[_0xd0c5('0x9b')][_0xd0c5('0x9f')]===_0xd0c5('0x9c')&&!_0x23fcd6&&!_0x3dc24a[_0xd0c5('0x44')][_0xd0c5('0x7e')])return[];return db[_0xd0c5('0xa0')]['query'](_0x1d02b1[_0xd0c5('0xa1')](),_0x5ab587);})['then'](function(_0x6b3345){_0x41796b[_0xd0c5('0x24')]=_0x6b3345[_0xd0c5('0x67')];if(_0x41796b[_0xd0c5('0x24')]===0x0)return[];return db[_0xd0c5('0xa0')][_0xd0c5('0x44')](_0x38324c[_0xd0c5('0xa1')](),_0x5ab587)[_0xd0c5('0x29')](function(_0x24ab98){_0xca2e1f=_['keyBy'](_0x24ab98,'id');_0x5ab587=_['merge'](_0x5ab587,{'model':db[_0xd0c5('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3dc24a[_0xd0c5('0x44')][_0xd0c5('0x49')]){_0x583ec8[_0xd0c5('0x48')][_0xd0c5('0x34')](function(_0x215161){_0x5bf9bb['field']('i.'+_0x215161);});}else{_0x5bf9bb[_0xd0c5('0x4e')](_0xd0c5('0x96'),'unreadMessages');_0x5bf9bb[_0xd0c5('0x4e')](_0xd0c5('0xa2'),_0xd0c5('0xa3'));_0x5bf9bb['field'](_0xd0c5('0xa4'),_0xd0c5('0xa5'));_0x5bf9bb[_0xd0c5('0x4e')](_0xd0c5('0xa6'),_0xd0c5('0x97'));_0x5bf9bb[_0xd0c5('0x4e')](_0xd0c5('0xa7'));_0x5bf9bb[_0xd0c5('0x4e')](_0xd0c5('0xa8'),_0xd0c5('0xa9'));_0x5bf9bb['field']('c.lastName',_0xd0c5('0xaa'));_0x5bf9bb[_0xd0c5('0x4e')](_0xd0c5('0xab'),_0xd0c5('0xac'));_0x5bf9bb[_0xd0c5('0x4e')](_0xd0c5('0xad'),_0xd0c5('0xae'));_0x5bf9bb[_0xd0c5('0x4e')](_0xd0c5('0xaf'),_0xd0c5('0xb0'));_0x5bf9bb['field'](_0xd0c5('0xb1'),_0xd0c5('0xb2'));_0x5bf9bb['field'](_0xd0c5('0xb3'),_0xd0c5('0xb4'));_0x5bf9bb[_0xd0c5('0x4e')](_0xd0c5('0xb5'),_0xd0c5('0xb6'));_0x5bf9bb[_0xd0c5('0x4e')](_0xd0c5('0xb7'),_0xd0c5('0x32'));}if(_0x583ec8[_0xd0c5('0x23')])_0x5bf9bb['limit'](_0x583ec8[_0xd0c5('0x23')]);if(_0x583ec8[_0xd0c5('0x21')])_0x5bf9bb[_0xd0c5('0x21')](_0x583ec8['offset']);return db[_0xd0c5('0xa0')][_0xd0c5('0x44')](_0x5bf9bb[_0xd0c5('0xa1')](),_0x5ab587);})['then'](function(_0x32aa17){if(_0x32aa17['length']>0x0)_0x269d63[_0xd0c5('0x4d')](_0xd0c5('0xb8'),_[_0xd0c5('0x30')](_0x32aa17,'id'));return db[_0xd0c5('0xa0')]['query'](_0x269d63[_0xd0c5('0xa1')](),_0x5ab587)[_0xd0c5('0x29')](function(_0x3f1eb9){var _0x5e20f8=_[_0xd0c5('0xb9')](_0x3f1eb9,_0xd0c5('0xba'));var _0x36d807=[];_0x32aa17[_0xd0c5('0x34')](function(_0xe9c9b3){_0x36d807[_0xd0c5('0x35')](updateSmsInteraction(_0xe9c9b3,_0xca2e1f,_0x5e20f8));});return BPromise[_0xd0c5('0xbb')](_0x36d807);});});})[_0xd0c5('0x29')](function(_0x459a7e){_0x41796b[_0xd0c5('0xbc')]=_0x459a7e;return _0x41796b;})[_0xd0c5('0x29')](respondWithFilteredResult(_0x1b7eda,_0x583ec8))[_0xd0c5('0x36')](handleError(_0x1b7eda,null));};exports[_0xd0c5('0xbd')]=function(_0x31b02d,_0x8dd001){var _0x5a491d={'raw':![],'where':{'id':_0x31b02d[_0xd0c5('0xbe')]['id']}},_0x136c30={};_0x136c30[_0xd0c5('0x43')]=_['keys'](db[_0xd0c5('0x3f')][_0xd0c5('0xbf')]);_0x136c30[_0xd0c5('0x44')]=_[_0xd0c5('0x45')](_0x31b02d[_0xd0c5('0x44')]);_0x136c30[_0xd0c5('0x46')]=_[_0xd0c5('0x47')](_0x136c30['model'],_0x136c30[_0xd0c5('0x44')]);_0x5a491d['attributes']=_[_0xd0c5('0x47')](_0x136c30['model'],qs[_0xd0c5('0x49')](_0x31b02d[_0xd0c5('0x44')][_0xd0c5('0x49')]));_0x5a491d[_0xd0c5('0x48')]=_0x5a491d[_0xd0c5('0x48')][_0xd0c5('0x67')]?_0x5a491d[_0xd0c5('0x48')]:_0x136c30['model'];if(_0x31b02d[_0xd0c5('0x44')][_0xd0c5('0xc0')]){_0x5a491d['include']=[{'all':!![]}];}_0x5a491d=_['merge']({},_0x5a491d,_0x31b02d['options']);return db[_0xd0c5('0x3f')][_0xd0c5('0x70')](_0x5a491d)[_0xd0c5('0x29')](handleEntityNotFound(_0x8dd001,null))[_0xd0c5('0x29')](respondWithResult(_0x8dd001,null))[_0xd0c5('0x36')](handleError(_0x8dd001,null));};exports[_0xd0c5('0xc1')]=function(_0xd19275,_0x260254){return db['SmsInteraction'][_0xd0c5('0xc1')](_0xd19275[_0xd0c5('0x7a')],{})[_0xd0c5('0x29')](respondWithResult(_0x260254,0xc9))['catch'](handleError(_0x260254,null));};exports[_0xd0c5('0x28')]=function(_0x4e874e,_0x126a28){if(_0x4e874e[_0xd0c5('0x7a')]['id']){delete _0x4e874e[_0xd0c5('0x7a')]['id'];}return db[_0xd0c5('0x3f')][_0xd0c5('0x70')]({'where':{'id':_0x4e874e['params']['id']}})[_0xd0c5('0x29')](handleEntityNotFound(_0x126a28,null))['then'](saveUpdates(_0x4e874e[_0xd0c5('0x7a')],null))[_0xd0c5('0x29')](respondWithResult(_0x126a28,null))[_0xd0c5('0x36')](handleError(_0x126a28,null));};exports[_0xd0c5('0x2a')]=function(_0x325d5f,_0x3ca6d0){return db[_0xd0c5('0x3f')][_0xd0c5('0x70')]({'where':{'id':_0x325d5f[_0xd0c5('0xbe')]['id']}})[_0xd0c5('0x29')](handleEntityNotFound(_0x3ca6d0,null))['then'](removeEntity(_0x3ca6d0,null))[_0xd0c5('0x36')](handleError(_0x3ca6d0,null));};exports[_0xd0c5('0xc2')]=function(_0x1368c2,_0x129c1f){return db['SmsInteraction'][_0xd0c5('0xc2')]()[_0xd0c5('0x29')](respondWithResult(_0x129c1f,null))[_0xd0c5('0x36')](handleError(_0x129c1f,null));};exports[_0xd0c5('0xc3')]=function(_0x30cd2d,_0xb71ed4,_0x33b1b9){return db[_0xd0c5('0xc4')]['find']({'where':{'id':_0x30cd2d['params']['id']}})[_0xd0c5('0x29')](handleEntityNotFound(_0xb71ed4,null))[_0xd0c5('0x29')](function(_0xeaf54d){if(_0xeaf54d){return _0xeaf54d[_0xd0c5('0xc3')](_0x30cd2d[_0xd0c5('0x7a')][_0xd0c5('0xc5')],_[_0xd0c5('0xc6')](_0x30cd2d['body'],[_0xd0c5('0xc5'),'id'])||{});}})[_0xd0c5('0x29')](respondWithResult(_0xb71ed4,null))[_0xd0c5('0x36')](handleError(_0xb71ed4,null));};exports[_0xd0c5('0xc7')]=function(_0x12d341,_0x4f7c20,_0x1ddac8){var _0x273f88={'raw':![],'where':{}};var _0x1336e3={};var _0x46a4d3={'count':0x0,'rows':[]};return db[_0xd0c5('0x3f')][_0xd0c5('0xc8')]({'where':{'id':_0x12d341[_0xd0c5('0xbe')]['id']}})[_0xd0c5('0x29')](handleEntityNotFound(_0x4f7c20,null))[_0xd0c5('0x29')](function(_0x41240c){if(_0x41240c){_0x1336e3[_0xd0c5('0x43')]=_[_0xd0c5('0x45')](db[_0xd0c5('0xc4')]['rawAttributes']);_0x1336e3[_0xd0c5('0x44')]=_[_0xd0c5('0x45')](_0x12d341['query']);_0x1336e3[_0xd0c5('0x46')]=_[_0xd0c5('0x47')](_0x1336e3[_0xd0c5('0x43')],_0x1336e3[_0xd0c5('0x44')]);_0x273f88[_0xd0c5('0x48')]=_['intersection'](_0x1336e3[_0xd0c5('0x43')],qs['fields'](_0x12d341[_0xd0c5('0x44')][_0xd0c5('0x49')]));_0x273f88['attributes']=_0x273f88[_0xd0c5('0x48')][_0xd0c5('0x67')]?_0x273f88[_0xd0c5('0x48')]:_0x1336e3[_0xd0c5('0x43')];if(!_0x12d341[_0xd0c5('0x44')][_0xd0c5('0x4a')](_0xd0c5('0xc9'))){_0x273f88[_0xd0c5('0x23')]=qs['limit'](_0x12d341[_0xd0c5('0x44')][_0xd0c5('0x23')]);_0x273f88[_0xd0c5('0x21')]=qs[_0xd0c5('0x21')](_0x12d341[_0xd0c5('0x44')]['offset']);}_0x273f88[_0xd0c5('0x4b')]=qs[_0xd0c5('0x4c')](_0x12d341[_0xd0c5('0x44')]['sort']);_0x273f88['where']=qs[_0xd0c5('0x46')](_[_0xd0c5('0xca')](_0x12d341[_0xd0c5('0x44')],_0x1336e3[_0xd0c5('0x46')]));_0x273f88[_0xd0c5('0x4d')]['SmsInteractionId']=_0x41240c['id'];if(_0x12d341[_0xd0c5('0x44')][_0xd0c5('0x8b')]){_0x273f88[_0xd0c5('0x4d')]=_[_0xd0c5('0xcb')](_0x273f88[_0xd0c5('0x4d')],{'$or':_[_0xd0c5('0x30')](_0x273f88[_0xd0c5('0x48')],function(_0x19e920){var _0xa75d4a={};_0xa75d4a[_0x19e920]={'$like':'%'+_0x12d341[_0xd0c5('0x44')][_0xd0c5('0x8b')]+'%'};return _0xa75d4a;})});}if(_0x12d341['query']['$gte']){var _0x1eb5be=_0x12d341[_0xd0c5('0x44')][_0xd0c5('0x81')][_0xd0c5('0x33')](',');var _0x4fbc6e={};_0x4fbc6e[_0x1eb5be[0x0]]={'$gte':moment(_0x1eb5be[0x1])[_0xd0c5('0xcc')](_0xd0c5('0xcd'))};_0x273f88[_0xd0c5('0x4d')]=_[_0xd0c5('0xcb')](_0x273f88[_0xd0c5('0x4d')],_0x4fbc6e);}_0x273f88=_['merge']({},_0x273f88,_0x12d341[_0xd0c5('0xce')]);return db['SmsMessage']['count']({'where':_0x273f88[_0xd0c5('0x4d')]})[_0xd0c5('0x29')](function(_0x18647e){_0x46a4d3[_0xd0c5('0x24')]=_0x18647e;if(_0x12d341['query']['includeAll']){_0x273f88[_0xd0c5('0xcf')]=[{'all':!![]}];}return db[_0xd0c5('0xc4')][_0xd0c5('0xd0')](_0x273f88);})['then'](function(_0x45ddc7){_0x46a4d3[_0xd0c5('0xbc')]=_0x45ddc7;return _0x46a4d3;});}})[_0xd0c5('0x29')](respondWithFilteredResult(_0x4f7c20,_0x273f88))['catch'](handleError(_0x4f7c20,null));};exports[_0xd0c5('0xd1')]=function(_0x187a87,_0xae18bb,_0x495bd8){return db[_0xd0c5('0x3f')]['find']({'where':{'id':_0x187a87[_0xd0c5('0xbe')]['id']}})[_0xd0c5('0x29')](handleEntityNotFound(_0xae18bb,null))[_0xd0c5('0x29')](function(_0x53a4f7){if(_0x53a4f7){return _0x53a4f7[_0xd0c5('0xd2')](_0x187a87[_0xd0c5('0x7a')][_0xd0c5('0xc5')],_['omit'](_0x187a87['body'],[_0xd0c5('0xc5'),'id'])||{})[_0xd0c5('0xd3')](function(){return db[_0xd0c5('0x74')]['findAll']({'attributes':['id',_0xd0c5('0x2d'),_0xd0c5('0x4f')],'where':{'id':_0x187a87[_0xd0c5('0x7a')][_0xd0c5('0xc5')]}});})[_0xd0c5('0x29')](function(_0x380451){socket[_0xd0c5('0xd4')]('smsInteractionTags:save',{'id':Number(_0x187a87['params']['id']),'tags':_0x380451||[]});return{'id':Number(_0x187a87[_0xd0c5('0xbe')]['id']),'tags':_0x380451||[]};});}})[_0xd0c5('0x29')](respondWithResult(_0xae18bb,null))['catch'](handleError(_0xae18bb,null));};exports[_0xd0c5('0xd5')]=function(_0x1b7460,_0x234669,_0x5965fc){return db['SmsInteraction']['find']({'where':{'id':_0x1b7460['params']['id']}})[_0xd0c5('0x29')](handleEntityNotFound(_0x234669,null))[_0xd0c5('0x29')](function(_0x1cf47a){if(_0x1cf47a){return _0x1cf47a[_0xd0c5('0xd5')](_0x1b7460[_0xd0c5('0x44')][_0xd0c5('0xc5')]);}})['then'](respondWithStatusCode(_0x234669,null))[_0xd0c5('0x36')](handleError(_0x234669,null));};exports[_0xd0c5('0xd6')]=function(_0x5ed999,_0x1c0b3b){var _0x19f31d=moment()[_0xd0c5('0xd7')]()[_0xd0c5('0xa1')]();var _0x2dda57=path[_0xd0c5('0xd8')](config[_0xd0c5('0xd9')],_0xd0c5('0xda'),_0xd0c5('0xdb'),_0xd0c5('0xdc'));var _0x46ca79=path[_0xd0c5('0xd8')](config[_0xd0c5('0xd9')],_0xd0c5('0xda'),_0xd0c5('0xdb'),_0xd0c5('0xdd'));var _0x5d89b6=path[_0xd0c5('0xd8')](_0x2dda57,_0x19f31d);var _0xffdbb2=util[_0xd0c5('0xcc')]('transcript-%d-%s.zip',_0x5ed999[_0xd0c5('0xbe')]['id'],_0x19f31d);var _0x107faa=path['join'](_0x2dda57,_0xffdbb2);var _0x13085b=[];_0x13085b[_0xd0c5('0x35')]({'model':db['User'],'as':_0xd0c5('0x76'),'attributes':['id',_0xd0c5('0x31')],'raw':!![]});_0x13085b[_0xd0c5('0x35')]({'model':db[_0xd0c5('0xde')],'as':'Contact','attributes':['id',_0xd0c5('0xdf'),_0xd0c5('0xe0')],'raw':!![]});var _0x54d022=[{'model':db[_0xd0c5('0xc4')],'as':_0xd0c5('0xe1'),'attributes':['id','body',_0xd0c5('0xe2'),_0xd0c5('0xe3'),'secret',_0xd0c5('0x87')],'include':_0x13085b}];_0x54d022['push']({'model':db[_0xd0c5('0xe4')],'as':_0xd0c5('0xe5'),'attributes':['id',_0xd0c5('0x2d')]});_0x54d022[_0xd0c5('0x35')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db[_0xd0c5('0x3f')][_0xd0c5('0x70')]({'where':{'id':_0x5ed999[_0xd0c5('0xbe')]['id']},'include':_0x54d022})[_0xd0c5('0x29')](handleEntityNotFound(_0x1c0b3b,null))[_0xd0c5('0x29')](function(_0x21d66b){if(_0x21d66b){var _0x5eee78=_0x21d66b[_0xd0c5('0xe6')]({'plain':!![]});fs['mkdirSync'](_0x5d89b6);var _0x41874f={'channel':'Sms','account':_0x5eee78[_0xd0c5('0xe5')][_0xd0c5('0x2d')],'agent':_0x5eee78[_0xd0c5('0xe7')]?_0x5eee78[_0xd0c5('0xe7')][_0xd0c5('0x31')]:_0xd0c5('0xe8'),'createdAt':moment(_0x5eee78[_0xd0c5('0xe2')])[_0xd0c5('0xcc')](_0xd0c5('0xcd'))[_0xd0c5('0xa1')](),'closedAt':_0x5eee78[_0xd0c5('0x3c')]?moment(_0x5eee78[_0xd0c5('0xe9')])[_0xd0c5('0xcc')](_0xd0c5('0xcd'))[_0xd0c5('0xa1')]():'','disposition':_0x5eee78[_0xd0c5('0xea')],'messages':_(_0x5eee78[_0xd0c5('0xe1')])['filter']({'secret':![]})[_0xd0c5('0x30')](function(_0x1a6a2e){return{'date':moment(_0x1a6a2e[_0xd0c5('0xe2')])[_0xd0c5('0xcc')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd0c5('0xa1')](),'sender':_0x1a6a2e[_0xd0c5('0xe3')]===_0xd0c5('0xeb')?_0x1a6a2e[_0xd0c5('0x76')]?_0x1a6a2e[_0xd0c5('0x76')]['fullname']:_0xd0c5('0xec'):_0x1a6a2e[_0xd0c5('0x6c')][_0xd0c5('0xdf')]+(_0x1a6a2e[_0xd0c5('0x6c')][_0xd0c5('0xe0')]?'\x20'+_0x1a6a2e[_0xd0c5('0x6c')]['lastName']:''),'body':_0x1a6a2e[_0xd0c5('0x7a')],'direction':_0x1a6a2e[_0xd0c5('0xe3')]===_0xd0c5('0xeb')?'A':'C','secret':_0x1a6a2e['secret'],'read':_0x1a6a2e[_0xd0c5('0x87')]};})[_0xd0c5('0x69')]()};return ejs[_0xd0c5('0xed')](path[_0xd0c5('0xd8')](config[_0xd0c5('0xd9')],_0xd0c5('0xda'),_0xd0c5('0xee'),_0xd0c5('0xef')),{'interaction':_0x41874f})[_0xd0c5('0x29')](function(_0x10e0fa){var _0x4b5a87=path[_0xd0c5('0xd8')](_0x5d89b6,_0xd0c5('0xf0')+_0x5eee78['id']+'-'+_0x19f31d+_0xd0c5('0xf1'));var _0x8bb5c1={'path':_0x4b5a87,'channel':_0xd0c5('0xf2'),'interactionId':_0x5eee78['id']};return pdf[_0xd0c5('0xf3')](_0x10e0fa,_0x8bb5c1);})[_0xd0c5('0x29')](function(){return new BPromise(function(_0x4eff72,_0x2e04b8){zipdir(_0x5d89b6,{'saveTo':_0x107faa},function(_0x3bd4f8,_0x49792f){if(_0x3bd4f8)return _0x2e04b8(_0x3bd4f8);return _0x4eff72(_0x49792f);});})[_0xd0c5('0x29')](function(){return new BPromise(function(_0x1ee9ff,_0x5c189c){rimraf(_0x5d89b6,function(_0x56bdb6){if(_0x56bdb6)_0x5c189c(_0x56bdb6);return _0x1ee9ff();});});})[_0xd0c5('0x29')](function(){return _0x1c0b3b[_0xd0c5('0xd6')](_0x107faa,_0xffdbb2,function(_0x2c8260){if(_0x2c8260){console[_0xd0c5('0xf4')](_0xd0c5('0xf5'),_0x2c8260);}else{fs[_0xd0c5('0xf6')](_0x107faa);}});});});}else{return _0x1c0b3b[_0xd0c5('0x1e')](0xc8);}})[_0xd0c5('0x36')](handleError(_0x1c0b3b,null));}; \ No newline at end of file +var _0xf4ae=['$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','user','getSmsAccounts','isEmpty','i.SmsAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','push','all','rows','params','includeAll','options','create','describe','SmsMessage','addMessage','ids','omit','getMessages','hasOwnProperty','pick','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','lastName','createdAt','direction','secret','SmsAccount','Account','Owner','mkdirSync','Sms','closedAt','disposition','out','firstName','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','name','send','Users','map','fullname','TagIds','forEach','Tags','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','select','field','color','from','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','o.id\x20=\x20i.UserId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','split','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','some','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','parse','$gte'];(function(_0x120feb,_0x5f1724){var _0x3251ff=function(_0x3eb7a4){while(--_0x3eb7a4){_0x120feb['push'](_0x120feb['shift']());}};_0x3251ff(++_0x5f1724);}(_0xf4ae,0x69));var _0xef4a=function(_0x11ce46,_0x7a1715){_0x11ce46=_0x11ce46-0x0;var _0x272001=_0xf4ae[_0x11ce46];return _0x272001;};'use strict';var emlformat=require(_0xef4a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef4a('0x1'));var jsonpatch=require(_0xef4a('0x2'));var rp=require(_0xef4a('0x3'));var moment=require('moment');var BPromise=require(_0xef4a('0x4'));var Mustache=require('mustache');var util=require(_0xef4a('0x5'));var path=require(_0xef4a('0x6'));var sox=require(_0xef4a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xef4a('0x8'));var squel=require(_0xef4a('0x9'));var crypto=require(_0xef4a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xef4a('0xb'));var toCsv=require(_0xef4a('0xc'));var querystring=require('querystring');var Papa=require(_0xef4a('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xef4a('0xe'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xef4a('0xf'));var logger=require('../../config/logger')(_0xef4a('0x10'));var utils=require(_0xef4a('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xef4a('0x12'));var db=require(_0xef4a('0x13'))['db'];config[_0xef4a('0x14')]=_[_0xef4a('0x15')](config['redis'],{'host':_0xef4a('0x16'),'port':0x18eb});var socket=require(_0xef4a('0x17'))(new Redis(config[_0xef4a('0x14')]));require(_0xef4a('0x18'))[_0xef4a('0x19')](socket);function respondWithStatusCode(_0x2cd438,_0x1f053c){_0x1f053c=_0x1f053c||0xcc;return function(_0x15504d){if(_0x15504d){return _0x2cd438[_0xef4a('0x1a')](_0x1f053c);}return _0x2cd438[_0xef4a('0x1b')](_0x1f053c)[_0xef4a('0x1c')]();};}function respondWithResult(_0x59c130,_0x32b559){_0x32b559=_0x32b559||0xc8;return function(_0x5a72a6){if(_0x5a72a6){return _0x59c130[_0xef4a('0x1b')](_0x32b559)[_0xef4a('0x1d')](_0x5a72a6);}};}function respondWithFilteredResult(_0x4e2791,_0x5d83ca){return function(_0x214274){if(_0x214274){var _0x2d4d19=typeof _0x5d83ca[_0xef4a('0x1e')]==='undefined'&&typeof _0x5d83ca[_0xef4a('0x1f')]===_0xef4a('0x20');var _0x5ec069=_0x214274[_0xef4a('0x21')];var _0x2174f1=_0x2d4d19?0x0:_0x5d83ca['offset'];var _0x31e09a=_0x2d4d19?_0x214274[_0xef4a('0x21')]:_0x5d83ca[_0xef4a('0x1e')]+_0x5d83ca[_0xef4a('0x1f')];var _0x25a61b;if(_0x31e09a>=_0x5ec069){_0x31e09a=_0x5ec069;_0x25a61b=0xc8;}else{_0x25a61b=0xce;}_0x4e2791[_0xef4a('0x1b')](_0x25a61b);return _0x4e2791[_0xef4a('0x22')]('Content-Range',_0x2174f1+'-'+_0x31e09a+'/'+_0x5ec069)[_0xef4a('0x1d')](_0x214274);}return null;};}function patchUpdates(_0x1b8849){return function(_0x5f1223){try{jsonpatch[_0xef4a('0x23')](_0x5f1223,_0x1b8849,!![]);}catch(_0x1e4cc4){return BPromise[_0xef4a('0x24')](_0x1e4cc4);}return _0x5f1223[_0xef4a('0x25')]();};}function saveUpdates(_0x591eac,_0x4cd3df){return function(_0x28c819){if(_0x28c819){return _0x28c819[_0xef4a('0x26')](_0x591eac)[_0xef4a('0x27')](function(_0xd02756){return _0xd02756;});}return null;};}function removeEntity(_0x537879,_0x4927bb){return function(_0x4fbafe){if(_0x4fbafe){return _0x4fbafe[_0xef4a('0x28')]()[_0xef4a('0x27')](function(){_0x537879[_0xef4a('0x1b')](0xcc)[_0xef4a('0x1c')]();});}};}function handleEntityNotFound(_0x426402,_0x30d9d3){return function(_0x650f){if(!_0x650f){_0x426402['sendStatus'](0x194);}return _0x650f;};}function handleError(_0x57e2ee,_0x116831){_0x116831=_0x116831||0x1f4;return function(_0xaacf82){logger[_0xef4a('0x29')](_0xaacf82['stack']);if(_0xaacf82[_0xef4a('0x2a')]){delete _0xaacf82['name'];}_0x57e2ee['status'](_0x116831)[_0xef4a('0x2b')](_0xaacf82);};}function getInteractionUsers(_0x20ef33,_0x442676){return new BPromise(function(_0x2d879d,_0x5473bd){try{if(_0x442676[_0x20ef33['id']]){_0x20ef33[_0xef4a('0x2c')]=_[_0xef4a('0x2d')](_0x442676[_0x20ef33['id']],function(_0xba38e5){return{'id':_0xba38e5['id'],'fullname':_0xba38e5[_0xef4a('0x2e')]};});}}catch(_0x3a8a47){_0x5473bd(_0x3a8a47);}_0x2d879d(_0x20ef33);});}function getInteractionTags(_0x3d767b,_0x905b12){return new BPromise(function(_0x33f2d9,_0x5a6178){try{if(_0x3d767b[_0xef4a('0x2f')]){_0x3d767b['Tags']=[];_0x3d767b[_0xef4a('0x2f')]['split'](',')[_0xef4a('0x30')](function(_0xa5b38b){_0x3d767b[_0xef4a('0x31')]['push'](_0x905b12[_0xa5b38b]);});}delete _0x3d767b[_0xef4a('0x2f')];}catch(_0x28b123){_0x5a6178(_0x28b123);}_0x33f2d9(_0x3d767b);});}function updateSmsInteraction(_0x57d7ab,_0x37b51c,_0x22c586){return new BPromise(function(_0x15f648,_0x314dbb){return getInteractionUsers(_0x57d7ab,_0x22c586)[_0xef4a('0x27')](function(_0x1e22de){return getInteractionTags(_0x1e22de,_0x37b51c);})['then'](function(_0x2d7f61){return getStateInteraction(_0x2d7f61);})['then'](function(_0x2d7ea8){_0x15f648(_0x2d7ea8);})[_0xef4a('0x32')](function(_0x7c9b42){_0x314dbb(_0x7c9b42);});});}function getStateInteraction(_0x7de908){return new BPromise(function(_0x5f10f7){_0x7de908[_0xef4a('0x33')]=0x0;_0x7de908[_0xef4a('0x34')]=0x0;_0x7de908[_0xef4a('0x35')]=0x0;_0x7de908[_0xef4a('0x36')]=0x0;_0x7de908[_0xef4a('0x37')]=0x0;if(!_0x7de908[_0xef4a('0x38')]&&!_0x7de908[_0xef4a('0x39')]){_0x7de908['waiting']+=0x1;}if(!_0x7de908['closed']&&_0x7de908[_0xef4a('0x39')]){_0x7de908['talking']+=0x1;if(_0x7de908[_0xef4a('0x33')]){_0x7de908['waiting']-=0x1;}}if(_0x7de908['closed']&&_0x7de908[_0xef4a('0x39')]){_0x7de908[_0xef4a('0x35')]+=0x1;if(_0x7de908['talking']){_0x7de908[_0xef4a('0x34')]-=0x1;}}if(_0x7de908['closed']&&!_0x7de908[_0xef4a('0x39')]){_0x7de908[_0xef4a('0x36')]+=0x1;if(_0x7de908['waiting']){_0x7de908['waiting']-=0x1;}}_0x7de908[_0xef4a('0x37')]+=0x1;_0x5f10f7(_0x7de908);});}exports[_0xef4a('0x3a')]=function(_0x15a8a5,_0x32f431){var _0x2d588d={},_0x4a9c58={},_0x47e7de={'count':0x0,'rows':[]};var _0x585e42=_[_0xef4a('0x2d')](db[_0xef4a('0x3b')][_0xef4a('0x3c')],function(_0x43a70e){return{'name':_0x43a70e[_0xef4a('0x3d')],'type':_0x43a70e[_0xef4a('0x3e')][_0xef4a('0x3f')]};});_0x4a9c58[_0xef4a('0x40')]=_[_0xef4a('0x2d')](_0x585e42,_0xef4a('0x2a'));_0x4a9c58[_0xef4a('0x41')]=_[_0xef4a('0x42')](_0x15a8a5[_0xef4a('0x41')]);_0x4a9c58[_0xef4a('0x43')]=_[_0xef4a('0x44')](_0x4a9c58[_0xef4a('0x40')],_0x4a9c58[_0xef4a('0x41')]);_0x2d588d[_0xef4a('0x45')]=_[_0xef4a('0x44')](_0x4a9c58[_0xef4a('0x40')],qs['fields'](_0x15a8a5['query'][_0xef4a('0x46')]));_0x2d588d[_0xef4a('0x45')]=_0x2d588d[_0xef4a('0x45')][_0xef4a('0x47')]?_0x2d588d['attributes']:_0x4a9c58[_0xef4a('0x40')];if(!_0x15a8a5[_0xef4a('0x41')]['hasOwnProperty'](_0xef4a('0x48'))){_0x2d588d[_0xef4a('0x1f')]=qs[_0xef4a('0x1f')](_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x1f')]);_0x2d588d[_0xef4a('0x1e')]=qs['offset'](_0x15a8a5[_0xef4a('0x41')]['offset']);}_0x2d588d['order']=qs[_0xef4a('0x49')](_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x49')]);_0x2d588d[_0xef4a('0x4a')]=qs[_0xef4a('0x43')](_['pick'](_0x15a8a5[_0xef4a('0x41')],_0x4a9c58[_0xef4a('0x43')]),_0x585e42);var _0x5b29bb=[];var _0x1a1ca3=squel[_0xef4a('0x4b')]()[_0xef4a('0x4c')]('id')[_0xef4a('0x4c')](_0xef4a('0x2a'))['field'](_0xef4a('0x4d'))[_0xef4a('0x4e')](_0xef4a('0x4f'));var _0xfc4279=squel[_0xef4a('0x4b')]()[_0xef4a('0x4c')](_0xef4a('0x50'))['field']('u.fullname')[_0xef4a('0x4c')](_0xef4a('0x51'))[_0xef4a('0x4e')](_0xef4a('0x52'),'ui')[_0xef4a('0x53')](_0xef4a('0x54'),'u','u.id\x20=\x20ui.UserId');var _0x4ee6e7=squel[_0xef4a('0x4b')]()[_0xef4a('0x4e')](_0xef4a('0x55'),'i')[_0xef4a('0x53')](_0xef4a('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xef4a('0x54'),'o',_0xef4a('0x57'))[_0xef4a('0x53')]('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')[_0xef4a('0x53')](_0xef4a('0x58'),'me',_0xef4a('0x59'))[_0xef4a('0x53')](_0xef4a('0x5a'),'it',_0xef4a('0x5b'))[_0xef4a('0x53')](_0xef4a('0x4f'),'t',_0xef4a('0x5c'));var _0x5282ec=squel[_0xef4a('0x5d')]();var _0x30f946=[];var _0x15a8de=squel[_0xef4a('0x5d')]();var _0x5bf2c9;if(_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x5e')]){_0x5bf2c9=as[_0xef4a('0x5f')](_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x5e')]);var _0x14fb75=_0x5bf2c9['sqlOperator'];for(var _0x2b1143=0x0;_0x2b1143<_0x5bf2c9[_0xef4a('0x60')][_0xef4a('0x47')];_0x2b1143++){var _0x5c08c1=_0x5bf2c9[_0xef4a('0x60')][_0x2b1143];var _0xd0b175='i';var _0x5b22fc=_[_0xef4a('0x61')](_0x585e42,[_0xef4a('0x2a'),_0x5c08c1[_0xef4a('0x4c')]]);if(!_0x5b22fc){switch(_0x5c08c1[_0xef4a('0x4c')]){case _0xef4a('0x62'):if(_0x5c08c1[_0xef4a('0x63')]==0x1){_0x4ee6e7['having']('`'+_0x5c08c1[_0xef4a('0x4c')]+_0xef4a('0x64'));}else{_0x4ee6e7[_0xef4a('0x65')]('`'+_0x5c08c1['field']+'`\x20>\x200');}break;case _0xef4a('0x66'):if(_0x5c08c1[_0xef4a('0x67')]===_0xef4a('0x68')){if(_0x5c08c1[_0xef4a('0x63')]['split']('\x20')[_0xef4a('0x47')]>0x1){_0x5282ec[_0x14fb75](_0xef4a('0x69'),qs['getFullTextValue'](_0x5c08c1['value']),null);}else{var _0xacdbea='%'+_0x5c08c1[_0xef4a('0x63')]+'%';_0x5282ec[_0x14fb75](_0xef4a('0x6a'),_0xacdbea,_0xacdbea,_0xacdbea);}}else{_0x5b22fc=_[_0xef4a('0x61')](_0x585e42,['name',_0xef4a('0x6b')]);_0x5c08c1[_0xef4a('0x4c')]=_0xef4a('0x6b');_0xce7589=as[_0xef4a('0x6c')](_0xd0b175,_0x5b22fc[_0xef4a('0x3e')],_0x5c08c1);_0x5282ec[_0x14fb75](_0xce7589['text'],_0xce7589[_0xef4a('0x63')][_0xef4a('0x6d')],_0xce7589[_0xef4a('0x63')]['end']);}break;case _0xef4a('0x6e'):var _0x24a4bb=_0x5c08c1[_0xef4a('0x63')][_0xef4a('0x6f')](',')[_0xef4a('0x2d')](function(_0x2b8122){return Number(_0x2b8122);});_0x24a4bb[_0xef4a('0x30')](function(_0x391cc4){_0x15a8de['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x391cc4+',%');});_0x30f946=_[_0xef4a('0x70')](_0x30f946,_0x24a4bb);break;case _0xef4a('0x71'):if(_0x5c08c1[_0xef4a('0x67')]===_0xef4a('0x68')){_0x5282ec[_0x14fb75](_0xef4a('0x72'),'%'+_0x5c08c1['value']+'%',null);}else{_0x5b22fc=_[_0xef4a('0x61')](_0x585e42,[_0xef4a('0x2a'),_0xef4a('0x39')]);_0x5c08c1[_0xef4a('0x4c')]=_0xef4a('0x39');_0xce7589=as[_0xef4a('0x6c')](_0xd0b175,_0x5b22fc[_0xef4a('0x3e')],_0x5c08c1);_0x5282ec[_0x14fb75](_0xce7589[_0xef4a('0x73')],_0xce7589['value'][_0xef4a('0x6d')],_0xce7589[_0xef4a('0x63')][_0xef4a('0x1c')]);}break;case _0xef4a('0x74'):_0xce7589=as[_0xef4a('0x6c')]('me',null,_0x5c08c1);_0x5282ec[_0x14fb75](_0xce7589[_0xef4a('0x73')],_0xce7589[_0xef4a('0x63')]['start'],_0xce7589['value'][_0xef4a('0x1c')]);break;}}else{var _0xce7589=as['buildExpression'](_0xd0b175,_0x5b22fc[_0xef4a('0x3e')],_0x5c08c1);_0x5282ec[_0x14fb75](_0xce7589[_0xef4a('0x73')],_0xce7589['value'][_0xef4a('0x6d')],_0xce7589['value'][_0xef4a('0x1c')]);}}}else{var _0x3f3caf=_(_0x15a8a5['query'])[_0xef4a('0x42')]()['map'](function(_0x2b538f){return _[_0xef4a('0x75')](_0x585e42,[_0xef4a('0x2a'),_0x2b538f])?_0x2b538f:undefined;})['compact']()[_0xef4a('0x63')]();if(!_['isEmpty'](_0x3f3caf)){_0x3f3caf[_0xef4a('0x30')](function(_0x4ee119){if(_0x4ee119===_0xef4a('0x76')){_0x4ee6e7['where'](_0xef4a('0x77'),[][_0xef4a('0x78')](_0x15a8a5[_0xef4a('0x41')][_0x4ee119]));}else if(_0x4ee119==='createdAt'){var _0x5d2ff=JSON[_0xef4a('0x79')](_0x15a8a5[_0xef4a('0x41')][_0x4ee119])[_0xef4a('0x7a')];var _0x4c3439=JSON[_0xef4a('0x79')](_0x15a8a5[_0xef4a('0x41')][_0x4ee119])[_0xef4a('0x7b')];_0x4ee6e7['where'](_0xef4a('0x7c'),_0x5d2ff,_0x4c3439);}else{if(_0x15a8a5[_0xef4a('0x41')][_0x4ee119]==='null'){_0x4ee6e7[_0xef4a('0x4a')]('i.'+_0x4ee119+_0xef4a('0x7d'));}else{_0x4ee6e7['where']('i.'+_0x4ee119+_0xef4a('0x7e'),_0x15a8a5[_0xef4a('0x41')][_0x4ee119]);}}});}if(_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x7f')]){if(_0x15a8a5[_0xef4a('0x41')]['read']==0x1){_0x4ee6e7[_0xef4a('0x65')](_0xef4a('0x80'));}else{_0x4ee6e7[_0xef4a('0x65')](_0xef4a('0x81'));}}if(_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x82')]){_0x30f946=_[_0xef4a('0x83')](_0x15a8a5[_0xef4a('0x41')]['tag'])?_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x82')]:new Array(_0x15a8a5[_0xef4a('0x41')]['tag']);_0x30f946[_0xef4a('0x30')](function(_0x2dc09f){_0x15a8de['or'](_0xef4a('0x84'),'%,'+_0x2dc09f+',%');});}if(_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x85')]){var _0x333a73=_0x15a8a5[_0xef4a('0x41')]['filter'][_0xef4a('0x86')]('\x5c','\x5c\x5c')[_0xef4a('0x86')](/'/g,'\x27\x27');if(qs[_0xef4a('0x87')](_0x333a73)){_0x5282ec['or']('i.id\x20LIKE\x20?',_0x333a73+'%')['or']('i.phone\x20LIKE\x20?',_0x333a73+'%');}else{_0x5282ec['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xef4a('0x88')](_0x333a73))['or'](_0xef4a('0x89'),_0x333a73+'%');}}}_0x4ee6e7['where'](_0x5282ec);_0x4ee6e7['group']('i.id');var _0x3b065c={'type':db[_0xef4a('0x8a')]['QueryTypes'][_0xef4a('0x8b')],'raw':!![]};var _0x4fee07=_0x4ee6e7['clone']();_0x4fee07[_0xef4a('0x4c')]('i.id');_0x4fee07[_0xef4a('0x4c')](_0xef4a('0x8c'),'unreadMessages');if(_0x2d588d[_0xef4a('0x8d')]){_0x2d588d['order'][_0xef4a('0x30')](function(_0x23cf41){var _0x3bf972=_0x23cf41[0x0]==='contactName'?_0x23cf41[0x0]:'i.'+_0x23cf41[0x0];_0x4ee6e7[_0xef4a('0x8d')](_0x3bf972,_0x23cf41[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x30f946)){_0x4ee6e7[_0xef4a('0x65')](_0x15a8de);_0x4fee07['where'](_0xef4a('0x8e'),_0x30f946);}BPromise[_0xef4a('0x8f')]()['then'](function(){if(!_0x5bf2c9){if(_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x76')])return;_0x4fee07['where'](_0xef4a('0x90'));_0x4ee6e7[_0xef4a('0x4a')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x15a8a5['user'][_0xef4a('0x91')]!=='agent')return;return _0x15a8a5[_0xef4a('0x92')][_0xef4a('0x93')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1669fc){if(_[_0xef4a('0x94')](_0x1669fc)){_0x4fee07[_0xef4a('0x4a')]('i.SmsAccountId\x20IS\x20NULL');_0x4ee6e7[_0xef4a('0x4a')](_0xef4a('0x95'));}else{_0x4fee07[_0xef4a('0x4a')]('i.SmsAccountId\x20IN\x20?',_[_0xef4a('0x2d')](_0x1669fc,'id'));_0x4ee6e7[_0xef4a('0x4a')](_0xef4a('0x77'),_[_0xef4a('0x2d')](_0x1669fc,'id'));}});})[_0xef4a('0x27')](function(){if(_0x15a8a5[_0xef4a('0x92')][_0xef4a('0x91')]===_0xef4a('0x96')&&!_0x5bf2c9&&!_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x76')])return[];return db['sequelize']['query'](_0x4fee07[_0xef4a('0x97')](),_0x3b065c);})['then'](function(_0xbfd21f){_0x47e7de[_0xef4a('0x21')]=_0xbfd21f[_0xef4a('0x47')];if(_0x47e7de[_0xef4a('0x21')]===0x0)return[];return db[_0xef4a('0x98')][_0xef4a('0x41')](_0x1a1ca3[_0xef4a('0x97')](),_0x3b065c)[_0xef4a('0x27')](function(_0x356115){_0x5b29bb=_[_0xef4a('0x99')](_0x356115,'id');_0x3b065c=_[_0xef4a('0x9a')](_0x3b065c,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x15a8a5[_0xef4a('0x41')][_0xef4a('0x46')]){_0x2d588d[_0xef4a('0x45')][_0xef4a('0x30')](function(_0xfef20c){_0x4ee6e7[_0xef4a('0x4c')]('i.'+_0xfef20c);});}else{_0x4ee6e7['field'](_0xef4a('0x8c'),_0xef4a('0x62'));_0x4ee6e7[_0xef4a('0x4c')]('a.key',_0xef4a('0x9b'));_0x4ee6e7[_0xef4a('0x4c')](_0xef4a('0x9c'),_0xef4a('0x9d'));_0x4ee6e7[_0xef4a('0x4c')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xef4a('0x9e'));_0x4ee6e7[_0xef4a('0x4c')](_0xef4a('0x9f'));_0x4ee6e7[_0xef4a('0x4c')]('c.firstName','Contact.firstName');_0x4ee6e7[_0xef4a('0x4c')](_0xef4a('0xa0'),_0xef4a('0xa1'));_0x4ee6e7[_0xef4a('0x4c')](_0xef4a('0xa2'),_0xef4a('0xa3'));_0x4ee6e7['field'](_0xef4a('0xa4'),_0xef4a('0xa5'));_0x4ee6e7[_0xef4a('0x4c')](_0xef4a('0xa6'),_0xef4a('0xa7'));_0x4ee6e7[_0xef4a('0x4c')](_0xef4a('0xa8'),'Contact.fax');_0x4ee6e7[_0xef4a('0x4c')]('o.fullname',_0xef4a('0xa9'));_0x4ee6e7['field'](_0xef4a('0xaa'),_0xef4a('0xab'));_0x4ee6e7[_0xef4a('0x4c')](_0xef4a('0xac'),_0xef4a('0x2f'));}if(_0x2d588d['limit'])_0x4ee6e7[_0xef4a('0x1f')](_0x2d588d['limit']);if(_0x2d588d['offset'])_0x4ee6e7['offset'](_0x2d588d[_0xef4a('0x1e')]);return db['sequelize'][_0xef4a('0x41')](_0x4ee6e7[_0xef4a('0x97')](),_0x3b065c);})['then'](function(_0xe677c7){if(_0xe677c7[_0xef4a('0x47')]>0x0)_0xfc4279[_0xef4a('0x4a')]('ui.SmsInteractionId\x20IN\x20?',_[_0xef4a('0x2d')](_0xe677c7,'id'));return db['sequelize']['query'](_0xfc4279[_0xef4a('0x97')](),_0x3b065c)[_0xef4a('0x27')](function(_0x37294a){var _0x31d1d8=_[_0xef4a('0xad')](_0x37294a,_0xef4a('0xae'));var _0xb77615=[];_0xe677c7[_0xef4a('0x30')](function(_0x4b8f84){_0xb77615[_0xef4a('0xaf')](updateSmsInteraction(_0x4b8f84,_0x5b29bb,_0x31d1d8));});return BPromise[_0xef4a('0xb0')](_0xb77615);});});})[_0xef4a('0x27')](function(_0x28d6ed){_0x47e7de[_0xef4a('0xb1')]=_0x28d6ed;return _0x47e7de;})[_0xef4a('0x27')](respondWithFilteredResult(_0x32f431,_0x2d588d))[_0xef4a('0x32')](handleError(_0x32f431,null));};exports['show']=function(_0x265f13,_0x2a1034){var _0x17178c={'raw':![],'where':{'id':_0x265f13[_0xef4a('0xb2')]['id']}},_0x1d450c={};_0x1d450c[_0xef4a('0x40')]=_[_0xef4a('0x42')](db[_0xef4a('0x3b')][_0xef4a('0x3c')]);_0x1d450c['query']=_[_0xef4a('0x42')](_0x265f13[_0xef4a('0x41')]);_0x1d450c[_0xef4a('0x43')]=_[_0xef4a('0x44')](_0x1d450c[_0xef4a('0x40')],_0x1d450c[_0xef4a('0x41')]);_0x17178c[_0xef4a('0x45')]=_[_0xef4a('0x44')](_0x1d450c[_0xef4a('0x40')],qs['fields'](_0x265f13[_0xef4a('0x41')]['fields']));_0x17178c[_0xef4a('0x45')]=_0x17178c[_0xef4a('0x45')]['length']?_0x17178c['attributes']:_0x1d450c['model'];if(_0x265f13['query'][_0xef4a('0xb3')]){_0x17178c['include']=[{'all':!![]}];}_0x17178c=_[_0xef4a('0x9a')]({},_0x17178c,_0x265f13[_0xef4a('0xb4')]);return db['SmsInteraction'][_0xef4a('0x61')](_0x17178c)[_0xef4a('0x27')](handleEntityNotFound(_0x2a1034,null))['then'](respondWithResult(_0x2a1034,null))[_0xef4a('0x32')](handleError(_0x2a1034,null));};exports[_0xef4a('0xb5')]=function(_0x2f354c,_0x43e872){return db[_0xef4a('0x3b')]['create'](_0x2f354c[_0xef4a('0x74')],{})[_0xef4a('0x27')](respondWithResult(_0x43e872,0xc9))['catch'](handleError(_0x43e872,null));};exports[_0xef4a('0x26')]=function(_0x51c6ad,_0x5c38d2){if(_0x51c6ad['body']['id']){delete _0x51c6ad[_0xef4a('0x74')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x51c6ad[_0xef4a('0xb2')]['id']}})[_0xef4a('0x27')](handleEntityNotFound(_0x5c38d2,null))[_0xef4a('0x27')](saveUpdates(_0x51c6ad['body'],null))[_0xef4a('0x27')](respondWithResult(_0x5c38d2,null))['catch'](handleError(_0x5c38d2,null));};exports[_0xef4a('0x28')]=function(_0x1b4204,_0x5d4e7d){return db['SmsInteraction'][_0xef4a('0x61')]({'where':{'id':_0x1b4204[_0xef4a('0xb2')]['id']}})[_0xef4a('0x27')](handleEntityNotFound(_0x5d4e7d,null))[_0xef4a('0x27')](removeEntity(_0x5d4e7d,null))[_0xef4a('0x32')](handleError(_0x5d4e7d,null));};exports[_0xef4a('0xb6')]=function(_0x3bbfe7,_0x3cd6bc){return db[_0xef4a('0x3b')][_0xef4a('0xb6')]()[_0xef4a('0x27')](respondWithResult(_0x3cd6bc,null))['catch'](handleError(_0x3cd6bc,null));};exports['addMessage']=function(_0x136858,_0x493c5f,_0x1a95e3){return db[_0xef4a('0xb7')][_0xef4a('0x61')]({'where':{'id':_0x136858[_0xef4a('0xb2')]['id']}})[_0xef4a('0x27')](handleEntityNotFound(_0x493c5f,null))[_0xef4a('0x27')](function(_0x2abde3){if(_0x2abde3){return _0x2abde3[_0xef4a('0xb8')](_0x136858['body'][_0xef4a('0xb9')],_[_0xef4a('0xba')](_0x136858[_0xef4a('0x74')],[_0xef4a('0xb9'),'id'])||{});}})[_0xef4a('0x27')](respondWithResult(_0x493c5f,null))[_0xef4a('0x32')](handleError(_0x493c5f,null));};exports[_0xef4a('0xbb')]=function(_0x2ceda7,_0x344739,_0x1acd1f){var _0x214e81={'raw':![],'where':{}};var _0x556e14={};var _0x3ee928={'count':0x0,'rows':[]};return db[_0xef4a('0x3b')]['findOne']({'where':{'id':_0x2ceda7['params']['id']}})['then'](handleEntityNotFound(_0x344739,null))[_0xef4a('0x27')](function(_0x3d06ba){if(_0x3d06ba){_0x556e14[_0xef4a('0x40')]=_['keys'](db[_0xef4a('0xb7')][_0xef4a('0x3c')]);_0x556e14[_0xef4a('0x41')]=_[_0xef4a('0x42')](_0x2ceda7['query']);_0x556e14[_0xef4a('0x43')]=_[_0xef4a('0x44')](_0x556e14[_0xef4a('0x40')],_0x556e14[_0xef4a('0x41')]);_0x214e81['attributes']=_[_0xef4a('0x44')](_0x556e14[_0xef4a('0x40')],qs['fields'](_0x2ceda7[_0xef4a('0x41')][_0xef4a('0x46')]));_0x214e81['attributes']=_0x214e81[_0xef4a('0x45')]['length']?_0x214e81['attributes']:_0x556e14[_0xef4a('0x40')];if(!_0x2ceda7[_0xef4a('0x41')][_0xef4a('0xbc')](_0xef4a('0x48'))){_0x214e81['limit']=qs[_0xef4a('0x1f')](_0x2ceda7[_0xef4a('0x41')][_0xef4a('0x1f')]);_0x214e81['offset']=qs['offset'](_0x2ceda7[_0xef4a('0x41')][_0xef4a('0x1e')]);}_0x214e81[_0xef4a('0x8d')]=qs[_0xef4a('0x49')](_0x2ceda7[_0xef4a('0x41')][_0xef4a('0x49')]);_0x214e81[_0xef4a('0x4a')]=qs['filters'](_[_0xef4a('0xbd')](_0x2ceda7[_0xef4a('0x41')],_0x556e14[_0xef4a('0x43')]));_0x214e81[_0xef4a('0x4a')][_0xef4a('0xae')]=_0x3d06ba['id'];if(_0x2ceda7[_0xef4a('0x41')][_0xef4a('0x85')]){_0x214e81['where']=_[_0xef4a('0x9a')](_0x214e81[_0xef4a('0x4a')],{'$or':_[_0xef4a('0x2d')](_0x214e81[_0xef4a('0x45')],function(_0x1abe70){var _0x48b0e9={};_0x48b0e9[_0x1abe70]={'$like':'%'+_0x2ceda7[_0xef4a('0x41')]['filter']+'%'};return _0x48b0e9;})});}if(_0x2ceda7[_0xef4a('0x41')][_0xef4a('0x7a')]){var _0x3f1f6a=_0x2ceda7['query']['$gte'][_0xef4a('0x6f')](',');var _0x58e8f1={};_0x58e8f1[_0x3f1f6a[0x0]]={'$gte':moment(_0x3f1f6a[0x1])[_0xef4a('0xbe')](_0xef4a('0xbf'))};_0x214e81[_0xef4a('0x4a')]=_[_0xef4a('0x9a')](_0x214e81[_0xef4a('0x4a')],_0x58e8f1);}_0x214e81=_['merge']({},_0x214e81,_0x2ceda7[_0xef4a('0xb4')]);return db[_0xef4a('0xb7')][_0xef4a('0x21')]({'where':_0x214e81[_0xef4a('0x4a')]})[_0xef4a('0x27')](function(_0x51fdcb){_0x3ee928['count']=_0x51fdcb;if(_0x2ceda7[_0xef4a('0x41')][_0xef4a('0xb3')]){_0x214e81[_0xef4a('0xc0')]=[{'all':!![]}];}return db[_0xef4a('0xb7')][_0xef4a('0xc1')](_0x214e81);})[_0xef4a('0x27')](function(_0x3c9263){_0x3ee928[_0xef4a('0xb1')]=_0x3c9263;return _0x3ee928;});}})[_0xef4a('0x27')](respondWithFilteredResult(_0x344739,_0x214e81))[_0xef4a('0x32')](handleError(_0x344739,null));};exports[_0xef4a('0xc2')]=function(_0x1540bd,_0x276260,_0x4d31de){return db['SmsInteraction']['find']({'where':{'id':_0x1540bd[_0xef4a('0xb2')]['id']}})['then'](handleEntityNotFound(_0x276260,null))[_0xef4a('0x27')](function(_0x341cd2){if(_0x341cd2){return _0x341cd2[_0xef4a('0xc3')](_0x1540bd[_0xef4a('0x74')][_0xef4a('0xb9')],_['omit'](_0x1540bd[_0xef4a('0x74')],[_0xef4a('0xb9'),'id'])||{})[_0xef4a('0xc4')](function(){return db['Tag'][_0xef4a('0xc1')]({'attributes':['id','name',_0xef4a('0x4d')],'where':{'id':_0x1540bd[_0xef4a('0x74')][_0xef4a('0xb9')]}});})['then'](function(_0x548c6f){socket['emit'](_0xef4a('0xc5'),{'id':Number(_0x1540bd[_0xef4a('0xb2')]['id']),'tags':_0x548c6f||[]});return{'id':Number(_0x1540bd[_0xef4a('0xb2')]['id']),'tags':_0x548c6f||[]};});}})['then'](respondWithResult(_0x276260,null))[_0xef4a('0x32')](handleError(_0x276260,null));};exports[_0xef4a('0xc6')]=function(_0x218dfe,_0x211154,_0x2df6c9){return db[_0xef4a('0x3b')][_0xef4a('0x61')]({'where':{'id':_0x218dfe[_0xef4a('0xb2')]['id']}})['then'](handleEntityNotFound(_0x211154,null))[_0xef4a('0x27')](function(_0x1c0b11){if(_0x1c0b11){return _0x1c0b11['removeTags'](_0x218dfe['query'][_0xef4a('0xb9')]);}})['then'](respondWithStatusCode(_0x211154,null))[_0xef4a('0x32')](handleError(_0x211154,null));};exports[_0xef4a('0xc7')]=function(_0x360001,_0x17e9d8){var _0x2660f0=moment()[_0xef4a('0xc8')]()[_0xef4a('0x97')]();var _0x565018=path[_0xef4a('0xc9')](config[_0xef4a('0xca')],_0xef4a('0xcb'),_0xef4a('0xcc'),_0xef4a('0xcd'));var _0x16478e=path[_0xef4a('0xc9')](config['root'],'server',_0xef4a('0xcc'),_0xef4a('0xce'));var _0x49bab9=path[_0xef4a('0xc9')](_0x565018,_0x2660f0);var _0x4458b5=util['format'](_0xef4a('0xcf'),_0x360001[_0xef4a('0xb2')]['id'],_0x2660f0);var _0x3369a3=path[_0xef4a('0xc9')](_0x565018,_0x4458b5);var _0x267a11=[];_0x267a11[_0xef4a('0xaf')]({'model':db[_0xef4a('0x71')],'as':_0xef4a('0x71'),'attributes':['id',_0xef4a('0x2e')],'raw':!![]});_0x267a11['push']({'model':db[_0xef4a('0xd0')],'as':_0xef4a('0x66'),'attributes':['id','firstName',_0xef4a('0xd1')],'raw':!![]});var _0x4b69d2=[{'model':db[_0xef4a('0xb7')],'as':'Messages','attributes':['id',_0xef4a('0x74'),_0xef4a('0xd2'),_0xef4a('0xd3'),_0xef4a('0xd4'),'read'],'include':_0x267a11}];_0x4b69d2[_0xef4a('0xaf')]({'model':db[_0xef4a('0xd5')],'as':_0xef4a('0xd6'),'attributes':['id',_0xef4a('0x2a')]});_0x4b69d2[_0xef4a('0xaf')]({'model':db[_0xef4a('0x71')],'as':_0xef4a('0xd7'),'attributes':['id',_0xef4a('0x2e')]});return db[_0xef4a('0x3b')][_0xef4a('0x61')]({'where':{'id':_0x360001[_0xef4a('0xb2')]['id']},'include':_0x4b69d2})[_0xef4a('0x27')](handleEntityNotFound(_0x17e9d8,null))['then'](function(_0x5352d7){if(_0x5352d7){var _0x1799b0=_0x5352d7['get']({'plain':!![]});fs[_0xef4a('0xd8')](_0x49bab9);var _0x140e72={'channel':_0xef4a('0xd9'),'account':_0x1799b0['Account']['name'],'agent':_0x1799b0[_0xef4a('0xd7')]?_0x1799b0[_0xef4a('0xd7')][_0xef4a('0x2e')]:'N.A.','createdAt':moment(_0x1799b0[_0xef4a('0xd2')])['format'](_0xef4a('0xbf'))[_0xef4a('0x97')](),'closedAt':_0x1799b0[_0xef4a('0x38')]?moment(_0x1799b0[_0xef4a('0xda')])[_0xef4a('0xbe')](_0xef4a('0xbf'))[_0xef4a('0x97')]():'','disposition':_0x1799b0[_0xef4a('0xdb')],'messages':_(_0x1799b0['Messages'])[_0xef4a('0x85')]({'secret':![]})[_0xef4a('0x2d')](function(_0x523e0d){return{'date':moment(_0x523e0d[_0xef4a('0xd2')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x523e0d[_0xef4a('0xd3')]===_0xef4a('0xdc')?_0x523e0d['User']?_0x523e0d[_0xef4a('0x71')][_0xef4a('0x2e')]:'System':_0x523e0d[_0xef4a('0x66')][_0xef4a('0xdd')]+(_0x523e0d['Contact'][_0xef4a('0xd1')]?'\x20'+_0x523e0d['Contact'][_0xef4a('0xd1')]:''),'body':_0x523e0d[_0xef4a('0x74')],'direction':_0x523e0d['direction']===_0xef4a('0xdc')?'A':'C','secret':_0x523e0d['secret'],'read':_0x523e0d[_0xef4a('0x7f')]};})[_0xef4a('0x63')]()};return ejs['renderFile'](path[_0xef4a('0xc9')](config[_0xef4a('0xca')],_0xef4a('0xcb'),_0xef4a('0xde'),'downloadInteraction.ejs'),{'interaction':_0x140e72})[_0xef4a('0x27')](function(_0x2bcafb){var _0x41ca08=path[_0xef4a('0xc9')](_0x49bab9,_0xef4a('0xdf')+_0x1799b0['id']+'-'+_0x2660f0+_0xef4a('0xe0'));var _0x1f1ebd={'path':_0x41ca08,'channel':_0xef4a('0xd9'),'interactionId':_0x1799b0['id']};return pdf[_0xef4a('0xe1')](_0x2bcafb,_0x1f1ebd);})['then'](function(){return new BPromise(function(_0xba2fb4,_0x3b5d5d){zipdir(_0x49bab9,{'saveTo':_0x3369a3},function(_0x20f26f,_0x3b7a25){if(_0x20f26f)return _0x3b5d5d(_0x20f26f);return _0xba2fb4(_0x3b7a25);});})[_0xef4a('0x27')](function(){return new BPromise(function(_0x499075,_0x144df8){rimraf(_0x49bab9,function(_0x493b03){if(_0x493b03)_0x144df8(_0x493b03);return _0x499075();});});})['then'](function(){return _0x17e9d8[_0xef4a('0xc7')](_0x3369a3,_0x4458b5,function(_0x506edd){if(_0x506edd){console['log'](_0xef4a('0xe2'),_0x506edd);}else{fs[_0xef4a('0xe3')](_0x3369a3);}});});});}else{return _0x17e9d8[_0xef4a('0x1a')](0xc8);}})[_0xef4a('0x32')](handleError(_0x17e9d8,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 3e8e2eb..bb29122 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 _0x430c=['setMaxListeners','getUsers','setDataValue','Users','map','findAll','then','length','emit','catch','hook','events','../../mysqldb','SmsMessage'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0x430c,0x1a1));var _0xc430=function(_0x403cff,_0x1cf463){_0x403cff=_0x403cff-0x0;var _0x5a7c56=_0x430c[_0x403cff];return _0x5a7c56;};'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 +var _0xef0f=['SmsInteraction','../../mysqldb','SmsMessage','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x39e740,_0x3a3084){var _0x49d5fc=function(_0x344959){while(--_0x344959){_0x39e740['push'](_0x39e740['shift']());}};_0x49d5fc(++_0x3a3084);}(_0xef0f,0x168));var _0xfef0=function(_0x2970c2,_0x59b21e){_0x2970c2=_0x2970c2-0x0;var _0x9e3084=_0xef0f[_0x2970c2];return _0x9e3084;};'use strict';var EventEmitter=require(_0xfef0('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xfef0('0x1')];var SmsMessage=require(_0xfef0('0x2'))['db'][_0xfef0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfef0('0x4'),'afterUpdate':_0xfef0('0x5'),'afterDestroy':_0xfef0('0x6')};function emitEvent(_0x4e1af6){return function(_0x2a6fcf,_0x9b8b9e,_0x2697df){_0x2a6fcf[_0xfef0('0x7')]({'attributes':['id'],'raw':!![]})[_0xfef0('0x8')](function(_0x11dfd7){_0x2a6fcf['setDataValue'](_0xfef0('0x9'),_0x11dfd7['map'](function(_0x82e37a){return{'id':_0x82e37a['id']};}));return SmsMessage[_0xfef0('0xa')]({'where':{'SmsInteractionId':_0x2a6fcf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfef0('0x8')](function(_0x2d42dc){_0x2a6fcf[_0xfef0('0xb')](_0xfef0('0xc'),_0x2d42dc[_0xfef0('0xd')]);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6+':'+_0x2a6fcf['id'],_0x2a6fcf);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6,_0x2a6fcf);_0x2697df(null);})[_0xfef0('0xf')](_0x2697df(null));};}for(var e in events){if(events[_0xfef0('0x10')](e)){var event=events[e];SmsInteraction[_0xfef0('0x11')](e,emitEvent(event));}}module[_0xfef0('0x12')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index ee4dbb1..6f73fb9 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 _0xa788=['SmsInteraction','sms_interactions','changed','closed','closedAt','format','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define'];(function(_0x38641e,_0x25874e){var _0x49856e=function(_0x22d863){while(--_0x22d863){_0x38641e['push'](_0x38641e['shift']());}};_0x49856e(++_0x25874e);}(_0xa788,0xb0));var _0x8a78=function(_0x44e7f3,_0x98b960){_0x44e7f3=_0x44e7f3-0x0;var _0x181870=_0xa788[_0x44e7f3];return _0x181870;};'use strict';var _=require('lodash');var util=require(_0x8a78('0x0'));var logger=require(_0x8a78('0x1'))('api');var moment=require(_0x8a78('0x2'));var BPromise=require(_0x8a78('0x3'));var rp=require(_0x8a78('0x4'));var fs=require('fs');var path=require(_0x8a78('0x5'));var rimraf=require(_0x8a78('0x6'));var config=require(_0x8a78('0x7'));var attributes=require(_0x8a78('0x8'));module[_0x8a78('0x9')]=function(_0x2d84b4,_0x13cfd0){return _0x2d84b4[_0x8a78('0xa')](_0x8a78('0xb'),attributes,{'tableName':_0x8a78('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40bccd,_0x1b5188,_0x272b04){if(_0x40bccd[_0x8a78('0xd')](_0x8a78('0xe'))){_0x40bccd[_0x8a78('0xf')]=moment()[_0x8a78('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x272b04(null,_0x40bccd);}}});}; \ No newline at end of file +var _0x6c98=['SmsInteraction','sms_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define'];(function(_0x299175,_0x5333a3){var _0x3db1d8=function(_0xc4f39){while(--_0xc4f39){_0x299175['push'](_0x299175['shift']());}};_0x3db1d8(++_0x5333a3);}(_0x6c98,0x90));var _0x86c9=function(_0x3125e5,_0xe55296){_0x3125e5=_0x3125e5-0x0;var _0x5ea5de=_0x6c98[_0x3125e5];return _0x5ea5de;};'use strict';var _=require(_0x86c9('0x0'));var util=require(_0x86c9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x86c9('0x2'));var BPromise=require(_0x86c9('0x3'));var rp=require(_0x86c9('0x4'));var fs=require('fs');var path=require(_0x86c9('0x5'));var rimraf=require(_0x86c9('0x6'));var config=require(_0x86c9('0x7'));var attributes=require(_0x86c9('0x8'));module['exports']=function(_0x597c04,_0x991b3e){return _0x597c04[_0x86c9('0x9')](_0x86c9('0xa'),attributes,{'tableName':_0x86c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a208c,_0x210aa8,_0x1ef80b){if(_0x3a208c['changed'](_0x86c9('0xc'))){_0x3a208c['closedAt']=moment()['format'](_0x86c9('0xd'));}_0x1ef80b(null,_0x3a208c);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 00cfc91..360ec35 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 _0xc9bf=['request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsInteraction','update','body','raw','options','where','attributes','UpdateSmsInteraction','AddTagsToSmsInteraction','find','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc9bf,0xde));var _0xfc9b=function(_0x4463eb,_0x3cd3fb){_0x4463eb=_0x4463eb-0x0;var _0x1d20d5=_0xc9bf[_0x4463eb];return _0x1d20d5;};'use strict';var _=require(_0xfc9b('0x0'));var util=require(_0xfc9b('0x1'));var moment=require(_0xfc9b('0x2'));var BPromise=require(_0xfc9b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc9b('0x4'));var db=require(_0xfc9b('0x5'))['db'];var utils=require(_0xfc9b('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfc9b('0x7')][_0xfc9b('0x8')]({'port':0x232a});config[_0xfc9b('0x9')]=_[_0xfc9b('0xa')](config[_0xfc9b('0x9')],{'host':_0xfc9b('0xb'),'port':0x18eb});var socket=require(_0xfc9b('0xc'))(new Redis(config[_0xfc9b('0x9')]));require(_0xfc9b('0xd'))[_0xfc9b('0xe')](socket);function respondWithRpcPromise(_0x11560c,_0x4ec117,_0x5ddde8){return new BPromise(function(_0xdc5d06,_0x5e3d0e){return client['request'](_0x11560c,_0x5ddde8)[_0xfc9b('0xf')](function(_0x48e0fe){logger[_0xfc9b('0x10')](_0xfc9b('0x11'),_0x4ec117,_0xfc9b('0x12'));logger[_0xfc9b('0x13')](_0xfc9b('0x14'),_0x4ec117,_0xfc9b('0x12'),JSON[_0xfc9b('0x15')](_0x48e0fe));if(_0x48e0fe[_0xfc9b('0x16')]){if(_0x48e0fe[_0xfc9b('0x16')][_0xfc9b('0x17')]===0x1f4){logger[_0xfc9b('0x16')](_0xfc9b('0x11'),_0x4ec117,_0x48e0fe['error'][_0xfc9b('0x18')]);return _0x5e3d0e(_0x48e0fe[_0xfc9b('0x16')][_0xfc9b('0x18')]);}logger[_0xfc9b('0x16')](_0xfc9b('0x11'),_0x4ec117,_0x48e0fe['error'][_0xfc9b('0x18')]);return _0xdc5d06(_0x48e0fe[_0xfc9b('0x16')][_0xfc9b('0x18')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x4ec117,_0xfc9b('0x12'));_0xdc5d06(_0x48e0fe[_0xfc9b('0x19')][_0xfc9b('0x18')]);}})[_0xfc9b('0x1a')](function(_0x1ef4a9){logger[_0xfc9b('0x16')](_0xfc9b('0x11'),_0x4ec117,_0x1ef4a9);_0x5e3d0e(_0x1ef4a9);});});}exports['UpdateSmsInteraction']=function(_0x29a3e8){var _0x2cfff7=this;return new Promise(function(_0x2ce805,_0x2247bf){return db[_0xfc9b('0x1b')][_0xfc9b('0x1c')](_0x29a3e8[_0xfc9b('0x1d')],{'raw':_0x29a3e8['options']?_0x29a3e8['options'][_0xfc9b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29a3e8[_0xfc9b('0x1f')]?_0x29a3e8[_0xfc9b('0x1f')][_0xfc9b('0x20')]||null:null,'attributes':_0x29a3e8[_0xfc9b('0x1f')]?_0x29a3e8[_0xfc9b('0x1f')][_0xfc9b('0x21')]||null:null,'limit':_0x29a3e8[_0xfc9b('0x1f')]?_0x29a3e8[_0xfc9b('0x1f')]['limit']||null:null})['then'](function(_0x3cd2ef){logger[_0xfc9b('0x10')]('UpdateSmsInteraction',_0x29a3e8);logger[_0xfc9b('0x13')](_0xfc9b('0x22'),_0x29a3e8,JSON[_0xfc9b('0x15')](_0x3cd2ef));_0x2ce805(_0x3cd2ef);})[_0xfc9b('0x1a')](function(_0x270974){logger[_0xfc9b('0x16')](_0xfc9b('0x22'),_0x270974[_0xfc9b('0x18')],_0x29a3e8);_0x2247bf(_0x2cfff7['error'](0x1f4,_0x270974[_0xfc9b('0x18')]));});});};exports[_0xfc9b('0x23')]=function(_0x1c815d){return new Promise(function(_0x2e2bb6,_0x487861){return db[_0xfc9b('0x1b')][_0xfc9b('0x24')]({'where':_0x1c815d[_0xfc9b('0x1f')]?_0x1c815d[_0xfc9b('0x1f')][_0xfc9b('0x20')]||null:null})['then'](function(_0x1e0e74){if(_0x1e0e74){return _0x1e0e74['addTags'](_0x1c815d[_0xfc9b('0x1d')][_0xfc9b('0x25')],_[_0xfc9b('0x26')](_0x1c815d['body'],[_0xfc9b('0x25'),'id'])||{});}})['spread'](function(_0x401fbe){logger[_0xfc9b('0x10')](_0xfc9b('0x27'),_0x1c815d);logger[_0xfc9b('0x13')](_0xfc9b('0x27'),_0x1c815d,JSON['stringify'](_0x401fbe));_0x2e2bb6(_0x401fbe);})[_0xfc9b('0x1a')](function(_0x5c80fa){logger[_0xfc9b('0x16')](_0xfc9b('0x27'),_0x5c80fa[_0xfc9b('0x18')],_0x1c815d);_0x487861(_this['error'](0x1f4,_0x5c80fa[_0xfc9b('0x18')]));});});}; \ No newline at end of file +var _0x0e6a=['AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','limit'];(function(_0x4a4592,_0x4ce90d){var _0x41185d=function(_0x365d3f){while(--_0x365d3f){_0x4a4592['push'](_0x4a4592['shift']());}};_0x41185d(++_0x4ce90d);}(_0x0e6a,0x197));var _0xa0e6=function(_0x4557d1,_0x1d7c22){_0x4557d1=_0x4557d1-0x0;var _0x5c27bc=_0x0e6a[_0x4557d1];return _0x5c27bc;};'use strict';var _=require(_0xa0e6('0x0'));var util=require('util');var moment=require(_0xa0e6('0x1'));var BPromise=require(_0xa0e6('0x2'));var rs=require(_0xa0e6('0x3'));var fs=require('fs');var Redis=require(_0xa0e6('0x4'));var db=require(_0xa0e6('0x5'))['db'];var utils=require(_0xa0e6('0x6'));var logger=require(_0xa0e6('0x7'))('rpc');var config=require(_0xa0e6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa0e6('0x9')][_0xa0e6('0xa')]({'port':0x232a});config[_0xa0e6('0xb')]=_[_0xa0e6('0xc')](config[_0xa0e6('0xb')],{'host':_0xa0e6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0xfffd35,_0x4c8dec,_0x55b824){return new BPromise(function(_0xaee3cd,_0x1f7186){return client[_0xa0e6('0xe')](_0xfffd35,_0x55b824)[_0xa0e6('0xf')](function(_0x4c21a6){logger[_0xa0e6('0x10')](_0xa0e6('0x11'),_0x4c8dec,_0xa0e6('0x12'));logger[_0xa0e6('0x13')](_0xa0e6('0x14'),_0x4c8dec,'request\x20sent',JSON[_0xa0e6('0x15')](_0x4c21a6));if(_0x4c21a6[_0xa0e6('0x16')]){if(_0x4c21a6[_0xa0e6('0x16')][_0xa0e6('0x17')]===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x4c8dec,_0x4c21a6[_0xa0e6('0x16')][_0xa0e6('0x18')]);return _0x1f7186(_0x4c21a6[_0xa0e6('0x16')]['message']);}logger[_0xa0e6('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x4c8dec,_0x4c21a6[_0xa0e6('0x16')][_0xa0e6('0x18')]);return _0xaee3cd(_0x4c21a6[_0xa0e6('0x16')][_0xa0e6('0x18')]);}else{logger[_0xa0e6('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x4c8dec,_0xa0e6('0x12'));_0xaee3cd(_0x4c21a6['result'][_0xa0e6('0x18')]);}})[_0xa0e6('0x19')](function(_0x2fdd9d){logger[_0xa0e6('0x16')](_0xa0e6('0x11'),_0x4c8dec,_0x2fdd9d);_0x1f7186(_0x2fdd9d);});});}exports[_0xa0e6('0x1a')]=function(_0x50c558){var _0x5a1352=this;return new Promise(function(_0x21e462,_0x4dc54d){return db[_0xa0e6('0x1b')]['update'](_0x50c558[_0xa0e6('0x1c')],{'raw':_0x50c558[_0xa0e6('0x1d')]?_0x50c558['options'][_0xa0e6('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50c558['options']?_0x50c558[_0xa0e6('0x1d')][_0xa0e6('0x1f')]||null:null,'attributes':_0x50c558[_0xa0e6('0x1d')]?_0x50c558[_0xa0e6('0x1d')]['attributes']||null:null,'limit':_0x50c558['options']?_0x50c558[_0xa0e6('0x1d')][_0xa0e6('0x20')]||null:null})[_0xa0e6('0xf')](function(_0x4b705b){logger[_0xa0e6('0x10')](_0xa0e6('0x1a'),_0x50c558);logger[_0xa0e6('0x13')](_0xa0e6('0x1a'),_0x50c558,JSON[_0xa0e6('0x15')](_0x4b705b));_0x21e462(_0x4b705b);})['catch'](function(_0x5c4407){logger[_0xa0e6('0x16')]('UpdateSmsInteraction',_0x5c4407[_0xa0e6('0x18')],_0x50c558);_0x4dc54d(_0x5a1352[_0xa0e6('0x16')](0x1f4,_0x5c4407['message']));});});};exports[_0xa0e6('0x21')]=function(_0x160566){return new Promise(function(_0x21c28f,_0x3040a8){return db[_0xa0e6('0x1b')][_0xa0e6('0x22')]({'where':_0x160566[_0xa0e6('0x1d')]?_0x160566[_0xa0e6('0x1d')]['where']||null:null})[_0xa0e6('0xf')](function(_0x1dc5a7){if(_0x1dc5a7){return _0x1dc5a7[_0xa0e6('0x23')](_0x160566[_0xa0e6('0x1c')][_0xa0e6('0x24')],_[_0xa0e6('0x25')](_0x160566[_0xa0e6('0x1c')],[_0xa0e6('0x24'),'id'])||{});}})[_0xa0e6('0x26')](function(_0x5cc757){logger[_0xa0e6('0x10')]('AddTags',_0x160566);logger[_0xa0e6('0x13')](_0xa0e6('0x27'),_0x160566,JSON[_0xa0e6('0x15')](_0x5cc757));_0x21c28f(_0x5cc757);})['catch'](function(_0x13941e){logger[_0xa0e6('0x16')]('AddTags',_0x13941e[_0xa0e6('0x18')],_0x160566);_0x3040a8(_this[_0xa0e6('0x16')](0x1f4,_0x13941e['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 58cc9ba..1055e2e 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 _0x9e61=['length','smsInteraction:','./smsInteraction.events','save','remove','removeListener','register'];(function(_0x2870fa,_0x35f624){var _0x3763f9=function(_0x465fbf){while(--_0x465fbf){_0x2870fa['push'](_0x2870fa['shift']());}};_0x3763f9(++_0x35f624);}(_0x9e61,0x18a));var _0x19e6=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x9e61[_0x411017];return _0x2adeea;};'use strict';var SmsInteractionEvents=require(_0x19e6('0x0'));var events=[_0x19e6('0x1'),_0x19e6('0x2'),'update'];function createListener(_0x564b4e,_0x4c2bb4){return function(_0x484477){_0x4c2bb4['emit'](_0x564b4e,_0x484477);};}function removeListener(_0x312876,_0x4a32e4){return function(){SmsInteractionEvents[_0x19e6('0x3')](_0x312876,_0x4a32e4);};}exports[_0x19e6('0x4')]=function(_0x40b5a7){for(var _0x1ead86=0x0,_0x29dc1a=events[_0x19e6('0x5')];_0x1ead86<_0x29dc1a;_0x1ead86++){var _0xbf952e=events[_0x1ead86];var _0x1ac418=createListener(_0x19e6('0x6')+_0xbf952e,_0x40b5a7);SmsInteractionEvents['on'](_0xbf952e,_0x1ac418);}}; \ No newline at end of file +var _0x558e=['./smsInteraction.events','save','remove','update','emit','register','smsInteraction:'];(function(_0x3540f7,_0x24916e){var _0x4da083=function(_0xdebb83){while(--_0xdebb83){_0x3540f7['push'](_0x3540f7['shift']());}};_0x4da083(++_0x24916e);}(_0x558e,0x69));var _0xe558=function(_0x764874,_0x3ed544){_0x764874=_0x764874-0x0;var _0x29f9d5=_0x558e[_0x764874];return _0x29f9d5;};'use strict';var SmsInteractionEvents=require(_0xe558('0x0'));var events=[_0xe558('0x1'),_0xe558('0x2'),_0xe558('0x3')];function createListener(_0x350680,_0x1114f9){return function(_0x166232){_0x1114f9[_0xe558('0x4')](_0x350680,_0x166232);};}function removeListener(_0x1a6d99,_0x3fc144){return function(){SmsInteractionEvents['removeListener'](_0x1a6d99,_0x3fc144);};}exports[_0xe558('0x5')]=function(_0x30ea91){for(var _0xa0cd79=0x0,_0x3f444b=events['length'];_0xa0cd79<_0x3f444b;_0xa0cd79++){var _0x42541a=events[_0xa0cd79];var _0x18f7bc=createListener(_0xe558('0x6')+_0x42541a,_0x30ea91);SmsInteractionEvents['on'](_0x42541a,_0x18f7bc);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 978ba74..3d76cf4 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 _0xfbb2=['isAuthenticated','show','smsmessage:create','create','post','status','update','put','/:id/accept','accept','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','/describe','describe','/:id'];(function(_0x4e9a07,_0x1b49f0){var _0xab802a=function(_0x73ba57){while(--_0x73ba57){_0x4e9a07['push'](_0x4e9a07['shift']());}};_0xab802a(++_0x1b49f0);}(_0xfbb2,0xae));var _0x2fbb=function(_0x5b3c61,_0x3eb2aa){_0x5b3c61=_0x5b3c61-0x0;var _0x153389=_0xfbb2[_0x5b3c61];return _0x153389;};'use strict';var multer=require(_0x2fbb('0x0'));var util=require(_0x2fbb('0x1'));var path=require(_0x2fbb('0x2'));var timeout=require(_0x2fbb('0x3'));var express=require('express');var router=express[_0x2fbb('0x4')]();var fs_extra=require(_0x2fbb('0x5'));var auth=require(_0x2fbb('0x6'));var interaction=require(_0x2fbb('0x7'));var config=require(_0x2fbb('0x8'));var controller=require(_0x2fbb('0x9'));router[_0x2fbb('0xa')]('/',auth['isAuthenticated'](),controller[_0x2fbb('0xb')]);router[_0x2fbb('0xa')](_0x2fbb('0xc'),auth['isAuthenticated'](),controller[_0x2fbb('0xd')]);router[_0x2fbb('0xa')](_0x2fbb('0xe'),auth[_0x2fbb('0xf')](),controller[_0x2fbb('0x10')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked']('sms',_0x2fbb('0x11')),controller[_0x2fbb('0x12')]);router[_0x2fbb('0x13')]('/:id/status',controller[_0x2fbb('0x14')]);router['put'](_0x2fbb('0xe'),auth[_0x2fbb('0xf')](),controller[_0x2fbb('0x15')]);router[_0x2fbb('0x16')](_0x2fbb('0x17'),auth['isAuthenticated'](),controller[_0x2fbb('0x18')]);router[_0x2fbb('0x16')]('/:id/reject',auth[_0x2fbb('0xf')](),controller['reject']);router[_0x2fbb('0x19')](_0x2fbb('0xe'),auth[_0x2fbb('0xf')](),controller['destroy']);module[_0x2fbb('0x1a')]=router; \ No newline at end of file +var _0x4f8f=['isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','express','fs-extra','../../components/auth/service','./smsMessage.controller'];(function(_0x36615c,_0x126c0b){var _0x5a5bc3=function(_0x471406){while(--_0x471406){_0x36615c['push'](_0x36615c['shift']());}};_0x5a5bc3(++_0x126c0b);}(_0x4f8f,0x175));var _0xf4f8=function(_0x5ebd40,_0x10609d){_0x5ebd40=_0x5ebd40-0x0;var _0x4a4294=_0x4f8f[_0x5ebd40];return _0x4a4294;};'use strict';var multer=require('multer');var util=require(_0xf4f8('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf4f8('0x1'));var router=express['Router']();var fs_extra=require(_0xf4f8('0x2'));var auth=require(_0xf4f8('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf4f8('0x4'));router['get']('/',auth[_0xf4f8('0x5')](),controller[_0xf4f8('0x6')]);router[_0xf4f8('0x7')](_0xf4f8('0x8'),auth[_0xf4f8('0x5')](),controller[_0xf4f8('0x9')]);router['get'](_0xf4f8('0xa'),auth[_0xf4f8('0x5')](),controller[_0xf4f8('0xb')]);router[_0xf4f8('0xc')]('/',auth[_0xf4f8('0x5')](),interaction[_0xf4f8('0xd')](_0xf4f8('0xe'),_0xf4f8('0xf')),controller[_0xf4f8('0x10')]);router[_0xf4f8('0xc')]('/:id/status',controller[_0xf4f8('0x11')]);router[_0xf4f8('0x12')](_0xf4f8('0xa'),auth[_0xf4f8('0x5')](),controller[_0xf4f8('0x13')]);router[_0xf4f8('0x12')](_0xf4f8('0x14'),auth[_0xf4f8('0x5')](),controller[_0xf4f8('0x15')]);router[_0xf4f8('0x12')](_0xf4f8('0x16'),auth['isAuthenticated'](),controller[_0xf4f8('0x17')]);router[_0xf4f8('0x18')](_0xf4f8('0xa'),auth[_0xf4f8('0x5')](),controller[_0xf4f8('0x19')]);module[_0xf4f8('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 411ae4c..e15cb33 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 _0x3a4f=['sequelize','TEXT','medium','out','STRING'];(function(_0x5721c4,_0x2ffbd4){var _0x597a5f=function(_0x2387a5){while(--_0x2387a5){_0x5721c4['push'](_0x5721c4['shift']());}};_0x597a5f(++_0x2ffbd4);}(_0x3a4f,0x18b));var _0xf3a4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3a4f[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xf3a4('0x0'));module['exports']={'body':{'type':Sequelize[_0xf3a4('0x1')](_0xf3a4('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf3a4('0x3')),'defaultValue':_0xf3a4('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf3a4('0x4')]},'providerResponse':{'type':Sequelize[_0xf3a4('0x1')]}}; \ No newline at end of file +var _0x181d=['DATE','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x23d241,_0x9f5d38){var _0x21a740=function(_0x31c6fe){while(--_0x31c6fe){_0x23d241['push'](_0x23d241['shift']());}};_0x21a740(++_0x9f5d38);}(_0x181d,0x10f));var _0xd181=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x181d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xd181('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd181('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd181('0x2')]('in',_0xd181('0x3')),'defaultValue':_0xd181('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xd181('0x4')]},'readAt':{'type':Sequelize[_0xd181('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd181('0x0')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 1097e1f..19a0a4c 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 _0xf0f1=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','request\x20sent','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','destroy','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','SmsMessage','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','sms-interactions','accept','sms','read','readAt','format','UserId','agent','get','update','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','internal','interface','channel','motionChannel','event','EventManager','SmsInteractionId','role','null','rejectMessage','Sequelize','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','results','groupName','DELIVERED','infobip','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3fdf03,_0x1665a9){var _0x2a5497=function(_0x367f02){while(--_0x367f02){_0x3fdf03['push'](_0x3fdf03['shift']());}};_0x2a5497(++_0x1665a9);}(_0xf0f1,0x110));var _0x1f0f=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0xf0f1[_0x4defd6];return _0x4c9276;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f0f('0x0'));var zipdir=require(_0x1f0f('0x1'));var jsonpatch=require(_0x1f0f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1f0f('0x3'));var Mustache=require('mustache');var util=require(_0x1f0f('0x4'));var path=require('path');var sox=require(_0x1f0f('0x5'));var csv=require(_0x1f0f('0x6'));var ejs=require(_0x1f0f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f0f('0x8'));var squel=require(_0x1f0f('0x9'));var crypto=require(_0x1f0f('0xa'));var jsforce=require(_0x1f0f('0xb'));var deskjs=require(_0x1f0f('0xc'));var toCsv=require(_0x1f0f('0x6'));var querystring=require(_0x1f0f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1f0f('0xe'));var qs=require(_0x1f0f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f0f('0x10'));var logger=require(_0x1f0f('0x11'))(_0x1f0f('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1f0f('0x13'));var db=require('../../mysqldb')['db'];config[_0x1f0f('0x14')]=_[_0x1f0f('0x15')](config[_0x1f0f('0x14')],{'host':_0x1f0f('0x16'),'port':0x18eb});var socket=require(_0x1f0f('0x17'))(new Redis(config[_0x1f0f('0x14')]));require(_0x1f0f('0x18'))[_0x1f0f('0x19')](socket);var jayson=require(_0x1f0f('0x1a'));var client=jayson[_0x1f0f('0x1b')][_0x1f0f('0x1c')]({'port':0x232c});var client9002=jayson[_0x1f0f('0x1b')][_0x1f0f('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x795854,_0x1edcc3,_0x4abdc4,_0x96bafe){return new BPromise(function(_0x22d72c,_0xfd1fe5){var _0x11a307=_0x96bafe||client;return _0x11a307[_0x1f0f('0x1d')](_0x795854,_0x4abdc4)[_0x1f0f('0x1e')](function(_0x1bd19e){logger[_0x1f0f('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x1edcc3,'request\x20sent');logger[_0x1f0f('0x20')](_0x1f0f('0x21'),_0x1edcc3,'request\x20sent',JSON['stringify'](_0x1bd19e));if(_0x1bd19e[_0x1f0f('0x22')]){if(_0x1bd19e[_0x1f0f('0x22')][_0x1f0f('0x23')]===0x1f4){logger['error'](_0x1f0f('0x24'),_0x1edcc3,_0x1bd19e[_0x1f0f('0x22')][_0x1f0f('0x25')]);return _0xfd1fe5(_0x1bd19e[_0x1f0f('0x22')][_0x1f0f('0x25')]);}logger[_0x1f0f('0x22')](_0x1f0f('0x24'),_0x1edcc3,_0x1bd19e[_0x1f0f('0x22')][_0x1f0f('0x25')]);return _0x22d72c(_0x1bd19e[_0x1f0f('0x22')][_0x1f0f('0x25')]);}else{logger[_0x1f0f('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x1edcc3,_0x1f0f('0x26'));_0x22d72c(_0x1bd19e[_0x1f0f('0x27')][_0x1f0f('0x25')]);}})['catch'](function(_0x2b8635){logger[_0x1f0f('0x22')](_0x1f0f('0x24'),_0x1edcc3,_0x2b8635);_0xfd1fe5(_0x2b8635);});});}function respondWithStatusCode(_0x464c57,_0x5ab5fc){_0x5ab5fc=_0x5ab5fc||0xcc;return function(_0x38bd70){if(_0x38bd70){return _0x464c57[_0x1f0f('0x28')](_0x5ab5fc);}return _0x464c57[_0x1f0f('0x29')](_0x5ab5fc)[_0x1f0f('0x2a')]();};}function respondWithResult(_0x3ce818,_0x17fa03){_0x17fa03=_0x17fa03||0xc8;return function(_0x5c265f){if(_0x5c265f){return _0x3ce818[_0x1f0f('0x29')](_0x17fa03)[_0x1f0f('0x2b')](_0x5c265f);}};}function respondWithFilteredResult(_0x380b36,_0xc959a6){return function(_0x155d3c){if(_0x155d3c){var _0x351eb6=typeof _0xc959a6[_0x1f0f('0x2c')]===_0x1f0f('0x2d')&&typeof _0xc959a6[_0x1f0f('0x2e')]==='undefined';var _0x36002c=_0x155d3c[_0x1f0f('0x2f')];var _0x19aee2=_0x351eb6?0x0:_0xc959a6[_0x1f0f('0x2c')];var _0x5a5611=_0x351eb6?_0x155d3c[_0x1f0f('0x2f')]:_0xc959a6[_0x1f0f('0x2c')]+_0xc959a6[_0x1f0f('0x2e')];var _0x1e45c0;if(_0x5a5611>=_0x36002c){_0x5a5611=_0x36002c;_0x1e45c0=0xc8;}else{_0x1e45c0=0xce;}_0x380b36[_0x1f0f('0x29')](_0x1e45c0);return _0x380b36[_0x1f0f('0x30')]('Content-Range',_0x19aee2+'-'+_0x5a5611+'/'+_0x36002c)[_0x1f0f('0x2b')](_0x155d3c);}return null;};}function patchUpdates(_0x29788e){return function(_0x200306){try{jsonpatch[_0x1f0f('0x31')](_0x200306,_0x29788e,!![]);}catch(_0x47036a){return BPromise['reject'](_0x47036a);}return _0x200306[_0x1f0f('0x32')]();};}function saveUpdates(_0x5d2285,_0x2c5319){return function(_0x3489db){if(_0x3489db){return _0x3489db['update'](_0x5d2285)['then'](function(_0x4d6975){return _0x4d6975;});}return null;};}function removeEntity(_0x5941b5,_0x463432){return function(_0x145854){if(_0x145854){return _0x145854[_0x1f0f('0x33')]()[_0x1f0f('0x1e')](function(){_0x5941b5['status'](0xcc)[_0x1f0f('0x2a')]();});}};}function handleEntityNotFound(_0x14e8c4,_0x3a4786){return function(_0x90730){if(!_0x90730){_0x14e8c4['sendStatus'](0x194);}return _0x90730;};}function handleError(_0x25022c,_0x3f8877){_0x3f8877=_0x3f8877||0x1f4;return function(_0xa91d4d){logger[_0x1f0f('0x22')](_0xa91d4d[_0x1f0f('0x34')]);if(_0xa91d4d[_0x1f0f('0x35')]){delete _0xa91d4d[_0x1f0f('0x35')];}_0x25022c[_0x1f0f('0x29')](_0x3f8877)[_0x1f0f('0x36')](_0xa91d4d);};}exports[_0x1f0f('0x37')]=function(_0x5f31a9,_0x23fa95){var _0x205d86={},_0x49e847={},_0xc7b28={'count':0x0,'rows':[]};var _0x423ef0=_['map'](db['SmsMessage'][_0x1f0f('0x38')],function(_0x1abc2c){return{'name':_0x1abc2c['fieldName'],'type':_0x1abc2c[_0x1f0f('0x39')][_0x1f0f('0x3a')]};});_0x49e847[_0x1f0f('0x3b')]=_[_0x1f0f('0x3c')](_0x423ef0,'name');_0x49e847[_0x1f0f('0x3d')]=_[_0x1f0f('0x3e')](_0x5f31a9[_0x1f0f('0x3d')]);_0x49e847[_0x1f0f('0x3f')]=_[_0x1f0f('0x40')](_0x49e847[_0x1f0f('0x3b')],_0x49e847['query']);_0x205d86['attributes']=_['intersection'](_0x49e847[_0x1f0f('0x3b')],qs['fields'](_0x5f31a9[_0x1f0f('0x3d')][_0x1f0f('0x41')]));_0x205d86['attributes']=_0x205d86[_0x1f0f('0x42')]['length']?_0x205d86[_0x1f0f('0x42')]:_0x49e847[_0x1f0f('0x3b')];if(!_0x5f31a9[_0x1f0f('0x3d')][_0x1f0f('0x43')](_0x1f0f('0x44'))){_0x205d86[_0x1f0f('0x2e')]=qs[_0x1f0f('0x2e')](_0x5f31a9[_0x1f0f('0x3d')][_0x1f0f('0x2e')]);_0x205d86['offset']=qs[_0x1f0f('0x2c')](_0x5f31a9[_0x1f0f('0x3d')][_0x1f0f('0x2c')]);}_0x205d86[_0x1f0f('0x45')]=qs[_0x1f0f('0x46')](_0x5f31a9['query']['sort']);_0x205d86['where']=qs['filters'](_[_0x1f0f('0x47')](_0x5f31a9['query'],_0x49e847[_0x1f0f('0x3f')]),_0x423ef0);if(_0x5f31a9[_0x1f0f('0x3d')][_0x1f0f('0x48')]){_0x205d86['where']=_[_0x1f0f('0x49')](_0x205d86[_0x1f0f('0x4a')],{'$or':_[_0x1f0f('0x3c')](_0x423ef0,function(_0x5a0f2b){if(_0x5a0f2b[_0x1f0f('0x39')]!==_0x1f0f('0x4b')){var _0x3353f7={};_0x3353f7[_0x5a0f2b['name']]={'$like':'%'+_0x5f31a9[_0x1f0f('0x3d')][_0x1f0f('0x48')]+'%'};return _0x3353f7;}})});}_0x205d86=_[_0x1f0f('0x49')]({},_0x205d86,_0x5f31a9[_0x1f0f('0x4c')]);var _0x194d24={'where':_0x205d86[_0x1f0f('0x4a')]};return db[_0x1f0f('0x4d')][_0x1f0f('0x2f')](_0x194d24)[_0x1f0f('0x1e')](function(_0xc04ddb){_0xc7b28[_0x1f0f('0x2f')]=_0xc04ddb;if(_0x5f31a9[_0x1f0f('0x3d')][_0x1f0f('0x4e')]){_0x205d86[_0x1f0f('0x4f')]=[{'all':!![]}];}return db[_0x1f0f('0x4d')][_0x1f0f('0x50')](_0x205d86);})['then'](function(_0x5ea941){_0xc7b28[_0x1f0f('0x51')]=_0x5ea941;return _0xc7b28;})[_0x1f0f('0x1e')](respondWithFilteredResult(_0x23fa95,_0x205d86))[_0x1f0f('0x52')](handleError(_0x23fa95,null));};exports[_0x1f0f('0x53')]=function(_0x443e10,_0x2c2c86){var _0x380e8b={'raw':!![],'where':{'id':_0x443e10[_0x1f0f('0x54')]['id']}},_0x1e3355={};_0x1e3355[_0x1f0f('0x3b')]=_[_0x1f0f('0x3e')](db[_0x1f0f('0x4d')][_0x1f0f('0x38')]);_0x1e3355[_0x1f0f('0x3d')]=_[_0x1f0f('0x3e')](_0x443e10[_0x1f0f('0x3d')]);_0x1e3355[_0x1f0f('0x3f')]=_['intersection'](_0x1e3355[_0x1f0f('0x3b')],_0x1e3355['query']);_0x380e8b['attributes']=_['intersection'](_0x1e3355[_0x1f0f('0x3b')],qs[_0x1f0f('0x41')](_0x443e10[_0x1f0f('0x3d')][_0x1f0f('0x41')]));_0x380e8b[_0x1f0f('0x42')]=_0x380e8b[_0x1f0f('0x42')][_0x1f0f('0x55')]?_0x380e8b[_0x1f0f('0x42')]:_0x1e3355[_0x1f0f('0x3b')];if(_0x443e10['query']['includeAll']){_0x380e8b[_0x1f0f('0x4f')]=[{'all':!![]}];}_0x380e8b=_[_0x1f0f('0x49')]({},_0x380e8b,_0x443e10[_0x1f0f('0x4c')]);return db[_0x1f0f('0x4d')][_0x1f0f('0x56')](_0x380e8b)['then'](handleEntityNotFound(_0x2c2c86,null))[_0x1f0f('0x1e')](respondWithResult(_0x2c2c86,null))[_0x1f0f('0x52')](handleError(_0x2c2c86,null));};exports[_0x1f0f('0x57')]=function(_0x144f36,_0x24e2c0){return db[_0x1f0f('0x4d')]['create'](_0x144f36[_0x1f0f('0x58')],{})['then'](respondWithResult(_0x24e2c0,0xc9))[_0x1f0f('0x52')](handleError(_0x24e2c0,null));};exports['update']=function(_0x1f341a,_0x2a9a9e){if(_0x1f341a['body']['id']){delete _0x1f341a[_0x1f0f('0x58')]['id'];}return db[_0x1f0f('0x4d')][_0x1f0f('0x56')]({'where':{'id':_0x1f341a[_0x1f0f('0x54')]['id']}})[_0x1f0f('0x1e')](handleEntityNotFound(_0x2a9a9e,null))['then'](saveUpdates(_0x1f341a['body'],null))[_0x1f0f('0x1e')](respondWithResult(_0x2a9a9e,null))[_0x1f0f('0x52')](handleError(_0x2a9a9e,null));};exports['destroy']=function(_0x47cbf5,_0x31e9c3){return db['SmsMessage'][_0x1f0f('0x56')]({'where':{'id':_0x47cbf5[_0x1f0f('0x54')]['id']}})[_0x1f0f('0x1e')](handleEntityNotFound(_0x31e9c3,null))['then'](removeEntity(_0x31e9c3,null))[_0x1f0f('0x52')](handleError(_0x31e9c3,null));};exports['describe']=function(_0x4defd3,_0x59f621){return db['SmsMessage']['describe']()[_0x1f0f('0x1e')](respondWithResult(_0x59f621,null))['catch'](handleError(_0x59f621,null));};var interaction_log=require(_0x1f0f('0x11'))(_0x1f0f('0x59'));exports[_0x1f0f('0x5a')]=function(_0x3ef5cd,_0x250944,_0x4709eb){var _0x22f6a8={'agent':{},'channel':_0x1f0f('0x5b')};if(_0x3ef5cd[_0x1f0f('0x58')]['id']){delete _0x3ef5cd[_0x1f0f('0x58')]['id'];}_0x3ef5cd[_0x1f0f('0x58')][_0x1f0f('0x5c')]=!![];_0x3ef5cd['body'][_0x1f0f('0x5d')]=moment()[_0x1f0f('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x3ef5cd['body'][_0x1f0f('0x5f')]=_0x3ef5cd[_0x1f0f('0x58')][_0x1f0f('0x5f')]||_0x3ef5cd['user']['id'];_0x22f6a8[_0x1f0f('0x60')]['id']=_0x3ef5cd[_0x1f0f('0x58')][_0x1f0f('0x5f')];return db[_0x1f0f('0x4d')][_0x1f0f('0x56')]({'where':{'id':_0x3ef5cd[_0x1f0f('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x250944,null))[_0x1f0f('0x1e')](saveUpdates(_0x3ef5cd[_0x1f0f('0x58')],null))[_0x1f0f('0x1e')](function(_0x24734e){if(_0x24734e){_0x22f6a8['message']=_0x24734e[_0x1f0f('0x61')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x24734e['SmsInteractionId']}});}return null;})[_0x1f0f('0x1e')](handleEntityNotFound(_0x250944,null))[_0x1f0f('0x1e')](function(_0x6c0bbb){if(_0x6c0bbb){return _0x6c0bbb[_0x1f0f('0x62')]({'UserId':_0x3ef5cd[_0x1f0f('0x58')][_0x1f0f('0x5f')],'read1stAt':_[_0x1f0f('0x63')](_0x6c0bbb['read1stAt'])?moment()[_0x1f0f('0x5e')](_0x1f0f('0x64')):undefined});}return null;})[_0x1f0f('0x1e')](function(_0x12ffda){if(_0x12ffda){_0x22f6a8[_0x1f0f('0x65')]=_0x12ffda[_0x1f0f('0x61')]({'plain':!![]});interaction_log['info'](_0x1f0f('0x66'),_0x3ef5cd[_0x1f0f('0x67')]['id'],_0x3ef5cd[_0x1f0f('0x67')][_0x1f0f('0x35')],_0x3ef5cd[_0x1f0f('0x67')]['role'],_0x22f6a8['interaction']['id'],_0x3ef5cd[_0x1f0f('0x58')]?JSON[_0x1f0f('0x68')](_0x3ef5cd[_0x1f0f('0x58')]):'null');return respondWithRpcPromise(_0x1f0f('0x69'),'acceptMessage',_0x22f6a8);}return null;})[_0x1f0f('0x1e')](function(_0x5aa2eb){var _0xe15cd1=_0x1f0f('0x6a')+_0x5aa2eb[_0x1f0f('0x25')][_0x1f0f('0x6b')];return db[_0x1f0f('0x6c')][_0x1f0f('0x3d')](_0xe15cd1,{'type':db['Sequelize'][_0x1f0f('0x6d')][_0x1f0f('0x6e')],'raw':!![]})[_0x1f0f('0x1e')](function(_0x9d6c5b){return _0x9d6c5b;});})[_0x1f0f('0x1e')](function(_0x49640f){if(_0x49640f){_0x22f6a8['message'][_0x1f0f('0x6f')]=_0x49640f[0x0];if(!_0x3ef5cd[_0x1f0f('0x58')][_0x1f0f('0x5f')])return;return db['User'][_0x1f0f('0x56')]({'where':{'id':_0x3ef5cd[_0x1f0f('0x58')][_0x1f0f('0x5f')],'role':'agent'},'attributes':['id',_0x1f0f('0x35'),_0x1f0f('0x70'),_0x1f0f('0x71'),_0x1f0f('0x72')],'raw':!![]});}return null;})[_0x1f0f('0x1e')](function(_0xcacbaf){if(!_0xcacbaf)return null;_0x22f6a8['message'][_0x1f0f('0x60')]=_0xcacbaf;return _0x22f6a8;})[_0x1f0f('0x1e')](function(_0x24c9bd){if(_0x24c9bd){if(_0x3ef5cd[_0x1f0f('0x58')]['manual']){_0x22f6a8[_0x1f0f('0x25')][_0x1f0f('0x73')]=util['format']('SIP/%s',_0x3ef5cd['user'][_0x1f0f('0x35')]);_0x22f6a8[_0x1f0f('0x25')]['channel']=_0x22f6a8[_0x1f0f('0x74')];_0x22f6a8['message'][_0x1f0f('0x75')]=_0x22f6a8[_0x1f0f('0x74')];_0x22f6a8[_0x1f0f('0x25')][_0x1f0f('0x76')]=_0x1f0f('0x5a');return respondWithRpcPromise('EventManager',_0x1f0f('0x77'),{'event':'acceptmessage','message':_0x22f6a8[_0x1f0f('0x25')]},client9002)[_0x1f0f('0x1e')](function(){return _0x22f6a8;});}return _0x22f6a8;}return null;})[_0x1f0f('0x1e')](respondWithResult(_0x250944,null))['catch'](handleError(_0x250944,null));};var interaction_log=require(_0x1f0f('0x11'))(_0x1f0f('0x59'));exports['reject']=function(_0x51ed46,_0x49b2d3,_0x49e74c){var _0x16196e={'agent':{},'channel':_0x1f0f('0x5b')};if(_0x51ed46[_0x1f0f('0x58')]['id']){delete _0x51ed46[_0x1f0f('0x58')]['id'];}_0x51ed46[_0x1f0f('0x58')][_0x1f0f('0x5f')]=_0x51ed46[_0x1f0f('0x58')]['UserId']||_0x51ed46[_0x1f0f('0x67')]['id'];_0x16196e['agent']['id']=_0x51ed46[_0x1f0f('0x58')]['UserId'];return db[_0x1f0f('0x4d')][_0x1f0f('0x56')]({'where':{'id':_0x51ed46['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x49b2d3,null))['then'](function(_0x366aad){if(_0x366aad){_0x16196e[_0x1f0f('0x25')]=_0x366aad[_0x1f0f('0x61')]({'plain':!![]});return db['SmsInteraction'][_0x1f0f('0x56')]({'where':{'id':_0x366aad[_0x1f0f('0x78')]}});}return null;})[_0x1f0f('0x1e')](handleEntityNotFound(_0x49b2d3,null))['then'](function(_0x45682b){if(_0x45682b){_0x16196e[_0x1f0f('0x65')]=_0x45682b[_0x1f0f('0x61')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x51ed46[_0x1f0f('0x67')]['id'],_0x51ed46[_0x1f0f('0x67')][_0x1f0f('0x35')],_0x51ed46[_0x1f0f('0x67')][_0x1f0f('0x79')],_0x16196e['interaction']['id'],_0x51ed46[_0x1f0f('0x58')]?JSON[_0x1f0f('0x68')](_0x51ed46[_0x1f0f('0x58')]):_0x1f0f('0x7a'));return respondWithRpcPromise('RejectMessage',_0x1f0f('0x7b'),_0x16196e);}return null;})[_0x1f0f('0x1e')](function(_0x4ffcea){var _0x458de2=_0x1f0f('0x6a')+_0x4ffcea[_0x1f0f('0x25')]['ContactId'];return db[_0x1f0f('0x6c')]['query'](_0x458de2,{'type':db[_0x1f0f('0x7c')][_0x1f0f('0x6d')][_0x1f0f('0x6e')],'raw':!![]})[_0x1f0f('0x1e')](function(_0x363565){return _0x363565;});})[_0x1f0f('0x1e')](function(_0x363867){if(_0x363867){_0x16196e[_0x1f0f('0x25')]['contact']=_0x363867[0x0];if(!_0x51ed46[_0x1f0f('0x58')]['UserId'])return;return db['User'][_0x1f0f('0x56')]({'where':{'id':_0x51ed46[_0x1f0f('0x58')][_0x1f0f('0x5f')],'role':_0x1f0f('0x60')},'attributes':['id',_0x1f0f('0x35'),_0x1f0f('0x70'),_0x1f0f('0x71'),_0x1f0f('0x72')],'raw':!![]});}return null;})[_0x1f0f('0x1e')](function(_0x118817){if(!_0x118817)return null;_0x16196e[_0x1f0f('0x25')][_0x1f0f('0x60')]=_0x118817;return _0x16196e;})['then'](function(_0x360e97){if(_0x360e97){_0x360e97[_0x1f0f('0x25')][_0x1f0f('0x73')]=util[_0x1f0f('0x5e')]('SIP/%s',_0x51ed46[_0x1f0f('0x67')][_0x1f0f('0x35')]);_0x360e97[_0x1f0f('0x25')]['channel']=_0x16196e[_0x1f0f('0x74')];_0x360e97[_0x1f0f('0x25')]['motionChannel']=_0x16196e[_0x1f0f('0x74')];_0x360e97[_0x1f0f('0x25')]['event']='reject';respondWithRpcPromise(_0x1f0f('0x77'),'EventManager',{'event':_0x1f0f('0x7d'),'message':_0x360e97[_0x1f0f('0x25')]},client9002);return _0x16196e;}return null;})['then'](respondWithResult(_0x49b2d3,null))['catch'](handleError(_0x49b2d3,null));};exports['status']=function(_0x196c89,_0x13dfb7,_0x10c0f8){if(_0x196c89[_0x1f0f('0x58')]['id']){delete _0x196c89[_0x1f0f('0x58')]['id'];}var _0x33caa0;return db[_0x1f0f('0x4d')]['find']({'where':{'id':_0x196c89[_0x1f0f('0x54')]['id']}})[_0x1f0f('0x1e')](handleEntityNotFound(_0x13dfb7,null))[_0x1f0f('0x1e')](function(_0x32987c){if(_0x32987c){_0x33caa0=_0x32987c;return db[_0x1f0f('0x7e')][_0x1f0f('0x56')]({'where':{'id':_0x32987c['SmsAccountId']}});}})[_0x1f0f('0x1e')](handleEntityNotFound(_0x13dfb7,null))[_0x1f0f('0x1e')](function(_0x571bae){if(_0x571bae){logger[_0x1f0f('0x20')](_0x1f0f('0x21'),_0x1f0f('0x29'),_0x1f0f('0x7f'),_0x571bae[_0x1f0f('0x39')],util[_0x1f0f('0x80')](_0x196c89[_0x1f0f('0x58')],{'showHidden':![],'depth':null}));switch(_0x571bae[_0x1f0f('0x39')]){case _0x1f0f('0x81'):if(_0x196c89[_0x1f0f('0x58')]['MessageSid']&&_0x196c89[_0x1f0f('0x58')][_0x1f0f('0x82')]===_0x33caa0['messageId']){return _0x33caa0[_0x1f0f('0x62')]({'read':!![]});}else{logger['error'](_0x1f0f('0x83'),_0x1f0f('0x29'),_0x1f0f('0x81'),util[_0x1f0f('0x80')](_0x196c89[_0x1f0f('0x58')],{'showHidden':![],'depth':null}));}break;case _0x1f0f('0x84'):if(_0x196c89[_0x1f0f('0x58')][_0x1f0f('0x85')]&&_0x196c89[_0x1f0f('0x58')][_0x1f0f('0x85')]===_0x33caa0[_0x1f0f('0x86')]&&_[_0x1f0f('0x87')]([_0x1f0f('0x88'),_0x1f0f('0x89')],_0x196c89[_0x1f0f('0x58')][_0x1f0f('0x8a')])>=0x0){return _0x33caa0[_0x1f0f('0x62')]({'read':!![]});}else{logger[_0x1f0f('0x22')](_0x1f0f('0x83'),_0x1f0f('0x29'),'plivio',util[_0x1f0f('0x80')](_0x196c89['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x415f63=_0x196c89[_0x1f0f('0x58')][_0x1f0f('0x8b')][0x0];if(_0x415f63['status'][_0x1f0f('0x8c')]===_0x1f0f('0x8d')){return _0x33caa0['update']({'read':!![]});}else{logger[_0x1f0f('0x22')](_0x1f0f('0x83'),'status',_0x1f0f('0x8e'),util[_0x1f0f('0x80')](_0x196c89[_0x1f0f('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x33caa0;}})[_0x1f0f('0x1e')](respondWithResult(_0x13dfb7,null))[_0x1f0f('0x52')](handleError(_0x13dfb7,null));}; \ No newline at end of file +var _0xeaab=['filters','pick','filter','merge','VIRTUAL','options','includeAll','include','SmsMessage','findAll','rows','catch','show','find','create','body','params','describe','sms-interactions','accept','sms','read','readAt','format','UserId','user','agent','get','SmsInteraction','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','RejectMessage','User','internal','interface','rejectmessage','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','sent','delivered','plivio','infobip','results','groupName','eml-format','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','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','result','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x101802,_0x11f913){var _0x5d61ce=function(_0x4acc0){while(--_0x4acc0){_0x101802['push'](_0x101802['shift']());}};_0x5d61ce(++_0x11f913);}(_0xeaab,0xd9));var _0xbeaa=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xeaab[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xbeaa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbeaa('0x1'));var jsonpatch=require(_0xbeaa('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbeaa('0x3'));var Mustache=require(_0xbeaa('0x4'));var util=require(_0xbeaa('0x5'));var path=require(_0xbeaa('0x6'));var sox=require(_0xbeaa('0x7'));var csv=require(_0xbeaa('0x8'));var ejs=require(_0xbeaa('0x9'));var fs=require('fs');var fs_extra=require(_0xbeaa('0xa'));var _=require(_0xbeaa('0xb'));var squel=require(_0xbeaa('0xc'));var crypto=require(_0xbeaa('0xd'));var jsforce=require(_0xbeaa('0xe'));var deskjs=require(_0xbeaa('0xf'));var toCsv=require(_0xbeaa('0x8'));var querystring=require('querystring');var Papa=require(_0xbeaa('0x10'));var Redis=require(_0xbeaa('0x11'));var authService=require(_0xbeaa('0x12'));var qs=require(_0xbeaa('0x13'));var as=require(_0xbeaa('0x14'));var hardwareService=require(_0xbeaa('0x15'));var logger=require(_0xbeaa('0x16'))('api');var utils=require(_0xbeaa('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbeaa('0x18'));var db=require(_0xbeaa('0x19'))['db'];config['redis']=_[_0xbeaa('0x1a')](config['redis'],{'host':_0xbeaa('0x1b'),'port':0x18eb});var socket=require(_0xbeaa('0x1c'))(new Redis(config['redis']));require(_0xbeaa('0x1d'))[_0xbeaa('0x1e')](socket);var jayson=require(_0xbeaa('0x1f'));var client=jayson[_0xbeaa('0x20')][_0xbeaa('0x21')]({'port':0x232c});var client9002=jayson[_0xbeaa('0x20')][_0xbeaa('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1cebef,_0x2ab806,_0x34271a,_0x1b28a5){return new BPromise(function(_0x1cc387,_0x24c1ce){var _0x2ae656=_0x1b28a5||client;return _0x2ae656[_0xbeaa('0x22')](_0x1cebef,_0x34271a)[_0xbeaa('0x23')](function(_0x2a72ef){logger[_0xbeaa('0x24')](_0xbeaa('0x25'),_0x2ab806,_0xbeaa('0x26'));logger[_0xbeaa('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2ab806,_0xbeaa('0x26'),JSON[_0xbeaa('0x28')](_0x2a72ef));if(_0x2a72ef[_0xbeaa('0x29')]){if(_0x2a72ef['error'][_0xbeaa('0x2a')]===0x1f4){logger[_0xbeaa('0x29')](_0xbeaa('0x25'),_0x2ab806,_0x2a72ef[_0xbeaa('0x29')][_0xbeaa('0x2b')]);return _0x24c1ce(_0x2a72ef[_0xbeaa('0x29')][_0xbeaa('0x2b')]);}logger['error'](_0xbeaa('0x25'),_0x2ab806,_0x2a72ef[_0xbeaa('0x29')]['message']);return _0x1cc387(_0x2a72ef['error']['message']);}else{logger[_0xbeaa('0x24')](_0xbeaa('0x25'),_0x2ab806,_0xbeaa('0x26'));_0x1cc387(_0x2a72ef[_0xbeaa('0x2c')]['message']);}})['catch'](function(_0x53b066){logger[_0xbeaa('0x29')](_0xbeaa('0x25'),_0x2ab806,_0x53b066);_0x24c1ce(_0x53b066);});});}function respondWithStatusCode(_0x63d68b,_0xa9a88e){_0xa9a88e=_0xa9a88e||0xcc;return function(_0x41661b){if(_0x41661b){return _0x63d68b['sendStatus'](_0xa9a88e);}return _0x63d68b[_0xbeaa('0x2d')](_0xa9a88e)[_0xbeaa('0x2e')]();};}function respondWithResult(_0x2ee10e,_0x583be5){_0x583be5=_0x583be5||0xc8;return function(_0x2f509e){if(_0x2f509e){return _0x2ee10e[_0xbeaa('0x2d')](_0x583be5)[_0xbeaa('0x2f')](_0x2f509e);}};}function respondWithFilteredResult(_0x52edbc,_0x1d84cd){return function(_0x578e92){if(_0x578e92){var _0x13d8b7=typeof _0x1d84cd[_0xbeaa('0x30')]===_0xbeaa('0x31')&&typeof _0x1d84cd[_0xbeaa('0x32')]===_0xbeaa('0x31');var _0x52e876=_0x578e92[_0xbeaa('0x33')];var _0x1126b3=_0x13d8b7?0x0:_0x1d84cd['offset'];var _0x31afc9=_0x13d8b7?_0x578e92[_0xbeaa('0x33')]:_0x1d84cd['offset']+_0x1d84cd[_0xbeaa('0x32')];var _0x5af042;if(_0x31afc9>=_0x52e876){_0x31afc9=_0x52e876;_0x5af042=0xc8;}else{_0x5af042=0xce;}_0x52edbc['status'](_0x5af042);return _0x52edbc['set'](_0xbeaa('0x34'),_0x1126b3+'-'+_0x31afc9+'/'+_0x52e876)[_0xbeaa('0x2f')](_0x578e92);}return null;};}function patchUpdates(_0x3f5516){return function(_0x4b9c55){try{jsonpatch[_0xbeaa('0x35')](_0x4b9c55,_0x3f5516,!![]);}catch(_0xc76552){return BPromise[_0xbeaa('0x36')](_0xc76552);}return _0x4b9c55[_0xbeaa('0x37')]();};}function saveUpdates(_0x5d064e,_0x208a38){return function(_0x40b2eb){if(_0x40b2eb){return _0x40b2eb[_0xbeaa('0x38')](_0x5d064e)[_0xbeaa('0x23')](function(_0x73d452){return _0x73d452;});}return null;};}function removeEntity(_0x44b2a8,_0x462cb0){return function(_0x363531){if(_0x363531){return _0x363531[_0xbeaa('0x39')]()['then'](function(){_0x44b2a8[_0xbeaa('0x2d')](0xcc)[_0xbeaa('0x2e')]();});}};}function handleEntityNotFound(_0x5c7734,_0x586bf4){return function(_0x460a83){if(!_0x460a83){_0x5c7734[_0xbeaa('0x3a')](0x194);}return _0x460a83;};}function handleError(_0x4f3548,_0x345a48){_0x345a48=_0x345a48||0x1f4;return function(_0x7f4c43){logger[_0xbeaa('0x29')](_0x7f4c43['stack']);if(_0x7f4c43[_0xbeaa('0x3b')]){delete _0x7f4c43[_0xbeaa('0x3b')];}_0x4f3548[_0xbeaa('0x2d')](_0x345a48)[_0xbeaa('0x3c')](_0x7f4c43);};}exports['index']=function(_0x57e667,_0x526420){var _0x52cb5c={},_0x318b54={},_0x4d3b5b={'count':0x0,'rows':[]};var _0xc00b9f=_[_0xbeaa('0x3d')](db['SmsMessage'][_0xbeaa('0x3e')],function(_0x78c4ff){return{'name':_0x78c4ff['fieldName'],'type':_0x78c4ff[_0xbeaa('0x3f')]['key']};});_0x318b54[_0xbeaa('0x40')]=_[_0xbeaa('0x3d')](_0xc00b9f,_0xbeaa('0x3b'));_0x318b54[_0xbeaa('0x41')]=_[_0xbeaa('0x42')](_0x57e667[_0xbeaa('0x41')]);_0x318b54['filters']=_[_0xbeaa('0x43')](_0x318b54[_0xbeaa('0x40')],_0x318b54[_0xbeaa('0x41')]);_0x52cb5c[_0xbeaa('0x44')]=_[_0xbeaa('0x43')](_0x318b54['model'],qs[_0xbeaa('0x45')](_0x57e667[_0xbeaa('0x41')][_0xbeaa('0x45')]));_0x52cb5c['attributes']=_0x52cb5c['attributes'][_0xbeaa('0x46')]?_0x52cb5c[_0xbeaa('0x44')]:_0x318b54[_0xbeaa('0x40')];if(!_0x57e667[_0xbeaa('0x41')][_0xbeaa('0x47')](_0xbeaa('0x48'))){_0x52cb5c[_0xbeaa('0x32')]=qs[_0xbeaa('0x32')](_0x57e667[_0xbeaa('0x41')][_0xbeaa('0x32')]);_0x52cb5c['offset']=qs[_0xbeaa('0x30')](_0x57e667[_0xbeaa('0x41')][_0xbeaa('0x30')]);}_0x52cb5c['order']=qs[_0xbeaa('0x49')](_0x57e667['query'][_0xbeaa('0x49')]);_0x52cb5c[_0xbeaa('0x4a')]=qs[_0xbeaa('0x4b')](_[_0xbeaa('0x4c')](_0x57e667[_0xbeaa('0x41')],_0x318b54[_0xbeaa('0x4b')]),_0xc00b9f);if(_0x57e667['query'][_0xbeaa('0x4d')]){_0x52cb5c['where']=_[_0xbeaa('0x4e')](_0x52cb5c[_0xbeaa('0x4a')],{'$or':_[_0xbeaa('0x3d')](_0xc00b9f,function(_0x5000b1){if(_0x5000b1[_0xbeaa('0x3f')]!==_0xbeaa('0x4f')){var _0x487746={};_0x487746[_0x5000b1[_0xbeaa('0x3b')]]={'$like':'%'+_0x57e667[_0xbeaa('0x41')]['filter']+'%'};return _0x487746;}})});}_0x52cb5c=_[_0xbeaa('0x4e')]({},_0x52cb5c,_0x57e667[_0xbeaa('0x50')]);var _0x5962f9={'where':_0x52cb5c['where']};return db['SmsMessage'][_0xbeaa('0x33')](_0x5962f9)[_0xbeaa('0x23')](function(_0x1e9296){_0x4d3b5b[_0xbeaa('0x33')]=_0x1e9296;if(_0x57e667[_0xbeaa('0x41')][_0xbeaa('0x51')]){_0x52cb5c[_0xbeaa('0x52')]=[{'all':!![]}];}return db[_0xbeaa('0x53')][_0xbeaa('0x54')](_0x52cb5c);})[_0xbeaa('0x23')](function(_0x350400){_0x4d3b5b[_0xbeaa('0x55')]=_0x350400;return _0x4d3b5b;})[_0xbeaa('0x23')](respondWithFilteredResult(_0x526420,_0x52cb5c))[_0xbeaa('0x56')](handleError(_0x526420,null));};exports[_0xbeaa('0x57')]=function(_0x59be64,_0x33fcbb){var _0x5a97de={'raw':!![],'where':{'id':_0x59be64['params']['id']}},_0x42e46b={};_0x42e46b['model']=_[_0xbeaa('0x42')](db[_0xbeaa('0x53')][_0xbeaa('0x3e')]);_0x42e46b[_0xbeaa('0x41')]=_['keys'](_0x59be64[_0xbeaa('0x41')]);_0x42e46b[_0xbeaa('0x4b')]=_[_0xbeaa('0x43')](_0x42e46b[_0xbeaa('0x40')],_0x42e46b['query']);_0x5a97de[_0xbeaa('0x44')]=_['intersection'](_0x42e46b[_0xbeaa('0x40')],qs[_0xbeaa('0x45')](_0x59be64[_0xbeaa('0x41')][_0xbeaa('0x45')]));_0x5a97de['attributes']=_0x5a97de['attributes']['length']?_0x5a97de['attributes']:_0x42e46b[_0xbeaa('0x40')];if(_0x59be64[_0xbeaa('0x41')][_0xbeaa('0x51')]){_0x5a97de[_0xbeaa('0x52')]=[{'all':!![]}];}_0x5a97de=_[_0xbeaa('0x4e')]({},_0x5a97de,_0x59be64[_0xbeaa('0x50')]);return db[_0xbeaa('0x53')][_0xbeaa('0x58')](_0x5a97de)[_0xbeaa('0x23')](handleEntityNotFound(_0x33fcbb,null))[_0xbeaa('0x23')](respondWithResult(_0x33fcbb,null))[_0xbeaa('0x56')](handleError(_0x33fcbb,null));};exports[_0xbeaa('0x59')]=function(_0x4187b5,_0x47579a){return db[_0xbeaa('0x53')]['create'](_0x4187b5['body'],{})['then'](respondWithResult(_0x47579a,0xc9))[_0xbeaa('0x56')](handleError(_0x47579a,null));};exports[_0xbeaa('0x38')]=function(_0x5f0582,_0x96862e){if(_0x5f0582['body']['id']){delete _0x5f0582[_0xbeaa('0x5a')]['id'];}return db[_0xbeaa('0x53')][_0xbeaa('0x58')]({'where':{'id':_0x5f0582['params']['id']}})['then'](handleEntityNotFound(_0x96862e,null))[_0xbeaa('0x23')](saveUpdates(_0x5f0582[_0xbeaa('0x5a')],null))[_0xbeaa('0x23')](respondWithResult(_0x96862e,null))[_0xbeaa('0x56')](handleError(_0x96862e,null));};exports['destroy']=function(_0x83011,_0x281ab6){return db['SmsMessage'][_0xbeaa('0x58')]({'where':{'id':_0x83011[_0xbeaa('0x5b')]['id']}})[_0xbeaa('0x23')](handleEntityNotFound(_0x281ab6,null))['then'](removeEntity(_0x281ab6,null))['catch'](handleError(_0x281ab6,null));};exports[_0xbeaa('0x5c')]=function(_0x544ae3,_0x28ad74){return db[_0xbeaa('0x53')]['describe']()[_0xbeaa('0x23')](respondWithResult(_0x28ad74,null))[_0xbeaa('0x56')](handleError(_0x28ad74,null));};var interaction_log=require(_0xbeaa('0x16'))(_0xbeaa('0x5d'));exports[_0xbeaa('0x5e')]=function(_0x18cea0,_0x586f0d,_0x49210d){var _0x1cf119={'agent':{},'channel':_0xbeaa('0x5f')};if(_0x18cea0[_0xbeaa('0x5a')]['id']){delete _0x18cea0[_0xbeaa('0x5a')]['id'];}_0x18cea0[_0xbeaa('0x5a')][_0xbeaa('0x60')]=!![];_0x18cea0[_0xbeaa('0x5a')][_0xbeaa('0x61')]=moment()[_0xbeaa('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x18cea0[_0xbeaa('0x5a')][_0xbeaa('0x63')]=_0x18cea0[_0xbeaa('0x5a')][_0xbeaa('0x63')]||_0x18cea0[_0xbeaa('0x64')]['id'];_0x1cf119[_0xbeaa('0x65')]['id']=_0x18cea0[_0xbeaa('0x5a')][_0xbeaa('0x63')];return db[_0xbeaa('0x53')][_0xbeaa('0x58')]({'where':{'id':_0x18cea0[_0xbeaa('0x5b')]['id'],'UserId':null}})[_0xbeaa('0x23')](handleEntityNotFound(_0x586f0d,null))[_0xbeaa('0x23')](saveUpdates(_0x18cea0[_0xbeaa('0x5a')],null))[_0xbeaa('0x23')](function(_0x4a92b7){if(_0x4a92b7){_0x1cf119[_0xbeaa('0x2b')]=_0x4a92b7[_0xbeaa('0x66')]({'plain':!![]});return db[_0xbeaa('0x67')][_0xbeaa('0x58')]({'where':{'id':_0x4a92b7['SmsInteractionId']}});}return null;})[_0xbeaa('0x23')](handleEntityNotFound(_0x586f0d,null))[_0xbeaa('0x23')](function(_0xfdb0f){if(_0xfdb0f){return _0xfdb0f['update']({'UserId':_0x18cea0['body'][_0xbeaa('0x63')],'read1stAt':_['isNil'](_0xfdb0f[_0xbeaa('0x68')])?moment()[_0xbeaa('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xbeaa('0x23')](function(_0x3e8b2f){if(_0x3e8b2f){_0x1cf119[_0xbeaa('0x69')]=_0x3e8b2f[_0xbeaa('0x66')]({'plain':!![]});interaction_log[_0xbeaa('0x24')](_0xbeaa('0x6a'),_0x18cea0['user']['id'],_0x18cea0[_0xbeaa('0x64')][_0xbeaa('0x3b')],_0x18cea0[_0xbeaa('0x64')]['role'],_0x1cf119[_0xbeaa('0x69')]['id'],_0x18cea0[_0xbeaa('0x5a')]?JSON[_0xbeaa('0x28')](_0x18cea0[_0xbeaa('0x5a')]):_0xbeaa('0x6b'));return respondWithRpcPromise('AcceptMessage',_0xbeaa('0x6c'),_0x1cf119);}return null;})[_0xbeaa('0x23')](function(_0x247196){var _0x268d90=_0xbeaa('0x6d')+_0x247196[_0xbeaa('0x2b')][_0xbeaa('0x6e')];return db[_0xbeaa('0x6f')][_0xbeaa('0x41')](_0x268d90,{'type':db[_0xbeaa('0x70')][_0xbeaa('0x71')][_0xbeaa('0x72')],'raw':!![]})['then'](function(_0x50472b){return _0x50472b;});})[_0xbeaa('0x23')](function(_0x1b5464){if(_0x1b5464){_0x1cf119['message'][_0xbeaa('0x73')]=_0x1b5464[0x0];if(!_0x18cea0[_0xbeaa('0x5a')][_0xbeaa('0x63')])return;return db['User'][_0xbeaa('0x58')]({'where':{'id':_0x18cea0[_0xbeaa('0x5a')][_0xbeaa('0x63')],'role':_0xbeaa('0x65')},'attributes':['id',_0xbeaa('0x3b'),_0xbeaa('0x74'),_0xbeaa('0x75'),'internal'],'raw':!![]});}return null;})[_0xbeaa('0x23')](function(_0x5be94c){if(!_0x5be94c)return null;_0x1cf119[_0xbeaa('0x2b')][_0xbeaa('0x65')]=_0x5be94c;return _0x1cf119;})[_0xbeaa('0x23')](function(_0x555a29){if(_0x555a29){if(_0x18cea0[_0xbeaa('0x5a')][_0xbeaa('0x76')]){_0x1cf119['message']['interface']=util['format'](_0xbeaa('0x77'),_0x18cea0[_0xbeaa('0x64')][_0xbeaa('0x3b')]);_0x1cf119[_0xbeaa('0x2b')][_0xbeaa('0x78')]=_0x1cf119[_0xbeaa('0x78')];_0x1cf119[_0xbeaa('0x2b')][_0xbeaa('0x79')]=_0x1cf119['channel'];_0x1cf119[_0xbeaa('0x2b')][_0xbeaa('0x7a')]=_0xbeaa('0x5e');return respondWithRpcPromise(_0xbeaa('0x7b'),_0xbeaa('0x7b'),{'event':_0xbeaa('0x7c'),'message':_0x1cf119['message']},client9002)[_0xbeaa('0x23')](function(){return _0x1cf119;});}return _0x1cf119;}return null;})['then'](respondWithResult(_0x586f0d,null))['catch'](handleError(_0x586f0d,null));};var interaction_log=require(_0xbeaa('0x16'))(_0xbeaa('0x5d'));exports['reject']=function(_0x57636c,_0x297239,_0x369f92){var _0x351074={'agent':{},'channel':_0xbeaa('0x5f')};if(_0x57636c[_0xbeaa('0x5a')]['id']){delete _0x57636c[_0xbeaa('0x5a')]['id'];}_0x57636c['body']['UserId']=_0x57636c[_0xbeaa('0x5a')][_0xbeaa('0x63')]||_0x57636c[_0xbeaa('0x64')]['id'];_0x351074[_0xbeaa('0x65')]['id']=_0x57636c[_0xbeaa('0x5a')][_0xbeaa('0x63')];return db[_0xbeaa('0x53')][_0xbeaa('0x58')]({'where':{'id':_0x57636c[_0xbeaa('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x297239,null))[_0xbeaa('0x23')](function(_0x22e6d4){if(_0x22e6d4){_0x351074[_0xbeaa('0x2b')]=_0x22e6d4[_0xbeaa('0x66')]({'plain':!![]});return db[_0xbeaa('0x67')][_0xbeaa('0x58')]({'where':{'id':_0x22e6d4['SmsInteractionId']}});}return null;})[_0xbeaa('0x23')](handleEntityNotFound(_0x297239,null))['then'](function(_0x362986){if(_0x362986){_0x351074[_0xbeaa('0x69')]=_0x362986[_0xbeaa('0x66')]({'plain':!![]});interaction_log[_0xbeaa('0x24')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x57636c[_0xbeaa('0x64')]['id'],_0x57636c[_0xbeaa('0x64')][_0xbeaa('0x3b')],_0x57636c[_0xbeaa('0x64')]['role'],_0x351074['interaction']['id'],_0x57636c[_0xbeaa('0x5a')]?JSON[_0xbeaa('0x28')](_0x57636c['body']):_0xbeaa('0x6b'));return respondWithRpcPromise(_0xbeaa('0x7d'),'rejectMessage',_0x351074);}return null;})[_0xbeaa('0x23')](function(_0x5ab02d){var _0x3903e3=_0xbeaa('0x6d')+_0x5ab02d[_0xbeaa('0x2b')][_0xbeaa('0x6e')];return db['sequelize'][_0xbeaa('0x41')](_0x3903e3,{'type':db[_0xbeaa('0x70')][_0xbeaa('0x71')][_0xbeaa('0x72')],'raw':!![]})[_0xbeaa('0x23')](function(_0x35a36b){return _0x35a36b;});})[_0xbeaa('0x23')](function(_0x46da7a){if(_0x46da7a){_0x351074[_0xbeaa('0x2b')]['contact']=_0x46da7a[0x0];if(!_0x57636c[_0xbeaa('0x5a')][_0xbeaa('0x63')])return;return db[_0xbeaa('0x7e')][_0xbeaa('0x58')]({'where':{'id':_0x57636c[_0xbeaa('0x5a')]['UserId'],'role':'agent'},'attributes':['id',_0xbeaa('0x3b'),_0xbeaa('0x74'),_0xbeaa('0x75'),_0xbeaa('0x7f')],'raw':!![]});}return null;})['then'](function(_0x367859){if(!_0x367859)return null;_0x351074['message'][_0xbeaa('0x65')]=_0x367859;return _0x351074;})[_0xbeaa('0x23')](function(_0xe192f){if(_0xe192f){_0xe192f[_0xbeaa('0x2b')][_0xbeaa('0x80')]=util[_0xbeaa('0x62')](_0xbeaa('0x77'),_0x57636c[_0xbeaa('0x64')][_0xbeaa('0x3b')]);_0xe192f[_0xbeaa('0x2b')][_0xbeaa('0x78')]=_0x351074[_0xbeaa('0x78')];_0xe192f['message']['motionChannel']=_0x351074[_0xbeaa('0x78')];_0xe192f[_0xbeaa('0x2b')][_0xbeaa('0x7a')]='reject';respondWithRpcPromise(_0xbeaa('0x7b'),_0xbeaa('0x7b'),{'event':_0xbeaa('0x81'),'message':_0xe192f[_0xbeaa('0x2b')]},client9002);return _0x351074;}return null;})[_0xbeaa('0x23')](respondWithResult(_0x297239,null))[_0xbeaa('0x56')](handleError(_0x297239,null));};exports[_0xbeaa('0x2d')]=function(_0x41e585,_0x326e54,_0x2ae223){if(_0x41e585[_0xbeaa('0x5a')]['id']){delete _0x41e585[_0xbeaa('0x5a')]['id'];}var _0xe8c7fe;return db[_0xbeaa('0x53')][_0xbeaa('0x58')]({'where':{'id':_0x41e585[_0xbeaa('0x5b')]['id']}})[_0xbeaa('0x23')](handleEntityNotFound(_0x326e54,null))[_0xbeaa('0x23')](function(_0x339406){if(_0x339406){_0xe8c7fe=_0x339406;return db['SmsAccount'][_0xbeaa('0x58')]({'where':{'id':_0x339406[_0xbeaa('0x82')]}});}})[_0xbeaa('0x23')](handleEntityNotFound(_0x326e54,null))[_0xbeaa('0x23')](function(_0x36e169){if(_0x36e169){logger[_0xbeaa('0x27')](_0xbeaa('0x83'),_0xbeaa('0x2d'),_0xbeaa('0x84'),_0x36e169[_0xbeaa('0x3f')],util[_0xbeaa('0x85')](_0x41e585['body'],{'showHidden':![],'depth':null}));switch(_0x36e169[_0xbeaa('0x3f')]){case _0xbeaa('0x86'):if(_0x41e585[_0xbeaa('0x5a')]['MessageSid']&&_0x41e585[_0xbeaa('0x5a')][_0xbeaa('0x87')]===_0xe8c7fe[_0xbeaa('0x88')]){return _0xe8c7fe[_0xbeaa('0x38')]({'read':!![]});}else{logger[_0xbeaa('0x29')](_0xbeaa('0x89'),_0xbeaa('0x2d'),_0xbeaa('0x86'),util[_0xbeaa('0x85')](_0x41e585[_0xbeaa('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xbeaa('0x8a'):if(_0x41e585[_0xbeaa('0x5a')][_0xbeaa('0x8b')]&&_0x41e585[_0xbeaa('0x5a')]['MessageUUID']===_0xe8c7fe['messageId']&&_['indexOf']([_0xbeaa('0x8c'),_0xbeaa('0x8d')],_0x41e585[_0xbeaa('0x5a')]['Status'])>=0x0){return _0xe8c7fe[_0xbeaa('0x38')]({'read':!![]});}else{logger['error'](_0xbeaa('0x89'),_0xbeaa('0x2d'),_0xbeaa('0x8e'),util['inspect'](_0x41e585[_0xbeaa('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xbeaa('0x8f'):var _0xb4badd=_0x41e585[_0xbeaa('0x5a')][_0xbeaa('0x90')][0x0];if(_0xb4badd[_0xbeaa('0x2d')][_0xbeaa('0x91')]==='DELIVERED'){return _0xe8c7fe['update']({'read':!![]});}else{logger['error'](_0xbeaa('0x89'),_0xbeaa('0x2d'),'infobip',util[_0xbeaa('0x85')](_0x41e585[_0xbeaa('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0xe8c7fe;}})['then'](respondWithResult(_0x326e54,null))[_0xbeaa('0x56')](handleError(_0x326e54,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index ea1bc15..13b0008 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 _0x6614=['emit','hasOwnProperty','exports','events','SmsMessage','setMaxListeners','save','remove'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6614,0x1c3));var _0x4661=function(_0x5a0693,_0x5e80b8){_0x5a0693=_0x5a0693-0x0;var _0x5daa64=_0x6614[_0x5a0693];return _0x5daa64;};'use strict';var EventEmitter=require(_0x4661('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x4661('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4661('0x2')](0x0);var events={'afterCreate':_0x4661('0x3'),'afterUpdate':'update','afterDestroy':_0x4661('0x4')};function emitEvent(_0x2b5fa2){return function(_0x36dfbe,_0x1da53e,_0x2fa3e9){SmsMessageEvents[_0x4661('0x5')](_0x2b5fa2+':'+_0x36dfbe['id'],_0x36dfbe);SmsMessageEvents['emit'](_0x2b5fa2,_0x36dfbe);_0x2fa3e9(null);};}for(var e in events){if(events[_0x4661('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x4661('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x9254=['SmsMessage','setMaxListeners','update','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x384207,_0x2773da){var _0x3f64ee=function(_0x5957e3){while(--_0x5957e3){_0x384207['push'](_0x384207['shift']());}};_0x3f64ee(++_0x2773da);}(_0x9254,0x1bf));var _0x4925=function(_0x4b24d1,_0x3726b6){_0x4b24d1=_0x4b24d1-0x0;var _0x3221d0=_0x9254[_0x4b24d1];return _0x3221d0;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x4925('0x0'))['db'][_0x4925('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4925('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4925('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2d407b){return function(_0x4a629e,_0x5214c3,_0x1abdf4){SmsMessageEvents[_0x4925('0x4')](_0x2d407b+':'+_0x4a629e['id'],_0x4a629e);SmsMessageEvents[_0x4925('0x4')](_0x2d407b,_0x4a629e);_0x1abdf4(null);};}for(var e in events){if(events[_0x4925('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x4925('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 7e2b1f3..df299c7 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 _0xf6b1=['clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','crypto','apiKey','login','timestamp','keys','sort','length','createHash','md5','hex','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','message','status','refid','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','accountSid','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','POST','user_key','session_key','internal_order_id','deliveryReport','inspect','connectel','senderString','read','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','message_id'];(function(_0x161ac3,_0x142e49){var _0x3bb837=function(_0x269c7c){while(--_0x269c7c){_0x161ac3['push'](_0x161ac3['shift']());}};_0x3bb837(++_0x142e49);}(_0xf6b1,0x1a9));var _0x1f6b=function(_0xe58a2e,_0x277013){_0xe58a2e=_0xe58a2e-0x0;var _0x5178c8=_0xf6b1[_0xe58a2e];return _0x5178c8;};'use strict';var _=require(_0x1f6b('0x0'));var util=require('util');var logger=require(_0x1f6b('0x1'))(_0x1f6b('0x2'));var moment=require(_0x1f6b('0x3'));var BPromise=require(_0x1f6b('0x4'));var rp=require(_0x1f6b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f6b('0x6'));var config=require(_0x1f6b('0x7'));var attributes=require(_0x1f6b('0x8'));module['exports']=function(_0x1404f4,_0x49c000){return _0x1404f4[_0x1f6b('0x9')](_0x1f6b('0xa'),attributes,{'tableName':_0x1f6b('0xb'),'paranoid':![],'indexes':[{'name':_0x1f6b('0xc'),'fields':['messageId']},{'name':_0x1f6b('0xd'),'fields':[_0x1f6b('0xe')],'type':_0x1f6b('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x15ad2c,_0x453645,_0x167f9b){var _0x22f2ec=_0x1404f4[_0x1f6b('0x10')];var _0x10a1c0=_0x15ad2c[_0x1f6b('0x11')]({'plain':!![]});if(_0x10a1c0[_0x1f6b('0x12')][_0x1f6b('0x13')]()==='in'||_0x10a1c0[_0x1f6b('0x12')][_0x1f6b('0x13')]()===_0x1f6b('0x14')&&!_0x10a1c0[_0x1f6b('0x15')]&&!_[_0x1f6b('0x16')](_0x10a1c0['UserId'])&&!_[_0x1f6b('0x16')](_0x10a1c0[_0x1f6b('0x17')])){_0x22f2ec[_0x1f6b('0x18')][_0x1f6b('0x19')]({'where':{'id':_0x10a1c0[_0x1f6b('0x17')]}})[_0x1f6b('0x1a')](function(_0x4d3055){if(_0x4d3055){_0x4d3055[_0x1f6b('0x1b')]({'lastMsgAt':_0x10a1c0[_0x1f6b('0x1c')],'lastMsgDirection':_0x10a1c0[_0x1f6b('0x12')]['toLowerCase']()});}})[_0x1f6b('0x1d')](function(_0x526f92){console[_0x1f6b('0x1e')](_0x526f92);});}if(_0x10a1c0[_0x1f6b('0x12')]===_0x1f6b('0x14')&&!_0x10a1c0['secret']){var _0x33c0cc;_0x22f2ec[_0x1f6b('0x1f')][_0x1f6b('0x20')]({'where':{'id':_0x10a1c0[_0x1f6b('0x21')]},'raw':!![]})[_0x1f6b('0x1a')](function(_0x17c07f){_0x33c0cc=_0x17c07f;if(_0x33c0cc&&_0x33c0cc[_0x1f6b('0x22')]){switch(_0x33c0cc['type']){case _0x1f6b('0x23'):var _0x3d8022=require(_0x1f6b('0x23'));if(_0x33c0cc['accountSid']&&_0x33c0cc[_0x1f6b('0x24')]&&_0x33c0cc[_0x1f6b('0x25')]){var _0x2d6dfc=new _0x3d8022(_0x33c0cc[_0x1f6b('0x26')],_0x33c0cc[_0x1f6b('0x24')]);_0x2d6dfc['messages']['create']({'body':_0x10a1c0[_0x1f6b('0xe')],'to':_0x10a1c0[_0x1f6b('0x25')],'from':_0x33c0cc[_0x1f6b('0x25')],'statusCallback':_0x33c0cc[_0x1f6b('0x27')]+_0x1f6b('0x28')+_0x10a1c0['id']+_0x1f6b('0x29')+_0x33c0cc[_0x1f6b('0x2a')]})['then'](function(_0x3a7dee){if(_0x3a7dee[_0x1f6b('0x2b')]){return _0x15ad2c[_0x1f6b('0x1b')]({'messageId':_0x3a7dee['sid']});}})[_0x1f6b('0x1d')](function(_0x130ca6){logger[_0x1f6b('0x1e')](_0x1f6b('0x2c'),_0x1f6b('0x2d'),_0x1f6b('0x23'),util['inspect'](_0x130ca6,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1f6b('0x2d'),_0x1f6b('0x23'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x1f6b('0x2e'):var _0x2b5d3b=_0x1f6b('0x2f');if(_0x33c0cc[_0x1f6b('0x30')]&&_0x33c0cc[_0x1f6b('0x31')]){var _0x8465b4={'recipient':[_0x10a1c0['phone']],'message':_0x10a1c0['body'],'message_type':_0x33c0cc[_0x1f6b('0x32')]};if(_0x33c0cc[_0x1f6b('0x32')]&&_0x33c0cc[_0x1f6b('0x32')]!=='SI'){_0x8465b4[_0x1f6b('0x33')]=_0x33c0cc[_0x1f6b('0x25')];}var _0x1be5a2={'url':_0x2b5d3b+_0x1f6b('0x34')+_0x33c0cc[_0x1f6b('0x30')]+_0x1f6b('0x35')+_0x33c0cc[_0x1f6b('0x31')],'method':_0x1f6b('0x36')};rp(_0x1be5a2)['then'](function(_0x44dba5){var _0x66ae24=_0x44dba5['split'](';');var _0x2ae403={'user_key':_0x66ae24[0x0],'session_key':_0x66ae24[0x1]};_0x1be5a2={'url':_0x2b5d3b+'sms','method':_0x1f6b('0x37'),'headers':{'user_key':_0x2ae403[_0x1f6b('0x38')],'Session_key':_0x2ae403[_0x1f6b('0x39')]},'json':!![],'body':_0x8465b4};return rp(_0x1be5a2);})[_0x1f6b('0x1a')](function(_0x14d0eb){if(_0x14d0eb['total_sent']>=0x1){var _0x4f7f69={'messageId':_0x14d0eb[_0x1f6b('0x3a')]};if(_0x33c0cc[_0x1f6b('0x32')]!=='GP'||!_0x33c0cc[_0x1f6b('0x3b')]){_0x4f7f69['read']=!![];}return _0x15ad2c[_0x1f6b('0x1b')](_0x4f7f69);}else{return logger[_0x1f6b('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1f6b('0x2d'),_0x1f6b('0x2e'),util[_0x1f6b('0x3c')](_0x14d0eb,{'showHidden':![],'depth':null}));}})[_0x1f6b('0x1d')](function(_0x2af7ae){return logger[_0x1f6b('0x1e')](_0x1f6b('0x2c'),_0x1f6b('0x2d'),_0x1f6b('0x2e'),util[_0x1f6b('0x3c')](_0x2af7ae,{'showHidden':![],'depth':null}));});}else{logger[_0x1f6b('0x1e')](_0x1f6b('0x2c'),_0x1f6b('0x2d'),_0x1f6b('0x2e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x1f6b('0x3d'):if(_0x33c0cc[_0x1f6b('0x24')]){var _0x136752={'recipient':_0x10a1c0[_0x1f6b('0x25')],'message':_0x10a1c0[_0x1f6b('0xe')],'sender':_0x33c0cc[_0x1f6b('0x3e')]||_0x33c0cc[_0x1f6b('0x25')],'authorization':_0x33c0cc[_0x1f6b('0x24')]};var _0x453645={'method':_0x1f6b('0x37'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x136752,'json':!![]};rp(_0x453645)['then'](function(_0xbc6f5){var _0x5438bb={'messageId':_0xbc6f5['requestid']};if(!_0x33c0cc['deliveryReport']){_0x5438bb[_0x1f6b('0x3f')]=!![];}return _0x15ad2c['update'](_0x5438bb);})[_0x1f6b('0x1d')](function(_0x25b4b9){logger[_0x1f6b('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1f6b('0x2d'),'connectel',util[_0x1f6b('0x3c')](_0x25b4b9,{'showHidden':![],'depth':null}));});}else{logger[_0x1f6b('0x1e')](_0x1f6b('0x2c'),_0x1f6b('0x2d'),_0x1f6b('0x3d'),_0x1f6b('0x40'));}break;case _0x1f6b('0x41'):if(_0x33c0cc[_0x1f6b('0x30')]&&_0x33c0cc[_0x1f6b('0x31')]){var _0x136752={'messages':[{'source':'xCALLY\x20Motion','to':_0x10a1c0['phone'],'body':_0x10a1c0[_0x1f6b('0xe')],'from':_0x33c0cc[_0x1f6b('0x3e')]||_0x33c0cc['phone']}]};var _0x4d865d=util[_0x1f6b('0x42')](_0x1f6b('0x43'),_0x33c0cc['username'],_0x33c0cc['password']);var _0x453645={'method':_0x1f6b('0x37'),'uri':_0x1f6b('0x44'),'body':_0x136752,'headers':{'Authorization':util[_0x1f6b('0x42')]('Basic\x20%s',new Buffer(_0x4d865d)[_0x1f6b('0x45')](_0x1f6b('0x46')))},'json':!![]};rp(_0x453645)[_0x1f6b('0x1a')](function(_0x540fad){if(_0x540fad[_0x1f6b('0x47')]>=0xc8&&_0x540fad['http_code']<=0xce){if(_0x540fad[_0x1f6b('0x48')]&&_0x540fad[_0x1f6b('0x48')][_0x1f6b('0x49')]>0x0){var _0x4bc041=_['head'](_0x540fad['data']['messages']);var _0x12f674={'messageId':_0x4bc041[_0x1f6b('0x4a')]};if(!_0x33c0cc[_0x1f6b('0x3b')]){_0x12f674[_0x1f6b('0x3f')]=!![];}return _0x15ad2c[_0x1f6b('0x1b')](_0x12f674);}else{logger['error'](_0x1f6b('0x2c'),_0x1f6b('0x2d'),_0x1f6b('0x4b'),util[_0x1f6b('0x3c')](_0x540fad,{'showHidden':![],'depth':null}));}}else{logger[_0x1f6b('0x1e')](_0x1f6b('0x2c'),_0x1f6b('0x2d'),'clickSend',util[_0x1f6b('0x3c')](_0x540fad,{'showHidden':![],'depth':null}));}})[_0x1f6b('0x1d')](function(_0x32b221){logger['error'](_0x1f6b('0x2c'),_0x1f6b('0x2d'),_0x1f6b('0x4b'),util[_0x1f6b('0x3c')](_0x32b221,{'showHidden':![],'depth':null}));});}else{logger[_0x1f6b('0x1e')](_0x1f6b('0x2c'),'afterCreate',_0x1f6b('0x4b'),_0x1f6b('0x4c'));}break;case _0x1f6b('0x4d'):if(_0x33c0cc[_0x1f6b('0x4e')]&&_0x33c0cc['authToken']){var _0x136752={'dst':_0x10a1c0[_0x1f6b('0x25')],'text':_0x10a1c0[_0x1f6b('0xe')],'src':_0x33c0cc['senderString']||_0x33c0cc['phone'],'url':_0x33c0cc['remote']+'/api/sms/messages/'+_0x10a1c0['id']+_0x1f6b('0x29')+_0x33c0cc[_0x1f6b('0x2a')]};var _0x4d865d=util[_0x1f6b('0x42')]('%s:%s',_0x33c0cc['authId'],_0x33c0cc[_0x1f6b('0x24')]);var _0x453645={'method':_0x1f6b('0x37'),'uri':util[_0x1f6b('0x42')](_0x1f6b('0x4f'),_0x33c0cc[_0x1f6b('0x4e')]),'body':_0x136752,'headers':{'Authorization':util[_0x1f6b('0x42')](_0x1f6b('0x50'),new Buffer(_0x4d865d)['toString']('base64'))},'json':!![]};rp(_0x453645)['then'](function(_0x3126be){var _0x536d12={'messageId':_0x3126be[_0x1f6b('0x51')][0x0]};return _0x15ad2c[_0x1f6b('0x1b')](_0x536d12);})[_0x1f6b('0x1d')](function(_0x3f37e0){logger[_0x1f6b('0x1e')](_0x1f6b('0x2c'),_0x1f6b('0x2d'),_0x1f6b('0x4d'),util['inspect'](_0x3f37e0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1f6b('0x2c'),_0x1f6b('0x2d'),_0x1f6b('0x4d'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x1f6b('0x52'):if(_0x33c0cc['username']&&_0x33c0cc[_0x1f6b('0x31')]){if(_0x33c0cc['baseUrl']){var _0x27701e={'method':'POST','uri':_0x33c0cc[_0x1f6b('0x53')]+_0x1f6b('0x54'),'body':{'username':_0x33c0cc['username'],'password':_0x33c0cc[_0x1f6b('0x31')]},'json':!![]};return rp(_0x27701e)[_0x1f6b('0x1a')](function(_0x20d079){var _0x28de38={'method':_0x1f6b('0x37'),'uri':_0x33c0cc[_0x1f6b('0x53')]+_0x1f6b('0x55'),'body':{'messages':[{'from':_0x33c0cc[_0x1f6b('0x25')],'destinations':[{'to':_0x10a1c0[_0x1f6b('0x25')]}],'text':_0x10a1c0[_0x1f6b('0xe')],'notifyUrl':_0x33c0cc['remote']+_0x1f6b('0x28')+_0x10a1c0['id']+_0x1f6b('0x29')+_0x33c0cc[_0x1f6b('0x2a')],'notifyContentType':_0x1f6b('0x56'),'callbackData':_0x33c0cc['phone']+';'+_0x10a1c0[_0x1f6b('0xe')]}]},'headers':{'Authorization':_0x1f6b('0x57')+_0x20d079[_0x1f6b('0x2a')]},'json':!![]};return rp(_0x28de38)[_0x1f6b('0x1a')](function(_0x12a913){if(_0x12a913[_0x1f6b('0x58')]){var _0x1a083a={'messageId':_0x12a913[_0x1f6b('0x58')][0x0][_0x1f6b('0xc')]};if(!_0x33c0cc[_0x1f6b('0x3b')]){_0x1a083a[_0x1f6b('0x3f')]=!![];}return _0x15ad2c[_0x1f6b('0x1b')](_0x1a083a);}else{return logger['error'](_0x1f6b('0x2c'),'afterCreate',_0x1f6b('0x52'),util['inspect'](_0x12a913,{'showHidden':![],'depth':null}));}});})[_0x1f6b('0x1d')](function(_0x45bc64){return logger[_0x1f6b('0x1e')](_0x1f6b('0x2c'),'afterCreate',_0x1f6b('0x52'),util[_0x1f6b('0x3c')](_0x45bc64,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1f6b('0x2c'),'afterCreate',_0x1f6b('0x52'),_0x1f6b('0x59'));}}else{logger['error'](_0x1f6b('0x2c'),_0x1f6b('0x2d'),_0x1f6b('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x3cf3fa=require(_0x1f6b('0x5a'));if(_0x33c0cc[_0x1f6b('0x5b')]){var _0x2c5dff={};_0x2c5dff[_0x1f6b('0x5c')]=_0x33c0cc['username'];_0x2c5dff['phone']=_0x10a1c0['phone'];_0x2c5dff[_0x1f6b('0x33')]=_0x33c0cc[_0x1f6b('0x25')];_0x2c5dff['text']=_0x10a1c0[_0x1f6b('0xe')];_0x2c5dff[_0x1f6b('0x5d')]=+new Date();var _0x3dae2a='';var _0x2cafc0='';var _0x734850=Object[_0x1f6b('0x5e')](_0x2c5dff);_0x734850[_0x1f6b('0x5f')]();for(var _0x41bcac=0x0;_0x41bcac<_0x734850[_0x1f6b('0x60')];_0x41bcac++){if(_0x3dae2a!=''){_0x3dae2a+='&';}_0x3dae2a+=_0x734850[_0x41bcac]+'='+encodeURIComponent(_0x2c5dff[_0x734850[_0x41bcac]]);_0x2cafc0+=_0x2c5dff[_0x734850[_0x41bcac]];}_0x2cafc0+=_0x33c0cc[_0x1f6b('0x5b')];_0x2cafc0=_0x3cf3fa[_0x1f6b('0x61')](_0x1f6b('0x62'))[_0x1f6b('0x1b')](_0x2cafc0)['digest'](_0x1f6b('0x63'));if(_0x3dae2a!==''){_0x3dae2a+='&';}_0x3dae2a+=_0x1f6b('0x64')+_0x2cafc0;var _0x1be5a2={'method':'GET','uri':_0x33c0cc[_0x1f6b('0x53')]+_0x1f6b('0x65')+_0x3dae2a,'json':!![]};return rp(_0x1be5a2)[_0x1f6b('0x1a')](function(_0x272baa){var _0x3a2f12=Object[_0x1f6b('0x5e')](_0x272baa);if(_0x272baa[_0x3a2f12[0x0]][_0x1f6b('0x1e')]&&parseInt(_0x272baa[_0x3a2f12[0x0]][_0x1f6b('0x1e')])===0x0){var _0x1785f8={'messageId':_0x272baa[_0x3a2f12[0x0]][_0x1f6b('0x66')]};if(!_0x33c0cc['deliveryReport']){_0x1785f8[_0x1f6b('0x3f')]=!![];}return _0x15ad2c['update'](_0x1785f8);}else{return logger[_0x1f6b('0x1e')](_0x1f6b('0x2c'),_0x1f6b('0x2d'),_0x1f6b('0x67'),util[_0x1f6b('0x3c')](_0x272baa['error'],{'showHidden':![],'depth':null}));}})[_0x1f6b('0x1d')](function(_0x4b41cc){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1f6b('0x67'),util[_0x1f6b('0x3c')](_0x4b41cc,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1f6b('0x2d'),_0x1f6b('0x67'),_0x1f6b('0x68'));}break;case'clickatell':if(_0x33c0cc[_0x1f6b('0x5b')]){var _0x1d40b9={'method':_0x1f6b('0x37'),'uri':_0x1f6b('0x69'),'headers':{'Authorization':_0x33c0cc['apiKey']},'body':{'content':_0x10a1c0[_0x1f6b('0xe')],'to':[_0x10a1c0['phone']],'from':_0x33c0cc[_0x1f6b('0x25')],'binary':![],'clientMessageId':_0x1f6b('0x6a'),'charset':_0x1f6b('0x6b')},'json':!![]};rp(_0x1d40b9)[_0x1f6b('0x1a')](function(_0x52cbc9){if(!_0x52cbc9['error']){var _0x5ddd74={'messageId':_0x52cbc9[_0x1f6b('0x58')][0x0][_0x1f6b('0x6c')]};if(!_0x33c0cc[_0x1f6b('0x3b')]){_0x5ddd74[_0x1f6b('0x3f')]=!![];}return _0x15ad2c['update'](_0x5ddd74);}else{return logger[_0x1f6b('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1f6b('0x2d'),_0x1f6b('0x6d'),util[_0x1f6b('0x3c')](_0x52cbc9['error'],{'showHidden':![],'depth':null}));}})[_0x1f6b('0x1d')](function(_0x18c395){return logger['error'](_0x1f6b('0x2c'),_0x1f6b('0x2d'),_0x1f6b('0x6d'),util[_0x1f6b('0x3c')](_0x18c395,{'showHidden':![],'depth':null}));});}else{logger[_0x1f6b('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1f6b('0x2d'),_0x1f6b('0x6d'),_0x1f6b('0x68'));}break;case _0x1f6b('0x6e'):if(_0x33c0cc[_0x1f6b('0x30')]&&_0x33c0cc[_0x1f6b('0x31')]){var _0x4d865d=util[_0x1f6b('0x42')](_0x1f6b('0x43'),_0x33c0cc['username'],_0x33c0cc[_0x1f6b('0x31')]);var _0x453645={'method':_0x1f6b('0x37'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x33c0cc[_0x1f6b('0x6f')]+_0x1f6b('0x70'),'body':{'to':[_0x10a1c0[_0x1f6b('0x25')]],'text':_0x10a1c0[_0x1f6b('0xe')],'from':_0x33c0cc[_0x1f6b('0x25')],'applicationId':_0x33c0cc[_0x1f6b('0x71')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x4d865d)[_0x1f6b('0x45')](_0x1f6b('0x46')))},'json':!![]};rp(_0x453645)[_0x1f6b('0x1a')](function(_0x3e9c6b){if(_0x3e9c6b['id']){var _0x2d535a={'messageId':_0x3e9c6b['id']};return _0x15ad2c['update'](_0x2d535a);}else{logger[_0x1f6b('0x1e')](_0x1f6b('0x2c'),_0x1f6b('0x2d'),_0x1f6b('0x6e'),util[_0x1f6b('0x3c')](_0x3e9c6b,{'showHidden':![],'depth':null}));}})[_0x1f6b('0x1d')](function(_0x205a00){logger[_0x1f6b('0x1e')](_0x1f6b('0x2c'),_0x1f6b('0x2d'),_0x1f6b('0x6e'),util[_0x1f6b('0x3c')](_0x205a00,{'showHidden':![],'depth':null}));});}else{logger[_0x1f6b('0x1e')](_0x1f6b('0x2c'),_0x1f6b('0x2d'),_0x1f6b('0x6e'),_0x1f6b('0x4c'));}break;case _0x1f6b('0x72'):if(_0x33c0cc[_0x1f6b('0x5b')]){var _0xa74ea5={};var _0x1be5a2={'method':_0x1f6b('0x37'),'uri':_0x1f6b('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x33c0cc['apiKey'],'Content-Type':_0x1f6b('0x56')},'body':{'from':_0x33c0cc[_0x1f6b('0x25')],'to':_0x10a1c0[_0x1f6b('0x25')],'text':_0x10a1c0[_0x1f6b('0xe')]},'json':!![]};return rp(_0x1be5a2)[_0x1f6b('0x1a')](function(_0x424227){if(_0x424227[_0x1f6b('0x74')]==0xca){_0xa74ea5['message']=_0x424227;var _0xa64850={'method':_0x1f6b('0x37'),'uri':_0x1f6b('0x75'),'headers':{'Authorization':_0x1f6b('0x76')+_0x33c0cc[_0x1f6b('0x5b')],'Content-Type':_0x1f6b('0x56')},'body':{'refid':_0xa74ea5[_0x1f6b('0x77')]['refid']},'json':!![]};return rp(_0xa64850)[_0x1f6b('0x1a')](function(_0xe548af){_0xa74ea5[_0x1f6b('0x78')]=_0xe548af;var _0x485eb5={'messageId':_0xa74ea5[_0x1f6b('0x77')][_0x1f6b('0x79')],'read':!![]};return _0x15ad2c['update'](_0x485eb5);});}else{return logger[_0x1f6b('0x1e')](_0x1f6b('0x2c'),'afterCreate',_0x1f6b('0x72'),util['inspect'](_0x424227,{'showHidden':![],'depth':null}));}})[_0x1f6b('0x1d')](function(_0x73d0b1){return logger['error'](_0x1f6b('0x2c'),_0x1f6b('0x2d'),_0x1f6b('0x72'),util[_0x1f6b('0x3c')](_0x73d0b1,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x1f6b('0x2c'),_0x1f6b('0x2d'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x1f6b('0x7a')](function(){_0x167f9b();});}else{_0x167f9b();}}},'charset':_0x1f6b('0x7b'),'collate':_0x1f6b('0x7c')});}; \ No newline at end of file +var _0x6c14=['accountId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','rimraf','./smsMessage.attributes','exports','define','sms_messages','messageId','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','error','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','body','remote','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','GET','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','read','catch','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','password','format','%s:%s','Basic\x20%s','toString','http_code','data','queued_count','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','token','application/json','infobip','csc','crypto','login','text','sort','length','apiKey','createHash','md5','digest','hex','signature=','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','clickatell','https://messaging.bandwidth.com/api/v2/users/'];(function(_0x2fb866,_0x59bc0c){var _0x5d310f=function(_0x13bf75){while(--_0x13bf75){_0x2fb866['push'](_0x2fb866['shift']());}};_0x5d310f(++_0x59bc0c);}(_0x6c14,0xee));var _0x46c1=function(_0x29c696,_0x133cef){_0x29c696=_0x29c696-0x0;var _0x238a8d=_0x6c14[_0x29c696];return _0x238a8d;};'use strict';var _=require('lodash');var util=require(_0x46c1('0x0'));var logger=require('../../config/logger')(_0x46c1('0x1'));var moment=require(_0x46c1('0x2'));var BPromise=require(_0x46c1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x46c1('0x4'));var config=require('../../config/environment');var attributes=require(_0x46c1('0x5'));module[_0x46c1('0x6')]=function(_0x1c1de2,_0x3e6a97){return _0x1c1de2[_0x46c1('0x7')]('SmsMessage',attributes,{'tableName':_0x46c1('0x8'),'paranoid':![],'indexes':[{'name':_0x46c1('0x9'),'fields':['messageId']},{'name':'fti_sms_messages','fields':['body'],'type':_0x46c1('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41c2da,_0x5a6353,_0x3aeae8){var _0x600e01=_0x1c1de2[_0x46c1('0xb')];var _0x5a2013=_0x41c2da['get']({'plain':!![]});if(_0x5a2013[_0x46c1('0xc')][_0x46c1('0xd')]()==='in'||_0x5a2013[_0x46c1('0xc')][_0x46c1('0xd')]()===_0x46c1('0xe')&&!_0x5a2013[_0x46c1('0xf')]&&!_['isNil'](_0x5a2013[_0x46c1('0x10')])&&!_['isNil'](_0x5a2013[_0x46c1('0x11')])){_0x600e01[_0x46c1('0x12')][_0x46c1('0x13')]({'where':{'id':_0x5a2013[_0x46c1('0x11')]}})[_0x46c1('0x14')](function(_0x4d7281){if(_0x4d7281){_0x4d7281[_0x46c1('0x15')]({'lastMsgAt':_0x5a2013['createdAt'],'lastMsgDirection':_0x5a2013[_0x46c1('0xc')][_0x46c1('0xd')]()});}})['catch'](function(_0x20e61a){console[_0x46c1('0x16')](_0x20e61a);});}if(_0x5a2013[_0x46c1('0xc')]===_0x46c1('0xe')&&!_0x5a2013[_0x46c1('0xf')]){var _0x28cebb;_0x600e01['SmsAccount'][_0x46c1('0x17')]({'where':{'id':_0x5a2013[_0x46c1('0x18')]},'raw':!![]})[_0x46c1('0x14')](function(_0x1c6aab){_0x28cebb=_0x1c6aab;if(_0x28cebb&&_0x28cebb[_0x46c1('0x19')]){switch(_0x28cebb[_0x46c1('0x19')]){case'twilio':var _0x7a5754=require(_0x46c1('0x1a'));if(_0x28cebb[_0x46c1('0x1b')]&&_0x28cebb['authToken']&&_0x28cebb[_0x46c1('0x1c')]){var _0x2dd19d=new _0x7a5754(_0x28cebb['accountSid'],_0x28cebb[_0x46c1('0x1d')]);_0x2dd19d[_0x46c1('0x1e')][_0x46c1('0x1f')]({'body':_0x5a2013[_0x46c1('0x20')],'to':_0x5a2013[_0x46c1('0x1c')],'from':_0x28cebb['phone'],'statusCallback':_0x28cebb[_0x46c1('0x21')]+_0x46c1('0x22')+_0x5a2013['id']+_0x46c1('0x23')+_0x28cebb['token']})[_0x46c1('0x14')](function(_0xb1aca8){if(_0xb1aca8[_0x46c1('0x24')]){return _0x41c2da['update']({'messageId':_0xb1aca8[_0x46c1('0x24')]});}})['catch'](function(_0x5a6c23){logger['error'](_0x46c1('0x25'),_0x46c1('0x26'),'twilio',util['inspect'](_0x5a6c23,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),'afterCreate',_0x46c1('0x1a'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x46c1('0x27'):var _0x5cf999=_0x46c1('0x28');if(_0x28cebb[_0x46c1('0x29')]&&_0x28cebb['password']){var _0x54b4da={'recipient':[_0x5a2013[_0x46c1('0x1c')]],'message':_0x5a2013[_0x46c1('0x20')],'message_type':_0x28cebb[_0x46c1('0x2a')]};if(_0x28cebb['smsMethod']&&_0x28cebb[_0x46c1('0x2a')]!=='SI'){_0x54b4da[_0x46c1('0x2b')]=_0x28cebb[_0x46c1('0x1c')];}var _0x1493aa={'url':_0x5cf999+_0x46c1('0x2c')+_0x28cebb[_0x46c1('0x29')]+_0x46c1('0x2d')+_0x28cebb['password'],'method':_0x46c1('0x2e')};rp(_0x1493aa)[_0x46c1('0x14')](function(_0x45228a){var _0x19781d=_0x45228a['split'](';');var _0x293949={'user_key':_0x19781d[0x0],'session_key':_0x19781d[0x1]};_0x1493aa={'url':_0x5cf999+_0x46c1('0x2f'),'method':_0x46c1('0x30'),'headers':{'user_key':_0x293949[_0x46c1('0x31')],'Session_key':_0x293949['session_key']},'json':!![],'body':_0x54b4da};return rp(_0x1493aa);})[_0x46c1('0x14')](function(_0x3aabc1){if(_0x3aabc1[_0x46c1('0x32')]>=0x1){var _0x5a2ca2={'messageId':_0x3aabc1[_0x46c1('0x33')]};if(_0x28cebb[_0x46c1('0x2a')]!=='GP'||!_0x28cebb[_0x46c1('0x34')]){_0x5a2ca2[_0x46c1('0x35')]=!![];}return _0x41c2da[_0x46c1('0x15')](_0x5a2ca2);}else{return logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x27'),util['inspect'](_0x3aabc1,{'showHidden':![],'depth':null}));}})[_0x46c1('0x36')](function(_0x12dda6){return logger['error'](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x27'),util[_0x46c1('0x37')](_0x12dda6,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),'skebby',_0x46c1('0x38'));}break;case _0x46c1('0x39'):if(_0x28cebb['authToken']){var _0x43ca0d={'recipient':_0x5a2013[_0x46c1('0x1c')],'message':_0x5a2013[_0x46c1('0x20')],'sender':_0x28cebb[_0x46c1('0x3a')]||_0x28cebb[_0x46c1('0x1c')],'authorization':_0x28cebb['authToken']};var _0x5a6353={'method':_0x46c1('0x30'),'uri':_0x46c1('0x3b'),'body':_0x43ca0d,'json':!![]};rp(_0x5a6353)[_0x46c1('0x14')](function(_0x309362){var _0x3bd00b={'messageId':_0x309362[_0x46c1('0x3c')]};if(!_0x28cebb[_0x46c1('0x34')]){_0x3bd00b[_0x46c1('0x35')]=!![];}return _0x41c2da[_0x46c1('0x15')](_0x3bd00b);})[_0x46c1('0x36')](function(_0x282d32){logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x39'),util[_0x46c1('0x37')](_0x282d32,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x39'),_0x46c1('0x3d'));}break;case'clicksend':if(_0x28cebb['username']&&_0x28cebb[_0x46c1('0x3e')]){var _0x43ca0d={'messages':[{'source':'xCALLY\x20Motion','to':_0x5a2013[_0x46c1('0x1c')],'body':_0x5a2013[_0x46c1('0x20')],'from':_0x28cebb[_0x46c1('0x3a')]||_0x28cebb[_0x46c1('0x1c')]}]};var _0x131805=util[_0x46c1('0x3f')](_0x46c1('0x40'),_0x28cebb[_0x46c1('0x29')],_0x28cebb[_0x46c1('0x3e')]);var _0x5a6353={'method':_0x46c1('0x30'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x43ca0d,'headers':{'Authorization':util[_0x46c1('0x3f')](_0x46c1('0x41'),new Buffer(_0x131805)[_0x46c1('0x42')]('base64'))},'json':!![]};rp(_0x5a6353)['then'](function(_0x39dc80){if(_0x39dc80[_0x46c1('0x43')]>=0xc8&&_0x39dc80[_0x46c1('0x43')]<=0xce){if(_0x39dc80['data']&&_0x39dc80[_0x46c1('0x44')][_0x46c1('0x45')]>0x0){var _0x38ebaa=_['head'](_0x39dc80[_0x46c1('0x44')][_0x46c1('0x1e')]);var _0x3bb328={'messageId':_0x38ebaa['message_id']};if(!_0x28cebb[_0x46c1('0x34')]){_0x3bb328[_0x46c1('0x35')]=!![];}return _0x41c2da['update'](_0x3bb328);}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x46'),util['inspect'](_0x39dc80,{'showHidden':![],'depth':null}));}}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x46'),util[_0x46c1('0x37')](_0x39dc80,{'showHidden':![],'depth':null}));}})[_0x46c1('0x36')](function(_0x57c49c){logger[_0x46c1('0x16')](_0x46c1('0x25'),'afterCreate',_0x46c1('0x46'),util[_0x46c1('0x37')](_0x57c49c,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x46'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x46c1('0x47'):if(_0x28cebb[_0x46c1('0x48')]&&_0x28cebb[_0x46c1('0x1d')]){var _0x43ca0d={'dst':_0x5a2013['phone'],'text':_0x5a2013[_0x46c1('0x20')],'src':_0x28cebb[_0x46c1('0x3a')]||_0x28cebb[_0x46c1('0x1c')],'url':_0x28cebb[_0x46c1('0x21')]+_0x46c1('0x22')+_0x5a2013['id']+'/status?token='+_0x28cebb['token']};var _0x131805=util[_0x46c1('0x3f')]('%s:%s',_0x28cebb[_0x46c1('0x48')],_0x28cebb['authToken']);var _0x5a6353={'method':_0x46c1('0x30'),'uri':util[_0x46c1('0x3f')](_0x46c1('0x49'),_0x28cebb[_0x46c1('0x48')]),'body':_0x43ca0d,'headers':{'Authorization':util[_0x46c1('0x3f')]('Basic\x20%s',new Buffer(_0x131805)[_0x46c1('0x42')](_0x46c1('0x4a')))},'json':!![]};rp(_0x5a6353)[_0x46c1('0x14')](function(_0x5ed37a){var _0x4f35f0={'messageId':_0x5ed37a['message_uuid'][0x0]};return _0x41c2da['update'](_0x4f35f0);})['catch'](function(_0x577cfc){logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),'plivo',util[_0x46c1('0x37')](_0x577cfc,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),'plivo',_0x46c1('0x4b'));}break;case'infobip':if(_0x28cebb[_0x46c1('0x29')]&&_0x28cebb[_0x46c1('0x3e')]){if(_0x28cebb[_0x46c1('0x4c')]){var _0x5cdd55={'method':_0x46c1('0x30'),'uri':_0x28cebb[_0x46c1('0x4c')]+_0x46c1('0x4d'),'body':{'username':_0x28cebb[_0x46c1('0x29')],'password':_0x28cebb[_0x46c1('0x3e')]},'json':!![]};return rp(_0x5cdd55)[_0x46c1('0x14')](function(_0x11c8a5){var _0x2ea4b1={'method':_0x46c1('0x30'),'uri':_0x28cebb[_0x46c1('0x4c')]+_0x46c1('0x4e'),'body':{'messages':[{'from':_0x28cebb[_0x46c1('0x1c')],'destinations':[{'to':_0x5a2013[_0x46c1('0x1c')]}],'text':_0x5a2013['body'],'notifyUrl':_0x28cebb[_0x46c1('0x21')]+_0x46c1('0x22')+_0x5a2013['id']+_0x46c1('0x23')+_0x28cebb[_0x46c1('0x4f')],'notifyContentType':_0x46c1('0x50'),'callbackData':_0x28cebb['phone']+';'+_0x5a2013[_0x46c1('0x20')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x11c8a5['token']},'json':!![]};return rp(_0x2ea4b1)[_0x46c1('0x14')](function(_0x15858f){if(_0x15858f[_0x46c1('0x1e')]){var _0x5198a4={'messageId':_0x15858f[_0x46c1('0x1e')][0x0]['messageId']};if(!_0x28cebb[_0x46c1('0x34')]){_0x5198a4[_0x46c1('0x35')]=!![];}return _0x41c2da['update'](_0x5198a4);}else{return logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),'infobip',util[_0x46c1('0x37')](_0x15858f,{'showHidden':![],'depth':null}));}});})[_0x46c1('0x36')](function(_0x30a8f0){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x46c1('0x26'),_0x46c1('0x51'),util['inspect'](_0x30a8f0,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x51'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),'infobip',_0x46c1('0x38'));}break;case _0x46c1('0x52'):var _0x415737=require(_0x46c1('0x53'));if(_0x28cebb['apiKey']){var _0x161f3e={};_0x161f3e[_0x46c1('0x54')]=_0x28cebb['username'];_0x161f3e[_0x46c1('0x1c')]=_0x5a2013['phone'];_0x161f3e['sender']=_0x28cebb[_0x46c1('0x1c')];_0x161f3e[_0x46c1('0x55')]=_0x5a2013[_0x46c1('0x20')];_0x161f3e['timestamp']=+new Date();var _0x1ccf63='';var _0x3ef970='';var _0xc6eddc=Object['keys'](_0x161f3e);_0xc6eddc[_0x46c1('0x56')]();for(var _0x84c0f4=0x0;_0x84c0f4<_0xc6eddc[_0x46c1('0x57')];_0x84c0f4++){if(_0x1ccf63!=''){_0x1ccf63+='&';}_0x1ccf63+=_0xc6eddc[_0x84c0f4]+'='+encodeURIComponent(_0x161f3e[_0xc6eddc[_0x84c0f4]]);_0x3ef970+=_0x161f3e[_0xc6eddc[_0x84c0f4]];}_0x3ef970+=_0x28cebb[_0x46c1('0x58')];_0x3ef970=_0x415737[_0x46c1('0x59')](_0x46c1('0x5a'))['update'](_0x3ef970)[_0x46c1('0x5b')](_0x46c1('0x5c'));if(_0x1ccf63!==''){_0x1ccf63+='&';}_0x1ccf63+=_0x46c1('0x5d')+_0x3ef970;var _0x1493aa={'method':_0x46c1('0x2e'),'uri':_0x28cebb[_0x46c1('0x4c')]+_0x46c1('0x5e')+_0x1ccf63,'json':!![]};return rp(_0x1493aa)['then'](function(_0x5ee631){var _0x5a46c6=Object[_0x46c1('0x5f')](_0x5ee631);if(_0x5ee631[_0x5a46c6[0x0]][_0x46c1('0x16')]&&parseInt(_0x5ee631[_0x5a46c6[0x0]][_0x46c1('0x16')])===0x0){var _0x5a33c8={'messageId':_0x5ee631[_0x5a46c6[0x0]][_0x46c1('0x60')]};if(!_0x28cebb[_0x46c1('0x34')]){_0x5a33c8[_0x46c1('0x35')]=!![];}return _0x41c2da[_0x46c1('0x15')](_0x5a33c8);}else{return logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x52'),util[_0x46c1('0x37')](_0x5ee631['error'],{'showHidden':![],'depth':null}));}})[_0x46c1('0x36')](function(_0x2919d8){return logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x52'),util[_0x46c1('0x37')](_0x2919d8,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x52'),_0x46c1('0x61'));}break;case'clickatell':if(_0x28cebb[_0x46c1('0x58')]){var _0x2d94f5={'method':'POST','uri':_0x46c1('0x62'),'headers':{'Authorization':_0x28cebb[_0x46c1('0x58')]},'body':{'content':_0x5a2013[_0x46c1('0x20')],'to':[_0x5a2013[_0x46c1('0x1c')]],'from':_0x28cebb[_0x46c1('0x1c')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x2d94f5)['then'](function(_0x15c63c){if(!_0x15c63c[_0x46c1('0x16')]){var _0x519581={'messageId':_0x15c63c[_0x46c1('0x1e')][0x0]['apiMessageId']};if(!_0x28cebb[_0x46c1('0x34')]){_0x519581['read']=!![];}return _0x41c2da[_0x46c1('0x15')](_0x519581);}else{return logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x63'),util[_0x46c1('0x37')](_0x15c63c[_0x46c1('0x16')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3ec264){return logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x63'),util['inspect'](_0x3ec264,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x63'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x28cebb[_0x46c1('0x29')]&&_0x28cebb[_0x46c1('0x3e')]){var _0x131805=util[_0x46c1('0x3f')](_0x46c1('0x40'),_0x28cebb[_0x46c1('0x29')],_0x28cebb[_0x46c1('0x3e')]);var _0x5a6353={'method':'POST','uri':_0x46c1('0x64')+_0x28cebb[_0x46c1('0x65')]+'/messages','body':{'to':[_0x5a2013['phone']],'text':_0x5a2013[_0x46c1('0x20')],'from':_0x28cebb[_0x46c1('0x1c')],'applicationId':_0x28cebb['applicationId']},'headers':{'Authorization':util['format'](_0x46c1('0x41'),new Buffer(_0x131805)[_0x46c1('0x42')](_0x46c1('0x4a')))},'json':!![]};rp(_0x5a6353)[_0x46c1('0x14')](function(_0x52395e){if(_0x52395e['id']){var _0x216bb4={'messageId':_0x52395e['id']};return _0x41c2da[_0x46c1('0x15')](_0x216bb4);}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),'afterCreate',_0x46c1('0x66'),util['inspect'](_0x52395e,{'showHidden':![],'depth':null}));}})[_0x46c1('0x36')](function(_0x2023e0){logger[_0x46c1('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x46c1('0x26'),_0x46c1('0x66'),util[_0x46c1('0x37')](_0x2023e0,{'showHidden':![],'depth':null}));});}else{logger[_0x46c1('0x16')](_0x46c1('0x25'),_0x46c1('0x26'),_0x46c1('0x66'),_0x46c1('0x38'));}break;case _0x46c1('0x67'):if(_0x28cebb[_0x46c1('0x58')]){var _0x1f7c41={};var _0x1493aa={'method':'POST','uri':_0x46c1('0x68'),'headers':{'Authorization':_0x46c1('0x69')+_0x28cebb[_0x46c1('0x58')],'Content-Type':_0x46c1('0x50')},'body':{'from':_0x28cebb[_0x46c1('0x1c')],'to':_0x5a2013[_0x46c1('0x1c')],'text':_0x5a2013[_0x46c1('0x20')]},'json':!![]};return rp(_0x1493aa)[_0x46c1('0x14')](function(_0x9f7677){if(_0x9f7677[_0x46c1('0x6a')]==0xca){_0x1f7c41[_0x46c1('0x6b')]=_0x9f7677;var _0x1a36df={'method':_0x46c1('0x30'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x28cebb['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x1f7c41[_0x46c1('0x6b')][_0x46c1('0x6c')]},'json':!![]};return rp(_0x1a36df)[_0x46c1('0x14')](function(_0x3e0760){_0x1f7c41['status']=_0x3e0760;var _0x472da5={'messageId':_0x1f7c41[_0x46c1('0x6b')]['refid'],'read':!![]};return _0x41c2da[_0x46c1('0x15')](_0x472da5);});}else{return logger['error'](_0x46c1('0x25'),_0x46c1('0x26'),'intelepeer',util['inspect'](_0x9f7677,{'showHidden':![],'depth':null}));}})[_0x46c1('0x36')](function(_0x2ca597){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util[_0x46c1('0x37')](_0x2ca597,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x46c1('0x67'),_0x46c1('0x6d'));}break;}}})[_0x46c1('0x6e')](function(){_0x3aeae8();});}else{_0x3aeae8();}}},'charset':_0x46c1('0x6f'),'collate':_0x46c1('0x70')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index eca7a14..437afa8 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 _0xdb8d=['stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsMessage','body','options','raw'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xdb8d,0x118));var _0xddb8=function(_0x9b6188,_0x28cb0b){_0x9b6188=_0x9b6188-0x0;var _0x37d16d=_0xdb8d[_0x9b6188];return _0x37d16d;};'use strict';var _=require('lodash');var util=require(_0xddb8('0x0'));var moment=require(_0xddb8('0x1'));var BPromise=require('bluebird');var rs=require(_0xddb8('0x2'));var fs=require('fs');var Redis=require(_0xddb8('0x3'));var db=require(_0xddb8('0x4'))['db'];var utils=require(_0xddb8('0x5'));var logger=require(_0xddb8('0x6'))(_0xddb8('0x7'));var config=require(_0xddb8('0x8'));var jayson=require(_0xddb8('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xddb8('0xa')]=_['defaults'](config[_0xddb8('0xa')],{'host':_0xddb8('0xb'),'port':0x18eb});var socket=require(_0xddb8('0xc'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xddb8('0xd')](socket);function respondWithRpcPromise(_0x2bc0c8,_0x1d718e,_0x13167f){return new BPromise(function(_0xfb969c,_0x46b80c){return client[_0xddb8('0xe')](_0x2bc0c8,_0x13167f)[_0xddb8('0xf')](function(_0x582c80){logger[_0xddb8('0x10')](_0xddb8('0x11'),_0x1d718e,_0xddb8('0x12'));logger[_0xddb8('0x13')](_0xddb8('0x14'),_0x1d718e,'request\x20sent',JSON['stringify'](_0x582c80));if(_0x582c80['error']){if(_0x582c80[_0xddb8('0x15')][_0xddb8('0x16')]===0x1f4){logger[_0xddb8('0x15')]('SmsMessage,\x20%s,\x20%s',_0x1d718e,_0x582c80['error']['message']);return _0x46b80c(_0x582c80[_0xddb8('0x15')][_0xddb8('0x17')]);}logger[_0xddb8('0x15')]('SmsMessage,\x20%s,\x20%s',_0x1d718e,_0x582c80[_0xddb8('0x15')][_0xddb8('0x17')]);return _0xfb969c(_0x582c80['error'][_0xddb8('0x17')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x1d718e,_0xddb8('0x12'));_0xfb969c(_0x582c80[_0xddb8('0x18')][_0xddb8('0x17')]);}})[_0xddb8('0x19')](function(_0x4d9e95){logger[_0xddb8('0x15')](_0xddb8('0x11'),_0x1d718e,_0x4d9e95);_0x46b80c(_0x4d9e95);});});}exports[_0xddb8('0x1a')]=function(_0x1734d1){var _0x2cd497=this;return new Promise(function(_0x13dbaf,_0x5b179f){return db['SmsMessage']['create'](_0x1734d1[_0xddb8('0x1b')],{'raw':_0x1734d1[_0xddb8('0x1c')]?_0x1734d1['options'][_0xddb8('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x38fbb7){logger['info'](_0xddb8('0x1a'),_0x1734d1);logger[_0xddb8('0x13')](_0xddb8('0x1a'),_0x1734d1,JSON[_0xddb8('0x1e')](_0x38fbb7));_0x13dbaf(_0x38fbb7);})[_0xddb8('0x19')](function(_0xa49c76){logger['error'](_0xddb8('0x1a'),_0xa49c76[_0xddb8('0x17')],_0x1734d1);_0x5b179f(_0x2cd497[_0xddb8('0x15')](0x1f4,_0xa49c76[_0xddb8('0x17')]));});});}; \ No newline at end of file +var _0x0733=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','options','raw','then','util','moment','bluebird','randomstring'];(function(_0x4c40f6,_0x432c5f){var _0x132f49=function(_0x163df1){while(--_0x163df1){_0x4c40f6['push'](_0x4c40f6['shift']());}};_0x132f49(++_0x432c5f);}(_0x0733,0x125));var _0x3073=function(_0x506565,_0x1386aa){_0x506565=_0x506565-0x0;var _0x172aa2=_0x0733[_0x506565];return _0x172aa2;};'use strict';var _=require('lodash');var util=require(_0x3073('0x0'));var moment=require(_0x3073('0x1'));var BPromise=require(_0x3073('0x2'));var rs=require(_0x3073('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3073('0x4'))['db'];var utils=require(_0x3073('0x5'));var logger=require(_0x3073('0x6'))(_0x3073('0x7'));var config=require(_0x3073('0x8'));var jayson=require(_0x3073('0x9'));var client=jayson[_0x3073('0xa')][_0x3073('0xb')]({'port':0x232a});config['redis']=_[_0x3073('0xc')](config[_0x3073('0xd')],{'host':_0x3073('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3073('0xd')]));require(_0x3073('0xf'))[_0x3073('0x10')](socket);function respondWithRpcPromise(_0x5e6b44,_0x105e78,_0x39874f){return new BPromise(function(_0x3e631f,_0x923b40){return client[_0x3073('0x11')](_0x5e6b44,_0x39874f)['then'](function(_0x4243cf){logger[_0x3073('0x12')](_0x3073('0x13'),_0x105e78,_0x3073('0x14'));logger['debug'](_0x3073('0x15'),_0x105e78,'request\x20sent',JSON[_0x3073('0x16')](_0x4243cf));if(_0x4243cf['error']){if(_0x4243cf[_0x3073('0x17')][_0x3073('0x18')]===0x1f4){logger['error'](_0x3073('0x13'),_0x105e78,_0x4243cf[_0x3073('0x17')][_0x3073('0x19')]);return _0x923b40(_0x4243cf[_0x3073('0x17')][_0x3073('0x19')]);}logger[_0x3073('0x17')]('SmsMessage,\x20%s,\x20%s',_0x105e78,_0x4243cf[_0x3073('0x17')]['message']);return _0x3e631f(_0x4243cf[_0x3073('0x17')][_0x3073('0x19')]);}else{logger['info'](_0x3073('0x13'),_0x105e78,_0x3073('0x14'));_0x3e631f(_0x4243cf[_0x3073('0x1a')]['message']);}})[_0x3073('0x1b')](function(_0x17bdab){logger[_0x3073('0x17')](_0x3073('0x13'),_0x105e78,_0x17bdab);_0x923b40(_0x17bdab);});});}exports[_0x3073('0x1c')]=function(_0x1e94cb){var _0x58cdc4=this;return new Promise(function(_0x4479f3,_0x1e3ebc){return db[_0x3073('0x1d')]['create'](_0x1e94cb['body'],{'raw':_0x1e94cb[_0x3073('0x1e')]?_0x1e94cb['options'][_0x3073('0x1f')]===undefined?!![]:![]:!![]})[_0x3073('0x20')](function(_0x3da25c){logger['info'](_0x3073('0x1c'),_0x1e94cb);logger['debug'](_0x3073('0x1c'),_0x1e94cb,JSON[_0x3073('0x16')](_0x3da25c));_0x4479f3(_0x3da25c);})[_0x3073('0x1b')](function(_0x530594){logger[_0x3073('0x17')]('CreateSmsMessage',_0x530594[_0x3073('0x19')],_0x1e94cb);_0x1e3ebc(_0x58cdc4[_0x3073('0x17')](0x1f4,_0x530594[_0x3073('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index fc080d6..48cd78d 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 _0x0ac1=['update','removeListener','register','smsMessage:','./smsMessage.events','save'];(function(_0x879e31,_0x139d02){var _0x3467e8=function(_0x544fc6){while(--_0x544fc6){_0x879e31['push'](_0x879e31['shift']());}};_0x3467e8(++_0x139d02);}(_0x0ac1,0x12a));var _0x10ac=function(_0x3d81c0,_0xd20f88){_0x3d81c0=_0x3d81c0-0x0;var _0x478cd1=_0x0ac1[_0x3d81c0];return _0x478cd1;};'use strict';var SmsMessageEvents=require(_0x10ac('0x0'));var events=[_0x10ac('0x1'),'remove',_0x10ac('0x2')];function createListener(_0x1bcc22,_0x1a941b){return function(_0x5e7dd5){_0x1a941b['emit'](_0x1bcc22,_0x5e7dd5);};}function removeListener(_0x420695,_0x581e2c){return function(){SmsMessageEvents[_0x10ac('0x3')](_0x420695,_0x581e2c);};}exports[_0x10ac('0x4')]=function(_0x2447dc){for(var _0x5357bd=0x0,_0x5b27a8=events['length'];_0x5357bd<_0x5b27a8;_0x5357bd++){var _0x505220=events[_0x5357bd];var _0xd3488c=createListener(_0x10ac('0x5')+_0x505220,_0x2447dc);SmsMessageEvents['on'](_0x505220,_0xd3488c);}}; \ No newline at end of file +var _0xe189=['removeListener','register','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0x44e470,_0x13b9e9){var _0x28fd40=function(_0x5b0ab2){while(--_0x5b0ab2){_0x44e470['push'](_0x44e470['shift']());}};_0x28fd40(++_0x13b9e9);}(_0xe189,0x1d8));var _0x9e18=function(_0x5ab48c,_0x45e2d3){_0x5ab48c=_0x5ab48c-0x0;var _0xc25049=_0xe189[_0x5ab48c];return _0xc25049;};'use strict';var SmsMessageEvents=require(_0x9e18('0x0'));var events=[_0x9e18('0x1'),_0x9e18('0x2'),_0x9e18('0x3')];function createListener(_0x21e81d,_0x3f571e){return function(_0x1e46d3){_0x3f571e['emit'](_0x21e81d,_0x1e46d3);};}function removeListener(_0x13c41a,_0x49fd91){return function(){SmsMessageEvents[_0x9e18('0x4')](_0x13c41a,_0x49fd91);};}exports[_0x9e18('0x5')]=function(_0x4ffd49){for(var _0xcecaf4=0x0,_0x3a47d9=events['length'];_0xcecaf4<_0x3a47d9;_0xcecaf4++){var _0x4be306=events[_0xcecaf4];var _0x22b42b=createListener(_0x9e18('0x6')+_0x4be306,_0x4ffd49);SmsMessageEvents['on'](_0x4be306,_0x22b42b);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 51e9fe0..8b8b75d 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 _0x98fa=['/:id','show','/:id/members','getMembers','getTeams','getAgents','post','/:id/teams','addTeams','/:id/users','addAgents','update','removeTeams','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x232bd6,_0x513f9f){var _0x40c2dd=function(_0x4a78d5){while(--_0x4a78d5){_0x232bd6['push'](_0x232bd6['shift']());}};_0x40c2dd(++_0x513f9f);}(_0x98fa,0x99));var _0xa98f=function(_0x54640c,_0x2a7887){_0x54640c=_0x54640c-0x0;var _0x2fa24d=_0x98fa[_0x54640c];return _0x2fa24d;};'use strict';var multer=require(_0xa98f('0x0'));var util=require(_0xa98f('0x1'));var path=require(_0xa98f('0x2'));var timeout=require(_0xa98f('0x3'));var express=require('express');var router=express[_0xa98f('0x4')]();var fs_extra=require(_0xa98f('0x5'));var auth=require(_0xa98f('0x6'));var interaction=require(_0xa98f('0x7'));var config=require(_0xa98f('0x8'));var controller=require(_0xa98f('0x9'));router[_0xa98f('0xa')]('/',auth[_0xa98f('0xb')](),controller[_0xa98f('0xc')]);router[_0xa98f('0xa')](_0xa98f('0xd'),auth['isAuthenticated'](),controller[_0xa98f('0xe')]);router['get'](_0xa98f('0xf'),auth['isAuthenticated'](),controller[_0xa98f('0x10')]);router[_0xa98f('0xa')](_0xa98f('0x11'),auth[_0xa98f('0xb')](),controller[_0xa98f('0x12')]);router[_0xa98f('0xa')]('/:id/teams',auth[_0xa98f('0xb')](),controller[_0xa98f('0x13')]);router['get']('/:id/users',auth[_0xa98f('0xb')](),controller[_0xa98f('0x14')]);router['post']('/',auth[_0xa98f('0xb')](),controller['create']);router[_0xa98f('0x15')](_0xa98f('0x16'),auth['isAuthenticated'](),controller[_0xa98f('0x17')]);router[_0xa98f('0x15')](_0xa98f('0x18'),auth[_0xa98f('0xb')](),controller[_0xa98f('0x19')]);router['put'](_0xa98f('0xf'),auth['isAuthenticated'](),controller[_0xa98f('0x1a')]);router['delete'](_0xa98f('0xf'),auth[_0xa98f('0xb')](),controller['destroy']);router['delete'](_0xa98f('0x16'),auth[_0xa98f('0xb')](),controller[_0xa98f('0x1b')]);router['delete'](_0xa98f('0x18'),auth[_0xa98f('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xfe64=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util'];(function(_0x375325,_0x57a850){var _0x228f57=function(_0x2ad744){while(--_0x2ad744){_0x375325['push'](_0x375325['shift']());}};_0x228f57(++_0x57a850);}(_0xfe64,0x94));var _0x4fe6=function(_0x388334,_0x436e8a){_0x388334=_0x388334-0x0;var _0x526544=_0xfe64[_0x388334];return _0x526544;};'use strict';var multer=require(_0x4fe6('0x0'));var util=require(_0x4fe6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4fe6('0x2'));var router=express['Router']();var fs_extra=require(_0x4fe6('0x3'));var auth=require(_0x4fe6('0x4'));var interaction=require(_0x4fe6('0x5'));var config=require(_0x4fe6('0x6'));var controller=require(_0x4fe6('0x7'));router[_0x4fe6('0x8')]('/',auth['isAuthenticated'](),controller[_0x4fe6('0x9')]);router[_0x4fe6('0x8')](_0x4fe6('0xa'),auth[_0x4fe6('0xb')](),controller[_0x4fe6('0xc')]);router[_0x4fe6('0x8')](_0x4fe6('0xd'),auth[_0x4fe6('0xb')](),controller[_0x4fe6('0xe')]);router[_0x4fe6('0x8')](_0x4fe6('0xf'),auth[_0x4fe6('0xb')](),controller['getMembers']);router[_0x4fe6('0x8')](_0x4fe6('0x10'),auth['isAuthenticated'](),controller[_0x4fe6('0x11')]);router[_0x4fe6('0x8')](_0x4fe6('0x12'),auth['isAuthenticated'](),controller[_0x4fe6('0x13')]);router[_0x4fe6('0x14')]('/',auth['isAuthenticated'](),controller[_0x4fe6('0x15')]);router[_0x4fe6('0x14')](_0x4fe6('0x10'),auth['isAuthenticated'](),controller[_0x4fe6('0x16')]);router['post'](_0x4fe6('0x12'),auth[_0x4fe6('0xb')](),controller[_0x4fe6('0x17')]);router['put']('/:id',auth[_0x4fe6('0xb')](),controller[_0x4fe6('0x18')]);router[_0x4fe6('0x19')](_0x4fe6('0xd'),auth['isAuthenticated'](),controller[_0x4fe6('0x1a')]);router[_0x4fe6('0x19')](_0x4fe6('0x10'),auth[_0x4fe6('0xb')](),controller[_0x4fe6('0x1b')]);router[_0x4fe6('0x19')]('/:id/users',auth[_0x4fe6('0xb')](),controller[_0x4fe6('0x1c')]);module[_0x4fe6('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 127c53f..18a4127 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 _0x825b=['exports','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x30b2c6,_0x1eafe8){var _0x42052d=function(_0xfeb539){while(--_0xfeb539){_0x30b2c6['push'](_0x30b2c6['shift']());}};_0x42052d(++_0x1eafe8);}(_0x825b,0xe7));var _0xb825=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0x825b[_0x3e0b8f];return _0x22f742;};'use strict';var Sequelize=require(_0xb825('0x0'));module[_0xb825('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb825('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb825('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb825('0x4')](_0xb825('0x5'),_0xb825('0x6'),_0xb825('0x7'))}}; \ No newline at end of file +var _0x7a69=['ENUM','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x5224ba,_0x3fb4e1){var _0x459bd2=function(_0x61be43){while(--_0x61be43){_0x5224ba['push'](_0x5224ba['shift']());}};_0x459bd2(++_0x3fb4e1);}(_0x7a69,0x9e));var _0x97a6=function(_0x20aeb4,_0x27bcce){_0x20aeb4=_0x20aeb4-0x0;var _0x37571b=_0x7a69[_0x20aeb4];return _0x37571b;};'use strict';var Sequelize=require(_0x97a6('0x0'));module[_0x97a6('0x1')]={'name':{'type':Sequelize[_0x97a6('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x97a6('0x2')]},'timeout':{'type':Sequelize[_0x97a6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x97a6('0x4')]('rrmemory','beepall',_0x97a6('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 45b07d7..c752aaa 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 _0xfa93=['isArray','userSmsQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','SmsQueues','UserProfileResource','end','error','name','send','SmsQueue','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserSmsQueue','pick','SmsQueueId','map','findAll','User','findAndCountAll','UserId','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','nolimit','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','removeTeams','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','spread','emit','userSmsQueue:save'];(function(_0x511215,_0x48cbb6){var _0x267f0a=function(_0x40782e){while(--_0x40782e){_0x511215['push'](_0x511215['shift']());}};_0x267f0a(++_0x48cbb6);}(_0xfa93,0x11f));var _0x3fa9=function(_0x19b3f6,_0xf111eb){_0x19b3f6=_0x19b3f6-0x0;var _0x4cb838=_0xfa93[_0x19b3f6];return _0x4cb838;};'use strict';var emlformat=require(_0x3fa9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fa9('0x1'));var jsonpatch=require(_0x3fa9('0x2'));var rp=require(_0x3fa9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3fa9('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x3fa9('0x5'));var ejs=require(_0x3fa9('0x6'));var fs=require('fs');var fs_extra=require(_0x3fa9('0x7'));var _=require(_0x3fa9('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3fa9('0x9'));var deskjs=require(_0x3fa9('0xa'));var toCsv=require('to-csv');var querystring=require(_0x3fa9('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3fa9('0xc'));var as=require(_0x3fa9('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3fa9('0xe'))(_0x3fa9('0xf'));var utils=require('../../config/utils');var config=require(_0x3fa9('0x10'));var licenseUtil=require(_0x3fa9('0x11'));var db=require(_0x3fa9('0x12'))['db'];config['redis']=_[_0x3fa9('0x13')](config[_0x3fa9('0x14')],{'host':_0x3fa9('0x15'),'port':0x18eb});var socket=require(_0x3fa9('0x16'))(new Redis(config[_0x3fa9('0x14')]));require(_0x3fa9('0x17'))[_0x3fa9('0x18')](socket);function respondWithStatusCode(_0x2743ee,_0x185f41){_0x185f41=_0x185f41||0xcc;return function(_0x1bc2e5){if(_0x1bc2e5){return _0x2743ee[_0x3fa9('0x19')](_0x185f41);}return _0x2743ee[_0x3fa9('0x1a')](_0x185f41)['end']();};}function respondWithResult(_0x152cec,_0x5d6cbd){_0x5d6cbd=_0x5d6cbd||0xc8;return function(_0x503dbf){if(_0x503dbf){return _0x152cec[_0x3fa9('0x1a')](_0x5d6cbd)[_0x3fa9('0x1b')](_0x503dbf);}};}function respondWithFilteredResult(_0x40349e,_0x49b777){return function(_0x3f4f36){if(_0x3f4f36){var _0x15365a=typeof _0x49b777[_0x3fa9('0x1c')]===_0x3fa9('0x1d')&&typeof _0x49b777[_0x3fa9('0x1e')]===_0x3fa9('0x1d');var _0x47cf8c=_0x3f4f36[_0x3fa9('0x1f')];var _0x48a421=_0x15365a?0x0:_0x49b777[_0x3fa9('0x1c')];var _0x3b5134=_0x15365a?_0x3f4f36[_0x3fa9('0x1f')]:_0x49b777[_0x3fa9('0x1c')]+_0x49b777[_0x3fa9('0x1e')];var _0x1a72fc;if(_0x3b5134>=_0x47cf8c){_0x3b5134=_0x47cf8c;_0x1a72fc=0xc8;}else{_0x1a72fc=0xce;}_0x40349e[_0x3fa9('0x1a')](_0x1a72fc);return _0x40349e[_0x3fa9('0x20')](_0x3fa9('0x21'),_0x48a421+'-'+_0x3b5134+'/'+_0x47cf8c)['json'](_0x3f4f36);}return null;};}function patchUpdates(_0xa78098){return function(_0xb3995b){try{jsonpatch[_0x3fa9('0x22')](_0xb3995b,_0xa78098,!![]);}catch(_0x3ad160){return BPromise[_0x3fa9('0x23')](_0x3ad160);}return _0xb3995b[_0x3fa9('0x24')]();};}function saveUpdates(_0x24ba67,_0xc9a83){return function(_0x4cffe0){if(_0x4cffe0){return _0x4cffe0['update'](_0x24ba67)['then'](function(_0x495b48){return _0x495b48;});}return null;};}function removeEntity(_0x44256b,_0x1e5770){return function(_0x48db4a){if(_0x48db4a){return _0x48db4a[_0x3fa9('0x25')]()[_0x3fa9('0x26')](function(){var _0x43f28f=_0x48db4a['get']({'plain':!![]});var _0x568434=_0x3fa9('0x27');return db[_0x3fa9('0x28')][_0x3fa9('0x25')]({'where':{'type':_0x568434,'resourceId':_0x43f28f['id']}})[_0x3fa9('0x26')](function(){return _0x48db4a;});})[_0x3fa9('0x26')](function(){_0x44256b['status'](0xcc)[_0x3fa9('0x29')]();});}};}function handleEntityNotFound(_0x47024c,_0x3c96c5){return function(_0x3b34c8){if(!_0x3b34c8){_0x47024c['sendStatus'](0x194);}return _0x3b34c8;};}function handleError(_0x420941,_0x79f98d){_0x79f98d=_0x79f98d||0x1f4;return function(_0x49ac93){logger[_0x3fa9('0x2a')](_0x49ac93['stack']);if(_0x49ac93[_0x3fa9('0x2b')]){delete _0x49ac93['name'];}_0x420941[_0x3fa9('0x1a')](_0x79f98d)[_0x3fa9('0x2c')](_0x49ac93);};}exports['index']=function(_0x6e4cfe,_0xa166e2){var _0x1dda83={},_0x51e4cf={},_0x2361e6={'count':0x0,'rows':[]};var _0x28cb3b=_['map'](db[_0x3fa9('0x2d')][_0x3fa9('0x2e')],function(_0x1d4e48){return{'name':_0x1d4e48[_0x3fa9('0x2f')],'type':_0x1d4e48[_0x3fa9('0x30')][_0x3fa9('0x31')]};});_0x51e4cf[_0x3fa9('0x32')]=_['map'](_0x28cb3b,_0x3fa9('0x2b'));_0x51e4cf[_0x3fa9('0x33')]=_['keys'](_0x6e4cfe[_0x3fa9('0x33')]);_0x51e4cf[_0x3fa9('0x34')]=_['intersection'](_0x51e4cf[_0x3fa9('0x32')],_0x51e4cf[_0x3fa9('0x33')]);_0x1dda83[_0x3fa9('0x35')]=_[_0x3fa9('0x36')](_0x51e4cf[_0x3fa9('0x32')],qs[_0x3fa9('0x37')](_0x6e4cfe[_0x3fa9('0x33')][_0x3fa9('0x37')]));_0x1dda83[_0x3fa9('0x35')]=_0x1dda83[_0x3fa9('0x35')][_0x3fa9('0x38')]?_0x1dda83[_0x3fa9('0x35')]:_0x51e4cf['model'];if(!_0x6e4cfe['query'][_0x3fa9('0x39')]('nolimit')){_0x1dda83[_0x3fa9('0x1e')]=qs[_0x3fa9('0x1e')](_0x6e4cfe[_0x3fa9('0x33')]['limit']);_0x1dda83[_0x3fa9('0x1c')]=qs[_0x3fa9('0x1c')](_0x6e4cfe[_0x3fa9('0x33')][_0x3fa9('0x1c')]);}_0x1dda83['order']=qs[_0x3fa9('0x3a')](_0x6e4cfe[_0x3fa9('0x33')][_0x3fa9('0x3a')]);_0x1dda83[_0x3fa9('0x3b')]=qs[_0x3fa9('0x34')](_['pick'](_0x6e4cfe[_0x3fa9('0x33')],_0x51e4cf[_0x3fa9('0x34')]),_0x28cb3b);if(_0x6e4cfe['query'][_0x3fa9('0x3c')]){_0x1dda83['where']=_[_0x3fa9('0x3d')](_0x1dda83[_0x3fa9('0x3b')],{'$or':_['map'](_0x28cb3b,function(_0x4ebb9b){if(_0x4ebb9b[_0x3fa9('0x30')]!==_0x3fa9('0x3e')){var _0x3e8444={};_0x3e8444[_0x4ebb9b[_0x3fa9('0x2b')]]={'$like':'%'+_0x6e4cfe[_0x3fa9('0x33')]['filter']+'%'};return _0x3e8444;}})});}_0x1dda83=_[_0x3fa9('0x3d')]({},_0x1dda83,_0x6e4cfe['options']);var _0x1a0d40={'where':_0x1dda83[_0x3fa9('0x3b')]};return db[_0x3fa9('0x2d')][_0x3fa9('0x1f')](_0x1a0d40)[_0x3fa9('0x26')](function(_0x41c062){_0x2361e6['count']=_0x41c062;if(_0x6e4cfe[_0x3fa9('0x33')][_0x3fa9('0x3f')]){_0x1dda83[_0x3fa9('0x40')]=[{'all':!![]}];}return db[_0x3fa9('0x2d')]['findAll'](_0x1dda83);})[_0x3fa9('0x26')](function(_0xbabf4){_0x2361e6[_0x3fa9('0x41')]=_0xbabf4;return _0x2361e6;})[_0x3fa9('0x26')](respondWithFilteredResult(_0xa166e2,_0x1dda83))[_0x3fa9('0x42')](handleError(_0xa166e2,null));};exports[_0x3fa9('0x43')]=function(_0x66cf0e,_0x17ca88){var _0x321df8={'raw':!![],'where':{'id':_0x66cf0e[_0x3fa9('0x44')]['id']}},_0x1dfd8e={};_0x1dfd8e[_0x3fa9('0x32')]=_[_0x3fa9('0x45')](db[_0x3fa9('0x2d')]['rawAttributes']);_0x1dfd8e[_0x3fa9('0x33')]=_[_0x3fa9('0x45')](_0x66cf0e['query']);_0x1dfd8e['filters']=_['intersection'](_0x1dfd8e[_0x3fa9('0x32')],_0x1dfd8e[_0x3fa9('0x33')]);_0x321df8[_0x3fa9('0x35')]=_['intersection'](_0x1dfd8e['model'],qs['fields'](_0x66cf0e[_0x3fa9('0x33')][_0x3fa9('0x37')]));_0x321df8[_0x3fa9('0x35')]=_0x321df8[_0x3fa9('0x35')]['length']?_0x321df8[_0x3fa9('0x35')]:_0x1dfd8e[_0x3fa9('0x32')];if(_0x66cf0e[_0x3fa9('0x33')]['includeAll']){_0x321df8['include']=[{'all':!![]}];}_0x321df8=_['merge']({},_0x321df8,_0x66cf0e[_0x3fa9('0x46')]);return db[_0x3fa9('0x2d')][_0x3fa9('0x47')](_0x321df8)['then'](handleEntityNotFound(_0x17ca88,null))[_0x3fa9('0x26')](respondWithResult(_0x17ca88,null))['catch'](handleError(_0x17ca88,null));};exports[_0x3fa9('0x48')]=function(_0x425070,_0x54c31f){return db[_0x3fa9('0x2d')][_0x3fa9('0x48')](_0x425070[_0x3fa9('0x49')],{})['then'](function(_0x127021){var _0x53cdd7=_0x425070[_0x3fa9('0x4a')][_0x3fa9('0x4b')]({'plain':!![]});if(!_0x53cdd7)throw new Error(_0x3fa9('0x4c'));if(_0x53cdd7[_0x3fa9('0x4d')]===_0x3fa9('0x4a')){var _0xcdca2f=_0x127021[_0x3fa9('0x4b')]({'plain':!![]});var _0x3467a5=_0x3fa9('0x27');return db['UserProfileSection'][_0x3fa9('0x47')]({'where':{'name':_0x3467a5,'userProfileId':_0x53cdd7[_0x3fa9('0x4e')]},'raw':!![]})[_0x3fa9('0x26')](function(_0xc4421d){if(_0xc4421d&&_0xc4421d[_0x3fa9('0x4f')]===0x0){return db[_0x3fa9('0x28')][_0x3fa9('0x48')]({'name':_0xcdca2f[_0x3fa9('0x2b')],'resourceId':_0xcdca2f['id'],'type':_0xc4421d[_0x3fa9('0x2b')],'sectionId':_0xc4421d['id']},{})[_0x3fa9('0x26')](function(){return _0x127021;});}else{return _0x127021;}})[_0x3fa9('0x42')](function(_0x127a66){logger[_0x3fa9('0x2a')](_0x3fa9('0x50'),_0x127a66);throw _0x127a66;});}return _0x127021;})[_0x3fa9('0x26')](respondWithResult(_0x54c31f,0xc9))[_0x3fa9('0x42')](handleError(_0x54c31f,null));};exports[_0x3fa9('0x51')]=function(_0x32cb35,_0x43d46c){if(_0x32cb35[_0x3fa9('0x49')]['id']){delete _0x32cb35[_0x3fa9('0x49')]['id'];}return db[_0x3fa9('0x2d')][_0x3fa9('0x47')]({'where':{'id':_0x32cb35[_0x3fa9('0x44')]['id']}})[_0x3fa9('0x26')](handleEntityNotFound(_0x43d46c,null))[_0x3fa9('0x26')](saveUpdates(_0x32cb35[_0x3fa9('0x49')],null))['then'](respondWithResult(_0x43d46c,null))[_0x3fa9('0x42')](handleError(_0x43d46c,null));};exports[_0x3fa9('0x25')]=function(_0x44068c,_0x40885b){return db[_0x3fa9('0x2d')]['find']({'where':{'id':_0x44068c[_0x3fa9('0x44')]['id']}})[_0x3fa9('0x26')](handleEntityNotFound(_0x40885b,null))[_0x3fa9('0x26')](removeEntity(_0x40885b,null))['catch'](handleError(_0x40885b,null));};exports['describe']=function(_0xf72489,_0xbbf3ba){return db[_0x3fa9('0x2d')][_0x3fa9('0x52')]()[_0x3fa9('0x26')](respondWithResult(_0xbbf3ba,null))[_0x3fa9('0x42')](handleError(_0xbbf3ba,null));};exports[_0x3fa9('0x53')]=function(_0x19c41b,_0x34d3b6,_0x1bf5f8){var _0x3654cd={'raw':!![],'where':{}},_0x2d6103={},_0x3cd466;return db['SmsQueue'][_0x3fa9('0x54')]({'where':{'id':_0x19c41b['params']['id']}})[_0x3fa9('0x26')](handleEntityNotFound(_0x34d3b6,null))[_0x3fa9('0x26')](function(_0x33c1f8){if(_0x33c1f8){_0x3cd466=_0x33c1f8[_0x3fa9('0x4b')]({'plain':!![]});_0x2d6103[_0x3fa9('0x32')]=_[_0x3fa9('0x45')](db[_0x3fa9('0x55')]['rawAttributes']);_0x2d6103['query']=_['keys'](_0x19c41b[_0x3fa9('0x33')]);_0x2d6103[_0x3fa9('0x34')]=_[_0x3fa9('0x36')](_0x2d6103[_0x3fa9('0x32')],_0x2d6103[_0x3fa9('0x33')]);_0x3654cd[_0x3fa9('0x35')]=_['intersection'](_0x2d6103[_0x3fa9('0x32')],qs[_0x3fa9('0x37')](_0x19c41b['query'][_0x3fa9('0x37')]));_0x3654cd[_0x3fa9('0x35')]=_0x3654cd[_0x3fa9('0x35')][_0x3fa9('0x38')]?_0x3654cd[_0x3fa9('0x35')]:_0x2d6103['model'];if(!_0x19c41b[_0x3fa9('0x33')][_0x3fa9('0x39')]('nolimit')){_0x3654cd[_0x3fa9('0x1e')]=qs[_0x3fa9('0x1e')](_0x19c41b['query'][_0x3fa9('0x1e')]);_0x3654cd[_0x3fa9('0x1c')]=qs[_0x3fa9('0x1c')](_0x19c41b[_0x3fa9('0x33')]['offset']);}_0x3654cd['order']=qs[_0x3fa9('0x3a')](_0x19c41b[_0x3fa9('0x33')][_0x3fa9('0x3a')]);_0x3654cd['where']=qs[_0x3fa9('0x34')](_[_0x3fa9('0x56')](_0x19c41b['query'],_0x2d6103['filters']));_0x3654cd['where'][_0x3fa9('0x57')]=_0x33c1f8['id'];if(_0x19c41b['query']['filter']){_0x3654cd['where']=_[_0x3fa9('0x3d')](_0x3654cd[_0x3fa9('0x3b')],{'$or':_[_0x3fa9('0x58')](_0x3654cd[_0x3fa9('0x35')],function(_0x4fe5f0){var _0x4e4cf7={};_0x4e4cf7[_0x4fe5f0]={'$like':'%'+_0x19c41b['query'][_0x3fa9('0x3c')]+'%'};return _0x4e4cf7;})});}_0x3654cd=_[_0x3fa9('0x3d')]({},_0x3654cd,_0x19c41b[_0x3fa9('0x46')]);return db['UserSmsQueue'][_0x3fa9('0x59')](_0x3654cd);}})[_0x3fa9('0x26')](function(_0x21837b){if(_0x21837b){return db[_0x3fa9('0x5a')][_0x3fa9('0x5b')]({'where':{'id':_[_0x3fa9('0x58')](_0x21837b,_0x3fa9('0x5c')),'role':'agent'},'attributes':['id',_0x3fa9('0x2b'),_0x3fa9('0x5d'),_0x3fa9('0x5e'),_0x3fa9('0x5f')]});}})[_0x3fa9('0x26')](function(_0x1b8e91){if(_0x1b8e91){return{'count':_0x1b8e91[_0x3fa9('0x1f')],'rows':_[_0x3fa9('0x58')](_0x1b8e91['rows'],function(_0x199608){return{'membername':_0x199608[_0x3fa9('0x2b')],'UserId':_0x199608['id'],'queue_name':_0x3cd466[_0x3fa9('0x2b')],'SmsQueueId':_0x3cd466['id'],'interface':util[_0x3fa9('0x60')](_0x3fa9('0x61'),_0x3fa9('0x62'),_0x199608[_0x3fa9('0x2b')]),'penalty':0x0,'paused':_0x199608[_0x3fa9('0x5d')],'createdAt':_0x199608[_0x3fa9('0x5f')],'updatedAt':_0x199608['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x34d3b6,_0x3654cd))[_0x3fa9('0x42')](handleError(_0x34d3b6,null));};exports[_0x3fa9('0x63')]=function(_0x455c63,_0x29fc49,_0x5587b7){var _0x552e75={};var _0x3b8471={};var _0x51ec5c;var _0x516c2b;return db[_0x3fa9('0x2d')][_0x3fa9('0x54')]({'where':{'id':_0x455c63[_0x3fa9('0x44')]['id']}})[_0x3fa9('0x26')](handleEntityNotFound(_0x29fc49,null))[_0x3fa9('0x26')](function(_0x212101){if(_0x212101){_0x51ec5c=_0x212101;_0x3b8471[_0x3fa9('0x32')]=_[_0x3fa9('0x45')](db[_0x3fa9('0x64')][_0x3fa9('0x2e')]);_0x3b8471[_0x3fa9('0x33')]=_[_0x3fa9('0x45')](_0x455c63['query']);_0x3b8471[_0x3fa9('0x34')]=_['intersection'](_0x3b8471[_0x3fa9('0x32')],_0x3b8471[_0x3fa9('0x33')]);_0x552e75[_0x3fa9('0x35')]=_[_0x3fa9('0x36')](_0x3b8471[_0x3fa9('0x32')],qs[_0x3fa9('0x37')](_0x455c63[_0x3fa9('0x33')]['fields']));_0x552e75[_0x3fa9('0x35')]=_0x552e75[_0x3fa9('0x35')]['length']?_0x552e75['attributes']:_0x3b8471['model'];_0x552e75[_0x3fa9('0x65')]=qs[_0x3fa9('0x3a')](_0x455c63[_0x3fa9('0x33')]['sort']);_0x552e75[_0x3fa9('0x3b')]=qs['filters'](_[_0x3fa9('0x56')](_0x455c63[_0x3fa9('0x33')],_0x3b8471[_0x3fa9('0x34')]));if(_0x455c63[_0x3fa9('0x33')]['filter']){_0x552e75['where']=_['merge'](_0x552e75[_0x3fa9('0x3b')],{'$or':_[_0x3fa9('0x58')](_0x552e75[_0x3fa9('0x35')],function(_0x5dd8e2){var _0x370ce6={};_0x370ce6[_0x5dd8e2]={'$like':'%'+_0x455c63[_0x3fa9('0x33')]['filter']+'%'};return _0x370ce6;})});}_0x552e75=_[_0x3fa9('0x3d')]({},_0x552e75,_0x455c63[_0x3fa9('0x46')]);return _0x51ec5c[_0x3fa9('0x63')](_0x552e75);}})[_0x3fa9('0x26')](function(_0x2ba476){if(_0x2ba476){_0x516c2b=_0x2ba476[_0x3fa9('0x38')];if(!_0x455c63[_0x3fa9('0x33')][_0x3fa9('0x39')](_0x3fa9('0x66'))){_0x552e75[_0x3fa9('0x1e')]=qs[_0x3fa9('0x1e')](_0x455c63[_0x3fa9('0x33')]['limit']);_0x552e75[_0x3fa9('0x1c')]=qs[_0x3fa9('0x1c')](_0x455c63[_0x3fa9('0x33')][_0x3fa9('0x1c')]);}return _0x51ec5c[_0x3fa9('0x63')](_0x552e75);}})[_0x3fa9('0x26')](function(_0x1b03ac){if(_0x1b03ac){return _0x1b03ac?{'count':_0x516c2b,'rows':_0x1b03ac}:null;}})[_0x3fa9('0x26')](respondWithResult(_0x29fc49,null))[_0x3fa9('0x42')](handleError(_0x29fc49,null));};exports[_0x3fa9('0x67')]=function(_0x59e0f0,_0x215c9e,_0x59ed54){var _0x2a96ca=_0x59e0f0[_0x3fa9('0x49')][_0x3fa9('0x68')];return db[_0x3fa9('0x64')][_0x3fa9('0x59')]({'where':{'id':_0x2a96ca},'attributes':['id'],'include':[{'model':db[_0x3fa9('0x5a')],'as':_0x3fa9('0x69'),'attributes':['id',_0x3fa9('0x2b'),_0x3fa9('0x6a'),'voicePause',_0x3fa9('0x6b')],'raw':!![]}]})[_0x3fa9('0x26')](function(_0x3e3174){if(_0x3e3174){var _0x2d426f=_[_0x3fa9('0x6c')](_0x3e3174,function(_0x365d3f){var _0x46814d=_0x365d3f['get']({'plain':!![]});return _0x46814d[_0x3fa9('0x69')];});return db['SmsQueue'][_0x3fa9('0x47')]({'where':{'id':_0x59e0f0[_0x3fa9('0x44')]['id']}})[_0x3fa9('0x26')](function(_0x4b27a){return db[_0x3fa9('0x6d')][_0x3fa9('0x6e')](function(_0x937891){return _0x4b27a[_0x3fa9('0x67')](_0x2a96ca,{'transaction':_0x937891})[_0x3fa9('0x26')](function(){return BPromise[_0x3fa9('0x6f')](_0x2d426f,function(_0x61046f){return db['UserSmsQueue'][_0x3fa9('0x70')]({'where':{'UserId':_0x61046f['id'],'SmsQueueId':_0x59e0f0[_0x3fa9('0x44')]['id']},'transaction':_0x937891});});})[_0x3fa9('0x26')](function(){_0x2d426f[_0x3fa9('0x71')](function(_0x1e9621){socket['emit']('userSmsQueue:save',{'UserId':_0x1e9621['id'],'SmsQueueId':_0x4b27a['id']});});});});});}})[_0x3fa9('0x26')](respondWithStatusCode(_0x215c9e,null))[_0x3fa9('0x42')](handleError(_0x215c9e,null));};exports[_0x3fa9('0x72')]=function(_0x19c674,_0x1d3bea,_0x5a2a7c){return db['Team'][_0x3fa9('0x59')]({'where':{'id':_0x19c674['query'][_0x3fa9('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3fa9('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1d3bea,null))['then'](function(_0x38a7e0){var _0x491d46=_['map'](_0x38a7e0,'id');var _0x1331a0=[];var _0x446bed=[];var _0x1daf3a=squel['select']();_0x1daf3a[_0x3fa9('0x73')](_0x3fa9('0x74'))[_0x3fa9('0x75')](_0x3fa9('0x76'),'tq')[_0x3fa9('0x77')]('user_has_teams','ut',_0x3fa9('0x78'))[_0x3fa9('0x3b')](_0x3fa9('0x79'),_0x19c674[_0x3fa9('0x44')]['id']);for(var _0x2e4039=0x0;_0x2e4039<_0x38a7e0[_0x3fa9('0x38')];_0x2e4039+=0x1){let _0xfdf14c=_0x38a7e0[_0x2e4039];for(var _0x5ba2a1=0x0;_0x5ba2a1<_0xfdf14c['Agents'][_0x3fa9('0x38')];_0x5ba2a1+=0x1){let _0x58550d=_0xfdf14c[_0x3fa9('0x69')][_0x5ba2a1];var _0x36e4af=_0x1daf3a[_0x3fa9('0x7a')]();_0x36e4af[_0x3fa9('0x3b')](_0x3fa9('0x7b'),_0x58550d['id']);_0x446bed['push'](db[_0x3fa9('0x6d')]['query'](_0x36e4af['toString'](),{'type':db[_0x3fa9('0x6d')][_0x3fa9('0x7c')][_0x3fa9('0x7d')]})[_0x3fa9('0x26')](function(_0x1f6160){if(_0x1f6160[_0x3fa9('0x38')]===0x1){return _0x58550d['id'];}else{var _0x21dff6=_[_0x3fa9('0x7e')](_[_0x3fa9('0x58')](_0x1f6160,_0x3fa9('0x7f')),function(_0x51ae88){return _[_0x3fa9('0x80')](_0x491d46,_0x51ae88);});if(_0x21dff6){return _0x58550d['id'];}}}));}}return BPromise[_0x3fa9('0x81')](_0x446bed)[_0x3fa9('0x26')](function(_0x1a702a){_0x1331a0=_(_0x1331a0)[_0x3fa9('0x82')](_0x1a702a)[_0x3fa9('0x83')]()[_0x3fa9('0x84')]();return db[_0x3fa9('0x2d')]['find']({'where':{'id':_0x19c674[_0x3fa9('0x44')]['id']}})['then'](function(_0x36144f){return db['sequelize'][_0x3fa9('0x6e')](function(_0x2605be){return _0x36144f['removeTeams'](_0x19c674[_0x3fa9('0x33')][_0x3fa9('0x68')],{'transaction':_0x2605be})[_0x3fa9('0x26')](function(){if(!_[_0x3fa9('0x85')](_0x1331a0)){return _0x36144f[_0x3fa9('0x86')](_0x1331a0,{'transaction':_0x2605be});}})[_0x3fa9('0x26')](function(){_0x1331a0[_0x3fa9('0x71')](function(_0x56d5f9){socket['emit']('userSmsQueue:remove',{'UserId':_0x56d5f9,'SmsQueueId':_0x36144f['id']});});});});});});})[_0x3fa9('0x26')](respondWithStatusCode(_0x1d3bea,null))[_0x3fa9('0x42')](handleError(_0x1d3bea,null));};exports[_0x3fa9('0x87')]=function(_0x2cb533,_0x23a96d,_0x166c01){return db[_0x3fa9('0x2d')]['find']({'where':{'id':_0x2cb533[_0x3fa9('0x44')]['id']}})[_0x3fa9('0x26')](handleEntityNotFound(_0x23a96d,null))[_0x3fa9('0x26')](function(_0x399737){if(_0x399737){return _0x399737[_0x3fa9('0x87')](_0x2cb533[_0x3fa9('0x49')][_0x3fa9('0x68')],_['omit'](_0x2cb533[_0x3fa9('0x49')],[_0x3fa9('0x68'),'id'])||{})[_0x3fa9('0x88')](function(_0x46efb5){for(var _0x3bf563=0x0;_0x3bf563<_0x2cb533[_0x3fa9('0x49')][_0x3fa9('0x68')][_0x3fa9('0x38')];_0x3bf563+=0x1){socket[_0x3fa9('0x89')](_0x3fa9('0x8a'),{'UserId':Number(_0x2cb533[_0x3fa9('0x49')][_0x3fa9('0x68')][_0x3bf563]),'SmsQueueId':Number(_0x2cb533[_0x3fa9('0x44')]['id'])});}return _0x46efb5;});}})[_0x3fa9('0x26')](respondWithResult(_0x23a96d,null))[_0x3fa9('0x42')](handleError(_0x23a96d,null));};exports['removeAgents']=function(_0xf4c488,_0x17b07f,_0x4b4126){return db[_0x3fa9('0x2d')][_0x3fa9('0x47')]({'where':{'id':_0xf4c488[_0x3fa9('0x44')]['id']}})[_0x3fa9('0x26')](handleEntityNotFound(_0x17b07f,null))[_0x3fa9('0x26')](function(_0x10f842){if(_0x10f842){return _0x10f842['removeAgents'](_0xf4c488[_0x3fa9('0x33')]['ids'])['then'](function(){if(_[_0x3fa9('0x8b')](_0xf4c488[_0x3fa9('0x33')][_0x3fa9('0x68')])){for(var _0xdfc1ff=0x0;_0xdfc1ff<_0xf4c488[_0x3fa9('0x33')][_0x3fa9('0x68')][_0x3fa9('0x38')];_0xdfc1ff+=0x1){socket[_0x3fa9('0x89')](_0x3fa9('0x8c'),{'UserId':Number(_0xf4c488['query'][_0x3fa9('0x68')][_0xdfc1ff]),'SmsQueueId':Number(_0xf4c488[_0x3fa9('0x44')]['id'])});}}else{socket[_0x3fa9('0x89')]('userSmsQueue:remove',{'UserId':Number(_0xf4c488[_0x3fa9('0x33')][_0x3fa9('0x68')]),'SmsQueueId':Number(_0xf4c488[_0x3fa9('0x44')]['id'])});}});}})[_0x3fa9('0x26')](respondWithStatusCode(_0x17b07f,null))[_0x3fa9('0x42')](handleError(_0x17b07f,null));};exports['getAgents']=function(_0x212580,_0x1f0672,_0x3a0b41){var _0x3148cb={};var _0x344225={};var _0x5b7cac;var _0x39c9b6;return db['SmsQueue'][_0x3fa9('0x54')]({'where':{'id':_0x212580[_0x3fa9('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f0672,null))[_0x3fa9('0x26')](function(_0x1c9d8c){if(_0x1c9d8c){_0x5b7cac=_0x1c9d8c;_0x344225[_0x3fa9('0x32')]=_[_0x3fa9('0x45')](db['User'][_0x3fa9('0x2e')]);_0x344225[_0x3fa9('0x33')]=_[_0x3fa9('0x45')](_0x212580[_0x3fa9('0x33')]);_0x344225[_0x3fa9('0x34')]=_['intersection'](_0x344225[_0x3fa9('0x32')],_0x344225[_0x3fa9('0x33')]);_0x3148cb[_0x3fa9('0x35')]=_['intersection'](_0x344225[_0x3fa9('0x32')],qs[_0x3fa9('0x37')](_0x212580[_0x3fa9('0x33')][_0x3fa9('0x37')]));_0x3148cb[_0x3fa9('0x35')]=_0x3148cb[_0x3fa9('0x35')]['length']?_0x3148cb[_0x3fa9('0x35')]:_0x344225[_0x3fa9('0x32')];_0x3148cb[_0x3fa9('0x65')]=qs[_0x3fa9('0x3a')](_0x212580[_0x3fa9('0x33')][_0x3fa9('0x3a')]);_0x3148cb[_0x3fa9('0x3b')]=qs['filters'](_[_0x3fa9('0x56')](_0x212580[_0x3fa9('0x33')],_0x344225[_0x3fa9('0x34')]));if(_0x212580[_0x3fa9('0x33')][_0x3fa9('0x3c')]){_0x3148cb[_0x3fa9('0x3b')]=_[_0x3fa9('0x3d')](_0x3148cb[_0x3fa9('0x3b')],{'$or':_['map'](_0x3148cb['attributes'],function(_0xfcb13e){var _0x964b90={};_0x964b90[_0xfcb13e]={'$like':'%'+_0x212580[_0x3fa9('0x33')][_0x3fa9('0x3c')]+'%'};return _0x964b90;})});}_0x3148cb=_[_0x3fa9('0x3d')]({},_0x3148cb,_0x212580[_0x3fa9('0x46')]);return _0x5b7cac[_0x3fa9('0x8d')](_0x3148cb);}})[_0x3fa9('0x26')](function(_0x5e3a0c){if(_0x5e3a0c){_0x39c9b6=_0x5e3a0c['length'];if(!_0x212580['query'][_0x3fa9('0x39')]('nolimit')){_0x3148cb[_0x3fa9('0x1e')]=qs['limit'](_0x212580[_0x3fa9('0x33')]['limit']);_0x3148cb[_0x3fa9('0x1c')]=qs[_0x3fa9('0x1c')](_0x212580['query'][_0x3fa9('0x1c')]);}return _0x5b7cac['getAgents'](_0x3148cb);}})[_0x3fa9('0x26')](function(_0x321bad){if(_0x321bad){return _0x321bad?{'count':_0x39c9b6,'rows':_0x321bad}:null;}})['then'](respondWithResult(_0x1f0672,null))[_0x3fa9('0x42')](handleError(_0x1f0672,null));}; \ No newline at end of file +var _0x61f1=['rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','SmsQueue','includeAll','include','findAll','rows','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','error','catch','params','describe','UserSmsQueue','SmsQueueId','findAndCountAll','UserId','smsPause','updatedAt','createdAt','SIP','Team','getTeams','addTeams','User','Agents','online','voicePause','flatMap','findOrCreate','forEach','userSmsQueue:save','removeTeams','select','field','join','user_has_teams','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','union','value','ids','removeAgents','userSmsQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','findOne','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','register','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','end','sendStatus','name'];(function(_0x11c9ab,_0x13caac){var _0x16bff0=function(_0x17b881){while(--_0x17b881){_0x11c9ab['push'](_0x11c9ab['shift']());}};_0x16bff0(++_0x13caac);}(_0x61f1,0xde));var _0x161f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x61f1[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x161f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x161f('0x1'));var rp=require(_0x161f('0x2'));var moment=require(_0x161f('0x3'));var BPromise=require(_0x161f('0x4'));var Mustache=require(_0x161f('0x5'));var util=require(_0x161f('0x6'));var path=require(_0x161f('0x7'));var sox=require(_0x161f('0x8'));var csv=require(_0x161f('0x9'));var ejs=require(_0x161f('0xa'));var fs=require('fs');var fs_extra=require(_0x161f('0xb'));var _=require('lodash');var squel=require(_0x161f('0xc'));var crypto=require(_0x161f('0xd'));var jsforce=require(_0x161f('0xe'));var deskjs=require(_0x161f('0xf'));var toCsv=require(_0x161f('0x9'));var querystring=require(_0x161f('0x10'));var Papa=require(_0x161f('0x11'));var Redis=require(_0x161f('0x12'));var authService=require(_0x161f('0x13'));var qs=require(_0x161f('0x14'));var as=require(_0x161f('0x15'));var hardwareService=require(_0x161f('0x16'));var logger=require(_0x161f('0x17'))(_0x161f('0x18'));var utils=require(_0x161f('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x161f('0x1a'));var db=require(_0x161f('0x1b'))['db'];config[_0x161f('0x1c')]=_[_0x161f('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x161f('0x1e'))(new Redis(config[_0x161f('0x1c')]));require(_0x161f('0x1f'))[_0x161f('0x20')](socket);function respondWithStatusCode(_0x110513,_0x12b78b){_0x12b78b=_0x12b78b||0xcc;return function(_0x5a899d){if(_0x5a899d){return _0x110513['sendStatus'](_0x12b78b);}return _0x110513[_0x161f('0x21')](_0x12b78b)['end']();};}function respondWithResult(_0x39dcf3,_0x115995){_0x115995=_0x115995||0xc8;return function(_0x5b5cae){if(_0x5b5cae){return _0x39dcf3[_0x161f('0x21')](_0x115995)['json'](_0x5b5cae);}};}function respondWithFilteredResult(_0x34fc2a,_0x35ffce){return function(_0x105eb8){if(_0x105eb8){var _0x2161e8=typeof _0x35ffce[_0x161f('0x22')]===_0x161f('0x23')&&typeof _0x35ffce['limit']===_0x161f('0x23');var _0x2f5dd2=_0x105eb8[_0x161f('0x24')];var _0xe48633=_0x2161e8?0x0:_0x35ffce[_0x161f('0x22')];var _0x3ea435=_0x2161e8?_0x105eb8[_0x161f('0x24')]:_0x35ffce['offset']+_0x35ffce[_0x161f('0x25')];var _0x2e3280;if(_0x3ea435>=_0x2f5dd2){_0x3ea435=_0x2f5dd2;_0x2e3280=0xc8;}else{_0x2e3280=0xce;}_0x34fc2a[_0x161f('0x21')](_0x2e3280);return _0x34fc2a[_0x161f('0x26')](_0x161f('0x27'),_0xe48633+'-'+_0x3ea435+'/'+_0x2f5dd2)[_0x161f('0x28')](_0x105eb8);}return null;};}function patchUpdates(_0x314423){return function(_0x4d9e49){try{jsonpatch['apply'](_0x4d9e49,_0x314423,!![]);}catch(_0x306ea4){return BPromise[_0x161f('0x29')](_0x306ea4);}return _0x4d9e49[_0x161f('0x2a')]();};}function saveUpdates(_0x27236a,_0x4ab4f8){return function(_0x93cd8e){if(_0x93cd8e){return _0x93cd8e[_0x161f('0x2b')](_0x27236a)[_0x161f('0x2c')](function(_0xfb2ffb){return _0xfb2ffb;});}return null;};}function removeEntity(_0x40f67,_0x45663a){return function(_0x4672d5){if(_0x4672d5){return _0x4672d5[_0x161f('0x2d')]()[_0x161f('0x2c')](function(){var _0x17f212=_0x4672d5[_0x161f('0x2e')]({'plain':!![]});var _0x11f841=_0x161f('0x2f');return db[_0x161f('0x30')]['destroy']({'where':{'type':_0x11f841,'resourceId':_0x17f212['id']}})[_0x161f('0x2c')](function(){return _0x4672d5;});})[_0x161f('0x2c')](function(){_0x40f67[_0x161f('0x21')](0xcc)[_0x161f('0x31')]();});}};}function handleEntityNotFound(_0x42ef43,_0x5e255b){return function(_0x10f4ff){if(!_0x10f4ff){_0x42ef43[_0x161f('0x32')](0x194);}return _0x10f4ff;};}function handleError(_0x236c32,_0x48ad4c){_0x48ad4c=_0x48ad4c||0x1f4;return function(_0x266882){logger['error'](_0x266882['stack']);if(_0x266882[_0x161f('0x33')]){delete _0x266882[_0x161f('0x33')];}_0x236c32['status'](_0x48ad4c)['send'](_0x266882);};}exports['index']=function(_0x5625f3,_0x53ab2e){var _0xd81b5d={},_0x346e68={},_0x94e146={'count':0x0,'rows':[]};var _0x1c9f78=_['map'](db['SmsQueue'][_0x161f('0x34')],function(_0x47df9c){return{'name':_0x47df9c['fieldName'],'type':_0x47df9c['type'][_0x161f('0x35')]};});_0x346e68[_0x161f('0x36')]=_[_0x161f('0x37')](_0x1c9f78,_0x161f('0x33'));_0x346e68[_0x161f('0x38')]=_[_0x161f('0x39')](_0x5625f3[_0x161f('0x38')]);_0x346e68['filters']=_[_0x161f('0x3a')](_0x346e68['model'],_0x346e68['query']);_0xd81b5d[_0x161f('0x3b')]=_[_0x161f('0x3a')](_0x346e68[_0x161f('0x36')],qs[_0x161f('0x3c')](_0x5625f3['query']['fields']));_0xd81b5d[_0x161f('0x3b')]=_0xd81b5d[_0x161f('0x3b')][_0x161f('0x3d')]?_0xd81b5d[_0x161f('0x3b')]:_0x346e68[_0x161f('0x36')];if(!_0x5625f3[_0x161f('0x38')][_0x161f('0x3e')](_0x161f('0x3f'))){_0xd81b5d[_0x161f('0x25')]=qs[_0x161f('0x25')](_0x5625f3[_0x161f('0x38')][_0x161f('0x25')]);_0xd81b5d[_0x161f('0x22')]=qs[_0x161f('0x22')](_0x5625f3[_0x161f('0x38')]['offset']);}_0xd81b5d[_0x161f('0x40')]=qs[_0x161f('0x41')](_0x5625f3[_0x161f('0x38')][_0x161f('0x41')]);_0xd81b5d['where']=qs[_0x161f('0x42')](_[_0x161f('0x43')](_0x5625f3[_0x161f('0x38')],_0x346e68[_0x161f('0x42')]),_0x1c9f78);if(_0x5625f3[_0x161f('0x38')][_0x161f('0x44')]){_0xd81b5d[_0x161f('0x45')]=_[_0x161f('0x46')](_0xd81b5d[_0x161f('0x45')],{'$or':_[_0x161f('0x37')](_0x1c9f78,function(_0x58113f){if(_0x58113f[_0x161f('0x47')]!==_0x161f('0x48')){var _0x2bfa13={};_0x2bfa13[_0x58113f['name']]={'$like':'%'+_0x5625f3[_0x161f('0x38')][_0x161f('0x44')]+'%'};return _0x2bfa13;}})});}_0xd81b5d=_['merge']({},_0xd81b5d,_0x5625f3[_0x161f('0x49')]);var _0x515153={'where':_0xd81b5d[_0x161f('0x45')]};return db[_0x161f('0x4a')][_0x161f('0x24')](_0x515153)[_0x161f('0x2c')](function(_0x127619){_0x94e146[_0x161f('0x24')]=_0x127619;if(_0x5625f3['query'][_0x161f('0x4b')]){_0xd81b5d[_0x161f('0x4c')]=[{'all':!![]}];}return db[_0x161f('0x4a')][_0x161f('0x4d')](_0xd81b5d);})['then'](function(_0x76880){_0x94e146[_0x161f('0x4e')]=_0x76880;return _0x94e146;})['then'](respondWithFilteredResult(_0x53ab2e,_0xd81b5d))['catch'](handleError(_0x53ab2e,null));};exports[_0x161f('0x4f')]=function(_0x29df5c,_0x3c0bc3){var _0x38c660={'raw':!![],'where':{'id':_0x29df5c['params']['id']}},_0x1f2e20={};_0x1f2e20['model']=_[_0x161f('0x39')](db[_0x161f('0x4a')][_0x161f('0x34')]);_0x1f2e20['query']=_[_0x161f('0x39')](_0x29df5c[_0x161f('0x38')]);_0x1f2e20['filters']=_['intersection'](_0x1f2e20[_0x161f('0x36')],_0x1f2e20[_0x161f('0x38')]);_0x38c660[_0x161f('0x3b')]=_[_0x161f('0x3a')](_0x1f2e20['model'],qs['fields'](_0x29df5c[_0x161f('0x38')]['fields']));_0x38c660['attributes']=_0x38c660[_0x161f('0x3b')]['length']?_0x38c660[_0x161f('0x3b')]:_0x1f2e20['model'];if(_0x29df5c[_0x161f('0x38')][_0x161f('0x4b')]){_0x38c660[_0x161f('0x4c')]=[{'all':!![]}];}_0x38c660=_[_0x161f('0x46')]({},_0x38c660,_0x29df5c[_0x161f('0x49')]);return db[_0x161f('0x4a')]['find'](_0x38c660)['then'](handleEntityNotFound(_0x3c0bc3,null))['then'](respondWithResult(_0x3c0bc3,null))['catch'](handleError(_0x3c0bc3,null));};exports[_0x161f('0x50')]=function(_0x36e559,_0x463206){return db['SmsQueue']['create'](_0x36e559[_0x161f('0x51')],{})['then'](function(_0x4a9faf){var _0x148369=_0x36e559[_0x161f('0x52')][_0x161f('0x2e')]({'plain':!![]});if(!_0x148369)throw new Error(_0x161f('0x53'));if(_0x148369[_0x161f('0x54')]===_0x161f('0x52')){var _0x5ecd36=_0x4a9faf[_0x161f('0x2e')]({'plain':!![]});var _0x428415='SmsQueues';return db[_0x161f('0x55')][_0x161f('0x56')]({'where':{'name':_0x428415,'userProfileId':_0x148369[_0x161f('0x57')]},'raw':!![]})[_0x161f('0x2c')](function(_0x398221){if(_0x398221&&_0x398221['autoAssociation']===0x0){return db[_0x161f('0x30')][_0x161f('0x50')]({'name':_0x5ecd36[_0x161f('0x33')],'resourceId':_0x5ecd36['id'],'type':_0x398221[_0x161f('0x33')],'sectionId':_0x398221['id']},{})[_0x161f('0x2c')](function(){return _0x4a9faf;});}else{return _0x4a9faf;}})['catch'](function(_0x5be0c7){logger[_0x161f('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5be0c7);throw _0x5be0c7;});}return _0x4a9faf;})[_0x161f('0x2c')](respondWithResult(_0x463206,0xc9))[_0x161f('0x59')](handleError(_0x463206,null));};exports['update']=function(_0x444c6d,_0x272a5d){if(_0x444c6d[_0x161f('0x51')]['id']){delete _0x444c6d[_0x161f('0x51')]['id'];}return db[_0x161f('0x4a')][_0x161f('0x56')]({'where':{'id':_0x444c6d[_0x161f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x272a5d,null))['then'](saveUpdates(_0x444c6d['body'],null))[_0x161f('0x2c')](respondWithResult(_0x272a5d,null))[_0x161f('0x59')](handleError(_0x272a5d,null));};exports['destroy']=function(_0x4336f5,_0x294596){return db[_0x161f('0x4a')]['find']({'where':{'id':_0x4336f5['params']['id']}})[_0x161f('0x2c')](handleEntityNotFound(_0x294596,null))[_0x161f('0x2c')](removeEntity(_0x294596,null))[_0x161f('0x59')](handleError(_0x294596,null));};exports[_0x161f('0x5b')]=function(_0x86513c,_0x138425){return db[_0x161f('0x4a')][_0x161f('0x5b')]()[_0x161f('0x2c')](respondWithResult(_0x138425,null))['catch'](handleError(_0x138425,null));};exports['getMembers']=function(_0x124726,_0x54e011,_0x15f992){var _0x2f5063={'raw':!![],'where':{}},_0x19df49={},_0x3ea9e6;return db[_0x161f('0x4a')]['findOne']({'where':{'id':_0x124726[_0x161f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x54e011,null))['then'](function(_0x447247){if(_0x447247){_0x3ea9e6=_0x447247[_0x161f('0x2e')]({'plain':!![]});_0x19df49['model']=_[_0x161f('0x39')](db[_0x161f('0x5c')][_0x161f('0x34')]);_0x19df49[_0x161f('0x38')]=_['keys'](_0x124726[_0x161f('0x38')]);_0x19df49[_0x161f('0x42')]=_[_0x161f('0x3a')](_0x19df49[_0x161f('0x36')],_0x19df49[_0x161f('0x38')]);_0x2f5063[_0x161f('0x3b')]=_['intersection'](_0x19df49['model'],qs[_0x161f('0x3c')](_0x124726[_0x161f('0x38')]['fields']));_0x2f5063[_0x161f('0x3b')]=_0x2f5063[_0x161f('0x3b')][_0x161f('0x3d')]?_0x2f5063[_0x161f('0x3b')]:_0x19df49[_0x161f('0x36')];if(!_0x124726[_0x161f('0x38')][_0x161f('0x3e')](_0x161f('0x3f'))){_0x2f5063[_0x161f('0x25')]=qs[_0x161f('0x25')](_0x124726[_0x161f('0x38')]['limit']);_0x2f5063[_0x161f('0x22')]=qs['offset'](_0x124726[_0x161f('0x38')][_0x161f('0x22')]);}_0x2f5063[_0x161f('0x40')]=qs['sort'](_0x124726[_0x161f('0x38')]['sort']);_0x2f5063[_0x161f('0x45')]=qs[_0x161f('0x42')](_[_0x161f('0x43')](_0x124726['query'],_0x19df49[_0x161f('0x42')]));_0x2f5063[_0x161f('0x45')][_0x161f('0x5d')]=_0x447247['id'];if(_0x124726[_0x161f('0x38')][_0x161f('0x44')]){_0x2f5063[_0x161f('0x45')]=_[_0x161f('0x46')](_0x2f5063['where'],{'$or':_[_0x161f('0x37')](_0x2f5063[_0x161f('0x3b')],function(_0x36e30d){var _0x19de87={};_0x19de87[_0x36e30d]={'$like':'%'+_0x124726[_0x161f('0x38')][_0x161f('0x44')]+'%'};return _0x19de87;})});}_0x2f5063=_[_0x161f('0x46')]({},_0x2f5063,_0x124726['options']);return db['UserSmsQueue'][_0x161f('0x4d')](_0x2f5063);}})['then'](function(_0x4ab3d6){if(_0x4ab3d6){return db['User'][_0x161f('0x5e')]({'where':{'id':_['map'](_0x4ab3d6,_0x161f('0x5f')),'role':'agent'},'attributes':['id','name',_0x161f('0x60'),_0x161f('0x61'),_0x161f('0x62')]});}})[_0x161f('0x2c')](function(_0x100c01){if(_0x100c01){return{'count':_0x100c01[_0x161f('0x24')],'rows':_[_0x161f('0x37')](_0x100c01[_0x161f('0x4e')],function(_0x43e5fd){return{'membername':_0x43e5fd[_0x161f('0x33')],'UserId':_0x43e5fd['id'],'queue_name':_0x3ea9e6[_0x161f('0x33')],'SmsQueueId':_0x3ea9e6['id'],'interface':util['format']('%s/%s',_0x161f('0x63'),_0x43e5fd[_0x161f('0x33')]),'penalty':0x0,'paused':_0x43e5fd[_0x161f('0x60')],'createdAt':_0x43e5fd['createdAt'],'updatedAt':_0x43e5fd['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x161f('0x2c')](respondWithFilteredResult(_0x54e011,_0x2f5063))[_0x161f('0x59')](handleError(_0x54e011,null));};exports['getTeams']=function(_0x1e76dc,_0x268228,_0x23bde3){var _0x5e7abc={};var _0x116ead={};var _0x45d3fe;var _0x4cad83;return db[_0x161f('0x4a')]['findOne']({'where':{'id':_0x1e76dc[_0x161f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x268228,null))['then'](function(_0x3fec96){if(_0x3fec96){_0x45d3fe=_0x3fec96;_0x116ead[_0x161f('0x36')]=_[_0x161f('0x39')](db[_0x161f('0x64')]['rawAttributes']);_0x116ead[_0x161f('0x38')]=_['keys'](_0x1e76dc[_0x161f('0x38')]);_0x116ead[_0x161f('0x42')]=_[_0x161f('0x3a')](_0x116ead[_0x161f('0x36')],_0x116ead[_0x161f('0x38')]);_0x5e7abc[_0x161f('0x3b')]=_[_0x161f('0x3a')](_0x116ead[_0x161f('0x36')],qs[_0x161f('0x3c')](_0x1e76dc[_0x161f('0x38')][_0x161f('0x3c')]));_0x5e7abc[_0x161f('0x3b')]=_0x5e7abc[_0x161f('0x3b')][_0x161f('0x3d')]?_0x5e7abc[_0x161f('0x3b')]:_0x116ead[_0x161f('0x36')];_0x5e7abc[_0x161f('0x40')]=qs['sort'](_0x1e76dc[_0x161f('0x38')][_0x161f('0x41')]);_0x5e7abc[_0x161f('0x45')]=qs['filters'](_[_0x161f('0x43')](_0x1e76dc['query'],_0x116ead[_0x161f('0x42')]));if(_0x1e76dc[_0x161f('0x38')][_0x161f('0x44')]){_0x5e7abc[_0x161f('0x45')]=_[_0x161f('0x46')](_0x5e7abc[_0x161f('0x45')],{'$or':_[_0x161f('0x37')](_0x5e7abc[_0x161f('0x3b')],function(_0x7908e7){var _0x5d0eff={};_0x5d0eff[_0x7908e7]={'$like':'%'+_0x1e76dc['query']['filter']+'%'};return _0x5d0eff;})});}_0x5e7abc=_[_0x161f('0x46')]({},_0x5e7abc,_0x1e76dc[_0x161f('0x49')]);return _0x45d3fe[_0x161f('0x65')](_0x5e7abc);}})[_0x161f('0x2c')](function(_0xc66979){if(_0xc66979){_0x4cad83=_0xc66979['length'];if(!_0x1e76dc['query'][_0x161f('0x3e')](_0x161f('0x3f'))){_0x5e7abc[_0x161f('0x25')]=qs[_0x161f('0x25')](_0x1e76dc[_0x161f('0x38')]['limit']);_0x5e7abc[_0x161f('0x22')]=qs['offset'](_0x1e76dc[_0x161f('0x38')][_0x161f('0x22')]);}return _0x45d3fe['getTeams'](_0x5e7abc);}})[_0x161f('0x2c')](function(_0x582701){if(_0x582701){return _0x582701?{'count':_0x4cad83,'rows':_0x582701}:null;}})[_0x161f('0x2c')](respondWithResult(_0x268228,null))[_0x161f('0x59')](handleError(_0x268228,null));};exports[_0x161f('0x66')]=function(_0x5d9691,_0x1eb815,_0x524967){var _0x248f6d=_0x5d9691['body']['ids'];return db[_0x161f('0x64')]['findAll']({'where':{'id':_0x248f6d},'attributes':['id'],'include':[{'model':db[_0x161f('0x67')],'as':_0x161f('0x68'),'attributes':['id','name',_0x161f('0x69'),_0x161f('0x6a'),'interface'],'raw':!![]}]})[_0x161f('0x2c')](function(_0xa717be){if(_0xa717be){var _0xeecff4=_[_0x161f('0x6b')](_0xa717be,function(_0x372e77){var _0x29b75f=_0x372e77[_0x161f('0x2e')]({'plain':!![]});return _0x29b75f[_0x161f('0x68')];});return db[_0x161f('0x4a')][_0x161f('0x56')]({'where':{'id':_0x5d9691['params']['id']}})[_0x161f('0x2c')](function(_0x1a75e9){return db['sequelize']['transaction'](function(_0x4280fa){return _0x1a75e9[_0x161f('0x66')](_0x248f6d,{'transaction':_0x4280fa})[_0x161f('0x2c')](function(){return BPromise['each'](_0xeecff4,function(_0x271902){return db[_0x161f('0x5c')][_0x161f('0x6c')]({'where':{'UserId':_0x271902['id'],'SmsQueueId':_0x5d9691[_0x161f('0x5a')]['id']},'transaction':_0x4280fa});});})[_0x161f('0x2c')](function(){_0xeecff4[_0x161f('0x6d')](function(_0x384439){socket['emit'](_0x161f('0x6e'),{'UserId':_0x384439['id'],'SmsQueueId':_0x1a75e9['id']});});});});});}})[_0x161f('0x2c')](respondWithStatusCode(_0x1eb815,null))[_0x161f('0x59')](handleError(_0x1eb815,null));};exports[_0x161f('0x6f')]=function(_0x53272f,_0x9d824f,_0x76667e){return db[_0x161f('0x64')][_0x161f('0x4d')]({'where':{'id':_0x53272f[_0x161f('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x161f('0x67')],'as':_0x161f('0x68'),'attributes':['id'],'raw':!![]}]})[_0x161f('0x2c')](handleEntityNotFound(_0x9d824f,null))[_0x161f('0x2c')](function(_0x4c2455){var _0x4a62c1=_[_0x161f('0x37')](_0x4c2455,'id');var _0x26d106=[];var _0xa8e93b=[];var _0x2dc4c9=squel[_0x161f('0x70')]();_0x2dc4c9[_0x161f('0x71')]('tq.TeamId')['from']('team_has_sms_queues','tq')[_0x161f('0x72')](_0x161f('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x161f('0x74'),_0x53272f[_0x161f('0x5a')]['id']);for(var _0x491411=0x0;_0x491411<_0x4c2455[_0x161f('0x3d')];_0x491411+=0x1){let _0x2b47b5=_0x4c2455[_0x491411];for(var _0x2d9f96=0x0;_0x2d9f96<_0x2b47b5['Agents'][_0x161f('0x3d')];_0x2d9f96+=0x1){let _0x69ce17=_0x2b47b5[_0x161f('0x68')][_0x2d9f96];var _0x51124e=_0x2dc4c9['clone']();_0x51124e['where'](_0x161f('0x75'),_0x69ce17['id']);_0xa8e93b[_0x161f('0x76')](db[_0x161f('0x77')][_0x161f('0x38')](_0x51124e[_0x161f('0x78')](),{'type':db['sequelize']['QueryTypes'][_0x161f('0x79')]})[_0x161f('0x2c')](function(_0x3f6312){if(_0x3f6312[_0x161f('0x3d')]===0x1){return _0x69ce17['id'];}else{var _0x2b9e01=_[_0x161f('0x7a')](_['map'](_0x3f6312,_0x161f('0x7b')),function(_0x540b02){return _[_0x161f('0x7c')](_0x4a62c1,_0x540b02);});if(_0x2b9e01){return _0x69ce17['id'];}}}));}}return BPromise['all'](_0xa8e93b)[_0x161f('0x2c')](function(_0x4c7464){_0x26d106=_(_0x26d106)[_0x161f('0x7d')](_0x4c7464)['compact']()[_0x161f('0x7e')]();return db[_0x161f('0x4a')][_0x161f('0x56')]({'where':{'id':_0x53272f[_0x161f('0x5a')]['id']}})['then'](function(_0x4a14cf){return db[_0x161f('0x77')]['transaction'](function(_0xd669a9){return _0x4a14cf[_0x161f('0x6f')](_0x53272f[_0x161f('0x38')][_0x161f('0x7f')],{'transaction':_0xd669a9})[_0x161f('0x2c')](function(){if(!_['isEmpty'](_0x26d106)){return _0x4a14cf[_0x161f('0x80')](_0x26d106,{'transaction':_0xd669a9});}})[_0x161f('0x2c')](function(){_0x26d106[_0x161f('0x6d')](function(_0x13f316){socket['emit'](_0x161f('0x81'),{'UserId':_0x13f316,'SmsQueueId':_0x4a14cf['id']});});});});});});})[_0x161f('0x2c')](respondWithStatusCode(_0x9d824f,null))[_0x161f('0x59')](handleError(_0x9d824f,null));};exports['addAgents']=function(_0x1bedea,_0x373423,_0x10d3d6){return db[_0x161f('0x4a')][_0x161f('0x56')]({'where':{'id':_0x1bedea[_0x161f('0x5a')]['id']}})[_0x161f('0x2c')](handleEntityNotFound(_0x373423,null))[_0x161f('0x2c')](function(_0x18cc1b){if(_0x18cc1b){return _0x18cc1b[_0x161f('0x82')](_0x1bedea[_0x161f('0x51')][_0x161f('0x7f')],_[_0x161f('0x83')](_0x1bedea[_0x161f('0x51')],[_0x161f('0x7f'),'id'])||{})[_0x161f('0x84')](function(_0x203835){for(var _0x25bffc=0x0;_0x25bffc<_0x1bedea[_0x161f('0x51')][_0x161f('0x7f')][_0x161f('0x3d')];_0x25bffc+=0x1){socket[_0x161f('0x85')](_0x161f('0x6e'),{'UserId':Number(_0x1bedea[_0x161f('0x51')][_0x161f('0x7f')][_0x25bffc]),'SmsQueueId':Number(_0x1bedea['params']['id'])});}return _0x203835;});}})[_0x161f('0x2c')](respondWithResult(_0x373423,null))[_0x161f('0x59')](handleError(_0x373423,null));};exports[_0x161f('0x80')]=function(_0x8c278e,_0x3f1b67,_0x59a273){return db[_0x161f('0x4a')][_0x161f('0x56')]({'where':{'id':_0x8c278e[_0x161f('0x5a')]['id']}})[_0x161f('0x2c')](handleEntityNotFound(_0x3f1b67,null))[_0x161f('0x2c')](function(_0xa34eee){if(_0xa34eee){return _0xa34eee[_0x161f('0x80')](_0x8c278e[_0x161f('0x38')][_0x161f('0x7f')])['then'](function(){if(_[_0x161f('0x86')](_0x8c278e[_0x161f('0x38')]['ids'])){for(var _0x120ab1=0x0;_0x120ab1<_0x8c278e[_0x161f('0x38')][_0x161f('0x7f')]['length'];_0x120ab1+=0x1){socket[_0x161f('0x85')](_0x161f('0x81'),{'UserId':Number(_0x8c278e['query'][_0x161f('0x7f')][_0x120ab1]),'SmsQueueId':Number(_0x8c278e[_0x161f('0x5a')]['id'])});}}else{socket[_0x161f('0x85')](_0x161f('0x81'),{'UserId':Number(_0x8c278e[_0x161f('0x38')]['ids']),'SmsQueueId':Number(_0x8c278e[_0x161f('0x5a')]['id'])});}});}})[_0x161f('0x2c')](respondWithStatusCode(_0x3f1b67,null))[_0x161f('0x59')](handleError(_0x3f1b67,null));};exports[_0x161f('0x87')]=function(_0xbf9dc1,_0x9162e0,_0xd8782d){var _0x2cf24f={};var _0x2f16b4={};var _0x3ef484;var _0x93ba9e;return db[_0x161f('0x4a')][_0x161f('0x88')]({'where':{'id':_0xbf9dc1[_0x161f('0x5a')]['id']}})[_0x161f('0x2c')](handleEntityNotFound(_0x9162e0,null))['then'](function(_0x306ed8){if(_0x306ed8){_0x3ef484=_0x306ed8;_0x2f16b4['model']=_[_0x161f('0x39')](db[_0x161f('0x67')][_0x161f('0x34')]);_0x2f16b4[_0x161f('0x38')]=_[_0x161f('0x39')](_0xbf9dc1[_0x161f('0x38')]);_0x2f16b4[_0x161f('0x42')]=_['intersection'](_0x2f16b4[_0x161f('0x36')],_0x2f16b4[_0x161f('0x38')]);_0x2cf24f[_0x161f('0x3b')]=_[_0x161f('0x3a')](_0x2f16b4[_0x161f('0x36')],qs[_0x161f('0x3c')](_0xbf9dc1[_0x161f('0x38')]['fields']));_0x2cf24f['attributes']=_0x2cf24f[_0x161f('0x3b')][_0x161f('0x3d')]?_0x2cf24f[_0x161f('0x3b')]:_0x2f16b4[_0x161f('0x36')];_0x2cf24f[_0x161f('0x40')]=qs[_0x161f('0x41')](_0xbf9dc1[_0x161f('0x38')][_0x161f('0x41')]);_0x2cf24f['where']=qs[_0x161f('0x42')](_[_0x161f('0x43')](_0xbf9dc1['query'],_0x2f16b4[_0x161f('0x42')]));if(_0xbf9dc1[_0x161f('0x38')][_0x161f('0x44')]){_0x2cf24f[_0x161f('0x45')]=_['merge'](_0x2cf24f[_0x161f('0x45')],{'$or':_[_0x161f('0x37')](_0x2cf24f['attributes'],function(_0x3841c3){var _0x4ae443={};_0x4ae443[_0x3841c3]={'$like':'%'+_0xbf9dc1[_0x161f('0x38')][_0x161f('0x44')]+'%'};return _0x4ae443;})});}_0x2cf24f=_[_0x161f('0x46')]({},_0x2cf24f,_0xbf9dc1[_0x161f('0x49')]);return _0x3ef484[_0x161f('0x87')](_0x2cf24f);}})[_0x161f('0x2c')](function(_0x1da6b0){if(_0x1da6b0){_0x93ba9e=_0x1da6b0[_0x161f('0x3d')];if(!_0xbf9dc1[_0x161f('0x38')][_0x161f('0x3e')](_0x161f('0x3f'))){_0x2cf24f['limit']=qs[_0x161f('0x25')](_0xbf9dc1['query'][_0x161f('0x25')]);_0x2cf24f[_0x161f('0x22')]=qs[_0x161f('0x22')](_0xbf9dc1[_0x161f('0x38')][_0x161f('0x22')]);}return _0x3ef484[_0x161f('0x87')](_0x2cf24f);}})[_0x161f('0x2c')](function(_0x8903dd){if(_0x8903dd){return _0x8903dd?{'count':_0x93ba9e,'rows':_0x8903dd}:null;}})[_0x161f('0x2c')](respondWithResult(_0x9162e0,null))[_0x161f('0x59')](handleError(_0x9162e0,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 22aa1f2..fff58e6 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 _0x3fdb=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb','SmsQueue'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0x3fdb,0xc3));var _0xb3fd=function(_0x41fca9,_0x1ff188){_0x41fca9=_0x41fca9-0x0;var _0x564891=_0x3fdb[_0x41fca9];return _0x564891;};'use strict';var EventEmitter=require(_0xb3fd('0x0'));var SmsQueue=require(_0xb3fd('0x1'))['db'][_0xb3fd('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb3fd('0x3')](0x0);var events={'afterCreate':_0xb3fd('0x4'),'afterUpdate':_0xb3fd('0x5'),'afterDestroy':_0xb3fd('0x6')};function emitEvent(_0x4952d4){return function(_0x3e72f2,_0x133a0f,_0x3909f3){SmsQueueEvents[_0xb3fd('0x7')](_0x4952d4+':'+_0x3e72f2['id'],_0x3e72f2);SmsQueueEvents[_0xb3fd('0x7')](_0x4952d4,_0x3e72f2);_0x3909f3(null);};}for(var e in events){if(events[_0xb3fd('0x8')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x9953=['../../mysqldb','SmsQueue','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x13d7cc,_0x26ef4b){var _0x486517=function(_0x19e3fc){while(--_0x19e3fc){_0x13d7cc['push'](_0x13d7cc['shift']());}};_0x486517(++_0x26ef4b);}(_0x9953,0x98));var _0x3995=function(_0x48229a,_0x2dac65){_0x48229a=_0x48229a-0x0;var _0x5342e5=_0x9953[_0x48229a];return _0x5342e5;};'use strict';var EventEmitter=require(_0x3995('0x0'));var SmsQueue=require(_0x3995('0x1'))['db'][_0x3995('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3995('0x4'),'afterDestroy':_0x3995('0x5')};function emitEvent(_0x445b58){return function(_0x591420,_0x4f5cbf,_0x437732){SmsQueueEvents[_0x3995('0x6')](_0x445b58+':'+_0x591420['id'],_0x591420);SmsQueueEvents['emit'](_0x445b58,_0x591420);_0x437732(null);};}for(var e in events){if(events[_0x3995('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x3995('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 630934b..9a5c2ae 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 _0xb31b=['./smsQueue.attributes','exports','define','sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x567ec4,_0x3e8a71){var _0x36df92=function(_0x3998e0){while(--_0x3998e0){_0x567ec4['push'](_0x567ec4['shift']());}};_0x36df92(++_0x3e8a71);}(_0xb31b,0xdc));var _0xbb31=function(_0x2b7db4,_0x473ff2){_0x2b7db4=_0x2b7db4-0x0;var _0x51e768=_0xb31b[_0x2b7db4];return _0x51e768;};'use strict';var _=require(_0xbb31('0x0'));var util=require('util');var logger=require(_0xbb31('0x1'))(_0xbb31('0x2'));var moment=require(_0xbb31('0x3'));var BPromise=require(_0xbb31('0x4'));var rp=require(_0xbb31('0x5'));var fs=require('fs');var path=require(_0xbb31('0x6'));var rimraf=require(_0xbb31('0x7'));var config=require('../../config/environment');var attributes=require(_0xbb31('0x8'));module[_0xbb31('0x9')]=function(_0x3e0f66,_0x1ec37a){return _0x3e0f66[_0xbb31('0xa')]('SmsQueue',attributes,{'tableName':_0xbb31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a9e=['sms_queues','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./smsQueue.attributes','exports','SmsQueue'];(function(_0x1ebd59,_0x259be6){var _0x2a1505=function(_0x33a2f0){while(--_0x33a2f0){_0x1ebd59['push'](_0x1ebd59['shift']());}};_0x2a1505(++_0x259be6);}(_0x7a9e,0x119));var _0xe7a9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7a9e[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xe7a9('0x0'));var util=require(_0xe7a9('0x1'));var logger=require(_0xe7a9('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe7a9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe7a9('0x4'));var config=require(_0xe7a9('0x5'));var attributes=require(_0xe7a9('0x6'));module[_0xe7a9('0x7')]=function(_0x59b159,_0x5ad53a){return _0x59b159['define'](_0xe7a9('0x8'),attributes,{'tableName':_0xe7a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 128a70e..6067396 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 _0xba42=['include','map','model','attributes','ShowSmsQueue','find','where','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','limit'];(function(_0x2acee5,_0x27c02b){var _0x2bded4=function(_0xbd53b7){while(--_0xbd53b7){_0x2acee5['push'](_0x2acee5['shift']());}};_0x2bded4(++_0x27c02b);}(_0xba42,0xf1));var _0x2ba4=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0xba42[_0x2468b5];return _0x1056e4;};'use strict';var _=require(_0x2ba4('0x0'));var util=require(_0x2ba4('0x1'));var moment=require(_0x2ba4('0x2'));var BPromise=require(_0x2ba4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ba4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2ba4('0x5'))(_0x2ba4('0x6'));var config=require(_0x2ba4('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2ba4('0x8')]({'port':0x232a});config[_0x2ba4('0x9')]=_[_0x2ba4('0xa')](config[_0x2ba4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ba4('0xb'))(new Redis(config['redis']));require(_0x2ba4('0xc'))[_0x2ba4('0xd')](socket);function respondWithRpcPromise(_0x196e65,_0x559553,_0x364b98){return new BPromise(function(_0x1cd136,_0x384c28){return client[_0x2ba4('0xe')](_0x196e65,_0x364b98)[_0x2ba4('0xf')](function(_0x3a3ebb){logger[_0x2ba4('0x10')](_0x2ba4('0x11'),_0x559553,_0x2ba4('0x12'));logger[_0x2ba4('0x13')](_0x2ba4('0x14'),_0x559553,_0x2ba4('0x12'),JSON[_0x2ba4('0x15')](_0x3a3ebb));if(_0x3a3ebb['error']){if(_0x3a3ebb['error']['code']===0x1f4){logger['error'](_0x2ba4('0x11'),_0x559553,_0x3a3ebb[_0x2ba4('0x16')][_0x2ba4('0x17')]);return _0x384c28(_0x3a3ebb['error']['message']);}logger[_0x2ba4('0x16')](_0x2ba4('0x11'),_0x559553,_0x3a3ebb[_0x2ba4('0x16')]['message']);return _0x1cd136(_0x3a3ebb[_0x2ba4('0x16')][_0x2ba4('0x17')]);}else{logger[_0x2ba4('0x10')](_0x2ba4('0x11'),_0x559553,'request\x20sent');_0x1cd136(_0x3a3ebb[_0x2ba4('0x18')][_0x2ba4('0x17')]);}})[_0x2ba4('0x19')](function(_0x27c570){logger[_0x2ba4('0x16')](_0x2ba4('0x11'),_0x559553,_0x27c570);_0x384c28(_0x27c570);});});}exports[_0x2ba4('0x1a')]=function(_0x1be8cc){var _0x58c960=this;return new Promise(function(_0x5dbb46,_0x249489){return db[_0x2ba4('0x1b')][_0x2ba4('0x1c')]({'raw':_0x1be8cc[_0x2ba4('0x1d')]?_0x1be8cc[_0x2ba4('0x1d')][_0x2ba4('0x1e')]===undefined?!![]:![]:!![],'where':_0x1be8cc[_0x2ba4('0x1d')]?_0x1be8cc['options']['where']||null:null,'attributes':_0x1be8cc[_0x2ba4('0x1d')]?_0x1be8cc['options']['attributes']||null:null,'limit':_0x1be8cc['options']?_0x1be8cc[_0x2ba4('0x1d')][_0x2ba4('0x1f')]||null:null,'include':_0x1be8cc[_0x2ba4('0x1d')]?_0x1be8cc[_0x2ba4('0x1d')][_0x2ba4('0x20')]?_[_0x2ba4('0x21')](_0x1be8cc[_0x2ba4('0x1d')][_0x2ba4('0x20')],function(_0x23cc05){return{'model':db[_0x23cc05['model']],'as':_0x23cc05['as'],'attributes':_0x23cc05['attributes'],'include':_0x23cc05['include']?_['map'](_0x23cc05['include'],function(_0x4e7f64){return{'model':db[_0x4e7f64[_0x2ba4('0x22')]],'as':_0x4e7f64['as'],'attributes':_0x4e7f64[_0x2ba4('0x23')],'include':_0x4e7f64[_0x2ba4('0x20')]?_[_0x2ba4('0x21')](_0x4e7f64[_0x2ba4('0x20')],function(_0x261f83){return{'model':db[_0x261f83[_0x2ba4('0x22')]],'as':_0x261f83['as'],'attributes':_0x261f83[_0x2ba4('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x156154){logger[_0x2ba4('0x10')](_0x2ba4('0x1a'),_0x1be8cc);logger[_0x2ba4('0x13')]('GetSmsQueue',_0x1be8cc,JSON[_0x2ba4('0x15')](_0x156154));_0x5dbb46(_0x156154);})['catch'](function(_0x5b469d){logger[_0x2ba4('0x16')](_0x2ba4('0x1a'),_0x5b469d[_0x2ba4('0x17')],_0x1be8cc);_0x249489(_0x58c960[_0x2ba4('0x16')](0x1f4,_0x5b469d['message']));});});};exports[_0x2ba4('0x24')]=function(_0x330be){var _0x41bd36=this;return new Promise(function(_0x253726,_0x45981e){return db['SmsQueue'][_0x2ba4('0x25')]({'raw':_0x330be[_0x2ba4('0x1d')]?_0x330be[_0x2ba4('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x330be['options']?_0x330be['options'][_0x2ba4('0x26')]||null:null,'attributes':_0x330be[_0x2ba4('0x1d')]?_0x330be[_0x2ba4('0x1d')]['attributes']||null:null,'include':_0x330be['options']?_0x330be[_0x2ba4('0x1d')][_0x2ba4('0x20')]?_[_0x2ba4('0x21')](_0x330be[_0x2ba4('0x1d')][_0x2ba4('0x20')],function(_0xe1afd4){return{'model':db[_0xe1afd4['model']],'as':_0xe1afd4['as'],'attributes':_0xe1afd4[_0x2ba4('0x23')],'include':_0xe1afd4[_0x2ba4('0x20')]?_['map'](_0xe1afd4[_0x2ba4('0x20')],function(_0x554b26){return{'model':db[_0x554b26[_0x2ba4('0x22')]],'as':_0x554b26['as'],'attributes':_0x554b26['attributes'],'include':_0x554b26['include']?_[_0x2ba4('0x21')](_0x554b26[_0x2ba4('0x20')],function(_0x2b7967){return{'model':db[_0x2b7967[_0x2ba4('0x22')]],'as':_0x2b7967['as'],'attributes':_0x2b7967['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ba4('0xf')](function(_0x25f28b){logger[_0x2ba4('0x10')](_0x2ba4('0x24'),_0x330be);logger[_0x2ba4('0x13')](_0x2ba4('0x24'),_0x330be,JSON[_0x2ba4('0x15')](_0x25f28b));_0x253726(_0x25f28b);})['catch'](function(_0xf9a8b4){logger['error'](_0x2ba4('0x24'),_0xf9a8b4[_0x2ba4('0x17')],_0x330be);_0x45981e(_0x41bd36[_0x2ba4('0x16')](0x1f4,_0xf9a8b4['message']));});});}; \ No newline at end of file +var _0xdca5=['attributes','map','include','model','GetSmsQueue','debug','ShowSmsQueue','find','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','catch','SmsQueue','options','raw','where'];(function(_0x566320,_0x254877){var _0x777b74=function(_0x3e6ddc){while(--_0x3e6ddc){_0x566320['push'](_0x566320['shift']());}};_0x777b74(++_0x254877);}(_0xdca5,0x1dc));var _0x5dca=function(_0x141f4c,_0x1cd3cb){_0x141f4c=_0x141f4c-0x0;var _0x438b05=_0xdca5[_0x141f4c];return _0x438b05;};'use strict';var _=require('lodash');var util=require(_0x5dca('0x0'));var moment=require('moment');var BPromise=require(_0x5dca('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dca('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5dca('0x3'));var logger=require(_0x5dca('0x4'))(_0x5dca('0x5'));var config=require(_0x5dca('0x6'));var jayson=require(_0x5dca('0x7'));var client=jayson[_0x5dca('0x8')][_0x5dca('0x9')]({'port':0x232a});config[_0x5dca('0xa')]=_[_0x5dca('0xb')](config['redis'],{'host':_0x5dca('0xc'),'port':0x18eb});var socket=require(_0x5dca('0xd'))(new Redis(config[_0x5dca('0xa')]));require(_0x5dca('0xe'))[_0x5dca('0xf')](socket);function respondWithRpcPromise(_0xb4db14,_0x2e4dde,_0x4f1049){return new BPromise(function(_0x3df202,_0x4458d4){return client[_0x5dca('0x10')](_0xb4db14,_0x4f1049)[_0x5dca('0x11')](function(_0x1b3eac){logger[_0x5dca('0x12')]('SmsQueue,\x20%s,\x20%s',_0x2e4dde,_0x5dca('0x13'));logger['debug'](_0x5dca('0x14'),_0x2e4dde,_0x5dca('0x13'),JSON[_0x5dca('0x15')](_0x1b3eac));if(_0x1b3eac['error']){if(_0x1b3eac[_0x5dca('0x16')][_0x5dca('0x17')]===0x1f4){logger['error'](_0x5dca('0x18'),_0x2e4dde,_0x1b3eac['error'][_0x5dca('0x19')]);return _0x4458d4(_0x1b3eac['error'][_0x5dca('0x19')]);}logger[_0x5dca('0x16')](_0x5dca('0x18'),_0x2e4dde,_0x1b3eac[_0x5dca('0x16')][_0x5dca('0x19')]);return _0x3df202(_0x1b3eac[_0x5dca('0x16')]['message']);}else{logger['info'](_0x5dca('0x18'),_0x2e4dde,_0x5dca('0x13'));_0x3df202(_0x1b3eac['result']['message']);}})[_0x5dca('0x1a')](function(_0x240231){logger[_0x5dca('0x16')]('SmsQueue,\x20%s,\x20%s',_0x2e4dde,_0x240231);_0x4458d4(_0x240231);});});}exports['GetSmsQueue']=function(_0x5e4a90){var _0x31cc84=this;return new Promise(function(_0xf5f09d,_0x42b9f0){return db[_0x5dca('0x1b')]['findAll']({'raw':_0x5e4a90[_0x5dca('0x1c')]?_0x5e4a90[_0x5dca('0x1c')][_0x5dca('0x1d')]===undefined?!![]:![]:!![],'where':_0x5e4a90[_0x5dca('0x1c')]?_0x5e4a90['options'][_0x5dca('0x1e')]||null:null,'attributes':_0x5e4a90[_0x5dca('0x1c')]?_0x5e4a90[_0x5dca('0x1c')][_0x5dca('0x1f')]||null:null,'limit':_0x5e4a90[_0x5dca('0x1c')]?_0x5e4a90['options']['limit']||null:null,'include':_0x5e4a90['options']?_0x5e4a90[_0x5dca('0x1c')]['include']?_[_0x5dca('0x20')](_0x5e4a90['options'][_0x5dca('0x21')],function(_0x175f1d){return{'model':db[_0x175f1d[_0x5dca('0x22')]],'as':_0x175f1d['as'],'attributes':_0x175f1d['attributes'],'include':_0x175f1d[_0x5dca('0x21')]?_[_0x5dca('0x20')](_0x175f1d[_0x5dca('0x21')],function(_0xec9ac4){return{'model':db[_0xec9ac4['model']],'as':_0xec9ac4['as'],'attributes':_0xec9ac4[_0x5dca('0x1f')],'include':_0xec9ac4[_0x5dca('0x21')]?_[_0x5dca('0x20')](_0xec9ac4['include'],function(_0xa9dc92){return{'model':db[_0xa9dc92[_0x5dca('0x22')]],'as':_0xa9dc92['as'],'attributes':_0xa9dc92[_0x5dca('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x279208){logger[_0x5dca('0x12')](_0x5dca('0x23'),_0x5e4a90);logger[_0x5dca('0x24')](_0x5dca('0x23'),_0x5e4a90,JSON[_0x5dca('0x15')](_0x279208));_0xf5f09d(_0x279208);})[_0x5dca('0x1a')](function(_0x2028fe){logger[_0x5dca('0x16')]('GetSmsQueue',_0x2028fe[_0x5dca('0x19')],_0x5e4a90);_0x42b9f0(_0x31cc84[_0x5dca('0x16')](0x1f4,_0x2028fe[_0x5dca('0x19')]));});});};exports[_0x5dca('0x25')]=function(_0x473b2d){var _0x332fcb=this;return new Promise(function(_0x37a939,_0x290a71){return db[_0x5dca('0x1b')][_0x5dca('0x26')]({'raw':_0x473b2d[_0x5dca('0x1c')]?_0x473b2d[_0x5dca('0x1c')][_0x5dca('0x1d')]===undefined?!![]:![]:!![],'where':_0x473b2d['options']?_0x473b2d[_0x5dca('0x1c')][_0x5dca('0x1e')]||null:null,'attributes':_0x473b2d['options']?_0x473b2d[_0x5dca('0x1c')]['attributes']||null:null,'include':_0x473b2d[_0x5dca('0x1c')]?_0x473b2d[_0x5dca('0x1c')]['include']?_[_0x5dca('0x20')](_0x473b2d[_0x5dca('0x1c')]['include'],function(_0x3dacdb){return{'model':db[_0x3dacdb['model']],'as':_0x3dacdb['as'],'attributes':_0x3dacdb[_0x5dca('0x1f')],'include':_0x3dacdb['include']?_[_0x5dca('0x20')](_0x3dacdb[_0x5dca('0x21')],function(_0x1f480a){return{'model':db[_0x1f480a['model']],'as':_0x1f480a['as'],'attributes':_0x1f480a['attributes'],'include':_0x1f480a[_0x5dca('0x21')]?_['map'](_0x1f480a[_0x5dca('0x21')],function(_0x706c12){return{'model':db[_0x706c12['model']],'as':_0x706c12['as'],'attributes':_0x706c12[_0x5dca('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5dca('0x11')](function(_0x36e852){logger[_0x5dca('0x12')](_0x5dca('0x25'),_0x473b2d);logger[_0x5dca('0x24')](_0x5dca('0x25'),_0x473b2d,JSON[_0x5dca('0x15')](_0x36e852));_0x37a939(_0x36e852);})[_0x5dca('0x1a')](function(_0x40a817){logger[_0x5dca('0x16')](_0x5dca('0x25'),_0x40a817[_0x5dca('0x19')],_0x473b2d);_0x290a71(_0x332fcb[_0x5dca('0x16')](0x1f4,_0x40a817[_0x5dca('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index f845482..8e8e9a0 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 _0x18a7=['save','remove','update','removeListener','register','length','./smsQueue.events'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x18a7,0x92));var _0x718a=function(_0x2b2b48,_0x42f139){_0x2b2b48=_0x2b2b48-0x0;var _0x131b38=_0x18a7[_0x2b2b48];return _0x131b38;};'use strict';var SmsQueueEvents=require(_0x718a('0x0'));var events=[_0x718a('0x1'),_0x718a('0x2'),_0x718a('0x3')];function createListener(_0x35e3c0,_0x1d7ce6){return function(_0x2e0374){_0x1d7ce6['emit'](_0x35e3c0,_0x2e0374);};}function removeListener(_0x3faf0c,_0x140865){return function(){SmsQueueEvents[_0x718a('0x4')](_0x3faf0c,_0x140865);};}exports[_0x718a('0x5')]=function(_0x5aef7b){for(var _0x4297ba=0x0,_0x3627b5=events[_0x718a('0x6')];_0x4297ba<_0x3627b5;_0x4297ba++){var _0x63270f=events[_0x4297ba];var _0x9a8a8b=createListener('smsQueue:'+_0x63270f,_0x5aef7b);SmsQueueEvents['on'](_0x63270f,_0x9a8a8b);}}; \ No newline at end of file +var _0x8c19=['remove','update','emit','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x1862f0,_0x773da7){var _0x447214=function(_0x5b3a9e){while(--_0x5b3a9e){_0x1862f0['push'](_0x1862f0['shift']());}};_0x447214(++_0x773da7);}(_0x8c19,0x1c7));var _0x98c1=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x8c19[_0x311c35];return _0x5cc50c;};'use strict';var SmsQueueEvents=require(_0x98c1('0x0'));var events=['save',_0x98c1('0x1'),_0x98c1('0x2')];function createListener(_0x27d3dc,_0x378e45){return function(_0x118d57){_0x378e45[_0x98c1('0x3')](_0x27d3dc,_0x118d57);};}function removeListener(_0x5e5b51,_0x39ac59){return function(){SmsQueueEvents[_0x98c1('0x4')](_0x5e5b51,_0x39ac59);};}exports[_0x98c1('0x5')]=function(_0x3dabe5){for(var _0x591519=0x0,_0x501dd7=events[_0x98c1('0x6')];_0x591519<_0x501dd7;_0x591519++){var _0x4d6d58=events[_0x591519];var _0x3e108c=createListener(_0x98c1('0x7')+_0x4d6d58,_0x3dabe5);SmsQueueEvents['on'](_0x4d6d58,_0x3e108c);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index b97018b..b77eaba 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 _0x048f=['show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x048f,0xcd));var _0xf048=function(_0x360ae5,_0x3c521e){_0x360ae5=_0x360ae5-0x0;var _0x1d0f74=_0x048f[_0x360ae5];return _0x1d0f74;};'use strict';var multer=require(_0xf048('0x0'));var util=require(_0xf048('0x1'));var path=require(_0xf048('0x2'));var timeout=require(_0xf048('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf048('0x4'));var auth=require(_0xf048('0x5'));var interaction=require(_0xf048('0x6'));var config=require(_0xf048('0x7'));var controller=require(_0xf048('0x8'));router[_0xf048('0x9')]('/',auth[_0xf048('0xa')](),controller[_0xf048('0xb')]);router[_0xf048('0x9')](_0xf048('0xc'),auth[_0xf048('0xa')](),controller[_0xf048('0xd')]);router['get'](_0xf048('0xe'),auth['isAuthenticated'](),controller[_0xf048('0xf')]);router[_0xf048('0x10')]('/',auth[_0xf048('0xa')](),controller[_0xf048('0x11')]);router[_0xf048('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xf048('0x13')]);router[_0xf048('0x14')](_0xf048('0xe'),auth[_0xf048('0xa')](),controller['destroy']);module[_0xf048('0x15')]=router; \ No newline at end of file +var _0x80bf=['connect-timeout','express','fs-extra','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','delete','destroy','multer','util'];(function(_0x533f24,_0x4e0b2a){var _0x50a185=function(_0x511b2d){while(--_0x511b2d){_0x533f24['push'](_0x533f24['shift']());}};_0x50a185(++_0x4e0b2a);}(_0x80bf,0x148));var _0xf80b=function(_0x157582,_0x3fbd88){_0x157582=_0x157582-0x0;var _0x23c4c8=_0x80bf[_0x157582];return _0x23c4c8;};'use strict';var multer=require(_0xf80b('0x0'));var util=require(_0xf80b('0x1'));var path=require('path');var timeout=require(_0xf80b('0x2'));var express=require(_0xf80b('0x3'));var router=express['Router']();var fs_extra=require(_0xf80b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf80b('0x5'));var config=require('../../config/environment');var controller=require(_0xf80b('0x6'));router[_0xf80b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf80b('0x7')]('/describe',auth[_0xf80b('0x8')](),controller[_0xf80b('0x9')]);router[_0xf80b('0x7')](_0xf80b('0xa'),auth[_0xf80b('0x8')](),controller[_0xf80b('0xb')]);router[_0xf80b('0xc')]('/',auth[_0xf80b('0x8')](),controller['create']);router['put'](_0xf80b('0xa'),auth[_0xf80b('0x8')](),controller['update']);router[_0xf80b('0xd')](_0xf80b('0xa'),auth[_0xf80b('0x8')](),controller[_0xf80b('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index c7492e4..b8b7166 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 _0x7488=['STRING','DATE','moment','sequelize'];(function(_0x4b36b4,_0x2fd637){var _0x8189ef=function(_0xceb3bf){while(--_0xceb3bf){_0x4b36b4['push'](_0x4b36b4['shift']());}};_0x8189ef(++_0x2fd637);}(_0x7488,0x19a));var _0x8748=function(_0x52e629,_0x32bcaf){_0x52e629=_0x52e629-0x0;var _0x36ca0f=_0x7488[_0x52e629];return _0x36ca0f;};'use strict';var moment=require(_0x8748('0x0'));var Sequelize=require(_0x8748('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8748('0x2')]},'joinAt':{'type':Sequelize[_0x8748('0x3')]},'leaveAt':{'type':Sequelize[_0x8748('0x3')]},'acceptAt':{'type':Sequelize[_0x8748('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8748('0x2')]}}; \ No newline at end of file +var _0x002e=['sequelize','STRING','DATE','moment'];(function(_0x28d9ee,_0x27ecff){var _0x580769=function(_0x16ea7e){while(--_0x16ea7e){_0x28d9ee['push'](_0x28d9ee['shift']());}};_0x580769(++_0x27ecff);}(_0x002e,0x18f));var _0xe002=function(_0x43b06b,_0x1929c7){_0x43b06b=_0x43b06b-0x0;var _0x2c555b=_0x002e[_0x43b06b];return _0x2c555b;};'use strict';var moment=require(_0xe002('0x0'));var Sequelize=require(_0xe002('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xe002('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe002('0x2')]},'joinAt':{'type':Sequelize[_0xe002('0x3')]},'leaveAt':{'type':Sequelize[_0xe002('0x3')]},'acceptAt':{'type':Sequelize[_0xe002('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xe002('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 5990065..1bb130b 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 _0x19bd=['describe','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body'];(function(_0x5f5239,_0x168952){var _0x1ed9ef=function(_0x2f5b7d){while(--_0x2f5b7d){_0x5f5239['push'](_0x5f5239['shift']());}};_0x1ed9ef(++_0x168952);}(_0x19bd,0x131));var _0xd19b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x19bd[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xd19b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd19b('0x1'));var jsonpatch=require(_0xd19b('0x2'));var rp=require(_0xd19b('0x3'));var moment=require(_0xd19b('0x4'));var BPromise=require(_0xd19b('0x5'));var Mustache=require(_0xd19b('0x6'));var util=require(_0xd19b('0x7'));var path=require(_0xd19b('0x8'));var sox=require(_0xd19b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd19b('0xa'));var _=require('lodash');var squel=require(_0xd19b('0xb'));var crypto=require(_0xd19b('0xc'));var jsforce=require(_0xd19b('0xd'));var deskjs=require(_0xd19b('0xe'));var toCsv=require(_0xd19b('0xf'));var querystring=require(_0xd19b('0x10'));var Papa=require(_0xd19b('0x11'));var Redis=require('ioredis');var authService=require(_0xd19b('0x12'));var qs=require(_0xd19b('0x13'));var as=require(_0xd19b('0x14'));var hardwareService=require(_0xd19b('0x15'));var logger=require(_0xd19b('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xd19b('0x17'));var licenseUtil=require(_0xd19b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d4a28,_0xe9fd9f){_0xe9fd9f=_0xe9fd9f||0xcc;return function(_0x5c9435){if(_0x5c9435){return _0x5d4a28['sendStatus'](_0xe9fd9f);}return _0x5d4a28[_0xd19b('0x19')](_0xe9fd9f)[_0xd19b('0x1a')]();};}function respondWithResult(_0x26552d,_0x5a8a17){_0x5a8a17=_0x5a8a17||0xc8;return function(_0x4b4397){if(_0x4b4397){return _0x26552d[_0xd19b('0x19')](_0x5a8a17)[_0xd19b('0x1b')](_0x4b4397);}};}function respondWithFilteredResult(_0x11ea9e,_0x3fca61){return function(_0x36b026){if(_0x36b026){var _0x1f57c1=typeof _0x3fca61['offset']===_0xd19b('0x1c')&&typeof _0x3fca61[_0xd19b('0x1d')]==='undefined';var _0x108a8c=_0x36b026[_0xd19b('0x1e')];var _0xad88d7=_0x1f57c1?0x0:_0x3fca61[_0xd19b('0x1f')];var _0x5efb8b=_0x1f57c1?_0x36b026[_0xd19b('0x1e')]:_0x3fca61[_0xd19b('0x1f')]+_0x3fca61['limit'];var _0x51d924;if(_0x5efb8b>=_0x108a8c){_0x5efb8b=_0x108a8c;_0x51d924=0xc8;}else{_0x51d924=0xce;}_0x11ea9e[_0xd19b('0x19')](_0x51d924);return _0x11ea9e[_0xd19b('0x20')](_0xd19b('0x21'),_0xad88d7+'-'+_0x5efb8b+'/'+_0x108a8c)[_0xd19b('0x1b')](_0x36b026);}return null;};}function patchUpdates(_0x36674f){return function(_0x4416c4){try{jsonpatch[_0xd19b('0x22')](_0x4416c4,_0x36674f,!![]);}catch(_0x456c66){return BPromise[_0xd19b('0x23')](_0x456c66);}return _0x4416c4['save']();};}function saveUpdates(_0x28567d,_0x3e571b){return function(_0x4e1803){if(_0x4e1803){return _0x4e1803[_0xd19b('0x24')](_0x28567d)[_0xd19b('0x25')](function(_0x1126f6){return _0x1126f6;});}return null;};}function removeEntity(_0x194606,_0x9d99c3){return function(_0x36afe6){if(_0x36afe6){return _0x36afe6[_0xd19b('0x26')]()[_0xd19b('0x25')](function(){_0x194606['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3529d8,_0x3bdc9e){return function(_0x242ca1){if(!_0x242ca1){_0x3529d8['sendStatus'](0x194);}return _0x242ca1;};}function handleError(_0xeaee49,_0x3bb9bd){_0x3bb9bd=_0x3bb9bd||0x1f4;return function(_0x203293){logger['error'](_0x203293[_0xd19b('0x27')]);if(_0x203293[_0xd19b('0x28')]){delete _0x203293[_0xd19b('0x28')];}_0xeaee49['status'](_0x3bb9bd)[_0xd19b('0x29')](_0x203293);};}exports[_0xd19b('0x2a')]=function(_0x7c291,_0x50ccc6){var _0x2e2af6={},_0x3b611c={},_0x431b0a={'count':0x0,'rows':[]};var _0x361c53=_['map'](db[_0xd19b('0x2b')][_0xd19b('0x2c')],function(_0x5bffe7){return{'name':_0x5bffe7[_0xd19b('0x2d')],'type':_0x5bffe7[_0xd19b('0x2e')][_0xd19b('0x2f')]};});_0x3b611c[_0xd19b('0x30')]=_[_0xd19b('0x31')](_0x361c53,_0xd19b('0x28'));_0x3b611c[_0xd19b('0x32')]=_['keys'](_0x7c291[_0xd19b('0x32')]);_0x3b611c[_0xd19b('0x33')]=_[_0xd19b('0x34')](_0x3b611c[_0xd19b('0x30')],_0x3b611c[_0xd19b('0x32')]);_0x2e2af6[_0xd19b('0x35')]=_[_0xd19b('0x34')](_0x3b611c[_0xd19b('0x30')],qs[_0xd19b('0x36')](_0x7c291[_0xd19b('0x32')][_0xd19b('0x36')]));_0x2e2af6[_0xd19b('0x35')]=_0x2e2af6['attributes'][_0xd19b('0x37')]?_0x2e2af6[_0xd19b('0x35')]:_0x3b611c[_0xd19b('0x30')];if(!_0x7c291[_0xd19b('0x32')][_0xd19b('0x38')](_0xd19b('0x39'))){_0x2e2af6[_0xd19b('0x1d')]=qs[_0xd19b('0x1d')](_0x7c291[_0xd19b('0x32')][_0xd19b('0x1d')]);_0x2e2af6[_0xd19b('0x1f')]=qs[_0xd19b('0x1f')](_0x7c291[_0xd19b('0x32')]['offset']);}_0x2e2af6['order']=qs[_0xd19b('0x3a')](_0x7c291['query']['sort']);_0x2e2af6[_0xd19b('0x3b')]=qs[_0xd19b('0x33')](_[_0xd19b('0x3c')](_0x7c291[_0xd19b('0x32')],_0x3b611c[_0xd19b('0x33')]),_0x361c53);if(_0x7c291[_0xd19b('0x32')][_0xd19b('0x3d')]){_0x2e2af6['where']=_[_0xd19b('0x3e')](_0x2e2af6[_0xd19b('0x3b')],{'$or':_[_0xd19b('0x31')](_0x361c53,function(_0x2427bd){if(_0x2427bd[_0xd19b('0x2e')]!==_0xd19b('0x3f')){var _0x32947a={};_0x32947a[_0x2427bd[_0xd19b('0x28')]]={'$like':'%'+_0x7c291['query'][_0xd19b('0x3d')]+'%'};return _0x32947a;}})});}_0x2e2af6=_[_0xd19b('0x3e')]({},_0x2e2af6,_0x7c291[_0xd19b('0x40')]);var _0x818ed0={'where':_0x2e2af6[_0xd19b('0x3b')]};return db['SmsQueueReport'][_0xd19b('0x1e')](_0x818ed0)[_0xd19b('0x25')](function(_0x4e5fa5){_0x431b0a[_0xd19b('0x1e')]=_0x4e5fa5;if(_0x7c291[_0xd19b('0x32')][_0xd19b('0x41')]){_0x2e2af6['include']=[{'all':!![]}];}return db['SmsQueueReport'][_0xd19b('0x42')](_0x2e2af6);})[_0xd19b('0x25')](function(_0x3b73ed){_0x431b0a[_0xd19b('0x43')]=_0x3b73ed;return _0x431b0a;})['then'](respondWithFilteredResult(_0x50ccc6,_0x2e2af6))[_0xd19b('0x44')](handleError(_0x50ccc6,null));};exports[_0xd19b('0x45')]=function(_0x3049ae,_0x5c3763){var _0x4f5030={'raw':!![],'where':{'id':_0x3049ae[_0xd19b('0x46')]['id']}},_0x532a86={};_0x532a86['model']=_['keys'](db['SmsQueueReport'][_0xd19b('0x2c')]);_0x532a86[_0xd19b('0x32')]=_['keys'](_0x3049ae[_0xd19b('0x32')]);_0x532a86[_0xd19b('0x33')]=_[_0xd19b('0x34')](_0x532a86[_0xd19b('0x30')],_0x532a86[_0xd19b('0x32')]);_0x4f5030[_0xd19b('0x35')]=_['intersection'](_0x532a86[_0xd19b('0x30')],qs[_0xd19b('0x36')](_0x3049ae['query'][_0xd19b('0x36')]));_0x4f5030[_0xd19b('0x35')]=_0x4f5030[_0xd19b('0x35')][_0xd19b('0x37')]?_0x4f5030[_0xd19b('0x35')]:_0x532a86[_0xd19b('0x30')];if(_0x3049ae[_0xd19b('0x32')][_0xd19b('0x41')]){_0x4f5030[_0xd19b('0x47')]=[{'all':!![]}];}_0x4f5030=_[_0xd19b('0x3e')]({},_0x4f5030,_0x3049ae[_0xd19b('0x40')]);return db[_0xd19b('0x2b')][_0xd19b('0x48')](_0x4f5030)[_0xd19b('0x25')](handleEntityNotFound(_0x5c3763,null))[_0xd19b('0x25')](respondWithResult(_0x5c3763,null))['catch'](handleError(_0x5c3763,null));};exports['create']=function(_0x10475f,_0x1bca3d){return db[_0xd19b('0x2b')][_0xd19b('0x49')](_0x10475f[_0xd19b('0x4a')],{})[_0xd19b('0x25')](respondWithResult(_0x1bca3d,0xc9))['catch'](handleError(_0x1bca3d,null));};exports['update']=function(_0xd73709,_0x355cc8){if(_0xd73709[_0xd19b('0x4a')]['id']){delete _0xd73709[_0xd19b('0x4a')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0xd73709[_0xd19b('0x46')]['id']}})[_0xd19b('0x25')](handleEntityNotFound(_0x355cc8,null))[_0xd19b('0x25')](saveUpdates(_0xd73709['body'],null))[_0xd19b('0x25')](respondWithResult(_0x355cc8,null))['catch'](handleError(_0x355cc8,null));};exports[_0xd19b('0x26')]=function(_0x1b4e26,_0x5a82e7){return db[_0xd19b('0x2b')][_0xd19b('0x48')]({'where':{'id':_0x1b4e26['params']['id']}})['then'](handleEntityNotFound(_0x5a82e7,null))[_0xd19b('0x25')](removeEntity(_0x5a82e7,null))[_0xd19b('0x44')](handleError(_0x5a82e7,null));};exports[_0xd19b('0x4b')]=function(_0xb82d29,_0x18f144){return db[_0xd19b('0x2b')][_0xd19b('0x4b')]()[_0xd19b('0x25')](respondWithResult(_0x18f144,null))[_0xd19b('0x44')](handleError(_0x18f144,null));}; \ No newline at end of file +var _0x77b4=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','SmsQueueReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','length','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x77b4,0x11d));var _0x477b=function(_0x278a40,_0x439018){_0x278a40=_0x278a40-0x0;var _0x383227=_0x77b4[_0x278a40];return _0x383227;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x477b('0x0'));var zipdir=require(_0x477b('0x1'));var jsonpatch=require(_0x477b('0x2'));var rp=require(_0x477b('0x3'));var moment=require(_0x477b('0x4'));var BPromise=require(_0x477b('0x5'));var Mustache=require(_0x477b('0x6'));var util=require('util');var path=require(_0x477b('0x7'));var sox=require(_0x477b('0x8'));var csv=require(_0x477b('0x9'));var ejs=require(_0x477b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x477b('0xb'));var squel=require(_0x477b('0xc'));var crypto=require(_0x477b('0xd'));var jsforce=require(_0x477b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x477b('0xf'));var Papa=require('papaparse');var Redis=require(_0x477b('0x10'));var authService=require(_0x477b('0x11'));var qs=require(_0x477b('0x12'));var as=require(_0x477b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x477b('0x14'))(_0x477b('0x15'));var utils=require(_0x477b('0x16'));var config=require(_0x477b('0x17'));var licenseUtil=require(_0x477b('0x18'));var db=require(_0x477b('0x19'))['db'];function respondWithStatusCode(_0x5b85cb,_0x270196){_0x270196=_0x270196||0xcc;return function(_0x4da24f){if(_0x4da24f){return _0x5b85cb[_0x477b('0x1a')](_0x270196);}return _0x5b85cb['status'](_0x270196)[_0x477b('0x1b')]();};}function respondWithResult(_0x174df8,_0xd67e68){_0xd67e68=_0xd67e68||0xc8;return function(_0x2e6085){if(_0x2e6085){return _0x174df8[_0x477b('0x1c')](_0xd67e68)[_0x477b('0x1d')](_0x2e6085);}};}function respondWithFilteredResult(_0x37edfd,_0x5787cd){return function(_0x409b54){if(_0x409b54){var _0xa67638=typeof _0x5787cd[_0x477b('0x1e')]===_0x477b('0x1f')&&typeof _0x5787cd['limit']===_0x477b('0x1f');var _0x5261ba=_0x409b54[_0x477b('0x20')];var _0x223e77=_0xa67638?0x0:_0x5787cd[_0x477b('0x1e')];var _0x5fdc78=_0xa67638?_0x409b54[_0x477b('0x20')]:_0x5787cd['offset']+_0x5787cd[_0x477b('0x21')];var _0x2d4b1f;if(_0x5fdc78>=_0x5261ba){_0x5fdc78=_0x5261ba;_0x2d4b1f=0xc8;}else{_0x2d4b1f=0xce;}_0x37edfd[_0x477b('0x1c')](_0x2d4b1f);return _0x37edfd['set'](_0x477b('0x22'),_0x223e77+'-'+_0x5fdc78+'/'+_0x5261ba)['json'](_0x409b54);}return null;};}function patchUpdates(_0x2ff34f){return function(_0x57be6b){try{jsonpatch[_0x477b('0x23')](_0x57be6b,_0x2ff34f,!![]);}catch(_0x1a3570){return BPromise[_0x477b('0x24')](_0x1a3570);}return _0x57be6b[_0x477b('0x25')]();};}function saveUpdates(_0x133bc7,_0x325063){return function(_0x333d3b){if(_0x333d3b){return _0x333d3b[_0x477b('0x26')](_0x133bc7)[_0x477b('0x27')](function(_0x4d3bf7){return _0x4d3bf7;});}return null;};}function removeEntity(_0xfbde67,_0x4e0a3f){return function(_0x1f3f2d){if(_0x1f3f2d){return _0x1f3f2d[_0x477b('0x28')]()['then'](function(){_0xfbde67['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x81c9a,_0x172ff9){return function(_0x36e13a){if(!_0x36e13a){_0x81c9a[_0x477b('0x1a')](0x194);}return _0x36e13a;};}function handleError(_0x4a3142,_0x241cf0){_0x241cf0=_0x241cf0||0x1f4;return function(_0x54c853){logger['error'](_0x54c853[_0x477b('0x29')]);if(_0x54c853['name']){delete _0x54c853[_0x477b('0x2a')];}_0x4a3142['status'](_0x241cf0)['send'](_0x54c853);};}exports[_0x477b('0x2b')]=function(_0x116d84,_0x434673){var _0x1fcf1b={},_0x7b6041={},_0x2ab9ca={'count':0x0,'rows':[]};var _0x2ed924=_[_0x477b('0x2c')](db[_0x477b('0x2d')][_0x477b('0x2e')],function(_0x45520b){return{'name':_0x45520b['fieldName'],'type':_0x45520b['type'][_0x477b('0x2f')]};});_0x7b6041[_0x477b('0x30')]=_[_0x477b('0x2c')](_0x2ed924,_0x477b('0x2a'));_0x7b6041[_0x477b('0x31')]=_[_0x477b('0x32')](_0x116d84[_0x477b('0x31')]);_0x7b6041[_0x477b('0x33')]=_[_0x477b('0x34')](_0x7b6041[_0x477b('0x30')],_0x7b6041[_0x477b('0x31')]);_0x1fcf1b[_0x477b('0x35')]=_[_0x477b('0x34')](_0x7b6041[_0x477b('0x30')],qs[_0x477b('0x36')](_0x116d84[_0x477b('0x31')]['fields']));_0x1fcf1b[_0x477b('0x35')]=_0x1fcf1b['attributes']['length']?_0x1fcf1b[_0x477b('0x35')]:_0x7b6041[_0x477b('0x30')];if(!_0x116d84[_0x477b('0x31')][_0x477b('0x37')](_0x477b('0x38'))){_0x1fcf1b[_0x477b('0x21')]=qs['limit'](_0x116d84[_0x477b('0x31')][_0x477b('0x21')]);_0x1fcf1b[_0x477b('0x1e')]=qs[_0x477b('0x1e')](_0x116d84[_0x477b('0x31')][_0x477b('0x1e')]);}_0x1fcf1b[_0x477b('0x39')]=qs[_0x477b('0x3a')](_0x116d84[_0x477b('0x31')][_0x477b('0x3a')]);_0x1fcf1b['where']=qs['filters'](_[_0x477b('0x3b')](_0x116d84[_0x477b('0x31')],_0x7b6041[_0x477b('0x33')]),_0x2ed924);if(_0x116d84[_0x477b('0x31')][_0x477b('0x3c')]){_0x1fcf1b[_0x477b('0x3d')]=_[_0x477b('0x3e')](_0x1fcf1b[_0x477b('0x3d')],{'$or':_[_0x477b('0x2c')](_0x2ed924,function(_0x4a4816){if(_0x4a4816[_0x477b('0x3f')]!==_0x477b('0x40')){var _0x4401d2={};_0x4401d2[_0x4a4816[_0x477b('0x2a')]]={'$like':'%'+_0x116d84[_0x477b('0x31')][_0x477b('0x3c')]+'%'};return _0x4401d2;}})});}_0x1fcf1b=_['merge']({},_0x1fcf1b,_0x116d84['options']);var _0x2a84d8={'where':_0x1fcf1b[_0x477b('0x3d')]};return db[_0x477b('0x2d')][_0x477b('0x20')](_0x2a84d8)['then'](function(_0x1bf228){_0x2ab9ca[_0x477b('0x20')]=_0x1bf228;if(_0x116d84['query'][_0x477b('0x41')]){_0x1fcf1b[_0x477b('0x42')]=[{'all':!![]}];}return db[_0x477b('0x2d')]['findAll'](_0x1fcf1b);})[_0x477b('0x27')](function(_0x16cb14){_0x2ab9ca[_0x477b('0x43')]=_0x16cb14;return _0x2ab9ca;})[_0x477b('0x27')](respondWithFilteredResult(_0x434673,_0x1fcf1b))[_0x477b('0x44')](handleError(_0x434673,null));};exports[_0x477b('0x45')]=function(_0x3821ed,_0x4de977){var _0x4602b2={'raw':!![],'where':{'id':_0x3821ed[_0x477b('0x46')]['id']}},_0x378a74={};_0x378a74[_0x477b('0x30')]=_['keys'](db[_0x477b('0x2d')][_0x477b('0x2e')]);_0x378a74[_0x477b('0x31')]=_[_0x477b('0x32')](_0x3821ed[_0x477b('0x31')]);_0x378a74[_0x477b('0x33')]=_['intersection'](_0x378a74[_0x477b('0x30')],_0x378a74[_0x477b('0x31')]);_0x4602b2[_0x477b('0x35')]=_[_0x477b('0x34')](_0x378a74[_0x477b('0x30')],qs[_0x477b('0x36')](_0x3821ed[_0x477b('0x31')][_0x477b('0x36')]));_0x4602b2[_0x477b('0x35')]=_0x4602b2[_0x477b('0x35')][_0x477b('0x47')]?_0x4602b2[_0x477b('0x35')]:_0x378a74[_0x477b('0x30')];if(_0x3821ed['query'][_0x477b('0x41')]){_0x4602b2[_0x477b('0x42')]=[{'all':!![]}];}_0x4602b2=_[_0x477b('0x3e')]({},_0x4602b2,_0x3821ed[_0x477b('0x48')]);return db[_0x477b('0x2d')][_0x477b('0x49')](_0x4602b2)[_0x477b('0x27')](handleEntityNotFound(_0x4de977,null))[_0x477b('0x27')](respondWithResult(_0x4de977,null))[_0x477b('0x44')](handleError(_0x4de977,null));};exports[_0x477b('0x4a')]=function(_0x40aa74,_0x45ccf4){return db['SmsQueueReport'][_0x477b('0x4a')](_0x40aa74[_0x477b('0x4b')],{})['then'](respondWithResult(_0x45ccf4,0xc9))['catch'](handleError(_0x45ccf4,null));};exports[_0x477b('0x26')]=function(_0x9eb00f,_0x1936cb){if(_0x9eb00f[_0x477b('0x4b')]['id']){delete _0x9eb00f['body']['id'];}return db[_0x477b('0x2d')]['find']({'where':{'id':_0x9eb00f['params']['id']}})[_0x477b('0x27')](handleEntityNotFound(_0x1936cb,null))[_0x477b('0x27')](saveUpdates(_0x9eb00f['body'],null))[_0x477b('0x27')](respondWithResult(_0x1936cb,null))[_0x477b('0x44')](handleError(_0x1936cb,null));};exports[_0x477b('0x28')]=function(_0x4c6e50,_0x46e4e5){return db[_0x477b('0x2d')][_0x477b('0x49')]({'where':{'id':_0x4c6e50[_0x477b('0x46')]['id']}})[_0x477b('0x27')](handleEntityNotFound(_0x46e4e5,null))[_0x477b('0x27')](removeEntity(_0x46e4e5,null))['catch'](handleError(_0x46e4e5,null));};exports['describe']=function(_0x2e72f8,_0x138a73){return db[_0x477b('0x2d')]['describe']()[_0x477b('0x27')](respondWithResult(_0x138a73,null))['catch'](handleError(_0x138a73,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 63fd903..95daf56 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xe706,0xa3));var _0x6e70=function(_0x4eb893,_0x1b650c){_0x4eb893=_0x4eb893-0x0;var _0x113080=_0xe706[_0x4eb893];return _0x113080;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x2390bd,_0x212fbd){var _0x3a969d=function(_0x3dd049){while(--_0x3dd049){_0x2390bd['push'](_0x2390bd['shift']());}};_0x3a969d(++_0x212fbd);}(_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 56a09b1..6a90aa0 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 _0x2ba5=['create','body','options','raw','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport'];(function(_0x5f3094,_0x33af18){var _0x2b452d=function(_0x3385a6){while(--_0x3385a6){_0x5f3094['push'](_0x5f3094['shift']());}};_0x2b452d(++_0x33af18);}(_0x2ba5,0x6a));var _0x52ba=function(_0x53ad58,_0x3fb489){_0x53ad58=_0x53ad58-0x0;var _0x554b03=_0x2ba5[_0x53ad58];return _0x554b03;};'use strict';var _=require(_0x52ba('0x0'));var util=require(_0x52ba('0x1'));var moment=require(_0x52ba('0x2'));var BPromise=require(_0x52ba('0x3'));var rs=require(_0x52ba('0x4'));var fs=require('fs');var Redis=require(_0x52ba('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x52ba('0x6'));var jayson=require(_0x52ba('0x7'));var client=jayson['client'][_0x52ba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56a184,_0x3d64b7,_0x13e953){return new BPromise(function(_0x11193b,_0x9c625a){return client[_0x52ba('0x9')](_0x56a184,_0x13e953)[_0x52ba('0xa')](function(_0x3e1137){logger[_0x52ba('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x3d64b7,_0x52ba('0xc'));logger[_0x52ba('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3d64b7,_0x52ba('0xc'),JSON[_0x52ba('0xe')](_0x3e1137));if(_0x3e1137[_0x52ba('0xf')]){if(_0x3e1137['error'][_0x52ba('0x10')]===0x1f4){logger[_0x52ba('0xf')](_0x52ba('0x11'),_0x3d64b7,_0x3e1137[_0x52ba('0xf')][_0x52ba('0x12')]);return _0x9c625a(_0x3e1137[_0x52ba('0xf')][_0x52ba('0x12')]);}logger[_0x52ba('0xf')](_0x52ba('0x11'),_0x3d64b7,_0x3e1137[_0x52ba('0xf')]['message']);return _0x11193b(_0x3e1137['error'][_0x52ba('0x12')]);}else{logger[_0x52ba('0xb')](_0x52ba('0x11'),_0x3d64b7,_0x52ba('0xc'));_0x11193b(_0x3e1137[_0x52ba('0x13')][_0x52ba('0x12')]);}})[_0x52ba('0x14')](function(_0x311af5){logger[_0x52ba('0xf')](_0x52ba('0x11'),_0x3d64b7,_0x311af5);_0x9c625a(_0x311af5);});});}exports[_0x52ba('0x15')]=function(_0x83259c){var _0x2c2f7d=this;return new Promise(function(_0x59e741,_0x2c6d79){return db['SmsQueueReport'][_0x52ba('0x16')](_0x83259c[_0x52ba('0x17')],{'raw':_0x83259c[_0x52ba('0x18')]?_0x83259c[_0x52ba('0x18')][_0x52ba('0x19')]===undefined?!![]:![]:!![]})[_0x52ba('0xa')](function(_0x8e984e){logger[_0x52ba('0xb')](_0x52ba('0x15'),_0x83259c);logger[_0x52ba('0xd')](_0x52ba('0x15'),_0x83259c,JSON[_0x52ba('0xe')](_0x8e984e));_0x59e741(_0x8e984e);})['catch'](function(_0x405894){logger[_0x52ba('0xf')](_0x52ba('0x15'),_0x405894[_0x52ba('0x12')],_0x83259c);_0x2c6d79(_0x2c2f7d[_0x52ba('0xf')](0x1f4,_0x405894[_0x52ba('0x12')]));});});};exports[_0x52ba('0x1a')]=function(_0x3c6830){var _0x2f005f=this;return new Promise(function(_0x1ff8a0,_0x1c8a6e){return db[_0x52ba('0x1b')][_0x52ba('0x1c')](_0x3c6830[_0x52ba('0x17')],{'raw':_0x3c6830[_0x52ba('0x18')]?_0x3c6830['options'][_0x52ba('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c6830['options']?_0x3c6830[_0x52ba('0x18')][_0x52ba('0x1d')]||null:null,'attributes':_0x3c6830[_0x52ba('0x18')]?_0x3c6830[_0x52ba('0x18')][_0x52ba('0x1e')]||null:null,'limit':_0x3c6830['options']?_0x3c6830[_0x52ba('0x18')][_0x52ba('0x1f')]||null:null})[_0x52ba('0xa')](function(_0x7b4900){logger[_0x52ba('0xb')]('UpdateSmsQueueReport',_0x3c6830);logger[_0x52ba('0xd')](_0x52ba('0x1a'),_0x3c6830,JSON[_0x52ba('0xe')](_0x7b4900));_0x1ff8a0(_0x7b4900);})[_0x52ba('0x14')](function(_0x4e3915){logger[_0x52ba('0xf')](_0x52ba('0x1a'),_0x4e3915[_0x52ba('0x12')],_0x3c6830);_0x1c8a6e(_0x2f005f[_0x52ba('0xf')](0x1f4,_0x4e3915[_0x52ba('0x12')]));});});}; \ No newline at end of file +var _0x9282=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','then','where','limit','UpdateSmsQueueReport','lodash','moment'];(function(_0x243893,_0x349e42){var _0xc15cd6=function(_0x2d5c74){while(--_0x2d5c74){_0x243893['push'](_0x243893['shift']());}};_0xc15cd6(++_0x349e42);}(_0x9282,0x106));var _0x2928=function(_0x5980e4,_0x44ec9c){_0x5980e4=_0x5980e4-0x0;var _0x429716=_0x9282[_0x5980e4];return _0x429716;};'use strict';var _=require(_0x2928('0x0'));var util=require('util');var moment=require(_0x2928('0x1'));var BPromise=require(_0x2928('0x2'));var rs=require(_0x2928('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2928('0x4'))['db'];var utils=require(_0x2928('0x5'));var logger=require(_0x2928('0x6'))(_0x2928('0x7'));var config=require(_0x2928('0x8'));var jayson=require(_0x2928('0x9'));var client=jayson[_0x2928('0xa')][_0x2928('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3331ca,_0x514603,_0x31e492){return new BPromise(function(_0x449f5b,_0x243c98){return client[_0x2928('0xc')](_0x3331ca,_0x31e492)['then'](function(_0x29c3e4){logger[_0x2928('0xd')](_0x2928('0xe'),_0x514603,'request\x20sent');logger[_0x2928('0xf')](_0x2928('0x10'),_0x514603,'request\x20sent',JSON[_0x2928('0x11')](_0x29c3e4));if(_0x29c3e4[_0x2928('0x12')]){if(_0x29c3e4[_0x2928('0x12')][_0x2928('0x13')]===0x1f4){logger[_0x2928('0x12')](_0x2928('0xe'),_0x514603,_0x29c3e4[_0x2928('0x12')][_0x2928('0x14')]);return _0x243c98(_0x29c3e4[_0x2928('0x12')][_0x2928('0x14')]);}logger[_0x2928('0x12')](_0x2928('0xe'),_0x514603,_0x29c3e4[_0x2928('0x12')][_0x2928('0x14')]);return _0x449f5b(_0x29c3e4['error'][_0x2928('0x14')]);}else{logger[_0x2928('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x514603,'request\x20sent');_0x449f5b(_0x29c3e4[_0x2928('0x15')][_0x2928('0x14')]);}})[_0x2928('0x16')](function(_0x9da77f){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x514603,_0x9da77f);_0x243c98(_0x9da77f);});});}exports[_0x2928('0x17')]=function(_0x372e61){var _0x33b498=this;return new Promise(function(_0x2a800f,_0x1d4464){return db[_0x2928('0x18')][_0x2928('0x19')](_0x372e61[_0x2928('0x1a')],{'raw':_0x372e61[_0x2928('0x1b')]?_0x372e61[_0x2928('0x1b')][_0x2928('0x1c')]===undefined?!![]:![]:!![]})[_0x2928('0x1d')](function(_0x13d0da){logger[_0x2928('0xd')](_0x2928('0x17'),_0x372e61);logger[_0x2928('0xf')]('CreateSmsQueueReport',_0x372e61,JSON['stringify'](_0x13d0da));_0x2a800f(_0x13d0da);})[_0x2928('0x16')](function(_0x4288f8){logger[_0x2928('0x12')](_0x2928('0x17'),_0x4288f8[_0x2928('0x14')],_0x372e61);_0x1d4464(_0x33b498[_0x2928('0x12')](0x1f4,_0x4288f8[_0x2928('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x1ce1b2){var _0x20eb71=this;return new Promise(function(_0x5b0824,_0x14fb29){return db[_0x2928('0x18')]['update'](_0x1ce1b2[_0x2928('0x1a')],{'raw':_0x1ce1b2[_0x2928('0x1b')]?_0x1ce1b2[_0x2928('0x1b')][_0x2928('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ce1b2[_0x2928('0x1b')]?_0x1ce1b2['options'][_0x2928('0x1e')]||null:null,'attributes':_0x1ce1b2[_0x2928('0x1b')]?_0x1ce1b2[_0x2928('0x1b')]['attributes']||null:null,'limit':_0x1ce1b2[_0x2928('0x1b')]?_0x1ce1b2[_0x2928('0x1b')][_0x2928('0x1f')]||null:null})[_0x2928('0x1d')](function(_0xe7f368){logger[_0x2928('0xd')](_0x2928('0x20'),_0x1ce1b2);logger[_0x2928('0xf')](_0x2928('0x20'),_0x1ce1b2,JSON['stringify'](_0xe7f368));_0x5b0824(_0xe7f368);})[_0x2928('0x16')](function(_0x43eabc){logger[_0x2928('0x12')](_0x2928('0x20'),_0x43eabc['message'],_0x1ce1b2);_0x14fb29(_0x20eb71['error'](0x1f4,_0x43eabc['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 00e19d5..8658d6c 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 _0xbd50=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','create','delete','exports','multer','util'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xbd50,0x196));var _0x0bd5=function(_0x14ef49,_0x4d0ca8){_0x14ef49=_0x14ef49-0x0;var _0x3953da=_0xbd50[_0x14ef49];return _0x3953da;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['describe']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['post']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);router['put'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['update']);router[_0x0bd5('0xf')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['destroy']);module[_0x0bd5('0x10')]=router; \ No newline at end of file +var _0xb717=['put','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','show','create'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xb717,0x1b4));var _0x7b71=function(_0x32ffa9,_0x5ed14c){_0x32ffa9=_0x32ffa9-0x0;var _0x12eb2f=_0xb717[_0x32ffa9];return _0x12eb2f;};'use strict';var multer=require(_0x7b71('0x0'));var util=require('util');var path=require(_0x7b71('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b71('0x2'));var router=express[_0x7b71('0x3')]();var fs_extra=require(_0x7b71('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7b71('0x5'));var config=require(_0x7b71('0x6'));var controller=require(_0x7b71('0x7'));router[_0x7b71('0x8')]('/',auth[_0x7b71('0x9')](),controller['index']);router[_0x7b71('0x8')](_0x7b71('0xa'),auth[_0x7b71('0x9')](),controller[_0x7b71('0xb')]);router[_0x7b71('0x8')]('/:id',auth[_0x7b71('0x9')](),controller[_0x7b71('0xc')]);router['post']('/',auth[_0x7b71('0x9')](),controller[_0x7b71('0xd')]);router[_0x7b71('0xe')]('/:id',auth[_0x7b71('0x9')](),controller['update']);router[_0x7b71('0xf')]('/:id',auth[_0x7b71('0x9')](),controller[_0x7b71('0x10')]);module[_0x7b71('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 490b903..46f715b 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x450689,_0x3b857c){var _0x46ffb0=function(_0x5d3679){while(--_0x5d3679){_0x450689['push'](_0x450689['shift']());}};_0x46ffb0(++_0x3b857c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x575724,_0xc918a5){_0x575724=_0x575724-0x0;var _0x4ceea4=_0x9bde[_0x575724];return _0x4ceea4;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x45466b,_0x228624){var _0x436e9d=function(_0x2b2e14){while(--_0x2b2e14){_0x45466b['push'](_0x45466b['shift']());}};_0x436e9d(++_0x228624);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xcb91[_0x125ff8];return _0x2d9ef;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 027a00c..c2c2ca7 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 _0x78fe=['jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','Content-Range','json','apply','save','then','destroy','end','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','include','findAll','rows','keys','find','catch','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','crypto'];(function(_0x18a1f6,_0x5356c4){var _0x493551=function(_0x1686a4){while(--_0x1686a4){_0x18a1f6['push'](_0x18a1f6['shift']());}};_0x493551(++_0x5356c4);}(_0x78fe,0x153));var _0xe78f=function(_0x257972,_0x102ebb){_0x257972=_0x257972-0x0;var _0x363e09=_0x78fe[_0x257972];return _0x363e09;};'use strict';var emlformat=require(_0xe78f('0x0'));var rimraf=require(_0xe78f('0x1'));var zipdir=require(_0xe78f('0x2'));var jsonpatch=require(_0xe78f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe78f('0x4'));var util=require(_0xe78f('0x5'));var path=require(_0xe78f('0x6'));var sox=require('sox');var csv=require(_0xe78f('0x7'));var ejs=require(_0xe78f('0x8'));var fs=require('fs');var fs_extra=require(_0xe78f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe78f('0xa'));var jsforce=require(_0xe78f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe78f('0x7'));var querystring=require('querystring');var Papa=require(_0xe78f('0xc'));var Redis=require(_0xe78f('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe78f('0xe'));var hardwareService=require(_0xe78f('0xf'));var logger=require('../../config/logger')(_0xe78f('0x10'));var utils=require(_0xe78f('0x11'));var config=require(_0xe78f('0x12'));var licenseUtil=require(_0xe78f('0x13'));var db=require(_0xe78f('0x14'))['db'];function respondWithStatusCode(_0x141e9c,_0x44b6e8){_0x44b6e8=_0x44b6e8||0xcc;return function(_0x5590f6){if(_0x5590f6){return _0x141e9c[_0xe78f('0x15')](_0x44b6e8);}return _0x141e9c[_0xe78f('0x16')](_0x44b6e8)['end']();};}function respondWithResult(_0xf4fb0d,_0x39c9bb){_0x39c9bb=_0x39c9bb||0xc8;return function(_0x1a542f){if(_0x1a542f){return _0xf4fb0d[_0xe78f('0x16')](_0x39c9bb)['json'](_0x1a542f);}};}function respondWithFilteredResult(_0x366982,_0x51ba80){return function(_0x5c998a){if(_0x5c998a){var _0x27de18=typeof _0x51ba80['offset']===_0xe78f('0x17')&&typeof _0x51ba80[_0xe78f('0x18')]===_0xe78f('0x17');var _0x207953=_0x5c998a[_0xe78f('0x19')];var _0xcf0b91=_0x27de18?0x0:_0x51ba80['offset'];var _0x3f0941=_0x27de18?_0x5c998a['count']:_0x51ba80['offset']+_0x51ba80[_0xe78f('0x18')];var _0x1a6806;if(_0x3f0941>=_0x207953){_0x3f0941=_0x207953;_0x1a6806=0xc8;}else{_0x1a6806=0xce;}_0x366982[_0xe78f('0x16')](_0x1a6806);return _0x366982['set'](_0xe78f('0x1a'),_0xcf0b91+'-'+_0x3f0941+'/'+_0x207953)[_0xe78f('0x1b')](_0x5c998a);}return null;};}function patchUpdates(_0x4b7d02){return function(_0x2be661){try{jsonpatch[_0xe78f('0x1c')](_0x2be661,_0x4b7d02,!![]);}catch(_0xf54245){return BPromise['reject'](_0xf54245);}return _0x2be661[_0xe78f('0x1d')]();};}function saveUpdates(_0x44cf8d,_0x19cfd8){return function(_0x58d7b2){if(_0x58d7b2){return _0x58d7b2['update'](_0x44cf8d)[_0xe78f('0x1e')](function(_0x4499d3){return _0x4499d3;});}return null;};}function removeEntity(_0x4758fe,_0x253e4a){return function(_0xde8784){if(_0xde8784){return _0xde8784[_0xe78f('0x1f')]()[_0xe78f('0x1e')](function(){_0x4758fe[_0xe78f('0x16')](0xcc)[_0xe78f('0x20')]();});}};}function handleEntityNotFound(_0x4cdc07,_0x3ef80e){return function(_0x45d467){if(!_0x45d467){_0x4cdc07['sendStatus'](0x194);}return _0x45d467;};}function handleError(_0x401c2b,_0x50454d){_0x50454d=_0x50454d||0x1f4;return function(_0x13c0eb){logger[_0xe78f('0x21')](_0x13c0eb[_0xe78f('0x22')]);if(_0x13c0eb['name']){delete _0x13c0eb[_0xe78f('0x23')];}_0x401c2b['status'](_0x50454d)[_0xe78f('0x24')](_0x13c0eb);};}exports[_0xe78f('0x25')]=function(_0x2dd57a,_0x45aaf9){var _0x1e3caa={},_0x2af502={},_0x5ba94b={'count':0x0,'rows':[]};var _0x4a06c8=_[_0xe78f('0x26')](db[_0xe78f('0x27')][_0xe78f('0x28')],function(_0x10a7f1){return{'name':_0x10a7f1['fieldName'],'type':_0x10a7f1[_0xe78f('0x29')][_0xe78f('0x2a')]};});_0x2af502[_0xe78f('0x2b')]=_[_0xe78f('0x26')](_0x4a06c8,_0xe78f('0x23'));_0x2af502[_0xe78f('0x2c')]=_['keys'](_0x2dd57a['query']);_0x2af502[_0xe78f('0x2d')]=_[_0xe78f('0x2e')](_0x2af502[_0xe78f('0x2b')],_0x2af502[_0xe78f('0x2c')]);_0x1e3caa[_0xe78f('0x2f')]=_[_0xe78f('0x2e')](_0x2af502[_0xe78f('0x2b')],qs['fields'](_0x2dd57a[_0xe78f('0x2c')][_0xe78f('0x30')]));_0x1e3caa[_0xe78f('0x2f')]=_0x1e3caa['attributes'][_0xe78f('0x31')]?_0x1e3caa['attributes']:_0x2af502[_0xe78f('0x2b')];if(!_0x2dd57a[_0xe78f('0x2c')][_0xe78f('0x32')](_0xe78f('0x33'))){_0x1e3caa[_0xe78f('0x18')]=qs[_0xe78f('0x18')](_0x2dd57a[_0xe78f('0x2c')]['limit']);_0x1e3caa[_0xe78f('0x34')]=qs['offset'](_0x2dd57a[_0xe78f('0x2c')][_0xe78f('0x34')]);}_0x1e3caa[_0xe78f('0x35')]=qs['sort'](_0x2dd57a['query'][_0xe78f('0x36')]);_0x1e3caa[_0xe78f('0x37')]=qs['filters'](_[_0xe78f('0x38')](_0x2dd57a[_0xe78f('0x2c')],_0x2af502['filters']),_0x4a06c8);if(_0x2dd57a[_0xe78f('0x2c')][_0xe78f('0x39')]){_0x1e3caa[_0xe78f('0x37')]=_[_0xe78f('0x3a')](_0x1e3caa[_0xe78f('0x37')],{'$or':_[_0xe78f('0x26')](_0x4a06c8,function(_0x56293b){if(_0x56293b[_0xe78f('0x29')]!=='VIRTUAL'){var _0x57a00e={};_0x57a00e[_0x56293b[_0xe78f('0x23')]]={'$like':'%'+_0x2dd57a[_0xe78f('0x2c')][_0xe78f('0x39')]+'%'};return _0x57a00e;}})});}_0x1e3caa=_['merge']({},_0x1e3caa,_0x2dd57a[_0xe78f('0x3b')]);var _0x4a498f={'where':_0x1e3caa[_0xe78f('0x37')]};return db[_0xe78f('0x27')]['count'](_0x4a498f)[_0xe78f('0x1e')](function(_0x159f06){_0x5ba94b[_0xe78f('0x19')]=_0x159f06;if(_0x2dd57a['query']['includeAll']){_0x1e3caa[_0xe78f('0x3c')]=[{'all':!![]}];}return db[_0xe78f('0x27')][_0xe78f('0x3d')](_0x1e3caa);})[_0xe78f('0x1e')](function(_0x4f9db3){_0x5ba94b[_0xe78f('0x3e')]=_0x4f9db3;return _0x5ba94b;})['then'](respondWithFilteredResult(_0x45aaf9,_0x1e3caa))['catch'](handleError(_0x45aaf9,null));};exports['show']=function(_0x2c18a3,_0x5a0cd0){var _0x4235c4={'raw':!![],'where':{'id':_0x2c18a3['params']['id']}},_0x4ecd86={};_0x4ecd86[_0xe78f('0x2b')]=_[_0xe78f('0x3f')](db['SmsTransferReport'][_0xe78f('0x28')]);_0x4ecd86[_0xe78f('0x2c')]=_[_0xe78f('0x3f')](_0x2c18a3[_0xe78f('0x2c')]);_0x4ecd86[_0xe78f('0x2d')]=_['intersection'](_0x4ecd86[_0xe78f('0x2b')],_0x4ecd86['query']);_0x4235c4[_0xe78f('0x2f')]=_['intersection'](_0x4ecd86[_0xe78f('0x2b')],qs[_0xe78f('0x30')](_0x2c18a3[_0xe78f('0x2c')][_0xe78f('0x30')]));_0x4235c4[_0xe78f('0x2f')]=_0x4235c4['attributes'][_0xe78f('0x31')]?_0x4235c4[_0xe78f('0x2f')]:_0x4ecd86[_0xe78f('0x2b')];if(_0x2c18a3[_0xe78f('0x2c')]['includeAll']){_0x4235c4[_0xe78f('0x3c')]=[{'all':!![]}];}_0x4235c4=_[_0xe78f('0x3a')]({},_0x4235c4,_0x2c18a3['options']);return db['SmsTransferReport'][_0xe78f('0x40')](_0x4235c4)[_0xe78f('0x1e')](handleEntityNotFound(_0x5a0cd0,null))[_0xe78f('0x1e')](respondWithResult(_0x5a0cd0,null))[_0xe78f('0x41')](handleError(_0x5a0cd0,null));};exports['create']=function(_0x3a6ce2,_0x4fe162){return db[_0xe78f('0x27')]['create'](_0x3a6ce2[_0xe78f('0x42')],{})[_0xe78f('0x1e')](respondWithResult(_0x4fe162,0xc9))['catch'](handleError(_0x4fe162,null));};exports[_0xe78f('0x43')]=function(_0xc1d728,_0x5afdf7){if(_0xc1d728[_0xe78f('0x42')]['id']){delete _0xc1d728[_0xe78f('0x42')]['id'];}return db[_0xe78f('0x27')]['find']({'where':{'id':_0xc1d728[_0xe78f('0x44')]['id']}})[_0xe78f('0x1e')](handleEntityNotFound(_0x5afdf7,null))[_0xe78f('0x1e')](saveUpdates(_0xc1d728[_0xe78f('0x42')],null))[_0xe78f('0x1e')](respondWithResult(_0x5afdf7,null))[_0xe78f('0x41')](handleError(_0x5afdf7,null));};exports[_0xe78f('0x1f')]=function(_0x5070e3,_0x2b9aa4){return db['SmsTransferReport'][_0xe78f('0x40')]({'where':{'id':_0x5070e3[_0xe78f('0x44')]['id']}})[_0xe78f('0x1e')](handleEntityNotFound(_0x2b9aa4,null))[_0xe78f('0x1e')](removeEntity(_0x2b9aa4,null))[_0xe78f('0x41')](handleError(_0x2b9aa4,null));};exports[_0xe78f('0x45')]=function(_0x2e010b,_0x4f69e9){return db[_0xe78f('0x27')]['describe']()[_0xe78f('0x1e')](respondWithResult(_0x4f69e9,null))[_0xe78f('0x41')](handleError(_0x4f69e9,null));}; \ No newline at end of file +var _0x2cdb=['stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsTransferReport','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error'];(function(_0x3e17a9,_0x39afdc){var _0x402e91=function(_0x1a07b1){while(--_0x1a07b1){_0x3e17a9['push'](_0x3e17a9['shift']());}};_0x402e91(++_0x39afdc);}(_0x2cdb,0x1a0));var _0xb2cd=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2cdb[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb2cd('0x0'));var zipdir=require(_0xb2cd('0x1'));var jsonpatch=require(_0xb2cd('0x2'));var rp=require(_0xb2cd('0x3'));var moment=require(_0xb2cd('0x4'));var BPromise=require(_0xb2cd('0x5'));var Mustache=require(_0xb2cd('0x6'));var util=require(_0xb2cd('0x7'));var path=require(_0xb2cd('0x8'));var sox=require('sox');var csv=require(_0xb2cd('0x9'));var ejs=require(_0xb2cd('0xa'));var fs=require('fs');var fs_extra=require(_0xb2cd('0xb'));var _=require(_0xb2cd('0xc'));var squel=require('squel');var crypto=require(_0xb2cd('0xd'));var jsforce=require(_0xb2cd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb2cd('0x9'));var querystring=require(_0xb2cd('0xf'));var Papa=require('papaparse');var Redis=require(_0xb2cd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb2cd('0x11'));var as=require(_0xb2cd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb2cd('0x13'))(_0xb2cd('0x14'));var utils=require(_0xb2cd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb2cd('0x16'));var db=require(_0xb2cd('0x17'))['db'];function respondWithStatusCode(_0x3fd5ec,_0x52891d){_0x52891d=_0x52891d||0xcc;return function(_0x14d97e){if(_0x14d97e){return _0x3fd5ec[_0xb2cd('0x18')](_0x52891d);}return _0x3fd5ec[_0xb2cd('0x19')](_0x52891d)['end']();};}function respondWithResult(_0x3b871a,_0x2b8874){_0x2b8874=_0x2b8874||0xc8;return function(_0x218417){if(_0x218417){return _0x3b871a['status'](_0x2b8874)[_0xb2cd('0x1a')](_0x218417);}};}function respondWithFilteredResult(_0x3e4928,_0x36f3b8){return function(_0x51c88a){if(_0x51c88a){var _0x45374c=typeof _0x36f3b8['offset']===_0xb2cd('0x1b')&&typeof _0x36f3b8[_0xb2cd('0x1c')]===_0xb2cd('0x1b');var _0x22577f=_0x51c88a[_0xb2cd('0x1d')];var _0x34d5fc=_0x45374c?0x0:_0x36f3b8[_0xb2cd('0x1e')];var _0x31d4f5=_0x45374c?_0x51c88a[_0xb2cd('0x1d')]:_0x36f3b8['offset']+_0x36f3b8[_0xb2cd('0x1c')];var _0x259d2a;if(_0x31d4f5>=_0x22577f){_0x31d4f5=_0x22577f;_0x259d2a=0xc8;}else{_0x259d2a=0xce;}_0x3e4928[_0xb2cd('0x19')](_0x259d2a);return _0x3e4928[_0xb2cd('0x1f')](_0xb2cd('0x20'),_0x34d5fc+'-'+_0x31d4f5+'/'+_0x22577f)['json'](_0x51c88a);}return null;};}function patchUpdates(_0xb0235d){return function(_0x55f4a9){try{jsonpatch['apply'](_0x55f4a9,_0xb0235d,!![]);}catch(_0x5b776e){return BPromise[_0xb2cd('0x21')](_0x5b776e);}return _0x55f4a9[_0xb2cd('0x22')]();};}function saveUpdates(_0x405484,_0x42e720){return function(_0x28aabd){if(_0x28aabd){return _0x28aabd[_0xb2cd('0x23')](_0x405484)[_0xb2cd('0x24')](function(_0x5e3cdb){return _0x5e3cdb;});}return null;};}function removeEntity(_0x3c26f0,_0x12a9fd){return function(_0x3e8744){if(_0x3e8744){return _0x3e8744[_0xb2cd('0x25')]()[_0xb2cd('0x24')](function(){_0x3c26f0[_0xb2cd('0x19')](0xcc)[_0xb2cd('0x26')]();});}};}function handleEntityNotFound(_0x2da08b,_0x293b0e){return function(_0x32e167){if(!_0x32e167){_0x2da08b['sendStatus'](0x194);}return _0x32e167;};}function handleError(_0x363142,_0x4fdb91){_0x4fdb91=_0x4fdb91||0x1f4;return function(_0x9807c4){logger[_0xb2cd('0x27')](_0x9807c4[_0xb2cd('0x28')]);if(_0x9807c4[_0xb2cd('0x29')]){delete _0x9807c4['name'];}_0x363142[_0xb2cd('0x19')](_0x4fdb91)[_0xb2cd('0x2a')](_0x9807c4);};}exports[_0xb2cd('0x2b')]=function(_0x190e4a,_0x5457a0){var _0x39f604={},_0x172db0={},_0x191a0a={'count':0x0,'rows':[]};var _0x2907fb=_['map'](db['SmsTransferReport'][_0xb2cd('0x2c')],function(_0x1201de){return{'name':_0x1201de['fieldName'],'type':_0x1201de[_0xb2cd('0x2d')][_0xb2cd('0x2e')]};});_0x172db0[_0xb2cd('0x2f')]=_[_0xb2cd('0x30')](_0x2907fb,'name');_0x172db0[_0xb2cd('0x31')]=_[_0xb2cd('0x32')](_0x190e4a[_0xb2cd('0x31')]);_0x172db0[_0xb2cd('0x33')]=_[_0xb2cd('0x34')](_0x172db0[_0xb2cd('0x2f')],_0x172db0[_0xb2cd('0x31')]);_0x39f604[_0xb2cd('0x35')]=_['intersection'](_0x172db0['model'],qs[_0xb2cd('0x36')](_0x190e4a[_0xb2cd('0x31')][_0xb2cd('0x36')]));_0x39f604[_0xb2cd('0x35')]=_0x39f604[_0xb2cd('0x35')][_0xb2cd('0x37')]?_0x39f604[_0xb2cd('0x35')]:_0x172db0[_0xb2cd('0x2f')];if(!_0x190e4a['query']['hasOwnProperty']('nolimit')){_0x39f604[_0xb2cd('0x1c')]=qs['limit'](_0x190e4a[_0xb2cd('0x31')][_0xb2cd('0x1c')]);_0x39f604[_0xb2cd('0x1e')]=qs['offset'](_0x190e4a[_0xb2cd('0x31')][_0xb2cd('0x1e')]);}_0x39f604[_0xb2cd('0x38')]=qs['sort'](_0x190e4a[_0xb2cd('0x31')][_0xb2cd('0x39')]);_0x39f604[_0xb2cd('0x3a')]=qs[_0xb2cd('0x33')](_[_0xb2cd('0x3b')](_0x190e4a[_0xb2cd('0x31')],_0x172db0[_0xb2cd('0x33')]),_0x2907fb);if(_0x190e4a[_0xb2cd('0x31')][_0xb2cd('0x3c')]){_0x39f604[_0xb2cd('0x3a')]=_[_0xb2cd('0x3d')](_0x39f604[_0xb2cd('0x3a')],{'$or':_[_0xb2cd('0x30')](_0x2907fb,function(_0x39bf3b){if(_0x39bf3b['type']!==_0xb2cd('0x3e')){var _0x9e31ec={};_0x9e31ec[_0x39bf3b[_0xb2cd('0x29')]]={'$like':'%'+_0x190e4a[_0xb2cd('0x31')][_0xb2cd('0x3c')]+'%'};return _0x9e31ec;}})});}_0x39f604=_['merge']({},_0x39f604,_0x190e4a[_0xb2cd('0x3f')]);var _0x3d56bf={'where':_0x39f604[_0xb2cd('0x3a')]};return db[_0xb2cd('0x40')][_0xb2cd('0x1d')](_0x3d56bf)[_0xb2cd('0x24')](function(_0x379b30){_0x191a0a[_0xb2cd('0x1d')]=_0x379b30;if(_0x190e4a[_0xb2cd('0x31')]['includeAll']){_0x39f604[_0xb2cd('0x41')]=[{'all':!![]}];}return db[_0xb2cd('0x40')][_0xb2cd('0x42')](_0x39f604);})[_0xb2cd('0x24')](function(_0x437419){_0x191a0a[_0xb2cd('0x43')]=_0x437419;return _0x191a0a;})[_0xb2cd('0x24')](respondWithFilteredResult(_0x5457a0,_0x39f604))[_0xb2cd('0x44')](handleError(_0x5457a0,null));};exports[_0xb2cd('0x45')]=function(_0xb426f,_0xbc3dd6){var _0x4cb6f8={'raw':!![],'where':{'id':_0xb426f['params']['id']}},_0x259190={};_0x259190['model']=_[_0xb2cd('0x32')](db[_0xb2cd('0x40')][_0xb2cd('0x2c')]);_0x259190[_0xb2cd('0x31')]=_[_0xb2cd('0x32')](_0xb426f[_0xb2cd('0x31')]);_0x259190[_0xb2cd('0x33')]=_['intersection'](_0x259190['model'],_0x259190['query']);_0x4cb6f8[_0xb2cd('0x35')]=_[_0xb2cd('0x34')](_0x259190[_0xb2cd('0x2f')],qs[_0xb2cd('0x36')](_0xb426f[_0xb2cd('0x31')][_0xb2cd('0x36')]));_0x4cb6f8[_0xb2cd('0x35')]=_0x4cb6f8[_0xb2cd('0x35')][_0xb2cd('0x37')]?_0x4cb6f8[_0xb2cd('0x35')]:_0x259190[_0xb2cd('0x2f')];if(_0xb426f[_0xb2cd('0x31')][_0xb2cd('0x46')]){_0x4cb6f8[_0xb2cd('0x41')]=[{'all':!![]}];}_0x4cb6f8=_[_0xb2cd('0x3d')]({},_0x4cb6f8,_0xb426f[_0xb2cd('0x3f')]);return db[_0xb2cd('0x40')][_0xb2cd('0x47')](_0x4cb6f8)[_0xb2cd('0x24')](handleEntityNotFound(_0xbc3dd6,null))[_0xb2cd('0x24')](respondWithResult(_0xbc3dd6,null))['catch'](handleError(_0xbc3dd6,null));};exports[_0xb2cd('0x48')]=function(_0x553dd9,_0x510eec){return db[_0xb2cd('0x40')][_0xb2cd('0x48')](_0x553dd9['body'],{})[_0xb2cd('0x24')](respondWithResult(_0x510eec,0xc9))[_0xb2cd('0x44')](handleError(_0x510eec,null));};exports[_0xb2cd('0x23')]=function(_0x175336,_0x3b67bc){if(_0x175336[_0xb2cd('0x49')]['id']){delete _0x175336[_0xb2cd('0x49')]['id'];}return db[_0xb2cd('0x40')][_0xb2cd('0x47')]({'where':{'id':_0x175336[_0xb2cd('0x4a')]['id']}})[_0xb2cd('0x24')](handleEntityNotFound(_0x3b67bc,null))[_0xb2cd('0x24')](saveUpdates(_0x175336[_0xb2cd('0x49')],null))[_0xb2cd('0x24')](respondWithResult(_0x3b67bc,null))['catch'](handleError(_0x3b67bc,null));};exports['destroy']=function(_0x4175d0,_0x5cd084){return db[_0xb2cd('0x40')][_0xb2cd('0x47')]({'where':{'id':_0x4175d0[_0xb2cd('0x4a')]['id']}})[_0xb2cd('0x24')](handleEntityNotFound(_0x5cd084,null))[_0xb2cd('0x24')](removeEntity(_0x5cd084,null))[_0xb2cd('0x44')](handleError(_0x5cd084,null));};exports[_0xb2cd('0x4b')]=function(_0x3a00fd,_0x3dd8ad){return db['SmsTransferReport'][_0xb2cd('0x4b')]()[_0xb2cd('0x24')](respondWithResult(_0x3dd8ad,null))[_0xb2cd('0x44')](handleError(_0x3dd8ad,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 6cf8fd7..6782571 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 _0x4a77=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x4a77,0x1ee));var _0x74a7=function(_0x59e602,_0x2b8951){_0x59e602=_0x59e602-0x0;var _0x3536bb=_0x4a77[_0x59e602];return _0x3536bb;};'use strict';var _=require(_0x74a7('0x0'));var util=require(_0x74a7('0x1'));var logger=require(_0x74a7('0x2'))(_0x74a7('0x3'));var moment=require(_0x74a7('0x4'));var BPromise=require(_0x74a7('0x5'));var rp=require(_0x74a7('0x6'));var fs=require('fs');var path=require(_0x74a7('0x7'));var rimraf=require('rimraf');var config=require(_0x74a7('0x8'));var attributes=require(_0x74a7('0x9'));module['exports']=function(_0x3641c0,_0x12928a){return _0x3641c0[_0x74a7('0xa')](_0x74a7('0xb'),attributes,{'tableName':_0x74a7('0xc'),'paranoid':![],'indexes':[{'name':_0x74a7('0xd'),'fields':[_0x74a7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa4ba=['../../config/logger','api','moment','request-promise','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','util'];(function(_0x4c3427,_0xc1361b){var _0x497ba8=function(_0x350736){while(--_0x350736){_0x4c3427['push'](_0x4c3427['shift']());}};_0x497ba8(++_0xc1361b);}(_0xa4ba,0x1b7));var _0xaa4b=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xa4ba[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var util=require(_0xaa4b('0x0'));var logger=require(_0xaa4b('0x1'))(_0xaa4b('0x2'));var moment=require(_0xaa4b('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa4b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa4b('0x5'));var attributes=require(_0xaa4b('0x6'));module[_0xaa4b('0x7')]=function(_0x146035,_0x4809a9){return _0x146035[_0xaa4b('0x8')]('SmsTransferReport',attributes,{'tableName':_0xaa4b('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index d3ac2f7..2f965ff 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 _0x1db9=['../../config/utils','../../config/logger','jayson/promise','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5c40cf,_0x44dc9b){var _0x17d310=function(_0x30885d){while(--_0x30885d){_0x5c40cf['push'](_0x5c40cf['shift']());}};_0x17d310(++_0x44dc9b);}(_0x1db9,0x176));var _0x91db=function(_0x383f85,_0x2fb1dc){_0x383f85=_0x383f85-0x0;var _0x5f1e9f=_0x1db9[_0x383f85];return _0x5f1e9f;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var moment=require(_0x91db('0x2'));var BPromise=require(_0x91db('0x3'));var rs=require(_0x91db('0x4'));var fs=require('fs');var Redis=require(_0x91db('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x91db('0x6'));var logger=require(_0x91db('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x91db('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x433c75,_0x3b0c53,_0x45fea0){return new BPromise(function(_0x2330c2,_0x2d89a1){return client['request'](_0x433c75,_0x45fea0)[_0x91db('0x9')](function(_0x58cda2){logger[_0x91db('0xa')](_0x91db('0xb'),_0x3b0c53,_0x91db('0xc'));logger['debug'](_0x91db('0xd'),_0x3b0c53,'request\x20sent',JSON['stringify'](_0x58cda2));if(_0x58cda2['error']){if(_0x58cda2[_0x91db('0xe')][_0x91db('0xf')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x3b0c53,_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);return _0x2d89a1(_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);}logger[_0x91db('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x3b0c53,_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);return _0x2330c2(_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);}else{logger[_0x91db('0xa')](_0x91db('0xb'),_0x3b0c53,_0x91db('0xc'));_0x2330c2(_0x58cda2[_0x91db('0x11')][_0x91db('0x10')]);}})[_0x91db('0x12')](function(_0x1e9679){logger[_0x91db('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x3b0c53,_0x1e9679);_0x2d89a1(_0x1e9679);});});} \ No newline at end of file +var _0x3351=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x2bbf94,_0x4d2f13){var _0x452473=function(_0x485bfc){while(--_0x485bfc){_0x2bbf94['push'](_0x2bbf94['shift']());}};_0x452473(++_0x4d2f13);}(_0x3351,0x1b4));var _0x1335=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x3351[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x1335('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1335('0x1'));var rs=require(_0x1335('0x2'));var fs=require('fs');var Redis=require(_0x1335('0x3'));var db=require(_0x1335('0x4'))['db'];var utils=require(_0x1335('0x5'));var logger=require(_0x1335('0x6'))(_0x1335('0x7'));var config=require('../../config/environment');var jayson=require(_0x1335('0x8'));var client=jayson[_0x1335('0x9')][_0x1335('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cee84,_0x225646,_0x629305){return new BPromise(function(_0x1a1f63,_0x2c934c){return client[_0x1335('0xb')](_0x2cee84,_0x629305)[_0x1335('0xc')](function(_0x248005){logger['info'](_0x1335('0xd'),_0x225646,'request\x20sent');logger[_0x1335('0xe')](_0x1335('0xf'),_0x225646,_0x1335('0x10'),JSON[_0x1335('0x11')](_0x248005));if(_0x248005[_0x1335('0x12')]){if(_0x248005[_0x1335('0x12')]['code']===0x1f4){logger[_0x1335('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x225646,_0x248005[_0x1335('0x12')]['message']);return _0x2c934c(_0x248005[_0x1335('0x12')]['message']);}logger[_0x1335('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x225646,_0x248005['error'][_0x1335('0x13')]);return _0x1a1f63(_0x248005[_0x1335('0x12')]['message']);}else{logger['info'](_0x1335('0xd'),_0x225646,'request\x20sent');_0x1a1f63(_0x248005[_0x1335('0x14')][_0x1335('0x13')]);}})[_0x1335('0x15')](function(_0x59134c){logger[_0x1335('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x225646,_0x59134c);_0x2c934c(_0x59134c);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 9a96a7a..cf387c4 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 _0x1d09=['../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','/:id/download','diskStorage','join','server/files/sounds/original/','originalname','%s-%s%s','basename','now','extname','post','single','file','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x374457,_0x58398d){var _0x2faa7a=function(_0x3c9d7e){while(--_0x3c9d7e){_0x374457['push'](_0x374457['shift']());}};_0x2faa7a(++_0x58398d);}(_0x1d09,0x12e));var _0x91d0=function(_0x3b594b,_0x5835c3){_0x3b594b=_0x3b594b-0x0;var _0x1ea5f8=_0x1d09[_0x3b594b];return _0x1ea5f8;};'use strict';var multer=require(_0x91d0('0x0'));var util=require(_0x91d0('0x1'));var path=require('path');var timeout=require(_0x91d0('0x2'));var express=require(_0x91d0('0x3'));var router=express[_0x91d0('0x4')]();var fs_extra=require(_0x91d0('0x5'));var auth=require(_0x91d0('0x6'));var interaction=require(_0x91d0('0x7'));var config=require('../../config/environment');var controller=require('./sound.controller');router['get']('/',auth[_0x91d0('0x8')](),controller[_0x91d0('0x9')]);router[_0x91d0('0xa')](_0x91d0('0xb'),auth['isAuthenticated'](),controller[_0x91d0('0xc')]);router[_0x91d0('0xa')](_0x91d0('0xd'),auth[_0x91d0('0x8')](),controller['download']);var upload=multer({'storage':multer[_0x91d0('0xe')]({'destination':function(_0x4e43da,_0x29bd23,_0x3d8d27){_0x3d8d27(null,path[_0x91d0('0xf')](config['root'],_0x91d0('0x10')));},'filename':function(_0x24d493,_0x3ddd39,_0x42f6e5){_0x3ddd39[_0x91d0('0x11')]=_0x3ddd39['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x42f6e5(null,util['format'](_0x91d0('0x12'),path[_0x91d0('0x13')](_0x3ddd39['originalname'],path['extname'](_0x3ddd39['originalname'])),Date[_0x91d0('0x14')](),path[_0x91d0('0x15')](_0x3ddd39[_0x91d0('0x11')])));}})});router[_0x91d0('0x16')]('/',upload[_0x91d0('0x17')](_0x91d0('0x18')),controller['create']);router[_0x91d0('0x19')](_0x91d0('0xb'),auth['isAuthenticated'](),controller[_0x91d0('0x1a')]);router[_0x91d0('0x1b')]('/:id',auth[_0x91d0('0x8')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x627b=['%s-%s%s','basename','extname','post','single','file','create','put','delete','/:id','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','show','/:id/download','diskStorage','join','server/files/sounds/original/','originalname','replace','format'];(function(_0xbd9895,_0x1af1a7){var _0x5d7443=function(_0x5c51dd){while(--_0x5c51dd){_0xbd9895['push'](_0xbd9895['shift']());}};_0x5d7443(++_0x1af1a7);}(_0x627b,0xf3));var _0xb627=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x627b[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require('multer');var util=require(_0xb627('0x0'));var path=require('path');var timeout=require(_0xb627('0x1'));var express=require('express');var router=express[_0xb627('0x2')]();var fs_extra=require(_0xb627('0x3'));var auth=require(_0xb627('0x4'));var interaction=require(_0xb627('0x5'));var config=require(_0xb627('0x6'));var controller=require(_0xb627('0x7'));router[_0xb627('0x8')]('/',auth[_0xb627('0x9')](),controller['index']);router[_0xb627('0x8')]('/:id',auth[_0xb627('0x9')](),controller[_0xb627('0xa')]);router[_0xb627('0x8')](_0xb627('0xb'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xb627('0xc')]({'destination':function(_0x199ef0,_0x2bd237,_0x1d4144){_0x1d4144(null,path[_0xb627('0xd')](config['root'],_0xb627('0xe')));},'filename':function(_0x853c23,_0x1e748d,_0x3fc2c5){_0x1e748d[_0xb627('0xf')]=_0x1e748d[_0xb627('0xf')][_0xb627('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3fc2c5(null,util[_0xb627('0x11')](_0xb627('0x12'),path[_0xb627('0x13')](_0x1e748d[_0xb627('0xf')],path['extname'](_0x1e748d[_0xb627('0xf')])),Date['now'](),path[_0xb627('0x14')](_0x1e748d[_0xb627('0xf')])));}})});router[_0xb627('0x15')]('/',upload[_0xb627('0x16')](_0xb627('0x17')),controller[_0xb627('0x18')]);router[_0xb627('0x19')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb627('0x1a')](_0xb627('0x1b'),auth[_0xb627('0x9')](),controller[_0xb627('0x1a')]);module[_0xb627('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 5cf5cdd..68b805e 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 _0xfb92=['name','BIGINT','INTEGER','FLOAT','sequelize','exports','STRING'];(function(_0x2300f6,_0x551b06){var _0x3083ac=function(_0x334f7d){while(--_0x334f7d){_0x2300f6['push'](_0x2300f6['shift']());}};_0x3083ac(++_0x551b06);}(_0xfb92,0x146));var _0x2fb9=function(_0x2483eb,_0x94cd8){_0x2483eb=_0x2483eb-0x0;var _0x19cf5b=_0xfb92[_0x2483eb];return _0x19cf5b;};'use strict';var Sequelize=require(_0x2fb9('0x0'));module[_0x2fb9('0x1')]={'name':{'type':Sequelize[_0x2fb9('0x2')],'unique':_0x2fb9('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x2fb9('0x2')]},'display_name':{'type':Sequelize[_0x2fb9('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x2fb9('0x4')]},'original_channelCount':{'type':Sequelize[_0x2fb9('0x5')]},'original_bitRate':{'type':Sequelize[_0x2fb9('0x4')]},'original_sampleRate':{'type':Sequelize[_0x2fb9('0x5')]},'converted_format':{'type':Sequelize[_0x2fb9('0x2')]},'converted_duration':{'type':Sequelize[_0x2fb9('0x6')]},'converted_sampleCount':{'type':Sequelize[_0x2fb9('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x2fb9('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x2fb9('0x5')]}}; \ No newline at end of file +var _0x203a=['name','FLOAT','BIGINT','INTEGER','exports','STRING'];(function(_0x3940a3,_0x47d762){var _0x58aa44=function(_0x142af9){while(--_0x142af9){_0x3940a3['push'](_0x3940a3['shift']());}};_0x58aa44(++_0x47d762);}(_0x203a,0x136));var _0xa203=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x203a[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xa203('0x0')]={'name':{'type':Sequelize[_0xa203('0x1')],'unique':_0xa203('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xa203('0x1')]},'display_name':{'type':Sequelize[_0xa203('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xa203('0x3')]},'original_sampleCount':{'type':Sequelize[_0xa203('0x4')]},'original_channelCount':{'type':Sequelize[_0xa203('0x5')]},'original_bitRate':{'type':Sequelize[_0xa203('0x4')]},'original_sampleRate':{'type':Sequelize[_0xa203('0x5')]},'converted_format':{'type':Sequelize[_0xa203('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xa203('0x5')]},'converted_bitRate':{'type':Sequelize[_0xa203('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xa203('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 4d902aa..361fdf2 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 _0x5540=['includeAll','include','show','params','find','catch','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','file','originalname','filename','extname','server/files/sounds/original','basename','info','chmodSync','0777','transcode','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','end','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','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','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','sendStatus','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count'];(function(_0x51068b,_0x12371b){var _0x2e521d=function(_0x333599){while(--_0x333599){_0x51068b['push'](_0x51068b['shift']());}};_0x2e521d(++_0x12371b);}(_0x5540,0xb7));var _0x0554=function(_0xcc488f,_0x351dca){_0xcc488f=_0xcc488f-0x0;var _0x10ed4d=_0x5540[_0xcc488f];return _0x10ed4d;};'use strict';var emlformat=require(_0x0554('0x0'));var rimraf=require(_0x0554('0x1'));var zipdir=require(_0x0554('0x2'));var jsonpatch=require(_0x0554('0x3'));var rp=require('request-promise');var moment=require(_0x0554('0x4'));var BPromise=require(_0x0554('0x5'));var Mustache=require(_0x0554('0x6'));var util=require(_0x0554('0x7'));var path=require(_0x0554('0x8'));var sox=require(_0x0554('0x9'));var csv=require(_0x0554('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0554('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0554('0xc'));var jsforce=require(_0x0554('0xd'));var deskjs=require(_0x0554('0xe'));var toCsv=require(_0x0554('0xa'));var querystring=require('querystring');var Papa=require(_0x0554('0xf'));var Redis=require(_0x0554('0x10'));var authService=require(_0x0554('0x11'));var qs=require(_0x0554('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0554('0x13'));var logger=require(_0x0554('0x14'))(_0x0554('0x15'));var utils=require(_0x0554('0x16'));var config=require(_0x0554('0x17'));var licenseUtil=require(_0x0554('0x18'));var db=require(_0x0554('0x19'))['db'];function respondWithStatusCode(_0x1d09d8,_0x40f189){_0x40f189=_0x40f189||0xcc;return function(_0x2a72bf){if(_0x2a72bf){return _0x1d09d8['sendStatus'](_0x40f189);}return _0x1d09d8[_0x0554('0x1a')](_0x40f189)['end']();};}function respondWithResult(_0x220a68,_0x37b5d5){_0x37b5d5=_0x37b5d5||0xc8;return function(_0x50186){if(_0x50186){return _0x220a68[_0x0554('0x1a')](_0x37b5d5)[_0x0554('0x1b')](_0x50186);}};}function respondWithFilteredResult(_0x219a03,_0x5419d2){return function(_0xe3a57a){if(_0xe3a57a){var _0x131afc=typeof _0x5419d2[_0x0554('0x1c')]==='undefined'&&typeof _0x5419d2[_0x0554('0x1d')]==='undefined';var _0x325dce=_0xe3a57a['count'];var _0x199d2a=_0x131afc?0x0:_0x5419d2[_0x0554('0x1c')];var _0x1f2ac7=_0x131afc?_0xe3a57a['count']:_0x5419d2['offset']+_0x5419d2[_0x0554('0x1d')];var _0x39865e;if(_0x1f2ac7>=_0x325dce){_0x1f2ac7=_0x325dce;_0x39865e=0xc8;}else{_0x39865e=0xce;}_0x219a03[_0x0554('0x1a')](_0x39865e);return _0x219a03[_0x0554('0x1e')](_0x0554('0x1f'),_0x199d2a+'-'+_0x1f2ac7+'/'+_0x325dce)[_0x0554('0x1b')](_0xe3a57a);}return null;};}function patchUpdates(_0xb9d75e){return function(_0x3fb26f){try{jsonpatch[_0x0554('0x20')](_0x3fb26f,_0xb9d75e,!![]);}catch(_0x917be5){return BPromise[_0x0554('0x21')](_0x917be5);}return _0x3fb26f[_0x0554('0x22')]();};}function saveUpdates(_0x4d4e3e,_0x3870cb){return function(_0x2aee5b){if(_0x2aee5b){return _0x2aee5b[_0x0554('0x23')](_0x4d4e3e)[_0x0554('0x24')](function(_0x4926ab){return _0x4926ab;});}return null;};}function removeEntity(_0x367372,_0xbafe93){return function(_0x55fca2){if(_0x55fca2){return _0x55fca2[_0x0554('0x25')]()['then'](function(){var _0x40b75f=_0x55fca2[_0x0554('0x26')]({'plain':!![]});var _0x5e2bcb=_0x0554('0x27');return db[_0x0554('0x28')]['destroy']({'where':{'type':_0x5e2bcb,'resourceId':_0x40b75f['id']}})[_0x0554('0x24')](function(){return _0x55fca2;});})[_0x0554('0x24')](function(){_0x367372[_0x0554('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b6307,_0x13f3ad){return function(_0x524362){if(!_0x524362){_0x4b6307[_0x0554('0x29')](0x194);}return _0x524362;};}function handleError(_0x1d1ca0,_0x1135f6){_0x1135f6=_0x1135f6||0x1f4;return function(_0x215c4f){logger[_0x0554('0x2a')](_0x215c4f[_0x0554('0x2b')]);if(_0x215c4f['name']){delete _0x215c4f[_0x0554('0x2c')];}_0x1d1ca0[_0x0554('0x1a')](_0x1135f6)[_0x0554('0x2d')](_0x215c4f);};}exports[_0x0554('0x2e')]=function(_0x51527d,_0x3997b8){var _0x52ffda={},_0x2f188a={},_0x202f6a={'count':0x0,'rows':[]};var _0xc6553e=_[_0x0554('0x2f')](db[_0x0554('0x30')][_0x0554('0x31')],function(_0x556bc){return{'name':_0x556bc[_0x0554('0x32')],'type':_0x556bc[_0x0554('0x33')][_0x0554('0x34')]};});_0x2f188a[_0x0554('0x35')]=_['map'](_0xc6553e,'name');_0x2f188a[_0x0554('0x36')]=_[_0x0554('0x37')](_0x51527d['query']);_0x2f188a[_0x0554('0x38')]=_[_0x0554('0x39')](_0x2f188a[_0x0554('0x35')],_0x2f188a['query']);_0x52ffda[_0x0554('0x3a')]=_[_0x0554('0x39')](_0x2f188a['model'],qs[_0x0554('0x3b')](_0x51527d[_0x0554('0x36')][_0x0554('0x3b')]));_0x52ffda[_0x0554('0x3a')]=_0x52ffda[_0x0554('0x3a')][_0x0554('0x3c')]?_0x52ffda[_0x0554('0x3a')]:_0x2f188a[_0x0554('0x35')];if(!_0x51527d[_0x0554('0x36')][_0x0554('0x3d')](_0x0554('0x3e'))){_0x52ffda[_0x0554('0x1d')]=qs[_0x0554('0x1d')](_0x51527d['query'][_0x0554('0x1d')]);_0x52ffda[_0x0554('0x1c')]=qs['offset'](_0x51527d[_0x0554('0x36')]['offset']);}_0x52ffda[_0x0554('0x3f')]=qs[_0x0554('0x40')](_0x51527d['query'][_0x0554('0x40')]);_0x52ffda[_0x0554('0x41')]=qs['filters'](_[_0x0554('0x42')](_0x51527d[_0x0554('0x36')],_0x2f188a[_0x0554('0x38')]),_0xc6553e);if(_0x51527d[_0x0554('0x36')][_0x0554('0x43')]){_0x52ffda[_0x0554('0x41')]=_[_0x0554('0x44')](_0x52ffda[_0x0554('0x41')],{'$or':_[_0x0554('0x2f')](_0xc6553e,function(_0x313796){if(_0x313796[_0x0554('0x33')]!=='VIRTUAL'){var _0x211354={};_0x211354[_0x313796[_0x0554('0x2c')]]={'$like':'%'+_0x51527d[_0x0554('0x36')][_0x0554('0x43')]+'%'};return _0x211354;}})});}_0x52ffda=_[_0x0554('0x44')]({},_0x52ffda,_0x51527d[_0x0554('0x45')]);var _0x5dc80f={'where':_0x52ffda[_0x0554('0x41')]};return db[_0x0554('0x30')][_0x0554('0x46')](_0x5dc80f)[_0x0554('0x24')](function(_0x4cfdcd){_0x202f6a[_0x0554('0x46')]=_0x4cfdcd;if(_0x51527d[_0x0554('0x36')][_0x0554('0x47')]){_0x52ffda[_0x0554('0x48')]=[{'all':!![]}];}return db[_0x0554('0x30')]['findAll'](_0x52ffda);})['then'](function(_0x547b0e){_0x202f6a['rows']=_0x547b0e;return _0x202f6a;})['then'](respondWithFilteredResult(_0x3997b8,_0x52ffda))['catch'](handleError(_0x3997b8,null));};exports[_0x0554('0x49')]=function(_0x2cbc0f,_0x2a62a3){var _0x4e3840={'raw':!![],'where':{'id':_0x2cbc0f[_0x0554('0x4a')]['id']}},_0x46139c={};_0x46139c[_0x0554('0x35')]=_[_0x0554('0x37')](db[_0x0554('0x30')]['rawAttributes']);_0x46139c['query']=_[_0x0554('0x37')](_0x2cbc0f[_0x0554('0x36')]);_0x46139c[_0x0554('0x38')]=_[_0x0554('0x39')](_0x46139c['model'],_0x46139c[_0x0554('0x36')]);_0x4e3840[_0x0554('0x3a')]=_[_0x0554('0x39')](_0x46139c[_0x0554('0x35')],qs[_0x0554('0x3b')](_0x2cbc0f[_0x0554('0x36')][_0x0554('0x3b')]));_0x4e3840[_0x0554('0x3a')]=_0x4e3840['attributes'][_0x0554('0x3c')]?_0x4e3840[_0x0554('0x3a')]:_0x46139c[_0x0554('0x35')];if(_0x2cbc0f['query'][_0x0554('0x47')]){_0x4e3840[_0x0554('0x48')]=[{'all':!![]}];}_0x4e3840=_[_0x0554('0x44')]({},_0x4e3840,_0x2cbc0f[_0x0554('0x45')]);return db[_0x0554('0x30')][_0x0554('0x4b')](_0x4e3840)[_0x0554('0x24')](handleEntityNotFound(_0x2a62a3,null))[_0x0554('0x24')](respondWithResult(_0x2a62a3,null))[_0x0554('0x4c')](handleError(_0x2a62a3,null));};exports[_0x0554('0x4d')]=function(_0x5f13b9,_0x5a5a10,_0x4ce83b){return db[_0x0554('0x30')][_0x0554('0x4b')]({'where':{'id':_0x5f13b9[_0x0554('0x4a')]['id']},'attributes':['name',_0x0554('0x4e'),_0x0554('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x5a5a10,null))[_0x0554('0x24')](function(_0xddc723){if(_0xddc723){if(!fs[_0x0554('0x50')](path[_0x0554('0x51')](config[_0x0554('0x52')],_0x0554('0x53'),_0xddc723['save_name']+'.'+_0xddc723[_0x0554('0x4f')]))){throw new db[(_0x0554('0x54'))][(_0x0554('0x55'))](_0x0554('0x56'));}return _0x5a5a10[_0x0554('0x4d')](path[_0x0554('0x51')](config['root'],_0x0554('0x53'),util[_0x0554('0x57')](_0x0554('0x58'),_0xddc723['save_name'],_0xddc723[_0x0554('0x4f')])),util[_0x0554('0x57')](_0x0554('0x58'),_0xddc723[_0x0554('0x2c')],_0xddc723[_0x0554('0x4f')]));}return null;})['catch'](handleError(_0x5a5a10,null));};exports[_0x0554('0x59')]=function(_0xfefcba,_0x22a3dc,_0x362a0b){var _0x52a184={'name':path['basename'](_0xfefcba[_0x0554('0x5a')][_0x0554('0x5b')],path['extname'](_0xfefcba['file'][_0x0554('0x5b')])),'save_name':path['basename'](_0xfefcba[_0x0554('0x5a')][_0x0554('0x5c')],path[_0x0554('0x5d')](_0xfefcba[_0x0554('0x5a')][_0x0554('0x5c')])),'original_format':path[_0x0554('0x5d')](_0xfefcba['file'][_0x0554('0x5b')])['substring'](0x1),'converted_format':'wav'};var _0x2f8508=path[_0x0554('0x51')](config['root'],_0x0554('0x5e'),_0xfefcba[_0x0554('0x5a')][_0x0554('0x5c')]);var _0x9d513f=path['join'](config[_0x0554('0x52')],_0x0554('0x53'),util[_0x0554('0x57')](_0x0554('0x58'),path[_0x0554('0x5f')](_0xfefcba['file'][_0x0554('0x5c')],path[_0x0554('0x5d')](_0xfefcba[_0x0554('0x5a')]['filename'])),_0x52a184[_0x0554('0x4f')]));logger[_0x0554('0x60')]('Sound\x20upload\x20filepath:\x20%s',_0x2f8508);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x9d513f);try{fs[_0x0554('0x61')](_0x2f8508,parseInt(_0x0554('0x62'),0x8));var _0x3f8134=sox[_0x0554('0x63')](_0x2f8508,_0x9d513f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3f8134['on'](_0x0554('0x2a'),function(_0x583b87){fs[_0x0554('0x64')](_0x2f8508);_0x22a3dc[_0x0554('0x1a')](0x1f4)[_0x0554('0x2d')](_0x583b87);});_0x3f8134['on'](_0x0554('0x65'),function(_0x1d1218){_0x52a184['original_duration']=isNaN(_0x1d1218[_0x0554('0x66')])?null:_0x1d1218[_0x0554('0x66')]*0x3e8;_0x52a184[_0x0554('0x67')]=isNaN(_0x1d1218[_0x0554('0x68')])?null:_0x1d1218[_0x0554('0x68')];_0x52a184[_0x0554('0x69')]=isNaN(_0x1d1218['channelCount'])?null:_0x1d1218[_0x0554('0x6a')];_0x52a184[_0x0554('0x6b')]=isNaN(_0x1d1218[_0x0554('0x6c')])?null:_0x1d1218[_0x0554('0x6c')];_0x52a184[_0x0554('0x6d')]=isNaN(_0x1d1218[_0x0554('0x6e')])?null:_0x1d1218[_0x0554('0x6e')];});_0x3f8134['on'](_0x0554('0x6f'),function(_0x208423){_0x52a184[_0x0554('0x70')]=isNaN(_0x208423[_0x0554('0x66')])?null:_0x208423['duration']*0x3e8;_0x52a184[_0x0554('0x71')]=isNaN(_0x208423[_0x0554('0x68')])?null:_0x208423[_0x0554('0x68')];_0x52a184[_0x0554('0x72')]=isNaN(_0x208423[_0x0554('0x6a')])?null:_0x208423[_0x0554('0x6a')];_0x52a184[_0x0554('0x73')]=isNaN(_0x208423['bitRate'])?null:_0x208423[_0x0554('0x6c')];_0x52a184[_0x0554('0x74')]=isNaN(_0x208423[_0x0554('0x6e')])?null:_0x208423[_0x0554('0x6e')];});_0x3f8134['on'](_0x0554('0x75'),function(){fs[_0x0554('0x61')](_0x9d513f,parseInt('0777',0x8));return db[_0x0554('0x30')]['create'](_0x52a184)[_0x0554('0x24')](function(_0x2c77aa){var _0x18c917={'role':_0xfefcba[_0x0554('0x76')][_0x0554('0x77')],'userProfileId':_0xfefcba[_0x0554('0x76')][_0x0554('0x78')]};if(!_0x18c917)throw new Error(_0x0554('0x79'));if(_0x18c917[_0x0554('0x77')]==='user'){var _0x505071=_0x2c77aa[_0x0554('0x26')]({'plain':!![]});return db['UserProfileSection'][_0x0554('0x4b')]({'where':{'name':'Sounds','userProfileId':_0x18c917[_0x0554('0x78')]},'raw':!![]})['then'](function(_0x1f7005){if(_0x1f7005&&_0x1f7005[_0x0554('0x7a')]===0x0){return db[_0x0554('0x28')][_0x0554('0x59')]({'name':_0x505071['name'],'resourceId':_0x505071['id'],'type':_0x1f7005['name'],'sectionId':_0x1f7005['id']},{})[_0x0554('0x24')](function(){return _0x2c77aa;});}else{return _0x2c77aa;}})['catch'](function(_0x38c8bb){logger[_0x0554('0x2a')](_0x0554('0x7b'),_0x38c8bb);throw _0x38c8bb;});}return _0x2c77aa;})[_0x0554('0x24')](respondWithResult(_0x22a3dc,null))[_0x0554('0x4c')](handleError(_0x22a3dc,null));});_0x3f8134[_0x0554('0x7c')]();}catch(_0x16cabb){_0x22a3dc[_0x0554('0x1a')](0x1f4)[_0x0554('0x2d')](_0x16cabb);}};exports[_0x0554('0x23')]=function(_0x48ee3e,_0x273e14,_0x36d9f1){return db['Sound'][_0x0554('0x4b')]({'where':{'id':_0x48ee3e[_0x0554('0x4a')]['id']}})[_0x0554('0x24')](handleEntityNotFound(_0x273e14,null))[_0x0554('0x24')](saveUpdates(_[_0x0554('0x42')](_0x48ee3e['body'],[_0x0554('0x2c'),_0x0554('0x7d')]),null))[_0x0554('0x24')](respondWithResult(_0x273e14,null))[_0x0554('0x4c')](handleError(_0x273e14,null));};exports[_0x0554('0x7e')]=function(_0x28b35f,_0x1e046e,_0x32a0a1){return db[_0x0554('0x30')][_0x0554('0x4b')]({'where':{'id':_0x28b35f[_0x0554('0x4a')]['id']}})[_0x0554('0x24')](function(_0x41811c){if(_0x41811c){return _0x41811c[_0x0554('0x25')]();}})[_0x0554('0x24')](function(_0x2031ad){var _0x4dc02f=path[_0x0554('0x51')](config[_0x0554('0x52')],_0x0554('0x5e'),util['format'](_0x0554('0x58'),_0x2031ad[_0x0554('0x4e')],_0x2031ad['original_format']));var _0x56f43c=path[_0x0554('0x51')](config[_0x0554('0x52')],_0x0554('0x53'),util[_0x0554('0x57')]('%s.%s',_0x2031ad['save_name'],_0x2031ad['converted_format']));fs[_0x0554('0x64')](_0x4dc02f);fs[_0x0554('0x64')](_0x56f43c);return _0x2031ad;})[_0x0554('0x24')](function(_0x44dbc3){if(_0x44dbc3){return _0x1e046e[_0x0554('0x1a')](0xcc)[_0x0554('0x75')]();}})[_0x0554('0x24')](handleEntityNotFound(_0x1e046e,null))['catch'](handleError(_0x1e046e,null));}; \ No newline at end of file +var _0x1476=['body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','description','delete','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../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','apply','reject','save','update','destroy','then','Sounds','end','error','stack','send','index','Sound','rawAttributes','fieldName','type','model','map','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','download','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','basename','file','originalname','extname','filename','substring','root','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','channelCount','converted_bitRate','converted_sampleRate','create'];(function(_0x2330cf,_0x5add9f){var _0x5e230f=function(_0x1f44f7){while(--_0x1f44f7){_0x2330cf['push'](_0x2330cf['shift']());}};_0x5e230f(++_0x5add9f);}(_0x1476,0x8a));var _0x6147=function(_0x5a75d3,_0x3f9427){_0x5a75d3=_0x5a75d3-0x0;var _0x1fe768=_0x1476[_0x5a75d3];return _0x1fe768;};'use strict';var emlformat=require(_0x6147('0x0'));var rimraf=require(_0x6147('0x1'));var zipdir=require(_0x6147('0x2'));var jsonpatch=require(_0x6147('0x3'));var rp=require(_0x6147('0x4'));var moment=require(_0x6147('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6147('0x6'));var util=require('util');var path=require(_0x6147('0x7'));var sox=require(_0x6147('0x8'));var csv=require(_0x6147('0x9'));var ejs=require(_0x6147('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6147('0xb'));var crypto=require(_0x6147('0xc'));var jsforce=require(_0x6147('0xd'));var deskjs=require(_0x6147('0xe'));var toCsv=require(_0x6147('0x9'));var querystring=require(_0x6147('0xf'));var Papa=require('papaparse');var Redis=require(_0x6147('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6147('0x11'));var as=require(_0x6147('0x12'));var hardwareService=require(_0x6147('0x13'));var logger=require(_0x6147('0x14'))(_0x6147('0x15'));var utils=require(_0x6147('0x16'));var config=require(_0x6147('0x17'));var licenseUtil=require(_0x6147('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f4275,_0x207f19){_0x207f19=_0x207f19||0xcc;return function(_0x2c7bc4){if(_0x2c7bc4){return _0x2f4275[_0x6147('0x19')](_0x207f19);}return _0x2f4275[_0x6147('0x1a')](_0x207f19)['end']();};}function respondWithResult(_0x469fa5,_0x1205b2){_0x1205b2=_0x1205b2||0xc8;return function(_0x4962a7){if(_0x4962a7){return _0x469fa5['status'](_0x1205b2)['json'](_0x4962a7);}};}function respondWithFilteredResult(_0x807475,_0x4ff887){return function(_0x5b0db8){if(_0x5b0db8){var _0x12f00b=typeof _0x4ff887[_0x6147('0x1b')]===_0x6147('0x1c')&&typeof _0x4ff887[_0x6147('0x1d')]===_0x6147('0x1c');var _0xe1cc66=_0x5b0db8[_0x6147('0x1e')];var _0x5ba2a6=_0x12f00b?0x0:_0x4ff887[_0x6147('0x1b')];var _0x450a86=_0x12f00b?_0x5b0db8[_0x6147('0x1e')]:_0x4ff887[_0x6147('0x1b')]+_0x4ff887[_0x6147('0x1d')];var _0x2e0ca1;if(_0x450a86>=_0xe1cc66){_0x450a86=_0xe1cc66;_0x2e0ca1=0xc8;}else{_0x2e0ca1=0xce;}_0x807475[_0x6147('0x1a')](_0x2e0ca1);return _0x807475[_0x6147('0x1f')](_0x6147('0x20'),_0x5ba2a6+'-'+_0x450a86+'/'+_0xe1cc66)[_0x6147('0x21')](_0x5b0db8);}return null;};}function patchUpdates(_0x370863){return function(_0x45ec6f){try{jsonpatch[_0x6147('0x22')](_0x45ec6f,_0x370863,!![]);}catch(_0x409ffe){return BPromise[_0x6147('0x23')](_0x409ffe);}return _0x45ec6f[_0x6147('0x24')]();};}function saveUpdates(_0x2332a4,_0x55a8c4){return function(_0x4a0bec){if(_0x4a0bec){return _0x4a0bec[_0x6147('0x25')](_0x2332a4)['then'](function(_0x16d99e){return _0x16d99e;});}return null;};}function removeEntity(_0x1f2dcb,_0xc069e5){return function(_0xe3799){if(_0xe3799){return _0xe3799[_0x6147('0x26')]()[_0x6147('0x27')](function(){var _0x13455b=_0xe3799['get']({'plain':!![]});var _0x52e437=_0x6147('0x28');return db['UserProfileResource'][_0x6147('0x26')]({'where':{'type':_0x52e437,'resourceId':_0x13455b['id']}})['then'](function(){return _0xe3799;});})[_0x6147('0x27')](function(){_0x1f2dcb[_0x6147('0x1a')](0xcc)[_0x6147('0x29')]();});}};}function handleEntityNotFound(_0x19c6fc,_0x5560e8){return function(_0x53e731){if(!_0x53e731){_0x19c6fc[_0x6147('0x19')](0x194);}return _0x53e731;};}function handleError(_0x37f8ff,_0x3dc185){_0x3dc185=_0x3dc185||0x1f4;return function(_0x1653e4){logger[_0x6147('0x2a')](_0x1653e4[_0x6147('0x2b')]);if(_0x1653e4['name']){delete _0x1653e4['name'];}_0x37f8ff[_0x6147('0x1a')](_0x3dc185)[_0x6147('0x2c')](_0x1653e4);};}exports[_0x6147('0x2d')]=function(_0xddd698,_0x10d2d3){var _0x1a1a58={},_0x2c629a={},_0x529ba9={'count':0x0,'rows':[]};var _0x457ee3=_['map'](db[_0x6147('0x2e')][_0x6147('0x2f')],function(_0x52de41){return{'name':_0x52de41[_0x6147('0x30')],'type':_0x52de41[_0x6147('0x31')]['key']};});_0x2c629a[_0x6147('0x32')]=_[_0x6147('0x33')](_0x457ee3,_0x6147('0x34'));_0x2c629a['query']=_['keys'](_0xddd698[_0x6147('0x35')]);_0x2c629a['filters']=_[_0x6147('0x36')](_0x2c629a[_0x6147('0x32')],_0x2c629a['query']);_0x1a1a58[_0x6147('0x37')]=_[_0x6147('0x36')](_0x2c629a[_0x6147('0x32')],qs[_0x6147('0x38')](_0xddd698['query'][_0x6147('0x38')]));_0x1a1a58[_0x6147('0x37')]=_0x1a1a58[_0x6147('0x37')][_0x6147('0x39')]?_0x1a1a58[_0x6147('0x37')]:_0x2c629a[_0x6147('0x32')];if(!_0xddd698[_0x6147('0x35')][_0x6147('0x3a')](_0x6147('0x3b'))){_0x1a1a58['limit']=qs['limit'](_0xddd698['query']['limit']);_0x1a1a58[_0x6147('0x1b')]=qs['offset'](_0xddd698[_0x6147('0x35')][_0x6147('0x1b')]);}_0x1a1a58[_0x6147('0x3c')]=qs[_0x6147('0x3d')](_0xddd698[_0x6147('0x35')][_0x6147('0x3d')]);_0x1a1a58['where']=qs[_0x6147('0x3e')](_[_0x6147('0x3f')](_0xddd698[_0x6147('0x35')],_0x2c629a[_0x6147('0x3e')]),_0x457ee3);if(_0xddd698['query'][_0x6147('0x40')]){_0x1a1a58[_0x6147('0x41')]=_[_0x6147('0x42')](_0x1a1a58[_0x6147('0x41')],{'$or':_[_0x6147('0x33')](_0x457ee3,function(_0x389994){if(_0x389994[_0x6147('0x31')]!==_0x6147('0x43')){var _0x4b5278={};_0x4b5278[_0x389994[_0x6147('0x34')]]={'$like':'%'+_0xddd698[_0x6147('0x35')][_0x6147('0x40')]+'%'};return _0x4b5278;}})});}_0x1a1a58=_[_0x6147('0x42')]({},_0x1a1a58,_0xddd698[_0x6147('0x44')]);var _0x238344={'where':_0x1a1a58[_0x6147('0x41')]};return db[_0x6147('0x2e')]['count'](_0x238344)[_0x6147('0x27')](function(_0x58e2a4){_0x529ba9['count']=_0x58e2a4;if(_0xddd698['query'][_0x6147('0x45')]){_0x1a1a58[_0x6147('0x46')]=[{'all':!![]}];}return db[_0x6147('0x2e')][_0x6147('0x47')](_0x1a1a58);})[_0x6147('0x27')](function(_0x23efb4){_0x529ba9[_0x6147('0x48')]=_0x23efb4;return _0x529ba9;})[_0x6147('0x27')](respondWithFilteredResult(_0x10d2d3,_0x1a1a58))[_0x6147('0x49')](handleError(_0x10d2d3,null));};exports['show']=function(_0x3af0ca,_0x85f0e8){var _0x1d3d91={'raw':!![],'where':{'id':_0x3af0ca[_0x6147('0x4a')]['id']}},_0x2464f3={};_0x2464f3['model']=_[_0x6147('0x4b')](db[_0x6147('0x2e')]['rawAttributes']);_0x2464f3[_0x6147('0x35')]=_['keys'](_0x3af0ca[_0x6147('0x35')]);_0x2464f3['filters']=_[_0x6147('0x36')](_0x2464f3[_0x6147('0x32')],_0x2464f3['query']);_0x1d3d91['attributes']=_[_0x6147('0x36')](_0x2464f3[_0x6147('0x32')],qs[_0x6147('0x38')](_0x3af0ca[_0x6147('0x35')]['fields']));_0x1d3d91['attributes']=_0x1d3d91[_0x6147('0x37')][_0x6147('0x39')]?_0x1d3d91[_0x6147('0x37')]:_0x2464f3['model'];if(_0x3af0ca['query'][_0x6147('0x45')]){_0x1d3d91[_0x6147('0x46')]=[{'all':!![]}];}_0x1d3d91=_[_0x6147('0x42')]({},_0x1d3d91,_0x3af0ca[_0x6147('0x44')]);return db[_0x6147('0x2e')][_0x6147('0x4c')](_0x1d3d91)[_0x6147('0x27')](handleEntityNotFound(_0x85f0e8,null))['then'](respondWithResult(_0x85f0e8,null))[_0x6147('0x49')](handleError(_0x85f0e8,null));};exports[_0x6147('0x4d')]=function(_0x3e2f46,_0x47e363,_0x2189d1){return db[_0x6147('0x2e')]['find']({'where':{'id':_0x3e2f46[_0x6147('0x4a')]['id']},'attributes':[_0x6147('0x34'),_0x6147('0x4e'),_0x6147('0x4f')],'raw':!![]})[_0x6147('0x27')](handleEntityNotFound(_0x47e363,null))[_0x6147('0x27')](function(_0xd6bb77){if(_0xd6bb77){if(!fs[_0x6147('0x50')](path[_0x6147('0x51')](config['root'],_0x6147('0x52'),_0xd6bb77[_0x6147('0x4e')]+'.'+_0xd6bb77[_0x6147('0x4f')]))){throw new db[(_0x6147('0x53'))][(_0x6147('0x54'))](_0x6147('0x55'));}return _0x47e363[_0x6147('0x4d')](path['join'](config['root'],_0x6147('0x52'),util[_0x6147('0x56')]('%s.%s',_0xd6bb77[_0x6147('0x4e')],_0xd6bb77[_0x6147('0x4f')])),util['format'](_0x6147('0x57'),_0xd6bb77[_0x6147('0x34')],_0xd6bb77[_0x6147('0x4f')]));}return null;})['catch'](handleError(_0x47e363,null));};exports['create']=function(_0x416528,_0x420d5a,_0x1b185f){var _0x16e274={'name':path[_0x6147('0x58')](_0x416528[_0x6147('0x59')][_0x6147('0x5a')],path[_0x6147('0x5b')](_0x416528[_0x6147('0x59')][_0x6147('0x5a')])),'save_name':path[_0x6147('0x58')](_0x416528[_0x6147('0x59')][_0x6147('0x5c')],path[_0x6147('0x5b')](_0x416528['file']['filename'])),'original_format':path[_0x6147('0x5b')](_0x416528[_0x6147('0x59')][_0x6147('0x5a')])[_0x6147('0x5d')](0x1),'converted_format':'wav'};var _0x1854e9=path[_0x6147('0x51')](config[_0x6147('0x5e')],_0x6147('0x5f'),_0x416528['file'][_0x6147('0x5c')]);var _0x264e68=path[_0x6147('0x51')](config[_0x6147('0x5e')],_0x6147('0x52'),util[_0x6147('0x56')](_0x6147('0x57'),path[_0x6147('0x58')](_0x416528[_0x6147('0x59')]['filename'],path[_0x6147('0x5b')](_0x416528[_0x6147('0x59')][_0x6147('0x5c')])),_0x16e274[_0x6147('0x4f')]));logger['info'](_0x6147('0x60'),_0x1854e9);logger[_0x6147('0x61')](_0x6147('0x62'),_0x264e68);try{fs[_0x6147('0x63')](_0x1854e9,parseInt(_0x6147('0x64'),0x8));var _0x14afab=sox[_0x6147('0x65')](_0x1854e9,_0x264e68,{'sampleRate':0x1f40,'format':_0x6147('0x66'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x14afab['on'](_0x6147('0x2a'),function(_0x2671e9){fs[_0x6147('0x67')](_0x1854e9);_0x420d5a[_0x6147('0x1a')](0x1f4)[_0x6147('0x2c')](_0x2671e9);});_0x14afab['on'](_0x6147('0x68'),function(_0x3772c2){_0x16e274[_0x6147('0x69')]=isNaN(_0x3772c2['duration'])?null:_0x3772c2[_0x6147('0x6a')]*0x3e8;_0x16e274[_0x6147('0x6b')]=isNaN(_0x3772c2[_0x6147('0x6c')])?null:_0x3772c2[_0x6147('0x6c')];_0x16e274[_0x6147('0x6d')]=isNaN(_0x3772c2['channelCount'])?null:_0x3772c2['channelCount'];_0x16e274['original_bitRate']=isNaN(_0x3772c2[_0x6147('0x6e')])?null:_0x3772c2[_0x6147('0x6e')];_0x16e274['original_sampleRate']=isNaN(_0x3772c2[_0x6147('0x6f')])?null:_0x3772c2[_0x6147('0x6f')];});_0x14afab['on'](_0x6147('0x70'),function(_0x572089){_0x16e274[_0x6147('0x71')]=isNaN(_0x572089['duration'])?null:_0x572089[_0x6147('0x6a')]*0x3e8;_0x16e274[_0x6147('0x72')]=isNaN(_0x572089['sampleCount'])?null:_0x572089[_0x6147('0x6c')];_0x16e274[_0x6147('0x73')]=isNaN(_0x572089[_0x6147('0x74')])?null:_0x572089[_0x6147('0x74')];_0x16e274[_0x6147('0x75')]=isNaN(_0x572089['bitRate'])?null:_0x572089[_0x6147('0x6e')];_0x16e274[_0x6147('0x76')]=isNaN(_0x572089[_0x6147('0x6f')])?null:_0x572089[_0x6147('0x6f')];});_0x14afab['on'](_0x6147('0x29'),function(){fs[_0x6147('0x63')](_0x264e68,parseInt(_0x6147('0x64'),0x8));return db[_0x6147('0x2e')][_0x6147('0x77')](_0x16e274)['then'](function(_0x106368){var _0x56077e={'role':_0x416528[_0x6147('0x78')][_0x6147('0x79')],'userProfileId':_0x416528[_0x6147('0x78')][_0x6147('0x7a')]};if(!_0x56077e)throw new Error(_0x6147('0x7b'));if(_0x56077e[_0x6147('0x79')]==='user'){var _0x2fb539=_0x106368['get']({'plain':!![]});return db[_0x6147('0x7c')][_0x6147('0x4c')]({'where':{'name':_0x6147('0x28'),'userProfileId':_0x56077e[_0x6147('0x7a')]},'raw':!![]})['then'](function(_0xc4a684){if(_0xc4a684&&_0xc4a684[_0x6147('0x7d')]===0x0){return db[_0x6147('0x7e')][_0x6147('0x77')]({'name':_0x2fb539[_0x6147('0x34')],'resourceId':_0x2fb539['id'],'type':_0xc4a684[_0x6147('0x34')],'sectionId':_0xc4a684['id']},{})[_0x6147('0x27')](function(){return _0x106368;});}else{return _0x106368;}})[_0x6147('0x49')](function(_0x9939a6){logger[_0x6147('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9939a6);throw _0x9939a6;});}return _0x106368;})['then'](respondWithResult(_0x420d5a,null))['catch'](handleError(_0x420d5a,null));});_0x14afab['start']();}catch(_0x4f7da8){_0x420d5a['status'](0x1f4)[_0x6147('0x2c')](_0x4f7da8);}};exports['update']=function(_0x2a94ff,_0xcfcc6b,_0x212cb4){return db[_0x6147('0x2e')][_0x6147('0x4c')]({'where':{'id':_0x2a94ff[_0x6147('0x4a')]['id']}})['then'](handleEntityNotFound(_0xcfcc6b,null))[_0x6147('0x27')](saveUpdates(_[_0x6147('0x3f')](_0x2a94ff[_0x6147('0x78')],[_0x6147('0x34'),_0x6147('0x7f')]),null))[_0x6147('0x27')](respondWithResult(_0xcfcc6b,null))[_0x6147('0x49')](handleError(_0xcfcc6b,null));};exports[_0x6147('0x80')]=function(_0x32c791,_0x5a5b92,_0x18f50c){return db[_0x6147('0x2e')]['find']({'where':{'id':_0x32c791['params']['id']}})['then'](function(_0x155c44){if(_0x155c44){return _0x155c44[_0x6147('0x26')]();}})[_0x6147('0x27')](function(_0x3bf7d7){var _0x3ca07d=path[_0x6147('0x51')](config[_0x6147('0x5e')],_0x6147('0x5f'),util[_0x6147('0x56')]('%s.%s',_0x3bf7d7[_0x6147('0x4e')],_0x3bf7d7['original_format']));var _0x49efc7=path[_0x6147('0x51')](config[_0x6147('0x5e')],'server/files/sounds/converted',util[_0x6147('0x56')](_0x6147('0x57'),_0x3bf7d7[_0x6147('0x4e')],_0x3bf7d7[_0x6147('0x4f')]));fs[_0x6147('0x67')](_0x3ca07d);fs[_0x6147('0x67')](_0x49efc7);return _0x3bf7d7;})[_0x6147('0x27')](function(_0x23d6df){if(_0x23d6df){return _0x5a5b92[_0x6147('0x1a')](0xcc)[_0x6147('0x29')]();}})[_0x6147('0x27')](handleEntityNotFound(_0x5a5b92,null))[_0x6147('0x49')](handleError(_0x5a5b92,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index ba05432..8d30fcc 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 _0x22f8=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds'];(function(_0x40c275,_0x43914c){var _0x210636=function(_0x14ced1){while(--_0x14ced1){_0x40c275['push'](_0x40c275['shift']());}};_0x210636(++_0x43914c);}(_0x22f8,0x9a));var _0x822f=function(_0x1ef5cb,_0x3a9a73){_0x1ef5cb=_0x1ef5cb-0x0;var _0x198a87=_0x22f8[_0x1ef5cb];return _0x198a87;};'use strict';var _=require(_0x822f('0x0'));var util=require(_0x822f('0x1'));var logger=require(_0x822f('0x2'))('api');var moment=require(_0x822f('0x3'));var BPromise=require(_0x822f('0x4'));var rp=require(_0x822f('0x5'));var fs=require('fs');var path=require(_0x822f('0x6'));var rimraf=require(_0x822f('0x7'));var config=require(_0x822f('0x8'));var attributes=require(_0x822f('0x9'));module[_0x822f('0xa')]=function(_0x36b14b,_0x27c721){return _0x36b14b[_0x822f('0xb')](_0x822f('0xc'),attributes,{'tableName':_0x822f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x687f=['Sound','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define'];(function(_0x509dad,_0x1f995f){var _0x21e122=function(_0x2a9b90){while(--_0x2a9b90){_0x509dad['push'](_0x509dad['shift']());}};_0x21e122(++_0x1f995f);}(_0x687f,0x194));var _0xf687=function(_0x2797c6,_0x37421b){_0x2797c6=_0x2797c6-0x0;var _0x54809f=_0x687f[_0x2797c6];return _0x54809f;};'use strict';var _=require(_0xf687('0x0'));var util=require(_0xf687('0x1'));var logger=require(_0xf687('0x2'))(_0xf687('0x3'));var moment=require('moment');var BPromise=require(_0xf687('0x4'));var rp=require(_0xf687('0x5'));var fs=require('fs');var path=require(_0xf687('0x6'));var rimraf=require(_0xf687('0x7'));var config=require(_0xf687('0x8'));var attributes=require(_0xf687('0x9'));module[_0xf687('0xa')]=function(_0x5490e0,_0x3f9cb8){return _0x5490e0[_0xf687('0xb')](_0xf687('0xc'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 14f3131..ae8094b 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 _0x0043=['info','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Sound,\x20%s,\x20%s','result','catch','ShowSound','Sound','options','raw','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x241de8,_0x24c165){var _0x19fb75=function(_0x3f1515){while(--_0x3f1515){_0x241de8['push'](_0x241de8['shift']());}};_0x19fb75(++_0x24c165);}(_0x0043,0xcd));var _0x3004=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x0043[_0x469a3c];return _0x968f4;};'use strict';var _=require(_0x3004('0x0'));var util=require('util');var moment=require(_0x3004('0x1'));var BPromise=require(_0x3004('0x2'));var rs=require(_0x3004('0x3'));var fs=require('fs');var Redis=require(_0x3004('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3004('0x5'));var logger=require(_0x3004('0x6'))(_0x3004('0x7'));var config=require(_0x3004('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3004('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3289c9,_0x4cbbbe,_0x43fd77){return new BPromise(function(_0x3c3ec8,_0x2518ac){return client[_0x3004('0xa')](_0x3289c9,_0x43fd77)[_0x3004('0xb')](function(_0x51d96e){logger[_0x3004('0xc')]('Sound,\x20%s,\x20%s',_0x4cbbbe,'request\x20sent');logger[_0x3004('0xd')](_0x3004('0xe'),_0x4cbbbe,_0x3004('0xf'),JSON[_0x3004('0x10')](_0x51d96e));if(_0x51d96e[_0x3004('0x11')]){if(_0x51d96e[_0x3004('0x11')]['code']===0x1f4){logger[_0x3004('0x11')]('Sound,\x20%s,\x20%s',_0x4cbbbe,_0x51d96e['error']['message']);return _0x2518ac(_0x51d96e['error'][_0x3004('0x12')]);}logger[_0x3004('0x11')](_0x3004('0x13'),_0x4cbbbe,_0x51d96e[_0x3004('0x11')][_0x3004('0x12')]);return _0x3c3ec8(_0x51d96e['error'][_0x3004('0x12')]);}else{logger[_0x3004('0xc')]('Sound,\x20%s,\x20%s',_0x4cbbbe,'request\x20sent');_0x3c3ec8(_0x51d96e[_0x3004('0x14')][_0x3004('0x12')]);}})[_0x3004('0x15')](function(_0xa87edf){logger[_0x3004('0x11')]('Sound,\x20%s,\x20%s',_0x4cbbbe,_0xa87edf);_0x2518ac(_0xa87edf);});});}exports[_0x3004('0x16')]=function(_0x266773){var _0x407cb2=this;return new Promise(function(_0x4578da,_0x5dd1d0){return db[_0x3004('0x17')]['find']({'raw':_0x266773[_0x3004('0x18')]?_0x266773[_0x3004('0x18')][_0x3004('0x19')]===undefined?!![]:![]:!![],'where':_0x266773['options']?_0x266773[_0x3004('0x18')][_0x3004('0x1a')]||null:null,'attributes':_0x266773[_0x3004('0x18')]?_0x266773[_0x3004('0x18')][_0x3004('0x1b')]||null:null,'include':_0x266773['options']?_0x266773[_0x3004('0x18')][_0x3004('0x1c')]?_[_0x3004('0x1d')](_0x266773[_0x3004('0x18')][_0x3004('0x1c')],function(_0x1285e7){return{'model':db[_0x1285e7['model']],'as':_0x1285e7['as'],'attributes':_0x1285e7[_0x3004('0x1b')],'include':_0x1285e7[_0x3004('0x1c')]?_[_0x3004('0x1d')](_0x1285e7[_0x3004('0x1c')],function(_0x1e559a){return{'model':db[_0x1e559a[_0x3004('0x1e')]],'as':_0x1e559a['as'],'attributes':_0x1e559a[_0x3004('0x1b')],'include':_0x1e559a[_0x3004('0x1c')]?_[_0x3004('0x1d')](_0x1e559a[_0x3004('0x1c')],function(_0x141223){return{'model':db[_0x141223['model']],'as':_0x141223['as'],'attributes':_0x141223['attributes']};}):[]};}):[]};}):[]:[]})[_0x3004('0xb')](function(_0x24c30c){logger[_0x3004('0xc')](_0x3004('0x16'),_0x266773);logger[_0x3004('0xd')]('ShowSound',_0x266773,JSON[_0x3004('0x10')](_0x24c30c));_0x4578da(_0x24c30c);})['catch'](function(_0xdc9fe2){logger['error']('ShowSound',_0xdc9fe2[_0x3004('0x12')],_0x266773);_0x5dd1d0(_0x407cb2[_0x3004('0x11')](0x1f4,_0xdc9fe2[_0x3004('0x12')]));});});}; \ No newline at end of file +var _0x8888=['stringify','code','error','message','result','catch','ShowSound','Sound','find','options','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3b60ef,_0x270e26){var _0x391fc3=function(_0x589fc1){while(--_0x589fc1){_0x3b60ef['push'](_0x3b60ef['shift']());}};_0x391fc3(++_0x270e26);}(_0x8888,0x140));var _0x8888=function(_0x486f0e,_0x3c9877){_0x486f0e=_0x486f0e-0x0;var _0x34f9b3=_0x8888[_0x486f0e];return _0x34f9b3;};'use strict';var _=require(_0x8888('0x0'));var util=require(_0x8888('0x1'));var moment=require(_0x8888('0x2'));var BPromise=require(_0x8888('0x3'));var rs=require(_0x8888('0x4'));var fs=require('fs');var Redis=require(_0x8888('0x5'));var db=require(_0x8888('0x6'))['db'];var utils=require(_0x8888('0x7'));var logger=require('../../config/logger')(_0x8888('0x8'));var config=require(_0x8888('0x9'));var jayson=require(_0x8888('0xa'));var client=jayson[_0x8888('0xb')][_0x8888('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d1e62,_0x140f12,_0x93af04){return new BPromise(function(_0x3383f8,_0x360542){return client[_0x8888('0xd')](_0x3d1e62,_0x93af04)[_0x8888('0xe')](function(_0x54b5a5){logger[_0x8888('0xf')](_0x8888('0x10'),_0x140f12,'request\x20sent');logger[_0x8888('0x11')](_0x8888('0x12'),_0x140f12,_0x8888('0x13'),JSON[_0x8888('0x14')](_0x54b5a5));if(_0x54b5a5['error']){if(_0x54b5a5['error'][_0x8888('0x15')]===0x1f4){logger[_0x8888('0x16')]('Sound,\x20%s,\x20%s',_0x140f12,_0x54b5a5[_0x8888('0x16')][_0x8888('0x17')]);return _0x360542(_0x54b5a5[_0x8888('0x16')][_0x8888('0x17')]);}logger[_0x8888('0x16')](_0x8888('0x10'),_0x140f12,_0x54b5a5[_0x8888('0x16')]['message']);return _0x3383f8(_0x54b5a5[_0x8888('0x16')][_0x8888('0x17')]);}else{logger[_0x8888('0xf')]('Sound,\x20%s,\x20%s',_0x140f12,'request\x20sent');_0x3383f8(_0x54b5a5[_0x8888('0x18')][_0x8888('0x17')]);}})[_0x8888('0x19')](function(_0x32a017){logger[_0x8888('0x16')](_0x8888('0x10'),_0x140f12,_0x32a017);_0x360542(_0x32a017);});});}exports[_0x8888('0x1a')]=function(_0x4fe78f){var _0x130ad5=this;return new Promise(function(_0x301c09,_0x399fde){return db[_0x8888('0x1b')][_0x8888('0x1c')]({'raw':_0x4fe78f['options']?_0x4fe78f['options']['raw']===undefined?!![]:![]:!![],'where':_0x4fe78f[_0x8888('0x1d')]?_0x4fe78f['options']['where']||null:null,'attributes':_0x4fe78f[_0x8888('0x1d')]?_0x4fe78f[_0x8888('0x1d')][_0x8888('0x1e')]||null:null,'include':_0x4fe78f[_0x8888('0x1d')]?_0x4fe78f[_0x8888('0x1d')]['include']?_[_0x8888('0x1f')](_0x4fe78f[_0x8888('0x1d')][_0x8888('0x20')],function(_0x21e547){return{'model':db[_0x21e547[_0x8888('0x21')]],'as':_0x21e547['as'],'attributes':_0x21e547[_0x8888('0x1e')],'include':_0x21e547[_0x8888('0x20')]?_[_0x8888('0x1f')](_0x21e547[_0x8888('0x20')],function(_0x3744dc){return{'model':db[_0x3744dc[_0x8888('0x21')]],'as':_0x3744dc['as'],'attributes':_0x3744dc[_0x8888('0x1e')],'include':_0x3744dc[_0x8888('0x20')]?_[_0x8888('0x1f')](_0x3744dc[_0x8888('0x20')],function(_0x333354){return{'model':db[_0x333354[_0x8888('0x21')]],'as':_0x333354['as'],'attributes':_0x333354[_0x8888('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8888('0xe')](function(_0x443c2c){logger[_0x8888('0xf')](_0x8888('0x1a'),_0x4fe78f);logger['debug'](_0x8888('0x1a'),_0x4fe78f,JSON['stringify'](_0x443c2c));_0x301c09(_0x443c2c);})[_0x8888('0x19')](function(_0x20c1e2){logger[_0x8888('0x16')](_0x8888('0x1a'),_0x20c1e2[_0x8888('0x17')],_0x4fe78f);_0x399fde(_0x130ad5['error'](0x1f4,_0x20c1e2[_0x8888('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index c77bf32..15b1cb0 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 _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x44e7b6,_0x227953){var _0x325047=function(_0x5ccc8a){while(--_0x5ccc8a){_0x44e7b6['push'](_0x44e7b6['shift']());}};_0x325047(++_0x227953);}(_0xda2d,0x102));var _0xdda2=function(_0x5e18f7,_0x523d1c){_0x5e18f7=_0x5e18f7-0x0;var _0x2e58f1=_0xda2d[_0x5e18f7];return _0x2e58f1;};'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('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file +var _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x45b190,_0x6297da){var _0x46234d=function(_0x41f5ad){while(--_0x41f5ad){_0x45b190['push'](_0x45b190['shift']());}};_0x46234d(++_0x6297da);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3a3c17,_0x5b7b7e){_0x3a3c17=_0x3a3c17-0x0;var _0xd07f21=_0x0b0e[_0x3a3c17];return _0xd07f21;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index e063014..ac78083 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 _0x5f25=['medium','ENUM','out','sequelize','STRING','TEXT'];(function(_0x430c98,_0x3c312d){var _0xfa574d=function(_0x10f0eb){while(--_0x10f0eb){_0x430c98['push'](_0x430c98['shift']());}};_0xfa574d(++_0x3c312d);}(_0x5f25,0x177));var _0x55f2=function(_0x178668,_0x1ec300){_0x178668=_0x178668-0x0;var _0x26107d=_0x5f25[_0x178668];return _0x26107d;};'use strict';var Sequelize=require(_0x55f2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x55f2('0x1')]},'body':{'type':Sequelize[_0x55f2('0x2')](_0x55f2('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x55f2('0x4')]('in','out'),'defaultValue':_0x55f2('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x55f2('0x1')]},'providerResponse':{'type':Sequelize[_0x55f2('0x2')]}}; \ No newline at end of file +var _0x4fc9=['sequelize','exports','STRING','TEXT','medium','ENUM','out'];(function(_0x1157c3,_0x18f174){var _0x287d2a=function(_0x4d4da7){while(--_0x4d4da7){_0x1157c3['push'](_0x1157c3['shift']());}};_0x287d2a(++_0x18f174);}(_0x4fc9,0x1a4));var _0x94fc=function(_0x46e319,_0x2afb65){_0x46e319=_0x46e319-0x0;var _0x5b5b7d=_0x4fc9[_0x46e319];return _0x5b5b7d;};'use strict';var Sequelize=require(_0x94fc('0x0'));module[_0x94fc('0x1')]={'uniqueid':{'type':Sequelize[_0x94fc('0x2')]},'body':{'type':Sequelize[_0x94fc('0x3')](_0x94fc('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x94fc('0x5')]('in',_0x94fc('0x6')),'defaultValue':_0x94fc('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x94fc('0x2')]},'providerResponse':{'type':Sequelize[_0x94fc('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 6db5e03..62f6ba6 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 _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','SquareMessage','includeAll','include','findAll','rows','catch','params','options','find','create','body','eml-format','rimraf','zip-dir'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xa848,0x99));var _0x8a84=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa848[_0x4b369d];return _0x571a98;};'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['SquareMessage'][_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['SquareMessage'][_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['SquareMessage'][_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['SquareMessage'][_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 +var _0x6dc0=['../../config/license/util','sendStatus','status','undefined','limit','count','offset','Content-Range','apply','reject','save','then','name','send','index','map','SquareMessage','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x2e36e0,_0x3c8bbc){var _0x4abb14=function(_0x277fcd){while(--_0x277fcd){_0x2e36e0['push'](_0x2e36e0['shift']());}};_0x4abb14(++_0x3c8bbc);}(_0x6dc0,0xb6));var _0x06dc=function(_0x37086c,_0x4b1fb8){_0x37086c=_0x37086c-0x0;var _0x77f118=_0x6dc0[_0x37086c];return _0x77f118;};'use strict';var emlformat=require(_0x06dc('0x0'));var rimraf=require(_0x06dc('0x1'));var zipdir=require(_0x06dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06dc('0x3'));var moment=require(_0x06dc('0x4'));var BPromise=require(_0x06dc('0x5'));var Mustache=require(_0x06dc('0x6'));var util=require('util');var path=require(_0x06dc('0x7'));var sox=require(_0x06dc('0x8'));var csv=require('to-csv');var ejs=require(_0x06dc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06dc('0xa'));var squel=require(_0x06dc('0xb'));var crypto=require(_0x06dc('0xc'));var jsforce=require(_0x06dc('0xd'));var deskjs=require(_0x06dc('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x06dc('0xf'));var authService=require(_0x06dc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x06dc('0x11'));var hardwareService=require(_0x06dc('0x12'));var logger=require(_0x06dc('0x13'))(_0x06dc('0x14'));var utils=require('../../config/utils');var config=require(_0x06dc('0x15'));var licenseUtil=require(_0x06dc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x527806,_0x534c07){_0x534c07=_0x534c07||0xcc;return function(_0x4f086f){if(_0x4f086f){return _0x527806[_0x06dc('0x17')](_0x534c07);}return _0x527806['status'](_0x534c07)['end']();};}function respondWithResult(_0x4874ce,_0x196cfd){_0x196cfd=_0x196cfd||0xc8;return function(_0x47753d){if(_0x47753d){return _0x4874ce[_0x06dc('0x18')](_0x196cfd)['json'](_0x47753d);}};}function respondWithFilteredResult(_0x183302,_0x1d92c2){return function(_0x145a07){if(_0x145a07){var _0x3da2c5=typeof _0x1d92c2['offset']===_0x06dc('0x19')&&typeof _0x1d92c2[_0x06dc('0x1a')]===_0x06dc('0x19');var _0x2478b9=_0x145a07[_0x06dc('0x1b')];var _0x51df31=_0x3da2c5?0x0:_0x1d92c2[_0x06dc('0x1c')];var _0x1d6ec8=_0x3da2c5?_0x145a07[_0x06dc('0x1b')]:_0x1d92c2[_0x06dc('0x1c')]+_0x1d92c2[_0x06dc('0x1a')];var _0x152ed2;if(_0x1d6ec8>=_0x2478b9){_0x1d6ec8=_0x2478b9;_0x152ed2=0xc8;}else{_0x152ed2=0xce;}_0x183302['status'](_0x152ed2);return _0x183302['set'](_0x06dc('0x1d'),_0x51df31+'-'+_0x1d6ec8+'/'+_0x2478b9)['json'](_0x145a07);}return null;};}function patchUpdates(_0x21c8c3){return function(_0x5088f3){try{jsonpatch[_0x06dc('0x1e')](_0x5088f3,_0x21c8c3,!![]);}catch(_0x369c60){return BPromise[_0x06dc('0x1f')](_0x369c60);}return _0x5088f3[_0x06dc('0x20')]();};}function saveUpdates(_0x8aaf2,_0x427f39){return function(_0x577284){if(_0x577284){return _0x577284['update'](_0x8aaf2)[_0x06dc('0x21')](function(_0x426260){return _0x426260;});}return null;};}function removeEntity(_0x56c345,_0x95dab2){return function(_0x5eab9b){if(_0x5eab9b){return _0x5eab9b['destroy']()['then'](function(){_0x56c345['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd3e42b,_0x5edc7b){return function(_0xfa043e){if(!_0xfa043e){_0xd3e42b['sendStatus'](0x194);}return _0xfa043e;};}function handleError(_0x52afcf,_0xa85ffc){_0xa85ffc=_0xa85ffc||0x1f4;return function(_0x26bbfe){logger['error'](_0x26bbfe['stack']);if(_0x26bbfe[_0x06dc('0x22')]){delete _0x26bbfe['name'];}_0x52afcf[_0x06dc('0x18')](_0xa85ffc)[_0x06dc('0x23')](_0x26bbfe);};}exports[_0x06dc('0x24')]=function(_0xfd5611,_0x1d98b8){var _0x31f5cd={},_0x164554={},_0x33ff4c={'count':0x0,'rows':[]};var _0x3f0e2d=_[_0x06dc('0x25')](db[_0x06dc('0x26')][_0x06dc('0x27')],function(_0x43e689){return{'name':_0x43e689['fieldName'],'type':_0x43e689['type'][_0x06dc('0x28')]};});_0x164554[_0x06dc('0x29')]=_[_0x06dc('0x25')](_0x3f0e2d,_0x06dc('0x22'));_0x164554[_0x06dc('0x2a')]=_[_0x06dc('0x2b')](_0xfd5611[_0x06dc('0x2a')]);_0x164554[_0x06dc('0x2c')]=_[_0x06dc('0x2d')](_0x164554[_0x06dc('0x29')],_0x164554['query']);_0x31f5cd[_0x06dc('0x2e')]=_[_0x06dc('0x2d')](_0x164554[_0x06dc('0x29')],qs[_0x06dc('0x2f')](_0xfd5611[_0x06dc('0x2a')]['fields']));_0x31f5cd[_0x06dc('0x2e')]=_0x31f5cd[_0x06dc('0x2e')][_0x06dc('0x30')]?_0x31f5cd['attributes']:_0x164554[_0x06dc('0x29')];if(!_0xfd5611[_0x06dc('0x2a')]['hasOwnProperty'](_0x06dc('0x31'))){_0x31f5cd[_0x06dc('0x1a')]=qs['limit'](_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x1a')]);_0x31f5cd[_0x06dc('0x1c')]=qs[_0x06dc('0x1c')](_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x1c')]);}_0x31f5cd[_0x06dc('0x32')]=qs[_0x06dc('0x33')](_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x33')]);_0x31f5cd['where']=qs['filters'](_['pick'](_0xfd5611[_0x06dc('0x2a')],_0x164554[_0x06dc('0x2c')]),_0x3f0e2d);if(_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x34')]){_0x31f5cd['where']=_['merge'](_0x31f5cd[_0x06dc('0x35')],{'$or':_[_0x06dc('0x25')](_0x3f0e2d,function(_0xdc718a){if(_0xdc718a[_0x06dc('0x36')]!==_0x06dc('0x37')){var _0xe65d69={};_0xe65d69[_0xdc718a[_0x06dc('0x22')]]={'$like':'%'+_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x34')]+'%'};return _0xe65d69;}})});}_0x31f5cd=_[_0x06dc('0x38')]({},_0x31f5cd,_0xfd5611[_0x06dc('0x39')]);var _0x11e2f6={'where':_0x31f5cd[_0x06dc('0x35')]};return db[_0x06dc('0x26')][_0x06dc('0x1b')](_0x11e2f6)[_0x06dc('0x21')](function(_0x3e9434){_0x33ff4c[_0x06dc('0x1b')]=_0x3e9434;if(_0xfd5611[_0x06dc('0x2a')][_0x06dc('0x3a')]){_0x31f5cd['include']=[{'all':!![]}];}return db['SquareMessage'][_0x06dc('0x3b')](_0x31f5cd);})[_0x06dc('0x21')](function(_0x4250fd){_0x33ff4c[_0x06dc('0x3c')]=_0x4250fd;return _0x33ff4c;})[_0x06dc('0x21')](respondWithFilteredResult(_0x1d98b8,_0x31f5cd))['catch'](handleError(_0x1d98b8,null));};exports[_0x06dc('0x3d')]=function(_0x37ec58,_0x64f6f3){var _0x59d4a0={'raw':!![],'where':{'id':_0x37ec58[_0x06dc('0x3e')]['id']}},_0x164684={};_0x164684['model']=_[_0x06dc('0x2b')](db[_0x06dc('0x26')][_0x06dc('0x27')]);_0x164684[_0x06dc('0x2a')]=_['keys'](_0x37ec58['query']);_0x164684[_0x06dc('0x2c')]=_[_0x06dc('0x2d')](_0x164684[_0x06dc('0x29')],_0x164684['query']);_0x59d4a0[_0x06dc('0x2e')]=_[_0x06dc('0x2d')](_0x164684[_0x06dc('0x29')],qs[_0x06dc('0x2f')](_0x37ec58[_0x06dc('0x2a')]['fields']));_0x59d4a0[_0x06dc('0x2e')]=_0x59d4a0['attributes']['length']?_0x59d4a0[_0x06dc('0x2e')]:_0x164684[_0x06dc('0x29')];if(_0x37ec58[_0x06dc('0x2a')][_0x06dc('0x3a')]){_0x59d4a0[_0x06dc('0x3f')]=[{'all':!![]}];}_0x59d4a0=_['merge']({},_0x59d4a0,_0x37ec58[_0x06dc('0x39')]);return db[_0x06dc('0x26')][_0x06dc('0x40')](_0x59d4a0)[_0x06dc('0x21')](handleEntityNotFound(_0x64f6f3,null))[_0x06dc('0x21')](respondWithResult(_0x64f6f3,null))[_0x06dc('0x41')](handleError(_0x64f6f3,null));};exports[_0x06dc('0x42')]=function(_0x6a5800,_0x1081a9){return db[_0x06dc('0x26')][_0x06dc('0x42')](_0x6a5800['body'],{})[_0x06dc('0x21')](respondWithResult(_0x1081a9,0xc9))[_0x06dc('0x41')](handleError(_0x1081a9,null));};exports['update']=function(_0xb9c6a2,_0x39e42a){if(_0xb9c6a2[_0x06dc('0x43')]['id']){delete _0xb9c6a2['body']['id'];}return db[_0x06dc('0x26')][_0x06dc('0x40')]({'where':{'id':_0xb9c6a2['params']['id']}})['then'](handleEntityNotFound(_0x39e42a,null))['then'](saveUpdates(_0xb9c6a2[_0x06dc('0x43')],null))[_0x06dc('0x21')](respondWithResult(_0x39e42a,null))[_0x06dc('0x41')](handleError(_0x39e42a,null));};exports['destroy']=function(_0x5dd2c2,_0x1d759b){return db[_0x06dc('0x26')][_0x06dc('0x40')]({'where':{'id':_0x5dd2c2[_0x06dc('0x3e')]['id']}})[_0x06dc('0x21')](handleEntityNotFound(_0x1d759b,null))['then'](removeEntity(_0x1d759b,null))[_0x06dc('0x41')](handleError(_0x1d759b,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 712d1dc..fda30b9 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 _0xe7fe=['path','rimraf','../../config/environment','exports','define','SquareMessage','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4d9607,_0x4a2515){var _0x5e510f=function(_0x3c8b52){while(--_0x3c8b52){_0x4d9607['push'](_0x4d9607['shift']());}};_0x5e510f(++_0x4a2515);}(_0xe7fe,0x6e));var _0xee7f=function(_0xd27941,_0x3d5cc5){_0xd27941=_0xd27941-0x0;var _0x27c9b4=_0xe7fe[_0xd27941];return _0x27c9b4;};'use strict';var _=require(_0xee7f('0x0'));var util=require(_0xee7f('0x1'));var logger=require(_0xee7f('0x2'))(_0xee7f('0x3'));var moment=require(_0xee7f('0x4'));var BPromise=require(_0xee7f('0x5'));var rp=require(_0xee7f('0x6'));var fs=require('fs');var path=require(_0xee7f('0x7'));var rimraf=require(_0xee7f('0x8'));var config=require(_0xee7f('0x9'));var attributes=require('./squareMessage.attributes');module[_0xee7f('0xa')]=function(_0x247d92,_0x4c8609){return _0x247d92[_0xee7f('0xb')](_0xee7f('0xc'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc285=['exports','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3da885,_0xac5ecf){var _0x222f0d=function(_0x19bf69){while(--_0x19bf69){_0x3da885['push'](_0x3da885['shift']());}};_0x222f0d(++_0xac5ecf);}(_0xc285,0x9a));var _0x5c28=function(_0x37be36,_0x18fe03){_0x37be36=_0x37be36-0x0;var _0x47108e=_0xc285[_0x37be36];return _0x47108e;};'use strict';var _=require(_0x5c28('0x0'));var util=require(_0x5c28('0x1'));var logger=require('../../config/logger')(_0x5c28('0x2'));var moment=require(_0x5c28('0x3'));var BPromise=require('bluebird');var rp=require(_0x5c28('0x4'));var fs=require('fs');var path=require(_0x5c28('0x5'));var rimraf=require(_0x5c28('0x6'));var config=require(_0x5c28('0x7'));var attributes=require('./squareMessage.attributes');module[_0x5c28('0x8')]=function(_0x4d2c9f,_0x1f5f7b){return _0x4d2c9f['define']('SquareMessage',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 9771dbd..0c0b0b4 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 _0x60b7=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','SquareMessage,\x20%s,\x20%s','info','catch','CreateSquareMessage','SquareMessage','body','options','raw','debug','stringify','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x56c5c0,_0x2901e6){var _0x3610b8=function(_0x3a1958){while(--_0x3a1958){_0x56c5c0['push'](_0x56c5c0['shift']());}};_0x3610b8(++_0x2901e6);}(_0x60b7,0x12f));var _0x760b=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0x60b7[_0x3cb3ca];return _0x214366;};'use strict';var _=require('lodash');var util=require(_0x760b('0x0'));var moment=require('moment');var BPromise=require(_0x760b('0x1'));var rs=require(_0x760b('0x2'));var fs=require('fs');var Redis=require(_0x760b('0x3'));var db=require(_0x760b('0x4'))['db'];var utils=require(_0x760b('0x5'));var logger=require(_0x760b('0x6'))(_0x760b('0x7'));var config=require(_0x760b('0x8'));var jayson=require(_0x760b('0x9'));var client=jayson[_0x760b('0xa')][_0x760b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b7215,_0x127b00,_0x535166){return new BPromise(function(_0x162eff,_0xe57b89){return client['request'](_0x3b7215,_0x535166)[_0x760b('0xc')](function(_0x25c9d9){logger['info']('SquareMessage,\x20%s,\x20%s',_0x127b00,_0x760b('0xd'));logger['debug'](_0x760b('0xe'),_0x127b00,'request\x20sent',JSON['stringify'](_0x25c9d9));if(_0x25c9d9[_0x760b('0xf')]){if(_0x25c9d9[_0x760b('0xf')][_0x760b('0x10')]===0x1f4){logger[_0x760b('0xf')]('SquareMessage,\x20%s,\x20%s',_0x127b00,_0x25c9d9[_0x760b('0xf')]['message']);return _0xe57b89(_0x25c9d9['error'][_0x760b('0x11')]);}logger['error'](_0x760b('0x12'),_0x127b00,_0x25c9d9[_0x760b('0xf')][_0x760b('0x11')]);return _0x162eff(_0x25c9d9[_0x760b('0xf')][_0x760b('0x11')]);}else{logger[_0x760b('0x13')]('SquareMessage,\x20%s,\x20%s',_0x127b00,_0x760b('0xd'));_0x162eff(_0x25c9d9['result']['message']);}})[_0x760b('0x14')](function(_0x2efb39){logger['error'](_0x760b('0x12'),_0x127b00,_0x2efb39);_0xe57b89(_0x2efb39);});});}exports[_0x760b('0x15')]=function(_0x1c7f8d){var _0x5de174=this;return new Promise(function(_0x478f14,_0x551abe){return db[_0x760b('0x16')]['create'](_0x1c7f8d[_0x760b('0x17')],{'raw':_0x1c7f8d[_0x760b('0x18')]?_0x1c7f8d['options'][_0x760b('0x19')]===undefined?!![]:![]:!![]})[_0x760b('0xc')](function(_0x16badd){logger[_0x760b('0x13')](_0x760b('0x15'),_0x1c7f8d);logger[_0x760b('0x1a')](_0x760b('0x15'),_0x1c7f8d,JSON[_0x760b('0x1b')](_0x16badd));_0x478f14(_0x16badd);})[_0x760b('0x14')](function(_0x238177){logger[_0x760b('0xf')](_0x760b('0x15'),_0x238177[_0x760b('0x11')],_0x1c7f8d);_0x551abe(_0x5de174[_0x760b('0xf')](0x1f4,_0x238177['message']));});});}; \ No newline at end of file +var _0x5f11=['request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','create','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','SquareMessage,\x20%s,\x20%s'];(function(_0x5e781c,_0x2cbae0){var _0x55939f=function(_0x2bd05b){while(--_0x2bd05b){_0x5e781c['push'](_0x5e781c['shift']());}};_0x55939f(++_0x2cbae0);}(_0x5f11,0xee));var _0x15f1=function(_0x8f5e19,_0x568541){_0x8f5e19=_0x8f5e19-0x0;var _0x3ca99b=_0x5f11[_0x8f5e19];return _0x3ca99b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x15f1('0x0'));var BPromise=require(_0x15f1('0x1'));var rs=require(_0x15f1('0x2'));var fs=require('fs');var Redis=require(_0x15f1('0x3'));var db=require(_0x15f1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x15f1('0x5'))('rpc');var config=require(_0x15f1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x15f1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x287e5c,_0x5b7a46,_0x4c41a0){return new BPromise(function(_0xb33ed3,_0x37f70c){return client[_0x15f1('0x8')](_0x287e5c,_0x4c41a0)[_0x15f1('0x9')](function(_0xbfdd3f){logger[_0x15f1('0xa')](_0x15f1('0xb'),_0x5b7a46,_0x15f1('0xc'));logger[_0x15f1('0xd')](_0x15f1('0xe'),_0x5b7a46,_0x15f1('0xc'),JSON[_0x15f1('0xf')](_0xbfdd3f));if(_0xbfdd3f[_0x15f1('0x10')]){if(_0xbfdd3f[_0x15f1('0x10')][_0x15f1('0x11')]===0x1f4){logger[_0x15f1('0x10')]('SquareMessage,\x20%s,\x20%s',_0x5b7a46,_0xbfdd3f[_0x15f1('0x10')][_0x15f1('0x12')]);return _0x37f70c(_0xbfdd3f['error'][_0x15f1('0x12')]);}logger[_0x15f1('0x10')]('SquareMessage,\x20%s,\x20%s',_0x5b7a46,_0xbfdd3f[_0x15f1('0x10')][_0x15f1('0x12')]);return _0xb33ed3(_0xbfdd3f[_0x15f1('0x10')][_0x15f1('0x12')]);}else{logger['info'](_0x15f1('0xb'),_0x5b7a46,_0x15f1('0xc'));_0xb33ed3(_0xbfdd3f[_0x15f1('0x13')][_0x15f1('0x12')]);}})[_0x15f1('0x14')](function(_0x2fb46d){logger[_0x15f1('0x10')](_0x15f1('0xb'),_0x5b7a46,_0x2fb46d);_0x37f70c(_0x2fb46d);});});}exports[_0x15f1('0x15')]=function(_0x55815c){var _0x26fedb=this;return new Promise(function(_0x5582c0,_0x56c6f5){return db['SquareMessage'][_0x15f1('0x16')](_0x55815c['body'],{'raw':_0x55815c[_0x15f1('0x17')]?_0x55815c[_0x15f1('0x17')][_0x15f1('0x18')]===undefined?!![]:![]:!![]})[_0x15f1('0x9')](function(_0x51ceeb){logger[_0x15f1('0xa')](_0x15f1('0x15'),_0x55815c);logger[_0x15f1('0xd')](_0x15f1('0x15'),_0x55815c,JSON[_0x15f1('0xf')](_0x51ceeb));_0x5582c0(_0x51ceeb);})[_0x15f1('0x14')](function(_0x5bca7b){logger['error'](_0x15f1('0x15'),_0x5bca7b['message'],_0x55815c);_0x56c6f5(_0x26fedb['error'](0x1f4,_0x5bca7b[_0x15f1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 789f878..0845a57 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 _0xb069=['/:id/test','test','post','put','update','delete','destroy','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show'];(function(_0x57c3ab,_0x353af9){var _0x5dba29=function(_0x2848f9){while(--_0x2848f9){_0x57c3ab['push'](_0x57c3ab['shift']());}};_0x5dba29(++_0x353af9);}(_0xb069,0x147));var _0x9b06=function(_0x8068b3,_0x71d498){_0x8068b3=_0x8068b3-0x0;var _0x22b694=_0xb069[_0x8068b3];return _0x22b694;};'use strict';var multer=require('multer');var util=require(_0x9b06('0x0'));var path=require('path');var timeout=require(_0x9b06('0x1'));var express=require(_0x9b06('0x2'));var router=express['Router']();var fs_extra=require(_0x9b06('0x3'));var auth=require(_0x9b06('0x4'));var interaction=require(_0x9b06('0x5'));var config=require(_0x9b06('0x6'));var controller=require(_0x9b06('0x7'));router[_0x9b06('0x8')]('/',auth[_0x9b06('0x9')](),controller[_0x9b06('0xa')]);router[_0x9b06('0x8')](_0x9b06('0xb'),auth[_0x9b06('0x9')](),controller[_0x9b06('0xc')]);router['get'](_0x9b06('0xd'),auth[_0x9b06('0x9')](),timeout('15s'),controller[_0x9b06('0xe')]);router[_0x9b06('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9b06('0x10')](_0x9b06('0xb'),auth['isAuthenticated'](),controller[_0x9b06('0x11')]);router[_0x9b06('0x12')](_0x9b06('0xb'),auth[_0x9b06('0x9')](),controller[_0x9b06('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0aac=['index','/:id','isAuthenticated','show','15s','post','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get'];(function(_0x1a858a,_0x3b56de){var _0x3acb99=function(_0x35a42e){while(--_0x35a42e){_0x1a858a['push'](_0x1a858a['shift']());}};_0x3acb99(++_0x3b56de);}(_0x0aac,0x1d6));var _0xc0aa=function(_0x239f2e,_0x4c5c60){_0x239f2e=_0x239f2e-0x0;var _0x17dcf6=_0x0aac[_0x239f2e];return _0x17dcf6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc0aa('0x0'));var timeout=require(_0xc0aa('0x1'));var express=require(_0xc0aa('0x2'));var router=express[_0xc0aa('0x3')]();var fs_extra=require(_0xc0aa('0x4'));var auth=require(_0xc0aa('0x5'));var interaction=require(_0xc0aa('0x6'));var config=require(_0xc0aa('0x7'));var controller=require(_0xc0aa('0x8'));router[_0xc0aa('0x9')]('/',auth['isAuthenticated'](),controller[_0xc0aa('0xa')]);router[_0xc0aa('0x9')](_0xc0aa('0xb'),auth[_0xc0aa('0xc')](),controller[_0xc0aa('0xd')]);router['get']('/:id/test',auth[_0xc0aa('0xc')](),timeout(_0xc0aa('0xe')),controller['test']);router[_0xc0aa('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc0aa('0x10')](_0xc0aa('0xb'),auth['isAuthenticated'](),controller[_0xc0aa('0x11')]);router['delete'](_0xc0aa('0xb'),auth[_0xc0aa('0xc')](),controller[_0xc0aa('0x12')]);module[_0xc0aa('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 941ea0f..60cd328 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 _0x648d=['exports','STRING'];(function(_0x3a7033,_0x1ebde6){var _0x5b64a8=function(_0x344a37){while(--_0x344a37){_0x3a7033['push'](_0x3a7033['shift']());}};_0x5b64a8(++_0x1ebde6);}(_0x648d,0xe6));var _0xd648=function(_0xd70fc,_0x4ed622){_0xd70fc=_0xd70fc-0x0;var _0x242cf4=_0x648d[_0xd70fc];return _0x242cf4;};'use strict';var Sequelize=require('sequelize');module[_0xd648('0x0')]={'name':{'type':Sequelize[_0xd648('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xd648('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd86a=['STRING','name','sequelize','exports'];(function(_0x5741ea,_0x1101fc){var _0x4f6ae6=function(_0x1e16ba){while(--_0x1e16ba){_0x5741ea['push'](_0x5741ea['shift']());}};_0x4f6ae6(++_0x1101fc);}(_0xd86a,0x136));var _0xad86=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0xd86a[_0x22eb96];return _0x5e1adf;};'use strict';var Sequelize=require(_0xad86('0x0'));module[_0xad86('0x1')]={'name':{'type':Sequelize[_0xad86('0x2')],'unique':_0xad86('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xad86('0x2')]},'description':{'type':Sequelize[_0xad86('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index d40527f..b635390 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 _0x6e85=['query','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','find','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','ODBC','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../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','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','SquareOdbc','type','key','model','keys','filters','intersection','attributes','fields'];(function(_0x26137c,_0x3796fe){var _0x1b29f2=function(_0x208b8d){while(--_0x208b8d){_0x26137c['push'](_0x26137c['shift']());}};_0x1b29f2(++_0x3796fe);}(_0x6e85,0x1e1));var _0x56e8=function(_0xd2e60e,_0x30493b){_0xd2e60e=_0xd2e60e-0x0;var _0x155a49=_0x6e85[_0xd2e60e];return _0x155a49;};'use strict';var emlformat=require(_0x56e8('0x0'));var rimraf=require(_0x56e8('0x1'));var zipdir=require(_0x56e8('0x2'));var jsonpatch=require(_0x56e8('0x3'));var rp=require(_0x56e8('0x4'));var moment=require(_0x56e8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x56e8('0x6'));var util=require(_0x56e8('0x7'));var path=require(_0x56e8('0x8'));var sox=require(_0x56e8('0x9'));var csv=require('to-csv');var ejs=require(_0x56e8('0xa'));var fs=require('fs');var fs_extra=require(_0x56e8('0xb'));var _=require(_0x56e8('0xc'));var squel=require('squel');var crypto=require(_0x56e8('0xd'));var jsforce=require(_0x56e8('0xe'));var deskjs=require(_0x56e8('0xf'));var toCsv=require(_0x56e8('0x10'));var querystring=require('querystring');var Papa=require(_0x56e8('0x11'));var Redis=require(_0x56e8('0x12'));var authService=require(_0x56e8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x56e8('0x14'));var hardwareService=require(_0x56e8('0x15'));var logger=require('../../config/logger')(_0x56e8('0x16'));var utils=require(_0x56e8('0x17'));var config=require(_0x56e8('0x18'));var licenseUtil=require(_0x56e8('0x19'));var db=require(_0x56e8('0x1a'))['db'];function respondWithStatusCode(_0xc49a3c,_0x1718a3){_0x1718a3=_0x1718a3||0xcc;return function(_0x5895cc){if(_0x5895cc){return _0xc49a3c[_0x56e8('0x1b')](_0x1718a3);}return _0xc49a3c[_0x56e8('0x1c')](_0x1718a3)[_0x56e8('0x1d')]();};}function respondWithResult(_0x50aade,_0x1e4fff){_0x1e4fff=_0x1e4fff||0xc8;return function(_0x25d287){if(_0x25d287){return _0x50aade[_0x56e8('0x1c')](_0x1e4fff)['json'](_0x25d287);}};}function respondWithFilteredResult(_0x297ac7,_0x410f84){return function(_0x75b89f){if(_0x75b89f){var _0x21e950=typeof _0x410f84['offset']===_0x56e8('0x1e')&&typeof _0x410f84[_0x56e8('0x1f')]===_0x56e8('0x1e');var _0x12aaed=_0x75b89f[_0x56e8('0x20')];var _0x16faa9=_0x21e950?0x0:_0x410f84[_0x56e8('0x21')];var _0x4c2d7d=_0x21e950?_0x75b89f[_0x56e8('0x20')]:_0x410f84['offset']+_0x410f84['limit'];var _0x16b7a2;if(_0x4c2d7d>=_0x12aaed){_0x4c2d7d=_0x12aaed;_0x16b7a2=0xc8;}else{_0x16b7a2=0xce;}_0x297ac7[_0x56e8('0x1c')](_0x16b7a2);return _0x297ac7[_0x56e8('0x22')](_0x56e8('0x23'),_0x16faa9+'-'+_0x4c2d7d+'/'+_0x12aaed)[_0x56e8('0x24')](_0x75b89f);}return null;};}function patchUpdates(_0x140b80){return function(_0x135b15){try{jsonpatch[_0x56e8('0x25')](_0x135b15,_0x140b80,!![]);}catch(_0x5cf057){return BPromise[_0x56e8('0x26')](_0x5cf057);}return _0x135b15[_0x56e8('0x27')]();};}function saveUpdates(_0x52dffa,_0xc84472){return function(_0x3192d5){if(_0x3192d5){return _0x3192d5[_0x56e8('0x28')](_0x52dffa)[_0x56e8('0x29')](function(_0x1b20a0){return _0x1b20a0;});}return null;};}function removeEntity(_0x5bbba8,_0x2cb904){return function(_0x384cf6){if(_0x384cf6){return _0x384cf6[_0x56e8('0x2a')]()['then'](function(){var _0x1a26bb=_0x384cf6[_0x56e8('0x2b')]({'plain':!![]});var _0x2ffc6a='ODBC';return db[_0x56e8('0x2c')][_0x56e8('0x2a')]({'where':{'type':_0x2ffc6a,'resourceId':_0x1a26bb['id']}})[_0x56e8('0x29')](function(){return _0x384cf6;});})[_0x56e8('0x29')](function(){_0x5bbba8[_0x56e8('0x1c')](0xcc)[_0x56e8('0x1d')]();});}};}function handleEntityNotFound(_0x2101bf,_0x3ddbae){return function(_0xf91024){if(!_0xf91024){_0x2101bf[_0x56e8('0x1b')](0x194);}return _0xf91024;};}function handleError(_0x53ebdb,_0x28e037){_0x28e037=_0x28e037||0x1f4;return function(_0x140331){logger[_0x56e8('0x2d')](_0x140331['stack']);if(_0x140331[_0x56e8('0x2e')]){delete _0x140331[_0x56e8('0x2e')];}_0x53ebdb[_0x56e8('0x1c')](_0x28e037)[_0x56e8('0x2f')](_0x140331);};}exports[_0x56e8('0x30')]=function(_0x4eaa6f,_0x1a0c73){var _0x4b4e5a={},_0x557459={},_0x57b7dd={'count':0x0,'rows':[]};var _0x3cf3f2=_[_0x56e8('0x31')](db[_0x56e8('0x32')]['rawAttributes'],function(_0x35acfd){return{'name':_0x35acfd['fieldName'],'type':_0x35acfd[_0x56e8('0x33')][_0x56e8('0x34')]};});_0x557459[_0x56e8('0x35')]=_[_0x56e8('0x31')](_0x3cf3f2,_0x56e8('0x2e'));_0x557459['query']=_[_0x56e8('0x36')](_0x4eaa6f['query']);_0x557459[_0x56e8('0x37')]=_[_0x56e8('0x38')](_0x557459[_0x56e8('0x35')],_0x557459['query']);_0x4b4e5a[_0x56e8('0x39')]=_['intersection'](_0x557459[_0x56e8('0x35')],qs[_0x56e8('0x3a')](_0x4eaa6f[_0x56e8('0x3b')]['fields']));_0x4b4e5a[_0x56e8('0x39')]=_0x4b4e5a['attributes'][_0x56e8('0x3c')]?_0x4b4e5a[_0x56e8('0x39')]:_0x557459[_0x56e8('0x35')];if(!_0x4eaa6f[_0x56e8('0x3b')][_0x56e8('0x3d')](_0x56e8('0x3e'))){_0x4b4e5a['limit']=qs[_0x56e8('0x1f')](_0x4eaa6f['query']['limit']);_0x4b4e5a['offset']=qs[_0x56e8('0x21')](_0x4eaa6f[_0x56e8('0x3b')][_0x56e8('0x21')]);}_0x4b4e5a[_0x56e8('0x3f')]=qs[_0x56e8('0x40')](_0x4eaa6f[_0x56e8('0x3b')][_0x56e8('0x40')]);_0x4b4e5a['where']=qs['filters'](_['pick'](_0x4eaa6f[_0x56e8('0x3b')],_0x557459[_0x56e8('0x37')]),_0x3cf3f2);if(_0x4eaa6f[_0x56e8('0x3b')][_0x56e8('0x41')]){_0x4b4e5a[_0x56e8('0x42')]=_[_0x56e8('0x43')](_0x4b4e5a['where'],{'$or':_[_0x56e8('0x31')](_0x3cf3f2,function(_0x2b4f56){if(_0x2b4f56['type']!==_0x56e8('0x44')){var _0x30c475={};_0x30c475[_0x2b4f56[_0x56e8('0x2e')]]={'$like':'%'+_0x4eaa6f[_0x56e8('0x3b')][_0x56e8('0x41')]+'%'};return _0x30c475;}})});}_0x4b4e5a=_[_0x56e8('0x43')]({},_0x4b4e5a,_0x4eaa6f[_0x56e8('0x45')]);var _0x1af53f={'where':_0x4b4e5a[_0x56e8('0x42')]};return db['SquareOdbc'][_0x56e8('0x20')](_0x1af53f)[_0x56e8('0x29')](function(_0x944a6a){_0x57b7dd[_0x56e8('0x20')]=_0x944a6a;if(_0x4eaa6f['query'][_0x56e8('0x46')]){_0x4b4e5a[_0x56e8('0x47')]=[{'all':!![]}];}return db[_0x56e8('0x32')]['findAll'](_0x4b4e5a);})[_0x56e8('0x29')](function(_0x32b8e1){_0x57b7dd[_0x56e8('0x48')]=_0x32b8e1;return _0x57b7dd;})[_0x56e8('0x29')](respondWithFilteredResult(_0x1a0c73,_0x4b4e5a))['catch'](handleError(_0x1a0c73,null));};exports[_0x56e8('0x49')]=function(_0x368587,_0x50b84c){var _0x177c3c={'raw':!![],'where':{'id':_0x368587['params']['id']}},_0x51d14a={};_0x51d14a[_0x56e8('0x35')]=_[_0x56e8('0x36')](db['SquareOdbc'][_0x56e8('0x4a')]);_0x51d14a[_0x56e8('0x3b')]=_[_0x56e8('0x36')](_0x368587[_0x56e8('0x3b')]);_0x51d14a[_0x56e8('0x37')]=_[_0x56e8('0x38')](_0x51d14a[_0x56e8('0x35')],_0x51d14a[_0x56e8('0x3b')]);_0x177c3c['attributes']=_['intersection'](_0x51d14a['model'],qs[_0x56e8('0x3a')](_0x368587[_0x56e8('0x3b')]['fields']));_0x177c3c[_0x56e8('0x39')]=_0x177c3c[_0x56e8('0x39')]['length']?_0x177c3c[_0x56e8('0x39')]:_0x51d14a['model'];if(_0x368587[_0x56e8('0x3b')][_0x56e8('0x46')]){_0x177c3c['include']=[{'all':!![]}];}_0x177c3c=_['merge']({},_0x177c3c,_0x368587[_0x56e8('0x45')]);return db['SquareOdbc'][_0x56e8('0x4b')](_0x177c3c)[_0x56e8('0x29')](handleEntityNotFound(_0x50b84c,null))['then'](respondWithResult(_0x50b84c,null))[_0x56e8('0x4c')](handleError(_0x50b84c,null));};exports['create']=function(_0x20db5b,_0x97d0c5){return db['SquareOdbc']['create'](_0x20db5b[_0x56e8('0x4d')],{})[_0x56e8('0x29')](function(_0x3ba0d2){var _0x17cd02=_0x20db5b['user'][_0x56e8('0x2b')]({'plain':!![]});if(!_0x17cd02)throw new Error(_0x56e8('0x4e'));if(_0x17cd02['role']===_0x56e8('0x4f')){var _0x43e153=_0x3ba0d2[_0x56e8('0x2b')]({'plain':!![]});var _0x24199b=_0x56e8('0x50');return db[_0x56e8('0x51')][_0x56e8('0x4b')]({'where':{'name':_0x24199b,'userProfileId':_0x17cd02[_0x56e8('0x52')]},'raw':!![]})['then'](function(_0x37a1c5){if(_0x37a1c5&&_0x37a1c5['autoAssociation']===0x0){return db[_0x56e8('0x2c')]['create']({'name':_0x43e153[_0x56e8('0x2e')],'resourceId':_0x43e153['id'],'type':_0x37a1c5[_0x56e8('0x2e')],'sectionId':_0x37a1c5['id']},{})['then'](function(){return _0x3ba0d2;});}else{return _0x3ba0d2;}})[_0x56e8('0x4c')](function(_0x4f0f35){logger[_0x56e8('0x2d')](_0x56e8('0x53'),_0x4f0f35);throw _0x4f0f35;});}return _0x3ba0d2;})[_0x56e8('0x29')](respondWithResult(_0x97d0c5,0xc9))['catch'](handleError(_0x97d0c5,null));};exports[_0x56e8('0x28')]=function(_0x1732b5,_0x1bd653){if(_0x1732b5[_0x56e8('0x4d')]['id']){delete _0x1732b5['body']['id'];}return db[_0x56e8('0x32')][_0x56e8('0x4b')]({'where':{'id':_0x1732b5[_0x56e8('0x54')]['id']}})['then'](handleEntityNotFound(_0x1bd653,null))[_0x56e8('0x29')](saveUpdates(_0x1732b5[_0x56e8('0x4d')],null))['then'](respondWithResult(_0x1bd653,null))[_0x56e8('0x4c')](handleError(_0x1bd653,null));};exports[_0x56e8('0x2a')]=function(_0x5e95cf,_0x335236){return db[_0x56e8('0x32')][_0x56e8('0x4b')]({'where':{'id':_0x5e95cf['params']['id']}})[_0x56e8('0x29')](handleEntityNotFound(_0x335236,null))[_0x56e8('0x29')](removeEntity(_0x335236,null))[_0x56e8('0x4c')](handleError(_0x335236,null));};exports[_0x56e8('0x55')]=function(_0x115e02,_0x149fbb,_0x29c09a){var _0x58b0b5;return db[_0x56e8('0x32')][_0x56e8('0x4b')]({'where':{'id':_0x115e02[_0x56e8('0x54')]['id']},'attributes':['id',_0x56e8('0x56')]})['then'](handleEntityNotFound(_0x149fbb,null))[_0x56e8('0x29')](function(_0x1b1b62){if(_0x1b1b62){var _0x881490=require(_0x56e8('0x57'))();_0x881490[_0x56e8('0x58')](_0x1b1b62['dsn']);_0x881490[_0x56e8('0x59')]();return _0x1b1b62;}})[_0x56e8('0x29')](respondWithResult(_0x149fbb,null))[_0x56e8('0x4c')](handleError(_0x149fbb,null));}; \ No newline at end of file +var _0xb4af=['../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','end','error','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SquareOdbc','includeAll','include','rows','catch','show','params','rawAttributes','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0xb4af,0x9f));var _0xfb4a=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xb4af[_0x31e29a];return _0x32d892;};'use strict';var emlformat=require(_0xfb4a('0x0'));var rimraf=require(_0xfb4a('0x1'));var zipdir=require(_0xfb4a('0x2'));var jsonpatch=require(_0xfb4a('0x3'));var rp=require(_0xfb4a('0x4'));var moment=require(_0xfb4a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfb4a('0x6'));var util=require(_0xfb4a('0x7'));var path=require(_0xfb4a('0x8'));var sox=require(_0xfb4a('0x9'));var csv=require(_0xfb4a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfb4a('0xb'));var _=require(_0xfb4a('0xc'));var squel=require(_0xfb4a('0xd'));var crypto=require('crypto');var jsforce=require(_0xfb4a('0xe'));var deskjs=require(_0xfb4a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfb4a('0x10'));var Papa=require(_0xfb4a('0x11'));var Redis=require(_0xfb4a('0x12'));var authService=require(_0xfb4a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb4a('0x14'));var logger=require(_0xfb4a('0x15'))(_0xfb4a('0x16'));var utils=require('../../config/utils');var config=require(_0xfb4a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfb4a('0x18'))['db'];function respondWithStatusCode(_0x2bf7b4,_0x2271c2){_0x2271c2=_0x2271c2||0xcc;return function(_0x150d6e){if(_0x150d6e){return _0x2bf7b4[_0xfb4a('0x19')](_0x2271c2);}return _0x2bf7b4[_0xfb4a('0x1a')](_0x2271c2)['end']();};}function respondWithResult(_0x37cf76,_0x5b348a){_0x5b348a=_0x5b348a||0xc8;return function(_0x19787c){if(_0x19787c){return _0x37cf76[_0xfb4a('0x1a')](_0x5b348a)[_0xfb4a('0x1b')](_0x19787c);}};}function respondWithFilteredResult(_0x2c2e7f,_0x5e0f58){return function(_0x270a98){if(_0x270a98){var _0x5e8f07=typeof _0x5e0f58['offset']===_0xfb4a('0x1c')&&typeof _0x5e0f58['limit']===_0xfb4a('0x1c');var _0x4b3606=_0x270a98[_0xfb4a('0x1d')];var _0x4f7f2b=_0x5e8f07?0x0:_0x5e0f58[_0xfb4a('0x1e')];var _0x49b4d3=_0x5e8f07?_0x270a98[_0xfb4a('0x1d')]:_0x5e0f58['offset']+_0x5e0f58[_0xfb4a('0x1f')];var _0x2d5902;if(_0x49b4d3>=_0x4b3606){_0x49b4d3=_0x4b3606;_0x2d5902=0xc8;}else{_0x2d5902=0xce;}_0x2c2e7f[_0xfb4a('0x1a')](_0x2d5902);return _0x2c2e7f[_0xfb4a('0x20')](_0xfb4a('0x21'),_0x4f7f2b+'-'+_0x49b4d3+'/'+_0x4b3606)['json'](_0x270a98);}return null;};}function patchUpdates(_0x292e5b){return function(_0x15ae96){try{jsonpatch[_0xfb4a('0x22')](_0x15ae96,_0x292e5b,!![]);}catch(_0x36e795){return BPromise[_0xfb4a('0x23')](_0x36e795);}return _0x15ae96[_0xfb4a('0x24')]();};}function saveUpdates(_0x2fef01,_0x2d8a1f){return function(_0x21f55c){if(_0x21f55c){return _0x21f55c[_0xfb4a('0x25')](_0x2fef01)[_0xfb4a('0x26')](function(_0x304133){return _0x304133;});}return null;};}function removeEntity(_0x38cfa3,_0x94f4be){return function(_0x32dce0){if(_0x32dce0){return _0x32dce0[_0xfb4a('0x27')]()[_0xfb4a('0x26')](function(){var _0xf1c70a=_0x32dce0[_0xfb4a('0x28')]({'plain':!![]});var _0x3d51a3=_0xfb4a('0x29');return db['UserProfileResource'][_0xfb4a('0x27')]({'where':{'type':_0x3d51a3,'resourceId':_0xf1c70a['id']}})['then'](function(){return _0x32dce0;});})[_0xfb4a('0x26')](function(){_0x38cfa3[_0xfb4a('0x1a')](0xcc)[_0xfb4a('0x2a')]();});}};}function handleEntityNotFound(_0x34ab8b,_0xcf1fff){return function(_0x1c6a42){if(!_0x1c6a42){_0x34ab8b[_0xfb4a('0x19')](0x194);}return _0x1c6a42;};}function handleError(_0x188426,_0x267002){_0x267002=_0x267002||0x1f4;return function(_0xc72e4d){logger[_0xfb4a('0x2b')](_0xc72e4d['stack']);if(_0xc72e4d[_0xfb4a('0x2c')]){delete _0xc72e4d[_0xfb4a('0x2c')];}_0x188426['status'](_0x267002)['send'](_0xc72e4d);};}exports[_0xfb4a('0x2d')]=function(_0x44c71e,_0x1be57a){var _0x39d4fa={},_0x53be78={},_0x956581={'count':0x0,'rows':[]};var _0x24be02=_[_0xfb4a('0x2e')](db['SquareOdbc']['rawAttributes'],function(_0x5050d1){return{'name':_0x5050d1[_0xfb4a('0x2f')],'type':_0x5050d1[_0xfb4a('0x30')][_0xfb4a('0x31')]};});_0x53be78[_0xfb4a('0x32')]=_['map'](_0x24be02,'name');_0x53be78[_0xfb4a('0x33')]=_[_0xfb4a('0x34')](_0x44c71e[_0xfb4a('0x33')]);_0x53be78[_0xfb4a('0x35')]=_[_0xfb4a('0x36')](_0x53be78['model'],_0x53be78[_0xfb4a('0x33')]);_0x39d4fa[_0xfb4a('0x37')]=_[_0xfb4a('0x36')](_0x53be78['model'],qs[_0xfb4a('0x38')](_0x44c71e[_0xfb4a('0x33')][_0xfb4a('0x38')]));_0x39d4fa[_0xfb4a('0x37')]=_0x39d4fa[_0xfb4a('0x37')][_0xfb4a('0x39')]?_0x39d4fa[_0xfb4a('0x37')]:_0x53be78[_0xfb4a('0x32')];if(!_0x44c71e[_0xfb4a('0x33')][_0xfb4a('0x3a')](_0xfb4a('0x3b'))){_0x39d4fa[_0xfb4a('0x1f')]=qs['limit'](_0x44c71e[_0xfb4a('0x33')][_0xfb4a('0x1f')]);_0x39d4fa[_0xfb4a('0x1e')]=qs[_0xfb4a('0x1e')](_0x44c71e['query'][_0xfb4a('0x1e')]);}_0x39d4fa[_0xfb4a('0x3c')]=qs['sort'](_0x44c71e[_0xfb4a('0x33')][_0xfb4a('0x3d')]);_0x39d4fa[_0xfb4a('0x3e')]=qs['filters'](_[_0xfb4a('0x3f')](_0x44c71e[_0xfb4a('0x33')],_0x53be78[_0xfb4a('0x35')]),_0x24be02);if(_0x44c71e[_0xfb4a('0x33')][_0xfb4a('0x40')]){_0x39d4fa[_0xfb4a('0x3e')]=_[_0xfb4a('0x41')](_0x39d4fa[_0xfb4a('0x3e')],{'$or':_['map'](_0x24be02,function(_0x478de9){if(_0x478de9['type']!==_0xfb4a('0x42')){var _0x1d0f5d={};_0x1d0f5d[_0x478de9['name']]={'$like':'%'+_0x44c71e['query'][_0xfb4a('0x40')]+'%'};return _0x1d0f5d;}})});}_0x39d4fa=_[_0xfb4a('0x41')]({},_0x39d4fa,_0x44c71e['options']);var _0x37269c={'where':_0x39d4fa[_0xfb4a('0x3e')]};return db[_0xfb4a('0x43')][_0xfb4a('0x1d')](_0x37269c)[_0xfb4a('0x26')](function(_0x5117e2){_0x956581[_0xfb4a('0x1d')]=_0x5117e2;if(_0x44c71e[_0xfb4a('0x33')][_0xfb4a('0x44')]){_0x39d4fa[_0xfb4a('0x45')]=[{'all':!![]}];}return db[_0xfb4a('0x43')]['findAll'](_0x39d4fa);})[_0xfb4a('0x26')](function(_0x19de90){_0x956581[_0xfb4a('0x46')]=_0x19de90;return _0x956581;})[_0xfb4a('0x26')](respondWithFilteredResult(_0x1be57a,_0x39d4fa))[_0xfb4a('0x47')](handleError(_0x1be57a,null));};exports[_0xfb4a('0x48')]=function(_0x4e9995,_0x471f88){var _0x314f44={'raw':!![],'where':{'id':_0x4e9995[_0xfb4a('0x49')]['id']}},_0x22ead4={};_0x22ead4[_0xfb4a('0x32')]=_[_0xfb4a('0x34')](db[_0xfb4a('0x43')][_0xfb4a('0x4a')]);_0x22ead4[_0xfb4a('0x33')]=_['keys'](_0x4e9995[_0xfb4a('0x33')]);_0x22ead4[_0xfb4a('0x35')]=_[_0xfb4a('0x36')](_0x22ead4[_0xfb4a('0x32')],_0x22ead4[_0xfb4a('0x33')]);_0x314f44[_0xfb4a('0x37')]=_[_0xfb4a('0x36')](_0x22ead4[_0xfb4a('0x32')],qs['fields'](_0x4e9995['query'][_0xfb4a('0x38')]));_0x314f44[_0xfb4a('0x37')]=_0x314f44[_0xfb4a('0x37')][_0xfb4a('0x39')]?_0x314f44[_0xfb4a('0x37')]:_0x22ead4[_0xfb4a('0x32')];if(_0x4e9995[_0xfb4a('0x33')][_0xfb4a('0x44')]){_0x314f44[_0xfb4a('0x45')]=[{'all':!![]}];}_0x314f44=_['merge']({},_0x314f44,_0x4e9995[_0xfb4a('0x4b')]);return db[_0xfb4a('0x43')]['find'](_0x314f44)[_0xfb4a('0x26')](handleEntityNotFound(_0x471f88,null))[_0xfb4a('0x26')](respondWithResult(_0x471f88,null))[_0xfb4a('0x47')](handleError(_0x471f88,null));};exports[_0xfb4a('0x4c')]=function(_0xa0625d,_0x520e0d){return db[_0xfb4a('0x43')]['create'](_0xa0625d['body'],{})[_0xfb4a('0x26')](function(_0x33b333){var _0x2190ed=_0xa0625d['user']['get']({'plain':!![]});if(!_0x2190ed)throw new Error(_0xfb4a('0x4d'));if(_0x2190ed['role']===_0xfb4a('0x4e')){var _0x582ee4=_0x33b333['get']({'plain':!![]});var _0x4f1e69=_0xfb4a('0x29');return db[_0xfb4a('0x4f')][_0xfb4a('0x50')]({'where':{'name':_0x4f1e69,'userProfileId':_0x2190ed[_0xfb4a('0x51')]},'raw':!![]})['then'](function(_0x171bcb){if(_0x171bcb&&_0x171bcb[_0xfb4a('0x52')]===0x0){return db[_0xfb4a('0x53')]['create']({'name':_0x582ee4['name'],'resourceId':_0x582ee4['id'],'type':_0x171bcb[_0xfb4a('0x2c')],'sectionId':_0x171bcb['id']},{})[_0xfb4a('0x26')](function(){return _0x33b333;});}else{return _0x33b333;}})[_0xfb4a('0x47')](function(_0xc1c690){logger[_0xfb4a('0x2b')](_0xfb4a('0x54'),_0xc1c690);throw _0xc1c690;});}return _0x33b333;})[_0xfb4a('0x26')](respondWithResult(_0x520e0d,0xc9))[_0xfb4a('0x47')](handleError(_0x520e0d,null));};exports[_0xfb4a('0x25')]=function(_0x16eb32,_0x2c53d8){if(_0x16eb32[_0xfb4a('0x55')]['id']){delete _0x16eb32['body']['id'];}return db[_0xfb4a('0x43')][_0xfb4a('0x50')]({'where':{'id':_0x16eb32['params']['id']}})[_0xfb4a('0x26')](handleEntityNotFound(_0x2c53d8,null))['then'](saveUpdates(_0x16eb32[_0xfb4a('0x55')],null))['then'](respondWithResult(_0x2c53d8,null))[_0xfb4a('0x47')](handleError(_0x2c53d8,null));};exports[_0xfb4a('0x27')]=function(_0x397490,_0x562234){return db[_0xfb4a('0x43')][_0xfb4a('0x50')]({'where':{'id':_0x397490[_0xfb4a('0x49')]['id']}})[_0xfb4a('0x26')](handleEntityNotFound(_0x562234,null))[_0xfb4a('0x26')](removeEntity(_0x562234,null))[_0xfb4a('0x47')](handleError(_0x562234,null));};exports[_0xfb4a('0x56')]=function(_0x2469df,_0x93f1b3,_0x325cfb){var _0x42e8cc;return db[_0xfb4a('0x43')][_0xfb4a('0x50')]({'where':{'id':_0x2469df[_0xfb4a('0x49')]['id']},'attributes':['id',_0xfb4a('0x57')]})['then'](handleEntityNotFound(_0x93f1b3,null))[_0xfb4a('0x26')](function(_0x3d152b){if(_0x3d152b){var _0x518f44=require(_0xfb4a('0x58'))();_0x518f44['openSync'](_0x3d152b[_0xfb4a('0x57')]);_0x518f44[_0xfb4a('0x59')]();return _0x3d152b;}})[_0xfb4a('0x26')](respondWithResult(_0x93f1b3,null))[_0xfb4a('0x47')](handleError(_0x93f1b3,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 39b108a..4d3f1a1 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 _0x18d8=['define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports'];(function(_0x3544ca,_0x5aa69d){var _0x5da81e=function(_0x19f279){while(--_0x19f279){_0x3544ca['push'](_0x3544ca['shift']());}};_0x5da81e(++_0x5aa69d);}(_0x18d8,0x1c3));var _0x818d=function(_0x33caf9,_0x16d49f){_0x33caf9=_0x33caf9-0x0;var _0x5ee02f=_0x18d8[_0x33caf9];return _0x5ee02f;};'use strict';var _=require(_0x818d('0x0'));var util=require(_0x818d('0x1'));var logger=require(_0x818d('0x2'))(_0x818d('0x3'));var moment=require(_0x818d('0x4'));var BPromise=require(_0x818d('0x5'));var rp=require(_0x818d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x818d('0x7'));var config=require(_0x818d('0x8'));var attributes=require(_0x818d('0x9'));module[_0x818d('0xa')]=function(_0x1ce450,_0x40eb03){return _0x1ce450[_0x818d('0xb')](_0x818d('0xc'),attributes,{'tableName':_0x818d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24ee=['./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4d733c,_0x1c2ed9){var _0xbe16b2=function(_0x82eb1b){while(--_0x82eb1b){_0x4d733c['push'](_0x4d733c['shift']());}};_0xbe16b2(++_0x1c2ed9);}(_0x24ee,0x1b2));var _0xe24e=function(_0x3e1054,_0x345ece){_0x3e1054=_0x3e1054-0x0;var _0xa74ef6=_0x24ee[_0x3e1054];return _0xa74ef6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe24e('0x0'));var BPromise=require(_0xe24e('0x1'));var rp=require(_0xe24e('0x2'));var fs=require('fs');var path=require(_0xe24e('0x3'));var rimraf=require(_0xe24e('0x4'));var config=require(_0xe24e('0x5'));var attributes=require(_0xe24e('0x6'));module[_0xe24e('0x7')]=function(_0x4d7d92,_0x196805){return _0x4d7d92[_0xe24e('0x8')](_0xe24e('0x9'),attributes,{'tableName':_0xe24e('0xa'),'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 614324a..3d9ddb2 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 _0x7579=['model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSquareOdbc','SquareOdbc','find','options','attributes','include'];(function(_0x48cb1f,_0x5ca68d){var _0x172c4d=function(_0x85040){while(--_0x85040){_0x48cb1f['push'](_0x48cb1f['shift']());}};_0x172c4d(++_0x5ca68d);}(_0x7579,0x1e2));var _0x9757=function(_0x5ec9e5,_0x5566ce){_0x5ec9e5=_0x5ec9e5-0x0;var _0x25d6c2=_0x7579[_0x5ec9e5];return _0x25d6c2;};'use strict';var _=require(_0x9757('0x0'));var util=require(_0x9757('0x1'));var moment=require(_0x9757('0x2'));var BPromise=require(_0x9757('0x3'));var rs=require(_0x9757('0x4'));var fs=require('fs');var Redis=require(_0x9757('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9757('0x6'));var logger=require(_0x9757('0x7'))(_0x9757('0x8'));var config=require(_0x9757('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9757('0xa')][_0x9757('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4757e9,_0x4b5446,_0x28a14a){return new BPromise(function(_0x51a1c8,_0x2d65dd){return client[_0x9757('0xc')](_0x4757e9,_0x28a14a)[_0x9757('0xd')](function(_0x5b5749){logger[_0x9757('0xe')](_0x9757('0xf'),_0x4b5446,_0x9757('0x10'));logger[_0x9757('0x11')](_0x9757('0x12'),_0x4b5446,_0x9757('0x10'),JSON[_0x9757('0x13')](_0x5b5749));if(_0x5b5749[_0x9757('0x14')]){if(_0x5b5749[_0x9757('0x14')][_0x9757('0x15')]===0x1f4){logger[_0x9757('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x4b5446,_0x5b5749[_0x9757('0x14')][_0x9757('0x16')]);return _0x2d65dd(_0x5b5749[_0x9757('0x14')]['message']);}logger[_0x9757('0x14')](_0x9757('0xf'),_0x4b5446,_0x5b5749[_0x9757('0x14')][_0x9757('0x16')]);return _0x51a1c8(_0x5b5749[_0x9757('0x14')][_0x9757('0x16')]);}else{logger[_0x9757('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x4b5446,_0x9757('0x10'));_0x51a1c8(_0x5b5749['result'][_0x9757('0x16')]);}})[_0x9757('0x17')](function(_0xad2a22){logger[_0x9757('0x14')](_0x9757('0xf'),_0x4b5446,_0xad2a22);_0x2d65dd(_0xad2a22);});});}exports[_0x9757('0x18')]=function(_0x57e309){var _0x9ee1f6=this;return new Promise(function(_0x2aa360,_0x1c9449){return db[_0x9757('0x19')][_0x9757('0x1a')]({'raw':_0x57e309[_0x9757('0x1b')]?_0x57e309[_0x9757('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x57e309[_0x9757('0x1b')]?_0x57e309['options']['where']||null:null,'attributes':_0x57e309[_0x9757('0x1b')]?_0x57e309[_0x9757('0x1b')][_0x9757('0x1c')]||null:null,'include':_0x57e309[_0x9757('0x1b')]?_0x57e309['options']['include']?_['map'](_0x57e309[_0x9757('0x1b')][_0x9757('0x1d')],function(_0x3bec93){return{'model':db[_0x3bec93[_0x9757('0x1e')]],'as':_0x3bec93['as'],'attributes':_0x3bec93['attributes'],'include':_0x3bec93[_0x9757('0x1d')]?_[_0x9757('0x1f')](_0x3bec93['include'],function(_0x293951){return{'model':db[_0x293951[_0x9757('0x1e')]],'as':_0x293951['as'],'attributes':_0x293951['attributes'],'include':_0x293951[_0x9757('0x1d')]?_[_0x9757('0x1f')](_0x293951[_0x9757('0x1d')],function(_0x14b614){return{'model':db[_0x14b614[_0x9757('0x1e')]],'as':_0x14b614['as'],'attributes':_0x14b614[_0x9757('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a9438){logger['info'](_0x9757('0x18'),_0x57e309);logger[_0x9757('0x11')]('ShowSquareOdbc',_0x57e309,JSON['stringify'](_0x2a9438));_0x2aa360(_0x2a9438);})[_0x9757('0x17')](function(_0x21a4bd){logger[_0x9757('0x14')](_0x9757('0x18'),_0x21a4bd['message'],_0x57e309);_0x1c9449(_0x9ee1f6[_0x9757('0x14')](0x1f4,_0x21a4bd[_0x9757('0x16')]));});});}; \ No newline at end of file +var _0x2bb1=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','lodash','util','bluebird'];(function(_0x1ae491,_0x5b83b9){var _0x4958a5=function(_0xf0f364){while(--_0xf0f364){_0x1ae491['push'](_0x1ae491['shift']());}};_0x4958a5(++_0x5b83b9);}(_0x2bb1,0x1ce));var _0x12bb=function(_0x1b141d,_0x39de80){_0x1b141d=_0x1b141d-0x0;var _0xd5d5f3=_0x2bb1[_0x1b141d];return _0xd5d5f3;};'use strict';var _=require(_0x12bb('0x0'));var util=require(_0x12bb('0x1'));var moment=require('moment');var BPromise=require(_0x12bb('0x2'));var rs=require(_0x12bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12bb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x12bb('0x5'))(_0x12bb('0x6'));var config=require(_0x12bb('0x7'));var jayson=require(_0x12bb('0x8'));var client=jayson[_0x12bb('0x9')][_0x12bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56ebe7,_0x5f3e25,_0x39f503){return new BPromise(function(_0x42cfbf,_0x5cd0c1){return client['request'](_0x56ebe7,_0x39f503)[_0x12bb('0xb')](function(_0x260424){logger[_0x12bb('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x5f3e25,_0x12bb('0xd'));logger['debug'](_0x12bb('0xe'),_0x5f3e25,_0x12bb('0xd'),JSON[_0x12bb('0xf')](_0x260424));if(_0x260424[_0x12bb('0x10')]){if(_0x260424['error'][_0x12bb('0x11')]===0x1f4){logger[_0x12bb('0x10')](_0x12bb('0x12'),_0x5f3e25,_0x260424[_0x12bb('0x10')][_0x12bb('0x13')]);return _0x5cd0c1(_0x260424[_0x12bb('0x10')][_0x12bb('0x13')]);}logger[_0x12bb('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x5f3e25,_0x260424[_0x12bb('0x10')][_0x12bb('0x13')]);return _0x42cfbf(_0x260424[_0x12bb('0x10')][_0x12bb('0x13')]);}else{logger[_0x12bb('0xc')](_0x12bb('0x12'),_0x5f3e25,_0x12bb('0xd'));_0x42cfbf(_0x260424[_0x12bb('0x14')][_0x12bb('0x13')]);}})['catch'](function(_0x380193){logger[_0x12bb('0x10')](_0x12bb('0x12'),_0x5f3e25,_0x380193);_0x5cd0c1(_0x380193);});});}exports[_0x12bb('0x15')]=function(_0x2c278f){var _0x16ff56=this;return new Promise(function(_0x5be41a,_0x50825a){return db[_0x12bb('0x16')][_0x12bb('0x17')]({'raw':_0x2c278f[_0x12bb('0x18')]?_0x2c278f[_0x12bb('0x18')][_0x12bb('0x19')]===undefined?!![]:![]:!![],'where':_0x2c278f[_0x12bb('0x18')]?_0x2c278f[_0x12bb('0x18')][_0x12bb('0x1a')]||null:null,'attributes':_0x2c278f['options']?_0x2c278f[_0x12bb('0x18')][_0x12bb('0x1b')]||null:null,'include':_0x2c278f['options']?_0x2c278f['options'][_0x12bb('0x1c')]?_[_0x12bb('0x1d')](_0x2c278f[_0x12bb('0x18')][_0x12bb('0x1c')],function(_0x3fdea5){return{'model':db[_0x3fdea5[_0x12bb('0x1e')]],'as':_0x3fdea5['as'],'attributes':_0x3fdea5[_0x12bb('0x1b')],'include':_0x3fdea5['include']?_[_0x12bb('0x1d')](_0x3fdea5[_0x12bb('0x1c')],function(_0x524e94){return{'model':db[_0x524e94[_0x12bb('0x1e')]],'as':_0x524e94['as'],'attributes':_0x524e94[_0x12bb('0x1b')],'include':_0x524e94['include']?_[_0x12bb('0x1d')](_0x524e94['include'],function(_0x265a20){return{'model':db[_0x265a20[_0x12bb('0x1e')]],'as':_0x265a20['as'],'attributes':_0x265a20[_0x12bb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x12bb('0xb')](function(_0x3c0bc2){logger[_0x12bb('0xc')](_0x12bb('0x15'),_0x2c278f);logger['debug'](_0x12bb('0x15'),_0x2c278f,JSON['stringify'](_0x3c0bc2));_0x5be41a(_0x3c0bc2);})['catch'](function(_0x34ca6c){logger[_0x12bb('0x10')](_0x12bb('0x15'),_0x34ca6c[_0x12bb('0x13')],_0x2c278f);_0x50825a(_0x16ff56[_0x12bb('0x10')](0x1f4,_0x34ca6c['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index c3d917c..b0c5d3d 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 _0x1433=['getUsers','post','addUsers','put','destroy','delete','removeUsers','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','show','/:id/users'];(function(_0x1dac7a,_0x1828ce){var _0x4cb363=function(_0x80f6de){while(--_0x80f6de){_0x1dac7a['push'](_0x1dac7a['shift']());}};_0x4cb363(++_0x1828ce);}(_0x1433,0x152));var _0x3143=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1433[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x3143('0x0'));var util=require(_0x3143('0x1'));var path=require(_0x3143('0x2'));var timeout=require(_0x3143('0x3'));var express=require('express');var router=express[_0x3143('0x4')]();var fs_extra=require(_0x3143('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3143('0x6'));var config=require(_0x3143('0x7'));var controller=require(_0x3143('0x8'));router[_0x3143('0x9')]('/',auth[_0x3143('0xa')](),controller['index']);router['get'](_0x3143('0xb'),auth[_0x3143('0xa')](),controller[_0x3143('0xc')]);router[_0x3143('0x9')](_0x3143('0xd'),auth['isAuthenticated'](),controller[_0x3143('0xe')]);router[_0x3143('0xf')]('/',auth[_0x3143('0xa')](),controller['create']);router[_0x3143('0xf')]('/:id/users',auth[_0x3143('0xa')](),controller[_0x3143('0x10')]);router[_0x3143('0x11')](_0x3143('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x3143('0xb'),auth[_0x3143('0xa')](),controller[_0x3143('0x12')]);router[_0x3143('0x13')](_0x3143('0xd'),auth[_0x3143('0xa')](),controller[_0x3143('0x14')]);module[_0x3143('0x15')]=router; \ No newline at end of file +var _0x9153=['create','post','/:id/users','addUsers','put','update','delete','removeUsers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','/:id','show','get'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0x9153,0xd8));var _0x3915=function(_0x1f1c4b,_0xabd842){_0x1f1c4b=_0x1f1c4b-0x0;var _0x4d5d61=_0x9153[_0x1f1c4b];return _0x4d5d61;};'use strict';var multer=require(_0x3915('0x0'));var util=require(_0x3915('0x1'));var path=require(_0x3915('0x2'));var timeout=require(_0x3915('0x3'));var express=require(_0x3915('0x4'));var router=express[_0x3915('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3915('0x6'));var interaction=require(_0x3915('0x7'));var config=require(_0x3915('0x8'));var controller=require(_0x3915('0x9'));router['get']('/',auth[_0x3915('0xa')](),controller['index']);router['get'](_0x3915('0xb'),auth[_0x3915('0xa')](),controller[_0x3915('0xc')]);router[_0x3915('0xd')]('/:id/users',auth[_0x3915('0xa')](),controller['getUsers']);router['post']('/',auth[_0x3915('0xa')](),controller[_0x3915('0xe')]);router[_0x3915('0xf')](_0x3915('0x10'),auth[_0x3915('0xa')](),controller[_0x3915('0x11')]);router[_0x3915('0x12')](_0x3915('0xb'),auth[_0x3915('0xa')](),controller[_0x3915('0x13')]);router['delete'](_0x3915('0xb'),auth[_0x3915('0xa')](),controller['destroy']);router[_0x3915('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0x3915('0x15')]);module[_0x3915('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 1dddd1d..743dd7f 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 _0x7360=['long','preproduction','getDataValue','toString','utf8','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB'];(function(_0x2aa3ed,_0x21bb61){var _0x4e0881=function(_0x581164){while(--_0x581164){_0x2aa3ed['push'](_0x2aa3ed['shift']());}};_0x4e0881(++_0x21bb61);}(_0x7360,0x14c));var _0x0736=function(_0xf9d497,_0x51df7f){_0xf9d497=_0xf9d497-0x0;var _0x10ed8a=_0x7360[_0xf9d497];return _0x10ed8a;};'use strict';var Sequelize=require(_0x0736('0x0'));module[_0x0736('0x1')]={'name':{'type':Sequelize[_0x0736('0x2')],'unique':_0x0736('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x0736('0x2')]},'notes':{'type':Sequelize[_0x0736('0x4')]},'preproduction':{'type':Sequelize[_0x0736('0x5')](_0x0736('0x6')),'get':function(){if(this['getDataValue'](_0x0736('0x7'))){return this[_0x0736('0x8')](_0x0736('0x7'))[_0x0736('0x9')](_0x0736('0xa'));}}},'production':{'type':Sequelize[_0x0736('0x5')](_0x0736('0x6')),'get':function(){if(this[_0x0736('0x8')](_0x0736('0xb'))){return this[_0x0736('0x8')](_0x0736('0xb'))[_0x0736('0x9')](_0x0736('0xa'));}}},'savedAt':{'type':Sequelize[_0x0736('0xc')]},'publishedAt':{'type':Sequelize[_0x0736('0xc')]}}; \ No newline at end of file +var _0xf1bd=['toString','DATE','sequelize','exports','STRING','TEXT','BLOB','long','getDataValue','preproduction','utf8','production'];(function(_0x2309ef,_0x26c3d8){var _0x53b7c9=function(_0x46c3e0){while(--_0x46c3e0){_0x2309ef['push'](_0x2309ef['shift']());}};_0x53b7c9(++_0x26c3d8);}(_0xf1bd,0x19a));var _0xdf1b=function(_0x18bb38,_0x17af25){_0x18bb38=_0x18bb38-0x0;var _0x1a8416=_0xf1bd[_0x18bb38];return _0x1a8416;};'use strict';var Sequelize=require(_0xdf1b('0x0'));module[_0xdf1b('0x1')]={'name':{'type':Sequelize[_0xdf1b('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xdf1b('0x2')]},'notes':{'type':Sequelize[_0xdf1b('0x3')]},'preproduction':{'type':Sequelize[_0xdf1b('0x4')](_0xdf1b('0x5')),'get':function(){if(this[_0xdf1b('0x6')](_0xdf1b('0x7'))){return this[_0xdf1b('0x6')]('preproduction')['toString'](_0xdf1b('0x8'));}}},'production':{'type':Sequelize[_0xdf1b('0x4')](_0xdf1b('0x5')),'get':function(){if(this[_0xdf1b('0x6')](_0xdf1b('0x9'))){return this['getDataValue'](_0xdf1b('0x9'))[_0xdf1b('0xa')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xdf1b('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 223ab76..bc082af 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 _0xcdc5=['util','sox','to-csv','fs-extra','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./squareProject.socket','register','sendStatus','status','limit','offset','count','set','Content-Range','json','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','SquareProject','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','keys','User','hasOwnProperty','zip-dir','fast-json-patch','moment','mustache'];(function(_0x4c64cf,_0x2d2cf3){var _0x2de23b=function(_0x5e3c59){while(--_0x5e3c59){_0x4c64cf['push'](_0x4c64cf['shift']());}};_0x2de23b(++_0x2d2cf3);}(_0xcdc5,0x178));var _0x5cdc=function(_0x3f0b15,_0x29a0c6){_0x3f0b15=_0x3f0b15-0x0;var _0x371196=_0xcdc5[_0x3f0b15];return _0x371196;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5cdc('0x0'));var jsonpatch=require(_0x5cdc('0x1'));var rp=require('request-promise');var moment=require(_0x5cdc('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5cdc('0x3'));var util=require(_0x5cdc('0x4'));var path=require('path');var sox=require(_0x5cdc('0x5'));var csv=require(_0x5cdc('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5cdc('0x7'));var _=require('lodash');var squel=require(_0x5cdc('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5cdc('0x9'));var toCsv=require(_0x5cdc('0x6'));var querystring=require(_0x5cdc('0xa'));var Papa=require('papaparse');var Redis=require(_0x5cdc('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x5cdc('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5cdc('0xd'));var logger=require(_0x5cdc('0xe'))(_0x5cdc('0xf'));var utils=require(_0x5cdc('0x10'));var config=require(_0x5cdc('0x11'));var licenseUtil=require(_0x5cdc('0x12'));var db=require(_0x5cdc('0x13'))['db'];config[_0x5cdc('0x14')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5cdc('0x15'))(new Redis(config[_0x5cdc('0x14')]));require(_0x5cdc('0x16'))[_0x5cdc('0x17')](socket);function respondWithStatusCode(_0x57bfb7,_0x2125e4){_0x2125e4=_0x2125e4||0xcc;return function(_0x2b5bc5){if(_0x2b5bc5){return _0x57bfb7[_0x5cdc('0x18')](_0x2125e4);}return _0x57bfb7[_0x5cdc('0x19')](_0x2125e4)['end']();};}function respondWithResult(_0x4e682d,_0x8726ec){_0x8726ec=_0x8726ec||0xc8;return function(_0x3ad214){if(_0x3ad214){return _0x4e682d[_0x5cdc('0x19')](_0x8726ec)['json'](_0x3ad214);}};}function respondWithFilteredResult(_0x326a33,_0x38a440){return function(_0x95f7d9){if(_0x95f7d9){var _0x1afa15=typeof _0x38a440['offset']==='undefined'&&typeof _0x38a440[_0x5cdc('0x1a')]==='undefined';var _0x20f533=_0x95f7d9['count'];var _0x133003=_0x1afa15?0x0:_0x38a440[_0x5cdc('0x1b')];var _0x153e39=_0x1afa15?_0x95f7d9[_0x5cdc('0x1c')]:_0x38a440[_0x5cdc('0x1b')]+_0x38a440['limit'];var _0x41decc;if(_0x153e39>=_0x20f533){_0x153e39=_0x20f533;_0x41decc=0xc8;}else{_0x41decc=0xce;}_0x326a33[_0x5cdc('0x19')](_0x41decc);return _0x326a33[_0x5cdc('0x1d')](_0x5cdc('0x1e'),_0x133003+'-'+_0x153e39+'/'+_0x20f533)[_0x5cdc('0x1f')](_0x95f7d9);}return null;};}function patchUpdates(_0x597357){return function(_0x31a831){try{jsonpatch['apply'](_0x31a831,_0x597357,!![]);}catch(_0x5bc90f){return BPromise[_0x5cdc('0x20')](_0x5bc90f);}return _0x31a831[_0x5cdc('0x21')]();};}function saveUpdates(_0x16abea,_0x240dac){return function(_0x147c20){if(_0x147c20){return _0x147c20[_0x5cdc('0x22')](_0x16abea)[_0x5cdc('0x23')](function(_0x482114){return _0x482114;});}return null;};}function removeEntity(_0x486b9f,_0x22e161){return function(_0x1cdfcf){if(_0x1cdfcf){return _0x1cdfcf[_0x5cdc('0x24')]()[_0x5cdc('0x23')](function(){var _0x1c0b93=_0x1cdfcf[_0x5cdc('0x25')]({'plain':!![]});var _0x27158b='SquareProjects';return db[_0x5cdc('0x26')][_0x5cdc('0x24')]({'where':{'type':_0x27158b,'resourceId':_0x1c0b93['id']}})['then'](function(){return _0x1cdfcf;});})[_0x5cdc('0x23')](function(){_0x486b9f[_0x5cdc('0x19')](0xcc)[_0x5cdc('0x27')]();});}};}function handleEntityNotFound(_0x42359b,_0x4ee09b){return function(_0x292d67){if(!_0x292d67){_0x42359b['sendStatus'](0x194);}return _0x292d67;};}function handleError(_0x107a6c,_0x1f5530){_0x1f5530=_0x1f5530||0x1f4;return function(_0xd17398){logger[_0x5cdc('0x28')](_0xd17398[_0x5cdc('0x29')]);if(_0xd17398['name']){delete _0xd17398[_0x5cdc('0x2a')];}_0x107a6c[_0x5cdc('0x19')](_0x1f5530)[_0x5cdc('0x2b')](_0xd17398);};}exports[_0x5cdc('0x2c')]=function(_0x1d4a54,_0x120e25){var _0x104237={},_0x5c1f5b={},_0x27b7f8={'count':0x0,'rows':[]};var _0x1a10c0=_[_0x5cdc('0x2d')](db[_0x5cdc('0x2e')]['rawAttributes'],function(_0xcd7f67){return{'name':_0xcd7f67[_0x5cdc('0x2f')],'type':_0xcd7f67['type'][_0x5cdc('0x30')]};});_0x5c1f5b[_0x5cdc('0x31')]=_[_0x5cdc('0x2d')](_0x1a10c0,_0x5cdc('0x2a'));_0x5c1f5b[_0x5cdc('0x32')]=_['keys'](_0x1d4a54['query']);_0x5c1f5b[_0x5cdc('0x33')]=_[_0x5cdc('0x34')](_0x5c1f5b[_0x5cdc('0x31')],_0x5c1f5b['query']);_0x104237[_0x5cdc('0x35')]=_[_0x5cdc('0x34')](_0x5c1f5b[_0x5cdc('0x31')],qs[_0x5cdc('0x36')](_0x1d4a54['query'][_0x5cdc('0x36')]));_0x104237['attributes']=_0x104237[_0x5cdc('0x35')][_0x5cdc('0x37')]?_0x104237[_0x5cdc('0x35')]:_0x5c1f5b[_0x5cdc('0x31')];if(!_0x1d4a54[_0x5cdc('0x32')]['hasOwnProperty'](_0x5cdc('0x38'))){_0x104237['limit']=qs[_0x5cdc('0x1a')](_0x1d4a54[_0x5cdc('0x32')][_0x5cdc('0x1a')]);_0x104237[_0x5cdc('0x1b')]=qs[_0x5cdc('0x1b')](_0x1d4a54['query'][_0x5cdc('0x1b')]);}_0x104237[_0x5cdc('0x39')]=qs[_0x5cdc('0x3a')](_0x1d4a54['query']['sort']);_0x104237[_0x5cdc('0x3b')]=qs[_0x5cdc('0x33')](_['pick'](_0x1d4a54[_0x5cdc('0x32')],_0x5c1f5b[_0x5cdc('0x33')]),_0x1a10c0);if(_0x1d4a54[_0x5cdc('0x32')][_0x5cdc('0x3c')]){_0x104237[_0x5cdc('0x3b')]=_[_0x5cdc('0x3d')](_0x104237[_0x5cdc('0x3b')],{'$or':_[_0x5cdc('0x2d')](_0x1a10c0,function(_0x5e01b9){if(_0x5e01b9[_0x5cdc('0x3e')]!=='VIRTUAL'){var _0x5489ac={};_0x5489ac[_0x5e01b9[_0x5cdc('0x2a')]]={'$like':'%'+_0x1d4a54[_0x5cdc('0x32')][_0x5cdc('0x3c')]+'%'};return _0x5489ac;}})});}_0x104237=_[_0x5cdc('0x3d')]({},_0x104237,_0x1d4a54[_0x5cdc('0x3f')]);var _0x278342={'where':_0x104237[_0x5cdc('0x3b')]};return db[_0x5cdc('0x2e')][_0x5cdc('0x1c')](_0x278342)[_0x5cdc('0x23')](function(_0x4579a1){_0x27b7f8[_0x5cdc('0x1c')]=_0x4579a1;if(_0x1d4a54[_0x5cdc('0x32')][_0x5cdc('0x40')]){_0x104237['include']=[{'all':!![]}];}return db[_0x5cdc('0x2e')][_0x5cdc('0x41')](_0x104237);})[_0x5cdc('0x23')](function(_0x26476c){_0x27b7f8[_0x5cdc('0x42')]=_0x26476c;return _0x27b7f8;})[_0x5cdc('0x23')](respondWithFilteredResult(_0x120e25,_0x104237))[_0x5cdc('0x43')](handleError(_0x120e25,null));};exports[_0x5cdc('0x44')]=function(_0xa2f359,_0x288fdb){var _0x4001aa={'raw':![],'where':{'id':_0xa2f359[_0x5cdc('0x45')]['id']}},_0x5c59df={};_0x5c59df[_0x5cdc('0x31')]=_['keys'](db[_0x5cdc('0x2e')][_0x5cdc('0x46')]);_0x5c59df[_0x5cdc('0x32')]=_['keys'](_0xa2f359[_0x5cdc('0x32')]);_0x5c59df[_0x5cdc('0x33')]=_[_0x5cdc('0x34')](_0x5c59df[_0x5cdc('0x31')],_0x5c59df[_0x5cdc('0x32')]);_0x4001aa[_0x5cdc('0x35')]=_[_0x5cdc('0x34')](_0x5c59df[_0x5cdc('0x31')],qs[_0x5cdc('0x36')](_0xa2f359['query'][_0x5cdc('0x36')]));_0x4001aa[_0x5cdc('0x35')]=_0x4001aa[_0x5cdc('0x35')][_0x5cdc('0x37')]?_0x4001aa[_0x5cdc('0x35')]:_0x5c59df['model'];if(_0xa2f359[_0x5cdc('0x32')][_0x5cdc('0x40')]){_0x4001aa[_0x5cdc('0x47')]=[{'all':!![]}];}_0x4001aa=_[_0x5cdc('0x3d')]({},_0x4001aa,_0xa2f359[_0x5cdc('0x3f')]);return db[_0x5cdc('0x2e')]['find'](_0x4001aa)[_0x5cdc('0x23')](handleEntityNotFound(_0x288fdb,null))[_0x5cdc('0x23')](respondWithResult(_0x288fdb,null))[_0x5cdc('0x43')](handleError(_0x288fdb,null));};exports[_0x5cdc('0x48')]=function(_0x3e706a,_0x1dea21){return db[_0x5cdc('0x2e')][_0x5cdc('0x48')](_0x3e706a[_0x5cdc('0x49')],{})[_0x5cdc('0x23')](function(_0x3cea57){var _0x148fd8=_0x3e706a[_0x5cdc('0x4a')]['get']({'plain':!![]});if(!_0x148fd8)throw new Error(_0x5cdc('0x4b'));if(_0x148fd8[_0x5cdc('0x4c')]===_0x5cdc('0x4a')){var _0x42f369=_0x3cea57['get']({'plain':!![]});var _0x5cd987=_0x5cdc('0x4d');return db[_0x5cdc('0x4e')][_0x5cdc('0x4f')]({'where':{'name':_0x5cd987,'userProfileId':_0x148fd8[_0x5cdc('0x50')]},'raw':!![]})['then'](function(_0x43d282){if(_0x43d282&&_0x43d282[_0x5cdc('0x51')]===0x0){return db[_0x5cdc('0x26')][_0x5cdc('0x48')]({'name':_0x42f369['name'],'resourceId':_0x42f369['id'],'type':_0x43d282['name'],'sectionId':_0x43d282['id']},{})[_0x5cdc('0x23')](function(){return _0x3cea57;});}else{return _0x3cea57;}})[_0x5cdc('0x43')](function(_0x5be1f8){logger[_0x5cdc('0x28')](_0x5cdc('0x52'),_0x5be1f8);throw _0x5be1f8;});}return _0x3cea57;})[_0x5cdc('0x23')](respondWithResult(_0x1dea21,0xc9))[_0x5cdc('0x43')](handleError(_0x1dea21,null));};exports[_0x5cdc('0x22')]=function(_0x18db07,_0x53e98f){if(_0x18db07[_0x5cdc('0x49')]['id']){delete _0x18db07[_0x5cdc('0x49')]['id'];}return db[_0x5cdc('0x2e')]['find']({'where':{'id':_0x18db07[_0x5cdc('0x45')]['id']}})[_0x5cdc('0x23')](handleEntityNotFound(_0x53e98f,null))[_0x5cdc('0x23')](saveUpdates(_0x18db07['body'],null))[_0x5cdc('0x23')](respondWithResult(_0x53e98f,null))[_0x5cdc('0x43')](handleError(_0x53e98f,null));};exports['destroy']=function(_0xf7b4cf,_0x3fd5cf){return db[_0x5cdc('0x2e')][_0x5cdc('0x4f')]({'where':{'id':_0xf7b4cf[_0x5cdc('0x45')]['id']}})['then'](handleEntityNotFound(_0x3fd5cf,null))[_0x5cdc('0x23')](removeEntity(_0x3fd5cf,null))[_0x5cdc('0x43')](handleError(_0x3fd5cf,null));};exports['addUsers']=function(_0x3cd7bd,_0x143ed5,_0x17acc7){return db[_0x5cdc('0x2e')][_0x5cdc('0x4f')]({'where':{'id':_0x3cd7bd[_0x5cdc('0x45')]['id']}})['then'](handleEntityNotFound(_0x143ed5,null))[_0x5cdc('0x23')](function(_0x161ffe){if(_0x161ffe){return _0x161ffe[_0x5cdc('0x53')](_0x3cd7bd[_0x5cdc('0x49')][_0x5cdc('0x54')],_[_0x5cdc('0x55')](_0x3cd7bd[_0x5cdc('0x49')],[_0x5cdc('0x54'),'id'])||{});}})[_0x5cdc('0x23')](respondWithResult(_0x143ed5,null))[_0x5cdc('0x43')](handleError(_0x143ed5,null));};exports['removeUsers']=function(_0x5338f9,_0x4429e7,_0x57784b){return db[_0x5cdc('0x2e')][_0x5cdc('0x4f')]({'where':{'id':_0x5338f9[_0x5cdc('0x45')]['id']}})[_0x5cdc('0x23')](handleEntityNotFound(_0x4429e7,null))[_0x5cdc('0x23')](function(_0x36e615){if(_0x36e615){return _0x36e615[_0x5cdc('0x56')](_0x5338f9[_0x5cdc('0x32')]['ids'])[_0x5cdc('0x23')](function(){if(_[_0x5cdc('0x57')](_0x5338f9[_0x5cdc('0x32')][_0x5cdc('0x54')])){for(var _0x1dc035=0x0;_0x1dc035<_0x5338f9[_0x5cdc('0x32')][_0x5cdc('0x54')][_0x5cdc('0x37')];_0x1dc035+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x5338f9[_0x5cdc('0x32')][_0x5cdc('0x54')][_0x1dc035]),'SquareProjectId':Number(_0x5338f9['params']['id'])});}}else{socket[_0x5cdc('0x58')](_0x5cdc('0x59'),{'UserId':Number(_0x5338f9[_0x5cdc('0x32')][_0x5cdc('0x54')]),'SquareProjectId':Number(_0x5338f9[_0x5cdc('0x45')]['id'])});}});}})[_0x5cdc('0x23')](respondWithStatusCode(_0x4429e7,null))[_0x5cdc('0x43')](handleError(_0x4429e7,null));};exports[_0x5cdc('0x5a')]=function(_0x52b544,_0x28c2bd,_0x519d1d){var _0x5d691b={};var _0x8c0276={};var _0x5b0fc6;var _0x3477b0;return db['SquareProject'][_0x5cdc('0x5b')]({'where':{'id':_0x52b544[_0x5cdc('0x45')]['id']}})[_0x5cdc('0x23')](handleEntityNotFound(_0x28c2bd,null))[_0x5cdc('0x23')](function(_0x5c29d1){if(_0x5c29d1){_0x5b0fc6=_0x5c29d1;_0x8c0276[_0x5cdc('0x31')]=_[_0x5cdc('0x5c')](db[_0x5cdc('0x5d')][_0x5cdc('0x46')]);_0x8c0276[_0x5cdc('0x32')]=_[_0x5cdc('0x5c')](_0x52b544[_0x5cdc('0x32')]);_0x8c0276[_0x5cdc('0x33')]=_[_0x5cdc('0x34')](_0x8c0276[_0x5cdc('0x31')],_0x8c0276[_0x5cdc('0x32')]);_0x5d691b[_0x5cdc('0x35')]=_[_0x5cdc('0x34')](_0x8c0276[_0x5cdc('0x31')],qs[_0x5cdc('0x36')](_0x52b544['query'][_0x5cdc('0x36')]));_0x5d691b[_0x5cdc('0x35')]=_0x5d691b['attributes'][_0x5cdc('0x37')]?_0x5d691b[_0x5cdc('0x35')]:_0x8c0276[_0x5cdc('0x31')];_0x5d691b[_0x5cdc('0x39')]=qs[_0x5cdc('0x3a')](_0x52b544[_0x5cdc('0x32')][_0x5cdc('0x3a')]);_0x5d691b['where']=qs[_0x5cdc('0x33')](_['pick'](_0x52b544['query'],_0x8c0276[_0x5cdc('0x33')]));if(_0x52b544[_0x5cdc('0x32')][_0x5cdc('0x3c')]){_0x5d691b['where']=_[_0x5cdc('0x3d')](_0x5d691b['where'],{'$or':_[_0x5cdc('0x2d')](_0x5d691b[_0x5cdc('0x35')],function(_0x495bc6){var _0x51e8c1={};_0x51e8c1[_0x495bc6]={'$like':'%'+_0x52b544[_0x5cdc('0x32')]['filter']+'%'};return _0x51e8c1;})});}_0x5d691b=_[_0x5cdc('0x3d')]({},_0x5d691b,_0x52b544[_0x5cdc('0x3f')]);return _0x5b0fc6['getUsers'](_0x5d691b);}})[_0x5cdc('0x23')](function(_0x4adfc2){if(_0x4adfc2){_0x3477b0=_0x4adfc2[_0x5cdc('0x37')];if(!_0x52b544[_0x5cdc('0x32')][_0x5cdc('0x5e')](_0x5cdc('0x38'))){_0x5d691b[_0x5cdc('0x1a')]=qs[_0x5cdc('0x1a')](_0x52b544[_0x5cdc('0x32')]['limit']);_0x5d691b[_0x5cdc('0x1b')]=qs[_0x5cdc('0x1b')](_0x52b544['query']['offset']);}return _0x5b0fc6[_0x5cdc('0x5a')](_0x5d691b);}})[_0x5cdc('0x23')](function(_0x535065){if(_0x535065){return _0x535065?{'count':_0x3477b0,'rows':_0x535065}:null;}})[_0x5cdc('0x23')](respondWithResult(_0x28c2bd,null))[_0x5cdc('0x43')](handleError(_0x28c2bd,null));}; \ No newline at end of file +var _0x42eb=['util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./squareProject.socket','register','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','get','SquareProjects','UserProfileResource','destroy','then','name','index','map','SquareProject','rawAttributes','type','key','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','omit','ids','removeUsers','isArray','userSquareProject:remove','getUsers','findOne','eml-format','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x59d482,_0x43e5e9){var _0x4b6c63=function(_0x314527){while(--_0x314527){_0x59d482['push'](_0x59d482['shift']());}};_0x4b6c63(++_0x43e5e9);}(_0x42eb,0x11b));var _0xb42e=function(_0x33dcf7,_0x3d5390){_0x33dcf7=_0x33dcf7-0x0;var _0x542d4e=_0x42eb[_0x33dcf7];return _0x542d4e;};'use strict';var emlformat=require(_0xb42e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb42e('0x1'));var jsonpatch=require(_0xb42e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb42e('0x3'));var Mustache=require(_0xb42e('0x4'));var util=require(_0xb42e('0x5'));var path=require('path');var sox=require(_0xb42e('0x6'));var csv=require(_0xb42e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb42e('0x8'));var _=require(_0xb42e('0x9'));var squel=require(_0xb42e('0xa'));var crypto=require('crypto');var jsforce=require(_0xb42e('0xb'));var deskjs=require(_0xb42e('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb42e('0xd'));var Papa=require(_0xb42e('0xe'));var Redis=require(_0xb42e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb42e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb42e('0x11'));var logger=require(_0xb42e('0x12'))('api');var utils=require(_0xb42e('0x13'));var config=require(_0xb42e('0x14'));var licenseUtil=require(_0xb42e('0x15'));var db=require(_0xb42e('0x16'))['db'];config['redis']=_[_0xb42e('0x17')](config['redis'],{'host':_0xb42e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb42e('0x19')]));require(_0xb42e('0x1a'))[_0xb42e('0x1b')](socket);function respondWithStatusCode(_0x3f27f5,_0x19dcbc){_0x19dcbc=_0x19dcbc||0xcc;return function(_0x23e328){if(_0x23e328){return _0x3f27f5[_0xb42e('0x1c')](_0x19dcbc);}return _0x3f27f5[_0xb42e('0x1d')](_0x19dcbc)[_0xb42e('0x1e')]();};}function respondWithResult(_0x27a8d9,_0x43f2a6){_0x43f2a6=_0x43f2a6||0xc8;return function(_0x24b6d2){if(_0x24b6d2){return _0x27a8d9[_0xb42e('0x1d')](_0x43f2a6)['json'](_0x24b6d2);}};}function respondWithFilteredResult(_0x2eea8c,_0x433a20){return function(_0x549cf5){if(_0x549cf5){var _0x4531b=typeof _0x433a20['offset']===_0xb42e('0x1f')&&typeof _0x433a20[_0xb42e('0x20')]===_0xb42e('0x1f');var _0x39a46c=_0x549cf5[_0xb42e('0x21')];var _0x12cc30=_0x4531b?0x0:_0x433a20['offset'];var _0x55cd1c=_0x4531b?_0x549cf5[_0xb42e('0x21')]:_0x433a20[_0xb42e('0x22')]+_0x433a20[_0xb42e('0x20')];var _0x1e2d40;if(_0x55cd1c>=_0x39a46c){_0x55cd1c=_0x39a46c;_0x1e2d40=0xc8;}else{_0x1e2d40=0xce;}_0x2eea8c[_0xb42e('0x1d')](_0x1e2d40);return _0x2eea8c['set'](_0xb42e('0x23'),_0x12cc30+'-'+_0x55cd1c+'/'+_0x39a46c)[_0xb42e('0x24')](_0x549cf5);}return null;};}function patchUpdates(_0x388a55){return function(_0x2cd678){try{jsonpatch['apply'](_0x2cd678,_0x388a55,!![]);}catch(_0x2b10d9){return BPromise[_0xb42e('0x25')](_0x2b10d9);}return _0x2cd678[_0xb42e('0x26')]();};}function saveUpdates(_0x3c96c9,_0x5df929){return function(_0x5a1d82){if(_0x5a1d82){return _0x5a1d82[_0xb42e('0x27')](_0x3c96c9)['then'](function(_0x567e82){return _0x567e82;});}return null;};}function removeEntity(_0x3014d5,_0x14e724){return function(_0x1c4581){if(_0x1c4581){return _0x1c4581['destroy']()['then'](function(){var _0x11675b=_0x1c4581[_0xb42e('0x28')]({'plain':!![]});var _0x2f894a=_0xb42e('0x29');return db[_0xb42e('0x2a')][_0xb42e('0x2b')]({'where':{'type':_0x2f894a,'resourceId':_0x11675b['id']}})[_0xb42e('0x2c')](function(){return _0x1c4581;});})[_0xb42e('0x2c')](function(){_0x3014d5[_0xb42e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a9490,_0x151270){return function(_0x5ed22c){if(!_0x5ed22c){_0x1a9490['sendStatus'](0x194);}return _0x5ed22c;};}function handleError(_0x545dc9,_0x44621d){_0x44621d=_0x44621d||0x1f4;return function(_0x2380bc){logger['error'](_0x2380bc['stack']);if(_0x2380bc['name']){delete _0x2380bc[_0xb42e('0x2d')];}_0x545dc9[_0xb42e('0x1d')](_0x44621d)['send'](_0x2380bc);};}exports[_0xb42e('0x2e')]=function(_0x170748,_0x3f22aa){var _0x209407={},_0x465a33={},_0x57aa05={'count':0x0,'rows':[]};var _0x21090e=_[_0xb42e('0x2f')](db[_0xb42e('0x30')][_0xb42e('0x31')],function(_0x50fe96){return{'name':_0x50fe96['fieldName'],'type':_0x50fe96[_0xb42e('0x32')][_0xb42e('0x33')]};});_0x465a33['model']=_[_0xb42e('0x2f')](_0x21090e,_0xb42e('0x2d'));_0x465a33['query']=_['keys'](_0x170748[_0xb42e('0x34')]);_0x465a33['filters']=_['intersection'](_0x465a33[_0xb42e('0x35')],_0x465a33[_0xb42e('0x34')]);_0x209407['attributes']=_[_0xb42e('0x36')](_0x465a33[_0xb42e('0x35')],qs[_0xb42e('0x37')](_0x170748['query'][_0xb42e('0x37')]));_0x209407[_0xb42e('0x38')]=_0x209407[_0xb42e('0x38')][_0xb42e('0x39')]?_0x209407[_0xb42e('0x38')]:_0x465a33[_0xb42e('0x35')];if(!_0x170748[_0xb42e('0x34')][_0xb42e('0x3a')](_0xb42e('0x3b'))){_0x209407[_0xb42e('0x20')]=qs[_0xb42e('0x20')](_0x170748[_0xb42e('0x34')][_0xb42e('0x20')]);_0x209407[_0xb42e('0x22')]=qs[_0xb42e('0x22')](_0x170748[_0xb42e('0x34')][_0xb42e('0x22')]);}_0x209407[_0xb42e('0x3c')]=qs['sort'](_0x170748[_0xb42e('0x34')][_0xb42e('0x3d')]);_0x209407[_0xb42e('0x3e')]=qs[_0xb42e('0x3f')](_[_0xb42e('0x40')](_0x170748['query'],_0x465a33[_0xb42e('0x3f')]),_0x21090e);if(_0x170748['query'][_0xb42e('0x41')]){_0x209407[_0xb42e('0x3e')]=_[_0xb42e('0x42')](_0x209407['where'],{'$or':_['map'](_0x21090e,function(_0x181feb){if(_0x181feb['type']!==_0xb42e('0x43')){var _0x221593={};_0x221593[_0x181feb[_0xb42e('0x2d')]]={'$like':'%'+_0x170748[_0xb42e('0x34')][_0xb42e('0x41')]+'%'};return _0x221593;}})});}_0x209407=_[_0xb42e('0x42')]({},_0x209407,_0x170748[_0xb42e('0x44')]);var _0x444a63={'where':_0x209407[_0xb42e('0x3e')]};return db[_0xb42e('0x30')][_0xb42e('0x21')](_0x444a63)['then'](function(_0x1f4a38){_0x57aa05[_0xb42e('0x21')]=_0x1f4a38;if(_0x170748[_0xb42e('0x34')][_0xb42e('0x45')]){_0x209407[_0xb42e('0x46')]=[{'all':!![]}];}return db[_0xb42e('0x30')][_0xb42e('0x47')](_0x209407);})[_0xb42e('0x2c')](function(_0x585b3a){_0x57aa05[_0xb42e('0x48')]=_0x585b3a;return _0x57aa05;})['then'](respondWithFilteredResult(_0x3f22aa,_0x209407))[_0xb42e('0x49')](handleError(_0x3f22aa,null));};exports[_0xb42e('0x4a')]=function(_0x4f69f1,_0x2a5713){var _0x1956f8={'raw':![],'where':{'id':_0x4f69f1['params']['id']}},_0x4bec01={};_0x4bec01['model']=_[_0xb42e('0x4b')](db[_0xb42e('0x30')][_0xb42e('0x31')]);_0x4bec01[_0xb42e('0x34')]=_[_0xb42e('0x4b')](_0x4f69f1[_0xb42e('0x34')]);_0x4bec01[_0xb42e('0x3f')]=_['intersection'](_0x4bec01[_0xb42e('0x35')],_0x4bec01['query']);_0x1956f8[_0xb42e('0x38')]=_[_0xb42e('0x36')](_0x4bec01['model'],qs['fields'](_0x4f69f1[_0xb42e('0x34')][_0xb42e('0x37')]));_0x1956f8[_0xb42e('0x38')]=_0x1956f8[_0xb42e('0x38')][_0xb42e('0x39')]?_0x1956f8[_0xb42e('0x38')]:_0x4bec01[_0xb42e('0x35')];if(_0x4f69f1[_0xb42e('0x34')][_0xb42e('0x45')]){_0x1956f8[_0xb42e('0x46')]=[{'all':!![]}];}_0x1956f8=_['merge']({},_0x1956f8,_0x4f69f1[_0xb42e('0x44')]);return db[_0xb42e('0x30')][_0xb42e('0x4c')](_0x1956f8)[_0xb42e('0x2c')](handleEntityNotFound(_0x2a5713,null))['then'](respondWithResult(_0x2a5713,null))[_0xb42e('0x49')](handleError(_0x2a5713,null));};exports[_0xb42e('0x4d')]=function(_0x4759e3,_0x2a5ed3){return db[_0xb42e('0x30')][_0xb42e('0x4d')](_0x4759e3[_0xb42e('0x4e')],{})['then'](function(_0x11fe64){var _0x29499d=_0x4759e3[_0xb42e('0x4f')][_0xb42e('0x28')]({'plain':!![]});if(!_0x29499d)throw new Error(_0xb42e('0x50'));if(_0x29499d[_0xb42e('0x51')]===_0xb42e('0x4f')){var _0x2bcd62=_0x11fe64[_0xb42e('0x28')]({'plain':!![]});var _0x10f7c9='SquareProjects';return db[_0xb42e('0x52')][_0xb42e('0x4c')]({'where':{'name':_0x10f7c9,'userProfileId':_0x29499d[_0xb42e('0x53')]},'raw':!![]})['then'](function(_0x253976){if(_0x253976&&_0x253976[_0xb42e('0x54')]===0x0){return db[_0xb42e('0x2a')]['create']({'name':_0x2bcd62[_0xb42e('0x2d')],'resourceId':_0x2bcd62['id'],'type':_0x253976[_0xb42e('0x2d')],'sectionId':_0x253976['id']},{})[_0xb42e('0x2c')](function(){return _0x11fe64;});}else{return _0x11fe64;}})['catch'](function(_0x4e6b6d){logger[_0xb42e('0x55')](_0xb42e('0x56'),_0x4e6b6d);throw _0x4e6b6d;});}return _0x11fe64;})[_0xb42e('0x2c')](respondWithResult(_0x2a5ed3,0xc9))[_0xb42e('0x49')](handleError(_0x2a5ed3,null));};exports[_0xb42e('0x27')]=function(_0x270777,_0x239a1c){if(_0x270777[_0xb42e('0x4e')]['id']){delete _0x270777[_0xb42e('0x4e')]['id'];}return db[_0xb42e('0x30')][_0xb42e('0x4c')]({'where':{'id':_0x270777[_0xb42e('0x57')]['id']}})[_0xb42e('0x2c')](handleEntityNotFound(_0x239a1c,null))[_0xb42e('0x2c')](saveUpdates(_0x270777[_0xb42e('0x4e')],null))[_0xb42e('0x2c')](respondWithResult(_0x239a1c,null))[_0xb42e('0x49')](handleError(_0x239a1c,null));};exports[_0xb42e('0x2b')]=function(_0x3bbe7f,_0x388e7a){return db['SquareProject'][_0xb42e('0x4c')]({'where':{'id':_0x3bbe7f[_0xb42e('0x57')]['id']}})[_0xb42e('0x2c')](handleEntityNotFound(_0x388e7a,null))[_0xb42e('0x2c')](removeEntity(_0x388e7a,null))[_0xb42e('0x49')](handleError(_0x388e7a,null));};exports[_0xb42e('0x58')]=function(_0x155301,_0x16f38b,_0x1d0a38){return db['SquareProject']['find']({'where':{'id':_0x155301[_0xb42e('0x57')]['id']}})['then'](handleEntityNotFound(_0x16f38b,null))[_0xb42e('0x2c')](function(_0x9ac241){if(_0x9ac241){return _0x9ac241['addUsers'](_0x155301['body']['ids'],_[_0xb42e('0x59')](_0x155301['body'],[_0xb42e('0x5a'),'id'])||{});}})[_0xb42e('0x2c')](respondWithResult(_0x16f38b,null))[_0xb42e('0x49')](handleError(_0x16f38b,null));};exports[_0xb42e('0x5b')]=function(_0xd04b04,_0xf77ae6,_0x61f2a){return db[_0xb42e('0x30')][_0xb42e('0x4c')]({'where':{'id':_0xd04b04['params']['id']}})[_0xb42e('0x2c')](handleEntityNotFound(_0xf77ae6,null))[_0xb42e('0x2c')](function(_0xf5734){if(_0xf5734){return _0xf5734[_0xb42e('0x5b')](_0xd04b04[_0xb42e('0x34')][_0xb42e('0x5a')])[_0xb42e('0x2c')](function(){if(_[_0xb42e('0x5c')](_0xd04b04['query'][_0xb42e('0x5a')])){for(var _0x468e49=0x0;_0x468e49<_0xd04b04['query'][_0xb42e('0x5a')]['length'];_0x468e49+=0x1){socket['emit'](_0xb42e('0x5d'),{'UserId':Number(_0xd04b04[_0xb42e('0x34')][_0xb42e('0x5a')][_0x468e49]),'SquareProjectId':Number(_0xd04b04['params']['id'])});}}else{socket['emit'](_0xb42e('0x5d'),{'UserId':Number(_0xd04b04[_0xb42e('0x34')][_0xb42e('0x5a')]),'SquareProjectId':Number(_0xd04b04[_0xb42e('0x57')]['id'])});}});}})[_0xb42e('0x2c')](respondWithStatusCode(_0xf77ae6,null))['catch'](handleError(_0xf77ae6,null));};exports[_0xb42e('0x5e')]=function(_0xaeee65,_0x5d176b,_0x6191f5){var _0x200528={};var _0x184cb8={};var _0x4eb084;var _0x162a62;return db['SquareProject'][_0xb42e('0x5f')]({'where':{'id':_0xaeee65['params']['id']}})[_0xb42e('0x2c')](handleEntityNotFound(_0x5d176b,null))['then'](function(_0x41cb7b){if(_0x41cb7b){_0x4eb084=_0x41cb7b;_0x184cb8['model']=_['keys'](db['User']['rawAttributes']);_0x184cb8['query']=_['keys'](_0xaeee65[_0xb42e('0x34')]);_0x184cb8[_0xb42e('0x3f')]=_[_0xb42e('0x36')](_0x184cb8[_0xb42e('0x35')],_0x184cb8[_0xb42e('0x34')]);_0x200528[_0xb42e('0x38')]=_[_0xb42e('0x36')](_0x184cb8[_0xb42e('0x35')],qs[_0xb42e('0x37')](_0xaeee65[_0xb42e('0x34')][_0xb42e('0x37')]));_0x200528[_0xb42e('0x38')]=_0x200528[_0xb42e('0x38')][_0xb42e('0x39')]?_0x200528[_0xb42e('0x38')]:_0x184cb8['model'];_0x200528['order']=qs[_0xb42e('0x3d')](_0xaeee65[_0xb42e('0x34')][_0xb42e('0x3d')]);_0x200528[_0xb42e('0x3e')]=qs['filters'](_[_0xb42e('0x40')](_0xaeee65[_0xb42e('0x34')],_0x184cb8['filters']));if(_0xaeee65[_0xb42e('0x34')][_0xb42e('0x41')]){_0x200528[_0xb42e('0x3e')]=_['merge'](_0x200528[_0xb42e('0x3e')],{'$or':_[_0xb42e('0x2f')](_0x200528[_0xb42e('0x38')],function(_0x4caf8a){var _0x201e8f={};_0x201e8f[_0x4caf8a]={'$like':'%'+_0xaeee65['query'][_0xb42e('0x41')]+'%'};return _0x201e8f;})});}_0x200528=_[_0xb42e('0x42')]({},_0x200528,_0xaeee65['options']);return _0x4eb084[_0xb42e('0x5e')](_0x200528);}})['then'](function(_0x3c78d6){if(_0x3c78d6){_0x162a62=_0x3c78d6[_0xb42e('0x39')];if(!_0xaeee65['query']['hasOwnProperty'](_0xb42e('0x3b'))){_0x200528[_0xb42e('0x20')]=qs[_0xb42e('0x20')](_0xaeee65['query'][_0xb42e('0x20')]);_0x200528[_0xb42e('0x22')]=qs[_0xb42e('0x22')](_0xaeee65['query'][_0xb42e('0x22')]);}return _0x4eb084[_0xb42e('0x5e')](_0x200528);}})[_0xb42e('0x2c')](function(_0x2c7989){if(_0x2c7989){return _0x2c7989?{'count':_0x162a62,'rows':_0x2c7989}:null;}})[_0xb42e('0x2c')](respondWithResult(_0x5d176b,null))[_0xb42e('0x49')](handleError(_0x5d176b,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 80e6b2c..caf1896 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 _0x06b9=['SquareProject','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3a2ca4,_0x5c5809){var _0x4624e6=function(_0x427b01){while(--_0x427b01){_0x3a2ca4['push'](_0x3a2ca4['shift']());}};_0x4624e6(++_0x5c5809);}(_0x06b9,0x1b8));var _0x906b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06b9[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x906b('0x0'))['db'][_0x906b('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x906b('0x2')](0x0);var events={'afterCreate':_0x906b('0x3'),'afterUpdate':'update','afterDestroy':_0x906b('0x4')};function emitEvent(_0xdba685){return function(_0x436d0e,_0x4c06ba,_0x58b3e0){SquareProjectEvents['emit'](_0xdba685+':'+_0x436d0e['id'],_0x436d0e);SquareProjectEvents[_0x906b('0x5')](_0xdba685,_0x436d0e);_0x58b3e0(null);};}for(var e in events){if(events[_0x906b('0x6')](e)){var event=events[e];SquareProject[_0x906b('0x7')](e,emitEvent(event));}}module[_0x906b('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x3c4b=['events','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x28603c,_0x4a63f4){var _0x21ae3f=function(_0x2180e2){while(--_0x2180e2){_0x28603c['push'](_0x28603c['shift']());}};_0x21ae3f(++_0x4a63f4);}(_0x3c4b,0x129));var _0xb3c4=function(_0x583e18,_0x18c831){_0x583e18=_0x583e18-0x0;var _0x55a6f4=_0x3c4b[_0x583e18];return _0x55a6f4;};'use strict';var EventEmitter=require(_0xb3c4('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xb3c4('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb3c4('0x2')](0x0);var events={'afterCreate':_0xb3c4('0x3'),'afterUpdate':_0xb3c4('0x4'),'afterDestroy':_0xb3c4('0x5')};function emitEvent(_0x2a3f5d){return function(_0x74d4d9,_0xd39d9d,_0x50257b){SquareProjectEvents[_0xb3c4('0x6')](_0x2a3f5d+':'+_0x74d4d9['id'],_0x74d4d9);SquareProjectEvents[_0xb3c4('0x6')](_0x2a3f5d,_0x74d4d9);_0x50257b(null);};}for(var e in events){if(events[_0xb3c4('0x7')](e)){var event=events[e];SquareProject[_0xb3c4('0x8')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 6c5aa11..0fc542f 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 _0xe760=['request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','lodash','../../config/logger','bluebird'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe760,0x9f));var _0x0e76=function(_0x330d03,_0x4c791c){_0x330d03=_0x330d03-0x0;var _0x24c560=_0xe760[_0x330d03];return _0x24c560;};'use strict';var _=require(_0x0e76('0x0'));var util=require('util');var logger=require(_0x0e76('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0e76('0x2'));var rp=require(_0x0e76('0x3'));var fs=require('fs');var path=require(_0x0e76('0x4'));var rimraf=require(_0x0e76('0x5'));var config=require(_0x0e76('0x6'));var attributes=require(_0x0e76('0x7'));module[_0x0e76('0x8')]=function(_0x4a1ad0,_0x38797c){return _0x4a1ad0[_0x0e76('0x9')]('SquareProject',attributes,{'tableName':_0x0e76('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x970d04,_0x4401e2,_0x4d409d){if(_0x970d04['changed'](_0x0e76('0xb'))){_0x970d04[_0x0e76('0xc')]=moment()[_0x0e76('0xd')](_0x0e76('0xe'));}if(_0x970d04[_0x0e76('0xf')](_0x0e76('0x10'))){_0x970d04[_0x0e76('0x11')]=moment()[_0x0e76('0xd')](_0x0e76('0xe'));}_0x4d409d(null,_0x970d04);}}});}; \ No newline at end of file +var _0x81ec=['savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','util','../../config/logger','bluebird','request-promise','rimraf','exports','define','SquareProject','changed','preproduction'];(function(_0x540df4,_0x264a86){var _0x23dc36=function(_0x3661ba){while(--_0x3661ba){_0x540df4['push'](_0x540df4['shift']());}};_0x23dc36(++_0x264a86);}(_0x81ec,0x140));var _0xc81e=function(_0x1a42bc,_0x34a88c){_0x1a42bc=_0x1a42bc-0x0;var _0x33fd2b=_0x81ec[_0x1a42bc];return _0x33fd2b;};'use strict';var _=require('lodash');var util=require(_0xc81e('0x0'));var logger=require(_0xc81e('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc81e('0x2'));var rp=require(_0xc81e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc81e('0x4'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0xc81e('0x5')]=function(_0x1b0674,_0x4389fe){return _0x1b0674[_0xc81e('0x6')](_0xc81e('0x7'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59f1f3,_0x213973,_0x59ff60){if(_0x59f1f3[_0xc81e('0x8')](_0xc81e('0x9'))){_0x59f1f3[_0xc81e('0xa')]=moment()[_0xc81e('0xb')](_0xc81e('0xc'));}if(_0x59f1f3['changed'](_0xc81e('0xd'))){_0x59f1f3[_0xc81e('0xe')]=moment()[_0xc81e('0xb')](_0xc81e('0xc'));}_0x59ff60(null,_0x59f1f3);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index a0da2d1..c7fc145 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 _0x2866=['SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','debug'];(function(_0x5d0e4f,_0xe751d2){var _0x51ec1e=function(_0x51688f){while(--_0x51688f){_0x5d0e4f['push'](_0x5d0e4f['shift']());}};_0x51ec1e(++_0xe751d2);}(_0x2866,0xae));var _0x6286=function(_0x1a89ca,_0x27394b){_0x1a89ca=_0x1a89ca-0x0;var _0x29cbb2=_0x2866[_0x1a89ca];return _0x29cbb2;};'use strict';var _=require(_0x6286('0x0'));var util=require(_0x6286('0x1'));var moment=require(_0x6286('0x2'));var BPromise=require(_0x6286('0x3'));var rs=require(_0x6286('0x4'));var fs=require('fs');var Redis=require(_0x6286('0x5'));var db=require(_0x6286('0x6'))['db'];var utils=require(_0x6286('0x7'));var logger=require('../../config/logger')(_0x6286('0x8'));var config=require(_0x6286('0x9'));var jayson=require(_0x6286('0xa'));var client=jayson[_0x6286('0xb')]['http']({'port':0x232a});config[_0x6286('0xc')]=_['defaults'](config[_0x6286('0xc')],{'host':_0x6286('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6286('0xc')]));require(_0x6286('0xe'))[_0x6286('0xf')](socket);function respondWithRpcPromise(_0x33f7a1,_0x557c31,_0x426ddd){return new BPromise(function(_0x191c91,_0x30a1be){return client[_0x6286('0x10')](_0x33f7a1,_0x426ddd)[_0x6286('0x11')](function(_0x3b1dbd){logger[_0x6286('0x12')](_0x6286('0x13'),_0x557c31,'request\x20sent');logger[_0x6286('0x14')](_0x6286('0x15'),_0x557c31,'request\x20sent',JSON['stringify'](_0x3b1dbd));if(_0x3b1dbd[_0x6286('0x16')]){if(_0x3b1dbd[_0x6286('0x16')][_0x6286('0x17')]===0x1f4){logger['error'](_0x6286('0x13'),_0x557c31,_0x3b1dbd[_0x6286('0x16')][_0x6286('0x18')]);return _0x30a1be(_0x3b1dbd[_0x6286('0x16')][_0x6286('0x18')]);}logger[_0x6286('0x16')](_0x6286('0x13'),_0x557c31,_0x3b1dbd[_0x6286('0x16')][_0x6286('0x18')]);return _0x191c91(_0x3b1dbd[_0x6286('0x16')][_0x6286('0x18')]);}else{logger['info'](_0x6286('0x13'),_0x557c31,_0x6286('0x19'));_0x191c91(_0x3b1dbd[_0x6286('0x1a')][_0x6286('0x18')]);}})['catch'](function(_0x252db7){logger['error']('SquareProject,\x20%s,\x20%s',_0x557c31,_0x252db7);_0x30a1be(_0x252db7);});});}exports[_0x6286('0x1b')]=function(_0x416991){var _0x3dc6a7=this;return new Promise(function(_0x52a2c7,_0x12f648){return db[_0x6286('0x1c')][_0x6286('0x1d')]({'raw':_0x416991[_0x6286('0x1e')]?_0x416991[_0x6286('0x1e')][_0x6286('0x1f')]===undefined?!![]:![]:!![],'where':_0x416991[_0x6286('0x1e')]?_0x416991['options'][_0x6286('0x20')]||null:null,'attributes':_0x416991[_0x6286('0x1e')]?_0x416991[_0x6286('0x1e')][_0x6286('0x21')]||null:null,'include':_0x416991[_0x6286('0x1e')]?_0x416991['options'][_0x6286('0x22')]?_[_0x6286('0x23')](_0x416991[_0x6286('0x1e')][_0x6286('0x22')],function(_0x361c19){return{'model':db[_0x361c19[_0x6286('0x24')]],'as':_0x361c19['as'],'attributes':_0x361c19['attributes'],'include':_0x361c19[_0x6286('0x22')]?_['map'](_0x361c19[_0x6286('0x22')],function(_0x34826f){return{'model':db[_0x34826f[_0x6286('0x24')]],'as':_0x34826f['as'],'attributes':_0x34826f[_0x6286('0x21')],'include':_0x34826f['include']?_[_0x6286('0x23')](_0x34826f['include'],function(_0x562cb3){return{'model':db[_0x562cb3[_0x6286('0x24')]],'as':_0x562cb3['as'],'attributes':_0x562cb3[_0x6286('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9a6a8b){logger[_0x6286('0x12')](_0x6286('0x1b'),_0x416991);logger[_0x6286('0x14')](_0x6286('0x1b'),_0x416991,JSON[_0x6286('0x25')](_0x9a6a8b));_0x52a2c7(_0x9a6a8b);})[_0x6286('0x26')](function(_0xcee391){logger[_0x6286('0x16')]('ShowSquareProject',_0xcee391[_0x6286('0x18')],_0x416991);_0x12f648(_0x3dc6a7['error'](0x1f4,_0xcee391[_0x6286('0x18')]));});});}; \ No newline at end of file +var _0xc08f=['defaults','localhost','./squareProject.socket','register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareProject','SquareProject','raw','where','options','attributes','include','model','map','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x502f60,_0x345e6d){var _0x2fe26f=function(_0x41fb8f){while(--_0x41fb8f){_0x502f60['push'](_0x502f60['shift']());}};_0x2fe26f(++_0x345e6d);}(_0xc08f,0x12a));var _0xfc08=function(_0x520d9b,_0x217fc0){_0x520d9b=_0x520d9b-0x0;var _0x34f3f9=_0xc08f[_0x520d9b];return _0x34f3f9;};'use strict';var _=require(_0xfc08('0x0'));var util=require(_0xfc08('0x1'));var moment=require(_0xfc08('0x2'));var BPromise=require(_0xfc08('0x3'));var rs=require(_0xfc08('0x4'));var fs=require('fs');var Redis=require(_0xfc08('0x5'));var db=require(_0xfc08('0x6'))['db'];var utils=require(_0xfc08('0x7'));var logger=require(_0xfc08('0x8'))(_0xfc08('0x9'));var config=require(_0xfc08('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfc08('0xb')][_0xfc08('0xc')]({'port':0x232a});config[_0xfc08('0xd')]=_[_0xfc08('0xe')](config[_0xfc08('0xd')],{'host':_0xfc08('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc08('0xd')]));require(_0xfc08('0x10'))[_0xfc08('0x11')](socket);function respondWithRpcPromise(_0x2b3c01,_0x135b35,_0x563397){return new BPromise(function(_0xd9f98c,_0x39feb4){return client[_0xfc08('0x12')](_0x2b3c01,_0x563397)['then'](function(_0x4717e3){logger[_0xfc08('0x13')](_0xfc08('0x14'),_0x135b35,_0xfc08('0x15'));logger[_0xfc08('0x16')](_0xfc08('0x17'),_0x135b35,_0xfc08('0x15'),JSON['stringify'](_0x4717e3));if(_0x4717e3[_0xfc08('0x18')]){if(_0x4717e3[_0xfc08('0x18')][_0xfc08('0x19')]===0x1f4){logger[_0xfc08('0x18')](_0xfc08('0x14'),_0x135b35,_0x4717e3[_0xfc08('0x18')][_0xfc08('0x1a')]);return _0x39feb4(_0x4717e3[_0xfc08('0x18')]['message']);}logger[_0xfc08('0x18')]('SquareProject,\x20%s,\x20%s',_0x135b35,_0x4717e3[_0xfc08('0x18')][_0xfc08('0x1a')]);return _0xd9f98c(_0x4717e3[_0xfc08('0x18')][_0xfc08('0x1a')]);}else{logger['info'](_0xfc08('0x14'),_0x135b35,'request\x20sent');_0xd9f98c(_0x4717e3[_0xfc08('0x1b')]['message']);}})[_0xfc08('0x1c')](function(_0x5b72b3){logger['error']('SquareProject,\x20%s,\x20%s',_0x135b35,_0x5b72b3);_0x39feb4(_0x5b72b3);});});}exports[_0xfc08('0x1d')]=function(_0x32e582){var _0x121c36=this;return new Promise(function(_0x4e2a97,_0x176125){return db[_0xfc08('0x1e')]['find']({'raw':_0x32e582['options']?_0x32e582['options'][_0xfc08('0x1f')]===undefined?!![]:![]:!![],'where':_0x32e582['options']?_0x32e582['options'][_0xfc08('0x20')]||null:null,'attributes':_0x32e582[_0xfc08('0x21')]?_0x32e582[_0xfc08('0x21')][_0xfc08('0x22')]||null:null,'include':_0x32e582[_0xfc08('0x21')]?_0x32e582['options'][_0xfc08('0x23')]?_['map'](_0x32e582['options']['include'],function(_0x19d647){return{'model':db[_0x19d647[_0xfc08('0x24')]],'as':_0x19d647['as'],'attributes':_0x19d647[_0xfc08('0x22')],'include':_0x19d647['include']?_['map'](_0x19d647[_0xfc08('0x23')],function(_0x505805){return{'model':db[_0x505805[_0xfc08('0x24')]],'as':_0x505805['as'],'attributes':_0x505805['attributes'],'include':_0x505805['include']?_[_0xfc08('0x25')](_0x505805[_0xfc08('0x23')],function(_0x5180aa){return{'model':db[_0x5180aa[_0xfc08('0x24')]],'as':_0x5180aa['as'],'attributes':_0x5180aa['attributes']};}):[]};}):[]};}):[]:[]})[_0xfc08('0x26')](function(_0x5dc796){logger[_0xfc08('0x13')](_0xfc08('0x1d'),_0x32e582);logger['debug']('ShowSquareProject',_0x32e582,JSON['stringify'](_0x5dc796));_0x4e2a97(_0x5dc796);})[_0xfc08('0x1c')](function(_0x3c76cc){logger[_0xfc08('0x18')](_0xfc08('0x1d'),_0x3c76cc[_0xfc08('0x1a')],_0x32e582);_0x176125(_0x121c36[_0xfc08('0x18')](0x1f4,_0x3c76cc['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index a3a9dac..b158893 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 _0x0ecb=['./squareProject.events','save','update','emit','removeListener','length','squareProject:'];(function(_0x1c1780,_0x93cb2){var _0x5eb4ae=function(_0x11a831){while(--_0x11a831){_0x1c1780['push'](_0x1c1780['shift']());}};_0x5eb4ae(++_0x93cb2);}(_0x0ecb,0x11f));var _0xb0ec=function(_0x2d3728,_0x4c05b2){_0x2d3728=_0x2d3728-0x0;var _0x13bac3=_0x0ecb[_0x2d3728];return _0x13bac3;};'use strict';var SquareProjectEvents=require(_0xb0ec('0x0'));var events=[_0xb0ec('0x1'),'remove',_0xb0ec('0x2')];function createListener(_0x14e72a,_0x812577){return function(_0x56eb60){_0x812577[_0xb0ec('0x3')](_0x14e72a,_0x56eb60);};}function removeListener(_0x3e6a63,_0x32e7d2){return function(){SquareProjectEvents[_0xb0ec('0x4')](_0x3e6a63,_0x32e7d2);};}exports['register']=function(_0x11f2d4){for(var _0x3f39c9=0x0,_0x2ad285=events[_0xb0ec('0x5')];_0x3f39c9<_0x2ad285;_0x3f39c9++){var _0x40e3e1=events[_0x3f39c9];var _0x59b29e=createListener(_0xb0ec('0x6')+_0x40e3e1,_0x11f2d4);SquareProjectEvents['on'](_0x40e3e1,_0x59b29e);}}; \ No newline at end of file +var _0xddb6=['save','update','emit','removeListener','register','./squareProject.events'];(function(_0x3187b0,_0x4cee2a){var _0x12c691=function(_0x25f27c){while(--_0x25f27c){_0x3187b0['push'](_0x3187b0['shift']());}};_0x12c691(++_0x4cee2a);}(_0xddb6,0x89));var _0x6ddb=function(_0xebfde5,_0x3e8236){_0xebfde5=_0xebfde5-0x0;var _0x2a3d41=_0xddb6[_0xebfde5];return _0x2a3d41;};'use strict';var SquareProjectEvents=require(_0x6ddb('0x0'));var events=[_0x6ddb('0x1'),'remove',_0x6ddb('0x2')];function createListener(_0x373110,_0x1a23d6){return function(_0x2c85ef){_0x1a23d6[_0x6ddb('0x3')](_0x373110,_0x2c85ef);};}function removeListener(_0x3f0180,_0x1e1cd1){return function(){SquareProjectEvents[_0x6ddb('0x4')](_0x3f0180,_0x1e1cd1);};}exports[_0x6ddb('0x5')]=function(_0xa911c){for(var _0x476c0f=0x0,_0x1af8ff=events['length'];_0x476c0f<_0x1af8ff;_0x476c0f++){var _0x3bc42c=events[_0x476c0f];var _0x314a91=createListener('squareProject:'+_0x3bc42c,_0xa911c);SquareProjectEvents['on'](_0x3bc42c,_0x314a91);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 8068c24..d8c5ef2 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 _0x7217=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0x7217,0x19e));var _0x7721=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x7217[_0x387777];return _0x3f84c0;};'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('0xf')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x13')]);module['exports']=router; \ No newline at end of file +var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x85de56,_0x1d9596){var _0x115f55=function(_0x3e3012){while(--_0x3e3012){_0x85de56['push'](_0x85de56['shift']());}};_0x115f55(++_0x1d9596);}(_0x814b,0x1a2));var _0xb814=function(_0x24a654,_0x2ca441){_0x24a654=_0x24a654-0x0;var _0x458651=_0x814b[_0x24a654];return _0x458651;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 45cab3d..ab8dfb1 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 _0xf2ca=['getDataValue','substring','sequelize','exports','STRING','VIRTUAL'];(function(_0x532992,_0x492c06){var _0x57cbcb=function(_0x96b637){while(--_0x96b637){_0x532992['push'](_0x532992['shift']());}};_0x57cbcb(++_0x492c06);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x469fc4,_0x427a80){_0x469fc4=_0x469fc4-0x0;var _0x11f6d4=_0xf2ca[_0x469fc4];return _0x11f6d4;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'uniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xaf2c('0x2')]},'context':{'type':Sequelize[_0xaf2c('0x2')]},'extension':{'type':Sequelize[_0xaf2c('0x2')]},'priority':{'type':Sequelize[_0xaf2c('0x2')]},'accountcode':{'type':Sequelize[_0xaf2c('0x2')]},'dnid':{'type':Sequelize[_0xaf2c('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xaf2c('0x2')]},'filename':{'type':Sequelize[_0xaf2c('0x2')]},'savePath':{'type':Sequelize[_0xaf2c('0x2')]},'format':{'type':Sequelize[_0xaf2c('0x3')],'get':function(){var _0x58351f='';var _0x37fedd=this[_0xaf2c('0x4')]('savePath');if(_0x37fedd){_0x58351f=_0x37fedd[_0xaf2c('0x5')](_0x37fedd['lastIndexOf']('.'));}return _0x58351f;}}}; \ No newline at end of file +var _0xd6d6=['substring','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0xf02b98,_0xb0ee62){var _0x1b9a63=function(_0x261cdd){while(--_0x261cdd){_0xf02b98['push'](_0xf02b98['shift']());}};_0x1b9a63(++_0xb0ee62);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x41b20f,_0x3e1d12){_0x41b20f=_0x41b20f-0x0;var _0x369cb2=_0xd6d6[_0x41b20f];return _0x369cb2;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'uniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'callerid':{'type':Sequelize[_0x6d6d('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6d6d('0x2')]},'extension':{'type':Sequelize[_0x6d6d('0x2')]},'priority':{'type':Sequelize[_0x6d6d('0x2')]},'accountcode':{'type':Sequelize[_0x6d6d('0x2')]},'dnid':{'type':Sequelize[_0x6d6d('0x2')]},'projectName':{'type':Sequelize[_0x6d6d('0x2')]},'saveName':{'type':Sequelize[_0x6d6d('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x6d6d('0x2')]},'format':{'type':Sequelize[_0x6d6d('0x3')],'get':function(){var _0x44f83d='';var _0x18f824=this[_0x6d6d('0x4')](_0x6d6d('0x5'));if(_0x18f824){_0x44f83d=_0x18f824[_0x6d6d('0x6')](_0x18f824['lastIndexOf']('.'));}return _0x44f83d;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 5398662..330f452 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 _0xd43e=['map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','SquareRecording','includeAll','findAll','rows','catch','params','include','find','create','body','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','Sequelize','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','isNil','info','File:\x20\x22','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','reject','save','update','destroy','then','end','stack','name','send','rawAttributes','fieldName','type','model'];(function(_0xfad1a7,_0x2e3b8d){var _0x571012=function(_0x33255d){while(--_0x33255d){_0xfad1a7['push'](_0xfad1a7['shift']());}};_0x571012(++_0x2e3b8d);}(_0xd43e,0xe4));var _0xed43=function(_0x5ade57,_0x3fe0a7){_0x5ade57=_0x5ade57-0x0;var _0x3a4fb5=_0xd43e[_0x5ade57];return _0x3a4fb5;};'use strict';var emlformat=require(_0xed43('0x0'));var rimraf=require(_0xed43('0x1'));var zipdir=require(_0xed43('0x2'));var jsonpatch=require(_0xed43('0x3'));var rp=require(_0xed43('0x4'));var moment=require(_0xed43('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xed43('0x6'));var util=require(_0xed43('0x7'));var path=require('path');var sox=require(_0xed43('0x8'));var csv=require(_0xed43('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed43('0xa'));var squel=require(_0xed43('0xb'));var crypto=require(_0xed43('0xc'));var jsforce=require(_0xed43('0xd'));var deskjs=require(_0xed43('0xe'));var toCsv=require(_0xed43('0x9'));var querystring=require(_0xed43('0xf'));var Papa=require(_0xed43('0x10'));var Redis=require(_0xed43('0x11'));var authService=require(_0xed43('0x12'));var qs=require(_0xed43('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed43('0x14'));var logger=require(_0xed43('0x15'))('api');var utils=require(_0xed43('0x16'));var config=require(_0xed43('0x17'));var licenseUtil=require(_0xed43('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x489719,_0x2783ae){_0x2783ae=_0x2783ae||0xcc;return function(_0xa1b9f5){if(_0xa1b9f5){return _0x489719[_0xed43('0x19')](_0x2783ae);}return _0x489719[_0xed43('0x1a')](_0x2783ae)['end']();};}function respondWithResult(_0x1189dd,_0x3bf65b){_0x3bf65b=_0x3bf65b||0xc8;return function(_0x370902){if(_0x370902){return _0x1189dd[_0xed43('0x1a')](_0x3bf65b)[_0xed43('0x1b')](_0x370902);}};}function respondWithFilteredResult(_0x2dc321,_0x94636e){return function(_0x415cc8){if(_0x415cc8){var _0x53ff78=typeof _0x94636e[_0xed43('0x1c')]===_0xed43('0x1d')&&typeof _0x94636e['limit']==='undefined';var _0x3e1154=_0x415cc8[_0xed43('0x1e')];var _0x1a12ce=_0x53ff78?0x0:_0x94636e[_0xed43('0x1c')];var _0x52cfb0=_0x53ff78?_0x415cc8['count']:_0x94636e[_0xed43('0x1c')]+_0x94636e[_0xed43('0x1f')];var _0x3813be;if(_0x52cfb0>=_0x3e1154){_0x52cfb0=_0x3e1154;_0x3813be=0xc8;}else{_0x3813be=0xce;}_0x2dc321[_0xed43('0x1a')](_0x3813be);return _0x2dc321['set']('Content-Range',_0x1a12ce+'-'+_0x52cfb0+'/'+_0x3e1154)['json'](_0x415cc8);}return null;};}function patchUpdates(_0x303f71){return function(_0x1bf831){try{jsonpatch['apply'](_0x1bf831,_0x303f71,!![]);}catch(_0x5d2104){return BPromise[_0xed43('0x20')](_0x5d2104);}return _0x1bf831[_0xed43('0x21')]();};}function saveUpdates(_0x101394,_0x51b5ae){return function(_0x23d363){if(_0x23d363){return _0x23d363[_0xed43('0x22')](_0x101394)['then'](function(_0x448c8d){return _0x448c8d;});}return null;};}function removeEntity(_0x5e58c7,_0x22510e){return function(_0x1f7000){if(_0x1f7000){return _0x1f7000[_0xed43('0x23')]()[_0xed43('0x24')](function(){_0x5e58c7['status'](0xcc)[_0xed43('0x25')]();});}};}function handleEntityNotFound(_0x1b1579,_0x4075e7){return function(_0x56b978){if(!_0x56b978){_0x1b1579['sendStatus'](0x194);}return _0x56b978;};}function handleError(_0x44a913,_0x3d34c2){_0x3d34c2=_0x3d34c2||0x1f4;return function(_0x35dddf){logger['error'](_0x35dddf[_0xed43('0x26')]);if(_0x35dddf[_0xed43('0x27')]){delete _0x35dddf[_0xed43('0x27')];}_0x44a913[_0xed43('0x1a')](_0x3d34c2)[_0xed43('0x28')](_0x35dddf);};}exports['index']=function(_0x4066de,_0x175da3){var _0x21aa38={},_0x487954={},_0x353c27={'count':0x0,'rows':[]};var _0xa6e104=_['map'](db['SquareRecording'][_0xed43('0x29')],function(_0x55b026){return{'name':_0x55b026[_0xed43('0x2a')],'type':_0x55b026[_0xed43('0x2b')]['key']};});_0x487954[_0xed43('0x2c')]=_[_0xed43('0x2d')](_0xa6e104,'name');_0x487954['query']=_[_0xed43('0x2e')](_0x4066de[_0xed43('0x2f')]);_0x487954[_0xed43('0x30')]=_['intersection'](_0x487954[_0xed43('0x2c')],_0x487954[_0xed43('0x2f')]);_0x21aa38[_0xed43('0x31')]=_[_0xed43('0x32')](_0x487954['model'],qs[_0xed43('0x33')](_0x4066de[_0xed43('0x2f')]['fields']));_0x21aa38[_0xed43('0x31')]=_0x21aa38['attributes'][_0xed43('0x34')]?_0x21aa38[_0xed43('0x31')]:_0x487954[_0xed43('0x2c')];if(!_0x4066de[_0xed43('0x2f')][_0xed43('0x35')](_0xed43('0x36'))){_0x21aa38[_0xed43('0x1f')]=qs[_0xed43('0x1f')](_0x4066de[_0xed43('0x2f')][_0xed43('0x1f')]);_0x21aa38['offset']=qs[_0xed43('0x1c')](_0x4066de[_0xed43('0x2f')][_0xed43('0x1c')]);}_0x21aa38[_0xed43('0x37')]=qs[_0xed43('0x38')](_0x4066de[_0xed43('0x2f')]['sort']);_0x21aa38['where']=qs[_0xed43('0x30')](_[_0xed43('0x39')](_0x4066de[_0xed43('0x2f')],_0x487954[_0xed43('0x30')]),_0xa6e104);if(_0x4066de[_0xed43('0x2f')]['filter']){_0x21aa38[_0xed43('0x3a')]=_[_0xed43('0x3b')](_0x21aa38['where'],{'$or':_['map'](_0xa6e104,function(_0x5477bf){if(_0x5477bf[_0xed43('0x2b')]!==_0xed43('0x3c')){var _0xed7bcb={};_0xed7bcb[_0x5477bf[_0xed43('0x27')]]={'$like':'%'+_0x4066de['query'][_0xed43('0x3d')]+'%'};return _0xed7bcb;}})});}_0x21aa38=_[_0xed43('0x3b')]({},_0x21aa38,_0x4066de[_0xed43('0x3e')]);var _0x9be251={'where':_0x21aa38[_0xed43('0x3a')]};return db[_0xed43('0x3f')][_0xed43('0x1e')](_0x9be251)['then'](function(_0x3073e2){_0x353c27['count']=_0x3073e2;if(_0x4066de[_0xed43('0x2f')][_0xed43('0x40')]){_0x21aa38['include']=[{'all':!![]}];}return db['SquareRecording'][_0xed43('0x41')](_0x21aa38);})[_0xed43('0x24')](function(_0x52ffc4){_0x353c27[_0xed43('0x42')]=_0x52ffc4;return _0x353c27;})['then'](respondWithFilteredResult(_0x175da3,_0x21aa38))[_0xed43('0x43')](handleError(_0x175da3,null));};exports['show']=function(_0x3c49d0,_0x29fa86){var _0xdeee77={'raw':!![],'where':{'id':_0x3c49d0[_0xed43('0x44')]['id']}},_0x20c05f={};_0x20c05f[_0xed43('0x2c')]=_[_0xed43('0x2e')](db[_0xed43('0x3f')][_0xed43('0x29')]);_0x20c05f[_0xed43('0x2f')]=_[_0xed43('0x2e')](_0x3c49d0[_0xed43('0x2f')]);_0x20c05f[_0xed43('0x30')]=_[_0xed43('0x32')](_0x20c05f['model'],_0x20c05f[_0xed43('0x2f')]);_0xdeee77[_0xed43('0x31')]=_[_0xed43('0x32')](_0x20c05f[_0xed43('0x2c')],qs[_0xed43('0x33')](_0x3c49d0[_0xed43('0x2f')][_0xed43('0x33')]));_0xdeee77['attributes']=_0xdeee77['attributes']['length']?_0xdeee77[_0xed43('0x31')]:_0x20c05f[_0xed43('0x2c')];if(_0x3c49d0[_0xed43('0x2f')]['includeAll']){_0xdeee77[_0xed43('0x45')]=[{'all':!![]}];}_0xdeee77=_[_0xed43('0x3b')]({},_0xdeee77,_0x3c49d0[_0xed43('0x3e')]);return db[_0xed43('0x3f')][_0xed43('0x46')](_0xdeee77)[_0xed43('0x24')](handleEntityNotFound(_0x29fa86,null))[_0xed43('0x24')](respondWithResult(_0x29fa86,null))[_0xed43('0x43')](handleError(_0x29fa86,null));};exports[_0xed43('0x47')]=function(_0x8259ad,_0x25cb75){return db['SquareRecording'][_0xed43('0x47')](_0x8259ad['body'],{})[_0xed43('0x24')](respondWithResult(_0x25cb75,0xc9))[_0xed43('0x43')](handleError(_0x25cb75,null));};exports[_0xed43('0x22')]=function(_0x58ec15,_0x1a8f3f){if(_0x58ec15[_0xed43('0x48')]['id']){delete _0x58ec15[_0xed43('0x48')]['id'];}return db[_0xed43('0x3f')][_0xed43('0x46')]({'where':{'id':_0x58ec15['params']['id']}})[_0xed43('0x24')](handleEntityNotFound(_0x1a8f3f,null))[_0xed43('0x24')](saveUpdates(_0x58ec15['body'],null))[_0xed43('0x24')](respondWithResult(_0x1a8f3f,null))[_0xed43('0x43')](handleError(_0x1a8f3f,null));};exports['download']=function(_0x447e1f,_0x1a058b,_0x3dfadf){var _0x4f4309=require('../../components/encryptor');var _0x4046c3=![];var _0x1f2a75={};if(_0x447e1f[_0xed43('0x2f')][_0xed43('0x2b')]&&_0x447e1f[_0xed43('0x2f')][_0xed43('0x2b')]==='uniqueid'){_0x1f2a75[_0xed43('0x49')]=_0x447e1f[_0xed43('0x44')]['id'];}else{_0x1f2a75['id']=_0x447e1f[_0xed43('0x44')]['id'];}return db[_0xed43('0x3f')]['find']({'where':_0x1f2a75,'attributes':['id',_0xed43('0x4a'),_0xed43('0x4b')],'raw':!![]})[_0xed43('0x24')](handleEntityNotFound(_0x1a058b,null))['then'](function(_0x2c2177){if(_0x2c2177){var _0x497543=_0x2c2177[_0xed43('0x4a')];var _0x14e5eb=util['format'](_0xed43('0x4c'),_0x497543);if(fs[_0xed43('0x4d')](_0x14e5eb)){_0x4046c3=!![];return _0x4f4309[_0xed43('0x4e')](_0x14e5eb,_0x497543,config[_0xed43('0x4f')]['recording'])[_0xed43('0x24')](function(){return _0x2c2177;});}return _0x2c2177;}})[_0xed43('0x24')](function(_0x355e29){if(_0x355e29){var _0x3d8376=_0x355e29[_0xed43('0x4a')];if(!fs[_0xed43('0x4d')](_0x3d8376)){throw new db[(_0xed43('0x50'))]['ValidationError'](_0xed43('0x51'));}if(_0x355e29['filename']){return _0x1a058b[_0xed43('0x52')](_0x3d8376,_0x355e29[_0xed43('0x4b')]+path[_0xed43('0x53')](_0x3d8376),function(){if(_0x4046c3){fs[_0xed43('0x54')](_0x3d8376);}});}else{return _0x1a058b[_0xed43('0x52')](_0x3d8376,function(_0x29601d){if(_0x4046c3){fs[_0xed43('0x54')](_0x3d8376);}});}}})['catch'](function(_0x55e7a2){if(_0x55e7a2[_0xed43('0x55')]===_0xed43('0x51')){_0x1a058b['status'](0x194)[_0xed43('0x28')](_0xed43('0x56'));}else{return handleError(_0x1a058b,null);}});};exports[_0xed43('0x23')]=function(_0x237af9,_0x1d2df9){return db['SquareRecording']['find']({'where':{'id':_0x237af9['params']['id']}})[_0xed43('0x24')](function(_0x4a424e){if(_[_0xed43('0x57')](_0x4a424e)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4a424e;})[_0xed43('0x24')](function(_0x44b1db){var _0x85620b=_0x44b1db[_0xed43('0x4a')];logger[_0xed43('0x58')]('cancellazione\x20fisica\x20documento\x20%s',_0x85620b);if(!_['isNil'](_0x44b1db['savePath'])&&fs[_0xed43('0x4d')](_0x85620b)){logger[_0xed43('0x58')](_0xed43('0x59')+_0x85620b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xed43('0x5a')](_0x85620b);}_0x85620b=_0x85620b+'.cypher';if(!_[_0xed43('0x57')](_0x44b1db[_0xed43('0x4a')])&&fs[_0xed43('0x4d')](_0x85620b)){logger['info'](_0xed43('0x59')+_0x85620b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xed43('0x5a')](_0x85620b);}return _0x44b1db;})[_0xed43('0x24')](function(_0x379b86){if(!_0x379b86)throw new InternalError();return _0x379b86[_0xed43('0x23')]();})[_0xed43('0x24')](function(){_0x1d2df9[_0xed43('0x1a')](0xcc)[_0xed43('0x25')]();})[_0xed43('0x43')](handleError(_0x1d2df9,null));}; \ No newline at end of file +var _0x7293=['isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','rows','show','params','include','find','catch','create','body','download','../../components/encryptor','uniqueid','filename','savePath','format','existsSync','secrets','recording','ValidationError','SquareRecording\x20not\x20found','unlink','message'];(function(_0x52260f,_0x455667){var _0x27ac6b=function(_0x57995a){while(--_0x57995a){_0x52260f['push'](_0x52260f['shift']());}};_0x27ac6b(++_0x455667);}(_0x7293,0x1c9));var _0x3729=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7293[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x3729('0x0'));var rimraf=require(_0x3729('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3729('0x2'));var rp=require(_0x3729('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3729('0x4'));var util=require(_0x3729('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x3729('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3729('0x7'));var _=require(_0x3729('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3729('0x9'));var deskjs=require(_0x3729('0xa'));var toCsv=require(_0x3729('0x6'));var querystring=require(_0x3729('0xb'));var Papa=require('papaparse');var Redis=require(_0x3729('0xc'));var authService=require(_0x3729('0xd'));var qs=require(_0x3729('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3729('0xf'));var logger=require(_0x3729('0x10'))(_0x3729('0x11'));var utils=require(_0x3729('0x12'));var config=require(_0x3729('0x13'));var licenseUtil=require(_0x3729('0x14'));var db=require(_0x3729('0x15'))['db'];function respondWithStatusCode(_0x4231ba,_0x4d0781){_0x4d0781=_0x4d0781||0xcc;return function(_0x1738cf){if(_0x1738cf){return _0x4231ba[_0x3729('0x16')](_0x4d0781);}return _0x4231ba[_0x3729('0x17')](_0x4d0781)[_0x3729('0x18')]();};}function respondWithResult(_0x19c461,_0x45daed){_0x45daed=_0x45daed||0xc8;return function(_0x14eebd){if(_0x14eebd){return _0x19c461[_0x3729('0x17')](_0x45daed)[_0x3729('0x19')](_0x14eebd);}};}function respondWithFilteredResult(_0x97e622,_0x3ce2f5){return function(_0x3f30dd){if(_0x3f30dd){var _0x4fef3b=typeof _0x3ce2f5[_0x3729('0x1a')]===_0x3729('0x1b')&&typeof _0x3ce2f5[_0x3729('0x1c')]===_0x3729('0x1b');var _0x31ac92=_0x3f30dd[_0x3729('0x1d')];var _0x588e63=_0x4fef3b?0x0:_0x3ce2f5[_0x3729('0x1a')];var _0x8aa64d=_0x4fef3b?_0x3f30dd[_0x3729('0x1d')]:_0x3ce2f5[_0x3729('0x1a')]+_0x3ce2f5[_0x3729('0x1c')];var _0x3718fb;if(_0x8aa64d>=_0x31ac92){_0x8aa64d=_0x31ac92;_0x3718fb=0xc8;}else{_0x3718fb=0xce;}_0x97e622[_0x3729('0x17')](_0x3718fb);return _0x97e622['set'](_0x3729('0x1e'),_0x588e63+'-'+_0x8aa64d+'/'+_0x31ac92)['json'](_0x3f30dd);}return null;};}function patchUpdates(_0x3fa8e7){return function(_0x49b1a8){try{jsonpatch[_0x3729('0x1f')](_0x49b1a8,_0x3fa8e7,!![]);}catch(_0x4332b1){return BPromise[_0x3729('0x20')](_0x4332b1);}return _0x49b1a8['save']();};}function saveUpdates(_0x36af64,_0x54821c){return function(_0x2585dc){if(_0x2585dc){return _0x2585dc[_0x3729('0x21')](_0x36af64)['then'](function(_0x5e3072){return _0x5e3072;});}return null;};}function removeEntity(_0xcb8eb8,_0x485bb3){return function(_0x26054c){if(_0x26054c){return _0x26054c[_0x3729('0x22')]()[_0x3729('0x23')](function(){_0xcb8eb8[_0x3729('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c8c6c,_0x571d6f){return function(_0xee6b69){if(!_0xee6b69){_0x3c8c6c[_0x3729('0x16')](0x194);}return _0xee6b69;};}function handleError(_0xb2b757,_0x4c2167){_0x4c2167=_0x4c2167||0x1f4;return function(_0x2e2593){logger[_0x3729('0x24')](_0x2e2593['stack']);if(_0x2e2593[_0x3729('0x25')]){delete _0x2e2593[_0x3729('0x25')];}_0xb2b757['status'](_0x4c2167)[_0x3729('0x26')](_0x2e2593);};}exports[_0x3729('0x27')]=function(_0x403c93,_0x5a2548){var _0x543b4f={},_0x29f1dc={},_0x29e87d={'count':0x0,'rows':[]};var _0x2a54c5=_[_0x3729('0x28')](db[_0x3729('0x29')][_0x3729('0x2a')],function(_0x587cc7){return{'name':_0x587cc7[_0x3729('0x2b')],'type':_0x587cc7[_0x3729('0x2c')]['key']};});_0x29f1dc[_0x3729('0x2d')]=_[_0x3729('0x28')](_0x2a54c5,_0x3729('0x25'));_0x29f1dc['query']=_['keys'](_0x403c93[_0x3729('0x2e')]);_0x29f1dc[_0x3729('0x2f')]=_[_0x3729('0x30')](_0x29f1dc[_0x3729('0x2d')],_0x29f1dc[_0x3729('0x2e')]);_0x543b4f[_0x3729('0x31')]=_[_0x3729('0x30')](_0x29f1dc['model'],qs['fields'](_0x403c93[_0x3729('0x2e')][_0x3729('0x32')]));_0x543b4f[_0x3729('0x31')]=_0x543b4f[_0x3729('0x31')][_0x3729('0x33')]?_0x543b4f[_0x3729('0x31')]:_0x29f1dc[_0x3729('0x2d')];if(!_0x403c93[_0x3729('0x2e')][_0x3729('0x34')](_0x3729('0x35'))){_0x543b4f[_0x3729('0x1c')]=qs[_0x3729('0x1c')](_0x403c93[_0x3729('0x2e')]['limit']);_0x543b4f['offset']=qs['offset'](_0x403c93['query']['offset']);}_0x543b4f[_0x3729('0x36')]=qs[_0x3729('0x37')](_0x403c93[_0x3729('0x2e')]['sort']);_0x543b4f[_0x3729('0x38')]=qs['filters'](_['pick'](_0x403c93[_0x3729('0x2e')],_0x29f1dc[_0x3729('0x2f')]),_0x2a54c5);if(_0x403c93[_0x3729('0x2e')]['filter']){_0x543b4f[_0x3729('0x38')]=_[_0x3729('0x39')](_0x543b4f[_0x3729('0x38')],{'$or':_['map'](_0x2a54c5,function(_0x3aa86c){if(_0x3aa86c['type']!==_0x3729('0x3a')){var _0x58e4c1={};_0x58e4c1[_0x3aa86c[_0x3729('0x25')]]={'$like':'%'+_0x403c93[_0x3729('0x2e')][_0x3729('0x3b')]+'%'};return _0x58e4c1;}})});}_0x543b4f=_[_0x3729('0x39')]({},_0x543b4f,_0x403c93[_0x3729('0x3c')]);var _0x3d2b20={'where':_0x543b4f[_0x3729('0x38')]};return db[_0x3729('0x29')]['count'](_0x3d2b20)['then'](function(_0x3efc7d){_0x29e87d[_0x3729('0x1d')]=_0x3efc7d;if(_0x403c93[_0x3729('0x2e')][_0x3729('0x3d')]){_0x543b4f['include']=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x543b4f);})[_0x3729('0x23')](function(_0x2d2d27){_0x29e87d[_0x3729('0x3e')]=_0x2d2d27;return _0x29e87d;})[_0x3729('0x23')](respondWithFilteredResult(_0x5a2548,_0x543b4f))['catch'](handleError(_0x5a2548,null));};exports[_0x3729('0x3f')]=function(_0x317394,_0x31f11d){var _0x26dbee={'raw':!![],'where':{'id':_0x317394[_0x3729('0x40')]['id']}},_0x466ec1={};_0x466ec1[_0x3729('0x2d')]=_['keys'](db[_0x3729('0x29')][_0x3729('0x2a')]);_0x466ec1[_0x3729('0x2e')]=_['keys'](_0x317394[_0x3729('0x2e')]);_0x466ec1[_0x3729('0x2f')]=_[_0x3729('0x30')](_0x466ec1[_0x3729('0x2d')],_0x466ec1[_0x3729('0x2e')]);_0x26dbee['attributes']=_['intersection'](_0x466ec1['model'],qs[_0x3729('0x32')](_0x317394[_0x3729('0x2e')][_0x3729('0x32')]));_0x26dbee['attributes']=_0x26dbee[_0x3729('0x31')][_0x3729('0x33')]?_0x26dbee[_0x3729('0x31')]:_0x466ec1['model'];if(_0x317394['query']['includeAll']){_0x26dbee[_0x3729('0x41')]=[{'all':!![]}];}_0x26dbee=_[_0x3729('0x39')]({},_0x26dbee,_0x317394[_0x3729('0x3c')]);return db['SquareRecording'][_0x3729('0x42')](_0x26dbee)['then'](handleEntityNotFound(_0x31f11d,null))[_0x3729('0x23')](respondWithResult(_0x31f11d,null))[_0x3729('0x43')](handleError(_0x31f11d,null));};exports[_0x3729('0x44')]=function(_0xa60d3d,_0x2b2b98){return db[_0x3729('0x29')][_0x3729('0x44')](_0xa60d3d[_0x3729('0x45')],{})[_0x3729('0x23')](respondWithResult(_0x2b2b98,0xc9))[_0x3729('0x43')](handleError(_0x2b2b98,null));};exports[_0x3729('0x21')]=function(_0x43621e,_0x57bd93){if(_0x43621e[_0x3729('0x45')]['id']){delete _0x43621e[_0x3729('0x45')]['id'];}return db[_0x3729('0x29')][_0x3729('0x42')]({'where':{'id':_0x43621e['params']['id']}})[_0x3729('0x23')](handleEntityNotFound(_0x57bd93,null))['then'](saveUpdates(_0x43621e[_0x3729('0x45')],null))[_0x3729('0x23')](respondWithResult(_0x57bd93,null))[_0x3729('0x43')](handleError(_0x57bd93,null));};exports[_0x3729('0x46')]=function(_0x31574e,_0x54ff93,_0x350fde){var _0x3c35e6=require(_0x3729('0x47'));var _0x4329d1=![];var _0x5ab113={};if(_0x31574e[_0x3729('0x2e')]['type']&&_0x31574e[_0x3729('0x2e')]['type']===_0x3729('0x48')){_0x5ab113[_0x3729('0x48')]=_0x31574e['params']['id'];}else{_0x5ab113['id']=_0x31574e['params']['id'];}return db[_0x3729('0x29')][_0x3729('0x42')]({'where':_0x5ab113,'attributes':['id','savePath',_0x3729('0x49')],'raw':!![]})[_0x3729('0x23')](handleEntityNotFound(_0x54ff93,null))['then'](function(_0x3d99a8){if(_0x3d99a8){var _0x4dc435=_0x3d99a8[_0x3729('0x4a')];var _0x43ed5f=util[_0x3729('0x4b')]('%s.cypher',_0x4dc435);if(fs[_0x3729('0x4c')](_0x43ed5f)){_0x4329d1=!![];return _0x3c35e6['decryptFile'](_0x43ed5f,_0x4dc435,config[_0x3729('0x4d')][_0x3729('0x4e')])[_0x3729('0x23')](function(){return _0x3d99a8;});}return _0x3d99a8;}})[_0x3729('0x23')](function(_0x24cc57){if(_0x24cc57){var _0x12a4e0=_0x24cc57[_0x3729('0x4a')];if(!fs['existsSync'](_0x12a4e0)){throw new db['Sequelize'][(_0x3729('0x4f'))](_0x3729('0x50'));}if(_0x24cc57[_0x3729('0x49')]){return _0x54ff93[_0x3729('0x46')](_0x12a4e0,_0x24cc57[_0x3729('0x49')]+path['extname'](_0x12a4e0),function(){if(_0x4329d1){fs[_0x3729('0x51')](_0x12a4e0);}});}else{return _0x54ff93[_0x3729('0x46')](_0x12a4e0,function(_0x3b0b6c){if(_0x4329d1){fs[_0x3729('0x51')](_0x12a4e0);}});}}})['catch'](function(_0x2be4c2){if(_0x2be4c2[_0x3729('0x52')]==='SquareRecording\x20not\x20found'){_0x54ff93['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x54ff93,null);}});};exports[_0x3729('0x22')]=function(_0x4c5798,_0xc588d1){return db['SquareRecording'][_0x3729('0x42')]({'where':{'id':_0x4c5798[_0x3729('0x40')]['id']}})[_0x3729('0x23')](function(_0x1510ae){if(_[_0x3729('0x53')](_0x1510ae)){throw new ReferenceError(_0x3729('0x54'));}return _0x1510ae;})[_0x3729('0x23')](function(_0x429ac4){var _0x1490b9=_0x429ac4[_0x3729('0x4a')];logger[_0x3729('0x55')](_0x3729('0x56'),_0x1490b9);if(!_['isNil'](_0x429ac4[_0x3729('0x4a')])&&fs['existsSync'](_0x1490b9)){logger[_0x3729('0x55')]('File:\x20\x22'+_0x1490b9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3729('0x57')](_0x1490b9);}_0x1490b9=_0x1490b9+_0x3729('0x58');if(!_['isNil'](_0x429ac4['savePath'])&&fs[_0x3729('0x4c')](_0x1490b9)){logger[_0x3729('0x55')]('File:\x20\x22'+_0x1490b9+_0x3729('0x59'));fs[_0x3729('0x57')](_0x1490b9);}return _0x429ac4;})[_0x3729('0x23')](function(_0x342431){if(!_0x342431)throw new InternalError();return _0x342431['destroy']();})['then'](function(){_0xc588d1[_0x3729('0x17')](0xcc)[_0x3729('0x18')]();})[_0x3729('0x43')](handleError(_0xc588d1,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index d56357c..d3394bd 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 _0x5a9e=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1eb252,_0x1b9c4f){var _0x7d46a=function(_0x255724){while(--_0x255724){_0x1eb252['push'](_0x1eb252['shift']());}};_0x7d46a(++_0x1b9c4f);}(_0x5a9e,0xbd));var _0xe5a9=function(_0x561771,_0x554760){_0x561771=_0x561771-0x0;var _0x54d16e=_0x5a9e[_0x561771];return _0x54d16e;};'use strict';var _=require('lodash');var util=require(_0xe5a9('0x0'));var logger=require(_0xe5a9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe5a9('0x2'));var rp=require(_0xe5a9('0x3'));var fs=require('fs');var path=require(_0xe5a9('0x4'));var rimraf=require(_0xe5a9('0x5'));var config=require(_0xe5a9('0x6'));var attributes=require('./squareRecording.attributes');module[_0xe5a9('0x7')]=function(_0x5354cb,_0x205adf){return _0x5354cb[_0xe5a9('0x8')]('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55c1=['rimraf','../../config/environment','exports','SquareRecording','square_recordings','lodash','util','bluebird','request-promise','path'];(function(_0x31b151,_0x42fc2a){var _0x325470=function(_0x2127b2){while(--_0x2127b2){_0x31b151['push'](_0x31b151['shift']());}};_0x325470(++_0x42fc2a);}(_0x55c1,0x1e5));var _0x155c=function(_0x4a73f2,_0x352409){_0x4a73f2=_0x4a73f2-0x0;var _0x4190ee=_0x55c1[_0x4a73f2];return _0x4190ee;};'use strict';var _=require(_0x155c('0x0'));var util=require(_0x155c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x155c('0x2'));var rp=require(_0x155c('0x3'));var fs=require('fs');var path=require(_0x155c('0x4'));var rimraf=require(_0x155c('0x5'));var config=require(_0x155c('0x6'));var attributes=require('./squareRecording.attributes');module[_0x155c('0x7')]=function(_0x55a3ae,_0x1b30c6){return _0x55a3ae['define'](_0x155c('0x8'),attributes,{'tableName':_0x155c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 58037f6..bc0c335 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 _0xd6d7=['SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','options','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x176317,_0x4897b3){var _0xef2759=function(_0x581e2b){while(--_0x581e2b){_0x176317['push'](_0x176317['shift']());}};_0xef2759(++_0x4897b3);}(_0xd6d7,0x1d7));var _0x7d6d=function(_0x5be5c8,_0x3e779b){_0x5be5c8=_0x5be5c8-0x0;var _0x3f4098=_0xd6d7[_0x5be5c8];return _0x3f4098;};'use strict';var _=require('lodash');var util=require(_0x7d6d('0x0'));var moment=require(_0x7d6d('0x1'));var BPromise=require(_0x7d6d('0x2'));var rs=require(_0x7d6d('0x3'));var fs=require('fs');var Redis=require(_0x7d6d('0x4'));var db=require(_0x7d6d('0x5'))['db'];var utils=require(_0x7d6d('0x6'));var logger=require(_0x7d6d('0x7'))(_0x7d6d('0x8'));var config=require(_0x7d6d('0x9'));var jayson=require(_0x7d6d('0xa'));var client=jayson[_0x7d6d('0xb')][_0x7d6d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2fc96d,_0x416ed9,_0x328107){return new BPromise(function(_0x321140,_0x5b2d6a){return client[_0x7d6d('0xd')](_0x2fc96d,_0x328107)['then'](function(_0x35d2b8){logger[_0x7d6d('0xe')](_0x7d6d('0xf'),_0x416ed9,_0x7d6d('0x10'));logger[_0x7d6d('0x11')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x416ed9,_0x7d6d('0x10'),JSON[_0x7d6d('0x12')](_0x35d2b8));if(_0x35d2b8['error']){if(_0x35d2b8[_0x7d6d('0x13')][_0x7d6d('0x14')]===0x1f4){logger[_0x7d6d('0x13')]('SquareRecording,\x20%s,\x20%s',_0x416ed9,_0x35d2b8['error'][_0x7d6d('0x15')]);return _0x5b2d6a(_0x35d2b8[_0x7d6d('0x13')]['message']);}logger['error'](_0x7d6d('0xf'),_0x416ed9,_0x35d2b8[_0x7d6d('0x13')][_0x7d6d('0x15')]);return _0x321140(_0x35d2b8['error'][_0x7d6d('0x15')]);}else{logger[_0x7d6d('0xe')]('SquareRecording,\x20%s,\x20%s',_0x416ed9,_0x7d6d('0x10'));_0x321140(_0x35d2b8[_0x7d6d('0x16')][_0x7d6d('0x15')]);}})[_0x7d6d('0x17')](function(_0x2bed74){logger[_0x7d6d('0x13')](_0x7d6d('0xf'),_0x416ed9,_0x2bed74);_0x5b2d6a(_0x2bed74);});});}exports[_0x7d6d('0x18')]=function(_0x37923f){var _0x41127b=this;return new Promise(function(_0x211b7c,_0x2688b9){return db[_0x7d6d('0x19')]['create'](_0x37923f['body'],{'raw':_0x37923f['options']?_0x37923f[_0x7d6d('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x516a9f){logger[_0x7d6d('0xe')](_0x7d6d('0x18'),_0x37923f);logger[_0x7d6d('0x11')](_0x7d6d('0x18'),_0x37923f,JSON[_0x7d6d('0x12')](_0x516a9f));_0x211b7c(_0x516a9f);})['catch'](function(_0x5aeaff){logger[_0x7d6d('0x13')]('CreateSquareRecording',_0x5aeaff[_0x7d6d('0x15')],_0x37923f);_0x2688b9(_0x41127b['error'](0x1f4,_0x5aeaff[_0x7d6d('0x15')]));});});}; \ No newline at end of file +var _0xf33c=['SquareRecording,\x20%s,\x20%s,\x20%s','error','code','SquareRecording,\x20%s,\x20%s','message','info','request\x20sent','result','catch','CreateSquareRecording','SquareRecording','create','options','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug'];(function(_0x53788f,_0x225e11){var _0x35d60d=function(_0x594f92){while(--_0x594f92){_0x53788f['push'](_0x53788f['shift']());}};_0x35d60d(++_0x225e11);}(_0xf33c,0x193));var _0xcf33=function(_0x31e753,_0x18503f){_0x31e753=_0x31e753-0x0;var _0x40feaa=_0xf33c[_0x31e753];return _0x40feaa;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xcf33('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf33('0x1'));var db=require(_0xcf33('0x2'))['db'];var utils=require(_0xcf33('0x3'));var logger=require(_0xcf33('0x4'))(_0xcf33('0x5'));var config=require(_0xcf33('0x6'));var jayson=require(_0xcf33('0x7'));var client=jayson[_0xcf33('0x8')][_0xcf33('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c0df4,_0x167d54,_0x2920e2){return new BPromise(function(_0x293f63,_0x3784d1){return client[_0xcf33('0xa')](_0x5c0df4,_0x2920e2)[_0xcf33('0xb')](function(_0x1429c4){logger['info']('SquareRecording,\x20%s,\x20%s',_0x167d54,'request\x20sent');logger[_0xcf33('0xc')](_0xcf33('0xd'),_0x167d54,'request\x20sent',JSON['stringify'](_0x1429c4));if(_0x1429c4[_0xcf33('0xe')]){if(_0x1429c4[_0xcf33('0xe')][_0xcf33('0xf')]===0x1f4){logger['error'](_0xcf33('0x10'),_0x167d54,_0x1429c4['error'][_0xcf33('0x11')]);return _0x3784d1(_0x1429c4[_0xcf33('0xe')][_0xcf33('0x11')]);}logger[_0xcf33('0xe')](_0xcf33('0x10'),_0x167d54,_0x1429c4[_0xcf33('0xe')][_0xcf33('0x11')]);return _0x293f63(_0x1429c4['error']['message']);}else{logger[_0xcf33('0x12')](_0xcf33('0x10'),_0x167d54,_0xcf33('0x13'));_0x293f63(_0x1429c4[_0xcf33('0x14')][_0xcf33('0x11')]);}})[_0xcf33('0x15')](function(_0x493bcc){logger[_0xcf33('0xe')](_0xcf33('0x10'),_0x167d54,_0x493bcc);_0x3784d1(_0x493bcc);});});}exports[_0xcf33('0x16')]=function(_0x2dc858){var _0x3fa6c9=this;return new Promise(function(_0x50ca18,_0xa7de7e){return db[_0xcf33('0x17')][_0xcf33('0x18')](_0x2dc858['body'],{'raw':_0x2dc858['options']?_0x2dc858[_0xcf33('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xcf33('0xb')](function(_0x2e1f83){logger['info'](_0xcf33('0x16'),_0x2dc858);logger['debug'](_0xcf33('0x16'),_0x2dc858,JSON['stringify'](_0x2e1f83));_0x50ca18(_0x2e1f83);})['catch'](function(_0x495ce9){logger[_0xcf33('0xe')](_0xcf33('0x16'),_0x495ce9[_0xcf33('0x11')],_0x2dc858);_0xa7de7e(_0x3fa6c9[_0xcf33('0xe')](0x1f4,_0x495ce9[_0xcf33('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 1294b5d..dded9da 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 _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(_0x53b8e0,_0x55d46e){var _0x10630c=function(_0x3189aa){while(--_0x3189aa){_0x53b8e0['push'](_0x53b8e0['shift']());}};_0x10630c(++_0x55d46e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x1dfcf9,_0x2a88f8){var _0x39676a=function(_0x245463){while(--_0x245463){_0x1dfcf9['push'](_0x1dfcf9['shift']());}};_0x39676a(++_0x2a88f8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 5b9c695..6a6307c 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 _0x659c=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x4af0ef,_0x26b91){var _0x169587=function(_0x3b6eac){while(--_0x3b6eac){_0x4af0ef['push'](_0x4af0ef['shift']());}};_0x169587(++_0x26b91);}(_0x659c,0x1aa));var _0xc659=function(_0x1da811,_0x2e30db){_0x1da811=_0x1da811-0x0;var _0x53858b=_0x659c[_0x1da811];return _0x53858b;};'use strict';var Sequelize=require(_0xc659('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xc659('0x1')]},'request':{'type':Sequelize[_0xc659('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc659('0x1')]},'type':{'type':Sequelize[_0xc659('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc659('0x1')]},'calleridname':{'type':Sequelize[_0xc659('0x1')]},'callingpres':{'type':Sequelize[_0xc659('0x1')]},'callingani2':{'type':Sequelize[_0xc659('0x1')]},'callington':{'type':Sequelize[_0xc659('0x1')]},'callingtns':{'type':Sequelize[_0xc659('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc659('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc659('0x1')]},'threadid':{'type':Sequelize[_0xc659('0x1')]},'project_name':{'type':Sequelize[_0xc659('0x1')]},'joinAt':{'type':Sequelize[_0xc659('0x2')]},'leaveAt':{'type':Sequelize[_0xc659('0x2')]},'bot':{'type':Sequelize[_0xc659('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x6876=['DATE','sequelize','exports','STRING'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0x6876,0x10d));var _0x6687=function(_0x295b61,_0x20b436){_0x295b61=_0x295b61-0x0;var _0x2d9519=_0x6876[_0x295b61];return _0x2d9519;};'use strict';var Sequelize=require(_0x6687('0x0'));module[_0x6687('0x1')]={'network':{'type':Sequelize[_0x6687('0x2')]},'network_script':{'type':Sequelize[_0x6687('0x2')]},'request':{'type':Sequelize[_0x6687('0x2')]},'channel':{'type':Sequelize[_0x6687('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6687('0x2')]},'uniqueid':{'type':Sequelize[_0x6687('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x6687('0x2')]},'calleridname':{'type':Sequelize[_0x6687('0x2')]},'callingpres':{'type':Sequelize[_0x6687('0x2')]},'callingani2':{'type':Sequelize[_0x6687('0x2')]},'callington':{'type':Sequelize[_0x6687('0x2')]},'callingtns':{'type':Sequelize[_0x6687('0x2')]},'dnid':{'type':Sequelize[_0x6687('0x2')]},'rdnis':{'type':Sequelize[_0x6687('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x6687('0x2')]},'priority':{'type':Sequelize[_0x6687('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x6687('0x2')]},'project_name':{'type':Sequelize[_0x6687('0x2')]},'joinAt':{'type':Sequelize[_0x6687('0x3')]},'leaveAt':{'type':Sequelize[_0x6687('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index f2750bf..b8f0aad 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 _0x2c12=['count','offset','set','apply','reject','save','error','stack','index','SquareReport','rawAttributes','fieldName','type','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','find','update','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','undefined'];(function(_0x5759e0,_0x31984b){var _0x1a64cd=function(_0x586c59){while(--_0x586c59){_0x5759e0['push'](_0x5759e0['shift']());}};_0x1a64cd(++_0x31984b);}(_0x2c12,0x19f));var _0x22c1=function(_0x581249,_0x483f03){_0x581249=_0x581249-0x0;var _0x284bae=_0x2c12[_0x581249];return _0x284bae;};'use strict';var emlformat=require(_0x22c1('0x0'));var rimraf=require(_0x22c1('0x1'));var zipdir=require(_0x22c1('0x2'));var jsonpatch=require(_0x22c1('0x3'));var rp=require(_0x22c1('0x4'));var moment=require(_0x22c1('0x5'));var BPromise=require(_0x22c1('0x6'));var Mustache=require(_0x22c1('0x7'));var util=require('util');var path=require(_0x22c1('0x8'));var sox=require('sox');var csv=require(_0x22c1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x22c1('0xa'));var _=require(_0x22c1('0xb'));var squel=require(_0x22c1('0xc'));var crypto=require(_0x22c1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x22c1('0xe'));var toCsv=require(_0x22c1('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x22c1('0xf'));var authService=require(_0x22c1('0x10'));var qs=require(_0x22c1('0x11'));var as=require(_0x22c1('0x12'));var hardwareService=require(_0x22c1('0x13'));var logger=require(_0x22c1('0x14'))('api');var utils=require(_0x22c1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x22c1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1dc879,_0x11e595){_0x11e595=_0x11e595||0xcc;return function(_0x390e6e){if(_0x390e6e){return _0x1dc879[_0x22c1('0x17')](_0x11e595);}return _0x1dc879[_0x22c1('0x18')](_0x11e595)[_0x22c1('0x19')]();};}function respondWithResult(_0x50409f,_0x11ab63){_0x11ab63=_0x11ab63||0xc8;return function(_0x38a22f){if(_0x38a22f){return _0x50409f['status'](_0x11ab63)[_0x22c1('0x1a')](_0x38a22f);}};}function respondWithFilteredResult(_0x4fa796,_0x36cc70){return function(_0x513ac2){if(_0x513ac2){var _0x4e5bb7=typeof _0x36cc70['offset']==='undefined'&&typeof _0x36cc70[_0x22c1('0x1b')]===_0x22c1('0x1c');var _0x25e01f=_0x513ac2[_0x22c1('0x1d')];var _0x419b09=_0x4e5bb7?0x0:_0x36cc70[_0x22c1('0x1e')];var _0x36fa00=_0x4e5bb7?_0x513ac2[_0x22c1('0x1d')]:_0x36cc70[_0x22c1('0x1e')]+_0x36cc70[_0x22c1('0x1b')];var _0x471279;if(_0x36fa00>=_0x25e01f){_0x36fa00=_0x25e01f;_0x471279=0xc8;}else{_0x471279=0xce;}_0x4fa796[_0x22c1('0x18')](_0x471279);return _0x4fa796[_0x22c1('0x1f')]('Content-Range',_0x419b09+'-'+_0x36fa00+'/'+_0x25e01f)[_0x22c1('0x1a')](_0x513ac2);}return null;};}function patchUpdates(_0x34c85e){return function(_0x3951cc){try{jsonpatch[_0x22c1('0x20')](_0x3951cc,_0x34c85e,!![]);}catch(_0x553241){return BPromise[_0x22c1('0x21')](_0x553241);}return _0x3951cc[_0x22c1('0x22')]();};}function saveUpdates(_0x28470d,_0x277fbc){return function(_0x16c18e){if(_0x16c18e){return _0x16c18e['update'](_0x28470d)['then'](function(_0x512585){return _0x512585;});}return null;};}function removeEntity(_0x1f320a,_0x2c753c){return function(_0x33b43b){if(_0x33b43b){return _0x33b43b['destroy']()['then'](function(){_0x1f320a[_0x22c1('0x18')](0xcc)[_0x22c1('0x19')]();});}};}function handleEntityNotFound(_0x27e6dc,_0xe86ffc){return function(_0x33b1bc){if(!_0x33b1bc){_0x27e6dc[_0x22c1('0x17')](0x194);}return _0x33b1bc;};}function handleError(_0x3a87b4,_0x35e528){_0x35e528=_0x35e528||0x1f4;return function(_0x5e063c){logger[_0x22c1('0x23')](_0x5e063c[_0x22c1('0x24')]);if(_0x5e063c['name']){delete _0x5e063c['name'];}_0x3a87b4[_0x22c1('0x18')](_0x35e528)['send'](_0x5e063c);};}exports[_0x22c1('0x25')]=function(_0x454528,_0x2ee0a3){var _0x2b90a0={},_0x1fc320={},_0x3ede12={'count':0x0,'rows':[]};var _0x31b37e=_['map'](db[_0x22c1('0x26')][_0x22c1('0x27')],function(_0x415ae6){return{'name':_0x415ae6[_0x22c1('0x28')],'type':_0x415ae6[_0x22c1('0x29')][_0x22c1('0x2a')]};});_0x1fc320[_0x22c1('0x2b')]=_[_0x22c1('0x2c')](_0x31b37e,_0x22c1('0x2d'));_0x1fc320['query']=_[_0x22c1('0x2e')](_0x454528[_0x22c1('0x2f')]);_0x1fc320[_0x22c1('0x30')]=_[_0x22c1('0x31')](_0x1fc320['model'],_0x1fc320[_0x22c1('0x2f')]);_0x2b90a0[_0x22c1('0x32')]=_['intersection'](_0x1fc320[_0x22c1('0x2b')],qs[_0x22c1('0x33')](_0x454528[_0x22c1('0x2f')][_0x22c1('0x33')]));_0x2b90a0[_0x22c1('0x32')]=_0x2b90a0[_0x22c1('0x32')][_0x22c1('0x34')]?_0x2b90a0[_0x22c1('0x32')]:_0x1fc320['model'];if(!_0x454528[_0x22c1('0x2f')][_0x22c1('0x35')]('nolimit')){_0x2b90a0[_0x22c1('0x1b')]=qs[_0x22c1('0x1b')](_0x454528[_0x22c1('0x2f')]['limit']);_0x2b90a0[_0x22c1('0x1e')]=qs[_0x22c1('0x1e')](_0x454528[_0x22c1('0x2f')][_0x22c1('0x1e')]);}_0x2b90a0[_0x22c1('0x36')]=qs[_0x22c1('0x37')](_0x454528[_0x22c1('0x2f')]['sort']);_0x2b90a0[_0x22c1('0x38')]=qs[_0x22c1('0x30')](_[_0x22c1('0x39')](_0x454528[_0x22c1('0x2f')],_0x1fc320[_0x22c1('0x30')]),_0x31b37e);if(_0x454528[_0x22c1('0x2f')][_0x22c1('0x3a')]){_0x2b90a0['where']=_[_0x22c1('0x3b')](_0x2b90a0[_0x22c1('0x38')],{'$or':_[_0x22c1('0x2c')](_0x31b37e,function(_0x51e012){if(_0x51e012[_0x22c1('0x29')]!==_0x22c1('0x3c')){var _0x2bf816={};_0x2bf816[_0x51e012[_0x22c1('0x2d')]]={'$like':'%'+_0x454528[_0x22c1('0x2f')][_0x22c1('0x3a')]+'%'};return _0x2bf816;}})});}_0x2b90a0=_[_0x22c1('0x3b')]({},_0x2b90a0,_0x454528[_0x22c1('0x3d')]);var _0x3d6dda={'where':_0x2b90a0[_0x22c1('0x38')]};return db[_0x22c1('0x26')][_0x22c1('0x1d')](_0x3d6dda)[_0x22c1('0x3e')](function(_0x5c36ca){_0x3ede12[_0x22c1('0x1d')]=_0x5c36ca;if(_0x454528['query'][_0x22c1('0x3f')]){_0x2b90a0[_0x22c1('0x40')]=[{'all':!![]}];}return db['SquareReport'][_0x22c1('0x41')](_0x2b90a0);})[_0x22c1('0x3e')](function(_0x340894){_0x3ede12[_0x22c1('0x42')]=_0x340894;return _0x3ede12;})['then'](respondWithFilteredResult(_0x2ee0a3,_0x2b90a0))[_0x22c1('0x43')](handleError(_0x2ee0a3,null));};exports[_0x22c1('0x44')]=function(_0x2638d2,_0xca5df1){var _0x3b5ced={'raw':!![],'where':{'id':_0x2638d2['params']['id']}},_0xf18dab={};_0xf18dab[_0x22c1('0x2b')]=_[_0x22c1('0x2e')](db[_0x22c1('0x26')][_0x22c1('0x27')]);_0xf18dab[_0x22c1('0x2f')]=_[_0x22c1('0x2e')](_0x2638d2[_0x22c1('0x2f')]);_0xf18dab[_0x22c1('0x30')]=_[_0x22c1('0x31')](_0xf18dab[_0x22c1('0x2b')],_0xf18dab[_0x22c1('0x2f')]);_0x3b5ced[_0x22c1('0x32')]=_[_0x22c1('0x31')](_0xf18dab[_0x22c1('0x2b')],qs[_0x22c1('0x33')](_0x2638d2[_0x22c1('0x2f')]['fields']));_0x3b5ced[_0x22c1('0x32')]=_0x3b5ced['attributes'][_0x22c1('0x34')]?_0x3b5ced[_0x22c1('0x32')]:_0xf18dab[_0x22c1('0x2b')];if(_0x2638d2[_0x22c1('0x2f')][_0x22c1('0x3f')]){_0x3b5ced[_0x22c1('0x40')]=[{'all':!![]}];}_0x3b5ced=_['merge']({},_0x3b5ced,_0x2638d2[_0x22c1('0x3d')]);return db[_0x22c1('0x26')][_0x22c1('0x45')](_0x3b5ced)[_0x22c1('0x3e')](handleEntityNotFound(_0xca5df1,null))[_0x22c1('0x3e')](respondWithResult(_0xca5df1,null))[_0x22c1('0x43')](handleError(_0xca5df1,null));};exports['create']=function(_0x4e2b4f,_0x38aafe){return db[_0x22c1('0x26')]['create'](_0x4e2b4f['body'],{})['then'](respondWithResult(_0x38aafe,0xc9))[_0x22c1('0x43')](handleError(_0x38aafe,null));};exports[_0x22c1('0x46')]=function(_0x3e98d7,_0x9dc86){if(_0x3e98d7[_0x22c1('0x47')]['id']){delete _0x3e98d7[_0x22c1('0x47')]['id'];}return db[_0x22c1('0x26')]['find']({'where':{'id':_0x3e98d7[_0x22c1('0x48')]['id']}})[_0x22c1('0x3e')](handleEntityNotFound(_0x9dc86,null))[_0x22c1('0x3e')](saveUpdates(_0x3e98d7[_0x22c1('0x47')],null))[_0x22c1('0x3e')](respondWithResult(_0x9dc86,null))[_0x22c1('0x43')](handleError(_0x9dc86,null));};exports[_0x22c1('0x49')]=function(_0x16b18b,_0x7e6c91){return db[_0x22c1('0x26')][_0x22c1('0x45')]({'where':{'id':_0x16b18b[_0x22c1('0x48')]['id']}})['then'](handleEntityNotFound(_0x7e6c91,null))[_0x22c1('0x3e')](removeEntity(_0x7e6c91,null))['catch'](handleError(_0x7e6c91,null));};exports['describe']=function(_0x5a751b,_0x5602ac){return db[_0x22c1('0x26')]['describe']()[_0x22c1('0x3e')](respondWithResult(_0x5602ac,null))[_0x22c1('0x43')](handleError(_0x5602ac,null));}; \ No newline at end of file +var _0x1af3=['where','merge','type','VIRTUAL','name','options','includeAll','include','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../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','stack','send','map','SquareReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter'];(function(_0x25937c,_0xc2db6f){var _0x52640b=function(_0x298387){while(--_0x298387){_0x25937c['push'](_0x25937c['shift']());}};_0x52640b(++_0xc2db6f);}(_0x1af3,0x178));var _0x31af=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x1af3[_0x3227c1];return _0x31fd48;};'use strict';var emlformat=require(_0x31af('0x0'));var rimraf=require(_0x31af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x31af('0x2'));var rp=require('request-promise');var moment=require(_0x31af('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x31af('0x4'));var util=require(_0x31af('0x5'));var path=require(_0x31af('0x6'));var sox=require('sox');var csv=require(_0x31af('0x7'));var ejs=require(_0x31af('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x31af('0x9'));var squel=require('squel');var crypto=require(_0x31af('0xa'));var jsforce=require(_0x31af('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x31af('0x7'));var querystring=require('querystring');var Papa=require(_0x31af('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x31af('0xd'));var as=require(_0x31af('0xe'));var hardwareService=require(_0x31af('0xf'));var logger=require(_0x31af('0x10'))(_0x31af('0x11'));var utils=require('../../config/utils');var config=require(_0x31af('0x12'));var licenseUtil=require(_0x31af('0x13'));var db=require(_0x31af('0x14'))['db'];function respondWithStatusCode(_0x28a3b3,_0x313db9){_0x313db9=_0x313db9||0xcc;return function(_0x2683f){if(_0x2683f){return _0x28a3b3[_0x31af('0x15')](_0x313db9);}return _0x28a3b3[_0x31af('0x16')](_0x313db9)['end']();};}function respondWithResult(_0x42d3e6,_0x528828){_0x528828=_0x528828||0xc8;return function(_0x145283){if(_0x145283){return _0x42d3e6[_0x31af('0x16')](_0x528828)[_0x31af('0x17')](_0x145283);}};}function respondWithFilteredResult(_0x2fff26,_0x5c8342){return function(_0x1dade5){if(_0x1dade5){var _0xd79ba8=typeof _0x5c8342[_0x31af('0x18')]===_0x31af('0x19')&&typeof _0x5c8342[_0x31af('0x1a')]===_0x31af('0x19');var _0x308071=_0x1dade5[_0x31af('0x1b')];var _0x19287d=_0xd79ba8?0x0:_0x5c8342[_0x31af('0x18')];var _0x3c1cf1=_0xd79ba8?_0x1dade5[_0x31af('0x1b')]:_0x5c8342[_0x31af('0x18')]+_0x5c8342[_0x31af('0x1a')];var _0x4d33ce;if(_0x3c1cf1>=_0x308071){_0x3c1cf1=_0x308071;_0x4d33ce=0xc8;}else{_0x4d33ce=0xce;}_0x2fff26[_0x31af('0x16')](_0x4d33ce);return _0x2fff26[_0x31af('0x1c')](_0x31af('0x1d'),_0x19287d+'-'+_0x3c1cf1+'/'+_0x308071)[_0x31af('0x17')](_0x1dade5);}return null;};}function patchUpdates(_0x358539){return function(_0x16a7b5){try{jsonpatch[_0x31af('0x1e')](_0x16a7b5,_0x358539,!![]);}catch(_0x462f46){return BPromise[_0x31af('0x1f')](_0x462f46);}return _0x16a7b5[_0x31af('0x20')]();};}function saveUpdates(_0x116a26,_0x13a835){return function(_0x100394){if(_0x100394){return _0x100394[_0x31af('0x21')](_0x116a26)[_0x31af('0x22')](function(_0xe18642){return _0xe18642;});}return null;};}function removeEntity(_0x25e08c,_0x50d0b2){return function(_0x15d56c){if(_0x15d56c){return _0x15d56c['destroy']()[_0x31af('0x22')](function(){_0x25e08c[_0x31af('0x16')](0xcc)[_0x31af('0x23')]();});}};}function handleEntityNotFound(_0x4ce9d2,_0x23e721){return function(_0x4552e4){if(!_0x4552e4){_0x4ce9d2[_0x31af('0x15')](0x194);}return _0x4552e4;};}function handleError(_0x566245,_0x189403){_0x189403=_0x189403||0x1f4;return function(_0x4534fa){logger['error'](_0x4534fa[_0x31af('0x24')]);if(_0x4534fa['name']){delete _0x4534fa['name'];}_0x566245[_0x31af('0x16')](_0x189403)[_0x31af('0x25')](_0x4534fa);};}exports['index']=function(_0x16a452,_0xf32087){var _0x27f295={},_0x42c6cd={},_0x105961={'count':0x0,'rows':[]};var _0x59af7a=_[_0x31af('0x26')](db[_0x31af('0x27')][_0x31af('0x28')],function(_0x58842f){return{'name':_0x58842f[_0x31af('0x29')],'type':_0x58842f['type'][_0x31af('0x2a')]};});_0x42c6cd[_0x31af('0x2b')]=_[_0x31af('0x26')](_0x59af7a,'name');_0x42c6cd['query']=_[_0x31af('0x2c')](_0x16a452[_0x31af('0x2d')]);_0x42c6cd[_0x31af('0x2e')]=_[_0x31af('0x2f')](_0x42c6cd[_0x31af('0x2b')],_0x42c6cd['query']);_0x27f295[_0x31af('0x30')]=_[_0x31af('0x2f')](_0x42c6cd['model'],qs['fields'](_0x16a452[_0x31af('0x2d')][_0x31af('0x31')]));_0x27f295[_0x31af('0x30')]=_0x27f295[_0x31af('0x30')][_0x31af('0x32')]?_0x27f295[_0x31af('0x30')]:_0x42c6cd[_0x31af('0x2b')];if(!_0x16a452[_0x31af('0x2d')]['hasOwnProperty'](_0x31af('0x33'))){_0x27f295['limit']=qs[_0x31af('0x1a')](_0x16a452[_0x31af('0x2d')][_0x31af('0x1a')]);_0x27f295[_0x31af('0x18')]=qs[_0x31af('0x18')](_0x16a452['query'][_0x31af('0x18')]);}_0x27f295[_0x31af('0x34')]=qs[_0x31af('0x35')](_0x16a452[_0x31af('0x2d')][_0x31af('0x35')]);_0x27f295['where']=qs[_0x31af('0x2e')](_[_0x31af('0x36')](_0x16a452[_0x31af('0x2d')],_0x42c6cd['filters']),_0x59af7a);if(_0x16a452[_0x31af('0x2d')][_0x31af('0x37')]){_0x27f295[_0x31af('0x38')]=_[_0x31af('0x39')](_0x27f295['where'],{'$or':_[_0x31af('0x26')](_0x59af7a,function(_0x519bb4){if(_0x519bb4[_0x31af('0x3a')]!==_0x31af('0x3b')){var _0x36fd13={};_0x36fd13[_0x519bb4[_0x31af('0x3c')]]={'$like':'%'+_0x16a452[_0x31af('0x2d')]['filter']+'%'};return _0x36fd13;}})});}_0x27f295=_[_0x31af('0x39')]({},_0x27f295,_0x16a452[_0x31af('0x3d')]);var _0x920143={'where':_0x27f295[_0x31af('0x38')]};return db['SquareReport'][_0x31af('0x1b')](_0x920143)[_0x31af('0x22')](function(_0x53fd8e){_0x105961[_0x31af('0x1b')]=_0x53fd8e;if(_0x16a452[_0x31af('0x2d')][_0x31af('0x3e')]){_0x27f295[_0x31af('0x3f')]=[{'all':!![]}];}return db[_0x31af('0x27')]['findAll'](_0x27f295);})[_0x31af('0x22')](function(_0x35d9af){_0x105961['rows']=_0x35d9af;return _0x105961;})[_0x31af('0x22')](respondWithFilteredResult(_0xf32087,_0x27f295))[_0x31af('0x40')](handleError(_0xf32087,null));};exports[_0x31af('0x41')]=function(_0x25bcbe,_0x3fccb6){var _0x35bb1c={'raw':!![],'where':{'id':_0x25bcbe[_0x31af('0x42')]['id']}},_0x1ad785={};_0x1ad785[_0x31af('0x2b')]=_[_0x31af('0x2c')](db[_0x31af('0x27')]['rawAttributes']);_0x1ad785[_0x31af('0x2d')]=_[_0x31af('0x2c')](_0x25bcbe[_0x31af('0x2d')]);_0x1ad785[_0x31af('0x2e')]=_['intersection'](_0x1ad785[_0x31af('0x2b')],_0x1ad785[_0x31af('0x2d')]);_0x35bb1c[_0x31af('0x30')]=_[_0x31af('0x2f')](_0x1ad785[_0x31af('0x2b')],qs[_0x31af('0x31')](_0x25bcbe[_0x31af('0x2d')][_0x31af('0x31')]));_0x35bb1c[_0x31af('0x30')]=_0x35bb1c['attributes']['length']?_0x35bb1c['attributes']:_0x1ad785[_0x31af('0x2b')];if(_0x25bcbe[_0x31af('0x2d')][_0x31af('0x3e')]){_0x35bb1c[_0x31af('0x3f')]=[{'all':!![]}];}_0x35bb1c=_[_0x31af('0x39')]({},_0x35bb1c,_0x25bcbe[_0x31af('0x3d')]);return db[_0x31af('0x27')]['find'](_0x35bb1c)[_0x31af('0x22')](handleEntityNotFound(_0x3fccb6,null))['then'](respondWithResult(_0x3fccb6,null))[_0x31af('0x40')](handleError(_0x3fccb6,null));};exports['create']=function(_0x1c432f,_0x510a51){return db['SquareReport'][_0x31af('0x43')](_0x1c432f['body'],{})[_0x31af('0x22')](respondWithResult(_0x510a51,0xc9))['catch'](handleError(_0x510a51,null));};exports[_0x31af('0x21')]=function(_0x854415,_0x532264){if(_0x854415[_0x31af('0x44')]['id']){delete _0x854415[_0x31af('0x44')]['id'];}return db[_0x31af('0x27')][_0x31af('0x45')]({'where':{'id':_0x854415['params']['id']}})[_0x31af('0x22')](handleEntityNotFound(_0x532264,null))[_0x31af('0x22')](saveUpdates(_0x854415[_0x31af('0x44')],null))[_0x31af('0x22')](respondWithResult(_0x532264,null))[_0x31af('0x40')](handleError(_0x532264,null));};exports[_0x31af('0x46')]=function(_0x210f96,_0x29ddef){return db[_0x31af('0x27')][_0x31af('0x45')]({'where':{'id':_0x210f96[_0x31af('0x42')]['id']}})['then'](handleEntityNotFound(_0x29ddef,null))['then'](removeEntity(_0x29ddef,null))['catch'](handleError(_0x29ddef,null));};exports[_0x31af('0x47')]=function(_0x206cb1,_0x1de9a0){return db[_0x31af('0x27')][_0x31af('0x47')]()['then'](respondWithResult(_0x1de9a0,null))['catch'](handleError(_0x1de9a0,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index a32c4f0..2df7d36 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 _0x2804=['uid_pname','uniqueid','leaveAt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','define','report_square'];(function(_0x26707d,_0x137522){var _0x5685ea=function(_0x23d9af){while(--_0x23d9af){_0x26707d['push'](_0x26707d['shift']());}};_0x5685ea(++_0x137522);}(_0x2804,0x1a7));var _0x4280=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2804[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4280('0x0'));var util=require(_0x4280('0x1'));var logger=require(_0x4280('0x2'))('api');var moment=require(_0x4280('0x3'));var BPromise=require(_0x4280('0x4'));var rp=require(_0x4280('0x5'));var fs=require('fs');var path=require(_0x4280('0x6'));var rimraf=require('rimraf');var config=require(_0x4280('0x7'));var attributes=require(_0x4280('0x8'));module['exports']=function(_0x3034dc,_0x1d36f3){return _0x3034dc[_0x4280('0x9')]('SquareReport',attributes,{'tableName':_0x4280('0xa'),'paranoid':![],'indexes':[{'name':_0x4280('0xb'),'fields':[_0x4280('0xc'),'project_name']},{'name':_0x4280('0xd'),'fields':[_0x4280('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c81=['report_square','uid_pname','project_name','leaveAt','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareReport'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9c81,0x8b));var _0x19c8=function(_0x4a308b,_0x37276a){_0x4a308b=_0x4a308b-0x0;var _0x2f80c7=_0x9c81[_0x4a308b];return _0x2f80c7;};'use strict';var _=require(_0x19c8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x19c8('0x1'));var moment=require(_0x19c8('0x2'));var BPromise=require(_0x19c8('0x3'));var rp=require(_0x19c8('0x4'));var fs=require('fs');var path=require(_0x19c8('0x5'));var rimraf=require(_0x19c8('0x6'));var config=require(_0x19c8('0x7'));var attributes=require('./squareReport.attributes');module[_0x19c8('0x8')]=function(_0x373fbe,_0x1e5042){return _0x373fbe[_0x19c8('0x9')](_0x19c8('0xa'),attributes,{'tableName':_0x19c8('0xb'),'paranoid':![],'indexes':[{'name':_0x19c8('0xc'),'fields':['uniqueid',_0x19c8('0xd')]},{'name':_0x19c8('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index fdb2024..08a9f05 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 _0x0f38=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateSquareReport','SquareReport','body','options','raw','debug','catch','UpdateSquareReport','update','where','attributes','limit'];(function(_0x3c85f3,_0x499e31){var _0x5764cb=function(_0x5cee42){while(--_0x5cee42){_0x3c85f3['push'](_0x3c85f3['shift']());}};_0x5764cb(++_0x499e31);}(_0x0f38,0x129));var _0x80f3=function(_0x19d033,_0xf6599d){_0x19d033=_0x19d033-0x0;var _0x58fce0=_0x0f38[_0x19d033];return _0x58fce0;};'use strict';var _=require(_0x80f3('0x0'));var util=require(_0x80f3('0x1'));var moment=require('moment');var BPromise=require(_0x80f3('0x2'));var rs=require(_0x80f3('0x3'));var fs=require('fs');var Redis=require(_0x80f3('0x4'));var db=require(_0x80f3('0x5'))['db'];var utils=require(_0x80f3('0x6'));var logger=require('../../config/logger')(_0x80f3('0x7'));var config=require(_0x80f3('0x8'));var jayson=require(_0x80f3('0x9'));var client=jayson[_0x80f3('0xa')][_0x80f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x297888,_0x1af0d5,_0x1064b2){return new BPromise(function(_0x128aad,_0x29eae9){return client[_0x80f3('0xc')](_0x297888,_0x1064b2)[_0x80f3('0xd')](function(_0x3adb18){logger[_0x80f3('0xe')](_0x80f3('0xf'),_0x1af0d5,_0x80f3('0x10'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x1af0d5,'request\x20sent',JSON[_0x80f3('0x11')](_0x3adb18));if(_0x3adb18[_0x80f3('0x12')]){if(_0x3adb18['error']['code']===0x1f4){logger[_0x80f3('0x12')](_0x80f3('0xf'),_0x1af0d5,_0x3adb18[_0x80f3('0x12')][_0x80f3('0x13')]);return _0x29eae9(_0x3adb18[_0x80f3('0x12')][_0x80f3('0x13')]);}logger['error'](_0x80f3('0xf'),_0x1af0d5,_0x3adb18[_0x80f3('0x12')]['message']);return _0x128aad(_0x3adb18[_0x80f3('0x12')][_0x80f3('0x13')]);}else{logger[_0x80f3('0xe')](_0x80f3('0xf'),_0x1af0d5,_0x80f3('0x10'));_0x128aad(_0x3adb18[_0x80f3('0x14')][_0x80f3('0x13')]);}})['catch'](function(_0x2bfa9a){logger['error'](_0x80f3('0xf'),_0x1af0d5,_0x2bfa9a);_0x29eae9(_0x2bfa9a);});});}exports[_0x80f3('0x15')]=function(_0x3407c5){var _0x43ba75=this;return new Promise(function(_0x59e0b7,_0x5a0e88){return db[_0x80f3('0x16')]['create'](_0x3407c5[_0x80f3('0x17')],{'raw':_0x3407c5[_0x80f3('0x18')]?_0x3407c5[_0x80f3('0x18')][_0x80f3('0x19')]===undefined?!![]:![]:!![]})[_0x80f3('0xd')](function(_0x2cca0e){logger[_0x80f3('0xe')]('CreateSquareReport',_0x3407c5);logger[_0x80f3('0x1a')](_0x80f3('0x15'),_0x3407c5,JSON[_0x80f3('0x11')](_0x2cca0e));_0x59e0b7(_0x2cca0e);})[_0x80f3('0x1b')](function(_0x1399b5){logger[_0x80f3('0x12')]('CreateSquareReport',_0x1399b5[_0x80f3('0x13')],_0x3407c5);_0x5a0e88(_0x43ba75['error'](0x1f4,_0x1399b5[_0x80f3('0x13')]));});});};exports[_0x80f3('0x1c')]=function(_0xa0df22){var _0x497195=this;return new Promise(function(_0x244e86,_0x4dd3ed){return db[_0x80f3('0x16')][_0x80f3('0x1d')](_0xa0df22[_0x80f3('0x17')],{'raw':_0xa0df22[_0x80f3('0x18')]?_0xa0df22[_0x80f3('0x18')][_0x80f3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa0df22[_0x80f3('0x18')]?_0xa0df22['options'][_0x80f3('0x1e')]||null:null,'attributes':_0xa0df22[_0x80f3('0x18')]?_0xa0df22[_0x80f3('0x18')][_0x80f3('0x1f')]||null:null,'limit':_0xa0df22[_0x80f3('0x18')]?_0xa0df22['options'][_0x80f3('0x20')]||null:null})[_0x80f3('0xd')](function(_0x4c0ca9){logger[_0x80f3('0xe')]('UpdateSquareReport',_0xa0df22);logger[_0x80f3('0x1a')]('UpdateSquareReport',_0xa0df22,JSON[_0x80f3('0x11')](_0x4c0ca9));_0x244e86(_0x4c0ca9);})['catch'](function(_0x1d903a){logger[_0x80f3('0x12')]('UpdateSquareReport',_0x1d903a['message'],_0xa0df22);_0x4dd3ed(_0x497195[_0x80f3('0x12')](0x1f4,_0x1d903a['message']));});});}; \ No newline at end of file +var _0x8afb=['raw','stringify','catch','UpdateSquareReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','CreateSquareReport','SquareReport','create','body','options'];(function(_0x5444a7,_0x42be78){var _0x4e8dfe=function(_0x4b4462){while(--_0x4b4462){_0x5444a7['push'](_0x5444a7['shift']());}};_0x4e8dfe(++_0x42be78);}(_0x8afb,0x17d));var _0xb8af=function(_0x2455d4,_0x3c14db){_0x2455d4=_0x2455d4-0x0;var _0xe7f3ed=_0x8afb[_0x2455d4];return _0xe7f3ed;};'use strict';var _=require(_0xb8af('0x0'));var util=require(_0xb8af('0x1'));var moment=require(_0xb8af('0x2'));var BPromise=require(_0xb8af('0x3'));var rs=require(_0xb8af('0x4'));var fs=require('fs');var Redis=require(_0xb8af('0x5'));var db=require(_0xb8af('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb8af('0x7'))(_0xb8af('0x8'));var config=require('../../config/environment');var jayson=require(_0xb8af('0x9'));var client=jayson['client'][_0xb8af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x299f34,_0x2eb1ea,_0x1dfe97){return new BPromise(function(_0xf5eb4d,_0x9207bd){return client[_0xb8af('0xb')](_0x299f34,_0x1dfe97)[_0xb8af('0xc')](function(_0x2d6038){logger['info'](_0xb8af('0xd'),_0x2eb1ea,'request\x20sent');logger[_0xb8af('0xe')](_0xb8af('0xf'),_0x2eb1ea,_0xb8af('0x10'),JSON['stringify'](_0x2d6038));if(_0x2d6038['error']){if(_0x2d6038[_0xb8af('0x11')][_0xb8af('0x12')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x2eb1ea,_0x2d6038['error'][_0xb8af('0x13')]);return _0x9207bd(_0x2d6038[_0xb8af('0x11')][_0xb8af('0x13')]);}logger[_0xb8af('0x11')]('SquareReport,\x20%s,\x20%s',_0x2eb1ea,_0x2d6038[_0xb8af('0x11')][_0xb8af('0x13')]);return _0xf5eb4d(_0x2d6038[_0xb8af('0x11')][_0xb8af('0x13')]);}else{logger[_0xb8af('0x14')](_0xb8af('0xd'),_0x2eb1ea,_0xb8af('0x10'));_0xf5eb4d(_0x2d6038[_0xb8af('0x15')]['message']);}})['catch'](function(_0x1e2af4){logger[_0xb8af('0x11')](_0xb8af('0xd'),_0x2eb1ea,_0x1e2af4);_0x9207bd(_0x1e2af4);});});}exports[_0xb8af('0x16')]=function(_0x13c442){var _0x441d5f=this;return new Promise(function(_0x10284d,_0x5ae2c7){return db[_0xb8af('0x17')][_0xb8af('0x18')](_0x13c442[_0xb8af('0x19')],{'raw':_0x13c442[_0xb8af('0x1a')]?_0x13c442[_0xb8af('0x1a')][_0xb8af('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5661a9){logger[_0xb8af('0x14')](_0xb8af('0x16'),_0x13c442);logger[_0xb8af('0xe')]('CreateSquareReport',_0x13c442,JSON[_0xb8af('0x1c')](_0x5661a9));_0x10284d(_0x5661a9);})[_0xb8af('0x1d')](function(_0xea3326){logger[_0xb8af('0x11')]('CreateSquareReport',_0xea3326[_0xb8af('0x13')],_0x13c442);_0x5ae2c7(_0x441d5f[_0xb8af('0x11')](0x1f4,_0xea3326[_0xb8af('0x13')]));});});};exports[_0xb8af('0x1e')]=function(_0x597be9){var _0x56df73=this;return new Promise(function(_0x5cb069,_0x150efe){return db['SquareReport']['update'](_0x597be9['body'],{'raw':_0x597be9['options']?_0x597be9['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x597be9[_0xb8af('0x1a')]?_0x597be9[_0xb8af('0x1a')][_0xb8af('0x1f')]||null:null,'attributes':_0x597be9['options']?_0x597be9[_0xb8af('0x1a')][_0xb8af('0x20')]||null:null,'limit':_0x597be9[_0xb8af('0x1a')]?_0x597be9[_0xb8af('0x1a')][_0xb8af('0x21')]||null:null})[_0xb8af('0xc')](function(_0x596edf){logger[_0xb8af('0x14')](_0xb8af('0x1e'),_0x597be9);logger['debug'](_0xb8af('0x1e'),_0x597be9,JSON['stringify'](_0x596edf));_0x5cb069(_0x596edf);})['catch'](function(_0x6d0c3){logger['error']('UpdateSquareReport',_0x6d0c3[_0xb8af('0x13')],_0x597be9);_0x150efe(_0x56df73[_0xb8af('0x11')](0x1f4,_0x6d0c3[_0xb8af('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index d422ad1..b755a0b 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 _0xb71f=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb71f,0x118));var _0xfb71=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0xb71f[_0xf0ec6e];return _0x8bbc27;};'use strict';var multer=require('multer');var util=require(_0xfb71('0x0'));var path=require(_0xfb71('0x1'));var timeout=require('connect-timeout');var express=require(_0xfb71('0x2'));var router=express['Router']();var fs_extra=require(_0xfb71('0x3'));var auth=require(_0xfb71('0x4'));var interaction=require(_0xfb71('0x5'));var config=require('../../config/environment');var controller=require(_0xfb71('0x6'));router[_0xfb71('0x7')]('/',auth[_0xfb71('0x8')](),controller[_0xfb71('0x9')]);router[_0xfb71('0x7')]('/describe',auth[_0xfb71('0x8')](),controller[_0xfb71('0xa')]);router[_0xfb71('0x7')](_0xfb71('0xb'),auth[_0xfb71('0x8')](),controller[_0xfb71('0xc')]);router[_0xfb71('0xd')]('/',auth[_0xfb71('0x8')](),controller[_0xfb71('0xe')]);router[_0xfb71('0xf')](_0xfb71('0xb'),auth[_0xfb71('0x8')](),controller[_0xfb71('0x10')]);router[_0xfb71('0x11')](_0xfb71('0xb'),auth[_0xfb71('0x8')](),controller[_0xfb71('0x12')]);module[_0xfb71('0x13')]=router; \ No newline at end of file +var _0xf3e1=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','describe','show','post','create','/:id','update','delete','exports','path','connect-timeout','express'];(function(_0x48562d,_0x3ca202){var _0x658f0a=function(_0x52b83f){while(--_0x52b83f){_0x48562d['push'](_0x48562d['shift']());}};_0x658f0a(++_0x3ca202);}(_0xf3e1,0x107));var _0x1f3e=function(_0x327f66,_0x188d77){_0x327f66=_0x327f66-0x0;var _0x31f70a=_0xf3e1[_0x327f66];return _0x31f70a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1f3e('0x0'));var timeout=require(_0x1f3e('0x1'));var express=require(_0x1f3e('0x2'));var router=express[_0x1f3e('0x3')]();var fs_extra=require(_0x1f3e('0x4'));var auth=require(_0x1f3e('0x5'));var interaction=require(_0x1f3e('0x6'));var config=require(_0x1f3e('0x7'));var controller=require(_0x1f3e('0x8'));router[_0x1f3e('0x9')]('/',auth[_0x1f3e('0xa')](),controller['index']);router[_0x1f3e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x1f3e('0xb')]);router[_0x1f3e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1f3e('0xc')]);router[_0x1f3e('0xd')]('/',auth[_0x1f3e('0xa')](),controller[_0x1f3e('0xe')]);router['put'](_0x1f3e('0xf'),auth[_0x1f3e('0xa')](),controller[_0x1f3e('0x10')]);router[_0x1f3e('0x11')]('/:id',auth[_0x1f3e('0xa')](),controller['destroy']);module[_0x1f3e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 276b561..b595485 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 _0x5a9d=['exports','STRING','TEXT'];(function(_0x318795,_0x4b11c9){var _0x29dca1=function(_0x3556aa){while(--_0x3556aa){_0x318795['push'](_0x318795['shift']());}};_0x29dca1(++_0x4b11c9);}(_0x5a9d,0x87));var _0xd5a9=function(_0x5d92b6,_0x25b33f){_0x5d92b6=_0x5d92b6-0x0;var _0x65b3e0=_0x5a9d[_0x5d92b6];return _0x65b3e0;};'use strict';var Sequelize=require('sequelize');module[_0xd5a9('0x0')]={'uniqueid':{'type':Sequelize[_0xd5a9('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xd5a9('0x1')]},'data':{'type':Sequelize[_0xd5a9('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4ccb=['TEXT','exports','STRING'];(function(_0x2bd20a,_0x1db27a){var _0x59e9e1=function(_0x46be96){while(--_0x46be96){_0x2bd20a['push'](_0x2bd20a['shift']());}};_0x59e9e1(++_0x1db27a);}(_0x4ccb,0x8b));var _0xb4cc=function(_0xefda,_0x20c209){_0xefda=_0xefda-0x0;var _0x5790d4=_0x4ccb[_0xefda];return _0x5790d4;};'use strict';var Sequelize=require('sequelize');module[_0xb4cc('0x0')]={'uniqueid':{'type':Sequelize[_0xb4cc('0x1')]},'node':{'type':Sequelize[_0xb4cc('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xb4cc('0x2')]},'project_name':{'type':Sequelize[_0xb4cc('0x1')]},'callerid':{'type':Sequelize[_0xb4cc('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index b649d84..f1aa4bd 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 _0x84c5=['find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options'];(function(_0x173130,_0x19081c){var _0x3946a1=function(_0x425c5d){while(--_0x425c5d){_0x173130['push'](_0x173130['shift']());}};_0x3946a1(++_0x19081c);}(_0x84c5,0x1de));var _0x584c=function(_0x12f6bd,_0x1f2b90){_0x12f6bd=_0x12f6bd-0x0;var _0x586992=_0x84c5[_0x12f6bd];return _0x586992;};'use strict';var emlformat=require(_0x584c('0x0'));var rimraf=require(_0x584c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x584c('0x2'));var rp=require(_0x584c('0x3'));var moment=require(_0x584c('0x4'));var BPromise=require(_0x584c('0x5'));var Mustache=require(_0x584c('0x6'));var util=require(_0x584c('0x7'));var path=require(_0x584c('0x8'));var sox=require(_0x584c('0x9'));var csv=require(_0x584c('0xa'));var ejs=require(_0x584c('0xb'));var fs=require('fs');var fs_extra=require(_0x584c('0xc'));var _=require(_0x584c('0xd'));var squel=require('squel');var crypto=require(_0x584c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x584c('0xf'));var toCsv=require(_0x584c('0xa'));var querystring=require(_0x584c('0x10'));var Papa=require(_0x584c('0x11'));var Redis=require(_0x584c('0x12'));var authService=require(_0x584c('0x13'));var qs=require(_0x584c('0x14'));var as=require(_0x584c('0x15'));var hardwareService=require(_0x584c('0x16'));var logger=require(_0x584c('0x17'))(_0x584c('0x18'));var utils=require('../../config/utils');var config=require(_0x584c('0x19'));var licenseUtil=require(_0x584c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31cf51,_0x430cd3){_0x430cd3=_0x430cd3||0xcc;return function(_0x2fa1b2){if(_0x2fa1b2){return _0x31cf51[_0x584c('0x1b')](_0x430cd3);}return _0x31cf51[_0x584c('0x1c')](_0x430cd3)[_0x584c('0x1d')]();};}function respondWithResult(_0x368390,_0x3379e3){_0x3379e3=_0x3379e3||0xc8;return function(_0x4614de){if(_0x4614de){return _0x368390[_0x584c('0x1c')](_0x3379e3)['json'](_0x4614de);}};}function respondWithFilteredResult(_0x63cb07,_0x473b12){return function(_0x24056d){if(_0x24056d){var _0x4e70a7=typeof _0x473b12[_0x584c('0x1e')]===_0x584c('0x1f')&&typeof _0x473b12[_0x584c('0x20')]===_0x584c('0x1f');var _0x47100c=_0x24056d[_0x584c('0x21')];var _0x5de841=_0x4e70a7?0x0:_0x473b12[_0x584c('0x1e')];var _0x48c46f=_0x4e70a7?_0x24056d[_0x584c('0x21')]:_0x473b12['offset']+_0x473b12[_0x584c('0x20')];var _0x25ad93;if(_0x48c46f>=_0x47100c){_0x48c46f=_0x47100c;_0x25ad93=0xc8;}else{_0x25ad93=0xce;}_0x63cb07[_0x584c('0x1c')](_0x25ad93);return _0x63cb07[_0x584c('0x22')]('Content-Range',_0x5de841+'-'+_0x48c46f+'/'+_0x47100c)['json'](_0x24056d);}return null;};}function patchUpdates(_0x23e19){return function(_0x334a72){try{jsonpatch[_0x584c('0x23')](_0x334a72,_0x23e19,!![]);}catch(_0x1ee9bf){return BPromise[_0x584c('0x24')](_0x1ee9bf);}return _0x334a72[_0x584c('0x25')]();};}function saveUpdates(_0x2091b8,_0x1193f6){return function(_0x3ef7e6){if(_0x3ef7e6){return _0x3ef7e6[_0x584c('0x26')](_0x2091b8)[_0x584c('0x27')](function(_0x376d05){return _0x376d05;});}return null;};}function removeEntity(_0xf58993,_0x8c3b2d){return function(_0x59de4a){if(_0x59de4a){return _0x59de4a[_0x584c('0x28')]()['then'](function(){_0xf58993[_0x584c('0x1c')](0xcc)[_0x584c('0x1d')]();});}};}function handleEntityNotFound(_0x59882d,_0x3b6da7){return function(_0x3910f3){if(!_0x3910f3){_0x59882d[_0x584c('0x1b')](0x194);}return _0x3910f3;};}function handleError(_0x5de714,_0xa213ac){_0xa213ac=_0xa213ac||0x1f4;return function(_0x285dd3){logger[_0x584c('0x29')](_0x285dd3[_0x584c('0x2a')]);if(_0x285dd3[_0x584c('0x2b')]){delete _0x285dd3[_0x584c('0x2b')];}_0x5de714[_0x584c('0x1c')](_0xa213ac)[_0x584c('0x2c')](_0x285dd3);};}exports[_0x584c('0x2d')]=function(_0x30cb87,_0x3d1f8d){var _0x21a3f8={},_0x334fd4={},_0x370465={'count':0x0,'rows':[]};var _0x411e6d=_['map'](db[_0x584c('0x2e')][_0x584c('0x2f')],function(_0x3795cb){return{'name':_0x3795cb[_0x584c('0x30')],'type':_0x3795cb[_0x584c('0x31')][_0x584c('0x32')]};});_0x334fd4['model']=_[_0x584c('0x33')](_0x411e6d,_0x584c('0x2b'));_0x334fd4[_0x584c('0x34')]=_[_0x584c('0x35')](_0x30cb87['query']);_0x334fd4[_0x584c('0x36')]=_[_0x584c('0x37')](_0x334fd4[_0x584c('0x38')],_0x334fd4[_0x584c('0x34')]);_0x21a3f8[_0x584c('0x39')]=_['intersection'](_0x334fd4[_0x584c('0x38')],qs['fields'](_0x30cb87['query'][_0x584c('0x3a')]));_0x21a3f8[_0x584c('0x39')]=_0x21a3f8['attributes'][_0x584c('0x3b')]?_0x21a3f8[_0x584c('0x39')]:_0x334fd4['model'];if(!_0x30cb87[_0x584c('0x34')][_0x584c('0x3c')]('nolimit')){_0x21a3f8[_0x584c('0x20')]=qs[_0x584c('0x20')](_0x30cb87[_0x584c('0x34')][_0x584c('0x20')]);_0x21a3f8['offset']=qs[_0x584c('0x1e')](_0x30cb87[_0x584c('0x34')]['offset']);}_0x21a3f8[_0x584c('0x3d')]=qs[_0x584c('0x3e')](_0x30cb87[_0x584c('0x34')][_0x584c('0x3e')]);_0x21a3f8[_0x584c('0x3f')]=qs[_0x584c('0x36')](_[_0x584c('0x40')](_0x30cb87[_0x584c('0x34')],_0x334fd4[_0x584c('0x36')]),_0x411e6d);if(_0x30cb87[_0x584c('0x34')][_0x584c('0x41')]){_0x21a3f8[_0x584c('0x3f')]=_[_0x584c('0x42')](_0x21a3f8[_0x584c('0x3f')],{'$or':_[_0x584c('0x33')](_0x411e6d,function(_0x3551a4){if(_0x3551a4[_0x584c('0x31')]!=='VIRTUAL'){var _0x5145a9={};_0x5145a9[_0x3551a4[_0x584c('0x2b')]]={'$like':'%'+_0x30cb87[_0x584c('0x34')][_0x584c('0x41')]+'%'};return _0x5145a9;}})});}_0x21a3f8=_[_0x584c('0x42')]({},_0x21a3f8,_0x30cb87['options']);var _0x3b68c7={'where':_0x21a3f8['where']};return db[_0x584c('0x2e')][_0x584c('0x21')](_0x3b68c7)['then'](function(_0x3b8fe7){_0x370465['count']=_0x3b8fe7;if(_0x30cb87[_0x584c('0x34')][_0x584c('0x43')]){_0x21a3f8[_0x584c('0x44')]=[{'all':!![]}];}return db[_0x584c('0x2e')][_0x584c('0x45')](_0x21a3f8);})['then'](function(_0x2855ff){_0x370465[_0x584c('0x46')]=_0x2855ff;return _0x370465;})['then'](respondWithFilteredResult(_0x3d1f8d,_0x21a3f8))[_0x584c('0x47')](handleError(_0x3d1f8d,null));};exports[_0x584c('0x48')]=function(_0x1845af,_0x920e48){var _0x5c5e44={'raw':!![],'where':{'id':_0x1845af[_0x584c('0x49')]['id']}},_0x2d0aec={};_0x2d0aec['model']=_[_0x584c('0x35')](db[_0x584c('0x2e')][_0x584c('0x2f')]);_0x2d0aec['query']=_[_0x584c('0x35')](_0x1845af[_0x584c('0x34')]);_0x2d0aec[_0x584c('0x36')]=_[_0x584c('0x37')](_0x2d0aec[_0x584c('0x38')],_0x2d0aec['query']);_0x5c5e44[_0x584c('0x39')]=_[_0x584c('0x37')](_0x2d0aec[_0x584c('0x38')],qs[_0x584c('0x3a')](_0x1845af[_0x584c('0x34')][_0x584c('0x3a')]));_0x5c5e44['attributes']=_0x5c5e44[_0x584c('0x39')][_0x584c('0x3b')]?_0x5c5e44[_0x584c('0x39')]:_0x2d0aec[_0x584c('0x38')];if(_0x1845af[_0x584c('0x34')][_0x584c('0x43')]){_0x5c5e44[_0x584c('0x44')]=[{'all':!![]}];}_0x5c5e44=_[_0x584c('0x42')]({},_0x5c5e44,_0x1845af[_0x584c('0x4a')]);return db['SquareDetailsReport'][_0x584c('0x4b')](_0x5c5e44)['then'](handleEntityNotFound(_0x920e48,null))['then'](respondWithResult(_0x920e48,null))[_0x584c('0x47')](handleError(_0x920e48,null));};exports[_0x584c('0x4c')]=function(_0x3b5ae0,_0x26bd38){return db[_0x584c('0x2e')][_0x584c('0x4c')](_0x3b5ae0[_0x584c('0x4d')],{})['then'](respondWithResult(_0x26bd38,0xc9))['catch'](handleError(_0x26bd38,null));};exports[_0x584c('0x26')]=function(_0x4e85b3,_0x11725c){if(_0x4e85b3[_0x584c('0x4d')]['id']){delete _0x4e85b3[_0x584c('0x4d')]['id'];}return db[_0x584c('0x2e')]['find']({'where':{'id':_0x4e85b3['params']['id']}})['then'](handleEntityNotFound(_0x11725c,null))[_0x584c('0x27')](saveUpdates(_0x4e85b3[_0x584c('0x4d')],null))[_0x584c('0x27')](respondWithResult(_0x11725c,null))[_0x584c('0x47')](handleError(_0x11725c,null));};exports[_0x584c('0x28')]=function(_0x3b7622,_0x11752a){return db[_0x584c('0x2e')][_0x584c('0x4b')]({'where':{'id':_0x3b7622[_0x584c('0x49')]['id']}})[_0x584c('0x27')](handleEntityNotFound(_0x11752a,null))[_0x584c('0x27')](removeEntity(_0x11752a,null))['catch'](handleError(_0x11752a,null));};exports['describe']=function(_0x5381e5,_0x24d4ed){return db[_0x584c('0x2e')][_0x584c('0x4e')]()[_0x584c('0x27')](respondWithResult(_0x24d4ed,null))[_0x584c('0x47')](handleError(_0x24d4ed,null));}; \ No newline at end of file +var _0x7e9b=['model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','filter','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','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','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','SquareDetailsReport','fieldName','key'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x7e9b,0x18e));var _0xb7e9=function(_0x26912f,_0x59fab1){_0x26912f=_0x26912f-0x0;var _0x254200=_0x7e9b[_0x26912f];return _0x254200;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb7e9('0x0'));var zipdir=require(_0xb7e9('0x1'));var jsonpatch=require(_0xb7e9('0x2'));var rp=require(_0xb7e9('0x3'));var moment=require('moment');var BPromise=require(_0xb7e9('0x4'));var Mustache=require(_0xb7e9('0x5'));var util=require(_0xb7e9('0x6'));var path=require(_0xb7e9('0x7'));var sox=require(_0xb7e9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb7e9('0x9'));var squel=require('squel');var crypto=require(_0xb7e9('0xa'));var jsforce=require(_0xb7e9('0xb'));var deskjs=require(_0xb7e9('0xc'));var toCsv=require(_0xb7e9('0xd'));var querystring=require(_0xb7e9('0xe'));var Papa=require(_0xb7e9('0xf'));var Redis=require(_0xb7e9('0x10'));var authService=require(_0xb7e9('0x11'));var qs=require(_0xb7e9('0x12'));var as=require(_0xb7e9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb7e9('0x14'))(_0xb7e9('0x15'));var utils=require(_0xb7e9('0x16'));var config=require(_0xb7e9('0x17'));var licenseUtil=require(_0xb7e9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f1cb1,_0xebd333){_0xebd333=_0xebd333||0xcc;return function(_0x29b26f){if(_0x29b26f){return _0x2f1cb1[_0xb7e9('0x19')](_0xebd333);}return _0x2f1cb1['status'](_0xebd333)[_0xb7e9('0x1a')]();};}function respondWithResult(_0x530836,_0x31d944){_0x31d944=_0x31d944||0xc8;return function(_0x670058){if(_0x670058){return _0x530836[_0xb7e9('0x1b')](_0x31d944)['json'](_0x670058);}};}function respondWithFilteredResult(_0x3b523e,_0x23caa8){return function(_0x32fa98){if(_0x32fa98){var _0x980153=typeof _0x23caa8[_0xb7e9('0x1c')]===_0xb7e9('0x1d')&&typeof _0x23caa8['limit']==='undefined';var _0x671b01=_0x32fa98[_0xb7e9('0x1e')];var _0x629ab1=_0x980153?0x0:_0x23caa8[_0xb7e9('0x1c')];var _0x3324f1=_0x980153?_0x32fa98['count']:_0x23caa8[_0xb7e9('0x1c')]+_0x23caa8[_0xb7e9('0x1f')];var _0x424a91;if(_0x3324f1>=_0x671b01){_0x3324f1=_0x671b01;_0x424a91=0xc8;}else{_0x424a91=0xce;}_0x3b523e['status'](_0x424a91);return _0x3b523e[_0xb7e9('0x20')](_0xb7e9('0x21'),_0x629ab1+'-'+_0x3324f1+'/'+_0x671b01)[_0xb7e9('0x22')](_0x32fa98);}return null;};}function patchUpdates(_0x41caf9){return function(_0x40f3a1){try{jsonpatch['apply'](_0x40f3a1,_0x41caf9,!![]);}catch(_0x516021){return BPromise['reject'](_0x516021);}return _0x40f3a1[_0xb7e9('0x23')]();};}function saveUpdates(_0x283344,_0x31a329){return function(_0x117c26){if(_0x117c26){return _0x117c26[_0xb7e9('0x24')](_0x283344)[_0xb7e9('0x25')](function(_0x2fc1ee){return _0x2fc1ee;});}return null;};}function removeEntity(_0x4910d5,_0x58736c){return function(_0x511d7d){if(_0x511d7d){return _0x511d7d[_0xb7e9('0x26')]()['then'](function(){_0x4910d5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44ffb6,_0x3a0b13){return function(_0x42857b){if(!_0x42857b){_0x44ffb6[_0xb7e9('0x19')](0x194);}return _0x42857b;};}function handleError(_0x394d4f,_0x3ec815){_0x3ec815=_0x3ec815||0x1f4;return function(_0x2f8e43){logger[_0xb7e9('0x27')](_0x2f8e43[_0xb7e9('0x28')]);if(_0x2f8e43[_0xb7e9('0x29')]){delete _0x2f8e43['name'];}_0x394d4f[_0xb7e9('0x1b')](_0x3ec815)[_0xb7e9('0x2a')](_0x2f8e43);};}exports['index']=function(_0x33d050,_0x57e82e){var _0x3fbd0e={},_0x2c0e29={},_0x4720f5={'count':0x0,'rows':[]};var _0x111e8d=_['map'](db[_0xb7e9('0x2b')]['rawAttributes'],function(_0x14fd14){return{'name':_0x14fd14[_0xb7e9('0x2c')],'type':_0x14fd14['type'][_0xb7e9('0x2d')]};});_0x2c0e29[_0xb7e9('0x2e')]=_[_0xb7e9('0x2f')](_0x111e8d,_0xb7e9('0x29'));_0x2c0e29[_0xb7e9('0x30')]=_[_0xb7e9('0x31')](_0x33d050[_0xb7e9('0x30')]);_0x2c0e29[_0xb7e9('0x32')]=_[_0xb7e9('0x33')](_0x2c0e29[_0xb7e9('0x2e')],_0x2c0e29['query']);_0x3fbd0e[_0xb7e9('0x34')]=_[_0xb7e9('0x33')](_0x2c0e29['model'],qs[_0xb7e9('0x35')](_0x33d050[_0xb7e9('0x30')][_0xb7e9('0x35')]));_0x3fbd0e[_0xb7e9('0x34')]=_0x3fbd0e[_0xb7e9('0x34')][_0xb7e9('0x36')]?_0x3fbd0e[_0xb7e9('0x34')]:_0x2c0e29['model'];if(!_0x33d050[_0xb7e9('0x30')][_0xb7e9('0x37')]('nolimit')){_0x3fbd0e['limit']=qs[_0xb7e9('0x1f')](_0x33d050['query'][_0xb7e9('0x1f')]);_0x3fbd0e[_0xb7e9('0x1c')]=qs[_0xb7e9('0x1c')](_0x33d050[_0xb7e9('0x30')][_0xb7e9('0x1c')]);}_0x3fbd0e[_0xb7e9('0x38')]=qs[_0xb7e9('0x39')](_0x33d050[_0xb7e9('0x30')][_0xb7e9('0x39')]);_0x3fbd0e['where']=qs[_0xb7e9('0x32')](_[_0xb7e9('0x3a')](_0x33d050[_0xb7e9('0x30')],_0x2c0e29['filters']),_0x111e8d);if(_0x33d050['query']['filter']){_0x3fbd0e[_0xb7e9('0x3b')]=_[_0xb7e9('0x3c')](_0x3fbd0e[_0xb7e9('0x3b')],{'$or':_['map'](_0x111e8d,function(_0x118536){if(_0x118536['type']!=='VIRTUAL'){var _0x50b46b={};_0x50b46b[_0x118536[_0xb7e9('0x29')]]={'$like':'%'+_0x33d050['query'][_0xb7e9('0x3d')]+'%'};return _0x50b46b;}})});}_0x3fbd0e=_[_0xb7e9('0x3c')]({},_0x3fbd0e,_0x33d050['options']);var _0x25f4df={'where':_0x3fbd0e[_0xb7e9('0x3b')]};return db[_0xb7e9('0x2b')][_0xb7e9('0x1e')](_0x25f4df)[_0xb7e9('0x25')](function(_0x539650){_0x4720f5[_0xb7e9('0x1e')]=_0x539650;if(_0x33d050[_0xb7e9('0x30')][_0xb7e9('0x3e')]){_0x3fbd0e[_0xb7e9('0x3f')]=[{'all':!![]}];}return db[_0xb7e9('0x2b')][_0xb7e9('0x40')](_0x3fbd0e);})[_0xb7e9('0x25')](function(_0x4f0a53){_0x4720f5['rows']=_0x4f0a53;return _0x4720f5;})[_0xb7e9('0x25')](respondWithFilteredResult(_0x57e82e,_0x3fbd0e))[_0xb7e9('0x41')](handleError(_0x57e82e,null));};exports[_0xb7e9('0x42')]=function(_0xa0d268,_0x228e52){var _0x25a932={'raw':!![],'where':{'id':_0xa0d268[_0xb7e9('0x43')]['id']}},_0x4a8412={};_0x4a8412['model']=_['keys'](db['SquareDetailsReport'][_0xb7e9('0x44')]);_0x4a8412[_0xb7e9('0x30')]=_['keys'](_0xa0d268['query']);_0x4a8412['filters']=_['intersection'](_0x4a8412[_0xb7e9('0x2e')],_0x4a8412['query']);_0x25a932[_0xb7e9('0x34')]=_[_0xb7e9('0x33')](_0x4a8412[_0xb7e9('0x2e')],qs['fields'](_0xa0d268[_0xb7e9('0x30')][_0xb7e9('0x35')]));_0x25a932[_0xb7e9('0x34')]=_0x25a932[_0xb7e9('0x34')][_0xb7e9('0x36')]?_0x25a932[_0xb7e9('0x34')]:_0x4a8412[_0xb7e9('0x2e')];if(_0xa0d268[_0xb7e9('0x30')][_0xb7e9('0x3e')]){_0x25a932[_0xb7e9('0x3f')]=[{'all':!![]}];}_0x25a932=_[_0xb7e9('0x3c')]({},_0x25a932,_0xa0d268[_0xb7e9('0x45')]);return db[_0xb7e9('0x2b')][_0xb7e9('0x46')](_0x25a932)['then'](handleEntityNotFound(_0x228e52,null))[_0xb7e9('0x25')](respondWithResult(_0x228e52,null))[_0xb7e9('0x41')](handleError(_0x228e52,null));};exports[_0xb7e9('0x47')]=function(_0x3df48c,_0x3a590e){return db[_0xb7e9('0x2b')][_0xb7e9('0x47')](_0x3df48c[_0xb7e9('0x48')],{})['then'](respondWithResult(_0x3a590e,0xc9))[_0xb7e9('0x41')](handleError(_0x3a590e,null));};exports[_0xb7e9('0x24')]=function(_0x3e15fb,_0x4096cc){if(_0x3e15fb[_0xb7e9('0x48')]['id']){delete _0x3e15fb[_0xb7e9('0x48')]['id'];}return db[_0xb7e9('0x2b')]['find']({'where':{'id':_0x3e15fb[_0xb7e9('0x43')]['id']}})[_0xb7e9('0x25')](handleEntityNotFound(_0x4096cc,null))[_0xb7e9('0x25')](saveUpdates(_0x3e15fb['body'],null))['then'](respondWithResult(_0x4096cc,null))[_0xb7e9('0x41')](handleError(_0x4096cc,null));};exports[_0xb7e9('0x26')]=function(_0x5a53b8,_0x1b01e3){return db[_0xb7e9('0x2b')][_0xb7e9('0x46')]({'where':{'id':_0x5a53b8[_0xb7e9('0x43')]['id']}})['then'](handleEntityNotFound(_0x1b01e3,null))[_0xb7e9('0x25')](removeEntity(_0x1b01e3,null))[_0xb7e9('0x41')](handleError(_0x1b01e3,null));};exports[_0xb7e9('0x49')]=function(_0x3d19e5,_0x24b74b){return db[_0xb7e9('0x2b')][_0xb7e9('0x49')]()['then'](respondWithResult(_0x24b74b,null))['catch'](handleError(_0x24b74b,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 159bbe9..7b226ec 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 _0x1123=['request-promise','path','rimraf','./squareReportDetail.attributes','util','moment','bluebird'];(function(_0x273b7e,_0x1b642f){var _0x5df145=function(_0x58e003){while(--_0x58e003){_0x273b7e['push'](_0x273b7e['shift']());}};_0x5df145(++_0x1b642f);}(_0x1123,0x1e7));var _0x3112=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1123[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x3112('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3112('0x1'));var BPromise=require(_0x3112('0x2'));var rp=require(_0x3112('0x3'));var fs=require('fs');var path=require(_0x3112('0x4'));var rimraf=require(_0x3112('0x5'));var config=require('../../config/environment');var attributes=require(_0x3112('0x6'));module['exports']=function(_0x2479a0,_0x3b72ee){return _0x2479a0['define']('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd51c=['request-promise','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x575020,_0x35bec1){var _0x297ee9=function(_0x4e09f1){while(--_0x4e09f1){_0x575020['push'](_0x575020['shift']());}};_0x297ee9(++_0x35bec1);}(_0xd51c,0x14a));var _0xcd51=function(_0x28ac6e,_0x3705eb){_0x28ac6e=_0x28ac6e-0x0;var _0x372a24=_0xd51c[_0x28ac6e];return _0x372a24;};'use strict';var _=require(_0xcd51('0x0'));var util=require(_0xcd51('0x1'));var logger=require(_0xcd51('0x2'))(_0xcd51('0x3'));var moment=require(_0xcd51('0x4'));var BPromise=require(_0xcd51('0x5'));var rp=require(_0xcd51('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcd51('0x7'));var attributes=require(_0xcd51('0x8'));module[_0xcd51('0x9')]=function(_0x18fe27,_0x4404c6){return _0x18fe27[_0xcd51('0xa')]('SquareDetailsReport',attributes,{'tableName':_0xcd51('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 17916de..e129895 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 _0x1a85=['then','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw'];(function(_0x386525,_0xefae6){var _0x14d015=function(_0x4a45c1){while(--_0x4a45c1){_0x386525['push'](_0x386525['shift']());}};_0x14d015(++_0xefae6);}(_0x1a85,0x178));var _0x51a8=function(_0x5e7b6c,_0x4916d0){_0x5e7b6c=_0x5e7b6c-0x0;var _0x3afdbd=_0x1a85[_0x5e7b6c];return _0x3afdbd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});}exports[_0x51a8('0x13')]=function(_0x45a433){var _0xd52230=this;return new Promise(function(_0x23539e,_0x3bc1a2){return db[_0x51a8('0x14')]['create'](_0x45a433[_0x51a8('0x15')],{'raw':_0x45a433[_0x51a8('0x16')]?_0x45a433[_0x51a8('0x16')][_0x51a8('0x17')]===undefined?!![]:![]:!![]})[_0x51a8('0x18')](function(_0x3bc044){logger[_0x51a8('0x8')](_0x51a8('0x13'),_0x45a433);logger['debug'](_0x51a8('0x13'),_0x45a433,JSON['stringify'](_0x3bc044));_0x23539e(_0x3bc044);})[_0x51a8('0x12')](function(_0x12c029){logger[_0x51a8('0xe')](_0x51a8('0x13'),_0x12c029['message'],_0x45a433);_0x3bc1a2(_0xd52230[_0x51a8('0xe')](0x1f4,_0x12c029['message']));});});}; \ No newline at end of file +var _0x4fc2=['rpc','../../config/environment','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','CreateSquareDetailsReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x542984,_0x1f33c0){var _0x5e8ac2=function(_0x48fcdc){while(--_0x48fcdc){_0x542984['push'](_0x542984['shift']());}};_0x5e8ac2(++_0x1f33c0);}(_0x4fc2,0x111));var _0x24fc=function(_0x59e225,_0x190985){_0x59e225=_0x59e225-0x0;var _0x5dc34b=_0x4fc2[_0x59e225];return _0x5dc34b;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});}exports['CreateSquareDetailsReport']=function(_0x23873c){var _0x1cb3d0=this;return new Promise(function(_0x6cfa0a,_0x8ac114){return db['SquareDetailsReport'][_0x24fc('0x17')](_0x23873c[_0x24fc('0x18')],{'raw':_0x23873c[_0x24fc('0x19')]?_0x23873c['options'][_0x24fc('0x1a')]===undefined?!![]:![]:!![]})[_0x24fc('0xc')](function(_0xbf1d6b){logger[_0x24fc('0xd')]('CreateSquareDetailsReport',_0x23873c);logger[_0x24fc('0x10')]('CreateSquareDetailsReport',_0x23873c,JSON[_0x24fc('0x12')](_0xbf1d6b));_0x6cfa0a(_0xbf1d6b);})['catch'](function(_0x3ed464){logger[_0x24fc('0x13')](_0x24fc('0x1b'),_0x3ed464['message'],_0x23873c);_0x8ac114(_0x1cb3d0[_0x24fc('0x13')](0x1f4,_0x3ed464['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 33e99e5..fdc8546 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 _0x6f0b=['get','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller','isAuthenticated'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x6f0b,0x151));var _0xb6f0=function(_0x5929d0,_0x33e251){_0x5929d0=_0x5929d0-0x0;var _0x460cf6=_0x6f0b[_0x5929d0];return _0x460cf6;};'use strict';var express=require(_0xb6f0('0x0'));var router=express[_0xb6f0('0x1')]();var auth=require(_0xb6f0('0x2'));var controller=require(_0xb6f0('0x3'));router['get']('/',auth[_0xb6f0('0x4')](),controller['index']);router[_0xb6f0('0x5')](_0xb6f0('0x6'),auth[_0xb6f0('0x4')](),controller[_0xb6f0('0x7')]);module[_0xb6f0('0x8')]=router; \ No newline at end of file +var _0x50a3=['express','../../components/auth/service','index','get','/process/:pid/kill','isAuthenticated','exports'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x50a3,0xee));var _0x350a=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x50a3[_0x2e913b];return _0x173899;};'use strict';var express=require(_0x350a('0x0'));var router=express['Router']();var auth=require(_0x350a('0x1'));var controller=require('./system.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x350a('0x2')]);router[_0x350a('0x3')](_0x350a('0x4'),auth[_0x350a('0x5')](),controller['killProcess']);module[_0x350a('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index b3b92c3..dfb2317 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 _0xbdff=['format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','json','catch','killProcess','components/import/cm'];(function(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0xbdff,0x12c));var _0xfbdf=function(_0x4dc79b,_0x4f1c6e){_0x4dc79b=_0x4dc79b-0x0;var _0x37b498=_0xbdff[_0x4dc79b];return _0x37b498;};'use strict';var info=require(_0xfbdf('0x0'));var exec=require(_0xfbdf('0x1'))[_0xfbdf('0x2')];var logger=require(_0xfbdf('0x3'))(_0xfbdf('0x4'));var util=require(_0xfbdf('0x5'));var BPromise=require(_0xfbdf('0x6'));var _=require(_0xfbdf('0x7'));function handleError(_0x1963b6,_0x41a347,_0x3ffb43){_0x41a347=_0x41a347||0x1f4;return function(_0x354466){logger[_0xfbdf('0x8')](_0xfbdf('0x9'),_0x3ffb43,_0x41a347,util[_0xfbdf('0xa')](_0x354466,{'showHidden':![],'depth':null}));delete _0x354466[_0xfbdf('0xb')];_0x1963b6[_0xfbdf('0xc')](_0x41a347)[_0xfbdf('0xd')](_0x354466);};}exports['index']=function(_0x1513c5,_0x1dd0b2){return info[_0xfbdf('0xe')]()['then'](function(_0x3e9de5){return _0x1dd0b2[_0xfbdf('0xc')](0xc8)[_0xfbdf('0xf')](_0x3e9de5);})[_0xfbdf('0x10')](function(_0xee8224){return _0x1dd0b2[_0xfbdf('0xc')](0x1f4)['json'](_0xee8224);});};exports[_0xfbdf('0x11')]=function(_0x53fad3,_0x40f309){var _0x37b670=[_0xfbdf('0x12')];return new BPromise(function(_0x469cad,_0x21960e){return exec(util[_0xfbdf('0x13')](_0xfbdf('0x14'),_0x53fad3[_0xfbdf('0x15')][_0xfbdf('0x16')]),function(_0x304ad7,_0x52ccaa,_0x17b814){if(_0x304ad7){return _0x21960e(_0x304ad7);}return _0x469cad(_0x52ccaa);});})['then'](function(_0x3d50bb){var _0x4a21ae=![];var _0x180deb=_0x3d50bb[_0xfbdf('0x17')](/\n/);for(var _0xe33643=0x0,_0x26c56a=_0x37b670[_0xfbdf('0x18')];_0xe33643<_0x26c56a,_0x4a21ae===![];_0xe33643+=0x1){if(_0x3d50bb[_0xfbdf('0x19')](_0x37b670[_0xe33643])>=0x0){_0x4a21ae=!![];}}if(!_0x4a21ae){throw new Error(util['format'](_0xfbdf('0x1a'),_0x53fad3['params']['pid']));}process[_0xfbdf('0x1b')](_0x53fad3[_0xfbdf('0x15')][_0xfbdf('0x16')],_0xfbdf('0x1c'));return _0x40f309['status'](0xc8)[_0xfbdf('0xf')]({'message':util[_0xfbdf('0x13')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x53fad3[_0xfbdf('0x15')][_0xfbdf('0x16')])});})['catch'](handleError(_0x40f309,null,_0xfbdf('0x11')));}; \ No newline at end of file +var _0x5eb2=['indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','lodash','inspect','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'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x5eb2,0x149));var _0x25eb=function(_0x3d0678,_0x10e9ae){_0x3d0678=_0x3d0678-0x0;var _0x7f9a43=_0x5eb2[_0x3d0678];return _0x7f9a43;};'use strict';var info=require('systeminformation');var exec=require(_0x25eb('0x0'))[_0x25eb('0x1')];var logger=require(_0x25eb('0x2'))(_0x25eb('0x3'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x25eb('0x4'));function handleError(_0x444a74,_0xb2c5ea,_0x1a6d29){_0xb2c5ea=_0xb2c5ea||0x1f4;return function(_0x466fcf){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x1a6d29,_0xb2c5ea,util[_0x25eb('0x5')](_0x466fcf,{'showHidden':![],'depth':null}));delete _0x466fcf[_0x25eb('0x6')];_0x444a74[_0x25eb('0x7')](_0xb2c5ea)['send'](_0x466fcf);};}exports[_0x25eb('0x8')]=function(_0x4b3a2b,_0x1bcb81){return info[_0x25eb('0x9')]()[_0x25eb('0xa')](function(_0x55f909){return _0x1bcb81[_0x25eb('0x7')](0xc8)[_0x25eb('0xb')](_0x55f909);})[_0x25eb('0xc')](function(_0x4ee00b){return _0x1bcb81[_0x25eb('0x7')](0x1f4)[_0x25eb('0xb')](_0x4ee00b);});};exports[_0x25eb('0xd')]=function(_0x55c648,_0x29722d){var _0x40cb24=[_0x25eb('0xe')];return new BPromise(function(_0x1e6a04,_0x3ff0fe){return exec(util[_0x25eb('0xf')](_0x25eb('0x10'),_0x55c648[_0x25eb('0x11')][_0x25eb('0x12')]),function(_0x22d75b,_0x51df11,_0x2d7c2d){if(_0x22d75b){return _0x3ff0fe(_0x22d75b);}return _0x1e6a04(_0x51df11);});})[_0x25eb('0xa')](function(_0x56886d){var _0x1e3665=![];var _0x2fecda=_0x56886d[_0x25eb('0x13')](/\n/);for(var _0x5b11b2=0x0,_0x2f7c5e=_0x40cb24[_0x25eb('0x14')];_0x5b11b2<_0x2f7c5e,_0x1e3665===![];_0x5b11b2+=0x1){if(_0x56886d[_0x25eb('0x15')](_0x40cb24[_0x5b11b2])>=0x0){_0x1e3665=!![];}}if(!_0x1e3665){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x55c648[_0x25eb('0x11')][_0x25eb('0x12')]));}process[_0x25eb('0x16')](_0x55c648[_0x25eb('0x11')][_0x25eb('0x12')],_0x25eb('0x17'));return _0x29722d[_0x25eb('0x7')](0xc8)[_0x25eb('0xb')]({'message':util[_0x25eb('0xf')](_0x25eb('0x18'),_0x55c648['params'][_0x25eb('0x12')])});})[_0x25eb('0xc')](handleError(_0x29722d,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index f161cbf..f4525e4 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 _0x6caf=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x1ae3a6,_0x4d6fbd){var _0x2f7b56=function(_0xc96c76){while(--_0xc96c76){_0x1ae3a6['push'](_0x1ae3a6['shift']());}};_0x2f7b56(++_0x4d6fbd);}(_0x6caf,0x90));var _0xf6ca=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0x6caf[_0xdbe2de];return _0x2facd7;};'use strict';var multer=require(_0xf6ca('0x0'));var util=require(_0xf6ca('0x1'));var path=require(_0xf6ca('0x2'));var timeout=require('connect-timeout');var express=require(_0xf6ca('0x3'));var router=express[_0xf6ca('0x4')]();var fs_extra=require(_0xf6ca('0x5'));var auth=require(_0xf6ca('0x6'));var interaction=require(_0xf6ca('0x7'));var config=require(_0xf6ca('0x8'));var controller=require(_0xf6ca('0x9'));router['get']('/',auth[_0xf6ca('0xa')](),controller[_0xf6ca('0xb')]);router['get']('/:id',auth[_0xf6ca('0xa')](),controller[_0xf6ca('0xc')]);router[_0xf6ca('0xd')]('/',auth[_0xf6ca('0xa')](),controller[_0xf6ca('0xe')]);router[_0xf6ca('0xf')](_0xf6ca('0x10'),auth[_0xf6ca('0xa')](),controller[_0xf6ca('0x11')]);router[_0xf6ca('0x12')](_0xf6ca('0x10'),auth[_0xf6ca('0xa')](),controller[_0xf6ca('0x13')]);module[_0xf6ca('0x14')]=router; \ No newline at end of file +var _0x648e=['./tag.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2bd565,_0x38ff91){var _0x11e9c4=function(_0x25da2f){while(--_0x25da2f){_0x2bd565['push'](_0x2bd565['shift']());}};_0x11e9c4(++_0x38ff91);}(_0x648e,0xa3));var _0xe648=function(_0x5b5a0d,_0x5a8e75){_0x5b5a0d=_0x5b5a0d-0x0;var _0x167e1e=_0x648e[_0x5b5a0d];return _0x167e1e;};'use strict';var multer=require(_0xe648('0x0'));var util=require(_0xe648('0x1'));var path=require('path');var timeout=require(_0xe648('0x2'));var express=require('express');var router=express[_0xe648('0x3')]();var fs_extra=require(_0xe648('0x4'));var auth=require(_0xe648('0x5'));var interaction=require(_0xe648('0x6'));var config=require(_0xe648('0x7'));var controller=require(_0xe648('0x8'));router[_0xe648('0x9')]('/',auth[_0xe648('0xa')](),controller[_0xe648('0xb')]);router[_0xe648('0x9')](_0xe648('0xc'),auth[_0xe648('0xa')](),controller[_0xe648('0xd')]);router[_0xe648('0xe')]('/',auth[_0xe648('0xa')](),controller['create']);router[_0xe648('0xf')](_0xe648('0xc'),auth['isAuthenticated'](),controller[_0xe648('0x10')]);router['delete'](_0xe648('0xc'),auth[_0xe648('0xa')](),controller[_0xe648('0x11')]);module[_0xe648('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index d09191e..d724662 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 _0x9e0d=['name','#0091EA','sequelize','exports','STRING'];(function(_0x3ff6e6,_0x5343bf){var _0x4acf88=function(_0x25aa7d){while(--_0x25aa7d){_0x3ff6e6['push'](_0x3ff6e6['shift']());}};_0x4acf88(++_0x5343bf);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x459c7d,_0x1771b5){_0x459c7d=_0x459c7d-0x0;var _0x2e676f=_0x9e0d[_0x459c7d];return _0x2e676f;};'use strict';var Sequelize=require(_0xd9e0('0x0'));module[_0xd9e0('0x1')]={'name':{'type':Sequelize[_0xd9e0('0x2')],'unique':_0xd9e0('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xd9e0('0x4')},'description':{'type':Sequelize[_0xd9e0('0x2')]}}; \ No newline at end of file +var _0xadcc=['name','#0091EA','sequelize','STRING'];(function(_0x2e1389,_0x1f4433){var _0x53acb3=function(_0x339807){while(--_0x339807){_0x2e1389['push'](_0x2e1389['shift']());}};_0x53acb3(++_0x1f4433);}(_0xadcc,0x76));var _0xcadc=function(_0x39c723,_0x5ab9e0){_0x39c723=_0x39c723-0x0;var _0x2eb15b=_0xadcc[_0x39c723];return _0x2eb15b;};'use strict';var Sequelize=require(_0xcadc('0x0'));module['exports']={'name':{'type':Sequelize[_0xcadc('0x1')],'unique':_0xcadc('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xcadc('0x1')],'defaultValue':_0xcadc('0x3')},'description':{'type':Sequelize[_0xcadc('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 30f2a7b..5b90b37 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 _0x4c6d=['apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','show','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','find','userProfileId','autoAssociation','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json'];(function(_0x1cfe2e,_0x1ebbcd){var _0x39233f=function(_0x48831a){while(--_0x48831a){_0x1cfe2e['push'](_0x1cfe2e['shift']());}};_0x39233f(++_0x1ebbcd);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x18bf5b,_0x370e42){_0x18bf5b=_0x18bf5b-0x0;var _0x1853e6=_0x4c6d[_0x18bf5b];return _0x1853e6;};'use strict';var emlformat=require(_0xd4c6('0x0'));var rimraf=require(_0xd4c6('0x1'));var zipdir=require(_0xd4c6('0x2'));var jsonpatch=require(_0xd4c6('0x3'));var rp=require(_0xd4c6('0x4'));var moment=require('moment');var BPromise=require(_0xd4c6('0x5'));var Mustache=require(_0xd4c6('0x6'));var util=require(_0xd4c6('0x7'));var path=require('path');var sox=require(_0xd4c6('0x8'));var csv=require(_0xd4c6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4c6('0xa'));var _=require(_0xd4c6('0xb'));var squel=require(_0xd4c6('0xc'));var crypto=require('crypto');var jsforce=require(_0xd4c6('0xd'));var deskjs=require(_0xd4c6('0xe'));var toCsv=require(_0xd4c6('0x9'));var querystring=require('querystring');var Papa=require(_0xd4c6('0xf'));var Redis=require(_0xd4c6('0x10'));var authService=require(_0xd4c6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd4c6('0x12'));var hardwareService=require(_0xd4c6('0x13'));var logger=require(_0xd4c6('0x14'))(_0xd4c6('0x15'));var utils=require(_0xd4c6('0x16'));var config=require(_0xd4c6('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35b902,_0x489171){_0x489171=_0x489171||0xcc;return function(_0x162681){if(_0x162681){return _0x35b902[_0xd4c6('0x18')](_0x489171);}return _0x35b902[_0xd4c6('0x19')](_0x489171)[_0xd4c6('0x1a')]();};}function respondWithResult(_0x3a2143,_0x384a98){_0x384a98=_0x384a98||0xc8;return function(_0x94f42e){if(_0x94f42e){return _0x3a2143['status'](_0x384a98)['json'](_0x94f42e);}};}function respondWithFilteredResult(_0x11e6c2,_0x3deb85){return function(_0x25e1fb){if(_0x25e1fb){var _0x25204d=typeof _0x3deb85[_0xd4c6('0x1b')]===_0xd4c6('0x1c')&&typeof _0x3deb85[_0xd4c6('0x1d')]==='undefined';var _0x761a3e=_0x25e1fb[_0xd4c6('0x1e')];var _0x23a16f=_0x25204d?0x0:_0x3deb85[_0xd4c6('0x1b')];var _0x31f328=_0x25204d?_0x25e1fb['count']:_0x3deb85[_0xd4c6('0x1b')]+_0x3deb85[_0xd4c6('0x1d')];var _0x359577;if(_0x31f328>=_0x761a3e){_0x31f328=_0x761a3e;_0x359577=0xc8;}else{_0x359577=0xce;}_0x11e6c2['status'](_0x359577);return _0x11e6c2[_0xd4c6('0x1f')](_0xd4c6('0x20'),_0x23a16f+'-'+_0x31f328+'/'+_0x761a3e)[_0xd4c6('0x21')](_0x25e1fb);}return null;};}function patchUpdates(_0x3b1658){return function(_0x48dbf8){try{jsonpatch[_0xd4c6('0x22')](_0x48dbf8,_0x3b1658,!![]);}catch(_0x4a10d8){return BPromise[_0xd4c6('0x23')](_0x4a10d8);}return _0x48dbf8[_0xd4c6('0x24')]();};}function saveUpdates(_0x2750c9,_0x222813){return function(_0xf536e0){if(_0xf536e0){return _0xf536e0[_0xd4c6('0x25')](_0x2750c9)[_0xd4c6('0x26')](function(_0x3f99e8){return _0x3f99e8;});}return null;};}function removeEntity(_0x155cb3,_0x466330){return function(_0x1ebb17){if(_0x1ebb17){return _0x1ebb17[_0xd4c6('0x27')]()['then'](function(){var _0x582326=_0x1ebb17[_0xd4c6('0x28')]({'plain':!![]});var _0x2febbf='Tags';return db[_0xd4c6('0x29')][_0xd4c6('0x27')]({'where':{'type':_0x2febbf,'resourceId':_0x582326['id']}})[_0xd4c6('0x26')](function(){return _0x1ebb17;});})['then'](function(){_0x155cb3[_0xd4c6('0x19')](0xcc)[_0xd4c6('0x1a')]();});}};}function handleEntityNotFound(_0x5614f3,_0x406ed0){return function(_0x8ce066){if(!_0x8ce066){_0x5614f3[_0xd4c6('0x18')](0x194);}return _0x8ce066;};}function handleError(_0x488e7e,_0x3ce942){_0x3ce942=_0x3ce942||0x1f4;return function(_0x3b656d){logger[_0xd4c6('0x2a')](_0x3b656d[_0xd4c6('0x2b')]);if(_0x3b656d[_0xd4c6('0x2c')]){delete _0x3b656d[_0xd4c6('0x2c')];}_0x488e7e[_0xd4c6('0x19')](_0x3ce942)[_0xd4c6('0x2d')](_0x3b656d);};}exports[_0xd4c6('0x2e')]=function(_0x1de7ae,_0x441119){var _0x31e3d0={},_0x15d312={},_0x112969={'count':0x0,'rows':[]};var _0x5d7997=_[_0xd4c6('0x2f')](db[_0xd4c6('0x30')][_0xd4c6('0x31')],function(_0x38d423){return{'name':_0x38d423['fieldName'],'type':_0x38d423['type']['key']};});_0x15d312[_0xd4c6('0x32')]=_[_0xd4c6('0x2f')](_0x5d7997,_0xd4c6('0x2c'));_0x15d312[_0xd4c6('0x33')]=_[_0xd4c6('0x34')](_0x1de7ae[_0xd4c6('0x33')]);_0x15d312[_0xd4c6('0x35')]=_['intersection'](_0x15d312[_0xd4c6('0x32')],_0x15d312[_0xd4c6('0x33')]);_0x31e3d0[_0xd4c6('0x36')]=_['intersection'](_0x15d312[_0xd4c6('0x32')],qs[_0xd4c6('0x37')](_0x1de7ae[_0xd4c6('0x33')]['fields']));_0x31e3d0[_0xd4c6('0x36')]=_0x31e3d0[_0xd4c6('0x36')][_0xd4c6('0x38')]?_0x31e3d0[_0xd4c6('0x36')]:_0x15d312['model'];if(!_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x39')](_0xd4c6('0x3a'))){_0x31e3d0[_0xd4c6('0x1d')]=qs[_0xd4c6('0x1d')](_0x1de7ae['query'][_0xd4c6('0x1d')]);_0x31e3d0[_0xd4c6('0x1b')]=qs[_0xd4c6('0x1b')](_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x1b')]);}_0x31e3d0[_0xd4c6('0x3b')]=qs['sort'](_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x3c')]);_0x31e3d0[_0xd4c6('0x3d')]=qs['filters'](_[_0xd4c6('0x3e')](_0x1de7ae[_0xd4c6('0x33')],_0x15d312[_0xd4c6('0x35')]),_0x5d7997);if(_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x3f')]){_0x31e3d0[_0xd4c6('0x3d')]=_[_0xd4c6('0x40')](_0x31e3d0[_0xd4c6('0x3d')],{'$or':_[_0xd4c6('0x2f')](_0x5d7997,function(_0x4c00f0){if(_0x4c00f0[_0xd4c6('0x41')]!=='VIRTUAL'){var _0x55063c={};_0x55063c[_0x4c00f0[_0xd4c6('0x2c')]]={'$like':'%'+_0x1de7ae[_0xd4c6('0x33')][_0xd4c6('0x3f')]+'%'};return _0x55063c;}})});}_0x31e3d0=_[_0xd4c6('0x40')]({},_0x31e3d0,_0x1de7ae[_0xd4c6('0x42')]);var _0x536d65={'where':_0x31e3d0['where']};return db[_0xd4c6('0x30')][_0xd4c6('0x1e')](_0x536d65)[_0xd4c6('0x26')](function(_0x14ee8f){_0x112969['count']=_0x14ee8f;if(_0x1de7ae[_0xd4c6('0x33')]['includeAll']){_0x31e3d0[_0xd4c6('0x43')]=[{'all':!![]}];}return db[_0xd4c6('0x30')][_0xd4c6('0x44')](_0x31e3d0);})['then'](function(_0x470157){_0x112969[_0xd4c6('0x45')]=_0x470157;return _0x112969;})[_0xd4c6('0x26')](respondWithFilteredResult(_0x441119,_0x31e3d0))[_0xd4c6('0x46')](handleError(_0x441119,null));};exports[_0xd4c6('0x47')]=function(_0x3ef1b0,_0x11f62e){var _0x3beb89={'raw':!![],'where':{'id':_0x3ef1b0['params']['id']}},_0x343d94={};_0x343d94[_0xd4c6('0x32')]=_[_0xd4c6('0x34')](db[_0xd4c6('0x30')]['rawAttributes']);_0x343d94[_0xd4c6('0x33')]=_[_0xd4c6('0x34')](_0x3ef1b0[_0xd4c6('0x33')]);_0x343d94['filters']=_['intersection'](_0x343d94[_0xd4c6('0x32')],_0x343d94[_0xd4c6('0x33')]);_0x3beb89[_0xd4c6('0x36')]=_['intersection'](_0x343d94[_0xd4c6('0x32')],qs[_0xd4c6('0x37')](_0x3ef1b0[_0xd4c6('0x33')][_0xd4c6('0x37')]));_0x3beb89[_0xd4c6('0x36')]=_0x3beb89[_0xd4c6('0x36')]['length']?_0x3beb89[_0xd4c6('0x36')]:_0x343d94[_0xd4c6('0x32')];if(_0x3ef1b0[_0xd4c6('0x33')][_0xd4c6('0x48')]){_0x3beb89[_0xd4c6('0x43')]=[{'all':!![]}];}_0x3beb89=_[_0xd4c6('0x40')]({},_0x3beb89,_0x3ef1b0[_0xd4c6('0x42')]);return db[_0xd4c6('0x30')]['find'](_0x3beb89)['then'](handleEntityNotFound(_0x11f62e,null))[_0xd4c6('0x26')](respondWithResult(_0x11f62e,null))[_0xd4c6('0x46')](handleError(_0x11f62e,null));};exports[_0xd4c6('0x49')]=function(_0x5bb875,_0x37aa81){return db[_0xd4c6('0x30')][_0xd4c6('0x49')](_0x5bb875['body'],{})[_0xd4c6('0x26')](function(_0xa6bd55){var _0x17193f=_0x5bb875[_0xd4c6('0x4a')]['get']({'plain':!![]});if(!_0x17193f)throw new Error(_0xd4c6('0x4b'));if(_0x17193f[_0xd4c6('0x4c')]===_0xd4c6('0x4a')){var _0x14279d=_0xa6bd55[_0xd4c6('0x28')]({'plain':!![]});var _0x2803ef=_0xd4c6('0x4d');return db['UserProfileSection'][_0xd4c6('0x4e')]({'where':{'name':_0x2803ef,'userProfileId':_0x17193f[_0xd4c6('0x4f')]},'raw':!![]})[_0xd4c6('0x26')](function(_0x4a62a8){if(_0x4a62a8&&_0x4a62a8[_0xd4c6('0x50')]===0x0){return db[_0xd4c6('0x29')][_0xd4c6('0x49')]({'name':_0x14279d[_0xd4c6('0x2c')],'resourceId':_0x14279d['id'],'type':_0x4a62a8[_0xd4c6('0x2c')],'sectionId':_0x4a62a8['id']},{})[_0xd4c6('0x26')](function(){return _0xa6bd55;});}else{return _0xa6bd55;}})[_0xd4c6('0x46')](function(_0x591c7c){logger[_0xd4c6('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x591c7c);throw _0x591c7c;});}return _0xa6bd55;})['then'](respondWithResult(_0x37aa81,0xc9))[_0xd4c6('0x46')](handleError(_0x37aa81,null));};exports['update']=function(_0x868da9,_0x574665){if(_0x868da9[_0xd4c6('0x51')]['id']){delete _0x868da9['body']['id'];}return db['Tag'][_0xd4c6('0x4e')]({'where':{'id':_0x868da9[_0xd4c6('0x52')]['id']}})[_0xd4c6('0x26')](handleEntityNotFound(_0x574665,null))[_0xd4c6('0x26')](saveUpdates(_0x868da9[_0xd4c6('0x51')],null))[_0xd4c6('0x26')](respondWithResult(_0x574665,null))[_0xd4c6('0x46')](handleError(_0x574665,null));};exports[_0xd4c6('0x27')]=function(_0x33fac6,_0x5e52db){return db[_0xd4c6('0x30')][_0xd4c6('0x4e')]({'where':{'id':_0x33fac6[_0xd4c6('0x52')]['id']}})[_0xd4c6('0x26')](handleEntityNotFound(_0x5e52db,null))[_0xd4c6('0x26')](removeEntity(_0x5e52db,null))[_0xd4c6('0x46')](handleError(_0x5e52db,null));}; \ No newline at end of file +var _0xb717=['keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Tags','end','sendStatus','stack','name','send','map','Tag','rawAttributes','fieldName','type','model'];(function(_0x52d63e,_0x4add57){var _0x19032f=function(_0x2f7358){while(--_0x2f7358){_0x52d63e['push'](_0x52d63e['shift']());}};_0x19032f(++_0x4add57);}(_0xb717,0x1b4));var _0x7b71=function(_0x3600c8,_0x5832eb){_0x3600c8=_0x3600c8-0x0;var _0x2e68df=_0xb717[_0x3600c8];return _0x2e68df;};'use strict';var emlformat=require(_0x7b71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b71('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b71('0x2'));var moment=require(_0x7b71('0x3'));var BPromise=require(_0x7b71('0x4'));var Mustache=require('mustache');var util=require(_0x7b71('0x5'));var path=require(_0x7b71('0x6'));var sox=require(_0x7b71('0x7'));var csv=require(_0x7b71('0x8'));var ejs=require(_0x7b71('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b71('0xa'));var squel=require(_0x7b71('0xb'));var crypto=require(_0x7b71('0xc'));var jsforce=require(_0x7b71('0xd'));var deskjs=require(_0x7b71('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7b71('0xf'));var Papa=require(_0x7b71('0x10'));var Redis=require('ioredis');var authService=require(_0x7b71('0x11'));var qs=require(_0x7b71('0x12'));var as=require(_0x7b71('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b71('0x14'))('api');var utils=require(_0x7b71('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7b71('0x16'));var db=require(_0x7b71('0x17'))['db'];function respondWithStatusCode(_0x291ba5,_0x101181){_0x101181=_0x101181||0xcc;return function(_0x45c890){if(_0x45c890){return _0x291ba5['sendStatus'](_0x101181);}return _0x291ba5[_0x7b71('0x18')](_0x101181)['end']();};}function respondWithResult(_0x121e8f,_0x22114a){_0x22114a=_0x22114a||0xc8;return function(_0x4f1f41){if(_0x4f1f41){return _0x121e8f[_0x7b71('0x18')](_0x22114a)[_0x7b71('0x19')](_0x4f1f41);}};}function respondWithFilteredResult(_0x4266e5,_0x5888f9){return function(_0x5e7c3a){if(_0x5e7c3a){var _0xadd51e=typeof _0x5888f9[_0x7b71('0x1a')]===_0x7b71('0x1b')&&typeof _0x5888f9[_0x7b71('0x1c')]==='undefined';var _0x268090=_0x5e7c3a['count'];var _0x4adce8=_0xadd51e?0x0:_0x5888f9[_0x7b71('0x1a')];var _0xbde25=_0xadd51e?_0x5e7c3a[_0x7b71('0x1d')]:_0x5888f9[_0x7b71('0x1a')]+_0x5888f9[_0x7b71('0x1c')];var _0x51d647;if(_0xbde25>=_0x268090){_0xbde25=_0x268090;_0x51d647=0xc8;}else{_0x51d647=0xce;}_0x4266e5[_0x7b71('0x18')](_0x51d647);return _0x4266e5[_0x7b71('0x1e')](_0x7b71('0x1f'),_0x4adce8+'-'+_0xbde25+'/'+_0x268090)[_0x7b71('0x19')](_0x5e7c3a);}return null;};}function patchUpdates(_0x206000){return function(_0x297918){try{jsonpatch['apply'](_0x297918,_0x206000,!![]);}catch(_0x459c8b){return BPromise[_0x7b71('0x20')](_0x459c8b);}return _0x297918[_0x7b71('0x21')]();};}function saveUpdates(_0x375f85,_0x47d933){return function(_0x55ed9c){if(_0x55ed9c){return _0x55ed9c[_0x7b71('0x22')](_0x375f85)[_0x7b71('0x23')](function(_0x467f1a){return _0x467f1a;});}return null;};}function removeEntity(_0x33ad80,_0x3aca34){return function(_0x478dd8){if(_0x478dd8){return _0x478dd8[_0x7b71('0x24')]()['then'](function(){var _0x16c1f3=_0x478dd8[_0x7b71('0x25')]({'plain':!![]});var _0x19a6f5=_0x7b71('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x19a6f5,'resourceId':_0x16c1f3['id']}})[_0x7b71('0x23')](function(){return _0x478dd8;});})[_0x7b71('0x23')](function(){_0x33ad80['status'](0xcc)[_0x7b71('0x27')]();});}};}function handleEntityNotFound(_0x214555,_0x7c978b){return function(_0x2f9ca9){if(!_0x2f9ca9){_0x214555[_0x7b71('0x28')](0x194);}return _0x2f9ca9;};}function handleError(_0x5209b6,_0x55ae81){_0x55ae81=_0x55ae81||0x1f4;return function(_0x2b323b){logger['error'](_0x2b323b[_0x7b71('0x29')]);if(_0x2b323b['name']){delete _0x2b323b[_0x7b71('0x2a')];}_0x5209b6[_0x7b71('0x18')](_0x55ae81)[_0x7b71('0x2b')](_0x2b323b);};}exports['index']=function(_0x1e4e89,_0xc29e2b){var _0x21ef65={},_0x5b5a4b={},_0x5e11e1={'count':0x0,'rows':[]};var _0xd100d4=_[_0x7b71('0x2c')](db[_0x7b71('0x2d')][_0x7b71('0x2e')],function(_0x43925c){return{'name':_0x43925c[_0x7b71('0x2f')],'type':_0x43925c[_0x7b71('0x30')]['key']};});_0x5b5a4b[_0x7b71('0x31')]=_[_0x7b71('0x2c')](_0xd100d4,_0x7b71('0x2a'));_0x5b5a4b['query']=_[_0x7b71('0x32')](_0x1e4e89[_0x7b71('0x33')]);_0x5b5a4b[_0x7b71('0x34')]=_[_0x7b71('0x35')](_0x5b5a4b[_0x7b71('0x31')],_0x5b5a4b[_0x7b71('0x33')]);_0x21ef65['attributes']=_[_0x7b71('0x35')](_0x5b5a4b[_0x7b71('0x31')],qs[_0x7b71('0x36')](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x36')]));_0x21ef65['attributes']=_0x21ef65[_0x7b71('0x37')][_0x7b71('0x38')]?_0x21ef65[_0x7b71('0x37')]:_0x5b5a4b[_0x7b71('0x31')];if(!_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x39')](_0x7b71('0x3a'))){_0x21ef65[_0x7b71('0x1c')]=qs['limit'](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x1c')]);_0x21ef65[_0x7b71('0x1a')]=qs[_0x7b71('0x1a')](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x1a')]);}_0x21ef65[_0x7b71('0x3b')]=qs['sort'](_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x3c')]);_0x21ef65[_0x7b71('0x3d')]=qs[_0x7b71('0x34')](_['pick'](_0x1e4e89[_0x7b71('0x33')],_0x5b5a4b[_0x7b71('0x34')]),_0xd100d4);if(_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x3e')]){_0x21ef65[_0x7b71('0x3d')]=_[_0x7b71('0x3f')](_0x21ef65[_0x7b71('0x3d')],{'$or':_[_0x7b71('0x2c')](_0xd100d4,function(_0x30e9d1){if(_0x30e9d1[_0x7b71('0x30')]!==_0x7b71('0x40')){var _0x154dd5={};_0x154dd5[_0x30e9d1['name']]={'$like':'%'+_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x3e')]+'%'};return _0x154dd5;}})});}_0x21ef65=_['merge']({},_0x21ef65,_0x1e4e89[_0x7b71('0x41')]);var _0x411c57={'where':_0x21ef65[_0x7b71('0x3d')]};return db[_0x7b71('0x2d')][_0x7b71('0x1d')](_0x411c57)['then'](function(_0x37cf27){_0x5e11e1[_0x7b71('0x1d')]=_0x37cf27;if(_0x1e4e89[_0x7b71('0x33')][_0x7b71('0x42')]){_0x21ef65[_0x7b71('0x43')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x21ef65);})[_0x7b71('0x23')](function(_0x541730){_0x5e11e1[_0x7b71('0x44')]=_0x541730;return _0x5e11e1;})[_0x7b71('0x23')](respondWithFilteredResult(_0xc29e2b,_0x21ef65))[_0x7b71('0x45')](handleError(_0xc29e2b,null));};exports[_0x7b71('0x46')]=function(_0x3c3ffb,_0x324b28){var _0x23a762={'raw':!![],'where':{'id':_0x3c3ffb[_0x7b71('0x47')]['id']}},_0x5b73a6={};_0x5b73a6[_0x7b71('0x31')]=_['keys'](db[_0x7b71('0x2d')][_0x7b71('0x2e')]);_0x5b73a6[_0x7b71('0x33')]=_[_0x7b71('0x32')](_0x3c3ffb[_0x7b71('0x33')]);_0x5b73a6[_0x7b71('0x34')]=_[_0x7b71('0x35')](_0x5b73a6[_0x7b71('0x31')],_0x5b73a6[_0x7b71('0x33')]);_0x23a762[_0x7b71('0x37')]=_[_0x7b71('0x35')](_0x5b73a6[_0x7b71('0x31')],qs[_0x7b71('0x36')](_0x3c3ffb['query'][_0x7b71('0x36')]));_0x23a762[_0x7b71('0x37')]=_0x23a762['attributes']['length']?_0x23a762['attributes']:_0x5b73a6[_0x7b71('0x31')];if(_0x3c3ffb[_0x7b71('0x33')][_0x7b71('0x42')]){_0x23a762['include']=[{'all':!![]}];}_0x23a762=_[_0x7b71('0x3f')]({},_0x23a762,_0x3c3ffb[_0x7b71('0x41')]);return db['Tag'][_0x7b71('0x48')](_0x23a762)[_0x7b71('0x23')](handleEntityNotFound(_0x324b28,null))[_0x7b71('0x23')](respondWithResult(_0x324b28,null))['catch'](handleError(_0x324b28,null));};exports[_0x7b71('0x49')]=function(_0x18cb19,_0x945c68){return db[_0x7b71('0x2d')][_0x7b71('0x49')](_0x18cb19[_0x7b71('0x4a')],{})[_0x7b71('0x23')](function(_0x30e8d8){var _0xdb438=_0x18cb19[_0x7b71('0x4b')][_0x7b71('0x25')]({'plain':!![]});if(!_0xdb438)throw new Error(_0x7b71('0x4c'));if(_0xdb438['role']===_0x7b71('0x4b')){var _0x504cdf=_0x30e8d8[_0x7b71('0x25')]({'plain':!![]});var _0x154f72=_0x7b71('0x26');return db[_0x7b71('0x4d')][_0x7b71('0x48')]({'where':{'name':_0x154f72,'userProfileId':_0xdb438[_0x7b71('0x4e')]},'raw':!![]})['then'](function(_0x318605){if(_0x318605&&_0x318605['autoAssociation']===0x0){return db['UserProfileResource'][_0x7b71('0x49')]({'name':_0x504cdf['name'],'resourceId':_0x504cdf['id'],'type':_0x318605[_0x7b71('0x2a')],'sectionId':_0x318605['id']},{})[_0x7b71('0x23')](function(){return _0x30e8d8;});}else{return _0x30e8d8;}})[_0x7b71('0x45')](function(_0x38cf0e){logger[_0x7b71('0x4f')](_0x7b71('0x50'),_0x38cf0e);throw _0x38cf0e;});}return _0x30e8d8;})[_0x7b71('0x23')](respondWithResult(_0x945c68,0xc9))[_0x7b71('0x45')](handleError(_0x945c68,null));};exports[_0x7b71('0x22')]=function(_0x38395a,_0xbb46b3){if(_0x38395a['body']['id']){delete _0x38395a['body']['id'];}return db[_0x7b71('0x2d')]['find']({'where':{'id':_0x38395a[_0x7b71('0x47')]['id']}})[_0x7b71('0x23')](handleEntityNotFound(_0xbb46b3,null))[_0x7b71('0x23')](saveUpdates(_0x38395a['body'],null))['then'](respondWithResult(_0xbb46b3,null))['catch'](handleError(_0xbb46b3,null));};exports[_0x7b71('0x24')]=function(_0x48b486,_0x1d3acf){return db[_0x7b71('0x2d')]['find']({'where':{'id':_0x48b486[_0x7b71('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d3acf,null))[_0x7b71('0x23')](removeEntity(_0x1d3acf,null))['catch'](handleError(_0x1d3acf,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 7a0c4b0..317d7b9 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 _0x2323=['path','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','bluebird','request-promise'];(function(_0xb1bfe6,_0xcf74e8){var _0x4afaab=function(_0x591005){while(--_0x591005){_0xb1bfe6['push'](_0xb1bfe6['shift']());}};_0x4afaab(++_0xcf74e8);}(_0x2323,0x146));var _0x3232=function(_0x205250,_0x13c236){_0x205250=_0x205250-0x0;var _0x482160=_0x2323[_0x205250];return _0x482160;};'use strict';var _=require(_0x3232('0x0'));var util=require(_0x3232('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3232('0x2'));var rp=require(_0x3232('0x3'));var fs=require('fs');var path=require(_0x3232('0x4'));var rimraf=require('rimraf');var config=require(_0x3232('0x5'));var attributes=require(_0x3232('0x6'));module[_0x3232('0x7')]=function(_0xc9fcf8,_0x1949c8){return _0xc9fcf8[_0x3232('0x8')](_0x3232('0x9'),attributes,{'tableName':_0x3232('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ac7=['bluebird','request-promise','path','./tag.attributes','exports','Tag','tools_tags','lodash','util','../../config/logger','api','moment'];(function(_0x4c7fa5,_0x63c9be){var _0x5ec1d5=function(_0x43e5a8){while(--_0x43e5a8){_0x4c7fa5['push'](_0x4c7fa5['shift']());}};_0x5ec1d5(++_0x63c9be);}(_0x8ac7,0xeb));var _0x78ac=function(_0x718377,_0x46cf96){_0x718377=_0x718377-0x0;var _0xc1f190=_0x8ac7[_0x718377];return _0xc1f190;};'use strict';var _=require(_0x78ac('0x0'));var util=require(_0x78ac('0x1'));var logger=require(_0x78ac('0x2'))(_0x78ac('0x3'));var moment=require(_0x78ac('0x4'));var BPromise=require(_0x78ac('0x5'));var rp=require(_0x78ac('0x6'));var fs=require('fs');var path=require(_0x78ac('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x78ac('0x8'));module[_0x78ac('0x9')]=function(_0x144ceb,_0xb83d69){return _0x144ceb['define'](_0x78ac('0xa'),attributes,{'tableName':_0x78ac('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 d94a1cd..16d462b 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 _0x4fef=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0xf8f55b,_0x5f0f3a){var _0x3458b1=function(_0x45e2fb){while(--_0x45e2fb){_0xf8f55b['push'](_0xf8f55b['shift']());}};_0x3458b1(++_0x5f0f3a);}(_0x4fef,0x10f));var _0xf4fe=function(_0x4a32ce,_0x43debe){_0x4a32ce=_0x4a32ce-0x0;var _0x58277e=_0x4fef[_0x4a32ce];return _0x58277e;};'use strict';var _=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var moment=require('moment');var BPromise=require(_0xf4fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4fe('0x3'));var db=require(_0xf4fe('0x4'))['db'];var utils=require(_0xf4fe('0x5'));var logger=require(_0xf4fe('0x6'))(_0xf4fe('0x7'));var config=require(_0xf4fe('0x8'));var jayson=require(_0xf4fe('0x9'));var client=jayson[_0xf4fe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x363096,_0x3e844d,_0x4805b0){return new BPromise(function(_0x23b761,_0x1e858f){return client[_0xf4fe('0xb')](_0x363096,_0x4805b0)[_0xf4fe('0xc')](function(_0xdec534){logger[_0xf4fe('0xd')](_0xf4fe('0xe'),_0x3e844d,_0xf4fe('0xf'));logger['debug'](_0xf4fe('0x10'),_0x3e844d,'request\x20sent',JSON[_0xf4fe('0x11')](_0xdec534));if(_0xdec534[_0xf4fe('0x12')]){if(_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x13')]===0x1f4){logger[_0xf4fe('0x12')]('Tag,\x20%s,\x20%s',_0x3e844d,_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x14')]);return _0x1e858f(_0xdec534[_0xf4fe('0x12')]['message']);}logger[_0xf4fe('0x12')]('Tag,\x20%s,\x20%s',_0x3e844d,_0xdec534[_0xf4fe('0x12')][_0xf4fe('0x14')]);return _0x23b761(_0xdec534[_0xf4fe('0x12')]['message']);}else{logger[_0xf4fe('0xd')](_0xf4fe('0xe'),_0x3e844d,'request\x20sent');_0x23b761(_0xdec534[_0xf4fe('0x15')][_0xf4fe('0x14')]);}})[_0xf4fe('0x16')](function(_0x565dc6){logger['error'](_0xf4fe('0xe'),_0x3e844d,_0x565dc6);_0x1e858f(_0x565dc6);});});} \ No newline at end of file +var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','Tag,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x27eda4,_0x5e7af2){var _0x1c6255=function(_0x3b7506){while(--_0x3b7506){_0x27eda4['push'](_0x27eda4['shift']());}};_0x1c6255(++_0x5e7af2);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0x4b84[_0x3c59fc];return _0x2b78d4;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('Tag,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('Tag,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 28c3ae8..dad0590 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_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/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(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 d947744..e1f3c38 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['name','exports','STRING'];(function(_0x179a30,_0x3ff24c){var _0x1b91b8=function(_0x3e399e){while(--_0x3e399e){_0x179a30['push'](_0x179a30['shift']());}};_0x1b91b8(++_0x3ff24c);}(_0x2032,0xd9));var _0x2203=function(_0x2bfed6,_0x5cc502){_0x2bfed6=_0x2bfed6-0x0;var _0x4f4b1a=_0x2032[_0x2bfed6];return _0x4f4b1a;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x4ef58a,_0x122e9d){var _0x4e5968=function(_0x3a3573){while(--_0x3a3573){_0x4ef58a['push'](_0x4ef58a['shift']());}};_0x4e5968(++_0x122e9d);}(_0x757a,0xde));var _0xa757=function(_0x407687,_0x2e75c8){_0x407687=_0x407687-0x0;var _0xc7a6df=_0x757a[_0x407687];return _0xc7a6df;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index f676075..ec2cf02 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 _0x3dec=['pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','catch','show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','end','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','length','addQueues','Queues','ids','removeQueues','findOne','addAgents','isArray','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','defaults','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','interface','voicePause','all','spread','removeAgents','getAgents','hasOwnProperty','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./team.socket','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','sendStatus','error','stack','name','send','index','Team','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','order','sort','where','filters'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3dec,0x100));var _0xc3de=function(_0x430f44,_0x4ae21b){_0x430f44=_0x430f44-0x0;var _0x1f6b0f=_0x3dec[_0x430f44];return _0x1f6b0f;};'use strict';var emlformat=require(_0xc3de('0x0'));var rimraf=require(_0xc3de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc3de('0x2'));var rp=require(_0xc3de('0x3'));var moment=require(_0xc3de('0x4'));var BPromise=require(_0xc3de('0x5'));var Mustache=require(_0xc3de('0x6'));var util=require(_0xc3de('0x7'));var path=require(_0xc3de('0x8'));var sox=require(_0xc3de('0x9'));var csv=require('to-csv');var ejs=require(_0xc3de('0xa'));var fs=require('fs');var fs_extra=require(_0xc3de('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc3de('0xc'));var jsforce=require(_0xc3de('0xd'));var deskjs=require(_0xc3de('0xe'));var toCsv=require(_0xc3de('0xf'));var querystring=require(_0xc3de('0x10'));var Papa=require(_0xc3de('0x11'));var Redis=require('ioredis');var authService=require(_0xc3de('0x12'));var qs=require(_0xc3de('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3de('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xc3de('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc3de('0x16'));var db=require('../../mysqldb')['db'];config[_0xc3de('0x17')]=_['defaults'](config[_0xc3de('0x17')],{'host':_0xc3de('0x18'),'port':0x18eb});var socket=require(_0xc3de('0x19'))(new Redis(config[_0xc3de('0x17')]));require(_0xc3de('0x1a'))['register'](socket);function respondWithStatusCode(_0x9a4610,_0x3f259b){_0x3f259b=_0x3f259b||0xcc;return function(_0x5cb001){if(_0x5cb001){return _0x9a4610['sendStatus'](_0x3f259b);}return _0x9a4610[_0xc3de('0x1b')](_0x3f259b)['end']();};}function respondWithResult(_0x375891,_0x4c2bf2){_0x4c2bf2=_0x4c2bf2||0xc8;return function(_0x4e3e56){if(_0x4e3e56){return _0x375891[_0xc3de('0x1b')](_0x4c2bf2)[_0xc3de('0x1c')](_0x4e3e56);}};}function respondWithFilteredResult(_0x3c5922,_0x19e61a){return function(_0x4a2e83){if(_0x4a2e83){var _0x427e53=typeof _0x19e61a['offset']===_0xc3de('0x1d')&&typeof _0x19e61a[_0xc3de('0x1e')]===_0xc3de('0x1d');var _0x1d8a3a=_0x4a2e83[_0xc3de('0x1f')];var _0x25667a=_0x427e53?0x0:_0x19e61a[_0xc3de('0x20')];var _0x380921=_0x427e53?_0x4a2e83[_0xc3de('0x1f')]:_0x19e61a[_0xc3de('0x20')]+_0x19e61a['limit'];var _0x17b195;if(_0x380921>=_0x1d8a3a){_0x380921=_0x1d8a3a;_0x17b195=0xc8;}else{_0x17b195=0xce;}_0x3c5922[_0xc3de('0x1b')](_0x17b195);return _0x3c5922[_0xc3de('0x21')](_0xc3de('0x22'),_0x25667a+'-'+_0x380921+'/'+_0x1d8a3a)['json'](_0x4a2e83);}return null;};}function patchUpdates(_0x2236a7){return function(_0x182ffa){try{jsonpatch[_0xc3de('0x23')](_0x182ffa,_0x2236a7,!![]);}catch(_0x1cdeb2){return BPromise[_0xc3de('0x24')](_0x1cdeb2);}return _0x182ffa[_0xc3de('0x25')]();};}function saveUpdates(_0x4634c5,_0x5b11dd){return function(_0x30e294){if(_0x30e294){return _0x30e294['update'](_0x4634c5)['then'](function(_0x6fa23d){return _0x6fa23d;});}return null;};}function handleEntityNotFound(_0x3d978d,_0x24ed66){return function(_0xe8871c){if(!_0xe8871c){_0x3d978d[_0xc3de('0x26')](0x194);}return _0xe8871c;};}function handleError(_0xfe22b4,_0x23a789){_0x23a789=_0x23a789||0x1f4;return function(_0x5dc260){logger[_0xc3de('0x27')](_0x5dc260[_0xc3de('0x28')]);if(_0x5dc260[_0xc3de('0x29')]){delete _0x5dc260[_0xc3de('0x29')];}_0xfe22b4[_0xc3de('0x1b')](_0x23a789)[_0xc3de('0x2a')](_0x5dc260);};}exports[_0xc3de('0x2b')]=function(_0x59836c,_0x4ad02f){var _0xf9b26={},_0x25ffdc={},_0x444e5b={'count':0x0,'rows':[]};var _0x1cfee6=_['map'](db[_0xc3de('0x2c')][_0xc3de('0x2d')],function(_0x670d0a){return{'name':_0x670d0a[_0xc3de('0x2e')],'type':_0x670d0a[_0xc3de('0x2f')][_0xc3de('0x30')]};});_0x25ffdc[_0xc3de('0x31')]=_[_0xc3de('0x32')](_0x1cfee6,_0xc3de('0x29'));_0x25ffdc[_0xc3de('0x33')]=_[_0xc3de('0x34')](_0x59836c[_0xc3de('0x33')]);_0x25ffdc['filters']=_[_0xc3de('0x35')](_0x25ffdc['model'],_0x25ffdc['query']);_0xf9b26[_0xc3de('0x36')]=_[_0xc3de('0x35')](_0x25ffdc[_0xc3de('0x31')],qs[_0xc3de('0x37')](_0x59836c[_0xc3de('0x33')][_0xc3de('0x37')]));_0xf9b26[_0xc3de('0x36')]=_0xf9b26[_0xc3de('0x36')]['length']?_0xf9b26[_0xc3de('0x36')]:_0x25ffdc['model'];if(!_0x59836c['query']['hasOwnProperty']('nolimit')){_0xf9b26['limit']=qs[_0xc3de('0x1e')](_0x59836c[_0xc3de('0x33')]['limit']);_0xf9b26[_0xc3de('0x20')]=qs[_0xc3de('0x20')](_0x59836c[_0xc3de('0x33')][_0xc3de('0x20')]);}_0xf9b26[_0xc3de('0x38')]=qs[_0xc3de('0x39')](_0x59836c[_0xc3de('0x33')][_0xc3de('0x39')]);_0xf9b26[_0xc3de('0x3a')]=qs[_0xc3de('0x3b')](_[_0xc3de('0x3c')](_0x59836c['query'],_0x25ffdc['filters']),_0x1cfee6);if(_0x59836c[_0xc3de('0x33')][_0xc3de('0x3d')]){_0xf9b26[_0xc3de('0x3a')]=_[_0xc3de('0x3e')](_0xf9b26[_0xc3de('0x3a')],{'$or':_[_0xc3de('0x32')](_0x1cfee6,function(_0x26e837){if(_0x26e837['type']!==_0xc3de('0x3f')){var _0x12768c={};_0x12768c[_0x26e837[_0xc3de('0x29')]]={'$like':'%'+_0x59836c[_0xc3de('0x33')][_0xc3de('0x3d')]+'%'};return _0x12768c;}})});}_0xf9b26=_[_0xc3de('0x3e')]({},_0xf9b26,_0x59836c[_0xc3de('0x40')]);var _0x1c02c3={'where':_0xf9b26[_0xc3de('0x3a')]};return db[_0xc3de('0x2c')][_0xc3de('0x1f')](_0x1c02c3)[_0xc3de('0x41')](function(_0x388190){_0x444e5b[_0xc3de('0x1f')]=_0x388190;if(_0x59836c[_0xc3de('0x33')][_0xc3de('0x42')]){_0xf9b26['include']=[{'all':!![]}];}return db[_0xc3de('0x2c')][_0xc3de('0x43')](_0xf9b26);})[_0xc3de('0x41')](function(_0x59a51b){_0x444e5b['rows']=_0x59a51b;return _0x444e5b;})[_0xc3de('0x41')](respondWithFilteredResult(_0x4ad02f,_0xf9b26))[_0xc3de('0x44')](handleError(_0x4ad02f,null));};exports[_0xc3de('0x45')]=function(_0x4e3979,_0x7a21b9){var _0x44ec81={'raw':![],'where':{'id':_0x4e3979[_0xc3de('0x46')]['id']}},_0x5e9ba1={};_0x5e9ba1['model']=_['keys'](db['Team'][_0xc3de('0x2d')]);_0x5e9ba1[_0xc3de('0x33')]=_[_0xc3de('0x34')](_0x4e3979[_0xc3de('0x33')]);_0x5e9ba1['filters']=_[_0xc3de('0x35')](_0x5e9ba1[_0xc3de('0x31')],_0x5e9ba1['query']);_0x44ec81[_0xc3de('0x36')]=_[_0xc3de('0x35')](_0x5e9ba1['model'],qs[_0xc3de('0x37')](_0x4e3979[_0xc3de('0x33')][_0xc3de('0x37')]));_0x44ec81['attributes']=_0x44ec81[_0xc3de('0x36')]['length']?_0x44ec81[_0xc3de('0x36')]:_0x5e9ba1[_0xc3de('0x31')];if(_0x4e3979[_0xc3de('0x33')][_0xc3de('0x42')]){_0x44ec81[_0xc3de('0x47')]=[{'all':!![]}];}_0x44ec81=_[_0xc3de('0x3e')]({},_0x44ec81,_0x4e3979[_0xc3de('0x40')]);return db['Team'][_0xc3de('0x48')](_0x44ec81)['then'](handleEntityNotFound(_0x7a21b9,null))[_0xc3de('0x41')](respondWithResult(_0x7a21b9,null))[_0xc3de('0x44')](handleError(_0x7a21b9,null));};exports[_0xc3de('0x49')]=function(_0x54c7e1,_0x52484a){return db[_0xc3de('0x2c')][_0xc3de('0x49')](_0x54c7e1[_0xc3de('0x4a')],{})[_0xc3de('0x41')](function(_0x37cca0){var _0x4db6d5=_0x54c7e1[_0xc3de('0x4b')][_0xc3de('0x4c')]({'plain':!![]});if(!_0x4db6d5)throw new Error(_0xc3de('0x4d'));if(_0x4db6d5['role']==='user'){var _0x1a9acc=_0x37cca0[_0xc3de('0x4c')]({'plain':!![]});var _0x357839=_0xc3de('0x4e');return db[_0xc3de('0x4f')]['find']({'where':{'name':_0x357839,'userProfileId':_0x4db6d5[_0xc3de('0x50')]},'raw':!![]})[_0xc3de('0x41')](function(_0x5acf2a){if(_0x5acf2a&&_0x5acf2a[_0xc3de('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x1a9acc[_0xc3de('0x29')],'resourceId':_0x1a9acc['id'],'type':_0x5acf2a[_0xc3de('0x29')],'sectionId':_0x5acf2a['id']},{})[_0xc3de('0x41')](function(){return _0x37cca0;});}else{return _0x37cca0;}})['catch'](function(_0x37078e){logger[_0xc3de('0x27')](_0xc3de('0x52'),_0x37078e);throw _0x37078e;});}return _0x37cca0;})[_0xc3de('0x41')](respondWithResult(_0x52484a,0xc9))['catch'](handleError(_0x52484a,null));};exports[_0xc3de('0x53')]=function(_0x4a9439,_0x1646b3){if(_0x4a9439[_0xc3de('0x4a')]['id']){delete _0x4a9439['body']['id'];}return db[_0xc3de('0x2c')]['find']({'where':{'id':_0x4a9439[_0xc3de('0x46')]['id']}})[_0xc3de('0x41')](handleEntityNotFound(_0x1646b3,null))['then'](saveUpdates(_0x4a9439[_0xc3de('0x4a')],null))[_0xc3de('0x41')](respondWithResult(_0x1646b3,null))[_0xc3de('0x44')](handleError(_0x1646b3,null));};exports[_0xc3de('0x54')]=function(_0x71dbd1,_0x2882d2){var _0x489346=_0x71dbd1[_0xc3de('0x46')]['id'];var _0xb1cc39=[];return db[_0xc3de('0x55')][_0xc3de('0x56')](function(_0x5c966f){var _0x408660=_0xc3de('0x57')+_0x489346;return db['sequelize'][_0xc3de('0x33')](_0x408660,{'type':db['Sequelize'][_0xc3de('0x58')][_0xc3de('0x59')],'raw':!![],'transaction':_0x5c966f})[_0xc3de('0x41')](function(_0x23b132){_0xb1cc39=_[_0xc3de('0x32')](_0x23b132,function(_0x38d4b3){return Number(_0x38d4b3['UserId']);});})['then'](function(){var _0x4b803b=_0xc3de('0x5a')+_0x489346;return db['sequelize'][_0xc3de('0x33')](_0x4b803b,{'type':db['Sequelize'][_0xc3de('0x58')][_0xc3de('0x59')],'raw':!![],'transaction':_0x5c966f});})[_0xc3de('0x41')](function(_0x254397){var _0x1dc158=_['map'](_0x254397,function(_0xe55ef9){return Number(_0xe55ef9[_0xc3de('0x5b')]);});return db[_0xc3de('0x5c')][_0xc3de('0x54')]({'where':{'UserId':{'$in':_0xb1cc39},'VoiceQueueId':{'$in':_0x1dc158}},'transaction':_0x5c966f});})[_0xc3de('0x41')](function(){var _0x8464b7=_0xc3de('0x5d')+_0x489346;return db['sequelize'][_0xc3de('0x33')](_0x8464b7,{'type':db[_0xc3de('0x5e')][_0xc3de('0x58')][_0xc3de('0x59')],'raw':!![],'transaction':_0x5c966f});})[_0xc3de('0x41')](function(_0x46792f){var _0x5ec9e0=_['map'](_0x46792f,function(_0x23c1d4){return Number(_0x23c1d4[_0xc3de('0x5f')]);});return db[_0xc3de('0x60')][_0xc3de('0x54')]({'where':{'UserId':{'$in':_0xb1cc39},'MailQueueId':{'$in':_0x5ec9e0}},'transaction':_0x5c966f});})[_0xc3de('0x41')](function(){var _0x3c6458=_0xc3de('0x61')+_0x489346;return db[_0xc3de('0x55')][_0xc3de('0x33')](_0x3c6458,{'type':db[_0xc3de('0x5e')]['QueryTypes'][_0xc3de('0x59')],'raw':!![],'transaction':_0x5c966f});})[_0xc3de('0x41')](function(_0x1fcde0){var _0x4f6eec=_[_0xc3de('0x32')](_0x1fcde0,function(_0x53686e){return Number(_0x53686e[_0xc3de('0x62')]);});return db[_0xc3de('0x63')]['destroy']({'where':{'UserId':{'$in':_0xb1cc39},'SmsQueueId':{'$in':_0x4f6eec}},'transaction':_0x5c966f});})[_0xc3de('0x41')](function(){var _0x424354=_0xc3de('0x64')+_0x489346;return db['sequelize'][_0xc3de('0x33')](_0x424354,{'type':db[_0xc3de('0x5e')][_0xc3de('0x58')]['SELECT'],'raw':!![],'transaction':_0x5c966f});})['then'](function(_0x4321c1){var _0x39ee12=_['map'](_0x4321c1,function(_0x56553b){return Number(_0x56553b['ChatQueueId']);});return db[_0xc3de('0x65')][_0xc3de('0x54')]({'where':{'UserId':{'$in':_0xb1cc39},'ChatQueueId':{'$in':_0x39ee12}},'transaction':_0x5c966f});})[_0xc3de('0x41')](function(){var _0x2cab1d=_0xc3de('0x66')+_0x489346;return db[_0xc3de('0x55')][_0xc3de('0x33')](_0x2cab1d,{'type':db[_0xc3de('0x5e')][_0xc3de('0x58')][_0xc3de('0x59')],'raw':!![],'transaction':_0x5c966f});})[_0xc3de('0x41')](function(_0x277a94){var _0x48a15f=_['map'](_0x277a94,function(_0x3a5bec){return Number(_0x3a5bec['FaxQueueId']);});return db[_0xc3de('0x67')][_0xc3de('0x54')]({'where':{'UserId':{'$in':_0xb1cc39},'FaxQueueId':{'$in':_0x48a15f}},'transaction':_0x5c966f});})[_0xc3de('0x41')](function(){var _0x15c91f=_0xc3de('0x68')+_0x489346;return db[_0xc3de('0x55')][_0xc3de('0x33')](_0x15c91f,{'type':db[_0xc3de('0x5e')][_0xc3de('0x58')][_0xc3de('0x59')],'raw':!![],'transaction':_0x5c966f});})[_0xc3de('0x41')](function(_0xd0f9f5){var _0x3b79ae=_[_0xc3de('0x32')](_0xd0f9f5,function(_0x2d61f8){return Number(_0x2d61f8[_0xc3de('0x69')]);});return db[_0xc3de('0x6a')][_0xc3de('0x54')]({'where':{'UserId':{'$in':_0xb1cc39},'OpenchannelQueueId':{'$in':_0x3b79ae}},'transaction':_0x5c966f});})[_0xc3de('0x41')](function(){var _0x1ca427=_0xc3de('0x6b')+_0x489346;return db[_0xc3de('0x55')][_0xc3de('0x33')](_0x1ca427,{'type':db[_0xc3de('0x5e')][_0xc3de('0x58')][_0xc3de('0x59')],'raw':!![],'transaction':_0x5c966f});})[_0xc3de('0x41')](function(_0x66e14a){var _0x21909e=_[_0xc3de('0x32')](_0x66e14a,function(_0x387a90){return Number(_0x387a90[_0xc3de('0x6c')]);});return db[_0xc3de('0x6d')]['destroy']({'where':{'UserId':{'$in':_0xb1cc39},'WhatsappQueueId':{'$in':_0x21909e}},'transaction':_0x5c966f});})['then'](function(){return db[_0xc3de('0x6e')]['find']({'where':{'TeamId':_0x489346}});})[_0xc3de('0x41')](function(_0x280378){if(_0x280378===null){return;}return db[_0xc3de('0x6f')][_0xc3de('0x54')]({'where':{'UserId':{'$in':_0xb1cc39},'VoicePrefixId':_0x280378[_0xc3de('0x70')]},'transaction':_0x5c966f});})[_0xc3de('0x41')](function(){return db['Team']['destroy']({'where':{'id':_0x489346},'cascade':!![],'transaction':_0x5c966f});})['then'](function(_0x117c2c){if(_0x117c2c===0x0){_0x2882d2['sendStatus'](0x194);}else{return db['UserProfileResource'][_0xc3de('0x54')]({'where':{'type':_0xc3de('0x4e'),'resourceId':_0x489346},'cascade':!![],'transaction':_0x5c966f})[_0xc3de('0x41')](function(){_0x2882d2[_0xc3de('0x1b')](0xcc)[_0xc3de('0x71')]();});}})[_0xc3de('0x44')](function(_0x1d8878){_0x2882d2[_0xc3de('0x1b')](0x1f4)[_0xc3de('0x2a')](_0x1d8878);});});};exports[_0xc3de('0x72')]=function(_0x3a5191,_0x3676dd,_0x32be63){return db[_0xc3de('0x2c')]['findOne']({'where':{'id':_0x3a5191[_0xc3de('0x46')]['id']}})['then'](handleEntityNotFound(_0x3676dd,null))[_0xc3de('0x41')](function(_0x34e7e9){if(!_0x3a5191[_0xc3de('0x33')][_0xc3de('0x73')]||!utils[_0xc3de('0x74')](_0x3a5191['query'][_0xc3de('0x73')])){throw new db[(_0xc3de('0x5e'))][(_0xc3de('0x75'))](_0xc3de('0x76'));}var _0x3d47a2={};var _0x42ff4d={};_0x42ff4d[_0xc3de('0x31')]=_[_0xc3de('0x34')](db[_[_0xc3de('0x77')](_0x3a5191[_0xc3de('0x33')][_0xc3de('0x73')][_0xc3de('0x78')]())+_0xc3de('0x79')][_0xc3de('0x2d')]);_0x42ff4d['query']=_['keys'](_0x3a5191['query']);_0x42ff4d[_0xc3de('0x3b')]=_['intersection'](_0x42ff4d[_0xc3de('0x31')],_0x42ff4d[_0xc3de('0x33')]);_0x3d47a2[_0xc3de('0x36')]=_[_0xc3de('0x35')](_0x42ff4d[_0xc3de('0x31')],qs[_0xc3de('0x37')](_0x3a5191[_0xc3de('0x33')]['fields']));_0x3d47a2[_0xc3de('0x36')]=_0x3d47a2['attributes'][_0xc3de('0x7a')]?_0x3d47a2[_0xc3de('0x36')]:_0x42ff4d[_0xc3de('0x31')];_0x3d47a2['limit']=qs[_0xc3de('0x1e')](_0x3a5191[_0xc3de('0x33')]['limit']);_0x3d47a2[_0xc3de('0x20')]=qs[_0xc3de('0x20')](_0x3a5191[_0xc3de('0x33')]['offset']);_0x3d47a2['order']=qs['sort'](_0x3a5191[_0xc3de('0x33')][_0xc3de('0x39')]);_0x3d47a2[_0xc3de('0x3a')]=qs[_0xc3de('0x3b')](_['pick'](_0x3a5191['query'],_0x42ff4d[_0xc3de('0x3b')]));_0x3d47a2=_[_0xc3de('0x3e')]({},_0x3d47a2,_0x3a5191[_0xc3de('0x40')]);return _0x34e7e9[_0xc3de('0x4c')+_[_0xc3de('0x77')](_0x3a5191['query'][_0xc3de('0x73')]['toLowerCase']())+'Queues'](_0x3d47a2);})[_0xc3de('0x41')](respondWithResult(_0x3676dd,null))['catch'](handleError(_0x3676dd,null));};exports[_0xc3de('0x7b')]=function(_0xcb394d,_0x90ce7d,_0x20165e){return db[_0xc3de('0x2c')]['findOne']({'where':{'id':_0xcb394d[_0xc3de('0x46')]['id']}})[_0xc3de('0x41')](function(_0x27dc42){if(_0x27dc42){if(!_0xcb394d[_0xc3de('0x4a')][_0xc3de('0x73')]||!utils['isValidChannel'](_0xcb394d['body'][_0xc3de('0x73')])){throw new db[(_0xc3de('0x5e'))]['ValidationError']('Unknown\x20channel');}return _0x27dc42['add'+_[_0xc3de('0x77')](_0xcb394d[_0xc3de('0x4a')]['channel']['toLowerCase']())+_0xc3de('0x7c')](_0xcb394d[_0xc3de('0x4a')][_0xc3de('0x7d')]);}return null;})[_0xc3de('0x41')](handleEntityNotFound(_0x90ce7d,null))[_0xc3de('0x41')](respondWithStatusCode(_0x90ce7d,null))['catch'](handleError(_0x90ce7d,null));};exports[_0xc3de('0x7e')]=function(_0x530652,_0x23649d,_0x1522f3){return db[_0xc3de('0x2c')][_0xc3de('0x7f')]({'where':{'id':_0x530652[_0xc3de('0x46')]['id']}})['then'](function(_0x1866b9){if(_0x1866b9){if(!_0x530652[_0xc3de('0x33')][_0xc3de('0x73')]||!utils[_0xc3de('0x74')](_0x530652[_0xc3de('0x33')][_0xc3de('0x73')])){throw new db['Sequelize'][(_0xc3de('0x75'))](_0xc3de('0x76'));}return _0x1866b9['remove'+_['capitalize'](_0x530652[_0xc3de('0x33')]['channel'][_0xc3de('0x78')]())+_0xc3de('0x7c')](_0x530652['query']['ids']);}return null;})['then'](handleEntityNotFound(_0x23649d,null))[_0xc3de('0x41')](respondWithStatusCode(_0x23649d,null))[_0xc3de('0x44')](handleError(_0x23649d,null));};exports[_0xc3de('0x80')]=function(_0x50aa5d,_0x39c502){var _0x3e4293=_[_0xc3de('0x81')](_0x50aa5d[_0xc3de('0x4a')][_0xc3de('0x7d')])?_0x50aa5d[_0xc3de('0x4a')][_0xc3de('0x7d')]:[_0x50aa5d['body'][_0xc3de('0x7d')]];var _0x309675=_0x50aa5d[_0xc3de('0x46')]['id'];return db[_0xc3de('0x2c')]['find']({'where':{'id':_0x309675}})[_0xc3de('0x41')](handleEntityNotFound(_0x39c502,null))[_0xc3de('0x41')](function(_0x10408e){if(_0x10408e){var _0x4c0262=[_0xc3de('0x82'),'Chat',_0xc3de('0x83'),_0xc3de('0x84'),_0xc3de('0x85'),_0xc3de('0x86'),_0xc3de('0x87')];return db[_0xc3de('0x55')]['transaction'](function(_0x1fb997){var _0x424120=_[_0xc3de('0x32')](_0x4c0262,function(_0x45dfc0){var _0x43dee3={'attributes':['id','name']};if(_0x45dfc0===_0xc3de('0x82')){_0x43dee3[_0xc3de('0x88')]={'attributes':[_0xc3de('0x89')]};}return _0x10408e[_0xc3de('0x4c')+_0x45dfc0+_0xc3de('0x7c')](_0x43dee3)[_0xc3de('0x41')](function(_0x1c72ab){var _0xbbce1a=_[_0xc3de('0x32')](_0x1c72ab,function(_0x3cefaf){var _0x11a8a6=_[_0xc3de('0x32')](_0x3e4293,function(_0x1a30a4){var _0x50cecc={'where':{'UserId':_0x1a30a4,[_0x45dfc0+_0xc3de('0x8a')]:_0x3cefaf['id']},'transaction':_0x1fb997};if(_0x45dfc0===_0xc3de('0x82')){_0x50cecc[_0xc3de('0x8b')]={'penalty':_0x3cefaf[_0xc3de('0x8c')][_0xc3de('0x89')]};}return db[_0xc3de('0x8d')+_0x45dfc0+_0xc3de('0x79')][_0xc3de('0x8e')](_0x50cecc)[_0xc3de('0x41')](function(){socket[_0xc3de('0x8f')](_0xc3de('0x4b')+_0x45dfc0+_0xc3de('0x90'),{'UserId':_0x1a30a4,[_0x45dfc0+_0xc3de('0x8a')]:_0x3cefaf['id']});if(_0x45dfc0!==_0xc3de('0x82')){return;}return db[_0xc3de('0x8d')][_0xc3de('0x43')]({'where':{'id':_0x3e4293,'online':0x1},'attributes':['id',_0xc3de('0x29'),'online','voicePause','interface'],'raw':!![]})[_0xc3de('0x41')](function(_0x27121a){var _0x390445=_[_0xc3de('0x32')](_0x27121a,function(_0x24dba0){return db[_0xc3de('0x91')][_0xc3de('0x92')]({'membername':_0x24dba0[_0xc3de('0x29')],'UserId':_0x24dba0['id'],'queue_name':_0x3cefaf[_0xc3de('0x29')],'VoiceQueueId':_0x3cefaf['id'],'interface':_[_0xc3de('0x93')](_0x24dba0['interface'])?util[_0xc3de('0x94')](_0xc3de('0x95'),_0x24dba0[_0xc3de('0x29')]):_0x24dba0[_0xc3de('0x96')],'paused':_0x24dba0[_0xc3de('0x97')]||![],'penalty':_0x3cefaf[_0xc3de('0x8c')][_0xc3de('0x89')]},{'transaction':_0x1fb997});});return Promise[_0xc3de('0x98')](_0x390445);});});});return Promise[_0xc3de('0x98')](_0x11a8a6);});return Promise[_0xc3de('0x98')](_0xbbce1a);})[_0xc3de('0x41')](function(){return db['TeamVoicePrefix'][_0xc3de('0x7f')]({'where':{'teamId':_0x309675}})[_0xc3de('0x41')](function(_0x287f5a){if(_0x287f5a){var _0x183f08=_[_0xc3de('0x32')](_0x3e4293,function(_0x3c0f9e){db['UserVoicePrefix'][_0xc3de('0x92')]({'UserId':_0x3c0f9e,'VoicePrefixId':_0x287f5a[_0xc3de('0x70')]});});return Promise[_0xc3de('0x98')](_0x183f08);}});});});return Promise['all'](_0x424120)['then'](function(){return _0x10408e[_0xc3de('0x80')](_0x3e4293,{'transaction':_0x1fb997})[_0xc3de('0x99')](function(_0x3d726c){return _0x3d726c;});});});}})[_0xc3de('0x41')](respondWithResult(_0x39c502,null))['catch'](handleError(_0x39c502,null));};exports[_0xc3de('0x9a')]=function(_0x305886,_0x49ffdf){var _0xad61e0=_[_0xc3de('0x81')](_0x305886[_0xc3de('0x33')][_0xc3de('0x7d')])?_0x305886[_0xc3de('0x33')][_0xc3de('0x7d')]:[_0x305886[_0xc3de('0x33')][_0xc3de('0x7d')]];var _0x18c06e=_0x305886[_0xc3de('0x46')]['id'];return db[_0xc3de('0x2c')][_0xc3de('0x48')]({'where':{'id':_0x18c06e}})[_0xc3de('0x41')](handleEntityNotFound(_0x49ffdf,null))[_0xc3de('0x41')](function(_0x5c1899){if(_0x5c1899){var _0x5968fc=[_0xc3de('0x82'),'Chat',_0xc3de('0x83'),'Sms',_0xc3de('0x85'),'Openchannel','Whatsapp'];return db[_0xc3de('0x55')][_0xc3de('0x56')](function(_0x1c9f8e){var _0x56707c=_['map'](_0x5968fc,function(_0xc457f9){var _0x41ea70={'attributes':['id',_0xc3de('0x29')]};return _0x5c1899[_0xc3de('0x4c')+_0xc457f9+_0xc3de('0x7c')](_0x41ea70)[_0xc3de('0x41')](function(_0xda392d){var _0x24180f=_[_0xc3de('0x32')](_0xda392d,function(_0x3ab9a2){return _0x3ab9a2[_0xc3de('0x9a')](_0xad61e0,{'transaction':_0x1c9f8e})['then'](function(){var _0x371e6f=_[_0xc3de('0x32')](_0xad61e0,function(_0x1d05a2){socket[_0xc3de('0x8f')](_0xc3de('0x4b')+_0xc457f9+'Queue:remove',{'UserId':Number(_0x1d05a2),[_0xc457f9+_0xc3de('0x8a')]:_0x3ab9a2['id']});if(_0xc457f9!==_0xc3de('0x82')){return;}return db['UserVoiceQueueRt'][_0xc3de('0x54')]({'where':{'VoiceQueueId':_0x3ab9a2['id'],'UserId':_0x1d05a2},'transaction':_0x1c9f8e});});return Promise[_0xc3de('0x98')](_0x371e6f);});});return Promise[_0xc3de('0x98')](_0x24180f);});});return Promise[_0xc3de('0x98')](_0x56707c)[_0xc3de('0x41')](function(){return _0x5c1899[_0xc3de('0x9a')](_0xad61e0,{'transaction':_0x1c9f8e});})[_0xc3de('0x41')](function(){return db[_0xc3de('0x6e')][_0xc3de('0x7f')]({'where':{'teamId':_0x18c06e}})[_0xc3de('0x41')](function(_0x5e361b){if(_0x5e361b){var _0x45a0bb=_['map'](_0xad61e0,function(_0x1cc97c){db['UserVoicePrefix'][_0xc3de('0x54')]({'where':{'UserId':_0x1cc97c,'VoicePrefixId':_0x5e361b[_0xc3de('0x70')]}});});return Promise[_0xc3de('0x98')](_0x45a0bb);}});});});}})[_0xc3de('0x41')](respondWithStatusCode(_0x49ffdf,null))['catch'](handleError(_0x49ffdf,null));};exports[_0xc3de('0x9b')]=function(_0x2bdf5b,_0x479599,_0x1df98f){var _0x2a110f={};var _0x46d774={};var _0x567942;var _0x35c9e3;return db['Team'][_0xc3de('0x7f')]({'where':{'id':_0x2bdf5b[_0xc3de('0x46')]['id']}})[_0xc3de('0x41')](handleEntityNotFound(_0x479599,null))[_0xc3de('0x41')](function(_0x598da5){if(_0x598da5){_0x567942=_0x598da5;_0x46d774['model']=_[_0xc3de('0x34')](db[_0xc3de('0x8d')][_0xc3de('0x2d')]);_0x46d774[_0xc3de('0x33')]=_[_0xc3de('0x34')](_0x2bdf5b['query']);_0x46d774[_0xc3de('0x3b')]=_['intersection'](_0x46d774[_0xc3de('0x31')],_0x46d774[_0xc3de('0x33')]);_0x2a110f['attributes']=_[_0xc3de('0x35')](_0x46d774[_0xc3de('0x31')],qs[_0xc3de('0x37')](_0x2bdf5b[_0xc3de('0x33')][_0xc3de('0x37')]));_0x2a110f['attributes']=_0x2a110f['attributes']['length']?_0x2a110f['attributes']:_0x46d774[_0xc3de('0x31')];_0x2a110f[_0xc3de('0x38')]=qs[_0xc3de('0x39')](_0x2bdf5b[_0xc3de('0x33')][_0xc3de('0x39')]);_0x2a110f[_0xc3de('0x3a')]=qs[_0xc3de('0x3b')](_['pick'](_0x2bdf5b[_0xc3de('0x33')],_0x46d774[_0xc3de('0x3b')]));if(_0x2bdf5b[_0xc3de('0x33')][_0xc3de('0x3d')]){_0x2a110f[_0xc3de('0x3a')]=_[_0xc3de('0x3e')](_0x2a110f['where'],{'$or':_['map'](_0x2a110f['attributes'],function(_0x4746d2){var _0x53601f={};_0x53601f[_0x4746d2]={'$like':'%'+_0x2bdf5b[_0xc3de('0x33')][_0xc3de('0x3d')]+'%'};return _0x53601f;})});}_0x2a110f=_[_0xc3de('0x3e')]({},_0x2a110f,_0x2bdf5b[_0xc3de('0x40')]);return _0x567942[_0xc3de('0x9b')](_0x2a110f);}})['then'](function(_0x2fb4a9){if(_0x2fb4a9){_0x35c9e3=_0x2fb4a9[_0xc3de('0x7a')];if(!_0x2bdf5b[_0xc3de('0x33')][_0xc3de('0x9c')](_0xc3de('0x9d'))){_0x2a110f['limit']=qs[_0xc3de('0x1e')](_0x2bdf5b[_0xc3de('0x33')][_0xc3de('0x1e')]);_0x2a110f[_0xc3de('0x20')]=qs[_0xc3de('0x20')](_0x2bdf5b[_0xc3de('0x33')][_0xc3de('0x20')]);}return _0x567942['getAgents'](_0x2a110f);}})[_0xc3de('0x41')](function(_0x38a081){if(_0x38a081){return _0x38a081?{'count':_0x35c9e3,'rows':_0x38a081}:null;}})[_0xc3de('0x41')](respondWithResult(_0x479599,null))[_0xc3de('0x44')](handleError(_0x479599,null));}; \ No newline at end of file +var _0x2678=['voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','all','VoicePrefixId','spread','isArray','Chat','Sms','removeAgents','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','error','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Team','includeAll','include','findAll','rows','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','destroy','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','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','send','findOne','channel','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','isValidChannel','ValidationError','add','ids','removeQueues','addAgents','Voice','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','Queue:save'];(function(_0x3215bb,_0x1c42da){var _0x274014=function(_0x3df30c){while(--_0x3df30c){_0x3215bb['push'](_0x3215bb['shift']());}};_0x274014(++_0x1c42da);}(_0x2678,0xac));var _0x8267=function(_0xb8242,_0x253564){_0xb8242=_0xb8242-0x0;var _0x5e2c40=_0x2678[_0xb8242];return _0x5e2c40;};'use strict';var emlformat=require(_0x8267('0x0'));var rimraf=require(_0x8267('0x1'));var zipdir=require(_0x8267('0x2'));var jsonpatch=require(_0x8267('0x3'));var rp=require('request-promise');var moment=require(_0x8267('0x4'));var BPromise=require(_0x8267('0x5'));var Mustache=require(_0x8267('0x6'));var util=require(_0x8267('0x7'));var path=require(_0x8267('0x8'));var sox=require(_0x8267('0x9'));var csv=require('to-csv');var ejs=require(_0x8267('0xa'));var fs=require('fs');var fs_extra=require(_0x8267('0xb'));var _=require(_0x8267('0xc'));var squel=require(_0x8267('0xd'));var crypto=require('crypto');var jsforce=require(_0x8267('0xe'));var deskjs=require(_0x8267('0xf'));var toCsv=require(_0x8267('0x10'));var querystring=require(_0x8267('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8267('0x12'));var qs=require(_0x8267('0x13'));var as=require(_0x8267('0x14'));var hardwareService=require(_0x8267('0x15'));var logger=require(_0x8267('0x16'))(_0x8267('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8267('0x18'));var db=require(_0x8267('0x19'))['db'];config[_0x8267('0x1a')]=_[_0x8267('0x1b')](config[_0x8267('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x8267('0x1c'))(new Redis(config['redis']));require('./team.socket')[_0x8267('0x1d')](socket);function respondWithStatusCode(_0x1e7297,_0x273ec1){_0x273ec1=_0x273ec1||0xcc;return function(_0x3a6e02){if(_0x3a6e02){return _0x1e7297[_0x8267('0x1e')](_0x273ec1);}return _0x1e7297['status'](_0x273ec1)[_0x8267('0x1f')]();};}function respondWithResult(_0x1d2b4b,_0x30261f){_0x30261f=_0x30261f||0xc8;return function(_0x4d9113){if(_0x4d9113){return _0x1d2b4b[_0x8267('0x20')](_0x30261f)['json'](_0x4d9113);}};}function respondWithFilteredResult(_0xf2830f,_0x3e0f53){return function(_0x542ceb){if(_0x542ceb){var _0x67dc01=typeof _0x3e0f53[_0x8267('0x21')]===_0x8267('0x22')&&typeof _0x3e0f53[_0x8267('0x23')]==='undefined';var _0x194b90=_0x542ceb[_0x8267('0x24')];var _0x5da96d=_0x67dc01?0x0:_0x3e0f53[_0x8267('0x21')];var _0x3be9a9=_0x67dc01?_0x542ceb['count']:_0x3e0f53[_0x8267('0x21')]+_0x3e0f53[_0x8267('0x23')];var _0x191da3;if(_0x3be9a9>=_0x194b90){_0x3be9a9=_0x194b90;_0x191da3=0xc8;}else{_0x191da3=0xce;}_0xf2830f[_0x8267('0x20')](_0x191da3);return _0xf2830f[_0x8267('0x25')](_0x8267('0x26'),_0x5da96d+'-'+_0x3be9a9+'/'+_0x194b90)[_0x8267('0x27')](_0x542ceb);}return null;};}function patchUpdates(_0x24ddd3){return function(_0x3ea83b){try{jsonpatch[_0x8267('0x28')](_0x3ea83b,_0x24ddd3,!![]);}catch(_0x255150){return BPromise['reject'](_0x255150);}return _0x3ea83b[_0x8267('0x29')]();};}function saveUpdates(_0x4b5240,_0x507ab6){return function(_0x41db7a){if(_0x41db7a){return _0x41db7a[_0x8267('0x2a')](_0x4b5240)[_0x8267('0x2b')](function(_0x1e67bc){return _0x1e67bc;});}return null;};}function handleEntityNotFound(_0x5adbf4,_0x690c0e){return function(_0x23e6c6){if(!_0x23e6c6){_0x5adbf4['sendStatus'](0x194);}return _0x23e6c6;};}function handleError(_0x38dde7,_0x523845){_0x523845=_0x523845||0x1f4;return function(_0x2bd20b){logger[_0x8267('0x2c')](_0x2bd20b['stack']);if(_0x2bd20b[_0x8267('0x2d')]){delete _0x2bd20b[_0x8267('0x2d')];}_0x38dde7[_0x8267('0x20')](_0x523845)['send'](_0x2bd20b);};}exports[_0x8267('0x2e')]=function(_0x5b3e41,_0x938b67){var _0x51529f={},_0x5665fe={},_0x254356={'count':0x0,'rows':[]};var _0x53929e=_[_0x8267('0x2f')](db['Team'][_0x8267('0x30')],function(_0x261165){return{'name':_0x261165[_0x8267('0x31')],'type':_0x261165[_0x8267('0x32')]['key']};});_0x5665fe[_0x8267('0x33')]=_[_0x8267('0x2f')](_0x53929e,'name');_0x5665fe[_0x8267('0x34')]=_['keys'](_0x5b3e41['query']);_0x5665fe[_0x8267('0x35')]=_[_0x8267('0x36')](_0x5665fe[_0x8267('0x33')],_0x5665fe[_0x8267('0x34')]);_0x51529f[_0x8267('0x37')]=_[_0x8267('0x36')](_0x5665fe[_0x8267('0x33')],qs[_0x8267('0x38')](_0x5b3e41[_0x8267('0x34')][_0x8267('0x38')]));_0x51529f[_0x8267('0x37')]=_0x51529f[_0x8267('0x37')][_0x8267('0x39')]?_0x51529f[_0x8267('0x37')]:_0x5665fe[_0x8267('0x33')];if(!_0x5b3e41[_0x8267('0x34')][_0x8267('0x3a')](_0x8267('0x3b'))){_0x51529f['limit']=qs[_0x8267('0x23')](_0x5b3e41['query'][_0x8267('0x23')]);_0x51529f[_0x8267('0x21')]=qs[_0x8267('0x21')](_0x5b3e41[_0x8267('0x34')][_0x8267('0x21')]);}_0x51529f[_0x8267('0x3c')]=qs[_0x8267('0x3d')](_0x5b3e41[_0x8267('0x34')][_0x8267('0x3d')]);_0x51529f[_0x8267('0x3e')]=qs[_0x8267('0x35')](_[_0x8267('0x3f')](_0x5b3e41[_0x8267('0x34')],_0x5665fe['filters']),_0x53929e);if(_0x5b3e41[_0x8267('0x34')][_0x8267('0x40')]){_0x51529f['where']=_[_0x8267('0x41')](_0x51529f[_0x8267('0x3e')],{'$or':_[_0x8267('0x2f')](_0x53929e,function(_0x533274){if(_0x533274['type']!==_0x8267('0x42')){var _0x48dcf0={};_0x48dcf0[_0x533274[_0x8267('0x2d')]]={'$like':'%'+_0x5b3e41[_0x8267('0x34')][_0x8267('0x40')]+'%'};return _0x48dcf0;}})});}_0x51529f=_[_0x8267('0x41')]({},_0x51529f,_0x5b3e41[_0x8267('0x43')]);var _0x259021={'where':_0x51529f[_0x8267('0x3e')]};return db[_0x8267('0x44')][_0x8267('0x24')](_0x259021)['then'](function(_0x2a1866){_0x254356[_0x8267('0x24')]=_0x2a1866;if(_0x5b3e41[_0x8267('0x34')][_0x8267('0x45')]){_0x51529f[_0x8267('0x46')]=[{'all':!![]}];}return db[_0x8267('0x44')][_0x8267('0x47')](_0x51529f);})[_0x8267('0x2b')](function(_0x3138ca){_0x254356[_0x8267('0x48')]=_0x3138ca;return _0x254356;})[_0x8267('0x2b')](respondWithFilteredResult(_0x938b67,_0x51529f))['catch'](handleError(_0x938b67,null));};exports[_0x8267('0x49')]=function(_0x17a19a,_0x482dba){var _0x2a6905={'raw':![],'where':{'id':_0x17a19a[_0x8267('0x4a')]['id']}},_0xcb863a={};_0xcb863a['model']=_[_0x8267('0x4b')](db['Team'][_0x8267('0x30')]);_0xcb863a[_0x8267('0x34')]=_[_0x8267('0x4b')](_0x17a19a['query']);_0xcb863a[_0x8267('0x35')]=_[_0x8267('0x36')](_0xcb863a[_0x8267('0x33')],_0xcb863a[_0x8267('0x34')]);_0x2a6905[_0x8267('0x37')]=_[_0x8267('0x36')](_0xcb863a[_0x8267('0x33')],qs[_0x8267('0x38')](_0x17a19a[_0x8267('0x34')][_0x8267('0x38')]));_0x2a6905[_0x8267('0x37')]=_0x2a6905['attributes'][_0x8267('0x39')]?_0x2a6905[_0x8267('0x37')]:_0xcb863a[_0x8267('0x33')];if(_0x17a19a[_0x8267('0x34')][_0x8267('0x45')]){_0x2a6905[_0x8267('0x46')]=[{'all':!![]}];}_0x2a6905=_[_0x8267('0x41')]({},_0x2a6905,_0x17a19a[_0x8267('0x43')]);return db[_0x8267('0x44')][_0x8267('0x4c')](_0x2a6905)[_0x8267('0x2b')](handleEntityNotFound(_0x482dba,null))[_0x8267('0x2b')](respondWithResult(_0x482dba,null))['catch'](handleError(_0x482dba,null));};exports[_0x8267('0x4d')]=function(_0x426a55,_0x22c815){return db[_0x8267('0x44')][_0x8267('0x4d')](_0x426a55[_0x8267('0x4e')],{})[_0x8267('0x2b')](function(_0x46d48f){var _0x4c12d5=_0x426a55[_0x8267('0x4f')][_0x8267('0x50')]({'plain':!![]});if(!_0x4c12d5)throw new Error(_0x8267('0x51'));if(_0x4c12d5[_0x8267('0x52')]===_0x8267('0x4f')){var _0xe060d3=_0x46d48f[_0x8267('0x50')]({'plain':!![]});var _0x17d8c5=_0x8267('0x53');return db[_0x8267('0x54')][_0x8267('0x4c')]({'where':{'name':_0x17d8c5,'userProfileId':_0x4c12d5[_0x8267('0x55')]},'raw':!![]})[_0x8267('0x2b')](function(_0x2e6619){if(_0x2e6619&&_0x2e6619[_0x8267('0x56')]===0x0){return db[_0x8267('0x57')]['create']({'name':_0xe060d3[_0x8267('0x2d')],'resourceId':_0xe060d3['id'],'type':_0x2e6619[_0x8267('0x2d')],'sectionId':_0x2e6619['id']},{})[_0x8267('0x2b')](function(){return _0x46d48f;});}else{return _0x46d48f;}})[_0x8267('0x58')](function(_0x549d67){logger[_0x8267('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x549d67);throw _0x549d67;});}return _0x46d48f;})[_0x8267('0x2b')](respondWithResult(_0x22c815,0xc9))[_0x8267('0x58')](handleError(_0x22c815,null));};exports[_0x8267('0x2a')]=function(_0x450552,_0x4bce3c){if(_0x450552['body']['id']){delete _0x450552['body']['id'];}return db['Team']['find']({'where':{'id':_0x450552['params']['id']}})[_0x8267('0x2b')](handleEntityNotFound(_0x4bce3c,null))[_0x8267('0x2b')](saveUpdates(_0x450552['body'],null))[_0x8267('0x2b')](respondWithResult(_0x4bce3c,null))[_0x8267('0x58')](handleError(_0x4bce3c,null));};exports['destroy']=function(_0x1fc3d6,_0x5afbe5){var _0x19319e=_0x1fc3d6['params']['id'];var _0x12d133=[];return db[_0x8267('0x59')][_0x8267('0x5a')](function(_0x29e4f0){var _0x34f020=_0x8267('0x5b')+_0x19319e;return db[_0x8267('0x59')]['query'](_0x34f020,{'type':db[_0x8267('0x5c')][_0x8267('0x5d')]['SELECT'],'raw':!![],'transaction':_0x29e4f0})[_0x8267('0x2b')](function(_0x4d18ff){_0x12d133=_['map'](_0x4d18ff,function(_0x32e84e){return Number(_0x32e84e[_0x8267('0x5e')]);});})[_0x8267('0x2b')](function(){var _0x5f393f=_0x8267('0x5f')+_0x19319e;return db[_0x8267('0x59')]['query'](_0x5f393f,{'type':db['Sequelize'][_0x8267('0x5d')][_0x8267('0x60')],'raw':!![],'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(_0x22e003){var _0x573759=_[_0x8267('0x2f')](_0x22e003,function(_0x5583df){return Number(_0x5583df[_0x8267('0x61')]);});return db[_0x8267('0x62')]['destroy']({'where':{'UserId':{'$in':_0x12d133},'VoiceQueueId':{'$in':_0x573759}},'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(){var _0x2a75c4=_0x8267('0x63')+_0x19319e;return db[_0x8267('0x59')][_0x8267('0x34')](_0x2a75c4,{'type':db['Sequelize'][_0x8267('0x5d')][_0x8267('0x60')],'raw':!![],'transaction':_0x29e4f0});})['then'](function(_0x4db277){var _0x8ea3cf=_[_0x8267('0x2f')](_0x4db277,function(_0x58d512){return Number(_0x58d512[_0x8267('0x64')]);});return db['UserMailQueue'][_0x8267('0x65')]({'where':{'UserId':{'$in':_0x12d133},'MailQueueId':{'$in':_0x8ea3cf}},'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(){var _0x234c8d=_0x8267('0x66')+_0x19319e;return db[_0x8267('0x59')][_0x8267('0x34')](_0x234c8d,{'type':db['Sequelize'][_0x8267('0x5d')][_0x8267('0x60')],'raw':!![],'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(_0x828571){var _0x84c334=_[_0x8267('0x2f')](_0x828571,function(_0x537695){return Number(_0x537695[_0x8267('0x67')]);});return db[_0x8267('0x68')][_0x8267('0x65')]({'where':{'UserId':{'$in':_0x12d133},'SmsQueueId':{'$in':_0x84c334}},'transaction':_0x29e4f0});})['then'](function(){var _0x3a4b70=_0x8267('0x69')+_0x19319e;return db[_0x8267('0x59')][_0x8267('0x34')](_0x3a4b70,{'type':db[_0x8267('0x5c')][_0x8267('0x5d')]['SELECT'],'raw':!![],'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(_0x334ecd){var _0x5292ac=_[_0x8267('0x2f')](_0x334ecd,function(_0x2466d2){return Number(_0x2466d2[_0x8267('0x6a')]);});return db[_0x8267('0x6b')][_0x8267('0x65')]({'where':{'UserId':{'$in':_0x12d133},'ChatQueueId':{'$in':_0x5292ac}},'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(){var _0x5f5140=_0x8267('0x6c')+_0x19319e;return db['sequelize'][_0x8267('0x34')](_0x5f5140,{'type':db[_0x8267('0x5c')][_0x8267('0x5d')][_0x8267('0x60')],'raw':!![],'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(_0x1d3767){var _0x2b06dd=_[_0x8267('0x2f')](_0x1d3767,function(_0x2f8455){return Number(_0x2f8455['FaxQueueId']);});return db['UserFaxQueue'][_0x8267('0x65')]({'where':{'UserId':{'$in':_0x12d133},'FaxQueueId':{'$in':_0x2b06dd}},'transaction':_0x29e4f0});})['then'](function(){var _0x21fb7d=_0x8267('0x6d')+_0x19319e;return db[_0x8267('0x59')]['query'](_0x21fb7d,{'type':db[_0x8267('0x5c')][_0x8267('0x5d')]['SELECT'],'raw':!![],'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(_0x9f41bf){var _0x44aeee=_[_0x8267('0x2f')](_0x9f41bf,function(_0x54490b){return Number(_0x54490b[_0x8267('0x6e')]);});return db[_0x8267('0x6f')][_0x8267('0x65')]({'where':{'UserId':{'$in':_0x12d133},'OpenchannelQueueId':{'$in':_0x44aeee}},'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(){var _0x2a76eb=_0x8267('0x70')+_0x19319e;return db[_0x8267('0x59')][_0x8267('0x34')](_0x2a76eb,{'type':db[_0x8267('0x5c')][_0x8267('0x5d')][_0x8267('0x60')],'raw':!![],'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(_0x3be28f){var _0x31c7ef=_[_0x8267('0x2f')](_0x3be28f,function(_0x247dfd){return Number(_0x247dfd[_0x8267('0x71')]);});return db[_0x8267('0x72')][_0x8267('0x65')]({'where':{'UserId':{'$in':_0x12d133},'WhatsappQueueId':{'$in':_0x31c7ef}},'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(){return db[_0x8267('0x73')]['find']({'where':{'TeamId':_0x19319e}});})['then'](function(_0x36a09e){if(_0x36a09e===null){return;}return db[_0x8267('0x74')][_0x8267('0x65')]({'where':{'UserId':{'$in':_0x12d133},'VoicePrefixId':_0x36a09e['VoicePrefixId']},'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(){return db[_0x8267('0x44')][_0x8267('0x65')]({'where':{'id':_0x19319e},'cascade':!![],'transaction':_0x29e4f0});})[_0x8267('0x2b')](function(_0x33ebc7){if(_0x33ebc7===0x0){_0x5afbe5[_0x8267('0x1e')](0x194);}else{return db[_0x8267('0x57')][_0x8267('0x65')]({'where':{'type':'Teams','resourceId':_0x19319e},'cascade':!![],'transaction':_0x29e4f0})[_0x8267('0x2b')](function(){_0x5afbe5['status'](0xcc)[_0x8267('0x1f')]();});}})[_0x8267('0x58')](function(_0x56149b){_0x5afbe5['status'](0x1f4)[_0x8267('0x75')](_0x56149b);});});};exports['getQueues']=function(_0x400c12,_0x41afc8,_0x4147d8){return db[_0x8267('0x44')][_0x8267('0x76')]({'where':{'id':_0x400c12['params']['id']}})[_0x8267('0x2b')](handleEntityNotFound(_0x41afc8,null))[_0x8267('0x2b')](function(_0x1a7673){if(!_0x400c12[_0x8267('0x34')]['channel']||!utils['isValidChannel'](_0x400c12['query'][_0x8267('0x77')])){throw new db[(_0x8267('0x5c'))]['ValidationError'](_0x8267('0x78'));}var _0x588dea={};var _0x5726f4={};_0x5726f4[_0x8267('0x33')]=_['keys'](db[_[_0x8267('0x79')](_0x400c12[_0x8267('0x34')][_0x8267('0x77')][_0x8267('0x7a')]())+_0x8267('0x7b')][_0x8267('0x30')]);_0x5726f4[_0x8267('0x34')]=_['keys'](_0x400c12[_0x8267('0x34')]);_0x5726f4[_0x8267('0x35')]=_['intersection'](_0x5726f4[_0x8267('0x33')],_0x5726f4[_0x8267('0x34')]);_0x588dea['attributes']=_[_0x8267('0x36')](_0x5726f4[_0x8267('0x33')],qs['fields'](_0x400c12['query'][_0x8267('0x38')]));_0x588dea['attributes']=_0x588dea['attributes'][_0x8267('0x39')]?_0x588dea[_0x8267('0x37')]:_0x5726f4[_0x8267('0x33')];_0x588dea[_0x8267('0x23')]=qs[_0x8267('0x23')](_0x400c12[_0x8267('0x34')]['limit']);_0x588dea[_0x8267('0x21')]=qs[_0x8267('0x21')](_0x400c12[_0x8267('0x34')][_0x8267('0x21')]);_0x588dea[_0x8267('0x3c')]=qs['sort'](_0x400c12['query'][_0x8267('0x3d')]);_0x588dea[_0x8267('0x3e')]=qs[_0x8267('0x35')](_['pick'](_0x400c12['query'],_0x5726f4[_0x8267('0x35')]));_0x588dea=_['merge']({},_0x588dea,_0x400c12[_0x8267('0x43')]);return _0x1a7673[_0x8267('0x50')+_[_0x8267('0x79')](_0x400c12[_0x8267('0x34')][_0x8267('0x77')]['toLowerCase']())+_0x8267('0x7c')](_0x588dea);})['then'](respondWithResult(_0x41afc8,null))[_0x8267('0x58')](handleError(_0x41afc8,null));};exports[_0x8267('0x7d')]=function(_0x2867fd,_0x3f54b1,_0xd61433){return db[_0x8267('0x44')][_0x8267('0x76')]({'where':{'id':_0x2867fd[_0x8267('0x4a')]['id']}})[_0x8267('0x2b')](function(_0x1cd1cb){if(_0x1cd1cb){if(!_0x2867fd[_0x8267('0x4e')][_0x8267('0x77')]||!utils[_0x8267('0x7e')](_0x2867fd[_0x8267('0x4e')]['channel'])){throw new db[(_0x8267('0x5c'))][(_0x8267('0x7f'))](_0x8267('0x78'));}return _0x1cd1cb[_0x8267('0x80')+_[_0x8267('0x79')](_0x2867fd[_0x8267('0x4e')]['channel'][_0x8267('0x7a')]())+'Queues'](_0x2867fd[_0x8267('0x4e')][_0x8267('0x81')]);}return null;})[_0x8267('0x2b')](handleEntityNotFound(_0x3f54b1,null))[_0x8267('0x2b')](respondWithStatusCode(_0x3f54b1,null))[_0x8267('0x58')](handleError(_0x3f54b1,null));};exports[_0x8267('0x82')]=function(_0x1648d2,_0x268714,_0x3b42f4){return db[_0x8267('0x44')][_0x8267('0x76')]({'where':{'id':_0x1648d2[_0x8267('0x4a')]['id']}})['then'](function(_0x5b3ffd){if(_0x5b3ffd){if(!_0x1648d2[_0x8267('0x34')][_0x8267('0x77')]||!utils['isValidChannel'](_0x1648d2[_0x8267('0x34')][_0x8267('0x77')])){throw new db['Sequelize']['ValidationError'](_0x8267('0x78'));}return _0x5b3ffd['remove'+_['capitalize'](_0x1648d2[_0x8267('0x34')][_0x8267('0x77')]['toLowerCase']())+_0x8267('0x7c')](_0x1648d2['query']['ids']);}return null;})[_0x8267('0x2b')](handleEntityNotFound(_0x268714,null))[_0x8267('0x2b')](respondWithStatusCode(_0x268714,null))[_0x8267('0x58')](handleError(_0x268714,null));};exports[_0x8267('0x83')]=function(_0x1307b1,_0x3011b5){var _0x1f5ce0=_['isArray'](_0x1307b1[_0x8267('0x4e')][_0x8267('0x81')])?_0x1307b1[_0x8267('0x4e')][_0x8267('0x81')]:[_0x1307b1['body'][_0x8267('0x81')]];var _0x16fce9=_0x1307b1[_0x8267('0x4a')]['id'];return db[_0x8267('0x44')][_0x8267('0x4c')]({'where':{'id':_0x16fce9}})[_0x8267('0x2b')](handleEntityNotFound(_0x3011b5,null))['then'](function(_0x2f9232){if(_0x2f9232){var _0x375af9=[_0x8267('0x84'),'Chat','Mail','Sms',_0x8267('0x85'),_0x8267('0x86'),_0x8267('0x87')];return db[_0x8267('0x59')][_0x8267('0x5a')](function(_0x4c81a1){var _0x1e0a96=_[_0x8267('0x2f')](_0x375af9,function(_0x4893e4){var _0x2cf973={'attributes':['id',_0x8267('0x2d')]};if(_0x4893e4==='Voice'){_0x2cf973[_0x8267('0x88')]={'attributes':[_0x8267('0x89')]};}return _0x2f9232[_0x8267('0x50')+_0x4893e4+_0x8267('0x7c')](_0x2cf973)[_0x8267('0x2b')](function(_0x5f2842){var _0x554293=_[_0x8267('0x2f')](_0x5f2842,function(_0x4db2fb){var _0x1e2ba1=_[_0x8267('0x2f')](_0x1f5ce0,function(_0x1f20e6){var _0x5e7b28={'where':{'UserId':_0x1f20e6,[_0x4893e4+_0x8267('0x8a')]:_0x4db2fb['id']},'transaction':_0x4c81a1};if(_0x4893e4==='Voice'){_0x5e7b28[_0x8267('0x1b')]={'penalty':_0x4db2fb[_0x8267('0x8b')][_0x8267('0x89')]};}return db[_0x8267('0x8c')+_0x4893e4+_0x8267('0x7b')]['findOrCreate'](_0x5e7b28)[_0x8267('0x2b')](function(){socket['emit'](_0x8267('0x4f')+_0x4893e4+_0x8267('0x8d'),{'UserId':_0x1f20e6,[_0x4893e4+_0x8267('0x8a')]:_0x4db2fb['id']});if(_0x4893e4!=='Voice'){return;}return db['User'][_0x8267('0x47')]({'where':{'id':_0x1f5ce0,'online':0x1},'attributes':['id',_0x8267('0x2d'),'online',_0x8267('0x8e'),_0x8267('0x8f')],'raw':!![]})[_0x8267('0x2b')](function(_0x37afc3){var _0x5bc2d8=_[_0x8267('0x2f')](_0x37afc3,function(_0x10d9b5){return db[_0x8267('0x90')][_0x8267('0x91')]({'membername':_0x10d9b5[_0x8267('0x2d')],'UserId':_0x10d9b5['id'],'queue_name':_0x4db2fb[_0x8267('0x2d')],'VoiceQueueId':_0x4db2fb['id'],'interface':_[_0x8267('0x92')](_0x10d9b5[_0x8267('0x8f')])?util['format'](_0x8267('0x93'),_0x10d9b5[_0x8267('0x2d')]):_0x10d9b5[_0x8267('0x8f')],'paused':_0x10d9b5[_0x8267('0x8e')]||![],'penalty':_0x4db2fb['TeamVoiceQueue'][_0x8267('0x89')]},{'transaction':_0x4c81a1});});return Promise[_0x8267('0x94')](_0x5bc2d8);});});});return Promise['all'](_0x1e2ba1);});return Promise[_0x8267('0x94')](_0x554293);})[_0x8267('0x2b')](function(){return db[_0x8267('0x73')][_0x8267('0x76')]({'where':{'teamId':_0x16fce9}})[_0x8267('0x2b')](function(_0x53ea04){if(_0x53ea04){var _0x4e23a3=_[_0x8267('0x2f')](_0x1f5ce0,function(_0x396536){db[_0x8267('0x74')][_0x8267('0x91')]({'UserId':_0x396536,'VoicePrefixId':_0x53ea04[_0x8267('0x95')]});});return Promise[_0x8267('0x94')](_0x4e23a3);}});});});return Promise[_0x8267('0x94')](_0x1e0a96)[_0x8267('0x2b')](function(){return _0x2f9232[_0x8267('0x83')](_0x1f5ce0,{'transaction':_0x4c81a1})[_0x8267('0x96')](function(_0x455c95){return _0x455c95;});});});}})[_0x8267('0x2b')](respondWithResult(_0x3011b5,null))[_0x8267('0x58')](handleError(_0x3011b5,null));};exports['removeAgents']=function(_0xd926ba,_0x1e189b){var _0x30cb7e=_[_0x8267('0x97')](_0xd926ba[_0x8267('0x34')][_0x8267('0x81')])?_0xd926ba[_0x8267('0x34')][_0x8267('0x81')]:[_0xd926ba[_0x8267('0x34')][_0x8267('0x81')]];var _0x174e95=_0xd926ba[_0x8267('0x4a')]['id'];return db[_0x8267('0x44')][_0x8267('0x4c')]({'where':{'id':_0x174e95}})[_0x8267('0x2b')](handleEntityNotFound(_0x1e189b,null))[_0x8267('0x2b')](function(_0x11f45f){if(_0x11f45f){var _0x4d506c=[_0x8267('0x84'),_0x8267('0x98'),'Mail',_0x8267('0x99'),_0x8267('0x85'),_0x8267('0x86'),_0x8267('0x87')];return db[_0x8267('0x59')]['transaction'](function(_0x41f9f7){var _0x519adc=_[_0x8267('0x2f')](_0x4d506c,function(_0x5a5e5a){var _0x2da4aa={'attributes':['id','name']};return _0x11f45f[_0x8267('0x50')+_0x5a5e5a+_0x8267('0x7c')](_0x2da4aa)['then'](function(_0x7041c9){var _0x4e796e=_[_0x8267('0x2f')](_0x7041c9,function(_0x1c580e){return _0x1c580e[_0x8267('0x9a')](_0x30cb7e,{'transaction':_0x41f9f7})[_0x8267('0x2b')](function(){var _0x24d7b1=_[_0x8267('0x2f')](_0x30cb7e,function(_0x1a3374){socket['emit'](_0x8267('0x4f')+_0x5a5e5a+_0x8267('0x9b'),{'UserId':Number(_0x1a3374),[_0x5a5e5a+_0x8267('0x8a')]:_0x1c580e['id']});if(_0x5a5e5a!==_0x8267('0x84')){return;}return db[_0x8267('0x90')][_0x8267('0x65')]({'where':{'VoiceQueueId':_0x1c580e['id'],'UserId':_0x1a3374},'transaction':_0x41f9f7});});return Promise[_0x8267('0x94')](_0x24d7b1);});});return Promise['all'](_0x4e796e);});});return Promise[_0x8267('0x94')](_0x519adc)[_0x8267('0x2b')](function(){return _0x11f45f['removeAgents'](_0x30cb7e,{'transaction':_0x41f9f7});})[_0x8267('0x2b')](function(){return db['TeamVoicePrefix'][_0x8267('0x76')]({'where':{'teamId':_0x174e95}})['then'](function(_0x55934f){if(_0x55934f){var _0x15c32b=_[_0x8267('0x2f')](_0x30cb7e,function(_0x1bdbe8){db[_0x8267('0x74')]['destroy']({'where':{'UserId':_0x1bdbe8,'VoicePrefixId':_0x55934f[_0x8267('0x95')]}});});return Promise[_0x8267('0x94')](_0x15c32b);}});});});}})['then'](respondWithStatusCode(_0x1e189b,null))[_0x8267('0x58')](handleError(_0x1e189b,null));};exports[_0x8267('0x9c')]=function(_0x8b07ab,_0x26b1d3,_0x1bf3ee){var _0x92ff85={};var _0x31aa96={};var _0x1a15a3;var _0xd671fc;return db[_0x8267('0x44')]['findOne']({'where':{'id':_0x8b07ab[_0x8267('0x4a')]['id']}})[_0x8267('0x2b')](handleEntityNotFound(_0x26b1d3,null))['then'](function(_0x28cdd0){if(_0x28cdd0){_0x1a15a3=_0x28cdd0;_0x31aa96[_0x8267('0x33')]=_[_0x8267('0x4b')](db[_0x8267('0x8c')][_0x8267('0x30')]);_0x31aa96['query']=_[_0x8267('0x4b')](_0x8b07ab[_0x8267('0x34')]);_0x31aa96['filters']=_[_0x8267('0x36')](_0x31aa96['model'],_0x31aa96[_0x8267('0x34')]);_0x92ff85['attributes']=_['intersection'](_0x31aa96['model'],qs['fields'](_0x8b07ab[_0x8267('0x34')][_0x8267('0x38')]));_0x92ff85[_0x8267('0x37')]=_0x92ff85[_0x8267('0x37')]['length']?_0x92ff85['attributes']:_0x31aa96['model'];_0x92ff85[_0x8267('0x3c')]=qs[_0x8267('0x3d')](_0x8b07ab[_0x8267('0x34')][_0x8267('0x3d')]);_0x92ff85[_0x8267('0x3e')]=qs[_0x8267('0x35')](_[_0x8267('0x3f')](_0x8b07ab['query'],_0x31aa96[_0x8267('0x35')]));if(_0x8b07ab[_0x8267('0x34')][_0x8267('0x40')]){_0x92ff85[_0x8267('0x3e')]=_[_0x8267('0x41')](_0x92ff85['where'],{'$or':_[_0x8267('0x2f')](_0x92ff85[_0x8267('0x37')],function(_0xc53d0d){var _0x5694fb={};_0x5694fb[_0xc53d0d]={'$like':'%'+_0x8b07ab[_0x8267('0x34')][_0x8267('0x40')]+'%'};return _0x5694fb;})});}_0x92ff85=_[_0x8267('0x41')]({},_0x92ff85,_0x8b07ab['options']);return _0x1a15a3[_0x8267('0x9c')](_0x92ff85);}})[_0x8267('0x2b')](function(_0x4f759d){if(_0x4f759d){_0xd671fc=_0x4f759d[_0x8267('0x39')];if(!_0x8b07ab['query']['hasOwnProperty'](_0x8267('0x3b'))){_0x92ff85[_0x8267('0x23')]=qs[_0x8267('0x23')](_0x8b07ab['query'][_0x8267('0x23')]);_0x92ff85[_0x8267('0x21')]=qs['offset'](_0x8b07ab['query']['offset']);}return _0x1a15a3[_0x8267('0x9c')](_0x92ff85);}})[_0x8267('0x2b')](function(_0x165b76){if(_0x165b76){return _0x165b76?{'count':_0xd671fc,'rows':_0x165b76}:null;}})[_0x8267('0x2b')](respondWithResult(_0x26b1d3,null))['catch'](handleError(_0x26b1d3,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 6ea4e7b..03882ef 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 _0xc9a0=['emit','hasOwnProperty','events','../../mysqldb','Team','update'];(function(_0x5e1d60,_0x360eb9){var _0x5611d6=function(_0x407201){while(--_0x407201){_0x5e1d60['push'](_0x5e1d60['shift']());}};_0x5611d6(++_0x360eb9);}(_0xc9a0,0xe0));var _0x0c9a=function(_0x516eee,_0x3ff1e9){_0x516eee=_0x516eee-0x0;var _0x1fbbc4=_0xc9a0[_0x516eee];return _0x1fbbc4;};'use strict';var EventEmitter=require(_0x0c9a('0x0'));var Team=require(_0x0c9a('0x1'))['db'][_0x0c9a('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0c9a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x499614){return function(_0x2cb9cd,_0x43d1c4,_0x3f22bc){TeamEvents[_0x0c9a('0x4')](_0x499614+':'+_0x2cb9cd['id'],_0x2cb9cd);TeamEvents[_0x0c9a('0x4')](_0x499614,_0x2cb9cd);_0x3f22bc(null);};}for(var e in events){if(events[_0x0c9a('0x5')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x0e63=['update','remove','emit','exports','events','../../mysqldb','Team','setMaxListeners','save'];(function(_0x4f37e2,_0x1f5ddf){var _0x177e10=function(_0x1d7493){while(--_0x1d7493){_0x4f37e2['push'](_0x4f37e2['shift']());}};_0x177e10(++_0x1f5ddf);}(_0x0e63,0x190));var _0x30e6=function(_0x5ac2e3,_0x31cc81){_0x5ac2e3=_0x5ac2e3-0x0;var _0x1cf218=_0x0e63[_0x5ac2e3];return _0x1cf218;};'use strict';var EventEmitter=require(_0x30e6('0x0'));var Team=require(_0x30e6('0x1'))['db'][_0x30e6('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x30e6('0x3')](0x0);var events={'afterCreate':_0x30e6('0x4'),'afterUpdate':_0x30e6('0x5'),'afterDestroy':_0x30e6('0x6')};function emitEvent(_0x98fa7){return function(_0xaa710d,_0x289b79,_0x44ebe9){TeamEvents[_0x30e6('0x7')](_0x98fa7+':'+_0xaa710d['id'],_0xaa710d);TeamEvents[_0x30e6('0x7')](_0x98fa7,_0xaa710d);_0x44ebe9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x30e6('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 673c6c1..406b12a 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 _0x0348=['Team','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./team.attributes','exports','define'];(function(_0x4b8ee1,_0x4854eb){var _0x11612d=function(_0x1989f3){while(--_0x1989f3){_0x4b8ee1['push'](_0x4b8ee1['shift']());}};_0x11612d(++_0x4854eb);}(_0x0348,0x1e5));var _0x8034=function(_0x35c506,_0x18351c){_0x35c506=_0x35c506-0x0;var _0x4d025c=_0x0348[_0x35c506];return _0x4d025c;};'use strict';var _=require(_0x8034('0x0'));var util=require('util');var logger=require(_0x8034('0x1'))(_0x8034('0x2'));var moment=require(_0x8034('0x3'));var BPromise=require(_0x8034('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8034('0x5'));var rimraf=require('rimraf');var config=require(_0x8034('0x6'));var attributes=require(_0x8034('0x7'));module[_0x8034('0x8')]=function(_0x494928,_0x982cd2){return _0x494928[_0x8034('0x9')](_0x8034('0xa'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf635=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Team','teams','lodash'];(function(_0x1def93,_0x1adede){var _0x35199a=function(_0x44051a){while(--_0x44051a){_0x1def93['push'](_0x1def93['shift']());}};_0x35199a(++_0x1adede);}(_0xf635,0xc2));var _0x5f63=function(_0x1e0c0e,_0x5ccb80){_0x1e0c0e=_0x1e0c0e-0x0;var _0x53fecc=_0xf635[_0x1e0c0e];return _0x53fecc;};'use strict';var _=require(_0x5f63('0x0'));var util=require(_0x5f63('0x1'));var logger=require(_0x5f63('0x2'))(_0x5f63('0x3'));var moment=require('moment');var BPromise=require(_0x5f63('0x4'));var rp=require(_0x5f63('0x5'));var fs=require('fs');var path=require(_0x5f63('0x6'));var rimraf=require(_0x5f63('0x7'));var config=require(_0x5f63('0x8'));var attributes=require('./team.attributes');module[_0x5f63('0x9')]=function(_0xfb97fa,_0x29fae5){return _0xfb97fa[_0x5f63('0xa')](_0x5f63('0xb'),attributes,{'tableName':_0x5f63('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 62616da..08525ca 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 _0x06f3=['defaults','redis','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x50dfea,_0x5dc9ae){var _0x385bda=function(_0x51e3d1){while(--_0x51e3d1){_0x50dfea['push'](_0x50dfea['shift']());}};_0x385bda(++_0x5dc9ae);}(_0x06f3,0xa9));var _0x306f=function(_0x1bbad0,_0x34e914){_0x1bbad0=_0x1bbad0-0x0;var _0x463383=_0x06f3[_0x1bbad0];return _0x463383;};'use strict';var _=require(_0x306f('0x0'));var util=require(_0x306f('0x1'));var moment=require(_0x306f('0x2'));var BPromise=require(_0x306f('0x3'));var rs=require(_0x306f('0x4'));var fs=require('fs');var Redis=require(_0x306f('0x5'));var db=require(_0x306f('0x6'))['db'];var utils=require(_0x306f('0x7'));var logger=require(_0x306f('0x8'))(_0x306f('0x9'));var config=require(_0x306f('0xa'));var jayson=require(_0x306f('0xb'));var client=jayson[_0x306f('0xc')]['http']({'port':0x232a});config['redis']=_[_0x306f('0xd')](config[_0x306f('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x5b1c9a,_0x3d4b72,_0x48ce8e){return new BPromise(function(_0x4b807e,_0x489107){return client['request'](_0x5b1c9a,_0x48ce8e)[_0x306f('0xf')](function(_0x2d9feb){logger[_0x306f('0x10')](_0x306f('0x11'),_0x3d4b72,_0x306f('0x12'));logger['debug'](_0x306f('0x13'),_0x3d4b72,_0x306f('0x12'),JSON[_0x306f('0x14')](_0x2d9feb));if(_0x2d9feb[_0x306f('0x15')]){if(_0x2d9feb[_0x306f('0x15')][_0x306f('0x16')]===0x1f4){logger[_0x306f('0x15')](_0x306f('0x11'),_0x3d4b72,_0x2d9feb['error'][_0x306f('0x17')]);return _0x489107(_0x2d9feb[_0x306f('0x15')][_0x306f('0x17')]);}logger[_0x306f('0x15')](_0x306f('0x11'),_0x3d4b72,_0x2d9feb[_0x306f('0x15')][_0x306f('0x17')]);return _0x4b807e(_0x2d9feb[_0x306f('0x15')]['message']);}else{logger[_0x306f('0x10')](_0x306f('0x11'),_0x3d4b72,_0x306f('0x12'));_0x4b807e(_0x2d9feb[_0x306f('0x18')][_0x306f('0x17')]);}})[_0x306f('0x19')](function(_0x3b0ff2){logger[_0x306f('0x15')]('Team,\x20%s,\x20%s',_0x3d4b72,_0x3b0ff2);_0x489107(_0x3b0ff2);});});} \ No newline at end of file +var _0x473a=['../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','./team.socket','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0x473a,0x1a4));var _0xa473=function(_0x227b3c,_0x122a91){_0x227b3c=_0x227b3c-0x0;var _0x39ada5=_0x473a[_0x227b3c];return _0x39ada5;};'use strict';var _=require(_0xa473('0x0'));var util=require(_0xa473('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa473('0x2'));var fs=require('fs');var Redis=require(_0xa473('0x3'));var db=require(_0xa473('0x4'))['db'];var utils=require(_0xa473('0x5'));var logger=require(_0xa473('0x6'))(_0xa473('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa473('0x8')]({'port':0x232a});config[_0xa473('0x9')]=_[_0xa473('0xa')](config[_0xa473('0x9')],{'host':_0xa473('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa473('0xc'))['register'](socket);function respondWithRpcPromise(_0x2f8d1b,_0x3f748e,_0x40e48c){return new BPromise(function(_0x547d74,_0x54b494){return client[_0xa473('0xd')](_0x2f8d1b,_0x40e48c)[_0xa473('0xe')](function(_0x162780){logger['info'](_0xa473('0xf'),_0x3f748e,_0xa473('0x10'));logger[_0xa473('0x11')](_0xa473('0x12'),_0x3f748e,_0xa473('0x10'),JSON['stringify'](_0x162780));if(_0x162780[_0xa473('0x13')]){if(_0x162780[_0xa473('0x13')][_0xa473('0x14')]===0x1f4){logger[_0xa473('0x13')](_0xa473('0xf'),_0x3f748e,_0x162780[_0xa473('0x13')][_0xa473('0x15')]);return _0x54b494(_0x162780[_0xa473('0x13')][_0xa473('0x15')]);}logger['error'](_0xa473('0xf'),_0x3f748e,_0x162780[_0xa473('0x13')][_0xa473('0x15')]);return _0x547d74(_0x162780['error'][_0xa473('0x15')]);}else{logger[_0xa473('0x16')]('Team,\x20%s,\x20%s',_0x3f748e,'request\x20sent');_0x547d74(_0x162780[_0xa473('0x17')]['message']);}})[_0xa473('0x18')](function(_0x35463a){logger['error'](_0xa473('0xf'),_0x3f748e,_0x35463a);_0x54b494(_0x35463a);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 4ffcd19..2f55fac 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 _0x45bb=['update','removeListener','register','team:','./team.events'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x45bb,0xd1));var _0xb45b=function(_0x27c572,_0x2d0d1c){_0x27c572=_0x27c572-0x0;var _0x10f82e=_0x45bb[_0x27c572];return _0x10f82e;};'use strict';var TeamEvents=require(_0xb45b('0x0'));var events=['save','remove',_0xb45b('0x1')];function createListener(_0x7448f1,_0x20f3d8){return function(_0x4cb2b6){_0x20f3d8['emit'](_0x7448f1,_0x4cb2b6);};}function removeListener(_0xec3106,_0x3d6839){return function(){TeamEvents[_0xb45b('0x2')](_0xec3106,_0x3d6839);};}exports[_0xb45b('0x3')]=function(_0x266813){for(var _0x319f53=0x0,_0x4fc69e=events['length'];_0x319f53<_0x4fc69e;_0x319f53++){var _0x30064e=events[_0x319f53];var _0x39bb61=createListener(_0xb45b('0x4')+_0x30064e,_0x266813);TeamEvents['on'](_0x30064e,_0x39bb61);}}; \ No newline at end of file +var _0x7543=['remove','update','emit','removeListener','register','length','save'];(function(_0x2ecc2d,_0x2cef69){var _0x50766b=function(_0x1313ec){while(--_0x1313ec){_0x2ecc2d['push'](_0x2ecc2d['shift']());}};_0x50766b(++_0x2cef69);}(_0x7543,0xca));var _0x3754=function(_0x92bc95,_0x2dbcc0){_0x92bc95=_0x92bc95-0x0;var _0x1d671e=_0x7543[_0x92bc95];return _0x1d671e;};'use strict';var TeamEvents=require('./team.events');var events=[_0x3754('0x0'),_0x3754('0x1'),_0x3754('0x2')];function createListener(_0x41c08e,_0x34cba1){return function(_0x3af056){_0x34cba1[_0x3754('0x3')](_0x41c08e,_0x3af056);};}function removeListener(_0x276109,_0x3e5e4e){return function(){TeamEvents[_0x3754('0x4')](_0x276109,_0x3e5e4e);};}exports[_0x3754('0x5')]=function(_0x1e49a2){for(var _0x48c22f=0x0,_0x2304fb=events[_0x3754('0x6')];_0x48c22f<_0x2304fb;_0x48c22f++){var _0x11ef76=events[_0x48c22f];var _0x6852d5=createListener('team:'+_0x11ef76,_0x1e49a2);TeamEvents['on'](_0x11ef76,_0x6852d5);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 0271a3e..0fcb055 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 _0xcaa4=['INTEGER','sequelize','exports'];(function(_0xbcf20e,_0x209079){var _0x3cef11=function(_0x20fbed){while(--_0x20fbed){_0xbcf20e['push'](_0xbcf20e['shift']());}};_0x3cef11(++_0x209079);}(_0xcaa4,0x1b7));var _0x4caa=function(_0x131c4c,_0x57f188){_0x131c4c=_0x131c4c-0x0;var _0x177c01=_0xcaa4[_0x131c4c];return _0x177c01;};'use strict';var Sequelize=require(_0x4caa('0x0'));module[_0x4caa('0x1')]={'TeamId':{'type':Sequelize[_0x4caa('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x4caa('0x2')]}}; \ No newline at end of file +var _0x1b32=['INTEGER','exports'];(function(_0x4e731a,_0x268b0a){var _0xac9961=function(_0x1f82ab){while(--_0x1f82ab){_0x4e731a['push'](_0x4e731a['shift']());}};_0xac9961(++_0x268b0a);}(_0x1b32,0x85));var _0x21b3=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x1b32[_0x4e9d3c];return _0x2d0825;};'use strict';var Sequelize=require('sequelize');module[_0x21b3('0x0')]={'TeamId':{'type':Sequelize[_0x21b3('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x21b3('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index b3b5afb..20e7c3d 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 _0xadcc=['api','moment','bluebird','request-promise','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','../../config/logger'];(function(_0x478a19,_0x2ff359){var _0x7fd2fa=function(_0x2aeb50){while(--_0x2aeb50){_0x478a19['push'](_0x478a19['shift']());}};_0x7fd2fa(++_0x2ff359);}(_0xadcc,0x76));var _0xcadc=function(_0x5e4601,_0x5f1733){_0x5e4601=_0x5e4601-0x0;var _0x4ac6a1=_0xadcc[_0x5e4601];return _0x4ac6a1;};'use strict';var _=require(_0xcadc('0x0'));var util=require('util');var logger=require(_0xcadc('0x1'))(_0xcadc('0x2'));var moment=require(_0xcadc('0x3'));var BPromise=require(_0xcadc('0x4'));var rp=require(_0xcadc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcadc('0x6'));var attributes=require(_0xcadc('0x7'));module[_0xcadc('0x8')]=function(_0x25ab60,_0x3aaa29){return _0x25ab60[_0xcadc('0x9')](_0xcadc('0xa'),attributes,{'tableName':_0xcadc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9af1=['../../config/environment','exports','define','TeamVoicePrefix','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2d885b,_0x37010c){var _0x255e9b=function(_0x50c565){while(--_0x50c565){_0x2d885b['push'](_0x2d885b['shift']());}};_0x255e9b(++_0x37010c);}(_0x9af1,0x68));var _0x19af=function(_0x5aedb2,_0x41d9d5){_0x5aedb2=_0x5aedb2-0x0;var _0x4010a1=_0x9af1[_0x5aedb2];return _0x4010a1;};'use strict';var _=require(_0x19af('0x0'));var util=require(_0x19af('0x1'));var logger=require(_0x19af('0x2'))('api');var moment=require(_0x19af('0x3'));var BPromise=require(_0x19af('0x4'));var rp=require(_0x19af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x19af('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0x19af('0x7')]=function(_0x157fc9,_0x41a50f){return _0x157fc9[_0x19af('0x8')](_0x19af('0x9'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 2a162ef..231926d 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xb4d2a2,_0x2187c9){var _0x8e6eb9=function(_0x4a9431){while(--_0x4a9431){_0xb4d2a2['push'](_0xb4d2a2['shift']());}};_0x8e6eb9(++_0x2187c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x583800,_0xef7e91){var _0x5720fb=function(_0x261e70){while(--_0x261e70){_0x583800['push'](_0x583800['shift']());}};_0x5720fb(++_0xef7e91);}(_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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index f0fbc48..f58ce68 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 _0x5781=['INTEGER','sequelize'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x5781,0x179));var _0x1578=function(_0x5a62a1,_0x2a8e32){_0x5a62a1=_0x5a62a1-0x0;var _0x383230=_0x5781[_0x5a62a1];return _0x383230;};'use strict';var Sequelize=require(_0x1578('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x1578('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5533=['sequelize','exports','INTEGER'];(function(_0x10ec84,_0x2f71a4){var _0x3d4db0=function(_0x4da4b4){while(--_0x4da4b4){_0x10ec84['push'](_0x10ec84['shift']());}};_0x3d4db0(++_0x2f71a4);}(_0x5533,0xf9));var _0x3553=function(_0x384782,_0x2ebb8d){_0x384782=_0x384782-0x0;var _0x2d5489=_0x5533[_0x384782];return _0x2d5489;};'use strict';var Sequelize=require(_0x3553('0x0'));module[_0x3553('0x1')]={'penalty':{'type':Sequelize[_0x3553('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 3855175..8c14242 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 _0xea81=['team_has_voice_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue'];(function(_0x2da5b4,_0x481d4d){var _0x592c53=function(_0x16e71b){while(--_0x16e71b){_0x2da5b4['push'](_0x2da5b4['shift']());}};_0x592c53(++_0x481d4d);}(_0xea81,0x1ed));var _0x1ea8=function(_0x2a2e34,_0x273a58){_0x2a2e34=_0x2a2e34-0x0;var _0x3d5b2c=_0xea81[_0x2a2e34];return _0x3d5b2c;};'use strict';var _=require(_0x1ea8('0x0'));var util=require(_0x1ea8('0x1'));var logger=require(_0x1ea8('0x2'))(_0x1ea8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1ea8('0x4'));var fs=require('fs');var path=require(_0x1ea8('0x5'));var rimraf=require(_0x1ea8('0x6'));var config=require(_0x1ea8('0x7'));var attributes=require(_0x1ea8('0x8'));module['exports']=function(_0x486b32,_0x5f4538){return _0x486b32[_0x1ea8('0x9')](_0x1ea8('0xa'),attributes,{'tableName':_0x1ea8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6597=['../../config/logger','moment','request-promise','./teamVoiceQueue.attributes','exports','define','lodash','util'];(function(_0x11df10,_0x132def){var _0x1b08df=function(_0x336048){while(--_0x336048){_0x11df10['push'](_0x11df10['shift']());}};_0x1b08df(++_0x132def);}(_0x6597,0x16e));var _0x7659=function(_0x1f4c48,_0x1ea65c){_0x1f4c48=_0x1f4c48-0x0;var _0xf40f40=_0x6597[_0x1f4c48];return _0xf40f40;};'use strict';var _=require(_0x7659('0x0'));var util=require(_0x7659('0x1'));var logger=require(_0x7659('0x2'))('api');var moment=require(_0x7659('0x3'));var BPromise=require('bluebird');var rp=require(_0x7659('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7659('0x5'));module[_0x7659('0x6')]=function(_0x4e09cc,_0xb90fa2){return _0x4e09cc[_0x7659('0x7')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 870bf53..5bd9885 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 _0x180b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x4be730,_0x341fe4){var _0x54bbe5=function(_0x57aba7){while(--_0x57aba7){_0x4be730['push'](_0x4be730['shift']());}};_0x54bbe5(++_0x341fe4);}(_0x180b,0xdc));var _0xb180=function(_0x37febe,_0x12d212){_0x37febe=_0x37febe-0x0;var _0x2dbde4=_0x180b[_0x37febe];return _0x2dbde4;};'use strict';var _=require(_0xb180('0x0'));var util=require(_0xb180('0x1'));var moment=require(_0xb180('0x2'));var BPromise=require('bluebird');var rs=require(_0xb180('0x3'));var fs=require('fs');var Redis=require(_0xb180('0x4'));var db=require(_0xb180('0x5'))['db'];var utils=require(_0xb180('0x6'));var logger=require(_0xb180('0x7'))(_0xb180('0x8'));var config=require(_0xb180('0x9'));var jayson=require(_0xb180('0xa'));var client=jayson[_0xb180('0xb')][_0xb180('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb4f0ac,_0x26cd5f,_0x30b656){return new BPromise(function(_0x274aac,_0x47b54f){return client['request'](_0xb4f0ac,_0x30b656)[_0xb180('0xd')](function(_0x3713d0){logger[_0xb180('0xe')](_0xb180('0xf'),_0x26cd5f,_0xb180('0x10'));logger[_0xb180('0x11')](_0xb180('0x12'),_0x26cd5f,_0xb180('0x10'),JSON[_0xb180('0x13')](_0x3713d0));if(_0x3713d0[_0xb180('0x14')]){if(_0x3713d0[_0xb180('0x14')][_0xb180('0x15')]===0x1f4){logger[_0xb180('0x14')](_0xb180('0xf'),_0x26cd5f,_0x3713d0[_0xb180('0x14')]['message']);return _0x47b54f(_0x3713d0[_0xb180('0x14')]['message']);}logger[_0xb180('0x14')]('TeamVoiceQueue,\x20%s,\x20%s',_0x26cd5f,_0x3713d0[_0xb180('0x14')][_0xb180('0x16')]);return _0x274aac(_0x3713d0[_0xb180('0x14')]['message']);}else{logger[_0xb180('0xe')](_0xb180('0xf'),_0x26cd5f,_0xb180('0x10'));_0x274aac(_0x3713d0[_0xb180('0x17')][_0xb180('0x16')]);}})[_0xb180('0x18')](function(_0x322cfd){logger[_0xb180('0x14')]('TeamVoiceQueue,\x20%s,\x20%s',_0x26cd5f,_0x322cfd);_0x47b54f(_0x322cfd);});});} \ No newline at end of file +var _0x208d=['TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x59bd64,_0x237f2b){var _0x378c0e=function(_0x24e2be){while(--_0x24e2be){_0x59bd64['push'](_0x59bd64['shift']());}};_0x378c0e(++_0x237f2b);}(_0x208d,0xa4));var _0xd208=function(_0x4a4c78,_0x13d5b7){_0x4a4c78=_0x4a4c78-0x0;var _0xd58f32=_0x208d[_0x4a4c78];return _0xd58f32;};'use strict';var _=require(_0xd208('0x0'));var util=require(_0xd208('0x1'));var moment=require(_0xd208('0x2'));var BPromise=require(_0xd208('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd208('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd208('0x5'));var logger=require(_0xd208('0x6'))(_0xd208('0x7'));var config=require(_0xd208('0x8'));var jayson=require(_0xd208('0x9'));var client=jayson['client'][_0xd208('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6aabd,_0x25008a,_0x521d9c){return new BPromise(function(_0xc03f32,_0x4477a6){return client['request'](_0x6aabd,_0x521d9c)[_0xd208('0xb')](function(_0x406cbb){logger['info'](_0xd208('0xc'),_0x25008a,_0xd208('0xd'));logger[_0xd208('0xe')](_0xd208('0xf'),_0x25008a,'request\x20sent',JSON[_0xd208('0x10')](_0x406cbb));if(_0x406cbb[_0xd208('0x11')]){if(_0x406cbb['error'][_0xd208('0x12')]===0x1f4){logger[_0xd208('0x11')](_0xd208('0xc'),_0x25008a,_0x406cbb[_0xd208('0x11')][_0xd208('0x13')]);return _0x4477a6(_0x406cbb[_0xd208('0x11')][_0xd208('0x13')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x25008a,_0x406cbb[_0xd208('0x11')][_0xd208('0x13')]);return _0xc03f32(_0x406cbb[_0xd208('0x11')][_0xd208('0x13')]);}else{logger[_0xd208('0x14')](_0xd208('0xc'),_0x25008a,'request\x20sent');_0xc03f32(_0x406cbb[_0xd208('0x15')][_0xd208('0x13')]);}})['catch'](function(_0x6ac23e){logger['error'](_0xd208('0xc'),_0x25008a,_0x6ac23e);_0x4477a6(_0x6ac23e);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 4ab5afd..cadec81 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 _0xba37=['../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service'];(function(_0x243de9,_0x1897bb){var _0x58e4bd=function(_0x342b42){while(--_0x342b42){_0x243de9['push'](_0x243de9['shift']());}};_0x58e4bd(++_0x1897bb);}(_0xba37,0xb6));var _0x7ba3=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xba37[_0x2112d4];return _0x434972;};'use strict';var multer=require(_0x7ba3('0x0'));var util=require('util');var path=require(_0x7ba3('0x1'));var timeout=require('connect-timeout');var express=require(_0x7ba3('0x2'));var router=express['Router']();var fs_extra=require(_0x7ba3('0x3'));var auth=require(_0x7ba3('0x4'));var interaction=require(_0x7ba3('0x5'));var config=require(_0x7ba3('0x6'));var controller=require(_0x7ba3('0x7'));router['get']('/',auth[_0x7ba3('0x8')](),controller['index']);router['get'](_0x7ba3('0x9'),auth[_0x7ba3('0x8')](),controller['show']);router[_0x7ba3('0xa')]('/',auth[_0x7ba3('0x8')](),controller[_0x7ba3('0xb')]);router[_0x7ba3('0xc')](_0x7ba3('0x9'),auth[_0x7ba3('0x8')](),controller[_0x7ba3('0xd')]);router[_0x7ba3('0xe')](_0x7ba3('0x9'),auth['isAuthenticated'](),controller[_0x7ba3('0xf')]);module[_0x7ba3('0x10')]=router; \ No newline at end of file +var _0x2cc4=['isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','./template.controller','get'];(function(_0x11c50f,_0x361ddb){var _0x39c015=function(_0x546611){while(--_0x546611){_0x11c50f['push'](_0x11c50f['shift']());}};_0x39c015(++_0x361ddb);}(_0x2cc4,0x1f0));var _0x42cc=function(_0xc69f39,_0x2ce0cf){_0xc69f39=_0xc69f39-0x0;var _0x93be41=_0x2cc4[_0xc69f39];return _0x93be41;};'use strict';var multer=require(_0x42cc('0x0'));var util=require(_0x42cc('0x1'));var path=require(_0x42cc('0x2'));var timeout=require(_0x42cc('0x3'));var express=require('express');var router=express[_0x42cc('0x4')]();var fs_extra=require(_0x42cc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x42cc('0x6'));router[_0x42cc('0x7')]('/',auth[_0x42cc('0x8')](),controller[_0x42cc('0x9')]);router[_0x42cc('0x7')]('/:id',auth[_0x42cc('0x8')](),controller[_0x42cc('0xa')]);router[_0x42cc('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x42cc('0xc')](_0x42cc('0xd'),auth[_0x42cc('0x8')](),controller[_0x42cc('0xe')]);router[_0x42cc('0xf')](_0x42cc('0xd'),auth[_0x42cc('0x8')](),controller[_0x42cc('0x10')]);module[_0x42cc('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index f45ed5d..fa3dde6 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 _0x8387=['sequelize','exports','STRING'];(function(_0x3f0613,_0x3f2846){var _0x3abb8f=function(_0x48a16d){while(--_0x48a16d){_0x3f0613['push'](_0x3f0613['shift']());}};_0x3abb8f(++_0x3f2846);}(_0x8387,0x12f));var _0x7838=function(_0x13d130,_0x5c9dc1){_0x13d130=_0x13d130-0x0;var _0x52df35=_0x8387[_0x13d130];return _0x52df35;};'use strict';var Sequelize=require(_0x7838('0x0'));module[_0x7838('0x1')]={'name':{'type':Sequelize[_0x7838('0x2')]},'description':{'type':Sequelize[_0x7838('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1344=['TEXT','STRING'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x1344,0x1eb));var _0x4134=function(_0x2657c1,_0x50043d){_0x2657c1=_0x2657c1-0x0;var _0x2a94c3=_0x1344[_0x2657c1];return _0x2a94c3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4134('0x0')]},'html':{'type':Sequelize[_0x4134('0x1')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 471e616..c89ed54 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 _0xd76f=['Content-Range','apply','reject','save','then','Templates','UserProfileResource','destroy','end','sendStatus','error','stack','name','index','Template','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','rows','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set'];(function(_0x2fd0f0,_0x4b634e){var _0x57f71a=function(_0x400d6f){while(--_0x400d6f){_0x2fd0f0['push'](_0x2fd0f0['shift']());}};_0x57f71a(++_0x4b634e);}(_0xd76f,0xe3));var _0xfd76=function(_0x335f37,_0x37302b){_0x335f37=_0x335f37-0x0;var _0x1768f4=_0xd76f[_0x335f37];return _0x1768f4;};'use strict';var emlformat=require(_0xfd76('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfd76('0x1'));var jsonpatch=require(_0xfd76('0x2'));var rp=require(_0xfd76('0x3'));var moment=require(_0xfd76('0x4'));var BPromise=require(_0xfd76('0x5'));var Mustache=require('mustache');var util=require(_0xfd76('0x6'));var path=require('path');var sox=require(_0xfd76('0x7'));var csv=require(_0xfd76('0x8'));var ejs=require(_0xfd76('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd76('0xa'));var squel=require(_0xfd76('0xb'));var crypto=require(_0xfd76('0xc'));var jsforce=require(_0xfd76('0xd'));var deskjs=require(_0xfd76('0xe'));var toCsv=require(_0xfd76('0x8'));var querystring=require('querystring');var Papa=require(_0xfd76('0xf'));var Redis=require(_0xfd76('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfd76('0x11'));var as=require(_0xfd76('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd76('0x13'))(_0xfd76('0x14'));var utils=require(_0xfd76('0x15'));var config=require(_0xfd76('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd76('0x17'))['db'];function respondWithStatusCode(_0x1069f5,_0x457b08){_0x457b08=_0x457b08||0xcc;return function(_0x1a7326){if(_0x1a7326){return _0x1069f5['sendStatus'](_0x457b08);}return _0x1069f5[_0xfd76('0x18')](_0x457b08)['end']();};}function respondWithResult(_0x49ac61,_0x5c575d){_0x5c575d=_0x5c575d||0xc8;return function(_0x258f61){if(_0x258f61){return _0x49ac61['status'](_0x5c575d)[_0xfd76('0x19')](_0x258f61);}};}function respondWithFilteredResult(_0x320a8d,_0x476b49){return function(_0x6d82e){if(_0x6d82e){var _0x6eb42b=typeof _0x476b49[_0xfd76('0x1a')]===_0xfd76('0x1b')&&typeof _0x476b49[_0xfd76('0x1c')]===_0xfd76('0x1b');var _0x5c2b00=_0x6d82e[_0xfd76('0x1d')];var _0x5b94f7=_0x6eb42b?0x0:_0x476b49[_0xfd76('0x1a')];var _0x2027c7=_0x6eb42b?_0x6d82e[_0xfd76('0x1d')]:_0x476b49[_0xfd76('0x1a')]+_0x476b49[_0xfd76('0x1c')];var _0x1a0c74;if(_0x2027c7>=_0x5c2b00){_0x2027c7=_0x5c2b00;_0x1a0c74=0xc8;}else{_0x1a0c74=0xce;}_0x320a8d['status'](_0x1a0c74);return _0x320a8d[_0xfd76('0x1e')](_0xfd76('0x1f'),_0x5b94f7+'-'+_0x2027c7+'/'+_0x5c2b00)[_0xfd76('0x19')](_0x6d82e);}return null;};}function patchUpdates(_0x59a3f6){return function(_0x3bf29d){try{jsonpatch[_0xfd76('0x20')](_0x3bf29d,_0x59a3f6,!![]);}catch(_0x102cd4){return BPromise[_0xfd76('0x21')](_0x102cd4);}return _0x3bf29d[_0xfd76('0x22')]();};}function saveUpdates(_0xbbc11,_0x2ae067){return function(_0x459795){if(_0x459795){return _0x459795['update'](_0xbbc11)[_0xfd76('0x23')](function(_0x4ccbb8){return _0x4ccbb8;});}return null;};}function removeEntity(_0x38515c,_0x5304b0){return function(_0xb976e3){if(_0xb976e3){return _0xb976e3['destroy']()[_0xfd76('0x23')](function(){var _0x202faf=_0xb976e3['get']({'plain':!![]});var _0x12cb91=_0xfd76('0x24');return db[_0xfd76('0x25')][_0xfd76('0x26')]({'where':{'type':_0x12cb91,'resourceId':_0x202faf['id']}})[_0xfd76('0x23')](function(){return _0xb976e3;});})['then'](function(){_0x38515c[_0xfd76('0x18')](0xcc)[_0xfd76('0x27')]();});}};}function handleEntityNotFound(_0x32e384,_0xde59e8){return function(_0xac2983){if(!_0xac2983){_0x32e384[_0xfd76('0x28')](0x194);}return _0xac2983;};}function handleError(_0x50e6d4,_0x194057){_0x194057=_0x194057||0x1f4;return function(_0x482638){logger[_0xfd76('0x29')](_0x482638[_0xfd76('0x2a')]);if(_0x482638[_0xfd76('0x2b')]){delete _0x482638[_0xfd76('0x2b')];}_0x50e6d4[_0xfd76('0x18')](_0x194057)['send'](_0x482638);};}exports[_0xfd76('0x2c')]=function(_0x1bbb55,_0x1861cf){var _0x10918e={},_0x50ce55={},_0x2bf2e4={'count':0x0,'rows':[]};var _0x3ac4ce=_['map'](db[_0xfd76('0x2d')][_0xfd76('0x2e')],function(_0x31a155){return{'name':_0x31a155[_0xfd76('0x2f')],'type':_0x31a155[_0xfd76('0x30')][_0xfd76('0x31')]};});_0x50ce55[_0xfd76('0x32')]=_[_0xfd76('0x33')](_0x3ac4ce,_0xfd76('0x2b'));_0x50ce55[_0xfd76('0x34')]=_[_0xfd76('0x35')](_0x1bbb55['query']);_0x50ce55['filters']=_[_0xfd76('0x36')](_0x50ce55[_0xfd76('0x32')],_0x50ce55['query']);_0x10918e[_0xfd76('0x37')]=_['intersection'](_0x50ce55['model'],qs[_0xfd76('0x38')](_0x1bbb55[_0xfd76('0x34')][_0xfd76('0x38')]));_0x10918e[_0xfd76('0x37')]=_0x10918e['attributes'][_0xfd76('0x39')]?_0x10918e['attributes']:_0x50ce55[_0xfd76('0x32')];if(!_0x1bbb55[_0xfd76('0x34')][_0xfd76('0x3a')](_0xfd76('0x3b'))){_0x10918e[_0xfd76('0x1c')]=qs[_0xfd76('0x1c')](_0x1bbb55['query'][_0xfd76('0x1c')]);_0x10918e[_0xfd76('0x1a')]=qs[_0xfd76('0x1a')](_0x1bbb55[_0xfd76('0x34')]['offset']);}_0x10918e['order']=qs[_0xfd76('0x3c')](_0x1bbb55[_0xfd76('0x34')][_0xfd76('0x3c')]);_0x10918e[_0xfd76('0x3d')]=qs[_0xfd76('0x3e')](_[_0xfd76('0x3f')](_0x1bbb55[_0xfd76('0x34')],_0x50ce55[_0xfd76('0x3e')]),_0x3ac4ce);if(_0x1bbb55[_0xfd76('0x34')]['filter']){_0x10918e['where']=_[_0xfd76('0x40')](_0x10918e[_0xfd76('0x3d')],{'$or':_['map'](_0x3ac4ce,function(_0x15e56f){if(_0x15e56f['type']!==_0xfd76('0x41')){var _0x31c8cb={};_0x31c8cb[_0x15e56f[_0xfd76('0x2b')]]={'$like':'%'+_0x1bbb55[_0xfd76('0x34')][_0xfd76('0x42')]+'%'};return _0x31c8cb;}})});}_0x10918e=_[_0xfd76('0x40')]({},_0x10918e,_0x1bbb55['options']);var _0x5aad56={'where':_0x10918e[_0xfd76('0x3d')]};return db[_0xfd76('0x2d')][_0xfd76('0x1d')](_0x5aad56)[_0xfd76('0x23')](function(_0x37137e){_0x2bf2e4[_0xfd76('0x1d')]=_0x37137e;if(_0x1bbb55[_0xfd76('0x34')][_0xfd76('0x43')]){_0x10918e[_0xfd76('0x44')]=[{'all':!![]}];}return db[_0xfd76('0x2d')]['findAll'](_0x10918e);})[_0xfd76('0x23')](function(_0x24981a){_0x2bf2e4[_0xfd76('0x45')]=_0x24981a;return _0x2bf2e4;})['then'](respondWithFilteredResult(_0x1861cf,_0x10918e))['catch'](handleError(_0x1861cf,null));};exports[_0xfd76('0x46')]=function(_0x1d6c91,_0x3d0176){var _0x1b8d6e={'raw':!![],'where':{'id':_0x1d6c91[_0xfd76('0x47')]['id']}},_0x12bfca={};_0x12bfca[_0xfd76('0x32')]=_[_0xfd76('0x35')](db[_0xfd76('0x2d')][_0xfd76('0x2e')]);_0x12bfca[_0xfd76('0x34')]=_['keys'](_0x1d6c91['query']);_0x12bfca[_0xfd76('0x3e')]=_[_0xfd76('0x36')](_0x12bfca[_0xfd76('0x32')],_0x12bfca[_0xfd76('0x34')]);_0x1b8d6e[_0xfd76('0x37')]=_[_0xfd76('0x36')](_0x12bfca[_0xfd76('0x32')],qs[_0xfd76('0x38')](_0x1d6c91[_0xfd76('0x34')][_0xfd76('0x38')]));_0x1b8d6e[_0xfd76('0x37')]=_0x1b8d6e[_0xfd76('0x37')][_0xfd76('0x39')]?_0x1b8d6e[_0xfd76('0x37')]:_0x12bfca[_0xfd76('0x32')];if(_0x1d6c91[_0xfd76('0x34')][_0xfd76('0x43')]){_0x1b8d6e[_0xfd76('0x44')]=[{'all':!![]}];}_0x1b8d6e=_[_0xfd76('0x40')]({},_0x1b8d6e,_0x1d6c91[_0xfd76('0x48')]);return db[_0xfd76('0x2d')][_0xfd76('0x49')](_0x1b8d6e)[_0xfd76('0x23')](handleEntityNotFound(_0x3d0176,null))[_0xfd76('0x23')](respondWithResult(_0x3d0176,null))['catch'](handleError(_0x3d0176,null));};exports['create']=function(_0x197d9b,_0x55539d){return db[_0xfd76('0x2d')][_0xfd76('0x4a')](_0x197d9b[_0xfd76('0x4b')],{})[_0xfd76('0x23')](function(_0x195b2a){var _0x4e1197=_0x197d9b['user']['get']({'plain':!![]});if(!_0x4e1197)throw new Error(_0xfd76('0x4c'));if(_0x4e1197[_0xfd76('0x4d')]===_0xfd76('0x4e')){var _0x8c5e2c=_0x195b2a[_0xfd76('0x4f')]({'plain':!![]});var _0x2f96ff=_0xfd76('0x24');return db[_0xfd76('0x50')][_0xfd76('0x49')]({'where':{'name':_0x2f96ff,'userProfileId':_0x4e1197[_0xfd76('0x51')]},'raw':!![]})[_0xfd76('0x23')](function(_0x57104d){if(_0x57104d&&_0x57104d[_0xfd76('0x52')]===0x0){return db[_0xfd76('0x25')]['create']({'name':_0x8c5e2c[_0xfd76('0x2b')],'resourceId':_0x8c5e2c['id'],'type':_0x57104d[_0xfd76('0x2b')],'sectionId':_0x57104d['id']},{})['then'](function(){return _0x195b2a;});}else{return _0x195b2a;}})['catch'](function(_0x47b6fd){logger[_0xfd76('0x29')](_0xfd76('0x53'),_0x47b6fd);throw _0x47b6fd;});}return _0x195b2a;})[_0xfd76('0x23')](respondWithResult(_0x55539d,0xc9))[_0xfd76('0x54')](handleError(_0x55539d,null));};exports[_0xfd76('0x55')]=function(_0x17dcd2,_0x577918){if(_0x17dcd2['body']['id']){delete _0x17dcd2[_0xfd76('0x4b')]['id'];}return db[_0xfd76('0x2d')]['find']({'where':{'id':_0x17dcd2[_0xfd76('0x47')]['id']}})['then'](handleEntityNotFound(_0x577918,null))[_0xfd76('0x23')](saveUpdates(_0x17dcd2[_0xfd76('0x4b')],null))[_0xfd76('0x23')](respondWithResult(_0x577918,null))['catch'](handleError(_0x577918,null));};exports['destroy']=function(_0x1117f5,_0x1e77d3){return db[_0xfd76('0x2d')][_0xfd76('0x49')]({'where':{'id':_0x1117f5[_0xfd76('0x47')]['id']}})[_0xfd76('0x23')](handleEntityNotFound(_0x1e77d3,null))[_0xfd76('0x23')](removeEntity(_0x1e77d3,null))[_0xfd76('0x54')](handleError(_0x1e77d3,null));}; \ No newline at end of file +var _0xf426=['model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','length','include','find','create','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','save','update','then','get','Templates','UserProfileResource','destroy','error','stack','name','send','Template','rawAttributes','fieldName','type','key'];(function(_0x41ddb5,_0x5015a5){var _0x213548=function(_0x436654){while(--_0x436654){_0x41ddb5['push'](_0x41ddb5['shift']());}};_0x213548(++_0x5015a5);}(_0xf426,0xb0));var _0x6f42=function(_0x4498a2,_0x143689){_0x4498a2=_0x4498a2-0x0;var _0x411aa8=_0xf426[_0x4498a2];return _0x411aa8;};'use strict';var emlformat=require(_0x6f42('0x0'));var rimraf=require(_0x6f42('0x1'));var zipdir=require(_0x6f42('0x2'));var jsonpatch=require(_0x6f42('0x3'));var rp=require(_0x6f42('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6f42('0x5'));var csv=require(_0x6f42('0x6'));var ejs=require(_0x6f42('0x7'));var fs=require('fs');var fs_extra=require(_0x6f42('0x8'));var _=require(_0x6f42('0x9'));var squel=require('squel');var crypto=require(_0x6f42('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6f42('0x6'));var querystring=require(_0x6f42('0xb'));var Papa=require(_0x6f42('0xc'));var Redis=require(_0x6f42('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6f42('0xe'));var hardwareService=require(_0x6f42('0xf'));var logger=require(_0x6f42('0x10'))('api');var utils=require(_0x6f42('0x11'));var config=require(_0x6f42('0x12'));var licenseUtil=require(_0x6f42('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52611e,_0x567bbd){_0x567bbd=_0x567bbd||0xcc;return function(_0x5e6035){if(_0x5e6035){return _0x52611e[_0x6f42('0x14')](_0x567bbd);}return _0x52611e['status'](_0x567bbd)[_0x6f42('0x15')]();};}function respondWithResult(_0xdf88ed,_0x2b271c){_0x2b271c=_0x2b271c||0xc8;return function(_0x5df819){if(_0x5df819){return _0xdf88ed[_0x6f42('0x16')](_0x2b271c)[_0x6f42('0x17')](_0x5df819);}};}function respondWithFilteredResult(_0x793104,_0x37ca61){return function(_0x3f63dd){if(_0x3f63dd){var _0x859730=typeof _0x37ca61['offset']==='undefined'&&typeof _0x37ca61[_0x6f42('0x18')]===_0x6f42('0x19');var _0x21fe9a=_0x3f63dd[_0x6f42('0x1a')];var _0x1f5560=_0x859730?0x0:_0x37ca61[_0x6f42('0x1b')];var _0x2d0248=_0x859730?_0x3f63dd[_0x6f42('0x1a')]:_0x37ca61[_0x6f42('0x1b')]+_0x37ca61['limit'];var _0x310c30;if(_0x2d0248>=_0x21fe9a){_0x2d0248=_0x21fe9a;_0x310c30=0xc8;}else{_0x310c30=0xce;}_0x793104[_0x6f42('0x16')](_0x310c30);return _0x793104['set'](_0x6f42('0x1c'),_0x1f5560+'-'+_0x2d0248+'/'+_0x21fe9a)[_0x6f42('0x17')](_0x3f63dd);}return null;};}function patchUpdates(_0x23757b){return function(_0x5c352c){try{jsonpatch[_0x6f42('0x1d')](_0x5c352c,_0x23757b,!![]);}catch(_0x4dbc90){return BPromise['reject'](_0x4dbc90);}return _0x5c352c[_0x6f42('0x1e')]();};}function saveUpdates(_0x19c496,_0x28cd97){return function(_0x38d95d){if(_0x38d95d){return _0x38d95d[_0x6f42('0x1f')](_0x19c496)[_0x6f42('0x20')](function(_0x502f68){return _0x502f68;});}return null;};}function removeEntity(_0x45a977,_0x22de1b){return function(_0x488bb9){if(_0x488bb9){return _0x488bb9['destroy']()[_0x6f42('0x20')](function(){var _0x88de99=_0x488bb9[_0x6f42('0x21')]({'plain':!![]});var _0x368ef9=_0x6f42('0x22');return db[_0x6f42('0x23')][_0x6f42('0x24')]({'where':{'type':_0x368ef9,'resourceId':_0x88de99['id']}})[_0x6f42('0x20')](function(){return _0x488bb9;});})[_0x6f42('0x20')](function(){_0x45a977[_0x6f42('0x16')](0xcc)[_0x6f42('0x15')]();});}};}function handleEntityNotFound(_0x5172b9,_0x563874){return function(_0x5920b2){if(!_0x5920b2){_0x5172b9['sendStatus'](0x194);}return _0x5920b2;};}function handleError(_0x1ea1ca,_0x2607ae){_0x2607ae=_0x2607ae||0x1f4;return function(_0x34b9ef){logger[_0x6f42('0x25')](_0x34b9ef[_0x6f42('0x26')]);if(_0x34b9ef[_0x6f42('0x27')]){delete _0x34b9ef['name'];}_0x1ea1ca['status'](_0x2607ae)[_0x6f42('0x28')](_0x34b9ef);};}exports['index']=function(_0x1106d4,_0x2d5e24){var _0x216daa={},_0x23bec4={},_0x63ddcf={'count':0x0,'rows':[]};var _0x37ee98=_['map'](db[_0x6f42('0x29')][_0x6f42('0x2a')],function(_0x4944cb){return{'name':_0x4944cb[_0x6f42('0x2b')],'type':_0x4944cb[_0x6f42('0x2c')][_0x6f42('0x2d')]};});_0x23bec4[_0x6f42('0x2e')]=_['map'](_0x37ee98,_0x6f42('0x27'));_0x23bec4[_0x6f42('0x2f')]=_[_0x6f42('0x30')](_0x1106d4['query']);_0x23bec4['filters']=_[_0x6f42('0x31')](_0x23bec4[_0x6f42('0x2e')],_0x23bec4['query']);_0x216daa['attributes']=_[_0x6f42('0x31')](_0x23bec4[_0x6f42('0x2e')],qs[_0x6f42('0x32')](_0x1106d4['query'][_0x6f42('0x32')]));_0x216daa[_0x6f42('0x33')]=_0x216daa[_0x6f42('0x33')]['length']?_0x216daa['attributes']:_0x23bec4[_0x6f42('0x2e')];if(!_0x1106d4['query'][_0x6f42('0x34')](_0x6f42('0x35'))){_0x216daa[_0x6f42('0x18')]=qs[_0x6f42('0x18')](_0x1106d4[_0x6f42('0x2f')][_0x6f42('0x18')]);_0x216daa['offset']=qs[_0x6f42('0x1b')](_0x1106d4['query'][_0x6f42('0x1b')]);}_0x216daa['order']=qs[_0x6f42('0x36')](_0x1106d4[_0x6f42('0x2f')][_0x6f42('0x36')]);_0x216daa[_0x6f42('0x37')]=qs[_0x6f42('0x38')](_['pick'](_0x1106d4[_0x6f42('0x2f')],_0x23bec4[_0x6f42('0x38')]),_0x37ee98);if(_0x1106d4[_0x6f42('0x2f')]['filter']){_0x216daa[_0x6f42('0x37')]=_[_0x6f42('0x39')](_0x216daa[_0x6f42('0x37')],{'$or':_[_0x6f42('0x3a')](_0x37ee98,function(_0x9ef9e0){if(_0x9ef9e0[_0x6f42('0x2c')]!==_0x6f42('0x3b')){var _0x64ecd3={};_0x64ecd3[_0x9ef9e0[_0x6f42('0x27')]]={'$like':'%'+_0x1106d4['query']['filter']+'%'};return _0x64ecd3;}})});}_0x216daa=_['merge']({},_0x216daa,_0x1106d4[_0x6f42('0x3c')]);var _0x187a19={'where':_0x216daa[_0x6f42('0x37')]};return db[_0x6f42('0x29')][_0x6f42('0x1a')](_0x187a19)['then'](function(_0x4fcd53){_0x63ddcf[_0x6f42('0x1a')]=_0x4fcd53;if(_0x1106d4[_0x6f42('0x2f')][_0x6f42('0x3d')]){_0x216daa['include']=[{'all':!![]}];}return db[_0x6f42('0x29')][_0x6f42('0x3e')](_0x216daa);})[_0x6f42('0x20')](function(_0x292a3f){_0x63ddcf[_0x6f42('0x3f')]=_0x292a3f;return _0x63ddcf;})[_0x6f42('0x20')](respondWithFilteredResult(_0x2d5e24,_0x216daa))[_0x6f42('0x40')](handleError(_0x2d5e24,null));};exports['show']=function(_0x57093f,_0x49b087){var _0x2a4d7a={'raw':!![],'where':{'id':_0x57093f['params']['id']}},_0x2d2316={};_0x2d2316[_0x6f42('0x2e')]=_[_0x6f42('0x30')](db[_0x6f42('0x29')][_0x6f42('0x2a')]);_0x2d2316[_0x6f42('0x2f')]=_[_0x6f42('0x30')](_0x57093f[_0x6f42('0x2f')]);_0x2d2316['filters']=_['intersection'](_0x2d2316['model'],_0x2d2316[_0x6f42('0x2f')]);_0x2a4d7a[_0x6f42('0x33')]=_[_0x6f42('0x31')](_0x2d2316[_0x6f42('0x2e')],qs['fields'](_0x57093f[_0x6f42('0x2f')]['fields']));_0x2a4d7a[_0x6f42('0x33')]=_0x2a4d7a[_0x6f42('0x33')][_0x6f42('0x41')]?_0x2a4d7a[_0x6f42('0x33')]:_0x2d2316['model'];if(_0x57093f[_0x6f42('0x2f')][_0x6f42('0x3d')]){_0x2a4d7a[_0x6f42('0x42')]=[{'all':!![]}];}_0x2a4d7a=_['merge']({},_0x2a4d7a,_0x57093f[_0x6f42('0x3c')]);return db[_0x6f42('0x29')][_0x6f42('0x43')](_0x2a4d7a)['then'](handleEntityNotFound(_0x49b087,null))['then'](respondWithResult(_0x49b087,null))['catch'](handleError(_0x49b087,null));};exports['create']=function(_0x5008ae,_0x21f286){return db[_0x6f42('0x29')][_0x6f42('0x44')](_0x5008ae['body'],{})[_0x6f42('0x20')](function(_0x4bfd03){var _0x2414bf=_0x5008ae[_0x6f42('0x45')][_0x6f42('0x21')]({'plain':!![]});if(!_0x2414bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2414bf[_0x6f42('0x46')]==='user'){var _0x2439ca=_0x4bfd03[_0x6f42('0x21')]({'plain':!![]});var _0x317496=_0x6f42('0x22');return db['UserProfileSection'][_0x6f42('0x43')]({'where':{'name':_0x317496,'userProfileId':_0x2414bf['userProfileId']},'raw':!![]})[_0x6f42('0x20')](function(_0x1a44fd){if(_0x1a44fd&&_0x1a44fd[_0x6f42('0x47')]===0x0){return db[_0x6f42('0x23')]['create']({'name':_0x2439ca['name'],'resourceId':_0x2439ca['id'],'type':_0x1a44fd[_0x6f42('0x27')],'sectionId':_0x1a44fd['id']},{})[_0x6f42('0x20')](function(){return _0x4bfd03;});}else{return _0x4bfd03;}})[_0x6f42('0x40')](function(_0x1cbb73){logger[_0x6f42('0x25')](_0x6f42('0x48'),_0x1cbb73);throw _0x1cbb73;});}return _0x4bfd03;})['then'](respondWithResult(_0x21f286,0xc9))['catch'](handleError(_0x21f286,null));};exports[_0x6f42('0x1f')]=function(_0x6d831f,_0x55868e){if(_0x6d831f[_0x6f42('0x49')]['id']){delete _0x6d831f[_0x6f42('0x49')]['id'];}return db[_0x6f42('0x29')][_0x6f42('0x43')]({'where':{'id':_0x6d831f['params']['id']}})[_0x6f42('0x20')](handleEntityNotFound(_0x55868e,null))[_0x6f42('0x20')](saveUpdates(_0x6d831f[_0x6f42('0x49')],null))[_0x6f42('0x20')](respondWithResult(_0x55868e,null))[_0x6f42('0x40')](handleError(_0x55868e,null));};exports[_0x6f42('0x24')]=function(_0x31b9ba,_0xbfc53){return db[_0x6f42('0x29')][_0x6f42('0x43')]({'where':{'id':_0x31b9ba['params']['id']}})[_0x6f42('0x20')](handleEntityNotFound(_0xbfc53,null))['then'](removeEntity(_0xbfc53,null))['catch'](handleError(_0xbfc53,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 21f8c82..a472a28 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 _0xd82a=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','util'];(function(_0x154cbb,_0x43c57f){var _0x494584=function(_0x971bd9){while(--_0x971bd9){_0x154cbb['push'](_0x154cbb['shift']());}};_0x494584(++_0x43c57f);}(_0xd82a,0xf6));var _0xad82=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xd82a[_0x599e60];return _0x468e19;};'use strict';var _=require('lodash');var util=require(_0xad82('0x0'));var logger=require(_0xad82('0x1'))(_0xad82('0x2'));var moment=require(_0xad82('0x3'));var BPromise=require('bluebird');var rp=require(_0xad82('0x4'));var fs=require('fs');var path=require(_0xad82('0x5'));var rimraf=require(_0xad82('0x6'));var config=require(_0xad82('0x7'));var attributes=require(_0xad82('0x8'));module[_0xad82('0x9')]=function(_0x1f6a4f,_0x1d51f3){return _0x1f6a4f[_0xad82('0xa')](_0xad82('0xb'),attributes,{'tableName':_0xad82('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7baa=['tools_templates','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./template.attributes','exports','define','Template'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x7baa,0x145));var _0xa7ba=function(_0x53d172,_0x46611b){_0x53d172=_0x53d172-0x0;var _0x1bd0a2=_0x7baa[_0x53d172];return _0x1bd0a2;};'use strict';var _=require(_0xa7ba('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa7ba('0x1'));var moment=require(_0xa7ba('0x2'));var BPromise=require(_0xa7ba('0x3'));var rp=require(_0xa7ba('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa7ba('0x5'));var config=require(_0xa7ba('0x6'));var attributes=require(_0xa7ba('0x7'));module[_0xa7ba('0x8')]=function(_0x30df69,_0x37d113){return _0x30df69[_0xa7ba('0x9')](_0xa7ba('0xa'),attributes,{'tableName':_0xa7ba('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 8fe8839..3546e20 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 _0xd0a4=['options','limit','include','map','attributes','model','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTemplate','Template','findAll'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xd0a4,0x166));var _0x4d0a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0a4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4d0a('0x0'));var util=require(_0x4d0a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d0a('0x2'));var db=require(_0x4d0a('0x3'))['db'];var utils=require(_0x4d0a('0x4'));var logger=require(_0x4d0a('0x5'))(_0x4d0a('0x6'));var config=require(_0x4d0a('0x7'));var jayson=require(_0x4d0a('0x8'));var client=jayson[_0x4d0a('0x9')][_0x4d0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a3a1a,_0x59fe32,_0xd6c889){return new BPromise(function(_0x1feaea,_0x5199b8){return client[_0x4d0a('0xb')](_0x4a3a1a,_0xd6c889)[_0x4d0a('0xc')](function(_0x4e049b){logger[_0x4d0a('0xd')](_0x4d0a('0xe'),_0x59fe32,_0x4d0a('0xf'));logger[_0x4d0a('0x10')](_0x4d0a('0x11'),_0x59fe32,'request\x20sent',JSON['stringify'](_0x4e049b));if(_0x4e049b['error']){if(_0x4e049b[_0x4d0a('0x12')][_0x4d0a('0x13')]===0x1f4){logger[_0x4d0a('0x12')]('Template,\x20%s,\x20%s',_0x59fe32,_0x4e049b['error']['message']);return _0x5199b8(_0x4e049b['error'][_0x4d0a('0x14')]);}logger['error'](_0x4d0a('0xe'),_0x59fe32,_0x4e049b[_0x4d0a('0x12')][_0x4d0a('0x14')]);return _0x1feaea(_0x4e049b['error'][_0x4d0a('0x14')]);}else{logger[_0x4d0a('0xd')](_0x4d0a('0xe'),_0x59fe32,_0x4d0a('0xf'));_0x1feaea(_0x4e049b[_0x4d0a('0x15')][_0x4d0a('0x14')]);}})[_0x4d0a('0x16')](function(_0x4052e8){logger['error'](_0x4d0a('0xe'),_0x59fe32,_0x4052e8);_0x5199b8(_0x4052e8);});});}exports[_0x4d0a('0x17')]=function(_0x38f959){var _0x63c272=this;return new Promise(function(_0x1b3f7e,_0x4dcd56){return db[_0x4d0a('0x18')][_0x4d0a('0x19')]({'raw':_0x38f959[_0x4d0a('0x1a')]?_0x38f959[_0x4d0a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x38f959[_0x4d0a('0x1a')]?_0x38f959['options']['where']||null:null,'attributes':_0x38f959[_0x4d0a('0x1a')]?_0x38f959[_0x4d0a('0x1a')]['attributes']||null:null,'limit':_0x38f959[_0x4d0a('0x1a')]?_0x38f959['options'][_0x4d0a('0x1b')]||null:null,'include':_0x38f959[_0x4d0a('0x1a')]?_0x38f959[_0x4d0a('0x1a')][_0x4d0a('0x1c')]?_[_0x4d0a('0x1d')](_0x38f959[_0x4d0a('0x1a')][_0x4d0a('0x1c')],function(_0x9a4961){return{'model':db[_0x9a4961['model']],'as':_0x9a4961['as'],'attributes':_0x9a4961[_0x4d0a('0x1e')],'include':_0x9a4961['include']?_[_0x4d0a('0x1d')](_0x9a4961[_0x4d0a('0x1c')],function(_0x56706e){return{'model':db[_0x56706e['model']],'as':_0x56706e['as'],'attributes':_0x56706e[_0x4d0a('0x1e')],'include':_0x56706e[_0x4d0a('0x1c')]?_['map'](_0x56706e['include'],function(_0x5c0d86){return{'model':db[_0x5c0d86[_0x4d0a('0x1f')]],'as':_0x5c0d86['as'],'attributes':_0x5c0d86[_0x4d0a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a9f90){logger['info']('GetTemplate',_0x38f959);logger[_0x4d0a('0x10')](_0x4d0a('0x17'),_0x38f959,JSON['stringify'](_0x3a9f90));_0x1b3f7e(_0x3a9f90);})[_0x4d0a('0x16')](function(_0x4e4dce){logger[_0x4d0a('0x12')](_0x4d0a('0x17'),_0x4e4dce[_0x4d0a('0x14')],_0x38f959);_0x4dcd56(_0x63c272['error'](0x1f4,_0x4e4dce[_0x4d0a('0x14')]));});});}; \ No newline at end of file +var _0x3563=['request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','map','model','include','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Template,\x20%s,\x20%s'];(function(_0x28f358,_0x2ab025){var _0x2e58d2=function(_0x1c3b01){while(--_0x1c3b01){_0x28f358['push'](_0x28f358['shift']());}};_0x2e58d2(++_0x2ab025);}(_0x3563,0x159));var _0x3356=function(_0x33ec76,_0x10f648){_0x33ec76=_0x33ec76-0x0;var _0x5c8ab2=_0x3563[_0x33ec76];return _0x5c8ab2;};'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('../../mysqldb')['db'];var utils=require(_0x3356('0x6'));var logger=require(_0x3356('0x7'))(_0x3356('0x8'));var config=require(_0x3356('0x9'));var jayson=require(_0x3356('0xa'));var client=jayson[_0x3356('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x587083,_0x14048a,_0x5c7883){return new BPromise(function(_0x415bd4,_0x44a6c6){return client[_0x3356('0xc')](_0x587083,_0x5c7883)[_0x3356('0xd')](function(_0x5a0b27){logger['info'](_0x3356('0xe'),_0x14048a,_0x3356('0xf'));logger[_0x3356('0x10')](_0x3356('0x11'),_0x14048a,'request\x20sent',JSON[_0x3356('0x12')](_0x5a0b27));if(_0x5a0b27['error']){if(_0x5a0b27['error'][_0x3356('0x13')]===0x1f4){logger[_0x3356('0x14')](_0x3356('0xe'),_0x14048a,_0x5a0b27['error']['message']);return _0x44a6c6(_0x5a0b27[_0x3356('0x14')][_0x3356('0x15')]);}logger[_0x3356('0x14')](_0x3356('0xe'),_0x14048a,_0x5a0b27[_0x3356('0x14')][_0x3356('0x15')]);return _0x415bd4(_0x5a0b27[_0x3356('0x14')][_0x3356('0x15')]);}else{logger[_0x3356('0x16')](_0x3356('0xe'),_0x14048a,_0x3356('0xf'));_0x415bd4(_0x5a0b27[_0x3356('0x17')][_0x3356('0x15')]);}})[_0x3356('0x18')](function(_0x18eaf3){logger['error'](_0x3356('0xe'),_0x14048a,_0x18eaf3);_0x44a6c6(_0x18eaf3);});});}exports[_0x3356('0x19')]=function(_0x44c30b){var _0x1428e9=this;return new Promise(function(_0x346f7c,_0x22fd4e){return db[_0x3356('0x1a')][_0x3356('0x1b')]({'raw':_0x44c30b['options']?_0x44c30b[_0x3356('0x1c')][_0x3356('0x1d')]===undefined?!![]:![]:!![],'where':_0x44c30b[_0x3356('0x1c')]?_0x44c30b[_0x3356('0x1c')][_0x3356('0x1e')]||null:null,'attributes':_0x44c30b[_0x3356('0x1c')]?_0x44c30b[_0x3356('0x1c')][_0x3356('0x1f')]||null:null,'limit':_0x44c30b[_0x3356('0x1c')]?_0x44c30b[_0x3356('0x1c')][_0x3356('0x20')]||null:null,'include':_0x44c30b[_0x3356('0x1c')]?_0x44c30b[_0x3356('0x1c')]['include']?_[_0x3356('0x21')](_0x44c30b[_0x3356('0x1c')]['include'],function(_0x207ada){return{'model':db[_0x207ada[_0x3356('0x22')]],'as':_0x207ada['as'],'attributes':_0x207ada[_0x3356('0x1f')],'include':_0x207ada[_0x3356('0x23')]?_[_0x3356('0x21')](_0x207ada[_0x3356('0x23')],function(_0xb512a0){return{'model':db[_0xb512a0[_0x3356('0x22')]],'as':_0xb512a0['as'],'attributes':_0xb512a0['attributes'],'include':_0xb512a0[_0x3356('0x23')]?_['map'](_0xb512a0[_0x3356('0x23')],function(_0x933ece){return{'model':db[_0x933ece[_0x3356('0x22')]],'as':_0x933ece['as'],'attributes':_0x933ece[_0x3356('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3356('0xd')](function(_0x14f5bd){logger['info']('GetTemplate',_0x44c30b);logger[_0x3356('0x10')](_0x3356('0x19'),_0x44c30b,JSON[_0x3356('0x12')](_0x14f5bd));_0x346f7c(_0x14f5bd);})['catch'](function(_0x409237){logger[_0x3356('0x14')](_0x3356('0x19'),_0x409237[_0x3356('0x15')],_0x44c30b);_0x22fd4e(_0x1428e9[_0x3356('0x14')](0x1f4,_0x409237[_0x3356('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index c79a665..3d19ce8 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 _0xf989=['../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id/all_conditions','getAllConditions','/:id/actions','post','create','/:id/any_conditions','addAnyCondition','addAction','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x6a6ac1,_0x48db68){var _0x522352=function(_0x5867ec){while(--_0x5867ec){_0x6a6ac1['push'](_0x6a6ac1['shift']());}};_0x522352(++_0x48db68);}(_0xf989,0x164));var _0x9f98=function(_0x441563,_0x1d4a28){_0x441563=_0x441563-0x0;var _0x2369ec=_0xf989[_0x441563];return _0x2369ec;};'use strict';var multer=require(_0x9f98('0x0'));var util=require(_0x9f98('0x1'));var path=require(_0x9f98('0x2'));var timeout=require(_0x9f98('0x3'));var express=require(_0x9f98('0x4'));var router=express[_0x9f98('0x5')]();var fs_extra=require(_0x9f98('0x6'));var auth=require(_0x9f98('0x7'));var interaction=require(_0x9f98('0x8'));var config=require(_0x9f98('0x9'));var controller=require(_0x9f98('0xa'));router[_0x9f98('0xb')]('/',auth[_0x9f98('0xc')](),controller[_0x9f98('0xd')]);router[_0x9f98('0xb')]('/:id',auth[_0x9f98('0xc')](),controller['show']);router[_0x9f98('0xb')](_0x9f98('0xe'),auth[_0x9f98('0xc')](),controller[_0x9f98('0xf')]);router['get']('/:id/any_conditions',auth[_0x9f98('0xc')](),controller['getAnyConditions']);router[_0x9f98('0xb')](_0x9f98('0x10'),auth['isAuthenticated'](),controller['getActions']);router[_0x9f98('0x11')]('/',auth['isAuthenticated'](),controller[_0x9f98('0x12')]);router[_0x9f98('0x11')]('/:id/all_conditions',auth[_0x9f98('0xc')](),controller['addAllCondition']);router[_0x9f98('0x11')](_0x9f98('0x13'),auth[_0x9f98('0xc')](),controller[_0x9f98('0x14')]);router[_0x9f98('0x11')]('/:id/actions',auth[_0x9f98('0xc')](),controller[_0x9f98('0x15')]);router[_0x9f98('0x16')]('/:id',auth[_0x9f98('0xc')](),controller[_0x9f98('0x17')]);router[_0x9f98('0x18')](_0x9f98('0x19'),auth['isAuthenticated'](),controller[_0x9f98('0x1a')]);module[_0x9f98('0x1b')]=router; \ No newline at end of file +var _0x1baf=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','getAnyConditions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','/:id/actions','put','update','destroy','multer','util','path','express'];(function(_0x562cd0,_0x30659f){var _0x18a4d7=function(_0x2d762e){while(--_0x2d762e){_0x562cd0['push'](_0x562cd0['shift']());}};_0x18a4d7(++_0x30659f);}(_0x1baf,0x14e));var _0xf1ba=function(_0x52aba9,_0x17f9ba){_0x52aba9=_0x52aba9-0x0;var _0x1805d2=_0x1baf[_0x52aba9];return _0x1805d2;};'use strict';var multer=require(_0xf1ba('0x0'));var util=require(_0xf1ba('0x1'));var path=require(_0xf1ba('0x2'));var timeout=require('connect-timeout');var express=require(_0xf1ba('0x3'));var router=express[_0xf1ba('0x4')]();var fs_extra=require(_0xf1ba('0x5'));var auth=require(_0xf1ba('0x6'));var interaction=require(_0xf1ba('0x7'));var config=require(_0xf1ba('0x8'));var controller=require('./trigger.controller');router[_0xf1ba('0x9')]('/',auth[_0xf1ba('0xa')](),controller['index']);router['get'](_0xf1ba('0xb'),auth[_0xf1ba('0xa')](),controller[_0xf1ba('0xc')]);router[_0xf1ba('0x9')](_0xf1ba('0xd'),auth[_0xf1ba('0xa')](),controller[_0xf1ba('0xe')]);router['get']('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xf1ba('0xf')]);router[_0xf1ba('0x9')]('/:id/actions',auth[_0xf1ba('0xa')](),controller[_0xf1ba('0x10')]);router[_0xf1ba('0x11')]('/',auth[_0xf1ba('0xa')](),controller[_0xf1ba('0x12')]);router[_0xf1ba('0x11')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xf1ba('0x13')]);router[_0xf1ba('0x11')](_0xf1ba('0x14'),auth['isAuthenticated'](),controller[_0xf1ba('0x15')]);router[_0xf1ba('0x11')](_0xf1ba('0x16'),auth[_0xf1ba('0xa')](),controller['addAction']);router[_0xf1ba('0x17')]('/:id',auth[_0xf1ba('0xa')](),controller[_0xf1ba('0x18')]);router['delete'](_0xf1ba('0xb'),auth[_0xf1ba('0xa')](),controller[_0xf1ba('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 86a8efa..67afcff 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 _0x9bcb=['STRING','sequelize','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9bcb,0x8b));var _0xb9bc=function(_0x6f1709,_0x25100f){_0x6f1709=_0x6f1709-0x0;var _0x12ebf7=_0x9bcb[_0x6f1709];return _0x12ebf7;};'use strict';var Sequelize=require(_0xb9bc('0x0'));module[_0xb9bc('0x1')]={'name':{'type':Sequelize[_0xb9bc('0x2')]},'channel':{'type':Sequelize[_0xb9bc('0x2')]},'description':{'type':Sequelize[_0xb9bc('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xdcd5=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3d3275,_0x18b2f0){var _0x379f31=function(_0x5c7911){while(--_0x5c7911){_0x3d3275['push'](_0x3d3275['shift']());}};_0x379f31(++_0x18b2f0);}(_0xdcd5,0x174));var _0x5dcd=function(_0x1d94d1,_0x347bb8){_0x1d94d1=_0x1d94d1-0x0;var _0x23c397=_0xdcd5[_0x1d94d1];return _0x23c397;};'use strict';var Sequelize=require(_0x5dcd('0x0'));module[_0x5dcd('0x1')]={'name':{'type':Sequelize[_0x5dcd('0x2')]},'channel':{'type':Sequelize[_0x5dcd('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x5dcd('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 80d0231..c0eb223 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 _0xb079=['fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','options','include','findAll','catch','params','includeAll','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','TriggerAnyId','findOne','getAllConditions','nolimit','getAnyConditions','addAction','Action','getActions','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','sendStatus','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes'];(function(_0xb2910c,_0x4bf124){var _0x4c18cb=function(_0x2c6807){while(--_0x2c6807){_0xb2910c['push'](_0xb2910c['shift']());}};_0x4c18cb(++_0x4bf124);}(_0xb079,0x1ef));var _0x9b07=function(_0x553efb,_0x2e6faf){_0x553efb=_0x553efb-0x0;var _0x4a43e0=_0xb079[_0x553efb];return _0x4a43e0;};'use strict';var emlformat=require(_0x9b07('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9b07('0x1'));var rp=require('request-promise');var moment=require(_0x9b07('0x2'));var BPromise=require(_0x9b07('0x3'));var Mustache=require('mustache');var util=require(_0x9b07('0x4'));var path=require(_0x9b07('0x5'));var sox=require(_0x9b07('0x6'));var csv=require(_0x9b07('0x7'));var ejs=require(_0x9b07('0x8'));var fs=require('fs');var fs_extra=require(_0x9b07('0x9'));var _=require(_0x9b07('0xa'));var squel=require(_0x9b07('0xb'));var crypto=require(_0x9b07('0xc'));var jsforce=require(_0x9b07('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9b07('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9b07('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9b07('0xf'));var as=require(_0x9b07('0x10'));var hardwareService=require(_0x9b07('0x11'));var logger=require(_0x9b07('0x12'))(_0x9b07('0x13'));var utils=require(_0x9b07('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9b07('0x15'));var db=require(_0x9b07('0x16'))['db'];function respondWithStatusCode(_0x544314,_0x3f26a0){_0x3f26a0=_0x3f26a0||0xcc;return function(_0xcebcd0){if(_0xcebcd0){return _0x544314['sendStatus'](_0x3f26a0);}return _0x544314[_0x9b07('0x17')](_0x3f26a0)[_0x9b07('0x18')]();};}function respondWithResult(_0x57a74a,_0x227cbb){_0x227cbb=_0x227cbb||0xc8;return function(_0x282ffc){if(_0x282ffc){return _0x57a74a[_0x9b07('0x17')](_0x227cbb)['json'](_0x282ffc);}};}function respondWithFilteredResult(_0x25f93a,_0xd6e05c){return function(_0x57291c){if(_0x57291c){var _0x5f33c1=typeof _0xd6e05c['offset']===_0x9b07('0x19')&&typeof _0xd6e05c[_0x9b07('0x1a')]===_0x9b07('0x19');var _0x54c1e6=_0x57291c['count'];var _0x7852d0=_0x5f33c1?0x0:_0xd6e05c['offset'];var _0x14feb0=_0x5f33c1?_0x57291c[_0x9b07('0x1b')]:_0xd6e05c['offset']+_0xd6e05c[_0x9b07('0x1a')];var _0x1426cd;if(_0x14feb0>=_0x54c1e6){_0x14feb0=_0x54c1e6;_0x1426cd=0xc8;}else{_0x1426cd=0xce;}_0x25f93a[_0x9b07('0x17')](_0x1426cd);return _0x25f93a[_0x9b07('0x1c')](_0x9b07('0x1d'),_0x7852d0+'-'+_0x14feb0+'/'+_0x54c1e6)['json'](_0x57291c);}return null;};}function patchUpdates(_0x1aca8e){return function(_0x2e509d){try{jsonpatch[_0x9b07('0x1e')](_0x2e509d,_0x1aca8e,!![]);}catch(_0x27bf4b){return BPromise[_0x9b07('0x1f')](_0x27bf4b);}return _0x2e509d[_0x9b07('0x20')]();};}function saveUpdates(_0x4603b9,_0xed47fa){return function(_0x52ffb4){if(_0x52ffb4){return _0x52ffb4[_0x9b07('0x21')](_0x4603b9)[_0x9b07('0x22')](function(_0x2b3de5){return _0x2b3de5;});}return null;};}function removeEntity(_0xc58297,_0x2686b7){return function(_0x4ccc48){if(_0x4ccc48){return _0x4ccc48[_0x9b07('0x23')]()[_0x9b07('0x22')](function(){var _0x2a5a5c=_0x4ccc48[_0x9b07('0x24')]({'plain':!![]});var _0xcbe3fe=_0x9b07('0x25');return db[_0x9b07('0x26')][_0x9b07('0x23')]({'where':{'type':_0xcbe3fe,'resourceId':_0x2a5a5c['id']}})[_0x9b07('0x22')](function(){return _0x4ccc48;});})[_0x9b07('0x22')](function(){_0xc58297['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23d90a,_0x212c17){return function(_0x2d3794){if(!_0x2d3794){_0x23d90a[_0x9b07('0x27')](0x194);}return _0x2d3794;};}function handleError(_0x2f71ba,_0x3b8de7){_0x3b8de7=_0x3b8de7||0x1f4;return function(_0x57f01c){logger[_0x9b07('0x28')](_0x57f01c[_0x9b07('0x29')]);if(_0x57f01c[_0x9b07('0x2a')]){delete _0x57f01c[_0x9b07('0x2a')];}_0x2f71ba[_0x9b07('0x17')](_0x3b8de7)[_0x9b07('0x2b')](_0x57f01c);};}exports[_0x9b07('0x2c')]=function(_0x563cd5,_0x334a8a){var _0x5b390d={},_0x4e7209={},_0x4604a1={'count':0x0,'rows':[]};var _0x420c10=_[_0x9b07('0x2d')](db[_0x9b07('0x2e')][_0x9b07('0x2f')],function(_0x2e08c9){return{'name':_0x2e08c9[_0x9b07('0x30')],'type':_0x2e08c9[_0x9b07('0x31')][_0x9b07('0x32')]};});_0x4e7209[_0x9b07('0x33')]=_[_0x9b07('0x2d')](_0x420c10,_0x9b07('0x2a'));_0x4e7209['query']=_[_0x9b07('0x34')](_0x563cd5['query']);_0x4e7209[_0x9b07('0x35')]=_[_0x9b07('0x36')](_0x4e7209[_0x9b07('0x33')],_0x4e7209[_0x9b07('0x37')]);_0x5b390d[_0x9b07('0x38')]=_[_0x9b07('0x36')](_0x4e7209[_0x9b07('0x33')],qs[_0x9b07('0x39')](_0x563cd5[_0x9b07('0x37')][_0x9b07('0x39')]));_0x5b390d[_0x9b07('0x38')]=_0x5b390d[_0x9b07('0x38')][_0x9b07('0x3a')]?_0x5b390d[_0x9b07('0x38')]:_0x4e7209[_0x9b07('0x33')];if(!_0x563cd5[_0x9b07('0x37')][_0x9b07('0x3b')]('nolimit')){_0x5b390d[_0x9b07('0x1a')]=qs['limit'](_0x563cd5[_0x9b07('0x37')][_0x9b07('0x1a')]);_0x5b390d[_0x9b07('0x3c')]=qs[_0x9b07('0x3c')](_0x563cd5[_0x9b07('0x37')][_0x9b07('0x3c')]);}_0x5b390d[_0x9b07('0x3d')]=qs[_0x9b07('0x3e')](_0x563cd5['query'][_0x9b07('0x3e')]);_0x5b390d[_0x9b07('0x3f')]=qs['filters'](_[_0x9b07('0x40')](_0x563cd5[_0x9b07('0x37')],_0x4e7209[_0x9b07('0x35')]),_0x420c10);if(_0x563cd5[_0x9b07('0x37')][_0x9b07('0x41')]){_0x5b390d[_0x9b07('0x3f')]=_['merge'](_0x5b390d[_0x9b07('0x3f')],{'$or':_[_0x9b07('0x2d')](_0x420c10,function(_0x450313){if(_0x450313['type']!=='VIRTUAL'){var _0x511334={};_0x511334[_0x450313[_0x9b07('0x2a')]]={'$like':'%'+_0x563cd5[_0x9b07('0x37')][_0x9b07('0x41')]+'%'};return _0x511334;}})});}_0x5b390d=_[_0x9b07('0x42')]({},_0x5b390d,_0x563cd5[_0x9b07('0x43')]);var _0x1b52ee={'where':_0x5b390d[_0x9b07('0x3f')]};return db[_0x9b07('0x2e')]['count'](_0x1b52ee)[_0x9b07('0x22')](function(_0xe7cfe5){_0x4604a1[_0x9b07('0x1b')]=_0xe7cfe5;if(_0x563cd5[_0x9b07('0x37')]['includeAll']){_0x5b390d[_0x9b07('0x44')]=[{'all':!![]}];}return db['Trigger'][_0x9b07('0x45')](_0x5b390d);})[_0x9b07('0x22')](function(_0x4674ad){_0x4604a1['rows']=_0x4674ad;return _0x4604a1;})['then'](respondWithFilteredResult(_0x334a8a,_0x5b390d))[_0x9b07('0x46')](handleError(_0x334a8a,null));};exports['show']=function(_0x288bad,_0x1d1d14){var _0x5442c0={'raw':![],'where':{'id':_0x288bad[_0x9b07('0x47')]['id']}},_0x313040={};_0x313040['model']=_['keys'](db[_0x9b07('0x2e')]['rawAttributes']);_0x313040[_0x9b07('0x37')]=_[_0x9b07('0x34')](_0x288bad[_0x9b07('0x37')]);_0x313040['filters']=_['intersection'](_0x313040['model'],_0x313040[_0x9b07('0x37')]);_0x5442c0[_0x9b07('0x38')]=_[_0x9b07('0x36')](_0x313040[_0x9b07('0x33')],qs[_0x9b07('0x39')](_0x288bad[_0x9b07('0x37')]['fields']));_0x5442c0[_0x9b07('0x38')]=_0x5442c0[_0x9b07('0x38')][_0x9b07('0x3a')]?_0x5442c0[_0x9b07('0x38')]:_0x313040[_0x9b07('0x33')];if(_0x288bad['query'][_0x9b07('0x48')]){_0x5442c0[_0x9b07('0x44')]=[{'all':!![]}];}_0x5442c0=_[_0x9b07('0x42')]({},_0x5442c0,_0x288bad['options']);return db[_0x9b07('0x2e')][_0x9b07('0x49')](_0x5442c0)['then'](handleEntityNotFound(_0x1d1d14,null))[_0x9b07('0x22')](respondWithResult(_0x1d1d14,null))[_0x9b07('0x46')](handleError(_0x1d1d14,null));};exports[_0x9b07('0x4a')]=function(_0x47f545,_0x12a417){return db[_0x9b07('0x2e')]['create'](_0x47f545[_0x9b07('0x4b')],{})[_0x9b07('0x22')](function(_0x3dcea9){var _0x27f609=_0x47f545[_0x9b07('0x4c')][_0x9b07('0x24')]({'plain':!![]});if(!_0x27f609)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27f609[_0x9b07('0x4d')]===_0x9b07('0x4c')){var _0x42c3d1=_0x3dcea9[_0x9b07('0x24')]({'plain':!![]});var _0x34c163=_0x9b07('0x25');return db[_0x9b07('0x4e')][_0x9b07('0x49')]({'where':{'name':_0x34c163,'userProfileId':_0x27f609['userProfileId']},'raw':!![]})['then'](function(_0x13d03f){if(_0x13d03f&&_0x13d03f[_0x9b07('0x4f')]===0x0){return db[_0x9b07('0x26')][_0x9b07('0x4a')]({'name':_0x42c3d1[_0x9b07('0x2a')],'resourceId':_0x42c3d1['id'],'type':_0x13d03f['name'],'sectionId':_0x13d03f['id']},{})[_0x9b07('0x22')](function(){return _0x3dcea9;});}else{return _0x3dcea9;}})[_0x9b07('0x46')](function(_0xbf19ef){logger['error'](_0x9b07('0x50'),_0xbf19ef);throw _0xbf19ef;});}return _0x3dcea9;})['then'](respondWithResult(_0x12a417,0xc9))[_0x9b07('0x46')](handleError(_0x12a417,null));};exports[_0x9b07('0x21')]=function(_0x44b073,_0x3fcfda){if(_0x44b073[_0x9b07('0x4b')]['id']){delete _0x44b073[_0x9b07('0x4b')]['id'];}return db[_0x9b07('0x2e')][_0x9b07('0x49')]({'where':{'id':_0x44b073[_0x9b07('0x47')]['id']}})[_0x9b07('0x22')](handleEntityNotFound(_0x3fcfda,null))[_0x9b07('0x22')](saveUpdates(_0x44b073['body'],null))['then'](respondWithResult(_0x3fcfda,null))['catch'](handleError(_0x3fcfda,null));};exports[_0x9b07('0x23')]=function(_0x36ec5f,_0xf5b41b){return db['Trigger'][_0x9b07('0x49')]({'where':{'id':_0x36ec5f['params']['id']}})['then'](handleEntityNotFound(_0xf5b41b,null))['then'](removeEntity(_0xf5b41b,null))[_0x9b07('0x46')](handleError(_0xf5b41b,null));};exports[_0x9b07('0x51')]=function(_0x5ee374,_0x29e5da,_0x5d93a3){if(_0x5ee374[_0x9b07('0x4b')]['id']){delete _0x5ee374[_0x9b07('0x4b')]['id'];}return db['Trigger'][_0x9b07('0x49')]({'where':{'id':_0x5ee374[_0x9b07('0x47')]['id']}})[_0x9b07('0x22')](handleEntityNotFound(_0x29e5da,null))[_0x9b07('0x22')](function(_0x741ee6){if(_0x741ee6){_0x5ee374[_0x9b07('0x4b')]['TriggerAllId']=_0x741ee6['id'];return db[_0x9b07('0x52')][_0x9b07('0x4a')](_0x5ee374[_0x9b07('0x4b')]);}})[_0x9b07('0x22')](respondWithResult(_0x29e5da,null))['catch'](handleError(_0x29e5da,null));};exports[_0x9b07('0x53')]=function(_0x41921a,_0x3e49ad,_0x3b90ac){if(_0x41921a[_0x9b07('0x4b')]['id']){delete _0x41921a[_0x9b07('0x4b')]['id'];}return db[_0x9b07('0x2e')]['find']({'where':{'id':_0x41921a[_0x9b07('0x47')]['id']}})[_0x9b07('0x22')](handleEntityNotFound(_0x3e49ad,null))[_0x9b07('0x22')](function(_0x5c3067){if(_0x5c3067){_0x41921a[_0x9b07('0x4b')][_0x9b07('0x54')]=_0x5c3067['id'];return db[_0x9b07('0x52')][_0x9b07('0x4a')](_0x41921a['body']);}})['then'](respondWithResult(_0x3e49ad,null))['catch'](handleError(_0x3e49ad,null));};exports['getAllConditions']=function(_0x2dbca1,_0x3d4959,_0x3f4cc2){var _0x178ba2={};var _0xc0d3fb={};var _0x481dcc;var _0xa7ccea;return db[_0x9b07('0x2e')][_0x9b07('0x55')]({'where':{'id':_0x2dbca1[_0x9b07('0x47')]['id']}})[_0x9b07('0x22')](handleEntityNotFound(_0x3d4959,null))[_0x9b07('0x22')](function(_0x103f8d){if(_0x103f8d){_0x481dcc=_0x103f8d;_0xc0d3fb[_0x9b07('0x33')]=_[_0x9b07('0x34')](db[_0x9b07('0x52')][_0x9b07('0x2f')]);_0xc0d3fb[_0x9b07('0x37')]=_['keys'](_0x2dbca1[_0x9b07('0x37')]);_0xc0d3fb['filters']=_['intersection'](_0xc0d3fb[_0x9b07('0x33')],_0xc0d3fb[_0x9b07('0x37')]);_0x178ba2[_0x9b07('0x38')]=_[_0x9b07('0x36')](_0xc0d3fb['model'],qs[_0x9b07('0x39')](_0x2dbca1[_0x9b07('0x37')][_0x9b07('0x39')]));_0x178ba2[_0x9b07('0x38')]=_0x178ba2[_0x9b07('0x38')][_0x9b07('0x3a')]?_0x178ba2[_0x9b07('0x38')]:_0xc0d3fb[_0x9b07('0x33')];_0x178ba2[_0x9b07('0x3d')]=qs['sort'](_0x2dbca1[_0x9b07('0x37')][_0x9b07('0x3e')]);_0x178ba2[_0x9b07('0x3f')]=qs[_0x9b07('0x35')](_[_0x9b07('0x40')](_0x2dbca1['query'],_0xc0d3fb[_0x9b07('0x35')]));if(_0x2dbca1['query'][_0x9b07('0x41')]){_0x178ba2[_0x9b07('0x3f')]=_[_0x9b07('0x42')](_0x178ba2[_0x9b07('0x3f')],{'$or':_[_0x9b07('0x2d')](_0x178ba2[_0x9b07('0x38')],function(_0x5169b2){var _0x1ef4a3={};_0x1ef4a3[_0x5169b2]={'$like':'%'+_0x2dbca1['query']['filter']+'%'};return _0x1ef4a3;})});}_0x178ba2=_[_0x9b07('0x42')]({},_0x178ba2,_0x2dbca1[_0x9b07('0x43')]);return _0x481dcc[_0x9b07('0x56')](_0x178ba2);}})[_0x9b07('0x22')](function(_0x25f7df){if(_0x25f7df){_0xa7ccea=_0x25f7df[_0x9b07('0x3a')];if(!_0x2dbca1[_0x9b07('0x37')][_0x9b07('0x3b')](_0x9b07('0x57'))){_0x178ba2[_0x9b07('0x1a')]=qs[_0x9b07('0x1a')](_0x2dbca1[_0x9b07('0x37')]['limit']);_0x178ba2[_0x9b07('0x3c')]=qs[_0x9b07('0x3c')](_0x2dbca1[_0x9b07('0x37')][_0x9b07('0x3c')]);}return _0x481dcc['getAllConditions'](_0x178ba2);}})['then'](function(_0x316ba9){if(_0x316ba9){return _0x316ba9?{'count':_0xa7ccea,'rows':_0x316ba9}:null;}})['then'](respondWithResult(_0x3d4959,null))[_0x9b07('0x46')](handleError(_0x3d4959,null));};exports[_0x9b07('0x58')]=function(_0x16eef1,_0x28b3c3,_0x370e17){var _0x501880={};var _0x31f831={};var _0xd3d29a;var _0x541e01;return db[_0x9b07('0x2e')][_0x9b07('0x55')]({'where':{'id':_0x16eef1[_0x9b07('0x47')]['id']}})[_0x9b07('0x22')](handleEntityNotFound(_0x28b3c3,null))[_0x9b07('0x22')](function(_0x55cf5c){if(_0x55cf5c){_0xd3d29a=_0x55cf5c;_0x31f831[_0x9b07('0x33')]=_[_0x9b07('0x34')](db['Condition'][_0x9b07('0x2f')]);_0x31f831['query']=_['keys'](_0x16eef1['query']);_0x31f831[_0x9b07('0x35')]=_[_0x9b07('0x36')](_0x31f831[_0x9b07('0x33')],_0x31f831[_0x9b07('0x37')]);_0x501880[_0x9b07('0x38')]=_['intersection'](_0x31f831['model'],qs[_0x9b07('0x39')](_0x16eef1[_0x9b07('0x37')][_0x9b07('0x39')]));_0x501880[_0x9b07('0x38')]=_0x501880[_0x9b07('0x38')][_0x9b07('0x3a')]?_0x501880[_0x9b07('0x38')]:_0x31f831[_0x9b07('0x33')];_0x501880[_0x9b07('0x3d')]=qs[_0x9b07('0x3e')](_0x16eef1[_0x9b07('0x37')][_0x9b07('0x3e')]);_0x501880[_0x9b07('0x3f')]=qs[_0x9b07('0x35')](_[_0x9b07('0x40')](_0x16eef1[_0x9b07('0x37')],_0x31f831[_0x9b07('0x35')]));if(_0x16eef1[_0x9b07('0x37')]['filter']){_0x501880['where']=_[_0x9b07('0x42')](_0x501880['where'],{'$or':_[_0x9b07('0x2d')](_0x501880['attributes'],function(_0x59d3f2){var _0x5fada7={};_0x5fada7[_0x59d3f2]={'$like':'%'+_0x16eef1[_0x9b07('0x37')][_0x9b07('0x41')]+'%'};return _0x5fada7;})});}_0x501880=_[_0x9b07('0x42')]({},_0x501880,_0x16eef1[_0x9b07('0x43')]);return _0xd3d29a['getAnyConditions'](_0x501880);}})[_0x9b07('0x22')](function(_0x27e741){if(_0x27e741){_0x541e01=_0x27e741[_0x9b07('0x3a')];if(!_0x16eef1['query'][_0x9b07('0x3b')](_0x9b07('0x57'))){_0x501880[_0x9b07('0x1a')]=qs['limit'](_0x16eef1[_0x9b07('0x37')][_0x9b07('0x1a')]);_0x501880['offset']=qs['offset'](_0x16eef1['query'][_0x9b07('0x3c')]);}return _0xd3d29a[_0x9b07('0x58')](_0x501880);}})['then'](function(_0x22adf1){if(_0x22adf1){return _0x22adf1?{'count':_0x541e01,'rows':_0x22adf1}:null;}})['then'](respondWithResult(_0x28b3c3,null))[_0x9b07('0x46')](handleError(_0x28b3c3,null));};exports[_0x9b07('0x59')]=function(_0x306bf5,_0x559db8,_0x4c9a47){if(_0x306bf5['body']['id']){delete _0x306bf5['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x306bf5[_0x9b07('0x47')]['id']}})[_0x9b07('0x22')](handleEntityNotFound(_0x559db8,null))[_0x9b07('0x22')](function(_0x36f5ea){if(_0x36f5ea){_0x306bf5['body']['TriggerId']=_0x36f5ea['id'];return db[_0x9b07('0x5a')][_0x9b07('0x4a')](_0x306bf5[_0x9b07('0x4b')]);}})[_0x9b07('0x22')](respondWithResult(_0x559db8,null))[_0x9b07('0x46')](handleError(_0x559db8,null));};exports[_0x9b07('0x5b')]=function(_0x4d03f1,_0x5d36ef,_0x4fd52c){var _0x47bb8c={};var _0x3af537={};var _0x164afe;var _0x437c3d;return db[_0x9b07('0x2e')][_0x9b07('0x55')]({'where':{'id':_0x4d03f1[_0x9b07('0x47')]['id']}})[_0x9b07('0x22')](handleEntityNotFound(_0x5d36ef,null))[_0x9b07('0x22')](function(_0x3d52ac){if(_0x3d52ac){_0x164afe=_0x3d52ac;_0x3af537['model']=_['keys'](db['Action'][_0x9b07('0x2f')]);_0x3af537['query']=_['keys'](_0x4d03f1[_0x9b07('0x37')]);_0x3af537[_0x9b07('0x35')]=_[_0x9b07('0x36')](_0x3af537['model'],_0x3af537[_0x9b07('0x37')]);_0x47bb8c[_0x9b07('0x38')]=_[_0x9b07('0x36')](_0x3af537[_0x9b07('0x33')],qs[_0x9b07('0x39')](_0x4d03f1[_0x9b07('0x37')][_0x9b07('0x39')]));_0x47bb8c[_0x9b07('0x38')]=_0x47bb8c['attributes'][_0x9b07('0x3a')]?_0x47bb8c[_0x9b07('0x38')]:_0x3af537['model'];_0x47bb8c['order']=qs[_0x9b07('0x3e')](_0x4d03f1['query'][_0x9b07('0x3e')]);_0x47bb8c['where']=qs[_0x9b07('0x35')](_[_0x9b07('0x40')](_0x4d03f1['query'],_0x3af537[_0x9b07('0x35')]));if(_0x4d03f1[_0x9b07('0x37')]['filter']){_0x47bb8c['where']=_[_0x9b07('0x42')](_0x47bb8c[_0x9b07('0x3f')],{'$or':_[_0x9b07('0x2d')](_0x47bb8c[_0x9b07('0x38')],function(_0x54d14a){var _0xccd059={};_0xccd059[_0x54d14a]={'$like':'%'+_0x4d03f1[_0x9b07('0x37')][_0x9b07('0x41')]+'%'};return _0xccd059;})});}_0x47bb8c=_[_0x9b07('0x42')]({},_0x47bb8c,_0x4d03f1[_0x9b07('0x43')]);return _0x164afe[_0x9b07('0x5b')](_0x47bb8c);}})[_0x9b07('0x22')](function(_0x2ecb25){if(_0x2ecb25){_0x437c3d=_0x2ecb25[_0x9b07('0x3a')];if(!_0x4d03f1[_0x9b07('0x37')][_0x9b07('0x3b')]('nolimit')){_0x47bb8c[_0x9b07('0x1a')]=qs[_0x9b07('0x1a')](_0x4d03f1[_0x9b07('0x37')][_0x9b07('0x1a')]);_0x47bb8c[_0x9b07('0x3c')]=qs[_0x9b07('0x3c')](_0x4d03f1[_0x9b07('0x37')][_0x9b07('0x3c')]);}return _0x164afe[_0x9b07('0x5b')](_0x47bb8c);}})[_0x9b07('0x22')](function(_0x204799){if(_0x204799){return _0x204799?{'count':_0x437c3d,'rows':_0x204799}:null;}})['then'](respondWithResult(_0x5d36ef,null))['catch'](handleError(_0x5d36ef,null));}; \ No newline at end of file +var _0x113b=['status','set','Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','Trigger','includeAll','include','rows','catch','show','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','length','order','pick','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','json','offset','undefined','count','limit'];(function(_0x5dbb3e,_0x4b494d){var _0x138d23=function(_0x414fb4){while(--_0x414fb4){_0x5dbb3e['push'](_0x5dbb3e['shift']());}};_0x138d23(++_0x4b494d);}(_0x113b,0x167));var _0xb113=function(_0x355235,_0x5517f9){_0x355235=_0x355235-0x0;var _0x104ea0=_0x113b[_0x355235];return _0x104ea0;};'use strict';var emlformat=require(_0xb113('0x0'));var rimraf=require(_0xb113('0x1'));var zipdir=require(_0xb113('0x2'));var jsonpatch=require(_0xb113('0x3'));var rp=require(_0xb113('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb113('0x5'));var util=require('util');var path=require(_0xb113('0x6'));var sox=require(_0xb113('0x7'));var csv=require(_0xb113('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb113('0x9'));var _=require(_0xb113('0xa'));var squel=require(_0xb113('0xb'));var crypto=require(_0xb113('0xc'));var jsforce=require(_0xb113('0xd'));var deskjs=require(_0xb113('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb113('0xf'));var authService=require(_0xb113('0x10'));var qs=require(_0xb113('0x11'));var as=require(_0xb113('0x12'));var hardwareService=require(_0xb113('0x13'));var logger=require('../../config/logger')(_0xb113('0x14'));var utils=require(_0xb113('0x15'));var config=require(_0xb113('0x16'));var licenseUtil=require(_0xb113('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6a55b6,_0x2e128a){_0x2e128a=_0x2e128a||0xcc;return function(_0x2bf932){if(_0x2bf932){return _0x6a55b6['sendStatus'](_0x2e128a);}return _0x6a55b6['status'](_0x2e128a)['end']();};}function respondWithResult(_0x38cac1,_0x2dfa2b){_0x2dfa2b=_0x2dfa2b||0xc8;return function(_0x4ca74d){if(_0x4ca74d){return _0x38cac1['status'](_0x2dfa2b)[_0xb113('0x18')](_0x4ca74d);}};}function respondWithFilteredResult(_0x4d6a57,_0x396266){return function(_0x12c248){if(_0x12c248){var _0x1df18a=typeof _0x396266[_0xb113('0x19')]===_0xb113('0x1a')&&typeof _0x396266['limit']===_0xb113('0x1a');var _0x2aede8=_0x12c248[_0xb113('0x1b')];var _0x4041da=_0x1df18a?0x0:_0x396266[_0xb113('0x19')];var _0xc25049=_0x1df18a?_0x12c248[_0xb113('0x1b')]:_0x396266['offset']+_0x396266[_0xb113('0x1c')];var _0x2565f9;if(_0xc25049>=_0x2aede8){_0xc25049=_0x2aede8;_0x2565f9=0xc8;}else{_0x2565f9=0xce;}_0x4d6a57[_0xb113('0x1d')](_0x2565f9);return _0x4d6a57[_0xb113('0x1e')](_0xb113('0x1f'),_0x4041da+'-'+_0xc25049+'/'+_0x2aede8)['json'](_0x12c248);}return null;};}function patchUpdates(_0x5ec400){return function(_0x105cc9){try{jsonpatch[_0xb113('0x20')](_0x105cc9,_0x5ec400,!![]);}catch(_0xca1ee1){return BPromise[_0xb113('0x21')](_0xca1ee1);}return _0x105cc9[_0xb113('0x22')]();};}function saveUpdates(_0x2e579d,_0x5341d8){return function(_0x2bf519){if(_0x2bf519){return _0x2bf519[_0xb113('0x23')](_0x2e579d)[_0xb113('0x24')](function(_0x187656){return _0x187656;});}return null;};}function removeEntity(_0x3ed51b,_0x1aec59){return function(_0xd5e810){if(_0xd5e810){return _0xd5e810[_0xb113('0x25')]()['then'](function(){var _0x288007=_0xd5e810[_0xb113('0x26')]({'plain':!![]});var _0x3c805b='Triggers';return db['UserProfileResource'][_0xb113('0x25')]({'where':{'type':_0x3c805b,'resourceId':_0x288007['id']}})[_0xb113('0x24')](function(){return _0xd5e810;});})[_0xb113('0x24')](function(){_0x3ed51b[_0xb113('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c07e4,_0x37d588){return function(_0x376655){if(!_0x376655){_0x2c07e4[_0xb113('0x27')](0x194);}return _0x376655;};}function handleError(_0x43fab8,_0x41a9f1){_0x41a9f1=_0x41a9f1||0x1f4;return function(_0x439821){logger[_0xb113('0x28')](_0x439821[_0xb113('0x29')]);if(_0x439821[_0xb113('0x2a')]){delete _0x439821['name'];}_0x43fab8[_0xb113('0x1d')](_0x41a9f1)['send'](_0x439821);};}exports[_0xb113('0x2b')]=function(_0x3999c9,_0x2efb56){var _0x15e107={},_0x24fff4={},_0x1dc3d7={'count':0x0,'rows':[]};var _0x414bc6=_['map'](db['Trigger'][_0xb113('0x2c')],function(_0x475087){return{'name':_0x475087[_0xb113('0x2d')],'type':_0x475087[_0xb113('0x2e')][_0xb113('0x2f')]};});_0x24fff4[_0xb113('0x30')]=_[_0xb113('0x31')](_0x414bc6,_0xb113('0x2a'));_0x24fff4[_0xb113('0x32')]=_[_0xb113('0x33')](_0x3999c9[_0xb113('0x32')]);_0x24fff4[_0xb113('0x34')]=_[_0xb113('0x35')](_0x24fff4[_0xb113('0x30')],_0x24fff4['query']);_0x15e107['attributes']=_[_0xb113('0x35')](_0x24fff4[_0xb113('0x30')],qs[_0xb113('0x36')](_0x3999c9[_0xb113('0x32')]['fields']));_0x15e107[_0xb113('0x37')]=_0x15e107['attributes']['length']?_0x15e107[_0xb113('0x37')]:_0x24fff4[_0xb113('0x30')];if(!_0x3999c9[_0xb113('0x32')][_0xb113('0x38')]('nolimit')){_0x15e107[_0xb113('0x1c')]=qs[_0xb113('0x1c')](_0x3999c9[_0xb113('0x32')][_0xb113('0x1c')]);_0x15e107[_0xb113('0x19')]=qs[_0xb113('0x19')](_0x3999c9[_0xb113('0x32')][_0xb113('0x19')]);}_0x15e107['order']=qs[_0xb113('0x39')](_0x3999c9[_0xb113('0x32')][_0xb113('0x39')]);_0x15e107[_0xb113('0x3a')]=qs['filters'](_['pick'](_0x3999c9[_0xb113('0x32')],_0x24fff4[_0xb113('0x34')]),_0x414bc6);if(_0x3999c9[_0xb113('0x32')][_0xb113('0x3b')]){_0x15e107[_0xb113('0x3a')]=_[_0xb113('0x3c')](_0x15e107[_0xb113('0x3a')],{'$or':_[_0xb113('0x31')](_0x414bc6,function(_0x1ed37c){if(_0x1ed37c[_0xb113('0x2e')]!==_0xb113('0x3d')){var _0x13bcef={};_0x13bcef[_0x1ed37c[_0xb113('0x2a')]]={'$like':'%'+_0x3999c9[_0xb113('0x32')][_0xb113('0x3b')]+'%'};return _0x13bcef;}})});}_0x15e107=_[_0xb113('0x3c')]({},_0x15e107,_0x3999c9['options']);var _0x3a1594={'where':_0x15e107[_0xb113('0x3a')]};return db[_0xb113('0x3e')][_0xb113('0x1b')](_0x3a1594)['then'](function(_0x472b09){_0x1dc3d7[_0xb113('0x1b')]=_0x472b09;if(_0x3999c9[_0xb113('0x32')][_0xb113('0x3f')]){_0x15e107[_0xb113('0x40')]=[{'all':!![]}];}return db[_0xb113('0x3e')]['findAll'](_0x15e107);})['then'](function(_0x43d82d){_0x1dc3d7[_0xb113('0x41')]=_0x43d82d;return _0x1dc3d7;})['then'](respondWithFilteredResult(_0x2efb56,_0x15e107))[_0xb113('0x42')](handleError(_0x2efb56,null));};exports[_0xb113('0x43')]=function(_0x402f4b,_0x101465){var _0x56a159={'raw':![],'where':{'id':_0x402f4b['params']['id']}},_0x4d0c13={};_0x4d0c13[_0xb113('0x30')]=_['keys'](db[_0xb113('0x3e')]['rawAttributes']);_0x4d0c13[_0xb113('0x32')]=_[_0xb113('0x33')](_0x402f4b[_0xb113('0x32')]);_0x4d0c13['filters']=_[_0xb113('0x35')](_0x4d0c13[_0xb113('0x30')],_0x4d0c13['query']);_0x56a159[_0xb113('0x37')]=_['intersection'](_0x4d0c13['model'],qs[_0xb113('0x36')](_0x402f4b[_0xb113('0x32')]['fields']));_0x56a159[_0xb113('0x37')]=_0x56a159[_0xb113('0x37')]['length']?_0x56a159[_0xb113('0x37')]:_0x4d0c13[_0xb113('0x30')];if(_0x402f4b[_0xb113('0x32')]['includeAll']){_0x56a159[_0xb113('0x40')]=[{'all':!![]}];}_0x56a159=_['merge']({},_0x56a159,_0x402f4b[_0xb113('0x44')]);return db['Trigger']['find'](_0x56a159)[_0xb113('0x24')](handleEntityNotFound(_0x101465,null))[_0xb113('0x24')](respondWithResult(_0x101465,null))['catch'](handleError(_0x101465,null));};exports['create']=function(_0x41ae0a,_0x2febe5){return db[_0xb113('0x3e')][_0xb113('0x45')](_0x41ae0a['body'],{})[_0xb113('0x24')](function(_0x3b65fa){var _0x20f723=_0x41ae0a[_0xb113('0x46')][_0xb113('0x26')]({'plain':!![]});if(!_0x20f723)throw new Error(_0xb113('0x47'));if(_0x20f723[_0xb113('0x48')]===_0xb113('0x46')){var _0x46699b=_0x3b65fa[_0xb113('0x26')]({'plain':!![]});var _0x56fcc9=_0xb113('0x49');return db[_0xb113('0x4a')][_0xb113('0x4b')]({'where':{'name':_0x56fcc9,'userProfileId':_0x20f723[_0xb113('0x4c')]},'raw':!![]})[_0xb113('0x24')](function(_0x48ae84){if(_0x48ae84&&_0x48ae84[_0xb113('0x4d')]===0x0){return db['UserProfileResource'][_0xb113('0x45')]({'name':_0x46699b['name'],'resourceId':_0x46699b['id'],'type':_0x48ae84[_0xb113('0x2a')],'sectionId':_0x48ae84['id']},{})['then'](function(){return _0x3b65fa;});}else{return _0x3b65fa;}})[_0xb113('0x42')](function(_0x42cb4a){logger[_0xb113('0x28')](_0xb113('0x4e'),_0x42cb4a);throw _0x42cb4a;});}return _0x3b65fa;})[_0xb113('0x24')](respondWithResult(_0x2febe5,0xc9))[_0xb113('0x42')](handleError(_0x2febe5,null));};exports[_0xb113('0x23')]=function(_0x2c08f0,_0x1562be){if(_0x2c08f0[_0xb113('0x4f')]['id']){delete _0x2c08f0[_0xb113('0x4f')]['id'];}return db['Trigger'][_0xb113('0x4b')]({'where':{'id':_0x2c08f0[_0xb113('0x50')]['id']}})[_0xb113('0x24')](handleEntityNotFound(_0x1562be,null))['then'](saveUpdates(_0x2c08f0[_0xb113('0x4f')],null))[_0xb113('0x24')](respondWithResult(_0x1562be,null))[_0xb113('0x42')](handleError(_0x1562be,null));};exports[_0xb113('0x25')]=function(_0x55d9e4,_0x5b9ccf){return db[_0xb113('0x3e')][_0xb113('0x4b')]({'where':{'id':_0x55d9e4[_0xb113('0x50')]['id']}})[_0xb113('0x24')](handleEntityNotFound(_0x5b9ccf,null))['then'](removeEntity(_0x5b9ccf,null))[_0xb113('0x42')](handleError(_0x5b9ccf,null));};exports[_0xb113('0x51')]=function(_0x26b840,_0x4e7c61,_0x43ff8a){if(_0x26b840['body']['id']){delete _0x26b840[_0xb113('0x4f')]['id'];}return db['Trigger']['find']({'where':{'id':_0x26b840['params']['id']}})[_0xb113('0x24')](handleEntityNotFound(_0x4e7c61,null))[_0xb113('0x24')](function(_0x33b841){if(_0x33b841){_0x26b840[_0xb113('0x4f')][_0xb113('0x52')]=_0x33b841['id'];return db[_0xb113('0x53')]['create'](_0x26b840['body']);}})[_0xb113('0x24')](respondWithResult(_0x4e7c61,null))['catch'](handleError(_0x4e7c61,null));};exports[_0xb113('0x54')]=function(_0x3aa9e5,_0x1374a5,_0x171165){if(_0x3aa9e5['body']['id']){delete _0x3aa9e5[_0xb113('0x4f')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3aa9e5[_0xb113('0x50')]['id']}})[_0xb113('0x24')](handleEntityNotFound(_0x1374a5,null))[_0xb113('0x24')](function(_0x31a4df){if(_0x31a4df){_0x3aa9e5[_0xb113('0x4f')][_0xb113('0x55')]=_0x31a4df['id'];return db[_0xb113('0x53')]['create'](_0x3aa9e5[_0xb113('0x4f')]);}})[_0xb113('0x24')](respondWithResult(_0x1374a5,null))[_0xb113('0x42')](handleError(_0x1374a5,null));};exports[_0xb113('0x56')]=function(_0x4246f1,_0xc9ead8,_0x4b9004){var _0x5c650a={};var _0x54e6ba={};var _0x4c5e86;var _0x103257;return db[_0xb113('0x3e')][_0xb113('0x57')]({'where':{'id':_0x4246f1['params']['id']}})[_0xb113('0x24')](handleEntityNotFound(_0xc9ead8,null))['then'](function(_0x34deab){if(_0x34deab){_0x4c5e86=_0x34deab;_0x54e6ba[_0xb113('0x30')]=_[_0xb113('0x33')](db[_0xb113('0x53')]['rawAttributes']);_0x54e6ba[_0xb113('0x32')]=_[_0xb113('0x33')](_0x4246f1[_0xb113('0x32')]);_0x54e6ba['filters']=_['intersection'](_0x54e6ba[_0xb113('0x30')],_0x54e6ba['query']);_0x5c650a[_0xb113('0x37')]=_[_0xb113('0x35')](_0x54e6ba[_0xb113('0x30')],qs[_0xb113('0x36')](_0x4246f1[_0xb113('0x32')][_0xb113('0x36')]));_0x5c650a['attributes']=_0x5c650a[_0xb113('0x37')][_0xb113('0x58')]?_0x5c650a[_0xb113('0x37')]:_0x54e6ba[_0xb113('0x30')];_0x5c650a[_0xb113('0x59')]=qs[_0xb113('0x39')](_0x4246f1[_0xb113('0x32')]['sort']);_0x5c650a[_0xb113('0x3a')]=qs[_0xb113('0x34')](_[_0xb113('0x5a')](_0x4246f1[_0xb113('0x32')],_0x54e6ba[_0xb113('0x34')]));if(_0x4246f1[_0xb113('0x32')][_0xb113('0x3b')]){_0x5c650a[_0xb113('0x3a')]=_[_0xb113('0x3c')](_0x5c650a[_0xb113('0x3a')],{'$or':_['map'](_0x5c650a[_0xb113('0x37')],function(_0x44c9ab){var _0x2fc12e={};_0x2fc12e[_0x44c9ab]={'$like':'%'+_0x4246f1['query'][_0xb113('0x3b')]+'%'};return _0x2fc12e;})});}_0x5c650a=_[_0xb113('0x3c')]({},_0x5c650a,_0x4246f1[_0xb113('0x44')]);return _0x4c5e86[_0xb113('0x56')](_0x5c650a);}})[_0xb113('0x24')](function(_0x1afeb8){if(_0x1afeb8){_0x103257=_0x1afeb8[_0xb113('0x58')];if(!_0x4246f1[_0xb113('0x32')]['hasOwnProperty'](_0xb113('0x5b'))){_0x5c650a[_0xb113('0x1c')]=qs[_0xb113('0x1c')](_0x4246f1['query'][_0xb113('0x1c')]);_0x5c650a[_0xb113('0x19')]=qs['offset'](_0x4246f1[_0xb113('0x32')]['offset']);}return _0x4c5e86['getAllConditions'](_0x5c650a);}})[_0xb113('0x24')](function(_0x29f315){if(_0x29f315){return _0x29f315?{'count':_0x103257,'rows':_0x29f315}:null;}})[_0xb113('0x24')](respondWithResult(_0xc9ead8,null))[_0xb113('0x42')](handleError(_0xc9ead8,null));};exports[_0xb113('0x5c')]=function(_0x5b572d,_0x1f8efa,_0x3ddce3){var _0x4976ee={};var _0x113fd5={};var _0x134b42;var _0x50b40e;return db['Trigger'][_0xb113('0x57')]({'where':{'id':_0x5b572d[_0xb113('0x50')]['id']}})[_0xb113('0x24')](handleEntityNotFound(_0x1f8efa,null))[_0xb113('0x24')](function(_0x4e6139){if(_0x4e6139){_0x134b42=_0x4e6139;_0x113fd5[_0xb113('0x30')]=_[_0xb113('0x33')](db['Condition']['rawAttributes']);_0x113fd5[_0xb113('0x32')]=_[_0xb113('0x33')](_0x5b572d[_0xb113('0x32')]);_0x113fd5['filters']=_[_0xb113('0x35')](_0x113fd5[_0xb113('0x30')],_0x113fd5['query']);_0x4976ee[_0xb113('0x37')]=_[_0xb113('0x35')](_0x113fd5[_0xb113('0x30')],qs[_0xb113('0x36')](_0x5b572d[_0xb113('0x32')][_0xb113('0x36')]));_0x4976ee[_0xb113('0x37')]=_0x4976ee[_0xb113('0x37')][_0xb113('0x58')]?_0x4976ee[_0xb113('0x37')]:_0x113fd5[_0xb113('0x30')];_0x4976ee['order']=qs['sort'](_0x5b572d[_0xb113('0x32')][_0xb113('0x39')]);_0x4976ee['where']=qs[_0xb113('0x34')](_[_0xb113('0x5a')](_0x5b572d[_0xb113('0x32')],_0x113fd5[_0xb113('0x34')]));if(_0x5b572d[_0xb113('0x32')][_0xb113('0x3b')]){_0x4976ee[_0xb113('0x3a')]=_['merge'](_0x4976ee[_0xb113('0x3a')],{'$or':_[_0xb113('0x31')](_0x4976ee[_0xb113('0x37')],function(_0x34e381){var _0x53cff3={};_0x53cff3[_0x34e381]={'$like':'%'+_0x5b572d[_0xb113('0x32')][_0xb113('0x3b')]+'%'};return _0x53cff3;})});}_0x4976ee=_[_0xb113('0x3c')]({},_0x4976ee,_0x5b572d[_0xb113('0x44')]);return _0x134b42[_0xb113('0x5c')](_0x4976ee);}})[_0xb113('0x24')](function(_0x459cde){if(_0x459cde){_0x50b40e=_0x459cde[_0xb113('0x58')];if(!_0x5b572d[_0xb113('0x32')][_0xb113('0x38')](_0xb113('0x5b'))){_0x4976ee[_0xb113('0x1c')]=qs[_0xb113('0x1c')](_0x5b572d['query']['limit']);_0x4976ee[_0xb113('0x19')]=qs[_0xb113('0x19')](_0x5b572d[_0xb113('0x32')]['offset']);}return _0x134b42[_0xb113('0x5c')](_0x4976ee);}})['then'](function(_0x4a921c){if(_0x4a921c){return _0x4a921c?{'count':_0x50b40e,'rows':_0x4a921c}:null;}})[_0xb113('0x24')](respondWithResult(_0x1f8efa,null))['catch'](handleError(_0x1f8efa,null));};exports[_0xb113('0x5d')]=function(_0x586421,_0xf27809,_0x25cf54){if(_0x586421[_0xb113('0x4f')]['id']){delete _0x586421[_0xb113('0x4f')]['id'];}return db[_0xb113('0x3e')][_0xb113('0x4b')]({'where':{'id':_0x586421[_0xb113('0x50')]['id']}})[_0xb113('0x24')](handleEntityNotFound(_0xf27809,null))['then'](function(_0x400798){if(_0x400798){_0x586421['body'][_0xb113('0x5e')]=_0x400798['id'];return db[_0xb113('0x5f')][_0xb113('0x45')](_0x586421[_0xb113('0x4f')]);}})[_0xb113('0x24')](respondWithResult(_0xf27809,null))[_0xb113('0x42')](handleError(_0xf27809,null));};exports[_0xb113('0x60')]=function(_0x315c5e,_0x1673b6,_0x5715dc){var _0x357f36={};var _0x441cc9={};var _0x1f6a18;var _0x5eee84;return db[_0xb113('0x3e')][_0xb113('0x57')]({'where':{'id':_0x315c5e[_0xb113('0x50')]['id']}})[_0xb113('0x24')](handleEntityNotFound(_0x1673b6,null))[_0xb113('0x24')](function(_0x263e77){if(_0x263e77){_0x1f6a18=_0x263e77;_0x441cc9[_0xb113('0x30')]=_[_0xb113('0x33')](db['Action'][_0xb113('0x2c')]);_0x441cc9[_0xb113('0x32')]=_[_0xb113('0x33')](_0x315c5e[_0xb113('0x32')]);_0x441cc9[_0xb113('0x34')]=_['intersection'](_0x441cc9[_0xb113('0x30')],_0x441cc9[_0xb113('0x32')]);_0x357f36[_0xb113('0x37')]=_['intersection'](_0x441cc9[_0xb113('0x30')],qs[_0xb113('0x36')](_0x315c5e[_0xb113('0x32')]['fields']));_0x357f36[_0xb113('0x37')]=_0x357f36[_0xb113('0x37')]['length']?_0x357f36[_0xb113('0x37')]:_0x441cc9[_0xb113('0x30')];_0x357f36[_0xb113('0x59')]=qs[_0xb113('0x39')](_0x315c5e[_0xb113('0x32')]['sort']);_0x357f36[_0xb113('0x3a')]=qs[_0xb113('0x34')](_[_0xb113('0x5a')](_0x315c5e[_0xb113('0x32')],_0x441cc9[_0xb113('0x34')]));if(_0x315c5e[_0xb113('0x32')][_0xb113('0x3b')]){_0x357f36['where']=_[_0xb113('0x3c')](_0x357f36[_0xb113('0x3a')],{'$or':_[_0xb113('0x31')](_0x357f36['attributes'],function(_0x27133e){var _0x4fe143={};_0x4fe143[_0x27133e]={'$like':'%'+_0x315c5e[_0xb113('0x32')][_0xb113('0x3b')]+'%'};return _0x4fe143;})});}_0x357f36=_[_0xb113('0x3c')]({},_0x357f36,_0x315c5e['options']);return _0x1f6a18[_0xb113('0x60')](_0x357f36);}})[_0xb113('0x24')](function(_0x5b4812){if(_0x5b4812){_0x5eee84=_0x5b4812[_0xb113('0x58')];if(!_0x315c5e[_0xb113('0x32')][_0xb113('0x38')](_0xb113('0x5b'))){_0x357f36[_0xb113('0x1c')]=qs[_0xb113('0x1c')](_0x315c5e['query'][_0xb113('0x1c')]);_0x357f36[_0xb113('0x19')]=qs[_0xb113('0x19')](_0x315c5e['query']['offset']);}return _0x1f6a18[_0xb113('0x60')](_0x357f36);}})['then'](function(_0x652eca){if(_0x652eca){return _0x652eca?{'count':_0x5eee84,'rows':_0x652eca}:null;}})['then'](respondWithResult(_0x1673b6,null))[_0xb113('0x42')](handleError(_0x1673b6,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 6f32a88..f9c700c 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 _0xbd50=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','Trigger','tools_triggers','lodash'];(function(_0x1e45ec,_0x2e11eb){var _0x42f22d=function(_0x35bd42){while(--_0x35bd42){_0x1e45ec['push'](_0x1e45ec['shift']());}};_0x42f22d(++_0x2e11eb);}(_0xbd50,0x196));var _0x0bd5=function(_0x25c985,_0x1fd521){_0x25c985=_0x25c985-0x0;var _0x91e97b=_0xbd50[_0x25c985];return _0x91e97b;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var logger=require(_0x0bd5('0x2'))('api');var moment=require(_0x0bd5('0x3'));var BPromise=require(_0x0bd5('0x4'));var rp=require(_0x0bd5('0x5'));var fs=require('fs');var path=require(_0x0bd5('0x6'));var rimraf=require(_0x0bd5('0x7'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module['exports']=function(_0x376024,_0x2ef1d0){return _0x376024[_0x0bd5('0x8')](_0x0bd5('0x9'),attributes,{'tableName':_0x0bd5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde50=['../../config/logger','api','moment','bluebird','path','../../config/environment','define','Trigger'];(function(_0x130263,_0x56682e){var _0x2c9e6d=function(_0x27efe5){while(--_0x27efe5){_0x130263['push'](_0x130263['shift']());}};_0x2c9e6d(++_0x56682e);}(_0xde50,0x140));var _0x0de5=function(_0x531cc1,_0x2a048c){_0x531cc1=_0x531cc1-0x0;var _0x33a99b=_0xde50[_0x531cc1];return _0x33a99b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0de5('0x0'))(_0x0de5('0x1'));var moment=require(_0x0de5('0x2'));var BPromise=require(_0x0de5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0de5('0x4'));var rimraf=require('rimraf');var config=require(_0x0de5('0x5'));var attributes=require('./trigger.attributes');module['exports']=function(_0x5f05a1,_0x444955){return _0x5f05a1[_0x0de5('0x6')](_0x0de5('0x7'),attributes,{'tableName':'tools_triggers','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 3bab244..c831671 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 _0xb030=['then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','map','include','model','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request'];(function(_0x55e456,_0x31a7f2){var _0x4a3ea7=function(_0x13652a){while(--_0x13652a){_0x55e456['push'](_0x55e456['shift']());}};_0x4a3ea7(++_0x31a7f2);}(_0xb030,0x9e));var _0x0b03=function(_0x245e9c,_0x3846b6){_0x245e9c=_0x245e9c-0x0;var _0x423cb0=_0xb030[_0x245e9c];return _0x423cb0;};'use strict';var _=require(_0x0b03('0x0'));var util=require(_0x0b03('0x1'));var moment=require(_0x0b03('0x2'));var BPromise=require(_0x0b03('0x3'));var rs=require(_0x0b03('0x4'));var fs=require('fs');var Redis=require(_0x0b03('0x5'));var db=require(_0x0b03('0x6'))['db'];var utils=require(_0x0b03('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0b03('0x8'));var jayson=require(_0x0b03('0x9'));var client=jayson[_0x0b03('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30624c,_0x5d4716,_0x5c80cf){return new BPromise(function(_0x562076,_0x13ee64){return client[_0x0b03('0xb')](_0x30624c,_0x5c80cf)[_0x0b03('0xc')](function(_0x438049){logger[_0x0b03('0xd')](_0x0b03('0xe'),_0x5d4716,_0x0b03('0xf'));logger[_0x0b03('0x10')](_0x0b03('0x11'),_0x5d4716,_0x0b03('0xf'),JSON[_0x0b03('0x12')](_0x438049));if(_0x438049[_0x0b03('0x13')]){if(_0x438049['error'][_0x0b03('0x14')]===0x1f4){logger[_0x0b03('0x13')]('Trigger,\x20%s,\x20%s',_0x5d4716,_0x438049[_0x0b03('0x13')][_0x0b03('0x15')]);return _0x13ee64(_0x438049[_0x0b03('0x13')][_0x0b03('0x15')]);}logger[_0x0b03('0x13')](_0x0b03('0xe'),_0x5d4716,_0x438049['error'][_0x0b03('0x15')]);return _0x562076(_0x438049[_0x0b03('0x13')][_0x0b03('0x15')]);}else{logger[_0x0b03('0xd')]('Trigger,\x20%s,\x20%s',_0x5d4716,'request\x20sent');_0x562076(_0x438049['result'][_0x0b03('0x15')]);}})[_0x0b03('0x16')](function(_0x49393e){logger['error'](_0x0b03('0xe'),_0x5d4716,_0x49393e);_0x13ee64(_0x49393e);});});}exports[_0x0b03('0x17')]=function(_0x5d717f){var _0x1d8394=this;return new Promise(function(_0x2a08dd,_0x5b3fe7){return db[_0x0b03('0x18')][_0x0b03('0x19')]({'raw':_0x5d717f[_0x0b03('0x1a')]?_0x5d717f[_0x0b03('0x1a')][_0x0b03('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d717f[_0x0b03('0x1a')]?_0x5d717f[_0x0b03('0x1a')][_0x0b03('0x1c')]||null:null,'attributes':_0x5d717f[_0x0b03('0x1a')]?_0x5d717f[_0x0b03('0x1a')][_0x0b03('0x1d')]||null:null,'limit':_0x5d717f[_0x0b03('0x1a')]?_0x5d717f[_0x0b03('0x1a')]['limit']||null:null,'include':_0x5d717f[_0x0b03('0x1a')]?_0x5d717f[_0x0b03('0x1a')]['include']?_[_0x0b03('0x1e')](_0x5d717f[_0x0b03('0x1a')][_0x0b03('0x1f')],function(_0x21486c){return{'model':db[_0x21486c[_0x0b03('0x20')]],'as':_0x21486c['as'],'attributes':_0x21486c[_0x0b03('0x1d')],'include':_0x21486c['include']?_[_0x0b03('0x1e')](_0x21486c[_0x0b03('0x1f')],function(_0x2c886d){return{'model':db[_0x2c886d[_0x0b03('0x20')]],'as':_0x2c886d['as'],'attributes':_0x2c886d[_0x0b03('0x1d')],'include':_0x2c886d[_0x0b03('0x1f')]?_[_0x0b03('0x1e')](_0x2c886d[_0x0b03('0x1f')],function(_0x5b62dc){return{'model':db[_0x5b62dc[_0x0b03('0x20')]],'as':_0x5b62dc['as'],'attributes':_0x5b62dc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x16e63b){logger[_0x0b03('0xd')](_0x0b03('0x17'),_0x5d717f);logger[_0x0b03('0x10')](_0x0b03('0x17'),_0x5d717f,JSON[_0x0b03('0x12')](_0x16e63b));_0x2a08dd(_0x16e63b);})['catch'](function(_0x2bc69a){logger['error'](_0x0b03('0x17'),_0x2bc69a[_0x0b03('0x15')],_0x5d717f);_0x5b3fe7(_0x1d8394[_0x0b03('0x13')](0x1f4,_0x2bc69a[_0x0b03('0x15')]));});});};exports[_0x0b03('0x21')]=function(_0x451b96){var _0x1ee57e=this;return new Promise(function(_0x45c7c8,_0x203cfa){return db['Trigger']['find']({'raw':_0x451b96['options']?_0x451b96[_0x0b03('0x1a')][_0x0b03('0x1b')]===undefined?!![]:![]:!![],'where':_0x451b96['options']?_0x451b96['options']['where']||null:null,'attributes':_0x451b96[_0x0b03('0x1a')]?_0x451b96[_0x0b03('0x1a')]['attributes']||null:null,'include':_0x451b96[_0x0b03('0x1a')]?_0x451b96['options']['include']?_[_0x0b03('0x1e')](_0x451b96['options']['include'],function(_0x4ccbc7){return{'model':db[_0x4ccbc7[_0x0b03('0x20')]],'as':_0x4ccbc7['as'],'attributes':_0x4ccbc7[_0x0b03('0x1d')],'include':_0x4ccbc7[_0x0b03('0x1f')]?_[_0x0b03('0x1e')](_0x4ccbc7[_0x0b03('0x1f')],function(_0xd15cd4){return{'model':db[_0xd15cd4['model']],'as':_0xd15cd4['as'],'attributes':_0xd15cd4[_0x0b03('0x1d')],'include':_0xd15cd4[_0x0b03('0x1f')]?_[_0x0b03('0x1e')](_0xd15cd4[_0x0b03('0x1f')],function(_0x19898b){return{'model':db[_0x19898b[_0x0b03('0x20')]],'as':_0x19898b['as'],'attributes':_0x19898b[_0x0b03('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0b03('0xc')](function(_0x556c4a){logger[_0x0b03('0xd')](_0x0b03('0x21'),_0x451b96);logger['debug'](_0x0b03('0x21'),_0x451b96,JSON['stringify'](_0x556c4a));_0x45c7c8(_0x556c4a);})[_0x0b03('0x16')](function(_0x1ee34b){logger[_0x0b03('0x13')](_0x0b03('0x21'),_0x1ee34b[_0x0b03('0x15')],_0x451b96);_0x203cfa(_0x1ee57e['error'](0x1f4,_0x1ee34b[_0x0b03('0x15')]));});});}; \ No newline at end of file +var _0xd777=['GetTrigger','Trigger','findAll','options','raw','where','attributes','include','map','model','stringify','catch','ShowTrigger','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x1bccda,_0x1009e2){var _0x486285=function(_0x3a9e43){while(--_0x3a9e43){_0x1bccda['push'](_0x1bccda['shift']());}};_0x486285(++_0x1009e2);}(_0xd777,0x9a));var _0x7d77=function(_0x1119c8,_0x87303e){_0x1119c8=_0x1119c8-0x0;var _0x3f3071=_0xd777[_0x1119c8];return _0x3f3071;};'use strict';var _=require(_0x7d77('0x0'));var util=require(_0x7d77('0x1'));var moment=require(_0x7d77('0x2'));var BPromise=require(_0x7d77('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d77('0x4'));var db=require(_0x7d77('0x5'))['db'];var utils=require(_0x7d77('0x6'));var logger=require('../../config/logger')(_0x7d77('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7d77('0x8')][_0x7d77('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb166d1,_0xed3d03,_0x3054ec){return new BPromise(function(_0x6cdfc1,_0x589186){return client[_0x7d77('0xa')](_0xb166d1,_0x3054ec)[_0x7d77('0xb')](function(_0x32ad30){logger[_0x7d77('0xc')](_0x7d77('0xd'),_0xed3d03,_0x7d77('0xe'));logger[_0x7d77('0xf')](_0x7d77('0x10'),_0xed3d03,_0x7d77('0xe'),JSON['stringify'](_0x32ad30));if(_0x32ad30['error']){if(_0x32ad30[_0x7d77('0x11')][_0x7d77('0x12')]===0x1f4){logger[_0x7d77('0x11')](_0x7d77('0xd'),_0xed3d03,_0x32ad30[_0x7d77('0x11')][_0x7d77('0x13')]);return _0x589186(_0x32ad30[_0x7d77('0x11')][_0x7d77('0x13')]);}logger[_0x7d77('0x11')](_0x7d77('0xd'),_0xed3d03,_0x32ad30[_0x7d77('0x11')][_0x7d77('0x13')]);return _0x6cdfc1(_0x32ad30[_0x7d77('0x11')][_0x7d77('0x13')]);}else{logger[_0x7d77('0xc')]('Trigger,\x20%s,\x20%s',_0xed3d03,_0x7d77('0xe'));_0x6cdfc1(_0x32ad30[_0x7d77('0x14')][_0x7d77('0x13')]);}})['catch'](function(_0x15c3c0){logger[_0x7d77('0x11')](_0x7d77('0xd'),_0xed3d03,_0x15c3c0);_0x589186(_0x15c3c0);});});}exports[_0x7d77('0x15')]=function(_0x2db17f){var _0x106efd=this;return new Promise(function(_0xc4ba43,_0x4192a4){return db[_0x7d77('0x16')][_0x7d77('0x17')]({'raw':_0x2db17f['options']?_0x2db17f[_0x7d77('0x18')][_0x7d77('0x19')]===undefined?!![]:![]:!![],'where':_0x2db17f[_0x7d77('0x18')]?_0x2db17f[_0x7d77('0x18')][_0x7d77('0x1a')]||null:null,'attributes':_0x2db17f[_0x7d77('0x18')]?_0x2db17f[_0x7d77('0x18')][_0x7d77('0x1b')]||null:null,'limit':_0x2db17f[_0x7d77('0x18')]?_0x2db17f[_0x7d77('0x18')]['limit']||null:null,'include':_0x2db17f[_0x7d77('0x18')]?_0x2db17f[_0x7d77('0x18')]['include']?_['map'](_0x2db17f['options']['include'],function(_0x4138cd){return{'model':db[_0x4138cd['model']],'as':_0x4138cd['as'],'attributes':_0x4138cd[_0x7d77('0x1b')],'include':_0x4138cd[_0x7d77('0x1c')]?_[_0x7d77('0x1d')](_0x4138cd['include'],function(_0x46fe72){return{'model':db[_0x46fe72[_0x7d77('0x1e')]],'as':_0x46fe72['as'],'attributes':_0x46fe72['attributes'],'include':_0x46fe72[_0x7d77('0x1c')]?_[_0x7d77('0x1d')](_0x46fe72['include'],function(_0x1ad1b5){return{'model':db[_0x1ad1b5[_0x7d77('0x1e')]],'as':_0x1ad1b5['as'],'attributes':_0x1ad1b5[_0x7d77('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7d77('0xb')](function(_0x35ac2c){logger['info'](_0x7d77('0x15'),_0x2db17f);logger['debug']('GetTrigger',_0x2db17f,JSON[_0x7d77('0x1f')](_0x35ac2c));_0xc4ba43(_0x35ac2c);})[_0x7d77('0x20')](function(_0x5379b7){logger[_0x7d77('0x11')](_0x7d77('0x15'),_0x5379b7['message'],_0x2db17f);_0x4192a4(_0x106efd[_0x7d77('0x11')](0x1f4,_0x5379b7[_0x7d77('0x13')]));});});};exports[_0x7d77('0x21')]=function(_0x609bd4){var _0x5283fc=this;return new Promise(function(_0x198836,_0x5139ac){return db[_0x7d77('0x16')][_0x7d77('0x22')]({'raw':_0x609bd4[_0x7d77('0x18')]?_0x609bd4[_0x7d77('0x18')][_0x7d77('0x19')]===undefined?!![]:![]:!![],'where':_0x609bd4[_0x7d77('0x18')]?_0x609bd4[_0x7d77('0x18')][_0x7d77('0x1a')]||null:null,'attributes':_0x609bd4[_0x7d77('0x18')]?_0x609bd4['options'][_0x7d77('0x1b')]||null:null,'include':_0x609bd4[_0x7d77('0x18')]?_0x609bd4['options'][_0x7d77('0x1c')]?_['map'](_0x609bd4[_0x7d77('0x18')][_0x7d77('0x1c')],function(_0xf35cf){return{'model':db[_0xf35cf[_0x7d77('0x1e')]],'as':_0xf35cf['as'],'attributes':_0xf35cf[_0x7d77('0x1b')],'include':_0xf35cf['include']?_[_0x7d77('0x1d')](_0xf35cf['include'],function(_0xde8072){return{'model':db[_0xde8072[_0x7d77('0x1e')]],'as':_0xde8072['as'],'attributes':_0xde8072[_0x7d77('0x1b')],'include':_0xde8072[_0x7d77('0x1c')]?_[_0x7d77('0x1d')](_0xde8072[_0x7d77('0x1c')],function(_0x104758){return{'model':db[_0x104758['model']],'as':_0x104758['as'],'attributes':_0x104758[_0x7d77('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44ef7f){logger['info']('ShowTrigger',_0x609bd4);logger[_0x7d77('0xf')](_0x7d77('0x21'),_0x609bd4,JSON[_0x7d77('0x1f')](_0x44ef7f));_0x198836(_0x44ef7f);})[_0x7d77('0x20')](function(_0x32d01b){logger['error'](_0x7d77('0x21'),_0x32d01b[_0x7d77('0x13')],_0x609bd4);_0x5139ac(_0x5283fc['error'](0x1f4,_0x32d01b['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 6c3f011..e4f7b6f 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 _0x75c3=['util','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/clone','clone','post','create','update','delete','destroy','exports','multer'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0x75c3,0x18e));var _0x375c=function(_0x40bbd2,_0x2ec7dc){_0x40bbd2=_0x40bbd2-0x0;var _0x3fa72d=_0x75c3[_0x40bbd2];return _0x3fa72d;};'use strict';var multer=require(_0x375c('0x0'));var util=require(_0x375c('0x1'));var path=require('path');var timeout=require(_0x375c('0x2'));var express=require('express');var router=express[_0x375c('0x3')]();var fs_extra=require(_0x375c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x375c('0x5'));var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0x375c('0x6')]('/',auth[_0x375c('0x7')](),controller[_0x375c('0x8')]);router[_0x375c('0x6')](_0x375c('0x9'),auth[_0x375c('0x7')](),controller[_0x375c('0xa')]);router['post'](_0x375c('0xb'),auth[_0x375c('0x7')](),controller[_0x375c('0xc')]);router[_0x375c('0xd')]('/',auth['isAuthenticated'](),controller[_0x375c('0xe')]);router['put'](_0x375c('0x9'),auth[_0x375c('0x7')](),controller[_0x375c('0xf')]);router[_0x375c('0x10')]('/:id',auth[_0x375c('0x7')](),controller[_0x375c('0x11')]);module[_0x375c('0x12')]=router; \ No newline at end of file +var _0xc3ef=['isAuthenticated','index','show','post','/:id/clone','clone','create','put','/:id','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get'];(function(_0x3eee4e,_0x417ac8){var _0x42a56b=function(_0xfe7a3a){while(--_0xfe7a3a){_0x3eee4e['push'](_0x3eee4e['shift']());}};_0x42a56b(++_0x417ac8);}(_0xc3ef,0x89));var _0xfc3e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc3ef[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xfc3e('0x0'));var util=require(_0xfc3e('0x1'));var path=require('path');var timeout=require(_0xfc3e('0x2'));var express=require(_0xfc3e('0x3'));var router=express[_0xfc3e('0x4')]();var fs_extra=require(_0xfc3e('0x5'));var auth=require(_0xfc3e('0x6'));var interaction=require(_0xfc3e('0x7'));var config=require('../../config/environment');var controller=require(_0xfc3e('0x8'));router[_0xfc3e('0x9')]('/',auth[_0xfc3e('0xa')](),controller[_0xfc3e('0xb')]);router['get']('/:id',auth[_0xfc3e('0xa')](),controller[_0xfc3e('0xc')]);router[_0xfc3e('0xd')](_0xfc3e('0xe'),auth[_0xfc3e('0xa')](),controller[_0xfc3e('0xf')]);router[_0xfc3e('0xd')]('/',auth['isAuthenticated'](),controller[_0xfc3e('0x10')]);router[_0xfc3e('0x11')](_0xfc3e('0x12'),auth[_0xfc3e('0xa')](),controller['update']);router[_0xfc3e('0x13')](_0xfc3e('0x12'),auth[_0xfc3e('0xa')](),controller[_0xfc3e('0x14')]);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 2927522..8d48c0f 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 _0x79cf=['auto','update','outgoing','yes','force_rport,comedia','nat','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','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','\x22\x22\x20<>','always','INTEGER','refuse','originate','uac','uas','pai','fingerprint','certificate','actpass','dynamic','nonat','update,nonat','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','split','rfc2833','info','shortinfo','inband'];(function(_0x3f141c,_0x39d4bc){var _0x3bb173=function(_0x16406f){while(--_0x16406f){_0x3f141c['push'](_0x3f141c['shift']());}};_0x3bb173(++_0x39d4bc);}(_0x79cf,0xf1));var _0xf79c=function(_0x1da175,_0x286c66){_0x1da175=_0x1da175-0x0;var _0x5c5c62=_0x79cf[_0x1da175];return _0x5c5c62;};'use strict';var Sequelize=require(_0xf79c('0x0'));module[_0xf79c('0x1')]={'name':{'type':Sequelize[_0xf79c('0x2')],'allowNull':![],'unique':_0xf79c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x5'),_0xf79c('0x6'),_0xf79c('0x7')),'allowNull':![],'defaultValue':_0xf79c('0x5')},'context':{'type':Sequelize[_0xf79c('0x2')],'allowNull':![],'defaultValue':_0xf79c('0x8')},'callingpres':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x9'),_0xf79c('0xa'),_0xf79c('0xb'),_0xf79c('0xc'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xf79c('0xd'),_0xf79c('0xe'))},'deny':{'type':Sequelize[_0xf79c('0x2')]},'permit':{'type':Sequelize[_0xf79c('0x2')]},'secret':{'type':Sequelize[_0xf79c('0x2')]},'md5secret':{'type':Sequelize[_0xf79c('0x2')]},'remotesecret':{'type':Sequelize[_0xf79c('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xf79c('0xf'),'set':function(_0x41ee05){this[_0xf79c('0x10')](_0xf79c('0x11'),_0x41ee05?_0x41ee05[_0xf79c('0x12')](','):null);},'get':function(){return this['getDataValue'](_0xf79c('0x11'))?this['getDataValue'](_0xf79c('0x11'))[_0xf79c('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x14'),_0xf79c('0x15'),_0xf79c('0x16'),_0xf79c('0x17'),_0xf79c('0x18')),'defaultValue':_0xf79c('0x14')},'directmedia':{'type':Sequelize[_0xf79c('0x4')]('yes','no','nonat',_0xf79c('0x19'),_0xf79c('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xf79c('0x2')]},'nat':{'type':Sequelize[_0xf79c('0x2')],'defaultValue':_0xf79c('0x1c'),'set':function(_0x5e8b5c){this['setDataValue'](_0xf79c('0x1d'),_0x5e8b5c?_0x5e8b5c[_0xf79c('0x12')](','):null);},'get':function(){return this[_0xf79c('0x1e')](_0xf79c('0x1d'))?this[_0xf79c('0x1e')](_0xf79c('0x1d'))[_0xf79c('0x13')](','):null;},'comment':_0xf79c('0x1f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xf79c('0x2')]},'pickupgroup':{'type':Sequelize[_0xf79c('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xf79c('0x2')]},'language':{'type':Sequelize[_0xf79c('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf79c('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf79c('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x549c88){this[_0xf79c('0x10')](_0xf79c('0x20'),_0x549c88?_0x549c88[_0xf79c('0x12')](';'):_0xf79c('0x21'));},'get':function(){return this[_0xf79c('0x1e')](_0xf79c('0x20'))?this[_0xf79c('0x1e')](_0xf79c('0x20'))['split'](';'):null;},'comment':_0xf79c('0x22')},'autoframing':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x1b'),'no')},'insecure':{'type':Sequelize[_0xf79c('0x2')],'defaultValue':_0xf79c('0x23'),'set':function(_0x475fe6){this[_0xf79c('0x10')]('insecure',_0x475fe6?_0x475fe6[_0xf79c('0x12')](','):null);},'get':function(){return this['getDataValue'](_0xf79c('0x24'))?this[_0xf79c('0x1e')]('insecure')['split'](','):null;},'comment':_0xf79c('0x25')},'trustrpid':{'type':Sequelize[_0xf79c('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf79c('0x4')]('yes','no',_0xf79c('0x26'))},'promiscredir':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x1b'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf79c('0x2')],'defaultValue':_0xf79c('0x27')},'amaflags':{'type':Sequelize[_0xf79c('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0xf79c('0x1b'),'no'),'defaultValue':_0xf79c('0x1b')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xf79c('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xf79c('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xf79c('0x2')]},'videosupport':{'type':Sequelize[_0xf79c('0x4')]('yes','no',_0xf79c('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf79c('0x29')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x1b'),'no')},'mailbox':{'type':Sequelize[_0xf79c('0x2')]},'session_timers':{'type':Sequelize[_0xf79c('0x4')]('accept',_0xf79c('0x2a'),_0xf79c('0x2b'))},'session_expires':{'type':Sequelize[_0xf79c('0x29')](0xb)},'session_minse':{'type':Sequelize[_0xf79c('0x29')](0xb)},'session_refresher':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x2c'),_0xf79c('0x2d')),'defaultValue':_0xf79c('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0xf79c('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xf79c('0x2')]},'fromuser':{'type':Sequelize[_0xf79c('0x2')]},'port':{'type':Sequelize[_0xf79c('0x29')](0x5)},'qualify':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x1b'),'no'),'defaultValue':_0xf79c('0x1b')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xf79c('0x29')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf79c('0x29')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf79c('0x29')](0xb)},'sendrpid':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x1b'),'no',_0xf79c('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf79c('0x2')]},'callbackextension':{'type':Sequelize[_0xf79c('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xf79c('0x29')](0xb)},'qualifyfreq':{'type':Sequelize[_0xf79c('0x29')](0xb)},'contactpermit':{'type':Sequelize[_0xf79c('0x2')]},'contactdeny':{'type':Sequelize[_0xf79c('0x2')]},'contactacl':{'type':Sequelize[_0xf79c('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xf79c('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xf79c('0x29')](0xb)},'encryption':{'type':Sequelize[_0xf79c('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x1b'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0xf79c('0x1b'),'no')},'dtlsenable':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x1b'),'no',_0xf79c('0x2f'),_0xf79c('0x30'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xf79c('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xf79c('0x2')]},'dtlscafile':{'type':Sequelize[_0xf79c('0x2')]},'dtlscapath':{'type':Sequelize[_0xf79c('0x2')]},'dtlssetup':{'type':Sequelize[_0xf79c('0x4')]('active','passive',_0xf79c('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf79c('0x2')]},'usereqphone':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf79c('0x2')]},'recordofffeature':{'type':Sequelize[_0xf79c('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0xf79c('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0xf79c('0x2')]},'mohinterpret':{'type':Sequelize[_0xf79c('0x2')]},'mohsuggest':{'type':Sequelize[_0xf79c('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0xf79c('0x32')},'canreinvite':{'type':Sequelize[_0xf79c('0x4')](_0xf79c('0x1b'),'no',_0xf79c('0x33'),_0xf79c('0x19'),_0xf79c('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xf79c('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf79c('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x7e03=['force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','fingerprint','active','passive','actpass','dynamic','update','update,nonat','sequelize','exports','friend','user','peer','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','STRING','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing'];(function(_0x417b1a,_0x3cfce5){var _0x1e41af=function(_0xe2e44e){while(--_0xe2e44e){_0x417b1a['push'](_0x417b1a['shift']());}};_0x1e41af(++_0x3cfce5);}(_0x7e03,0x113));var _0x37e0=function(_0x469e3d,_0x4b8a1b){_0x469e3d=_0x469e3d-0x0;var _0x31144f=_0x7e03[_0x469e3d];return _0x31144f;};'use strict';var Sequelize=require(_0x37e0('0x0'));module[_0x37e0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x37e0('0x2'),_0x37e0('0x3'),_0x37e0('0x4')),'allowNull':![],'defaultValue':_0x37e0('0x2')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x37e0('0x5')},'callingpres':{'type':Sequelize[_0x37e0('0x6')]('ALLOWED_NOT_SCREENED',_0x37e0('0x7'),_0x37e0('0x8'),_0x37e0('0x9'),'PROHIB_NOT_SCREENED',_0x37e0('0xa'),_0x37e0('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0x37e0('0xc')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x37e0('0xc')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x37e0('0xc')]},'transport':{'type':Sequelize[_0x37e0('0xc')],'defaultValue':'udp','set':function(_0x468785){this['setDataValue'](_0x37e0('0xd'),_0x468785?_0x468785[_0x37e0('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x37e0('0xd'))?this[_0x37e0('0xf')]('transport')[_0x37e0('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x11'),_0x37e0('0x12'),_0x37e0('0x13'),_0x37e0('0x14'),_0x37e0('0x15')),'defaultValue':_0x37e0('0x11')},'directmedia':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no',_0x37e0('0x17'),'update',_0x37e0('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x37e0('0x6')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x37e0('0xc')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x37e0('0x19'),'set':function(_0x55544c){this[_0x37e0('0x1a')](_0x37e0('0x1b'),_0x55544c?_0x55544c[_0x37e0('0xe')](','):null);},'get':function(){return this[_0x37e0('0xf')]('nat')?this['getDataValue']('nat')[_0x37e0('0x10')](','):null;},'comment':_0x37e0('0x1c')},'callgroup':{'type':Sequelize[_0x37e0('0xc')]},'namedcallgroup':{'type':Sequelize[_0x37e0('0xc')]},'pickupgroup':{'type':Sequelize[_0x37e0('0xc')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x37e0('0xc')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x37e0('0xc')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x37e0('0xc')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x25e37c){this[_0x37e0('0x1a')](_0x37e0('0x1d'),_0x25e37c?_0x25e37c['join'](';'):_0x37e0('0x1e'));},'get':function(){return this[_0x37e0('0xf')]('allow')?this[_0x37e0('0xf')](_0x37e0('0x1d'))[_0x37e0('0x10')](';'):null;},'comment':_0x37e0('0x1f')},'autoframing':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no')},'insecure':{'type':Sequelize[_0x37e0('0xc')],'defaultValue':_0x37e0('0x20'),'set':function(_0xd35ad8){this[_0x37e0('0x1a')](_0x37e0('0x21'),_0xd35ad8?_0xd35ad8[_0x37e0('0xe')](','):null);},'get':function(){return this[_0x37e0('0xf')](_0x37e0('0x21'))?this['getDataValue'](_0x37e0('0x21'))[_0x37e0('0x10')](','):null;},'comment':_0x37e0('0x22')},'trustrpid':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x37e0('0x6')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x37e0('0x16'),'no','never')},'promiscredir':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no')},'accountcode':{'type':Sequelize[_0x37e0('0x23')](0xb)},'setvar':{'type':Sequelize[_0x37e0('0xc')]},'callerid':{'type':Sequelize[_0x37e0('0xc')],'defaultValue':_0x37e0('0x24')},'amaflags':{'type':Sequelize[_0x37e0('0xc')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x37e0('0x16')},'busylevel':{'type':Sequelize[_0x37e0('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x37e0('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x37e0('0x6')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x37e0('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x37e0('0xc')]},'template':{'type':Sequelize[_0x37e0('0xc')]},'videosupport':{'type':Sequelize['ENUM'](_0x37e0('0x16'),'no',_0x37e0('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x37e0('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x37e0('0x16'),'no')},'mailbox':{'type':Sequelize[_0x37e0('0xc')]},'session_timers':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x26'),_0x37e0('0x27'),'originate')},'session_expires':{'type':Sequelize[_0x37e0('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x37e0('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x28'),'uas'),'defaultValue':_0x37e0('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x37e0('0xc')]},'fromdomain':{'type':Sequelize[_0x37e0('0xc')]},'fromuser':{'type':Sequelize[_0x37e0('0xc')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no'),'defaultValue':_0x37e0('0x16')},'keepalive':{'type':Sequelize[_0x37e0('0x23')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x37e0('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no',_0x37e0('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x37e0('0xc')]},'callbackextension':{'type':Sequelize[_0x37e0('0xc')]},'timert1':{'type':Sequelize[_0x37e0('0x23')](0xb)},'timerb':{'type':Sequelize[_0x37e0('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x37e0('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x37e0('0xc')]},'contactdeny':{'type':Sequelize[_0x37e0('0xc')]},'contactacl':{'type':Sequelize[_0x37e0('0xc')]},'unsolicited_mailbox':{'type':Sequelize[_0x37e0('0xc')]},'use_q850_reason':{'type':Sequelize[_0x37e0('0xc')]},'maxforwards':{'type':Sequelize[_0x37e0('0x23')](0xb)},'encryption':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x37e0('0x16'),'no')},'force_avp':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no')},'icesupport':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x37e0('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x37e0('0x6')]('yes','no',_0x37e0('0x2b'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x37e0('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x37e0('0xc')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x37e0('0xc')]},'dtlscafile':{'type':Sequelize[_0x37e0('0xc')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0x37e0('0x2c'),_0x37e0('0x2d'),_0x37e0('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x37e0('0xc')]},'recordofffeature':{'type':Sequelize[_0x37e0('0xc')]},'call_limit':{'type':Sequelize[_0x37e0('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0x37e0('0x6')](_0x37e0('0x16'),'no')},'vmexten':{'type':Sequelize[_0x37e0('0xc')]},'mohinterpret':{'type':Sequelize[_0x37e0('0xc')]},'mohsuggest':{'type':Sequelize[_0x37e0('0xc')]},'parkinglot':{'type':Sequelize[_0x37e0('0xc')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x37e0('0x2f')},'canreinvite':{'type':Sequelize['ENUM'](_0x37e0('0x16'),'no',_0x37e0('0x17'),_0x37e0('0x30'),_0x37e0('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x37e0('0xc')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x37e0('0xc')],'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 59c8ce9..65f967b 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 _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x238c53,_0x17131c){var _0x34c754=function(_0x5655db){while(--_0x5655db){_0x238c53['push'](_0x238c53['shift']());}};_0x34c754(++_0x17131c);}(_0x98a8,0x12c));var _0x898a=function(_0x5a3ac6,_0x30b672){_0x5a3ac6=_0x5a3ac6-0x0;var _0x46645d=_0x98a8[_0x5a3ac6];return _0x46645d;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file +var _0xd6d6=['sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','send','index','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','VIRTUAL','filter','merge','options','Trunk','includeAll','include','findAll','rows','show','params','find','clone','omit','createdAt','updatedAt','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','create','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','role','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0xfc5a84,_0x552e63){var _0x15cacb=function(_0x4f135b){while(--_0x4f135b){_0xfc5a84['push'](_0xfc5a84['shift']());}};_0x15cacb(++_0x552e63);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x113d6a,_0x212abd){_0x113d6a=_0x113d6a-0x0;var _0x38448d=_0xd6d6[_0x113d6a];return _0x38448d;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];var jayson=require(_0x6d6d('0x19'));var client=jayson[_0x6d6d('0x1a')][_0x6d6d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2b74ed,_0x41fbdf,_0x19cf50,_0x2cb2dd){return new BPromise(function(_0x5f4154,_0xd09ea7){var _0x3dd4b3=_0x2cb2dd||client;return _0x3dd4b3[_0x6d6d('0x1c')](_0x2b74ed,_0x19cf50)[_0x6d6d('0x1d')](function(_0x29cbd8){logger['info'](_0x6d6d('0x1e'),_0x41fbdf,'request\x20sent');logger[_0x6d6d('0x1f')](_0x6d6d('0x20'),_0x41fbdf,_0x6d6d('0x21'),JSON['stringify'](_0x29cbd8));if(_0x29cbd8['error']){if(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x23')]===0x1f4){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8['error']['message']);return _0xd09ea7(_0x29cbd8[_0x6d6d('0x22')]['message']);}logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);return _0x5f4154(_0x29cbd8[_0x6d6d('0x22')][_0x6d6d('0x24')]);}else{logger[_0x6d6d('0x25')](_0x6d6d('0x1e'),_0x41fbdf,_0x6d6d('0x21'));_0x5f4154(_0x29cbd8[_0x6d6d('0x26')][_0x6d6d('0x24')]);}})[_0x6d6d('0x27')](function(_0x466a29){logger[_0x6d6d('0x22')](_0x6d6d('0x1e'),_0x41fbdf,_0x466a29);_0xd09ea7(_0x466a29);});});}function respondWithStatusCode(_0x25a02e,_0xced622){_0xced622=_0xced622||0xcc;return function(_0x583b10){if(_0x583b10){return _0x25a02e[_0x6d6d('0x28')](_0xced622);}return _0x25a02e[_0x6d6d('0x29')](_0xced622)[_0x6d6d('0x2a')]();};}function respondWithResult(_0x97ec9e,_0xf0df7f){_0xf0df7f=_0xf0df7f||0xc8;return function(_0x12fab2){if(_0x12fab2){return _0x97ec9e['status'](_0xf0df7f)[_0x6d6d('0x2b')](_0x12fab2);}};}function respondWithFilteredResult(_0x2b5e31,_0x235451){return function(_0x126ac8){if(_0x126ac8){var _0x25c121=typeof _0x235451[_0x6d6d('0x2c')]===_0x6d6d('0x2d')&&typeof _0x235451['limit']===_0x6d6d('0x2d');var _0x9595d8=_0x126ac8['count'];var _0x553645=_0x25c121?0x0:_0x235451[_0x6d6d('0x2c')];var _0x5273cd=_0x25c121?_0x126ac8[_0x6d6d('0x2e')]:_0x235451['offset']+_0x235451[_0x6d6d('0x2f')];var _0x20255e;if(_0x5273cd>=_0x9595d8){_0x5273cd=_0x9595d8;_0x20255e=0xc8;}else{_0x20255e=0xce;}_0x2b5e31[_0x6d6d('0x29')](_0x20255e);return _0x2b5e31[_0x6d6d('0x30')](_0x6d6d('0x31'),_0x553645+'-'+_0x5273cd+'/'+_0x9595d8)[_0x6d6d('0x2b')](_0x126ac8);}return null;};}function patchUpdates(_0xdda3f2){return function(_0x359cfd){try{jsonpatch[_0x6d6d('0x32')](_0x359cfd,_0xdda3f2,!![]);}catch(_0x34050a){return BPromise['reject'](_0x34050a);}return _0x359cfd[_0x6d6d('0x33')]();};}function saveUpdates(_0x4f1fc5,_0x18015a){return function(_0x1ea9b2){if(_0x1ea9b2){return _0x1ea9b2[_0x6d6d('0x34')](_0x4f1fc5)[_0x6d6d('0x1d')](function(_0x5c6248){return _0x5c6248;});}return null;};}function removeEntity(_0x182441,_0x4f2f13){return function(_0x3cc702){if(_0x3cc702){return _0x3cc702[_0x6d6d('0x35')]()['then'](function(){var _0x37993f=_0x3cc702[_0x6d6d('0x36')]({'plain':!![]});var _0x37ac94=_0x6d6d('0x37');return db[_0x6d6d('0x38')][_0x6d6d('0x35')]({'where':{'type':_0x37ac94,'resourceId':_0x37993f['id']}})[_0x6d6d('0x1d')](function(){return _0x3cc702;});})[_0x6d6d('0x1d')](function(){_0x182441[_0x6d6d('0x29')](0xcc)[_0x6d6d('0x2a')]();});}};}function handleEntityNotFound(_0x2fcf88,_0x3693da){return function(_0x17d863){if(!_0x17d863){_0x2fcf88[_0x6d6d('0x28')](0x194);}return _0x17d863;};}function handleError(_0x5a2397,_0x1335ef){_0x1335ef=_0x1335ef||0x1f4;return function(_0xf98bfa){logger[_0x6d6d('0x22')](_0xf98bfa[_0x6d6d('0x39')]);if(_0xf98bfa['name']){delete _0xf98bfa['name'];}_0x5a2397[_0x6d6d('0x29')](_0x1335ef)[_0x6d6d('0x3a')](_0xf98bfa);};}exports[_0x6d6d('0x3b')]=function(_0x4d42ff,_0x2a3f67){var _0x2607c1={},_0x23c173={},_0x125d79={'count':0x0,'rows':[]};var _0x52556b=_['map'](db['Trunk'][_0x6d6d('0x3c')],function(_0x4196f0){return{'name':_0x4196f0[_0x6d6d('0x3d')],'type':_0x4196f0[_0x6d6d('0x3e')]['key']};});_0x23c173[_0x6d6d('0x3f')]=_[_0x6d6d('0x40')](_0x52556b,_0x6d6d('0x41'));_0x23c173[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x4d42ff[_0x6d6d('0x42')]);_0x23c173['filters']=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],_0x23c173[_0x6d6d('0x42')]);_0x2607c1[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x23c173[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x4d42ff['query'][_0x6d6d('0x46')]));_0x2607c1[_0x6d6d('0x45')]=_0x2607c1[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x2607c1[_0x6d6d('0x45')]:_0x23c173['model'];if(!_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x48')]('nolimit')){_0x2607c1[_0x6d6d('0x2f')]=qs['limit'](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2f')]);_0x2607c1['offset']=qs[_0x6d6d('0x2c')](_0x4d42ff[_0x6d6d('0x42')][_0x6d6d('0x2c')]);}_0x2607c1[_0x6d6d('0x49')]=qs[_0x6d6d('0x4a')](_0x4d42ff['query']['sort']);_0x2607c1[_0x6d6d('0x4b')]=qs['filters'](_['pick'](_0x4d42ff[_0x6d6d('0x42')],_0x23c173[_0x6d6d('0x4c')]),_0x52556b);if(_0x4d42ff[_0x6d6d('0x42')]['filter']){_0x2607c1[_0x6d6d('0x4b')]=_['merge'](_0x2607c1[_0x6d6d('0x4b')],{'$or':_[_0x6d6d('0x40')](_0x52556b,function(_0x1d3826){if(_0x1d3826[_0x6d6d('0x3e')]!==_0x6d6d('0x4d')){var _0x2669f0={};_0x2669f0[_0x1d3826[_0x6d6d('0x41')]]={'$like':'%'+_0x4d42ff['query'][_0x6d6d('0x4e')]+'%'};return _0x2669f0;}})});}_0x2607c1=_[_0x6d6d('0x4f')]({},_0x2607c1,_0x4d42ff[_0x6d6d('0x50')]);var _0x389e51={'where':_0x2607c1[_0x6d6d('0x4b')]};return db[_0x6d6d('0x51')][_0x6d6d('0x2e')](_0x389e51)[_0x6d6d('0x1d')](function(_0x24cec2){_0x125d79['count']=_0x24cec2;if(_0x4d42ff['query'][_0x6d6d('0x52')]){_0x2607c1[_0x6d6d('0x53')]=[{'all':!![]}];}return db[_0x6d6d('0x51')][_0x6d6d('0x54')](_0x2607c1);})[_0x6d6d('0x1d')](function(_0x492834){_0x125d79[_0x6d6d('0x55')]=_0x492834;return _0x125d79;})[_0x6d6d('0x1d')](respondWithFilteredResult(_0x2a3f67,_0x2607c1))[_0x6d6d('0x27')](handleError(_0x2a3f67,null));};exports[_0x6d6d('0x56')]=function(_0x2ee917,_0x23c2db){var _0x1f7a09={'raw':![],'where':{'id':_0x2ee917[_0x6d6d('0x57')]['id']}},_0x39ec2a={};_0x39ec2a[_0x6d6d('0x3f')]=_[_0x6d6d('0x43')](db[_0x6d6d('0x51')]['rawAttributes']);_0x39ec2a[_0x6d6d('0x42')]=_[_0x6d6d('0x43')](_0x2ee917[_0x6d6d('0x42')]);_0x39ec2a[_0x6d6d('0x4c')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],_0x39ec2a[_0x6d6d('0x42')]);_0x1f7a09[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x39ec2a['model'],qs['fields'](_0x2ee917[_0x6d6d('0x42')]['fields']));_0x1f7a09[_0x6d6d('0x45')]=_0x1f7a09[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x1f7a09[_0x6d6d('0x45')]:_0x39ec2a[_0x6d6d('0x3f')];if(_0x2ee917[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x1f7a09[_0x6d6d('0x53')]=[{'all':!![]}];}_0x1f7a09=_[_0x6d6d('0x4f')]({},_0x1f7a09,_0x2ee917[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x1f7a09)[_0x6d6d('0x1d')](handleEntityNotFound(_0x23c2db,null))[_0x6d6d('0x1d')](respondWithResult(_0x23c2db,null))[_0x6d6d('0x27')](handleError(_0x23c2db,null));};exports[_0x6d6d('0x59')]=function(_0x45f44a,_0x243be3){var _0x5e5ace={'where':{'id':_0x45f44a[_0x6d6d('0x57')]['id']}},_0x5a1cdc={};_0x5a1cdc[_0x6d6d('0x3f')]=_['keys'](db[_0x6d6d('0x51')][_0x6d6d('0x3c')]);_0x5e5ace[_0x6d6d('0x45')]=_[_0x6d6d('0x44')](_0x5a1cdc[_0x6d6d('0x3f')],qs[_0x6d6d('0x46')](_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x46')]));_0x5e5ace[_0x6d6d('0x45')]=_0x5e5ace[_0x6d6d('0x45')][_0x6d6d('0x47')]?_0x5e5ace[_0x6d6d('0x45')]:_0x5a1cdc[_0x6d6d('0x3f')];if(_0x45f44a[_0x6d6d('0x42')][_0x6d6d('0x52')]){_0x5e5ace['include']=[{'all':!![]}];}_0x5e5ace=_[_0x6d6d('0x4f')]({},_0x5e5ace,_0x45f44a[_0x6d6d('0x50')]);return db['Trunk'][_0x6d6d('0x58')](_0x5e5ace)[_0x6d6d('0x1d')](handleEntityNotFound(_0x243be3,null))[_0x6d6d('0x1d')](function(_0x407357){if(_0x407357){var _0x2d61cc=_0x407357[_0x6d6d('0x36')]({'plain':!![]});_0x2d61cc=qs[_0x6d6d('0x5a')](_0x2d61cc,['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);_0x45f44a['body']=_['omit'](_0x45f44a[_0x6d6d('0x5d')],['id',_0x6d6d('0x5b'),_0x6d6d('0x5c')]);return db['Trunk']['create'](_[_0x6d6d('0x4f')](_0x2d61cc,_0x45f44a['body']),{'include':_0x45f44a[_0x6d6d('0x42')]['includeAll']?[{'all':!![]}]:undefined})[_0x6d6d('0x1d')](function(_0x367a6f){var _0x21f14c=_0x45f44a[_0x6d6d('0x5e')][_0x6d6d('0x36')]({'plain':!![]});if(!_0x21f14c)throw new Error(_0x6d6d('0x5f'));if(_0x21f14c['role']===_0x6d6d('0x5e')){var _0x5eb78f=_0x367a6f[_0x6d6d('0x36')]({'plain':!![]});var _0x52d9e7=_0x6d6d('0x37');return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x52d9e7,'userProfileId':_0x21f14c[_0x6d6d('0x61')]},'raw':!![]})[_0x6d6d('0x1d')](function(_0x163bb7){if(_0x163bb7&&_0x163bb7[_0x6d6d('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x5eb78f[_0x6d6d('0x41')],'resourceId':_0x5eb78f['id'],'type':_0x163bb7['name'],'sectionId':_0x163bb7['id']},{})[_0x6d6d('0x1d')](function(){return _0x367a6f;});}else{return _0x367a6f;}})['catch'](function(_0xe19d23){logger[_0x6d6d('0x22')](_0x6d6d('0x63'),_0xe19d23);throw _0xe19d23;});}return _0x367a6f;});}})[_0x6d6d('0x1d')](respondWithResult(_0x243be3,0xc9))[_0x6d6d('0x27')](handleError(_0x243be3,null));};exports[_0x6d6d('0x64')]=function(_0x5dd3b0,_0x3cedc0,_0xbca58e){var _0x3a6d79;return db[_0x6d6d('0x51')][_0x6d6d('0x64')](_0x5dd3b0[_0x6d6d('0x5d')],{'raw':!![]})[_0x6d6d('0x1d')](function(_0x589d64){_0x3a6d79=_0x589d64;return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0x3bf8a7){var _0x1aa25d=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x1efc55=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5b6ca7=ejs[_0x6d6d('0x6a')](_0x1aa25d,{'trunks':_0x3bf8a7||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x5b6ca7);if(_0x3a6d79[_0x6d6d('0x6d')]){var _0x2d4a04=ejs[_0x6d6d('0x6a')](_0x1efc55,{'trunks':_0x3bf8a7||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x2d4a04);}})[_0x6d6d('0x1d')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0x6d6d('0x1d')](function(){var _0x5cd494=_0x5dd3b0[_0x6d6d('0x5e')]['get']({'plain':!![]});if(!_0x5cd494)throw new Error(_0x6d6d('0x5f'));if(_0x5cd494[_0x6d6d('0x6e')]==='user'){var _0x52dca9=_0x3a6d79[_0x6d6d('0x36')]({'plain':!![]});return db[_0x6d6d('0x60')][_0x6d6d('0x58')]({'where':{'name':_0x6d6d('0x37'),'userProfileId':_0x5cd494['userProfileId']},'raw':!![]})[_0x6d6d('0x1d')](function(_0x264d24){if(_0x264d24&&_0x264d24[_0x6d6d('0x62')]===0x0){return db[_0x6d6d('0x38')]['create']({'name':_0x52dca9[_0x6d6d('0x41')],'resourceId':_0x52dca9['id'],'type':_0x264d24['name'],'sectionId':_0x264d24['id']},{})['then'](function(){return _0x3a6d79;});}else{return _0x3a6d79;}})['catch'](function(_0x3da125){logger['error'](_0x6d6d('0x63'),_0x3da125);throw _0x3da125;});}return _0x3a6d79;})[_0x6d6d('0x1d')](respondWithResult(_0x3cedc0,0xc9))[_0x6d6d('0x27')](handleError(_0x3cedc0,null));};exports['update']=function(_0x5146a4,_0x55d877,_0xcba8dd){var _0x542386;return db['Trunk'][_0x6d6d('0x58')]({'where':{'id':_0x5146a4[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x55d877,null))[_0x6d6d('0x1d')](saveUpdates(_0x5146a4[_0x6d6d('0x5d')],null))[_0x6d6d('0x1d')](function(_0x3f9aad){if(_0x3f9aad){_0x542386=_0x3f9aad;return db['Trunk']['findAll']({'raw':!![]});}})['then'](function(_0x5c20c5){if(_0x5c20c5){var _0x54bdef=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],_0x6d6d('0x68')),_0x6d6d('0x69'));var _0x59998e=fs['readFileSync'](path['join'](config[_0x6d6d('0x67')],_0x6d6d('0x6f')),_0x6d6d('0x69'));var _0x1c8d15=ejs['render'](_0x54bdef,{'trunks':_0x5c20c5||[]});fs['writeFileSync'](_0x6d6d('0x6c'),_0x1c8d15);var _0x1e1c4e=ejs['render'](_0x59998e,{'trunks':_0x5c20c5||[]});fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x1e1c4e);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x34'),{'module':_0x6d6d('0x72')});}return null;})['then'](function(_0xf5586f){if(_0xf5586f){return _0x542386;}})['then'](respondWithResult(_0x55d877,null))[_0x6d6d('0x27')](handleError(_0x55d877,null));};exports['destroy']=function(_0x108108,_0x54a5a9,_0x445196){var _0x1bfce6;return db[_0x6d6d('0x51')][_0x6d6d('0x58')]({'where':{'id':_0x108108[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x1d')](handleEntityNotFound(_0x54a5a9,null))[_0x6d6d('0x1d')](removeEntity(_0x54a5a9,null))[_0x6d6d('0x1d')](function(){return db[_0x6d6d('0x51')][_0x6d6d('0x54')]({'raw':!![]});})[_0x6d6d('0x1d')](function(_0xb2940d){var _0x7c1934=fs[_0x6d6d('0x65')](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/trunk.ejs'),'utf8');var _0x139b61=fs['readFileSync'](path[_0x6d6d('0x66')](config[_0x6d6d('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x1d2668=ejs['render'](_0x7c1934,{'trunks':_0xb2940d});var _0x2ab52f=ejs[_0x6d6d('0x6a')](_0x139b61,{'trunks':_0xb2940d});fs[_0x6d6d('0x6b')](_0x6d6d('0x6c'),_0x1d2668);fs[_0x6d6d('0x6b')](_0x6d6d('0x70'),_0x2ab52f);return respondWithRpcPromise(_0x6d6d('0x71'),_0x6d6d('0x35'),{'module':'chan_sip.so'});})[_0x6d6d('0x27')](handleError(_0x54a5a9,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index b501512..da79c78 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 _0x46cc=['rimraf','../../config/environment','exports','Trunk','tools_trunks','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5b6252,_0x7fa09e){var _0x10e8d4=function(_0x420d69){while(--_0x420d69){_0x5b6252['push'](_0x5b6252['shift']());}};_0x10e8d4(++_0x7fa09e);}(_0x46cc,0xeb));var _0xc46c=function(_0x31f433,_0x3026f4){_0x31f433=_0x31f433-0x0;var _0x185f84=_0x46cc[_0x31f433];return _0x185f84;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc46c('0x0'))('api');var moment=require(_0xc46c('0x1'));var BPromise=require(_0xc46c('0x2'));var rp=require(_0xc46c('0x3'));var fs=require('fs');var path=require(_0xc46c('0x4'));var rimraf=require(_0xc46c('0x5'));var config=require(_0xc46c('0x6'));var attributes=require('./trunk.attributes');module[_0xc46c('0x7')]=function(_0x358f1c,_0x3c88ad){return _0x358f1c['define'](_0xc46c('0x8'),attributes,{'tableName':_0xc46c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1fb=['exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0x2874c2,_0x1de2df){var _0x1624d2=function(_0x2857a2){while(--_0x2857a2){_0x2874c2['push'](_0x2874c2['shift']());}};_0x1624d2(++_0x1de2df);}(_0xd1fb,0xe5));var _0xbd1f=function(_0x4950a6,_0xb4845f){_0x4950a6=_0x4950a6-0x0;var _0x10f9a2=_0xd1fb[_0x4950a6];return _0x10f9a2;};'use strict';var _=require(_0xbd1f('0x0'));var util=require(_0xbd1f('0x1'));var logger=require(_0xbd1f('0x2'))(_0xbd1f('0x3'));var moment=require(_0xbd1f('0x4'));var BPromise=require(_0xbd1f('0x5'));var rp=require(_0xbd1f('0x6'));var fs=require('fs');var path=require(_0xbd1f('0x7'));var rimraf=require(_0xbd1f('0x8'));var config=require(_0xbd1f('0x9'));var attributes=require(_0xbd1f('0xa'));module[_0xbd1f('0xb')]=function(_0xd71db5,_0x5c0334){return _0xd71db5[_0xbd1f('0xc')](_0xbd1f('0xd'),attributes,{'tableName':_0xbd1f('0xe'),'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 e2042a6..c05a71e 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 _0x4975=['request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTrunk','Trunk','findAll','options','limit','include','map','model','attributes','stringify','find','raw','then','ShowTrunk','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Trunk,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4975,0xce));var _0x5497=function(_0x3f5a62,_0x20be66){_0x3f5a62=_0x3f5a62-0x0;var _0x49770c=_0x4975[_0x3f5a62];return _0x49770c;};'use strict';var _=require(_0x5497('0x0'));var util=require(_0x5497('0x1'));var moment=require(_0x5497('0x2'));var BPromise=require(_0x5497('0x3'));var rs=require(_0x5497('0x4'));var fs=require('fs');var Redis=require(_0x5497('0x5'));var db=require(_0x5497('0x6'))['db'];var utils=require(_0x5497('0x7'));var logger=require(_0x5497('0x8'))(_0x5497('0x9'));var config=require(_0x5497('0xa'));var jayson=require(_0x5497('0xb'));var client=jayson[_0x5497('0xc')][_0x5497('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1d2554,_0x5dc632,_0x16f1d9){return new BPromise(function(_0x4f8534,_0x3140a7){return client['request'](_0x1d2554,_0x16f1d9)['then'](function(_0x206a09){logger[_0x5497('0xe')](_0x5497('0xf'),_0x5dc632,_0x5497('0x10'));logger[_0x5497('0x11')](_0x5497('0x12'),_0x5dc632,_0x5497('0x10'),JSON['stringify'](_0x206a09));if(_0x206a09[_0x5497('0x13')]){if(_0x206a09[_0x5497('0x13')][_0x5497('0x14')]===0x1f4){logger[_0x5497('0x13')](_0x5497('0xf'),_0x5dc632,_0x206a09['error'][_0x5497('0x15')]);return _0x3140a7(_0x206a09[_0x5497('0x13')]['message']);}logger[_0x5497('0x13')]('Trunk,\x20%s,\x20%s',_0x5dc632,_0x206a09['error']['message']);return _0x4f8534(_0x206a09[_0x5497('0x13')][_0x5497('0x15')]);}else{logger[_0x5497('0xe')](_0x5497('0xf'),_0x5dc632,_0x5497('0x10'));_0x4f8534(_0x206a09['result'][_0x5497('0x15')]);}})[_0x5497('0x16')](function(_0x6e1fbf){logger[_0x5497('0x13')]('Trunk,\x20%s,\x20%s',_0x5dc632,_0x6e1fbf);_0x3140a7(_0x6e1fbf);});});}exports[_0x5497('0x17')]=function(_0x5e2df1){var _0x4b2c6d=this;return new Promise(function(_0x21df9f,_0x18c841){return db[_0x5497('0x18')][_0x5497('0x19')]({'raw':_0x5e2df1[_0x5497('0x1a')]?_0x5e2df1[_0x5497('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5e2df1['options']?_0x5e2df1[_0x5497('0x1a')]['where']||null:null,'attributes':_0x5e2df1[_0x5497('0x1a')]?_0x5e2df1[_0x5497('0x1a')]['attributes']||null:null,'limit':_0x5e2df1[_0x5497('0x1a')]?_0x5e2df1[_0x5497('0x1a')][_0x5497('0x1b')]||null:null,'include':_0x5e2df1['options']?_0x5e2df1[_0x5497('0x1a')][_0x5497('0x1c')]?_[_0x5497('0x1d')](_0x5e2df1['options'][_0x5497('0x1c')],function(_0x4c6e21){return{'model':db[_0x4c6e21[_0x5497('0x1e')]],'as':_0x4c6e21['as'],'attributes':_0x4c6e21[_0x5497('0x1f')],'include':_0x4c6e21[_0x5497('0x1c')]?_[_0x5497('0x1d')](_0x4c6e21[_0x5497('0x1c')],function(_0x1cc7d4){return{'model':db[_0x1cc7d4[_0x5497('0x1e')]],'as':_0x1cc7d4['as'],'attributes':_0x1cc7d4['attributes'],'include':_0x1cc7d4['include']?_[_0x5497('0x1d')](_0x1cc7d4['include'],function(_0x29d172){return{'model':db[_0x29d172[_0x5497('0x1e')]],'as':_0x29d172['as'],'attributes':_0x29d172[_0x5497('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c1664){logger[_0x5497('0xe')](_0x5497('0x17'),_0x5e2df1);logger[_0x5497('0x11')](_0x5497('0x17'),_0x5e2df1,JSON[_0x5497('0x20')](_0x3c1664));_0x21df9f(_0x3c1664);})[_0x5497('0x16')](function(_0x39e2b3){logger[_0x5497('0x13')](_0x5497('0x17'),_0x39e2b3[_0x5497('0x15')],_0x5e2df1);_0x18c841(_0x4b2c6d[_0x5497('0x13')](0x1f4,_0x39e2b3[_0x5497('0x15')]));});});};exports['ShowTrunk']=function(_0x5a01fa){var _0x4678d4=this;return new Promise(function(_0x182ce2,_0x225904){return db[_0x5497('0x18')][_0x5497('0x21')]({'raw':_0x5a01fa[_0x5497('0x1a')]?_0x5a01fa[_0x5497('0x1a')][_0x5497('0x22')]===undefined?!![]:![]:!![],'where':_0x5a01fa[_0x5497('0x1a')]?_0x5a01fa[_0x5497('0x1a')]['where']||null:null,'attributes':_0x5a01fa[_0x5497('0x1a')]?_0x5a01fa[_0x5497('0x1a')][_0x5497('0x1f')]||null:null,'include':_0x5a01fa[_0x5497('0x1a')]?_0x5a01fa[_0x5497('0x1a')][_0x5497('0x1c')]?_['map'](_0x5a01fa['options']['include'],function(_0x5b8d2b){return{'model':db[_0x5b8d2b['model']],'as':_0x5b8d2b['as'],'attributes':_0x5b8d2b[_0x5497('0x1f')],'include':_0x5b8d2b[_0x5497('0x1c')]?_[_0x5497('0x1d')](_0x5b8d2b[_0x5497('0x1c')],function(_0x52a191){return{'model':db[_0x52a191[_0x5497('0x1e')]],'as':_0x52a191['as'],'attributes':_0x52a191[_0x5497('0x1f')],'include':_0x52a191[_0x5497('0x1c')]?_[_0x5497('0x1d')](_0x52a191[_0x5497('0x1c')],function(_0x16a1a4){return{'model':db[_0x16a1a4[_0x5497('0x1e')]],'as':_0x16a1a4['as'],'attributes':_0x16a1a4[_0x5497('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5497('0x23')](function(_0x36a974){logger['info']('ShowTrunk',_0x5a01fa);logger['debug']('ShowTrunk',_0x5a01fa,JSON[_0x5497('0x20')](_0x36a974));_0x182ce2(_0x36a974);})['catch'](function(_0x3a4160){logger['error'](_0x5497('0x24'),_0x3a4160[_0x5497('0x15')],_0x5a01fa);_0x225904(_0x4678d4[_0x5497('0x13')](0x1f4,_0x3a4160[_0x5497('0x15')]));});});}; \ No newline at end of file +var _0xa543=['limit','include','map','model','debug','catch','ShowTrunk','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetTrunk','findAll','options','where','attributes'];(function(_0x2e1c99,_0x2b667a){var _0x3d5e7e=function(_0x142f29){while(--_0x142f29){_0x2e1c99['push'](_0x2e1c99['shift']());}};_0x3d5e7e(++_0x2b667a);}(_0xa543,0x167));var _0x3a54=function(_0x5c02f5,_0x545d10){_0x5c02f5=_0x5c02f5-0x0;var _0xe997ea=_0xa543[_0x5c02f5];return _0xe997ea;};'use strict';var _=require(_0x3a54('0x0'));var util=require(_0x3a54('0x1'));var moment=require(_0x3a54('0x2'));var BPromise=require(_0x3a54('0x3'));var rs=require(_0x3a54('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a54('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a54('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3a54('0x7'));var client=jayson[_0x3a54('0x8')][_0x3a54('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d4ca8,_0x2a8eda,_0x383451){return new BPromise(function(_0x3a3eb7,_0x5b7d02){return client[_0x3a54('0xa')](_0x2d4ca8,_0x383451)[_0x3a54('0xb')](function(_0x123b6d){logger[_0x3a54('0xc')](_0x3a54('0xd'),_0x2a8eda,'request\x20sent');logger['debug'](_0x3a54('0xe'),_0x2a8eda,_0x3a54('0xf'),JSON[_0x3a54('0x10')](_0x123b6d));if(_0x123b6d['error']){if(_0x123b6d[_0x3a54('0x11')][_0x3a54('0x12')]===0x1f4){logger[_0x3a54('0x11')](_0x3a54('0xd'),_0x2a8eda,_0x123b6d[_0x3a54('0x11')][_0x3a54('0x13')]);return _0x5b7d02(_0x123b6d[_0x3a54('0x11')][_0x3a54('0x13')]);}logger[_0x3a54('0x11')](_0x3a54('0xd'),_0x2a8eda,_0x123b6d[_0x3a54('0x11')][_0x3a54('0x13')]);return _0x3a3eb7(_0x123b6d[_0x3a54('0x11')][_0x3a54('0x13')]);}else{logger[_0x3a54('0xc')](_0x3a54('0xd'),_0x2a8eda,_0x3a54('0xf'));_0x3a3eb7(_0x123b6d[_0x3a54('0x14')][_0x3a54('0x13')]);}})['catch'](function(_0x63807){logger[_0x3a54('0x11')]('Trunk,\x20%s,\x20%s',_0x2a8eda,_0x63807);_0x5b7d02(_0x63807);});});}exports[_0x3a54('0x15')]=function(_0x53a464){var _0x3832e1=this;return new Promise(function(_0x1767fe,_0x1e4205){return db['Trunk'][_0x3a54('0x16')]({'raw':_0x53a464['options']?_0x53a464[_0x3a54('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x53a464[_0x3a54('0x17')]?_0x53a464[_0x3a54('0x17')][_0x3a54('0x18')]||null:null,'attributes':_0x53a464[_0x3a54('0x17')]?_0x53a464[_0x3a54('0x17')][_0x3a54('0x19')]||null:null,'limit':_0x53a464[_0x3a54('0x17')]?_0x53a464[_0x3a54('0x17')][_0x3a54('0x1a')]||null:null,'include':_0x53a464[_0x3a54('0x17')]?_0x53a464[_0x3a54('0x17')][_0x3a54('0x1b')]?_[_0x3a54('0x1c')](_0x53a464[_0x3a54('0x17')][_0x3a54('0x1b')],function(_0x438fe2){return{'model':db[_0x438fe2['model']],'as':_0x438fe2['as'],'attributes':_0x438fe2[_0x3a54('0x19')],'include':_0x438fe2[_0x3a54('0x1b')]?_[_0x3a54('0x1c')](_0x438fe2[_0x3a54('0x1b')],function(_0x227961){return{'model':db[_0x227961[_0x3a54('0x1d')]],'as':_0x227961['as'],'attributes':_0x227961[_0x3a54('0x19')],'include':_0x227961[_0x3a54('0x1b')]?_[_0x3a54('0x1c')](_0x227961[_0x3a54('0x1b')],function(_0x52580c){return{'model':db[_0x52580c['model']],'as':_0x52580c['as'],'attributes':_0x52580c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b46be){logger[_0x3a54('0xc')](_0x3a54('0x15'),_0x53a464);logger[_0x3a54('0x1e')](_0x3a54('0x15'),_0x53a464,JSON[_0x3a54('0x10')](_0x5b46be));_0x1767fe(_0x5b46be);})[_0x3a54('0x1f')](function(_0x71f013){logger[_0x3a54('0x11')](_0x3a54('0x15'),_0x71f013[_0x3a54('0x13')],_0x53a464);_0x1e4205(_0x3832e1[_0x3a54('0x11')](0x1f4,_0x71f013['message']));});});};exports[_0x3a54('0x20')]=function(_0x2b011a){var _0x30c689=this;return new Promise(function(_0x428d0e,_0x48cd4d){return db['Trunk'][_0x3a54('0x21')]({'raw':_0x2b011a[_0x3a54('0x17')]?_0x2b011a[_0x3a54('0x17')][_0x3a54('0x22')]===undefined?!![]:![]:!![],'where':_0x2b011a[_0x3a54('0x17')]?_0x2b011a[_0x3a54('0x17')][_0x3a54('0x18')]||null:null,'attributes':_0x2b011a['options']?_0x2b011a[_0x3a54('0x17')]['attributes']||null:null,'include':_0x2b011a[_0x3a54('0x17')]?_0x2b011a[_0x3a54('0x17')]['include']?_['map'](_0x2b011a[_0x3a54('0x17')][_0x3a54('0x1b')],function(_0x24ee39){return{'model':db[_0x24ee39[_0x3a54('0x1d')]],'as':_0x24ee39['as'],'attributes':_0x24ee39[_0x3a54('0x19')],'include':_0x24ee39[_0x3a54('0x1b')]?_[_0x3a54('0x1c')](_0x24ee39['include'],function(_0x5a3b00){return{'model':db[_0x5a3b00[_0x3a54('0x1d')]],'as':_0x5a3b00['as'],'attributes':_0x5a3b00[_0x3a54('0x19')],'include':_0x5a3b00[_0x3a54('0x1b')]?_['map'](_0x5a3b00[_0x3a54('0x1b')],function(_0x44a7f6){return{'model':db[_0x44a7f6['model']],'as':_0x44a7f6['as'],'attributes':_0x44a7f6[_0x3a54('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3a54('0xb')](function(_0x2df99a){logger[_0x3a54('0xc')]('ShowTrunk',_0x2b011a);logger[_0x3a54('0x1e')]('ShowTrunk',_0x2b011a,JSON[_0x3a54('0x10')](_0x2df99a));_0x428d0e(_0x2df99a);})['catch'](function(_0x417280){logger[_0x3a54('0x11')](_0x3a54('0x20'),_0x417280[_0x3a54('0x13')],_0x2b011a);_0x48cd4d(_0x30c689[_0x3a54('0x11')](0x1f4,_0x417280[_0x3a54('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 67c2164..2738df3 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 _0x6f5b=['Router','./user-setting.controller','put','isAuthenticated','exports','express'];(function(_0x61ba8d,_0x23fe21){var _0x1e6f08=function(_0xbc809b){while(--_0xbc809b){_0x61ba8d['push'](_0x61ba8d['shift']());}};_0x1e6f08(++_0x23fe21);}(_0x6f5b,0xef));var _0xb6f5=function(_0x3f84a6,_0x1039bb){_0x3f84a6=_0x3f84a6-0x0;var _0x2727c8=_0x6f5b[_0x3f84a6];return _0x2727c8;};'use strict';var express=require(_0xb6f5('0x0'));var router=express[_0xb6f5('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xb6f5('0x2'));router[_0xb6f5('0x3')]('/:id',auth[_0xb6f5('0x4')](),controller['update']);module[_0xb6f5('0x5')]=router; \ No newline at end of file +var _0xed05=['../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update','exports','express','Router'];(function(_0x20f200,_0x146614){var _0x5b7169=function(_0x1a01da){while(--_0x1a01da){_0x20f200['push'](_0x20f200['shift']());}};_0x5b7169(++_0x146614);}(_0xed05,0xcd));var _0x5ed0=function(_0x2bb47a,_0xd334f7){_0x2bb47a=_0x2bb47a-0x0;var _0x510f5d=_0xed05[_0x2bb47a];return _0x510f5d;};'use strict';var express=require(_0x5ed0('0x0'));var router=express[_0x5ed0('0x1')]();var auth=require(_0x5ed0('0x2'));var controller=require(_0x5ed0('0x3'));router[_0x5ed0('0x4')](_0x5ed0('0x5'),auth[_0x5ed0('0x6')](),controller[_0x5ed0('0x7')]);module[_0x5ed0('0x8')]=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 ebd59b9..495b992 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 _0xa9e0=['exports','BOOLEAN','DATE','sequelize','error','warning'];(function(_0x45403b,_0x5b8ceb){var _0xf66330=function(_0x54ca09){while(--_0x54ca09){_0x45403b['push'](_0x45403b['shift']());}};_0xf66330(++_0x5b8ceb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var Sequelize=require(_0x0a9e('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x0a9e('0x1'),_0x0a9e('0x2'),'info','debug'];module[_0x0a9e('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x0a9e('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xa9e0=['exports','BOOLEAN','DATE','sequelize','error','warning'];(function(_0xa4db92,_0x1a07e3){var _0x403706=function(_0x30e61d){while(--_0x30e61d){_0xa4db92['push'](_0xa4db92['shift']());}};_0x403706(++_0x1a07e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var Sequelize=require(_0x0a9e('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x0a9e('0x1'),_0x0a9e('0x2'),'info','debug'];module[_0x0a9e('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x0a9e('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':!![],'defaultValue':null}}; \ 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 df3cd13..277298e 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 _0x833b=['Unauthorized','params','UserSetting','find','then','catch','ioredis','api','../../mysqldb','redis','./user-setting.socket','register','defaults','localhost','status','json','update','sendStatus','stack','name','user','role','admin'];(function(_0x4a2079,_0x4c3f4f){var _0x1c8f5f=function(_0x4dd1fa){while(--_0x4dd1fa){_0x4a2079['push'](_0x4a2079['shift']());}};_0x1c8f5f(++_0x4c3f4f);}(_0x833b,0x131));var _0xb833=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x833b[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require('lodash');var Redis=require(_0xb833('0x0'));var logger=require('../../config/logger')(_0xb833('0x1'));var config=require('../../config/environment');var db=require(_0xb833('0x2'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xb833('0x3')]));require(_0xb833('0x4'))[_0xb833('0x5')](socket);config[_0xb833('0x3')]=_[_0xb833('0x6')](config[_0xb833('0x3')],{'host':_0xb833('0x7'),'port':0x18eb});function respondWithResult(_0x4eaff4,_0x3afa71){_0x3afa71=_0x3afa71||0xc8;return function(_0xb60891){if(_0xb60891){return _0x4eaff4[_0xb833('0x8')](_0x3afa71)[_0xb833('0x9')](_0xb60891);}};}function saveUpdates(_0x3b74c4){return function(_0x20aae5){if(_0x20aae5){return _0x20aae5[_0xb833('0xa')](_0x3b74c4)['then'](function(_0x1660db){return _0x1660db;});}return null;};}function handleEntityNotFound(_0x579a68){return function(_0x55ab06){if(!_0x55ab06){_0x579a68[_0xb833('0xb')](0x194);}return _0x55ab06;};}function handleError(_0x261561,_0x193b4d){_0x193b4d=_0x193b4d||0x1f4;return function(_0x492017){logger['error'](_0x492017[_0xb833('0xc')]);if(_0x492017[_0xb833('0xd')]){delete _0x492017['name'];}_0x261561[_0xb833('0x8')](_0x193b4d)['send'](_0x492017);};}exports[_0xb833('0xa')]=function(_0x1622a8,_0x920804){if(_0x1622a8[_0xb833('0xe')][_0xb833('0xf')]!==_0xb833('0x10'))throw new Error(_0xb833('0x11'));if(isNaN(Number(_0x1622a8[_0xb833('0x12')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0xb833('0x13')][_0xb833('0x14')]({'where':{'id':_0x1622a8['params']['id']}})['then'](handleEntityNotFound(_0x920804,null))[_0xb833('0x15')](saveUpdates(_0x1622a8['body'],null))[_0xb833('0x15')](respondWithResult(_0x920804,null))[_0xb833('0x16')](handleError(_0x920804,null));}; \ No newline at end of file +var _0xb32d=['admin','Unauthorized','params','UserSetting','find','catch','lodash','ioredis','../../config/logger','api','../../config/environment','redis','./user-setting.socket','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send','user','role'];(function(_0x429e40,_0x16e27e){var _0xfda349=function(_0x4e0a5e){while(--_0x4e0a5e){_0x429e40['push'](_0x429e40['shift']());}};_0xfda349(++_0x16e27e);}(_0xb32d,0x1da));var _0xdb32=function(_0x55d0fd,_0x1b1bdd){_0x55d0fd=_0x55d0fd-0x0;var _0x40ce6f=_0xb32d[_0x55d0fd];return _0x40ce6f;};'use strict';var _=require(_0xdb32('0x0'));var Redis=require(_0xdb32('0x1'));var logger=require(_0xdb32('0x2'))(_0xdb32('0x3'));var config=require(_0xdb32('0x4'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xdb32('0x5')]));require(_0xdb32('0x6'))['register'](socket);config[_0xdb32('0x5')]=_[_0xdb32('0x7')](config[_0xdb32('0x5')],{'host':_0xdb32('0x8'),'port':0x18eb});function respondWithResult(_0x6f4af0,_0x386309){_0x386309=_0x386309||0xc8;return function(_0x5bb076){if(_0x5bb076){return _0x6f4af0[_0xdb32('0x9')](_0x386309)[_0xdb32('0xa')](_0x5bb076);}};}function saveUpdates(_0xbe779d){return function(_0x1deacb){if(_0x1deacb){return _0x1deacb[_0xdb32('0xb')](_0xbe779d)[_0xdb32('0xc')](function(_0x112db6){return _0x112db6;});}return null;};}function handleEntityNotFound(_0x3ddfc6){return function(_0x251443){if(!_0x251443){_0x3ddfc6[_0xdb32('0xd')](0x194);}return _0x251443;};}function handleError(_0x296482,_0x2c3355){_0x2c3355=_0x2c3355||0x1f4;return function(_0x91be02){logger[_0xdb32('0xe')](_0x91be02[_0xdb32('0xf')]);if(_0x91be02[_0xdb32('0x10')]){delete _0x91be02[_0xdb32('0x10')];}_0x296482[_0xdb32('0x9')](_0x2c3355)[_0xdb32('0x11')](_0x91be02);};}exports[_0xdb32('0xb')]=function(_0x410b23,_0x5e4377){if(_0x410b23[_0xdb32('0x12')][_0xdb32('0x13')]!==_0xdb32('0x14'))throw new Error(_0xdb32('0x15'));if(isNaN(Number(_0x410b23[_0xdb32('0x16')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0xdb32('0x17')][_0xdb32('0x18')]({'where':{'id':_0x410b23[_0xdb32('0x16')]['id']}})['then'](handleEntityNotFound(_0x5e4377,null))['then'](saveUpdates(_0x410b23['body'],null))['then'](respondWithResult(_0x5e4377,null))[_0xdb32('0x19')](handleError(_0x5e4377,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 62b8bfa..0e85e3d 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 _0x2053=['../../mysqldb','UserSetting','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x1498e2,_0x1e630f){var _0x45a3d0=function(_0x3905cc){while(--_0x3905cc){_0x1498e2['push'](_0x1498e2['shift']());}};_0x45a3d0(++_0x1e630f);}(_0x2053,0x7d));var _0x3205=function(_0x46002e,_0x45b1e7){_0x46002e=_0x46002e-0x0;var _0x139993=_0x2053[_0x46002e];return _0x139993;};'use strict';var EventEmitter=require(_0x3205('0x0'));var UserSetting=require(_0x3205('0x1'))['db'][_0x3205('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x3205('0x3')](0x0);var events={'afterCreate':_0x3205('0x4'),'afterUpdate':'update','afterDestroy':_0x3205('0x5')};function emitEvent(_0xa31abd){return function(_0x2b3a3b,_0x38308f,_0x5a537a){UserSettingEvents[_0x3205('0x6')](_0xa31abd+':'+_0x2b3a3b['id'],_0x2b3a3b);UserSettingEvents[_0x3205('0x6')](_0xa31abd,_0x2b3a3b);_0x5a537a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x3205('0x7')](e,emitEvent(event));}}module[_0x3205('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x0b3e=['update','remove','emit','hasOwnProperty','events','../../mysqldb','UserSetting','setMaxListeners'];(function(_0x270930,_0x5169ca){var _0x2220ca=function(_0xe36c18){while(--_0xe36c18){_0x270930['push'](_0x270930['shift']());}};_0x2220ca(++_0x5169ca);}(_0x0b3e,0x114));var _0xe0b3=function(_0x4501a5,_0xaa8ce7){_0x4501a5=_0x4501a5-0x0;var _0x1ae352=_0x0b3e[_0x4501a5];return _0x1ae352;};'use strict';var EventEmitter=require(_0xe0b3('0x0'));var UserSetting=require(_0xe0b3('0x1'))['db'][_0xe0b3('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xe0b3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe0b3('0x4'),'afterDestroy':_0xe0b3('0x5')};function emitEvent(_0x3529a9){return function(_0xe43f61,_0x3989b1,_0x204600){UserSettingEvents[_0xe0b3('0x6')](_0x3529a9+':'+_0xe43f61['id'],_0xe43f61);UserSettingEvents[_0xe0b3('0x6')](_0x3529a9,_0xe43f61);_0x204600(null);};}for(var e in events){if(events[_0xe0b3('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 5a04bb7..2dc22ad 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 _0x4e81=['./user-setting.attributes','exports','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x1d930e,_0x20d8b8){var _0x5bbd66=function(_0x3c7488){while(--_0x3c7488){_0x1d930e['push'](_0x1d930e['shift']());}};_0x5bbd66(++_0x20d8b8);}(_0x4e81,0x1bc));var _0x14e8=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x4e81[_0x396466];return _0x5e9ab4;};'use strict';var attributes=require(_0x14e8('0x0'));module[_0x14e8('0x1')]=function(_0x354aac){return _0x354aac['define']('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2184fc){if(!_0x2184fc[_0x14e8('0x2')])_0x2184fc[_0x14e8('0x3')]=null;else if(_0x2184fc[_0x14e8('0x3')]===null)_0x2184fc[_0x14e8('0x3')]=new Date();}}});}; \ No newline at end of file +var _0x4f3c=['exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x4f3c,0x15d));var _0xc4f3=function(_0x20e7e3,_0x1529be){_0x20e7e3=_0x20e7e3-0x0;var _0x14b9de=_0x4f3c[_0x20e7e3];return _0x14b9de;};'use strict';var attributes=require(_0xc4f3('0x0'));module[_0xc4f3('0x1')]=function(_0x362124){return _0x362124[_0xc4f3('0x2')](_0xc4f3('0x3'),attributes,{'tableName':_0xc4f3('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8261e6){if(!_0x8261e6[_0xc4f3('0x5')])_0x8261e6[_0xc4f3('0x6')]=null;else if(_0x8261e6[_0xc4f3('0x6')]===null)_0x8261e6['clientSideLoggingEnabledSince']=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 dc0ea33..a6a5478 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 _0x0ee2=['user-setting:update','register','user-setting:','emit'];(function(_0x20d30f,_0x5c8825){var _0x4c8ae3=function(_0x28f39d){while(--_0x28f39d){_0x20d30f['push'](_0x20d30f['shift']());}};_0x4c8ae3(++_0x5c8825);}(_0x0ee2,0x1ef));var _0x20ee=function(_0x4548a9,_0xef87f5){_0x4548a9=_0x4548a9-0x0;var _0x3712b3=_0x0ee2[_0x4548a9];return _0x3712b3;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save','remove','update'];function createListener(_0x4fa2ff,_0x263c8e){return function(_0x639e46){_0x263c8e[_0x20ee('0x0')](_0x4fa2ff,_0x639e46);if(_0x4fa2ff===_0x20ee('0x1')){_0x263c8e[_0x20ee('0x0')]('user-setting:update:user-'+_0x639e46['UserId'],_0x639e46);}};}exports[_0x20ee('0x2')]=function(_0x1fc1a3){for(var _0x4c6105=0x0,_0x40012b=events['length'];_0x4c6105<_0x40012b;_0x4c6105++){var _0x570bd9=events[_0x4c6105];var _0x4732a7=createListener(_0x20ee('0x3')+_0x570bd9,_0x1fc1a3);UserSettingEvents['on'](_0x570bd9,_0x4732a7);}}; \ No newline at end of file +var _0x0f7a=['length','user-setting:','./user-setting.events','save','remove','emit','user-setting:update:user-','UserId','register'];(function(_0x56ff5e,_0x257c79){var _0x26d7c6=function(_0x3cd248){while(--_0x3cd248){_0x56ff5e['push'](_0x56ff5e['shift']());}};_0x26d7c6(++_0x257c79);}(_0x0f7a,0x1bb));var _0xa0f7=function(_0x5b7030,_0x387b0b){_0x5b7030=_0x5b7030-0x0;var _0x198515=_0x0f7a[_0x5b7030];return _0x198515;};'use strict';var UserSettingEvents=require(_0xa0f7('0x0'));var events=[_0xa0f7('0x1'),_0xa0f7('0x2'),'update'];function createListener(_0x36b22b,_0xb28ee2){return function(_0xe8ecb5){_0xb28ee2[_0xa0f7('0x3')](_0x36b22b,_0xe8ecb5);if(_0x36b22b==='user-setting:update'){_0xb28ee2[_0xa0f7('0x3')](_0xa0f7('0x4')+_0xe8ecb5[_0xa0f7('0x5')],_0xe8ecb5);}};}exports[_0xa0f7('0x6')]=function(_0x508ed3){for(var _0x331fd2=0x0,_0x3f57e9=events[_0xa0f7('0x7')];_0x331fd2<_0x3f57e9;_0x331fd2++){var _0x5451e7=events[_0x331fd2];var _0x4b876d=createListener(_0xa0f7('0x8')+_0x5451e7,_0x508ed3);UserSettingEvents['on'](_0x5451e7,_0x4b876d);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 0fbe796..ee03a98 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 _0xbaee=['getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/api_key','getApiKey','post','addContacts','create','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','addAvatar','/:id/login','login','logout','/:id/pause','pause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/fax_accounts','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','put','update','/:id/password','changePassword','delete','removeQueues','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','/:id/sms_accounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','isAuthenticated','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes'];(function(_0x172948,_0x4262cc){var _0x4aeaa9=function(_0x5ec4b3){while(--_0x5ec4b3){_0x172948['push'](_0x172948['shift']());}};_0x4aeaa9(++_0x4262cc);}(_0xbaee,0x12b));var _0xebae=function(_0x162fa2,_0x3fc59e){_0x162fa2=_0x162fa2-0x0;var _0x32f21c=_0xbaee[_0x162fa2];return _0x32f21c;};'use strict';var multer=require(_0xebae('0x0'));var util=require(_0xebae('0x1'));var path=require(_0xebae('0x2'));var timeout=require(_0xebae('0x3'));var express=require(_0xebae('0x4'));var router=express[_0xebae('0x5')]();var fs_extra=require(_0xebae('0x6'));var auth=require(_0xebae('0x7'));var interaction=require(_0xebae('0x8'));var config=require(_0xebae('0x9'));var controller=require('./user.controller');router[_0xebae('0xa')]('/',auth['isAuthenticated'](),controller[_0xebae('0xb')]);router[_0xebae('0xa')](_0xebae('0xc'),auth['isAuthenticated'](),controller[_0xebae('0xd')]);router[_0xebae('0xa')]('/whoami',auth['isAuthenticated'](),controller[_0xebae('0xe')]);router[_0xebae('0xa')](_0xebae('0xf'),auth['isAuthenticated'](),controller[_0xebae('0x10')]);router['get'](_0xebae('0x11'),auth['isAuthenticated'](),controller[_0xebae('0x12')]);router['get'](_0xebae('0x13'),controller[_0xebae('0x14')]);router['get'](_0xebae('0x15'),auth[_0xebae('0x16')](),controller[_0xebae('0x17')]);router[_0xebae('0xa')](_0xebae('0x18'),auth[_0xebae('0x16')](),controller[_0xebae('0x19')]);router['get'](_0xebae('0x1a'),auth[_0xebae('0x16')](),controller[_0xebae('0x1b')]);router['get'](_0xebae('0x1c'),auth['isAuthenticated'](),controller[_0xebae('0x1d')]);router[_0xebae('0xa')](_0xebae('0x1e'),auth[_0xebae('0x16')](),controller['getGroups']);router[_0xebae('0xa')](_0xebae('0x1f'),auth['isAuthenticated'](),controller[_0xebae('0x20')]);router[_0xebae('0xa')](_0xebae('0x21'),auth[_0xebae('0x16')](),controller[_0xebae('0x22')]);router[_0xebae('0xa')]('/:id/chat/interactions',auth[_0xebae('0x16')](),controller[_0xebae('0x23')]);router[_0xebae('0xa')](_0xebae('0x24'),auth[_0xebae('0x16')](),controller[_0xebae('0x25')]);router[_0xebae('0xa')](_0xebae('0x26'),auth[_0xebae('0x16')](),controller[_0xebae('0x27')]);router[_0xebae('0xa')](_0xebae('0x28'),auth[_0xebae('0x16')](),controller[_0xebae('0x29')]);router['get'](_0xebae('0x2a'),auth[_0xebae('0x16')](),controller[_0xebae('0x2b')]);router['get'](_0xebae('0x2c'),auth[_0xebae('0x16')](),controller[_0xebae('0x2d')]);router[_0xebae('0xa')]('/:id/teams',auth[_0xebae('0x16')](),controller[_0xebae('0x2e')]);router[_0xebae('0xa')](_0xebae('0x2f'),auth[_0xebae('0x16')](),controller[_0xebae('0x30')]);router['get']('/:id/agents',auth[_0xebae('0x16')](),controller[_0xebae('0x31')]);router[_0xebae('0xa')](_0xebae('0x32'),auth[_0xebae('0x16')](),controller[_0xebae('0x33')]);router[_0xebae('0xa')]('/:id/fax_accounts',auth[_0xebae('0x16')](),controller[_0xebae('0x34')]);router[_0xebae('0xa')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xebae('0x35')]);router[_0xebae('0xa')](_0xebae('0x36'),auth[_0xebae('0x16')](),controller[_0xebae('0x37')]);router['get']('/:id/sms_accounts',auth[_0xebae('0x16')](),controller[_0xebae('0x38')]);router['get'](_0xebae('0x39'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0xebae('0xa')](_0xebae('0x3a'),auth[_0xebae('0x16')](),controller[_0xebae('0x3b')]);router[_0xebae('0xa')](_0xebae('0x3c'),auth[_0xebae('0x16')](),controller[_0xebae('0x3d')]);router[_0xebae('0xa')]('/:id/scheduled_calls',auth[_0xebae('0x16')](),controller['getScheduledCalls']);router[_0xebae('0xa')](_0xebae('0x3e'),auth[_0xebae('0x16')](),controller[_0xebae('0x3f')]);router[_0xebae('0x40')](_0xebae('0x18'),auth[_0xebae('0x16')](),controller[_0xebae('0x41')]);router[_0xebae('0x40')]('/',auth[_0xebae('0x16')](),controller[_0xebae('0x42')]);router[_0xebae('0x40')]('/create_many',auth[_0xebae('0x16')](),controller['bulkCreate']);router['post']('/:id/queues',auth[_0xebae('0x16')](),controller[_0xebae('0x43')]);var upload=multer({'storage':multer[_0xebae('0x44')]({'destination':function(_0x262b62,_0x265e62,_0x57d93c){_0x57d93c(null,path[_0xebae('0x45')](config[_0xebae('0x46')],_0xebae('0x47')));},'filename':function(_0x1bb975,_0x1ca403,_0x4395fe){_0x4395fe(null,util[_0xebae('0x48')](_0xebae('0x49'),Date[_0xebae('0x4a')](),_0x1ca403['originalname']));}})});router['post']('/:id/avatar',upload['single']('file'),controller[_0xebae('0x4b')]);router['post'](_0xebae('0x4c'),auth[_0xebae('0x16')](),controller[_0xebae('0x4d')]);router[_0xebae('0x40')]('/:id/logout',auth[_0xebae('0x16')](),controller[_0xebae('0x4e')]);router[_0xebae('0x40')](_0xebae('0x4f'),auth[_0xebae('0x16')](),controller[_0xebae('0x50')]);router[_0xebae('0x40')]('/:id/unpause',auth[_0xebae('0x16')](),controller[_0xebae('0x51')]);router[_0xebae('0x40')](_0xebae('0x52'),auth[_0xebae('0x16')](),controller[_0xebae('0x53')]);router['post'](_0xebae('0x54'),auth[_0xebae('0x16')](),controller[_0xebae('0x55')]);router[_0xebae('0x40')](_0xebae('0x56'),auth[_0xebae('0x16')](),controller['addMailInteractions']);router[_0xebae('0x40')](_0xebae('0x57'),auth['isAuthenticated'](),controller[_0xebae('0x58')]);router[_0xebae('0x40')](_0xebae('0x59'),auth[_0xebae('0x16')](),controller[_0xebae('0x5a')]);router[_0xebae('0x40')](_0xebae('0x5b'),auth[_0xebae('0x16')](),controller[_0xebae('0x5c')]);router[_0xebae('0x40')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0xebae('0x40')](_0xebae('0x5d'),auth[_0xebae('0x16')](),controller[_0xebae('0x5e')]);router['post'](_0xebae('0x5f'),auth[_0xebae('0x16')](),controller[_0xebae('0x60')]);router[_0xebae('0x40')](_0xebae('0x36'),auth[_0xebae('0x16')](),controller[_0xebae('0x61')]);router[_0xebae('0x40')]('/:id/sms_accounts',auth[_0xebae('0x16')](),controller['addSmsAccounts']);router[_0xebae('0x40')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xebae('0x62')]);router[_0xebae('0x40')](_0xebae('0x3a'),auth['isAuthenticated'](),controller[_0xebae('0x63')]);router['post'](_0xebae('0x3c'),auth[_0xebae('0x16')](),controller['addSquareProjects']);router['post'](_0xebae('0x3e'),auth[_0xebae('0x16')](),controller['createApiKey']);router[_0xebae('0x64')](_0xebae('0x11'),auth['isAuthenticated'](),controller[_0xebae('0x65')]);router[_0xebae('0x64')](_0xebae('0x66'),auth[_0xebae('0x16')](),controller[_0xebae('0x67')]);router[_0xebae('0x68')]('/:id/queues',auth[_0xebae('0x16')](),controller[_0xebae('0x69')]);router[_0xebae('0x68')](_0xebae('0x52'),auth[_0xebae('0x16')](),controller['removeTeams']);router[_0xebae('0x68')]('/:id',auth[_0xebae('0x16')](),controller[_0xebae('0x6a')]);router[_0xebae('0x68')](_0xebae('0x54'),auth['isAuthenticated'](),controller[_0xebae('0x6b')]);router['delete'](_0xebae('0x56'),auth['isAuthenticated'](),controller[_0xebae('0x6c')]);router[_0xebae('0x68')]('/:id/fax_interactions',auth[_0xebae('0x16')](),controller[_0xebae('0x6d')]);router[_0xebae('0x68')]('/:id/sms_interactions',auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0xebae('0x68')](_0xebae('0x5b'),auth[_0xebae('0x16')](),controller[_0xebae('0x6e')]);router['delete'](_0xebae('0x6f'),auth[_0xebae('0x16')](),controller[_0xebae('0x70')]);router[_0xebae('0x68')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0xebae('0x68')](_0xebae('0x5f'),auth[_0xebae('0x16')](),controller['removeMailAccounts']);router[_0xebae('0x68')](_0xebae('0x36'),auth[_0xebae('0x16')](),controller['removeOpenchannelAccounts']);router[_0xebae('0x68')](_0xebae('0x71'),auth[_0xebae('0x16')](),controller['removeSmsAccounts']);router['delete'](_0xebae('0x39'),auth[_0xebae('0x16')](),controller[_0xebae('0x72')]);router[_0xebae('0x68')](_0xebae('0x3a'),auth[_0xebae('0x16')](),controller[_0xebae('0x73')]);router['delete'](_0xebae('0x3c'),auth[_0xebae('0x16')](),controller['removeSquareProjects']);router[_0xebae('0x68')]('/:id/api_key',auth[_0xebae('0x16')](),controller[_0xebae('0x74')]);module['exports']=router; \ No newline at end of file +var _0xa23a=['/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','originalname','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','removeQueues','delete','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','whoami','getPresence','/:id','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','/:id/agents','/:id/prefixes','getVoicePrefixes'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xa23a,0x1b4));var _0xaa23=function(_0x1b9a9f,_0x482c35){_0x1b9a9f=_0x1b9a9f-0x0;var _0x2552fd=_0xa23a[_0x1b9a9f];return _0x2552fd;};'use strict';var multer=require(_0xaa23('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaa23('0x1'));var express=require(_0xaa23('0x2'));var router=express[_0xaa23('0x3')]();var fs_extra=require(_0xaa23('0x4'));var auth=require(_0xaa23('0x5'));var interaction=require(_0xaa23('0x6'));var config=require(_0xaa23('0x7'));var controller=require(_0xaa23('0x8'));router[_0xaa23('0x9')]('/',auth[_0xaa23('0xa')](),controller[_0xaa23('0xb')]);router[_0xaa23('0x9')](_0xaa23('0xc'),auth[_0xaa23('0xa')](),controller['describe']);router['get'](_0xaa23('0xd'),auth[_0xaa23('0xa')](),controller[_0xaa23('0xe')]);router['get']('/presence',auth['isAuthenticated'](),controller[_0xaa23('0xf')]);router[_0xaa23('0x9')](_0xaa23('0x10'),auth[_0xaa23('0xa')](),controller['show']);router[_0xaa23('0x9')](_0xaa23('0x11'),controller[_0xaa23('0x12')]);router['get']('/:id/open_tabs',auth[_0xaa23('0xa')](),controller[_0xaa23('0x13')]);router['get'](_0xaa23('0x14'),auth[_0xaa23('0xa')](),controller['getContacts']);router[_0xaa23('0x9')](_0xaa23('0x15'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x16')]);router[_0xaa23('0x9')](_0xaa23('0x17'),auth['isAuthenticated'](),controller[_0xaa23('0x18')]);router[_0xaa23('0x9')]('/:id/groups',auth[_0xaa23('0xa')](),controller[_0xaa23('0x19')]);router[_0xaa23('0x9')](_0xaa23('0x1a'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x1b')]);router[_0xaa23('0x9')](_0xaa23('0x1c'),auth['isAuthenticated'](),controller[_0xaa23('0x1d')]);router[_0xaa23('0x9')](_0xaa23('0x1e'),auth['isAuthenticated'](),controller[_0xaa23('0x1f')]);router[_0xaa23('0x9')]('/:id/openchannel/interactions',auth[_0xaa23('0xa')](),controller['getOpenchannelInteractions']);router['get'](_0xaa23('0x20'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x21')]);router[_0xaa23('0x9')](_0xaa23('0x22'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x23')]);router[_0xaa23('0x9')](_0xaa23('0x24'),auth[_0xaa23('0xa')](),controller['getFaxInteractions']);router['get'](_0xaa23('0x25'),auth[_0xaa23('0xa')](),controller['getWhatsappInteractions']);router[_0xaa23('0x9')](_0xaa23('0x26'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x27')]);router[_0xaa23('0x9')](_0xaa23('0x28'),auth[_0xaa23('0xa')](),controller['getLists']);router[_0xaa23('0x9')](_0xaa23('0x29'),auth[_0xaa23('0xa')](),controller['getAgents']);router[_0xaa23('0x9')](_0xaa23('0x2a'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x2b')]);router['get']('/:id/fax_accounts',auth[_0xaa23('0xa')](),controller['getFaxAccounts']);router['get'](_0xaa23('0x2c'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x2d')]);router[_0xaa23('0x9')](_0xaa23('0x2e'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x2f')]);router[_0xaa23('0x9')](_0xaa23('0x30'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x31')]);router[_0xaa23('0x9')]('/:id/chat_websites',auth[_0xaa23('0xa')](),controller[_0xaa23('0x32')]);router[_0xaa23('0x9')](_0xaa23('0x33'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x34')]);router['get']('/:id/square_projects',auth['isAuthenticated'](),controller['getSquareProjects']);router['get'](_0xaa23('0x35'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x36')]);router['get']('/:id/api_key',auth[_0xaa23('0xa')](),controller[_0xaa23('0x37')]);router[_0xaa23('0x38')]('/:id/contacts',auth[_0xaa23('0xa')](),controller[_0xaa23('0x39')]);router[_0xaa23('0x38')]('/',auth[_0xaa23('0xa')](),controller[_0xaa23('0x3a')]);router['post'](_0xaa23('0x3b'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x3c')]);router[_0xaa23('0x38')](_0xaa23('0x15'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x3d')]);var upload=multer({'storage':multer[_0xaa23('0x3e')]({'destination':function(_0x48cbae,_0x2519d1,_0xc2355){_0xc2355(null,path[_0xaa23('0x3f')](config[_0xaa23('0x40')],_0xaa23('0x41')));},'filename':function(_0x178127,_0x486753,_0x16bb22){_0x16bb22(null,util[_0xaa23('0x42')](_0xaa23('0x43'),Date['now'](),_0x486753[_0xaa23('0x44')]));}})});router[_0xaa23('0x38')]('/:id/avatar',upload[_0xaa23('0x45')]('file'),controller[_0xaa23('0x46')]);router[_0xaa23('0x38')](_0xaa23('0x47'),auth['isAuthenticated'](),controller[_0xaa23('0x48')]);router[_0xaa23('0x38')](_0xaa23('0x49'),auth['isAuthenticated'](),controller[_0xaa23('0x4a')]);router[_0xaa23('0x38')](_0xaa23('0x4b'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x4c')]);router['post'](_0xaa23('0x4d'),auth['isAuthenticated'](),controller[_0xaa23('0x4e')]);router[_0xaa23('0x38')](_0xaa23('0x26'),auth['isAuthenticated'](),controller[_0xaa23('0x4f')]);router['post'](_0xaa23('0x50'),auth['isAuthenticated'](),controller[_0xaa23('0x51')]);router['post'](_0xaa23('0x52'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x53')]);router[_0xaa23('0x38')](_0xaa23('0x54'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x55')]);router[_0xaa23('0x38')](_0xaa23('0x56'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x57')]);router[_0xaa23('0x38')](_0xaa23('0x58'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x59')]);router['post'](_0xaa23('0x5a'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x5b')]);router[_0xaa23('0x38')](_0xaa23('0x5c'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x5d')]);router[_0xaa23('0x38')](_0xaa23('0x2c'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x5e')]);router[_0xaa23('0x38')](_0xaa23('0x2e'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x5f')]);router[_0xaa23('0x38')](_0xaa23('0x30'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x60')]);router['post']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xaa23('0x61')]);router[_0xaa23('0x38')](_0xaa23('0x33'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x62')]);router[_0xaa23('0x38')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0xaa23('0x63')]);router['post'](_0xaa23('0x64'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x65')]);router[_0xaa23('0x66')](_0xaa23('0x10'),auth[_0xaa23('0xa')](),controller['update']);router[_0xaa23('0x66')]('/:id/password',auth['isAuthenticated'](),controller['changePassword']);router['delete'](_0xaa23('0x15'),auth['isAuthenticated'](),controller[_0xaa23('0x67')]);router[_0xaa23('0x68')](_0xaa23('0x26'),auth['isAuthenticated'](),controller[_0xaa23('0x69')]);router[_0xaa23('0x68')]('/:id',auth[_0xaa23('0xa')](),controller[_0xaa23('0x6a')]);router[_0xaa23('0x68')](_0xaa23('0x50'),auth[_0xaa23('0xa')](),controller['removeChatInteractions']);router['delete'](_0xaa23('0x52'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x6b')]);router[_0xaa23('0x68')](_0xaa23('0x54'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x6c')]);router[_0xaa23('0x68')]('/:id/sms_interactions',auth[_0xaa23('0xa')](),controller[_0xaa23('0x6d')]);router[_0xaa23('0x68')](_0xaa23('0x58'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x6e')]);router[_0xaa23('0x68')](_0xaa23('0x5a'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x6f')]);router[_0xaa23('0x68')](_0xaa23('0x5c'),auth['isAuthenticated'](),controller[_0xaa23('0x70')]);router[_0xaa23('0x68')](_0xaa23('0x2c'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x71')]);router['delete']('/:id/openchannel_accounts',auth[_0xaa23('0xa')](),controller[_0xaa23('0x72')]);router['delete'](_0xaa23('0x30'),auth[_0xaa23('0xa')](),controller[_0xaa23('0x73')]);router[_0xaa23('0x68')](_0xaa23('0x74'),auth['isAuthenticated'](),controller[_0xaa23('0x75')]);router[_0xaa23('0x68')]('/:id/whatsapp_accounts',auth[_0xaa23('0xa')](),controller[_0xaa23('0x76')]);router[_0xaa23('0x68')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0xaa23('0x77')]);router['delete'](_0xaa23('0x64'),auth[_0xaa23('0xa')](),controller['removeApiKey']);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 bf597fa..0e13d24 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 _0xcb91=['toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','never','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','update','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','setDataValue','defaultuser','fullname','format','internal','email'];(function(_0x54c337,_0x2c09be){var _0x2ad6e0=function(_0x2d052b){while(--_0x2d052b){_0x54c337['push'](_0x54c337['shift']());}};_0x2ad6e0(++_0x2c09be);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x54d49e,_0x5d9911){_0x54d49e=_0x54d49e-0x0;var _0x4af0f1=_0xcb91[_0x54d49e];return _0x4af0f1;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x1cb9('0x0'));var _=require(_0x1cb9('0x1'));module[_0x1cb9('0x2')]={'name':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x8c392f){this[_0x1cb9('0x4')]('name',_0x8c392f);this[_0x1cb9('0x4')](_0x1cb9('0x5'),_0x8c392f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'set':function(_0x3f7deb){this['setDataValue'](_0x1cb9('0x6'),_0x3f7deb);this[_0x1cb9('0x4')]('callerid',util[_0x1cb9('0x7')]('\x22%s\x22\x20<%s>',_0x3f7deb,this['getDataValue'](_0x1cb9('0x8'))));}},'alias':{'type':Sequelize[_0x1cb9('0x3')]},'email':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':_0x1cb9('0x9'),'validate':{'isEmail':!![]},'set':function(_0x2fc627){if(_0x2fc627){this['setDataValue'](_0x1cb9('0x9'),_0x2fc627[_0x1cb9('0xa')]());}}},'role':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0xc'),_0x1cb9('0xd'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0xe')},'internal':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':![],'unique':_0x1cb9('0x8'),'set':function(_0x56884d){this[_0x1cb9('0x4')](_0x1cb9('0x8'),_0x56884d);this[_0x1cb9('0x4')](_0x1cb9('0x10'),_0x56884d);this[_0x1cb9('0x4')]('callerid',util['format'](_0x1cb9('0x11'),this[_0x1cb9('0x12')](_0x1cb9('0x6')),_0x56884d));}},'salt':{'type':Sequelize[_0x1cb9('0x3')]},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'mobile':{'type':Sequelize[_0x1cb9('0x3')]},'address':{'type':Sequelize[_0x1cb9('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1cb9('0x3')]},'country':{'type':Sequelize[_0x1cb9('0x3')]},'online':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1cb9('0x14')]},'voicePause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1cb9('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x16')},'ipaddr':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x17'),_0x1cb9('0xd'),_0x1cb9('0x18')),'allowNull':!![],'defaultValue':_0x1cb9('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0x1cb9('0x1a'),'ALLOWED_PASSED_SCREEN',_0x1cb9('0x1b'),_0x1cb9('0x1c'),_0x1cb9('0x1d'),_0x1cb9('0x1e'),'PROHIB_FAILED_SCREEN',_0x1cb9('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a3543){this['setDataValue'](_0x1cb9('0x20'),_0x3a3543?_0x3a3543[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x20'))?this['getDataValue'](_0x1cb9('0x20'))[_0x1cb9('0x22')](','):null;},'comment':_0x1cb9('0x23')},'dtmfmode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x24'),_0x1cb9('0x25'),_0x1cb9('0x26'),_0x1cb9('0x27'),_0x1cb9('0x28')),'allowNull':!![],'defaultValue':_0x1cb9('0x24')},'directmedia':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':_0x1cb9('0x2b'),'set':function(_0x35f5e8){this[_0x1cb9('0x4')]('nat',_0x35f5e8?_0x35f5e8[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2c'))?this['getDataValue'](_0x1cb9('0x2c'))['split'](','):null;},'comment':_0x1cb9('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1cb9('0x3')]},'pickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'language':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1cb9('0x3')]},'disallow':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'defaultValue':_0x1cb9('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4111b8){this[_0x1cb9('0x4')](_0x1cb9('0x2f'),_0x4111b8?_0x4111b8[_0x1cb9('0x21')](';'):_0x1cb9('0x30'));},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2f'))?this['getDataValue'](_0x1cb9('0x2f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'set':function(_0x1bf51c){this[_0x1cb9('0x4')](_0x1cb9('0x31'),_0x1bf51c?_0x1bf51c['join'](','):null);},'get':function(){return this[_0x1cb9('0x12')]('insecure')?this[_0x1cb9('0x12')](_0x1cb9('0x31'))[_0x1cb9('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'busylevel':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no',_0x1cb9('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1cb9('0x34'),'refuse',_0x1cb9('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x36'),_0x1cb9('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'keepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x38'),_0x1cb9('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x3a'),_0x1cb9('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),_0x1cb9('0x3c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1cb9('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1cb9('0x14')]},'passwordResetAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x319358){this[_0x1cb9('0x4')](_0x1cb9('0x3d'),_0x319358);var _0x173db5=this[_0x1cb9('0x3e')]({'plain':!![]});switch(_0x319358){case 0x0:case 0x1:var _0x75c734=_0x173db5[_0x1cb9('0x20')]?_[_0x1cb9('0x3f')](_0x173db5['transport'])?_0x173db5['transport'][_0x1cb9('0x21')]():_0x173db5['transport']:'udp';if(_0x75c734==='wss'){_0x75c734='udp';}this['setDataValue'](_0x1cb9('0x20'),_0x75c734);this[_0x1cb9('0x4')](_0x1cb9('0x40'),'no');this[_0x1cb9('0x4')](_0x1cb9('0x41'),null);this[_0x1cb9('0x4')]('force_avp',null);this[_0x1cb9('0x4')](_0x1cb9('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x1cb9('0x4')](_0x1cb9('0x43'),null);this[_0x1cb9('0x4')](_0x1cb9('0x44'),null);this[_0x1cb9('0x4')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x1cb9('0x4')](_0x1cb9('0x45'),'no');break;case 0x2:this[_0x1cb9('0x4')](_0x1cb9('0x20'),_0x1cb9('0x46'));this['setDataValue'](_0x1cb9('0x40'),_0x1cb9('0x29'));this['setDataValue']('avpf',_0x1cb9('0x29'));this['setDataValue'](_0x1cb9('0x47'),_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x42'),_0x1cb9('0x29'));this[_0x1cb9('0x4')]('dtlsenable',_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x43'),'no');this[_0x1cb9('0x4')]('dtlssetup','actpass');this[_0x1cb9('0x4')](_0x1cb9('0x48'),_0x173db5[_0x1cb9('0x48')]||_0x1cb9('0x49'));this[_0x1cb9('0x4')](_0x1cb9('0x4a'),_0x173db5['dtlsprivatekey']||_0x1cb9('0x4b'));this['setDataValue'](_0x1cb9('0x45'),_0x1cb9('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xf5b006){this[_0x1cb9('0x4')](_0x1cb9('0x4c'),_0xf5b006?_0xf5b006['join'](','):[]);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x4c'))?_[_0x1cb9('0x4d')](this[_0x1cb9('0x12')](_0x1cb9('0x4c'))[_0x1cb9('0x22')](','),function(_0x5a3f1d){return parseInt(_0x5a3f1d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1cb9('0x4e')],'get':function(){return this['getDataValue'](_0x1cb9('0x4f'))?this['getDataValue'](_0x1cb9('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![],'set':function(_0x4f8d74){if(typeof _0x4f8d74===_0x1cb9('0x50')){var _0x4cb014=_0x4f8d74==='1'?!![]:_0x4f8d74==='0'?![]:_0x4f8d74===_0x1cb9('0x51')?!![]:_0x4f8d74===_0x1cb9('0x52')?![]:![];this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4cb014);}else{this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4f8d74);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3db146){this[_0x1cb9('0x4')]('blocked',_0x3db146);if(_0x3db146===!![]){this[_0x1cb9('0x4')](_0x1cb9('0x54'),moment());this[_0x1cb9('0x4')](_0x1cb9('0x55'),0x0);}else{this[_0x1cb9('0x4')](_0x1cb9('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1cb9('0xf')](0x5)[_0x1cb9('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcb91=['toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','never','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','update','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','setDataValue','defaultuser','fullname','format','internal','email'];(function(_0x236f79,_0x4e04ff){var _0x49d6c7=function(_0x3add88){while(--_0x3add88){_0x236f79['push'](_0x236f79['shift']());}};_0x49d6c7(++_0x4e04ff);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x34c553,_0x3e7dfc){_0x34c553=_0x34c553-0x0;var _0x1357d2=_0xcb91[_0x34c553];return _0x1357d2;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x1cb9('0x0'));var _=require(_0x1cb9('0x1'));module[_0x1cb9('0x2')]={'name':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x8c392f){this[_0x1cb9('0x4')]('name',_0x8c392f);this[_0x1cb9('0x4')](_0x1cb9('0x5'),_0x8c392f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'set':function(_0x3f7deb){this['setDataValue'](_0x1cb9('0x6'),_0x3f7deb);this[_0x1cb9('0x4')]('callerid',util[_0x1cb9('0x7')]('\x22%s\x22\x20<%s>',_0x3f7deb,this['getDataValue'](_0x1cb9('0x8'))));}},'alias':{'type':Sequelize[_0x1cb9('0x3')]},'email':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':_0x1cb9('0x9'),'validate':{'isEmail':!![]},'set':function(_0x2fc627){if(_0x2fc627){this['setDataValue'](_0x1cb9('0x9'),_0x2fc627[_0x1cb9('0xa')]());}}},'role':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0xc'),_0x1cb9('0xd'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0xe')},'internal':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':![],'unique':_0x1cb9('0x8'),'set':function(_0x56884d){this[_0x1cb9('0x4')](_0x1cb9('0x8'),_0x56884d);this[_0x1cb9('0x4')](_0x1cb9('0x10'),_0x56884d);this[_0x1cb9('0x4')]('callerid',util['format'](_0x1cb9('0x11'),this[_0x1cb9('0x12')](_0x1cb9('0x6')),_0x56884d));}},'salt':{'type':Sequelize[_0x1cb9('0x3')]},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'mobile':{'type':Sequelize[_0x1cb9('0x3')]},'address':{'type':Sequelize[_0x1cb9('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1cb9('0x3')]},'country':{'type':Sequelize[_0x1cb9('0x3')]},'online':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1cb9('0x14')]},'voicePause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1cb9('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x16')},'ipaddr':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x17'),_0x1cb9('0xd'),_0x1cb9('0x18')),'allowNull':!![],'defaultValue':_0x1cb9('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0x1cb9('0x1a'),'ALLOWED_PASSED_SCREEN',_0x1cb9('0x1b'),_0x1cb9('0x1c'),_0x1cb9('0x1d'),_0x1cb9('0x1e'),'PROHIB_FAILED_SCREEN',_0x1cb9('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a3543){this['setDataValue'](_0x1cb9('0x20'),_0x3a3543?_0x3a3543[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x20'))?this['getDataValue'](_0x1cb9('0x20'))[_0x1cb9('0x22')](','):null;},'comment':_0x1cb9('0x23')},'dtmfmode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x24'),_0x1cb9('0x25'),_0x1cb9('0x26'),_0x1cb9('0x27'),_0x1cb9('0x28')),'allowNull':!![],'defaultValue':_0x1cb9('0x24')},'directmedia':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':_0x1cb9('0x2b'),'set':function(_0x35f5e8){this[_0x1cb9('0x4')]('nat',_0x35f5e8?_0x35f5e8[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2c'))?this['getDataValue'](_0x1cb9('0x2c'))['split'](','):null;},'comment':_0x1cb9('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1cb9('0x3')]},'pickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'language':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1cb9('0x3')]},'disallow':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'defaultValue':_0x1cb9('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4111b8){this[_0x1cb9('0x4')](_0x1cb9('0x2f'),_0x4111b8?_0x4111b8[_0x1cb9('0x21')](';'):_0x1cb9('0x30'));},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2f'))?this['getDataValue'](_0x1cb9('0x2f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'set':function(_0x1bf51c){this[_0x1cb9('0x4')](_0x1cb9('0x31'),_0x1bf51c?_0x1bf51c['join'](','):null);},'get':function(){return this[_0x1cb9('0x12')]('insecure')?this[_0x1cb9('0x12')](_0x1cb9('0x31'))[_0x1cb9('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'busylevel':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no',_0x1cb9('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1cb9('0x34'),'refuse',_0x1cb9('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x36'),_0x1cb9('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'keepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x38'),_0x1cb9('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x3a'),_0x1cb9('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),_0x1cb9('0x3c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1cb9('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1cb9('0x14')]},'passwordResetAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x319358){this[_0x1cb9('0x4')](_0x1cb9('0x3d'),_0x319358);var _0x173db5=this[_0x1cb9('0x3e')]({'plain':!![]});switch(_0x319358){case 0x0:case 0x1:var _0x75c734=_0x173db5[_0x1cb9('0x20')]?_[_0x1cb9('0x3f')](_0x173db5['transport'])?_0x173db5['transport'][_0x1cb9('0x21')]():_0x173db5['transport']:'udp';if(_0x75c734==='wss'){_0x75c734='udp';}this['setDataValue'](_0x1cb9('0x20'),_0x75c734);this[_0x1cb9('0x4')](_0x1cb9('0x40'),'no');this[_0x1cb9('0x4')](_0x1cb9('0x41'),null);this[_0x1cb9('0x4')]('force_avp',null);this[_0x1cb9('0x4')](_0x1cb9('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x1cb9('0x4')](_0x1cb9('0x43'),null);this[_0x1cb9('0x4')](_0x1cb9('0x44'),null);this[_0x1cb9('0x4')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x1cb9('0x4')](_0x1cb9('0x45'),'no');break;case 0x2:this[_0x1cb9('0x4')](_0x1cb9('0x20'),_0x1cb9('0x46'));this['setDataValue'](_0x1cb9('0x40'),_0x1cb9('0x29'));this['setDataValue']('avpf',_0x1cb9('0x29'));this['setDataValue'](_0x1cb9('0x47'),_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x42'),_0x1cb9('0x29'));this[_0x1cb9('0x4')]('dtlsenable',_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x43'),'no');this[_0x1cb9('0x4')]('dtlssetup','actpass');this[_0x1cb9('0x4')](_0x1cb9('0x48'),_0x173db5[_0x1cb9('0x48')]||_0x1cb9('0x49'));this[_0x1cb9('0x4')](_0x1cb9('0x4a'),_0x173db5['dtlsprivatekey']||_0x1cb9('0x4b'));this['setDataValue'](_0x1cb9('0x45'),_0x1cb9('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xf5b006){this[_0x1cb9('0x4')](_0x1cb9('0x4c'),_0xf5b006?_0xf5b006['join'](','):[]);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x4c'))?_[_0x1cb9('0x4d')](this[_0x1cb9('0x12')](_0x1cb9('0x4c'))[_0x1cb9('0x22')](','),function(_0x5a3f1d){return parseInt(_0x5a3f1d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1cb9('0x4e')],'get':function(){return this['getDataValue'](_0x1cb9('0x4f'))?this['getDataValue'](_0x1cb9('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![],'set':function(_0x4f8d74){if(typeof _0x4f8d74===_0x1cb9('0x50')){var _0x4cb014=_0x4f8d74==='1'?!![]:_0x4f8d74==='0'?![]:_0x4f8d74===_0x1cb9('0x51')?!![]:_0x4f8d74===_0x1cb9('0x52')?![]:![];this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4cb014);}else{this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4f8d74);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3db146){this[_0x1cb9('0x4')]('blocked',_0x3db146);if(_0x3db146===!![]){this[_0x1cb9('0x4')](_0x1cb9('0x54'),moment());this[_0x1cb9('0x4')](_0x1cb9('0x55'),0x0);}else{this[_0x1cb9('0x4')](_0x1cb9('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1cb9('0xf')](0x5)[_0x1cb9('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'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 d32d6c2..615031f 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 _0xbcac=['differenceBy','rawAttributes','filters','fields','merge','options','body','describe','addContacts','ids','omit','findById','securePassword','validatePasswordPattern','max','internal','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','isNil','from','mailbox','VoiceMail','email','agent','permissions','101','102','103','113','105','106','107','109','114','115','create','Unauthorized','user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','oldPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','validatePasswordHistory','previousPasswords','addQueues','channel','online','loginInPause','voicePause','interface','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','Queue:save','voice','VoiceQueue','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','isArray','emit','Queue:remove','addAvatar','userpic','file','filename','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','openchannel','ChatOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','concat','getContacts','keys','CmContact','intersection','order','sort','pick','hasOwnProperty','CmList','List','color','tag','nolimit','limit','getQueues','isValidChannel','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','UserId','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','LOCAL/%s@from-sip/n','intrf','format','user:%s','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','%s%s','Pause','getTeams','addTeams','Team','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','Whatsapp','Openchannel','flatten','transaction','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Sms','getFaxQueues','Fax','getOpenchannelQueues','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notLike','$iLike','$notILike','$like','$contained','$any','firstName','lastName','Contact','getApiKey','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','nonce','token','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','isEmpty','queues','lower','col','toString','asc','desc','substring','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','client','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','InteractionId','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','bluebird','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','redis','./user.socket','http','request','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','User,\x20%s,\x20%s','message','info','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','then','get','role','admin','Users','Agents','Telephones','telephone','filter','ignore','map','value','includes','find','name','UserProfileResource','destroy','stack','send','index','User','fieldName','type','password','getOptions','where','query','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','openTabs','rows','length','chat','dataValues','sms','fax','mail','whatsapp','all','catch','params','model'];(function(_0x237c0b,_0x2ee7cf){var _0x273e17=function(_0x8a3a6d){while(--_0x8a3a6d){_0x237c0b['push'](_0x237c0b['shift']());}};_0x273e17(++_0x2ee7cf);}(_0xbcac,0x149));var _0xcbca=function(_0x329e79,_0xac77d2){_0x329e79=_0x329e79-0x0;var _0x22a675=_0xbcac[_0x329e79];return _0x22a675;};'use strict';var moment=require(_0xcbca('0x0'));var BPromise=require(_0xcbca('0x1'));var util=require(_0xcbca('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0xcbca('0x3'));var jayson=require('jayson/promise');var Redis=require(_0xcbca('0x4'));var authService=require('../../components/auth/service');var qs=require(_0xcbca('0x5'));var logger=require('../../config/logger')(_0xcbca('0x6'));var utils=require('../../config/utils');var config=require(_0xcbca('0x7'));var licenseUtil=require(_0xcbca('0x8'));var db=require(_0xcbca('0x9'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xcbca('0xa')]));require(_0xcbca('0xb'))['register'](socket);config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var client=jayson['client'][_0xcbca('0xc')]({'port':0x232a});var values;function respondWithRpcPromise(_0x4b2bc6,_0x439072,_0x1cae38,_0x33b774){return new BPromise(function(_0x11223b,_0x2d7835){var _0x451557=_0x33b774||client;return _0x451557[_0xcbca('0xd')](_0x4b2bc6,_0x1cae38)['then'](function(_0x31f73a){logger['info']('User,\x20%s,\x20%s',_0x439072,'request\x20sent');logger[_0xcbca('0xe')](_0xcbca('0xf'),_0x439072,_0xcbca('0x10'),JSON[_0xcbca('0x11')](_0x31f73a));if(_0x31f73a[_0xcbca('0x12')]){if(_0x31f73a[_0xcbca('0x12')][_0xcbca('0x13')]===0x1f4){logger[_0xcbca('0x12')](_0xcbca('0x14'),_0x439072,_0x31f73a[_0xcbca('0x12')][_0xcbca('0x15')]);return _0x2d7835(_0x31f73a[_0xcbca('0x12')][_0xcbca('0x15')]);}logger['error'](_0xcbca('0x14'),_0x439072,_0x31f73a['error'][_0xcbca('0x15')]);return _0x11223b(_0x31f73a[_0xcbca('0x12')][_0xcbca('0x15')]);}else{logger[_0xcbca('0x16')]('User,\x20%s,\x20%s',_0x439072,_0xcbca('0x10'));_0x11223b(_0x31f73a['result'][_0xcbca('0x15')]);}})['catch'](function(_0x7943a8){logger[_0xcbca('0x12')](_0xcbca('0x14'),_0x439072,_0x7943a8);_0x2d7835(_0x7943a8);});});}function respondWithStatusCode(_0x1c2eaa,_0x29fa5e){_0x29fa5e=_0x29fa5e||0xcc;return function(_0x4cc4ce){if(_0x4cc4ce){return _0x1c2eaa[_0xcbca('0x17')](_0x29fa5e);}return _0x1c2eaa[_0xcbca('0x18')](_0x29fa5e)[_0xcbca('0x19')]();};}function respondWithResult(_0x15ce83,_0x31a2cf){_0x31a2cf=_0x31a2cf||0xc8;return function(_0x376fb4){if(_0x376fb4){return _0x15ce83[_0xcbca('0x18')](_0x31a2cf)[_0xcbca('0x1a')](_0x376fb4);}};}function respondWithFilteredResult(_0x2c9e76,_0x3d916a){return function(_0x3ea7c5){if(_0x3ea7c5){var _0x36cb5c=typeof _0x3d916a[_0xcbca('0x1b')]==='undefined'&&typeof _0x3d916a['limit']===_0xcbca('0x1c');var _0x2b666f=_0x3ea7c5['count'];var _0xd912db=_0x36cb5c?0x0:_0x3d916a[_0xcbca('0x1b')];var _0x32b52c=_0x36cb5c?_0x3ea7c5[_0xcbca('0x1d')]:_0x3d916a[_0xcbca('0x1b')]+_0x3d916a['limit'];var _0x51a2a4;if(_0x32b52c>=_0x2b666f){_0x32b52c=_0x2b666f;_0x51a2a4=0xc8;}else{_0x51a2a4=0xce;}_0x2c9e76['status'](_0x51a2a4);return _0x2c9e76[_0xcbca('0x1e')](_0xcbca('0x1f'),_0xd912db+'-'+_0x32b52c+'/'+_0x2b666f)[_0xcbca('0x1a')](_0x3ea7c5);}return null;};}function saveUpdates(_0x47207d){return function(_0x22b5f9){if(_0x22b5f9){return _0x22b5f9[_0xcbca('0x20')](_0x47207d)['then'](function(_0x259a10){return _0x259a10;});}return null;};}function removeEntity(_0x52a5fb){return function(_0x58b704){if(_0x58b704){return _0x58b704['destroy']()[_0xcbca('0x21')](function(){var _0x329952=_0x58b704[_0xcbca('0x22')]({'plain':!![]});if(_0x329952[_0xcbca('0x23')]===_0xcbca('0x24'))return;var _0xfcfcb6=[{'name':_0xcbca('0x25'),'value':'user','ignore':!![]},{'name':_0xcbca('0x26'),'value':'agent','ignore':![]},{'name':_0xcbca('0x27'),'value':_0xcbca('0x28'),'ignore':![]}];var _0x5eeebc=_(_0xfcfcb6)[_0xcbca('0x29')](_0xcbca('0x2a'))[_0xcbca('0x2b')](_0xcbca('0x2c'))[_0xcbca('0x2c')]();if(_[_0xcbca('0x2d')](_0x5eeebc,_0x329952['role'])){return;}var _0x446534=_[_0xcbca('0x2e')](_0xfcfcb6,[_0xcbca('0x2c'),_0x329952['role']])[_0xcbca('0x2f')];return db[_0xcbca('0x30')][_0xcbca('0x31')]({'where':{'type':_0x446534,'resourceId':_0x329952['id']}})[_0xcbca('0x21')](function(){return _0x58b704;});})['then'](function(){_0x52a5fb['status'](0xcc)[_0xcbca('0x19')]();});}};}function handleEntityNotFound(_0x470077){return function(_0xb5375){if(!_0xb5375){_0x470077[_0xcbca('0x17')](0x194);}return _0xb5375;};}function handleError(_0x381d8a,_0x56ddf9){_0x56ddf9=_0x56ddf9||0x1f4;return function(_0x58e7b1){logger[_0xcbca('0x12')](_0x58e7b1[_0xcbca('0x32')]);if(_0x58e7b1['name']){delete _0x58e7b1[_0xcbca('0x2f')];}_0x381d8a['status'](_0x56ddf9)[_0xcbca('0x33')](_0x58e7b1);};}exports[_0xcbca('0x34')]=function(_0x8976da,_0x1241ce){var _0x48a99a={},_0x2b9386={'count':0x0,'rows':[]};var _0x5aa997=_(db[_0xcbca('0x35')]['rawAttributes'])[_0xcbca('0x2b')](function(_0x1cdb5d){return{'name':_0x1cdb5d[_0xcbca('0x36')],'type':_0x1cdb5d[_0xcbca('0x37')]['key']};})[_0xcbca('0x29')](function(_0xc68724){return!_[_0xcbca('0x2d')]([_0xcbca('0x38'),'salt'],_0xc68724['name']);})[_0xcbca('0x2c')]();_0x48a99a=qs[_0xcbca('0x39')](_0x5aa997,_0x8976da);var _0x324e7a={'where':_0x48a99a[_0xcbca('0x3a')]};return db['User'][_0xcbca('0x1d')](_0x324e7a)[_0xcbca('0x21')](function(_0x2294e7){_0x2b9386['count']=_0x2294e7;if(_0x8976da[_0xcbca('0x3b')][_0xcbca('0x3c')]){_0x48a99a[_0xcbca('0x3d')]=[{'all':!![]}];}if(_0x8976da[_0xcbca('0x3b')][_0xcbca('0x3e')]===_0xcbca('0x3f')){_0x48a99a[_0xcbca('0x3d')]=[{'model':db[_0xcbca('0x40')],'as':_0xcbca('0x3e')}];}if(!_[_0xcbca('0x2d')](_0x48a99a[_0xcbca('0x41')],'id')){_0x48a99a['attributes'][_0xcbca('0x42')]('id');}return db[_0xcbca('0x35')][_0xcbca('0x43')](_0x48a99a);})[_0xcbca('0x21')](function(_0x27eb4a){_0x2b9386['rows']=_0x27eb4a;if(_0x8976da['query'][_0xcbca('0x44')]===_0xcbca('0x3f')){var _0xec8800=[];for(var _0x56cb4c=0x0;_0x56cb4c<_0x2b9386[_0xcbca('0x45')][_0xcbca('0x46')];_0x56cb4c++){_0xec8800[_0xcbca('0x42')](get_open_tabs(_0xcbca('0x47'),_0x2b9386[_0xcbca('0x45')][_0x56cb4c][_0xcbca('0x48')]));_0xec8800[_0xcbca('0x42')](get_open_tabs(_0xcbca('0x49'),_0x2b9386[_0xcbca('0x45')][_0x56cb4c][_0xcbca('0x48')]));_0xec8800[_0xcbca('0x42')](get_open_tabs(_0xcbca('0x4a'),_0x2b9386['rows'][_0x56cb4c][_0xcbca('0x48')]));_0xec8800[_0xcbca('0x42')](get_open_tabs(_0xcbca('0x4b'),_0x2b9386[_0xcbca('0x45')][_0x56cb4c][_0xcbca('0x48')]));_0xec8800[_0xcbca('0x42')](get_open_tabs('openchannel',_0x2b9386['rows'][_0x56cb4c][_0xcbca('0x48')]));_0xec8800[_0xcbca('0x42')](get_open_tabs(_0xcbca('0x4c'),_0x2b9386[_0xcbca('0x45')][_0x56cb4c][_0xcbca('0x48')]));}return BPromise[_0xcbca('0x4d')](_0xec8800)[_0xcbca('0x21')](function(){return _0x2b9386;});}else{return _0x2b9386;}})[_0xcbca('0x21')](respondWithFilteredResult(_0x1241ce,_0x48a99a))[_0xcbca('0x4e')](handleError(_0x1241ce,null));};exports['show']=function(_0x201a63,_0x4b8315){var _0x1c837f={'raw':![],'where':{'id':_0x201a63[_0xcbca('0x4f')]['id']}},_0x15a3f6={};_0x15a3f6[_0xcbca('0x50')]=_[_0xcbca('0x51')](_['keys'](db['User'][_0xcbca('0x52')]),[_0xcbca('0x38'),'salt']);_0x15a3f6[_0xcbca('0x3b')]=_['keys'](_0x201a63['query']);_0x15a3f6[_0xcbca('0x53')]=_['intersection'](_0x15a3f6[_0xcbca('0x50')],_0x15a3f6[_0xcbca('0x3b')]);_0x1c837f[_0xcbca('0x41')]=_['intersection'](_0x15a3f6[_0xcbca('0x50')],qs[_0xcbca('0x54')](_0x201a63[_0xcbca('0x3b')]['fields']));_0x1c837f[_0xcbca('0x41')]=_0x1c837f['attributes']['length']?_0x1c837f['attributes']:_0x15a3f6[_0xcbca('0x50')];if(_0x201a63[_0xcbca('0x3b')][_0xcbca('0x3c')]){_0x1c837f[_0xcbca('0x3d')]=[{'all':!![]}];}if(_0x201a63['query'][_0xcbca('0x3e')]===_0xcbca('0x3f')){_0x1c837f[_0xcbca('0x3d')]=[{'model':db[_0xcbca('0x40')],'as':'userSetting'}];}_0x1c837f=_[_0xcbca('0x55')]({},_0x1c837f,_0x201a63[_0xcbca('0x56')]);if(!_[_0xcbca('0x2d')](_0x1c837f[_0xcbca('0x41')],'id')){_0x1c837f[_0xcbca('0x41')][_0xcbca('0x42')]('id');}return db[_0xcbca('0x35')]['find'](_0x1c837f)[_0xcbca('0x21')](handleEntityNotFound(_0x4b8315,null))[_0xcbca('0x21')](function(_0x2ca53a){var _0x47f4e8=[];values=_0x2ca53a;if(_0x201a63[_0xcbca('0x3b')][_0xcbca('0x44')]===_0xcbca('0x3f')){_0x47f4e8[_0xcbca('0x42')](get_open_tabs(_0xcbca('0x47'),_0x2ca53a[_0xcbca('0x48')]));_0x47f4e8[_0xcbca('0x42')](get_open_tabs('sms',_0x2ca53a[_0xcbca('0x48')]));_0x47f4e8[_0xcbca('0x42')](get_open_tabs('openchannel',_0x2ca53a[_0xcbca('0x48')]));_0x47f4e8[_0xcbca('0x42')](get_open_tabs(_0xcbca('0x4c'),_0x2ca53a[_0xcbca('0x48')]));_0x47f4e8['push'](get_open_tabs('fax',_0x2ca53a[_0xcbca('0x48')]));_0x47f4e8['push'](get_open_tabs('mail',_0x2ca53a[_0xcbca('0x48')]));return BPromise[_0xcbca('0x4d')](_0x47f4e8);}else{return values;}})['then'](function(){return values;})[_0xcbca('0x21')](respondWithResult(_0x4b8315,null))['catch'](handleError(_0x4b8315,null));};exports[_0xcbca('0x20')]=function(_0x101f8e,_0x7b47ee){if(_0x101f8e[_0xcbca('0x57')]['id']){delete _0x101f8e[_0xcbca('0x57')]['id'];}delete _0x101f8e[_0xcbca('0x57')][_0xcbca('0x23')];return db[_0xcbca('0x35')][_0xcbca('0x2e')]({'where':{'id':_0x101f8e[_0xcbca('0x4f')]['id']}})[_0xcbca('0x21')](handleEntityNotFound(_0x7b47ee,null))[_0xcbca('0x21')](saveUpdates(_0x101f8e[_0xcbca('0x57')],null))[_0xcbca('0x21')](respondWithResult(_0x7b47ee,null))[_0xcbca('0x4e')](handleError(_0x7b47ee,null));};exports[_0xcbca('0x58')]=function(_0x45ea70,_0x1434c2){return db['User'][_0xcbca('0x58')]()['then'](respondWithResult(_0x1434c2,null))[_0xcbca('0x4e')](handleError(_0x1434c2,null));};exports['addContacts']=function(_0x1582eb,_0x304dd6){return db[_0xcbca('0x35')]['find']({'where':{'id':_0x1582eb[_0xcbca('0x4f')]['id']}})[_0xcbca('0x21')](handleEntityNotFound(_0x304dd6,null))[_0xcbca('0x21')](function(_0x19a56a){if(_0x19a56a){return _0x19a56a[_0xcbca('0x59')](_0x1582eb[_0xcbca('0x57')][_0xcbca('0x5a')],_[_0xcbca('0x5b')](_0x1582eb[_0xcbca('0x57')],[_0xcbca('0x5a'),'id'])||{});}})[_0xcbca('0x21')](respondWithResult(_0x304dd6,null))['catch'](handleError(_0x304dd6,null));};function validateUser(_0x9c7aea){return new BPromise(function(_0x5710bf,_0xd2a81b){if(_0x9c7aea['internal'])return _0x5710bf(_0x9c7aea);return db['Setting'][_0xcbca('0x5c')](0x1)['then'](function(_0x1a26ef){if(_0x1a26ef[_0xcbca('0x5d')])authService[_0xcbca('0x5e')](_0x9c7aea[_0xcbca('0x38')]);db[_0xcbca('0x35')][_0xcbca('0x5f')](_0xcbca('0x60'))[_0xcbca('0x21')](function(_0x16d5fd){if(_['isNil'](_0x16d5fd)){_0x9c7aea[_0xcbca('0x60')]=_0x1a26ef[_0xcbca('0x61')]||0x1;return;}if(_['isNil'](_0x1a26ef['min_internal'])||_0x1a26ef[_0xcbca('0x61')]===_0x16d5fd){_0x9c7aea[_0xcbca('0x60')]=_0x16d5fd+0x1;return;}if(_0x1a26ef[_0xcbca('0x61')]>_0x16d5fd){_0x9c7aea['internal']=_0x1a26ef['min_internal'];return;}return db[_0xcbca('0x62')][_0xcbca('0x3b')](_0xcbca('0x63'),{'type':db[_0xcbca('0x62')][_0xcbca('0x64')][_0xcbca('0x65')]})[_0xcbca('0x21')](function(_0x5b1f09){if(_0x5b1f09&&_0x5b1f09['length']){for(var _0x254549=0x0,_0x4466ce=_0x5b1f09[_0xcbca('0x46')];_0x254549<_0x4466ce&&_[_0xcbca('0x66')](_0x9c7aea[_0xcbca('0x60')]);_0x254549++){if(_0x1a26ef[_0xcbca('0x61')]<=_0x5b1f09[_0x254549][_0xcbca('0x67')]){_0x9c7aea['internal']=_0x5b1f09[_0x254549]['from'];}else if(_0x1a26ef[_0xcbca('0x61')]>_0x5b1f09[_0x254549][_0xcbca('0x67')]&&_0x1a26ef['min_internal']<=_0x5b1f09[_0x254549]['to']){_0x9c7aea['internal']=_0x1a26ef[_0xcbca('0x61')];}}}if(_[_0xcbca('0x66')](_0x9c7aea[_0xcbca('0x60')])){_0x9c7aea[_0xcbca('0x60')]=_0x16d5fd+0x1;}return _0x5710bf(_0x9c7aea);});});})[_0xcbca('0x4e')](function(_0x9e4f2){_0xd2a81b(_0x9e4f2);});});}function updateUser(_0x205b85){return new BPromise(function(_0x5b09fe,_0x4b6431){try{if(_0x205b85['voicemail']){_0x205b85[_0xcbca('0x68')]=_0x205b85[_0xcbca('0x60')];_0x205b85[_0xcbca('0x69')]={'mailbox':_0x205b85['internal'],'password':_0x205b85['password'],'fullname':_0x205b85['fullname'],'email':_0x205b85[_0xcbca('0x6a')]};}if(_0x205b85[_0xcbca('0x23')]===_0xcbca('0x6b')){if(!_0x205b85[_0xcbca('0x6c')])_0x205b85['permissions']=[_0xcbca('0x6d'),_0xcbca('0x6e'),_0xcbca('0x6f'),_0xcbca('0x70'),'110','104',_0xcbca('0x71'),_0xcbca('0x72'),_0xcbca('0x73'),'108',_0xcbca('0x74'),'100','111',_0xcbca('0x75'),_0xcbca('0x76')];}_0x5b09fe(_0x205b85);}catch(_0x23e5a2){_0x4b6431(_0x23e5a2);}});}exports[_0xcbca('0x77')]=function(_0x364c7b,_0xc83097){if(_0x364c7b['user'][_0xcbca('0x23')]==='agent')throw new Error(_0xcbca('0x78'));if(_0x364c7b[_0xcbca('0x57')][_0xcbca('0x23')]===_0xcbca('0x79')&&_0x364c7b[_0xcbca('0x79')]['role']!=='admin'){throw new Error(_0xcbca('0x7a'));}if(_0x364c7b[_0xcbca('0x57')]['role']===_0xcbca('0x24')&&_0x364c7b[_0xcbca('0x79')][_0xcbca('0x23')]!=='admin'){throw new Error(_0xcbca('0x7b'));}return licenseUtil[_0xcbca('0x7c')]([_0x364c7b[_0xcbca('0x57')]])[_0xcbca('0x21')](function(){return validateUser(_0x364c7b[_0xcbca('0x57')]);})[_0xcbca('0x21')](function(_0x57d198){return updateUser(_0x57d198)[_0xcbca('0x21')](function(_0x4d0582){if(_0x4d0582[_0xcbca('0x23')]==='admin'){_0x4d0582[_0xcbca('0x7d')]=_0x364c7b[_0xcbca('0x79')][_0xcbca('0x7d')];delete _0x4d0582[_0xcbca('0x7e')];}return _0x4d0582;});})[_0xcbca('0x21')](function(_0x16ad49){return db[_0xcbca('0x35')][_0xcbca('0x77')](_0x16ad49,{'include':[{'model':db[_0xcbca('0x69')],'as':'VoiceMail'}]});})['then'](function(_0x311553){if(_0x364c7b[_0xcbca('0x57')]['role']===_0xcbca('0x79'))return _0x311553;if(_0x364c7b[_0xcbca('0x79')][_0xcbca('0x23')]!==_0xcbca('0x79'))return _0x311553;return db[_0xcbca('0x7f')][_0xcbca('0x2e')]({'where':{'name':_0x311553[_0xcbca('0x23')]===_0xcbca('0x6b')?_0xcbca('0x26'):_0xcbca('0x27'),'userProfileId':_0x364c7b['user'][_0xcbca('0x7e')]},'raw':!![]})[_0xcbca('0x21')](function(_0x31cf52){if(!_0x31cf52||_0x31cf52[_0xcbca('0x80')]!=0x0)return _0x311553;return db[_0xcbca('0x30')][_0xcbca('0x77')]({'name':_0x311553[_0xcbca('0x2f')],'resourceId':_0x311553['id'],'type':_0x31cf52[_0xcbca('0x2f')],'sectionId':_0x31cf52['id']},{})[_0xcbca('0x21')](function(){return _0x311553;});})[_0xcbca('0x4e')](function(_0x2ab5a3){logger[_0xcbca('0x12')](_0xcbca('0x81'),_0x2ab5a3);throw _0x2ab5a3;});})[_0xcbca('0x21')](respondWithResult(_0xc83097,0xc9))[_0xcbca('0x4e')](handleError(_0xc83097,null));};exports[_0xcbca('0x82')]=function(_0x1e5f1e,_0x2af94c){var _0x5649ea=_0x1e5f1e[_0xcbca('0x57')];var _0x1c7650=[];if(_0x1e5f1e[_0xcbca('0x79')]['role']===_0xcbca('0x6b'))throw new Error('Unauthorized');if(_['some'](_0x5649ea,[_0xcbca('0x23'),_0xcbca('0x79')])&&_0x1e5f1e[_0xcbca('0x79')][_0xcbca('0x23')]!==_0xcbca('0x24')){throw new Error(_0xcbca('0x7a'));}if(_[_0xcbca('0x83')](_0x5649ea,['role',_0xcbca('0x24')])&&_0x1e5f1e[_0xcbca('0x79')][_0xcbca('0x23')]!=='admin'){throw new Error(_0xcbca('0x84'));}return licenseUtil[_0xcbca('0x7c')](_0x5649ea)[_0xcbca('0x21')](function(){return validateUser(_0x5649ea[0x0]);})[_0xcbca('0x21')](function(){for(var _0x4eaa86=0x1;_0x4eaa86<_0x5649ea['length'];_0x4eaa86++){var _0x5c2e90=_0x5649ea[_0x4eaa86-0x1][_0xcbca('0x60')];if(!_0x5649ea[_0x4eaa86][_0xcbca('0x60')])_0x5649ea[_0x4eaa86][_0xcbca('0x60')]=_0x5c2e90+0x1;_0x1c7650['push'](validateUser(_0x5649ea[_0x4eaa86]));}return BPromise['all'](_0x1c7650);})[_0xcbca('0x21')](function(){_0x1c7650=[];for(var _0x502cb1=0x0;_0x502cb1<_0x5649ea[_0xcbca('0x46')];_0x502cb1++){_0x1c7650[_0xcbca('0x42')](updateUser(_0x5649ea[_0x502cb1]));}return BPromise['all'](_0x1c7650);})['then'](function(){return BPromise[_0xcbca('0x85')](_0x5649ea,function(_0x2254ec){return db[_0xcbca('0x35')][_0xcbca('0x77')](_0x2254ec,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})['then'](function(_0x346fe2){_0x2254ec['id']=_0x346fe2['id'];return _0x2254ec;});});})[_0xcbca('0x21')](function(_0x1748ec){if(_0x1e5f1e[_0xcbca('0x57')]['role']===_0xcbca('0x79'))return _0x1748ec;if(_0x1e5f1e[_0xcbca('0x79')]['role']!=='user')return _0x1748ec;var _0x4efc94=_[_0xcbca('0x83')](_0x1748ec,function(_0x357fc4){return _0x357fc4['role']===_0xcbca('0x6b')||_0x357fc4['role']==='telephone';});if(!_0x4efc94)return _0x1748ec;return db[_0xcbca('0x7f')][_0xcbca('0x43')]({'where':{'name':{'$or':[_0xcbca('0x26'),_0xcbca('0x27')]},'userProfileId':_0x1e5f1e['user'][_0xcbca('0x7e')]},'raw':!![]})[_0xcbca('0x21')](function(_0x204f6c){if(_['isEmpty'](_0x204f6c)||!_['some'](_0x204f6c,[_0xcbca('0x80'),0x0]))return _0x1748ec;_0x1c7650=[];var _0x174791=_(_0x204f6c)[_0xcbca('0x2b')](function(_0xc5434f){if(_0xc5434f[_0xcbca('0x80')]===0x1)return;return _0xc5434f['name']===_0xcbca('0x26')?_0xcbca('0x6b'):_0xcbca('0x28');})['compact']()[_0xcbca('0x2c')]();for(var _0x367f95=0x0;_0x367f95<_0x1748ec[_0xcbca('0x46')];_0x367f95++){if(!_[_0xcbca('0x2d')](_0x174791,_0x1748ec[_0x367f95][_0xcbca('0x23')]))return;var _0x31ee78=_0x1748ec[_0x367f95][_0xcbca('0x23')]===_0xcbca('0x6b')?_0xcbca('0x26'):_0xcbca('0x27');_0x1c7650[_0xcbca('0x42')](db[_0xcbca('0x30')]['create']({'name':_0x1748ec[_0x367f95][_0xcbca('0x2f')],'resourceId':_0x1748ec[_0x367f95]['id'],'type':_0x31ee78,'sectionId':_[_0xcbca('0x2e')](_0x204f6c,[_0xcbca('0x2f'),_0x31ee78])['id']},{}));}return BPromise[_0xcbca('0x4d')](_0x1c7650);});})[_0xcbca('0x21')](respondWithResult(_0x2af94c,0xc9))[_0xcbca('0x4e')](handleError(_0x2af94c,null));};exports['changePassword']=function(_0x52b8d7,_0x499d42){if(_0x52b8d7[_0xcbca('0x57')]['id']){delete _0x52b8d7[_0xcbca('0x57')]['id'];}return db[_0xcbca('0x35')]['find']({'where':{'id':_0x52b8d7['params']['id']}})[_0xcbca('0x21')](function(_0x235562){if(!_0x235562)return null;if(_0x235562['id']===_0x52b8d7['user']['id']){if(!_0x52b8d7[_0xcbca('0x57')][_0xcbca('0x86')]||!_0x52b8d7['body']['newPassword']){throw new db[(_0xcbca('0x87'))][(_0xcbca('0x88'))](_0xcbca('0x89'));}if(!_0x235562[_0xcbca('0x8a')](_0x52b8d7[_0xcbca('0x57')][_0xcbca('0x86')])){throw new db[(_0xcbca('0x87'))][(_0xcbca('0x88'))](_0xcbca('0x8b'));}if(_0x52b8d7[_0xcbca('0x57')]['oldPassword']===_0x52b8d7['body'][_0xcbca('0x8c')]){throw new db[(_0xcbca('0x87'))]['ValidationError'](_0xcbca('0x8d'));}}else if(_0x52b8d7[_0xcbca('0x79')]['role']===_0xcbca('0x24')){if(!_0x52b8d7[_0xcbca('0x57')][_0xcbca('0x8c')]){throw new db[(_0xcbca('0x87'))][(_0xcbca('0x88'))](_0xcbca('0x8e'));}}else if(_0x52b8d7[_0xcbca('0x79')][_0xcbca('0x23')]===_0xcbca('0x79')){if(!_0x52b8d7['body'][_0xcbca('0x8c')]){throw new db['Sequelize'][(_0xcbca('0x88'))](_0xcbca('0x8e'));}if(_0x235562[_0xcbca('0x23')]!=='agent'){throw new db[(_0xcbca('0x87'))][(_0xcbca('0x88'))](_0xcbca('0x78'));}}else{throw new db[(_0xcbca('0x87'))][(_0xcbca('0x88'))](_0xcbca('0x78'));}return _0x235562;})[_0xcbca('0x21')](handleEntityNotFound(_0x499d42,null))['then'](function(_0x495406){return db[_0xcbca('0x8f')][_0xcbca('0x90')]({'attributes':['id',_0xcbca('0x5d'),_0xcbca('0x91'),'passwordHistoryLimit']})[_0xcbca('0x21')](function(_0x2636d2){if(_0x2636d2['securePassword'])authService['validatePasswordPattern'](_0x52b8d7[_0xcbca('0x57')]['newPassword']);if(!_0x2636d2[_0xcbca('0x91')]||!_0x495406['previousPasswords'])return _0x495406;authService[_0xcbca('0x92')](_0x52b8d7['body'][_0xcbca('0x8c')],_0x495406[_0xcbca('0x93')],_0x2636d2['passwordHistoryLimit']);return _0x495406;})['then'](saveUpdates({'password':_0x52b8d7[_0xcbca('0x57')]['newPassword'],'passwordResetAt':_0x52b8d7[_0xcbca('0x79')]['id']==_0x52b8d7[_0xcbca('0x4f')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x52b8d7[_0xcbca('0x57')][_0xcbca('0x8c')],_0x495406[_0xcbca('0x93')])},null));})[_0xcbca('0x21')](respondWithResult(_0x499d42,null))[_0xcbca('0x4e')](handleError(_0x499d42,null));};exports[_0xcbca('0x94')]=function(_0x5d7d5b,_0x4f1dcb){var _0x501fa8=_0x5d7d5b[_0xcbca('0x57')][_0xcbca('0x95')];return db['User']['find']({'where':{'id':_0x5d7d5b[_0xcbca('0x4f')]['id']},'attributes':['id',_0xcbca('0x2f'),_0xcbca('0x23'),_0xcbca('0x96'),_0xcbca('0x97'),_0xcbca('0x98'),_0xcbca('0x99')]})['then'](handleEntityNotFound(_0x4f1dcb,null))[_0xcbca('0x21')](function(_0x4a5dd6){if(_0x4a5dd6){if(!utils['isValidChannel'](_0x501fa8)){throw new db['Sequelize'][(_0xcbca('0x88'))](_0xcbca('0x9a'));}return _0x4a5dd6[_0xcbca('0x9b')+_[_0xcbca('0x9c')](_0x501fa8[_0xcbca('0x9d')]())+_0xcbca('0x9e')](_0x5d7d5b['body'][_0xcbca('0x5a')],{'penalty':_0x5d7d5b['body'][_0xcbca('0x9f')]||0x0})[_0xcbca('0xa0')](function(_0x3f024d){for(var _0x1ac7e1=0x0;_0x1ac7e1<_0x5d7d5b['body'][_0xcbca('0x5a')][_0xcbca('0x46')];_0x1ac7e1+=0x1){var _0x583858={'UserId':Number(_0x5d7d5b[_0xcbca('0x4f')]['id'])};_0x583858[_[_0xcbca('0x9c')](_0x501fa8[_0xcbca('0x9d')]())+_0xcbca('0xa1')]=Number(_0x5d7d5b[_0xcbca('0x57')][_0xcbca('0x5a')][_0x1ac7e1]);socket['emit'](_0xcbca('0x79')+_['capitalize'](_0x501fa8[_0xcbca('0x9d')]())+_0xcbca('0xa2'),_0x583858);}return _0x3f024d;})[_0xcbca('0x21')](function(){if(_0x501fa8===_0xcbca('0xa3')){return db[_0xcbca('0xa4')][_0xcbca('0x43')]({'where':{'id':_0x5d7d5b[_0xcbca('0x57')][_0xcbca('0x5a')]||[]},'raw':!![],'attributes':['id',_0xcbca('0x2f')]});}})['then'](function(_0x26b420){var _0x2a0001=_0x4a5dd6[_0xcbca('0x22')]({'plain':!![]});var _0xaf5ea=[];if(_0x501fa8==='voice'&&_0x2a0001[_0xcbca('0x23')]===_0xcbca('0x6b')&&_0x2a0001['online']){for(var _0x27e052=0x0;_0x27e052<_0x26b420[_0xcbca('0x46')];_0x27e052+=0x1){_0xaf5ea[_0xcbca('0x42')]({'membername':_0x2a0001[_0xcbca('0x2f')],'UserId':_0x2a0001['id'],'queue_name':_0x26b420[_0x27e052]['name'],'VoiceQueueId':_0x26b420[_0x27e052]['id'],'interface':_['isNil'](_0x2a0001[_0xcbca('0x99')])?util['format'](_0xcbca('0xa5'),_0x2a0001['name']):_0x2a0001[_0xcbca('0x99')],'paused':_0x2a0001[_0xcbca('0x98')]||![],'penalty':_0x5d7d5b['body'][_0xcbca('0x9f')]||0x0});}return BPromise[_0xcbca('0x85')](_0xaf5ea,function(_0x234e95){return db[_0xcbca('0xa6')][_0xcbca('0xa7')](_0x234e95);});}return _0x4a5dd6;});}})[_0xcbca('0x21')](respondWithStatusCode(_0x4f1dcb,null))['catch'](handleError(_0x4f1dcb,null));};exports[_0xcbca('0xa8')]=function(_0x4d5a92,_0x4bbced){var _0x1595a2,_0x4a36e5;return db['User'][_0xcbca('0x2e')]({'where':{'id':_0x4d5a92['params']['id']},'attributes':['id',_0xcbca('0x2f'),_0xcbca('0x23')]})[_0xcbca('0x21')](handleEntityNotFound(_0x4bbced,null))[_0xcbca('0x21')](function(_0x3a8c0d){if(_0x3a8c0d){_0x1595a2=_0x3a8c0d;if(!_0x4d5a92[_0xcbca('0x3b')][_0xcbca('0x95')]||!utils['isValidChannel'](_0x4d5a92[_0xcbca('0x3b')][_0xcbca('0x95')])){throw new db[(_0xcbca('0x87'))]['ValidationError']('Unknown\x20channel');}return _0x3a8c0d['remove'+_['capitalize'](_0x4d5a92[_0xcbca('0x3b')][_0xcbca('0x95')][_0xcbca('0x9d')]())+_0xcbca('0x9e')](_0x4d5a92[_0xcbca('0x3b')][_0xcbca('0x5a')]);}})[_0xcbca('0x21')](function(_0x4d7cd9){if(_[_0xcbca('0xa9')](_0x4d5a92[_0xcbca('0x3b')][_0xcbca('0x5a')])){for(var _0x5ef8f4=0x0;_0x5ef8f4<_0x4d5a92[_0xcbca('0x3b')][_0xcbca('0x5a')][_0xcbca('0x46')];_0x5ef8f4+=0x1){_0x4a36e5={'UserId':Number(_0x4d5a92[_0xcbca('0x4f')]['id'])};_0x4a36e5[_[_0xcbca('0x9c')](_0x4d5a92['query'][_0xcbca('0x95')][_0xcbca('0x9d')]())+_0xcbca('0xa1')]=Number(_0x4d5a92['query']['ids'][_0x5ef8f4]);socket[_0xcbca('0xaa')](_0xcbca('0x79')+_[_0xcbca('0x9c')](_0x4d5a92['query'][_0xcbca('0x95')][_0xcbca('0x9d')]())+_0xcbca('0xab'),_0x4a36e5);}}else{_0x4a36e5={'UserId':Number(_0x4d5a92[_0xcbca('0x4f')]['id'])};_0x4a36e5[_[_0xcbca('0x9c')](_0x4d5a92[_0xcbca('0x3b')][_0xcbca('0x95')][_0xcbca('0x9d')]())+_0xcbca('0xa1')]=Number(_0x4d5a92[_0xcbca('0x3b')][_0xcbca('0x5a')]);socket['emit'](_0xcbca('0x79')+_[_0xcbca('0x9c')](_0x4d5a92[_0xcbca('0x3b')][_0xcbca('0x95')][_0xcbca('0x9d')]())+_0xcbca('0xab'),_0x4a36e5);}return _0x4d7cd9;})['then'](function(){if(_0x4d5a92[_0xcbca('0x3b')][_0xcbca('0x95')]==='voice'){return db[_0xcbca('0xa6')][_0xcbca('0x31')]({'where':{'UserId':_0x4d5a92[_0xcbca('0x4f')]['id'],'VoiceQueueId':_0x4d5a92[_0xcbca('0x3b')][_0xcbca('0x5a')]},'individualHooks':!![]})['then'](function(){return _0x1595a2;});}return _0x1595a2;})[_0xcbca('0x21')](respondWithStatusCode(_0x4bbced,null))[_0xcbca('0x4e')](handleError(_0x4bbced,null));};exports[_0xcbca('0xac')]=function(_0x25c2d7,_0x1eb11b){_0x25c2d7[_0xcbca('0x57')][_0xcbca('0xad')]=_0x25c2d7[_0xcbca('0xae')][_0xcbca('0xaf')];return db[_0xcbca('0x35')][_0xcbca('0x2e')]({'where':{'id':_0x25c2d7[_0xcbca('0x4f')]['id']}})[_0xcbca('0x21')](handleEntityNotFound(_0x1eb11b,null))[_0xcbca('0x21')](saveUpdates(_0x25c2d7['body'],null))[_0xcbca('0x21')](respondWithResult(_0x1eb11b,null))[_0xcbca('0x4e')](handleError(_0x1eb11b,null));};exports['getAvatar']=function(_0x33f951,_0x57ccc2){var _0x3d79cb=path[_0xcbca('0xb0')](config[_0xcbca('0xb1')],_0xcbca('0xb2'));return db[_0xcbca('0x35')][_0xcbca('0x2e')]({'where':{'id':_0x33f951[_0xcbca('0x4f')]['id']},'attributes':['id',_0xcbca('0xad')],'raw':!![]})['then'](handleEntityNotFound(_0x57ccc2,null))[_0xcbca('0x21')](function(_0x4b0b9a){if(_0x4b0b9a){if(_[_0xcbca('0x66')](_0x4b0b9a['userpic'])){return _0x57ccc2[_0xcbca('0xb3')](_0x3d79cb);}else{if(!fs[_0xcbca('0xb4')](path[_0xcbca('0xb0')](config[_0xcbca('0xb1')],_0xcbca('0xb5'),_0x4b0b9a['userpic']))){return _0x57ccc2[_0xcbca('0xb3')](_0x3d79cb);}return _0x57ccc2['download'](path[_0xcbca('0xb0')](config[_0xcbca('0xb1')],'server/files/images/',_0x4b0b9a[_0xcbca('0xad')]));}}})[_0xcbca('0x4e')](handleError(_0x57ccc2,null));};exports[_0xcbca('0xb6')]=function(_0x24741c,_0x5e413f){return db[_0xcbca('0x35')][_0xcbca('0x2e')]({'where':{'id':_0x24741c['params']['id']},'attributes':['id']})[_0xcbca('0x21')](handleEntityNotFound(_0x5e413f,null))[_0xcbca('0x21')](function(_0x369a0a){var _0x1bbf05=[];values=_0x369a0a[_0xcbca('0x48')];_0x1bbf05['push'](get_open_tabs(_0xcbca('0x47'),_0x369a0a['dataValues']));_0x1bbf05[_0xcbca('0x42')](get_open_tabs('sms',_0x369a0a[_0xcbca('0x48')]));_0x1bbf05[_0xcbca('0x42')](get_open_tabs(_0xcbca('0xb7'),_0x369a0a[_0xcbca('0x48')]));_0x1bbf05['push'](get_open_tabs(_0xcbca('0x4c'),_0x369a0a[_0xcbca('0x48')]));_0x1bbf05[_0xcbca('0x42')](get_open_tabs(_0xcbca('0x4a'),_0x369a0a[_0xcbca('0x48')]));_0x1bbf05['push'](get_open_tabs(_0xcbca('0x4b'),_0x369a0a[_0xcbca('0x48')]));return BPromise[_0xcbca('0x4d')](_0x1bbf05);})['then'](function(_0x2b3abf){if(_0x2b3abf){var _0x2085e5=_['map'](values[_0xcbca('0xb8')],function(_0x5a1be6){return{'channel':'CHAT','id':_0x5a1be6['id'],'createdAt':_0x5a1be6['createdAt']};});var _0x1641ca=_[_0xcbca('0x2b')](values['FaxOpenTabs'],function(_0x3d695b){return{'channel':_0xcbca('0xb9'),'id':_0x3d695b['id'],'createdAt':_0x3d695b[_0xcbca('0xba')]};});var _0x24b4c2=_[_0xcbca('0x2b')](values[_0xcbca('0xbb')],function(_0x44d6ed){return{'channel':_0xcbca('0xbc'),'id':_0x44d6ed['id'],'createdAt':_0x44d6ed[_0xcbca('0xba')]};});var _0x15d576=_[_0xcbca('0x2b')](values[_0xcbca('0xbd')],function(_0x52583d){return{'channel':_0xcbca('0xbe'),'id':_0x52583d['id'],'createdAt':_0x52583d[_0xcbca('0xba')]};});var _0x36b68b=_['map'](values[_0xcbca('0xbf')],function(_0xdecc03){return{'channel':'SMS','id':_0xdecc03['id'],'createdAt':_0xdecc03[_0xcbca('0xba')]};});var _0x9cd856=_[_0xcbca('0x2b')](values[_0xcbca('0xc0')],function(_0x248c10){return{'channel':_0xcbca('0xc1'),'id':_0x248c10['id'],'createdAt':_0x248c10[_0xcbca('0xba')]};});var _0x13cd76=_[_0xcbca('0xc2')](_0x2085e5,_0x1641ca,_0x24b4c2,_0x15d576,_0x36b68b,_0x9cd856);var _0x491bac={'count':_0x13cd76[_0xcbca('0x46')],'rows':_0x13cd76};return _0x491bac;}else return null;})[_0xcbca('0x21')](respondWithResult(_0x5e413f,null))[_0xcbca('0x4e')](handleError(_0x5e413f,null));};exports[_0xcbca('0xc3')]=function(_0x40962d,_0x2cedaa){var _0x4ceeb0={};var _0x514ada={};var _0x1c3105;var _0x2c4a92;return db[_0xcbca('0x35')]['findOne']({'where':{'id':_0x40962d[_0xcbca('0x4f')]['id']}})[_0xcbca('0x21')](handleEntityNotFound(_0x2cedaa,null))[_0xcbca('0x21')](function(_0x273be8){if(_0x273be8){_0x1c3105=_0x273be8;_0x514ada[_0xcbca('0x50')]=_[_0xcbca('0xc4')](db[_0xcbca('0xc5')]['rawAttributes']);_0x514ada[_0xcbca('0x3b')]=_[_0xcbca('0xc4')](_0x40962d[_0xcbca('0x3b')]);_0x514ada[_0xcbca('0x53')]=_[_0xcbca('0xc6')](_0x514ada[_0xcbca('0x50')],_0x514ada[_0xcbca('0x3b')]);_0x4ceeb0['attributes']=_[_0xcbca('0xc6')](_0x514ada[_0xcbca('0x50')],qs[_0xcbca('0x54')](_0x40962d[_0xcbca('0x3b')]['fields']));_0x4ceeb0[_0xcbca('0x41')]=_0x4ceeb0['attributes']['length']?_0x4ceeb0[_0xcbca('0x41')]:_0x514ada[_0xcbca('0x50')];_0x4ceeb0[_0xcbca('0xc7')]=qs[_0xcbca('0xc8')](_0x40962d[_0xcbca('0x3b')][_0xcbca('0xc8')]);_0x4ceeb0[_0xcbca('0x3a')]=qs['filters'](_[_0xcbca('0xc9')](_0x40962d['query'],_0x514ada[_0xcbca('0x53')]));if(_0x40962d[_0xcbca('0x3b')][_0xcbca('0x29')]){_0x4ceeb0[_0xcbca('0x3a')]=_[_0xcbca('0x55')](_0x4ceeb0['where'],{'$or':_['map'](_0x4ceeb0[_0xcbca('0x41')],function(_0x3fe919){var _0xa6b022={};_0xa6b022[_0x3fe919]={'$like':'%'+_0x40962d[_0xcbca('0x3b')][_0xcbca('0x29')]+'%'};return _0xa6b022;})});}_0x4ceeb0=_[_0xcbca('0x55')]({},_0x4ceeb0,_0x40962d['options']);return _0x1c3105['getContacts'](_0x4ceeb0);}})[_0xcbca('0x21')](function(_0x51aaf6){if(_0x51aaf6){_0x2c4a92=_0x51aaf6[_0xcbca('0x46')];if(_0x40962d[_0xcbca('0x3b')][_0xcbca('0xca')]('includeAll')){_0x4ceeb0[_0xcbca('0x3d')]=[{'model':db[_0xcbca('0xcb')],'as':_0xcbca('0xcc'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xcbca('0xcd')],'where':_0x40962d['query'][_0xcbca('0xce')]?{'id':_0x40962d[_0xcbca('0x3b')]['tag']}:undefined,'required':_0x40962d['query']['tag']?!![]:![]}];}if(!_0x40962d[_0xcbca('0x3b')][_0xcbca('0xca')](_0xcbca('0xcf'))){_0x4ceeb0[_0xcbca('0xd0')]=qs[_0xcbca('0xd0')](_0x40962d['query']['limit']);_0x4ceeb0[_0xcbca('0x1b')]=qs['offset'](_0x40962d[_0xcbca('0x3b')]['offset']);}return _0x1c3105[_0xcbca('0xc3')](_0x4ceeb0);}})[_0xcbca('0x21')](function(_0x30a360){if(_0x30a360){return _0x30a360?{'count':_0x2c4a92,'rows':_0x30a360}:null;}})[_0xcbca('0x21')](respondWithResult(_0x2cedaa,null))[_0xcbca('0x4e')](handleError(_0x2cedaa,null));};exports[_0xcbca('0xd1')]=function(_0x23429e,_0x561f99){var _0x50f7b1;var _0x14e838={};var _0x59e1df;return db['User']['findOne']({'where':{'id':_0x23429e[_0xcbca('0x4f')]['id']},'attributes':['id','name',_0xcbca('0x23')]})[_0xcbca('0x21')](handleEntityNotFound(_0x561f99,null))[_0xcbca('0x21')](function(_0x10676a){if(!utils[_0xcbca('0xd2')](_0x23429e[_0xcbca('0x3b')]['channel'])){throw new db[(_0xcbca('0x87'))][(_0xcbca('0x88'))]('Unknown\x20channel');}_0x50f7b1=_0x10676a;var _0x13b98b={};_0x13b98b[_0xcbca('0x50')]=_[_0xcbca('0xc4')](db[_['capitalize'](_0x23429e[_0xcbca('0x3b')][_0xcbca('0x95')])+_0xcbca('0xd3')][_0xcbca('0x52')]);_0x13b98b[_0xcbca('0x3b')]=_[_0xcbca('0xc4')](_0x23429e['query']);_0x13b98b[_0xcbca('0x53')]=_[_0xcbca('0xc6')](_0x13b98b[_0xcbca('0x50')],_0x13b98b[_0xcbca('0x3b')]);_0x14e838[_0xcbca('0x41')]=_[_0xcbca('0xc6')](_0x13b98b['model'],qs[_0xcbca('0x54')](_0x23429e[_0xcbca('0x3b')][_0xcbca('0x54')]));_0x14e838[_0xcbca('0x41')]=_0x14e838[_0xcbca('0x41')][_0xcbca('0x46')]?_0x14e838[_0xcbca('0x41')]:_0x13b98b['model'];_0x14e838[_0xcbca('0xc7')]=qs['sort'](_0x23429e['query'][_0xcbca('0xc8')]);_0x14e838[_0xcbca('0x3a')]=qs[_0xcbca('0x53')](_['pick'](_0x23429e['query'],_0x13b98b['filters']));if(_0x23429e[_0xcbca('0x3b')][_0xcbca('0x29')]){_0x14e838['where']=_[_0xcbca('0x55')](_0x14e838['where'],{'$or':_['map'](_0x14e838[_0xcbca('0x41')],function(_0x37063a){var _0x3df7e6={};_0x3df7e6[_0x37063a]={'$like':'%'+_0x23429e[_0xcbca('0x3b')][_0xcbca('0x29')]+'%'};return _0x3df7e6;})});}_0x14e838=_['merge']({},_0x14e838,_0x23429e[_0xcbca('0x56')]);switch(_0x50f7b1[_0xcbca('0x23')]){case _0xcbca('0x24'):return db[_[_0xcbca('0x9c')](_0x23429e[_0xcbca('0x3b')][_0xcbca('0x95')])+_0xcbca('0xd3')]['findAll'](_0x14e838);case _0xcbca('0x79'):case _0xcbca('0x6b'):return _0x50f7b1[_0xcbca('0x22')+_['capitalize'](_0x23429e[_0xcbca('0x3b')][_0xcbca('0x95')])+'Queues'](_0x14e838);default:throw new db[(_0xcbca('0x87'))]['ValidationError'](_0xcbca('0xd4'));}})[_0xcbca('0x21')](function(_0x53edfb){_0x59e1df=_0x53edfb[_0xcbca('0x46')];if(!_0x23429e['query']['hasOwnProperty'](_0xcbca('0xcf'))){_0x14e838[_0xcbca('0xd0')]=qs[_0xcbca('0xd0')](_0x23429e[_0xcbca('0x3b')][_0xcbca('0xd0')]);_0x14e838[_0xcbca('0x1b')]=qs[_0xcbca('0x1b')](_0x23429e[_0xcbca('0x3b')][_0xcbca('0x1b')]);}switch(_0x50f7b1[_0xcbca('0x23')]){case _0xcbca('0x24'):return db[_[_0xcbca('0x9c')](_0x23429e[_0xcbca('0x3b')][_0xcbca('0x95')])+_0xcbca('0xd3')][_0xcbca('0x43')](_0x14e838);case _0xcbca('0x79'):case _0xcbca('0x6b'):return _0x50f7b1['get'+_[_0xcbca('0x9c')](_0x23429e[_0xcbca('0x3b')][_0xcbca('0x95')])+'Queues'](_0x14e838);}})['then'](function(_0x28b36c){return{'count':_0x59e1df,'rows':_0x28b36c};})[_0xcbca('0x21')](respondWithResult(_0x561f99,null))[_0xcbca('0x4e')](handleError(_0x561f99,null));};exports[_0xcbca('0xd5')]=function(_0x191fff,_0x1da4b8){var _0x3a2ea0={};var _0xc3588={};var _0x553e09;var _0x305edb;return db[_0xcbca('0x35')][_0xcbca('0x90')]({'where':{'id':_0x191fff[_0xcbca('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1da4b8,null))['then'](function(_0x444a90){if(_0x444a90){_0x553e09=_0x444a90;_0xc3588[_0xcbca('0x50')]=_[_0xcbca('0xc4')](db['UserVoiceQueueRt'][_0xcbca('0x52')]);_0xc3588[_0xcbca('0x3b')]=_[_0xcbca('0xc4')](_0x191fff[_0xcbca('0x3b')]);_0xc3588[_0xcbca('0x53')]=_['intersection'](_0xc3588[_0xcbca('0x50')],_0xc3588[_0xcbca('0x3b')]);_0x3a2ea0[_0xcbca('0x41')]=_[_0xcbca('0xc6')](_0xc3588[_0xcbca('0x50')],qs[_0xcbca('0x54')](_0x191fff['query'][_0xcbca('0x54')]));_0x3a2ea0[_0xcbca('0x41')]=_0x3a2ea0[_0xcbca('0x41')][_0xcbca('0x46')]?_0x3a2ea0[_0xcbca('0x41')]:_0xc3588[_0xcbca('0x50')];_0x3a2ea0[_0xcbca('0xc7')]=qs[_0xcbca('0xc8')](_0x191fff[_0xcbca('0x3b')][_0xcbca('0xc8')]);_0x3a2ea0[_0xcbca('0x3a')]=qs[_0xcbca('0x53')](_[_0xcbca('0xc9')](_0x191fff[_0xcbca('0x3b')],_0xc3588[_0xcbca('0x53')]));if(_0x191fff[_0xcbca('0x3b')][_0xcbca('0x29')]){_0x3a2ea0[_0xcbca('0x3a')]=_[_0xcbca('0x55')](_0x3a2ea0[_0xcbca('0x3a')],{'$or':_[_0xcbca('0x2b')](_0x3a2ea0[_0xcbca('0x41')],function(_0x119dd0){var _0x4f491a={};_0x4f491a[_0x119dd0]={'$like':'%'+_0x191fff[_0xcbca('0x3b')][_0xcbca('0x29')]+'%'};return _0x4f491a;})});}_0x3a2ea0=_[_0xcbca('0x55')]({},_0x3a2ea0,_0x191fff[_0xcbca('0x56')]);return _0x553e09[_0xcbca('0xd5')](_0x3a2ea0);}})[_0xcbca('0x21')](function(_0x1f4e7a){if(_0x1f4e7a){_0x305edb=_0x1f4e7a[_0xcbca('0x46')];if(!_0x191fff[_0xcbca('0x3b')][_0xcbca('0xca')](_0xcbca('0xcf'))){_0x3a2ea0[_0xcbca('0xd0')]=qs['limit'](_0x191fff[_0xcbca('0x3b')][_0xcbca('0xd0')]);_0x3a2ea0[_0xcbca('0x1b')]=qs[_0xcbca('0x1b')](_0x191fff['query'][_0xcbca('0x1b')]);}return _0x553e09[_0xcbca('0xd5')](_0x3a2ea0);}})[_0xcbca('0x21')](function(_0x5ccb0b){if(_0x5ccb0b){return _0x5ccb0b?{'count':_0x305edb,'rows':_0x5ccb0b}:null;}})[_0xcbca('0x21')](respondWithResult(_0x1da4b8,null))[_0xcbca('0x4e')](handleError(_0x1da4b8,null));};exports[_0xcbca('0xd6')]=function(_0x2d82bb,_0x11816d){var _0x3d7a3f={};var _0x405c6e={};var _0x387b4c;var _0x256022;return db[_0xcbca('0x35')]['findOne']({'where':{'id':_0x2d82bb[_0xcbca('0x4f')]['id']}})[_0xcbca('0x21')](handleEntityNotFound(_0x11816d,null))[_0xcbca('0x21')](function(_0x43295a){if(_0x43295a){_0x387b4c=_0x43295a;_0x405c6e[_0xcbca('0x50')]=_[_0xcbca('0xc4')](db[_0xcbca('0xd7')][_0xcbca('0x52')]);_0x405c6e['query']=_[_0xcbca('0xc4')](_0x2d82bb[_0xcbca('0x3b')]);_0x405c6e[_0xcbca('0x53')]=_[_0xcbca('0xc6')](_0x405c6e['model'],_0x405c6e['query']);_0x3d7a3f[_0xcbca('0x41')]=_['intersection'](_0x405c6e[_0xcbca('0x50')],qs[_0xcbca('0x54')](_0x2d82bb[_0xcbca('0x3b')][_0xcbca('0x54')]));_0x3d7a3f[_0xcbca('0x41')]=_0x3d7a3f[_0xcbca('0x41')][_0xcbca('0x46')]?_0x3d7a3f[_0xcbca('0x41')]:_0x405c6e[_0xcbca('0x50')];_0x3d7a3f[_0xcbca('0xc7')]=qs[_0xcbca('0xc8')](_0x2d82bb[_0xcbca('0x3b')][_0xcbca('0xc8')]);_0x3d7a3f['where']=qs['filters'](_[_0xcbca('0xc9')](_0x2d82bb['query'],_0x405c6e[_0xcbca('0x53')]));if(_0x2d82bb[_0xcbca('0x3b')][_0xcbca('0x29')]){_0x3d7a3f[_0xcbca('0x3a')]=_[_0xcbca('0x55')](_0x3d7a3f[_0xcbca('0x3a')],{'$or':_[_0xcbca('0x2b')](_0x3d7a3f['attributes'],function(_0x8d7dbb){var _0x43be6b={};_0x43be6b[_0x8d7dbb]={'$like':'%'+_0x2d82bb[_0xcbca('0x3b')][_0xcbca('0x29')]+'%'};return _0x43be6b;})});}_0x3d7a3f=_[_0xcbca('0x55')]({},_0x3d7a3f,_0x2d82bb[_0xcbca('0x56')]);return _0x387b4c[_0xcbca('0xd6')](_0x3d7a3f);}})[_0xcbca('0x21')](function(_0x71d88a){if(_0x71d88a){_0x256022=_0x71d88a[_0xcbca('0x46')];if(!_0x2d82bb[_0xcbca('0x3b')][_0xcbca('0xca')](_0xcbca('0xcf'))){_0x3d7a3f[_0xcbca('0xd0')]=qs[_0xcbca('0xd0')](_0x2d82bb[_0xcbca('0x3b')][_0xcbca('0xd0')]);_0x3d7a3f['offset']=qs[_0xcbca('0x1b')](_0x2d82bb[_0xcbca('0x3b')][_0xcbca('0x1b')]);}return _0x387b4c[_0xcbca('0xd6')](_0x3d7a3f);}})[_0xcbca('0x21')](function(_0xb2a278){if(_0xb2a278){return _0xb2a278?{'count':_0x256022,'rows':_0xb2a278}:null;}})[_0xcbca('0x21')](respondWithResult(_0x11816d,null))[_0xcbca('0x4e')](handleError(_0x11816d,null));};exports[_0xcbca('0xd8')]=function(_0x4e8a04,_0x58253e){var _0x2527e3={'raw':!![],'where':{}};var _0x4c8f73={};var _0x38249b={'count':0x0,'rows':[]};return db[_0xcbca('0x35')][_0xcbca('0x90')]({'where':{'id':_0x4e8a04[_0xcbca('0x4f')]['id']}})[_0xcbca('0x21')](handleEntityNotFound(_0x58253e,null))[_0xcbca('0x21')](function(_0x28f2e8){if(_0x28f2e8){_0x4c8f73['model']=_['keys'](db[_0xcbca('0xd9')][_0xcbca('0x52')]);_0x4c8f73[_0xcbca('0x3b')]=_['keys'](_0x4e8a04[_0xcbca('0x3b')]);_0x4c8f73[_0xcbca('0x53')]=_[_0xcbca('0xc6')](_0x4c8f73[_0xcbca('0x50')],_0x4c8f73[_0xcbca('0x3b')]);_0x2527e3[_0xcbca('0x41')]=_[_0xcbca('0xc6')](_0x4c8f73['model'],qs[_0xcbca('0x54')](_0x4e8a04[_0xcbca('0x3b')][_0xcbca('0x54')]));_0x2527e3[_0xcbca('0x41')]=_0x2527e3[_0xcbca('0x41')][_0xcbca('0x46')]?_0x2527e3[_0xcbca('0x41')]:_0x4c8f73[_0xcbca('0x50')];if(!_0x4e8a04[_0xcbca('0x3b')][_0xcbca('0xca')](_0xcbca('0xcf'))){_0x2527e3['limit']=qs[_0xcbca('0xd0')](_0x4e8a04['query']['limit']);_0x2527e3['offset']=qs[_0xcbca('0x1b')](_0x4e8a04[_0xcbca('0x3b')][_0xcbca('0x1b')]);}_0x2527e3['order']=qs[_0xcbca('0xc8')](_0x4e8a04[_0xcbca('0x3b')][_0xcbca('0xc8')]);_0x2527e3[_0xcbca('0x3a')]=qs[_0xcbca('0x53')](_[_0xcbca('0xc9')](_0x4e8a04[_0xcbca('0x3b')],_0x4c8f73[_0xcbca('0x53')]));_0x2527e3[_0xcbca('0x3a')]['UserId']=_0x28f2e8['id'];if(_0x4e8a04[_0xcbca('0x3b')][_0xcbca('0x29')]){_0x2527e3[_0xcbca('0x3a')]=_[_0xcbca('0x55')](_0x2527e3[_0xcbca('0x3a')],{'$or':_[_0xcbca('0x2b')](_0x2527e3[_0xcbca('0x41')],function(_0x571f0a){var _0x16a05f={};_0x16a05f[_0x571f0a]={'$like':'%'+_0x4e8a04[_0xcbca('0x3b')][_0xcbca('0x29')]+'%'};return _0x16a05f;})});}_0x2527e3=_[_0xcbca('0x55')]({},_0x2527e3,_0x4e8a04[_0xcbca('0x56')]);return db[_0xcbca('0xd9')]['count']({'where':_0x2527e3[_0xcbca('0x3a')]})[_0xcbca('0x21')](function(_0x2df338){_0x38249b[_0xcbca('0x1d')]=_0x2df338;if(_0x4e8a04[_0xcbca('0x3b')][_0xcbca('0x3c')]){_0x2527e3['include']=[{'all':!![]}];}return db[_0xcbca('0xd9')][_0xcbca('0x43')](_0x2527e3);})[_0xcbca('0x21')](function(_0x1833d0){_0x38249b[_0xcbca('0x45')]=_0x1833d0;return _0x38249b;});}})[_0xcbca('0x21')](respondWithFilteredResult(_0x58253e,_0x2527e3))[_0xcbca('0x4e')](handleError(_0x58253e,null));};exports['getScreenRecordings']=function(_0x1da109,_0x182f12){var _0x101f3c={'raw':!![],'where':{}};var _0x540804={};var _0xa8862a={'count':0x0,'rows':[]};return db[_0xcbca('0x35')]['findOne']({'where':{'id':_0x1da109['params']['id']}})[_0xcbca('0x21')](handleEntityNotFound(_0x182f12,null))[_0xcbca('0x21')](function(_0x1c9adb){if(_0x1c9adb){_0x540804['model']=_[_0xcbca('0xc4')](db[_0xcbca('0xda')][_0xcbca('0x52')]);_0x540804['query']=_[_0xcbca('0xc4')](_0x1da109[_0xcbca('0x3b')]);_0x540804['filters']=_['intersection'](_0x540804[_0xcbca('0x50')],_0x540804[_0xcbca('0x3b')]);_0x101f3c['attributes']=_[_0xcbca('0xc6')](_0x540804[_0xcbca('0x50')],qs[_0xcbca('0x54')](_0x1da109[_0xcbca('0x3b')][_0xcbca('0x54')]));_0x101f3c[_0xcbca('0x41')]=_0x101f3c[_0xcbca('0x41')][_0xcbca('0x46')]?_0x101f3c[_0xcbca('0x41')]:_0x540804[_0xcbca('0x50')];if(!_0x1da109[_0xcbca('0x3b')][_0xcbca('0xca')](_0xcbca('0xcf'))){_0x101f3c['limit']=qs[_0xcbca('0xd0')](_0x1da109[_0xcbca('0x3b')]['limit']);_0x101f3c[_0xcbca('0x1b')]=qs[_0xcbca('0x1b')](_0x1da109[_0xcbca('0x3b')]['offset']);}_0x101f3c[_0xcbca('0xc7')]=qs[_0xcbca('0xc8')](_0x1da109['query'][_0xcbca('0xc8')]);_0x101f3c[_0xcbca('0x3a')]=qs[_0xcbca('0x53')](_[_0xcbca('0xc9')](_0x1da109['query'],_0x540804['filters']));_0x101f3c[_0xcbca('0x3a')]['UserId']=_0x1c9adb['id'];if(_0x1da109[_0xcbca('0x3b')][_0xcbca('0x29')]){_0x101f3c[_0xcbca('0x3a')]=_[_0xcbca('0x55')](_0x101f3c['where'],{'$or':_['map'](_0x101f3c['attributes'],function(_0x116d0c){var _0x29f1bc={};_0x29f1bc[_0x116d0c]={'$like':'%'+_0x1da109[_0xcbca('0x3b')][_0xcbca('0x29')]+'%'};return _0x29f1bc;})});}_0x101f3c=_[_0xcbca('0x55')]({},_0x101f3c,_0x1da109[_0xcbca('0x56')]);return db[_0xcbca('0xda')][_0xcbca('0x1d')]({'where':_0x101f3c['where']})[_0xcbca('0x21')](function(_0x4731c4){_0xa8862a[_0xcbca('0x1d')]=_0x4731c4;if(_0x1da109[_0xcbca('0x3b')][_0xcbca('0x3c')]){_0x101f3c[_0xcbca('0x3d')]=[{'all':!![]}];}return db[_0xcbca('0xda')]['findAll'](_0x101f3c);})[_0xcbca('0x21')](function(_0x4a6911){_0xa8862a[_0xcbca('0x45')]=_0x4a6911;return _0xa8862a;});}})[_0xcbca('0x21')](respondWithFilteredResult(_0x182f12,_0x101f3c))['catch'](handleError(_0x182f12,null));};exports[_0xcbca('0xdb')]=function(_0x1b8807,_0x582ac2){var _0x207884={};var _0x41875e={};var _0x2f7847;var _0x2453ad;return db[_0xcbca('0x35')][_0xcbca('0x90')]({'where':{'id':_0x1b8807['params']['id']}})[_0xcbca('0x21')](handleEntityNotFound(_0x582ac2,null))[_0xcbca('0x21')](function(_0x13df2d){if(_0x13df2d){_0x2f7847=_0x13df2d;_0x41875e[_0xcbca('0x50')]=_[_0xcbca('0xc4')](db[_0xcbca('0xdc')][_0xcbca('0x52')]);_0x41875e['query']=_[_0xcbca('0xc4')](_0x1b8807[_0xcbca('0x3b')]);_0x41875e[_0xcbca('0x53')]=_['intersection'](_0x41875e[_0xcbca('0x50')],_0x41875e['query']);_0x207884[_0xcbca('0x41')]=_[_0xcbca('0xc6')](_0x41875e[_0xcbca('0x50')],qs[_0xcbca('0x54')](_0x1b8807['query']['fields']));_0x207884[_0xcbca('0x41')]=_0x207884[_0xcbca('0x41')][_0xcbca('0x46')]?_0x207884[_0xcbca('0x41')]:_0x41875e[_0xcbca('0x50')];_0x207884[_0xcbca('0xc7')]=qs[_0xcbca('0xc8')](_0x1b8807[_0xcbca('0x3b')][_0xcbca('0xc8')]);_0x207884['where']=qs[_0xcbca('0x53')](_[_0xcbca('0xc9')](_0x1b8807['query'],_0x41875e[_0xcbca('0x53')]));if(_0x1b8807[_0xcbca('0x3b')][_0xcbca('0x29')]){_0x207884[_0xcbca('0x3a')]=_[_0xcbca('0x55')](_0x207884[_0xcbca('0x3a')],{'$or':_[_0xcbca('0x2b')](_0x207884[_0xcbca('0x41')],function(_0x2ca5f7){var _0x14c2b6={};_0x14c2b6[_0x2ca5f7]={'$like':'%'+_0x1b8807[_0xcbca('0x3b')][_0xcbca('0x29')]+'%'};return _0x14c2b6;})});}_0x207884=_['merge']({},_0x207884,_0x1b8807['options']);return _0x2f7847[_0xcbca('0xdb')](_0x207884);}})[_0xcbca('0x21')](function(_0xa36076){if(_0xa36076){_0x2453ad=_0xa36076[_0xcbca('0x46')];if(!_0x1b8807['query'][_0xcbca('0xca')]('nolimit')){_0x207884[_0xcbca('0xd0')]=qs['limit'](_0x1b8807[_0xcbca('0x3b')][_0xcbca('0xd0')]);_0x207884['offset']=qs[_0xcbca('0x1b')](_0x1b8807[_0xcbca('0x3b')][_0xcbca('0x1b')]);}return _0x2f7847[_0xcbca('0xdb')](_0x207884);}})['then'](function(_0x461d37){if(_0x461d37){return _0x461d37?{'count':_0x2453ad,'rows':_0x461d37}:null;}})['then'](respondWithResult(_0x582ac2,null))[_0xcbca('0x4e')](handleError(_0x582ac2,null));};exports[_0xcbca('0xdd')]=function(_0x397d3e,_0x1dc4e1){var _0x5029bc={};var _0x1e0b1c={};var _0x2c0b03;var _0x16e4f9;return db[_0xcbca('0x35')][_0xcbca('0x90')]({'where':{'id':_0x397d3e['params']['id']}})['then'](handleEntityNotFound(_0x1dc4e1,null))[_0xcbca('0x21')](function(_0x1b16ff){if(_0x1b16ff){_0x2c0b03=_0x1b16ff;_0x1e0b1c['model']=_[_0xcbca('0xc4')](db['OpenchannelInteraction'][_0xcbca('0x52')]);_0x1e0b1c['query']=_[_0xcbca('0xc4')](_0x397d3e['query']);_0x1e0b1c[_0xcbca('0x53')]=_[_0xcbca('0xc6')](_0x1e0b1c[_0xcbca('0x50')],_0x1e0b1c[_0xcbca('0x3b')]);_0x5029bc['attributes']=_[_0xcbca('0xc6')](_0x1e0b1c['model'],qs[_0xcbca('0x54')](_0x397d3e[_0xcbca('0x3b')][_0xcbca('0x54')]));_0x5029bc[_0xcbca('0x41')]=_0x5029bc[_0xcbca('0x41')][_0xcbca('0x46')]?_0x5029bc[_0xcbca('0x41')]:_0x1e0b1c[_0xcbca('0x50')];_0x5029bc['order']=qs[_0xcbca('0xc8')](_0x397d3e[_0xcbca('0x3b')][_0xcbca('0xc8')]);_0x5029bc['where']=qs[_0xcbca('0x53')](_[_0xcbca('0xc9')](_0x397d3e[_0xcbca('0x3b')],_0x1e0b1c['filters']));if(_0x397d3e[_0xcbca('0x3b')]['filter']){_0x5029bc[_0xcbca('0x3a')]=_[_0xcbca('0x55')](_0x5029bc[_0xcbca('0x3a')],{'$or':_[_0xcbca('0x2b')](_0x5029bc['attributes'],function(_0x490099){var _0x3daec6={};_0x3daec6[_0x490099]={'$like':'%'+_0x397d3e[_0xcbca('0x3b')][_0xcbca('0x29')]+'%'};return _0x3daec6;})});}_0x5029bc=_[_0xcbca('0x55')]({},_0x5029bc,_0x397d3e[_0xcbca('0x56')]);return _0x2c0b03['getOpenchannelInteractions'](_0x5029bc);}})['then'](function(_0x26f928){if(_0x26f928){_0x16e4f9=_0x26f928['length'];if(!_0x397d3e[_0xcbca('0x3b')][_0xcbca('0xca')](_0xcbca('0xcf'))){_0x5029bc[_0xcbca('0xd0')]=qs[_0xcbca('0xd0')](_0x397d3e[_0xcbca('0x3b')][_0xcbca('0xd0')]);_0x5029bc['offset']=qs[_0xcbca('0x1b')](_0x397d3e[_0xcbca('0x3b')][_0xcbca('0x1b')]);}return _0x2c0b03['getOpenchannelInteractions'](_0x5029bc);}})['then'](function(_0xb9b885){if(_0xb9b885){return _0xb9b885?{'count':_0x16e4f9,'rows':_0xb9b885}:null;}})[_0xcbca('0x21')](respondWithResult(_0x1dc4e1,null))[_0xcbca('0x4e')](handleError(_0x1dc4e1,null));};exports[_0xcbca('0xde')]=function(_0x577a94,_0x3fd7bb){var _0x16f447={'raw':!![],'where':{}};var _0x36f356={};var _0x822711={'count':0x0,'rows':[]};return db['User'][_0xcbca('0x90')]({'where':{'id':_0x577a94[_0xcbca('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3fd7bb,null))[_0xcbca('0x21')](function(_0x3e85f3){if(_0x3e85f3){_0x36f356['model']=_[_0xcbca('0xc4')](db[_0xcbca('0xdf')][_0xcbca('0x52')]);_0x36f356[_0xcbca('0x3b')]=_['keys'](_0x577a94[_0xcbca('0x3b')]);_0x36f356[_0xcbca('0x53')]=_['intersection'](_0x36f356[_0xcbca('0x50')],_0x36f356['query']);_0x16f447[_0xcbca('0x41')]=_[_0xcbca('0xc6')](_0x36f356['model'],qs[_0xcbca('0x54')](_0x577a94[_0xcbca('0x3b')][_0xcbca('0x54')]));_0x16f447[_0xcbca('0x41')]=_0x16f447[_0xcbca('0x41')][_0xcbca('0x46')]?_0x16f447['attributes']:_0x36f356['model'];if(!_0x577a94[_0xcbca('0x3b')][_0xcbca('0xca')](_0xcbca('0xcf'))){_0x16f447[_0xcbca('0xd0')]=qs[_0xcbca('0xd0')](_0x577a94[_0xcbca('0x3b')]['limit']);_0x16f447[_0xcbca('0x1b')]=qs[_0xcbca('0x1b')](_0x577a94[_0xcbca('0x3b')][_0xcbca('0x1b')]);}_0x16f447[_0xcbca('0xc7')]=qs[_0xcbca('0xc8')](_0x577a94[_0xcbca('0x3b')]['sort']);_0x16f447[_0xcbca('0x3a')]=qs[_0xcbca('0x53')](_['pick'](_0x577a94[_0xcbca('0x3b')],_0x36f356['filters']));_0x16f447[_0xcbca('0x3a')][_0xcbca('0xe0')]=_0x3e85f3['id'];if(_0x577a94[_0xcbca('0x3b')][_0xcbca('0x29')]){_0x16f447[_0xcbca('0x3a')]=_['merge'](_0x16f447[_0xcbca('0x3a')],{'$or':_[_0xcbca('0x2b')](_0x16f447[_0xcbca('0x41')],function(_0x2478d3){var _0x4f4efb={};_0x4f4efb[_0x2478d3]={'$like':'%'+_0x577a94['query'][_0xcbca('0x29')]+'%'};return _0x4f4efb;})});}_0x16f447=_[_0xcbca('0x55')]({},_0x16f447,_0x577a94[_0xcbca('0x56')]);return db[_0xcbca('0xdf')][_0xcbca('0x1d')]({'where':_0x16f447[_0xcbca('0x3a')]})[_0xcbca('0x21')](function(_0x40130b){_0x822711[_0xcbca('0x1d')]=_0x40130b;if(_0x577a94[_0xcbca('0x3b')][_0xcbca('0x3c')]){_0x16f447[_0xcbca('0x3d')]=[{'all':!![]}];}return db['MailInteraction'][_0xcbca('0x43')](_0x16f447);})[_0xcbca('0x21')](function(_0x4fd43c){_0x822711[_0xcbca('0x45')]=_0x4fd43c;return _0x822711;});}})[_0xcbca('0x21')](respondWithFilteredResult(_0x3fd7bb,_0x16f447))[_0xcbca('0x4e')](handleError(_0x3fd7bb,null));};exports[_0xcbca('0xe1')]=function(_0x5bba6a,_0x2e7497){var _0xcf915a={};var _0x20ae8b={};var _0x2ed05e;var _0x4366a3;return db[_0xcbca('0x35')][_0xcbca('0x90')]({'where':{'id':_0x5bba6a[_0xcbca('0x4f')]['id']}})[_0xcbca('0x21')](handleEntityNotFound(_0x2e7497,null))['then'](function(_0x3cf700){if(_0x3cf700){_0x2ed05e=_0x3cf700;_0x20ae8b[_0xcbca('0x50')]=_['keys'](db[_0xcbca('0xe2')][_0xcbca('0x52')]);_0x20ae8b[_0xcbca('0x3b')]=_[_0xcbca('0xc4')](_0x5bba6a['query']);_0x20ae8b['filters']=_[_0xcbca('0xc6')](_0x20ae8b[_0xcbca('0x50')],_0x20ae8b[_0xcbca('0x3b')]);_0xcf915a[_0xcbca('0x41')]=_['intersection'](_0x20ae8b[_0xcbca('0x50')],qs['fields'](_0x5bba6a[_0xcbca('0x3b')]['fields']));_0xcf915a['attributes']=_0xcf915a[_0xcbca('0x41')]['length']?_0xcf915a[_0xcbca('0x41')]:_0x20ae8b['model'];_0xcf915a['order']=qs[_0xcbca('0xc8')](_0x5bba6a[_0xcbca('0x3b')][_0xcbca('0xc8')]);_0xcf915a['where']=qs[_0xcbca('0x53')](_['pick'](_0x5bba6a['query'],_0x20ae8b[_0xcbca('0x53')]));if(_0x5bba6a['query'][_0xcbca('0x29')]){_0xcf915a[_0xcbca('0x3a')]=_[_0xcbca('0x55')](_0xcf915a['where'],{'$or':_['map'](_0xcf915a[_0xcbca('0x41')],function(_0x588bdc){var _0x306f53={};_0x306f53[_0x588bdc]={'$like':'%'+_0x5bba6a[_0xcbca('0x3b')][_0xcbca('0x29')]+'%'};return _0x306f53;})});}_0xcf915a=_[_0xcbca('0x55')]({},_0xcf915a,_0x5bba6a[_0xcbca('0x56')]);return _0x2ed05e[_0xcbca('0xe1')](_0xcf915a);}})[_0xcbca('0x21')](function(_0x3e5889){if(_0x3e5889){_0x4366a3=_0x3e5889[_0xcbca('0x46')];if(!_0x5bba6a[_0xcbca('0x3b')]['hasOwnProperty'](_0xcbca('0xcf'))){_0xcf915a[_0xcbca('0xd0')]=qs['limit'](_0x5bba6a[_0xcbca('0x3b')][_0xcbca('0xd0')]);_0xcf915a['offset']=qs[_0xcbca('0x1b')](_0x5bba6a[_0xcbca('0x3b')]['offset']);}return _0x2ed05e[_0xcbca('0xe1')](_0xcf915a);}})[_0xcbca('0x21')](function(_0x19b547){if(_0x19b547){return _0x19b547?{'count':_0x4366a3,'rows':_0x19b547}:null;}})['then'](respondWithResult(_0x2e7497,null))[_0xcbca('0x4e')](handleError(_0x2e7497,null));};exports['getFaxInteractions']=function(_0x496c48,_0x5595bb){var _0x210622={};var _0xfb05df={};var _0x3b50f5;var _0x4da55d;return db['User'][_0xcbca('0x90')]({'where':{'id':_0x496c48[_0xcbca('0x4f')]['id']}})[_0xcbca('0x21')](handleEntityNotFound(_0x5595bb,null))['then'](function(_0x3089cc){if(_0x3089cc){_0x3b50f5=_0x3089cc;_0xfb05df[_0xcbca('0x50')]=_['keys'](db['FaxInteraction'][_0xcbca('0x52')]);_0xfb05df[_0xcbca('0x3b')]=_['keys'](_0x496c48[_0xcbca('0x3b')]);_0xfb05df[_0xcbca('0x53')]=_[_0xcbca('0xc6')](_0xfb05df[_0xcbca('0x50')],_0xfb05df[_0xcbca('0x3b')]);_0x210622['attributes']=_[_0xcbca('0xc6')](_0xfb05df['model'],qs[_0xcbca('0x54')](_0x496c48[_0xcbca('0x3b')][_0xcbca('0x54')]));_0x210622['attributes']=_0x210622[_0xcbca('0x41')][_0xcbca('0x46')]?_0x210622[_0xcbca('0x41')]:_0xfb05df['model'];_0x210622[_0xcbca('0xc7')]=qs['sort'](_0x496c48[_0xcbca('0x3b')][_0xcbca('0xc8')]);_0x210622[_0xcbca('0x3a')]=qs[_0xcbca('0x53')](_['pick'](_0x496c48[_0xcbca('0x3b')],_0xfb05df[_0xcbca('0x53')]));if(_0x496c48[_0xcbca('0x3b')][_0xcbca('0x29')]){_0x210622['where']=_[_0xcbca('0x55')](_0x210622['where'],{'$or':_[_0xcbca('0x2b')](_0x210622[_0xcbca('0x41')],function(_0x2b3d0f){var _0x5aecfe={};_0x5aecfe[_0x2b3d0f]={'$like':'%'+_0x496c48[_0xcbca('0x3b')][_0xcbca('0x29')]+'%'};return _0x5aecfe;})});}_0x210622=_['merge']({},_0x210622,_0x496c48['options']);return _0x3b50f5[_0xcbca('0xe3')](_0x210622);}})[_0xcbca('0x21')](function(_0x16fdd8){if(_0x16fdd8){_0x4da55d=_0x16fdd8[_0xcbca('0x46')];if(!_0x496c48['query'][_0xcbca('0xca')]('nolimit')){_0x210622['limit']=qs[_0xcbca('0xd0')](_0x496c48[_0xcbca('0x3b')]['limit']);_0x210622[_0xcbca('0x1b')]=qs[_0xcbca('0x1b')](_0x496c48[_0xcbca('0x3b')][_0xcbca('0x1b')]);}return _0x3b50f5[_0xcbca('0xe3')](_0x210622);}})[_0xcbca('0x21')](function(_0x21f119){if(_0x21f119){return _0x21f119?{'count':_0x4da55d,'rows':_0x21f119}:null;}})[_0xcbca('0x21')](respondWithResult(_0x5595bb,null))[_0xcbca('0x4e')](handleError(_0x5595bb,null));};exports[_0xcbca('0xe4')]=function(_0x312dbb,_0x20aaaf){var _0x344fad={};var _0x10516a={};var _0x2de572;var _0x37b0ea;return db[_0xcbca('0x35')][_0xcbca('0x90')]({'where':{'id':_0x312dbb[_0xcbca('0x4f')]['id']}})[_0xcbca('0x21')](handleEntityNotFound(_0x20aaaf,null))['then'](function(_0x51ede8){if(_0x51ede8){_0x2de572=_0x51ede8;_0x10516a[_0xcbca('0x50')]=_[_0xcbca('0xc4')](db[_0xcbca('0xe5')][_0xcbca('0x52')]);_0x10516a[_0xcbca('0x3b')]=_[_0xcbca('0xc4')](_0x312dbb['query']);_0x10516a[_0xcbca('0x53')]=_['intersection'](_0x10516a[_0xcbca('0x50')],_0x10516a[_0xcbca('0x3b')]);_0x344fad[_0xcbca('0x41')]=_[_0xcbca('0xc6')](_0x10516a[_0xcbca('0x50')],qs[_0xcbca('0x54')](_0x312dbb[_0xcbca('0x3b')][_0xcbca('0x54')]));_0x344fad[_0xcbca('0x41')]=_0x344fad[_0xcbca('0x41')][_0xcbca('0x46')]?_0x344fad[_0xcbca('0x41')]:_0x10516a[_0xcbca('0x50')];_0x344fad[_0xcbca('0xc7')]=qs[_0xcbca('0xc8')](_0x312dbb[_0xcbca('0x3b')][_0xcbca('0xc8')]);_0x344fad[_0xcbca('0x3a')]=qs[_0xcbca('0x53')](_[_0xcbca('0xc9')](_0x312dbb[_0xcbca('0x3b')],_0x10516a[_0xcbca('0x53')]));if(_0x312dbb[_0xcbca('0x3b')][_0xcbca('0x29')]){_0x344fad[_0xcbca('0x3a')]=_[_0xcbca('0x55')](_0x344fad[_0xcbca('0x3a')],{'$or':_[_0xcbca('0x2b')](_0x344fad[_0xcbca('0x41')],function(_0x18499d){var _0x2ccc96={};_0x2ccc96[_0x18499d]={'$like':'%'+_0x312dbb[_0xcbca('0x3b')][_0xcbca('0x29')]+'%'};return _0x2ccc96;})});}_0x344fad=_[_0xcbca('0x55')]({},_0x344fad,_0x312dbb[_0xcbca('0x56')]);return _0x2de572['getWhatsappInteractions'](_0x344fad);}})[_0xcbca('0x21')](function(_0x397b8c){if(_0x397b8c){_0x37b0ea=_0x397b8c['length'];if(!_0x312dbb[_0xcbca('0x3b')][_0xcbca('0xca')](_0xcbca('0xcf'))){_0x344fad[_0xcbca('0xd0')]=qs[_0xcbca('0xd0')](_0x312dbb[_0xcbca('0x3b')]['limit']);_0x344fad[_0xcbca('0x1b')]=qs[_0xcbca('0x1b')](_0x312dbb[_0xcbca('0x3b')]['offset']);}return _0x2de572['getWhatsappInteractions'](_0x344fad);}})['then'](function(_0x40d480){if(_0x40d480){return _0x40d480?{'count':_0x37b0ea,'rows':_0x40d480}:null;}})['then'](respondWithResult(_0x20aaaf,null))[_0xcbca('0x4e')](handleError(_0x20aaaf,null));};exports['login']=function(_0x206a57,_0x46ac97,_0x1b4424){var _0x282833;var _0x5c5f80;var _0x3af727;var _0x2f7947=!_['isNil'](_0x206a57[_0xcbca('0x4f')]['id'])?_0x206a57['params']['id']:!_[_0xcbca('0x66')](_0x206a57[_0xcbca('0x79')]['id'])?_0x206a57[_0xcbca('0x79')]['id']:null;return db[_0xcbca('0x35')][_0xcbca('0x2e')]({'where':{'id':_0x2f7947,'role':{'$or':[_0xcbca('0x24'),_0xcbca('0x79'),'agent']}},'attributes':['id',_0xcbca('0x2f'),_0xcbca('0xe6'),'mobile',_0xcbca('0x23'),'internal',_0xcbca('0x97')]})[_0xcbca('0x21')](function(_0x4e41e9){if(_0x4e41e9){if(_0x4e41e9['role']===_0xcbca('0x6b')){_0x282833=_0x4e41e9;if(_0x206a57['body']['interface']){_0x3af727=util['format'](_0xcbca('0xe7'),_0x282833[_0x206a57['body'][_0xcbca('0x99')]]);}else if(_0x206a57[_0xcbca('0x57')][_0xcbca('0xe8')]){_0x3af727=util['format'](_0xcbca('0xa5'),_0x206a57['body'][_0xcbca('0xe8')]);}else{_0x3af727=util['format'](_0xcbca('0xa5'),_0x282833['name']);}socket['to'](util[_0xcbca('0xe9')](_0xcbca('0xea'),_0x282833['name']))[_0xcbca('0xaa')](_0xcbca('0xeb'),{'user':{'id':_0x282833['id'],'name':_0x282833['name']},'ip':_0x206a57['headers'][_0xcbca('0xec')]||_0x206a57[_0xcbca('0xed')][_0xcbca('0xee')]||_0x206a57[_0xcbca('0xef')][_0xcbca('0xee')]||_0x206a57['connection']['socket'][_0xcbca('0xee')]});return db[_0xcbca('0xa6')]['destroy']({'where':{'membername':_0x282833[_0xcbca('0x2f')]},'individualHooks':!![]});}}else{throw new db[(_0xcbca('0x87'))][(_0xcbca('0x88'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xcbca('0x21')](function(){if(_0x282833){return _0x282833[_0xcbca('0xf0')]({'raw':!![]});}})[_0xcbca('0x21')](function(_0x523552){if(_0x282833){var _0x313408=[];if(_0x523552){_0x5c5f80=_0x523552;if(_0x5c5f80[_0xcbca('0x46')]){for(var _0x5d1b8e=0x0;_0x5d1b8e<_0x5c5f80[_0xcbca('0x46')];_0x5d1b8e++){_0x313408[_0xcbca('0x42')]({'membername':_0x282833[_0xcbca('0x2f')],'UserId':_0x282833['id'],'queue_name':_0x5c5f80[_0x5d1b8e][_0xcbca('0x2f')],'VoiceQueueId':_0x5c5f80[_0x5d1b8e]['id'],'interface':_0x3af727,'paused':_0x282833[_0xcbca('0x97')]||![],'penalty':_0x5c5f80[_0x5d1b8e][_0xcbca('0xf1')]||0x0});}return BPromise[_0xcbca('0x85')](_0x313408,function(_0x480c60){return db['UserVoiceQueueRt'][_0xcbca('0xa7')](_0x480c60);});}}}})[_0xcbca('0x21')](function(){if(_0x282833){return db[_0xcbca('0xf2')]['findAll']({'where':{'membername':_0x282833[_0xcbca('0x2f')],'exitAt':null}});}})[_0xcbca('0x21')](function(_0xd25969){if(_0x282833){var _0x262dfe=[];_0xd25969['forEach'](function(_0xfad48a){_0x262dfe[_0xcbca('0x42')](_0xfad48a[_0xcbca('0x20')]({'exitAt':moment()[_0xcbca('0xe9')](_0xcbca('0xf3'))}));});return BPromise[_0xcbca('0x4d')](_0x262dfe);}})['then'](function(){if(_0x282833){var _0x3b43a7=[];var _0x137819=[];var _0xad1194=utils[_0xcbca('0xf4')]();var _0x3e67fe={'membername':_0x282833[_0xcbca('0x2f')],'interface':_0x3af727,'enterAt':moment()[_0xcbca('0xe9')](_0xcbca('0xf3')),'role':_0x282833['role'],'internal':_0x282833[_0xcbca('0x60')]};_0xad1194[_0xcbca('0xf5')](function(_0x290c01){_0x3b43a7[_0xcbca('0x42')](_['merge']({'channel':_0x290c01,'type':_0xcbca('0xf6'),'data1':_0x206a57[_0xcbca('0x57')][_0xcbca('0xf7')],'data2':_0x3af727},_0x3e67fe));if(_0x282833[_0xcbca('0x97')]){_0x137819[_0xcbca('0x42')](_[_0xcbca('0x55')]({'channel':_0x290c01,'type':_0xcbca('0xf8'),'data1':_0xcbca('0xf9')},_0x3e67fe));}});return db[_0xcbca('0xf2')][_0xcbca('0x82')](_0x3b43a7[_0xcbca('0xc2')](_0x137819),{'individualHooks':!![]});}})[_0xcbca('0x21')](function(){if(_0x282833){return _0x282833[_0xcbca('0x20')]({'online':!![],'lastLoginAt':moment()['format'](_0xcbca('0xf3')),'voicePause':_0x282833[_0xcbca('0x97')]||![],'mailPause':_0x282833['loginInPause']||![],'chatPause':_0x282833[_0xcbca('0x97')]||![],'faxPause':_0x282833[_0xcbca('0x97')]||![],'smsPause':_0x282833[_0xcbca('0x97')]||![],'openchannelPause':_0x282833['loginInPause']||![],'whatsappPause':_0x282833['loginInPause']||![],'pauseType':_0x282833[_0xcbca('0x97')]?_0xcbca('0xf9'):null,'interface':_0x3af727,'lastPauseAt':moment()[_0xcbca('0xe9')](_0xcbca('0xf3'))});}})['then'](function(_0x2b410f){if(_0x206a57[_0xcbca('0xfa')]){return _0x1b4424();}else{return BPromise[_0xcbca('0xfb')](_0x2b410f)[_0xcbca('0x21')](respondWithResult(_0x46ac97,null));}})[_0xcbca('0x4e')](handleError(_0x46ac97,null));};exports[_0xcbca('0xfc')]=function(_0x1c3889,_0x6f1992){var _0x4b6a4f;return db[_0xcbca('0x35')]['find']({'where':{'id':_0x1c3889['params']['id'],'role':_0xcbca('0x6b')},'attributes':['id',_0xcbca('0x2f'),'role']})[_0xcbca('0x21')](handleEntityNotFound(_0x6f1992,null))['then'](function(_0x464e79){if(_0x464e79){_0x4b6a4f=_0x464e79;return db[_0xcbca('0xa6')]['destroy']({'where':{'membername':_0x4b6a4f[_0xcbca('0x2f')]},'individualHooks':!![]});}})[_0xcbca('0x21')](function(){return db[_0xcbca('0xf2')][_0xcbca('0x43')]({'where':{'membername':_0x4b6a4f[_0xcbca('0x2f')],'exitAt':null}});})[_0xcbca('0x21')](function(_0x415da1){var _0x5ee25a=[];_0x415da1['forEach'](function(_0x1ddc99){_0x5ee25a[_0xcbca('0x42')](_0x1ddc99['update']({'exitAt':moment()['format'](_0xcbca('0xf3'))}));});return BPromise['all'](_0x5ee25a);})[_0xcbca('0x21')](function(){return _0x4b6a4f[_0xcbca('0x20')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xcbca('0x21')](respondWithResult(_0x6f1992,null))['catch'](handleError(_0x6f1992,null));};exports[_0xcbca('0xfd')]=function(_0x21957b,_0x10fdaf){var _0x442a36;return db[_0xcbca('0xa6')]['update']({'paused':0x1},{'where':{'UserId':_0x21957b['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0xcbca('0x35')][_0xcbca('0x2e')]({'where':{'id':_0x21957b[_0xcbca('0x4f')]['id'],'role':_0xcbca('0x6b')},'attributes':['id',_0xcbca('0x2f'),_0xcbca('0x23'),_0xcbca('0x60'),_0xcbca('0x99')]});})[_0xcbca('0x21')](handleEntityNotFound(_0x10fdaf,null))[_0xcbca('0x21')](function(_0x57feea){if(_0x57feea){_0x442a36=_0x57feea;return respondWithRpcPromise(_0xcbca('0xfe'),'pause',{'id':_0x442a36['id'],'name':_0x442a36['name'],'pause':!![]});}})[_0xcbca('0x21')](function(){if(_0x442a36){return db['MemberReport'][_0xcbca('0x43')]({'where':{'membername':_0x442a36[_0xcbca('0x2f')],'type':_0xcbca('0xf8'),'exitAt':null}});}})[_0xcbca('0x21')](function(_0x40cd3){if(_0x40cd3[_0xcbca('0x46')]){var _0x189dfa=moment()[_0xcbca('0xe9')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2b9f0e=0x0,_0xc9366d=_0x40cd3[_0xcbca('0x46')];_0x2b9f0e<_0xc9366d;_0x2b9f0e++){_0x40cd3[_0x2b9f0e]['updateAttributes']({'exitAt':_0x189dfa});}}})[_0xcbca('0x21')](function(){var _0x35129f=[];var _0x29d25c=utils['getChannels']();_0x29d25c[_0xcbca('0xf5')](function(_0x4c2bd5){_0x35129f[_0xcbca('0x42')]({'channel':_0x4c2bd5,'membername':_0x442a36[_0xcbca('0x2f')],'interface':_[_0xcbca('0x66')](_0x442a36[_0xcbca('0x99')])?util[_0xcbca('0xe9')]('SIP/%s',_0x442a36[_0xcbca('0x2f')]):_0x442a36[_0xcbca('0x99')],'type':'PAUSE','enterAt':moment()[_0xcbca('0xe9')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x21957b[_0xcbca('0x57')][_0xcbca('0x37')]||'DEFAULT\x20PAUSE','role':_0x442a36['role'],'internal':_0x442a36[_0xcbca('0x60')]});});return db[_0xcbca('0xf2')][_0xcbca('0x82')](_0x35129f,{'individualHooks':!![]});})[_0xcbca('0x21')](function(){return _0x442a36[_0xcbca('0x20')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x21957b['body'][_0xcbca('0x37')]||_0xcbca('0xff'),'lastPauseAt':moment()[_0xcbca('0xe9')](_0xcbca('0xf3'))});})[_0xcbca('0x21')](respondWithResult(_0x10fdaf,null))[_0xcbca('0x4e')](handleError(_0x10fdaf,null));};exports[_0xcbca('0x100')]=function(_0x556ade,_0x49a38e){var _0x483ccf;return db['User'][_0xcbca('0x2e')]({'where':{'id':_0x556ade[_0xcbca('0x4f')]['id']},'attributes':['id',_0xcbca('0x2f'),'role',_0xcbca('0x98'),_0xcbca('0x101'),'chatPause',_0xcbca('0x102'),_0xcbca('0x103'),_0xcbca('0x104'),_0xcbca('0x105'),_0xcbca('0x106'),_0xcbca('0x107')]})[_0xcbca('0x21')](handleEntityNotFound(_0x49a38e,null))['then'](function(_0x3d6cdf){if(_0x3d6cdf){_0x483ccf=_0x3d6cdf;if(_0x556ade[_0xcbca('0x57')][_0xcbca('0x95')]&&!utils[_0xcbca('0xd2')](_0x556ade[_0xcbca('0x57')][_0xcbca('0x95')])){throw new db[(_0xcbca('0x87'))][(_0xcbca('0x88'))](_0xcbca('0x9a'));}switch(_0x556ade[_0xcbca('0x57')][_0xcbca('0x95')]){case _0xcbca('0xa3'):return respondWithRpcPromise(_0xcbca('0xfe'),_0xcbca('0x100'),{'id':_0x483ccf['id'],'name':_0x483ccf[_0xcbca('0x2f')],'pause':![]})['then'](function(){return db[_0xcbca('0xa6')][_0xcbca('0x20')]({'paused':0x0},{'where':{'UserId':_0x483ccf['id']},'individualHooks':!![]});})[_0xcbca('0x21')](function(){return db[_0xcbca('0xf2')][_0xcbca('0x2e')]({'where':{'channel':_0x556ade[_0xcbca('0x57')][_0xcbca('0x95')],'membername':_0x483ccf['name'],'type':_0xcbca('0xf8'),'exitAt':null}});})['then'](function(_0x110e85){if(_0x110e85){return _0x110e85[_0xcbca('0x20')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xcbca('0x108')},{'individualHooks':!![]});}return null;})[_0xcbca('0x21')](function(){return _0x483ccf['update']({'voicePause':![]});});case _0xcbca('0x4b'):case'chat':case'fax':case _0xcbca('0x49'):case _0xcbca('0x4c'):case _0xcbca('0xb7'):return db['MemberReport'][_0xcbca('0x2e')]({'where':{'channel':_0x556ade[_0xcbca('0x57')][_0xcbca('0x95')],'membername':_0x483ccf[_0xcbca('0x2f')],'type':'PAUSE','exitAt':null}})[_0xcbca('0x21')](function(_0x5d6ec2){if(_0x5d6ec2){return _0x5d6ec2[_0xcbca('0x20')]({'exitAt':moment()['format'](_0xcbca('0xf3')),'data2':_0xcbca('0x108')},{'individualHooks':!![]});}return null;})[_0xcbca('0x21')](function(){var _0x54c03a={};_[_0xcbca('0x1e')](_0x54c03a,util[_0xcbca('0xe9')](_0xcbca('0x109'),_0x556ade[_0xcbca('0x57')][_0xcbca('0x95')],_0xcbca('0x10a')),![]);return _0x483ccf[_0xcbca('0x20')](_0x54c03a);});default:return respondWithRpcPromise('QueuePause',_0xcbca('0x100'),{'id':_0x483ccf['id'],'name':_0x483ccf[_0xcbca('0x2f')],'pause':![]})['then'](function(){return db[_0xcbca('0xa6')][_0xcbca('0x20')]({'paused':0x0},{'where':{'UserId':_0x483ccf['id']}});})['then'](function(){return db[_0xcbca('0xf2')][_0xcbca('0x43')]({'where':{'membername':_0x483ccf[_0xcbca('0x2f')],'type':_0xcbca('0xf8'),'exitAt':null}});})[_0xcbca('0x21')](function(_0x428e11){var _0x2ab8f1=[];_0x428e11[_0xcbca('0xf5')](function(_0x4ae156){_0x2ab8f1[_0xcbca('0x42')](_0x4ae156[_0xcbca('0x20')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xcbca('0x108')}));});return BPromise['all'](_0x2ab8f1);})[_0xcbca('0x21')](function(){return _0x483ccf['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xcbca('0x21')](respondWithResult(_0x49a38e,null))[_0xcbca('0x4e')](handleError(_0x49a38e,null));};exports[_0xcbca('0x10b')]=function(_0x2da200,_0xe974b8){var _0x4544f6={};var _0x587951={};var _0x3129ba;var _0x5bf639;return db[_0xcbca('0x35')][_0xcbca('0x90')]({'where':{'id':_0x2da200[_0xcbca('0x4f')]['id']}})['then'](handleEntityNotFound(_0xe974b8,null))[_0xcbca('0x21')](function(_0x25fb61){if(_0x25fb61){_0x3129ba=_0x25fb61;_0x587951[_0xcbca('0x50')]=_['keys'](db['Team'][_0xcbca('0x52')]);_0x587951[_0xcbca('0x3b')]=_[_0xcbca('0xc4')](_0x2da200['query']);_0x587951['filters']=_['intersection'](_0x587951[_0xcbca('0x50')],_0x587951[_0xcbca('0x3b')]);_0x4544f6[_0xcbca('0x41')]=_[_0xcbca('0xc6')](_0x587951['model'],qs[_0xcbca('0x54')](_0x2da200[_0xcbca('0x3b')][_0xcbca('0x54')]));_0x4544f6[_0xcbca('0x41')]=_0x4544f6[_0xcbca('0x41')][_0xcbca('0x46')]?_0x4544f6[_0xcbca('0x41')]:_0x587951[_0xcbca('0x50')];_0x4544f6[_0xcbca('0xc7')]=qs[_0xcbca('0xc8')](_0x2da200[_0xcbca('0x3b')][_0xcbca('0xc8')]);_0x4544f6[_0xcbca('0x3a')]=qs[_0xcbca('0x53')](_[_0xcbca('0xc9')](_0x2da200[_0xcbca('0x3b')],_0x587951[_0xcbca('0x53')]));if(_0x2da200[_0xcbca('0x3b')][_0xcbca('0x29')]){_0x4544f6[_0xcbca('0x3a')]=_[_0xcbca('0x55')](_0x4544f6[_0xcbca('0x3a')],{'$or':_[_0xcbca('0x2b')](_0x4544f6['attributes'],function(_0x5b2382){var _0x508b4d={};_0x508b4d[_0x5b2382]={'$like':'%'+_0x2da200[_0xcbca('0x3b')]['filter']+'%'};return _0x508b4d;})});}_0x4544f6=_[_0xcbca('0x55')]({},_0x4544f6,_0x2da200[_0xcbca('0x56')]);return _0x3129ba[_0xcbca('0x10b')](_0x4544f6);}})[_0xcbca('0x21')](function(_0x2f282b){if(_0x2f282b){_0x5bf639=_0x2f282b['length'];if(!_0x2da200[_0xcbca('0x3b')][_0xcbca('0xca')](_0xcbca('0xcf'))){_0x4544f6[_0xcbca('0xd0')]=qs[_0xcbca('0xd0')](_0x2da200[_0xcbca('0x3b')][_0xcbca('0xd0')]);_0x4544f6[_0xcbca('0x1b')]=qs[_0xcbca('0x1b')](_0x2da200['query']['offset']);}return _0x3129ba[_0xcbca('0x10b')](_0x4544f6);}})['then'](function(_0x11840d){if(_0x11840d){return _0x11840d?{'count':_0x5bf639,'rows':_0x11840d}:null;}})[_0xcbca('0x21')](respondWithResult(_0xe974b8,null))[_0xcbca('0x4e')](handleError(_0xe974b8,null));};exports[_0xcbca('0x10c')]=function(_0x2e7149,_0x9271c6){return db[_0xcbca('0x35')]['find']({'where':{'id':_0x2e7149[_0xcbca('0x4f')]['id']}})['then'](handleEntityNotFound(_0x9271c6,null))[_0xcbca('0x21')](function(_0x229f25){if(_0x229f25){var _0x14d716=_0x229f25['get']({'plain':!![]});return _0x229f25[_0xcbca('0x10c')](_0x2e7149[_0xcbca('0x57')][_0xcbca('0x5a')],_['omit'](_0x2e7149['body'],['ids','id'])||{})['then'](function(){for(var _0x4cdf61=0x0;_0x4cdf61<_0x2e7149[_0xcbca('0x57')][_0xcbca('0x5a')][_0xcbca('0x46')];_0x4cdf61++){var _0x56fef4=[];var _0x5a39ac={};db[_0xcbca('0x10d')][_0xcbca('0x90')]({'where':{'id':_0x2e7149[_0xcbca('0x57')]['ids'][_0x4cdf61]}})[_0xcbca('0x21')](function(_0x4e54d7){_0x5a39ac=_0x4e54d7[_0xcbca('0x48')];_0x56fef4[_0xcbca('0x42')](_0x4e54d7['getVoiceQueues']()['then'](function(_0x2299e7){for(var _0x5756e7=0x0;_0x5756e7<_0x2299e7[_0xcbca('0x46')];_0x5756e7++){_0x2299e7[_0x5756e7][_0xcbca('0x10e')](_0xcbca('0x95'),_0xcbca('0x10f'));}return _0x2299e7;}));_0x56fef4['push'](_0x4e54d7[_0xcbca('0x110')]()[_0xcbca('0x21')](function(_0x1b345e){for(var _0x235a5d=0x0;_0x235a5d<_0x1b345e['length'];_0x235a5d++){_0x1b345e[_0x235a5d][_0xcbca('0x10e')](_0xcbca('0x95'),_0xcbca('0x111'));}return _0x1b345e;}));_0x56fef4['push'](_0x4e54d7[_0xcbca('0x112')]()[_0xcbca('0x21')](function(_0x49ca3e){for(var _0x421ab7=0x0;_0x421ab7<_0x49ca3e[_0xcbca('0x46')];_0x421ab7++){_0x49ca3e[_0x421ab7]['setDataValue'](_0xcbca('0x95'),_0xcbca('0x113'));}return _0x49ca3e;}));_0x56fef4[_0xcbca('0x42')](_0x4e54d7[_0xcbca('0x114')]()['then'](function(_0x3bb594){for(var _0x5bed46=0x0;_0x5bed46<_0x3bb594[_0xcbca('0x46')];_0x5bed46++){_0x3bb594[_0x5bed46]['setDataValue']('channel','Sms');}return _0x3bb594;}));_0x56fef4[_0xcbca('0x42')](_0x4e54d7['getWhatsappQueues']()[_0xcbca('0x21')](function(_0x18670a){for(var _0x67a2bc=0x0;_0x67a2bc<_0x18670a[_0xcbca('0x46')];_0x67a2bc++){_0x18670a[_0x67a2bc]['setDataValue'](_0xcbca('0x95'),_0xcbca('0x115'));}return _0x18670a;}));_0x56fef4[_0xcbca('0x42')](_0x4e54d7['getFaxQueues']()[_0xcbca('0x21')](function(_0x34bb19){for(var _0x3fe29e=0x0;_0x3fe29e<_0x34bb19[_0xcbca('0x46')];_0x3fe29e++){_0x34bb19[_0x3fe29e]['setDataValue'](_0xcbca('0x95'),'Fax');}return _0x34bb19;}));_0x56fef4[_0xcbca('0x42')](_0x4e54d7['getOpenchannelQueues']()[_0xcbca('0x21')](function(_0x5b7479){for(var _0x42d3ce=0x0;_0x42d3ce<_0x5b7479[_0xcbca('0x46')];_0x42d3ce++){_0x5b7479[_0x42d3ce]['setDataValue'](_0xcbca('0x95'),_0xcbca('0x116'));}return _0x5b7479;}));return BPromise['all'](_0x56fef4);})[_0xcbca('0x21')](function(_0x18177c){var _0x5e0fb6=_[_0xcbca('0x117')](_0x18177c);_0x56fef4=[];return db['sequelize'][_0xcbca('0x118')](function(_0x17fd46){for(var _0x1c72b9=0x0;_0x1c72b9<_0x5e0fb6[_0xcbca('0x46')];_0x1c72b9++){_0x56fef4[_0xcbca('0x42')](_0x5e0fb6[_0x1c72b9][_0xcbca('0x119')](_0x14d716['id']),{'transaction':_0x17fd46});}return BPromise['all'](_0x56fef4)['then'](function(){if(_0x14d716[_0xcbca('0x96')]){return BPromise[_0xcbca('0x85')](_[_0xcbca('0x29')](_0x5e0fb6,function(_0xcd864c){return _0xcd864c[_0xcbca('0x11a')]('channel')===_0xcbca('0x10f');}),function(_0x29f889){return db[_0xcbca('0xa6')]['upsert']({'membername':_0x14d716['name'],'UserId':_0x14d716['id'],'queue_name':_0x29f889['name'],'VoiceQueueId':_0x29f889['id'],'interface':_[_0xcbca('0x66')](_0x14d716[_0xcbca('0x99')])?util['format'](_0xcbca('0xa5'),_0x14d716[_0xcbca('0x2f')]):_0x14d716['interface'],'paused':_0x14d716[_0xcbca('0x98')]||![],'penalty':_0x14d716['penalty']},{'transaction':_0x17fd46});});}else{return;}})[_0xcbca('0x21')](function(){for(var _0x4a8153=0x0;_0x4a8153<_0x5e0fb6[_0xcbca('0x46')];_0x4a8153++){var _0x38e1d0=_0x5e0fb6[_0x4a8153]['getDataValue']('channel');var _0x287f73=_0x38e1d0+'QueueId';socket['emit'](_0xcbca('0x79')+_0x38e1d0+_0xcbca('0xa2'),{'UserId':_0x14d716['id'],['queueField']:_0x5e0fb6[_0x4a8153]['id']});}});});})['then'](function(){db[_0xcbca('0x11b')][_0xcbca('0x90')]({'where':{'teamId':_0x5a39ac['id']}})[_0xcbca('0x21')](function(_0x4bba74){if(_0x4bba74){db[_0xcbca('0x11c')][_0xcbca('0x77')]({'UserId':_0x2e7149[_0xcbca('0x4f')]['id'],'VoicePrefixId':_0x4bba74[_0xcbca('0x11d')]});}});});}});}})[_0xcbca('0x21')](respondWithStatusCode(_0x9271c6,null))[_0xcbca('0x4e')](handleError(_0x9271c6,null));};exports['removeTeams']=function(_0x41932e,_0x53f17d){return db[_0xcbca('0x35')]['findOne']({'where':{'id':_0x41932e[_0xcbca('0x4f')]['id']}})[_0xcbca('0x21')](handleEntityNotFound(_0x53f17d,null))[_0xcbca('0x21')](function(_0x453c8f){if(_0x453c8f){var _0x19f2ff=_0x453c8f[_0xcbca('0x22')]({'plain':!![]});var _0x3181ea=_0x41932e[_0xcbca('0x3b')]['ids'];return _0x453c8f['removeTeams'](_0x3181ea)[_0xcbca('0x21')](function(){for(var _0x4d64f4=0x0;_0x4d64f4<_0x3181ea[_0xcbca('0x46')];_0x4d64f4++){var _0x35e438=[];var _0x3dab35={};db['Team'][_0xcbca('0x90')]({'where':{'id':_0x3181ea[_0x4d64f4]}})['then'](function(_0x399b49){_0x3dab35=_0x399b49[_0xcbca('0x48')];_0x35e438['push'](_0x399b49[_0xcbca('0xf0')]()[_0xcbca('0x21')](function(_0x50e515){for(var _0x122643=0x0;_0x122643<_0x50e515[_0xcbca('0x46')];_0x122643++){_0x50e515[_0x122643][_0xcbca('0x10e')](_0xcbca('0x95'),'Voice');}return _0x50e515;}));_0x35e438['push'](_0x399b49['getChatQueues']()[_0xcbca('0x21')](function(_0x5f4ffb){for(var _0x13dbcd=0x0;_0x13dbcd<_0x5f4ffb['length'];_0x13dbcd++){_0x5f4ffb[_0x13dbcd]['setDataValue']('channel',_0xcbca('0x111'));}return _0x5f4ffb;}));_0x35e438['push'](_0x399b49[_0xcbca('0x112')]()[_0xcbca('0x21')](function(_0x21ed5c){for(var _0x490427=0x0;_0x490427<_0x21ed5c[_0xcbca('0x46')];_0x490427++){_0x21ed5c[_0x490427][_0xcbca('0x10e')](_0xcbca('0x95'),'Mail');}return _0x21ed5c;}));_0x35e438[_0xcbca('0x42')](_0x399b49[_0xcbca('0x114')]()[_0xcbca('0x21')](function(_0x4dc272){for(var _0x1ecfcf=0x0;_0x1ecfcf<_0x4dc272[_0xcbca('0x46')];_0x1ecfcf++){_0x4dc272[_0x1ecfcf]['setDataValue']('channel',_0xcbca('0x11e'));}return _0x4dc272;}));_0x35e438['push'](_0x399b49['getWhatsappQueues']()['then'](function(_0x22a350){for(var _0x42652a=0x0;_0x42652a<_0x22a350['length'];_0x42652a++){_0x22a350[_0x42652a]['setDataValue'](_0xcbca('0x95'),_0xcbca('0x115'));}return _0x22a350;}));_0x35e438[_0xcbca('0x42')](_0x399b49[_0xcbca('0x11f')]()[_0xcbca('0x21')](function(_0x4a7446){for(var _0x3bd937=0x0;_0x3bd937<_0x4a7446[_0xcbca('0x46')];_0x3bd937++){_0x4a7446[_0x3bd937]['setDataValue'](_0xcbca('0x95'),_0xcbca('0x120'));}return _0x4a7446;}));_0x35e438[_0xcbca('0x42')](_0x399b49[_0xcbca('0x121')]()['then'](function(_0x4c6855){for(var _0x3d944d=0x0;_0x3d944d<_0x4c6855['length'];_0x3d944d++){_0x4c6855[_0x3d944d]['setDataValue'](_0xcbca('0x95'),'Openchannel');}return _0x4c6855;}));return BPromise['all'](_0x35e438);})['then'](function(_0x27cc0d){var _0x5647f3=_['flatten'](_0x27cc0d);_0x35e438=[];return db[_0xcbca('0x62')][_0xcbca('0x118')](function(_0x32f268){for(var _0x22a46e=0x0;_0x22a46e<_0x5647f3[_0xcbca('0x46')];_0x22a46e++){_0x35e438[_0xcbca('0x42')](_0x5647f3[_0x22a46e]['removeAgent'](_0x19f2ff['id']),{'transaction':_0x32f268});}return BPromise[_0xcbca('0x4d')](_0x35e438)[_0xcbca('0x21')](function(){if(_0x19f2ff[_0xcbca('0x96')]){return BPromise[_0xcbca('0x85')](_[_0xcbca('0x29')](_0x5647f3,function(_0x5cf63c){return _0x5cf63c[_0xcbca('0x11a')](_0xcbca('0x95'))===_0xcbca('0x10f');}),function(_0x31bb5c){return db[_0xcbca('0xa6')][_0xcbca('0x31')]({'where':{'VoiceQueueId':_0x31bb5c['id'],'UserId':_0x19f2ff['id']},'transaction':_0x32f268});});}else{return;}})[_0xcbca('0x21')](function(){db['TeamVoicePrefix'][_0xcbca('0x90')]({'where':{'teamId':_0x3dab35['id']}})[_0xcbca('0x21')](function(_0x5337b5){if(_0x5337b5){return db[_0xcbca('0x11c')][_0xcbca('0x31')]({'where':{'UserId':_0x19f2ff['id'],'VoicePrefixId':_0x5337b5[_0xcbca('0x48')][_0xcbca('0x11d')]}});}});})[_0xcbca('0x21')](function(){for(var _0x4b78ba=0x0;_0x4b78ba<_0x5647f3[_0xcbca('0x46')];_0x4b78ba++){var _0x215a02=_0x5647f3[_0x4b78ba][_0xcbca('0x11a')](_0xcbca('0x95'));var _0x440db4=_0x215a02+_0xcbca('0xa1');socket[_0xcbca('0xaa')](_0xcbca('0x79')+_0x215a02+_0xcbca('0xab'),{'UserId':_0x19f2ff['id'],['queueField']:_0x5647f3[_0x4b78ba]['id']});}});});});}});}})[_0xcbca('0x21')](respondWithStatusCode(_0x53f17d,null))['catch'](handleError(_0x53f17d,null));};exports[_0xcbca('0x122')]=function(_0x4bb89e,_0x406871){var _0x29b232={};var _0x4f5fc6={};var _0x255e6f;var _0xd7f69f;return db[_0xcbca('0x35')][_0xcbca('0x90')]({'where':{'id':_0x4bb89e['params']['id']}})[_0xcbca('0x21')](handleEntityNotFound(_0x406871,null))['then'](function(_0x14b948){if(_0x14b948){_0x255e6f=_0x14b948;_0x4f5fc6['model']=_[_0xcbca('0xc4')](db[_0xcbca('0xcb')][_0xcbca('0x52')]);_0x4f5fc6[_0xcbca('0x3b')]=_[_0xcbca('0xc4')](_0x4bb89e[_0xcbca('0x3b')]);_0x4f5fc6[_0xcbca('0x53')]=_[_0xcbca('0xc6')](_0x4f5fc6[_0xcbca('0x50')],_0x4f5fc6['query']);_0x29b232[_0xcbca('0x41')]=_['intersection'](_0x4f5fc6[_0xcbca('0x50')],qs[_0xcbca('0x54')](_0x4bb89e[_0xcbca('0x3b')][_0xcbca('0x54')]));_0x29b232[_0xcbca('0x41')]=_0x29b232[_0xcbca('0x41')][_0xcbca('0x46')]?_0x29b232[_0xcbca('0x41')]:_0x4f5fc6[_0xcbca('0x50')];_0x29b232[_0xcbca('0xc7')]=qs[_0xcbca('0xc8')](_0x4bb89e[_0xcbca('0x3b')][_0xcbca('0xc8')]);_0x29b232[_0xcbca('0x3a')]=qs['filters'](_[_0xcbca('0xc9')](_0x4bb89e[_0xcbca('0x3b')],_0x4f5fc6[_0xcbca('0x53')]));if(_0x4bb89e[_0xcbca('0x3b')][_0xcbca('0x29')]){_0x29b232[_0xcbca('0x3a')]=_[_0xcbca('0x55')](_0x29b232[_0xcbca('0x3a')],{'$or':_[_0xcbca('0x2b')](_0x29b232['attributes'],function(_0x45798c){var _0x525f40={};_0x525f40[_0x45798c]={'$like':'%'+_0x4bb89e['query'][_0xcbca('0x29')]+'%'};return _0x525f40;})});}_0x29b232=_[_0xcbca('0x55')]({},_0x29b232,_0x4bb89e[_0xcbca('0x56')]);return _0x255e6f['getLists'](_0x29b232);}})[_0xcbca('0x21')](function(_0x39cb54){if(_0x39cb54){_0xd7f69f=_0x39cb54['length'];if(!_0x4bb89e['query']['hasOwnProperty']('nolimit')){_0x29b232[_0xcbca('0xd0')]=qs[_0xcbca('0xd0')](_0x4bb89e[_0xcbca('0x3b')][_0xcbca('0xd0')]);_0x29b232[_0xcbca('0x1b')]=qs['offset'](_0x4bb89e[_0xcbca('0x3b')]['offset']);}return _0x255e6f[_0xcbca('0x122')](_0x29b232);}})[_0xcbca('0x21')](function(_0x567f97){if(_0x567f97){return _0x567f97?{'count':_0xd7f69f,'rows':_0x567f97}:null;}})['then'](respondWithResult(_0x406871,null))[_0xcbca('0x4e')](handleError(_0x406871,null));};exports[_0xcbca('0x123')]=function(_0xb84641,_0x173d31){var _0x3c281c={};var _0x94945f={};var _0x5808ca;return db[_0xcbca('0x35')][_0xcbca('0x90')]({'where':{'id':_0xb84641['params']['id']}})[_0xcbca('0x21')](handleEntityNotFound(_0x173d31,null))[_0xcbca('0x21')](function(_0x5670c4){if(_0x5670c4){_0x5808ca=_0x5670c4;_0x94945f['model']=_[_0xcbca('0xc4')](db[_0xcbca('0x35')]['rawAttributes']);_0x94945f[_0xcbca('0x3b')]=_[_0xcbca('0xc4')](_0xb84641[_0xcbca('0x3b')]);_0x94945f[_0xcbca('0x53')]=_['intersection'](_0x94945f[_0xcbca('0x50')],_0x94945f[_0xcbca('0x3b')]);_0x3c281c[_0xcbca('0x41')]=_[_0xcbca('0xc6')](_0x94945f[_0xcbca('0x50')],qs[_0xcbca('0x54')](_0xb84641[_0xcbca('0x3b')][_0xcbca('0x54')]));_0x3c281c[_0xcbca('0x41')]=_0x3c281c[_0xcbca('0x41')][_0xcbca('0x46')]?_0x3c281c[_0xcbca('0x41')]:_0x94945f[_0xcbca('0x50')];_0x3c281c[_0xcbca('0xc7')]=qs[_0xcbca('0xc8')](_0xb84641[_0xcbca('0x3b')][_0xcbca('0xc8')]);_0x3c281c[_0xcbca('0x3a')]=qs[_0xcbca('0x53')](_[_0xcbca('0xc9')](_0xb84641[_0xcbca('0x3b')],_0x94945f[_0xcbca('0x53')]));if(_0xb84641['query'][_0xcbca('0x29')]){_0x3c281c['where']=_[_0xcbca('0x55')](_0x3c281c[_0xcbca('0x3a')],{'$or':_[_0xcbca('0x2b')](_0x3c281c[_0xcbca('0x41')],function(_0xd1a16c){var _0x50fef3={};_0x50fef3[_0xd1a16c]={'$like':'%'+_0xb84641[_0xcbca('0x3b')][_0xcbca('0x29')]+'%'};return _0x50fef3;})});}_0x3c281c['model']=db[_0xcbca('0x35')];_0x3c281c['as']=_0xcbca('0x26');_0x3c281c=_[_0xcbca('0x55')]({},_0x3c281c,_0xb84641[_0xcbca('0x56')]);return _0x5808ca['getVoiceQueues']({'include':[_0x3c281c]});}})[_0xcbca('0x21')](function(_0x49d267){if(_0x49d267){var _0x3aa7f3={},_0xf29704=[];for(var _0x2234d3=0x0;_0x2234d3<_0x49d267[_0xcbca('0x46')];_0x2234d3+=0x1){for(var _0x15565c=0x0,_0x24ecc0;_0x15565c<_0x49d267[_0x2234d3][_0xcbca('0x26')][_0xcbca('0x46')];_0x15565c+=0x1){_0x24ecc0=_0x49d267[_0x2234d3][_0xcbca('0x26')][_0x15565c][_0xcbca('0x22')]({'plain':!![]});_0x3aa7f3[_0x24ecc0['id']]=_0x24ecc0;}}_0x3aa7f3=_['values'](_0x3aa7f3);for(var _0x59db12=qs['offset'](_0xb84641['query']['offset']);_0x59db12<_0x3aa7f3[_0xcbca('0x46')]&&_0xf29704[_0xcbca('0x46')]=_0x46e719){_0x43a92c=_0x46e719;_0x12f688=0xc8;}else{_0x12f688=0xce;}_0x83eb26[_0x2f29('0x1f')](_0x12f688);return _0x83eb26[_0x2f29('0x25')](_0x2f29('0x26'),_0xea7a13+'-'+_0x43a92c+'/'+_0x46e719)[_0x2f29('0x21')](_0x2b668e);}return null;};}function saveUpdates(_0x510d3b){return function(_0x2693c4){if(_0x2693c4){return _0x2693c4[_0x2f29('0x27')](_0x510d3b)[_0x2f29('0x28')](function(_0xa7016e){return _0xa7016e;});}return null;};}function removeEntity(_0x33e64d){return function(_0x2501af){if(_0x2501af){return _0x2501af[_0x2f29('0x29')]()[_0x2f29('0x28')](function(){var _0x417046=_0x2501af[_0x2f29('0x2a')]({'plain':!![]});if(_0x417046['role']===_0x2f29('0x2b'))return;var _0x52cde9=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x2f29('0x2c'),'value':_0x2f29('0x2d'),'ignore':![]},{'name':_0x2f29('0x2e'),'value':'telephone','ignore':![]}];var _0x391c45=_(_0x52cde9)[_0x2f29('0x2f')]('ignore')[_0x2f29('0x30')](_0x2f29('0x31'))['value']();if(_[_0x2f29('0x32')](_0x391c45,_0x417046[_0x2f29('0x33')])){return;}var _0x444e8c=_[_0x2f29('0x34')](_0x52cde9,[_0x2f29('0x31'),_0x417046[_0x2f29('0x33')]])[_0x2f29('0x35')];return db[_0x2f29('0x36')][_0x2f29('0x29')]({'where':{'type':_0x444e8c,'resourceId':_0x417046['id']}})[_0x2f29('0x28')](function(){return _0x2501af;});})[_0x2f29('0x28')](function(){_0x33e64d[_0x2f29('0x1f')](0xcc)[_0x2f29('0x20')]();});}};}function handleEntityNotFound(_0x5bcabb){return function(_0x35e187){if(!_0x35e187){_0x5bcabb[_0x2f29('0x1e')](0x194);}return _0x35e187;};}function handleError(_0x1d4e5c,_0x4d4c6d){_0x4d4c6d=_0x4d4c6d||0x1f4;return function(_0x17ffdd){logger['error'](_0x17ffdd[_0x2f29('0x37')]);if(_0x17ffdd[_0x2f29('0x35')]){delete _0x17ffdd[_0x2f29('0x35')];}_0x1d4e5c['status'](_0x4d4c6d)[_0x2f29('0x38')](_0x17ffdd);};}exports[_0x2f29('0x39')]=function(_0x30e161,_0x1728a0){var _0x14c3e9={},_0xc91009={'count':0x0,'rows':[]};var _0x47e1ba=_(db[_0x2f29('0x3a')]['rawAttributes'])[_0x2f29('0x30')](function(_0x4012b9){return{'name':_0x4012b9[_0x2f29('0x3b')],'type':_0x4012b9['type'][_0x2f29('0x3c')]};})[_0x2f29('0x2f')](function(_0x5ae519){return!_[_0x2f29('0x32')]([_0x2f29('0x3d'),'salt'],_0x5ae519[_0x2f29('0x35')]);})['value']();_0x14c3e9=qs['getOptions'](_0x47e1ba,_0x30e161);var _0x2717dc={'where':_0x14c3e9[_0x2f29('0x3e')]};return db[_0x2f29('0x3a')][_0x2f29('0x3f')](_0x2717dc)[_0x2f29('0x28')](function(_0x4943d1){_0xc91009['count']=_0x4943d1;if(_0x30e161[_0x2f29('0x40')]['includeAll']){_0x14c3e9['include']=[{'all':!![]}];}if(_0x30e161[_0x2f29('0x40')][_0x2f29('0x41')]===_0x2f29('0x42')){_0x14c3e9[_0x2f29('0x43')]=[{'model':db[_0x2f29('0x44')],'as':_0x2f29('0x41')}];}if(!_[_0x2f29('0x32')](_0x14c3e9['attributes'],'id')){_0x14c3e9['attributes'][_0x2f29('0x45')]('id');}return db['User'][_0x2f29('0x46')](_0x14c3e9);})[_0x2f29('0x28')](function(_0x42c693){_0xc91009[_0x2f29('0x47')]=_0x42c693;if(_0x30e161[_0x2f29('0x40')]['openTabs']===_0x2f29('0x42')){var _0x3781fa=[];for(var _0x2a18bb=0x0;_0x2a18bb<_0xc91009[_0x2f29('0x47')][_0x2f29('0x48')];_0x2a18bb++){_0x3781fa['push'](get_open_tabs('chat',_0xc91009[_0x2f29('0x47')][_0x2a18bb][_0x2f29('0x49')]));_0x3781fa[_0x2f29('0x45')](get_open_tabs('sms',_0xc91009[_0x2f29('0x47')][_0x2a18bb][_0x2f29('0x49')]));_0x3781fa['push'](get_open_tabs(_0x2f29('0x4a'),_0xc91009['rows'][_0x2a18bb][_0x2f29('0x49')]));_0x3781fa[_0x2f29('0x45')](get_open_tabs('mail',_0xc91009[_0x2f29('0x47')][_0x2a18bb][_0x2f29('0x49')]));_0x3781fa['push'](get_open_tabs(_0x2f29('0x4b'),_0xc91009['rows'][_0x2a18bb][_0x2f29('0x49')]));_0x3781fa[_0x2f29('0x45')](get_open_tabs(_0x2f29('0x4c'),_0xc91009[_0x2f29('0x47')][_0x2a18bb][_0x2f29('0x49')]));}return BPromise[_0x2f29('0x4d')](_0x3781fa)[_0x2f29('0x28')](function(){return _0xc91009;});}else{return _0xc91009;}})[_0x2f29('0x28')](respondWithFilteredResult(_0x1728a0,_0x14c3e9))[_0x2f29('0x1d')](handleError(_0x1728a0,null));};exports[_0x2f29('0x4e')]=function(_0x493321,_0x2fb7b3){var _0x4a2958={'raw':![],'where':{'id':_0x493321['params']['id']}},_0x4a86a5={};_0x4a86a5[_0x2f29('0x4f')]=_['differenceBy'](_[_0x2f29('0x50')](db['User'][_0x2f29('0x51')]),['password','salt']);_0x4a86a5[_0x2f29('0x40')]=_[_0x2f29('0x50')](_0x493321[_0x2f29('0x40')]);_0x4a86a5[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0x4a86a5['model'],_0x4a86a5[_0x2f29('0x40')]);_0x4a2958[_0x2f29('0x54')]=_['intersection'](_0x4a86a5[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x493321[_0x2f29('0x40')][_0x2f29('0x55')]));_0x4a2958[_0x2f29('0x54')]=_0x4a2958[_0x2f29('0x54')]['length']?_0x4a2958['attributes']:_0x4a86a5[_0x2f29('0x4f')];if(_0x493321[_0x2f29('0x40')][_0x2f29('0x56')]){_0x4a2958['include']=[{'all':!![]}];}if(_0x493321['query']['userSetting']===_0x2f29('0x42')){_0x4a2958[_0x2f29('0x43')]=[{'model':db[_0x2f29('0x44')],'as':_0x2f29('0x41')}];}_0x4a2958=_[_0x2f29('0x57')]({},_0x4a2958,_0x493321[_0x2f29('0x58')]);if(!_[_0x2f29('0x32')](_0x4a2958[_0x2f29('0x54')],'id')){_0x4a2958[_0x2f29('0x54')][_0x2f29('0x45')]('id');}return db[_0x2f29('0x3a')][_0x2f29('0x34')](_0x4a2958)[_0x2f29('0x28')](handleEntityNotFound(_0x2fb7b3,null))[_0x2f29('0x28')](function(_0x5ba266){var _0x8d5595=[];values=_0x5ba266;if(_0x493321[_0x2f29('0x40')][_0x2f29('0x59')]==='true'){_0x8d5595['push'](get_open_tabs(_0x2f29('0x5a'),_0x5ba266[_0x2f29('0x49')]));_0x8d5595['push'](get_open_tabs(_0x2f29('0x5b'),_0x5ba266[_0x2f29('0x49')]));_0x8d5595[_0x2f29('0x45')](get_open_tabs(_0x2f29('0x4b'),_0x5ba266[_0x2f29('0x49')]));_0x8d5595[_0x2f29('0x45')](get_open_tabs(_0x2f29('0x4c'),_0x5ba266[_0x2f29('0x49')]));_0x8d5595['push'](get_open_tabs(_0x2f29('0x4a'),_0x5ba266[_0x2f29('0x49')]));_0x8d5595[_0x2f29('0x45')](get_open_tabs(_0x2f29('0x5c'),_0x5ba266['dataValues']));return BPromise['all'](_0x8d5595);}else{return values;}})[_0x2f29('0x28')](function(){return values;})['then'](respondWithResult(_0x2fb7b3,null))[_0x2f29('0x1d')](handleError(_0x2fb7b3,null));};exports['update']=function(_0x12e5f6,_0x57fd77){if(_0x12e5f6[_0x2f29('0x5d')]['id']){delete _0x12e5f6['body']['id'];}delete _0x12e5f6['body'][_0x2f29('0x33')];return db['User'][_0x2f29('0x34')]({'where':{'id':_0x12e5f6[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x57fd77,null))[_0x2f29('0x28')](saveUpdates(_0x12e5f6[_0x2f29('0x5d')],null))['then'](respondWithResult(_0x57fd77,null))['catch'](handleError(_0x57fd77,null));};exports['describe']=function(_0x3e19c2,_0x555748){return db[_0x2f29('0x3a')][_0x2f29('0x5f')]()[_0x2f29('0x28')](respondWithResult(_0x555748,null))[_0x2f29('0x1d')](handleError(_0x555748,null));};exports[_0x2f29('0x60')]=function(_0x22b271,_0x52b9d8){return db[_0x2f29('0x3a')][_0x2f29('0x34')]({'where':{'id':_0x22b271['params']['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x52b9d8,null))['then'](function(_0x2837f1){if(_0x2837f1){return _0x2837f1[_0x2f29('0x60')](_0x22b271[_0x2f29('0x5d')][_0x2f29('0x61')],_[_0x2f29('0x62')](_0x22b271[_0x2f29('0x5d')],[_0x2f29('0x61'),'id'])||{});}})[_0x2f29('0x28')](respondWithResult(_0x52b9d8,null))[_0x2f29('0x1d')](handleError(_0x52b9d8,null));};function validateUser(_0x4b5981){return new BPromise(function(_0x39b9e6,_0x191a23){if(_0x4b5981['internal'])return _0x39b9e6(_0x4b5981);return db[_0x2f29('0x63')][_0x2f29('0x64')](0x1)['then'](function(_0x5221b7){if(_0x5221b7[_0x2f29('0x65')])authService[_0x2f29('0x66')](_0x4b5981[_0x2f29('0x3d')]);db['User'][_0x2f29('0x67')]('internal')[_0x2f29('0x28')](function(_0x1a43cc){if(_['isNil'](_0x1a43cc)){_0x4b5981[_0x2f29('0x68')]=_0x5221b7[_0x2f29('0x69')]||0x1;return;}if(_[_0x2f29('0x6a')](_0x5221b7[_0x2f29('0x69')])||_0x5221b7['min_internal']===_0x1a43cc){_0x4b5981[_0x2f29('0x68')]=_0x1a43cc+0x1;return;}if(_0x5221b7[_0x2f29('0x69')]>_0x1a43cc){_0x4b5981[_0x2f29('0x68')]=_0x5221b7[_0x2f29('0x69')];return;}return db[_0x2f29('0x6b')][_0x2f29('0x40')](_0x2f29('0x6c'),{'type':db[_0x2f29('0x6b')][_0x2f29('0x6d')][_0x2f29('0x6e')]})[_0x2f29('0x28')](function(_0x3367a8){if(_0x3367a8&&_0x3367a8[_0x2f29('0x48')]){for(var _0x4eaedd=0x0,_0x4f48b1=_0x3367a8[_0x2f29('0x48')];_0x4eaedd<_0x4f48b1&&_[_0x2f29('0x6a')](_0x4b5981[_0x2f29('0x68')]);_0x4eaedd++){if(_0x5221b7[_0x2f29('0x69')]<=_0x3367a8[_0x4eaedd][_0x2f29('0x6f')]){_0x4b5981[_0x2f29('0x68')]=_0x3367a8[_0x4eaedd][_0x2f29('0x6f')];}else if(_0x5221b7[_0x2f29('0x69')]>_0x3367a8[_0x4eaedd][_0x2f29('0x6f')]&&_0x5221b7[_0x2f29('0x69')]<=_0x3367a8[_0x4eaedd]['to']){_0x4b5981[_0x2f29('0x68')]=_0x5221b7[_0x2f29('0x69')];}}}if(_[_0x2f29('0x6a')](_0x4b5981[_0x2f29('0x68')])){_0x4b5981[_0x2f29('0x68')]=_0x1a43cc+0x1;}return _0x39b9e6(_0x4b5981);});});})[_0x2f29('0x1d')](function(_0x49a54){_0x191a23(_0x49a54);});});}function updateUser(_0x143b67){return new BPromise(function(_0xe5e25f,_0x17dac8){try{if(_0x143b67[_0x2f29('0x70')]){_0x143b67[_0x2f29('0x71')]=_0x143b67[_0x2f29('0x68')];_0x143b67[_0x2f29('0x72')]={'mailbox':_0x143b67[_0x2f29('0x68')],'password':_0x143b67[_0x2f29('0x3d')],'fullname':_0x143b67[_0x2f29('0x73')],'email':_0x143b67['email']};}if(_0x143b67[_0x2f29('0x33')]==='agent'){if(!_0x143b67[_0x2f29('0x74')])_0x143b67[_0x2f29('0x74')]=[_0x2f29('0x75'),_0x2f29('0x76'),_0x2f29('0x77'),_0x2f29('0x78'),_0x2f29('0x79'),_0x2f29('0x7a'),_0x2f29('0x7b'),'106',_0x2f29('0x7c'),_0x2f29('0x7d'),'109',_0x2f29('0x7e'),'111','114',_0x2f29('0x7f')];}_0xe5e25f(_0x143b67);}catch(_0xb1d41a){_0x17dac8(_0xb1d41a);}});}exports[_0x2f29('0x80')]=function(_0x402281,_0x3905a7){if(_0x402281[_0x2f29('0x81')][_0x2f29('0x33')]===_0x2f29('0x2d'))throw new Error(_0x2f29('0x82'));if(_0x402281[_0x2f29('0x5d')]['role']===_0x2f29('0x81')&&_0x402281[_0x2f29('0x81')][_0x2f29('0x33')]!=='admin'){throw new Error(_0x2f29('0x83'));}if(_0x402281[_0x2f29('0x5d')][_0x2f29('0x33')]==='admin'&&_0x402281[_0x2f29('0x81')][_0x2f29('0x33')]!==_0x2f29('0x2b')){throw new Error(_0x2f29('0x84'));}return licenseUtil[_0x2f29('0x85')]([_0x402281[_0x2f29('0x5d')]])[_0x2f29('0x28')](function(){return validateUser(_0x402281[_0x2f29('0x5d')]);})['then'](function(_0x45f0fa){return updateUser(_0x45f0fa)['then'](function(_0x220eb2){if(_0x220eb2[_0x2f29('0x33')]===_0x2f29('0x2b')){_0x220eb2[_0x2f29('0x86')]=_0x402281['user']['settingsEnabled'];delete _0x220eb2[_0x2f29('0x87')];}return _0x220eb2;});})[_0x2f29('0x28')](function(_0x5d9430){return db['User'][_0x2f29('0x80')](_0x5d9430,{'include':[{'model':db['VoiceMail'],'as':_0x2f29('0x72')}]});})['then'](function(_0x5736a3){if(_0x402281[_0x2f29('0x5d')][_0x2f29('0x33')]==='user')return _0x5736a3;if(_0x402281['user'][_0x2f29('0x33')]!==_0x2f29('0x81'))return _0x5736a3;return db[_0x2f29('0x88')]['find']({'where':{'name':_0x5736a3[_0x2f29('0x33')]===_0x2f29('0x2d')?_0x2f29('0x2c'):'Telephones','userProfileId':_0x402281[_0x2f29('0x81')]['userProfileId']},'raw':!![]})['then'](function(_0x2562d1){if(!_0x2562d1||_0x2562d1[_0x2f29('0x89')]!=0x0)return _0x5736a3;return db[_0x2f29('0x36')][_0x2f29('0x80')]({'name':_0x5736a3[_0x2f29('0x35')],'resourceId':_0x5736a3['id'],'type':_0x2562d1[_0x2f29('0x35')],'sectionId':_0x2562d1['id']},{})['then'](function(){return _0x5736a3;});})[_0x2f29('0x1d')](function(_0x5a711f){logger[_0x2f29('0x1a')](_0x2f29('0x8a'),_0x5a711f);throw _0x5a711f;});})[_0x2f29('0x28')](respondWithResult(_0x3905a7,0xc9))[_0x2f29('0x1d')](handleError(_0x3905a7,null));};exports[_0x2f29('0x8b')]=function(_0x8cbc20,_0x48ae6a){var _0x1d114d=_0x8cbc20[_0x2f29('0x5d')];var _0x58cbdf=[];if(_0x8cbc20[_0x2f29('0x81')][_0x2f29('0x33')]===_0x2f29('0x2d'))throw new Error('Unauthorized');if(_['some'](_0x1d114d,['role',_0x2f29('0x81')])&&_0x8cbc20[_0x2f29('0x81')][_0x2f29('0x33')]!=='admin'){throw new Error(_0x2f29('0x83'));}if(_['some'](_0x1d114d,[_0x2f29('0x33'),'admin'])&&_0x8cbc20[_0x2f29('0x81')]['role']!==_0x2f29('0x2b')){throw new Error(_0x2f29('0x8c'));}return licenseUtil['checkUserLimits'](_0x1d114d)[_0x2f29('0x28')](function(){return validateUser(_0x1d114d[0x0]);})[_0x2f29('0x28')](function(){for(var _0x2faad1=0x1;_0x2faad1<_0x1d114d[_0x2f29('0x48')];_0x2faad1++){var _0x242ccf=_0x1d114d[_0x2faad1-0x1][_0x2f29('0x68')];if(!_0x1d114d[_0x2faad1][_0x2f29('0x68')])_0x1d114d[_0x2faad1][_0x2f29('0x68')]=_0x242ccf+0x1;_0x58cbdf[_0x2f29('0x45')](validateUser(_0x1d114d[_0x2faad1]));}return BPromise[_0x2f29('0x4d')](_0x58cbdf);})[_0x2f29('0x28')](function(){_0x58cbdf=[];for(var _0x17123f=0x0;_0x17123f<_0x1d114d['length'];_0x17123f++){_0x58cbdf[_0x2f29('0x45')](updateUser(_0x1d114d[_0x17123f]));}return BPromise[_0x2f29('0x4d')](_0x58cbdf);})[_0x2f29('0x28')](function(){return BPromise[_0x2f29('0x8d')](_0x1d114d,function(_0x59f490){return db[_0x2f29('0x3a')][_0x2f29('0x80')](_0x59f490,{'include':[{'model':db['VoiceMail'],'as':_0x2f29('0x72')}]})[_0x2f29('0x28')](function(_0x14c07f){_0x59f490['id']=_0x14c07f['id'];return _0x59f490;});});})[_0x2f29('0x28')](function(_0x3b6ec5){if(_0x8cbc20[_0x2f29('0x5d')][_0x2f29('0x33')]===_0x2f29('0x81'))return _0x3b6ec5;if(_0x8cbc20[_0x2f29('0x81')][_0x2f29('0x33')]!==_0x2f29('0x81'))return _0x3b6ec5;var _0x794ab1=_[_0x2f29('0x8e')](_0x3b6ec5,function(_0x2b785b){return _0x2b785b['role']===_0x2f29('0x2d')||_0x2b785b[_0x2f29('0x33')]===_0x2f29('0x8f');});if(!_0x794ab1)return _0x3b6ec5;return db[_0x2f29('0x88')][_0x2f29('0x46')]({'where':{'name':{'$or':[_0x2f29('0x2c'),_0x2f29('0x2e')]},'userProfileId':_0x8cbc20[_0x2f29('0x81')]['userProfileId']},'raw':!![]})[_0x2f29('0x28')](function(_0x4d2995){if(_[_0x2f29('0x90')](_0x4d2995)||!_[_0x2f29('0x8e')](_0x4d2995,['autoAssociation',0x0]))return _0x3b6ec5;_0x58cbdf=[];var _0x129330=_(_0x4d2995)[_0x2f29('0x30')](function(_0x4d88a1){if(_0x4d88a1[_0x2f29('0x89')]===0x1)return;return _0x4d88a1['name']==='Agents'?_0x2f29('0x2d'):_0x2f29('0x8f');})[_0x2f29('0x91')]()[_0x2f29('0x31')]();for(var _0x4de55e=0x0;_0x4de55e<_0x3b6ec5[_0x2f29('0x48')];_0x4de55e++){if(!_[_0x2f29('0x32')](_0x129330,_0x3b6ec5[_0x4de55e][_0x2f29('0x33')]))return;var _0x4129ea=_0x3b6ec5[_0x4de55e]['role']===_0x2f29('0x2d')?'Agents':_0x2f29('0x2e');_0x58cbdf[_0x2f29('0x45')](db[_0x2f29('0x36')][_0x2f29('0x80')]({'name':_0x3b6ec5[_0x4de55e][_0x2f29('0x35')],'resourceId':_0x3b6ec5[_0x4de55e]['id'],'type':_0x4129ea,'sectionId':_[_0x2f29('0x34')](_0x4d2995,[_0x2f29('0x35'),_0x4129ea])['id']},{}));}return BPromise['all'](_0x58cbdf);});})[_0x2f29('0x28')](respondWithResult(_0x48ae6a,0xc9))[_0x2f29('0x1d')](handleError(_0x48ae6a,null));};exports['changePassword']=function(_0x15ab1b,_0x1ca460){if(_0x15ab1b['body']['id']){delete _0x15ab1b[_0x2f29('0x5d')]['id'];}return db[_0x2f29('0x3a')]['find']({'where':{'id':_0x15ab1b[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](function(_0x3a7a0b){if(!_0x3a7a0b)return null;if(_0x3a7a0b['id']===_0x15ab1b[_0x2f29('0x81')]['id']){if(!_0x15ab1b[_0x2f29('0x5d')]['oldPassword']||!_0x15ab1b[_0x2f29('0x5d')][_0x2f29('0x92')]){throw new db[(_0x2f29('0x93'))][(_0x2f29('0x94'))](_0x2f29('0x95'));}if(!_0x3a7a0b['authenticate'](_0x15ab1b[_0x2f29('0x5d')][_0x2f29('0x96')])){throw new db[(_0x2f29('0x93'))]['ValidationError'](_0x2f29('0x97'));}if(_0x15ab1b[_0x2f29('0x5d')][_0x2f29('0x96')]===_0x15ab1b[_0x2f29('0x5d')][_0x2f29('0x92')]){throw new db['Sequelize'][(_0x2f29('0x94'))](_0x2f29('0x98'));}}else if(_0x15ab1b[_0x2f29('0x81')][_0x2f29('0x33')]===_0x2f29('0x2b')){if(!_0x15ab1b['body'][_0x2f29('0x92')]){throw new db[(_0x2f29('0x93'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x15ab1b[_0x2f29('0x81')][_0x2f29('0x33')]===_0x2f29('0x81')){if(!_0x15ab1b[_0x2f29('0x5d')][_0x2f29('0x92')]){throw new db[(_0x2f29('0x93'))][(_0x2f29('0x94'))](_0x2f29('0x99'));}if(_0x3a7a0b['role']!==_0x2f29('0x2d')){throw new db['Sequelize']['ValidationError'](_0x2f29('0x82'));}}else{throw new db[(_0x2f29('0x93'))][(_0x2f29('0x94'))](_0x2f29('0x82'));}return _0x3a7a0b;})['then'](handleEntityNotFound(_0x1ca460,null))[_0x2f29('0x28')](function(_0x2a1340){return db[_0x2f29('0x63')]['findOne']({'attributes':['id',_0x2f29('0x65'),_0x2f29('0x9a'),_0x2f29('0x9b')]})[_0x2f29('0x28')](function(_0x22efc5){if(_0x22efc5[_0x2f29('0x65')])authService[_0x2f29('0x66')](_0x15ab1b[_0x2f29('0x5d')]['newPassword']);if(!_0x22efc5[_0x2f29('0x9a')]||!_0x2a1340[_0x2f29('0x9c')])return _0x2a1340;authService[_0x2f29('0x9d')](_0x15ab1b[_0x2f29('0x5d')]['newPassword'],_0x2a1340[_0x2f29('0x9c')],_0x22efc5['passwordHistoryLimit']);return _0x2a1340;})[_0x2f29('0x28')](saveUpdates({'password':_0x15ab1b['body']['newPassword'],'passwordResetAt':_0x15ab1b[_0x2f29('0x81')]['id']==_0x15ab1b[_0x2f29('0x5e')]['id']?moment():null,'previousPasswords':authService[_0x2f29('0x9e')](_0x15ab1b[_0x2f29('0x5d')][_0x2f29('0x92')],_0x2a1340[_0x2f29('0x9c')])},null));})['then'](respondWithResult(_0x1ca460,null))[_0x2f29('0x1d')](handleError(_0x1ca460,null));};exports['addQueues']=function(_0x32ac4c,_0x32d58a){var _0x3f3b59=_0x32ac4c['body']['channel'];return db['User'][_0x2f29('0x34')]({'where':{'id':_0x32ac4c[_0x2f29('0x5e')]['id']},'attributes':['id',_0x2f29('0x35'),_0x2f29('0x33'),_0x2f29('0x9f'),'loginInPause',_0x2f29('0xa0'),'interface']})[_0x2f29('0x28')](handleEntityNotFound(_0x32d58a,null))[_0x2f29('0x28')](function(_0x5a7aea){if(_0x5a7aea){if(!utils[_0x2f29('0xa1')](_0x3f3b59)){throw new db[(_0x2f29('0x93'))][(_0x2f29('0x94'))](_0x2f29('0xa2'));}return _0x5a7aea[_0x2f29('0xa3')+_[_0x2f29('0xa4')](_0x3f3b59['toLowerCase']())+_0x2f29('0xa5')](_0x32ac4c[_0x2f29('0x5d')][_0x2f29('0x61')],{'penalty':_0x32ac4c[_0x2f29('0x5d')]['penalty']||0x0})[_0x2f29('0xa6')](function(_0x36d7df){for(var _0x1aff09=0x0;_0x1aff09<_0x32ac4c['body'][_0x2f29('0x61')][_0x2f29('0x48')];_0x1aff09+=0x1){var _0x415d97={'UserId':Number(_0x32ac4c['params']['id'])};_0x415d97[_[_0x2f29('0xa4')](_0x3f3b59[_0x2f29('0xa7')]())+'QueueId']=Number(_0x32ac4c[_0x2f29('0x5d')][_0x2f29('0x61')][_0x1aff09]);socket[_0x2f29('0xa8')](_0x2f29('0x81')+_[_0x2f29('0xa4')](_0x3f3b59[_0x2f29('0xa7')]())+'Queue:save',_0x415d97);}return _0x36d7df;})[_0x2f29('0x28')](function(){if(_0x3f3b59==='voice'){return db['VoiceQueue']['findAll']({'where':{'id':_0x32ac4c[_0x2f29('0x5d')][_0x2f29('0x61')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x2f29('0x28')](function(_0x76220b){var _0x318514=_0x5a7aea[_0x2f29('0x2a')]({'plain':!![]});var _0x559b8e=[];if(_0x3f3b59===_0x2f29('0xa9')&&_0x318514[_0x2f29('0x33')]===_0x2f29('0x2d')&&_0x318514[_0x2f29('0x9f')]){for(var _0x340696=0x0;_0x340696<_0x76220b[_0x2f29('0x48')];_0x340696+=0x1){_0x559b8e[_0x2f29('0x45')]({'membername':_0x318514['name'],'UserId':_0x318514['id'],'queue_name':_0x76220b[_0x340696][_0x2f29('0x35')],'VoiceQueueId':_0x76220b[_0x340696]['id'],'interface':_[_0x2f29('0x6a')](_0x318514[_0x2f29('0xaa')])?util[_0x2f29('0xab')](_0x2f29('0xac'),_0x318514[_0x2f29('0x35')]):_0x318514[_0x2f29('0xaa')],'paused':_0x318514[_0x2f29('0xa0')]||![],'penalty':_0x32ac4c[_0x2f29('0x5d')][_0x2f29('0xad')]||0x0});}return BPromise[_0x2f29('0x8d')](_0x559b8e,function(_0x450072){return db[_0x2f29('0xae')]['upsert'](_0x450072);});}return _0x5a7aea;});}})['then'](respondWithStatusCode(_0x32d58a,null))[_0x2f29('0x1d')](handleError(_0x32d58a,null));};exports[_0x2f29('0xaf')]=function(_0x52ff01,_0x1458ce){var _0xb8076d,_0xdfee7e;return db['User'][_0x2f29('0x34')]({'where':{'id':_0x52ff01['params']['id']},'attributes':['id',_0x2f29('0x35'),_0x2f29('0x33')]})[_0x2f29('0x28')](handleEntityNotFound(_0x1458ce,null))[_0x2f29('0x28')](function(_0x4f10e7){if(_0x4f10e7){_0xb8076d=_0x4f10e7;if(!_0x52ff01[_0x2f29('0x40')]['channel']||!utils[_0x2f29('0xa1')](_0x52ff01['query']['channel'])){throw new db[(_0x2f29('0x93'))]['ValidationError']('Unknown\x20channel');}return _0x4f10e7[_0x2f29('0xb0')+_['capitalize'](_0x52ff01[_0x2f29('0x40')][_0x2f29('0xb1')][_0x2f29('0xa7')]())+_0x2f29('0xa5')](_0x52ff01[_0x2f29('0x40')][_0x2f29('0x61')]);}})[_0x2f29('0x28')](function(_0x3ffd45){if(_[_0x2f29('0xb2')](_0x52ff01['query'][_0x2f29('0x61')])){for(var _0x3f125d=0x0;_0x3f125d<_0x52ff01['query'][_0x2f29('0x61')][_0x2f29('0x48')];_0x3f125d+=0x1){_0xdfee7e={'UserId':Number(_0x52ff01[_0x2f29('0x5e')]['id'])};_0xdfee7e[_[_0x2f29('0xa4')](_0x52ff01[_0x2f29('0x40')][_0x2f29('0xb1')][_0x2f29('0xa7')]())+_0x2f29('0xb3')]=Number(_0x52ff01[_0x2f29('0x40')][_0x2f29('0x61')][_0x3f125d]);socket[_0x2f29('0xa8')](_0x2f29('0x81')+_[_0x2f29('0xa4')](_0x52ff01['query'][_0x2f29('0xb1')][_0x2f29('0xa7')]())+_0x2f29('0xb4'),_0xdfee7e);}}else{_0xdfee7e={'UserId':Number(_0x52ff01[_0x2f29('0x5e')]['id'])};_0xdfee7e[_[_0x2f29('0xa4')](_0x52ff01['query'][_0x2f29('0xb1')]['toLowerCase']())+_0x2f29('0xb3')]=Number(_0x52ff01[_0x2f29('0x40')][_0x2f29('0x61')]);socket[_0x2f29('0xa8')](_0x2f29('0x81')+_[_0x2f29('0xa4')](_0x52ff01['query'][_0x2f29('0xb1')]['toLowerCase']())+_0x2f29('0xb4'),_0xdfee7e);}return _0x3ffd45;})[_0x2f29('0x28')](function(){if(_0x52ff01[_0x2f29('0x40')]['channel']==='voice'){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x52ff01['params']['id'],'VoiceQueueId':_0x52ff01[_0x2f29('0x40')]['ids']},'individualHooks':!![]})[_0x2f29('0x28')](function(){return _0xb8076d;});}return _0xb8076d;})[_0x2f29('0x28')](respondWithStatusCode(_0x1458ce,null))['catch'](handleError(_0x1458ce,null));};exports['addAvatar']=function(_0x3018cb,_0x5aa8be){_0x3018cb[_0x2f29('0x5d')][_0x2f29('0xb5')]=_0x3018cb[_0x2f29('0xb6')][_0x2f29('0xb7')];return db[_0x2f29('0x3a')][_0x2f29('0x34')]({'where':{'id':_0x3018cb[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x5aa8be,null))['then'](saveUpdates(_0x3018cb[_0x2f29('0x5d')],null))[_0x2f29('0x28')](respondWithResult(_0x5aa8be,null))[_0x2f29('0x1d')](handleError(_0x5aa8be,null));};exports[_0x2f29('0xb8')]=function(_0x116fe5,_0x27df75){var _0xc9b3fb=path['join'](config[_0x2f29('0xb9')],'server/files/images/logos/default_profile.png');return db[_0x2f29('0x3a')]['find']({'where':{'id':_0x116fe5[_0x2f29('0x5e')]['id']},'attributes':['id',_0x2f29('0xb5')],'raw':!![]})[_0x2f29('0x28')](handleEntityNotFound(_0x27df75,null))[_0x2f29('0x28')](function(_0x4872d4){if(_0x4872d4){if(_[_0x2f29('0x6a')](_0x4872d4[_0x2f29('0xb5')])){return _0x27df75[_0x2f29('0xba')](_0xc9b3fb);}else{if(!fs[_0x2f29('0xbb')](path[_0x2f29('0xbc')](config[_0x2f29('0xb9')],_0x2f29('0xbd'),_0x4872d4[_0x2f29('0xb5')]))){return _0x27df75[_0x2f29('0xba')](_0xc9b3fb);}return _0x27df75['download'](path['join'](config[_0x2f29('0xb9')],'server/files/images/',_0x4872d4[_0x2f29('0xb5')]));}}})[_0x2f29('0x1d')](handleError(_0x27df75,null));};exports[_0x2f29('0xbe')]=function(_0x4f7238,_0x2b33cb){return db['User'][_0x2f29('0x34')]({'where':{'id':_0x4f7238['params']['id']},'attributes':['id']})[_0x2f29('0x28')](handleEntityNotFound(_0x2b33cb,null))[_0x2f29('0x28')](function(_0x42e715){var _0x219440=[];values=_0x42e715[_0x2f29('0x49')];_0x219440[_0x2f29('0x45')](get_open_tabs('chat',_0x42e715[_0x2f29('0x49')]));_0x219440[_0x2f29('0x45')](get_open_tabs('sms',_0x42e715[_0x2f29('0x49')]));_0x219440[_0x2f29('0x45')](get_open_tabs('openchannel',_0x42e715[_0x2f29('0x49')]));_0x219440[_0x2f29('0x45')](get_open_tabs(_0x2f29('0x4c'),_0x42e715['dataValues']));_0x219440[_0x2f29('0x45')](get_open_tabs(_0x2f29('0x4a'),_0x42e715['dataValues']));_0x219440[_0x2f29('0x45')](get_open_tabs('mail',_0x42e715[_0x2f29('0x49')]));return BPromise[_0x2f29('0x4d')](_0x219440);})[_0x2f29('0x28')](function(_0x5a917b){if(_0x5a917b){var _0x33a9d8=_[_0x2f29('0x30')](values['ChatOpenTabs'],function(_0x4eef75){return{'channel':_0x2f29('0xbf'),'id':_0x4eef75['id'],'createdAt':_0x4eef75[_0x2f29('0xc0')]};});var _0x34dae3=_[_0x2f29('0x30')](values[_0x2f29('0xc1')],function(_0x4f4477){return{'channel':_0x2f29('0xc2'),'id':_0x4f4477['id'],'createdAt':_0x4f4477[_0x2f29('0xc0')]};});var _0x289073=_[_0x2f29('0x30')](values[_0x2f29('0xc3')],function(_0x4e569e){return{'channel':_0x2f29('0xc4'),'id':_0x4e569e['id'],'createdAt':_0x4e569e['createdAt']};});var _0xf24a4d=_[_0x2f29('0x30')](values[_0x2f29('0xc5')],function(_0x1277ad){return{'channel':_0x2f29('0xc6'),'id':_0x1277ad['id'],'createdAt':_0x1277ad[_0x2f29('0xc0')]};});var _0x10ca14=_[_0x2f29('0x30')](values[_0x2f29('0xc7')],function(_0xc0b846){return{'channel':_0x2f29('0xc8'),'id':_0xc0b846['id'],'createdAt':_0xc0b846['createdAt']};});var _0x56976e=_[_0x2f29('0x30')](values[_0x2f29('0xc9')],function(_0x23753b){return{'channel':_0x2f29('0xca'),'id':_0x23753b['id'],'createdAt':_0x23753b['createdAt']};});var _0x4f3b7b=_[_0x2f29('0xcb')](_0x33a9d8,_0x34dae3,_0x289073,_0xf24a4d,_0x10ca14,_0x56976e);var _0x30350d={'count':_0x4f3b7b[_0x2f29('0x48')],'rows':_0x4f3b7b};return _0x30350d;}else return null;})['then'](respondWithResult(_0x2b33cb,null))[_0x2f29('0x1d')](handleError(_0x2b33cb,null));};exports[_0x2f29('0xcc')]=function(_0x32318b,_0x8df29d){var _0x117b18={};var _0xfd919a={};var _0x33c55a;var _0x547b75;return db['User']['findOne']({'where':{'id':_0x32318b['params']['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x8df29d,null))[_0x2f29('0x28')](function(_0x5b6fb8){if(_0x5b6fb8){_0x33c55a=_0x5b6fb8;_0xfd919a[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_0x2f29('0xcd')]['rawAttributes']);_0xfd919a[_0x2f29('0x40')]=_['keys'](_0x32318b[_0x2f29('0x40')]);_0xfd919a[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0xfd919a[_0x2f29('0x4f')],_0xfd919a['query']);_0x117b18[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0xfd919a['model'],qs[_0x2f29('0x55')](_0x32318b[_0x2f29('0x40')][_0x2f29('0x55')]));_0x117b18[_0x2f29('0x54')]=_0x117b18[_0x2f29('0x54')]['length']?_0x117b18[_0x2f29('0x54')]:_0xfd919a[_0x2f29('0x4f')];_0x117b18[_0x2f29('0xce')]=qs[_0x2f29('0xcf')](_0x32318b[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x117b18[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_[_0x2f29('0xd0')](_0x32318b[_0x2f29('0x40')],_0xfd919a[_0x2f29('0x52')]));if(_0x32318b['query'][_0x2f29('0x2f')]){_0x117b18[_0x2f29('0x3e')]=_[_0x2f29('0x57')](_0x117b18['where'],{'$or':_[_0x2f29('0x30')](_0x117b18['attributes'],function(_0x21081b){var _0x67f4b8={};_0x67f4b8[_0x21081b]={'$like':'%'+_0x32318b[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x67f4b8;})});}_0x117b18=_[_0x2f29('0x57')]({},_0x117b18,_0x32318b['options']);return _0x33c55a[_0x2f29('0xcc')](_0x117b18);}})[_0x2f29('0x28')](function(_0x4267d0){if(_0x4267d0){_0x547b75=_0x4267d0[_0x2f29('0x48')];if(_0x32318b['query'][_0x2f29('0xd1')]('includeAll')){_0x117b18[_0x2f29('0x43')]=[{'model':db[_0x2f29('0xd2')],'as':_0x2f29('0xd3'),'required':![]},{'model':db['Tag'],'as':_0x2f29('0xd4'),'attributes':['id','name',_0x2f29('0xd5')],'where':_0x32318b[_0x2f29('0x40')][_0x2f29('0xd6')]?{'id':_0x32318b[_0x2f29('0x40')][_0x2f29('0xd6')]}:undefined,'required':_0x32318b[_0x2f29('0x40')][_0x2f29('0xd6')]?!![]:![]}];}if(!_0x32318b[_0x2f29('0x40')][_0x2f29('0xd1')](_0x2f29('0xd7'))){_0x117b18[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x32318b[_0x2f29('0x40')][_0x2f29('0x23')]);_0x117b18[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x32318b[_0x2f29('0x40')]['offset']);}return _0x33c55a[_0x2f29('0xcc')](_0x117b18);}})['then'](function(_0x59a7fd){if(_0x59a7fd){return _0x59a7fd?{'count':_0x547b75,'rows':_0x59a7fd}:null;}})[_0x2f29('0x28')](respondWithResult(_0x8df29d,null))['catch'](handleError(_0x8df29d,null));};exports[_0x2f29('0xd8')]=function(_0x3a34d5,_0x2c7606){var _0x3c2174;var _0x18c231={};var _0x2a411e;return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x3a34d5[_0x2f29('0x5e')]['id']},'attributes':['id',_0x2f29('0x35'),_0x2f29('0x33')]})[_0x2f29('0x28')](handleEntityNotFound(_0x2c7606,null))[_0x2f29('0x28')](function(_0x483524){if(!utils['isValidChannel'](_0x3a34d5[_0x2f29('0x40')][_0x2f29('0xb1')])){throw new db[(_0x2f29('0x93'))][(_0x2f29('0x94'))](_0x2f29('0xa2'));}_0x3c2174=_0x483524;var _0x53b75d={};_0x53b75d[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_[_0x2f29('0xa4')](_0x3a34d5['query'][_0x2f29('0xb1')])+_0x2f29('0xda')][_0x2f29('0x51')]);_0x53b75d[_0x2f29('0x40')]=_[_0x2f29('0x50')](_0x3a34d5[_0x2f29('0x40')]);_0x53b75d[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0x53b75d[_0x2f29('0x4f')],_0x53b75d['query']);_0x18c231['attributes']=_['intersection'](_0x53b75d[_0x2f29('0x4f')],qs['fields'](_0x3a34d5[_0x2f29('0x40')][_0x2f29('0x55')]));_0x18c231[_0x2f29('0x54')]=_0x18c231['attributes'][_0x2f29('0x48')]?_0x18c231[_0x2f29('0x54')]:_0x53b75d[_0x2f29('0x4f')];_0x18c231['order']=qs[_0x2f29('0xcf')](_0x3a34d5[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x18c231[_0x2f29('0x3e')]=qs['filters'](_[_0x2f29('0xd0')](_0x3a34d5[_0x2f29('0x40')],_0x53b75d[_0x2f29('0x52')]));if(_0x3a34d5['query']['filter']){_0x18c231[_0x2f29('0x3e')]=_[_0x2f29('0x57')](_0x18c231[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x18c231['attributes'],function(_0x44de54){var _0x578542={};_0x578542[_0x44de54]={'$like':'%'+_0x3a34d5[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x578542;})});}_0x18c231=_[_0x2f29('0x57')]({},_0x18c231,_0x3a34d5[_0x2f29('0x58')]);switch(_0x3c2174['role']){case _0x2f29('0x2b'):return db[_[_0x2f29('0xa4')](_0x3a34d5['query']['channel'])+'Queue'][_0x2f29('0x46')](_0x18c231);case _0x2f29('0x81'):case _0x2f29('0x2d'):return _0x3c2174[_0x2f29('0x2a')+_[_0x2f29('0xa4')](_0x3a34d5['query'][_0x2f29('0xb1')])+_0x2f29('0xa5')](_0x18c231);default:throw new db[(_0x2f29('0x93'))][(_0x2f29('0x94'))](_0x2f29('0xdb'));}})['then'](function(_0x373a25){_0x2a411e=_0x373a25[_0x2f29('0x48')];if(!_0x3a34d5['query'][_0x2f29('0xd1')](_0x2f29('0xd7'))){_0x18c231[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x3a34d5[_0x2f29('0x40')][_0x2f29('0x23')]);_0x18c231[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x3a34d5[_0x2f29('0x40')][_0x2f29('0x24')]);}switch(_0x3c2174[_0x2f29('0x33')]){case _0x2f29('0x2b'):return db[_['capitalize'](_0x3a34d5[_0x2f29('0x40')][_0x2f29('0xb1')])+_0x2f29('0xda')][_0x2f29('0x46')](_0x18c231);case _0x2f29('0x81'):case _0x2f29('0x2d'):return _0x3c2174[_0x2f29('0x2a')+_[_0x2f29('0xa4')](_0x3a34d5[_0x2f29('0x40')][_0x2f29('0xb1')])+_0x2f29('0xa5')](_0x18c231);}})[_0x2f29('0x28')](function(_0x56cbae){return{'count':_0x2a411e,'rows':_0x56cbae};})[_0x2f29('0x28')](respondWithResult(_0x2c7606,null))['catch'](handleError(_0x2c7606,null));};exports[_0x2f29('0xdc')]=function(_0x414fe2,_0x4351de){var _0x223500={};var _0x2a711f={};var _0x2f1d35;var _0x2b9323;return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x414fe2[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x4351de,null))[_0x2f29('0x28')](function(_0x2aa8e0){if(_0x2aa8e0){_0x2f1d35=_0x2aa8e0;_0x2a711f[_0x2f29('0x4f')]=_['keys'](db[_0x2f29('0xae')][_0x2f29('0x51')]);_0x2a711f[_0x2f29('0x40')]=_[_0x2f29('0x50')](_0x414fe2[_0x2f29('0x40')]);_0x2a711f['filters']=_[_0x2f29('0x53')](_0x2a711f[_0x2f29('0x4f')],_0x2a711f[_0x2f29('0x40')]);_0x223500[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x2a711f[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x414fe2['query'][_0x2f29('0x55')]));_0x223500[_0x2f29('0x54')]=_0x223500[_0x2f29('0x54')][_0x2f29('0x48')]?_0x223500['attributes']:_0x2a711f[_0x2f29('0x4f')];_0x223500['order']=qs[_0x2f29('0xcf')](_0x414fe2['query'][_0x2f29('0xcf')]);_0x223500[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_[_0x2f29('0xd0')](_0x414fe2[_0x2f29('0x40')],_0x2a711f['filters']));if(_0x414fe2[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x223500[_0x2f29('0x3e')]=_[_0x2f29('0x57')](_0x223500[_0x2f29('0x3e')],{'$or':_['map'](_0x223500[_0x2f29('0x54')],function(_0x28862d){var _0x32c556={};_0x32c556[_0x28862d]={'$like':'%'+_0x414fe2[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x32c556;})});}_0x223500=_[_0x2f29('0x57')]({},_0x223500,_0x414fe2[_0x2f29('0x58')]);return _0x2f1d35[_0x2f29('0xdc')](_0x223500);}})['then'](function(_0xab392c){if(_0xab392c){_0x2b9323=_0xab392c[_0x2f29('0x48')];if(!_0x414fe2[_0x2f29('0x40')][_0x2f29('0xd1')](_0x2f29('0xd7'))){_0x223500['limit']=qs[_0x2f29('0x23')](_0x414fe2[_0x2f29('0x40')][_0x2f29('0x23')]);_0x223500[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x414fe2[_0x2f29('0x40')]['offset']);}return _0x2f1d35[_0x2f29('0xdc')](_0x223500);}})['then'](function(_0x1dad5b){if(_0x1dad5b){return _0x1dad5b?{'count':_0x2b9323,'rows':_0x1dad5b}:null;}})['then'](respondWithResult(_0x4351de,null))[_0x2f29('0x1d')](handleError(_0x4351de,null));};exports['getGroups']=function(_0x2a0047,_0x35ae36){var _0x3a0e37={};var _0x83de1b={};var _0x5123a1;var _0x5e4a09;return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x2a0047['params']['id']}})['then'](handleEntityNotFound(_0x35ae36,null))[_0x2f29('0x28')](function(_0x2dc08c){if(_0x2dc08c){_0x5123a1=_0x2dc08c;_0x83de1b[_0x2f29('0x4f')]=_['keys'](db['ChatGroup']['rawAttributes']);_0x83de1b[_0x2f29('0x40')]=_[_0x2f29('0x50')](_0x2a0047[_0x2f29('0x40')]);_0x83de1b[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0x83de1b['model'],_0x83de1b[_0x2f29('0x40')]);_0x3a0e37[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x83de1b[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x2a0047[_0x2f29('0x40')][_0x2f29('0x55')]));_0x3a0e37[_0x2f29('0x54')]=_0x3a0e37[_0x2f29('0x54')]['length']?_0x3a0e37[_0x2f29('0x54')]:_0x83de1b['model'];_0x3a0e37[_0x2f29('0xce')]=qs[_0x2f29('0xcf')](_0x2a0047[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x3a0e37[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_[_0x2f29('0xd0')](_0x2a0047['query'],_0x83de1b['filters']));if(_0x2a0047['query'][_0x2f29('0x2f')]){_0x3a0e37[_0x2f29('0x3e')]=_[_0x2f29('0x57')](_0x3a0e37[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x3a0e37[_0x2f29('0x54')],function(_0x4bf0f9){var _0x67df19={};_0x67df19[_0x4bf0f9]={'$like':'%'+_0x2a0047[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x67df19;})});}_0x3a0e37=_[_0x2f29('0x57')]({},_0x3a0e37,_0x2a0047[_0x2f29('0x58')]);return _0x5123a1[_0x2f29('0xdd')](_0x3a0e37);}})[_0x2f29('0x28')](function(_0xfd0c77){if(_0xfd0c77){_0x5e4a09=_0xfd0c77[_0x2f29('0x48')];if(!_0x2a0047['query']['hasOwnProperty'](_0x2f29('0xd7'))){_0x3a0e37[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x2a0047[_0x2f29('0x40')]['limit']);_0x3a0e37[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x2a0047[_0x2f29('0x40')]['offset']);}return _0x5123a1[_0x2f29('0xdd')](_0x3a0e37);}})[_0x2f29('0x28')](function(_0xe2ae3a){if(_0xe2ae3a){return _0xe2ae3a?{'count':_0x5e4a09,'rows':_0xe2ae3a}:null;}})[_0x2f29('0x28')](respondWithResult(_0x35ae36,null))[_0x2f29('0x1d')](handleError(_0x35ae36,null));};exports['getRecordings']=function(_0x318477,_0x5d27b8){var _0x5d353b={'raw':!![],'where':{}};var _0x39f969={};var _0x24e9af={'count':0x0,'rows':[]};return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x318477[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x5d27b8,null))[_0x2f29('0x28')](function(_0xf64199){if(_0xf64199){_0x39f969[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_0x2f29('0xde')][_0x2f29('0x51')]);_0x39f969[_0x2f29('0x40')]=_[_0x2f29('0x50')](_0x318477[_0x2f29('0x40')]);_0x39f969['filters']=_[_0x2f29('0x53')](_0x39f969[_0x2f29('0x4f')],_0x39f969['query']);_0x5d353b[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x39f969[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x318477[_0x2f29('0x40')][_0x2f29('0x55')]));_0x5d353b[_0x2f29('0x54')]=_0x5d353b['attributes'][_0x2f29('0x48')]?_0x5d353b[_0x2f29('0x54')]:_0x39f969[_0x2f29('0x4f')];if(!_0x318477[_0x2f29('0x40')]['hasOwnProperty'](_0x2f29('0xd7'))){_0x5d353b['limit']=qs[_0x2f29('0x23')](_0x318477['query'][_0x2f29('0x23')]);_0x5d353b[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x318477[_0x2f29('0x40')]['offset']);}_0x5d353b[_0x2f29('0xce')]=qs[_0x2f29('0xcf')](_0x318477[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x5d353b['where']=qs[_0x2f29('0x52')](_['pick'](_0x318477[_0x2f29('0x40')],_0x39f969[_0x2f29('0x52')]));_0x5d353b[_0x2f29('0x3e')]['UserId']=_0xf64199['id'];if(_0x318477['query']['filter']){_0x5d353b[_0x2f29('0x3e')]=_['merge'](_0x5d353b[_0x2f29('0x3e')],{'$or':_['map'](_0x5d353b['attributes'],function(_0x91becb){var _0x1d27db={};_0x1d27db[_0x91becb]={'$like':'%'+_0x318477[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x1d27db;})});}_0x5d353b=_[_0x2f29('0x57')]({},_0x5d353b,_0x318477['options']);return db[_0x2f29('0xde')][_0x2f29('0x3f')]({'where':_0x5d353b['where']})[_0x2f29('0x28')](function(_0x52d414){_0x24e9af[_0x2f29('0x3f')]=_0x52d414;if(_0x318477[_0x2f29('0x40')]['includeAll']){_0x5d353b[_0x2f29('0x43')]=[{'all':!![]}];}return db[_0x2f29('0xde')]['findAll'](_0x5d353b);})['then'](function(_0x288c1f){_0x24e9af[_0x2f29('0x47')]=_0x288c1f;return _0x24e9af;});}})[_0x2f29('0x28')](respondWithFilteredResult(_0x5d27b8,_0x5d353b))[_0x2f29('0x1d')](handleError(_0x5d27b8,null));};exports[_0x2f29('0xdf')]=function(_0x20bc0c,_0x6f186){var _0x4b67a3={'raw':!![],'where':{}};var _0x4705a5={};var _0x4b663a={'count':0x0,'rows':[]};return db['User'][_0x2f29('0xd9')]({'where':{'id':_0x20bc0c[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x6f186,null))['then'](function(_0x5a62a2){if(_0x5a62a2){_0x4705a5[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db['ScreenRecording'][_0x2f29('0x51')]);_0x4705a5[_0x2f29('0x40')]=_[_0x2f29('0x50')](_0x20bc0c[_0x2f29('0x40')]);_0x4705a5[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0x4705a5[_0x2f29('0x4f')],_0x4705a5['query']);_0x4b67a3[_0x2f29('0x54')]=_['intersection'](_0x4705a5[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x20bc0c[_0x2f29('0x40')][_0x2f29('0x55')]));_0x4b67a3[_0x2f29('0x54')]=_0x4b67a3[_0x2f29('0x54')][_0x2f29('0x48')]?_0x4b67a3[_0x2f29('0x54')]:_0x4705a5[_0x2f29('0x4f')];if(!_0x20bc0c[_0x2f29('0x40')][_0x2f29('0xd1')](_0x2f29('0xd7'))){_0x4b67a3[_0x2f29('0x23')]=qs['limit'](_0x20bc0c[_0x2f29('0x40')]['limit']);_0x4b67a3[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x20bc0c[_0x2f29('0x40')]['offset']);}_0x4b67a3[_0x2f29('0xce')]=qs[_0x2f29('0xcf')](_0x20bc0c[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x4b67a3[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_['pick'](_0x20bc0c[_0x2f29('0x40')],_0x4705a5[_0x2f29('0x52')]));_0x4b67a3[_0x2f29('0x3e')][_0x2f29('0xe0')]=_0x5a62a2['id'];if(_0x20bc0c[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x4b67a3['where']=_[_0x2f29('0x57')](_0x4b67a3[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x4b67a3['attributes'],function(_0xf011b5){var _0x29f5c2={};_0x29f5c2[_0xf011b5]={'$like':'%'+_0x20bc0c[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x29f5c2;})});}_0x4b67a3=_[_0x2f29('0x57')]({},_0x4b67a3,_0x20bc0c['options']);return db[_0x2f29('0xe1')][_0x2f29('0x3f')]({'where':_0x4b67a3['where']})['then'](function(_0xdb99ef){_0x4b663a[_0x2f29('0x3f')]=_0xdb99ef;if(_0x20bc0c[_0x2f29('0x40')][_0x2f29('0x56')]){_0x4b67a3[_0x2f29('0x43')]=[{'all':!![]}];}return db[_0x2f29('0xe1')]['findAll'](_0x4b67a3);})[_0x2f29('0x28')](function(_0xa99993){_0x4b663a[_0x2f29('0x47')]=_0xa99993;return _0x4b663a;});}})['then'](respondWithFilteredResult(_0x6f186,_0x4b67a3))[_0x2f29('0x1d')](handleError(_0x6f186,null));};exports[_0x2f29('0xe2')]=function(_0x3fdcc0,_0x50cacd){var _0x1ca350={};var _0x449e96={};var _0x2b3fb9;var _0x23d81e;return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x3fdcc0[_0x2f29('0x5e')]['id']}})['then'](handleEntityNotFound(_0x50cacd,null))[_0x2f29('0x28')](function(_0x5b2713){if(_0x5b2713){_0x2b3fb9=_0x5b2713;_0x449e96[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db['ChatInteraction'][_0x2f29('0x51')]);_0x449e96[_0x2f29('0x40')]=_['keys'](_0x3fdcc0['query']);_0x449e96[_0x2f29('0x52')]=_['intersection'](_0x449e96[_0x2f29('0x4f')],_0x449e96[_0x2f29('0x40')]);_0x1ca350[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x449e96[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x3fdcc0[_0x2f29('0x40')][_0x2f29('0x55')]));_0x1ca350[_0x2f29('0x54')]=_0x1ca350['attributes'][_0x2f29('0x48')]?_0x1ca350[_0x2f29('0x54')]:_0x449e96[_0x2f29('0x4f')];_0x1ca350[_0x2f29('0xce')]=qs[_0x2f29('0xcf')](_0x3fdcc0[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x1ca350[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_[_0x2f29('0xd0')](_0x3fdcc0[_0x2f29('0x40')],_0x449e96[_0x2f29('0x52')]));if(_0x3fdcc0['query'][_0x2f29('0x2f')]){_0x1ca350[_0x2f29('0x3e')]=_[_0x2f29('0x57')](_0x1ca350['where'],{'$or':_[_0x2f29('0x30')](_0x1ca350[_0x2f29('0x54')],function(_0x286626){var _0x4dda9e={};_0x4dda9e[_0x286626]={'$like':'%'+_0x3fdcc0[_0x2f29('0x40')]['filter']+'%'};return _0x4dda9e;})});}_0x1ca350=_['merge']({},_0x1ca350,_0x3fdcc0['options']);return _0x2b3fb9['getChatInteractions'](_0x1ca350);}})[_0x2f29('0x28')](function(_0x1e1b04){if(_0x1e1b04){_0x23d81e=_0x1e1b04[_0x2f29('0x48')];if(!_0x3fdcc0[_0x2f29('0x40')]['hasOwnProperty'](_0x2f29('0xd7'))){_0x1ca350[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x3fdcc0['query']['limit']);_0x1ca350[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x3fdcc0[_0x2f29('0x40')][_0x2f29('0x24')]);}return _0x2b3fb9[_0x2f29('0xe2')](_0x1ca350);}})[_0x2f29('0x28')](function(_0x49de25){if(_0x49de25){return _0x49de25?{'count':_0x23d81e,'rows':_0x49de25}:null;}})[_0x2f29('0x28')](respondWithResult(_0x50cacd,null))[_0x2f29('0x1d')](handleError(_0x50cacd,null));};exports[_0x2f29('0xe3')]=function(_0x4ef371,_0x561ae4){var _0x43d36f={};var _0x5ed49f={};var _0x5118ca;var _0x2c1649;return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x4ef371['params']['id']}})['then'](handleEntityNotFound(_0x561ae4,null))[_0x2f29('0x28')](function(_0x34a5fb){if(_0x34a5fb){_0x5118ca=_0x34a5fb;_0x5ed49f[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_0x2f29('0xe4')][_0x2f29('0x51')]);_0x5ed49f[_0x2f29('0x40')]=_[_0x2f29('0x50')](_0x4ef371[_0x2f29('0x40')]);_0x5ed49f[_0x2f29('0x52')]=_['intersection'](_0x5ed49f[_0x2f29('0x4f')],_0x5ed49f[_0x2f29('0x40')]);_0x43d36f[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x5ed49f[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x4ef371[_0x2f29('0x40')]['fields']));_0x43d36f[_0x2f29('0x54')]=_0x43d36f['attributes']['length']?_0x43d36f[_0x2f29('0x54')]:_0x5ed49f['model'];_0x43d36f['order']=qs[_0x2f29('0xcf')](_0x4ef371[_0x2f29('0x40')]['sort']);_0x43d36f['where']=qs[_0x2f29('0x52')](_[_0x2f29('0xd0')](_0x4ef371[_0x2f29('0x40')],_0x5ed49f[_0x2f29('0x52')]));if(_0x4ef371[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x43d36f['where']=_[_0x2f29('0x57')](_0x43d36f[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x43d36f[_0x2f29('0x54')],function(_0x2c8657){var _0x29569d={};_0x29569d[_0x2c8657]={'$like':'%'+_0x4ef371[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x29569d;})});}_0x43d36f=_[_0x2f29('0x57')]({},_0x43d36f,_0x4ef371[_0x2f29('0x58')]);return _0x5118ca['getOpenchannelInteractions'](_0x43d36f);}})[_0x2f29('0x28')](function(_0x48e070){if(_0x48e070){_0x2c1649=_0x48e070[_0x2f29('0x48')];if(!_0x4ef371[_0x2f29('0x40')][_0x2f29('0xd1')](_0x2f29('0xd7'))){_0x43d36f[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x4ef371['query'][_0x2f29('0x23')]);_0x43d36f['offset']=qs['offset'](_0x4ef371[_0x2f29('0x40')][_0x2f29('0x24')]);}return _0x5118ca[_0x2f29('0xe3')](_0x43d36f);}})[_0x2f29('0x28')](function(_0x40647d){if(_0x40647d){return _0x40647d?{'count':_0x2c1649,'rows':_0x40647d}:null;}})['then'](respondWithResult(_0x561ae4,null))[_0x2f29('0x1d')](handleError(_0x561ae4,null));};exports['getMailInteractions']=function(_0x318d56,_0x2be77d){var _0x16289e={'raw':!![],'where':{}};var _0x42bbcd={};var _0x79596={'count':0x0,'rows':[]};return db[_0x2f29('0x3a')]['findOne']({'where':{'id':_0x318d56[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x2be77d,null))[_0x2f29('0x28')](function(_0x4eccba){if(_0x4eccba){_0x42bbcd[_0x2f29('0x4f')]=_['keys'](db[_0x2f29('0xe5')][_0x2f29('0x51')]);_0x42bbcd[_0x2f29('0x40')]=_[_0x2f29('0x50')](_0x318d56[_0x2f29('0x40')]);_0x42bbcd[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0x42bbcd[_0x2f29('0x4f')],_0x42bbcd['query']);_0x16289e[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x42bbcd[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x318d56[_0x2f29('0x40')]['fields']));_0x16289e['attributes']=_0x16289e[_0x2f29('0x54')][_0x2f29('0x48')]?_0x16289e[_0x2f29('0x54')]:_0x42bbcd[_0x2f29('0x4f')];if(!_0x318d56[_0x2f29('0x40')][_0x2f29('0xd1')]('nolimit')){_0x16289e[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x318d56[_0x2f29('0x40')]['limit']);_0x16289e[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x318d56[_0x2f29('0x40')][_0x2f29('0x24')]);}_0x16289e[_0x2f29('0xce')]=qs['sort'](_0x318d56['query'][_0x2f29('0xcf')]);_0x16289e[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_['pick'](_0x318d56[_0x2f29('0x40')],_0x42bbcd[_0x2f29('0x52')]));_0x16289e[_0x2f29('0x3e')]['UserId']=_0x4eccba['id'];if(_0x318d56[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x16289e[_0x2f29('0x3e')]=_['merge'](_0x16289e['where'],{'$or':_[_0x2f29('0x30')](_0x16289e[_0x2f29('0x54')],function(_0x111ae0){var _0x19c740={};_0x19c740[_0x111ae0]={'$like':'%'+_0x318d56[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x19c740;})});}_0x16289e=_['merge']({},_0x16289e,_0x318d56[_0x2f29('0x58')]);return db['MailInteraction']['count']({'where':_0x16289e['where']})[_0x2f29('0x28')](function(_0x423948){_0x79596[_0x2f29('0x3f')]=_0x423948;if(_0x318d56[_0x2f29('0x40')]['includeAll']){_0x16289e[_0x2f29('0x43')]=[{'all':!![]}];}return db[_0x2f29('0xe5')]['findAll'](_0x16289e);})['then'](function(_0x5f4f34){_0x79596[_0x2f29('0x47')]=_0x5f4f34;return _0x79596;});}})['then'](respondWithFilteredResult(_0x2be77d,_0x16289e))[_0x2f29('0x1d')](handleError(_0x2be77d,null));};exports[_0x2f29('0xe6')]=function(_0x240f3f,_0x43f9e4){var _0x3c7bec={};var _0x34d67b={};var _0xcfa793;var _0x2df2e5;return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x240f3f[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x43f9e4,null))[_0x2f29('0x28')](function(_0x9e7faf){if(_0x9e7faf){_0xcfa793=_0x9e7faf;_0x34d67b[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_0x2f29('0xe7')][_0x2f29('0x51')]);_0x34d67b['query']=_[_0x2f29('0x50')](_0x240f3f['query']);_0x34d67b['filters']=_['intersection'](_0x34d67b[_0x2f29('0x4f')],_0x34d67b[_0x2f29('0x40')]);_0x3c7bec[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x34d67b[_0x2f29('0x4f')],qs['fields'](_0x240f3f[_0x2f29('0x40')][_0x2f29('0x55')]));_0x3c7bec[_0x2f29('0x54')]=_0x3c7bec[_0x2f29('0x54')][_0x2f29('0x48')]?_0x3c7bec['attributes']:_0x34d67b[_0x2f29('0x4f')];_0x3c7bec[_0x2f29('0xce')]=qs[_0x2f29('0xcf')](_0x240f3f[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x3c7bec[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_[_0x2f29('0xd0')](_0x240f3f[_0x2f29('0x40')],_0x34d67b[_0x2f29('0x52')]));if(_0x240f3f[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x3c7bec['where']=_[_0x2f29('0x57')](_0x3c7bec[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x3c7bec[_0x2f29('0x54')],function(_0x3882b){var _0x30b017={};_0x30b017[_0x3882b]={'$like':'%'+_0x240f3f[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x30b017;})});}_0x3c7bec=_[_0x2f29('0x57')]({},_0x3c7bec,_0x240f3f[_0x2f29('0x58')]);return _0xcfa793['getSmsInteractions'](_0x3c7bec);}})[_0x2f29('0x28')](function(_0xa5fe65){if(_0xa5fe65){_0x2df2e5=_0xa5fe65['length'];if(!_0x240f3f[_0x2f29('0x40')][_0x2f29('0xd1')](_0x2f29('0xd7'))){_0x3c7bec[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x240f3f[_0x2f29('0x40')][_0x2f29('0x23')]);_0x3c7bec[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x240f3f[_0x2f29('0x40')][_0x2f29('0x24')]);}return _0xcfa793[_0x2f29('0xe6')](_0x3c7bec);}})[_0x2f29('0x28')](function(_0x10879c){if(_0x10879c){return _0x10879c?{'count':_0x2df2e5,'rows':_0x10879c}:null;}})['then'](respondWithResult(_0x43f9e4,null))[_0x2f29('0x1d')](handleError(_0x43f9e4,null));};exports[_0x2f29('0xe8')]=function(_0x1cfb76,_0xf8a253){var _0x3de280={};var _0x2618d7={};var _0x3ad84f;var _0x40e68d;return db['User'][_0x2f29('0xd9')]({'where':{'id':_0x1cfb76['params']['id']}})['then'](handleEntityNotFound(_0xf8a253,null))['then'](function(_0x5d59c2){if(_0x5d59c2){_0x3ad84f=_0x5d59c2;_0x2618d7[_0x2f29('0x4f')]=_['keys'](db[_0x2f29('0xe9')][_0x2f29('0x51')]);_0x2618d7['query']=_[_0x2f29('0x50')](_0x1cfb76[_0x2f29('0x40')]);_0x2618d7[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0x2618d7['model'],_0x2618d7[_0x2f29('0x40')]);_0x3de280[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x2618d7[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x1cfb76[_0x2f29('0x40')][_0x2f29('0x55')]));_0x3de280['attributes']=_0x3de280[_0x2f29('0x54')][_0x2f29('0x48')]?_0x3de280[_0x2f29('0x54')]:_0x2618d7[_0x2f29('0x4f')];_0x3de280[_0x2f29('0xce')]=qs['sort'](_0x1cfb76['query']['sort']);_0x3de280[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_[_0x2f29('0xd0')](_0x1cfb76[_0x2f29('0x40')],_0x2618d7[_0x2f29('0x52')]));if(_0x1cfb76[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x3de280[_0x2f29('0x3e')]=_[_0x2f29('0x57')](_0x3de280[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x3de280['attributes'],function(_0x48b6f1){var _0x33d43e={};_0x33d43e[_0x48b6f1]={'$like':'%'+_0x1cfb76[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x33d43e;})});}_0x3de280=_[_0x2f29('0x57')]({},_0x3de280,_0x1cfb76[_0x2f29('0x58')]);return _0x3ad84f[_0x2f29('0xe8')](_0x3de280);}})['then'](function(_0x11e549){if(_0x11e549){_0x40e68d=_0x11e549[_0x2f29('0x48')];if(!_0x1cfb76[_0x2f29('0x40')][_0x2f29('0xd1')](_0x2f29('0xd7'))){_0x3de280[_0x2f29('0x23')]=qs['limit'](_0x1cfb76[_0x2f29('0x40')][_0x2f29('0x23')]);_0x3de280[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x1cfb76[_0x2f29('0x40')][_0x2f29('0x24')]);}return _0x3ad84f[_0x2f29('0xe8')](_0x3de280);}})['then'](function(_0x83aa20){if(_0x83aa20){return _0x83aa20?{'count':_0x40e68d,'rows':_0x83aa20}:null;}})[_0x2f29('0x28')](respondWithResult(_0xf8a253,null))[_0x2f29('0x1d')](handleError(_0xf8a253,null));};exports[_0x2f29('0xea')]=function(_0x44caf4,_0x22ae67){var _0x5cc2e5={};var _0x45a1a0={};var _0x4ad6a0;var _0x3bc124;return db['User'][_0x2f29('0xd9')]({'where':{'id':_0x44caf4[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x22ae67,null))['then'](function(_0xe7af9d){if(_0xe7af9d){_0x4ad6a0=_0xe7af9d;_0x45a1a0[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_0x2f29('0xeb')][_0x2f29('0x51')]);_0x45a1a0['query']=_[_0x2f29('0x50')](_0x44caf4[_0x2f29('0x40')]);_0x45a1a0[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0x45a1a0['model'],_0x45a1a0[_0x2f29('0x40')]);_0x5cc2e5['attributes']=_['intersection'](_0x45a1a0['model'],qs[_0x2f29('0x55')](_0x44caf4[_0x2f29('0x40')][_0x2f29('0x55')]));_0x5cc2e5[_0x2f29('0x54')]=_0x5cc2e5[_0x2f29('0x54')]['length']?_0x5cc2e5[_0x2f29('0x54')]:_0x45a1a0['model'];_0x5cc2e5[_0x2f29('0xce')]=qs['sort'](_0x44caf4[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x5cc2e5[_0x2f29('0x3e')]=qs['filters'](_[_0x2f29('0xd0')](_0x44caf4[_0x2f29('0x40')],_0x45a1a0[_0x2f29('0x52')]));if(_0x44caf4[_0x2f29('0x40')]['filter']){_0x5cc2e5['where']=_[_0x2f29('0x57')](_0x5cc2e5['where'],{'$or':_[_0x2f29('0x30')](_0x5cc2e5[_0x2f29('0x54')],function(_0x458c78){var _0x1af8a2={};_0x1af8a2[_0x458c78]={'$like':'%'+_0x44caf4[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x1af8a2;})});}_0x5cc2e5=_[_0x2f29('0x57')]({},_0x5cc2e5,_0x44caf4[_0x2f29('0x58')]);return _0x4ad6a0[_0x2f29('0xea')](_0x5cc2e5);}})[_0x2f29('0x28')](function(_0x4fe270){if(_0x4fe270){_0x3bc124=_0x4fe270[_0x2f29('0x48')];if(!_0x44caf4['query'][_0x2f29('0xd1')](_0x2f29('0xd7'))){_0x5cc2e5[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x44caf4[_0x2f29('0x40')][_0x2f29('0x23')]);_0x5cc2e5[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x44caf4['query'][_0x2f29('0x24')]);}return _0x4ad6a0[_0x2f29('0xea')](_0x5cc2e5);}})['then'](function(_0x329ee4){if(_0x329ee4){return _0x329ee4?{'count':_0x3bc124,'rows':_0x329ee4}:null;}})[_0x2f29('0x28')](respondWithResult(_0x22ae67,null))[_0x2f29('0x1d')](handleError(_0x22ae67,null));};exports[_0x2f29('0xec')]=function(_0x46ae0f,_0xb80827,_0x34e2be){var _0x8f34bb;var _0x4fb7a0;var _0x408202;var _0x53e5c6=!_[_0x2f29('0x6a')](_0x46ae0f[_0x2f29('0x5e')]['id'])?_0x46ae0f[_0x2f29('0x5e')]['id']:!_[_0x2f29('0x6a')](_0x46ae0f[_0x2f29('0x81')]['id'])?_0x46ae0f['user']['id']:null;return db['User'][_0x2f29('0x34')]({'where':{'id':_0x53e5c6,'role':{'$or':[_0x2f29('0x2b'),_0x2f29('0x81'),_0x2f29('0x2d')]}},'attributes':['id','name',_0x2f29('0xed'),'mobile',_0x2f29('0x33'),'internal',_0x2f29('0xee')]})[_0x2f29('0x28')](function(_0x113975){if(_0x113975){if(_0x113975['role']==='agent'){_0x8f34bb=_0x113975;if(_0x46ae0f[_0x2f29('0x5d')][_0x2f29('0xaa')]){_0x408202=util[_0x2f29('0xab')](_0x2f29('0xef'),_0x8f34bb[_0x46ae0f['body'][_0x2f29('0xaa')]]);}else if(_0x46ae0f['body'][_0x2f29('0xf0')]){_0x408202=util[_0x2f29('0xab')](_0x2f29('0xac'),_0x46ae0f[_0x2f29('0x5d')][_0x2f29('0xf0')]);}else{_0x408202=util[_0x2f29('0xab')]('SIP/%s',_0x8f34bb[_0x2f29('0x35')]);}socket['to'](util[_0x2f29('0xab')](_0x2f29('0xf1'),_0x8f34bb[_0x2f29('0x35')]))[_0x2f29('0xa8')](_0x2f29('0xf2'),{'user':{'id':_0x8f34bb['id'],'name':_0x8f34bb[_0x2f29('0x35')]},'ip':_0x46ae0f['headers'][_0x2f29('0xf3')]||_0x46ae0f[_0x2f29('0xf4')][_0x2f29('0xf5')]||_0x46ae0f['socket'][_0x2f29('0xf5')]||_0x46ae0f[_0x2f29('0xf4')]['socket'][_0x2f29('0xf5')]});return db[_0x2f29('0xae')]['destroy']({'where':{'membername':_0x8f34bb[_0x2f29('0x35')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x2f29('0x94'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x8f34bb){return _0x8f34bb[_0x2f29('0xf6')]({'raw':!![]});}})['then'](function(_0x43730d){if(_0x8f34bb){var _0x325c51=[];if(_0x43730d){_0x4fb7a0=_0x43730d;if(_0x4fb7a0[_0x2f29('0x48')]){for(var _0x5587=0x0;_0x5587<_0x4fb7a0[_0x2f29('0x48')];_0x5587++){_0x325c51['push']({'membername':_0x8f34bb[_0x2f29('0x35')],'UserId':_0x8f34bb['id'],'queue_name':_0x4fb7a0[_0x5587]['name'],'VoiceQueueId':_0x4fb7a0[_0x5587]['id'],'interface':_0x408202,'paused':_0x8f34bb[_0x2f29('0xee')]||![],'penalty':_0x4fb7a0[_0x5587][_0x2f29('0xf7')]||0x0});}return BPromise[_0x2f29('0x8d')](_0x325c51,function(_0x854be8){return db[_0x2f29('0xae')][_0x2f29('0xf8')](_0x854be8);});}}}})[_0x2f29('0x28')](function(){if(_0x8f34bb){return db[_0x2f29('0xf9')][_0x2f29('0x46')]({'where':{'membername':_0x8f34bb[_0x2f29('0x35')],'exitAt':null}});}})[_0x2f29('0x28')](function(_0x4941cb){if(_0x8f34bb){var _0x138990=[];_0x4941cb[_0x2f29('0xfa')](function(_0x5a17d9){_0x138990[_0x2f29('0x45')](_0x5a17d9['update']({'exitAt':moment()[_0x2f29('0xab')](_0x2f29('0xfb'))}));});return BPromise[_0x2f29('0x4d')](_0x138990);}})[_0x2f29('0x28')](function(){if(_0x8f34bb){var _0x4c2eec=[];var _0x48bc16=[];var _0x32524b=utils[_0x2f29('0xfc')]();var _0x40b23d={'membername':_0x8f34bb[_0x2f29('0x35')],'interface':_0x408202,'enterAt':moment()[_0x2f29('0xab')](_0x2f29('0xfb')),'role':_0x8f34bb[_0x2f29('0x33')],'internal':_0x8f34bb['internal']};_0x32524b[_0x2f29('0xfa')](function(_0x4c8e57){_0x4c2eec[_0x2f29('0x45')](_[_0x2f29('0x57')]({'channel':_0x4c8e57,'type':_0x2f29('0xfd'),'data1':_0x46ae0f[_0x2f29('0x5d')][_0x2f29('0xfe')],'data2':_0x408202},_0x40b23d));if(_0x8f34bb[_0x2f29('0xee')]){_0x48bc16[_0x2f29('0x45')](_['merge']({'channel':_0x4c8e57,'type':'PAUSE','data1':_0x2f29('0xff')},_0x40b23d));}});return db[_0x2f29('0xf9')]['bulkCreate'](_0x4c2eec['concat'](_0x48bc16),{'individualHooks':!![]});}})[_0x2f29('0x28')](function(){if(_0x8f34bb){return _0x8f34bb[_0x2f29('0x27')]({'online':!![],'lastLoginAt':moment()[_0x2f29('0xab')](_0x2f29('0xfb')),'voicePause':_0x8f34bb[_0x2f29('0xee')]||![],'mailPause':_0x8f34bb['loginInPause']||![],'chatPause':_0x8f34bb[_0x2f29('0xee')]||![],'faxPause':_0x8f34bb['loginInPause']||![],'smsPause':_0x8f34bb[_0x2f29('0xee')]||![],'openchannelPause':_0x8f34bb[_0x2f29('0xee')]||![],'whatsappPause':_0x8f34bb[_0x2f29('0xee')]||![],'pauseType':_0x8f34bb[_0x2f29('0xee')]?_0x2f29('0xff'):null,'interface':_0x408202,'lastPauseAt':moment()[_0x2f29('0xab')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x2f29('0x28')](function(_0x474249){if(_0x46ae0f[_0x2f29('0x100')]){return _0x34e2be();}else{return BPromise[_0x2f29('0x101')](_0x474249)[_0x2f29('0x28')](respondWithResult(_0xb80827,null));}})[_0x2f29('0x1d')](handleError(_0xb80827,null));};exports[_0x2f29('0x102')]=function(_0xc97cbd,_0x1540c3){var _0x4c2721;return db[_0x2f29('0x3a')][_0x2f29('0x34')]({'where':{'id':_0xc97cbd[_0x2f29('0x5e')]['id'],'role':_0x2f29('0x2d')},'attributes':['id',_0x2f29('0x35'),_0x2f29('0x33')]})[_0x2f29('0x28')](handleEntityNotFound(_0x1540c3,null))[_0x2f29('0x28')](function(_0xa19b87){if(_0xa19b87){_0x4c2721=_0xa19b87;return db['UserVoiceQueueRt'][_0x2f29('0x29')]({'where':{'membername':_0x4c2721[_0x2f29('0x35')]},'individualHooks':!![]});}})[_0x2f29('0x28')](function(){return db[_0x2f29('0xf9')][_0x2f29('0x46')]({'where':{'membername':_0x4c2721[_0x2f29('0x35')],'exitAt':null}});})[_0x2f29('0x28')](function(_0x334abc){var _0x1f5710=[];_0x334abc['forEach'](function(_0x29e552){_0x1f5710[_0x2f29('0x45')](_0x29e552[_0x2f29('0x27')]({'exitAt':moment()['format'](_0x2f29('0xfb'))}));});return BPromise[_0x2f29('0x4d')](_0x1f5710);})[_0x2f29('0x28')](function(){return _0x4c2721[_0x2f29('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2f29('0x28')](respondWithResult(_0x1540c3,null))[_0x2f29('0x1d')](handleError(_0x1540c3,null));};exports['pause']=function(_0x49de18,_0x33e2fa){var _0x29be18;return db['UserVoiceQueueRt'][_0x2f29('0x27')]({'paused':0x1},{'where':{'UserId':_0x49de18['params']['id']},'individualHooks':!![]})[_0x2f29('0x28')](function(){return db[_0x2f29('0x3a')][_0x2f29('0x34')]({'where':{'id':_0x49de18[_0x2f29('0x5e')]['id'],'role':_0x2f29('0x2d')},'attributes':['id',_0x2f29('0x35'),_0x2f29('0x33'),_0x2f29('0x68'),_0x2f29('0xaa')]});})[_0x2f29('0x28')](handleEntityNotFound(_0x33e2fa,null))[_0x2f29('0x28')](function(_0x35d176){if(_0x35d176){_0x29be18=_0x35d176;return respondWithRpcPromise(_0x2f29('0x103'),_0x2f29('0x104'),{'id':_0x29be18['id'],'name':_0x29be18[_0x2f29('0x35')],'pause':!![]});}})[_0x2f29('0x28')](function(){if(_0x29be18){return db[_0x2f29('0xf9')]['findAll']({'where':{'membername':_0x29be18[_0x2f29('0x35')],'type':'PAUSE','exitAt':null}});}})[_0x2f29('0x28')](function(_0x7cb1a1){if(_0x7cb1a1[_0x2f29('0x48')]){var _0x2a594c=moment()[_0x2f29('0xab')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x415dfa=0x0,_0x436ada=_0x7cb1a1[_0x2f29('0x48')];_0x415dfa<_0x436ada;_0x415dfa++){_0x7cb1a1[_0x415dfa][_0x2f29('0x105')]({'exitAt':_0x2a594c});}}})[_0x2f29('0x28')](function(){var _0x46fa12=[];var _0x2f8fb4=utils[_0x2f29('0xfc')]();_0x2f8fb4[_0x2f29('0xfa')](function(_0x1ae721){_0x46fa12[_0x2f29('0x45')]({'channel':_0x1ae721,'membername':_0x29be18[_0x2f29('0x35')],'interface':_[_0x2f29('0x6a')](_0x29be18['interface'])?util['format'](_0x2f29('0xac'),_0x29be18[_0x2f29('0x35')]):_0x29be18[_0x2f29('0xaa')],'type':_0x2f29('0x106'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x49de18[_0x2f29('0x5d')][_0x2f29('0x107')]||_0x2f29('0x108'),'role':_0x29be18[_0x2f29('0x33')],'internal':_0x29be18['internal']});});return db[_0x2f29('0xf9')][_0x2f29('0x8b')](_0x46fa12,{'individualHooks':!![]});})[_0x2f29('0x28')](function(){return _0x29be18['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x49de18['body']['type']||_0x2f29('0x108'),'lastPauseAt':moment()[_0x2f29('0xab')](_0x2f29('0xfb'))});})['then'](respondWithResult(_0x33e2fa,null))[_0x2f29('0x1d')](handleError(_0x33e2fa,null));};exports[_0x2f29('0x109')]=function(_0x4e7d15,_0x20dcf0){var _0xcb62f9;return db[_0x2f29('0x3a')][_0x2f29('0x34')]({'where':{'id':_0x4e7d15['params']['id']},'attributes':['id',_0x2f29('0x35'),_0x2f29('0x33'),'voicePause',_0x2f29('0x10a'),'chatPause',_0x2f29('0x10b'),'openchannelPause',_0x2f29('0x10c'),_0x2f29('0x10d'),_0x2f29('0x10e'),_0x2f29('0x10f')]})['then'](handleEntityNotFound(_0x20dcf0,null))[_0x2f29('0x28')](function(_0x2d480b){if(_0x2d480b){_0xcb62f9=_0x2d480b;if(_0x4e7d15[_0x2f29('0x5d')][_0x2f29('0xb1')]&&!utils[_0x2f29('0xa1')](_0x4e7d15['body'][_0x2f29('0xb1')])){throw new db[(_0x2f29('0x93'))][(_0x2f29('0x94'))](_0x2f29('0xa2'));}switch(_0x4e7d15[_0x2f29('0x5d')]['channel']){case _0x2f29('0xa9'):return respondWithRpcPromise(_0x2f29('0x103'),_0x2f29('0x109'),{'id':_0xcb62f9['id'],'name':_0xcb62f9['name'],'pause':![]})[_0x2f29('0x28')](function(){return db[_0x2f29('0xae')][_0x2f29('0x27')]({'paused':0x0},{'where':{'UserId':_0xcb62f9['id']},'individualHooks':!![]});})[_0x2f29('0x28')](function(){return db[_0x2f29('0xf9')]['find']({'where':{'channel':_0x4e7d15[_0x2f29('0x5d')][_0x2f29('0xb1')],'membername':_0xcb62f9[_0x2f29('0x35')],'type':_0x2f29('0x106'),'exitAt':null}});})['then'](function(_0x316773){if(_0x316773){return _0x316773[_0x2f29('0x27')]({'exitAt':moment()[_0x2f29('0xab')](_0x2f29('0xfb')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){return _0xcb62f9[_0x2f29('0x27')]({'voicePause':![]});});case'mail':case'chat':case _0x2f29('0x4a'):case _0x2f29('0x5b'):case _0x2f29('0x4c'):case'openchannel':return db[_0x2f29('0xf9')]['find']({'where':{'channel':_0x4e7d15[_0x2f29('0x5d')][_0x2f29('0xb1')],'membername':_0xcb62f9[_0x2f29('0x35')],'type':'PAUSE','exitAt':null}})['then'](function(_0x137dee){if(_0x137dee){return _0x137dee[_0x2f29('0x27')]({'exitAt':moment()[_0x2f29('0xab')](_0x2f29('0xfb')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x2f29('0x28')](function(){var _0x5d006e={};_['set'](_0x5d006e,util[_0x2f29('0xab')](_0x2f29('0x110'),_0x4e7d15[_0x2f29('0x5d')]['channel'],_0x2f29('0x111')),![]);return _0xcb62f9['update'](_0x5d006e);});default:return respondWithRpcPromise(_0x2f29('0x103'),_0x2f29('0x109'),{'id':_0xcb62f9['id'],'name':_0xcb62f9[_0x2f29('0x35')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt'][_0x2f29('0x27')]({'paused':0x0},{'where':{'UserId':_0xcb62f9['id']}});})[_0x2f29('0x28')](function(){return db['MemberReport'][_0x2f29('0x46')]({'where':{'membername':_0xcb62f9[_0x2f29('0x35')],'type':'PAUSE','exitAt':null}});})[_0x2f29('0x28')](function(_0x437113){var _0x21e275=[];_0x437113['forEach'](function(_0x4d5dd4){_0x21e275[_0x2f29('0x45')](_0x4d5dd4[_0x2f29('0x27')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'}));});return BPromise['all'](_0x21e275);})[_0x2f29('0x28')](function(){return _0xcb62f9[_0x2f29('0x27')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x20dcf0,null))['catch'](handleError(_0x20dcf0,null));};exports[_0x2f29('0x112')]=function(_0x3dfb02,_0x360ad1){var _0x3b7588={};var _0xc32be5={};var _0xe8b81a;var _0x1c88e5;return db[_0x2f29('0x3a')]['findOne']({'where':{'id':_0x3dfb02['params']['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x360ad1,null))[_0x2f29('0x28')](function(_0x405c6d){if(_0x405c6d){_0xe8b81a=_0x405c6d;_0xc32be5[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_0x2f29('0x113')][_0x2f29('0x51')]);_0xc32be5[_0x2f29('0x40')]=_['keys'](_0x3dfb02[_0x2f29('0x40')]);_0xc32be5['filters']=_[_0x2f29('0x53')](_0xc32be5[_0x2f29('0x4f')],_0xc32be5[_0x2f29('0x40')]);_0x3b7588['attributes']=_[_0x2f29('0x53')](_0xc32be5[_0x2f29('0x4f')],qs[_0x2f29('0x55')](_0x3dfb02['query'][_0x2f29('0x55')]));_0x3b7588[_0x2f29('0x54')]=_0x3b7588['attributes'][_0x2f29('0x48')]?_0x3b7588['attributes']:_0xc32be5[_0x2f29('0x4f')];_0x3b7588[_0x2f29('0xce')]=qs[_0x2f29('0xcf')](_0x3dfb02[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x3b7588[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_[_0x2f29('0xd0')](_0x3dfb02[_0x2f29('0x40')],_0xc32be5[_0x2f29('0x52')]));if(_0x3dfb02[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x3b7588[_0x2f29('0x3e')]=_[_0x2f29('0x57')](_0x3b7588[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x3b7588[_0x2f29('0x54')],function(_0x466433){var _0x4e2e8b={};_0x4e2e8b[_0x466433]={'$like':'%'+_0x3dfb02[_0x2f29('0x40')]['filter']+'%'};return _0x4e2e8b;})});}_0x3b7588=_[_0x2f29('0x57')]({},_0x3b7588,_0x3dfb02[_0x2f29('0x58')]);return _0xe8b81a[_0x2f29('0x112')](_0x3b7588);}})['then'](function(_0x1b1d30){if(_0x1b1d30){_0x1c88e5=_0x1b1d30[_0x2f29('0x48')];if(!_0x3dfb02[_0x2f29('0x40')]['hasOwnProperty'](_0x2f29('0xd7'))){_0x3b7588[_0x2f29('0x23')]=qs['limit'](_0x3dfb02[_0x2f29('0x40')]['limit']);_0x3b7588[_0x2f29('0x24')]=qs[_0x2f29('0x24')](_0x3dfb02[_0x2f29('0x40')][_0x2f29('0x24')]);}return _0xe8b81a['getTeams'](_0x3b7588);}})[_0x2f29('0x28')](function(_0x363def){if(_0x363def){return _0x363def?{'count':_0x1c88e5,'rows':_0x363def}:null;}})[_0x2f29('0x28')](respondWithResult(_0x360ad1,null))['catch'](handleError(_0x360ad1,null));};exports[_0x2f29('0x114')]=function(_0x11571b,_0x53c4dc){return db['User']['find']({'where':{'id':_0x11571b['params']['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x53c4dc,null))[_0x2f29('0x28')](function(_0x304743){if(_0x304743){var _0x4b479a=_0x304743[_0x2f29('0x2a')]({'plain':!![]});return _0x304743[_0x2f29('0x114')](_0x11571b[_0x2f29('0x5d')][_0x2f29('0x61')],_['omit'](_0x11571b[_0x2f29('0x5d')],[_0x2f29('0x61'),'id'])||{})[_0x2f29('0x28')](function(){for(var _0x4bac9c=0x0;_0x4bac9c<_0x11571b[_0x2f29('0x5d')][_0x2f29('0x61')][_0x2f29('0x48')];_0x4bac9c++){var _0x59f842=[];var _0x4b055b={};db['Team'][_0x2f29('0xd9')]({'where':{'id':_0x11571b[_0x2f29('0x5d')][_0x2f29('0x61')][_0x4bac9c]}})[_0x2f29('0x28')](function(_0x2f067e){_0x4b055b=_0x2f067e['dataValues'];_0x59f842[_0x2f29('0x45')](_0x2f067e[_0x2f29('0xf6')]()['then'](function(_0x3dbdc5){for(var _0x514f6c=0x0;_0x514f6c<_0x3dbdc5['length'];_0x514f6c++){_0x3dbdc5[_0x514f6c][_0x2f29('0x115')](_0x2f29('0xb1'),_0x2f29('0x116'));}return _0x3dbdc5;}));_0x59f842[_0x2f29('0x45')](_0x2f067e[_0x2f29('0x117')]()[_0x2f29('0x28')](function(_0x835f53){for(var _0x7eccd8=0x0;_0x7eccd8<_0x835f53[_0x2f29('0x48')];_0x7eccd8++){_0x835f53[_0x7eccd8][_0x2f29('0x115')]('channel','Chat');}return _0x835f53;}));_0x59f842[_0x2f29('0x45')](_0x2f067e[_0x2f29('0x118')]()[_0x2f29('0x28')](function(_0x1b768e){for(var _0x791c31=0x0;_0x791c31<_0x1b768e[_0x2f29('0x48')];_0x791c31++){_0x1b768e[_0x791c31][_0x2f29('0x115')](_0x2f29('0xb1'),'Mail');}return _0x1b768e;}));_0x59f842[_0x2f29('0x45')](_0x2f067e[_0x2f29('0x119')]()['then'](function(_0x468606){for(var _0x1ec6ad=0x0;_0x1ec6ad<_0x468606[_0x2f29('0x48')];_0x1ec6ad++){_0x468606[_0x1ec6ad]['setDataValue'](_0x2f29('0xb1'),_0x2f29('0x11a'));}return _0x468606;}));_0x59f842[_0x2f29('0x45')](_0x2f067e['getWhatsappQueues']()['then'](function(_0x4e38c4){for(var _0x5c59e3=0x0;_0x5c59e3<_0x4e38c4[_0x2f29('0x48')];_0x5c59e3++){_0x4e38c4[_0x5c59e3][_0x2f29('0x115')](_0x2f29('0xb1'),_0x2f29('0x11b'));}return _0x4e38c4;}));_0x59f842[_0x2f29('0x45')](_0x2f067e[_0x2f29('0x11c')]()['then'](function(_0x18a036){for(var _0x57e448=0x0;_0x57e448<_0x18a036['length'];_0x57e448++){_0x18a036[_0x57e448]['setDataValue'](_0x2f29('0xb1'),_0x2f29('0x11d'));}return _0x18a036;}));_0x59f842[_0x2f29('0x45')](_0x2f067e[_0x2f29('0x11e')]()['then'](function(_0x3b1281){for(var _0x3d0863=0x0;_0x3d0863<_0x3b1281[_0x2f29('0x48')];_0x3d0863++){_0x3b1281[_0x3d0863]['setDataValue']('channel',_0x2f29('0x11f'));}return _0x3b1281;}));return BPromise[_0x2f29('0x4d')](_0x59f842);})[_0x2f29('0x28')](function(_0x510b78){var _0x2e7ce9=_[_0x2f29('0x120')](_0x510b78);_0x59f842=[];return db[_0x2f29('0x6b')][_0x2f29('0x121')](function(_0x3ba804){for(var _0x4e15af=0x0;_0x4e15af<_0x2e7ce9[_0x2f29('0x48')];_0x4e15af++){_0x59f842[_0x2f29('0x45')](_0x2e7ce9[_0x4e15af][_0x2f29('0x122')](_0x4b479a['id']),{'transaction':_0x3ba804});}return BPromise[_0x2f29('0x4d')](_0x59f842)[_0x2f29('0x28')](function(){if(_0x4b479a[_0x2f29('0x9f')]){return BPromise[_0x2f29('0x8d')](_['filter'](_0x2e7ce9,function(_0x41a562){return _0x41a562[_0x2f29('0x123')](_0x2f29('0xb1'))===_0x2f29('0x116');}),function(_0x3243e2){return db['UserVoiceQueueRt'][_0x2f29('0xf8')]({'membername':_0x4b479a[_0x2f29('0x35')],'UserId':_0x4b479a['id'],'queue_name':_0x3243e2[_0x2f29('0x35')],'VoiceQueueId':_0x3243e2['id'],'interface':_[_0x2f29('0x6a')](_0x4b479a[_0x2f29('0xaa')])?util[_0x2f29('0xab')]('SIP/%s',_0x4b479a['name']):_0x4b479a[_0x2f29('0xaa')],'paused':_0x4b479a['voicePause']||![],'penalty':_0x4b479a[_0x2f29('0xad')]},{'transaction':_0x3ba804});});}else{return;}})[_0x2f29('0x28')](function(){for(var _0x4a508e=0x0;_0x4a508e<_0x2e7ce9[_0x2f29('0x48')];_0x4a508e++){var _0x3552f2=_0x2e7ce9[_0x4a508e][_0x2f29('0x123')](_0x2f29('0xb1'));var _0x1046df=_0x3552f2+'QueueId';socket['emit']('user'+_0x3552f2+_0x2f29('0x124'),{'UserId':_0x4b479a['id'],['queueField']:_0x2e7ce9[_0x4a508e]['id']});}});});})[_0x2f29('0x28')](function(){db[_0x2f29('0x125')][_0x2f29('0xd9')]({'where':{'teamId':_0x4b055b['id']}})[_0x2f29('0x28')](function(_0x2d5ce6){if(_0x2d5ce6){db[_0x2f29('0x126')][_0x2f29('0x80')]({'UserId':_0x11571b[_0x2f29('0x5e')]['id'],'VoicePrefixId':_0x2d5ce6[_0x2f29('0x127')]});}});});}});}})[_0x2f29('0x28')](respondWithStatusCode(_0x53c4dc,null))[_0x2f29('0x1d')](handleError(_0x53c4dc,null));};exports[_0x2f29('0x128')]=function(_0x29a8dd,_0x16a986){return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x29a8dd[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x16a986,null))[_0x2f29('0x28')](function(_0x82ffa0){if(_0x82ffa0){var _0x1d4998=_0x82ffa0[_0x2f29('0x2a')]({'plain':!![]});var _0x3b3da6=_0x29a8dd[_0x2f29('0x40')][_0x2f29('0x61')];return _0x82ffa0[_0x2f29('0x128')](_0x3b3da6)[_0x2f29('0x28')](function(){for(var _0x21bce9=0x0;_0x21bce9<_0x3b3da6[_0x2f29('0x48')];_0x21bce9++){var _0x34886f=[];var _0x48ce47={};db['Team']['findOne']({'where':{'id':_0x3b3da6[_0x21bce9]}})['then'](function(_0x5c81c7){_0x48ce47=_0x5c81c7['dataValues'];_0x34886f[_0x2f29('0x45')](_0x5c81c7[_0x2f29('0xf6')]()[_0x2f29('0x28')](function(_0x232782){for(var _0x1f93d7=0x0;_0x1f93d7<_0x232782[_0x2f29('0x48')];_0x1f93d7++){_0x232782[_0x1f93d7][_0x2f29('0x115')](_0x2f29('0xb1'),_0x2f29('0x116'));}return _0x232782;}));_0x34886f[_0x2f29('0x45')](_0x5c81c7[_0x2f29('0x117')]()['then'](function(_0x2ffd77){for(var _0x194ed0=0x0;_0x194ed0<_0x2ffd77['length'];_0x194ed0++){_0x2ffd77[_0x194ed0][_0x2f29('0x115')](_0x2f29('0xb1'),'Chat');}return _0x2ffd77;}));_0x34886f[_0x2f29('0x45')](_0x5c81c7[_0x2f29('0x118')]()['then'](function(_0x5b456b){for(var _0x4d8d68=0x0;_0x4d8d68<_0x5b456b[_0x2f29('0x48')];_0x4d8d68++){_0x5b456b[_0x4d8d68][_0x2f29('0x115')](_0x2f29('0xb1'),_0x2f29('0x129'));}return _0x5b456b;}));_0x34886f['push'](_0x5c81c7[_0x2f29('0x119')]()['then'](function(_0x263e70){for(var _0x5c8532=0x0;_0x5c8532<_0x263e70['length'];_0x5c8532++){_0x263e70[_0x5c8532][_0x2f29('0x115')](_0x2f29('0xb1'),_0x2f29('0x11a'));}return _0x263e70;}));_0x34886f[_0x2f29('0x45')](_0x5c81c7['getWhatsappQueues']()['then'](function(_0x3fe722){for(var _0xe677dd=0x0;_0xe677dd<_0x3fe722['length'];_0xe677dd++){_0x3fe722[_0xe677dd][_0x2f29('0x115')](_0x2f29('0xb1'),_0x2f29('0x11b'));}return _0x3fe722;}));_0x34886f[_0x2f29('0x45')](_0x5c81c7[_0x2f29('0x11c')]()['then'](function(_0x270026){for(var _0x5ea86c=0x0;_0x5ea86c<_0x270026['length'];_0x5ea86c++){_0x270026[_0x5ea86c][_0x2f29('0x115')](_0x2f29('0xb1'),'Fax');}return _0x270026;}));_0x34886f['push'](_0x5c81c7[_0x2f29('0x11e')]()[_0x2f29('0x28')](function(_0x5382b8){for(var _0x5d416a=0x0;_0x5d416a<_0x5382b8[_0x2f29('0x48')];_0x5d416a++){_0x5382b8[_0x5d416a][_0x2f29('0x115')]('channel',_0x2f29('0x11f'));}return _0x5382b8;}));return BPromise['all'](_0x34886f);})['then'](function(_0x4f9e63){var _0x4e4899=_['flatten'](_0x4f9e63);_0x34886f=[];return db['sequelize'][_0x2f29('0x121')](function(_0x3562a5){for(var _0x7b29cd=0x0;_0x7b29cd<_0x4e4899[_0x2f29('0x48')];_0x7b29cd++){_0x34886f[_0x2f29('0x45')](_0x4e4899[_0x7b29cd][_0x2f29('0x12a')](_0x1d4998['id']),{'transaction':_0x3562a5});}return BPromise[_0x2f29('0x4d')](_0x34886f)[_0x2f29('0x28')](function(){if(_0x1d4998['online']){return BPromise[_0x2f29('0x8d')](_[_0x2f29('0x2f')](_0x4e4899,function(_0x43c461){return _0x43c461['getDataValue'](_0x2f29('0xb1'))===_0x2f29('0x116');}),function(_0x281622){return db[_0x2f29('0xae')][_0x2f29('0x29')]({'where':{'VoiceQueueId':_0x281622['id'],'UserId':_0x1d4998['id']},'transaction':_0x3562a5});});}else{return;}})['then'](function(){db[_0x2f29('0x125')][_0x2f29('0xd9')]({'where':{'teamId':_0x48ce47['id']}})[_0x2f29('0x28')](function(_0xdb60f6){if(_0xdb60f6){return db[_0x2f29('0x126')]['destroy']({'where':{'UserId':_0x1d4998['id'],'VoicePrefixId':_0xdb60f6[_0x2f29('0x49')][_0x2f29('0x127')]}});}});})['then'](function(){for(var _0x1ab689=0x0;_0x1ab689<_0x4e4899['length'];_0x1ab689++){var _0x1eba5f=_0x4e4899[_0x1ab689]['getDataValue']('channel');var _0x2777a6=_0x1eba5f+_0x2f29('0xb3');socket[_0x2f29('0xa8')](_0x2f29('0x81')+_0x1eba5f+_0x2f29('0xb4'),{'UserId':_0x1d4998['id'],['queueField']:_0x4e4899[_0x1ab689]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x16a986,null))['catch'](handleError(_0x16a986,null));};exports[_0x2f29('0x12b')]=function(_0x5957fe,_0x2bd535){var _0x3853c5={};var _0x21f6a8={};var _0x40964c;var _0x4a4bab;return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x5957fe[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0x2bd535,null))['then'](function(_0x2dc344){if(_0x2dc344){_0x40964c=_0x2dc344;_0x21f6a8[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_0x2f29('0xd2')][_0x2f29('0x51')]);_0x21f6a8['query']=_['keys'](_0x5957fe['query']);_0x21f6a8[_0x2f29('0x52')]=_['intersection'](_0x21f6a8[_0x2f29('0x4f')],_0x21f6a8[_0x2f29('0x40')]);_0x3853c5[_0x2f29('0x54')]=_['intersection'](_0x21f6a8['model'],qs[_0x2f29('0x55')](_0x5957fe['query'][_0x2f29('0x55')]));_0x3853c5[_0x2f29('0x54')]=_0x3853c5[_0x2f29('0x54')][_0x2f29('0x48')]?_0x3853c5[_0x2f29('0x54')]:_0x21f6a8['model'];_0x3853c5[_0x2f29('0xce')]=qs['sort'](_0x5957fe[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x3853c5[_0x2f29('0x3e')]=qs[_0x2f29('0x52')](_['pick'](_0x5957fe[_0x2f29('0x40')],_0x21f6a8[_0x2f29('0x52')]));if(_0x5957fe[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x3853c5['where']=_[_0x2f29('0x57')](_0x3853c5[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x3853c5[_0x2f29('0x54')],function(_0x5bbaa1){var _0x31bbac={};_0x31bbac[_0x5bbaa1]={'$like':'%'+_0x5957fe[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x31bbac;})});}_0x3853c5=_[_0x2f29('0x57')]({},_0x3853c5,_0x5957fe[_0x2f29('0x58')]);return _0x40964c[_0x2f29('0x12b')](_0x3853c5);}})['then'](function(_0x46326e){if(_0x46326e){_0x4a4bab=_0x46326e['length'];if(!_0x5957fe[_0x2f29('0x40')][_0x2f29('0xd1')]('nolimit')){_0x3853c5[_0x2f29('0x23')]=qs[_0x2f29('0x23')](_0x5957fe[_0x2f29('0x40')][_0x2f29('0x23')]);_0x3853c5['offset']=qs[_0x2f29('0x24')](_0x5957fe[_0x2f29('0x40')][_0x2f29('0x24')]);}return _0x40964c['getLists'](_0x3853c5);}})['then'](function(_0x336b6a){if(_0x336b6a){return _0x336b6a?{'count':_0x4a4bab,'rows':_0x336b6a}:null;}})[_0x2f29('0x28')](respondWithResult(_0x2bd535,null))[_0x2f29('0x1d')](handleError(_0x2bd535,null));};exports[_0x2f29('0x12c')]=function(_0x513522,_0xbaa40e){var _0x142277={};var _0x1476ee={};var _0x58c416;return db[_0x2f29('0x3a')][_0x2f29('0xd9')]({'where':{'id':_0x513522[_0x2f29('0x5e')]['id']}})[_0x2f29('0x28')](handleEntityNotFound(_0xbaa40e,null))[_0x2f29('0x28')](function(_0x485ff0){if(_0x485ff0){_0x58c416=_0x485ff0;_0x1476ee[_0x2f29('0x4f')]=_[_0x2f29('0x50')](db[_0x2f29('0x3a')][_0x2f29('0x51')]);_0x1476ee['query']=_[_0x2f29('0x50')](_0x513522[_0x2f29('0x40')]);_0x1476ee[_0x2f29('0x52')]=_[_0x2f29('0x53')](_0x1476ee['model'],_0x1476ee[_0x2f29('0x40')]);_0x142277[_0x2f29('0x54')]=_[_0x2f29('0x53')](_0x1476ee['model'],qs[_0x2f29('0x55')](_0x513522[_0x2f29('0x40')][_0x2f29('0x55')]));_0x142277[_0x2f29('0x54')]=_0x142277['attributes'][_0x2f29('0x48')]?_0x142277['attributes']:_0x1476ee[_0x2f29('0x4f')];_0x142277[_0x2f29('0xce')]=qs[_0x2f29('0xcf')](_0x513522[_0x2f29('0x40')][_0x2f29('0xcf')]);_0x142277[_0x2f29('0x3e')]=qs['filters'](_[_0x2f29('0xd0')](_0x513522[_0x2f29('0x40')],_0x1476ee[_0x2f29('0x52')]));if(_0x513522[_0x2f29('0x40')][_0x2f29('0x2f')]){_0x142277[_0x2f29('0x3e')]=_[_0x2f29('0x57')](_0x142277[_0x2f29('0x3e')],{'$or':_[_0x2f29('0x30')](_0x142277['attributes'],function(_0x17d586){var _0x30f14c={};_0x30f14c[_0x17d586]={'$like':'%'+_0x513522[_0x2f29('0x40')][_0x2f29('0x2f')]+'%'};return _0x30f14c;})});}_0x142277[_0x2f29('0x4f')]=db['User'];_0x142277['as']='Agents';_0x142277=_[_0x2f29('0x57')]({},_0x142277,_0x513522[_0x2f29('0x58')]);return _0x58c416[_0x2f29('0xf6')]({'include':[_0x142277]});}})['then'](function(_0x32bcae){if(_0x32bcae){var _0x2cc6e9={},_0x1c0b07=[];for(var _0x439362=0x0;_0x439362<_0x32bcae['length'];_0x439362+=0x1){for(var _0x4a950c=0x0,_0x10948e;_0x4a950c<_0x32bcae[_0x439362][_0x2f29('0x2c')][_0x2f29('0x48')];_0x4a950c+=0x1){_0x10948e=_0x32bcae[_0x439362][_0x2f29('0x2c')][_0x4a950c]['get']({'plain':!![]});_0x2cc6e9[_0x10948e['id']]=_0x10948e;}}_0x2cc6e9=_['values'](_0x2cc6e9);for(var _0x28c23b=qs[_0x2f29('0x24')](_0x513522[_0x2f29('0x40')]['offset']);_0x28c23b<_0x2cc6e9[_0x2f29('0x48')]&&_0x1c0b07['length']=_0x3e6e30[_0x544b('0x53')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x544b('0x11')](function(){if(_0x5bdb48){return db['UserVoiceQueueRt'][_0x544b('0x4a')]({'where':{'membername':_0x5bdb48[_0x544b('0x2e')]},'individualHooks':!![]});}})[_0x544b('0x11')](function(){if(_0x5bdb48){return _0x5bdb48['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x688810){if(_0x5bdb48){if(_0x688810){var _0x297a60=[];_0x2008cd=_0x688810;if(_0x2008cd[_0x544b('0x31')]){for(var _0x1c4123=0x0;_0x1c4123<_0x2008cd['length'];_0x1c4123++){_0x297a60[_0x544b('0x34')](db[_0x544b('0x43')][_0x544b('0x54')]({'membername':_0x5bdb48[_0x544b('0x2e')],'UserId':_0x5bdb48['id'],'queue_name':_0x2008cd[_0x1c4123][_0x544b('0x2e')],'VoiceQueueId':_0x2008cd[_0x1c4123]['id'],'interface':_0x2b1c2d,'paused':_0x5bdb48[_0x544b('0x4f')]||![],'penalty':_0x2008cd[_0x1c4123]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x544b('0x4b')](_0x297a60);}}}})['then'](function(){if(_0x5bdb48){return db[_0x544b('0x2d')][_0x544b('0x1f')]({'where':{'membername':_0x5bdb48['name'],'exitAt':null}});}})[_0x544b('0x11')](function(_0x1ea211){if(_0x5bdb48){if(_0x1ea211&&_0x1ea211[_0x544b('0x31')]){var _0x226abc=[];_0x1ea211['forEach'](function(_0x4b82d9){_0x226abc[_0x544b('0x34')](_0x4b82d9[_0x544b('0x2c')]({'exitAt':moment()[_0x544b('0x30')](_0x544b('0x38'))}));});return BPromise[_0x544b('0x4b')](_0x226abc);}}})['then'](function(_0x3e997c){if(_0x5bdb48){var _0x5e8cf4=[];var _0x1b5d66=[];var _0x19f124=utils[_0x544b('0x33')]();var _0x8a2ada={'membername':_0x5bdb48[_0x544b('0x2e')],'interface':_0x2b1c2d,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5bdb48[_0x544b('0x2a')],'internal':_0x5bdb48[_0x544b('0x2b')]};_0x19f124[_0x544b('0x49')](function(_0x3fb554){_0x5e8cf4['push'](_['merge']({'channel':_0x3fb554,'type':_0x544b('0x55'),'data1':'callysquare','data2':_0x2b1c2d},_0x8a2ada));if(_0x5bdb48[_0x544b('0x4f')]){_0x1b5d66[_0x544b('0x34')](_['merge']({'channel':_0x3fb554,'type':_0x544b('0x2f'),'data1':'LOGININPAUSE'},_0x8a2ada));}});return db['MemberReport'][_0x544b('0x3d')](_0x5e8cf4['concat'](_0x1b5d66),{'individualHooks':!![]});}})['then'](function(){if(_0x5bdb48){return _0x5bdb48[_0x544b('0x2c')]({'online':!![],'lastLoginAt':moment()[_0x544b('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5bdb48[_0x544b('0x4f')]||![],'mailPause':_0x5bdb48['loginInPause']||![],'chatPause':_0x5bdb48[_0x544b('0x4f')]||![],'faxPause':_0x5bdb48[_0x544b('0x4f')]||![],'smsPause':_0x5bdb48['loginInPause']||![],'openchannelPause':_0x5bdb48[_0x544b('0x4f')]||![],'pauseType':_0x5bdb48[_0x544b('0x4f')]?_0x544b('0x56'):null,'lastPauseAt':moment()['format'](_0x544b('0x38')),'interface':_0x2b1c2d});}})['then'](function(_0x51cb47){_0x2f8bb8(_0x51cb47);})[_0x544b('0x1c')](function(_0x329e07){_0x1813f1(_0x2263c3['error'](0x1f4,_0x329e07['message']));});});}; \ No newline at end of file +var _0xf3d5=['findAll','options','where','attributes','include','map','model','then','debug','catch','ShowUser','User','raw','find','name','role','internal','interface','UserVoiceQueueRt','MemberReport','PAUSE','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','forEach','isNil','format','SIP/%s','body','DEFAULT\x20PAUSE','uniqueid','update','type','UnpauseUser','channel','voice','system','mail','chat','fax','sms','openchannel','set','Pause','all','LogoutUser','destroy','push','LoginUser','findOne','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','concat','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','info','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','User,\x20%s,\x20%s','message','result','GetUser'];(function(_0x3ad4a5,_0x519fe9){var _0x1b5e19=function(_0x311898){while(--_0x311898){_0x3ad4a5['push'](_0x3ad4a5['shift']());}};_0x1b5e19(++_0x519fe9);}(_0xf3d5,0xa1));var _0x5f3d=function(_0x40837c,_0x3bb3b7){_0x40837c=_0x40837c-0x0;var _0x4e815b=_0xf3d5[_0x40837c];return _0x4e815b;};'use strict';var _=require(_0x5f3d('0x0'));var util=require(_0x5f3d('0x1'));var moment=require(_0x5f3d('0x2'));var BPromise=require(_0x5f3d('0x3'));var rs=require(_0x5f3d('0x4'));var fs=require('fs');var Redis=require(_0x5f3d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f3d('0x6'));var logger=require(_0x5f3d('0x7'))(_0x5f3d('0x8'));var config=require('../../config/environment');var jayson=require(_0x5f3d('0x9'));var client=jayson[_0x5f3d('0xa')]['http']({'port':0x232a});config[_0x5f3d('0xb')]=_['defaults'](config[_0x5f3d('0xb')],{'host':_0x5f3d('0xc'),'port':0x18eb});var socket=require(_0x5f3d('0xd'))(new Redis(config[_0x5f3d('0xb')]));require('./user.socket')[_0x5f3d('0xe')](socket);function respondWithRpcPromise(_0xbb70c2,_0x286e57,_0x186cef){return new BPromise(function(_0x226d37,_0xd95a1f){return client[_0x5f3d('0xf')](_0xbb70c2,_0x186cef)['then'](function(_0x20d071){logger[_0x5f3d('0x10')]('User,\x20%s,\x20%s',_0x286e57,_0x5f3d('0x11'));logger['debug'](_0x5f3d('0x12'),_0x286e57,_0x5f3d('0x11'),JSON[_0x5f3d('0x13')](_0x20d071));if(_0x20d071[_0x5f3d('0x14')]){if(_0x20d071['error']['code']===0x1f4){logger[_0x5f3d('0x14')](_0x5f3d('0x15'),_0x286e57,_0x20d071[_0x5f3d('0x14')]['message']);return _0xd95a1f(_0x20d071['error'][_0x5f3d('0x16')]);}logger[_0x5f3d('0x14')](_0x5f3d('0x15'),_0x286e57,_0x20d071[_0x5f3d('0x14')][_0x5f3d('0x16')]);return _0x226d37(_0x20d071['error'][_0x5f3d('0x16')]);}else{logger[_0x5f3d('0x10')]('User,\x20%s,\x20%s',_0x286e57,_0x5f3d('0x11'));_0x226d37(_0x20d071[_0x5f3d('0x17')][_0x5f3d('0x16')]);}})['catch'](function(_0xac70fb){logger[_0x5f3d('0x14')](_0x5f3d('0x15'),_0x286e57,_0xac70fb);_0xd95a1f(_0xac70fb);});});}exports[_0x5f3d('0x18')]=function(_0x1128cf){var _0x3990e3=this;return new Promise(function(_0x5aece3,_0x1308ca){return db['User'][_0x5f3d('0x19')]({'raw':_0x1128cf['options']?_0x1128cf[_0x5f3d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1128cf[_0x5f3d('0x1a')]?_0x1128cf['options'][_0x5f3d('0x1b')]||null:null,'attributes':_0x1128cf[_0x5f3d('0x1a')]?_0x1128cf[_0x5f3d('0x1a')][_0x5f3d('0x1c')]||null:null,'limit':_0x1128cf[_0x5f3d('0x1a')]?_0x1128cf[_0x5f3d('0x1a')]['limit']||null:null,'include':_0x1128cf['options']?_0x1128cf[_0x5f3d('0x1a')][_0x5f3d('0x1d')]?_[_0x5f3d('0x1e')](_0x1128cf['options']['include'],function(_0x388393){return{'model':db[_0x388393[_0x5f3d('0x1f')]],'as':_0x388393['as'],'attributes':_0x388393['attributes'],'include':_0x388393[_0x5f3d('0x1d')]?_['map'](_0x388393[_0x5f3d('0x1d')],function(_0x4dafb4){return{'model':db[_0x4dafb4[_0x5f3d('0x1f')]],'as':_0x4dafb4['as'],'attributes':_0x4dafb4['attributes'],'include':_0x4dafb4['include']?_[_0x5f3d('0x1e')](_0x4dafb4['include'],function(_0x38d1eb){return{'model':db[_0x38d1eb[_0x5f3d('0x1f')]],'as':_0x38d1eb['as'],'attributes':_0x38d1eb['attributes']};}):[]};}):[]};}):[]:[]})[_0x5f3d('0x20')](function(_0x113e52){logger['info'](_0x5f3d('0x18'),_0x1128cf);logger[_0x5f3d('0x21')](_0x5f3d('0x18'),_0x1128cf,JSON['stringify'](_0x113e52));_0x5aece3(_0x113e52);})[_0x5f3d('0x22')](function(_0x21efa2){logger[_0x5f3d('0x14')](_0x5f3d('0x18'),_0x21efa2['message'],_0x1128cf);_0x1308ca(_0x3990e3[_0x5f3d('0x14')](0x1f4,_0x21efa2[_0x5f3d('0x16')]));});});};exports[_0x5f3d('0x23')]=function(_0x2f0e0e){var _0x2a73f8=this;return new Promise(function(_0x12e8b1,_0x51f5e4){return db[_0x5f3d('0x24')]['find']({'raw':_0x2f0e0e[_0x5f3d('0x1a')]?_0x2f0e0e[_0x5f3d('0x1a')][_0x5f3d('0x25')]===undefined?!![]:![]:!![],'where':_0x2f0e0e[_0x5f3d('0x1a')]?_0x2f0e0e[_0x5f3d('0x1a')]['where']||null:null,'attributes':_0x2f0e0e[_0x5f3d('0x1a')]?_0x2f0e0e[_0x5f3d('0x1a')][_0x5f3d('0x1c')]||null:null,'include':_0x2f0e0e['options']?_0x2f0e0e[_0x5f3d('0x1a')]['include']?_[_0x5f3d('0x1e')](_0x2f0e0e['options'][_0x5f3d('0x1d')],function(_0x39a77b){return{'model':db[_0x39a77b['model']],'as':_0x39a77b['as'],'attributes':_0x39a77b['attributes'],'include':_0x39a77b[_0x5f3d('0x1d')]?_[_0x5f3d('0x1e')](_0x39a77b[_0x5f3d('0x1d')],function(_0x512ea3){return{'model':db[_0x512ea3[_0x5f3d('0x1f')]],'as':_0x512ea3['as'],'attributes':_0x512ea3[_0x5f3d('0x1c')],'include':_0x512ea3[_0x5f3d('0x1d')]?_['map'](_0x512ea3['include'],function(_0x10168d){return{'model':db[_0x10168d['model']],'as':_0x10168d['as'],'attributes':_0x10168d[_0x5f3d('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49b17f){logger['info'](_0x5f3d('0x23'),_0x2f0e0e);logger[_0x5f3d('0x21')](_0x5f3d('0x23'),_0x2f0e0e,JSON[_0x5f3d('0x13')](_0x49b17f));_0x12e8b1(_0x49b17f);})[_0x5f3d('0x22')](function(_0x4280bd){logger[_0x5f3d('0x14')](_0x5f3d('0x23'),_0x4280bd['message'],_0x2f0e0e);_0x51f5e4(_0x2a73f8[_0x5f3d('0x14')](0x1f4,_0x4280bd['message']));});});};exports['PauseUser']=function(_0x4ffadc){var _0x309938=this;return new Promise(function(_0xeb2e6d,_0x4dba7d){var _0x5c41bf;return db['User'][_0x5f3d('0x26')]({'where':_0x4ffadc[_0x5f3d('0x1a')][_0x5f3d('0x1b')]||{},'attributes':['id',_0x5f3d('0x27'),_0x5f3d('0x28'),_0x5f3d('0x29'),_0x5f3d('0x2a')]})['then'](function(_0x3b070c){if(_0x3b070c){_0x5c41bf=_0x3b070c;return db[_0x5f3d('0x2b')]['update']({'paused':0x1},{'where':{'UserId':_0x5c41bf['id']},'individualHooks':!![]});}})[_0x5f3d('0x20')](function(){if(_0x5c41bf){return db[_0x5f3d('0x2c')]['findAll']({'where':{'membername':_0x5c41bf[_0x5f3d('0x27')],'type':_0x5f3d('0x2d'),'exitAt':null}});}})[_0x5f3d('0x20')](function(_0x1bdc0a){if(_0x5c41bf){if(_0x1bdc0a&&_0x1bdc0a['length']){var _0x51ed9e=moment()['format'](_0x5f3d('0x2e'));for(var _0x4aa159=0x0,_0x3e2519=_0x1bdc0a[_0x5f3d('0x2f')];_0x4aa159<_0x3e2519;_0x4aa159++){_0x1bdc0a[_0x4aa159][_0x5f3d('0x30')]({'exitAt':_0x51ed9e});}}}})['then'](function(){if(_0x5c41bf){var _0x493044=[];var _0x296c87=utils[_0x5f3d('0x31')]();_0x296c87[_0x5f3d('0x32')](function(_0x117d10){_0x493044['push']({'channel':_0x117d10,'membername':_0x5c41bf[_0x5f3d('0x27')],'interface':_[_0x5f3d('0x33')](_0x5c41bf[_0x5f3d('0x2a')])?util[_0x5f3d('0x34')](_0x5f3d('0x35'),_0x5c41bf[_0x5f3d('0x27')]):_0x5c41bf[_0x5f3d('0x2a')],'type':'PAUSE','enterAt':moment()['format'](_0x5f3d('0x2e')),'data1':_0x4ffadc[_0x5f3d('0x36')]['type']||_0x5f3d('0x37'),'role':_0x5c41bf['role'],'internal':_0x5c41bf[_0x5f3d('0x29')],'uniqueid':_0x4ffadc[_0x5f3d('0x36')][_0x5f3d('0x38')]||null});});return db[_0x5f3d('0x2c')]['bulkCreate'](_0x493044,{'individualHooks':!![]});}})[_0x5f3d('0x20')](function(){if(_0x5c41bf){return _0x5c41bf[_0x5f3d('0x39')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4ffadc[_0x5f3d('0x36')][_0x5f3d('0x3a')]||_0x5f3d('0x37'),'lastPauseAt':moment()['format'](_0x5f3d('0x2e'))});}})[_0x5f3d('0x20')](function(_0xe1210e){_0xeb2e6d(_0xe1210e);})[_0x5f3d('0x22')](function(_0x4d23f4){_0x4dba7d(_0x309938['error'](0x1f4,_0x4d23f4[_0x5f3d('0x16')]));});});};exports[_0x5f3d('0x3b')]=function(_0x440ab1){var _0x1168a5=this;return new Promise(function(_0x560937,_0xc48835){var _0x27bf20;return db[_0x5f3d('0x24')]['findOne']({'where':_0x440ab1['options'][_0x5f3d('0x1b')]||{},'attributes':['id',_0x5f3d('0x27')]})[_0x5f3d('0x20')](function(_0x33c8e9){if(_0x33c8e9){_0x27bf20=_0x33c8e9;if(_0x440ab1[_0x5f3d('0x36')][_0x5f3d('0x3c')]&&!utils['isValidChannel'](_0x440ab1[_0x5f3d('0x36')][_0x5f3d('0x3c')])){throw new Error('Unknown\x20channel');}switch(_0x440ab1['body'][_0x5f3d('0x3c')]){case _0x5f3d('0x3d'):return db[_0x5f3d('0x2b')][_0x5f3d('0x39')]({'paused':0x0},{'where':{'UserId':_0x27bf20['id']}})[_0x5f3d('0x20')](function(){return db[_0x5f3d('0x2c')][_0x5f3d('0x26')]({'where':{'channel':_0x440ab1[_0x5f3d('0x36')][_0x5f3d('0x3c')],'membername':_0x27bf20['name'],'type':'PAUSE','exitAt':null}});})[_0x5f3d('0x20')](function(_0x5e3ec2){if(_0x5e3ec2){return _0x5e3ec2[_0x5f3d('0x39')]({'exitAt':moment()[_0x5f3d('0x34')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x5f3d('0x3e')},{'individualHooks':!![]});}return null;})[_0x5f3d('0x20')](function(){return _0x27bf20[_0x5f3d('0x39')]({'voicePause':![]});});case _0x5f3d('0x3f'):case _0x5f3d('0x40'):case _0x5f3d('0x41'):case _0x5f3d('0x42'):case _0x5f3d('0x43'):case'whatsapp':return db[_0x5f3d('0x2c')][_0x5f3d('0x26')]({'where':{'channel':_0x440ab1['body'][_0x5f3d('0x3c')],'membername':_0x27bf20['name'],'type':_0x5f3d('0x2d'),'exitAt':null}})[_0x5f3d('0x20')](function(_0x5434f1){return _0x5434f1[_0x5f3d('0x39')]({'exitAt':moment()[_0x5f3d('0x34')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x5f3d('0x3e')},{'individualHooks':!![]});})[_0x5f3d('0x20')](function(){var _0x2884b0={};_[_0x5f3d('0x44')](_0x2884b0,util[_0x5f3d('0x34')]('%s%s',_0x440ab1[_0x5f3d('0x36')][_0x5f3d('0x3c')],_0x5f3d('0x45')),![]);return _0x27bf20['update'](_0x2884b0);});default:return db[_0x5f3d('0x2b')][_0x5f3d('0x39')]({'paused':0x0},{'where':{'UserId':_0x27bf20['id']}})[_0x5f3d('0x20')](function(){return db[_0x5f3d('0x2c')][_0x5f3d('0x19')]({'where':{'membername':_0x27bf20[_0x5f3d('0x27')],'type':_0x5f3d('0x2d'),'exitAt':null}});})[_0x5f3d('0x20')](function(_0x47fce6){var _0x2598fc=[];_0x47fce6['forEach'](function(_0x475a09){_0x2598fc['push'](_0x475a09[_0x5f3d('0x39')]({'exitAt':moment()['format'](_0x5f3d('0x2e')),'data2':'system'}));});return BPromise[_0x5f3d('0x46')](_0x2598fc);})[_0x5f3d('0x20')](function(){return _0x27bf20[_0x5f3d('0x39')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x5f3d('0x20')](function(_0xf3feae){_0x560937(_0xf3feae);})[_0x5f3d('0x22')](function(_0x15302f){_0xc48835(_0x1168a5[_0x5f3d('0x14')](0x1f4,_0x15302f[_0x5f3d('0x16')]));});});};exports[_0x5f3d('0x47')]=function(_0x1fe758){var _0x515a67=this;return new Promise(function(_0x240912,_0x7ae51d){var _0x796167;return db[_0x5f3d('0x24')]['findOne']({'where':_0x1fe758['options'][_0x5f3d('0x1b')]||{},'attributes':['id',_0x5f3d('0x27')]})[_0x5f3d('0x20')](function(_0x34e886){if(_0x34e886){_0x796167=_0x34e886;return db[_0x5f3d('0x2b')][_0x5f3d('0x48')]({'where':{'membername':_0x796167[_0x5f3d('0x27')]},'individualHooks':!![]});}})[_0x5f3d('0x20')](function(){if(_0x796167){return db[_0x5f3d('0x2c')][_0x5f3d('0x19')]({'where':{'membername':_0x796167[_0x5f3d('0x27')],'exitAt':null}});}})[_0x5f3d('0x20')](function(_0x5958c3){if(_0x796167){if(_0x5958c3&&_0x5958c3[_0x5f3d('0x2f')]){var _0x1cf8e1=[];_0x5958c3[_0x5f3d('0x32')](function(_0xb372b0){_0x1cf8e1[_0x5f3d('0x49')](_0xb372b0[_0x5f3d('0x39')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x1cf8e1);}}})[_0x5f3d('0x20')](function(){if(_0x796167){return _0x796167['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x2df638){_0x240912(_0x2df638);})[_0x5f3d('0x22')](function(_0x2459e6){_0x7ae51d(_0x515a67[_0x5f3d('0x14')](0x1f4,_0x2459e6[_0x5f3d('0x16')]));});});};exports[_0x5f3d('0x4a')]=function(_0x4a2a6c){var _0x2e6b72=this;return new Promise(function(_0x257594,_0xf99e00){var _0x33ce77;var _0x2a30f1;var _0x56fc40;var _0x57a592;return db[_0x5f3d('0x24')][_0x5f3d('0x4b')]({'where':_0x4a2a6c[_0x5f3d('0x1a')][_0x5f3d('0x1b')]||{},'attributes':['id','name','role',_0x5f3d('0x4c'),_0x5f3d('0x4d'),_0x5f3d('0x29'),_0x5f3d('0x4e'),'interface']})[_0x5f3d('0x20')](function(_0x2929b1){if(_0x2929b1){_0x33ce77=_0x2929b1;_0x57a592=_0x4a2a6c[_0x5f3d('0x36')][_0x5f3d('0x2a')]?_0x4a2a6c[_0x5f3d('0x36')][_0x5f3d('0x2a')]:util['format'](_0x5f3d('0x35'),_0x33ce77['name']);return db[_0x5f3d('0x24')][_0x5f3d('0x4f')]({'where':{'role':_0x5f3d('0x50'),'online':!![],'id':{'$ne':_0x33ce77['id']}}});}})[_0x5f3d('0x20')](function(_0xe658fa){if(_0xe658fa){_0x56fc40=_0xe658fa;return require(_0x5f3d('0x51'))[_0x5f3d('0x52')]();}})['then'](function(_0x456208){if(_0x456208&&_0x456208[_0x5f3d('0x53')]&&_0x56fc40>=_0x456208[_0x5f3d('0x53')]){throw new Error(_0x5f3d('0x54'));}})['then'](function(){if(_0x33ce77){return db[_0x5f3d('0x2b')][_0x5f3d('0x48')]({'where':{'membername':_0x33ce77[_0x5f3d('0x27')]},'individualHooks':!![]});}})[_0x5f3d('0x20')](function(){if(_0x33ce77){return _0x33ce77[_0x5f3d('0x55')]({'raw':!![]});}})[_0x5f3d('0x20')](function(_0x5bd674){if(_0x33ce77){if(_0x5bd674){var _0x5e135a=[];_0x2a30f1=_0x5bd674;if(_0x2a30f1[_0x5f3d('0x2f')]){for(var _0x4039ae=0x0;_0x4039ae<_0x2a30f1[_0x5f3d('0x2f')];_0x4039ae++){_0x5e135a[_0x5f3d('0x49')](db['UserVoiceQueueRt'][_0x5f3d('0x56')]({'membername':_0x33ce77[_0x5f3d('0x27')],'UserId':_0x33ce77['id'],'queue_name':_0x2a30f1[_0x4039ae][_0x5f3d('0x27')],'VoiceQueueId':_0x2a30f1[_0x4039ae]['id'],'interface':_0x57a592,'paused':_0x33ce77[_0x5f3d('0x4e')]||![],'penalty':_0x2a30f1[_0x4039ae][_0x5f3d('0x57')]||0x0}));}return BPromise[_0x5f3d('0x46')](_0x5e135a);}}}})[_0x5f3d('0x20')](function(){if(_0x33ce77){return db[_0x5f3d('0x2c')]['findAll']({'where':{'membername':_0x33ce77[_0x5f3d('0x27')],'exitAt':null}});}})[_0x5f3d('0x20')](function(_0x27ca04){if(_0x33ce77){if(_0x27ca04&&_0x27ca04[_0x5f3d('0x2f')]){var _0x131563=[];_0x27ca04[_0x5f3d('0x32')](function(_0xdf506){_0x131563['push'](_0xdf506[_0x5f3d('0x39')]({'exitAt':moment()[_0x5f3d('0x34')](_0x5f3d('0x2e'))}));});return BPromise[_0x5f3d('0x46')](_0x131563);}}})[_0x5f3d('0x20')](function(_0x3be4cd){if(_0x33ce77){var _0xe563ea=[];var _0x44d079=[];var _0x440afe=utils[_0x5f3d('0x31')]();var _0x11d10e={'membername':_0x33ce77[_0x5f3d('0x27')],'interface':_0x57a592,'enterAt':moment()['format'](_0x5f3d('0x2e')),'role':_0x33ce77[_0x5f3d('0x28')],'internal':_0x33ce77['internal']};_0x440afe[_0x5f3d('0x32')](function(_0x4f23c4){_0xe563ea[_0x5f3d('0x49')](_[_0x5f3d('0x58')]({'channel':_0x4f23c4,'type':_0x5f3d('0x59'),'data1':_0x5f3d('0x5a'),'data2':_0x57a592},_0x11d10e));if(_0x33ce77[_0x5f3d('0x4e')]){_0x44d079[_0x5f3d('0x49')](_[_0x5f3d('0x58')]({'channel':_0x4f23c4,'type':'PAUSE','data1':'LOGININPAUSE'},_0x11d10e));}});return db[_0x5f3d('0x2c')]['bulkCreate'](_0xe563ea[_0x5f3d('0x5b')](_0x44d079),{'individualHooks':!![]});}})['then'](function(){if(_0x33ce77){return _0x33ce77['update']({'online':!![],'lastLoginAt':moment()[_0x5f3d('0x34')](_0x5f3d('0x2e')),'voicePause':_0x33ce77[_0x5f3d('0x4e')]||![],'mailPause':_0x33ce77[_0x5f3d('0x4e')]||![],'chatPause':_0x33ce77[_0x5f3d('0x4e')]||![],'faxPause':_0x33ce77[_0x5f3d('0x4e')]||![],'smsPause':_0x33ce77[_0x5f3d('0x4e')]||![],'openchannelPause':_0x33ce77[_0x5f3d('0x4e')]||![],'pauseType':_0x33ce77[_0x5f3d('0x4e')]?_0x5f3d('0x5c'):null,'lastPauseAt':moment()[_0x5f3d('0x34')](_0x5f3d('0x2e')),'interface':_0x57a592});}})[_0x5f3d('0x20')](function(_0x2a4525){_0x257594(_0x2a4525);})[_0x5f3d('0x22')](function(_0x5e9502){_0xf99e00(_0x2e6b72[_0x5f3d('0x14')](0x1f4,_0x5e9502[_0x5f3d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 52f8ab6..eb69231 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 _0xe51f=['remove','update','removeListener','length','user:','./user.events'];(function(_0x386f57,_0x111919){var _0x46c258=function(_0xd17966){while(--_0xd17966){_0x386f57['push'](_0x386f57['shift']());}};_0x46c258(++_0x111919);}(_0xe51f,0x155));var _0xfe51=function(_0x3add1a,_0x33e5c4){_0x3add1a=_0x3add1a-0x0;var _0x459f88=_0xe51f[_0x3add1a];return _0x459f88;};'use strict';var UserEvents=require(_0xfe51('0x0'));var events=['save',_0xfe51('0x1'),_0xfe51('0x2')];function createListener(_0x3d265e,_0x444e88){return function(_0x3eb705){_0x444e88['emit'](_0x3d265e,_0x3eb705);};}function removeListener(_0x4b98d4,_0x3c0b8a){return function(){UserEvents[_0xfe51('0x3')](_0x4b98d4,_0x3c0b8a);};}exports['register']=function(_0xbc35a5){for(var _0x48283a=0x0,_0x1ec09a=events[_0xfe51('0x4')];_0x48283a<_0x1ec09a;_0x48283a++){var _0x5cc555=events[_0x48283a];var _0x37a7cd=createListener(_0xfe51('0x5')+_0x5cc555,_0xbc35a5);UserEvents['on'](_0x5cc555,_0x37a7cd);}}; \ No newline at end of file +var _0x4cb5=['update','register','length','user:','./user.events','save','remove'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0x4cb5,0x11c));var _0x54cb=function(_0x5a65da,_0x5e8d5d){_0x5a65da=_0x5a65da-0x0;var _0x3d01e3=_0x4cb5[_0x5a65da];return _0x3d01e3;};'use strict';var UserEvents=require(_0x54cb('0x0'));var events=[_0x54cb('0x1'),_0x54cb('0x2'),_0x54cb('0x3')];function createListener(_0x3325ff,_0x2537c3){return function(_0x56e058){_0x2537c3['emit'](_0x3325ff,_0x56e058);};}function removeListener(_0x5c8c4d,_0x11a9d5){return function(){UserEvents['removeListener'](_0x5c8c4d,_0x11a9d5);};}exports[_0x54cb('0x4')]=function(_0xcedf5){for(var _0x4c4360=0x0,_0x1b3171=events[_0x54cb('0x5')];_0x4c4360<_0x1b3171;_0x4c4360++){var _0x4ed3c6=events[_0x4c4360];var _0x5edcb2=createListener(_0x54cb('0x6')+_0x4ed3c6,_0xcedf5);UserEvents['on'](_0x4ed3c6,_0x5edcb2);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 1145a9c..e137ec0 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x24e7b2,_0x16b3b4){var _0x7e7074=function(_0x31d4f1){while(--_0x31d4f1){_0x24e7b2['push'](_0x24e7b2['shift']());}};_0x7e7074(++_0x16b3b4);}(_0xe706,0xa3));var _0x6e70=function(_0x188c3d,_0x35d1b7){_0x188c3d=_0x188c3d-0x0;var _0x8bfd13=_0xe706[_0x188c3d];return _0x8bfd13;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x40fcfb,_0xfd7c59){var _0x4095cf=function(_0x5037cb){while(--_0x5037cb){_0x40fcfb['push'](_0x40fcfb['shift']());}};_0x4095cf(++_0xfd7c59);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 68b9e8b..82516c1 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc385=['sequelize','exports','INTEGER'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xc385,0x8a));var _0x5c38=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xc385[_0xda464c];return _0x19e222;};'use strict';var Sequelize=require(_0x5c38('0x0'));module[_0x5c38('0x1')]={'penalty':{'type':Sequelize[_0x5c38('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0404=['INTEGER','exports'];(function(_0x2d340d,_0x35a2f6){var _0x38932a=function(_0x425276){while(--_0x425276){_0x2d340d['push'](_0x2d340d['shift']());}};_0x38932a(++_0x35a2f6);}(_0x0404,0x123));var _0x4040=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0x0404[_0xbe40ad];return _0x50fac9;};'use strict';var Sequelize=require('sequelize');module[_0x4040('0x0')]={'penalty':{'type':Sequelize[_0x4040('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 7324f45..192ee1d 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 _0x1746=['UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','path','./userChatQueue.attributes','exports','define'];(function(_0x17e600,_0x1fdf60){var _0x317515=function(_0x5a4607){while(--_0x5a4607){_0x17e600['push'](_0x17e600['shift']());}};_0x317515(++_0x1fdf60);}(_0x1746,0x1bb));var _0x6174=function(_0x436a6a,_0x44a8b6){_0x436a6a=_0x436a6a-0x0;var _0x54b529=_0x1746[_0x436a6a];return _0x54b529;};'use strict';var _=require(_0x6174('0x0'));var util=require(_0x6174('0x1'));var logger=require(_0x6174('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6174('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6174('0x4'));module[_0x6174('0x5')]=function(_0x223bb4,_0x1ffce9){return _0x223bb4[_0x6174('0x6')](_0x6174('0x7'),attributes,{'tableName':_0x6174('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8016=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','define','user_has_chat_queues','lodash','util','api'];(function(_0x28d936,_0x5d98a6){var _0x569200=function(_0x569e00){while(--_0x569e00){_0x28d936['push'](_0x28d936['shift']());}};_0x569200(++_0x5d98a6);}(_0x8016,0x19f));var _0x6801=function(_0x3c3ec7,_0x309339){_0x3c3ec7=_0x3c3ec7-0x0;var _0x23e52c=_0x8016[_0x3c3ec7];return _0x23e52c;};'use strict';var _=require(_0x6801('0x0'));var util=require(_0x6801('0x1'));var logger=require('../../config/logger')(_0x6801('0x2'));var moment=require('moment');var BPromise=require(_0x6801('0x3'));var rp=require(_0x6801('0x4'));var fs=require('fs');var path=require(_0x6801('0x5'));var rimraf=require(_0x6801('0x6'));var config=require(_0x6801('0x7'));var attributes=require(_0x6801('0x8'));module['exports']=function(_0x3533ab,_0x49cfd0){return _0x3533ab[_0x6801('0x9')]('UserChatQueue',attributes,{'tableName':_0x6801('0xa'),'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 0fedc1d..438d1e4 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 _0xb2d2=['jayson/promise','client','http','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0xb2d2,0x1c5));var _0x2b2d=function(_0x5cd449,_0x116736){_0x5cd449=_0x5cd449-0x0;var _0x1a29f4=_0xb2d2[_0x5cd449];return _0x1a29f4;};'use strict';var _=require(_0x2b2d('0x0'));var util=require(_0x2b2d('0x1'));var moment=require(_0x2b2d('0x2'));var BPromise=require(_0x2b2d('0x3'));var rs=require(_0x2b2d('0x4'));var fs=require('fs');var Redis=require(_0x2b2d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b2d('0x6'));var logger=require('../../config/logger')(_0x2b2d('0x7'));var config=require(_0x2b2d('0x8'));var jayson=require(_0x2b2d('0x9'));var client=jayson[_0x2b2d('0xa')][_0x2b2d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fa6ea,_0x2fac68,_0x3f545b){return new BPromise(function(_0x53c750,_0x31a6d4){return client['request'](_0x3fa6ea,_0x3f545b)[_0x2b2d('0xc')](function(_0x6cfb7e){logger['info'](_0x2b2d('0xd'),_0x2fac68,_0x2b2d('0xe'));logger[_0x2b2d('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x2fac68,_0x2b2d('0xe'),JSON['stringify'](_0x6cfb7e));if(_0x6cfb7e[_0x2b2d('0x10')]){if(_0x6cfb7e[_0x2b2d('0x10')][_0x2b2d('0x11')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x2fac68,_0x6cfb7e['error']['message']);return _0x31a6d4(_0x6cfb7e['error'][_0x2b2d('0x12')]);}logger[_0x2b2d('0x10')](_0x2b2d('0xd'),_0x2fac68,_0x6cfb7e[_0x2b2d('0x10')][_0x2b2d('0x12')]);return _0x53c750(_0x6cfb7e[_0x2b2d('0x10')][_0x2b2d('0x12')]);}else{logger[_0x2b2d('0x13')](_0x2b2d('0xd'),_0x2fac68,'request\x20sent');_0x53c750(_0x6cfb7e[_0x2b2d('0x14')][_0x2b2d('0x12')]);}})['catch'](function(_0x4d125c){logger[_0x2b2d('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x2fac68,_0x4d125c);_0x31a6d4(_0x4d125c);});});} \ No newline at end of file +var _0xbef7=['info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x4dde94,_0x52b903){var _0x30acf7=function(_0x2d0ead){while(--_0x2d0ead){_0x4dde94['push'](_0x4dde94['shift']());}};_0x30acf7(++_0x52b903);}(_0xbef7,0xd8));var _0x7bef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbef7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7bef('0x0'));var util=require('util');var moment=require(_0x7bef('0x1'));var BPromise=require(_0x7bef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7bef('0x3'));var db=require(_0x7bef('0x4'))['db'];var utils=require(_0x7bef('0x5'));var logger=require(_0x7bef('0x6'))(_0x7bef('0x7'));var config=require(_0x7bef('0x8'));var jayson=require(_0x7bef('0x9'));var client=jayson['client'][_0x7bef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x380a09,_0x143058,_0x201fb4){return new BPromise(function(_0xe24da3,_0x5c0cd4){return client['request'](_0x380a09,_0x201fb4)[_0x7bef('0xb')](function(_0x289737){logger[_0x7bef('0xc')](_0x7bef('0xd'),_0x143058,_0x7bef('0xe'));logger['debug'](_0x7bef('0xf'),_0x143058,_0x7bef('0xe'),JSON['stringify'](_0x289737));if(_0x289737['error']){if(_0x289737[_0x7bef('0x10')]['code']===0x1f4){logger[_0x7bef('0x10')](_0x7bef('0xd'),_0x143058,_0x289737[_0x7bef('0x10')]['message']);return _0x5c0cd4(_0x289737['error'][_0x7bef('0x11')]);}logger[_0x7bef('0x10')](_0x7bef('0xd'),_0x143058,_0x289737['error'][_0x7bef('0x11')]);return _0xe24da3(_0x289737['error'][_0x7bef('0x11')]);}else{logger[_0x7bef('0xc')](_0x7bef('0xd'),_0x143058,_0x7bef('0xe'));_0xe24da3(_0x289737['result'][_0x7bef('0x11')]);}})[_0x7bef('0x12')](function(_0x328289){logger['error'](_0x7bef('0xd'),_0x143058,_0x328289);_0x5c0cd4(_0x328289);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 611181c..518796a 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xbfba71,_0x36d378){var _0x39470b=function(_0x1e37f3){while(--_0x1e37f3){_0xbfba71['push'](_0xbfba71['shift']());}};_0x39470b(++_0x36d378);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x411f5c,_0xc2ecc9){var _0x5ef722=function(_0x35b0fb){while(--_0x35b0fb){_0x411f5c['push'](_0x411f5c['shift']());}};_0x5ef722(++_0xc2ecc9);}(_0x70e0,0x17b));var _0x070e=function(_0x109d39,_0x54bf3c){_0x109d39=_0x109d39-0x0;var _0x2b17b9=_0x70e0[_0x109d39];return _0x2b17b9;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index d70f762..b0b775a 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 _0xd30f=['exports','INTEGER','sequelize'];(function(_0xe217ea,_0x5e2d2f){var _0x15d235=function(_0x34f7cb){while(--_0x34f7cb){_0xe217ea['push'](_0xe217ea['shift']());}};_0x15d235(++_0x5e2d2f);}(_0xd30f,0x191));var _0xfd30=function(_0x419de1,_0xdce6e5){_0x419de1=_0x419de1-0x0;var _0x54ed8f=_0xd30f[_0x419de1];return _0x54ed8f;};'use strict';var Sequelize=require(_0xfd30('0x0'));module[_0xfd30('0x1')]={'penalty':{'type':Sequelize[_0xfd30('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5d81=['exports','INTEGER','STRING','sequelize'];(function(_0x12fc36,_0x6530d3){var _0x55c667=function(_0x39ed70){while(--_0x39ed70){_0x12fc36['push'](_0x12fc36['shift']());}};_0x55c667(++_0x6530d3);}(_0x5d81,0x97));var _0x15d8=function(_0x631a3c,_0x1b61b6){_0x631a3c=_0x631a3c-0x0;var _0x2bdfa3=_0x5d81[_0x631a3c];return _0x2bdfa3;};'use strict';var Sequelize=require(_0x15d8('0x0'));module[_0x15d8('0x1')]={'penalty':{'type':Sequelize[_0x15d8('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x15d8('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x15d8('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index fd4f504..9f3ffe1 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 _0xbb3f=['bluebird','request-promise','path','rimraf','exports','define','UserFaxQueue','user_has_fax_queues','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb3f,0x6b));var _0xfbb3=function(_0x126361,_0xcfea74){_0x126361=_0x126361-0x0;var _0x3b5204=_0xbb3f[_0x126361];return _0x3b5204;};'use strict';var _=require('lodash');var util=require(_0xfbb3('0x0'));var logger=require(_0xfbb3('0x1'))(_0xfbb3('0x2'));var moment=require('moment');var BPromise=require(_0xfbb3('0x3'));var rp=require(_0xfbb3('0x4'));var fs=require('fs');var path=require(_0xfbb3('0x5'));var rimraf=require(_0xfbb3('0x6'));var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0xfbb3('0x7')]=function(_0x195aa4,_0x105886){return _0x195aa4[_0xfbb3('0x8')](_0xfbb3('0x9'),attributes,{'tableName':_0xfbb3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3f3=['UserFaxQueue','user_has_fax_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x2db45e,_0x3c3b37){var _0x200a5=function(_0x2a9fb2){while(--_0x2a9fb2){_0x2db45e['push'](_0x2db45e['shift']());}};_0x200a5(++_0x3c3b37);}(_0xc3f3,0x152));var _0x3c3f=function(_0x38c980,_0x2912a6){_0x38c980=_0x38c980-0x0;var _0x4ccf3c=_0xc3f3[_0x38c980];return _0x4ccf3c;};'use strict';var _=require(_0x3c3f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3c3f('0x1'));var moment=require(_0x3c3f('0x2'));var BPromise=require(_0x3c3f('0x3'));var rp=require(_0x3c3f('0x4'));var fs=require('fs');var path=require(_0x3c3f('0x5'));var rimraf=require(_0x3c3f('0x6'));var config=require(_0x3c3f('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0x3c3f('0x8')]=function(_0x44c05c,_0x505bc7){return _0x44c05c[_0x3c3f('0x9')](_0x3c3f('0xa'),attributes,{'tableName':_0x3c3f('0xb'),'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 8e8ea97..3d54bc2 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 _0x25ff=['lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x12b8ef,_0x24641e){var _0x5db551=function(_0x4ce2f9){while(--_0x4ce2f9){_0x12b8ef['push'](_0x12b8ef['shift']());}};_0x5db551(++_0x24641e);}(_0x25ff,0xbd));var _0xf25f=function(_0x26a6e0,_0x5d0172){_0x26a6e0=_0x26a6e0-0x0;var _0x47ed9d=_0x25ff[_0x26a6e0];return _0x47ed9d;};'use strict';var _=require(_0xf25f('0x0'));var util=require('util');var moment=require(_0xf25f('0x1'));var BPromise=require(_0xf25f('0x2'));var rs=require(_0xf25f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf25f('0x4'));var logger=require(_0xf25f('0x5'))('rpc');var config=require(_0xf25f('0x6'));var jayson=require(_0xf25f('0x7'));var client=jayson[_0xf25f('0x8')][_0xf25f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3be501,_0x52ed9a,_0x19877a){return new BPromise(function(_0x136c5f,_0x2bac3f){return client['request'](_0x3be501,_0x19877a)[_0xf25f('0xa')](function(_0x4b27d7){logger['info'](_0xf25f('0xb'),_0x52ed9a,_0xf25f('0xc'));logger[_0xf25f('0xd')](_0xf25f('0xe'),_0x52ed9a,_0xf25f('0xc'),JSON['stringify'](_0x4b27d7));if(_0x4b27d7['error']){if(_0x4b27d7[_0xf25f('0xf')][_0xf25f('0x10')]===0x1f4){logger[_0xf25f('0xf')](_0xf25f('0xb'),_0x52ed9a,_0x4b27d7[_0xf25f('0xf')]['message']);return _0x2bac3f(_0x4b27d7[_0xf25f('0xf')][_0xf25f('0x11')]);}logger['error'](_0xf25f('0xb'),_0x52ed9a,_0x4b27d7[_0xf25f('0xf')][_0xf25f('0x11')]);return _0x136c5f(_0x4b27d7[_0xf25f('0xf')][_0xf25f('0x11')]);}else{logger[_0xf25f('0x12')](_0xf25f('0xb'),_0x52ed9a,'request\x20sent');_0x136c5f(_0x4b27d7[_0xf25f('0x13')][_0xf25f('0x11')]);}})[_0xf25f('0x14')](function(_0x5ea59d){logger[_0xf25f('0xf')](_0xf25f('0xb'),_0x52ed9a,_0x5ea59d);_0x2bac3f(_0x5ea59d);});});} \ No newline at end of file +var _0x1f93=['http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x591b15,_0x29ab95){var _0x11c6b7=function(_0x2acf6d){while(--_0x2acf6d){_0x591b15['push'](_0x591b15['shift']());}};_0x11c6b7(++_0x29ab95);}(_0x1f93,0x137));var _0x31f9=function(_0xddcdd7,_0x2c3459){_0xddcdd7=_0xddcdd7-0x0;var _0xe6047b=_0x1f93[_0xddcdd7];return _0xe6047b;};'use strict';var _=require(_0x31f9('0x0'));var util=require('util');var moment=require(_0x31f9('0x1'));var BPromise=require(_0x31f9('0x2'));var rs=require(_0x31f9('0x3'));var fs=require('fs');var Redis=require(_0x31f9('0x4'));var db=require(_0x31f9('0x5'))['db'];var utils=require(_0x31f9('0x6'));var logger=require(_0x31f9('0x7'))(_0x31f9('0x8'));var config=require(_0x31f9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x31f9('0xa')][_0x31f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e59d5,_0x1c272a,_0x2d5998){return new BPromise(function(_0x2dd4c2,_0x3be2b3){return client[_0x31f9('0xc')](_0x2e59d5,_0x2d5998)['then'](function(_0x3086df){logger[_0x31f9('0xd')](_0x31f9('0xe'),_0x1c272a,_0x31f9('0xf'));logger[_0x31f9('0x10')](_0x31f9('0x11'),_0x1c272a,_0x31f9('0xf'),JSON[_0x31f9('0x12')](_0x3086df));if(_0x3086df[_0x31f9('0x13')]){if(_0x3086df[_0x31f9('0x13')][_0x31f9('0x14')]===0x1f4){logger['error'](_0x31f9('0xe'),_0x1c272a,_0x3086df['error'][_0x31f9('0x15')]);return _0x3be2b3(_0x3086df['error'][_0x31f9('0x15')]);}logger['error'](_0x31f9('0xe'),_0x1c272a,_0x3086df['error']['message']);return _0x2dd4c2(_0x3086df[_0x31f9('0x13')][_0x31f9('0x15')]);}else{logger[_0x31f9('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x1c272a,_0x31f9('0xf'));_0x2dd4c2(_0x3086df[_0x31f9('0x16')]['message']);}})['catch'](function(_0x1baeb9){logger['error'](_0x31f9('0xe'),_0x1c272a,_0x1baeb9);_0x3be2b3(_0x1baeb9);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 8dd2c4b..01bc492 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2fa11e,_0x57a5c4){var _0x2b445c=function(_0x1179c4){while(--_0x1179c4){_0x2fa11e['push'](_0x2fa11e['shift']());}};_0x2b445c(++_0x57a5c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x60581d,_0xa3e313){var _0x43dd38=function(_0x38c017){while(--_0x38c017){_0x60581d['push'](_0x60581d['shift']());}};_0x43dd38(++_0xa3e313);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index f3d9120..03806e8 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 _0x6ce7=['exports','INTEGER','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6ce7,0x116));var _0x76ce=function(_0x2f4abb,_0x2eafe2){_0x2f4abb=_0x2f4abb-0x0;var _0x57d7e7=_0x6ce7[_0x2f4abb];return _0x57d7e7;};'use strict';var Sequelize=require(_0x76ce('0x0'));module[_0x76ce('0x1')]={'penalty':{'type':Sequelize[_0x76ce('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfb06=['exports'];(function(_0xba9fee,_0x4447c0){var _0x305416=function(_0x3d0d7f){while(--_0x3d0d7f){_0xba9fee['push'](_0xba9fee['shift']());}};_0x305416(++_0x4447c0);}(_0xfb06,0x118));var _0x6fb0=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0xfb06[_0x480bc8];return _0x28c245;};'use strict';var Sequelize=require('sequelize');module[_0x6fb0('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 18d629f..23ef600 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 _0xb57b=['user_has_mail_queues','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x39028f,_0x5a0214){var _0x1ae6e0=function(_0x95346c){while(--_0x95346c){_0x39028f['push'](_0x39028f['shift']());}};_0x1ae6e0(++_0x5a0214);}(_0xb57b,0x1a5));var _0xbb57=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xb57b[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xbb57('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbb57('0x1'));var moment=require(_0xbb57('0x2'));var BPromise=require(_0xbb57('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb57('0x4'));var rimraf=require(_0xbb57('0x5'));var config=require(_0xbb57('0x6'));var attributes=require(_0xbb57('0x7'));module[_0xbb57('0x8')]=function(_0x3f7bbb,_0x414377){return _0x3f7bbb[_0xbb57('0x9')](_0xbb57('0xa'),attributes,{'tableName':_0xbb57('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e43=['rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','api','moment','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2e43,0x187));var _0x32e4=function(_0x3300d0,_0x45afb1){_0x3300d0=_0x3300d0-0x0;var _0x2762dd=_0x2e43[_0x3300d0];return _0x2762dd;};'use strict';var _=require(_0x32e4('0x0'));var util=require(_0x32e4('0x1'));var logger=require('../../config/logger')(_0x32e4('0x2'));var moment=require(_0x32e4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x32e4('0x4'));var rimraf=require(_0x32e4('0x5'));var config=require(_0x32e4('0x6'));var attributes=require(_0x32e4('0x7'));module[_0x32e4('0x8')]=function(_0x3dcd83,_0x4bffcf){return _0x3dcd83[_0x32e4('0x9')](_0x32e4('0xa'),attributes,{'tableName':_0x32e4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index f552c13..62bfe2b 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x1a97bd,_0x300e51){var _0x4193c6=function(_0x8797ec){while(--_0x8797ec){_0x1a97bd['push'](_0x1a97bd['shift']());}};_0x4193c6(++_0x300e51);}(_0xe14b,0x93));var _0xbe14=function(_0xf091e4,_0x44febe){_0xf091e4=_0xf091e4-0x0;var _0x22ae5f=_0xe14b[_0xf091e4];return _0x22ae5f;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5a0f27,_0x1ff8e3){var _0x2c504c=function(_0x49af99){while(--_0x49af99){_0x5a0f27['push'](_0x5a0f27['shift']());}};_0x2c504c(++_0x1ff8e3);}(_0xa41a,0x6b));var _0xaa41=function(_0x2ed7d6,_0x3592ff){_0x2ed7d6=_0x2ed7d6-0x0;var _0x3767bd=_0xa41a[_0x2ed7d6];return _0x3767bd;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index a227789..f38c0b8 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 _0x677f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','exports','multer','util','connect-timeout','express'];(function(_0x4c6bca,_0x3de390){var _0x29d58e=function(_0x1ac871){while(--_0x1ac871){_0x4c6bca['push'](_0x4c6bca['shift']());}};_0x29d58e(++_0x3de390);}(_0x677f,0x193));var _0xf677=function(_0x5a499d,_0xf08699){_0x5a499d=_0x5a499d-0x0;var _0x33cef9=_0x677f[_0x5a499d];return _0x33cef9;};'use strict';var multer=require(_0xf677('0x0'));var util=require(_0xf677('0x1'));var path=require('path');var timeout=require(_0xf677('0x2'));var express=require(_0xf677('0x3'));var router=express[_0xf677('0x4')]();var fs_extra=require(_0xf677('0x5'));var auth=require(_0xf677('0x6'));var interaction=require(_0xf677('0x7'));var config=require(_0xf677('0x8'));var controller=require('./userNotification.controller');router[_0xf677('0x9')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0xf677('0xa')]=router; \ No newline at end of file +var _0x2c4c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express'];(function(_0x4a208f,_0x45325b){var _0xd20ec2=function(_0x3fbf2f){while(--_0x3fbf2f){_0x4a208f['push'](_0x4a208f['shift']());}};_0xd20ec2(++_0x45325b);}(_0x2c4c,0x1ad));var _0xc2c4=function(_0xb51463,_0x1c7959){_0xb51463=_0xb51463-0x0;var _0x15f379=_0x2c4c[_0xb51463];return _0x15f379;};'use strict';var multer=require(_0xc2c4('0x0'));var util=require(_0xc2c4('0x1'));var path=require(_0xc2c4('0x2'));var timeout=require(_0xc2c4('0x3'));var express=require(_0xc2c4('0x4'));var router=express[_0xc2c4('0x5')]();var fs_extra=require(_0xc2c4('0x6'));var auth=require(_0xc2c4('0x7'));var interaction=require(_0xc2c4('0x8'));var config=require(_0xc2c4('0x9'));var controller=require('./userNotification.controller');router[_0xc2c4('0xa')]('/',auth[_0xc2c4('0xb')](),controller[_0xc2c4('0xc')]);module[_0xc2c4('0xd')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index e2d63d1..27949f7 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 _0x0902=['STRING','exports','TEXT'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x0902,0xeb));var _0x2090=function(_0x5ace25,_0x536239){_0x5ace25=_0x5ace25-0x0;var _0x4ba17a=_0x0902[_0x5ace25];return _0x4ba17a;};'use strict';var Sequelize=require('sequelize');module[_0x2090('0x0')]={'body':{'type':Sequelize[_0x2090('0x1')]},'senderName':{'type':Sequelize[_0x2090('0x2')]},'recipientsId':{'type':Sequelize[_0x2090('0x1')]},'recipientsDescription':{'type':Sequelize[_0x2090('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xfa42=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x2dffac,_0x2d38e7){var _0x535c18=function(_0x1f3df0){while(--_0x1f3df0){_0x2dffac['push'](_0x2dffac['shift']());}};_0x535c18(++_0x2d38e7);}(_0xfa42,0xd7));var _0x2fa4=function(_0x26bf5a,_0x1d5c98){_0x26bf5a=_0x26bf5a-0x0;var _0x409a3a=_0xfa42[_0x26bf5a];return _0x409a3a;};'use strict';var Sequelize=require(_0x2fa4('0x0'));module[_0x2fa4('0x1')]={'body':{'type':Sequelize[_0x2fa4('0x2')]},'senderName':{'type':Sequelize[_0x2fa4('0x3')]},'recipientsId':{'type':Sequelize[_0x2fa4('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x2fa4('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 4a24a7f..6b88f95 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 _0x1278=['recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','userNotification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','union','queue','replace','ids','push','all','flatten','catch','getAgents','map','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','end','sendStatus','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1278,0x1c2));var _0x8127=function(_0x197043,_0x3ebf47){_0x197043=_0x197043-0x0;var _0x233e33=_0x1278[_0x197043];return _0x233e33;};'use strict';var emlformat=require(_0x8127('0x0'));var rimraf=require(_0x8127('0x1'));var zipdir=require(_0x8127('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8127('0x3'));var moment=require(_0x8127('0x4'));var BPromise=require(_0x8127('0x5'));var Mustache=require(_0x8127('0x6'));var util=require(_0x8127('0x7'));var path=require(_0x8127('0x8'));var sox=require(_0x8127('0x9'));var csv=require('to-csv');var ejs=require(_0x8127('0xa'));var fs=require('fs');var fs_extra=require(_0x8127('0xb'));var _=require(_0x8127('0xc'));var squel=require(_0x8127('0xd'));var crypto=require(_0x8127('0xe'));var jsforce=require(_0x8127('0xf'));var deskjs=require(_0x8127('0x10'));var toCsv=require(_0x8127('0x11'));var querystring=require(_0x8127('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8127('0x13'));var as=require(_0x8127('0x14'));var hardwareService=require(_0x8127('0x15'));var logger=require(_0x8127('0x16'))(_0x8127('0x17'));var utils=require('../../config/utils');var config=require(_0x8127('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8127('0x19'))['db'];config[_0x8127('0x1a')]=_['defaults'](config[_0x8127('0x1a')],{'host':_0x8127('0x1b'),'port':0x18eb});var socket=require(_0x8127('0x1c'))(new Redis(config[_0x8127('0x1a')]));require(_0x8127('0x1d'))[_0x8127('0x1e')](socket);function respondWithStatusCode(_0x29dbb2,_0x42a214){_0x42a214=_0x42a214||0xcc;return function(_0x330320){if(_0x330320){return _0x29dbb2['sendStatus'](_0x42a214);}return _0x29dbb2['status'](_0x42a214)['end']();};}function respondWithResult(_0x46817b,_0x2529e1){_0x2529e1=_0x2529e1||0xc8;return function(_0x201922){if(_0x201922){return _0x46817b[_0x8127('0x1f')](_0x2529e1)[_0x8127('0x20')](_0x201922);}};}function respondWithFilteredResult(_0x1f8ae5,_0x2b2f9d){return function(_0x5d0214){if(_0x5d0214){var _0x532fc3=typeof _0x2b2f9d['offset']===_0x8127('0x21')&&typeof _0x2b2f9d[_0x8127('0x22')]===_0x8127('0x21');var _0x200324=_0x5d0214[_0x8127('0x23')];var _0xc136d1=_0x532fc3?0x0:_0x2b2f9d[_0x8127('0x24')];var _0x3ca546=_0x532fc3?_0x5d0214[_0x8127('0x23')]:_0x2b2f9d[_0x8127('0x24')]+_0x2b2f9d[_0x8127('0x22')];var _0x1f47ec;if(_0x3ca546>=_0x200324){_0x3ca546=_0x200324;_0x1f47ec=0xc8;}else{_0x1f47ec=0xce;}_0x1f8ae5[_0x8127('0x1f')](_0x1f47ec);return _0x1f8ae5[_0x8127('0x25')](_0x8127('0x26'),_0xc136d1+'-'+_0x3ca546+'/'+_0x200324)[_0x8127('0x20')](_0x5d0214);}return null;};}function patchUpdates(_0x5c1608){return function(_0xdd2577){try{jsonpatch['apply'](_0xdd2577,_0x5c1608,!![]);}catch(_0x549bab){return BPromise['reject'](_0x549bab);}return _0xdd2577[_0x8127('0x27')]();};}function saveUpdates(_0x27e8b4,_0x208f53){return function(_0xdccced){if(_0xdccced){return _0xdccced[_0x8127('0x28')](_0x27e8b4)[_0x8127('0x29')](function(_0x56bd6c){return _0x56bd6c;});}return null;};}function removeEntity(_0xd50fb5,_0x5b46fc){return function(_0x2801a4){if(_0x2801a4){return _0x2801a4['destroy']()['then'](function(){_0xd50fb5[_0x8127('0x1f')](0xcc)[_0x8127('0x2a')]();});}};}function handleEntityNotFound(_0x5cfebd,_0x293968){return function(_0x4714b9){if(!_0x4714b9){_0x5cfebd[_0x8127('0x2b')](0x194);}return _0x4714b9;};}function handleError(_0x4ce435,_0x187eb6){_0x187eb6=_0x187eb6||0x1f4;return function(_0x1a8e8e){logger['error'](_0x1a8e8e['stack']);if(_0x1a8e8e[_0x8127('0x2c')]){delete _0x1a8e8e[_0x8127('0x2c')];}_0x4ce435['status'](_0x187eb6)['send'](_0x1a8e8e);};}exports[_0x8127('0x2d')]=function(_0x10acd2,_0x114efc,_0x484b10){if(!_0x10acd2[_0x8127('0x2e')][_0x8127('0x2f')](_0x8127('0x30'))&&!_0x10acd2['body'][_0x8127('0x2f')](_0x8127('0x31'))){throw new db['Sequelize'][(_0x8127('0x32'))](_0x8127('0x33'));}else{if(_0x10acd2['body'][_0x8127('0x2f')](_0x8127('0x31'))&&!_0x10acd2[_0x8127('0x2e')]['hasOwnProperty'](_0x8127('0x34'))){throw new db[(_0x8127('0x35'))]['ValidationError'](_0x8127('0x36'));}if(!_0x10acd2[_0x8127('0x2e')][_0x8127('0x2f')](_0x8127('0x37'))){throw new db[(_0x8127('0x35'))][(_0x8127('0x32'))](_0x8127('0x38'));}else{try{var _0x5eb733=JSON[_0x8127('0x39')](_0x10acd2['body'][_0x8127('0x37')]);}catch(_0x279367){logger[_0x8127('0x3a')](_0x279367);throw new db[(_0x8127('0x35'))][(_0x8127('0x32'))](_0x8127('0x3b'));}var _0x52a2c5=[_0x8127('0x3c'),_0x8127('0x3d'),_0x8127('0x3e'),'openchannelqueue','smsqueue','voicequeue',_0x8127('0x3f'),_0x8127('0x40'),_0x8127('0x41')];if(_[_0x8127('0x42')](_0x5eb733,function(_0x585838){return!_[_0x8127('0x43')](_0x52a2c5,_0x585838['model'][_0x8127('0x44')]());})){throw new db[(_0x8127('0x35'))]['ValidationError'](_0x8127('0x45'));}}}var _0x50c425={};_0x50c425[_0x8127('0x46')]=_0x10acd2[_0x8127('0x2e')]['hasOwnProperty']('senderName')?_0x10acd2[_0x8127('0x2e')][_0x8127('0x46')]:_0x10acd2['user'][_0x8127('0x47')];_0x50c425[_0x8127('0x48')]=_[_0x8127('0x49')](_0x10acd2[_0x8127('0x2e')]['recipientsDescription'])?null:_0x10acd2[_0x8127('0x2e')][_0x8127('0x48')];_0x50c425['beep']=_0x10acd2[_0x8127('0x2e')][_0x8127('0x4a')]||![];_0x50c425[_0x8127('0x4b')]=_0x10acd2['user']['id'];return getContent(_0x10acd2[_0x8127('0x2e')])[_0x8127('0x29')](function(_0x204ae1){_0x50c425[_0x8127('0x2e')]=_0x204ae1;return getRecipients(_0x5eb733);})[_0x8127('0x29')](function(_0x53f1d5){_0x50c425['recipientsId']=_[_0x8127('0x4c')](_0x53f1d5)[_0x8127('0x4d')](',');return db[_0x8127('0x4e')][_0x8127('0x4f')](function(_0x4449d2){return db[_0x8127('0x50')][_0x8127('0x51')](_0x50c425,{'raw':!![],'transaction':_0x4449d2})[_0x8127('0x29')](function(_0x3328b4){var _0x223aa3={'sender':_0x50c425[_0x8127('0x46')],'description':_0x50c425[_0x8127('0x48')],'content':_0x50c425['body'],'beep':_0x50c425['beep']};_0x53f1d5[_0x8127('0x52')](function(_0x523d16){_0x223aa3[_0x8127('0x53')]=_0x523d16;socket['emit'](_0x8127('0x54'),_0x223aa3);});return _0x3328b4;});});})[_0x8127('0x29')](respondWithResult(_0x114efc,0xc9))['catch'](handleError(_0x114efc,null));};function getContent(_0xf78f77){return new BPromise(function(_0x1ba53d,_0x2a0696){if(_0xf78f77[_0x8127('0x30')]){_0x1ba53d(_0xf78f77[_0x8127('0x30')]);return;}return db[_0x8127('0x55')][_0x8127('0x56')]({'attributes':[_0x8127('0x57')],'where':{'id':_0xf78f77[_0x8127('0x31')]},'raw':!![]})['then'](function(_0x24a8d4){if(!_0x24a8d4)throw new db[(_0x8127('0x35'))]['ValidationError'](_0x8127('0x58'));var _0x27c616=Mustache[_0x8127('0x59')](_0x24a8d4[_0x8127('0x57')],_0xf78f77[_0x8127('0x34')]);_0x1ba53d(_0x27c616);})['catch'](function(_0x422ca5){_0x2a0696(_0x422ca5);});});}function getRecipients(_0x4092ad){return new BPromise(function(_0x3b398b,_0x4baafc){var _0x1196db=[];var _0x48834a=[];_0x4092ad[_0x8127('0x52')](function(_0x52b4d5){var _0x51764e=_[_0x8127('0x5a')](_0x52b4d5['model'][_0x8127('0x44')]());if(_0x51764e==='User'){_0x1196db=_[_0x8127('0x5b')](_0x1196db,_0x52b4d5['ids']);}else{if(_[_0x8127('0x43')](_0x51764e,_0x8127('0x5c')))_0x51764e=_0x51764e[_0x8127('0x5d')](_0x8127('0x5c'),'Queue');_0x52b4d5[_0x8127('0x5e')][_0x8127('0x52')](function(_0x49d9ee){_0x48834a[_0x8127('0x5f')](getAgents(_0x51764e,_0x49d9ee));});}});return BPromise[_0x8127('0x60')](_0x48834a)[_0x8127('0x29')](function(_0x333a6f){_0x1196db=_[_0x8127('0x5b')](_0x1196db,_[_0x8127('0x61')](_0x333a6f));_0x3b398b(_0x1196db);})[_0x8127('0x62')](function(_0x808f64){_0x4baafc(_0x808f64);});});}function getAgents(_0x7f74a7,_0x25afee){return new BPromise(function(_0x5f0c94,_0x171f57){return db[_0x7f74a7]['findOne']({'where':{'id':_0x25afee}})[_0x8127('0x29')](function(_0x4f6709){return _0x4f6709[_0x8127('0x63')]({'attributes':['id'],'raw':!![]})[_0x8127('0x29')](function(_0x39a0a2){var _0x4d5bb5=_[_0x8127('0x64')](_0x39a0a2,'id');_0x5f0c94(_0x4d5bb5);});})[_0x8127('0x62')](function(_0x527441){_0x171f57(_0x527441);});});} \ No newline at end of file +var _0x94c6=['error','stack','name','send','body','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','mailqueue','openchannelqueue','voicequeue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize','transaction','forEach','recipient','emit','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','User','union','ids','queue','Queue','push','flatten','getAgents','map','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then'];(function(_0x89fc66,_0x45bd91){var _0x417acb=function(_0x29323a){while(--_0x29323a){_0x89fc66['push'](_0x89fc66['shift']());}};_0x417acb(++_0x45bd91);}(_0x94c6,0x96));var _0x694c=function(_0x3cdaf1,_0x5e9c5f){_0x3cdaf1=_0x3cdaf1-0x0;var _0xdbcc68=_0x94c6[_0x3cdaf1];return _0xdbcc68;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x694c('0x0'));var zipdir=require(_0x694c('0x1'));var jsonpatch=require(_0x694c('0x2'));var rp=require('request-promise');var moment=require(_0x694c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x694c('0x4'));var util=require(_0x694c('0x5'));var path=require(_0x694c('0x6'));var sox=require('sox');var csv=require(_0x694c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x694c('0x8'));var _=require(_0x694c('0x9'));var squel=require(_0x694c('0xa'));var crypto=require('crypto');var jsforce=require(_0x694c('0xb'));var deskjs=require(_0x694c('0xc'));var toCsv=require(_0x694c('0x7'));var querystring=require(_0x694c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x694c('0xe'));var qs=require(_0x694c('0xf'));var as=require(_0x694c('0x10'));var hardwareService=require(_0x694c('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x694c('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x694c('0x13'))['db'];config[_0x694c('0x14')]=_['defaults'](config[_0x694c('0x14')],{'host':_0x694c('0x15'),'port':0x18eb});var socket=require(_0x694c('0x16'))(new Redis(config['redis']));require('./userNotification.socket')[_0x694c('0x17')](socket);function respondWithStatusCode(_0x4c6432,_0x2f2ecd){_0x2f2ecd=_0x2f2ecd||0xcc;return function(_0x425e5c){if(_0x425e5c){return _0x4c6432[_0x694c('0x18')](_0x2f2ecd);}return _0x4c6432['status'](_0x2f2ecd)[_0x694c('0x19')]();};}function respondWithResult(_0x554ddb,_0x3330e8){_0x3330e8=_0x3330e8||0xc8;return function(_0xe6a8e4){if(_0xe6a8e4){return _0x554ddb[_0x694c('0x1a')](_0x3330e8)[_0x694c('0x1b')](_0xe6a8e4);}};}function respondWithFilteredResult(_0x549ac8,_0x433daf){return function(_0x12569b){if(_0x12569b){var _0x5381d0=typeof _0x433daf['offset']===_0x694c('0x1c')&&typeof _0x433daf['limit']==='undefined';var _0x3fb5f5=_0x12569b[_0x694c('0x1d')];var _0xba8593=_0x5381d0?0x0:_0x433daf[_0x694c('0x1e')];var _0x1451b7=_0x5381d0?_0x12569b[_0x694c('0x1d')]:_0x433daf[_0x694c('0x1e')]+_0x433daf[_0x694c('0x1f')];var _0x2bad7d;if(_0x1451b7>=_0x3fb5f5){_0x1451b7=_0x3fb5f5;_0x2bad7d=0xc8;}else{_0x2bad7d=0xce;}_0x549ac8[_0x694c('0x1a')](_0x2bad7d);return _0x549ac8[_0x694c('0x20')](_0x694c('0x21'),_0xba8593+'-'+_0x1451b7+'/'+_0x3fb5f5)[_0x694c('0x1b')](_0x12569b);}return null;};}function patchUpdates(_0x5e25ce){return function(_0x2e5030){try{jsonpatch[_0x694c('0x22')](_0x2e5030,_0x5e25ce,!![]);}catch(_0x3268a7){return BPromise[_0x694c('0x23')](_0x3268a7);}return _0x2e5030['save']();};}function saveUpdates(_0x914607,_0x2471eb){return function(_0x1f86a4){if(_0x1f86a4){return _0x1f86a4[_0x694c('0x24')](_0x914607)[_0x694c('0x25')](function(_0x562dfd){return _0x562dfd;});}return null;};}function removeEntity(_0x444f78,_0x807a01){return function(_0x58044e){if(_0x58044e){return _0x58044e['destroy']()[_0x694c('0x25')](function(){_0x444f78['status'](0xcc)[_0x694c('0x19')]();});}};}function handleEntityNotFound(_0x228e36,_0x5d3d58){return function(_0x240a4e){if(!_0x240a4e){_0x228e36[_0x694c('0x18')](0x194);}return _0x240a4e;};}function handleError(_0x54d55d,_0x381c60){_0x381c60=_0x381c60||0x1f4;return function(_0x116730){logger[_0x694c('0x26')](_0x116730[_0x694c('0x27')]);if(_0x116730['name']){delete _0x116730[_0x694c('0x28')];}_0x54d55d[_0x694c('0x1a')](_0x381c60)[_0x694c('0x29')](_0x116730);};}exports['sendUserNotification']=function(_0x4121fe,_0xaea59a,_0xae5121){if(!_0x4121fe[_0x694c('0x2a')]['hasOwnProperty'](_0x694c('0x2b'))&&!_0x4121fe[_0x694c('0x2a')]['hasOwnProperty'](_0x694c('0x2c'))){throw new db[(_0x694c('0x2d'))][(_0x694c('0x2e'))](_0x694c('0x2f'));}else{if(_0x4121fe['body']['hasOwnProperty'](_0x694c('0x2c'))&&!_0x4121fe['body'][_0x694c('0x30')]('view')){throw new db[(_0x694c('0x2d'))][(_0x694c('0x2e'))](_0x694c('0x31'));}if(!_0x4121fe[_0x694c('0x2a')][_0x694c('0x30')](_0x694c('0x32'))){throw new db[(_0x694c('0x2d'))]['ValidationError'](_0x694c('0x33'));}else{try{var _0x2c9da7=JSON[_0x694c('0x34')](_0x4121fe['body'][_0x694c('0x32')]);}catch(_0x4eae54){logger[_0x694c('0x26')](_0x4eae54);throw new db[(_0x694c('0x2d'))][(_0x694c('0x2e'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x447a36=[_0x694c('0x35'),'faxqueue',_0x694c('0x36'),_0x694c('0x37'),'smsqueue',_0x694c('0x38'),'whatsappqueue',_0x694c('0x39'),_0x694c('0x3a')];if(_[_0x694c('0x3b')](_0x2c9da7,function(_0x118802){return!_[_0x694c('0x3c')](_0x447a36,_0x118802[_0x694c('0x3d')][_0x694c('0x3e')]());})){throw new db['Sequelize'][(_0x694c('0x2e'))](_0x694c('0x3f'));}}}var _0x53cebf={};_0x53cebf[_0x694c('0x40')]=_0x4121fe[_0x694c('0x2a')]['hasOwnProperty'](_0x694c('0x40'))?_0x4121fe[_0x694c('0x2a')]['senderName']:_0x4121fe[_0x694c('0x3a')][_0x694c('0x41')];_0x53cebf[_0x694c('0x42')]=_[_0x694c('0x43')](_0x4121fe['body'][_0x694c('0x42')])?null:_0x4121fe[_0x694c('0x2a')][_0x694c('0x42')];_0x53cebf[_0x694c('0x44')]=_0x4121fe[_0x694c('0x2a')][_0x694c('0x44')]||![];_0x53cebf[_0x694c('0x45')]=_0x4121fe[_0x694c('0x3a')]['id'];return getContent(_0x4121fe[_0x694c('0x2a')])['then'](function(_0x436bda){_0x53cebf['body']=_0x436bda;return getRecipients(_0x2c9da7);})[_0x694c('0x25')](function(_0xee0df8){_0x53cebf[_0x694c('0x46')]=_[_0x694c('0x47')](_0xee0df8)['join'](',');return db[_0x694c('0x48')][_0x694c('0x49')](function(_0x2e1275){return db['UserNotification']['create'](_0x53cebf,{'raw':!![],'transaction':_0x2e1275})[_0x694c('0x25')](function(_0x2d0d98){var _0x403c86={'sender':_0x53cebf[_0x694c('0x40')],'description':_0x53cebf[_0x694c('0x42')],'content':_0x53cebf[_0x694c('0x2a')],'beep':_0x53cebf[_0x694c('0x44')]};_0xee0df8[_0x694c('0x4a')](function(_0x1dc712){_0x403c86[_0x694c('0x4b')]=_0x1dc712;socket[_0x694c('0x4c')]('userNotification:send',_0x403c86);});return _0x2d0d98;});});})['then'](respondWithResult(_0xaea59a,0xc9))[_0x694c('0x4d')](handleError(_0xaea59a,null));};function getContent(_0x2df255){return new BPromise(function(_0xac297a,_0x31e6b7){if(_0x2df255[_0x694c('0x2b')]){_0xac297a(_0x2df255[_0x694c('0x2b')]);return;}return db[_0x694c('0x4e')][_0x694c('0x4f')]({'attributes':[_0x694c('0x50')],'where':{'id':_0x2df255['TemplateId']},'raw':!![]})[_0x694c('0x25')](function(_0x43d364){if(!_0x43d364)throw new db[(_0x694c('0x2d'))][(_0x694c('0x2e'))](_0x694c('0x51'));var _0x2ddf43=Mustache[_0x694c('0x52')](_0x43d364['html'],_0x2df255[_0x694c('0x53')]);_0xac297a(_0x2ddf43);})['catch'](function(_0x4dbf71){_0x31e6b7(_0x4dbf71);});});}function getRecipients(_0x48e18a){return new BPromise(function(_0x37c95d,_0x30b28e){var _0x231e2d=[];var _0x4c4e02=[];_0x48e18a[_0x694c('0x4a')](function(_0x20b395){var _0x3320e8=_[_0x694c('0x54')](_0x20b395[_0x694c('0x3d')]['toLowerCase']());if(_0x3320e8===_0x694c('0x55')){_0x231e2d=_[_0x694c('0x56')](_0x231e2d,_0x20b395[_0x694c('0x57')]);}else{if(_[_0x694c('0x3c')](_0x3320e8,_0x694c('0x58')))_0x3320e8=_0x3320e8['replace']('queue',_0x694c('0x59'));_0x20b395['ids']['forEach'](function(_0x5b93b3){_0x4c4e02[_0x694c('0x5a')](getAgents(_0x3320e8,_0x5b93b3));});}});return BPromise['all'](_0x4c4e02)['then'](function(_0x3e6594){_0x231e2d=_[_0x694c('0x56')](_0x231e2d,_[_0x694c('0x5b')](_0x3e6594));_0x37c95d(_0x231e2d);})[_0x694c('0x4d')](function(_0x547073){_0x30b28e(_0x547073);});});}function getAgents(_0xa19234,_0x2c2bf4){return new BPromise(function(_0xbb032b,_0x2cd4da){return db[_0xa19234][_0x694c('0x4f')]({'where':{'id':_0x2c2bf4}})[_0x694c('0x25')](function(_0x1cd44d){return _0x1cd44d[_0x694c('0x5c')]({'attributes':['id'],'raw':!![]})[_0x694c('0x25')](function(_0x1a0d51){var _0x5619e8=_[_0x694c('0x5d')](_0x1a0d51,'id');_0xbb032b(_0x5619e8);});})[_0x694c('0x4d')](function(_0x271a10){_0x2cd4da(_0x271a10);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 9dd22a2..1d3d42c 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 _0x15d5=['hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit'];(function(_0x566e64,_0x42bb05){var _0x3bb7b6=function(_0x31fa1d){while(--_0x31fa1d){_0x566e64['push'](_0x566e64['shift']());}};_0x3bb7b6(++_0x42bb05);}(_0x15d5,0x7c));var _0x515d=function(_0x53d40d,_0x4a799a){_0x53d40d=_0x53d40d-0x0;var _0x218495=_0x15d5[_0x53d40d];return _0x218495;};'use strict';var EventEmitter=require(_0x515d('0x0'));var UserNotification=require(_0x515d('0x1'))['db'][_0x515d('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x515d('0x3')](0x0);var events={'afterCreate':_0x515d('0x4'),'afterUpdate':_0x515d('0x5'),'afterDestroy':_0x515d('0x6')};function emitEvent(_0x5f144e){return function(_0x4424e5,_0x174b44,_0xe7ca05){UserNotificationEvents[_0x515d('0x7')](_0x5f144e+':'+_0x4424e5['id'],_0x4424e5);UserNotificationEvents[_0x515d('0x7')](_0x5f144e,_0x4424e5);_0xe7ca05(null);};}for(var e in events){if(events[_0x515d('0x8')](e)){var event=events[e];UserNotification[_0x515d('0x9')](e,emitEvent(event));}}module[_0x515d('0xa')]=UserNotificationEvents; \ No newline at end of file +var _0x3ef7=['events','UserNotification','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3ef7,0x1f4));var _0x73ef=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3ef7[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x73ef('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x73ef('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x73ef('0x2')](0x0);var events={'afterCreate':_0x73ef('0x3'),'afterUpdate':_0x73ef('0x4'),'afterDestroy':_0x73ef('0x5')};function emitEvent(_0x163da1){return function(_0x499776,_0x4f041b,_0x2a0369){UserNotificationEvents[_0x73ef('0x6')](_0x163da1+':'+_0x499776['id'],_0x499776);UserNotificationEvents[_0x73ef('0x6')](_0x163da1,_0x499776);_0x2a0369(null);};}for(var e in events){if(events[_0x73ef('0x7')](e)){var event=events[e];UserNotification[_0x73ef('0x8')](e,emitEvent(event));}}module[_0x73ef('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index b638a37..d35af5a 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 _0x946c=['./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x37aeea,_0x56b1a8){var _0x4d58f1=function(_0x38079c){while(--_0x38079c){_0x37aeea['push'](_0x37aeea['shift']());}};_0x4d58f1(++_0x56b1a8);}(_0x946c,0x1e7));var _0xc946=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x946c[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0xc946('0x0'));var util=require(_0xc946('0x1'));var logger=require(_0xc946('0x2'))(_0xc946('0x3'));var moment=require(_0xc946('0x4'));var BPromise=require(_0xc946('0x5'));var rp=require(_0xc946('0x6'));var fs=require('fs');var path=require(_0xc946('0x7'));var rimraf=require('rimraf');var config=require(_0xc946('0x8'));var attributes=require(_0xc946('0x9'));module[_0xc946('0xa')]=function(_0xcd8362,_0x47e597){return _0xcd8362[_0xc946('0xb')](_0xc946('0xc'),attributes,{'tableName':_0xc946('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc946('0xe'),'collate':_0xc946('0xf')});}; \ No newline at end of file +var _0xe00f=['rimraf','../../config/environment','exports','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x53d5d6,_0x168987){var _0x401965=function(_0x177a8e){while(--_0x177a8e){_0x53d5d6['push'](_0x53d5d6['shift']());}};_0x401965(++_0x168987);}(_0xe00f,0x14b));var _0xfe00=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xe00f[_0x481bf7];return _0x461787;};'use strict';var _=require(_0xfe00('0x0'));var util=require(_0xfe00('0x1'));var logger=require('../../config/logger')(_0xfe00('0x2'));var moment=require(_0xfe00('0x3'));var BPromise=require(_0xfe00('0x4'));var rp=require(_0xfe00('0x5'));var fs=require('fs');var path=require(_0xfe00('0x6'));var rimraf=require(_0xfe00('0x7'));var config=require(_0xfe00('0x8'));var attributes=require('./userNotification.attributes');module[_0xfe00('0x9')]=function(_0x4eac9d,_0x4c4705){return _0x4eac9d['define']('UserNotification',attributes,{'tableName':_0xfe00('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfe00('0xb'),'collate':_0xfe00('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 1359c52..fa88a21 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 _0xa159=['../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x6571b1,_0x17fa5f){var _0xadc4af=function(_0x5d9435){while(--_0x5d9435){_0x6571b1['push'](_0x6571b1['shift']());}};_0xadc4af(++_0x17fa5f);}(_0xa159,0xc3));var _0x9a15=function(_0x558c43,_0x1eec23){_0x558c43=_0x558c43-0x0;var _0x40c586=_0xa159[_0x558c43];return _0x40c586;};'use strict';var _=require(_0x9a15('0x0'));var util=require(_0x9a15('0x1'));var moment=require(_0x9a15('0x2'));var BPromise=require('bluebird');var rs=require(_0x9a15('0x3'));var fs=require('fs');var Redis=require(_0x9a15('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9a15('0x5'));var logger=require(_0x9a15('0x6'))('rpc');var config=require(_0x9a15('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9a15('0x8')][_0x9a15('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9a15('0xa')],{'host':_0x9a15('0xb'),'port':0x18eb});var socket=require(_0x9a15('0xc'))(new Redis(config[_0x9a15('0xa')]));require(_0x9a15('0xd'))[_0x9a15('0xe')](socket);function respondWithRpcPromise(_0xc62a93,_0x5b565a,_0x2c2d6c){return new BPromise(function(_0xb9e656,_0x14728c){return client[_0x9a15('0xf')](_0xc62a93,_0x2c2d6c)[_0x9a15('0x10')](function(_0x3396c9){logger[_0x9a15('0x11')](_0x9a15('0x12'),_0x5b565a,_0x9a15('0x13'));logger[_0x9a15('0x14')](_0x9a15('0x15'),_0x5b565a,'request\x20sent',JSON['stringify'](_0x3396c9));if(_0x3396c9[_0x9a15('0x16')]){if(_0x3396c9['error']['code']===0x1f4){logger[_0x9a15('0x16')](_0x9a15('0x12'),_0x5b565a,_0x3396c9['error'][_0x9a15('0x17')]);return _0x14728c(_0x3396c9[_0x9a15('0x16')][_0x9a15('0x17')]);}logger[_0x9a15('0x16')](_0x9a15('0x12'),_0x5b565a,_0x3396c9['error'][_0x9a15('0x17')]);return _0xb9e656(_0x3396c9[_0x9a15('0x16')][_0x9a15('0x17')]);}else{logger[_0x9a15('0x11')](_0x9a15('0x12'),_0x5b565a,_0x9a15('0x13'));_0xb9e656(_0x3396c9[_0x9a15('0x18')]['message']);}})['catch'](function(_0x870937){logger[_0x9a15('0x16')](_0x9a15('0x12'),_0x5b565a,_0x870937);_0x14728c(_0x870937);});});} \ No newline at end of file +var _0x1706=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','then','info','UserNotification,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x3fd750,_0x120661){var _0x4f15d9=function(_0x3181b8){while(--_0x3181b8){_0x3fd750['push'](_0x3fd750['shift']());}};_0x4f15d9(++_0x120661);}(_0x1706,0x1d8));var _0x6170=function(_0x27fc64,_0x3cf15b){_0x27fc64=_0x27fc64-0x0;var _0x51a9fb=_0x1706[_0x27fc64];return _0x51a9fb;};'use strict';var _=require(_0x6170('0x0'));var util=require(_0x6170('0x1'));var moment=require(_0x6170('0x2'));var BPromise=require('bluebird');var rs=require(_0x6170('0x3'));var fs=require('fs');var Redis=require(_0x6170('0x4'));var db=require(_0x6170('0x5'))['db'];var utils=require(_0x6170('0x6'));var logger=require('../../config/logger')(_0x6170('0x7'));var config=require(_0x6170('0x8'));var jayson=require(_0x6170('0x9'));var client=jayson[_0x6170('0xa')][_0x6170('0xb')]({'port':0x232a});config[_0x6170('0xc')]=_['defaults'](config['redis'],{'host':_0x6170('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6170('0xc')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x243d73,_0x29aa1e,_0x293c8d){return new BPromise(function(_0x225adc,_0xbd3a2f){return client['request'](_0x243d73,_0x293c8d)[_0x6170('0xe')](function(_0x55b9ef){logger[_0x6170('0xf')](_0x6170('0x10'),_0x29aa1e,'request\x20sent');logger[_0x6170('0x11')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x29aa1e,_0x6170('0x12'),JSON[_0x6170('0x13')](_0x55b9ef));if(_0x55b9ef[_0x6170('0x14')]){if(_0x55b9ef[_0x6170('0x14')][_0x6170('0x15')]===0x1f4){logger['error'](_0x6170('0x10'),_0x29aa1e,_0x55b9ef[_0x6170('0x14')][_0x6170('0x16')]);return _0xbd3a2f(_0x55b9ef[_0x6170('0x14')][_0x6170('0x16')]);}logger[_0x6170('0x14')]('UserNotification,\x20%s,\x20%s',_0x29aa1e,_0x55b9ef['error'][_0x6170('0x16')]);return _0x225adc(_0x55b9ef[_0x6170('0x14')]['message']);}else{logger['info'](_0x6170('0x10'),_0x29aa1e,_0x6170('0x12'));_0x225adc(_0x55b9ef[_0x6170('0x17')]['message']);}})[_0x6170('0x18')](function(_0x2881c3){logger[_0x6170('0x14')](_0x6170('0x10'),_0x29aa1e,_0x2881c3);_0xbd3a2f(_0x2881c3);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index f17590c..590cc42 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 _0x2c7d=['save','remove','emit','removeListener','register','./userNotification.events'];(function(_0x2b101b,_0x2077f7){var _0x4ac093=function(_0x29152d){while(--_0x29152d){_0x2b101b['push'](_0x2b101b['shift']());}};_0x4ac093(++_0x2077f7);}(_0x2c7d,0x1d9));var _0xd2c7=function(_0x1d0aca,_0x52b7a7){_0x1d0aca=_0x1d0aca-0x0;var _0x2233ee=_0x2c7d[_0x1d0aca];return _0x2233ee;};'use strict';var UserNotificationEvents=require(_0xd2c7('0x0'));var events=[_0xd2c7('0x1'),_0xd2c7('0x2'),'update'];function createListener(_0x1e5b15,_0x49eeb4){return function(_0x178535){_0x49eeb4[_0xd2c7('0x3')](_0x1e5b15,_0x178535);};}function removeListener(_0x20a803,_0x42dd67){return function(){UserNotificationEvents[_0xd2c7('0x4')](_0x20a803,_0x42dd67);};}exports[_0xd2c7('0x5')]=function(_0x26bf21){for(var _0x5eeac5=0x0,_0x2d7e92=events['length'];_0x5eeac5<_0x2d7e92;_0x5eeac5++){var _0x1c0cc6=events[_0x5eeac5];var _0x21ab1c=createListener('userNotification:'+_0x1c0cc6,_0x26bf21);UserNotificationEvents['on'](_0x1c0cc6,_0x21ab1c);}}; \ No newline at end of file +var _0x735f=['length','./userNotification.events','remove','update','emit','removeListener','register'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x735f,0x112));var _0xf735=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x735f[_0x3dd15e];return _0x231fd0;};'use strict';var UserNotificationEvents=require(_0xf735('0x0'));var events=['save',_0xf735('0x1'),_0xf735('0x2')];function createListener(_0x7e0b0e,_0x558409){return function(_0x37d3f8){_0x558409[_0xf735('0x3')](_0x7e0b0e,_0x37d3f8);};}function removeListener(_0x4de7e6,_0x3f0643){return function(){UserNotificationEvents[_0xf735('0x4')](_0x4de7e6,_0x3f0643);};}exports[_0xf735('0x5')]=function(_0x4cabaf){for(var _0x566ff0=0x0,_0x410df3=events[_0xf735('0x6')];_0x566ff0<_0x410df3;_0x566ff0++){var _0x30ad1b=events[_0x566ff0];var _0x3709ed=createListener('userNotification:'+_0x30ad1b,_0x4cabaf);UserNotificationEvents['on'](_0x30ad1b,_0x3709ed);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index e18fb95..ef3a048 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5d5927,_0x21ce0f){var _0x7b3408=function(_0x55e20b){while(--_0x55e20b){_0x5d5927['push'](_0x5d5927['shift']());}};_0x7b3408(++_0x21ce0f);}(_0xedd9,0xfc));var _0x9edd=function(_0x50df10,_0x52332e){_0x50df10=_0x50df10-0x0;var _0x320b14=_0xedd9[_0x50df10];return _0x320b14;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x114135,_0x1636a0){var _0x7c7e22=function(_0x43cbf3){while(--_0x43cbf3){_0x114135['push'](_0x114135['shift']());}};_0x7c7e22(++_0x1636a0);}(_0x70e0,0x17b));var _0x070e=function(_0x4f9223,_0x330bf1){_0x4f9223=_0x4f9223-0x0;var _0x4165c5=_0x70e0[_0x4f9223];return _0x4165c5;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 275153a..2f80bca 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 _0x8c05=['INTEGER','sequelize','exports'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0x8c05,0x1e4));var _0x58c0=function(_0x3fe720,_0x22664a){_0x3fe720=_0x3fe720-0x0;var _0x17c702=_0x8c05[_0x3fe720];return _0x17c702;};'use strict';var Sequelize=require(_0x58c0('0x0'));module[_0x58c0('0x1')]={'penalty':{'type':Sequelize[_0x58c0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb905=['INTEGER','sequelize'];(function(_0x36c7f0,_0x294d21){var _0x23fd16=function(_0x2442ef){while(--_0x2442ef){_0x36c7f0['push'](_0x36c7f0['shift']());}};_0x23fd16(++_0x294d21);}(_0xb905,0xa7));var _0x5b90=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xb905[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require(_0x5b90('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x5b90('0x1')],'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 aeb4434..ed28a50 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 _0xc7fe=['util','../../config/logger','api','moment','bluebird','path','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash'];(function(_0x3bd703,_0x230988){var _0xf8270a=function(_0xf6c63a){while(--_0xf6c63a){_0x3bd703['push'](_0x3bd703['shift']());}};_0xf8270a(++_0x230988);}(_0xc7fe,0xa4));var _0xec7f=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xc7fe[_0x257642];return _0x3d813b;};'use strict';var _=require(_0xec7f('0x0'));var util=require(_0xec7f('0x1'));var logger=require(_0xec7f('0x2'))(_0xec7f('0x3'));var moment=require(_0xec7f('0x4'));var BPromise=require(_0xec7f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec7f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xec7f('0x7'));module[_0xec7f('0x8')]=function(_0x41259f,_0x2d537c){return _0x41259f['define'](_0xec7f('0x9'),attributes,{'tableName':_0xec7f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4f2=['bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api','moment'];(function(_0xfa48f3,_0x3bce6c){var _0x47694f=function(_0x2431e8){while(--_0x2431e8){_0xfa48f3['push'](_0xfa48f3['shift']());}};_0x47694f(++_0x3bce6c);}(_0xc4f2,0xbc));var _0x2c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2c4f('0x0'));var logger=require(_0x2c4f('0x1'))(_0x2c4f('0x2'));var moment=require(_0x2c4f('0x3'));var BPromise=require(_0x2c4f('0x4'));var rp=require(_0x2c4f('0x5'));var fs=require('fs');var path=require(_0x2c4f('0x6'));var rimraf=require(_0x2c4f('0x7'));var config=require(_0x2c4f('0x8'));var attributes=require(_0x2c4f('0x9'));module['exports']=function(_0x414065,_0x229bb5){return _0x414065['define'](_0x2c4f('0xa'),attributes,{'tableName':_0x2c4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 0abde87..0409668 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 _0x8422=['error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8422,0x89));var _0x2842=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0x8422[_0xaaf2e2];return _0x28bc36;};'use strict';var _=require(_0x2842('0x0'));var util=require(_0x2842('0x1'));var moment=require(_0x2842('0x2'));var BPromise=require(_0x2842('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2842('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2842('0x5'));var logger=require('../../config/logger')(_0x2842('0x6'));var config=require(_0x2842('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2842('0x8')][_0x2842('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad15d,_0x16d908,_0x15fa4b){return new BPromise(function(_0x2904fb,_0x2678ca){return client['request'](_0x3ad15d,_0x15fa4b)[_0x2842('0xa')](function(_0x5d8486){logger[_0x2842('0xb')](_0x2842('0xc'),_0x16d908,'request\x20sent');logger[_0x2842('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x16d908,'request\x20sent',JSON[_0x2842('0xe')](_0x5d8486));if(_0x5d8486[_0x2842('0xf')]){if(_0x5d8486['error']['code']===0x1f4){logger[_0x2842('0xf')](_0x2842('0xc'),_0x16d908,_0x5d8486[_0x2842('0xf')][_0x2842('0x10')]);return _0x2678ca(_0x5d8486['error']['message']);}logger['error'](_0x2842('0xc'),_0x16d908,_0x5d8486[_0x2842('0xf')][_0x2842('0x10')]);return _0x2904fb(_0x5d8486[_0x2842('0xf')][_0x2842('0x10')]);}else{logger['info'](_0x2842('0xc'),_0x16d908,'request\x20sent');_0x2904fb(_0x5d8486[_0x2842('0x11')][_0x2842('0x10')]);}})[_0x2842('0x12')](function(_0x5d600c){logger[_0x2842('0xf')](_0x2842('0xc'),_0x16d908,_0x5d600c);_0x2678ca(_0x5d600c);});});} \ No newline at end of file +var _0xf3a1=['lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3e5bf0,_0x2e9af1){var _0x4b5b79=function(_0x56bb6e){while(--_0x56bb6e){_0x3e5bf0['push'](_0x3e5bf0['shift']());}};_0x4b5b79(++_0x2e9af1);}(_0xf3a1,0x6e));var _0x1f3a=function(_0xdf34cc,_0x223241){_0xdf34cc=_0xdf34cc-0x0;var _0x510795=_0xf3a1[_0xdf34cc];return _0x510795;};'use strict';var _=require(_0x1f3a('0x0'));var util=require(_0x1f3a('0x1'));var moment=require(_0x1f3a('0x2'));var BPromise=require(_0x1f3a('0x3'));var rs=require(_0x1f3a('0x4'));var fs=require('fs');var Redis=require(_0x1f3a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1f3a('0x6'));var config=require(_0x1f3a('0x7'));var jayson=require(_0x1f3a('0x8'));var client=jayson[_0x1f3a('0x9')][_0x1f3a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe7f116,_0x142bcc,_0x300bee){return new BPromise(function(_0x492ac3,_0x573c84){return client['request'](_0xe7f116,_0x300bee)[_0x1f3a('0xb')](function(_0x27c081){logger[_0x1f3a('0xc')](_0x1f3a('0xd'),_0x142bcc,_0x1f3a('0xe'));logger[_0x1f3a('0xf')](_0x1f3a('0x10'),_0x142bcc,_0x1f3a('0xe'),JSON[_0x1f3a('0x11')](_0x27c081));if(_0x27c081[_0x1f3a('0x12')]){if(_0x27c081[_0x1f3a('0x12')][_0x1f3a('0x13')]===0x1f4){logger[_0x1f3a('0x12')](_0x1f3a('0xd'),_0x142bcc,_0x27c081['error']['message']);return _0x573c84(_0x27c081[_0x1f3a('0x12')]['message']);}logger[_0x1f3a('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x142bcc,_0x27c081[_0x1f3a('0x12')][_0x1f3a('0x14')]);return _0x492ac3(_0x27c081[_0x1f3a('0x12')][_0x1f3a('0x14')]);}else{logger[_0x1f3a('0xc')](_0x1f3a('0xd'),_0x142bcc,_0x1f3a('0xe'));_0x492ac3(_0x27c081[_0x1f3a('0x15')][_0x1f3a('0x14')]);}})['catch'](function(_0x25ada4){logger[_0x1f3a('0x12')](_0x1f3a('0xd'),_0x142bcc,_0x25ada4);_0x573c84(_0x25ada4);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 8247028..9703339 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 _0xe41d=['getSections','getResources','post','create','clone','/:id/sections','addSections','addResources','update','delete','/:id/resources','removeResources','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','show'];(function(_0x5ce34a,_0x57887e){var _0x309350=function(_0x52a947){while(--_0x52a947){_0x5ce34a['push'](_0x5ce34a['shift']());}};_0x309350(++_0x57887e);}(_0xe41d,0x1bd));var _0xde41=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe41d[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xde41('0x0'));var util=require(_0xde41('0x1'));var path=require(_0xde41('0x2'));var timeout=require(_0xde41('0x3'));var express=require('express');var router=express[_0xde41('0x4')]();var fs_extra=require(_0xde41('0x5'));var auth=require(_0xde41('0x6'));var interaction=require(_0xde41('0x7'));var config=require(_0xde41('0x8'));var controller=require('./userProfile.controller');router[_0xde41('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xde41('0xa'),auth[_0xde41('0xb')](),controller['describe']);router[_0xde41('0x9')](_0xde41('0xc'),auth[_0xde41('0xb')](),controller[_0xde41('0xd')]);router['get']('/:id/sections',auth[_0xde41('0xb')](),controller[_0xde41('0xe')]);router[_0xde41('0x9')]('/:id/resources',auth[_0xde41('0xb')](),controller[_0xde41('0xf')]);router[_0xde41('0x10')]('/',auth[_0xde41('0xb')](),controller[_0xde41('0x11')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0xde41('0x12')]);router[_0xde41('0x10')](_0xde41('0x13'),auth[_0xde41('0xb')](),controller[_0xde41('0x14')]);router['post']('/:id/resources',auth['isAuthenticated'](),controller[_0xde41('0x15')]);router['put'](_0xde41('0xc'),auth[_0xde41('0xb')](),controller[_0xde41('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xde41('0x13'),auth[_0xde41('0xb')](),controller['removeSections']);router[_0xde41('0x17')](_0xde41('0x18'),auth['isAuthenticated'](),controller[_0xde41('0x19')]);module[_0xde41('0x1a')]=router; \ No newline at end of file +var _0x7794=['removeSections','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','/:id/sections','/:id/resources','getResources','post','create','clone','addSections','put','update','delete','destroy'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x7794,0x16a));var _0x4779=function(_0x455453,_0x3ed4b3){_0x455453=_0x455453-0x0;var _0x5174b4=_0x7794[_0x455453];return _0x5174b4;};'use strict';var multer=require('multer');var util=require(_0x4779('0x0'));var path=require(_0x4779('0x1'));var timeout=require('connect-timeout');var express=require(_0x4779('0x2'));var router=express['Router']();var fs_extra=require(_0x4779('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4779('0x4'));var config=require(_0x4779('0x5'));var controller=require('./userProfile.controller');router[_0x4779('0x6')]('/',auth[_0x4779('0x7')](),controller[_0x4779('0x8')]);router['get']('/describe',auth[_0x4779('0x7')](),controller[_0x4779('0x9')]);router[_0x4779('0x6')](_0x4779('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x4779('0xb'),auth['isAuthenticated'](),controller['getSections']);router[_0x4779('0x6')](_0x4779('0xc'),auth[_0x4779('0x7')](),controller[_0x4779('0xd')]);router[_0x4779('0xe')]('/',auth['isAuthenticated'](),controller[_0x4779('0xf')]);router['post']('/:id/clone',auth[_0x4779('0x7')](),controller[_0x4779('0x10')]);router['post'](_0x4779('0xb'),auth[_0x4779('0x7')](),controller[_0x4779('0x11')]);router['post']('/:id/resources',auth[_0x4779('0x7')](),controller['addResources']);router[_0x4779('0x12')](_0x4779('0xa'),auth[_0x4779('0x7')](),controller[_0x4779('0x13')]);router[_0x4779('0x14')]('/:id',auth[_0x4779('0x7')](),controller[_0x4779('0x15')]);router[_0x4779('0x14')](_0x4779('0xb'),auth[_0x4779('0x7')](),controller[_0x4779('0x16')]);router[_0x4779('0x14')](_0x4779('0xc'),auth[_0x4779('0x7')](),controller['removeResources']);module[_0x4779('0x17')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 33369ac..66bc8b6 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 _0xd9b0=['BOOLEAN','sequelize','exports','name','STRING','setDataValue','join','crudPermissions','getDataValue','split'];(function(_0x12419a,_0x799c14){var _0x320828=function(_0x9904f8){while(--_0x9904f8){_0x12419a['push'](_0x12419a['shift']());}};_0x320828(++_0x799c14);}(_0xd9b0,0x14b));var _0x0d9b=function(_0x3b9a67,_0x1fb08f){_0x3b9a67=_0x3b9a67-0x0;var _0x31dd64=_0xd9b0[_0x3b9a67];return _0x31dd64;};'use strict';var Sequelize=require(_0x0d9b('0x0'));module[_0x0d9b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0d9b('0x2')},'crudPermissions':{'type':Sequelize[_0x0d9b('0x3')],'set':function(_0x1e661c){this[_0x0d9b('0x4')]('crudPermissions',_0x1e661c?_0x1e661c[_0x0d9b('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x0d9b('0x6'))?this[_0x0d9b('0x7')](_0x0d9b('0x6'))[_0x0d9b('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0d9b('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x0d9b('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x0d9b('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x0d9b('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x0d9b('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x0d9b('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0d9b('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x0d9b('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xb934=['setDataValue','crudPermissions','getDataValue','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb934,0x164));var _0x4b93=function(_0x3fe2b1,_0x967d3b){_0x3fe2b1=_0x3fe2b1-0x0;var _0xeff4db=_0xb934[_0x3fe2b1];return _0xeff4db;};'use strict';var Sequelize=require(_0x4b93('0x0'));module[_0x4b93('0x1')]={'name':{'type':Sequelize[_0x4b93('0x2')],'allowNull':![],'unique':_0x4b93('0x3')},'crudPermissions':{'type':Sequelize[_0x4b93('0x2')],'set':function(_0x56b232){this[_0x4b93('0x4')](_0x4b93('0x5'),_0x56b232?_0x56b232['join'](''):[]);},'get':function(){return this[_0x4b93('0x6')]('crudPermissions')?this[_0x4b93('0x6')](_0x4b93('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x4b93('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x4b93('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x4b93('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x4b93('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x4b93('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x4b93('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4b93('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'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 34f5e12..c6478c2 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 _0xbdfb=['sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','clone','find','get','createdAt','updatedAt','crudPermissions','omit','transaction','each','autoAssociation','sectionId','Resources','UserProfileSection','destroy','describe','addSections','sequelize','userProfileId','UserProfileResource','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','Missing\x20section\x20parameter','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./userProfile.socket','sendStatus','status','offset','undefined','count','limit','set','apply','reject','update','then','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order'];(function(_0x52da6f,_0x1265bb){var _0x13c634=function(_0x400ea9){while(--_0x400ea9){_0x52da6f['push'](_0x52da6f['shift']());}};_0x13c634(++_0x1265bb);}(_0xbdfb,0x1ef));var _0xbbdf=function(_0x3be2e2,_0x5c166d){_0x3be2e2=_0x3be2e2-0x0;var _0x53b9c5=_0xbdfb[_0x3be2e2];return _0x53b9c5;};'use strict';var emlformat=require(_0xbbdf('0x0'));var rimraf=require(_0xbbdf('0x1'));var zipdir=require(_0xbbdf('0x2'));var jsonpatch=require(_0xbbdf('0x3'));var rp=require(_0xbbdf('0x4'));var moment=require(_0xbbdf('0x5'));var BPromise=require(_0xbbdf('0x6'));var Mustache=require(_0xbbdf('0x7'));var util=require(_0xbbdf('0x8'));var path=require(_0xbbdf('0x9'));var sox=require('sox');var csv=require(_0xbbdf('0xa'));var ejs=require(_0xbbdf('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbbdf('0xc'));var squel=require(_0xbbdf('0xd'));var crypto=require('crypto');var jsforce=require(_0xbbdf('0xe'));var deskjs=require(_0xbbdf('0xf'));var toCsv=require(_0xbbdf('0xa'));var querystring=require(_0xbbdf('0x10'));var Papa=require('papaparse');var Redis=require(_0xbbdf('0x11'));var authService=require(_0xbbdf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbbdf('0x13'));var hardwareService=require(_0xbbdf('0x14'));var logger=require(_0xbbdf('0x15'))(_0xbbdf('0x16'));var utils=require('../../config/utils');var config=require(_0xbbdf('0x17'));var licenseUtil=require(_0xbbdf('0x18'));var db=require(_0xbbdf('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbbdf('0x1a'))(new Redis(config[_0xbbdf('0x1b')]));require(_0xbbdf('0x1c'))['register'](socket);function respondWithStatusCode(_0x215cba,_0x2022ba){_0x2022ba=_0x2022ba||0xcc;return function(_0x27c4ff){if(_0x27c4ff){return _0x215cba[_0xbbdf('0x1d')](_0x2022ba);}return _0x215cba[_0xbbdf('0x1e')](_0x2022ba)['end']();};}function respondWithResult(_0x41a6e2,_0x46968e){_0x46968e=_0x46968e||0xc8;return function(_0x1f1a7f){if(_0x1f1a7f){return _0x41a6e2['status'](_0x46968e)['json'](_0x1f1a7f);}};}function respondWithFilteredResult(_0x9cd7d6,_0x185803){return function(_0xa723dc){if(_0xa723dc){var _0x276062=typeof _0x185803[_0xbbdf('0x1f')]==='undefined'&&typeof _0x185803['limit']===_0xbbdf('0x20');var _0x3e9ac9=_0xa723dc[_0xbbdf('0x21')];var _0x43e3f6=_0x276062?0x0:_0x185803[_0xbbdf('0x1f')];var _0x2c668b=_0x276062?_0xa723dc[_0xbbdf('0x21')]:_0x185803[_0xbbdf('0x1f')]+_0x185803[_0xbbdf('0x22')];var _0x2e8b17;if(_0x2c668b>=_0x3e9ac9){_0x2c668b=_0x3e9ac9;_0x2e8b17=0xc8;}else{_0x2e8b17=0xce;}_0x9cd7d6[_0xbbdf('0x1e')](_0x2e8b17);return _0x9cd7d6[_0xbbdf('0x23')]('Content-Range',_0x43e3f6+'-'+_0x2c668b+'/'+_0x3e9ac9)['json'](_0xa723dc);}return null;};}function patchUpdates(_0xb39b4b){return function(_0x540bcb){try{jsonpatch[_0xbbdf('0x24')](_0x540bcb,_0xb39b4b,!![]);}catch(_0x32fcf6){return BPromise[_0xbbdf('0x25')](_0x32fcf6);}return _0x540bcb['save']();};}function saveUpdates(_0x440f2a,_0x1c9036){return function(_0xbe39d4){if(_0xbe39d4){return _0xbe39d4[_0xbbdf('0x26')](_0x440f2a)['then'](function(_0xa67162){return _0xa67162;});}return null;};}function removeEntity(_0x391c42,_0x9d9067){return function(_0x5c8824){if(_0x5c8824){return _0x5c8824['destroy']()[_0xbbdf('0x27')](function(){_0x391c42['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ff60d,_0x16f14d){return function(_0x1d8590){if(!_0x1d8590){_0x3ff60d[_0xbbdf('0x1d')](0x194);}return _0x1d8590;};}function handleError(_0x28c283,_0x436f58){_0x436f58=_0x436f58||0x1f4;return function(_0x2b20bb){logger['error'](_0x2b20bb[_0xbbdf('0x28')]);if(_0x2b20bb[_0xbbdf('0x29')]){delete _0x2b20bb[_0xbbdf('0x29')];}_0x28c283[_0xbbdf('0x1e')](_0x436f58)[_0xbbdf('0x2a')](_0x2b20bb);};}exports[_0xbbdf('0x2b')]=function(_0x3f853f,_0x5e3005){var _0x5b3965={},_0x42ce4d={},_0x568c87={'count':0x0,'rows':[]};var _0x26cbb2=_[_0xbbdf('0x2c')](db[_0xbbdf('0x2d')][_0xbbdf('0x2e')],function(_0x3c9360){return{'name':_0x3c9360[_0xbbdf('0x2f')],'type':_0x3c9360[_0xbbdf('0x30')][_0xbbdf('0x31')]};});_0x42ce4d[_0xbbdf('0x32')]=_[_0xbbdf('0x2c')](_0x26cbb2,_0xbbdf('0x29'));_0x42ce4d['query']=_[_0xbbdf('0x33')](_0x3f853f[_0xbbdf('0x34')]);_0x42ce4d[_0xbbdf('0x35')]=_['intersection'](_0x42ce4d[_0xbbdf('0x32')],_0x42ce4d[_0xbbdf('0x34')]);_0x5b3965[_0xbbdf('0x36')]=_[_0xbbdf('0x37')](_0x42ce4d[_0xbbdf('0x32')],qs[_0xbbdf('0x38')](_0x3f853f[_0xbbdf('0x34')]['fields']));_0x5b3965[_0xbbdf('0x36')]=_0x5b3965[_0xbbdf('0x36')][_0xbbdf('0x39')]?_0x5b3965[_0xbbdf('0x36')]:_0x42ce4d[_0xbbdf('0x32')];if(!_0x3f853f[_0xbbdf('0x34')]['hasOwnProperty'](_0xbbdf('0x3a'))){_0x5b3965[_0xbbdf('0x22')]=qs['limit'](_0x3f853f['query'][_0xbbdf('0x22')]);_0x5b3965[_0xbbdf('0x1f')]=qs[_0xbbdf('0x1f')](_0x3f853f[_0xbbdf('0x34')]['offset']);}_0x5b3965[_0xbbdf('0x3b')]=qs[_0xbbdf('0x3c')](_0x3f853f[_0xbbdf('0x34')][_0xbbdf('0x3c')]);_0x5b3965['where']=qs['filters'](_[_0xbbdf('0x3d')](_0x3f853f[_0xbbdf('0x34')],_0x42ce4d[_0xbbdf('0x35')]),_0x26cbb2);if(_0x3f853f[_0xbbdf('0x34')][_0xbbdf('0x3e')]){_0x5b3965['where']=_[_0xbbdf('0x3f')](_0x5b3965[_0xbbdf('0x40')],{'$or':_[_0xbbdf('0x2c')](_0x26cbb2,function(_0x22cc1d){if(_0x22cc1d[_0xbbdf('0x30')]!==_0xbbdf('0x41')){var _0x317cc1={};_0x317cc1[_0x22cc1d[_0xbbdf('0x29')]]={'$like':'%'+_0x3f853f[_0xbbdf('0x34')][_0xbbdf('0x3e')]+'%'};return _0x317cc1;}})});}_0x5b3965=_[_0xbbdf('0x3f')]({},_0x5b3965,_0x3f853f[_0xbbdf('0x42')]);var _0xa498a4={'where':_0x5b3965[_0xbbdf('0x40')]};return db['UserProfile'][_0xbbdf('0x21')](_0xa498a4)['then'](function(_0x2cdc25){_0x568c87[_0xbbdf('0x21')]=_0x2cdc25;if(_0x3f853f[_0xbbdf('0x34')][_0xbbdf('0x43')]){_0x5b3965[_0xbbdf('0x44')]=[{'all':!![]}];}return db['UserProfile'][_0xbbdf('0x45')](_0x5b3965);})[_0xbbdf('0x27')](function(_0x4595dd){_0x568c87[_0xbbdf('0x46')]=_0x4595dd;return _0x568c87;})[_0xbbdf('0x27')](respondWithFilteredResult(_0x5e3005,_0x5b3965))[_0xbbdf('0x47')](handleError(_0x5e3005,null));};exports['show']=function(_0x8b273a,_0x506f50){var _0xf45d6c={'raw':![],'where':{'id':_0x8b273a[_0xbbdf('0x48')]['id']}},_0x5994d2={};_0x5994d2['model']=_[_0xbbdf('0x33')](db[_0xbbdf('0x2d')][_0xbbdf('0x2e')]);_0x5994d2[_0xbbdf('0x34')]=_[_0xbbdf('0x33')](_0x8b273a['query']);_0x5994d2[_0xbbdf('0x35')]=_[_0xbbdf('0x37')](_0x5994d2[_0xbbdf('0x32')],_0x5994d2['query']);_0xf45d6c[_0xbbdf('0x36')]=_[_0xbbdf('0x37')](_0x5994d2[_0xbbdf('0x32')],qs[_0xbbdf('0x38')](_0x8b273a[_0xbbdf('0x34')]['fields']));_0xf45d6c[_0xbbdf('0x36')]=_0xf45d6c['attributes'][_0xbbdf('0x39')]?_0xf45d6c['attributes']:_0x5994d2['model'];if(_0x8b273a[_0xbbdf('0x34')][_0xbbdf('0x43')]){_0xf45d6c[_0xbbdf('0x44')]=[{'all':!![]}];}_0xf45d6c=_['merge']({},_0xf45d6c,_0x8b273a['options']);return db[_0xbbdf('0x2d')]['find'](_0xf45d6c)['then'](handleEntityNotFound(_0x506f50,null))[_0xbbdf('0x27')](respondWithResult(_0x506f50,null))[_0xbbdf('0x47')](handleError(_0x506f50,null));};exports[_0xbbdf('0x49')]=function(_0x344b92,_0x23ecde){return db[_0xbbdf('0x2d')][_0xbbdf('0x49')](_0x344b92[_0xbbdf('0x4a')],{})['then'](respondWithResult(_0x23ecde,0xc9))[_0xbbdf('0x47')](handleError(_0x23ecde,null));};exports[_0xbbdf('0x4b')]=function(_0x21e6b1,_0x3d2fdf){var _0x1b8661={'where':{'id':_0x21e6b1[_0xbbdf('0x48')]['id']}},_0x5668a7={};_0x5668a7[_0xbbdf('0x32')]=_['keys'](db[_0xbbdf('0x2d')][_0xbbdf('0x2e')]);_0x1b8661['attributes']=_[_0xbbdf('0x37')](_0x5668a7[_0xbbdf('0x32')],qs[_0xbbdf('0x38')](_0x21e6b1[_0xbbdf('0x34')]['fields']));_0x1b8661[_0xbbdf('0x36')]=_0x1b8661['attributes'][_0xbbdf('0x39')]?_0x1b8661[_0xbbdf('0x36')]:_0x5668a7[_0xbbdf('0x32')];if(_0x21e6b1['query']['includeAll']){_0x1b8661[_0xbbdf('0x44')]=[{'all':!![]}];}_0x1b8661=_[_0xbbdf('0x3f')]({},_0x1b8661,_0x21e6b1['options']);return db[_0xbbdf('0x2d')][_0xbbdf('0x4c')](_0x1b8661)[_0xbbdf('0x27')](handleEntityNotFound(_0x3d2fdf,null))[_0xbbdf('0x27')](function(_0x749b4){if(_0x749b4){var _0x3f3e96=_0x749b4[_0xbbdf('0x4d')]({'plain':!![]});_0x3f3e96=qs['omit'](_0x3f3e96,['id',_0xbbdf('0x4e'),_0xbbdf('0x4f'),_0xbbdf('0x50')]);_0x21e6b1[_0xbbdf('0x4a')]=_[_0xbbdf('0x51')](_0x21e6b1[_0xbbdf('0x4a')],['id',_0xbbdf('0x4e'),_0xbbdf('0x4f')]);return db['sequelize'][_0xbbdf('0x52')](function(_0x23f6e2){return db['UserProfile'][_0xbbdf('0x49')](_['merge'](_0x3f3e96,_0x21e6b1['body']),{'include':_0x21e6b1['query'][_0xbbdf('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x23f6e2})[_0xbbdf('0x27')](function(_0x59816c){var _0x2059a6=_0x59816c['get']({'plain':!![]});return db['UserProfileSection'][_0xbbdf('0x45')]({'where':{'userProfileId':_0x21e6b1[_0xbbdf('0x48')]['id']},'raw':!![]})[_0xbbdf('0x27')](function(_0x4207a5){if(_0x4207a5){return BPromise[_0xbbdf('0x53')](_0x4207a5,function(_0x21b88e){return new BPromise(function(_0x2e8098,_0x9c7d2c){if(_0x21b88e[_0xbbdf('0x54')]===null||_0x21b88e[_0xbbdf('0x54')]===0x1)_0x2e8098(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x21b88e['id']},'raw':!![]})['then'](function(_0x368ee6){var _0x200026=_[_0xbbdf('0x2c')](_0x368ee6,function(_0x117379){return qs[_0xbbdf('0x51')](_0x117379,['id','createdAt',_0xbbdf('0x4f'),_0xbbdf('0x55')]);});_0x2e8098(_0x200026);})[_0xbbdf('0x47')](function(_0x45cc68){_0x9c7d2c(_0x45cc68);});})[_0xbbdf('0x27')](function(_0x442700){var _0x56a3a8=qs[_0xbbdf('0x51')](_0x21b88e,['id',_0xbbdf('0x4e'),_0xbbdf('0x4f')]);_0x56a3a8['userProfileId']=_0x2059a6['id'];if(_0x442700)_0x56a3a8[_0xbbdf('0x56')]=_0x442700;return _0x56a3a8;})['then'](function(_0x39f8f9){return db[_0xbbdf('0x57')][_0xbbdf('0x49')](_0x39f8f9,{'include':[{'model':db['UserProfileResource'],'as':_0xbbdf('0x56')}],'raw':!![],'transaction':_0x23f6e2});});})[_0xbbdf('0x27')](function(){return _0x2059a6;});}});});});}})[_0xbbdf('0x27')](respondWithResult(_0x3d2fdf,0xc9))[_0xbbdf('0x47')](handleError(_0x3d2fdf,null));};exports[_0xbbdf('0x26')]=function(_0x363e44,_0x26ddb6){if(_0x363e44['body']['id']){delete _0x363e44['body']['id'];}return db['UserProfile'][_0xbbdf('0x4c')]({'where':{'id':_0x363e44[_0xbbdf('0x48')]['id']}})['then'](handleEntityNotFound(_0x26ddb6,null))[_0xbbdf('0x27')](saveUpdates(_0x363e44['body'],null))[_0xbbdf('0x27')](respondWithResult(_0x26ddb6,null))[_0xbbdf('0x47')](handleError(_0x26ddb6,null));};exports[_0xbbdf('0x58')]=function(_0x46c253,_0x15295e){return db['UserProfile'][_0xbbdf('0x4c')]({'where':{'id':_0x46c253[_0xbbdf('0x48')]['id']}})[_0xbbdf('0x27')](handleEntityNotFound(_0x15295e,null))[_0xbbdf('0x27')](removeEntity(_0x15295e,null))[_0xbbdf('0x47')](handleError(_0x15295e,null));};exports[_0xbbdf('0x59')]=function(_0x26596f,_0x1c2d04){return db[_0xbbdf('0x2d')][_0xbbdf('0x59')]()[_0xbbdf('0x27')](respondWithResult(_0x1c2d04,null))['catch'](handleError(_0x1c2d04,null));};exports[_0xbbdf('0x5a')]=function(_0x50a0c0,_0x380e04){var _0x1d0334=_0x50a0c0[_0xbbdf('0x4a')];return db[_0xbbdf('0x2d')]['find']({'where':{'id':_0x50a0c0[_0xbbdf('0x48')]['id']}})[_0xbbdf('0x27')](handleEntityNotFound(_0x380e04,null))[_0xbbdf('0x27')](function(_0x3ac8b1){if(_0x3ac8b1){return db[_0xbbdf('0x5b')]['transaction'](function(_0x43f8ac){return db[_0xbbdf('0x57')]['destroy']({'where':{'userProfileId':_0x50a0c0[_0xbbdf('0x48')]['id'],'sectionId':_[_0xbbdf('0x2c')](_0x1d0334,function(_0x374071){return _0x374071[_0xbbdf('0x55')];})},'transaction':_0x43f8ac})[_0xbbdf('0x27')](function(){var _0x5bd7b9=_[_0xbbdf('0x2c')](_0x1d0334,function(_0x3b79e7){_0x3b79e7[_0xbbdf('0x5c')]=_0x50a0c0[_0xbbdf('0x48')]['id'];return _0x3b79e7;});var _0x4469ab=[];return BPromise['each'](_0x5bd7b9,function(_0x5ea6c9){return db[_0xbbdf('0x57')][_0xbbdf('0x49')](_0x5ea6c9,{'include':[{'model':db[_0xbbdf('0x5d')],'as':'Resources'}],'raw':!![],'transaction':_0x43f8ac})['then'](function(_0x3b0f92){_0x4469ab[_0xbbdf('0x5e')](_0x3b0f92[_0xbbdf('0x4d')]({'plain':!![]}));});})[_0xbbdf('0x27')](function(){return _0x4469ab;});});});}})['then'](function(_0x21b819){return _0x21b819;})['then'](respondWithResult(_0x380e04,null))['catch'](handleError(_0x380e04,null));};exports[_0xbbdf('0x5f')]=function(_0xa1bdaf,_0x5b23f7){var _0x1ccaaf;return db[_0xbbdf('0x2d')]['find']({'where':{'id':_0xa1bdaf['params']['id']},'attributes':['id',_0xbbdf('0x29')]})['then'](handleEntityNotFound(_0x5b23f7,null))['then'](function(_0x1cb1a7){if(_0x1cb1a7){_0x1ccaaf=_0x1cb1a7;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0xa1bdaf[_0xbbdf('0x48')]['id'],'sectionId':_0xa1bdaf[_0xbbdf('0x34')][_0xbbdf('0x60')]}});}})[_0xbbdf('0x27')](function(){return _0x1ccaaf;})['then'](respondWithStatusCode(_0x5b23f7,null))[_0xbbdf('0x47')](handleError(_0x5b23f7,null));};exports[_0xbbdf('0x61')]=function(_0x519906,_0xcb1ddd){var _0x148910=[];var _0x422433=[];return db['UserProfileSection'][_0xbbdf('0x45')]({'where':{'userProfileId':_0x519906[_0xbbdf('0x48')]['id']},'raw':!![]})[_0xbbdf('0x27')](function(_0x5c1b88){_0x148910=_[_0xbbdf('0x3e')](_0x5c1b88,function(_0x5b3657){return _0x5b3657[_0xbbdf('0x62')]===0x1||_[_0xbbdf('0x63')]([0x3eb,0x709],_0x5b3657['sectionId']);});if(!_[_0xbbdf('0x64')](_0x148910)){return _['map'](_0x148910,function(_0x2fe26e){return _0x2fe26e[_0xbbdf('0x55')];});}else{return;}})['then'](function(_0x309e64){if(_0x309e64)_0x422433=_0x309e64;if(_['includes'](_0x422433,0x64)){var _0x3d2230=_[_0xbbdf('0x4c')](_0x148910,{'sectionId':0x64});return hasDefaultDashboard(_0x3d2230)['then'](function(_0x25b4b4){return _[_0xbbdf('0x2c')](_0x148910,function(_0x9967ed){if(_0x9967ed[_0xbbdf('0x55')]===0x64){_0x9967ed[_0xbbdf('0x65')]=_0x25b4b4;}return _0x9967ed;});});}else{return;}})[_0xbbdf('0x27')](function(_0x51f6b3){if(_0x51f6b3)_0x148910=_0x51f6b3;if(_[_0xbbdf('0x63')](_0x422433,0x3eb)){var _0x58738d=_[_0xbbdf('0x4c')](_0x148910,{'sectionId':0x3eb});return getCustomDashboards(_0x58738d)[_0xbbdf('0x27')](function(_0x197bdc){return _[_0xbbdf('0x2c')](_0x148910,function(_0x11bfcb){if(_0x58738d[_0xbbdf('0x62')]){if(_0x11bfcb[_0xbbdf('0x55')]===0x3eb){_0x11bfcb[_0xbbdf('0x65')]=_0x197bdc;}}else{if(_0x11bfcb[_0xbbdf('0x55')]===0x64){_0x11bfcb[_0xbbdf('0x65')]=_0x197bdc;}}return _0x11bfcb;});});}else{return;}})[_0xbbdf('0x27')](function(_0x37df3a){if(_0x37df3a)_0x148910=_0x37df3a;if(_['includes'](_0x422433,0x709)){var _0x264291=_[_0xbbdf('0x4c')](_0x148910,{'sectionId':0x709});return getPlugins(_0x264291)['then'](function(_0x400084){if(_0x264291[_0xbbdf('0x62')]){return _['map'](_0x148910,function(_0x1183d7){if(_0x1183d7[_0xbbdf('0x55')]===0x709){_0x1183d7[_0xbbdf('0x65')]=_0x400084;}return _0x1183d7;});}else{var _0x5eeac9={'sectionId':0x76c,'enabled':0x1,'subsections':_0x400084};var _0x1d5f39=_['map'](_0x148910);_0x1d5f39['push'](_0x5eeac9);return _0x1d5f39;}});}else{return;}})['then'](function(_0x4ade31){if(_0x4ade31)_0x148910=_0x4ade31;return _[_0xbbdf('0x3e')](_0x148910,[_0xbbdf('0x62'),0x1]);})[_0xbbdf('0x27')](respondWithResult(_0xcb1ddd,null))[_0xbbdf('0x47')](handleError(_0xcb1ddd,null));};function hasDefaultDashboard(_0x50b245){var _0x5d0d41=[0x65];return new BPromise(function(_0x39c07d,_0x5b625b){try{if(_0x50b245[_0xbbdf('0x54')]){_0x39c07d(_0x5d0d41);}else{return db[_0xbbdf('0x5d')][_0xbbdf('0x66')]({'where':{'sectionId':_0x50b245['id']},'raw':!![]})[_0xbbdf('0x27')](function(_0x226c6f){_0x226c6f?_0x39c07d(_0x5d0d41):_0x39c07d();});}}catch(_0xa5ea8c){_0x5b625b(_0xa5ea8c);}});}function getCustomDashboards(_0x1a8e62){var _0x224ff2=[];return new BPromise(function(_0x181533,_0x552c8d){try{if(_0x1a8e62[_0xbbdf('0x54')]){return db['Dashboard'][_0xbbdf('0x45')]({'raw':!![]})[_0xbbdf('0x27')](function(_0x36a878){_0x36a878['forEach'](function(_0x3a53bb){_0x224ff2[_0xbbdf('0x5e')](_0x3a53bb['id']+0x1869f);});_0x181533(_0x224ff2);});}else{return db[_0xbbdf('0x5d')]['findAll']({'where':{'sectionId':_0x1a8e62['id']},'raw':!![]})[_0xbbdf('0x27')](function(_0xc8710c){_0xc8710c[_0xbbdf('0x67')](function(_0x35358a){_0x224ff2[_0xbbdf('0x5e')](_0x35358a['resourceId']+0x1869f);});_0x181533(_0x224ff2);});}}catch(_0x137d19){_0x552c8d(_0x137d19);}});}function getPlugins(_0x54f845){var _0x96e5d2=[];return new BPromise(function(_0x5aee83,_0x22c8b4){try{if(_0x54f845[_0xbbdf('0x54')]){return db[_0xbbdf('0x68')]['findAll']({'raw':!![]})[_0xbbdf('0x27')](function(_0x28682d){_0x28682d[_0xbbdf('0x67')](function(_0x3c63d0){_0x96e5d2[_0xbbdf('0x5e')](_0x3c63d0['id']+0x15b38);});_0x5aee83(_0x96e5d2);});}else{return db[_0xbbdf('0x5d')][_0xbbdf('0x45')]({'where':{'sectionId':_0x54f845['id']},'raw':!![]})['then'](function(_0x3dcaa0){_0x3dcaa0[_0xbbdf('0x67')](function(_0x2ac0f9){_0x96e5d2[_0xbbdf('0x5e')](_0x2ac0f9[_0xbbdf('0x69')]+0x15b38);});_0x5aee83(_0x96e5d2);});}}catch(_0x57a3d5){_0x22c8b4(_0x57a3d5);}});}exports[_0xbbdf('0x6a')]=function(_0x1c7bc9,_0x2a7114){return db[_0xbbdf('0x2d')][_0xbbdf('0x4c')]({'where':{'id':_0x1c7bc9[_0xbbdf('0x48')]['id']}})[_0xbbdf('0x27')](handleEntityNotFound(_0x2a7114,null))['then'](function(_0x2f29a9){if(_0x2f29a9){return db[_0xbbdf('0x5b')][_0xbbdf('0x52')](function(_0x1676d9){return db[_0xbbdf('0x57')][_0xbbdf('0x45')]({'where':{'userProfileId':_0x1c7bc9['params']['id']},'attributes':['id'],'raw':!![]})[_0xbbdf('0x27')](function(_0x37fc0f){if(_0x37fc0f){return db[_0xbbdf('0x57')][_0xbbdf('0x58')]({'where':{'userProfileId':_0x1c7bc9[_0xbbdf('0x48')]['id'],'id':_[_0xbbdf('0x2c')](_0x37fc0f,function(_0x170211){return _0x170211['id'];})},'transaction':_0x1676d9});}})[_0xbbdf('0x27')](function(_0x44a393){var _0x4afe59=_[_0xbbdf('0x2c')](_0x1c7bc9[_0xbbdf('0x4a')],function(_0x5e87d1){_0x5e87d1[_0xbbdf('0x5c')]=_0x1c7bc9[_0xbbdf('0x48')]['id'];return _0x5e87d1;});return db[_0xbbdf('0x57')]['bulkCreate'](_0x4afe59,{'raw':!![],'transaction':_0x1676d9});})['then'](function(_0x3d2c7d){var _0x5b1ba2=_[_0xbbdf('0x3e')](_[_0xbbdf('0x2c')](_0x3d2c7d,function(_0x45ef48){return _0x45ef48['get']({'plain':!![]});}),{'includeAll':![]});if(_0x5b1ba2){return db[_0xbbdf('0x57')][_0xbbdf('0x45')]({'where':{'userProfileId':_0x1c7bc9[_0xbbdf('0x48')]['id'],'sectionId':_[_0xbbdf('0x2c')](_0x5b1ba2,function(_0x2646bf){return _0x2646bf['sectionId'];})},'attributes':['id',_0xbbdf('0x55')],'raw':!![]})['then'](function(_0x509ade){var _0x349310=_['map'](_0x1c7bc9[_0xbbdf('0x4a')],function(_0x33ac70){_0x33ac70['userProfileId']=_0x1c7bc9[_0xbbdf('0x48')]['id'];return _0x33ac70;});return db[_0xbbdf('0x5d')][_0xbbdf('0x6b')](_0x349310,{'raw':!![],'transaction':_0x1676d9});});}})[_0xbbdf('0x47')](handleError(_0x2a7114,null));});}})['then'](function(_0x20d21b){var _0x1eb594=_[_0xbbdf('0x2c')](_0x20d21b,function(_0x193a13){return _0x193a13[_0xbbdf('0x4d')]({'plain':!![]});});})[_0xbbdf('0x27')](respondWithResult(_0x2a7114,null))[_0xbbdf('0x47')](handleError(_0x2a7114,null));};exports[_0xbbdf('0x6c')]=function(_0x293dbb,_0x9e0b16,_0x2907d5){return db['UserProfile'][_0xbbdf('0x4c')]({'where':{'id':_0x293dbb[_0xbbdf('0x48')]['id']}})[_0xbbdf('0x27')](handleEntityNotFound(_0x9e0b16,null))[_0xbbdf('0x27')](function(_0x374c2a){if(_0x374c2a){return _0x374c2a[_0xbbdf('0x6c')](_0x293dbb[_0xbbdf('0x34')][_0xbbdf('0x60')]);}})['then'](respondWithStatusCode(_0x9e0b16,null))[_0xbbdf('0x47')](handleError(_0x9e0b16,null));};exports['getResources']=function(_0x3e4360,_0x356eea){var _0x1f4229={};if(!_0x3e4360[_0xbbdf('0x34')]['section'])throw new Error(_0xbbdf('0x6d'));if(!_0x3e4360[_0xbbdf('0x34')][_0xbbdf('0x6e')](_0xbbdf('0x3a'))){_0x1f4229[_0xbbdf('0x22')]=qs[_0xbbdf('0x22')](_0x3e4360[_0xbbdf('0x34')][_0xbbdf('0x22')]);_0x1f4229[_0xbbdf('0x1f')]=qs[_0xbbdf('0x1f')](_0x3e4360[_0xbbdf('0x34')][_0xbbdf('0x1f')]);}return db[_0xbbdf('0x2d')]['find']({'where':{'id':_0x3e4360[_0xbbdf('0x48')]['id']}})['then'](function(_0x5786af){if(!_0x5786af)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x3e4360[_0xbbdf('0x48')]['id']);return db[_0xbbdf('0x2d')]['getResources'](_0x3e4360);})[_0xbbdf('0x27')](respondWithFilteredResult(_0x356eea,_0x1f4229))[_0xbbdf('0x47')](handleError(_0x356eea,null));}; \ No newline at end of file +var _0x4910=['enabled','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','destroy','error','send','map','rawAttributes','fieldName','type','name','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','UserProfile','includeAll','include','findAll','then','rows','catch','find','create','clone','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','params','each','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','userProfileId','UserProfileSection','push','removeSections','ids','getSections','includes','isEmpty','subsections'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4910,0x1d9));var _0x0491=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4910[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x0491('0x0'));var rimraf=require(_0x0491('0x1'));var zipdir=require(_0x0491('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0491('0x3'));var moment=require(_0x0491('0x4'));var BPromise=require(_0x0491('0x5'));var Mustache=require(_0x0491('0x6'));var util=require(_0x0491('0x7'));var path=require('path');var sox=require(_0x0491('0x8'));var csv=require(_0x0491('0x9'));var ejs=require(_0x0491('0xa'));var fs=require('fs');var fs_extra=require(_0x0491('0xb'));var _=require(_0x0491('0xc'));var squel=require('squel');var crypto=require(_0x0491('0xd'));var jsforce=require(_0x0491('0xe'));var deskjs=require(_0x0491('0xf'));var toCsv=require(_0x0491('0x9'));var querystring=require(_0x0491('0x10'));var Papa=require('papaparse');var Redis=require(_0x0491('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0491('0x12'));var as=require(_0x0491('0x13'));var hardwareService=require(_0x0491('0x14'));var logger=require(_0x0491('0x15'))(_0x0491('0x16'));var utils=require(_0x0491('0x17'));var config=require(_0x0491('0x18'));var licenseUtil=require(_0x0491('0x19'));var db=require(_0x0491('0x1a'))['db'];config[_0x0491('0x1b')]=_['defaults'](config[_0x0491('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x0491('0x1c'))(new Redis(config['redis']));require('./userProfile.socket')[_0x0491('0x1d')](socket);function respondWithStatusCode(_0x7ba36,_0x439f5c){_0x439f5c=_0x439f5c||0xcc;return function(_0x2f1a37){if(_0x2f1a37){return _0x7ba36[_0x0491('0x1e')](_0x439f5c);}return _0x7ba36[_0x0491('0x1f')](_0x439f5c)[_0x0491('0x20')]();};}function respondWithResult(_0xbd94bd,_0xf12423){_0xf12423=_0xf12423||0xc8;return function(_0x1411a6){if(_0x1411a6){return _0xbd94bd['status'](_0xf12423)[_0x0491('0x21')](_0x1411a6);}};}function respondWithFilteredResult(_0x1cf288,_0x12990a){return function(_0x31bc2c){if(_0x31bc2c){var _0x3b536e=typeof _0x12990a[_0x0491('0x22')]==='undefined'&&typeof _0x12990a[_0x0491('0x23')]===_0x0491('0x24');var _0x4e94f8=_0x31bc2c['count'];var _0x1ba594=_0x3b536e?0x0:_0x12990a['offset'];var _0x6f8139=_0x3b536e?_0x31bc2c[_0x0491('0x25')]:_0x12990a['offset']+_0x12990a[_0x0491('0x23')];var _0x22776d;if(_0x6f8139>=_0x4e94f8){_0x6f8139=_0x4e94f8;_0x22776d=0xc8;}else{_0x22776d=0xce;}_0x1cf288[_0x0491('0x1f')](_0x22776d);return _0x1cf288[_0x0491('0x26')]('Content-Range',_0x1ba594+'-'+_0x6f8139+'/'+_0x4e94f8)[_0x0491('0x21')](_0x31bc2c);}return null;};}function patchUpdates(_0x358117){return function(_0x1fb8a5){try{jsonpatch['apply'](_0x1fb8a5,_0x358117,!![]);}catch(_0x1498c2){return BPromise[_0x0491('0x27')](_0x1498c2);}return _0x1fb8a5[_0x0491('0x28')]();};}function saveUpdates(_0x1934a0,_0x30ad41){return function(_0xdda718){if(_0xdda718){return _0xdda718[_0x0491('0x29')](_0x1934a0)['then'](function(_0x7c03ef){return _0x7c03ef;});}return null;};}function removeEntity(_0x4a39f0,_0xc0c021){return function(_0x93bc14){if(_0x93bc14){return _0x93bc14[_0x0491('0x2a')]()['then'](function(){_0x4a39f0[_0x0491('0x1f')](0xcc)[_0x0491('0x20')]();});}};}function handleEntityNotFound(_0x59beec,_0x2d13c4){return function(_0xe0e31e){if(!_0xe0e31e){_0x59beec[_0x0491('0x1e')](0x194);}return _0xe0e31e;};}function handleError(_0x2c3f39,_0x3ec059){_0x3ec059=_0x3ec059||0x1f4;return function(_0x38b4b8){logger[_0x0491('0x2b')](_0x38b4b8['stack']);if(_0x38b4b8['name']){delete _0x38b4b8['name'];}_0x2c3f39['status'](_0x3ec059)[_0x0491('0x2c')](_0x38b4b8);};}exports['index']=function(_0x46d432,_0xb82361){var _0x3b66d0={},_0x7d4feb={},_0x2e3223={'count':0x0,'rows':[]};var _0x18278b=_[_0x0491('0x2d')](db['UserProfile'][_0x0491('0x2e')],function(_0x133d37){return{'name':_0x133d37[_0x0491('0x2f')],'type':_0x133d37[_0x0491('0x30')]['key']};});_0x7d4feb['model']=_['map'](_0x18278b,_0x0491('0x31'));_0x7d4feb['query']=_[_0x0491('0x32')](_0x46d432[_0x0491('0x33')]);_0x7d4feb[_0x0491('0x34')]=_[_0x0491('0x35')](_0x7d4feb[_0x0491('0x36')],_0x7d4feb[_0x0491('0x33')]);_0x3b66d0[_0x0491('0x37')]=_[_0x0491('0x35')](_0x7d4feb['model'],qs[_0x0491('0x38')](_0x46d432['query'][_0x0491('0x38')]));_0x3b66d0[_0x0491('0x37')]=_0x3b66d0['attributes'][_0x0491('0x39')]?_0x3b66d0['attributes']:_0x7d4feb[_0x0491('0x36')];if(!_0x46d432[_0x0491('0x33')][_0x0491('0x3a')](_0x0491('0x3b'))){_0x3b66d0['limit']=qs['limit'](_0x46d432[_0x0491('0x33')][_0x0491('0x23')]);_0x3b66d0[_0x0491('0x22')]=qs['offset'](_0x46d432[_0x0491('0x33')]['offset']);}_0x3b66d0[_0x0491('0x3c')]=qs['sort'](_0x46d432[_0x0491('0x33')][_0x0491('0x3d')]);_0x3b66d0[_0x0491('0x3e')]=qs['filters'](_['pick'](_0x46d432[_0x0491('0x33')],_0x7d4feb[_0x0491('0x34')]),_0x18278b);if(_0x46d432[_0x0491('0x33')]['filter']){_0x3b66d0['where']=_[_0x0491('0x3f')](_0x3b66d0[_0x0491('0x3e')],{'$or':_[_0x0491('0x2d')](_0x18278b,function(_0xd58fa7){if(_0xd58fa7[_0x0491('0x30')]!==_0x0491('0x40')){var _0x36c305={};_0x36c305[_0xd58fa7['name']]={'$like':'%'+_0x46d432[_0x0491('0x33')][_0x0491('0x41')]+'%'};return _0x36c305;}})});}_0x3b66d0=_['merge']({},_0x3b66d0,_0x46d432[_0x0491('0x42')]);var _0x2e7566={'where':_0x3b66d0[_0x0491('0x3e')]};return db[_0x0491('0x43')][_0x0491('0x25')](_0x2e7566)['then'](function(_0xfdb977){_0x2e3223[_0x0491('0x25')]=_0xfdb977;if(_0x46d432[_0x0491('0x33')][_0x0491('0x44')]){_0x3b66d0[_0x0491('0x45')]=[{'all':!![]}];}return db[_0x0491('0x43')][_0x0491('0x46')](_0x3b66d0);})[_0x0491('0x47')](function(_0x20ead0){_0x2e3223[_0x0491('0x48')]=_0x20ead0;return _0x2e3223;})[_0x0491('0x47')](respondWithFilteredResult(_0xb82361,_0x3b66d0))[_0x0491('0x49')](handleError(_0xb82361,null));};exports['show']=function(_0x51c997,_0x25439c){var _0x4af10d={'raw':![],'where':{'id':_0x51c997['params']['id']}},_0x5dc807={};_0x5dc807['model']=_[_0x0491('0x32')](db['UserProfile'][_0x0491('0x2e')]);_0x5dc807[_0x0491('0x33')]=_[_0x0491('0x32')](_0x51c997['query']);_0x5dc807[_0x0491('0x34')]=_['intersection'](_0x5dc807[_0x0491('0x36')],_0x5dc807['query']);_0x4af10d[_0x0491('0x37')]=_[_0x0491('0x35')](_0x5dc807[_0x0491('0x36')],qs[_0x0491('0x38')](_0x51c997[_0x0491('0x33')][_0x0491('0x38')]));_0x4af10d[_0x0491('0x37')]=_0x4af10d[_0x0491('0x37')][_0x0491('0x39')]?_0x4af10d[_0x0491('0x37')]:_0x5dc807[_0x0491('0x36')];if(_0x51c997[_0x0491('0x33')][_0x0491('0x44')]){_0x4af10d['include']=[{'all':!![]}];}_0x4af10d=_[_0x0491('0x3f')]({},_0x4af10d,_0x51c997[_0x0491('0x42')]);return db[_0x0491('0x43')][_0x0491('0x4a')](_0x4af10d)[_0x0491('0x47')](handleEntityNotFound(_0x25439c,null))[_0x0491('0x47')](respondWithResult(_0x25439c,null))['catch'](handleError(_0x25439c,null));};exports[_0x0491('0x4b')]=function(_0x27fc82,_0x198312){return db[_0x0491('0x43')]['create'](_0x27fc82['body'],{})[_0x0491('0x47')](respondWithResult(_0x198312,0xc9))[_0x0491('0x49')](handleError(_0x198312,null));};exports[_0x0491('0x4c')]=function(_0x563c4f,_0x6dd643){var _0x584f74={'where':{'id':_0x563c4f['params']['id']}},_0x129f9c={};_0x129f9c[_0x0491('0x36')]=_[_0x0491('0x32')](db[_0x0491('0x43')][_0x0491('0x2e')]);_0x584f74[_0x0491('0x37')]=_['intersection'](_0x129f9c[_0x0491('0x36')],qs['fields'](_0x563c4f['query'][_0x0491('0x38')]));_0x584f74[_0x0491('0x37')]=_0x584f74[_0x0491('0x37')][_0x0491('0x39')]?_0x584f74[_0x0491('0x37')]:_0x129f9c[_0x0491('0x36')];if(_0x563c4f[_0x0491('0x33')][_0x0491('0x44')]){_0x584f74['include']=[{'all':!![]}];}_0x584f74=_[_0x0491('0x3f')]({},_0x584f74,_0x563c4f[_0x0491('0x42')]);return db[_0x0491('0x43')][_0x0491('0x4a')](_0x584f74)[_0x0491('0x47')](handleEntityNotFound(_0x6dd643,null))['then'](function(_0x9a980e){if(_0x9a980e){var _0x225a34=_0x9a980e[_0x0491('0x4d')]({'plain':!![]});_0x225a34=qs[_0x0491('0x4e')](_0x225a34,['id',_0x0491('0x4f'),_0x0491('0x50'),_0x0491('0x51')]);_0x563c4f[_0x0491('0x52')]=_['omit'](_0x563c4f[_0x0491('0x52')],['id',_0x0491('0x4f'),_0x0491('0x50')]);return db[_0x0491('0x53')][_0x0491('0x54')](function(_0x112f8b){return db[_0x0491('0x43')][_0x0491('0x4b')](_[_0x0491('0x3f')](_0x225a34,_0x563c4f['body']),{'include':_0x563c4f[_0x0491('0x33')][_0x0491('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x112f8b})[_0x0491('0x47')](function(_0x260d06){var _0x5a97ae=_0x260d06['get']({'plain':!![]});return db['UserProfileSection'][_0x0491('0x46')]({'where':{'userProfileId':_0x563c4f[_0x0491('0x55')]['id']},'raw':!![]})['then'](function(_0x472b68){if(_0x472b68){return BPromise[_0x0491('0x56')](_0x472b68,function(_0x4bb695){return new BPromise(function(_0x9802a9,_0x28b3ce){if(_0x4bb695[_0x0491('0x57')]===null||_0x4bb695[_0x0491('0x57')]===0x1)_0x9802a9(null);return db[_0x0491('0x58')]['findAll']({'where':{'sectionId':_0x4bb695['id']},'raw':!![]})[_0x0491('0x47')](function(_0x4b3df8){var _0x4ea662=_[_0x0491('0x2d')](_0x4b3df8,function(_0x3527f4){return qs[_0x0491('0x4e')](_0x3527f4,['id','createdAt',_0x0491('0x50'),_0x0491('0x59')]);});_0x9802a9(_0x4ea662);})['catch'](function(_0x1b439e){_0x28b3ce(_0x1b439e);});})[_0x0491('0x47')](function(_0x2f840d){var _0x3427ef=qs[_0x0491('0x4e')](_0x4bb695,['id',_0x0491('0x4f'),_0x0491('0x50')]);_0x3427ef['userProfileId']=_0x5a97ae['id'];if(_0x2f840d)_0x3427ef['Resources']=_0x2f840d;return _0x3427ef;})[_0x0491('0x47')](function(_0x11de4c){return db['UserProfileSection'][_0x0491('0x4b')](_0x11de4c,{'include':[{'model':db[_0x0491('0x58')],'as':_0x0491('0x5a')}],'raw':!![],'transaction':_0x112f8b});});})[_0x0491('0x47')](function(){return _0x5a97ae;});}});});});}})[_0x0491('0x47')](respondWithResult(_0x6dd643,0xc9))[_0x0491('0x49')](handleError(_0x6dd643,null));};exports['update']=function(_0x2c41ec,_0x3c4a45){if(_0x2c41ec[_0x0491('0x52')]['id']){delete _0x2c41ec[_0x0491('0x52')]['id'];}return db['UserProfile'][_0x0491('0x4a')]({'where':{'id':_0x2c41ec[_0x0491('0x55')]['id']}})[_0x0491('0x47')](handleEntityNotFound(_0x3c4a45,null))[_0x0491('0x47')](saveUpdates(_0x2c41ec['body'],null))[_0x0491('0x47')](respondWithResult(_0x3c4a45,null))[_0x0491('0x49')](handleError(_0x3c4a45,null));};exports[_0x0491('0x2a')]=function(_0x2b3cf9,_0x1fe684){return db['UserProfile']['find']({'where':{'id':_0x2b3cf9['params']['id']}})[_0x0491('0x47')](handleEntityNotFound(_0x1fe684,null))[_0x0491('0x47')](removeEntity(_0x1fe684,null))[_0x0491('0x49')](handleError(_0x1fe684,null));};exports[_0x0491('0x5b')]=function(_0x4236e5,_0x4344dd){return db[_0x0491('0x43')]['describe']()[_0x0491('0x47')](respondWithResult(_0x4344dd,null))['catch'](handleError(_0x4344dd,null));};exports[_0x0491('0x5c')]=function(_0x2e9cc3,_0x6f2731){var _0xe4af61=_0x2e9cc3[_0x0491('0x52')];return db['UserProfile'][_0x0491('0x4a')]({'where':{'id':_0x2e9cc3[_0x0491('0x55')]['id']}})['then'](handleEntityNotFound(_0x6f2731,null))['then'](function(_0x143104){if(_0x143104){return db[_0x0491('0x53')]['transaction'](function(_0x1cf948){return db['UserProfileSection'][_0x0491('0x2a')]({'where':{'userProfileId':_0x2e9cc3[_0x0491('0x55')]['id'],'sectionId':_[_0x0491('0x2d')](_0xe4af61,function(_0xd5aed4){return _0xd5aed4[_0x0491('0x59')];})},'transaction':_0x1cf948})['then'](function(){var _0x1ee5af=_[_0x0491('0x2d')](_0xe4af61,function(_0x22bb76){_0x22bb76[_0x0491('0x5d')]=_0x2e9cc3[_0x0491('0x55')]['id'];return _0x22bb76;});var _0x1d2772=[];return BPromise[_0x0491('0x56')](_0x1ee5af,function(_0x477ef4){return db[_0x0491('0x5e')][_0x0491('0x4b')](_0x477ef4,{'include':[{'model':db[_0x0491('0x58')],'as':_0x0491('0x5a')}],'raw':!![],'transaction':_0x1cf948})['then'](function(_0x3e0903){_0x1d2772[_0x0491('0x5f')](_0x3e0903[_0x0491('0x4d')]({'plain':!![]}));});})[_0x0491('0x47')](function(){return _0x1d2772;});});});}})[_0x0491('0x47')](function(_0x13e7e1){return _0x13e7e1;})[_0x0491('0x47')](respondWithResult(_0x6f2731,null))[_0x0491('0x49')](handleError(_0x6f2731,null));};exports[_0x0491('0x60')]=function(_0x56f608,_0x361252){var _0x24899e;return db[_0x0491('0x43')][_0x0491('0x4a')]({'where':{'id':_0x56f608[_0x0491('0x55')]['id']},'attributes':['id',_0x0491('0x31')]})[_0x0491('0x47')](handleEntityNotFound(_0x361252,null))['then'](function(_0x1b651d){if(_0x1b651d){_0x24899e=_0x1b651d;return db[_0x0491('0x5e')][_0x0491('0x2a')]({'where':{'userProfileId':_0x56f608[_0x0491('0x55')]['id'],'sectionId':_0x56f608['query'][_0x0491('0x61')]}});}})[_0x0491('0x47')](function(){return _0x24899e;})[_0x0491('0x47')](respondWithStatusCode(_0x361252,null))['catch'](handleError(_0x361252,null));};exports[_0x0491('0x62')]=function(_0x502d27,_0x30008b){var _0x1b2115=[];var _0x393aa5=[];return db[_0x0491('0x5e')][_0x0491('0x46')]({'where':{'userProfileId':_0x502d27['params']['id']},'raw':!![]})['then'](function(_0x4daffd){_0x1b2115=_['filter'](_0x4daffd,function(_0x2ff034){return _0x2ff034['enabled']===0x1||_[_0x0491('0x63')]([0x3eb,0x709],_0x2ff034['sectionId']);});if(!_[_0x0491('0x64')](_0x1b2115)){return _['map'](_0x1b2115,function(_0x3170f4){return _0x3170f4['sectionId'];});}else{return;}})[_0x0491('0x47')](function(_0x1a455e){if(_0x1a455e)_0x393aa5=_0x1a455e;if(_[_0x0491('0x63')](_0x393aa5,0x64)){var _0xae356c=_['find'](_0x1b2115,{'sectionId':0x64});return hasDefaultDashboard(_0xae356c)[_0x0491('0x47')](function(_0x1e4487){return _[_0x0491('0x2d')](_0x1b2115,function(_0x58e77b){if(_0x58e77b[_0x0491('0x59')]===0x64){_0x58e77b[_0x0491('0x65')]=_0x1e4487;}return _0x58e77b;});});}else{return;}})[_0x0491('0x47')](function(_0x18bd6a){if(_0x18bd6a)_0x1b2115=_0x18bd6a;if(_[_0x0491('0x63')](_0x393aa5,0x3eb)){var _0x4dac50=_[_0x0491('0x4a')](_0x1b2115,{'sectionId':0x3eb});return getCustomDashboards(_0x4dac50)['then'](function(_0x29e671){return _[_0x0491('0x2d')](_0x1b2115,function(_0x2eeb61){if(_0x4dac50['enabled']){if(_0x2eeb61[_0x0491('0x59')]===0x3eb){_0x2eeb61[_0x0491('0x65')]=_0x29e671;}}else{if(_0x2eeb61[_0x0491('0x59')]===0x64){_0x2eeb61[_0x0491('0x65')]=_0x29e671;}}return _0x2eeb61;});});}else{return;}})[_0x0491('0x47')](function(_0x14ded9){if(_0x14ded9)_0x1b2115=_0x14ded9;if(_[_0x0491('0x63')](_0x393aa5,0x709)){var _0x36e0a0=_['find'](_0x1b2115,{'sectionId':0x709});return getPlugins(_0x36e0a0)[_0x0491('0x47')](function(_0x393832){if(_0x36e0a0['enabled']){return _[_0x0491('0x2d')](_0x1b2115,function(_0x4eb0d9){if(_0x4eb0d9['sectionId']===0x709){_0x4eb0d9['subsections']=_0x393832;}return _0x4eb0d9;});}else{var _0x469733={'sectionId':0x76c,'enabled':0x1,'subsections':_0x393832};var _0x3f2d2a=_[_0x0491('0x2d')](_0x1b2115);_0x3f2d2a[_0x0491('0x5f')](_0x469733);return _0x3f2d2a;}});}else{return;}})['then'](function(_0x50e2de){if(_0x50e2de)_0x1b2115=_0x50e2de;return _[_0x0491('0x41')](_0x1b2115,[_0x0491('0x66'),0x1]);})[_0x0491('0x47')](respondWithResult(_0x30008b,null))[_0x0491('0x49')](handleError(_0x30008b,null));};function hasDefaultDashboard(_0x148359){var _0x52ac40=[0x65];return new BPromise(function(_0x42d8ad,_0xf52e3b){try{if(_0x148359[_0x0491('0x57')]){_0x42d8ad(_0x52ac40);}else{return db[_0x0491('0x58')][_0x0491('0x67')]({'where':{'sectionId':_0x148359['id']},'raw':!![]})[_0x0491('0x47')](function(_0x54d46a){_0x54d46a?_0x42d8ad(_0x52ac40):_0x42d8ad();});}}catch(_0x50c727){_0xf52e3b(_0x50c727);}});}function getCustomDashboards(_0x543699){var _0x52772b=[];return new BPromise(function(_0x5b91f5,_0x26ff9a){try{if(_0x543699[_0x0491('0x57')]){return db[_0x0491('0x68')]['findAll']({'raw':!![]})[_0x0491('0x47')](function(_0xfc37e0){_0xfc37e0[_0x0491('0x69')](function(_0x2540bd){_0x52772b[_0x0491('0x5f')](_0x2540bd['id']+0x1869f);});_0x5b91f5(_0x52772b);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x543699['id']},'raw':!![]})['then'](function(_0x458796){_0x458796['forEach'](function(_0x22309b){_0x52772b['push'](_0x22309b['resourceId']+0x1869f);});_0x5b91f5(_0x52772b);});}}catch(_0x1b7241){_0x26ff9a(_0x1b7241);}});}function getPlugins(_0x534752){var _0x270766=[];return new BPromise(function(_0x1e92f7,_0x5229d3){try{if(_0x534752['autoAssociation']){return db[_0x0491('0x6a')][_0x0491('0x46')]({'raw':!![]})['then'](function(_0x874976){_0x874976['forEach'](function(_0x4cd686){_0x270766[_0x0491('0x5f')](_0x4cd686['id']+0x15b38);});_0x1e92f7(_0x270766);});}else{return db[_0x0491('0x58')]['findAll']({'where':{'sectionId':_0x534752['id']},'raw':!![]})[_0x0491('0x47')](function(_0x4cbf5c){_0x4cbf5c[_0x0491('0x69')](function(_0x5a3682){_0x270766[_0x0491('0x5f')](_0x5a3682[_0x0491('0x6b')]+0x15b38);});_0x1e92f7(_0x270766);});}}catch(_0x35fd25){_0x5229d3(_0x35fd25);}});}exports[_0x0491('0x6c')]=function(_0x46320a,_0x2f9755){return db[_0x0491('0x43')]['find']({'where':{'id':_0x46320a[_0x0491('0x55')]['id']}})[_0x0491('0x47')](handleEntityNotFound(_0x2f9755,null))[_0x0491('0x47')](function(_0x5a1deb){if(_0x5a1deb){return db['sequelize'][_0x0491('0x54')](function(_0x2eb1a3){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x46320a[_0x0491('0x55')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x57795b){if(_0x57795b){return db[_0x0491('0x5e')]['destroy']({'where':{'userProfileId':_0x46320a[_0x0491('0x55')]['id'],'id':_[_0x0491('0x2d')](_0x57795b,function(_0x3ae15f){return _0x3ae15f['id'];})},'transaction':_0x2eb1a3});}})[_0x0491('0x47')](function(_0x3a3cea){var _0x1648ab=_['map'](_0x46320a[_0x0491('0x52')],function(_0x42eaf8){_0x42eaf8[_0x0491('0x5d')]=_0x46320a[_0x0491('0x55')]['id'];return _0x42eaf8;});return db[_0x0491('0x5e')]['bulkCreate'](_0x1648ab,{'raw':!![],'transaction':_0x2eb1a3});})[_0x0491('0x47')](function(_0x4bbed5){var _0x8bd3a6=_[_0x0491('0x41')](_[_0x0491('0x2d')](_0x4bbed5,function(_0x2a7d5f){return _0x2a7d5f[_0x0491('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x8bd3a6){return db[_0x0491('0x5e')][_0x0491('0x46')]({'where':{'userProfileId':_0x46320a[_0x0491('0x55')]['id'],'sectionId':_[_0x0491('0x2d')](_0x8bd3a6,function(_0x41761c){return _0x41761c[_0x0491('0x59')];})},'attributes':['id',_0x0491('0x59')],'raw':!![]})[_0x0491('0x47')](function(_0x4ed236){var _0x274a33=_['map'](_0x46320a[_0x0491('0x52')],function(_0x4d3265){_0x4d3265['userProfileId']=_0x46320a[_0x0491('0x55')]['id'];return _0x4d3265;});return db[_0x0491('0x58')][_0x0491('0x6d')](_0x274a33,{'raw':!![],'transaction':_0x2eb1a3});});}})[_0x0491('0x49')](handleError(_0x2f9755,null));});}})['then'](function(_0x5905e6){var _0x3d1d5e=_[_0x0491('0x2d')](_0x5905e6,function(_0x32cc17){return _0x32cc17[_0x0491('0x4d')]({'plain':!![]});});})[_0x0491('0x47')](respondWithResult(_0x2f9755,null))[_0x0491('0x49')](handleError(_0x2f9755,null));};exports[_0x0491('0x6e')]=function(_0x30ab30,_0x50638a,_0x2d3f32){return db[_0x0491('0x43')][_0x0491('0x4a')]({'where':{'id':_0x30ab30[_0x0491('0x55')]['id']}})[_0x0491('0x47')](handleEntityNotFound(_0x50638a,null))[_0x0491('0x47')](function(_0x38b20b){if(_0x38b20b){return _0x38b20b['removeResources'](_0x30ab30[_0x0491('0x33')]['ids']);}})[_0x0491('0x47')](respondWithStatusCode(_0x50638a,null))['catch'](handleError(_0x50638a,null));};exports[_0x0491('0x6f')]=function(_0x360943,_0x3bc361){var _0x149cbe={};if(!_0x360943[_0x0491('0x33')][_0x0491('0x70')])throw new Error(_0x0491('0x71'));if(!_0x360943[_0x0491('0x33')][_0x0491('0x3a')](_0x0491('0x3b'))){_0x149cbe['limit']=qs[_0x0491('0x23')](_0x360943[_0x0491('0x33')][_0x0491('0x23')]);_0x149cbe[_0x0491('0x22')]=qs[_0x0491('0x22')](_0x360943[_0x0491('0x33')][_0x0491('0x22')]);}return db[_0x0491('0x43')][_0x0491('0x4a')]({'where':{'id':_0x360943[_0x0491('0x55')]['id']}})['then'](function(_0x4a9c5e){if(!_0x4a9c5e)throw new Error(_0x0491('0x72')+_0x360943['params']['id']);return db[_0x0491('0x43')][_0x0491('0x6f')](_0x360943);})['then'](respondWithFilteredResult(_0x3bc361,_0x149cbe))[_0x0491('0x49')](handleError(_0x3bc361,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 904719d..7088f0e 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 _0x9af6=['hook','exports','events','../../mysqldb','UserProfile','update','emit'];(function(_0x1d90cd,_0x1d2745){var _0x81bbac=function(_0x4f91cd){while(--_0x4f91cd){_0x1d90cd['push'](_0x1d90cd['shift']());}};_0x81bbac(++_0x1d2745);}(_0x9af6,0x1d7));var _0x69af=function(_0x2cfa7e,_0x2df2af){_0x2cfa7e=_0x2cfa7e-0x0;var _0xa9680=_0x9af6[_0x2cfa7e];return _0xa9680;};'use strict';var EventEmitter=require(_0x69af('0x0'));var UserProfile=require(_0x69af('0x1'))['db'][_0x69af('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x69af('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5e0e6b){return function(_0x185b85,_0x11f0e4,_0x2b73be){UserProfileEvents['emit'](_0x5e0e6b+':'+_0x185b85['id'],_0x185b85);UserProfileEvents[_0x69af('0x4')](_0x5e0e6b,_0x185b85);_0x2b73be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x69af('0x5')](e,emitEvent(event));}}module[_0x69af('0x6')]=UserProfileEvents; \ No newline at end of file +var _0x5ff9=['../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ff9,0xa0));var _0x95ff=function(_0x1df0a7,_0x3b31bd){_0x1df0a7=_0x1df0a7-0x0;var _0xf612a2=_0x5ff9[_0x1df0a7];return _0xf612a2;};'use strict';var EventEmitter=require(_0x95ff('0x0'));var UserProfile=require(_0x95ff('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x95ff('0x2')](0x0);var events={'afterCreate':_0x95ff('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3d1ce4){return function(_0x58eb5d,_0x5b1bee,_0x174f9d){UserProfileEvents[_0x95ff('0x4')](_0x3d1ce4+':'+_0x58eb5d['id'],_0x58eb5d);UserProfileEvents['emit'](_0x3d1ce4,_0x58eb5d);_0x174f9d(null);};}for(var e in events){if(events[_0x95ff('0x5')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x95ff('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 5eb31e0..2568ae9 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 _0x26e9=['OpenTabs','define','UserProfile','user_profiles','raw','section','Invalid\x20section\x20\x27','isEmpty','UserProfileSection','find','params','all','ignore','union','push','autoAssociation','model','rawAttributes','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','length','forEach','options','includeAll','include','default','custom','CustomReports','count','rows','Tags','color','tag','openTabs','true','chat','dataValues','sms','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','exports','filter','field','value','findAll','then','associatedResources','map','catch','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','parentSections','SquareProjects','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','FaxQueue','FaxAccount','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','outbound','musiconholds','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','whatsappqueues','whatsappaccounts','teams','Team','voicequeues','QueueCampaigns','users','agents','admin','user','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','zohoaccounts','ZohoAccount','cannedanswers','Disposition','customdashboards','Interval','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','ui.createdAt','user_has_','_interactions','where','sequelize','toString'];(function(_0x2142fa,_0x1e9945){var _0x350983=function(_0x125657){while(--_0x125657){_0x2142fa['push'](_0x2142fa['shift']());}};_0x350983(++_0x1e9945);}(_0x26e9,0xf2));var _0x926e=function(_0x30ba61,_0x48b905){_0x30ba61=_0x30ba61-0x0;var _0x7300ad=_0x26e9[_0x30ba61];return _0x7300ad;};'use strict';var _=require(_0x926e('0x0'));var attributes=require(_0x926e('0x1'));var qs=require(_0x926e('0x2'));var squel=require('squel');module[_0x926e('0x3')]=function(_0x551387){var _0x1cf850=_0x551387['models'];function _0x4f50cb(_0x500a90,_0x5f0a9a){return new Promise(function(_0x1ae84d,_0x1c707a){if(!_0x5f0a9a)return _0x1ae84d(null);var _0x3c68c7=_0x5f0a9a['filter']?{[_0x5f0a9a[_0x926e('0x4')][_0x926e('0x5')]]:_0x5f0a9a[_0x926e('0x4')][_0x926e('0x6')]}:undefined;return _0x1cf850[_0x500a90][_0x926e('0x7')]({'where':_0x3c68c7,'raw':!![]})[_0x926e('0x8')](function(_0x16159f){_0x5f0a9a[_0x926e('0x9')]=_[_0x926e('0xa')](_0x16159f,'id');_0x1ae84d(_0x5f0a9a);})[_0x926e('0xb')](function(_0x448a7f){_0x1c707a(_0x448a7f);});});}function _0x8848d6(_0x282ca1,_0x46e996){return new Promise(function(_0x4ba8bc,_0x33c98b){var _0x4fafa8=_0x282ca1[_0x926e('0x4')]?{[_0x282ca1[_0x926e('0x4')]['field']]:_0x282ca1[_0x926e('0x4')][_0x926e('0x6')]}:undefined;return _0x1cf850[_0x282ca1['model']][_0x926e('0x7')]({'where':_0x4fafa8,'raw':!![]})[_0x926e('0x8')](function(_0x1547fa){_0x46e996[_0x926e('0x9')]=_[_0x926e('0xa')](_0x1547fa,function(_0x3133c3){return _0x3133c3[_0x926e('0xc')];});_0x4ba8bc(_0x46e996);})['catch'](function(_0x4f8ffc){_0x33c98b(_0x4f8ffc);});});}function _0x32c71f(_0x15edfa,_0x36d3d7,_0x23f63b){if(!_0x36d3d7)return Promise[_0x926e('0xd')](null);return new Promise(function(_0x258267,_0x37eab3){return _0x1cf850[_0x926e('0xe')]['findAll']({'where':{'sectionId':_0x36d3d7['id']},'raw':!![]})[_0x926e('0x8')](function(_0x1db6af){if(_0x15edfa[_0x926e('0x5')]&&_0x15edfa[_0x926e('0x5')]!=='id'){_0x36d3d7[_0x926e('0x9')]=_[_0x926e('0xa')](_0x1db6af,function(_0x4e99af){return _0x4e99af[_0x15edfa[_0x926e('0x5')]];});}else{if(_0x23f63b===_0x926e('0xf')){_0x36d3d7[_0x926e('0x9')]=_[_0x926e('0xa')](_0x1db6af,function(_0x1e6c8e){return{'id':_0x1e6c8e[_0x926e('0x10')],'type':_0x1e6c8e['type']};});}else{_0x36d3d7[_0x926e('0x9')]=_['map'](_0x1db6af,function(_0x5a66a1){return _0x5a66a1[_0x926e('0x10')];});}}_0x258267(_0x36d3d7);})[_0x926e('0xb')](function(_0x4c0887){_0x37eab3(_0x4c0887);});});}function _0x591389(_0x459054,_0x5ef4be){var _0x424f16={'parentSections':[]};switch(_0x459054[_0x926e('0x11')]()){case _0x926e('0x12'):_0x424f16[_0x926e('0x13')]=_0x926e('0x14');break;case _0x926e('0x15'):_0x424f16['childModel']='SquareOdbc';break;case'squarerecordings':_0x424f16['childModel']='SquareRecording';_0x424f16[_0x926e('0x16')]=[{'name':_0x926e('0x17'),'field':'name','foreignKey':'projectName'}];break;case _0x926e('0x18'):_0x424f16[_0x926e('0x13')]=_0x926e('0x19');break;case _0x926e('0x1a'):_0x424f16['childModel']=_0x926e('0x1b');_0x424f16[_0x926e('0x16')]=[{'name':_0x926e('0x1c'),'field':'id','foreignKey':_0x926e('0x1d')}];break;case _0x926e('0x1e'):_0x424f16[_0x926e('0x13')]=_0x926e('0x1f');break;case _0x926e('0x20'):_0x424f16['childModel']=_0x926e('0x21');break;case _0x926e('0x22'):_0x424f16[_0x926e('0x13')]=_0x926e('0x23');break;case _0x926e('0x24'):_0x424f16[_0x926e('0x13')]=_0x926e('0x25');break;case'chatwebsites':_0x424f16[_0x926e('0x13')]=_0x926e('0x26');break;case'faxqueues':_0x424f16['childModel']=_0x926e('0x27');break;case'faxaccounts':_0x424f16[_0x926e('0x13')]=_0x926e('0x28');break;case'inboundroutes':case _0x926e('0x29'):case _0x926e('0x2a'):_0x424f16['childModel']='VoiceExtension';break;case _0x926e('0x2b'):_0x424f16['childModel']=_0x926e('0x2c');break;case _0x926e('0x2d'):_0x424f16[_0x926e('0x13')]=_0x926e('0x2e');break;case _0x926e('0x2f'):_0x424f16[_0x926e('0x13')]=_0x926e('0x30');_0x424f16[_0x926e('0x16')]=[{'name':'Agents','field':_0x926e('0xc'),'foreignKey':_0x926e('0x31'),'model':_0x926e('0x32'),'filter':{'field':_0x926e('0x33'),'value':[_0x926e('0x34')]}},{'name':_0x926e('0x35'),'field':_0x926e('0xc'),'foreignKey':_0x926e('0x31'),'model':_0x926e('0x32'),'filter':{'field':_0x926e('0x33'),'value':[_0x926e('0x36')]}},{'name':_0x926e('0x37'),'field':_0x926e('0xc'),'foreignKey':_0x926e('0x38'),'model':_0x926e('0x39'),'filter':{'field':_0x926e('0x3a'),'value':[_0x926e('0x3b')]}},{'name':'QueueCampaigns','field':_0x926e('0xc'),'foreignKey':'queue','model':_0x926e('0x39'),'filter':{'field':'type','value':[_0x926e('0x3c')]}}];break;case _0x926e('0x3d'):_0x424f16[_0x926e('0x13')]='VoiceMusicOnHold';break;case _0x926e('0x3e'):_0x424f16['childModel']=_0x926e('0x3f');break;case'voiceprefixes':_0x424f16[_0x926e('0x13')]=_0x926e('0x40');break;case _0x926e('0x41'):_0x424f16[_0x926e('0x13')]=_0x926e('0x42');break;case _0x926e('0x43'):_0x424f16[_0x926e('0x13')]=_0x926e('0x44');break;case _0x926e('0x45'):_0x424f16['childModel']='MailAccount';break;case _0x926e('0x46'):_0x424f16['childModel']='MailSubstatus';break;case _0x926e('0x47'):_0x424f16[_0x926e('0x13')]=_0x926e('0x48');break;case _0x926e('0x49'):_0x424f16[_0x926e('0x13')]='OpenchannelAccount';break;case _0x926e('0x4a'):_0x424f16[_0x926e('0x13')]=_0x926e('0x4b');break;case'smsaccounts':_0x424f16[_0x926e('0x13')]='SmsAccount';break;case _0x926e('0x4c'):_0x424f16['childModel']='WhatsappQueue';break;case _0x926e('0x4d'):_0x424f16['childModel']='WhatsappAccount';break;case _0x926e('0x4e'):_0x424f16['childModel']=_0x926e('0x4f');break;case _0x926e('0x50'):case'queuecampaigns':_0x424f16['childModel']=_0x926e('0x39');if(_0x5ef4be){_0x424f16[_0x926e('0x16')]=[{'name':_0x926e('0x37')},{'name':_0x926e('0x51')}];}break;case _0x926e('0x52'):case _0x926e('0x53'):case'telephones':_0x424f16[_0x926e('0x13')]=_0x926e('0x32');if(_0x5ef4be){_0x424f16['parentSections']=[{'name':'Users','filter':{'field':_0x926e('0x33'),'value':[_0x926e('0x54'),_0x926e('0x55')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x424f16[_0x926e('0x13')]=_0x926e('0x56');break;case _0x926e('0x57'):_0x424f16['childModel']='SalesforceAccount';break;case _0x926e('0x58'):_0x424f16['childModel']=_0x926e('0x59');break;case _0x926e('0x5a'):_0x424f16[_0x926e('0x13')]='SugarcrmAccount';break;case _0x926e('0x5b'):_0x424f16['childModel']='DeskAccount';break;case _0x926e('0x5c'):_0x424f16['childModel']=_0x926e('0x5d');break;case'vtigeraccounts':_0x424f16['childModel']=_0x926e('0x32');break;case _0x926e('0x5e'):_0x424f16[_0x926e('0x13')]='CannedAnswer';break;case'dispositions':_0x424f16[_0x926e('0x13')]=_0x926e('0x5f');break;case _0x926e('0x60'):_0x424f16['childModel']='Dashboard';break;case'intervals':_0x424f16[_0x926e('0x13')]=_0x926e('0x61');break;case'pauses':_0x424f16[_0x926e('0x13')]=_0x926e('0x62');break;case _0x926e('0x63'):_0x424f16[_0x926e('0x13')]=_0x926e('0x64');break;case _0x926e('0x65'):_0x424f16[_0x926e('0x13')]=_0x926e('0x66');break;case _0x926e('0x67'):_0x424f16[_0x926e('0x13')]=_0x926e('0x68');break;case'templates':_0x424f16[_0x926e('0x13')]=_0x926e('0x69');break;case _0x926e('0x6a'):_0x424f16['childModel']=_0x926e('0x6b');break;case _0x926e('0x6c'):_0x424f16['childModel']=_0x926e('0x6d');break;case _0x926e('0x6e'):_0x424f16[_0x926e('0x13')]=_0x926e('0x6f');break;case _0x926e('0x70'):_0x424f16[_0x926e('0x13')]=_0x926e('0x71');break;case _0x926e('0x72'):_0x424f16[_0x926e('0x13')]=_0x926e('0xf');_0x424f16[_0x926e('0x16')]=[{'name':_0x926e('0x73'),'field':'id','foreignKey':_0x926e('0x74')}];break;case _0x926e('0x75'):_0x424f16[_0x926e('0x13')]=_0x926e('0x76');break;}return _0x424f16;}function _0x4b7913(_0x3b81a7,_0x26fb5f){var _0x125768=_0x3b81a7[_0x926e('0x77')](0x0)[_0x926e('0x78')]()+_0x3b81a7[_0x926e('0x79')](0x1);var _0x521b48={'type':_0x1cf850['Sequelize'][_0x926e('0x7a')][_0x926e('0x7b')],'raw':!![]};return new Promise(function(_0x17c92c,_0x36dd44){var _0x3ba535=squel[_0x926e('0x7c')]()[_0x926e('0x5')](_0x926e('0x7d')+_0x125768+'InteractionId','id')['field'](_0x926e('0x7e'))['from'](_0x926e('0x7f')+_0x3b81a7+_0x926e('0x80'),'ui')[_0x926e('0x81')]('ui.UserId\x20=\x20?',_0x26fb5f['id']);return _0x1cf850[_0x926e('0x82')]['query'](_0x3ba535[_0x926e('0x83')](),_0x521b48)[_0x926e('0x8')](function(_0x4a008b){_0x26fb5f[_0x125768+_0x926e('0x84')]=_0x4a008b;_0x17c92c(_0x4a008b);})[_0x926e('0xb')](function(_0x50c43a){_0x36dd44(_0x50c43a);});});}return _0x551387[_0x926e('0x85')](_0x926e('0x86'),attributes,{'tableName':_0x926e('0x87'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5e5f2e){var _0x1d4c8d={'raw':_0x5e5f2e['query'][_0x926e('0x88')],'where':{}};var _0x45eda6={};var _0x4423c2={'count':0x0,'rows':[]};var _0x41a7cf=_0x5e5f2e['query'][_0x926e('0x89')];var _0x239448=_0x5e5f2e['query']['mergeResources']||![];var _0x413e90=_0x591389(_0x41a7cf,_0x239448);if(!_0x413e90['childModel'])throw new Error(_0x926e('0x8a')+_0x41a7cf+'\x27');var _0x2bf8d5=[{'name':_0x41a7cf}];if(!_[_0x926e('0x8b')](_0x413e90[_0x926e('0x16')]))_0x2bf8d5=_0x413e90['parentSections'];var _0x27e562=[];for(var _0x3674a3=0x0;_0x3674a3<_0x2bf8d5['length'];_0x3674a3++){_0x27e562['push'](_0x1cf850[_0x926e('0x8c')][_0x926e('0x8d')]({'where':{'userProfileId':_0x5e5f2e[_0x926e('0x8e')]['id'],'name':_0x2bf8d5[_0x3674a3][_0x926e('0xc')]},'raw':!![]}));}return Promise[_0x926e('0x8f')](_0x27e562)[_0x926e('0x8')](function(_0x2b81c5){var _0x2316c0=_[_0x926e('0x4')](_0x2b81c5,function(_0x3b8328){return _0x3b8328?_0x3b8328:undefined;});var _0x30e3a5=_[_0x926e('0x4')](_0x2bf8d5,[_0x926e('0x90'),!![]]);var _0xcbc8a3=_[_0x926e('0x8b')](_0x2316c0)&&_[_0x926e('0x8b')](_0x30e3a5)?null:_[_0x926e('0x91')](_0x30e3a5,_0x2316c0);if(!_0xcbc8a3)return null;var _0x4ebecd=[];for(var _0x4c2fb9=0x0;_0x4c2fb9<_0xcbc8a3['length'];_0x4c2fb9++){var _0x285157=_[_0x926e('0x8d')](_0x2bf8d5,function(_0x469977){return _0xcbc8a3[_0x4c2fb9]?_0x469977[_0x926e('0xc')]===_0xcbc8a3[_0x4c2fb9][_0x926e('0xc')]:null;});if(_0x285157){if(_0xcbc8a3[_0x4c2fb9][_0x926e('0x90')]){_0x4ebecd[_0x926e('0x92')](_0x4f50cb(_0x413e90['childModel'],_0xcbc8a3[_0x4c2fb9]));}else{if(!_0xcbc8a3[_0x4c2fb9][_0x926e('0x93')]){_0x4ebecd[_0x926e('0x92')](_0x32c71f(_0x285157,_0xcbc8a3[_0x4c2fb9],_0x413e90[_0x926e('0x13')]));}else{if(_0x285157[_0x926e('0x94')]){_0x4ebecd[_0x926e('0x92')](_0x8848d6(_0x285157,_0xcbc8a3[_0x4c2fb9]));}}}}}return Promise[_0x926e('0x8f')](_0x4ebecd);})['then'](function(_0x31266a){var _0x676bc1=_0x31266a;var _0x2d05a6=null;if(_0x676bc1){_0x2d05a6=_0x676bc1['length']===0x1?_0x676bc1[0x0]:null;}if(!_0x2d05a6&&!_0x676bc1)return _0x4423c2;var _0xff2cb6=_0x1cf850[_0x413e90['childModel']][_0x926e('0x95')];_0x45eda6[_0x926e('0x94')]=_[_0x926e('0x96')](_0xff2cb6);_0x45eda6['query']=_[_0x926e('0x96')](_0x5e5f2e[_0x926e('0x97')]);_0x45eda6[_0x926e('0x98')]=_['intersection'](_0x45eda6['model'],_0x45eda6[_0x926e('0x97')]);_0x1d4c8d[_0x926e('0x99')]=_[_0x926e('0x9a')](_0x45eda6['model'],qs[_0x926e('0x9b')](_0x5e5f2e['query'][_0x926e('0x9b')]));_0x1d4c8d['attributes']=_0x1d4c8d['attributes']['length']?_0x1d4c8d[_0x926e('0x99')]:_0x45eda6[_0x926e('0x94')];if(!_0x5e5f2e[_0x926e('0x97')][_0x926e('0x9c')](_0x926e('0x9d'))){_0x1d4c8d[_0x926e('0x9e')]=qs['limit'](_0x5e5f2e['query'][_0x926e('0x9e')]);_0x1d4c8d['offset']=qs[_0x926e('0x9f')](_0x5e5f2e[_0x926e('0x97')][_0x926e('0x9f')]);}_0x1d4c8d[_0x926e('0xa0')]=qs['sort'](_0x5e5f2e[_0x926e('0x97')][_0x926e('0xa1')]);_0x1d4c8d[_0x926e('0x81')]=qs[_0x926e('0x98')](_[_0x926e('0xa2')](_0x5e5f2e[_0x926e('0x97')],_0x45eda6[_0x926e('0x98')]));if(_0x5e5f2e[_0x926e('0x97')][_0x926e('0x4')]){_0x1d4c8d[_0x926e('0x81')]=_[_0x926e('0xa3')](_0x1d4c8d['where'],{'$or':_['map'](_0xff2cb6,function(_0x3b1fac){if(_0x3b1fac['type'][_0x926e('0xa4')]!==_0x926e('0xa5')){var _0x33408e={};_0x33408e[_0x3b1fac['field']]={'$like':'%'+_0x5e5f2e[_0x926e('0x97')][_0x926e('0x4')]+'%'};return _0x33408e;}})});}var _0x4d37f7=[];var _0x2d9444=null;var _0x2a2b52={};if(_0x2d05a6){_0x2d9444=_[_0x926e('0x8d')](_0x2bf8d5,[_0x926e('0xc'),_0x2d05a6[_0x926e('0xc')]]);if(_0x2d9444[_0x926e('0x5')]){_0x2a2b52={};if(_0x413e90[_0x926e('0x13')]==='AnalyticExtractedReport'){_0x2a2b52[_0x2d9444[_0x926e('0xa6')]]=_[_0x926e('0xa')](_0x2d05a6[_0x926e('0x9')],'id');}else{_0x2a2b52[_0x2d9444[_0x926e('0xa6')]]=_0x2d05a6[_0x926e('0x9')];}_0x4d37f7[_0x926e('0x92')](_0x2a2b52);}else{_0x1d4c8d['where']['id']=_0x2d05a6[_0x926e('0x9')];}}else{for(var _0x164210=0x0;_0x164210<_0x676bc1[_0x926e('0xa7')];_0x164210++){_0x2d9444=_['find'](_0x2bf8d5,[_0x926e('0xc'),_0x676bc1[_0x164210][_0x926e('0xc')]]);if(_0x2d9444[_0x926e('0x5')]){_0x2a2b52={};_0x2a2b52[_0x2d9444[_0x926e('0xa6')]]=_0x676bc1[_0x164210][_0x926e('0x9')];_0x4d37f7['push'](_0x2a2b52);}else{if(!_0x1d4c8d[_0x926e('0x81')]['id'])_0x1d4c8d[_0x926e('0x81')]['id']=[];_0x676bc1[_0x164210][_0x926e('0x9')][_0x926e('0xa8')](function(_0x573c49){_0x1d4c8d[_0x926e('0x81')]['id']['push'](_0x573c49);});}}}if(!_[_0x926e('0x8b')](_0x4d37f7)){_0x1d4c8d['where']=_['merge'](_0x1d4c8d[_0x926e('0x81')],{'$and':{'$or':_0x4d37f7}});}_0x1d4c8d=_['merge']({},_0x1d4c8d,_0x5e5f2e[_0x926e('0xa9')]);if(_0x2d05a6&&!_0x2d05a6[_0x926e('0x93')]&&_0x413e90[_0x926e('0x13')]===_0x926e('0xf')){if(_0x5e5f2e[_0x926e('0x97')][_0x926e('0xaa')]){_0x1d4c8d[_0x926e('0xab')]=[{'all':!![]}];}return _0x1cf850[_0x413e90[_0x926e('0x13')]][_0x926e('0x7')](_0x1d4c8d)[_0x926e('0x8')](function(_0x41364e){var _0x3907d0=[];_0x41364e[_0x926e('0xa8')](function(_0x4cfd12){var _0xe952d;switch(_0x4cfd12['reportType']){case _0x926e('0xac'):_0xe952d=_[_0x926e('0x8d')](_0x2d05a6[_0x926e('0x9')],function(_0x2e42fe){return _0x2e42fe['id']===_0x4cfd12[_0x926e('0x74')]&&_0x2e42fe[_0x926e('0x3a')]==='DefaultReports';});break;case _0x926e('0xad'):_0xe952d=_[_0x926e('0x8d')](_0x2d05a6[_0x926e('0x9')],function(_0x5f0bb0){return _0x5f0bb0['id']===_0x4cfd12['reportId']&&_0x5f0bb0[_0x926e('0x3a')]===_0x926e('0xae');});break;}if(_0xe952d)_0x3907d0['push'](_0x4cfd12);});_0x4423c2[_0x926e('0xaf')]=_0x3907d0[_0x926e('0xa7')];_0x4423c2[_0x926e('0xb0')]=_0x3907d0;return _0x4423c2;});}else{return _0x1cf850[_0x413e90[_0x926e('0x13')]]['count']({'where':_0x1d4c8d[_0x926e('0x81')]})['then'](function(_0x321f82){_0x4423c2[_0x926e('0xaf')]=_0x321f82;if(_0x5e5f2e[_0x926e('0x97')]['includeAll']){if(_0x413e90[_0x926e('0x13')]==='CmContact'){_0x1d4c8d[_0x926e('0xab')]=[{'model':_0x1cf850['Tag'],'as':_0x926e('0xb1'),'attributes':['id',_0x926e('0xc'),_0x926e('0xb2')],'required':_0x5e5f2e[_0x926e('0x97')][_0x926e('0xb3')]?!![]:![]},{'model':_0x1cf850['Tag'],'as':'ThroughTags','attributes':['id','name',_0x926e('0xb2')],'through':_0x5e5f2e['query']['tag']?{'attributes':[],'where':{'TagId':_0x5e5f2e[_0x926e('0x97')][_0x926e('0xb3')]||undefined}}:{},'required':_0x5e5f2e[_0x926e('0x97')][_0x926e('0xb3')]?!![]:![]}];}else{_0x1d4c8d[_0x926e('0xab')]=[{'all':!![]}];}}return _0x1cf850[_0x413e90[_0x926e('0x13')]][_0x926e('0x7')](_0x1d4c8d);})['then'](function(_0x5c31af){_0x4423c2['rows']=_0x5c31af;if(_0x41a7cf==='Agents'&&_0x5e5f2e[_0x926e('0x97')][_0x926e('0xb4')]===_0x926e('0xb5')){var _0x54ddb5=[];for(var _0x4a1f00=0x0;_0x4a1f00<_0x4423c2['rows'][_0x926e('0xa7')];_0x4a1f00++){_0x54ddb5[_0x926e('0x92')](_0x4b7913(_0x926e('0xb6'),_0x4423c2[_0x926e('0xb0')][_0x4a1f00][_0x926e('0xb7')]));_0x54ddb5[_0x926e('0x92')](_0x4b7913(_0x926e('0xb8'),_0x4423c2[_0x926e('0xb0')][_0x4a1f00][_0x926e('0xb7')]));_0x54ddb5[_0x926e('0x92')](_0x4b7913('fax',_0x4423c2[_0x926e('0xb0')][_0x4a1f00][_0x926e('0xb7')]));_0x54ddb5[_0x926e('0x92')](_0x4b7913(_0x926e('0xb9'),_0x4423c2['rows'][_0x4a1f00][_0x926e('0xb7')]));_0x54ddb5['push'](_0x4b7913('openchannel',_0x4423c2[_0x926e('0xb0')][_0x4a1f00][_0x926e('0xb7')]));_0x54ddb5['push'](_0x4b7913(_0x926e('0xba'),_0x4423c2[_0x926e('0xb0')][_0x4a1f00]['dataValues']));}return Promise['all'](_0x54ddb5)[_0x926e('0x8')](function(){return _0x4423c2;});}return _0x4423c2;});}});}}});}; \ No newline at end of file +var _0x22d4=['params','union','ignore','autoAssociation','all','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','where','pick','merge','key','foreignKey','options','includeAll','forEach','default','reportId','DefaultReports','custom','CustomReports','count','rows','color','tag','openTabs','true','chat','sms','dataValues','mail','openchannel','whatsapp','./userProfile.attributes','squel','exports','filter','field','value','findAll','then','associatedResources','map','catch','model','name','resolve','UserProfileResource','AnalyticExtractedReport','type','toLowerCase','SquareProject','odbc','SquareOdbc','squarerecordings','childModel','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','parentSections','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','Agents','User','agent','membername','telephone','VoiceQueues','VoiceQueue','inbound','queue','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','smsqueues','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','QueueCampaigns','users','agents','Users','role','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','tags','Tag','Template','Trigger','trunks','Trunk','variables','Variable','metrics','charAt','Sequelize','QueryTypes','ui.','InteractionId','ui.createdAt','_interactions','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','find'];(function(_0x4fa939,_0x222e50){var _0x40d21a=function(_0x12b4f1){while(--_0x12b4f1){_0x4fa939['push'](_0x4fa939['shift']());}};_0x40d21a(++_0x222e50);}(_0x22d4,0xe2));var _0x422d=function(_0x164e8f,_0xdba27a){_0x164e8f=_0x164e8f-0x0;var _0x2b2840=_0x22d4[_0x164e8f];return _0x2b2840;};'use strict';var _=require('lodash');var attributes=require(_0x422d('0x0'));var qs=require('../../components/parsers/qs');var squel=require(_0x422d('0x1'));module[_0x422d('0x2')]=function(_0x44be05){var _0x2ad11d=_0x44be05['models'];function _0x317478(_0x1795a9,_0x20255a){return new Promise(function(_0x2d440b,_0x4fde01){if(!_0x20255a)return _0x2d440b(null);var _0x2b590b=_0x20255a[_0x422d('0x3')]?{[_0x20255a[_0x422d('0x3')][_0x422d('0x4')]]:_0x20255a['filter'][_0x422d('0x5')]}:undefined;return _0x2ad11d[_0x1795a9][_0x422d('0x6')]({'where':_0x2b590b,'raw':!![]})[_0x422d('0x7')](function(_0x1766cb){_0x20255a[_0x422d('0x8')]=_[_0x422d('0x9')](_0x1766cb,'id');_0x2d440b(_0x20255a);})[_0x422d('0xa')](function(_0x4d5dc8){_0x4fde01(_0x4d5dc8);});});}function _0x29777d(_0x38f506,_0x1a94aa){return new Promise(function(_0x1a968f,_0x43f34c){var _0x5419c5=_0x38f506[_0x422d('0x3')]?{[_0x38f506['filter'][_0x422d('0x4')]]:_0x38f506[_0x422d('0x3')][_0x422d('0x5')]}:undefined;return _0x2ad11d[_0x38f506[_0x422d('0xb')]][_0x422d('0x6')]({'where':_0x5419c5,'raw':!![]})[_0x422d('0x7')](function(_0x18e3dd){_0x1a94aa[_0x422d('0x8')]=_[_0x422d('0x9')](_0x18e3dd,function(_0xd8a51f){return _0xd8a51f[_0x422d('0xc')];});_0x1a968f(_0x1a94aa);})[_0x422d('0xa')](function(_0x519c5c){_0x43f34c(_0x519c5c);});});}function _0x417a27(_0x2e4242,_0x5be7d7,_0x20e948){if(!_0x5be7d7)return Promise[_0x422d('0xd')](null);return new Promise(function(_0x43693d,_0x301228){return _0x2ad11d[_0x422d('0xe')][_0x422d('0x6')]({'where':{'sectionId':_0x5be7d7['id']},'raw':!![]})[_0x422d('0x7')](function(_0x8636af){if(_0x2e4242[_0x422d('0x4')]&&_0x2e4242[_0x422d('0x4')]!=='id'){_0x5be7d7[_0x422d('0x8')]=_['map'](_0x8636af,function(_0x4b59c6){return _0x4b59c6[_0x2e4242[_0x422d('0x4')]];});}else{if(_0x20e948===_0x422d('0xf')){_0x5be7d7[_0x422d('0x8')]=_[_0x422d('0x9')](_0x8636af,function(_0x16cf48){return{'id':_0x16cf48['resourceId'],'type':_0x16cf48[_0x422d('0x10')]};});}else{_0x5be7d7[_0x422d('0x8')]=_[_0x422d('0x9')](_0x8636af,function(_0x949a0a){return _0x949a0a['resourceId'];});}}_0x43693d(_0x5be7d7);})[_0x422d('0xa')](function(_0x4c16e8){_0x301228(_0x4c16e8);});});}function _0x2d15ee(_0x317162,_0x514b37){var _0x45e003={'parentSections':[]};switch(_0x317162[_0x422d('0x11')]()){case'squareprojects':_0x45e003['childModel']=_0x422d('0x12');break;case _0x422d('0x13'):_0x45e003['childModel']=_0x422d('0x14');break;case _0x422d('0x15'):_0x45e003[_0x422d('0x16')]='SquareRecording';_0x45e003['parentSections']=[{'name':_0x422d('0x17'),'field':_0x422d('0xc'),'foreignKey':_0x422d('0x18')}];break;case _0x422d('0x19'):_0x45e003[_0x422d('0x16')]=_0x422d('0x1a');break;case _0x422d('0x1b'):_0x45e003[_0x422d('0x16')]=_0x422d('0x1c');_0x45e003[_0x422d('0x1d')]=[{'name':'Lists','field':'id','foreignKey':_0x422d('0x1e')}];break;case _0x422d('0x1f'):_0x45e003[_0x422d('0x16')]=_0x422d('0x20');break;case'companies':_0x45e003[_0x422d('0x16')]=_0x422d('0x21');break;case _0x422d('0x22'):_0x45e003[_0x422d('0x16')]=_0x422d('0x23');break;case _0x422d('0x24'):_0x45e003[_0x422d('0x16')]=_0x422d('0x25');break;case _0x422d('0x26'):_0x45e003[_0x422d('0x16')]=_0x422d('0x27');break;case'faxqueues':_0x45e003[_0x422d('0x16')]=_0x422d('0x28');break;case _0x422d('0x29'):_0x45e003['childModel']='FaxAccount';break;case _0x422d('0x2a'):case _0x422d('0x2b'):case'outboundroutes':_0x45e003[_0x422d('0x16')]=_0x422d('0x2c');break;case _0x422d('0x2d'):_0x45e003[_0x422d('0x16')]=_0x422d('0x2e');break;case _0x422d('0x2f'):_0x45e003[_0x422d('0x16')]='VoiceMail';break;case _0x422d('0x30'):_0x45e003['childModel']='VoiceRecording';_0x45e003['parentSections']=[{'name':_0x422d('0x31'),'field':_0x422d('0xc'),'foreignKey':'membername','model':_0x422d('0x32'),'filter':{'field':'role','value':[_0x422d('0x33')]}},{'name':'Telephones','field':_0x422d('0xc'),'foreignKey':_0x422d('0x34'),'model':_0x422d('0x32'),'filter':{'field':'role','value':[_0x422d('0x35')]}},{'name':_0x422d('0x36'),'field':_0x422d('0xc'),'foreignKey':'queue','model':_0x422d('0x37'),'filter':{'field':_0x422d('0x10'),'value':[_0x422d('0x38')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0x422d('0x39'),'model':_0x422d('0x37'),'filter':{'field':_0x422d('0x10'),'value':['outbound']}}];break;case _0x422d('0x3a'):_0x45e003[_0x422d('0x16')]=_0x422d('0x3b');break;case _0x422d('0x3c'):_0x45e003[_0x422d('0x16')]=_0x422d('0x3d');break;case _0x422d('0x3e'):_0x45e003['childModel']=_0x422d('0x3f');break;case _0x422d('0x40'):_0x45e003['childModel']=_0x422d('0x41');break;case _0x422d('0x42'):_0x45e003['childModel']=_0x422d('0x43');break;case _0x422d('0x44'):_0x45e003[_0x422d('0x16')]='MailAccount';break;case _0x422d('0x45'):_0x45e003['childModel']=_0x422d('0x46');break;case'openchannelqueues':_0x45e003[_0x422d('0x16')]=_0x422d('0x47');break;case _0x422d('0x48'):_0x45e003[_0x422d('0x16')]='OpenchannelAccount';break;case _0x422d('0x49'):_0x45e003['childModel']='SmsQueue';break;case _0x422d('0x4a'):_0x45e003['childModel']='SmsAccount';break;case _0x422d('0x4b'):_0x45e003[_0x422d('0x16')]=_0x422d('0x4c');break;case _0x422d('0x4d'):_0x45e003[_0x422d('0x16')]=_0x422d('0x4e');break;case _0x422d('0x4f'):_0x45e003[_0x422d('0x16')]=_0x422d('0x50');break;case'voicequeues':case'queuecampaigns':_0x45e003['childModel']=_0x422d('0x37');if(_0x514b37){_0x45e003[_0x422d('0x1d')]=[{'name':_0x422d('0x36')},{'name':_0x422d('0x51')}];}break;case _0x422d('0x52'):case _0x422d('0x53'):case'telephones':_0x45e003[_0x422d('0x16')]=_0x422d('0x32');if(_0x514b37){_0x45e003[_0x422d('0x1d')]=[{'name':_0x422d('0x54'),'filter':{'field':_0x422d('0x55'),'value':[_0x422d('0x56'),_0x422d('0x57')]},'ignore':!![]},{'name':'Agents'},{'name':_0x422d('0x58')}];}break;case _0x422d('0x59'):_0x45e003['childModel']=_0x422d('0x5a');break;case _0x422d('0x5b'):_0x45e003[_0x422d('0x16')]=_0x422d('0x5c');break;case'freshdeskaccounts':_0x45e003[_0x422d('0x16')]=_0x422d('0x5d');break;case'sugarcrmaccounts':_0x45e003[_0x422d('0x16')]=_0x422d('0x5e');break;case _0x422d('0x5f'):_0x45e003[_0x422d('0x16')]=_0x422d('0x60');break;case _0x422d('0x61'):_0x45e003[_0x422d('0x16')]=_0x422d('0x62');break;case _0x422d('0x63'):_0x45e003['childModel']='User';break;case _0x422d('0x64'):_0x45e003[_0x422d('0x16')]=_0x422d('0x65');break;case _0x422d('0x66'):_0x45e003[_0x422d('0x16')]='Disposition';break;case _0x422d('0x67'):_0x45e003[_0x422d('0x16')]=_0x422d('0x68');break;case _0x422d('0x69'):_0x45e003[_0x422d('0x16')]=_0x422d('0x6a');break;case _0x422d('0x6b'):_0x45e003[_0x422d('0x16')]=_0x422d('0x6c');break;case _0x422d('0x6d'):_0x45e003[_0x422d('0x16')]='Schedule';break;case _0x422d('0x6e'):_0x45e003[_0x422d('0x16')]=_0x422d('0x6f');break;case _0x422d('0x70'):_0x45e003['childModel']=_0x422d('0x71');break;case'templates':_0x45e003[_0x422d('0x16')]=_0x422d('0x72');break;case'triggers':_0x45e003[_0x422d('0x16')]=_0x422d('0x73');break;case _0x422d('0x74'):_0x45e003['childModel']=_0x422d('0x75');break;case _0x422d('0x76'):_0x45e003[_0x422d('0x16')]=_0x422d('0x77');break;case'plugins':_0x45e003[_0x422d('0x16')]='Plugin';break;case'extractedreports':_0x45e003['childModel']=_0x422d('0xf');_0x45e003['parentSections']=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x422d('0x78'):_0x45e003['childModel']='AnalyticMetric';break;}return _0x45e003;}function _0x19d7d1(_0x567a43,_0x3db6ba){var _0x1c94e2=_0x567a43[_0x422d('0x79')](0x0)['toUpperCase']()+_0x567a43['slice'](0x1);var _0x271803={'type':_0x2ad11d[_0x422d('0x7a')][_0x422d('0x7b')]['SELECT'],'raw':!![]};return new Promise(function(_0x1e794d,_0x35f7b2){var _0x218faf=squel['select']()['field'](_0x422d('0x7c')+_0x1c94e2+_0x422d('0x7d'),'id')[_0x422d('0x4')](_0x422d('0x7e'))['from']('user_has_'+_0x567a43+_0x422d('0x7f'),'ui')['where'](_0x422d('0x80'),_0x3db6ba['id']);return _0x2ad11d[_0x422d('0x81')][_0x422d('0x82')](_0x218faf[_0x422d('0x83')](),_0x271803)[_0x422d('0x7')](function(_0x5d9cab){_0x3db6ba[_0x1c94e2+_0x422d('0x84')]=_0x5d9cab;_0x1e794d(_0x5d9cab);})['catch'](function(_0x315129){_0x35f7b2(_0x315129);});});}return _0x44be05[_0x422d('0x85')](_0x422d('0x86'),attributes,{'tableName':_0x422d('0x87'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x31d57e){var _0x398926={'raw':_0x31d57e['query'][_0x422d('0x88')],'where':{}};var _0x3c61b3={};var _0x28ae4b={'count':0x0,'rows':[]};var _0x3801a5=_0x31d57e[_0x422d('0x82')][_0x422d('0x89')];var _0x680134=_0x31d57e['query'][_0x422d('0x8a')]||![];var _0x4c8aed=_0x2d15ee(_0x3801a5,_0x680134);if(!_0x4c8aed[_0x422d('0x16')])throw new Error(_0x422d('0x8b')+_0x3801a5+'\x27');var _0x47ff8b=[{'name':_0x3801a5}];if(!_[_0x422d('0x8c')](_0x4c8aed[_0x422d('0x1d')]))_0x47ff8b=_0x4c8aed[_0x422d('0x1d')];var _0x2f5ca5=[];for(var _0x22bc13=0x0;_0x22bc13<_0x47ff8b[_0x422d('0x8d')];_0x22bc13++){_0x2f5ca5[_0x422d('0x8e')](_0x2ad11d['UserProfileSection'][_0x422d('0x8f')]({'where':{'userProfileId':_0x31d57e[_0x422d('0x90')]['id'],'name':_0x47ff8b[_0x22bc13][_0x422d('0xc')]},'raw':!![]}));}return Promise['all'](_0x2f5ca5)[_0x422d('0x7')](function(_0x3b8e23){var _0x506483=_[_0x422d('0x3')](_0x3b8e23,function(_0x26880c){return _0x26880c?_0x26880c:undefined;});var _0x344883=_[_0x422d('0x3')](_0x47ff8b,['ignore',!![]]);var _0x505daa=_[_0x422d('0x8c')](_0x506483)&&_[_0x422d('0x8c')](_0x344883)?null:_[_0x422d('0x91')](_0x344883,_0x506483);if(!_0x505daa)return null;var _0x17bd48=[];for(var _0x5bb3b2=0x0;_0x5bb3b2<_0x505daa['length'];_0x5bb3b2++){var _0x43021b=_[_0x422d('0x8f')](_0x47ff8b,function(_0x364443){return _0x505daa[_0x5bb3b2]?_0x364443[_0x422d('0xc')]===_0x505daa[_0x5bb3b2][_0x422d('0xc')]:null;});if(_0x43021b){if(_0x505daa[_0x5bb3b2][_0x422d('0x92')]){_0x17bd48['push'](_0x317478(_0x4c8aed[_0x422d('0x16')],_0x505daa[_0x5bb3b2]));}else{if(!_0x505daa[_0x5bb3b2][_0x422d('0x93')]){_0x17bd48[_0x422d('0x8e')](_0x417a27(_0x43021b,_0x505daa[_0x5bb3b2],_0x4c8aed[_0x422d('0x16')]));}else{if(_0x43021b[_0x422d('0xb')]){_0x17bd48[_0x422d('0x8e')](_0x29777d(_0x43021b,_0x505daa[_0x5bb3b2]));}}}}}return Promise[_0x422d('0x94')](_0x17bd48);})[_0x422d('0x7')](function(_0x2535d2){var _0x229784=_0x2535d2;var _0x247ea2=null;if(_0x229784){_0x247ea2=_0x229784['length']===0x1?_0x229784[0x0]:null;}if(!_0x247ea2&&!_0x229784)return _0x28ae4b;var _0x5f136f=_0x2ad11d[_0x4c8aed[_0x422d('0x16')]][_0x422d('0x95')];_0x3c61b3[_0x422d('0xb')]=_[_0x422d('0x96')](_0x5f136f);_0x3c61b3['query']=_[_0x422d('0x96')](_0x31d57e[_0x422d('0x82')]);_0x3c61b3[_0x422d('0x97')]=_[_0x422d('0x98')](_0x3c61b3[_0x422d('0xb')],_0x3c61b3[_0x422d('0x82')]);_0x398926[_0x422d('0x99')]=_[_0x422d('0x98')](_0x3c61b3[_0x422d('0xb')],qs[_0x422d('0x9a')](_0x31d57e['query'][_0x422d('0x9a')]));_0x398926[_0x422d('0x99')]=_0x398926['attributes'][_0x422d('0x8d')]?_0x398926['attributes']:_0x3c61b3[_0x422d('0xb')];if(!_0x31d57e[_0x422d('0x82')]['hasOwnProperty'](_0x422d('0x9b'))){_0x398926[_0x422d('0x9c')]=qs['limit'](_0x31d57e[_0x422d('0x82')]['limit']);_0x398926[_0x422d('0x9d')]=qs['offset'](_0x31d57e[_0x422d('0x82')][_0x422d('0x9d')]);}_0x398926[_0x422d('0x9e')]=qs[_0x422d('0x9f')](_0x31d57e['query']['sort']);_0x398926[_0x422d('0xa0')]=qs[_0x422d('0x97')](_[_0x422d('0xa1')](_0x31d57e[_0x422d('0x82')],_0x3c61b3[_0x422d('0x97')]));if(_0x31d57e[_0x422d('0x82')][_0x422d('0x3')]){_0x398926['where']=_[_0x422d('0xa2')](_0x398926[_0x422d('0xa0')],{'$or':_[_0x422d('0x9')](_0x5f136f,function(_0x5e177b){if(_0x5e177b[_0x422d('0x10')][_0x422d('0xa3')]!=='VIRTUAL'){var _0x35aacb={};_0x35aacb[_0x5e177b[_0x422d('0x4')]]={'$like':'%'+_0x31d57e['query'][_0x422d('0x3')]+'%'};return _0x35aacb;}})});}var _0x23b0f8=[];var _0x4997c0=null;var _0x41fe47={};if(_0x247ea2){_0x4997c0=_[_0x422d('0x8f')](_0x47ff8b,['name',_0x247ea2[_0x422d('0xc')]]);if(_0x4997c0[_0x422d('0x4')]){_0x41fe47={};if(_0x4c8aed[_0x422d('0x16')]===_0x422d('0xf')){_0x41fe47[_0x4997c0['foreignKey']]=_[_0x422d('0x9')](_0x247ea2[_0x422d('0x8')],'id');}else{_0x41fe47[_0x4997c0[_0x422d('0xa4')]]=_0x247ea2[_0x422d('0x8')];}_0x23b0f8['push'](_0x41fe47);}else{_0x398926['where']['id']=_0x247ea2['associatedResources'];}}else{for(var _0x17aa04=0x0;_0x17aa04<_0x229784['length'];_0x17aa04++){_0x4997c0=_[_0x422d('0x8f')](_0x47ff8b,[_0x422d('0xc'),_0x229784[_0x17aa04][_0x422d('0xc')]]);if(_0x4997c0['field']){_0x41fe47={};_0x41fe47[_0x4997c0[_0x422d('0xa4')]]=_0x229784[_0x17aa04][_0x422d('0x8')];_0x23b0f8['push'](_0x41fe47);}else{if(!_0x398926[_0x422d('0xa0')]['id'])_0x398926[_0x422d('0xa0')]['id']=[];_0x229784[_0x17aa04][_0x422d('0x8')]['forEach'](function(_0x55df9f){_0x398926[_0x422d('0xa0')]['id'][_0x422d('0x8e')](_0x55df9f);});}}}if(!_[_0x422d('0x8c')](_0x23b0f8)){_0x398926[_0x422d('0xa0')]=_[_0x422d('0xa2')](_0x398926[_0x422d('0xa0')],{'$and':{'$or':_0x23b0f8}});}_0x398926=_[_0x422d('0xa2')]({},_0x398926,_0x31d57e[_0x422d('0xa5')]);if(_0x247ea2&&!_0x247ea2['autoAssociation']&&_0x4c8aed[_0x422d('0x16')]===_0x422d('0xf')){if(_0x31d57e[_0x422d('0x82')][_0x422d('0xa6')]){_0x398926['include']=[{'all':!![]}];}return _0x2ad11d[_0x4c8aed[_0x422d('0x16')]][_0x422d('0x6')](_0x398926)[_0x422d('0x7')](function(_0x469312){var _0x214390=[];_0x469312[_0x422d('0xa7')](function(_0x2bb2b5){var _0x300dc2;switch(_0x2bb2b5['reportType']){case _0x422d('0xa8'):_0x300dc2=_[_0x422d('0x8f')](_0x247ea2[_0x422d('0x8')],function(_0x1ba96a){return _0x1ba96a['id']===_0x2bb2b5[_0x422d('0xa9')]&&_0x1ba96a['type']===_0x422d('0xaa');});break;case _0x422d('0xab'):_0x300dc2=_['find'](_0x247ea2[_0x422d('0x8')],function(_0x29830b){return _0x29830b['id']===_0x2bb2b5['reportId']&&_0x29830b[_0x422d('0x10')]===_0x422d('0xac');});break;}if(_0x300dc2)_0x214390['push'](_0x2bb2b5);});_0x28ae4b[_0x422d('0xad')]=_0x214390[_0x422d('0x8d')];_0x28ae4b[_0x422d('0xae')]=_0x214390;return _0x28ae4b;});}else{return _0x2ad11d[_0x4c8aed[_0x422d('0x16')]]['count']({'where':_0x398926['where']})[_0x422d('0x7')](function(_0x166696){_0x28ae4b[_0x422d('0xad')]=_0x166696;if(_0x31d57e['query'][_0x422d('0xa6')]){if(_0x4c8aed[_0x422d('0x16')]==='CmContact'){_0x398926['include']=[{'model':_0x2ad11d['Tag'],'as':'Tags','attributes':['id',_0x422d('0xc'),'color'],'required':_0x31d57e[_0x422d('0x82')]['tag']?!![]:![]},{'model':_0x2ad11d[_0x422d('0x71')],'as':'ThroughTags','attributes':['id',_0x422d('0xc'),_0x422d('0xaf')],'through':_0x31d57e[_0x422d('0x82')][_0x422d('0xb0')]?{'attributes':[],'where':{'TagId':_0x31d57e[_0x422d('0x82')][_0x422d('0xb0')]||undefined}}:{},'required':_0x31d57e[_0x422d('0x82')][_0x422d('0xb0')]?!![]:![]}];}else{_0x398926['include']=[{'all':!![]}];}}return _0x2ad11d[_0x4c8aed[_0x422d('0x16')]][_0x422d('0x6')](_0x398926);})[_0x422d('0x7')](function(_0x259067){_0x28ae4b[_0x422d('0xae')]=_0x259067;if(_0x3801a5===_0x422d('0x31')&&_0x31d57e[_0x422d('0x82')][_0x422d('0xb1')]===_0x422d('0xb2')){var _0x3e6b00=[];for(var _0x4d1806=0x0;_0x4d1806<_0x28ae4b[_0x422d('0xae')][_0x422d('0x8d')];_0x4d1806++){_0x3e6b00[_0x422d('0x8e')](_0x19d7d1(_0x422d('0xb3'),_0x28ae4b[_0x422d('0xae')][_0x4d1806]['dataValues']));_0x3e6b00[_0x422d('0x8e')](_0x19d7d1(_0x422d('0xb4'),_0x28ae4b[_0x422d('0xae')][_0x4d1806][_0x422d('0xb5')]));_0x3e6b00[_0x422d('0x8e')](_0x19d7d1('fax',_0x28ae4b[_0x422d('0xae')][_0x4d1806][_0x422d('0xb5')]));_0x3e6b00[_0x422d('0x8e')](_0x19d7d1(_0x422d('0xb6'),_0x28ae4b[_0x422d('0xae')][_0x4d1806][_0x422d('0xb5')]));_0x3e6b00[_0x422d('0x8e')](_0x19d7d1(_0x422d('0xb7'),_0x28ae4b[_0x422d('0xae')][_0x4d1806][_0x422d('0xb5')]));_0x3e6b00[_0x422d('0x8e')](_0x19d7d1(_0x422d('0xb8'),_0x28ae4b[_0x422d('0xae')][_0x4d1806][_0x422d('0xb5')]));}return Promise[_0x422d('0x94')](_0x3e6b00)['then'](function(){return _0x28ae4b;});}return _0x28ae4b;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index e10838d..71a59af 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 _0x8daf=['request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x2a5d0b,_0x4894f1){var _0x4bbb7e=function(_0x14feb4){while(--_0x14feb4){_0x2a5d0b['push'](_0x2a5d0b['shift']());}};_0x4bbb7e(++_0x4894f1);}(_0x8daf,0x15c));var _0xf8da=function(_0x5ba5c7,_0x1caf61){_0x5ba5c7=_0x5ba5c7-0x0;var _0x574a48=_0x8daf[_0x5ba5c7];return _0x574a48;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf8da('0x0'));var fs=require('fs');var Redis=require(_0xf8da('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8da('0x2'));var logger=require(_0xf8da('0x3'))(_0xf8da('0x4'));var config=require(_0xf8da('0x5'));var jayson=require(_0xf8da('0x6'));var client=jayson[_0xf8da('0x7')][_0xf8da('0x8')]({'port':0x232a});config[_0xf8da('0x9')]=_[_0xf8da('0xa')](config['redis'],{'host':_0xf8da('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf8da('0x9')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x2f16ba,_0x44dabc,_0xbd4f48){return new BPromise(function(_0x408b04,_0x4463eb){return client[_0xf8da('0xc')](_0x2f16ba,_0xbd4f48)[_0xf8da('0xd')](function(_0x31193e){logger['info'](_0xf8da('0xe'),_0x44dabc,_0xf8da('0xf'));logger[_0xf8da('0x10')](_0xf8da('0x11'),_0x44dabc,'request\x20sent',JSON[_0xf8da('0x12')](_0x31193e));if(_0x31193e['error']){if(_0x31193e[_0xf8da('0x13')][_0xf8da('0x14')]===0x1f4){logger[_0xf8da('0x13')](_0xf8da('0xe'),_0x44dabc,_0x31193e[_0xf8da('0x13')]['message']);return _0x4463eb(_0x31193e[_0xf8da('0x13')][_0xf8da('0x15')]);}logger[_0xf8da('0x13')](_0xf8da('0xe'),_0x44dabc,_0x31193e[_0xf8da('0x13')][_0xf8da('0x15')]);return _0x408b04(_0x31193e[_0xf8da('0x13')]['message']);}else{logger[_0xf8da('0x16')]('UserProfile,\x20%s,\x20%s',_0x44dabc,'request\x20sent');_0x408b04(_0x31193e[_0xf8da('0x17')][_0xf8da('0x15')]);}})['catch'](function(_0x3e427){logger[_0xf8da('0x13')](_0xf8da('0xe'),_0x44dabc,_0x3e427);_0x4463eb(_0x3e427);});});} \ No newline at end of file +var _0x11f3=['redis','defaults','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http'];(function(_0x3a18e8,_0x5a4ae7){var _0x48cbf3=function(_0x460d58){while(--_0x460d58){_0x3a18e8['push'](_0x3a18e8['shift']());}};_0x48cbf3(++_0x5a4ae7);}(_0x11f3,0x149));var _0x311f=function(_0x3dc16f,_0x5e7b05){_0x3dc16f=_0x3dc16f-0x0;var _0x2bfa63=_0x11f3[_0x3dc16f];return _0x2bfa63;};'use strict';var _=require(_0x311f('0x0'));var util=require(_0x311f('0x1'));var moment=require(_0x311f('0x2'));var BPromise=require('bluebird');var rs=require(_0x311f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x311f('0x4'))['db'];var utils=require(_0x311f('0x5'));var logger=require(_0x311f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x311f('0x7'));var client=jayson['client'][_0x311f('0x8')]({'port':0x232a});config[_0x311f('0x9')]=_[_0x311f('0xa')](config[_0x311f('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x311f('0xb'))(new Redis(config[_0x311f('0x9')]));require(_0x311f('0xc'))[_0x311f('0xd')](socket);function respondWithRpcPromise(_0x7cd779,_0x495f48,_0x20de65){return new BPromise(function(_0x292325,_0x2e45d1){return client[_0x311f('0xe')](_0x7cd779,_0x20de65)[_0x311f('0xf')](function(_0x1d70ea){logger[_0x311f('0x10')](_0x311f('0x11'),_0x495f48,_0x311f('0x12'));logger[_0x311f('0x13')](_0x311f('0x14'),_0x495f48,_0x311f('0x12'),JSON[_0x311f('0x15')](_0x1d70ea));if(_0x1d70ea[_0x311f('0x16')]){if(_0x1d70ea[_0x311f('0x16')][_0x311f('0x17')]===0x1f4){logger[_0x311f('0x16')](_0x311f('0x11'),_0x495f48,_0x1d70ea[_0x311f('0x16')]['message']);return _0x2e45d1(_0x1d70ea['error']['message']);}logger[_0x311f('0x16')](_0x311f('0x11'),_0x495f48,_0x1d70ea[_0x311f('0x16')][_0x311f('0x18')]);return _0x292325(_0x1d70ea[_0x311f('0x16')][_0x311f('0x18')]);}else{logger[_0x311f('0x10')](_0x311f('0x11'),_0x495f48,_0x311f('0x12'));_0x292325(_0x1d70ea['result'][_0x311f('0x18')]);}})[_0x311f('0x19')](function(_0x3b9ca8){logger[_0x311f('0x16')](_0x311f('0x11'),_0x495f48,_0x3b9ca8);_0x2e45d1(_0x3b9ca8);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 0522895..39da722 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 _0x2585=['userProfile:','remove','update','emit','register','length'];(function(_0x19a206,_0x1d7556){var _0x7514ac=function(_0xaddeaa){while(--_0xaddeaa){_0x19a206['push'](_0x19a206['shift']());}};_0x7514ac(++_0x1d7556);}(_0x2585,0x19f));var _0x5258=function(_0x35a8d4,_0x1dc025){_0x35a8d4=_0x35a8d4-0x0;var _0x2e5fe0=_0x2585[_0x35a8d4];return _0x2e5fe0;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x5258('0x0'),_0x5258('0x1')];function createListener(_0x462f6d,_0xf32528){return function(_0x4b9521){_0xf32528[_0x5258('0x2')](_0x462f6d,_0x4b9521);};}function removeListener(_0x4e50cf,_0x5cf9a1){return function(){UserProfileEvents['removeListener'](_0x4e50cf,_0x5cf9a1);};}exports[_0x5258('0x3')]=function(_0x1427b6){for(var _0xe51109=0x0,_0x516803=events[_0x5258('0x4')];_0xe51109<_0x516803;_0xe51109++){var _0x2de34b=events[_0xe51109];var _0x118a5b=createListener(_0x5258('0x5')+_0x2de34b,_0x1427b6);UserProfileEvents['on'](_0x2de34b,_0x118a5b);}}; \ No newline at end of file +var _0xa04d=['save','remove','emit','removeListener','length','./userProfile.events'];(function(_0x11ca9b,_0x21cf96){var _0x22bc61=function(_0x1a9ec6){while(--_0x1a9ec6){_0x11ca9b['push'](_0x11ca9b['shift']());}};_0x22bc61(++_0x21cf96);}(_0xa04d,0xe3));var _0xda04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa04d[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require(_0xda04('0x0'));var events=[_0xda04('0x1'),_0xda04('0x2'),'update'];function createListener(_0x30eaec,_0x465bf7){return function(_0x3f90c6){_0x465bf7[_0xda04('0x3')](_0x30eaec,_0x3f90c6);};}function removeListener(_0x507e84,_0xf40acf){return function(){UserProfileEvents[_0xda04('0x4')](_0x507e84,_0xf40acf);};}exports['register']=function(_0x5762cf){for(var _0x8a62c2=0x0,_0x21a9c0=events[_0xda04('0x5')];_0x8a62c2<_0x21a9c0;_0x8a62c2++){var _0x448066=events[_0x8a62c2];var _0x428712=createListener('userProfile:'+_0x448066,_0x5762cf);UserProfileEvents['on'](_0x448066,_0x428712);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index ae3bb53..5aaf761 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 _0x1a06=['index','describe','/:id','show','post','create','put','update','destroy','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated'];(function(_0x36bf46,_0x3d8db9){var _0x1d0a72=function(_0x328e8d){while(--_0x328e8d){_0x36bf46['push'](_0x36bf46['shift']());}};_0x1d0a72(++_0x3d8db9);}(_0x1a06,0xe1));var _0x61a0=function(_0xa71605,_0x58763b){_0xa71605=_0xa71605-0x0;var _0x23587c=_0x1a06[_0xa71605];return _0x23587c;};'use strict';var multer=require('multer');var util=require(_0x61a0('0x0'));var path=require(_0x61a0('0x1'));var timeout=require(_0x61a0('0x2'));var express=require(_0x61a0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x61a0('0x4'));var config=require(_0x61a0('0x5'));var controller=require(_0x61a0('0x6'));router[_0x61a0('0x7')]('/',auth[_0x61a0('0x8')](),controller[_0x61a0('0x9')]);router[_0x61a0('0x7')]('/describe',auth[_0x61a0('0x8')](),controller[_0x61a0('0xa')]);router[_0x61a0('0x7')](_0x61a0('0xb'),auth['isAuthenticated'](),controller[_0x61a0('0xc')]);router[_0x61a0('0xd')]('/',auth['isAuthenticated'](),controller[_0x61a0('0xe')]);router[_0x61a0('0xf')](_0x61a0('0xb'),auth[_0x61a0('0x8')](),controller[_0x61a0('0x10')]);router['delete'](_0x61a0('0xb'),auth[_0x61a0('0x8')](),controller[_0x61a0('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa805=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','describe','/:id','post','destroy','multer','util','path','connect-timeout'];(function(_0x5f3eca,_0xf5e61e){var _0x18fc28=function(_0x49d26e){while(--_0x49d26e){_0x5f3eca['push'](_0x5f3eca['shift']());}};_0x18fc28(++_0xf5e61e);}(_0xa805,0x161));var _0x5a80=function(_0x847af,_0x38f42f){_0x847af=_0x847af-0x0;var _0x111667=_0xa805[_0x847af];return _0x111667;};'use strict';var multer=require(_0x5a80('0x0'));var util=require(_0x5a80('0x1'));var path=require(_0x5a80('0x2'));var timeout=require(_0x5a80('0x3'));var express=require(_0x5a80('0x4'));var router=express[_0x5a80('0x5')]();var fs_extra=require(_0x5a80('0x6'));var auth=require(_0x5a80('0x7'));var interaction=require(_0x5a80('0x8'));var config=require(_0x5a80('0x9'));var controller=require(_0x5a80('0xa'));router[_0x5a80('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5a80('0xb')]('/describe',auth[_0x5a80('0xc')](),controller[_0x5a80('0xd')]);router[_0x5a80('0xb')](_0x5a80('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x5a80('0xf')]('/',auth[_0x5a80('0xc')](),controller['create']);router['put'](_0x5a80('0xe'),auth[_0x5a80('0xc')](),controller['update']);router['delete'](_0x5a80('0xe'),auth[_0x5a80('0xc')](),controller[_0x5a80('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 2bf8270..f7651ec 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 _0xe3ca=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3ca,0x135));var _0xae3c=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xe3ca[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require(_0xae3c('0x0'));module[_0xae3c('0x1')]={'name':{'type':Sequelize[_0xae3c('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x62ab=['exports','INTEGER','STRING'];(function(_0x2f2781,_0x579a21){var _0x5d14e4=function(_0x5f2f71){while(--_0x5f2f71){_0x2f2781['push'](_0x2f2781['shift']());}};_0x5d14e4(++_0x579a21);}(_0x62ab,0xd2));var _0xb62a=function(_0x3a228f,_0x434931){_0x3a228f=_0x3a228f-0x0;var _0x52001e=_0x62ab[_0x3a228f];return _0x52001e;};'use strict';var Sequelize=require('sequelize');module[_0xb62a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb62a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb62a('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 42d5593..3010c2c 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 _0x5c3c=['findAll','rows','params','merge','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','limit','count','offset','Content-Range','json','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','UserProfileResource','includeAll','include'];(function(_0x56f5c5,_0x3dd9ec){var _0x543086=function(_0x149983){while(--_0x149983){_0x56f5c5['push'](_0x56f5c5['shift']());}};_0x543086(++_0x3dd9ec);}(_0x5c3c,0x132));var _0xc5c3=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x5c3c[_0x710815];return _0x5b3b89;};'use strict';var emlformat=require(_0xc5c3('0x0'));var rimraf=require(_0xc5c3('0x1'));var zipdir=require(_0xc5c3('0x2'));var jsonpatch=require(_0xc5c3('0x3'));var rp=require('request-promise');var moment=require(_0xc5c3('0x4'));var BPromise=require(_0xc5c3('0x5'));var Mustache=require(_0xc5c3('0x6'));var util=require(_0xc5c3('0x7'));var path=require(_0xc5c3('0x8'));var sox=require(_0xc5c3('0x9'));var csv=require(_0xc5c3('0xa'));var ejs=require(_0xc5c3('0xb'));var fs=require('fs');var fs_extra=require(_0xc5c3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c3('0xd'));var deskjs=require(_0xc5c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c3('0xf'));var Papa=require(_0xc5c3('0x10'));var Redis=require('ioredis');var authService=require(_0xc5c3('0x11'));var qs=require(_0xc5c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5c3('0x13'));var logger=require(_0xc5c3('0x14'))(_0xc5c3('0x15'));var utils=require('../../config/utils');var config=require(_0xc5c3('0x16'));var licenseUtil=require(_0xc5c3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b56e6,_0x44d2b9){_0x44d2b9=_0x44d2b9||0xcc;return function(_0x3f0f45){if(_0x3f0f45){return _0x2b56e6['sendStatus'](_0x44d2b9);}return _0x2b56e6[_0xc5c3('0x18')](_0x44d2b9)[_0xc5c3('0x19')]();};}function respondWithResult(_0x1488ab,_0x13a740){_0x13a740=_0x13a740||0xc8;return function(_0xc8a636){if(_0xc8a636){return _0x1488ab['status'](_0x13a740)['json'](_0xc8a636);}};}function respondWithFilteredResult(_0x4445ea,_0x577e1a){return function(_0x1bae87){if(_0x1bae87){var _0xef8b21=typeof _0x577e1a['offset']==='undefined'&&typeof _0x577e1a[_0xc5c3('0x1a')]==='undefined';var _0xa9bc84=_0x1bae87[_0xc5c3('0x1b')];var _0x2ff158=_0xef8b21?0x0:_0x577e1a[_0xc5c3('0x1c')];var _0x28bae6=_0xef8b21?_0x1bae87['count']:_0x577e1a[_0xc5c3('0x1c')]+_0x577e1a[_0xc5c3('0x1a')];var _0x123dba;if(_0x28bae6>=_0xa9bc84){_0x28bae6=_0xa9bc84;_0x123dba=0xc8;}else{_0x123dba=0xce;}_0x4445ea[_0xc5c3('0x18')](_0x123dba);return _0x4445ea['set'](_0xc5c3('0x1d'),_0x2ff158+'-'+_0x28bae6+'/'+_0xa9bc84)[_0xc5c3('0x1e')](_0x1bae87);}return null;};}function patchUpdates(_0x3cc612){return function(_0x3ca20a){try{jsonpatch[_0xc5c3('0x1f')](_0x3ca20a,_0x3cc612,!![]);}catch(_0x564815){return BPromise[_0xc5c3('0x20')](_0x564815);}return _0x3ca20a[_0xc5c3('0x21')]();};}function saveUpdates(_0x370254,_0x2de266){return function(_0x1c5793){if(_0x1c5793){return _0x1c5793[_0xc5c3('0x22')](_0x370254)[_0xc5c3('0x23')](function(_0x5996a0){return _0x5996a0;});}return null;};}function removeEntity(_0x52d638,_0x45affe){return function(_0x38dd9e){if(_0x38dd9e){return _0x38dd9e['destroy']()['then'](function(){_0x52d638[_0xc5c3('0x18')](0xcc)[_0xc5c3('0x19')]();});}};}function handleEntityNotFound(_0x38a3df,_0x52e54a){return function(_0x4af067){if(!_0x4af067){_0x38a3df[_0xc5c3('0x24')](0x194);}return _0x4af067;};}function handleError(_0x22f607,_0x20c506){_0x20c506=_0x20c506||0x1f4;return function(_0x29791c){logger['error'](_0x29791c[_0xc5c3('0x25')]);if(_0x29791c['name']){delete _0x29791c[_0xc5c3('0x26')];}_0x22f607['status'](_0x20c506)[_0xc5c3('0x27')](_0x29791c);};}exports[_0xc5c3('0x28')]=function(_0x4269eb,_0x4773c5){var _0x15361c={},_0x2d07e1={},_0x35a397={'count':0x0,'rows':[]};var _0x4b5a0c=_[_0xc5c3('0x29')](db['UserProfileResource'][_0xc5c3('0x2a')],function(_0x43ebfc){return{'name':_0x43ebfc['fieldName'],'type':_0x43ebfc['type'][_0xc5c3('0x2b')]};});_0x2d07e1[_0xc5c3('0x2c')]=_[_0xc5c3('0x29')](_0x4b5a0c,_0xc5c3('0x26'));_0x2d07e1['query']=_[_0xc5c3('0x2d')](_0x4269eb[_0xc5c3('0x2e')]);_0x2d07e1[_0xc5c3('0x2f')]=_[_0xc5c3('0x30')](_0x2d07e1[_0xc5c3('0x2c')],_0x2d07e1[_0xc5c3('0x2e')]);_0x15361c[_0xc5c3('0x31')]=_[_0xc5c3('0x30')](_0x2d07e1[_0xc5c3('0x2c')],qs['fields'](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x32')]));_0x15361c[_0xc5c3('0x31')]=_0x15361c[_0xc5c3('0x31')][_0xc5c3('0x33')]?_0x15361c[_0xc5c3('0x31')]:_0x2d07e1[_0xc5c3('0x2c')];if(!_0x4269eb['query']['hasOwnProperty'](_0xc5c3('0x34'))){_0x15361c['limit']=qs[_0xc5c3('0x1a')](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x1a')]);_0x15361c[_0xc5c3('0x1c')]=qs[_0xc5c3('0x1c')](_0x4269eb['query'][_0xc5c3('0x1c')]);}_0x15361c[_0xc5c3('0x35')]=qs['sort'](_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x36')]);_0x15361c[_0xc5c3('0x37')]=qs[_0xc5c3('0x2f')](_[_0xc5c3('0x38')](_0x4269eb[_0xc5c3('0x2e')],_0x2d07e1[_0xc5c3('0x2f')]),_0x4b5a0c);if(_0x4269eb[_0xc5c3('0x2e')][_0xc5c3('0x39')]){_0x15361c[_0xc5c3('0x37')]=_['merge'](_0x15361c[_0xc5c3('0x37')],{'$or':_['map'](_0x4b5a0c,function(_0x4fdbe6){if(_0x4fdbe6[_0xc5c3('0x3a')]!==_0xc5c3('0x3b')){var _0x1b546e={};_0x1b546e[_0x4fdbe6[_0xc5c3('0x26')]]={'$like':'%'+_0x4269eb[_0xc5c3('0x2e')]['filter']+'%'};return _0x1b546e;}})});}_0x15361c=_['merge']({},_0x15361c,_0x4269eb[_0xc5c3('0x3c')]);var _0xa7cb91={'where':_0x15361c['where']};return db[_0xc5c3('0x3d')]['count'](_0xa7cb91)[_0xc5c3('0x23')](function(_0x2dfd19){_0x35a397[_0xc5c3('0x1b')]=_0x2dfd19;if(_0x4269eb['query'][_0xc5c3('0x3e')]){_0x15361c[_0xc5c3('0x3f')]=[{'all':!![]}];}return db['UserProfileResource'][_0xc5c3('0x40')](_0x15361c);})['then'](function(_0x33936c){_0x35a397[_0xc5c3('0x41')]=_0x33936c;return _0x35a397;})['then'](respondWithFilteredResult(_0x4773c5,_0x15361c))['catch'](handleError(_0x4773c5,null));};exports['show']=function(_0xfb64bb,_0x2f02ab){var _0x49b1fc={'raw':![],'where':{'id':_0xfb64bb[_0xc5c3('0x42')]['id']}},_0x1a8490={};_0x1a8490[_0xc5c3('0x2c')]=_[_0xc5c3('0x2d')](db['UserProfileResource'][_0xc5c3('0x2a')]);_0x1a8490['query']=_['keys'](_0xfb64bb[_0xc5c3('0x2e')]);_0x1a8490[_0xc5c3('0x2f')]=_['intersection'](_0x1a8490[_0xc5c3('0x2c')],_0x1a8490[_0xc5c3('0x2e')]);_0x49b1fc['attributes']=_[_0xc5c3('0x30')](_0x1a8490['model'],qs[_0xc5c3('0x32')](_0xfb64bb[_0xc5c3('0x2e')]['fields']));_0x49b1fc[_0xc5c3('0x31')]=_0x49b1fc['attributes'][_0xc5c3('0x33')]?_0x49b1fc[_0xc5c3('0x31')]:_0x1a8490['model'];if(_0xfb64bb[_0xc5c3('0x2e')][_0xc5c3('0x3e')]){_0x49b1fc[_0xc5c3('0x3f')]=[{'all':!![]}];}_0x49b1fc=_[_0xc5c3('0x43')]({},_0x49b1fc,_0xfb64bb[_0xc5c3('0x3c')]);return db[_0xc5c3('0x3d')]['find'](_0x49b1fc)[_0xc5c3('0x23')](handleEntityNotFound(_0x2f02ab,null))[_0xc5c3('0x23')](respondWithResult(_0x2f02ab,null))[_0xc5c3('0x44')](handleError(_0x2f02ab,null));};exports[_0xc5c3('0x45')]=function(_0x23002b,_0x4a7330){return db['UserProfileResource'][_0xc5c3('0x45')](_0x23002b[_0xc5c3('0x46')],{})[_0xc5c3('0x23')](respondWithResult(_0x4a7330,0xc9))['catch'](handleError(_0x4a7330,null));};exports[_0xc5c3('0x22')]=function(_0x65f720,_0x3a901f){if(_0x65f720[_0xc5c3('0x46')]['id']){delete _0x65f720[_0xc5c3('0x46')]['id'];}return db[_0xc5c3('0x3d')][_0xc5c3('0x47')]({'where':{'id':_0x65f720['params']['id']}})[_0xc5c3('0x23')](handleEntityNotFound(_0x3a901f,null))[_0xc5c3('0x23')](saveUpdates(_0x65f720[_0xc5c3('0x46')],null))['then'](respondWithResult(_0x3a901f,null))[_0xc5c3('0x44')](handleError(_0x3a901f,null));};exports[_0xc5c3('0x48')]=function(_0x3b1bc2,_0x103bde){return db[_0xc5c3('0x3d')]['find']({'where':{'id':_0x3b1bc2[_0xc5c3('0x42')]['id']}})['then'](handleEntityNotFound(_0x103bde,null))[_0xc5c3('0x23')](removeEntity(_0x103bde,null))['catch'](handleError(_0x103bde,null));};exports[_0xc5c3('0x49')]=function(_0x34a2c3,_0x4add6b){return db[_0xc5c3('0x3d')][_0xc5c3('0x49')]()['then'](respondWithResult(_0x4add6b,null))[_0xc5c3('0x44')](handleError(_0x4add6b,null));}; \ No newline at end of file +var _0x7a54=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileResource','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','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'];(function(_0x20cea6,_0x3a0611){var _0x29f2ae=function(_0x204b68){while(--_0x204b68){_0x20cea6['push'](_0x20cea6['shift']());}};_0x29f2ae(++_0x3a0611);}(_0x7a54,0x106));var _0x47a5=function(_0x53d69b,_0x150f7e){_0x53d69b=_0x53d69b-0x0;var _0x4dbef3=_0x7a54[_0x53d69b];return _0x4dbef3;};'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['UserProfileResource'][_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['UserProfileResource']['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['UserProfileResource']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x48')]=function(_0x1c9a62,_0x5f6a){return db['UserProfileResource'][_0x47a5('0x48')]()['then'](respondWithResult(_0x5f6a,null))[_0x47a5('0x46')](handleError(_0x5f6a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 9a11770..d5884b2 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 _0xee71=['moment','bluebird','request-promise','path','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','lodash','util','../../config/logger'];(function(_0x256422,_0x367394){var _0x55dddc=function(_0x1594bc){while(--_0x1594bc){_0x256422['push'](_0x256422['shift']());}};_0x55dddc(++_0x367394);}(_0xee71,0x1e7));var _0x1ee7=function(_0x39a1c0,_0x5c949c){_0x39a1c0=_0x39a1c0-0x0;var _0xf22628=_0xee71[_0x39a1c0];return _0xf22628;};'use strict';var _=require(_0x1ee7('0x0'));var util=require(_0x1ee7('0x1'));var logger=require(_0x1ee7('0x2'))('api');var moment=require(_0x1ee7('0x3'));var BPromise=require(_0x1ee7('0x4'));var rp=require(_0x1ee7('0x5'));var fs=require('fs');var path=require(_0x1ee7('0x6'));var rimraf=require('rimraf');var config=require(_0x1ee7('0x7'));var attributes=require('./userProfileResource.attributes');module[_0x1ee7('0x8')]=function(_0xaee49c,_0x2b4af5){return _0xaee49c[_0x1ee7('0x9')](_0x1ee7('0xa'),attributes,{'tableName':_0x1ee7('0xb'),'paranoid':![],'indexes':[{'name':_0x1ee7('0xc'),'fields':['resourceId',_0x1ee7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x477e=['resourceId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources'];(function(_0x3d2be9,_0xa46038){var _0x4184ea=function(_0x5d9770){while(--_0x5d9770){_0x3d2be9['push'](_0x3d2be9['shift']());}};_0x4184ea(++_0xa46038);}(_0x477e,0x146));var _0xe477=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0x477e[_0x2b8077];return _0x308091;};'use strict';var _=require(_0xe477('0x0'));var util=require('util');var logger=require(_0xe477('0x1'))(_0xe477('0x2'));var moment=require(_0xe477('0x3'));var BPromise=require(_0xe477('0x4'));var rp=require(_0xe477('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe477('0x6'));var config=require(_0xe477('0x7'));var attributes=require('./userProfileResource.attributes');module[_0xe477('0x8')]=function(_0x5b7e3a,_0x26c115){return _0x5b7e3a[_0xe477('0x9')](_0xe477('0xa'),attributes,{'tableName':_0xe477('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xe477('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 6055090..5e6793b 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 _0x4e16=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x418cb2,_0x21b7e8){var _0x44c9c9=function(_0x4c3373){while(--_0x4c3373){_0x418cb2['push'](_0x418cb2['shift']());}};_0x44c9c9(++_0x21b7e8);}(_0x4e16,0x156));var _0x64e1=function(_0x5c2cb7,_0x47e8c0){_0x5c2cb7=_0x5c2cb7-0x0;var _0x20506a=_0x4e16[_0x5c2cb7];return _0x20506a;};'use strict';var _=require(_0x64e1('0x0'));var util=require(_0x64e1('0x1'));var moment=require(_0x64e1('0x2'));var BPromise=require(_0x64e1('0x3'));var rs=require(_0x64e1('0x4'));var fs=require('fs');var Redis=require(_0x64e1('0x5'));var db=require(_0x64e1('0x6'))['db'];var utils=require(_0x64e1('0x7'));var logger=require(_0x64e1('0x8'))(_0x64e1('0x9'));var config=require(_0x64e1('0xa'));var jayson=require(_0x64e1('0xb'));var client=jayson[_0x64e1('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d01c6,_0x35fa55,_0xc5b607){return new BPromise(function(_0x361c37,_0xcc1754){return client['request'](_0x5d01c6,_0xc5b607)[_0x64e1('0xd')](function(_0x659d45){logger[_0x64e1('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x35fa55,_0x64e1('0xf'));logger['debug'](_0x64e1('0x10'),_0x35fa55,_0x64e1('0xf'),JSON[_0x64e1('0x11')](_0x659d45));if(_0x659d45[_0x64e1('0x12')]){if(_0x659d45[_0x64e1('0x12')][_0x64e1('0x13')]===0x1f4){logger['error'](_0x64e1('0x14'),_0x35fa55,_0x659d45[_0x64e1('0x12')][_0x64e1('0x15')]);return _0xcc1754(_0x659d45[_0x64e1('0x12')][_0x64e1('0x15')]);}logger['error'](_0x64e1('0x14'),_0x35fa55,_0x659d45[_0x64e1('0x12')][_0x64e1('0x15')]);return _0x361c37(_0x659d45[_0x64e1('0x12')][_0x64e1('0x15')]);}else{logger['info'](_0x64e1('0x14'),_0x35fa55,_0x64e1('0xf'));_0x361c37(_0x659d45['result'][_0x64e1('0x15')]);}})[_0x64e1('0x16')](function(_0x50653d){logger[_0x64e1('0x12')](_0x64e1('0x14'),_0x35fa55,_0x50653d);_0xcc1754(_0x50653d);});});} \ No newline at end of file +var _0xabd2=['code','message','result','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xabd2,0x10c));var _0x2abd=function(_0x128e93,_0x51a346){_0x128e93=_0x128e93-0x0;var _0x44abfa=_0xabd2[_0x128e93];return _0x44abfa;};'use strict';var _=require(_0x2abd('0x0'));var util=require(_0x2abd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2abd('0x2'))['db'];var utils=require(_0x2abd('0x3'));var logger=require(_0x2abd('0x4'))(_0x2abd('0x5'));var config=require(_0x2abd('0x6'));var jayson=require(_0x2abd('0x7'));var client=jayson[_0x2abd('0x8')][_0x2abd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28f848,_0x488370,_0x866534){return new BPromise(function(_0x40a6d9,_0x504a21){return client[_0x2abd('0xa')](_0x28f848,_0x866534)['then'](function(_0x21b27e){logger[_0x2abd('0xb')](_0x2abd('0xc'),_0x488370,_0x2abd('0xd'));logger[_0x2abd('0xe')](_0x2abd('0xf'),_0x488370,_0x2abd('0xd'),JSON[_0x2abd('0x10')](_0x21b27e));if(_0x21b27e[_0x2abd('0x11')]){if(_0x21b27e[_0x2abd('0x11')][_0x2abd('0x12')]===0x1f4){logger['error'](_0x2abd('0xc'),_0x488370,_0x21b27e[_0x2abd('0x11')][_0x2abd('0x13')]);return _0x504a21(_0x21b27e[_0x2abd('0x11')][_0x2abd('0x13')]);}logger['error'](_0x2abd('0xc'),_0x488370,_0x21b27e[_0x2abd('0x11')][_0x2abd('0x13')]);return _0x40a6d9(_0x21b27e[_0x2abd('0x11')][_0x2abd('0x13')]);}else{logger['info'](_0x2abd('0xc'),_0x488370,_0x2abd('0xd'));_0x40a6d9(_0x21b27e[_0x2abd('0x14')][_0x2abd('0x13')]);}})[_0x2abd('0x15')](function(_0xe81c78){logger[_0x2abd('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x488370,_0xe81c78);_0x504a21(_0xe81c78);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 6cd34d8..e474731 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 _0x80c2=['describe','show','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe'];(function(_0x57b78c,_0x4fd21e){var _0x280320=function(_0x5b54f3){while(--_0x5b54f3){_0x57b78c['push'](_0x57b78c['shift']());}};_0x280320(++_0x4fd21e);}(_0x80c2,0x9b));var _0x280c=function(_0x5d68e6,_0x386401){_0x5d68e6=_0x5d68e6-0x0;var _0x24ceb0=_0x80c2[_0x5d68e6];return _0x24ceb0;};'use strict';var multer=require(_0x280c('0x0'));var util=require(_0x280c('0x1'));var path=require('path');var timeout=require(_0x280c('0x2'));var express=require(_0x280c('0x3'));var router=express[_0x280c('0x4')]();var fs_extra=require(_0x280c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x280c('0x6'));var config=require(_0x280c('0x7'));var controller=require(_0x280c('0x8'));router[_0x280c('0x9')]('/',auth[_0x280c('0xa')](),controller[_0x280c('0xb')]);router[_0x280c('0x9')](_0x280c('0xc'),auth[_0x280c('0xa')](),controller[_0x280c('0xd')]);router[_0x280c('0x9')]('/:id',auth[_0x280c('0xa')](),controller[_0x280c('0xe')]);router['post']('/',auth[_0x280c('0xa')](),controller['create']);router[_0x280c('0xf')](_0x280c('0x10'),auth['isAuthenticated'](),controller[_0x280c('0x11')]);router[_0x280c('0x12')](_0x280c('0x10'),auth[_0x280c('0xa')](),controller[_0x280c('0x13')]);module[_0x280c('0x14')]=router; \ No newline at end of file +var _0x0939=['/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../config/environment','index','get'];(function(_0x26dd05,_0x135f80){var _0x5da547=function(_0x3b5aed){while(--_0x3b5aed){_0x26dd05['push'](_0x26dd05['shift']());}};_0x5da547(++_0x135f80);}(_0x0939,0x174));var _0x9093=function(_0x5d9d84,_0x2a82){_0x5d9d84=_0x5d9d84-0x0;var _0x43f34f=_0x0939[_0x5d9d84];return _0x43f34f;};'use strict';var multer=require('multer');var util=require(_0x9093('0x0'));var path=require('path');var timeout=require(_0x9093('0x1'));var express=require(_0x9093('0x2'));var router=express[_0x9093('0x3')]();var fs_extra=require(_0x9093('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9093('0x5'));var controller=require('./userProfileSection.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9093('0x6')]);router[_0x9093('0x7')](_0x9093('0x8'),auth['isAuthenticated'](),controller[_0x9093('0x9')]);router[_0x9093('0x7')](_0x9093('0xa'),auth[_0x9093('0xb')](),controller[_0x9093('0xc')]);router[_0x9093('0xd')]('/',auth[_0x9093('0xb')](),controller[_0x9093('0xe')]);router[_0x9093('0xf')]('/:id',auth[_0x9093('0xb')](),controller[_0x9093('0x10')]);router[_0x9093('0x11')]('/:id',auth[_0x9093('0xb')](),controller[_0x9093('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index bfbb1c5..eb216d4 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 _0x9354=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','exports','STRING','INTEGER'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0x9354,0x96));var _0x4935=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0x9354[_0x22b39b];return _0x280e1d;};'use strict';var Sequelize=require('sequelize');module[_0x4935('0x0')]={'name':{'type':Sequelize[_0x4935('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4935('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4935('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4935('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4935('0x1')],'set':function(_0x5327fc){this[_0x4935('0x4')](_0x4935('0x5'),_0x5327fc?_0x5327fc[_0x4935('0x6')](''):[]);},'get':function(){return this[_0x4935('0x7')](_0x4935('0x5'))?this[_0x4935('0x7')](_0x4935('0x5'))[_0x4935('0x8')](''):[];}}}; \ No newline at end of file +var _0x3266=['getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN','crudPermissions'];(function(_0x2d16d5,_0x36b981){var _0x16bc44=function(_0x337409){while(--_0x337409){_0x2d16d5['push'](_0x2d16d5['shift']());}};_0x16bc44(++_0x36b981);}(_0x3266,0x6a));var _0x6326=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x3266[_0x4ff09b];return _0x3f5c2e;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'name':{'type':Sequelize[_0x6326('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x6326('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x6326('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x6326('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x6326('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x6326('0x2')],'set':function(_0x265264){this['setDataValue'](_0x6326('0x5'),_0x265264?_0x265264['join'](''):[]);},'get':function(){return this[_0x6326('0x6')](_0x6326('0x5'))?this[_0x6326('0x6')]('crudPermissions')[_0x6326('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 56d0979..20f4edd 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 _0x1655=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','map','UserProfileSection','fieldName','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','findAll','rows','catch','params','includeAll','include','options','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','desk.js','querystring','papaparse'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0x1655,0x1a7));var _0x5165=function(_0x2f1eb5,_0x30f0d3){_0x2f1eb5=_0x2f1eb5-0x0;var _0xdcc845=_0x1655[_0x2f1eb5];return _0xdcc845;};'use strict';var emlformat=require(_0x5165('0x0'));var rimraf=require(_0x5165('0x1'));var zipdir=require(_0x5165('0x2'));var jsonpatch=require(_0x5165('0x3'));var rp=require(_0x5165('0x4'));var moment=require(_0x5165('0x5'));var BPromise=require(_0x5165('0x6'));var Mustache=require(_0x5165('0x7'));var util=require('util');var path=require('path');var sox=require(_0x5165('0x8'));var csv=require(_0x5165('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5165('0xa'));var squel=require(_0x5165('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5165('0xc'));var toCsv=require(_0x5165('0x9'));var querystring=require(_0x5165('0xd'));var Papa=require(_0x5165('0xe'));var Redis=require(_0x5165('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5165('0x10'));var as=require(_0x5165('0x11'));var hardwareService=require(_0x5165('0x12'));var logger=require(_0x5165('0x13'))(_0x5165('0x14'));var utils=require(_0x5165('0x15'));var config=require(_0x5165('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5165('0x17'))['db'];function respondWithStatusCode(_0x5474ca,_0x5f20a8){_0x5f20a8=_0x5f20a8||0xcc;return function(_0x101e23){if(_0x101e23){return _0x5474ca[_0x5165('0x18')](_0x5f20a8);}return _0x5474ca[_0x5165('0x19')](_0x5f20a8)[_0x5165('0x1a')]();};}function respondWithResult(_0x57d9c5,_0xe980e6){_0xe980e6=_0xe980e6||0xc8;return function(_0x531709){if(_0x531709){return _0x57d9c5[_0x5165('0x19')](_0xe980e6)[_0x5165('0x1b')](_0x531709);}};}function respondWithFilteredResult(_0x4be9e8,_0x19f807){return function(_0x2b6938){if(_0x2b6938){var _0x2998f7=typeof _0x19f807['offset']===_0x5165('0x1c')&&typeof _0x19f807[_0x5165('0x1d')]===_0x5165('0x1c');var _0xec00b0=_0x2b6938[_0x5165('0x1e')];var _0x35f664=_0x2998f7?0x0:_0x19f807['offset'];var _0x39ced5=_0x2998f7?_0x2b6938['count']:_0x19f807[_0x5165('0x1f')]+_0x19f807[_0x5165('0x1d')];var _0x53d6a8;if(_0x39ced5>=_0xec00b0){_0x39ced5=_0xec00b0;_0x53d6a8=0xc8;}else{_0x53d6a8=0xce;}_0x4be9e8['status'](_0x53d6a8);return _0x4be9e8['set'](_0x5165('0x20'),_0x35f664+'-'+_0x39ced5+'/'+_0xec00b0)[_0x5165('0x1b')](_0x2b6938);}return null;};}function patchUpdates(_0x40fe56){return function(_0x38ef38){try{jsonpatch[_0x5165('0x21')](_0x38ef38,_0x40fe56,!![]);}catch(_0x2eff5f){return BPromise[_0x5165('0x22')](_0x2eff5f);}return _0x38ef38[_0x5165('0x23')]();};}function saveUpdates(_0x12b1ff,_0x52a804){return function(_0xefcaea){if(_0xefcaea){return _0xefcaea['update'](_0x12b1ff)[_0x5165('0x24')](function(_0x2bbf4e){return _0x2bbf4e;});}return null;};}function removeEntity(_0x3f899b,_0x11e490){return function(_0x5a487c){if(_0x5a487c){return _0x5a487c[_0x5165('0x25')]()[_0x5165('0x24')](function(){_0x3f899b[_0x5165('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ec52a,_0x29decb){return function(_0x46de3a){if(!_0x46de3a){_0x1ec52a['sendStatus'](0x194);}return _0x46de3a;};}function handleError(_0x15f83f,_0x387820){_0x387820=_0x387820||0x1f4;return function(_0x1f0274){logger[_0x5165('0x26')](_0x1f0274[_0x5165('0x27')]);if(_0x1f0274['name']){delete _0x1f0274['name'];}_0x15f83f[_0x5165('0x19')](_0x387820)['send'](_0x1f0274);};}exports['index']=function(_0x44fc90,_0x3197c9){var _0x2da3df={},_0x4aa5f1={},_0x553e49={'count':0x0,'rows':[]};var _0x1357f4=_[_0x5165('0x28')](db[_0x5165('0x29')]['rawAttributes'],function(_0x4fda24){return{'name':_0x4fda24[_0x5165('0x2a')],'type':_0x4fda24['type']['key']};});_0x4aa5f1[_0x5165('0x2b')]=_[_0x5165('0x28')](_0x1357f4,_0x5165('0x2c'));_0x4aa5f1[_0x5165('0x2d')]=_[_0x5165('0x2e')](_0x44fc90[_0x5165('0x2d')]);_0x4aa5f1[_0x5165('0x2f')]=_[_0x5165('0x30')](_0x4aa5f1[_0x5165('0x2b')],_0x4aa5f1['query']);_0x2da3df[_0x5165('0x31')]=_[_0x5165('0x30')](_0x4aa5f1[_0x5165('0x2b')],qs[_0x5165('0x32')](_0x44fc90[_0x5165('0x2d')][_0x5165('0x32')]));_0x2da3df['attributes']=_0x2da3df[_0x5165('0x31')][_0x5165('0x33')]?_0x2da3df['attributes']:_0x4aa5f1[_0x5165('0x2b')];if(!_0x44fc90[_0x5165('0x2d')][_0x5165('0x34')]('nolimit')){_0x2da3df['limit']=qs[_0x5165('0x1d')](_0x44fc90[_0x5165('0x2d')][_0x5165('0x1d')]);_0x2da3df[_0x5165('0x1f')]=qs[_0x5165('0x1f')](_0x44fc90['query'][_0x5165('0x1f')]);}_0x2da3df[_0x5165('0x35')]=qs['sort'](_0x44fc90['query'][_0x5165('0x36')]);_0x2da3df[_0x5165('0x37')]=qs[_0x5165('0x2f')](_[_0x5165('0x38')](_0x44fc90[_0x5165('0x2d')],_0x4aa5f1['filters']),_0x1357f4);if(_0x44fc90['query']['filter']){_0x2da3df['where']=_[_0x5165('0x39')](_0x2da3df[_0x5165('0x37')],{'$or':_['map'](_0x1357f4,function(_0x530a69){if(_0x530a69[_0x5165('0x3a')]!==_0x5165('0x3b')){var _0x5e70c4={};_0x5e70c4[_0x530a69[_0x5165('0x2c')]]={'$like':'%'+_0x44fc90[_0x5165('0x2d')][_0x5165('0x3c')]+'%'};return _0x5e70c4;}})});}_0x2da3df=_[_0x5165('0x39')]({},_0x2da3df,_0x44fc90['options']);var _0x163aef={'where':_0x2da3df[_0x5165('0x37')]};return db[_0x5165('0x29')][_0x5165('0x1e')](_0x163aef)['then'](function(_0x283bf4){_0x553e49[_0x5165('0x1e')]=_0x283bf4;if(_0x44fc90['query']['includeAll']){_0x2da3df['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x5165('0x3d')](_0x2da3df);})[_0x5165('0x24')](function(_0x42fe44){_0x553e49[_0x5165('0x3e')]=_0x42fe44;return _0x553e49;})[_0x5165('0x24')](respondWithFilteredResult(_0x3197c9,_0x2da3df))[_0x5165('0x3f')](handleError(_0x3197c9,null));};exports['show']=function(_0x404c32,_0x10f9f5){var _0x2a3791={'raw':![],'where':{'id':_0x404c32[_0x5165('0x40')]['id']}},_0x1ff768={};_0x1ff768[_0x5165('0x2b')]=_[_0x5165('0x2e')](db[_0x5165('0x29')]['rawAttributes']);_0x1ff768[_0x5165('0x2d')]=_[_0x5165('0x2e')](_0x404c32[_0x5165('0x2d')]);_0x1ff768[_0x5165('0x2f')]=_[_0x5165('0x30')](_0x1ff768[_0x5165('0x2b')],_0x1ff768['query']);_0x2a3791[_0x5165('0x31')]=_[_0x5165('0x30')](_0x1ff768['model'],qs['fields'](_0x404c32[_0x5165('0x2d')][_0x5165('0x32')]));_0x2a3791[_0x5165('0x31')]=_0x2a3791[_0x5165('0x31')][_0x5165('0x33')]?_0x2a3791[_0x5165('0x31')]:_0x1ff768['model'];if(_0x404c32[_0x5165('0x2d')][_0x5165('0x41')]){_0x2a3791[_0x5165('0x42')]=[{'all':!![]}];}_0x2a3791=_['merge']({},_0x2a3791,_0x404c32[_0x5165('0x43')]);return db[_0x5165('0x29')]['find'](_0x2a3791)[_0x5165('0x24')](handleEntityNotFound(_0x10f9f5,null))[_0x5165('0x24')](respondWithResult(_0x10f9f5,null))[_0x5165('0x3f')](handleError(_0x10f9f5,null));};exports[_0x5165('0x44')]=function(_0x5e475a,_0xcb54fe){return db[_0x5165('0x29')]['create'](_0x5e475a[_0x5165('0x45')],{})[_0x5165('0x24')](respondWithResult(_0xcb54fe,0xc9))[_0x5165('0x3f')](handleError(_0xcb54fe,null));};exports[_0x5165('0x46')]=function(_0x1d7b38,_0x3d513b){if(_0x1d7b38['body']['id']){delete _0x1d7b38[_0x5165('0x45')]['id'];}return db[_0x5165('0x29')][_0x5165('0x47')]({'where':{'id':_0x1d7b38[_0x5165('0x40')]['id']}})[_0x5165('0x24')](handleEntityNotFound(_0x3d513b,null))[_0x5165('0x24')](saveUpdates(_0x1d7b38[_0x5165('0x45')],null))['then'](respondWithResult(_0x3d513b,null))['catch'](handleError(_0x3d513b,null));};exports[_0x5165('0x25')]=function(_0x3388ca,_0x22f6f3){return db['UserProfileSection'][_0x5165('0x47')]({'where':{'id':_0x3388ca[_0x5165('0x40')]['id']}})['then'](handleEntityNotFound(_0x22f6f3,null))['then'](removeEntity(_0x22f6f3,null))[_0x5165('0x3f')](handleError(_0x22f6f3,null));};exports['describe']=function(_0x21e736,_0x4bf545){return db['UserProfileSection'][_0x5165('0x48')]()['then'](respondWithResult(_0x4bf545,null))[_0x5165('0x3f')](handleError(_0x4bf545,null));}; \ No newline at end of file +var _0x90f7=['set','apply','reject','update','then','sendStatus','error','name','send','index','map','UserProfileSection','type','model','query','filters','intersection','fields','attributes','length','where','merge','VIRTUAL','include','catch','show','params','keys','rawAttributes','includeAll','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset'];(function(_0xcf109,_0x5ca129){var _0x1f203d=function(_0x5e1988){while(--_0x5e1988){_0xcf109['push'](_0xcf109['shift']());}};_0x1f203d(++_0x5ca129);}(_0x90f7,0x134));var _0x790f=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x90f7[_0x5834bc];return _0x3e183a;};'use strict';var emlformat=require(_0x790f('0x0'));var rimraf=require(_0x790f('0x1'));var zipdir=require(_0x790f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x790f('0x3'));var moment=require('moment');var BPromise=require(_0x790f('0x4'));var Mustache=require(_0x790f('0x5'));var util=require(_0x790f('0x6'));var path=require(_0x790f('0x7'));var sox=require(_0x790f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x790f('0x9'));var _=require(_0x790f('0xa'));var squel=require('squel');var crypto=require(_0x790f('0xb'));var jsforce=require(_0x790f('0xc'));var deskjs=require(_0x790f('0xd'));var toCsv=require(_0x790f('0xe'));var querystring=require(_0x790f('0xf'));var Papa=require(_0x790f('0x10'));var Redis=require(_0x790f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x790f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x790f('0x13'));var logger=require(_0x790f('0x14'))('api');var utils=require(_0x790f('0x15'));var config=require(_0x790f('0x16'));var licenseUtil=require(_0x790f('0x17'));var db=require(_0x790f('0x18'))['db'];function respondWithStatusCode(_0x44aaa8,_0x58c248){_0x58c248=_0x58c248||0xcc;return function(_0x3fdbc8){if(_0x3fdbc8){return _0x44aaa8['sendStatus'](_0x58c248);}return _0x44aaa8[_0x790f('0x19')](_0x58c248)[_0x790f('0x1a')]();};}function respondWithResult(_0xf98023,_0x489343){_0x489343=_0x489343||0xc8;return function(_0xc9563){if(_0xc9563){return _0xf98023['status'](_0x489343)[_0x790f('0x1b')](_0xc9563);}};}function respondWithFilteredResult(_0x105505,_0x51a700){return function(_0x1f5b29){if(_0x1f5b29){var _0x5d03cd=typeof _0x51a700['offset']===_0x790f('0x1c')&&typeof _0x51a700[_0x790f('0x1d')]===_0x790f('0x1c');var _0x526ab7=_0x1f5b29[_0x790f('0x1e')];var _0x5b47f2=_0x5d03cd?0x0:_0x51a700[_0x790f('0x1f')];var _0x455fff=_0x5d03cd?_0x1f5b29['count']:_0x51a700[_0x790f('0x1f')]+_0x51a700[_0x790f('0x1d')];var _0x25b7b1;if(_0x455fff>=_0x526ab7){_0x455fff=_0x526ab7;_0x25b7b1=0xc8;}else{_0x25b7b1=0xce;}_0x105505[_0x790f('0x19')](_0x25b7b1);return _0x105505[_0x790f('0x20')]('Content-Range',_0x5b47f2+'-'+_0x455fff+'/'+_0x526ab7)['json'](_0x1f5b29);}return null;};}function patchUpdates(_0x33592d){return function(_0x360010){try{jsonpatch[_0x790f('0x21')](_0x360010,_0x33592d,!![]);}catch(_0x5ea486){return BPromise[_0x790f('0x22')](_0x5ea486);}return _0x360010['save']();};}function saveUpdates(_0x137112,_0x352982){return function(_0x28f11b){if(_0x28f11b){return _0x28f11b[_0x790f('0x23')](_0x137112)[_0x790f('0x24')](function(_0xa3bced){return _0xa3bced;});}return null;};}function removeEntity(_0x12886c,_0x35119c){return function(_0x5adf6e){if(_0x5adf6e){return _0x5adf6e['destroy']()[_0x790f('0x24')](function(){_0x12886c[_0x790f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30fd96,_0x11359a){return function(_0x51bf64){if(!_0x51bf64){_0x30fd96[_0x790f('0x25')](0x194);}return _0x51bf64;};}function handleError(_0x1073f8,_0x2cd4c2){_0x2cd4c2=_0x2cd4c2||0x1f4;return function(_0x49bae2){logger[_0x790f('0x26')](_0x49bae2['stack']);if(_0x49bae2[_0x790f('0x27')]){delete _0x49bae2[_0x790f('0x27')];}_0x1073f8[_0x790f('0x19')](_0x2cd4c2)[_0x790f('0x28')](_0x49bae2);};}exports[_0x790f('0x29')]=function(_0x4b9cfc,_0x2c202a){var _0x1c6570={},_0x2bf411={},_0x313a26={'count':0x0,'rows':[]};var _0x326ceb=_[_0x790f('0x2a')](db[_0x790f('0x2b')]['rawAttributes'],function(_0x245649){return{'name':_0x245649['fieldName'],'type':_0x245649[_0x790f('0x2c')]['key']};});_0x2bf411[_0x790f('0x2d')]=_[_0x790f('0x2a')](_0x326ceb,_0x790f('0x27'));_0x2bf411['query']=_['keys'](_0x4b9cfc[_0x790f('0x2e')]);_0x2bf411[_0x790f('0x2f')]=_[_0x790f('0x30')](_0x2bf411[_0x790f('0x2d')],_0x2bf411[_0x790f('0x2e')]);_0x1c6570['attributes']=_['intersection'](_0x2bf411[_0x790f('0x2d')],qs[_0x790f('0x31')](_0x4b9cfc[_0x790f('0x2e')][_0x790f('0x31')]));_0x1c6570[_0x790f('0x32')]=_0x1c6570[_0x790f('0x32')][_0x790f('0x33')]?_0x1c6570['attributes']:_0x2bf411[_0x790f('0x2d')];if(!_0x4b9cfc[_0x790f('0x2e')]['hasOwnProperty']('nolimit')){_0x1c6570[_0x790f('0x1d')]=qs[_0x790f('0x1d')](_0x4b9cfc['query'][_0x790f('0x1d')]);_0x1c6570[_0x790f('0x1f')]=qs[_0x790f('0x1f')](_0x4b9cfc['query'][_0x790f('0x1f')]);}_0x1c6570['order']=qs['sort'](_0x4b9cfc[_0x790f('0x2e')]['sort']);_0x1c6570['where']=qs[_0x790f('0x2f')](_['pick'](_0x4b9cfc[_0x790f('0x2e')],_0x2bf411[_0x790f('0x2f')]),_0x326ceb);if(_0x4b9cfc[_0x790f('0x2e')]['filter']){_0x1c6570[_0x790f('0x34')]=_[_0x790f('0x35')](_0x1c6570['where'],{'$or':_['map'](_0x326ceb,function(_0x5dd236){if(_0x5dd236['type']!==_0x790f('0x36')){var _0x44f391={};_0x44f391[_0x5dd236[_0x790f('0x27')]]={'$like':'%'+_0x4b9cfc[_0x790f('0x2e')]['filter']+'%'};return _0x44f391;}})});}_0x1c6570=_[_0x790f('0x35')]({},_0x1c6570,_0x4b9cfc['options']);var _0x1a165f={'where':_0x1c6570[_0x790f('0x34')]};return db['UserProfileSection'][_0x790f('0x1e')](_0x1a165f)['then'](function(_0x3450b1){_0x313a26['count']=_0x3450b1;if(_0x4b9cfc[_0x790f('0x2e')]['includeAll']){_0x1c6570[_0x790f('0x37')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x1c6570);})[_0x790f('0x24')](function(_0x1762af){_0x313a26['rows']=_0x1762af;return _0x313a26;})[_0x790f('0x24')](respondWithFilteredResult(_0x2c202a,_0x1c6570))[_0x790f('0x38')](handleError(_0x2c202a,null));};exports[_0x790f('0x39')]=function(_0x5819e9,_0x4389e6){var _0x5afb63={'raw':![],'where':{'id':_0x5819e9[_0x790f('0x3a')]['id']}},_0x50dfb3={};_0x50dfb3[_0x790f('0x2d')]=_[_0x790f('0x3b')](db['UserProfileSection'][_0x790f('0x3c')]);_0x50dfb3[_0x790f('0x2e')]=_['keys'](_0x5819e9['query']);_0x50dfb3[_0x790f('0x2f')]=_['intersection'](_0x50dfb3[_0x790f('0x2d')],_0x50dfb3['query']);_0x5afb63['attributes']=_['intersection'](_0x50dfb3[_0x790f('0x2d')],qs['fields'](_0x5819e9[_0x790f('0x2e')][_0x790f('0x31')]));_0x5afb63['attributes']=_0x5afb63[_0x790f('0x32')][_0x790f('0x33')]?_0x5afb63[_0x790f('0x32')]:_0x50dfb3[_0x790f('0x2d')];if(_0x5819e9[_0x790f('0x2e')][_0x790f('0x3d')]){_0x5afb63[_0x790f('0x37')]=[{'all':!![]}];}_0x5afb63=_['merge']({},_0x5afb63,_0x5819e9[_0x790f('0x3e')]);return db['UserProfileSection'][_0x790f('0x3f')](_0x5afb63)[_0x790f('0x24')](handleEntityNotFound(_0x4389e6,null))[_0x790f('0x24')](respondWithResult(_0x4389e6,null))[_0x790f('0x38')](handleError(_0x4389e6,null));};exports['create']=function(_0x252788,_0x40ebcd){return db[_0x790f('0x2b')][_0x790f('0x40')](_0x252788[_0x790f('0x41')],{})[_0x790f('0x24')](respondWithResult(_0x40ebcd,0xc9))[_0x790f('0x38')](handleError(_0x40ebcd,null));};exports[_0x790f('0x23')]=function(_0x231eb2,_0x5e6144){if(_0x231eb2[_0x790f('0x41')]['id']){delete _0x231eb2[_0x790f('0x41')]['id'];}return db[_0x790f('0x2b')][_0x790f('0x3f')]({'where':{'id':_0x231eb2[_0x790f('0x3a')]['id']}})[_0x790f('0x24')](handleEntityNotFound(_0x5e6144,null))['then'](saveUpdates(_0x231eb2[_0x790f('0x41')],null))[_0x790f('0x24')](respondWithResult(_0x5e6144,null))['catch'](handleError(_0x5e6144,null));};exports[_0x790f('0x42')]=function(_0x36d877,_0x2dbd3e){return db[_0x790f('0x2b')][_0x790f('0x3f')]({'where':{'id':_0x36d877[_0x790f('0x3a')]['id']}})[_0x790f('0x24')](handleEntityNotFound(_0x2dbd3e,null))[_0x790f('0x24')](removeEntity(_0x2dbd3e,null))[_0x790f('0x38')](handleError(_0x2dbd3e,null));};exports[_0x790f('0x43')]=function(_0x38eee4,_0x434902){return db['UserProfileSection'][_0x790f('0x43')]()[_0x790f('0x24')](respondWithResult(_0x434902,null))[_0x790f('0x38')](handleError(_0x434902,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 3536778..8e51008 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 _0x7896=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment'];(function(_0x579363,_0xa8cc04){var _0x17bab1=function(_0x54aade){while(--_0x54aade){_0x579363['push'](_0x579363['shift']());}};_0x17bab1(++_0xa8cc04);}(_0x7896,0xe9));var _0x6789=function(_0x4ef1a9,_0x59a5fa){_0x4ef1a9=_0x4ef1a9-0x0;var _0x23f201=_0x7896[_0x4ef1a9];return _0x23f201;};'use strict';var _=require(_0x6789('0x0'));var util=require(_0x6789('0x1'));var logger=require(_0x6789('0x2'))(_0x6789('0x3'));var moment=require(_0x6789('0x4'));var BPromise=require(_0x6789('0x5'));var rp=require(_0x6789('0x6'));var fs=require('fs');var path=require(_0x6789('0x7'));var rimraf=require(_0x6789('0x8'));var config=require(_0x6789('0x9'));var attributes=require('./userProfileSection.attributes');module[_0x6789('0xa')]=function(_0x4665c4,_0x465f1c){return _0x4665c4[_0x6789('0xb')](_0x6789('0xc'),attributes,{'tableName':_0x6789('0xd'),'paranoid':![],'indexes':[{'name':_0x6789('0xe'),'fields':[_0x6789('0xf'),_0x6789('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0738=['compositeIndex','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','user_profile_has_sections'];(function(_0x36a5d0,_0x477b0f){var _0x2b0076=function(_0x4f78d0){while(--_0x4f78d0){_0x36a5d0['push'](_0x36a5d0['shift']());}};_0x2b0076(++_0x477b0f);}(_0x0738,0x15d));var _0x8073=function(_0x445024,_0x36dca6){_0x445024=_0x445024-0x0;var _0x5ab19a=_0x0738[_0x445024];return _0x5ab19a;};'use strict';var _=require(_0x8073('0x0'));var util=require(_0x8073('0x1'));var logger=require(_0x8073('0x2'))('api');var moment=require(_0x8073('0x3'));var BPromise=require(_0x8073('0x4'));var rp=require(_0x8073('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8073('0x6'));var config=require(_0x8073('0x7'));var attributes=require('./userProfileSection.attributes');module[_0x8073('0x8')]=function(_0x1e8168,_0x13208e){return _0x1e8168[_0x8073('0x9')]('UserProfileSection',attributes,{'tableName':_0x8073('0xa'),'paranoid':![],'indexes':[{'name':_0x8073('0xb'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 747ebaf..b97d48c 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 _0x04f1=['http','request','then','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','info','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x419130,_0x37cf61){var _0x16e1bd=function(_0x540c99){while(--_0x540c99){_0x419130['push'](_0x419130['shift']());}};_0x16e1bd(++_0x37cf61);}(_0x04f1,0x92));var _0x104f=function(_0x50aa46,_0x3ce76b){_0x50aa46=_0x50aa46-0x0;var _0x38d6c5=_0x04f1[_0x50aa46];return _0x38d6c5;};'use strict';var _=require(_0x104f('0x0'));var util=require(_0x104f('0x1'));var moment=require(_0x104f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x104f('0x3'));var db=require(_0x104f('0x4'))['db'];var utils=require(_0x104f('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x104f('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x289bb8,_0x5b7110,_0x1d5651){return new BPromise(function(_0x57acf5,_0x47582b){return client[_0x104f('0x7')](_0x289bb8,_0x1d5651)[_0x104f('0x8')](function(_0x37891c){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x5b7110,_0x104f('0x9'));logger[_0x104f('0xa')](_0x104f('0xb'),_0x5b7110,_0x104f('0x9'),JSON[_0x104f('0xc')](_0x37891c));if(_0x37891c[_0x104f('0xd')]){if(_0x37891c[_0x104f('0xd')][_0x104f('0xe')]===0x1f4){logger[_0x104f('0xd')](_0x104f('0xf'),_0x5b7110,_0x37891c['error'][_0x104f('0x10')]);return _0x47582b(_0x37891c[_0x104f('0xd')][_0x104f('0x10')]);}logger[_0x104f('0xd')](_0x104f('0xf'),_0x5b7110,_0x37891c[_0x104f('0xd')][_0x104f('0x10')]);return _0x57acf5(_0x37891c[_0x104f('0xd')][_0x104f('0x10')]);}else{logger[_0x104f('0x11')](_0x104f('0xf'),_0x5b7110,_0x104f('0x9'));_0x57acf5(_0x37891c[_0x104f('0x12')][_0x104f('0x10')]);}})['catch'](function(_0x12b9a6){logger[_0x104f('0xd')](_0x104f('0xf'),_0x5b7110,_0x12b9a6);_0x47582b(_0x12b9a6);});});} \ No newline at end of file +var _0xa7ac=['rpc','../../config/environment','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1baf5b,_0x221ae6){var _0x3b69ef=function(_0x5ac234){while(--_0x5ac234){_0x1baf5b['push'](_0x1baf5b['shift']());}};_0x3b69ef(++_0x221ae6);}(_0xa7ac,0x14e));var _0xca7a=function(_0x1131f9,_0x23ef30){_0x1131f9=_0x1131f9-0x0;var _0x4d2e77=_0xa7ac[_0x1131f9];return _0x4d2e77;};'use strict';var _=require('lodash');var util=require(_0xca7a('0x0'));var moment=require('moment');var BPromise=require(_0xca7a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca7a('0x2'));var db=require(_0xca7a('0x3'))['db'];var utils=require(_0xca7a('0x4'));var logger=require(_0xca7a('0x5'))(_0xca7a('0x6'));var config=require(_0xca7a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xca7a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c19cf,_0x2115de,_0x5386c0){return new BPromise(function(_0x1ce1b8,_0xa55113){return client[_0xca7a('0x9')](_0x4c19cf,_0x5386c0)[_0xca7a('0xa')](function(_0x58aa59){logger[_0xca7a('0xb')](_0xca7a('0xc'),_0x2115de,_0xca7a('0xd'));logger[_0xca7a('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2115de,_0xca7a('0xd'),JSON[_0xca7a('0xf')](_0x58aa59));if(_0x58aa59['error']){if(_0x58aa59[_0xca7a('0x10')][_0xca7a('0x11')]===0x1f4){logger[_0xca7a('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x2115de,_0x58aa59[_0xca7a('0x10')][_0xca7a('0x12')]);return _0xa55113(_0x58aa59['error']['message']);}logger[_0xca7a('0x10')](_0xca7a('0xc'),_0x2115de,_0x58aa59[_0xca7a('0x10')][_0xca7a('0x12')]);return _0x1ce1b8(_0x58aa59[_0xca7a('0x10')][_0xca7a('0x12')]);}else{logger[_0xca7a('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x2115de,'request\x20sent');_0x1ce1b8(_0x58aa59['result'][_0xca7a('0x12')]);}})[_0xca7a('0x13')](function(_0x2a92f6){logger[_0xca7a('0x10')](_0xca7a('0xc'),_0x2115de,_0x2a92f6);_0xa55113(_0x2a92f6);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 860fc27..6cd882c 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1c30c9,_0x596313){var _0x51e413=function(_0x149c99){while(--_0x149c99){_0x1c30c9['push'](_0x1c30c9['shift']());}};_0x51e413(++_0x596313);}(_0x70e0,0x17b));var _0x070e=function(_0x5b2d4c,_0x505cd8){_0x5b2d4c=_0x5b2d4c-0x0;var _0x59db59=_0x70e0[_0x5b2d4c];return _0x59db59;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xfed299,_0x21b8d0){var _0x4ef1f2=function(_0x347a84){while(--_0x347a84){_0xfed299['push'](_0xfed299['shift']());}};_0x4ef1f2(++_0x21b8d0);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index f063168..13def62 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 _0xf5dc=['INTEGER'];(function(_0x34e174,_0x3f560a){var _0x5d55d2=function(_0x1ad48e){while(--_0x1ad48e){_0x34e174['push'](_0x34e174['shift']());}};_0x5d55d2(++_0x3f560a);}(_0xf5dc,0x117));var _0xcf5d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf5dc[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xcf5d('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x56ff=['exports','INTEGER','sequelize'];(function(_0x31de0f,_0x4a6913){var _0x5c827f=function(_0x220720){while(--_0x220720){_0x31de0f['push'](_0x31de0f['shift']());}};_0x5c827f(++_0x4a6913);}(_0x56ff,0xb9));var _0xf56f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x56ff[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xf56f('0x0'));module[_0xf56f('0x1')]={'penalty':{'type':Sequelize[_0xf56f('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 223f204..652ab3e 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 _0x01d9=['bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0xdbff26,_0xfc8995){var _0x4adb23=function(_0x291780){while(--_0x291780){_0xdbff26['push'](_0xdbff26['shift']());}};_0x4adb23(++_0xfc8995);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4745=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger'];(function(_0x30944e,_0x1f0757){var _0x5761a0=function(_0x45842e){while(--_0x45842e){_0x30944e['push'](_0x30944e['shift']());}};_0x5761a0(++_0x1f0757);}(_0x4745,0x1e7));var _0x5474=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x4745[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));module[_0x5474('0xb')]=function(_0x4e7ce7,_0x3d1e1){return _0x4e7ce7[_0x5474('0xc')]('UserSmsQueue',attributes,{'tableName':_0x5474('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index b9e2d63..6ec8e7a 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 _0x6255=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2dc6eb,_0x439724){var _0x2faaf1=function(_0x1fa112){while(--_0x1fa112){_0x2dc6eb['push'](_0x2dc6eb['shift']());}};_0x2faaf1(++_0x439724);}(_0x6255,0x1dc));var _0x5625=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0x6255[_0x506d2f];return _0x101255;};'use strict';var _=require('lodash');var util=require(_0x5625('0x0'));var moment=require(_0x5625('0x1'));var BPromise=require(_0x5625('0x2'));var rs=require(_0x5625('0x3'));var fs=require('fs');var Redis=require(_0x5625('0x4'));var db=require(_0x5625('0x5'))['db'];var utils=require(_0x5625('0x6'));var logger=require(_0x5625('0x7'))(_0x5625('0x8'));var config=require(_0x5625('0x9'));var jayson=require(_0x5625('0xa'));var client=jayson[_0x5625('0xb')][_0x5625('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31d352,_0x32f4f1,_0x52cc45){return new BPromise(function(_0x19d015,_0x320192){return client[_0x5625('0xd')](_0x31d352,_0x52cc45)['then'](function(_0x4af8a0){logger[_0x5625('0xe')](_0x5625('0xf'),_0x32f4f1,_0x5625('0x10'));logger['debug'](_0x5625('0x11'),_0x32f4f1,_0x5625('0x10'),JSON['stringify'](_0x4af8a0));if(_0x4af8a0[_0x5625('0x12')]){if(_0x4af8a0[_0x5625('0x12')][_0x5625('0x13')]===0x1f4){logger[_0x5625('0x12')](_0x5625('0xf'),_0x32f4f1,_0x4af8a0[_0x5625('0x12')][_0x5625('0x14')]);return _0x320192(_0x4af8a0[_0x5625('0x12')][_0x5625('0x14')]);}logger[_0x5625('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x32f4f1,_0x4af8a0[_0x5625('0x12')]['message']);return _0x19d015(_0x4af8a0[_0x5625('0x12')][_0x5625('0x14')]);}else{logger[_0x5625('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x32f4f1,'request\x20sent');_0x19d015(_0x4af8a0[_0x5625('0x15')][_0x5625('0x14')]);}})[_0x5625('0x16')](function(_0x1ded48){logger['error'](_0x5625('0xf'),_0x32f4f1,_0x1ded48);_0x320192(_0x1ded48);});});} \ No newline at end of file +var _0x04d9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x3db122,_0x5e6bee){var _0x325b67=function(_0x5095af){while(--_0x5095af){_0x3db122['push'](_0x3db122['shift']());}};_0x325b67(++_0x5e6bee);}(_0x04d9,0xfc));var _0x904d=function(_0x2ce2b9,_0x39dfb0){_0x2ce2b9=_0x2ce2b9-0x0;var _0xa95197=_0x04d9[_0x2ce2b9];return _0xa95197;};'use strict';var _=require(_0x904d('0x0'));var util=require(_0x904d('0x1'));var moment=require(_0x904d('0x2'));var BPromise=require(_0x904d('0x3'));var rs=require(_0x904d('0x4'));var fs=require('fs');var Redis=require(_0x904d('0x5'));var db=require(_0x904d('0x6'))['db'];var utils=require(_0x904d('0x7'));var logger=require('../../config/logger')(_0x904d('0x8'));var config=require(_0x904d('0x9'));var jayson=require(_0x904d('0xa'));var client=jayson['client'][_0x904d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb4f1ea,_0x4c3d61,_0x277561){return new BPromise(function(_0x2899ef,_0xe30694){return client['request'](_0xb4f1ea,_0x277561)[_0x904d('0xc')](function(_0x5b4ccd){logger[_0x904d('0xd')](_0x904d('0xe'),_0x4c3d61,_0x904d('0xf'));logger[_0x904d('0x10')](_0x904d('0x11'),_0x4c3d61,_0x904d('0xf'),JSON[_0x904d('0x12')](_0x5b4ccd));if(_0x5b4ccd[_0x904d('0x13')]){if(_0x5b4ccd[_0x904d('0x13')][_0x904d('0x14')]===0x1f4){logger[_0x904d('0x13')](_0x904d('0xe'),_0x4c3d61,_0x5b4ccd[_0x904d('0x13')][_0x904d('0x15')]);return _0xe30694(_0x5b4ccd[_0x904d('0x13')][_0x904d('0x15')]);}logger[_0x904d('0x13')](_0x904d('0xe'),_0x4c3d61,_0x5b4ccd[_0x904d('0x13')][_0x904d('0x15')]);return _0x2899ef(_0x5b4ccd[_0x904d('0x13')]['message']);}else{logger[_0x904d('0xd')](_0x904d('0xe'),_0x4c3d61,_0x904d('0xf'));_0x2899ef(_0x5b4ccd['result'][_0x904d('0x15')]);}})[_0x904d('0x16')](function(_0x55af56){logger[_0x904d('0x13')](_0x904d('0xe'),_0x4c3d61,_0x55af56);_0xe30694(_0x55af56);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 5b5027a..0d12103 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 _0x8e99=['exports','INTEGER','sequelize'];(function(_0x36ed6c,_0x5744f1){var _0x46b013=function(_0x112df8){while(--_0x112df8){_0x36ed6c['push'](_0x36ed6c['shift']());}};_0x46b013(++_0x5744f1);}(_0x8e99,0x161));var _0x98e9=function(_0x251314,_0x26ac1f){_0x251314=_0x251314-0x0;var _0x581cda=_0x8e99[_0x251314];return _0x581cda;};'use strict';var Sequelize=require(_0x98e9('0x0'));module[_0x98e9('0x1')]={'UserId':{'type':Sequelize[_0x98e9('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x98e9('0x2')]}}; \ No newline at end of file +var _0xd000=['INTEGER','sequelize','exports'];(function(_0x2b29b0,_0x1fad82){var _0x201198=function(_0x2f9bea){while(--_0x2f9bea){_0x2b29b0['push'](_0x2b29b0['shift']());}};_0x201198(++_0x1fad82);}(_0xd000,0x178));var _0x0d00=function(_0x2a5ee5,_0x5cbfd2){_0x2a5ee5=_0x2a5ee5-0x0;var _0x36ec33=_0xd000[_0x2a5ee5];return _0x36ec33;};'use strict';var Sequelize=require(_0x0d00('0x0'));module[_0x0d00('0x1')]={'UserId':{'type':Sequelize[_0x0d00('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x0d00('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 3c56458..629e333 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(_0xeadca9,_0x34c235){var _0x422b97=function(_0x46897f){while(--_0x46897f){_0xeadca9['push'](_0xeadca9['shift']());}};_0x422b97(++_0x34c235);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x657bf2,_0x20b429){var _0x381e4f=function(_0x32f438){while(--_0x32f438){_0x657bf2['push'](_0x657bf2['shift']());}};_0x381e4f(++_0x20b429);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 bdd5298..1d50e0b 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x30355b,_0xb0bb20){var _0x3b99c8=function(_0x2914ca){while(--_0x2914ca){_0x30355b['push'](_0x30355b['shift']());}};_0x3b99c8(++_0xb0bb20);}(_0xedd9,0xfc));var _0x9edd=function(_0x32c01,_0x48ac41){_0x32c01=_0x32c01-0x0;var _0x323e85=_0xedd9[_0x32c01];return _0x323e85;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1c8e64,_0x538dc9){var _0x2a69fe=function(_0x1d63b0){while(--_0x1d63b0){_0x1c8e64['push'](_0x1c8e64['shift']());}};_0x2a69fe(++_0x538dc9);}(_0xedd9,0xfc));var _0x9edd=function(_0x3a2c3d,_0x1f12ae){_0x3a2c3d=_0x3a2c3d-0x0;var _0x51c339=_0xedd9[_0x3a2c3d];return _0x51c339;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index c85dcc6..79ecec9 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 _0x9b78=['INTEGER','sequelize'];(function(_0x3ebb77,_0xb222a5){var _0x43e4e3=function(_0x4f2302){while(--_0x4f2302){_0x3ebb77['push'](_0x3ebb77['shift']());}};_0x43e4e3(++_0xb222a5);}(_0x9b78,0x19f));var _0x89b7=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0x9b78[_0x358806];return _0x19fdcb;};'use strict';var Sequelize=require(_0x89b7('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x89b7('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x20d8=['exports'];(function(_0x4d0df6,_0x4634f3){var _0x4e2615=function(_0x5285e2){while(--_0x5285e2){_0x4d0df6['push'](_0x4d0df6['shift']());}};_0x4e2615(++_0x4634f3);}(_0x20d8,0xbe));var _0x820d=function(_0x4d8728,_0x14096b){_0x4d8728=_0x4d8728-0x0;var _0x47d2c4=_0x20d8[_0x4d8728];return _0x47d2c4;};'use strict';var Sequelize=require('sequelize');module[_0x820d('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 90effbf..1a4dc52 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 _0xa117=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash','util'];(function(_0x5834c7,_0x596152){var _0x151d83=function(_0x14ec39){while(--_0x14ec39){_0x5834c7['push'](_0x5834c7['shift']());}};_0x151d83(++_0x596152);}(_0xa117,0x11c));var _0x7a11=function(_0x622dc9,_0x3025a5){_0x622dc9=_0x622dc9-0x0;var _0x2602ad=_0xa117[_0x622dc9];return _0x2602ad;};'use strict';var _=require(_0x7a11('0x0'));var util=require(_0x7a11('0x1'));var logger=require(_0x7a11('0x2'))(_0x7a11('0x3'));var moment=require(_0x7a11('0x4'));var BPromise=require(_0x7a11('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a11('0x6'));var rimraf=require(_0x7a11('0x7'));var config=require(_0x7a11('0x8'));var attributes=require(_0x7a11('0x9'));module[_0x7a11('0xa')]=function(_0x5191ed,_0xa258c7){return _0x5191ed[_0x7a11('0xb')](_0x7a11('0xc'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe181=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0xe181,0x17a));var _0x1e18=function(_0x1119c8,_0x87303e){_0x1119c8=_0x1119c8-0x0;var _0x3f3071=_0xe181[_0x1119c8];return _0x3f3071;};'use strict';var _=require(_0x1e18('0x0'));var util=require(_0x1e18('0x1'));var logger=require(_0x1e18('0x2'))(_0x1e18('0x3'));var moment=require(_0x1e18('0x4'));var BPromise=require(_0x1e18('0x5'));var rp=require(_0x1e18('0x6'));var fs=require('fs');var path=require(_0x1e18('0x7'));var rimraf=require(_0x1e18('0x8'));var config=require(_0x1e18('0x9'));var attributes=require(_0x1e18('0xa'));module[_0x1e18('0xb')]=function(_0x34f9c4,_0x2bafc4){return _0x34f9c4['define'](_0x1e18('0xc'),attributes,{'tableName':_0x1e18('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 5e865c4..93b2c22 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 _0x5eb4=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x3a6cf8,_0x18005e){var _0x57ed36=function(_0x4c64ff){while(--_0x4c64ff){_0x3a6cf8['push'](_0x3a6cf8['shift']());}};_0x57ed36(++_0x18005e);}(_0x5eb4,0xdd));var _0x45eb=function(_0x4ecad8,_0x26541a){_0x4ecad8=_0x4ecad8-0x0;var _0x1e65e3=_0x5eb4[_0x4ecad8];return _0x1e65e3;};'use strict';var _=require(_0x45eb('0x0'));var util=require(_0x45eb('0x1'));var moment=require(_0x45eb('0x2'));var BPromise=require(_0x45eb('0x3'));var rs=require(_0x45eb('0x4'));var fs=require('fs');var Redis=require(_0x45eb('0x5'));var db=require(_0x45eb('0x6'))['db'];var utils=require(_0x45eb('0x7'));var logger=require(_0x45eb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x45eb('0x9'));var client=jayson[_0x45eb('0xa')][_0x45eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b29e1,_0xf95f55,_0x3d557d){return new BPromise(function(_0x2f8ba5,_0x73df81){return client['request'](_0x2b29e1,_0x3d557d)[_0x45eb('0xc')](function(_0x15cfb2){logger[_0x45eb('0xd')](_0x45eb('0xe'),_0xf95f55,_0x45eb('0xf'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0xf95f55,_0x45eb('0xf'),JSON[_0x45eb('0x10')](_0x15cfb2));if(_0x15cfb2[_0x45eb('0x11')]){if(_0x15cfb2[_0x45eb('0x11')][_0x45eb('0x12')]===0x1f4){logger[_0x45eb('0x11')](_0x45eb('0xe'),_0xf95f55,_0x15cfb2['error']['message']);return _0x73df81(_0x15cfb2[_0x45eb('0x11')][_0x45eb('0x13')]);}logger[_0x45eb('0x11')](_0x45eb('0xe'),_0xf95f55,_0x15cfb2['error'][_0x45eb('0x13')]);return _0x2f8ba5(_0x15cfb2['error'][_0x45eb('0x13')]);}else{logger[_0x45eb('0xd')](_0x45eb('0xe'),_0xf95f55,_0x45eb('0xf'));_0x2f8ba5(_0x15cfb2[_0x45eb('0x14')][_0x45eb('0x13')]);}})[_0x45eb('0x15')](function(_0x5d19b6){logger[_0x45eb('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0xf95f55,_0x5d19b6);_0x73df81(_0x5d19b6);});});} \ No newline at end of file +var _0xae65=['stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x4b8a01,_0x5d9c82){var _0x32838b=function(_0x13cdb2){while(--_0x13cdb2){_0x4b8a01['push'](_0x4b8a01['shift']());}};_0x32838b(++_0x5d9c82);}(_0xae65,0xde));var _0x5ae6=function(_0x4b0fa8,_0x1ca747){_0x4b0fa8=_0x4b0fa8-0x0;var _0x22869d=_0xae65[_0x4b0fa8];return _0x22869d;};'use strict';var _=require(_0x5ae6('0x0'));var util=require(_0x5ae6('0x1'));var moment=require(_0x5ae6('0x2'));var BPromise=require(_0x5ae6('0x3'));var rs=require(_0x5ae6('0x4'));var fs=require('fs');var Redis=require(_0x5ae6('0x5'));var db=require(_0x5ae6('0x6'))['db'];var utils=require(_0x5ae6('0x7'));var logger=require(_0x5ae6('0x8'))(_0x5ae6('0x9'));var config=require(_0x5ae6('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5ae6('0xb')][_0x5ae6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22f99d,_0x3163b3,_0x28c61f){return new BPromise(function(_0x546506,_0x2ec0c8){return client[_0x5ae6('0xd')](_0x22f99d,_0x28c61f)[_0x5ae6('0xe')](function(_0x1949d4){logger['info'](_0x5ae6('0xf'),_0x3163b3,_0x5ae6('0x10'));logger['debug'](_0x5ae6('0x11'),_0x3163b3,_0x5ae6('0x10'),JSON[_0x5ae6('0x12')](_0x1949d4));if(_0x1949d4[_0x5ae6('0x13')]){if(_0x1949d4[_0x5ae6('0x13')]['code']===0x1f4){logger['error'](_0x5ae6('0xf'),_0x3163b3,_0x1949d4[_0x5ae6('0x13')][_0x5ae6('0x14')]);return _0x2ec0c8(_0x1949d4[_0x5ae6('0x13')][_0x5ae6('0x14')]);}logger[_0x5ae6('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x3163b3,_0x1949d4['error']['message']);return _0x546506(_0x1949d4['error']['message']);}else{logger[_0x5ae6('0x15')](_0x5ae6('0xf'),_0x3163b3,'request\x20sent');_0x546506(_0x1949d4[_0x5ae6('0x16')][_0x5ae6('0x14')]);}})[_0x5ae6('0x17')](function(_0x52b167){logger['error'](_0x5ae6('0xf'),_0x3163b3,_0x52b167);_0x2ec0c8(_0x52b167);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index b5c940d..a081f52 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x20edd4,_0x7c30f2){var _0xc4a1e4=function(_0x32f2f6){while(--_0x32f2f6){_0x20edd4['push'](_0x20edd4['shift']());}};_0xc4a1e4(++_0x7c30f2);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x26dbc0,_0x395329){var _0x15ca33=function(_0x55decb){while(--_0x55decb){_0x26dbc0['push'](_0x26dbc0['shift']());}};_0x15ca33(++_0x395329);}(_0x70e0,0x17b));var _0x070e=function(_0x384a2c,_0x55ef82){_0x384a2c=_0x384a2c-0x0;var _0xdcb951=_0x70e0[_0x384a2c];return _0xdcb951;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 9932338..c5d1a3f 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 _0x6a6c=['INTEGER','sequelize','exports','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x40f69b,_0x2da55d){var _0x18c2be=function(_0xf4cef2){while(--_0xf4cef2){_0x40f69b['push'](_0x40f69b['shift']());}};_0x18c2be(++_0x2da55d);}(_0x6a6c,0x199));var _0xc6a6=function(_0x147bfe,_0x49969b){_0x147bfe=_0x147bfe-0x0;var _0x40411a=_0x6a6c[_0x147bfe];return _0x40411a;};'use strict';var Sequelize=require(_0xc6a6('0x0'));module[_0xc6a6('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xc6a6('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xc6a6('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xc6a6('0x3')],'allowNull':![],'unique':_0xc6a6('0x4'),'comment':_0xc6a6('0x2')},'VoiceQueueId':{'type':Sequelize[_0xc6a6('0x5')],'allowNull':![]},'interface':{'type':Sequelize[_0xc6a6('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xc6a6('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xc6a6('0x2')}}; \ No newline at end of file +var _0xee10=['STRING','queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xee10,0x66));var _0x0ee1=function(_0x157c40,_0x2b514b){_0x157c40=_0x157c40-0x0;var _0x5cbb3b=_0xee10[_0x157c40];return _0x5cbb3b;};'use strict';var Sequelize=require(_0x0ee1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0ee1('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0ee1('0x2')},'membername':{'type':Sequelize[_0x0ee1('0x3')],'allowNull':![],'comment':_0x0ee1('0x2')},'UserId':{'type':Sequelize[_0x0ee1('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x0ee1('0x3')],'allowNull':![],'unique':_0x0ee1('0x4'),'comment':_0x0ee1('0x2')},'VoiceQueueId':{'type':Sequelize[_0x0ee1('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x0ee1('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x0ee1('0x2')},'penalty':{'type':Sequelize[_0x0ee1('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x0ee1('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 06b0504..2159628 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 _0xbc6e=['UserVoiceQueueRt','setMaxListeners','update','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x4b6e98,_0x2df79c){var _0x1bfea2=function(_0x4f1a75){while(--_0x4f1a75){_0x4b6e98['push'](_0x4b6e98['shift']());}};_0x1bfea2(++_0x2df79c);}(_0xbc6e,0x68));var _0xebc6=function(_0x4a2e58,_0x37eb38){_0x4a2e58=_0x4a2e58-0x0;var _0x575ca2=_0xbc6e[_0x4a2e58];return _0x575ca2;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xebc6('0x0'))['db'][_0xebc6('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xebc6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xebc6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x266cda){return function(_0x443c46,_0x4b1382,_0xec7412){UserVoiceQueueRtEvents['emit'](_0x266cda+':'+_0x443c46['id'],_0x443c46);UserVoiceQueueRtEvents[_0xebc6('0x4')](_0x266cda,_0x443c46);_0xec7412(null);};}for(var e in events){if(events[_0xebc6('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xebc6('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xf068=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf068,0x141));var _0x8f06=function(_0x22686a,_0x1f9e0f){_0x22686a=_0x22686a-0x0;var _0x139f39=_0xf068[_0x22686a];return _0x139f39;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x8f06('0x0'))['db'][_0x8f06('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x8f06('0x2')](0x0);var events={'afterCreate':_0x8f06('0x3'),'afterUpdate':_0x8f06('0x4'),'afterDestroy':_0x8f06('0x5')};function emitEvent(_0x264cbb){return function(_0x557a84,_0x1b0624,_0x312567){UserVoiceQueueRtEvents['emit'](_0x264cbb+':'+_0x557a84['id'],_0x557a84);UserVoiceQueueRtEvents[_0x8f06('0x6')](_0x264cbb,_0x557a84);_0x312567(null);};}for(var e in events){if(events[_0x8f06('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x8f06('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index fa65cbc..8b788cf 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 _0xb8fb=['../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x300c89,_0x25fcad){var _0x41762e=function(_0x5b852f){while(--_0x5b852f){_0x300c89['push'](_0x300c89['shift']());}};_0x41762e(++_0x25fcad);}(_0xb8fb,0x172));var _0xbb8f=function(_0x1a04c9,_0x2f1f9d){_0x1a04c9=_0x1a04c9-0x0;var _0xa8617c=_0xb8fb[_0x1a04c9];return _0xa8617c;};'use strict';var _=require(_0xbb8f('0x0'));var util=require(_0xbb8f('0x1'));var logger=require(_0xbb8f('0x2'))(_0xbb8f('0x3'));var moment=require(_0xbb8f('0x4'));var BPromise=require(_0xbb8f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb8f('0x6'));var rimraf=require(_0xbb8f('0x7'));var config=require(_0xbb8f('0x8'));var attributes=require(_0xbb8f('0x9'));module[_0xbb8f('0xa')]=function(_0x45f646,_0x533a13){return _0x45f646[_0xbb8f('0xb')](_0xbb8f('0xc'),attributes,{'tableName':_0xbb8f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c70=['request-promise','rimraf','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3b7db5,_0x26811d){var _0x150c1b=function(_0x50b28d){while(--_0x50b28d){_0x3b7db5['push'](_0x3b7db5['shift']());}};_0x150c1b(++_0x26811d);}(_0x1c70,0x17a));var _0x01c7=function(_0x4559d6,_0x21ff92){_0x4559d6=_0x4559d6-0x0;var _0x3b77ae=_0x1c70[_0x4559d6];return _0x3b77ae;};'use strict';var _=require(_0x01c7('0x0'));var util=require(_0x01c7('0x1'));var logger=require(_0x01c7('0x2'))(_0x01c7('0x3'));var moment=require(_0x01c7('0x4'));var BPromise=require(_0x01c7('0x5'));var rp=require(_0x01c7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01c7('0x7'));var config=require('../../config/environment');var attributes=require(_0x01c7('0x8'));module['exports']=function(_0x55b033,_0x29376f){return _0x55b033[_0x01c7('0x9')](_0x01c7('0xa'),attributes,{'tableName':_0x01c7('0xb'),'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 f2237cf..ecda54b 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 _0xe785=['sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw'];(function(_0x1a5a1f,_0x5b8a30){var _0x6d2678=function(_0x5ed2cd){while(--_0x5ed2cd){_0x1a5a1f['push'](_0x1a5a1f['shift']());}};_0x6d2678(++_0x5b8a30);}(_0xe785,0x11f));var _0x5e78=function(_0x174175,_0x251250){_0x174175=_0x174175-0x0;var _0x2eff46=_0xe785[_0x174175];return _0x2eff46;};'use strict';var _=require(_0x5e78('0x0'));var util=require(_0x5e78('0x1'));var moment=require(_0x5e78('0x2'));var BPromise=require(_0x5e78('0x3'));var rs=require(_0x5e78('0x4'));var fs=require('fs');var Redis=require(_0x5e78('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e78('0x6'));var logger=require(_0x5e78('0x7'))(_0x5e78('0x8'));var config=require('../../config/environment');var jayson=require(_0x5e78('0x9'));var client=jayson[_0x5e78('0xa')][_0x5e78('0xb')]({'port':0x232a});config[_0x5e78('0xc')]=_[_0x5e78('0xd')](config[_0x5e78('0xc')],{'host':_0x5e78('0xe'),'port':0x18eb});var socket=require(_0x5e78('0xf'))(new Redis(config['redis']));require(_0x5e78('0x10'))['register'](socket);function respondWithRpcPromise(_0x500478,_0x16dd23,_0x5992ca){return new BPromise(function(_0x268331,_0x3174a4){return client[_0x5e78('0x11')](_0x500478,_0x5992ca)[_0x5e78('0x12')](function(_0x114ab9){logger[_0x5e78('0x13')](_0x5e78('0x14'),_0x16dd23,_0x5e78('0x15'));logger[_0x5e78('0x16')](_0x5e78('0x17'),_0x16dd23,_0x5e78('0x15'),JSON['stringify'](_0x114ab9));if(_0x114ab9[_0x5e78('0x18')]){if(_0x114ab9[_0x5e78('0x18')][_0x5e78('0x19')]===0x1f4){logger[_0x5e78('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x16dd23,_0x114ab9[_0x5e78('0x18')][_0x5e78('0x1a')]);return _0x3174a4(_0x114ab9['error'][_0x5e78('0x1a')]);}logger[_0x5e78('0x18')](_0x5e78('0x14'),_0x16dd23,_0x114ab9[_0x5e78('0x18')][_0x5e78('0x1a')]);return _0x268331(_0x114ab9[_0x5e78('0x18')]['message']);}else{logger['info'](_0x5e78('0x14'),_0x16dd23,_0x5e78('0x15'));_0x268331(_0x114ab9[_0x5e78('0x1b')][_0x5e78('0x1a')]);}})['catch'](function(_0x332bc8){logger[_0x5e78('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x16dd23,_0x332bc8);_0x3174a4(_0x332bc8);});});}exports[_0x5e78('0x1c')]=function(_0x157a8a){var _0x6228d6=this;return new Promise(function(_0x1c716,_0x3d1337){return db[_0x5e78('0x1d')][_0x5e78('0x1e')]({'raw':_0x157a8a[_0x5e78('0x1f')]?_0x157a8a[_0x5e78('0x1f')][_0x5e78('0x20')]===undefined?!![]:![]:!![],'where':_0x157a8a[_0x5e78('0x1f')]?_0x157a8a['options']['where']||null:null,'attributes':[[db[_0x5e78('0x21')]['fn'](_0x5e78('0x22'),db[_0x5e78('0x21')]['fn']('IF',db['sequelize'][_0x5e78('0x23')](_0x5e78('0x24')))),_0x5e78('0x25')]]})[_0x5e78('0x12')](function(_0x57fd4d){logger[_0x5e78('0x13')]('GetVoiceQueueRtPauses',_0x157a8a);logger[_0x5e78('0x16')](_0x5e78('0x1c'),_0x157a8a,JSON[_0x5e78('0x26')](_0x57fd4d));_0x1c716(_0x57fd4d);})[_0x5e78('0x27')](function(_0x21cc80){logger[_0x5e78('0x18')]('GetVoiceQueueRtPauses',_0x21cc80[_0x5e78('0x1a')],_0x157a8a);_0x3d1337(_0x6228d6[_0x5e78('0x18')](0x1f4,_0x21cc80['message']));});});}; \ No newline at end of file +var _0xb4be=['then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','outboundQueuePauses','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./userVoiceQueueRt.socket','register','request'];(function(_0x535644,_0x5d5fea){var _0x1ceb8b=function(_0x59e10b){while(--_0x59e10b){_0x535644['push'](_0x535644['shift']());}};_0x1ceb8b(++_0x5d5fea);}(_0xb4be,0x1cf));var _0xeb4b=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xb4be[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xeb4b('0x0'));var util=require(_0xeb4b('0x1'));var moment=require(_0xeb4b('0x2'));var BPromise=require(_0xeb4b('0x3'));var rs=require(_0xeb4b('0x4'));var fs=require('fs');var Redis=require(_0xeb4b('0x5'));var db=require(_0xeb4b('0x6'))['db'];var utils=require(_0xeb4b('0x7'));var logger=require(_0xeb4b('0x8'))(_0xeb4b('0x9'));var config=require(_0xeb4b('0xa'));var jayson=require(_0xeb4b('0xb'));var client=jayson[_0xeb4b('0xc')]['http']({'port':0x232a});config[_0xeb4b('0xd')]=_[_0xeb4b('0xe')](config[_0xeb4b('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb4b('0xd')]));require(_0xeb4b('0xf'))[_0xeb4b('0x10')](socket);function respondWithRpcPromise(_0xc333c3,_0x23cd36,_0x2b1bdd){return new BPromise(function(_0x3b3914,_0xe5c4c9){return client[_0xeb4b('0x11')](_0xc333c3,_0x2b1bdd)[_0xeb4b('0x12')](function(_0x292c69){logger[_0xeb4b('0x13')](_0xeb4b('0x14'),_0x23cd36,_0xeb4b('0x15'));logger['debug'](_0xeb4b('0x16'),_0x23cd36,_0xeb4b('0x15'),JSON[_0xeb4b('0x17')](_0x292c69));if(_0x292c69[_0xeb4b('0x18')]){if(_0x292c69[_0xeb4b('0x18')]['code']===0x1f4){logger[_0xeb4b('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x23cd36,_0x292c69[_0xeb4b('0x18')]['message']);return _0xe5c4c9(_0x292c69[_0xeb4b('0x18')]['message']);}logger[_0xeb4b('0x18')](_0xeb4b('0x14'),_0x23cd36,_0x292c69[_0xeb4b('0x18')][_0xeb4b('0x19')]);return _0x3b3914(_0x292c69['error'][_0xeb4b('0x19')]);}else{logger['info'](_0xeb4b('0x14'),_0x23cd36,_0xeb4b('0x15'));_0x3b3914(_0x292c69[_0xeb4b('0x1a')]['message']);}})[_0xeb4b('0x1b')](function(_0x45a6bd){logger[_0xeb4b('0x18')](_0xeb4b('0x14'),_0x23cd36,_0x45a6bd);_0xe5c4c9(_0x45a6bd);});});}exports[_0xeb4b('0x1c')]=function(_0x14da5c){var _0x2f98a1=this;return new Promise(function(_0x37cf34,_0x4809f3){return db[_0xeb4b('0x1d')][_0xeb4b('0x1e')]({'raw':_0x14da5c[_0xeb4b('0x1f')]?_0x14da5c[_0xeb4b('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x14da5c[_0xeb4b('0x1f')]?_0x14da5c['options'][_0xeb4b('0x20')]||null:null,'attributes':[[db[_0xeb4b('0x21')]['fn'](_0xeb4b('0x22'),db[_0xeb4b('0x21')]['fn']('IF',db[_0xeb4b('0x21')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0xeb4b('0x23')]]})[_0xeb4b('0x12')](function(_0x38edf1){logger[_0xeb4b('0x13')](_0xeb4b('0x1c'),_0x14da5c);logger[_0xeb4b('0x24')](_0xeb4b('0x1c'),_0x14da5c,JSON[_0xeb4b('0x17')](_0x38edf1));_0x37cf34(_0x38edf1);})[_0xeb4b('0x1b')](function(_0x59c409){logger[_0xeb4b('0x18')](_0xeb4b('0x1c'),_0x59c409[_0xeb4b('0x19')],_0x14da5c);_0x4809f3(_0x2f98a1['error'](0x1f4,_0x59c409[_0xeb4b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 45bec56..20c10f3 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 _0xc627=['length','save','remove','update','emit','removeListener','register'];(function(_0x54e000,_0x1f8a31){var _0x44aa1e=function(_0xe143a5){while(--_0xe143a5){_0x54e000['push'](_0x54e000['shift']());}};_0x44aa1e(++_0x1f8a31);}(_0xc627,0x14a));var _0x7c62=function(_0x5ce9c7,_0xa164ef){_0x5ce9c7=_0x5ce9c7-0x0;var _0x25fe73=_0xc627[_0x5ce9c7];return _0x25fe73;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x7c62('0x0'),_0x7c62('0x1'),_0x7c62('0x2')];function createListener(_0x55c85f,_0x311a10){return function(_0x1e7490){_0x311a10[_0x7c62('0x3')](_0x55c85f,_0x1e7490);};}function removeListener(_0x313d80,_0x121766){return function(){UserVoiceQueueRtEvents[_0x7c62('0x4')](_0x313d80,_0x121766);};}exports[_0x7c62('0x5')]=function(_0x448f4b){for(var _0x25a5c8=0x0,_0x43f964=events[_0x7c62('0x6')];_0x25a5c8<_0x43f964;_0x25a5c8++){var _0x29705f=events[_0x25a5c8];var _0x58c31c=createListener('userVoiceQueueRt:'+_0x29705f,_0x448f4b);UserVoiceQueueRtEvents['on'](_0x29705f,_0x58c31c);}}; \ No newline at end of file +var _0xaa3f=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x41d578,_0x2dbaf4){var _0x57e9fc=function(_0x210249){while(--_0x210249){_0x41d578['push'](_0x41d578['shift']());}};_0x57e9fc(++_0x2dbaf4);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x5b0aec,_0x410ecc){_0x5b0aec=_0x5b0aec-0x0;var _0x23c946=_0xaa3f[_0x5b0aec];return _0x23c946;};'use strict';var UserVoiceQueueRtEvents=require(_0xfaa3('0x0'));var events=[_0xfaa3('0x1'),_0xfaa3('0x2'),_0xfaa3('0x3')];function createListener(_0x1ebbfb,_0x1da39b){return function(_0x408343){_0x1da39b[_0xfaa3('0x4')](_0x1ebbfb,_0x408343);};}function removeListener(_0x32f4e1,_0x5123a3){return function(){UserVoiceQueueRtEvents['removeListener'](_0x32f4e1,_0x5123a3);};}exports[_0xfaa3('0x5')]=function(_0x4bac92){for(var _0x3d09aa=0x0,_0xeecce5=events[_0xfaa3('0x6')];_0x3d09aa<_0xeecce5;_0x3d09aa++){var _0xbf270c=events[_0x3d09aa];var _0x328d5f=createListener(_0xfaa3('0x7')+_0xbf270c,_0x4bac92);UserVoiceQueueRtEvents['on'](_0xbf270c,_0x328d5f);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 04193e4..e90f311 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1dffe7,_0x1d425c){var _0x277eb5=function(_0x59ba35){while(--_0x59ba35){_0x1dffe7['push'](_0x1dffe7['shift']());}};_0x277eb5(++_0x1d425c);}(_0x70e0,0x17b));var _0x070e=function(_0x1e1421,_0x1cfbe5){_0x1e1421=_0x1e1421-0x0;var _0x57e7a1=_0x70e0[_0x1e1421];return _0x57e7a1;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x322252,_0x12d2c5){var _0x3f6c4e=function(_0x2e03ca){while(--_0x2e03ca){_0x322252['push'](_0x322252['shift']());}};_0x3f6c4e(++_0x12d2c5);}(_0x70e0,0x17b));var _0x070e=function(_0x36c30c,_0x5966bb){_0x36c30c=_0x36c30c-0x0;var _0x5cd602=_0x70e0[_0x36c30c];return _0x5cd602;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 3bdd0b9..f00afdd 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 _0xe9e7=['INTEGER','sequelize','exports'];(function(_0xcb64e4,_0x1b2d8e){var _0x542ed4=function(_0x381901){while(--_0x381901){_0xcb64e4['push'](_0xcb64e4['shift']());}};_0x542ed4(++_0x1b2d8e);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x2f79ee,_0x2c4607){_0x2f79ee=_0x2f79ee-0x0;var _0x5e0f67=_0xe9e7[_0x2f79ee];return _0x5e0f67;};'use strict';var Sequelize=require(_0x7e9e('0x0'));module[_0x7e9e('0x1')]={'penalty':{'type':Sequelize[_0x7e9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5ec3=['exports','sequelize'];(function(_0x1fd412,_0x335420){var _0x416a4c=function(_0x19f1f0){while(--_0x19f1f0){_0x1fd412['push'](_0x1fd412['shift']());}};_0x416a4c(++_0x335420);}(_0x5ec3,0xa1));var _0x35ec=function(_0x4e0ab3,_0x524063){_0x4e0ab3=_0x4e0ab3-0x0;var _0x46ff71=_0x5ec3[_0x4e0ab3];return _0x46ff71;};'use strict';var Sequelize=require(_0x35ec('0x0'));module[_0x35ec('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 7e1516b..228281e 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 _0x0bfa=['../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x0bfa,0xa1));var _0xa0bf=function(_0x273987,_0x44056f){_0x273987=_0x273987-0x0;var _0x50ebc7=_0x0bfa[_0x273987];return _0x50ebc7;};'use strict';var _=require(_0xa0bf('0x0'));var util=require(_0xa0bf('0x1'));var logger=require(_0xa0bf('0x2'))(_0xa0bf('0x3'));var moment=require('moment');var BPromise=require(_0xa0bf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0bf('0x5'));var rimraf=require(_0xa0bf('0x6'));var config=require(_0xa0bf('0x7'));var attributes=require(_0xa0bf('0x8'));module[_0xa0bf('0x9')]=function(_0x22535f,_0x26a845){return _0x22535f['define'](_0xa0bf('0xa'),attributes,{'tableName':_0xa0bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83b0=['util','../../config/logger','request-promise','path','../../config/environment','exports','define','user_has_whatsapp_queues','lodash'];(function(_0x114749,_0x3b09f3){var _0x14b8ce=function(_0xcd1b6e){while(--_0xcd1b6e){_0x114749['push'](_0x114749['shift']());}};_0x14b8ce(++_0x3b09f3);}(_0x83b0,0x170));var _0x083b=function(_0x382b1b,_0x2553aa){_0x382b1b=_0x382b1b-0x0;var _0x4abaa5=_0x83b0[_0x382b1b];return _0x4abaa5;};'use strict';var _=require(_0x083b('0x0'));var util=require(_0x083b('0x1'));var logger=require(_0x083b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x083b('0x3'));var fs=require('fs');var path=require(_0x083b('0x4'));var rimraf=require('rimraf');var config=require(_0x083b('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0x083b('0x6')]=function(_0x18c98e,_0x116286){return _0x18c98e[_0x083b('0x7')]('UserWhatsappQueue',attributes,{'tableName':_0x083b('0x8'),'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 8d10388..95ed3ff 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 _0xb00e=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x11e022,_0x8f36d8){var _0x59960c=function(_0x5d5805){while(--_0x5d5805){_0x11e022['push'](_0x11e022['shift']());}};_0x59960c(++_0x8f36d8);}(_0xb00e,0xb8));var _0xeb00=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0xb00e[_0x5a2285];return _0x48f6ed;};'use strict';var _=require(_0xeb00('0x0'));var util=require('util');var moment=require(_0xeb00('0x1'));var BPromise=require(_0xeb00('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb00('0x3'));var db=require(_0xeb00('0x4'))['db'];var utils=require(_0xeb00('0x5'));var logger=require(_0xeb00('0x6'))(_0xeb00('0x7'));var config=require(_0xeb00('0x8'));var jayson=require(_0xeb00('0x9'));var client=jayson[_0xeb00('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x219bdb,_0x524b39,_0x12c298){return new BPromise(function(_0x206537,_0x16a4d6){return client[_0xeb00('0xb')](_0x219bdb,_0x12c298)['then'](function(_0xb8cd78){logger[_0xeb00('0xc')](_0xeb00('0xd'),_0x524b39,_0xeb00('0xe'));logger[_0xeb00('0xf')](_0xeb00('0x10'),_0x524b39,_0xeb00('0xe'),JSON[_0xeb00('0x11')](_0xb8cd78));if(_0xb8cd78['error']){if(_0xb8cd78[_0xeb00('0x12')][_0xeb00('0x13')]===0x1f4){logger[_0xeb00('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x524b39,_0xb8cd78['error'][_0xeb00('0x14')]);return _0x16a4d6(_0xb8cd78['error']['message']);}logger[_0xeb00('0x12')](_0xeb00('0xd'),_0x524b39,_0xb8cd78[_0xeb00('0x12')][_0xeb00('0x14')]);return _0x206537(_0xb8cd78[_0xeb00('0x12')][_0xeb00('0x14')]);}else{logger[_0xeb00('0xc')](_0xeb00('0xd'),_0x524b39,_0xeb00('0xe'));_0x206537(_0xb8cd78[_0xeb00('0x15')][_0xeb00('0x14')]);}})[_0xeb00('0x16')](function(_0x39b636){logger[_0xeb00('0x12')](_0xeb00('0xd'),_0x524b39,_0x39b636);_0x16a4d6(_0x39b636);});});} \ No newline at end of file +var _0x2f02=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x363554,_0x7abbb0){var _0x1faff7=function(_0x4761dd){while(--_0x4761dd){_0x363554['push'](_0x363554['shift']());}};_0x1faff7(++_0x7abbb0);}(_0x2f02,0xa3));var _0x22f0=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x2f02[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x22f0('0x0'));var util=require(_0x22f0('0x1'));var moment=require(_0x22f0('0x2'));var BPromise=require(_0x22f0('0x3'));var rs=require(_0x22f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22f0('0x5'))['db'];var utils=require(_0x22f0('0x6'));var logger=require('../../config/logger')(_0x22f0('0x7'));var config=require(_0x22f0('0x8'));var jayson=require(_0x22f0('0x9'));var client=jayson['client'][_0x22f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x83a6e1,_0x4b437f,_0x440213){return new BPromise(function(_0x1b1ffd,_0x44973c){return client['request'](_0x83a6e1,_0x440213)[_0x22f0('0xb')](function(_0x3d15b6){logger[_0x22f0('0xc')](_0x22f0('0xd'),_0x4b437f,_0x22f0('0xe'));logger['debug'](_0x22f0('0xf'),_0x4b437f,_0x22f0('0xe'),JSON[_0x22f0('0x10')](_0x3d15b6));if(_0x3d15b6[_0x22f0('0x11')]){if(_0x3d15b6[_0x22f0('0x11')][_0x22f0('0x12')]===0x1f4){logger[_0x22f0('0x11')](_0x22f0('0xd'),_0x4b437f,_0x3d15b6[_0x22f0('0x11')][_0x22f0('0x13')]);return _0x44973c(_0x3d15b6['error'][_0x22f0('0x13')]);}logger[_0x22f0('0x11')](_0x22f0('0xd'),_0x4b437f,_0x3d15b6['error']['message']);return _0x1b1ffd(_0x3d15b6[_0x22f0('0x11')][_0x22f0('0x13')]);}else{logger[_0x22f0('0xc')](_0x22f0('0xd'),_0x4b437f,_0x22f0('0xe'));_0x1b1ffd(_0x3d15b6[_0x22f0('0x14')][_0x22f0('0x13')]);}})[_0x22f0('0x15')](function(_0x4e7438){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x4b437f,_0x4e7438);_0x44973c(_0x4e7438);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index f539921..9adf19d 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 _0xfd0f=['get','isAuthenticated','index','/:id','show','create','put','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./variable.controller'];(function(_0xb81223,_0x1c999c){var _0x1ab680=function(_0x18199a){while(--_0x18199a){_0xb81223['push'](_0xb81223['shift']());}};_0x1ab680(++_0x1c999c);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x22c359,_0x3838ac){_0x22c359=_0x22c359-0x0;var _0x54afc9=_0xfd0f[_0x22c359];return _0x54afc9;};'use strict';var multer=require(_0xffd0('0x0'));var util=require(_0xffd0('0x1'));var path=require('path');var timeout=require(_0xffd0('0x2'));var express=require(_0xffd0('0x3'));var router=express[_0xffd0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xffd0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xffd0('0x6'));var controller=require(_0xffd0('0x7'));router[_0xffd0('0x8')]('/',auth[_0xffd0('0x9')](),controller[_0xffd0('0xa')]);router[_0xffd0('0x8')](_0xffd0('0xb'),auth[_0xffd0('0x9')](),controller[_0xffd0('0xc')]);router['post']('/',auth[_0xffd0('0x9')](),controller[_0xffd0('0xd')]);router[_0xffd0('0xe')](_0xffd0('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xffd0('0xf')](_0xffd0('0xb'),auth[_0xffd0('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf842=['isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x555337,_0x1559d1){var _0x49b217=function(_0x3cb634){while(--_0x3cb634){_0x555337['push'](_0x555337['shift']());}};_0x49b217(++_0x1559d1);}(_0xf842,0x172));var _0x2f84=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0xf842[_0x53abe5];return _0xc1c37e;};'use strict';var multer=require(_0x2f84('0x0'));var util=require(_0x2f84('0x1'));var path=require(_0x2f84('0x2'));var timeout=require(_0x2f84('0x3'));var express=require('express');var router=express[_0x2f84('0x4')]();var fs_extra=require(_0x2f84('0x5'));var auth=require(_0x2f84('0x6'));var interaction=require(_0x2f84('0x7'));var config=require(_0x2f84('0x8'));var controller=require('./variable.controller');router[_0x2f84('0x9')]('/',auth[_0x2f84('0xa')](),controller[_0x2f84('0xb')]);router['get'](_0x2f84('0xc'),auth[_0x2f84('0xa')](),controller[_0x2f84('0xd')]);router[_0x2f84('0xe')]('/',auth[_0x2f84('0xa')](),controller[_0x2f84('0xf')]);router[_0x2f84('0x10')](_0x2f84('0xc'),auth[_0x2f84('0xa')](),controller[_0x2f84('0x11')]);router['delete'](_0x2f84('0xc'),auth['isAuthenticated'](),controller[_0x2f84('0x12')]);module[_0x2f84('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index a47569c..567c569 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 _0x269f=['STRING','sequelize','exports'];(function(_0x17cdb7,_0x2028c9){var _0x1dd9db=function(_0x2e1dc){while(--_0x2e1dc){_0x17cdb7['push'](_0x17cdb7['shift']());}};_0x1dd9db(++_0x2028c9);}(_0x269f,0xee));var _0xf269=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x269f[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require(_0xf269('0x0'));module[_0xf269('0x1')]={'name':{'type':Sequelize[_0xf269('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf269('0x2')]}}; \ No newline at end of file +var _0xeaa7=['exports','STRING','name','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeaa7,0x113));var _0x7eaa=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xeaa7[_0x4dcc2d];return _0x1bbd79;};'use strict';var Sequelize=require(_0x7eaa('0x0'));module[_0x7eaa('0x1')]={'name':{'type':Sequelize[_0x7eaa('0x2')],'unique':_0x7eaa('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7eaa('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 972f7a3..53d572e 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 _0x28a5=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','bluebird','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge'];(function(_0x4bacb6,_0x2b299d){var _0x58c029=function(_0x2faaf5){while(--_0x2faaf5){_0x4bacb6['push'](_0x4bacb6['shift']());}};_0x58c029(++_0x2b299d);}(_0x28a5,0x170));var _0x528a=function(_0x2700d5,_0x1b113b){_0x2700d5=_0x2700d5-0x0;var _0xdc3338=_0x28a5[_0x2700d5];return _0xdc3338;};'use strict';var emlformat=require(_0x528a('0x0'));var rimraf=require(_0x528a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x528a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x528a('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x528a('0x4'));var sox=require(_0x528a('0x5'));var csv=require(_0x528a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x528a('0x7'));var squel=require(_0x528a('0x8'));var crypto=require(_0x528a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x528a('0xa'));var toCsv=require('to-csv');var querystring=require(_0x528a('0xb'));var Papa=require(_0x528a('0xc'));var Redis=require(_0x528a('0xd'));var authService=require(_0x528a('0xe'));var qs=require(_0x528a('0xf'));var as=require(_0x528a('0x10'));var hardwareService=require(_0x528a('0x11'));var logger=require(_0x528a('0x12'))(_0x528a('0x13'));var utils=require(_0x528a('0x14'));var config=require(_0x528a('0x15'));var licenseUtil=require(_0x528a('0x16'));var db=require(_0x528a('0x17'))['db'];function respondWithStatusCode(_0x6d4ab1,_0x37c72f){_0x37c72f=_0x37c72f||0xcc;return function(_0x56ad8e){if(_0x56ad8e){return _0x6d4ab1[_0x528a('0x18')](_0x37c72f);}return _0x6d4ab1['status'](_0x37c72f)[_0x528a('0x19')]();};}function respondWithResult(_0x3c3b9f,_0x522a2a){_0x522a2a=_0x522a2a||0xc8;return function(_0x5dd7f4){if(_0x5dd7f4){return _0x3c3b9f['status'](_0x522a2a)[_0x528a('0x1a')](_0x5dd7f4);}};}function respondWithFilteredResult(_0x4c5a1b,_0x35949c){return function(_0x1e6956){if(_0x1e6956){var _0x489e21=typeof _0x35949c[_0x528a('0x1b')]===_0x528a('0x1c')&&typeof _0x35949c[_0x528a('0x1d')]===_0x528a('0x1c');var _0x47a764=_0x1e6956['count'];var _0x1e0058=_0x489e21?0x0:_0x35949c[_0x528a('0x1b')];var _0xff1a51=_0x489e21?_0x1e6956[_0x528a('0x1e')]:_0x35949c[_0x528a('0x1b')]+_0x35949c[_0x528a('0x1d')];var _0x59f599;if(_0xff1a51>=_0x47a764){_0xff1a51=_0x47a764;_0x59f599=0xc8;}else{_0x59f599=0xce;}_0x4c5a1b[_0x528a('0x1f')](_0x59f599);return _0x4c5a1b[_0x528a('0x20')](_0x528a('0x21'),_0x1e0058+'-'+_0xff1a51+'/'+_0x47a764)[_0x528a('0x1a')](_0x1e6956);}return null;};}function patchUpdates(_0x1a6531){return function(_0x2ac585){try{jsonpatch[_0x528a('0x22')](_0x2ac585,_0x1a6531,!![]);}catch(_0x1073cd){return BPromise[_0x528a('0x23')](_0x1073cd);}return _0x2ac585[_0x528a('0x24')]();};}function saveUpdates(_0xa69c38,_0x511fe2){return function(_0x2286eb){if(_0x2286eb){return _0x2286eb[_0x528a('0x25')](_0xa69c38)['then'](function(_0x95d75a){return _0x95d75a;});}return null;};}function removeEntity(_0x3f1249,_0x3fd300){return function(_0xde7fd4){if(_0xde7fd4){return _0xde7fd4[_0x528a('0x26')]()['then'](function(){var _0x477ef1=_0xde7fd4[_0x528a('0x27')]({'plain':!![]});var _0xe993d5='Variables';return db[_0x528a('0x28')][_0x528a('0x26')]({'where':{'type':_0xe993d5,'resourceId':_0x477ef1['id']}})[_0x528a('0x29')](function(){return _0xde7fd4;});})['then'](function(){_0x3f1249[_0x528a('0x1f')](0xcc)[_0x528a('0x19')]();});}};}function handleEntityNotFound(_0xab2ce4,_0x4a8902){return function(_0x1698bf){if(!_0x1698bf){_0xab2ce4['sendStatus'](0x194);}return _0x1698bf;};}function handleError(_0x3bca93,_0x3ea0a9){_0x3ea0a9=_0x3ea0a9||0x1f4;return function(_0x5ddea7){logger[_0x528a('0x2a')](_0x5ddea7[_0x528a('0x2b')]);if(_0x5ddea7['name']){delete _0x5ddea7[_0x528a('0x2c')];}_0x3bca93[_0x528a('0x1f')](_0x3ea0a9)[_0x528a('0x2d')](_0x5ddea7);};}exports[_0x528a('0x2e')]=function(_0xe3f768,_0xde91d6){var _0x51f244={},_0x167f9b={},_0x1861d1={'count':0x0,'rows':[]};var _0x58c5c5=_[_0x528a('0x2f')](db[_0x528a('0x30')][_0x528a('0x31')],function(_0x6d12d){return{'name':_0x6d12d[_0x528a('0x32')],'type':_0x6d12d[_0x528a('0x33')][_0x528a('0x34')]};});_0x167f9b[_0x528a('0x35')]=_[_0x528a('0x2f')](_0x58c5c5,'name');_0x167f9b['query']=_[_0x528a('0x36')](_0xe3f768[_0x528a('0x37')]);_0x167f9b[_0x528a('0x38')]=_['intersection'](_0x167f9b[_0x528a('0x35')],_0x167f9b[_0x528a('0x37')]);_0x51f244[_0x528a('0x39')]=_['intersection'](_0x167f9b[_0x528a('0x35')],qs[_0x528a('0x3a')](_0xe3f768[_0x528a('0x37')][_0x528a('0x3a')]));_0x51f244[_0x528a('0x39')]=_0x51f244[_0x528a('0x39')][_0x528a('0x3b')]?_0x51f244['attributes']:_0x167f9b[_0x528a('0x35')];if(!_0xe3f768['query'][_0x528a('0x3c')]('nolimit')){_0x51f244[_0x528a('0x1d')]=qs[_0x528a('0x1d')](_0xe3f768[_0x528a('0x37')][_0x528a('0x1d')]);_0x51f244[_0x528a('0x1b')]=qs['offset'](_0xe3f768[_0x528a('0x37')][_0x528a('0x1b')]);}_0x51f244[_0x528a('0x3d')]=qs[_0x528a('0x3e')](_0xe3f768[_0x528a('0x37')][_0x528a('0x3e')]);_0x51f244['where']=qs[_0x528a('0x38')](_[_0x528a('0x3f')](_0xe3f768[_0x528a('0x37')],_0x167f9b[_0x528a('0x38')]),_0x58c5c5);if(_0xe3f768[_0x528a('0x37')][_0x528a('0x40')]){_0x51f244[_0x528a('0x41')]=_[_0x528a('0x42')](_0x51f244[_0x528a('0x41')],{'$or':_[_0x528a('0x2f')](_0x58c5c5,function(_0x4298e7){if(_0x4298e7[_0x528a('0x33')]!==_0x528a('0x43')){var _0x4ad476={};_0x4ad476[_0x4298e7[_0x528a('0x2c')]]={'$like':'%'+_0xe3f768[_0x528a('0x37')][_0x528a('0x40')]+'%'};return _0x4ad476;}})});}_0x51f244=_['merge']({},_0x51f244,_0xe3f768[_0x528a('0x44')]);var _0x1a6600={'where':_0x51f244['where']};return db[_0x528a('0x30')][_0x528a('0x1e')](_0x1a6600)[_0x528a('0x29')](function(_0x552e52){_0x1861d1['count']=_0x552e52;if(_0xe3f768[_0x528a('0x37')][_0x528a('0x45')]){_0x51f244[_0x528a('0x46')]=[{'all':!![]}];}return db[_0x528a('0x30')][_0x528a('0x47')](_0x51f244);})[_0x528a('0x29')](function(_0x2d7323){_0x1861d1[_0x528a('0x48')]=_0x2d7323;return _0x1861d1;})[_0x528a('0x29')](respondWithFilteredResult(_0xde91d6,_0x51f244))[_0x528a('0x49')](handleError(_0xde91d6,null));};exports[_0x528a('0x4a')]=function(_0x4b0faf,_0x37df0d){var _0x2a2b71={'raw':!![],'where':{'id':_0x4b0faf['params']['id']}},_0x14a163={};_0x14a163['model']=_['keys'](db[_0x528a('0x30')][_0x528a('0x31')]);_0x14a163[_0x528a('0x37')]=_[_0x528a('0x36')](_0x4b0faf[_0x528a('0x37')]);_0x14a163[_0x528a('0x38')]=_[_0x528a('0x4b')](_0x14a163[_0x528a('0x35')],_0x14a163[_0x528a('0x37')]);_0x2a2b71[_0x528a('0x39')]=_[_0x528a('0x4b')](_0x14a163[_0x528a('0x35')],qs[_0x528a('0x3a')](_0x4b0faf[_0x528a('0x37')][_0x528a('0x3a')]));_0x2a2b71[_0x528a('0x39')]=_0x2a2b71['attributes'][_0x528a('0x3b')]?_0x2a2b71[_0x528a('0x39')]:_0x14a163[_0x528a('0x35')];if(_0x4b0faf[_0x528a('0x37')][_0x528a('0x45')]){_0x2a2b71[_0x528a('0x46')]=[{'all':!![]}];}_0x2a2b71=_[_0x528a('0x42')]({},_0x2a2b71,_0x4b0faf['options']);return db[_0x528a('0x30')][_0x528a('0x4c')](_0x2a2b71)['then'](handleEntityNotFound(_0x37df0d,null))[_0x528a('0x29')](respondWithResult(_0x37df0d,null))[_0x528a('0x49')](handleError(_0x37df0d,null));};exports['create']=function(_0x2dd5ea,_0x3eeac5){return db['Variable'][_0x528a('0x4d')](_0x2dd5ea[_0x528a('0x4e')],{})['then'](function(_0x3198ea){var _0x83ceb8=_0x2dd5ea[_0x528a('0x4f')][_0x528a('0x27')]({'plain':!![]});if(!_0x83ceb8)throw new Error(_0x528a('0x50'));if(_0x83ceb8[_0x528a('0x51')]==='user'){var _0x53a7e9=_0x3198ea['get']({'plain':!![]});var _0x230b75=_0x528a('0x52');return db[_0x528a('0x53')]['find']({'where':{'name':_0x230b75,'userProfileId':_0x83ceb8['userProfileId']},'raw':!![]})[_0x528a('0x29')](function(_0x23001f){if(_0x23001f&&_0x23001f[_0x528a('0x54')]===0x0){return db[_0x528a('0x28')][_0x528a('0x4d')]({'name':_0x53a7e9['name'],'resourceId':_0x53a7e9['id'],'type':_0x23001f[_0x528a('0x2c')],'sectionId':_0x23001f['id']},{})[_0x528a('0x29')](function(){return _0x3198ea;});}else{return _0x3198ea;}})[_0x528a('0x49')](function(_0x1174d2){logger[_0x528a('0x2a')](_0x528a('0x55'),_0x1174d2);throw _0x1174d2;});}return _0x3198ea;})[_0x528a('0x29')](respondWithResult(_0x3eeac5,0xc9))[_0x528a('0x49')](handleError(_0x3eeac5,null));};exports['update']=function(_0x4cfe25,_0x3397f1){if(_0x4cfe25[_0x528a('0x4e')]['id']){delete _0x4cfe25['body']['id'];}return db[_0x528a('0x30')][_0x528a('0x4c')]({'where':{'id':_0x4cfe25[_0x528a('0x56')]['id']}})[_0x528a('0x29')](handleEntityNotFound(_0x3397f1,null))[_0x528a('0x29')](saveUpdates(_0x4cfe25[_0x528a('0x4e')],null))['then'](respondWithResult(_0x3397f1,null))[_0x528a('0x49')](handleError(_0x3397f1,null));};exports['destroy']=function(_0x39bdf0,_0x13a994){return db[_0x528a('0x30')]['find']({'where':{'id':_0x39bdf0[_0x528a('0x56')]['id']}})[_0x528a('0x29')](handleEntityNotFound(_0x13a994,null))['then'](removeEntity(_0x13a994,null))[_0x528a('0x49')](handleError(_0x13a994,null));}; \ No newline at end of file +var _0xc372=['fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','show','fields','include','create','body','user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','reject','save','then','destroy','get','Variables','UserProfileResource','sendStatus','error','stack','name','send','index','map','Variable','rawAttributes'];(function(_0x2992ef,_0x2d8d01){var _0x440f83=function(_0x1f63a7){while(--_0x1f63a7){_0x2992ef['push'](_0x2992ef['shift']());}};_0x440f83(++_0x2d8d01);}(_0xc372,0x114));var _0x2c37=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc372[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x2c37('0x0'));var rimraf=require(_0x2c37('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c37('0x2'));var rp=require(_0x2c37('0x3'));var moment=require(_0x2c37('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2c37('0x5'));var util=require(_0x2c37('0x6'));var path=require(_0x2c37('0x7'));var sox=require(_0x2c37('0x8'));var csv=require(_0x2c37('0x9'));var ejs=require(_0x2c37('0xa'));var fs=require('fs');var fs_extra=require(_0x2c37('0xb'));var _=require(_0x2c37('0xc'));var squel=require(_0x2c37('0xd'));var crypto=require(_0x2c37('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2c37('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2c37('0x10'));var Papa=require(_0x2c37('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2c37('0x12'));var as=require(_0x2c37('0x13'));var hardwareService=require(_0x2c37('0x14'));var logger=require(_0x2c37('0x15'))('api');var utils=require(_0x2c37('0x16'));var config=require(_0x2c37('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c37('0x18'))['db'];function respondWithStatusCode(_0x2b2c0e,_0x30f7b0){_0x30f7b0=_0x30f7b0||0xcc;return function(_0x446651){if(_0x446651){return _0x2b2c0e['sendStatus'](_0x30f7b0);}return _0x2b2c0e[_0x2c37('0x19')](_0x30f7b0)[_0x2c37('0x1a')]();};}function respondWithResult(_0x1d0a6a,_0x21006a){_0x21006a=_0x21006a||0xc8;return function(_0xfa502b){if(_0xfa502b){return _0x1d0a6a[_0x2c37('0x19')](_0x21006a)[_0x2c37('0x1b')](_0xfa502b);}};}function respondWithFilteredResult(_0x5929ad,_0x13c333){return function(_0x3210f3){if(_0x3210f3){var _0x1fe151=typeof _0x13c333['offset']===_0x2c37('0x1c')&&typeof _0x13c333[_0x2c37('0x1d')]===_0x2c37('0x1c');var _0x162ceb=_0x3210f3['count'];var _0xcc8806=_0x1fe151?0x0:_0x13c333['offset'];var _0x4ca5d8=_0x1fe151?_0x3210f3[_0x2c37('0x1e')]:_0x13c333[_0x2c37('0x1f')]+_0x13c333[_0x2c37('0x1d')];var _0x47308f;if(_0x4ca5d8>=_0x162ceb){_0x4ca5d8=_0x162ceb;_0x47308f=0xc8;}else{_0x47308f=0xce;}_0x5929ad[_0x2c37('0x19')](_0x47308f);return _0x5929ad['set']('Content-Range',_0xcc8806+'-'+_0x4ca5d8+'/'+_0x162ceb)['json'](_0x3210f3);}return null;};}function patchUpdates(_0x3d4d6b){return function(_0xa889b9){try{jsonpatch['apply'](_0xa889b9,_0x3d4d6b,!![]);}catch(_0x535a72){return BPromise[_0x2c37('0x20')](_0x535a72);}return _0xa889b9[_0x2c37('0x21')]();};}function saveUpdates(_0xb9ba2e,_0x1dc279){return function(_0x32c616){if(_0x32c616){return _0x32c616['update'](_0xb9ba2e)[_0x2c37('0x22')](function(_0x17e596){return _0x17e596;});}return null;};}function removeEntity(_0x5b1211,_0x22de68){return function(_0x59d4d5){if(_0x59d4d5){return _0x59d4d5[_0x2c37('0x23')]()[_0x2c37('0x22')](function(){var _0x3f032f=_0x59d4d5[_0x2c37('0x24')]({'plain':!![]});var _0x28d639=_0x2c37('0x25');return db[_0x2c37('0x26')]['destroy']({'where':{'type':_0x28d639,'resourceId':_0x3f032f['id']}})[_0x2c37('0x22')](function(){return _0x59d4d5;});})['then'](function(){_0x5b1211['status'](0xcc)[_0x2c37('0x1a')]();});}};}function handleEntityNotFound(_0x58208c,_0x1c0012){return function(_0x3602a4){if(!_0x3602a4){_0x58208c[_0x2c37('0x27')](0x194);}return _0x3602a4;};}function handleError(_0x472d6a,_0x46bda7){_0x46bda7=_0x46bda7||0x1f4;return function(_0x2d0ce0){logger[_0x2c37('0x28')](_0x2d0ce0[_0x2c37('0x29')]);if(_0x2d0ce0[_0x2c37('0x2a')]){delete _0x2d0ce0[_0x2c37('0x2a')];}_0x472d6a[_0x2c37('0x19')](_0x46bda7)[_0x2c37('0x2b')](_0x2d0ce0);};}exports[_0x2c37('0x2c')]=function(_0x38d258,_0x16da64){var _0x31d56c={},_0x13d9f4={},_0x4e8f85={'count':0x0,'rows':[]};var _0x42a0d3=_[_0x2c37('0x2d')](db[_0x2c37('0x2e')][_0x2c37('0x2f')],function(_0x132254){return{'name':_0x132254[_0x2c37('0x30')],'type':_0x132254['type']['key']};});_0x13d9f4[_0x2c37('0x31')]=_['map'](_0x42a0d3,_0x2c37('0x2a'));_0x13d9f4[_0x2c37('0x32')]=_[_0x2c37('0x33')](_0x38d258['query']);_0x13d9f4[_0x2c37('0x34')]=_[_0x2c37('0x35')](_0x13d9f4['model'],_0x13d9f4['query']);_0x31d56c['attributes']=_[_0x2c37('0x35')](_0x13d9f4[_0x2c37('0x31')],qs['fields'](_0x38d258['query']['fields']));_0x31d56c[_0x2c37('0x36')]=_0x31d56c[_0x2c37('0x36')][_0x2c37('0x37')]?_0x31d56c['attributes']:_0x13d9f4[_0x2c37('0x31')];if(!_0x38d258['query'][_0x2c37('0x38')](_0x2c37('0x39'))){_0x31d56c[_0x2c37('0x1d')]=qs[_0x2c37('0x1d')](_0x38d258[_0x2c37('0x32')][_0x2c37('0x1d')]);_0x31d56c['offset']=qs[_0x2c37('0x1f')](_0x38d258['query'][_0x2c37('0x1f')]);}_0x31d56c[_0x2c37('0x3a')]=qs['sort'](_0x38d258[_0x2c37('0x32')]['sort']);_0x31d56c[_0x2c37('0x3b')]=qs['filters'](_[_0x2c37('0x3c')](_0x38d258['query'],_0x13d9f4[_0x2c37('0x34')]),_0x42a0d3);if(_0x38d258[_0x2c37('0x32')][_0x2c37('0x3d')]){_0x31d56c[_0x2c37('0x3b')]=_[_0x2c37('0x3e')](_0x31d56c[_0x2c37('0x3b')],{'$or':_['map'](_0x42a0d3,function(_0x55af4d){if(_0x55af4d[_0x2c37('0x3f')]!=='VIRTUAL'){var _0x3a1571={};_0x3a1571[_0x55af4d[_0x2c37('0x2a')]]={'$like':'%'+_0x38d258[_0x2c37('0x32')][_0x2c37('0x3d')]+'%'};return _0x3a1571;}})});}_0x31d56c=_[_0x2c37('0x3e')]({},_0x31d56c,_0x38d258[_0x2c37('0x40')]);var _0xe42102={'where':_0x31d56c[_0x2c37('0x3b')]};return db[_0x2c37('0x2e')][_0x2c37('0x1e')](_0xe42102)[_0x2c37('0x22')](function(_0x712f03){_0x4e8f85[_0x2c37('0x1e')]=_0x712f03;if(_0x38d258['query'][_0x2c37('0x41')]){_0x31d56c['include']=[{'all':!![]}];}return db[_0x2c37('0x2e')][_0x2c37('0x42')](_0x31d56c);})[_0x2c37('0x22')](function(_0x4b8f8c){_0x4e8f85[_0x2c37('0x43')]=_0x4b8f8c;return _0x4e8f85;})[_0x2c37('0x22')](respondWithFilteredResult(_0x16da64,_0x31d56c))[_0x2c37('0x44')](handleError(_0x16da64,null));};exports[_0x2c37('0x45')]=function(_0x400410,_0x5c604d){var _0x217314={'raw':!![],'where':{'id':_0x400410['params']['id']}},_0xcf9a53={};_0xcf9a53['model']=_[_0x2c37('0x33')](db[_0x2c37('0x2e')][_0x2c37('0x2f')]);_0xcf9a53[_0x2c37('0x32')]=_[_0x2c37('0x33')](_0x400410[_0x2c37('0x32')]);_0xcf9a53['filters']=_[_0x2c37('0x35')](_0xcf9a53[_0x2c37('0x31')],_0xcf9a53['query']);_0x217314['attributes']=_['intersection'](_0xcf9a53[_0x2c37('0x31')],qs[_0x2c37('0x46')](_0x400410[_0x2c37('0x32')][_0x2c37('0x46')]));_0x217314[_0x2c37('0x36')]=_0x217314[_0x2c37('0x36')][_0x2c37('0x37')]?_0x217314[_0x2c37('0x36')]:_0xcf9a53[_0x2c37('0x31')];if(_0x400410[_0x2c37('0x32')]['includeAll']){_0x217314[_0x2c37('0x47')]=[{'all':!![]}];}_0x217314=_[_0x2c37('0x3e')]({},_0x217314,_0x400410[_0x2c37('0x40')]);return db['Variable']['find'](_0x217314)[_0x2c37('0x22')](handleEntityNotFound(_0x5c604d,null))['then'](respondWithResult(_0x5c604d,null))[_0x2c37('0x44')](handleError(_0x5c604d,null));};exports['create']=function(_0x3be672,_0x1eba5b){return db[_0x2c37('0x2e')][_0x2c37('0x48')](_0x3be672[_0x2c37('0x49')],{})['then'](function(_0x2f1d63){var _0x13fd4e=_0x3be672[_0x2c37('0x4a')][_0x2c37('0x24')]({'plain':!![]});if(!_0x13fd4e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13fd4e[_0x2c37('0x4b')]===_0x2c37('0x4a')){var _0x53868b=_0x2f1d63[_0x2c37('0x24')]({'plain':!![]});var _0x2361d9=_0x2c37('0x25');return db['UserProfileSection'][_0x2c37('0x4c')]({'where':{'name':_0x2361d9,'userProfileId':_0x13fd4e['userProfileId']},'raw':!![]})[_0x2c37('0x22')](function(_0x5d456b){if(_0x5d456b&&_0x5d456b[_0x2c37('0x4d')]===0x0){return db['UserProfileResource'][_0x2c37('0x48')]({'name':_0x53868b[_0x2c37('0x2a')],'resourceId':_0x53868b['id'],'type':_0x5d456b[_0x2c37('0x2a')],'sectionId':_0x5d456b['id']},{})[_0x2c37('0x22')](function(){return _0x2f1d63;});}else{return _0x2f1d63;}})[_0x2c37('0x44')](function(_0x55f7f1){logger[_0x2c37('0x28')](_0x2c37('0x4e'),_0x55f7f1);throw _0x55f7f1;});}return _0x2f1d63;})[_0x2c37('0x22')](respondWithResult(_0x1eba5b,0xc9))['catch'](handleError(_0x1eba5b,null));};exports[_0x2c37('0x4f')]=function(_0xe870c,_0x195f32){if(_0xe870c[_0x2c37('0x49')]['id']){delete _0xe870c[_0x2c37('0x49')]['id'];}return db['Variable'][_0x2c37('0x4c')]({'where':{'id':_0xe870c[_0x2c37('0x50')]['id']}})['then'](handleEntityNotFound(_0x195f32,null))[_0x2c37('0x22')](saveUpdates(_0xe870c[_0x2c37('0x49')],null))[_0x2c37('0x22')](respondWithResult(_0x195f32,null))['catch'](handleError(_0x195f32,null));};exports[_0x2c37('0x23')]=function(_0x25e63f,_0x4ff90f){return db['Variable'][_0x2c37('0x4c')]({'where':{'id':_0x25e63f[_0x2c37('0x50')]['id']}})[_0x2c37('0x22')](handleEntityNotFound(_0x4ff90f,null))['then'](removeEntity(_0x4ff90f,null))[_0x2c37('0x44')](handleError(_0x4ff90f,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 2be7cf2..6f70962 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 _0x7df1=['lodash','util','../../config/logger','api','moment','request-promise','path','./variable.attributes','exports','define','Variable','tools_variables'];(function(_0x53847f,_0x336b11){var _0x592021=function(_0x4ce05b){while(--_0x4ce05b){_0x53847f['push'](_0x53847f['shift']());}};_0x592021(++_0x336b11);}(_0x7df1,0xb4));var _0x17df=function(_0x4c6bdf,_0x163063){_0x4c6bdf=_0x4c6bdf-0x0;var _0x325986=_0x7df1[_0x4c6bdf];return _0x325986;};'use strict';var _=require(_0x17df('0x0'));var util=require(_0x17df('0x1'));var logger=require(_0x17df('0x2'))(_0x17df('0x3'));var moment=require(_0x17df('0x4'));var BPromise=require('bluebird');var rp=require(_0x17df('0x5'));var fs=require('fs');var path=require(_0x17df('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x17df('0x7'));module[_0x17df('0x8')]=function(_0x288867,_0x316fee){return _0x288867[_0x17df('0x9')](_0x17df('0xa'),attributes,{'tableName':_0x17df('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa9e=['request-promise','../../config/environment','./variable.attributes','define','Variable','tools_variables','lodash','util','moment'];(function(_0x35c921,_0x4b18d7){var _0x160814=function(_0x32fbd9){while(--_0x32fbd9){_0x35c921['push'](_0x35c921['shift']());}};_0x160814(++_0x4b18d7);}(_0xfa9e,0x180));var _0xefa9=function(_0x211f44,_0x5b0f30){_0x211f44=_0x211f44-0x0;var _0x2dfb6d=_0xfa9e[_0x211f44];return _0x2dfb6d;};'use strict';var _=require(_0xefa9('0x0'));var util=require(_0xefa9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xefa9('0x2'));var BPromise=require('bluebird');var rp=require(_0xefa9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xefa9('0x4'));var attributes=require(_0xefa9('0x5'));module['exports']=function(_0x178f49,_0x23e727){return _0x178f49[_0xefa9('0x6')](_0xefa9('0x7'),attributes,{'tableName':_0xefa9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index e8c8117..f358e85 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x195ab3,_0x3a5da5){var _0x479182=function(_0x4feb3e){while(--_0x4feb3e){_0x195ab3['push'](_0x195ab3['shift']());}};_0x479182(++_0x3a5da5);}(_0xabce,0x103));var _0xeabc=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xabce[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file +var _0x4b84=['catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','then','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','Variable,\x20%s,\x20%s','message','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model'];(function(_0xf7d47e,_0x7222c8){var _0x31733c=function(_0x1efa27){while(--_0x1efa27){_0xf7d47e['push'](_0xf7d47e['shift']());}};_0x31733c(++_0x7222c8);}(_0x4b84,0x1cc));var _0x44b8=function(_0x39ea42,_0x3c1f50){_0x39ea42=_0x39ea42-0x0;var _0x33f5b7=_0x4b84[_0x39ea42];return _0x33f5b7;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('Variable,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('Variable,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});}exports[_0x44b8('0x10')]=function(_0x55e258){var _0x36743e=this;return new Promise(function(_0xe3de8f,_0x5103f5){return db[_0x44b8('0x11')][_0x44b8('0x12')]({'raw':_0x55e258['options']?_0x55e258[_0x44b8('0x13')][_0x44b8('0x14')]===undefined?!![]:![]:!![],'where':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x15')]||null:null,'attributes':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x16')]||null:null,'include':_0x55e258[_0x44b8('0x13')]?_0x55e258[_0x44b8('0x13')][_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x55e258['options'][_0x44b8('0x17')],function(_0x3a8aa4){return{'model':db[_0x3a8aa4[_0x44b8('0x19')]],'as':_0x3a8aa4['as'],'attributes':_0x3a8aa4[_0x44b8('0x16')],'include':_0x3a8aa4[_0x44b8('0x17')]?_['map'](_0x3a8aa4[_0x44b8('0x17')],function(_0x54677c){return{'model':db[_0x54677c[_0x44b8('0x19')]],'as':_0x54677c['as'],'attributes':_0x54677c[_0x44b8('0x16')],'include':_0x54677c[_0x44b8('0x17')]?_[_0x44b8('0x18')](_0x54677c[_0x44b8('0x17')],function(_0x59acbc){return{'model':db[_0x59acbc[_0x44b8('0x19')]],'as':_0x59acbc['as'],'attributes':_0x59acbc['attributes']};}):[]};}):[]};}):[]:[]})[_0x44b8('0x7')](function(_0x350482){logger['info'](_0x44b8('0x10'),_0x55e258);logger[_0x44b8('0xa')](_0x44b8('0x10'),_0x55e258,JSON['stringify'](_0x350482));_0xe3de8f(_0x350482);})[_0x44b8('0x1a')](function(_0x242342){logger['error'](_0x44b8('0x10'),_0x242342['message'],_0x55e258);_0x5103f5(_0x36743e[_0x44b8('0xd')](0x1f4,_0x242342['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 43fa464..6823cc8 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 _0x4ac5=['/reset','reset','/pull','pull','/restart','restart','migrations','exports','express','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch'];(function(_0xf7c94b,_0x2accd9){var _0x36844f=function(_0x1a4234){while(--_0x1a4234){_0xf7c94b['push'](_0xf7c94b['shift']());}};_0x36844f(++_0x2accd9);}(_0x4ac5,0x14b));var _0x54ac=function(_0x4239bd,_0x1f310b){_0x4239bd=_0x4239bd-0x0;var _0x21f061=_0x4ac5[_0x4239bd];return _0x21f061;};'use strict';var express=require(_0x54ac('0x0'));var router=express['Router']();var auth=require(_0x54ac('0x1'));var controller=require(_0x54ac('0x2'));router[_0x54ac('0x3')]('/',controller[_0x54ac('0x4')]);router['get'](_0x54ac('0x5'),auth[_0x54ac('0x6')](),auth[_0x54ac('0x7')](),controller[_0x54ac('0x8')]);router[_0x54ac('0x3')](_0x54ac('0x9'),auth[_0x54ac('0x6')](),auth[_0x54ac('0x7')](),controller[_0x54ac('0xa')]);router[_0x54ac('0x3')](_0x54ac('0xb'),auth[_0x54ac('0x6')](),auth[_0x54ac('0x7')](),controller[_0x54ac('0xc')]);router[_0x54ac('0x3')](_0x54ac('0xd'),auth[_0x54ac('0x6')](),controller[_0x54ac('0xe')]);router[_0x54ac('0x3')]('/migrations',controller[_0x54ac('0xf')]);module[_0x54ac('0x10')]=router; \ No newline at end of file +var _0x1d20=['express','Router','../../components/auth/service','./version.controller','get','/fetch','fetch','/reset','isAuthenticated','canUpdate','reset','/pull','pull','/restart','restart','/migrations','migrations','exports'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x1d20,0x1e6));var _0x01d2=function(_0x524b3f,_0x6ecfd2){_0x524b3f=_0x524b3f-0x0;var _0x40184a=_0x1d20[_0x524b3f];return _0x40184a;};'use strict';var express=require(_0x01d2('0x0'));var router=express[_0x01d2('0x1')]();var auth=require(_0x01d2('0x2'));var controller=require(_0x01d2('0x3'));router[_0x01d2('0x4')]('/',controller['index']);router[_0x01d2('0x4')](_0x01d2('0x5'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x01d2('0x6')]);router[_0x01d2('0x4')](_0x01d2('0x7'),auth[_0x01d2('0x8')](),auth[_0x01d2('0x9')](),controller[_0x01d2('0xa')]);router[_0x01d2('0x4')](_0x01d2('0xb'),auth[_0x01d2('0x8')](),auth['canUpdate'](),controller[_0x01d2('0xc')]);router['get'](_0x01d2('0xd'),auth[_0x01d2('0x8')](),controller[_0x01d2('0xe')]);router[_0x01d2('0x4')](_0x01d2('0xf'),controller[_0x01d2('0x10')]);module[_0x01d2('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 b0239d2..bda07b2 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 _0xc463=['git\x20reset\x20--hard','pull','npm\x20install\x20--production','info','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','server','migrations','length','version','push','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.','join','map','\x20to\x20','last','catch','Database\x20already\x20up-to-date','umzug','pkginfo','compare-versions','exec','../../config/pm2','../../config/logger','update','root','index','exports','query','fetch','tags','latest','2.0.0','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xc463,0xdc));var _0x3c46=function(_0xbc550a,_0x2bb605){_0xbc550a=_0xbc550a-0x0;var _0xd16ba4=_0xc463[_0xbc550a];return _0xd16ba4;};'use strict';var Umzug=require(_0x3c46('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x3c46('0x1'))(module,'version');var compareVersions=require(_0x3c46('0x2'));var exec=require('child_process')[_0x3c46('0x3')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0x3c46('0x4'));var logger=require(_0x3c46('0x5'))(_0x3c46('0x6'));var git=require('simple-git')(config[_0x3c46('0x7')]);exports[_0x3c46('0x8')]=function(_0x2591ac,_0x30ac98){var _0x10f0e7={'current':module[_0x3c46('0x9')]['version'],'phonebar':0x2};if(_0x2591ac['query']&&_0x2591ac[_0x3c46('0xa')]['latest']){return git[_0x3c46('0xb')]()[_0x3c46('0xc')](function(_0x25cc81,_0xa5967){_0x10f0e7[_0x3c46('0xd')]=(_0x25cc81?module[_0x3c46('0x9')]['version']:_0xa5967[_0x3c46('0xd')])||_0x3c46('0xe');return _0x30ac98[_0x3c46('0xf')](0xc8)[_0x3c46('0x10')](_0x10f0e7);});}else{return _0x30ac98[_0x3c46('0xf')](0xc8)[_0x3c46('0x10')](_0x10f0e7);}};exports['fetch']=function(_0x3a073d,_0x5850c3){return git['fetch']([_0x3c46('0x11'),_0x3c46('0x12')],function(_0x4681aa){if(_0x4681aa){logger[_0x3c46('0x13')](_0x4681aa);return _0x5850c3[_0x3c46('0xf')](0x1f4)[_0x3c46('0x10')](_0x4681aa);}logger['info'](_0x3c46('0x14'));return _0x5850c3[_0x3c46('0xf')](0xc8)[_0x3c46('0x10')]({'output':_0x3c46('0x15')});});};exports['reset']=function(_0x123ac9,_0x316823){return git[_0x3c46('0x16')]([_0x3c46('0x17'),'FETCH_HEAD'],function(_0x16fc81){if(_0x16fc81){logger[_0x3c46('0x13')](_0x16fc81);return _0x316823[_0x3c46('0xf')](0x1f4)[_0x3c46('0x10')](_0x16fc81);}logger['info'](_0x3c46('0x18'));return _0x316823[_0x3c46('0xf')](0xc8)[_0x3c46('0x10')]({'output':_0x3c46('0x19')});});};exports[_0x3c46('0x1a')]=function(_0x15c9d2,_0x59f31b){exec(_0x3c46('0x1b'),function(_0x39182d,_0x1133c8,_0x421139){logger[_0x3c46('0x1c')](_0x1133c8);logger[_0x3c46('0x1c')](_0x421139);if(_0x39182d){logger[_0x3c46('0x13')](_0x39182d);return _0x59f31b[_0x3c46('0xf')](0x1f4)[_0x3c46('0x10')](_0x39182d);}return _0x59f31b[_0x3c46('0xf')](0xc8)['json']({'output':_0x1133c8});});};exports[_0x3c46('0x1d')]=function(_0x63ae88,_0x266e12){return pm2[_0x3c46('0x1d')](_0x3c46('0x1e'))[_0x3c46('0x1f')](function(_0x2cd00d){logger['info']('pm2\x20restart\x20motion\x20%s',_0x2cd00d);return _0x266e12[_0x3c46('0xf')](0xc8)[_0x3c46('0x10')]({'output':_0x3c46('0x20')});})['catch'](function(_0x1d2ef5){logger[_0x3c46('0x13')](_0x1d2ef5);return _0x266e12[_0x3c46('0xf')](0x1f4)['json'](_0x1d2ef5);});};exports['migrations']=function(_0x36955b,_0x19722a){var _0x3a9917=fs['readdirSync'](path['join'](config[_0x3c46('0x7')],_0x3c46('0x21'),_0x3c46('0x22')));var _0x4b3931=[];for(var _0x5e46c5=0x0;_0x5e46c5<_0x3a9917[_0x3c46('0x23')];_0x5e46c5++){var _0x350a65=_0x3a9917[_0x5e46c5]['replace']('.js','');if(compareVersions(module[_0x3c46('0x9')][_0x3c46('0x24')],_0x350a65)===-0x1){_0x4b3931[_0x3c46('0x25')](_0x350a65);}}if(_0x4b3931['length']){var _0x48face=_0x4b3931['sort'](compareVersions);var _0x214dd2=new Umzug({'storage':_0x3c46('0x26'),'storageOptions':{'model':db[_0x3c46('0x27')],'modelName':'Migration','columnName':_0x3c46('0x24')},'migrations':{'params':[db[_0x3c46('0x26')][_0x3c46('0x28')](),db[_0x3c46('0x26')][_0x3c46('0x29')],function(){throw new Error(_0x3c46('0x2a'));}],'path':path[_0x3c46('0x2b')](config[_0x3c46('0x7')],_0x3c46('0x21'),_0x3c46('0x22')),'pattern':/\.js$/}});_0x214dd2['up']({'migrations':_[_0x3c46('0x2c')](_0x48face,function(_0x2d50dc){return _0x2d50dc+'.js';})})['then'](function(){return _0x19722a[_0x3c46('0xf')](0xc8)[_0x3c46('0x10')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports']['version']+_0x3c46('0x2d')+_[_0x3c46('0x2e')](_0x48face),'migrations':_[_0x3c46('0x2b')](_0x48face)});})[_0x3c46('0x2f')](function(_0x471308){if(_0x471308 instanceof db['sequelize']['UniqueConstraintError']){return _0x19722a[_0x3c46('0xf')](0xc8)[_0x3c46('0x10')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x19722a[_0x3c46('0xf')](0x1f4)[_0x3c46('0x10')](_0x471308);}});}else{return _0x19722a[_0x3c46('0xf')](0xc8)[_0x3c46('0x10')]({'output':_0x3c46('0x30')});}}; \ No newline at end of file +var _0xdf40=['compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','root','index','exports','query','latest','fetch','2.0.0','status','json','origin','master','info','git\x20fetch','reset','--hard','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','.js','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','pkginfo','version'];(function(_0x2e2e13,_0x36b176){var _0x5480d3=function(_0x57c0c4){while(--_0x57c0c4){_0x2e2e13['push'](_0x2e2e13['shift']());}};_0x5480d3(++_0x36b176);}(_0xdf40,0xc5));var _0x0df4=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xdf40[_0x46e363];return _0x3fb059;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x0df4('0x0'));var pkginfo=require(_0x0df4('0x1'))(module,_0x0df4('0x2'));var compareVersions=require(_0x0df4('0x3'));var exec=require(_0x0df4('0x4'))[_0x0df4('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x0df4('0x6'));var pm2=require(_0x0df4('0x7'));var logger=require(_0x0df4('0x8'))('update');var git=require('simple-git')(config[_0x0df4('0x9')]);exports[_0x0df4('0xa')]=function(_0x173a46,_0x209064){var _0x285e95={'current':module[_0x0df4('0xb')][_0x0df4('0x2')],'phonebar':0x2};if(_0x173a46['query']&&_0x173a46[_0x0df4('0xc')][_0x0df4('0xd')]){return git[_0x0df4('0xe')]()['tags'](function(_0x223158,_0x3c247b){_0x285e95[_0x0df4('0xd')]=(_0x223158?module[_0x0df4('0xb')][_0x0df4('0x2')]:_0x3c247b[_0x0df4('0xd')])||_0x0df4('0xf');return _0x209064[_0x0df4('0x10')](0xc8)[_0x0df4('0x11')](_0x285e95);});}else{return _0x209064['status'](0xc8)[_0x0df4('0x11')](_0x285e95);}};exports[_0x0df4('0xe')]=function(_0x19c0af,_0x3be8e0){return git[_0x0df4('0xe')]([_0x0df4('0x12'),_0x0df4('0x13')],function(_0x49c7a3){if(_0x49c7a3){logger['error'](_0x49c7a3);return _0x3be8e0[_0x0df4('0x10')](0x1f4)[_0x0df4('0x11')](_0x49c7a3);}logger[_0x0df4('0x14')](_0x0df4('0x15'));return _0x3be8e0[_0x0df4('0x10')](0xc8)[_0x0df4('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x0df4('0x16')]=function(_0x1b8d48,_0x37ab26){return git['reset']([_0x0df4('0x17'),'FETCH_HEAD'],function(_0x480fc4){if(_0x480fc4){logger[_0x0df4('0x18')](_0x480fc4);return _0x37ab26[_0x0df4('0x10')](0x1f4)[_0x0df4('0x11')](_0x480fc4);}logger[_0x0df4('0x14')](_0x0df4('0x19'));return _0x37ab26[_0x0df4('0x10')](0xc8)[_0x0df4('0x11')]({'output':_0x0df4('0x1a')});});};exports[_0x0df4('0x1b')]=function(_0x185527,_0x50240f){exec('npm\x20install\x20--production',function(_0x53350b,_0x144de0,_0x3d862b){logger[_0x0df4('0x14')](_0x144de0);logger[_0x0df4('0x14')](_0x3d862b);if(_0x53350b){logger['error'](_0x53350b);return _0x50240f[_0x0df4('0x10')](0x1f4)[_0x0df4('0x11')](_0x53350b);}return _0x50240f[_0x0df4('0x10')](0xc8)[_0x0df4('0x11')]({'output':_0x144de0});});};exports[_0x0df4('0x1c')]=function(_0x44719d,_0x3b27a2){return pm2[_0x0df4('0x1c')](_0x0df4('0x1d'))[_0x0df4('0x1e')](function(_0x317de1){logger[_0x0df4('0x14')](_0x0df4('0x1f'),_0x317de1);return _0x3b27a2[_0x0df4('0x10')](0xc8)[_0x0df4('0x11')]({'output':_0x0df4('0x20')});})[_0x0df4('0x21')](function(_0x18e06c){logger[_0x0df4('0x18')](_0x18e06c);return _0x3b27a2['status'](0x1f4)['json'](_0x18e06c);});};exports[_0x0df4('0x22')]=function(_0x4a0fba,_0x560187){var _0x5920b0=fs[_0x0df4('0x23')](path[_0x0df4('0x24')](config['root'],_0x0df4('0x25'),_0x0df4('0x22')));var _0x56d148=[];for(var _0x4c7e3e=0x0;_0x4c7e3e<_0x5920b0[_0x0df4('0x26')];_0x4c7e3e++){var _0x43e7b1=_0x5920b0[_0x4c7e3e][_0x0df4('0x27')](_0x0df4('0x28'),'');if(compareVersions(module[_0x0df4('0xb')][_0x0df4('0x2')],_0x43e7b1)===-0x1){_0x56d148['push'](_0x43e7b1);}}if(_0x56d148[_0x0df4('0x26')]){var _0x39a008=_0x56d148['sort'](compareVersions);var _0x288afe=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x0df4('0x29')],'modelName':_0x0df4('0x29'),'columnName':_0x0df4('0x2')},'migrations':{'params':[db[_0x0df4('0x2a')][_0x0df4('0x2b')](),db[_0x0df4('0x2a')][_0x0df4('0x2c')],function(){throw new Error(_0x0df4('0x2d'));}],'path':path['join'](config[_0x0df4('0x9')],_0x0df4('0x25'),'migrations'),'pattern':/\.js$/}});_0x288afe['up']({'migrations':_['map'](_0x39a008,function(_0x99462){return _0x99462+_0x0df4('0x28');})})[_0x0df4('0x1e')](function(){return _0x560187[_0x0df4('0x10')](0xc8)['json']({'output':_0x0df4('0x2e')+module[_0x0df4('0xb')][_0x0df4('0x2')]+_0x0df4('0x2f')+_['last'](_0x39a008),'migrations':_[_0x0df4('0x24')](_0x39a008)});})[_0x0df4('0x21')](function(_0x19140e){if(_0x19140e instanceof db['sequelize'][_0x0df4('0x30')]){return _0x560187[_0x0df4('0x10')](0xc8)['json']({'output':_0x0df4('0x31')});}else{return _0x560187[_0x0df4('0x10')](0x1f4)[_0x0df4('0x11')](_0x19140e);}});}else{return _0x560187[_0x0df4('0x10')](0xc8)['json']({'output':_0x0df4('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index de7a2ea..2562ffb 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 _0x7231=['post','create','put','/:id','update','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe'];(function(_0x460765,_0x30f733){var _0x22ee7e=function(_0x427d18){while(--_0x427d18){_0x460765['push'](_0x460765['shift']());}};_0x22ee7e(++_0x30f733);}(_0x7231,0xd2));var _0x1723=function(_0x378613,_0x706596){_0x378613=_0x378613-0x0;var _0x13b333=_0x7231[_0x378613];return _0x13b333;};'use strict';var multer=require('multer');var util=require(_0x1723('0x0'));var path=require(_0x1723('0x1'));var timeout=require(_0x1723('0x2'));var express=require(_0x1723('0x3'));var router=express['Router']();var fs_extra=require(_0x1723('0x4'));var auth=require(_0x1723('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x1723('0x6')]('/',auth[_0x1723('0x7')](),controller[_0x1723('0x8')]);router[_0x1723('0x6')](_0x1723('0x9'),auth[_0x1723('0x7')](),controller[_0x1723('0xa')]);router[_0x1723('0x6')]('/:id',auth[_0x1723('0x7')](),controller['show']);router[_0x1723('0xb')]('/',auth[_0x1723('0x7')](),controller[_0x1723('0xc')]);router[_0x1723('0xd')](_0x1723('0xe'),auth['isAuthenticated'](),controller[_0x1723('0xf')]);router['delete'](_0x1723('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x1723('0x10')]=router; \ No newline at end of file +var _0xc1aa=['./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xc1aa,0xe9));var _0xac1a=function(_0x503563,_0x4b1c57){_0x503563=_0x503563-0x0;var _0x4fffac=_0xc1aa[_0x503563];return _0x4fffac;};'use strict';var multer=require(_0xac1a('0x0'));var util=require(_0xac1a('0x1'));var path=require(_0xac1a('0x2'));var timeout=require(_0xac1a('0x3'));var express=require(_0xac1a('0x4'));var router=express['Router']();var fs_extra=require(_0xac1a('0x5'));var auth=require(_0xac1a('0x6'));var interaction=require(_0xac1a('0x7'));var config=require(_0xac1a('0x8'));var controller=require(_0xac1a('0x9'));router[_0xac1a('0xa')]('/',auth[_0xac1a('0xb')](),controller[_0xac1a('0xc')]);router[_0xac1a('0xa')](_0xac1a('0xd'),auth['isAuthenticated'](),controller[_0xac1a('0xe')]);router[_0xac1a('0xa')]('/:id',auth[_0xac1a('0xb')](),controller[_0xac1a('0xf')]);router['post']('/',auth[_0xac1a('0xb')](),controller['create']);router[_0xac1a('0x10')](_0xac1a('0x11'),auth[_0xac1a('0xb')](),controller[_0xac1a('0x12')]);router[_0xac1a('0x13')]('/:id',auth[_0xac1a('0xb')](),controller[_0xac1a('0x14')]);module[_0xac1a('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index b76295b..9672186 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 _0x56bd=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports'];(function(_0x50388b,_0x276225){var _0x6037b=function(_0x584277){while(--_0x584277){_0x50388b['push'](_0x50388b['shift']());}};_0x6037b(++_0x276225);}(_0x56bd,0xe9));var _0xd56b=function(_0x25e8d9,_0x338272){_0x25e8d9=_0x25e8d9-0x0;var _0x5d32ae=_0x56bd[_0x25e8d9];return _0x5d32ae;};'use strict';var Sequelize=require('sequelize');module[_0xd56b('0x0')]={'type':{'type':Sequelize[_0xd56b('0x1')]},'uniqueid':{'type':Sequelize[_0xd56b('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd56b('0x1')]},'queue':{'type':Sequelize[_0xd56b('0x1')]},'interface':{'type':Sequelize[_0xd56b('0x1')]},'membername':{'type':Sequelize[_0xd56b('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xd56b('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xd56b('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xd56b('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd56b('0x2')]},'holdtime':{'type':Sequelize[_0xd56b('0x3')]},'agentcomplete':{'type':Sequelize[_0xd56b('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd56b('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd56b('0x3')]},'agentacw':{'type':Sequelize[_0xd56b('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd56b('0x3')]},'reason':{'type':Sequelize[_0xd56b('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xd56b('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd56b('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd56b('0x1')]},'language':{'type':Sequelize[_0xd56b('0x1')]},'accountcode':{'type':Sequelize[_0xd56b('0x1')]},'context':{'type':Sequelize[_0xd56b('0x1')]},'exten':{'type':Sequelize[_0xd56b('0x1')]},'priority':{'type':Sequelize[_0xd56b('0x1')]},'destchannel':{'type':Sequelize[_0xd56b('0x1')]},'destchannelstate':{'type':Sequelize[_0xd56b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xd56b('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd56b('0x1')]},'destcalleridname':{'type':Sequelize[_0xd56b('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd56b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd56b('0x1')]},'destlanguage':{'type':Sequelize[_0xd56b('0x1')]},'destaccountcode':{'type':Sequelize[_0xd56b('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xd56b('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xd56b('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd56b('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xd56b('0x1')]},'transfer':{'type':Sequelize[_0xd56b('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd56b('0x1')],'comment':_0xd56b('0x5')},'transferexten':{'type':Sequelize[_0xd56b('0x1')]},'transferuniqueid':{'type':Sequelize[_0xd56b('0x1')]},'agententerreason':{'type':Sequelize[_0xd56b('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf7d9=['BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x2789ea,_0xa34d25){var _0x3a88ce=function(_0x399e85){while(--_0x399e85){_0x2789ea['push'](_0x2789ea['shift']());}};_0x3a88ce(++_0xa34d25);}(_0xf7d9,0x122));var _0x9f7d=function(_0x31210e,_0x5ae645){_0x31210e=_0x31210e-0x0;var _0x365e5b=_0xf7d9[_0x31210e];return _0x365e5b;};'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 056cab7..41e1070 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(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 37f8ce4..71a7aa9 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 _0x02a7=['define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x288756,_0x234cd6){var _0x25498b=function(_0x31d037){while(--_0x31d037){_0x288756['push'](_0x288756['shift']());}};_0x25498b(++_0x234cd6);}(_0x02a7,0x7a));var _0x702a=function(_0x46da9f,_0x423399){_0x46da9f=_0x46da9f-0x0;var _0x298f58=_0x02a7[_0x46da9f];return _0x298f58;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x702a('0x1'));var BPromise=require(_0x702a('0x2'));var rp=require(_0x702a('0x3'));var fs=require('fs');var path=require(_0x702a('0x4'));var rimraf=require(_0x702a('0x5'));var config=require(_0x702a('0x6'));var attributes=require(_0x702a('0x7'));module['exports']=function(_0x1bcfe5,_0x5b7d8c){return _0x1bcfe5[_0x702a('0x8')](_0x702a('0x9'),attributes,{'tableName':_0x702a('0xa'),'paranoid':![],'indexes':[{'fields':[_0x702a('0xb'),_0x702a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6dac=['rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x121e52,_0x48e0d2){var _0x5b6f18=function(_0xd97ba0){while(--_0xd97ba0){_0x121e52['push'](_0x121e52['shift']());}};_0x5b6f18(++_0x48e0d2);}(_0x6dac,0x16e));var _0xc6da=function(_0x5a5e7c,_0x218a51){_0x5a5e7c=_0x5a5e7c-0x0;var _0x3a9b12=_0x6dac[_0x5a5e7c];return _0x3a9b12;};'use strict';var _=require(_0xc6da('0x0'));var util=require(_0xc6da('0x1'));var logger=require(_0xc6da('0x2'))(_0xc6da('0x3'));var moment=require(_0xc6da('0x4'));var BPromise=require(_0xc6da('0x5'));var rp=require(_0xc6da('0x6'));var fs=require('fs');var path=require(_0xc6da('0x7'));var rimraf=require(_0xc6da('0x8'));var config=require(_0xc6da('0x9'));var attributes=require(_0xc6da('0xa'));module[_0xc6da('0xb')]=function(_0x325f49,_0x5caf49){return _0x325f49[_0xc6da('0xc')](_0xc6da('0xd'),attributes,{'tableName':_0xc6da('0xe'),'paranoid':![],'indexes':[{'fields':[_0xc6da('0xf'),_0xc6da('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 1b78af0..0c7acb4 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 _0x4312=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','VoiceAgentReport,\x20%s,\x20%s','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','stringify','UpdateVoiceAgentReport','where','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x4312,0x122));var _0x2431=function(_0x1e1fe9,_0x216dd9){_0x1e1fe9=_0x1e1fe9-0x0;var _0x4eeb06=_0x4312[_0x1e1fe9];return _0x4eeb06;};'use strict';var _=require('lodash');var util=require(_0x2431('0x0'));var moment=require(_0x2431('0x1'));var BPromise=require(_0x2431('0x2'));var rs=require(_0x2431('0x3'));var fs=require('fs');var Redis=require(_0x2431('0x4'));var db=require(_0x2431('0x5'))['db'];var utils=require(_0x2431('0x6'));var logger=require(_0x2431('0x7'))('rpc');var config=require(_0x2431('0x8'));var jayson=require(_0x2431('0x9'));var client=jayson[_0x2431('0xa')][_0x2431('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa1522e,_0x510c2c,_0x20cfec){return new BPromise(function(_0x1bc5b9,_0x26b8cf){return client[_0x2431('0xc')](_0xa1522e,_0x20cfec)[_0x2431('0xd')](function(_0x55fe2d){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x510c2c,_0x2431('0xe'));logger[_0x2431('0xf')](_0x2431('0x10'),_0x510c2c,_0x2431('0xe'),JSON['stringify'](_0x55fe2d));if(_0x55fe2d[_0x2431('0x11')]){if(_0x55fe2d[_0x2431('0x11')][_0x2431('0x12')]===0x1f4){logger['error'](_0x2431('0x13'),_0x510c2c,_0x55fe2d[_0x2431('0x11')]['message']);return _0x26b8cf(_0x55fe2d[_0x2431('0x11')][_0x2431('0x14')]);}logger[_0x2431('0x11')](_0x2431('0x13'),_0x510c2c,_0x55fe2d[_0x2431('0x11')]['message']);return _0x1bc5b9(_0x55fe2d[_0x2431('0x11')][_0x2431('0x14')]);}else{logger[_0x2431('0x15')](_0x2431('0x13'),_0x510c2c,_0x2431('0xe'));_0x1bc5b9(_0x55fe2d[_0x2431('0x16')][_0x2431('0x14')]);}})[_0x2431('0x17')](function(_0x2e310a){logger['error'](_0x2431('0x13'),_0x510c2c,_0x2e310a);_0x26b8cf(_0x2e310a);});});}exports[_0x2431('0x18')]=function(_0x20a0bd){var _0x122a16=this;return new Promise(function(_0xda35e3,_0x323783){return db[_0x2431('0x19')][_0x2431('0x1a')](_0x20a0bd['body'],{'raw':_0x20a0bd[_0x2431('0x1b')]?_0x20a0bd[_0x2431('0x1b')][_0x2431('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5bc16c){logger[_0x2431('0x15')](_0x2431('0x18'),_0x20a0bd);logger[_0x2431('0xf')](_0x2431('0x18'),_0x20a0bd,JSON[_0x2431('0x1d')](_0x5bc16c));_0xda35e3(_0x5bc16c);})[_0x2431('0x17')](function(_0x495abf){logger['error'](_0x2431('0x18'),_0x495abf[_0x2431('0x14')],_0x20a0bd);_0x323783(_0x122a16[_0x2431('0x11')](0x1f4,_0x495abf[_0x2431('0x14')]));});});};exports[_0x2431('0x1e')]=function(_0x50d8a0){var _0x42351a=this;return new Promise(function(_0x202a27,_0x4af66d){return db[_0x2431('0x19')]['update'](_0x50d8a0['body'],{'raw':_0x50d8a0['options']?_0x50d8a0[_0x2431('0x1b')][_0x2431('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50d8a0['options']?_0x50d8a0[_0x2431('0x1b')][_0x2431('0x1f')]||null:null,'attributes':_0x50d8a0['options']?_0x50d8a0[_0x2431('0x1b')]['attributes']||null:null,'limit':_0x50d8a0['options']?_0x50d8a0[_0x2431('0x1b')][_0x2431('0x20')]||null:null})['then'](function(_0x340283){logger[_0x2431('0x15')](_0x2431('0x1e'),_0x50d8a0);logger['debug'](_0x2431('0x1e'),_0x50d8a0,JSON[_0x2431('0x1d')](_0x340283));_0x202a27(_0x340283);})[_0x2431('0x17')](function(_0x1377a6){logger['error'](_0x2431('0x1e'),_0x1377a6['message'],_0x50d8a0);_0x4af66d(_0x42351a[_0x2431('0x11')](0x1f4,_0x1377a6[_0x2431('0x14')]));});});}; \ No newline at end of file +var _0xc63e=['create','body','options','CreateVoiceAgentReport','debug','update','raw','where','attributes','limit','UpdateVoiceAgentReport','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceAgentReport,\x20%s,\x20%s','info','result','catch','VoiceAgentReport'];(function(_0x2c288f,_0x4359d7){var _0x56bc18=function(_0x4b27a3){while(--_0x4b27a3){_0x2c288f['push'](_0x2c288f['shift']());}};_0x56bc18(++_0x4359d7);}(_0xc63e,0xab));var _0xec63=function(_0x13606d,_0x30f265){_0x13606d=_0x13606d-0x0;var _0x1b85b0=_0xc63e[_0x13606d];return _0x1b85b0;};'use strict';var _=require(_0xec63('0x0'));var util=require('util');var moment=require(_0xec63('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec63('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xec63('0x3'));var logger=require(_0xec63('0x4'))(_0xec63('0x5'));var config=require(_0xec63('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xec63('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cc3ae,_0x18c125,_0x44615a){return new BPromise(function(_0x30d059,_0x893b26){return client[_0xec63('0x8')](_0x4cc3ae,_0x44615a)[_0xec63('0x9')](function(_0x1c2bed){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x18c125,_0xec63('0xa'));logger['debug'](_0xec63('0xb'),_0x18c125,_0xec63('0xa'),JSON[_0xec63('0xc')](_0x1c2bed));if(_0x1c2bed[_0xec63('0xd')]){if(_0x1c2bed[_0xec63('0xd')][_0xec63('0xe')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x18c125,_0x1c2bed[_0xec63('0xd')][_0xec63('0xf')]);return _0x893b26(_0x1c2bed['error']['message']);}logger['error'](_0xec63('0x10'),_0x18c125,_0x1c2bed[_0xec63('0xd')][_0xec63('0xf')]);return _0x30d059(_0x1c2bed[_0xec63('0xd')][_0xec63('0xf')]);}else{logger[_0xec63('0x11')](_0xec63('0x10'),_0x18c125,_0xec63('0xa'));_0x30d059(_0x1c2bed[_0xec63('0x12')][_0xec63('0xf')]);}})[_0xec63('0x13')](function(_0x56e6f6){logger['error'](_0xec63('0x10'),_0x18c125,_0x56e6f6);_0x893b26(_0x56e6f6);});});}exports['CreateVoiceAgentReport']=function(_0x19a41b){var _0x49ff9d=this;return new Promise(function(_0x2958b0,_0x38d48f){return db[_0xec63('0x14')][_0xec63('0x15')](_0x19a41b[_0xec63('0x16')],{'raw':_0x19a41b['options']?_0x19a41b[_0xec63('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xec63('0x9')](function(_0x25dba8){logger[_0xec63('0x11')](_0xec63('0x18'),_0x19a41b);logger[_0xec63('0x19')](_0xec63('0x18'),_0x19a41b,JSON['stringify'](_0x25dba8));_0x2958b0(_0x25dba8);})[_0xec63('0x13')](function(_0xf6cda1){logger[_0xec63('0xd')](_0xec63('0x18'),_0xf6cda1[_0xec63('0xf')],_0x19a41b);_0x38d48f(_0x49ff9d[_0xec63('0xd')](0x1f4,_0xf6cda1[_0xec63('0xf')]));});});};exports['UpdateVoiceAgentReport']=function(_0x227122){var _0x1bd810=this;return new Promise(function(_0x53b96f,_0x3ba79d){return db[_0xec63('0x14')][_0xec63('0x1a')](_0x227122[_0xec63('0x16')],{'raw':_0x227122['options']?_0x227122['options'][_0xec63('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x227122['options']?_0x227122[_0xec63('0x17')][_0xec63('0x1c')]||null:null,'attributes':_0x227122[_0xec63('0x17')]?_0x227122['options'][_0xec63('0x1d')]||null:null,'limit':_0x227122[_0xec63('0x17')]?_0x227122[_0xec63('0x17')][_0xec63('0x1e')]||null:null})['then'](function(_0x16810a){logger['info'](_0xec63('0x1f'),_0x227122);logger['debug'](_0xec63('0x1f'),_0x227122,JSON[_0xec63('0xc')](_0x16810a));_0x53b96f(_0x16810a);})[_0xec63('0x13')](function(_0x1e0bf2){logger['error'](_0xec63('0x1f'),_0x1e0bf2[_0xec63('0xf')],_0x227122);_0x3ba79d(_0x1bd810['error'](0x1f4,_0x1e0bf2[_0xec63('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index a2b7b98..d78b0a8 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 _0x9957=['show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x12454f,_0x278802){var _0x1fceb0=function(_0x3cc9c7){while(--_0x3cc9c7){_0x12454f['push'](_0x12454f['shift']());}};_0x1fceb0(++_0x278802);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0xf')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')](_0x7995('0x12'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);module[_0x7995('0x16')]=router; \ No newline at end of file +var _0x7bae=['isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get'];(function(_0x9bc1b5,_0x2a0313){var _0x35e68e=function(_0x58dbc6){while(--_0x58dbc6){_0x9bc1b5['push'](_0x9bc1b5['shift']());}};_0x35e68e(++_0x2a0313);}(_0x7bae,0x13b));var _0xe7ba=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x7bae[_0xdc37a1];return _0x99b4fe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ba('0x3'));var interaction=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var controller=require(_0xe7ba('0x6'));router[_0xe7ba('0x7')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x9')]);router[_0xe7ba('0x7')](_0xe7ba('0xa'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xb')]);router[_0xe7ba('0x7')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller['show']);router[_0xe7ba('0xd')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xe')]);router[_0xe7ba('0xf')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x10')]);router[_0xe7ba('0x11')](_0xe7ba('0xc'),auth['isAuthenticated'](),controller[_0xe7ba('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 45247d3..3b275c7 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 _0xd914=['exports','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','STRING','TEXT','DATE','INTEGER','sequelize'];(function(_0x2379ae,_0x4845ce){var _0x3e0b6d=function(_0x534b96){while(--_0x534b96){_0x2379ae['push'](_0x2379ae['shift']());}};_0x3e0b6d(++_0x4845ce);}(_0xd914,0x17f));var _0x4d91=function(_0x2defb5,_0x1cda14){_0x2defb5=_0x2defb5-0x0;var _0x229c53=_0xd914[_0x2defb5];return _0x229c53;};'use strict';var Sequelize=require(_0x4d91('0x0'));module[_0x4d91('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4d91('0x2')](_0x4d91('0x3'),_0x4d91('0x4'),_0x4d91('0x5'),_0x4d91('0x6'),_0x4d91('0x7'),'dialer')},'tag':{'type':Sequelize[_0x4d91('0x8')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x4d91('0x8')]},'destination':{'type':Sequelize[_0x4d91('0x8')]},'destinationcontext':{'type':Sequelize[_0x4d91('0x8')]},'callerid':{'type':Sequelize[_0x4d91('0x8')]},'channel':{'type':Sequelize[_0x4d91('0x8')]},'destinationchannel':{'type':Sequelize[_0x4d91('0x8')]},'lastapplication':{'type':Sequelize[_0x4d91('0x8')]},'lastdata':{'type':Sequelize[_0x4d91('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x4d91('0xa')]},'answertime':{'type':Sequelize[_0x4d91('0xa')]},'endtime':{'type':Sequelize[_0x4d91('0xa')]},'duration':{'type':Sequelize[_0x4d91('0xb')]},'billableseconds':{'type':Sequelize[_0x4d91('0xb')]},'mohtime':{'type':Sequelize[_0x4d91('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x4d91('0x8')]},'userDisposition':{'type':Sequelize[_0x4d91('0x8')]},'userSecondDisposition':{'type':Sequelize[_0x4d91('0x8')]},'userThirdDisposition':{'type':Sequelize[_0x4d91('0x8')]},'note':{'type':Sequelize[_0x4d91('0x8')]},'prefix':{'type':Sequelize[_0x4d91('0x8')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8c6c=['internal','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports','ENUM'];(function(_0x13b471,_0x42efbf){var _0xc79516=function(_0x287f5b){while(--_0x287f5b){_0x13b471['push'](_0x13b471['shift']());}};_0xc79516(++_0x42efbf);}(_0x8c6c,0x133));var _0xc8c6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8c6c[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xc8c6('0x0'));module[_0xc8c6('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc8c6('0x2')]('inbound',_0xc8c6('0x3'),'outbound','inbound-fax',_0xc8c6('0x4'),_0xc8c6('0x5'))},'tag':{'type':Sequelize[_0xc8c6('0x6')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xc8c6('0x6')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc8c6('0x6')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xc8c6('0x6')]},'lastapplication':{'type':Sequelize[_0xc8c6('0x6')]},'lastdata':{'type':Sequelize[_0xc8c6('0x7')]},'starttime':{'type':Sequelize[_0xc8c6('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xc8c6('0x8')]},'endtime':{'type':Sequelize[_0xc8c6('0x8')]},'duration':{'type':Sequelize[_0xc8c6('0x9')]},'billableseconds':{'type':Sequelize[_0xc8c6('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc8c6('0x6')]},'amaflags':{'type':Sequelize[_0xc8c6('0x6')]},'userfield':{'type':Sequelize[_0xc8c6('0x6')]},'userDisposition':{'type':Sequelize[_0xc8c6('0x6')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xc8c6('0x6')]},'note':{'type':Sequelize[_0xc8c6('0x6')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xc8c6('0x9')]},'sipcallid':{'type':Sequelize[_0xc8c6('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 6199b6d..dd060ee 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0x2ef3,0xba));var _0x32ef=function(_0x1de90e,_0x97586d){_0x1de90e=_0x1de90e-0x0;var _0x276014=_0x2ef3[_0x1de90e];return _0x276014;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0xadb5,0xad));var _0x5adb=function(_0x20fec4,_0x59e85c){_0x20fec4=_0x20fec4-0x0;var _0x432758=_0xadb5[_0x20fec4];return _0x432758;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c890605..219753e 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 _0xe6dc=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x37f31e,_0x5d144c){var _0x135dc0=function(_0x4ed6a0){while(--_0x4ed6a0){_0x37f31e['push'](_0x37f31e['shift']());}};_0x135dc0(++_0x5d144c);}(_0xe6dc,0x70));var _0xce6d=function(_0x4b6a77,_0x4e8d2a){_0x4b6a77=_0x4b6a77-0x0;var _0x4fd421=_0xe6dc[_0x4b6a77];return _0x4fd421;};'use strict';var _=require(_0xce6d('0x0'));var util=require(_0xce6d('0x1'));var logger=require(_0xce6d('0x2'))(_0xce6d('0x3'));var moment=require(_0xce6d('0x4'));var BPromise=require(_0xce6d('0x5'));var rp=require(_0xce6d('0x6'));var fs=require('fs');var path=require(_0xce6d('0x7'));var rimraf=require(_0xce6d('0x8'));var config=require(_0xce6d('0x9'));var attributes=require(_0xce6d('0xa'));module[_0xce6d('0xb')]=function(_0x29aa61,_0x5aaad9){return _0x29aa61[_0xce6d('0xc')](_0xce6d('0xd'),attributes,{'tableName':_0xce6d('0xe'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd04b=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call'];(function(_0x2d323f,_0x231fe6){var _0x11e018=function(_0x4f326b){while(--_0x4f326b){_0x2d323f['push'](_0x2d323f['shift']());}};_0x11e018(++_0x231fe6);}(_0xd04b,0x145));var _0xbd04=function(_0x462d15,_0x53293c){_0x462d15=_0x462d15-0x0;var _0x985573=_0xd04b[_0x462d15];return _0x985573;};'use strict';var _=require(_0xbd04('0x0'));var util=require(_0xbd04('0x1'));var logger=require(_0xbd04('0x2'))('api');var moment=require(_0xbd04('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd04('0x4'));var fs=require('fs');var path=require(_0xbd04('0x5'));var rimraf=require(_0xbd04('0x6'));var config=require(_0xbd04('0x7'));var attributes=require(_0xbd04('0x8'));module[_0xbd04('0x9')]=function(_0x11d6ce,_0x2d8811){return _0x11d6ce[_0xbd04('0xa')](_0xbd04('0xb'),attributes,{'tableName':_0xbd04('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 10eb8cc..c99823d 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 _0xb157=['error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','include','map','model','attributes','CreateVoiceCallReport','create','body','then','UpdateVoiceCallReport','update','limit','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0xb157,0x101));var _0x7b15=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb157[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7b15('0x0'));var util=require('util');var moment=require(_0x7b15('0x1'));var BPromise=require(_0x7b15('0x2'));var rs=require(_0x7b15('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7b15('0x4'))(_0x7b15('0x5'));var config=require(_0x7b15('0x6'));var jayson=require(_0x7b15('0x7'));var client=jayson[_0x7b15('0x8')][_0x7b15('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c141a,_0x5bf6b5,_0x2e4c4c){return new BPromise(function(_0x56ef18,_0x18873b){return client[_0x7b15('0xa')](_0x5c141a,_0x2e4c4c)['then'](function(_0xca6a98){logger[_0x7b15('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x5bf6b5,_0x7b15('0xc'));logger[_0x7b15('0xd')](_0x7b15('0xe'),_0x5bf6b5,_0x7b15('0xc'),JSON[_0x7b15('0xf')](_0xca6a98));if(_0xca6a98[_0x7b15('0x10')]){if(_0xca6a98[_0x7b15('0x10')][_0x7b15('0x11')]===0x1f4){logger[_0x7b15('0x10')](_0x7b15('0x12'),_0x5bf6b5,_0xca6a98[_0x7b15('0x10')][_0x7b15('0x13')]);return _0x18873b(_0xca6a98[_0x7b15('0x10')][_0x7b15('0x13')]);}logger[_0x7b15('0x10')](_0x7b15('0x12'),_0x5bf6b5,_0xca6a98['error'][_0x7b15('0x13')]);return _0x56ef18(_0xca6a98['error'][_0x7b15('0x13')]);}else{logger[_0x7b15('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x5bf6b5,_0x7b15('0xc'));_0x56ef18(_0xca6a98[_0x7b15('0x14')]['message']);}})[_0x7b15('0x15')](function(_0xf6527b){logger[_0x7b15('0x10')](_0x7b15('0x12'),_0x5bf6b5,_0xf6527b);_0x18873b(_0xf6527b);});});}exports[_0x7b15('0x16')]=function(_0x545e71){var _0x297591=this;return new Promise(function(_0x3301e3,_0x8ee1e6){return db[_0x7b15('0x17')][_0x7b15('0x18')]({'raw':_0x545e71[_0x7b15('0x19')]?_0x545e71[_0x7b15('0x19')][_0x7b15('0x1a')]===undefined?!![]:![]:!![],'where':_0x545e71[_0x7b15('0x19')]?_0x545e71[_0x7b15('0x19')][_0x7b15('0x1b')]||null:null,'attributes':_0x545e71[_0x7b15('0x19')]?_0x545e71[_0x7b15('0x19')]['attributes']||null:null,'limit':_0x545e71[_0x7b15('0x19')]?_0x545e71[_0x7b15('0x19')]['limit']||null:null,'include':_0x545e71[_0x7b15('0x19')]?_0x545e71[_0x7b15('0x19')][_0x7b15('0x1c')]?_[_0x7b15('0x1d')](_0x545e71[_0x7b15('0x19')][_0x7b15('0x1c')],function(_0x5c6380){return{'model':db[_0x5c6380[_0x7b15('0x1e')]],'as':_0x5c6380['as'],'attributes':_0x5c6380[_0x7b15('0x1f')],'include':_0x5c6380[_0x7b15('0x1c')]?_['map'](_0x5c6380[_0x7b15('0x1c')],function(_0xd78271){return{'model':db[_0xd78271[_0x7b15('0x1e')]],'as':_0xd78271['as'],'attributes':_0xd78271[_0x7b15('0x1f')],'include':_0xd78271['include']?_['map'](_0xd78271['include'],function(_0x107d01){return{'model':db[_0x107d01[_0x7b15('0x1e')]],'as':_0x107d01['as'],'attributes':_0x107d01[_0x7b15('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40d11f){logger['info'](_0x7b15('0x16'),_0x545e71);logger[_0x7b15('0xd')](_0x7b15('0x16'),_0x545e71,JSON[_0x7b15('0xf')](_0x40d11f));_0x3301e3(_0x40d11f);})[_0x7b15('0x15')](function(_0x284445){logger[_0x7b15('0x10')]('GetVoiceCallReport',_0x284445['message'],_0x545e71);_0x8ee1e6(_0x297591[_0x7b15('0x10')](0x1f4,_0x284445[_0x7b15('0x13')]));});});};exports[_0x7b15('0x20')]=function(_0x247245){var _0x5e82b2=this;return new Promise(function(_0x20b988,_0x373d2b){return db['VoiceCallReport'][_0x7b15('0x21')](_0x247245[_0x7b15('0x22')],{'raw':_0x247245[_0x7b15('0x19')]?_0x247245[_0x7b15('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x7b15('0x23')](function(_0x4b45ba){logger['info']('CreateVoiceCallReport',_0x247245);logger['debug'](_0x7b15('0x20'),_0x247245,JSON[_0x7b15('0xf')](_0x4b45ba));_0x20b988(_0x4b45ba);})['catch'](function(_0x59198c){logger[_0x7b15('0x10')](_0x7b15('0x20'),_0x59198c[_0x7b15('0x13')],_0x247245);_0x373d2b(_0x5e82b2[_0x7b15('0x10')](0x1f4,_0x59198c[_0x7b15('0x13')]));});});};exports[_0x7b15('0x24')]=function(_0x55ac23){var _0x4c239b=this;return new Promise(function(_0xc084b6,_0x1c966e){return db[_0x7b15('0x17')][_0x7b15('0x25')](_0x55ac23[_0x7b15('0x22')],{'raw':_0x55ac23[_0x7b15('0x19')]?_0x55ac23[_0x7b15('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55ac23[_0x7b15('0x19')]?_0x55ac23[_0x7b15('0x19')][_0x7b15('0x1b')]||null:null,'attributes':_0x55ac23[_0x7b15('0x19')]?_0x55ac23[_0x7b15('0x19')][_0x7b15('0x1f')]||null:null,'limit':_0x55ac23[_0x7b15('0x19')]?_0x55ac23[_0x7b15('0x19')][_0x7b15('0x26')]||null:null})[_0x7b15('0x23')](function(_0x1a8d7e){logger[_0x7b15('0xb')](_0x7b15('0x24'),_0x55ac23);logger[_0x7b15('0xd')](_0x7b15('0x24'),_0x55ac23,JSON[_0x7b15('0xf')](_0x1a8d7e));_0xc084b6(_0x1a8d7e);})[_0x7b15('0x15')](function(_0x27c8d8){logger[_0x7b15('0x10')]('UpdateVoiceCallReport',_0x27c8d8[_0x7b15('0x13')],_0x55ac23);_0x1c966e(_0x4c239b[_0x7b15('0x10')](0x1f4,_0x27c8d8['message']));});});}; \ No newline at end of file +var _0xb83c=['raw','where','include','map','model','attributes','info','GetVoiceCallReport','CreateVoiceCallReport','VoiceCallReport','debug','UpdateVoiceCallReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','catch','findAll','options'];(function(_0x16759a,_0x2c1f70){var _0x49d27a=function(_0xf9815d){while(--_0xf9815d){_0x16759a['push'](_0x16759a['shift']());}};_0x49d27a(++_0x2c1f70);}(_0xb83c,0x180));var _0xcb83=function(_0x391244,_0x13c2a5){_0x391244=_0x391244-0x0;var _0x1e86c5=_0xb83c[_0x391244];return _0x1e86c5;};'use strict';var _=require(_0xcb83('0x0'));var util=require(_0xcb83('0x1'));var moment=require(_0xcb83('0x2'));var BPromise=require(_0xcb83('0x3'));var rs=require(_0xcb83('0x4'));var fs=require('fs');var Redis=require(_0xcb83('0x5'));var db=require(_0xcb83('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb83('0x7'))(_0xcb83('0x8'));var config=require('../../config/environment');var jayson=require(_0xcb83('0x9'));var client=jayson[_0xcb83('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33b417,_0x24cc4a,_0x2bf7d3){return new BPromise(function(_0x4d9577,_0x59b4a6){return client[_0xcb83('0xb')](_0x33b417,_0x2bf7d3)[_0xcb83('0xc')](function(_0x724fca){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x24cc4a,_0xcb83('0xd'));logger['debug'](_0xcb83('0xe'),_0x24cc4a,_0xcb83('0xd'),JSON[_0xcb83('0xf')](_0x724fca));if(_0x724fca[_0xcb83('0x10')]){if(_0x724fca[_0xcb83('0x10')][_0xcb83('0x11')]===0x1f4){logger['error'](_0xcb83('0x12'),_0x24cc4a,_0x724fca[_0xcb83('0x10')][_0xcb83('0x13')]);return _0x59b4a6(_0x724fca[_0xcb83('0x10')]['message']);}logger[_0xcb83('0x10')](_0xcb83('0x12'),_0x24cc4a,_0x724fca[_0xcb83('0x10')][_0xcb83('0x13')]);return _0x4d9577(_0x724fca[_0xcb83('0x10')][_0xcb83('0x13')]);}else{logger['info'](_0xcb83('0x12'),_0x24cc4a,'request\x20sent');_0x4d9577(_0x724fca['result'][_0xcb83('0x13')]);}})[_0xcb83('0x14')](function(_0x3f1cbb){logger[_0xcb83('0x10')](_0xcb83('0x12'),_0x24cc4a,_0x3f1cbb);_0x59b4a6(_0x3f1cbb);});});}exports['GetVoiceCallReport']=function(_0x39e5de){var _0x2106ef=this;return new Promise(function(_0x3620cc,_0x2b0ec9){return db['VoiceCallReport'][_0xcb83('0x15')]({'raw':_0x39e5de['options']?_0x39e5de[_0xcb83('0x16')][_0xcb83('0x17')]===undefined?!![]:![]:!![],'where':_0x39e5de[_0xcb83('0x16')]?_0x39e5de['options'][_0xcb83('0x18')]||null:null,'attributes':_0x39e5de[_0xcb83('0x16')]?_0x39e5de[_0xcb83('0x16')]['attributes']||null:null,'limit':_0x39e5de[_0xcb83('0x16')]?_0x39e5de[_0xcb83('0x16')]['limit']||null:null,'include':_0x39e5de[_0xcb83('0x16')]?_0x39e5de[_0xcb83('0x16')][_0xcb83('0x19')]?_[_0xcb83('0x1a')](_0x39e5de[_0xcb83('0x16')]['include'],function(_0x41f39d){return{'model':db[_0x41f39d[_0xcb83('0x1b')]],'as':_0x41f39d['as'],'attributes':_0x41f39d[_0xcb83('0x1c')],'include':_0x41f39d[_0xcb83('0x19')]?_[_0xcb83('0x1a')](_0x41f39d[_0xcb83('0x19')],function(_0x51977e){return{'model':db[_0x51977e['model']],'as':_0x51977e['as'],'attributes':_0x51977e[_0xcb83('0x1c')],'include':_0x51977e[_0xcb83('0x19')]?_[_0xcb83('0x1a')](_0x51977e[_0xcb83('0x19')],function(_0x352c52){return{'model':db[_0x352c52[_0xcb83('0x1b')]],'as':_0x352c52['as'],'attributes':_0x352c52[_0xcb83('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcb83('0xc')](function(_0x4edc63){logger[_0xcb83('0x1d')](_0xcb83('0x1e'),_0x39e5de);logger['debug'](_0xcb83('0x1e'),_0x39e5de,JSON[_0xcb83('0xf')](_0x4edc63));_0x3620cc(_0x4edc63);})[_0xcb83('0x14')](function(_0x3d41a4){logger[_0xcb83('0x10')](_0xcb83('0x1e'),_0x3d41a4[_0xcb83('0x13')],_0x39e5de);_0x2b0ec9(_0x2106ef[_0xcb83('0x10')](0x1f4,_0x3d41a4[_0xcb83('0x13')]));});});};exports[_0xcb83('0x1f')]=function(_0x58afc9){var _0x409817=this;return new Promise(function(_0x1d2631,_0x22aa60){return db[_0xcb83('0x20')]['create'](_0x58afc9['body'],{'raw':_0x58afc9['options']?_0x58afc9[_0xcb83('0x16')][_0xcb83('0x17')]===undefined?!![]:![]:!![]})[_0xcb83('0xc')](function(_0x46df78){logger[_0xcb83('0x1d')](_0xcb83('0x1f'),_0x58afc9);logger[_0xcb83('0x21')](_0xcb83('0x1f'),_0x58afc9,JSON[_0xcb83('0xf')](_0x46df78));_0x1d2631(_0x46df78);})[_0xcb83('0x14')](function(_0x45490a){logger[_0xcb83('0x10')](_0xcb83('0x1f'),_0x45490a[_0xcb83('0x13')],_0x58afc9);_0x22aa60(_0x409817['error'](0x1f4,_0x45490a[_0xcb83('0x13')]));});});};exports[_0xcb83('0x22')]=function(_0x48a476){var _0x382c7d=this;return new Promise(function(_0xd70440,_0x1eef94){return db[_0xcb83('0x20')][_0xcb83('0x23')](_0x48a476[_0xcb83('0x24')],{'raw':_0x48a476[_0xcb83('0x16')]?_0x48a476[_0xcb83('0x16')][_0xcb83('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48a476[_0xcb83('0x16')]?_0x48a476[_0xcb83('0x16')][_0xcb83('0x18')]||null:null,'attributes':_0x48a476[_0xcb83('0x16')]?_0x48a476[_0xcb83('0x16')][_0xcb83('0x1c')]||null:null,'limit':_0x48a476[_0xcb83('0x16')]?_0x48a476[_0xcb83('0x16')]['limit']||null:null})[_0xcb83('0xc')](function(_0xa1a277){logger[_0xcb83('0x1d')]('UpdateVoiceCallReport',_0x48a476);logger[_0xcb83('0x21')](_0xcb83('0x22'),_0x48a476,JSON[_0xcb83('0xf')](_0xa1a277));_0xd70440(_0xa1a277);})[_0xcb83('0x14')](function(_0x21acc2){logger[_0xcb83('0x10')]('UpdateVoiceCallReport',_0x21acc2[_0xcb83('0x13')],_0x48a476);_0x1eef94(_0x382c7d['error'](0x1f4,_0x21acc2['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 564c7ad..0cd7e4d 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 _0x001d=['show','post','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated'];(function(_0x46ec3e,_0x1c8c95){var _0x453789=function(_0x2056cb){while(--_0x2056cb){_0x46ec3e['push'](_0x46ec3e['shift']());}};_0x453789(++_0x1c8c95);}(_0x001d,0x1d3));var _0xd001=function(_0x5cc5cd,_0x4b19b2){_0x5cc5cd=_0x5cc5cd-0x0;var _0x44abe4=_0x001d[_0x5cc5cd];return _0x44abe4;};'use strict';var multer=require(_0xd001('0x0'));var util=require(_0xd001('0x1'));var path=require(_0xd001('0x2'));var timeout=require(_0xd001('0x3'));var express=require(_0xd001('0x4'));var router=express[_0xd001('0x5')]();var fs_extra=require(_0xd001('0x6'));var auth=require(_0xd001('0x7'));var interaction=require(_0xd001('0x8'));var config=require(_0xd001('0x9'));var controller=require(_0xd001('0xa'));router[_0xd001('0xb')]('/',auth[_0xd001('0xc')](),controller['index']);router[_0xd001('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xd001('0xd')]);router[_0xd001('0xe')]('/',auth[_0xd001('0xc')](),controller['create']);router['put']('/:id',auth[_0xd001('0xc')](),controller[_0xd001('0xf')]);router[_0xd001('0x10')](_0xd001('0x11'),auth[_0xd001('0xc')](),controller[_0xd001('0x12')]);module[_0xd001('0x13')]=router; \ No newline at end of file +var _0x83a5=['../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','/:id','isAuthenticated','show','post','create','put','delete','multer','util','path','Router','fs-extra'];(function(_0x1b0af8,_0x47def0){var _0x392d26=function(_0x1e7168){while(--_0x1e7168){_0x1b0af8['push'](_0x1b0af8['shift']());}};_0x392d26(++_0x47def0);}(_0x83a5,0xcb));var _0x583a=function(_0x51f4a6,_0x23fa32){_0x51f4a6=_0x51f4a6-0x0;var _0x150756=_0x83a5[_0x51f4a6];return _0x150756;};'use strict';var multer=require(_0x583a('0x0'));var util=require(_0x583a('0x1'));var path=require(_0x583a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x583a('0x3')]();var fs_extra=require(_0x583a('0x4'));var auth=require(_0x583a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x583a('0x6'));var controller=require(_0x583a('0x7'));router[_0x583a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x583a('0x9'),auth[_0x583a('0xa')](),controller[_0x583a('0xb')]);router[_0x583a('0xc')]('/',auth[_0x583a('0xa')](),controller[_0x583a('0xd')]);router[_0x583a('0xe')](_0x583a('0x9'),auth[_0x583a('0xa')](),controller['update']);router[_0x583a('0xf')](_0x583a('0x9'),auth[_0x583a('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 5f4b602..97dd13c 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 _0xe450=['exports','STRING','name','options','join','getDataValue','BOOLEAN'];(function(_0x20d26a,_0x59e9d1){var _0x1c297c=function(_0x5b6f18){while(--_0x5b6f18){_0x20d26a['push'](_0x20d26a['shift']());}};_0x1c297c(++_0x59e9d1);}(_0xe450,0x1e3));var _0x0e45=function(_0x22dcc4,_0xb719d5){_0x22dcc4=_0x22dcc4-0x0;var _0x52133b=_0xe450[_0x22dcc4];return _0x52133b;};'use strict';var Sequelize=require('sequelize');module[_0x0e45('0x0')]={'name':{'type':Sequelize[_0x0e45('0x1')]},'prefix':{'type':Sequelize[_0x0e45('0x1')],'unique':_0x0e45('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x0e45('0x1')],'set':function(_0x2f23f0){this['setDataValue'](_0x0e45('0x3'),_0x2f23f0?_0x2f23f0[_0x0e45('0x4')](''):[]);},'get':function(){return this[_0x0e45('0x5')](_0x0e45('0x3'))?this['getDataValue'](_0x0e45('0x3'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x0e45('0x1')]},'record':{'type':Sequelize[_0x0e45('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0e45('0x1')]},'description':{'type':Sequelize[_0x0e45('0x1')]}}; \ No newline at end of file +var _0x1edc=['exports','STRING','options','join','getDataValue','split','BOOLEAN'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x1edc,0x16c));var _0xc1ed=function(_0x42f091,_0x22cac5){_0x42f091=_0x42f091-0x0;var _0x495be1=_0x1edc[_0x42f091];return _0x495be1;};'use strict';var Sequelize=require('sequelize');module[_0xc1ed('0x0')]={'name':{'type':Sequelize[_0xc1ed('0x1')]},'prefix':{'type':Sequelize[_0xc1ed('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xc1ed('0x1')],'set':function(_0x42ec39){this['setDataValue'](_0xc1ed('0x2'),_0x42ec39?_0x42ec39[_0xc1ed('0x3')](''):[]);},'get':function(){return this[_0xc1ed('0x4')](_0xc1ed('0x2'))?this['getDataValue'](_0xc1ed('0x2'))[_0xc1ed('0x5')](''):[];}},'auth':{'type':Sequelize[_0xc1ed('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xc1ed('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc1ed('0x1')]},'description':{'type':Sequelize[_0xc1ed('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index b0550f2..e8d96ae 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 _0xab26=['stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0xab26,0xd2));var _0x6ab2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xab26[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x6ab2('0x0'));var rimraf=require(_0x6ab2('0x1'));var zipdir=require(_0x6ab2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6ab2('0x3'));var moment=require(_0x6ab2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6ab2('0x5'));var path=require('path');var sox=require(_0x6ab2('0x6'));var csv=require(_0x6ab2('0x7'));var ejs=require(_0x6ab2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ab2('0x9'));var squel=require(_0x6ab2('0xa'));var crypto=require('crypto');var jsforce=require(_0x6ab2('0xb'));var deskjs=require(_0x6ab2('0xc'));var toCsv=require(_0x6ab2('0x7'));var querystring=require(_0x6ab2('0xd'));var Papa=require(_0x6ab2('0xe'));var Redis=require(_0x6ab2('0xf'));var authService=require(_0x6ab2('0x10'));var qs=require(_0x6ab2('0x11'));var as=require(_0x6ab2('0x12'));var hardwareService=require(_0x6ab2('0x13'));var logger=require(_0x6ab2('0x14'))('api');var utils=require(_0x6ab2('0x15'));var config=require(_0x6ab2('0x16'));var licenseUtil=require(_0x6ab2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b6f7c,_0x10c3b1){_0x10c3b1=_0x10c3b1||0xcc;return function(_0x2bb464){if(_0x2bb464){return _0x5b6f7c[_0x6ab2('0x18')](_0x10c3b1);}return _0x5b6f7c[_0x6ab2('0x19')](_0x10c3b1)[_0x6ab2('0x1a')]();};}function respondWithResult(_0x432df4,_0x9f3aea){_0x9f3aea=_0x9f3aea||0xc8;return function(_0x13d31d){if(_0x13d31d){return _0x432df4['status'](_0x9f3aea)[_0x6ab2('0x1b')](_0x13d31d);}};}function respondWithFilteredResult(_0x55d6f4,_0x1bc335){return function(_0x429aba){if(_0x429aba){var _0x5ced24=typeof _0x1bc335['offset']==='undefined'&&typeof _0x1bc335[_0x6ab2('0x1c')]===_0x6ab2('0x1d');var _0x20f437=_0x429aba[_0x6ab2('0x1e')];var _0x272bd0=_0x5ced24?0x0:_0x1bc335[_0x6ab2('0x1f')];var _0x508376=_0x5ced24?_0x429aba[_0x6ab2('0x1e')]:_0x1bc335[_0x6ab2('0x1f')]+_0x1bc335['limit'];var _0x17f6e0;if(_0x508376>=_0x20f437){_0x508376=_0x20f437;_0x17f6e0=0xc8;}else{_0x17f6e0=0xce;}_0x55d6f4['status'](_0x17f6e0);return _0x55d6f4['set'](_0x6ab2('0x20'),_0x272bd0+'-'+_0x508376+'/'+_0x20f437)[_0x6ab2('0x1b')](_0x429aba);}return null;};}function patchUpdates(_0x2ca855){return function(_0x1851bf){try{jsonpatch[_0x6ab2('0x21')](_0x1851bf,_0x2ca855,!![]);}catch(_0x4a2584){return BPromise[_0x6ab2('0x22')](_0x4a2584);}return _0x1851bf[_0x6ab2('0x23')]();};}function saveUpdates(_0x3b7a1a,_0x3fad2b){return function(_0x25fa3f){if(_0x25fa3f){return _0x25fa3f[_0x6ab2('0x24')](_0x3b7a1a)[_0x6ab2('0x25')](function(_0x2b87a0){return _0x2b87a0;});}return null;};}function removeEntity(_0x2784f8,_0x1caf3d){return function(_0x4fd76d){if(_0x4fd76d){return _0x4fd76d['destroy']()['then'](function(){var _0x11e287=_0x4fd76d[_0x6ab2('0x26')]({'plain':!![]});var _0x273aee='ChanSpies';return db[_0x6ab2('0x27')][_0x6ab2('0x28')]({'where':{'type':_0x273aee,'resourceId':_0x11e287['id']}})[_0x6ab2('0x25')](function(){return _0x4fd76d;});})[_0x6ab2('0x25')](function(){_0x2784f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x58e29c,_0x22085c){return function(_0x5bb6ac){if(!_0x5bb6ac){_0x58e29c['sendStatus'](0x194);}return _0x5bb6ac;};}function handleError(_0xd40bad,_0x2a1833){_0x2a1833=_0x2a1833||0x1f4;return function(_0x161165){logger[_0x6ab2('0x29')](_0x161165[_0x6ab2('0x2a')]);if(_0x161165[_0x6ab2('0x2b')]){delete _0x161165[_0x6ab2('0x2b')];}_0xd40bad[_0x6ab2('0x19')](_0x2a1833)[_0x6ab2('0x2c')](_0x161165);};}exports['index']=function(_0x3c80ed,_0xd9c398){var _0x4978eb={},_0xbbd61b={},_0x5eca90={'count':0x0,'rows':[]};var _0x390015=_[_0x6ab2('0x2d')](db[_0x6ab2('0x2e')][_0x6ab2('0x2f')],function(_0x6d3c1d){return{'name':_0x6d3c1d[_0x6ab2('0x30')],'type':_0x6d3c1d['type'][_0x6ab2('0x31')]};});_0xbbd61b[_0x6ab2('0x32')]=_[_0x6ab2('0x2d')](_0x390015,_0x6ab2('0x2b'));_0xbbd61b[_0x6ab2('0x33')]=_[_0x6ab2('0x34')](_0x3c80ed[_0x6ab2('0x33')]);_0xbbd61b['filters']=_[_0x6ab2('0x35')](_0xbbd61b[_0x6ab2('0x32')],_0xbbd61b['query']);_0x4978eb['attributes']=_[_0x6ab2('0x35')](_0xbbd61b[_0x6ab2('0x32')],qs[_0x6ab2('0x36')](_0x3c80ed[_0x6ab2('0x33')][_0x6ab2('0x36')]));_0x4978eb[_0x6ab2('0x37')]=_0x4978eb[_0x6ab2('0x37')][_0x6ab2('0x38')]?_0x4978eb['attributes']:_0xbbd61b['model'];if(!_0x3c80ed[_0x6ab2('0x33')][_0x6ab2('0x39')](_0x6ab2('0x3a'))){_0x4978eb[_0x6ab2('0x1c')]=qs[_0x6ab2('0x1c')](_0x3c80ed['query'][_0x6ab2('0x1c')]);_0x4978eb[_0x6ab2('0x1f')]=qs[_0x6ab2('0x1f')](_0x3c80ed['query'][_0x6ab2('0x1f')]);}_0x4978eb[_0x6ab2('0x3b')]=qs['sort'](_0x3c80ed[_0x6ab2('0x33')][_0x6ab2('0x3c')]);_0x4978eb[_0x6ab2('0x3d')]=qs[_0x6ab2('0x3e')](_[_0x6ab2('0x3f')](_0x3c80ed[_0x6ab2('0x33')],_0xbbd61b[_0x6ab2('0x3e')]),_0x390015);if(_0x3c80ed['query'][_0x6ab2('0x40')]){_0x4978eb['where']=_[_0x6ab2('0x41')](_0x4978eb[_0x6ab2('0x3d')],{'$or':_[_0x6ab2('0x2d')](_0x390015,function(_0x5c765b){if(_0x5c765b['type']!==_0x6ab2('0x42')){var _0x4f08ad={};_0x4f08ad[_0x5c765b['name']]={'$like':'%'+_0x3c80ed[_0x6ab2('0x33')][_0x6ab2('0x40')]+'%'};return _0x4f08ad;}})});}_0x4978eb=_[_0x6ab2('0x41')]({},_0x4978eb,_0x3c80ed[_0x6ab2('0x43')]);var _0x1a4818={'where':_0x4978eb['where']};return db[_0x6ab2('0x2e')]['count'](_0x1a4818)[_0x6ab2('0x25')](function(_0x1a3b61){_0x5eca90[_0x6ab2('0x1e')]=_0x1a3b61;if(_0x3c80ed[_0x6ab2('0x33')]['includeAll']){_0x4978eb[_0x6ab2('0x44')]=[{'all':!![]}];}return db[_0x6ab2('0x2e')][_0x6ab2('0x45')](_0x4978eb);})[_0x6ab2('0x25')](function(_0x12d4b6){_0x5eca90[_0x6ab2('0x46')]=_0x12d4b6;return _0x5eca90;})[_0x6ab2('0x25')](respondWithFilteredResult(_0xd9c398,_0x4978eb))[_0x6ab2('0x47')](handleError(_0xd9c398,null));};exports[_0x6ab2('0x48')]=function(_0x2aea88,_0x398274){var _0x32333d={'raw':![],'where':{'id':_0x2aea88[_0x6ab2('0x49')]['id']}},_0x5720af={};_0x5720af[_0x6ab2('0x32')]=_[_0x6ab2('0x34')](db[_0x6ab2('0x2e')][_0x6ab2('0x2f')]);_0x5720af[_0x6ab2('0x33')]=_['keys'](_0x2aea88[_0x6ab2('0x33')]);_0x5720af[_0x6ab2('0x3e')]=_[_0x6ab2('0x35')](_0x5720af[_0x6ab2('0x32')],_0x5720af['query']);_0x32333d['attributes']=_[_0x6ab2('0x35')](_0x5720af[_0x6ab2('0x32')],qs[_0x6ab2('0x36')](_0x2aea88[_0x6ab2('0x33')][_0x6ab2('0x36')]));_0x32333d['attributes']=_0x32333d[_0x6ab2('0x37')][_0x6ab2('0x38')]?_0x32333d[_0x6ab2('0x37')]:_0x5720af[_0x6ab2('0x32')];if(_0x2aea88['query']['includeAll']){_0x32333d[_0x6ab2('0x44')]=[{'all':!![]}];}_0x32333d=_[_0x6ab2('0x41')]({},_0x32333d,_0x2aea88['options']);return db[_0x6ab2('0x2e')]['find'](_0x32333d)['then'](handleEntityNotFound(_0x398274,null))['then'](respondWithResult(_0x398274,null))[_0x6ab2('0x47')](handleError(_0x398274,null));};exports[_0x6ab2('0x4a')]=function(_0x4fffb4,_0x186746){return db['VoiceChanSpy'][_0x6ab2('0x4a')](_0x4fffb4[_0x6ab2('0x4b')],{})[_0x6ab2('0x25')](function(_0x9c5d40){var _0x507695=_0x4fffb4[_0x6ab2('0x4c')][_0x6ab2('0x26')]({'plain':!![]});if(!_0x507695)throw new Error(_0x6ab2('0x4d'));if(_0x507695[_0x6ab2('0x4e')]===_0x6ab2('0x4c')){var _0x301270=_0x9c5d40[_0x6ab2('0x26')]({'plain':!![]});var _0x507da5=_0x6ab2('0x4f');return db[_0x6ab2('0x50')][_0x6ab2('0x51')]({'where':{'name':_0x507da5,'userProfileId':_0x507695[_0x6ab2('0x52')]},'raw':!![]})[_0x6ab2('0x25')](function(_0x1449db){if(_0x1449db&&_0x1449db['autoAssociation']===0x0){return db[_0x6ab2('0x27')]['create']({'name':_0x301270[_0x6ab2('0x2b')],'resourceId':_0x301270['id'],'type':_0x1449db[_0x6ab2('0x2b')],'sectionId':_0x1449db['id']},{})[_0x6ab2('0x25')](function(){return _0x9c5d40;});}else{return _0x9c5d40;}})[_0x6ab2('0x47')](function(_0x145428){logger[_0x6ab2('0x29')](_0x6ab2('0x53'),_0x145428);throw _0x145428;});}return _0x9c5d40;})[_0x6ab2('0x25')](respondWithResult(_0x186746,0xc9))[_0x6ab2('0x47')](handleError(_0x186746,null));};exports['update']=function(_0x326d64,_0x5df5be){if(_0x326d64['body']['id']){delete _0x326d64[_0x6ab2('0x4b')]['id'];}return db[_0x6ab2('0x2e')][_0x6ab2('0x51')]({'where':{'id':_0x326d64[_0x6ab2('0x49')]['id']}})[_0x6ab2('0x25')](handleEntityNotFound(_0x5df5be,null))[_0x6ab2('0x25')](saveUpdates(_0x326d64[_0x6ab2('0x4b')],null))[_0x6ab2('0x25')](respondWithResult(_0x5df5be,null))[_0x6ab2('0x47')](handleError(_0x5df5be,null));};exports[_0x6ab2('0x28')]=function(_0xdd943,_0x409b6e){return db['VoiceChanSpy'][_0x6ab2('0x51')]({'where':{'id':_0xdd943[_0x6ab2('0x49')]['id']}})[_0x6ab2('0x25')](handleEntityNotFound(_0x409b6e,null))[_0x6ab2('0x25')](removeEntity(_0x409b6e,null))[_0x6ab2('0x47')](handleError(_0x409b6e,null));}; \ No newline at end of file +var _0x7341=['status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','ChanSpies','UserProfileResource','stack','name','send','index','map','VoiceChanSpy','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x563634,_0x5da4cf){var _0xe1b86=function(_0x33e2a5){while(--_0x33e2a5){_0x563634['push'](_0x563634['shift']());}};_0xe1b86(++_0x5da4cf);}(_0x7341,0xe4));var _0x1734=function(_0x122ac2,_0x48d2e1){_0x122ac2=_0x122ac2-0x0;var _0x2600e0=_0x7341[_0x122ac2];return _0x2600e0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1734('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1734('0x1'));var moment=require(_0x1734('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1734('0x3'));var util=require(_0x1734('0x4'));var path=require(_0x1734('0x5'));var sox=require(_0x1734('0x6'));var csv=require(_0x1734('0x7'));var ejs=require(_0x1734('0x8'));var fs=require('fs');var fs_extra=require(_0x1734('0x9'));var _=require('lodash');var squel=require(_0x1734('0xa'));var crypto=require(_0x1734('0xb'));var jsforce=require(_0x1734('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1734('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1734('0xd'));var authService=require(_0x1734('0xe'));var qs=require(_0x1734('0xf'));var as=require(_0x1734('0x10'));var hardwareService=require(_0x1734('0x11'));var logger=require(_0x1734('0x12'))(_0x1734('0x13'));var utils=require(_0x1734('0x14'));var config=require(_0x1734('0x15'));var licenseUtil=require(_0x1734('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4391a1,_0x449ab1){_0x449ab1=_0x449ab1||0xcc;return function(_0x44de07){if(_0x44de07){return _0x4391a1[_0x1734('0x17')](_0x449ab1);}return _0x4391a1[_0x1734('0x18')](_0x449ab1)[_0x1734('0x19')]();};}function respondWithResult(_0x9e7cf5,_0xd2f288){_0xd2f288=_0xd2f288||0xc8;return function(_0xb90c22){if(_0xb90c22){return _0x9e7cf5[_0x1734('0x18')](_0xd2f288)[_0x1734('0x1a')](_0xb90c22);}};}function respondWithFilteredResult(_0x27679e,_0x2162c9){return function(_0x2dd53c){if(_0x2dd53c){var _0x3989a6=typeof _0x2162c9[_0x1734('0x1b')]===_0x1734('0x1c')&&typeof _0x2162c9[_0x1734('0x1d')]===_0x1734('0x1c');var _0x56756c=_0x2dd53c['count'];var _0x1fa9c0=_0x3989a6?0x0:_0x2162c9[_0x1734('0x1b')];var _0x4a86d1=_0x3989a6?_0x2dd53c[_0x1734('0x1e')]:_0x2162c9['offset']+_0x2162c9['limit'];var _0x5b2789;if(_0x4a86d1>=_0x56756c){_0x4a86d1=_0x56756c;_0x5b2789=0xc8;}else{_0x5b2789=0xce;}_0x27679e[_0x1734('0x18')](_0x5b2789);return _0x27679e['set'](_0x1734('0x1f'),_0x1fa9c0+'-'+_0x4a86d1+'/'+_0x56756c)[_0x1734('0x1a')](_0x2dd53c);}return null;};}function patchUpdates(_0x4fc4ed){return function(_0x54b1bd){try{jsonpatch['apply'](_0x54b1bd,_0x4fc4ed,!![]);}catch(_0x1e7401){return BPromise['reject'](_0x1e7401);}return _0x54b1bd[_0x1734('0x20')]();};}function saveUpdates(_0x5ad801,_0x215ae4){return function(_0x42485f){if(_0x42485f){return _0x42485f[_0x1734('0x21')](_0x5ad801)[_0x1734('0x22')](function(_0x29bb2c){return _0x29bb2c;});}return null;};}function removeEntity(_0x45593e,_0x4285ee){return function(_0x44e420){if(_0x44e420){return _0x44e420[_0x1734('0x23')]()['then'](function(){var _0x34ac29=_0x44e420['get']({'plain':!![]});var _0x5e0023=_0x1734('0x24');return db[_0x1734('0x25')][_0x1734('0x23')]({'where':{'type':_0x5e0023,'resourceId':_0x34ac29['id']}})[_0x1734('0x22')](function(){return _0x44e420;});})[_0x1734('0x22')](function(){_0x45593e[_0x1734('0x18')](0xcc)[_0x1734('0x19')]();});}};}function handleEntityNotFound(_0x27d6e5,_0x4a670a){return function(_0x381960){if(!_0x381960){_0x27d6e5['sendStatus'](0x194);}return _0x381960;};}function handleError(_0x17e068,_0x16a35f){_0x16a35f=_0x16a35f||0x1f4;return function(_0xfca2ad){logger['error'](_0xfca2ad[_0x1734('0x26')]);if(_0xfca2ad[_0x1734('0x27')]){delete _0xfca2ad[_0x1734('0x27')];}_0x17e068['status'](_0x16a35f)[_0x1734('0x28')](_0xfca2ad);};}exports[_0x1734('0x29')]=function(_0x5594c0,_0x1bd659){var _0x419e75={},_0x1b2d85={},_0xf3d22e={'count':0x0,'rows':[]};var _0x4f4d92=_[_0x1734('0x2a')](db[_0x1734('0x2b')]['rawAttributes'],function(_0x4dd04a){return{'name':_0x4dd04a[_0x1734('0x2c')],'type':_0x4dd04a[_0x1734('0x2d')][_0x1734('0x2e')]};});_0x1b2d85[_0x1734('0x2f')]=_[_0x1734('0x2a')](_0x4f4d92,_0x1734('0x27'));_0x1b2d85[_0x1734('0x30')]=_[_0x1734('0x31')](_0x5594c0[_0x1734('0x30')]);_0x1b2d85[_0x1734('0x32')]=_[_0x1734('0x33')](_0x1b2d85[_0x1734('0x2f')],_0x1b2d85[_0x1734('0x30')]);_0x419e75[_0x1734('0x34')]=_[_0x1734('0x33')](_0x1b2d85[_0x1734('0x2f')],qs[_0x1734('0x35')](_0x5594c0['query'][_0x1734('0x35')]));_0x419e75['attributes']=_0x419e75[_0x1734('0x34')][_0x1734('0x36')]?_0x419e75[_0x1734('0x34')]:_0x1b2d85[_0x1734('0x2f')];if(!_0x5594c0[_0x1734('0x30')][_0x1734('0x37')](_0x1734('0x38'))){_0x419e75[_0x1734('0x1d')]=qs['limit'](_0x5594c0[_0x1734('0x30')][_0x1734('0x1d')]);_0x419e75[_0x1734('0x1b')]=qs[_0x1734('0x1b')](_0x5594c0[_0x1734('0x30')][_0x1734('0x1b')]);}_0x419e75[_0x1734('0x39')]=qs['sort'](_0x5594c0[_0x1734('0x30')][_0x1734('0x3a')]);_0x419e75[_0x1734('0x3b')]=qs[_0x1734('0x32')](_[_0x1734('0x3c')](_0x5594c0[_0x1734('0x30')],_0x1b2d85[_0x1734('0x32')]),_0x4f4d92);if(_0x5594c0[_0x1734('0x30')]['filter']){_0x419e75[_0x1734('0x3b')]=_['merge'](_0x419e75[_0x1734('0x3b')],{'$or':_[_0x1734('0x2a')](_0x4f4d92,function(_0x4ee569){if(_0x4ee569[_0x1734('0x2d')]!==_0x1734('0x3d')){var _0x169db8={};_0x169db8[_0x4ee569[_0x1734('0x27')]]={'$like':'%'+_0x5594c0[_0x1734('0x30')][_0x1734('0x3e')]+'%'};return _0x169db8;}})});}_0x419e75=_[_0x1734('0x3f')]({},_0x419e75,_0x5594c0[_0x1734('0x40')]);var _0x55d67c={'where':_0x419e75[_0x1734('0x3b')]};return db[_0x1734('0x2b')][_0x1734('0x1e')](_0x55d67c)[_0x1734('0x22')](function(_0x5f34e1){_0xf3d22e[_0x1734('0x1e')]=_0x5f34e1;if(_0x5594c0['query']['includeAll']){_0x419e75[_0x1734('0x41')]=[{'all':!![]}];}return db[_0x1734('0x2b')][_0x1734('0x42')](_0x419e75);})[_0x1734('0x22')](function(_0x4fc418){_0xf3d22e[_0x1734('0x43')]=_0x4fc418;return _0xf3d22e;})[_0x1734('0x22')](respondWithFilteredResult(_0x1bd659,_0x419e75))['catch'](handleError(_0x1bd659,null));};exports[_0x1734('0x44')]=function(_0x1b104a,_0x55954e){var _0x17f282={'raw':![],'where':{'id':_0x1b104a[_0x1734('0x45')]['id']}},_0x4bfc67={};_0x4bfc67[_0x1734('0x2f')]=_[_0x1734('0x31')](db[_0x1734('0x2b')][_0x1734('0x46')]);_0x4bfc67[_0x1734('0x30')]=_[_0x1734('0x31')](_0x1b104a['query']);_0x4bfc67[_0x1734('0x32')]=_[_0x1734('0x33')](_0x4bfc67['model'],_0x4bfc67[_0x1734('0x30')]);_0x17f282[_0x1734('0x34')]=_[_0x1734('0x33')](_0x4bfc67[_0x1734('0x2f')],qs['fields'](_0x1b104a[_0x1734('0x30')][_0x1734('0x35')]));_0x17f282[_0x1734('0x34')]=_0x17f282['attributes'][_0x1734('0x36')]?_0x17f282[_0x1734('0x34')]:_0x4bfc67[_0x1734('0x2f')];if(_0x1b104a[_0x1734('0x30')][_0x1734('0x47')]){_0x17f282[_0x1734('0x41')]=[{'all':!![]}];}_0x17f282=_[_0x1734('0x3f')]({},_0x17f282,_0x1b104a[_0x1734('0x40')]);return db[_0x1734('0x2b')][_0x1734('0x48')](_0x17f282)[_0x1734('0x22')](handleEntityNotFound(_0x55954e,null))[_0x1734('0x22')](respondWithResult(_0x55954e,null))[_0x1734('0x49')](handleError(_0x55954e,null));};exports[_0x1734('0x4a')]=function(_0x470110,_0x121c8c){return db[_0x1734('0x2b')][_0x1734('0x4a')](_0x470110['body'],{})[_0x1734('0x22')](function(_0x50e12d){var _0xfc42f3=_0x470110[_0x1734('0x4b')][_0x1734('0x4c')]({'plain':!![]});if(!_0xfc42f3)throw new Error(_0x1734('0x4d'));if(_0xfc42f3['role']==='user'){var _0x294097=_0x50e12d[_0x1734('0x4c')]({'plain':!![]});var _0x518ef4=_0x1734('0x24');return db[_0x1734('0x4e')][_0x1734('0x48')]({'where':{'name':_0x518ef4,'userProfileId':_0xfc42f3[_0x1734('0x4f')]},'raw':!![]})[_0x1734('0x22')](function(_0x1394bd){if(_0x1394bd&&_0x1394bd[_0x1734('0x50')]===0x0){return db['UserProfileResource'][_0x1734('0x4a')]({'name':_0x294097[_0x1734('0x27')],'resourceId':_0x294097['id'],'type':_0x1394bd[_0x1734('0x27')],'sectionId':_0x1394bd['id']},{})['then'](function(){return _0x50e12d;});}else{return _0x50e12d;}})[_0x1734('0x49')](function(_0x6b6fef){logger[_0x1734('0x51')](_0x1734('0x52'),_0x6b6fef);throw _0x6b6fef;});}return _0x50e12d;})['then'](respondWithResult(_0x121c8c,0xc9))[_0x1734('0x49')](handleError(_0x121c8c,null));};exports[_0x1734('0x21')]=function(_0x19ceed,_0xac0441){if(_0x19ceed[_0x1734('0x53')]['id']){delete _0x19ceed['body']['id'];}return db[_0x1734('0x2b')]['find']({'where':{'id':_0x19ceed['params']['id']}})[_0x1734('0x22')](handleEntityNotFound(_0xac0441,null))[_0x1734('0x22')](saveUpdates(_0x19ceed['body'],null))['then'](respondWithResult(_0xac0441,null))[_0x1734('0x49')](handleError(_0xac0441,null));};exports[_0x1734('0x23')]=function(_0x553fc0,_0x515e39){return db['VoiceChanSpy'][_0x1734('0x48')]({'where':{'id':_0x553fc0[_0x1734('0x45')]['id']}})[_0x1734('0x22')](handleEntityNotFound(_0x515e39,null))[_0x1734('0x22')](removeEntity(_0x515e39,null))['catch'](handleError(_0x515e39,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 20bd16b..e7bbbc1 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 _0x7db4=['%s%s','prefix','system','merge','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','format','${UNIQUEID}.%s,a','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','name','options','join','length','internal','findAll','then','catch','exports','define','VoiceExtension','bulkCreate','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip'];(function(_0x4ad0f7,_0x1920b0){var _0x30f5c8=function(_0x2aa6b6){while(--_0x2aa6b6){_0x4ad0f7['push'](_0x4ad0f7['shift']());}};_0x30f5c8(++_0x1920b0);}(_0x7db4,0x87));var _0x47db=function(_0x1530bf,_0x14bd16){_0x1530bf=_0x1530bf-0x0;var _0x1da684=_0x7db4[_0x1530bf];return _0x1da684;};'use strict';var _=require(_0x47db('0x0'));var util=require('util');var BPromise=require(_0x47db('0x1'));var attributes=require(_0x47db('0x2'));var getUserApplications=function(_0x34cba1,_0xe1c8bf,_0x4a888e){var _0x248d36=0x1;var _0x415562=[];var _0x1d1aeb={'context':_0xe1c8bf[_0x47db('0x3')]||_0x47db('0x4'),'exten':util['format'](_0x47db('0x5'),_0x34cba1[_0x47db('0x6')],_0x4a888e),'type':_0x47db('0x7'),'isApp':![],'ChanSpyId':_0x34cba1['id'],'UserId':_0xe1c8bf['id']};_0x415562['push'](_[_0x47db('0x8')]({'app':_0x47db('0x9'),'appdata':util['format'](_0x47db('0xa'),_0x47db('0xb')),'priority':_0x248d36++},_0x1d1aeb));if(_0x34cba1[_0x47db('0xc')]){_0x415562[_0x47db('0xd')](_[_0x47db('0x8')]({'app':_0x47db('0xe'),'appdata':util[_0x47db('0xf')](_0x47db('0x10'),_0x34cba1[_0x47db('0x11')]),'priority':_0x248d36++},_0x1d1aeb));}if(_0x34cba1[_0x47db('0x12')]){_0x415562[_0x47db('0xd')](_['merge']({'app':'Authenticate','appdata':_0x34cba1[_0x47db('0x13')],'priority':_0x248d36++},_0x1d1aeb));}_0x415562['push'](_[_0x47db('0x8')]({'app':_0x47db('0x14'),'appdata':util[_0x47db('0xf')](_0x47db('0x15'),_0xe1c8bf[_0x47db('0x16')],_0x34cba1[_0x47db('0x17')]?_0x34cba1[_0x47db('0x17')][_0x47db('0x18')](''):''),'priority':_0x248d36++},_0x1d1aeb));if(_0x34cba1[_0x47db('0xc')]){_0x415562[_0x47db('0xd')](_['merge']({'app':'StopMixMonitor','priority':_0x248d36++},_0x1d1aeb));}return _0x415562;};var getChanSpyApplications=function(_0x17b32a,_0x54a764){var _0x1b2bbc=[];for(var _0xe3879c=0x0,_0x1da3f2=0x1;_0xe3879c<_0x54a764[_0x47db('0x19')];_0xe3879c++,_0x1da3f2=0x1){_0x1b2bbc=_0x1b2bbc['concat'](getUserApplications(_0x17b32a,_0x54a764[_0xe3879c],_0x54a764[_0xe3879c][_0x47db('0x1a')]));if(_0x54a764[_0xe3879c][_0x47db('0x1a')]!=_0x54a764[_0xe3879c]['name']){_0x1b2bbc=_0x1b2bbc['concat'](getUserApplications(_0x17b32a,_0x54a764[_0xe3879c],_0x54a764[_0xe3879c][_0x47db('0x16')]));}}return _0x1b2bbc;};var getChanSpyPromise=function(_0x121c22,_0x490507){return new BPromise(function(_0x5c7036,_0xf6c22a){return _0x121c22['User'][_0x47db('0x1b')]({'attributes':['id','name',_0x47db('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x47db('0x1c')](function(_0x5c205c){if(_0x5c205c){return _0x5c7036(getChanSpyApplications(_0x490507,_0x5c205c));}return _0x5c7036([]);})[_0x47db('0x1d')](function(_0x3c338b){_0xf6c22a(_0x3c338b);});});};module[_0x47db('0x1e')]=function(_0xdbe518,_0x4e3337){var _0x58b45d=_0xdbe518['models'];return _0xdbe518[_0x47db('0x1f')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x37de3a,_0x371ca5,_0x4d7d5d){return getChanSpyPromise(_0x58b45d,_0x37de3a)[_0x47db('0x1c')](function(_0x5dfc0d){if(_0x5dfc0d&&_0x5dfc0d[_0x47db('0x19')]){return _0x58b45d[_0x47db('0x20')][_0x47db('0x21')](_0x5dfc0d);}})[_0x47db('0x1c')](function(){_0x4d7d5d();})[_0x47db('0x1d')](function(_0x5f0695){_0x4d7d5d(_0x5f0695);});},'afterUpdate':function(_0x8439a2,_0x42a444,_0x1462ed){return _0x58b45d['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x8439a2['id']}})[_0x47db('0x1c')](function(){return getChanSpyPromise(_0x58b45d,_0x8439a2);})[_0x47db('0x1c')](function(_0x265546){if(_0x265546&&_0x265546[_0x47db('0x19')]){return _0x58b45d['VoiceExtension'][_0x47db('0x21')](_0x265546);}})[_0x47db('0x1c')](function(){_0x1462ed();})[_0x47db('0x1d')](function(_0x35538d){_0x1462ed(_0x35538d);});},'afterDestroy':function(_0x14ae2d,_0x39cef1,_0x5547da){return _0x58b45d[_0x47db('0x20')][_0x47db('0x22')]({'where':{'ChanSpyId':_0x14ae2d['id']}})[_0x47db('0x1c')](function(){_0x5547da();})[_0x47db('0x1d')](function(_0x133205){_0x5547da(_0x133205);});}}});}; \ No newline at end of file +var _0xb994=['internal','name','concat','User','findAll','agent','models','define','VoiceChanSpy','voice_chanspy','then','length','bulkCreate','VoiceExtension','destroy','catch','bluebird','context','from-sip','%s%s','system','push','merge','Set','format','CDR(type)=%s','record','MixMonitor','auth','Authenticate','ChanSpy','SIP/%s,%s','options'];(function(_0x268868,_0x1979ae){var _0x3a4fcd=function(_0x58d70b){while(--_0x58d70b){_0x268868['push'](_0x268868['shift']());}};_0x3a4fcd(++_0x1979ae);}(_0xb994,0x19c));var _0x4b99=function(_0x132339,_0x330970){_0x132339=_0x132339-0x0;var _0x2fbe07=_0xb994[_0x132339];return _0x2fbe07;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x4b99('0x0'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x5cdfbb,_0x718538,_0x2361dc){var _0x3c99f9=0x1;var _0x100724=[];var _0x4ef31a={'context':_0x718538[_0x4b99('0x1')]||_0x4b99('0x2'),'exten':util['format'](_0x4b99('0x3'),_0x5cdfbb['prefix'],_0x2361dc),'type':_0x4b99('0x4'),'isApp':![],'ChanSpyId':_0x5cdfbb['id'],'UserId':_0x718538['id']};_0x100724[_0x4b99('0x5')](_[_0x4b99('0x6')]({'app':_0x4b99('0x7'),'appdata':util[_0x4b99('0x8')](_0x4b99('0x9'),'chanspy'),'priority':_0x3c99f9++},_0x4ef31a));if(_0x5cdfbb[_0x4b99('0xa')]){_0x100724['push'](_[_0x4b99('0x6')]({'app':_0x4b99('0xb'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x5cdfbb['recordingFormat']),'priority':_0x3c99f9++},_0x4ef31a));}if(_0x5cdfbb[_0x4b99('0xc')]){_0x100724[_0x4b99('0x5')](_[_0x4b99('0x6')]({'app':_0x4b99('0xd'),'appdata':_0x5cdfbb['password'],'priority':_0x3c99f9++},_0x4ef31a));}_0x100724['push'](_[_0x4b99('0x6')]({'app':_0x4b99('0xe'),'appdata':util[_0x4b99('0x8')](_0x4b99('0xf'),_0x718538['name'],_0x5cdfbb[_0x4b99('0x10')]?_0x5cdfbb[_0x4b99('0x10')]['join'](''):''),'priority':_0x3c99f9++},_0x4ef31a));if(_0x5cdfbb['record']){_0x100724[_0x4b99('0x5')](_[_0x4b99('0x6')]({'app':'StopMixMonitor','priority':_0x3c99f9++},_0x4ef31a));}return _0x100724;};var getChanSpyApplications=function(_0x52b66d,_0x59840f){var _0x269acc=[];for(var _0x980b61=0x0,_0x159606=0x1;_0x980b61<_0x59840f['length'];_0x980b61++,_0x159606=0x1){_0x269acc=_0x269acc['concat'](getUserApplications(_0x52b66d,_0x59840f[_0x980b61],_0x59840f[_0x980b61]['internal']));if(_0x59840f[_0x980b61][_0x4b99('0x11')]!=_0x59840f[_0x980b61][_0x4b99('0x12')]){_0x269acc=_0x269acc[_0x4b99('0x13')](getUserApplications(_0x52b66d,_0x59840f[_0x980b61],_0x59840f[_0x980b61][_0x4b99('0x12')]));}}return _0x269acc;};var getChanSpyPromise=function(_0x38555c,_0x3777ef){return new BPromise(function(_0x1461db,_0x3ee869){return _0x38555c[_0x4b99('0x14')][_0x4b99('0x15')]({'attributes':['id','name',_0x4b99('0x11')],'where':{'role':_0x4b99('0x16'),'chanspy':!![]},'raw':!![]})['then'](function(_0x20e818){if(_0x20e818){return _0x1461db(getChanSpyApplications(_0x3777ef,_0x20e818));}return _0x1461db([]);})['catch'](function(_0x23acd7){_0x3ee869(_0x23acd7);});});};module['exports']=function(_0x95fca1,_0x542c15){var _0x28b3d6=_0x95fca1[_0x4b99('0x17')];return _0x95fca1[_0x4b99('0x18')](_0x4b99('0x19'),attributes,{'tableName':_0x4b99('0x1a'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1e1cb4,_0x146db1,_0x514bb5){return getChanSpyPromise(_0x28b3d6,_0x1e1cb4)[_0x4b99('0x1b')](function(_0xc772a4){if(_0xc772a4&&_0xc772a4[_0x4b99('0x1c')]){return _0x28b3d6['VoiceExtension'][_0x4b99('0x1d')](_0xc772a4);}})[_0x4b99('0x1b')](function(){_0x514bb5();})['catch'](function(_0x1f7644){_0x514bb5(_0x1f7644);});},'afterUpdate':function(_0x889364,_0x223d85,_0x5c6151){return _0x28b3d6[_0x4b99('0x1e')][_0x4b99('0x1f')]({'where':{'ChanSpyId':_0x889364['id']}})['then'](function(){return getChanSpyPromise(_0x28b3d6,_0x889364);})[_0x4b99('0x1b')](function(_0x4aeb0a){if(_0x4aeb0a&&_0x4aeb0a[_0x4b99('0x1c')]){return _0x28b3d6[_0x4b99('0x1e')][_0x4b99('0x1d')](_0x4aeb0a);}})['then'](function(){_0x5c6151();})[_0x4b99('0x20')](function(_0x1b0685){_0x5c6151(_0x1b0685);});},'afterDestroy':function(_0x153a8b,_0x32918f,_0x5f4a7e){return _0x28b3d6[_0x4b99('0x1e')][_0x4b99('0x1f')]({'where':{'ChanSpyId':_0x153a8b['id']}})[_0x4b99('0x1b')](function(){_0x5f4a7e();})[_0x4b99('0x20')](function(_0x13bfcd){_0x5f4a7e(_0x13bfcd);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 5fc5919..e2248a3 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 _0x5712=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x397f37,_0x3cf86d){var _0x31cae6=function(_0x5cddb9){while(--_0x5cddb9){_0x397f37['push'](_0x397f37['shift']());}};_0x31cae6(++_0x3cf86d);}(_0x5712,0x140));var _0x2571=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5712[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x2571('0x0'));var util=require(_0x2571('0x1'));var moment=require(_0x2571('0x2'));var BPromise=require(_0x2571('0x3'));var rs=require(_0x2571('0x4'));var fs=require('fs');var Redis=require(_0x2571('0x5'));var db=require(_0x2571('0x6'))['db'];var utils=require(_0x2571('0x7'));var logger=require(_0x2571('0x8'))(_0x2571('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2571('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e19b2,_0x251ee6,_0x3ca885){return new BPromise(function(_0x204ecc,_0xda659a){return client[_0x2571('0xb')](_0x3e19b2,_0x3ca885)['then'](function(_0x1f0c98){logger['info'](_0x2571('0xc'),_0x251ee6,_0x2571('0xd'));logger[_0x2571('0xe')](_0x2571('0xf'),_0x251ee6,_0x2571('0xd'),JSON[_0x2571('0x10')](_0x1f0c98));if(_0x1f0c98[_0x2571('0x11')]){if(_0x1f0c98[_0x2571('0x11')]['code']===0x1f4){logger['error'](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0xda659a(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0x204ecc(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}else{logger[_0x2571('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x251ee6,_0x2571('0xd'));_0x204ecc(_0x1f0c98['result']['message']);}})['catch'](function(_0x4c3e11){logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x4c3e11);_0xda659a(_0x4c3e11);});});} \ No newline at end of file +var _0xdace=['request\x20sent','debug','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xdace,0xc5));var _0xedac=function(_0x320b8e,_0x1da3fe){_0x320b8e=_0x320b8e-0x0;var _0x55a10a=_0xdace[_0x320b8e];return _0x55a10a;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index bfea56f..d640a2e 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 _0xbf27=['create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0xed2e5e,_0x21775c){var _0x17a1a6=function(_0x2da190){while(--_0x2da190){_0xed2e5e['push'](_0xed2e5e['shift']());}};_0x17a1a6(++_0x21775c);}(_0xbf27,0xb9));var _0x7bf2=function(_0x1d258a,_0x578db2){_0x1d258a=_0x1d258a-0x0;var _0x45d21f=_0xbf27[_0x1d258a];return _0x45d21f;};'use strict';var multer=require(_0x7bf2('0x0'));var util=require(_0x7bf2('0x1'));var path=require(_0x7bf2('0x2'));var timeout=require(_0x7bf2('0x3'));var express=require('express');var router=express[_0x7bf2('0x4')]();var fs_extra=require(_0x7bf2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7bf2('0x6'));var config=require(_0x7bf2('0x7'));var controller=require(_0x7bf2('0x8'));router[_0x7bf2('0x9')]('/',auth[_0x7bf2('0xa')](),controller[_0x7bf2('0xb')]);router['get'](_0x7bf2('0xc'),auth['isAuthenticated'](),controller[_0x7bf2('0xd')]);router[_0x7bf2('0xe')]('/',auth[_0x7bf2('0xa')](),controller[_0x7bf2('0xf')]);router[_0x7bf2('0x10')](_0x7bf2('0xc'),auth[_0x7bf2('0xa')](),controller[_0x7bf2('0x11')]);router[_0x7bf2('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x7bf2('0x13')]);module['exports']=router; \ No newline at end of file +var _0x303d=['/:id','show','post','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x64aff8,_0x106082){var _0x5488a3=function(_0x36969c){while(--_0x36969c){_0x64aff8['push'](_0x64aff8['shift']());}};_0x5488a3(++_0x106082);}(_0x303d,0xe3));var _0xd303=function(_0x5a7e78,_0x400b57){_0x5a7e78=_0x5a7e78-0x0;var _0xa8d4a1=_0x303d[_0x5a7e78];return _0xa8d4a1;};'use strict';var multer=require(_0xd303('0x0'));var util=require(_0xd303('0x1'));var path=require(_0xd303('0x2'));var timeout=require(_0xd303('0x3'));var express=require(_0xd303('0x4'));var router=express[_0xd303('0x5')]();var fs_extra=require(_0xd303('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd303('0x7'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0xd303('0x8')]('/',auth[_0xd303('0x9')](),controller[_0xd303('0xa')]);router[_0xd303('0x8')](_0xd303('0xb'),auth['isAuthenticated'](),controller[_0xd303('0xc')]);router[_0xd303('0xd')]('/',auth[_0xd303('0x9')](),controller['create']);router[_0xd303('0xe')](_0xd303('0xb'),auth[_0xd303('0x9')](),controller[_0xd303('0xf')]);router['delete'](_0xd303('0xb'),auth[_0xd303('0x9')](),controller['destroy']);module[_0xd303('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 0aeaf68..5f9311e 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 _0x6892=['exports','STRING','name','sequelize'];(function(_0xb6fc41,_0x512e38){var _0x18a01d=function(_0x32cbf2){while(--_0x32cbf2){_0xb6fc41['push'](_0xb6fc41['shift']());}};_0x18a01d(++_0x512e38);}(_0x6892,0xef));var _0x2689=function(_0x337f9b,_0x4dcbae){_0x337f9b=_0x337f9b-0x0;var _0x15ad7b=_0x6892[_0x337f9b];return _0x15ad7b;};'use strict';var Sequelize=require(_0x2689('0x0'));module[_0x2689('0x1')]={'name':{'type':Sequelize[_0x2689('0x2')],'unique':_0x2689('0x3')},'description':{'type':Sequelize[_0x2689('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf705=['sequelize','STRING','BOOLEAN'];(function(_0x2067e9,_0x5e6a97){var _0x280ce4=function(_0x2eca23){while(--_0x2eca23){_0x2067e9['push'](_0x2067e9['shift']());}};_0x280ce4(++_0x5e6a97);}(_0xf705,0x168));var _0x5f70=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf705[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x5f70('0x0'));module['exports']={'name':{'type':Sequelize[_0x5f70('0x1')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x5f70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index d3600d5..00a927a 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 _0xef3f=['pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','filters','fields','find','body','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','create','chan_sip.so','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','readFileSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','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','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','destroy','get','Contexts','UserProfileResource','end','stack','name','send','map','VoiceContext','key','model','query','keys','intersection','attributes','length','hasOwnProperty','order','sort'];(function(_0x549555,_0x5c2217){var _0x259593=function(_0x3f6746){while(--_0x3f6746){_0x549555['push'](_0x549555['shift']());}};_0x259593(++_0x5c2217);}(_0xef3f,0x1c4));var _0xfef3=function(_0x28ebe0,_0x1dbd02){_0x28ebe0=_0x28ebe0-0x0;var _0x34dfe1=_0xef3f[_0x28ebe0];return _0x34dfe1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfef3('0x0'));var zipdir=require(_0xfef3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfef3('0x2'));var moment=require(_0xfef3('0x3'));var BPromise=require(_0xfef3('0x4'));var Mustache=require(_0xfef3('0x5'));var util=require(_0xfef3('0x6'));var path=require(_0xfef3('0x7'));var sox=require(_0xfef3('0x8'));var csv=require(_0xfef3('0x9'));var ejs=require(_0xfef3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfef3('0xb'));var squel=require('squel');var crypto=require(_0xfef3('0xc'));var jsforce=require(_0xfef3('0xd'));var deskjs=require(_0xfef3('0xe'));var toCsv=require(_0xfef3('0x9'));var querystring=require('querystring');var Papa=require(_0xfef3('0xf'));var Redis=require(_0xfef3('0x10'));var authService=require(_0xfef3('0x11'));var qs=require(_0xfef3('0x12'));var as=require(_0xfef3('0x13'));var hardwareService=require(_0xfef3('0x14'));var logger=require('../../config/logger')(_0xfef3('0x15'));var utils=require(_0xfef3('0x16'));var config=require(_0xfef3('0x17'));var licenseUtil=require(_0xfef3('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0xfef3('0x19'));var client=jayson[_0xfef3('0x1a')][_0xfef3('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x46d78c,_0x53e147,_0x5d84a7,_0x176ea3){return new BPromise(function(_0xac3c31,_0x1f8436){var _0x4b25bf=_0x176ea3||client;return _0x4b25bf[_0xfef3('0x1c')](_0x46d78c,_0x5d84a7)[_0xfef3('0x1d')](function(_0x39bbdf){logger[_0xfef3('0x1e')](_0xfef3('0x1f'),_0x53e147,_0xfef3('0x20'));logger[_0xfef3('0x21')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x53e147,'request\x20sent',JSON[_0xfef3('0x22')](_0x39bbdf));if(_0x39bbdf[_0xfef3('0x23')]){if(_0x39bbdf[_0xfef3('0x23')][_0xfef3('0x24')]===0x1f4){logger[_0xfef3('0x23')](_0xfef3('0x1f'),_0x53e147,_0x39bbdf[_0xfef3('0x23')][_0xfef3('0x25')]);return _0x1f8436(_0x39bbdf[_0xfef3('0x23')][_0xfef3('0x25')]);}logger[_0xfef3('0x23')](_0xfef3('0x1f'),_0x53e147,_0x39bbdf[_0xfef3('0x23')][_0xfef3('0x25')]);return _0xac3c31(_0x39bbdf[_0xfef3('0x23')][_0xfef3('0x25')]);}else{logger[_0xfef3('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x53e147,'request\x20sent');_0xac3c31(_0x39bbdf[_0xfef3('0x26')][_0xfef3('0x25')]);}})['catch'](function(_0x28e8ca){logger[_0xfef3('0x23')](_0xfef3('0x1f'),_0x53e147,_0x28e8ca);_0x1f8436(_0x28e8ca);});});}function respondWithStatusCode(_0x347bc6,_0x1f7bc7){_0x1f7bc7=_0x1f7bc7||0xcc;return function(_0x6ba8f0){if(_0x6ba8f0){return _0x347bc6[_0xfef3('0x27')](_0x1f7bc7);}return _0x347bc6['status'](_0x1f7bc7)['end']();};}function respondWithResult(_0x144413,_0x31b4dd){_0x31b4dd=_0x31b4dd||0xc8;return function(_0x41c616){if(_0x41c616){return _0x144413[_0xfef3('0x28')](_0x31b4dd)['json'](_0x41c616);}};}function respondWithFilteredResult(_0x31a6ec,_0x3ce617){return function(_0x195895){if(_0x195895){var _0x4a2c58=typeof _0x3ce617[_0xfef3('0x29')]===_0xfef3('0x2a')&&typeof _0x3ce617[_0xfef3('0x2b')]===_0xfef3('0x2a');var _0x518102=_0x195895['count'];var _0x53afe5=_0x4a2c58?0x0:_0x3ce617[_0xfef3('0x29')];var _0x290681=_0x4a2c58?_0x195895[_0xfef3('0x2c')]:_0x3ce617[_0xfef3('0x29')]+_0x3ce617[_0xfef3('0x2b')];var _0xac6711;if(_0x290681>=_0x518102){_0x290681=_0x518102;_0xac6711=0xc8;}else{_0xac6711=0xce;}_0x31a6ec['status'](_0xac6711);return _0x31a6ec[_0xfef3('0x2d')](_0xfef3('0x2e'),_0x53afe5+'-'+_0x290681+'/'+_0x518102)[_0xfef3('0x2f')](_0x195895);}return null;};}function patchUpdates(_0x2c3780){return function(_0x53b0f4){try{jsonpatch['apply'](_0x53b0f4,_0x2c3780,!![]);}catch(_0x22d28b){return BPromise['reject'](_0x22d28b);}return _0x53b0f4['save']();};}function saveUpdates(_0x4d7b18,_0x4d70e6){return function(_0x6baccd){if(_0x6baccd){return _0x6baccd['update'](_0x4d7b18)[_0xfef3('0x1d')](function(_0x565b82){return _0x565b82;});}return null;};}function removeEntity(_0x5dd5d0,_0x355ed8){return function(_0x463521){if(_0x463521){return _0x463521[_0xfef3('0x30')]()[_0xfef3('0x1d')](function(){var _0x396381=_0x463521[_0xfef3('0x31')]({'plain':!![]});var _0x1cf129=_0xfef3('0x32');return db[_0xfef3('0x33')][_0xfef3('0x30')]({'where':{'type':_0x1cf129,'resourceId':_0x396381['id']}})[_0xfef3('0x1d')](function(){return _0x463521;});})[_0xfef3('0x1d')](function(){_0x5dd5d0['status'](0xcc)[_0xfef3('0x34')]();});}};}function handleEntityNotFound(_0x3fe519,_0x1402b1){return function(_0x3fadaa){if(!_0x3fadaa){_0x3fe519[_0xfef3('0x27')](0x194);}return _0x3fadaa;};}function handleError(_0x593209,_0x2fce83){_0x2fce83=_0x2fce83||0x1f4;return function(_0x361c82){logger[_0xfef3('0x23')](_0x361c82[_0xfef3('0x35')]);if(_0x361c82['name']){delete _0x361c82[_0xfef3('0x36')];}_0x593209[_0xfef3('0x28')](_0x2fce83)[_0xfef3('0x37')](_0x361c82);};}exports['index']=function(_0x511319,_0x50be70){var _0x2198cc={},_0x1a859a={},_0x4d4a48={'count':0x0,'rows':[]};var _0x595021=_[_0xfef3('0x38')](db[_0xfef3('0x39')]['rawAttributes'],function(_0x228fd8){return{'name':_0x228fd8['fieldName'],'type':_0x228fd8['type'][_0xfef3('0x3a')]};});_0x1a859a[_0xfef3('0x3b')]=_['map'](_0x595021,_0xfef3('0x36'));_0x1a859a[_0xfef3('0x3c')]=_[_0xfef3('0x3d')](_0x511319[_0xfef3('0x3c')]);_0x1a859a['filters']=_[_0xfef3('0x3e')](_0x1a859a[_0xfef3('0x3b')],_0x1a859a[_0xfef3('0x3c')]);_0x2198cc[_0xfef3('0x3f')]=_[_0xfef3('0x3e')](_0x1a859a[_0xfef3('0x3b')],qs['fields'](_0x511319[_0xfef3('0x3c')]['fields']));_0x2198cc[_0xfef3('0x3f')]=_0x2198cc[_0xfef3('0x3f')][_0xfef3('0x40')]?_0x2198cc['attributes']:_0x1a859a[_0xfef3('0x3b')];if(!_0x511319[_0xfef3('0x3c')][_0xfef3('0x41')]('nolimit')){_0x2198cc['limit']=qs[_0xfef3('0x2b')](_0x511319[_0xfef3('0x3c')][_0xfef3('0x2b')]);_0x2198cc[_0xfef3('0x29')]=qs[_0xfef3('0x29')](_0x511319[_0xfef3('0x3c')]['offset']);}_0x2198cc[_0xfef3('0x42')]=qs[_0xfef3('0x43')](_0x511319[_0xfef3('0x3c')]['sort']);_0x2198cc['where']=qs['filters'](_[_0xfef3('0x44')](_0x511319[_0xfef3('0x3c')],_0x1a859a['filters']),_0x595021);if(_0x511319[_0xfef3('0x3c')]['filter']){_0x2198cc[_0xfef3('0x45')]=_[_0xfef3('0x46')](_0x2198cc[_0xfef3('0x45')],{'$or':_['map'](_0x595021,function(_0x2a152d){if(_0x2a152d[_0xfef3('0x47')]!==_0xfef3('0x48')){var _0x276f0d={};_0x276f0d[_0x2a152d[_0xfef3('0x36')]]={'$like':'%'+_0x511319[_0xfef3('0x3c')][_0xfef3('0x49')]+'%'};return _0x276f0d;}})});}_0x2198cc=_[_0xfef3('0x46')]({},_0x2198cc,_0x511319[_0xfef3('0x4a')]);var _0x4b7350={'where':_0x2198cc[_0xfef3('0x45')]};return db[_0xfef3('0x39')][_0xfef3('0x2c')](_0x4b7350)[_0xfef3('0x1d')](function(_0x4ffb72){_0x4d4a48[_0xfef3('0x2c')]=_0x4ffb72;if(_0x511319[_0xfef3('0x3c')][_0xfef3('0x4b')]){_0x2198cc[_0xfef3('0x4c')]=[{'all':!![]}];}return db[_0xfef3('0x39')][_0xfef3('0x4d')](_0x2198cc);})['then'](function(_0x11081a){_0x4d4a48[_0xfef3('0x4e')]=_0x11081a;return _0x4d4a48;})['then'](respondWithFilteredResult(_0x50be70,_0x2198cc))[_0xfef3('0x4f')](handleError(_0x50be70,null));};exports[_0xfef3('0x50')]=function(_0x2642b9,_0x351264){var _0x148782={'raw':![],'where':{'id':_0x2642b9[_0xfef3('0x51')]['id']}},_0x110084={};_0x110084[_0xfef3('0x3b')]=_[_0xfef3('0x3d')](db[_0xfef3('0x39')][_0xfef3('0x52')]);_0x110084[_0xfef3('0x3c')]=_[_0xfef3('0x3d')](_0x2642b9['query']);_0x110084[_0xfef3('0x53')]=_[_0xfef3('0x3e')](_0x110084['model'],_0x110084[_0xfef3('0x3c')]);_0x148782[_0xfef3('0x3f')]=_[_0xfef3('0x3e')](_0x110084['model'],qs[_0xfef3('0x54')](_0x2642b9[_0xfef3('0x3c')][_0xfef3('0x54')]));_0x148782[_0xfef3('0x3f')]=_0x148782[_0xfef3('0x3f')][_0xfef3('0x40')]?_0x148782[_0xfef3('0x3f')]:_0x110084[_0xfef3('0x3b')];if(_0x2642b9[_0xfef3('0x3c')][_0xfef3('0x4b')]){_0x148782[_0xfef3('0x4c')]=[{'all':!![]}];}_0x148782=_['merge']({},_0x148782,_0x2642b9['options']);return db['VoiceContext'][_0xfef3('0x55')](_0x148782)[_0xfef3('0x1d')](handleEntityNotFound(_0x351264,null))[_0xfef3('0x1d')](respondWithResult(_0x351264,null))['catch'](handleError(_0x351264,null));};exports['create']=function(_0x1b7dd6,_0x2a2866,_0x2bbfb5){var _0x30136d;return db['VoiceContext']['create'](_0x1b7dd6[_0xfef3('0x56')],{'raw':!![]})['then'](function(_0x56b088){_0x30136d=_0x56b088;return db[_0xfef3('0x39')]['findAll']({'raw':!![]});})[_0xfef3('0x1d')](function(_0x2b1696){var _0x41366f=fs['readFileSync'](path[_0xfef3('0x57')](config[_0xfef3('0x58')],_0xfef3('0x59')),_0xfef3('0x5a'));var _0x2650d6=ejs[_0xfef3('0x5b')](_0x41366f,{'contexts':_0x2b1696||[]});fs[_0xfef3('0x5c')](_0xfef3('0x5d'),_0x2650d6);})[_0xfef3('0x1d')](function(){return respondWithRpcPromise(_0xfef3('0x5e'),_0xfef3('0x5f'),{'module':_0xfef3('0x60')});})[_0xfef3('0x1d')](function(){var _0x2d60c5=_0x1b7dd6[_0xfef3('0x61')][_0xfef3('0x31')]({'plain':!![]});if(!_0x2d60c5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d60c5['role']===_0xfef3('0x61')){var _0x37fd42=_0x30136d[_0xfef3('0x31')]({'plain':!![]});return db[_0xfef3('0x62')][_0xfef3('0x55')]({'where':{'name':_0xfef3('0x32'),'userProfileId':_0x2d60c5[_0xfef3('0x63')]},'raw':!![]})[_0xfef3('0x1d')](function(_0xb5dd3){if(_0xb5dd3&&_0xb5dd3[_0xfef3('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x37fd42[_0xfef3('0x36')],'resourceId':_0x37fd42['id'],'type':_0xb5dd3[_0xfef3('0x36')],'sectionId':_0xb5dd3['id']},{})[_0xfef3('0x1d')](function(){return _0x30136d;});}else{return _0x30136d;}})[_0xfef3('0x4f')](function(_0x3688f3){logger[_0xfef3('0x23')](_0xfef3('0x65'),_0x3688f3);throw _0x3688f3;});}return _0x30136d;})[_0xfef3('0x1d')](respondWithResult(_0x2a2866,0xc9))[_0xfef3('0x4f')](handleError(_0x2a2866,null));};exports[_0xfef3('0x66')]=function(_0x3bd0b3,_0x5e768f,_0x4a6a99){var _0x297fb4;return db[_0xfef3('0x39')][_0xfef3('0x55')]({'where':{'id':_0x3bd0b3['params']['id']}})['then'](handleEntityNotFound(_0x5e768f,null))['then'](saveUpdates(_0x3bd0b3[_0xfef3('0x56')],null))['then'](function(_0x6753c){if(_0x6753c){_0x297fb4=_0x6753c;return db[_0xfef3('0x39')][_0xfef3('0x4d')]({'raw':!![]});}})[_0xfef3('0x1d')](function(_0x58c6e5){var _0x357945=fs[_0xfef3('0x67')](path[_0xfef3('0x57')](config[_0xfef3('0x58')],_0xfef3('0x59')),_0xfef3('0x5a'));var _0xbcea0d=ejs[_0xfef3('0x5b')](_0x357945,{'contexts':_0x58c6e5||[]});fs[_0xfef3('0x5c')](_0xfef3('0x5d'),_0xbcea0d);})[_0xfef3('0x1d')](function(){return respondWithRpcPromise(_0xfef3('0x5e'),'update',{'module':_0xfef3('0x60')});})['then'](function(){return _0x297fb4;})[_0xfef3('0x1d')](respondWithResult(_0x5e768f,null))['catch'](handleError(_0x5e768f,null));};exports['destroy']=function(_0xeb216b,_0x2344d1,_0x31aca5){var _0x50c36e;return db[_0xfef3('0x39')][_0xfef3('0x55')]({'where':{'id':_0xeb216b[_0xfef3('0x51')]['id']}})[_0xfef3('0x1d')](handleEntityNotFound(_0x2344d1,null))[_0xfef3('0x1d')](removeEntity(_0x2344d1,null))[_0xfef3('0x1d')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0xfef3('0x1d')](function(_0x1a7cfc){var _0x3cc8fe=fs[_0xfef3('0x67')](path['join'](config['root'],'server/files/templates/context.ejs'),_0xfef3('0x5a'));var _0x2fca57=ejs[_0xfef3('0x5b')](_0x3cc8fe,{'contexts':_0x1a7cfc});fs['writeFileSync'](_0xfef3('0x5d'),_0x2fca57);return respondWithRpcPromise(_0xfef3('0x5e'),_0xfef3('0x30'),{'module':_0xfef3('0x60')});})[_0xfef3('0x4f')](handleError(_0x2344d1,null));}; \ No newline at end of file +var _0x4f74=['jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','map','VoiceContext','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','readFileSync','join','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','server/files/templates/context.ejs','utf8','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x698173,_0x32fca1){var _0x18898e=function(_0x2f9e4b){while(--_0x2f9e4b){_0x698173['push'](_0x698173['shift']());}};_0x18898e(++_0x32fca1);}(_0x4f74,0x17f));var _0x44f7=function(_0x4851ff,_0x1c9a8d){_0x4851ff=_0x4851ff-0x0;var _0x26773b=_0x4f74[_0x4851ff];return _0x26773b;};'use strict';var emlformat=require(_0x44f7('0x0'));var rimraf=require(_0x44f7('0x1'));var zipdir=require(_0x44f7('0x2'));var jsonpatch=require(_0x44f7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x44f7('0x4'));var Mustache=require(_0x44f7('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x44f7('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44f7('0x7'));var _=require(_0x44f7('0x8'));var squel=require(_0x44f7('0x9'));var crypto=require(_0x44f7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x44f7('0xb'));var toCsv=require(_0x44f7('0x6'));var querystring=require('querystring');var Papa=require(_0x44f7('0xc'));var Redis=require(_0x44f7('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44f7('0xe'));var logger=require(_0x44f7('0xf'))(_0x44f7('0x10'));var utils=require(_0x44f7('0x11'));var config=require(_0x44f7('0x12'));var licenseUtil=require(_0x44f7('0x13'));var db=require(_0x44f7('0x14'))['db'];var jayson=require(_0x44f7('0x15'));var client=jayson[_0x44f7('0x16')][_0x44f7('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xddbed7,_0x5049a0,_0x210344,_0x5b6bc0){return new BPromise(function(_0x15e0b5,_0xf581a4){var _0x57e982=_0x5b6bc0||client;return _0x57e982['request'](_0xddbed7,_0x210344)[_0x44f7('0x18')](function(_0x10640c){logger[_0x44f7('0x19')](_0x44f7('0x1a'),_0x5049a0,_0x44f7('0x1b'));logger['debug'](_0x44f7('0x1c'),_0x5049a0,_0x44f7('0x1b'),JSON[_0x44f7('0x1d')](_0x10640c));if(_0x10640c[_0x44f7('0x1e')]){if(_0x10640c[_0x44f7('0x1e')][_0x44f7('0x1f')]===0x1f4){logger[_0x44f7('0x1e')](_0x44f7('0x1a'),_0x5049a0,_0x10640c[_0x44f7('0x1e')][_0x44f7('0x20')]);return _0xf581a4(_0x10640c['error']['message']);}logger[_0x44f7('0x1e')](_0x44f7('0x1a'),_0x5049a0,_0x10640c[_0x44f7('0x1e')]['message']);return _0x15e0b5(_0x10640c[_0x44f7('0x1e')]['message']);}else{logger[_0x44f7('0x19')]('VoiceContext,\x20%s,\x20%s',_0x5049a0,_0x44f7('0x1b'));_0x15e0b5(_0x10640c[_0x44f7('0x21')][_0x44f7('0x20')]);}})['catch'](function(_0x1f6082){logger[_0x44f7('0x1e')](_0x44f7('0x1a'),_0x5049a0,_0x1f6082);_0xf581a4(_0x1f6082);});});}function respondWithStatusCode(_0x494489,_0xe8f022){_0xe8f022=_0xe8f022||0xcc;return function(_0x3f7793){if(_0x3f7793){return _0x494489['sendStatus'](_0xe8f022);}return _0x494489['status'](_0xe8f022)[_0x44f7('0x22')]();};}function respondWithResult(_0x45d53e,_0x32e7bc){_0x32e7bc=_0x32e7bc||0xc8;return function(_0x1125de){if(_0x1125de){return _0x45d53e[_0x44f7('0x23')](_0x32e7bc)[_0x44f7('0x24')](_0x1125de);}};}function respondWithFilteredResult(_0x54328c,_0x1d9804){return function(_0x4cbf2f){if(_0x4cbf2f){var _0x1a90ca=typeof _0x1d9804[_0x44f7('0x25')]===_0x44f7('0x26')&&typeof _0x1d9804['limit']===_0x44f7('0x26');var _0x407e4f=_0x4cbf2f['count'];var _0x1221e8=_0x1a90ca?0x0:_0x1d9804[_0x44f7('0x25')];var _0x3ec1a4=_0x1a90ca?_0x4cbf2f[_0x44f7('0x27')]:_0x1d9804[_0x44f7('0x25')]+_0x1d9804[_0x44f7('0x28')];var _0x560efb;if(_0x3ec1a4>=_0x407e4f){_0x3ec1a4=_0x407e4f;_0x560efb=0xc8;}else{_0x560efb=0xce;}_0x54328c[_0x44f7('0x23')](_0x560efb);return _0x54328c[_0x44f7('0x29')](_0x44f7('0x2a'),_0x1221e8+'-'+_0x3ec1a4+'/'+_0x407e4f)[_0x44f7('0x24')](_0x4cbf2f);}return null;};}function patchUpdates(_0x51b1d9){return function(_0x3b1865){try{jsonpatch[_0x44f7('0x2b')](_0x3b1865,_0x51b1d9,!![]);}catch(_0x4c226e){return BPromise[_0x44f7('0x2c')](_0x4c226e);}return _0x3b1865[_0x44f7('0x2d')]();};}function saveUpdates(_0x6099b2,_0x1c9c93){return function(_0x31708d){if(_0x31708d){return _0x31708d[_0x44f7('0x2e')](_0x6099b2)['then'](function(_0x8213b0){return _0x8213b0;});}return null;};}function removeEntity(_0x236b0d,_0x246fcd){return function(_0x4b08eb){if(_0x4b08eb){return _0x4b08eb[_0x44f7('0x2f')]()['then'](function(){var _0x25dd82=_0x4b08eb[_0x44f7('0x30')]({'plain':!![]});var _0x35c701=_0x44f7('0x31');return db[_0x44f7('0x32')][_0x44f7('0x2f')]({'where':{'type':_0x35c701,'resourceId':_0x25dd82['id']}})[_0x44f7('0x18')](function(){return _0x4b08eb;});})[_0x44f7('0x18')](function(){_0x236b0d[_0x44f7('0x23')](0xcc)[_0x44f7('0x22')]();});}};}function handleEntityNotFound(_0xefb5ec,_0x5aff46){return function(_0x163130){if(!_0x163130){_0xefb5ec['sendStatus'](0x194);}return _0x163130;};}function handleError(_0x4ed47b,_0x27f13e){_0x27f13e=_0x27f13e||0x1f4;return function(_0x48aff6){logger['error'](_0x48aff6[_0x44f7('0x33')]);if(_0x48aff6['name']){delete _0x48aff6[_0x44f7('0x34')];}_0x4ed47b[_0x44f7('0x23')](_0x27f13e)[_0x44f7('0x35')](_0x48aff6);};}exports['index']=function(_0x3d1ea6,_0x5bf1d9){var _0x330ca1={},_0x36db0d={},_0x1f4a47={'count':0x0,'rows':[]};var _0x50cd4a=_[_0x44f7('0x36')](db[_0x44f7('0x37')]['rawAttributes'],function(_0x2b8b42){return{'name':_0x2b8b42[_0x44f7('0x38')],'type':_0x2b8b42[_0x44f7('0x39')][_0x44f7('0x3a')]};});_0x36db0d[_0x44f7('0x3b')]=_[_0x44f7('0x36')](_0x50cd4a,'name');_0x36db0d[_0x44f7('0x3c')]=_[_0x44f7('0x3d')](_0x3d1ea6[_0x44f7('0x3c')]);_0x36db0d[_0x44f7('0x3e')]=_[_0x44f7('0x3f')](_0x36db0d['model'],_0x36db0d[_0x44f7('0x3c')]);_0x330ca1['attributes']=_['intersection'](_0x36db0d['model'],qs[_0x44f7('0x40')](_0x3d1ea6['query'][_0x44f7('0x40')]));_0x330ca1[_0x44f7('0x41')]=_0x330ca1[_0x44f7('0x41')]['length']?_0x330ca1[_0x44f7('0x41')]:_0x36db0d[_0x44f7('0x3b')];if(!_0x3d1ea6[_0x44f7('0x3c')]['hasOwnProperty'](_0x44f7('0x42'))){_0x330ca1[_0x44f7('0x28')]=qs[_0x44f7('0x28')](_0x3d1ea6[_0x44f7('0x3c')][_0x44f7('0x28')]);_0x330ca1[_0x44f7('0x25')]=qs[_0x44f7('0x25')](_0x3d1ea6[_0x44f7('0x3c')][_0x44f7('0x25')]);}_0x330ca1['order']=qs[_0x44f7('0x43')](_0x3d1ea6[_0x44f7('0x3c')]['sort']);_0x330ca1[_0x44f7('0x44')]=qs[_0x44f7('0x3e')](_[_0x44f7('0x45')](_0x3d1ea6[_0x44f7('0x3c')],_0x36db0d[_0x44f7('0x3e')]),_0x50cd4a);if(_0x3d1ea6[_0x44f7('0x3c')]['filter']){_0x330ca1[_0x44f7('0x44')]=_['merge'](_0x330ca1['where'],{'$or':_[_0x44f7('0x36')](_0x50cd4a,function(_0x49a263){if(_0x49a263[_0x44f7('0x39')]!==_0x44f7('0x46')){var _0x1e85e7={};_0x1e85e7[_0x49a263[_0x44f7('0x34')]]={'$like':'%'+_0x3d1ea6['query']['filter']+'%'};return _0x1e85e7;}})});}_0x330ca1=_[_0x44f7('0x47')]({},_0x330ca1,_0x3d1ea6[_0x44f7('0x48')]);var _0x2489e2={'where':_0x330ca1[_0x44f7('0x44')]};return db['VoiceContext'][_0x44f7('0x27')](_0x2489e2)[_0x44f7('0x18')](function(_0x38da04){_0x1f4a47['count']=_0x38da04;if(_0x3d1ea6[_0x44f7('0x3c')]['includeAll']){_0x330ca1[_0x44f7('0x49')]=[{'all':!![]}];}return db[_0x44f7('0x37')][_0x44f7('0x4a')](_0x330ca1);})[_0x44f7('0x18')](function(_0x1de113){_0x1f4a47[_0x44f7('0x4b')]=_0x1de113;return _0x1f4a47;})['then'](respondWithFilteredResult(_0x5bf1d9,_0x330ca1))[_0x44f7('0x4c')](handleError(_0x5bf1d9,null));};exports[_0x44f7('0x4d')]=function(_0x2d7892,_0x289813){var _0x451feb={'raw':![],'where':{'id':_0x2d7892[_0x44f7('0x4e')]['id']}},_0x46a20f={};_0x46a20f['model']=_['keys'](db[_0x44f7('0x37')][_0x44f7('0x4f')]);_0x46a20f['query']=_[_0x44f7('0x3d')](_0x2d7892[_0x44f7('0x3c')]);_0x46a20f[_0x44f7('0x3e')]=_[_0x44f7('0x3f')](_0x46a20f[_0x44f7('0x3b')],_0x46a20f['query']);_0x451feb[_0x44f7('0x41')]=_[_0x44f7('0x3f')](_0x46a20f[_0x44f7('0x3b')],qs['fields'](_0x2d7892[_0x44f7('0x3c')][_0x44f7('0x40')]));_0x451feb[_0x44f7('0x41')]=_0x451feb['attributes'][_0x44f7('0x50')]?_0x451feb['attributes']:_0x46a20f[_0x44f7('0x3b')];if(_0x2d7892[_0x44f7('0x3c')][_0x44f7('0x51')]){_0x451feb[_0x44f7('0x49')]=[{'all':!![]}];}_0x451feb=_['merge']({},_0x451feb,_0x2d7892['options']);return db[_0x44f7('0x37')][_0x44f7('0x52')](_0x451feb)[_0x44f7('0x18')](handleEntityNotFound(_0x289813,null))['then'](respondWithResult(_0x289813,null))[_0x44f7('0x4c')](handleError(_0x289813,null));};exports[_0x44f7('0x53')]=function(_0x1074a1,_0x24a5ed,_0x134756){var _0x56c85a;return db[_0x44f7('0x37')][_0x44f7('0x53')](_0x1074a1[_0x44f7('0x54')],{'raw':!![]})[_0x44f7('0x18')](function(_0x4d6a41){_0x56c85a=_0x4d6a41;return db[_0x44f7('0x37')][_0x44f7('0x4a')]({'raw':!![]});})[_0x44f7('0x18')](function(_0x31a852){var _0x411cdb=fs[_0x44f7('0x55')](path[_0x44f7('0x56')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x398848=ejs[_0x44f7('0x57')](_0x411cdb,{'contexts':_0x31a852||[]});fs['writeFileSync'](_0x44f7('0x58'),_0x398848);})['then'](function(){return respondWithRpcPromise(_0x44f7('0x59'),_0x44f7('0x53'),{'module':_0x44f7('0x5a')});})[_0x44f7('0x18')](function(){var _0xec03e4=_0x1074a1[_0x44f7('0x5b')][_0x44f7('0x30')]({'plain':!![]});if(!_0xec03e4)throw new Error(_0x44f7('0x5c'));if(_0xec03e4['role']==='user'){var _0x161c61=_0x56c85a['get']({'plain':!![]});return db[_0x44f7('0x5d')][_0x44f7('0x52')]({'where':{'name':_0x44f7('0x31'),'userProfileId':_0xec03e4[_0x44f7('0x5e')]},'raw':!![]})[_0x44f7('0x18')](function(_0x25122a){if(_0x25122a&&_0x25122a[_0x44f7('0x5f')]===0x0){return db['UserProfileResource'][_0x44f7('0x53')]({'name':_0x161c61['name'],'resourceId':_0x161c61['id'],'type':_0x25122a[_0x44f7('0x34')],'sectionId':_0x25122a['id']},{})[_0x44f7('0x18')](function(){return _0x56c85a;});}else{return _0x56c85a;}})[_0x44f7('0x4c')](function(_0xf12f6f){logger[_0x44f7('0x1e')](_0x44f7('0x60'),_0xf12f6f);throw _0xf12f6f;});}return _0x56c85a;})['then'](respondWithResult(_0x24a5ed,0xc9))[_0x44f7('0x4c')](handleError(_0x24a5ed,null));};exports[_0x44f7('0x2e')]=function(_0x445bf1,_0x279653,_0x231383){var _0x11da66;return db[_0x44f7('0x37')][_0x44f7('0x52')]({'where':{'id':_0x445bf1['params']['id']}})[_0x44f7('0x18')](handleEntityNotFound(_0x279653,null))[_0x44f7('0x18')](saveUpdates(_0x445bf1[_0x44f7('0x54')],null))['then'](function(_0x140211){if(_0x140211){_0x11da66=_0x140211;return db[_0x44f7('0x37')][_0x44f7('0x4a')]({'raw':!![]});}})['then'](function(_0x8356a3){var _0x372891=fs[_0x44f7('0x55')](path[_0x44f7('0x56')](config[_0x44f7('0x61')],_0x44f7('0x62')),_0x44f7('0x63'));var _0x17f887=ejs[_0x44f7('0x57')](_0x372891,{'contexts':_0x8356a3||[]});fs[_0x44f7('0x64')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x17f887);})[_0x44f7('0x18')](function(){return respondWithRpcPromise(_0x44f7('0x59'),_0x44f7('0x2e'),{'module':_0x44f7('0x5a')});})[_0x44f7('0x18')](function(){return _0x11da66;})['then'](respondWithResult(_0x279653,null))[_0x44f7('0x4c')](handleError(_0x279653,null));};exports[_0x44f7('0x2f')]=function(_0x2a9ca4,_0x1b155a,_0xec9ac6){var _0x66111c;return db['VoiceContext'][_0x44f7('0x52')]({'where':{'id':_0x2a9ca4[_0x44f7('0x4e')]['id']}})[_0x44f7('0x18')](handleEntityNotFound(_0x1b155a,null))[_0x44f7('0x18')](removeEntity(_0x1b155a,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x44f7('0x18')](function(_0xa848a1){var _0x36159a=fs[_0x44f7('0x55')](path[_0x44f7('0x56')](config['root'],_0x44f7('0x62')),_0x44f7('0x63'));var _0x5eb88f=ejs[_0x44f7('0x57')](_0x36159a,{'contexts':_0xa848a1});fs['writeFileSync'](_0x44f7('0x58'),_0x5eb88f);return respondWithRpcPromise(_0x44f7('0x59'),'destroy',{'module':_0x44f7('0x5a')});})[_0x44f7('0x4c')](handleError(_0x1b155a,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index d080ad7..600fc9c 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 _0xbc5e=['path','rimraf','./voiceContext.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2f02d9,_0x30b2d0){var _0x23ebd2=function(_0x45e9bf){while(--_0x45e9bf){_0x2f02d9['push'](_0x2f02d9['shift']());}};_0x23ebd2(++_0x30b2d0);}(_0xbc5e,0x7d));var _0xebc5=function(_0x3d436e,_0x494ece){_0x3d436e=_0x3d436e-0x0;var _0x5a7873=_0xbc5e[_0x3d436e];return _0x5a7873;};'use strict';var _=require(_0xebc5('0x0'));var util=require(_0xebc5('0x1'));var logger=require(_0xebc5('0x2'))(_0xebc5('0x3'));var moment=require(_0xebc5('0x4'));var BPromise=require(_0xebc5('0x5'));var rp=require(_0xebc5('0x6'));var fs=require('fs');var path=require(_0xebc5('0x7'));var rimraf=require(_0xebc5('0x8'));var config=require('../../config/environment');var attributes=require(_0xebc5('0x9'));module[_0xebc5('0xa')]=function(_0x19f4c6,_0x2cbf91){return _0x19f4c6[_0xebc5('0xb')]('VoiceContext',attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5b0=['path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4ee799,_0x22e2c2){var _0x26fe5b=function(_0x52b3e9){while(--_0x52b3e9){_0x4ee799['push'](_0x4ee799['shift']());}};_0x26fe5b(++_0x22e2c2);}(_0xd5b0,0x16e));var _0x0d5b=function(_0x5a1804,_0x5f12a5){_0x5a1804=_0x5a1804-0x0;var _0x4087d2=_0xd5b0[_0x5a1804];return _0x4087d2;};'use strict';var _=require(_0x0d5b('0x0'));var util=require(_0x0d5b('0x1'));var logger=require(_0x0d5b('0x2'))(_0x0d5b('0x3'));var moment=require('moment');var BPromise=require(_0x0d5b('0x4'));var rp=require(_0x0d5b('0x5'));var fs=require('fs');var path=require(_0x0d5b('0x6'));var rimraf=require(_0x0d5b('0x7'));var config=require(_0x0d5b('0x8'));var attributes=require(_0x0d5b('0x9'));module[_0x0d5b('0xa')]=function(_0x52b1f6,_0x4036b4){return _0x52b1f6[_0x0d5b('0xb')]('VoiceContext',attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index a91f2b0..3c95c06 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 _0x0f88=['../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1ffd67,_0x1c18ba){var _0xce170f=function(_0x16cdb2){while(--_0x16cdb2){_0x1ffd67['push'](_0x1ffd67['shift']());}};_0xce170f(++_0x1c18ba);}(_0x0f88,0x1d9));var _0x80f8=function(_0x4a7843,_0x24f6d1){_0x4a7843=_0x4a7843-0x0;var _0x2c57fe=_0x0f88[_0x4a7843];return _0x2c57fe;};'use strict';var _=require(_0x80f8('0x0'));var util=require(_0x80f8('0x1'));var moment=require(_0x80f8('0x2'));var BPromise=require(_0x80f8('0x3'));var rs=require(_0x80f8('0x4'));var fs=require('fs');var Redis=require(_0x80f8('0x5'));var db=require(_0x80f8('0x6'))['db'];var utils=require(_0x80f8('0x7'));var logger=require('../../config/logger')(_0x80f8('0x8'));var config=require('../../config/environment');var jayson=require(_0x80f8('0x9'));var client=jayson[_0x80f8('0xa')][_0x80f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18cd5e,_0x3db34c,_0x279479){return new BPromise(function(_0x3d6ad3,_0x2bb7aa){return client[_0x80f8('0xc')](_0x18cd5e,_0x279479)[_0x80f8('0xd')](function(_0x26c259){logger[_0x80f8('0xe')](_0x80f8('0xf'),_0x3db34c,_0x80f8('0x10'));logger[_0x80f8('0x11')](_0x80f8('0x12'),_0x3db34c,_0x80f8('0x10'),JSON[_0x80f8('0x13')](_0x26c259));if(_0x26c259[_0x80f8('0x14')]){if(_0x26c259[_0x80f8('0x14')]['code']===0x1f4){logger[_0x80f8('0x14')](_0x80f8('0xf'),_0x3db34c,_0x26c259[_0x80f8('0x14')]['message']);return _0x2bb7aa(_0x26c259[_0x80f8('0x14')][_0x80f8('0x15')]);}logger[_0x80f8('0x14')]('VoiceContext,\x20%s,\x20%s',_0x3db34c,_0x26c259['error']['message']);return _0x3d6ad3(_0x26c259['error'][_0x80f8('0x15')]);}else{logger['info'](_0x80f8('0xf'),_0x3db34c,_0x80f8('0x10'));_0x3d6ad3(_0x26c259[_0x80f8('0x16')][_0x80f8('0x15')]);}})[_0x80f8('0x17')](function(_0x12e53c){logger[_0x80f8('0x14')](_0x80f8('0xf'),_0x3db34c,_0x12e53c);_0x2bb7aa(_0x12e53c);});});} \ No newline at end of file +var _0x51c5=['code','message','VoiceContext,\x20%s,\x20%s','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug','request\x20sent','stringify','error'];(function(_0x26d252,_0x3d7e71){var _0x5cd2be=function(_0xd7c16){while(--_0xd7c16){_0x26d252['push'](_0x26d252['shift']());}};_0x5cd2be(++_0x3d7e71);}(_0x51c5,0x8f));var _0x551c=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x51c5[_0x101e7b];return _0x4995c0;};'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']('VoiceContext,\x20%s,\x20%s',_0x196955,'request\x20sent');logger[_0x551c('0xe')]('VoiceContext,\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')]('VoiceContext,\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);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 51e6667..9e5d2ba 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 _0x6c50=['../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x31e8c6,_0x36550c){var _0x5bd5bb=function(_0xe6fcef){while(--_0xe6fcef){_0x31e8c6['push'](_0x31e8c6['shift']());}};_0x5bd5bb(++_0x36550c);}(_0x6c50,0xa4));var _0x06c5=function(_0x5adf24,_0x2e96a0){_0x5adf24=_0x5adf24-0x0;var _0x2de9ba=_0x6c50[_0x5adf24];return _0x2de9ba;};'use strict';var multer=require(_0x06c5('0x0'));var util=require(_0x06c5('0x1'));var path=require(_0x06c5('0x2'));var timeout=require(_0x06c5('0x3'));var express=require('express');var router=express[_0x06c5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x06c5('0x5'));var interaction=require(_0x06c5('0x6'));var config=require(_0x06c5('0x7'));var controller=require(_0x06c5('0x8'));router[_0x06c5('0x9')]('/',auth[_0x06c5('0xa')](),controller[_0x06c5('0xb')]);router[_0x06c5('0x9')](_0x06c5('0xc'),auth[_0x06c5('0xa')](),controller[_0x06c5('0xd')]);router['get'](_0x06c5('0xe'),auth[_0x06c5('0xa')](),controller[_0x06c5('0xf')]);router[_0x06c5('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x06c5('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x06c5('0xe'),auth['isAuthenticated'](),controller[_0x06c5('0x11')]);module[_0x06c5('0x12')]=router; \ No newline at end of file +var _0x6ce9=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x55da99,_0x4a6b0c){var _0x575612=function(_0x9ebd8){while(--_0x9ebd8){_0x55da99['push'](_0x55da99['shift']());}};_0x575612(++_0x4a6b0c);}(_0x6ce9,0xe1));var _0x96ce=function(_0x4c44fe,_0x2a45b2){_0x4c44fe=_0x4c44fe-0x0;var _0x36b26e=_0x6ce9[_0x4c44fe];return _0x36b26e;};'use strict';var multer=require(_0x96ce('0x0'));var util=require(_0x96ce('0x1'));var path=require(_0x96ce('0x2'));var timeout=require(_0x96ce('0x3'));var express=require(_0x96ce('0x4'));var router=express[_0x96ce('0x5')]();var fs_extra=require(_0x96ce('0x6'));var auth=require(_0x96ce('0x7'));var interaction=require(_0x96ce('0x8'));var config=require('../../config/environment');var controller=require(_0x96ce('0x9'));router[_0x96ce('0xa')]('/',auth[_0x96ce('0xb')](),controller[_0x96ce('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x96ce('0xd')]);router[_0x96ce('0xa')](_0x96ce('0xe'),auth[_0x96ce('0xb')](),controller[_0x96ce('0xf')]);router[_0x96ce('0x10')]('/',auth['isAuthenticated'](),controller[_0x96ce('0x11')]);router[_0x96ce('0x12')](_0x96ce('0xe'),auth[_0x96ce('0xb')](),controller[_0x96ce('0x13')]);router['delete'](_0x96ce('0xe'),auth['isAuthenticated'](),controller[_0x96ce('0x14')]);module[_0x96ce('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index b9f7036..281dd47 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 _0x9c44=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0x49c4('0x0')]},'channel':{'type':Sequelize[_0x49c4('0x0')]},'channelstate':{'type':Sequelize[_0x49c4('0x1')]},'channelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'calleridnum':{'type':Sequelize[_0x49c4('0x0')]},'calleridname':{'type':Sequelize[_0x49c4('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x49c4('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x49c4('0x0')]},'exten':{'type':Sequelize[_0x49c4('0x0')]},'priority':{'type':Sequelize[_0x49c4('0x1')]},'uniqueid':{'type':Sequelize[_0x49c4('0x0')]},'linkedid':{'type':Sequelize[_0x49c4('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x49c4('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridnum':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridname':{'type':Sequelize[_0x49c4('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x49c4('0x0')]},'destaccountcode':{'type':Sequelize[_0x49c4('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x49c4('0x0')]},'destpriority':{'type':Sequelize[_0x49c4('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x49c4('0x0')]},'dialstatus':{'type':Sequelize[_0x49c4('0x0')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x49c4('0x2')]},'endtime':{'type':Sequelize[_0x49c4('0x2')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x49c4('0x3')},'routeId':{'type':Sequelize[_0x49c4('0x1')]},'duration':{'type':Sequelize[_0x49c4('0x1')]},'holdtime':{'type':Sequelize[_0x49c4('0x1')]},'billableseconds':{'type':Sequelize[_0x49c4('0x1')]}}; \ No newline at end of file +var _0xb821=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x1b4af6,_0xd59625){var _0x105d96=function(_0x31995e){while(--_0x31995e){_0x1b4af6['push'](_0x1b4af6['shift']());}};_0x105d96(++_0xd59625);}(_0xb821,0xa7));var _0x1b82=function(_0x4f62af,_0x231ea8){_0x4f62af=_0x4f62af-0x0;var _0x16aa1b=_0xb821[_0x4f62af];return _0x16aa1b;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'privilege':{'type':Sequelize[_0x1b82('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1b82('0x1')]},'connectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'language':{'type':Sequelize[_0x1b82('0x1')]},'accountcode':{'type':Sequelize[_0x1b82('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1b82('0x1')]},'priority':{'type':Sequelize[_0x1b82('0x2')]},'uniqueid':{'type':Sequelize[_0x1b82('0x1')]},'linkedid':{'type':Sequelize[_0x1b82('0x1')]},'destchannel':{'type':Sequelize[_0x1b82('0x1')]},'destchannelstate':{'type':Sequelize[_0x1b82('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridname':{'type':Sequelize[_0x1b82('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'destlanguage':{'type':Sequelize[_0x1b82('0x1')]},'destaccountcode':{'type':Sequelize[_0x1b82('0x1')]},'destcontext':{'type':Sequelize[_0x1b82('0x1')]},'destexten':{'type':Sequelize[_0x1b82('0x1')]},'destpriority':{'type':Sequelize[_0x1b82('0x2')]},'destuniqueid':{'type':Sequelize[_0x1b82('0x1')]},'destlinkedid':{'type':Sequelize[_0x1b82('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x1b82('0x1')]},'starttime':{'type':Sequelize[_0x1b82('0x3')]},'answertime':{'type':Sequelize[_0x1b82('0x3')]},'endtime':{'type':Sequelize[_0x1b82('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x1b82('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x1b82('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index c7235e8..5c25ac2 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 _0x303f=['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','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','length','create','body','catch','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x303f,0x12d));var _0xf303=function(_0x2ea367,_0x66c7ad){_0x2ea367=_0x2ea367-0x0;var _0x245d7e=_0x303f[_0x2ea367];return _0x245d7e;};'use strict';var emlformat=require(_0xf303('0x0'));var rimraf=require(_0xf303('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf303('0x2'));var rp=require(_0xf303('0x3'));var moment=require(_0xf303('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf303('0x5'));var util=require(_0xf303('0x6'));var path=require(_0xf303('0x7'));var sox=require(_0xf303('0x8'));var csv=require(_0xf303('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf303('0xa'));var _=require(_0xf303('0xb'));var squel=require(_0xf303('0xc'));var crypto=require(_0xf303('0xd'));var jsforce=require(_0xf303('0xe'));var deskjs=require(_0xf303('0xf'));var toCsv=require(_0xf303('0x9'));var querystring=require(_0xf303('0x10'));var Papa=require(_0xf303('0x11'));var Redis=require(_0xf303('0x12'));var authService=require(_0xf303('0x13'));var qs=require(_0xf303('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf303('0x15'));var logger=require(_0xf303('0x16'))(_0xf303('0x17'));var utils=require(_0xf303('0x18'));var config=require(_0xf303('0x19'));var licenseUtil=require(_0xf303('0x1a'));var db=require(_0xf303('0x1b'))['db'];function respondWithStatusCode(_0x3a2213,_0x1929be){_0x1929be=_0x1929be||0xcc;return function(_0x2d783d){if(_0x2d783d){return _0x3a2213[_0xf303('0x1c')](_0x1929be);}return _0x3a2213[_0xf303('0x1d')](_0x1929be)[_0xf303('0x1e')]();};}function respondWithResult(_0x59e01b,_0xee8f39){_0xee8f39=_0xee8f39||0xc8;return function(_0x3107bb){if(_0x3107bb){return _0x59e01b[_0xf303('0x1d')](_0xee8f39)[_0xf303('0x1f')](_0x3107bb);}};}function respondWithFilteredResult(_0xdb3b8c,_0x298413){return function(_0x426100){if(_0x426100){var _0x573fb3=typeof _0x298413['offset']===_0xf303('0x20')&&typeof _0x298413[_0xf303('0x21')]===_0xf303('0x20');var _0x47e041=_0x426100[_0xf303('0x22')];var _0x2ee303=_0x573fb3?0x0:_0x298413[_0xf303('0x23')];var _0x417ef9=_0x573fb3?_0x426100[_0xf303('0x22')]:_0x298413[_0xf303('0x23')]+_0x298413[_0xf303('0x21')];var _0xf6f0cc;if(_0x417ef9>=_0x47e041){_0x417ef9=_0x47e041;_0xf6f0cc=0xc8;}else{_0xf6f0cc=0xce;}_0xdb3b8c[_0xf303('0x1d')](_0xf6f0cc);return _0xdb3b8c['set'](_0xf303('0x24'),_0x2ee303+'-'+_0x417ef9+'/'+_0x47e041)[_0xf303('0x1f')](_0x426100);}return null;};}function patchUpdates(_0xc4a5d1){return function(_0x53bb77){try{jsonpatch[_0xf303('0x25')](_0x53bb77,_0xc4a5d1,!![]);}catch(_0x37c0a2){return BPromise[_0xf303('0x26')](_0x37c0a2);}return _0x53bb77['save']();};}function saveUpdates(_0x1c1bce,_0xcc821e){return function(_0x558c28){if(_0x558c28){return _0x558c28[_0xf303('0x27')](_0x1c1bce)[_0xf303('0x28')](function(_0x52cc9a){return _0x52cc9a;});}return null;};}function removeEntity(_0x9570e4,_0x4b37b5){return function(_0xedcb4b){if(_0xedcb4b){return _0xedcb4b[_0xf303('0x29')]()[_0xf303('0x28')](function(){_0x9570e4[_0xf303('0x1d')](0xcc)[_0xf303('0x1e')]();});}};}function handleEntityNotFound(_0x24d02a,_0x2d3972){return function(_0x45213c){if(!_0x45213c){_0x24d02a[_0xf303('0x1c')](0x194);}return _0x45213c;};}function handleError(_0x349069,_0x5cc2e1){_0x5cc2e1=_0x5cc2e1||0x1f4;return function(_0xea8d72){logger['error'](_0xea8d72[_0xf303('0x2a')]);if(_0xea8d72[_0xf303('0x2b')]){delete _0xea8d72['name'];}_0x349069['status'](_0x5cc2e1)[_0xf303('0x2c')](_0xea8d72);};}exports[_0xf303('0x2d')]=function(_0x32526e,_0xbdfed6){var _0xad7623={},_0x2919a1={},_0x32b496={'count':0x0,'rows':[]};var _0x200c9b=_[_0xf303('0x2e')](db[_0xf303('0x2f')][_0xf303('0x30')],function(_0x18dfd4){return{'name':_0x18dfd4[_0xf303('0x31')],'type':_0x18dfd4[_0xf303('0x32')][_0xf303('0x33')]};});_0x2919a1['model']=_[_0xf303('0x2e')](_0x200c9b,_0xf303('0x2b'));_0x2919a1[_0xf303('0x34')]=_[_0xf303('0x35')](_0x32526e['query']);_0x2919a1[_0xf303('0x36')]=_['intersection'](_0x2919a1[_0xf303('0x37')],_0x2919a1['query']);_0xad7623['attributes']=_[_0xf303('0x38')](_0x2919a1[_0xf303('0x37')],qs[_0xf303('0x39')](_0x32526e[_0xf303('0x34')][_0xf303('0x39')]));_0xad7623['attributes']=_0xad7623[_0xf303('0x3a')]['length']?_0xad7623[_0xf303('0x3a')]:_0x2919a1['model'];if(!_0x32526e[_0xf303('0x34')][_0xf303('0x3b')](_0xf303('0x3c'))){_0xad7623[_0xf303('0x21')]=qs['limit'](_0x32526e[_0xf303('0x34')][_0xf303('0x21')]);_0xad7623[_0xf303('0x23')]=qs[_0xf303('0x23')](_0x32526e[_0xf303('0x34')][_0xf303('0x23')]);}_0xad7623[_0xf303('0x3d')]=qs[_0xf303('0x3e')](_0x32526e[_0xf303('0x34')][_0xf303('0x3e')]);_0xad7623[_0xf303('0x3f')]=qs[_0xf303('0x36')](_[_0xf303('0x40')](_0x32526e[_0xf303('0x34')],_0x2919a1[_0xf303('0x36')]),_0x200c9b);if(_0x32526e['query'][_0xf303('0x41')]){_0xad7623[_0xf303('0x3f')]=_[_0xf303('0x42')](_0xad7623[_0xf303('0x3f')],{'$or':_[_0xf303('0x2e')](_0x200c9b,function(_0x253c06){if(_0x253c06[_0xf303('0x32')]!==_0xf303('0x43')){var _0x1dcb72={};_0x1dcb72[_0x253c06[_0xf303('0x2b')]]={'$like':'%'+_0x32526e[_0xf303('0x34')]['filter']+'%'};return _0x1dcb72;}})});}_0xad7623=_['merge']({},_0xad7623,_0x32526e[_0xf303('0x44')]);var _0x515e17={'where':_0xad7623[_0xf303('0x3f')]};return db[_0xf303('0x2f')]['count'](_0x515e17)[_0xf303('0x28')](function(_0xac9eab){_0x32b496['count']=_0xac9eab;if(_0x32526e[_0xf303('0x34')][_0xf303('0x45')]){_0xad7623[_0xf303('0x46')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0xad7623);})[_0xf303('0x28')](function(_0x56334a){_0x32b496['rows']=_0x56334a;return _0x32b496;})['then'](respondWithFilteredResult(_0xbdfed6,_0xad7623))['catch'](handleError(_0xbdfed6,null));};exports[_0xf303('0x47')]=function(_0x2399ee,_0x3b5fb9){var _0x1b6335={'raw':!![],'where':{'id':_0x2399ee[_0xf303('0x48')]['id']}},_0x12f270={};_0x12f270[_0xf303('0x37')]=_['keys'](db[_0xf303('0x2f')]['rawAttributes']);_0x12f270[_0xf303('0x34')]=_['keys'](_0x2399ee[_0xf303('0x34')]);_0x12f270[_0xf303('0x36')]=_[_0xf303('0x38')](_0x12f270[_0xf303('0x37')],_0x12f270[_0xf303('0x34')]);_0x1b6335[_0xf303('0x3a')]=_[_0xf303('0x38')](_0x12f270[_0xf303('0x37')],qs['fields'](_0x2399ee[_0xf303('0x34')][_0xf303('0x39')]));_0x1b6335[_0xf303('0x3a')]=_0x1b6335['attributes'][_0xf303('0x49')]?_0x1b6335[_0xf303('0x3a')]:_0x12f270[_0xf303('0x37')];if(_0x2399ee[_0xf303('0x34')][_0xf303('0x45')]){_0x1b6335[_0xf303('0x46')]=[{'all':!![]}];}_0x1b6335=_['merge']({},_0x1b6335,_0x2399ee[_0xf303('0x44')]);return db[_0xf303('0x2f')]['find'](_0x1b6335)[_0xf303('0x28')](handleEntityNotFound(_0x3b5fb9,null))[_0xf303('0x28')](respondWithResult(_0x3b5fb9,null))['catch'](handleError(_0x3b5fb9,null));};exports['create']=function(_0x57ce01,_0x32f1d3){return db[_0xf303('0x2f')][_0xf303('0x4a')](_0x57ce01[_0xf303('0x4b')],{})[_0xf303('0x28')](respondWithResult(_0x32f1d3,0xc9))[_0xf303('0x4c')](handleError(_0x32f1d3,null));};exports[_0xf303('0x27')]=function(_0x46fa1b,_0x27c168){if(_0x46fa1b[_0xf303('0x4b')]['id']){delete _0x46fa1b['body']['id'];}return db[_0xf303('0x2f')]['find']({'where':{'id':_0x46fa1b[_0xf303('0x48')]['id']}})[_0xf303('0x28')](handleEntityNotFound(_0x27c168,null))[_0xf303('0x28')](saveUpdates(_0x46fa1b[_0xf303('0x4b')],null))['then'](respondWithResult(_0x27c168,null))[_0xf303('0x4c')](handleError(_0x27c168,null));};exports[_0xf303('0x29')]=function(_0x55b09e,_0x16a998){return db[_0xf303('0x2f')][_0xf303('0x4d')]({'where':{'id':_0x55b09e[_0xf303('0x48')]['id']}})[_0xf303('0x28')](handleEntityNotFound(_0x16a998,null))['then'](removeEntity(_0x16a998,null))[_0xf303('0x4c')](handleError(_0x16a998,null));};exports['describe']=function(_0x27ef62,_0x19e545){return db[_0xf303('0x2f')][_0xf303('0x4e')]()[_0xf303('0x28')](respondWithResult(_0x19e545,null))[_0xf303('0x4c')](handleError(_0x19e545,null));}; \ No newline at end of file +var _0x3d4b=['set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch','params','keys','length','create','body','find','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x3d4b,0x15e));var _0xb3d4=function(_0x2f1c02,_0x3f24bf){_0x2f1c02=_0x2f1c02-0x0;var _0x5bb7de=_0x3d4b[_0x2f1c02];return _0x5bb7de;};'use strict';var emlformat=require(_0xb3d4('0x0'));var rimraf=require(_0xb3d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb3d4('0x2'));var BPromise=require(_0xb3d4('0x3'));var Mustache=require(_0xb3d4('0x4'));var util=require(_0xb3d4('0x5'));var path=require(_0xb3d4('0x6'));var sox=require(_0xb3d4('0x7'));var csv=require(_0xb3d4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb3d4('0x9'));var squel=require(_0xb3d4('0xa'));var crypto=require(_0xb3d4('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb3d4('0x8'));var querystring=require(_0xb3d4('0xc'));var Papa=require(_0xb3d4('0xd'));var Redis=require(_0xb3d4('0xe'));var authService=require(_0xb3d4('0xf'));var qs=require(_0xb3d4('0x10'));var as=require(_0xb3d4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3d4('0x12'))(_0xb3d4('0x13'));var utils=require('../../config/utils');var config=require(_0xb3d4('0x14'));var licenseUtil=require(_0xb3d4('0x15'));var db=require(_0xb3d4('0x16'))['db'];function respondWithStatusCode(_0x3d67d0,_0x9ff88d){_0x9ff88d=_0x9ff88d||0xcc;return function(_0x1b3774){if(_0x1b3774){return _0x3d67d0[_0xb3d4('0x17')](_0x9ff88d);}return _0x3d67d0[_0xb3d4('0x18')](_0x9ff88d)['end']();};}function respondWithResult(_0x9d7bc4,_0x6ac81a){_0x6ac81a=_0x6ac81a||0xc8;return function(_0x1efa53){if(_0x1efa53){return _0x9d7bc4[_0xb3d4('0x18')](_0x6ac81a)[_0xb3d4('0x19')](_0x1efa53);}};}function respondWithFilteredResult(_0x871a05,_0x591657){return function(_0x5267f1){if(_0x5267f1){var _0x5c3790=typeof _0x591657['offset']==='undefined'&&typeof _0x591657[_0xb3d4('0x1a')]===_0xb3d4('0x1b');var _0x41ce82=_0x5267f1[_0xb3d4('0x1c')];var _0xa42a94=_0x5c3790?0x0:_0x591657[_0xb3d4('0x1d')];var _0x523ccc=_0x5c3790?_0x5267f1[_0xb3d4('0x1c')]:_0x591657[_0xb3d4('0x1d')]+_0x591657[_0xb3d4('0x1a')];var _0x5cda46;if(_0x523ccc>=_0x41ce82){_0x523ccc=_0x41ce82;_0x5cda46=0xc8;}else{_0x5cda46=0xce;}_0x871a05[_0xb3d4('0x18')](_0x5cda46);return _0x871a05[_0xb3d4('0x1e')](_0xb3d4('0x1f'),_0xa42a94+'-'+_0x523ccc+'/'+_0x41ce82)[_0xb3d4('0x19')](_0x5267f1);}return null;};}function patchUpdates(_0x2ddc42){return function(_0x4eafa2){try{jsonpatch[_0xb3d4('0x20')](_0x4eafa2,_0x2ddc42,!![]);}catch(_0x36a356){return BPromise[_0xb3d4('0x21')](_0x36a356);}return _0x4eafa2[_0xb3d4('0x22')]();};}function saveUpdates(_0x58894d,_0x20e22b){return function(_0xb8f36e){if(_0xb8f36e){return _0xb8f36e[_0xb3d4('0x23')](_0x58894d)['then'](function(_0x3ab6b0){return _0x3ab6b0;});}return null;};}function removeEntity(_0x510e2,_0x1bac9b){return function(_0x5da9ed){if(_0x5da9ed){return _0x5da9ed[_0xb3d4('0x24')]()['then'](function(){_0x510e2[_0xb3d4('0x18')](0xcc)[_0xb3d4('0x25')]();});}};}function handleEntityNotFound(_0x393dfe,_0x23489c){return function(_0x5c3e2b){if(!_0x5c3e2b){_0x393dfe['sendStatus'](0x194);}return _0x5c3e2b;};}function handleError(_0x44f9bd,_0x6c4cd3){_0x6c4cd3=_0x6c4cd3||0x1f4;return function(_0x592ae4){logger[_0xb3d4('0x26')](_0x592ae4[_0xb3d4('0x27')]);if(_0x592ae4[_0xb3d4('0x28')]){delete _0x592ae4[_0xb3d4('0x28')];}_0x44f9bd[_0xb3d4('0x18')](_0x6c4cd3)[_0xb3d4('0x29')](_0x592ae4);};}exports[_0xb3d4('0x2a')]=function(_0x584116,_0x5bb174){var _0x27ae0c={},_0x254a9c={},_0x4dfe10={'count':0x0,'rows':[]};var _0x4b00a9=_[_0xb3d4('0x2b')](db[_0xb3d4('0x2c')][_0xb3d4('0x2d')],function(_0xf29265){return{'name':_0xf29265[_0xb3d4('0x2e')],'type':_0xf29265[_0xb3d4('0x2f')]['key']};});_0x254a9c[_0xb3d4('0x30')]=_[_0xb3d4('0x2b')](_0x4b00a9,_0xb3d4('0x28'));_0x254a9c[_0xb3d4('0x31')]=_['keys'](_0x584116[_0xb3d4('0x31')]);_0x254a9c[_0xb3d4('0x32')]=_['intersection'](_0x254a9c[_0xb3d4('0x30')],_0x254a9c[_0xb3d4('0x31')]);_0x27ae0c[_0xb3d4('0x33')]=_[_0xb3d4('0x34')](_0x254a9c[_0xb3d4('0x30')],qs[_0xb3d4('0x35')](_0x584116[_0xb3d4('0x31')]['fields']));_0x27ae0c['attributes']=_0x27ae0c['attributes']['length']?_0x27ae0c[_0xb3d4('0x33')]:_0x254a9c['model'];if(!_0x584116['query'][_0xb3d4('0x36')](_0xb3d4('0x37'))){_0x27ae0c[_0xb3d4('0x1a')]=qs[_0xb3d4('0x1a')](_0x584116[_0xb3d4('0x31')]['limit']);_0x27ae0c['offset']=qs['offset'](_0x584116[_0xb3d4('0x31')][_0xb3d4('0x1d')]);}_0x27ae0c[_0xb3d4('0x38')]=qs[_0xb3d4('0x39')](_0x584116[_0xb3d4('0x31')][_0xb3d4('0x39')]);_0x27ae0c[_0xb3d4('0x3a')]=qs['filters'](_['pick'](_0x584116[_0xb3d4('0x31')],_0x254a9c['filters']),_0x4b00a9);if(_0x584116['query']['filter']){_0x27ae0c[_0xb3d4('0x3a')]=_[_0xb3d4('0x3b')](_0x27ae0c[_0xb3d4('0x3a')],{'$or':_['map'](_0x4b00a9,function(_0x3d2181){if(_0x3d2181[_0xb3d4('0x2f')]!==_0xb3d4('0x3c')){var _0x5292ec={};_0x5292ec[_0x3d2181[_0xb3d4('0x28')]]={'$like':'%'+_0x584116['query'][_0xb3d4('0x3d')]+'%'};return _0x5292ec;}})});}_0x27ae0c=_[_0xb3d4('0x3b')]({},_0x27ae0c,_0x584116[_0xb3d4('0x3e')]);var _0x457135={'where':_0x27ae0c[_0xb3d4('0x3a')]};return db['VoiceDialReport']['count'](_0x457135)[_0xb3d4('0x3f')](function(_0x41287b){_0x4dfe10[_0xb3d4('0x1c')]=_0x41287b;if(_0x584116[_0xb3d4('0x31')][_0xb3d4('0x40')]){_0x27ae0c[_0xb3d4('0x41')]=[{'all':!![]}];}return db[_0xb3d4('0x2c')][_0xb3d4('0x42')](_0x27ae0c);})['then'](function(_0xb0356d){_0x4dfe10[_0xb3d4('0x43')]=_0xb0356d;return _0x4dfe10;})['then'](respondWithFilteredResult(_0x5bb174,_0x27ae0c))[_0xb3d4('0x44')](handleError(_0x5bb174,null));};exports['show']=function(_0x50d83d,_0x10f632){var _0x9bf9a0={'raw':!![],'where':{'id':_0x50d83d[_0xb3d4('0x45')]['id']}},_0x4274a4={};_0x4274a4['model']=_[_0xb3d4('0x46')](db[_0xb3d4('0x2c')][_0xb3d4('0x2d')]);_0x4274a4[_0xb3d4('0x31')]=_[_0xb3d4('0x46')](_0x50d83d['query']);_0x4274a4[_0xb3d4('0x32')]=_[_0xb3d4('0x34')](_0x4274a4[_0xb3d4('0x30')],_0x4274a4[_0xb3d4('0x31')]);_0x9bf9a0[_0xb3d4('0x33')]=_[_0xb3d4('0x34')](_0x4274a4['model'],qs[_0xb3d4('0x35')](_0x50d83d[_0xb3d4('0x31')][_0xb3d4('0x35')]));_0x9bf9a0[_0xb3d4('0x33')]=_0x9bf9a0['attributes'][_0xb3d4('0x47')]?_0x9bf9a0[_0xb3d4('0x33')]:_0x4274a4[_0xb3d4('0x30')];if(_0x50d83d[_0xb3d4('0x31')][_0xb3d4('0x40')]){_0x9bf9a0[_0xb3d4('0x41')]=[{'all':!![]}];}_0x9bf9a0=_[_0xb3d4('0x3b')]({},_0x9bf9a0,_0x50d83d[_0xb3d4('0x3e')]);return db[_0xb3d4('0x2c')]['find'](_0x9bf9a0)[_0xb3d4('0x3f')](handleEntityNotFound(_0x10f632,null))[_0xb3d4('0x3f')](respondWithResult(_0x10f632,null))[_0xb3d4('0x44')](handleError(_0x10f632,null));};exports['create']=function(_0x1a644c,_0x1f69e9){return db[_0xb3d4('0x2c')][_0xb3d4('0x48')](_0x1a644c['body'],{})[_0xb3d4('0x3f')](respondWithResult(_0x1f69e9,0xc9))[_0xb3d4('0x44')](handleError(_0x1f69e9,null));};exports[_0xb3d4('0x23')]=function(_0xa95383,_0x3db461){if(_0xa95383[_0xb3d4('0x49')]['id']){delete _0xa95383[_0xb3d4('0x49')]['id'];}return db[_0xb3d4('0x2c')][_0xb3d4('0x4a')]({'where':{'id':_0xa95383[_0xb3d4('0x45')]['id']}})[_0xb3d4('0x3f')](handleEntityNotFound(_0x3db461,null))[_0xb3d4('0x3f')](saveUpdates(_0xa95383[_0xb3d4('0x49')],null))[_0xb3d4('0x3f')](respondWithResult(_0x3db461,null))[_0xb3d4('0x44')](handleError(_0x3db461,null));};exports[_0xb3d4('0x24')]=function(_0x3cafdf,_0x500856){return db[_0xb3d4('0x2c')][_0xb3d4('0x4a')]({'where':{'id':_0x3cafdf['params']['id']}})['then'](handleEntityNotFound(_0x500856,null))['then'](removeEntity(_0x500856,null))[_0xb3d4('0x44')](handleError(_0x500856,null));};exports[_0xb3d4('0x4b')]=function(_0x544540,_0x479b39){return db[_0xb3d4('0x2c')]['describe']()[_0xb3d4('0x3f')](respondWithResult(_0x479b39,null))[_0xb3d4('0x44')](handleError(_0x479b39,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index d97f628..3bb92b6 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 _0x0dd9=['util','moment','bluebird','request-promise','rimraf','./voiceDialReport.attributes','exports','define','report_dial','uniqueid','lodash'];(function(_0x1979ba,_0x2d1ff1){var _0x272c7d=function(_0x35fab9){while(--_0x35fab9){_0x1979ba['push'](_0x1979ba['shift']());}};_0x272c7d(++_0x2d1ff1);}(_0x0dd9,0x78));var _0x90dd=function(_0x1fdc5c,_0x81da5){_0x1fdc5c=_0x1fdc5c-0x0;var _0x3ab68f=_0x0dd9[_0x1fdc5c];return _0x3ab68f;};'use strict';var _=require(_0x90dd('0x0'));var util=require(_0x90dd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x90dd('0x2'));var BPromise=require(_0x90dd('0x3'));var rp=require(_0x90dd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x90dd('0x5'));var config=require('../../config/environment');var attributes=require(_0x90dd('0x6'));module[_0x90dd('0x7')]=function(_0x1fda33,_0x3507d9){return _0x1fda33[_0x90dd('0x8')]('VoiceDialReport',attributes,{'tableName':_0x90dd('0x9'),'paranoid':![],'indexes':[{'fields':[_0x90dd('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4202=['request-promise','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','api','bluebird'];(function(_0x284d70,_0x4e5330){var _0x5a40f8=function(_0x5507e7){while(--_0x5507e7){_0x284d70['push'](_0x284d70['shift']());}};_0x5a40f8(++_0x4e5330);}(_0x4202,0x8c));var _0x2420=function(_0x835cb7,_0x1e574d){_0x835cb7=_0x835cb7-0x0;var _0x3ef599=_0x4202[_0x835cb7];return _0x3ef599;};'use strict';var _=require(_0x2420('0x0'));var util=require(_0x2420('0x1'));var logger=require('../../config/logger')(_0x2420('0x2'));var moment=require('moment');var BPromise=require(_0x2420('0x3'));var rp=require(_0x2420('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2420('0x5'));var config=require(_0x2420('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0x2420('0x7')]=function(_0x322420,_0x582361){return _0x322420[_0x2420('0x8')](_0x2420('0x9'),attributes,{'tableName':_0x2420('0xa'),'paranoid':![],'indexes':[{'fields':[_0x2420('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 690823b..e0f34b5 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 _0x495b=['jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','UpdateVoiceDialReport','update','where','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2b01a2,_0x3b4040){var _0xcce4ab=function(_0x34c777){while(--_0x34c777){_0x2b01a2['push'](_0x2b01a2['shift']());}};_0xcce4ab(++_0x3b4040);}(_0x495b,0xd7));var _0xb495=function(_0x390db6,_0x415d7b){_0x390db6=_0x390db6-0x0;var _0x463962=_0x495b[_0x390db6];return _0x463962;};'use strict';var _=require(_0xb495('0x0'));var util=require(_0xb495('0x1'));var moment=require('moment');var BPromise=require(_0xb495('0x2'));var rs=require(_0xb495('0x3'));var fs=require('fs');var Redis=require(_0xb495('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb495('0x5'));var logger=require(_0xb495('0x6'))(_0xb495('0x7'));var config=require(_0xb495('0x8'));var jayson=require(_0xb495('0x9'));var client=jayson[_0xb495('0xa')][_0xb495('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18148c,_0x1ac9ad,_0x2a9575){return new BPromise(function(_0x331c62,_0x3db3cd){return client['request'](_0x18148c,_0x2a9575)[_0xb495('0xc')](function(_0x1fed17){logger[_0xb495('0xd')](_0xb495('0xe'),_0x1ac9ad,_0xb495('0xf'));logger[_0xb495('0x10')](_0xb495('0x11'),_0x1ac9ad,_0xb495('0xf'),JSON[_0xb495('0x12')](_0x1fed17));if(_0x1fed17[_0xb495('0x13')]){if(_0x1fed17['error']['code']===0x1f4){logger['error'](_0xb495('0xe'),_0x1ac9ad,_0x1fed17[_0xb495('0x13')][_0xb495('0x14')]);return _0x3db3cd(_0x1fed17['error'][_0xb495('0x14')]);}logger[_0xb495('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x1ac9ad,_0x1fed17[_0xb495('0x13')][_0xb495('0x14')]);return _0x331c62(_0x1fed17['error'][_0xb495('0x14')]);}else{logger[_0xb495('0xd')](_0xb495('0xe'),_0x1ac9ad,_0xb495('0xf'));_0x331c62(_0x1fed17[_0xb495('0x15')][_0xb495('0x14')]);}})[_0xb495('0x16')](function(_0x4eec7f){logger['error'](_0xb495('0xe'),_0x1ac9ad,_0x4eec7f);_0x3db3cd(_0x4eec7f);});});}exports[_0xb495('0x17')]=function(_0x3e259d){var _0x7be189=this;return new Promise(function(_0x48b814,_0xfe2c00){return db[_0xb495('0x18')]['create'](_0x3e259d[_0xb495('0x19')],{'raw':_0x3e259d[_0xb495('0x1a')]?_0x3e259d['options'][_0xb495('0x1b')]===undefined?!![]:![]:!![]})[_0xb495('0xc')](function(_0xaa3d21){logger[_0xb495('0xd')](_0xb495('0x17'),_0x3e259d);logger[_0xb495('0x10')](_0xb495('0x17'),_0x3e259d,JSON[_0xb495('0x12')](_0xaa3d21));_0x48b814(_0xaa3d21);})[_0xb495('0x16')](function(_0x264275){logger[_0xb495('0x13')]('CreateVoiceDialReport',_0x264275[_0xb495('0x14')],_0x3e259d);_0xfe2c00(_0x7be189[_0xb495('0x13')](0x1f4,_0x264275[_0xb495('0x14')]));});});};exports[_0xb495('0x1c')]=function(_0x1b3110){var _0x425862=this;return new Promise(function(_0x210a01,_0x55eeab){return db[_0xb495('0x18')][_0xb495('0x1d')](_0x1b3110[_0xb495('0x19')],{'raw':_0x1b3110[_0xb495('0x1a')]?_0x1b3110[_0xb495('0x1a')][_0xb495('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b3110[_0xb495('0x1a')]?_0x1b3110[_0xb495('0x1a')][_0xb495('0x1e')]||null:null,'attributes':_0x1b3110['options']?_0x1b3110['options']['attributes']||null:null,'limit':_0x1b3110[_0xb495('0x1a')]?_0x1b3110[_0xb495('0x1a')][_0xb495('0x1f')]||null:null})[_0xb495('0xc')](function(_0x3a079e){logger[_0xb495('0xd')](_0xb495('0x1c'),_0x1b3110);logger[_0xb495('0x10')](_0xb495('0x1c'),_0x1b3110,JSON['stringify'](_0x3a079e));_0x210a01(_0x3a079e);})[_0xb495('0x16')](function(_0x581785){logger[_0xb495('0x13')]('UpdateVoiceDialReport',_0x581785['message'],_0x1b3110);_0x55eeab(_0x425862['error'](0x1f4,_0x581785[_0xb495('0x14')]));});});}; \ No newline at end of file +var _0x24ec=['VoiceDialReport','body','options','raw','CreateVoiceDialReport','catch','UpdateVoiceDialReport','update','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x32c98a,_0x5e6eb0){var _0x1796d3=function(_0x560640){while(--_0x560640){_0x32c98a['push'](_0x32c98a['shift']());}};_0x1796d3(++_0x5e6eb0);}(_0x24ec,0x64));var _0xc24e=function(_0x2febc2,_0x2245ea){_0x2febc2=_0x2febc2-0x0;var _0x41c10f=_0x24ec[_0x2febc2];return _0x41c10f;};'use strict';var _=require(_0xc24e('0x0'));var util=require(_0xc24e('0x1'));var moment=require('moment');var BPromise=require(_0xc24e('0x2'));var rs=require(_0xc24e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc24e('0x4'))['db'];var utils=require(_0xc24e('0x5'));var logger=require(_0xc24e('0x6'))(_0xc24e('0x7'));var config=require(_0xc24e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc24e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x529610,_0x3e8ab8,_0x7f741e){return new BPromise(function(_0x3b069e,_0x4978ad){return client[_0xc24e('0xa')](_0x529610,_0x7f741e)[_0xc24e('0xb')](function(_0x5bc83b){logger[_0xc24e('0xc')](_0xc24e('0xd'),_0x3e8ab8,'request\x20sent');logger[_0xc24e('0xe')](_0xc24e('0xf'),_0x3e8ab8,'request\x20sent',JSON[_0xc24e('0x10')](_0x5bc83b));if(_0x5bc83b[_0xc24e('0x11')]){if(_0x5bc83b[_0xc24e('0x11')][_0xc24e('0x12')]===0x1f4){logger[_0xc24e('0x11')](_0xc24e('0xd'),_0x3e8ab8,_0x5bc83b[_0xc24e('0x11')][_0xc24e('0x13')]);return _0x4978ad(_0x5bc83b['error'][_0xc24e('0x13')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x3e8ab8,_0x5bc83b[_0xc24e('0x11')][_0xc24e('0x13')]);return _0x3b069e(_0x5bc83b['error'][_0xc24e('0x13')]);}else{logger[_0xc24e('0xc')](_0xc24e('0xd'),_0x3e8ab8,'request\x20sent');_0x3b069e(_0x5bc83b['result'][_0xc24e('0x13')]);}})['catch'](function(_0x17de30){logger[_0xc24e('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x3e8ab8,_0x17de30);_0x4978ad(_0x17de30);});});}exports['CreateVoiceDialReport']=function(_0x5ee1c6){var _0x56d045=this;return new Promise(function(_0x2bd5d6,_0x598a15){return db[_0xc24e('0x14')]['create'](_0x5ee1c6[_0xc24e('0x15')],{'raw':_0x5ee1c6[_0xc24e('0x16')]?_0x5ee1c6[_0xc24e('0x16')][_0xc24e('0x17')]===undefined?!![]:![]:!![]})[_0xc24e('0xb')](function(_0x3b9885){logger[_0xc24e('0xc')]('CreateVoiceDialReport',_0x5ee1c6);logger[_0xc24e('0xe')](_0xc24e('0x18'),_0x5ee1c6,JSON['stringify'](_0x3b9885));_0x2bd5d6(_0x3b9885);})[_0xc24e('0x19')](function(_0x265f96){logger[_0xc24e('0x11')](_0xc24e('0x18'),_0x265f96[_0xc24e('0x13')],_0x5ee1c6);_0x598a15(_0x56d045[_0xc24e('0x11')](0x1f4,_0x265f96['message']));});});};exports[_0xc24e('0x1a')]=function(_0x15e1f2){var _0x47e03e=this;return new Promise(function(_0x1f8fe3,_0x2637c3){return db[_0xc24e('0x14')][_0xc24e('0x1b')](_0x15e1f2[_0xc24e('0x15')],{'raw':_0x15e1f2[_0xc24e('0x16')]?_0x15e1f2[_0xc24e('0x16')][_0xc24e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15e1f2[_0xc24e('0x16')]?_0x15e1f2[_0xc24e('0x16')]['where']||null:null,'attributes':_0x15e1f2[_0xc24e('0x16')]?_0x15e1f2[_0xc24e('0x16')][_0xc24e('0x1c')]||null:null,'limit':_0x15e1f2[_0xc24e('0x16')]?_0x15e1f2[_0xc24e('0x16')][_0xc24e('0x1d')]||null:null})[_0xc24e('0xb')](function(_0x1e83f3){logger[_0xc24e('0xc')](_0xc24e('0x1a'),_0x15e1f2);logger[_0xc24e('0xe')](_0xc24e('0x1a'),_0x15e1f2,JSON[_0xc24e('0x10')](_0x1e83f3));_0x1f8fe3(_0x1e83f3);})[_0xc24e('0x19')](function(_0x24f5c3){logger[_0xc24e('0x11')](_0xc24e('0x1a'),_0x24f5c3[_0xc24e('0x13')],_0x15e1f2);_0x2637c3(_0x47e03e[_0xc24e('0x11')](0x1f4,_0x24f5c3[_0xc24e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f5d6fb5..9ee8911 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 _0xc90e=['index','/:id','post','/:id/applications','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated'];(function(_0x7275e9,_0x321fa5){var _0x17b99d=function(_0x54af41){while(--_0x54af41){_0x7275e9['push'](_0x7275e9['shift']());}};_0x17b99d(++_0x321fa5);}(_0xc90e,0x106));var _0xec90=function(_0x16c58e,_0x350404){_0x16c58e=_0x16c58e-0x0;var _0x3fa2a6=_0xc90e[_0x16c58e];return _0x3fa2a6;};'use strict';var multer=require(_0xec90('0x0'));var util=require('util');var path=require(_0xec90('0x1'));var timeout=require('connect-timeout');var express=require(_0xec90('0x2'));var router=express[_0xec90('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xec90('0x4'));var interaction=require(_0xec90('0x5'));var config=require(_0xec90('0x6'));var controller=require(_0xec90('0x7'));router[_0xec90('0x8')]('/',auth[_0xec90('0x9')](),controller[_0xec90('0xa')]);router[_0xec90('0x8')](_0xec90('0xb'),auth[_0xec90('0x9')](),controller['show']);router[_0xec90('0xc')]('/',auth[_0xec90('0x9')](),controller['create']);router[_0xec90('0xc')](_0xec90('0xd'),auth[_0xec90('0x9')](),controller['addApplications']);router['put'](_0xec90('0xb'),auth[_0xec90('0x9')](),controller['update']);router[_0xec90('0xe')](_0xec90('0xb'),auth[_0xec90('0x9')](),controller[_0xec90('0xf')]);module[_0xec90('0x10')]=router; \ No newline at end of file +var _0x5ee6=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','delete','destroy','multer'];(function(_0x4bcbe1,_0x4575fc){var _0x4d9bb3=function(_0x5a1593){while(--_0x5a1593){_0x4bcbe1['push'](_0x4bcbe1['shift']());}};_0x4d9bb3(++_0x4575fc);}(_0x5ee6,0x1f3));var _0x65ee=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5ee6[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x65ee('0x0'));var util=require(_0x65ee('0x1'));var path=require(_0x65ee('0x2'));var timeout=require(_0x65ee('0x3'));var express=require('express');var router=express[_0x65ee('0x4')]();var fs_extra=require(_0x65ee('0x5'));var auth=require(_0x65ee('0x6'));var interaction=require(_0x65ee('0x7'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0x65ee('0x8')]('/',auth[_0x65ee('0x9')](),controller[_0x65ee('0xa')]);router[_0x65ee('0x8')](_0x65ee('0xb'),auth[_0x65ee('0x9')](),controller[_0x65ee('0xc')]);router[_0x65ee('0xd')]('/',auth[_0x65ee('0x9')](),controller[_0x65ee('0xe')]);router[_0x65ee('0xd')](_0x65ee('0xf'),auth[_0x65ee('0x9')](),controller[_0x65ee('0x10')]);router[_0x65ee('0x11')](_0x65ee('0xb'),auth[_0x65ee('0x9')](),controller['update']);router[_0x65ee('0x12')](_0x65ee('0xb'),auth['isAuthenticated'](),controller[_0x65ee('0x13')]);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 b5d9933..0365f66 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 _0x9e9a=['internal','inbound-fax','outbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x9e9a,0x180));var _0xa9e9=function(_0x1f909a,_0x15d56f){_0x1f909a=_0x1f909a-0x0;var _0x543f16=_0x9e9a[_0x1f909a];return _0x543f16;};'use strict';var Sequelize=require(_0xa9e9('0x0'));module['exports']={'context':{'type':Sequelize[_0xa9e9('0x1')],'allowNull':![],'unique':_0xa9e9('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xa9e9('0x1')],'allowNull':![],'unique':_0xa9e9('0x2')},'priority':{'type':Sequelize[_0xa9e9('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xa9e9('0x2')},'tag':{'type':Sequelize[_0xa9e9('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xa9e9('0x1')],'allowNull':![],'defaultValue':_0xa9e9('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xa9e9('0x4')](_0xa9e9('0x5'),_0xa9e9('0x6'),_0xa9e9('0x7'),_0xa9e9('0x8'),_0xa9e9('0x9'),_0xa9e9('0xa'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0xa9e9('0x1')]},'interval':{'type':Sequelize[_0xa9e9('0x1')],'allowNull':![],'defaultValue':_0xa9e9('0xb')},'IntervalId':{'type':Sequelize[_0xa9e9('0xc')]},'isApp':{'type':Sequelize[_0xa9e9('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xa9e9('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xa9e9('0x1')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xa9e9('0xc')]},'recordingFormat':{'type':Sequelize[_0xa9e9('0x1')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xa9e9('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0xa9e9('0xe')],'get':function(_0x2715d9){return this[_0xa9e9('0xf')](_0xa9e9('0x10'));}},'alias':{'type':Sequelize[_0xa9e9('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x34cf=['wav','VIRTUAL','exten','exports','STRING','compositeIndex','ENUM','inbound','outbound','inbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN'];(function(_0x3328ac,_0x28f068){var _0x5c729e=function(_0x1866e7){while(--_0x1866e7){_0x3328ac['push'](_0x3328ac['shift']());}};_0x5c729e(++_0x28f068);}(_0x34cf,0xc6));var _0xf34c=function(_0x4a11e0,_0x5d9cad){_0x4a11e0=_0x4a11e0-0x0;var _0x2db0ee=_0x34cf[_0x4a11e0];return _0x2db0ee;};'use strict';var Sequelize=require('sequelize');module[_0xf34c('0x0')]={'context':{'type':Sequelize[_0xf34c('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xf34c('0x1')],'allowNull':![],'unique':_0xf34c('0x2')},'priority':{'type':Sequelize[_0xf34c('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xf34c('0x2')},'tag':{'type':Sequelize[_0xf34c('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xf34c('0x1')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xf34c('0x3')](_0xf34c('0x4'),_0xf34c('0x5'),'internal',_0xf34c('0x6'),'outbound-fax',_0xf34c('0x7'),_0xf34c('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0xf34c('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf34c('0x9')},'IntervalId':{'type':Sequelize[_0xf34c('0xa')]},'isApp':{'type':Sequelize[_0xf34c('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xf34c('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xf34c('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xf34c('0xa')]},'recordingFormat':{'type':Sequelize[_0xf34c('0x1')],'defaultValue':_0xf34c('0xc')},'answer':{'type':Sequelize[_0xf34c('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xf34c('0xd')],'get':function(_0x226bd5){return this['getDataValue'](_0xf34c('0xe'));}},'alias':{'type':Sequelize[_0xf34c('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 0b1a775..259260c 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 _0x8721=['localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','destroy','get','InboundRoutes','inbound','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','then','error','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','include','VoiceExtension','findAll','rows','catch','show','params','includeAll','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','InternalRoutes','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','addApplications','sequelize','transaction','READ_COMMITTED','findOne','VoiceExtensionId','cast(priority\x20as\x20unsigned)','stack','finally','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults'];(function(_0x57f17f,_0x56be02){var _0x194657=function(_0x11653c){while(--_0x11653c){_0x57f17f['push'](_0x57f17f['shift']());}};_0x194657(++_0x56be02);}(_0x8721,0x16e));var _0x1872=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0x8721[_0x234ae1];return _0x227ba0;};'use strict';var _=require('lodash');var Redis=require(_0x1872('0x0'));var qs=require(_0x1872('0x1'));var logger=require(_0x1872('0x2'))('api');var config=require('../../config/environment');var db=require(_0x1872('0x3'))['db'];config[_0x1872('0x4')]=_[_0x1872('0x5')](config[_0x1872('0x4')],{'host':_0x1872('0x6'),'port':0x18eb});var socket=require(_0x1872('0x7'))(new Redis(config['redis']));require(_0x1872('0x8'))[_0x1872('0x9')](socket);function respondWithStatusCode(_0x33236c,_0x163a92){_0x163a92=_0x163a92||0xcc;return function(_0x4654d9){if(_0x4654d9){return _0x33236c[_0x1872('0xa')](_0x163a92);}return _0x33236c['status'](_0x163a92)[_0x1872('0xb')]();};}function respondWithResult(_0x2e2abb,_0x17e311){_0x17e311=_0x17e311||0xc8;return function(_0x25f59c){if(_0x25f59c){return _0x2e2abb[_0x1872('0xc')](_0x17e311)['json'](_0x25f59c);}};}function respondWithFilteredResult(_0xe585cb,_0x33e1bb){return function(_0x263f9f){if(_0x263f9f){var _0x20dc91=typeof _0x33e1bb[_0x1872('0xd')]===_0x1872('0xe')&&typeof _0x33e1bb[_0x1872('0xf')]==='undefined';var _0x37571a=_0x263f9f[_0x1872('0x10')];var _0x3ee7b6=_0x20dc91?0x0:_0x33e1bb[_0x1872('0xd')];var _0x2ce893=_0x20dc91?_0x263f9f[_0x1872('0x10')]:_0x33e1bb['offset']+_0x33e1bb[_0x1872('0xf')];var _0xbe04d1;if(_0x2ce893>=_0x37571a){_0x2ce893=_0x37571a;_0xbe04d1=0xc8;}else{_0xbe04d1=0xce;}_0xe585cb[_0x1872('0xc')](_0xbe04d1);return _0xe585cb[_0x1872('0x11')](_0x1872('0x12'),_0x3ee7b6+'-'+_0x2ce893+'/'+_0x37571a)[_0x1872('0x13')](_0x263f9f);}return null;};}function removeEntity(_0x9427c4){return function(_0x21ba42){if(_0x21ba42){return _0x21ba42[_0x1872('0x14')]()['then'](function(){var _0x3e134c=_0x21ba42[_0x1872('0x15')]({'plain':!![]});var _0x4c0520=[{'name':_0x1872('0x16'),'value':_0x1872('0x17'),'ignore':![]},{'name':'OutboundRoutes','value':_0x1872('0x18'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x195951=_(_0x4c0520)[_0x1872('0x19')](_0x1872('0x1a'))[_0x1872('0x1b')]('value')[_0x1872('0x1c')]();if(_[_0x1872('0x1d')](_0x195951,_0x3e134c[_0x1872('0x1e')])){return;}var _0x334e50=_[_0x1872('0x1f')](_0x4c0520,[_0x1872('0x1c'),_0x3e134c[_0x1872('0x1e')]])[_0x1872('0x20')];return db[_0x1872('0x21')][_0x1872('0x14')]({'where':{'type':_0x334e50,'resourceId':_0x3e134c['id']}})[_0x1872('0x22')](function(){return _0x21ba42;});})[_0x1872('0x22')](function(){_0x9427c4[_0x1872('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10c2e8){return function(_0x3e38b5){if(!_0x3e38b5){_0x10c2e8['sendStatus'](0x194);}return _0x3e38b5;};}function handleError(_0x452bee,_0x380d7e){_0x380d7e=_0x380d7e||0x1f4;return function(_0x41e111){logger[_0x1872('0x23')](_0x41e111['stack']);if(_0x41e111[_0x1872('0x20')]){delete _0x41e111[_0x1872('0x20')];}_0x452bee[_0x1872('0xc')](_0x380d7e)[_0x1872('0x24')](_0x41e111);};}exports[_0x1872('0x25')]=function(_0x1c8a80,_0x21351c){var _0x1acf08={},_0x256916={},_0x20ed24={'count':0x0,'rows':[]};var _0xd39e3a=_['map'](db['VoiceExtension'][_0x1872('0x26')],function(_0x3f3152){return{'name':_0x3f3152[_0x1872('0x27')],'type':_0x3f3152[_0x1872('0x1e')][_0x1872('0x28')]};});_0x256916[_0x1872('0x29')]=_[_0x1872('0x1b')](_0xd39e3a,_0x1872('0x20'));_0x256916[_0x1872('0x2a')]=_[_0x1872('0x2b')](_0x1c8a80[_0x1872('0x2a')]);_0x256916[_0x1872('0x2c')]=_[_0x1872('0x2d')](_0x256916[_0x1872('0x29')],_0x256916[_0x1872('0x2a')]);_0x1acf08[_0x1872('0x2e')]=_[_0x1872('0x2d')](_0x256916[_0x1872('0x29')],qs[_0x1872('0x2f')](_0x1c8a80[_0x1872('0x2a')]['fields']));_0x1acf08[_0x1872('0x2e')]=_0x1acf08[_0x1872('0x2e')][_0x1872('0x30')]?_0x1acf08[_0x1872('0x2e')]:_0x256916['model'];if(!_0x1c8a80[_0x1872('0x2a')][_0x1872('0x31')](_0x1872('0x32'))){_0x1acf08['limit']=qs['limit'](_0x1c8a80['query'][_0x1872('0xf')]);_0x1acf08[_0x1872('0xd')]=qs['offset'](_0x1c8a80[_0x1872('0x2a')][_0x1872('0xd')]);}_0x1acf08['order']=qs[_0x1872('0x33')](_0x1c8a80[_0x1872('0x2a')]['sort']);_0x1acf08[_0x1872('0x34')]=qs[_0x1872('0x2c')](_[_0x1872('0x35')](_0x1c8a80[_0x1872('0x2a')],_0x256916[_0x1872('0x2c')]),_0xd39e3a);if(_0x1c8a80['query'][_0x1872('0x19')]){_0x1acf08[_0x1872('0x34')]=_[_0x1872('0x36')](_0x1acf08['where'],{'$or':_[_0x1872('0x1b')](_0xd39e3a,function(_0x31b530){if(_0x31b530[_0x1872('0x1e')]!==_0x1872('0x37')){var _0x3de11d={};_0x3de11d[_0x31b530['name']]={'$like':'%'+_0x1c8a80[_0x1872('0x2a')][_0x1872('0x19')]+'%'};return _0x3de11d;}})});}_0x1acf08=_[_0x1872('0x36')]({},_0x1acf08,_0x1c8a80[_0x1872('0x38')]);var _0x378e56={'where':_0x1acf08[_0x1872('0x34')]};return db['VoiceExtension'][_0x1872('0x10')](_0x378e56)[_0x1872('0x22')](function(_0x133e07){_0x20ed24[_0x1872('0x10')]=_0x133e07;if(_0x1c8a80[_0x1872('0x2a')]['includeAll']){_0x1acf08[_0x1872('0x39')]=[{'all':!![]}];}return db[_0x1872('0x3a')][_0x1872('0x3b')](_0x1acf08);})[_0x1872('0x22')](function(_0x4d941c){_0x20ed24[_0x1872('0x3c')]=_0x4d941c;return _0x20ed24;})[_0x1872('0x22')](respondWithFilteredResult(_0x21351c,_0x1acf08))[_0x1872('0x3d')](handleError(_0x21351c,null));};exports[_0x1872('0x3e')]=function(_0x32583a,_0x890230){var _0x30aaa3={'raw':![],'where':{'id':_0x32583a[_0x1872('0x3f')]['id']}},_0xd2e6ad={};_0xd2e6ad[_0x1872('0x29')]=_['keys'](db[_0x1872('0x3a')]['rawAttributes']);_0xd2e6ad[_0x1872('0x2a')]=_[_0x1872('0x2b')](_0x32583a['query']);_0xd2e6ad[_0x1872('0x2c')]=_['intersection'](_0xd2e6ad[_0x1872('0x29')],_0xd2e6ad[_0x1872('0x2a')]);_0x30aaa3[_0x1872('0x2e')]=_[_0x1872('0x2d')](_0xd2e6ad[_0x1872('0x29')],qs[_0x1872('0x2f')](_0x32583a[_0x1872('0x2a')][_0x1872('0x2f')]));_0x30aaa3[_0x1872('0x2e')]=_0x30aaa3[_0x1872('0x2e')]['length']?_0x30aaa3['attributes']:_0xd2e6ad[_0x1872('0x29')];if(_0x32583a[_0x1872('0x2a')][_0x1872('0x40')]){_0x30aaa3[_0x1872('0x39')]=[{'all':!![]}];}_0x30aaa3=_[_0x1872('0x36')]({},_0x30aaa3,_0x32583a[_0x1872('0x38')]);return db[_0x1872('0x3a')][_0x1872('0x1f')](_0x30aaa3)[_0x1872('0x22')](handleEntityNotFound(_0x890230,null))[_0x1872('0x22')](respondWithResult(_0x890230,null))['catch'](handleError(_0x890230,null));};exports[_0x1872('0x14')]=function(_0x10cc53,_0x13e4ba){return db['VoiceExtension']['find']({'where':{'id':_0x10cc53[_0x1872('0x3f')]['id']}})[_0x1872('0x22')](handleEntityNotFound(_0x13e4ba,null))[_0x1872('0x22')](removeEntity(_0x13e4ba,null))['catch'](handleError(_0x13e4ba,null));};exports[_0x1872('0x41')]=function(_0x21d508,_0x13ef7b){if(_0x21d508[_0x1872('0x42')]['type']===_0x1872('0x18')&&!_[_0x1872('0x43')](_0x21d508[_0x1872('0x42')][_0x1872('0x44')],'_')){_0x21d508[_0x1872('0x42')][_0x1872('0x44')]='_'[_0x1872('0x45')](_0x21d508[_0x1872('0x42')][_0x1872('0x44')]);}return db[_0x1872('0x3a')][_0x1872('0x41')](_0x21d508[_0x1872('0x42')],{'raw':![]})['then'](function(_0x4e854d){var _0x26199d=_0x21d508[_0x1872('0x46')][_0x1872('0x15')]({'plain':!![]});if(!_0x26199d)throw new Error(_0x1872('0x47'));if(_0x26199d[_0x1872('0x48')]==='user'){var _0x321865=_0x4e854d[_0x1872('0x15')]({'plain':!![]});var _0x4b1097=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x1872('0x49'),'value':_0x1872('0x18')},{'name':_0x1872('0x4a'),'value':_0x1872('0x4b')}];var _0x517137=_[_0x1872('0x1f')](_0x4b1097,['value',_0x321865[_0x1872('0x1e')]])[_0x1872('0x20')];return db[_0x1872('0x4c')][_0x1872('0x1f')]({'where':{'name':_0x517137,'userProfileId':_0x26199d[_0x1872('0x4d')]},'raw':!![]})[_0x1872('0x22')](function(_0x42a0a4){if(_0x42a0a4&&_0x42a0a4[_0x1872('0x4e')]===0x0){return db['UserProfileResource'][_0x1872('0x41')]({'name':_0x321865['name'],'resourceId':_0x321865['id'],'type':_0x42a0a4['name'],'sectionId':_0x42a0a4['id']},{})[_0x1872('0x22')](function(){return _0x4e854d;});}else{return _0x4e854d;}})[_0x1872('0x3d')](function(_0x2d4bd3){logger['error'](_0x1872('0x4f'),_0x2d4bd3);throw _0x2d4bd3;});}return _0x4e854d;})['then'](respondWithResult(_0x13ef7b,0xc9))[_0x1872('0x3d')](handleError(_0x13ef7b,null));};exports['update']=function(_0x3c3852,_0x41255){if(_0x3c3852[_0x1872('0x42')]['id']){delete _0x3c3852['body']['id'];}return db[_0x1872('0x3a')][_0x1872('0x1f')]({'where':{'id':_0x3c3852[_0x1872('0x3f')]['id']}})[_0x1872('0x22')](handleEntityNotFound(_0x41255,null))[_0x1872('0x22')](function(_0x504c0a){if(_0x504c0a){return db[_0x1872('0x3a')][_0x1872('0x50')](_[_0x1872('0x35')](_0x3c3852[_0x1872('0x42')],['exten',_0x1872('0x51'),_0x1872('0x52'),'recordingFormat',_0x1872('0x53'),'mandatoryDisposition','alias']),{'where':{'context':_0x504c0a[_0x1872('0x51')],'exten':_0x504c0a[_0x1872('0x44')]},'individualHooks':!![]})[_0x1872('0x22')](function(_0x4f2b10){return _0x4f2b10;});}return null;})[_0x1872('0x22')](respondWithStatusCode(_0x41255,null))[_0x1872('0x3d')](handleError(_0x41255,null));};exports[_0x1872('0x54')]=function(_0x15f0e4,_0x240d1c){var _0x53df4e=_0x15f0e4[_0x1872('0x3f')]['id'];var _0x14909f=_0x15f0e4[_0x1872('0x42')];var _0x2a68ef=0xc8;var _0x50d6b0=null;return db[_0x1872('0x55')][_0x1872('0x56')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x1872('0x57')]},function(_0x38bbe1){return db[_0x1872('0x3a')][_0x1872('0x58')]({'where':{'id':_0x53df4e},'transaction':_0x38bbe1})[_0x1872('0x22')](function(_0x385777){if(_0x385777){return db[_0x1872('0x3a')][_0x1872('0x14')]({'where':{'VoiceExtensionId':_0x53df4e},'transaction':_0x38bbe1})[_0x1872('0x22')](function(){var _0x5b0dd3=_[_0x1872('0x1b')](_0x14909f,function(_0x1fcd37){_0x1fcd37[_0x1872('0x59')]=_0x53df4e;_0x1fcd37['isApp']=!![];return _0x1fcd37;});return _0x385777['createRouting'](_0x5b0dd3);})[_0x1872('0x22')](function(_0x2b76a9){return db[_0x1872('0x3a')]['bulkCreate'](_0x2b76a9,{'transaction':_0x38bbe1});});}else{_0x2a68ef=0x194;_0x50d6b0=[];}});})['then'](function(){if(_0x2a68ef!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x53df4e},'order':_0x1872('0x5a')})[_0x1872('0x22')](function(_0x31f8f3){_0x50d6b0=_0x31f8f3;});}})[_0x1872('0x3d')](function(_0x5c69de){_0x2a68ef=0x1f4;logger[_0x1872('0x23')](_0x5c69de[_0x1872('0x5b')]);if(_0x5c69de['name']){delete _0x5c69de[_0x1872('0x20')];}_0x50d6b0=_0x5c69de;})[_0x1872('0x5c')](function(){if(_0x50d6b0===null){_0x240d1c['sendStatus'](_0x2a68ef);}else{if(_0x2a68ef===0x1f4){_0x240d1c[_0x1872('0xc')](_0x2a68ef)[_0x1872('0x24')](_0x50d6b0);}else{_0x240d1c['status'](_0x2a68ef)[_0x1872('0x13')](_0x50d6b0);}}});}; \ No newline at end of file +var _0xc820=['ignore','map','includes','find','value','type','name','UserProfileResource','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','recordingFormat','cutdigits','alias','sequelize','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','findAndCountAll','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','destroy','then','OutboundRoutes','outbound','InternalRoutes','internal'];(function(_0x707c3,_0x3c7ca1){var _0x35a6cb=function(_0xa26127){while(--_0xa26127){_0x707c3['push'](_0x707c3['shift']());}};_0x35a6cb(++_0x3c7ca1);}(_0xc820,0x97));var _0x0c82=function(_0x79d61b,_0x6a19fc){_0x79d61b=_0x79d61b-0x0;var _0x47cdf7=_0xc820[_0x79d61b];return _0x47cdf7;};'use strict';var _=require(_0x0c82('0x0'));var Redis=require(_0x0c82('0x1'));var qs=require(_0x0c82('0x2'));var logger=require('../../config/logger')(_0x0c82('0x3'));var config=require(_0x0c82('0x4'));var db=require(_0x0c82('0x5'))['db'];config[_0x0c82('0x6')]=_['defaults'](config[_0x0c82('0x6')],{'host':_0x0c82('0x7'),'port':0x18eb});var socket=require(_0x0c82('0x8'))(new Redis(config[_0x0c82('0x6')]));require('./voiceExtension.socket')[_0x0c82('0x9')](socket);function respondWithStatusCode(_0x14eadf,_0x201e91){_0x201e91=_0x201e91||0xcc;return function(_0x3de4ab){if(_0x3de4ab){return _0x14eadf[_0x0c82('0xa')](_0x201e91);}return _0x14eadf[_0x0c82('0xb')](_0x201e91)[_0x0c82('0xc')]();};}function respondWithResult(_0x37d62e,_0x35a4d6){_0x35a4d6=_0x35a4d6||0xc8;return function(_0x37add6){if(_0x37add6){return _0x37d62e[_0x0c82('0xb')](_0x35a4d6)['json'](_0x37add6);}};}function respondWithFilteredResult(_0xdc85fa,_0x46121c){return function(_0x46c307){if(_0x46c307){var _0x254350=typeof _0x46121c[_0x0c82('0xd')]===_0x0c82('0xe')&&typeof _0x46121c['limit']===_0x0c82('0xe');var _0x276d8f=_0x46c307[_0x0c82('0xf')];var _0x41d8af=_0x254350?0x0:_0x46121c[_0x0c82('0xd')];var _0x3a4c44=_0x254350?_0x46c307[_0x0c82('0xf')]:_0x46121c[_0x0c82('0xd')]+_0x46121c[_0x0c82('0x10')];var _0x29ec96;if(_0x3a4c44>=_0x276d8f){_0x3a4c44=_0x276d8f;_0x29ec96=0xc8;}else{_0x29ec96=0xce;}_0xdc85fa[_0x0c82('0xb')](_0x29ec96);return _0xdc85fa['set'](_0x0c82('0x11'),_0x41d8af+'-'+_0x3a4c44+'/'+_0x276d8f)[_0x0c82('0x12')](_0x46c307);}return null;};}function removeEntity(_0xe3bb61){return function(_0x564482){if(_0x564482){return _0x564482[_0x0c82('0x13')]()[_0x0c82('0x14')](function(){var _0x42c558=_0x564482['get']({'plain':!![]});var _0xb7ac3f=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x0c82('0x15'),'value':_0x0c82('0x16'),'ignore':![]},{'name':_0x0c82('0x17'),'value':_0x0c82('0x18'),'ignore':![]}];var _0x506d6d=_(_0xb7ac3f)['filter'](_0x0c82('0x19'))[_0x0c82('0x1a')]('value')['value']();if(_[_0x0c82('0x1b')](_0x506d6d,_0x42c558['type'])){return;}var _0x4e7e97=_[_0x0c82('0x1c')](_0xb7ac3f,[_0x0c82('0x1d'),_0x42c558[_0x0c82('0x1e')]])[_0x0c82('0x1f')];return db[_0x0c82('0x20')][_0x0c82('0x13')]({'where':{'type':_0x4e7e97,'resourceId':_0x42c558['id']}})['then'](function(){return _0x564482;});})[_0x0c82('0x14')](function(){_0xe3bb61[_0x0c82('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58643e){return function(_0x1721a9){if(!_0x1721a9){_0x58643e[_0x0c82('0xa')](0x194);}return _0x1721a9;};}function handleError(_0x373001,_0x475b20){_0x475b20=_0x475b20||0x1f4;return function(_0x26da58){logger['error'](_0x26da58['stack']);if(_0x26da58[_0x0c82('0x1f')]){delete _0x26da58[_0x0c82('0x1f')];}_0x373001['status'](_0x475b20)[_0x0c82('0x21')](_0x26da58);};}exports[_0x0c82('0x22')]=function(_0x479323,_0xcaa8c8){var _0x342164={},_0x2fa8c4={},_0x451024={'count':0x0,'rows':[]};var _0x4b6ed3=_[_0x0c82('0x1a')](db[_0x0c82('0x23')][_0x0c82('0x24')],function(_0x5ee6d0){return{'name':_0x5ee6d0[_0x0c82('0x25')],'type':_0x5ee6d0[_0x0c82('0x1e')][_0x0c82('0x26')]};});_0x2fa8c4[_0x0c82('0x27')]=_[_0x0c82('0x1a')](_0x4b6ed3,_0x0c82('0x1f'));_0x2fa8c4[_0x0c82('0x28')]=_[_0x0c82('0x29')](_0x479323['query']);_0x2fa8c4['filters']=_[_0x0c82('0x2a')](_0x2fa8c4[_0x0c82('0x27')],_0x2fa8c4[_0x0c82('0x28')]);_0x342164['attributes']=_[_0x0c82('0x2a')](_0x2fa8c4[_0x0c82('0x27')],qs[_0x0c82('0x2b')](_0x479323[_0x0c82('0x28')][_0x0c82('0x2b')]));_0x342164['attributes']=_0x342164[_0x0c82('0x2c')][_0x0c82('0x2d')]?_0x342164['attributes']:_0x2fa8c4[_0x0c82('0x27')];if(!_0x479323['query'][_0x0c82('0x2e')](_0x0c82('0x2f'))){_0x342164[_0x0c82('0x10')]=qs[_0x0c82('0x10')](_0x479323[_0x0c82('0x28')][_0x0c82('0x10')]);_0x342164[_0x0c82('0xd')]=qs['offset'](_0x479323[_0x0c82('0x28')][_0x0c82('0xd')]);}_0x342164['order']=qs[_0x0c82('0x30')](_0x479323[_0x0c82('0x28')][_0x0c82('0x30')]);_0x342164[_0x0c82('0x31')]=qs[_0x0c82('0x32')](_['pick'](_0x479323['query'],_0x2fa8c4['filters']),_0x4b6ed3);if(_0x479323['query'][_0x0c82('0x33')]){_0x342164[_0x0c82('0x31')]=_[_0x0c82('0x34')](_0x342164[_0x0c82('0x31')],{'$or':_[_0x0c82('0x1a')](_0x4b6ed3,function(_0x15e135){if(_0x15e135[_0x0c82('0x1e')]!==_0x0c82('0x35')){var _0xd501d7={};_0xd501d7[_0x15e135[_0x0c82('0x1f')]]={'$like':'%'+_0x479323[_0x0c82('0x28')][_0x0c82('0x33')]+'%'};return _0xd501d7;}})});}_0x342164=_[_0x0c82('0x34')]({},_0x342164,_0x479323[_0x0c82('0x36')]);var _0x46cac6={'where':_0x342164[_0x0c82('0x31')]};return db[_0x0c82('0x23')][_0x0c82('0xf')](_0x46cac6)['then'](function(_0x2737b7){_0x451024[_0x0c82('0xf')]=_0x2737b7;if(_0x479323[_0x0c82('0x28')][_0x0c82('0x37')]){_0x342164[_0x0c82('0x38')]=[{'all':!![]}];}return db[_0x0c82('0x23')][_0x0c82('0x39')](_0x342164);})[_0x0c82('0x14')](function(_0x3db4d1){_0x451024[_0x0c82('0x3a')]=_0x3db4d1;return _0x451024;})[_0x0c82('0x14')](respondWithFilteredResult(_0xcaa8c8,_0x342164))[_0x0c82('0x3b')](handleError(_0xcaa8c8,null));};exports[_0x0c82('0x3c')]=function(_0x2f91c5,_0x2604da){var _0x5d7213={'raw':![],'where':{'id':_0x2f91c5[_0x0c82('0x3d')]['id']}},_0x349e5b={};_0x349e5b[_0x0c82('0x27')]=_[_0x0c82('0x29')](db[_0x0c82('0x23')]['rawAttributes']);_0x349e5b['query']=_[_0x0c82('0x29')](_0x2f91c5[_0x0c82('0x28')]);_0x349e5b[_0x0c82('0x32')]=_[_0x0c82('0x2a')](_0x349e5b[_0x0c82('0x27')],_0x349e5b[_0x0c82('0x28')]);_0x5d7213[_0x0c82('0x2c')]=_[_0x0c82('0x2a')](_0x349e5b[_0x0c82('0x27')],qs[_0x0c82('0x2b')](_0x2f91c5[_0x0c82('0x28')][_0x0c82('0x2b')]));_0x5d7213['attributes']=_0x5d7213[_0x0c82('0x2c')][_0x0c82('0x2d')]?_0x5d7213[_0x0c82('0x2c')]:_0x349e5b[_0x0c82('0x27')];if(_0x2f91c5[_0x0c82('0x28')][_0x0c82('0x37')]){_0x5d7213[_0x0c82('0x38')]=[{'all':!![]}];}_0x5d7213=_[_0x0c82('0x34')]({},_0x5d7213,_0x2f91c5[_0x0c82('0x36')]);return db[_0x0c82('0x23')][_0x0c82('0x1c')](_0x5d7213)['then'](handleEntityNotFound(_0x2604da,null))['then'](respondWithResult(_0x2604da,null))[_0x0c82('0x3b')](handleError(_0x2604da,null));};exports[_0x0c82('0x13')]=function(_0x1428bd,_0x28ec4b){return db[_0x0c82('0x23')]['find']({'where':{'id':_0x1428bd[_0x0c82('0x3d')]['id']}})[_0x0c82('0x14')](handleEntityNotFound(_0x28ec4b,null))['then'](removeEntity(_0x28ec4b,null))[_0x0c82('0x3b')](handleError(_0x28ec4b,null));};exports[_0x0c82('0x3e')]=function(_0x40d785,_0x30acda){if(_0x40d785[_0x0c82('0x3f')][_0x0c82('0x1e')]===_0x0c82('0x16')&&!_[_0x0c82('0x40')](_0x40d785['body'][_0x0c82('0x41')],'_')){_0x40d785[_0x0c82('0x3f')][_0x0c82('0x41')]='_'[_0x0c82('0x42')](_0x40d785['body'][_0x0c82('0x41')]);}return db['VoiceExtension'][_0x0c82('0x3e')](_0x40d785[_0x0c82('0x3f')],{'raw':![]})[_0x0c82('0x14')](function(_0x5105f8){var _0x14d3f1=_0x40d785[_0x0c82('0x43')]['get']({'plain':!![]});if(!_0x14d3f1)throw new Error(_0x0c82('0x44'));if(_0x14d3f1[_0x0c82('0x45')]==='user'){var _0x46f09a=_0x5105f8[_0x0c82('0x46')]({'plain':!![]});var _0xf79f56=[{'name':'InboundRoutes','value':'inbound'},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x0c82('0x17'),'value':_0x0c82('0x18')}];var _0x33a2bc=_[_0x0c82('0x1c')](_0xf79f56,['value',_0x46f09a[_0x0c82('0x1e')]])['name'];return db[_0x0c82('0x47')]['find']({'where':{'name':_0x33a2bc,'userProfileId':_0x14d3f1[_0x0c82('0x48')]},'raw':!![]})[_0x0c82('0x14')](function(_0x5454e2){if(_0x5454e2&&_0x5454e2[_0x0c82('0x49')]===0x0){return db[_0x0c82('0x20')][_0x0c82('0x3e')]({'name':_0x46f09a[_0x0c82('0x1f')],'resourceId':_0x46f09a['id'],'type':_0x5454e2['name'],'sectionId':_0x5454e2['id']},{})['then'](function(){return _0x5105f8;});}else{return _0x5105f8;}})[_0x0c82('0x3b')](function(_0x455e4e){logger[_0x0c82('0x4a')](_0x0c82('0x4b'),_0x455e4e);throw _0x455e4e;});}return _0x5105f8;})[_0x0c82('0x14')](respondWithResult(_0x30acda,0xc9))['catch'](handleError(_0x30acda,null));};exports[_0x0c82('0x4c')]=function(_0x2ea98e,_0x2658e9){if(_0x2ea98e[_0x0c82('0x3f')]['id']){delete _0x2ea98e['body']['id'];}return db[_0x0c82('0x23')][_0x0c82('0x1c')]({'where':{'id':_0x2ea98e['params']['id']}})[_0x0c82('0x14')](handleEntityNotFound(_0x2658e9,null))[_0x0c82('0x14')](function(_0x101ca2){if(_0x101ca2){return db[_0x0c82('0x23')][_0x0c82('0x4c')](_[_0x0c82('0x4d')](_0x2ea98e['body'],[_0x0c82('0x41'),_0x0c82('0x4e'),'description',_0x0c82('0x4f'),_0x0c82('0x50'),'mandatoryDisposition',_0x0c82('0x51')]),{'where':{'context':_0x101ca2[_0x0c82('0x4e')],'exten':_0x101ca2['exten']},'individualHooks':!![]})[_0x0c82('0x14')](function(_0x26e42f){return _0x26e42f;});}return null;})['then'](respondWithStatusCode(_0x2658e9,null))[_0x0c82('0x3b')](handleError(_0x2658e9,null));};exports['addApplications']=function(_0x1c34ec,_0x630dfc){var _0x2a5649=_0x1c34ec['params']['id'];var _0x1515f6=_0x1c34ec[_0x0c82('0x3f')];var _0x4a8fd2=0xc8;var _0x1ef786=null;return db[_0x0c82('0x52')]['transaction']({'isolationLevel':db[_0x0c82('0x52')]['Transaction']['ISOLATION_LEVELS'][_0x0c82('0x53')]},function(_0x17db8a){return db[_0x0c82('0x23')]['findOne']({'where':{'id':_0x2a5649},'transaction':_0x17db8a})[_0x0c82('0x14')](function(_0x22bd45){if(_0x22bd45){return db[_0x0c82('0x23')]['destroy']({'where':{'VoiceExtensionId':_0x2a5649},'transaction':_0x17db8a})[_0x0c82('0x14')](function(){var _0x3c05e8=_[_0x0c82('0x1a')](_0x1515f6,function(_0x583b2f){_0x583b2f[_0x0c82('0x54')]=_0x2a5649;_0x583b2f[_0x0c82('0x55')]=!![];return _0x583b2f;});return _0x22bd45[_0x0c82('0x56')](_0x3c05e8);})[_0x0c82('0x14')](function(_0x2b3d32){return db[_0x0c82('0x23')]['bulkCreate'](_0x2b3d32,{'transaction':_0x17db8a});});}else{_0x4a8fd2=0x194;_0x1ef786=[];}});})['then'](function(){if(_0x4a8fd2!==0x194){return db[_0x0c82('0x23')][_0x0c82('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2a5649},'order':'cast(priority\x20as\x20unsigned)'})[_0x0c82('0x14')](function(_0x534894){_0x1ef786=_0x534894;});}})['catch'](function(_0x4b0e69){_0x4a8fd2=0x1f4;logger[_0x0c82('0x4a')](_0x4b0e69['stack']);if(_0x4b0e69['name']){delete _0x4b0e69[_0x0c82('0x1f')];}_0x1ef786=_0x4b0e69;})['finally'](function(){if(_0x1ef786===null){_0x630dfc[_0x0c82('0xa')](_0x4a8fd2);}else{if(_0x4a8fd2===0x1f4){_0x630dfc[_0x0c82('0xb')](_0x4a8fd2)[_0x0c82('0x21')](_0x1ef786);}else{_0x630dfc[_0x0c82('0xb')](_0x4a8fd2)[_0x0c82('0x12')](_0x1ef786);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index b018330..cd26277 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 _0x407c=['hasOwnProperty','hook','exports','events','../../mysqldb','update','remove','emit'];(function(_0x5833c6,_0x28a1e){var _0x4c4e7a=function(_0x45774f){while(--_0x45774f){_0x5833c6['push'](_0x5833c6['shift']());}};_0x4c4e7a(++_0x28a1e);}(_0x407c,0x18b));var _0xc407=function(_0x480b8e,_0x56d780){_0x480b8e=_0x480b8e-0x0;var _0x43d86b=_0x407c[_0x480b8e];return _0x43d86b;};'use strict';var EventEmitter=require(_0xc407('0x0'));var VoiceExtension=require(_0xc407('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc407('0x2'),'afterDestroy':_0xc407('0x3')};function emitEvent(_0x3e3a73){return function(_0xa9053d,_0x577655,_0x1443d5){VoiceExtensionEvents[_0xc407('0x4')](_0x3e3a73+':'+_0xa9053d['id'],_0xa9053d);VoiceExtensionEvents[_0xc407('0x4')](_0x3e3a73,_0xa9053d);_0x1443d5(null);};}for(var e in events){if(events[_0xc407('0x5')](e)){var event=events[e];VoiceExtension[_0xc407('0x6')](e,emitEvent(event));}}module[_0xc407('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x79e0=['VoiceExtension','setMaxListeners','save','update','emit','hook','exports','../../mysqldb'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x79e0,0xd7));var _0x079e=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x79e0[_0x5c9307];return _0x373e29;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x079e('0x0'))['db'][_0x079e('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x079e('0x2')](0x0);var events={'afterCreate':_0x079e('0x3'),'afterUpdate':_0x079e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ec80d){return function(_0x58cda8,_0x23d7a7,_0x38244f){VoiceExtensionEvents[_0x079e('0x5')](_0x1ec80d+':'+_0x58cda8['id'],_0x58cda8);VoiceExtensionEvents[_0x079e('0x5')](_0x1ec80d,_0x58cda8);_0x38244f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x079e('0x6')](e,emitEvent(event));}}module[_0x079e('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 9a598be..4ad0a80 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 _0x7579=['includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','appdata','priority','last','concat','VoiceExtension','voice_extensions','Hangup','lodash','./voiceExtension.attributes','exports','models','type','CDR(type)=','context','Set','NoOp','alias','No\x20alias\x20set','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','CDR(type)=outbound','outbound','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','length','name','param','phone','prefix','SIP','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','answer','queue','playback'];(function(_0x150706,_0x5c28e6){var _0x3507e1=function(_0x1798cb){while(--_0x1798cb){_0x150706['push'](_0x150706['shift']());}};_0x3507e1(++_0x5c28e6);}(_0x7579,0x1e2));var _0x9757=function(_0x2c5f7c,_0x1cd767){_0x2c5f7c=_0x2c5f7c-0x0;var _0x326d7a=_0x7579[_0x2c5f7c];return _0x326d7a;};'use strict';var _=require(_0x9757('0x0'));var attributes=require(_0x9757('0x1'));module[_0x9757('0x2')]=function(_0x30eeec){var _0x2e6afa=_0x30eeec[_0x9757('0x3')];function _0x5a7bc9(_0x399165){var _0x231ca6=0x2;var _0xcffaa0=[{'type':_0x399165[_0x9757('0x4')],'app':'Set','appdata':_0x9757('0x5')+_0x399165[_0x9757('0x4')],'context':_0x399165[_0x9757('0x6')],'exten':_0x399165['exten'],'priority':_0x231ca6++,'VoiceExtensionId':_0x399165['id']},{'type':_0x399165[_0x9757('0x4')],'app':_0x399165['alias']?_0x9757('0x7'):_0x9757('0x8'),'appdata':_0x399165[_0x9757('0x9')]?'CDR(routeAlias)='+_0x399165[_0x9757('0x9')]:_0x9757('0xa'),'context':_0x399165[_0x9757('0x6')],'exten':_0x399165[_0x9757('0xb')],'priority':_0x231ca6++,'VoiceExtensionId':_0x399165['id']}];if(_0x399165[_0x9757('0x4')]===_0x9757('0xc')){_0xcffaa0[_0x9757('0xd')]({'type':_0x9757('0xc'),'app':_0x9757('0x7'),'appdata':_0x9757('0xe')+_0x399165['id'],'context':_0x399165[_0x9757('0x6')],'exten':_0x399165['exten'],'priority':_0x231ca6++,'VoiceExtensionId':_0x399165['id']});}_0xcffaa0[_0x9757('0xd')]({'type':_0x399165[_0x9757('0x4')],'app':_0x9757('0x7'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x399165[_0x9757('0x6')],'exten':_0x399165[_0x9757('0xb')],'priority':_0x231ca6++,'VoiceExtensionId':_0x399165['id']},{'type':_0x399165[_0x9757('0x4')],'app':_0x9757('0x7'),'appdata':_0x9757('0xf'),'context':_0x399165[_0x9757('0x6')],'exten':_0x399165[_0x9757('0xb')],'priority':_0x231ca6++,'VoiceExtensionId':_0x399165['id']},{'type':_0x399165['type'],'app':_0x9757('0x7'),'appdata':'MONITOR_OPTIONS=ab','context':_0x399165[_0x9757('0x6')],'exten':_0x399165[_0x9757('0xb')],'priority':_0x231ca6++,'VoiceExtensionId':_0x399165['id']});return _0xcffaa0;}function _0xad2a22(_0x1e4000){var _0x3f6be9=0x2;var _0x377390=[{'type':'outbound','app':_0x9757('0x7'),'appdata':_0x9757('0x10'),'context':_0x1e4000[_0x9757('0x6')],'exten':_0x1e4000[_0x9757('0xb')],'priority':_0x3f6be9++,'VoiceExtensionId':_0x1e4000['id']},{'type':_0x9757('0x11'),'app':_0x1e4000[_0x9757('0x9')]?_0x9757('0x7'):'NoOp','appdata':_0x1e4000[_0x9757('0x9')]?'CDR(routeAlias)='+_0x1e4000['alias']:_0x9757('0xa'),'context':_0x1e4000[_0x9757('0x6')],'exten':_0x1e4000[_0x9757('0xb')],'priority':_0x3f6be9++,'VoiceExtensionId':_0x1e4000['id']},{'type':_0x9757('0x11'),'app':'Set','appdata':'CDR(destination)='+(_0x1e4000['cutdigits']?_0x9757('0x12')+_0x1e4000[_0x9757('0x13')]+'}':_0x9757('0x14')),'context':_0x1e4000[_0x9757('0x6')],'exten':_0x1e4000['exten'],'priority':_0x3f6be9++,'VoiceExtensionId':_0x1e4000['id']},{'type':_0x9757('0x11'),'app':_0x9757('0x7'),'appdata':'CDR(routeid)='+_0x1e4000['id'],'context':_0x1e4000[_0x9757('0x6')],'exten':_0x1e4000[_0x9757('0xb')],'priority':_0x3f6be9++,'VoiceExtensionId':_0x1e4000['id']},{'type':'outbound','app':_0x9757('0x15'),'appdata':_0x9757('0x16')+(_0x3f6be9+0x2)+_0x9757('0x17')+(_0x3f6be9+0x1)+')','context':_0x1e4000[_0x9757('0x6')],'exten':_0x1e4000[_0x9757('0xb')],'priority':_0x3f6be9++,'VoiceExtensionId':_0x1e4000['id']},{'type':_0x9757('0x11'),'app':'Set','appdata':_0x1e4000[_0x9757('0x13')]?'CDR(prefix)=${EXTEN:0:'+_0x1e4000[_0x9757('0x13')]+'}':_0x9757('0x18'),'context':_0x1e4000['context'],'exten':_0x1e4000['exten'],'priority':_0x3f6be9++,'VoiceExtensionId':_0x1e4000['id']},{'type':_0x9757('0x11'),'app':_0x9757('0x7'),'appdata':_0x9757('0x19'),'context':_0x1e4000[_0x9757('0x6')],'exten':_0x1e4000['exten'],'priority':_0x3f6be9++,'VoiceExtensionId':_0x1e4000['id']},{'type':_0x9757('0x11'),'app':_0x9757('0x7'),'appdata':_0x9757('0xf'),'context':_0x1e4000[_0x9757('0x6')],'exten':_0x1e4000[_0x9757('0xb')],'priority':_0x3f6be9++,'VoiceExtensionId':_0x1e4000['id']},{'type':_0x9757('0x11'),'app':'Set','appdata':_0x9757('0x1a'),'context':_0x1e4000[_0x9757('0x6')],'exten':_0x1e4000[_0x9757('0xb')],'priority':_0x3f6be9++,'VoiceExtensionId':_0x1e4000['id']},{'type':_0x9757('0x11'),'app':_0x9757('0x7'),'appdata':_0x9757('0x1b')+_0x1e4000['id'],'context':_0x1e4000[_0x9757('0x6')],'exten':_0x1e4000['exten'],'priority':_0x3f6be9++,'VoiceExtensionId':_0x1e4000['id']}];if(_0x1e4000[_0x9757('0x1c')](_0x9757('0x1d'))&&_0x1e4000[_0x9757('0x1d')]!==_0x9757('0x1e')){_0x377390[_0x9757('0xd')]({'type':_0x9757('0x11'),'app':_0x9757('0x7'),'appdata':_0x9757('0x1f'),'context':_0x1e4000['context'],'exten':_0x1e4000[_0x9757('0xb')],'priority':_0x3f6be9++,'VoiceExtensionId':_0x1e4000['id']},{'type':'outbound','app':_0x9757('0x7'),'appdata':_0x9757('0x20')+_0x1e4000['recordingFormat']||_0x9757('0x21'),'context':_0x1e4000[_0x9757('0x6')],'exten':_0x1e4000[_0x9757('0xb')],'priority':_0x3f6be9++,'VoiceExtensionId':_0x1e4000['id']});}return _0x377390;}function _0x12beb2(_0x459bcc,_0x2f2688){var _0x3c94b2=[{'name':_0x9757('0x22'),'param':0x0},{'name':_0x9757('0x23'),'param':0x1},{'name':_0x9757('0x24'),'param':0x2},{'name':'url','param':0x3}];var _0x329dc3={};var _0x1224a3=_0x2f2688[_0x9757('0x25')](',');var _0x4f2ea4=[];for(var _0x3c4b9c=0x0;_0x3c4b9c<_0x3c94b2[_0x9757('0x26')];_0x3c4b9c++){switch(_0x3c94b2[_0x3c4b9c][_0x9757('0x27')]){case _0x9757('0x22'):_0x329dc3[_0x9757('0x22')]=_0x1224a3[_0x3c94b2[_0x3c4b9c][_0x9757('0x28')]][_0x9757('0x25')]('/')[0x1];_0x329dc3[_0x9757('0x29')]=_0x1224a3[_0x3c94b2[_0x3c4b9c][_0x9757('0x28')]]['split']('/')[0x2];_0x329dc3['prefix']=_0x329dc3[_0x9757('0x29')]?_0x329dc3[_0x9757('0x29')][_0x9757('0x25')]('$')[0x0]:undefined;_0x329dc3[_0x9757('0x29')]=_0x459bcc['cutdigits']?(_0x329dc3[_0x9757('0x2a')]||'')+'${EXTEN:'+_0x459bcc[_0x9757('0x13')]+'}':(_0x329dc3[_0x9757('0x2a')]||'')+_0x9757('0x14');_0x4f2ea4[_0x3c94b2[_0x3c4b9c]['param']]=[_0x9757('0x2b'),_0x329dc3[_0x9757('0x22')],_0x329dc3[_0x9757('0x29')]]['join']('/');break;case _0x9757('0x24'):_0x329dc3['options']=_0x1224a3[_0x3c94b2[_0x3c4b9c]['param']];if(_0x459bcc[_0x9757('0x1d')]!==_0x9757('0x1e')){if(_0x329dc3[_0x9757('0x24')][_0x9757('0x2c')](_0x9757('0x2d'))<0x0){_0x329dc3['options']+='U(xcally-mixmonitor-context)';}}else{_0x329dc3['options']=_0x329dc3[_0x9757('0x24')][_0x9757('0x2e')](_0x9757('0x2d'),'');}_0x4f2ea4[_0x3c94b2[_0x3c4b9c]['param']]=_0x329dc3[_0x9757('0x24')];break;default:_0x4f2ea4[_0x3c94b2[_0x3c4b9c][_0x9757('0x28')]]=_0x1224a3[_0x3c94b2[_0x3c4b9c]['param']];}}return _0x4f2ea4[_0x9757('0x2f')](',');}function _0x2e7ad9(_0x3a1658,_0xa84122,_0x49cba0){return new Promise(function(_0xc312a8,_0x2d616a){var _0x1a1222=[];if(_[_0x9757('0x30')](_0xa84122))return _0xc312a8(_0x1a1222);_0x2e6afa[_0x9757('0x31')][_0x9757('0x32')]({'attributes':['id',_0x9757('0x33'),_0x9757('0x34')],'raw':!![]})[_0x9757('0x35')](function(_0x5c977e){for(var _0x5f3588=0x0,_0x35c2c1=0x0;_0x5f3588<_0xa84122[_0x9757('0x26')];_0x5f3588++,_0x35c2c1=0x0){var _0x164593=_0xa84122[_0x5f3588];var _0x544c49=[];var _0x229f8a=[];delete _0x164593['id'];if(_0x164593[_0x9757('0x33')]!==_0x9757('0x36')){_0x164593['intervals']=[_0x164593[_0x9757('0x33')]];}else{_0x164593[_0x9757('0x37')]=_0x164593['IntervalId']?_['map'](_['filter'](_0x5c977e,{'IntervalId':_0x164593[_0x9757('0x34')]}),_0x9757('0x33')):[];}_0x164593[_0x9757('0x6')]=_0x3a1658['context'];_0x164593[_0x9757('0xb')]=_0x3a1658['exten'];if(_0x164593[_0x9757('0x4')])_0x164593[_0x9757('0x4')]=_0x164593['type'][_0x9757('0x38')]();if(_0x3a1658[_0x9757('0x4')]===_0x9757('0x11')){if(_0x164593[_0x9757('0x1c')](_0x9757('0x39'))&&_0x164593['tag']&&_0x164593[_0x9757('0x39')]!=='--'){_0x544c49[_0x9757('0xd')]({'type':_0x164593[_0x9757('0x4')][_0x9757('0x38')](),'app':_0x9757('0x7'),'appdata':_0x9757('0x3a')+_0x164593[_0x9757('0x39')],'context':_0x3a1658['context'],'exten':_0x3a1658['exten'],'priority':_0x164593[_0x9757('0x37')]['length']+_0x49cba0+_0x35c2c1++,'VoiceExtensionId':_0x3a1658['id']});}_0x544c49['push']({'type':_0x164593[_0x9757('0x4')]['toLowerCase'](),'app':_0x9757('0x15'),'appdata':_0x9757('0x3b')+(_0x164593['callerID']?'Set(CALLERID(all)='+_0x164593[_0x9757('0x3c')]+')':'NoOp(No\x20number\x20available)'),'context':_0x3a1658[_0x9757('0x6')],'exten':_0x3a1658['exten'],'priority':_0x164593[_0x9757('0x37')]['length']+_0x49cba0+_0x35c2c1++,'VoiceExtensionId':_0x3a1658['id']});}else{if(_0x164593[_0x9757('0x1c')](_0x9757('0x3d'))){if([_0x9757('0x3e'),_0x9757('0x3f')][_0x9757('0x40')](_0x164593[_0x9757('0x41')][_0x9757('0x38')]())&&_0x164593[_0x9757('0x42')]!=='custom'){if(_0x164593[_0x9757('0x3d')]){_0x544c49[_0x9757('0xd')]({'type':_0x164593[_0x9757('0x4')][_0x9757('0x38')](),'app':_0x9757('0x15'),'appdata':_0x9757('0x43'),'context':_0x3a1658[_0x9757('0x6')],'exten':_0x3a1658[_0x9757('0xb')],'priority':_0x164593[_0x9757('0x37')][_0x9757('0x26')]+_0x49cba0+_0x35c2c1++,'VoiceExtensionId':_0x3a1658['id']});_0x544c49[_0x9757('0xd')]({'type':_0x164593[_0x9757('0x4')][_0x9757('0x38')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3a1658[_0x9757('0x6')],'exten':_0x3a1658['exten'],'priority':_0x164593[_0x9757('0x37')][_0x9757('0x26')]+_0x49cba0+_0x35c2c1++,'VoiceExtensionId':_0x3a1658['id']});}else{_0x544c49[_0x9757('0xd')]({'type':_0x164593['type'][_0x9757('0x38')](),'app':_0x9757('0x15'),'appdata':_0x9757('0x44'),'context':_0x3a1658[_0x9757('0x6')],'exten':_0x3a1658[_0x9757('0xb')],'priority':_0x164593[_0x9757('0x37')][_0x9757('0x26')]+_0x49cba0+_0x35c2c1++,'VoiceExtensionId':_0x3a1658['id']});_0x544c49[_0x9757('0xd')]({'type':_0x164593[_0x9757('0x4')][_0x9757('0x38')](),'app':_0x9757('0x7'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x3a1658[_0x9757('0x6')],'exten':_0x3a1658[_0x9757('0xb')],'priority':_0x164593[_0x9757('0x37')][_0x9757('0x26')]+_0x49cba0+_0x35c2c1++,'VoiceExtensionId':_0x3a1658['id']});}}}}for(var _0x3a361e=0x0;_0x3a361e<_0x164593[_0x9757('0x37')][_0x9757('0x26')];_0x3a361e++){var _0x518fd7=_0x49cba0+_0x164593[_0x9757('0x37')][_0x9757('0x26')];var _0x2a91f4=_0x3a361e===_0x164593['intervals']['length']-0x1?_0x49cba0+_0x544c49['length']+_0x229f8a[_0x9757('0x26')]+0x2:_0x49cba0+_0x3a361e+0x1;_0x544c49[_0x9757('0x45')](_0x3a361e,0x0,{'type':_0x3a1658[_0x9757('0x4')],'app':'GotoIfTime','appdata':_0x164593[_0x9757('0x37')][_0x3a361e]+'?'+_0x3a1658['context']+_0x9757('0x46')+_0x518fd7+':'+_0x3a1658['context']+',${EXTEN},'+_0x2a91f4,'exten':_0x3a1658[_0x9757('0xb')],'context':_0x3a1658[_0x9757('0x6')],'priority':_0x49cba0+_0x3a361e,'VoiceExtensionId':_0x3a1658['id']});}if(_0x164593[_0x9757('0x42')]==='outboundDial')_0x164593[_0x9757('0x47')]=_0x12beb2(_0x3a1658,_0x164593[_0x9757('0x47')]);_0x164593[_0x9757('0x48')]=_0x544c49[_0x9757('0x26')]?_[_0x9757('0x49')](_0x544c49)[_0x9757('0x48')]+0x1:_0x49cba0;_0x1a1222=_[_0x9757('0x4a')](_0x1a1222,_0x544c49,[_0x164593],_0x229f8a);_0x49cba0=_[_0x9757('0x49')](_0x1a1222)['priority']+0x1;}return _0xc312a8(_0x1a1222);})['catch'](function(_0x5b6c80){_0x2d616a(_0x5b6c80);});});}return _0x30eeec['define'](_0x9757('0x4b'),attributes,{'tableName':_0x9757('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x13a799){var _0x255b62=this['get']({'plain':!![]});var _0x58180a=_0x255b62[_0x9757('0x4')]==='outbound'?_0xad2a22(_0x255b62):_0x5a7bc9(_0x255b62);return _0x2e7ad9(_0x255b62,_0x13a799,_[_0x9757('0x49')](_0x58180a)[_0x9757('0x48')]+0x1)[_0x9757('0x35')](function(_0x431e51){var _0x1a03dd=_[_0x9757('0x4a')](_0x58180a,_0x431e51);_0x1a03dd[_0x9757('0xd')]({'type':_0x255b62[_0x9757('0x4')],'app':_0x9757('0x4d'),'exten':_0x255b62[_0x9757('0xb')],'context':_0x255b62[_0x9757('0x6')],'priority':_[_0x9757('0x49')](_0x1a03dd)[_0x9757('0x48')]+0x1,'VoiceExtensionId':_0x255b62['id']});return _0x1a03dd;});}}});}; \ No newline at end of file +var _0x0d64=['SIP','join','none','U(xcally-mixmonitor-context)','replace','interval','IntervalId','then','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','VoiceExtension','voice_extensions','get','concat','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','inbound','push','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','timeout','options','url','split','length','name','trunk','param','phone','prefix','${EXTEN}'];(function(_0x490bd1,_0x1de391){var _0x2f38e3=function(_0x2e036e){while(--_0x2e036e){_0x490bd1['push'](_0x490bd1['shift']());}};_0x2f38e3(++_0x1de391);}(_0x0d64,0x77));var _0x40d6=function(_0x396583,_0x1049e3){_0x396583=_0x396583-0x0;var _0x3af08e=_0x0d64[_0x396583];return _0x3af08e;};'use strict';var _=require(_0x40d6('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x40d6('0x1')]=function(_0x24aa2e){var _0x48b4d9=_0x24aa2e[_0x40d6('0x2')];function _0x3f6845(_0x59340b){var _0x1c9abe=0x2;var _0xa5722b=[{'type':_0x59340b[_0x40d6('0x3')],'app':_0x40d6('0x4'),'appdata':_0x40d6('0x5')+_0x59340b[_0x40d6('0x3')],'context':_0x59340b[_0x40d6('0x6')],'exten':_0x59340b[_0x40d6('0x7')],'priority':_0x1c9abe++,'VoiceExtensionId':_0x59340b['id']},{'type':_0x59340b[_0x40d6('0x3')],'app':_0x59340b[_0x40d6('0x8')]?_0x40d6('0x4'):_0x40d6('0x9'),'appdata':_0x59340b['alias']?'CDR(routeAlias)='+_0x59340b[_0x40d6('0x8')]:'No\x20alias\x20set','context':_0x59340b[_0x40d6('0x6')],'exten':_0x59340b[_0x40d6('0x7')],'priority':_0x1c9abe++,'VoiceExtensionId':_0x59340b['id']}];if(_0x59340b['type']===_0x40d6('0xa')){_0xa5722b['push']({'type':_0x40d6('0xa'),'app':'Set','appdata':'CDR(routeid)='+_0x59340b['id'],'context':_0x59340b['context'],'exten':_0x59340b[_0x40d6('0x7')],'priority':_0x1c9abe++,'VoiceExtensionId':_0x59340b['id']});}_0xa5722b[_0x40d6('0xb')]({'type':_0x59340b[_0x40d6('0x3')],'app':_0x40d6('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x59340b[_0x40d6('0x6')],'exten':_0x59340b[_0x40d6('0x7')],'priority':_0x1c9abe++,'VoiceExtensionId':_0x59340b['id']},{'type':_0x59340b[_0x40d6('0x3')],'app':_0x40d6('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x59340b[_0x40d6('0x6')],'exten':_0x59340b[_0x40d6('0x7')],'priority':_0x1c9abe++,'VoiceExtensionId':_0x59340b['id']},{'type':_0x59340b[_0x40d6('0x3')],'app':_0x40d6('0x4'),'appdata':_0x40d6('0xc'),'context':_0x59340b[_0x40d6('0x6')],'exten':_0x59340b[_0x40d6('0x7')],'priority':_0x1c9abe++,'VoiceExtensionId':_0x59340b['id']});return _0xa5722b;}function _0x249e0c(_0x1d9be4){var _0x5866e9=0x2;var _0x4290d0=[{'type':_0x40d6('0xd'),'app':'Set','appdata':_0x40d6('0xe'),'context':_0x1d9be4[_0x40d6('0x6')],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':_0x40d6('0xd'),'app':_0x1d9be4[_0x40d6('0x8')]?_0x40d6('0x4'):'NoOp','appdata':_0x1d9be4[_0x40d6('0x8')]?'CDR(routeAlias)='+_0x1d9be4[_0x40d6('0x8')]:_0x40d6('0xf'),'context':_0x1d9be4[_0x40d6('0x6')],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':_0x40d6('0xd'),'app':_0x40d6('0x4'),'appdata':'CDR(destination)='+(_0x1d9be4[_0x40d6('0x10')]?_0x40d6('0x11')+_0x1d9be4['cutdigits']+'}':'${EXTEN}'),'context':_0x1d9be4['context'],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':_0x40d6('0xd'),'app':_0x40d6('0x4'),'appdata':'CDR(routeid)='+_0x1d9be4['id'],'context':_0x1d9be4[_0x40d6('0x6')],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':_0x40d6('0xd'),'app':_0x40d6('0x12'),'appdata':_0x40d6('0x13')+(_0x5866e9+0x2)+'):Goto('+(_0x5866e9+0x1)+')','context':_0x1d9be4[_0x40d6('0x6')],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':_0x40d6('0xd'),'app':_0x40d6('0x4'),'appdata':_0x1d9be4[_0x40d6('0x10')]?_0x40d6('0x14')+_0x1d9be4['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x1d9be4[_0x40d6('0x6')],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':_0x40d6('0xd'),'app':_0x40d6('0x4'),'appdata':_0x40d6('0x15'),'context':_0x1d9be4[_0x40d6('0x6')],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':'outbound','app':'Set','appdata':_0x40d6('0x16'),'context':_0x1d9be4['context'],'exten':_0x1d9be4['exten'],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':_0x40d6('0xd'),'app':_0x40d6('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1d9be4['context'],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':_0x40d6('0xd'),'app':_0x40d6('0x4'),'appdata':_0x40d6('0x17')+_0x1d9be4['id'],'context':_0x1d9be4['context'],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']}];if(_0x1d9be4[_0x40d6('0x18')](_0x40d6('0x19'))&&_0x1d9be4[_0x40d6('0x19')]!=='none'){_0x4290d0[_0x40d6('0xb')]({'type':_0x40d6('0xd'),'app':_0x40d6('0x4'),'appdata':_0x40d6('0x1a'),'context':_0x1d9be4[_0x40d6('0x6')],'exten':_0x1d9be4['exten'],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']},{'type':'outbound','app':_0x40d6('0x4'),'appdata':_0x40d6('0x1b')+_0x1d9be4[_0x40d6('0x19')]||'wav','context':_0x1d9be4[_0x40d6('0x6')],'exten':_0x1d9be4[_0x40d6('0x7')],'priority':_0x5866e9++,'VoiceExtensionId':_0x1d9be4['id']});}return _0x4290d0;}function _0x15be32(_0x243822,_0x433e70){var _0x3966de=[{'name':'trunk','param':0x0},{'name':_0x40d6('0x1c'),'param':0x1},{'name':_0x40d6('0x1d'),'param':0x2},{'name':_0x40d6('0x1e'),'param':0x3}];var _0xa505b2={};var _0x161d3a=_0x433e70[_0x40d6('0x1f')](',');var _0x534494=[];for(var _0x1d366c=0x0;_0x1d366c<_0x3966de[_0x40d6('0x20')];_0x1d366c++){switch(_0x3966de[_0x1d366c][_0x40d6('0x21')]){case _0x40d6('0x22'):_0xa505b2[_0x40d6('0x22')]=_0x161d3a[_0x3966de[_0x1d366c][_0x40d6('0x23')]][_0x40d6('0x1f')]('/')[0x1];_0xa505b2[_0x40d6('0x24')]=_0x161d3a[_0x3966de[_0x1d366c][_0x40d6('0x23')]][_0x40d6('0x1f')]('/')[0x2];_0xa505b2[_0x40d6('0x25')]=_0xa505b2[_0x40d6('0x24')]?_0xa505b2[_0x40d6('0x24')][_0x40d6('0x1f')]('$')[0x0]:undefined;_0xa505b2['phone']=_0x243822['cutdigits']?(_0xa505b2[_0x40d6('0x25')]||'')+_0x40d6('0x11')+_0x243822['cutdigits']+'}':(_0xa505b2[_0x40d6('0x25')]||'')+_0x40d6('0x26');_0x534494[_0x3966de[_0x1d366c][_0x40d6('0x23')]]=[_0x40d6('0x27'),_0xa505b2['trunk'],_0xa505b2[_0x40d6('0x24')]][_0x40d6('0x28')]('/');break;case _0x40d6('0x1d'):_0xa505b2[_0x40d6('0x1d')]=_0x161d3a[_0x3966de[_0x1d366c][_0x40d6('0x23')]];if(_0x243822[_0x40d6('0x19')]!==_0x40d6('0x29')){if(_0xa505b2['options']['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0xa505b2['options']+=_0x40d6('0x2a');}}else{_0xa505b2['options']=_0xa505b2[_0x40d6('0x1d')][_0x40d6('0x2b')](_0x40d6('0x2a'),'');}_0x534494[_0x3966de[_0x1d366c][_0x40d6('0x23')]]=_0xa505b2['options'];break;default:_0x534494[_0x3966de[_0x1d366c][_0x40d6('0x23')]]=_0x161d3a[_0x3966de[_0x1d366c]['param']];}}return _0x534494[_0x40d6('0x28')](',');}function _0x34d467(_0x13c5e8,_0x4f1f75,_0x1d0648){return new Promise(function(_0x383507,_0x1cf0c6){var _0x2ab202=[];if(_['isEmpty'](_0x4f1f75))return _0x383507(_0x2ab202);_0x48b4d9['Interval']['findAll']({'attributes':['id',_0x40d6('0x2c'),_0x40d6('0x2d')],'raw':!![]})[_0x40d6('0x2e')](function(_0x4bd7c6){for(var _0x70d05c=0x0,_0x25f65a=0x0;_0x70d05c<_0x4f1f75[_0x40d6('0x20')];_0x70d05c++,_0x25f65a=0x0){var _0x1ea783=_0x4f1f75[_0x70d05c];var _0x1b210e=[];var _0x15b778=[];delete _0x1ea783['id'];if(_0x1ea783[_0x40d6('0x2c')]!=='*,*,*,*'){_0x1ea783['intervals']=[_0x1ea783[_0x40d6('0x2c')]];}else{_0x1ea783[_0x40d6('0x2f')]=_0x1ea783[_0x40d6('0x2d')]?_[_0x40d6('0x30')](_[_0x40d6('0x31')](_0x4bd7c6,{'IntervalId':_0x1ea783[_0x40d6('0x2d')]}),_0x40d6('0x2c')):[];}_0x1ea783[_0x40d6('0x6')]=_0x13c5e8['context'];_0x1ea783[_0x40d6('0x7')]=_0x13c5e8[_0x40d6('0x7')];if(_0x1ea783[_0x40d6('0x3')])_0x1ea783[_0x40d6('0x3')]=_0x1ea783[_0x40d6('0x3')][_0x40d6('0x32')]();if(_0x13c5e8['type']===_0x40d6('0xd')){if(_0x1ea783[_0x40d6('0x18')](_0x40d6('0x33'))&&_0x1ea783['tag']&&_0x1ea783['tag']!=='--'){_0x1b210e['push']({'type':_0x1ea783[_0x40d6('0x3')][_0x40d6('0x32')](),'app':_0x40d6('0x4'),'appdata':_0x40d6('0x34')+_0x1ea783['tag'],'context':_0x13c5e8[_0x40d6('0x6')],'exten':_0x13c5e8[_0x40d6('0x7')],'priority':_0x1ea783[_0x40d6('0x2f')]['length']+_0x1d0648+_0x25f65a++,'VoiceExtensionId':_0x13c5e8['id']});}_0x1b210e[_0x40d6('0xb')]({'type':_0x1ea783['type'][_0x40d6('0x32')](),'app':_0x40d6('0x12'),'appdata':_0x40d6('0x35')+(_0x1ea783[_0x40d6('0x36')]?_0x40d6('0x37')+_0x1ea783[_0x40d6('0x36')]+')':_0x40d6('0x38')),'context':_0x13c5e8[_0x40d6('0x6')],'exten':_0x13c5e8['exten'],'priority':_0x1ea783['intervals']['length']+_0x1d0648+_0x25f65a++,'VoiceExtensionId':_0x13c5e8['id']});}else{if(_0x1ea783[_0x40d6('0x18')](_0x40d6('0x39'))){if(['queue','playback'][_0x40d6('0x3a')](_0x1ea783[_0x40d6('0x3b')][_0x40d6('0x32')]())&&_0x1ea783[_0x40d6('0x3c')]!==_0x40d6('0x3d')){if(_0x1ea783[_0x40d6('0x39')]){_0x1b210e[_0x40d6('0xb')]({'type':_0x1ea783['type']['toLowerCase'](),'app':_0x40d6('0x12'),'appdata':_0x40d6('0x3e'),'context':_0x13c5e8[_0x40d6('0x6')],'exten':_0x13c5e8[_0x40d6('0x7')],'priority':_0x1ea783[_0x40d6('0x2f')][_0x40d6('0x20')]+_0x1d0648+_0x25f65a++,'VoiceExtensionId':_0x13c5e8['id']});_0x1b210e[_0x40d6('0xb')]({'type':_0x1ea783[_0x40d6('0x3')]['toLowerCase'](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x13c5e8['context'],'exten':_0x13c5e8['exten'],'priority':_0x1ea783[_0x40d6('0x2f')][_0x40d6('0x20')]+_0x1d0648+_0x25f65a++,'VoiceExtensionId':_0x13c5e8['id']});}else{_0x1b210e['push']({'type':_0x1ea783[_0x40d6('0x3')][_0x40d6('0x32')](),'app':'ExecIf','appdata':_0x40d6('0x3f'),'context':_0x13c5e8[_0x40d6('0x6')],'exten':_0x13c5e8[_0x40d6('0x7')],'priority':_0x1ea783[_0x40d6('0x2f')][_0x40d6('0x20')]+_0x1d0648+_0x25f65a++,'VoiceExtensionId':_0x13c5e8['id']});_0x1b210e['push']({'type':_0x1ea783[_0x40d6('0x3')]['toLowerCase'](),'app':_0x40d6('0x4'),'appdata':_0x40d6('0x40'),'context':_0x13c5e8[_0x40d6('0x6')],'exten':_0x13c5e8['exten'],'priority':_0x1ea783[_0x40d6('0x2f')]['length']+_0x1d0648+_0x25f65a++,'VoiceExtensionId':_0x13c5e8['id']});}}}}for(var _0x24d90f=0x0;_0x24d90f<_0x1ea783[_0x40d6('0x2f')]['length'];_0x24d90f++){var _0xe1ba99=_0x1d0648+_0x1ea783[_0x40d6('0x2f')]['length'];var _0x4e60b6=_0x24d90f===_0x1ea783[_0x40d6('0x2f')][_0x40d6('0x20')]-0x1?_0x1d0648+_0x1b210e['length']+_0x15b778['length']+0x2:_0x1d0648+_0x24d90f+0x1;_0x1b210e[_0x40d6('0x41')](_0x24d90f,0x0,{'type':_0x13c5e8['type'],'app':_0x40d6('0x42'),'appdata':_0x1ea783[_0x40d6('0x2f')][_0x24d90f]+'?'+_0x13c5e8[_0x40d6('0x6')]+_0x40d6('0x43')+_0xe1ba99+':'+_0x13c5e8[_0x40d6('0x6')]+_0x40d6('0x43')+_0x4e60b6,'exten':_0x13c5e8[_0x40d6('0x7')],'context':_0x13c5e8[_0x40d6('0x6')],'priority':_0x1d0648+_0x24d90f,'VoiceExtensionId':_0x13c5e8['id']});}if(_0x1ea783[_0x40d6('0x3c')]===_0x40d6('0x44'))_0x1ea783['appdata']=_0x15be32(_0x13c5e8,_0x1ea783[_0x40d6('0x45')]);_0x1ea783[_0x40d6('0x46')]=_0x1b210e[_0x40d6('0x20')]?_[_0x40d6('0x47')](_0x1b210e)[_0x40d6('0x46')]+0x1:_0x1d0648;_0x2ab202=_['concat'](_0x2ab202,_0x1b210e,[_0x1ea783],_0x15b778);_0x1d0648=_[_0x40d6('0x47')](_0x2ab202)[_0x40d6('0x46')]+0x1;}return _0x383507(_0x2ab202);})[_0x40d6('0x48')](function(_0x1bd6ac){_0x1cf0c6(_0x1bd6ac);});});}return _0x24aa2e[_0x40d6('0x49')](_0x40d6('0x4a'),attributes,{'tableName':_0x40d6('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x217aa5){var _0x3d7b5a=this[_0x40d6('0x4c')]({'plain':!![]});var _0x32c14f=_0x3d7b5a[_0x40d6('0x3')]===_0x40d6('0xd')?_0x249e0c(_0x3d7b5a):_0x3f6845(_0x3d7b5a);return _0x34d467(_0x3d7b5a,_0x217aa5,_[_0x40d6('0x47')](_0x32c14f)[_0x40d6('0x46')]+0x1)[_0x40d6('0x2e')](function(_0x364a00){var _0x566588=_[_0x40d6('0x4d')](_0x32c14f,_0x364a00);_0x566588[_0x40d6('0xb')]({'type':_0x3d7b5a[_0x40d6('0x3')],'app':_0x40d6('0x4e'),'exten':_0x3d7b5a['exten'],'context':_0x3d7b5a[_0x40d6('0x6')],'priority':_[_0x40d6('0x47')](_0x566588)[_0x40d6('0x46')]+0x1,'VoiceExtensionId':_0x3d7b5a['id']});return _0x566588;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 7a942a5..e43f946 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 _0xd9c8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','debug','request\x20sent','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','options','where','attributes','include','map','model','lodash','util'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xd9c8[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x8d9c('0x0'));var util=require(_0x8d9c('0x1'));var moment=require('moment');var BPromise=require(_0x8d9c('0x2'));var rs=require(_0x8d9c('0x3'));var fs=require('fs');var Redis=require(_0x8d9c('0x4'));var db=require(_0x8d9c('0x5'))['db'];var utils=require(_0x8d9c('0x6'));var logger=require(_0x8d9c('0x7'))(_0x8d9c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8d9c('0x9')]({'port':0x232a});config[_0x8d9c('0xa')]=_[_0x8d9c('0xb')](config['redis'],{'host':_0x8d9c('0xc'),'port':0x18eb});var socket=require(_0x8d9c('0xd'))(new Redis(config[_0x8d9c('0xa')]));require(_0x8d9c('0xe'))[_0x8d9c('0xf')](socket);function respondWithRpcPromise(_0xc3a2ff,_0xa2bf79,_0xaa0a72){return new BPromise(function(_0x52de51,_0x26b5b3){return client['request'](_0xc3a2ff,_0xaa0a72)[_0x8d9c('0x10')](function(_0x5d31e7){logger[_0x8d9c('0x11')]('VoiceExtension,\x20%s,\x20%s',_0xa2bf79,'request\x20sent');logger[_0x8d9c('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0xa2bf79,_0x8d9c('0x13'),JSON[_0x8d9c('0x14')](_0x5d31e7));if(_0x5d31e7[_0x8d9c('0x15')]){if(_0x5d31e7[_0x8d9c('0x15')][_0x8d9c('0x16')]===0x1f4){logger[_0x8d9c('0x15')](_0x8d9c('0x17'),_0xa2bf79,_0x5d31e7[_0x8d9c('0x15')][_0x8d9c('0x18')]);return _0x26b5b3(_0x5d31e7[_0x8d9c('0x15')]['message']);}logger[_0x8d9c('0x15')](_0x8d9c('0x17'),_0xa2bf79,_0x5d31e7[_0x8d9c('0x15')][_0x8d9c('0x18')]);return _0x52de51(_0x5d31e7[_0x8d9c('0x15')][_0x8d9c('0x18')]);}else{logger[_0x8d9c('0x11')](_0x8d9c('0x17'),_0xa2bf79,_0x8d9c('0x13'));_0x52de51(_0x5d31e7[_0x8d9c('0x19')]['message']);}})[_0x8d9c('0x1a')](function(_0x6671d7){logger['error'](_0x8d9c('0x17'),_0xa2bf79,_0x6671d7);_0x26b5b3(_0x6671d7);});});}exports[_0x8d9c('0x1b')]=function(_0x57a45b){var _0x3ba938=this;return new Promise(function(_0x2ba1c8,_0xa8391d){return db[_0x8d9c('0x1c')]['findAll']({'raw':_0x57a45b[_0x8d9c('0x1d')]?_0x57a45b[_0x8d9c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x57a45b['options']?_0x57a45b[_0x8d9c('0x1d')][_0x8d9c('0x1e')]||null:null,'attributes':_0x57a45b[_0x8d9c('0x1d')]?_0x57a45b[_0x8d9c('0x1d')][_0x8d9c('0x1f')]||null:null,'limit':_0x57a45b[_0x8d9c('0x1d')]?_0x57a45b[_0x8d9c('0x1d')]['limit']||null:null,'include':_0x57a45b[_0x8d9c('0x1d')]?_0x57a45b['options'][_0x8d9c('0x20')]?_[_0x8d9c('0x21')](_0x57a45b[_0x8d9c('0x1d')][_0x8d9c('0x20')],function(_0x171c96){return{'model':db[_0x171c96[_0x8d9c('0x22')]],'as':_0x171c96['as'],'attributes':_0x171c96[_0x8d9c('0x1f')],'include':_0x171c96['include']?_['map'](_0x171c96['include'],function(_0x527302){return{'model':db[_0x527302['model']],'as':_0x527302['as'],'attributes':_0x527302[_0x8d9c('0x1f')],'include':_0x527302[_0x8d9c('0x20')]?_[_0x8d9c('0x21')](_0x527302[_0x8d9c('0x20')],function(_0x5cb119){return{'model':db[_0x5cb119[_0x8d9c('0x22')]],'as':_0x5cb119['as'],'attributes':_0x5cb119[_0x8d9c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5548a7){logger[_0x8d9c('0x11')]('GetVoiceExtension',_0x57a45b);logger[_0x8d9c('0x12')](_0x8d9c('0x1b'),_0x57a45b,JSON[_0x8d9c('0x14')](_0x5548a7));_0x2ba1c8(_0x5548a7);})['catch'](function(_0x5eaa3e){logger[_0x8d9c('0x15')](_0x8d9c('0x1b'),_0x5eaa3e[_0x8d9c('0x18')],_0x57a45b);_0xa8391d(_0x3ba938[_0x8d9c('0x15')](0x1f4,_0x5eaa3e[_0x8d9c('0x18')]));});});}; \ No newline at end of file +var _0x979e=['localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceExtension','VoiceExtension','findAll','options','where','map','include','model','attributes','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x979e,0x195));var _0xe979=function(_0x25cf01,_0x49b221){_0x25cf01=_0x25cf01-0x0;var _0x3a31c3=_0x979e[_0x25cf01];return _0x3a31c3;};'use strict';var _=require(_0xe979('0x0'));var util=require(_0xe979('0x1'));var moment=require(_0xe979('0x2'));var BPromise=require(_0xe979('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe979('0x4'));var db=require(_0xe979('0x5'))['db'];var utils=require(_0xe979('0x6'));var logger=require(_0xe979('0x7'))(_0xe979('0x8'));var config=require('../../config/environment');var jayson=require(_0xe979('0x9'));var client=jayson['client'][_0xe979('0xa')]({'port':0x232a});config[_0xe979('0xb')]=_[_0xe979('0xc')](config[_0xe979('0xb')],{'host':_0xe979('0xd'),'port':0x18eb});var socket=require(_0xe979('0xe'))(new Redis(config[_0xe979('0xb')]));require(_0xe979('0xf'))[_0xe979('0x10')](socket);function respondWithRpcPromise(_0x22cb19,_0x3aeb90,_0x4eddb9){return new BPromise(function(_0x19fcc8,_0x1647d2){return client[_0xe979('0x11')](_0x22cb19,_0x4eddb9)['then'](function(_0x18fe2b){logger[_0xe979('0x12')](_0xe979('0x13'),_0x3aeb90,_0xe979('0x14'));logger[_0xe979('0x15')](_0xe979('0x16'),_0x3aeb90,_0xe979('0x14'),JSON[_0xe979('0x17')](_0x18fe2b));if(_0x18fe2b['error']){if(_0x18fe2b[_0xe979('0x18')][_0xe979('0x19')]===0x1f4){logger[_0xe979('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x3aeb90,_0x18fe2b['error'][_0xe979('0x1a')]);return _0x1647d2(_0x18fe2b[_0xe979('0x18')][_0xe979('0x1a')]);}logger[_0xe979('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x3aeb90,_0x18fe2b[_0xe979('0x18')][_0xe979('0x1a')]);return _0x19fcc8(_0x18fe2b[_0xe979('0x18')][_0xe979('0x1a')]);}else{logger[_0xe979('0x12')](_0xe979('0x13'),_0x3aeb90,_0xe979('0x14'));_0x19fcc8(_0x18fe2b['result'][_0xe979('0x1a')]);}})['catch'](function(_0x58f4a9){logger[_0xe979('0x18')](_0xe979('0x13'),_0x3aeb90,_0x58f4a9);_0x1647d2(_0x58f4a9);});});}exports[_0xe979('0x1b')]=function(_0x184373){var _0x5d3cbe=this;return new Promise(function(_0x466879,_0x480fbd){return db[_0xe979('0x1c')][_0xe979('0x1d')]({'raw':_0x184373[_0xe979('0x1e')]?_0x184373[_0xe979('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x184373[_0xe979('0x1e')]?_0x184373['options'][_0xe979('0x1f')]||null:null,'attributes':_0x184373[_0xe979('0x1e')]?_0x184373[_0xe979('0x1e')]['attributes']||null:null,'limit':_0x184373[_0xe979('0x1e')]?_0x184373['options']['limit']||null:null,'include':_0x184373[_0xe979('0x1e')]?_0x184373[_0xe979('0x1e')]['include']?_[_0xe979('0x20')](_0x184373['options'][_0xe979('0x21')],function(_0x4bfb4b){return{'model':db[_0x4bfb4b[_0xe979('0x22')]],'as':_0x4bfb4b['as'],'attributes':_0x4bfb4b[_0xe979('0x23')],'include':_0x4bfb4b[_0xe979('0x21')]?_[_0xe979('0x20')](_0x4bfb4b[_0xe979('0x21')],function(_0x4aa174){return{'model':db[_0x4aa174[_0xe979('0x22')]],'as':_0x4aa174['as'],'attributes':_0x4aa174[_0xe979('0x23')],'include':_0x4aa174[_0xe979('0x21')]?_[_0xe979('0x20')](_0x4aa174[_0xe979('0x21')],function(_0x53ada7){return{'model':db[_0x53ada7[_0xe979('0x22')]],'as':_0x53ada7['as'],'attributes':_0x53ada7[_0xe979('0x23')]};}):[]};}):[]};}):[]:[]})[_0xe979('0x24')](function(_0x2d7302){logger[_0xe979('0x12')]('GetVoiceExtension',_0x184373);logger[_0xe979('0x15')](_0xe979('0x1b'),_0x184373,JSON[_0xe979('0x17')](_0x2d7302));_0x466879(_0x2d7302);})[_0xe979('0x25')](function(_0xe6e59e){logger['error'](_0xe979('0x1b'),_0xe6e59e[_0xe979('0x1a')],_0x184373);_0x480fbd(_0x5d3cbe['error'](0x1f4,_0xe6e59e[_0xe979('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 5d621d9..4f893a5 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(_0xddd90,_0x42221d){var _0x8b386e=function(_0x19debd){while(--_0x19debd){_0xddd90['push'](_0xddd90['shift']());}};_0x8b386e(++_0x42221d);}(_0x326f,0xd1));var _0xf326=function(_0x20686a,_0x1d088a){_0x20686a=_0x20686a-0x0;var _0x4cc8a1=_0x326f[_0x20686a];return _0x4cc8a1;};'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 _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x3de9ad,_0x2a0d99){var _0x3b7676=function(_0x541c88){while(--_0x541c88){_0x3de9ad['push'](_0x3de9ad['shift']());}};_0x3b7676(++_0x2a0d99);}(_0xe14b,0x93));var _0xbe14=function(_0x4ebcee,_0x22671d){_0x4ebcee=_0x4ebcee-0x0;var _0x26e5bf=_0xe14b[_0x4ebcee];return _0x26e5bf;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 8895ccb..4cc2b74 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 _0x6a55=['isAuthenticated','index','/:id','show','getMessages','post','create','put','update','destroy','exports','multer','express','../../components/auth/service','../../config/environment','get'];(function(_0x193d09,_0x2d5922){var _0x1ec751=function(_0x23126f){while(--_0x23126f){_0x193d09['push'](_0x193d09['shift']());}};_0x1ec751(++_0x2d5922);}(_0x6a55,0xdb));var _0x56a5=function(_0x59522a,_0x14d1e5){_0x59522a=_0x59522a-0x0;var _0x30f09d=_0x6a55[_0x59522a];return _0x30f09d;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56a5('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x56a5('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x56a5('0x3'));var controller=require('./voiceMail.controller');router[_0x56a5('0x4')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x6')]);router[_0x56a5('0x4')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x8')]);router[_0x56a5('0x4')]('/:id/messages',auth[_0x56a5('0x5')](),controller[_0x56a5('0x9')]);router[_0x56a5('0xa')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0xb')]);router[_0x56a5('0xc')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xd')]);router['delete']('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0xe')]);module[_0x56a5('0xf')]=router; \ No newline at end of file +var _0x687b=['../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x20bf79,_0xbecfa4){var _0x1f9012=function(_0x18a569){while(--_0x18a569){_0x20bf79['push'](_0x20bf79['shift']());}};_0x1f9012(++_0xbecfa4);}(_0x687b,0x14a));var _0xb687=function(_0x35e0d4,_0x4cc3b2){_0x35e0d4=_0x35e0d4-0x0;var _0x481513=_0x687b[_0x35e0d4];return _0x481513;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb687('0x4'));var auth=require(_0xb687('0x5'));var interaction=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var controller=require(_0xb687('0x8'));router[_0xb687('0x9')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0x9')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0x9')]('/:id/messages',auth[_0xb687('0xa')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0x10')]);router[_0xb687('0x11')](_0xb687('0xc'),auth[_0xb687('0xa')](),controller[_0xb687('0x12')]);router['delete'](_0xb687('0xc'),auth[_0xb687('0xa')](),controller[_0xb687('0x13')]);module[_0xb687('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 61b40c2..336fffb 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 _0xbde0=['STRING','from-voicemail','contest_mailbox','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','sequelize','exports'];(function(_0x230cd9,_0x1b12b0){var _0x308b16=function(_0x7a9ee){while(--_0x7a9ee){_0x230cd9['push'](_0x230cd9['shift']());}};_0x308b16(++_0x1b12b0);}(_0xbde0,0x94));var _0x0bde=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xbde0[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x0bde('0x0'));module[_0x0bde('0x1')]={'customer_id':{'type':Sequelize[_0x0bde('0x2')]},'context':{'type':Sequelize[_0x0bde('0x2')],'defaultValue':_0x0bde('0x3'),'unique':_0x0bde('0x4')},'mailbox':{'type':Sequelize[_0x0bde('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x0bde('0x2')]},'fullname':{'type':Sequelize[_0x0bde('0x2')]},'email':{'type':Sequelize[_0x0bde('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3138b5){this['setDataValue']('email',typeof _0x3138b5===_0x0bde('0x5')&&_0x3138b5[_0x0bde('0x6')]()?_0x3138b5['trim']():null);}},'pager':{'type':Sequelize[_0x0bde('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x0bde('0x7')](_0x0bde('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x0bde('0x7')](_0x0bde('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x0bde('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x0bde('0x7')](_0x0bde('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0bde('0x7')](_0x0bde('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x0bde('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0bde('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0bde('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x0bde('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x0bde('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0bde('0x7')](_0x0bde('0x8'),'no'),'defaultValue':_0x0bde('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0bde('0x7')](_0x0bde('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0bde('0x7')](_0x0bde('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x0bde('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x0bde('0xa')},'emailsubject':{'type':Sequelize[_0x0bde('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x0bde('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0bde('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0bde('0xc')],'get':function(){return this[_0x0bde('0xd')]('fullname')+_0x0bde('0xe')+this[_0x0bde('0xd')]('mailbox');}}}; \ No newline at end of file +var _0x9040=['INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes'];(function(_0x14fd3e,_0x1949ae){var _0x3958d5=function(_0x280aaf){while(--_0x280aaf){_0x14fd3e['push'](_0x14fd3e['shift']());}};_0x3958d5(++_0x1949ae);}(_0x9040,0x1a4));var _0x0904=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x9040[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0x0904('0x0'));module[_0x0904('0x1')]={'customer_id':{'type':Sequelize[_0x0904('0x2')]},'context':{'type':Sequelize[_0x0904('0x2')],'defaultValue':_0x0904('0x3'),'unique':_0x0904('0x4')},'mailbox':{'type':Sequelize[_0x0904('0x2')],'defaultValue':'','allowNull':![],'unique':_0x0904('0x4')},'password':{'type':Sequelize[_0x0904('0x2')]},'fullname':{'type':Sequelize[_0x0904('0x2')]},'email':{'type':Sequelize[_0x0904('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1d5edf){this[_0x0904('0x5')](_0x0904('0x6'),typeof _0x1d5edf===_0x0904('0x7')&&_0x1d5edf[_0x0904('0x8')]()?_0x1d5edf[_0x0904('0x8')]():null);}},'pager':{'type':Sequelize[_0x0904('0x2')]},'tz':{'type':Sequelize[_0x0904('0x2')],'defaultValue':_0x0904('0x9')},'attach':{'type':Sequelize[_0x0904('0xa')](_0x0904('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x0904('0xa')](_0x0904('0xb'),'no'),'defaultValue':_0x0904('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0x0904('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x0904('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0904('0xa')](_0x0904('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0904('0xa')](_0x0904('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0904('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0904('0xa')](_0x0904('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0904('0xa')]('yes','no'),'defaultValue':_0x0904('0xb'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0904('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0904('0xa')](_0x0904('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0904('0xa')](_0x0904('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x0904('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0904('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0904('0xd')],'get':function(){return this[_0x0904('0xe')](_0x0904('0xf'))+_0x0904('0x10')+this[_0x0904('0xe')](_0x0904('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index db2a2f1..95d6b0b 100644 --- a/server/api/voiceMail/voiceMail.controller.js +++ b/server/api/voiceMail/voiceMail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbee3=['map','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceMail','includeAll','include','findAll','rows','catch','rawAttributes','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','nolimit','order','mailbox','findAndCountAll','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index'];(function(_0x3d27e4,_0x2e43f4){var _0x230938=function(_0x4ab38c){while(--_0x4ab38c){_0x3d27e4['push'](_0x3d27e4['shift']());}};_0x230938(++_0x2e43f4);}(_0xbee3,0xd5));var _0x3bee=function(_0x3d1238,_0x2c4032){_0x3d1238=_0x3d1238-0x0;var _0x203c9c=_0xbee3[_0x3d1238];return _0x203c9c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3bee('0x1'));var moment=require(_0x3bee('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3bee('0x3'));var util=require(_0x3bee('0x4'));var path=require(_0x3bee('0x5'));var sox=require('sox');var csv=require(_0x3bee('0x6'));var ejs=require(_0x3bee('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bee('0x8'));var squel=require(_0x3bee('0x9'));var crypto=require(_0x3bee('0xa'));var jsforce=require(_0x3bee('0xb'));var deskjs=require(_0x3bee('0xc'));var toCsv=require(_0x3bee('0x6'));var querystring=require(_0x3bee('0xd'));var Papa=require('papaparse');var Redis=require(_0x3bee('0xe'));var authService=require(_0x3bee('0xf'));var qs=require(_0x3bee('0x10'));var as=require(_0x3bee('0x11'));var hardwareService=require(_0x3bee('0x12'));var logger=require(_0x3bee('0x13'))('api');var utils=require(_0x3bee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3bee('0x15'));var db=require(_0x3bee('0x16'))['db'];function respondWithStatusCode(_0x407526,_0x6950d0){_0x6950d0=_0x6950d0||0xcc;return function(_0x410124){if(_0x410124){return _0x407526[_0x3bee('0x17')](_0x6950d0);}return _0x407526[_0x3bee('0x18')](_0x6950d0)['end']();};}function respondWithResult(_0xad01f9,_0x33504d){_0x33504d=_0x33504d||0xc8;return function(_0x31ac52){if(_0x31ac52){return _0xad01f9[_0x3bee('0x18')](_0x33504d)[_0x3bee('0x19')](_0x31ac52);}};}function respondWithFilteredResult(_0x5b9473,_0x558436){return function(_0x346767){if(_0x346767){var _0x515397=typeof _0x558436[_0x3bee('0x1a')]===_0x3bee('0x1b')&&typeof _0x558436['limit']==='undefined';var _0x1582a4=_0x346767[_0x3bee('0x1c')];var _0xfdba3b=_0x515397?0x0:_0x558436[_0x3bee('0x1a')];var _0x49095a=_0x515397?_0x346767[_0x3bee('0x1c')]:_0x558436[_0x3bee('0x1a')]+_0x558436[_0x3bee('0x1d')];var _0x49b32d;if(_0x49095a>=_0x1582a4){_0x49095a=_0x1582a4;_0x49b32d=0xc8;}else{_0x49b32d=0xce;}_0x5b9473[_0x3bee('0x18')](_0x49b32d);return _0x5b9473[_0x3bee('0x1e')](_0x3bee('0x1f'),_0xfdba3b+'-'+_0x49095a+'/'+_0x1582a4)['json'](_0x346767);}return null;};}function patchUpdates(_0x4f36af){return function(_0x1afd0f){try{jsonpatch[_0x3bee('0x20')](_0x1afd0f,_0x4f36af,!![]);}catch(_0x57aba4){return BPromise[_0x3bee('0x21')](_0x57aba4);}return _0x1afd0f[_0x3bee('0x22')]();};}function saveUpdates(_0x2eea75,_0x179e62){return function(_0x28c248){if(_0x28c248){return _0x28c248[_0x3bee('0x23')](_0x2eea75)[_0x3bee('0x24')](function(_0x582fa9){return _0x582fa9;});}return null;};}function removeEntity(_0x8ae4ca,_0x1ed0c1){return function(_0x1fed5a){if(_0x1fed5a){return _0x1fed5a[_0x3bee('0x25')]()['then'](function(){var _0x45249c=_0x1fed5a[_0x3bee('0x26')]({'plain':!![]});var _0x1e0111='Voicemails';return db['UserProfileResource'][_0x3bee('0x25')]({'where':{'type':_0x1e0111,'resourceId':_0x45249c['id']}})[_0x3bee('0x24')](function(){return _0x1fed5a;});})['then'](function(){_0x8ae4ca[_0x3bee('0x18')](0xcc)[_0x3bee('0x27')]();});}};}function handleEntityNotFound(_0x2e666a,_0x5b1eec){return function(_0x1984c4){if(!_0x1984c4){_0x2e666a[_0x3bee('0x17')](0x194);}return _0x1984c4;};}function handleError(_0x150766,_0x4f2066){_0x4f2066=_0x4f2066||0x1f4;return function(_0x239fa4){logger[_0x3bee('0x28')](_0x239fa4[_0x3bee('0x29')]);if(_0x239fa4['name']){delete _0x239fa4[_0x3bee('0x2a')];}_0x150766[_0x3bee('0x18')](_0x4f2066)[_0x3bee('0x2b')](_0x239fa4);};}exports[_0x3bee('0x2c')]=function(_0x3433aa,_0x559c2b){var _0x564e45={},_0x3fbc8c={},_0x1e1529={'count':0x0,'rows':[]};var _0x10bae0=_[_0x3bee('0x2d')](db['VoiceMail']['rawAttributes'],function(_0x38f93c){return{'name':_0x38f93c[_0x3bee('0x2e')],'type':_0x38f93c['type']['key']};});_0x3fbc8c[_0x3bee('0x2f')]=_[_0x3bee('0x2d')](_0x10bae0,_0x3bee('0x2a'));_0x3fbc8c[_0x3bee('0x30')]=_[_0x3bee('0x31')](_0x3433aa[_0x3bee('0x30')]);_0x3fbc8c[_0x3bee('0x32')]=_[_0x3bee('0x33')](_0x3fbc8c[_0x3bee('0x2f')],_0x3fbc8c[_0x3bee('0x30')]);_0x564e45['attributes']=_['intersection'](_0x3fbc8c[_0x3bee('0x2f')],qs['fields'](_0x3433aa['query'][_0x3bee('0x34')]));_0x564e45[_0x3bee('0x35')]=_0x564e45[_0x3bee('0x35')][_0x3bee('0x36')]?_0x564e45[_0x3bee('0x35')]:_0x3fbc8c[_0x3bee('0x2f')];if(!_0x3433aa[_0x3bee('0x30')][_0x3bee('0x37')]('nolimit')){_0x564e45[_0x3bee('0x1d')]=qs[_0x3bee('0x1d')](_0x3433aa['query'][_0x3bee('0x1d')]);_0x564e45[_0x3bee('0x1a')]=qs[_0x3bee('0x1a')](_0x3433aa[_0x3bee('0x30')][_0x3bee('0x1a')]);}_0x564e45['order']=qs['sort'](_0x3433aa[_0x3bee('0x30')][_0x3bee('0x38')]);_0x564e45[_0x3bee('0x39')]=qs[_0x3bee('0x32')](_[_0x3bee('0x3a')](_0x3433aa[_0x3bee('0x30')],_0x3fbc8c[_0x3bee('0x32')]),_0x10bae0);if(_0x3433aa[_0x3bee('0x30')][_0x3bee('0x3b')]){_0x564e45[_0x3bee('0x39')]=_[_0x3bee('0x3c')](_0x564e45[_0x3bee('0x39')],{'$or':_['map'](_0x10bae0,function(_0xaceed4){if(_0xaceed4[_0x3bee('0x3d')]!==_0x3bee('0x3e')){var _0x45cf81={};_0x45cf81[_0xaceed4[_0x3bee('0x2a')]]={'$like':'%'+_0x3433aa[_0x3bee('0x30')][_0x3bee('0x3b')]+'%'};return _0x45cf81;}})});}_0x564e45=_[_0x3bee('0x3c')]({},_0x564e45,_0x3433aa[_0x3bee('0x3f')]);var _0x12ba6f={'where':_0x564e45[_0x3bee('0x39')]};return db[_0x3bee('0x40')][_0x3bee('0x1c')](_0x12ba6f)['then'](function(_0x2b773d){_0x1e1529[_0x3bee('0x1c')]=_0x2b773d;if(_0x3433aa[_0x3bee('0x30')][_0x3bee('0x41')]){_0x564e45[_0x3bee('0x42')]=[{'all':!![]}];}return db[_0x3bee('0x40')][_0x3bee('0x43')](_0x564e45);})[_0x3bee('0x24')](function(_0x5d9e1b){_0x1e1529[_0x3bee('0x44')]=_0x5d9e1b;return _0x1e1529;})[_0x3bee('0x24')](respondWithFilteredResult(_0x559c2b,_0x564e45))[_0x3bee('0x45')](handleError(_0x559c2b,null));};exports['show']=function(_0x4567f2,_0x57113b){var _0x2b1677={'raw':!![],'where':{'id':_0x4567f2['params']['id']}},_0x48325e={};_0x48325e[_0x3bee('0x2f')]=_[_0x3bee('0x31')](db[_0x3bee('0x40')][_0x3bee('0x46')]);_0x48325e[_0x3bee('0x30')]=_['keys'](_0x4567f2['query']);_0x48325e[_0x3bee('0x32')]=_['intersection'](_0x48325e[_0x3bee('0x2f')],_0x48325e['query']);_0x2b1677[_0x3bee('0x35')]=_['intersection'](_0x48325e[_0x3bee('0x2f')],qs[_0x3bee('0x34')](_0x4567f2[_0x3bee('0x30')][_0x3bee('0x34')]));_0x2b1677['attributes']=_0x2b1677['attributes'][_0x3bee('0x36')]?_0x2b1677['attributes']:_0x48325e['model'];if(_0x4567f2['query'][_0x3bee('0x41')]){_0x2b1677['include']=[{'all':!![]}];}_0x2b1677=_[_0x3bee('0x3c')]({},_0x2b1677,_0x4567f2[_0x3bee('0x3f')]);return db[_0x3bee('0x40')]['find'](_0x2b1677)[_0x3bee('0x24')](handleEntityNotFound(_0x57113b,null))['then'](respondWithResult(_0x57113b,null))[_0x3bee('0x45')](handleError(_0x57113b,null));};exports['create']=function(_0x26ccd7,_0x16b096){return db[_0x3bee('0x40')]['create'](_0x26ccd7[_0x3bee('0x47')],{})[_0x3bee('0x24')](function(_0x477de2){var _0x504382=_0x26ccd7['user'][_0x3bee('0x26')]({'plain':!![]});if(!_0x504382)throw new Error(_0x3bee('0x48'));if(_0x504382[_0x3bee('0x49')]===_0x3bee('0x4a')){var _0x3b5d7a=_0x477de2[_0x3bee('0x26')]({'plain':!![]});var _0x4005a3='Voicemails';return db[_0x3bee('0x4b')][_0x3bee('0x4c')]({'where':{'name':_0x4005a3,'userProfileId':_0x504382['userProfileId']},'raw':!![]})['then'](function(_0x3730c5){if(_0x3730c5&&_0x3730c5['autoAssociation']===0x0){return db[_0x3bee('0x4d')][_0x3bee('0x4e')]({'name':_0x3b5d7a[_0x3bee('0x2a')],'resourceId':_0x3b5d7a['id'],'type':_0x3730c5['name'],'sectionId':_0x3730c5['id']},{})[_0x3bee('0x24')](function(){return _0x477de2;});}else{return _0x477de2;}})[_0x3bee('0x45')](function(_0x127cb8){logger['error'](_0x3bee('0x4f'),_0x127cb8);throw _0x127cb8;});}return _0x477de2;})[_0x3bee('0x24')](respondWithResult(_0x16b096,0xc9))['catch'](handleError(_0x16b096,null));};exports[_0x3bee('0x23')]=function(_0x14940e,_0x53c881){if(_0x14940e[_0x3bee('0x47')]['id']){delete _0x14940e[_0x3bee('0x47')]['id'];}return db[_0x3bee('0x40')][_0x3bee('0x4c')]({'where':{'id':_0x14940e[_0x3bee('0x50')]['id']}})[_0x3bee('0x24')](handleEntityNotFound(_0x53c881,null))[_0x3bee('0x24')](saveUpdates(_0x14940e[_0x3bee('0x47')],null))['then'](respondWithResult(_0x53c881,null))['catch'](handleError(_0x53c881,null));};exports[_0x3bee('0x25')]=function(_0x5e13e8,_0x38b82a){return db[_0x3bee('0x40')][_0x3bee('0x4c')]({'where':{'id':_0x5e13e8['params']['id']}})[_0x3bee('0x24')](handleEntityNotFound(_0x38b82a,null))[_0x3bee('0x24')](removeEntity(_0x38b82a,null))[_0x3bee('0x45')](handleError(_0x38b82a,null));};exports['getMessages']=function(_0x19cbb8,_0x52a327,_0x3cb900){return db[_0x3bee('0x40')][_0x3bee('0x51')]({'where':{'id':_0x19cbb8['params']['id']}})[_0x3bee('0x24')](handleEntityNotFound(_0x52a327,null))[_0x3bee('0x24')](function(_0x282300){var _0x526551;var _0x5d95a7={},_0xb9f53e={};_0xb9f53e[_0x3bee('0x2f')]=_[_0x3bee('0x31')](db['VoiceMailMessage']['rawAttributes']);_0xb9f53e[_0x3bee('0x30')]=_['keys'](_0x19cbb8['query']);_0xb9f53e[_0x3bee('0x32')]=_[_0x3bee('0x33')](_0xb9f53e[_0x3bee('0x2f')],_0xb9f53e['query']);_0x5d95a7['attributes']=_[_0x3bee('0x33')](_0xb9f53e[_0x3bee('0x2f')],qs['fields'](_0x19cbb8[_0x3bee('0x30')]['fields']));_0x5d95a7[_0x3bee('0x35')]=_0x5d95a7[_0x3bee('0x35')][_0x3bee('0x36')]?_0x5d95a7[_0x3bee('0x35')]:_0xb9f53e[_0x3bee('0x2f')];if(!_0x19cbb8[_0x3bee('0x30')][_0x3bee('0x37')](_0x3bee('0x52'))){_0x5d95a7[_0x3bee('0x1d')]=qs[_0x3bee('0x1d')](_0x19cbb8[_0x3bee('0x30')]['limit']);_0x5d95a7['offset']=qs['offset'](_0x19cbb8[_0x3bee('0x30')][_0x3bee('0x1a')]);}_0x5d95a7[_0x3bee('0x53')]=qs[_0x3bee('0x38')](_0x19cbb8['query'][_0x3bee('0x38')]);_0x5d95a7[_0x3bee('0x39')]=qs['filters'](_['pick'](_0x19cbb8[_0x3bee('0x30')],_0xb9f53e[_0x3bee('0x32')]));if(_0x19cbb8[_0x3bee('0x30')]['filter']){_0x5d95a7[_0x3bee('0x39')]=_[_0x3bee('0x3c')](_0x5d95a7[_0x3bee('0x39')],{'$or':_['map'](_0x5d95a7[_0x3bee('0x35')],function(_0x412e0d){var _0x1bfb3a={};_0x1bfb3a[_0x412e0d]={'$like':'%'+_0x19cbb8[_0x3bee('0x30')]['filter']+'%'};return _0x1bfb3a;})});}_0x5d95a7['where']=_[_0x3bee('0x3c')](_0x5d95a7[_0x3bee('0x39')],{'mailboxuser':_0x282300[_0x3bee('0x54')]});_0x5d95a7=_[_0x3bee('0x3c')]({},_0x5d95a7,_0x19cbb8[_0x3bee('0x3f')]);return db['VoiceMailMessage'][_0x3bee('0x55')](_0x5d95a7)['then'](respondWithFilteredResult(_0x52a327,_0x5d95a7));})[_0x3bee('0x45')](handleError(_0x52a327,null));}; \ No newline at end of file +var _0x3f8c=['create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','Voicemails','UserProfileResource','destroy','error','stack','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch'];(function(_0x55c876,_0x3184b2){var _0x50c931=function(_0x1b62a5){while(--_0x1b62a5){_0x55c876['push'](_0x55c876['shift']());}};_0x50c931(++_0x3184b2);}(_0x3f8c,0x104));var _0xc3f8=function(_0x322391,_0x4143d9){_0x322391=_0x322391-0x0;var _0x19cb8b=_0x3f8c[_0x322391];return _0x19cb8b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f8('0x0'));var jsonpatch=require(_0xc3f8('0x1'));var rp=require(_0xc3f8('0x2'));var moment=require(_0xc3f8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc3f8('0x4'));var ejs=require(_0xc3f8('0x5'));var fs=require('fs');var fs_extra=require(_0xc3f8('0x6'));var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x4'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f8('0x10'));var logger=require(_0xc3f8('0x11'))(_0xc3f8('0x12'));var utils=require(_0xc3f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3f8('0x14'));var db=require(_0xc3f8('0x15'))['db'];function respondWithStatusCode(_0x256e3d,_0x155c80){_0x155c80=_0x155c80||0xcc;return function(_0x511763){if(_0x511763){return _0x256e3d[_0xc3f8('0x16')](_0x155c80);}return _0x256e3d[_0xc3f8('0x17')](_0x155c80)[_0xc3f8('0x18')]();};}function respondWithResult(_0x44632a,_0x6155e9){_0x6155e9=_0x6155e9||0xc8;return function(_0x47754c){if(_0x47754c){return _0x44632a[_0xc3f8('0x17')](_0x6155e9)[_0xc3f8('0x19')](_0x47754c);}};}function respondWithFilteredResult(_0x12b141,_0x2fd8e8){return function(_0x3cb28a){if(_0x3cb28a){var _0x2a9f64=typeof _0x2fd8e8[_0xc3f8('0x1a')]==='undefined'&&typeof _0x2fd8e8[_0xc3f8('0x1b')]==='undefined';var _0x51807b=_0x3cb28a[_0xc3f8('0x1c')];var _0x2e7c0f=_0x2a9f64?0x0:_0x2fd8e8[_0xc3f8('0x1a')];var _0xb4ab67=_0x2a9f64?_0x3cb28a['count']:_0x2fd8e8[_0xc3f8('0x1a')]+_0x2fd8e8[_0xc3f8('0x1b')];var _0x5df6f9;if(_0xb4ab67>=_0x51807b){_0xb4ab67=_0x51807b;_0x5df6f9=0xc8;}else{_0x5df6f9=0xce;}_0x12b141[_0xc3f8('0x17')](_0x5df6f9);return _0x12b141['set'](_0xc3f8('0x1d'),_0x2e7c0f+'-'+_0xb4ab67+'/'+_0x51807b)[_0xc3f8('0x19')](_0x3cb28a);}return null;};}function patchUpdates(_0x3b2e98){return function(_0x53ada5){try{jsonpatch['apply'](_0x53ada5,_0x3b2e98,!![]);}catch(_0x113cd2){return BPromise[_0xc3f8('0x1e')](_0x113cd2);}return _0x53ada5[_0xc3f8('0x1f')]();};}function saveUpdates(_0x25a4c7,_0x6522e9){return function(_0x251bf7){if(_0x251bf7){return _0x251bf7[_0xc3f8('0x20')](_0x25a4c7)[_0xc3f8('0x21')](function(_0x49aeea){return _0x49aeea;});}return null;};}function removeEntity(_0x571f92,_0x4b83f0){return function(_0x2559a4){if(_0x2559a4){return _0x2559a4['destroy']()[_0xc3f8('0x21')](function(){var _0x3f196d=_0x2559a4['get']({'plain':!![]});var _0x4569c2=_0xc3f8('0x22');return db[_0xc3f8('0x23')][_0xc3f8('0x24')]({'where':{'type':_0x4569c2,'resourceId':_0x3f196d['id']}})[_0xc3f8('0x21')](function(){return _0x2559a4;});})[_0xc3f8('0x21')](function(){_0x571f92[_0xc3f8('0x17')](0xcc)[_0xc3f8('0x18')]();});}};}function handleEntityNotFound(_0x21b002,_0xbea3b8){return function(_0x22c8e6){if(!_0x22c8e6){_0x21b002[_0xc3f8('0x16')](0x194);}return _0x22c8e6;};}function handleError(_0x238ff5,_0x429fd8){_0x429fd8=_0x429fd8||0x1f4;return function(_0x59e4dd){logger[_0xc3f8('0x25')](_0x59e4dd[_0xc3f8('0x26')]);if(_0x59e4dd[_0xc3f8('0x27')]){delete _0x59e4dd['name'];}_0x238ff5[_0xc3f8('0x17')](_0x429fd8)['send'](_0x59e4dd);};}exports[_0xc3f8('0x28')]=function(_0x32343e,_0x47ab53){var _0x48b32e={},_0x21a225={},_0x25df65={'count':0x0,'rows':[]};var _0xd32b09=_[_0xc3f8('0x29')](db[_0xc3f8('0x2a')][_0xc3f8('0x2b')],function(_0x680047){return{'name':_0x680047[_0xc3f8('0x2c')],'type':_0x680047[_0xc3f8('0x2d')][_0xc3f8('0x2e')]};});_0x21a225['model']=_[_0xc3f8('0x29')](_0xd32b09,_0xc3f8('0x27'));_0x21a225[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x32343e[_0xc3f8('0x2f')]);_0x21a225['filters']=_['intersection'](_0x21a225[_0xc3f8('0x31')],_0x21a225[_0xc3f8('0x2f')]);_0x48b32e[_0xc3f8('0x32')]=_[_0xc3f8('0x33')](_0x21a225[_0xc3f8('0x31')],qs['fields'](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x48b32e[_0xc3f8('0x32')]=_0x48b32e['attributes'][_0xc3f8('0x35')]?_0x48b32e[_0xc3f8('0x32')]:_0x21a225[_0xc3f8('0x31')];if(!_0x32343e['query'][_0xc3f8('0x36')](_0xc3f8('0x37'))){_0x48b32e['limit']=qs[_0xc3f8('0x1b')](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0x48b32e[_0xc3f8('0x1a')]=qs[_0xc3f8('0x1a')](_0x32343e[_0xc3f8('0x2f')]['offset']);}_0x48b32e[_0xc3f8('0x38')]=qs[_0xc3f8('0x39')](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x39')]);_0x48b32e[_0xc3f8('0x3a')]=qs['filters'](_[_0xc3f8('0x3b')](_0x32343e[_0xc3f8('0x2f')],_0x21a225[_0xc3f8('0x3c')]),_0xd32b09);if(_0x32343e['query'][_0xc3f8('0x3d')]){_0x48b32e[_0xc3f8('0x3a')]=_[_0xc3f8('0x3e')](_0x48b32e[_0xc3f8('0x3a')],{'$or':_['map'](_0xd32b09,function(_0x306182){if(_0x306182[_0xc3f8('0x2d')]!==_0xc3f8('0x3f')){var _0x37b104={};_0x37b104[_0x306182['name']]={'$like':'%'+_0x32343e[_0xc3f8('0x2f')]['filter']+'%'};return _0x37b104;}})});}_0x48b32e=_['merge']({},_0x48b32e,_0x32343e[_0xc3f8('0x40')]);var _0x1f3aef={'where':_0x48b32e[_0xc3f8('0x3a')]};return db[_0xc3f8('0x2a')]['count'](_0x1f3aef)['then'](function(_0x361a85){_0x25df65[_0xc3f8('0x1c')]=_0x361a85;if(_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x41')]){_0x48b32e[_0xc3f8('0x42')]=[{'all':!![]}];}return db[_0xc3f8('0x2a')][_0xc3f8('0x43')](_0x48b32e);})[_0xc3f8('0x21')](function(_0x13d8dc){_0x25df65[_0xc3f8('0x44')]=_0x13d8dc;return _0x25df65;})[_0xc3f8('0x21')](respondWithFilteredResult(_0x47ab53,_0x48b32e))['catch'](handleError(_0x47ab53,null));};exports[_0xc3f8('0x45')]=function(_0x22e9b3,_0x4b327f){var _0x1aff20={'raw':!![],'where':{'id':_0x22e9b3['params']['id']}},_0x172f1a={};_0x172f1a[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](db[_0xc3f8('0x2a')][_0xc3f8('0x2b')]);_0x172f1a[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x22e9b3[_0xc3f8('0x2f')]);_0x172f1a[_0xc3f8('0x3c')]=_[_0xc3f8('0x33')](_0x172f1a[_0xc3f8('0x31')],_0x172f1a[_0xc3f8('0x2f')]);_0x1aff20['attributes']=_[_0xc3f8('0x33')](_0x172f1a[_0xc3f8('0x31')],qs['fields'](_0x22e9b3[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x1aff20[_0xc3f8('0x32')]=_0x1aff20[_0xc3f8('0x32')]['length']?_0x1aff20['attributes']:_0x172f1a[_0xc3f8('0x31')];if(_0x22e9b3[_0xc3f8('0x2f')][_0xc3f8('0x41')]){_0x1aff20['include']=[{'all':!![]}];}_0x1aff20=_[_0xc3f8('0x3e')]({},_0x1aff20,_0x22e9b3[_0xc3f8('0x40')]);return db[_0xc3f8('0x2a')][_0xc3f8('0x46')](_0x1aff20)[_0xc3f8('0x21')](handleEntityNotFound(_0x4b327f,null))['then'](respondWithResult(_0x4b327f,null))[_0xc3f8('0x47')](handleError(_0x4b327f,null));};exports[_0xc3f8('0x48')]=function(_0x5961ab,_0x1becae){return db[_0xc3f8('0x2a')][_0xc3f8('0x48')](_0x5961ab[_0xc3f8('0x49')],{})[_0xc3f8('0x21')](function(_0x3045bc){var _0x1ca7c9=_0x5961ab['user'][_0xc3f8('0x4a')]({'plain':!![]});if(!_0x1ca7c9)throw new Error(_0xc3f8('0x4b'));if(_0x1ca7c9['role']===_0xc3f8('0x4c')){var _0x2e9f93=_0x3045bc[_0xc3f8('0x4a')]({'plain':!![]});var _0x33e5c5=_0xc3f8('0x22');return db[_0xc3f8('0x4d')][_0xc3f8('0x46')]({'where':{'name':_0x33e5c5,'userProfileId':_0x1ca7c9['userProfileId']},'raw':!![]})[_0xc3f8('0x21')](function(_0x2c6999){if(_0x2c6999&&_0x2c6999[_0xc3f8('0x4e')]===0x0){return db[_0xc3f8('0x23')][_0xc3f8('0x48')]({'name':_0x2e9f93[_0xc3f8('0x27')],'resourceId':_0x2e9f93['id'],'type':_0x2c6999[_0xc3f8('0x27')],'sectionId':_0x2c6999['id']},{})[_0xc3f8('0x21')](function(){return _0x3045bc;});}else{return _0x3045bc;}})['catch'](function(_0x51249a){logger[_0xc3f8('0x25')](_0xc3f8('0x4f'),_0x51249a);throw _0x51249a;});}return _0x3045bc;})['then'](respondWithResult(_0x1becae,0xc9))['catch'](handleError(_0x1becae,null));};exports[_0xc3f8('0x20')]=function(_0x4b4adb,_0x1b1e13){if(_0x4b4adb[_0xc3f8('0x49')]['id']){delete _0x4b4adb[_0xc3f8('0x49')]['id'];}return db['VoiceMail'][_0xc3f8('0x46')]({'where':{'id':_0x4b4adb['params']['id']}})['then'](handleEntityNotFound(_0x1b1e13,null))[_0xc3f8('0x21')](saveUpdates(_0x4b4adb['body'],null))[_0xc3f8('0x21')](respondWithResult(_0x1b1e13,null))[_0xc3f8('0x47')](handleError(_0x1b1e13,null));};exports[_0xc3f8('0x24')]=function(_0x490f37,_0xcb45c1){return db[_0xc3f8('0x2a')][_0xc3f8('0x46')]({'where':{'id':_0x490f37[_0xc3f8('0x50')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0xcb45c1,null))['then'](removeEntity(_0xcb45c1,null))['catch'](handleError(_0xcb45c1,null));};exports[_0xc3f8('0x51')]=function(_0x326dcc,_0x2f1b68,_0x3a268d){return db[_0xc3f8('0x2a')]['findOne']({'where':{'id':_0x326dcc[_0xc3f8('0x50')]['id']}})['then'](handleEntityNotFound(_0x2f1b68,null))[_0xc3f8('0x21')](function(_0x337029){var _0x163264;var _0xd5d6a7={},_0x5c6f6e={};_0x5c6f6e[_0xc3f8('0x31')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x5c6f6e['query']=_[_0xc3f8('0x30')](_0x326dcc[_0xc3f8('0x2f')]);_0x5c6f6e[_0xc3f8('0x3c')]=_[_0xc3f8('0x33')](_0x5c6f6e[_0xc3f8('0x31')],_0x5c6f6e[_0xc3f8('0x2f')]);_0xd5d6a7[_0xc3f8('0x32')]=_[_0xc3f8('0x33')](_0x5c6f6e['model'],qs[_0xc3f8('0x34')](_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0xd5d6a7[_0xc3f8('0x32')]=_0xd5d6a7[_0xc3f8('0x32')]['length']?_0xd5d6a7[_0xc3f8('0x32')]:_0x5c6f6e[_0xc3f8('0x31')];if(!_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x36')](_0xc3f8('0x37'))){_0xd5d6a7['limit']=qs[_0xc3f8('0x1b')](_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0xd5d6a7[_0xc3f8('0x1a')]=qs[_0xc3f8('0x1a')](_0x326dcc[_0xc3f8('0x2f')]['offset']);}_0xd5d6a7[_0xc3f8('0x38')]=qs[_0xc3f8('0x39')](_0x326dcc[_0xc3f8('0x2f')]['sort']);_0xd5d6a7[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3c')](_['pick'](_0x326dcc['query'],_0x5c6f6e[_0xc3f8('0x3c')]));if(_0x326dcc[_0xc3f8('0x2f')]['filter']){_0xd5d6a7[_0xc3f8('0x3a')]=_[_0xc3f8('0x3e')](_0xd5d6a7[_0xc3f8('0x3a')],{'$or':_[_0xc3f8('0x29')](_0xd5d6a7[_0xc3f8('0x32')],function(_0x30a23a){var _0x1e62ec={};_0x1e62ec[_0x30a23a]={'$like':'%'+_0x326dcc[_0xc3f8('0x2f')]['filter']+'%'};return _0x1e62ec;})});}_0xd5d6a7['where']=_[_0xc3f8('0x3e')](_0xd5d6a7['where'],{'mailboxuser':_0x337029['mailbox']});_0xd5d6a7=_['merge']({},_0xd5d6a7,_0x326dcc['options']);return db['VoiceMailMessage'][_0xc3f8('0x52')](_0xd5d6a7)[_0xc3f8('0x21')](respondWithFilteredResult(_0x2f1b68,_0xd5d6a7));})[_0xc3f8('0x47')](handleError(_0x2f1b68,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index ab8a39c..b25b3d8 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 _0x2453=['request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','lodash','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2453,0xac));var _0x3245=function(_0x13cdc7,_0x21094a){_0x13cdc7=_0x13cdc7-0x0;var _0x45dae5=_0x2453[_0x13cdc7];return _0x45dae5;};'use strict';var _=require(_0x3245('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3245('0x1'));var moment=require(_0x3245('0x2'));var BPromise=require(_0x3245('0x3'));var rp=require(_0x3245('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3245('0x5'));var config=require(_0x3245('0x6'));var attributes=require(_0x3245('0x7'));module[_0x3245('0x8')]=function(_0x129c49,_0x4a7e40){return _0x129c49[_0x3245('0x9')](_0x3245('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x13cc=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox','context'];(function(_0xeb2609,_0x3dd738){var _0x49b540=function(_0x454a3e){while(--_0x454a3e){_0xeb2609['push'](_0xeb2609['shift']());}};_0x49b540(++_0x3dd738);}(_0x13cc,0x177));var _0xc13c=function(_0x321d43,_0x2a116a){_0x321d43=_0x321d43-0x0;var _0x2640e1=_0x13cc[_0x321d43];return _0x2640e1;};'use strict';var _=require(_0xc13c('0x0'));var util=require('util');var logger=require(_0xc13c('0x1'))(_0xc13c('0x2'));var moment=require(_0xc13c('0x3'));var BPromise=require(_0xc13c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc13c('0x5'));var rimraf=require(_0xc13c('0x6'));var config=require(_0xc13c('0x7'));var attributes=require(_0xc13c('0x8'));module[_0xc13c('0x9')]=function(_0x2fd8bc,_0x5abc54){return _0x2fd8bc[_0xc13c('0xa')](_0xc13c('0xb'),attributes,{'tableName':_0xc13c('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xc13c('0xd'),_0xc13c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index ae83cb0..9391dc5 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 _0x97ac=['../../config/environment','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x42fd67,_0x5dbdfd){var _0x3293f5=function(_0xeadbef){while(--_0xeadbef){_0x42fd67['push'](_0x42fd67['shift']());}};_0x3293f5(++_0x5dbdfd);}(_0x97ac,0xa8));var _0xc97a=function(_0x46e677,_0x6bbe3b){_0x46e677=_0x46e677-0x0;var _0x20e5f3=_0x97ac[_0x46e677];return _0x20e5f3;};'use strict';var _=require(_0xc97a('0x0'));var util=require(_0xc97a('0x1'));var moment=require(_0xc97a('0x2'));var BPromise=require(_0xc97a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc97a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc97a('0x5'));var logger=require(_0xc97a('0x6'))(_0xc97a('0x7'));var config=require(_0xc97a('0x8'));var jayson=require(_0xc97a('0x9'));var client=jayson[_0xc97a('0xa')][_0xc97a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c87d5,_0x5cbe8a,_0x40994a){return new BPromise(function(_0x253fc7,_0x7f837a){return client[_0xc97a('0xc')](_0x1c87d5,_0x40994a)['then'](function(_0x194de3){logger[_0xc97a('0xd')](_0xc97a('0xe'),_0x5cbe8a,_0xc97a('0xf'));logger[_0xc97a('0x10')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x5cbe8a,'request\x20sent',JSON['stringify'](_0x194de3));if(_0x194de3['error']){if(_0x194de3[_0xc97a('0x11')][_0xc97a('0x12')]===0x1f4){logger['error'](_0xc97a('0xe'),_0x5cbe8a,_0x194de3[_0xc97a('0x11')]['message']);return _0x7f837a(_0x194de3[_0xc97a('0x11')][_0xc97a('0x13')]);}logger['error'](_0xc97a('0xe'),_0x5cbe8a,_0x194de3[_0xc97a('0x11')][_0xc97a('0x13')]);return _0x253fc7(_0x194de3[_0xc97a('0x11')][_0xc97a('0x13')]);}else{logger[_0xc97a('0xd')]('VoiceMail,\x20%s,\x20%s',_0x5cbe8a,_0xc97a('0xf'));_0x253fc7(_0x194de3[_0xc97a('0x14')][_0xc97a('0x13')]);}})[_0xc97a('0x15')](function(_0x3a3317){logger[_0xc97a('0x11')](_0xc97a('0xe'),_0x5cbe8a,_0x3a3317);_0x7f837a(_0x3a3317);});});} \ No newline at end of file +var _0xb81f=['info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0xb81f,0x13a));var _0xfb81=function(_0x535d45,_0x3a1ba2){_0x535d45=_0x535d45-0x0;var _0x79dcf6=_0xb81f[_0x535d45];return _0x79dcf6;};'use strict';var _=require('lodash');var util=require(_0xfb81('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfb81('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb81('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb81('0x3'))(_0xfb81('0x4'));var config=require(_0xfb81('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xfb81('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc5c7c4,_0x53a8bf,_0x406e1e){return new BPromise(function(_0x30961e,_0xf4e954){return client[_0xfb81('0x7')](_0xc5c7c4,_0x406e1e)[_0xfb81('0x8')](function(_0x17ee45){logger[_0xfb81('0x9')](_0xfb81('0xa'),_0x53a8bf,_0xfb81('0xb'));logger[_0xfb81('0xc')](_0xfb81('0xd'),_0x53a8bf,'request\x20sent',JSON[_0xfb81('0xe')](_0x17ee45));if(_0x17ee45[_0xfb81('0xf')]){if(_0x17ee45['error'][_0xfb81('0x10')]===0x1f4){logger[_0xfb81('0xf')](_0xfb81('0xa'),_0x53a8bf,_0x17ee45['error'][_0xfb81('0x11')]);return _0xf4e954(_0x17ee45['error'][_0xfb81('0x11')]);}logger[_0xfb81('0xf')](_0xfb81('0xa'),_0x53a8bf,_0x17ee45['error'][_0xfb81('0x11')]);return _0x30961e(_0x17ee45['error'][_0xfb81('0x11')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x53a8bf,_0xfb81('0xb'));_0x30961e(_0x17ee45['result']['message']);}})[_0xfb81('0x12')](function(_0x134a7e){logger[_0xfb81('0xf')]('VoiceMail,\x20%s,\x20%s',_0x53a8bf,_0x134a7e);_0xf4e954(_0x134a7e);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 52f29e4..27974d9 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 _0x8efb=['download','post','create','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id'];(function(_0xe23a04,_0x1cf625){var _0x240a9c=function(_0x29b647){while(--_0x29b647){_0xe23a04['push'](_0xe23a04['shift']());}};_0x240a9c(++_0x1cf625);}(_0x8efb,0x1f4));var _0xb8ef=function(_0x394914,_0x3707a1){_0x394914=_0x394914-0x0;var _0x4e142d=_0x8efb[_0x394914];return _0x4e142d;};'use strict';var multer=require(_0xb8ef('0x0'));var util=require('util');var path=require(_0xb8ef('0x1'));var timeout=require(_0xb8ef('0x2'));var express=require(_0xb8ef('0x3'));var router=express[_0xb8ef('0x4')]();var fs_extra=require(_0xb8ef('0x5'));var auth=require(_0xb8ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb8ef('0x7'));var controller=require(_0xb8ef('0x8'));router[_0xb8ef('0x9')]('/',auth[_0xb8ef('0xa')](),controller[_0xb8ef('0xb')]);router['get'](_0xb8ef('0xc'),auth[_0xb8ef('0xa')](),controller['show']);router[_0xb8ef('0x9')]('/:id/download',auth[_0xb8ef('0xa')](),controller[_0xb8ef('0xd')]);router[_0xb8ef('0xe')]('/',auth[_0xb8ef('0xa')](),controller[_0xb8ef('0xf')]);router['put'](_0xb8ef('0xc'),auth[_0xb8ef('0xa')](),controller[_0xb8ef('0x10')]);router['delete'](_0xb8ef('0xc'),auth[_0xb8ef('0xa')](),controller[_0xb8ef('0x11')]);module[_0xb8ef('0x12')]=router; \ No newline at end of file +var _0xb8bf=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','download','post','update','delete','exports','path','connect-timeout','express','fs-extra'];(function(_0x5b78d5,_0x39764c){var _0x48f8ca=function(_0x3acee0){while(--_0x3acee0){_0x5b78d5['push'](_0x5b78d5['shift']());}};_0x48f8ca(++_0x39764c);}(_0xb8bf,0x16c));var _0xfb8b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb8bf[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfb8b('0x0'));var timeout=require(_0xfb8b('0x1'));var express=require(_0xfb8b('0x2'));var router=express['Router']();var fs_extra=require(_0xfb8b('0x3'));var auth=require(_0xfb8b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfb8b('0x5'));var controller=require('./voiceMailMessage.controller');router[_0xfb8b('0x6')]('/',auth[_0xfb8b('0x7')](),controller[_0xfb8b('0x8')]);router['get'](_0xfb8b('0x9'),auth['isAuthenticated'](),controller[_0xfb8b('0xa')]);router['get']('/:id/download',auth[_0xfb8b('0x7')](),controller[_0xfb8b('0xb')]);router[_0xfb8b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xfb8b('0x9'),auth['isAuthenticated'](),controller[_0xfb8b('0xd')]);router[_0xfb8b('0xe')](_0xfb8b('0x9'),auth[_0xfb8b('0x7')](),controller['destroy']);module[_0xfb8b('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 6d8cfdc..a8f7baa 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 _0x3ea0=['STRING','BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER'];(function(_0x589ba3,_0x20c12a){var _0x58d4db=function(_0x35df7d){while(--_0x35df7d){_0x589ba3['push'](_0x589ba3['shift']());}};_0x58d4db(++_0x20c12a);}(_0x3ea0,0x1b3));var _0x03ea=function(_0x44a274,_0x17b558){_0x44a274=_0x44a274-0x0;var _0x582fdc=_0x3ea0[_0x44a274];return _0x582fdc;};'use strict';var Sequelize=require(_0x03ea('0x0'));module[_0x03ea('0x1')]={'name':{'type':Sequelize[_0x03ea('0x2')],'get':function(_0x3a2064){return this[_0x03ea('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x03ea('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x03ea('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x03ea('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x03ea('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x03ea('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x03ea('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x03ea('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x03ea('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x03ea('0x7'),'defaultValue':Sequelize[_0x03ea('0x8')](_0x03ea('0x9'))}}; \ No newline at end of file +var _0xff6d=['STRING','BLOB','long','TIMESTAMP','literal','sequelize','exports','VIRTUAL','INTEGER'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xff6d,0x9e));var _0xdff6=function(_0x2af276,_0xb15ec5){_0x2af276=_0x2af276-0x0;var _0x4c586e=_0xff6d[_0x2af276];return _0x4c586e;};'use strict';var Sequelize=require(_0xdff6('0x0'));module[_0xdff6('0x1')]={'name':{'type':Sequelize[_0xdff6('0x2')],'get':function(_0x5c944d){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xdff6('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xdff6('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xdff6('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xdff6('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xdff6('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xdff6('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xdff6('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xdff6('0x5')](_0xdff6('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xdff6('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xdff6('0x4')],'defaultValue':''},'stamp':{'type':_0xdff6('0x7'),'defaultValue':Sequelize[_0xdff6('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 8374a65..091464c 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 _0x7a78=['reject','update','then','error','stack','name','send','map','fieldName','type','key','model','differenceBy','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','VoiceMailMessage','includeAll','include','rows','show','options','create','body','find','params','catch','destroy','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../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','Content-Range','apply'];(function(_0x45af9d,_0x5d8012){var _0x38d971=function(_0x12ffd2){while(--_0x12ffd2){_0x45af9d['push'](_0x45af9d['shift']());}};_0x38d971(++_0x5d8012);}(_0x7a78,0xdc));var _0x87a7=function(_0x21bc45,_0x3c4626){_0x21bc45=_0x21bc45-0x0;var _0x145d9b=_0x7a78[_0x21bc45];return _0x145d9b;};'use strict';var emlformat=require(_0x87a7('0x0'));var rimraf=require(_0x87a7('0x1'));var zipdir=require(_0x87a7('0x2'));var jsonpatch=require(_0x87a7('0x3'));var rp=require('request-promise');var moment=require(_0x87a7('0x4'));var BPromise=require(_0x87a7('0x5'));var Mustache=require(_0x87a7('0x6'));var util=require(_0x87a7('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x87a7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x87a7('0x9'));var _=require(_0x87a7('0xa'));var squel=require(_0x87a7('0xb'));var crypto=require('crypto');var jsforce=require(_0x87a7('0xc'));var deskjs=require(_0x87a7('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x87a7('0xe'));var Redis=require(_0x87a7('0xf'));var authService=require(_0x87a7('0x10'));var qs=require(_0x87a7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x87a7('0x12'));var logger=require(_0x87a7('0x13'))(_0x87a7('0x14'));var utils=require('../../config/utils');var config=require(_0x87a7('0x15'));var licenseUtil=require(_0x87a7('0x16'));var db=require(_0x87a7('0x17'))['db'];function respondWithStatusCode(_0x51ef10,_0x53e9ff){_0x53e9ff=_0x53e9ff||0xcc;return function(_0x3f2089){if(_0x3f2089){return _0x51ef10[_0x87a7('0x18')](_0x53e9ff);}return _0x51ef10[_0x87a7('0x19')](_0x53e9ff)[_0x87a7('0x1a')]();};}function respondWithResult(_0x1ef606,_0x269542){_0x269542=_0x269542||0xc8;return function(_0x391c69){if(_0x391c69){return _0x1ef606['status'](_0x269542)[_0x87a7('0x1b')](_0x391c69);}};}function respondWithFilteredResult(_0x22613f,_0x27e519){return function(_0x4f49fa){if(_0x4f49fa){var _0x39a12d=typeof _0x27e519['offset']===_0x87a7('0x1c')&&typeof _0x27e519[_0x87a7('0x1d')]==='undefined';var _0x21bc95=_0x4f49fa[_0x87a7('0x1e')];var _0x5bbd64=_0x39a12d?0x0:_0x27e519[_0x87a7('0x1f')];var _0x4a7c45=_0x39a12d?_0x4f49fa[_0x87a7('0x1e')]:_0x27e519[_0x87a7('0x1f')]+_0x27e519[_0x87a7('0x1d')];var _0x4d6a3b;if(_0x4a7c45>=_0x21bc95){_0x4a7c45=_0x21bc95;_0x4d6a3b=0xc8;}else{_0x4d6a3b=0xce;}_0x22613f[_0x87a7('0x19')](_0x4d6a3b);return _0x22613f[_0x87a7('0x20')](_0x87a7('0x21'),_0x5bbd64+'-'+_0x4a7c45+'/'+_0x21bc95)[_0x87a7('0x1b')](_0x4f49fa);}return null;};}function patchUpdates(_0x124925){return function(_0xa38da6){try{jsonpatch[_0x87a7('0x22')](_0xa38da6,_0x124925,!![]);}catch(_0xd22d5b){return BPromise[_0x87a7('0x23')](_0xd22d5b);}return _0xa38da6['save']();};}function saveUpdates(_0x568658,_0x4835a0){return function(_0x5bbaa8){if(_0x5bbaa8){return _0x5bbaa8[_0x87a7('0x24')](_0x568658)[_0x87a7('0x25')](function(_0x150b11){return _0x150b11;});}return null;};}function removeEntity(_0x4ae986,_0x1742ca){return function(_0x14f637){if(_0x14f637){return _0x14f637['destroy']()['then'](function(){_0x4ae986[_0x87a7('0x19')](0xcc)[_0x87a7('0x1a')]();});}};}function handleEntityNotFound(_0x5c0e0b,_0xdfd31e){return function(_0xcb9d3d){if(!_0xcb9d3d){_0x5c0e0b['sendStatus'](0x194);}return _0xcb9d3d;};}function handleError(_0x1c5a4c,_0xd85ef9){_0xd85ef9=_0xd85ef9||0x1f4;return function(_0x4bf893){logger[_0x87a7('0x26')](_0x4bf893[_0x87a7('0x27')]);if(_0x4bf893[_0x87a7('0x28')]){delete _0x4bf893[_0x87a7('0x28')];}_0x1c5a4c['status'](_0xd85ef9)[_0x87a7('0x29')](_0x4bf893);};}exports['index']=function(_0x3052dd,_0x27394f){var _0x114e54={},_0x33661c={},_0x22f4fa={'count':0x0,'rows':[]};var _0x46aac5=_[_0x87a7('0x2a')](db['VoiceMailMessage']['rawAttributes'],function(_0x4f26a4){return{'name':_0x4f26a4[_0x87a7('0x2b')],'type':_0x4f26a4[_0x87a7('0x2c')][_0x87a7('0x2d')]};});_0x33661c[_0x87a7('0x2e')]=_[_0x87a7('0x2f')](_[_0x87a7('0x2a')](_0x46aac5,'name'),['name']);_0x33661c['query']=_[_0x87a7('0x30')](_0x3052dd[_0x87a7('0x31')]);_0x33661c['filters']=_[_0x87a7('0x32')](_0x33661c[_0x87a7('0x2e')],_0x33661c['query']);_0x114e54[_0x87a7('0x33')]=_[_0x87a7('0x32')](_0x33661c[_0x87a7('0x2e')],qs['fields'](_0x3052dd[_0x87a7('0x31')][_0x87a7('0x34')]));_0x114e54[_0x87a7('0x33')]=_0x114e54[_0x87a7('0x33')][_0x87a7('0x35')]?_0x114e54['attributes']:_0x33661c[_0x87a7('0x2e')];if(!_0x3052dd[_0x87a7('0x31')][_0x87a7('0x36')](_0x87a7('0x37'))){_0x114e54[_0x87a7('0x1d')]=qs[_0x87a7('0x1d')](_0x3052dd[_0x87a7('0x31')][_0x87a7('0x1d')]);_0x114e54[_0x87a7('0x1f')]=qs[_0x87a7('0x1f')](_0x3052dd['query'][_0x87a7('0x1f')]);}_0x114e54[_0x87a7('0x38')]=qs[_0x87a7('0x39')](_0x3052dd[_0x87a7('0x31')][_0x87a7('0x39')]);_0x114e54[_0x87a7('0x3a')]=qs[_0x87a7('0x3b')](_[_0x87a7('0x3c')](_0x3052dd['query'],_0x33661c[_0x87a7('0x3b')]),_0x46aac5);if(_0x3052dd[_0x87a7('0x31')]['filter']){_0x114e54[_0x87a7('0x3a')]=_[_0x87a7('0x3d')](_0x114e54['where'],{'$or':_[_0x87a7('0x2a')](_0x46aac5,function(_0x3a0116){if(_0x3a0116[_0x87a7('0x2c')]!==_0x87a7('0x3e')){var _0xee5bc2={};_0xee5bc2[_0x3a0116['name']]={'$like':'%'+_0x3052dd[_0x87a7('0x31')]['filter']+'%'};return _0xee5bc2;}})});}_0x114e54=_[_0x87a7('0x3d')]({},_0x114e54,_0x3052dd['options']);var _0x2db0e5={'where':_0x114e54[_0x87a7('0x3a')]};return db[_0x87a7('0x3f')][_0x87a7('0x1e')](_0x2db0e5)[_0x87a7('0x25')](function(_0x1df5d2){_0x22f4fa['count']=_0x1df5d2;if(_0x3052dd['query'][_0x87a7('0x40')]){_0x114e54[_0x87a7('0x41')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x114e54);})['then'](function(_0x332a1a){_0x22f4fa[_0x87a7('0x42')]=_0x332a1a;return _0x22f4fa;})[_0x87a7('0x25')](respondWithFilteredResult(_0x27394f,_0x114e54))['catch'](handleError(_0x27394f,null));};exports[_0x87a7('0x43')]=function(_0x5d6e9c,_0x46f885){var _0x2266e6={'raw':!![],'where':{'id':_0x5d6e9c['params']['id']}},_0x32ef1e={};_0x32ef1e[_0x87a7('0x2e')]=_['keys'](db[_0x87a7('0x3f')]['rawAttributes']);_0x32ef1e[_0x87a7('0x31')]=_[_0x87a7('0x30')](_0x5d6e9c[_0x87a7('0x31')]);_0x32ef1e[_0x87a7('0x3b')]=_[_0x87a7('0x32')](_0x32ef1e[_0x87a7('0x2e')],_0x32ef1e[_0x87a7('0x31')]);_0x2266e6[_0x87a7('0x33')]=_[_0x87a7('0x32')](_0x32ef1e[_0x87a7('0x2e')],qs[_0x87a7('0x34')](_0x5d6e9c[_0x87a7('0x31')][_0x87a7('0x34')]));_0x2266e6[_0x87a7('0x33')]=_0x2266e6[_0x87a7('0x33')][_0x87a7('0x35')]?_0x2266e6['attributes']:_0x32ef1e[_0x87a7('0x2e')];if(_0x5d6e9c[_0x87a7('0x31')]['includeAll']){_0x2266e6[_0x87a7('0x41')]=[{'all':!![]}];}_0x2266e6=_[_0x87a7('0x3d')]({},_0x2266e6,_0x5d6e9c[_0x87a7('0x44')]);return db[_0x87a7('0x3f')]['find'](_0x2266e6)[_0x87a7('0x25')](handleEntityNotFound(_0x46f885,null))[_0x87a7('0x25')](respondWithResult(_0x46f885,null))['catch'](handleError(_0x46f885,null));};exports[_0x87a7('0x45')]=function(_0x5a249d,_0x493b0b){return db['VoiceMailMessage'][_0x87a7('0x45')](_0x5a249d['body'],{})[_0x87a7('0x25')](respondWithResult(_0x493b0b,0xc9))['catch'](handleError(_0x493b0b,null));};exports[_0x87a7('0x24')]=function(_0x48e9b7,_0x58bc6d){if(_0x48e9b7['body']['id']){delete _0x48e9b7[_0x87a7('0x46')]['id'];}return db[_0x87a7('0x3f')][_0x87a7('0x47')]({'where':{'id':_0x48e9b7[_0x87a7('0x48')]['id']}})['then'](handleEntityNotFound(_0x58bc6d,null))[_0x87a7('0x25')](saveUpdates(_0x48e9b7[_0x87a7('0x46')],null))[_0x87a7('0x25')](respondWithResult(_0x58bc6d,null))[_0x87a7('0x49')](handleError(_0x58bc6d,null));};exports[_0x87a7('0x4a')]=function(_0x20cb93,_0x1c2506){return db[_0x87a7('0x3f')][_0x87a7('0x47')]({'where':{'id':_0x20cb93[_0x87a7('0x48')]['id']}})[_0x87a7('0x25')](handleEntityNotFound(_0x1c2506,null))['then'](removeEntity(_0x1c2506,null))[_0x87a7('0x49')](handleError(_0x1c2506,null));};exports[_0x87a7('0x4b')]=function(_0x26e49d,_0x2347bc,_0x3aa7fa){return db[_0x87a7('0x3f')][_0x87a7('0x47')]({'where':{'id':_0x26e49d[_0x87a7('0x48')]['id']},'attributes':['id','recording','msg_id']})[_0x87a7('0x25')](handleEntityNotFound(_0x2347bc,null))['then'](function(_0x41fa29){if(_0x41fa29){if(!_0x41fa29[_0x87a7('0x4c')]){throw new db[(_0x87a7('0x4d'))][(_0x87a7('0x4e'))](_0x87a7('0x4f'));}var _0x47c4a7={'Content-Type':_0x87a7('0x50'),'Content-Disposition':_0x87a7('0x51')};if(_0x41fa29[_0x87a7('0x52')]){_0x47c4a7[_0x87a7('0x53')]=_0x87a7('0x54')+_0x41fa29[_0x87a7('0x52')]+'.wav\x22';}_0x2347bc[_0x87a7('0x20')](_0x47c4a7);return _0x2347bc['send'](new Buffer(_0x41fa29[_0x87a7('0x4c')]));}})['catch'](handleError(_0x2347bc,null));}; \ No newline at end of file +var _0x5cca=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','undefined','limit','count','offset','status','set','Content-Range','update','then','destroy','sendStatus','name','map','VoiceMailMessage','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','keys','includeAll','find','create','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','attachment','.wav\x22','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5cca,0x116));var _0xa5cc=function(_0x77e7e8,_0x5a319f){_0x77e7e8=_0x77e7e8-0x0;var _0x205a3e=_0x5cca[_0x77e7e8];return _0x205a3e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa5cc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa5cc('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xa5cc('0x2'));var util=require(_0xa5cc('0x3'));var path=require(_0xa5cc('0x4'));var sox=require(_0xa5cc('0x5'));var csv=require(_0xa5cc('0x6'));var ejs=require(_0xa5cc('0x7'));var fs=require('fs');var fs_extra=require(_0xa5cc('0x8'));var _=require('lodash');var squel=require(_0xa5cc('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa5cc('0xa'));var toCsv=require(_0xa5cc('0x6'));var querystring=require(_0xa5cc('0xb'));var Papa=require(_0xa5cc('0xc'));var Redis=require(_0xa5cc('0xd'));var authService=require(_0xa5cc('0xe'));var qs=require(_0xa5cc('0xf'));var as=require(_0xa5cc('0x10'));var hardwareService=require(_0xa5cc('0x11'));var logger=require(_0xa5cc('0x12'))(_0xa5cc('0x13'));var utils=require(_0xa5cc('0x14'));var config=require(_0xa5cc('0x15'));var licenseUtil=require(_0xa5cc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x205df7,_0x545790){_0x545790=_0x545790||0xcc;return function(_0x3e9d95){if(_0x3e9d95){return _0x205df7['sendStatus'](_0x545790);}return _0x205df7['status'](_0x545790)[_0xa5cc('0x17')]();};}function respondWithResult(_0x399ca3,_0x1cc9be){_0x1cc9be=_0x1cc9be||0xc8;return function(_0x12fb45){if(_0x12fb45){return _0x399ca3['status'](_0x1cc9be)['json'](_0x12fb45);}};}function respondWithFilteredResult(_0x1c5602,_0x3a6c8a){return function(_0x3f3967){if(_0x3f3967){var _0x123ff7=typeof _0x3a6c8a['offset']===_0xa5cc('0x18')&&typeof _0x3a6c8a[_0xa5cc('0x19')]==='undefined';var _0x8ad55d=_0x3f3967[_0xa5cc('0x1a')];var _0x53ab49=_0x123ff7?0x0:_0x3a6c8a[_0xa5cc('0x1b')];var _0x48aeba=_0x123ff7?_0x3f3967['count']:_0x3a6c8a[_0xa5cc('0x1b')]+_0x3a6c8a[_0xa5cc('0x19')];var _0xf4bff;if(_0x48aeba>=_0x8ad55d){_0x48aeba=_0x8ad55d;_0xf4bff=0xc8;}else{_0xf4bff=0xce;}_0x1c5602[_0xa5cc('0x1c')](_0xf4bff);return _0x1c5602[_0xa5cc('0x1d')](_0xa5cc('0x1e'),_0x53ab49+'-'+_0x48aeba+'/'+_0x8ad55d)['json'](_0x3f3967);}return null;};}function patchUpdates(_0x2dd3a0){return function(_0x796ac2){try{jsonpatch['apply'](_0x796ac2,_0x2dd3a0,!![]);}catch(_0x3d0ac6){return BPromise['reject'](_0x3d0ac6);}return _0x796ac2['save']();};}function saveUpdates(_0x47a213,_0x32ca8f){return function(_0x348ce4){if(_0x348ce4){return _0x348ce4[_0xa5cc('0x1f')](_0x47a213)[_0xa5cc('0x20')](function(_0x107c61){return _0x107c61;});}return null;};}function removeEntity(_0x2a2c33,_0x2761ed){return function(_0x44eed8){if(_0x44eed8){return _0x44eed8[_0xa5cc('0x21')]()[_0xa5cc('0x20')](function(){_0x2a2c33[_0xa5cc('0x1c')](0xcc)[_0xa5cc('0x17')]();});}};}function handleEntityNotFound(_0x2a2e37,_0x57fe7d){return function(_0x3877dc){if(!_0x3877dc){_0x2a2e37[_0xa5cc('0x22')](0x194);}return _0x3877dc;};}function handleError(_0x289dbd,_0x40118b){_0x40118b=_0x40118b||0x1f4;return function(_0x2802ca){logger['error'](_0x2802ca['stack']);if(_0x2802ca[_0xa5cc('0x23')]){delete _0x2802ca['name'];}_0x289dbd[_0xa5cc('0x1c')](_0x40118b)['send'](_0x2802ca);};}exports['index']=function(_0x46ca99,_0x4102ca){var _0xf72ff7={},_0x3d1a4f={},_0x412bb4={'count':0x0,'rows':[]};var _0x5b4031=_[_0xa5cc('0x24')](db[_0xa5cc('0x25')][_0xa5cc('0x26')],function(_0xbc3b1f){return{'name':_0xbc3b1f[_0xa5cc('0x27')],'type':_0xbc3b1f[_0xa5cc('0x28')]['key']};});_0x3d1a4f[_0xa5cc('0x29')]=_['differenceBy'](_[_0xa5cc('0x24')](_0x5b4031,_0xa5cc('0x23')),[_0xa5cc('0x23')]);_0x3d1a4f[_0xa5cc('0x2a')]=_['keys'](_0x46ca99[_0xa5cc('0x2a')]);_0x3d1a4f[_0xa5cc('0x2b')]=_[_0xa5cc('0x2c')](_0x3d1a4f[_0xa5cc('0x29')],_0x3d1a4f['query']);_0xf72ff7['attributes']=_['intersection'](_0x3d1a4f['model'],qs[_0xa5cc('0x2d')](_0x46ca99[_0xa5cc('0x2a')][_0xa5cc('0x2d')]));_0xf72ff7[_0xa5cc('0x2e')]=_0xf72ff7[_0xa5cc('0x2e')][_0xa5cc('0x2f')]?_0xf72ff7[_0xa5cc('0x2e')]:_0x3d1a4f[_0xa5cc('0x29')];if(!_0x46ca99[_0xa5cc('0x2a')][_0xa5cc('0x30')](_0xa5cc('0x31'))){_0xf72ff7[_0xa5cc('0x19')]=qs['limit'](_0x46ca99['query'][_0xa5cc('0x19')]);_0xf72ff7['offset']=qs['offset'](_0x46ca99['query']['offset']);}_0xf72ff7['order']=qs[_0xa5cc('0x32')](_0x46ca99['query'][_0xa5cc('0x32')]);_0xf72ff7[_0xa5cc('0x33')]=qs['filters'](_[_0xa5cc('0x34')](_0x46ca99[_0xa5cc('0x2a')],_0x3d1a4f[_0xa5cc('0x2b')]),_0x5b4031);if(_0x46ca99['query'][_0xa5cc('0x35')]){_0xf72ff7[_0xa5cc('0x33')]=_[_0xa5cc('0x36')](_0xf72ff7[_0xa5cc('0x33')],{'$or':_[_0xa5cc('0x24')](_0x5b4031,function(_0x4d8d04){if(_0x4d8d04[_0xa5cc('0x28')]!=='VIRTUAL'){var _0x3dbc0f={};_0x3dbc0f[_0x4d8d04[_0xa5cc('0x23')]]={'$like':'%'+_0x46ca99[_0xa5cc('0x2a')][_0xa5cc('0x35')]+'%'};return _0x3dbc0f;}})});}_0xf72ff7=_[_0xa5cc('0x36')]({},_0xf72ff7,_0x46ca99[_0xa5cc('0x37')]);var _0x3c2507={'where':_0xf72ff7['where']};return db['VoiceMailMessage'][_0xa5cc('0x1a')](_0x3c2507)[_0xa5cc('0x20')](function(_0x21c16c){_0x412bb4[_0xa5cc('0x1a')]=_0x21c16c;if(_0x46ca99['query']['includeAll']){_0xf72ff7[_0xa5cc('0x38')]=[{'all':!![]}];}return db[_0xa5cc('0x25')][_0xa5cc('0x39')](_0xf72ff7);})['then'](function(_0x23a75b){_0x412bb4[_0xa5cc('0x3a')]=_0x23a75b;return _0x412bb4;})[_0xa5cc('0x20')](respondWithFilteredResult(_0x4102ca,_0xf72ff7))[_0xa5cc('0x3b')](handleError(_0x4102ca,null));};exports['show']=function(_0x49443b,_0x486168){var _0x39e0c8={'raw':!![],'where':{'id':_0x49443b[_0xa5cc('0x3c')]['id']}},_0x28efe5={};_0x28efe5['model']=_[_0xa5cc('0x3d')](db['VoiceMailMessage']['rawAttributes']);_0x28efe5[_0xa5cc('0x2a')]=_[_0xa5cc('0x3d')](_0x49443b['query']);_0x28efe5['filters']=_[_0xa5cc('0x2c')](_0x28efe5['model'],_0x28efe5[_0xa5cc('0x2a')]);_0x39e0c8[_0xa5cc('0x2e')]=_[_0xa5cc('0x2c')](_0x28efe5[_0xa5cc('0x29')],qs['fields'](_0x49443b[_0xa5cc('0x2a')]['fields']));_0x39e0c8['attributes']=_0x39e0c8[_0xa5cc('0x2e')]['length']?_0x39e0c8[_0xa5cc('0x2e')]:_0x28efe5['model'];if(_0x49443b[_0xa5cc('0x2a')][_0xa5cc('0x3e')]){_0x39e0c8[_0xa5cc('0x38')]=[{'all':!![]}];}_0x39e0c8=_['merge']({},_0x39e0c8,_0x49443b['options']);return db['VoiceMailMessage'][_0xa5cc('0x3f')](_0x39e0c8)[_0xa5cc('0x20')](handleEntityNotFound(_0x486168,null))['then'](respondWithResult(_0x486168,null))[_0xa5cc('0x3b')](handleError(_0x486168,null));};exports[_0xa5cc('0x40')]=function(_0x4ad317,_0x305844){return db['VoiceMailMessage']['create'](_0x4ad317[_0xa5cc('0x41')],{})['then'](respondWithResult(_0x305844,0xc9))['catch'](handleError(_0x305844,null));};exports[_0xa5cc('0x1f')]=function(_0x3a02d5,_0x3b4772){if(_0x3a02d5['body']['id']){delete _0x3a02d5[_0xa5cc('0x41')]['id'];}return db['VoiceMailMessage'][_0xa5cc('0x3f')]({'where':{'id':_0x3a02d5[_0xa5cc('0x3c')]['id']}})[_0xa5cc('0x20')](handleEntityNotFound(_0x3b4772,null))[_0xa5cc('0x20')](saveUpdates(_0x3a02d5['body'],null))[_0xa5cc('0x20')](respondWithResult(_0x3b4772,null))[_0xa5cc('0x3b')](handleError(_0x3b4772,null));};exports['destroy']=function(_0x24b449,_0x1e563e){return db[_0xa5cc('0x25')][_0xa5cc('0x3f')]({'where':{'id':_0x24b449[_0xa5cc('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1e563e,null))['then'](removeEntity(_0x1e563e,null))[_0xa5cc('0x3b')](handleError(_0x1e563e,null));};exports[_0xa5cc('0x42')]=function(_0x3e2577,_0xf3f189,_0x5b27e2){return db[_0xa5cc('0x25')][_0xa5cc('0x3f')]({'where':{'id':_0x3e2577['params']['id']},'attributes':['id',_0xa5cc('0x43'),_0xa5cc('0x44')]})['then'](handleEntityNotFound(_0xf3f189,null))[_0xa5cc('0x20')](function(_0x45c395){if(_0x45c395){if(!_0x45c395['recording']){throw new db[(_0xa5cc('0x45'))]['ValidationError'](_0xa5cc('0x46'));}var _0x5f7061={'Content-Type':'audio/wav','Content-Disposition':_0xa5cc('0x47')};if(_0x45c395[_0xa5cc('0x44')]){_0x5f7061['Content-Disposition']='attachment;\x20filename=\x22'+_0x45c395[_0xa5cc('0x44')]+_0xa5cc('0x48');}_0xf3f189[_0xa5cc('0x1d')](_0x5f7061);return _0xf3f189['send'](new Buffer(_0x45c395[_0xa5cc('0x43')]));}})[_0xa5cc('0x3b')](handleError(_0xf3f189,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 13e3cda..14057e4 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 _0x1243=['define','VoiceMailMessage','voice_voicemail_messages','dir','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports'];(function(_0x47325b,_0x483eb6){var _0x5b133d=function(_0x146429){while(--_0x146429){_0x47325b['push'](_0x47325b['shift']());}};_0x5b133d(++_0x483eb6);}(_0x1243,0x79));var _0x3124=function(_0x4a8e3b,_0x1cbd0a){_0x4a8e3b=_0x4a8e3b-0x0;var _0x2aa1e9=_0x1243[_0x4a8e3b];return _0x2aa1e9;};'use strict';var _=require('lodash');var util=require(_0x3124('0x0'));var logger=require('../../config/logger')(_0x3124('0x1'));var moment=require('moment');var BPromise=require(_0x3124('0x2'));var rp=require(_0x3124('0x3'));var fs=require('fs');var path=require(_0x3124('0x4'));var rimraf=require(_0x3124('0x5'));var config=require(_0x3124('0x6'));var attributes=require(_0x3124('0x7'));module[_0x3124('0x8')]=function(_0x24af0f,_0x1a6dab){return _0x24af0f[_0x3124('0x9')](_0x3124('0xa'),attributes,{'tableName':_0x3124('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x3124('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6f15=['rimraf','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x12f5f7,_0xa58b52){var _0x345c1b=function(_0x306035){while(--_0x306035){_0x12f5f7['push'](_0x12f5f7['shift']());}};_0x345c1b(++_0xa58b52);}(_0x6f15,0xd2));var _0x56f1=function(_0x351246,_0x5a7b4e){_0x351246=_0x351246-0x0;var _0x2ec4ab=_0x6f15[_0x351246];return _0x2ec4ab;};'use strict';var _=require(_0x56f1('0x0'));var util=require(_0x56f1('0x1'));var logger=require(_0x56f1('0x2'))('api');var moment=require(_0x56f1('0x3'));var BPromise=require('bluebird');var rp=require(_0x56f1('0x4'));var fs=require('fs');var path=require(_0x56f1('0x5'));var rimraf=require(_0x56f1('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x56f1('0x7')]=function(_0x95d367,_0x5284cb){return _0x95d367[_0x56f1('0x8')](_0x56f1('0x9'),attributes,{'tableName':_0x56f1('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x56f1('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 4429f6c..230599d 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 _0x2203=['lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x2981d7,_0x13c09e){var _0x6834d8=function(_0x490134){while(--_0x490134){_0x2981d7['push'](_0x2981d7['shift']());}};_0x6834d8(++_0x13c09e);}(_0x2203,0x73));var _0x3220=function(_0x2f8805,_0x2f1d21){_0x2f8805=_0x2f8805-0x0;var _0xa16375=_0x2203[_0x2f8805];return _0xa16375;};'use strict';var _=require(_0x3220('0x0'));var util=require(_0x3220('0x1'));var moment=require(_0x3220('0x2'));var BPromise=require(_0x3220('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3220('0x4'));var db=require(_0x3220('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3220('0x6'));var config=require(_0x3220('0x7'));var jayson=require(_0x3220('0x8'));var client=jayson[_0x3220('0x9')][_0x3220('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14933e,_0x4d9e87,_0x4f715d){return new BPromise(function(_0x40ce3a,_0x5e6500){return client[_0x3220('0xb')](_0x14933e,_0x4f715d)[_0x3220('0xc')](function(_0x33f19d){logger[_0x3220('0xd')](_0x3220('0xe'),_0x4d9e87,'request\x20sent');logger[_0x3220('0xf')](_0x3220('0x10'),_0x4d9e87,_0x3220('0x11'),JSON[_0x3220('0x12')](_0x33f19d));if(_0x33f19d[_0x3220('0x13')]){if(_0x33f19d[_0x3220('0x13')][_0x3220('0x14')]===0x1f4){logger[_0x3220('0x13')](_0x3220('0xe'),_0x4d9e87,_0x33f19d[_0x3220('0x13')][_0x3220('0x15')]);return _0x5e6500(_0x33f19d[_0x3220('0x13')][_0x3220('0x15')]);}logger[_0x3220('0x13')](_0x3220('0xe'),_0x4d9e87,_0x33f19d['error'][_0x3220('0x15')]);return _0x40ce3a(_0x33f19d[_0x3220('0x13')][_0x3220('0x15')]);}else{logger['info'](_0x3220('0xe'),_0x4d9e87,_0x3220('0x11'));_0x40ce3a(_0x33f19d[_0x3220('0x16')][_0x3220('0x15')]);}})['catch'](function(_0x14ae49){logger['error'](_0x3220('0xe'),_0x4d9e87,_0x14ae49);_0x5e6500(_0x14ae49);});});} \ No newline at end of file +var _0x25fa=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x384438,_0x228524){var _0xe475e9=function(_0xa107df){while(--_0xa107df){_0x384438['push'](_0x384438['shift']());}};_0xe475e9(++_0x228524);}(_0x25fa,0xc4));var _0xa25f=function(_0x609688,_0x44059d){_0x609688=_0x609688-0x0;var _0x46396d=_0x25fa[_0x609688];return _0x46396d;};'use strict';var _=require(_0xa25f('0x0'));var util=require(_0xa25f('0x1'));var moment=require(_0xa25f('0x2'));var BPromise=require(_0xa25f('0x3'));var rs=require(_0xa25f('0x4'));var fs=require('fs');var Redis=require(_0xa25f('0x5'));var db=require(_0xa25f('0x6'))['db'];var utils=require(_0xa25f('0x7'));var logger=require('../../config/logger')(_0xa25f('0x8'));var config=require(_0xa25f('0x9'));var jayson=require(_0xa25f('0xa'));var client=jayson[_0xa25f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a16e8,_0x590804,_0x15502c){return new BPromise(function(_0x7092d2,_0x5c9383){return client[_0xa25f('0xc')](_0x3a16e8,_0x15502c)['then'](function(_0x130c9b){logger[_0xa25f('0xd')](_0xa25f('0xe'),_0x590804,'request\x20sent');logger['debug'](_0xa25f('0xf'),_0x590804,_0xa25f('0x10'),JSON[_0xa25f('0x11')](_0x130c9b));if(_0x130c9b[_0xa25f('0x12')]){if(_0x130c9b['error'][_0xa25f('0x13')]===0x1f4){logger[_0xa25f('0x12')](_0xa25f('0xe'),_0x590804,_0x130c9b[_0xa25f('0x12')][_0xa25f('0x14')]);return _0x5c9383(_0x130c9b[_0xa25f('0x12')][_0xa25f('0x14')]);}logger[_0xa25f('0x12')](_0xa25f('0xe'),_0x590804,_0x130c9b[_0xa25f('0x12')][_0xa25f('0x14')]);return _0x7092d2(_0x130c9b[_0xa25f('0x12')]['message']);}else{logger[_0xa25f('0xd')](_0xa25f('0xe'),_0x590804,_0xa25f('0x10'));_0x7092d2(_0x130c9b[_0xa25f('0x15')][_0xa25f('0x14')]);}})['catch'](function(_0x2197dc){logger[_0xa25f('0x12')](_0xa25f('0xe'),_0x590804,_0x2197dc);_0x5c9383(_0x2197dc);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 32437cc..acb71ef 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 _0x458e=['destroy','/:id/sounds/:id2','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','create','post','addSound','delete'];(function(_0x152702,_0x5a9ea7){var _0x100fd6=function(_0x24a4eb){while(--_0x24a4eb){_0x152702['push'](_0x152702['shift']());}};_0x100fd6(++_0x5a9ea7);}(_0x458e,0x114));var _0xe458=function(_0x470182,_0x3fa181){_0x470182=_0x470182-0x0;var _0x201e50=_0x458e[_0x470182];return _0x201e50;};'use strict';var multer=require(_0xe458('0x0'));var util=require('util');var path=require(_0xe458('0x1'));var timeout=require(_0xe458('0x2'));var express=require('express');var router=express[_0xe458('0x3')]();var fs_extra=require(_0xe458('0x4'));var auth=require(_0xe458('0x5'));var interaction=require(_0xe458('0x6'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0xe458('0x7')]('/',auth[_0xe458('0x8')](),controller[_0xe458('0x9')]);router[_0xe458('0x7')](_0xe458('0xa'),auth[_0xe458('0x8')](),controller[_0xe458('0xb')]);router[_0xe458('0x7')](_0xe458('0xc'),auth[_0xe458('0x8')](),controller[_0xe458('0xd')]);router['post']('/',auth[_0xe458('0x8')](),controller[_0xe458('0xe')]);router[_0xe458('0xf')](_0xe458('0xc'),auth[_0xe458('0x8')](),controller[_0xe458('0x10')]);router['put']('/:id',auth[_0xe458('0x8')](),controller['update']);router[_0xe458('0x11')](_0xe458('0xa'),auth['isAuthenticated'](),controller[_0xe458('0x12')]);router[_0xe458('0x11')](_0xe458('0x13'),auth['isAuthenticated'](),controller['removeSound']);module[_0xe458('0x14')]=router; \ No newline at end of file +var _0x519a=['removeSound','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','create','put','update','delete','destroy'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x519a,0x65));var _0xa519=function(_0xaf025d,_0x586d7a){_0xaf025d=_0xaf025d-0x0;var _0x1c77cb=_0x519a[_0xaf025d];return _0x1c77cb;};'use strict';var multer=require(_0xa519('0x0'));var util=require(_0xa519('0x1'));var path=require(_0xa519('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa519('0x3'));var auth=require(_0xa519('0x4'));var interaction=require(_0xa519('0x5'));var config=require('../../config/environment');var controller=require(_0xa519('0x6'));router[_0xa519('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa519('0x7')](_0xa519('0x8'),auth[_0xa519('0x9')](),controller[_0xa519('0xa')]);router[_0xa519('0x7')](_0xa519('0xb'),auth[_0xa519('0x9')](),controller[_0xa519('0xc')]);router[_0xa519('0xd')]('/',auth[_0xa519('0x9')](),controller[_0xa519('0xe')]);router[_0xa519('0xd')](_0xa519('0xb'),auth[_0xa519('0x9')](),controller['addSound']);router[_0xa519('0xf')](_0xa519('0x8'),auth[_0xa519('0x9')](),controller[_0xa519('0x10')]);router[_0xa519('0x11')]('/:id',auth[_0xa519('0x9')](),controller[_0xa519('0x12')]);router['delete']('/:id/sounds/:id2',auth[_0xa519('0x9')](),controller[_0xa519('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c7a08b7..8abf3fe 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 _0x7d76=['sequelize','exports','name','ENUM','mp3nb','quietmp3nb','quietmp3','mp3','files','STRING','alpha','TIMESTAMP','BOOLEAN'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x7d76,0xb6));var _0x67d7=function(_0x3020dc,_0x302084){_0x3020dc=_0x3020dc-0x0;var _0x5266a9=_0x7d76[_0x3020dc];return _0x5266a9;};'use strict';var Sequelize=require(_0x67d7('0x0'));module[_0x67d7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x67d7('0x2')},'mode':{'type':Sequelize[_0x67d7('0x3')]('custom','files',_0x67d7('0x4'),_0x67d7('0x5'),_0x67d7('0x6'),_0x67d7('0x7')),'allowNull':!![],'defaultValue':_0x67d7('0x8')},'directory':{'type':Sequelize[_0x67d7('0x9')],'allowNull':!![]},'application':{'type':Sequelize[_0x67d7('0x9')],'allowNull':!![]},'digit':{'type':Sequelize[_0x67d7('0x9')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x67d7('0xa')},'format':{'type':Sequelize[_0x67d7('0x9')],'allowNull':!![]},'stamp':{'type':_0x67d7('0xb')},'defaultEntry':{'type':Sequelize[_0x67d7('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0ab1=['ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','exports','STRING','name'];(function(_0x33006f,_0x152441){var _0x215222=function(_0x1e1d78){while(--_0x1e1d78){_0x33006f['push'](_0x33006f['shift']());}};_0x215222(++_0x152441);}(_0x0ab1,0xcd));var _0x10ab=function(_0x57ae69,_0x2c5bf8){_0x57ae69=_0x57ae69-0x0;var _0x51b15a=_0x0ab1[_0x57ae69];return _0x51b15a;};'use strict';var Sequelize=require('sequelize');module[_0x10ab('0x0')]={'name':{'type':Sequelize[_0x10ab('0x1')],'allowNull':![],'unique':_0x10ab('0x2')},'mode':{'type':Sequelize[_0x10ab('0x3')](_0x10ab('0x4'),_0x10ab('0x5'),_0x10ab('0x6'),_0x10ab('0x7'),_0x10ab('0x8'),_0x10ab('0x9')),'allowNull':!![],'defaultValue':_0x10ab('0x5')},'directory':{'type':Sequelize[_0x10ab('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x10ab('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x10ab('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x10ab('0x1')],'allowNull':!![],'defaultValue':_0x10ab('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x10ab('0xb')},'defaultEntry':{'type':Sequelize[_0x10ab('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 4839a6f..a332459 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 _0xa111=['options','includeAll','include','catch','body','find','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','symlinkSync','removeSound','id2','getSounds','pick','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','MusicOnHolds','destroy','end','error','name','send','index','map','VoiceMusicOnHold','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL'];(function(_0x27beea,_0x3bc9f4){var _0x122645=function(_0x2c848){while(--_0x2c848){_0x27beea['push'](_0x27beea['shift']());}};_0x122645(++_0x3bc9f4);}(_0xa111,0x18e));var _0x1a11=function(_0x9a38bc,_0x3c0f11){_0x9a38bc=_0x9a38bc-0x0;var _0x38938c=_0xa111[_0x9a38bc];return _0x38938c;};'use strict';var emlformat=require(_0x1a11('0x0'));var rimraf=require(_0x1a11('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a11('0x2'));var rp=require(_0x1a11('0x3'));var moment=require(_0x1a11('0x4'));var BPromise=require(_0x1a11('0x5'));var Mustache=require(_0x1a11('0x6'));var util=require(_0x1a11('0x7'));var path=require(_0x1a11('0x8'));var sox=require(_0x1a11('0x9'));var csv=require(_0x1a11('0xa'));var ejs=require(_0x1a11('0xb'));var fs=require('fs');var fs_extra=require(_0x1a11('0xc'));var _=require('lodash');var squel=require(_0x1a11('0xd'));var crypto=require(_0x1a11('0xe'));var jsforce=require(_0x1a11('0xf'));var deskjs=require(_0x1a11('0x10'));var toCsv=require(_0x1a11('0xa'));var querystring=require(_0x1a11('0x11'));var Papa=require(_0x1a11('0x12'));var Redis=require(_0x1a11('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1a11('0x14'));var as=require(_0x1a11('0x15'));var hardwareService=require(_0x1a11('0x16'));var logger=require(_0x1a11('0x17'))(_0x1a11('0x18'));var utils=require(_0x1a11('0x19'));var config=require(_0x1a11('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x1a11('0x1b'))['db'];function respondWithStatusCode(_0xe5f82c,_0x181e05){_0x181e05=_0x181e05||0xcc;return function(_0xcfa7f6){if(_0xcfa7f6){return _0xe5f82c[_0x1a11('0x1c')](_0x181e05);}return _0xe5f82c[_0x1a11('0x1d')](_0x181e05)['end']();};}function respondWithResult(_0x385330,_0x53c61c){_0x53c61c=_0x53c61c||0xc8;return function(_0x177626){if(_0x177626){return _0x385330[_0x1a11('0x1d')](_0x53c61c)['json'](_0x177626);}};}function respondWithFilteredResult(_0x362155,_0x47db76){return function(_0x14facf){if(_0x14facf){var _0xca364e=typeof _0x47db76['offset']===_0x1a11('0x1e')&&typeof _0x47db76[_0x1a11('0x1f')]==='undefined';var _0x52ae43=_0x14facf[_0x1a11('0x20')];var _0x4078ff=_0xca364e?0x0:_0x47db76['offset'];var _0x1ee001=_0xca364e?_0x14facf['count']:_0x47db76[_0x1a11('0x21')]+_0x47db76['limit'];var _0x11c819;if(_0x1ee001>=_0x52ae43){_0x1ee001=_0x52ae43;_0x11c819=0xc8;}else{_0x11c819=0xce;}_0x362155['status'](_0x11c819);return _0x362155[_0x1a11('0x22')](_0x1a11('0x23'),_0x4078ff+'-'+_0x1ee001+'/'+_0x52ae43)[_0x1a11('0x24')](_0x14facf);}return null;};}function patchUpdates(_0x325d86){return function(_0xd3fe3c){try{jsonpatch[_0x1a11('0x25')](_0xd3fe3c,_0x325d86,!![]);}catch(_0x264902){return BPromise[_0x1a11('0x26')](_0x264902);}return _0xd3fe3c[_0x1a11('0x27')]();};}function saveUpdates(_0x38686,_0x1d0627){return function(_0x33dbcb){if(_0x33dbcb){return _0x33dbcb[_0x1a11('0x28')](_0x38686)['then'](function(_0x48ac0c){return _0x48ac0c;});}return null;};}function removeEntity(_0x215233,_0x55a6a2){return function(_0x516796){if(_0x516796){return _0x516796['destroy']()[_0x1a11('0x29')](function(){var _0x56a96e=_0x516796['get']({'plain':!![]});var _0x11338c=_0x1a11('0x2a');return db['UserProfileResource'][_0x1a11('0x2b')]({'where':{'type':_0x11338c,'resourceId':_0x56a96e['id']}})[_0x1a11('0x29')](function(){return _0x516796;});})[_0x1a11('0x29')](function(){_0x215233[_0x1a11('0x1d')](0xcc)[_0x1a11('0x2c')]();});}};}function handleEntityNotFound(_0x3e04e7,_0x16c71a){return function(_0x9b9c35){if(!_0x9b9c35){_0x3e04e7[_0x1a11('0x1c')](0x194);}return _0x9b9c35;};}function handleError(_0x3d4e5e,_0x10fdf9){_0x10fdf9=_0x10fdf9||0x1f4;return function(_0x1c2afb){logger[_0x1a11('0x2d')](_0x1c2afb['stack']);if(_0x1c2afb[_0x1a11('0x2e')]){delete _0x1c2afb[_0x1a11('0x2e')];}_0x3d4e5e[_0x1a11('0x1d')](_0x10fdf9)[_0x1a11('0x2f')](_0x1c2afb);};}exports[_0x1a11('0x30')]=function(_0xf4e8fd,_0x1a744d){var _0x506fdb={},_0x37dbab={},_0x5074b4={'count':0x0,'rows':[]};var _0x32d413=_[_0x1a11('0x31')](db[_0x1a11('0x32')][_0x1a11('0x33')],function(_0x447221){return{'name':_0x447221['fieldName'],'type':_0x447221[_0x1a11('0x34')][_0x1a11('0x35')]};});_0x37dbab[_0x1a11('0x36')]=_[_0x1a11('0x31')](_0x32d413,_0x1a11('0x2e'));_0x37dbab['query']=_[_0x1a11('0x37')](_0xf4e8fd[_0x1a11('0x38')]);_0x37dbab[_0x1a11('0x39')]=_[_0x1a11('0x3a')](_0x37dbab[_0x1a11('0x36')],_0x37dbab[_0x1a11('0x38')]);_0x506fdb[_0x1a11('0x3b')]=_[_0x1a11('0x3a')](_0x37dbab[_0x1a11('0x36')],qs[_0x1a11('0x3c')](_0xf4e8fd[_0x1a11('0x38')][_0x1a11('0x3c')]));_0x506fdb[_0x1a11('0x3b')]=_0x506fdb[_0x1a11('0x3b')][_0x1a11('0x3d')]?_0x506fdb[_0x1a11('0x3b')]:_0x37dbab[_0x1a11('0x36')];if(!_0xf4e8fd[_0x1a11('0x38')][_0x1a11('0x3e')](_0x1a11('0x3f'))){_0x506fdb[_0x1a11('0x1f')]=qs[_0x1a11('0x1f')](_0xf4e8fd['query']['limit']);_0x506fdb[_0x1a11('0x21')]=qs[_0x1a11('0x21')](_0xf4e8fd[_0x1a11('0x38')][_0x1a11('0x21')]);}_0x506fdb[_0x1a11('0x40')]=qs[_0x1a11('0x41')](_0xf4e8fd[_0x1a11('0x38')]['sort']);delete _0xf4e8fd[_0x1a11('0x38')]['sort'];_0x506fdb[_0x1a11('0x42')]=qs[_0x1a11('0x39')](_['pick'](_0xf4e8fd[_0x1a11('0x38')],_0x37dbab[_0x1a11('0x39')]),_0x32d413);if(_0xf4e8fd['query'][_0x1a11('0x43')]){_0x506fdb[_0x1a11('0x42')]=_[_0x1a11('0x44')](_0x506fdb[_0x1a11('0x42')],{'$or':_[_0x1a11('0x31')](_0x32d413,function(_0x65300f){if(_0x65300f[_0x1a11('0x34')]!==_0x1a11('0x45')){var _0x3f8c89={};_0x3f8c89[_0x65300f[_0x1a11('0x2e')]]={'$like':'%'+_0xf4e8fd[_0x1a11('0x38')][_0x1a11('0x43')]+'%'};return _0x3f8c89;}})});}_0x506fdb=_[_0x1a11('0x44')]({},_0x506fdb,_0xf4e8fd[_0x1a11('0x46')]);var _0x4c0695={'where':_0x506fdb['where']};return db[_0x1a11('0x32')][_0x1a11('0x20')](_0x4c0695)[_0x1a11('0x29')](function(_0x18d04c){_0x5074b4[_0x1a11('0x20')]=_0x18d04c;if(_0xf4e8fd[_0x1a11('0x38')][_0x1a11('0x47')]){_0x506fdb[_0x1a11('0x48')]=[{'all':!![]}];}return db[_0x1a11('0x32')]['findAll'](_0x506fdb);})['then'](function(_0xa9aa39){_0x5074b4['rows']=_0xa9aa39;return _0x5074b4;})[_0x1a11('0x29')](respondWithFilteredResult(_0x1a744d,_0x506fdb))[_0x1a11('0x49')](handleError(_0x1a744d,null));};exports['show']=function(_0x2d8f94,_0x43aff4){var _0x52e950={'raw':![],'where':{'id':_0x2d8f94['params']['id']}},_0x3551bb={};_0x3551bb[_0x1a11('0x36')]=_[_0x1a11('0x37')](db[_0x1a11('0x32')][_0x1a11('0x33')]);_0x3551bb['query']=_[_0x1a11('0x37')](_0x2d8f94[_0x1a11('0x38')]);_0x3551bb[_0x1a11('0x39')]=_['intersection'](_0x3551bb[_0x1a11('0x36')],_0x3551bb[_0x1a11('0x38')]);_0x52e950[_0x1a11('0x3b')]=_[_0x1a11('0x3a')](_0x3551bb[_0x1a11('0x36')],qs[_0x1a11('0x3c')](_0x2d8f94['query'][_0x1a11('0x3c')]));_0x52e950[_0x1a11('0x3b')]=_0x52e950[_0x1a11('0x3b')]['length']?_0x52e950[_0x1a11('0x3b')]:_0x3551bb['model'];if(_0x2d8f94['query'][_0x1a11('0x47')]){_0x52e950[_0x1a11('0x48')]=[{'all':!![]}];}_0x52e950=_[_0x1a11('0x44')]({},_0x52e950,_0x2d8f94['options']);return db[_0x1a11('0x32')]['find'](_0x52e950)['then'](handleEntityNotFound(_0x43aff4,null))[_0x1a11('0x29')](respondWithResult(_0x43aff4,null))[_0x1a11('0x49')](handleError(_0x43aff4,null));};exports[_0x1a11('0x28')]=function(_0xd15e9,_0x2f7b59){if(_0xd15e9[_0x1a11('0x4a')]['id']){delete _0xd15e9[_0x1a11('0x4a')]['id'];}return db['VoiceMusicOnHold'][_0x1a11('0x4b')]({'where':{'id':_0xd15e9['params']['id']}})[_0x1a11('0x29')](handleEntityNotFound(_0x2f7b59,null))['then'](saveUpdates(_0xd15e9['body'],null))['then'](respondWithResult(_0x2f7b59,null))[_0x1a11('0x49')](handleError(_0x2f7b59,null));};exports[_0x1a11('0x4c')]=function(_0x4485a6,_0xcd4413,_0x213cef){return db[_0x1a11('0x4d')][_0x1a11('0x4e')](function(_0x44b5a2){if(_0x4485a6[_0x1a11('0x4a')][_0x1a11('0x4f')]===_0x1a11('0x50')){_0x4485a6[_0x1a11('0x4a')][_0x1a11('0x51')]=path[_0x1a11('0x52')](config[_0x1a11('0x53')],_0x1a11('0x54'),_0x4485a6[_0x1a11('0x4a')]['name']);}return db['VoiceMusicOnHold'][_0x1a11('0x4c')](_0x4485a6[_0x1a11('0x4a')],{'transaction':_0x44b5a2})[_0x1a11('0x29')](function(_0xfe483f){if(_0x4485a6[_0x1a11('0x4a')][_0x1a11('0x4f')]===_0x1a11('0x50')){fs[_0x1a11('0x55')](_0xfe483f[_0x1a11('0x51')],parseInt('0777',0x8));}var _0x4d84b5=_0x4485a6['user'][_0x1a11('0x56')]({'plain':!![]});if(!_0x4d84b5)throw new Error(_0x1a11('0x57'));if(_0x4d84b5[_0x1a11('0x58')]===_0x1a11('0x59')){var _0x5821f4=_0xfe483f[_0x1a11('0x56')]({'plain':!![]});return db[_0x1a11('0x5a')][_0x1a11('0x4b')]({'where':{'name':_0x1a11('0x2a'),'userProfileId':_0x4d84b5[_0x1a11('0x5b')]},'raw':!![]})[_0x1a11('0x29')](function(_0x11123b){if(_0x11123b&&_0x11123b['autoAssociation']===0x0){return db[_0x1a11('0x5c')][_0x1a11('0x4c')]({'name':_0x5821f4[_0x1a11('0x2e')],'resourceId':_0x5821f4['id'],'type':_0x11123b[_0x1a11('0x2e')],'sectionId':_0x11123b['id']},{})['then'](function(){return _0xfe483f;});}else{return _0xfe483f;}})['catch'](function(_0x498da6){logger[_0x1a11('0x2d')](_0x1a11('0x5d'),_0x498da6);});}return _0xfe483f;});})[_0x1a11('0x29')](respondWithResult(_0xcd4413,0xc9))[_0x1a11('0x49')](handleError(_0xcd4413,null));};exports[_0x1a11('0x2b')]=function(_0x425be1,_0x16654f,_0x15e3bf){var _0x4de3e2;return db['VoiceMusicOnHold'][_0x1a11('0x4b')]({'where':{'id':_0x425be1[_0x1a11('0x5e')]['id']}})[_0x1a11('0x29')](function(_0x4aa90b){if(_0x4aa90b){return db[_0x1a11('0x4d')][_0x1a11('0x4e')](function(_0x15f4b8){return _0x4aa90b[_0x1a11('0x2b')]({'transaction':_0x15f4b8,'raw':!![]})[_0x1a11('0x29')](function(_0x33a4e3){if(_0x33a4e3[_0x1a11('0x51')]){fs[_0x1a11('0x5f')](_0x33a4e3[_0x1a11('0x51')])[_0x1a11('0x60')](function(_0x4f54d9){fs[_0x1a11('0x61')](path[_0x1a11('0x52')](_0x33a4e3[_0x1a11('0x51')],_0x4f54d9));});fs[_0x1a11('0x62')](_0x33a4e3[_0x1a11('0x51')]);}return _0x33a4e3;});})['catch'](function(_0x43cdfd){throw new db[(_0x1a11('0x63'))][(_0x1a11('0x64'))](_0x43cdfd[_0x1a11('0x65')]);});}})[_0x1a11('0x29')](handleEntityNotFound(_0x16654f,null))[_0x1a11('0x29')](removeEntity(_0x16654f,null))[_0x1a11('0x49')](handleError(_0x16654f,null));};exports[_0x1a11('0x66')]=function(_0x83893e,_0x3fe3f1,_0x5d6a9b){return db[_0x1a11('0x4d')][_0x1a11('0x4e')](function(_0x5173a9){var _0x590a78;return db[_0x1a11('0x32')][_0x1a11('0x4b')]({'where':{'id':_0x83893e[_0x1a11('0x5e')]['id']}})['then'](function(_0xd55181){if(_0xd55181){_0x590a78=_0xd55181;return _0xd55181[_0x1a11('0x66')](_0x83893e[_0x1a11('0x4a')]['id'],{'transaction':_0x5173a9});}})[_0x1a11('0x29')](function(_0x43904b){if(_0x43904b){return db[_0x1a11('0x67')][_0x1a11('0x68')]({'where':{'id':_0x83893e[_0x1a11('0x4a')]['id']},'attributes':['id',_0x1a11('0x2e'),_0x1a11('0x69'),_0x1a11('0x6a'),_0x1a11('0x6b')],'raw':!![]});}})[_0x1a11('0x29')](function(_0x5c9090){if(_0x5c9090){var _0x28604a=path['join'](config[_0x1a11('0x53')],_0x1a11('0x6c'),util[_0x1a11('0x6d')](_0x1a11('0x6e'),path['basename'](_0x5c9090[_0x1a11('0x69')],path[_0x1a11('0x6f')](_0x5c9090[_0x1a11('0x69')])),_0x5c9090[_0x1a11('0x6a')]));var _0x5c5651=path[_0x1a11('0x52')](config[_0x1a11('0x53')],'server/files/moh',_0x590a78[_0x1a11('0x2e')],util[_0x1a11('0x6d')](_0x1a11('0x6e'),_0x5c9090['name'],_0x5c9090['converted_format']));fs[_0x1a11('0x70')](_0x28604a,_0x5c5651);return _0x5c9090;}})[_0x1a11('0x49')](function(_0x227bcd){throw new db[(_0x1a11('0x63'))][(_0x1a11('0x64'))](_0x227bcd[_0x1a11('0x65')]);});})[_0x1a11('0x29')](handleEntityNotFound(_0x3fe3f1,null))[_0x1a11('0x29')](respondWithResult(_0x3fe3f1,0xc9))[_0x1a11('0x49')](handleError(_0x3fe3f1,null));};exports['removeSound']=function(_0x34e1bc,_0x26ea2e,_0x240848){return db[_0x1a11('0x4d')][_0x1a11('0x4e')](function(_0x4f6508){var _0x4bda1e;return db[_0x1a11('0x32')]['findOne']({'where':{'id':_0x34e1bc['params']['id']}})[_0x1a11('0x29')](handleEntityNotFound(_0x26ea2e,null))[_0x1a11('0x29')](function(_0x284b2a){if(_0x284b2a){_0x4bda1e=_0x284b2a;return _0x284b2a[_0x1a11('0x71')](_0x34e1bc[_0x1a11('0x5e')][_0x1a11('0x72')]);}})['then'](function(_0x5bf3a3){if(_0x5bf3a3){return db[_0x1a11('0x67')]['findOne']({'where':{'id':_0x34e1bc['params'][_0x1a11('0x72')]},'attributes':['id',_0x1a11('0x2e'),_0x1a11('0x69'),_0x1a11('0x6a'),'createdAt'],'raw':!![]});}})[_0x1a11('0x29')](function(_0x2ff790){if(_0x2ff790){fs[_0x1a11('0x61')](path['join'](_0x4bda1e['directory'],util['format'](_0x1a11('0x6e'),_0x2ff790[_0x1a11('0x2e')],_0x2ff790['converted_format'])));return _0x2ff790;}})['catch'](function(_0x39d0f1){throw new db[(_0x1a11('0x63'))][(_0x1a11('0x64'))](_0x39d0f1[_0x1a11('0x65')]);});})[_0x1a11('0x29')](handleEntityNotFound(_0x26ea2e,null))[_0x1a11('0x29')](respondWithStatusCode(_0x26ea2e,0xcc))[_0x1a11('0x49')](handleError(_0x26ea2e,null));};exports[_0x1a11('0x73')]=function(_0x2fa654,_0x47f7d0,_0x47837e){var _0x34c1e0={};var _0x1369b4={};var _0x2e04d8;var _0x24a15b;return db[_0x1a11('0x32')][_0x1a11('0x68')]({'where':{'id':_0x2fa654[_0x1a11('0x5e')]['id']}})[_0x1a11('0x29')](handleEntityNotFound(_0x47f7d0,null))['then'](function(_0x2376b8){if(_0x2376b8){_0x2e04d8=_0x2376b8;_0x1369b4[_0x1a11('0x36')]=_[_0x1a11('0x37')](db[_0x1a11('0x67')][_0x1a11('0x33')]);_0x1369b4[_0x1a11('0x38')]=_['keys'](_0x2fa654[_0x1a11('0x38')]);_0x1369b4['filters']=_[_0x1a11('0x3a')](_0x1369b4[_0x1a11('0x36')],_0x1369b4['query']);_0x34c1e0[_0x1a11('0x3b')]=_[_0x1a11('0x3a')](_0x1369b4['model'],qs[_0x1a11('0x3c')](_0x2fa654['query']['fields']));_0x34c1e0[_0x1a11('0x3b')]=_0x34c1e0['attributes'][_0x1a11('0x3d')]?_0x34c1e0[_0x1a11('0x3b')]:_0x1369b4['model'];_0x34c1e0[_0x1a11('0x40')]=qs[_0x1a11('0x41')](_0x2fa654[_0x1a11('0x38')][_0x1a11('0x41')]);_0x34c1e0['where']=qs[_0x1a11('0x39')](_[_0x1a11('0x74')](_0x2fa654[_0x1a11('0x38')],_0x1369b4['filters']));if(_0x2fa654[_0x1a11('0x38')]['filter']){_0x34c1e0[_0x1a11('0x42')]=_[_0x1a11('0x44')](_0x34c1e0[_0x1a11('0x42')],{'$or':_[_0x1a11('0x31')](_0x34c1e0[_0x1a11('0x3b')],function(_0x2dfb0a){var _0x1db8a7={};_0x1db8a7[_0x2dfb0a]={'$like':'%'+_0x2fa654['query']['filter']+'%'};return _0x1db8a7;})});}_0x34c1e0=_[_0x1a11('0x44')]({},_0x34c1e0,_0x2fa654['options']);return _0x2e04d8[_0x1a11('0x73')](_0x34c1e0);}})[_0x1a11('0x29')](function(_0x2d4c2c){if(_0x2d4c2c){_0x24a15b=_0x2d4c2c[_0x1a11('0x3d')];if(!_0x2fa654[_0x1a11('0x38')][_0x1a11('0x3e')](_0x1a11('0x3f'))){_0x34c1e0[_0x1a11('0x1f')]=qs[_0x1a11('0x1f')](_0x2fa654[_0x1a11('0x38')][_0x1a11('0x1f')]);_0x34c1e0[_0x1a11('0x21')]=qs[_0x1a11('0x21')](_0x2fa654[_0x1a11('0x38')]['offset']);}return _0x2e04d8['getSounds'](_0x34c1e0);}})[_0x1a11('0x29')](function(_0x2d7551){if(_0x2d7551){return _0x2d7551?{'count':_0x24a15b,'rows':_0x2d7551}:null;}})['then'](respondWithResult(_0x47f7d0,null))[_0x1a11('0x49')](handleError(_0x47f7d0,null));}; \ No newline at end of file +var _0xa85b=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','ValidationError','message','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','symlinkSync','Sequelize','removeSound','id2','unlinkSync','order','hasOwnProperty','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','length','find','update','body','params','create','sequelize','transaction','files','join','root','server/files/moh','mode','mkdirSync','directory','0777','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','MusicOnHolds','autoAssociation'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xa85b,0x103));var _0xba85=function(_0x552a60,_0x42d26d){_0x552a60=_0x552a60-0x0;var _0x3730d1=_0xa85b[_0x552a60];return _0x3730d1;};'use strict';var emlformat=require(_0xba85('0x0'));var rimraf=require(_0xba85('0x1'));var zipdir=require(_0xba85('0x2'));var jsonpatch=require(_0xba85('0x3'));var rp=require('request-promise');var moment=require(_0xba85('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xba85('0x5'));var util=require(_0xba85('0x6'));var path=require(_0xba85('0x7'));var sox=require(_0xba85('0x8'));var csv=require('to-csv');var ejs=require(_0xba85('0x9'));var fs=require('fs');var fs_extra=require(_0xba85('0xa'));var _=require(_0xba85('0xb'));var squel=require(_0xba85('0xc'));var crypto=require('crypto');var jsforce=require(_0xba85('0xd'));var deskjs=require(_0xba85('0xe'));var toCsv=require(_0xba85('0xf'));var querystring=require(_0xba85('0x10'));var Papa=require(_0xba85('0x11'));var Redis=require(_0xba85('0x12'));var authService=require(_0xba85('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba85('0x14'));var logger=require(_0xba85('0x15'))('api');var utils=require(_0xba85('0x16'));var config=require(_0xba85('0x17'));var licenseUtil=require(_0xba85('0x18'));var db=require(_0xba85('0x19'))['db'];function respondWithStatusCode(_0xf8cf0,_0x4349ee){_0x4349ee=_0x4349ee||0xcc;return function(_0x4e0dcb){if(_0x4e0dcb){return _0xf8cf0[_0xba85('0x1a')](_0x4349ee);}return _0xf8cf0['status'](_0x4349ee)[_0xba85('0x1b')]();};}function respondWithResult(_0x5c3672,_0x3dee15){_0x3dee15=_0x3dee15||0xc8;return function(_0x118384){if(_0x118384){return _0x5c3672[_0xba85('0x1c')](_0x3dee15)[_0xba85('0x1d')](_0x118384);}};}function respondWithFilteredResult(_0x3957a1,_0x1b31a8){return function(_0x524864){if(_0x524864){var _0x32a2d8=typeof _0x1b31a8[_0xba85('0x1e')]===_0xba85('0x1f')&&typeof _0x1b31a8[_0xba85('0x20')]===_0xba85('0x1f');var _0x3f84ff=_0x524864['count'];var _0x5f42fb=_0x32a2d8?0x0:_0x1b31a8[_0xba85('0x1e')];var _0x2f02ef=_0x32a2d8?_0x524864['count']:_0x1b31a8[_0xba85('0x1e')]+_0x1b31a8['limit'];var _0x2895a7;if(_0x2f02ef>=_0x3f84ff){_0x2f02ef=_0x3f84ff;_0x2895a7=0xc8;}else{_0x2895a7=0xce;}_0x3957a1[_0xba85('0x1c')](_0x2895a7);return _0x3957a1[_0xba85('0x21')](_0xba85('0x22'),_0x5f42fb+'-'+_0x2f02ef+'/'+_0x3f84ff)[_0xba85('0x1d')](_0x524864);}return null;};}function patchUpdates(_0x5e42c4){return function(_0x472e3d){try{jsonpatch[_0xba85('0x23')](_0x472e3d,_0x5e42c4,!![]);}catch(_0x376a03){return BPromise[_0xba85('0x24')](_0x376a03);}return _0x472e3d[_0xba85('0x25')]();};}function saveUpdates(_0x37c8a3,_0x355e9c){return function(_0x3b5866){if(_0x3b5866){return _0x3b5866['update'](_0x37c8a3)[_0xba85('0x26')](function(_0x1d1280){return _0x1d1280;});}return null;};}function removeEntity(_0x27d656,_0xd7ab24){return function(_0xcf454f){if(_0xcf454f){return _0xcf454f[_0xba85('0x27')]()[_0xba85('0x26')](function(){var _0x1382fe=_0xcf454f['get']({'plain':!![]});var _0x4a1572='MusicOnHolds';return db[_0xba85('0x28')][_0xba85('0x27')]({'where':{'type':_0x4a1572,'resourceId':_0x1382fe['id']}})[_0xba85('0x26')](function(){return _0xcf454f;});})[_0xba85('0x26')](function(){_0x27d656[_0xba85('0x1c')](0xcc)[_0xba85('0x1b')]();});}};}function handleEntityNotFound(_0xf962d,_0xef506c){return function(_0x44b3be){if(!_0x44b3be){_0xf962d[_0xba85('0x1a')](0x194);}return _0x44b3be;};}function handleError(_0x1d59a5,_0x252332){_0x252332=_0x252332||0x1f4;return function(_0x41c97e){logger[_0xba85('0x29')](_0x41c97e[_0xba85('0x2a')]);if(_0x41c97e[_0xba85('0x2b')]){delete _0x41c97e[_0xba85('0x2b')];}_0x1d59a5[_0xba85('0x1c')](_0x252332)[_0xba85('0x2c')](_0x41c97e);};}exports[_0xba85('0x2d')]=function(_0x2b1b18,_0x1df8ac){var _0x23bc42={},_0x12a63e={},_0x589a97={'count':0x0,'rows':[]};var _0x2a1ddd=_[_0xba85('0x2e')](db[_0xba85('0x2f')][_0xba85('0x30')],function(_0x176db1){return{'name':_0x176db1[_0xba85('0x31')],'type':_0x176db1[_0xba85('0x32')]['key']};});_0x12a63e[_0xba85('0x33')]=_[_0xba85('0x2e')](_0x2a1ddd,'name');_0x12a63e[_0xba85('0x34')]=_[_0xba85('0x35')](_0x2b1b18[_0xba85('0x34')]);_0x12a63e['filters']=_[_0xba85('0x36')](_0x12a63e[_0xba85('0x33')],_0x12a63e[_0xba85('0x34')]);_0x23bc42[_0xba85('0x37')]=_[_0xba85('0x36')](_0x12a63e['model'],qs[_0xba85('0x38')](_0x2b1b18[_0xba85('0x34')][_0xba85('0x38')]));_0x23bc42[_0xba85('0x37')]=_0x23bc42[_0xba85('0x37')]['length']?_0x23bc42[_0xba85('0x37')]:_0x12a63e[_0xba85('0x33')];if(!_0x2b1b18[_0xba85('0x34')]['hasOwnProperty'](_0xba85('0x39'))){_0x23bc42[_0xba85('0x20')]=qs[_0xba85('0x20')](_0x2b1b18[_0xba85('0x34')]['limit']);_0x23bc42[_0xba85('0x1e')]=qs[_0xba85('0x1e')](_0x2b1b18[_0xba85('0x34')][_0xba85('0x1e')]);}_0x23bc42['order']=qs[_0xba85('0x3a')](_0x2b1b18[_0xba85('0x34')][_0xba85('0x3a')]);delete _0x2b1b18[_0xba85('0x34')][_0xba85('0x3a')];_0x23bc42[_0xba85('0x3b')]=qs[_0xba85('0x3c')](_[_0xba85('0x3d')](_0x2b1b18['query'],_0x12a63e['filters']),_0x2a1ddd);if(_0x2b1b18['query'][_0xba85('0x3e')]){_0x23bc42['where']=_['merge'](_0x23bc42[_0xba85('0x3b')],{'$or':_[_0xba85('0x2e')](_0x2a1ddd,function(_0x40d6fe){if(_0x40d6fe[_0xba85('0x32')]!==_0xba85('0x3f')){var _0x57f435={};_0x57f435[_0x40d6fe['name']]={'$like':'%'+_0x2b1b18[_0xba85('0x34')][_0xba85('0x3e')]+'%'};return _0x57f435;}})});}_0x23bc42=_[_0xba85('0x40')]({},_0x23bc42,_0x2b1b18[_0xba85('0x41')]);var _0x16e418={'where':_0x23bc42[_0xba85('0x3b')]};return db[_0xba85('0x2f')][_0xba85('0x42')](_0x16e418)[_0xba85('0x26')](function(_0x35aadf){_0x589a97[_0xba85('0x42')]=_0x35aadf;if(_0x2b1b18[_0xba85('0x34')][_0xba85('0x43')]){_0x23bc42[_0xba85('0x44')]=[{'all':!![]}];}return db[_0xba85('0x2f')][_0xba85('0x45')](_0x23bc42);})[_0xba85('0x26')](function(_0x25d267){_0x589a97['rows']=_0x25d267;return _0x589a97;})[_0xba85('0x26')](respondWithFilteredResult(_0x1df8ac,_0x23bc42))[_0xba85('0x46')](handleError(_0x1df8ac,null));};exports[_0xba85('0x47')]=function(_0x53ee59,_0x47f568){var _0x4ad17b={'raw':![],'where':{'id':_0x53ee59['params']['id']}},_0x24b797={};_0x24b797[_0xba85('0x33')]=_[_0xba85('0x35')](db[_0xba85('0x2f')]['rawAttributes']);_0x24b797[_0xba85('0x34')]=_[_0xba85('0x35')](_0x53ee59[_0xba85('0x34')]);_0x24b797['filters']=_[_0xba85('0x36')](_0x24b797['model'],_0x24b797[_0xba85('0x34')]);_0x4ad17b['attributes']=_[_0xba85('0x36')](_0x24b797[_0xba85('0x33')],qs[_0xba85('0x38')](_0x53ee59[_0xba85('0x34')][_0xba85('0x38')]));_0x4ad17b[_0xba85('0x37')]=_0x4ad17b[_0xba85('0x37')][_0xba85('0x48')]?_0x4ad17b[_0xba85('0x37')]:_0x24b797[_0xba85('0x33')];if(_0x53ee59['query'][_0xba85('0x43')]){_0x4ad17b[_0xba85('0x44')]=[{'all':!![]}];}_0x4ad17b=_['merge']({},_0x4ad17b,_0x53ee59[_0xba85('0x41')]);return db[_0xba85('0x2f')][_0xba85('0x49')](_0x4ad17b)[_0xba85('0x26')](handleEntityNotFound(_0x47f568,null))[_0xba85('0x26')](respondWithResult(_0x47f568,null))[_0xba85('0x46')](handleError(_0x47f568,null));};exports[_0xba85('0x4a')]=function(_0x4abee4,_0x169a54){if(_0x4abee4[_0xba85('0x4b')]['id']){delete _0x4abee4[_0xba85('0x4b')]['id'];}return db[_0xba85('0x2f')][_0xba85('0x49')]({'where':{'id':_0x4abee4[_0xba85('0x4c')]['id']}})[_0xba85('0x26')](handleEntityNotFound(_0x169a54,null))[_0xba85('0x26')](saveUpdates(_0x4abee4[_0xba85('0x4b')],null))[_0xba85('0x26')](respondWithResult(_0x169a54,null))[_0xba85('0x46')](handleError(_0x169a54,null));};exports[_0xba85('0x4d')]=function(_0x447113,_0x4a3407,_0x54dee3){return db[_0xba85('0x4e')][_0xba85('0x4f')](function(_0x204791){if(_0x447113[_0xba85('0x4b')]['mode']===_0xba85('0x50')){_0x447113[_0xba85('0x4b')]['directory']=path[_0xba85('0x51')](config[_0xba85('0x52')],_0xba85('0x53'),_0x447113[_0xba85('0x4b')][_0xba85('0x2b')]);}return db[_0xba85('0x2f')][_0xba85('0x4d')](_0x447113[_0xba85('0x4b')],{'transaction':_0x204791})[_0xba85('0x26')](function(_0x4d9c09){if(_0x447113[_0xba85('0x4b')][_0xba85('0x54')]===_0xba85('0x50')){fs[_0xba85('0x55')](_0x4d9c09[_0xba85('0x56')],parseInt(_0xba85('0x57'),0x8));}var _0x1571c2=_0x447113['user'][_0xba85('0x58')]({'plain':!![]});if(!_0x1571c2)throw new Error(_0xba85('0x59'));if(_0x1571c2[_0xba85('0x5a')]===_0xba85('0x5b')){var _0x33fe23=_0x4d9c09[_0xba85('0x58')]({'plain':!![]});return db[_0xba85('0x5c')]['find']({'where':{'name':_0xba85('0x5d'),'userProfileId':_0x1571c2['userProfileId']},'raw':!![]})[_0xba85('0x26')](function(_0xc028d){if(_0xc028d&&_0xc028d[_0xba85('0x5e')]===0x0){return db[_0xba85('0x28')][_0xba85('0x4d')]({'name':_0x33fe23[_0xba85('0x2b')],'resourceId':_0x33fe23['id'],'type':_0xc028d[_0xba85('0x2b')],'sectionId':_0xc028d['id']},{})[_0xba85('0x26')](function(){return _0x4d9c09;});}else{return _0x4d9c09;}})[_0xba85('0x46')](function(_0x240b4e){logger[_0xba85('0x29')](_0xba85('0x5f'),_0x240b4e);});}return _0x4d9c09;});})[_0xba85('0x26')](respondWithResult(_0x4a3407,0xc9))['catch'](handleError(_0x4a3407,null));};exports['destroy']=function(_0x4db135,_0x55ed05,_0x54c98e){var _0x35de64;return db[_0xba85('0x2f')]['find']({'where':{'id':_0x4db135['params']['id']}})[_0xba85('0x26')](function(_0x167ee6){if(_0x167ee6){return db[_0xba85('0x4e')]['transaction'](function(_0x178b6e){return _0x167ee6[_0xba85('0x27')]({'transaction':_0x178b6e,'raw':!![]})['then'](function(_0x189b9b){if(_0x189b9b[_0xba85('0x56')]){fs[_0xba85('0x60')](_0x189b9b[_0xba85('0x56')])[_0xba85('0x61')](function(_0x5d89c3){fs['unlinkSync'](path[_0xba85('0x51')](_0x189b9b[_0xba85('0x56')],_0x5d89c3));});fs['rmdirSync'](_0x189b9b[_0xba85('0x56')]);}return _0x189b9b;});})[_0xba85('0x46')](function(_0x24cdcd){throw new db['Sequelize'][(_0xba85('0x62'))](_0x24cdcd[_0xba85('0x63')]);});}})[_0xba85('0x26')](handleEntityNotFound(_0x55ed05,null))[_0xba85('0x26')](removeEntity(_0x55ed05,null))[_0xba85('0x46')](handleError(_0x55ed05,null));};exports['addSound']=function(_0xb64829,_0x50ade3,_0x23e348){return db[_0xba85('0x4e')][_0xba85('0x4f')](function(_0x156b7f){var _0x46922b;return db['VoiceMusicOnHold'][_0xba85('0x49')]({'where':{'id':_0xb64829[_0xba85('0x4c')]['id']}})[_0xba85('0x26')](function(_0x40e838){if(_0x40e838){_0x46922b=_0x40e838;return _0x40e838[_0xba85('0x64')](_0xb64829['body']['id'],{'transaction':_0x156b7f});}})['then'](function(_0x38bf76){if(_0x38bf76){return db[_0xba85('0x65')][_0xba85('0x66')]({'where':{'id':_0xb64829[_0xba85('0x4b')]['id']},'attributes':['id',_0xba85('0x2b'),'save_name',_0xba85('0x67'),_0xba85('0x68')],'raw':!![]});}})[_0xba85('0x26')](function(_0x88af6a){if(_0x88af6a){var _0x1e2cfc=path[_0xba85('0x51')](config['root'],_0xba85('0x69'),util[_0xba85('0x6a')](_0xba85('0x6b'),path[_0xba85('0x6c')](_0x88af6a[_0xba85('0x6d')],path['extname'](_0x88af6a[_0xba85('0x6d')])),_0x88af6a[_0xba85('0x67')]));var _0x46dcc7=path['join'](config[_0xba85('0x52')],_0xba85('0x53'),_0x46922b['name'],util[_0xba85('0x6a')](_0xba85('0x6b'),_0x88af6a['name'],_0x88af6a['converted_format']));fs[_0xba85('0x6e')](_0x1e2cfc,_0x46dcc7);return _0x88af6a;}})['catch'](function(_0x57d585){throw new db[(_0xba85('0x6f'))][(_0xba85('0x62'))](_0x57d585[_0xba85('0x63')]);});})[_0xba85('0x26')](handleEntityNotFound(_0x50ade3,null))[_0xba85('0x26')](respondWithResult(_0x50ade3,0xc9))[_0xba85('0x46')](handleError(_0x50ade3,null));};exports[_0xba85('0x70')]=function(_0x1c5729,_0x48bd91,_0x3bf0b8){return db['sequelize'][_0xba85('0x4f')](function(_0x2e7636){var _0x5c6333;return db['VoiceMusicOnHold'][_0xba85('0x66')]({'where':{'id':_0x1c5729[_0xba85('0x4c')]['id']}})[_0xba85('0x26')](handleEntityNotFound(_0x48bd91,null))[_0xba85('0x26')](function(_0x1a889e){if(_0x1a889e){_0x5c6333=_0x1a889e;return _0x1a889e[_0xba85('0x70')](_0x1c5729[_0xba85('0x4c')]['id2']);}})[_0xba85('0x26')](function(_0x48d864){if(_0x48d864){return db['Sound']['findOne']({'where':{'id':_0x1c5729[_0xba85('0x4c')][_0xba85('0x71')]},'attributes':['id','name',_0xba85('0x6d'),_0xba85('0x67'),_0xba85('0x68')],'raw':!![]});}})[_0xba85('0x26')](function(_0x32166a){if(_0x32166a){fs[_0xba85('0x72')](path['join'](_0x5c6333[_0xba85('0x56')],util['format'](_0xba85('0x6b'),_0x32166a[_0xba85('0x2b')],_0x32166a[_0xba85('0x67')])));return _0x32166a;}})['catch'](function(_0x2ec01c){throw new db['Sequelize'][(_0xba85('0x62'))](_0x2ec01c['message']);});})[_0xba85('0x26')](handleEntityNotFound(_0x48bd91,null))[_0xba85('0x26')](respondWithStatusCode(_0x48bd91,0xcc))[_0xba85('0x46')](handleError(_0x48bd91,null));};exports['getSounds']=function(_0x2012f7,_0x5d7f2a,_0x3e6fd6){var _0x415a79={};var _0x183f20={};var _0x41cba2;var _0x350d28;return db[_0xba85('0x2f')]['findOne']({'where':{'id':_0x2012f7[_0xba85('0x4c')]['id']}})[_0xba85('0x26')](handleEntityNotFound(_0x5d7f2a,null))[_0xba85('0x26')](function(_0x29fbf4){if(_0x29fbf4){_0x41cba2=_0x29fbf4;_0x183f20['model']=_[_0xba85('0x35')](db[_0xba85('0x65')][_0xba85('0x30')]);_0x183f20['query']=_[_0xba85('0x35')](_0x2012f7['query']);_0x183f20['filters']=_[_0xba85('0x36')](_0x183f20['model'],_0x183f20['query']);_0x415a79[_0xba85('0x37')]=_[_0xba85('0x36')](_0x183f20[_0xba85('0x33')],qs[_0xba85('0x38')](_0x2012f7[_0xba85('0x34')][_0xba85('0x38')]));_0x415a79['attributes']=_0x415a79[_0xba85('0x37')][_0xba85('0x48')]?_0x415a79[_0xba85('0x37')]:_0x183f20['model'];_0x415a79[_0xba85('0x73')]=qs[_0xba85('0x3a')](_0x2012f7['query'][_0xba85('0x3a')]);_0x415a79[_0xba85('0x3b')]=qs[_0xba85('0x3c')](_[_0xba85('0x3d')](_0x2012f7[_0xba85('0x34')],_0x183f20[_0xba85('0x3c')]));if(_0x2012f7[_0xba85('0x34')][_0xba85('0x3e')]){_0x415a79[_0xba85('0x3b')]=_[_0xba85('0x40')](_0x415a79[_0xba85('0x3b')],{'$or':_[_0xba85('0x2e')](_0x415a79[_0xba85('0x37')],function(_0x21250b){var _0x4115dd={};_0x4115dd[_0x21250b]={'$like':'%'+_0x2012f7[_0xba85('0x34')][_0xba85('0x3e')]+'%'};return _0x4115dd;})});}_0x415a79=_['merge']({},_0x415a79,_0x2012f7[_0xba85('0x41')]);return _0x41cba2['getSounds'](_0x415a79);}})[_0xba85('0x26')](function(_0x3d13e8){if(_0x3d13e8){_0x350d28=_0x3d13e8[_0xba85('0x48')];if(!_0x2012f7[_0xba85('0x34')][_0xba85('0x74')](_0xba85('0x39'))){_0x415a79[_0xba85('0x20')]=qs[_0xba85('0x20')](_0x2012f7[_0xba85('0x34')]['limit']);_0x415a79[_0xba85('0x1e')]=qs[_0xba85('0x1e')](_0x2012f7[_0xba85('0x34')][_0xba85('0x1e')]);}return _0x41cba2[_0xba85('0x75')](_0x415a79);}})[_0xba85('0x26')](function(_0x572c0b){if(_0x572c0b){return _0x572c0b?{'count':_0x350d28,'rows':_0x572c0b}:null;}})['then'](respondWithResult(_0x5d7f2a,null))['catch'](handleError(_0x5d7f2a,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index dcd5c3c..5953c4a 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 _0x59f7=['voice_musiconhold','api','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define'];(function(_0x533ec4,_0x2070cd){var _0x1ef0c8=function(_0x51e105){while(--_0x51e105){_0x533ec4['push'](_0x533ec4['shift']());}};_0x1ef0c8(++_0x2070cd);}(_0x59f7,0xe1));var _0x759f=function(_0x25c60e,_0x570e08){_0x25c60e=_0x25c60e-0x0;var _0xea58ff=_0x59f7[_0x25c60e];return _0xea58ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x759f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x759f('0x1'));var fs=require('fs');var path=require(_0x759f('0x2'));var rimraf=require(_0x759f('0x3'));var config=require(_0x759f('0x4'));var attributes=require(_0x759f('0x5'));module['exports']=function(_0x223bcf,_0x514f74){return _0x223bcf[_0x759f('0x6')]('VoiceMusicOnHold',attributes,{'tableName':_0x759f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0418=['path','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0418,0xb9));var _0x8041=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0418[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8041('0x0'))(_0x8041('0x1'));var moment=require(_0x8041('0x2'));var BPromise=require(_0x8041('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8041('0x4'));var rimraf=require('rimraf');var config=require(_0x8041('0x5'));var attributes=require(_0x8041('0x6'));module['exports']=function(_0x4bebbe,_0x265b32){return _0x4bebbe[_0x8041('0x7')](_0x8041('0x8'),attributes,{'tableName':'voice_musiconhold','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 166f633..08a0cab 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 _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xc63251,_0x2260d5){var _0x22701f=function(_0x157012){while(--_0x157012){_0xc63251['push'](_0xc63251['shift']());}};_0x22701f(++_0x2260d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x2c1f47,_0x3cbcdf){var _0x24cdab=function(_0x1a154d){while(--_0x1a154d){_0x2c1f47['push'](_0x2c1f47['shift']());}};_0x24cdab(++_0x3cbcdf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0xcb91[_0x498334];return _0x13bb70;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index d8f5636..cd7f99b 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 _0xf7ed=['/:id/teams','getTeams','post','create','addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/users','getAgents'];(function(_0x18b023,_0x5e2621){var _0x3b664e=function(_0x34ef4a){while(--_0x34ef4a){_0x18b023['push'](_0x18b023['shift']());}};_0x3b664e(++_0x5e2621);}(_0xf7ed,0x1a1));var _0xdf7e=function(_0x3a980f,_0x49e4d6){_0x3a980f=_0x3a980f-0x0;var _0x36010f=_0xf7ed[_0x3a980f];return _0x36010f;};'use strict';var multer=require('multer');var util=require(_0xdf7e('0x0'));var path=require(_0xdf7e('0x1'));var timeout=require('connect-timeout');var express=require(_0xdf7e('0x2'));var router=express[_0xdf7e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdf7e('0x4'));var interaction=require(_0xdf7e('0x5'));var config=require('../../config/environment');var controller=require(_0xdf7e('0x6'));router[_0xdf7e('0x7')]('/',auth[_0xdf7e('0x8')](),controller['index']);router[_0xdf7e('0x7')](_0xdf7e('0x9'),auth[_0xdf7e('0x8')](),controller[_0xdf7e('0xa')]);router['get'](_0xdf7e('0xb'),auth[_0xdf7e('0x8')](),controller[_0xdf7e('0xc')]);router[_0xdf7e('0x7')](_0xdf7e('0xd'),auth[_0xdf7e('0x8')](),controller[_0xdf7e('0xe')]);router[_0xdf7e('0x7')](_0xdf7e('0xf'),auth[_0xdf7e('0x8')](),controller[_0xdf7e('0x10')]);router[_0xdf7e('0x11')]('/',auth[_0xdf7e('0x8')](),controller[_0xdf7e('0x12')]);router[_0xdf7e('0x11')]('/:id/users',auth[_0xdf7e('0x8')](),controller['addAgents']);router[_0xdf7e('0x11')](_0xdf7e('0xf'),auth['isAuthenticated'](),controller[_0xdf7e('0x13')]);router[_0xdf7e('0x14')](_0xdf7e('0xb'),auth['isAuthenticated'](),controller[_0xdf7e('0x15')]);router[_0xdf7e('0x16')](_0xdf7e('0xb'),auth[_0xdf7e('0x8')](),controller[_0xdf7e('0x17')]);router[_0xdf7e('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xdf7e('0x18')]);router[_0xdf7e('0x16')](_0xdf7e('0xf'),auth['isAuthenticated'](),controller[_0xdf7e('0x19')]);module[_0xdf7e('0x1a')]=router; \ No newline at end of file +var _0xebec=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','/:id/teams','getTeams','post','create','addAgents','addTeams','put','delete','removeAgents','removeTeams'];(function(_0x4f75ca,_0x2f2e8f){var _0x54bb5f=function(_0x48ddbf){while(--_0x48ddbf){_0x4f75ca['push'](_0x4f75ca['shift']());}};_0x54bb5f(++_0x2f2e8f);}(_0xebec,0x135));var _0xcebe=function(_0x1a4ad1,_0x4df6a5){_0x1a4ad1=_0x1a4ad1-0x0;var _0x32b225=_0xebec[_0x1a4ad1];return _0x32b225;};'use strict';var multer=require(_0xcebe('0x0'));var util=require(_0xcebe('0x1'));var path=require(_0xcebe('0x2'));var timeout=require('connect-timeout');var express=require(_0xcebe('0x3'));var router=express[_0xcebe('0x4')]();var fs_extra=require(_0xcebe('0x5'));var auth=require(_0xcebe('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcebe('0x7'));var controller=require(_0xcebe('0x8'));router[_0xcebe('0x9')]('/',auth[_0xcebe('0xa')](),controller[_0xcebe('0xb')]);router[_0xcebe('0x9')](_0xcebe('0xc'),auth[_0xcebe('0xa')](),controller[_0xcebe('0xd')]);router['get'](_0xcebe('0xe'),auth[_0xcebe('0xa')](),controller[_0xcebe('0xf')]);router[_0xcebe('0x9')](_0xcebe('0x10'),auth[_0xcebe('0xa')](),controller['getAgents']);router[_0xcebe('0x9')](_0xcebe('0x11'),auth[_0xcebe('0xa')](),controller[_0xcebe('0x12')]);router[_0xcebe('0x13')]('/',auth[_0xcebe('0xa')](),controller[_0xcebe('0x14')]);router[_0xcebe('0x13')](_0xcebe('0x10'),auth['isAuthenticated'](),controller[_0xcebe('0x15')]);router[_0xcebe('0x13')](_0xcebe('0x11'),auth[_0xcebe('0xa')](),controller[_0xcebe('0x16')]);router[_0xcebe('0x17')](_0xcebe('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xcebe('0x18')](_0xcebe('0xe'),auth[_0xcebe('0xa')](),controller['destroy']);router['delete']('/:id/users',auth[_0xcebe('0xa')](),controller[_0xcebe('0x19')]);router['delete']('/:id/teams',auth[_0xcebe('0xa')](),controller[_0xcebe('0x1a')]);module[_0xcebe('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 38908be..1ea9509 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 _0xabe2=['STRING','name','system-','getDataValue','INTEGER','sequelize','exports'];(function(_0x450df4,_0x4c0f66){var _0x250d62=function(_0x2d901d){while(--_0x2d901d){_0x450df4['push'](_0x450df4['shift']());}};_0x250d62(++_0x4c0f66);}(_0xabe2,0x147));var _0x2abe=function(_0x471493,_0x2d67da){_0x471493=_0x471493-0x0;var _0x1a5e4f=_0xabe2[_0x471493];return _0x1a5e4f;};'use strict';var Sequelize=require(_0x2abe('0x0'));module[_0x2abe('0x1')]={'name':{'type':Sequelize[_0x2abe('0x2')],'allowNull':![],'unique':_0x2abe('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x1b6099){return _0x2abe('0x4')+this[_0x2abe('0x5')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x2abe('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x2abe('0x6')]}}; \ No newline at end of file +var _0x9b6e=['name','system-','getDataValue','STRING','exports'];(function(_0x173a20,_0x57570f){var _0x1177f2=function(_0x305dbf){while(--_0x305dbf){_0x173a20['push'](_0x173a20['shift']());}};_0x1177f2(++_0x57570f);}(_0x9b6e,0x144));var _0xe9b6=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9b6e[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require('sequelize');module[_0xe9b6('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe9b6('0x1')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x4dd42d){return _0xe9b6('0x2')+this[_0xe9b6('0x3')](_0xe9b6('0x1'))+'-';}},'description':{'type':Sequelize[_0xe9b6('0x4')]},'callerIdAll':{'type':Sequelize[_0xe9b6('0x4')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 510092f..619208f 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 _0x58a4=['addAgents','omit','ids','spread','userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','getAgents','getTeams','Team','User','Agents','online','voicePause','interface','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','show','params','keys','include','find','catch','describe','create','sequelize','transaction','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','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','VoiceExtension','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','body','system-','findById'];(function(_0x427572,_0x1d89f2){var _0x585590=function(_0x1699da){while(--_0x1699da){_0x427572['push'](_0x427572['shift']());}};_0x585590(++_0x1d89f2);}(_0x58a4,0xbf));var _0x458a=function(_0x97385e,_0x17e853){_0x97385e=_0x97385e-0x0;var _0x5d337e=_0x58a4[_0x97385e];return _0x5d337e;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];config[_0x458a('0x1a')]=_[_0x458a('0x1b')](config[_0x458a('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x458a('0x1a')]));require('./voicePrefix.socket')[_0x458a('0x1c')](socket);function respondWithStatusCode(_0x44f683,_0x10133b){_0x10133b=_0x10133b||0xcc;return function(_0x3b74f9){if(_0x3b74f9){return _0x44f683[_0x458a('0x1d')](_0x10133b);}return _0x44f683[_0x458a('0x1e')](_0x10133b)['end']();};}function respondWithResult(_0x4b26be,_0x5c7993){_0x5c7993=_0x5c7993||0xc8;return function(_0x2faf6a){if(_0x2faf6a){return _0x4b26be[_0x458a('0x1e')](_0x5c7993)[_0x458a('0x1f')](_0x2faf6a);}};}function respondWithFilteredResult(_0x5c5b41,_0x310569){return function(_0x260c87){if(_0x260c87){var _0x18504d=typeof _0x310569[_0x458a('0x20')]===_0x458a('0x21')&&typeof _0x310569['limit']==='undefined';var _0x178db9=_0x260c87['count'];var _0x3302b7=_0x18504d?0x0:_0x310569[_0x458a('0x20')];var _0x47a202=_0x18504d?_0x260c87[_0x458a('0x22')]:_0x310569['offset']+_0x310569[_0x458a('0x23')];var _0x1c79cb;if(_0x47a202>=_0x178db9){_0x47a202=_0x178db9;_0x1c79cb=0xc8;}else{_0x1c79cb=0xce;}_0x5c5b41['status'](_0x1c79cb);return _0x5c5b41[_0x458a('0x24')](_0x458a('0x25'),_0x3302b7+'-'+_0x47a202+'/'+_0x178db9)['json'](_0x260c87);}return null;};}function patchUpdates(_0xa6b8ff){return function(_0x5ad95a){try{jsonpatch[_0x458a('0x26')](_0x5ad95a,_0xa6b8ff,!![]);}catch(_0x5bca42){return BPromise[_0x458a('0x27')](_0x5bca42);}return _0x5ad95a['save']();};}function saveUpdates(_0x36b08e,_0x911eaf){return function(_0xcb0756){if(_0xcb0756){return _0xcb0756[_0x458a('0x28')](_0x36b08e)[_0x458a('0x29')](function(_0x19bd5){return _0x19bd5;});}return null;};}function removeEntity(_0x340375,_0x3012c7){return function(_0x1f2d0){if(_0x1f2d0){return _0x1f2d0[_0x458a('0x2a')]()[_0x458a('0x29')](function(){var _0x327fcb=_0x1f2d0[_0x458a('0x2b')]({'plain':!![]});var _0x5a55b7=_0x458a('0x2c');return db[_0x458a('0x2d')]['destroy']({'where':{'type':_0x5a55b7,'resourceId':_0x327fcb['id']}})['then'](function(){return _0x1f2d0;});})[_0x458a('0x29')](function(){_0x340375['status'](0xcc)[_0x458a('0x2e')]();});}};}function handleEntityNotFound(_0x29f9b5,_0x223f73){return function(_0x4a49e4){if(!_0x4a49e4){_0x29f9b5[_0x458a('0x1d')](0x194);}return _0x4a49e4;};}function handleError(_0x2531f7,_0x1426a8){_0x1426a8=_0x1426a8||0x1f4;return function(_0x562c36){logger['error'](_0x562c36[_0x458a('0x2f')]);if(_0x562c36['name']){delete _0x562c36[_0x458a('0x30')];}_0x2531f7['status'](_0x1426a8)[_0x458a('0x31')](_0x562c36);};}exports[_0x458a('0x32')]=function(_0x492843,_0x309a6a){var _0x269f53={},_0x625ae3={},_0x525caf={'count':0x0,'rows':[]};var _0x3371c3=_[_0x458a('0x33')](db[_0x458a('0x34')][_0x458a('0x35')],function(_0x5267fe){return{'name':_0x5267fe['fieldName'],'type':_0x5267fe[_0x458a('0x36')][_0x458a('0x37')]};});_0x625ae3[_0x458a('0x38')]=_[_0x458a('0x33')](_0x3371c3,_0x458a('0x30'));_0x625ae3[_0x458a('0x39')]=_['keys'](_0x492843[_0x458a('0x39')]);_0x625ae3[_0x458a('0x3a')]=_[_0x458a('0x3b')](_0x625ae3[_0x458a('0x38')],_0x625ae3[_0x458a('0x39')]);_0x269f53[_0x458a('0x3c')]=_[_0x458a('0x3b')](_0x625ae3[_0x458a('0x38')],qs[_0x458a('0x3d')](_0x492843['query'][_0x458a('0x3d')]));_0x269f53[_0x458a('0x3c')]=_0x269f53[_0x458a('0x3c')][_0x458a('0x3e')]?_0x269f53[_0x458a('0x3c')]:_0x625ae3[_0x458a('0x38')];if(!_0x492843[_0x458a('0x39')][_0x458a('0x3f')](_0x458a('0x40'))){_0x269f53[_0x458a('0x23')]=qs[_0x458a('0x23')](_0x492843[_0x458a('0x39')][_0x458a('0x23')]);_0x269f53[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x492843['query'][_0x458a('0x20')]);}_0x269f53[_0x458a('0x41')]=qs[_0x458a('0x42')](_0x492843[_0x458a('0x39')][_0x458a('0x42')]);_0x269f53[_0x458a('0x43')]=qs[_0x458a('0x3a')](_[_0x458a('0x44')](_0x492843[_0x458a('0x39')],_0x625ae3[_0x458a('0x3a')]),_0x3371c3);if(_0x492843[_0x458a('0x39')]['filter']){_0x269f53[_0x458a('0x43')]=_[_0x458a('0x45')](_0x269f53['where'],{'$or':_[_0x458a('0x33')](_0x3371c3,function(_0x422b45){if(_0x422b45[_0x458a('0x36')]!=='VIRTUAL'){var _0x406312={};_0x406312[_0x422b45[_0x458a('0x30')]]={'$like':'%'+_0x492843[_0x458a('0x39')][_0x458a('0x46')]+'%'};return _0x406312;}})});}_0x269f53=_[_0x458a('0x45')]({},_0x269f53,_0x492843[_0x458a('0x47')]);var _0x21d2d4={'where':_0x269f53[_0x458a('0x43')]};return db['VoicePrefix'][_0x458a('0x22')](_0x21d2d4)[_0x458a('0x29')](function(_0x2b9030){_0x525caf['count']=_0x2b9030;if(_0x492843[_0x458a('0x39')][_0x458a('0x48')]){_0x269f53['include']=[{'all':!![]}];}return db[_0x458a('0x34')][_0x458a('0x49')](_0x269f53);})[_0x458a('0x29')](function(_0x36c391){_0x525caf[_0x458a('0x4a')]=_0x36c391;return _0x525caf;})['then'](respondWithFilteredResult(_0x309a6a,_0x269f53))['catch'](handleError(_0x309a6a,null));};exports[_0x458a('0x4b')]=function(_0x301e61,_0x33a31d){var _0x18e4e2={'raw':![],'where':{'id':_0x301e61[_0x458a('0x4c')]['id']}},_0x5afd24={};_0x5afd24[_0x458a('0x38')]=_['keys'](db[_0x458a('0x34')]['rawAttributes']);_0x5afd24[_0x458a('0x39')]=_[_0x458a('0x4d')](_0x301e61[_0x458a('0x39')]);_0x5afd24['filters']=_[_0x458a('0x3b')](_0x5afd24[_0x458a('0x38')],_0x5afd24[_0x458a('0x39')]);_0x18e4e2['attributes']=_['intersection'](_0x5afd24[_0x458a('0x38')],qs[_0x458a('0x3d')](_0x301e61[_0x458a('0x39')]['fields']));_0x18e4e2['attributes']=_0x18e4e2[_0x458a('0x3c')][_0x458a('0x3e')]?_0x18e4e2[_0x458a('0x3c')]:_0x5afd24[_0x458a('0x38')];if(_0x301e61[_0x458a('0x39')][_0x458a('0x48')]){_0x18e4e2[_0x458a('0x4e')]=[{'all':!![]}];}_0x18e4e2=_[_0x458a('0x45')]({},_0x18e4e2,_0x301e61[_0x458a('0x47')]);return db[_0x458a('0x34')][_0x458a('0x4f')](_0x18e4e2)[_0x458a('0x29')](handleEntityNotFound(_0x33a31d,null))[_0x458a('0x29')](respondWithResult(_0x33a31d,null))[_0x458a('0x50')](handleError(_0x33a31d,null));};exports[_0x458a('0x2a')]=function(_0x25b44c,_0x51669b){return db[_0x458a('0x34')][_0x458a('0x4f')]({'where':{'id':_0x25b44c[_0x458a('0x4c')]['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x51669b,null))[_0x458a('0x29')](removeEntity(_0x51669b,null))['catch'](handleError(_0x51669b,null));};exports['describe']=function(_0x514d82,_0x2abf75){return db['VoicePrefix'][_0x458a('0x51')]()[_0x458a('0x29')](respondWithResult(_0x2abf75,null))[_0x458a('0x50')](handleError(_0x2abf75,null));};exports[_0x458a('0x52')]=function(_0xfa6e65,_0x5f0151){var _0x48f68e;return db[_0x458a('0x53')][_0x458a('0x54')](function(_0x2587a1){return db[_0x458a('0x34')][_0x458a('0x52')](_0xfa6e65['body'],{'transaction':_0x2587a1})[_0x458a('0x29')](function(_0x4eed01){_0x48f68e=_0x4eed01[_0x458a('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0x458a('0x4f')]({'where':{'id':_0x48f68e['VoiceExtensionId']},'raw':!![]})['then'](function(_0x4b9928){return createVoicePrefixExtensions(_0x48f68e,_0x4b9928,_0x2587a1);});});})[_0x458a('0x29')](function(){var _0x3eb267=_0xfa6e65['user'][_0x458a('0x2b')]({'plain':!![]});if(!_0x3eb267)throw new Error(_0x458a('0x55'));if(_0x3eb267[_0x458a('0x56')]==='user'){var _0x2c1230=_0x48f68e;return db[_0x458a('0x57')][_0x458a('0x4f')]({'where':{'name':_0x458a('0x2c'),'userProfileId':_0x3eb267[_0x458a('0x58')]},'raw':!![]})[_0x458a('0x29')](function(_0x597e74){if(_0x597e74&&_0x597e74[_0x458a('0x59')]===0x0){return db[_0x458a('0x2d')][_0x458a('0x52')]({'name':_0x2c1230[_0x458a('0x30')],'resourceId':_0x2c1230['id'],'type':_0x597e74[_0x458a('0x30')],'sectionId':_0x597e74['id']},{})[_0x458a('0x29')](function(){return _0x48f68e;});}else{return _0x48f68e;}})[_0x458a('0x50')](function(_0x3b6cf9){logger['error'](_0x458a('0x5a'),_0x3b6cf9);throw _0x3b6cf9;});}return _0x48f68e;})['then'](respondWithResult(_0x5f0151,null))[_0x458a('0x50')](handleError(_0x5f0151,null));};function Extension(_0x2921ba,_0x222aa4,_0x42b748,_0x4da240){this['context']=_0x458a('0x5b');this[_0x458a('0x5c')]=_0x2921ba;this[_0x458a('0x5d')]=_0x42b748;this[_0x458a('0x36')]=_0x458a('0x5e');this[_0x458a('0x5f')]='Voice\x20Prefix\x20Extension';this[_0x458a('0x60')]=_0x222aa4;this[_0x458a('0x61')]=_0x4da240;}function createVoicePrefixExtensions(_0x4f6913,_0x18d83a,_0x47b334){return new BPromise(function(_0x425a0f,_0x338127){var _0xa37d44=new Extension(formatPrefixName(_0x4f6913[_0x458a('0x62')]),0x1,_0x458a('0x63'),_0x458a('0x64'));_0xa37d44[_0x458a('0x65')]=_0x4f6913['id'];return db[_0x458a('0x66')]['create'](_0xa37d44,{'transaction':_0x47b334})[_0x458a('0x29')](function(_0x3ed05d){var _0x5d41a2=_0x3ed05d[_0x458a('0x2b')]({'plain':!![]});var _0x3da617=_['map'](addVoicePrefixExtensions(_0x4f6913,_0x18d83a),function(_0xaf7b50){_0xaf7b50[_0x458a('0x67')]=_0x5d41a2['id'];_0xaf7b50['VoicePrefixId']=_0x4f6913['id'];return _0xaf7b50;});return db[_0x458a('0x66')][_0x458a('0x68')](_0x3da617,{'transaction':_0x47b334})['then'](function(_0x16f82f){if(!_0x16f82f){return _0x338127(_0x458a('0x69'));}else{return _0x425a0f(_0x16f82f);}})[_0x458a('0x50')](function(_0x404d93){return _0x338127(_0x404d93);});});;});};function addVoicePrefixExtensions(_0x541375,_0x27d1f2){var _0x4199a7=[];var _0x397595=formatPrefixName(_0x541375['prefix']);_0x4199a7[_0x458a('0x6a')](new Extension(_0x397595,0x2,_0x458a('0x6b'),_0x458a('0x6c')+_0x541375[_0x458a('0x30')]));if(_0x541375[_0x458a('0x6d')]){_0x4199a7[_0x458a('0x6a')](new Extension(_0x397595,0x3,_0x458a('0x6b'),_0x458a('0x6e')+_0x541375[_0x458a('0x6d')]));}else{_0x4199a7[_0x458a('0x6a')](new Extension(_0x397595,0x3,'NoOp',_0x458a('0x6f')));}_0x4199a7['push'](new Extension(_0x397595,0x4,_0x458a('0x70'),_0x27d1f2[_0x458a('0x71')]+','+_0x458a('0x72')+(0x8+_0x541375[_0x458a('0x30')][_0x458a('0x3e')])+'}'+','+0x1));return _0x4199a7;}function formatPrefixName(_0x3d1d37){var _0x2c6a00='_';for(var _0x3745d5=0x0;_0x3745d5<_0x3d1d37[_0x458a('0x3e')];_0x3745d5++){if(_0x3d1d37[_0x458a('0x73')](_0x3745d5)=='-'){_0x2c6a00+=_0x3d1d37[_0x458a('0x73')](_0x3745d5);}else{_0x2c6a00+='['+_0x3d1d37[_0x458a('0x73')](_0x3745d5)+']';}}_0x2c6a00+='.';return _0x2c6a00;}exports[_0x458a('0x28')]=function(_0x435884,_0x3948aa,_0x2c131b){var _0x4c426a=_0x435884[_0x458a('0x74')];_0x4c426a['prefix']=_0x458a('0x75')+_0x4c426a[_0x458a('0x30')]+'-';return db['sequelize'][_0x458a('0x54')](function(_0xb028b3){return db[_0x458a('0x34')]['update'](_0x4c426a,{'where':{'id':_0x4c426a['id']},'transaction':_0xb028b3})[_0x458a('0x29')](function(){return db[_0x458a('0x66')][_0x458a('0x2a')]({'where':{'VoicePrefixId':_0x4c426a['id']},'transaction':_0xb028b3})[_0x458a('0x29')](function(){return db[_0x458a('0x66')][_0x458a('0x4f')]({'where':{'id':_0x4c426a['VoiceExtensionId']},'raw':!![]})[_0x458a('0x29')](function(_0x54abb1){return createVoicePrefixExtensions(_0x4c426a,_0x54abb1,_0xb028b3);});});});})['then'](function(){return db[_0x458a('0x34')][_0x458a('0x76')](_0x4c426a['id']);})[_0x458a('0x29')](respondWithResult(_0x3948aa,null))[_0x458a('0x50')](handleError(_0x3948aa,null));};exports[_0x458a('0x77')]=function(_0x434d04,_0x42eae7,_0x5aee0d){return db[_0x458a('0x34')][_0x458a('0x4f')]({'where':{'id':_0x434d04[_0x458a('0x4c')]['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x42eae7,null))[_0x458a('0x29')](function(_0x17398f){if(_0x17398f){return _0x17398f['addAgents'](_0x434d04['body']['ids'],_[_0x458a('0x78')](_0x434d04['body'],[_0x458a('0x79'),'id'])||{})[_0x458a('0x7a')](function(_0x46ef02){for(var _0x3d73d1=0x0;_0x3d73d1<_0x434d04[_0x458a('0x74')][_0x458a('0x79')][_0x458a('0x3e')];_0x3d73d1+=0x1){socket['emit'](_0x458a('0x7b'),{'UserId':Number(_0x434d04[_0x458a('0x74')]['ids'][_0x3d73d1]),'VoicePrefixId':Number(_0x434d04[_0x458a('0x4c')]['id'])});}return _0x46ef02;});}})['then'](respondWithResult(_0x42eae7,null))[_0x458a('0x50')](handleError(_0x42eae7,null));};exports['removeAgents']=function(_0x26b3f7,_0x177457,_0xce45b5){return db[_0x458a('0x34')]['find']({'where':{'id':_0x26b3f7[_0x458a('0x4c')]['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x177457,null))[_0x458a('0x29')](function(_0x239e2f){if(_0x239e2f){return _0x239e2f[_0x458a('0x7c')](_0x26b3f7[_0x458a('0x39')][_0x458a('0x79')])[_0x458a('0x29')](function(){if(_['isArray'](_0x26b3f7[_0x458a('0x39')][_0x458a('0x79')])){for(var _0x12e367=0x0;_0x12e367<_0x26b3f7[_0x458a('0x39')]['ids'][_0x458a('0x3e')];_0x12e367+=0x1){socket[_0x458a('0x7d')]('userVoicePrefix:remove',{'UserId':Number(_0x26b3f7[_0x458a('0x39')][_0x458a('0x79')][_0x12e367]),'VoicePrefixId':Number(_0x26b3f7[_0x458a('0x4c')]['id'])});}}else{socket[_0x458a('0x7d')](_0x458a('0x7e'),{'UserId':Number(_0x26b3f7['query'][_0x458a('0x79')]),'VoicePrefixId':Number(_0x26b3f7[_0x458a('0x4c')]['id'])});}});}})[_0x458a('0x29')](respondWithStatusCode(_0x177457,null))[_0x458a('0x50')](handleError(_0x177457,null));};exports[_0x458a('0x7f')]=function(_0x46ac5c,_0x2eecf0,_0x573f46){var _0x1f9925={};var _0x4d3790={};var _0x396af9;var _0x36e650;return db[_0x458a('0x34')]['findOne']({'where':{'id':_0x46ac5c[_0x458a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2eecf0,null))['then'](function(_0x2574a3){if(_0x2574a3){_0x396af9=_0x2574a3;_0x4d3790[_0x458a('0x38')]=_['keys'](db['User'][_0x458a('0x35')]);_0x4d3790[_0x458a('0x39')]=_[_0x458a('0x4d')](_0x46ac5c[_0x458a('0x39')]);_0x4d3790[_0x458a('0x3a')]=_['intersection'](_0x4d3790[_0x458a('0x38')],_0x4d3790['query']);_0x1f9925[_0x458a('0x3c')]=_[_0x458a('0x3b')](_0x4d3790[_0x458a('0x38')],qs['fields'](_0x46ac5c[_0x458a('0x39')][_0x458a('0x3d')]));_0x1f9925['attributes']=_0x1f9925[_0x458a('0x3c')]['length']?_0x1f9925[_0x458a('0x3c')]:_0x4d3790[_0x458a('0x38')];_0x1f9925[_0x458a('0x41')]=qs[_0x458a('0x42')](_0x46ac5c['query'][_0x458a('0x42')]);_0x1f9925['where']=qs['filters'](_[_0x458a('0x44')](_0x46ac5c[_0x458a('0x39')],_0x4d3790[_0x458a('0x3a')]));if(_0x46ac5c[_0x458a('0x39')][_0x458a('0x46')]){_0x1f9925[_0x458a('0x43')]=_['merge'](_0x1f9925[_0x458a('0x43')],{'$or':_[_0x458a('0x33')](_0x1f9925[_0x458a('0x3c')],function(_0x222dcb){var _0x17099e={};_0x17099e[_0x222dcb]={'$like':'%'+_0x46ac5c[_0x458a('0x39')]['filter']+'%'};return _0x17099e;})});}_0x1f9925=_[_0x458a('0x45')]({},_0x1f9925,_0x46ac5c[_0x458a('0x47')]);return _0x396af9[_0x458a('0x7f')](_0x1f9925);}})['then'](function(_0x2903c2){if(_0x2903c2){_0x36e650=_0x2903c2[_0x458a('0x3e')];if(!_0x46ac5c[_0x458a('0x39')]['hasOwnProperty']('nolimit')){_0x1f9925[_0x458a('0x23')]=qs['limit'](_0x46ac5c['query']['limit']);_0x1f9925['offset']=qs['offset'](_0x46ac5c[_0x458a('0x39')]['offset']);}return _0x396af9[_0x458a('0x7f')](_0x1f9925);}})[_0x458a('0x29')](function(_0x2adefe){if(_0x2adefe){return _0x2adefe?{'count':_0x36e650,'rows':_0x2adefe}:null;}})[_0x458a('0x29')](respondWithResult(_0x2eecf0,null))[_0x458a('0x50')](handleError(_0x2eecf0,null));};exports[_0x458a('0x80')]=function(_0x555190,_0x11ebe7,_0x59ad9c){var _0x24b1ee={};var _0x4e1d44={};var _0x23428c;var _0x333d74;return db['VoicePrefix']['findOne']({'where':{'id':_0x555190['params']['id']}})[_0x458a('0x29')](handleEntityNotFound(_0x11ebe7,null))[_0x458a('0x29')](function(_0x21d8a9){if(_0x21d8a9){_0x23428c=_0x21d8a9;_0x4e1d44[_0x458a('0x38')]=_[_0x458a('0x4d')](db['Team'][_0x458a('0x35')]);_0x4e1d44[_0x458a('0x39')]=_[_0x458a('0x4d')](_0x555190[_0x458a('0x39')]);_0x4e1d44[_0x458a('0x3a')]=_[_0x458a('0x3b')](_0x4e1d44[_0x458a('0x38')],_0x4e1d44[_0x458a('0x39')]);_0x24b1ee['attributes']=_[_0x458a('0x3b')](_0x4e1d44[_0x458a('0x38')],qs[_0x458a('0x3d')](_0x555190[_0x458a('0x39')][_0x458a('0x3d')]));_0x24b1ee[_0x458a('0x3c')]=_0x24b1ee[_0x458a('0x3c')]['length']?_0x24b1ee['attributes']:_0x4e1d44['model'];_0x24b1ee['order']=qs[_0x458a('0x42')](_0x555190[_0x458a('0x39')][_0x458a('0x42')]);_0x24b1ee[_0x458a('0x43')]=qs['filters'](_[_0x458a('0x44')](_0x555190[_0x458a('0x39')],_0x4e1d44[_0x458a('0x3a')]));if(_0x555190[_0x458a('0x39')]['filter']){_0x24b1ee['where']=_[_0x458a('0x45')](_0x24b1ee[_0x458a('0x43')],{'$or':_[_0x458a('0x33')](_0x24b1ee[_0x458a('0x3c')],function(_0x4ff826){var _0xbb80ab={};_0xbb80ab[_0x4ff826]={'$like':'%'+_0x555190[_0x458a('0x39')][_0x458a('0x46')]+'%'};return _0xbb80ab;})});}_0x24b1ee=_[_0x458a('0x45')]({},_0x24b1ee,_0x555190[_0x458a('0x47')]);return _0x23428c[_0x458a('0x80')](_0x24b1ee);}})[_0x458a('0x29')](function(_0xd05241){if(_0xd05241){_0x333d74=_0xd05241[_0x458a('0x3e')];if(!_0x555190[_0x458a('0x39')]['hasOwnProperty']('nolimit')){_0x24b1ee[_0x458a('0x23')]=qs[_0x458a('0x23')](_0x555190[_0x458a('0x39')][_0x458a('0x23')]);_0x24b1ee[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x555190[_0x458a('0x39')]['offset']);}return _0x23428c[_0x458a('0x80')](_0x24b1ee);}})['then'](function(_0x165b0d){if(_0x165b0d){return _0x165b0d?{'count':_0x333d74,'rows':_0x165b0d}:null;}})[_0x458a('0x29')](respondWithResult(_0x11ebe7,null))[_0x458a('0x50')](handleError(_0x11ebe7,null));};exports['addTeams']=function(_0x589496,_0x4ee34,_0x1c9f4c){var _0x241c72=_0x589496[_0x458a('0x74')][_0x458a('0x79')];var _0x53d065;return db[_0x458a('0x81')][_0x458a('0x49')]({'where':{'id':_0x241c72},'attributes':['id'],'include':[{'model':db[_0x458a('0x82')],'as':_0x458a('0x83'),'attributes':['id',_0x458a('0x30'),_0x458a('0x84'),_0x458a('0x85'),_0x458a('0x86')],'raw':!![]}]})[_0x458a('0x29')](function(_0x52b844){if(_0x52b844){_0x53d065=_0x52b844;var _0x3051d2=_['flatMap'](_0x52b844,function(_0x2e496b){var _0x442b4a=_0x2e496b[_0x458a('0x2b')]({'plain':!![]});return _0x442b4a['Agents'];});return db['VoicePrefix'][_0x458a('0x4f')]({'where':{'id':_0x589496['params']['id']}})[_0x458a('0x29')](function(_0x5d97cc){return db[_0x458a('0x53')][_0x458a('0x54')](function(_0x1b8558){return _0x5d97cc['addTeams'](_0x241c72,{'transaction':_0x1b8558})[_0x458a('0x29')](function(){return BPromise[_0x458a('0x87')](_0x53d065,function(_0x5dbeed){return db[_0x458a('0x88')]['upsert']({'TeamId':_0x5dbeed['id'],'VoicePrefixId':_0x589496[_0x458a('0x4c')]['id']},{'transaction':_0x1b8558});});})[_0x458a('0x29')](function(){return BPromise[_0x458a('0x87')](_0x3051d2,function(_0x49bdfc){return db[_0x458a('0x89')][_0x458a('0x8a')]({'where':{'UserId':_0x49bdfc['id'],'VoicePrefixId':_0x589496[_0x458a('0x4c')]['id']},'transaction':_0x1b8558});});})[_0x458a('0x29')](function(){_0x3051d2[_0x458a('0x8b')](function(_0x477402){socket['emit'](_0x458a('0x7b'),{'UserId':_0x477402['id'],'VoicePrefixId':_0x5d97cc['id']});});});});});}})[_0x458a('0x29')](respondWithStatusCode(_0x4ee34,null))['catch'](handleError(_0x4ee34,null));};exports[_0x458a('0x8c')]=function(_0x187bc8,_0x197858,_0x48622f){return db[_0x458a('0x81')][_0x458a('0x49')]({'where':{'id':_0x187bc8[_0x458a('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x458a('0x82')],'as':_0x458a('0x83'),'attributes':['id'],'raw':!![]}]})[_0x458a('0x29')](handleEntityNotFound(_0x197858,null))[_0x458a('0x29')](function(_0x2334f3){var _0x46bfc7=_[_0x458a('0x33')](_0x2334f3,'id');var _0x43cb92=[];var _0x5c42a4=[];var _0x3c3c7b=squel['select']();_0x3c3c7b['field'](_0x458a('0x8d'))[_0x458a('0x8e')]('team_has_voice_prefixes','tq')[_0x458a('0x8f')]('user_has_teams','ut',_0x458a('0x90'))['where'](_0x458a('0x91'),_0x187bc8[_0x458a('0x4c')]['id']);for(var _0x20ad0b=0x0;_0x20ad0b<_0x2334f3[_0x458a('0x3e')];_0x20ad0b+=0x1){let _0x55eab3=_0x2334f3[_0x20ad0b];for(var _0x4677a6=0x0;_0x4677a6<_0x55eab3[_0x458a('0x83')][_0x458a('0x3e')];_0x4677a6+=0x1){let _0x4df0b4=_0x55eab3[_0x458a('0x83')][_0x4677a6];var _0xfd1b68=_0x3c3c7b[_0x458a('0x92')]();_0xfd1b68[_0x458a('0x43')]('ut.UserId\x20=\x20?',_0x4df0b4['id']);_0x5c42a4[_0x458a('0x6a')](db['sequelize']['query'](_0xfd1b68['toString'](),{'type':db[_0x458a('0x53')][_0x458a('0x93')]['SELECT']})[_0x458a('0x29')](function(_0x49297c){if(_0x49297c[_0x458a('0x3e')]===0x1){return _0x4df0b4['id'];}else{var _0x4bfd6b=_[_0x458a('0x94')](_['map'](_0x49297c,_0x458a('0x95')),function(_0x3c9685){return _[_0x458a('0x96')](_0x46bfc7,_0x3c9685);});if(_0x4bfd6b){return _0x4df0b4['id'];}}}));}}return BPromise[_0x458a('0x97')](_0x5c42a4)[_0x458a('0x29')](function(_0x2e24aa){_0x43cb92=_(_0x43cb92)[_0x458a('0x98')](_0x2e24aa)['compact']()[_0x458a('0x99')]();return db[_0x458a('0x34')][_0x458a('0x4f')]({'where':{'id':_0x187bc8['params']['id']}})['then'](function(_0x334129){return db[_0x458a('0x53')][_0x458a('0x54')](function(_0x330330){return _0x334129[_0x458a('0x8c')](_0x187bc8['query'][_0x458a('0x79')],{'transaction':_0x330330})[_0x458a('0x29')](function(){if(!_[_0x458a('0x9a')](_0x43cb92)){return _0x334129[_0x458a('0x7c')](_0x43cb92,{'transaction':_0x330330});}})[_0x458a('0x29')](function(){_0x43cb92['forEach'](function(_0x16a747){socket[_0x458a('0x7d')](_0x458a('0x7e'),{'UserId':_0x16a747,'VoicePrefixId':_0x334129['id']});});});});});});})[_0x458a('0x29')](respondWithStatusCode(_0x197858,null))[_0x458a('0x50')](handleError(_0x197858,null));}; \ No newline at end of file +var _0xd914=['Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','Set','PREFIX-CALLERIDALL=','callerIdAll','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','sequelize','findById','addAgents','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','hasOwnProperty','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','union','compact','value','isEmpty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','describe','create','transaction','body','get','VoiceExtension','VoiceExtensionId','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','type','system','description'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd914,0x17f));var _0x4d91=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xd914[_0x934425];return _0x31d596;};'use strict';var emlformat=require(_0x4d91('0x0'));var rimraf=require(_0x4d91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d91('0x2'));var rp=require(_0x4d91('0x3'));var moment=require(_0x4d91('0x4'));var BPromise=require(_0x4d91('0x5'));var Mustache=require(_0x4d91('0x6'));var util=require(_0x4d91('0x7'));var path=require('path');var sox=require(_0x4d91('0x8'));var csv=require('to-csv');var ejs=require(_0x4d91('0x9'));var fs=require('fs');var fs_extra=require(_0x4d91('0xa'));var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x10'));var querystring=require('querystring');var Papa=require(_0x4d91('0x11'));var Redis=require(_0x4d91('0x12'));var authService=require(_0x4d91('0x13'));var qs=require(_0x4d91('0x14'));var as=require(_0x4d91('0x15'));var hardwareService=require(_0x4d91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4d91('0x17'));var config=require(_0x4d91('0x18'));var licenseUtil=require(_0x4d91('0x19'));var db=require(_0x4d91('0x1a'))['db'];config[_0x4d91('0x1b')]=_[_0x4d91('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4d91('0x1d'))(new Redis(config[_0x4d91('0x1b')]));require(_0x4d91('0x1e'))[_0x4d91('0x1f')](socket);function respondWithStatusCode(_0x33fbd4,_0x25bafc){_0x25bafc=_0x25bafc||0xcc;return function(_0x36f606){if(_0x36f606){return _0x33fbd4['sendStatus'](_0x25bafc);}return _0x33fbd4[_0x4d91('0x20')](_0x25bafc)[_0x4d91('0x21')]();};}function respondWithResult(_0x1e2ef7,_0xb92681){_0xb92681=_0xb92681||0xc8;return function(_0x280e80){if(_0x280e80){return _0x1e2ef7['status'](_0xb92681)[_0x4d91('0x22')](_0x280e80);}};}function respondWithFilteredResult(_0xb75abf,_0x241564){return function(_0x44b9a7){if(_0x44b9a7){var _0x4cfa40=typeof _0x241564[_0x4d91('0x23')]===_0x4d91('0x24')&&typeof _0x241564[_0x4d91('0x25')]==='undefined';var _0x13ef2c=_0x44b9a7[_0x4d91('0x26')];var _0x351388=_0x4cfa40?0x0:_0x241564[_0x4d91('0x23')];var _0x10b767=_0x4cfa40?_0x44b9a7[_0x4d91('0x26')]:_0x241564[_0x4d91('0x23')]+_0x241564[_0x4d91('0x25')];var _0x30d911;if(_0x10b767>=_0x13ef2c){_0x10b767=_0x13ef2c;_0x30d911=0xc8;}else{_0x30d911=0xce;}_0xb75abf[_0x4d91('0x20')](_0x30d911);return _0xb75abf['set'](_0x4d91('0x27'),_0x351388+'-'+_0x10b767+'/'+_0x13ef2c)['json'](_0x44b9a7);}return null;};}function patchUpdates(_0x57913e){return function(_0x74a697){try{jsonpatch[_0x4d91('0x28')](_0x74a697,_0x57913e,!![]);}catch(_0x341d18){return BPromise[_0x4d91('0x29')](_0x341d18);}return _0x74a697[_0x4d91('0x2a')]();};}function saveUpdates(_0x12b722,_0x100cd4){return function(_0x123606){if(_0x123606){return _0x123606['update'](_0x12b722)['then'](function(_0x1ee6b3){return _0x1ee6b3;});}return null;};}function removeEntity(_0x112923,_0x3bed98){return function(_0x45fc91){if(_0x45fc91){return _0x45fc91[_0x4d91('0x2b')]()[_0x4d91('0x2c')](function(){var _0x14bdb4=_0x45fc91['get']({'plain':!![]});var _0x3dc353=_0x4d91('0x2d');return db[_0x4d91('0x2e')]['destroy']({'where':{'type':_0x3dc353,'resourceId':_0x14bdb4['id']}})['then'](function(){return _0x45fc91;});})[_0x4d91('0x2c')](function(){_0x112923[_0x4d91('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50fe76,_0x42d5a0){return function(_0x2d6981){if(!_0x2d6981){_0x50fe76[_0x4d91('0x2f')](0x194);}return _0x2d6981;};}function handleError(_0x17c7bc,_0x4f23dd){_0x4f23dd=_0x4f23dd||0x1f4;return function(_0x2587a1){logger[_0x4d91('0x30')](_0x2587a1[_0x4d91('0x31')]);if(_0x2587a1[_0x4d91('0x32')]){delete _0x2587a1[_0x4d91('0x32')];}_0x17c7bc[_0x4d91('0x20')](_0x4f23dd)[_0x4d91('0x33')](_0x2587a1);};}exports['index']=function(_0x82f585,_0x4f44ff){var _0x4ad7bf={},_0x292808={},_0x3a2780={'count':0x0,'rows':[]};var _0x4f95f0=_[_0x4d91('0x34')](db[_0x4d91('0x35')][_0x4d91('0x36')],function(_0x2be3f5){return{'name':_0x2be3f5[_0x4d91('0x37')],'type':_0x2be3f5['type'][_0x4d91('0x38')]};});_0x292808[_0x4d91('0x39')]=_[_0x4d91('0x34')](_0x4f95f0,_0x4d91('0x32'));_0x292808[_0x4d91('0x3a')]=_[_0x4d91('0x3b')](_0x82f585['query']);_0x292808[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0x292808['model'],_0x292808[_0x4d91('0x3a')]);_0x4ad7bf[_0x4d91('0x3e')]=_[_0x4d91('0x3d')](_0x292808['model'],qs[_0x4d91('0x3f')](_0x82f585[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x4ad7bf[_0x4d91('0x3e')]=_0x4ad7bf['attributes'][_0x4d91('0x40')]?_0x4ad7bf[_0x4d91('0x3e')]:_0x292808[_0x4d91('0x39')];if(!_0x82f585[_0x4d91('0x3a')]['hasOwnProperty']('nolimit')){_0x4ad7bf[_0x4d91('0x25')]=qs[_0x4d91('0x25')](_0x82f585['query'][_0x4d91('0x25')]);_0x4ad7bf[_0x4d91('0x23')]=qs[_0x4d91('0x23')](_0x82f585[_0x4d91('0x3a')]['offset']);}_0x4ad7bf[_0x4d91('0x41')]=qs[_0x4d91('0x42')](_0x82f585['query'][_0x4d91('0x42')]);_0x4ad7bf['where']=qs[_0x4d91('0x3c')](_['pick'](_0x82f585[_0x4d91('0x3a')],_0x292808['filters']),_0x4f95f0);if(_0x82f585[_0x4d91('0x3a')][_0x4d91('0x43')]){_0x4ad7bf[_0x4d91('0x44')]=_[_0x4d91('0x45')](_0x4ad7bf['where'],{'$or':_['map'](_0x4f95f0,function(_0x25e0f5){if(_0x25e0f5['type']!==_0x4d91('0x46')){var _0x282d64={};_0x282d64[_0x25e0f5['name']]={'$like':'%'+_0x82f585[_0x4d91('0x3a')][_0x4d91('0x43')]+'%'};return _0x282d64;}})});}_0x4ad7bf=_[_0x4d91('0x45')]({},_0x4ad7bf,_0x82f585[_0x4d91('0x47')]);var _0x1c6d0b={'where':_0x4ad7bf[_0x4d91('0x44')]};return db[_0x4d91('0x35')]['count'](_0x1c6d0b)[_0x4d91('0x2c')](function(_0x4c70af){_0x3a2780[_0x4d91('0x26')]=_0x4c70af;if(_0x82f585[_0x4d91('0x3a')][_0x4d91('0x48')]){_0x4ad7bf[_0x4d91('0x49')]=[{'all':!![]}];}return db[_0x4d91('0x35')][_0x4d91('0x4a')](_0x4ad7bf);})['then'](function(_0x4ffc08){_0x3a2780[_0x4d91('0x4b')]=_0x4ffc08;return _0x3a2780;})[_0x4d91('0x2c')](respondWithFilteredResult(_0x4f44ff,_0x4ad7bf))['catch'](handleError(_0x4f44ff,null));};exports[_0x4d91('0x4c')]=function(_0x164658,_0x342de1){var _0x3f8659={'raw':![],'where':{'id':_0x164658[_0x4d91('0x4d')]['id']}},_0x31f21a={};_0x31f21a[_0x4d91('0x39')]=_[_0x4d91('0x3b')](db[_0x4d91('0x35')]['rawAttributes']);_0x31f21a['query']=_[_0x4d91('0x3b')](_0x164658['query']);_0x31f21a[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0x31f21a[_0x4d91('0x39')],_0x31f21a[_0x4d91('0x3a')]);_0x3f8659['attributes']=_[_0x4d91('0x3d')](_0x31f21a['model'],qs['fields'](_0x164658[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x3f8659[_0x4d91('0x3e')]=_0x3f8659[_0x4d91('0x3e')][_0x4d91('0x40')]?_0x3f8659[_0x4d91('0x3e')]:_0x31f21a['model'];if(_0x164658[_0x4d91('0x3a')][_0x4d91('0x48')]){_0x3f8659[_0x4d91('0x49')]=[{'all':!![]}];}_0x3f8659=_[_0x4d91('0x45')]({},_0x3f8659,_0x164658[_0x4d91('0x47')]);return db[_0x4d91('0x35')][_0x4d91('0x4e')](_0x3f8659)[_0x4d91('0x2c')](handleEntityNotFound(_0x342de1,null))[_0x4d91('0x2c')](respondWithResult(_0x342de1,null))[_0x4d91('0x4f')](handleError(_0x342de1,null));};exports[_0x4d91('0x2b')]=function(_0x5a67fa,_0xa5c630){return db['VoicePrefix'][_0x4d91('0x4e')]({'where':{'id':_0x5a67fa[_0x4d91('0x4d')]['id']}})[_0x4d91('0x2c')](handleEntityNotFound(_0xa5c630,null))[_0x4d91('0x2c')](removeEntity(_0xa5c630,null))[_0x4d91('0x4f')](handleError(_0xa5c630,null));};exports[_0x4d91('0x50')]=function(_0x3028b1,_0x22b341){return db['VoicePrefix'][_0x4d91('0x50')]()[_0x4d91('0x2c')](respondWithResult(_0x22b341,null))[_0x4d91('0x4f')](handleError(_0x22b341,null));};exports[_0x4d91('0x51')]=function(_0x26ecd7,_0x19e57e){var _0x5765ce;return db['sequelize'][_0x4d91('0x52')](function(_0x2159e4){return db[_0x4d91('0x35')][_0x4d91('0x51')](_0x26ecd7[_0x4d91('0x53')],{'transaction':_0x2159e4})[_0x4d91('0x2c')](function(_0x2875f4){_0x5765ce=_0x2875f4[_0x4d91('0x54')]({'plain':!![]});return db[_0x4d91('0x55')][_0x4d91('0x4e')]({'where':{'id':_0x5765ce[_0x4d91('0x56')]},'raw':!![]})[_0x4d91('0x2c')](function(_0x280c41){return createVoicePrefixExtensions(_0x5765ce,_0x280c41,_0x2159e4);});});})[_0x4d91('0x2c')](function(){var _0x3e9154=_0x26ecd7[_0x4d91('0x57')][_0x4d91('0x54')]({'plain':!![]});if(!_0x3e9154)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e9154['role']==='user'){var _0x45cf4e=_0x5765ce;return db[_0x4d91('0x58')][_0x4d91('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3e9154[_0x4d91('0x59')]},'raw':!![]})[_0x4d91('0x2c')](function(_0x3985f3){if(_0x3985f3&&_0x3985f3['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x45cf4e[_0x4d91('0x32')],'resourceId':_0x45cf4e['id'],'type':_0x3985f3[_0x4d91('0x32')],'sectionId':_0x3985f3['id']},{})[_0x4d91('0x2c')](function(){return _0x5765ce;});}else{return _0x5765ce;}})[_0x4d91('0x4f')](function(_0x31d6e5){logger['error'](_0x4d91('0x5a'),_0x31d6e5);throw _0x31d6e5;});}return _0x5765ce;})[_0x4d91('0x2c')](respondWithResult(_0x19e57e,null))['catch'](handleError(_0x19e57e,null));};function Extension(_0x563558,_0x3f4f24,_0x544711,_0x3fda50){this[_0x4d91('0x5b')]=_0x4d91('0x5c');this['exten']=_0x563558;this[_0x4d91('0x5d')]=_0x544711;this[_0x4d91('0x5e')]=_0x4d91('0x5f');this[_0x4d91('0x60')]=_0x4d91('0x61');this[_0x4d91('0x62')]=_0x3f4f24;this[_0x4d91('0x63')]=_0x3fda50;}function createVoicePrefixExtensions(_0x524b4f,_0x533572,_0x5eeba8){return new BPromise(function(_0x4bd66d,_0x83395){var _0x8d6db2=new Extension(formatPrefixName(_0x524b4f[_0x4d91('0x64')]),0x1,'NoOp',_0x4d91('0x65'));_0x8d6db2['VoicePrefixId']=_0x524b4f['id'];return db[_0x4d91('0x55')][_0x4d91('0x51')](_0x8d6db2,{'transaction':_0x5eeba8})['then'](function(_0x51a594){var _0x1a707f=_0x51a594[_0x4d91('0x54')]({'plain':!![]});var _0x31150f=_[_0x4d91('0x34')](addVoicePrefixExtensions(_0x524b4f,_0x533572),function(_0x24661a){_0x24661a[_0x4d91('0x56')]=_0x1a707f['id'];_0x24661a[_0x4d91('0x66')]=_0x524b4f['id'];return _0x24661a;});return db[_0x4d91('0x55')][_0x4d91('0x67')](_0x31150f,{'transaction':_0x5eeba8})[_0x4d91('0x2c')](function(_0x5bfb08){if(!_0x5bfb08){return _0x83395('Extensions\x20creation\x20failed');}else{return _0x4bd66d(_0x5bfb08);}})[_0x4d91('0x4f')](function(_0x7e26c2){return _0x83395(_0x7e26c2);});});;});};function addVoicePrefixExtensions(_0x2049ca,_0x13281d){var _0x16ba26=[];var _0x16d384=formatPrefixName(_0x2049ca[_0x4d91('0x64')]);_0x16ba26[_0x4d91('0x68')](new Extension(_0x16d384,0x2,_0x4d91('0x69'),'CDR(prefix)='+_0x2049ca['name']));if(_0x2049ca['callerIdAll']){_0x16ba26['push'](new Extension(_0x16d384,0x3,_0x4d91('0x69'),_0x4d91('0x6a')+_0x2049ca[_0x4d91('0x6b')]));}else{_0x16ba26[_0x4d91('0x68')](new Extension(_0x16d384,0x3,_0x4d91('0x6c'),_0x4d91('0x6d')));}_0x16ba26[_0x4d91('0x68')](new Extension(_0x16d384,0x4,_0x4d91('0x6e'),_0x13281d[_0x4d91('0x5b')]+','+_0x4d91('0x6f')+(0x8+_0x2049ca[_0x4d91('0x32')][_0x4d91('0x40')])+'}'+','+0x1));return _0x16ba26;}function formatPrefixName(_0x4444a2){var _0xef787='_';for(var _0x3bc828=0x0;_0x3bc828<_0x4444a2[_0x4d91('0x40')];_0x3bc828++){if(_0x4444a2[_0x4d91('0x70')](_0x3bc828)=='-'){_0xef787+=_0x4444a2['charAt'](_0x3bc828);}else{_0xef787+='['+_0x4444a2[_0x4d91('0x70')](_0x3bc828)+']';}}_0xef787+='.';return _0xef787;}exports[_0x4d91('0x71')]=function(_0xc4ef10,_0x2e2105,_0x1cad5b){var _0x5ab447=_0xc4ef10[_0x4d91('0x53')];_0x5ab447[_0x4d91('0x64')]='system-'+_0x5ab447[_0x4d91('0x32')]+'-';return db[_0x4d91('0x72')][_0x4d91('0x52')](function(_0xa469a4){return db[_0x4d91('0x35')]['update'](_0x5ab447,{'where':{'id':_0x5ab447['id']},'transaction':_0xa469a4})[_0x4d91('0x2c')](function(){return db[_0x4d91('0x55')]['destroy']({'where':{'VoicePrefixId':_0x5ab447['id']},'transaction':_0xa469a4})[_0x4d91('0x2c')](function(){return db[_0x4d91('0x55')][_0x4d91('0x4e')]({'where':{'id':_0x5ab447['VoiceExtensionId']},'raw':!![]})[_0x4d91('0x2c')](function(_0x403e0c){return createVoicePrefixExtensions(_0x5ab447,_0x403e0c,_0xa469a4);});});});})[_0x4d91('0x2c')](function(){return db[_0x4d91('0x35')][_0x4d91('0x73')](_0x5ab447['id']);})[_0x4d91('0x2c')](respondWithResult(_0x2e2105,null))[_0x4d91('0x4f')](handleError(_0x2e2105,null));};exports['addAgents']=function(_0xdbb484,_0x2e014b,_0x4e7994){return db[_0x4d91('0x35')]['find']({'where':{'id':_0xdbb484['params']['id']}})[_0x4d91('0x2c')](handleEntityNotFound(_0x2e014b,null))['then'](function(_0x1a5376){if(_0x1a5376){return _0x1a5376[_0x4d91('0x74')](_0xdbb484[_0x4d91('0x53')][_0x4d91('0x75')],_[_0x4d91('0x76')](_0xdbb484[_0x4d91('0x53')],[_0x4d91('0x75'),'id'])||{})['spread'](function(_0x485da1){for(var _0x1c27e7=0x0;_0x1c27e7<_0xdbb484[_0x4d91('0x53')][_0x4d91('0x75')][_0x4d91('0x40')];_0x1c27e7+=0x1){socket[_0x4d91('0x77')]('userVoicePrefix:save',{'UserId':Number(_0xdbb484['body'][_0x4d91('0x75')][_0x1c27e7]),'VoicePrefixId':Number(_0xdbb484['params']['id'])});}return _0x485da1;});}})['then'](respondWithResult(_0x2e014b,null))[_0x4d91('0x4f')](handleError(_0x2e014b,null));};exports['removeAgents']=function(_0x585a8d,_0x216c33,_0x1b813c){return db[_0x4d91('0x35')]['find']({'where':{'id':_0x585a8d['params']['id']}})['then'](handleEntityNotFound(_0x216c33,null))[_0x4d91('0x2c')](function(_0x8d84f3){if(_0x8d84f3){return _0x8d84f3[_0x4d91('0x78')](_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')])[_0x4d91('0x2c')](function(){if(_[_0x4d91('0x79')](_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')])){for(var _0x542f58=0x0;_0x542f58<_0x585a8d[_0x4d91('0x3a')]['ids']['length'];_0x542f58+=0x1){socket[_0x4d91('0x77')](_0x4d91('0x7a'),{'UserId':Number(_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')][_0x542f58]),'VoicePrefixId':Number(_0x585a8d['params']['id'])});}}else{socket[_0x4d91('0x77')](_0x4d91('0x7a'),{'UserId':Number(_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')]),'VoicePrefixId':Number(_0x585a8d[_0x4d91('0x4d')]['id'])});}});}})[_0x4d91('0x2c')](respondWithStatusCode(_0x216c33,null))[_0x4d91('0x4f')](handleError(_0x216c33,null));};exports['getAgents']=function(_0x28322e,_0x24376e,_0x7bc606){var _0x49d81c={};var _0xc37e2e={};var _0x45a628;var _0x2cf518;return db[_0x4d91('0x35')][_0x4d91('0x7b')]({'where':{'id':_0x28322e[_0x4d91('0x4d')]['id']}})['then'](handleEntityNotFound(_0x24376e,null))[_0x4d91('0x2c')](function(_0x582bee){if(_0x582bee){_0x45a628=_0x582bee;_0xc37e2e[_0x4d91('0x39')]=_['keys'](db[_0x4d91('0x7c')][_0x4d91('0x36')]);_0xc37e2e['query']=_['keys'](_0x28322e['query']);_0xc37e2e[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0xc37e2e[_0x4d91('0x39')],_0xc37e2e[_0x4d91('0x3a')]);_0x49d81c[_0x4d91('0x3e')]=_['intersection'](_0xc37e2e['model'],qs[_0x4d91('0x3f')](_0x28322e[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x49d81c[_0x4d91('0x3e')]=_0x49d81c[_0x4d91('0x3e')][_0x4d91('0x40')]?_0x49d81c[_0x4d91('0x3e')]:_0xc37e2e['model'];_0x49d81c[_0x4d91('0x41')]=qs[_0x4d91('0x42')](_0x28322e[_0x4d91('0x3a')][_0x4d91('0x42')]);_0x49d81c[_0x4d91('0x44')]=qs[_0x4d91('0x3c')](_[_0x4d91('0x7d')](_0x28322e[_0x4d91('0x3a')],_0xc37e2e[_0x4d91('0x3c')]));if(_0x28322e['query'][_0x4d91('0x43')]){_0x49d81c[_0x4d91('0x44')]=_[_0x4d91('0x45')](_0x49d81c[_0x4d91('0x44')],{'$or':_[_0x4d91('0x34')](_0x49d81c[_0x4d91('0x3e')],function(_0x4682a8){var _0x51a30d={};_0x51a30d[_0x4682a8]={'$like':'%'+_0x28322e[_0x4d91('0x3a')][_0x4d91('0x43')]+'%'};return _0x51a30d;})});}_0x49d81c=_['merge']({},_0x49d81c,_0x28322e[_0x4d91('0x47')]);return _0x45a628[_0x4d91('0x7e')](_0x49d81c);}})['then'](function(_0x22cd5a){if(_0x22cd5a){_0x2cf518=_0x22cd5a[_0x4d91('0x40')];if(!_0x28322e[_0x4d91('0x3a')][_0x4d91('0x7f')](_0x4d91('0x80'))){_0x49d81c[_0x4d91('0x25')]=qs['limit'](_0x28322e[_0x4d91('0x3a')][_0x4d91('0x25')]);_0x49d81c[_0x4d91('0x23')]=qs[_0x4d91('0x23')](_0x28322e[_0x4d91('0x3a')]['offset']);}return _0x45a628[_0x4d91('0x7e')](_0x49d81c);}})[_0x4d91('0x2c')](function(_0x3b0ab3){if(_0x3b0ab3){return _0x3b0ab3?{'count':_0x2cf518,'rows':_0x3b0ab3}:null;}})[_0x4d91('0x2c')](respondWithResult(_0x24376e,null))[_0x4d91('0x4f')](handleError(_0x24376e,null));};exports[_0x4d91('0x81')]=function(_0x18f844,_0x3e93d0,_0x53d973){var _0x367c30={};var _0x28b505={};var _0x451e14;var _0x37fe62;return db[_0x4d91('0x35')][_0x4d91('0x7b')]({'where':{'id':_0x18f844[_0x4d91('0x4d')]['id']}})[_0x4d91('0x2c')](handleEntityNotFound(_0x3e93d0,null))[_0x4d91('0x2c')](function(_0x5abc1d){if(_0x5abc1d){_0x451e14=_0x5abc1d;_0x28b505[_0x4d91('0x39')]=_[_0x4d91('0x3b')](db[_0x4d91('0x82')][_0x4d91('0x36')]);_0x28b505['query']=_['keys'](_0x18f844[_0x4d91('0x3a')]);_0x28b505[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0x28b505[_0x4d91('0x39')],_0x28b505['query']);_0x367c30[_0x4d91('0x3e')]=_[_0x4d91('0x3d')](_0x28b505[_0x4d91('0x39')],qs[_0x4d91('0x3f')](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x367c30[_0x4d91('0x3e')]=_0x367c30[_0x4d91('0x3e')][_0x4d91('0x40')]?_0x367c30['attributes']:_0x28b505[_0x4d91('0x39')];_0x367c30[_0x4d91('0x41')]=qs[_0x4d91('0x42')](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x42')]);_0x367c30[_0x4d91('0x44')]=qs[_0x4d91('0x3c')](_[_0x4d91('0x7d')](_0x18f844[_0x4d91('0x3a')],_0x28b505[_0x4d91('0x3c')]));if(_0x18f844[_0x4d91('0x3a')][_0x4d91('0x43')]){_0x367c30['where']=_[_0x4d91('0x45')](_0x367c30[_0x4d91('0x44')],{'$or':_[_0x4d91('0x34')](_0x367c30[_0x4d91('0x3e')],function(_0x3e57a1){var _0x41fbc7={};_0x41fbc7[_0x3e57a1]={'$like':'%'+_0x18f844[_0x4d91('0x3a')][_0x4d91('0x43')]+'%'};return _0x41fbc7;})});}_0x367c30=_[_0x4d91('0x45')]({},_0x367c30,_0x18f844[_0x4d91('0x47')]);return _0x451e14[_0x4d91('0x81')](_0x367c30);}})[_0x4d91('0x2c')](function(_0x5a241a){if(_0x5a241a){_0x37fe62=_0x5a241a['length'];if(!_0x18f844[_0x4d91('0x3a')]['hasOwnProperty'](_0x4d91('0x80'))){_0x367c30[_0x4d91('0x25')]=qs[_0x4d91('0x25')](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x25')]);_0x367c30[_0x4d91('0x23')]=qs['offset'](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x23')]);}return _0x451e14[_0x4d91('0x81')](_0x367c30);}})[_0x4d91('0x2c')](function(_0x1419c5){if(_0x1419c5){return _0x1419c5?{'count':_0x37fe62,'rows':_0x1419c5}:null;}})[_0x4d91('0x2c')](respondWithResult(_0x3e93d0,null))[_0x4d91('0x4f')](handleError(_0x3e93d0,null));};exports[_0x4d91('0x83')]=function(_0x47cbca,_0x1df276,_0x3e2771){var _0x15d270=_0x47cbca[_0x4d91('0x53')][_0x4d91('0x75')];var _0x17e3bc;return db[_0x4d91('0x82')][_0x4d91('0x4a')]({'where':{'id':_0x15d270},'attributes':['id'],'include':[{'model':db[_0x4d91('0x7c')],'as':_0x4d91('0x84'),'attributes':['id','name',_0x4d91('0x85'),_0x4d91('0x86'),'interface'],'raw':!![]}]})[_0x4d91('0x2c')](function(_0x1f836b){if(_0x1f836b){_0x17e3bc=_0x1f836b;var _0x455dd6=_['flatMap'](_0x1f836b,function(_0x46ccf4){var _0xcc22a2=_0x46ccf4['get']({'plain':!![]});return _0xcc22a2['Agents'];});return db[_0x4d91('0x35')][_0x4d91('0x4e')]({'where':{'id':_0x47cbca[_0x4d91('0x4d')]['id']}})['then'](function(_0x352e84){return db[_0x4d91('0x72')][_0x4d91('0x52')](function(_0x3b2e36){return _0x352e84[_0x4d91('0x83')](_0x15d270,{'transaction':_0x3b2e36})[_0x4d91('0x2c')](function(){return BPromise[_0x4d91('0x87')](_0x17e3bc,function(_0x185ded){return db[_0x4d91('0x88')][_0x4d91('0x89')]({'TeamId':_0x185ded['id'],'VoicePrefixId':_0x47cbca[_0x4d91('0x4d')]['id']},{'transaction':_0x3b2e36});});})['then'](function(){return BPromise[_0x4d91('0x87')](_0x455dd6,function(_0x2a9069){return db[_0x4d91('0x8a')][_0x4d91('0x8b')]({'where':{'UserId':_0x2a9069['id'],'VoicePrefixId':_0x47cbca[_0x4d91('0x4d')]['id']},'transaction':_0x3b2e36});});})[_0x4d91('0x2c')](function(){_0x455dd6[_0x4d91('0x8c')](function(_0xb67bd3){socket[_0x4d91('0x77')](_0x4d91('0x8d'),{'UserId':_0xb67bd3['id'],'VoicePrefixId':_0x352e84['id']});});});});});}})[_0x4d91('0x2c')](respondWithStatusCode(_0x1df276,null))[_0x4d91('0x4f')](handleError(_0x1df276,null));};exports[_0x4d91('0x8e')]=function(_0xbadba4,_0xe88619,_0x44f21b){return db[_0x4d91('0x82')]['findAll']({'where':{'id':_0xbadba4['query'][_0x4d91('0x75')]},'attributes':['id'],'include':[{'model':db[_0x4d91('0x7c')],'as':_0x4d91('0x84'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xe88619,null))[_0x4d91('0x2c')](function(_0x2882d5){var _0x2678e7=_[_0x4d91('0x34')](_0x2882d5,'id');var _0x236a61=[];var _0x54f720=[];var _0x5f2ce4=squel['select']();_0x5f2ce4['field'](_0x4d91('0x8f'))[_0x4d91('0x90')]('team_has_voice_prefixes','tq')[_0x4d91('0x91')](_0x4d91('0x92'),'ut',_0x4d91('0x93'))['where'](_0x4d91('0x94'),_0xbadba4[_0x4d91('0x4d')]['id']);for(var _0x237074=0x0;_0x237074<_0x2882d5['length'];_0x237074+=0x1){let _0x3b4804=_0x2882d5[_0x237074];for(var _0x20212f=0x0;_0x20212f<_0x3b4804[_0x4d91('0x84')][_0x4d91('0x40')];_0x20212f+=0x1){let _0x39de93=_0x3b4804['Agents'][_0x20212f];var _0xe60b6=_0x5f2ce4[_0x4d91('0x95')]();_0xe60b6[_0x4d91('0x44')](_0x4d91('0x96'),_0x39de93['id']);_0x54f720['push'](db[_0x4d91('0x72')][_0x4d91('0x3a')](_0xe60b6[_0x4d91('0x97')](),{'type':db[_0x4d91('0x72')][_0x4d91('0x98')][_0x4d91('0x99')]})['then'](function(_0x12e226){if(_0x12e226[_0x4d91('0x40')]===0x1){return _0x39de93['id'];}else{var _0x448a12=_[_0x4d91('0x9a')](_[_0x4d91('0x34')](_0x12e226,_0x4d91('0x9b')),function(_0x2c5ccc){return _['includes'](_0x2678e7,_0x2c5ccc);});if(_0x448a12){return _0x39de93['id'];}}}));}}return BPromise['all'](_0x54f720)[_0x4d91('0x2c')](function(_0x4026b3){_0x236a61=_(_0x236a61)[_0x4d91('0x9c')](_0x4026b3)[_0x4d91('0x9d')]()[_0x4d91('0x9e')]();return db[_0x4d91('0x35')]['find']({'where':{'id':_0xbadba4[_0x4d91('0x4d')]['id']}})['then'](function(_0x3e23df){return db[_0x4d91('0x72')]['transaction'](function(_0x9d7ff1){return _0x3e23df[_0x4d91('0x8e')](_0xbadba4['query']['ids'],{'transaction':_0x9d7ff1})['then'](function(){if(!_[_0x4d91('0x9f')](_0x236a61)){return _0x3e23df['removeAgents'](_0x236a61,{'transaction':_0x9d7ff1});}})[_0x4d91('0x2c')](function(){_0x236a61[_0x4d91('0x8c')](function(_0x4da3b1){socket['emit'](_0x4d91('0x7a'),{'UserId':_0x4da3b1,'VoicePrefixId':_0x3e23df['id']});});});});});});})[_0x4d91('0x2c')](respondWithStatusCode(_0xe88619,null))[_0x4d91('0x4f')](handleError(_0xe88619,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index afe0a04..bef1106 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 _0x78c0=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','VoicePrefix'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x78c0,0xfe));var _0x078c=function(_0x362639,_0x499412){_0x362639=_0x362639-0x0;var _0x3bc78a=_0x78c0[_0x362639];return _0x3bc78a;};'use strict';var EventEmitter=require(_0x078c('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x078c('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x078c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x078c('0x3')};function emitEvent(_0x52f8c3){return function(_0x390438,_0x166d73,_0x1e4b04){VoicePrefixEvents['emit'](_0x52f8c3+':'+_0x390438['id'],_0x390438);VoicePrefixEvents[_0x078c('0x4')](_0x52f8c3,_0x390438);_0x1e4b04(null);};}for(var e in events){if(events[_0x078c('0x5')](e)){var event=events[e];VoicePrefix[_0x078c('0x6')](e,emitEvent(event));}}module[_0x078c('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0x5a59=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x5a59,0x19f));var _0x95a5=function(_0x8c8b76,_0x500c08){_0x8c8b76=_0x8c8b76-0x0;var _0x5377f8=_0x5a59[_0x8c8b76];return _0x5377f8;};'use strict';var EventEmitter=require(_0x95a5('0x0'));var VoicePrefix=require(_0x95a5('0x1'))['db'][_0x95a5('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x95a5('0x3')](0x0);var events={'afterCreate':_0x95a5('0x4'),'afterUpdate':_0x95a5('0x5'),'afterDestroy':_0x95a5('0x6')};function emitEvent(_0x168430){return function(_0x4aa2da,_0x4f40ed,_0x538150){VoicePrefixEvents[_0x95a5('0x7')](_0x168430+':'+_0x4aa2da['id'],_0x4aa2da);VoicePrefixEvents[_0x95a5('0x7')](_0x168430,_0x4aa2da);_0x538150(null);};}for(var e in events){if(events[_0x95a5('0x8')](e)){var event=events[e];VoicePrefix[_0x95a5('0x9')](e,emitEvent(event));}}module[_0x95a5('0xa')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index b105955..2a58d4b 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 _0x5cae=['exports','define','VoicePrefix','voice_prefixes','lodash','api','moment','bluebird','rimraf','./voicePrefix.attributes'];(function(_0x2d9e90,_0x5dcc72){var _0x54695f=function(_0xc3b3){while(--_0xc3b3){_0x2d9e90['push'](_0x2d9e90['shift']());}};_0x54695f(++_0x5dcc72);}(_0x5cae,0x1d0));var _0xe5ca=function(_0x479a35,_0x2526b2){_0x479a35=_0x479a35-0x0;var _0x24fea9=_0x5cae[_0x479a35];return _0x24fea9;};'use strict';var _=require(_0xe5ca('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe5ca('0x1'));var moment=require(_0xe5ca('0x2'));var BPromise=require(_0xe5ca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe5ca('0x4'));var config=require('../../config/environment');var attributes=require(_0xe5ca('0x5'));module[_0xe5ca('0x6')]=function(_0x2c7f6e,_0x4bcbf4){return _0x2c7f6e[_0xe5ca('0x7')](_0xe5ca('0x8'),attributes,{'tableName':_0xe5ca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41ab=['rimraf','../../config/environment','./voicePrefix.attributes','define','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x402731,_0x43c115){var _0x111736=function(_0x5a7044){while(--_0x5a7044){_0x402731['push'](_0x402731['shift']());}};_0x111736(++_0x43c115);}(_0x41ab,0xef));var _0xb41a=function(_0x56b9ee,_0x25a747){_0x56b9ee=_0x56b9ee-0x0;var _0x371286=_0x41ab[_0x56b9ee];return _0x371286;};'use strict';var _=require(_0xb41a('0x0'));var util=require(_0xb41a('0x1'));var logger=require(_0xb41a('0x2'))(_0xb41a('0x3'));var moment=require(_0xb41a('0x4'));var BPromise=require(_0xb41a('0x5'));var rp=require(_0xb41a('0x6'));var fs=require('fs');var path=require(_0xb41a('0x7'));var rimraf=require(_0xb41a('0x8'));var config=require(_0xb41a('0x9'));var attributes=require(_0xb41a('0xa'));module['exports']=function(_0xc6ae3f,_0x77882f){return _0xc6ae3f[_0xb41a('0xb')]('VoicePrefix',attributes,{'tableName':_0xb41a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index f604ffb..2d0a749 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 _0xa7db=['VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./voicePrefix.socket','register','then','info'];(function(_0x290694,_0x281935){var _0x5a0f2e=function(_0x58d7d4){while(--_0x58d7d4){_0x290694['push'](_0x290694['shift']());}};_0x5a0f2e(++_0x281935);}(_0xa7db,0xbf));var _0xba7d=function(_0x23ac80,_0x3dbe95){_0x23ac80=_0x23ac80-0x0;var _0x177e65=_0xa7db[_0x23ac80];return _0x177e65;};'use strict';var _=require(_0xba7d('0x0'));var util=require(_0xba7d('0x1'));var moment=require(_0xba7d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba7d('0x3'))['db'];var utils=require(_0xba7d('0x4'));var logger=require(_0xba7d('0x5'))(_0xba7d('0x6'));var config=require(_0xba7d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xba7d('0x8')][_0xba7d('0x9')]({'port':0x232a});config[_0xba7d('0xa')]=_[_0xba7d('0xb')](config[_0xba7d('0xa')],{'host':_0xba7d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba7d('0xa')]));require(_0xba7d('0xd'))[_0xba7d('0xe')](socket);function respondWithRpcPromise(_0x242f4d,_0x7c24b5,_0x557008){return new BPromise(function(_0x142700,_0x3dcea9){return client['request'](_0x242f4d,_0x557008)[_0xba7d('0xf')](function(_0x39c6e0){logger[_0xba7d('0x10')](_0xba7d('0x11'),_0x7c24b5,'request\x20sent');logger[_0xba7d('0x12')](_0xba7d('0x13'),_0x7c24b5,_0xba7d('0x14'),JSON[_0xba7d('0x15')](_0x39c6e0));if(_0x39c6e0['error']){if(_0x39c6e0[_0xba7d('0x16')]['code']===0x1f4){logger[_0xba7d('0x16')](_0xba7d('0x11'),_0x7c24b5,_0x39c6e0[_0xba7d('0x16')][_0xba7d('0x17')]);return _0x3dcea9(_0x39c6e0['error'][_0xba7d('0x17')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x7c24b5,_0x39c6e0[_0xba7d('0x16')]['message']);return _0x142700(_0x39c6e0[_0xba7d('0x16')][_0xba7d('0x17')]);}else{logger[_0xba7d('0x10')](_0xba7d('0x11'),_0x7c24b5,_0xba7d('0x14'));_0x142700(_0x39c6e0[_0xba7d('0x18')][_0xba7d('0x17')]);}})[_0xba7d('0x19')](function(_0x354430){logger[_0xba7d('0x16')](_0xba7d('0x11'),_0x7c24b5,_0x354430);_0x3dcea9(_0x354430);});});} \ No newline at end of file +var _0x50a5=['VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','info'];(function(_0x514c15,_0x486901){var _0x16283e=function(_0x53b7d0){while(--_0x53b7d0){_0x514c15['push'](_0x514c15['shift']());}};_0x16283e(++_0x486901);}(_0x50a5,0xd1));var _0x550a=function(_0x5d85b2,_0x5f3494){_0x5d85b2=_0x5d85b2-0x0;var _0x58675c=_0x50a5[_0x5d85b2];return _0x58675c;};'use strict';var _=require(_0x550a('0x0'));var util=require(_0x550a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x550a('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x550a('0x3'))(_0x550a('0x4'));var config=require(_0x550a('0x5'));var jayson=require(_0x550a('0x6'));var client=jayson[_0x550a('0x7')][_0x550a('0x8')]({'port':0x232a});config[_0x550a('0x9')]=_[_0x550a('0xa')](config[_0x550a('0x9')],{'host':_0x550a('0xb'),'port':0x18eb});var socket=require(_0x550a('0xc'))(new Redis(config[_0x550a('0x9')]));require(_0x550a('0xd'))['register'](socket);function respondWithRpcPromise(_0x1f584d,_0x13e4f3,_0x2f7cc5){return new BPromise(function(_0x1249d5,_0x3f13f5){return client[_0x550a('0xe')](_0x1f584d,_0x2f7cc5)['then'](function(_0xa6bce5){logger[_0x550a('0xf')](_0x550a('0x10'),_0x13e4f3,_0x550a('0x11'));logger[_0x550a('0x12')](_0x550a('0x13'),_0x13e4f3,_0x550a('0x11'),JSON[_0x550a('0x14')](_0xa6bce5));if(_0xa6bce5['error']){if(_0xa6bce5[_0x550a('0x15')]['code']===0x1f4){logger['error'](_0x550a('0x10'),_0x13e4f3,_0xa6bce5[_0x550a('0x15')]['message']);return _0x3f13f5(_0xa6bce5[_0x550a('0x15')]['message']);}logger[_0x550a('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x13e4f3,_0xa6bce5[_0x550a('0x15')][_0x550a('0x16')]);return _0x1249d5(_0xa6bce5[_0x550a('0x15')][_0x550a('0x16')]);}else{logger[_0x550a('0xf')](_0x550a('0x10'),_0x13e4f3,'request\x20sent');_0x1249d5(_0xa6bce5[_0x550a('0x17')]['message']);}})[_0x550a('0x18')](function(_0x142a9f){logger[_0x550a('0x15')](_0x550a('0x10'),_0x13e4f3,_0x142a9f);_0x3f13f5(_0x142a9f);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 1187141..b13f67c 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 _0x534d=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','update','emit'];(function(_0x354803,_0x3b56d8){var _0x2e30ba=function(_0x24e9b7){while(--_0x24e9b7){_0x354803['push'](_0x354803['shift']());}};_0x2e30ba(++_0x3b56d8);}(_0x534d,0x79));var _0xd534=function(_0x2221c7,_0x221e8d){_0x2221c7=_0x2221c7-0x0;var _0x2f4ce8=_0x534d[_0x2221c7];return _0x2f4ce8;};'use strict';var VoicePrefixEvents=require(_0xd534('0x0'));var events=[_0xd534('0x1'),_0xd534('0x2'),_0xd534('0x3')];function createListener(_0x35088f,_0xedc863){return function(_0x110ae2){_0xedc863[_0xd534('0x4')](_0x35088f,_0x110ae2);};}function removeListener(_0x1479ec,_0x278f6b){return function(){VoicePrefixEvents[_0xd534('0x5')](_0x1479ec,_0x278f6b);};}exports[_0xd534('0x6')]=function(_0x2e9c44){for(var _0x2ebe36=0x0,_0x1db778=events[_0xd534('0x7')];_0x2ebe36<_0x1db778;_0x2ebe36++){var _0x4419ee=events[_0x2ebe36];var _0x1a00af=createListener(_0xd534('0x8')+_0x4419ee,_0x2e9c44);VoicePrefixEvents['on'](_0x4419ee,_0x1a00af);}}; \ No newline at end of file +var _0xad13=['voicePrefix:','./voicePrefix.events','remove','update','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad13,0x79));var _0x3ad1=function(_0x47854e,_0x2a8c38){_0x47854e=_0x47854e-0x0;var _0x27e266=_0xad13[_0x47854e];return _0x27e266;};'use strict';var VoicePrefixEvents=require(_0x3ad1('0x0'));var events=['save',_0x3ad1('0x1'),_0x3ad1('0x2')];function createListener(_0x17f6ee,_0x38bf8c){return function(_0x501af9){_0x38bf8c[_0x3ad1('0x3')](_0x17f6ee,_0x501af9);};}function removeListener(_0x8fd72a,_0x2d59bf){return function(){VoicePrefixEvents[_0x3ad1('0x4')](_0x8fd72a,_0x2d59bf);};}exports[_0x3ad1('0x5')]=function(_0x416e30){for(var _0x42ab5c=0x0,_0x23ed63=events[_0x3ad1('0x6')];_0x42ab5c<_0x23ed63;_0x42ab5c++){var _0x313ad9=events[_0x42ab5c];var _0x4d27b0=createListener(_0x3ad1('0x7')+_0x313ad9,_0x416e30);VoicePrefixEvents['on'](_0x313ad9,_0x4d27b0);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index f216d4b..65a5616 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 _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(_0x494f7f,_0x34a09b){var _0x18ebe4=function(_0x178e2e){while(--_0x178e2e){_0x494f7f['push'](_0x494f7f['shift']());}};_0x18ebe4(++_0x34a09b);}(_0xb10b,0x12a));var _0xbb10=function(_0xd0e677,_0x42939d){_0xd0e677=_0xd0e677-0x0;var _0x18aeb9=_0xb10b[_0xd0e677];return _0x18aeb9;};'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 +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(_0x47f4c2,_0x134e7b){var _0x22c63e=function(_0x5b8572){while(--_0x5b8572){_0x47f4c2['push'](_0x47f4c2['shift']());}};_0x22c63e(++_0x134e7b);}(_0xb10b,0x12a));var _0xbb10=function(_0x2cad1d,_0x95a8c7){_0x2cad1d=_0x2cad1d-0x0;var _0x4a900c=_0xb10b[_0x2cad1d];return _0x4a900c;};'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 a8c3427..6ef7b49 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 _0xd7e0=['#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','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)','#Abandoned\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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','inbound','outbound','ENUM','ringall','leastrecent','fewestcalls','wrandom','rrordered','setDataValue','rrmemory','getDataValue','type','dialMethod','strategy','booked','roundrobin','progressive','predictive','power','INTEGER','yes','once','join','periodic_announce','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','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\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x1c024c,_0x193b17){var _0x58574a=function(_0x3eea2c){while(--_0x3eea2c){_0x1c024c['push'](_0x1c024c['shift']());}};_0x58574a(++_0x193b17);}(_0xd7e0,0xb3));var _0x0d7e=function(_0x315d55,_0x500471){_0x315d55=_0x315d55-0x0;var _0x36b485=_0xd7e0[_0x315d55];return _0x36b485;};'use strict';var Sequelize=require(_0x0d7e('0x0'));module[_0x0d7e('0x1')]={'name':{'type':Sequelize[_0x0d7e('0x2')],'allowNull':![],'unique':_0x0d7e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0d7e('0x4'),_0x0d7e('0x5')),'allowNull':![],'defaultValue':_0x0d7e('0x4')},'musiconhold':{'type':Sequelize[_0x0d7e('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x0d7e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0d7e('0x6')]('rr',_0x0d7e('0x7'),_0x0d7e('0x8'),_0x0d7e('0x9'),'random','rrmemory','linear',_0x0d7e('0xa'),_0x0d7e('0xb')),'allowNull':![],'defaultValue':_0x0d7e('0x7'),'set':function(_0x24f4e1){this[_0x0d7e('0xc')]('strategy',_0x24f4e1?_0x24f4e1:_0x0d7e('0xd'));},'get':function(){var _0x4587f5=this[_0x0d7e('0xe')](_0x0d7e('0xf'));var _0x1abac2=this[_0x0d7e('0xe')](_0x0d7e('0x10'));var _0x5a70a4=this[_0x0d7e('0xe')](_0x0d7e('0x11'));if(_0x4587f5===_0x0d7e('0x4')){return _0x5a70a4;}if(_0x1abac2===_0x0d7e('0x12')&&_0x5a70a4===_0x0d7e('0xd')||_0x1abac2===_0x0d7e('0x12')&&_0x5a70a4===_0x0d7e('0x13')){return _0x5a70a4;}if(_0x1abac2===_0x0d7e('0x14')||_0x1abac2===_0x0d7e('0x15')||_0x1abac2===_0x0d7e('0x16')){return _0x5a70a4;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0d7e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x0d7e('0x17')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x0d7e('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0d7e('0x6')]('yes','no'),'defaultValue':_0x0d7e('0x18')},'autopause':{'type':Sequelize[_0x0d7e('0x6')](_0x0d7e('0x18'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x0d7e('0x6')](_0x0d7e('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0d7e('0x6')](_0x0d7e('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0d7e('0x6')](_0x0d7e('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0d7e('0x6')](_0x0d7e('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0d7e('0x6')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0d7e('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0d7e('0x6')](_0x0d7e('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x0d7e('0x6')](_0x0d7e('0x18'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x0d7e('0x6')](_0x0d7e('0x18'),'no',_0x0d7e('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0d7e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0d7e('0x6')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x0d7e('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0d7e('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0d7e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0d7e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0d7e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x0d7e('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0d7e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0d7e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x0d7e('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0d7e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0d7e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0d7e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0d7e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0d7e('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x0d7e('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x272aa0){this['setDataValue']('periodic_announce',_0x272aa0?_0x272aa0[_0x0d7e('0x1a')](','):[]);},'get':function(){return this['getDataValue'](_0x0d7e('0x1b'))?this['getDataValue'](_0x0d7e('0x1b'))[_0x0d7e('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x0d7e('0x2')],'defaultValue':'yes','set':function(_0x4f9023){this['setDataValue'](_0x0d7e('0x1d'),_0x4f9023?_0x4f9023[_0x0d7e('0x1a')](','):undefined);},'get':function(){return this['getDataValue'](_0x0d7e('0x1d'))?this[_0x0d7e('0xe')](_0x0d7e('0x1d'))[_0x0d7e('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0d7e('0x2')],'defaultValue':'no','set':function(_0x435b83){this[_0x0d7e('0xc')](_0x0d7e('0x1e'),_0x435b83?_0x435b83[_0x0d7e('0x1a')](','):undefined);},'get':function(){return this[_0x0d7e('0xe')]('leavewhenempty')?this[_0x0d7e('0xe')](_0x0d7e('0x1e'))[_0x0d7e('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0d7e('0x6')](_0x0d7e('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x0d7e('0x6')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x0d7e('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0d7e('0x6')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0d7e('0x2')]},'description':{'type':Sequelize[_0x0d7e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0xa1e41){this['setDataValue'](_0x0d7e('0x1f'),_0xa1e41);if(_0xa1e41){if(this['getDataValue'](_0x0d7e('0x20'))<0x2){this[_0x0d7e('0xc')](_0x0d7e('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x0d7e('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0d7e('0x21')],'defaultValue':0x0,'comment':_0x0d7e('0x22')},'dialMethod':{'type':Sequelize[_0x0d7e('0x6')]('preview',_0x0d7e('0x14'),_0x0d7e('0x16'),'predictive',_0x0d7e('0x12')),'defaultValue':_0x0d7e('0x14'),'comment':_0x0d7e('0x23')},'dialLimitChannel':{'type':Sequelize[_0x0d7e('0x17')](0x4)[_0x0d7e('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0d7e('0x25')},'dialLimitQueue':{'type':Sequelize[_0x0d7e('0x17')](0x4)[_0x0d7e('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0d7e('0x26')},'dialPowerLevel':{'type':Sequelize[_0x0d7e('0x27')](0x2)[_0x0d7e('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0d7e('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x0d7e('0x6')]('agentBusyFactor',_0x0d7e('0x29')),'defaultValue':_0x0d7e('0x29'),'comment':_0x0d7e('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x0d7e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0d7e('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x0d7e('0x17')](0x3)[_0x0d7e('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x0d7e('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x0d7e('0x17')](0x3)[_0x0d7e('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d7e('0x2d')},'dialQueueOptions':{'type':Sequelize[_0x0d7e('0x2')],'defaultValue':_0x0d7e('0x2e'),'comment':_0x0d7e('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x0d7e('0x17')](0x3)[_0x0d7e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d7e('0x30')},'dialQueueProject':{'type':Sequelize[_0x0d7e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x0d7e('0x17')](0x3)[_0x0d7e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d7e('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0d7e('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d7e('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0x0d7e('0x17')](0x3)[_0x0d7e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d7e('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0d7e('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d7e('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0d7e('0x24')],'defaultValue':0x3,'comment':_0x0d7e('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0d7e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x0d7e('0x17')](0x3)[_0x0d7e('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x0d7e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0d7e('0x2')],'defaultValue':_0x0d7e('0x36')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x0d7e('0x6')]('always','never',_0x0d7e('0x37')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0d7e('0x21')],'defaultValue':0x0,'comment':_0x0d7e('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0x0d7e('0x17')](0x9)[_0x0d7e('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0d7e('0x39')},'dialAMDGreeting':{'type':Sequelize[_0x0d7e('0x17')](0x9)[_0x0d7e('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0d7e('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0d7e('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0d7e('0x17')](0x9)[_0x0d7e('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0d7e('0x3c')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0d7e('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0d7e('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0d7e('0x17')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0d7e('0x17')](0x9)[_0x0d7e('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x0d7e('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0d7e('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0d7e('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0d7e('0x3f')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x0d7e('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0d7e('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x0d7e('0x21')],'defaultValue':0x0,'comment':_0x0d7e('0x41')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0d7e('0x42')),'defaultValue':_0x0d7e('0x43')},'dialQueueProject2':{'type':Sequelize[_0x0d7e('0x2')],'comment':_0x0d7e('0x44')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0d7e('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0d7e('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0d7e('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0d7e('0x45')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0d7e('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0d7e('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0d7e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d7e('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0d7e('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d7e('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0x0d7e('0x17')](0x3)[_0x0d7e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0d7e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0d7e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d7e('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0d7e('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d7e('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0d7e('0x17')](0x5)[_0x0d7e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d7e('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0d7e('0x17')](0x3)[_0x0d7e('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0d7e('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0d7e('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0d7e('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0d7e('0x17')],'allowNull':!![],'comment':_0x0d7e('0x4e')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x588b38){if(!_0x588b38)this[_0x0d7e('0xc')](_0x0d7e('0x4f'),null);this[_0x0d7e('0xc')](_0x0d7e('0x50'),_0x588b38);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0d7e('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x0d7e('0x17')](0x3)[_0x0d7e('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x0d7e('0x21')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xf97b=['type','dialMethod','booked','predictive','power','INTEGER','yes','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#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,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#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)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','default','leastrecent','fewestcalls','random','linear','wrandom','rrordered','ringall','setDataValue','strategy','rrmemory','getDataValue'];(function(_0x54d0a3,_0x5d25b2){var _0x2d79c9=function(_0x11a14e){while(--_0x11a14e){_0x54d0a3['push'](_0x54d0a3['shift']());}};_0x2d79c9(++_0x5d25b2);}(_0xf97b,0x97));var _0xbf97=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xf97b[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0xbf97('0x0'));module['exports']={'name':{'type':Sequelize[_0xbf97('0x1')],'allowNull':![],'unique':_0xbf97('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x4'),'outbound'),'allowNull':![],'defaultValue':_0xbf97('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xbf97('0x5')},'announce':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xbf97('0x3')]('rr','ringall',_0xbf97('0x6'),_0xbf97('0x7'),_0xbf97('0x8'),'rrmemory',_0xbf97('0x9'),_0xbf97('0xa'),_0xbf97('0xb')),'allowNull':![],'defaultValue':_0xbf97('0xc'),'set':function(_0x23d78b){this[_0xbf97('0xd')](_0xbf97('0xe'),_0x23d78b?_0x23d78b:_0xbf97('0xf'));},'get':function(){var _0x4d6377=this[_0xbf97('0x10')](_0xbf97('0x11'));var _0x11872e=this['getDataValue'](_0xbf97('0x12'));var _0x128c48=this['getDataValue'](_0xbf97('0xe'));if(_0x4d6377==='inbound'){return _0x128c48;}if(_0x11872e==='booked'&&_0x128c48==='rrmemory'||_0x11872e===_0xbf97('0x13')&&_0x128c48==='roundrobin'){return _0x128c48;}if(_0x11872e==='progressive'||_0x11872e===_0xbf97('0x14')||_0x11872e===_0xbf97('0x15')){return _0x128c48;}return null;}},'servicelevel':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xbf97('0x16')](0xb)},'timeout':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xbf97('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xbf97('0x3')]('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xbf97('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xbf97('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xbf97('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xbf97('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xbf97('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xbf97('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defaultValue':_0xbf97('0x17')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xbf97('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0xbf97('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xbf97('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xbf97('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xbf97('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xbf97('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xbf97('0x1')]},'queue_less_than':{'type':Sequelize[_0xbf97('0x1')]},'periodic_announce':{'type':Sequelize[_0xbf97('0x18')],'set':function(_0x2931cf){this['setDataValue']('periodic_announce',_0x2931cf?_0x2931cf[_0xbf97('0x19')](','):[]);},'get':function(){return this[_0xbf97('0x10')]('periodic_announce')?this[_0xbf97('0x10')](_0xbf97('0x1a'))[_0xbf97('0x1b')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xbf97('0x17'),'set':function(_0xa6d53d){this[_0xbf97('0xd')]('joinempty',_0xa6d53d?_0xa6d53d[_0xbf97('0x19')](','):undefined);},'get':function(){return this[_0xbf97('0x10')]('joinempty')?this[_0xbf97('0x10')](_0xbf97('0x1c'))[_0xbf97('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':'no','set':function(_0x57ed47){this['setDataValue'](_0xbf97('0x1d'),_0x57ed47?_0x57ed47[_0xbf97('0x19')](','):undefined);},'get':function(){return this[_0xbf97('0x10')](_0xbf97('0x1d'))?this[_0xbf97('0x10')](_0xbf97('0x1d'))[_0xbf97('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbf97('0x1')]},'acw':{'type':Sequelize[_0xbf97('0x1e')],'defaultValue':0x0,'set':function(_0x1595cb){this[_0xbf97('0xd')](_0xbf97('0x1f'),_0x1595cb);if(_0x1595cb){if(this[_0xbf97('0x10')]('wrapuptime')<0x2){this[_0xbf97('0xd')](_0xbf97('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xbf97('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xbf97('0x21')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0xbf97('0x22'),_0xbf97('0x15'),_0xbf97('0x14'),_0xbf97('0x13')),'defaultValue':_0xbf97('0x22'),'comment':_0xbf97('0x23')},'dialLimitChannel':{'type':Sequelize[_0xbf97('0x16')](0x4)[_0xbf97('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xbf97('0x16')](0x4)[_0xbf97('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbf97('0x25')},'dialPowerLevel':{'type':Sequelize[_0xbf97('0x26')](0x2)[_0xbf97('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xbf97('0x27')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xbf97('0x28'),_0xbf97('0x29')),'defaultValue':_0xbf97('0x29'),'comment':_0xbf97('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xbf97('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xbf97('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0xbf97('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xbf97('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':_0xbf97('0x2e'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x2f')},'dialQueueProject':{'type':Sequelize[_0xbf97('0x1')],'comment':_0xbf97('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0xbf97('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0xbf97('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xbf97('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xbf97('0x16')](0x5)[_0xbf97('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbf97('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xbf97('0x35')},'dialTimezone':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':_0xbf97('0x36')},'dialPrefix':{'type':Sequelize[_0xbf97('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xbf97('0x3')]('always',_0xbf97('0x37'),_0xbf97('0x38')),'defaultValue':_0xbf97('0x39')},'dialAMDActive':{'type':Sequelize[_0xbf97('0x1e')],'defaultValue':0x0,'comment':_0xbf97('0x3a')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xbf97('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xbf97('0x3b')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xbf97('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbf97('0x16')](0x9)[_0xbf97('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xbf97('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xbf97('0x16')](0x9)[_0xbf97('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbf97('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xbf97('0x16')](0x9)[_0xbf97('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xbf97('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xbf97('0x16')](0x9)[_0xbf97('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xbf97('0x16')](0x9)[_0xbf97('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xbf97('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xbf97('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xbf97('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xbf97('0x16')](0x9)[_0xbf97('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbf97('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0xbf97('0x16')](0x5)[_0xbf97('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xbf97('0x42')},'dialRecallInQueue':{'type':Sequelize[_0xbf97('0x1e')],'defaultValue':0x0,'comment':_0xbf97('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0xbf97('0x3')](_0xbf97('0x44'),_0xbf97('0x45')),'defaultValue':_0xbf97('0x44')},'dialQueueProject2':{'type':Sequelize[_0xbf97('0x1')],'comment':_0xbf97('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xbf97('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbf97('0x46')},'dialCutDigit':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbf97('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbf97('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x4a')},'dialDropRetryFrequency':{'type':Sequelize[_0xbf97('0x16')](0x5)[_0xbf97('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbf97('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0xbf97('0x16')](0x5)[_0xbf97('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbf97('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xbf97('0x16')](0x3)[_0xbf97('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbf97('0x4f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xbf97('0x16')](0x5)[_0xbf97('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbf97('0x50')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbf97('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xbf97('0x1e')],'defaultValue':![],'comment':_0xbf97('0x51'),'set':function(_0xd5cc7){if(!_0xd5cc7)this[_0xbf97('0xd')](_0xbf97('0x52'),null);this[_0xbf97('0xd')](_0xbf97('0x53'),_0xd5cc7);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xbf97('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xbf97('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xbf97('0x1e')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index d53b484..5904775 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 _0x731d=['order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','VoiceQueues','UserProfileSection','getHoppers','findOne','pick','CmHopper','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','voicePause','interface','flatMap','penalty','each','TeamVoiceQueue','upsert','UserVoiceQueue','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','includes','all','union','transaction','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','isNil','isArray','User','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','insert','into','fromQuery','phone','scheduledAt','ContactId','CmListId','ListId','NOW()','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','cm_contacts','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','inbound','QueueCampaigns','filter','ignore','map','value','type','find','name','UserProfileResource','stack','send','VoiceQueue','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x731d,0x12f));var _0xd731=function(_0x829333,_0x3f4849){_0x829333=_0x829333-0x0;var _0x417c8a=_0x731d[_0x829333];return _0x417c8a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd731('0x0'));var zipdir=require(_0xd731('0x1'));var jsonpatch=require(_0xd731('0x2'));var rp=require(_0xd731('0x3'));var moment=require('moment');var BPromise=require(_0xd731('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd731('0x5'));var csv=require(_0xd731('0x6'));var ejs=require(_0xd731('0x7'));var fs=require('fs');var fs_extra=require(_0xd731('0x8'));var _=require(_0xd731('0x9'));var squel=require('squel');var crypto=require(_0xd731('0xa'));var jsforce=require(_0xd731('0xb'));var deskjs=require(_0xd731('0xc'));var toCsv=require(_0xd731('0x6'));var querystring=require(_0xd731('0xd'));var Papa=require('papaparse');var Redis=require(_0xd731('0xe'));var authService=require(_0xd731('0xf'));var qs=require(_0xd731('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd731('0x11'));var logger=require(_0xd731('0x12'))(_0xd731('0x13'));var utils=require(_0xd731('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd731('0x15'));var db=require(_0xd731('0x16'))['db'];config[_0xd731('0x17')]=_[_0xd731('0x18')](config['redis'],{'host':_0xd731('0x19'),'port':0x18eb});var socket=require(_0xd731('0x1a'))(new Redis(config[_0xd731('0x17')]));require(_0xd731('0x1b'))[_0xd731('0x1c')](socket);function respondWithStatusCode(_0x481a6f,_0x4f1218){_0x4f1218=_0x4f1218||0xcc;return function(_0x52a94){if(_0x52a94){return _0x481a6f[_0xd731('0x1d')](_0x4f1218);}return _0x481a6f[_0xd731('0x1e')](_0x4f1218)[_0xd731('0x1f')]();};}function respondWithResult(_0x57df77,_0x5e92bf){_0x5e92bf=_0x5e92bf||0xc8;return function(_0x2ba2dd){if(_0x2ba2dd){return _0x57df77[_0xd731('0x1e')](_0x5e92bf)[_0xd731('0x20')](_0x2ba2dd);}};}function respondWithFilteredResult(_0x29de34,_0x23ee12){return function(_0x1c6adf){if(_0x1c6adf){var _0x58600b=typeof _0x23ee12['offset']===_0xd731('0x21')&&typeof _0x23ee12[_0xd731('0x22')]==='undefined';var _0x5c5672=_0x1c6adf['count'];var _0x53e968=_0x58600b?0x0:_0x23ee12[_0xd731('0x23')];var _0x33ab1e=_0x58600b?_0x1c6adf[_0xd731('0x24')]:_0x23ee12[_0xd731('0x23')]+_0x23ee12[_0xd731('0x22')];var _0x7d4646;if(_0x33ab1e>=_0x5c5672){_0x33ab1e=_0x5c5672;_0x7d4646=0xc8;}else{_0x7d4646=0xce;}_0x29de34[_0xd731('0x1e')](_0x7d4646);return _0x29de34[_0xd731('0x25')](_0xd731('0x26'),_0x53e968+'-'+_0x33ab1e+'/'+_0x5c5672)[_0xd731('0x20')](_0x1c6adf);}return null;};}function patchUpdates(_0x2afc90){return function(_0x420676){try{jsonpatch['apply'](_0x420676,_0x2afc90,!![]);}catch(_0x24bc8c){return BPromise[_0xd731('0x27')](_0x24bc8c);}return _0x420676[_0xd731('0x28')]();};}function saveUpdates(_0x125481,_0x212167){return function(_0x25f885){if(_0x25f885){return _0x25f885[_0xd731('0x29')](_0x125481)[_0xd731('0x2a')](function(_0x341a6d){return _0x341a6d;});}return null;};}function removeEntity(_0x5f40a1,_0x1455b0){return function(_0x398327){if(_0x398327){return _0x398327[_0xd731('0x2b')]()[_0xd731('0x2a')](function(){var _0x147a9a=_0x398327['get']({'plain':!![]});var _0x458bd5=[{'name':'VoiceQueues','value':_0xd731('0x2c'),'ignore':![]},{'name':_0xd731('0x2d'),'value':'outbound','ignore':![]}];var _0x1336c0=_(_0x458bd5)[_0xd731('0x2e')](_0xd731('0x2f'))[_0xd731('0x30')]('value')[_0xd731('0x31')]();if(_['includes'](_0x1336c0,_0x147a9a[_0xd731('0x32')])){return;}var _0x53a740=_[_0xd731('0x33')](_0x458bd5,[_0xd731('0x31'),_0x147a9a[_0xd731('0x32')]])[_0xd731('0x34')];return db[_0xd731('0x35')][_0xd731('0x2b')]({'where':{'type':_0x53a740,'resourceId':_0x147a9a['id']}})[_0xd731('0x2a')](function(){return _0x398327;});})[_0xd731('0x2a')](function(){_0x5f40a1['status'](0xcc)[_0xd731('0x1f')]();});}};}function handleEntityNotFound(_0x4d0bc7,_0x3056aa){return function(_0x65fd45){if(!_0x65fd45){_0x4d0bc7[_0xd731('0x1d')](0x194);}return _0x65fd45;};}function handleError(_0x47f235,_0x5243b8){_0x5243b8=_0x5243b8||0x1f4;return function(_0x4ab8a5){logger['error'](_0x4ab8a5[_0xd731('0x36')]);if(_0x4ab8a5[_0xd731('0x34')]){delete _0x4ab8a5[_0xd731('0x34')];}_0x47f235[_0xd731('0x1e')](_0x5243b8)[_0xd731('0x37')](_0x4ab8a5);};}exports['index']=function(_0x46647f,_0xefa587){var _0x29a59b={},_0x32ecfa={},_0x4c06c6={'count':0x0,'rows':[]};var _0x56a892=_['map'](db[_0xd731('0x38')][_0xd731('0x39')],function(_0x39a6c6){return{'name':_0x39a6c6[_0xd731('0x3a')],'type':_0x39a6c6[_0xd731('0x32')]['key']};});_0x32ecfa[_0xd731('0x3b')]=_[_0xd731('0x30')](_0x56a892,_0xd731('0x34'));_0x32ecfa['query']=_[_0xd731('0x3c')](_0x46647f[_0xd731('0x3d')]);_0x32ecfa[_0xd731('0x3e')]=_[_0xd731('0x3f')](_0x32ecfa[_0xd731('0x3b')],_0x32ecfa[_0xd731('0x3d')]);_0x29a59b[_0xd731('0x40')]=_[_0xd731('0x3f')](_0x32ecfa[_0xd731('0x3b')],qs[_0xd731('0x41')](_0x46647f['query']['fields']));_0x29a59b[_0xd731('0x40')]=_0x29a59b[_0xd731('0x40')][_0xd731('0x42')]?_0x29a59b['attributes']:_0x32ecfa[_0xd731('0x3b')];if(!_0x46647f[_0xd731('0x3d')][_0xd731('0x43')](_0xd731('0x44'))){_0x29a59b[_0xd731('0x22')]=qs['limit'](_0x46647f[_0xd731('0x3d')][_0xd731('0x22')]);_0x29a59b[_0xd731('0x23')]=qs[_0xd731('0x23')](_0x46647f[_0xd731('0x3d')][_0xd731('0x23')]);}_0x29a59b[_0xd731('0x45')]=qs['sort'](_0x46647f[_0xd731('0x3d')][_0xd731('0x46')]);_0x29a59b[_0xd731('0x47')]=qs['filters'](_['pick'](_0x46647f[_0xd731('0x3d')],_0x32ecfa[_0xd731('0x3e')]),_0x56a892);if(_0x46647f[_0xd731('0x3d')]['filter']){_0x29a59b['where']=_[_0xd731('0x48')](_0x29a59b[_0xd731('0x47')],{'$or':_[_0xd731('0x30')](_0x56a892,function(_0x4aa67c){if(_0x4aa67c['type']!==_0xd731('0x49')){var _0x45a316={};_0x45a316[_0x4aa67c[_0xd731('0x34')]]={'$like':'%'+_0x46647f[_0xd731('0x3d')]['filter']+'%'};return _0x45a316;}})});}_0x29a59b=_['merge']({},_0x29a59b,_0x46647f[_0xd731('0x4a')]);var _0x4cd2d1={'where':_0x29a59b[_0xd731('0x47')]};return db[_0xd731('0x38')][_0xd731('0x24')](_0x4cd2d1)[_0xd731('0x2a')](function(_0x23b708){_0x4c06c6['count']=_0x23b708;if(_0x46647f[_0xd731('0x3d')][_0xd731('0x4b')]){_0x29a59b[_0xd731('0x4c')]=[{'all':!![]}];}return db[_0xd731('0x38')][_0xd731('0x4d')](_0x29a59b);})['then'](function(_0xc3d6ee){_0x4c06c6[_0xd731('0x4e')]=_0xc3d6ee;return _0x4c06c6;})[_0xd731('0x2a')](respondWithFilteredResult(_0xefa587,_0x29a59b))[_0xd731('0x4f')](handleError(_0xefa587,null));};exports[_0xd731('0x50')]=function(_0x4f1370,_0x2a696e){var _0x3f78ad={'raw':![],'where':{'id':_0x4f1370[_0xd731('0x51')]['id']}},_0x223dd6={};_0x223dd6[_0xd731('0x3b')]=_['keys'](db[_0xd731('0x38')]['rawAttributes']);_0x223dd6[_0xd731('0x3d')]=_[_0xd731('0x3c')](_0x4f1370[_0xd731('0x3d')]);_0x223dd6[_0xd731('0x3e')]=_[_0xd731('0x3f')](_0x223dd6['model'],_0x223dd6['query']);_0x3f78ad[_0xd731('0x40')]=_[_0xd731('0x3f')](_0x223dd6['model'],qs[_0xd731('0x41')](_0x4f1370[_0xd731('0x3d')][_0xd731('0x41')]));_0x3f78ad[_0xd731('0x40')]=_0x3f78ad[_0xd731('0x40')][_0xd731('0x42')]?_0x3f78ad[_0xd731('0x40')]:_0x223dd6['model'];if(_0x4f1370['query'][_0xd731('0x4b')]){_0x3f78ad[_0xd731('0x4c')]=[{'all':!![]}];}_0x3f78ad=_[_0xd731('0x48')]({},_0x3f78ad,_0x4f1370[_0xd731('0x4a')]);return db[_0xd731('0x38')]['find'](_0x3f78ad)[_0xd731('0x2a')](handleEntityNotFound(_0x2a696e,null))[_0xd731('0x2a')](respondWithResult(_0x2a696e,null))[_0xd731('0x4f')](handleError(_0x2a696e,null));};exports[_0xd731('0x52')]=function(_0x139018,_0x181082){return db[_0xd731('0x38')][_0xd731('0x52')](_0x139018['body'],{})[_0xd731('0x2a')](function(_0x33cd9b){var _0x2514c6=_0x139018[_0xd731('0x53')][_0xd731('0x54')]({'plain':!![]});if(!_0x2514c6)throw new Error(_0xd731('0x55'));if(_0x2514c6[_0xd731('0x56')]===_0xd731('0x53')){var _0x56bee8=_0x33cd9b['get']({'plain':!![]});var _0x45c5c2=[{'name':'VoiceQueues','value':_0xd731('0x2c')},{'name':'QueueCampaigns','value':_0xd731('0x57')}];var _0x376837=_[_0xd731('0x33')](_0x45c5c2,[_0xd731('0x31'),_0x56bee8['type']])[_0xd731('0x34')];return db['UserProfileSection'][_0xd731('0x33')]({'where':{'name':_0x376837,'userProfileId':_0x2514c6[_0xd731('0x58')]},'raw':!![]})[_0xd731('0x2a')](function(_0x43d457){if(_0x43d457&&_0x43d457['autoAssociation']===0x0){return db[_0xd731('0x35')][_0xd731('0x52')]({'name':_0x56bee8[_0xd731('0x34')],'resourceId':_0x56bee8['id'],'type':_0x43d457[_0xd731('0x34')],'sectionId':_0x43d457['id']},{})['then'](function(){return _0x33cd9b;});}else{return _0x33cd9b;}})[_0xd731('0x4f')](function(_0x43d55b){logger[_0xd731('0x59')](_0xd731('0x5a'),_0x43d55b);throw _0x43d55b;});}return _0x33cd9b;})['then'](respondWithResult(_0x181082,0xc9))[_0xd731('0x4f')](handleError(_0x181082,null));};exports[_0xd731('0x5b')]=function(_0x607cef,_0x3a19dc){var _0x45064a={'where':{'id':_0x607cef[_0xd731('0x51')]['id']}},_0x34aa87={};_0x34aa87[_0xd731('0x3b')]=_[_0xd731('0x3c')](db[_0xd731('0x38')][_0xd731('0x39')]);_0x45064a['attributes']=_['intersection'](_0x34aa87[_0xd731('0x3b')],qs[_0xd731('0x41')](_0x607cef[_0xd731('0x3d')][_0xd731('0x41')]));_0x45064a[_0xd731('0x40')]=_0x45064a['attributes'][_0xd731('0x42')]?_0x45064a[_0xd731('0x40')]:_0x34aa87['model'];if(_0x607cef[_0xd731('0x3d')][_0xd731('0x4b')]){_0x45064a[_0xd731('0x4c')]=[{'all':!![]}];}_0x45064a=_['merge']({},_0x45064a,_0x607cef[_0xd731('0x4a')]);return db[_0xd731('0x38')][_0xd731('0x33')](_0x45064a)[_0xd731('0x2a')](handleEntityNotFound(_0x3a19dc,null))[_0xd731('0x2a')](function(_0x2496f8){if(_0x2496f8){var _0x4f07ad=_0x2496f8[_0xd731('0x54')]({'plain':!![]});_0x4f07ad=qs[_0xd731('0x5c')](_0x4f07ad,['id',_0xd731('0x5d'),_0xd731('0x5e')]);_0x607cef[_0xd731('0x5f')]=_[_0xd731('0x5c')](_0x607cef['body'],['id',_0xd731('0x5d'),_0xd731('0x5e')]);return db[_0xd731('0x38')][_0xd731('0x52')](_[_0xd731('0x48')](_0x4f07ad,_0x607cef[_0xd731('0x5f')]),{'include':_0x607cef[_0xd731('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xd731('0x2a')](function(_0x398fee){var _0x178951=_0x607cef[_0xd731('0x53')]['get']({'plain':!![]});if(!_0x178951)throw new Error(_0xd731('0x55'));if(_0x178951[_0xd731('0x56')]===_0xd731('0x53')){var _0x3bc2fd=_0x398fee[_0xd731('0x54')]({'plain':!![]});var _0x49a81e=[{'name':_0xd731('0x60'),'value':_0xd731('0x2c')},{'name':'QueueCampaigns','value':'outbound'}];var _0x40f566=_[_0xd731('0x33')](_0x49a81e,[_0xd731('0x31'),_0x3bc2fd[_0xd731('0x32')]])[_0xd731('0x34')];return db[_0xd731('0x61')]['find']({'where':{'name':_0x40f566,'userProfileId':_0x178951[_0xd731('0x58')]},'raw':!![]})[_0xd731('0x2a')](function(_0x278e02){if(_0x278e02&&_0x278e02['autoAssociation']===0x0){return db[_0xd731('0x35')][_0xd731('0x52')]({'name':_0x3bc2fd[_0xd731('0x34')],'resourceId':_0x3bc2fd['id'],'type':_0x278e02[_0xd731('0x34')],'sectionId':_0x278e02['id']},{})[_0xd731('0x2a')](function(){return _0x398fee;});}else{return _0x398fee;}})['catch'](function(_0x149e6b){logger[_0xd731('0x59')](_0xd731('0x5a'),_0x149e6b);throw _0x149e6b;});}return _0x398fee;});}})[_0xd731('0x2a')](respondWithResult(_0x3a19dc,0xc9))[_0xd731('0x4f')](handleError(_0x3a19dc,null));};exports['update']=function(_0x242eb8,_0x4bb1bf){if(_0x242eb8[_0xd731('0x5f')]['id']){delete _0x242eb8[_0xd731('0x5f')]['id'];}return db[_0xd731('0x38')]['find']({'where':{'id':_0x242eb8[_0xd731('0x51')]['id']}})[_0xd731('0x2a')](handleEntityNotFound(_0x4bb1bf,null))[_0xd731('0x2a')](saveUpdates(_0x242eb8[_0xd731('0x5f')],null))[_0xd731('0x2a')](respondWithResult(_0x4bb1bf,null))[_0xd731('0x4f')](handleError(_0x4bb1bf,null));};exports['destroy']=function(_0x673939,_0x2c9c3e){return db['VoiceQueue'][_0xd731('0x33')]({'where':{'id':_0x673939[_0xd731('0x51')]['id']}})['then'](handleEntityNotFound(_0x2c9c3e,null))[_0xd731('0x2a')](removeEntity(_0x2c9c3e,null))[_0xd731('0x4f')](handleError(_0x2c9c3e,null));};exports[_0xd731('0x62')]=function(_0x92ada9,_0x1fe254,_0x157b13){var _0x3a085b={'raw':![],'where':{}};var _0x3a0cd6={};var _0x5a90f2={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd731('0x63')]({'where':{'id':_0x92ada9[_0xd731('0x51')]['id']}})[_0xd731('0x2a')](handleEntityNotFound(_0x1fe254,null))[_0xd731('0x2a')](function(_0x225ab5){if(_0x225ab5){_0x3a0cd6[_0xd731('0x3b')]=_[_0xd731('0x3c')](db['CmHopper'][_0xd731('0x39')]);_0x3a0cd6['query']=_[_0xd731('0x3c')](_0x92ada9[_0xd731('0x3d')]);_0x3a0cd6['filters']=_[_0xd731('0x3f')](_0x3a0cd6[_0xd731('0x3b')],_0x3a0cd6[_0xd731('0x3d')]);_0x3a085b['attributes']=_[_0xd731('0x3f')](_0x3a0cd6['model'],qs[_0xd731('0x41')](_0x92ada9[_0xd731('0x3d')][_0xd731('0x41')]));_0x3a085b[_0xd731('0x40')]=_0x3a085b[_0xd731('0x40')][_0xd731('0x42')]?_0x3a085b['attributes']:_0x3a0cd6[_0xd731('0x3b')];if(!_0x92ada9[_0xd731('0x3d')][_0xd731('0x43')]('nolimit')){_0x3a085b[_0xd731('0x22')]=qs[_0xd731('0x22')](_0x92ada9['query'][_0xd731('0x22')]);_0x3a085b[_0xd731('0x23')]=qs[_0xd731('0x23')](_0x92ada9['query'][_0xd731('0x23')]);}_0x3a085b[_0xd731('0x45')]=qs[_0xd731('0x46')](_0x92ada9['query']['sort']);_0x3a085b['where']=qs[_0xd731('0x3e')](_[_0xd731('0x64')](_0x92ada9['query'],_0x3a0cd6['filters']));_0x3a085b[_0xd731('0x47')]['VoiceQueueId']=_0x225ab5['id'];if(_0x92ada9['query'][_0xd731('0x2e')]){_0x3a085b[_0xd731('0x47')]=_['merge'](_0x3a085b[_0xd731('0x47')],{'$or':_['map'](_0x3a085b['attributes'],function(_0x484992){var _0xf528e1={};_0xf528e1[_0x484992]={'$like':'%'+_0x92ada9[_0xd731('0x3d')][_0xd731('0x2e')]+'%'};return _0xf528e1;})});}_0x3a085b=_[_0xd731('0x48')]({},_0x3a085b,_0x92ada9['options']);return db[_0xd731('0x65')]['count']({'where':_0x3a085b[_0xd731('0x47')]})[_0xd731('0x2a')](function(_0x254e11){_0x5a90f2['count']=_0x254e11;if(_0x92ada9['query'][_0xd731('0x4b')]){_0x3a085b[_0xd731('0x4c')]=[{'all':!![]}];}return db['CmHopper'][_0xd731('0x4d')](_0x3a085b);})[_0xd731('0x2a')](function(_0x19d9c9){_0x5a90f2['rows']=_0x19d9c9;return _0x5a90f2;});}})[_0xd731('0x2a')](respondWithFilteredResult(_0x1fe254,_0x3a085b))[_0xd731('0x4f')](handleError(_0x1fe254,null));};exports[_0xd731('0x66')]=function(_0x40e4d4,_0x3f3207,_0x15fa43){var _0xfe4644={'raw':!![],'where':{}};var _0x53b530={};var _0x12837e={'count':0x0,'rows':[]};return db[_0xd731('0x38')][_0xd731('0x63')]({'where':{'id':_0x40e4d4['params']['id']}})['then'](handleEntityNotFound(_0x3f3207,null))[_0xd731('0x2a')](function(_0xd7a032){if(_0xd7a032){_0x53b530[_0xd731('0x3b')]=_[_0xd731('0x3c')](db[_0xd731('0x67')]['rawAttributes']);_0x53b530[_0xd731('0x3d')]=_['keys'](_0x40e4d4[_0xd731('0x3d')]);_0x53b530[_0xd731('0x3e')]=_[_0xd731('0x3f')](_0x53b530['model'],_0x53b530[_0xd731('0x3d')]);_0xfe4644[_0xd731('0x40')]=_[_0xd731('0x3f')](_0x53b530[_0xd731('0x3b')],qs[_0xd731('0x41')](_0x40e4d4['query'][_0xd731('0x41')]));_0xfe4644[_0xd731('0x40')]=_0xfe4644[_0xd731('0x40')][_0xd731('0x42')]?_0xfe4644[_0xd731('0x40')]:_0x53b530['model'];if(!_0x40e4d4[_0xd731('0x3d')][_0xd731('0x43')](_0xd731('0x44'))){_0xfe4644['limit']=qs['limit'](_0x40e4d4[_0xd731('0x3d')][_0xd731('0x22')]);_0xfe4644[_0xd731('0x23')]=qs[_0xd731('0x23')](_0x40e4d4[_0xd731('0x3d')][_0xd731('0x23')]);}_0xfe4644[_0xd731('0x45')]=qs[_0xd731('0x46')](_0x40e4d4[_0xd731('0x3d')][_0xd731('0x46')]);_0xfe4644[_0xd731('0x47')]=qs[_0xd731('0x3e')](_[_0xd731('0x64')](_0x40e4d4[_0xd731('0x3d')],_0x53b530[_0xd731('0x3e')]));_0xfe4644['where'][_0xd731('0x68')]=_0xd7a032['id'];if(_0x40e4d4[_0xd731('0x3d')]['filter']){_0xfe4644[_0xd731('0x47')]=_[_0xd731('0x48')](_0xfe4644[_0xd731('0x47')],{'$or':_[_0xd731('0x30')](_0xfe4644[_0xd731('0x40')],function(_0x364c87){var _0x26c652={};_0x26c652[_0x364c87]={'$like':'%'+_0x40e4d4[_0xd731('0x3d')][_0xd731('0x2e')]+'%'};return _0x26c652;})});}_0xfe4644=_[_0xd731('0x48')]({},_0xfe4644,_0x40e4d4[_0xd731('0x4a')]);return db[_0xd731('0x67')][_0xd731('0x24')]({'where':_0xfe4644[_0xd731('0x47')]})[_0xd731('0x2a')](function(_0x1f8246){_0x12837e['count']=_0x1f8246;if(_0x40e4d4[_0xd731('0x3d')][_0xd731('0x4b')]){_0xfe4644[_0xd731('0x4c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xd731('0x4d')](_0xfe4644);})['then'](function(_0x31a9fa){_0x12837e[_0xd731('0x4e')]=_0x31a9fa;return _0x12837e;});}})['then'](respondWithFilteredResult(_0x3f3207,_0xfe4644))[_0xd731('0x4f')](handleError(_0x3f3207,null));};exports[_0xd731('0x69')]=function(_0x355094,_0x51d27d,_0xdc2a84){var _0x42d67f={'raw':!![],'where':{}};var _0x495883={};var _0x2379dc={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd731('0x63')]({'where':{'id':_0x355094[_0xd731('0x51')]['id']}})[_0xd731('0x2a')](handleEntityNotFound(_0x51d27d,null))[_0xd731('0x2a')](function(_0x2159da){if(_0x2159da){_0x495883[_0xd731('0x3b')]=_[_0xd731('0x3c')](db[_0xd731('0x6a')][_0xd731('0x39')]);_0x495883['query']=_[_0xd731('0x3c')](_0x355094[_0xd731('0x3d')]);_0x495883[_0xd731('0x3e')]=_[_0xd731('0x3f')](_0x495883[_0xd731('0x3b')],_0x495883['query']);_0x42d67f[_0xd731('0x40')]=_[_0xd731('0x3f')](_0x495883['model'],qs[_0xd731('0x41')](_0x355094[_0xd731('0x3d')][_0xd731('0x41')]));_0x42d67f[_0xd731('0x40')]=_0x42d67f[_0xd731('0x40')]['length']?_0x42d67f[_0xd731('0x40')]:_0x495883['model'];if(!_0x355094[_0xd731('0x3d')][_0xd731('0x43')](_0xd731('0x44'))){_0x42d67f[_0xd731('0x22')]=qs[_0xd731('0x22')](_0x355094[_0xd731('0x3d')][_0xd731('0x22')]);_0x42d67f[_0xd731('0x23')]=qs[_0xd731('0x23')](_0x355094[_0xd731('0x3d')][_0xd731('0x23')]);}_0x42d67f['order']=qs['sort'](_0x355094[_0xd731('0x3d')]['sort']);_0x42d67f['where']=qs['filters'](_[_0xd731('0x64')](_0x355094[_0xd731('0x3d')],_0x495883[_0xd731('0x3e')]));_0x42d67f[_0xd731('0x47')][_0xd731('0x68')]=_0x2159da['id'];if(_0x355094[_0xd731('0x3d')][_0xd731('0x2e')]){_0x42d67f[_0xd731('0x47')]=_['merge'](_0x42d67f[_0xd731('0x47')],{'$or':_[_0xd731('0x30')](_0x42d67f[_0xd731('0x40')],function(_0x23619a){var _0x251f53={};_0x251f53[_0x23619a]={'$like':'%'+_0x355094[_0xd731('0x3d')][_0xd731('0x2e')]+'%'};return _0x251f53;})});}_0x42d67f=_[_0xd731('0x48')]({},_0x42d67f,_0x355094[_0xd731('0x4a')]);return db[_0xd731('0x6a')]['count']({'where':_0x42d67f['where']})[_0xd731('0x2a')](function(_0x290bb4){_0x2379dc[_0xd731('0x24')]=_0x290bb4;if(_0x355094[_0xd731('0x3d')][_0xd731('0x4b')]){_0x42d67f[_0xd731('0x4c')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x42d67f);})[_0xd731('0x2a')](function(_0xfb1eae){_0x2379dc[_0xd731('0x4e')]=_0xfb1eae;return _0x2379dc;});}})[_0xd731('0x2a')](respondWithFilteredResult(_0x51d27d,_0x42d67f))[_0xd731('0x4f')](handleError(_0x51d27d,null));};exports[_0xd731('0x6b')]=function(_0x2a4b35,_0x1752eb,_0x4ac71d){var _0x1db23e={'raw':!![],'where':{}};var _0x22e139={};var _0x3f0879={'count':0x0,'rows':[]};return db[_0xd731('0x38')]['findOne']({'where':{'id':_0x2a4b35[_0xd731('0x51')]['id']}})[_0xd731('0x2a')](handleEntityNotFound(_0x1752eb,null))[_0xd731('0x2a')](function(_0x5b8eba){if(_0x5b8eba){_0x22e139['model']=_[_0xd731('0x3c')](db[_0xd731('0x6c')]['rawAttributes']);_0x22e139[_0xd731('0x3d')]=_[_0xd731('0x3c')](_0x2a4b35[_0xd731('0x3d')]);_0x22e139['filters']=_[_0xd731('0x3f')](_0x22e139[_0xd731('0x3b')],_0x22e139[_0xd731('0x3d')]);_0x1db23e[_0xd731('0x40')]=_['intersection'](_0x22e139[_0xd731('0x3b')],qs[_0xd731('0x41')](_0x2a4b35[_0xd731('0x3d')]['fields']));_0x1db23e[_0xd731('0x40')]=_0x1db23e['attributes'][_0xd731('0x42')]?_0x1db23e[_0xd731('0x40')]:_0x22e139[_0xd731('0x3b')];if(!_0x2a4b35['query'][_0xd731('0x43')]('nolimit')){_0x1db23e[_0xd731('0x22')]=qs['limit'](_0x2a4b35[_0xd731('0x3d')][_0xd731('0x22')]);_0x1db23e[_0xd731('0x23')]=qs[_0xd731('0x23')](_0x2a4b35[_0xd731('0x3d')][_0xd731('0x23')]);}_0x1db23e[_0xd731('0x45')]=qs[_0xd731('0x46')](_0x2a4b35[_0xd731('0x3d')][_0xd731('0x46')]);_0x1db23e[_0xd731('0x47')]=qs[_0xd731('0x3e')](_[_0xd731('0x64')](_0x2a4b35[_0xd731('0x3d')],_0x22e139[_0xd731('0x3e')]));_0x1db23e[_0xd731('0x47')][_0xd731('0x68')]=_0x5b8eba['id'];if(_0x2a4b35['query'][_0xd731('0x2e')]){_0x1db23e[_0xd731('0x47')]=_[_0xd731('0x48')](_0x1db23e['where'],{'$or':_[_0xd731('0x30')](_0x1db23e[_0xd731('0x40')],function(_0x2ee0e8){var _0x4de670={};_0x4de670[_0x2ee0e8]={'$like':'%'+_0x2a4b35[_0xd731('0x3d')][_0xd731('0x2e')]+'%'};return _0x4de670;})});}_0x1db23e=_[_0xd731('0x48')]({},_0x1db23e,_0x2a4b35[_0xd731('0x4a')]);return db[_0xd731('0x6c')]['count']({'where':_0x1db23e[_0xd731('0x47')]})[_0xd731('0x2a')](function(_0x4f3c96){_0x3f0879['count']=_0x4f3c96;if(_0x2a4b35[_0xd731('0x3d')]['includeAll']){_0x1db23e[_0xd731('0x4c')]=[{'all':!![]}];}return db[_0xd731('0x6c')][_0xd731('0x4d')](_0x1db23e);})[_0xd731('0x2a')](function(_0x5b885a){_0x3f0879['rows']=_0x5b885a;return _0x3f0879;});}})[_0xd731('0x2a')](respondWithFilteredResult(_0x1752eb,_0x1db23e))['catch'](handleError(_0x1752eb,null));};exports[_0xd731('0x6d')]=function(_0x553334,_0x220105,_0x2eaa12){var _0x7c7e59={};var _0x29f822={};var _0x2c60ed;var _0xe2610d;return db[_0xd731('0x38')][_0xd731('0x63')]({'where':{'id':_0x553334[_0xd731('0x51')]['id']}})[_0xd731('0x2a')](handleEntityNotFound(_0x220105,null))[_0xd731('0x2a')](function(_0x3fbee5){if(_0x3fbee5){_0x2c60ed=_0x3fbee5;_0x29f822[_0xd731('0x3b')]=_[_0xd731('0x3c')](db[_0xd731('0x6e')][_0xd731('0x39')]);_0x29f822[_0xd731('0x3d')]=_['keys'](_0x553334[_0xd731('0x3d')]);_0x29f822[_0xd731('0x3e')]=_['intersection'](_0x29f822[_0xd731('0x3b')],_0x29f822[_0xd731('0x3d')]);_0x7c7e59[_0xd731('0x40')]=_[_0xd731('0x3f')](_0x29f822[_0xd731('0x3b')],qs[_0xd731('0x41')](_0x553334[_0xd731('0x3d')][_0xd731('0x41')]));_0x7c7e59[_0xd731('0x40')]=_0x7c7e59['attributes'][_0xd731('0x42')]?_0x7c7e59[_0xd731('0x40')]:_0x29f822[_0xd731('0x3b')];_0x7c7e59[_0xd731('0x45')]=qs[_0xd731('0x46')](_0x553334[_0xd731('0x3d')]['sort']);_0x7c7e59[_0xd731('0x47')]=qs[_0xd731('0x3e')](_[_0xd731('0x64')](_0x553334[_0xd731('0x3d')],_0x29f822[_0xd731('0x3e')]));if(_0x553334[_0xd731('0x3d')][_0xd731('0x2e')]){_0x7c7e59['where']=_['merge'](_0x7c7e59[_0xd731('0x47')],{'$or':_[_0xd731('0x30')](_0x7c7e59[_0xd731('0x40')],function(_0x177d89){var _0x1200bf={};_0x1200bf[_0x177d89]={'$like':'%'+_0x553334[_0xd731('0x3d')][_0xd731('0x2e')]+'%'};return _0x1200bf;})});}_0x7c7e59=_[_0xd731('0x48')]({},_0x7c7e59,_0x553334[_0xd731('0x4a')]);return _0x2c60ed[_0xd731('0x6d')](_0x7c7e59);}})[_0xd731('0x2a')](function(_0x3585d5){if(_0x3585d5){_0xe2610d=_0x3585d5[_0xd731('0x42')];if(!_0x553334[_0xd731('0x3d')][_0xd731('0x43')](_0xd731('0x44'))){_0x7c7e59[_0xd731('0x22')]=qs[_0xd731('0x22')](_0x553334[_0xd731('0x3d')]['limit']);_0x7c7e59[_0xd731('0x23')]=qs[_0xd731('0x23')](_0x553334[_0xd731('0x3d')][_0xd731('0x23')]);}return _0x2c60ed['getTeams'](_0x7c7e59);}})[_0xd731('0x2a')](function(_0x2ae7db){if(_0x2ae7db){return _0x2ae7db?{'count':_0xe2610d,'rows':_0x2ae7db}:null;}})[_0xd731('0x2a')](respondWithResult(_0x220105,null))['catch'](handleError(_0x220105,null));};exports[_0xd731('0x6f')]=function(_0x1f095d,_0x21493c,_0x263a17){var _0x156208=_0x1f095d[_0xd731('0x5f')][_0xd731('0x70')];var _0x25efc3=_['map'](_0x156208,'id');return db[_0xd731('0x6e')]['findAll']({'where':{'id':_0x25efc3},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd731('0x71'),'attributes':['id',_0xd731('0x34'),_0xd731('0x72'),_0xd731('0x73'),_0xd731('0x74')],'raw':!![]}]})[_0xd731('0x2a')](function(_0x99b2c2){if(_0x99b2c2){var _0x36e9b8=_[_0xd731('0x75')](_0x99b2c2,function(_0x525bcf){var _0x382dbe=_0x525bcf[_0xd731('0x54')]({'plain':!![]});_0x382dbe['Agents']['forEach'](function(_0x45696c){_0x45696c[_0xd731('0x76')]=_['find'](_0x156208,{'id':_0x382dbe['id']})[_0xd731('0x76')];});return _0x382dbe[_0xd731('0x71')];});return db[_0xd731('0x38')][_0xd731('0x33')]({'where':{'id':_0x1f095d['params']['id']}})['then'](function(_0x186e26){return db['sequelize']['transaction'](function(_0x158a63){return _0x186e26[_0xd731('0x6f')](_0x25efc3,{'transaction':_0x158a63})['then'](function(){return BPromise[_0xd731('0x77')](_0x156208,function(_0x2819ab){return db[_0xd731('0x78')][_0xd731('0x79')]({'TeamId':_0x2819ab['id'],'VoiceQueueId':_0x1f095d[_0xd731('0x51')]['id'],'penalty':_0x2819ab[_0xd731('0x76')]},{'transaction':_0x158a63});});})[_0xd731('0x2a')](function(){return BPromise[_0xd731('0x77')](_0x36e9b8,function(_0xe48113){return db[_0xd731('0x7a')]['findOrCreate']({'where':{'UserId':_0xe48113['id'],'VoiceQueueId':_0x1f095d[_0xd731('0x51')]['id']},'defaults':{'penalty':_0xe48113['penalty']},'transaction':_0x158a63});});})[_0xd731('0x2a')](function(){return BPromise[_0xd731('0x77')](_[_0xd731('0x2e')](_0x36e9b8,{'online':!![]}),function(_0x5aa4e1){return db['UserVoiceQueueRt'][_0xd731('0x79')]({'membername':_0x5aa4e1[_0xd731('0x34')],'UserId':_0x5aa4e1['id'],'queue_name':_0x186e26['name'],'VoiceQueueId':_0x186e26['id'],'interface':_['isNil'](_0x5aa4e1['interface'])?util[_0xd731('0x7b')](_0xd731('0x7c'),_0x5aa4e1[_0xd731('0x34')]):_0x5aa4e1['interface'],'paused':_0x5aa4e1[_0xd731('0x73')]||![],'penalty':_0x5aa4e1['penalty']},{'transaction':_0x158a63});});})[_0xd731('0x2a')](function(){_0x36e9b8[_0xd731('0x7d')](function(_0x4d4dc4){socket[_0xd731('0x7e')](_0xd731('0x7f'),{'UserId':_0x4d4dc4['id'],'VoiceQueueId':_0x186e26['id']});});});});});}})['then'](respondWithStatusCode(_0x21493c,null))[_0xd731('0x4f')](handleError(_0x21493c,null));};exports[_0xd731('0x80')]=function(_0x5b4b50,_0xa02f01,_0x1a206f){return db[_0xd731('0x6e')][_0xd731('0x4d')]({'where':{'id':_0x5b4b50[_0xd731('0x3d')][_0xd731('0x81')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd731('0x71'),'attributes':['id'],'raw':!![]}]})[_0xd731('0x2a')](handleEntityNotFound(_0xa02f01,null))[_0xd731('0x2a')](function(_0x5af33e){var _0x5f257c=_['map'](_0x5af33e,'id');var _0x514b7c=[];var _0x12bb2b=[];var _0x405f8e=squel[_0xd731('0x82')]();_0x405f8e[_0xd731('0x83')](_0xd731('0x84'))[_0xd731('0x85')](_0xd731('0x86'),'tq')['join'](_0xd731('0x87'),'ut',_0xd731('0x88'))[_0xd731('0x47')](_0xd731('0x89'),_0x5b4b50[_0xd731('0x51')]['id']);for(var _0x5e5cd8=0x0;_0x5e5cd8<_0x5af33e[_0xd731('0x42')];_0x5e5cd8+=0x1){let _0xcd42b8=_0x5af33e[_0x5e5cd8];for(var _0x54d126=0x0;_0x54d126<_0xcd42b8[_0xd731('0x71')]['length'];_0x54d126+=0x1){let _0x4ab12e=_0xcd42b8[_0xd731('0x71')][_0x54d126];var _0x154139=_0x405f8e[_0xd731('0x5b')]();_0x154139['where'](_0xd731('0x8a'),_0x4ab12e['id']);_0x12bb2b[_0xd731('0x8b')](db[_0xd731('0x8c')]['query'](_0x154139[_0xd731('0x8d')](),{'type':db[_0xd731('0x8c')][_0xd731('0x8e')][_0xd731('0x8f')]})[_0xd731('0x2a')](function(_0x531772){if(_0x531772[_0xd731('0x42')]===0x1){return _0x4ab12e['id'];}else{var _0x56484c=_['every'](_[_0xd731('0x30')](_0x531772,'TeamId'),function(_0x1a3ffa){return _[_0xd731('0x90')](_0x5f257c,_0x1a3ffa);});if(_0x56484c){return _0x4ab12e['id'];}}}));}}return BPromise[_0xd731('0x91')](_0x12bb2b)['then'](function(_0xc772f4){_0x514b7c=_(_0x514b7c)[_0xd731('0x92')](_0xc772f4)['compact']()[_0xd731('0x31')]();return db[_0xd731('0x38')][_0xd731('0x33')]({'where':{'id':_0x5b4b50[_0xd731('0x51')]['id']}})[_0xd731('0x2a')](function(_0x5f0000){return db['sequelize'][_0xd731('0x93')](function(_0x505f83){return _0x5f0000[_0xd731('0x80')](_0x5b4b50[_0xd731('0x3d')]['ids'],{'transaction':_0x505f83})[_0xd731('0x2a')](function(){if(!_[_0xd731('0x94')](_0x514b7c)){return _0x5f0000[_0xd731('0x95')](_0x514b7c,{'transaction':_0x505f83})[_0xd731('0x2a')](function(){return db[_0xd731('0x96')][_0xd731('0x2b')]({'where':{'VoiceQueueId':_0x5b4b50['params']['id'],'UserId':_0x514b7c},'transaction':_0x505f83});});}})[_0xd731('0x2a')](function(){_0x514b7c[_0xd731('0x7d')](function(_0x134915){socket[_0xd731('0x7e')](_0xd731('0x97'),{'UserId':_0x134915,'VoiceQueueId':_0x5f0000['id']});});});});});});})['then'](respondWithStatusCode(_0xa02f01,null))['catch'](handleError(_0xa02f01,null));};exports[_0xd731('0x98')]=function(_0x366dd5,_0xe91eae,_0x2d0500){var _0x1c2e41,_0x287c8c;return db[_0xd731('0x38')]['find']({'where':{'id':_0x366dd5[_0xd731('0x51')]['id']}})[_0xd731('0x2a')](handleEntityNotFound(_0xe91eae,null))[_0xd731('0x2a')](function(_0x50c6d0){if(_0x50c6d0){_0x287c8c=_0x50c6d0;return _0x50c6d0['addAgents'](_0x366dd5[_0xd731('0x5f')][_0xd731('0x81')],_[_0xd731('0x5c')](_0x366dd5['body'],[_0xd731('0x81'),'id'])||{})['spread'](function(_0x324656){for(var _0x226cb7=0x0;_0x226cb7<_0x366dd5[_0xd731('0x5f')][_0xd731('0x81')][_0xd731('0x42')];_0x226cb7+=0x1){socket[_0xd731('0x7e')](_0xd731('0x7f'),{'UserId':Number(_0x366dd5[_0xd731('0x5f')][_0xd731('0x81')][_0x226cb7]),'VoiceQueueId':Number(_0x366dd5[_0xd731('0x51')]['id'])});}return _0x324656;});}})[_0xd731('0x2a')](function(_0x51951a){_0x1c2e41=_0x51951a||[];if(_0x287c8c){return db['User']['findAll']({'where':{'id':_0x366dd5[_0xd731('0x5f')][_0xd731('0x81')]},'attributes':['id','name',_0xd731('0x72'),_0xd731('0x73'),_0xd731('0x74')],'raw':!![]});}})[_0xd731('0x2a')](function(_0x887c6){if(!_[_0xd731('0x94')](_0x887c6)){var _0x112d31=[];for(var _0x4e7b4d=0x0;_0x4e7b4d<_0x887c6[_0xd731('0x42')];_0x4e7b4d++){if(_0x887c6[_0x4e7b4d][_0xd731('0x72')]){_0x112d31[_0xd731('0x8b')](db[_0xd731('0x96')]['upsert']({'membername':_0x887c6[_0x4e7b4d]['name'],'UserId':_0x887c6[_0x4e7b4d]['id'],'queue_name':_0x287c8c[_0xd731('0x34')],'VoiceQueueId':_0x287c8c['id'],'interface':_[_0xd731('0x99')](_0x887c6[_0x4e7b4d][_0xd731('0x74')])?util[_0xd731('0x7b')](_0xd731('0x7c'),_0x887c6[_0x4e7b4d][_0xd731('0x34')]):_0x887c6[_0x4e7b4d]['interface'],'paused':_0x887c6[_0x4e7b4d][_0xd731('0x73')]||![],'penalty':_0x366dd5[_0xd731('0x5f')]['penalty']||0x0}));}}return BPromise['all'](_0x112d31);}})['then'](function(){return _0x1c2e41;})[_0xd731('0x2a')](respondWithResult(_0xe91eae,null))[_0xd731('0x4f')](handleError(_0xe91eae,null));};exports['removeAgents']=function(_0x17bfbd,_0x12176f,_0xc8f54a){return db[_0xd731('0x38')][_0xd731('0x33')]({'where':{'id':_0x17bfbd['params']['id']}})[_0xd731('0x2a')](handleEntityNotFound(_0x12176f,null))[_0xd731('0x2a')](function(_0x2a5385){if(_0x2a5385){return _0x2a5385['removeAgents'](_0x17bfbd[_0xd731('0x3d')]['ids'])[_0xd731('0x2a')](function(){if(_[_0xd731('0x9a')](_0x17bfbd['query'][_0xd731('0x81')])){for(var _0x40515f=0x0;_0x40515f<_0x17bfbd[_0xd731('0x3d')][_0xd731('0x81')][_0xd731('0x42')];_0x40515f+=0x1){socket['emit'](_0xd731('0x97'),{'UserId':Number(_0x17bfbd[_0xd731('0x3d')]['ids'][_0x40515f]),'VoiceQueueId':Number(_0x17bfbd[_0xd731('0x51')]['id'])});}}else{socket[_0xd731('0x7e')]('userVoiceQueue:remove',{'UserId':Number(_0x17bfbd['query'][_0xd731('0x81')]),'VoiceQueueId':Number(_0x17bfbd[_0xd731('0x51')]['id'])});}});}})[_0xd731('0x2a')](function(_0x4b668c){return db[_0xd731('0x96')][_0xd731('0x2b')]({'where':{'VoiceQueueId':_0x17bfbd['params']['id'],'UserId':_0x17bfbd[_0xd731('0x3d')]['ids']}})[_0xd731('0x2a')](function(){return _0x4b668c;});})['then'](respondWithStatusCode(_0x12176f,null))[_0xd731('0x4f')](handleError(_0x12176f,null));};exports['getAgents']=function(_0x2a5bb2,_0x30d2a7,_0xc9540f){var _0xaf663d={};var _0x4e11cf={};var _0x2338cd;var _0x416482;return db[_0xd731('0x38')]['findOne']({'where':{'id':_0x2a5bb2['params']['id']}})[_0xd731('0x2a')](handleEntityNotFound(_0x30d2a7,null))[_0xd731('0x2a')](function(_0x2b2e55){if(_0x2b2e55){_0x2338cd=_0x2b2e55;_0x4e11cf[_0xd731('0x3b')]=_[_0xd731('0x3c')](db[_0xd731('0x9b')][_0xd731('0x39')]);_0x4e11cf['query']=_['keys'](_0x2a5bb2[_0xd731('0x3d')]);_0x4e11cf['filters']=_[_0xd731('0x3f')](_0x4e11cf[_0xd731('0x3b')],_0x4e11cf[_0xd731('0x3d')]);_0xaf663d[_0xd731('0x40')]=_[_0xd731('0x3f')](_0x4e11cf[_0xd731('0x3b')],qs[_0xd731('0x41')](_0x2a5bb2[_0xd731('0x3d')][_0xd731('0x41')]));_0xaf663d[_0xd731('0x40')]=_0xaf663d['attributes'][_0xd731('0x42')]?_0xaf663d[_0xd731('0x40')]:_0x4e11cf[_0xd731('0x3b')];_0xaf663d[_0xd731('0x45')]=qs[_0xd731('0x46')](_0x2a5bb2['query']['sort']);_0xaf663d[_0xd731('0x47')]=qs[_0xd731('0x3e')](_['pick'](_0x2a5bb2[_0xd731('0x3d')],_0x4e11cf['filters']));if(_0x2a5bb2[_0xd731('0x3d')][_0xd731('0x2e')]){_0xaf663d[_0xd731('0x47')]=_[_0xd731('0x48')](_0xaf663d[_0xd731('0x47')],{'$or':_[_0xd731('0x30')](_0xaf663d[_0xd731('0x40')],function(_0x1d7723){var _0x433054={};_0x433054[_0x1d7723]={'$like':'%'+_0x2a5bb2[_0xd731('0x3d')][_0xd731('0x2e')]+'%'};return _0x433054;})});}_0xaf663d=_[_0xd731('0x48')]({},_0xaf663d,_0x2a5bb2[_0xd731('0x4a')]);return _0x2338cd[_0xd731('0x9c')](_0xaf663d);}})[_0xd731('0x2a')](function(_0x4fd290){if(_0x4fd290){_0x416482=_0x4fd290[_0xd731('0x42')];if(!_0x2a5bb2[_0xd731('0x3d')][_0xd731('0x43')](_0xd731('0x44'))){_0xaf663d[_0xd731('0x22')]=qs[_0xd731('0x22')](_0x2a5bb2[_0xd731('0x3d')][_0xd731('0x22')]);_0xaf663d['offset']=qs[_0xd731('0x23')](_0x2a5bb2[_0xd731('0x3d')][_0xd731('0x23')]);}return _0x2338cd[_0xd731('0x9c')](_0xaf663d);}})[_0xd731('0x2a')](function(_0x2eec37){if(_0x2eec37){return _0x2eec37?{'count':_0x416482,'rows':_0x2eec37}:null;}})['then'](respondWithResult(_0x30d2a7,null))[_0xd731('0x4f')](handleError(_0x30d2a7,null));};exports['getMembers']=function(_0x530fda,_0xbd5d64,_0x362db1){var _0x2ab8a8={};var _0x3ca714={};var _0x3cde9d;var _0x42128c;return db[_0xd731('0x38')][_0xd731('0x63')]({'where':{'id':_0x530fda[_0xd731('0x51')]['id']}})[_0xd731('0x2a')](handleEntityNotFound(_0xbd5d64,null))['then'](function(_0x21c54c){if(_0x21c54c){_0x3cde9d=_0x21c54c;_0x3ca714[_0xd731('0x3b')]=_[_0xd731('0x3c')](db[_0xd731('0x96')]['rawAttributes']);_0x3ca714[_0xd731('0x3d')]=_[_0xd731('0x3c')](_0x530fda[_0xd731('0x3d')]);_0x3ca714[_0xd731('0x3e')]=_[_0xd731('0x3f')](_0x3ca714['model'],_0x3ca714[_0xd731('0x3d')]);_0x2ab8a8[_0xd731('0x40')]=_[_0xd731('0x3f')](_0x3ca714['model'],qs[_0xd731('0x41')](_0x530fda['query'][_0xd731('0x41')]));_0x2ab8a8['attributes']=_0x2ab8a8[_0xd731('0x40')]['length']?_0x2ab8a8[_0xd731('0x40')]:_0x3ca714['model'];_0x2ab8a8[_0xd731('0x45')]=qs[_0xd731('0x46')](_0x530fda['query']['sort']);_0x2ab8a8[_0xd731('0x47')]=qs['filters'](_[_0xd731('0x64')](_0x530fda[_0xd731('0x3d')],_0x3ca714[_0xd731('0x3e')]));if(_0x530fda['query'][_0xd731('0x2e')]){_0x2ab8a8[_0xd731('0x47')]=_['merge'](_0x2ab8a8[_0xd731('0x47')],{'$or':_[_0xd731('0x30')](_0x2ab8a8[_0xd731('0x40')],function(_0x3e9686){var _0x29f1c6={};_0x29f1c6[_0x3e9686]={'$like':'%'+_0x530fda['query']['filter']+'%'};return _0x29f1c6;})});}_0x2ab8a8=_[_0xd731('0x48')]({},_0x2ab8a8,_0x530fda['options']);return _0x3cde9d[_0xd731('0x9d')](_0x2ab8a8);}})[_0xd731('0x2a')](function(_0x378435){if(_0x378435){_0x42128c=_0x378435['length'];if(!_0x530fda[_0xd731('0x3d')][_0xd731('0x43')]('nolimit')){_0x2ab8a8[_0xd731('0x22')]=qs[_0xd731('0x22')](_0x530fda[_0xd731('0x3d')][_0xd731('0x22')]);_0x2ab8a8[_0xd731('0x23')]=qs[_0xd731('0x23')](_0x530fda['query'][_0xd731('0x23')]);}return _0x3cde9d[_0xd731('0x9d')](_0x2ab8a8);}})[_0xd731('0x2a')](function(_0x160c5f){return _0x160c5f?{'count':_0x42128c,'rows':_0x160c5f}:null;})[_0xd731('0x2a')](respondWithResult(_0xbd5d64,null))[_0xd731('0x4f')](handleError(_0xbd5d64,null));};exports[_0xd731('0x9e')]=function(_0x4cc878,_0x44c43e,_0x2dbb30){var _0x950cf7={};var _0x595a8b={};var _0x36330c;var _0x2c25d7;return db[_0xd731('0x38')]['findOne']({'where':{'id':_0x4cc878['params']['id']}})[_0xd731('0x2a')](handleEntityNotFound(_0x44c43e,null))[_0xd731('0x2a')](function(_0x28b6cc){if(_0x28b6cc){_0x36330c=_0x28b6cc;_0x595a8b[_0xd731('0x3b')]=_['keys'](db[_0xd731('0x9f')][_0xd731('0x39')]);_0x595a8b[_0xd731('0x3d')]=_[_0xd731('0x3c')](_0x4cc878['query']);_0x595a8b[_0xd731('0x3e')]=_[_0xd731('0x3f')](_0x595a8b[_0xd731('0x3b')],_0x595a8b[_0xd731('0x3d')]);_0x950cf7[_0xd731('0x40')]=_['intersection'](_0x595a8b[_0xd731('0x3b')],qs[_0xd731('0x41')](_0x4cc878[_0xd731('0x3d')][_0xd731('0x41')]));_0x950cf7[_0xd731('0x40')]=_0x950cf7['attributes'][_0xd731('0x42')]?_0x950cf7[_0xd731('0x40')]:_0x595a8b[_0xd731('0x3b')];_0x950cf7[_0xd731('0x45')]=qs[_0xd731('0x46')](_0x4cc878[_0xd731('0x3d')][_0xd731('0x46')]);_0x950cf7[_0xd731('0x47')]=qs['filters'](_[_0xd731('0x64')](_0x4cc878[_0xd731('0x3d')],_0x595a8b['filters']));if(_0x4cc878[_0xd731('0x3d')]['filter']){_0x950cf7[_0xd731('0x47')]=_[_0xd731('0x48')](_0x950cf7[_0xd731('0x47')],{'$or':_[_0xd731('0x30')](_0x950cf7['attributes'],function(_0x4f27b9){var _0x49fd9b={};_0x49fd9b[_0x4f27b9]={'$like':'%'+_0x4cc878[_0xd731('0x3d')][_0xd731('0x2e')]+'%'};return _0x49fd9b;})});}_0x950cf7=_[_0xd731('0x48')]({},_0x950cf7,_0x4cc878['options']);return _0x36330c[_0xd731('0x9e')](_0x950cf7);}})[_0xd731('0x2a')](function(_0x18f8da){if(_0x18f8da){_0x2c25d7=_0x18f8da[_0xd731('0x42')];if(!_0x4cc878[_0xd731('0x3d')][_0xd731('0x43')](_0xd731('0x44'))){_0x950cf7[_0xd731('0x22')]=qs[_0xd731('0x22')](_0x4cc878[_0xd731('0x3d')]['limit']);_0x950cf7[_0xd731('0x23')]=qs[_0xd731('0x23')](_0x4cc878[_0xd731('0x3d')][_0xd731('0x23')]);}return _0x36330c[_0xd731('0x9e')](_0x950cf7);}})[_0xd731('0x2a')](function(_0x1d0b7f){if(_0x1d0b7f){return _0x1d0b7f?{'count':_0x2c25d7,'rows':_0x1d0b7f}:null;}})[_0xd731('0x2a')](respondWithResult(_0x44c43e,null))[_0xd731('0x4f')](handleError(_0x44c43e,null));};exports[_0xd731('0xa0')]=function(_0x458ab9,_0x52df2e,_0x9b00b0){var _0x2c83ba,_0x76da61;return db[_0xd731('0x38')][_0xd731('0x33')]({'where':{'id':_0x458ab9[_0xd731('0x51')]['id']}})['then'](handleEntityNotFound(_0x52df2e,null))['then'](function(_0x4fd7ec){if(_0x4fd7ec){_0x76da61=_0x4fd7ec;return _0x4fd7ec[_0xd731('0xa0')](_0x458ab9[_0xd731('0x5f')][_0xd731('0x81')],_[_0xd731('0x5c')](_0x458ab9[_0xd731('0x5f')],['ids','id'])||{});}return null;})[_0xd731('0xa1')](function(_0x5095e2){var _0x3fe373;_0x2c83ba=_0x5095e2||[];var _0x48f8b4=[];if(_0x5095e2){for(var _0x20d3c6=0x0;_0x20d3c6<_0x5095e2[_0xd731('0x42')];_0x20d3c6+=0x1){var _0x5bc52b=_0x5095e2[_0x20d3c6][_0xd731('0x54')]({'plain':!![]});_0x76da61[_0xd731('0xa2')]=_0x458ab9['body'][_0xd731('0xa2')]?_0x458ab9[_0xd731('0x5f')][_0xd731('0xa2')]:_0x76da61[_0xd731('0xa2')];switch(_0x76da61[_0xd731('0xa2')]){case'always':_0x3fe373=squel[_0xd731('0xa3')]()[_0xd731('0xa4')]('cm_hopper')[_0xd731('0xa5')]([_0xd731('0xa6'),_0xd731('0xa7'),_0xd731('0xa8'),'ListId','VoiceQueueId',_0xd731('0x5d'),_0xd731('0x5e')],squel[_0xd731('0x82')]()['field'](_0xd731('0xa6'),_0xd731('0xa6'))[_0xd731('0x83')]('NOW()',_0xd731('0xa7'))[_0xd731('0x83')]('id',_0xd731('0xa8'))[_0xd731('0x83')](_0x5bc52b[_0xd731('0xa9')][_0xd731('0x8d')](),_0xd731('0xaa'))['field'](_0x458ab9['params']['id'][_0xd731('0x8d')](),_0xd731('0x68'))['field'](_0xd731('0xab'),'createdAt')[_0xd731('0x83')](_0xd731('0xab'),_0xd731('0x5e'))[_0xd731('0x85')]('cm_contacts')['where'](_0xd731('0xac'))[_0xd731('0x47')](_0xd731('0xad'),_0x5bc52b[_0xd731('0xa9')][_0xd731('0x8d')]())[_0xd731('0x47')](_0xd731('0xae'))[_0xd731('0x47')](_0xd731('0xaf'),squel[_0xd731('0x82')]()[_0xd731('0x83')](_0xd731('0xb0'))['from'](_0xd731('0xb1'))['where'](_0xd731('0x89'),_0x458ab9['params']['id'][_0xd731('0x8d')]()))[_0xd731('0x47')](_0xd731('0xaf'),squel[_0xd731('0x82')]()['field'](_0xd731('0xb2'))['from'](_0xd731('0xb3'))['where'](_0xd731('0x89'),_0x458ab9[_0xd731('0x51')]['id'][_0xd731('0x8d')]())))[_0xd731('0x8d')]();break;case'onlyIfOpen':_0x3fe373=squel[_0xd731('0xa3')]()['into'](_0xd731('0xb3'))[_0xd731('0xa5')]([_0xd731('0xa6'),_0xd731('0xa7'),_0xd731('0xa8'),_0xd731('0xaa'),'VoiceQueueId',_0xd731('0x5d'),'updatedAt'],squel[_0xd731('0x82')]()[_0xd731('0x83')](_0xd731('0xa6'),'phone')[_0xd731('0x83')](_0xd731('0xab'),_0xd731('0xa7'))[_0xd731('0x83')]('id',_0xd731('0xa8'))['field'](_0x5bc52b[_0xd731('0xa9')]['toString'](),_0xd731('0xaa'))[_0xd731('0x83')](_0x458ab9[_0xd731('0x51')]['id'][_0xd731('0x8d')](),_0xd731('0x68'))['field'](_0xd731('0xab'),'createdAt')[_0xd731('0x83')](_0xd731('0xab'),_0xd731('0x5e'))[_0xd731('0x85')]('cm_contacts')[_0xd731('0x47')](_0xd731('0xac'))['where'](_0xd731('0xad'),_0x5bc52b[_0xd731('0xa9')][_0xd731('0x8d')]())[_0xd731('0x47')](_0xd731('0xae'))[_0xd731('0x47')](_0xd731('0xaf'),squel[_0xd731('0x82')]()[_0xd731('0x83')](_0xd731('0xb2'))[_0xd731('0x85')]('cm_hopper')[_0xd731('0x47')]('VoiceQueueId\x20=\x20?',_0x458ab9[_0xd731('0x51')]['id'][_0xd731('0x8d')]())))['toString']();break;default:_0x3fe373=squel['insert']()[_0xd731('0xa4')](_0xd731('0xb3'))['fromQuery'](['phone',_0xd731('0xa7'),_0xd731('0xa8'),'ListId','VoiceQueueId','createdAt','updatedAt'],squel['select']()['field'](_0xd731('0xa6'),'phone')['field']('NOW()','scheduledAt')[_0xd731('0x83')]('id',_0xd731('0xa8'))['field'](_0x5bc52b[_0xd731('0xa9')][_0xd731('0x8d')](),'ListId')[_0xd731('0x83')](_0x458ab9['params']['id'][_0xd731('0x8d')](),'VoiceQueueId')[_0xd731('0x83')](_0xd731('0xab'),_0xd731('0x5d'))[_0xd731('0x83')]('NOW()',_0xd731('0x5e'))[_0xd731('0x85')](_0xd731('0xb4'))['where'](_0xd731('0xac'))[_0xd731('0x47')](_0xd731('0xad'),_0x5bc52b[_0xd731('0xa9')][_0xd731('0x8d')]())[_0xd731('0x47')](_0xd731('0xae')))[_0xd731('0x8d')]();}_0x48f8b4['push'](db[_0xd731('0x8c')]['query'](_0x3fe373));}return BPromise[_0xd731('0x91')](_0x48f8b4);}})[_0xd731('0x2a')](function(){return _0x2c83ba;})[_0xd731('0x2a')](respondWithResult(_0x52df2e,null))[_0xd731('0x4f')](handleError(_0x52df2e,null));};exports[_0xd731('0xb5')]=function(_0x107b8b,_0x4cd3e0,_0x244530){return db[_0xd731('0x38')][_0xd731('0x33')]({'where':{'id':_0x107b8b[_0xd731('0x51')]['id']}})[_0xd731('0x2a')](handleEntityNotFound(_0x4cd3e0,null))[_0xd731('0x2a')](function(_0x237436){if(_0x237436){return _0x237436['removeLists'](_0x107b8b[_0xd731('0x3d')][_0xd731('0x81')]);}})['then'](function(_0x2ecf26){if(_0x2ecf26){return db[_0xd731('0x65')]['destroy']({'where':{'ListId':_0x107b8b[_0xd731('0x3d')][_0xd731('0x81')],'VoiceQueueId':_0x107b8b['params']['id']}})[_0xd731('0x2a')](function(){return _0x2ecf26;});}})['then'](respondWithStatusCode(_0x4cd3e0,null))[_0xd731('0x4f')](handleError(_0x4cd3e0,null));};exports[_0xd731('0xb6')]=function(_0x311bd9,_0x5f06c4,_0x3fc202){var _0x47fd17={};var _0x5454f2={};var _0x2a54f0;var _0xda3c6b;return db[_0xd731('0x38')]['findOne']({'where':{'id':_0x311bd9[_0xd731('0x51')]['id']}})[_0xd731('0x2a')](handleEntityNotFound(_0x5f06c4,null))[_0xd731('0x2a')](function(_0x2cb7e5){if(_0x2cb7e5){_0x2a54f0=_0x2cb7e5;_0x5454f2['model']=_[_0xd731('0x3c')](db[_0xd731('0x9f')][_0xd731('0x39')]);_0x5454f2['query']=_[_0xd731('0x3c')](_0x311bd9[_0xd731('0x3d')]);_0x5454f2[_0xd731('0x3e')]=_[_0xd731('0x3f')](_0x5454f2[_0xd731('0x3b')],_0x5454f2[_0xd731('0x3d')]);_0x47fd17[_0xd731('0x40')]=_[_0xd731('0x3f')](_0x5454f2[_0xd731('0x3b')],qs[_0xd731('0x41')](_0x311bd9[_0xd731('0x3d')][_0xd731('0x41')]));_0x47fd17['attributes']=_0x47fd17[_0xd731('0x40')][_0xd731('0x42')]?_0x47fd17[_0xd731('0x40')]:_0x5454f2['model'];_0x47fd17['order']=qs['sort'](_0x311bd9[_0xd731('0x3d')][_0xd731('0x46')]);_0x47fd17[_0xd731('0x47')]=qs[_0xd731('0x3e')](_[_0xd731('0x64')](_0x311bd9['query'],_0x5454f2[_0xd731('0x3e')]));if(_0x311bd9[_0xd731('0x3d')]['filter']){_0x47fd17[_0xd731('0x47')]=_['merge'](_0x47fd17[_0xd731('0x47')],{'$or':_['map'](_0x47fd17[_0xd731('0x40')],function(_0x2d1a00){var _0x12af96={};_0x12af96[_0x2d1a00]={'$like':'%'+_0x311bd9[_0xd731('0x3d')][_0xd731('0x2e')]+'%'};return _0x12af96;})});}_0x47fd17=_[_0xd731('0x48')]({},_0x47fd17,_0x311bd9['options']);return _0x2a54f0['getBlackLists'](_0x47fd17);}})[_0xd731('0x2a')](function(_0x470dbb){if(_0x470dbb){_0xda3c6b=_0x470dbb['length'];if(!_0x311bd9['query']['hasOwnProperty']('nolimit')){_0x47fd17[_0xd731('0x22')]=qs[_0xd731('0x22')](_0x311bd9[_0xd731('0x3d')][_0xd731('0x22')]);_0x47fd17[_0xd731('0x23')]=qs[_0xd731('0x23')](_0x311bd9['query'][_0xd731('0x23')]);}return _0x2a54f0[_0xd731('0xb6')](_0x47fd17);}})['then'](function(_0x414b9c){if(_0x414b9c){return _0x414b9c?{'count':_0xda3c6b,'rows':_0x414b9c}:null;}})[_0xd731('0x2a')](respondWithResult(_0x5f06c4,null))[_0xd731('0x4f')](handleError(_0x5f06c4,null));};exports[_0xd731('0xb7')]=function(_0x5363a0,_0x3a0fb0,_0x53c2fa){var _0x375c6b,_0x24bd7a;return db[_0xd731('0x38')]['find']({'where':{'id':_0x5363a0['params']['id']}})['then'](handleEntityNotFound(_0x3a0fb0,null))[_0xd731('0x2a')](function(_0x1e950b){if(_0x1e950b){_0x24bd7a=_0x1e950b;return _0x1e950b[_0xd731('0xb7')](_0x5363a0[_0xd731('0x5f')][_0xd731('0x81')],_[_0xd731('0x5c')](_0x5363a0[_0xd731('0x5f')],[_0xd731('0x81'),'id'])||{});}return null;})[_0xd731('0xa1')](function(_0x3d3975){var _0x4d355e;_0x375c6b=_0x3d3975||[];var _0x36420f=[];if(_0x3d3975){for(var _0x4c70b3=0x0;_0x4c70b3<_0x3d3975[_0xd731('0x42')];_0x4c70b3+=0x1){var _0x33c217=_0x3d3975[_0x4c70b3][_0xd731('0x54')]({'plain':!![]});_0x4d355e=squel['insert']()[_0xd731('0xa4')](_0xd731('0xb8'))[_0xd731('0xa5')]([_0xd731('0xa6'),_0xd731('0xa8'),_0xd731('0xaa'),_0xd731('0x68'),_0xd731('0x5d'),_0xd731('0x5e')],squel[_0xd731('0x82')]()[_0xd731('0x83')](_0xd731('0xa6'),_0xd731('0xa6'))[_0xd731('0x83')]('id','ContactId')['field'](_0x33c217['CmListId'][_0xd731('0x8d')](),'ListId')[_0xd731('0x83')](_0x5363a0[_0xd731('0x51')]['id']['toString'](),_0xd731('0x68'))[_0xd731('0x83')]('NOW()',_0xd731('0x5d'))['field'](_0xd731('0xab'),_0xd731('0x5e'))['from'](_0xd731('0xb4'))[_0xd731('0x47')](_0xd731('0xac'))['where'](_0xd731('0xad'),_0x33c217[_0xd731('0xa9')][_0xd731('0x8d')]())[_0xd731('0x47')](_0xd731('0xae')))[_0xd731('0x8d')]();_0x36420f[_0xd731('0x8b')](db[_0xd731('0x8c')][_0xd731('0x3d')](_0x4d355e));}return BPromise[_0xd731('0x91')](_0x36420f);}})[_0xd731('0x2a')](function(){return _0x375c6b;})[_0xd731('0x2a')](respondWithResult(_0x3a0fb0,null))['catch'](handleError(_0x3a0fb0,null));};exports['removeBlackLists']=function(_0x27ad27,_0x25aa90,_0x7ab5fc){return db[_0xd731('0x38')][_0xd731('0x33')]({'where':{'id':_0x27ad27['params']['id']}})[_0xd731('0x2a')](handleEntityNotFound(_0x25aa90,null))[_0xd731('0x2a')](function(_0x475cde){if(_0x475cde){return _0x475cde[_0xd731('0xb9')](_0x27ad27['query'][_0xd731('0x81')]);}})[_0xd731('0x2a')](function(_0x4c3361){if(_0x4c3361){return db[_0xd731('0x6c')]['destroy']({'where':{'ListId':_0x27ad27[_0xd731('0x3d')][_0xd731('0x81')],'VoiceQueueId':_0x27ad27['params']['id']}})[_0xd731('0x2a')](function(){return _0x4c3361;});}})[_0xd731('0x2a')](respondWithStatusCode(_0x25aa90,null))[_0xd731('0x4f')](handleError(_0x25aa90,null));}; \ No newline at end of file +var _0xa8e1=['create','body','user','role','get','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','QueueCampaigns','UserProfileSection','destroy','getHoppers','findOne','CmHopper','sort','include','findAll','CmHopperHistory','getHopperFinals','CmHopperFinal','VoiceQueueId','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','compact','removeTeams','isEmpty','emit','addAgents','spread','SIP/%s','removeAgents','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ListId','scheduledAt','ContactId','CmListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','select','COALESCE(calleridnum,\x27\x27)','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','localhost','redis','register','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','VoiceQueues','inbound','outbound','filter','ignore','map','value','includes','find','type','UserProfileResource','then','stack','name','send','index','VoiceQueue','fieldName','key','model','query','intersection','length','attributes','hasOwnProperty','nolimit','order','where','filters','pick','merge','options','includeAll','rows','catch','show','params','keys','rawAttributes','fields'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa8e1,0x11a));var _0x1a8e=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0xa8e1[_0xa60623];return _0x4a6487;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a8e('0x0'));var zipdir=require(_0x1a8e('0x1'));var jsonpatch=require(_0x1a8e('0x2'));var rp=require('request-promise');var moment=require(_0x1a8e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a8e('0x4'));var path=require('path');var sox=require(_0x1a8e('0x5'));var csv=require(_0x1a8e('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1a8e('0x7'));var squel=require(_0x1a8e('0x8'));var crypto=require(_0x1a8e('0x9'));var jsforce=require(_0x1a8e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x1a8e('0x6'));var querystring=require('querystring');var Papa=require(_0x1a8e('0xb'));var Redis=require(_0x1a8e('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x1a8e('0xd'));var as=require(_0x1a8e('0xe'));var hardwareService=require(_0x1a8e('0xf'));var logger=require(_0x1a8e('0x10'))(_0x1a8e('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a8e('0x12'));var db=require(_0x1a8e('0x13'))['db'];config['redis']=_[_0x1a8e('0x14')](config['redis'],{'host':_0x1a8e('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a8e('0x16')]));require('./voiceQueue.socket')[_0x1a8e('0x17')](socket);function respondWithStatusCode(_0x34c93b,_0x17ad11){_0x17ad11=_0x17ad11||0xcc;return function(_0x321bfb){if(_0x321bfb){return _0x34c93b[_0x1a8e('0x18')](_0x17ad11);}return _0x34c93b[_0x1a8e('0x19')](_0x17ad11)[_0x1a8e('0x1a')]();};}function respondWithResult(_0x471c41,_0x41560f){_0x41560f=_0x41560f||0xc8;return function(_0x2761e5){if(_0x2761e5){return _0x471c41[_0x1a8e('0x19')](_0x41560f)[_0x1a8e('0x1b')](_0x2761e5);}};}function respondWithFilteredResult(_0x3895a5,_0x5da411){return function(_0x2bc004){if(_0x2bc004){var _0x23dcc8=typeof _0x5da411[_0x1a8e('0x1c')]==='undefined'&&typeof _0x5da411[_0x1a8e('0x1d')]==='undefined';var _0x399f82=_0x2bc004[_0x1a8e('0x1e')];var _0x596b30=_0x23dcc8?0x0:_0x5da411[_0x1a8e('0x1c')];var _0x3187db=_0x23dcc8?_0x2bc004[_0x1a8e('0x1e')]:_0x5da411['offset']+_0x5da411[_0x1a8e('0x1d')];var _0x2f05b4;if(_0x3187db>=_0x399f82){_0x3187db=_0x399f82;_0x2f05b4=0xc8;}else{_0x2f05b4=0xce;}_0x3895a5[_0x1a8e('0x19')](_0x2f05b4);return _0x3895a5['set'](_0x1a8e('0x1f'),_0x596b30+'-'+_0x3187db+'/'+_0x399f82)['json'](_0x2bc004);}return null;};}function patchUpdates(_0x1ed34f){return function(_0x265bdf){try{jsonpatch[_0x1a8e('0x20')](_0x265bdf,_0x1ed34f,!![]);}catch(_0x1f2441){return BPromise[_0x1a8e('0x21')](_0x1f2441);}return _0x265bdf[_0x1a8e('0x22')]();};}function saveUpdates(_0x45cf04,_0xa8f1f5){return function(_0x5e7752){if(_0x5e7752){return _0x5e7752[_0x1a8e('0x23')](_0x45cf04)['then'](function(_0x33b39a){return _0x33b39a;});}return null;};}function removeEntity(_0x19c03c,_0x37b8b4){return function(_0x5e0e83){if(_0x5e0e83){return _0x5e0e83['destroy']()['then'](function(){var _0x42868e=_0x5e0e83['get']({'plain':!![]});var _0x3c39de=[{'name':_0x1a8e('0x24'),'value':_0x1a8e('0x25'),'ignore':![]},{'name':'QueueCampaigns','value':_0x1a8e('0x26'),'ignore':![]}];var _0x544220=_(_0x3c39de)[_0x1a8e('0x27')](_0x1a8e('0x28'))[_0x1a8e('0x29')]('value')[_0x1a8e('0x2a')]();if(_[_0x1a8e('0x2b')](_0x544220,_0x42868e['type'])){return;}var _0x5da3e7=_[_0x1a8e('0x2c')](_0x3c39de,[_0x1a8e('0x2a'),_0x42868e[_0x1a8e('0x2d')]])['name'];return db[_0x1a8e('0x2e')]['destroy']({'where':{'type':_0x5da3e7,'resourceId':_0x42868e['id']}})[_0x1a8e('0x2f')](function(){return _0x5e0e83;});})[_0x1a8e('0x2f')](function(){_0x19c03c[_0x1a8e('0x19')](0xcc)[_0x1a8e('0x1a')]();});}};}function handleEntityNotFound(_0x5bad9b,_0x359378){return function(_0x5d84bc){if(!_0x5d84bc){_0x5bad9b[_0x1a8e('0x18')](0x194);}return _0x5d84bc;};}function handleError(_0x1969f1,_0x5bce61){_0x5bce61=_0x5bce61||0x1f4;return function(_0x2c7a99){logger['error'](_0x2c7a99[_0x1a8e('0x30')]);if(_0x2c7a99['name']){delete _0x2c7a99[_0x1a8e('0x31')];}_0x1969f1[_0x1a8e('0x19')](_0x5bce61)[_0x1a8e('0x32')](_0x2c7a99);};}exports[_0x1a8e('0x33')]=function(_0x46dfd4,_0x39702e){var _0x478e8f={},_0x478ed0={},_0x50c548={'count':0x0,'rows':[]};var _0x33276a=_[_0x1a8e('0x29')](db[_0x1a8e('0x34')]['rawAttributes'],function(_0x5a4802){return{'name':_0x5a4802[_0x1a8e('0x35')],'type':_0x5a4802[_0x1a8e('0x2d')][_0x1a8e('0x36')]};});_0x478ed0[_0x1a8e('0x37')]=_['map'](_0x33276a,_0x1a8e('0x31'));_0x478ed0['query']=_['keys'](_0x46dfd4[_0x1a8e('0x38')]);_0x478ed0['filters']=_[_0x1a8e('0x39')](_0x478ed0['model'],_0x478ed0['query']);_0x478e8f['attributes']=_['intersection'](_0x478ed0['model'],qs['fields'](_0x46dfd4[_0x1a8e('0x38')]['fields']));_0x478e8f['attributes']=_0x478e8f['attributes'][_0x1a8e('0x3a')]?_0x478e8f[_0x1a8e('0x3b')]:_0x478ed0[_0x1a8e('0x37')];if(!_0x46dfd4[_0x1a8e('0x38')][_0x1a8e('0x3c')](_0x1a8e('0x3d'))){_0x478e8f[_0x1a8e('0x1d')]=qs[_0x1a8e('0x1d')](_0x46dfd4['query'][_0x1a8e('0x1d')]);_0x478e8f['offset']=qs['offset'](_0x46dfd4[_0x1a8e('0x38')]['offset']);}_0x478e8f[_0x1a8e('0x3e')]=qs['sort'](_0x46dfd4['query']['sort']);_0x478e8f[_0x1a8e('0x3f')]=qs[_0x1a8e('0x40')](_[_0x1a8e('0x41')](_0x46dfd4[_0x1a8e('0x38')],_0x478ed0['filters']),_0x33276a);if(_0x46dfd4['query'][_0x1a8e('0x27')]){_0x478e8f[_0x1a8e('0x3f')]=_['merge'](_0x478e8f[_0x1a8e('0x3f')],{'$or':_[_0x1a8e('0x29')](_0x33276a,function(_0x5696fb){if(_0x5696fb[_0x1a8e('0x2d')]!=='VIRTUAL'){var _0x471fee={};_0x471fee[_0x5696fb[_0x1a8e('0x31')]]={'$like':'%'+_0x46dfd4[_0x1a8e('0x38')][_0x1a8e('0x27')]+'%'};return _0x471fee;}})});}_0x478e8f=_[_0x1a8e('0x42')]({},_0x478e8f,_0x46dfd4[_0x1a8e('0x43')]);var _0x23fa03={'where':_0x478e8f[_0x1a8e('0x3f')]};return db['VoiceQueue']['count'](_0x23fa03)['then'](function(_0x25abfb){_0x50c548['count']=_0x25abfb;if(_0x46dfd4[_0x1a8e('0x38')][_0x1a8e('0x44')]){_0x478e8f['include']=[{'all':!![]}];}return db[_0x1a8e('0x34')]['findAll'](_0x478e8f);})['then'](function(_0x566571){_0x50c548[_0x1a8e('0x45')]=_0x566571;return _0x50c548;})[_0x1a8e('0x2f')](respondWithFilteredResult(_0x39702e,_0x478e8f))[_0x1a8e('0x46')](handleError(_0x39702e,null));};exports[_0x1a8e('0x47')]=function(_0x4bbfd6,_0x5c110a){var _0x3bf0f3={'raw':![],'where':{'id':_0x4bbfd6[_0x1a8e('0x48')]['id']}},_0x3327f4={};_0x3327f4[_0x1a8e('0x37')]=_[_0x1a8e('0x49')](db[_0x1a8e('0x34')][_0x1a8e('0x4a')]);_0x3327f4[_0x1a8e('0x38')]=_[_0x1a8e('0x49')](_0x4bbfd6[_0x1a8e('0x38')]);_0x3327f4[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x3327f4[_0x1a8e('0x37')],_0x3327f4['query']);_0x3bf0f3[_0x1a8e('0x3b')]=_['intersection'](_0x3327f4[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x4bbfd6[_0x1a8e('0x38')][_0x1a8e('0x4b')]));_0x3bf0f3['attributes']=_0x3bf0f3[_0x1a8e('0x3b')][_0x1a8e('0x3a')]?_0x3bf0f3[_0x1a8e('0x3b')]:_0x3327f4[_0x1a8e('0x37')];if(_0x4bbfd6[_0x1a8e('0x38')]['includeAll']){_0x3bf0f3['include']=[{'all':!![]}];}_0x3bf0f3=_[_0x1a8e('0x42')]({},_0x3bf0f3,_0x4bbfd6[_0x1a8e('0x43')]);return db['VoiceQueue'][_0x1a8e('0x2c')](_0x3bf0f3)['then'](handleEntityNotFound(_0x5c110a,null))['then'](respondWithResult(_0x5c110a,null))[_0x1a8e('0x46')](handleError(_0x5c110a,null));};exports['create']=function(_0x4ec62e,_0x32f2ed){return db[_0x1a8e('0x34')][_0x1a8e('0x4c')](_0x4ec62e[_0x1a8e('0x4d')],{})['then'](function(_0x4e8da8){var _0x121bae=_0x4ec62e[_0x1a8e('0x4e')]['get']({'plain':!![]});if(!_0x121bae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x121bae[_0x1a8e('0x4f')]===_0x1a8e('0x4e')){var _0x20f1ce=_0x4e8da8[_0x1a8e('0x50')]({'plain':!![]});var _0x5326fa=[{'name':'VoiceQueues','value':_0x1a8e('0x25')},{'name':'QueueCampaigns','value':'outbound'}];var _0x3422e8=_[_0x1a8e('0x2c')](_0x5326fa,['value',_0x20f1ce[_0x1a8e('0x2d')]])[_0x1a8e('0x31')];return db['UserProfileSection'][_0x1a8e('0x2c')]({'where':{'name':_0x3422e8,'userProfileId':_0x121bae[_0x1a8e('0x51')]},'raw':!![]})['then'](function(_0x547b45){if(_0x547b45&&_0x547b45['autoAssociation']===0x0){return db['UserProfileResource'][_0x1a8e('0x4c')]({'name':_0x20f1ce[_0x1a8e('0x31')],'resourceId':_0x20f1ce['id'],'type':_0x547b45[_0x1a8e('0x31')],'sectionId':_0x547b45['id']},{})[_0x1a8e('0x2f')](function(){return _0x4e8da8;});}else{return _0x4e8da8;}})['catch'](function(_0x5e0e4f){logger[_0x1a8e('0x52')](_0x1a8e('0x53'),_0x5e0e4f);throw _0x5e0e4f;});}return _0x4e8da8;})['then'](respondWithResult(_0x32f2ed,0xc9))[_0x1a8e('0x46')](handleError(_0x32f2ed,null));};exports['clone']=function(_0x3d3531,_0xbda64e){var _0x2076c3={'where':{'id':_0x3d3531[_0x1a8e('0x48')]['id']}},_0x37673c={};_0x37673c['model']=_[_0x1a8e('0x49')](db[_0x1a8e('0x34')][_0x1a8e('0x4a')]);_0x2076c3['attributes']=_['intersection'](_0x37673c[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x3d3531[_0x1a8e('0x38')]['fields']));_0x2076c3[_0x1a8e('0x3b')]=_0x2076c3[_0x1a8e('0x3b')][_0x1a8e('0x3a')]?_0x2076c3[_0x1a8e('0x3b')]:_0x37673c[_0x1a8e('0x37')];if(_0x3d3531[_0x1a8e('0x38')][_0x1a8e('0x44')]){_0x2076c3['include']=[{'all':!![]}];}_0x2076c3=_[_0x1a8e('0x42')]({},_0x2076c3,_0x3d3531['options']);return db[_0x1a8e('0x34')][_0x1a8e('0x2c')](_0x2076c3)['then'](handleEntityNotFound(_0xbda64e,null))[_0x1a8e('0x2f')](function(_0x16049e){if(_0x16049e){var _0x78aac5=_0x16049e[_0x1a8e('0x50')]({'plain':!![]});_0x78aac5=qs[_0x1a8e('0x54')](_0x78aac5,['id',_0x1a8e('0x55'),_0x1a8e('0x56')]);_0x3d3531[_0x1a8e('0x4d')]=_[_0x1a8e('0x54')](_0x3d3531['body'],['id',_0x1a8e('0x55'),_0x1a8e('0x56')]);return db[_0x1a8e('0x34')][_0x1a8e('0x4c')](_[_0x1a8e('0x42')](_0x78aac5,_0x3d3531['body']),{'include':_0x3d3531['query'][_0x1a8e('0x44')]?[{'all':!![]}]:undefined})[_0x1a8e('0x2f')](function(_0x1c1e5e){var _0x155ddd=_0x3d3531[_0x1a8e('0x4e')][_0x1a8e('0x50')]({'plain':!![]});if(!_0x155ddd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x155ddd['role']===_0x1a8e('0x4e')){var _0x480337=_0x1c1e5e[_0x1a8e('0x50')]({'plain':!![]});var _0x4c1eec=[{'name':_0x1a8e('0x24'),'value':_0x1a8e('0x25')},{'name':_0x1a8e('0x57'),'value':'outbound'}];var _0x560c39=_[_0x1a8e('0x2c')](_0x4c1eec,[_0x1a8e('0x2a'),_0x480337[_0x1a8e('0x2d')]])['name'];return db[_0x1a8e('0x58')][_0x1a8e('0x2c')]({'where':{'name':_0x560c39,'userProfileId':_0x155ddd[_0x1a8e('0x51')]},'raw':!![]})[_0x1a8e('0x2f')](function(_0x4869e3){if(_0x4869e3&&_0x4869e3['autoAssociation']===0x0){return db['UserProfileResource'][_0x1a8e('0x4c')]({'name':_0x480337['name'],'resourceId':_0x480337['id'],'type':_0x4869e3['name'],'sectionId':_0x4869e3['id']},{})[_0x1a8e('0x2f')](function(){return _0x1c1e5e;});}else{return _0x1c1e5e;}})[_0x1a8e('0x46')](function(_0x3208f3){logger[_0x1a8e('0x52')](_0x1a8e('0x53'),_0x3208f3);throw _0x3208f3;});}return _0x1c1e5e;});}})[_0x1a8e('0x2f')](respondWithResult(_0xbda64e,0xc9))[_0x1a8e('0x46')](handleError(_0xbda64e,null));};exports['update']=function(_0x2e5902,_0xf16c8e){if(_0x2e5902[_0x1a8e('0x4d')]['id']){delete _0x2e5902[_0x1a8e('0x4d')]['id'];}return db[_0x1a8e('0x34')][_0x1a8e('0x2c')]({'where':{'id':_0x2e5902[_0x1a8e('0x48')]['id']}})['then'](handleEntityNotFound(_0xf16c8e,null))['then'](saveUpdates(_0x2e5902[_0x1a8e('0x4d')],null))[_0x1a8e('0x2f')](respondWithResult(_0xf16c8e,null))[_0x1a8e('0x46')](handleError(_0xf16c8e,null));};exports[_0x1a8e('0x59')]=function(_0x2baf2b,_0xe1c561){return db['VoiceQueue'][_0x1a8e('0x2c')]({'where':{'id':_0x2baf2b['params']['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0xe1c561,null))[_0x1a8e('0x2f')](removeEntity(_0xe1c561,null))[_0x1a8e('0x46')](handleError(_0xe1c561,null));};exports[_0x1a8e('0x5a')]=function(_0x2612ab,_0x3226a5,_0x55fa31){var _0x375231={'raw':![],'where':{}};var _0x18370f={};var _0x5edb3b={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x1a8e('0x5b')]({'where':{'id':_0x2612ab[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x3226a5,null))[_0x1a8e('0x2f')](function(_0x8941df){if(_0x8941df){_0x18370f[_0x1a8e('0x37')]=_[_0x1a8e('0x49')](db[_0x1a8e('0x5c')]['rawAttributes']);_0x18370f[_0x1a8e('0x38')]=_['keys'](_0x2612ab[_0x1a8e('0x38')]);_0x18370f[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x18370f[_0x1a8e('0x37')],_0x18370f[_0x1a8e('0x38')]);_0x375231[_0x1a8e('0x3b')]=_[_0x1a8e('0x39')](_0x18370f[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x2612ab['query']['fields']));_0x375231[_0x1a8e('0x3b')]=_0x375231[_0x1a8e('0x3b')]['length']?_0x375231['attributes']:_0x18370f[_0x1a8e('0x37')];if(!_0x2612ab[_0x1a8e('0x38')][_0x1a8e('0x3c')]('nolimit')){_0x375231[_0x1a8e('0x1d')]=qs[_0x1a8e('0x1d')](_0x2612ab[_0x1a8e('0x38')][_0x1a8e('0x1d')]);_0x375231[_0x1a8e('0x1c')]=qs[_0x1a8e('0x1c')](_0x2612ab[_0x1a8e('0x38')][_0x1a8e('0x1c')]);}_0x375231[_0x1a8e('0x3e')]=qs[_0x1a8e('0x5d')](_0x2612ab[_0x1a8e('0x38')][_0x1a8e('0x5d')]);_0x375231[_0x1a8e('0x3f')]=qs[_0x1a8e('0x40')](_[_0x1a8e('0x41')](_0x2612ab[_0x1a8e('0x38')],_0x18370f[_0x1a8e('0x40')]));_0x375231[_0x1a8e('0x3f')]['VoiceQueueId']=_0x8941df['id'];if(_0x2612ab[_0x1a8e('0x38')][_0x1a8e('0x27')]){_0x375231[_0x1a8e('0x3f')]=_[_0x1a8e('0x42')](_0x375231[_0x1a8e('0x3f')],{'$or':_[_0x1a8e('0x29')](_0x375231['attributes'],function(_0x56f4a5){var _0x19fe82={};_0x19fe82[_0x56f4a5]={'$like':'%'+_0x2612ab['query'][_0x1a8e('0x27')]+'%'};return _0x19fe82;})});}_0x375231=_[_0x1a8e('0x42')]({},_0x375231,_0x2612ab[_0x1a8e('0x43')]);return db['CmHopper'][_0x1a8e('0x1e')]({'where':_0x375231['where']})['then'](function(_0x5b9414){_0x5edb3b[_0x1a8e('0x1e')]=_0x5b9414;if(_0x2612ab[_0x1a8e('0x38')][_0x1a8e('0x44')]){_0x375231[_0x1a8e('0x5e')]=[{'all':!![]}];}return db['CmHopper'][_0x1a8e('0x5f')](_0x375231);})[_0x1a8e('0x2f')](function(_0x106890){_0x5edb3b['rows']=_0x106890;return _0x5edb3b;});}})[_0x1a8e('0x2f')](respondWithFilteredResult(_0x3226a5,_0x375231))[_0x1a8e('0x46')](handleError(_0x3226a5,null));};exports['getHopperHistories']=function(_0x10eeea,_0x2cf8a6,_0x27c415){var _0x5ab975={'raw':!![],'where':{}};var _0x468633={};var _0x57ed73={'count':0x0,'rows':[]};return db[_0x1a8e('0x34')][_0x1a8e('0x5b')]({'where':{'id':_0x10eeea['params']['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x2cf8a6,null))['then'](function(_0x5f3005){if(_0x5f3005){_0x468633[_0x1a8e('0x37')]=_[_0x1a8e('0x49')](db[_0x1a8e('0x60')][_0x1a8e('0x4a')]);_0x468633['query']=_[_0x1a8e('0x49')](_0x10eeea['query']);_0x468633[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x468633[_0x1a8e('0x37')],_0x468633[_0x1a8e('0x38')]);_0x5ab975[_0x1a8e('0x3b')]=_[_0x1a8e('0x39')](_0x468633[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x10eeea[_0x1a8e('0x38')][_0x1a8e('0x4b')]));_0x5ab975[_0x1a8e('0x3b')]=_0x5ab975[_0x1a8e('0x3b')][_0x1a8e('0x3a')]?_0x5ab975[_0x1a8e('0x3b')]:_0x468633[_0x1a8e('0x37')];if(!_0x10eeea[_0x1a8e('0x38')]['hasOwnProperty'](_0x1a8e('0x3d'))){_0x5ab975[_0x1a8e('0x1d')]=qs[_0x1a8e('0x1d')](_0x10eeea[_0x1a8e('0x38')][_0x1a8e('0x1d')]);_0x5ab975['offset']=qs[_0x1a8e('0x1c')](_0x10eeea[_0x1a8e('0x38')][_0x1a8e('0x1c')]);}_0x5ab975[_0x1a8e('0x3e')]=qs[_0x1a8e('0x5d')](_0x10eeea[_0x1a8e('0x38')][_0x1a8e('0x5d')]);_0x5ab975[_0x1a8e('0x3f')]=qs[_0x1a8e('0x40')](_[_0x1a8e('0x41')](_0x10eeea[_0x1a8e('0x38')],_0x468633[_0x1a8e('0x40')]));_0x5ab975[_0x1a8e('0x3f')]['VoiceQueueId']=_0x5f3005['id'];if(_0x10eeea[_0x1a8e('0x38')][_0x1a8e('0x27')]){_0x5ab975[_0x1a8e('0x3f')]=_[_0x1a8e('0x42')](_0x5ab975['where'],{'$or':_[_0x1a8e('0x29')](_0x5ab975[_0x1a8e('0x3b')],function(_0x28363c){var _0x33bc32={};_0x33bc32[_0x28363c]={'$like':'%'+_0x10eeea[_0x1a8e('0x38')][_0x1a8e('0x27')]+'%'};return _0x33bc32;})});}_0x5ab975=_[_0x1a8e('0x42')]({},_0x5ab975,_0x10eeea['options']);return db[_0x1a8e('0x60')][_0x1a8e('0x1e')]({'where':_0x5ab975[_0x1a8e('0x3f')]})[_0x1a8e('0x2f')](function(_0x7a8c2f){_0x57ed73[_0x1a8e('0x1e')]=_0x7a8c2f;if(_0x10eeea[_0x1a8e('0x38')][_0x1a8e('0x44')]){_0x5ab975['include']=[{'all':!![]}];}return db[_0x1a8e('0x60')][_0x1a8e('0x5f')](_0x5ab975);})[_0x1a8e('0x2f')](function(_0x58315e){_0x57ed73[_0x1a8e('0x45')]=_0x58315e;return _0x57ed73;});}})[_0x1a8e('0x2f')](respondWithFilteredResult(_0x2cf8a6,_0x5ab975))[_0x1a8e('0x46')](handleError(_0x2cf8a6,null));};exports[_0x1a8e('0x61')]=function(_0x1d38d1,_0x2c8941,_0x4df0cc){var _0x26eda5={'raw':!![],'where':{}};var _0x3e3ebd={};var _0x28dd1c={'count':0x0,'rows':[]};return db[_0x1a8e('0x34')][_0x1a8e('0x5b')]({'where':{'id':_0x1d38d1[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x2c8941,null))['then'](function(_0x52f65b){if(_0x52f65b){_0x3e3ebd['model']=_[_0x1a8e('0x49')](db[_0x1a8e('0x62')][_0x1a8e('0x4a')]);_0x3e3ebd['query']=_[_0x1a8e('0x49')](_0x1d38d1[_0x1a8e('0x38')]);_0x3e3ebd[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x3e3ebd[_0x1a8e('0x37')],_0x3e3ebd['query']);_0x26eda5[_0x1a8e('0x3b')]=_[_0x1a8e('0x39')](_0x3e3ebd[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x1d38d1['query'][_0x1a8e('0x4b')]));_0x26eda5[_0x1a8e('0x3b')]=_0x26eda5[_0x1a8e('0x3b')][_0x1a8e('0x3a')]?_0x26eda5[_0x1a8e('0x3b')]:_0x3e3ebd[_0x1a8e('0x37')];if(!_0x1d38d1[_0x1a8e('0x38')][_0x1a8e('0x3c')](_0x1a8e('0x3d'))){_0x26eda5[_0x1a8e('0x1d')]=qs['limit'](_0x1d38d1[_0x1a8e('0x38')][_0x1a8e('0x1d')]);_0x26eda5[_0x1a8e('0x1c')]=qs[_0x1a8e('0x1c')](_0x1d38d1[_0x1a8e('0x38')]['offset']);}_0x26eda5['order']=qs['sort'](_0x1d38d1[_0x1a8e('0x38')][_0x1a8e('0x5d')]);_0x26eda5['where']=qs['filters'](_[_0x1a8e('0x41')](_0x1d38d1['query'],_0x3e3ebd[_0x1a8e('0x40')]));_0x26eda5['where'][_0x1a8e('0x63')]=_0x52f65b['id'];if(_0x1d38d1[_0x1a8e('0x38')][_0x1a8e('0x27')]){_0x26eda5[_0x1a8e('0x3f')]=_[_0x1a8e('0x42')](_0x26eda5['where'],{'$or':_[_0x1a8e('0x29')](_0x26eda5[_0x1a8e('0x3b')],function(_0x4a6e73){var _0x4adf48={};_0x4adf48[_0x4a6e73]={'$like':'%'+_0x1d38d1['query']['filter']+'%'};return _0x4adf48;})});}_0x26eda5=_['merge']({},_0x26eda5,_0x1d38d1['options']);return db[_0x1a8e('0x62')][_0x1a8e('0x1e')]({'where':_0x26eda5[_0x1a8e('0x3f')]})[_0x1a8e('0x2f')](function(_0x249c37){_0x28dd1c[_0x1a8e('0x1e')]=_0x249c37;if(_0x1d38d1[_0x1a8e('0x38')]['includeAll']){_0x26eda5['include']=[{'all':!![]}];}return db[_0x1a8e('0x62')][_0x1a8e('0x5f')](_0x26eda5);})[_0x1a8e('0x2f')](function(_0x10cedc){_0x28dd1c['rows']=_0x10cedc;return _0x28dd1c;});}})[_0x1a8e('0x2f')](respondWithFilteredResult(_0x2c8941,_0x26eda5))['catch'](handleError(_0x2c8941,null));};exports[_0x1a8e('0x64')]=function(_0x191d0d,_0x37fba2,_0x22d268){var _0x1b5e74={'raw':!![],'where':{}};var _0x42dc6c={};var _0x45d176={'count':0x0,'rows':[]};return db[_0x1a8e('0x34')]['findOne']({'where':{'id':_0x191d0d[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x37fba2,null))[_0x1a8e('0x2f')](function(_0x42eb9){if(_0x42eb9){_0x42dc6c[_0x1a8e('0x37')]=_[_0x1a8e('0x49')](db[_0x1a8e('0x65')][_0x1a8e('0x4a')]);_0x42dc6c[_0x1a8e('0x38')]=_[_0x1a8e('0x49')](_0x191d0d[_0x1a8e('0x38')]);_0x42dc6c[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x42dc6c[_0x1a8e('0x37')],_0x42dc6c[_0x1a8e('0x38')]);_0x1b5e74[_0x1a8e('0x3b')]=_[_0x1a8e('0x39')](_0x42dc6c[_0x1a8e('0x37')],qs['fields'](_0x191d0d[_0x1a8e('0x38')]['fields']));_0x1b5e74['attributes']=_0x1b5e74[_0x1a8e('0x3b')][_0x1a8e('0x3a')]?_0x1b5e74[_0x1a8e('0x3b')]:_0x42dc6c[_0x1a8e('0x37')];if(!_0x191d0d[_0x1a8e('0x38')][_0x1a8e('0x3c')](_0x1a8e('0x3d'))){_0x1b5e74[_0x1a8e('0x1d')]=qs[_0x1a8e('0x1d')](_0x191d0d['query'][_0x1a8e('0x1d')]);_0x1b5e74[_0x1a8e('0x1c')]=qs['offset'](_0x191d0d[_0x1a8e('0x38')][_0x1a8e('0x1c')]);}_0x1b5e74['order']=qs['sort'](_0x191d0d['query'][_0x1a8e('0x5d')]);_0x1b5e74[_0x1a8e('0x3f')]=qs['filters'](_['pick'](_0x191d0d[_0x1a8e('0x38')],_0x42dc6c[_0x1a8e('0x40')]));_0x1b5e74[_0x1a8e('0x3f')][_0x1a8e('0x63')]=_0x42eb9['id'];if(_0x191d0d[_0x1a8e('0x38')]['filter']){_0x1b5e74[_0x1a8e('0x3f')]=_[_0x1a8e('0x42')](_0x1b5e74[_0x1a8e('0x3f')],{'$or':_[_0x1a8e('0x29')](_0x1b5e74[_0x1a8e('0x3b')],function(_0x5b0b56){var _0x4009cc={};_0x4009cc[_0x5b0b56]={'$like':'%'+_0x191d0d[_0x1a8e('0x38')][_0x1a8e('0x27')]+'%'};return _0x4009cc;})});}_0x1b5e74=_[_0x1a8e('0x42')]({},_0x1b5e74,_0x191d0d['options']);return db[_0x1a8e('0x65')]['count']({'where':_0x1b5e74[_0x1a8e('0x3f')]})[_0x1a8e('0x2f')](function(_0x56ac3c){_0x45d176[_0x1a8e('0x1e')]=_0x56ac3c;if(_0x191d0d['query'][_0x1a8e('0x44')]){_0x1b5e74[_0x1a8e('0x5e')]=[{'all':!![]}];}return db[_0x1a8e('0x65')][_0x1a8e('0x5f')](_0x1b5e74);})[_0x1a8e('0x2f')](function(_0xfb9abd){_0x45d176[_0x1a8e('0x45')]=_0xfb9abd;return _0x45d176;});}})[_0x1a8e('0x2f')](respondWithFilteredResult(_0x37fba2,_0x1b5e74))[_0x1a8e('0x46')](handleError(_0x37fba2,null));};exports['getTeams']=function(_0x127b95,_0x236260,_0xd6e161){var _0x231c7c={};var _0x46f64c={};var _0x5da7b0;var _0x1639a1;return db[_0x1a8e('0x34')][_0x1a8e('0x5b')]({'where':{'id':_0x127b95[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x236260,null))[_0x1a8e('0x2f')](function(_0x3d6bae){if(_0x3d6bae){_0x5da7b0=_0x3d6bae;_0x46f64c[_0x1a8e('0x37')]=_[_0x1a8e('0x49')](db[_0x1a8e('0x66')][_0x1a8e('0x4a')]);_0x46f64c[_0x1a8e('0x38')]=_[_0x1a8e('0x49')](_0x127b95['query']);_0x46f64c[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x46f64c[_0x1a8e('0x37')],_0x46f64c[_0x1a8e('0x38')]);_0x231c7c['attributes']=_[_0x1a8e('0x39')](_0x46f64c[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x127b95[_0x1a8e('0x38')][_0x1a8e('0x4b')]));_0x231c7c[_0x1a8e('0x3b')]=_0x231c7c[_0x1a8e('0x3b')]['length']?_0x231c7c[_0x1a8e('0x3b')]:_0x46f64c[_0x1a8e('0x37')];_0x231c7c[_0x1a8e('0x3e')]=qs[_0x1a8e('0x5d')](_0x127b95[_0x1a8e('0x38')]['sort']);_0x231c7c[_0x1a8e('0x3f')]=qs[_0x1a8e('0x40')](_[_0x1a8e('0x41')](_0x127b95['query'],_0x46f64c[_0x1a8e('0x40')]));if(_0x127b95[_0x1a8e('0x38')][_0x1a8e('0x27')]){_0x231c7c[_0x1a8e('0x3f')]=_['merge'](_0x231c7c[_0x1a8e('0x3f')],{'$or':_[_0x1a8e('0x29')](_0x231c7c[_0x1a8e('0x3b')],function(_0x3b4025){var _0x57b23f={};_0x57b23f[_0x3b4025]={'$like':'%'+_0x127b95[_0x1a8e('0x38')][_0x1a8e('0x27')]+'%'};return _0x57b23f;})});}_0x231c7c=_[_0x1a8e('0x42')]({},_0x231c7c,_0x127b95[_0x1a8e('0x43')]);return _0x5da7b0[_0x1a8e('0x67')](_0x231c7c);}})[_0x1a8e('0x2f')](function(_0x246b7c){if(_0x246b7c){_0x1639a1=_0x246b7c['length'];if(!_0x127b95[_0x1a8e('0x38')][_0x1a8e('0x3c')](_0x1a8e('0x3d'))){_0x231c7c['limit']=qs[_0x1a8e('0x1d')](_0x127b95[_0x1a8e('0x38')][_0x1a8e('0x1d')]);_0x231c7c[_0x1a8e('0x1c')]=qs[_0x1a8e('0x1c')](_0x127b95[_0x1a8e('0x38')]['offset']);}return _0x5da7b0[_0x1a8e('0x67')](_0x231c7c);}})[_0x1a8e('0x2f')](function(_0x5d0604){if(_0x5d0604){return _0x5d0604?{'count':_0x1639a1,'rows':_0x5d0604}:null;}})['then'](respondWithResult(_0x236260,null))[_0x1a8e('0x46')](handleError(_0x236260,null));};exports[_0x1a8e('0x68')]=function(_0x1116a0,_0x4d799d,_0x3910c3){var _0x3a699c=_0x1116a0[_0x1a8e('0x4d')]['teams'];var _0x464a6d=_[_0x1a8e('0x29')](_0x3a699c,'id');return db[_0x1a8e('0x66')][_0x1a8e('0x5f')]({'where':{'id':_0x464a6d},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1a8e('0x69'),'attributes':['id',_0x1a8e('0x31'),_0x1a8e('0x6a'),_0x1a8e('0x6b'),_0x1a8e('0x6c')],'raw':!![]}]})[_0x1a8e('0x2f')](function(_0x2a1a96){if(_0x2a1a96){var _0x28defb=_[_0x1a8e('0x6d')](_0x2a1a96,function(_0xc01fa4){var _0x22202d=_0xc01fa4[_0x1a8e('0x50')]({'plain':!![]});_0x22202d[_0x1a8e('0x69')][_0x1a8e('0x6e')](function(_0x3b5365){_0x3b5365[_0x1a8e('0x6f')]=_[_0x1a8e('0x2c')](_0x3a699c,{'id':_0x22202d['id']})['penalty'];});return _0x22202d[_0x1a8e('0x69')];});return db['VoiceQueue'][_0x1a8e('0x2c')]({'where':{'id':_0x1116a0['params']['id']}})['then'](function(_0x3b5161){return db[_0x1a8e('0x70')][_0x1a8e('0x71')](function(_0x17b036){return _0x3b5161['addTeams'](_0x464a6d,{'transaction':_0x17b036})[_0x1a8e('0x2f')](function(){return BPromise[_0x1a8e('0x72')](_0x3a699c,function(_0x3d8150){return db[_0x1a8e('0x73')][_0x1a8e('0x74')]({'TeamId':_0x3d8150['id'],'VoiceQueueId':_0x1116a0[_0x1a8e('0x48')]['id'],'penalty':_0x3d8150[_0x1a8e('0x6f')]},{'transaction':_0x17b036});});})[_0x1a8e('0x2f')](function(){return BPromise[_0x1a8e('0x72')](_0x28defb,function(_0x16d5c0){return db[_0x1a8e('0x75')][_0x1a8e('0x76')]({'where':{'UserId':_0x16d5c0['id'],'VoiceQueueId':_0x1116a0[_0x1a8e('0x48')]['id']},'defaults':{'penalty':_0x16d5c0[_0x1a8e('0x6f')]},'transaction':_0x17b036});});})['then'](function(){return BPromise[_0x1a8e('0x72')](_[_0x1a8e('0x27')](_0x28defb,{'online':!![]}),function(_0x308b22){return db[_0x1a8e('0x77')][_0x1a8e('0x74')]({'membername':_0x308b22['name'],'UserId':_0x308b22['id'],'queue_name':_0x3b5161[_0x1a8e('0x31')],'VoiceQueueId':_0x3b5161['id'],'interface':_[_0x1a8e('0x78')](_0x308b22[_0x1a8e('0x6c')])?util[_0x1a8e('0x79')]('SIP/%s',_0x308b22[_0x1a8e('0x31')]):_0x308b22[_0x1a8e('0x6c')],'paused':_0x308b22[_0x1a8e('0x6b')]||![],'penalty':_0x308b22[_0x1a8e('0x6f')]},{'transaction':_0x17b036});});})[_0x1a8e('0x2f')](function(){_0x28defb[_0x1a8e('0x6e')](function(_0x12b8f1){socket['emit'](_0x1a8e('0x7a'),{'UserId':_0x12b8f1['id'],'VoiceQueueId':_0x3b5161['id']});});});});});}})[_0x1a8e('0x2f')](respondWithStatusCode(_0x4d799d,null))[_0x1a8e('0x46')](handleError(_0x4d799d,null));};exports['removeTeams']=function(_0x20330b,_0x1bd972,_0x4257c0){return db[_0x1a8e('0x66')][_0x1a8e('0x5f')]({'where':{'id':_0x20330b['query'][_0x1a8e('0x7b')]},'attributes':['id'],'include':[{'model':db[_0x1a8e('0x7c')],'as':_0x1a8e('0x69'),'attributes':['id'],'raw':!![]}]})[_0x1a8e('0x2f')](handleEntityNotFound(_0x1bd972,null))[_0x1a8e('0x2f')](function(_0x3c939e){var _0x9e023e=_['map'](_0x3c939e,'id');var _0x357f39=[];var _0x998dd=[];var _0x1e30c6=squel['select']();_0x1e30c6[_0x1a8e('0x7d')](_0x1a8e('0x7e'))[_0x1a8e('0x7f')](_0x1a8e('0x80'),'tq')[_0x1a8e('0x81')](_0x1a8e('0x82'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x1a8e('0x3f')](_0x1a8e('0x83'),_0x20330b[_0x1a8e('0x48')]['id']);for(var _0x39e605=0x0;_0x39e605<_0x3c939e[_0x1a8e('0x3a')];_0x39e605+=0x1){let _0x283a9d=_0x3c939e[_0x39e605];for(var _0x97034e=0x0;_0x97034e<_0x283a9d[_0x1a8e('0x69')][_0x1a8e('0x3a')];_0x97034e+=0x1){let _0xb7cbc6=_0x283a9d['Agents'][_0x97034e];var _0x4f0aad=_0x1e30c6['clone']();_0x4f0aad[_0x1a8e('0x3f')](_0x1a8e('0x84'),_0xb7cbc6['id']);_0x998dd[_0x1a8e('0x85')](db['sequelize'][_0x1a8e('0x38')](_0x4f0aad[_0x1a8e('0x86')](),{'type':db[_0x1a8e('0x70')]['QueryTypes'][_0x1a8e('0x87')]})[_0x1a8e('0x2f')](function(_0x446ee0){if(_0x446ee0[_0x1a8e('0x3a')]===0x1){return _0xb7cbc6['id'];}else{var _0x3be6dc=_[_0x1a8e('0x88')](_[_0x1a8e('0x29')](_0x446ee0,_0x1a8e('0x89')),function(_0x42db5a){return _[_0x1a8e('0x2b')](_0x9e023e,_0x42db5a);});if(_0x3be6dc){return _0xb7cbc6['id'];}}}));}}return BPromise[_0x1a8e('0x8a')](_0x998dd)[_0x1a8e('0x2f')](function(_0x583f07){_0x357f39=_(_0x357f39)['union'](_0x583f07)[_0x1a8e('0x8b')]()[_0x1a8e('0x2a')]();return db['VoiceQueue'][_0x1a8e('0x2c')]({'where':{'id':_0x20330b['params']['id']}})[_0x1a8e('0x2f')](function(_0x170457){return db[_0x1a8e('0x70')][_0x1a8e('0x71')](function(_0x4dafbf){return _0x170457[_0x1a8e('0x8c')](_0x20330b[_0x1a8e('0x38')][_0x1a8e('0x7b')],{'transaction':_0x4dafbf})[_0x1a8e('0x2f')](function(){if(!_[_0x1a8e('0x8d')](_0x357f39)){return _0x170457['removeAgents'](_0x357f39,{'transaction':_0x4dafbf})[_0x1a8e('0x2f')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x20330b[_0x1a8e('0x48')]['id'],'UserId':_0x357f39},'transaction':_0x4dafbf});});}})[_0x1a8e('0x2f')](function(){_0x357f39[_0x1a8e('0x6e')](function(_0x28df57){socket[_0x1a8e('0x8e')]('userVoiceQueue:remove',{'UserId':_0x28df57,'VoiceQueueId':_0x170457['id']});});});});});});})['then'](respondWithStatusCode(_0x1bd972,null))[_0x1a8e('0x46')](handleError(_0x1bd972,null));};exports[_0x1a8e('0x8f')]=function(_0x284af4,_0x491a96,_0xd17dab){var _0x5ae9bc,_0x5ebb78;return db[_0x1a8e('0x34')][_0x1a8e('0x2c')]({'where':{'id':_0x284af4['params']['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x491a96,null))[_0x1a8e('0x2f')](function(_0x27145c){if(_0x27145c){_0x5ebb78=_0x27145c;return _0x27145c['addAgents'](_0x284af4[_0x1a8e('0x4d')][_0x1a8e('0x7b')],_[_0x1a8e('0x54')](_0x284af4[_0x1a8e('0x4d')],['ids','id'])||{})[_0x1a8e('0x90')](function(_0x2ca61b){for(var _0x11f010=0x0;_0x11f010<_0x284af4[_0x1a8e('0x4d')]['ids']['length'];_0x11f010+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':Number(_0x284af4[_0x1a8e('0x4d')][_0x1a8e('0x7b')][_0x11f010]),'VoiceQueueId':Number(_0x284af4[_0x1a8e('0x48')]['id'])});}return _0x2ca61b;});}})[_0x1a8e('0x2f')](function(_0x232e4d){_0x5ae9bc=_0x232e4d||[];if(_0x5ebb78){return db[_0x1a8e('0x7c')][_0x1a8e('0x5f')]({'where':{'id':_0x284af4[_0x1a8e('0x4d')][_0x1a8e('0x7b')]},'attributes':['id',_0x1a8e('0x31'),_0x1a8e('0x6a'),_0x1a8e('0x6b'),_0x1a8e('0x6c')],'raw':!![]});}})[_0x1a8e('0x2f')](function(_0x885f93){if(!_['isEmpty'](_0x885f93)){var _0x55adb8=[];for(var _0x272cf7=0x0;_0x272cf7<_0x885f93[_0x1a8e('0x3a')];_0x272cf7++){if(_0x885f93[_0x272cf7]['online']){_0x55adb8[_0x1a8e('0x85')](db[_0x1a8e('0x77')][_0x1a8e('0x74')]({'membername':_0x885f93[_0x272cf7][_0x1a8e('0x31')],'UserId':_0x885f93[_0x272cf7]['id'],'queue_name':_0x5ebb78[_0x1a8e('0x31')],'VoiceQueueId':_0x5ebb78['id'],'interface':_[_0x1a8e('0x78')](_0x885f93[_0x272cf7][_0x1a8e('0x6c')])?util[_0x1a8e('0x79')](_0x1a8e('0x91'),_0x885f93[_0x272cf7]['name']):_0x885f93[_0x272cf7][_0x1a8e('0x6c')],'paused':_0x885f93[_0x272cf7]['voicePause']||![],'penalty':_0x284af4[_0x1a8e('0x4d')][_0x1a8e('0x6f')]||0x0}));}}return BPromise['all'](_0x55adb8);}})['then'](function(){return _0x5ae9bc;})[_0x1a8e('0x2f')](respondWithResult(_0x491a96,null))[_0x1a8e('0x46')](handleError(_0x491a96,null));};exports[_0x1a8e('0x92')]=function(_0x2e6a77,_0x4b14dd,_0x5cbc75){return db[_0x1a8e('0x34')][_0x1a8e('0x2c')]({'where':{'id':_0x2e6a77[_0x1a8e('0x48')]['id']}})['then'](handleEntityNotFound(_0x4b14dd,null))['then'](function(_0x1d4e98){if(_0x1d4e98){return _0x1d4e98['removeAgents'](_0x2e6a77[_0x1a8e('0x38')][_0x1a8e('0x7b')])[_0x1a8e('0x2f')](function(){if(_[_0x1a8e('0x93')](_0x2e6a77['query'][_0x1a8e('0x7b')])){for(var _0x16de5f=0x0;_0x16de5f<_0x2e6a77['query'][_0x1a8e('0x7b')]['length'];_0x16de5f+=0x1){socket[_0x1a8e('0x8e')](_0x1a8e('0x94'),{'UserId':Number(_0x2e6a77[_0x1a8e('0x38')]['ids'][_0x16de5f]),'VoiceQueueId':Number(_0x2e6a77[_0x1a8e('0x48')]['id'])});}}else{socket[_0x1a8e('0x8e')](_0x1a8e('0x94'),{'UserId':Number(_0x2e6a77[_0x1a8e('0x38')]['ids']),'VoiceQueueId':Number(_0x2e6a77[_0x1a8e('0x48')]['id'])});}});}})[_0x1a8e('0x2f')](function(_0x1ac4ca){return db[_0x1a8e('0x77')]['destroy']({'where':{'VoiceQueueId':_0x2e6a77[_0x1a8e('0x48')]['id'],'UserId':_0x2e6a77[_0x1a8e('0x38')][_0x1a8e('0x7b')]}})['then'](function(){return _0x1ac4ca;});})[_0x1a8e('0x2f')](respondWithStatusCode(_0x4b14dd,null))[_0x1a8e('0x46')](handleError(_0x4b14dd,null));};exports[_0x1a8e('0x95')]=function(_0x294a5c,_0x77d7b,_0x3820ad){var _0x434e97={};var _0x171fed={};var _0x145176;var _0x25a898;return db[_0x1a8e('0x34')]['findOne']({'where':{'id':_0x294a5c[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x77d7b,null))[_0x1a8e('0x2f')](function(_0x30382d){if(_0x30382d){_0x145176=_0x30382d;_0x171fed[_0x1a8e('0x37')]=_[_0x1a8e('0x49')](db[_0x1a8e('0x7c')][_0x1a8e('0x4a')]);_0x171fed['query']=_[_0x1a8e('0x49')](_0x294a5c[_0x1a8e('0x38')]);_0x171fed[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x171fed[_0x1a8e('0x37')],_0x171fed[_0x1a8e('0x38')]);_0x434e97['attributes']=_['intersection'](_0x171fed[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x294a5c[_0x1a8e('0x38')][_0x1a8e('0x4b')]));_0x434e97[_0x1a8e('0x3b')]=_0x434e97[_0x1a8e('0x3b')][_0x1a8e('0x3a')]?_0x434e97[_0x1a8e('0x3b')]:_0x171fed[_0x1a8e('0x37')];_0x434e97[_0x1a8e('0x3e')]=qs[_0x1a8e('0x5d')](_0x294a5c[_0x1a8e('0x38')][_0x1a8e('0x5d')]);_0x434e97[_0x1a8e('0x3f')]=qs[_0x1a8e('0x40')](_['pick'](_0x294a5c[_0x1a8e('0x38')],_0x171fed['filters']));if(_0x294a5c['query'][_0x1a8e('0x27')]){_0x434e97[_0x1a8e('0x3f')]=_[_0x1a8e('0x42')](_0x434e97[_0x1a8e('0x3f')],{'$or':_[_0x1a8e('0x29')](_0x434e97[_0x1a8e('0x3b')],function(_0xd85948){var _0x2719ad={};_0x2719ad[_0xd85948]={'$like':'%'+_0x294a5c[_0x1a8e('0x38')][_0x1a8e('0x27')]+'%'};return _0x2719ad;})});}_0x434e97=_[_0x1a8e('0x42')]({},_0x434e97,_0x294a5c[_0x1a8e('0x43')]);return _0x145176[_0x1a8e('0x95')](_0x434e97);}})[_0x1a8e('0x2f')](function(_0x488f37){if(_0x488f37){_0x25a898=_0x488f37[_0x1a8e('0x3a')];if(!_0x294a5c[_0x1a8e('0x38')][_0x1a8e('0x3c')](_0x1a8e('0x3d'))){_0x434e97[_0x1a8e('0x1d')]=qs[_0x1a8e('0x1d')](_0x294a5c[_0x1a8e('0x38')]['limit']);_0x434e97['offset']=qs['offset'](_0x294a5c[_0x1a8e('0x38')][_0x1a8e('0x1c')]);}return _0x145176[_0x1a8e('0x95')](_0x434e97);}})[_0x1a8e('0x2f')](function(_0x4efb64){if(_0x4efb64){return _0x4efb64?{'count':_0x25a898,'rows':_0x4efb64}:null;}})[_0x1a8e('0x2f')](respondWithResult(_0x77d7b,null))[_0x1a8e('0x46')](handleError(_0x77d7b,null));};exports[_0x1a8e('0x96')]=function(_0x2dab67,_0x227818,_0x4c4d6e){var _0x3bf7f4={};var _0x51ad4b={};var _0x25c613;var _0x400800;return db[_0x1a8e('0x34')]['findOne']({'where':{'id':_0x2dab67[_0x1a8e('0x48')]['id']}})['then'](handleEntityNotFound(_0x227818,null))[_0x1a8e('0x2f')](function(_0x5dda0d){if(_0x5dda0d){_0x25c613=_0x5dda0d;_0x51ad4b[_0x1a8e('0x37')]=_[_0x1a8e('0x49')](db['UserVoiceQueueRt']['rawAttributes']);_0x51ad4b[_0x1a8e('0x38')]=_[_0x1a8e('0x49')](_0x2dab67[_0x1a8e('0x38')]);_0x51ad4b[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x51ad4b[_0x1a8e('0x37')],_0x51ad4b[_0x1a8e('0x38')]);_0x3bf7f4[_0x1a8e('0x3b')]=_[_0x1a8e('0x39')](_0x51ad4b[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x2dab67[_0x1a8e('0x38')][_0x1a8e('0x4b')]));_0x3bf7f4[_0x1a8e('0x3b')]=_0x3bf7f4[_0x1a8e('0x3b')][_0x1a8e('0x3a')]?_0x3bf7f4['attributes']:_0x51ad4b['model'];_0x3bf7f4[_0x1a8e('0x3e')]=qs[_0x1a8e('0x5d')](_0x2dab67[_0x1a8e('0x38')][_0x1a8e('0x5d')]);_0x3bf7f4['where']=qs[_0x1a8e('0x40')](_[_0x1a8e('0x41')](_0x2dab67[_0x1a8e('0x38')],_0x51ad4b[_0x1a8e('0x40')]));if(_0x2dab67['query'][_0x1a8e('0x27')]){_0x3bf7f4[_0x1a8e('0x3f')]=_[_0x1a8e('0x42')](_0x3bf7f4[_0x1a8e('0x3f')],{'$or':_[_0x1a8e('0x29')](_0x3bf7f4['attributes'],function(_0x5d5337){var _0xc31874={};_0xc31874[_0x5d5337]={'$like':'%'+_0x2dab67[_0x1a8e('0x38')][_0x1a8e('0x27')]+'%'};return _0xc31874;})});}_0x3bf7f4=_[_0x1a8e('0x42')]({},_0x3bf7f4,_0x2dab67['options']);return _0x25c613[_0x1a8e('0x96')](_0x3bf7f4);}})[_0x1a8e('0x2f')](function(_0x58d9d8){if(_0x58d9d8){_0x400800=_0x58d9d8['length'];if(!_0x2dab67[_0x1a8e('0x38')][_0x1a8e('0x3c')](_0x1a8e('0x3d'))){_0x3bf7f4[_0x1a8e('0x1d')]=qs[_0x1a8e('0x1d')](_0x2dab67[_0x1a8e('0x38')]['limit']);_0x3bf7f4['offset']=qs['offset'](_0x2dab67[_0x1a8e('0x38')][_0x1a8e('0x1c')]);}return _0x25c613[_0x1a8e('0x96')](_0x3bf7f4);}})['then'](function(_0x24e5a7){return _0x24e5a7?{'count':_0x400800,'rows':_0x24e5a7}:null;})[_0x1a8e('0x2f')](respondWithResult(_0x227818,null))[_0x1a8e('0x46')](handleError(_0x227818,null));};exports['getLists']=function(_0x54eda1,_0x5eb853,_0x36afae){var _0x4c3bdc={};var _0x1fe141={};var _0x213383;var _0x4fdc84;return db[_0x1a8e('0x34')]['findOne']({'where':{'id':_0x54eda1[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x5eb853,null))['then'](function(_0x25ec54){if(_0x25ec54){_0x213383=_0x25ec54;_0x1fe141['model']=_[_0x1a8e('0x49')](db['CmList']['rawAttributes']);_0x1fe141[_0x1a8e('0x38')]=_[_0x1a8e('0x49')](_0x54eda1['query']);_0x1fe141[_0x1a8e('0x40')]=_[_0x1a8e('0x39')](_0x1fe141['model'],_0x1fe141[_0x1a8e('0x38')]);_0x4c3bdc[_0x1a8e('0x3b')]=_[_0x1a8e('0x39')](_0x1fe141[_0x1a8e('0x37')],qs[_0x1a8e('0x4b')](_0x54eda1[_0x1a8e('0x38')][_0x1a8e('0x4b')]));_0x4c3bdc[_0x1a8e('0x3b')]=_0x4c3bdc['attributes'][_0x1a8e('0x3a')]?_0x4c3bdc[_0x1a8e('0x3b')]:_0x1fe141[_0x1a8e('0x37')];_0x4c3bdc[_0x1a8e('0x3e')]=qs['sort'](_0x54eda1[_0x1a8e('0x38')]['sort']);_0x4c3bdc[_0x1a8e('0x3f')]=qs[_0x1a8e('0x40')](_[_0x1a8e('0x41')](_0x54eda1[_0x1a8e('0x38')],_0x1fe141['filters']));if(_0x54eda1[_0x1a8e('0x38')][_0x1a8e('0x27')]){_0x4c3bdc[_0x1a8e('0x3f')]=_[_0x1a8e('0x42')](_0x4c3bdc[_0x1a8e('0x3f')],{'$or':_[_0x1a8e('0x29')](_0x4c3bdc[_0x1a8e('0x3b')],function(_0x2699ec){var _0x5c3159={};_0x5c3159[_0x2699ec]={'$like':'%'+_0x54eda1[_0x1a8e('0x38')][_0x1a8e('0x27')]+'%'};return _0x5c3159;})});}_0x4c3bdc=_['merge']({},_0x4c3bdc,_0x54eda1[_0x1a8e('0x43')]);return _0x213383[_0x1a8e('0x97')](_0x4c3bdc);}})[_0x1a8e('0x2f')](function(_0x407d1e){if(_0x407d1e){_0x4fdc84=_0x407d1e[_0x1a8e('0x3a')];if(!_0x54eda1[_0x1a8e('0x38')][_0x1a8e('0x3c')]('nolimit')){_0x4c3bdc['limit']=qs[_0x1a8e('0x1d')](_0x54eda1[_0x1a8e('0x38')][_0x1a8e('0x1d')]);_0x4c3bdc[_0x1a8e('0x1c')]=qs[_0x1a8e('0x1c')](_0x54eda1[_0x1a8e('0x38')][_0x1a8e('0x1c')]);}return _0x213383[_0x1a8e('0x97')](_0x4c3bdc);}})['then'](function(_0x812f71){if(_0x812f71){return _0x812f71?{'count':_0x4fdc84,'rows':_0x812f71}:null;}})[_0x1a8e('0x2f')](respondWithResult(_0x5eb853,null))['catch'](handleError(_0x5eb853,null));};exports['addLists']=function(_0x2fd45a,_0x5bf72c,_0x24b274){var _0x2f1e49,_0x44b060;return db[_0x1a8e('0x34')][_0x1a8e('0x2c')]({'where':{'id':_0x2fd45a[_0x1a8e('0x48')]['id']}})['then'](handleEntityNotFound(_0x5bf72c,null))[_0x1a8e('0x2f')](function(_0x47bd86){if(_0x47bd86){_0x44b060=_0x47bd86;return _0x47bd86['addLists'](_0x2fd45a[_0x1a8e('0x4d')][_0x1a8e('0x7b')],_[_0x1a8e('0x54')](_0x2fd45a['body'],[_0x1a8e('0x7b'),'id'])||{});}return null;})[_0x1a8e('0x90')](function(_0x3ec739){var _0x44ebb7;_0x2f1e49=_0x3ec739||[];var _0x27d9e0=[];if(_0x3ec739){for(var _0xe46a30=0x0;_0xe46a30<_0x3ec739[_0x1a8e('0x3a')];_0xe46a30+=0x1){var _0x4b2a7b=_0x3ec739[_0xe46a30]['get']({'plain':!![]});_0x44b060[_0x1a8e('0x98')]=_0x2fd45a['body'][_0x1a8e('0x98')]?_0x2fd45a[_0x1a8e('0x4d')][_0x1a8e('0x98')]:_0x44b060['dialCheckDuplicateType'];switch(_0x44b060[_0x1a8e('0x98')]){case _0x1a8e('0x99'):_0x44ebb7=squel[_0x1a8e('0x9a')]()[_0x1a8e('0x9b')]('cm_hopper')[_0x1a8e('0x9c')]([_0x1a8e('0x9d'),'scheduledAt','ContactId',_0x1a8e('0x9e'),'VoiceQueueId',_0x1a8e('0x55'),_0x1a8e('0x56')],squel['select']()[_0x1a8e('0x7d')]('phone','phone')[_0x1a8e('0x7d')]('NOW()',_0x1a8e('0x9f'))[_0x1a8e('0x7d')]('id',_0x1a8e('0xa0'))['field'](_0x4b2a7b[_0x1a8e('0xa1')][_0x1a8e('0x86')](),_0x1a8e('0x9e'))[_0x1a8e('0x7d')](_0x2fd45a[_0x1a8e('0x48')]['id'][_0x1a8e('0x86')](),_0x1a8e('0x63'))[_0x1a8e('0x7d')](_0x1a8e('0xa2'),'createdAt')['field'](_0x1a8e('0xa2'),_0x1a8e('0x56'))[_0x1a8e('0x7f')](_0x1a8e('0xa3'))[_0x1a8e('0x3f')](_0x1a8e('0xa4'))[_0x1a8e('0x3f')](_0x1a8e('0xa5'),_0x4b2a7b[_0x1a8e('0xa1')][_0x1a8e('0x86')]())[_0x1a8e('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1a8e('0xa6')]()[_0x1a8e('0x7d')](_0x1a8e('0xa7'))[_0x1a8e('0x7f')]('cm_hopper_final')[_0x1a8e('0x3f')]('VoiceQueueId\x20=\x20?',_0x2fd45a[_0x1a8e('0x48')]['id']['toString']()))[_0x1a8e('0x3f')](_0x1a8e('0xa8'),squel[_0x1a8e('0xa6')]()[_0x1a8e('0x7d')](_0x1a8e('0xa9'))[_0x1a8e('0x7f')](_0x1a8e('0xaa'))[_0x1a8e('0x3f')](_0x1a8e('0x83'),_0x2fd45a[_0x1a8e('0x48')]['id'][_0x1a8e('0x86')]())))[_0x1a8e('0x86')]();break;case _0x1a8e('0xab'):_0x44ebb7=squel[_0x1a8e('0x9a')]()[_0x1a8e('0x9b')]('cm_hopper')[_0x1a8e('0x9c')]([_0x1a8e('0x9d'),_0x1a8e('0x9f'),'ContactId',_0x1a8e('0x9e'),_0x1a8e('0x63'),_0x1a8e('0x55'),'updatedAt'],squel[_0x1a8e('0xa6')]()[_0x1a8e('0x7d')](_0x1a8e('0x9d'),_0x1a8e('0x9d'))[_0x1a8e('0x7d')](_0x1a8e('0xa2'),'scheduledAt')[_0x1a8e('0x7d')]('id','ContactId')['field'](_0x4b2a7b['CmListId'][_0x1a8e('0x86')](),_0x1a8e('0x9e'))[_0x1a8e('0x7d')](_0x2fd45a[_0x1a8e('0x48')]['id']['toString'](),_0x1a8e('0x63'))[_0x1a8e('0x7d')]('NOW()',_0x1a8e('0x55'))[_0x1a8e('0x7d')](_0x1a8e('0xa2'),_0x1a8e('0x56'))['from'](_0x1a8e('0xa3'))['where'](_0x1a8e('0xa4'))[_0x1a8e('0x3f')](_0x1a8e('0xa5'),_0x4b2a7b['CmListId'][_0x1a8e('0x86')]())[_0x1a8e('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x1a8e('0x3f')](_0x1a8e('0xa8'),squel['select']()[_0x1a8e('0x7d')](_0x1a8e('0xa9'))['from'](_0x1a8e('0xaa'))[_0x1a8e('0x3f')]('VoiceQueueId\x20=\x20?',_0x2fd45a[_0x1a8e('0x48')]['id'][_0x1a8e('0x86')]())))[_0x1a8e('0x86')]();break;default:_0x44ebb7=squel['insert']()[_0x1a8e('0x9b')](_0x1a8e('0xaa'))['fromQuery']([_0x1a8e('0x9d'),'scheduledAt',_0x1a8e('0xa0'),'ListId',_0x1a8e('0x63'),_0x1a8e('0x55'),_0x1a8e('0x56')],squel[_0x1a8e('0xa6')]()[_0x1a8e('0x7d')](_0x1a8e('0x9d'),_0x1a8e('0x9d'))[_0x1a8e('0x7d')](_0x1a8e('0xa2'),_0x1a8e('0x9f'))[_0x1a8e('0x7d')]('id',_0x1a8e('0xa0'))[_0x1a8e('0x7d')](_0x4b2a7b[_0x1a8e('0xa1')]['toString'](),'ListId')[_0x1a8e('0x7d')](_0x2fd45a[_0x1a8e('0x48')]['id'][_0x1a8e('0x86')](),'VoiceQueueId')[_0x1a8e('0x7d')]('NOW()','createdAt')['field'](_0x1a8e('0xa2'),'updatedAt')[_0x1a8e('0x7f')](_0x1a8e('0xa3'))[_0x1a8e('0x3f')]('deletedAt\x20IS\x20NULL')[_0x1a8e('0x3f')](_0x1a8e('0xa5'),_0x4b2a7b[_0x1a8e('0xa1')]['toString']())['where'](_0x1a8e('0xac')))['toString']();}_0x27d9e0[_0x1a8e('0x85')](db[_0x1a8e('0x70')]['query'](_0x44ebb7));}return BPromise['all'](_0x27d9e0);}})[_0x1a8e('0x2f')](function(){return _0x2f1e49;})[_0x1a8e('0x2f')](respondWithResult(_0x5bf72c,null))[_0x1a8e('0x46')](handleError(_0x5bf72c,null));};exports[_0x1a8e('0xad')]=function(_0xdce3d2,_0x5747c3,_0x2ad4e8){return db[_0x1a8e('0x34')][_0x1a8e('0x2c')]({'where':{'id':_0xdce3d2[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x5747c3,null))['then'](function(_0x2f7f23){if(_0x2f7f23){return _0x2f7f23[_0x1a8e('0xad')](_0xdce3d2[_0x1a8e('0x38')][_0x1a8e('0x7b')]);}})[_0x1a8e('0x2f')](function(_0x44c293){if(_0x44c293){return db[_0x1a8e('0x5c')][_0x1a8e('0x59')]({'where':{'ListId':_0xdce3d2['query'][_0x1a8e('0x7b')],'VoiceQueueId':_0xdce3d2[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](function(){return _0x44c293;});}})[_0x1a8e('0x2f')](respondWithStatusCode(_0x5747c3,null))[_0x1a8e('0x46')](handleError(_0x5747c3,null));};exports[_0x1a8e('0xae')]=function(_0x4342e9,_0xd988d4,_0x45dea8){var _0x20881b={};var _0x5b5639={};var _0x3464cb;var _0x1ff6a1;return db[_0x1a8e('0x34')][_0x1a8e('0x5b')]({'where':{'id':_0x4342e9[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0xd988d4,null))[_0x1a8e('0x2f')](function(_0x7d350c){if(_0x7d350c){_0x3464cb=_0x7d350c;_0x5b5639[_0x1a8e('0x37')]=_['keys'](db[_0x1a8e('0xaf')][_0x1a8e('0x4a')]);_0x5b5639[_0x1a8e('0x38')]=_['keys'](_0x4342e9['query']);_0x5b5639[_0x1a8e('0x40')]=_['intersection'](_0x5b5639[_0x1a8e('0x37')],_0x5b5639['query']);_0x20881b[_0x1a8e('0x3b')]=_[_0x1a8e('0x39')](_0x5b5639['model'],qs[_0x1a8e('0x4b')](_0x4342e9[_0x1a8e('0x38')][_0x1a8e('0x4b')]));_0x20881b['attributes']=_0x20881b[_0x1a8e('0x3b')][_0x1a8e('0x3a')]?_0x20881b[_0x1a8e('0x3b')]:_0x5b5639['model'];_0x20881b[_0x1a8e('0x3e')]=qs[_0x1a8e('0x5d')](_0x4342e9[_0x1a8e('0x38')]['sort']);_0x20881b[_0x1a8e('0x3f')]=qs[_0x1a8e('0x40')](_[_0x1a8e('0x41')](_0x4342e9['query'],_0x5b5639[_0x1a8e('0x40')]));if(_0x4342e9['query'][_0x1a8e('0x27')]){_0x20881b[_0x1a8e('0x3f')]=_['merge'](_0x20881b[_0x1a8e('0x3f')],{'$or':_[_0x1a8e('0x29')](_0x20881b[_0x1a8e('0x3b')],function(_0x13dd90){var _0x4c938d={};_0x4c938d[_0x13dd90]={'$like':'%'+_0x4342e9['query'][_0x1a8e('0x27')]+'%'};return _0x4c938d;})});}_0x20881b=_['merge']({},_0x20881b,_0x4342e9[_0x1a8e('0x43')]);return _0x3464cb['getBlackLists'](_0x20881b);}})[_0x1a8e('0x2f')](function(_0x513364){if(_0x513364){_0x1ff6a1=_0x513364[_0x1a8e('0x3a')];if(!_0x4342e9[_0x1a8e('0x38')][_0x1a8e('0x3c')](_0x1a8e('0x3d'))){_0x20881b[_0x1a8e('0x1d')]=qs[_0x1a8e('0x1d')](_0x4342e9['query'][_0x1a8e('0x1d')]);_0x20881b[_0x1a8e('0x1c')]=qs[_0x1a8e('0x1c')](_0x4342e9[_0x1a8e('0x38')][_0x1a8e('0x1c')]);}return _0x3464cb['getBlackLists'](_0x20881b);}})[_0x1a8e('0x2f')](function(_0x3ce731){if(_0x3ce731){return _0x3ce731?{'count':_0x1ff6a1,'rows':_0x3ce731}:null;}})[_0x1a8e('0x2f')](respondWithResult(_0xd988d4,null))['catch'](handleError(_0xd988d4,null));};exports['addBlackLists']=function(_0x49c748,_0x2ad4b5,_0xb23e9a){var _0x3f4489,_0x4d14f3;return db[_0x1a8e('0x34')]['find']({'where':{'id':_0x49c748[_0x1a8e('0x48')]['id']}})[_0x1a8e('0x2f')](handleEntityNotFound(_0x2ad4b5,null))['then'](function(_0x35816d){if(_0x35816d){_0x4d14f3=_0x35816d;return _0x35816d[_0x1a8e('0xb0')](_0x49c748[_0x1a8e('0x4d')][_0x1a8e('0x7b')],_[_0x1a8e('0x54')](_0x49c748[_0x1a8e('0x4d')],[_0x1a8e('0x7b'),'id'])||{});}return null;})[_0x1a8e('0x90')](function(_0x31a6a1){var _0x222d5b;_0x3f4489=_0x31a6a1||[];var _0x143915=[];if(_0x31a6a1){for(var _0x3545d5=0x0;_0x3545d5<_0x31a6a1[_0x1a8e('0x3a')];_0x3545d5+=0x1){var _0x2eedd8=_0x31a6a1[_0x3545d5]['get']({'plain':!![]});_0x222d5b=squel[_0x1a8e('0x9a')]()[_0x1a8e('0x9b')](_0x1a8e('0xb1'))['fromQuery']([_0x1a8e('0x9d'),_0x1a8e('0xa0'),'ListId',_0x1a8e('0x63'),_0x1a8e('0x55'),_0x1a8e('0x56')],squel[_0x1a8e('0xa6')]()['field'](_0x1a8e('0x9d'),'phone')[_0x1a8e('0x7d')]('id','ContactId')[_0x1a8e('0x7d')](_0x2eedd8[_0x1a8e('0xa1')][_0x1a8e('0x86')](),_0x1a8e('0x9e'))[_0x1a8e('0x7d')](_0x49c748[_0x1a8e('0x48')]['id'][_0x1a8e('0x86')](),_0x1a8e('0x63'))[_0x1a8e('0x7d')]('NOW()',_0x1a8e('0x55'))[_0x1a8e('0x7d')](_0x1a8e('0xa2'),_0x1a8e('0x56'))['from']('cm_contacts')[_0x1a8e('0x3f')]('deletedAt\x20IS\x20NULL')[_0x1a8e('0x3f')](_0x1a8e('0xa5'),_0x2eedd8[_0x1a8e('0xa1')][_0x1a8e('0x86')]())[_0x1a8e('0x3f')](_0x1a8e('0xac')))['toString']();_0x143915[_0x1a8e('0x85')](db[_0x1a8e('0x70')][_0x1a8e('0x38')](_0x222d5b));}return BPromise[_0x1a8e('0x8a')](_0x143915);}})[_0x1a8e('0x2f')](function(){return _0x3f4489;})[_0x1a8e('0x2f')](respondWithResult(_0x2ad4b5,null))[_0x1a8e('0x46')](handleError(_0x2ad4b5,null));};exports[_0x1a8e('0xb2')]=function(_0x238623,_0x48f57e,_0x338545){return db['VoiceQueue'][_0x1a8e('0x2c')]({'where':{'id':_0x238623['params']['id']}})['then'](handleEntityNotFound(_0x48f57e,null))[_0x1a8e('0x2f')](function(_0x582023){if(_0x582023){return _0x582023[_0x1a8e('0xb2')](_0x238623['query'][_0x1a8e('0x7b')]);}})[_0x1a8e('0x2f')](function(_0x38593f){if(_0x38593f){return db['CmHopperBlack'][_0x1a8e('0x59')]({'where':{'ListId':_0x238623[_0x1a8e('0x38')][_0x1a8e('0x7b')],'VoiceQueueId':_0x238623[_0x1a8e('0x48')]['id']}})['then'](function(){return _0x38593f;});}})[_0x1a8e('0x2f')](respondWithStatusCode(_0x48f57e,null))['catch'](handleError(_0x48f57e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index a8567bb..52ec95f 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 _0xfec0=['save','update','emit','hook','exports','events','VoiceQueue','setMaxListeners'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xfec0,0xb5));var _0x0fec=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xfec0[_0x1eda20];return _0x31b953;};'use strict';var EventEmitter=require(_0x0fec('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x0fec('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x0fec('0x2')](0x0);var events={'afterCreate':_0x0fec('0x3'),'afterUpdate':_0x0fec('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4a96ae){return function(_0x56e5d3,_0x17dc2d,_0x298237){VoiceQueueEvents[_0x0fec('0x5')](_0x4a96ae+':'+_0x56e5d3['id'],_0x56e5d3);VoiceQueueEvents[_0x0fec('0x5')](_0x4a96ae,_0x56e5d3);_0x298237(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x0fec('0x6')](e,emitEvent(event));}}module[_0x0fec('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x7189=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x7189,0x18a));var _0x9718=function(_0x21b36c,_0x543483){_0x21b36c=_0x21b36c-0x0;var _0x236627=_0x7189[_0x21b36c];return _0x236627;};'use strict';var EventEmitter=require(_0x9718('0x0'));var VoiceQueue=require(_0x9718('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9718('0x2'),'afterUpdate':_0x9718('0x3'),'afterDestroy':_0x9718('0x4')};function emitEvent(_0x22eda9){return function(_0x3d84b9,_0x202f0c,_0x118aaa){VoiceQueueEvents[_0x9718('0x5')](_0x22eda9+':'+_0x3d84b9['id'],_0x3d84b9);VoiceQueueEvents[_0x9718('0x5')](_0x22eda9,_0x3d84b9);_0x118aaa(null);};}for(var e in events){if(events[_0x9718('0x6')](e)){var event=events[e];VoiceQueue[_0x9718('0x7')](e,emitEvent(event));}}module[_0x9718('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index e68f5fb..53c42c0 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x55ca,0x126));var _0xa55c=function(_0x291c1b,_0x5216a6){_0x291c1b=_0x291c1b-0x0;var _0x2109c9=_0x55ca[_0x291c1b];return _0x2109c9;};'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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0xa81808,_0x5c00e0){var _0x35ad5c=function(_0x2ffba2){while(--_0x2ffba2){_0xa81808['push'](_0xa81808['shift']());}};_0x35ad5c(++_0x5c00e0);}(_0xedd9,0xfc));var _0x9edd=function(_0x56058e,_0x2b8057){_0x56058e=_0x56058e-0x0;var _0x316ec3=_0xedd9[_0x56058e];return _0x316ec3;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 8ffd7d4..c98b0ed 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 _0xfd73=['error','code','message','info','result','catch','GetVoiceQueue','findAll','options','where','attributes','limit','include','map','model','VoiceQueue','find','ShowVoiceQueue','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0xec19f4,_0x24359d){var _0x5d3167=function(_0x5bb39c){while(--_0x5bb39c){_0xec19f4['push'](_0xec19f4['shift']());}};_0x5d3167(++_0x24359d);}(_0xfd73,0x1b7));var _0x3fd7=function(_0x55dc0a,_0x544949){_0x55dc0a=_0x55dc0a-0x0;var _0x342e8f=_0xfd73[_0x55dc0a];return _0x342e8f;};'use strict';var _=require(_0x3fd7('0x0'));var util=require(_0x3fd7('0x1'));var moment=require(_0x3fd7('0x2'));var BPromise=require(_0x3fd7('0x3'));var rs=require(_0x3fd7('0x4'));var fs=require('fs');var Redis=require(_0x3fd7('0x5'));var db=require(_0x3fd7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3fd7('0x7'))(_0x3fd7('0x8'));var config=require('../../config/environment');var jayson=require(_0x3fd7('0x9'));var client=jayson[_0x3fd7('0xa')][_0x3fd7('0xb')]({'port':0x232a});config['redis']=_[_0x3fd7('0xc')](config['redis'],{'host':_0x3fd7('0xd'),'port':0x18eb});var socket=require(_0x3fd7('0xe'))(new Redis(config['redis']));require(_0x3fd7('0xf'))[_0x3fd7('0x10')](socket);function respondWithRpcPromise(_0x133cfc,_0x3aaadb,_0x2cf576){return new BPromise(function(_0x18cd39,_0x86b925){return client[_0x3fd7('0x11')](_0x133cfc,_0x2cf576)[_0x3fd7('0x12')](function(_0x492e30){logger['info'](_0x3fd7('0x13'),_0x3aaadb,_0x3fd7('0x14'));logger[_0x3fd7('0x15')](_0x3fd7('0x16'),_0x3aaadb,'request\x20sent',JSON['stringify'](_0x492e30));if(_0x492e30['error']){if(_0x492e30[_0x3fd7('0x17')][_0x3fd7('0x18')]===0x1f4){logger[_0x3fd7('0x17')](_0x3fd7('0x13'),_0x3aaadb,_0x492e30['error'][_0x3fd7('0x19')]);return _0x86b925(_0x492e30['error'][_0x3fd7('0x19')]);}logger[_0x3fd7('0x17')](_0x3fd7('0x13'),_0x3aaadb,_0x492e30['error']['message']);return _0x18cd39(_0x492e30['error']['message']);}else{logger[_0x3fd7('0x1a')](_0x3fd7('0x13'),_0x3aaadb,_0x3fd7('0x14'));_0x18cd39(_0x492e30[_0x3fd7('0x1b')][_0x3fd7('0x19')]);}})[_0x3fd7('0x1c')](function(_0x2bcbeb){logger[_0x3fd7('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x3aaadb,_0x2bcbeb);_0x86b925(_0x2bcbeb);});});}exports[_0x3fd7('0x1d')]=function(_0x3fdeaa){var _0x467c90=this;return new Promise(function(_0x12ce9c,_0x533279){return db['VoiceQueue'][_0x3fd7('0x1e')]({'raw':_0x3fdeaa[_0x3fd7('0x1f')]?_0x3fdeaa[_0x3fd7('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3fdeaa[_0x3fd7('0x1f')]?_0x3fdeaa[_0x3fd7('0x1f')][_0x3fd7('0x20')]||null:null,'attributes':_0x3fdeaa[_0x3fd7('0x1f')]?_0x3fdeaa[_0x3fd7('0x1f')][_0x3fd7('0x21')]||null:null,'limit':_0x3fdeaa[_0x3fd7('0x1f')]?_0x3fdeaa[_0x3fd7('0x1f')][_0x3fd7('0x22')]||null:null,'include':_0x3fdeaa['options']?_0x3fdeaa[_0x3fd7('0x1f')][_0x3fd7('0x23')]?_[_0x3fd7('0x24')](_0x3fdeaa[_0x3fd7('0x1f')][_0x3fd7('0x23')],function(_0x655a89){return{'model':db[_0x655a89[_0x3fd7('0x25')]],'as':_0x655a89['as'],'attributes':_0x655a89[_0x3fd7('0x21')],'include':_0x655a89[_0x3fd7('0x23')]?_[_0x3fd7('0x24')](_0x655a89[_0x3fd7('0x23')],function(_0x4b67e8){return{'model':db[_0x4b67e8[_0x3fd7('0x25')]],'as':_0x4b67e8['as'],'attributes':_0x4b67e8['attributes'],'include':_0x4b67e8['include']?_[_0x3fd7('0x24')](_0x4b67e8[_0x3fd7('0x23')],function(_0x2e1d4b){return{'model':db[_0x2e1d4b[_0x3fd7('0x25')]],'as':_0x2e1d4b['as'],'attributes':_0x2e1d4b['attributes']};}):[]};}):[]};}):[]:[]})[_0x3fd7('0x12')](function(_0x505192){logger[_0x3fd7('0x1a')]('GetVoiceQueue',_0x3fdeaa);logger[_0x3fd7('0x15')]('GetVoiceQueue',_0x3fdeaa,JSON['stringify'](_0x505192));_0x12ce9c(_0x505192);})[_0x3fd7('0x1c')](function(_0x514de1){logger[_0x3fd7('0x17')]('GetVoiceQueue',_0x514de1[_0x3fd7('0x19')],_0x3fdeaa);_0x533279(_0x467c90[_0x3fd7('0x17')](0x1f4,_0x514de1[_0x3fd7('0x19')]));});});};exports['ShowVoiceQueue']=function(_0x17fc8c){var _0x19a28a=this;return new Promise(function(_0x5cc2e6,_0x184953){return db[_0x3fd7('0x26')][_0x3fd7('0x27')]({'raw':_0x17fc8c[_0x3fd7('0x1f')]?_0x17fc8c[_0x3fd7('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x17fc8c[_0x3fd7('0x1f')]?_0x17fc8c[_0x3fd7('0x1f')]['where']||null:null,'attributes':_0x17fc8c[_0x3fd7('0x1f')]?_0x17fc8c[_0x3fd7('0x1f')][_0x3fd7('0x21')]||null:null,'include':_0x17fc8c['options']?_0x17fc8c[_0x3fd7('0x1f')][_0x3fd7('0x23')]?_[_0x3fd7('0x24')](_0x17fc8c['options'][_0x3fd7('0x23')],function(_0x55d594){return{'model':db[_0x55d594[_0x3fd7('0x25')]],'as':_0x55d594['as'],'attributes':_0x55d594[_0x3fd7('0x21')],'include':_0x55d594[_0x3fd7('0x23')]?_[_0x3fd7('0x24')](_0x55d594[_0x3fd7('0x23')],function(_0x278e3b){return{'model':db[_0x278e3b['model']],'as':_0x278e3b['as'],'attributes':_0x278e3b[_0x3fd7('0x21')],'include':_0x278e3b[_0x3fd7('0x23')]?_[_0x3fd7('0x24')](_0x278e3b['include'],function(_0x2c4a76){return{'model':db[_0x2c4a76[_0x3fd7('0x25')]],'as':_0x2c4a76['as'],'attributes':_0x2c4a76[_0x3fd7('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3fd7('0x12')](function(_0x40f7a9){logger[_0x3fd7('0x1a')](_0x3fd7('0x28'),_0x17fc8c);logger['debug']('ShowVoiceQueue',_0x17fc8c,JSON[_0x3fd7('0x29')](_0x40f7a9));_0x5cc2e6(_0x40f7a9);})[_0x3fd7('0x1c')](function(_0x2cb2d8){logger['error']('ShowVoiceQueue',_0x2cb2d8[_0x3fd7('0x19')],_0x17fc8c);_0x184953(_0x19a28a[_0x3fd7('0x17')](0x1f4,_0x2cb2d8[_0x3fd7('0x19')]));});});}; \ No newline at end of file +var _0xbe95=['request','then','info','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','attributes','limit','model','map','include','GetVoiceQueue','debug','ShowVoiceQueue','VoiceQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voiceQueue.socket','register'];(function(_0x2750a9,_0x2e8e75){var _0x5c437e=function(_0x6ca359){while(--_0x6ca359){_0x2750a9['push'](_0x2750a9['shift']());}};_0x5c437e(++_0x2e8e75);}(_0xbe95,0x103));var _0x5be9=function(_0x1f53fa,_0x538864){_0x1f53fa=_0x1f53fa-0x0;var _0x55e254=_0xbe95[_0x1f53fa];return _0x55e254;};'use strict';var _=require(_0x5be9('0x0'));var util=require(_0x5be9('0x1'));var moment=require('moment');var BPromise=require(_0x5be9('0x2'));var rs=require(_0x5be9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5be9('0x4'))['db'];var utils=require(_0x5be9('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5be9('0x6'));var jayson=require(_0x5be9('0x7'));var client=jayson[_0x5be9('0x8')]['http']({'port':0x232a});config[_0x5be9('0x9')]=_[_0x5be9('0xa')](config['redis'],{'host':_0x5be9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5be9('0x9')]));require(_0x5be9('0xc'))[_0x5be9('0xd')](socket);function respondWithRpcPromise(_0x4e6af7,_0xa3ef06,_0x25ca07){return new BPromise(function(_0x5779d0,_0x431e85){return client[_0x5be9('0xe')](_0x4e6af7,_0x25ca07)[_0x5be9('0xf')](function(_0x4ef52f){logger[_0x5be9('0x10')]('VoiceQueue,\x20%s,\x20%s',_0xa3ef06,_0x5be9('0x11'));logger['debug'](_0x5be9('0x12'),_0xa3ef06,_0x5be9('0x11'),JSON['stringify'](_0x4ef52f));if(_0x4ef52f[_0x5be9('0x13')]){if(_0x4ef52f['error'][_0x5be9('0x14')]===0x1f4){logger[_0x5be9('0x13')](_0x5be9('0x15'),_0xa3ef06,_0x4ef52f[_0x5be9('0x13')][_0x5be9('0x16')]);return _0x431e85(_0x4ef52f[_0x5be9('0x13')][_0x5be9('0x16')]);}logger[_0x5be9('0x13')](_0x5be9('0x15'),_0xa3ef06,_0x4ef52f[_0x5be9('0x13')][_0x5be9('0x16')]);return _0x5779d0(_0x4ef52f[_0x5be9('0x13')][_0x5be9('0x16')]);}else{logger[_0x5be9('0x10')](_0x5be9('0x15'),_0xa3ef06,_0x5be9('0x11'));_0x5779d0(_0x4ef52f[_0x5be9('0x17')]['message']);}})[_0x5be9('0x18')](function(_0x4d7128){logger[_0x5be9('0x13')](_0x5be9('0x15'),_0xa3ef06,_0x4d7128);_0x431e85(_0x4d7128);});});}exports['GetVoiceQueue']=function(_0x1526fd){var _0x1641dc=this;return new Promise(function(_0x2443bf,_0xf1b876){return db['VoiceQueue'][_0x5be9('0x19')]({'raw':_0x1526fd[_0x5be9('0x1a')]?_0x1526fd[_0x5be9('0x1a')][_0x5be9('0x1b')]===undefined?!![]:![]:!![],'where':_0x1526fd[_0x5be9('0x1a')]?_0x1526fd[_0x5be9('0x1a')][_0x5be9('0x1c')]||null:null,'attributes':_0x1526fd[_0x5be9('0x1a')]?_0x1526fd[_0x5be9('0x1a')][_0x5be9('0x1d')]||null:null,'limit':_0x1526fd[_0x5be9('0x1a')]?_0x1526fd[_0x5be9('0x1a')][_0x5be9('0x1e')]||null:null,'include':_0x1526fd[_0x5be9('0x1a')]?_0x1526fd[_0x5be9('0x1a')]['include']?_['map'](_0x1526fd[_0x5be9('0x1a')]['include'],function(_0x3c21d3){return{'model':db[_0x3c21d3[_0x5be9('0x1f')]],'as':_0x3c21d3['as'],'attributes':_0x3c21d3['attributes'],'include':_0x3c21d3['include']?_[_0x5be9('0x20')](_0x3c21d3[_0x5be9('0x21')],function(_0x5999ba){return{'model':db[_0x5999ba[_0x5be9('0x1f')]],'as':_0x5999ba['as'],'attributes':_0x5999ba[_0x5be9('0x1d')],'include':_0x5999ba[_0x5be9('0x21')]?_[_0x5be9('0x20')](_0x5999ba[_0x5be9('0x21')],function(_0x4b3cb7){return{'model':db[_0x4b3cb7[_0x5be9('0x1f')]],'as':_0x4b3cb7['as'],'attributes':_0x4b3cb7[_0x5be9('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2148a6){logger[_0x5be9('0x10')](_0x5be9('0x22'),_0x1526fd);logger[_0x5be9('0x23')](_0x5be9('0x22'),_0x1526fd,JSON['stringify'](_0x2148a6));_0x2443bf(_0x2148a6);})[_0x5be9('0x18')](function(_0x535550){logger[_0x5be9('0x13')](_0x5be9('0x22'),_0x535550[_0x5be9('0x16')],_0x1526fd);_0xf1b876(_0x1641dc[_0x5be9('0x13')](0x1f4,_0x535550[_0x5be9('0x16')]));});});};exports[_0x5be9('0x24')]=function(_0xad5712){var _0x212aec=this;return new Promise(function(_0x1c4a8a,_0x50d381){return db[_0x5be9('0x25')][_0x5be9('0x26')]({'raw':_0xad5712[_0x5be9('0x1a')]?_0xad5712['options'][_0x5be9('0x1b')]===undefined?!![]:![]:!![],'where':_0xad5712[_0x5be9('0x1a')]?_0xad5712[_0x5be9('0x1a')][_0x5be9('0x1c')]||null:null,'attributes':_0xad5712[_0x5be9('0x1a')]?_0xad5712[_0x5be9('0x1a')][_0x5be9('0x1d')]||null:null,'include':_0xad5712[_0x5be9('0x1a')]?_0xad5712[_0x5be9('0x1a')][_0x5be9('0x21')]?_[_0x5be9('0x20')](_0xad5712['options'][_0x5be9('0x21')],function(_0x14c8be){return{'model':db[_0x14c8be[_0x5be9('0x1f')]],'as':_0x14c8be['as'],'attributes':_0x14c8be[_0x5be9('0x1d')],'include':_0x14c8be[_0x5be9('0x21')]?_[_0x5be9('0x20')](_0x14c8be['include'],function(_0x4553ac){return{'model':db[_0x4553ac[_0x5be9('0x1f')]],'as':_0x4553ac['as'],'attributes':_0x4553ac[_0x5be9('0x1d')],'include':_0x4553ac[_0x5be9('0x21')]?_[_0x5be9('0x20')](_0x4553ac[_0x5be9('0x21')],function(_0x27cc53){return{'model':db[_0x27cc53[_0x5be9('0x1f')]],'as':_0x27cc53['as'],'attributes':_0x27cc53['attributes']};}):[]};}):[]};}):[]:[]})[_0x5be9('0xf')](function(_0x49421d){logger[_0x5be9('0x10')]('ShowVoiceQueue',_0xad5712);logger[_0x5be9('0x23')]('ShowVoiceQueue',_0xad5712,JSON['stringify'](_0x49421d));_0x1c4a8a(_0x49421d);})[_0x5be9('0x18')](function(_0x196c88){logger[_0x5be9('0x13')]('ShowVoiceQueue',_0x196c88[_0x5be9('0x16')],_0xad5712);_0x50d381(_0x212aec['error'](0x1f4,_0x196c88['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 601ed57..01bd295 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 _0x6e72=['save','remove','update','removeListener','register','length','./voiceQueue.events'];(function(_0x1c61ee,_0x3307f2){var _0x404805=function(_0x522fd0){while(--_0x522fd0){_0x1c61ee['push'](_0x1c61ee['shift']());}};_0x404805(++_0x3307f2);}(_0x6e72,0xd8));var _0x26e7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e72[_0x14add3];return _0x4a174f;};'use strict';var VoiceQueueEvents=require(_0x26e7('0x0'));var events=[_0x26e7('0x1'),_0x26e7('0x2'),_0x26e7('0x3')];function createListener(_0x5dcff6,_0x40fdd2){return function(_0x15e253){_0x40fdd2['emit'](_0x5dcff6,_0x15e253);};}function removeListener(_0x2e6fc3,_0xd5a6ba){return function(){VoiceQueueEvents[_0x26e7('0x4')](_0x2e6fc3,_0xd5a6ba);};}exports[_0x26e7('0x5')]=function(_0xdf81b4){for(var _0x4c4ccc=0x0,_0x164370=events[_0x26e7('0x6')];_0x4c4ccc<_0x164370;_0x4c4ccc++){var _0x2edfd5=events[_0x4c4ccc];var _0x8f3925=createListener('voiceQueue:'+_0x2edfd5,_0xdf81b4);VoiceQueueEvents['on'](_0x2edfd5,_0x8f3925);}}; \ No newline at end of file +var _0xcedf=['update','emit','register','length','voiceQueue:','save','remove'];(function(_0x3cc2d3,_0x52ea15){var _0x4f3a36=function(_0x4f6003){while(--_0x4f6003){_0x3cc2d3['push'](_0x3cc2d3['shift']());}};_0x4f3a36(++_0x52ea15);}(_0xcedf,0x12b));var _0xfced=function(_0x5440d0,_0x2627df){_0x5440d0=_0x5440d0-0x0;var _0x3364e4=_0xcedf[_0x5440d0];return _0x3364e4;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xfced('0x0'),_0xfced('0x1'),_0xfced('0x2')];function createListener(_0x3aa598,_0x3bf66b){return function(_0x3f39c3){_0x3bf66b[_0xfced('0x3')](_0x3aa598,_0x3f39c3);};}function removeListener(_0x242f79,_0x3996c0){return function(){VoiceQueueEvents['removeListener'](_0x242f79,_0x3996c0);};}exports[_0xfced('0x4')]=function(_0x44c39d){for(var _0x914e15=0x0,_0x75f33d=events[_0xfced('0x5')];_0x914e15<_0x75f33d;_0x914e15++){var _0x57506c=events[_0x914e15];var _0x32755d=createListener(_0xfced('0x6')+_0x57506c,_0x44c39d);VoiceQueueEvents['on'](_0x57506c,_0x32755d);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 6ebc9be..85a2946 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 _0x72cd=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','multer','path','connect-timeout'];(function(_0x279095,_0x15f37e){var _0x5a5cdb=function(_0x2909bd){while(--_0x2909bd){_0x279095['push'](_0x279095['shift']());}};_0x5a5cdb(++_0x15f37e);}(_0x72cd,0x140));var _0xd72c=function(_0x4e3486,_0x511d5d){_0x4e3486=_0x4e3486-0x0;var _0xd7c182=_0x72cd[_0x4e3486];return _0xd7c182;};'use strict';var multer=require(_0xd72c('0x0'));var util=require('util');var path=require(_0xd72c('0x1'));var timeout=require(_0xd72c('0x2'));var express=require(_0xd72c('0x3'));var router=express[_0xd72c('0x4')]();var fs_extra=require(_0xd72c('0x5'));var auth=require(_0xd72c('0x6'));var interaction=require(_0xd72c('0x7'));var config=require(_0xd72c('0x8'));var controller=require('./voiceQueueReport.controller');router[_0xd72c('0x9')]('/',auth[_0xd72c('0xa')](),controller['index']);router[_0xd72c('0x9')]('/describe',auth[_0xd72c('0xa')](),controller[_0xd72c('0xb')]);router['get'](_0xd72c('0xc'),auth['isAuthenticated'](),controller[_0xd72c('0xd')]);router[_0xd72c('0x9')](_0xd72c('0xe'),auth[_0xd72c('0xa')](),controller[_0xd72c('0xf')]);router[_0xd72c('0x10')]('/',auth[_0xd72c('0xa')](),controller[_0xd72c('0x11')]);router[_0xd72c('0x12')](_0xd72c('0xe'),auth[_0xd72c('0xa')](),controller['update']);router['delete'](_0xd72c('0xe'),auth[_0xd72c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf0ef=['isAuthenticated','/index','getVoiceQueuesReport','/:id','show','create','put','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get'];(function(_0x219d87,_0x1cb6f7){var _0x22823d=function(_0x5357bf){while(--_0x5357bf){_0x219d87['push'](_0x219d87['shift']());}};_0x22823d(++_0x1cb6f7);}(_0xf0ef,0x1a9));var _0xff0e=function(_0x18b191,_0x4e0684){_0x18b191=_0x18b191-0x0;var _0x43e146=_0xf0ef[_0x18b191];return _0x43e146;};'use strict';var multer=require('multer');var util=require(_0xff0e('0x0'));var path=require('path');var timeout=require(_0xff0e('0x1'));var express=require('express');var router=express[_0xff0e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xff0e('0x3'));var interaction=require(_0xff0e('0x4'));var config=require('../../config/environment');var controller=require(_0xff0e('0x5'));router[_0xff0e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xff0e('0x6')]('/describe',auth[_0xff0e('0x7')](),controller['describe']);router[_0xff0e('0x6')](_0xff0e('0x8'),auth[_0xff0e('0x7')](),controller[_0xff0e('0x9')]);router['get'](_0xff0e('0xa'),auth['isAuthenticated'](),controller[_0xff0e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xff0e('0xc')]);router[_0xff0e('0xd')](_0xff0e('0xa'),auth[_0xff0e('0x7')](),controller['update']);router['delete']('/:id',auth[_0xff0e('0x7')](),controller[_0xff0e('0xe')]);module[_0xff0e('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 6d94c24..efb53fa 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 _0xf1aa=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER'];(function(_0x1a86aa,_0x2ff522){var _0xf30b3f=function(_0x6f8ab3){while(--_0x6f8ab3){_0x1a86aa['push'](_0x1a86aa['shift']());}};_0xf30b3f(++_0x2ff522);}(_0xf1aa,0x1df));var _0xaf1a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf1aa[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xaf1a('0x0'));var moment=require(_0xaf1a('0x1'));module[_0xaf1a('0x2')]={'type':{'type':Sequelize[_0xaf1a('0x3')]},'uniqueid':{'type':Sequelize[_0xaf1a('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xaf1a('0x3')]},'queue':{'type':Sequelize[_0xaf1a('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xaf1a('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xaf1a('0x4')],'set':function(_0x42e87a){var _0x45adb1=moment(_0x42e87a);var _0x5c612a=moment(this[_0xaf1a('0x5')](_0xaf1a('0x6')))['format'](_0xaf1a('0x7'));var _0x50dd9a=_0x45adb1[_0xaf1a('0x8')](_0x5c612a,_0xaf1a('0x9'));this[_0xaf1a('0xa')](_0xaf1a('0xb'),_0x42e87a);this[_0xaf1a('0xa')](_0xaf1a('0xc'),_0x50dd9a||null);}},'position':{'type':Sequelize[_0xaf1a('0xd')]},'count':{'type':Sequelize[_0xaf1a('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xaf1a('0x4')]},'queuecallerexit':{'type':Sequelize[_0xaf1a('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xaf1a('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xaf1a('0x3')],'comment':_0xaf1a('0xf')},'originalposition':{'type':Sequelize[_0xaf1a('0xd')]},'channel':{'type':Sequelize[_0xaf1a('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xaf1a('0x3')]},'accountcode':{'type':Sequelize[_0xaf1a('0x3')]},'context':{'type':Sequelize[_0xaf1a('0x3')]},'exten':{'type':Sequelize[_0xaf1a('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xaf1a('0xd')]},'mohtime':{'type':Sequelize[_0xaf1a('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xaf1a('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xaf1a('0x3')],'comment':_0xaf1a('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xaf1a('0x3')]},'disposition':{'type':Sequelize[_0xaf1a('0x3')]},'secondDisposition':{'type':Sequelize[_0xaf1a('0x3')]},'thirdDisposition':{'type':Sequelize[_0xaf1a('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xaf1a('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa282=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','moment'];(function(_0x2363b1,_0x442198){var _0x1dc992=function(_0x387e87){while(--_0x387e87){_0x2363b1['push'](_0x2363b1['shift']());}};_0x1dc992(++_0x442198);}(_0xa282,0x8f));var _0x2a28=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa282[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2a28('0x0'));module[_0x2a28('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2a28('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2a28('0x2')]},'queue':{'type':Sequelize[_0x2a28('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x2a28('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x2a28('0x3')],'set':function(_0x4abf39){var _0x44bc0d=moment(_0x4abf39);var _0x4ee0aa=moment(this[_0x2a28('0x4')](_0x2a28('0x5')))[_0x2a28('0x6')](_0x2a28('0x7'));var _0x5ed41f=_0x44bc0d[_0x2a28('0x8')](_0x4ee0aa,_0x2a28('0x9'));this[_0x2a28('0xa')](_0x2a28('0xb'),_0x4abf39);this['setDataValue'](_0x2a28('0xc'),_0x5ed41f||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x2a28('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x2a28('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2a28('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x2a28('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2a28('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x2a28('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x2a28('0xd')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x2a28('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2a28('0x2')]},'context':{'type':Sequelize[_0x2a28('0x2')]},'exten':{'type':Sequelize[_0x2a28('0x2')]},'priority':{'type':Sequelize[_0x2a28('0x2')]},'holdtime':{'type':Sequelize[_0x2a28('0xd')]},'mohtime':{'type':Sequelize[_0x2a28('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x2a28('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2a28('0x2')],'comment':_0x2a28('0xf')},'transferexten':{'type':Sequelize[_0x2a28('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x2a28('0x2')]},'secondDisposition':{'type':Sequelize[_0x2a28('0x2')]},'thirdDisposition':{'type':Sequelize[_0x2a28('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x2a28('0xd')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 42e37d4..1dcb90d 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 _0x99bc=['localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','fields','find','catch','create','body','params','destroy','describe','getVoiceQueuesReport','nolimit','order','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','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','redis','defaults'];(function(_0x324f47,_0x2ea871){var _0x2bb2bc=function(_0x5929cc){while(--_0x5929cc){_0x324f47['push'](_0x324f47['shift']());}};_0x2bb2bc(++_0x2ea871);}(_0x99bc,0x197));var _0xc99b=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x99bc[_0x5ddaac];return _0x2a9c58;};'use strict';var emlformat=require(_0xc99b('0x0'));var rimraf=require(_0xc99b('0x1'));var zipdir=require(_0xc99b('0x2'));var jsonpatch=require(_0xc99b('0x3'));var rp=require(_0xc99b('0x4'));var moment=require(_0xc99b('0x5'));var BPromise=require(_0xc99b('0x6'));var Mustache=require('mustache');var util=require(_0xc99b('0x7'));var path=require(_0xc99b('0x8'));var sox=require(_0xc99b('0x9'));var csv=require(_0xc99b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc99b('0xb'));var squel=require('squel');var crypto=require(_0xc99b('0xc'));var jsforce=require(_0xc99b('0xd'));var deskjs=require(_0xc99b('0xe'));var toCsv=require(_0xc99b('0xa'));var querystring=require(_0xc99b('0xf'));var Papa=require(_0xc99b('0x10'));var Redis=require(_0xc99b('0x11'));var authService=require(_0xc99b('0x12'));var qs=require(_0xc99b('0x13'));var as=require(_0xc99b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc99b('0x15'))(_0xc99b('0x16'));var utils=require(_0xc99b('0x17'));var config=require(_0xc99b('0x18'));var licenseUtil=require(_0xc99b('0x19'));var db=require('../../mysqldb')['db'];config[_0xc99b('0x1a')]=_[_0xc99b('0x1b')](config[_0xc99b('0x1a')],{'host':_0xc99b('0x1c'),'port':0x18eb});var socket=require(_0xc99b('0x1d'))(new Redis(config[_0xc99b('0x1a')]));require(_0xc99b('0x1e'))[_0xc99b('0x1f')](socket);function respondWithStatusCode(_0x3cdbda,_0x42be38){_0x42be38=_0x42be38||0xcc;return function(_0x2d1215){if(_0x2d1215){return _0x3cdbda['sendStatus'](_0x42be38);}return _0x3cdbda[_0xc99b('0x20')](_0x42be38)[_0xc99b('0x21')]();};}function respondWithResult(_0x17c014,_0x333cc5){_0x333cc5=_0x333cc5||0xc8;return function(_0x2a2782){if(_0x2a2782){return _0x17c014[_0xc99b('0x20')](_0x333cc5)[_0xc99b('0x22')](_0x2a2782);}};}function respondWithFilteredResult(_0x17b1da,_0x45bfcc){return function(_0x180e62){if(_0x180e62){var _0x390918=typeof _0x45bfcc[_0xc99b('0x23')]===_0xc99b('0x24')&&typeof _0x45bfcc[_0xc99b('0x25')]===_0xc99b('0x24');var _0x2588fc=_0x180e62['count'];var _0xb74306=_0x390918?0x0:_0x45bfcc[_0xc99b('0x23')];var _0x1349fc=_0x390918?_0x180e62[_0xc99b('0x26')]:_0x45bfcc[_0xc99b('0x23')]+_0x45bfcc[_0xc99b('0x25')];var _0x129da3;if(_0x1349fc>=_0x2588fc){_0x1349fc=_0x2588fc;_0x129da3=0xc8;}else{_0x129da3=0xce;}_0x17b1da[_0xc99b('0x20')](_0x129da3);return _0x17b1da['set'](_0xc99b('0x27'),_0xb74306+'-'+_0x1349fc+'/'+_0x2588fc)[_0xc99b('0x22')](_0x180e62);}return null;};}function patchUpdates(_0x284334){return function(_0x499a06){try{jsonpatch[_0xc99b('0x28')](_0x499a06,_0x284334,!![]);}catch(_0x45b88f){return BPromise[_0xc99b('0x29')](_0x45b88f);}return _0x499a06[_0xc99b('0x2a')]();};}function saveUpdates(_0x31fa54,_0x5d852f){return function(_0x303c8d){if(_0x303c8d){return _0x303c8d[_0xc99b('0x2b')](_0x31fa54)[_0xc99b('0x2c')](function(_0x185c39){return _0x185c39;});}return null;};}function removeEntity(_0x5305a2,_0x49b970){return function(_0x54947a){if(_0x54947a){return _0x54947a['destroy']()[_0xc99b('0x2c')](function(){_0x5305a2[_0xc99b('0x20')](0xcc)[_0xc99b('0x21')]();});}};}function handleEntityNotFound(_0x18e31f,_0xe7b134){return function(_0x144d38){if(!_0x144d38){_0x18e31f[_0xc99b('0x2d')](0x194);}return _0x144d38;};}function handleError(_0x57f154,_0x3120d3){_0x3120d3=_0x3120d3||0x1f4;return function(_0x73603f){logger[_0xc99b('0x2e')](_0x73603f[_0xc99b('0x2f')]);if(_0x73603f[_0xc99b('0x30')]){delete _0x73603f['name'];}_0x57f154['status'](_0x3120d3)[_0xc99b('0x31')](_0x73603f);};}exports[_0xc99b('0x32')]=function(_0x3d9b45,_0x376de8){var _0x310295={},_0x3c7968={},_0x5c0971={'count':0x0,'rows':[]};var _0x3bb3ba=_[_0xc99b('0x33')](db[_0xc99b('0x34')][_0xc99b('0x35')],function(_0x1abb5c){return{'name':_0x1abb5c[_0xc99b('0x36')],'type':_0x1abb5c[_0xc99b('0x37')][_0xc99b('0x38')]};});_0x3c7968[_0xc99b('0x39')]=_['map'](_0x3bb3ba,_0xc99b('0x30'));_0x3c7968[_0xc99b('0x3a')]=_[_0xc99b('0x3b')](_0x3d9b45[_0xc99b('0x3a')]);_0x3c7968[_0xc99b('0x3c')]=_[_0xc99b('0x3d')](_0x3c7968[_0xc99b('0x39')],_0x3c7968[_0xc99b('0x3a')]);_0x310295[_0xc99b('0x3e')]=_[_0xc99b('0x3d')](_0x3c7968[_0xc99b('0x39')],qs['fields'](_0x3d9b45[_0xc99b('0x3a')]['fields']));_0x310295[_0xc99b('0x3e')]=_0x310295['attributes'][_0xc99b('0x3f')]?_0x310295['attributes']:_0x3c7968[_0xc99b('0x39')];if(!_0x3d9b45[_0xc99b('0x3a')][_0xc99b('0x40')]('nolimit')){_0x310295[_0xc99b('0x25')]=qs['limit'](_0x3d9b45['query'][_0xc99b('0x25')]);_0x310295['offset']=qs['offset'](_0x3d9b45['query'][_0xc99b('0x23')]);}_0x310295['order']=qs[_0xc99b('0x41')](_0x3d9b45['query'][_0xc99b('0x41')]);_0x310295['where']=qs[_0xc99b('0x3c')](_['pick'](_0x3d9b45[_0xc99b('0x3a')],_0x3c7968[_0xc99b('0x3c')]),_0x3bb3ba);if(_0x3d9b45[_0xc99b('0x3a')][_0xc99b('0x42')]){_0x310295[_0xc99b('0x43')]=_['merge'](_0x310295[_0xc99b('0x43')],{'$or':_['map'](_0x3bb3ba,function(_0x3e0f89){if(_0x3e0f89[_0xc99b('0x37')]!==_0xc99b('0x44')){var _0x408876={};_0x408876[_0x3e0f89['name']]={'$like':'%'+_0x3d9b45[_0xc99b('0x3a')][_0xc99b('0x42')]+'%'};return _0x408876;}})});}_0x310295=_[_0xc99b('0x45')]({},_0x310295,_0x3d9b45[_0xc99b('0x46')]);var _0x4c564b={'where':_0x310295[_0xc99b('0x43')]};return db[_0xc99b('0x34')][_0xc99b('0x26')](_0x4c564b)[_0xc99b('0x2c')](function(_0x517eb4){_0x5c0971['count']=_0x517eb4;if(_0x3d9b45[_0xc99b('0x3a')][_0xc99b('0x47')]){_0x310295[_0xc99b('0x48')]=[{'all':!![]}];}return db[_0xc99b('0x34')][_0xc99b('0x49')](_0x310295);})[_0xc99b('0x2c')](function(_0x5b159a){_0x5c0971[_0xc99b('0x4a')]=_0x5b159a;return _0x5c0971;})[_0xc99b('0x2c')](respondWithFilteredResult(_0x376de8,_0x310295))['catch'](handleError(_0x376de8,null));};exports['show']=function(_0x220382,_0x461784){var _0x4d0fdf={'raw':![],'where':{'id':_0x220382['params']['id']}},_0x5cfa6d={};_0x5cfa6d[_0xc99b('0x39')]=_[_0xc99b('0x3b')](db[_0xc99b('0x34')][_0xc99b('0x35')]);_0x5cfa6d[_0xc99b('0x3a')]=_['keys'](_0x220382[_0xc99b('0x3a')]);_0x5cfa6d[_0xc99b('0x3c')]=_[_0xc99b('0x3d')](_0x5cfa6d['model'],_0x5cfa6d[_0xc99b('0x3a')]);_0x4d0fdf['attributes']=_[_0xc99b('0x3d')](_0x5cfa6d[_0xc99b('0x39')],qs[_0xc99b('0x4b')](_0x220382[_0xc99b('0x3a')][_0xc99b('0x4b')]));_0x4d0fdf[_0xc99b('0x3e')]=_0x4d0fdf[_0xc99b('0x3e')][_0xc99b('0x3f')]?_0x4d0fdf[_0xc99b('0x3e')]:_0x5cfa6d[_0xc99b('0x39')];if(_0x220382['query'][_0xc99b('0x47')]){_0x4d0fdf[_0xc99b('0x48')]=[{'all':!![]}];}_0x4d0fdf=_['merge']({},_0x4d0fdf,_0x220382['options']);return db[_0xc99b('0x34')][_0xc99b('0x4c')](_0x4d0fdf)['then'](handleEntityNotFound(_0x461784,null))[_0xc99b('0x2c')](respondWithResult(_0x461784,null))[_0xc99b('0x4d')](handleError(_0x461784,null));};exports[_0xc99b('0x4e')]=function(_0x103288,_0x3ef571){return db['VoiceQueueReport']['create'](_0x103288[_0xc99b('0x4f')],{})[_0xc99b('0x2c')](respondWithResult(_0x3ef571,0xc9))['catch'](handleError(_0x3ef571,null));};exports[_0xc99b('0x2b')]=function(_0x28d62a,_0x481a6d){if(_0x28d62a[_0xc99b('0x4f')]['id']){delete _0x28d62a[_0xc99b('0x4f')]['id'];}return db['VoiceQueueReport'][_0xc99b('0x4c')]({'where':{'id':_0x28d62a[_0xc99b('0x50')]['id']}})['then'](handleEntityNotFound(_0x481a6d,null))[_0xc99b('0x2c')](saveUpdates(_0x28d62a[_0xc99b('0x4f')],null))[_0xc99b('0x2c')](respondWithResult(_0x481a6d,null))['catch'](handleError(_0x481a6d,null));};exports[_0xc99b('0x51')]=function(_0x5dd663,_0x36f149){return db[_0xc99b('0x34')]['find']({'where':{'id':_0x5dd663['params']['id']}})[_0xc99b('0x2c')](handleEntityNotFound(_0x36f149,null))['then'](removeEntity(_0x36f149,null))[_0xc99b('0x4d')](handleError(_0x36f149,null));};exports[_0xc99b('0x52')]=function(_0x493fb2,_0x295f34){return db['VoiceQueueReport'][_0xc99b('0x52')]()[_0xc99b('0x2c')](respondWithResult(_0x295f34,null))[_0xc99b('0x4d')](handleError(_0x295f34,null));};exports[_0xc99b('0x53')]=function(_0x3e13f4,_0x524e3b){var _0x6c9316={},_0x4a3126={},_0x80bbbc={'count':0x0,'rows':[]};_0x4a3126[_0xc99b('0x39')]=_[_0xc99b('0x3b')](db[_0xc99b('0x34')][_0xc99b('0x35')]);_0x4a3126['query']=_[_0xc99b('0x3b')](_0x3e13f4[_0xc99b('0x3a')]);_0x4a3126[_0xc99b('0x3c')]=_[_0xc99b('0x3d')](_0x4a3126[_0xc99b('0x39')],_0x4a3126['query']);_0x6c9316[_0xc99b('0x3e')]=_[_0xc99b('0x3d')](_0x4a3126[_0xc99b('0x39')],qs[_0xc99b('0x4b')](_0x3e13f4[_0xc99b('0x3a')][_0xc99b('0x4b')]));_0x6c9316['attributes']=_0x6c9316[_0xc99b('0x3e')]['length']?_0x6c9316['attributes']:_0x4a3126[_0xc99b('0x39')];if(!_0x3e13f4['query'][_0xc99b('0x40')](_0xc99b('0x54'))){_0x6c9316[_0xc99b('0x25')]=qs['limit'](_0x3e13f4['query'][_0xc99b('0x25')]);_0x6c9316[_0xc99b('0x23')]=qs[_0xc99b('0x23')](_0x3e13f4[_0xc99b('0x3a')][_0xc99b('0x23')]);}_0x6c9316[_0xc99b('0x55')]=qs['sort'](_0x3e13f4['query'][_0xc99b('0x41')]);_0x6c9316[_0xc99b('0x43')]=qs[_0xc99b('0x3c')](_[_0xc99b('0x56')](_0x3e13f4[_0xc99b('0x3a')],_0x4a3126['filters']));if(_0x3e13f4['query'][_0xc99b('0x42')]){_0x6c9316[_0xc99b('0x43')]=_[_0xc99b('0x45')](_0x6c9316[_0xc99b('0x43')],{'$or':_[_0xc99b('0x33')](_0x6c9316[_0xc99b('0x3e')],function(_0x1fd7cc){var _0x492688={};_0x492688[_0x1fd7cc]={'$like':'%'+_0x3e13f4['query'][_0xc99b('0x42')]+'%'};return _0x492688;})});}_0x6c9316=_[_0xc99b('0x45')]({},_0x6c9316,_0x3e13f4[_0xc99b('0x46')]);var _0x3caa52={'where':_0x6c9316['where']};return db[_0xc99b('0x34')][_0xc99b('0x26')](_0x3caa52)['then'](function(_0x266246){_0x80bbbc[_0xc99b('0x26')]=_0x266246;if(_0x3e13f4['query'][_0xc99b('0x47')]){_0x6c9316[_0xc99b('0x48')]=[{'all':!![]}];}return db[_0xc99b('0x34')]['findAll'](_0x6c9316);})['then'](function(_0xbe4b71){_0x80bbbc[_0xc99b('0x4a')]=_0xbe4b71;return _0x80bbbc;})[_0xc99b('0x2c')](respondWithFilteredResult(_0x524e3b,_0x6c9316,_0xc99b('0x53')))['catch'](handleError(_0x524e3b,null,_0xc99b('0x53')));}; \ No newline at end of file +var _0xdfdc=['VoiceQueueReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','findAll','catch','show','params','length','include','find','create','body','describe','filter','includeAll','getVoiceQueuesReport','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','stack','name','send'];(function(_0x2ec658,_0x2967ae){var _0x1e0e2f=function(_0x4ebf4e){while(--_0x4ebf4e){_0x2ec658['push'](_0x2ec658['shift']());}};_0x1e0e2f(++_0x2967ae);}(_0xdfdc,0xc7));var _0xcdfd=function(_0x3e0228,_0x4afdad){_0x3e0228=_0x3e0228-0x0;var _0x548109=_0xdfdc[_0x3e0228];return _0x548109;};'use strict';var emlformat=require(_0xcdfd('0x0'));var rimraf=require(_0xcdfd('0x1'));var zipdir=require(_0xcdfd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcdfd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcdfd('0x4'));var util=require(_0xcdfd('0x5'));var path=require(_0xcdfd('0x6'));var sox=require(_0xcdfd('0x7'));var csv=require('to-csv');var ejs=require(_0xcdfd('0x8'));var fs=require('fs');var fs_extra=require(_0xcdfd('0x9'));var _=require(_0xcdfd('0xa'));var squel=require(_0xcdfd('0xb'));var crypto=require('crypto');var jsforce=require(_0xcdfd('0xc'));var deskjs=require(_0xcdfd('0xd'));var toCsv=require(_0xcdfd('0xe'));var querystring=require('querystring');var Papa=require(_0xcdfd('0xf'));var Redis=require(_0xcdfd('0x10'));var authService=require(_0xcdfd('0x11'));var qs=require(_0xcdfd('0x12'));var as=require(_0xcdfd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcdfd('0x14'))(_0xcdfd('0x15'));var utils=require(_0xcdfd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcdfd('0x17'));var db=require('../../mysqldb')['db'];config[_0xcdfd('0x18')]=_[_0xcdfd('0x19')](config[_0xcdfd('0x18')],{'host':_0xcdfd('0x1a'),'port':0x18eb});var socket=require(_0xcdfd('0x1b'))(new Redis(config[_0xcdfd('0x18')]));require(_0xcdfd('0x1c'))[_0xcdfd('0x1d')](socket);function respondWithStatusCode(_0x142f77,_0x8e0a60){_0x8e0a60=_0x8e0a60||0xcc;return function(_0xd44cd2){if(_0xd44cd2){return _0x142f77[_0xcdfd('0x1e')](_0x8e0a60);}return _0x142f77['status'](_0x8e0a60)['end']();};}function respondWithResult(_0x4a67e7,_0x5a9f7e){_0x5a9f7e=_0x5a9f7e||0xc8;return function(_0x48d2cc){if(_0x48d2cc){return _0x4a67e7[_0xcdfd('0x1f')](_0x5a9f7e)[_0xcdfd('0x20')](_0x48d2cc);}};}function respondWithFilteredResult(_0x4b6b59,_0x5dad58){return function(_0x494e10){if(_0x494e10){var _0x5b7f4f=typeof _0x5dad58[_0xcdfd('0x21')]===_0xcdfd('0x22')&&typeof _0x5dad58[_0xcdfd('0x23')]===_0xcdfd('0x22');var _0x409d58=_0x494e10[_0xcdfd('0x24')];var _0x4bdb86=_0x5b7f4f?0x0:_0x5dad58[_0xcdfd('0x21')];var _0xf42b4f=_0x5b7f4f?_0x494e10[_0xcdfd('0x24')]:_0x5dad58['offset']+_0x5dad58['limit'];var _0x2dd1d5;if(_0xf42b4f>=_0x409d58){_0xf42b4f=_0x409d58;_0x2dd1d5=0xc8;}else{_0x2dd1d5=0xce;}_0x4b6b59[_0xcdfd('0x1f')](_0x2dd1d5);return _0x4b6b59[_0xcdfd('0x25')](_0xcdfd('0x26'),_0x4bdb86+'-'+_0xf42b4f+'/'+_0x409d58)['json'](_0x494e10);}return null;};}function patchUpdates(_0x1782ba){return function(_0x5808fe){try{jsonpatch['apply'](_0x5808fe,_0x1782ba,!![]);}catch(_0xacfae8){return BPromise[_0xcdfd('0x27')](_0xacfae8);}return _0x5808fe['save']();};}function saveUpdates(_0x2468ce,_0x5d012e){return function(_0x58935b){if(_0x58935b){return _0x58935b[_0xcdfd('0x28')](_0x2468ce)[_0xcdfd('0x29')](function(_0x558942){return _0x558942;});}return null;};}function removeEntity(_0x22b4b9,_0x365a91){return function(_0x332675){if(_0x332675){return _0x332675[_0xcdfd('0x2a')]()[_0xcdfd('0x29')](function(){_0x22b4b9[_0xcdfd('0x1f')](0xcc)[_0xcdfd('0x2b')]();});}};}function handleEntityNotFound(_0x39b8be,_0xa1a816){return function(_0x5bae89){if(!_0x5bae89){_0x39b8be[_0xcdfd('0x1e')](0x194);}return _0x5bae89;};}function handleError(_0x3eac6f,_0x286fbc){_0x286fbc=_0x286fbc||0x1f4;return function(_0x5a3fd7){logger['error'](_0x5a3fd7[_0xcdfd('0x2c')]);if(_0x5a3fd7[_0xcdfd('0x2d')]){delete _0x5a3fd7[_0xcdfd('0x2d')];}_0x3eac6f[_0xcdfd('0x1f')](_0x286fbc)[_0xcdfd('0x2e')](_0x5a3fd7);};}exports['index']=function(_0x88ebe0,_0x3391b8){var _0x1a0914={},_0x1f594a={},_0x555990={'count':0x0,'rows':[]};var _0x3214a9=_['map'](db[_0xcdfd('0x2f')][_0xcdfd('0x30')],function(_0x352791){return{'name':_0x352791[_0xcdfd('0x31')],'type':_0x352791[_0xcdfd('0x32')][_0xcdfd('0x33')]};});_0x1f594a['model']=_[_0xcdfd('0x34')](_0x3214a9,_0xcdfd('0x2d'));_0x1f594a[_0xcdfd('0x35')]=_[_0xcdfd('0x36')](_0x88ebe0[_0xcdfd('0x35')]);_0x1f594a['filters']=_[_0xcdfd('0x37')](_0x1f594a[_0xcdfd('0x38')],_0x1f594a[_0xcdfd('0x35')]);_0x1a0914[_0xcdfd('0x39')]=_[_0xcdfd('0x37')](_0x1f594a[_0xcdfd('0x38')],qs[_0xcdfd('0x3a')](_0x88ebe0[_0xcdfd('0x35')][_0xcdfd('0x3a')]));_0x1a0914[_0xcdfd('0x39')]=_0x1a0914[_0xcdfd('0x39')]['length']?_0x1a0914[_0xcdfd('0x39')]:_0x1f594a['model'];if(!_0x88ebe0[_0xcdfd('0x35')][_0xcdfd('0x3b')](_0xcdfd('0x3c'))){_0x1a0914[_0xcdfd('0x23')]=qs['limit'](_0x88ebe0[_0xcdfd('0x35')][_0xcdfd('0x23')]);_0x1a0914[_0xcdfd('0x21')]=qs[_0xcdfd('0x21')](_0x88ebe0[_0xcdfd('0x35')][_0xcdfd('0x21')]);}_0x1a0914[_0xcdfd('0x3d')]=qs[_0xcdfd('0x3e')](_0x88ebe0[_0xcdfd('0x35')]['sort']);_0x1a0914[_0xcdfd('0x3f')]=qs[_0xcdfd('0x40')](_[_0xcdfd('0x41')](_0x88ebe0[_0xcdfd('0x35')],_0x1f594a[_0xcdfd('0x40')]),_0x3214a9);if(_0x88ebe0[_0xcdfd('0x35')]['filter']){_0x1a0914[_0xcdfd('0x3f')]=_[_0xcdfd('0x42')](_0x1a0914[_0xcdfd('0x3f')],{'$or':_['map'](_0x3214a9,function(_0x296e1f){if(_0x296e1f[_0xcdfd('0x32')]!==_0xcdfd('0x43')){var _0x2f8242={};_0x2f8242[_0x296e1f[_0xcdfd('0x2d')]]={'$like':'%'+_0x88ebe0[_0xcdfd('0x35')]['filter']+'%'};return _0x2f8242;}})});}_0x1a0914=_[_0xcdfd('0x42')]({},_0x1a0914,_0x88ebe0[_0xcdfd('0x44')]);var _0x254a97={'where':_0x1a0914[_0xcdfd('0x3f')]};return db[_0xcdfd('0x2f')]['count'](_0x254a97)['then'](function(_0x4f34e0){_0x555990[_0xcdfd('0x24')]=_0x4f34e0;if(_0x88ebe0[_0xcdfd('0x35')]['includeAll']){_0x1a0914['include']=[{'all':!![]}];}return db[_0xcdfd('0x2f')][_0xcdfd('0x45')](_0x1a0914);})[_0xcdfd('0x29')](function(_0x25239d){_0x555990['rows']=_0x25239d;return _0x555990;})[_0xcdfd('0x29')](respondWithFilteredResult(_0x3391b8,_0x1a0914))[_0xcdfd('0x46')](handleError(_0x3391b8,null));};exports[_0xcdfd('0x47')]=function(_0x42eb1d,_0x64645a){var _0x568e00={'raw':![],'where':{'id':_0x42eb1d[_0xcdfd('0x48')]['id']}},_0x57de79={};_0x57de79[_0xcdfd('0x38')]=_[_0xcdfd('0x36')](db[_0xcdfd('0x2f')][_0xcdfd('0x30')]);_0x57de79[_0xcdfd('0x35')]=_[_0xcdfd('0x36')](_0x42eb1d[_0xcdfd('0x35')]);_0x57de79[_0xcdfd('0x40')]=_[_0xcdfd('0x37')](_0x57de79['model'],_0x57de79['query']);_0x568e00[_0xcdfd('0x39')]=_['intersection'](_0x57de79[_0xcdfd('0x38')],qs[_0xcdfd('0x3a')](_0x42eb1d[_0xcdfd('0x35')][_0xcdfd('0x3a')]));_0x568e00[_0xcdfd('0x39')]=_0x568e00[_0xcdfd('0x39')][_0xcdfd('0x49')]?_0x568e00['attributes']:_0x57de79[_0xcdfd('0x38')];if(_0x42eb1d['query']['includeAll']){_0x568e00[_0xcdfd('0x4a')]=[{'all':!![]}];}_0x568e00=_[_0xcdfd('0x42')]({},_0x568e00,_0x42eb1d['options']);return db['VoiceQueueReport'][_0xcdfd('0x4b')](_0x568e00)['then'](handleEntityNotFound(_0x64645a,null))[_0xcdfd('0x29')](respondWithResult(_0x64645a,null))['catch'](handleError(_0x64645a,null));};exports[_0xcdfd('0x4c')]=function(_0x27c28b,_0x4cf18d){return db['VoiceQueueReport'][_0xcdfd('0x4c')](_0x27c28b[_0xcdfd('0x4d')],{})[_0xcdfd('0x29')](respondWithResult(_0x4cf18d,0xc9))[_0xcdfd('0x46')](handleError(_0x4cf18d,null));};exports[_0xcdfd('0x28')]=function(_0x4cd8c3,_0x229fa4){if(_0x4cd8c3['body']['id']){delete _0x4cd8c3[_0xcdfd('0x4d')]['id'];}return db[_0xcdfd('0x2f')]['find']({'where':{'id':_0x4cd8c3[_0xcdfd('0x48')]['id']}})['then'](handleEntityNotFound(_0x229fa4,null))[_0xcdfd('0x29')](saveUpdates(_0x4cd8c3[_0xcdfd('0x4d')],null))['then'](respondWithResult(_0x229fa4,null))[_0xcdfd('0x46')](handleError(_0x229fa4,null));};exports[_0xcdfd('0x2a')]=function(_0x4efe8e,_0x3d69a8){return db['VoiceQueueReport'][_0xcdfd('0x4b')]({'where':{'id':_0x4efe8e[_0xcdfd('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d69a8,null))[_0xcdfd('0x29')](removeEntity(_0x3d69a8,null))['catch'](handleError(_0x3d69a8,null));};exports[_0xcdfd('0x4e')]=function(_0x221134,_0x56323f){return db[_0xcdfd('0x2f')]['describe']()[_0xcdfd('0x29')](respondWithResult(_0x56323f,null))[_0xcdfd('0x46')](handleError(_0x56323f,null));};exports['getVoiceQueuesReport']=function(_0x367eee,_0x3425c3){var _0x105054={},_0x47f223={},_0x770ea8={'count':0x0,'rows':[]};_0x47f223['model']=_[_0xcdfd('0x36')](db[_0xcdfd('0x2f')][_0xcdfd('0x30')]);_0x47f223[_0xcdfd('0x35')]=_[_0xcdfd('0x36')](_0x367eee['query']);_0x47f223[_0xcdfd('0x40')]=_[_0xcdfd('0x37')](_0x47f223[_0xcdfd('0x38')],_0x47f223['query']);_0x105054[_0xcdfd('0x39')]=_[_0xcdfd('0x37')](_0x47f223['model'],qs[_0xcdfd('0x3a')](_0x367eee[_0xcdfd('0x35')][_0xcdfd('0x3a')]));_0x105054['attributes']=_0x105054[_0xcdfd('0x39')][_0xcdfd('0x49')]?_0x105054['attributes']:_0x47f223['model'];if(!_0x367eee[_0xcdfd('0x35')][_0xcdfd('0x3b')](_0xcdfd('0x3c'))){_0x105054[_0xcdfd('0x23')]=qs['limit'](_0x367eee[_0xcdfd('0x35')][_0xcdfd('0x23')]);_0x105054[_0xcdfd('0x21')]=qs[_0xcdfd('0x21')](_0x367eee[_0xcdfd('0x35')][_0xcdfd('0x21')]);}_0x105054[_0xcdfd('0x3d')]=qs['sort'](_0x367eee['query'][_0xcdfd('0x3e')]);_0x105054[_0xcdfd('0x3f')]=qs['filters'](_[_0xcdfd('0x41')](_0x367eee[_0xcdfd('0x35')],_0x47f223[_0xcdfd('0x40')]));if(_0x367eee['query'][_0xcdfd('0x4f')]){_0x105054[_0xcdfd('0x3f')]=_[_0xcdfd('0x42')](_0x105054[_0xcdfd('0x3f')],{'$or':_[_0xcdfd('0x34')](_0x105054[_0xcdfd('0x39')],function(_0xb6bdab){var _0x2761c4={};_0x2761c4[_0xb6bdab]={'$like':'%'+_0x367eee[_0xcdfd('0x35')]['filter']+'%'};return _0x2761c4;})});}_0x105054=_[_0xcdfd('0x42')]({},_0x105054,_0x367eee[_0xcdfd('0x44')]);var _0x38c24a={'where':_0x105054[_0xcdfd('0x3f')]};return db[_0xcdfd('0x2f')]['count'](_0x38c24a)[_0xcdfd('0x29')](function(_0x1447bc){_0x770ea8['count']=_0x1447bc;if(_0x367eee[_0xcdfd('0x35')][_0xcdfd('0x50')]){_0x105054['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xcdfd('0x45')](_0x105054);})[_0xcdfd('0x29')](function(_0x50ffd6){_0x770ea8['rows']=_0x50ffd6;return _0x770ea8;})[_0xcdfd('0x29')](respondWithFilteredResult(_0x3425c3,_0x105054,_0xcdfd('0x51')))[_0xcdfd('0x46')](handleError(_0x3425c3,null,_0xcdfd('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 0616b3f..afb393a 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 _0xed57=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x1c2fb6,_0x1b941a){var _0x1f6680=function(_0x3f6339){while(--_0x3f6339){_0x1c2fb6['push'](_0x1c2fb6['shift']());}};_0x1f6680(++_0x1b941a);}(_0xed57,0x117));var _0x7ed5=function(_0x1557c8,_0xe885db){_0x1557c8=_0x1557c8-0x0;var _0x185f66=_0xed57[_0x1557c8];return _0x185f66;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x7ed5('0x0'))['db'][_0x7ed5('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7ed5('0x2')](0x0);var events={'afterCreate':_0x7ed5('0x3'),'afterUpdate':_0x7ed5('0x4'),'afterDestroy':_0x7ed5('0x5')};function emitEvent(_0x36e2f8){return function(_0xc7a9f1,_0x43c0d1,_0x84e56c){VoiceQueueReportEvents[_0x7ed5('0x6')](_0x36e2f8+':'+_0xc7a9f1['id'],_0xc7a9f1);VoiceQueueReportEvents[_0x7ed5('0x6')](_0x36e2f8,_0xc7a9f1);_0x84e56c(null);};}for(var e in events){if(events[_0x7ed5('0x7')](e)){var event=events[e];VoiceQueueReport[_0x7ed5('0x8')](e,emitEvent(event));}}module[_0x7ed5('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x6403=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','update','remove','emit'];(function(_0x126b37,_0x5089fa){var _0x40c7b8=function(_0x26ced5){while(--_0x26ced5){_0x126b37['push'](_0x126b37['shift']());}};_0x40c7b8(++_0x5089fa);}(_0x6403,0x1a1));var _0x3640=function(_0xfd5517,_0x468d64){_0xfd5517=_0xfd5517-0x0;var _0x3468c4=_0x6403[_0xfd5517];return _0x3468c4;};'use strict';var EventEmitter=require(_0x3640('0x0'));var VoiceQueueReport=require(_0x3640('0x1'))['db'][_0x3640('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3640('0x3'),'afterDestroy':_0x3640('0x4')};function emitEvent(_0xe9860a){return function(_0x3016a1,_0x18a19b,_0x2a4567){VoiceQueueReportEvents['emit'](_0xe9860a+':'+_0x3016a1['id'],_0x3016a1);VoiceQueueReportEvents[_0x3640('0x5')](_0xe9860a,_0x3016a1);_0x2a4567(null);};}for(var e in events){if(events[_0x3640('0x6')](e)){var event=events[e];VoiceQueueReport[_0x3640('0x7')](e,emitEvent(event));}}module[_0x3640('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 872c6de..ab3a075 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 _0xe497=['moment','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','calleridnum','lodash'];(function(_0x5ad335,_0x10489f){var _0x2a84d5=function(_0x1d6526){while(--_0x1d6526){_0x5ad335['push'](_0x5ad335['shift']());}};_0x2a84d5(++_0x10489f);}(_0xe497,0x1c1));var _0x7e49=function(_0x242617,_0x523952){_0x242617=_0x242617-0x0;var _0x18f859=_0xe497[_0x242617];return _0x18f859;};'use strict';var _=require(_0x7e49('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7e49('0x1'));var BPromise=require('bluebird');var rp=require(_0x7e49('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e49('0x3'));var config=require(_0x7e49('0x4'));var attributes=require(_0x7e49('0x5'));module[_0x7e49('0x6')]=function(_0x169eef,_0x472c4d){return _0x169eef[_0x7e49('0x7')]('VoiceQueueReport',attributes,{'tableName':_0x7e49('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x7e49('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x864e=['../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','calleridnum','lodash','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x864e,0x166));var _0xe864=function(_0xbea836,_0x100985){_0xbea836=_0xbea836-0x0;var _0x221a4e=_0x864e[_0xbea836];return _0x221a4e;};'use strict';var _=require(_0xe864('0x0'));var util=require('util');var logger=require(_0xe864('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe864('0x2'));var attributes=require(_0xe864('0x3'));module[_0xe864('0x4')]=function(_0xa9583b,_0x42f9b8){return _0xa9583b[_0xe864('0x5')](_0xe864('0x6'),attributes,{'tableName':_0xe864('0x7'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xe864('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index dd623aa..08fd99c 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 _0xf3e4=['./voiceQueueReport.socket','register','request','then','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueueReport,\x20%s,\x20%s','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','catch','CreateVoiceQueueReport','create','body','info','UpdateVoiceQueueReport','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost'];(function(_0xed6f46,_0x1c9006){var _0x5b267c=function(_0x59f0d2){while(--_0x59f0d2){_0xed6f46['push'](_0xed6f46['shift']());}};_0x5b267c(++_0x1c9006);}(_0xf3e4,0x71));var _0x4f3e=function(_0x18adbe,_0x3c26c7){_0x18adbe=_0x18adbe-0x0;var _0x3da562=_0xf3e4[_0x18adbe];return _0x3da562;};'use strict';var _=require(_0x4f3e('0x0'));var util=require(_0x4f3e('0x1'));var moment=require(_0x4f3e('0x2'));var BPromise=require(_0x4f3e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f3e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f3e('0x5'));var logger=require(_0x4f3e('0x6'))(_0x4f3e('0x7'));var config=require(_0x4f3e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4f3e('0x9')]['http']({'port':0x232a});config[_0x4f3e('0xa')]=_[_0x4f3e('0xb')](config[_0x4f3e('0xa')],{'host':_0x4f3e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4f3e('0xd'))[_0x4f3e('0xe')](socket);function respondWithRpcPromise(_0x142061,_0xfba4a0,_0x5344d3){return new BPromise(function(_0x394202,_0x3b6823){return client[_0x4f3e('0xf')](_0x142061,_0x5344d3)[_0x4f3e('0x10')](function(_0x4c9424){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0xfba4a0,_0x4f3e('0x11'));logger[_0x4f3e('0x12')](_0x4f3e('0x13'),_0xfba4a0,_0x4f3e('0x11'),JSON[_0x4f3e('0x14')](_0x4c9424));if(_0x4c9424[_0x4f3e('0x15')]){if(_0x4c9424[_0x4f3e('0x15')]['code']===0x1f4){logger[_0x4f3e('0x15')](_0x4f3e('0x16'),_0xfba4a0,_0x4c9424[_0x4f3e('0x15')][_0x4f3e('0x17')]);return _0x3b6823(_0x4c9424[_0x4f3e('0x15')][_0x4f3e('0x17')]);}logger[_0x4f3e('0x15')](_0x4f3e('0x16'),_0xfba4a0,_0x4c9424[_0x4f3e('0x15')]['message']);return _0x394202(_0x4c9424[_0x4f3e('0x15')]['message']);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0xfba4a0,_0x4f3e('0x11'));_0x394202(_0x4c9424[_0x4f3e('0x18')][_0x4f3e('0x17')]);}})['catch'](function(_0x4c8e42){logger[_0x4f3e('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0xfba4a0,_0x4c8e42);_0x3b6823(_0x4c8e42);});});}exports[_0x4f3e('0x19')]=function(_0x9b1641){var _0xcedff4=this;return new Promise(function(_0x55ef57,_0x5889db){return db[_0x4f3e('0x1a')][_0x4f3e('0x1b')]({'raw':_0x9b1641['options']?_0x9b1641[_0x4f3e('0x1c')][_0x4f3e('0x1d')]===undefined?!![]:![]:!![],'where':_0x9b1641[_0x4f3e('0x1c')]?_0x9b1641[_0x4f3e('0x1c')][_0x4f3e('0x1e')]||null:null,'attributes':_0x9b1641[_0x4f3e('0x1c')]?_0x9b1641['options'][_0x4f3e('0x1f')]||null:null,'limit':_0x9b1641[_0x4f3e('0x1c')]?_0x9b1641[_0x4f3e('0x1c')][_0x4f3e('0x20')]||null:null,'include':_0x9b1641[_0x4f3e('0x1c')]?_0x9b1641[_0x4f3e('0x1c')][_0x4f3e('0x21')]?_[_0x4f3e('0x22')](_0x9b1641[_0x4f3e('0x1c')][_0x4f3e('0x21')],function(_0x1f264c){return{'model':db[_0x1f264c[_0x4f3e('0x23')]],'as':_0x1f264c['as'],'attributes':_0x1f264c[_0x4f3e('0x1f')],'include':_0x1f264c[_0x4f3e('0x21')]?_[_0x4f3e('0x22')](_0x1f264c[_0x4f3e('0x21')],function(_0x25838a){return{'model':db[_0x25838a[_0x4f3e('0x23')]],'as':_0x25838a['as'],'attributes':_0x25838a['attributes'],'include':_0x25838a[_0x4f3e('0x21')]?_[_0x4f3e('0x22')](_0x25838a[_0x4f3e('0x21')],function(_0x10c91d){return{'model':db[_0x10c91d[_0x4f3e('0x23')]],'as':_0x10c91d['as'],'attributes':_0x10c91d[_0x4f3e('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe9f79b){logger['info']('GetVoiceQueueReport',_0x9b1641);logger[_0x4f3e('0x12')](_0x4f3e('0x19'),_0x9b1641,JSON[_0x4f3e('0x14')](_0xe9f79b));_0x55ef57(_0xe9f79b);})[_0x4f3e('0x24')](function(_0x22111a){logger['error'](_0x4f3e('0x19'),_0x22111a[_0x4f3e('0x17')],_0x9b1641);_0x5889db(_0xcedff4[_0x4f3e('0x15')](0x1f4,_0x22111a[_0x4f3e('0x17')]));});});};exports[_0x4f3e('0x25')]=function(_0x535cab){var _0x1bbcc5=this;return new Promise(function(_0x454d6d,_0x4ee98a){return db[_0x4f3e('0x1a')][_0x4f3e('0x26')](_0x535cab[_0x4f3e('0x27')],{'raw':_0x535cab['options']?_0x535cab[_0x4f3e('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x4f3e('0x10')](function(_0x1f01eb){logger[_0x4f3e('0x28')](_0x4f3e('0x25'),_0x535cab);logger[_0x4f3e('0x12')](_0x4f3e('0x25'),_0x535cab,JSON[_0x4f3e('0x14')](_0x1f01eb));_0x454d6d(_0x1f01eb);})[_0x4f3e('0x24')](function(_0x16baa1){logger[_0x4f3e('0x15')]('CreateVoiceQueueReport',_0x16baa1[_0x4f3e('0x17')],_0x535cab);_0x4ee98a(_0x1bbcc5['error'](0x1f4,_0x16baa1[_0x4f3e('0x17')]));});});};exports[_0x4f3e('0x29')]=function(_0x9f9524){var _0x31d799=this;return new Promise(function(_0x19d61c,_0x400f41){return db[_0x4f3e('0x1a')]['update'](_0x9f9524[_0x4f3e('0x27')],{'raw':_0x9f9524[_0x4f3e('0x1c')]?_0x9f9524[_0x4f3e('0x1c')][_0x4f3e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9f9524[_0x4f3e('0x1c')]?_0x9f9524[_0x4f3e('0x1c')][_0x4f3e('0x1e')]||null:null,'attributes':_0x9f9524[_0x4f3e('0x1c')]?_0x9f9524['options']['attributes']||null:null,'limit':_0x9f9524['options']?_0x9f9524[_0x4f3e('0x1c')][_0x4f3e('0x20')]||null:null})[_0x4f3e('0x10')](function(_0xa40a82){logger[_0x4f3e('0x28')](_0x4f3e('0x29'),_0x9f9524);logger[_0x4f3e('0x12')](_0x4f3e('0x29'),_0x9f9524,JSON[_0x4f3e('0x14')](_0xa40a82));_0x19d61c(_0xa40a82);})[_0x4f3e('0x24')](function(_0x10a1f9){logger['error']('UpdateVoiceQueueReport',_0x10a1f9['message'],_0x9f9524);_0x400f41(_0x31d799[_0x4f3e('0x15')](0x1f4,_0x10a1f9[_0x4f3e('0x17')]));});});}; \ No newline at end of file +var _0x4f83=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','raw','options','where','include','model','attributes','map','then','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4e082d,_0x26ce91){var _0x2c4df6=function(_0x241712){while(--_0x241712){_0x4e082d['push'](_0x4e082d['shift']());}};_0x2c4df6(++_0x26ce91);}(_0x4f83,0x78));var _0x34f8=function(_0x594293,_0x77712f){_0x594293=_0x594293-0x0;var _0x20f156=_0x4f83[_0x594293];return _0x20f156;};'use strict';var _=require('lodash');var util=require(_0x34f8('0x0'));var moment=require(_0x34f8('0x1'));var BPromise=require(_0x34f8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34f8('0x3'));var db=require(_0x34f8('0x4'))['db'];var utils=require(_0x34f8('0x5'));var logger=require(_0x34f8('0x6'))(_0x34f8('0x7'));var config=require(_0x34f8('0x8'));var jayson=require(_0x34f8('0x9'));var client=jayson[_0x34f8('0xa')]['http']({'port':0x232a});config[_0x34f8('0xb')]=_[_0x34f8('0xc')](config[_0x34f8('0xb')],{'host':_0x34f8('0xd'),'port':0x18eb});var socket=require(_0x34f8('0xe'))(new Redis(config['redis']));require(_0x34f8('0xf'))[_0x34f8('0x10')](socket);function respondWithRpcPromise(_0x5d7f4e,_0x5b91c7,_0x3ce875){return new BPromise(function(_0x25c6e3,_0x3f655c){return client['request'](_0x5d7f4e,_0x3ce875)['then'](function(_0x301573){logger[_0x34f8('0x11')](_0x34f8('0x12'),_0x5b91c7,_0x34f8('0x13'));logger[_0x34f8('0x14')](_0x34f8('0x15'),_0x5b91c7,_0x34f8('0x13'),JSON[_0x34f8('0x16')](_0x301573));if(_0x301573[_0x34f8('0x17')]){if(_0x301573[_0x34f8('0x17')][_0x34f8('0x18')]===0x1f4){logger['error'](_0x34f8('0x12'),_0x5b91c7,_0x301573[_0x34f8('0x17')][_0x34f8('0x19')]);return _0x3f655c(_0x301573[_0x34f8('0x17')][_0x34f8('0x19')]);}logger[_0x34f8('0x17')](_0x34f8('0x12'),_0x5b91c7,_0x301573[_0x34f8('0x17')][_0x34f8('0x19')]);return _0x25c6e3(_0x301573[_0x34f8('0x17')][_0x34f8('0x19')]);}else{logger[_0x34f8('0x11')](_0x34f8('0x12'),_0x5b91c7,_0x34f8('0x13'));_0x25c6e3(_0x301573[_0x34f8('0x1a')][_0x34f8('0x19')]);}})[_0x34f8('0x1b')](function(_0x2507a4){logger[_0x34f8('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x5b91c7,_0x2507a4);_0x3f655c(_0x2507a4);});});}exports[_0x34f8('0x1c')]=function(_0x3559bc){var _0x4d9a36=this;return new Promise(function(_0x1a0f60,_0x4b2625){return db[_0x34f8('0x1d')]['findAll']({'raw':_0x3559bc['options']?_0x3559bc['options'][_0x34f8('0x1e')]===undefined?!![]:![]:!![],'where':_0x3559bc[_0x34f8('0x1f')]?_0x3559bc[_0x34f8('0x1f')][_0x34f8('0x20')]||null:null,'attributes':_0x3559bc[_0x34f8('0x1f')]?_0x3559bc[_0x34f8('0x1f')]['attributes']||null:null,'limit':_0x3559bc[_0x34f8('0x1f')]?_0x3559bc[_0x34f8('0x1f')]['limit']||null:null,'include':_0x3559bc[_0x34f8('0x1f')]?_0x3559bc[_0x34f8('0x1f')]['include']?_['map'](_0x3559bc[_0x34f8('0x1f')][_0x34f8('0x21')],function(_0x493619){return{'model':db[_0x493619[_0x34f8('0x22')]],'as':_0x493619['as'],'attributes':_0x493619[_0x34f8('0x23')],'include':_0x493619[_0x34f8('0x21')]?_[_0x34f8('0x24')](_0x493619['include'],function(_0x19ba28){return{'model':db[_0x19ba28['model']],'as':_0x19ba28['as'],'attributes':_0x19ba28[_0x34f8('0x23')],'include':_0x19ba28['include']?_[_0x34f8('0x24')](_0x19ba28[_0x34f8('0x21')],function(_0x4eb3ef){return{'model':db[_0x4eb3ef[_0x34f8('0x22')]],'as':_0x4eb3ef['as'],'attributes':_0x4eb3ef[_0x34f8('0x23')]};}):[]};}):[]};}):[]:[]})[_0x34f8('0x25')](function(_0x4baedd){logger[_0x34f8('0x11')]('GetVoiceQueueReport',_0x3559bc);logger[_0x34f8('0x14')]('GetVoiceQueueReport',_0x3559bc,JSON[_0x34f8('0x16')](_0x4baedd));_0x1a0f60(_0x4baedd);})[_0x34f8('0x1b')](function(_0x4413e4){logger[_0x34f8('0x17')]('GetVoiceQueueReport',_0x4413e4['message'],_0x3559bc);_0x4b2625(_0x4d9a36[_0x34f8('0x17')](0x1f4,_0x4413e4['message']));});});};exports[_0x34f8('0x26')]=function(_0x1dce7){var _0x501467=this;return new Promise(function(_0x1d1a16,_0x2510fb){return db['VoiceQueueReport'][_0x34f8('0x27')](_0x1dce7[_0x34f8('0x28')],{'raw':_0x1dce7[_0x34f8('0x1f')]?_0x1dce7[_0x34f8('0x1f')][_0x34f8('0x1e')]===undefined?!![]:![]:!![]})[_0x34f8('0x25')](function(_0x4a3b06){logger[_0x34f8('0x11')](_0x34f8('0x26'),_0x1dce7);logger[_0x34f8('0x14')]('CreateVoiceQueueReport',_0x1dce7,JSON[_0x34f8('0x16')](_0x4a3b06));_0x1d1a16(_0x4a3b06);})[_0x34f8('0x1b')](function(_0x4bf7f1){logger[_0x34f8('0x17')](_0x34f8('0x26'),_0x4bf7f1[_0x34f8('0x19')],_0x1dce7);_0x2510fb(_0x501467[_0x34f8('0x17')](0x1f4,_0x4bf7f1['message']));});});};exports[_0x34f8('0x29')]=function(_0x59f231){var _0xf3e998=this;return new Promise(function(_0x8dbec6,_0x27376d){return db[_0x34f8('0x1d')]['update'](_0x59f231[_0x34f8('0x28')],{'raw':_0x59f231[_0x34f8('0x1f')]?_0x59f231['options'][_0x34f8('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59f231[_0x34f8('0x1f')]?_0x59f231['options'][_0x34f8('0x20')]||null:null,'attributes':_0x59f231[_0x34f8('0x1f')]?_0x59f231['options'][_0x34f8('0x23')]||null:null,'limit':_0x59f231[_0x34f8('0x1f')]?_0x59f231[_0x34f8('0x1f')][_0x34f8('0x2a')]||null:null})[_0x34f8('0x25')](function(_0x211857){logger[_0x34f8('0x11')]('UpdateVoiceQueueReport',_0x59f231);logger[_0x34f8('0x14')]('UpdateVoiceQueueReport',_0x59f231,JSON[_0x34f8('0x16')](_0x211857));_0x8dbec6(_0x211857);})[_0x34f8('0x1b')](function(_0x15bdc1){logger[_0x34f8('0x17')](_0x34f8('0x29'),_0x15bdc1['message'],_0x59f231);_0x27376d(_0xf3e998[_0x34f8('0x17')](0x1f4,_0x15bdc1[_0x34f8('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 99d44bc..af99abd 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 _0x873a=['length','voiceQueueReport:','./voiceQueueReport.events','save','remove','emit','removeListener','register'];(function(_0x2357ce,_0x11c703){var _0x58f3d2=function(_0x28cf84){while(--_0x28cf84){_0x2357ce['push'](_0x2357ce['shift']());}};_0x58f3d2(++_0x11c703);}(_0x873a,0x1c2));var _0xa873=function(_0x3bb1df,_0x542e73){_0x3bb1df=_0x3bb1df-0x0;var _0x2545a6=_0x873a[_0x3bb1df];return _0x2545a6;};'use strict';var VoiceQueueReportEvents=require(_0xa873('0x0'));var events=[_0xa873('0x1'),_0xa873('0x2'),'update'];function createListener(_0x1de6be,_0x5733ee){return function(_0x52c086){_0x5733ee[_0xa873('0x3')](_0x1de6be,_0x52c086);};}function removeListener(_0x46971d,_0x5a0d23){return function(){VoiceQueueReportEvents[_0xa873('0x4')](_0x46971d,_0x5a0d23);};}exports[_0xa873('0x5')]=function(_0x5c0d74){for(var _0x370b8a=0x0,_0x56f262=events[_0xa873('0x6')];_0x370b8a<_0x56f262;_0x370b8a++){var _0x43247f=events[_0x370b8a];var _0x265c05=createListener(_0xa873('0x7')+_0x43247f,_0x5c0d74);VoiceQueueReportEvents['on'](_0x43247f,_0x265c05);}}; \ No newline at end of file +var _0xdb94=['voiceQueueReport:','save','remove','emit','removeListener','length'];(function(_0x578201,_0xe5c92d){var _0x4c74f4=function(_0x2336e1){while(--_0x2336e1){_0x578201['push'](_0x578201['shift']());}};_0x4c74f4(++_0xe5c92d);}(_0xdb94,0xe5));var _0x4db9=function(_0x5e0af7,_0x1600eb){_0x5e0af7=_0x5e0af7-0x0;var _0x163ffa=_0xdb94[_0x5e0af7];return _0x163ffa;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x4db9('0x0'),_0x4db9('0x1'),'update'];function createListener(_0x26e16b,_0x3b24a6){return function(_0x25b510){_0x3b24a6[_0x4db9('0x2')](_0x26e16b,_0x25b510);};}function removeListener(_0x1f05d4,_0x592097){return function(){VoiceQueueReportEvents[_0x4db9('0x3')](_0x1f05d4,_0x592097);};}exports['register']=function(_0x1d21a8){for(var _0xc76bc1=0x0,_0x1dddb9=events[_0x4db9('0x4')];_0xc76bc1<_0x1dddb9;_0xc76bc1++){var _0x42a857=events[_0xc76bc1];var _0x57c701=createListener(_0x4db9('0x5')+_0x42a857,_0x1d21a8);VoiceQueueReportEvents['on'](_0x42a857,_0x57c701);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 17b265c..8c0fd56 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 _0xf491=['post','isAuthenticated','create','/:id','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x4e6f62,_0x58a168){var _0x19bcda=function(_0xc2eabd){while(--_0xc2eabd){_0x4e6f62['push'](_0x4e6f62['shift']());}};_0x19bcda(++_0x58a168);}(_0xf491,0x178));var _0x1f49=function(_0x426a37,_0x1d32df){_0x426a37=_0x426a37-0x0;var _0x4e9e28=_0xf491[_0x426a37];return _0x4e9e28;};'use strict';var multer=require(_0x1f49('0x0'));var util=require(_0x1f49('0x1'));var path=require(_0x1f49('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1f49('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1f49('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1f49('0x5'));var controller=require(_0x1f49('0x6'));router[_0x1f49('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1f49('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1f49('0x8')]('/',auth[_0x1f49('0x9')](),controller[_0x1f49('0xa')]);router['put'](_0x1f49('0xb'),auth[_0x1f49('0x9')](),controller[_0x1f49('0xc')]);router[_0x1f49('0xd')]('/:id',auth[_0x1f49('0x9')](),controller[_0x1f49('0xe')]);module[_0x1f49('0xf')]=router; \ No newline at end of file +var _0xd190=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create','put','update','delete','/:id'];(function(_0x2e2ba2,_0x1662ed){var _0x16a312=function(_0x500504){while(--_0x500504){_0x2e2ba2['push'](_0x2e2ba2['shift']());}};_0x16a312(++_0x1662ed);}(_0xd190,0xde));var _0x0d19=function(_0x4900e7,_0x3b3f2a){_0x4900e7=_0x4900e7-0x0;var _0x35803d=_0xd190[_0x4900e7];return _0x35803d;};'use strict';var multer=require('multer');var util=require(_0x0d19('0x0'));var path=require('path');var timeout=require(_0x0d19('0x1'));var express=require(_0x0d19('0x2'));var router=express[_0x0d19('0x3')]();var fs_extra=require(_0x0d19('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0d19('0x5'));var config=require(_0x0d19('0x6'));var controller=require(_0x0d19('0x7'));router[_0x0d19('0x8')]('/',auth[_0x0d19('0x9')](),controller[_0x0d19('0xa')]);router[_0x0d19('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0d19('0xb')]);router[_0x0d19('0xc')]('/',auth[_0x0d19('0x9')](),controller[_0x0d19('0xd')]);router[_0x0d19('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x0d19('0xf')]);router[_0x0d19('0x10')](_0x0d19('0x11'),auth[_0x0d19('0x9')](),controller[_0x0d19('0x12')]);module[_0x0d19('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index d0a84f1..da0eefd 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 _0x7b84=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING'];(function(_0x3194c5,_0x43a72f){var _0x544dee=function(_0x205a0f){while(--_0x205a0f){_0x3194c5['push'](_0x3194c5['shift']());}};_0x544dee(++_0x43a72f);}(_0x7b84,0x17c));var _0x47b8=function(_0x1983f9,_0x406b28){_0x1983f9=_0x1983f9-0x0;var _0x107e99=_0x7b84[_0x1983f9];return _0x107e99;};'use strict';var Sequelize=require(_0x47b8('0x0'));var moment=require(_0x47b8('0x1'));module[_0x47b8('0x2')]={'time':{'type':Sequelize[_0x47b8('0x3')]},'callid':{'type':Sequelize[_0x47b8('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x47b8('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x47b8('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x47b8('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x47b8('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x47b8('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x47b8('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x47b8('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x47b8('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x47b8('0x4')](_0x47b8('0x5'))}}; \ No newline at end of file +var _0xa1a9=['STRING','format','sequelize'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0xa1a9,0x9b));var _0x9a1a=function(_0x265364,_0x3c3b3f){_0x265364=_0x265364-0x0;var _0x3f3e65=_0xa1a9[_0x265364];return _0x3f3e65;};'use strict';var Sequelize=require(_0x9a1a('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x9a1a('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x9a1a('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x9a1a('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x9a1a('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x9a1a('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x9a1a('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x9a1a('0x2')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 52d55ca..51bfce1 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 _0x812b=['sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','error','stack','name','index','map','VoiceQueuesLog','fieldName','key','model','keys','filters','intersection','fields','attributes','length','query','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x5b197a,_0x12a97a){var _0x4c05af=function(_0x21e9fa){while(--_0x21e9fa){_0x5b197a['push'](_0x5b197a['shift']());}};_0x4c05af(++_0x12a97a);}(_0x812b,0x1d6));var _0xb812=function(_0x5e3191,_0x47fe85){_0x5e3191=_0x5e3191-0x0;var _0xc8d5e6=_0x812b[_0x5e3191];return _0xc8d5e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb812('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb812('0x1'));var rp=require(_0xb812('0x2'));var moment=require(_0xb812('0x3'));var BPromise=require(_0xb812('0x4'));var Mustache=require(_0xb812('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb812('0x6'));var csv=require(_0xb812('0x7'));var ejs=require(_0xb812('0x8'));var fs=require('fs');var fs_extra=require(_0xb812('0x9'));var _=require(_0xb812('0xa'));var squel=require(_0xb812('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb812('0xc'));var toCsv=require(_0xb812('0x7'));var querystring=require(_0xb812('0xd'));var Papa=require(_0xb812('0xe'));var Redis=require(_0xb812('0xf'));var authService=require(_0xb812('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb812('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb812('0x12'));var config=require(_0xb812('0x13'));var licenseUtil=require(_0xb812('0x14'));var db=require(_0xb812('0x15'))['db'];function respondWithStatusCode(_0x32ac10,_0x46482a){_0x46482a=_0x46482a||0xcc;return function(_0x11efe3){if(_0x11efe3){return _0x32ac10[_0xb812('0x16')](_0x46482a);}return _0x32ac10[_0xb812('0x17')](_0x46482a)[_0xb812('0x18')]();};}function respondWithResult(_0x3fceaa,_0x1bc342){_0x1bc342=_0x1bc342||0xc8;return function(_0x42aa84){if(_0x42aa84){return _0x3fceaa[_0xb812('0x17')](_0x1bc342)[_0xb812('0x19')](_0x42aa84);}};}function respondWithFilteredResult(_0x26ca51,_0xa72270){return function(_0x7c92e0){if(_0x7c92e0){var _0x5308f6=typeof _0xa72270[_0xb812('0x1a')]===_0xb812('0x1b')&&typeof _0xa72270[_0xb812('0x1c')]===_0xb812('0x1b');var _0x6cc194=_0x7c92e0[_0xb812('0x1d')];var _0x4d6a99=_0x5308f6?0x0:_0xa72270[_0xb812('0x1a')];var _0x829c65=_0x5308f6?_0x7c92e0[_0xb812('0x1d')]:_0xa72270[_0xb812('0x1a')]+_0xa72270[_0xb812('0x1c')];var _0x4b0491;if(_0x829c65>=_0x6cc194){_0x829c65=_0x6cc194;_0x4b0491=0xc8;}else{_0x4b0491=0xce;}_0x26ca51['status'](_0x4b0491);return _0x26ca51[_0xb812('0x1e')]('Content-Range',_0x4d6a99+'-'+_0x829c65+'/'+_0x6cc194)[_0xb812('0x19')](_0x7c92e0);}return null;};}function patchUpdates(_0x20cdae){return function(_0x2b4be0){try{jsonpatch[_0xb812('0x1f')](_0x2b4be0,_0x20cdae,!![]);}catch(_0xe3ad6a){return BPromise['reject'](_0xe3ad6a);}return _0x2b4be0['save']();};}function saveUpdates(_0xba2270,_0x122232){return function(_0x243bc0){if(_0x243bc0){return _0x243bc0[_0xb812('0x20')](_0xba2270)[_0xb812('0x21')](function(_0x52d7df){return _0x52d7df;});}return null;};}function removeEntity(_0x3e8ecd,_0x469424){return function(_0x1f2ea9){if(_0x1f2ea9){return _0x1f2ea9[_0xb812('0x22')]()[_0xb812('0x21')](function(){_0x3e8ecd['status'](0xcc)[_0xb812('0x18')]();});}};}function handleEntityNotFound(_0x4a453f,_0x5e85e1){return function(_0x1f08ea){if(!_0x1f08ea){_0x4a453f[_0xb812('0x16')](0x194);}return _0x1f08ea;};}function handleError(_0x547c07,_0x518a4a){_0x518a4a=_0x518a4a||0x1f4;return function(_0x4e56a4){logger[_0xb812('0x23')](_0x4e56a4[_0xb812('0x24')]);if(_0x4e56a4[_0xb812('0x25')]){delete _0x4e56a4[_0xb812('0x25')];}_0x547c07[_0xb812('0x17')](_0x518a4a)['send'](_0x4e56a4);};}exports[_0xb812('0x26')]=function(_0x3f8a7c,_0x385e20){var _0x16291c={},_0x354fbd={},_0xa4a625={'count':0x0,'rows':[]};var _0x4b7c2a=_[_0xb812('0x27')](db[_0xb812('0x28')]['rawAttributes'],function(_0xef767){return{'name':_0xef767[_0xb812('0x29')],'type':_0xef767['type'][_0xb812('0x2a')]};});_0x354fbd[_0xb812('0x2b')]=_[_0xb812('0x27')](_0x4b7c2a,_0xb812('0x25'));_0x354fbd['query']=_[_0xb812('0x2c')](_0x3f8a7c['query']);_0x354fbd[_0xb812('0x2d')]=_['intersection'](_0x354fbd[_0xb812('0x2b')],_0x354fbd['query']);_0x16291c['attributes']=_[_0xb812('0x2e')](_0x354fbd['model'],qs[_0xb812('0x2f')](_0x3f8a7c['query']['fields']));_0x16291c[_0xb812('0x30')]=_0x16291c[_0xb812('0x30')][_0xb812('0x31')]?_0x16291c[_0xb812('0x30')]:_0x354fbd[_0xb812('0x2b')];if(!_0x3f8a7c[_0xb812('0x32')][_0xb812('0x33')]('nolimit')){_0x16291c['limit']=qs[_0xb812('0x1c')](_0x3f8a7c[_0xb812('0x32')]['limit']);_0x16291c[_0xb812('0x1a')]=qs[_0xb812('0x1a')](_0x3f8a7c[_0xb812('0x32')][_0xb812('0x1a')]);}_0x16291c[_0xb812('0x34')]=qs[_0xb812('0x35')](_0x3f8a7c[_0xb812('0x32')][_0xb812('0x35')]);_0x16291c[_0xb812('0x36')]=qs[_0xb812('0x2d')](_['pick'](_0x3f8a7c[_0xb812('0x32')],_0x354fbd['filters']),_0x4b7c2a);if(_0x3f8a7c[_0xb812('0x32')][_0xb812('0x37')]){_0x16291c['where']=_['merge'](_0x16291c[_0xb812('0x36')],{'$or':_[_0xb812('0x27')](_0x4b7c2a,function(_0x43da7c){if(_0x43da7c['type']!==_0xb812('0x38')){var _0x408243={};_0x408243[_0x43da7c[_0xb812('0x25')]]={'$like':'%'+_0x3f8a7c[_0xb812('0x32')]['filter']+'%'};return _0x408243;}})});}_0x16291c=_[_0xb812('0x39')]({},_0x16291c,_0x3f8a7c['options']);var _0x4c9aad={'where':_0x16291c[_0xb812('0x36')]};return db[_0xb812('0x28')]['count'](_0x4c9aad)[_0xb812('0x21')](function(_0x3a4e23){_0xa4a625['count']=_0x3a4e23;if(_0x3f8a7c[_0xb812('0x32')][_0xb812('0x3a')]){_0x16291c[_0xb812('0x3b')]=[{'all':!![]}];}return db[_0xb812('0x28')][_0xb812('0x3c')](_0x16291c);})[_0xb812('0x21')](function(_0x1b3eae){_0xa4a625['rows']=_0x1b3eae;return _0xa4a625;})['then'](respondWithFilteredResult(_0x385e20,_0x16291c))[_0xb812('0x3d')](handleError(_0x385e20,null));};exports[_0xb812('0x3e')]=function(_0x1e3e77,_0x145c39){var _0x26746f={'raw':!![],'where':{'id':_0x1e3e77[_0xb812('0x3f')]['id']}},_0x2d5670={};_0x2d5670[_0xb812('0x2b')]=_['keys'](db['VoiceQueuesLog'][_0xb812('0x40')]);_0x2d5670[_0xb812('0x32')]=_[_0xb812('0x2c')](_0x1e3e77[_0xb812('0x32')]);_0x2d5670['filters']=_[_0xb812('0x2e')](_0x2d5670[_0xb812('0x2b')],_0x2d5670[_0xb812('0x32')]);_0x26746f[_0xb812('0x30')]=_[_0xb812('0x2e')](_0x2d5670[_0xb812('0x2b')],qs['fields'](_0x1e3e77[_0xb812('0x32')][_0xb812('0x2f')]));_0x26746f[_0xb812('0x30')]=_0x26746f['attributes'][_0xb812('0x31')]?_0x26746f[_0xb812('0x30')]:_0x2d5670['model'];if(_0x1e3e77['query'][_0xb812('0x3a')]){_0x26746f[_0xb812('0x3b')]=[{'all':!![]}];}_0x26746f=_[_0xb812('0x39')]({},_0x26746f,_0x1e3e77['options']);return db[_0xb812('0x28')][_0xb812('0x41')](_0x26746f)[_0xb812('0x21')](handleEntityNotFound(_0x145c39,null))[_0xb812('0x21')](respondWithResult(_0x145c39,null))[_0xb812('0x3d')](handleError(_0x145c39,null));};exports[_0xb812('0x42')]=function(_0x58a416,_0x151440){return db[_0xb812('0x28')]['create'](_0x58a416[_0xb812('0x43')],{})[_0xb812('0x21')](respondWithResult(_0x151440,0xc9))[_0xb812('0x3d')](handleError(_0x151440,null));};exports[_0xb812('0x20')]=function(_0x10896a,_0x512b27){if(_0x10896a['body']['id']){delete _0x10896a[_0xb812('0x43')]['id'];}return db['VoiceQueuesLog'][_0xb812('0x41')]({'where':{'id':_0x10896a[_0xb812('0x3f')]['id']}})[_0xb812('0x21')](handleEntityNotFound(_0x512b27,null))[_0xb812('0x21')](saveUpdates(_0x10896a[_0xb812('0x43')],null))[_0xb812('0x21')](respondWithResult(_0x512b27,null))[_0xb812('0x3d')](handleError(_0x512b27,null));};exports[_0xb812('0x22')]=function(_0x2846ff,_0x41b7ec){return db[_0xb812('0x28')][_0xb812('0x41')]({'where':{'id':_0x2846ff[_0xb812('0x3f')]['id']}})[_0xb812('0x21')](handleEntityNotFound(_0x41b7ec,null))[_0xb812('0x21')](removeEntity(_0x41b7ec,null))[_0xb812('0x3d')](handleError(_0x41b7ec,null));}; \ No newline at end of file +var _0x1b84=['then','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','includeAll','options','find','create','body','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy'];(function(_0x3a04f9,_0x131c24){var _0x58d308=function(_0x5b42cf){while(--_0x5b42cf){_0x3a04f9['push'](_0x3a04f9['shift']());}};_0x58d308(++_0x131c24);}(_0x1b84,0x151));var _0x41b8=function(_0x4c057b,_0xc46f08){_0x4c057b=_0x4c057b-0x0;var _0x5497b0=_0x1b84[_0x4c057b];return _0x5497b0;};'use strict';var emlformat=require(_0x41b8('0x0'));var rimraf=require(_0x41b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41b8('0x2'));var rp=require(_0x41b8('0x3'));var moment=require(_0x41b8('0x4'));var BPromise=require(_0x41b8('0x5'));var Mustache=require(_0x41b8('0x6'));var util=require(_0x41b8('0x7'));var path=require(_0x41b8('0x8'));var sox=require(_0x41b8('0x9'));var csv=require(_0x41b8('0xa'));var ejs=require(_0x41b8('0xb'));var fs=require('fs');var fs_extra=require(_0x41b8('0xc'));var _=require(_0x41b8('0xd'));var squel=require('squel');var crypto=require(_0x41b8('0xe'));var jsforce=require(_0x41b8('0xf'));var deskjs=require(_0x41b8('0x10'));var toCsv=require(_0x41b8('0xa'));var querystring=require('querystring');var Papa=require(_0x41b8('0x11'));var Redis=require(_0x41b8('0x12'));var authService=require(_0x41b8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x41b8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x41b8('0x15'))(_0x41b8('0x16'));var utils=require('../../config/utils');var config=require(_0x41b8('0x17'));var licenseUtil=require(_0x41b8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ced65,_0x4e247e){_0x4e247e=_0x4e247e||0xcc;return function(_0x3c123b){if(_0x3c123b){return _0x1ced65[_0x41b8('0x19')](_0x4e247e);}return _0x1ced65[_0x41b8('0x1a')](_0x4e247e)[_0x41b8('0x1b')]();};}function respondWithResult(_0x6c47e,_0x1eaa13){_0x1eaa13=_0x1eaa13||0xc8;return function(_0x417b7d){if(_0x417b7d){return _0x6c47e['status'](_0x1eaa13)[_0x41b8('0x1c')](_0x417b7d);}};}function respondWithFilteredResult(_0x10c005,_0x4a5454){return function(_0xeb061d){if(_0xeb061d){var _0x2b7f49=typeof _0x4a5454[_0x41b8('0x1d')]===_0x41b8('0x1e')&&typeof _0x4a5454[_0x41b8('0x1f')]===_0x41b8('0x1e');var _0x121370=_0xeb061d[_0x41b8('0x20')];var _0x5abc23=_0x2b7f49?0x0:_0x4a5454[_0x41b8('0x1d')];var _0x57f173=_0x2b7f49?_0xeb061d[_0x41b8('0x20')]:_0x4a5454[_0x41b8('0x1d')]+_0x4a5454[_0x41b8('0x1f')];var _0x211adf;if(_0x57f173>=_0x121370){_0x57f173=_0x121370;_0x211adf=0xc8;}else{_0x211adf=0xce;}_0x10c005['status'](_0x211adf);return _0x10c005[_0x41b8('0x21')](_0x41b8('0x22'),_0x5abc23+'-'+_0x57f173+'/'+_0x121370)['json'](_0xeb061d);}return null;};}function patchUpdates(_0x25ec32){return function(_0x5048c5){try{jsonpatch['apply'](_0x5048c5,_0x25ec32,!![]);}catch(_0x5664fa){return BPromise[_0x41b8('0x23')](_0x5664fa);}return _0x5048c5['save']();};}function saveUpdates(_0x470e96,_0x3b773c){return function(_0x8dc0eb){if(_0x8dc0eb){return _0x8dc0eb[_0x41b8('0x24')](_0x470e96)['then'](function(_0x2b0f79){return _0x2b0f79;});}return null;};}function removeEntity(_0x586ffa,_0x39d3d0){return function(_0x24609d){if(_0x24609d){return _0x24609d[_0x41b8('0x25')]()[_0x41b8('0x26')](function(){_0x586ffa[_0x41b8('0x1a')](0xcc)[_0x41b8('0x1b')]();});}};}function handleEntityNotFound(_0x43299b,_0x41865d){return function(_0x1855db){if(!_0x1855db){_0x43299b[_0x41b8('0x19')](0x194);}return _0x1855db;};}function handleError(_0x1cc1ae,_0x566b61){_0x566b61=_0x566b61||0x1f4;return function(_0x28b004){logger[_0x41b8('0x27')](_0x28b004['stack']);if(_0x28b004[_0x41b8('0x28')]){delete _0x28b004[_0x41b8('0x28')];}_0x1cc1ae[_0x41b8('0x1a')](_0x566b61)[_0x41b8('0x29')](_0x28b004);};}exports[_0x41b8('0x2a')]=function(_0x3b879d,_0x46f06){var _0x4a6677={},_0x3fc9dd={},_0x5df248={'count':0x0,'rows':[]};var _0x188c6f=_[_0x41b8('0x2b')](db[_0x41b8('0x2c')][_0x41b8('0x2d')],function(_0x3a546c){return{'name':_0x3a546c[_0x41b8('0x2e')],'type':_0x3a546c[_0x41b8('0x2f')][_0x41b8('0x30')]};});_0x3fc9dd[_0x41b8('0x31')]=_[_0x41b8('0x2b')](_0x188c6f,_0x41b8('0x28'));_0x3fc9dd[_0x41b8('0x32')]=_[_0x41b8('0x33')](_0x3b879d[_0x41b8('0x32')]);_0x3fc9dd[_0x41b8('0x34')]=_[_0x41b8('0x35')](_0x3fc9dd[_0x41b8('0x31')],_0x3fc9dd[_0x41b8('0x32')]);_0x4a6677[_0x41b8('0x36')]=_['intersection'](_0x3fc9dd[_0x41b8('0x31')],qs['fields'](_0x3b879d[_0x41b8('0x32')][_0x41b8('0x37')]));_0x4a6677[_0x41b8('0x36')]=_0x4a6677[_0x41b8('0x36')][_0x41b8('0x38')]?_0x4a6677[_0x41b8('0x36')]:_0x3fc9dd[_0x41b8('0x31')];if(!_0x3b879d[_0x41b8('0x32')]['hasOwnProperty'](_0x41b8('0x39'))){_0x4a6677[_0x41b8('0x1f')]=qs[_0x41b8('0x1f')](_0x3b879d[_0x41b8('0x32')][_0x41b8('0x1f')]);_0x4a6677[_0x41b8('0x1d')]=qs['offset'](_0x3b879d[_0x41b8('0x32')]['offset']);}_0x4a6677[_0x41b8('0x3a')]=qs[_0x41b8('0x3b')](_0x3b879d[_0x41b8('0x32')][_0x41b8('0x3b')]);_0x4a6677[_0x41b8('0x3c')]=qs[_0x41b8('0x34')](_[_0x41b8('0x3d')](_0x3b879d[_0x41b8('0x32')],_0x3fc9dd[_0x41b8('0x34')]),_0x188c6f);if(_0x3b879d['query'][_0x41b8('0x3e')]){_0x4a6677[_0x41b8('0x3c')]=_[_0x41b8('0x3f')](_0x4a6677[_0x41b8('0x3c')],{'$or':_['map'](_0x188c6f,function(_0x15fbdc){if(_0x15fbdc[_0x41b8('0x2f')]!==_0x41b8('0x40')){var _0x43fb89={};_0x43fb89[_0x15fbdc['name']]={'$like':'%'+_0x3b879d['query'][_0x41b8('0x3e')]+'%'};return _0x43fb89;}})});}_0x4a6677=_[_0x41b8('0x3f')]({},_0x4a6677,_0x3b879d['options']);var _0x2ac25c={'where':_0x4a6677['where']};return db['VoiceQueuesLog'][_0x41b8('0x20')](_0x2ac25c)['then'](function(_0x54843c){_0x5df248[_0x41b8('0x20')]=_0x54843c;if(_0x3b879d[_0x41b8('0x32')]['includeAll']){_0x4a6677[_0x41b8('0x41')]=[{'all':!![]}];}return db[_0x41b8('0x2c')][_0x41b8('0x42')](_0x4a6677);})[_0x41b8('0x26')](function(_0xbd687d){_0x5df248[_0x41b8('0x43')]=_0xbd687d;return _0x5df248;})[_0x41b8('0x26')](respondWithFilteredResult(_0x46f06,_0x4a6677))['catch'](handleError(_0x46f06,null));};exports[_0x41b8('0x44')]=function(_0x59e17c,_0x3ae7b8){var _0x44c7e4={'raw':!![],'where':{'id':_0x59e17c['params']['id']}},_0x491fff={};_0x491fff[_0x41b8('0x31')]=_[_0x41b8('0x33')](db['VoiceQueuesLog'][_0x41b8('0x2d')]);_0x491fff['query']=_[_0x41b8('0x33')](_0x59e17c['query']);_0x491fff['filters']=_[_0x41b8('0x35')](_0x491fff[_0x41b8('0x31')],_0x491fff[_0x41b8('0x32')]);_0x44c7e4[_0x41b8('0x36')]=_['intersection'](_0x491fff[_0x41b8('0x31')],qs['fields'](_0x59e17c[_0x41b8('0x32')][_0x41b8('0x37')]));_0x44c7e4[_0x41b8('0x36')]=_0x44c7e4[_0x41b8('0x36')][_0x41b8('0x38')]?_0x44c7e4[_0x41b8('0x36')]:_0x491fff[_0x41b8('0x31')];if(_0x59e17c[_0x41b8('0x32')][_0x41b8('0x45')]){_0x44c7e4[_0x41b8('0x41')]=[{'all':!![]}];}_0x44c7e4=_[_0x41b8('0x3f')]({},_0x44c7e4,_0x59e17c[_0x41b8('0x46')]);return db[_0x41b8('0x2c')][_0x41b8('0x47')](_0x44c7e4)[_0x41b8('0x26')](handleEntityNotFound(_0x3ae7b8,null))['then'](respondWithResult(_0x3ae7b8,null))['catch'](handleError(_0x3ae7b8,null));};exports['create']=function(_0x502a71,_0x433f8a){return db[_0x41b8('0x2c')][_0x41b8('0x48')](_0x502a71[_0x41b8('0x49')],{})[_0x41b8('0x26')](respondWithResult(_0x433f8a,0xc9))[_0x41b8('0x4a')](handleError(_0x433f8a,null));};exports[_0x41b8('0x24')]=function(_0x17b0c2,_0x2247ce){if(_0x17b0c2['body']['id']){delete _0x17b0c2[_0x41b8('0x49')]['id'];}return db[_0x41b8('0x2c')]['find']({'where':{'id':_0x17b0c2['params']['id']}})[_0x41b8('0x26')](handleEntityNotFound(_0x2247ce,null))[_0x41b8('0x26')](saveUpdates(_0x17b0c2[_0x41b8('0x49')],null))['then'](respondWithResult(_0x2247ce,null))[_0x41b8('0x4a')](handleError(_0x2247ce,null));};exports['destroy']=function(_0x545949,_0x3304d0){return db[_0x41b8('0x2c')][_0x41b8('0x47')]({'where':{'id':_0x545949['params']['id']}})[_0x41b8('0x26')](handleEntityNotFound(_0x3304d0,null))[_0x41b8('0x26')](removeEntity(_0x3304d0,null))[_0x41b8('0x4a')](handleError(_0x3304d0,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 817fffd..39133ba 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 _0x7a59=['define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x7a59,0x16e));var _0x97a5=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x7a59[_0x40b3f2];return _0x4ce90c;};'use strict';var _=require(_0x97a5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x97a5('0x1'));var moment=require(_0x97a5('0x2'));var BPromise=require(_0x97a5('0x3'));var rp=require(_0x97a5('0x4'));var fs=require('fs');var path=require(_0x97a5('0x5'));var rimraf=require('rimraf');var config=require(_0x97a5('0x6'));var attributes=require(_0x97a5('0x7'));module[_0x97a5('0x8')]=function(_0x48201b,_0x438520){return _0x48201b[_0x97a5('0x9')](_0x97a5('0xa'),attributes,{'tableName':_0x97a5('0xb'),'paranoid':![],'indexes':[{'name':_0x97a5('0xc'),'fields':[_0x97a5('0xd'),_0x97a5('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x01e7=['request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event','lodash','api'];(function(_0x21cf8f,_0x3996c8){var _0x2700bf=function(_0x19a492){while(--_0x19a492){_0x21cf8f['push'](_0x21cf8f['shift']());}};_0x2700bf(++_0x3996c8);}(_0x01e7,0x134));var _0x701e=function(_0x5f4153,_0x20a5be){_0x5f4153=_0x5f4153-0x0;var _0x44236e=_0x01e7[_0x5f4153];return _0x44236e;};'use strict';var _=require(_0x701e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x701e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x701e('0x2'));var fs=require('fs');var path=require(_0x701e('0x3'));var rimraf=require(_0x701e('0x4'));var config=require('../../config/environment');var attributes=require(_0x701e('0x5'));module[_0x701e('0x6')]=function(_0x415875,_0x16235b){return _0x415875['define'](_0x701e('0x7'),attributes,{'tableName':_0x701e('0x8'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x701e('0x9'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index b5eaab2..e352ffc 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 _0xf4eb=['VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2fca92,_0x42aa4f){var _0x3138c7=function(_0x19f425){while(--_0x19f425){_0x2fca92['push'](_0x2fca92['shift']());}};_0x3138c7(++_0x42aa4f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x37b87f,_0x3c677d){_0x37b87f=_0x37b87f-0x0;var _0x2c5edd=_0xf4eb[_0x37b87f];return _0x2c5edd;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xd9cc=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x1e061d,_0x28c134){var _0x472f97=function(_0x27a0a9){while(--_0x27a0a9){_0x1e061d['push'](_0x1e061d['shift']());}};_0x472f97(++_0x28c134);}(_0xd9cc,0x1e1));var _0xcd9c=function(_0x39f591,_0x264187){_0x39f591=_0x39f591-0x0;var _0x551627=_0xd9cc[_0x39f591];return _0x551627;};'use strict';var _=require(_0xcd9c('0x0'));var util=require(_0xcd9c('0x1'));var moment=require(_0xcd9c('0x2'));var BPromise=require(_0xcd9c('0x3'));var rs=require(_0xcd9c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd9c('0x5'))['db'];var utils=require(_0xcd9c('0x6'));var logger=require(_0xcd9c('0x7'))('rpc');var config=require(_0xcd9c('0x8'));var jayson=require(_0xcd9c('0x9'));var client=jayson['client'][_0xcd9c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a9c7a,_0x15c37c,_0x245c95){return new BPromise(function(_0x598a78,_0x2e62c5){return client['request'](_0x2a9c7a,_0x245c95)[_0xcd9c('0xb')](function(_0x21ecd4){logger[_0xcd9c('0xc')](_0xcd9c('0xd'),_0x15c37c,_0xcd9c('0xe'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x15c37c,_0xcd9c('0xe'),JSON[_0xcd9c('0xf')](_0x21ecd4));if(_0x21ecd4[_0xcd9c('0x10')]){if(_0x21ecd4['error'][_0xcd9c('0x11')]===0x1f4){logger[_0xcd9c('0x10')](_0xcd9c('0xd'),_0x15c37c,_0x21ecd4['error'][_0xcd9c('0x12')]);return _0x2e62c5(_0x21ecd4[_0xcd9c('0x10')][_0xcd9c('0x12')]);}logger[_0xcd9c('0x10')](_0xcd9c('0xd'),_0x15c37c,_0x21ecd4['error']['message']);return _0x598a78(_0x21ecd4[_0xcd9c('0x10')][_0xcd9c('0x12')]);}else{logger[_0xcd9c('0xc')](_0xcd9c('0xd'),_0x15c37c,_0xcd9c('0xe'));_0x598a78(_0x21ecd4[_0xcd9c('0x13')][_0xcd9c('0x12')]);}})[_0xcd9c('0x14')](function(_0x793f5f){logger[_0xcd9c('0x10')](_0xcd9c('0xd'),_0x15c37c,_0x793f5f);_0x2e62c5(_0x793f5f);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 2e13447..0ea99ce 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 _0x1286=['/:id','show','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','describe'];(function(_0x13cfc,_0x2c87a8){var _0x132b22=function(_0x19a281){while(--_0x19a281){_0x13cfc['push'](_0x13cfc['shift']());}};_0x132b22(++_0x2c87a8);}(_0x1286,0x75));var _0x6128=function(_0x112fe3,_0x16b642){_0x112fe3=_0x112fe3-0x0;var _0x1ec903=_0x1286[_0x112fe3];return _0x1ec903;};'use strict';var multer=require(_0x6128('0x0'));var util=require(_0x6128('0x1'));var path=require(_0x6128('0x2'));var timeout=require(_0x6128('0x3'));var express=require('express');var router=express[_0x6128('0x4')]();var fs_extra=require(_0x6128('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6128('0x6'));var config=require(_0x6128('0x7'));var controller=require(_0x6128('0x8'));router[_0x6128('0x9')]('/',auth[_0x6128('0xa')](),controller[_0x6128('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x6128('0xc')]);router[_0x6128('0x9')](_0x6128('0xd'),auth[_0x6128('0xa')](),controller[_0x6128('0xe')]);router['get'](_0x6128('0xf'),auth[_0x6128('0xa')](),controller[_0x6128('0x10')]);router['get'](_0x6128('0x11'),controller['downloads']);router[_0x6128('0x9')]('/:id/transcribe',auth[_0x6128('0xa')](),controller[_0x6128('0x12')]);router[_0x6128('0x13')]('/',auth[_0x6128('0xa')](),controller[_0x6128('0x14')]);router['post']('/:id/transcribe',auth[_0x6128('0xa')](),controller['runTranscribe']);router[_0x6128('0x15')](_0x6128('0xd'),auth[_0x6128('0xa')](),controller[_0x6128('0x16')]);router[_0x6128('0x17')](_0x6128('0xd'),auth[_0x6128('0xa')](),controller[_0x6128('0x18')]);module[_0x6128('0x19')]=router; \ No newline at end of file +var _0x4e40=['/:id/downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','/:id','exports','express','Router','fs-extra','../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','show','/:id/download','download'];(function(_0x330ae0,_0x33a050){var _0x165047=function(_0x4bdcff){while(--_0x4bdcff){_0x330ae0['push'](_0x330ae0['shift']());}};_0x165047(++_0x33a050);}(_0x4e40,0x148));var _0x04e4=function(_0x4cf874,_0x1a04a5){_0x4cf874=_0x4cf874-0x0;var _0x34c2b2=_0x4e40[_0x4cf874];return _0x34c2b2;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x04e4('0x0'));var router=express[_0x04e4('0x1')]();var fs_extra=require(_0x04e4('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x04e4('0x3'));var controller=require(_0x04e4('0x4'));router[_0x04e4('0x5')]('/',auth['isAuthenticated'](),controller[_0x04e4('0x6')]);router['get'](_0x04e4('0x7'),auth[_0x04e4('0x8')](),controller['describe']);router['get']('/:id',auth[_0x04e4('0x8')](),controller[_0x04e4('0x9')]);router[_0x04e4('0x5')](_0x04e4('0xa'),auth['isAuthenticated'](),controller[_0x04e4('0xb')]);router[_0x04e4('0x5')](_0x04e4('0xc'),controller['downloads']);router[_0x04e4('0x5')](_0x04e4('0xd'),auth['isAuthenticated'](),controller[_0x04e4('0xe')]);router[_0x04e4('0xf')]('/',auth[_0x04e4('0x8')](),controller['create']);router[_0x04e4('0xf')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x04e4('0x10')]);router[_0x04e4('0x11')]('/:id',auth[_0x04e4('0x8')](),controller['update']);router['delete'](_0x04e4('0x12'),auth[_0x04e4('0x8')](),controller['destroy']);module[_0x04e4('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 30f1fe9..b177c8a 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(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 5bcabbc..c737fcc 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 _0xd7ff=['send','index','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','../../components/encryptor','uniqueid','value','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','$and','push','%s.cypher','secrets','download','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','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','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../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','Content-Range','apply','reject','save','update','destroy','then','error','stack','name'];(function(_0xc1244c,_0x54990a){var _0x2a2b68=function(_0x5d2b21){while(--_0x5d2b21){_0xc1244c['push'](_0xc1244c['shift']());}};_0x2a2b68(++_0x54990a);}(_0xd7ff,0x6f));var _0xfd7f=function(_0x2fee1e,_0x5ccae6){_0x2fee1e=_0x2fee1e-0x0;var _0x5028ad=_0xd7ff[_0x2fee1e];return _0x5028ad;};'use strict';var emlformat=require(_0xfd7f('0x0'));var rimraf=require(_0xfd7f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd7f('0x2'));var rp=require(_0xfd7f('0x3'));var moment=require(_0xfd7f('0x4'));var BPromise=require(_0xfd7f('0x5'));var Mustache=require(_0xfd7f('0x6'));var util=require('util');var path=require(_0xfd7f('0x7'));var sox=require(_0xfd7f('0x8'));var csv=require(_0xfd7f('0x9'));var ejs=require(_0xfd7f('0xa'));var fs=require('fs');var fs_extra=require(_0xfd7f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfd7f('0xc'));var jsforce=require(_0xfd7f('0xd'));var deskjs=require(_0xfd7f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfd7f('0xf'));var Papa=require(_0xfd7f('0x10'));var AWS=require(_0xfd7f('0x11'));var uuidv4=require(_0xfd7f('0x12'));var Redis=require('ioredis');var authService=require(_0xfd7f('0x13'));var qs=require(_0xfd7f('0x14'));var as=require(_0xfd7f('0x15'));var hardwareService=require(_0xfd7f('0x16'));var logger=require(_0xfd7f('0x17'))(_0xfd7f('0x18'));var utils=require(_0xfd7f('0x19'));var config=require(_0xfd7f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd7f('0x1b'))['db'];function respondWithStatusCode(_0x252561,_0xed4b2d){_0xed4b2d=_0xed4b2d||0xcc;return function(_0x43cdaf){if(_0x43cdaf){return _0x252561[_0xfd7f('0x1c')](_0xed4b2d);}return _0x252561[_0xfd7f('0x1d')](_0xed4b2d)[_0xfd7f('0x1e')]();};}function respondWithResult(_0x31a787,_0x52b888){_0x52b888=_0x52b888||0xc8;return function(_0x1c1fad){if(_0x1c1fad){return _0x31a787[_0xfd7f('0x1d')](_0x52b888)[_0xfd7f('0x1f')](_0x1c1fad);}};}function respondWithFilteredResult(_0xbd54a1,_0x5029e4){return function(_0x599bd7){if(_0x599bd7){var _0x38acad=typeof _0x5029e4[_0xfd7f('0x20')]===_0xfd7f('0x21')&&typeof _0x5029e4[_0xfd7f('0x22')]===_0xfd7f('0x21');var _0x1ff64=_0x599bd7[_0xfd7f('0x23')];var _0x49204a=_0x38acad?0x0:_0x5029e4[_0xfd7f('0x20')];var _0x3c2878=_0x38acad?_0x599bd7['count']:_0x5029e4[_0xfd7f('0x20')]+_0x5029e4[_0xfd7f('0x22')];var _0x60fb54;if(_0x3c2878>=_0x1ff64){_0x3c2878=_0x1ff64;_0x60fb54=0xc8;}else{_0x60fb54=0xce;}_0xbd54a1[_0xfd7f('0x1d')](_0x60fb54);return _0xbd54a1[_0xfd7f('0x24')](_0xfd7f('0x25'),_0x49204a+'-'+_0x3c2878+'/'+_0x1ff64)['json'](_0x599bd7);}return null;};}function patchUpdates(_0x584b39){return function(_0x4beda5){try{jsonpatch[_0xfd7f('0x26')](_0x4beda5,_0x584b39,!![]);}catch(_0x12154c){return BPromise[_0xfd7f('0x27')](_0x12154c);}return _0x4beda5[_0xfd7f('0x28')]();};}function saveUpdates(_0x3a2979,_0x24a3d3){return function(_0x5dcb9a){if(_0x5dcb9a){return _0x5dcb9a[_0xfd7f('0x29')](_0x3a2979)['then'](function(_0x41f892){return _0x41f892;});}return null;};}function removeEntity(_0x58982c,_0x3ddef6){return function(_0x52da8b){if(_0x52da8b){return _0x52da8b[_0xfd7f('0x2a')]()[_0xfd7f('0x2b')](function(){_0x58982c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a270d,_0xe68a73){return function(_0x462f3c){if(!_0x462f3c){_0x2a270d[_0xfd7f('0x1c')](0x194);}return _0x462f3c;};}function handleError(_0x5df6eb,_0x46efdb){_0x46efdb=_0x46efdb||0x1f4;return function(_0x3fe8e0){logger[_0xfd7f('0x2c')](_0x3fe8e0[_0xfd7f('0x2d')]);if(_0x3fe8e0[_0xfd7f('0x2e')]){delete _0x3fe8e0['name'];}_0x5df6eb[_0xfd7f('0x1d')](_0x46efdb)[_0xfd7f('0x2f')](_0x3fe8e0);};}exports[_0xfd7f('0x30')]=function(_0x18d094,_0x23cebb){var _0x488976={},_0x206566={},_0x1a9d69={'count':0x0,'rows':[]};var _0x6865fd=_['map'](db[_0xfd7f('0x31')][_0xfd7f('0x32')],function(_0x3e567e){return{'name':_0x3e567e[_0xfd7f('0x33')],'type':_0x3e567e[_0xfd7f('0x34')][_0xfd7f('0x35')]};});_0x206566['model']=_[_0xfd7f('0x36')](_['map'](_0x6865fd,'name'),[_0xfd7f('0x37')]);_0x206566[_0xfd7f('0x38')]=_[_0xfd7f('0x39')](_0x18d094['query']);_0x206566[_0xfd7f('0x3a')]=_[_0xfd7f('0x3b')](_0x206566[_0xfd7f('0x3c')],_0x206566[_0xfd7f('0x38')]);_0x488976['attributes']=_[_0xfd7f('0x3b')](_0x206566[_0xfd7f('0x3c')],qs[_0xfd7f('0x3d')](_0x18d094[_0xfd7f('0x38')][_0xfd7f('0x3d')]));_0x488976[_0xfd7f('0x3e')]=_0x488976[_0xfd7f('0x3e')][_0xfd7f('0x3f')]?_0x488976[_0xfd7f('0x3e')]:_0x206566[_0xfd7f('0x3c')];if(!_0x18d094['query'][_0xfd7f('0x40')](_0xfd7f('0x41'))){_0x488976[_0xfd7f('0x22')]=qs[_0xfd7f('0x22')](_0x18d094[_0xfd7f('0x38')][_0xfd7f('0x22')]);_0x488976[_0xfd7f('0x20')]=qs[_0xfd7f('0x20')](_0x18d094[_0xfd7f('0x38')][_0xfd7f('0x20')]);}_0x488976[_0xfd7f('0x42')]=qs[_0xfd7f('0x43')](_0x18d094['query'][_0xfd7f('0x43')]);_0x488976[_0xfd7f('0x44')]=qs[_0xfd7f('0x3a')](_[_0xfd7f('0x45')](_0x18d094[_0xfd7f('0x38')],_0x206566[_0xfd7f('0x3a')]),_0x6865fd);if(_0x18d094[_0xfd7f('0x38')][_0xfd7f('0x46')]){_0x488976[_0xfd7f('0x44')]=_[_0xfd7f('0x47')](_0x488976['where'],{'$or':_[_0xfd7f('0x48')](_0x6865fd,function(_0x51478){if(_0x51478[_0xfd7f('0x34')]!=='VIRTUAL'){var _0x23eff7={};_0x23eff7[_0x51478['name']]={'$like':'%'+_0x18d094['query'][_0xfd7f('0x46')]+'%'};return _0x23eff7;}})});}_0x488976=_['merge']({},_0x488976,_0x18d094[_0xfd7f('0x49')]);var _0x2682a0={'where':_0x488976['where']};return db[_0xfd7f('0x31')][_0xfd7f('0x23')](_0x2682a0)[_0xfd7f('0x2b')](function(_0x1084d0){_0x1a9d69['count']=_0x1084d0;if(_0x18d094['query'][_0xfd7f('0x4a')]){_0x488976[_0xfd7f('0x4b')]=[{'all':!![]}];}return db['VoiceRecording'][_0xfd7f('0x4c')](_0x488976);})['then'](function(_0x18316f){_0x1a9d69[_0xfd7f('0x4d')]=_0x18316f;return _0x1a9d69;})['then'](respondWithFilteredResult(_0x23cebb,_0x488976))[_0xfd7f('0x4e')](handleError(_0x23cebb,null));};exports[_0xfd7f('0x4f')]=function(_0x4c374d,_0x3c464e){var _0x5a34dc={'raw':![],'where':{'id':_0x4c374d[_0xfd7f('0x50')]['id']}},_0x5ba356={};_0x5ba356['model']=_['keys'](db[_0xfd7f('0x31')]['rawAttributes']);_0x5ba356[_0xfd7f('0x38')]=_['keys'](_0x4c374d[_0xfd7f('0x38')]);_0x5ba356[_0xfd7f('0x3a')]=_[_0xfd7f('0x3b')](_0x5ba356[_0xfd7f('0x3c')],_0x5ba356[_0xfd7f('0x38')]);_0x5a34dc[_0xfd7f('0x3e')]=_['intersection'](_0x5ba356[_0xfd7f('0x3c')],qs[_0xfd7f('0x3d')](_0x4c374d['query'][_0xfd7f('0x3d')]));_0x5a34dc[_0xfd7f('0x3e')]=_0x5a34dc['attributes'][_0xfd7f('0x3f')]?_0x5a34dc[_0xfd7f('0x3e')]:_0x5ba356[_0xfd7f('0x3c')];if(_0x4c374d[_0xfd7f('0x38')][_0xfd7f('0x4a')]){_0x5a34dc['include']=[{'all':!![]}];}_0x5a34dc=_[_0xfd7f('0x47')]({},_0x5a34dc,_0x4c374d[_0xfd7f('0x49')]);return db['VoiceRecording'][_0xfd7f('0x51')](_0x5a34dc)['then'](handleEntityNotFound(_0x3c464e,null))['then'](respondWithResult(_0x3c464e,null))[_0xfd7f('0x4e')](handleError(_0x3c464e,null));};exports[_0xfd7f('0x52')]=function(_0x9fea5b,_0x5f57a9){return db[_0xfd7f('0x31')][_0xfd7f('0x52')](_0x9fea5b['body'],{})[_0xfd7f('0x2b')](respondWithResult(_0x5f57a9,0xc9))[_0xfd7f('0x4e')](handleError(_0x5f57a9,null));};exports[_0xfd7f('0x29')]=function(_0x1b4bd0,_0x3b1c74){if(_0x1b4bd0[_0xfd7f('0x53')]['id']){delete _0x1b4bd0[_0xfd7f('0x53')]['id'];}return db[_0xfd7f('0x31')][_0xfd7f('0x51')]({'where':{'id':_0x1b4bd0['params']['id']}})[_0xfd7f('0x2b')](handleEntityNotFound(_0x3b1c74,null))[_0xfd7f('0x2b')](saveUpdates(_0x1b4bd0[_0xfd7f('0x53')],null))[_0xfd7f('0x2b')](respondWithResult(_0x3b1c74,null))[_0xfd7f('0x4e')](handleError(_0x3b1c74,null));};exports[_0xfd7f('0x54')]=function(_0x4f9abe,_0x7f2331){return db[_0xfd7f('0x31')][_0xfd7f('0x54')]()['then'](respondWithResult(_0x7f2331,null))[_0xfd7f('0x4e')](handleError(_0x7f2331,null));};exports['download']=function(_0x1e1370,_0x55ccb4,_0x55c8f5){var _0x1d5029=require(_0xfd7f('0x55'));var _0x54db97=![];var _0x3e8396={};if(_0x1e1370[_0xfd7f('0x38')][_0xfd7f('0x34')]&&_0x1e1370[_0xfd7f('0x38')]['type']===_0xfd7f('0x56')){_0x3e8396[_0xfd7f('0x56')]=_0x1e1370['params']['id'];}else{_0x3e8396['id']=_0x1e1370[_0xfd7f('0x50')]['id'];}return db[_0xfd7f('0x31')][_0xfd7f('0x51')]({'where':_0x3e8396,'attributes':['id',_0xfd7f('0x57')],'raw':!![]})[_0xfd7f('0x2b')](handleEntityNotFound(_0x55ccb4,null))[_0xfd7f('0x2b')](function(_0x1d91aa){if(_0x1d91aa){var _0x2e14db=_0x1d91aa[_0xfd7f('0x57')];var _0x507bd7=util[_0xfd7f('0x37')]('%s.cypher',_0x2e14db);if(fs[_0xfd7f('0x58')](_0x507bd7)){_0x54db97=!![];return _0x1d5029[_0xfd7f('0x59')](_0x507bd7,_0x2e14db,config['secrets'][_0xfd7f('0x5a')])[_0xfd7f('0x2b')](function(){return _0x1d91aa;});}return _0x1d91aa;}})[_0xfd7f('0x2b')](function(_0x5d78f1){if(_0x5d78f1){var _0x26000b=_0x5d78f1['value'];if(!fs['existsSync'](_0x26000b)){throw new db[(_0xfd7f('0x5b'))][(_0xfd7f('0x5c'))](_0xfd7f('0x5d'));}if(_0x5d78f1[_0xfd7f('0x5e')]){return _0x55ccb4['download'](_0x26000b,_0x5d78f1[_0xfd7f('0x5e')]+path[_0xfd7f('0x5f')](_0x26000b),function(){if(_0x54db97){fs[_0xfd7f('0x60')](_0x26000b);}});}else{return _0x55ccb4['download'](_0x26000b,function(_0x257604){if(_0x54db97){fs[_0xfd7f('0x60')](_0x26000b);}});}}})[_0xfd7f('0x4e')](function(_0x59d852){if(_0x59d852[_0xfd7f('0x61')]==='VoiceRecording\x20not\x20found'){_0x55ccb4[_0xfd7f('0x1d')](0x194)[_0xfd7f('0x2f')](_0xfd7f('0x62'));}else{return handleError(_0x55ccb4,null);}});};exports[_0xfd7f('0x63')]=function(_0xa8b995,_0x11db8b,_0x424de3){var _0x5c412c=require(_0xfd7f('0x55'));var _0x2a7cbb=![];var _0x1ff5e9={'$and':[db['sequelize'][_0xfd7f('0x44')](db[_0xfd7f('0x64')]['fn'](_0xfd7f('0x65'),db[_0xfd7f('0x64')][_0xfd7f('0x66')](_0xfd7f('0x56'))),_0xa8b995[_0xfd7f('0x38')]['token'])]};if(_0xa8b995[_0xfd7f('0x38')][_0xfd7f('0x34')]&&_0xa8b995[_0xfd7f('0x38')]['type']===_0xfd7f('0x56')){_0x1ff5e9[_0xfd7f('0x67')][_0xfd7f('0x68')]({'uniqueid':_0xa8b995[_0xfd7f('0x50')]['id']});}else{_0x1ff5e9[_0xfd7f('0x67')][_0xfd7f('0x68')]({'id':_0xa8b995['params']['id']});}return db[_0xfd7f('0x31')][_0xfd7f('0x51')]({'where':_0x1ff5e9,'attributes':['id',_0xfd7f('0x57')],'raw':!![]})[_0xfd7f('0x2b')](handleEntityNotFound(_0x11db8b,null))[_0xfd7f('0x2b')](function(_0x28a6af){if(_0x28a6af){var _0x1731f4=util[_0xfd7f('0x37')](_0xfd7f('0x69'),_0x28a6af[_0xfd7f('0x57')]);if(fs['existsSync'](_0x1731f4)){_0x2a7cbb=!![];return _0x5c412c[_0xfd7f('0x59')](_0x1731f4,_0x28a6af[_0xfd7f('0x57')],config[_0xfd7f('0x6a')][_0xfd7f('0x5a')])[_0xfd7f('0x2b')](function(){return _0x28a6af;});}return _0x28a6af;}})[_0xfd7f('0x2b')](function(_0x3057cf){if(_0x3057cf){if(!fs[_0xfd7f('0x58')](_0x3057cf['value'])){throw new db['Sequelize'][(_0xfd7f('0x5c'))](_0xfd7f('0x5d'));}if(_0x3057cf[_0xfd7f('0x5e')]){return _0x11db8b['download'](_0x3057cf['value'],_0x3057cf[_0xfd7f('0x5e')]+path[_0xfd7f('0x5f')](_0x3057cf[_0xfd7f('0x57')]),function(){if(_0x2a7cbb){fs[_0xfd7f('0x60')](_0x3057cf['value']);}});}else{return _0x11db8b[_0xfd7f('0x6b')](_0x3057cf[_0xfd7f('0x57')],function(_0x2a1cbe){if(_0x2a7cbb){fs[_0xfd7f('0x60')](_0x3057cf[_0xfd7f('0x57')]);}});}}})[_0xfd7f('0x4e')](handleError(_0x11db8b,null));};exports[_0xfd7f('0x2a')]=function(_0x23f88d,_0x58dc7b){return db['VoiceRecording'][_0xfd7f('0x51')]({'where':{'id':_0x23f88d[_0xfd7f('0x50')]['id']}})['then'](function(_0x37d188){if(_[_0xfd7f('0x6c')](_0x37d188)){throw new ReferenceError(_0xfd7f('0x6d'));}return _0x37d188;})[_0xfd7f('0x2b')](function(_0x5ccf66){var _0x14f606=_0x5ccf66[_0xfd7f('0x57')];logger[_0xfd7f('0x6e')](_0xfd7f('0x6f'),_0x14f606);if(!_[_0xfd7f('0x6c')](_0x5ccf66[_0xfd7f('0x57')])&&fs[_0xfd7f('0x58')](_0x14f606)){logger[_0xfd7f('0x6e')](_0xfd7f('0x70')+_0x14f606+_0xfd7f('0x71'));fs[_0xfd7f('0x72')](_0x14f606);}_0x14f606=_0x14f606+_0xfd7f('0x73');if(!_['isNil'](_0x5ccf66['value'])&&fs['existsSync'](_0x14f606)){logger[_0xfd7f('0x6e')](_0xfd7f('0x70')+_0x14f606+_0xfd7f('0x71'));fs[_0xfd7f('0x72')](_0x14f606);}return _0x5ccf66;})[_0xfd7f('0x2b')](function(_0x40d368){if(!_0x40d368)throw new InternalError();return _0x40d368['destroy']();})[_0xfd7f('0x2b')](function(){_0x58dc7b['status'](0xcc)[_0xfd7f('0x1e')]();})[_0xfd7f('0x4e')](handleError(_0x58dc7b,null));};function getBucketslist(_0xa1c80b,_0x379dfa,_0x574937){return new Promise(function(_0xea9b52,_0x2e7b03){var _0xef595a=new AWS['S3']({'accessKeyId':_0x379dfa,'secretAccessKey':_0xa1c80b,'region':_0x574937});_0xef595a[_0xfd7f('0x74')]({},function(_0x50ce4a,_0x5c4c3c){if(_0x50ce4a){return _0x2e7b03(_0x50ce4a);}else{return _0xea9b52(_0x5c4c3c);}});});}function createBucket(_0x2ac350,_0x217c41,_0x13ee38,_0x3b98df){return new Promise(function(_0x113f8a,_0x243a37){var _0x2ebc6a=new AWS['S3']({'accessKeyId':_0x217c41,'secretAccessKey':_0x2ac350,'region':_0x13ee38});_0x2ebc6a['createBucket']({'Bucket':_0x3b98df},function(_0x1ce312,_0x43f12a){if(_0x1ce312){return _0x243a37(_0x1ce312);}else{return _0x113f8a(_0x43f12a);}});});}function uploadFile(_0x402986,_0x17773e,_0xabb736,_0x3ae81a,_0x15e1a4,_0x149b87){return new Promise(function(_0x49ce3a,_0x443f6a){var _0x24d9c9=new AWS['S3']({'accessKeyId':_0x17773e,'secretAccessKey':_0x402986,'region':_0xabb736});_0x24d9c9[_0xfd7f('0x75')]({'Bucket':_0x3ae81a,'Key':_0x15e1a4,'Body':_0x149b87},function(_0x544e25,_0xafd68a){if(_0x544e25){return _0x443f6a(_0x544e25);}else{return _0x49ce3a(_0xafd68a);}});});}function startTranscribe(_0x5b914d,_0x430a02,_0x252b50,_0x151d96,_0x5e8be7,_0x4dbb6c){return new Promise(function(_0x50210a,_0x50c70d){var _0x512074=new AWS['TranscribeService']({'accessKeyId':_0x430a02,'secretAccessKey':_0x5b914d,'region':_0x252b50});_0x512074['startTranscriptionJob']({'TranscriptionJobName':_0x151d96,'LanguageCode':_0x5e8be7,'Media':{'MediaFileUri':_0x4dbb6c}},function(_0x2673da,_0x2ace6f){if(_0x2673da){return _0x50c70d(_0x2673da);}else{return _0x50210a(_0x2ace6f);}});});}function transcribe(_0x4ee310,_0x970dae,_0x3f7296,_0x1deb08,_0x18ae66,_0xcb43ce,_0x3b815a){return new Promise(function(_0x16c82b,_0xac2df3){var _0x51b5d9={};logger[_0xfd7f('0x6e')](util[_0xfd7f('0x37')](_0xfd7f('0x76'),_0x4ee310,_0x18ae66));return uploadFile(_0x970dae,_0x3f7296,_0x1deb08,_0x18ae66,path[_0xfd7f('0x77')](_0xcb43ce),fs[_0xfd7f('0x78')](_0xcb43ce))['then'](function(_0x3611bd){logger[_0xfd7f('0x6e')](util[_0xfd7f('0x37')](_0xfd7f('0x79'),_0x4ee310,_0x18ae66,_0x3611bd[_0xfd7f('0x7a')]));_0x51b5d9[_0xfd7f('0x7b')]=_0x3611bd[_0xfd7f('0x7c')];_0x51b5d9[_0xfd7f('0x7d')]=_0x3611bd['Location'];logger['info'](util[_0xfd7f('0x37')](_0xfd7f('0x7e'),_0x4ee310));return startTranscribe(_0x970dae,_0x3f7296,_0x1deb08,uuidv4(),_0x3b815a,_0x3611bd[_0xfd7f('0x7a')]);})[_0xfd7f('0x2b')](function(_0xc76a70){logger[_0xfd7f('0x6e')](util[_0xfd7f('0x37')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x4ee310,_0xc76a70[_0xfd7f('0x7f')][_0xfd7f('0x80')]));_0x51b5d9[_0xfd7f('0x81')]=_0xc76a70[_0xfd7f('0x7f')]['TranscriptionJobName'];_0x51b5d9[_0xfd7f('0x82')]=_0xc76a70[_0xfd7f('0x7f')]['TranscriptionJobStatus'];return _0x16c82b(_0x51b5d9);})[_0xfd7f('0x4e')](function(_0x1fae22){return _0xac2df3(_0x1fae22);});});}exports['runTranscribe']=function(_0x5a69b4,_0x3bd551,_0x35b2e1){var _0x4de8bb;var _0x464fbe;var _0x5537ce;var _0x1a02a7=require(_0xfd7f('0x55'));return db[_0xfd7f('0x31')]['findOne']({'where':{'id':_0x5a69b4['params']['id']}})[_0xfd7f('0x2b')](function(_0x377c0b){if(_0x377c0b){var _0x7adc51=util[_0xfd7f('0x37')](_0xfd7f('0x69'),_0x377c0b[_0xfd7f('0x57')]);if(fs['existsSync'](_0x7adc51)){cypher=!![];return _0x1a02a7[_0xfd7f('0x59')](_0x7adc51,_0x377c0b[_0xfd7f('0x57')],config[_0xfd7f('0x6a')][_0xfd7f('0x5a')])['then'](function(){return _0x377c0b;});}return _0x377c0b;}})['then'](function(_0x248d18){if(!_0x248d18){throw new db[(_0xfd7f('0x5b'))][(_0xfd7f('0x5c'))](_0xfd7f('0x83'));}_0x464fbe=_0x248d18;return db[_0xfd7f('0x84')][_0xfd7f('0x85')]({'where':{'id':0x1}});})[_0xfd7f('0x2b')](handleEntityNotFound(_0x3bd551,null))[_0xfd7f('0x2b')](function(_0x4c1df7){if(_0x4c1df7){_0x4de8bb=_0x4c1df7;if(!_0x4de8bb['transcribe']||!_0x4de8bb[_0xfd7f('0x86')]||!_0x4de8bb[_0xfd7f('0x87')]||!_0x4de8bb[_0xfd7f('0x88')]||!_0x4de8bb[_0xfd7f('0x7b')]){throw new db[(_0xfd7f('0x5b'))]['ValidationError'](_0xfd7f('0x89'));}if(_0x5a69b4[_0xfd7f('0x53')]['runSentiment']&&(!_0x4de8bb['sentiment']||!_0x4de8bb[_0xfd7f('0x8a')]||!_0x4de8bb['sentimentRegion']||!_0x4de8bb[_0xfd7f('0x88')]||!_0x4de8bb[_0xfd7f('0x7b')])){throw new db[(_0xfd7f('0x5b'))][(_0xfd7f('0x5c'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xfd7f('0x8b')]['findOne']({'where':{'id':_0x4de8bb[_0xfd7f('0x86')]}});}})['then'](function(_0x261fea){if(!_0x261fea){throw new db['Sequelize'][(_0xfd7f('0x5c'))](_0xfd7f('0x8c'));}if(!_0x261fea[_0xfd7f('0x8d')]||!_0x261fea[_0xfd7f('0x8e')]){throw new db[(_0xfd7f('0x5b'))][(_0xfd7f('0x5c'))](_0xfd7f('0x8f'));}_0x5537ce=_0x261fea;return getBucketslist(_0x5537ce['data1'],_0x5537ce[_0xfd7f('0x8e')],_0x4de8bb[_0xfd7f('0x87')]);})[_0xfd7f('0x2b')](function(_0x565d20){if(_0x565d20&&_0x565d20[_0xfd7f('0x90')]){var _0x208f2a=_[_0xfd7f('0x51')](_0x565d20[_0xfd7f('0x90')],function(_0x1bb248){return _0x1bb248[_0xfd7f('0x91')]===_0x4de8bb[_0xfd7f('0x7b')];});if(!_0x208f2a){logger[_0xfd7f('0x6e')](util['format'](_0xfd7f('0x92'),_0x5a69b4[_0xfd7f('0x50')]['id'],_0x4de8bb[_0xfd7f('0x7b')]));return createBucket(_0x5537ce['data1'],_0x5537ce['data2'],_0x4de8bb[_0xfd7f('0x87')],_0x4de8bb[_0xfd7f('0x7b')]);}logger[_0xfd7f('0x6e')](util[_0xfd7f('0x37')](_0xfd7f('0x93'),_0x5a69b4[_0xfd7f('0x50')]['id'],_0x4de8bb['bucket']));return;}})[_0xfd7f('0x2b')](function(_0x65d8ca){if(_0x464fbe[_0xfd7f('0x82')]===_0xfd7f('0x94')){return transcribe(_0x5a69b4['params']['id'],_0x5537ce[_0xfd7f('0x8d')],_0x5537ce[_0xfd7f('0x8e')],_0x4de8bb['transcribeRegion'],_0x4de8bb['bucket'],_0x464fbe[_0xfd7f('0x57')],_0x4de8bb[_0xfd7f('0x88')]);}else{logger[_0xfd7f('0x6e')](util[_0xfd7f('0x37')](_0xfd7f('0x95'),_0x5a69b4[_0xfd7f('0x50')]['id']));return{'transcribeStatus':_0xfd7f('0x96')};}})[_0xfd7f('0x2b')](function(_0x34409d){if(_0x34409d){_0x34409d[_0xfd7f('0x97')]=_0x5a69b4[_0xfd7f('0x53')]['runSentiment'];return _0x464fbe['updateAttributes'](_0x34409d);}})[_0xfd7f('0x2b')](respondWithResult(_0x3bd551,null))[_0xfd7f('0x4e')](handleError(_0x3bd551,null));};function writeFile(_0x442569,_0x27482){return new Promise(function(_0x136952,_0x278ec7){fs[_0xfd7f('0x98')](_0x27482,_0x442569,function(_0x2b0e08,_0x5f5e04){if(_0x2b0e08){return _0x278ec7(_0x2b0e08);}else{return _0x136952(_0x5f5e04);}});});}exports['downloadTranscribe']=function(_0x2a8b94,_0x1434be,_0x325c05){return db[_0xfd7f('0x31')][_0xfd7f('0x85')]({'where':{'id':_0x2a8b94[_0xfd7f('0x50')]['id']}})[_0xfd7f('0x2b')](handleEntityNotFound(_0x1434be))[_0xfd7f('0x2b')](function(_0x4dbc91){if(_0x4dbc91&&_0x4dbc91[_0xfd7f('0x99')]){var _0x59ac4c=_0x4dbc91[_0xfd7f('0x99')];var _0x53a36a=config[_0xfd7f('0x9a')]+_0xfd7f('0x9b')+_0x4dbc91['id']+_0xfd7f('0x9c');if(fs[_0xfd7f('0x58')](_0x53a36a)){return _0x53a36a;}return writeFile(_0x59ac4c,_0x53a36a)[_0xfd7f('0x2b')](function(){return _0x53a36a;});}else{throw new db[(_0xfd7f('0x5b'))]['ValidationError'](_0xfd7f('0x9d'));}})[_0xfd7f('0x2b')](function(_0x5ccdf2){return _0x1434be['download'](_0x5ccdf2);})[_0xfd7f('0x4e')](handleError(_0x1434be));}; \ No newline at end of file +var _0x86d4=['../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','VoiceRecording','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','download','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','../../components/encryptor','sequelize','MD5','col','token','$and','push','%s.cypher','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','NEW','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x564e9f,_0x225a15){var _0x3a9f3e=function(_0x1bbe48){while(--_0x1bbe48){_0x564e9f['push'](_0x564e9f['shift']());}};_0x3a9f3e(++_0x225a15);}(_0x86d4,0x82));var _0x486d=function(_0x5c2ac7,_0x4e7fea){_0x5c2ac7=_0x5c2ac7-0x0;var _0x1efc9a=_0x86d4[_0x5c2ac7];return _0x1efc9a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x486d('0x0'));var zipdir=require(_0x486d('0x1'));var jsonpatch=require(_0x486d('0x2'));var rp=require(_0x486d('0x3'));var moment=require(_0x486d('0x4'));var BPromise=require(_0x486d('0x5'));var Mustache=require(_0x486d('0x6'));var util=require(_0x486d('0x7'));var path=require('path');var sox=require(_0x486d('0x8'));var csv=require('to-csv');var ejs=require(_0x486d('0x9'));var fs=require('fs');var fs_extra=require(_0x486d('0xa'));var _=require(_0x486d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x486d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x486d('0xd'));var Papa=require(_0x486d('0xe'));var AWS=require(_0x486d('0xf'));var uuidv4=require(_0x486d('0x10'));var Redis=require(_0x486d('0x11'));var authService=require(_0x486d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x486d('0x13'));var hardwareService=require(_0x486d('0x14'));var logger=require('../../config/logger')(_0x486d('0x15'));var utils=require(_0x486d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x486d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50010e,_0x432876){_0x432876=_0x432876||0xcc;return function(_0xbe0098){if(_0xbe0098){return _0x50010e[_0x486d('0x18')](_0x432876);}return _0x50010e[_0x486d('0x19')](_0x432876)[_0x486d('0x1a')]();};}function respondWithResult(_0x1a24cc,_0x5c879){_0x5c879=_0x5c879||0xc8;return function(_0x29d348){if(_0x29d348){return _0x1a24cc[_0x486d('0x19')](_0x5c879)['json'](_0x29d348);}};}function respondWithFilteredResult(_0x2b26d5,_0x4a68c8){return function(_0x35a0cb){if(_0x35a0cb){var _0x5d8555=typeof _0x4a68c8[_0x486d('0x1b')]===_0x486d('0x1c')&&typeof _0x4a68c8['limit']===_0x486d('0x1c');var _0x6f57ad=_0x35a0cb[_0x486d('0x1d')];var _0x592259=_0x5d8555?0x0:_0x4a68c8['offset'];var _0x262fce=_0x5d8555?_0x35a0cb[_0x486d('0x1d')]:_0x4a68c8[_0x486d('0x1b')]+_0x4a68c8[_0x486d('0x1e')];var _0x461009;if(_0x262fce>=_0x6f57ad){_0x262fce=_0x6f57ad;_0x461009=0xc8;}else{_0x461009=0xce;}_0x2b26d5[_0x486d('0x19')](_0x461009);return _0x2b26d5[_0x486d('0x1f')](_0x486d('0x20'),_0x592259+'-'+_0x262fce+'/'+_0x6f57ad)[_0x486d('0x21')](_0x35a0cb);}return null;};}function patchUpdates(_0x513700){return function(_0x4fb5f5){try{jsonpatch[_0x486d('0x22')](_0x4fb5f5,_0x513700,!![]);}catch(_0xfc7689){return BPromise[_0x486d('0x23')](_0xfc7689);}return _0x4fb5f5[_0x486d('0x24')]();};}function saveUpdates(_0x266f94,_0x109714){return function(_0x557280){if(_0x557280){return _0x557280[_0x486d('0x25')](_0x266f94)[_0x486d('0x26')](function(_0x48b5fe){return _0x48b5fe;});}return null;};}function removeEntity(_0x5c0e67,_0xa4da68){return function(_0x4c9cee){if(_0x4c9cee){return _0x4c9cee[_0x486d('0x27')]()[_0x486d('0x26')](function(){_0x5c0e67[_0x486d('0x19')](0xcc)[_0x486d('0x1a')]();});}};}function handleEntityNotFound(_0x2acc85,_0x2f9fbd){return function(_0x1771e8){if(!_0x1771e8){_0x2acc85[_0x486d('0x18')](0x194);}return _0x1771e8;};}function handleError(_0x51e223,_0x944726){_0x944726=_0x944726||0x1f4;return function(_0x182c98){logger['error'](_0x182c98['stack']);if(_0x182c98['name']){delete _0x182c98[_0x486d('0x28')];}_0x51e223[_0x486d('0x19')](_0x944726)[_0x486d('0x29')](_0x182c98);};}exports['index']=function(_0x4f86ae,_0x4b5053){var _0x4ed736={},_0x1dbaf5={},_0x587a36={'count':0x0,'rows':[]};var _0x1e130f=_[_0x486d('0x2a')](db['VoiceRecording'][_0x486d('0x2b')],function(_0x15b2d2){return{'name':_0x15b2d2[_0x486d('0x2c')],'type':_0x15b2d2[_0x486d('0x2d')][_0x486d('0x2e')]};});_0x1dbaf5[_0x486d('0x2f')]=_[_0x486d('0x30')](_['map'](_0x1e130f,_0x486d('0x28')),[_0x486d('0x31')]);_0x1dbaf5[_0x486d('0x32')]=_[_0x486d('0x33')](_0x4f86ae[_0x486d('0x32')]);_0x1dbaf5[_0x486d('0x34')]=_['intersection'](_0x1dbaf5[_0x486d('0x2f')],_0x1dbaf5[_0x486d('0x32')]);_0x4ed736[_0x486d('0x35')]=_[_0x486d('0x36')](_0x1dbaf5['model'],qs[_0x486d('0x37')](_0x4f86ae['query'][_0x486d('0x37')]));_0x4ed736[_0x486d('0x35')]=_0x4ed736['attributes'][_0x486d('0x38')]?_0x4ed736[_0x486d('0x35')]:_0x1dbaf5[_0x486d('0x2f')];if(!_0x4f86ae[_0x486d('0x32')][_0x486d('0x39')](_0x486d('0x3a'))){_0x4ed736['limit']=qs[_0x486d('0x1e')](_0x4f86ae[_0x486d('0x32')][_0x486d('0x1e')]);_0x4ed736['offset']=qs[_0x486d('0x1b')](_0x4f86ae[_0x486d('0x32')][_0x486d('0x1b')]);}_0x4ed736[_0x486d('0x3b')]=qs[_0x486d('0x3c')](_0x4f86ae[_0x486d('0x32')]['sort']);_0x4ed736[_0x486d('0x3d')]=qs[_0x486d('0x34')](_['pick'](_0x4f86ae[_0x486d('0x32')],_0x1dbaf5['filters']),_0x1e130f);if(_0x4f86ae[_0x486d('0x32')][_0x486d('0x3e')]){_0x4ed736['where']=_[_0x486d('0x3f')](_0x4ed736['where'],{'$or':_[_0x486d('0x2a')](_0x1e130f,function(_0x9accb9){if(_0x9accb9['type']!==_0x486d('0x40')){var _0xbfc7f8={};_0xbfc7f8[_0x9accb9['name']]={'$like':'%'+_0x4f86ae[_0x486d('0x32')][_0x486d('0x3e')]+'%'};return _0xbfc7f8;}})});}_0x4ed736=_[_0x486d('0x3f')]({},_0x4ed736,_0x4f86ae[_0x486d('0x41')]);var _0xd239dc={'where':_0x4ed736[_0x486d('0x3d')]};return db[_0x486d('0x42')][_0x486d('0x1d')](_0xd239dc)[_0x486d('0x26')](function(_0x3c734a){_0x587a36[_0x486d('0x1d')]=_0x3c734a;if(_0x4f86ae['query']['includeAll']){_0x4ed736[_0x486d('0x43')]=[{'all':!![]}];}return db['VoiceRecording'][_0x486d('0x44')](_0x4ed736);})[_0x486d('0x26')](function(_0xd4bbac){_0x587a36[_0x486d('0x45')]=_0xd4bbac;return _0x587a36;})[_0x486d('0x26')](respondWithFilteredResult(_0x4b5053,_0x4ed736))[_0x486d('0x46')](handleError(_0x4b5053,null));};exports[_0x486d('0x47')]=function(_0x44836f,_0x4afdb0){var _0x4ed11d={'raw':![],'where':{'id':_0x44836f[_0x486d('0x48')]['id']}},_0xecf5ed={};_0xecf5ed[_0x486d('0x2f')]=_['keys'](db[_0x486d('0x42')][_0x486d('0x2b')]);_0xecf5ed[_0x486d('0x32')]=_[_0x486d('0x33')](_0x44836f[_0x486d('0x32')]);_0xecf5ed[_0x486d('0x34')]=_[_0x486d('0x36')](_0xecf5ed['model'],_0xecf5ed[_0x486d('0x32')]);_0x4ed11d[_0x486d('0x35')]=_[_0x486d('0x36')](_0xecf5ed[_0x486d('0x2f')],qs[_0x486d('0x37')](_0x44836f['query'][_0x486d('0x37')]));_0x4ed11d[_0x486d('0x35')]=_0x4ed11d[_0x486d('0x35')]['length']?_0x4ed11d[_0x486d('0x35')]:_0xecf5ed[_0x486d('0x2f')];if(_0x44836f[_0x486d('0x32')][_0x486d('0x49')]){_0x4ed11d[_0x486d('0x43')]=[{'all':!![]}];}_0x4ed11d=_['merge']({},_0x4ed11d,_0x44836f[_0x486d('0x41')]);return db[_0x486d('0x42')]['find'](_0x4ed11d)[_0x486d('0x26')](handleEntityNotFound(_0x4afdb0,null))[_0x486d('0x26')](respondWithResult(_0x4afdb0,null))[_0x486d('0x46')](handleError(_0x4afdb0,null));};exports[_0x486d('0x4a')]=function(_0xd8438,_0x2ad0d4){return db['VoiceRecording']['create'](_0xd8438[_0x486d('0x4b')],{})[_0x486d('0x26')](respondWithResult(_0x2ad0d4,0xc9))[_0x486d('0x46')](handleError(_0x2ad0d4,null));};exports[_0x486d('0x25')]=function(_0x39554c,_0x566aaa){if(_0x39554c[_0x486d('0x4b')]['id']){delete _0x39554c[_0x486d('0x4b')]['id'];}return db[_0x486d('0x42')][_0x486d('0x4c')]({'where':{'id':_0x39554c['params']['id']}})[_0x486d('0x26')](handleEntityNotFound(_0x566aaa,null))[_0x486d('0x26')](saveUpdates(_0x39554c[_0x486d('0x4b')],null))[_0x486d('0x26')](respondWithResult(_0x566aaa,null))[_0x486d('0x46')](handleError(_0x566aaa,null));};exports[_0x486d('0x4d')]=function(_0x2c9c9d,_0xc67109){return db[_0x486d('0x42')][_0x486d('0x4d')]()[_0x486d('0x26')](respondWithResult(_0xc67109,null))[_0x486d('0x46')](handleError(_0xc67109,null));};exports[_0x486d('0x4e')]=function(_0x4841a8,_0x2df435,_0x5ea620){var _0x595199=require('../../components/encryptor');var _0x4b1bcf=![];var _0x18b2d5={};if(_0x4841a8[_0x486d('0x32')][_0x486d('0x2d')]&&_0x4841a8[_0x486d('0x32')]['type']==='uniqueid'){_0x18b2d5[_0x486d('0x4f')]=_0x4841a8[_0x486d('0x48')]['id'];}else{_0x18b2d5['id']=_0x4841a8['params']['id'];}return db[_0x486d('0x42')]['find']({'where':_0x18b2d5,'attributes':['id',_0x486d('0x50')],'raw':!![]})[_0x486d('0x26')](handleEntityNotFound(_0x2df435,null))[_0x486d('0x26')](function(_0x3658f2){if(_0x3658f2){var _0x429ea6=_0x3658f2['value'];var _0x7a35c5=util[_0x486d('0x31')]('%s.cypher',_0x429ea6);if(fs[_0x486d('0x51')](_0x7a35c5)){_0x4b1bcf=!![];return _0x595199[_0x486d('0x52')](_0x7a35c5,_0x429ea6,config[_0x486d('0x53')][_0x486d('0x54')])[_0x486d('0x26')](function(){return _0x3658f2;});}return _0x3658f2;}})['then'](function(_0x47838b){if(_0x47838b){var _0x4e3396=_0x47838b[_0x486d('0x50')];if(!fs['existsSync'](_0x4e3396)){throw new db[(_0x486d('0x55'))][(_0x486d('0x56'))](_0x486d('0x57'));}if(_0x47838b[_0x486d('0x58')]){return _0x2df435[_0x486d('0x4e')](_0x4e3396,_0x47838b[_0x486d('0x58')]+path[_0x486d('0x59')](_0x4e3396),function(){if(_0x4b1bcf){fs['unlink'](_0x4e3396);}});}else{return _0x2df435[_0x486d('0x4e')](_0x4e3396,function(_0x2b9bcc){if(_0x4b1bcf){fs[_0x486d('0x5a')](_0x4e3396);}});}}})[_0x486d('0x46')](function(_0x5ec7d2){if(_0x5ec7d2[_0x486d('0x5b')]===_0x486d('0x57')){_0x2df435[_0x486d('0x19')](0x194)['send'](_0x486d('0x5c'));}else{return handleError(_0x2df435,null);}});};exports['downloads']=function(_0x3b5594,_0x242771,_0x2e7df7){var _0x35f3e8=require(_0x486d('0x5d'));var _0x3105b1=![];var _0x43a8b5={'$and':[db[_0x486d('0x5e')][_0x486d('0x3d')](db[_0x486d('0x5e')]['fn'](_0x486d('0x5f'),db[_0x486d('0x5e')][_0x486d('0x60')](_0x486d('0x4f'))),_0x3b5594['query'][_0x486d('0x61')])]};if(_0x3b5594['query'][_0x486d('0x2d')]&&_0x3b5594['query']['type']===_0x486d('0x4f')){_0x43a8b5[_0x486d('0x62')][_0x486d('0x63')]({'uniqueid':_0x3b5594[_0x486d('0x48')]['id']});}else{_0x43a8b5['$and'][_0x486d('0x63')]({'id':_0x3b5594[_0x486d('0x48')]['id']});}return db['VoiceRecording'][_0x486d('0x4c')]({'where':_0x43a8b5,'attributes':['id',_0x486d('0x50')],'raw':!![]})[_0x486d('0x26')](handleEntityNotFound(_0x242771,null))['then'](function(_0x14a887){if(_0x14a887){var _0x44e5c5=util[_0x486d('0x31')](_0x486d('0x64'),_0x14a887[_0x486d('0x50')]);if(fs[_0x486d('0x51')](_0x44e5c5)){_0x3105b1=!![];return _0x35f3e8[_0x486d('0x52')](_0x44e5c5,_0x14a887[_0x486d('0x50')],config[_0x486d('0x53')][_0x486d('0x54')])[_0x486d('0x26')](function(){return _0x14a887;});}return _0x14a887;}})[_0x486d('0x26')](function(_0x892a1b){if(_0x892a1b){if(!fs[_0x486d('0x51')](_0x892a1b['value'])){throw new db[(_0x486d('0x55'))][(_0x486d('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x892a1b['filename']){return _0x242771['download'](_0x892a1b[_0x486d('0x50')],_0x892a1b[_0x486d('0x58')]+path[_0x486d('0x59')](_0x892a1b[_0x486d('0x50')]),function(){if(_0x3105b1){fs[_0x486d('0x5a')](_0x892a1b[_0x486d('0x50')]);}});}else{return _0x242771[_0x486d('0x4e')](_0x892a1b[_0x486d('0x50')],function(_0x47db9f){if(_0x3105b1){fs[_0x486d('0x5a')](_0x892a1b[_0x486d('0x50')]);}});}}})[_0x486d('0x46')](handleError(_0x242771,null));};exports[_0x486d('0x27')]=function(_0x14abbf,_0x4ba767){return db[_0x486d('0x42')][_0x486d('0x4c')]({'where':{'id':_0x14abbf[_0x486d('0x48')]['id']}})[_0x486d('0x26')](function(_0x4c1873){if(_[_0x486d('0x65')](_0x4c1873)){throw new ReferenceError(_0x486d('0x66'));}return _0x4c1873;})['then'](function(_0x5d909e){var _0x3fdfe4=_0x5d909e[_0x486d('0x50')];logger[_0x486d('0x67')](_0x486d('0x68'),_0x3fdfe4);if(!_[_0x486d('0x65')](_0x5d909e[_0x486d('0x50')])&&fs['existsSync'](_0x3fdfe4)){logger[_0x486d('0x67')]('File:\x20\x22'+_0x3fdfe4+_0x486d('0x69'));fs[_0x486d('0x6a')](_0x3fdfe4);}_0x3fdfe4=_0x3fdfe4+'.cypher';if(!_['isNil'](_0x5d909e[_0x486d('0x50')])&&fs[_0x486d('0x51')](_0x3fdfe4)){logger['info']('File:\x20\x22'+_0x3fdfe4+_0x486d('0x69'));fs[_0x486d('0x6a')](_0x3fdfe4);}return _0x5d909e;})[_0x486d('0x26')](function(_0x5bce07){if(!_0x5bce07)throw new InternalError();return _0x5bce07[_0x486d('0x27')]();})[_0x486d('0x26')](function(){_0x4ba767[_0x486d('0x19')](0xcc)['end']();})[_0x486d('0x46')](handleError(_0x4ba767,null));};function getBucketslist(_0x2b0362,_0x5df083,_0x3ac96a){return new Promise(function(_0x336191,_0x22b4b5){var _0x3e8515=new AWS['S3']({'accessKeyId':_0x5df083,'secretAccessKey':_0x2b0362,'region':_0x3ac96a});_0x3e8515[_0x486d('0x6b')]({},function(_0x191ed3,_0x4d5e25){if(_0x191ed3){return _0x22b4b5(_0x191ed3);}else{return _0x336191(_0x4d5e25);}});});}function createBucket(_0x2bfa6f,_0x35e36c,_0x1237e2,_0x412309){return new Promise(function(_0x12ce3b,_0x2982e7){var _0x184fba=new AWS['S3']({'accessKeyId':_0x35e36c,'secretAccessKey':_0x2bfa6f,'region':_0x1237e2});_0x184fba[_0x486d('0x6c')]({'Bucket':_0x412309},function(_0x3d390c,_0x360cb1){if(_0x3d390c){return _0x2982e7(_0x3d390c);}else{return _0x12ce3b(_0x360cb1);}});});}function uploadFile(_0x7278c8,_0x37f397,_0x5ef075,_0x48de02,_0x539930,_0x39961b){return new Promise(function(_0x4ba146,_0x48538e){var _0x22f08e=new AWS['S3']({'accessKeyId':_0x37f397,'secretAccessKey':_0x7278c8,'region':_0x5ef075});_0x22f08e['upload']({'Bucket':_0x48de02,'Key':_0x539930,'Body':_0x39961b},function(_0x160a69,_0xc5ceba){if(_0x160a69){return _0x48538e(_0x160a69);}else{return _0x4ba146(_0xc5ceba);}});});}function startTranscribe(_0x48ac32,_0x16cef7,_0xcbc2e0,_0x202d0c,_0x375c6d,_0xe90493){return new Promise(function(_0x58a07c,_0x5d57f9){var _0x402d9a=new AWS['TranscribeService']({'accessKeyId':_0x16cef7,'secretAccessKey':_0x48ac32,'region':_0xcbc2e0});_0x402d9a[_0x486d('0x6d')]({'TranscriptionJobName':_0x202d0c,'LanguageCode':_0x375c6d,'Media':{'MediaFileUri':_0xe90493}},function(_0x4aa373,_0x5ead92){if(_0x4aa373){return _0x5d57f9(_0x4aa373);}else{return _0x58a07c(_0x5ead92);}});});}function transcribe(_0x265848,_0x3d0feb,_0x3f3147,_0x5222a0,_0x24fa17,_0x8a66b1,_0x57a5f6){return new Promise(function(_0x3e0195,_0x179354){var _0x82209c={};logger[_0x486d('0x67')](util[_0x486d('0x31')](_0x486d('0x6e'),_0x265848,_0x24fa17));return uploadFile(_0x3d0feb,_0x3f3147,_0x5222a0,_0x24fa17,path['basename'](_0x8a66b1),fs[_0x486d('0x6f')](_0x8a66b1))[_0x486d('0x26')](function(_0x125bee){logger[_0x486d('0x67')](util[_0x486d('0x31')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x265848,_0x24fa17,_0x125bee['Location']));_0x82209c[_0x486d('0x70')]=_0x125bee[_0x486d('0x71')];_0x82209c['location']=_0x125bee[_0x486d('0x72')];logger[_0x486d('0x67')](util[_0x486d('0x31')](_0x486d('0x73'),_0x265848));return startTranscribe(_0x3d0feb,_0x3f3147,_0x5222a0,uuidv4(),_0x57a5f6,_0x125bee[_0x486d('0x72')]);})[_0x486d('0x26')](function(_0x41da2b){logger[_0x486d('0x67')](util[_0x486d('0x31')](_0x486d('0x74'),_0x265848,_0x41da2b[_0x486d('0x75')][_0x486d('0x76')]));_0x82209c[_0x486d('0x77')]=_0x41da2b[_0x486d('0x75')]['TranscriptionJobName'];_0x82209c['transcribeStatus']=_0x41da2b[_0x486d('0x75')][_0x486d('0x78')];return _0x3e0195(_0x82209c);})[_0x486d('0x46')](function(_0x104c9f){return _0x179354(_0x104c9f);});});}exports[_0x486d('0x79')]=function(_0x1e1690,_0xe59372,_0x169973){var _0x473443;var _0x272b26;var _0x2a06b2;var _0x4aab9e=require(_0x486d('0x5d'));return db[_0x486d('0x42')]['findOne']({'where':{'id':_0x1e1690[_0x486d('0x48')]['id']}})[_0x486d('0x26')](function(_0x629db1){if(_0x629db1){var _0x40067c=util[_0x486d('0x31')](_0x486d('0x64'),_0x629db1['value']);if(fs[_0x486d('0x51')](_0x40067c)){cypher=!![];return _0x4aab9e[_0x486d('0x52')](_0x40067c,_0x629db1[_0x486d('0x50')],config[_0x486d('0x53')][_0x486d('0x54')])['then'](function(){return _0x629db1;});}return _0x629db1;}})[_0x486d('0x26')](function(_0x2e1878){if(!_0x2e1878){throw new db['Sequelize'][(_0x486d('0x56'))](_0x486d('0x7a'));}_0x272b26=_0x2e1878;return db[_0x486d('0x7b')][_0x486d('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0xe59372,null))[_0x486d('0x26')](function(_0x37bede){if(_0x37bede){_0x473443=_0x37bede;if(!_0x473443[_0x486d('0x7d')]||!_0x473443[_0x486d('0x7e')]||!_0x473443[_0x486d('0x7f')]||!_0x473443[_0x486d('0x80')]||!_0x473443[_0x486d('0x70')]){throw new db[(_0x486d('0x55'))]['ValidationError'](_0x486d('0x81'));}if(_0x1e1690[_0x486d('0x4b')]['runSentiment']&&(!_0x473443[_0x486d('0x82')]||!_0x473443[_0x486d('0x83')]||!_0x473443[_0x486d('0x84')]||!_0x473443[_0x486d('0x80')]||!_0x473443[_0x486d('0x70')])){throw new db[(_0x486d('0x55'))][(_0x486d('0x56'))](_0x486d('0x85'));}return db[_0x486d('0x86')][_0x486d('0x7c')]({'where':{'id':_0x473443['transcribeAccountId']}});}})[_0x486d('0x26')](function(_0x44da27){if(!_0x44da27){throw new db[(_0x486d('0x55'))]['ValidationError'](_0x486d('0x87'));}if(!_0x44da27[_0x486d('0x88')]||!_0x44da27[_0x486d('0x89')]){throw new db[(_0x486d('0x55'))]['ValidationError'](_0x486d('0x8a'));}_0x2a06b2=_0x44da27;return getBucketslist(_0x2a06b2['data1'],_0x2a06b2[_0x486d('0x89')],_0x473443[_0x486d('0x7f')]);})['then'](function(_0x233f63){if(_0x233f63&&_0x233f63[_0x486d('0x8b')]){var _0x57a5c4=_[_0x486d('0x4c')](_0x233f63[_0x486d('0x8b')],function(_0x4c54b4){return _0x4c54b4[_0x486d('0x8c')]===_0x473443[_0x486d('0x70')];});if(!_0x57a5c4){logger['info'](util[_0x486d('0x31')](_0x486d('0x8d'),_0x1e1690[_0x486d('0x48')]['id'],_0x473443['bucket']));return createBucket(_0x2a06b2[_0x486d('0x88')],_0x2a06b2[_0x486d('0x89')],_0x473443[_0x486d('0x7f')],_0x473443[_0x486d('0x70')]);}logger[_0x486d('0x67')](util[_0x486d('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x1e1690[_0x486d('0x48')]['id'],_0x473443['bucket']));return;}})[_0x486d('0x26')](function(_0x65abc9){if(_0x272b26[_0x486d('0x8e')]===_0x486d('0x8f')){return transcribe(_0x1e1690['params']['id'],_0x2a06b2[_0x486d('0x88')],_0x2a06b2['data2'],_0x473443[_0x486d('0x7f')],_0x473443[_0x486d('0x70')],_0x272b26[_0x486d('0x50')],_0x473443[_0x486d('0x80')]);}else{logger[_0x486d('0x67')](util[_0x486d('0x31')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1e1690[_0x486d('0x48')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x486d('0x26')](function(_0x5f57b7){if(_0x5f57b7){_0x5f57b7[_0x486d('0x90')]=_0x1e1690[_0x486d('0x4b')][_0x486d('0x91')];return _0x272b26[_0x486d('0x92')](_0x5f57b7);}})[_0x486d('0x26')](respondWithResult(_0xe59372,null))[_0x486d('0x46')](handleError(_0xe59372,null));};function writeFile(_0x227bc5,_0xd99f29){return new Promise(function(_0x134c7d,_0x1bd598){fs[_0x486d('0x93')](_0xd99f29,_0x227bc5,function(_0x12c327,_0x66f60f){if(_0x12c327){return _0x1bd598(_0x12c327);}else{return _0x134c7d(_0x66f60f);}});});}exports[_0x486d('0x94')]=function(_0x2b5eb1,_0x342d15,_0xd41107){return db['VoiceRecording'][_0x486d('0x7c')]({'where':{'id':_0x2b5eb1[_0x486d('0x48')]['id']}})[_0x486d('0x26')](handleEntityNotFound(_0x342d15))['then'](function(_0x58d71c){if(_0x58d71c&&_0x58d71c['fileText']){var _0x2c5e11=_0x58d71c[_0x486d('0x95')];var _0x180130=config[_0x486d('0x96')]+_0x486d('0x97')+_0x58d71c['id']+'.txt';if(fs[_0x486d('0x51')](_0x180130)){return _0x180130;}return writeFile(_0x2c5e11,_0x180130)[_0x486d('0x26')](function(){return _0x180130;});}else{throw new db[(_0x486d('0x55'))][(_0x486d('0x56'))](_0x486d('0x98'));}})['then'](function(_0xea9cbd){return _0x342d15[_0x486d('0x4e')](_0xea9cbd);})[_0x486d('0x46')](handleError(_0x342d15));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 38f9fe6..b08d2a0 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 _0xa702=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports','VoiceRecording','voice_recordings'];(function(_0x1e9b5c,_0x17dfed){var _0x5612d4=function(_0x3f3c9d){while(--_0x3f3c9d){_0x1e9b5c['push'](_0x1e9b5c['shift']());}};_0x5612d4(++_0x17dfed);}(_0xa702,0x1ae));var _0x2a70=function(_0x40a4a8,_0x3034c6){_0x40a4a8=_0x40a4a8-0x0;var _0x4503de=_0xa702[_0x40a4a8];return _0x4503de;};'use strict';var _=require(_0x2a70('0x0'));var util=require(_0x2a70('0x1'));var logger=require(_0x2a70('0x2'))(_0x2a70('0x3'));var moment=require(_0x2a70('0x4'));var BPromise=require('bluebird');var rp=require(_0x2a70('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2a70('0x6'));var attributes=require('./voiceRecording.attributes');module[_0x2a70('0x7')]=function(_0x16cdc3,_0x4b2915){return _0x16cdc3['define'](_0x2a70('0x8'),attributes,{'tableName':_0x2a70('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2a70('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1c63=['./voiceRecording.attributes','exports','voice_recordings','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x329437,_0x1de73a){var _0x3789d9=function(_0x37832e){while(--_0x37832e){_0x329437['push'](_0x329437['shift']());}};_0x3789d9(++_0x1de73a);}(_0x1c63,0xdc));var _0x31c6=function(_0xe33b12,_0x2a9761){_0xe33b12=_0xe33b12-0x0;var _0x30699d=_0x1c63[_0xe33b12];return _0x30699d;};'use strict';var _=require(_0x31c6('0x0'));var util=require(_0x31c6('0x1'));var logger=require(_0x31c6('0x2'))(_0x31c6('0x3'));var moment=require('moment');var BPromise=require(_0x31c6('0x4'));var rp=require(_0x31c6('0x5'));var fs=require('fs');var path=require(_0x31c6('0x6'));var rimraf=require('rimraf');var config=require(_0x31c6('0x7'));var attributes=require(_0x31c6('0x8'));module[_0x31c6('0x9')]=function(_0x1f4994,_0xfd3cf3){return _0x1f4994['define']('VoiceRecording',attributes,{'tableName':_0x31c6('0xa'),'paranoid':![],'indexes':[{'name':_0x31c6('0xb'),'fields':[_0x31c6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 2211278..dcc7ced 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 _0xa30a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','UpdateVoiceRecording','update','body','options','where','limit','debug','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x278db6,_0x1696ae){var _0x30898f=function(_0x267735){while(--_0x267735){_0x278db6['push'](_0x278db6['shift']());}};_0x30898f(++_0x1696ae);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8af448,_0x14fe09,_0x42dc22){return new BPromise(function(_0x5d076a,_0xedbc45){return client[_0xaa30('0xb')](_0x8af448,_0x42dc22)[_0xaa30('0xc')](function(_0x59d028){logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,'request\x20sent');logger['debug'](_0xaa30('0xf'),_0x14fe09,'request\x20sent',JSON[_0xaa30('0x10')](_0x59d028));if(_0x59d028[_0xaa30('0x11')]){if(_0x59d028[_0xaa30('0x11')][_0xaa30('0x12')]===0x1f4){logger['error'](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0xedbc45(_0x59d028['error'][_0xaa30('0x13')]);}logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0x5d076a(_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);}else{logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,_0xaa30('0x14'));_0x5d076a(_0x59d028['result'][_0xaa30('0x13')]);}})['catch'](function(_0x5eb356){logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x5eb356);_0xedbc45(_0x5eb356);});});}exports[_0xaa30('0x15')]=function(_0x540e36){var _0x54fa49=this;return new Promise(function(_0x53f9fd,_0x23ad3b){return db['VoiceRecording'][_0xaa30('0x16')](_0x540e36[_0xaa30('0x17')],{'raw':_0x540e36['options']?_0x540e36['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')][_0xaa30('0x19')]||null:null,'attributes':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')]['attributes']||null:null,'limit':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')][_0xaa30('0x1a')]||null:null})[_0xaa30('0xc')](function(_0x1ff442){logger['info'](_0xaa30('0x15'),_0x540e36);logger[_0xaa30('0x1b')](_0xaa30('0x15'),_0x540e36,JSON[_0xaa30('0x10')](_0x1ff442));_0x53f9fd(_0x1ff442);})['catch'](function(_0x14d7fa){logger[_0xaa30('0x11')](_0xaa30('0x15'),_0x14d7fa[_0xaa30('0x13')],_0x540e36);_0x23ad3b(_0x54fa49[_0xaa30('0x11')](0x1f4,_0x14d7fa[_0xaa30('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x467850){var _0x465701=this;return new Promise(function(_0x5d4da8,_0xb043e4){var _0x5b3efb=require(_0xaa30('0x1c'));var _0x33a0c9;return db[_0xaa30('0x1d')][_0xaa30('0x1e')]({'attributes':['id',_0xaa30('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xaa30('0xc')](function(_0x6ff09a){_0x33a0c9=_0x6ff09a;return db[_0xaa30('0x20')][_0xaa30('0x21')](_0x467850[_0xaa30('0x17')]);})[_0xaa30('0xc')](function(_0x43003f){if(_0x33a0c9[_0xaa30('0x1f')]&&fs[_0xaa30('0x22')](_0x43003f[_0xaa30('0x23')])){var _0x1a3f64=util[_0xaa30('0x24')](_0xaa30('0x25'),_0x43003f['value']);return _0x5b3efb[_0xaa30('0x26')](_0x43003f[_0xaa30('0x23')],_0x1a3f64,config[_0xaa30('0x27')][_0xaa30('0x28')])[_0xaa30('0xc')](function(){fs[_0xaa30('0x29')](_0x43003f['value']);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x43003f;});}return _0x43003f;})[_0xaa30('0xc')](function(_0x407090){logger[_0xaa30('0xd')](_0xaa30('0x2a'),_0x467850);logger[_0xaa30('0x1b')]('CreateVoiceRecording',_0x467850,JSON['stringify'](_0x407090));_0x5d4da8(_0x407090);})[_0xaa30('0x2b')](function(_0x2d26fb){logger['error'](_0xaa30('0x2a'),_0x2d26fb['message'],_0x467850);_0xb043e4(_0x465701[_0xaa30('0x11')](0x1f4,_0x2d26fb['message']));});});}; \ No newline at end of file +var _0xb145=['info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','VoiceRecording,\x20%s,\x20%s','message','result','catch','VoiceRecording','update','body','options','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','then','create','existsSync','format','value','encryptFile','recording','unlink','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb145,0xa3));var _0x5b14=function(_0x190b8d,_0x325a21){_0x190b8d=_0x190b8d-0x0;var _0x35671c=_0xb145[_0x190b8d];return _0x35671c;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require(_0x5b14('0x2'));var rs=require(_0x5b14('0x3'));var fs=require('fs');var Redis=require(_0x5b14('0x4'));var db=require(_0x5b14('0x5'))['db'];var utils=require(_0x5b14('0x6'));var logger=require(_0x5b14('0x7'))('rpc');var config=require(_0x5b14('0x8'));var jayson=require(_0x5b14('0x9'));var client=jayson[_0x5b14('0xa')][_0x5b14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50fd91,_0x1d12ed,_0x2a3921){return new BPromise(function(_0x34530a,_0x62cdcd){return client[_0x5b14('0xc')](_0x50fd91,_0x2a3921)['then'](function(_0x32d729){logger[_0x5b14('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x1d12ed,_0x5b14('0xe'));logger[_0x5b14('0xf')](_0x5b14('0x10'),_0x1d12ed,_0x5b14('0xe'),JSON[_0x5b14('0x11')](_0x32d729));if(_0x32d729['error']){if(_0x32d729[_0x5b14('0x12')]['code']===0x1f4){logger[_0x5b14('0x12')](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x62cdcd(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x34530a(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}else{logger[_0x5b14('0xd')](_0x5b14('0x13'),_0x1d12ed,_0x5b14('0xe'));_0x34530a(_0x32d729[_0x5b14('0x15')][_0x5b14('0x14')]);}})[_0x5b14('0x16')](function(_0x2c3efb){logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x2c3efb);_0x62cdcd(_0x2c3efb);});});}exports['UpdateVoiceRecording']=function(_0x48d395){var _0x58bf3c=this;return new Promise(function(_0x3f397d,_0x3035b5){return db[_0x5b14('0x17')][_0x5b14('0x18')](_0x48d395[_0x5b14('0x19')],{'raw':_0x48d395[_0x5b14('0x1a')]?_0x48d395[_0x5b14('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48d395['options']?_0x48d395['options'][_0x5b14('0x1b')]||null:null,'attributes':_0x48d395[_0x5b14('0x1a')]?_0x48d395[_0x5b14('0x1a')][_0x5b14('0x1c')]||null:null,'limit':_0x48d395['options']?_0x48d395[_0x5b14('0x1a')][_0x5b14('0x1d')]||null:null})['then'](function(_0x2d7b38){logger[_0x5b14('0xd')]('UpdateVoiceRecording',_0x48d395);logger[_0x5b14('0xf')]('UpdateVoiceRecording',_0x48d395,JSON['stringify'](_0x2d7b38));_0x3f397d(_0x2d7b38);})['catch'](function(_0x4def4b){logger[_0x5b14('0x12')](_0x5b14('0x1e'),_0x4def4b[_0x5b14('0x14')],_0x48d395);_0x3035b5(_0x58bf3c['error'](0x1f4,_0x4def4b[_0x5b14('0x14')]));});});};exports[_0x5b14('0x1f')]=function(_0x2ac7b0){var _0x143648=this;return new Promise(function(_0xe6851b,_0x1bbbd7){var _0x422d22=require(_0x5b14('0x20'));var _0x296d65;return db[_0x5b14('0x21')][_0x5b14('0x22')]({'attributes':['id',_0x5b14('0x23')],'where':{'id':0x1},'raw':!![]})[_0x5b14('0x24')](function(_0x266bbe){_0x296d65=_0x266bbe;return db['VoiceRecording'][_0x5b14('0x25')](_0x2ac7b0[_0x5b14('0x19')]);})['then'](function(_0x4ecf7c){if(_0x296d65[_0x5b14('0x23')]&&fs[_0x5b14('0x26')](_0x4ecf7c['value'])){var _0x4c1f0e=util[_0x5b14('0x27')]('%s.cypher',_0x4ecf7c[_0x5b14('0x28')]);return _0x422d22[_0x5b14('0x29')](_0x4ecf7c['value'],_0x4c1f0e,config['secrets'][_0x5b14('0x2a')])[_0x5b14('0x24')](function(){fs[_0x5b14('0x2b')](_0x4ecf7c['value']);logger[_0x5b14('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x4ecf7c;});}return _0x4ecf7c;})[_0x5b14('0x24')](function(_0x291c92){logger[_0x5b14('0xd')](_0x5b14('0x1f'),_0x2ac7b0);logger['debug'](_0x5b14('0x1f'),_0x2ac7b0,JSON[_0x5b14('0x11')](_0x291c92));_0xe6851b(_0x291c92);})[_0x5b14('0x16')](function(_0x37f62c){logger['error'](_0x5b14('0x1f'),_0x37f62c[_0x5b14('0x14')],_0x2ac7b0);_0x1bbbd7(_0x143648[_0x5b14('0x12')](0x1f4,_0x37f62c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 8072dfb..172eac0 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 _0x9ab3=['connect-timeout','express','Router','fs-extra','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x9ab3,0x1c9));var _0x39ab=function(_0x2e27d4,_0x3e6e90){_0x2e27d4=_0x2e27d4-0x0;var _0x183432=_0x9ab3[_0x2e27d4];return _0x183432;};'use strict';var multer=require(_0x39ab('0x0'));var util=require(_0x39ab('0x1'));var path=require(_0x39ab('0x2'));var timeout=require(_0x39ab('0x3'));var express=require(_0x39ab('0x4'));var router=express[_0x39ab('0x5')]();var fs_extra=require(_0x39ab('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x39ab('0x7'));var controller=require(_0x39ab('0x8'));router[_0x39ab('0x9')]('/',auth[_0x39ab('0xa')](),controller['index']);router['get'](_0x39ab('0xb'),auth[_0x39ab('0xa')](),controller[_0x39ab('0xc')]);router[_0x39ab('0x9')](_0x39ab('0xd'),auth[_0x39ab('0xa')](),controller['show']);router[_0x39ab('0xe')]('/',auth[_0x39ab('0xa')](),controller[_0x39ab('0xf')]);router[_0x39ab('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x39ab('0x11')]);router[_0x39ab('0x12')](_0x39ab('0xd'),auth[_0x39ab('0xa')](),controller[_0x39ab('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2315=['show','create','put','update','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x504a25,_0x191ad4){var _0x3a8efe=function(_0x38b4a9){while(--_0x38b4a9){_0x504a25['push'](_0x504a25['shift']());}};_0x3a8efe(++_0x191ad4);}(_0x2315,0xfc));var _0x5231=function(_0x8004b5,_0x4932b2){_0x8004b5=_0x8004b5-0x0;var _0x1a5e1f=_0x2315[_0x8004b5];return _0x1a5e1f;};'use strict';var multer=require(_0x5231('0x0'));var util=require('util');var path=require(_0x5231('0x1'));var timeout=require('connect-timeout');var express=require(_0x5231('0x2'));var router=express[_0x5231('0x3')]();var fs_extra=require(_0x5231('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5231('0x5'));var config=require(_0x5231('0x6'));var controller=require(_0x5231('0x7'));router['get']('/',auth[_0x5231('0x8')](),controller[_0x5231('0x9')]);router[_0x5231('0xa')](_0x5231('0xb'),auth[_0x5231('0x8')](),controller[_0x5231('0xc')]);router['get'](_0x5231('0xd'),auth[_0x5231('0x8')](),controller[_0x5231('0xe')]);router['post']('/',auth[_0x5231('0x8')](),controller[_0x5231('0xf')]);router[_0x5231('0x10')]('/:id',auth[_0x5231('0x8')](),controller[_0x5231('0x11')]);router['delete']('/:id',auth[_0x5231('0x8')](),controller['destroy']);module[_0x5231('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 cfb9238..45469df 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 _0x5837=['attended','STRING','ENUM','Yes','sequelize','moment','exports'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x5837,0x131));var _0x7583=function(_0x1194ad,_0x435140){_0x1194ad=_0x1194ad-0x0;var _0x5f374d=_0x5837[_0x1194ad];return _0x5f374d;};'use strict';var Sequelize=require(_0x7583('0x0'));var moment=require(_0x7583('0x1'));module[_0x7583('0x2')]={'type':{'type':Sequelize['ENUM']('blind',_0x7583('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x7583('0x4')]},'transferercalleridname':{'type':Sequelize[_0x7583('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7583('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x7583('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x7583('0x4')]},'transferercontext':{'type':Sequelize[_0x7583('0x4')]},'transfererexten':{'type':Sequelize[_0x7583('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x7583('0x4')]},'transfereechannel':{'type':Sequelize[_0x7583('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x7583('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x7583('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x7583('0x4')]},'transfereecontext':{'type':Sequelize[_0x7583('0x4')]},'transfereeexten':{'type':Sequelize[_0x7583('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x7583('0x4')]},'isexternal':{'type':Sequelize[_0x7583('0x5')](_0x7583('0x6'),'No')},'context':{'type':Sequelize[_0x7583('0x4')]},'extension':{'type':Sequelize[_0x7583('0x4')]}}; \ No newline at end of file +var _0x20f3=['Yes','sequelize','moment','exports','ENUM','blind','attended','STRING'];(function(_0x4683b5,_0x51a68c){var _0x1f23aa=function(_0x2d8316){while(--_0x2d8316){_0x4683b5['push'](_0x4683b5['shift']());}};_0x1f23aa(++_0x51a68c);}(_0x20f3,0x149));var _0x320f=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x20f3[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0x320f('0x0'));var moment=require(_0x320f('0x1'));module[_0x320f('0x2')]={'type':{'type':Sequelize[_0x320f('0x3')](_0x320f('0x4'),_0x320f('0x5'))},'result':{'type':Sequelize[_0x320f('0x6')]},'transfererchannel':{'type':Sequelize[_0x320f('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x320f('0x6')]},'transferercalleridname':{'type':Sequelize[_0x320f('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x320f('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x320f('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x320f('0x6')]},'transferercontext':{'type':Sequelize[_0x320f('0x6')]},'transfererexten':{'type':Sequelize[_0x320f('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x320f('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x320f('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x320f('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x320f('0x6')]},'isexternal':{'type':Sequelize[_0x320f('0x3')](_0x320f('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 77817a4..00a0570 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 _0x9d77=['reject','then','destroy','sendStatus','name','send','index','map','VoiceTransferReport','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','undefined','count','offset','limit','status','set','Content-Range','apply'];(function(_0x1d0de6,_0x3c2621){var _0x2fa79f=function(_0x1e9418){while(--_0x1e9418){_0x1d0de6['push'](_0x1d0de6['shift']());}};_0x2fa79f(++_0x3c2621);}(_0x9d77,0x19c));var _0x79d7=function(_0x2ae961,_0x4b4af1){_0x2ae961=_0x2ae961-0x0;var _0x27069e=_0x9d77[_0x2ae961];return _0x27069e;};'use strict';var emlformat=require(_0x79d7('0x0'));var rimraf=require(_0x79d7('0x1'));var zipdir=require(_0x79d7('0x2'));var jsonpatch=require(_0x79d7('0x3'));var rp=require(_0x79d7('0x4'));var moment=require('moment');var BPromise=require(_0x79d7('0x5'));var Mustache=require('mustache');var util=require(_0x79d7('0x6'));var path=require(_0x79d7('0x7'));var sox=require(_0x79d7('0x8'));var csv=require(_0x79d7('0x9'));var ejs=require(_0x79d7('0xa'));var fs=require('fs');var fs_extra=require(_0x79d7('0xb'));var _=require(_0x79d7('0xc'));var squel=require(_0x79d7('0xd'));var crypto=require('crypto');var jsforce=require(_0x79d7('0xe'));var deskjs=require(_0x79d7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x79d7('0x10'));var Papa=require(_0x79d7('0x11'));var Redis=require(_0x79d7('0x12'));var authService=require(_0x79d7('0x13'));var qs=require(_0x79d7('0x14'));var as=require(_0x79d7('0x15'));var hardwareService=require(_0x79d7('0x16'));var logger=require(_0x79d7('0x17'))(_0x79d7('0x18'));var utils=require(_0x79d7('0x19'));var config=require(_0x79d7('0x1a'));var licenseUtil=require(_0x79d7('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59850b,_0x46ba85){_0x46ba85=_0x46ba85||0xcc;return function(_0x43787a){if(_0x43787a){return _0x59850b['sendStatus'](_0x46ba85);}return _0x59850b['status'](_0x46ba85)[_0x79d7('0x1c')]();};}function respondWithResult(_0x2ee9ee,_0x53eef4){_0x53eef4=_0x53eef4||0xc8;return function(_0x20a814){if(_0x20a814){return _0x2ee9ee['status'](_0x53eef4)[_0x79d7('0x1d')](_0x20a814);}};}function respondWithFilteredResult(_0x37e35b,_0x435ac1){return function(_0x5b33f2){if(_0x5b33f2){var _0x2a1b0e=typeof _0x435ac1['offset']===_0x79d7('0x1e')&&typeof _0x435ac1['limit']===_0x79d7('0x1e');var _0x55ba81=_0x5b33f2[_0x79d7('0x1f')];var _0x47b2e5=_0x2a1b0e?0x0:_0x435ac1[_0x79d7('0x20')];var _0x335618=_0x2a1b0e?_0x5b33f2['count']:_0x435ac1[_0x79d7('0x20')]+_0x435ac1[_0x79d7('0x21')];var _0x397a9d;if(_0x335618>=_0x55ba81){_0x335618=_0x55ba81;_0x397a9d=0xc8;}else{_0x397a9d=0xce;}_0x37e35b[_0x79d7('0x22')](_0x397a9d);return _0x37e35b[_0x79d7('0x23')](_0x79d7('0x24'),_0x47b2e5+'-'+_0x335618+'/'+_0x55ba81)[_0x79d7('0x1d')](_0x5b33f2);}return null;};}function patchUpdates(_0x1a7a62){return function(_0x505ce4){try{jsonpatch[_0x79d7('0x25')](_0x505ce4,_0x1a7a62,!![]);}catch(_0x40f158){return BPromise[_0x79d7('0x26')](_0x40f158);}return _0x505ce4['save']();};}function saveUpdates(_0xd5a57e,_0x28d888){return function(_0x55b3ea){if(_0x55b3ea){return _0x55b3ea['update'](_0xd5a57e)[_0x79d7('0x27')](function(_0x25326f){return _0x25326f;});}return null;};}function removeEntity(_0x554467,_0x30eeba){return function(_0x3aa12e){if(_0x3aa12e){return _0x3aa12e[_0x79d7('0x28')]()['then'](function(){_0x554467[_0x79d7('0x22')](0xcc)[_0x79d7('0x1c')]();});}};}function handleEntityNotFound(_0xb33faf,_0x416e5f){return function(_0x307342){if(!_0x307342){_0xb33faf[_0x79d7('0x29')](0x194);}return _0x307342;};}function handleError(_0x5ef431,_0x55dad5){_0x55dad5=_0x55dad5||0x1f4;return function(_0x5c5888){logger['error'](_0x5c5888['stack']);if(_0x5c5888[_0x79d7('0x2a')]){delete _0x5c5888[_0x79d7('0x2a')];}_0x5ef431[_0x79d7('0x22')](_0x55dad5)[_0x79d7('0x2b')](_0x5c5888);};}exports[_0x79d7('0x2c')]=function(_0x126dd7,_0x2daad6){var _0x3c36ee={},_0x27a977={},_0x2309db={'count':0x0,'rows':[]};var _0xb1be20=_[_0x79d7('0x2d')](db[_0x79d7('0x2e')]['rawAttributes'],function(_0xe05ac7){return{'name':_0xe05ac7['fieldName'],'type':_0xe05ac7['type']['key']};});_0x27a977[_0x79d7('0x2f')]=_[_0x79d7('0x2d')](_0xb1be20,_0x79d7('0x2a'));_0x27a977['query']=_[_0x79d7('0x30')](_0x126dd7[_0x79d7('0x31')]);_0x27a977[_0x79d7('0x32')]=_[_0x79d7('0x33')](_0x27a977['model'],_0x27a977[_0x79d7('0x31')]);_0x3c36ee[_0x79d7('0x34')]=_[_0x79d7('0x33')](_0x27a977['model'],qs[_0x79d7('0x35')](_0x126dd7[_0x79d7('0x31')][_0x79d7('0x35')]));_0x3c36ee[_0x79d7('0x34')]=_0x3c36ee[_0x79d7('0x34')][_0x79d7('0x36')]?_0x3c36ee[_0x79d7('0x34')]:_0x27a977[_0x79d7('0x2f')];if(!_0x126dd7[_0x79d7('0x31')][_0x79d7('0x37')](_0x79d7('0x38'))){_0x3c36ee[_0x79d7('0x21')]=qs[_0x79d7('0x21')](_0x126dd7['query'][_0x79d7('0x21')]);_0x3c36ee[_0x79d7('0x20')]=qs[_0x79d7('0x20')](_0x126dd7[_0x79d7('0x31')]['offset']);}_0x3c36ee[_0x79d7('0x39')]=qs[_0x79d7('0x3a')](_0x126dd7['query']['sort']);_0x3c36ee[_0x79d7('0x3b')]=qs['filters'](_[_0x79d7('0x3c')](_0x126dd7['query'],_0x27a977[_0x79d7('0x32')]),_0xb1be20);if(_0x126dd7[_0x79d7('0x31')][_0x79d7('0x3d')]){_0x3c36ee['where']=_[_0x79d7('0x3e')](_0x3c36ee[_0x79d7('0x3b')],{'$or':_[_0x79d7('0x2d')](_0xb1be20,function(_0x58ec4a){if(_0x58ec4a['type']!==_0x79d7('0x3f')){var _0x600774={};_0x600774[_0x58ec4a['name']]={'$like':'%'+_0x126dd7[_0x79d7('0x31')][_0x79d7('0x3d')]+'%'};return _0x600774;}})});}_0x3c36ee=_[_0x79d7('0x3e')]({},_0x3c36ee,_0x126dd7['options']);var _0x5eeee8={'where':_0x3c36ee[_0x79d7('0x3b')]};return db[_0x79d7('0x2e')][_0x79d7('0x1f')](_0x5eeee8)[_0x79d7('0x27')](function(_0xed75c0){_0x2309db[_0x79d7('0x1f')]=_0xed75c0;if(_0x126dd7[_0x79d7('0x31')]['includeAll']){_0x3c36ee[_0x79d7('0x40')]=[{'all':!![]}];}return db[_0x79d7('0x2e')][_0x79d7('0x41')](_0x3c36ee);})['then'](function(_0x5c4ed0){_0x2309db['rows']=_0x5c4ed0;return _0x2309db;})[_0x79d7('0x27')](respondWithFilteredResult(_0x2daad6,_0x3c36ee))[_0x79d7('0x42')](handleError(_0x2daad6,null));};exports[_0x79d7('0x43')]=function(_0x25508d,_0x1db158){var _0x53a436={'raw':!![],'where':{'id':_0x25508d[_0x79d7('0x44')]['id']}},_0x2901c7={};_0x2901c7[_0x79d7('0x2f')]=_[_0x79d7('0x30')](db['VoiceTransferReport']['rawAttributes']);_0x2901c7[_0x79d7('0x31')]=_[_0x79d7('0x30')](_0x25508d['query']);_0x2901c7[_0x79d7('0x32')]=_['intersection'](_0x2901c7[_0x79d7('0x2f')],_0x2901c7[_0x79d7('0x31')]);_0x53a436[_0x79d7('0x34')]=_[_0x79d7('0x33')](_0x2901c7[_0x79d7('0x2f')],qs[_0x79d7('0x35')](_0x25508d[_0x79d7('0x31')][_0x79d7('0x35')]));_0x53a436[_0x79d7('0x34')]=_0x53a436[_0x79d7('0x34')][_0x79d7('0x36')]?_0x53a436[_0x79d7('0x34')]:_0x2901c7['model'];if(_0x25508d[_0x79d7('0x31')]['includeAll']){_0x53a436['include']=[{'all':!![]}];}_0x53a436=_[_0x79d7('0x3e')]({},_0x53a436,_0x25508d[_0x79d7('0x45')]);return db[_0x79d7('0x2e')][_0x79d7('0x46')](_0x53a436)[_0x79d7('0x27')](handleEntityNotFound(_0x1db158,null))['then'](respondWithResult(_0x1db158,null))[_0x79d7('0x42')](handleError(_0x1db158,null));};exports['create']=function(_0x4d71f4,_0x29396a){return db[_0x79d7('0x2e')][_0x79d7('0x47')](_0x4d71f4[_0x79d7('0x48')],{})[_0x79d7('0x27')](respondWithResult(_0x29396a,0xc9))[_0x79d7('0x42')](handleError(_0x29396a,null));};exports[_0x79d7('0x49')]=function(_0x9c57d,_0x53cb81){if(_0x9c57d['body']['id']){delete _0x9c57d[_0x79d7('0x48')]['id'];}return db[_0x79d7('0x2e')]['find']({'where':{'id':_0x9c57d[_0x79d7('0x44')]['id']}})[_0x79d7('0x27')](handleEntityNotFound(_0x53cb81,null))[_0x79d7('0x27')](saveUpdates(_0x9c57d[_0x79d7('0x48')],null))[_0x79d7('0x27')](respondWithResult(_0x53cb81,null))[_0x79d7('0x42')](handleError(_0x53cb81,null));};exports['destroy']=function(_0x6c4243,_0x11d5f3){return db['VoiceTransferReport'][_0x79d7('0x46')]({'where':{'id':_0x6c4243[_0x79d7('0x44')]['id']}})[_0x79d7('0x27')](handleEntityNotFound(_0x11d5f3,null))[_0x79d7('0x27')](removeEntity(_0x11d5f3,null))[_0x79d7('0x42')](handleError(_0x11d5f3,null));};exports[_0x79d7('0x4a')]=function(_0x3187a0,_0x6a976e){return db[_0x79d7('0x2e')]['describe']()['then'](respondWithResult(_0x6a976e,null))[_0x79d7('0x42')](handleError(_0x6a976e,null));}; \ No newline at end of file +var _0x976b=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','count','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','VoiceTransferReport','fieldName','key','model','query'];(function(_0x979bfa,_0x3dc593){var _0x288866=function(_0x134d5c){while(--_0x134d5c){_0x979bfa['push'](_0x979bfa['shift']());}};_0x288866(++_0x3dc593);}(_0x976b,0xfd));var _0xb976=function(_0x6620ce,_0xbf690){_0x6620ce=_0x6620ce-0x0;var _0x31c9c7=_0x976b[_0x6620ce];return _0x31c9c7;};'use strict';var emlformat=require(_0xb976('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb976('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb976('0x2'));var moment=require(_0xb976('0x3'));var BPromise=require(_0xb976('0x4'));var Mustache=require(_0xb976('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb976('0x6'));var csv=require('to-csv');var ejs=require(_0xb976('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb976('0x8'));var crypto=require('crypto');var jsforce=require(_0xb976('0x9'));var deskjs=require(_0xb976('0xa'));var toCsv=require(_0xb976('0xb'));var querystring=require(_0xb976('0xc'));var Papa=require(_0xb976('0xd'));var Redis=require(_0xb976('0xe'));var authService=require(_0xb976('0xf'));var qs=require(_0xb976('0x10'));var as=require(_0xb976('0x11'));var hardwareService=require(_0xb976('0x12'));var logger=require(_0xb976('0x13'))('api');var utils=require(_0xb976('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb976('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41184f,_0x41d2f2){_0x41d2f2=_0x41d2f2||0xcc;return function(_0x2f18df){if(_0x2f18df){return _0x41184f[_0xb976('0x16')](_0x41d2f2);}return _0x41184f['status'](_0x41d2f2)[_0xb976('0x17')]();};}function respondWithResult(_0x72f6a5,_0x2ccd0f){_0x2ccd0f=_0x2ccd0f||0xc8;return function(_0x4d8aa1){if(_0x4d8aa1){return _0x72f6a5[_0xb976('0x18')](_0x2ccd0f)[_0xb976('0x19')](_0x4d8aa1);}};}function respondWithFilteredResult(_0x536e35,_0x26b76d){return function(_0x3003eb){if(_0x3003eb){var _0x141b4e=typeof _0x26b76d[_0xb976('0x1a')]===_0xb976('0x1b')&&typeof _0x26b76d[_0xb976('0x1c')]===_0xb976('0x1b');var _0x1f138c=_0x3003eb['count'];var _0x1520d9=_0x141b4e?0x0:_0x26b76d[_0xb976('0x1a')];var _0x27aaee=_0x141b4e?_0x3003eb['count']:_0x26b76d['offset']+_0x26b76d[_0xb976('0x1c')];var _0x3dfc2d;if(_0x27aaee>=_0x1f138c){_0x27aaee=_0x1f138c;_0x3dfc2d=0xc8;}else{_0x3dfc2d=0xce;}_0x536e35[_0xb976('0x18')](_0x3dfc2d);return _0x536e35[_0xb976('0x1d')](_0xb976('0x1e'),_0x1520d9+'-'+_0x27aaee+'/'+_0x1f138c)[_0xb976('0x19')](_0x3003eb);}return null;};}function patchUpdates(_0x27ec26){return function(_0x427b0b){try{jsonpatch[_0xb976('0x1f')](_0x427b0b,_0x27ec26,!![]);}catch(_0x51c634){return BPromise[_0xb976('0x20')](_0x51c634);}return _0x427b0b[_0xb976('0x21')]();};}function saveUpdates(_0x149c3b,_0x1e4147){return function(_0x13adbe){if(_0x13adbe){return _0x13adbe[_0xb976('0x22')](_0x149c3b)[_0xb976('0x23')](function(_0x334ef7){return _0x334ef7;});}return null;};}function removeEntity(_0x44b004,_0x557119){return function(_0x7116f){if(_0x7116f){return _0x7116f[_0xb976('0x24')]()['then'](function(){_0x44b004[_0xb976('0x18')](0xcc)[_0xb976('0x17')]();});}};}function handleEntityNotFound(_0x363fb8,_0xab2e3c){return function(_0x893e35){if(!_0x893e35){_0x363fb8[_0xb976('0x16')](0x194);}return _0x893e35;};}function handleError(_0x507974,_0x5861a0){_0x5861a0=_0x5861a0||0x1f4;return function(_0x47a8fc){logger['error'](_0x47a8fc[_0xb976('0x25')]);if(_0x47a8fc[_0xb976('0x26')]){delete _0x47a8fc[_0xb976('0x26')];}_0x507974[_0xb976('0x18')](_0x5861a0)[_0xb976('0x27')](_0x47a8fc);};}exports[_0xb976('0x28')]=function(_0x2c9fb9,_0x157c94){var _0x236ee2={},_0x290704={},_0x1de002={'count':0x0,'rows':[]};var _0x53b286=_[_0xb976('0x29')](db[_0xb976('0x2a')]['rawAttributes'],function(_0x5921a9){return{'name':_0x5921a9[_0xb976('0x2b')],'type':_0x5921a9['type'][_0xb976('0x2c')]};});_0x290704[_0xb976('0x2d')]=_[_0xb976('0x29')](_0x53b286,_0xb976('0x26'));_0x290704[_0xb976('0x2e')]=_[_0xb976('0x2f')](_0x2c9fb9[_0xb976('0x2e')]);_0x290704[_0xb976('0x30')]=_['intersection'](_0x290704['model'],_0x290704[_0xb976('0x2e')]);_0x236ee2[_0xb976('0x31')]=_[_0xb976('0x32')](_0x290704[_0xb976('0x2d')],qs[_0xb976('0x33')](_0x2c9fb9[_0xb976('0x2e')]['fields']));_0x236ee2[_0xb976('0x31')]=_0x236ee2[_0xb976('0x31')][_0xb976('0x34')]?_0x236ee2[_0xb976('0x31')]:_0x290704['model'];if(!_0x2c9fb9[_0xb976('0x2e')][_0xb976('0x35')](_0xb976('0x36'))){_0x236ee2[_0xb976('0x1c')]=qs['limit'](_0x2c9fb9[_0xb976('0x2e')]['limit']);_0x236ee2[_0xb976('0x1a')]=qs[_0xb976('0x1a')](_0x2c9fb9[_0xb976('0x2e')][_0xb976('0x1a')]);}_0x236ee2[_0xb976('0x37')]=qs[_0xb976('0x38')](_0x2c9fb9[_0xb976('0x2e')][_0xb976('0x38')]);_0x236ee2['where']=qs['filters'](_[_0xb976('0x39')](_0x2c9fb9[_0xb976('0x2e')],_0x290704[_0xb976('0x30')]),_0x53b286);if(_0x2c9fb9[_0xb976('0x2e')][_0xb976('0x3a')]){_0x236ee2[_0xb976('0x3b')]=_[_0xb976('0x3c')](_0x236ee2[_0xb976('0x3b')],{'$or':_[_0xb976('0x29')](_0x53b286,function(_0x7c613d){if(_0x7c613d[_0xb976('0x3d')]!=='VIRTUAL'){var _0x11b132={};_0x11b132[_0x7c613d['name']]={'$like':'%'+_0x2c9fb9[_0xb976('0x2e')][_0xb976('0x3a')]+'%'};return _0x11b132;}})});}_0x236ee2=_[_0xb976('0x3c')]({},_0x236ee2,_0x2c9fb9[_0xb976('0x3e')]);var _0x499b6f={'where':_0x236ee2[_0xb976('0x3b')]};return db[_0xb976('0x2a')][_0xb976('0x3f')](_0x499b6f)[_0xb976('0x23')](function(_0x29deaf){_0x1de002[_0xb976('0x3f')]=_0x29deaf;if(_0x2c9fb9[_0xb976('0x2e')][_0xb976('0x40')]){_0x236ee2[_0xb976('0x41')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x236ee2);})[_0xb976('0x23')](function(_0x41873c){_0x1de002[_0xb976('0x42')]=_0x41873c;return _0x1de002;})['then'](respondWithFilteredResult(_0x157c94,_0x236ee2))[_0xb976('0x43')](handleError(_0x157c94,null));};exports[_0xb976('0x44')]=function(_0x2c6f24,_0x56118c){var _0x23ed2e={'raw':!![],'where':{'id':_0x2c6f24[_0xb976('0x45')]['id']}},_0x26af8b={};_0x26af8b[_0xb976('0x2d')]=_[_0xb976('0x2f')](db[_0xb976('0x2a')][_0xb976('0x46')]);_0x26af8b['query']=_[_0xb976('0x2f')](_0x2c6f24['query']);_0x26af8b[_0xb976('0x30')]=_[_0xb976('0x32')](_0x26af8b[_0xb976('0x2d')],_0x26af8b[_0xb976('0x2e')]);_0x23ed2e[_0xb976('0x31')]=_[_0xb976('0x32')](_0x26af8b[_0xb976('0x2d')],qs[_0xb976('0x33')](_0x2c6f24[_0xb976('0x2e')][_0xb976('0x33')]));_0x23ed2e[_0xb976('0x31')]=_0x23ed2e['attributes'][_0xb976('0x34')]?_0x23ed2e[_0xb976('0x31')]:_0x26af8b[_0xb976('0x2d')];if(_0x2c6f24[_0xb976('0x2e')][_0xb976('0x40')]){_0x23ed2e[_0xb976('0x41')]=[{'all':!![]}];}_0x23ed2e=_[_0xb976('0x3c')]({},_0x23ed2e,_0x2c6f24[_0xb976('0x3e')]);return db[_0xb976('0x2a')][_0xb976('0x47')](_0x23ed2e)[_0xb976('0x23')](handleEntityNotFound(_0x56118c,null))[_0xb976('0x23')](respondWithResult(_0x56118c,null))[_0xb976('0x43')](handleError(_0x56118c,null));};exports[_0xb976('0x48')]=function(_0x5795f4,_0x5eba30){return db[_0xb976('0x2a')][_0xb976('0x48')](_0x5795f4[_0xb976('0x49')],{})['then'](respondWithResult(_0x5eba30,0xc9))[_0xb976('0x43')](handleError(_0x5eba30,null));};exports[_0xb976('0x22')]=function(_0x33a99d,_0x8b10fa){if(_0x33a99d[_0xb976('0x49')]['id']){delete _0x33a99d[_0xb976('0x49')]['id'];}return db[_0xb976('0x2a')][_0xb976('0x47')]({'where':{'id':_0x33a99d[_0xb976('0x45')]['id']}})['then'](handleEntityNotFound(_0x8b10fa,null))['then'](saveUpdates(_0x33a99d[_0xb976('0x49')],null))[_0xb976('0x23')](respondWithResult(_0x8b10fa,null))[_0xb976('0x43')](handleError(_0x8b10fa,null));};exports[_0xb976('0x24')]=function(_0x120567,_0x1fdcfc){return db[_0xb976('0x2a')][_0xb976('0x47')]({'where':{'id':_0x120567[_0xb976('0x45')]['id']}})[_0xb976('0x23')](handleEntityNotFound(_0x1fdcfc,null))[_0xb976('0x23')](removeEntity(_0x1fdcfc,null))[_0xb976('0x43')](handleError(_0x1fdcfc,null));};exports[_0xb976('0x4a')]=function(_0x2e051b,_0x52eb18){return db[_0xb976('0x2a')]['describe']()[_0xb976('0x23')](respondWithResult(_0x52eb18,null))['catch'](handleError(_0x52eb18,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 626ac18..c2ab99d 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 _0xa98b=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','path'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xa98b,0x9c));var _0xba98=function(_0x5536dc,_0x55c058){_0x5536dc=_0x5536dc-0x0;var _0x1b5732=_0xa98b[_0x5536dc];return _0x1b5732;};'use strict';var _=require(_0xba98('0x0'));var util=require(_0xba98('0x1'));var logger=require(_0xba98('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xba98('0x3'));var rimraf=require(_0xba98('0x4'));var config=require(_0xba98('0x5'));var attributes=require(_0xba98('0x6'));module[_0xba98('0x7')]=function(_0x4e9ebc,_0x5e5eda){return _0x4e9ebc['define'](_0xba98('0x8'),attributes,{'tableName':_0xba98('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91be=['api','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x2bcf5e,_0x5d9059){var _0x94e486=function(_0x24344f){while(--_0x24344f){_0x2bcf5e['push'](_0x2bcf5e['shift']());}};_0x94e486(++_0x5d9059);}(_0x91be,0x9a));var _0xe91b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x91be[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe91b('0x0'));var util=require(_0xe91b('0x1'));var logger=require('../../config/logger')(_0xe91b('0x2'));var moment=require('moment');var BPromise=require(_0xe91b('0x3'));var rp=require(_0xe91b('0x4'));var fs=require('fs');var path=require(_0xe91b('0x5'));var rimraf=require('rimraf');var config=require(_0xe91b('0x6'));var attributes=require(_0xe91b('0x7'));module[_0xe91b('0x8')]=function(_0x4b5e3d,_0x1f6cd5){return _0x4b5e3d[_0xe91b('0x9')](_0xe91b('0xa'),attributes,{'tableName':_0xe91b('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 3a695f6..1399909 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 _0xa9d3=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','info','catch','CreateVoiceTransferReport','create','body','options','debug','lodash','util','bluebird'];(function(_0x1f938f,_0x51c241){var _0x5d701f=function(_0x45dd69){while(--_0x45dd69){_0x1f938f['push'](_0x1f938f['shift']());}};_0x5d701f(++_0x51c241);}(_0xa9d3,0xed));var _0x3a9d=function(_0x51fa03,_0x54a6){_0x51fa03=_0x51fa03-0x0;var _0x1c19af=_0xa9d3[_0x51fa03];return _0x1c19af;};'use strict';var _=require(_0x3a9d('0x0'));var util=require(_0x3a9d('0x1'));var moment=require('moment');var BPromise=require(_0x3a9d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a9d('0x3'))['db'];var utils=require(_0x3a9d('0x4'));var logger=require(_0x3a9d('0x5'))(_0x3a9d('0x6'));var config=require('../../config/environment');var jayson=require(_0x3a9d('0x7'));var client=jayson[_0x3a9d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x426d67,_0x21f745,_0x3a4363){return new BPromise(function(_0x4cad1f,_0x3c96e0){return client['request'](_0x426d67,_0x3a4363)[_0x3a9d('0x9')](function(_0x1779a8){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x21f745,_0x3a9d('0xa'));logger['debug'](_0x3a9d('0xb'),_0x21f745,_0x3a9d('0xa'),JSON[_0x3a9d('0xc')](_0x1779a8));if(_0x1779a8['error']){if(_0x1779a8[_0x3a9d('0xd')][_0x3a9d('0xe')]===0x1f4){logger[_0x3a9d('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x21f745,_0x1779a8[_0x3a9d('0xd')][_0x3a9d('0xf')]);return _0x3c96e0(_0x1779a8[_0x3a9d('0xd')]['message']);}logger[_0x3a9d('0xd')](_0x3a9d('0x10'),_0x21f745,_0x1779a8['error']['message']);return _0x4cad1f(_0x1779a8[_0x3a9d('0xd')][_0x3a9d('0xf')]);}else{logger[_0x3a9d('0x11')](_0x3a9d('0x10'),_0x21f745,_0x3a9d('0xa'));_0x4cad1f(_0x1779a8['result']['message']);}})[_0x3a9d('0x12')](function(_0x2e19a9){logger[_0x3a9d('0xd')](_0x3a9d('0x10'),_0x21f745,_0x2e19a9);_0x3c96e0(_0x2e19a9);});});}exports[_0x3a9d('0x13')]=function(_0x1bffbf){var _0x2caecb=this;return new Promise(function(_0x2acf86,_0x143b5f){return db['VoiceTransferReport'][_0x3a9d('0x14')](_0x1bffbf[_0x3a9d('0x15')],{'raw':_0x1bffbf['options']?_0x1bffbf[_0x3a9d('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x145c57){logger['info'](_0x3a9d('0x13'),_0x1bffbf);logger[_0x3a9d('0x17')](_0x3a9d('0x13'),_0x1bffbf,JSON[_0x3a9d('0xc')](_0x145c57));_0x2acf86(_0x145c57);})[_0x3a9d('0x12')](function(_0x5a3c9a){logger[_0x3a9d('0xd')]('CreateVoiceTransferReport',_0x5a3c9a[_0x3a9d('0xf')],_0x1bffbf);_0x143b5f(_0x2caecb[_0x3a9d('0xd')](0x1f4,_0x5a3c9a[_0x3a9d('0xf')]));});});}; \ No newline at end of file +var _0xc7bf=['stringify','code','error','message','request\x20sent','result','catch','body','options','raw','CreateVoiceTransferReport','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xc7bf,0xff));var _0xfc7b=function(_0x3459d4,_0x51c957){_0x3459d4=_0x3459d4-0x0;var _0x47aed1=_0xc7bf[_0x3459d4];return _0x47aed1;};'use strict';var _=require(_0xfc7b('0x0'));var util=require(_0xfc7b('0x1'));var moment=require(_0xfc7b('0x2'));var BPromise=require(_0xfc7b('0x3'));var rs=require(_0xfc7b('0x4'));var fs=require('fs');var Redis=require(_0xfc7b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc7b('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfc7b('0x7'));var jayson=require(_0xfc7b('0x8'));var client=jayson[_0xfc7b('0x9')][_0xfc7b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x111a65,_0x2c53e2,_0x48e33b){return new BPromise(function(_0x394596,_0x4165f3){return client[_0xfc7b('0xb')](_0x111a65,_0x48e33b)[_0xfc7b('0xc')](function(_0x5af32b){logger[_0xfc7b('0xd')](_0xfc7b('0xe'),_0x2c53e2,'request\x20sent');logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x2c53e2,'request\x20sent',JSON[_0xfc7b('0xf')](_0x5af32b));if(_0x5af32b['error']){if(_0x5af32b['error'][_0xfc7b('0x10')]===0x1f4){logger['error'](_0xfc7b('0xe'),_0x2c53e2,_0x5af32b[_0xfc7b('0x11')][_0xfc7b('0x12')]);return _0x4165f3(_0x5af32b['error'][_0xfc7b('0x12')]);}logger[_0xfc7b('0x11')](_0xfc7b('0xe'),_0x2c53e2,_0x5af32b[_0xfc7b('0x11')][_0xfc7b('0x12')]);return _0x394596(_0x5af32b['error'][_0xfc7b('0x12')]);}else{logger[_0xfc7b('0xd')](_0xfc7b('0xe'),_0x2c53e2,_0xfc7b('0x13'));_0x394596(_0x5af32b[_0xfc7b('0x14')]['message']);}})[_0xfc7b('0x15')](function(_0x5210ee){logger[_0xfc7b('0x11')](_0xfc7b('0xe'),_0x2c53e2,_0x5210ee);_0x4165f3(_0x5210ee);});});}exports['CreateVoiceTransferReport']=function(_0x3d8525){var _0x2da99f=this;return new Promise(function(_0xabcdc,_0x12a2e1){return db['VoiceTransferReport']['create'](_0x3d8525[_0xfc7b('0x16')],{'raw':_0x3d8525[_0xfc7b('0x17')]?_0x3d8525['options'][_0xfc7b('0x18')]===undefined?!![]:![]:!![]})[_0xfc7b('0xc')](function(_0xc3cab1){logger['info'](_0xfc7b('0x19'),_0x3d8525);logger[_0xfc7b('0x1a')](_0xfc7b('0x19'),_0x3d8525,JSON[_0xfc7b('0xf')](_0xc3cab1));_0xabcdc(_0xc3cab1);})[_0xfc7b('0x15')](function(_0x30737d){logger[_0xfc7b('0x11')](_0xfc7b('0x19'),_0x30737d['message'],_0x3d8525);_0x12a2e1(_0x2da99f[_0xfc7b('0x11')](0x1f4,_0x30737d[_0xfc7b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index b9b13b9..2ef2d76 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 _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb43b,0x1b2));var _0xbb43=function(_0x752d82,_0x557042){_0x752d82=_0x752d82-0x0;var _0x1656d1=_0xb43b[_0x752d82];return _0x1656d1;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5b02=['Router','../../components/auth/service','./webbar.controller','isAuthenticated','originate','post','/hangup','isWebrtcLicence','/answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express'];(function(_0x179d7e,_0x2a078b){var _0x197c9a=function(_0x4f7151){while(--_0x4f7151){_0x179d7e['push'](_0x179d7e['shift']());}};_0x197c9a(++_0x2a078b);}(_0x5b02,0xe9));var _0x25b0=function(_0xc8a62b,_0x92ac22){_0xc8a62b=_0xc8a62b-0x0;var _0x7a38a6=_0x5b02[_0xc8a62b];return _0x7a38a6;};'use strict';var express=require(_0x25b0('0x0'));var router=express[_0x25b0('0x1')]();var auth=require(_0x25b0('0x2'));var controller=require(_0x25b0('0x3'));router['post']('/originate',auth[_0x25b0('0x4')](),auth['isWebrtcLicence'](),controller[_0x25b0('0x5')]);router[_0x25b0('0x6')](_0x25b0('0x7'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hangup']);router[_0x25b0('0x6')](_0x25b0('0x9'),auth['isAuthenticated'](),auth[_0x25b0('0x8')](),controller['answer']);router['post'](_0x25b0('0xa'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller['hold']);router[_0x25b0('0x6')](_0x25b0('0xb'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xc')]);router[_0x25b0('0x6')](_0x25b0('0xd'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0xe')]);router[_0x25b0('0x6')](_0x25b0('0xf'),auth[_0x25b0('0x4')](),auth[_0x25b0('0x8')](),controller[_0x25b0('0x10')]);module[_0x25b0('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 114cec4..c5430b8 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 _0x1b73=['unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','VoiceChannels','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','jayson/promise','http','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','User','findOne','agent','all','filter','rows','UserId','sessionId','\x20not\x20found!','originate','body','length','callerId','callbackUrl','entityFound:','format','user:%s','json','originate\x20executed!','catch','hangup','hangup\x20fired:','hangup\x20executed!','answer','userId','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!'];(function(_0x1c3124,_0x218186){var _0x23477a=function(_0x34df96){while(--_0x34df96){_0x1c3124['push'](_0x1c3124['shift']());}};_0x23477a(++_0x218186);}(_0x1b73,0x1d5));var _0x31b7=function(_0x2a2140,_0xc95391){_0x2a2140=_0x2a2140-0x0;var _0x4d4d2b=_0x1b73[_0x2a2140];return _0x4d4d2b;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x31b7('0x0'));var db=require(_0x31b7('0x1'))['db'];var config=require(_0x31b7('0x2'));var util=require(_0x31b7('0x3'));var BPromise=require('bluebird');var jayson=require(_0x31b7('0x4'));var amiClient=jayson['client'][_0x31b7('0x5')]({'port':0x232a});var logger=require(_0x31b7('0x6'))('webbarapi');var Redis=require(_0x31b7('0x7'));config[_0x31b7('0x8')]=_[_0x31b7('0x9')](config['redis'],{'host':_0x31b7('0xa'),'port':0x18eb});var io=require(_0x31b7('0xb'))(new Redis(config[_0x31b7('0x8')]));var Schema=require(_0x31b7('0xc'));var originateValidation=new Schema({'userId':{'type':_0x31b7('0xd'),'required':[!![],_0x31b7('0xe')]},'callNumber':{'type':_0x31b7('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x31b7('0xf')},'callbackUrl':{'type':_0x31b7('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x31b7('0xd'),'required':[!![],_0x31b7('0xe')]},'sessionId':{'type':_0x31b7('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x31b7('0xd'),'required':[!![],_0x31b7('0xe')]},'sessionId':{'type':_0x31b7('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x31b7('0xd'),'required':[!![],_0x31b7('0xe')]},'sessionId':{'type':'string','required':[!![],_0x31b7('0x10')]},'transferNumber':{'type':_0x31b7('0xf'),'required':[!![],_0x31b7('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x31b7('0xd'),'required':[!![],_0x31b7('0xe')]},'sessionId':{'type':_0x31b7('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x31b7('0xd'),'required':[!![],_0x31b7('0xe')]},'sessionId':{'type':_0x31b7('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x31b7('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x31b7('0xe')]}});function emit(_0xf213c9,_0x48f733,_0x15df1d){logger[_0x31b7('0x12')](_0xf213c9,_0x48f733,JSON[_0x31b7('0x13')](_0x15df1d));io['to'](_0xf213c9)[_0x31b7('0x14')](_0x48f733,_0x15df1d);}function handleError(_0x3daf67){return function(_0x5f3245){console[_0x31b7('0x15')](_0x31b7('0x16'),_0x5f3245,_0x5f3245 instanceof RangeError);logger[_0x31b7('0x17')](_0x5f3245[_0x31b7('0x18')]);if(_0x5f3245 instanceof RangeError){if(_0x5f3245[_0x31b7('0x19')]){delete _0x5f3245['name'];}_0x3daf67[_0x31b7('0x1a')](0x194)[_0x31b7('0x1b')](_0x5f3245);}else{if(_0x5f3245[_0x31b7('0x19')]){delete _0x5f3245[_0x31b7('0x19')];}_0x3daf67['status'](0x1f4)[_0x31b7('0x1b')](_0x5f3245);}};}function checkError(){return function(_0x15a20c){if(!_0x15a20c){throw new RangeError(_0x31b7('0x1c'));}return _0x15a20c;};}function respondWithRpcPromise(_0x2e4a56,_0x4d4368){return new BPromise(function(_0x33dd04,_0x20cb03){var _0x250574=amiClient;return _0x250574[_0x31b7('0x1d')](_0x2e4a56,_0x4d4368)[_0x31b7('0x1e')](function(_0x2d24bf){if(_0x2d24bf[_0x31b7('0x17')]){if(_0x2d24bf[_0x31b7('0x17')][_0x31b7('0x1f')]===0x1f4){return _0x20cb03(_0x2d24bf['error'][_0x31b7('0x20')]);}return _0x33dd04(_0x2d24bf[_0x31b7('0x17')][_0x31b7('0x20')]);}else{_0x33dd04(_0x2d24bf[_0x31b7('0x21')]);}})['catch'](function(_0xb8a998){_0x20cb03(_0xb8a998);});});}function getAgent(_0x516b89){return db[_0x31b7('0x22')][_0x31b7('0x23')]({'where':{'id':_0x516b89,'role':_0x31b7('0x24')}})[_0x31b7('0x1e')](checkError());}function getAgentCheckSession(_0xffacb,_0x128865){return new BPromise(function(_0x21ab03,_0x554a66){var _0x4e58e5=respondWithRpcPromise('VoiceChannels');var _0x503549=getAgent(_0xffacb);Promise[_0x31b7('0x25')]([_0x4e58e5,_0x503549])[_0x31b7('0x1e')](function(_0x2a7c54){var _0x4f5e1d=_0x2a7c54[0x0];var _0x169238=_0x2a7c54[0x1];var _0x6ba73c=_[_0x31b7('0x26')](_0x4f5e1d[_0x31b7('0x27')],function(_0x58a87e){return _0x58a87e[_0x31b7('0x28')]==_0x169238['id']&&_0x58a87e[_0x31b7('0x29')]==_0x128865;});if(_0x6ba73c['length']==0x1){_0x21ab03(_0x169238);}else{_0x554a66(new RangeError('sessionId\x20'+_0x128865+_0x31b7('0x2a')));}});});}exports[_0x31b7('0x2b')]=function(_0xdde2de,_0x35f83c){logger['info']('originate\x20fired:',_0xdde2de[_0x31b7('0x2c')]);var _0x345393=originateValidation[_0x31b7('0xc')](_0xdde2de[_0x31b7('0x2c')]);if(_0x345393[_0x31b7('0x2d')]>0x0){return _0x35f83c['status'](0x190)['json'](_0x345393);}var _0x36fe4e=_0xdde2de[_0x31b7('0x2c')]['userId'];var _0x2cd807=_0xdde2de[_0x31b7('0x2c')]['callNumber'];var _0x267691=_0xdde2de[_0x31b7('0x2c')][_0x31b7('0x2e')];var _0x23d84b=_0xdde2de[_0x31b7('0x2c')][_0x31b7('0x2f')];return getAgent(_0x36fe4e)[_0x31b7('0x1e')](function(_0x200314){logger[_0x31b7('0x12')](_0x31b7('0x30'),_0x200314[_0x31b7('0x19')]);emit(util[_0x31b7('0x31')](_0x31b7('0x32'),_0x200314['name']),'webbar:originate',{'callNumber':_0x2cd807,'callerId':_0x267691,'callbackUrl':_0x23d84b});return _0x35f83c[_0x31b7('0x1a')](0xc8)[_0x31b7('0x33')]({'error':![],'message':_0x31b7('0x34')});})[_0x31b7('0x35')](handleError(_0x35f83c));};exports[_0x31b7('0x36')]=function(_0x37dc32,_0x15a42b){logger[_0x31b7('0x12')](_0x31b7('0x37'),_0x37dc32[_0x31b7('0x2c')]);var _0x5849ad=hangupValidation[_0x31b7('0xc')](_0x37dc32[_0x31b7('0x2c')]);if(_0x5849ad[_0x31b7('0x2d')]>0x0){return _0x15a42b[_0x31b7('0x1a')](0x190)['json'](_0x5849ad);}var _0x20e865=_0x37dc32[_0x31b7('0x2c')]['userId'];var _0x3f8a6b=_0x37dc32['body']['sessionId'];return getAgent(_0x20e865)[_0x31b7('0x1e')](function(_0x10e82c){logger[_0x31b7('0x12')](_0x31b7('0x30'),_0x10e82c[_0x31b7('0x19')]);emit(util['format'](_0x31b7('0x32'),_0x10e82c['name']),'webbar:hangup',{'sessionId':_0x3f8a6b});return _0x15a42b['status'](0xc8)[_0x31b7('0x33')]({'error':![],'message':_0x31b7('0x38')});})[_0x31b7('0x35')](handleError(_0x15a42b));};exports[_0x31b7('0x39')]=function(_0x17c2d9,_0x4ccea9){logger[_0x31b7('0x12')]('answer\x20fired:',_0x17c2d9[_0x31b7('0x2c')]);var _0x3caab0=answerValidation[_0x31b7('0xc')](_0x17c2d9[_0x31b7('0x2c')]);if(_0x3caab0['length']>0x0){return _0x4ccea9[_0x31b7('0x1a')](0x190)[_0x31b7('0x33')](_0x3caab0);}var _0x1046fb=_0x17c2d9['body'][_0x31b7('0x3a')];var _0x51918d=_0x17c2d9[_0x31b7('0x2c')][_0x31b7('0x29')];return getAgent(_0x1046fb)['then'](function(_0x152b88){logger[_0x31b7('0x12')](_0x31b7('0x30'),_0x152b88[_0x31b7('0x19')]);emit(util['format'](_0x31b7('0x32'),_0x152b88['name']),'webbar:answer',{'sessionId':_0x51918d});return _0x4ccea9[_0x31b7('0x1a')](0xc8)[_0x31b7('0x33')]({'error':![],'message':_0x31b7('0x3b')});})[_0x31b7('0x35')](handleError(_0x4ccea9));};exports['hold']=function(_0x6014e,_0x2be7d6){logger['info'](_0x31b7('0x3c'),_0x6014e[_0x31b7('0x2c')]);var _0x2d313b=holdValidation['validate'](_0x6014e[_0x31b7('0x2c')]);if(_0x2d313b[_0x31b7('0x2d')]>0x0){return _0x2be7d6[_0x31b7('0x1a')](0x190)[_0x31b7('0x33')](_0x2d313b);}var _0x345059=_0x6014e[_0x31b7('0x2c')][_0x31b7('0x3a')];var _0x40aead=_0x6014e['body'][_0x31b7('0x29')];return getAgent(_0x345059)['then'](function(_0x5a72ee){logger[_0x31b7('0x12')](_0x31b7('0x30'),_0x5a72ee[_0x31b7('0x19')]);emit(util[_0x31b7('0x31')]('user:%s',_0x5a72ee[_0x31b7('0x19')]),_0x31b7('0x3d'),{'sessionId':_0x40aead});return _0x2be7d6[_0x31b7('0x1a')](0xc8)['json']({'error':![],'message':_0x31b7('0x3e')});})[_0x31b7('0x35')](handleError(_0x2be7d6));};exports[_0x31b7('0x3f')]=function(_0x3b5868,_0x2bf59c){logger[_0x31b7('0x12')](_0x31b7('0x40'),_0x3b5868[_0x31b7('0x2c')]);var _0x4d1fd6=unholdValidation['validate'](_0x3b5868[_0x31b7('0x2c')]);if(_0x4d1fd6[_0x31b7('0x2d')]>0x0){return _0x2bf59c[_0x31b7('0x1a')](0x190)[_0x31b7('0x33')](_0x4d1fd6);}var _0x4920e0=_0x3b5868['body'][_0x31b7('0x3a')];var _0x413bb0=_0x3b5868[_0x31b7('0x2c')][_0x31b7('0x29')];return getAgent(_0x4920e0)[_0x31b7('0x1e')](function(_0x12b713){logger[_0x31b7('0x12')](_0x31b7('0x30'),_0x12b713['name']);emit(util['format'](_0x31b7('0x32'),_0x12b713[_0x31b7('0x19')]),_0x31b7('0x41'),{'sessionId':_0x413bb0});return _0x2bf59c[_0x31b7('0x1a')](0xc8)[_0x31b7('0x33')]({'error':![],'message':_0x31b7('0x42')});})[_0x31b7('0x35')](handleError(_0x2bf59c));};exports[_0x31b7('0x43')]=function(_0x1ec95f,_0x3e1c4f){logger['info']('calls\x20fired:',_0x3e1c4f[_0x31b7('0x2c')]);var _0x954c=callsValidation[_0x31b7('0xc')](_0x1ec95f[_0x31b7('0x2c')]);if(_0x954c['length']>0x0){return _0x3e1c4f[_0x31b7('0x1a')](0x190)[_0x31b7('0x33')](_0x954c);}var _0x316175=_0x1ec95f[_0x31b7('0x2c')][_0x31b7('0x3a')];var _0x23ffad=respondWithRpcPromise(_0x31b7('0x44'));var _0x3a8b87=getAgent(_0x316175);return Promise[_0x31b7('0x25')]([_0x23ffad,_0x3a8b87])[_0x31b7('0x1e')](function(_0x29ef38){var _0x4cd34e=_0x29ef38[0x0];var _0x4c77e0=_0x29ef38[0x1];var _0x2cf8ec=_[_0x31b7('0x26')](_0x4cd34e[_0x31b7('0x27')],function(_0x3f25d7){return _0x3f25d7[_0x31b7('0x28')]==_0x4c77e0['id'];});return _0x3e1c4f[_0x31b7('0x1a')](0xc8)['json']({'count':_0x2cf8ec[_0x31b7('0x2d')],'rows':_0x2cf8ec});})['catch'](handleError(_0x3e1c4f));};exports['conference']=function(_0x531bcd,_0x3686b8){logger[_0x31b7('0x12')](_0x31b7('0x45'),_0x531bcd[_0x31b7('0x2c')]);var _0x44934f=conferenceValidation[_0x31b7('0xc')](_0x531bcd[_0x31b7('0x2c')]);if(_0x44934f[_0x31b7('0x2d')]>0x0){return _0x3686b8[_0x31b7('0x1a')](0x190)[_0x31b7('0x33')](_0x44934f);}var _0x40d54b=_0x531bcd[_0x31b7('0x2c')][_0x31b7('0x3a')];return getAgent(_0x40d54b)[_0x31b7('0x1e')](function(_0x2598d5){logger[_0x31b7('0x12')](_0x31b7('0x30'),_0x2598d5[_0x31b7('0x19')]);emit(util[_0x31b7('0x31')](_0x31b7('0x32'),_0x2598d5[_0x31b7('0x19')]),_0x31b7('0x46'));return _0x3686b8[_0x31b7('0x1a')](0xc8)[_0x31b7('0x33')]({'error':![],'message':'conference\x20executed!'});})[_0x31b7('0x35')](handleError(_0x3686b8));};exports[_0x31b7('0x47')]=function(_0x47f5f7,_0x2900ff){logger['info'](_0x31b7('0x48'),_0x47f5f7[_0x31b7('0x2c')]);var _0x318746=transferValidation[_0x31b7('0xc')](_0x47f5f7['body']);if(_0x318746[_0x31b7('0x2d')]>0x0){return _0x2900ff['status'](0x190)[_0x31b7('0x33')](_0x318746);}var _0x4b368c=_0x47f5f7[_0x31b7('0x2c')][_0x31b7('0x3a')];var _0xfeb4e2=_0x47f5f7[_0x31b7('0x2c')]['sessionId'];var _0xb4be25=_0x47f5f7[_0x31b7('0x2c')][_0x31b7('0x49')];return getAgent(_0x4b368c)[_0x31b7('0x1e')](function(_0x3c0cf8){logger[_0x31b7('0x12')](_0x31b7('0x30'),_0x3c0cf8[_0x31b7('0x19')]);emit(util[_0x31b7('0x31')](_0x31b7('0x32'),_0x3c0cf8[_0x31b7('0x19')]),_0x31b7('0x4a'),{'sessionId':_0xfeb4e2,'transferNumber':_0xb4be25});return _0x2900ff[_0x31b7('0x1a')](0xc8)[_0x31b7('0x33')]({'error':![],'message':_0x31b7('0x4b')});})[_0x31b7('0x35')](handleError(_0x2900ff));}; \ No newline at end of file +var _0x5636=['then','error','message','result','findOne','agent','VoiceChannels','all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','user:%s','json','originate\x20executed!','catch','hangup','info','format','answer','answer\x20fired:','webbar:answer','answer\x20executed!','webbar:hold','unhold\x20executed!','calls','calls\x20fired:','filter','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','stack','name','status','send','NotFound','request'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x5636,0x102));var _0x6563=function(_0x5a473b,_0x1a7d54){_0x5a473b=_0x5a473b-0x0;var _0x4271db=_0x5636[_0x5a473b];return _0x4271db;};'use strict';var path=require(_0x6563('0x0'));var fs=require('fs');var _=require(_0x6563('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x6563('0x2'));var jayson=require(_0x6563('0x3'));var amiClient=jayson[_0x6563('0x4')]['http']({'port':0x232a});var logger=require(_0x6563('0x5'))(_0x6563('0x6'));var Redis=require(_0x6563('0x7'));config[_0x6563('0x8')]=_[_0x6563('0x9')](config[_0x6563('0x8')],{'host':_0x6563('0xa'),'port':0x18eb});var io=require(_0x6563('0xb'))(new Redis(config[_0x6563('0x8')]));var Schema=require(_0x6563('0xc'));var originateValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],_0x6563('0xe')]},'callNumber':{'type':_0x6563('0xf'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x6563('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6563('0xe')]},'sessionId':{'type':_0x6563('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],_0x6563('0xe')]},'sessionId':{'type':_0x6563('0xf'),'required':[!![],_0x6563('0x10')]},'transferNumber':{'type':_0x6563('0xf'),'required':[!![],_0x6563('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6563('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6563('0xe')]},'sessionId':{'type':_0x6563('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x6563('0xd'),'required':[!![],_0x6563('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6563('0xe')]}});function emit(_0x11baa2,_0x477d9b,_0xd398ce){logger['info'](_0x11baa2,_0x477d9b,JSON[_0x6563('0x12')](_0xd398ce));io['to'](_0x11baa2)['emit'](_0x477d9b,_0xd398ce);}function handleError(_0x502694){return function(_0x47972a){console[_0x6563('0x13')]('handleError:',_0x47972a,_0x47972a instanceof RangeError);logger['error'](_0x47972a[_0x6563('0x14')]);if(_0x47972a instanceof RangeError){if(_0x47972a[_0x6563('0x15')]){delete _0x47972a[_0x6563('0x15')];}_0x502694[_0x6563('0x16')](0x194)[_0x6563('0x17')](_0x47972a);}else{if(_0x47972a[_0x6563('0x15')]){delete _0x47972a[_0x6563('0x15')];}_0x502694[_0x6563('0x16')](0x1f4)[_0x6563('0x17')](_0x47972a);}};}function checkError(){return function(_0x5bf608){if(!_0x5bf608){throw new RangeError(_0x6563('0x18'));}return _0x5bf608;};}function respondWithRpcPromise(_0x9c3da7,_0x20b478){return new BPromise(function(_0x5a335c,_0x293db2){var _0x5c37bb=amiClient;return _0x5c37bb[_0x6563('0x19')](_0x9c3da7,_0x20b478)[_0x6563('0x1a')](function(_0x5610b0){if(_0x5610b0['error']){if(_0x5610b0[_0x6563('0x1b')]['code']===0x1f4){return _0x293db2(_0x5610b0[_0x6563('0x1b')][_0x6563('0x1c')]);}return _0x5a335c(_0x5610b0[_0x6563('0x1b')]['message']);}else{_0x5a335c(_0x5610b0[_0x6563('0x1d')]);}})['catch'](function(_0x7ea857){_0x293db2(_0x7ea857);});});}function getAgent(_0x1590e6){return db['User'][_0x6563('0x1e')]({'where':{'id':_0x1590e6,'role':_0x6563('0x1f')}})['then'](checkError());}function getAgentCheckSession(_0x2ddb2b,_0x5b03a7){return new BPromise(function(_0x1fe1cb,_0x4fbb20){var _0x480408=respondWithRpcPromise(_0x6563('0x20'));var _0x118d31=getAgent(_0x2ddb2b);Promise[_0x6563('0x21')]([_0x480408,_0x118d31])[_0x6563('0x1a')](function(_0x3eb23b){var _0x4b4d3b=_0x3eb23b[0x0];var _0x3c8bd1=_0x3eb23b[0x1];var _0x4f275c=_['filter'](_0x4b4d3b[_0x6563('0x22')],function(_0x35af37){return _0x35af37[_0x6563('0x23')]==_0x3c8bd1['id']&&_0x35af37[_0x6563('0x24')]==_0x5b03a7;});if(_0x4f275c[_0x6563('0x25')]==0x1){_0x1fe1cb(_0x3c8bd1);}else{_0x4fbb20(new RangeError(_0x6563('0x26')+_0x5b03a7+_0x6563('0x27')));}});});}exports[_0x6563('0x28')]=function(_0x101b24,_0x246d53){logger['info'](_0x6563('0x29'),_0x101b24[_0x6563('0x2a')]);var _0x29fb9d=originateValidation[_0x6563('0xc')](_0x101b24[_0x6563('0x2a')]);if(_0x29fb9d[_0x6563('0x25')]>0x0){return _0x246d53[_0x6563('0x16')](0x190)['json'](_0x29fb9d);}var _0x8cf1=_0x101b24[_0x6563('0x2a')][_0x6563('0x2b')];var _0x46fb1b=_0x101b24[_0x6563('0x2a')][_0x6563('0x2c')];var _0x574a35=_0x101b24[_0x6563('0x2a')][_0x6563('0x2d')];var _0x26c24b=_0x101b24[_0x6563('0x2a')][_0x6563('0x2e')];return getAgent(_0x8cf1)[_0x6563('0x1a')](function(_0x3f578a){logger['info'](_0x6563('0x2f'),_0x3f578a[_0x6563('0x15')]);emit(util['format'](_0x6563('0x30'),_0x3f578a[_0x6563('0x15')]),'webbar:originate',{'callNumber':_0x46fb1b,'callerId':_0x574a35,'callbackUrl':_0x26c24b});return _0x246d53['status'](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x32')});})[_0x6563('0x33')](handleError(_0x246d53));};exports[_0x6563('0x34')]=function(_0x4962c2,_0x2d36d4){logger[_0x6563('0x35')]('hangup\x20fired:',_0x4962c2[_0x6563('0x2a')]);var _0xe5e80f=hangupValidation[_0x6563('0xc')](_0x4962c2[_0x6563('0x2a')]);if(_0xe5e80f[_0x6563('0x25')]>0x0){return _0x2d36d4[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0xe5e80f);}var _0x15c23e=_0x4962c2[_0x6563('0x2a')]['userId'];var _0x130a88=_0x4962c2[_0x6563('0x2a')][_0x6563('0x24')];return getAgent(_0x15c23e)[_0x6563('0x1a')](function(_0x5ebe88){logger['info'](_0x6563('0x2f'),_0x5ebe88[_0x6563('0x15')]);emit(util[_0x6563('0x36')]('user:%s',_0x5ebe88[_0x6563('0x15')]),'webbar:hangup',{'sessionId':_0x130a88});return _0x2d36d4[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':'hangup\x20executed!'});})[_0x6563('0x33')](handleError(_0x2d36d4));};exports[_0x6563('0x37')]=function(_0xea186,_0xcf92cd){logger[_0x6563('0x35')](_0x6563('0x38'),_0xea186[_0x6563('0x2a')]);var _0x32932f=answerValidation[_0x6563('0xc')](_0xea186[_0x6563('0x2a')]);if(_0x32932f[_0x6563('0x25')]>0x0){return _0xcf92cd['status'](0x190)['json'](_0x32932f);}var _0x38eab4=_0xea186[_0x6563('0x2a')][_0x6563('0x2b')];var _0x2f2aa6=_0xea186[_0x6563('0x2a')][_0x6563('0x24')];return getAgent(_0x38eab4)[_0x6563('0x1a')](function(_0x4b7838){logger[_0x6563('0x35')](_0x6563('0x2f'),_0x4b7838[_0x6563('0x15')]);emit(util[_0x6563('0x36')]('user:%s',_0x4b7838[_0x6563('0x15')]),_0x6563('0x39'),{'sessionId':_0x2f2aa6});return _0xcf92cd[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x3a')});})['catch'](handleError(_0xcf92cd));};exports['hold']=function(_0x1504ca,_0x42d54c){logger[_0x6563('0x35')]('hold\x20fired:',_0x1504ca[_0x6563('0x2a')]);var _0x120723=holdValidation[_0x6563('0xc')](_0x1504ca[_0x6563('0x2a')]);if(_0x120723['length']>0x0){return _0x42d54c[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0x120723);}var _0xd54477=_0x1504ca['body'][_0x6563('0x2b')];var _0x4bcfff=_0x1504ca[_0x6563('0x2a')]['sessionId'];return getAgent(_0xd54477)['then'](function(_0x1ef2da){logger[_0x6563('0x35')](_0x6563('0x2f'),_0x1ef2da[_0x6563('0x15')]);emit(util[_0x6563('0x36')](_0x6563('0x30'),_0x1ef2da[_0x6563('0x15')]),_0x6563('0x3b'),{'sessionId':_0x4bcfff});return _0x42d54c[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':'hold\x20executed!'});})[_0x6563('0x33')](handleError(_0x42d54c));};exports['unhold']=function(_0x22306a,_0xb339e9){logger[_0x6563('0x35')]('unhold\x20fired:',_0x22306a[_0x6563('0x2a')]);var _0x141f0c=unholdValidation['validate'](_0x22306a[_0x6563('0x2a')]);if(_0x141f0c[_0x6563('0x25')]>0x0){return _0xb339e9[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0x141f0c);}var _0xbd920a=_0x22306a['body'][_0x6563('0x2b')];var _0x5c4cfa=_0x22306a[_0x6563('0x2a')]['sessionId'];return getAgent(_0xbd920a)[_0x6563('0x1a')](function(_0x5992c8){logger['info']('entityFound:',_0x5992c8['name']);emit(util[_0x6563('0x36')]('user:%s',_0x5992c8[_0x6563('0x15')]),'webbar:unhold',{'sessionId':_0x5c4cfa});return _0xb339e9[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x3c')});})[_0x6563('0x33')](handleError(_0xb339e9));};exports[_0x6563('0x3d')]=function(_0x199a0e,_0x23c94a){logger[_0x6563('0x35')](_0x6563('0x3e'),_0x23c94a['body']);var _0x386ae9=callsValidation[_0x6563('0xc')](_0x199a0e[_0x6563('0x2a')]);if(_0x386ae9[_0x6563('0x25')]>0x0){return _0x23c94a[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0x386ae9);}var _0x40c99b=_0x199a0e[_0x6563('0x2a')][_0x6563('0x2b')];var _0x2c7e9d=respondWithRpcPromise(_0x6563('0x20'));var _0x5c456b=getAgent(_0x40c99b);return Promise[_0x6563('0x21')]([_0x2c7e9d,_0x5c456b])[_0x6563('0x1a')](function(_0x23f38d){var _0x2e9c69=_0x23f38d[0x0];var _0x46c26c=_0x23f38d[0x1];var _0x3c06ac=_[_0x6563('0x3f')](_0x2e9c69[_0x6563('0x22')],function(_0x53292e){return _0x53292e[_0x6563('0x23')]==_0x46c26c['id'];});return _0x23c94a['status'](0xc8)[_0x6563('0x31')]({'count':_0x3c06ac[_0x6563('0x25')],'rows':_0x3c06ac});})['catch'](handleError(_0x23c94a));};exports['conference']=function(_0x3374b0,_0x8f5e46){logger[_0x6563('0x35')](_0x6563('0x40'),_0x3374b0['body']);var _0x2a3df0=conferenceValidation['validate'](_0x3374b0[_0x6563('0x2a')]);if(_0x2a3df0[_0x6563('0x25')]>0x0){return _0x8f5e46['status'](0x190)['json'](_0x2a3df0);}var _0x3a3a35=_0x3374b0['body']['userId'];return getAgent(_0x3a3a35)[_0x6563('0x1a')](function(_0x49d6a5){logger[_0x6563('0x35')](_0x6563('0x2f'),_0x49d6a5[_0x6563('0x15')]);emit(util[_0x6563('0x36')]('user:%s',_0x49d6a5[_0x6563('0x15')]),_0x6563('0x41'));return _0x8f5e46[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x42')});})[_0x6563('0x33')](handleError(_0x8f5e46));};exports[_0x6563('0x43')]=function(_0x7d8546,_0x58728d){logger['info'](_0x6563('0x44'),_0x7d8546[_0x6563('0x2a')]);var _0x5b5783=transferValidation['validate'](_0x7d8546['body']);if(_0x5b5783[_0x6563('0x25')]>0x0){return _0x58728d[_0x6563('0x16')](0x190)[_0x6563('0x31')](_0x5b5783);}var _0x149b74=_0x7d8546['body'][_0x6563('0x2b')];var _0x1a5c54=_0x7d8546[_0x6563('0x2a')][_0x6563('0x24')];var _0xb55389=_0x7d8546['body']['transferNumber'];return getAgent(_0x149b74)[_0x6563('0x1a')](function(_0x1d7b5d){logger[_0x6563('0x35')]('entityFound:',_0x1d7b5d[_0x6563('0x15')]);emit(util['format'](_0x6563('0x30'),_0x1d7b5d[_0x6563('0x15')]),_0x6563('0x45'),{'sessionId':_0x1a5c54,'transferNumber':_0xb55389});return _0x58728d[_0x6563('0x16')](0xc8)[_0x6563('0x31')]({'error':![],'message':_0x6563('0x46')});})[_0x6563('0x33')](handleError(_0x58728d));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 32fe454..9255dcb 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 _0x14a0=['update','delete','destroy','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAgents','addApplications','/:id/notify','notify','/:id/send','put','/:id'];(function(_0x1cf34d,_0x4ba991){var _0x5ef605=function(_0x5747df){while(--_0x5747df){_0x1cf34d['push'](_0x1cf34d['shift']());}};_0x5ef605(++_0x4ba991);}(_0x14a0,0x8e));var _0x014a=function(_0x29407e,_0x38a7cb){_0x29407e=_0x29407e-0x0;var _0x230b7c=_0x14a0[_0x29407e];return _0x230b7c;};'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['get']('/:id',auth[_0x014a('0x9')](),controller['show']);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['get'](_0x014a('0xd'),auth[_0x014a('0x9')](),controller['getAnswers']);router[_0x014a('0x8')](_0x014a('0xe'),auth[_0x014a('0x9')](),controller[_0x014a('0xf')]);router[_0x014a('0x8')](_0x014a('0x10'),auth[_0x014a('0x9')](),controller[_0x014a('0x11')]);router[_0x014a('0x12')]('/',auth[_0x014a('0x9')](),controller[_0x014a('0x13')]);router[_0x014a('0x12')]('/:id/dispositions',auth[_0x014a('0x9')](),controller[_0x014a('0x14')]);router['post'](_0x014a('0xd'),auth[_0x014a('0x9')](),controller['addAnswer']);router[_0x014a('0x12')](_0x014a('0xe'),auth[_0x014a('0x9')](),controller[_0x014a('0x15')]);router[_0x014a('0x12')](_0x014a('0x10'),auth[_0x014a('0x9')](),controller[_0x014a('0x16')]);router[_0x014a('0x12')](_0x014a('0x17'),controller[_0x014a('0x18')]);router[_0x014a('0x12')](_0x014a('0x19'),auth[_0x014a('0x9')](),controller['send']);router[_0x014a('0x1a')](_0x014a('0x1b'),auth[_0x014a('0x9')](),controller[_0x014a('0x1c')]);router[_0x014a('0x1d')](_0x014a('0x1b'),auth[_0x014a('0x9')](),controller[_0x014a('0x1e')]);router[_0x014a('0x1d')]('/:id/dispositions',auth[_0x014a('0x9')](),controller['removeDispositions']);router[_0x014a('0x1d')](_0x014a('0xd'),auth[_0x014a('0x9')](),controller[_0x014a('0x1f')]);router[_0x014a('0x1d')](_0x014a('0xe'),auth[_0x014a('0x9')](),controller[_0x014a('0x20')]);module[_0x014a('0x21')]=router; \ No newline at end of file +var _0x6d38=['get','/describe','/:id','/:id/dispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','update','delete','removeAgents','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x6d38,0x1ef));var _0x86d3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6d38[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['get'](_0x86d3('0xc'),auth[_0x86d3('0x7')](),controller['getDispositions']);router['get'](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller['getAnswers']);router[_0x86d3('0x9')]('/:id/users',auth[_0x86d3('0x7')](),controller[_0x86d3('0xe')]);router[_0x86d3('0x9')](_0x86d3('0xf'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x10')]);router[_0x86d3('0x11')]('/',auth[_0x86d3('0x7')](),controller['create']);router[_0x86d3('0x11')](_0x86d3('0xc'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x12')]);router[_0x86d3('0x11')](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x13')]);router['post'](_0x86d3('0x14'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x15')]);router[_0x86d3('0x11')](_0x86d3('0xf'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x16')]);router[_0x86d3('0x11')](_0x86d3('0x17'),controller['notify']);router[_0x86d3('0x11')]('/:id/send',auth[_0x86d3('0x7')](),controller['send']);router['put'](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x18')]);router[_0x86d3('0x19')]('/:id',auth[_0x86d3('0x7')](),controller['destroy']);router[_0x86d3('0x19')](_0x86d3('0xc'),auth[_0x86d3('0x7')](),controller['removeDispositions']);router[_0x86d3('0x19')](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller['removeAnswers']);router['delete'](_0x86d3('0x14'),auth['isAuthenticated'](),controller[_0x86d3('0x1a')]);module[_0x86d3('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 5923922..a16e493 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 _0xb466=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','randomstring','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x278475,_0x426e12){var _0x476ad4=function(_0x38855c){while(--_0x38855c){_0x278475['push'](_0x278475['shift']());}};_0x476ad4(++_0x426e12);}(_0xb466,0xc9));var _0x6b46=function(_0x25b6d3,_0x390816){_0x25b6d3=_0x25b6d3-0x0;var _0x35e8f5=_0xb466[_0x25b6d3];return _0x35e8f5;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6b46('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b46('0x1')],'unique':_0x6b46('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x6b46('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x6b46('0x1')],'defaultValue':function(){return rs[_0x6b46('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6b46('0x4')](_0x6b46('0x5'),_0x6b46('0x6'))},'accountSid':{'type':Sequelize[_0x6b46('0x1')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x6b46('0x1')]},'notificationTemplate':{'type':Sequelize[_0x6b46('0x7')],'defaultValue':function(){return _0x6b46('0x8');}},'notificationSound':{'type':Sequelize[_0x6b46('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6b46('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6b46('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6b46('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6b46('0xa')],'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['INTEGER'],'comment':_0x6b46('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6b46('0xc'),'set':function(_0x3d177a){if(!_0x3d177a){this['setDataValue'](_0x6b46('0xd'),null);}this[_0x6b46('0xe')]('mandatoryDisposition',_0x3d177a);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6f42=['twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','exports','STRING','generate','ENUM'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0x6f42,0x1ea));var _0x26f4=function(_0x351b46,_0x26b265){_0x351b46=_0x351b46-0x0;var _0x1515df=_0x6f42[_0x351b46];return _0x1515df;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x26f4('0x0')]={'name':{'type':Sequelize[_0x26f4('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x26f4('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x26f4('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x26f4('0x2')]();}},'phone':{'type':Sequelize[_0x26f4('0x1')]},'type':{'type':Sequelize[_0x26f4('0x3')](_0x26f4('0x4'),_0x26f4('0x5'))},'accountSid':{'type':Sequelize[_0x26f4('0x1')]},'baseUrl':{'type':Sequelize[_0x26f4('0x1')]},'authToken':{'type':Sequelize[_0x26f4('0x1')]},'notificationTemplate':{'type':Sequelize[_0x26f4('0x6')],'defaultValue':function(){return _0x26f4('0x7');}},'notificationSound':{'type':Sequelize[_0x26f4('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x26f4('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x26f4('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x26f4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x26f4('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x26f4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x26f4('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x26f4('0x8')],'defaultValue':![],'comment':_0x26f4('0xa'),'set':function(_0x249df1){if(!_0x249df1){this[_0x26f4('0xb')](_0x26f4('0xc'),null);}this['setDataValue']('mandatoryDisposition',_0x249df1);}},'description':{'type':Sequelize[_0x26f4('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index f459207..94acf84 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 _0xb61b=['addApplications','transaction','sequelize','Transaction','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','statuses','WhatsappMessage','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','replace','whatsapp:','Body','MessageSid','sinch','notifications','messageId','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','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','stringify','set','Content-Type','text/xml','List','out','Messages','dataValues','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','options','includeAll','rows','catch','show','fields','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','filter','findAll','removeDispositions','ids','addAnswer','WhatsappAccountId','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User'];(function(_0x1c0096,_0x38c351){var _0x10a655=function(_0x3158c4){while(--_0x3158c4){_0x1c0096['push'](_0x1c0096['shift']());}};_0x10a655(++_0x38c351);}(_0xb61b,0x1d5));var _0xbb61=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb61b[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbb61('0x0'));var jsonpatch=require(_0xbb61('0x1'));var rp=require('request-promise');var moment=require(_0xbb61('0x2'));var BPromise=require(_0xbb61('0x3'));var Mustache=require(_0xbb61('0x4'));var util=require(_0xbb61('0x5'));var path=require('path');var sox=require(_0xbb61('0x6'));var csv=require(_0xbb61('0x7'));var ejs=require(_0xbb61('0x8'));var fs=require('fs');var fs_extra=require(_0xbb61('0x9'));var _=require(_0xbb61('0xa'));var squel=require(_0xbb61('0xb'));var crypto=require('crypto');var jsforce=require(_0xbb61('0xc'));var deskjs=require(_0xbb61('0xd'));var toCsv=require(_0xbb61('0x7'));var querystring=require('querystring');var Papa=require(_0xbb61('0xe'));var Redis=require('ioredis');var authService=require(_0xbb61('0xf'));var qs=require(_0xbb61('0x10'));var as=require(_0xbb61('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb61('0x12'))('api');var utils=require(_0xbb61('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xbb61('0x14'));var db=require(_0xbb61('0x15'))['db'];config[_0xbb61('0x16')]=_[_0xbb61('0x17')](config[_0xbb61('0x16')],{'host':_0xbb61('0x18'),'port':0x18eb});var socket=require(_0xbb61('0x19'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0xbb61('0x1a')](socket);var jayson=require(_0xbb61('0x1b'));var client=jayson[_0xbb61('0x1c')][_0xbb61('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0xec4331,_0x523e50,_0x1756c1,_0x1a9dd0){return new BPromise(function(_0x4bad9e,_0xfd1629){var _0x3ce80c=_0x1a9dd0||client;return _0x3ce80c['request'](_0xec4331,_0x1756c1)[_0xbb61('0x1e')](function(_0x43822d){logger['info'](_0xbb61('0x1f'),_0x523e50,_0xbb61('0x20'));logger[_0xbb61('0x21')](_0xbb61('0x22'),_0x523e50,_0xbb61('0x20'),JSON['stringify'](_0x43822d));if(_0x43822d['error']){if(_0x43822d[_0xbb61('0x23')][_0xbb61('0x24')]===0x1f4){logger[_0xbb61('0x23')](_0xbb61('0x1f'),_0x523e50,_0x43822d['error'][_0xbb61('0x25')]);return _0xfd1629(_0x43822d[_0xbb61('0x23')][_0xbb61('0x25')]);}logger[_0xbb61('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x523e50,_0x43822d[_0xbb61('0x23')]['message']);return _0x4bad9e(_0x43822d[_0xbb61('0x23')]['message']);}else{logger[_0xbb61('0x26')](_0xbb61('0x1f'),_0x523e50,_0xbb61('0x20'));_0x4bad9e(_0x43822d[_0xbb61('0x27')][_0xbb61('0x25')]);}})['catch'](function(_0x536c22){logger[_0xbb61('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x523e50,_0x536c22);_0xfd1629(_0x536c22);});});}function respondWithStatusCode(_0x355fd2,_0x222fea){_0x222fea=_0x222fea||0xcc;return function(_0x3fd9fd){if(_0x3fd9fd){return _0x355fd2[_0xbb61('0x28')](_0x222fea);}return _0x355fd2[_0xbb61('0x29')](_0x222fea)[_0xbb61('0x2a')]();};}function respondWithResult(_0x4bc5b9,_0x5c1f41){_0x5c1f41=_0x5c1f41||0xc8;return function(_0x25ec97){if(_0x25ec97){return _0x4bc5b9[_0xbb61('0x29')](_0x5c1f41)[_0xbb61('0x2b')](_0x25ec97);}};}function respondWithFilteredResult(_0xdac520,_0x3fd8e0){return function(_0x20b953){if(_0x20b953){var _0x27097c=typeof _0x3fd8e0[_0xbb61('0x2c')]===_0xbb61('0x2d')&&typeof _0x3fd8e0[_0xbb61('0x2e')]===_0xbb61('0x2d');var _0x25af11=_0x20b953[_0xbb61('0x2f')];var _0x5e5274=_0x27097c?0x0:_0x3fd8e0[_0xbb61('0x2c')];var _0x15998a=_0x27097c?_0x20b953[_0xbb61('0x2f')]:_0x3fd8e0[_0xbb61('0x2c')]+_0x3fd8e0[_0xbb61('0x2e')];var _0x911f87;if(_0x15998a>=_0x25af11){_0x15998a=_0x25af11;_0x911f87=0xc8;}else{_0x911f87=0xce;}_0xdac520[_0xbb61('0x29')](_0x911f87);return _0xdac520['set'](_0xbb61('0x30'),_0x5e5274+'-'+_0x15998a+'/'+_0x25af11)[_0xbb61('0x2b')](_0x20b953);}return null;};}function patchUpdates(_0x32d4b4){return function(_0x3c8ec3){try{jsonpatch[_0xbb61('0x31')](_0x3c8ec3,_0x32d4b4,!![]);}catch(_0x83d694){return BPromise[_0xbb61('0x32')](_0x83d694);}return _0x3c8ec3[_0xbb61('0x33')]();};}function saveUpdates(_0x2f68cd,_0x2f7809){return function(_0x4024a1){if(_0x4024a1){return _0x4024a1[_0xbb61('0x34')](_0x2f68cd)[_0xbb61('0x1e')](function(_0x12a28e){return _0x12a28e;});}return null;};}function removeEntity(_0x4766c8,_0x2d2caa){return function(_0x551e42){if(_0x551e42){return _0x551e42[_0xbb61('0x35')]()['then'](function(){var _0x49c2c7=_0x551e42[_0xbb61('0x36')]({'plain':!![]});var _0x387f17=_0xbb61('0x37');return db[_0xbb61('0x38')][_0xbb61('0x35')]({'where':{'type':_0x387f17,'resourceId':_0x49c2c7['id']}})['then'](function(){return _0x551e42;});})[_0xbb61('0x1e')](function(){_0x4766c8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1caa3a,_0x27b9d2){return function(_0x44bc15){if(!_0x44bc15){_0x1caa3a[_0xbb61('0x28')](0x194);}return _0x44bc15;};}function handleError(_0x2f29d4,_0x350668){_0x350668=_0x350668||0x1f4;return function(_0x1dee12){logger[_0xbb61('0x23')](_0x1dee12[_0xbb61('0x39')]);if(_0x1dee12[_0xbb61('0x3a')]){delete _0x1dee12[_0xbb61('0x3a')];}_0x2f29d4[_0xbb61('0x29')](_0x350668)[_0xbb61('0x3b')](_0x1dee12);};}exports[_0xbb61('0x3c')]=function(_0xe02684,_0x266553){var _0x1e5cfe={'include':[{'model':db[_0xbb61('0x3d')],'as':_0xbb61('0x3e')}]},_0x57715c={},_0x26c7eb={'count':0x0,'rows':[]};var _0xdf14d9=_['map'](db[_0xbb61('0x3f')][_0xbb61('0x40')],function(_0x157898){return{'name':_0x157898[_0xbb61('0x41')],'type':_0x157898['type'][_0xbb61('0x42')]};});_0x57715c[_0xbb61('0x43')]=_['map'](_0xdf14d9,_0xbb61('0x3a'));_0x57715c[_0xbb61('0x44')]=_[_0xbb61('0x45')](_0xe02684[_0xbb61('0x44')]);_0x57715c[_0xbb61('0x46')]=_[_0xbb61('0x47')](_0x57715c[_0xbb61('0x43')],_0x57715c[_0xbb61('0x44')]);_0x1e5cfe[_0xbb61('0x48')]=_[_0xbb61('0x47')](_0x57715c[_0xbb61('0x43')],qs['fields'](_0xe02684[_0xbb61('0x44')]['fields']));_0x1e5cfe[_0xbb61('0x48')]=_0x1e5cfe[_0xbb61('0x48')]['length']?_0x1e5cfe[_0xbb61('0x48')]:_0x57715c[_0xbb61('0x43')];if(!_0xe02684[_0xbb61('0x44')][_0xbb61('0x49')](_0xbb61('0x4a'))){_0x1e5cfe[_0xbb61('0x2e')]=qs[_0xbb61('0x2e')](_0xe02684['query'][_0xbb61('0x2e')]);_0x1e5cfe[_0xbb61('0x2c')]=qs[_0xbb61('0x2c')](_0xe02684[_0xbb61('0x44')][_0xbb61('0x2c')]);}_0x1e5cfe[_0xbb61('0x4b')]=qs['sort'](_0xe02684['query'][_0xbb61('0x4c')]);_0x1e5cfe[_0xbb61('0x4d')]=qs['filters'](_[_0xbb61('0x4e')](_0xe02684[_0xbb61('0x44')],_0x57715c['filters']),_0xdf14d9);if(_0xe02684['query']['filter']){_0x1e5cfe[_0xbb61('0x4d')]=_[_0xbb61('0x4f')](_0x1e5cfe[_0xbb61('0x4d')],{'$or':_[_0xbb61('0x50')](_0xdf14d9,function(_0x4308d8){if(_0x4308d8[_0xbb61('0x51')]!==_0xbb61('0x52')){var _0x2bab62={};_0x2bab62[_0x4308d8[_0xbb61('0x3a')]]={'$like':'%'+_0xe02684[_0xbb61('0x44')]['filter']+'%'};return _0x2bab62;}})});}_0x1e5cfe=_[_0xbb61('0x4f')]({},_0x1e5cfe,_0xe02684[_0xbb61('0x53')]);var _0x33ff6f={'where':_0x1e5cfe[_0xbb61('0x4d')]};return db[_0xbb61('0x3f')][_0xbb61('0x2f')](_0x33ff6f)[_0xbb61('0x1e')](function(_0x4cdff4){_0x26c7eb['count']=_0x4cdff4;if(_0xe02684[_0xbb61('0x44')][_0xbb61('0x54')]){_0x1e5cfe['include']=[{'all':!![]}];}return db[_0xbb61('0x3f')]['findAll'](_0x1e5cfe);})['then'](function(_0xb3ae48){_0x26c7eb[_0xbb61('0x55')]=_0xb3ae48;return _0x26c7eb;})[_0xbb61('0x1e')](respondWithFilteredResult(_0x266553,_0x1e5cfe))[_0xbb61('0x56')](handleError(_0x266553,null));};exports[_0xbb61('0x57')]=function(_0x2b59ff,_0x3651f9){var _0x500a0d={'raw':![],'where':{'id':_0x2b59ff['params']['id']},'include':[{'model':db[_0xbb61('0x3d')],'as':'mandatoryDispositionPause'}]},_0x15b8fb={};_0x15b8fb['model']=_[_0xbb61('0x45')](db[_0xbb61('0x3f')][_0xbb61('0x40')]);_0x15b8fb[_0xbb61('0x44')]=_[_0xbb61('0x45')](_0x2b59ff[_0xbb61('0x44')]);_0x15b8fb[_0xbb61('0x46')]=_[_0xbb61('0x47')](_0x15b8fb[_0xbb61('0x43')],_0x15b8fb[_0xbb61('0x44')]);_0x500a0d[_0xbb61('0x48')]=_['intersection'](_0x15b8fb[_0xbb61('0x43')],qs[_0xbb61('0x58')](_0x2b59ff[_0xbb61('0x44')][_0xbb61('0x58')]));_0x500a0d[_0xbb61('0x48')]=_0x500a0d[_0xbb61('0x48')][_0xbb61('0x59')]?_0x500a0d[_0xbb61('0x48')]:_0x15b8fb[_0xbb61('0x43')];if(_0x2b59ff[_0xbb61('0x44')][_0xbb61('0x54')]){_0x500a0d[_0xbb61('0x5a')]=[{'all':!![]}];}_0x500a0d=_[_0xbb61('0x4f')]({},_0x500a0d,_0x2b59ff[_0xbb61('0x53')]);return db[_0xbb61('0x3f')][_0xbb61('0x5b')](_0x500a0d)[_0xbb61('0x1e')](handleEntityNotFound(_0x3651f9,null))[_0xbb61('0x1e')](respondWithResult(_0x3651f9,null))[_0xbb61('0x56')](handleError(_0x3651f9,null));};exports[_0xbb61('0x5c')]=function(_0x1e0e47,_0x33b840){return db[_0xbb61('0x3f')][_0xbb61('0x5c')](_0x1e0e47[_0xbb61('0x5d')],{})['then'](function(_0x123262){var _0x504530=_0x1e0e47[_0xbb61('0x5e')]['get']({'plain':!![]});if(!_0x504530)throw new Error(_0xbb61('0x5f'));if(_0x504530[_0xbb61('0x60')]===_0xbb61('0x5e')){var _0x26800a=_0x123262[_0xbb61('0x36')]({'plain':!![]});var _0x2295dd=_0xbb61('0x37');return db[_0xbb61('0x61')][_0xbb61('0x5b')]({'where':{'name':_0x2295dd,'userProfileId':_0x504530['userProfileId']},'raw':!![]})[_0xbb61('0x1e')](function(_0x1ec7a9){if(_0x1ec7a9&&_0x1ec7a9[_0xbb61('0x62')]===0x0){return db[_0xbb61('0x38')][_0xbb61('0x5c')]({'name':_0x26800a[_0xbb61('0x3a')],'resourceId':_0x26800a['id'],'type':_0x1ec7a9[_0xbb61('0x3a')],'sectionId':_0x1ec7a9['id']},{})[_0xbb61('0x1e')](function(){return _0x123262;});}else{return _0x123262;}})['catch'](function(_0x496d0c){logger[_0xbb61('0x23')](_0xbb61('0x63'),_0x496d0c);throw _0x496d0c;});}return _0x123262;})[_0xbb61('0x1e')](respondWithResult(_0x33b840,0xc9))['catch'](handleError(_0x33b840,null));};exports[_0xbb61('0x34')]=function(_0xc95c79,_0x563e12){if(_0xc95c79[_0xbb61('0x5d')]['id']){delete _0xc95c79[_0xbb61('0x5d')]['id'];}return db[_0xbb61('0x3f')][_0xbb61('0x5b')]({'where':{'id':_0xc95c79[_0xbb61('0x64')]['id']},'include':[{'model':db[_0xbb61('0x3d')],'as':_0xbb61('0x3e')}]})[_0xbb61('0x1e')](handleEntityNotFound(_0x563e12,null))['then'](saveUpdates(_0xc95c79[_0xbb61('0x5d')],null))[_0xbb61('0x1e')](respondWithResult(_0x563e12,null))[_0xbb61('0x56')](handleError(_0x563e12,null));};exports[_0xbb61('0x35')]=function(_0x1c924e,_0x5d9589){return db[_0xbb61('0x3f')]['find']({'where':{'id':_0x1c924e[_0xbb61('0x64')]['id']}})['then'](handleEntityNotFound(_0x5d9589,null))[_0xbb61('0x1e')](removeEntity(_0x5d9589,null))[_0xbb61('0x56')](handleError(_0x5d9589,null));};exports[_0xbb61('0x65')]=function(_0xb120a3,_0x17298f){return db[_0xbb61('0x3f')]['describe']()[_0xbb61('0x1e')](respondWithResult(_0x17298f,null))[_0xbb61('0x56')](handleError(_0x17298f,null));};exports[_0xbb61('0x66')]=function(_0x2e9b16,_0x42551a,_0x2c849a){if(_0x2e9b16[_0xbb61('0x5d')]['id']){delete _0x2e9b16[_0xbb61('0x5d')]['id'];}return db[_0xbb61('0x3f')]['find']({'where':{'id':_0x2e9b16[_0xbb61('0x64')]['id']}})['then'](handleEntityNotFound(_0x42551a,null))[_0xbb61('0x1e')](function(_0xd58d8f){if(_0xd58d8f){_0x2e9b16[_0xbb61('0x5d')]['WhatsappAccountId']=_0xd58d8f['id'];return db[_0xbb61('0x67')][_0xbb61('0x5c')](_0x2e9b16['body']);}})['then'](respondWithResult(_0x42551a,null))[_0xbb61('0x56')](handleError(_0x42551a,null));};exports[_0xbb61('0x68')]=function(_0x1f55ad,_0xb1483b,_0x3cc919){var _0x3df491={'raw':![],'where':{}};var _0x92cc39={};var _0x303c5a={'count':0x0,'rows':[]};return db[_0xbb61('0x3f')][_0xbb61('0x69')]({'where':{'id':_0x1f55ad[_0xbb61('0x64')]['id']}})[_0xbb61('0x1e')](handleEntityNotFound(_0xb1483b,null))['then'](function(_0x470c13){if(_0x470c13){_0x92cc39['model']=_[_0xbb61('0x45')](db[_0xbb61('0x67')][_0xbb61('0x40')]);_0x92cc39[_0xbb61('0x44')]=_[_0xbb61('0x45')](_0x1f55ad[_0xbb61('0x44')]);_0x92cc39[_0xbb61('0x46')]=_[_0xbb61('0x47')](_0x92cc39['model'],_0x92cc39['query']);_0x3df491[_0xbb61('0x48')]=_[_0xbb61('0x47')](_0x92cc39['model'],qs[_0xbb61('0x58')](_0x1f55ad[_0xbb61('0x44')]['fields']));_0x3df491[_0xbb61('0x48')]=_0x3df491['attributes'][_0xbb61('0x59')]?_0x3df491[_0xbb61('0x48')]:_0x92cc39[_0xbb61('0x43')];if(!_0x1f55ad['query'][_0xbb61('0x49')]('nolimit')){_0x3df491[_0xbb61('0x2e')]=qs[_0xbb61('0x2e')](_0x1f55ad[_0xbb61('0x44')]['limit']);_0x3df491[_0xbb61('0x2c')]=qs['offset'](_0x1f55ad[_0xbb61('0x44')][_0xbb61('0x2c')]);}_0x3df491['order']=qs[_0xbb61('0x4c')](_0x1f55ad['query']['sort']);_0x3df491['where']=qs['filters'](_[_0xbb61('0x4e')](_0x1f55ad[_0xbb61('0x44')],_0x92cc39[_0xbb61('0x46')]));_0x3df491[_0xbb61('0x4d')]['WhatsappAccountId']=_0x470c13['id'];if(_0x1f55ad[_0xbb61('0x44')][_0xbb61('0x6a')]){_0x3df491[_0xbb61('0x4d')]=_[_0xbb61('0x4f')](_0x3df491[_0xbb61('0x4d')],{'$or':_[_0xbb61('0x50')](_0x3df491[_0xbb61('0x48')],function(_0x36f262){var _0x189e5b={};_0x189e5b[_0x36f262]={'$like':'%'+_0x1f55ad[_0xbb61('0x44')][_0xbb61('0x6a')]+'%'};return _0x189e5b;})});}_0x3df491=_[_0xbb61('0x4f')]({},_0x3df491,_0x1f55ad[_0xbb61('0x53')]);return db[_0xbb61('0x67')][_0xbb61('0x2f')]({'where':_0x3df491[_0xbb61('0x4d')]})[_0xbb61('0x1e')](function(_0x236289){_0x303c5a[_0xbb61('0x2f')]=_0x236289;if(_0x1f55ad[_0xbb61('0x44')]['includeAll']){_0x3df491[_0xbb61('0x5a')]=[{'all':!![]}];}return db[_0xbb61('0x67')][_0xbb61('0x6b')](_0x3df491);})[_0xbb61('0x1e')](function(_0x198bf6){_0x303c5a[_0xbb61('0x55')]=_0x198bf6;return _0x303c5a;});}})['then'](respondWithFilteredResult(_0xb1483b,_0x3df491))['catch'](handleError(_0xb1483b,null));};exports[_0xbb61('0x6c')]=function(_0x169fd3,_0x3661ce,_0x5bf1ad){return db['WhatsappAccount'][_0xbb61('0x5b')]({'where':{'id':_0x169fd3[_0xbb61('0x64')]['id']}})['then'](handleEntityNotFound(_0x3661ce,null))[_0xbb61('0x1e')](function(_0x834511){if(_0x834511){return _0x834511[_0xbb61('0x6c')](_0x169fd3['query'][_0xbb61('0x6d')]);}})['then'](respondWithStatusCode(_0x3661ce,null))[_0xbb61('0x56')](handleError(_0x3661ce,null));};exports[_0xbb61('0x6e')]=function(_0x279d77,_0x59817c,_0x40c099){if(_0x279d77['body']['id']){delete _0x279d77['body']['id'];}return db['WhatsappAccount'][_0xbb61('0x5b')]({'where':{'id':_0x279d77[_0xbb61('0x64')]['id']}})[_0xbb61('0x1e')](handleEntityNotFound(_0x59817c,null))[_0xbb61('0x1e')](function(_0x31c935){if(_0x31c935){_0x279d77['body'][_0xbb61('0x6f')]=_0x31c935['id'];return db['CannedAnswer'][_0xbb61('0x5c')](_0x279d77[_0xbb61('0x5d')]);}})[_0xbb61('0x1e')](respondWithResult(_0x59817c,null))[_0xbb61('0x56')](handleError(_0x59817c,null));};exports[_0xbb61('0x70')]=function(_0xf6576c,_0x4a87e4,_0xa80e81){var _0x215b8e={'raw':![],'where':{}};var _0x1454ff={};var _0x5d5c1={'count':0x0,'rows':[]};return db[_0xbb61('0x3f')][_0xbb61('0x69')]({'where':{'id':_0xf6576c[_0xbb61('0x64')]['id']}})[_0xbb61('0x1e')](handleEntityNotFound(_0x4a87e4,null))['then'](function(_0x93c58){if(_0x93c58){_0x1454ff['model']=_[_0xbb61('0x45')](db[_0xbb61('0x71')][_0xbb61('0x40')]);_0x1454ff['query']=_['keys'](_0xf6576c[_0xbb61('0x44')]);_0x1454ff[_0xbb61('0x46')]=_['intersection'](_0x1454ff[_0xbb61('0x43')],_0x1454ff[_0xbb61('0x44')]);_0x215b8e[_0xbb61('0x48')]=_[_0xbb61('0x47')](_0x1454ff[_0xbb61('0x43')],qs[_0xbb61('0x58')](_0xf6576c[_0xbb61('0x44')][_0xbb61('0x58')]));_0x215b8e[_0xbb61('0x48')]=_0x215b8e[_0xbb61('0x48')][_0xbb61('0x59')]?_0x215b8e[_0xbb61('0x48')]:_0x1454ff['model'];if(!_0xf6576c['query'][_0xbb61('0x49')](_0xbb61('0x4a'))){_0x215b8e[_0xbb61('0x2e')]=qs[_0xbb61('0x2e')](_0xf6576c[_0xbb61('0x44')]['limit']);_0x215b8e[_0xbb61('0x2c')]=qs[_0xbb61('0x2c')](_0xf6576c[_0xbb61('0x44')][_0xbb61('0x2c')]);}_0x215b8e[_0xbb61('0x4b')]=qs['sort'](_0xf6576c[_0xbb61('0x44')][_0xbb61('0x4c')]);_0x215b8e[_0xbb61('0x4d')]=qs[_0xbb61('0x46')](_[_0xbb61('0x4e')](_0xf6576c[_0xbb61('0x44')],_0x1454ff['filters']));_0x215b8e[_0xbb61('0x4d')][_0xbb61('0x6f')]=_0x93c58['id'];if(_0xf6576c[_0xbb61('0x44')][_0xbb61('0x6a')]){_0x215b8e[_0xbb61('0x4d')]=_['merge'](_0x215b8e[_0xbb61('0x4d')],{'$or':_[_0xbb61('0x50')](_0x215b8e[_0xbb61('0x48')],function(_0x7ff6ce){var _0x36a998={};_0x36a998[_0x7ff6ce]={'$like':'%'+_0xf6576c['query'][_0xbb61('0x6a')]+'%'};return _0x36a998;})});}_0x215b8e=_[_0xbb61('0x4f')]({},_0x215b8e,_0xf6576c['options']);return db[_0xbb61('0x71')][_0xbb61('0x2f')]({'where':_0x215b8e[_0xbb61('0x4d')]})[_0xbb61('0x1e')](function(_0x763b84){_0x5d5c1[_0xbb61('0x2f')]=_0x763b84;if(_0xf6576c[_0xbb61('0x44')][_0xbb61('0x54')]){_0x215b8e[_0xbb61('0x5a')]=[{'all':!![]}];}return db['CannedAnswer'][_0xbb61('0x6b')](_0x215b8e);})[_0xbb61('0x1e')](function(_0x4d3c4f){_0x5d5c1[_0xbb61('0x55')]=_0x4d3c4f;return _0x5d5c1;});}})['then'](respondWithFilteredResult(_0x4a87e4,_0x215b8e))[_0xbb61('0x56')](handleError(_0x4a87e4,null));};exports[_0xbb61('0x72')]=function(_0x1c8a8f,_0x5cefec,_0x58e0b2){return db[_0xbb61('0x3f')][_0xbb61('0x5b')]({'where':{'id':_0x1c8a8f[_0xbb61('0x64')]['id']}})[_0xbb61('0x1e')](handleEntityNotFound(_0x5cefec,null))[_0xbb61('0x1e')](function(_0x501c81){if(_0x501c81){return _0x501c81[_0xbb61('0x72')](_0x1c8a8f[_0xbb61('0x44')][_0xbb61('0x6d')]);}})[_0xbb61('0x1e')](respondWithStatusCode(_0x5cefec,null))[_0xbb61('0x56')](handleError(_0x5cefec,null));};exports[_0xbb61('0x73')]=function(_0x7416c,_0x43bed9,_0x516dd8){return db[_0xbb61('0x3f')][_0xbb61('0x5b')]({'where':{'id':_0x7416c[_0xbb61('0x64')]['id']}})[_0xbb61('0x1e')](handleEntityNotFound(_0x43bed9,null))[_0xbb61('0x1e')](function(_0x46baa0){if(_0x46baa0){return _0x46baa0[_0xbb61('0x73')](_0x7416c[_0xbb61('0x5d')][_0xbb61('0x6d')],_[_0xbb61('0x74')](_0x7416c[_0xbb61('0x5d')],['ids','id'])||{})[_0xbb61('0x75')](function(_0x27ac20){for(var _0x50dd3c=0x0;_0x50dd3c<_0x7416c['body']['ids'][_0xbb61('0x59')];_0x50dd3c+=0x1){socket[_0xbb61('0x76')](_0xbb61('0x77'),{'UserId':Number(_0x7416c['body'][_0xbb61('0x6d')][_0x50dd3c]),'WhatsappAccountId':Number(_0x7416c['params']['id'])});}return _0x27ac20;});}})[_0xbb61('0x1e')](respondWithResult(_0x43bed9,null))[_0xbb61('0x56')](handleError(_0x43bed9,null));};exports[_0xbb61('0x78')]=function(_0x4d20de,_0xa3d1d3,_0x2e1afc){return db[_0xbb61('0x3f')][_0xbb61('0x5b')]({'where':{'id':_0x4d20de[_0xbb61('0x64')]['id']}})['then'](handleEntityNotFound(_0xa3d1d3,null))[_0xbb61('0x1e')](function(_0x517920){if(_0x517920){return _0x517920['removeAgents'](_0x4d20de['query']['ids'])[_0xbb61('0x1e')](function(){if(_[_0xbb61('0x79')](_0x4d20de[_0xbb61('0x44')][_0xbb61('0x6d')])){for(var _0x48bc2e=0x0;_0x48bc2e<_0x4d20de[_0xbb61('0x44')][_0xbb61('0x6d')][_0xbb61('0x59')];_0x48bc2e+=0x1){socket[_0xbb61('0x76')](_0xbb61('0x7a'),{'UserId':Number(_0x4d20de['query'][_0xbb61('0x6d')][_0x48bc2e]),'WhatsappAccountId':Number(_0x4d20de[_0xbb61('0x64')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x4d20de[_0xbb61('0x44')][_0xbb61('0x6d')]),'WhatsappAccountId':Number(_0x4d20de['params']['id'])});}});}})[_0xbb61('0x1e')](respondWithStatusCode(_0xa3d1d3,null))['catch'](handleError(_0xa3d1d3,null));};exports[_0xbb61('0x7b')]=function(_0xede5ee,_0xf89f63,_0x2b673a){var _0x120fb0={};var _0x3797c9={};var _0x1bc981;var _0x3f18bd;return db['WhatsappAccount']['findOne']({'where':{'id':_0xede5ee[_0xbb61('0x64')]['id']}})['then'](handleEntityNotFound(_0xf89f63,null))[_0xbb61('0x1e')](function(_0x54e7fc){if(_0x54e7fc){_0x1bc981=_0x54e7fc;_0x3797c9['model']=_[_0xbb61('0x45')](db[_0xbb61('0x7c')]['rawAttributes']);_0x3797c9['query']=_[_0xbb61('0x45')](_0xede5ee[_0xbb61('0x44')]);_0x3797c9[_0xbb61('0x46')]=_[_0xbb61('0x47')](_0x3797c9[_0xbb61('0x43')],_0x3797c9['query']);_0x120fb0[_0xbb61('0x48')]=_[_0xbb61('0x47')](_0x3797c9['model'],qs[_0xbb61('0x58')](_0xede5ee[_0xbb61('0x44')][_0xbb61('0x58')]));_0x120fb0[_0xbb61('0x48')]=_0x120fb0[_0xbb61('0x48')]['length']?_0x120fb0[_0xbb61('0x48')]:_0x3797c9[_0xbb61('0x43')];_0x120fb0['order']=qs[_0xbb61('0x4c')](_0xede5ee[_0xbb61('0x44')][_0xbb61('0x4c')]);_0x120fb0[_0xbb61('0x4d')]=qs['filters'](_[_0xbb61('0x4e')](_0xede5ee[_0xbb61('0x44')],_0x3797c9[_0xbb61('0x46')]));if(_0xede5ee[_0xbb61('0x44')][_0xbb61('0x6a')]){_0x120fb0[_0xbb61('0x4d')]=_[_0xbb61('0x4f')](_0x120fb0[_0xbb61('0x4d')],{'$or':_['map'](_0x120fb0[_0xbb61('0x48')],function(_0x105656){var _0x1eb59b={};_0x1eb59b[_0x105656]={'$like':'%'+_0xede5ee[_0xbb61('0x44')][_0xbb61('0x6a')]+'%'};return _0x1eb59b;})});}_0x120fb0=_[_0xbb61('0x4f')]({},_0x120fb0,_0xede5ee['options']);return _0x1bc981[_0xbb61('0x7b')](_0x120fb0);}})[_0xbb61('0x1e')](function(_0x1bcac8){if(_0x1bcac8){_0x3f18bd=_0x1bcac8[_0xbb61('0x59')];if(!_0xede5ee['query'][_0xbb61('0x49')](_0xbb61('0x4a'))){_0x120fb0[_0xbb61('0x2e')]=qs['limit'](_0xede5ee[_0xbb61('0x44')]['limit']);_0x120fb0[_0xbb61('0x2c')]=qs[_0xbb61('0x2c')](_0xede5ee[_0xbb61('0x44')][_0xbb61('0x2c')]);}return _0x1bc981[_0xbb61('0x7b')](_0x120fb0);}})[_0xbb61('0x1e')](function(_0xa7acb7){if(_0xa7acb7){return _0xa7acb7?{'count':_0x3f18bd,'rows':_0xa7acb7}:null;}})[_0xbb61('0x1e')](respondWithResult(_0xf89f63,null))[_0xbb61('0x56')](handleError(_0xf89f63,null));};exports[_0xbb61('0x7d')]=function(_0x2c8d99,_0x432b16){var _0x594d45=_0x2c8d99['params']['id'];var _0x12c988=_0x2c8d99['body'];var _0x43b71a=0xc8;var _0x5eaec4=null;return db['sequelize'][_0xbb61('0x7e')]({'isolationLevel':db[_0xbb61('0x7f')][_0xbb61('0x80')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x22c277){return db[_0xbb61('0x3f')]['findOne']({'where':{'id':_0x594d45},'transaction':_0x22c277})[_0xbb61('0x1e')](function(_0x4737cc){if(_0x4737cc){return db[_0xbb61('0x81')][_0xbb61('0x35')]({'where':{'WhatsappAccountId':_0x594d45},'transaction':_0x22c277})[_0xbb61('0x1e')](function(){var _0x6ea092=_[_0xbb61('0x50')](_0x12c988,function(_0xf57810){_0xf57810[_0xbb61('0x6f')]=_0x594d45;return _0xf57810;});return db[_0xbb61('0x81')]['bulkCreate'](_0x6ea092,{'transaction':_0x22c277});});}else{_0x43b71a=0x194;_0x5eaec4=[];}});})[_0xbb61('0x1e')](function(){if(_0x43b71a!==0x194){return db[_0xbb61('0x81')][_0xbb61('0x82')]({'where':{'WhatsappAccountId':_0x594d45},'order':_0xbb61('0x83')})[_0xbb61('0x1e')](function(_0x31a9be){_0x5eaec4=_0x31a9be;});}})[_0xbb61('0x56')](function(_0x5220b1){_0x43b71a=0x1f4;logger['error'](_0x5220b1[_0xbb61('0x39')]);if(_0x5220b1['name']){delete _0x5220b1['name'];}_0x5eaec4=_0x5220b1;})[_0xbb61('0x84')](function(){if(_0x5eaec4===null){_0x432b16[_0xbb61('0x28')](_0x43b71a);}else{if(_0x43b71a===0x1f4){_0x432b16['status'](_0x43b71a)[_0xbb61('0x3b')](_0x5eaec4);}else{_0x432b16[_0xbb61('0x29')](_0x43b71a)[_0xbb61('0x2b')](_0x5eaec4);}}});};exports['getApplications']=function(_0x52d1ec,_0x1a79e9,_0x1b0441){var _0xd0ac78={};var _0x44a393={};var _0x59991f;var _0x245c32;return db[_0xbb61('0x3f')][_0xbb61('0x69')]({'where':{'id':_0x52d1ec[_0xbb61('0x64')]['id']}})[_0xbb61('0x1e')](handleEntityNotFound(_0x1a79e9,null))[_0xbb61('0x1e')](function(_0xb2b38b){if(_0xb2b38b){_0x59991f=_0xb2b38b;_0x44a393['model']=_[_0xbb61('0x45')](db[_0xbb61('0x81')]['rawAttributes']);_0x44a393[_0xbb61('0x44')]=_['keys'](_0x52d1ec[_0xbb61('0x44')]);_0x44a393[_0xbb61('0x46')]=_['intersection'](_0x44a393['model'],_0x44a393[_0xbb61('0x44')]);_0xd0ac78[_0xbb61('0x48')]=_[_0xbb61('0x47')](_0x44a393[_0xbb61('0x43')],qs['fields'](_0x52d1ec[_0xbb61('0x44')][_0xbb61('0x58')]));_0xd0ac78[_0xbb61('0x48')]=_0xd0ac78[_0xbb61('0x48')][_0xbb61('0x59')]?_0xd0ac78[_0xbb61('0x48')]:_0x44a393[_0xbb61('0x43')];_0xd0ac78['order']=qs['sort'](_0x52d1ec['query'][_0xbb61('0x4c')]);_0xd0ac78[_0xbb61('0x4d')]=qs[_0xbb61('0x46')](_[_0xbb61('0x4e')](_0x52d1ec[_0xbb61('0x44')],_0x44a393['filters']));if(_0x52d1ec['query'][_0xbb61('0x6a')]){_0xd0ac78[_0xbb61('0x4d')]=_[_0xbb61('0x4f')](_0xd0ac78[_0xbb61('0x4d')],{'$or':_[_0xbb61('0x50')](_0xd0ac78[_0xbb61('0x48')],function(_0x1a43ec){var _0x5c3ce4={};_0x5c3ce4[_0x1a43ec]={'$like':'%'+_0x52d1ec[_0xbb61('0x44')][_0xbb61('0x6a')]+'%'};return _0x5c3ce4;})});}_0xd0ac78=_[_0xbb61('0x4f')]({},_0xd0ac78,_0x52d1ec[_0xbb61('0x53')]);return _0x59991f[_0xbb61('0x85')](_0xd0ac78);}})[_0xbb61('0x1e')](function(_0xa9c5cd){if(_0xa9c5cd){_0x245c32=_0xa9c5cd[_0xbb61('0x59')];if(!_0x52d1ec[_0xbb61('0x44')][_0xbb61('0x49')](_0xbb61('0x4a'))){_0xd0ac78[_0xbb61('0x2e')]=qs[_0xbb61('0x2e')](_0x52d1ec[_0xbb61('0x44')][_0xbb61('0x2e')]);_0xd0ac78['offset']=qs[_0xbb61('0x2c')](_0x52d1ec[_0xbb61('0x44')]['offset']);}return _0x59991f[_0xbb61('0x85')](_0xd0ac78);}})['then'](function(_0x315751){if(_0x315751){return _0x315751?{'count':_0x245c32,'rows':_0x315751}:null;}})[_0xbb61('0x1e')](respondWithResult(_0x1a79e9,null))[_0xbb61('0x56')](handleError(_0x1a79e9,null));};exports[_0xbb61('0x86')]=function(_0x12dd97,_0x5488c9,_0x211dc9){var _0x57245a={'channel':_0xbb61('0x87')};var _0x1b2e53=[];var _0x1753db=[];var _0x177366={};return db['WhatsappAccount'][_0xbb61('0x5b')]({'where':{'id':_0x12dd97[_0xbb61('0x64')]['id']},'include':[{'model':db[_0xbb61('0x81')],'as':_0xbb61('0x88')}]})['then'](handleEntityNotFound(_0x5488c9,null))[_0xbb61('0x1e')](function(_0x187a09){_0x57245a['account']=_0x187a09;if(_0x57245a[_0xbb61('0x89')]&&_0x57245a['account']['type']==='sinch'&&_0x12dd97[_0xbb61('0x5d')][_0xbb61('0x8a')]){if(_0x12dd97[_0xbb61('0x5d')][_0xbb61('0x8a')][_0xbb61('0x59')]===0x0)return;if(_0x12dd97[_0xbb61('0x5d')][_0xbb61('0x8a')][0x0]['state']!=='read')return;return db[_0xbb61('0x8b')][_0xbb61('0x34')]({'read':!![],'readAt':_0x12dd97[_0xbb61('0x5d')][_0xbb61('0x8a')][0x0]['timestamp']},{'where':{'messageId':_0x12dd97[_0xbb61('0x5d')][_0xbb61('0x8a')][0x0][_0xbb61('0x8c')]},'individualHooks':!![]})['then'](function(_0x50ba26){return _0x5488c9[_0xbb61('0x29')](0xc8)[_0xbb61('0x2b')](_0x50ba26);});}_0x57245a[_0xbb61('0x8d')]=_[_0xbb61('0x8e')](_0x187a09[_0xbb61('0x88')],[_0xbb61('0x83')],[_0xbb61('0x8f')]);if(_0x57245a[_0xbb61('0x89')][_0xbb61('0x88')]){delete _0x57245a[_0xbb61('0x89')][_0xbb61('0x88')];}return db[_0xbb61('0x90')][_0xbb61('0x65')]()[_0xbb61('0x1e')](function(_0x23e82f){if(!_0x23e82f){throw new db[(_0xbb61('0x91'))][(_0xbb61('0x92'))](_0xbb61('0x93'));}_0x1b2e53=_[_0xbb61('0x94')](_[_0xbb61('0x45')](_0x23e82f),[_0xbb61('0x95'),_0xbb61('0x96')]);_0x1753db=_[_0xbb61('0x94')](_[_0xbb61('0x45')](_0x23e82f),['createdAt','updatedAt',_0xbb61('0x97'),_0xbb61('0x98')]);_0x57245a[_0xbb61('0x5d')]={'mapKey':'mobile'};if(_0x57245a[_0xbb61('0x89')]&&_0x57245a[_0xbb61('0x89')][_0xbb61('0x51')]===_0xbb61('0x99')){_0x57245a[_0xbb61('0x5d')][_0xbb61('0x9a')]=_0x12dd97[_0xbb61('0x5d')]['From'][_0xbb61('0x9b')](_0xbb61('0x9c'),'');_0x57245a[_0xbb61('0x5d')][_0xbb61('0x5d')]=_0x12dd97[_0xbb61('0x5d')][_0xbb61('0x9d')];_0x57245a[_0xbb61('0x5d')]['messageId']=_0x12dd97[_0xbb61('0x5d')][_0xbb61('0x9e')];}if(_0x57245a[_0xbb61('0x89')]&&_0x57245a[_0xbb61('0x89')]['type']===_0xbb61('0x9f')){_0x57245a[_0xbb61('0x5d')][_0xbb61('0x9a')]=_0x12dd97[_0xbb61('0x5d')][_0xbb61('0xa0')][0x0][_0xbb61('0x9a')];_0x57245a[_0xbb61('0x5d')][_0xbb61('0x5d')]=_0x12dd97[_0xbb61('0x5d')][_0xbb61('0xa0')][0x0][_0xbb61('0x25')]['body'];_0x57245a['body'][_0xbb61('0xa1')]=_0x12dd97[_0xbb61('0x5d')][_0xbb61('0xa0')][0x0][_0xbb61('0x8c')];}if(_0x57245a[_0xbb61('0x5d')]['id']){delete _0x57245a['body']['id'];}if(_['isNil'](_0x57245a[_0xbb61('0x5d')][_0xbb61('0x9a')])){throw new db[(_0xbb61('0x91'))][(_0xbb61('0x92'))]('from\x20is\x20mandatory');}if(_[_0xbb61('0xa2')](_0x57245a[_0xbb61('0x5d')][_0xbb61('0x5d')])||_0x57245a[_0xbb61('0x5d')][_0xbb61('0x5d')]===''){throw new db['Sequelize']['ValidationError'](_0xbb61('0xa3'));}if(_[_0xbb61('0xa2')](_0x57245a[_0xbb61('0x5d')]['mapKey'])){throw new db[(_0xbb61('0x91'))]['ValidationError'](_0xbb61('0xa4')+_0x1753db);}if(!_[_0xbb61('0xa5')](_0x1753db,_0x57245a[_0xbb61('0x5d')][_0xbb61('0xa6')])){throw new db[(_0xbb61('0x91'))][(_0xbb61('0x92'))](_0xbb61('0xa7')+_0x1753db);}_0x177366[_0x57245a['body']['mapKey']]=_0x57245a['body'][_0xbb61('0x9a')];return db[_0xbb61('0xa8')][_0xbb61('0x5b')]({'where':{'id':_0x57245a[_0xbb61('0x89')][_0xbb61('0x98')]},'include':[{'model':db[_0xbb61('0x90')],'as':_0xbb61('0xa9'),'where':_0x177366,'limit':0x1,'order':[[_0xbb61('0x96'),_0xbb61('0xaa')]]}]});})[_0xbb61('0x1e')](handleEntityNotFound(_0x5488c9,null))[_0xbb61('0x1e')](function(_0x4b6d48){if(_0x4b6d48){_0x57245a[_0xbb61('0xab')]=_[_0xbb61('0x74')](_0x4b6d48,[_0xbb61('0xa9')]);if(_0x4b6d48[_0xbb61('0xa9')][_0xbb61('0x59')]){return _0x4b6d48['Contacts'][0x0];}var _0x3ff845=_[_0xbb61('0x17')](_0x57245a[_0xbb61('0x5d')],{'firstName':_0x57245a[_0xbb61('0x5d')][_0xbb61('0x9a')],'ListId':_0x4b6d48['id']});_0x3ff845[_0x57245a['body'][_0xbb61('0xa6')]]=_0x57245a['body']['from'];return db[_0xbb61('0x90')][_0xbb61('0x5c')](_0x3ff845,{'fields':_0x1b2e53,'raw':!![]});}})['then'](handleEntityNotFound(_0x5488c9,null))['then'](function(_0x1000ed){if(_0x1000ed){_0x57245a[_0xbb61('0xac')]=_0x1000ed;var _0x1f8541={'ContactId':_0x1000ed['id'],'phone':_0x57245a[_0xbb61('0x5d')][_0xbb61('0x9a')],'WhatsappAccountId':_0x12dd97[_0xbb61('0x64')]['id']};var _0x11ceb6={'ContactId':_0x1000ed['id'],'WhatsappAccountId':_0x12dd97[_0xbb61('0x64')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xbb61('0x5b')]({'where':_0x11ceb6})[_0xbb61('0x1e')](function(_0xfa54f6){if(_0xfa54f6){return[_0xfa54f6,![]];}return db[_0xbb61('0xad')][_0xbb61('0x5c')](_0x1f8541)[_0xbb61('0x1e')](function(_0xa77a95){return[_0xa77a95,!![]];});});}})[_0xbb61('0x75')](function(_0x23fad8,_0x7ca1d6){_0x57245a[_0xbb61('0xae')]=_0x23fad8[_0xbb61('0x36')]({'plain':!![]});_0x57245a['interaction'][_0xbb61('0xaf')]=![];if(_0x7ca1d6){if(_0x57245a['account']['autoclose']){_0x57245a[_0xbb61('0x8d')][_0xbb61('0xb0')]({'id':0x0,'priority':_0x57245a[_0xbb61('0x8d')][_0xbb61('0x59')]+0x1,'app':_0xbb61('0xb1'),'appdata':_0xbb61('0xb2'),'interval':_0xbb61('0xb3')});}_0x57245a[_0xbb61('0xae')]['created']=!![];}return db['WhatsappMessage'][_0xbb61('0x5c')]({'phone':_0x57245a['body'][_0xbb61('0x9a')],'messageId':_0x57245a[_0xbb61('0x5d')][_0xbb61('0xa1')],'body':_0x57245a['body']['body'],'WhatsappAccountId':_0x12dd97[_0xbb61('0x64')]['id'],'WhatsappInteractionId':_0x23fad8['id'],'direction':'in','ContactId':_0x23fad8[_0xbb61('0xb4')],'AttachmentId':_0x57245a[_0xbb61('0x5d')][_0xbb61('0xb5')]});})[_0xbb61('0x1e')](function(_0x11825b){_0x57245a[_0xbb61('0x25')]=_0x11825b;if(_0x57245a[_0xbb61('0xae')][_0xbb61('0xb6')]){return db[_0xbb61('0x7c')][_0xbb61('0x5b')]({'attributes':['id',_0xbb61('0x3a')],'where':{'id':_0x57245a[_0xbb61('0xae')][_0xbb61('0xb6')]}})['then'](function(_0x445836){if(_0x445836){_0x57245a[_0xbb61('0x8d')][_0xbb61('0xb7')]({'id':0x0,'priority':0x0,'app':_0xbb61('0xb8'),'appdata':_0x445836[_0xbb61('0x3a')]+','+(_0x57245a[_0xbb61('0x89')][_0xbb61('0xb9')]||0xa),'interval':_0xbb61('0xb3')});}return respondWithRpcPromise('Start','startRouting',_0x57245a);});}return respondWithRpcPromise(_0xbb61('0xba'),_0xbb61('0xbb'),_0x57245a);})[_0xbb61('0x1e')](function(_0x116484){if(_0x116484){var _0x21bd78=0xc8;var _0x5ed61f=_0xbb61('0xbc');logger['info'](_0xbb61('0x22'),_0x5ed61f,_0x21bd78,_0xbb61('0xbd'));logger[_0xbb61('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x5ed61f,_0x21bd78,_0xbb61('0xbd'),JSON[_0xbb61('0xbe')](_0x116484));if(_0x57245a[_0xbb61('0x89')][_0xbb61('0x51')]===_0xbb61('0x99')){return _0x5488c9['status'](_0x21bd78)[_0xbb61('0xbf')](_0xbb61('0xc0'),_0xbb61('0xc1'))[_0xbb61('0x3b')]('\x0a');}else{return _0x5488c9[_0xbb61('0x29')](_0x21bd78)[_0xbb61('0x2b')](_0x116484);}}});})[_0xbb61('0x56')](handleError(_0x5488c9,null));};exports['send']=function(_0x11e5ba,_0x18bfe3,_0x585b78){var _0x3064b3,_0xade38c,_0x45a1e2;if(_[_0xbb61('0xa2')](_0x11e5ba[_0xbb61('0x5d')][_0xbb61('0x5d')])||_0x11e5ba[_0xbb61('0x5d')]['body']===''){throw new db['Sequelize'][(_0xbb61('0x92'))](_0xbb61('0xa3'));}if(_[_0xbb61('0xa2')](_0x11e5ba[_0xbb61('0x5d')]['to'])){throw new db[(_0xbb61('0x91'))]['ValidationError']('to\x20is\x20mandatory');}_0x3064b3=_0x11e5ba[_0xbb61('0x5d')]['to'];return db[_0xbb61('0x3f')][_0xbb61('0x5b')]({'where':{'id':_0x11e5ba[_0xbb61('0x64')]['id']},'include':[{'model':db[_0xbb61('0xa8')],'as':_0xbb61('0xc2'),'include':[{'model':db[_0xbb61('0x90')],'as':'Contacts','where':{'mobile':_0x3064b3},'limit':0x1,'order':[[_0xbb61('0x96'),_0xbb61('0xaa')]]}]}]})[_0xbb61('0x1e')](handleEntityNotFound(_0x18bfe3,null))[_0xbb61('0x1e')](function(_0x5db081){if(_0x5db081&&_0x5db081[_0xbb61('0xc2')]){_0xade38c=_0x5db081[_0xbb61('0x36')]({'plain':!![]});if(_0xade38c['List']&&_0xade38c[_0xbb61('0xc2')]['Contacts'][_0xbb61('0x59')]){return _0xade38c['List'][_0xbb61('0xa9')][0x0];}return db[_0xbb61('0x90')][_0xbb61('0x5c')](_[_0xbb61('0x17')](_0x11e5ba[_0xbb61('0x5d')],{'firstName':_0x3064b3,'mobile':_0x3064b3,'phone':_0x3064b3,'ListId':_0xade38c[_0xbb61('0x98')]}));}})[_0xbb61('0x1e')](handleEntityNotFound(_0x18bfe3,null))[_0xbb61('0x1e')](function(_0x535151){if(_0x535151){_0x45a1e2=_0x535151;return db[_0xbb61('0xad')][_0xbb61('0x5b')]({'where':{'ContactId':_0x45a1e2['id'],'closed':![],'WhatsappAccountId':_0xade38c['id']}})[_0xbb61('0x1e')](function(_0x1f07c0){if(_0x1f07c0){return[_0x1f07c0,![]];}return db['WhatsappInteraction'][_0xbb61('0x5c')]({'UserId':_0x11e5ba['user']['id'],'ContactId':_0x45a1e2['id'],'WhatsappAccountId':_0xade38c['id'],'phone':_0x3064b3,'firstMsgDirection':_0xbb61('0xc3'),'Messages':[_['merge'](_0x11e5ba[_0xbb61('0x5d')],{'read':![],'body':_0x11e5ba[_0xbb61('0x5d')][_0xbb61('0x5d')],'phone':_0x3064b3,'WhatsappAccountId':_0xade38c['id'],'UserId':_0x11e5ba[_0xbb61('0x5e')]['id'],'ContactId':_0x45a1e2['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xbb61('0xc4')}]})['then'](function(_0x173b0a){return[_0x173b0a,!![]];});});}})['spread'](function(_0x25e180,_0x24152b){if(_0x24152b){return _0x25e180;}return db['WhatsappMessage'][_0xbb61('0x5c')](_[_0xbb61('0x4f')](_0x11e5ba[_0xbb61('0x5d')],{'read':![],'body':_0x11e5ba[_0xbb61('0x5d')][_0xbb61('0x5d')],'phone':_0x3064b3,'WhatsappAccountId':_0xade38c['id'],'WhatsappInteractionId':_0x25e180['id'],'UserId':_0x11e5ba[_0xbb61('0x5e')]['id'],'ContactId':_0x45a1e2['id']}))[_0xbb61('0x1e')](function(_0x194a6f){_0x25e180[_0xbb61('0xc5')]['Messages']=[];_0x25e180[_0xbb61('0xc5')][_0xbb61('0xc4')]['push'](_0x194a6f[_0xbb61('0xc5')]);return _0x25e180;});})[_0xbb61('0x1e')](respondWithResult(_0x18bfe3,null))[_0xbb61('0x56')](handleError(_0x18bfe3,null));}; \ No newline at end of file +var _0xedec=['message_id','Sequelize','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','created','ContactId','AttachmentId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','stringify','Content-Type','text/xml','send','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','spread','dataValues','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','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','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','show','params','Pause','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','CmContact','ValidationError','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','replace','messageId','notifications'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xedec,0x1a4));var _0xcede=function(_0x4c9730,_0x412b10){_0x4c9730=_0x4c9730-0x0;var _0x16a1ef=_0xedec[_0x4c9730];return _0x16a1ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcede('0x0'));var rp=require('request-promise');var moment=require(_0xcede('0x1'));var BPromise=require(_0xcede('0x2'));var Mustache=require(_0xcede('0x3'));var util=require('util');var path=require(_0xcede('0x4'));var sox=require(_0xcede('0x5'));var csv=require(_0xcede('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcede('0x7'));var _=require(_0xcede('0x8'));var squel=require(_0xcede('0x9'));var crypto=require('crypto');var jsforce=require(_0xcede('0xa'));var deskjs=require(_0xcede('0xb'));var toCsv=require(_0xcede('0x6'));var querystring=require(_0xcede('0xc'));var Papa=require('papaparse');var Redis=require(_0xcede('0xd'));var authService=require(_0xcede('0xe'));var qs=require(_0xcede('0xf'));var as=require(_0xcede('0x10'));var hardwareService=require(_0xcede('0x11'));var logger=require(_0xcede('0x12'))(_0xcede('0x13'));var utils=require(_0xcede('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xcede('0x15')](config[_0xcede('0x16')],{'host':_0xcede('0x17'),'port':0x18eb});var socket=require(_0xcede('0x18'))(new Redis(config[_0xcede('0x16')]));require(_0xcede('0x19'))[_0xcede('0x1a')](socket);var jayson=require(_0xcede('0x1b'));var client=jayson[_0xcede('0x1c')][_0xcede('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x3768b9,_0x1eebaa,_0x4d6f84,_0x4811b6){return new BPromise(function(_0x1c0552,_0x59d945){var _0x51b5d2=_0x4811b6||client;return _0x51b5d2[_0xcede('0x1e')](_0x3768b9,_0x4d6f84)['then'](function(_0xf2983e){logger[_0xcede('0x1f')](_0xcede('0x20'),_0x1eebaa,_0xcede('0x21'));logger[_0xcede('0x22')](_0xcede('0x23'),_0x1eebaa,_0xcede('0x21'),JSON['stringify'](_0xf2983e));if(_0xf2983e[_0xcede('0x24')]){if(_0xf2983e['error'][_0xcede('0x25')]===0x1f4){logger[_0xcede('0x24')](_0xcede('0x20'),_0x1eebaa,_0xf2983e['error'][_0xcede('0x26')]);return _0x59d945(_0xf2983e[_0xcede('0x24')]['message']);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1eebaa,_0xf2983e['error']['message']);return _0x1c0552(_0xf2983e[_0xcede('0x24')][_0xcede('0x26')]);}else{logger[_0xcede('0x1f')](_0xcede('0x20'),_0x1eebaa,'request\x20sent');_0x1c0552(_0xf2983e['result'][_0xcede('0x26')]);}})[_0xcede('0x27')](function(_0x22a838){logger[_0xcede('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x1eebaa,_0x22a838);_0x59d945(_0x22a838);});});}function respondWithStatusCode(_0x92ce19,_0x1a3533){_0x1a3533=_0x1a3533||0xcc;return function(_0x2e45c2){if(_0x2e45c2){return _0x92ce19[_0xcede('0x28')](_0x1a3533);}return _0x92ce19[_0xcede('0x29')](_0x1a3533)[_0xcede('0x2a')]();};}function respondWithResult(_0x96aa4c,_0xd3d133){_0xd3d133=_0xd3d133||0xc8;return function(_0x1f7d99){if(_0x1f7d99){return _0x96aa4c[_0xcede('0x29')](_0xd3d133)[_0xcede('0x2b')](_0x1f7d99);}};}function respondWithFilteredResult(_0x3e1ae9,_0xb44588){return function(_0x38652a){if(_0x38652a){var _0x5a7626=typeof _0xb44588['offset']===_0xcede('0x2c')&&typeof _0xb44588[_0xcede('0x2d')]===_0xcede('0x2c');var _0x18b54f=_0x38652a[_0xcede('0x2e')];var _0x355f8=_0x5a7626?0x0:_0xb44588['offset'];var _0xd85bba=_0x5a7626?_0x38652a['count']:_0xb44588[_0xcede('0x2f')]+_0xb44588['limit'];var _0x385e57;if(_0xd85bba>=_0x18b54f){_0xd85bba=_0x18b54f;_0x385e57=0xc8;}else{_0x385e57=0xce;}_0x3e1ae9[_0xcede('0x29')](_0x385e57);return _0x3e1ae9[_0xcede('0x30')](_0xcede('0x31'),_0x355f8+'-'+_0xd85bba+'/'+_0x18b54f)[_0xcede('0x2b')](_0x38652a);}return null;};}function patchUpdates(_0x2bc549){return function(_0x3fb701){try{jsonpatch[_0xcede('0x32')](_0x3fb701,_0x2bc549,!![]);}catch(_0x1a12f7){return BPromise[_0xcede('0x33')](_0x1a12f7);}return _0x3fb701[_0xcede('0x34')]();};}function saveUpdates(_0x4feafb,_0x1f3816){return function(_0x4a36b7){if(_0x4a36b7){return _0x4a36b7[_0xcede('0x35')](_0x4feafb)[_0xcede('0x36')](function(_0x3818b4){return _0x3818b4;});}return null;};}function removeEntity(_0xd65946,_0x1dd46e){return function(_0x3a7bbf){if(_0x3a7bbf){return _0x3a7bbf[_0xcede('0x37')]()['then'](function(){var _0x2e4b10=_0x3a7bbf[_0xcede('0x38')]({'plain':!![]});var _0x41e726=_0xcede('0x39');return db[_0xcede('0x3a')][_0xcede('0x37')]({'where':{'type':_0x41e726,'resourceId':_0x2e4b10['id']}})['then'](function(){return _0x3a7bbf;});})['then'](function(){_0xd65946[_0xcede('0x29')](0xcc)[_0xcede('0x2a')]();});}};}function handleEntityNotFound(_0x59dec2,_0x183e62){return function(_0x2c62e8){if(!_0x2c62e8){_0x59dec2['sendStatus'](0x194);}return _0x2c62e8;};}function handleError(_0x46a487,_0x283629){_0x283629=_0x283629||0x1f4;return function(_0x2aca76){logger[_0xcede('0x24')](_0x2aca76[_0xcede('0x3b')]);if(_0x2aca76[_0xcede('0x3c')]){delete _0x2aca76[_0xcede('0x3c')];}_0x46a487[_0xcede('0x29')](_0x283629)['send'](_0x2aca76);};}exports[_0xcede('0x3d')]=function(_0x5363d2,_0x5a7e0c){var _0x5e6d7b={'include':[{'model':db['Pause'],'as':_0xcede('0x3e')}]},_0x1367a3={},_0x46ba28={'count':0x0,'rows':[]};var _0x52d32d=_[_0xcede('0x3f')](db[_0xcede('0x40')][_0xcede('0x41')],function(_0x58615e){return{'name':_0x58615e[_0xcede('0x42')],'type':_0x58615e[_0xcede('0x43')]['key']};});_0x1367a3['model']=_[_0xcede('0x3f')](_0x52d32d,_0xcede('0x3c'));_0x1367a3['query']=_['keys'](_0x5363d2[_0xcede('0x44')]);_0x1367a3['filters']=_['intersection'](_0x1367a3[_0xcede('0x45')],_0x1367a3[_0xcede('0x44')]);_0x5e6d7b['attributes']=_[_0xcede('0x46')](_0x1367a3['model'],qs[_0xcede('0x47')](_0x5363d2[_0xcede('0x44')][_0xcede('0x47')]));_0x5e6d7b['attributes']=_0x5e6d7b[_0xcede('0x48')][_0xcede('0x49')]?_0x5e6d7b[_0xcede('0x48')]:_0x1367a3['model'];if(!_0x5363d2[_0xcede('0x44')][_0xcede('0x4a')](_0xcede('0x4b'))){_0x5e6d7b[_0xcede('0x2d')]=qs[_0xcede('0x2d')](_0x5363d2['query'][_0xcede('0x2d')]);_0x5e6d7b[_0xcede('0x2f')]=qs[_0xcede('0x2f')](_0x5363d2['query'][_0xcede('0x2f')]);}_0x5e6d7b[_0xcede('0x4c')]=qs[_0xcede('0x4d')](_0x5363d2[_0xcede('0x44')][_0xcede('0x4d')]);_0x5e6d7b[_0xcede('0x4e')]=qs[_0xcede('0x4f')](_[_0xcede('0x50')](_0x5363d2['query'],_0x1367a3[_0xcede('0x4f')]),_0x52d32d);if(_0x5363d2[_0xcede('0x44')][_0xcede('0x51')]){_0x5e6d7b['where']=_[_0xcede('0x52')](_0x5e6d7b[_0xcede('0x4e')],{'$or':_[_0xcede('0x3f')](_0x52d32d,function(_0x54047b){if(_0x54047b['type']!=='VIRTUAL'){var _0x594b2d={};_0x594b2d[_0x54047b['name']]={'$like':'%'+_0x5363d2[_0xcede('0x44')][_0xcede('0x51')]+'%'};return _0x594b2d;}})});}_0x5e6d7b=_[_0xcede('0x52')]({},_0x5e6d7b,_0x5363d2[_0xcede('0x53')]);var _0x29fb63={'where':_0x5e6d7b[_0xcede('0x4e')]};return db[_0xcede('0x40')][_0xcede('0x2e')](_0x29fb63)[_0xcede('0x36')](function(_0x439714){_0x46ba28[_0xcede('0x2e')]=_0x439714;if(_0x5363d2[_0xcede('0x44')]['includeAll']){_0x5e6d7b[_0xcede('0x54')]=[{'all':!![]}];}return db[_0xcede('0x40')][_0xcede('0x55')](_0x5e6d7b);})[_0xcede('0x36')](function(_0xf3ae12){_0x46ba28[_0xcede('0x56')]=_0xf3ae12;return _0x46ba28;})[_0xcede('0x36')](respondWithFilteredResult(_0x5a7e0c,_0x5e6d7b))[_0xcede('0x27')](handleError(_0x5a7e0c,null));};exports[_0xcede('0x57')]=function(_0x536776,_0x2fe7d1){var _0x2eccea={'raw':![],'where':{'id':_0x536776[_0xcede('0x58')]['id']},'include':[{'model':db[_0xcede('0x59')],'as':_0xcede('0x3e')}]},_0x428483={};_0x428483[_0xcede('0x45')]=_[_0xcede('0x5a')](db[_0xcede('0x40')][_0xcede('0x41')]);_0x428483[_0xcede('0x44')]=_[_0xcede('0x5a')](_0x536776[_0xcede('0x44')]);_0x428483['filters']=_[_0xcede('0x46')](_0x428483[_0xcede('0x45')],_0x428483[_0xcede('0x44')]);_0x2eccea[_0xcede('0x48')]=_[_0xcede('0x46')](_0x428483[_0xcede('0x45')],qs[_0xcede('0x47')](_0x536776[_0xcede('0x44')][_0xcede('0x47')]));_0x2eccea[_0xcede('0x48')]=_0x2eccea[_0xcede('0x48')][_0xcede('0x49')]?_0x2eccea[_0xcede('0x48')]:_0x428483[_0xcede('0x45')];if(_0x536776[_0xcede('0x44')]['includeAll']){_0x2eccea[_0xcede('0x54')]=[{'all':!![]}];}_0x2eccea=_[_0xcede('0x52')]({},_0x2eccea,_0x536776[_0xcede('0x53')]);return db[_0xcede('0x40')][_0xcede('0x5b')](_0x2eccea)[_0xcede('0x36')](handleEntityNotFound(_0x2fe7d1,null))['then'](respondWithResult(_0x2fe7d1,null))[_0xcede('0x27')](handleError(_0x2fe7d1,null));};exports[_0xcede('0x5c')]=function(_0x4cb548,_0x31057c){return db[_0xcede('0x40')]['create'](_0x4cb548['body'],{})[_0xcede('0x36')](function(_0x590e57){var _0x4f1e6e=_0x4cb548[_0xcede('0x5d')][_0xcede('0x38')]({'plain':!![]});if(!_0x4f1e6e)throw new Error(_0xcede('0x5e'));if(_0x4f1e6e[_0xcede('0x5f')]==='user'){var _0x4b9b98=_0x590e57[_0xcede('0x38')]({'plain':!![]});var _0x4c2704='WhatsappAccounts';return db[_0xcede('0x60')]['find']({'where':{'name':_0x4c2704,'userProfileId':_0x4f1e6e[_0xcede('0x61')]},'raw':!![]})[_0xcede('0x36')](function(_0x4410c5){if(_0x4410c5&&_0x4410c5[_0xcede('0x62')]===0x0){return db[_0xcede('0x3a')][_0xcede('0x5c')]({'name':_0x4b9b98[_0xcede('0x3c')],'resourceId':_0x4b9b98['id'],'type':_0x4410c5[_0xcede('0x3c')],'sectionId':_0x4410c5['id']},{})[_0xcede('0x36')](function(){return _0x590e57;});}else{return _0x590e57;}})[_0xcede('0x27')](function(_0x5a545c){logger['error'](_0xcede('0x63'),_0x5a545c);throw _0x5a545c;});}return _0x590e57;})['then'](respondWithResult(_0x31057c,0xc9))['catch'](handleError(_0x31057c,null));};exports[_0xcede('0x35')]=function(_0x4473e7,_0x370875){if(_0x4473e7[_0xcede('0x64')]['id']){delete _0x4473e7['body']['id'];}return db[_0xcede('0x40')]['find']({'where':{'id':_0x4473e7[_0xcede('0x58')]['id']},'include':[{'model':db[_0xcede('0x59')],'as':_0xcede('0x3e')}]})['then'](handleEntityNotFound(_0x370875,null))[_0xcede('0x36')](saveUpdates(_0x4473e7[_0xcede('0x64')],null))[_0xcede('0x36')](respondWithResult(_0x370875,null))[_0xcede('0x27')](handleError(_0x370875,null));};exports['destroy']=function(_0x4e0177,_0x4ce61c){return db[_0xcede('0x40')][_0xcede('0x5b')]({'where':{'id':_0x4e0177[_0xcede('0x58')]['id']}})['then'](handleEntityNotFound(_0x4ce61c,null))['then'](removeEntity(_0x4ce61c,null))[_0xcede('0x27')](handleError(_0x4ce61c,null));};exports[_0xcede('0x65')]=function(_0x7faecf,_0x1ed5ea){return db[_0xcede('0x40')][_0xcede('0x65')]()['then'](respondWithResult(_0x1ed5ea,null))[_0xcede('0x27')](handleError(_0x1ed5ea,null));};exports[_0xcede('0x66')]=function(_0x2e3233,_0x366012,_0x3852fa){if(_0x2e3233[_0xcede('0x64')]['id']){delete _0x2e3233[_0xcede('0x64')]['id'];}return db['WhatsappAccount'][_0xcede('0x5b')]({'where':{'id':_0x2e3233['params']['id']}})[_0xcede('0x36')](handleEntityNotFound(_0x366012,null))[_0xcede('0x36')](function(_0x2642bf){if(_0x2642bf){_0x2e3233['body'][_0xcede('0x67')]=_0x2642bf['id'];return db['Disposition'][_0xcede('0x5c')](_0x2e3233[_0xcede('0x64')]);}})['then'](respondWithResult(_0x366012,null))[_0xcede('0x27')](handleError(_0x366012,null));};exports[_0xcede('0x68')]=function(_0x1eec32,_0x55f829,_0x2ae5e8){var _0x474d7c={'raw':![],'where':{}};var _0x5f2200={};var _0xfd08a2={'count':0x0,'rows':[]};return db[_0xcede('0x40')][_0xcede('0x69')]({'where':{'id':_0x1eec32['params']['id']}})[_0xcede('0x36')](handleEntityNotFound(_0x55f829,null))[_0xcede('0x36')](function(_0x281fd6){if(_0x281fd6){_0x5f2200[_0xcede('0x45')]=_[_0xcede('0x5a')](db[_0xcede('0x6a')]['rawAttributes']);_0x5f2200[_0xcede('0x44')]=_[_0xcede('0x5a')](_0x1eec32[_0xcede('0x44')]);_0x5f2200[_0xcede('0x4f')]=_[_0xcede('0x46')](_0x5f2200[_0xcede('0x45')],_0x5f2200['query']);_0x474d7c['attributes']=_['intersection'](_0x5f2200[_0xcede('0x45')],qs['fields'](_0x1eec32['query'][_0xcede('0x47')]));_0x474d7c['attributes']=_0x474d7c[_0xcede('0x48')][_0xcede('0x49')]?_0x474d7c[_0xcede('0x48')]:_0x5f2200[_0xcede('0x45')];if(!_0x1eec32[_0xcede('0x44')][_0xcede('0x4a')](_0xcede('0x4b'))){_0x474d7c[_0xcede('0x2d')]=qs['limit'](_0x1eec32['query'][_0xcede('0x2d')]);_0x474d7c[_0xcede('0x2f')]=qs[_0xcede('0x2f')](_0x1eec32[_0xcede('0x44')][_0xcede('0x2f')]);}_0x474d7c['order']=qs[_0xcede('0x4d')](_0x1eec32['query']['sort']);_0x474d7c[_0xcede('0x4e')]=qs[_0xcede('0x4f')](_['pick'](_0x1eec32[_0xcede('0x44')],_0x5f2200[_0xcede('0x4f')]));_0x474d7c['where'][_0xcede('0x67')]=_0x281fd6['id'];if(_0x1eec32[_0xcede('0x44')]['filter']){_0x474d7c['where']=_[_0xcede('0x52')](_0x474d7c[_0xcede('0x4e')],{'$or':_['map'](_0x474d7c['attributes'],function(_0x2c1b9c){var _0x16d348={};_0x16d348[_0x2c1b9c]={'$like':'%'+_0x1eec32[_0xcede('0x44')][_0xcede('0x51')]+'%'};return _0x16d348;})});}_0x474d7c=_[_0xcede('0x52')]({},_0x474d7c,_0x1eec32[_0xcede('0x53')]);return db[_0xcede('0x6a')][_0xcede('0x2e')]({'where':_0x474d7c[_0xcede('0x4e')]})['then'](function(_0x22834a){_0xfd08a2[_0xcede('0x2e')]=_0x22834a;if(_0x1eec32['query'][_0xcede('0x6b')]){_0x474d7c[_0xcede('0x54')]=[{'all':!![]}];}return db[_0xcede('0x6a')][_0xcede('0x55')](_0x474d7c);})[_0xcede('0x36')](function(_0x30c5df){_0xfd08a2[_0xcede('0x56')]=_0x30c5df;return _0xfd08a2;});}})[_0xcede('0x36')](respondWithFilteredResult(_0x55f829,_0x474d7c))[_0xcede('0x27')](handleError(_0x55f829,null));};exports[_0xcede('0x6c')]=function(_0x3b95b3,_0x2b7e88,_0x330dd1){return db[_0xcede('0x40')]['find']({'where':{'id':_0x3b95b3[_0xcede('0x58')]['id']}})['then'](handleEntityNotFound(_0x2b7e88,null))[_0xcede('0x36')](function(_0x5b0a40){if(_0x5b0a40){return _0x5b0a40[_0xcede('0x6c')](_0x3b95b3['query'][_0xcede('0x6d')]);}})[_0xcede('0x36')](respondWithStatusCode(_0x2b7e88,null))[_0xcede('0x27')](handleError(_0x2b7e88,null));};exports[_0xcede('0x6e')]=function(_0x325763,_0x4d1b81,_0xf6d294){if(_0x325763[_0xcede('0x64')]['id']){delete _0x325763[_0xcede('0x64')]['id'];}return db[_0xcede('0x40')][_0xcede('0x5b')]({'where':{'id':_0x325763[_0xcede('0x58')]['id']}})[_0xcede('0x36')](handleEntityNotFound(_0x4d1b81,null))[_0xcede('0x36')](function(_0x3816ca){if(_0x3816ca){_0x325763[_0xcede('0x64')]['WhatsappAccountId']=_0x3816ca['id'];return db[_0xcede('0x6f')][_0xcede('0x5c')](_0x325763[_0xcede('0x64')]);}})[_0xcede('0x36')](respondWithResult(_0x4d1b81,null))[_0xcede('0x27')](handleError(_0x4d1b81,null));};exports[_0xcede('0x70')]=function(_0x4c6b05,_0x2114a3,_0x5ddff8){var _0x5713f8={'raw':![],'where':{}};var _0x13fd8c={};var _0x525e4f={'count':0x0,'rows':[]};return db[_0xcede('0x40')][_0xcede('0x69')]({'where':{'id':_0x4c6b05[_0xcede('0x58')]['id']}})[_0xcede('0x36')](handleEntityNotFound(_0x2114a3,null))[_0xcede('0x36')](function(_0x50b3ce){if(_0x50b3ce){_0x13fd8c[_0xcede('0x45')]=_[_0xcede('0x5a')](db[_0xcede('0x6f')]['rawAttributes']);_0x13fd8c[_0xcede('0x44')]=_['keys'](_0x4c6b05[_0xcede('0x44')]);_0x13fd8c[_0xcede('0x4f')]=_['intersection'](_0x13fd8c[_0xcede('0x45')],_0x13fd8c[_0xcede('0x44')]);_0x5713f8['attributes']=_[_0xcede('0x46')](_0x13fd8c[_0xcede('0x45')],qs['fields'](_0x4c6b05['query'][_0xcede('0x47')]));_0x5713f8[_0xcede('0x48')]=_0x5713f8[_0xcede('0x48')][_0xcede('0x49')]?_0x5713f8[_0xcede('0x48')]:_0x13fd8c[_0xcede('0x45')];if(!_0x4c6b05[_0xcede('0x44')][_0xcede('0x4a')](_0xcede('0x4b'))){_0x5713f8['limit']=qs['limit'](_0x4c6b05['query']['limit']);_0x5713f8[_0xcede('0x2f')]=qs[_0xcede('0x2f')](_0x4c6b05[_0xcede('0x44')]['offset']);}_0x5713f8[_0xcede('0x4c')]=qs[_0xcede('0x4d')](_0x4c6b05[_0xcede('0x44')][_0xcede('0x4d')]);_0x5713f8[_0xcede('0x4e')]=qs[_0xcede('0x4f')](_[_0xcede('0x50')](_0x4c6b05[_0xcede('0x44')],_0x13fd8c[_0xcede('0x4f')]));_0x5713f8['where'][_0xcede('0x67')]=_0x50b3ce['id'];if(_0x4c6b05[_0xcede('0x44')][_0xcede('0x51')]){_0x5713f8[_0xcede('0x4e')]=_[_0xcede('0x52')](_0x5713f8['where'],{'$or':_[_0xcede('0x3f')](_0x5713f8['attributes'],function(_0x435c93){var _0x2ca845={};_0x2ca845[_0x435c93]={'$like':'%'+_0x4c6b05[_0xcede('0x44')]['filter']+'%'};return _0x2ca845;})});}_0x5713f8=_[_0xcede('0x52')]({},_0x5713f8,_0x4c6b05[_0xcede('0x53')]);return db[_0xcede('0x6f')][_0xcede('0x2e')]({'where':_0x5713f8[_0xcede('0x4e')]})[_0xcede('0x36')](function(_0x6b5f30){_0x525e4f[_0xcede('0x2e')]=_0x6b5f30;if(_0x4c6b05[_0xcede('0x44')]['includeAll']){_0x5713f8[_0xcede('0x54')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x5713f8);})[_0xcede('0x36')](function(_0x21f6ab){_0x525e4f[_0xcede('0x56')]=_0x21f6ab;return _0x525e4f;});}})[_0xcede('0x36')](respondWithFilteredResult(_0x2114a3,_0x5713f8))['catch'](handleError(_0x2114a3,null));};exports[_0xcede('0x71')]=function(_0x43cfda,_0x49005e,_0x5702a5){return db[_0xcede('0x40')][_0xcede('0x5b')]({'where':{'id':_0x43cfda[_0xcede('0x58')]['id']}})[_0xcede('0x36')](handleEntityNotFound(_0x49005e,null))[_0xcede('0x36')](function(_0x5cf48b){if(_0x5cf48b){return _0x5cf48b['removeAnswers'](_0x43cfda[_0xcede('0x44')]['ids']);}})[_0xcede('0x36')](respondWithStatusCode(_0x49005e,null))[_0xcede('0x27')](handleError(_0x49005e,null));};exports[_0xcede('0x72')]=function(_0x160a3a,_0x98293c,_0x43a070){return db[_0xcede('0x40')][_0xcede('0x5b')]({'where':{'id':_0x160a3a['params']['id']}})[_0xcede('0x36')](handleEntityNotFound(_0x98293c,null))[_0xcede('0x36')](function(_0x4b3c4b){if(_0x4b3c4b){return _0x4b3c4b[_0xcede('0x72')](_0x160a3a['body'][_0xcede('0x6d')],_[_0xcede('0x73')](_0x160a3a[_0xcede('0x64')],[_0xcede('0x6d'),'id'])||{})['spread'](function(_0x5c9e73){for(var _0x48f693=0x0;_0x48f693<_0x160a3a[_0xcede('0x64')][_0xcede('0x6d')][_0xcede('0x49')];_0x48f693+=0x1){socket[_0xcede('0x74')](_0xcede('0x75'),{'UserId':Number(_0x160a3a[_0xcede('0x64')][_0xcede('0x6d')][_0x48f693]),'WhatsappAccountId':Number(_0x160a3a[_0xcede('0x58')]['id'])});}return _0x5c9e73;});}})[_0xcede('0x36')](respondWithResult(_0x98293c,null))[_0xcede('0x27')](handleError(_0x98293c,null));};exports[_0xcede('0x76')]=function(_0x499c97,_0x4722ac,_0x5db81e){return db[_0xcede('0x40')][_0xcede('0x5b')]({'where':{'id':_0x499c97['params']['id']}})[_0xcede('0x36')](handleEntityNotFound(_0x4722ac,null))['then'](function(_0x3d253d){if(_0x3d253d){return _0x3d253d[_0xcede('0x76')](_0x499c97['query'][_0xcede('0x6d')])['then'](function(){if(_[_0xcede('0x77')](_0x499c97['query'][_0xcede('0x6d')])){for(var _0x963aed=0x0;_0x963aed<_0x499c97['query'][_0xcede('0x6d')]['length'];_0x963aed+=0x1){socket[_0xcede('0x74')](_0xcede('0x78'),{'UserId':Number(_0x499c97[_0xcede('0x44')][_0xcede('0x6d')][_0x963aed]),'WhatsappAccountId':Number(_0x499c97[_0xcede('0x58')]['id'])});}}else{socket['emit'](_0xcede('0x78'),{'UserId':Number(_0x499c97[_0xcede('0x44')]['ids']),'WhatsappAccountId':Number(_0x499c97[_0xcede('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x4722ac,null))[_0xcede('0x27')](handleError(_0x4722ac,null));};exports[_0xcede('0x79')]=function(_0x4adb92,_0x4c2d30,_0x186c19){var _0x21bfbe={};var _0x2d676f={};var _0x4d5047;var _0x4e46e8;return db[_0xcede('0x40')][_0xcede('0x69')]({'where':{'id':_0x4adb92['params']['id']}})['then'](handleEntityNotFound(_0x4c2d30,null))[_0xcede('0x36')](function(_0x2aaca6){if(_0x2aaca6){_0x4d5047=_0x2aaca6;_0x2d676f[_0xcede('0x45')]=_[_0xcede('0x5a')](db[_0xcede('0x7a')][_0xcede('0x41')]);_0x2d676f['query']=_[_0xcede('0x5a')](_0x4adb92[_0xcede('0x44')]);_0x2d676f[_0xcede('0x4f')]=_[_0xcede('0x46')](_0x2d676f[_0xcede('0x45')],_0x2d676f['query']);_0x21bfbe[_0xcede('0x48')]=_[_0xcede('0x46')](_0x2d676f['model'],qs[_0xcede('0x47')](_0x4adb92[_0xcede('0x44')][_0xcede('0x47')]));_0x21bfbe['attributes']=_0x21bfbe[_0xcede('0x48')][_0xcede('0x49')]?_0x21bfbe['attributes']:_0x2d676f[_0xcede('0x45')];_0x21bfbe[_0xcede('0x4c')]=qs[_0xcede('0x4d')](_0x4adb92[_0xcede('0x44')]['sort']);_0x21bfbe['where']=qs[_0xcede('0x4f')](_[_0xcede('0x50')](_0x4adb92[_0xcede('0x44')],_0x2d676f[_0xcede('0x4f')]));if(_0x4adb92['query'][_0xcede('0x51')]){_0x21bfbe[_0xcede('0x4e')]=_[_0xcede('0x52')](_0x21bfbe[_0xcede('0x4e')],{'$or':_[_0xcede('0x3f')](_0x21bfbe[_0xcede('0x48')],function(_0x1b372c){var _0x5735c9={};_0x5735c9[_0x1b372c]={'$like':'%'+_0x4adb92[_0xcede('0x44')]['filter']+'%'};return _0x5735c9;})});}_0x21bfbe=_['merge']({},_0x21bfbe,_0x4adb92[_0xcede('0x53')]);return _0x4d5047[_0xcede('0x79')](_0x21bfbe);}})[_0xcede('0x36')](function(_0x46d9d3){if(_0x46d9d3){_0x4e46e8=_0x46d9d3[_0xcede('0x49')];if(!_0x4adb92[_0xcede('0x44')][_0xcede('0x4a')](_0xcede('0x4b'))){_0x21bfbe[_0xcede('0x2d')]=qs[_0xcede('0x2d')](_0x4adb92['query'][_0xcede('0x2d')]);_0x21bfbe[_0xcede('0x2f')]=qs[_0xcede('0x2f')](_0x4adb92[_0xcede('0x44')]['offset']);}return _0x4d5047[_0xcede('0x79')](_0x21bfbe);}})[_0xcede('0x36')](function(_0x323a06){if(_0x323a06){return _0x323a06?{'count':_0x4e46e8,'rows':_0x323a06}:null;}})[_0xcede('0x36')](respondWithResult(_0x4c2d30,null))[_0xcede('0x27')](handleError(_0x4c2d30,null));};exports['addApplications']=function(_0x18ddc3,_0x39fd4d){var _0x4324aa=_0x18ddc3[_0xcede('0x58')]['id'];var _0x52c01f=_0x18ddc3[_0xcede('0x64')];var _0xe2225b=0xc8;var _0x1947d3=null;return db['sequelize'][_0xcede('0x7b')]({'isolationLevel':db['sequelize']['Transaction'][_0xcede('0x7c')][_0xcede('0x7d')]},function(_0x1935bc){return db[_0xcede('0x40')]['findOne']({'where':{'id':_0x4324aa},'transaction':_0x1935bc})['then'](function(_0x466d64){if(_0x466d64){return db[_0xcede('0x7e')][_0xcede('0x37')]({'where':{'WhatsappAccountId':_0x4324aa},'transaction':_0x1935bc})[_0xcede('0x36')](function(){var _0x3ba09d=_[_0xcede('0x3f')](_0x52c01f,function(_0x45070e){_0x45070e[_0xcede('0x67')]=_0x4324aa;return _0x45070e;});return db[_0xcede('0x7e')][_0xcede('0x7f')](_0x3ba09d,{'transaction':_0x1935bc});});}else{_0xe2225b=0x194;_0x1947d3=[];}});})['then'](function(){if(_0xe2225b!==0x194){return db[_0xcede('0x7e')][_0xcede('0x80')]({'where':{'WhatsappAccountId':_0x4324aa},'order':_0xcede('0x81')})['then'](function(_0x20513f){_0x1947d3=_0x20513f;});}})[_0xcede('0x27')](function(_0x427a96){_0xe2225b=0x1f4;logger[_0xcede('0x24')](_0x427a96[_0xcede('0x3b')]);if(_0x427a96[_0xcede('0x3c')]){delete _0x427a96[_0xcede('0x3c')];}_0x1947d3=_0x427a96;})['finally'](function(){if(_0x1947d3===null){_0x39fd4d['sendStatus'](_0xe2225b);}else{if(_0xe2225b===0x1f4){_0x39fd4d[_0xcede('0x29')](_0xe2225b)['send'](_0x1947d3);}else{_0x39fd4d[_0xcede('0x29')](_0xe2225b)[_0xcede('0x2b')](_0x1947d3);}}});};exports[_0xcede('0x82')]=function(_0x3f7795,_0x5da8ff,_0x81d2d6){var _0x17118a={};var _0x18a3b0={};var _0x2ef7c2;var _0x2b9e88;return db[_0xcede('0x40')][_0xcede('0x69')]({'where':{'id':_0x3f7795[_0xcede('0x58')]['id']}})[_0xcede('0x36')](handleEntityNotFound(_0x5da8ff,null))[_0xcede('0x36')](function(_0x5221b9){if(_0x5221b9){_0x2ef7c2=_0x5221b9;_0x18a3b0[_0xcede('0x45')]=_['keys'](db['WhatsappApplication'][_0xcede('0x41')]);_0x18a3b0[_0xcede('0x44')]=_[_0xcede('0x5a')](_0x3f7795['query']);_0x18a3b0[_0xcede('0x4f')]=_[_0xcede('0x46')](_0x18a3b0['model'],_0x18a3b0['query']);_0x17118a['attributes']=_[_0xcede('0x46')](_0x18a3b0[_0xcede('0x45')],qs['fields'](_0x3f7795[_0xcede('0x44')]['fields']));_0x17118a[_0xcede('0x48')]=_0x17118a['attributes'][_0xcede('0x49')]?_0x17118a[_0xcede('0x48')]:_0x18a3b0[_0xcede('0x45')];_0x17118a[_0xcede('0x4c')]=qs[_0xcede('0x4d')](_0x3f7795[_0xcede('0x44')]['sort']);_0x17118a[_0xcede('0x4e')]=qs['filters'](_[_0xcede('0x50')](_0x3f7795['query'],_0x18a3b0[_0xcede('0x4f')]));if(_0x3f7795[_0xcede('0x44')][_0xcede('0x51')]){_0x17118a[_0xcede('0x4e')]=_[_0xcede('0x52')](_0x17118a[_0xcede('0x4e')],{'$or':_[_0xcede('0x3f')](_0x17118a[_0xcede('0x48')],function(_0x472148){var _0x40f6bb={};_0x40f6bb[_0x472148]={'$like':'%'+_0x3f7795[_0xcede('0x44')][_0xcede('0x51')]+'%'};return _0x40f6bb;})});}_0x17118a=_['merge']({},_0x17118a,_0x3f7795[_0xcede('0x53')]);return _0x2ef7c2['getApplications'](_0x17118a);}})[_0xcede('0x36')](function(_0x19e8a7){if(_0x19e8a7){_0x2b9e88=_0x19e8a7[_0xcede('0x49')];if(!_0x3f7795['query'][_0xcede('0x4a')]('nolimit')){_0x17118a[_0xcede('0x2d')]=qs[_0xcede('0x2d')](_0x3f7795['query']['limit']);_0x17118a[_0xcede('0x2f')]=qs['offset'](_0x3f7795[_0xcede('0x44')][_0xcede('0x2f')]);}return _0x2ef7c2[_0xcede('0x82')](_0x17118a);}})[_0xcede('0x36')](function(_0x5f3ad5){if(_0x5f3ad5){return _0x5f3ad5?{'count':_0x2b9e88,'rows':_0x5f3ad5}:null;}})[_0xcede('0x36')](respondWithResult(_0x5da8ff,null))['catch'](handleError(_0x5da8ff,null));};exports[_0xcede('0x83')]=function(_0x52b160,_0x3c936f,_0xd540ba){var _0x26cfa2={'channel':_0xcede('0x84')};var _0x57cdcb=[];var _0xbcce27=[];var _0x5bb727={};return db['WhatsappAccount'][_0xcede('0x5b')]({'where':{'id':_0x52b160['params']['id']},'include':[{'model':db[_0xcede('0x7e')],'as':_0xcede('0x85')}]})[_0xcede('0x36')](handleEntityNotFound(_0x3c936f,null))[_0xcede('0x36')](function(_0x8e8b09){_0x26cfa2['account']=_0x8e8b09;if(_0x26cfa2[_0xcede('0x86')]&&_0x26cfa2['account'][_0xcede('0x43')]===_0xcede('0x87')&&_0x52b160[_0xcede('0x64')]['statuses']){if(_0x52b160['body']['statuses'][_0xcede('0x49')]===0x0)return;if(_0x52b160['body'][_0xcede('0x88')][0x0][_0xcede('0x89')]!==_0xcede('0x8a'))return;return db[_0xcede('0x8b')][_0xcede('0x35')]({'read':!![],'readAt':_0x52b160[_0xcede('0x64')][_0xcede('0x88')][0x0][_0xcede('0x8c')]},{'where':{'messageId':_0x52b160[_0xcede('0x64')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0xcede('0x36')](function(_0x21985b){return _0x3c936f['status'](0xc8)['json'](_0x21985b);});}_0x26cfa2[_0xcede('0x8d')]=_[_0xcede('0x8e')](_0x8e8b09[_0xcede('0x85')],[_0xcede('0x81')],['asc']);if(_0x26cfa2['account'][_0xcede('0x85')]){delete _0x26cfa2[_0xcede('0x86')][_0xcede('0x85')];}return db[_0xcede('0x8f')][_0xcede('0x65')]()[_0xcede('0x36')](function(_0x46e0b6){if(!_0x46e0b6){throw new db['Sequelize'][(_0xcede('0x90'))]('no\x20available\x20attributes');}_0x57cdcb=_[_0xcede('0x91')](_[_0xcede('0x5a')](_0x46e0b6),[_0xcede('0x92'),'updatedAt']);_0xbcce27=_['difference'](_[_0xcede('0x5a')](_0x46e0b6),['createdAt',_0xcede('0x93'),'CompanyId',_0xcede('0x94')]);_0x26cfa2[_0xcede('0x64')]={'mapKey':_0xcede('0x95')};if(_0x26cfa2[_0xcede('0x86')]&&_0x26cfa2['account'][_0xcede('0x43')]===_0xcede('0x96')){_0x26cfa2[_0xcede('0x64')][_0xcede('0x97')]=_0x52b160['body'][_0xcede('0x98')][_0xcede('0x99')]('whatsapp:','');_0x26cfa2['body']['body']=_0x52b160[_0xcede('0x64')]['Body'];_0x26cfa2[_0xcede('0x64')][_0xcede('0x9a')]=_0x52b160[_0xcede('0x64')]['MessageSid'];}if(_0x26cfa2['account']&&_0x26cfa2[_0xcede('0x86')][_0xcede('0x43')]===_0xcede('0x87')){_0x26cfa2[_0xcede('0x64')]['from']=_0x52b160['body'][_0xcede('0x9b')][0x0][_0xcede('0x97')];_0x26cfa2['body'][_0xcede('0x64')]=_0x52b160[_0xcede('0x64')][_0xcede('0x9b')][0x0][_0xcede('0x26')][_0xcede('0x64')];_0x26cfa2[_0xcede('0x64')][_0xcede('0x9a')]=_0x52b160['body']['notifications'][0x0][_0xcede('0x9c')];}if(_0x26cfa2[_0xcede('0x64')]['id']){delete _0x26cfa2[_0xcede('0x64')]['id'];}if(_['isNil'](_0x26cfa2[_0xcede('0x64')]['from'])){throw new db[(_0xcede('0x9d'))][(_0xcede('0x90'))]('from\x20is\x20mandatory');}if(_[_0xcede('0x9e')](_0x26cfa2[_0xcede('0x64')][_0xcede('0x64')])||_0x26cfa2[_0xcede('0x64')][_0xcede('0x64')]===''){throw new db[(_0xcede('0x9d'))][(_0xcede('0x90'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xcede('0x9e')](_0x26cfa2[_0xcede('0x64')][_0xcede('0x9f')])){throw new db[(_0xcede('0x9d'))]['ValidationError'](_0xcede('0xa0')+_0xbcce27);}if(!_[_0xcede('0xa1')](_0xbcce27,_0x26cfa2[_0xcede('0x64')][_0xcede('0x9f')])){throw new db[(_0xcede('0x9d'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xbcce27);}_0x5bb727[_0x26cfa2[_0xcede('0x64')][_0xcede('0x9f')]]=_0x26cfa2[_0xcede('0x64')]['from'];return db[_0xcede('0xa2')][_0xcede('0x5b')]({'where':{'id':_0x26cfa2['account'][_0xcede('0x94')]},'include':[{'model':db[_0xcede('0x8f')],'as':_0xcede('0xa3'),'where':_0x5bb727,'limit':0x1,'order':[[_0xcede('0x93'),_0xcede('0xa4')]]}]});})[_0xcede('0x36')](handleEntityNotFound(_0x3c936f,null))['then'](function(_0x4324dc){if(_0x4324dc){_0x26cfa2[_0xcede('0xa5')]=_['omit'](_0x4324dc,[_0xcede('0xa3')]);if(_0x4324dc['Contacts'][_0xcede('0x49')]){return _0x4324dc[_0xcede('0xa3')][0x0];}var _0x243723=_[_0xcede('0x15')](_0x26cfa2[_0xcede('0x64')],{'firstName':_0x26cfa2[_0xcede('0x64')][_0xcede('0x97')],'ListId':_0x4324dc['id']});_0x243723[_0x26cfa2['body']['mapKey']]=_0x26cfa2[_0xcede('0x64')][_0xcede('0x97')];return db[_0xcede('0x8f')][_0xcede('0x5c')](_0x243723,{'fields':_0x57cdcb,'raw':!![]});}})[_0xcede('0x36')](handleEntityNotFound(_0x3c936f,null))[_0xcede('0x36')](function(_0x58b7cd){if(_0x58b7cd){_0x26cfa2[_0xcede('0xa6')]=_0x58b7cd;var _0x13ba3a={'ContactId':_0x58b7cd['id'],'phone':_0x26cfa2['body'][_0xcede('0x97')],'WhatsappAccountId':_0x52b160[_0xcede('0x58')]['id']};var _0x2024c4={'ContactId':_0x58b7cd['id'],'WhatsappAccountId':_0x52b160['params']['id'],'closed':![]};return db[_0xcede('0xa7')][_0xcede('0x5b')]({'where':_0x2024c4})['then'](function(_0x26b1c5){if(_0x26b1c5){return[_0x26b1c5,![]];}return db[_0xcede('0xa7')]['create'](_0x13ba3a)[_0xcede('0x36')](function(_0x2970b6){return[_0x2970b6,!![]];});});}})['spread'](function(_0x39895c,_0x51fad7){_0x26cfa2[_0xcede('0xa8')]=_0x39895c[_0xcede('0x38')]({'plain':!![]});_0x26cfa2['interaction']['created']=![];if(_0x51fad7){if(_0x26cfa2['account'][_0xcede('0xa9')]){_0x26cfa2[_0xcede('0x8d')][_0xcede('0xaa')]({'id':0x0,'priority':_0x26cfa2[_0xcede('0x8d')]['length']+0x1,'app':_0xcede('0xab'),'appdata':_0xcede('0xac'),'interval':'*,*,*,*'});}_0x26cfa2['interaction'][_0xcede('0xad')]=!![];}return db[_0xcede('0x8b')]['create']({'phone':_0x26cfa2[_0xcede('0x64')][_0xcede('0x97')],'messageId':_0x26cfa2['body'][_0xcede('0x9a')],'body':_0x26cfa2[_0xcede('0x64')][_0xcede('0x64')],'WhatsappAccountId':_0x52b160[_0xcede('0x58')]['id'],'WhatsappInteractionId':_0x39895c['id'],'direction':'in','ContactId':_0x39895c[_0xcede('0xae')],'AttachmentId':_0x26cfa2[_0xcede('0x64')][_0xcede('0xaf')]});})[_0xcede('0x36')](function(_0x31b461){_0x26cfa2[_0xcede('0x26')]=_0x31b461;if(_0x26cfa2[_0xcede('0xa8')]['UserId']){return db[_0xcede('0x7a')]['find']({'attributes':['id',_0xcede('0x3c')],'where':{'id':_0x26cfa2[_0xcede('0xa8')]['UserId']}})[_0xcede('0x36')](function(_0x527bac){if(_0x527bac){_0x26cfa2['applications'][_0xcede('0xb0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x527bac[_0xcede('0x3c')]+','+(_0x26cfa2[_0xcede('0x86')][_0xcede('0xb1')]||0xa),'interval':_0xcede('0xb2')});}return respondWithRpcPromise(_0xcede('0xb3'),_0xcede('0xb4'),_0x26cfa2);});}return respondWithRpcPromise(_0xcede('0xb3'),_0xcede('0xb4'),_0x26cfa2);})['then'](function(_0x200334){if(_0x200334){var _0x2ed856=0xc8;var _0x1352ce=_0xcede('0xb5');logger[_0xcede('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1352ce,_0x2ed856,'entity\x20found');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1352ce,_0x2ed856,'entity\x20found',JSON[_0xcede('0xb6')](_0x200334));if(_0x26cfa2[_0xcede('0x86')]['type']===_0xcede('0x96')){return _0x3c936f[_0xcede('0x29')](_0x2ed856)['set'](_0xcede('0xb7'),_0xcede('0xb8'))['send']('\x0a');}else{return _0x3c936f[_0xcede('0x29')](_0x2ed856)['json'](_0x200334);}}});})[_0xcede('0x27')](handleError(_0x3c936f,null));};exports[_0xcede('0xb9')]=function(_0x3137c0,_0x16d1e2,_0x35abf8){var _0x1bd75f,_0x306dc4,_0x454389;if(_[_0xcede('0x9e')](_0x3137c0[_0xcede('0x64')]['body'])||_0x3137c0[_0xcede('0x64')][_0xcede('0x64')]===''){throw new db[(_0xcede('0x9d'))]['ValidationError'](_0xcede('0xba'));}if(_[_0xcede('0x9e')](_0x3137c0['body']['to'])){throw new db['Sequelize'][(_0xcede('0x90'))]('to\x20is\x20mandatory');}_0x1bd75f=_0x3137c0[_0xcede('0x64')]['to'];return db[_0xcede('0x40')][_0xcede('0x5b')]({'where':{'id':_0x3137c0[_0xcede('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0xcede('0xbb'),'include':[{'model':db['CmContact'],'as':_0xcede('0xa3'),'where':{'mobile':_0x1bd75f},'limit':0x1,'order':[[_0xcede('0x93'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x16d1e2,null))[_0xcede('0x36')](function(_0x27a3c1){if(_0x27a3c1&&_0x27a3c1[_0xcede('0xbb')]){_0x306dc4=_0x27a3c1['get']({'plain':!![]});if(_0x306dc4[_0xcede('0xbb')]&&_0x306dc4['List'][_0xcede('0xa3')]['length']){return _0x306dc4[_0xcede('0xbb')]['Contacts'][0x0];}return db[_0xcede('0x8f')][_0xcede('0x5c')](_[_0xcede('0x15')](_0x3137c0[_0xcede('0x64')],{'firstName':_0x1bd75f,'mobile':_0x1bd75f,'phone':_0x1bd75f,'ListId':_0x306dc4['ListId']}));}})[_0xcede('0x36')](handleEntityNotFound(_0x16d1e2,null))['then'](function(_0x10b4ad){if(_0x10b4ad){_0x454389=_0x10b4ad;return db[_0xcede('0xa7')]['find']({'where':{'ContactId':_0x454389['id'],'closed':![],'WhatsappAccountId':_0x306dc4['id']}})[_0xcede('0x36')](function(_0x554542){if(_0x554542){return[_0x554542,![]];}return db[_0xcede('0xa7')][_0xcede('0x5c')]({'UserId':_0x3137c0[_0xcede('0x5d')]['id'],'ContactId':_0x454389['id'],'WhatsappAccountId':_0x306dc4['id'],'phone':_0x1bd75f,'firstMsgDirection':_0xcede('0xbc'),'Messages':[_['merge'](_0x3137c0['body'],{'read':![],'body':_0x3137c0[_0xcede('0x64')]['body'],'phone':_0x1bd75f,'WhatsappAccountId':_0x306dc4['id'],'UserId':_0x3137c0[_0xcede('0x5d')]['id'],'ContactId':_0x454389['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xcede('0xbd')}]})[_0xcede('0x36')](function(_0x34f991){return[_0x34f991,!![]];});});}})[_0xcede('0xbe')](function(_0x2a6a7e,_0x9aeaa1){if(_0x9aeaa1){return _0x2a6a7e;}return db[_0xcede('0x8b')]['create'](_[_0xcede('0x52')](_0x3137c0[_0xcede('0x64')],{'read':![],'body':_0x3137c0[_0xcede('0x64')][_0xcede('0x64')],'phone':_0x1bd75f,'WhatsappAccountId':_0x306dc4['id'],'WhatsappInteractionId':_0x2a6a7e['id'],'UserId':_0x3137c0[_0xcede('0x5d')]['id'],'ContactId':_0x454389['id']}))[_0xcede('0x36')](function(_0x3adb19){_0x2a6a7e[_0xcede('0xbf')][_0xcede('0xbd')]=[];_0x2a6a7e[_0xcede('0xbf')]['Messages']['push'](_0x3adb19['dataValues']);return _0x2a6a7e;});})[_0xcede('0x36')](respondWithResult(_0x16d1e2,null))[_0xcede('0x27')](handleError(_0x16d1e2,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 9b8a09f..525b258 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 _0xb387=['emit','hasOwnProperty','hook','events','setMaxListeners','save','update'];(function(_0x2e7a43,_0x3b3df4){var _0x52e9e1=function(_0x2c08cf){while(--_0x2c08cf){_0x2e7a43['push'](_0x2e7a43['shift']());}};_0x52e9e1(++_0x3b3df4);}(_0xb387,0xb9));var _0x7b38=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0xb387[_0x202d24];return _0x2b3a8e;};'use strict';var EventEmitter=require(_0x7b38('0x0'));var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7b38('0x1')](0x0);var events={'afterCreate':_0x7b38('0x2'),'afterUpdate':_0x7b38('0x3'),'afterDestroy':'remove'};function emitEvent(_0x50827c){return function(_0x283feb,_0x5841ed,_0x5d4ae5){WhatsappAccountEvents[_0x7b38('0x4')](_0x50827c+':'+_0x283feb['id'],_0x283feb);WhatsappAccountEvents['emit'](_0x50827c,_0x283feb);_0x5d4ae5(null);};}for(var e in events){if(events[_0x7b38('0x5')](e)){var event=events[e];WhatsappAccount[_0x7b38('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x8c04=['WhatsappAccount','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x8c04,0x1cc));var _0x48c0=function(_0x13b5a1,_0x5e4687){_0x13b5a1=_0x13b5a1-0x0;var _0x3eedd9=_0x8c04[_0x13b5a1];return _0x3eedd9;};'use strict';var EventEmitter=require(_0x48c0('0x0'));var WhatsappAccount=require(_0x48c0('0x1'))['db'][_0x48c0('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x48c0('0x3'),'afterDestroy':_0x48c0('0x4')};function emitEvent(_0x1f0c30){return function(_0x3dee43,_0x36d6c3,_0x20659f){WhatsappAccountEvents['emit'](_0x1f0c30+':'+_0x3dee43['id'],_0x3dee43);WhatsappAccountEvents[_0x48c0('0x5')](_0x1f0c30,_0x3dee43);_0x20659f(null);};}for(var e in events){if(events[_0x48c0('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 403dddf..24d5d34 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 _0x636d=['whatsapp_accounts','util','../../config/logger','api','moment','bluebird','rimraf','./whatsappAccount.attributes','WhatsappAccount'];(function(_0x5ddc7f,_0x189dd4){var _0x2a1756=function(_0x5a3acc){while(--_0x5a3acc){_0x5ddc7f['push'](_0x5ddc7f['shift']());}};_0x2a1756(++_0x189dd4);}(_0x636d,0xe2));var _0xd636=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x636d[_0x491a7f];return _0x3d8f44;};'use strict';var _=require('lodash');var util=require(_0xd636('0x0'));var logger=require(_0xd636('0x1'))(_0xd636('0x2'));var moment=require(_0xd636('0x3'));var BPromise=require(_0xd636('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd636('0x5'));var config=require('../../config/environment');var attributes=require(_0xd636('0x6'));module['exports']=function(_0x25b2a6,_0x5c4da0){return _0x25b2a6['define'](_0xd636('0x7'),attributes,{'tableName':_0xd636('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1378=['exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x1378,0x162));var _0x8137=function(_0x27ac4e,_0x5dcaac){_0x27ac4e=_0x27ac4e-0x0;var _0x215a5d=_0x1378[_0x27ac4e];return _0x215a5d;};'use strict';var _=require(_0x8137('0x0'));var util=require(_0x8137('0x1'));var logger=require(_0x8137('0x2'))(_0x8137('0x3'));var moment=require(_0x8137('0x4'));var BPromise=require(_0x8137('0x5'));var rp=require(_0x8137('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8137('0x7'));var config=require(_0x8137('0x8'));var attributes=require(_0x8137('0x9'));module[_0x8137('0xa')]=function(_0x168608,_0x6c7270){return _0x168608[_0x8137('0xb')](_0x8137('0xc'),attributes,{'tableName':_0x8137('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index a5f1617..1f57762 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 _0x79a3=['rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./whatsappAccount.socket','register','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','WhatsappAccount','find','options','raw','attributes','include','map','model','then','ShowWhatsappAccount','catch','lodash','moment','bluebird','ioredis'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0x79a3,0x80));var _0x379a=function(_0xc082d1,_0x21c3f4){_0xc082d1=_0xc082d1-0x0;var _0x51e4a6=_0x79a3[_0xc082d1];return _0x51e4a6;};'use strict';var _=require(_0x379a('0x0'));var util=require('util');var moment=require(_0x379a('0x1'));var BPromise=require(_0x379a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x379a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x379a('0x4'));var config=require(_0x379a('0x5'));var jayson=require(_0x379a('0x6'));var client=jayson[_0x379a('0x7')][_0x379a('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x379a('0x9'),'port':0x18eb});var socket=require(_0x379a('0xa'))(new Redis(config[_0x379a('0xb')]));require(_0x379a('0xc'))[_0x379a('0xd')](socket);function respondWithRpcPromise(_0x819320,_0xfcd926,_0x5206aa){return new BPromise(function(_0x4d017c,_0x1f163a){return client['request'](_0x819320,_0x5206aa)['then'](function(_0x6b51ec){logger[_0x379a('0xe')](_0x379a('0xf'),_0xfcd926,_0x379a('0x10'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xfcd926,'request\x20sent',JSON[_0x379a('0x11')](_0x6b51ec));if(_0x6b51ec[_0x379a('0x12')]){if(_0x6b51ec[_0x379a('0x12')][_0x379a('0x13')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0xfcd926,_0x6b51ec[_0x379a('0x12')][_0x379a('0x14')]);return _0x1f163a(_0x6b51ec[_0x379a('0x12')][_0x379a('0x14')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0xfcd926,_0x6b51ec[_0x379a('0x12')]['message']);return _0x4d017c(_0x6b51ec[_0x379a('0x12')][_0x379a('0x14')]);}else{logger[_0x379a('0xe')]('WhatsappAccount,\x20%s,\x20%s',_0xfcd926,'request\x20sent');_0x4d017c(_0x6b51ec[_0x379a('0x15')][_0x379a('0x14')]);}})['catch'](function(_0x200cfd){logger[_0x379a('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0xfcd926,_0x200cfd);_0x1f163a(_0x200cfd);});});}exports['ShowWhatsappAccount']=function(_0x51cd86){var _0x305939=this;return new Promise(function(_0x4cf138,_0x263df8){return db[_0x379a('0x16')][_0x379a('0x17')]({'raw':_0x51cd86[_0x379a('0x18')]?_0x51cd86[_0x379a('0x18')][_0x379a('0x19')]===undefined?!![]:![]:!![],'where':_0x51cd86[_0x379a('0x18')]?_0x51cd86[_0x379a('0x18')]['where']||null:null,'attributes':_0x51cd86[_0x379a('0x18')]?_0x51cd86[_0x379a('0x18')][_0x379a('0x1a')]||null:null,'include':_0x51cd86[_0x379a('0x18')]?_0x51cd86[_0x379a('0x18')][_0x379a('0x1b')]?_[_0x379a('0x1c')](_0x51cd86['options'][_0x379a('0x1b')],function(_0x2379a3){return{'model':db[_0x2379a3[_0x379a('0x1d')]],'as':_0x2379a3['as'],'attributes':_0x2379a3['attributes'],'include':_0x2379a3['include']?_[_0x379a('0x1c')](_0x2379a3['include'],function(_0x13e665){return{'model':db[_0x13e665[_0x379a('0x1d')]],'as':_0x13e665['as'],'attributes':_0x13e665['attributes'],'include':_0x13e665[_0x379a('0x1b')]?_[_0x379a('0x1c')](_0x13e665[_0x379a('0x1b')],function(_0x4ff7ad){return{'model':db[_0x4ff7ad[_0x379a('0x1d')]],'as':_0x4ff7ad['as'],'attributes':_0x4ff7ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x379a('0x1e')](function(_0x33d5f7){logger[_0x379a('0xe')](_0x379a('0x1f'),_0x51cd86);logger['debug'](_0x379a('0x1f'),_0x51cd86,JSON[_0x379a('0x11')](_0x33d5f7));_0x4cf138(_0x33d5f7);})[_0x379a('0x20')](function(_0x97d9b4){logger[_0x379a('0x12')]('ShowWhatsappAccount',_0x97d9b4[_0x379a('0x14')],_0x51cd86);_0x263df8(_0x305939[_0x379a('0x12')](0x1f4,_0x97d9b4[_0x379a('0x14')]));});});}; \ No newline at end of file +var _0x5eda=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','register','request','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','then','moment'];(function(_0x68741a,_0x2908f1){var _0x2b7a05=function(_0x2a3ae9){while(--_0x2a3ae9){_0x68741a['push'](_0x68741a['shift']());}};_0x2b7a05(++_0x2908f1);}(_0x5eda,0x1af));var _0xa5ed=function(_0x39567e,_0x5686b1){_0x39567e=_0x39567e-0x0;var _0xfe26f9=_0x5eda[_0x39567e];return _0xfe26f9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa5ed('0x0'));var BPromise=require(_0xa5ed('0x1'));var rs=require(_0xa5ed('0x2'));var fs=require('fs');var Redis=require(_0xa5ed('0x3'));var db=require(_0xa5ed('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa5ed('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa5ed('0x6'));var client=jayson[_0xa5ed('0x7')][_0xa5ed('0x8')]({'port':0x232a});config['redis']=_[_0xa5ed('0x9')](config[_0xa5ed('0xa')],{'host':_0xa5ed('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa5ed('0xa')]));require('./whatsappAccount.socket')[_0xa5ed('0xc')](socket);function respondWithRpcPromise(_0x45aae0,_0x3d8179,_0x2014ae){return new BPromise(function(_0x5dc35c,_0x18f444){return client[_0xa5ed('0xd')](_0x45aae0,_0x2014ae)['then'](function(_0xe17e31){logger[_0xa5ed('0xe')]('WhatsappAccount,\x20%s,\x20%s',_0x3d8179,_0xa5ed('0xf'));logger[_0xa5ed('0x10')](_0xa5ed('0x11'),_0x3d8179,_0xa5ed('0xf'),JSON[_0xa5ed('0x12')](_0xe17e31));if(_0xe17e31[_0xa5ed('0x13')]){if(_0xe17e31['error'][_0xa5ed('0x14')]===0x1f4){logger['error'](_0xa5ed('0x15'),_0x3d8179,_0xe17e31[_0xa5ed('0x13')]['message']);return _0x18f444(_0xe17e31[_0xa5ed('0x13')][_0xa5ed('0x16')]);}logger[_0xa5ed('0x13')](_0xa5ed('0x15'),_0x3d8179,_0xe17e31[_0xa5ed('0x13')]['message']);return _0x5dc35c(_0xe17e31['error'][_0xa5ed('0x16')]);}else{logger[_0xa5ed('0xe')](_0xa5ed('0x15'),_0x3d8179,_0xa5ed('0xf'));_0x5dc35c(_0xe17e31[_0xa5ed('0x17')][_0xa5ed('0x16')]);}})[_0xa5ed('0x18')](function(_0x233e15){logger[_0xa5ed('0x13')](_0xa5ed('0x15'),_0x3d8179,_0x233e15);_0x18f444(_0x233e15);});});}exports[_0xa5ed('0x19')]=function(_0xaeb373){var _0x1ea203=this;return new Promise(function(_0xabd3cf,_0x713b89){return db[_0xa5ed('0x1a')][_0xa5ed('0x1b')]({'raw':_0xaeb373[_0xa5ed('0x1c')]?_0xaeb373['options'][_0xa5ed('0x1d')]===undefined?!![]:![]:!![],'where':_0xaeb373[_0xa5ed('0x1c')]?_0xaeb373[_0xa5ed('0x1c')][_0xa5ed('0x1e')]||null:null,'attributes':_0xaeb373[_0xa5ed('0x1c')]?_0xaeb373['options'][_0xa5ed('0x1f')]||null:null,'include':_0xaeb373[_0xa5ed('0x1c')]?_0xaeb373['options'][_0xa5ed('0x20')]?_[_0xa5ed('0x21')](_0xaeb373[_0xa5ed('0x1c')][_0xa5ed('0x20')],function(_0x17c967){return{'model':db[_0x17c967['model']],'as':_0x17c967['as'],'attributes':_0x17c967[_0xa5ed('0x1f')],'include':_0x17c967[_0xa5ed('0x20')]?_['map'](_0x17c967[_0xa5ed('0x20')],function(_0x2d3692){return{'model':db[_0x2d3692[_0xa5ed('0x22')]],'as':_0x2d3692['as'],'attributes':_0x2d3692[_0xa5ed('0x1f')],'include':_0x2d3692[_0xa5ed('0x20')]?_['map'](_0x2d3692['include'],function(_0x545f69){return{'model':db[_0x545f69[_0xa5ed('0x22')]],'as':_0x545f69['as'],'attributes':_0x545f69[_0xa5ed('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa5ed('0x23')](function(_0x9c50dd){logger[_0xa5ed('0xe')]('ShowWhatsappAccount',_0xaeb373);logger['debug']('ShowWhatsappAccount',_0xaeb373,JSON['stringify'](_0x9c50dd));_0xabd3cf(_0x9c50dd);})[_0xa5ed('0x18')](function(_0x21488c){logger[_0xa5ed('0x13')](_0xa5ed('0x19'),_0x21488c[_0xa5ed('0x16')],_0xaeb373);_0x713b89(_0x1ea203[_0xa5ed('0x13')](0x1f4,_0x21488c[_0xa5ed('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index a0ae869..b1dea55 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 _0x2d58=['./whatsappAccount.events','remove','update','emit','removeListener','register','length','whatsappAccount:'];(function(_0x362a9c,_0x434fd5){var _0x159079=function(_0x4e5a3c){while(--_0x4e5a3c){_0x362a9c['push'](_0x362a9c['shift']());}};_0x159079(++_0x434fd5);}(_0x2d58,0x1a0));var _0x82d5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2d58[_0xa464c9];return _0x3d73c4;};'use strict';var WhatsappAccountEvents=require(_0x82d5('0x0'));var events=['save',_0x82d5('0x1'),_0x82d5('0x2')];function createListener(_0xf13e99,_0x27ad9e){return function(_0x21d6bb){_0x27ad9e[_0x82d5('0x3')](_0xf13e99,_0x21d6bb);};}function removeListener(_0x37b730,_0x17549e){return function(){WhatsappAccountEvents[_0x82d5('0x4')](_0x37b730,_0x17549e);};}exports[_0x82d5('0x5')]=function(_0x331f99){for(var _0x2f7c4c=0x0,_0x2fe781=events[_0x82d5('0x6')];_0x2f7c4c<_0x2fe781;_0x2f7c4c++){var _0x1404e3=events[_0x2f7c4c];var _0x460ab1=createListener(_0x82d5('0x7')+_0x1404e3,_0x331f99);WhatsappAccountEvents['on'](_0x1404e3,_0x460ab1);}}; \ No newline at end of file +var _0xa9d5=['./whatsappAccount.events','save','remove','removeListener','length','whatsappAccount:'];(function(_0x494b44,_0x43583c){var _0x8ba974=function(_0x3b073b){while(--_0x3b073b){_0x494b44['push'](_0x494b44['shift']());}};_0x8ba974(++_0x43583c);}(_0xa9d5,0x1ec));var _0x5a9d=function(_0x546eb8,_0xb8e40f){_0x546eb8=_0x546eb8-0x0;var _0x4dca8a=_0xa9d5[_0x546eb8];return _0x4dca8a;};'use strict';var WhatsappAccountEvents=require(_0x5a9d('0x0'));var events=[_0x5a9d('0x1'),_0x5a9d('0x2'),'update'];function createListener(_0x21c8a4,_0x251330){return function(_0x554ba3){_0x251330['emit'](_0x21c8a4,_0x554ba3);};}function removeListener(_0x539eba,_0x2d5c7d){return function(){WhatsappAccountEvents[_0x5a9d('0x3')](_0x539eba,_0x2d5c7d);};}exports['register']=function(_0x56489d){for(var _0x579a8d=0x0,_0x334a24=events[_0x5a9d('0x4')];_0x579a8d<_0x334a24;_0x579a8d++){var _0x4789ce=events[_0x579a8d];var _0x10c1aa=createListener(_0x5a9d('0x5')+_0x4789ce,_0x56489d);WhatsappAccountEvents['on'](_0x4789ce,_0x10c1aa);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index ce2d3d7..ecb1bcd 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 _0x727a=['get','/:id','post','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated'];(function(_0x278f93,_0x5d74c6){var _0x47d224=function(_0x3acef8){while(--_0x3acef8){_0x278f93['push'](_0x278f93['shift']());}};_0x47d224(++_0x5d74c6);}(_0x727a,0x103));var _0xa727=function(_0x33e31b,_0xab5709){_0x33e31b=_0x33e31b-0x0;var _0x24759f=_0x727a[_0x33e31b];return _0x24759f;};'use strict';var multer=require(_0xa727('0x0'));var util=require(_0xa727('0x1'));var path=require(_0xa727('0x2'));var timeout=require(_0xa727('0x3'));var express=require('express');var router=express[_0xa727('0x4')]();var fs_extra=require(_0xa727('0x5'));var auth=require(_0xa727('0x6'));var interaction=require(_0xa727('0x7'));var config=require(_0xa727('0x8'));var controller=require(_0xa727('0x9'));router['get']('/',auth[_0xa727('0xa')](),controller['index']);router[_0xa727('0xb')](_0xa727('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa727('0xd')]('/',auth[_0xa727('0xa')](),controller['create']);router[_0xa727('0xe')](_0xa727('0xc'),auth[_0xa727('0xa')](),controller['update']);router[_0xa727('0xf')](_0xa727('0xc'),auth[_0xa727('0xa')](),controller[_0xa727('0x10')]);module[_0xa727('0x11')]=router; \ No newline at end of file +var _0xed06=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','show','post','create','/:id','update','delete','destroy'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xed06,0x131));var _0x6ed0=function(_0x56bf30,_0x284c8b){_0x56bf30=_0x56bf30-0x0;var _0xaea08b=_0xed06[_0x56bf30];return _0xaea08b;};'use strict';var multer=require('multer');var util=require(_0x6ed0('0x0'));var path=require(_0x6ed0('0x1'));var timeout=require(_0x6ed0('0x2'));var express=require(_0x6ed0('0x3'));var router=express[_0x6ed0('0x4')]();var fs_extra=require(_0x6ed0('0x5'));var auth=require(_0x6ed0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6ed0('0x7'));var controller=require(_0x6ed0('0x8'));router['get']('/',auth[_0x6ed0('0x9')](),controller[_0x6ed0('0xa')]);router['get']('/:id',auth[_0x6ed0('0x9')](),controller[_0x6ed0('0xb')]);router[_0x6ed0('0xc')]('/',auth['isAuthenticated'](),controller[_0x6ed0('0xd')]);router['put'](_0x6ed0('0xe'),auth['isAuthenticated'](),controller[_0x6ed0('0xf')]);router[_0x6ed0('0x10')](_0x6ed0('0xe'),auth[_0x6ed0('0x9')](),controller[_0x6ed0('0x11')]);module[_0x6ed0('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 3fa0c02..d9bb598 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 _0xebff=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0xa64da9,_0x549be6){var _0x2e5f3a=function(_0x39a178){while(--_0x39a178){_0xa64da9['push'](_0xa64da9['shift']());}};_0x2e5f3a(++_0x549be6);}(_0xebff,0x158));var _0xfebf=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xebff[_0x4c445a];return _0x2f611c;};'use strict';var Sequelize=require(_0xfebf('0x0'));module['exports']={'priority':{'type':Sequelize[_0xfebf('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xfebf('0x2')],'allowNull':![],'defaultValue':_0xfebf('0x3')},'appdata':{'type':Sequelize[_0xfebf('0x4')]()},'description':{'type':Sequelize[_0xfebf('0x2')]},'interval':{'type':Sequelize[_0xfebf('0x2')],'defaultValue':_0xfebf('0x5')}}; \ No newline at end of file +var _0xfe56=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x41576e,_0x2f8699){var _0x2b2715=function(_0x1e854a){while(--_0x1e854a){_0x41576e['push'](_0x41576e['shift']());}};_0x2b2715(++_0x2f8699);}(_0xfe56,0x9a));var _0x6fe5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfe56[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x6fe5('0x0'));module[_0x6fe5('0x1')]={'priority':{'type':Sequelize[_0x6fe5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6fe5('0x3')],'allowNull':![],'defaultValue':_0x6fe5('0x4')},'appdata':{'type':Sequelize[_0x6fe5('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6fe5('0x3')],'defaultValue':_0x6fe5('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index da7a0a7..a750250 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 _0x36fe=['create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','then','destroy','error','stack','name','index','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','includeAll','include','findAll','catch','params','intersection','fields'];(function(_0x1b2422,_0x1e98d4){var _0x376573=function(_0x5db41b){while(--_0x5db41b){_0x1b2422['push'](_0x1b2422['shift']());}};_0x376573(++_0x1e98d4);}(_0x36fe,0x127));var _0xe36f=function(_0x195577,_0x5de53a){_0x195577=_0x195577-0x0;var _0x13c367=_0x36fe[_0x195577];return _0x13c367;};'use strict';var emlformat=require(_0xe36f('0x0'));var rimraf=require(_0xe36f('0x1'));var zipdir=require(_0xe36f('0x2'));var jsonpatch=require(_0xe36f('0x3'));var rp=require(_0xe36f('0x4'));var moment=require(_0xe36f('0x5'));var BPromise=require(_0xe36f('0x6'));var Mustache=require(_0xe36f('0x7'));var util=require(_0xe36f('0x8'));var path=require(_0xe36f('0x9'));var sox=require(_0xe36f('0xa'));var csv=require('to-csv');var ejs=require(_0xe36f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe36f('0xc'));var squel=require(_0xe36f('0xd'));var crypto=require('crypto');var jsforce=require(_0xe36f('0xe'));var deskjs=require(_0xe36f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe36f('0x10'));var Papa=require(_0xe36f('0x11'));var Redis=require(_0xe36f('0x12'));var authService=require(_0xe36f('0x13'));var qs=require(_0xe36f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe36f('0x15'));var logger=require('../../config/logger')(_0xe36f('0x16'));var utils=require(_0xe36f('0x17'));var config=require(_0xe36f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe36f('0x19'))['db'];function respondWithStatusCode(_0x3caacb,_0x564d1e){_0x564d1e=_0x564d1e||0xcc;return function(_0x1bd5c2){if(_0x1bd5c2){return _0x3caacb[_0xe36f('0x1a')](_0x564d1e);}return _0x3caacb[_0xe36f('0x1b')](_0x564d1e)[_0xe36f('0x1c')]();};}function respondWithResult(_0x5f2407,_0x95f267){_0x95f267=_0x95f267||0xc8;return function(_0x8acac3){if(_0x8acac3){return _0x5f2407[_0xe36f('0x1b')](_0x95f267)['json'](_0x8acac3);}};}function respondWithFilteredResult(_0x2fcef3,_0x3ffb15){return function(_0x511de8){if(_0x511de8){var _0x1834a3=typeof _0x3ffb15[_0xe36f('0x1d')]===_0xe36f('0x1e')&&typeof _0x3ffb15[_0xe36f('0x1f')]===_0xe36f('0x1e');var _0x146efd=_0x511de8['count'];var _0x4d9df2=_0x1834a3?0x0:_0x3ffb15['offset'];var _0x5aed4f=_0x1834a3?_0x511de8[_0xe36f('0x20')]:_0x3ffb15[_0xe36f('0x1d')]+_0x3ffb15[_0xe36f('0x1f')];var _0x464164;if(_0x5aed4f>=_0x146efd){_0x5aed4f=_0x146efd;_0x464164=0xc8;}else{_0x464164=0xce;}_0x2fcef3['status'](_0x464164);return _0x2fcef3['set'](_0xe36f('0x21'),_0x4d9df2+'-'+_0x5aed4f+'/'+_0x146efd)[_0xe36f('0x22')](_0x511de8);}return null;};}function patchUpdates(_0x1502bf){return function(_0xb51dbf){try{jsonpatch[_0xe36f('0x23')](_0xb51dbf,_0x1502bf,!![]);}catch(_0x5c09ad){return BPromise[_0xe36f('0x24')](_0x5c09ad);}return _0xb51dbf['save']();};}function saveUpdates(_0x1fda7b,_0x395cc6){return function(_0x2dc212){if(_0x2dc212){return _0x2dc212['update'](_0x1fda7b)[_0xe36f('0x25')](function(_0xd00e9b){return _0xd00e9b;});}return null;};}function removeEntity(_0x5d8e84,_0xfd3899){return function(_0x12a473){if(_0x12a473){return _0x12a473[_0xe36f('0x26')]()['then'](function(){_0x5d8e84['status'](0xcc)[_0xe36f('0x1c')]();});}};}function handleEntityNotFound(_0x35ef46,_0x5edc48){return function(_0x1bd728){if(!_0x1bd728){_0x35ef46['sendStatus'](0x194);}return _0x1bd728;};}function handleError(_0xd0e82,_0x55f6d6){_0x55f6d6=_0x55f6d6||0x1f4;return function(_0x196183){logger[_0xe36f('0x27')](_0x196183[_0xe36f('0x28')]);if(_0x196183[_0xe36f('0x29')]){delete _0x196183[_0xe36f('0x29')];}_0xd0e82[_0xe36f('0x1b')](_0x55f6d6)['send'](_0x196183);};}exports[_0xe36f('0x2a')]=function(_0x5aa516,_0x13af30){var _0x253deb={},_0x471b91={},_0x1b8451={'count':0x0,'rows':[]};var _0x3296f2=_['map'](db[_0xe36f('0x2b')][_0xe36f('0x2c')],function(_0x1d8e72){return{'name':_0x1d8e72[_0xe36f('0x2d')],'type':_0x1d8e72[_0xe36f('0x2e')][_0xe36f('0x2f')]};});_0x471b91['model']=_['map'](_0x3296f2,_0xe36f('0x29'));_0x471b91[_0xe36f('0x30')]=_[_0xe36f('0x31')](_0x5aa516['query']);_0x471b91[_0xe36f('0x32')]=_['intersection'](_0x471b91[_0xe36f('0x33')],_0x471b91['query']);_0x253deb[_0xe36f('0x34')]=_['intersection'](_0x471b91[_0xe36f('0x33')],qs['fields'](_0x5aa516[_0xe36f('0x30')]['fields']));_0x253deb[_0xe36f('0x34')]=_0x253deb[_0xe36f('0x34')]['length']?_0x253deb[_0xe36f('0x34')]:_0x471b91[_0xe36f('0x33')];if(!_0x5aa516[_0xe36f('0x30')][_0xe36f('0x35')](_0xe36f('0x36'))){_0x253deb['limit']=qs['limit'](_0x5aa516[_0xe36f('0x30')][_0xe36f('0x1f')]);_0x253deb[_0xe36f('0x1d')]=qs['offset'](_0x5aa516[_0xe36f('0x30')]['offset']);}_0x253deb[_0xe36f('0x37')]=qs[_0xe36f('0x38')](_0x5aa516[_0xe36f('0x30')][_0xe36f('0x38')]);_0x253deb['where']=qs['filters'](_[_0xe36f('0x39')](_0x5aa516['query'],_0x471b91[_0xe36f('0x32')]),_0x3296f2);if(_0x5aa516[_0xe36f('0x30')][_0xe36f('0x3a')]){_0x253deb[_0xe36f('0x3b')]=_[_0xe36f('0x3c')](_0x253deb[_0xe36f('0x3b')],{'$or':_[_0xe36f('0x3d')](_0x3296f2,function(_0x5bfa56){if(_0x5bfa56[_0xe36f('0x2e')]!==_0xe36f('0x3e')){var _0x2593cf={};_0x2593cf[_0x5bfa56[_0xe36f('0x29')]]={'$like':'%'+_0x5aa516[_0xe36f('0x30')][_0xe36f('0x3a')]+'%'};return _0x2593cf;}})});}_0x253deb=_[_0xe36f('0x3c')]({},_0x253deb,_0x5aa516['options']);var _0x2e7dbd={'where':_0x253deb[_0xe36f('0x3b')]};return db[_0xe36f('0x2b')]['count'](_0x2e7dbd)[_0xe36f('0x25')](function(_0x573385){_0x1b8451[_0xe36f('0x20')]=_0x573385;if(_0x5aa516['query'][_0xe36f('0x3f')]){_0x253deb[_0xe36f('0x40')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xe36f('0x41')](_0x253deb);})['then'](function(_0x29f5e5){_0x1b8451['rows']=_0x29f5e5;return _0x1b8451;})[_0xe36f('0x25')](respondWithFilteredResult(_0x13af30,_0x253deb))[_0xe36f('0x42')](handleError(_0x13af30,null));};exports['show']=function(_0xd14f0d,_0x40c746){var _0x11e17e={'raw':!![],'where':{'id':_0xd14f0d[_0xe36f('0x43')]['id']}},_0x452314={};_0x452314[_0xe36f('0x33')]=_[_0xe36f('0x31')](db['WhatsappApplication'][_0xe36f('0x2c')]);_0x452314[_0xe36f('0x30')]=_['keys'](_0xd14f0d['query']);_0x452314['filters']=_[_0xe36f('0x44')](_0x452314['model'],_0x452314['query']);_0x11e17e[_0xe36f('0x34')]=_[_0xe36f('0x44')](_0x452314[_0xe36f('0x33')],qs['fields'](_0xd14f0d[_0xe36f('0x30')][_0xe36f('0x45')]));_0x11e17e[_0xe36f('0x34')]=_0x11e17e[_0xe36f('0x34')]['length']?_0x11e17e[_0xe36f('0x34')]:_0x452314[_0xe36f('0x33')];if(_0xd14f0d[_0xe36f('0x30')][_0xe36f('0x3f')]){_0x11e17e[_0xe36f('0x40')]=[{'all':!![]}];}_0x11e17e=_[_0xe36f('0x3c')]({},_0x11e17e,_0xd14f0d['options']);return db[_0xe36f('0x2b')]['find'](_0x11e17e)[_0xe36f('0x25')](handleEntityNotFound(_0x40c746,null))[_0xe36f('0x25')](respondWithResult(_0x40c746,null))[_0xe36f('0x42')](handleError(_0x40c746,null));};exports[_0xe36f('0x46')]=function(_0x4c3a2b,_0x58c3f6){return db[_0xe36f('0x2b')][_0xe36f('0x46')](_0x4c3a2b[_0xe36f('0x47')],{})[_0xe36f('0x25')](respondWithResult(_0x58c3f6,0xc9))[_0xe36f('0x42')](handleError(_0x58c3f6,null));};exports['update']=function(_0x66fa03,_0x4215b8){if(_0x66fa03['body']['id']){delete _0x66fa03[_0xe36f('0x47')]['id'];}return db[_0xe36f('0x2b')][_0xe36f('0x48')]({'where':{'id':_0x66fa03[_0xe36f('0x43')]['id']}})[_0xe36f('0x25')](handleEntityNotFound(_0x4215b8,null))[_0xe36f('0x25')](saveUpdates(_0x66fa03[_0xe36f('0x47')],null))[_0xe36f('0x25')](respondWithResult(_0x4215b8,null))[_0xe36f('0x42')](handleError(_0x4215b8,null));};exports['destroy']=function(_0x324def,_0x4f5f6a){return db['WhatsappApplication']['find']({'where':{'id':_0x324def[_0xe36f('0x43')]['id']}})[_0xe36f('0x25')](handleEntityNotFound(_0x4f5f6a,null))[_0xe36f('0x25')](removeEntity(_0x4f5f6a,null))['catch'](handleError(_0x4f5f6a,null));}; \ No newline at end of file +var _0x6d4b=['json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','status','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','filter','type','VIRTUAL','merge','options','WhatsappApplication','include','findAll','show','params','length','includeAll','find','create','body','catch','update','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','sendStatus','end'];(function(_0xba07a4,_0x29a01e){var _0x81cf82=function(_0x3b8fb0){while(--_0x3b8fb0){_0xba07a4['push'](_0xba07a4['shift']());}};_0x81cf82(++_0x29a01e);}(_0x6d4b,0xbf));var _0xb6d4=function(_0x5936ec,_0x50e4c3){_0x5936ec=_0x5936ec-0x0;var _0x496c3c=_0x6d4b[_0x5936ec];return _0x496c3c;};'use strict';var emlformat=require(_0xb6d4('0x0'));var rimraf=require(_0xb6d4('0x1'));var zipdir=require(_0xb6d4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6d4('0x3'));var moment=require(_0xb6d4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb6d4('0x5'));var path=require(_0xb6d4('0x6'));var sox=require(_0xb6d4('0x7'));var csv=require(_0xb6d4('0x8'));var ejs=require(_0xb6d4('0x9'));var fs=require('fs');var fs_extra=require(_0xb6d4('0xa'));var _=require(_0xb6d4('0xb'));var squel=require(_0xb6d4('0xc'));var crypto=require('crypto');var jsforce=require(_0xb6d4('0xd'));var deskjs=require(_0xb6d4('0xe'));var toCsv=require(_0xb6d4('0x8'));var querystring=require(_0xb6d4('0xf'));var Papa=require(_0xb6d4('0x10'));var Redis=require(_0xb6d4('0x11'));var authService=require(_0xb6d4('0x12'));var qs=require(_0xb6d4('0x13'));var as=require(_0xb6d4('0x14'));var hardwareService=require(_0xb6d4('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb6d4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x900d20,_0x23ca6e){_0x23ca6e=_0x23ca6e||0xcc;return function(_0x13cbfc){if(_0x13cbfc){return _0x900d20[_0xb6d4('0x17')](_0x23ca6e);}return _0x900d20['status'](_0x23ca6e)[_0xb6d4('0x18')]();};}function respondWithResult(_0x2c3af8,_0x4bb27b){_0x4bb27b=_0x4bb27b||0xc8;return function(_0xbad248){if(_0xbad248){return _0x2c3af8['status'](_0x4bb27b)[_0xb6d4('0x19')](_0xbad248);}};}function respondWithFilteredResult(_0x2b7c50,_0x300443){return function(_0x1b0dab){if(_0x1b0dab){var _0x9813c8=typeof _0x300443[_0xb6d4('0x1a')]===_0xb6d4('0x1b')&&typeof _0x300443['limit']===_0xb6d4('0x1b');var _0x14f314=_0x1b0dab[_0xb6d4('0x1c')];var _0x431af2=_0x9813c8?0x0:_0x300443[_0xb6d4('0x1a')];var _0x438053=_0x9813c8?_0x1b0dab[_0xb6d4('0x1c')]:_0x300443[_0xb6d4('0x1a')]+_0x300443[_0xb6d4('0x1d')];var _0x5221e7;if(_0x438053>=_0x14f314){_0x438053=_0x14f314;_0x5221e7=0xc8;}else{_0x5221e7=0xce;}_0x2b7c50['status'](_0x5221e7);return _0x2b7c50[_0xb6d4('0x1e')](_0xb6d4('0x1f'),_0x431af2+'-'+_0x438053+'/'+_0x14f314)[_0xb6d4('0x19')](_0x1b0dab);}return null;};}function patchUpdates(_0x3d3cd6){return function(_0x4e034e){try{jsonpatch['apply'](_0x4e034e,_0x3d3cd6,!![]);}catch(_0x145157){return BPromise[_0xb6d4('0x20')](_0x145157);}return _0x4e034e[_0xb6d4('0x21')]();};}function saveUpdates(_0x5b9fb1,_0x3ee5c4){return function(_0x532cbc){if(_0x532cbc){return _0x532cbc['update'](_0x5b9fb1)[_0xb6d4('0x22')](function(_0x9e402a){return _0x9e402a;});}return null;};}function removeEntity(_0x54ef55,_0x56baa4){return function(_0x3a86ac){if(_0x3a86ac){return _0x3a86ac[_0xb6d4('0x23')]()[_0xb6d4('0x22')](function(){_0x54ef55[_0xb6d4('0x24')](0xcc)[_0xb6d4('0x18')]();});}};}function handleEntityNotFound(_0x223ca0,_0x1d1ac6){return function(_0x474cfc){if(!_0x474cfc){_0x223ca0[_0xb6d4('0x17')](0x194);}return _0x474cfc;};}function handleError(_0x3aedc7,_0xe67526){_0xe67526=_0xe67526||0x1f4;return function(_0x18db34){logger['error'](_0x18db34[_0xb6d4('0x25')]);if(_0x18db34[_0xb6d4('0x26')]){delete _0x18db34['name'];}_0x3aedc7[_0xb6d4('0x24')](_0xe67526)['send'](_0x18db34);};}exports[_0xb6d4('0x27')]=function(_0x3f2e8b,_0x346d4d){var _0x3191d2={},_0x1a311d={},_0x1b7ace={'count':0x0,'rows':[]};var _0x41847c=_[_0xb6d4('0x28')](db['WhatsappApplication'][_0xb6d4('0x29')],function(_0x1fea09){return{'name':_0x1fea09[_0xb6d4('0x2a')],'type':_0x1fea09['type'][_0xb6d4('0x2b')]};});_0x1a311d[_0xb6d4('0x2c')]=_['map'](_0x41847c,_0xb6d4('0x26'));_0x1a311d[_0xb6d4('0x2d')]=_[_0xb6d4('0x2e')](_0x3f2e8b['query']);_0x1a311d['filters']=_['intersection'](_0x1a311d[_0xb6d4('0x2c')],_0x1a311d[_0xb6d4('0x2d')]);_0x3191d2[_0xb6d4('0x2f')]=_[_0xb6d4('0x30')](_0x1a311d[_0xb6d4('0x2c')],qs[_0xb6d4('0x31')](_0x3f2e8b['query']['fields']));_0x3191d2[_0xb6d4('0x2f')]=_0x3191d2['attributes']['length']?_0x3191d2['attributes']:_0x1a311d['model'];if(!_0x3f2e8b[_0xb6d4('0x2d')][_0xb6d4('0x32')]('nolimit')){_0x3191d2[_0xb6d4('0x1d')]=qs['limit'](_0x3f2e8b[_0xb6d4('0x2d')][_0xb6d4('0x1d')]);_0x3191d2[_0xb6d4('0x1a')]=qs[_0xb6d4('0x1a')](_0x3f2e8b[_0xb6d4('0x2d')][_0xb6d4('0x1a')]);}_0x3191d2[_0xb6d4('0x33')]=qs['sort'](_0x3f2e8b[_0xb6d4('0x2d')][_0xb6d4('0x34')]);_0x3191d2[_0xb6d4('0x35')]=qs['filters'](_['pick'](_0x3f2e8b[_0xb6d4('0x2d')],_0x1a311d[_0xb6d4('0x36')]),_0x41847c);if(_0x3f2e8b[_0xb6d4('0x2d')][_0xb6d4('0x37')]){_0x3191d2[_0xb6d4('0x35')]=_['merge'](_0x3191d2[_0xb6d4('0x35')],{'$or':_['map'](_0x41847c,function(_0x188a38){if(_0x188a38[_0xb6d4('0x38')]!==_0xb6d4('0x39')){var _0x4e0ac2={};_0x4e0ac2[_0x188a38[_0xb6d4('0x26')]]={'$like':'%'+_0x3f2e8b['query']['filter']+'%'};return _0x4e0ac2;}})});}_0x3191d2=_[_0xb6d4('0x3a')]({},_0x3191d2,_0x3f2e8b[_0xb6d4('0x3b')]);var _0xa71efc={'where':_0x3191d2[_0xb6d4('0x35')]};return db[_0xb6d4('0x3c')][_0xb6d4('0x1c')](_0xa71efc)['then'](function(_0x9c3a24){_0x1b7ace['count']=_0x9c3a24;if(_0x3f2e8b[_0xb6d4('0x2d')]['includeAll']){_0x3191d2[_0xb6d4('0x3d')]=[{'all':!![]}];}return db[_0xb6d4('0x3c')][_0xb6d4('0x3e')](_0x3191d2);})[_0xb6d4('0x22')](function(_0x23aefc){_0x1b7ace['rows']=_0x23aefc;return _0x1b7ace;})[_0xb6d4('0x22')](respondWithFilteredResult(_0x346d4d,_0x3191d2))['catch'](handleError(_0x346d4d,null));};exports[_0xb6d4('0x3f')]=function(_0x2c92c9,_0x12c55e){var _0x1d7960={'raw':!![],'where':{'id':_0x2c92c9[_0xb6d4('0x40')]['id']}},_0x314bfb={};_0x314bfb['model']=_[_0xb6d4('0x2e')](db['WhatsappApplication'][_0xb6d4('0x29')]);_0x314bfb[_0xb6d4('0x2d')]=_[_0xb6d4('0x2e')](_0x2c92c9[_0xb6d4('0x2d')]);_0x314bfb[_0xb6d4('0x36')]=_[_0xb6d4('0x30')](_0x314bfb['model'],_0x314bfb['query']);_0x1d7960[_0xb6d4('0x2f')]=_['intersection'](_0x314bfb['model'],qs[_0xb6d4('0x31')](_0x2c92c9[_0xb6d4('0x2d')][_0xb6d4('0x31')]));_0x1d7960['attributes']=_0x1d7960['attributes'][_0xb6d4('0x41')]?_0x1d7960[_0xb6d4('0x2f')]:_0x314bfb[_0xb6d4('0x2c')];if(_0x2c92c9[_0xb6d4('0x2d')][_0xb6d4('0x42')]){_0x1d7960['include']=[{'all':!![]}];}_0x1d7960=_[_0xb6d4('0x3a')]({},_0x1d7960,_0x2c92c9[_0xb6d4('0x3b')]);return db[_0xb6d4('0x3c')][_0xb6d4('0x43')](_0x1d7960)[_0xb6d4('0x22')](handleEntityNotFound(_0x12c55e,null))[_0xb6d4('0x22')](respondWithResult(_0x12c55e,null))['catch'](handleError(_0x12c55e,null));};exports['create']=function(_0x15eb4d,_0x47efcf){return db['WhatsappApplication'][_0xb6d4('0x44')](_0x15eb4d[_0xb6d4('0x45')],{})[_0xb6d4('0x22')](respondWithResult(_0x47efcf,0xc9))[_0xb6d4('0x46')](handleError(_0x47efcf,null));};exports[_0xb6d4('0x47')]=function(_0x3544ed,_0x28a5d5){if(_0x3544ed['body']['id']){delete _0x3544ed[_0xb6d4('0x45')]['id'];}return db[_0xb6d4('0x3c')][_0xb6d4('0x43')]({'where':{'id':_0x3544ed[_0xb6d4('0x40')]['id']}})['then'](handleEntityNotFound(_0x28a5d5,null))['then'](saveUpdates(_0x3544ed['body'],null))['then'](respondWithResult(_0x28a5d5,null))[_0xb6d4('0x46')](handleError(_0x28a5d5,null));};exports['destroy']=function(_0x2d2891,_0x19c8fd){return db[_0xb6d4('0x3c')][_0xb6d4('0x43')]({'where':{'id':_0x2d2891[_0xb6d4('0x40')]['id']}})[_0xb6d4('0x22')](handleEntityNotFound(_0x19c8fd,null))['then'](removeEntity(_0x19c8fd,null))['catch'](handleError(_0x19c8fd,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index e4754d3..bf8ea27 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 _0x01fe=['../../config/environment','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x01fe,0x102));var _0xe01f=function(_0x2fca9f,_0x68945e){_0x2fca9f=_0x2fca9f-0x0;var _0x4aaad2=_0x01fe[_0x2fca9f];return _0x4aaad2;};'use strict';var _=require(_0xe01f('0x0'));var util=require('util');var logger=require(_0xe01f('0x1'))(_0xe01f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe01f('0x3'));var fs=require('fs');var path=require(_0xe01f('0x4'));var rimraf=require(_0xe01f('0x5'));var config=require(_0xe01f('0x6'));var attributes=require('./whatsappApplication.attributes');module[_0xe01f('0x7')]=function(_0x574969,_0x3effc4){return _0x574969[_0xe01f('0x8')](_0xe01f('0x9'),attributes,{'tableName':_0xe01f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe01f('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf041=['bluebird','path','../../config/environment','define','WhatsappApplication','whatsapp_applications','utf8mb4','../../config/logger','api','moment'];(function(_0x490014,_0x519ad6){var _0x289bee=function(_0x44fcc8){while(--_0x44fcc8){_0x490014['push'](_0x490014['shift']());}};_0x289bee(++_0x519ad6);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f04('0x0'))(_0x1f04('0x1'));var moment=require(_0x1f04('0x2'));var BPromise=require(_0x1f04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f04('0x4'));var rimraf=require('rimraf');var config=require(_0x1f04('0x5'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x25d578,_0x504d71){return _0x25d578[_0x1f04('0x6')](_0x1f04('0x7'),attributes,{'tableName':_0x1f04('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1f04('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b4f38e7..f9bdd9e 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 _0x4bc3=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x481a01,_0x54989a){var _0x4253c3=function(_0x52636d){while(--_0x52636d){_0x481a01['push'](_0x481a01['shift']());}};_0x4253c3(++_0x54989a);}(_0x4bc3,0x16e));var _0x34bc=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x4bc3[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21451b,_0x50320d,_0x502087){return new BPromise(function(_0x18a01c,_0x474108){return client[_0x34bc('0xb')](_0x21451b,_0x502087)[_0x34bc('0xc')](function(_0x409105){logger[_0x34bc('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x50320d,'request\x20sent');logger[_0x34bc('0xe')](_0x34bc('0xf'),_0x50320d,_0x34bc('0x10'),JSON['stringify'](_0x409105));if(_0x409105[_0x34bc('0x11')]){if(_0x409105['error'][_0x34bc('0x12')]===0x1f4){logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error'][_0x34bc('0x14')]);return _0x474108(_0x409105['error'][_0x34bc('0x14')]);}logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error']['message']);return _0x18a01c(_0x409105[_0x34bc('0x11')]['message']);}else{logger[_0x34bc('0xd')](_0x34bc('0x13'),_0x50320d,_0x34bc('0x10'));_0x18a01c(_0x409105[_0x34bc('0x15')][_0x34bc('0x14')]);}})[_0x34bc('0x16')](function(_0x5e132d){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x50320d,_0x5e132d);_0x474108(_0x5e132d);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2f7a29,_0x55de79){var _0x47b74b=function(_0x53d890){while(--_0x53d890){_0x2f7a29['push'](_0x2f7a29['shift']());}};_0x47b74b(++_0x55de79);}(_0x6aa7,0x178));var _0x76aa=function(_0x1c71c1,_0x7b1da6){_0x1c71c1=_0x1c71c1-0x0;var _0x564f95=_0x6aa7[_0x1c71c1];return _0x564f95;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 93915c8..6daabb2 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 _0xbeea=['whatsappinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','show','/:id/messages','getMessages','/:id/download','download','create','post','tracked','whatsapp','whatsappinteraction:addtags','addTags','/:id','whatsappinteraction:update','update','delete'];(function(_0x37e799,_0x32625f){var _0x436718=function(_0x3e28a9){while(--_0x3e28a9){_0x37e799['push'](_0x37e799['shift']());}};_0x436718(++_0x32625f);}(_0xbeea,0xb1));var _0xabee=function(_0x281dda,_0x64147d){_0x281dda=_0x281dda-0x0;var _0x579ca1=_0xbeea[_0x281dda];return _0x579ca1;};'use strict';var multer=require(_0xabee('0x0'));var util=require('util');var path=require(_0xabee('0x1'));var timeout=require(_0xabee('0x2'));var express=require(_0xabee('0x3'));var router=express['Router']();var fs_extra=require(_0xabee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xabee('0x5'));var config=require(_0xabee('0x6'));var controller=require(_0xabee('0x7'));router[_0xabee('0x8')]('/',auth[_0xabee('0x9')](),controller['index']);router['get'](_0xabee('0xa'),auth[_0xabee('0x9')](),controller['describe']);router[_0xabee('0x8')]('/:id',auth[_0xabee('0x9')](),controller[_0xabee('0xb')]);router[_0xabee('0x8')](_0xabee('0xc'),auth[_0xabee('0x9')](),controller[_0xabee('0xd')]);router['get'](_0xabee('0xe'),auth[_0xabee('0x9')](),controller[_0xabee('0xf')]);router['post']('/',auth[_0xabee('0x9')](),controller[_0xabee('0x10')]);router[_0xabee('0x11')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post']('/:id/tags',auth[_0xabee('0x9')](),interaction[_0xabee('0x12')](_0xabee('0x13'),_0xabee('0x14')),controller[_0xabee('0x15')]);router['put'](_0xabee('0x16'),auth[_0xabee('0x9')](),interaction[_0xabee('0x12')](_0xabee('0x13'),_0xabee('0x17')),controller[_0xabee('0x18')]);router[_0xabee('0x19')]('/:id',auth[_0xabee('0x9')](),interaction[_0xabee('0x12')](_0xabee('0x13'),_0xabee('0x1a')),controller[_0xabee('0x1b')]);router[_0xabee('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0xabee('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x7d9f=['isAuthenticated','describe','/:id','show','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','index','get'];(function(_0x37ddb7,_0x32d333){var _0x36c284=function(_0x54ca86){while(--_0x54ca86){_0x37ddb7['push'](_0x37ddb7['shift']());}};_0x36c284(++_0x32d333);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x337dd9,_0x54e3f3){_0x337dd9=_0x337dd9-0x0;var _0x20f4fc=_0x7d9f[_0x337dd9];return _0x20f4fc;};'use strict';var multer=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var path=require(_0xf7d9('0x2'));var timeout=require(_0xf7d9('0x3'));var express=require(_0xf7d9('0x4'));var router=express['Router']();var fs_extra=require(_0xf7d9('0x5'));var auth=require(_0xf7d9('0x6'));var interaction=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var controller=require(_0xf7d9('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf7d9('0xa')]);router[_0xf7d9('0xb')]('/describe',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0xd')]);router['get'](_0xf7d9('0xe'),auth['isAuthenticated'](),controller[_0xf7d9('0xf')]);router[_0xf7d9('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0xf7d9('0x10')]);router[_0xf7d9('0xb')](_0xf7d9('0x11'),auth['isAuthenticated'](),controller['download']);router[_0xf7d9('0x12')]('/',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0x13')]);router[_0xf7d9('0x12')]('/:id/messages',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0x14')]);router[_0xf7d9('0x12')](_0xf7d9('0x15'),auth['isAuthenticated'](),interaction[_0xf7d9('0x16')](_0xf7d9('0x17'),_0xf7d9('0x18')),controller[_0xf7d9('0x19')]);router['put'](_0xf7d9('0xe'),auth[_0xf7d9('0xc')](),interaction[_0xf7d9('0x16')]('whatsapp','whatsappinteraction:update'),controller[_0xf7d9('0x1a')]);router[_0xf7d9('0x1b')](_0xf7d9('0xe'),auth['isAuthenticated'](),interaction[_0xf7d9('0x16')](_0xf7d9('0x17'),'whatsappinteraction:destroy'),controller[_0xf7d9('0x1c')]);router['delete'](_0xf7d9('0x15'),auth[_0xf7d9('0xc')](),controller['removeTags']);module[_0xf7d9('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 0882fa3..5813a46 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 _0xcf12=['ENUM','out','moment','BOOLEAN','DATE','STRING'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xcf12,0x140));var _0x2cf1=function(_0x4eeccc,_0x12a356){_0x4eeccc=_0x4eeccc-0x0;var _0x8f2e8=_0xcf12[_0x4eeccc];return _0x8f2e8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2cf1('0x0'));module['exports']={'closed':{'type':Sequelize[_0x2cf1('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2cf1('0x2')]},'disposition':{'type':Sequelize[_0x2cf1('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2cf1('0x3')]},'note':{'type':Sequelize[_0x2cf1('0x3')]},'phone':{'type':Sequelize[_0x2cf1('0x3')]},'read1stAt':{'type':Sequelize[_0x2cf1('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x2cf1('0x4')]('in',_0x2cf1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2cf1('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x2cf1('0x4')]('in',_0x2cf1('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd206=['moment','BOOLEAN','DATE','STRING','out','sequelize'];(function(_0x4c5a90,_0x39edaf){var _0x8e83e8=function(_0xce4f7e){while(--_0xce4f7e){_0x4c5a90['push'](_0x4c5a90['shift']());}};_0x8e83e8(++_0x39edaf);}(_0xd206,0x107));var _0x6d20=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xd206[_0x58e469];return _0x4c01c5;};'use strict';var Sequelize=require(_0x6d20('0x0'));var moment=require(_0x6d20('0x1'));module['exports']={'closed':{'type':Sequelize[_0x6d20('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6d20('0x3')]},'disposition':{'type':Sequelize[_0x6d20('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6d20('0x4')]},'note':{'type':Sequelize[_0x6d20('0x4')]},'phone':{'type':Sequelize[_0x6d20('0x4')]},'read1stAt':{'type':Sequelize[_0x6d20('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6d20('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6d20('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6d20('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index f315c40..7e6350d 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 _0xa3e8=['setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','join','server','files','tmp','root','format','transcript-%d-%s.zip','CmContact','firstName','lastName','attachments','Attachment','Messages','direction','secret','get','mkdirSync','Account','Owner','N.A.','closedAt','disposition','existsSync','createReadStream','pipe','basename','out','System','renderFile','views','downloadInteraction.ejs','.pdf','Whatsapp','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','forEach','waiting','talking','answered','unmanaged','total','UserId','closed','index','WhatsappInteraction','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','field','color','from','tools_tags','select','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','value','having','`\x20=\x200','Contact','operator','$substring','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','union','User','body','buildExpression','keys','isEmpty','WhatsappAccountId','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','rows','catch','show','includeAll','options','create','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags'];(function(_0x3d300b,_0xf5472f){var _0x593625=function(_0x202d30){while(--_0x202d30){_0x3d300b['push'](_0x3d300b['shift']());}};_0x593625(++_0xf5472f);}(_0xa3e8,0x127));var _0x8a3e=function(_0x5f5daa,_0xfc92e2){_0x5f5daa=_0x5f5daa-0x0;var _0x1ff301=_0xa3e8[_0x5f5daa];return _0x1ff301;};'use strict';var emlformat=require(_0x8a3e('0x0'));var rimraf=require(_0x8a3e('0x1'));var zipdir=require(_0x8a3e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a3e('0x3'));var moment=require(_0x8a3e('0x4'));var BPromise=require(_0x8a3e('0x5'));var Mustache=require(_0x8a3e('0x6'));var util=require(_0x8a3e('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8a3e('0x8'));var fs=require('fs');var fs_extra=require(_0x8a3e('0x9'));var _=require(_0x8a3e('0xa'));var squel=require('squel');var crypto=require(_0x8a3e('0xb'));var jsforce=require(_0x8a3e('0xc'));var deskjs=require(_0x8a3e('0xd'));var toCsv=require(_0x8a3e('0xe'));var querystring=require(_0x8a3e('0xf'));var Papa=require(_0x8a3e('0x10'));var Redis=require(_0x8a3e('0x11'));var authService=require(_0x8a3e('0x12'));var qs=require(_0x8a3e('0x13'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x8a3e('0x14'));var hardwareService=require(_0x8a3e('0x15'));var logger=require(_0x8a3e('0x16'))('api');var utils=require(_0x8a3e('0x17'));var config=require(_0x8a3e('0x18'));var licenseUtil=require(_0x8a3e('0x19'));var db=require(_0x8a3e('0x1a'))['db'];config[_0x8a3e('0x1b')]=_[_0x8a3e('0x1c')](config[_0x8a3e('0x1b')],{'host':_0x8a3e('0x1d'),'port':0x18eb});var socket=require(_0x8a3e('0x1e'))(new Redis(config[_0x8a3e('0x1b')]));require(_0x8a3e('0x1f'))[_0x8a3e('0x20')](socket);function respondWithStatusCode(_0x333c51,_0x4d9a4c){_0x4d9a4c=_0x4d9a4c||0xcc;return function(_0x48585f){if(_0x48585f){return _0x333c51[_0x8a3e('0x21')](_0x4d9a4c);}return _0x333c51[_0x8a3e('0x22')](_0x4d9a4c)[_0x8a3e('0x23')]();};}function respondWithResult(_0x2f316e,_0x4cfba8){_0x4cfba8=_0x4cfba8||0xc8;return function(_0x48e5a8){if(_0x48e5a8){return _0x2f316e[_0x8a3e('0x22')](_0x4cfba8)['json'](_0x48e5a8);}};}function respondWithFilteredResult(_0x49be9d,_0x2f0b46){return function(_0xb2f9c3){if(_0xb2f9c3){var _0xcb1a1f=typeof _0x2f0b46[_0x8a3e('0x24')]===_0x8a3e('0x25')&&typeof _0x2f0b46[_0x8a3e('0x26')]===_0x8a3e('0x25');var _0x1cc792=_0xb2f9c3['count'];var _0x18fc63=_0xcb1a1f?0x0:_0x2f0b46['offset'];var _0x103eab=_0xcb1a1f?_0xb2f9c3[_0x8a3e('0x27')]:_0x2f0b46[_0x8a3e('0x24')]+_0x2f0b46['limit'];var _0x60438d;if(_0x103eab>=_0x1cc792){_0x103eab=_0x1cc792;_0x60438d=0xc8;}else{_0x60438d=0xce;}_0x49be9d[_0x8a3e('0x22')](_0x60438d);return _0x49be9d['set'](_0x8a3e('0x28'),_0x18fc63+'-'+_0x103eab+'/'+_0x1cc792)[_0x8a3e('0x29')](_0xb2f9c3);}return null;};}function patchUpdates(_0x306632){return function(_0x2b29bb){try{jsonpatch[_0x8a3e('0x2a')](_0x2b29bb,_0x306632,!![]);}catch(_0x1dacd9){return BPromise[_0x8a3e('0x2b')](_0x1dacd9);}return _0x2b29bb[_0x8a3e('0x2c')]();};}function saveUpdates(_0x328c45,_0x36d365){return function(_0x41a6ff){if(_0x41a6ff){return _0x41a6ff[_0x8a3e('0x2d')](_0x328c45)['then'](function(_0x1d34e5){return _0x1d34e5;});}return null;};}function removeEntity(_0x58195b,_0x33322d){return function(_0x4eb728){if(_0x4eb728){return _0x4eb728[_0x8a3e('0x2e')]()[_0x8a3e('0x2f')](function(){_0x58195b[_0x8a3e('0x22')](0xcc)[_0x8a3e('0x23')]();});}};}function handleEntityNotFound(_0x86eb3e,_0x15c3ef){return function(_0x1c4259){if(!_0x1c4259){_0x86eb3e['sendStatus'](0x194);}return _0x1c4259;};}function handleError(_0x1f8079,_0x1c9a16){_0x1c9a16=_0x1c9a16||0x1f4;return function(_0xf80a64){logger[_0x8a3e('0x30')](_0xf80a64[_0x8a3e('0x31')]);if(_0xf80a64[_0x8a3e('0x32')]){delete _0xf80a64[_0x8a3e('0x32')];}_0x1f8079['status'](_0x1c9a16)[_0x8a3e('0x33')](_0xf80a64);};}function getInteractionUsers(_0x463efc,_0x1012b0){return new BPromise(function(_0xb21ef,_0x9587fd){try{if(_0x1012b0[_0x463efc['id']]){_0x463efc[_0x8a3e('0x34')]=_[_0x8a3e('0x35')](_0x1012b0[_0x463efc['id']],function(_0x216a13){return{'id':_0x216a13['id'],'fullname':_0x216a13[_0x8a3e('0x36')]};});}}catch(_0x3d38cc){_0x9587fd(_0x3d38cc);}_0xb21ef(_0x463efc);});}function getInteractionTags(_0xbd9410,_0x472bf1){return new BPromise(function(_0x3444de,_0x2f6611){try{if(_0xbd9410[_0x8a3e('0x37')]){_0xbd9410['Tags']=[];_0xbd9410['TagIds']['split'](',')[_0x8a3e('0x38')](function(_0x1ca9f4){_0xbd9410['Tags']['push'](_0x472bf1[_0x1ca9f4]);});}delete _0xbd9410[_0x8a3e('0x37')];}catch(_0x4fd586){_0x2f6611(_0x4fd586);}_0x3444de(_0xbd9410);});}function updateWhatsappInteraction(_0x5aef1a,_0x372ff5,_0x15c169){return new BPromise(function(_0x20612f,_0x2d6b39){return getInteractionUsers(_0x5aef1a,_0x15c169)[_0x8a3e('0x2f')](function(_0x48dc8c){return getInteractionTags(_0x48dc8c,_0x372ff5);})[_0x8a3e('0x2f')](function(_0xee4443){return getStateInteraction(_0xee4443);})['then'](function(_0x394946){_0x20612f(_0x394946);})['catch'](function(_0x8db886){_0x2d6b39(_0x8db886);});});}function getStateInteraction(_0x1c9454){return new BPromise(function(_0x405b89){_0x1c9454[_0x8a3e('0x39')]=0x0;_0x1c9454[_0x8a3e('0x3a')]=0x0;_0x1c9454[_0x8a3e('0x3b')]=0x0;_0x1c9454[_0x8a3e('0x3c')]=0x0;_0x1c9454[_0x8a3e('0x3d')]=0x0;if(!_0x1c9454['closed']&&!_0x1c9454[_0x8a3e('0x3e')]){_0x1c9454[_0x8a3e('0x39')]+=0x1;}if(!_0x1c9454[_0x8a3e('0x3f')]&&_0x1c9454[_0x8a3e('0x3e')]){_0x1c9454[_0x8a3e('0x3a')]+=0x1;if(_0x1c9454[_0x8a3e('0x39')]){_0x1c9454['waiting']-=0x1;}}if(_0x1c9454[_0x8a3e('0x3f')]&&_0x1c9454[_0x8a3e('0x3e')]){_0x1c9454[_0x8a3e('0x3b')]+=0x1;if(_0x1c9454[_0x8a3e('0x3a')]){_0x1c9454['talking']-=0x1;}}if(_0x1c9454[_0x8a3e('0x3f')]&&!_0x1c9454['UserId']){_0x1c9454[_0x8a3e('0x3c')]+=0x1;if(_0x1c9454[_0x8a3e('0x39')]){_0x1c9454[_0x8a3e('0x39')]-=0x1;}}_0x1c9454[_0x8a3e('0x3d')]+=0x1;_0x405b89(_0x1c9454);});}exports[_0x8a3e('0x40')]=function(_0x100446,_0x1e710a){var _0x44c5e7={},_0x2364db={},_0x218367={'count':0x0,'rows':[]};var _0x5b6928=_['map'](db[_0x8a3e('0x41')][_0x8a3e('0x42')],function(_0x5376bd){return{'name':_0x5376bd[_0x8a3e('0x43')],'type':_0x5376bd[_0x8a3e('0x44')]['key']};});_0x2364db[_0x8a3e('0x45')]=_['map'](_0x5b6928,'name');_0x2364db[_0x8a3e('0x46')]=_['keys'](_0x100446['query']);_0x2364db[_0x8a3e('0x47')]=_[_0x8a3e('0x48')](_0x2364db['model'],_0x2364db[_0x8a3e('0x46')]);_0x44c5e7[_0x8a3e('0x49')]=_['intersection'](_0x2364db[_0x8a3e('0x45')],qs['fields'](_0x100446['query'][_0x8a3e('0x4a')]));_0x44c5e7[_0x8a3e('0x49')]=_0x44c5e7[_0x8a3e('0x49')]['length']?_0x44c5e7[_0x8a3e('0x49')]:_0x2364db[_0x8a3e('0x45')];if(!_0x100446['query'][_0x8a3e('0x4b')](_0x8a3e('0x4c'))){_0x44c5e7['limit']=qs[_0x8a3e('0x26')](_0x100446[_0x8a3e('0x46')]['limit']);_0x44c5e7['offset']=qs[_0x8a3e('0x24')](_0x100446[_0x8a3e('0x46')]['offset']);}_0x44c5e7[_0x8a3e('0x4d')]=qs[_0x8a3e('0x4e')](_0x100446[_0x8a3e('0x46')][_0x8a3e('0x4e')]);_0x44c5e7[_0x8a3e('0x4f')]=qs['filters'](_['pick'](_0x100446[_0x8a3e('0x46')],_0x2364db[_0x8a3e('0x47')]),_0x5b6928);var _0x5dee53=[];var _0x318096=squel['select']()[_0x8a3e('0x50')]('id')[_0x8a3e('0x50')]('name')[_0x8a3e('0x50')](_0x8a3e('0x51'))[_0x8a3e('0x52')](_0x8a3e('0x53'));var _0x5e62b6=squel[_0x8a3e('0x54')]()['field'](_0x8a3e('0x55'))[_0x8a3e('0x50')]('u.fullname')[_0x8a3e('0x50')](_0x8a3e('0x56'))[_0x8a3e('0x52')](_0x8a3e('0x57'),'ui')[_0x8a3e('0x58')]('users','u','u.id\x20=\x20ui.UserId');var _0x5211ff=squel[_0x8a3e('0x54')]()[_0x8a3e('0x52')]('whatsapp_interactions','i')[_0x8a3e('0x58')](_0x8a3e('0x59'),'c',_0x8a3e('0x5a'))['left_join']('users','o',_0x8a3e('0x5b'))['left_join'](_0x8a3e('0x5c'),'a',_0x8a3e('0x5d'))['left_join'](_0x8a3e('0x5e'),'me',_0x8a3e('0x5f'))[_0x8a3e('0x58')](_0x8a3e('0x60'),'it',_0x8a3e('0x61'))['left_join'](_0x8a3e('0x53'),'t',_0x8a3e('0x62'));var _0x105cb9=squel[_0x8a3e('0x63')]();var _0x4582d3=[];var _0x32747b=squel[_0x8a3e('0x63')]();var _0x2c261d;if(_0x100446[_0x8a3e('0x46')][_0x8a3e('0x64')]){_0x2c261d=as[_0x8a3e('0x65')](_0x100446[_0x8a3e('0x46')][_0x8a3e('0x64')]);var _0x2c522f=_0x2c261d[_0x8a3e('0x66')];for(var _0x59f653=0x0;_0x59f653<_0x2c261d[_0x8a3e('0x67')][_0x8a3e('0x68')];_0x59f653++){var _0x38b9c1=_0x2c261d[_0x8a3e('0x67')][_0x59f653];var _0x3f408a='i';var _0x7631a0=_['find'](_0x5b6928,[_0x8a3e('0x32'),_0x38b9c1[_0x8a3e('0x50')]]);if(!_0x7631a0){switch(_0x38b9c1['field']){case'unreadMessages':if(_0x38b9c1[_0x8a3e('0x69')]==0x1){_0x5211ff[_0x8a3e('0x6a')]('`'+_0x38b9c1[_0x8a3e('0x50')]+_0x8a3e('0x6b'));}else{_0x5211ff[_0x8a3e('0x6a')]('`'+_0x38b9c1['field']+'`\x20>\x200');}break;case _0x8a3e('0x6c'):if(_0x38b9c1[_0x8a3e('0x6d')]===_0x8a3e('0x6e')){if(_0x38b9c1[_0x8a3e('0x69')][_0x8a3e('0x6f')]('\x20')[_0x8a3e('0x68')]>0x1){_0x105cb9[_0x2c522f]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8a3e('0x70')](_0x38b9c1[_0x8a3e('0x69')]),null);}else{var _0x15c265='%'+_0x38b9c1[_0x8a3e('0x69')]+'%';_0x105cb9[_0x2c522f](_0x8a3e('0x71'),_0x15c265,_0x15c265,_0x15c265);}}else{_0x7631a0=_[_0x8a3e('0x72')](_0x5b6928,['name',_0x8a3e('0x73')]);_0x38b9c1[_0x8a3e('0x50')]=_0x8a3e('0x73');_0x468ff3=as['buildExpression'](_0x3f408a,_0x7631a0[_0x8a3e('0x44')],_0x38b9c1);_0x105cb9[_0x2c522f](_0x468ff3[_0x8a3e('0x74')],_0x468ff3[_0x8a3e('0x69')][_0x8a3e('0x75')],_0x468ff3[_0x8a3e('0x69')][_0x8a3e('0x23')]);}break;case _0x8a3e('0x76'):var _0x42514a=_0x38b9c1[_0x8a3e('0x69')]['split'](',')['map'](function(_0x1ba8db){return Number(_0x1ba8db);});_0x42514a[_0x8a3e('0x38')](function(_0x180b84){_0x32747b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x180b84+',%');});_0x4582d3=_[_0x8a3e('0x77')](_0x4582d3,_0x42514a);break;case _0x8a3e('0x78'):if(_0x38b9c1[_0x8a3e('0x6d')]==='$substring'){_0x105cb9[_0x2c522f]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x38b9c1[_0x8a3e('0x69')]+'%',null);}else{_0x7631a0=_['find'](_0x5b6928,[_0x8a3e('0x32'),'UserId']);_0x38b9c1[_0x8a3e('0x50')]='UserId';_0x468ff3=as['buildExpression'](_0x3f408a,_0x7631a0[_0x8a3e('0x44')],_0x38b9c1);_0x105cb9[_0x2c522f](_0x468ff3['text'],_0x468ff3[_0x8a3e('0x69')][_0x8a3e('0x75')],_0x468ff3[_0x8a3e('0x69')][_0x8a3e('0x23')]);}break;case _0x8a3e('0x79'):_0x468ff3=as[_0x8a3e('0x7a')]('me',null,_0x38b9c1);_0x105cb9[_0x2c522f](_0x468ff3['text'],_0x468ff3['value']['start'],_0x468ff3[_0x8a3e('0x69')][_0x8a3e('0x23')]);break;}}else{var _0x468ff3=as[_0x8a3e('0x7a')](_0x3f408a,_0x7631a0['type'],_0x38b9c1);_0x105cb9[_0x2c522f](_0x468ff3[_0x8a3e('0x74')],_0x468ff3['value'][_0x8a3e('0x75')],_0x468ff3[_0x8a3e('0x69')][_0x8a3e('0x23')]);}}}else{var _0x49080b=_(_0x100446[_0x8a3e('0x46')])[_0x8a3e('0x7b')]()[_0x8a3e('0x35')](function(_0x1d7def){return _['some'](_0x5b6928,[_0x8a3e('0x32'),_0x1d7def])?_0x1d7def:undefined;})['compact']()[_0x8a3e('0x69')]();if(!_[_0x8a3e('0x7c')](_0x49080b)){_0x49080b[_0x8a3e('0x38')](function(_0x425f00){if(_0x425f00===_0x8a3e('0x7d')){_0x5211ff[_0x8a3e('0x4f')]('i.WhatsappAccountId\x20IN\x20?',[]['concat'](_0x100446[_0x8a3e('0x46')][_0x425f00]));}else if(_0x425f00===_0x8a3e('0x7e')){var _0xd77af7=JSON[_0x8a3e('0x7f')](_0x100446[_0x8a3e('0x46')][_0x425f00])['$gte'];var _0x493cb8=JSON['parse'](_0x100446[_0x8a3e('0x46')][_0x425f00])['$lte'];_0x5211ff[_0x8a3e('0x4f')](_0x8a3e('0x80'),_0xd77af7,_0x493cb8);}else{if(_0x100446[_0x8a3e('0x46')][_0x425f00]===_0x8a3e('0x81')){_0x5211ff[_0x8a3e('0x4f')]('i.'+_0x425f00+_0x8a3e('0x82'));}else{_0x5211ff['where']('i.'+_0x425f00+'\x20=\x20?',_0x100446[_0x8a3e('0x46')][_0x425f00]);}}});}if(_0x100446['query']['read']){if(_0x100446[_0x8a3e('0x46')][_0x8a3e('0x83')]==0x1){_0x5211ff[_0x8a3e('0x6a')](_0x8a3e('0x84'));}else{_0x5211ff['having'](_0x8a3e('0x85'));}}if(_0x100446['query'][_0x8a3e('0x86')]){_0x4582d3=_[_0x8a3e('0x87')](_0x100446[_0x8a3e('0x46')][_0x8a3e('0x86')])?_0x100446['query'][_0x8a3e('0x86')]:new Array(_0x100446[_0x8a3e('0x46')][_0x8a3e('0x86')]);_0x4582d3[_0x8a3e('0x38')](function(_0x50ef33){_0x32747b['or'](_0x8a3e('0x88'),'%,'+_0x50ef33+',%');});}if(_0x100446[_0x8a3e('0x46')]['filter']){var _0x1015ef=_0x100446[_0x8a3e('0x46')][_0x8a3e('0x89')][_0x8a3e('0x8a')]('\x5c','\x5c\x5c')[_0x8a3e('0x8a')](/'/g,'\x27\x27');if(qs[_0x8a3e('0x8b')](_0x1015ef)){_0x105cb9['or'](_0x8a3e('0x8c'),_0x1015ef+'%')['or'](_0x8a3e('0x8d'),_0x1015ef+'%');}else{_0x105cb9['or'](_0x8a3e('0x8e'),qs[_0x8a3e('0x70')](_0x1015ef))['or'](_0x8a3e('0x8f'),_0x1015ef+'%');}}}_0x5211ff[_0x8a3e('0x4f')](_0x105cb9);_0x5211ff[_0x8a3e('0x90')](_0x8a3e('0x91'));var _0x366589={'type':db[_0x8a3e('0x92')][_0x8a3e('0x93')]['SELECT'],'raw':!![]};var _0x5ca364=_0x5211ff[_0x8a3e('0x94')]();_0x5ca364['field']('i.id');_0x5ca364[_0x8a3e('0x50')](_0x8a3e('0x95'),_0x8a3e('0x96'));if(_0x44c5e7[_0x8a3e('0x4d')]){_0x44c5e7['order'][_0x8a3e('0x38')](function(_0x30bd8b){var _0x5561f4=_0x30bd8b[0x0]===_0x8a3e('0x97')?_0x30bd8b[0x0]:'i.'+_0x30bd8b[0x0];_0x5211ff['order'](_0x5561f4,_0x30bd8b[0x1]===_0x8a3e('0x98')?![]:!![]);});}if(!_[_0x8a3e('0x7c')](_0x4582d3)){_0x5211ff[_0x8a3e('0x6a')](_0x32747b);_0x5ca364[_0x8a3e('0x4f')](_0x8a3e('0x99'),_0x4582d3);}BPromise[_0x8a3e('0x9a')]()[_0x8a3e('0x2f')](function(){if(!_0x2c261d){if(_0x100446[_0x8a3e('0x46')]['WhatsappAccountId'])return;_0x5ca364[_0x8a3e('0x4f')](_0x8a3e('0x9b'));_0x5211ff['where'](_0x8a3e('0x9b'));return;}if(_0x100446[_0x8a3e('0x9c')][_0x8a3e('0x9d')]!=='agent')return;return _0x100446['user'][_0x8a3e('0x9e')]({'attributes':['id'],'raw':!![]})[_0x8a3e('0x2f')](function(_0x31f8dc){if(_['isEmpty'](_0x31f8dc)){_0x5ca364[_0x8a3e('0x4f')](_0x8a3e('0x9f'));_0x5211ff[_0x8a3e('0x4f')](_0x8a3e('0x9f'));}else{_0x5ca364['where'](_0x8a3e('0xa0'),_[_0x8a3e('0x35')](_0x31f8dc,'id'));_0x5211ff[_0x8a3e('0x4f')]('i.WhatsappAccountId\x20IN\x20?',_[_0x8a3e('0x35')](_0x31f8dc,'id'));}});})['then'](function(){if(_0x100446['user'][_0x8a3e('0x9d')]===_0x8a3e('0xa1')&&!_0x2c261d&&!_0x100446[_0x8a3e('0x46')][_0x8a3e('0x7d')])return[];return db[_0x8a3e('0xa2')]['query'](_0x5ca364['toString'](),_0x366589);})[_0x8a3e('0x2f')](function(_0x519014){_0x218367[_0x8a3e('0x27')]=_0x519014[_0x8a3e('0x68')];if(_0x218367[_0x8a3e('0x27')]===0x0)return[];return db['sequelize'][_0x8a3e('0x46')](_0x318096[_0x8a3e('0xa3')](),_0x366589)[_0x8a3e('0x2f')](function(_0x12e350){_0x5dee53=_[_0x8a3e('0xa4')](_0x12e350,'id');_0x366589=_[_0x8a3e('0xa5')](_0x366589,{'model':db[_0x8a3e('0x41')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x100446[_0x8a3e('0x46')][_0x8a3e('0x4a')]){_0x44c5e7[_0x8a3e('0x49')][_0x8a3e('0x38')](function(_0x51c8f9){_0x5211ff[_0x8a3e('0x50')]('i.'+_0x51c8f9);});}else{_0x5211ff[_0x8a3e('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x5211ff[_0x8a3e('0x50')](_0x8a3e('0xa6'),_0x8a3e('0xa7'));_0x5211ff[_0x8a3e('0x50')]('a.mandatoryDisposition',_0x8a3e('0xa8'));_0x5211ff[_0x8a3e('0x50')](_0x8a3e('0xa9'),_0x8a3e('0x97'));_0x5211ff[_0x8a3e('0x50')](_0x8a3e('0xaa'));_0x5211ff['field'](_0x8a3e('0xab'),_0x8a3e('0xac'));_0x5211ff[_0x8a3e('0x50')](_0x8a3e('0xad'),_0x8a3e('0xae'));_0x5211ff['field'](_0x8a3e('0xaf'),_0x8a3e('0xb0'));_0x5211ff[_0x8a3e('0x50')](_0x8a3e('0xb1'),_0x8a3e('0xb2'));_0x5211ff[_0x8a3e('0x50')](_0x8a3e('0xb3'),_0x8a3e('0xb4'));_0x5211ff[_0x8a3e('0x50')](_0x8a3e('0xb5'),_0x8a3e('0xb6'));_0x5211ff[_0x8a3e('0x50')](_0x8a3e('0xb7'),_0x8a3e('0xb8'));_0x5211ff[_0x8a3e('0x50')](_0x8a3e('0xb9'),'Owner.internal');_0x5211ff[_0x8a3e('0x50')](_0x8a3e('0xba'),_0x8a3e('0x37'));}if(_0x44c5e7[_0x8a3e('0x26')])_0x5211ff[_0x8a3e('0x26')](_0x44c5e7['limit']);if(_0x44c5e7['offset'])_0x5211ff[_0x8a3e('0x24')](_0x44c5e7[_0x8a3e('0x24')]);return db[_0x8a3e('0xa2')][_0x8a3e('0x46')](_0x5211ff[_0x8a3e('0xa3')](),_0x366589);})['then'](function(_0x51bf05){if(_0x51bf05[_0x8a3e('0x68')]>0x0)_0x5e62b6[_0x8a3e('0x4f')](_0x8a3e('0xbb'),_[_0x8a3e('0x35')](_0x51bf05,'id'));return db[_0x8a3e('0xa2')][_0x8a3e('0x46')](_0x5e62b6[_0x8a3e('0xa3')](),_0x366589)[_0x8a3e('0x2f')](function(_0x5c49fa){var _0x26377b=_[_0x8a3e('0xbc')](_0x5c49fa,_0x8a3e('0xbd'));var _0x5b4ee5=[];_0x51bf05[_0x8a3e('0x38')](function(_0x4959f0){_0x5b4ee5[_0x8a3e('0xbe')](updateWhatsappInteraction(_0x4959f0,_0x5dee53,_0x26377b));});return BPromise['all'](_0x5b4ee5);});});})[_0x8a3e('0x2f')](function(_0x17c312){_0x218367[_0x8a3e('0xbf')]=_0x17c312;return _0x218367;})[_0x8a3e('0x2f')](respondWithFilteredResult(_0x1e710a,_0x44c5e7))[_0x8a3e('0xc0')](handleError(_0x1e710a,null));};exports[_0x8a3e('0xc1')]=function(_0xaaf8d4,_0x47ed32){var _0xa18de5={'raw':![],'where':{'id':_0xaaf8d4['params']['id']}},_0x430a2b={};_0x430a2b[_0x8a3e('0x45')]=_[_0x8a3e('0x7b')](db['WhatsappInteraction']['rawAttributes']);_0x430a2b[_0x8a3e('0x46')]=_[_0x8a3e('0x7b')](_0xaaf8d4[_0x8a3e('0x46')]);_0x430a2b['filters']=_[_0x8a3e('0x48')](_0x430a2b[_0x8a3e('0x45')],_0x430a2b[_0x8a3e('0x46')]);_0xa18de5[_0x8a3e('0x49')]=_[_0x8a3e('0x48')](_0x430a2b[_0x8a3e('0x45')],qs[_0x8a3e('0x4a')](_0xaaf8d4[_0x8a3e('0x46')][_0x8a3e('0x4a')]));_0xa18de5[_0x8a3e('0x49')]=_0xa18de5[_0x8a3e('0x49')][_0x8a3e('0x68')]?_0xa18de5['attributes']:_0x430a2b[_0x8a3e('0x45')];if(_0xaaf8d4[_0x8a3e('0x46')][_0x8a3e('0xc2')]){_0xa18de5['include']=[{'all':!![]}];}_0xa18de5=_[_0x8a3e('0xa5')]({},_0xa18de5,_0xaaf8d4[_0x8a3e('0xc3')]);return db[_0x8a3e('0x41')]['find'](_0xa18de5)['then'](handleEntityNotFound(_0x47ed32,null))[_0x8a3e('0x2f')](respondWithResult(_0x47ed32,null))['catch'](handleError(_0x47ed32,null));};exports[_0x8a3e('0xc4')]=function(_0x1bc484,_0x23ffe2){return db[_0x8a3e('0x41')][_0x8a3e('0xc4')](_0x1bc484[_0x8a3e('0x79')],{})[_0x8a3e('0x2f')](respondWithResult(_0x23ffe2,0xc9))[_0x8a3e('0xc0')](handleError(_0x23ffe2,null));};exports[_0x8a3e('0x2d')]=function(_0x21b129,_0x4b7c06){if(_0x21b129[_0x8a3e('0x79')]['id']){delete _0x21b129[_0x8a3e('0x79')]['id'];}return db[_0x8a3e('0x41')]['find']({'where':{'id':_0x21b129[_0x8a3e('0xc5')]['id']}})[_0x8a3e('0x2f')](handleEntityNotFound(_0x4b7c06,null))[_0x8a3e('0x2f')](saveUpdates(_0x21b129[_0x8a3e('0x79')],null))[_0x8a3e('0x2f')](respondWithResult(_0x4b7c06,null))[_0x8a3e('0xc0')](handleError(_0x4b7c06,null));};exports[_0x8a3e('0x2e')]=function(_0x29000a,_0x571027){return db[_0x8a3e('0x41')]['find']({'where':{'id':_0x29000a[_0x8a3e('0xc5')]['id']}})[_0x8a3e('0x2f')](handleEntityNotFound(_0x571027,null))[_0x8a3e('0x2f')](removeEntity(_0x571027,null))['catch'](handleError(_0x571027,null));};exports[_0x8a3e('0xc6')]=function(_0x39838a,_0x1b0e50){return db[_0x8a3e('0x41')][_0x8a3e('0xc6')]()[_0x8a3e('0x2f')](respondWithResult(_0x1b0e50,null))['catch'](handleError(_0x1b0e50,null));};exports[_0x8a3e('0xc7')]=function(_0x13eab9,_0x5b0dd4,_0x1fa3ff){return db[_0x8a3e('0xc8')]['find']({'where':{'id':_0x13eab9[_0x8a3e('0xc5')]['id']}})['then'](handleEntityNotFound(_0x5b0dd4,null))[_0x8a3e('0x2f')](function(_0x31915b){if(_0x31915b){return _0x31915b[_0x8a3e('0xc7')](_0x13eab9['body'][_0x8a3e('0xc9')],_[_0x8a3e('0xca')](_0x13eab9[_0x8a3e('0x79')],['ids','id'])||{});}})[_0x8a3e('0x2f')](respondWithResult(_0x5b0dd4,null))[_0x8a3e('0xc0')](handleError(_0x5b0dd4,null));};exports[_0x8a3e('0xcb')]=function(_0x4fe813,_0x145265,_0x5032e3){var _0x5e3d9a={'raw':![],'where':{}};var _0x4e4447={};var _0x175dcc={'count':0x0,'rows':[]};return db[_0x8a3e('0x41')][_0x8a3e('0xcc')]({'where':{'id':_0x4fe813[_0x8a3e('0xc5')]['id']}})['then'](handleEntityNotFound(_0x145265,null))[_0x8a3e('0x2f')](function(_0x2f1623){if(_0x2f1623){_0x4e4447[_0x8a3e('0x45')]=_['keys'](db['WhatsappMessage'][_0x8a3e('0x42')]);_0x4e4447[_0x8a3e('0x46')]=_[_0x8a3e('0x7b')](_0x4fe813[_0x8a3e('0x46')]);_0x4e4447[_0x8a3e('0x47')]=_[_0x8a3e('0x48')](_0x4e4447[_0x8a3e('0x45')],_0x4e4447[_0x8a3e('0x46')]);_0x5e3d9a[_0x8a3e('0x49')]=_['intersection'](_0x4e4447['model'],qs['fields'](_0x4fe813['query']['fields']));_0x5e3d9a[_0x8a3e('0x49')]=_0x5e3d9a[_0x8a3e('0x49')][_0x8a3e('0x68')]?_0x5e3d9a[_0x8a3e('0x49')]:_0x4e4447['model'];if(!_0x4fe813[_0x8a3e('0x46')]['hasOwnProperty'](_0x8a3e('0x4c'))){_0x5e3d9a['limit']=qs[_0x8a3e('0x26')](_0x4fe813[_0x8a3e('0x46')][_0x8a3e('0x26')]);_0x5e3d9a[_0x8a3e('0x24')]=qs[_0x8a3e('0x24')](_0x4fe813[_0x8a3e('0x46')]['offset']);}_0x5e3d9a[_0x8a3e('0x4d')]=qs[_0x8a3e('0x4e')](_0x4fe813[_0x8a3e('0x46')][_0x8a3e('0x4e')]);_0x5e3d9a[_0x8a3e('0x4f')]=qs[_0x8a3e('0x47')](_[_0x8a3e('0xcd')](_0x4fe813['query'],_0x4e4447['filters']));_0x5e3d9a[_0x8a3e('0x4f')][_0x8a3e('0xbd')]=_0x2f1623['id'];if(_0x4fe813['query']['filter']){_0x5e3d9a[_0x8a3e('0x4f')]=_[_0x8a3e('0xa5')](_0x5e3d9a[_0x8a3e('0x4f')],{'$or':_[_0x8a3e('0x35')](_0x5e3d9a[_0x8a3e('0x49')],function(_0x4ac4be){var _0x5c7b41={};_0x5c7b41[_0x4ac4be]={'$like':'%'+_0x4fe813[_0x8a3e('0x46')][_0x8a3e('0x89')]+'%'};return _0x5c7b41;})});}if(_0x4fe813[_0x8a3e('0x46')][_0x8a3e('0xce')]){var _0x2c6373=_0x4fe813['query'][_0x8a3e('0xce')][_0x8a3e('0x6f')](',');var _0x41eaa4={};_0x41eaa4[_0x2c6373[0x0]]={'$gte':moment(_0x2c6373[0x1])['format'](_0x8a3e('0xcf'))};_0x5e3d9a['where']=_[_0x8a3e('0xa5')](_0x5e3d9a[_0x8a3e('0x4f')],_0x41eaa4);}_0x5e3d9a=_[_0x8a3e('0xa5')]({},_0x5e3d9a,_0x4fe813[_0x8a3e('0xc3')]);return db[_0x8a3e('0xc8')][_0x8a3e('0x27')]({'where':_0x5e3d9a[_0x8a3e('0x4f')]})[_0x8a3e('0x2f')](function(_0x1c09cf){_0x175dcc[_0x8a3e('0x27')]=_0x1c09cf;if(_0x4fe813[_0x8a3e('0x46')][_0x8a3e('0xc2')]){_0x5e3d9a[_0x8a3e('0xd0')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x8a3e('0xd1')](_0x5e3d9a);})['then'](function(_0x14ad08){_0x175dcc['rows']=_0x14ad08;return _0x175dcc;});}})[_0x8a3e('0x2f')](respondWithFilteredResult(_0x145265,_0x5e3d9a))[_0x8a3e('0xc0')](handleError(_0x145265,null));};exports[_0x8a3e('0xd2')]=function(_0x2fb873,_0xef1ef4,_0x38fee5){return db['WhatsappInteraction'][_0x8a3e('0x72')]({'where':{'id':_0x2fb873[_0x8a3e('0xc5')]['id']}})[_0x8a3e('0x2f')](handleEntityNotFound(_0xef1ef4,null))[_0x8a3e('0x2f')](function(_0x15540d){if(_0x15540d){return _0x15540d[_0x8a3e('0xd3')](_0x2fb873[_0x8a3e('0x79')][_0x8a3e('0xc9')],_[_0x8a3e('0xca')](_0x2fb873[_0x8a3e('0x79')],['ids','id'])||{})[_0x8a3e('0xd4')](function(){return db[_0x8a3e('0x76')][_0x8a3e('0xd1')]({'attributes':['id','name','color'],'where':{'id':_0x2fb873[_0x8a3e('0x79')][_0x8a3e('0xc9')]}});})[_0x8a3e('0x2f')](function(_0x1828c9){socket[_0x8a3e('0xd5')](_0x8a3e('0xd6'),{'id':Number(_0x2fb873[_0x8a3e('0xc5')]['id']),'tags':_0x1828c9||[]});return{'id':Number(_0x2fb873[_0x8a3e('0xc5')]['id']),'tags':_0x1828c9||[]};});}})[_0x8a3e('0x2f')](respondWithResult(_0xef1ef4,null))[_0x8a3e('0xc0')](handleError(_0xef1ef4,null));};exports[_0x8a3e('0xd7')]=function(_0x4b0832,_0x11da08,_0x3aebad){return db[_0x8a3e('0x41')][_0x8a3e('0x72')]({'where':{'id':_0x4b0832['params']['id']}})[_0x8a3e('0x2f')](handleEntityNotFound(_0x11da08,null))[_0x8a3e('0x2f')](function(_0x395e42){if(_0x395e42){return _0x395e42[_0x8a3e('0xd7')](_0x4b0832['query'][_0x8a3e('0xc9')]);}})['then'](respondWithStatusCode(_0x11da08,null))[_0x8a3e('0xc0')](handleError(_0x11da08,null));};exports[_0x8a3e('0xd8')]=function(_0x15f70a,_0x99272a){var _0x19720e=moment()['unix']()[_0x8a3e('0xa3')]();var _0x29c7bc=path[_0x8a3e('0xd9')](config['root'],_0x8a3e('0xda'),_0x8a3e('0xdb'),_0x8a3e('0xdc'));var _0x1c14e0=path[_0x8a3e('0xd9')](config[_0x8a3e('0xdd')],_0x8a3e('0xda'),_0x8a3e('0xdb'),'attachments');var _0x4ec7df=path[_0x8a3e('0xd9')](_0x29c7bc,_0x19720e);var _0x1ee696=util[_0x8a3e('0xde')](_0x8a3e('0xdf'),_0x15f70a[_0x8a3e('0xc5')]['id'],_0x19720e);var _0x3ae666=path[_0x8a3e('0xd9')](_0x29c7bc,_0x1ee696);var _0x5b8f49=[];_0x5b8f49[_0x8a3e('0xbe')]({'model':db[_0x8a3e('0x78')],'as':'User','attributes':['id',_0x8a3e('0x36')],'raw':!![]});_0x5b8f49['push']({'model':db[_0x8a3e('0xe0')],'as':_0x8a3e('0x6c'),'attributes':['id',_0x8a3e('0xe1'),_0x8a3e('0xe2')],'raw':!![]});if(_0x15f70a[_0x8a3e('0x46')][_0x8a3e('0xe3')]){_0x5b8f49[_0x8a3e('0xbe')]({'model':db['Attachment'],'as':_0x8a3e('0xe4'),'raw':!![]});}var _0x12ec26=[{'model':db[_0x8a3e('0xc8')],'as':_0x8a3e('0xe5'),'attributes':['id',_0x8a3e('0x79'),_0x8a3e('0x7e'),_0x8a3e('0xe6'),_0x8a3e('0xe7'),_0x8a3e('0x83')],'include':_0x5b8f49}];_0x12ec26[_0x8a3e('0xbe')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0x8a3e('0x32')]});_0x12ec26[_0x8a3e('0xbe')]({'model':db[_0x8a3e('0x78')],'as':'Owner','attributes':['id',_0x8a3e('0x36')]});return db[_0x8a3e('0x41')]['find']({'where':{'id':_0x15f70a[_0x8a3e('0xc5')]['id']},'include':_0x12ec26})[_0x8a3e('0x2f')](handleEntityNotFound(_0x99272a,null))[_0x8a3e('0x2f')](function(_0x5eee79){if(_0x5eee79){var _0x5a3e71=_0x5eee79[_0x8a3e('0xe8')]({'plain':!![]});fs[_0x8a3e('0xe9')](_0x4ec7df);var _0x105e82={'channel':'Whatsapp','account':_0x5a3e71[_0x8a3e('0xea')][_0x8a3e('0x32')],'agent':_0x5a3e71[_0x8a3e('0xeb')]?_0x5a3e71[_0x8a3e('0xeb')][_0x8a3e('0x36')]:_0x8a3e('0xec'),'createdAt':moment(_0x5a3e71[_0x8a3e('0x7e')])[_0x8a3e('0xde')](_0x8a3e('0xcf'))[_0x8a3e('0xa3')](),'closedAt':_0x5a3e71['closed']?moment(_0x5a3e71[_0x8a3e('0xed')])[_0x8a3e('0xde')](_0x8a3e('0xcf'))[_0x8a3e('0xa3')]():'','disposition':_0x5a3e71[_0x8a3e('0xee')],'messages':_(_0x5a3e71[_0x8a3e('0xe5')])[_0x8a3e('0x89')]({'secret':![]})[_0x8a3e('0x35')](function(_0xf55ff4){if(_0xf55ff4['Attachment']){var _0x31dc02=path[_0x8a3e('0xd9')](_0x1c14e0,_0xf55ff4[_0x8a3e('0xe4')]['basename']);if(fs[_0x8a3e('0xef')](_0x31dc02)){fs[_0x8a3e('0xf0')](_0x31dc02)[_0x8a3e('0xf1')](fs['createWriteStream'](path[_0x8a3e('0xd9')](_0x4ec7df,_0xf55ff4[_0x8a3e('0xe4')][_0x8a3e('0xf2')])));}}return{'date':moment(_0xf55ff4['createdAt'])[_0x8a3e('0xde')](_0x8a3e('0xcf'))[_0x8a3e('0xa3')](),'sender':_0xf55ff4[_0x8a3e('0xe6')]===_0x8a3e('0xf3')?_0xf55ff4[_0x8a3e('0x78')]?_0xf55ff4[_0x8a3e('0x78')][_0x8a3e('0x36')]:_0x8a3e('0xf4'):_0xf55ff4[_0x8a3e('0x6c')][_0x8a3e('0xe1')]+(_0xf55ff4[_0x8a3e('0x6c')][_0x8a3e('0xe2')]?'\x20'+_0xf55ff4[_0x8a3e('0x6c')][_0x8a3e('0xe2')]:''),'body':_0xf55ff4[_0x8a3e('0xe4')]?_0xf55ff4[_0x8a3e('0xe4')][_0x8a3e('0xf2')]:_0xf55ff4[_0x8a3e('0x79')],'direction':_0xf55ff4[_0x8a3e('0xe6')]==='out'?'A':'C','secret':_0xf55ff4[_0x8a3e('0xe7')],'read':_0xf55ff4[_0x8a3e('0x83')],'attachment':_0xf55ff4[_0x8a3e('0xe4')]};})[_0x8a3e('0x69')]()};return ejs[_0x8a3e('0xf5')](path[_0x8a3e('0xd9')](config[_0x8a3e('0xdd')],_0x8a3e('0xda'),_0x8a3e('0xf6'),_0x8a3e('0xf7')),{'interaction':_0x105e82})['then'](function(_0x568718){var _0x2719cb=path[_0x8a3e('0xd9')](_0x4ec7df,'transcript-'+_0x5a3e71['id']+'-'+_0x19720e+_0x8a3e('0xf8'));var _0x4b2f42={'path':_0x2719cb,'channel':_0x8a3e('0xf9'),'interactionId':_0x5a3e71['id']};return pdf[_0x8a3e('0xfa')](_0x568718,_0x4b2f42);})[_0x8a3e('0x2f')](function(){return new BPromise(function(_0x92a3f8,_0x33dc98){zipdir(_0x4ec7df,{'saveTo':_0x3ae666},function(_0x5429bf,_0x2e1501){if(_0x5429bf)return _0x33dc98(_0x5429bf);return _0x92a3f8(_0x2e1501);});})[_0x8a3e('0x2f')](function(){return new BPromise(function(_0x3e8540,_0x2d06fc){rimraf(_0x4ec7df,function(_0x4c2a17){if(_0x4c2a17)_0x2d06fc(_0x4c2a17);return _0x3e8540();});});})[_0x8a3e('0x2f')](function(){return _0x99272a[_0x8a3e('0xd8')](_0x3ae666,_0x1ee696,function(_0x3a619e){if(_0x3a619e){console['log'](_0x8a3e('0xfb'),_0x3a619e);}else{fs[_0x8a3e('0xfc')](_0x3ae666);}});});});}else{return _0x99272a['sendStatus'](0xc8);}})[_0x8a3e('0xc0')](handleError(_0x99272a,null));}; \ No newline at end of file +var _0x988c=['tools_tags','select','u.fullname','ui.WhatsappInteractionId','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','Tag','forEach','union','start','body','keys','some','compact','WhatsappAccountId','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','unreadMessages','order','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','merge','WhatsappInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','rows','includeAll','options','create','params','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','pick','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','omit','spread','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','CmContact','Contact','firstName','Attachment','Messages','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closedAt','disposition','basename','existsSync','createReadStream','pipe','out','System','lastName','direction','secret','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','eml-format','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','waiting','talking','unmanaged','total','closed','UserId','index','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','sort','where','field','color','from'];(function(_0x2a894c,_0x418da3){var _0x159fe8=function(_0x408c0c){while(--_0x408c0c){_0x2a894c['push'](_0x2a894c['shift']());}};_0x159fe8(++_0x418da3);}(_0x988c,0x19e));var _0xc988=function(_0x2469eb,_0x5024fa){_0x2469eb=_0x2469eb-0x0;var _0x5dc202=_0x988c[_0x2469eb];return _0x5dc202;};'use strict';var emlformat=require(_0xc988('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc988('0x1'));var moment=require(_0xc988('0x2'));var BPromise=require(_0xc988('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc988('0x4'));var csv=require(_0xc988('0x5'));var ejs=require(_0xc988('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc988('0x7'));var squel=require(_0xc988('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc988('0x9'));var toCsv=require(_0xc988('0x5'));var querystring=require(_0xc988('0xa'));var Papa=require(_0xc988('0xb'));var Redis=require(_0xc988('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xc988('0xd'));var as=require(_0xc988('0xe'));var pdf=require(_0xc988('0xf'));var hardwareService=require(_0xc988('0x10'));var logger=require(_0xc988('0x11'))('api');var utils=require(_0xc988('0x12'));var config=require(_0xc988('0x13'));var licenseUtil=require(_0xc988('0x14'));var db=require('../../mysqldb')['db'];config[_0xc988('0x15')]=_['defaults'](config[_0xc988('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xc988('0x16'))(new Redis(config[_0xc988('0x15')]));require(_0xc988('0x17'))[_0xc988('0x18')](socket);function respondWithStatusCode(_0x5dbfbf,_0x25c583){_0x25c583=_0x25c583||0xcc;return function(_0x35c0b4){if(_0x35c0b4){return _0x5dbfbf[_0xc988('0x19')](_0x25c583);}return _0x5dbfbf[_0xc988('0x1a')](_0x25c583)[_0xc988('0x1b')]();};}function respondWithResult(_0x24a096,_0xcb99f9){_0xcb99f9=_0xcb99f9||0xc8;return function(_0x35aebb){if(_0x35aebb){return _0x24a096[_0xc988('0x1a')](_0xcb99f9)[_0xc988('0x1c')](_0x35aebb);}};}function respondWithFilteredResult(_0xd27863,_0x49738a){return function(_0x314a24){if(_0x314a24){var _0x23677f=typeof _0x49738a[_0xc988('0x1d')]===_0xc988('0x1e')&&typeof _0x49738a[_0xc988('0x1f')]==='undefined';var _0x5d1c5f=_0x314a24[_0xc988('0x20')];var _0x47f438=_0x23677f?0x0:_0x49738a[_0xc988('0x1d')];var _0x3cad71=_0x23677f?_0x314a24['count']:_0x49738a['offset']+_0x49738a[_0xc988('0x1f')];var _0x304a30;if(_0x3cad71>=_0x5d1c5f){_0x3cad71=_0x5d1c5f;_0x304a30=0xc8;}else{_0x304a30=0xce;}_0xd27863[_0xc988('0x1a')](_0x304a30);return _0xd27863['set'](_0xc988('0x21'),_0x47f438+'-'+_0x3cad71+'/'+_0x5d1c5f)[_0xc988('0x1c')](_0x314a24);}return null;};}function patchUpdates(_0x32ea75){return function(_0x49fe1c){try{jsonpatch[_0xc988('0x22')](_0x49fe1c,_0x32ea75,!![]);}catch(_0xc57267){return BPromise[_0xc988('0x23')](_0xc57267);}return _0x49fe1c['save']();};}function saveUpdates(_0x5444a5,_0x343ac3){return function(_0x3ca571){if(_0x3ca571){return _0x3ca571[_0xc988('0x24')](_0x5444a5)[_0xc988('0x25')](function(_0x155c8e){return _0x155c8e;});}return null;};}function removeEntity(_0x3adb60,_0x176741){return function(_0xfb2eb4){if(_0xfb2eb4){return _0xfb2eb4['destroy']()[_0xc988('0x25')](function(){_0x3adb60[_0xc988('0x1a')](0xcc)[_0xc988('0x1b')]();});}};}function handleEntityNotFound(_0x3f8b9a,_0x38bcee){return function(_0x1c9d07){if(!_0x1c9d07){_0x3f8b9a[_0xc988('0x19')](0x194);}return _0x1c9d07;};}function handleError(_0xd97eff,_0x495b1a){_0x495b1a=_0x495b1a||0x1f4;return function(_0x2a0d6f){logger[_0xc988('0x26')](_0x2a0d6f[_0xc988('0x27')]);if(_0x2a0d6f[_0xc988('0x28')]){delete _0x2a0d6f['name'];}_0xd97eff['status'](_0x495b1a)[_0xc988('0x29')](_0x2a0d6f);};}function getInteractionUsers(_0x11d51f,_0x20aaab){return new BPromise(function(_0x4b954a,_0x117ec8){try{if(_0x20aaab[_0x11d51f['id']]){_0x11d51f[_0xc988('0x2a')]=_[_0xc988('0x2b')](_0x20aaab[_0x11d51f['id']],function(_0x467bd4){return{'id':_0x467bd4['id'],'fullname':_0x467bd4[_0xc988('0x2c')]};});}}catch(_0x34da97){_0x117ec8(_0x34da97);}_0x4b954a(_0x11d51f);});}function getInteractionTags(_0x3a798f,_0x1344db){return new BPromise(function(_0x3a5fe7,_0x2d1cfc){try{if(_0x3a798f[_0xc988('0x2d')]){_0x3a798f[_0xc988('0x2e')]=[];_0x3a798f[_0xc988('0x2d')][_0xc988('0x2f')](',')['forEach'](function(_0x5aa8fe){_0x3a798f[_0xc988('0x2e')][_0xc988('0x30')](_0x1344db[_0x5aa8fe]);});}delete _0x3a798f['TagIds'];}catch(_0x10e73e){_0x2d1cfc(_0x10e73e);}_0x3a5fe7(_0x3a798f);});}function updateWhatsappInteraction(_0x10b0f9,_0x5b003f,_0x1d26ea){return new BPromise(function(_0x284ce5,_0x1f7bf9){return getInteractionUsers(_0x10b0f9,_0x1d26ea)['then'](function(_0x5d11fc){return getInteractionTags(_0x5d11fc,_0x5b003f);})[_0xc988('0x25')](function(_0x34fbe6){return getStateInteraction(_0x34fbe6);})[_0xc988('0x25')](function(_0x2c105c){_0x284ce5(_0x2c105c);})[_0xc988('0x31')](function(_0x627095){_0x1f7bf9(_0x627095);});});}function getStateInteraction(_0x1bdeb5){return new BPromise(function(_0x17ff79){_0x1bdeb5[_0xc988('0x32')]=0x0;_0x1bdeb5[_0xc988('0x33')]=0x0;_0x1bdeb5['answered']=0x0;_0x1bdeb5[_0xc988('0x34')]=0x0;_0x1bdeb5[_0xc988('0x35')]=0x0;if(!_0x1bdeb5[_0xc988('0x36')]&&!_0x1bdeb5['UserId']){_0x1bdeb5[_0xc988('0x32')]+=0x1;}if(!_0x1bdeb5[_0xc988('0x36')]&&_0x1bdeb5['UserId']){_0x1bdeb5[_0xc988('0x33')]+=0x1;if(_0x1bdeb5[_0xc988('0x32')]){_0x1bdeb5['waiting']-=0x1;}}if(_0x1bdeb5[_0xc988('0x36')]&&_0x1bdeb5[_0xc988('0x37')]){_0x1bdeb5['answered']+=0x1;if(_0x1bdeb5[_0xc988('0x33')]){_0x1bdeb5[_0xc988('0x33')]-=0x1;}}if(_0x1bdeb5[_0xc988('0x36')]&&!_0x1bdeb5['UserId']){_0x1bdeb5[_0xc988('0x34')]+=0x1;if(_0x1bdeb5[_0xc988('0x32')]){_0x1bdeb5['waiting']-=0x1;}}_0x1bdeb5[_0xc988('0x35')]+=0x1;_0x17ff79(_0x1bdeb5);});}exports[_0xc988('0x38')]=function(_0x4cefe6,_0x20cadd){var _0x3a1617={},_0x2ec03d={},_0xa996f7={'count':0x0,'rows':[]};var _0x43c71e=_[_0xc988('0x2b')](db['WhatsappInteraction'][_0xc988('0x39')],function(_0x4a67bd){return{'name':_0x4a67bd[_0xc988('0x3a')],'type':_0x4a67bd[_0xc988('0x3b')]['key']};});_0x2ec03d[_0xc988('0x3c')]=_[_0xc988('0x2b')](_0x43c71e,_0xc988('0x28'));_0x2ec03d['query']=_['keys'](_0x4cefe6[_0xc988('0x3d')]);_0x2ec03d[_0xc988('0x3e')]=_[_0xc988('0x3f')](_0x2ec03d[_0xc988('0x3c')],_0x2ec03d[_0xc988('0x3d')]);_0x3a1617[_0xc988('0x40')]=_[_0xc988('0x3f')](_0x2ec03d[_0xc988('0x3c')],qs['fields'](_0x4cefe6[_0xc988('0x3d')][_0xc988('0x41')]));_0x3a1617[_0xc988('0x40')]=_0x3a1617[_0xc988('0x40')][_0xc988('0x42')]?_0x3a1617[_0xc988('0x40')]:_0x2ec03d[_0xc988('0x3c')];if(!_0x4cefe6['query']['hasOwnProperty']('nolimit')){_0x3a1617[_0xc988('0x1f')]=qs['limit'](_0x4cefe6[_0xc988('0x3d')][_0xc988('0x1f')]);_0x3a1617[_0xc988('0x1d')]=qs[_0xc988('0x1d')](_0x4cefe6[_0xc988('0x3d')][_0xc988('0x1d')]);}_0x3a1617['order']=qs[_0xc988('0x43')](_0x4cefe6[_0xc988('0x3d')][_0xc988('0x43')]);_0x3a1617[_0xc988('0x44')]=qs[_0xc988('0x3e')](_['pick'](_0x4cefe6[_0xc988('0x3d')],_0x2ec03d['filters']),_0x43c71e);var _0x24674a=[];var _0x15c0a9=squel['select']()['field']('id')[_0xc988('0x45')](_0xc988('0x28'))[_0xc988('0x45')](_0xc988('0x46'))[_0xc988('0x47')](_0xc988('0x48'));var _0x4e3f00=squel[_0xc988('0x49')]()[_0xc988('0x45')]('u.id')[_0xc988('0x45')](_0xc988('0x4a'))[_0xc988('0x45')](_0xc988('0x4b'))[_0xc988('0x47')]('user_has_whatsapp_interactions','ui')['left_join'](_0xc988('0x4c'),'u',_0xc988('0x4d'));var _0x2dfb6d=squel['select']()[_0xc988('0x47')](_0xc988('0x4e'),'i')[_0xc988('0x4f')](_0xc988('0x50'),'c',_0xc988('0x51'))[_0xc988('0x4f')](_0xc988('0x4c'),'o',_0xc988('0x52'))['left_join'](_0xc988('0x53'),'a',_0xc988('0x54'))[_0xc988('0x4f')](_0xc988('0x55'),'me',_0xc988('0x56'))['left_join'](_0xc988('0x57'),'it',_0xc988('0x58'))[_0xc988('0x4f')](_0xc988('0x48'),'t',_0xc988('0x59'));var _0x264dbf=squel[_0xc988('0x5a')]();var _0x513f59=[];var _0x40e033=squel[_0xc988('0x5a')]();var _0x509c93;if(_0x4cefe6['query']['search']){_0x509c93=as[_0xc988('0x5b')](_0x4cefe6['query'][_0xc988('0x5c')]);var _0x9f2344=_0x509c93[_0xc988('0x5d')];for(var _0x2ea91f=0x0;_0x2ea91f<_0x509c93[_0xc988('0x5e')][_0xc988('0x42')];_0x2ea91f++){var _0x31016e=_0x509c93[_0xc988('0x5e')][_0x2ea91f];var _0x536b72='i';var _0x452c75=_['find'](_0x43c71e,['name',_0x31016e[_0xc988('0x45')]]);if(!_0x452c75){switch(_0x31016e[_0xc988('0x45')]){case'unreadMessages':if(_0x31016e[_0xc988('0x5f')]==0x1){_0x2dfb6d[_0xc988('0x60')]('`'+_0x31016e[_0xc988('0x45')]+'`\x20=\x200');}else{_0x2dfb6d['having']('`'+_0x31016e[_0xc988('0x45')]+_0xc988('0x61'));}break;case'Contact':if(_0x31016e[_0xc988('0x62')]===_0xc988('0x63')){if(_0x31016e[_0xc988('0x5f')][_0xc988('0x2f')]('\x20')[_0xc988('0x42')]>0x1){_0x264dbf[_0x9f2344](_0xc988('0x64'),qs[_0xc988('0x65')](_0x31016e[_0xc988('0x5f')]),null);}else{var _0x3eeff5='%'+_0x31016e[_0xc988('0x5f')]+'%';_0x264dbf[_0x9f2344](_0xc988('0x66'),_0x3eeff5,_0x3eeff5,_0x3eeff5);}}else{_0x452c75=_[_0xc988('0x67')](_0x43c71e,[_0xc988('0x28'),_0xc988('0x68')]);_0x31016e['field']='ContactId';_0x12c40c=as[_0xc988('0x69')](_0x536b72,_0x452c75[_0xc988('0x3b')],_0x31016e);_0x264dbf[_0x9f2344](_0x12c40c[_0xc988('0x6a')],_0x12c40c[_0xc988('0x5f')]['start'],_0x12c40c[_0xc988('0x5f')][_0xc988('0x1b')]);}break;case _0xc988('0x6b'):var _0xcbb427=_0x31016e[_0xc988('0x5f')][_0xc988('0x2f')](',')[_0xc988('0x2b')](function(_0x5d0704){return Number(_0x5d0704);});_0xcbb427[_0xc988('0x6c')](function(_0x329741){_0x40e033['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x329741+',%');});_0x513f59=_[_0xc988('0x6d')](_0x513f59,_0xcbb427);break;case'User':if(_0x31016e[_0xc988('0x62')]===_0xc988('0x63')){_0x264dbf[_0x9f2344]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x31016e[_0xc988('0x5f')]+'%',null);}else{_0x452c75=_[_0xc988('0x67')](_0x43c71e,[_0xc988('0x28'),_0xc988('0x37')]);_0x31016e[_0xc988('0x45')]=_0xc988('0x37');_0x12c40c=as[_0xc988('0x69')](_0x536b72,_0x452c75[_0xc988('0x3b')],_0x31016e);_0x264dbf[_0x9f2344](_0x12c40c[_0xc988('0x6a')],_0x12c40c[_0xc988('0x5f')][_0xc988('0x6e')],_0x12c40c[_0xc988('0x5f')][_0xc988('0x1b')]);}break;case _0xc988('0x6f'):_0x12c40c=as[_0xc988('0x69')]('me',null,_0x31016e);_0x264dbf[_0x9f2344](_0x12c40c[_0xc988('0x6a')],_0x12c40c['value'][_0xc988('0x6e')],_0x12c40c[_0xc988('0x5f')][_0xc988('0x1b')]);break;}}else{var _0x12c40c=as[_0xc988('0x69')](_0x536b72,_0x452c75[_0xc988('0x3b')],_0x31016e);_0x264dbf[_0x9f2344](_0x12c40c[_0xc988('0x6a')],_0x12c40c[_0xc988('0x5f')][_0xc988('0x6e')],_0x12c40c[_0xc988('0x5f')][_0xc988('0x1b')]);}}}else{var _0x102524=_(_0x4cefe6[_0xc988('0x3d')])[_0xc988('0x70')]()['map'](function(_0x480d68){return _[_0xc988('0x71')](_0x43c71e,['name',_0x480d68])?_0x480d68:undefined;})[_0xc988('0x72')]()[_0xc988('0x5f')]();if(!_['isEmpty'](_0x102524)){_0x102524[_0xc988('0x6c')](function(_0x58b27b){if(_0x58b27b===_0xc988('0x73')){_0x2dfb6d[_0xc988('0x44')]('i.WhatsappAccountId\x20IN\x20?',[]['concat'](_0x4cefe6[_0xc988('0x3d')][_0x58b27b]));}else if(_0x58b27b===_0xc988('0x74')){var _0x3fb173=JSON[_0xc988('0x75')](_0x4cefe6[_0xc988('0x3d')][_0x58b27b])[_0xc988('0x76')];var _0x121eba=JSON[_0xc988('0x75')](_0x4cefe6['query'][_0x58b27b])[_0xc988('0x77')];_0x2dfb6d[_0xc988('0x44')](_0xc988('0x78'),_0x3fb173,_0x121eba);}else{if(_0x4cefe6[_0xc988('0x3d')][_0x58b27b]===_0xc988('0x79')){_0x2dfb6d[_0xc988('0x44')]('i.'+_0x58b27b+'\x20IS\x20NULL');}else{_0x2dfb6d['where']('i.'+_0x58b27b+_0xc988('0x7a'),_0x4cefe6['query'][_0x58b27b]);}}});}if(_0x4cefe6[_0xc988('0x3d')]['read']){if(_0x4cefe6[_0xc988('0x3d')][_0xc988('0x7b')]==0x1){_0x2dfb6d[_0xc988('0x60')]('`unreadMessages`\x20=\x200');}else{_0x2dfb6d[_0xc988('0x60')](_0xc988('0x7c'));}}if(_0x4cefe6[_0xc988('0x3d')][_0xc988('0x7d')]){_0x513f59=_[_0xc988('0x7e')](_0x4cefe6['query'][_0xc988('0x7d')])?_0x4cefe6[_0xc988('0x3d')][_0xc988('0x7d')]:new Array(_0x4cefe6['query'][_0xc988('0x7d')]);_0x513f59['forEach'](function(_0xd013c0){_0x40e033['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xd013c0+',%');});}if(_0x4cefe6[_0xc988('0x3d')][_0xc988('0x7f')]){var _0x5df930=_0x4cefe6['query'][_0xc988('0x7f')][_0xc988('0x80')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xc988('0x81')](_0x5df930)){_0x264dbf['or']('i.id\x20LIKE\x20?',_0x5df930+'%')['or'](_0xc988('0x82'),_0x5df930+'%');}else{_0x264dbf['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc988('0x65')](_0x5df930))['or'](_0xc988('0x83'),_0x5df930+'%');}}}_0x2dfb6d[_0xc988('0x44')](_0x264dbf);_0x2dfb6d[_0xc988('0x84')](_0xc988('0x85'));var _0x3f379e={'type':db['Sequelize'][_0xc988('0x86')]['SELECT'],'raw':!![]};var _0x29bbf0=_0x2dfb6d[_0xc988('0x87')]();_0x29bbf0[_0xc988('0x45')](_0xc988('0x85'));_0x29bbf0[_0xc988('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc988('0x88'));if(_0x3a1617[_0xc988('0x89')]){_0x3a1617[_0xc988('0x89')]['forEach'](function(_0x5b1da8){var _0x4b09b7=_0x5b1da8[0x0]===_0xc988('0x8a')?_0x5b1da8[0x0]:'i.'+_0x5b1da8[0x0];_0x2dfb6d[_0xc988('0x89')](_0x4b09b7,_0x5b1da8[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc988('0x8b')](_0x513f59)){_0x2dfb6d[_0xc988('0x60')](_0x40e033);_0x29bbf0['where'](_0xc988('0x8c'),_0x513f59);}BPromise[_0xc988('0x8d')]()[_0xc988('0x25')](function(){if(!_0x509c93){if(_0x4cefe6['query']['WhatsappAccountId'])return;_0x29bbf0[_0xc988('0x44')](_0xc988('0x8e'));_0x2dfb6d[_0xc988('0x44')](_0xc988('0x8e'));return;}if(_0x4cefe6[_0xc988('0x8f')][_0xc988('0x90')]!=='agent')return;return _0x4cefe6[_0xc988('0x8f')][_0xc988('0x91')]({'attributes':['id'],'raw':!![]})['then'](function(_0x176905){if(_[_0xc988('0x8b')](_0x176905)){_0x29bbf0['where'](_0xc988('0x92'));_0x2dfb6d['where']('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x29bbf0['where'](_0xc988('0x93'),_['map'](_0x176905,'id'));_0x2dfb6d[_0xc988('0x44')](_0xc988('0x93'),_['map'](_0x176905,'id'));}});})['then'](function(){if(_0x4cefe6[_0xc988('0x8f')][_0xc988('0x90')]===_0xc988('0x94')&&!_0x509c93&&!_0x4cefe6['query'][_0xc988('0x73')])return[];return db[_0xc988('0x95')][_0xc988('0x3d')](_0x29bbf0[_0xc988('0x96')](),_0x3f379e);})[_0xc988('0x25')](function(_0x120343){_0xa996f7[_0xc988('0x20')]=_0x120343[_0xc988('0x42')];if(_0xa996f7['count']===0x0)return[];return db[_0xc988('0x95')][_0xc988('0x3d')](_0x15c0a9[_0xc988('0x96')](),_0x3f379e)[_0xc988('0x25')](function(_0x54ff0d){_0x24674a=_[_0xc988('0x97')](_0x54ff0d,'id');_0x3f379e=_[_0xc988('0x98')](_0x3f379e,{'model':db[_0xc988('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4cefe6['query']['fields']){_0x3a1617[_0xc988('0x40')][_0xc988('0x6c')](function(_0x3bede2){_0x2dfb6d[_0xc988('0x45')]('i.'+_0x3bede2);});}else{_0x2dfb6d[_0xc988('0x45')](_0xc988('0x9a'),_0xc988('0x88'));_0x2dfb6d[_0xc988('0x45')](_0xc988('0x9b'),_0xc988('0x9c'));_0x2dfb6d['field'](_0xc988('0x9d'),_0xc988('0x9e'));_0x2dfb6d[_0xc988('0x45')](_0xc988('0x9f'),'contactName');_0x2dfb6d[_0xc988('0x45')](_0xc988('0xa0'));_0x2dfb6d['field'](_0xc988('0xa1'),_0xc988('0xa2'));_0x2dfb6d[_0xc988('0x45')](_0xc988('0xa3'),_0xc988('0xa4'));_0x2dfb6d[_0xc988('0x45')](_0xc988('0xa5'),_0xc988('0xa6'));_0x2dfb6d['field'](_0xc988('0xa7'),_0xc988('0xa8'));_0x2dfb6d[_0xc988('0x45')](_0xc988('0xa9'),_0xc988('0xaa'));_0x2dfb6d['field'](_0xc988('0xab'),_0xc988('0xac'));_0x2dfb6d[_0xc988('0x45')]('o.fullname',_0xc988('0xad'));_0x2dfb6d[_0xc988('0x45')](_0xc988('0xae'),_0xc988('0xaf'));_0x2dfb6d['field'](_0xc988('0xb0'),_0xc988('0x2d'));}if(_0x3a1617['limit'])_0x2dfb6d[_0xc988('0x1f')](_0x3a1617[_0xc988('0x1f')]);if(_0x3a1617[_0xc988('0x1d')])_0x2dfb6d[_0xc988('0x1d')](_0x3a1617['offset']);return db[_0xc988('0x95')][_0xc988('0x3d')](_0x2dfb6d[_0xc988('0x96')](),_0x3f379e);})[_0xc988('0x25')](function(_0x5e6f15){if(_0x5e6f15[_0xc988('0x42')]>0x0)_0x4e3f00[_0xc988('0x44')](_0xc988('0xb1'),_[_0xc988('0x2b')](_0x5e6f15,'id'));return db[_0xc988('0x95')][_0xc988('0x3d')](_0x4e3f00[_0xc988('0x96')](),_0x3f379e)[_0xc988('0x25')](function(_0x592f73){var _0x2d7c96=_[_0xc988('0xb2')](_0x592f73,_0xc988('0xb3'));var _0xb32d5c=[];_0x5e6f15['forEach'](function(_0x2b4e43){_0xb32d5c[_0xc988('0x30')](updateWhatsappInteraction(_0x2b4e43,_0x24674a,_0x2d7c96));});return BPromise['all'](_0xb32d5c);});});})[_0xc988('0x25')](function(_0x165553){_0xa996f7[_0xc988('0xb4')]=_0x165553;return _0xa996f7;})[_0xc988('0x25')](respondWithFilteredResult(_0x20cadd,_0x3a1617))[_0xc988('0x31')](handleError(_0x20cadd,null));};exports['show']=function(_0x3e21e2,_0x15ed88){var _0x2a2ed2={'raw':![],'where':{'id':_0x3e21e2['params']['id']}},_0x322e86={};_0x322e86[_0xc988('0x3c')]=_[_0xc988('0x70')](db['WhatsappInteraction']['rawAttributes']);_0x322e86[_0xc988('0x3d')]=_['keys'](_0x3e21e2['query']);_0x322e86[_0xc988('0x3e')]=_[_0xc988('0x3f')](_0x322e86['model'],_0x322e86[_0xc988('0x3d')]);_0x2a2ed2[_0xc988('0x40')]=_[_0xc988('0x3f')](_0x322e86[_0xc988('0x3c')],qs['fields'](_0x3e21e2[_0xc988('0x3d')][_0xc988('0x41')]));_0x2a2ed2['attributes']=_0x2a2ed2[_0xc988('0x40')][_0xc988('0x42')]?_0x2a2ed2[_0xc988('0x40')]:_0x322e86['model'];if(_0x3e21e2['query'][_0xc988('0xb5')]){_0x2a2ed2['include']=[{'all':!![]}];}_0x2a2ed2=_[_0xc988('0x98')]({},_0x2a2ed2,_0x3e21e2[_0xc988('0xb6')]);return db['WhatsappInteraction'][_0xc988('0x67')](_0x2a2ed2)[_0xc988('0x25')](handleEntityNotFound(_0x15ed88,null))[_0xc988('0x25')](respondWithResult(_0x15ed88,null))[_0xc988('0x31')](handleError(_0x15ed88,null));};exports[_0xc988('0xb7')]=function(_0x25492c,_0x12070e){return db['WhatsappInteraction'][_0xc988('0xb7')](_0x25492c[_0xc988('0x6f')],{})[_0xc988('0x25')](respondWithResult(_0x12070e,0xc9))[_0xc988('0x31')](handleError(_0x12070e,null));};exports[_0xc988('0x24')]=function(_0x2befd8,_0x68235){if(_0x2befd8[_0xc988('0x6f')]['id']){delete _0x2befd8['body']['id'];}return db['WhatsappInteraction'][_0xc988('0x67')]({'where':{'id':_0x2befd8[_0xc988('0xb8')]['id']}})[_0xc988('0x25')](handleEntityNotFound(_0x68235,null))[_0xc988('0x25')](saveUpdates(_0x2befd8['body'],null))[_0xc988('0x25')](respondWithResult(_0x68235,null))[_0xc988('0x31')](handleError(_0x68235,null));};exports['destroy']=function(_0xf652f4,_0x255c0d){return db[_0xc988('0x99')][_0xc988('0x67')]({'where':{'id':_0xf652f4[_0xc988('0xb8')]['id']}})['then'](handleEntityNotFound(_0x255c0d,null))['then'](removeEntity(_0x255c0d,null))[_0xc988('0x31')](handleError(_0x255c0d,null));};exports[_0xc988('0xb9')]=function(_0x5dba4b,_0x3f6441){return db[_0xc988('0x99')][_0xc988('0xb9')]()[_0xc988('0x25')](respondWithResult(_0x3f6441,null))['catch'](handleError(_0x3f6441,null));};exports[_0xc988('0xba')]=function(_0x39474f,_0x1fd584,_0x154b6b){return db[_0xc988('0xbb')]['find']({'where':{'id':_0x39474f['params']['id']}})[_0xc988('0x25')](handleEntityNotFound(_0x1fd584,null))[_0xc988('0x25')](function(_0x1a93e2){if(_0x1a93e2){return _0x1a93e2[_0xc988('0xba')](_0x39474f[_0xc988('0x6f')]['ids'],_['omit'](_0x39474f[_0xc988('0x6f')],[_0xc988('0xbc'),'id'])||{});}})['then'](respondWithResult(_0x1fd584,null))[_0xc988('0x31')](handleError(_0x1fd584,null));};exports[_0xc988('0xbd')]=function(_0x351992,_0x50422c,_0x3fd433){var _0x2736d2={'raw':![],'where':{}};var _0x3623f7={};var _0x46ae94={'count':0x0,'rows':[]};return db[_0xc988('0x99')][_0xc988('0xbe')]({'where':{'id':_0x351992['params']['id']}})[_0xc988('0x25')](handleEntityNotFound(_0x50422c,null))['then'](function(_0x38cad3){if(_0x38cad3){_0x3623f7[_0xc988('0x3c')]=_[_0xc988('0x70')](db[_0xc988('0xbb')][_0xc988('0x39')]);_0x3623f7[_0xc988('0x3d')]=_[_0xc988('0x70')](_0x351992[_0xc988('0x3d')]);_0x3623f7['filters']=_[_0xc988('0x3f')](_0x3623f7[_0xc988('0x3c')],_0x3623f7[_0xc988('0x3d')]);_0x2736d2['attributes']=_['intersection'](_0x3623f7[_0xc988('0x3c')],qs[_0xc988('0x41')](_0x351992['query'][_0xc988('0x41')]));_0x2736d2[_0xc988('0x40')]=_0x2736d2['attributes'][_0xc988('0x42')]?_0x2736d2[_0xc988('0x40')]:_0x3623f7['model'];if(!_0x351992[_0xc988('0x3d')][_0xc988('0xbf')](_0xc988('0xc0'))){_0x2736d2[_0xc988('0x1f')]=qs[_0xc988('0x1f')](_0x351992[_0xc988('0x3d')][_0xc988('0x1f')]);_0x2736d2[_0xc988('0x1d')]=qs[_0xc988('0x1d')](_0x351992[_0xc988('0x3d')][_0xc988('0x1d')]);}_0x2736d2[_0xc988('0x89')]=qs[_0xc988('0x43')](_0x351992[_0xc988('0x3d')][_0xc988('0x43')]);_0x2736d2['where']=qs[_0xc988('0x3e')](_[_0xc988('0xc1')](_0x351992[_0xc988('0x3d')],_0x3623f7[_0xc988('0x3e')]));_0x2736d2[_0xc988('0x44')][_0xc988('0xb3')]=_0x38cad3['id'];if(_0x351992[_0xc988('0x3d')][_0xc988('0x7f')]){_0x2736d2[_0xc988('0x44')]=_[_0xc988('0x98')](_0x2736d2[_0xc988('0x44')],{'$or':_[_0xc988('0x2b')](_0x2736d2[_0xc988('0x40')],function(_0xfe6fdb){var _0xfb36d5={};_0xfb36d5[_0xfe6fdb]={'$like':'%'+_0x351992[_0xc988('0x3d')][_0xc988('0x7f')]+'%'};return _0xfb36d5;})});}if(_0x351992['query'][_0xc988('0x76')]){var _0x1dd28=_0x351992[_0xc988('0x3d')][_0xc988('0x76')][_0xc988('0x2f')](',');var _0x2fdb56={};_0x2fdb56[_0x1dd28[0x0]]={'$gte':moment(_0x1dd28[0x1])[_0xc988('0xc2')](_0xc988('0xc3'))};_0x2736d2[_0xc988('0x44')]=_['merge'](_0x2736d2[_0xc988('0x44')],_0x2fdb56);}_0x2736d2=_[_0xc988('0x98')]({},_0x2736d2,_0x351992['options']);return db[_0xc988('0xbb')][_0xc988('0x20')]({'where':_0x2736d2['where']})['then'](function(_0x135f58){_0x46ae94[_0xc988('0x20')]=_0x135f58;if(_0x351992[_0xc988('0x3d')][_0xc988('0xb5')]){_0x2736d2[_0xc988('0xc4')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xc988('0xc5')](_0x2736d2);})['then'](function(_0x2c299c){_0x46ae94[_0xc988('0xb4')]=_0x2c299c;return _0x46ae94;});}})[_0xc988('0x25')](respondWithFilteredResult(_0x50422c,_0x2736d2))[_0xc988('0x31')](handleError(_0x50422c,null));};exports[_0xc988('0xc6')]=function(_0x8579a9,_0x50ddfa,_0x57484f){return db[_0xc988('0x99')][_0xc988('0x67')]({'where':{'id':_0x8579a9['params']['id']}})[_0xc988('0x25')](handleEntityNotFound(_0x50ddfa,null))['then'](function(_0x20286c){if(_0x20286c){return _0x20286c[_0xc988('0xc7')](_0x8579a9[_0xc988('0x6f')][_0xc988('0xbc')],_[_0xc988('0xc8')](_0x8579a9[_0xc988('0x6f')],[_0xc988('0xbc'),'id'])||{})[_0xc988('0xc9')](function(){return db[_0xc988('0x6b')]['findAll']({'attributes':['id',_0xc988('0x28'),_0xc988('0x46')],'where':{'id':_0x8579a9[_0xc988('0x6f')][_0xc988('0xbc')]}});})[_0xc988('0x25')](function(_0x503dc0){socket['emit'](_0xc988('0xca'),{'id':Number(_0x8579a9[_0xc988('0xb8')]['id']),'tags':_0x503dc0||[]});return{'id':Number(_0x8579a9[_0xc988('0xb8')]['id']),'tags':_0x503dc0||[]};});}})[_0xc988('0x25')](respondWithResult(_0x50ddfa,null))[_0xc988('0x31')](handleError(_0x50ddfa,null));};exports[_0xc988('0xcb')]=function(_0x3d2d79,_0x543536,_0x3b66e2){return db['WhatsappInteraction'][_0xc988('0x67')]({'where':{'id':_0x3d2d79[_0xc988('0xb8')]['id']}})['then'](handleEntityNotFound(_0x543536,null))[_0xc988('0x25')](function(_0x30f1c7){if(_0x30f1c7){return _0x30f1c7[_0xc988('0xcb')](_0x3d2d79[_0xc988('0x3d')][_0xc988('0xbc')]);}})[_0xc988('0x25')](respondWithStatusCode(_0x543536,null))[_0xc988('0x31')](handleError(_0x543536,null));};exports[_0xc988('0xcc')]=function(_0x5efafd,_0xa617e){var _0x5e451c=moment()[_0xc988('0xcd')]()[_0xc988('0x96')]();var _0x3cd208=path[_0xc988('0xce')](config[_0xc988('0xcf')],_0xc988('0xd0'),_0xc988('0xd1'),_0xc988('0xd2'));var _0x92c32c=path[_0xc988('0xce')](config[_0xc988('0xcf')],_0xc988('0xd0'),'files',_0xc988('0xd3'));var _0x379afe=path[_0xc988('0xce')](_0x3cd208,_0x5e451c);var _0x1aae72=util['format'](_0xc988('0xd4'),_0x5efafd[_0xc988('0xb8')]['id'],_0x5e451c);var _0xc58fb6=path['join'](_0x3cd208,_0x1aae72);var _0x1d867e=[];_0x1d867e[_0xc988('0x30')]({'model':db[_0xc988('0xd5')],'as':_0xc988('0xd5'),'attributes':['id',_0xc988('0x2c')],'raw':!![]});_0x1d867e[_0xc988('0x30')]({'model':db[_0xc988('0xd6')],'as':_0xc988('0xd7'),'attributes':['id',_0xc988('0xd8'),'lastName'],'raw':!![]});if(_0x5efafd[_0xc988('0x3d')][_0xc988('0xd3')]){_0x1d867e[_0xc988('0x30')]({'model':db[_0xc988('0xd9')],'as':_0xc988('0xd9'),'raw':!![]});}var _0x32986e=[{'model':db[_0xc988('0xbb')],'as':_0xc988('0xda'),'attributes':['id',_0xc988('0x6f'),_0xc988('0x74'),'direction','secret',_0xc988('0x7b')],'include':_0x1d867e}];_0x32986e['push']({'model':db[_0xc988('0xdb')],'as':_0xc988('0xdc'),'attributes':['id','name']});_0x32986e[_0xc988('0x30')]({'model':db[_0xc988('0xd5')],'as':_0xc988('0xdd'),'attributes':['id',_0xc988('0x2c')]});return db[_0xc988('0x99')][_0xc988('0x67')]({'where':{'id':_0x5efafd[_0xc988('0xb8')]['id']},'include':_0x32986e})[_0xc988('0x25')](handleEntityNotFound(_0xa617e,null))[_0xc988('0x25')](function(_0xbaf650){if(_0xbaf650){var _0xfa52dd=_0xbaf650[_0xc988('0xde')]({'plain':!![]});fs[_0xc988('0xdf')](_0x379afe);var _0x4910b6={'channel':_0xc988('0xe0'),'account':_0xfa52dd['Account'][_0xc988('0x28')],'agent':_0xfa52dd[_0xc988('0xdd')]?_0xfa52dd[_0xc988('0xdd')][_0xc988('0x2c')]:_0xc988('0xe1'),'createdAt':moment(_0xfa52dd[_0xc988('0x74')])[_0xc988('0xc2')](_0xc988('0xc3'))['toString'](),'closedAt':_0xfa52dd[_0xc988('0x36')]?moment(_0xfa52dd[_0xc988('0xe2')])[_0xc988('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc988('0x96')]():'','disposition':_0xfa52dd[_0xc988('0xe3')],'messages':_(_0xfa52dd[_0xc988('0xda')])[_0xc988('0x7f')]({'secret':![]})['map'](function(_0x48de71){if(_0x48de71[_0xc988('0xd9')]){var _0x47c1b3=path['join'](_0x92c32c,_0x48de71[_0xc988('0xd9')][_0xc988('0xe4')]);if(fs[_0xc988('0xe5')](_0x47c1b3)){fs[_0xc988('0xe6')](_0x47c1b3)[_0xc988('0xe7')](fs['createWriteStream'](path[_0xc988('0xce')](_0x379afe,_0x48de71['Attachment'][_0xc988('0xe4')])));}}return{'date':moment(_0x48de71[_0xc988('0x74')])[_0xc988('0xc2')](_0xc988('0xc3'))[_0xc988('0x96')](),'sender':_0x48de71['direction']===_0xc988('0xe8')?_0x48de71[_0xc988('0xd5')]?_0x48de71[_0xc988('0xd5')]['fullname']:_0xc988('0xe9'):_0x48de71[_0xc988('0xd7')][_0xc988('0xd8')]+(_0x48de71[_0xc988('0xd7')]['lastName']?'\x20'+_0x48de71['Contact'][_0xc988('0xea')]:''),'body':_0x48de71[_0xc988('0xd9')]?_0x48de71[_0xc988('0xd9')][_0xc988('0xe4')]:_0x48de71[_0xc988('0x6f')],'direction':_0x48de71[_0xc988('0xeb')]===_0xc988('0xe8')?'A':'C','secret':_0x48de71[_0xc988('0xec')],'read':_0x48de71[_0xc988('0x7b')],'attachment':_0x48de71[_0xc988('0xd9')]};})[_0xc988('0x5f')]()};return ejs['renderFile'](path['join'](config[_0xc988('0xcf')],_0xc988('0xd0'),'views',_0xc988('0xed')),{'interaction':_0x4910b6})[_0xc988('0x25')](function(_0x2a8192){var _0x11b9e9=path[_0xc988('0xce')](_0x379afe,_0xc988('0xee')+_0xfa52dd['id']+'-'+_0x5e451c+_0xc988('0xef'));var _0x3b018e={'path':_0x11b9e9,'channel':'Whatsapp','interactionId':_0xfa52dd['id']};return pdf[_0xc988('0xf0')](_0x2a8192,_0x3b018e);})['then'](function(){return new BPromise(function(_0x506479,_0x44cd25){zipdir(_0x379afe,{'saveTo':_0xc58fb6},function(_0x35d8af,_0x2ed15a){if(_0x35d8af)return _0x44cd25(_0x35d8af);return _0x506479(_0x2ed15a);});})['then'](function(){return new BPromise(function(_0x5bc52a,_0x42951c){rimraf(_0x379afe,function(_0x4cd1ca){if(_0x4cd1ca)_0x42951c(_0x4cd1ca);return _0x5bc52a();});});})[_0xc988('0x25')](function(){return _0xa617e['download'](_0xc58fb6,_0x1aae72,function(_0x12e46a){if(_0x12e46a){console[_0xc988('0xf1')](_0xc988('0xf2'),_0x12e46a);}else{fs['unlinkSync'](_0xc58fb6);}});});});}else{return _0xa617e[_0xc988('0x19')](0xc8);}})[_0xc988('0x31')](handleError(_0xa617e,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d4faf15..19e108a 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 _0x2821=['hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch'];(function(_0x4853bf,_0x3195a5){var _0xd7b240=function(_0x25f259){while(--_0x25f259){_0x4853bf['push'](_0x4853bf['shift']());}};_0xd7b240(++_0x3195a5);}(_0x2821,0x87));var _0x1282=function(_0x33ebed,_0x5a7a47){_0x33ebed=_0x33ebed-0x0;var _0x5caa1d=_0x2821[_0x33ebed];return _0x5caa1d;};'use strict';var EventEmitter=require(_0x1282('0x0'));var WhatsappInteraction=require(_0x1282('0x1'))['db'][_0x1282('0x2')];var WhatsappMessage=require(_0x1282('0x1'))['db'][_0x1282('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1282('0x4')](0x0);var events={'afterCreate':_0x1282('0x5'),'afterUpdate':_0x1282('0x6'),'afterDestroy':_0x1282('0x7')};function emitEvent(_0x7c8e0f){return function(_0x71ead4,_0x5c15c0,_0x31e0cf){_0x71ead4[_0x1282('0x8')]({'attributes':['id'],'raw':!![]})[_0x1282('0x9')](function(_0x13beb5){_0x71ead4[_0x1282('0xa')](_0x1282('0xb'),_0x13beb5[_0x1282('0xc')](function(_0x1436ba){return{'id':_0x1436ba['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x71ead4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1282('0x9')](function(_0x30df94){_0x71ead4[_0x1282('0xa')](_0x1282('0xd'),_0x30df94[_0x1282('0xe')]);WhatsappInteractionEvents['emit'](_0x7c8e0f+':'+_0x71ead4['id'],_0x71ead4);WhatsappInteractionEvents[_0x1282('0xf')](_0x7c8e0f,_0x71ead4);_0x31e0cf(null);})[_0x1282('0x10')](_0x31e0cf(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x1282('0x11')](e,emitEvent(event));}}module[_0x1282('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xc7ea=['remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7ea,0x171));var _0xac7e=function(_0xbca14e,_0x2b6d64){_0xbca14e=_0xbca14e-0x0;var _0x5cd841=_0xc7ea[_0xbca14e];return _0x5cd841;};'use strict';var EventEmitter=require(_0xac7e('0x0'));var WhatsappInteraction=require(_0xac7e('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xac7e('0x1'))['db'][_0xac7e('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xac7e('0x3')](0x0);var events={'afterCreate':_0xac7e('0x4'),'afterUpdate':'update','afterDestroy':_0xac7e('0x5')};function emitEvent(_0x39bf60){return function(_0x1c15cf,_0x3ca05f,_0x26b1c5){_0x1c15cf[_0xac7e('0x6')]({'attributes':['id'],'raw':!![]})[_0xac7e('0x7')](function(_0x1aca29){_0x1c15cf[_0xac7e('0x8')](_0xac7e('0x9'),_0x1aca29['map'](function(_0x114e82){return{'id':_0x114e82['id']};}));return WhatsappMessage[_0xac7e('0xa')]({'where':{'WhatsappInteractionId':_0x1c15cf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac7e('0x7')](function(_0x173b59){_0x1c15cf[_0xac7e('0x8')](_0xac7e('0xb'),_0x173b59[_0xac7e('0xc')]);WhatsappInteractionEvents[_0xac7e('0xd')](_0x39bf60+':'+_0x1c15cf['id'],_0x1c15cf);WhatsappInteractionEvents[_0xac7e('0xd')](_0x39bf60,_0x1c15cf);_0x26b1c5(null);})[_0xac7e('0xe')](_0x26b1c5(null));};}for(var e in events){if(events[_0xac7e('0xf')](e)){var event=events[e];WhatsappInteraction[_0xac7e('0x10')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 7ed3d12..ef7f957 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 _0x3333=['api','moment','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x5a920e,_0x4494fa){var _0x4c70f6=function(_0x424dbf){while(--_0x424dbf){_0x5a920e['push'](_0x5a920e['shift']());}};_0x4c70f6(++_0x4494fa);}(_0x3333,0x1dd));var _0x3333=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x3333[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0x3333('0x0'));var util=require(_0x3333('0x1'));var logger=require(_0x3333('0x2'))(_0x3333('0x3'));var moment=require(_0x3333('0x4'));var BPromise=require('bluebird');var rp=require(_0x3333('0x5'));var fs=require('fs');var path=require(_0x3333('0x6'));var rimraf=require(_0x3333('0x7'));var config=require(_0x3333('0x8'));var attributes=require(_0x3333('0x9'));module['exports']=function(_0x5900bd,_0x5e62ba){return _0x5900bd[_0x3333('0xa')](_0x3333('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1870cc,_0x24e63f,_0x39ebd2){if(_0x1870cc[_0x3333('0xc')](_0x3333('0xd'))){_0x1870cc[_0x3333('0xe')]=moment()['format'](_0x3333('0xf'));}_0x39ebd2(null,_0x1870cc);}}});}; \ No newline at end of file +var _0x106a=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x106a,0xb2));var _0xa106=function(_0x4d4282,_0x47388c){_0x4d4282=_0x4d4282-0x0;var _0x540385=_0x106a[_0x4d4282];return _0x540385;};'use strict';var _=require(_0xa106('0x0'));var util=require(_0xa106('0x1'));var logger=require(_0xa106('0x2'))(_0xa106('0x3'));var moment=require('moment');var BPromise=require(_0xa106('0x4'));var rp=require(_0xa106('0x5'));var fs=require('fs');var path=require(_0xa106('0x6'));var rimraf=require(_0xa106('0x7'));var config=require(_0xa106('0x8'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x593689,_0x558be7){return _0x593689['define'](_0xa106('0x9'),attributes,{'tableName':_0xa106('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59a09e,_0x3fc912,_0x32d5dc){if(_0x59a09e[_0xa106('0xb')](_0xa106('0xc'))){_0x59a09e[_0xa106('0xd')]=moment()[_0xa106('0xe')](_0xa106('0xf'));}_0x32d5dc(null,_0x59a09e);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index be2e126..a6b6099 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 _0xfedd=['error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','options','raw','where','limit','then','debug','AddTagsToWhatsappInteraction','addTags','omit','ids','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xb51895,_0x52f7db){var _0x2d6d15=function(_0x14a29d){while(--_0x14a29d){_0xb51895['push'](_0xb51895['shift']());}};_0x2d6d15(++_0x52f7db);}(_0xfedd,0x11e));var _0xdfed=function(_0x5bf31d,_0x851569){_0x5bf31d=_0x5bf31d-0x0;var _0x378617=_0xfedd[_0x5bf31d];return _0x378617;};'use strict';var _=require(_0xdfed('0x0'));var util=require(_0xdfed('0x1'));var moment=require('moment');var BPromise=require(_0xdfed('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdfed('0x3'));var db=require(_0xdfed('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdfed('0x5'));var config=require(_0xdfed('0x6'));var jayson=require(_0xdfed('0x7'));var client=jayson[_0xdfed('0x8')]['http']({'port':0x232a});config[_0xdfed('0x9')]=_[_0xdfed('0xa')](config[_0xdfed('0x9')],{'host':_0xdfed('0xb'),'port':0x18eb});var socket=require(_0xdfed('0xc'))(new Redis(config['redis']));require(_0xdfed('0xd'))['register'](socket);function respondWithRpcPromise(_0x325a61,_0x425ce8,_0x6cc139){return new BPromise(function(_0x1369b5,_0x1ea4d7){return client[_0xdfed('0xe')](_0x325a61,_0x6cc139)['then'](function(_0x3c3c05){logger['info'](_0xdfed('0xf'),_0x425ce8,_0xdfed('0x10'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x425ce8,'request\x20sent',JSON[_0xdfed('0x11')](_0x3c3c05));if(_0x3c3c05[_0xdfed('0x12')]){if(_0x3c3c05[_0xdfed('0x12')][_0xdfed('0x13')]===0x1f4){logger[_0xdfed('0x12')](_0xdfed('0xf'),_0x425ce8,_0x3c3c05[_0xdfed('0x12')]['message']);return _0x1ea4d7(_0x3c3c05['error'][_0xdfed('0x14')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x425ce8,_0x3c3c05[_0xdfed('0x12')][_0xdfed('0x14')]);return _0x1369b5(_0x3c3c05['error'][_0xdfed('0x14')]);}else{logger[_0xdfed('0x15')](_0xdfed('0xf'),_0x425ce8,'request\x20sent');_0x1369b5(_0x3c3c05[_0xdfed('0x16')][_0xdfed('0x14')]);}})[_0xdfed('0x17')](function(_0x3b4c82){logger[_0xdfed('0x12')](_0xdfed('0xf'),_0x425ce8,_0x3b4c82);_0x1ea4d7(_0x3b4c82);});});}exports[_0xdfed('0x18')]=function(_0xbf9c98){var _0x3cb42b=this;return new Promise(function(_0x462fa1,_0x457bd7){return db[_0xdfed('0x19')]['update'](_0xbf9c98['body'],{'raw':_0xbf9c98[_0xdfed('0x1a')]?_0xbf9c98['options'][_0xdfed('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbf9c98[_0xdfed('0x1a')]?_0xbf9c98[_0xdfed('0x1a')][_0xdfed('0x1c')]||null:null,'attributes':_0xbf9c98[_0xdfed('0x1a')]?_0xbf9c98[_0xdfed('0x1a')]['attributes']||null:null,'limit':_0xbf9c98[_0xdfed('0x1a')]?_0xbf9c98['options'][_0xdfed('0x1d')]||null:null})[_0xdfed('0x1e')](function(_0x3329d8){logger[_0xdfed('0x15')](_0xdfed('0x18'),_0xbf9c98);logger[_0xdfed('0x1f')]('UpdateWhatsappInteraction',_0xbf9c98,JSON[_0xdfed('0x11')](_0x3329d8));_0x462fa1(_0x3329d8);})['catch'](function(_0x268107){logger[_0xdfed('0x12')](_0xdfed('0x18'),_0x268107[_0xdfed('0x14')],_0xbf9c98);_0x457bd7(_0x3cb42b['error'](0x1f4,_0x268107['message']));});});};exports[_0xdfed('0x20')]=function(_0x313c69){return new Promise(function(_0x2baa10,_0x5c6d94){return db[_0xdfed('0x19')]['find']({'where':_0x313c69[_0xdfed('0x1a')]?_0x313c69[_0xdfed('0x1a')][_0xdfed('0x1c')]||null:null})[_0xdfed('0x1e')](function(_0x256af5){if(_0x256af5){return _0x256af5[_0xdfed('0x21')](_0x313c69['body']['ids'],_[_0xdfed('0x22')](_0x313c69['body'],[_0xdfed('0x23'),'id'])||{});}})[_0xdfed('0x24')](function(_0x2c1383){logger[_0xdfed('0x15')]('AddTags',_0x313c69);logger[_0xdfed('0x1f')]('AddTags',_0x313c69,JSON[_0xdfed('0x11')](_0x2c1383));_0x2baa10(_0x2c1383);})[_0xdfed('0x17')](function(_0x3fa947){logger[_0xdfed('0x12')](_0xdfed('0x25'),_0x3fa947[_0xdfed('0x14')],_0x313c69);_0x5c6d94(_this[_0xdfed('0x12')](0x1f4,_0x3fa947[_0xdfed('0x14')]));});});}; \ No newline at end of file +var _0x9f9a=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappInteraction','body','options','where','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','omit','spread','AddTags'];(function(_0x5cda7a,_0x51a7a0){var _0x18e18a=function(_0x1e8348){while(--_0x1e8348){_0x5cda7a['push'](_0x5cda7a['shift']());}};_0x18e18a(++_0x51a7a0);}(_0x9f9a,0x1e1));var _0xa9f9=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0x9f9a[_0x3e7804];return _0x56efda;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9f9('0x0'));var db=require(_0xa9f9('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9f9('0x2'))(_0xa9f9('0x3'));var config=require('../../config/environment');var jayson=require(_0xa9f9('0x4'));var client=jayson[_0xa9f9('0x5')][_0xa9f9('0x6')]({'port':0x232a});config[_0xa9f9('0x7')]=_[_0xa9f9('0x8')](config[_0xa9f9('0x7')],{'host':_0xa9f9('0x9'),'port':0x18eb});var socket=require(_0xa9f9('0xa'))(new Redis(config['redis']));require(_0xa9f9('0xb'))['register'](socket);function respondWithRpcPromise(_0x1cb976,_0x3b4881,_0x39a906){return new BPromise(function(_0x1768c2,_0x28a4bb){return client[_0xa9f9('0xc')](_0x1cb976,_0x39a906)[_0xa9f9('0xd')](function(_0x5d0074){logger[_0xa9f9('0xe')](_0xa9f9('0xf'),_0x3b4881,_0xa9f9('0x10'));logger[_0xa9f9('0x11')](_0xa9f9('0x12'),_0x3b4881,_0xa9f9('0x10'),JSON[_0xa9f9('0x13')](_0x5d0074));if(_0x5d0074['error']){if(_0x5d0074[_0xa9f9('0x14')][_0xa9f9('0x15')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x3b4881,_0x5d0074['error'][_0xa9f9('0x16')]);return _0x28a4bb(_0x5d0074['error'][_0xa9f9('0x16')]);}logger['error'](_0xa9f9('0xf'),_0x3b4881,_0x5d0074[_0xa9f9('0x14')]['message']);return _0x1768c2(_0x5d0074[_0xa9f9('0x14')]['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x3b4881,_0xa9f9('0x10'));_0x1768c2(_0x5d0074[_0xa9f9('0x17')][_0xa9f9('0x16')]);}})[_0xa9f9('0x18')](function(_0x171da9){logger[_0xa9f9('0x14')](_0xa9f9('0xf'),_0x3b4881,_0x171da9);_0x28a4bb(_0x171da9);});});}exports['UpdateWhatsappInteraction']=function(_0x100e3b){var _0xf3022f=this;return new Promise(function(_0x35e572,_0x14bee5){return db[_0xa9f9('0x19')]['update'](_0x100e3b[_0xa9f9('0x1a')],{'raw':_0x100e3b[_0xa9f9('0x1b')]?_0x100e3b[_0xa9f9('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x100e3b[_0xa9f9('0x1b')]?_0x100e3b[_0xa9f9('0x1b')][_0xa9f9('0x1c')]||null:null,'attributes':_0x100e3b[_0xa9f9('0x1b')]?_0x100e3b[_0xa9f9('0x1b')][_0xa9f9('0x1d')]||null:null,'limit':_0x100e3b[_0xa9f9('0x1b')]?_0x100e3b[_0xa9f9('0x1b')][_0xa9f9('0x1e')]||null:null})[_0xa9f9('0xd')](function(_0x3033ba){logger[_0xa9f9('0xe')](_0xa9f9('0x1f'),_0x100e3b);logger[_0xa9f9('0x11')](_0xa9f9('0x1f'),_0x100e3b,JSON[_0xa9f9('0x13')](_0x3033ba));_0x35e572(_0x3033ba);})['catch'](function(_0x3781c3){logger[_0xa9f9('0x14')](_0xa9f9('0x1f'),_0x3781c3[_0xa9f9('0x16')],_0x100e3b);_0x14bee5(_0xf3022f['error'](0x1f4,_0x3781c3[_0xa9f9('0x16')]));});});};exports[_0xa9f9('0x20')]=function(_0x3971a3){return new Promise(function(_0x108cc2,_0x58596e){return db[_0xa9f9('0x19')][_0xa9f9('0x21')]({'where':_0x3971a3['options']?_0x3971a3['options'][_0xa9f9('0x1c')]||null:null})[_0xa9f9('0xd')](function(_0x36f700){if(_0x36f700){return _0x36f700['addTags'](_0x3971a3['body']['ids'],_[_0xa9f9('0x22')](_0x3971a3['body'],['ids','id'])||{});}})[_0xa9f9('0x23')](function(_0x39987d){logger[_0xa9f9('0xe')]('AddTags',_0x3971a3);logger[_0xa9f9('0x11')]('AddTags',_0x3971a3,JSON[_0xa9f9('0x13')](_0x39987d));_0x108cc2(_0x39987d);})['catch'](function(_0x54e378){logger['error'](_0xa9f9('0x24'),_0x54e378[_0xa9f9('0x16')],_0x3971a3);_0x58596e(_this['error'](0x1f4,_0x54e378[_0xa9f9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 359a6dc..710ee98 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 _0x1d4d=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit'];(function(_0x349fe4,_0x3a7ec1){var _0x50842c=function(_0x2e0435){while(--_0x2e0435){_0x349fe4['push'](_0x349fe4['shift']());}};_0x50842c(++_0x3a7ec1);}(_0x1d4d,0x173));var _0xd1d4=function(_0x3067d5,_0x482827){_0x3067d5=_0x3067d5-0x0;var _0x13a218=_0x1d4d[_0x3067d5];return _0x13a218;};'use strict';var WhatsappInteractionEvents=require(_0xd1d4('0x0'));var events=[_0xd1d4('0x1'),_0xd1d4('0x2'),_0xd1d4('0x3')];function createListener(_0x2fabf5,_0x2a3bfb){return function(_0x15c679){_0x2a3bfb[_0xd1d4('0x4')](_0x2fabf5,_0x15c679);};}function removeListener(_0xb14744,_0x1debc6){return function(){WhatsappInteractionEvents['removeListener'](_0xb14744,_0x1debc6);};}exports[_0xd1d4('0x5')]=function(_0xce0307){for(var _0xdcadb7=0x0,_0x56467f=events[_0xd1d4('0x6')];_0xdcadb7<_0x56467f;_0xdcadb7++){var _0x324827=events[_0xdcadb7];var _0x16ca7b=createListener(_0xd1d4('0x7')+_0x324827,_0xce0307);WhatsappInteractionEvents['on'](_0x324827,_0x16ca7b);}}; \ No newline at end of file +var _0xe1b3=['register','whatsappInteraction:','./whatsappInteraction.events','save','removeListener'];(function(_0x5f1431,_0x49bea0){var _0x165500=function(_0xdb081a){while(--_0xdb081a){_0x5f1431['push'](_0x5f1431['shift']());}};_0x165500(++_0x49bea0);}(_0xe1b3,0x165));var _0x3e1b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe1b3[_0x321bb2];return _0x9c12ed;};'use strict';var WhatsappInteractionEvents=require(_0x3e1b('0x0'));var events=[_0x3e1b('0x1'),'remove','update'];function createListener(_0x5d246b,_0x54d1bb){return function(_0x571c03){_0x54d1bb['emit'](_0x5d246b,_0x571c03);};}function removeListener(_0x74ce5b,_0x3a4b10){return function(){WhatsappInteractionEvents[_0x3e1b('0x2')](_0x74ce5b,_0x3a4b10);};}exports[_0x3e1b('0x3')]=function(_0x18d45f){for(var _0xbd2e2d=0x0,_0x1fca7d=events['length'];_0xbd2e2d<_0x1fca7d;_0xbd2e2d++){var _0x41fff1=events[_0xbd2e2d];var _0x54335c=createListener(_0x3e1b('0x4')+_0x41fff1,_0x18d45f);WhatsappInteractionEvents['on'](_0x41fff1,_0x54335c);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index a5b3d60..65faed8 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 _0x6f6f=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','isAuthenticated','index','get','describe','/:id','post','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6f6f,0x77));var _0xf6f6=function(_0xa5c1dc,_0xa880cd){_0xa5c1dc=_0xa5c1dc-0x0;var _0x56ad0a=_0x6f6f[_0xa5c1dc];return _0x56ad0a;};'use strict';var multer=require(_0xf6f6('0x0'));var util=require('util');var path=require(_0xf6f6('0x1'));var timeout=require(_0xf6f6('0x2'));var express=require(_0xf6f6('0x3'));var router=express['Router']();var fs_extra=require(_0xf6f6('0x4'));var auth=require(_0xf6f6('0x5'));var interaction=require(_0xf6f6('0x6'));var config=require('../../config/environment');var controller=require(_0xf6f6('0x7'));router['get']('/',auth[_0xf6f6('0x8')](),controller[_0xf6f6('0x9')]);router[_0xf6f6('0xa')]('/describe',auth[_0xf6f6('0x8')](),controller[_0xf6f6('0xb')]);router['get'](_0xf6f6('0xc'),auth[_0xf6f6('0x8')](),controller['show']);router[_0xf6f6('0xd')]('/',auth[_0xf6f6('0x8')](),interaction['tracked'](_0xf6f6('0xe'),_0xf6f6('0xf')),controller[_0xf6f6('0x10')]);router[_0xf6f6('0xd')](_0xf6f6('0x11'),controller[_0xf6f6('0x12')]);router[_0xf6f6('0x13')](_0xf6f6('0xc'),auth[_0xf6f6('0x8')](),controller[_0xf6f6('0x14')]);router[_0xf6f6('0x13')](_0xf6f6('0x15'),auth[_0xf6f6('0x8')](),controller[_0xf6f6('0x16')]);router['put'](_0xf6f6('0x17'),auth[_0xf6f6('0x8')](),controller[_0xf6f6('0x18')]);router[_0xf6f6('0x19')](_0xf6f6('0xc'),auth[_0xf6f6('0x8')](),controller[_0xf6f6('0x1a')]);module[_0xf6f6('0x1b')]=router; \ No newline at end of file +var _0xbafc=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xbafc,0xed));var _0xcbaf=function(_0x5013bd,_0x4d4b8d){_0x5013bd=_0x5013bd-0x0;var _0x5d3e13=_0xbafc[_0x5013bd];return _0x5d3e13;};'use strict';var multer=require(_0xcbaf('0x0'));var util=require(_0xcbaf('0x1'));var path=require('path');var timeout=require(_0xcbaf('0x2'));var express=require(_0xcbaf('0x3'));var router=express[_0xcbaf('0x4')]();var fs_extra=require(_0xcbaf('0x5'));var auth=require(_0xcbaf('0x6'));var interaction=require(_0xcbaf('0x7'));var config=require(_0xcbaf('0x8'));var controller=require(_0xcbaf('0x9'));router[_0xcbaf('0xa')]('/',auth[_0xcbaf('0xb')](),controller[_0xcbaf('0xc')]);router[_0xcbaf('0xa')](_0xcbaf('0xd'),auth[_0xcbaf('0xb')](),controller['describe']);router['get'](_0xcbaf('0xe'),auth[_0xcbaf('0xb')](),controller[_0xcbaf('0xf')]);router[_0xcbaf('0x10')]('/',auth[_0xcbaf('0xb')](),interaction[_0xcbaf('0x11')](_0xcbaf('0x12'),_0xcbaf('0x13')),controller[_0xcbaf('0x14')]);router[_0xcbaf('0x10')](_0xcbaf('0x15'),controller[_0xcbaf('0x16')]);router[_0xcbaf('0x17')](_0xcbaf('0xe'),auth['isAuthenticated'](),controller['update']);router['put']('/:id/accept',auth[_0xcbaf('0xb')](),controller[_0xcbaf('0x18')]);router[_0xcbaf('0x17')](_0xcbaf('0x19'),auth['isAuthenticated'](),controller[_0xcbaf('0x1a')]);router[_0xcbaf('0x1b')](_0xcbaf('0xe'),auth['isAuthenticated'](),controller[_0xcbaf('0x1c')]);module[_0xcbaf('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 934551d..58791e7 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 _0x84cb=['STRING','DATE','sequelize','TEXT','BOOLEAN','out'];(function(_0x1e1020,_0xd64a27){var _0x464719=function(_0x376ffa){while(--_0x376ffa){_0x1e1020['push'](_0x1e1020['shift']());}};_0x464719(++_0xd64a27);}(_0x84cb,0xf8));var _0xb84c=function(_0x2e84ee,_0x283c59){_0x2e84ee=_0x2e84ee-0x0;var _0x5c82d0=_0x84cb[_0x2e84ee];return _0x5c82d0;};'use strict';var Sequelize=require(_0xb84c('0x0'));module['exports']={'body':{'type':Sequelize[_0xb84c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb84c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb84c('0x3')),'defaultValue':_0xb84c('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb84c('0x4')](0xbe)},'phone':{'type':Sequelize[_0xb84c('0x4')]},'readAt':{'type':Sequelize[_0xb84c('0x5')]},'secret':{'type':Sequelize[_0xb84c('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb84c('0x4')]},'providerResponse':{'type':Sequelize[_0xb84c('0x1')]}}; \ No newline at end of file +var _0x683f=['TEXT','medium','ENUM','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x2a0dc9,_0x3802f4){var _0x198be1=function(_0x154add){while(--_0x154add){_0x2a0dc9['push'](_0x2a0dc9['shift']());}};_0x198be1(++_0x3802f4);}(_0x683f,0x18e));var _0xf683=function(_0x16051a,_0x5e4326){_0x16051a=_0x16051a-0x0;var _0x35d20d=_0x683f[_0x16051a];return _0x35d20d;};'use strict';var Sequelize=require(_0xf683('0x0'));module[_0xf683('0x1')]={'body':{'type':Sequelize[_0xf683('0x2')](_0xf683('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf683('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xf683('0x5')](0xbe)},'phone':{'type':Sequelize[_0xf683('0x5')]},'readAt':{'type':Sequelize[_0xf683('0x6')]},'secret':{'type':Sequelize[_0xf683('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf683('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 61c3c71..6807c52 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 _0x7fcb=['../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','stack','name','map','WhatsappMessage','rawAttributes','type','model','keys','attributes','intersection','query','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','destroy','describe','whatsapp-interactions','accept','read','YYYY-MM-DD\x20HH:mm:ss','UserId','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','QueryTypes','contact','internal','rejectmessage','WhatsappAccount','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7fcb,0x18c));var _0xb7fc=function(_0x49c341,_0x5b9570){_0x49c341=_0x49c341-0x0;var _0x1c106d=_0x7fcb[_0x49c341];return _0x1c106d;};'use strict';var emlformat=require(_0xb7fc('0x0'));var rimraf=require(_0xb7fc('0x1'));var zipdir=require(_0xb7fc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb7fc('0x3'));var moment=require(_0xb7fc('0x4'));var BPromise=require(_0xb7fc('0x5'));var Mustache=require(_0xb7fc('0x6'));var util=require('util');var path=require(_0xb7fc('0x7'));var sox=require(_0xb7fc('0x8'));var csv=require(_0xb7fc('0x9'));var ejs=require(_0xb7fc('0xa'));var fs=require('fs');var fs_extra=require(_0xb7fc('0xb'));var _=require(_0xb7fc('0xc'));var squel=require('squel');var crypto=require(_0xb7fc('0xd'));var jsforce=require(_0xb7fc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb7fc('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb7fc('0xf'));var qs=require(_0xb7fc('0x10'));var as=require(_0xb7fc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb7fc('0x12'))(_0xb7fc('0x13'));var utils=require('../../config/utils');var config=require(_0xb7fc('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb7fc('0x15'))['db'];config[_0xb7fc('0x16')]=_['defaults'](config[_0xb7fc('0x16')],{'host':_0xb7fc('0x17'),'port':0x18eb});var socket=require(_0xb7fc('0x18'))(new Redis(config['redis']));require(_0xb7fc('0x19'))[_0xb7fc('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb7fc('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0xb7fc('0x1b')][_0xb7fc('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3fe5e3,_0x501dfb,_0x2dd944,_0x544055){return new BPromise(function(_0x564b22,_0x244f05){var _0x59dbdb=_0x544055||client;return _0x59dbdb[_0xb7fc('0x1d')](_0x3fe5e3,_0x2dd944)[_0xb7fc('0x1e')](function(_0x27c745){logger[_0xb7fc('0x1f')](_0xb7fc('0x20'),_0x501dfb,_0xb7fc('0x21'));logger['debug'](_0xb7fc('0x22'),_0x501dfb,'request\x20sent',JSON[_0xb7fc('0x23')](_0x27c745));if(_0x27c745[_0xb7fc('0x24')]){if(_0x27c745[_0xb7fc('0x24')][_0xb7fc('0x25')]===0x1f4){logger['error'](_0xb7fc('0x20'),_0x501dfb,_0x27c745[_0xb7fc('0x24')][_0xb7fc('0x26')]);return _0x244f05(_0x27c745['error'][_0xb7fc('0x26')]);}logger[_0xb7fc('0x24')](_0xb7fc('0x20'),_0x501dfb,_0x27c745['error'][_0xb7fc('0x26')]);return _0x564b22(_0x27c745[_0xb7fc('0x24')]['message']);}else{logger[_0xb7fc('0x1f')](_0xb7fc('0x20'),_0x501dfb,_0xb7fc('0x21'));_0x564b22(_0x27c745[_0xb7fc('0x27')]['message']);}})['catch'](function(_0x13807e){logger[_0xb7fc('0x24')](_0xb7fc('0x20'),_0x501dfb,_0x13807e);_0x244f05(_0x13807e);});});}function respondWithStatusCode(_0x2930ce,_0x5c7ea6){_0x5c7ea6=_0x5c7ea6||0xcc;return function(_0x246e73){if(_0x246e73){return _0x2930ce[_0xb7fc('0x28')](_0x5c7ea6);}return _0x2930ce['status'](_0x5c7ea6)[_0xb7fc('0x29')]();};}function respondWithResult(_0x25e37e,_0x37f367){_0x37f367=_0x37f367||0xc8;return function(_0x20525d){if(_0x20525d){return _0x25e37e[_0xb7fc('0x2a')](_0x37f367)[_0xb7fc('0x2b')](_0x20525d);}};}function respondWithFilteredResult(_0xf58a0e,_0x45514f){return function(_0x5cef89){if(_0x5cef89){var _0x578b8b=typeof _0x45514f['offset']===_0xb7fc('0x2c')&&typeof _0x45514f[_0xb7fc('0x2d')]===_0xb7fc('0x2c');var _0x5859fc=_0x5cef89[_0xb7fc('0x2e')];var _0x1c1831=_0x578b8b?0x0:_0x45514f[_0xb7fc('0x2f')];var _0x243e6c=_0x578b8b?_0x5cef89[_0xb7fc('0x2e')]:_0x45514f[_0xb7fc('0x2f')]+_0x45514f['limit'];var _0x112274;if(_0x243e6c>=_0x5859fc){_0x243e6c=_0x5859fc;_0x112274=0xc8;}else{_0x112274=0xce;}_0xf58a0e[_0xb7fc('0x2a')](_0x112274);return _0xf58a0e[_0xb7fc('0x30')]('Content-Range',_0x1c1831+'-'+_0x243e6c+'/'+_0x5859fc)[_0xb7fc('0x2b')](_0x5cef89);}return null;};}function patchUpdates(_0x41d350){return function(_0x9637a2){try{jsonpatch[_0xb7fc('0x31')](_0x9637a2,_0x41d350,!![]);}catch(_0x31804f){return BPromise[_0xb7fc('0x32')](_0x31804f);}return _0x9637a2[_0xb7fc('0x33')]();};}function saveUpdates(_0x4d90db,_0x355af4){return function(_0x46ca9e){if(_0x46ca9e){return _0x46ca9e['update'](_0x4d90db)[_0xb7fc('0x1e')](function(_0x58e9f5){return _0x58e9f5;});}return null;};}function removeEntity(_0xb18391,_0x3ca091){return function(_0xe08742){if(_0xe08742){return _0xe08742['destroy']()[_0xb7fc('0x1e')](function(){_0xb18391[_0xb7fc('0x2a')](0xcc)[_0xb7fc('0x29')]();});}};}function handleEntityNotFound(_0x4fadd,_0x35d23f){return function(_0x35e4a5){if(!_0x35e4a5){_0x4fadd[_0xb7fc('0x28')](0x194);}return _0x35e4a5;};}function handleError(_0x110c52,_0x739d2b){_0x739d2b=_0x739d2b||0x1f4;return function(_0x4708cf){logger[_0xb7fc('0x24')](_0x4708cf[_0xb7fc('0x34')]);if(_0x4708cf[_0xb7fc('0x35')]){delete _0x4708cf[_0xb7fc('0x35')];}_0x110c52['status'](_0x739d2b)['send'](_0x4708cf);};}exports['index']=function(_0x4c9f78,_0xf7ca2){var _0x2cfa22={},_0x4438df={},_0x2ee1fe={'count':0x0,'rows':[]};var _0x2ab922=_[_0xb7fc('0x36')](db[_0xb7fc('0x37')][_0xb7fc('0x38')],function(_0x4cca19){return{'name':_0x4cca19['fieldName'],'type':_0x4cca19[_0xb7fc('0x39')]['key']};});_0x4438df[_0xb7fc('0x3a')]=_[_0xb7fc('0x36')](_0x2ab922,_0xb7fc('0x35'));_0x4438df['query']=_[_0xb7fc('0x3b')](_0x4c9f78['query']);_0x4438df['filters']=_['intersection'](_0x4438df[_0xb7fc('0x3a')],_0x4438df['query']);_0x2cfa22[_0xb7fc('0x3c')]=_[_0xb7fc('0x3d')](_0x4438df['model'],qs['fields'](_0x4c9f78[_0xb7fc('0x3e')][_0xb7fc('0x3f')]));_0x2cfa22[_0xb7fc('0x3c')]=_0x2cfa22['attributes']['length']?_0x2cfa22[_0xb7fc('0x3c')]:_0x4438df['model'];if(!_0x4c9f78['query'][_0xb7fc('0x40')](_0xb7fc('0x41'))){_0x2cfa22[_0xb7fc('0x2d')]=qs[_0xb7fc('0x2d')](_0x4c9f78['query'][_0xb7fc('0x2d')]);_0x2cfa22['offset']=qs[_0xb7fc('0x2f')](_0x4c9f78[_0xb7fc('0x3e')]['offset']);}_0x2cfa22[_0xb7fc('0x42')]=qs[_0xb7fc('0x43')](_0x4c9f78[_0xb7fc('0x3e')][_0xb7fc('0x43')]);_0x2cfa22[_0xb7fc('0x44')]=qs[_0xb7fc('0x45')](_[_0xb7fc('0x46')](_0x4c9f78[_0xb7fc('0x3e')],_0x4438df[_0xb7fc('0x45')]),_0x2ab922);if(_0x4c9f78[_0xb7fc('0x3e')][_0xb7fc('0x47')]){_0x2cfa22['where']=_[_0xb7fc('0x48')](_0x2cfa22['where'],{'$or':_[_0xb7fc('0x36')](_0x2ab922,function(_0x2ad514){if(_0x2ad514[_0xb7fc('0x39')]!==_0xb7fc('0x49')){var _0x31d534={};_0x31d534[_0x2ad514[_0xb7fc('0x35')]]={'$like':'%'+_0x4c9f78[_0xb7fc('0x3e')][_0xb7fc('0x47')]+'%'};return _0x31d534;}})});}_0x2cfa22=_[_0xb7fc('0x48')]({},_0x2cfa22,_0x4c9f78['options']);var _0x5e7236={'where':_0x2cfa22['where']};return db[_0xb7fc('0x37')][_0xb7fc('0x2e')](_0x5e7236)[_0xb7fc('0x1e')](function(_0x4f04a9){_0x2ee1fe[_0xb7fc('0x2e')]=_0x4f04a9;if(_0x4c9f78['query'][_0xb7fc('0x4a')]){_0x2cfa22[_0xb7fc('0x4b')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xb7fc('0x4c')](_0x2cfa22);})[_0xb7fc('0x1e')](function(_0x120a5a){_0x2ee1fe[_0xb7fc('0x4d')]=_0x120a5a;return _0x2ee1fe;})[_0xb7fc('0x1e')](respondWithFilteredResult(_0xf7ca2,_0x2cfa22))[_0xb7fc('0x4e')](handleError(_0xf7ca2,null));};exports[_0xb7fc('0x4f')]=function(_0x341e74,_0x44cbd1){var _0x3492b7={'raw':!![],'where':{'id':_0x341e74[_0xb7fc('0x50')]['id']}},_0xefb000={};_0xefb000[_0xb7fc('0x3a')]=_[_0xb7fc('0x3b')](db[_0xb7fc('0x37')][_0xb7fc('0x38')]);_0xefb000[_0xb7fc('0x3e')]=_[_0xb7fc('0x3b')](_0x341e74[_0xb7fc('0x3e')]);_0xefb000[_0xb7fc('0x45')]=_[_0xb7fc('0x3d')](_0xefb000[_0xb7fc('0x3a')],_0xefb000['query']);_0x3492b7[_0xb7fc('0x3c')]=_['intersection'](_0xefb000[_0xb7fc('0x3a')],qs['fields'](_0x341e74[_0xb7fc('0x3e')][_0xb7fc('0x3f')]));_0x3492b7['attributes']=_0x3492b7[_0xb7fc('0x3c')]['length']?_0x3492b7[_0xb7fc('0x3c')]:_0xefb000['model'];if(_0x341e74[_0xb7fc('0x3e')]['includeAll']){_0x3492b7[_0xb7fc('0x4b')]=[{'all':!![]}];}_0x3492b7=_[_0xb7fc('0x48')]({},_0x3492b7,_0x341e74[_0xb7fc('0x51')]);return db[_0xb7fc('0x37')][_0xb7fc('0x52')](_0x3492b7)[_0xb7fc('0x1e')](handleEntityNotFound(_0x44cbd1,null))['then'](respondWithResult(_0x44cbd1,null))['catch'](handleError(_0x44cbd1,null));};exports[_0xb7fc('0x53')]=function(_0x5ea211,_0x15f71e){return db[_0xb7fc('0x37')][_0xb7fc('0x53')](_0x5ea211[_0xb7fc('0x54')],{})[_0xb7fc('0x1e')](respondWithResult(_0x15f71e,0xc9))[_0xb7fc('0x4e')](handleError(_0x15f71e,null));};exports[_0xb7fc('0x55')]=function(_0x38f250,_0x44a76e){if(_0x38f250[_0xb7fc('0x54')]['id']){delete _0x38f250[_0xb7fc('0x54')]['id'];}return db[_0xb7fc('0x37')][_0xb7fc('0x52')]({'where':{'id':_0x38f250['params']['id']}})[_0xb7fc('0x1e')](handleEntityNotFound(_0x44a76e,null))[_0xb7fc('0x1e')](saveUpdates(_0x38f250[_0xb7fc('0x54')],null))[_0xb7fc('0x1e')](respondWithResult(_0x44a76e,null))[_0xb7fc('0x4e')](handleError(_0x44a76e,null));};exports[_0xb7fc('0x56')]=function(_0x489c51,_0x10d978){return db[_0xb7fc('0x37')][_0xb7fc('0x52')]({'where':{'id':_0x489c51[_0xb7fc('0x50')]['id']}})[_0xb7fc('0x1e')](handleEntityNotFound(_0x10d978,null))['then'](removeEntity(_0x10d978,null))[_0xb7fc('0x4e')](handleError(_0x10d978,null));};exports[_0xb7fc('0x57')]=function(_0x460752,_0xd22ad4){return db['WhatsappMessage']['describe']()[_0xb7fc('0x1e')](respondWithResult(_0xd22ad4,null))[_0xb7fc('0x4e')](handleError(_0xd22ad4,null));};var interaction_log=require(_0xb7fc('0x12'))(_0xb7fc('0x58'));exports[_0xb7fc('0x59')]=function(_0x13756b,_0x2cbfcf,_0x2c36fa){var _0x49503c={'agent':{},'channel':'whatsapp'};if(_0x13756b[_0xb7fc('0x54')]['id']){delete _0x13756b[_0xb7fc('0x54')]['id'];}_0x13756b[_0xb7fc('0x54')][_0xb7fc('0x5a')]=!![];_0x13756b['body']['readAt']=moment()['format'](_0xb7fc('0x5b'));_0x13756b[_0xb7fc('0x54')][_0xb7fc('0x5c')]=_0x13756b['body'][_0xb7fc('0x5c')]||_0x13756b['user']['id'];_0x49503c['agent']['id']=_0x13756b[_0xb7fc('0x54')][_0xb7fc('0x5c')];return db[_0xb7fc('0x37')]['find']({'where':{'id':_0x13756b[_0xb7fc('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2cbfcf,null))[_0xb7fc('0x1e')](saveUpdates(_0x13756b['body'],null))[_0xb7fc('0x1e')](function(_0xe9dc6e){if(_0xe9dc6e){_0x49503c[_0xb7fc('0x26')]=_0xe9dc6e[_0xb7fc('0x5d')]({'plain':!![]});return db[_0xb7fc('0x5e')][_0xb7fc('0x52')]({'where':{'id':_0xe9dc6e[_0xb7fc('0x5f')]}});}return null;})[_0xb7fc('0x1e')](handleEntityNotFound(_0x2cbfcf,null))[_0xb7fc('0x1e')](function(_0x2a1a6a){if(_0x2a1a6a){return _0x2a1a6a[_0xb7fc('0x55')]({'UserId':_0x13756b[_0xb7fc('0x54')][_0xb7fc('0x5c')],'read1stAt':_[_0xb7fc('0x60')](_0x2a1a6a[_0xb7fc('0x61')])?moment()[_0xb7fc('0x62')](_0xb7fc('0x5b')):undefined});}return null;})[_0xb7fc('0x1e')](function(_0x11f58b){if(_0x11f58b){_0x49503c[_0xb7fc('0x63')]=_0x11f58b[_0xb7fc('0x5d')]({'plain':!![]});interaction_log[_0xb7fc('0x1f')](_0xb7fc('0x64'),_0x13756b['user']['id'],_0x13756b[_0xb7fc('0x65')]['name'],_0x13756b['user']['role'],_0x49503c[_0xb7fc('0x63')]['id'],_0x13756b[_0xb7fc('0x54')]?JSON['stringify'](_0x13756b[_0xb7fc('0x54')]):_0xb7fc('0x66'));return respondWithRpcPromise(_0xb7fc('0x67'),_0xb7fc('0x68'),_0x49503c);}return null;})[_0xb7fc('0x1e')](function(_0x44c1fe){var _0x4c22db=_0xb7fc('0x69')+_0x44c1fe['message'][_0xb7fc('0x6a')];return db[_0xb7fc('0x6b')][_0xb7fc('0x3e')](_0x4c22db,{'type':db[_0xb7fc('0x6c')]['QueryTypes'][_0xb7fc('0x6d')],'raw':!![]})[_0xb7fc('0x1e')](function(_0x5a4b81){return _0x5a4b81;});})[_0xb7fc('0x1e')](function(_0x56317a){if(_0x56317a){_0x49503c[_0xb7fc('0x26')]['contact']=_0x56317a[0x0];if(!_0x13756b[_0xb7fc('0x54')][_0xb7fc('0x5c')])return;return db[_0xb7fc('0x6e')][_0xb7fc('0x52')]({'where':{'id':_0x13756b[_0xb7fc('0x54')][_0xb7fc('0x5c')],'role':_0xb7fc('0x6f')},'attributes':['id','name',_0xb7fc('0x70'),_0xb7fc('0x71'),'internal'],'raw':!![]});}return null;})[_0xb7fc('0x1e')](function(_0x28e9ec){if(!_0x28e9ec)return null;_0x49503c['message'][_0xb7fc('0x6f')]=_0x28e9ec;return _0x49503c;})[_0xb7fc('0x1e')](function(_0x226146){if(_0x226146){if(_0x13756b['body'][_0xb7fc('0x72')]){_0x49503c[_0xb7fc('0x26')][_0xb7fc('0x73')]=util['format'](_0xb7fc('0x74'),_0x13756b[_0xb7fc('0x65')][_0xb7fc('0x35')]);_0x49503c[_0xb7fc('0x26')][_0xb7fc('0x75')]=_0x49503c[_0xb7fc('0x75')];_0x49503c[_0xb7fc('0x26')][_0xb7fc('0x76')]=_0x49503c[_0xb7fc('0x75')];_0x49503c[_0xb7fc('0x26')][_0xb7fc('0x77')]=_0xb7fc('0x59');return respondWithRpcPromise(_0xb7fc('0x78'),_0xb7fc('0x78'),{'event':'acceptmessage','message':_0x49503c['message']},client9002)[_0xb7fc('0x1e')](function(){return _0x49503c;});}return _0x49503c;}return null;})[_0xb7fc('0x1e')](respondWithResult(_0x2cbfcf,null))[_0xb7fc('0x4e')](handleError(_0x2cbfcf,null));};var interaction_log=require(_0xb7fc('0x12'))(_0xb7fc('0x58'));exports['reject']=function(_0x4f28d7,_0xf31f,_0x572dba){var _0x54a045={'agent':{},'channel':_0xb7fc('0x79')};if(_0x4f28d7[_0xb7fc('0x54')]['id']){delete _0x4f28d7[_0xb7fc('0x54')]['id'];}_0x4f28d7['body'][_0xb7fc('0x5c')]=_0x4f28d7[_0xb7fc('0x54')]['UserId']||_0x4f28d7['user']['id'];_0x54a045[_0xb7fc('0x6f')]['id']=_0x4f28d7[_0xb7fc('0x54')][_0xb7fc('0x5c')];return db[_0xb7fc('0x37')][_0xb7fc('0x52')]({'where':{'id':_0x4f28d7[_0xb7fc('0x50')]['id'],'UserId':null}})[_0xb7fc('0x1e')](handleEntityNotFound(_0xf31f,null))['then'](function(_0x33ff0e){if(_0x33ff0e){_0x54a045['message']=_0x33ff0e[_0xb7fc('0x5d')]({'plain':!![]});return db[_0xb7fc('0x5e')][_0xb7fc('0x52')]({'where':{'id':_0x33ff0e['WhatsappInteractionId']}});}return null;})[_0xb7fc('0x1e')](handleEntityNotFound(_0xf31f,null))[_0xb7fc('0x1e')](function(_0x158622){if(_0x158622){_0x54a045[_0xb7fc('0x63')]=_0x158622[_0xb7fc('0x5d')]({'plain':!![]});interaction_log[_0xb7fc('0x1f')](_0xb7fc('0x7a'),_0x4f28d7[_0xb7fc('0x65')]['id'],_0x4f28d7[_0xb7fc('0x65')][_0xb7fc('0x35')],_0x4f28d7[_0xb7fc('0x65')][_0xb7fc('0x7b')],_0x54a045['interaction']['id'],_0x4f28d7[_0xb7fc('0x54')]?JSON[_0xb7fc('0x23')](_0x4f28d7[_0xb7fc('0x54')]):_0xb7fc('0x66'));return respondWithRpcPromise(_0xb7fc('0x7c'),'rejectMessage',_0x54a045);}return null;})[_0xb7fc('0x1e')](function(_0x310d67){var _0x57eb36=_0xb7fc('0x69')+_0x310d67[_0xb7fc('0x26')][_0xb7fc('0x6a')];return db['sequelize'][_0xb7fc('0x3e')](_0x57eb36,{'type':db[_0xb7fc('0x6c')][_0xb7fc('0x7d')][_0xb7fc('0x6d')],'raw':!![]})[_0xb7fc('0x1e')](function(_0x31cb5e){return _0x31cb5e;});})[_0xb7fc('0x1e')](function(_0x3a3fdf){if(_0x3a3fdf){_0x54a045[_0xb7fc('0x26')][_0xb7fc('0x7e')]=_0x3a3fdf[0x0];if(!_0x4f28d7['body']['UserId'])return;return db['User'][_0xb7fc('0x52')]({'where':{'id':_0x4f28d7[_0xb7fc('0x54')][_0xb7fc('0x5c')],'role':_0xb7fc('0x6f')},'attributes':['id',_0xb7fc('0x35'),_0xb7fc('0x70'),_0xb7fc('0x71'),_0xb7fc('0x7f')],'raw':!![]});}return null;})['then'](function(_0x3a4f98){if(!_0x3a4f98)return null;_0x54a045['message'][_0xb7fc('0x6f')]=_0x3a4f98;return _0x54a045;})[_0xb7fc('0x1e')](function(_0x43d09e){if(_0x43d09e){_0x43d09e['message'][_0xb7fc('0x73')]=util[_0xb7fc('0x62')](_0xb7fc('0x74'),_0x4f28d7[_0xb7fc('0x65')][_0xb7fc('0x35')]);_0x43d09e['message'][_0xb7fc('0x75')]=_0x54a045['channel'];_0x43d09e[_0xb7fc('0x26')][_0xb7fc('0x76')]=_0x54a045[_0xb7fc('0x75')];_0x43d09e[_0xb7fc('0x26')][_0xb7fc('0x77')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0xb7fc('0x80'),'message':_0x43d09e[_0xb7fc('0x26')]},client9002);return _0x54a045;}return null;})['then'](respondWithResult(_0xf31f,null))[_0xb7fc('0x4e')](handleError(_0xf31f,null));};exports['status']=function(_0x3d7474,_0x25f8dc,_0x30f8e3){if(_0x3d7474[_0xb7fc('0x54')]['id']){delete _0x3d7474[_0xb7fc('0x54')]['id'];}var _0x397fd4;return db[_0xb7fc('0x37')]['find']({'where':{'id':_0x3d7474[_0xb7fc('0x50')]['id']}})['then'](handleEntityNotFound(_0x25f8dc,null))[_0xb7fc('0x1e')](function(_0x4d2fe9){if(_0x4d2fe9){_0x397fd4=_0x4d2fe9;return db[_0xb7fc('0x81')][_0xb7fc('0x52')]({'where':{'id':_0x4d2fe9['WhatsappAccountId']}});}})[_0xb7fc('0x1e')](handleEntityNotFound(_0x25f8dc,null))['then'](function(_0x35618e){if(_0x35618e){logger[_0xb7fc('0x82')](_0xb7fc('0x83'),_0xb7fc('0x2a'),_0xb7fc('0x84'),_0x35618e[_0xb7fc('0x39')],util[_0xb7fc('0x85')](_0x3d7474[_0xb7fc('0x54')],{'showHidden':![],'depth':null}));switch(_0x35618e[_0xb7fc('0x39')]){case _0xb7fc('0x86'):if(_0x3d7474['body'][_0xb7fc('0x87')]&&_0x3d7474[_0xb7fc('0x54')][_0xb7fc('0x87')]===_0x397fd4[_0xb7fc('0x88')]&&_0x3d7474['body'][_0xb7fc('0x89')]&&_0x3d7474[_0xb7fc('0x54')][_0xb7fc('0x89')]===_0xb7fc('0x5a')){return _0x397fd4[_0xb7fc('0x55')]({'read':!![]});}else{logger[_0xb7fc('0x24')](_0xb7fc('0x8a'),_0xb7fc('0x2a'),_0xb7fc('0x86'),util[_0xb7fc('0x85')](_0x3d7474['body'],{'showHidden':![],'depth':null}));}break;}return _0x397fd4;}})[_0xb7fc('0x1e')](respondWithResult(_0x25f8dc,null))[_0xb7fc('0x4e')](handleError(_0x25f8dc,null));}; \ No newline at end of file +var _0x7c52=['options','includeAll','include','findAll','rows','show','params','find','create','body','describe','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteractionId','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','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','WhatsappInteraction','null','RejectMessage','rejectMessage','rejectmessage','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','rimraf','zip-dir','fast-json-patch','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x7c52,0x14c));var _0x27c5=function(_0x1ba238,_0x240f26){_0x1ba238=_0x1ba238-0x0;var _0x4e020f=_0x7c52[_0x1ba238];return _0x4e020f;};'use strict';var emlformat=require(_0x27c5('0x0'));var rimraf=require(_0x27c5('0x1'));var zipdir=require(_0x27c5('0x2'));var jsonpatch=require(_0x27c5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x27c5('0x4'));var util=require('util');var path=require('path');var sox=require(_0x27c5('0x5'));var csv=require(_0x27c5('0x6'));var ejs=require(_0x27c5('0x7'));var fs=require('fs');var fs_extra=require(_0x27c5('0x8'));var _=require(_0x27c5('0x9'));var squel=require('squel');var crypto=require(_0x27c5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x27c5('0xb'));var toCsv=require(_0x27c5('0x6'));var querystring=require(_0x27c5('0xc'));var Papa=require(_0x27c5('0xd'));var Redis=require(_0x27c5('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x27c5('0xf'));var as=require(_0x27c5('0x10'));var hardwareService=require(_0x27c5('0x11'));var logger=require(_0x27c5('0x12'))(_0x27c5('0x13'));var utils=require('../../config/utils');var config=require(_0x27c5('0x14'));var licenseUtil=require(_0x27c5('0x15'));var db=require(_0x27c5('0x16'))['db'];config['redis']=_['defaults'](config[_0x27c5('0x17')],{'host':_0x27c5('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x27c5('0x17')]));require(_0x27c5('0x19'))[_0x27c5('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x27c5('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x27c5('0x1b')][_0x27c5('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2edba2,_0x171ab2,_0x43f7d4,_0x1aab57){return new BPromise(function(_0x442608,_0x3c1a94){var _0x11a0ed=_0x1aab57||client;return _0x11a0ed[_0x27c5('0x1d')](_0x2edba2,_0x43f7d4)[_0x27c5('0x1e')](function(_0x56b096){logger[_0x27c5('0x1f')](_0x27c5('0x20'),_0x171ab2,_0x27c5('0x21'));logger[_0x27c5('0x22')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x171ab2,'request\x20sent',JSON[_0x27c5('0x23')](_0x56b096));if(_0x56b096[_0x27c5('0x24')]){if(_0x56b096[_0x27c5('0x24')][_0x27c5('0x25')]===0x1f4){logger[_0x27c5('0x24')](_0x27c5('0x20'),_0x171ab2,_0x56b096[_0x27c5('0x24')][_0x27c5('0x26')]);return _0x3c1a94(_0x56b096[_0x27c5('0x24')][_0x27c5('0x26')]);}logger[_0x27c5('0x24')](_0x27c5('0x20'),_0x171ab2,_0x56b096[_0x27c5('0x24')][_0x27c5('0x26')]);return _0x442608(_0x56b096['error'][_0x27c5('0x26')]);}else{logger[_0x27c5('0x1f')](_0x27c5('0x20'),_0x171ab2,_0x27c5('0x21'));_0x442608(_0x56b096[_0x27c5('0x27')][_0x27c5('0x26')]);}})[_0x27c5('0x28')](function(_0x56986f){logger[_0x27c5('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x171ab2,_0x56986f);_0x3c1a94(_0x56986f);});});}function respondWithStatusCode(_0x5005a5,_0x3885b6){_0x3885b6=_0x3885b6||0xcc;return function(_0xc1a761){if(_0xc1a761){return _0x5005a5[_0x27c5('0x29')](_0x3885b6);}return _0x5005a5[_0x27c5('0x2a')](_0x3885b6)['end']();};}function respondWithResult(_0x12a324,_0x2f406c){_0x2f406c=_0x2f406c||0xc8;return function(_0x3841c7){if(_0x3841c7){return _0x12a324[_0x27c5('0x2a')](_0x2f406c)[_0x27c5('0x2b')](_0x3841c7);}};}function respondWithFilteredResult(_0x25f321,_0x5b1fed){return function(_0x279381){if(_0x279381){var _0x50a4b8=typeof _0x5b1fed['offset']==='undefined'&&typeof _0x5b1fed['limit']==='undefined';var _0x385908=_0x279381['count'];var _0x5dd61b=_0x50a4b8?0x0:_0x5b1fed['offset'];var _0x180579=_0x50a4b8?_0x279381[_0x27c5('0x2c')]:_0x5b1fed[_0x27c5('0x2d')]+_0x5b1fed['limit'];var _0x5dc24a;if(_0x180579>=_0x385908){_0x180579=_0x385908;_0x5dc24a=0xc8;}else{_0x5dc24a=0xce;}_0x25f321['status'](_0x5dc24a);return _0x25f321[_0x27c5('0x2e')](_0x27c5('0x2f'),_0x5dd61b+'-'+_0x180579+'/'+_0x385908)[_0x27c5('0x2b')](_0x279381);}return null;};}function patchUpdates(_0xa58590){return function(_0x216f17){try{jsonpatch[_0x27c5('0x30')](_0x216f17,_0xa58590,!![]);}catch(_0x43e681){return BPromise[_0x27c5('0x31')](_0x43e681);}return _0x216f17[_0x27c5('0x32')]();};}function saveUpdates(_0x397eed,_0x356d2a){return function(_0x1d49c1){if(_0x1d49c1){return _0x1d49c1[_0x27c5('0x33')](_0x397eed)[_0x27c5('0x1e')](function(_0x4f76b0){return _0x4f76b0;});}return null;};}function removeEntity(_0x2b65e1,_0x262874){return function(_0x20bf0d){if(_0x20bf0d){return _0x20bf0d[_0x27c5('0x34')]()[_0x27c5('0x1e')](function(){_0x2b65e1[_0x27c5('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a4988,_0x5b0b53){return function(_0x2dd640){if(!_0x2dd640){_0x5a4988[_0x27c5('0x29')](0x194);}return _0x2dd640;};}function handleError(_0x49b82b,_0x44a2e8){_0x44a2e8=_0x44a2e8||0x1f4;return function(_0x4d35a6){logger[_0x27c5('0x24')](_0x4d35a6['stack']);if(_0x4d35a6[_0x27c5('0x35')]){delete _0x4d35a6[_0x27c5('0x35')];}_0x49b82b[_0x27c5('0x2a')](_0x44a2e8)[_0x27c5('0x36')](_0x4d35a6);};}exports[_0x27c5('0x37')]=function(_0xb27f1,_0x5d5654){var _0x5ed6a5={},_0x17a9fb={},_0x473c66={'count':0x0,'rows':[]};var _0x1a6a13=_[_0x27c5('0x38')](db[_0x27c5('0x39')][_0x27c5('0x3a')],function(_0x2bdabd){return{'name':_0x2bdabd[_0x27c5('0x3b')],'type':_0x2bdabd[_0x27c5('0x3c')]['key']};});_0x17a9fb[_0x27c5('0x3d')]=_[_0x27c5('0x38')](_0x1a6a13,_0x27c5('0x35'));_0x17a9fb[_0x27c5('0x3e')]=_['keys'](_0xb27f1[_0x27c5('0x3e')]);_0x17a9fb[_0x27c5('0x3f')]=_[_0x27c5('0x40')](_0x17a9fb[_0x27c5('0x3d')],_0x17a9fb[_0x27c5('0x3e')]);_0x5ed6a5[_0x27c5('0x41')]=_['intersection'](_0x17a9fb['model'],qs['fields'](_0xb27f1[_0x27c5('0x3e')][_0x27c5('0x42')]));_0x5ed6a5[_0x27c5('0x41')]=_0x5ed6a5[_0x27c5('0x41')][_0x27c5('0x43')]?_0x5ed6a5[_0x27c5('0x41')]:_0x17a9fb[_0x27c5('0x3d')];if(!_0xb27f1['query'][_0x27c5('0x44')]('nolimit')){_0x5ed6a5['limit']=qs[_0x27c5('0x45')](_0xb27f1[_0x27c5('0x3e')][_0x27c5('0x45')]);_0x5ed6a5[_0x27c5('0x2d')]=qs['offset'](_0xb27f1[_0x27c5('0x3e')][_0x27c5('0x2d')]);}_0x5ed6a5[_0x27c5('0x46')]=qs[_0x27c5('0x47')](_0xb27f1['query'][_0x27c5('0x47')]);_0x5ed6a5[_0x27c5('0x48')]=qs['filters'](_[_0x27c5('0x49')](_0xb27f1[_0x27c5('0x3e')],_0x17a9fb[_0x27c5('0x3f')]),_0x1a6a13);if(_0xb27f1[_0x27c5('0x3e')][_0x27c5('0x4a')]){_0x5ed6a5[_0x27c5('0x48')]=_[_0x27c5('0x4b')](_0x5ed6a5[_0x27c5('0x48')],{'$or':_[_0x27c5('0x38')](_0x1a6a13,function(_0x17b876){if(_0x17b876['type']!=='VIRTUAL'){var _0x1f8139={};_0x1f8139[_0x17b876[_0x27c5('0x35')]]={'$like':'%'+_0xb27f1[_0x27c5('0x3e')]['filter']+'%'};return _0x1f8139;}})});}_0x5ed6a5=_['merge']({},_0x5ed6a5,_0xb27f1[_0x27c5('0x4c')]);var _0x26fcfb={'where':_0x5ed6a5['where']};return db[_0x27c5('0x39')][_0x27c5('0x2c')](_0x26fcfb)[_0x27c5('0x1e')](function(_0x57ea9b){_0x473c66[_0x27c5('0x2c')]=_0x57ea9b;if(_0xb27f1[_0x27c5('0x3e')][_0x27c5('0x4d')]){_0x5ed6a5[_0x27c5('0x4e')]=[{'all':!![]}];}return db[_0x27c5('0x39')][_0x27c5('0x4f')](_0x5ed6a5);})[_0x27c5('0x1e')](function(_0x4ec524){_0x473c66[_0x27c5('0x50')]=_0x4ec524;return _0x473c66;})['then'](respondWithFilteredResult(_0x5d5654,_0x5ed6a5))[_0x27c5('0x28')](handleError(_0x5d5654,null));};exports[_0x27c5('0x51')]=function(_0x544d85,_0x4b82e2){var _0x28af76={'raw':!![],'where':{'id':_0x544d85[_0x27c5('0x52')]['id']}},_0x575086={};_0x575086[_0x27c5('0x3d')]=_['keys'](db[_0x27c5('0x39')][_0x27c5('0x3a')]);_0x575086[_0x27c5('0x3e')]=_['keys'](_0x544d85['query']);_0x575086[_0x27c5('0x3f')]=_[_0x27c5('0x40')](_0x575086[_0x27c5('0x3d')],_0x575086[_0x27c5('0x3e')]);_0x28af76[_0x27c5('0x41')]=_[_0x27c5('0x40')](_0x575086[_0x27c5('0x3d')],qs[_0x27c5('0x42')](_0x544d85[_0x27c5('0x3e')][_0x27c5('0x42')]));_0x28af76[_0x27c5('0x41')]=_0x28af76[_0x27c5('0x41')][_0x27c5('0x43')]?_0x28af76['attributes']:_0x575086[_0x27c5('0x3d')];if(_0x544d85[_0x27c5('0x3e')][_0x27c5('0x4d')]){_0x28af76[_0x27c5('0x4e')]=[{'all':!![]}];}_0x28af76=_[_0x27c5('0x4b')]({},_0x28af76,_0x544d85[_0x27c5('0x4c')]);return db['WhatsappMessage'][_0x27c5('0x53')](_0x28af76)[_0x27c5('0x1e')](handleEntityNotFound(_0x4b82e2,null))['then'](respondWithResult(_0x4b82e2,null))[_0x27c5('0x28')](handleError(_0x4b82e2,null));};exports[_0x27c5('0x54')]=function(_0x1f535d,_0x96363){return db[_0x27c5('0x39')][_0x27c5('0x54')](_0x1f535d[_0x27c5('0x55')],{})[_0x27c5('0x1e')](respondWithResult(_0x96363,0xc9))[_0x27c5('0x28')](handleError(_0x96363,null));};exports[_0x27c5('0x33')]=function(_0x2a46b2,_0x520ba7){if(_0x2a46b2[_0x27c5('0x55')]['id']){delete _0x2a46b2['body']['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x2a46b2[_0x27c5('0x52')]['id']}})[_0x27c5('0x1e')](handleEntityNotFound(_0x520ba7,null))[_0x27c5('0x1e')](saveUpdates(_0x2a46b2['body'],null))[_0x27c5('0x1e')](respondWithResult(_0x520ba7,null))[_0x27c5('0x28')](handleError(_0x520ba7,null));};exports['destroy']=function(_0x3dfd85,_0x530cbc){return db[_0x27c5('0x39')][_0x27c5('0x53')]({'where':{'id':_0x3dfd85[_0x27c5('0x52')]['id']}})['then'](handleEntityNotFound(_0x530cbc,null))[_0x27c5('0x1e')](removeEntity(_0x530cbc,null))['catch'](handleError(_0x530cbc,null));};exports[_0x27c5('0x56')]=function(_0x47f657,_0x3c2223){return db['WhatsappMessage']['describe']()[_0x27c5('0x1e')](respondWithResult(_0x3c2223,null))[_0x27c5('0x28')](handleError(_0x3c2223,null));};var interaction_log=require(_0x27c5('0x12'))('whatsapp-interactions');exports[_0x27c5('0x57')]=function(_0x31b87a,_0x34b04d,_0x349377){var _0x6908e2={'agent':{},'channel':_0x27c5('0x58')};if(_0x31b87a[_0x27c5('0x55')]['id']){delete _0x31b87a[_0x27c5('0x55')]['id'];}_0x31b87a[_0x27c5('0x55')][_0x27c5('0x59')]=!![];_0x31b87a['body'][_0x27c5('0x5a')]=moment()['format'](_0x27c5('0x5b'));_0x31b87a[_0x27c5('0x55')][_0x27c5('0x5c')]=_0x31b87a[_0x27c5('0x55')][_0x27c5('0x5c')]||_0x31b87a['user']['id'];_0x6908e2[_0x27c5('0x5d')]['id']=_0x31b87a[_0x27c5('0x55')][_0x27c5('0x5c')];return db[_0x27c5('0x39')]['find']({'where':{'id':_0x31b87a[_0x27c5('0x52')]['id'],'UserId':null}})[_0x27c5('0x1e')](handleEntityNotFound(_0x34b04d,null))[_0x27c5('0x1e')](saveUpdates(_0x31b87a[_0x27c5('0x55')],null))[_0x27c5('0x1e')](function(_0x1a639d){if(_0x1a639d){_0x6908e2[_0x27c5('0x26')]=_0x1a639d[_0x27c5('0x5e')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x1a639d[_0x27c5('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x34b04d,null))[_0x27c5('0x1e')](function(_0x459546){if(_0x459546){return _0x459546['update']({'UserId':_0x31b87a['body'][_0x27c5('0x5c')],'read1stAt':_['isNil'](_0x459546[_0x27c5('0x60')])?moment()[_0x27c5('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x27c5('0x1e')](function(_0x547605){if(_0x547605){_0x6908e2[_0x27c5('0x62')]=_0x547605[_0x27c5('0x5e')]({'plain':!![]});interaction_log[_0x27c5('0x1f')](_0x27c5('0x63'),_0x31b87a[_0x27c5('0x64')]['id'],_0x31b87a[_0x27c5('0x64')][_0x27c5('0x35')],_0x31b87a[_0x27c5('0x64')][_0x27c5('0x65')],_0x6908e2[_0x27c5('0x62')]['id'],_0x31b87a['body']?JSON[_0x27c5('0x23')](_0x31b87a['body']):'null');return respondWithRpcPromise(_0x27c5('0x66'),_0x27c5('0x67'),_0x6908e2);}return null;})[_0x27c5('0x1e')](function(_0x411e6e){var _0x292c71=_0x27c5('0x68')+_0x411e6e[_0x27c5('0x26')][_0x27c5('0x69')];return db[_0x27c5('0x6a')]['query'](_0x292c71,{'type':db[_0x27c5('0x6b')][_0x27c5('0x6c')][_0x27c5('0x6d')],'raw':!![]})[_0x27c5('0x1e')](function(_0x5a5598){return _0x5a5598;});})[_0x27c5('0x1e')](function(_0xd7edf7){if(_0xd7edf7){_0x6908e2[_0x27c5('0x26')][_0x27c5('0x6e')]=_0xd7edf7[0x0];if(!_0x31b87a[_0x27c5('0x55')][_0x27c5('0x5c')])return;return db[_0x27c5('0x6f')][_0x27c5('0x53')]({'where':{'id':_0x31b87a[_0x27c5('0x55')][_0x27c5('0x5c')],'role':_0x27c5('0x5d')},'attributes':['id',_0x27c5('0x35'),_0x27c5('0x70'),_0x27c5('0x71'),_0x27c5('0x72')],'raw':!![]});}return null;})[_0x27c5('0x1e')](function(_0x4355cf){if(!_0x4355cf)return null;_0x6908e2['message']['agent']=_0x4355cf;return _0x6908e2;})[_0x27c5('0x1e')](function(_0x4f2992){if(_0x4f2992){if(_0x31b87a[_0x27c5('0x55')][_0x27c5('0x73')]){_0x6908e2[_0x27c5('0x26')][_0x27c5('0x74')]=util[_0x27c5('0x61')](_0x27c5('0x75'),_0x31b87a[_0x27c5('0x64')][_0x27c5('0x35')]);_0x6908e2[_0x27c5('0x26')][_0x27c5('0x76')]=_0x6908e2['channel'];_0x6908e2['message'][_0x27c5('0x77')]=_0x6908e2['channel'];_0x6908e2[_0x27c5('0x26')][_0x27c5('0x78')]=_0x27c5('0x57');return respondWithRpcPromise('EventManager',_0x27c5('0x79'),{'event':_0x27c5('0x7a'),'message':_0x6908e2[_0x27c5('0x26')]},client9002)['then'](function(){return _0x6908e2;});}return _0x6908e2;}return null;})[_0x27c5('0x1e')](respondWithResult(_0x34b04d,null))[_0x27c5('0x28')](handleError(_0x34b04d,null));};var interaction_log=require(_0x27c5('0x12'))('whatsapp-interactions');exports['reject']=function(_0xc96fe4,_0x2d99d0,_0x40a4de){var _0x4c353c={'agent':{},'channel':'whatsapp'};if(_0xc96fe4[_0x27c5('0x55')]['id']){delete _0xc96fe4[_0x27c5('0x55')]['id'];}_0xc96fe4[_0x27c5('0x55')]['UserId']=_0xc96fe4[_0x27c5('0x55')][_0x27c5('0x5c')]||_0xc96fe4[_0x27c5('0x64')]['id'];_0x4c353c['agent']['id']=_0xc96fe4[_0x27c5('0x55')]['UserId'];return db['WhatsappMessage'][_0x27c5('0x53')]({'where':{'id':_0xc96fe4[_0x27c5('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2d99d0,null))['then'](function(_0x57a8d7){if(_0x57a8d7){_0x4c353c[_0x27c5('0x26')]=_0x57a8d7[_0x27c5('0x5e')]({'plain':!![]});return db[_0x27c5('0x7b')][_0x27c5('0x53')]({'where':{'id':_0x57a8d7[_0x27c5('0x5f')]}});}return null;})[_0x27c5('0x1e')](handleEntityNotFound(_0x2d99d0,null))[_0x27c5('0x1e')](function(_0x45096c){if(_0x45096c){_0x4c353c[_0x27c5('0x62')]=_0x45096c[_0x27c5('0x5e')]({'plain':!![]});interaction_log[_0x27c5('0x1f')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xc96fe4[_0x27c5('0x64')]['id'],_0xc96fe4[_0x27c5('0x64')][_0x27c5('0x35')],_0xc96fe4[_0x27c5('0x64')][_0x27c5('0x65')],_0x4c353c[_0x27c5('0x62')]['id'],_0xc96fe4[_0x27c5('0x55')]?JSON['stringify'](_0xc96fe4['body']):_0x27c5('0x7c'));return respondWithRpcPromise(_0x27c5('0x7d'),_0x27c5('0x7e'),_0x4c353c);}return null;})['then'](function(_0x187b60){var _0x15a6aa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x187b60['message']['ContactId'];return db[_0x27c5('0x6a')]['query'](_0x15a6aa,{'type':db[_0x27c5('0x6b')][_0x27c5('0x6c')][_0x27c5('0x6d')],'raw':!![]})[_0x27c5('0x1e')](function(_0x67c49f){return _0x67c49f;});})['then'](function(_0x453d98){if(_0x453d98){_0x4c353c[_0x27c5('0x26')][_0x27c5('0x6e')]=_0x453d98[0x0];if(!_0xc96fe4['body'][_0x27c5('0x5c')])return;return db['User'][_0x27c5('0x53')]({'where':{'id':_0xc96fe4['body']['UserId'],'role':_0x27c5('0x5d')},'attributes':['id',_0x27c5('0x35'),_0x27c5('0x70'),'email','internal'],'raw':!![]});}return null;})[_0x27c5('0x1e')](function(_0x258eaf){if(!_0x258eaf)return null;_0x4c353c[_0x27c5('0x26')][_0x27c5('0x5d')]=_0x258eaf;return _0x4c353c;})['then'](function(_0x354822){if(_0x354822){_0x354822['message'][_0x27c5('0x74')]=util[_0x27c5('0x61')]('SIP/%s',_0xc96fe4[_0x27c5('0x64')][_0x27c5('0x35')]);_0x354822[_0x27c5('0x26')]['channel']=_0x4c353c[_0x27c5('0x76')];_0x354822[_0x27c5('0x26')][_0x27c5('0x77')]=_0x4c353c['channel'];_0x354822['message']['event']=_0x27c5('0x31');respondWithRpcPromise(_0x27c5('0x79'),'EventManager',{'event':_0x27c5('0x7f'),'message':_0x354822[_0x27c5('0x26')]},client9002);return _0x4c353c;}return null;})[_0x27c5('0x1e')](respondWithResult(_0x2d99d0,null))[_0x27c5('0x28')](handleError(_0x2d99d0,null));};exports[_0x27c5('0x2a')]=function(_0x55447f,_0x31f2e6,_0x33cdc0){if(_0x55447f[_0x27c5('0x55')]['id']){delete _0x55447f['body']['id'];}var _0x358d1c;return db[_0x27c5('0x39')][_0x27c5('0x53')]({'where':{'id':_0x55447f[_0x27c5('0x52')]['id']}})[_0x27c5('0x1e')](handleEntityNotFound(_0x31f2e6,null))[_0x27c5('0x1e')](function(_0x5779c5){if(_0x5779c5){_0x358d1c=_0x5779c5;return db['WhatsappAccount'][_0x27c5('0x53')]({'where':{'id':_0x5779c5['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x31f2e6,null))[_0x27c5('0x1e')](function(_0x5b97a9){if(_0x5b97a9){logger['debug'](_0x27c5('0x80'),_0x27c5('0x2a'),_0x27c5('0x81'),_0x5b97a9[_0x27c5('0x3c')],util['inspect'](_0x55447f[_0x27c5('0x55')],{'showHidden':![],'depth':null}));switch(_0x5b97a9['type']){case _0x27c5('0x82'):if(_0x55447f[_0x27c5('0x55')][_0x27c5('0x83')]&&_0x55447f['body'][_0x27c5('0x83')]===_0x358d1c[_0x27c5('0x84')]&&_0x55447f[_0x27c5('0x55')]['MessageStatus']&&_0x55447f['body'][_0x27c5('0x85')]==='read'){return _0x358d1c[_0x27c5('0x33')]({'read':!![]});}else{logger[_0x27c5('0x24')](_0x27c5('0x86'),'status','twilio',util[_0x27c5('0x87')](_0x55447f['body'],{'showHidden':![],'depth':null}));}break;}return _0x358d1c;}})['then'](respondWithResult(_0x31f2e6,null))['catch'](handleError(_0x31f2e6,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 323ef71..a7e42cb 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 _0xe511=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x11f5ff,_0xa0ef18){var _0x46eefb=function(_0x51872a){while(--_0x51872a){_0x11f5ff['push'](_0x11f5ff['shift']());}};_0x46eefb(++_0xa0ef18);}(_0xe511,0x16f));var _0x1e51=function(_0x5c811c,_0x313b25){_0x5c811c=_0x5c811c-0x0;var _0x5df3af=_0xe511[_0x5c811c];return _0x5df3af;};'use strict';var EventEmitter=require(_0x1e51('0x0'));var WhatsappMessage=require(_0x1e51('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x1e51('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1e51('0x3'),'afterDestroy':_0x1e51('0x4')};function emitEvent(_0x5bfa5d){return function(_0x42e242,_0x2be2b7,_0x204da7){WhatsappMessageEvents[_0x1e51('0x5')](_0x5bfa5d+':'+_0x42e242['id'],_0x42e242);WhatsappMessageEvents['emit'](_0x5bfa5d,_0x42e242);_0x204da7(null);};}for(var e in events){if(events[_0x1e51('0x6')](e)){var event=events[e];WhatsappMessage[_0x1e51('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xde2c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0xde2c,0x7f));var _0xcde2=function(_0x4232d8,_0x13fd09){_0x4232d8=_0x4232d8-0x0;var _0x324de2=_0xde2c[_0x4232d8];return _0x324de2;};'use strict';var EventEmitter=require(_0xcde2('0x0'));var WhatsappMessage=require(_0xcde2('0x1'))['db'][_0xcde2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xcde2('0x3')](0x0);var events={'afterCreate':_0xcde2('0x4'),'afterUpdate':_0xcde2('0x5'),'afterDestroy':_0xcde2('0x6')};function emitEvent(_0x3a309f){return function(_0x55c175,_0x4353c8,_0x196898){WhatsappMessageEvents[_0xcde2('0x7')](_0x3a309f+':'+_0x55c175['id'],_0x55c175);WhatsappMessageEvents[_0xcde2('0x7')](_0x3a309f,_0x55c175);_0x196898(null);};}for(var e in events){if(events[_0xcde2('0x8')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xcde2('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 3acdfc0..36c71d0 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 _0x9d3e=['Bearer\x20','application/json','statuses','message_id','catch','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','isNil','UserId','WhatsappInteraction','findOne','then','update','createdAt','out','secret','WhatsappAccount','find','type','twilio','accountSid','messages','whatsapp:','phone','remote','/status?token=','token','sid','error','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','authToken','/whatsapp/v1/','/messages/','text','POST'];(function(_0x380806,_0xcba312){var _0x401022=function(_0xf66ad4){while(--_0xf66ad4){_0x380806['push'](_0x380806['shift']());}};_0x401022(++_0xcba312);}(_0x9d3e,0x1c3));var _0xe9d3=function(_0x5db23e,_0x2075db){_0x5db23e=_0x5db23e-0x0;var _0x28a1fa=_0x9d3e[_0x5db23e];return _0x28a1fa;};'use strict';var _=require(_0xe9d3('0x0'));var util=require(_0xe9d3('0x1'));var logger=require(_0xe9d3('0x2'))(_0xe9d3('0x3'));var moment=require(_0xe9d3('0x4'));var BPromise=require(_0xe9d3('0x5'));var rp=require(_0xe9d3('0x6'));var fetch=require(_0xe9d3('0x7'));var fs=require('fs');var path=require(_0xe9d3('0x8'));var rimraf=require(_0xe9d3('0x9'));var config=require(_0xe9d3('0xa'));var attributes=require(_0xe9d3('0xb'));module[_0xe9d3('0xc')]=function(_0x36b7ba,_0x2af894){return _0x36b7ba[_0xe9d3('0xd')]('WhatsappMessage',attributes,{'tableName':_0xe9d3('0xe'),'paranoid':![],'indexes':[{'name':_0xe9d3('0xf'),'fields':['messageId']},{'name':_0xe9d3('0x10'),'fields':[_0xe9d3('0x11')],'type':_0xe9d3('0x12')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3eb2eb,_0x23f4db,_0x4d79d5){var _0x2559ef=_0x36b7ba[_0xe9d3('0x13')];var _0x435693=_0x3eb2eb['get']({'plain':!![]});if(_0x435693[_0xe9d3('0x14')][_0xe9d3('0x15')]()==='in'||_0x435693[_0xe9d3('0x14')][_0xe9d3('0x15')]()==='out'&&!_0x435693['secret']&&!_[_0xe9d3('0x16')](_0x435693[_0xe9d3('0x17')])){_0x2559ef[_0xe9d3('0x18')][_0xe9d3('0x19')]({'where':{'id':_0x435693['WhatsappInteractionId']}})[_0xe9d3('0x1a')](function(_0x2f426c){if(_0x2f426c){_0x2f426c[_0xe9d3('0x1b')]({'lastMsgAt':_0x435693[_0xe9d3('0x1c')],'lastMsgDirection':_0x435693['direction'][_0xe9d3('0x15')]()});}})['catch'](function(_0x29c408){console['error'](_0x29c408);});}if(_0x435693['direction']===_0xe9d3('0x1d')&&!_0x435693[_0xe9d3('0x1e')]){var _0x9b17b9;_0x2559ef[_0xe9d3('0x1f')][_0xe9d3('0x20')]({'where':{'id':_0x435693['WhatsappAccountId']},'raw':!![]})['then'](function(_0x47295e){_0x9b17b9=_0x47295e;if(_0x9b17b9&&_0x9b17b9[_0xe9d3('0x21')]){switch(_0x9b17b9[_0xe9d3('0x21')]){case'twilio':var _0x29bcb0=require(_0xe9d3('0x22'));if(_0x9b17b9[_0xe9d3('0x23')]&&_0x9b17b9['authToken']&&_0x9b17b9['phone']){var _0x159cdd=new _0x29bcb0(_0x9b17b9[_0xe9d3('0x23')],_0x9b17b9['authToken']);_0x159cdd[_0xe9d3('0x24')]['create']({'body':_0x435693['body'],'to':_0xe9d3('0x25')+_0x435693[_0xe9d3('0x26')],'from':_0xe9d3('0x25')+_0x9b17b9['phone'],'statusCallback':_0x9b17b9[_0xe9d3('0x27')]+'/api/whatsapp/messages/'+_0x435693['id']+_0xe9d3('0x28')+_0x9b17b9[_0xe9d3('0x29')]})[_0xe9d3('0x1a')](function(_0x38a0a3){if(_0x38a0a3[_0xe9d3('0x2a')]){return _0x3eb2eb[_0xe9d3('0x1b')]({'messageId':_0x38a0a3['sid']});}})['catch'](function(_0x27cc60){logger[_0xe9d3('0x2b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xe9d3('0x2c'),_0xe9d3('0x22'),util[_0xe9d3('0x2d')](_0x27cc60,{'showHidden':![],'depth':null}));});}else{logger[_0xe9d3('0x2b')](_0xe9d3('0x2e'),_0xe9d3('0x2c'),'twilio',_0xe9d3('0x2f'));}break;case'sinch':var _0x4ba2bc=_0x9b17b9[_0xe9d3('0x23')];var _0x4bc3d=_0x9b17b9[_0xe9d3('0x30')];var _0x3f3eeb=_0x9b17b9['baseUrl']+_0xe9d3('0x31')+_0x4ba2bc+_0xe9d3('0x32');var _0x377c8c={'to':[_0x435693[_0xe9d3('0x26')]],'message':{'type':_0xe9d3('0x33'),'text':_0x435693[_0xe9d3('0x11')]}};var _0x3a8369={'method':_0xe9d3('0x34'),'uri':_0x3f3eeb,'headers':{'Authorization':_0xe9d3('0x35')+_0x4bc3d,'Content-Type':_0xe9d3('0x36')},'body':_0x377c8c,'json':!![]};rp(_0x3a8369)[_0xe9d3('0x1a')](function(_0x3659c4){if(_0x3659c4[_0xe9d3('0x37')][0x0][_0xe9d3('0x38')]){return _0x3eb2eb[_0xe9d3('0x1b')]({'messageId':_0x3659c4[_0xe9d3('0x37')][0x0][_0xe9d3('0x38')]});}})[_0xe9d3('0x39')](function(_0x48ab7c){logger[_0xe9d3('0x3a')](_0xe9d3('0x3b'),_0x48ab7c);});break;}}})[_0xe9d3('0x3c')](function(){_0x4d79d5();});}else{_0x4d79d5();}}},'charset':_0xe9d3('0x3d'),'collate':_0xe9d3('0x3e')});}; \ No newline at end of file +var _0xcc4c=['baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','message_id','catch','err','WhatsappMessage,\x20%s','utf8mb4','lodash','util','../../config/logger','moment','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','WhatsappInteraction','findOne','then','update','createdAt','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch'];(function(_0x505f73,_0x1f95d8){var _0x227e7f=function(_0x112ae8){while(--_0x112ae8){_0x505f73['push'](_0x505f73['shift']());}};_0x227e7f(++_0x1f95d8);}(_0xcc4c,0x1e4));var _0xccc4=function(_0x26e6e5,_0x2c16ae){_0x26e6e5=_0x26e6e5-0x0;var _0x5ea5b8=_0xcc4c[_0x26e6e5];return _0x5ea5b8;};'use strict';var _=require(_0xccc4('0x0'));var util=require(_0xccc4('0x1'));var logger=require(_0xccc4('0x2'))('api');var moment=require(_0xccc4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0xccc4('0x4'));var fs=require('fs');var path=require(_0xccc4('0x5'));var rimraf=require(_0xccc4('0x6'));var config=require(_0xccc4('0x7'));var attributes=require(_0xccc4('0x8'));module['exports']=function(_0x4478b0,_0x57ad42){return _0x4478b0[_0xccc4('0x9')](_0xccc4('0xa'),attributes,{'tableName':_0xccc4('0xb'),'paranoid':![],'indexes':[{'name':_0xccc4('0xc'),'fields':['messageId']},{'name':_0xccc4('0xd'),'fields':[_0xccc4('0xe')],'type':_0xccc4('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31d19f,_0x5726ec,_0x5697b9){var _0x205112=_0x4478b0[_0xccc4('0x10')];var _0x2febce=_0x31d19f[_0xccc4('0x11')]({'plain':!![]});if(_0x2febce[_0xccc4('0x12')][_0xccc4('0x13')]()==='in'||_0x2febce[_0xccc4('0x12')]['toLowerCase']()==='out'&&!_0x2febce[_0xccc4('0x14')]&&!_[_0xccc4('0x15')](_0x2febce['UserId'])){_0x205112[_0xccc4('0x16')][_0xccc4('0x17')]({'where':{'id':_0x2febce['WhatsappInteractionId']}})[_0xccc4('0x18')](function(_0x44a0d3){if(_0x44a0d3){_0x44a0d3[_0xccc4('0x19')]({'lastMsgAt':_0x2febce[_0xccc4('0x1a')],'lastMsgDirection':_0x2febce[_0xccc4('0x12')]['toLowerCase']()});}})['catch'](function(_0x254982){console[_0xccc4('0x1b')](_0x254982);});}if(_0x2febce[_0xccc4('0x12')]==='out'&&!_0x2febce[_0xccc4('0x14')]){var _0x5cf51f;_0x205112[_0xccc4('0x1c')][_0xccc4('0x1d')]({'where':{'id':_0x2febce[_0xccc4('0x1e')]},'raw':!![]})['then'](function(_0x1cfd80){_0x5cf51f=_0x1cfd80;if(_0x5cf51f&&_0x5cf51f[_0xccc4('0x1f')]){switch(_0x5cf51f[_0xccc4('0x1f')]){case'twilio':var _0x26a735=require(_0xccc4('0x20'));if(_0x5cf51f[_0xccc4('0x21')]&&_0x5cf51f['authToken']&&_0x5cf51f[_0xccc4('0x22')]){var _0x562fd5=new _0x26a735(_0x5cf51f[_0xccc4('0x21')],_0x5cf51f[_0xccc4('0x23')]);_0x562fd5[_0xccc4('0x24')][_0xccc4('0x25')]({'body':_0x2febce['body'],'to':'whatsapp:'+_0x2febce[_0xccc4('0x22')],'from':_0xccc4('0x26')+_0x5cf51f['phone'],'statusCallback':_0x5cf51f['remote']+'/api/whatsapp/messages/'+_0x2febce['id']+_0xccc4('0x27')+_0x5cf51f[_0xccc4('0x28')]})[_0xccc4('0x18')](function(_0x397166){if(_0x397166['sid']){return _0x31d19f[_0xccc4('0x19')]({'messageId':_0x397166[_0xccc4('0x29')]});}})['catch'](function(_0x875be0){logger[_0xccc4('0x1b')](_0xccc4('0x2a'),_0xccc4('0x2b'),_0xccc4('0x20'),util[_0xccc4('0x2c')](_0x875be0,{'showHidden':![],'depth':null}));});}else{logger[_0xccc4('0x1b')](_0xccc4('0x2a'),_0xccc4('0x2b'),_0xccc4('0x20'),_0xccc4('0x2d'));}break;case _0xccc4('0x2e'):var _0x11c7ba=_0x5cf51f[_0xccc4('0x21')];var _0x2ea8dd=_0x5cf51f[_0xccc4('0x23')];var _0x4e53f4=_0x5cf51f[_0xccc4('0x2f')]+_0xccc4('0x30')+_0x11c7ba+_0xccc4('0x31');var _0x4c044a={'to':[_0x2febce['phone']],'message':{'type':_0xccc4('0x32'),'text':_0x2febce[_0xccc4('0xe')]}};var _0x4c7dda={'method':_0xccc4('0x33'),'uri':_0x4e53f4,'headers':{'Authorization':'Bearer\x20'+_0x2ea8dd,'Content-Type':_0xccc4('0x34')},'body':_0x4c044a,'json':!![]};rp(_0x4c7dda)[_0xccc4('0x18')](function(_0xff11c9){if(_0xff11c9[_0xccc4('0x35')][0x0]['message_id']){return _0x31d19f[_0xccc4('0x19')]({'messageId':_0xff11c9[_0xccc4('0x35')][0x0][_0xccc4('0x36')]});}})[_0xccc4('0x37')](function(_0x691803){logger[_0xccc4('0x38')](_0xccc4('0x39'),_0x691803);});break;}}})['finally'](function(){_0x5697b9();});}else{_0x5697b9();}}},'charset':_0xccc4('0x3a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index b207dc0..0c4842f 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 _0xde7b=['defaults','localhost','./whatsappMessage.socket','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','WhatsappMessage','create','options','info','CreateWhatsappMessage','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x587462,_0x5df999){var _0x21df33=function(_0x364191){while(--_0x364191){_0x587462['push'](_0x587462['shift']());}};_0x21df33(++_0x5df999);}(_0xde7b,0xcd));var _0xbde7=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xde7b[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0xbde7('0x0'));var util=require(_0xbde7('0x1'));var moment=require(_0xbde7('0x2'));var BPromise=require(_0xbde7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbde7('0x4'))['db'];var utils=require(_0xbde7('0x5'));var logger=require(_0xbde7('0x6'))(_0xbde7('0x7'));var config=require(_0xbde7('0x8'));var jayson=require(_0xbde7('0x9'));var client=jayson['client'][_0xbde7('0xa')]({'port':0x232a});config[_0xbde7('0xb')]=_[_0xbde7('0xc')](config['redis'],{'host':_0xbde7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbde7('0xb')]));require(_0xbde7('0xe'))['register'](socket);function respondWithRpcPromise(_0x3cae71,_0x4f96fb,_0x1283df){return new BPromise(function(_0x35517d,_0x8146e7){return client[_0xbde7('0xf')](_0x3cae71,_0x1283df)[_0xbde7('0x10')](function(_0x2a6294){logger['info'](_0xbde7('0x11'),_0x4f96fb,_0xbde7('0x12'));logger[_0xbde7('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4f96fb,_0xbde7('0x12'),JSON[_0xbde7('0x14')](_0x2a6294));if(_0x2a6294[_0xbde7('0x15')]){if(_0x2a6294[_0xbde7('0x15')][_0xbde7('0x16')]===0x1f4){logger[_0xbde7('0x15')](_0xbde7('0x11'),_0x4f96fb,_0x2a6294[_0xbde7('0x15')][_0xbde7('0x17')]);return _0x8146e7(_0x2a6294[_0xbde7('0x15')]['message']);}logger[_0xbde7('0x15')](_0xbde7('0x11'),_0x4f96fb,_0x2a6294[_0xbde7('0x15')]['message']);return _0x35517d(_0x2a6294[_0xbde7('0x15')][_0xbde7('0x17')]);}else{logger['info'](_0xbde7('0x11'),_0x4f96fb,_0xbde7('0x12'));_0x35517d(_0x2a6294[_0xbde7('0x18')][_0xbde7('0x17')]);}})[_0xbde7('0x19')](function(_0x2c233c){logger[_0xbde7('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x4f96fb,_0x2c233c);_0x8146e7(_0x2c233c);});});}exports['CreateWhatsappMessage']=function(_0xfa7bca){var _0x1b1648=this;return new Promise(function(_0x12abdb,_0x574dfa){return db[_0xbde7('0x1a')][_0xbde7('0x1b')](_0xfa7bca['body'],{'raw':_0xfa7bca[_0xbde7('0x1c')]?_0xfa7bca['options']['raw']===undefined?!![]:![]:!![]})[_0xbde7('0x10')](function(_0x21572a){logger[_0xbde7('0x1d')](_0xbde7('0x1e'),_0xfa7bca);logger[_0xbde7('0x13')](_0xbde7('0x1e'),_0xfa7bca,JSON[_0xbde7('0x14')](_0x21572a));_0x12abdb(_0x21572a);})[_0xbde7('0x19')](function(_0x5c8db3){logger[_0xbde7('0x15')]('CreateWhatsappMessage',_0x5c8db3[_0xbde7('0x17')],_0xfa7bca);_0x574dfa(_0x1b1648[_0xbde7('0x15')](0x1f4,_0x5c8db3[_0xbde7('0x17')]));});});}; \ No newline at end of file +var _0x384e=['CreateWhatsappMessage','WhatsappMessage','create','body','options','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x5a1a51,_0x144c79){var _0x47edd7=function(_0x2259bb){while(--_0x2259bb){_0x5a1a51['push'](_0x5a1a51['shift']());}};_0x47edd7(++_0x144c79);}(_0x384e,0x89));var _0xe384=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x384e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe384('0x0'));var util=require(_0xe384('0x1'));var moment=require(_0xe384('0x2'));var BPromise=require(_0xe384('0x3'));var rs=require(_0xe384('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe384('0x5'))['db'];var utils=require(_0xe384('0x6'));var logger=require(_0xe384('0x7'))('rpc');var config=require(_0xe384('0x8'));var jayson=require(_0xe384('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xe384('0xa')]=_['defaults'](config['redis'],{'host':_0xe384('0xb'),'port':0x18eb});var socket=require(_0xe384('0xc'))(new Redis(config[_0xe384('0xa')]));require(_0xe384('0xd'))[_0xe384('0xe')](socket);function respondWithRpcPromise(_0x4d0fe3,_0x5d9ea1,_0x3fa4c8){return new BPromise(function(_0x297b90,_0x4cac59){return client[_0xe384('0xf')](_0x4d0fe3,_0x3fa4c8)[_0xe384('0x10')](function(_0x3ed091){logger[_0xe384('0x11')](_0xe384('0x12'),_0x5d9ea1,'request\x20sent');logger[_0xe384('0x13')](_0xe384('0x14'),_0x5d9ea1,'request\x20sent',JSON[_0xe384('0x15')](_0x3ed091));if(_0x3ed091['error']){if(_0x3ed091[_0xe384('0x16')][_0xe384('0x17')]===0x1f4){logger['error'](_0xe384('0x12'),_0x5d9ea1,_0x3ed091[_0xe384('0x16')][_0xe384('0x18')]);return _0x4cac59(_0x3ed091[_0xe384('0x16')][_0xe384('0x18')]);}logger['error'](_0xe384('0x12'),_0x5d9ea1,_0x3ed091['error'][_0xe384('0x18')]);return _0x297b90(_0x3ed091[_0xe384('0x16')][_0xe384('0x18')]);}else{logger[_0xe384('0x11')](_0xe384('0x12'),_0x5d9ea1,_0xe384('0x19'));_0x297b90(_0x3ed091[_0xe384('0x1a')][_0xe384('0x18')]);}})[_0xe384('0x1b')](function(_0x3b4f67){logger[_0xe384('0x16')](_0xe384('0x12'),_0x5d9ea1,_0x3b4f67);_0x4cac59(_0x3b4f67);});});}exports[_0xe384('0x1c')]=function(_0x4a864f){var _0x3e168b=this;return new Promise(function(_0x4f4103,_0x2d7a7e){return db[_0xe384('0x1d')][_0xe384('0x1e')](_0x4a864f[_0xe384('0x1f')],{'raw':_0x4a864f['options']?_0x4a864f[_0xe384('0x20')]['raw']===undefined?!![]:![]:!![]})[_0xe384('0x10')](function(_0x2dc6fa){logger[_0xe384('0x11')]('CreateWhatsappMessage',_0x4a864f);logger['debug'](_0xe384('0x1c'),_0x4a864f,JSON[_0xe384('0x15')](_0x2dc6fa));_0x4f4103(_0x2dc6fa);})[_0xe384('0x1b')](function(_0x36fcd8){logger[_0xe384('0x16')](_0xe384('0x1c'),_0x36fcd8[_0xe384('0x18')],_0x4a864f);_0x2d7a7e(_0x3e168b[_0xe384('0x16')](0x1f4,_0x36fcd8[_0xe384('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index ad9449b..127a6f7 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 _0x0aca=['save','remove','update','emit','removeListener','register','whatsappMessage:','./whatsappMessage.events'];(function(_0x321382,_0x4b9070){var _0x2eaaf0=function(_0x5cebce){while(--_0x5cebce){_0x321382['push'](_0x321382['shift']());}};_0x2eaaf0(++_0x4b9070);}(_0x0aca,0xcf));var _0xa0ac=function(_0x5af459,_0x45d683){_0x5af459=_0x5af459-0x0;var _0x5ac0ae=_0x0aca[_0x5af459];return _0x5ac0ae;};'use strict';var WhatsappMessageEvents=require(_0xa0ac('0x0'));var events=[_0xa0ac('0x1'),_0xa0ac('0x2'),_0xa0ac('0x3')];function createListener(_0x5cbd55,_0x5a9c72){return function(_0x34dc98){_0x5a9c72[_0xa0ac('0x4')](_0x5cbd55,_0x34dc98);};}function removeListener(_0x1e1c80,_0x2d2829){return function(){WhatsappMessageEvents[_0xa0ac('0x5')](_0x1e1c80,_0x2d2829);};}exports[_0xa0ac('0x6')]=function(_0x53caf4){for(var _0x5af717=0x0,_0x65583c=events['length'];_0x5af717<_0x65583c;_0x5af717++){var _0x258afc=events[_0x5af717];var _0x270fc2=createListener(_0xa0ac('0x7')+_0x258afc,_0x53caf4);WhatsappMessageEvents['on'](_0x258afc,_0x270fc2);}}; \ No newline at end of file +var _0x9e6a=['./whatsappMessage.events','remove','update','emit','removeListener','length','whatsappMessage:'];(function(_0x107f6c,_0x4ed971){var _0x43e026=function(_0x407fc5){while(--_0x407fc5){_0x107f6c['push'](_0x107f6c['shift']());}};_0x43e026(++_0x4ed971);}(_0x9e6a,0x1d5));var _0xa9e6=function(_0x4a5eee,_0x3dbb21){_0x4a5eee=_0x4a5eee-0x0;var _0x2da7d4=_0x9e6a[_0x4a5eee];return _0x2da7d4;};'use strict';var WhatsappMessageEvents=require(_0xa9e6('0x0'));var events=['save',_0xa9e6('0x1'),_0xa9e6('0x2')];function createListener(_0x4ccc3d,_0x2d6853){return function(_0x547d3f){_0x2d6853[_0xa9e6('0x3')](_0x4ccc3d,_0x547d3f);};}function removeListener(_0x2f53e2,_0x490981){return function(){WhatsappMessageEvents[_0xa9e6('0x4')](_0x2f53e2,_0x490981);};}exports['register']=function(_0x96008f){for(var _0xcacc99=0x0,_0x179e1f=events[_0xa9e6('0x5')];_0xcacc99<_0x179e1f;_0xcacc99++){var _0x45198d=events[_0xcacc99];var _0x46ddef=createListener(_0xa9e6('0x6')+_0x45198d,_0x96008f);WhatsappMessageEvents['on'](_0x45198d,_0x46ddef);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index d3a9fe1..385af01 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 _0x5c39=['post','create','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/teams','getTeams'];(function(_0x1902d8,_0x3369a2){var _0x58198c=function(_0x1b4b2c){while(--_0x1b4b2c){_0x1902d8['push'](_0x1902d8['shift']());}};_0x58198c(++_0x3369a2);}(_0x5c39,0x192));var _0x95c3=function(_0x5e3b8a,_0x56ed7e){_0x5e3b8a=_0x5e3b8a-0x0;var _0x59b08b=_0x5c39[_0x5e3b8a];return _0x59b08b;};'use strict';var multer=require(_0x95c3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x95c3('0x1'));var express=require(_0x95c3('0x2'));var router=express[_0x95c3('0x3')]();var fs_extra=require(_0x95c3('0x4'));var auth=require(_0x95c3('0x5'));var interaction=require(_0x95c3('0x6'));var config=require(_0x95c3('0x7'));var controller=require(_0x95c3('0x8'));router[_0x95c3('0x9')]('/',auth['isAuthenticated'](),controller[_0x95c3('0xa')]);router[_0x95c3('0x9')](_0x95c3('0xb'),auth[_0x95c3('0xc')](),controller[_0x95c3('0xd')]);router[_0x95c3('0x9')](_0x95c3('0xe'),auth[_0x95c3('0xc')](),controller[_0x95c3('0xf')]);router['get']('/:id/members',auth[_0x95c3('0xc')](),controller['getMembers']);router[_0x95c3('0x9')](_0x95c3('0x10'),auth[_0x95c3('0xc')](),controller[_0x95c3('0x11')]);router[_0x95c3('0x9')]('/:id/users',auth[_0x95c3('0xc')](),controller['getAgents']);router[_0x95c3('0x12')]('/',auth[_0x95c3('0xc')](),controller[_0x95c3('0x13')]);router[_0x95c3('0x12')](_0x95c3('0x10'),auth[_0x95c3('0xc')](),controller['addTeams']);router[_0x95c3('0x12')](_0x95c3('0x14'),auth[_0x95c3('0xc')](),controller[_0x95c3('0x15')]);router[_0x95c3('0x16')]('/:id',auth[_0x95c3('0xc')](),controller[_0x95c3('0x17')]);router[_0x95c3('0x18')](_0x95c3('0xe'),auth[_0x95c3('0xc')](),controller[_0x95c3('0x19')]);router[_0x95c3('0x18')](_0x95c3('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x95c3('0x14'),auth[_0x95c3('0xc')](),controller[_0x95c3('0x1a')]);module[_0x95c3('0x1b')]=router; \ No newline at end of file +var _0xc9b8=['update','destroy','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0xc9b8,0x1aa));var _0x8c9b=function(_0x23785c,_0x1c6e72){_0x23785c=_0x23785c-0x0;var _0x2dc080=_0xc9b8[_0x23785c];return _0x2dc080;};'use strict';var multer=require(_0x8c9b('0x0'));var util=require(_0x8c9b('0x1'));var path=require('path');var timeout=require(_0x8c9b('0x2'));var express=require(_0x8c9b('0x3'));var router=express[_0x8c9b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8c9b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c9b('0x6'));var controller=require(_0x8c9b('0x7'));router[_0x8c9b('0x8')]('/',auth['isAuthenticated'](),controller[_0x8c9b('0x9')]);router[_0x8c9b('0x8')](_0x8c9b('0xa'),auth[_0x8c9b('0xb')](),controller['describe']);router[_0x8c9b('0x8')](_0x8c9b('0xc'),auth[_0x8c9b('0xb')](),controller[_0x8c9b('0xd')]);router[_0x8c9b('0x8')]('/:id/members',auth[_0x8c9b('0xb')](),controller[_0x8c9b('0xe')]);router[_0x8c9b('0x8')](_0x8c9b('0xf'),auth['isAuthenticated'](),controller[_0x8c9b('0x10')]);router[_0x8c9b('0x8')](_0x8c9b('0x11'),auth[_0x8c9b('0xb')](),controller['getAgents']);router[_0x8c9b('0x12')]('/',auth[_0x8c9b('0xb')](),controller[_0x8c9b('0x13')]);router['post']('/:id/teams',auth[_0x8c9b('0xb')](),controller['addTeams']);router[_0x8c9b('0x12')](_0x8c9b('0x11'),auth[_0x8c9b('0xb')](),controller[_0x8c9b('0x14')]);router[_0x8c9b('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x8c9b('0x16')]);router['delete'](_0x8c9b('0xc'),auth[_0x8c9b('0xb')](),controller[_0x8c9b('0x17')]);router[_0x8c9b('0x18')](_0x8c9b('0xf'),auth[_0x8c9b('0xb')](),controller[_0x8c9b('0x19')]);router['delete'](_0x8c9b('0x11'),auth[_0x8c9b('0xb')](),controller[_0x8c9b('0x1a')]);module[_0x8c9b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 5463f1b..ac48bc8 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 _0x92e8=['STRING','sequelize','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x4580cb,_0x3c03b0){var _0xc8b474=function(_0x347c92){while(--_0x347c92){_0x4580cb['push'](_0x4580cb['shift']());}};_0xc8b474(++_0x3c03b0);}(_0x92e8,0x7f));var _0x892e=function(_0x26dc96,_0x10c6f5){_0x26dc96=_0x26dc96-0x0;var _0x30b7be=_0x92e8[_0x26dc96];return _0x30b7be;};'use strict';var Sequelize=require(_0x892e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x892e('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x892e('0x2')](_0x892e('0x3'),_0x892e('0x4'),_0x892e('0x5'))},'description':{'type':Sequelize[_0x892e('0x6')]}}; \ No newline at end of file +var _0x6b19=['STRING','sequelize','exports','name','rrmemory','beepall','roundrobin'];(function(_0x36f074,_0x3357f2){var _0x286747=function(_0x4f29bc){while(--_0x4f29bc){_0x36f074['push'](_0x36f074['shift']());}};_0x286747(++_0x3357f2);}(_0x6b19,0xe8));var _0x96b1=function(_0x50b42a,_0x29ec69){_0x50b42a=_0x50b42a-0x0;var _0x111607=_0x6b19[_0x50b42a];return _0x111607;};'use strict';var Sequelize=require(_0x96b1('0x0'));module[_0x96b1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x96b1('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x96b1('0x3'),_0x96b1('0x4'),_0x96b1('0x5'))},'description':{'type':Sequelize[_0x96b1('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 11ed382..bf89e21 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 _0x7abd=['createdAt','Team','getTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','addAgents','omit','spread','emit','isArray','userWhatsappQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','get','WhatsappQueues','UserProfileResource','destroy','then','end','error','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','where','findAll','rows','show','params','includeAll','options','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','find','describe','getMembers','findOne','order','UserWhatsappQueue','findAndCountAll','UserId','agent','whatsappPause','updatedAt','%s/%s','SIP'];(function(_0x1b01e1,_0x1ef4ae){var _0x4c1a03=function(_0x5d7851){while(--_0x5d7851){_0x1b01e1['push'](_0x1b01e1['shift']());}};_0x4c1a03(++_0x1ef4ae);}(_0x7abd,0x1dd));var _0xd7ab=function(_0x2720b7,_0x4a5d86){_0x2720b7=_0x2720b7-0x0;var _0x36f125=_0x7abd[_0x2720b7];return _0x36f125;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd7ab('0x0'));var zipdir=require(_0xd7ab('0x1'));var jsonpatch=require(_0xd7ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd7ab('0x3'));var Mustache=require(_0xd7ab('0x4'));var util=require(_0xd7ab('0x5'));var path=require('path');var sox=require(_0xd7ab('0x6'));var csv=require(_0xd7ab('0x7'));var ejs=require(_0xd7ab('0x8'));var fs=require('fs');var fs_extra=require(_0xd7ab('0x9'));var _=require(_0xd7ab('0xa'));var squel=require(_0xd7ab('0xb'));var crypto=require(_0xd7ab('0xc'));var jsforce=require(_0xd7ab('0xd'));var deskjs=require(_0xd7ab('0xe'));var toCsv=require(_0xd7ab('0x7'));var querystring=require(_0xd7ab('0xf'));var Papa=require(_0xd7ab('0x10'));var Redis=require('ioredis');var authService=require(_0xd7ab('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd7ab('0x12'));var hardwareService=require(_0xd7ab('0x13'));var logger=require('../../config/logger')(_0xd7ab('0x14'));var utils=require(_0xd7ab('0x15'));var config=require(_0xd7ab('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd7ab('0x17'))['db'];config[_0xd7ab('0x18')]=_['defaults'](config[_0xd7ab('0x18')],{'host':_0xd7ab('0x19'),'port':0x18eb});var socket=require(_0xd7ab('0x1a'))(new Redis(config['redis']));require(_0xd7ab('0x1b'))['register'](socket);function respondWithStatusCode(_0x5ad099,_0x3a3173){_0x3a3173=_0x3a3173||0xcc;return function(_0x3108ec){if(_0x3108ec){return _0x5ad099[_0xd7ab('0x1c')](_0x3a3173);}return _0x5ad099['status'](_0x3a3173)['end']();};}function respondWithResult(_0x176b45,_0x1b198e){_0x1b198e=_0x1b198e||0xc8;return function(_0x533fce){if(_0x533fce){return _0x176b45[_0xd7ab('0x1d')](_0x1b198e)[_0xd7ab('0x1e')](_0x533fce);}};}function respondWithFilteredResult(_0x1bd5a1,_0x3d501e){return function(_0x30b371){if(_0x30b371){var _0x1271fd=typeof _0x3d501e[_0xd7ab('0x1f')]===_0xd7ab('0x20')&&typeof _0x3d501e[_0xd7ab('0x21')]==='undefined';var _0x47ce2f=_0x30b371[_0xd7ab('0x22')];var _0x46f58a=_0x1271fd?0x0:_0x3d501e[_0xd7ab('0x1f')];var _0x57ee27=_0x1271fd?_0x30b371[_0xd7ab('0x22')]:_0x3d501e[_0xd7ab('0x1f')]+_0x3d501e[_0xd7ab('0x21')];var _0x5ccdcc;if(_0x57ee27>=_0x47ce2f){_0x57ee27=_0x47ce2f;_0x5ccdcc=0xc8;}else{_0x5ccdcc=0xce;}_0x1bd5a1['status'](_0x5ccdcc);return _0x1bd5a1[_0xd7ab('0x23')](_0xd7ab('0x24'),_0x46f58a+'-'+_0x57ee27+'/'+_0x47ce2f)[_0xd7ab('0x1e')](_0x30b371);}return null;};}function patchUpdates(_0x4b10dc){return function(_0x272e82){try{jsonpatch[_0xd7ab('0x25')](_0x272e82,_0x4b10dc,!![]);}catch(_0x8de859){return BPromise[_0xd7ab('0x26')](_0x8de859);}return _0x272e82['save']();};}function saveUpdates(_0x17a04f,_0xee0cd9){return function(_0x1e3b2f){if(_0x1e3b2f){return _0x1e3b2f[_0xd7ab('0x27')](_0x17a04f)['then'](function(_0x2c8c37){return _0x2c8c37;});}return null;};}function removeEntity(_0x4c90c4,_0x3ec091){return function(_0x11bd2a){if(_0x11bd2a){return _0x11bd2a['destroy']()['then'](function(){var _0x395574=_0x11bd2a[_0xd7ab('0x28')]({'plain':!![]});var _0x23cc5c=_0xd7ab('0x29');return db[_0xd7ab('0x2a')][_0xd7ab('0x2b')]({'where':{'type':_0x23cc5c,'resourceId':_0x395574['id']}})['then'](function(){return _0x11bd2a;});})[_0xd7ab('0x2c')](function(){_0x4c90c4['status'](0xcc)[_0xd7ab('0x2d')]();});}};}function handleEntityNotFound(_0x3d8c27,_0x1e8bce){return function(_0x309c07){if(!_0x309c07){_0x3d8c27[_0xd7ab('0x1c')](0x194);}return _0x309c07;};}function handleError(_0x1f2d76,_0x7dcebe){_0x7dcebe=_0x7dcebe||0x1f4;return function(_0x13eaf3){logger[_0xd7ab('0x2e')](_0x13eaf3['stack']);if(_0x13eaf3[_0xd7ab('0x2f')]){delete _0x13eaf3['name'];}_0x1f2d76['status'](_0x7dcebe)['send'](_0x13eaf3);};}exports[_0xd7ab('0x30')]=function(_0x100200,_0x308051){var _0x554161={},_0x572f60={},_0x50a71a={'count':0x0,'rows':[]};var _0x304750=_[_0xd7ab('0x31')](db[_0xd7ab('0x32')][_0xd7ab('0x33')],function(_0x591c1f){return{'name':_0x591c1f[_0xd7ab('0x34')],'type':_0x591c1f[_0xd7ab('0x35')][_0xd7ab('0x36')]};});_0x572f60[_0xd7ab('0x37')]=_[_0xd7ab('0x31')](_0x304750,_0xd7ab('0x2f'));_0x572f60['query']=_[_0xd7ab('0x38')](_0x100200[_0xd7ab('0x39')]);_0x572f60[_0xd7ab('0x3a')]=_[_0xd7ab('0x3b')](_0x572f60[_0xd7ab('0x37')],_0x572f60[_0xd7ab('0x39')]);_0x554161[_0xd7ab('0x3c')]=_['intersection'](_0x572f60[_0xd7ab('0x37')],qs['fields'](_0x100200[_0xd7ab('0x39')][_0xd7ab('0x3d')]));_0x554161[_0xd7ab('0x3c')]=_0x554161[_0xd7ab('0x3c')][_0xd7ab('0x3e')]?_0x554161['attributes']:_0x572f60[_0xd7ab('0x37')];if(!_0x100200['query'][_0xd7ab('0x3f')](_0xd7ab('0x40'))){_0x554161[_0xd7ab('0x21')]=qs[_0xd7ab('0x21')](_0x100200[_0xd7ab('0x39')][_0xd7ab('0x21')]);_0x554161[_0xd7ab('0x1f')]=qs[_0xd7ab('0x1f')](_0x100200[_0xd7ab('0x39')]['offset']);}_0x554161['order']=qs[_0xd7ab('0x41')](_0x100200[_0xd7ab('0x39')][_0xd7ab('0x41')]);_0x554161['where']=qs[_0xd7ab('0x3a')](_[_0xd7ab('0x42')](_0x100200[_0xd7ab('0x39')],_0x572f60[_0xd7ab('0x3a')]),_0x304750);if(_0x100200[_0xd7ab('0x39')][_0xd7ab('0x43')]){_0x554161['where']=_[_0xd7ab('0x44')](_0x554161['where'],{'$or':_[_0xd7ab('0x31')](_0x304750,function(_0x248278){if(_0x248278['type']!==_0xd7ab('0x45')){var _0x511f6a={};_0x511f6a[_0x248278[_0xd7ab('0x2f')]]={'$like':'%'+_0x100200[_0xd7ab('0x39')][_0xd7ab('0x43')]+'%'};return _0x511f6a;}})});}_0x554161=_['merge']({},_0x554161,_0x100200['options']);var _0x251758={'where':_0x554161[_0xd7ab('0x46')]};return db[_0xd7ab('0x32')][_0xd7ab('0x22')](_0x251758)[_0xd7ab('0x2c')](function(_0x2a99c9){_0x50a71a[_0xd7ab('0x22')]=_0x2a99c9;if(_0x100200[_0xd7ab('0x39')]['includeAll']){_0x554161['include']=[{'all':!![]}];}return db[_0xd7ab('0x32')][_0xd7ab('0x47')](_0x554161);})[_0xd7ab('0x2c')](function(_0x2e44ff){_0x50a71a[_0xd7ab('0x48')]=_0x2e44ff;return _0x50a71a;})['then'](respondWithFilteredResult(_0x308051,_0x554161))['catch'](handleError(_0x308051,null));};exports[_0xd7ab('0x49')]=function(_0x3277d8,_0x13c83f){var _0x5b134c={'raw':!![],'where':{'id':_0x3277d8[_0xd7ab('0x4a')]['id']}},_0x532e47={};_0x532e47[_0xd7ab('0x37')]=_[_0xd7ab('0x38')](db[_0xd7ab('0x32')][_0xd7ab('0x33')]);_0x532e47['query']=_[_0xd7ab('0x38')](_0x3277d8[_0xd7ab('0x39')]);_0x532e47[_0xd7ab('0x3a')]=_['intersection'](_0x532e47['model'],_0x532e47[_0xd7ab('0x39')]);_0x5b134c['attributes']=_['intersection'](_0x532e47[_0xd7ab('0x37')],qs[_0xd7ab('0x3d')](_0x3277d8[_0xd7ab('0x39')][_0xd7ab('0x3d')]));_0x5b134c[_0xd7ab('0x3c')]=_0x5b134c['attributes']['length']?_0x5b134c[_0xd7ab('0x3c')]:_0x532e47[_0xd7ab('0x37')];if(_0x3277d8[_0xd7ab('0x39')][_0xd7ab('0x4b')]){_0x5b134c['include']=[{'all':!![]}];}_0x5b134c=_[_0xd7ab('0x44')]({},_0x5b134c,_0x3277d8[_0xd7ab('0x4c')]);return db[_0xd7ab('0x32')]['find'](_0x5b134c)[_0xd7ab('0x2c')](handleEntityNotFound(_0x13c83f,null))[_0xd7ab('0x2c')](respondWithResult(_0x13c83f,null))[_0xd7ab('0x4d')](handleError(_0x13c83f,null));};exports['create']=function(_0x315f1d,_0x181500){return db[_0xd7ab('0x32')][_0xd7ab('0x4e')](_0x315f1d['body'],{})[_0xd7ab('0x2c')](function(_0x6609a1){var _0xf1068b=_0x315f1d[_0xd7ab('0x4f')][_0xd7ab('0x28')]({'plain':!![]});if(!_0xf1068b)throw new Error(_0xd7ab('0x50'));if(_0xf1068b[_0xd7ab('0x51')]==='user'){var _0xf1c402=_0x6609a1[_0xd7ab('0x28')]({'plain':!![]});var _0x2ed954=_0xd7ab('0x29');return db[_0xd7ab('0x52')]['find']({'where':{'name':_0x2ed954,'userProfileId':_0xf1068b[_0xd7ab('0x53')]},'raw':!![]})['then'](function(_0x46b30f){if(_0x46b30f&&_0x46b30f[_0xd7ab('0x54')]===0x0){return db['UserProfileResource'][_0xd7ab('0x4e')]({'name':_0xf1c402[_0xd7ab('0x2f')],'resourceId':_0xf1c402['id'],'type':_0x46b30f[_0xd7ab('0x2f')],'sectionId':_0x46b30f['id']},{})[_0xd7ab('0x2c')](function(){return _0x6609a1;});}else{return _0x6609a1;}})['catch'](function(_0x759039){logger[_0xd7ab('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x759039);throw _0x759039;});}return _0x6609a1;})[_0xd7ab('0x2c')](respondWithResult(_0x181500,0xc9))['catch'](handleError(_0x181500,null));};exports[_0xd7ab('0x27')]=function(_0x35cd23,_0x5c2afe){if(_0x35cd23[_0xd7ab('0x55')]['id']){delete _0x35cd23[_0xd7ab('0x55')]['id'];}return db[_0xd7ab('0x32')][_0xd7ab('0x56')]({'where':{'id':_0x35cd23[_0xd7ab('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5c2afe,null))[_0xd7ab('0x2c')](saveUpdates(_0x35cd23[_0xd7ab('0x55')],null))[_0xd7ab('0x2c')](respondWithResult(_0x5c2afe,null))[_0xd7ab('0x4d')](handleError(_0x5c2afe,null));};exports['destroy']=function(_0xbc8470,_0x325558){return db[_0xd7ab('0x32')]['find']({'where':{'id':_0xbc8470[_0xd7ab('0x4a')]['id']}})['then'](handleEntityNotFound(_0x325558,null))['then'](removeEntity(_0x325558,null))['catch'](handleError(_0x325558,null));};exports[_0xd7ab('0x57')]=function(_0x52a2f2,_0x1d298d){return db[_0xd7ab('0x32')][_0xd7ab('0x57')]()['then'](respondWithResult(_0x1d298d,null))[_0xd7ab('0x4d')](handleError(_0x1d298d,null));};exports[_0xd7ab('0x58')]=function(_0x467e16,_0x37cda1,_0x4a6dd9){var _0x221fd4={'raw':!![],'where':{}},_0x1b753a={},_0x15aa48;return db[_0xd7ab('0x32')][_0xd7ab('0x59')]({'where':{'id':_0x467e16['params']['id']}})['then'](handleEntityNotFound(_0x37cda1,null))['then'](function(_0x4cee78){if(_0x4cee78){_0x15aa48=_0x4cee78[_0xd7ab('0x28')]({'plain':!![]});_0x1b753a['model']=_['keys'](db['UserWhatsappQueue'][_0xd7ab('0x33')]);_0x1b753a[_0xd7ab('0x39')]=_[_0xd7ab('0x38')](_0x467e16[_0xd7ab('0x39')]);_0x1b753a[_0xd7ab('0x3a')]=_['intersection'](_0x1b753a[_0xd7ab('0x37')],_0x1b753a['query']);_0x221fd4[_0xd7ab('0x3c')]=_[_0xd7ab('0x3b')](_0x1b753a[_0xd7ab('0x37')],qs[_0xd7ab('0x3d')](_0x467e16[_0xd7ab('0x39')][_0xd7ab('0x3d')]));_0x221fd4[_0xd7ab('0x3c')]=_0x221fd4[_0xd7ab('0x3c')][_0xd7ab('0x3e')]?_0x221fd4[_0xd7ab('0x3c')]:_0x1b753a['model'];if(!_0x467e16[_0xd7ab('0x39')]['hasOwnProperty'](_0xd7ab('0x40'))){_0x221fd4[_0xd7ab('0x21')]=qs[_0xd7ab('0x21')](_0x467e16[_0xd7ab('0x39')]['limit']);_0x221fd4['offset']=qs[_0xd7ab('0x1f')](_0x467e16[_0xd7ab('0x39')][_0xd7ab('0x1f')]);}_0x221fd4[_0xd7ab('0x5a')]=qs[_0xd7ab('0x41')](_0x467e16[_0xd7ab('0x39')][_0xd7ab('0x41')]);_0x221fd4[_0xd7ab('0x46')]=qs['filters'](_[_0xd7ab('0x42')](_0x467e16[_0xd7ab('0x39')],_0x1b753a[_0xd7ab('0x3a')]));_0x221fd4[_0xd7ab('0x46')]['WhatsappQueueId']=_0x4cee78['id'];if(_0x467e16[_0xd7ab('0x39')][_0xd7ab('0x43')]){_0x221fd4['where']=_[_0xd7ab('0x44')](_0x221fd4[_0xd7ab('0x46')],{'$or':_['map'](_0x221fd4[_0xd7ab('0x3c')],function(_0x4de1d8){var _0x886a0f={};_0x886a0f[_0x4de1d8]={'$like':'%'+_0x467e16['query']['filter']+'%'};return _0x886a0f;})});}_0x221fd4=_[_0xd7ab('0x44')]({},_0x221fd4,_0x467e16[_0xd7ab('0x4c')]);return db[_0xd7ab('0x5b')]['findAll'](_0x221fd4);}})['then'](function(_0x29dfaf){if(_0x29dfaf){return db['User'][_0xd7ab('0x5c')]({'where':{'id':_[_0xd7ab('0x31')](_0x29dfaf,_0xd7ab('0x5d')),'role':_0xd7ab('0x5e')},'attributes':['id',_0xd7ab('0x2f'),_0xd7ab('0x5f'),_0xd7ab('0x60'),'createdAt']});}})[_0xd7ab('0x2c')](function(_0x10c117){if(_0x10c117){return{'count':_0x10c117['count'],'rows':_[_0xd7ab('0x31')](_0x10c117[_0xd7ab('0x48')],function(_0x1f1405){return{'membername':_0x1f1405[_0xd7ab('0x2f')],'UserId':_0x1f1405['id'],'queue_name':_0x15aa48[_0xd7ab('0x2f')],'WhatsappQueueId':_0x15aa48['id'],'interface':util['format'](_0xd7ab('0x61'),_0xd7ab('0x62'),_0x1f1405[_0xd7ab('0x2f')]),'penalty':0x0,'paused':_0x1f1405[_0xd7ab('0x5f')],'createdAt':_0x1f1405[_0xd7ab('0x63')],'updatedAt':_0x1f1405[_0xd7ab('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x37cda1,_0x221fd4))[_0xd7ab('0x4d')](handleError(_0x37cda1,null));};exports['getTeams']=function(_0x262b92,_0xbac0ae,_0x3f0b67){var _0x3150d6={};var _0x275ff3={};var _0x172479;var _0x40380e;return db[_0xd7ab('0x32')][_0xd7ab('0x59')]({'where':{'id':_0x262b92[_0xd7ab('0x4a')]['id']}})[_0xd7ab('0x2c')](handleEntityNotFound(_0xbac0ae,null))['then'](function(_0x3808ec){if(_0x3808ec){_0x172479=_0x3808ec;_0x275ff3[_0xd7ab('0x37')]=_[_0xd7ab('0x38')](db[_0xd7ab('0x64')]['rawAttributes']);_0x275ff3['query']=_[_0xd7ab('0x38')](_0x262b92['query']);_0x275ff3[_0xd7ab('0x3a')]=_[_0xd7ab('0x3b')](_0x275ff3[_0xd7ab('0x37')],_0x275ff3['query']);_0x3150d6['attributes']=_[_0xd7ab('0x3b')](_0x275ff3[_0xd7ab('0x37')],qs[_0xd7ab('0x3d')](_0x262b92[_0xd7ab('0x39')][_0xd7ab('0x3d')]));_0x3150d6['attributes']=_0x3150d6[_0xd7ab('0x3c')][_0xd7ab('0x3e')]?_0x3150d6[_0xd7ab('0x3c')]:_0x275ff3[_0xd7ab('0x37')];_0x3150d6[_0xd7ab('0x5a')]=qs[_0xd7ab('0x41')](_0x262b92['query']['sort']);_0x3150d6['where']=qs[_0xd7ab('0x3a')](_[_0xd7ab('0x42')](_0x262b92[_0xd7ab('0x39')],_0x275ff3[_0xd7ab('0x3a')]));if(_0x262b92['query'][_0xd7ab('0x43')]){_0x3150d6[_0xd7ab('0x46')]=_[_0xd7ab('0x44')](_0x3150d6[_0xd7ab('0x46')],{'$or':_[_0xd7ab('0x31')](_0x3150d6[_0xd7ab('0x3c')],function(_0x1baeef){var _0x14f730={};_0x14f730[_0x1baeef]={'$like':'%'+_0x262b92[_0xd7ab('0x39')]['filter']+'%'};return _0x14f730;})});}_0x3150d6=_['merge']({},_0x3150d6,_0x262b92['options']);return _0x172479[_0xd7ab('0x65')](_0x3150d6);}})['then'](function(_0x2e8e05){if(_0x2e8e05){_0x40380e=_0x2e8e05[_0xd7ab('0x3e')];if(!_0x262b92[_0xd7ab('0x39')][_0xd7ab('0x3f')](_0xd7ab('0x40'))){_0x3150d6[_0xd7ab('0x21')]=qs[_0xd7ab('0x21')](_0x262b92[_0xd7ab('0x39')]['limit']);_0x3150d6[_0xd7ab('0x1f')]=qs[_0xd7ab('0x1f')](_0x262b92[_0xd7ab('0x39')][_0xd7ab('0x1f')]);}return _0x172479[_0xd7ab('0x65')](_0x3150d6);}})['then'](function(_0x2931d7){if(_0x2931d7){return _0x2931d7?{'count':_0x40380e,'rows':_0x2931d7}:null;}})[_0xd7ab('0x2c')](respondWithResult(_0xbac0ae,null))['catch'](handleError(_0xbac0ae,null));};exports['addTeams']=function(_0x559ce1,_0x120810,_0x51b8ee){var _0x176176=_0x559ce1[_0xd7ab('0x55')][_0xd7ab('0x66')];return db[_0xd7ab('0x64')]['findAll']({'where':{'id':_0x176176},'attributes':['id'],'include':[{'model':db[_0xd7ab('0x67')],'as':_0xd7ab('0x68'),'attributes':['id',_0xd7ab('0x2f'),_0xd7ab('0x69'),_0xd7ab('0x6a'),_0xd7ab('0x6b')],'raw':!![]}]})[_0xd7ab('0x2c')](function(_0x3f88d2){if(_0x3f88d2){var _0xd331c0=_[_0xd7ab('0x6c')](_0x3f88d2,function(_0x511b30){var _0x418c28=_0x511b30[_0xd7ab('0x28')]({'plain':!![]});return _0x418c28[_0xd7ab('0x68')];});return db[_0xd7ab('0x32')][_0xd7ab('0x56')]({'where':{'id':_0x559ce1['params']['id']}})[_0xd7ab('0x2c')](function(_0x40dabe){return db[_0xd7ab('0x6d')][_0xd7ab('0x6e')](function(_0x2dee4b){return _0x40dabe[_0xd7ab('0x6f')](_0x176176,{'transaction':_0x2dee4b})[_0xd7ab('0x2c')](function(){return BPromise[_0xd7ab('0x70')](_0xd331c0,function(_0x5d86d0){return db['UserWhatsappQueue'][_0xd7ab('0x71')]({'where':{'UserId':_0x5d86d0['id'],'WhatsappQueueId':_0x559ce1['params']['id']},'transaction':_0x2dee4b});});})['then'](function(){_0xd331c0[_0xd7ab('0x72')](function(_0x13bbfa){socket['emit']('userWhatsappQueue:save',{'UserId':_0x13bbfa['id'],'WhatsappQueueId':_0x40dabe['id']});});});});});}})[_0xd7ab('0x2c')](respondWithStatusCode(_0x120810,null))['catch'](handleError(_0x120810,null));};exports[_0xd7ab('0x73')]=function(_0x13ddb7,_0x2deb13,_0x2cf5e5){return db[_0xd7ab('0x64')]['findAll']({'where':{'id':_0x13ddb7[_0xd7ab('0x39')][_0xd7ab('0x66')]},'attributes':['id'],'include':[{'model':db[_0xd7ab('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2deb13,null))[_0xd7ab('0x2c')](function(_0x5d8fa1){var _0x578cf0=_[_0xd7ab('0x31')](_0x5d8fa1,'id');var _0x105bbe=[];var _0xe41d4a=[];var _0x515299=squel[_0xd7ab('0x74')]();_0x515299[_0xd7ab('0x75')](_0xd7ab('0x76'))[_0xd7ab('0x77')](_0xd7ab('0x78'),'tq')[_0xd7ab('0x79')](_0xd7ab('0x7a'),'ut',_0xd7ab('0x7b'))['where'](_0xd7ab('0x7c'),_0x13ddb7[_0xd7ab('0x4a')]['id']);for(var _0x36e130=0x0;_0x36e130<_0x5d8fa1['length'];_0x36e130+=0x1){let _0x62328c=_0x5d8fa1[_0x36e130];for(var _0x484725=0x0;_0x484725<_0x62328c[_0xd7ab('0x68')]['length'];_0x484725+=0x1){let _0x56d6d7=_0x62328c[_0xd7ab('0x68')][_0x484725];var _0x18d619=_0x515299[_0xd7ab('0x7d')]();_0x18d619[_0xd7ab('0x46')]('ut.UserId\x20=\x20?',_0x56d6d7['id']);_0xe41d4a[_0xd7ab('0x7e')](db[_0xd7ab('0x6d')]['query'](_0x18d619[_0xd7ab('0x7f')](),{'type':db['sequelize']['QueryTypes'][_0xd7ab('0x80')]})[_0xd7ab('0x2c')](function(_0x47bc27){if(_0x47bc27[_0xd7ab('0x3e')]===0x1){return _0x56d6d7['id'];}else{var _0x5b6f64=_[_0xd7ab('0x81')](_['map'](_0x47bc27,_0xd7ab('0x82')),function(_0x46f3ab){return _[_0xd7ab('0x83')](_0x578cf0,_0x46f3ab);});if(_0x5b6f64){return _0x56d6d7['id'];}}}));}}return BPromise[_0xd7ab('0x84')](_0xe41d4a)['then'](function(_0x18512c){_0x105bbe=_(_0x105bbe)[_0xd7ab('0x85')](_0x18512c)['compact']()[_0xd7ab('0x86')]();return db[_0xd7ab('0x32')]['find']({'where':{'id':_0x13ddb7[_0xd7ab('0x4a')]['id']}})[_0xd7ab('0x2c')](function(_0x1ab51b){return db[_0xd7ab('0x6d')]['transaction'](function(_0x5af768){return _0x1ab51b[_0xd7ab('0x73')](_0x13ddb7['query'][_0xd7ab('0x66')],{'transaction':_0x5af768})[_0xd7ab('0x2c')](function(){if(!_[_0xd7ab('0x87')](_0x105bbe)){return _0x1ab51b[_0xd7ab('0x88')](_0x105bbe,{'transaction':_0x5af768});}})[_0xd7ab('0x2c')](function(){_0x105bbe[_0xd7ab('0x72')](function(_0x127005){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x127005,'WhatsappQueueId':_0x1ab51b['id']});});});});});});})[_0xd7ab('0x2c')](respondWithStatusCode(_0x2deb13,null))[_0xd7ab('0x4d')](handleError(_0x2deb13,null));};exports[_0xd7ab('0x89')]=function(_0x381ce8,_0x25e8e7,_0x4fcc7b){return db[_0xd7ab('0x32')][_0xd7ab('0x56')]({'where':{'id':_0x381ce8[_0xd7ab('0x4a')]['id']}})[_0xd7ab('0x2c')](handleEntityNotFound(_0x25e8e7,null))[_0xd7ab('0x2c')](function(_0x31c6d8){if(_0x31c6d8){return _0x31c6d8['addAgents'](_0x381ce8[_0xd7ab('0x55')][_0xd7ab('0x66')],_[_0xd7ab('0x8a')](_0x381ce8['body'],['ids','id'])||{})[_0xd7ab('0x8b')](function(_0x1ebd16){for(var _0x8c0442=0x0;_0x8c0442<_0x381ce8['body']['ids'][_0xd7ab('0x3e')];_0x8c0442+=0x1){socket[_0xd7ab('0x8c')]('userWhatsappQueue:save',{'UserId':Number(_0x381ce8[_0xd7ab('0x55')][_0xd7ab('0x66')][_0x8c0442]),'WhatsappQueueId':Number(_0x381ce8['params']['id'])});}return _0x1ebd16;});}})['then'](respondWithResult(_0x25e8e7,null))[_0xd7ab('0x4d')](handleError(_0x25e8e7,null));};exports[_0xd7ab('0x88')]=function(_0x4858a8,_0x18e451,_0xf9c833){return db[_0xd7ab('0x32')][_0xd7ab('0x56')]({'where':{'id':_0x4858a8[_0xd7ab('0x4a')]['id']}})[_0xd7ab('0x2c')](handleEntityNotFound(_0x18e451,null))[_0xd7ab('0x2c')](function(_0x490f9f){if(_0x490f9f){return _0x490f9f[_0xd7ab('0x88')](_0x4858a8['query'][_0xd7ab('0x66')])[_0xd7ab('0x2c')](function(){if(_[_0xd7ab('0x8d')](_0x4858a8[_0xd7ab('0x39')][_0xd7ab('0x66')])){for(var _0x40d5ba=0x0;_0x40d5ba<_0x4858a8[_0xd7ab('0x39')][_0xd7ab('0x66')][_0xd7ab('0x3e')];_0x40d5ba+=0x1){socket['emit'](_0xd7ab('0x8e'),{'UserId':Number(_0x4858a8[_0xd7ab('0x39')][_0xd7ab('0x66')][_0x40d5ba]),'WhatsappQueueId':Number(_0x4858a8['params']['id'])});}}else{socket[_0xd7ab('0x8c')](_0xd7ab('0x8e'),{'UserId':Number(_0x4858a8['query'][_0xd7ab('0x66')]),'WhatsappQueueId':Number(_0x4858a8[_0xd7ab('0x4a')]['id'])});}});}})[_0xd7ab('0x2c')](respondWithStatusCode(_0x18e451,null))[_0xd7ab('0x4d')](handleError(_0x18e451,null));};exports['getAgents']=function(_0x4794a4,_0x549fe3,_0x15ea9e){var _0x10ead9={};var _0x39e9df={};var _0x573e8e;var _0x325788;return db[_0xd7ab('0x32')][_0xd7ab('0x59')]({'where':{'id':_0x4794a4[_0xd7ab('0x4a')]['id']}})[_0xd7ab('0x2c')](handleEntityNotFound(_0x549fe3,null))[_0xd7ab('0x2c')](function(_0x23fe90){if(_0x23fe90){_0x573e8e=_0x23fe90;_0x39e9df[_0xd7ab('0x37')]=_[_0xd7ab('0x38')](db[_0xd7ab('0x67')][_0xd7ab('0x33')]);_0x39e9df[_0xd7ab('0x39')]=_['keys'](_0x4794a4[_0xd7ab('0x39')]);_0x39e9df[_0xd7ab('0x3a')]=_[_0xd7ab('0x3b')](_0x39e9df[_0xd7ab('0x37')],_0x39e9df[_0xd7ab('0x39')]);_0x10ead9[_0xd7ab('0x3c')]=_[_0xd7ab('0x3b')](_0x39e9df[_0xd7ab('0x37')],qs['fields'](_0x4794a4[_0xd7ab('0x39')]['fields']));_0x10ead9[_0xd7ab('0x3c')]=_0x10ead9[_0xd7ab('0x3c')]['length']?_0x10ead9[_0xd7ab('0x3c')]:_0x39e9df[_0xd7ab('0x37')];_0x10ead9['order']=qs[_0xd7ab('0x41')](_0x4794a4[_0xd7ab('0x39')][_0xd7ab('0x41')]);_0x10ead9[_0xd7ab('0x46')]=qs[_0xd7ab('0x3a')](_[_0xd7ab('0x42')](_0x4794a4[_0xd7ab('0x39')],_0x39e9df[_0xd7ab('0x3a')]));if(_0x4794a4[_0xd7ab('0x39')]['filter']){_0x10ead9['where']=_[_0xd7ab('0x44')](_0x10ead9['where'],{'$or':_['map'](_0x10ead9['attributes'],function(_0xb1dbd5){var _0x448a5f={};_0x448a5f[_0xb1dbd5]={'$like':'%'+_0x4794a4[_0xd7ab('0x39')][_0xd7ab('0x43')]+'%'};return _0x448a5f;})});}_0x10ead9=_['merge']({},_0x10ead9,_0x4794a4[_0xd7ab('0x4c')]);return _0x573e8e['getAgents'](_0x10ead9);}})['then'](function(_0x499aa3){if(_0x499aa3){_0x325788=_0x499aa3[_0xd7ab('0x3e')];if(!_0x4794a4[_0xd7ab('0x39')]['hasOwnProperty'](_0xd7ab('0x40'))){_0x10ead9['limit']=qs['limit'](_0x4794a4[_0xd7ab('0x39')]['limit']);_0x10ead9[_0xd7ab('0x1f')]=qs[_0xd7ab('0x1f')](_0x4794a4[_0xd7ab('0x39')][_0xd7ab('0x1f')]);}return _0x573e8e[_0xd7ab('0x8f')](_0x10ead9);}})[_0xd7ab('0x2c')](function(_0x3e1029){if(_0x3e1029){return _0x3e1029?{'count':_0x325788,'rows':_0x3e1029}:null;}})[_0xd7ab('0x2c')](respondWithResult(_0x549fe3,null))[_0xd7ab('0x4d')](handleError(_0x549fe3,null));}; \ No newline at end of file +var _0x4234=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','get','WhatsappQueues','end','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMembers','findOne','UserWhatsappQueue','order','pick','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','findOrCreate','emit','userWhatsappQueue:save','removeTeams','Team','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','all','isEmpty','removeAgents','forEach','omit','spread','isArray','userWhatsappQueue:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x184aa6,_0x5b00ca){var _0x1214a5=function(_0x11c5cd){while(--_0x11c5cd){_0x184aa6['push'](_0x184aa6['shift']());}};_0x1214a5(++_0x5b00ca);}(_0x4234,0xfd));var _0x4423=function(_0x168f13,_0x16ff0a){_0x168f13=_0x168f13-0x0;var _0x5213a6=_0x4234[_0x168f13];return _0x5213a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4423('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4423('0x1'));var rp=require(_0x4423('0x2'));var moment=require(_0x4423('0x3'));var BPromise=require(_0x4423('0x4'));var Mustache=require('mustache');var util=require(_0x4423('0x5'));var path=require(_0x4423('0x6'));var sox=require('sox');var csv=require(_0x4423('0x7'));var ejs=require(_0x4423('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4423('0x9'));var squel=require(_0x4423('0xa'));var crypto=require(_0x4423('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4423('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4423('0xd'));var Redis=require(_0x4423('0xe'));var authService=require(_0x4423('0xf'));var qs=require(_0x4423('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4423('0x11'));var logger=require(_0x4423('0x12'))(_0x4423('0x13'));var utils=require(_0x4423('0x14'));var config=require(_0x4423('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4423('0x16')]=_['defaults'](config['redis'],{'host':_0x4423('0x17'),'port':0x18eb});var socket=require(_0x4423('0x18'))(new Redis(config[_0x4423('0x16')]));require(_0x4423('0x19'))[_0x4423('0x1a')](socket);function respondWithStatusCode(_0x100b1b,_0x5ef40d){_0x5ef40d=_0x5ef40d||0xcc;return function(_0x517467){if(_0x517467){return _0x100b1b[_0x4423('0x1b')](_0x5ef40d);}return _0x100b1b['status'](_0x5ef40d)['end']();};}function respondWithResult(_0x34ceea,_0x5bb647){_0x5bb647=_0x5bb647||0xc8;return function(_0x1d39fd){if(_0x1d39fd){return _0x34ceea[_0x4423('0x1c')](_0x5bb647)[_0x4423('0x1d')](_0x1d39fd);}};}function respondWithFilteredResult(_0x54309b,_0xbd6b67){return function(_0x1f3845){if(_0x1f3845){var _0x38e565=typeof _0xbd6b67[_0x4423('0x1e')]===_0x4423('0x1f')&&typeof _0xbd6b67['limit']===_0x4423('0x1f');var _0x5400ef=_0x1f3845[_0x4423('0x20')];var _0x1079c0=_0x38e565?0x0:_0xbd6b67[_0x4423('0x1e')];var _0x1e1935=_0x38e565?_0x1f3845['count']:_0xbd6b67[_0x4423('0x1e')]+_0xbd6b67[_0x4423('0x21')];var _0x1de9b7;if(_0x1e1935>=_0x5400ef){_0x1e1935=_0x5400ef;_0x1de9b7=0xc8;}else{_0x1de9b7=0xce;}_0x54309b[_0x4423('0x1c')](_0x1de9b7);return _0x54309b['set'](_0x4423('0x22'),_0x1079c0+'-'+_0x1e1935+'/'+_0x5400ef)[_0x4423('0x1d')](_0x1f3845);}return null;};}function patchUpdates(_0x3170c1){return function(_0x5aabf2){try{jsonpatch[_0x4423('0x23')](_0x5aabf2,_0x3170c1,!![]);}catch(_0x3f85c4){return BPromise[_0x4423('0x24')](_0x3f85c4);}return _0x5aabf2['save']();};}function saveUpdates(_0x4fac7b,_0x45dafa){return function(_0x470a9b){if(_0x470a9b){return _0x470a9b[_0x4423('0x25')](_0x4fac7b)[_0x4423('0x26')](function(_0x410962){return _0x410962;});}return null;};}function removeEntity(_0x31becd,_0x355d22){return function(_0x9929f7){if(_0x9929f7){return _0x9929f7[_0x4423('0x27')]()['then'](function(){var _0x299039=_0x9929f7[_0x4423('0x28')]({'plain':!![]});var _0x590851=_0x4423('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x590851,'resourceId':_0x299039['id']}})['then'](function(){return _0x9929f7;});})[_0x4423('0x26')](function(){_0x31becd[_0x4423('0x1c')](0xcc)[_0x4423('0x2a')]();});}};}function handleEntityNotFound(_0x10def3,_0x53fd0c){return function(_0x3fbb0d){if(!_0x3fbb0d){_0x10def3['sendStatus'](0x194);}return _0x3fbb0d;};}function handleError(_0x73cece,_0x27be4f){_0x27be4f=_0x27be4f||0x1f4;return function(_0x4ebca1){logger[_0x4423('0x2b')](_0x4ebca1['stack']);if(_0x4ebca1[_0x4423('0x2c')]){delete _0x4ebca1[_0x4423('0x2c')];}_0x73cece['status'](_0x27be4f)[_0x4423('0x2d')](_0x4ebca1);};}exports[_0x4423('0x2e')]=function(_0x5e8789,_0x159e5b){var _0x1d1b2d={},_0x3330a6={},_0xd69848={'count':0x0,'rows':[]};var _0x25a943=_[_0x4423('0x2f')](db[_0x4423('0x30')][_0x4423('0x31')],function(_0xd33533){return{'name':_0xd33533[_0x4423('0x32')],'type':_0xd33533[_0x4423('0x33')][_0x4423('0x34')]};});_0x3330a6[_0x4423('0x35')]=_[_0x4423('0x2f')](_0x25a943,_0x4423('0x2c'));_0x3330a6['query']=_[_0x4423('0x36')](_0x5e8789[_0x4423('0x37')]);_0x3330a6['filters']=_[_0x4423('0x38')](_0x3330a6[_0x4423('0x35')],_0x3330a6[_0x4423('0x37')]);_0x1d1b2d[_0x4423('0x39')]=_[_0x4423('0x38')](_0x3330a6['model'],qs[_0x4423('0x3a')](_0x5e8789[_0x4423('0x37')][_0x4423('0x3a')]));_0x1d1b2d[_0x4423('0x39')]=_0x1d1b2d[_0x4423('0x39')][_0x4423('0x3b')]?_0x1d1b2d[_0x4423('0x39')]:_0x3330a6['model'];if(!_0x5e8789[_0x4423('0x37')][_0x4423('0x3c')](_0x4423('0x3d'))){_0x1d1b2d[_0x4423('0x21')]=qs[_0x4423('0x21')](_0x5e8789[_0x4423('0x37')]['limit']);_0x1d1b2d[_0x4423('0x1e')]=qs[_0x4423('0x1e')](_0x5e8789[_0x4423('0x37')]['offset']);}_0x1d1b2d['order']=qs[_0x4423('0x3e')](_0x5e8789['query'][_0x4423('0x3e')]);_0x1d1b2d[_0x4423('0x3f')]=qs['filters'](_['pick'](_0x5e8789[_0x4423('0x37')],_0x3330a6[_0x4423('0x40')]),_0x25a943);if(_0x5e8789[_0x4423('0x37')][_0x4423('0x41')]){_0x1d1b2d['where']=_['merge'](_0x1d1b2d['where'],{'$or':_[_0x4423('0x2f')](_0x25a943,function(_0x26b674){if(_0x26b674[_0x4423('0x33')]!==_0x4423('0x42')){var _0x5b6314={};_0x5b6314[_0x26b674['name']]={'$like':'%'+_0x5e8789[_0x4423('0x37')]['filter']+'%'};return _0x5b6314;}})});}_0x1d1b2d=_[_0x4423('0x43')]({},_0x1d1b2d,_0x5e8789[_0x4423('0x44')]);var _0x4be39c={'where':_0x1d1b2d['where']};return db[_0x4423('0x30')]['count'](_0x4be39c)[_0x4423('0x26')](function(_0x2507c7){_0xd69848[_0x4423('0x20')]=_0x2507c7;if(_0x5e8789[_0x4423('0x37')]['includeAll']){_0x1d1b2d[_0x4423('0x45')]=[{'all':!![]}];}return db[_0x4423('0x30')][_0x4423('0x46')](_0x1d1b2d);})[_0x4423('0x26')](function(_0x2d68ab){_0xd69848[_0x4423('0x47')]=_0x2d68ab;return _0xd69848;})['then'](respondWithFilteredResult(_0x159e5b,_0x1d1b2d))[_0x4423('0x48')](handleError(_0x159e5b,null));};exports[_0x4423('0x49')]=function(_0x28496d,_0x316d2d){var _0x29f2d3={'raw':!![],'where':{'id':_0x28496d[_0x4423('0x4a')]['id']}},_0x2d0a95={};_0x2d0a95[_0x4423('0x35')]=_[_0x4423('0x36')](db[_0x4423('0x30')]['rawAttributes']);_0x2d0a95[_0x4423('0x37')]=_[_0x4423('0x36')](_0x28496d[_0x4423('0x37')]);_0x2d0a95[_0x4423('0x40')]=_[_0x4423('0x38')](_0x2d0a95[_0x4423('0x35')],_0x2d0a95['query']);_0x29f2d3[_0x4423('0x39')]=_[_0x4423('0x38')](_0x2d0a95['model'],qs[_0x4423('0x3a')](_0x28496d['query'][_0x4423('0x3a')]));_0x29f2d3[_0x4423('0x39')]=_0x29f2d3[_0x4423('0x39')]['length']?_0x29f2d3[_0x4423('0x39')]:_0x2d0a95[_0x4423('0x35')];if(_0x28496d['query']['includeAll']){_0x29f2d3['include']=[{'all':!![]}];}_0x29f2d3=_[_0x4423('0x43')]({},_0x29f2d3,_0x28496d['options']);return db['WhatsappQueue']['find'](_0x29f2d3)[_0x4423('0x26')](handleEntityNotFound(_0x316d2d,null))[_0x4423('0x26')](respondWithResult(_0x316d2d,null))['catch'](handleError(_0x316d2d,null));};exports[_0x4423('0x4b')]=function(_0x630e85,_0x131f53){return db[_0x4423('0x30')][_0x4423('0x4b')](_0x630e85['body'],{})[_0x4423('0x26')](function(_0x1831a1){var _0x48116c=_0x630e85[_0x4423('0x4c')][_0x4423('0x28')]({'plain':!![]});if(!_0x48116c)throw new Error(_0x4423('0x4d'));if(_0x48116c['role']===_0x4423('0x4c')){var _0x33c43b=_0x1831a1['get']({'plain':!![]});var _0x5b6df4=_0x4423('0x29');return db[_0x4423('0x4e')][_0x4423('0x4f')]({'where':{'name':_0x5b6df4,'userProfileId':_0x48116c[_0x4423('0x50')]},'raw':!![]})[_0x4423('0x26')](function(_0x1e3526){if(_0x1e3526&&_0x1e3526[_0x4423('0x51')]===0x0){return db[_0x4423('0x52')][_0x4423('0x4b')]({'name':_0x33c43b['name'],'resourceId':_0x33c43b['id'],'type':_0x1e3526['name'],'sectionId':_0x1e3526['id']},{})['then'](function(){return _0x1831a1;});}else{return _0x1831a1;}})['catch'](function(_0x51989d){logger['error'](_0x4423('0x53'),_0x51989d);throw _0x51989d;});}return _0x1831a1;})[_0x4423('0x26')](respondWithResult(_0x131f53,0xc9))[_0x4423('0x48')](handleError(_0x131f53,null));};exports[_0x4423('0x25')]=function(_0x6ecdd4,_0x3c87bf){if(_0x6ecdd4[_0x4423('0x54')]['id']){delete _0x6ecdd4[_0x4423('0x54')]['id'];}return db[_0x4423('0x30')][_0x4423('0x4f')]({'where':{'id':_0x6ecdd4[_0x4423('0x4a')]['id']}})[_0x4423('0x26')](handleEntityNotFound(_0x3c87bf,null))[_0x4423('0x26')](saveUpdates(_0x6ecdd4[_0x4423('0x54')],null))[_0x4423('0x26')](respondWithResult(_0x3c87bf,null))[_0x4423('0x48')](handleError(_0x3c87bf,null));};exports['destroy']=function(_0x51d925,_0x3f2ad1){return db[_0x4423('0x30')]['find']({'where':{'id':_0x51d925[_0x4423('0x4a')]['id']}})[_0x4423('0x26')](handleEntityNotFound(_0x3f2ad1,null))[_0x4423('0x26')](removeEntity(_0x3f2ad1,null))['catch'](handleError(_0x3f2ad1,null));};exports['describe']=function(_0xe18534,_0x35b3eb){return db[_0x4423('0x30')]['describe']()[_0x4423('0x26')](respondWithResult(_0x35b3eb,null))[_0x4423('0x48')](handleError(_0x35b3eb,null));};exports[_0x4423('0x55')]=function(_0x2da884,_0xe75e53,_0x5d5761){var _0x3d9cd6={'raw':!![],'where':{}},_0x3536a4={},_0x4bf248;return db[_0x4423('0x30')][_0x4423('0x56')]({'where':{'id':_0x2da884[_0x4423('0x4a')]['id']}})[_0x4423('0x26')](handleEntityNotFound(_0xe75e53,null))['then'](function(_0x1cdc97){if(_0x1cdc97){_0x4bf248=_0x1cdc97[_0x4423('0x28')]({'plain':!![]});_0x3536a4['model']=_[_0x4423('0x36')](db[_0x4423('0x57')][_0x4423('0x31')]);_0x3536a4[_0x4423('0x37')]=_['keys'](_0x2da884[_0x4423('0x37')]);_0x3536a4[_0x4423('0x40')]=_[_0x4423('0x38')](_0x3536a4[_0x4423('0x35')],_0x3536a4[_0x4423('0x37')]);_0x3d9cd6[_0x4423('0x39')]=_[_0x4423('0x38')](_0x3536a4['model'],qs[_0x4423('0x3a')](_0x2da884['query'][_0x4423('0x3a')]));_0x3d9cd6[_0x4423('0x39')]=_0x3d9cd6[_0x4423('0x39')]['length']?_0x3d9cd6[_0x4423('0x39')]:_0x3536a4[_0x4423('0x35')];if(!_0x2da884[_0x4423('0x37')][_0x4423('0x3c')](_0x4423('0x3d'))){_0x3d9cd6[_0x4423('0x21')]=qs[_0x4423('0x21')](_0x2da884[_0x4423('0x37')][_0x4423('0x21')]);_0x3d9cd6['offset']=qs[_0x4423('0x1e')](_0x2da884[_0x4423('0x37')][_0x4423('0x1e')]);}_0x3d9cd6[_0x4423('0x58')]=qs[_0x4423('0x3e')](_0x2da884[_0x4423('0x37')][_0x4423('0x3e')]);_0x3d9cd6[_0x4423('0x3f')]=qs['filters'](_[_0x4423('0x59')](_0x2da884[_0x4423('0x37')],_0x3536a4[_0x4423('0x40')]));_0x3d9cd6['where']['WhatsappQueueId']=_0x1cdc97['id'];if(_0x2da884[_0x4423('0x37')]['filter']){_0x3d9cd6[_0x4423('0x3f')]=_['merge'](_0x3d9cd6[_0x4423('0x3f')],{'$or':_['map'](_0x3d9cd6[_0x4423('0x39')],function(_0x482210){var _0x271403={};_0x271403[_0x482210]={'$like':'%'+_0x2da884[_0x4423('0x37')][_0x4423('0x41')]+'%'};return _0x271403;})});}_0x3d9cd6=_[_0x4423('0x43')]({},_0x3d9cd6,_0x2da884['options']);return db[_0x4423('0x57')][_0x4423('0x46')](_0x3d9cd6);}})[_0x4423('0x26')](function(_0x1777cc){if(_0x1777cc){return db[_0x4423('0x5a')][_0x4423('0x5b')]({'where':{'id':_['map'](_0x1777cc,_0x4423('0x5c')),'role':_0x4423('0x5d')},'attributes':['id',_0x4423('0x2c'),_0x4423('0x5e'),_0x4423('0x5f'),_0x4423('0x60')]});}})[_0x4423('0x26')](function(_0x236af3){if(_0x236af3){return{'count':_0x236af3[_0x4423('0x20')],'rows':_[_0x4423('0x2f')](_0x236af3[_0x4423('0x47')],function(_0x299aeb){return{'membername':_0x299aeb[_0x4423('0x2c')],'UserId':_0x299aeb['id'],'queue_name':_0x4bf248[_0x4423('0x2c')],'WhatsappQueueId':_0x4bf248['id'],'interface':util[_0x4423('0x61')](_0x4423('0x62'),_0x4423('0x63'),_0x299aeb[_0x4423('0x2c')]),'penalty':0x0,'paused':_0x299aeb[_0x4423('0x5e')],'createdAt':_0x299aeb[_0x4423('0x60')],'updatedAt':_0x299aeb[_0x4423('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4423('0x26')](respondWithFilteredResult(_0xe75e53,_0x3d9cd6))['catch'](handleError(_0xe75e53,null));};exports[_0x4423('0x64')]=function(_0x4a154a,_0x2688db,_0x5e277a){var _0x560198={};var _0x46f9e5={};var _0x53b002;var _0xd6fa21;return db['WhatsappQueue']['findOne']({'where':{'id':_0x4a154a[_0x4423('0x4a')]['id']}})[_0x4423('0x26')](handleEntityNotFound(_0x2688db,null))[_0x4423('0x26')](function(_0x310ae6){if(_0x310ae6){_0x53b002=_0x310ae6;_0x46f9e5[_0x4423('0x35')]=_[_0x4423('0x36')](db['Team'][_0x4423('0x31')]);_0x46f9e5['query']=_['keys'](_0x4a154a[_0x4423('0x37')]);_0x46f9e5['filters']=_[_0x4423('0x38')](_0x46f9e5[_0x4423('0x35')],_0x46f9e5[_0x4423('0x37')]);_0x560198[_0x4423('0x39')]=_['intersection'](_0x46f9e5[_0x4423('0x35')],qs[_0x4423('0x3a')](_0x4a154a[_0x4423('0x37')]['fields']));_0x560198[_0x4423('0x39')]=_0x560198[_0x4423('0x39')][_0x4423('0x3b')]?_0x560198[_0x4423('0x39')]:_0x46f9e5[_0x4423('0x35')];_0x560198[_0x4423('0x58')]=qs['sort'](_0x4a154a['query'][_0x4423('0x3e')]);_0x560198[_0x4423('0x3f')]=qs[_0x4423('0x40')](_[_0x4423('0x59')](_0x4a154a['query'],_0x46f9e5['filters']));if(_0x4a154a[_0x4423('0x37')][_0x4423('0x41')]){_0x560198['where']=_[_0x4423('0x43')](_0x560198[_0x4423('0x3f')],{'$or':_['map'](_0x560198[_0x4423('0x39')],function(_0x2c10fc){var _0x447420={};_0x447420[_0x2c10fc]={'$like':'%'+_0x4a154a[_0x4423('0x37')]['filter']+'%'};return _0x447420;})});}_0x560198=_[_0x4423('0x43')]({},_0x560198,_0x4a154a[_0x4423('0x44')]);return _0x53b002['getTeams'](_0x560198);}})[_0x4423('0x26')](function(_0x5cfc51){if(_0x5cfc51){_0xd6fa21=_0x5cfc51['length'];if(!_0x4a154a[_0x4423('0x37')]['hasOwnProperty'](_0x4423('0x3d'))){_0x560198[_0x4423('0x21')]=qs[_0x4423('0x21')](_0x4a154a[_0x4423('0x37')]['limit']);_0x560198['offset']=qs[_0x4423('0x1e')](_0x4a154a[_0x4423('0x37')]['offset']);}return _0x53b002['getTeams'](_0x560198);}})[_0x4423('0x26')](function(_0x27d6b8){if(_0x27d6b8){return _0x27d6b8?{'count':_0xd6fa21,'rows':_0x27d6b8}:null;}})['then'](respondWithResult(_0x2688db,null))['catch'](handleError(_0x2688db,null));};exports[_0x4423('0x65')]=function(_0x1cc8ea,_0xe6d866,_0x21366a){var _0x76dd61=_0x1cc8ea[_0x4423('0x54')][_0x4423('0x66')];return db['Team'][_0x4423('0x46')]({'where':{'id':_0x76dd61},'attributes':['id'],'include':[{'model':db[_0x4423('0x5a')],'as':_0x4423('0x67'),'attributes':['id','name',_0x4423('0x68'),_0x4423('0x69'),_0x4423('0x6a')],'raw':!![]}]})[_0x4423('0x26')](function(_0x42b7d9){if(_0x42b7d9){var _0x59bb48=_['flatMap'](_0x42b7d9,function(_0x1d8778){var _0x3b0f87=_0x1d8778[_0x4423('0x28')]({'plain':!![]});return _0x3b0f87[_0x4423('0x67')];});return db['WhatsappQueue'][_0x4423('0x4f')]({'where':{'id':_0x1cc8ea[_0x4423('0x4a')]['id']}})['then'](function(_0x456d84){return db[_0x4423('0x6b')][_0x4423('0x6c')](function(_0x18858d){return _0x456d84[_0x4423('0x65')](_0x76dd61,{'transaction':_0x18858d})[_0x4423('0x26')](function(){return BPromise['each'](_0x59bb48,function(_0x393be1){return db[_0x4423('0x57')][_0x4423('0x6d')]({'where':{'UserId':_0x393be1['id'],'WhatsappQueueId':_0x1cc8ea[_0x4423('0x4a')]['id']},'transaction':_0x18858d});});})[_0x4423('0x26')](function(){_0x59bb48['forEach'](function(_0x1651e5){socket[_0x4423('0x6e')](_0x4423('0x6f'),{'UserId':_0x1651e5['id'],'WhatsappQueueId':_0x456d84['id']});});});});});}})[_0x4423('0x26')](respondWithStatusCode(_0xe6d866,null))['catch'](handleError(_0xe6d866,null));};exports[_0x4423('0x70')]=function(_0x8d592b,_0x140684,_0xe1c9d1){return db[_0x4423('0x71')][_0x4423('0x46')]({'where':{'id':_0x8d592b['query'][_0x4423('0x66')]},'attributes':['id'],'include':[{'model':db[_0x4423('0x5a')],'as':_0x4423('0x67'),'attributes':['id'],'raw':!![]}]})[_0x4423('0x26')](handleEntityNotFound(_0x140684,null))[_0x4423('0x26')](function(_0xec7811){var _0x6ba097=_[_0x4423('0x2f')](_0xec7811,'id');var _0x270035=[];var _0x16283d=[];var _0x5b4ae0=squel[_0x4423('0x72')]();_0x5b4ae0[_0x4423('0x73')](_0x4423('0x74'))[_0x4423('0x75')]('team_has_whatsapp_queues','tq')['join'](_0x4423('0x76'),'ut',_0x4423('0x77'))['where'](_0x4423('0x78'),_0x8d592b[_0x4423('0x4a')]['id']);for(var _0x56d11c=0x0;_0x56d11c<_0xec7811[_0x4423('0x3b')];_0x56d11c+=0x1){let _0x2c0805=_0xec7811[_0x56d11c];for(var _0x597866=0x0;_0x597866<_0x2c0805[_0x4423('0x67')][_0x4423('0x3b')];_0x597866+=0x1){let _0x365214=_0x2c0805['Agents'][_0x597866];var _0x4f1557=_0x5b4ae0['clone']();_0x4f1557[_0x4423('0x3f')](_0x4423('0x79'),_0x365214['id']);_0x16283d[_0x4423('0x7a')](db[_0x4423('0x6b')]['query'](_0x4f1557['toString'](),{'type':db[_0x4423('0x6b')][_0x4423('0x7b')]['SELECT']})['then'](function(_0x448ee8){if(_0x448ee8['length']===0x1){return _0x365214['id'];}else{var _0x2ba840=_[_0x4423('0x7c')](_[_0x4423('0x2f')](_0x448ee8,_0x4423('0x7d')),function(_0x2a60a8){return _['includes'](_0x6ba097,_0x2a60a8);});if(_0x2ba840){return _0x365214['id'];}}}));}}return BPromise[_0x4423('0x7e')](_0x16283d)[_0x4423('0x26')](function(_0x41c12){_0x270035=_(_0x270035)['union'](_0x41c12)['compact']()['value']();return db[_0x4423('0x30')][_0x4423('0x4f')]({'where':{'id':_0x8d592b[_0x4423('0x4a')]['id']}})[_0x4423('0x26')](function(_0xa648e9){return db['sequelize'][_0x4423('0x6c')](function(_0x4d7c0c){return _0xa648e9[_0x4423('0x70')](_0x8d592b['query'][_0x4423('0x66')],{'transaction':_0x4d7c0c})[_0x4423('0x26')](function(){if(!_[_0x4423('0x7f')](_0x270035)){return _0xa648e9[_0x4423('0x80')](_0x270035,{'transaction':_0x4d7c0c});}})[_0x4423('0x26')](function(){_0x270035[_0x4423('0x81')](function(_0x2b60f3){socket[_0x4423('0x6e')]('userWhatsappQueue:remove',{'UserId':_0x2b60f3,'WhatsappQueueId':_0xa648e9['id']});});});});});});})[_0x4423('0x26')](respondWithStatusCode(_0x140684,null))[_0x4423('0x48')](handleError(_0x140684,null));};exports['addAgents']=function(_0x2a2816,_0x5a4951,_0x24642b){return db[_0x4423('0x30')]['find']({'where':{'id':_0x2a2816[_0x4423('0x4a')]['id']}})[_0x4423('0x26')](handleEntityNotFound(_0x5a4951,null))[_0x4423('0x26')](function(_0x2ffbdc){if(_0x2ffbdc){return _0x2ffbdc['addAgents'](_0x2a2816[_0x4423('0x54')]['ids'],_[_0x4423('0x82')](_0x2a2816[_0x4423('0x54')],[_0x4423('0x66'),'id'])||{})[_0x4423('0x83')](function(_0x1db612){for(var _0x16113e=0x0;_0x16113e<_0x2a2816[_0x4423('0x54')]['ids'][_0x4423('0x3b')];_0x16113e+=0x1){socket['emit'](_0x4423('0x6f'),{'UserId':Number(_0x2a2816['body'][_0x4423('0x66')][_0x16113e]),'WhatsappQueueId':Number(_0x2a2816['params']['id'])});}return _0x1db612;});}})[_0x4423('0x26')](respondWithResult(_0x5a4951,null))[_0x4423('0x48')](handleError(_0x5a4951,null));};exports[_0x4423('0x80')]=function(_0x309cd1,_0x54a896,_0x330663){return db['WhatsappQueue'][_0x4423('0x4f')]({'where':{'id':_0x309cd1['params']['id']}})['then'](handleEntityNotFound(_0x54a896,null))['then'](function(_0x4cc753){if(_0x4cc753){return _0x4cc753[_0x4423('0x80')](_0x309cd1[_0x4423('0x37')]['ids'])[_0x4423('0x26')](function(){if(_[_0x4423('0x84')](_0x309cd1['query'][_0x4423('0x66')])){for(var _0x5bac64=0x0;_0x5bac64<_0x309cd1[_0x4423('0x37')]['ids'][_0x4423('0x3b')];_0x5bac64+=0x1){socket['emit'](_0x4423('0x85'),{'UserId':Number(_0x309cd1['query'][_0x4423('0x66')][_0x5bac64]),'WhatsappQueueId':Number(_0x309cd1[_0x4423('0x4a')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x309cd1[_0x4423('0x37')]['ids']),'WhatsappQueueId':Number(_0x309cd1[_0x4423('0x4a')]['id'])});}});}})[_0x4423('0x26')](respondWithStatusCode(_0x54a896,null))[_0x4423('0x48')](handleError(_0x54a896,null));};exports[_0x4423('0x86')]=function(_0x3a43ae,_0x2d81dc,_0x1388ab){var _0x1b49aa={};var _0x1c2e70={};var _0x322aec;var _0x395c20;return db['WhatsappQueue'][_0x4423('0x56')]({'where':{'id':_0x3a43ae[_0x4423('0x4a')]['id']}})[_0x4423('0x26')](handleEntityNotFound(_0x2d81dc,null))[_0x4423('0x26')](function(_0x4a4eb3){if(_0x4a4eb3){_0x322aec=_0x4a4eb3;_0x1c2e70[_0x4423('0x35')]=_['keys'](db['User'][_0x4423('0x31')]);_0x1c2e70[_0x4423('0x37')]=_[_0x4423('0x36')](_0x3a43ae['query']);_0x1c2e70[_0x4423('0x40')]=_[_0x4423('0x38')](_0x1c2e70[_0x4423('0x35')],_0x1c2e70[_0x4423('0x37')]);_0x1b49aa[_0x4423('0x39')]=_[_0x4423('0x38')](_0x1c2e70[_0x4423('0x35')],qs['fields'](_0x3a43ae[_0x4423('0x37')][_0x4423('0x3a')]));_0x1b49aa[_0x4423('0x39')]=_0x1b49aa[_0x4423('0x39')][_0x4423('0x3b')]?_0x1b49aa[_0x4423('0x39')]:_0x1c2e70[_0x4423('0x35')];_0x1b49aa['order']=qs[_0x4423('0x3e')](_0x3a43ae[_0x4423('0x37')][_0x4423('0x3e')]);_0x1b49aa[_0x4423('0x3f')]=qs[_0x4423('0x40')](_['pick'](_0x3a43ae[_0x4423('0x37')],_0x1c2e70['filters']));if(_0x3a43ae[_0x4423('0x37')][_0x4423('0x41')]){_0x1b49aa[_0x4423('0x3f')]=_[_0x4423('0x43')](_0x1b49aa[_0x4423('0x3f')],{'$or':_['map'](_0x1b49aa[_0x4423('0x39')],function(_0x50de01){var _0x2e5b81={};_0x2e5b81[_0x50de01]={'$like':'%'+_0x3a43ae[_0x4423('0x37')][_0x4423('0x41')]+'%'};return _0x2e5b81;})});}_0x1b49aa=_[_0x4423('0x43')]({},_0x1b49aa,_0x3a43ae['options']);return _0x322aec[_0x4423('0x86')](_0x1b49aa);}})[_0x4423('0x26')](function(_0x1e5abe){if(_0x1e5abe){_0x395c20=_0x1e5abe[_0x4423('0x3b')];if(!_0x3a43ae['query'][_0x4423('0x3c')](_0x4423('0x3d'))){_0x1b49aa[_0x4423('0x21')]=qs[_0x4423('0x21')](_0x3a43ae[_0x4423('0x37')]['limit']);_0x1b49aa[_0x4423('0x1e')]=qs[_0x4423('0x1e')](_0x3a43ae['query'][_0x4423('0x1e')]);}return _0x322aec[_0x4423('0x86')](_0x1b49aa);}})[_0x4423('0x26')](function(_0x161c1a){if(_0x161c1a){return _0x161c1a?{'count':_0x395c20,'rows':_0x161c1a}:null;}})[_0x4423('0x26')](respondWithResult(_0x2d81dc,null))[_0x4423('0x48')](handleError(_0x2d81dc,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 9f88258..4b5fda0 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 _0xf7e1=['emit','hasOwnProperty','hook','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove'];(function(_0x622bb3,_0x11fb17){var _0x1b335f=function(_0x4597ce){while(--_0x4597ce){_0x622bb3['push'](_0x622bb3['shift']());}};_0x1b335f(++_0x11fb17);}(_0xf7e1,0xf3));var _0x1f7e=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xf7e1[_0x45d55e];return _0x29812a;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x1f7e('0x0'))['db'][_0x1f7e('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x1f7e('0x2')](0x0);var events={'afterCreate':_0x1f7e('0x3'),'afterUpdate':'update','afterDestroy':_0x1f7e('0x4')};function emitEvent(_0x47b260){return function(_0x45b4be,_0xd6c2f3,_0x157463){WhatsappQueueEvents[_0x1f7e('0x5')](_0x47b260+':'+_0x45b4be['id'],_0x45b4be);WhatsappQueueEvents[_0x1f7e('0x5')](_0x47b260,_0x45b4be);_0x157463(null);};}for(var e in events){if(events[_0x1f7e('0x6')](e)){var event=events[e];WhatsappQueue[_0x1f7e('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xea3b=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x1c301f,_0x3147d2){var _0x534338=function(_0x29dd11){while(--_0x29dd11){_0x1c301f['push'](_0x1c301f['shift']());}};_0x534338(++_0x3147d2);}(_0xea3b,0x19f));var _0xbea3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xea3b[_0x1d1779];return _0x2377e9;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xbea3('0x0'))['db'][_0xbea3('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xbea3('0x2')](0x0);var events={'afterCreate':_0xbea3('0x3'),'afterUpdate':_0xbea3('0x4'),'afterDestroy':_0xbea3('0x5')};function emitEvent(_0x4f08ad){return function(_0x298397,_0x209910,_0x45a377){WhatsappQueueEvents[_0xbea3('0x6')](_0x4f08ad+':'+_0x298397['id'],_0x298397);WhatsappQueueEvents[_0xbea3('0x6')](_0x4f08ad,_0x298397);_0x45a377(null);};}for(var e in events){if(events[_0xbea3('0x7')](e)){var event=events[e];WhatsappQueue[_0xbea3('0x8')](e,emitEvent(event));}}module[_0xbea3('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 7aa7a5f..34af734 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 _0x011d=['WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','request-promise','path','../../config/environment','./whatsappQueue.attributes','exports','define'];(function(_0x442f52,_0x3acdf8){var _0x587751=function(_0x423460){while(--_0x423460){_0x442f52['push'](_0x442f52['shift']());}};_0x587751(++_0x3acdf8);}(_0x011d,0x178));var _0xd011=function(_0x2436ad,_0x23e462){_0x2436ad=_0x2436ad-0x0;var _0x53a54a=_0x011d[_0x2436ad];return _0x53a54a;};'use strict';var _=require(_0xd011('0x0'));var util=require(_0xd011('0x1'));var logger=require(_0xd011('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd011('0x3'));var fs=require('fs');var path=require(_0xd011('0x4'));var rimraf=require('rimraf');var config=require(_0xd011('0x5'));var attributes=require(_0xd011('0x6'));module[_0xd011('0x7')]=function(_0x175273,_0xb3cc0f){return _0x175273[_0xd011('0x8')](_0xd011('0x9'),attributes,{'tableName':_0xd011('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1416=['WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports'];(function(_0x5138e0,_0x24fbbc){var _0x18e57b=function(_0x5eda17){while(--_0x5eda17){_0x5138e0['push'](_0x5138e0['shift']());}};_0x18e57b(++_0x24fbbc);}(_0x1416,0xe9));var _0x6141=function(_0x950e31,_0x299b10){_0x950e31=_0x950e31-0x0;var _0x472120=_0x1416[_0x950e31];return _0x472120;};'use strict';var _=require(_0x6141('0x0'));var util=require('util');var logger=require(_0x6141('0x1'))(_0x6141('0x2'));var moment=require('moment');var BPromise=require(_0x6141('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6141('0x4'));var rimraf=require(_0x6141('0x5'));var config=require(_0x6141('0x6'));var attributes=require(_0x6141('0x7'));module[_0x6141('0x8')]=function(_0x4e3b36,_0x76acc8){return _0x4e3b36['define'](_0x6141('0x9'),attributes,{'tableName':_0x6141('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 c49ad9c..9cda19a 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 _0xa796=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','limit','map','include','model','attributes','debug','stringify','ShowWhatsappQueue','find','where','catch','lodash','util','moment','randomstring'];(function(_0x1f5df2,_0x306f19){var _0x250d24=function(_0x3f4989){while(--_0x3f4989){_0x1f5df2['push'](_0x1f5df2['shift']());}};_0x250d24(++_0x306f19);}(_0xa796,0xfe));var _0x6a79=function(_0x30abd7,_0xb7a295){_0x30abd7=_0x30abd7-0x0;var _0x2bab86=_0xa796[_0x30abd7];return _0x2bab86;};'use strict';var _=require(_0x6a79('0x0'));var util=require(_0x6a79('0x1'));var moment=require(_0x6a79('0x2'));var BPromise=require('bluebird');var rs=require(_0x6a79('0x3'));var fs=require('fs');var Redis=require(_0x6a79('0x4'));var db=require(_0x6a79('0x5'))['db'];var utils=require(_0x6a79('0x6'));var logger=require(_0x6a79('0x7'))(_0x6a79('0x8'));var config=require('../../config/environment');var jayson=require(_0x6a79('0x9'));var client=jayson['client'][_0x6a79('0xa')]({'port':0x232a});config[_0x6a79('0xb')]=_[_0x6a79('0xc')](config[_0x6a79('0xb')],{'host':_0x6a79('0xd'),'port':0x18eb});var socket=require(_0x6a79('0xe'))(new Redis(config[_0x6a79('0xb')]));require(_0x6a79('0xf'))[_0x6a79('0x10')](socket);function respondWithRpcPromise(_0xd7a966,_0x3ea53e,_0x22db68){return new BPromise(function(_0x1ab7b5,_0x127ca2){return client[_0x6a79('0x11')](_0xd7a966,_0x22db68)[_0x6a79('0x12')](function(_0x2dc35d){logger[_0x6a79('0x13')](_0x6a79('0x14'),_0x3ea53e,_0x6a79('0x15'));logger['debug'](_0x6a79('0x16'),_0x3ea53e,_0x6a79('0x15'),JSON['stringify'](_0x2dc35d));if(_0x2dc35d[_0x6a79('0x17')]){if(_0x2dc35d[_0x6a79('0x17')][_0x6a79('0x18')]===0x1f4){logger[_0x6a79('0x17')](_0x6a79('0x14'),_0x3ea53e,_0x2dc35d[_0x6a79('0x17')][_0x6a79('0x19')]);return _0x127ca2(_0x2dc35d['error']['message']);}logger[_0x6a79('0x17')](_0x6a79('0x14'),_0x3ea53e,_0x2dc35d[_0x6a79('0x17')]['message']);return _0x1ab7b5(_0x2dc35d[_0x6a79('0x17')]['message']);}else{logger[_0x6a79('0x13')](_0x6a79('0x14'),_0x3ea53e,_0x6a79('0x15'));_0x1ab7b5(_0x2dc35d[_0x6a79('0x1a')]['message']);}})['catch'](function(_0x5b273d){logger[_0x6a79('0x17')](_0x6a79('0x14'),_0x3ea53e,_0x5b273d);_0x127ca2(_0x5b273d);});});}exports[_0x6a79('0x1b')]=function(_0x5272f6){var _0x19835c=this;return new Promise(function(_0x4f0161,_0x1058d9){return db[_0x6a79('0x1c')][_0x6a79('0x1d')]({'raw':_0x5272f6[_0x6a79('0x1e')]?_0x5272f6[_0x6a79('0x1e')][_0x6a79('0x1f')]===undefined?!![]:![]:!![],'where':_0x5272f6[_0x6a79('0x1e')]?_0x5272f6[_0x6a79('0x1e')]['where']||null:null,'attributes':_0x5272f6['options']?_0x5272f6[_0x6a79('0x1e')]['attributes']||null:null,'limit':_0x5272f6[_0x6a79('0x1e')]?_0x5272f6[_0x6a79('0x1e')][_0x6a79('0x20')]||null:null,'include':_0x5272f6[_0x6a79('0x1e')]?_0x5272f6['options']['include']?_[_0x6a79('0x21')](_0x5272f6[_0x6a79('0x1e')]['include'],function(_0x43f50f){return{'model':db[_0x43f50f['model']],'as':_0x43f50f['as'],'attributes':_0x43f50f['attributes'],'include':_0x43f50f['include']?_[_0x6a79('0x21')](_0x43f50f[_0x6a79('0x22')],function(_0x53d677){return{'model':db[_0x53d677[_0x6a79('0x23')]],'as':_0x53d677['as'],'attributes':_0x53d677[_0x6a79('0x24')],'include':_0x53d677[_0x6a79('0x22')]?_[_0x6a79('0x21')](_0x53d677[_0x6a79('0x22')],function(_0xfdc56d){return{'model':db[_0xfdc56d[_0x6a79('0x23')]],'as':_0xfdc56d['as'],'attributes':_0xfdc56d['attributes']};}):[]};}):[]};}):[]:[]})[_0x6a79('0x12')](function(_0xb78469){logger[_0x6a79('0x13')](_0x6a79('0x1b'),_0x5272f6);logger[_0x6a79('0x25')](_0x6a79('0x1b'),_0x5272f6,JSON[_0x6a79('0x26')](_0xb78469));_0x4f0161(_0xb78469);})['catch'](function(_0x14e5e1){logger[_0x6a79('0x17')]('GetWhatsappQueue',_0x14e5e1[_0x6a79('0x19')],_0x5272f6);_0x1058d9(_0x19835c[_0x6a79('0x17')](0x1f4,_0x14e5e1['message']));});});};exports[_0x6a79('0x27')]=function(_0x4d8670){var _0x2ae45b=this;return new Promise(function(_0x24f3ab,_0x4ca1ce){return db['WhatsappQueue'][_0x6a79('0x28')]({'raw':_0x4d8670[_0x6a79('0x1e')]?_0x4d8670[_0x6a79('0x1e')][_0x6a79('0x1f')]===undefined?!![]:![]:!![],'where':_0x4d8670['options']?_0x4d8670[_0x6a79('0x1e')][_0x6a79('0x29')]||null:null,'attributes':_0x4d8670[_0x6a79('0x1e')]?_0x4d8670['options'][_0x6a79('0x24')]||null:null,'include':_0x4d8670['options']?_0x4d8670[_0x6a79('0x1e')][_0x6a79('0x22')]?_[_0x6a79('0x21')](_0x4d8670['options'][_0x6a79('0x22')],function(_0x3893ff){return{'model':db[_0x3893ff[_0x6a79('0x23')]],'as':_0x3893ff['as'],'attributes':_0x3893ff[_0x6a79('0x24')],'include':_0x3893ff[_0x6a79('0x22')]?_[_0x6a79('0x21')](_0x3893ff[_0x6a79('0x22')],function(_0x5b622a){return{'model':db[_0x5b622a[_0x6a79('0x23')]],'as':_0x5b622a['as'],'attributes':_0x5b622a[_0x6a79('0x24')],'include':_0x5b622a[_0x6a79('0x22')]?_[_0x6a79('0x21')](_0x5b622a[_0x6a79('0x22')],function(_0x74a535){return{'model':db[_0x74a535[_0x6a79('0x23')]],'as':_0x74a535['as'],'attributes':_0x74a535[_0x6a79('0x24')]};}):[]};}):[]};}):[]:[]})[_0x6a79('0x12')](function(_0x47ec94){logger['info'](_0x6a79('0x27'),_0x4d8670);logger[_0x6a79('0x25')]('ShowWhatsappQueue',_0x4d8670,JSON['stringify'](_0x47ec94));_0x24f3ab(_0x47ec94);})[_0x6a79('0x2a')](function(_0x5f5c56){logger[_0x6a79('0x17')](_0x6a79('0x27'),_0x5f5c56[_0x6a79('0x19')],_0x4d8670);_0x4ca1ce(_0x2ae45b[_0x6a79('0x17')](0x1f4,_0x5f5c56['message']));});});}; \ No newline at end of file +var _0x0707=['request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','then','ShowWhatsappQueue','find','map','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','info','WhatsappQueue,\x20%s,\x20%s'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0x0707,0x91));var _0x7070=function(_0x402869,_0x327918){_0x402869=_0x402869-0x0;var _0x365a0d=_0x0707[_0x402869];return _0x365a0d;};'use strict';var _=require(_0x7070('0x0'));var util=require(_0x7070('0x1'));var moment=require(_0x7070('0x2'));var BPromise=require(_0x7070('0x3'));var rs=require(_0x7070('0x4'));var fs=require('fs');var Redis=require(_0x7070('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7070('0x6'));var logger=require(_0x7070('0x7'))(_0x7070('0x8'));var config=require('../../config/environment');var jayson=require(_0x7070('0x9'));var client=jayson[_0x7070('0xa')]['http']({'port':0x232a});config['redis']=_[_0x7070('0xb')](config[_0x7070('0xc')],{'host':_0x7070('0xd'),'port':0x18eb});var socket=require(_0x7070('0xe'))(new Redis(config[_0x7070('0xc')]));require(_0x7070('0xf'))[_0x7070('0x10')](socket);function respondWithRpcPromise(_0x41fd2e,_0x348ce2,_0x58b592){return new BPromise(function(_0x40b72c,_0x30cb60){return client['request'](_0x41fd2e,_0x58b592)['then'](function(_0x485208){logger[_0x7070('0x11')](_0x7070('0x12'),_0x348ce2,_0x7070('0x13'));logger[_0x7070('0x14')](_0x7070('0x15'),_0x348ce2,_0x7070('0x13'),JSON[_0x7070('0x16')](_0x485208));if(_0x485208[_0x7070('0x17')]){if(_0x485208[_0x7070('0x17')][_0x7070('0x18')]===0x1f4){logger[_0x7070('0x17')](_0x7070('0x12'),_0x348ce2,_0x485208[_0x7070('0x17')]['message']);return _0x30cb60(_0x485208[_0x7070('0x17')][_0x7070('0x19')]);}logger['error'](_0x7070('0x12'),_0x348ce2,_0x485208['error'][_0x7070('0x19')]);return _0x40b72c(_0x485208['error']['message']);}else{logger[_0x7070('0x11')](_0x7070('0x12'),_0x348ce2,_0x7070('0x13'));_0x40b72c(_0x485208['result'][_0x7070('0x19')]);}})[_0x7070('0x1a')](function(_0x2d22da){logger[_0x7070('0x17')](_0x7070('0x12'),_0x348ce2,_0x2d22da);_0x30cb60(_0x2d22da);});});}exports[_0x7070('0x1b')]=function(_0x1fcd7e){var _0x4a51f4=this;return new Promise(function(_0x2c3e8c,_0x3f1417){return db[_0x7070('0x1c')][_0x7070('0x1d')]({'raw':_0x1fcd7e[_0x7070('0x1e')]?_0x1fcd7e['options'][_0x7070('0x1f')]===undefined?!![]:![]:!![],'where':_0x1fcd7e['options']?_0x1fcd7e['options'][_0x7070('0x20')]||null:null,'attributes':_0x1fcd7e['options']?_0x1fcd7e['options'][_0x7070('0x21')]||null:null,'limit':_0x1fcd7e[_0x7070('0x1e')]?_0x1fcd7e[_0x7070('0x1e')][_0x7070('0x22')]||null:null,'include':_0x1fcd7e[_0x7070('0x1e')]?_0x1fcd7e['options'][_0x7070('0x23')]?_['map'](_0x1fcd7e[_0x7070('0x1e')]['include'],function(_0x268289){return{'model':db[_0x268289[_0x7070('0x24')]],'as':_0x268289['as'],'attributes':_0x268289['attributes'],'include':_0x268289[_0x7070('0x23')]?_['map'](_0x268289[_0x7070('0x23')],function(_0x4508aa){return{'model':db[_0x4508aa[_0x7070('0x24')]],'as':_0x4508aa['as'],'attributes':_0x4508aa[_0x7070('0x21')],'include':_0x4508aa[_0x7070('0x23')]?_['map'](_0x4508aa[_0x7070('0x23')],function(_0x4559d3){return{'model':db[_0x4559d3[_0x7070('0x24')]],'as':_0x4559d3['as'],'attributes':_0x4559d3[_0x7070('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7070('0x25')](function(_0x3b15dc){logger[_0x7070('0x11')](_0x7070('0x1b'),_0x1fcd7e);logger[_0x7070('0x14')]('GetWhatsappQueue',_0x1fcd7e,JSON[_0x7070('0x16')](_0x3b15dc));_0x2c3e8c(_0x3b15dc);})[_0x7070('0x1a')](function(_0x873f22){logger['error'](_0x7070('0x1b'),_0x873f22[_0x7070('0x19')],_0x1fcd7e);_0x3f1417(_0x4a51f4['error'](0x1f4,_0x873f22[_0x7070('0x19')]));});});};exports[_0x7070('0x26')]=function(_0x1e5f05){var _0x14e1c6=this;return new Promise(function(_0x1ca334,_0xc34e88){return db[_0x7070('0x1c')][_0x7070('0x27')]({'raw':_0x1e5f05['options']?_0x1e5f05['options'][_0x7070('0x1f')]===undefined?!![]:![]:!![],'where':_0x1e5f05[_0x7070('0x1e')]?_0x1e5f05['options'][_0x7070('0x20')]||null:null,'attributes':_0x1e5f05[_0x7070('0x1e')]?_0x1e5f05[_0x7070('0x1e')]['attributes']||null:null,'include':_0x1e5f05[_0x7070('0x1e')]?_0x1e5f05['options']['include']?_[_0x7070('0x28')](_0x1e5f05['options'][_0x7070('0x23')],function(_0x57506f){return{'model':db[_0x57506f[_0x7070('0x24')]],'as':_0x57506f['as'],'attributes':_0x57506f[_0x7070('0x21')],'include':_0x57506f[_0x7070('0x23')]?_['map'](_0x57506f[_0x7070('0x23')],function(_0x211ed9){return{'model':db[_0x211ed9[_0x7070('0x24')]],'as':_0x211ed9['as'],'attributes':_0x211ed9[_0x7070('0x21')],'include':_0x211ed9['include']?_[_0x7070('0x28')](_0x211ed9[_0x7070('0x23')],function(_0x47b71d){return{'model':db[_0x47b71d[_0x7070('0x24')]],'as':_0x47b71d['as'],'attributes':_0x47b71d[_0x7070('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7070('0x25')](function(_0x20868b){logger[_0x7070('0x11')](_0x7070('0x26'),_0x1e5f05);logger[_0x7070('0x14')](_0x7070('0x26'),_0x1e5f05,JSON['stringify'](_0x20868b));_0x1ca334(_0x20868b);})[_0x7070('0x1a')](function(_0x511a3f){logger[_0x7070('0x17')]('ShowWhatsappQueue',_0x511a3f[_0x7070('0x19')],_0x1e5f05);_0xc34e88(_0x14e1c6[_0x7070('0x17')](0x1f4,_0x511a3f['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 7156d32..bf597ab 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 _0x4fbe=['emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x785590,_0x53a07a){var _0x4dace6=function(_0x22b739){while(--_0x22b739){_0x785590['push'](_0x785590['shift']());}};_0x4dace6(++_0x53a07a);}(_0x4fbe,0x185));var _0xe4fb=function(_0x124202,_0x194d52){_0x124202=_0x124202-0x0;var _0xdd91f6=_0x4fbe[_0x124202];return _0xdd91f6;};'use strict';var WhatsappQueueEvents=require(_0xe4fb('0x0'));var events=[_0xe4fb('0x1'),_0xe4fb('0x2'),'update'];function createListener(_0x2961ae,_0x23c4ab){return function(_0x3dff62){_0x23c4ab[_0xe4fb('0x3')](_0x2961ae,_0x3dff62);};}function removeListener(_0x51ac3a,_0x289ee4){return function(){WhatsappQueueEvents[_0xe4fb('0x4')](_0x51ac3a,_0x289ee4);};}exports[_0xe4fb('0x5')]=function(_0x5b4caa){for(var _0x12153d=0x0,_0x49609f=events[_0xe4fb('0x6')];_0x12153d<_0x49609f;_0x12153d++){var _0x50c441=events[_0x12153d];var _0x2222fd=createListener(_0xe4fb('0x7')+_0x50c441,_0x5b4caa);WhatsappQueueEvents['on'](_0x50c441,_0x2222fd);}}; \ No newline at end of file +var _0xb9f5=['length','whatsappQueue:','save','remove','emit'];(function(_0x190325,_0x27adef){var _0x1b4c89=function(_0xd01a43){while(--_0xd01a43){_0x190325['push'](_0x190325['shift']());}};_0x1b4c89(++_0x27adef);}(_0xb9f5,0x165));var _0x5b9f=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0xb9f5[_0x37ffea];return _0x2e2615;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x5b9f('0x0'),_0x5b9f('0x1'),'update'];function createListener(_0x350de3,_0x587de7){return function(_0x1604ed){_0x587de7[_0x5b9f('0x2')](_0x350de3,_0x1604ed);};}function removeListener(_0x1e05a6,_0x159271){return function(){WhatsappQueueEvents['removeListener'](_0x1e05a6,_0x159271);};}exports['register']=function(_0x643a63){for(var _0x435bf3=0x0,_0x119749=events[_0x5b9f('0x3')];_0x435bf3<_0x119749;_0x435bf3++){var _0xd834de=events[_0x435bf3];var _0x2e1b67=createListener(_0x5b9f('0x4')+_0xd834de,_0x643a63);WhatsappQueueEvents['on'](_0xd834de,_0x2e1b67);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 658ac73..ca6d560 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 _0x91b4=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x13ac7e,_0x21b73e){var _0x55801d=function(_0x3e6504){while(--_0x3e6504){_0x13ac7e['push'](_0x13ac7e['shift']());}};_0x55801d(++_0x21b73e);}(_0x91b4,0x1b4));var _0x491b=function(_0x214aec,_0x2ad56c){_0x214aec=_0x214aec-0x0;var _0x29a23d=_0x91b4[_0x214aec];return _0x29a23d;};'use strict';var multer=require(_0x491b('0x0'));var util=require(_0x491b('0x1'));var path=require(_0x491b('0x2'));var timeout=require(_0x491b('0x3'));var express=require(_0x491b('0x4'));var router=express[_0x491b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x491b('0x6'));var interaction=require(_0x491b('0x7'));var config=require(_0x491b('0x8'));var controller=require(_0x491b('0x9'));router[_0x491b('0xa')]('/',auth[_0x491b('0xb')](),controller[_0x491b('0xc')]);router[_0x491b('0xa')](_0x491b('0xd'),auth[_0x491b('0xb')](),controller['describe']);router[_0x491b('0xa')]('/:id',auth[_0x491b('0xb')](),controller['show']);router['post']('/',auth[_0x491b('0xb')](),controller[_0x491b('0xe')]);router[_0x491b('0xf')](_0x491b('0x10'),auth[_0x491b('0xb')](),controller[_0x491b('0x11')]);router[_0x491b('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x491b('0x13')]);module['exports']=router; \ No newline at end of file +var _0xd3f0=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0xd3f0,0x160));var _0x0d3f=function(_0x4f41a0,_0xeb6e74){_0x4f41a0=_0x4f41a0-0x0;var _0x1618cd=_0xd3f0[_0x4f41a0];return _0x1618cd;};'use strict';var multer=require(_0x0d3f('0x0'));var util=require(_0x0d3f('0x1'));var path=require(_0x0d3f('0x2'));var timeout=require(_0x0d3f('0x3'));var express=require(_0x0d3f('0x4'));var router=express[_0x0d3f('0x5')]();var fs_extra=require(_0x0d3f('0x6'));var auth=require(_0x0d3f('0x7'));var interaction=require(_0x0d3f('0x8'));var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x0d3f('0x9')](),controller[_0x0d3f('0xa')]);router[_0x0d3f('0xb')](_0x0d3f('0xc'),auth[_0x0d3f('0x9')](),controller['describe']);router[_0x0d3f('0xb')](_0x0d3f('0xd'),auth[_0x0d3f('0x9')](),controller[_0x0d3f('0xe')]);router[_0x0d3f('0xf')]('/',auth[_0x0d3f('0x9')](),controller[_0x0d3f('0x10')]);router[_0x0d3f('0x11')]('/:id',auth[_0x0d3f('0x9')](),controller[_0x0d3f('0x12')]);router[_0x0d3f('0x13')](_0x0d3f('0xd'),auth['isAuthenticated'](),controller[_0x0d3f('0x14')]);module[_0x0d3f('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index f2a0496..ab0e383 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(_0x23b47f,_0x4f805e){var _0x5af260=function(_0x39a52c){while(--_0x39a52c){_0x23b47f['push'](_0x23b47f['shift']());}};_0x5af260(++_0x4f805e);}(_0x7a54,0x106));var _0x47a5=function(_0x560f96,_0x412896){_0x560f96=_0x560f96-0x0;var _0x297b60=_0x7a54[_0x560f96];return _0x297b60;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x4240f7,_0x50daab){var _0x2c2564=function(_0x1c550e){while(--_0x1c550e){_0x4240f7['push'](_0x4240f7['shift']());}};_0x2c2564(++_0x50daab);}(_0x7a54,0x106));var _0x47a5=function(_0x50fe87,_0x3bec30){_0x50fe87=_0x50fe87-0x0;var _0x327051=_0x7a54[_0x50fe87];return _0x327051;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 936518e..f156c48 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 _0xe511=['destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','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','sendStatus','status','end','json','offset','limit','count','set','Content-Range','save','update','then','error','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','WhatsappQueueReport','findAll','catch','show','params','rawAttributes','find','create','body'];(function(_0x545209,_0x1cf1f8){var _0x2c1944=function(_0x58cac0){while(--_0x58cac0){_0x545209['push'](_0x545209['shift']());}};_0x2c1944(++_0x1cf1f8);}(_0xe511,0x16f));var _0x1e51=function(_0x5dbb3e,_0x4b494d){_0x5dbb3e=_0x5dbb3e-0x0;var _0x138d23=_0xe511[_0x5dbb3e];return _0x138d23;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];function respondWithStatusCode(_0x3c5330,_0x5544eb){_0x5544eb=_0x5544eb||0xcc;return function(_0x408a77){if(_0x408a77){return _0x3c5330[_0x1e51('0x18')](_0x5544eb);}return _0x3c5330[_0x1e51('0x19')](_0x5544eb)[_0x1e51('0x1a')]();};}function respondWithResult(_0x21bcbd,_0x32945d){_0x32945d=_0x32945d||0xc8;return function(_0x441c70){if(_0x441c70){return _0x21bcbd[_0x1e51('0x19')](_0x32945d)[_0x1e51('0x1b')](_0x441c70);}};}function respondWithFilteredResult(_0xd76fba,_0x5a5c07){return function(_0x3b01b7){if(_0x3b01b7){var _0x24db4f=typeof _0x5a5c07[_0x1e51('0x1c')]==='undefined'&&typeof _0x5a5c07[_0x1e51('0x1d')]==='undefined';var _0x53d222=_0x3b01b7[_0x1e51('0x1e')];var _0x27dcad=_0x24db4f?0x0:_0x5a5c07[_0x1e51('0x1c')];var _0x4785a5=_0x24db4f?_0x3b01b7[_0x1e51('0x1e')]:_0x5a5c07[_0x1e51('0x1c')]+_0x5a5c07['limit'];var _0x39449b;if(_0x4785a5>=_0x53d222){_0x4785a5=_0x53d222;_0x39449b=0xc8;}else{_0x39449b=0xce;}_0xd76fba['status'](_0x39449b);return _0xd76fba[_0x1e51('0x1f')](_0x1e51('0x20'),_0x27dcad+'-'+_0x4785a5+'/'+_0x53d222)[_0x1e51('0x1b')](_0x3b01b7);}return null;};}function patchUpdates(_0x183a95){return function(_0x506f40){try{jsonpatch['apply'](_0x506f40,_0x183a95,!![]);}catch(_0x4e6a49){return BPromise['reject'](_0x4e6a49);}return _0x506f40[_0x1e51('0x21')]();};}function saveUpdates(_0x4f1f56,_0x3f7340){return function(_0x28aacb){if(_0x28aacb){return _0x28aacb[_0x1e51('0x22')](_0x4f1f56)[_0x1e51('0x23')](function(_0x23c85a){return _0x23c85a;});}return null;};}function removeEntity(_0xf9298,_0x270adf){return function(_0x461d3d){if(_0x461d3d){return _0x461d3d['destroy']()['then'](function(){_0xf9298[_0x1e51('0x19')](0xcc)[_0x1e51('0x1a')]();});}};}function handleEntityNotFound(_0x2e42b1,_0x1386db){return function(_0x505d79){if(!_0x505d79){_0x2e42b1['sendStatus'](0x194);}return _0x505d79;};}function handleError(_0x486ad6,_0x1eb83f){_0x1eb83f=_0x1eb83f||0x1f4;return function(_0x2a1561){logger[_0x1e51('0x24')](_0x2a1561['stack']);if(_0x2a1561[_0x1e51('0x25')]){delete _0x2a1561['name'];}_0x486ad6['status'](_0x1eb83f)[_0x1e51('0x26')](_0x2a1561);};}exports['index']=function(_0x170ec6,_0x1eb79f){var _0x56722f={},_0x3e6ef2={},_0x10ee23={'count':0x0,'rows':[]};var _0x71c7af=_[_0x1e51('0x27')](db['WhatsappQueueReport']['rawAttributes'],function(_0x4f67d3){return{'name':_0x4f67d3[_0x1e51('0x28')],'type':_0x4f67d3[_0x1e51('0x29')][_0x1e51('0x2a')]};});_0x3e6ef2[_0x1e51('0x2b')]=_[_0x1e51('0x27')](_0x71c7af,_0x1e51('0x25'));_0x3e6ef2[_0x1e51('0x2c')]=_[_0x1e51('0x2d')](_0x170ec6[_0x1e51('0x2c')]);_0x3e6ef2[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x3e6ef2['model'],_0x3e6ef2[_0x1e51('0x2c')]);_0x56722f[_0x1e51('0x30')]=_[_0x1e51('0x2f')](_0x3e6ef2[_0x1e51('0x2b')],qs[_0x1e51('0x31')](_0x170ec6['query'][_0x1e51('0x31')]));_0x56722f['attributes']=_0x56722f[_0x1e51('0x30')][_0x1e51('0x32')]?_0x56722f[_0x1e51('0x30')]:_0x3e6ef2['model'];if(!_0x170ec6[_0x1e51('0x2c')]['hasOwnProperty'](_0x1e51('0x33'))){_0x56722f['limit']=qs['limit'](_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x1d')]);_0x56722f[_0x1e51('0x1c')]=qs['offset'](_0x170ec6[_0x1e51('0x2c')]['offset']);}_0x56722f[_0x1e51('0x34')]=qs[_0x1e51('0x35')](_0x170ec6['query'][_0x1e51('0x35')]);_0x56722f[_0x1e51('0x36')]=qs[_0x1e51('0x2e')](_[_0x1e51('0x37')](_0x170ec6[_0x1e51('0x2c')],_0x3e6ef2[_0x1e51('0x2e')]),_0x71c7af);if(_0x170ec6['query']['filter']){_0x56722f[_0x1e51('0x36')]=_['merge'](_0x56722f[_0x1e51('0x36')],{'$or':_[_0x1e51('0x27')](_0x71c7af,function(_0x32c41b){if(_0x32c41b[_0x1e51('0x29')]!==_0x1e51('0x38')){var _0x174a24={};_0x174a24[_0x32c41b[_0x1e51('0x25')]]={'$like':'%'+_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x39')]+'%'};return _0x174a24;}})});}_0x56722f=_[_0x1e51('0x3a')]({},_0x56722f,_0x170ec6[_0x1e51('0x3b')]);var _0x5360b3={'where':_0x56722f[_0x1e51('0x36')]};return db['WhatsappQueueReport'][_0x1e51('0x1e')](_0x5360b3)[_0x1e51('0x23')](function(_0x2b287e){_0x10ee23[_0x1e51('0x1e')]=_0x2b287e;if(_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x3c')]){_0x56722f[_0x1e51('0x3d')]=[{'all':!![]}];}return db[_0x1e51('0x3e')][_0x1e51('0x3f')](_0x56722f);})[_0x1e51('0x23')](function(_0xc40fce){_0x10ee23['rows']=_0xc40fce;return _0x10ee23;})['then'](respondWithFilteredResult(_0x1eb79f,_0x56722f))[_0x1e51('0x40')](handleError(_0x1eb79f,null));};exports[_0x1e51('0x41')]=function(_0x3be495,_0x4650e4){var _0x1ef3d3={'raw':!![],'where':{'id':_0x3be495[_0x1e51('0x42')]['id']}},_0x1a9e0d={};_0x1a9e0d[_0x1e51('0x2b')]=_['keys'](db[_0x1e51('0x3e')][_0x1e51('0x43')]);_0x1a9e0d[_0x1e51('0x2c')]=_[_0x1e51('0x2d')](_0x3be495[_0x1e51('0x2c')]);_0x1a9e0d[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x1a9e0d['model'],_0x1a9e0d[_0x1e51('0x2c')]);_0x1ef3d3[_0x1e51('0x30')]=_['intersection'](_0x1a9e0d[_0x1e51('0x2b')],qs[_0x1e51('0x31')](_0x3be495[_0x1e51('0x2c')]['fields']));_0x1ef3d3[_0x1e51('0x30')]=_0x1ef3d3[_0x1e51('0x30')][_0x1e51('0x32')]?_0x1ef3d3[_0x1e51('0x30')]:_0x1a9e0d[_0x1e51('0x2b')];if(_0x3be495[_0x1e51('0x2c')][_0x1e51('0x3c')]){_0x1ef3d3[_0x1e51('0x3d')]=[{'all':!![]}];}_0x1ef3d3=_[_0x1e51('0x3a')]({},_0x1ef3d3,_0x3be495['options']);return db[_0x1e51('0x3e')][_0x1e51('0x44')](_0x1ef3d3)['then'](handleEntityNotFound(_0x4650e4,null))[_0x1e51('0x23')](respondWithResult(_0x4650e4,null))[_0x1e51('0x40')](handleError(_0x4650e4,null));};exports[_0x1e51('0x45')]=function(_0x4f6405,_0x44468a){return db[_0x1e51('0x3e')][_0x1e51('0x45')](_0x4f6405['body'],{})[_0x1e51('0x23')](respondWithResult(_0x44468a,0xc9))['catch'](handleError(_0x44468a,null));};exports['update']=function(_0x54688b,_0x169e6c){if(_0x54688b[_0x1e51('0x46')]['id']){delete _0x54688b['body']['id'];}return db['WhatsappQueueReport'][_0x1e51('0x44')]({'where':{'id':_0x54688b[_0x1e51('0x42')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x169e6c,null))[_0x1e51('0x23')](saveUpdates(_0x54688b[_0x1e51('0x46')],null))[_0x1e51('0x23')](respondWithResult(_0x169e6c,null))['catch'](handleError(_0x169e6c,null));};exports[_0x1e51('0x47')]=function(_0x48a2d0,_0xf6bd35){return db[_0x1e51('0x3e')]['find']({'where':{'id':_0x48a2d0['params']['id']}})['then'](handleEntityNotFound(_0xf6bd35,null))[_0x1e51('0x23')](removeEntity(_0xf6bd35,null))[_0x1e51('0x40')](handleError(_0xf6bd35,null));};exports[_0x1e51('0x48')]=function(_0x4cdfe3,_0x2fdee1){return db[_0x1e51('0x3e')][_0x1e51('0x48')]()[_0x1e51('0x23')](respondWithResult(_0x2fdee1,null))[_0x1e51('0x40')](handleError(_0x2fdee1,null));}; \ No newline at end of file +var _0x373d=['order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','show','rawAttributes','includeAll','options','catch','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappQueueReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0xdd15fd,_0x161a0a){var _0x3d71fd=function(_0x128859){while(--_0x128859){_0xdd15fd['push'](_0xdd15fd['shift']());}};_0x3d71fd(++_0x161a0a);}(_0x373d,0x1e2));var _0xd373=function(_0x1aaf71,_0x495878){_0x1aaf71=_0x1aaf71-0x0;var _0x1a3993=_0x373d[_0x1aaf71];return _0x1a3993;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c7f91,_0x5ab89c){_0x5ab89c=_0x5ab89c||0xcc;return function(_0xcd9b8c){if(_0xcd9b8c){return _0x4c7f91[_0xd373('0x15')](_0x5ab89c);}return _0x4c7f91['status'](_0x5ab89c)[_0xd373('0x16')]();};}function respondWithResult(_0x129475,_0x27c161){_0x27c161=_0x27c161||0xc8;return function(_0x23ed86){if(_0x23ed86){return _0x129475[_0xd373('0x17')](_0x27c161)[_0xd373('0x18')](_0x23ed86);}};}function respondWithFilteredResult(_0x20aca5,_0x2eacb1){return function(_0x5a286a){if(_0x5a286a){var _0x2c5854=typeof _0x2eacb1[_0xd373('0x19')]===_0xd373('0x1a')&&typeof _0x2eacb1[_0xd373('0x1b')]==='undefined';var _0x1e26cf=_0x5a286a['count'];var _0x460259=_0x2c5854?0x0:_0x2eacb1[_0xd373('0x19')];var _0x55c5c7=_0x2c5854?_0x5a286a[_0xd373('0x1c')]:_0x2eacb1['offset']+_0x2eacb1['limit'];var _0x23fada;if(_0x55c5c7>=_0x1e26cf){_0x55c5c7=_0x1e26cf;_0x23fada=0xc8;}else{_0x23fada=0xce;}_0x20aca5[_0xd373('0x17')](_0x23fada);return _0x20aca5[_0xd373('0x1d')](_0xd373('0x1e'),_0x460259+'-'+_0x55c5c7+'/'+_0x1e26cf)[_0xd373('0x18')](_0x5a286a);}return null;};}function patchUpdates(_0x181eb2){return function(_0x4ba510){try{jsonpatch[_0xd373('0x1f')](_0x4ba510,_0x181eb2,!![]);}catch(_0xd808f8){return BPromise[_0xd373('0x20')](_0xd808f8);}return _0x4ba510[_0xd373('0x21')]();};}function saveUpdates(_0x165e21,_0x3aa1c5){return function(_0x4f64bd){if(_0x4f64bd){return _0x4f64bd[_0xd373('0x22')](_0x165e21)[_0xd373('0x23')](function(_0x157f81){return _0x157f81;});}return null;};}function removeEntity(_0x209ca7,_0x217ee7){return function(_0x238ffd){if(_0x238ffd){return _0x238ffd[_0xd373('0x24')]()[_0xd373('0x23')](function(){_0x209ca7[_0xd373('0x17')](0xcc)[_0xd373('0x16')]();});}};}function handleEntityNotFound(_0x437110,_0x34f05a){return function(_0x388182){if(!_0x388182){_0x437110[_0xd373('0x15')](0x194);}return _0x388182;};}function handleError(_0x18d7ab,_0x38ba50){_0x38ba50=_0x38ba50||0x1f4;return function(_0x50b987){logger[_0xd373('0x25')](_0x50b987[_0xd373('0x26')]);if(_0x50b987[_0xd373('0x27')]){delete _0x50b987[_0xd373('0x27')];}_0x18d7ab[_0xd373('0x17')](_0x38ba50)[_0xd373('0x28')](_0x50b987);};}exports[_0xd373('0x29')]=function(_0xf85ca8,_0x2869e5){var _0x158825={},_0xbc420b={},_0x2ee37c={'count':0x0,'rows':[]};var _0x7dad3e=_['map'](db[_0xd373('0x2a')]['rawAttributes'],function(_0x498aaa){return{'name':_0x498aaa[_0xd373('0x2b')],'type':_0x498aaa[_0xd373('0x2c')][_0xd373('0x2d')]};});_0xbc420b[_0xd373('0x2e')]=_[_0xd373('0x2f')](_0x7dad3e,'name');_0xbc420b[_0xd373('0x30')]=_[_0xd373('0x31')](_0xf85ca8['query']);_0xbc420b[_0xd373('0x32')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],_0xbc420b[_0xd373('0x30')]);_0x158825[_0xd373('0x34')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],qs[_0xd373('0x35')](_0xf85ca8[_0xd373('0x30')]['fields']));_0x158825[_0xd373('0x34')]=_0x158825[_0xd373('0x34')][_0xd373('0x36')]?_0x158825[_0xd373('0x34')]:_0xbc420b[_0xd373('0x2e')];if(!_0xf85ca8[_0xd373('0x30')][_0xd373('0x37')](_0xd373('0x38'))){_0x158825[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x1b')]);_0x158825[_0xd373('0x19')]=qs[_0xd373('0x19')](_0xf85ca8[_0xd373('0x30')]['offset']);}_0x158825[_0xd373('0x39')]=qs[_0xd373('0x3a')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x3a')]);_0x158825['where']=qs[_0xd373('0x32')](_[_0xd373('0x3b')](_0xf85ca8[_0xd373('0x30')],_0xbc420b[_0xd373('0x32')]),_0x7dad3e);if(_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]){_0x158825['where']=_['merge'](_0x158825[_0xd373('0x3d')],{'$or':_['map'](_0x7dad3e,function(_0x37c97e){if(_0x37c97e[_0xd373('0x2c')]!==_0xd373('0x3e')){var _0x51ba69={};_0x51ba69[_0x37c97e[_0xd373('0x27')]]={'$like':'%'+_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]+'%'};return _0x51ba69;}})});}_0x158825=_[_0xd373('0x3f')]({},_0x158825,_0xf85ca8['options']);var _0x513038={'where':_0x158825['where']};return db[_0xd373('0x2a')]['count'](_0x513038)[_0xd373('0x23')](function(_0x2fa6c4){_0x2ee37c['count']=_0x2fa6c4;if(_0xf85ca8['query']['includeAll']){_0x158825[_0xd373('0x40')]=[{'all':!![]}];}return db[_0xd373('0x2a')][_0xd373('0x41')](_0x158825);})['then'](function(_0x5c3b22){_0x2ee37c[_0xd373('0x42')]=_0x5c3b22;return _0x2ee37c;})[_0xd373('0x23')](respondWithFilteredResult(_0x2869e5,_0x158825))['catch'](handleError(_0x2869e5,null));};exports[_0xd373('0x43')]=function(_0x2ee75f,_0x1e3de1){var _0x9989e4={'raw':!![],'where':{'id':_0x2ee75f['params']['id']}},_0x2d8c7d={};_0x2d8c7d['model']=_[_0xd373('0x31')](db[_0xd373('0x2a')][_0xd373('0x44')]);_0x2d8c7d[_0xd373('0x30')]=_['keys'](_0x2ee75f[_0xd373('0x30')]);_0x2d8c7d['filters']=_[_0xd373('0x33')](_0x2d8c7d[_0xd373('0x2e')],_0x2d8c7d[_0xd373('0x30')]);_0x9989e4[_0xd373('0x34')]=_[_0xd373('0x33')](_0x2d8c7d['model'],qs[_0xd373('0x35')](_0x2ee75f[_0xd373('0x30')]['fields']));_0x9989e4[_0xd373('0x34')]=_0x9989e4[_0xd373('0x34')][_0xd373('0x36')]?_0x9989e4[_0xd373('0x34')]:_0x2d8c7d[_0xd373('0x2e')];if(_0x2ee75f[_0xd373('0x30')][_0xd373('0x45')]){_0x9989e4[_0xd373('0x40')]=[{'all':!![]}];}_0x9989e4=_[_0xd373('0x3f')]({},_0x9989e4,_0x2ee75f[_0xd373('0x46')]);return db['WhatsappQueueReport']['find'](_0x9989e4)[_0xd373('0x23')](handleEntityNotFound(_0x1e3de1,null))['then'](respondWithResult(_0x1e3de1,null))[_0xd373('0x47')](handleError(_0x1e3de1,null));};exports['create']=function(_0x5e5279,_0x5cbc16){return db[_0xd373('0x2a')][_0xd373('0x48')](_0x5e5279[_0xd373('0x49')],{})[_0xd373('0x23')](respondWithResult(_0x5cbc16,0xc9))[_0xd373('0x47')](handleError(_0x5cbc16,null));};exports[_0xd373('0x22')]=function(_0x1855aa,_0x4d1088){if(_0x1855aa[_0xd373('0x49')]['id']){delete _0x1855aa['body']['id'];}return db[_0xd373('0x2a')][_0xd373('0x4a')]({'where':{'id':_0x1855aa['params']['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4d1088,null))['then'](saveUpdates(_0x1855aa[_0xd373('0x49')],null))[_0xd373('0x23')](respondWithResult(_0x4d1088,null))[_0xd373('0x47')](handleError(_0x4d1088,null));};exports[_0xd373('0x24')]=function(_0xe22cbd,_0x4bc631){return db['WhatsappQueueReport']['find']({'where':{'id':_0xe22cbd[_0xd373('0x4b')]['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4bc631,null))['then'](removeEntity(_0x4bc631,null))[_0xd373('0x47')](handleError(_0x4bc631,null));};exports[_0xd373('0x4c')]=function(_0x4d7020,_0xae7067){return db[_0xd373('0x2a')][_0xd373('0x4c')]()[_0xd373('0x23')](respondWithResult(_0xae7067,null))[_0xd373('0x47')](handleError(_0xae7067,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 2aceef9..175f68a 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 _0x4652=['report_whatsapp_queue','uniqueid','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport'];(function(_0x10c4d0,_0x361fe8){var _0x251e61=function(_0x3aa19d){while(--_0x3aa19d){_0x10c4d0['push'](_0x10c4d0['shift']());}};_0x251e61(++_0x361fe8);}(_0x4652,0xbd));var _0x2465=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4652[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2465('0x0'));var moment=require(_0x2465('0x1'));var BPromise=require(_0x2465('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2465('0x3'));var rimraf=require(_0x2465('0x4'));var config=require(_0x2465('0x5'));var attributes=require(_0x2465('0x6'));module['exports']=function(_0x2a4d7c,_0x4e27d1){return _0x2a4d7c[_0x2465('0x7')](_0x2465('0x8'),attributes,{'tableName':_0x2465('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2465('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e78=['path','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xd9e1a7,_0x5f5386){var _0x105ce1=function(_0x472be8){while(--_0x472be8){_0xd9e1a7['push'](_0xd9e1a7['shift']());}};_0x105ce1(++_0x5f5386);}(_0x0e78,0x1f4));var _0x80e7=function(_0x28560c,_0x4bcb77){_0x28560c=_0x28560c-0x0;var _0x464398=_0x0e78[_0x28560c];return _0x464398;};'use strict';var _=require(_0x80e7('0x0'));var util=require(_0x80e7('0x1'));var logger=require(_0x80e7('0x2'))(_0x80e7('0x3'));var moment=require(_0x80e7('0x4'));var BPromise=require(_0x80e7('0x5'));var rp=require(_0x80e7('0x6'));var fs=require('fs');var path=require(_0x80e7('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x80e7('0x8'));module[_0x80e7('0x9')]=function(_0x337728,_0x3cbc2a){return _0x337728[_0x80e7('0xa')](_0x80e7('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x80e7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 93e2ddf..b37810c 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 _0x850a=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','UpdateWhatsappQueueReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis'];(function(_0x2f2982,_0x5a035b){var _0x48e4ac=function(_0x342def){while(--_0x342def){_0x2f2982['push'](_0x2f2982['shift']());}};_0x48e4ac(++_0x5a035b);}(_0x850a,0x10b));var _0xa850=function(_0x347471,_0x1c9a02){_0x347471=_0x347471-0x0;var _0x422b6a=_0x850a[_0x347471];return _0x422b6a;};'use strict';var _=require(_0xa850('0x0'));var util=require(_0xa850('0x1'));var moment=require('moment');var BPromise=require(_0xa850('0x2'));var rs=require(_0xa850('0x3'));var fs=require('fs');var Redis=require(_0xa850('0x4'));var db=require(_0xa850('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa850('0x6'))(_0xa850('0x7'));var config=require(_0xa850('0x8'));var jayson=require(_0xa850('0x9'));var client=jayson[_0xa850('0xa')][_0xa850('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1265,_0x377776,_0x314a4e){return new BPromise(function(_0x469522,_0x4a834b){return client[_0xa850('0xc')](_0x4b1265,_0x314a4e)['then'](function(_0x418e50){logger[_0xa850('0xd')](_0xa850('0xe'),_0x377776,_0xa850('0xf'));logger[_0xa850('0x10')](_0xa850('0x11'),_0x377776,_0xa850('0xf'),JSON[_0xa850('0x12')](_0x418e50));if(_0x418e50['error']){if(_0x418e50[_0xa850('0x13')]['code']===0x1f4){logger['error'](_0xa850('0xe'),_0x377776,_0x418e50[_0xa850('0x13')][_0xa850('0x14')]);return _0x4a834b(_0x418e50['error'][_0xa850('0x14')]);}logger[_0xa850('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x377776,_0x418e50[_0xa850('0x13')]['message']);return _0x469522(_0x418e50[_0xa850('0x13')][_0xa850('0x14')]);}else{logger[_0xa850('0xd')](_0xa850('0xe'),_0x377776,'request\x20sent');_0x469522(_0x418e50[_0xa850('0x15')][_0xa850('0x14')]);}})[_0xa850('0x16')](function(_0x2e647f){logger[_0xa850('0x13')](_0xa850('0xe'),_0x377776,_0x2e647f);_0x4a834b(_0x2e647f);});});}exports[_0xa850('0x17')]=function(_0x12a446){var _0x200562=this;return new Promise(function(_0x523eae,_0x4a6126){return db[_0xa850('0x18')][_0xa850('0x19')](_0x12a446[_0xa850('0x1a')],{'raw':_0x12a446[_0xa850('0x1b')]?_0x12a446[_0xa850('0x1b')][_0xa850('0x1c')]===undefined?!![]:![]:!![]})[_0xa850('0x1d')](function(_0x369a67){logger['info'](_0xa850('0x17'),_0x12a446);logger['debug'](_0xa850('0x17'),_0x12a446,JSON[_0xa850('0x12')](_0x369a67));_0x523eae(_0x369a67);})['catch'](function(_0x750db2){logger[_0xa850('0x13')](_0xa850('0x17'),_0x750db2[_0xa850('0x14')],_0x12a446);_0x4a6126(_0x200562[_0xa850('0x13')](0x1f4,_0x750db2[_0xa850('0x14')]));});});};exports[_0xa850('0x1e')]=function(_0x120974){var _0x2f14dd=this;return new Promise(function(_0x6ec402,_0x44175d){return db[_0xa850('0x18')][_0xa850('0x1f')](_0x120974['body'],{'raw':_0x120974[_0xa850('0x1b')]?_0x120974['options'][_0xa850('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x120974['options']?_0x120974[_0xa850('0x1b')]['where']||null:null,'attributes':_0x120974[_0xa850('0x1b')]?_0x120974['options'][_0xa850('0x20')]||null:null,'limit':_0x120974[_0xa850('0x1b')]?_0x120974['options'][_0xa850('0x21')]||null:null})['then'](function(_0x4ab5bc){logger[_0xa850('0xd')](_0xa850('0x1e'),_0x120974);logger[_0xa850('0x10')](_0xa850('0x1e'),_0x120974,JSON['stringify'](_0x4ab5bc));_0x6ec402(_0x4ab5bc);})[_0xa850('0x16')](function(_0x38151){logger[_0xa850('0x13')](_0xa850('0x1e'),_0x38151[_0xa850('0x14')],_0x120974);_0x44175d(_0x2f14dd[_0xa850('0x13')](0x1f4,_0x38151[_0xa850('0x14')]));});});}; \ No newline at end of file +var _0x7720=['request\x20sent','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','debug','stringify','update','where','attributes','limit','UpdateWhatsappQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0x3dbbb7,_0x9f32b8){var _0x1cf503=function(_0x3e4605){while(--_0x3e4605){_0x3dbbb7['push'](_0x3dbbb7['shift']());}};_0x1cf503(++_0x9f32b8);}(_0x7720,0x172));var _0x0772=function(_0x5d9601,_0x17868e){_0x5d9601=_0x5d9601-0x0;var _0x3fdb5c=_0x7720[_0x5d9601];return _0x3fdb5c;};'use strict';var _=require('lodash');var util=require(_0x0772('0x0'));var moment=require(_0x0772('0x1'));var BPromise=require(_0x0772('0x2'));var rs=require(_0x0772('0x3'));var fs=require('fs');var Redis=require(_0x0772('0x4'));var db=require(_0x0772('0x5'))['db'];var utils=require(_0x0772('0x6'));var logger=require(_0x0772('0x7'))(_0x0772('0x8'));var config=require(_0x0772('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0772('0xa')][_0x0772('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56c128,_0x3a964a,_0x434feb){return new BPromise(function(_0x11a98a,_0x2e7164){return client[_0x0772('0xc')](_0x56c128,_0x434feb)['then'](function(_0x1a3ba2){logger[_0x0772('0xd')](_0x0772('0xe'),_0x3a964a,_0x0772('0xf'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3a964a,_0x0772('0xf'),JSON['stringify'](_0x1a3ba2));if(_0x1a3ba2[_0x0772('0x10')]){if(_0x1a3ba2[_0x0772('0x10')][_0x0772('0x11')]===0x1f4){logger[_0x0772('0x10')](_0x0772('0xe'),_0x3a964a,_0x1a3ba2[_0x0772('0x10')]['message']);return _0x2e7164(_0x1a3ba2['error'][_0x0772('0x12')]);}logger[_0x0772('0x10')](_0x0772('0xe'),_0x3a964a,_0x1a3ba2[_0x0772('0x10')][_0x0772('0x12')]);return _0x11a98a(_0x1a3ba2[_0x0772('0x10')][_0x0772('0x12')]);}else{logger[_0x0772('0xd')](_0x0772('0xe'),_0x3a964a,'request\x20sent');_0x11a98a(_0x1a3ba2[_0x0772('0x13')]['message']);}})[_0x0772('0x14')](function(_0x4deafd){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x3a964a,_0x4deafd);_0x2e7164(_0x4deafd);});});}exports[_0x0772('0x15')]=function(_0x2183ec){var _0x1fa649=this;return new Promise(function(_0x58ac3a,_0x3e055b){return db[_0x0772('0x16')][_0x0772('0x17')](_0x2183ec[_0x0772('0x18')],{'raw':_0x2183ec[_0x0772('0x19')]?_0x2183ec[_0x0772('0x19')][_0x0772('0x1a')]===undefined?!![]:![]:!![]})[_0x0772('0x1b')](function(_0x3cf2eb){logger[_0x0772('0xd')](_0x0772('0x15'),_0x2183ec);logger[_0x0772('0x1c')](_0x0772('0x15'),_0x2183ec,JSON[_0x0772('0x1d')](_0x3cf2eb));_0x58ac3a(_0x3cf2eb);})[_0x0772('0x14')](function(_0x58425c){logger[_0x0772('0x10')]('CreateWhatsappQueueReport',_0x58425c[_0x0772('0x12')],_0x2183ec);_0x3e055b(_0x1fa649['error'](0x1f4,_0x58425c['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x5e6e82){var _0x4d6fba=this;return new Promise(function(_0x511609,_0x25a5d4){return db[_0x0772('0x16')][_0x0772('0x1e')](_0x5e6e82[_0x0772('0x18')],{'raw':_0x5e6e82[_0x0772('0x19')]?_0x5e6e82[_0x0772('0x19')][_0x0772('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e6e82[_0x0772('0x19')]?_0x5e6e82[_0x0772('0x19')][_0x0772('0x1f')]||null:null,'attributes':_0x5e6e82[_0x0772('0x19')]?_0x5e6e82[_0x0772('0x19')][_0x0772('0x20')]||null:null,'limit':_0x5e6e82[_0x0772('0x19')]?_0x5e6e82['options'][_0x0772('0x21')]||null:null})[_0x0772('0x1b')](function(_0x340ffc){logger['info']('UpdateWhatsappQueueReport',_0x5e6e82);logger['debug'](_0x0772('0x22'),_0x5e6e82,JSON[_0x0772('0x1d')](_0x340ffc));_0x511609(_0x340ffc);})[_0x0772('0x14')](function(_0x1dc616){logger['error'](_0x0772('0x22'),_0x1dc616[_0x0772('0x12')],_0x5e6e82);_0x25a5d4(_0x4d6fba[_0x0772('0x10')](0x1f4,_0x1dc616['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index fd12906..4041071 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 _0x0d3e=['../../config/environment','get','isAuthenticated','index','/describe','/:id','show','create','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x29ec1f,_0x5baf42){var _0x431df5=function(_0x35414b){while(--_0x35414b){_0x29ec1f['push'](_0x29ec1f['shift']());}};_0x431df5(++_0x5baf42);}(_0x0d3e,0xee));var _0xe0d3=function(_0x1db29a,_0x5263e6){_0x1db29a=_0x1db29a-0x0;var _0x53525b=_0x0d3e[_0x1db29a];return _0x53525b;};'use strict';var multer=require(_0xe0d3('0x0'));var util=require(_0xe0d3('0x1'));var path=require(_0xe0d3('0x2'));var timeout=require(_0xe0d3('0x3'));var express=require(_0xe0d3('0x4'));var router=express[_0xe0d3('0x5')]();var fs_extra=require(_0xe0d3('0x6'));var auth=require(_0xe0d3('0x7'));var interaction=require(_0xe0d3('0x8'));var config=require(_0xe0d3('0x9'));var controller=require('./whatsappTransferReport.controller');router[_0xe0d3('0xa')]('/',auth[_0xe0d3('0xb')](),controller[_0xe0d3('0xc')]);router[_0xe0d3('0xa')](_0xe0d3('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xe0d3('0xa')](_0xe0d3('0xe'),auth[_0xe0d3('0xb')](),controller[_0xe0d3('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe0d3('0x10')]);router['put']('/:id',auth[_0xe0d3('0xb')](),controller[_0xe0d3('0x11')]);router['delete'](_0xe0d3('0xe'),auth[_0xe0d3('0xb')](),controller[_0xe0d3('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7e93=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x7e93,0x145));var _0x37e9=function(_0x23ab43,_0x548e4b){_0x23ab43=_0x23ab43-0x0;var _0x3df4dc=_0x7e93[_0x23ab43];return _0x3df4dc;};'use strict';var multer=require(_0x37e9('0x0'));var util=require(_0x37e9('0x1'));var path=require(_0x37e9('0x2'));var timeout=require(_0x37e9('0x3'));var express=require(_0x37e9('0x4'));var router=express[_0x37e9('0x5')]();var fs_extra=require(_0x37e9('0x6'));var auth=require(_0x37e9('0x7'));var interaction=require(_0x37e9('0x8'));var config=require(_0x37e9('0x9'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0x37e9('0xa')](),controller[_0x37e9('0xb')]);router[_0x37e9('0xc')](_0x37e9('0xd'),auth[_0x37e9('0xa')](),controller[_0x37e9('0xe')]);router[_0x37e9('0xc')](_0x37e9('0xf'),auth[_0x37e9('0xa')](),controller[_0x37e9('0x10')]);router['post']('/',auth[_0x37e9('0xa')](),controller[_0x37e9('0x11')]);router[_0x37e9('0x12')](_0x37e9('0xf'),auth[_0x37e9('0xa')](),controller[_0x37e9('0x13')]);router[_0x37e9('0x14')](_0x37e9('0xf'),auth[_0x37e9('0xa')](),controller['destroy']);module[_0x37e9('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 947745e..d378c20 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 _0xffc0=['queue','DATE','exports','ENUM','account','agent'];(function(_0x12a110,_0x2f5f52){var _0x1110c5=function(_0x18680c){while(--_0x18680c){_0x12a110['push'](_0x12a110['shift']());}};_0x1110c5(++_0x2f5f52);}(_0xffc0,0x1a0));var _0x0ffc=function(_0x106327,_0x292dd3){_0x106327=_0x106327-0x0;var _0x4df08c=_0xffc0[_0x106327];return _0x4df08c;};'use strict';var Sequelize=require('sequelize');module[_0x0ffc('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0ffc('0x1')](_0x0ffc('0x2'),_0x0ffc('0x3'),_0x0ffc('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0ffc('0x5')]}}; \ No newline at end of file +var _0x47d6=['exports','STRING','ENUM','account','agent','queue','DATE','sequelize'];(function(_0x3014e1,_0xd20822){var _0x5a5818=function(_0x20c0c2){while(--_0x20c0c2){_0x3014e1['push'](_0x3014e1['shift']());}};_0x5a5818(++_0xd20822);}(_0x47d6,0x13f));var _0x647d=function(_0x1ae713,_0x1cf743){_0x1ae713=_0x1ae713-0x0;var _0x9c0ca3=_0x47d6[_0x1ae713];return _0x9c0ca3;};'use strict';var Sequelize=require(_0x647d('0x0'));module[_0x647d('0x1')]={'uniqueid':{'type':Sequelize[_0x647d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x647d('0x3')](_0x647d('0x4'),_0x647d('0x5'),_0x647d('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x647d('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 519eb0a..c3bd932 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 _0x3cd7=['type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','WhatsappTransferReport','includeAll','include','rows','show','params','options','find','catch','create','body','describe','zip-dir','request-promise','moment','bluebird','mustache','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','map','rawAttributes','fieldName'];(function(_0x59fffc,_0x526e06){var _0x4e168e=function(_0x2194d8){while(--_0x2194d8){_0x59fffc['push'](_0x59fffc['shift']());}};_0x4e168e(++_0x526e06);}(_0x3cd7,0x69));var _0x73cd=function(_0x445f71,_0xa9a51e){_0x445f71=_0x445f71-0x0;var _0x444b85=_0x3cd7[_0x445f71];return _0x444b85;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x73cd('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x73cd('0x1'));var moment=require(_0x73cd('0x2'));var BPromise=require(_0x73cd('0x3'));var Mustache=require(_0x73cd('0x4'));var util=require('util');var path=require('path');var sox=require(_0x73cd('0x5'));var csv=require(_0x73cd('0x6'));var ejs=require(_0x73cd('0x7'));var fs=require('fs');var fs_extra=require(_0x73cd('0x8'));var _=require(_0x73cd('0x9'));var squel=require(_0x73cd('0xa'));var crypto=require(_0x73cd('0xb'));var jsforce=require(_0x73cd('0xc'));var deskjs=require(_0x73cd('0xd'));var toCsv=require(_0x73cd('0x6'));var querystring=require(_0x73cd('0xe'));var Papa=require(_0x73cd('0xf'));var Redis=require(_0x73cd('0x10'));var authService=require(_0x73cd('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x73cd('0x12'));var hardwareService=require(_0x73cd('0x13'));var logger=require(_0x73cd('0x14'))(_0x73cd('0x15'));var utils=require('../../config/utils');var config=require(_0x73cd('0x16'));var licenseUtil=require(_0x73cd('0x17'));var db=require(_0x73cd('0x18'))['db'];function respondWithStatusCode(_0x4552f9,_0x375e7a){_0x375e7a=_0x375e7a||0xcc;return function(_0x1bea12){if(_0x1bea12){return _0x4552f9[_0x73cd('0x19')](_0x375e7a);}return _0x4552f9['status'](_0x375e7a)['end']();};}function respondWithResult(_0x43c135,_0x23a7a1){_0x23a7a1=_0x23a7a1||0xc8;return function(_0x1e93f1){if(_0x1e93f1){return _0x43c135[_0x73cd('0x1a')](_0x23a7a1)[_0x73cd('0x1b')](_0x1e93f1);}};}function respondWithFilteredResult(_0x4ad9c1,_0x56232d){return function(_0x1bdb06){if(_0x1bdb06){var _0x5bb259=typeof _0x56232d['offset']===_0x73cd('0x1c')&&typeof _0x56232d['limit']==='undefined';var _0x2e8396=_0x1bdb06[_0x73cd('0x1d')];var _0x489273=_0x5bb259?0x0:_0x56232d[_0x73cd('0x1e')];var _0x505e65=_0x5bb259?_0x1bdb06[_0x73cd('0x1d')]:_0x56232d[_0x73cd('0x1e')]+_0x56232d[_0x73cd('0x1f')];var _0x33ee3a;if(_0x505e65>=_0x2e8396){_0x505e65=_0x2e8396;_0x33ee3a=0xc8;}else{_0x33ee3a=0xce;}_0x4ad9c1[_0x73cd('0x1a')](_0x33ee3a);return _0x4ad9c1[_0x73cd('0x20')](_0x73cd('0x21'),_0x489273+'-'+_0x505e65+'/'+_0x2e8396)[_0x73cd('0x1b')](_0x1bdb06);}return null;};}function patchUpdates(_0x189acf){return function(_0x5dd0c2){try{jsonpatch[_0x73cd('0x22')](_0x5dd0c2,_0x189acf,!![]);}catch(_0x53ba81){return BPromise[_0x73cd('0x23')](_0x53ba81);}return _0x5dd0c2['save']();};}function saveUpdates(_0x1aab53,_0x3b720f){return function(_0x1052e0){if(_0x1052e0){return _0x1052e0[_0x73cd('0x24')](_0x1aab53)['then'](function(_0x170f92){return _0x170f92;});}return null;};}function removeEntity(_0x562505,_0xe6d001){return function(_0x109a31){if(_0x109a31){return _0x109a31[_0x73cd('0x25')]()[_0x73cd('0x26')](function(){_0x562505[_0x73cd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x426cd9,_0x2e72d5){return function(_0x3db5fb){if(!_0x3db5fb){_0x426cd9[_0x73cd('0x19')](0x194);}return _0x3db5fb;};}function handleError(_0x121800,_0x4ca391){_0x4ca391=_0x4ca391||0x1f4;return function(_0x3bdf31){logger[_0x73cd('0x27')](_0x3bdf31[_0x73cd('0x28')]);if(_0x3bdf31[_0x73cd('0x29')]){delete _0x3bdf31[_0x73cd('0x29')];}_0x121800['status'](_0x4ca391)['send'](_0x3bdf31);};}exports['index']=function(_0x2b2c2f,_0x154e49){var _0x2fd7e7={},_0x4cbd8f={},_0x2f72b2={'count':0x0,'rows':[]};var _0x315a97=_[_0x73cd('0x2a')](db['WhatsappTransferReport'][_0x73cd('0x2b')],function(_0x511cca){return{'name':_0x511cca[_0x73cd('0x2c')],'type':_0x511cca[_0x73cd('0x2d')][_0x73cd('0x2e')]};});_0x4cbd8f['model']=_[_0x73cd('0x2a')](_0x315a97,_0x73cd('0x29'));_0x4cbd8f[_0x73cd('0x2f')]=_[_0x73cd('0x30')](_0x2b2c2f[_0x73cd('0x2f')]);_0x4cbd8f[_0x73cd('0x31')]=_[_0x73cd('0x32')](_0x4cbd8f[_0x73cd('0x33')],_0x4cbd8f[_0x73cd('0x2f')]);_0x2fd7e7[_0x73cd('0x34')]=_[_0x73cd('0x32')](_0x4cbd8f[_0x73cd('0x33')],qs[_0x73cd('0x35')](_0x2b2c2f[_0x73cd('0x2f')][_0x73cd('0x35')]));_0x2fd7e7[_0x73cd('0x34')]=_0x2fd7e7['attributes'][_0x73cd('0x36')]?_0x2fd7e7[_0x73cd('0x34')]:_0x4cbd8f[_0x73cd('0x33')];if(!_0x2b2c2f[_0x73cd('0x2f')][_0x73cd('0x37')](_0x73cd('0x38'))){_0x2fd7e7[_0x73cd('0x1f')]=qs[_0x73cd('0x1f')](_0x2b2c2f[_0x73cd('0x2f')][_0x73cd('0x1f')]);_0x2fd7e7[_0x73cd('0x1e')]=qs['offset'](_0x2b2c2f['query'][_0x73cd('0x1e')]);}_0x2fd7e7[_0x73cd('0x39')]=qs[_0x73cd('0x3a')](_0x2b2c2f[_0x73cd('0x2f')][_0x73cd('0x3a')]);_0x2fd7e7[_0x73cd('0x3b')]=qs[_0x73cd('0x31')](_['pick'](_0x2b2c2f[_0x73cd('0x2f')],_0x4cbd8f['filters']),_0x315a97);if(_0x2b2c2f['query'][_0x73cd('0x3c')]){_0x2fd7e7[_0x73cd('0x3b')]=_[_0x73cd('0x3d')](_0x2fd7e7[_0x73cd('0x3b')],{'$or':_[_0x73cd('0x2a')](_0x315a97,function(_0x59464b){if(_0x59464b[_0x73cd('0x2d')]!==_0x73cd('0x3e')){var _0x4f7fe9={};_0x4f7fe9[_0x59464b[_0x73cd('0x29')]]={'$like':'%'+_0x2b2c2f[_0x73cd('0x2f')][_0x73cd('0x3c')]+'%'};return _0x4f7fe9;}})});}_0x2fd7e7=_[_0x73cd('0x3d')]({},_0x2fd7e7,_0x2b2c2f['options']);var _0x2c3a9a={'where':_0x2fd7e7['where']};return db[_0x73cd('0x3f')][_0x73cd('0x1d')](_0x2c3a9a)[_0x73cd('0x26')](function(_0x467331){_0x2f72b2[_0x73cd('0x1d')]=_0x467331;if(_0x2b2c2f[_0x73cd('0x2f')][_0x73cd('0x40')]){_0x2fd7e7[_0x73cd('0x41')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x2fd7e7);})['then'](function(_0x106b91){_0x2f72b2[_0x73cd('0x42')]=_0x106b91;return _0x2f72b2;})['then'](respondWithFilteredResult(_0x154e49,_0x2fd7e7))['catch'](handleError(_0x154e49,null));};exports[_0x73cd('0x43')]=function(_0x57e061,_0x2d7cdc){var _0x47c78f={'raw':!![],'where':{'id':_0x57e061[_0x73cd('0x44')]['id']}},_0x2935b1={};_0x2935b1['model']=_[_0x73cd('0x30')](db[_0x73cd('0x3f')][_0x73cd('0x2b')]);_0x2935b1['query']=_[_0x73cd('0x30')](_0x57e061['query']);_0x2935b1['filters']=_[_0x73cd('0x32')](_0x2935b1['model'],_0x2935b1['query']);_0x47c78f[_0x73cd('0x34')]=_[_0x73cd('0x32')](_0x2935b1['model'],qs[_0x73cd('0x35')](_0x57e061[_0x73cd('0x2f')][_0x73cd('0x35')]));_0x47c78f[_0x73cd('0x34')]=_0x47c78f['attributes'][_0x73cd('0x36')]?_0x47c78f[_0x73cd('0x34')]:_0x2935b1['model'];if(_0x57e061['query']['includeAll']){_0x47c78f[_0x73cd('0x41')]=[{'all':!![]}];}_0x47c78f=_[_0x73cd('0x3d')]({},_0x47c78f,_0x57e061[_0x73cd('0x45')]);return db[_0x73cd('0x3f')][_0x73cd('0x46')](_0x47c78f)[_0x73cd('0x26')](handleEntityNotFound(_0x2d7cdc,null))[_0x73cd('0x26')](respondWithResult(_0x2d7cdc,null))[_0x73cd('0x47')](handleError(_0x2d7cdc,null));};exports['create']=function(_0x3d22ef,_0x2306f4){return db[_0x73cd('0x3f')][_0x73cd('0x48')](_0x3d22ef[_0x73cd('0x49')],{})[_0x73cd('0x26')](respondWithResult(_0x2306f4,0xc9))['catch'](handleError(_0x2306f4,null));};exports[_0x73cd('0x24')]=function(_0x379211,_0x5be0cc){if(_0x379211[_0x73cd('0x49')]['id']){delete _0x379211[_0x73cd('0x49')]['id'];}return db[_0x73cd('0x3f')][_0x73cd('0x46')]({'where':{'id':_0x379211[_0x73cd('0x44')]['id']}})[_0x73cd('0x26')](handleEntityNotFound(_0x5be0cc,null))[_0x73cd('0x26')](saveUpdates(_0x379211[_0x73cd('0x49')],null))[_0x73cd('0x26')](respondWithResult(_0x5be0cc,null))[_0x73cd('0x47')](handleError(_0x5be0cc,null));};exports[_0x73cd('0x25')]=function(_0x5e5d63,_0x4baa24){return db[_0x73cd('0x3f')][_0x73cd('0x46')]({'where':{'id':_0x5e5d63[_0x73cd('0x44')]['id']}})[_0x73cd('0x26')](handleEntityNotFound(_0x4baa24,null))[_0x73cd('0x26')](removeEntity(_0x4baa24,null))['catch'](handleError(_0x4baa24,null));};exports[_0x73cd('0x4a')]=function(_0x32564b,_0x4cbf65){return db[_0x73cd('0x3f')][_0x73cd('0x4a')]()['then'](respondWithResult(_0x4cbf65,null))[_0x73cd('0x47')](handleError(_0x4cbf65,null));}; \ No newline at end of file +var _0xf2e9=['body','describe','eml-format','rimraf','request-promise','moment','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0xf2e9,0x146));var _0x9f2e=function(_0x5a8422,_0x445129){_0x5a8422=_0x5a8422-0x0;var _0x53362e=_0xf2e9[_0x5a8422];return _0x53362e;};'use strict';var emlformat=require(_0x9f2e('0x0'));var rimraf=require(_0x9f2e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9f2e('0x2'));var moment=require(_0x9f2e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9f2e('0x4'));var util=require('util');var path=require(_0x9f2e('0x5'));var sox=require(_0x9f2e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f2e('0x7'));var _=require(_0x9f2e('0x8'));var squel=require(_0x9f2e('0x9'));var crypto=require(_0x9f2e('0xa'));var jsforce=require(_0x9f2e('0xb'));var deskjs=require(_0x9f2e('0xc'));var toCsv=require(_0x9f2e('0xd'));var querystring=require(_0x9f2e('0xe'));var Papa=require(_0x9f2e('0xf'));var Redis=require(_0x9f2e('0x10'));var authService=require(_0x9f2e('0x11'));var qs=require(_0x9f2e('0x12'));var as=require(_0x9f2e('0x13'));var hardwareService=require(_0x9f2e('0x14'));var logger=require('../../config/logger')(_0x9f2e('0x15'));var utils=require(_0x9f2e('0x16'));var config=require(_0x9f2e('0x17'));var licenseUtil=require(_0x9f2e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57ebab,_0x2dd547){_0x2dd547=_0x2dd547||0xcc;return function(_0x56aca1){if(_0x56aca1){return _0x57ebab[_0x9f2e('0x19')](_0x2dd547);}return _0x57ebab[_0x9f2e('0x1a')](_0x2dd547)[_0x9f2e('0x1b')]();};}function respondWithResult(_0x429ddd,_0x17082a){_0x17082a=_0x17082a||0xc8;return function(_0x201a0b){if(_0x201a0b){return _0x429ddd['status'](_0x17082a)[_0x9f2e('0x1c')](_0x201a0b);}};}function respondWithFilteredResult(_0x17a847,_0x3a600a){return function(_0x49c2c3){if(_0x49c2c3){var _0x7a33df=typeof _0x3a600a[_0x9f2e('0x1d')]==='undefined'&&typeof _0x3a600a[_0x9f2e('0x1e')]===_0x9f2e('0x1f');var _0x2556ab=_0x49c2c3[_0x9f2e('0x20')];var _0x528476=_0x7a33df?0x0:_0x3a600a['offset'];var _0x3c8fe0=_0x7a33df?_0x49c2c3[_0x9f2e('0x20')]:_0x3a600a['offset']+_0x3a600a[_0x9f2e('0x1e')];var _0x2ed5d2;if(_0x3c8fe0>=_0x2556ab){_0x3c8fe0=_0x2556ab;_0x2ed5d2=0xc8;}else{_0x2ed5d2=0xce;}_0x17a847[_0x9f2e('0x1a')](_0x2ed5d2);return _0x17a847[_0x9f2e('0x21')](_0x9f2e('0x22'),_0x528476+'-'+_0x3c8fe0+'/'+_0x2556ab)[_0x9f2e('0x1c')](_0x49c2c3);}return null;};}function patchUpdates(_0x56632a){return function(_0x2875a9){try{jsonpatch[_0x9f2e('0x23')](_0x2875a9,_0x56632a,!![]);}catch(_0x4e1cff){return BPromise[_0x9f2e('0x24')](_0x4e1cff);}return _0x2875a9[_0x9f2e('0x25')]();};}function saveUpdates(_0x24b6fc,_0xb22a97){return function(_0x3538ab){if(_0x3538ab){return _0x3538ab[_0x9f2e('0x26')](_0x24b6fc)[_0x9f2e('0x27')](function(_0x55a3c9){return _0x55a3c9;});}return null;};}function removeEntity(_0x384d04,_0x168ec6){return function(_0x396196){if(_0x396196){return _0x396196[_0x9f2e('0x28')]()[_0x9f2e('0x27')](function(){_0x384d04[_0x9f2e('0x1a')](0xcc)[_0x9f2e('0x1b')]();});}};}function handleEntityNotFound(_0x59756d,_0x4d13a9){return function(_0x55f9db){if(!_0x55f9db){_0x59756d[_0x9f2e('0x19')](0x194);}return _0x55f9db;};}function handleError(_0x772360,_0x5948e9){_0x5948e9=_0x5948e9||0x1f4;return function(_0x14cc6f){logger[_0x9f2e('0x29')](_0x14cc6f[_0x9f2e('0x2a')]);if(_0x14cc6f[_0x9f2e('0x2b')]){delete _0x14cc6f['name'];}_0x772360[_0x9f2e('0x1a')](_0x5948e9)[_0x9f2e('0x2c')](_0x14cc6f);};}exports[_0x9f2e('0x2d')]=function(_0x505a00,_0x1535e2){var _0x38c12c={},_0x24d012={},_0x2311df={'count':0x0,'rows':[]};var _0x26ac7d=_[_0x9f2e('0x2e')](db[_0x9f2e('0x2f')][_0x9f2e('0x30')],function(_0x4f369c){return{'name':_0x4f369c[_0x9f2e('0x31')],'type':_0x4f369c[_0x9f2e('0x32')][_0x9f2e('0x33')]};});_0x24d012[_0x9f2e('0x34')]=_[_0x9f2e('0x2e')](_0x26ac7d,'name');_0x24d012[_0x9f2e('0x35')]=_[_0x9f2e('0x36')](_0x505a00[_0x9f2e('0x35')]);_0x24d012[_0x9f2e('0x37')]=_[_0x9f2e('0x38')](_0x24d012[_0x9f2e('0x34')],_0x24d012[_0x9f2e('0x35')]);_0x38c12c[_0x9f2e('0x39')]=_[_0x9f2e('0x38')](_0x24d012[_0x9f2e('0x34')],qs[_0x9f2e('0x3a')](_0x505a00[_0x9f2e('0x35')][_0x9f2e('0x3a')]));_0x38c12c[_0x9f2e('0x39')]=_0x38c12c[_0x9f2e('0x39')][_0x9f2e('0x3b')]?_0x38c12c[_0x9f2e('0x39')]:_0x24d012['model'];if(!_0x505a00['query'][_0x9f2e('0x3c')](_0x9f2e('0x3d'))){_0x38c12c[_0x9f2e('0x1e')]=qs[_0x9f2e('0x1e')](_0x505a00[_0x9f2e('0x35')][_0x9f2e('0x1e')]);_0x38c12c[_0x9f2e('0x1d')]=qs[_0x9f2e('0x1d')](_0x505a00[_0x9f2e('0x35')]['offset']);}_0x38c12c[_0x9f2e('0x3e')]=qs[_0x9f2e('0x3f')](_0x505a00['query'][_0x9f2e('0x3f')]);_0x38c12c[_0x9f2e('0x40')]=qs[_0x9f2e('0x37')](_[_0x9f2e('0x41')](_0x505a00['query'],_0x24d012[_0x9f2e('0x37')]),_0x26ac7d);if(_0x505a00[_0x9f2e('0x35')]['filter']){_0x38c12c[_0x9f2e('0x40')]=_['merge'](_0x38c12c['where'],{'$or':_['map'](_0x26ac7d,function(_0xbb9702){if(_0xbb9702['type']!==_0x9f2e('0x42')){var _0x1386f8={};_0x1386f8[_0xbb9702[_0x9f2e('0x2b')]]={'$like':'%'+_0x505a00['query'][_0x9f2e('0x43')]+'%'};return _0x1386f8;}})});}_0x38c12c=_[_0x9f2e('0x44')]({},_0x38c12c,_0x505a00[_0x9f2e('0x45')]);var _0x322504={'where':_0x38c12c[_0x9f2e('0x40')]};return db['WhatsappTransferReport'][_0x9f2e('0x20')](_0x322504)[_0x9f2e('0x27')](function(_0x593a74){_0x2311df[_0x9f2e('0x20')]=_0x593a74;if(_0x505a00[_0x9f2e('0x35')]['includeAll']){_0x38c12c[_0x9f2e('0x46')]=[{'all':!![]}];}return db[_0x9f2e('0x2f')][_0x9f2e('0x47')](_0x38c12c);})[_0x9f2e('0x27')](function(_0x19be76){_0x2311df[_0x9f2e('0x48')]=_0x19be76;return _0x2311df;})['then'](respondWithFilteredResult(_0x1535e2,_0x38c12c))[_0x9f2e('0x49')](handleError(_0x1535e2,null));};exports[_0x9f2e('0x4a')]=function(_0xfd64ba,_0x3ea49d){var _0x2bdfa9={'raw':!![],'where':{'id':_0xfd64ba[_0x9f2e('0x4b')]['id']}},_0x7d3d58={};_0x7d3d58[_0x9f2e('0x34')]=_[_0x9f2e('0x36')](db[_0x9f2e('0x2f')][_0x9f2e('0x30')]);_0x7d3d58[_0x9f2e('0x35')]=_[_0x9f2e('0x36')](_0xfd64ba[_0x9f2e('0x35')]);_0x7d3d58[_0x9f2e('0x37')]=_['intersection'](_0x7d3d58[_0x9f2e('0x34')],_0x7d3d58[_0x9f2e('0x35')]);_0x2bdfa9[_0x9f2e('0x39')]=_[_0x9f2e('0x38')](_0x7d3d58[_0x9f2e('0x34')],qs[_0x9f2e('0x3a')](_0xfd64ba[_0x9f2e('0x35')][_0x9f2e('0x3a')]));_0x2bdfa9[_0x9f2e('0x39')]=_0x2bdfa9[_0x9f2e('0x39')][_0x9f2e('0x3b')]?_0x2bdfa9['attributes']:_0x7d3d58[_0x9f2e('0x34')];if(_0xfd64ba[_0x9f2e('0x35')][_0x9f2e('0x4c')]){_0x2bdfa9[_0x9f2e('0x46')]=[{'all':!![]}];}_0x2bdfa9=_['merge']({},_0x2bdfa9,_0xfd64ba[_0x9f2e('0x45')]);return db[_0x9f2e('0x2f')][_0x9f2e('0x4d')](_0x2bdfa9)[_0x9f2e('0x27')](handleEntityNotFound(_0x3ea49d,null))['then'](respondWithResult(_0x3ea49d,null))[_0x9f2e('0x49')](handleError(_0x3ea49d,null));};exports[_0x9f2e('0x4e')]=function(_0x13e956,_0x206247){return db[_0x9f2e('0x2f')][_0x9f2e('0x4e')](_0x13e956[_0x9f2e('0x4f')],{})[_0x9f2e('0x27')](respondWithResult(_0x206247,0xc9))[_0x9f2e('0x49')](handleError(_0x206247,null));};exports[_0x9f2e('0x26')]=function(_0x1dab92,_0x29cd78){if(_0x1dab92[_0x9f2e('0x4f')]['id']){delete _0x1dab92[_0x9f2e('0x4f')]['id'];}return db[_0x9f2e('0x2f')][_0x9f2e('0x4d')]({'where':{'id':_0x1dab92[_0x9f2e('0x4b')]['id']}})[_0x9f2e('0x27')](handleEntityNotFound(_0x29cd78,null))[_0x9f2e('0x27')](saveUpdates(_0x1dab92[_0x9f2e('0x4f')],null))[_0x9f2e('0x27')](respondWithResult(_0x29cd78,null))[_0x9f2e('0x49')](handleError(_0x29cd78,null));};exports['destroy']=function(_0x383408,_0x53f8a3){return db[_0x9f2e('0x2f')][_0x9f2e('0x4d')]({'where':{'id':_0x383408[_0x9f2e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x53f8a3,null))[_0x9f2e('0x27')](removeEntity(_0x53f8a3,null))['catch'](handleError(_0x53f8a3,null));};exports[_0x9f2e('0x50')]=function(_0xa39da6,_0x200251){return db[_0x9f2e('0x2f')][_0x9f2e('0x50')]()[_0x9f2e('0x27')](respondWithResult(_0x200251,null))['catch'](handleError(_0x200251,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 28614cc..fe07821 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 _0x2bbd=['report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','define'];(function(_0x5c4c4a,_0x3bd609){var _0x305095=function(_0x5b054f){while(--_0x5b054f){_0x5c4c4a['push'](_0x5c4c4a['shift']());}};_0x305095(++_0x3bd609);}(_0x2bbd,0x14c));var _0xd2bb=function(_0x140212,_0x3677c9){_0x140212=_0x140212-0x0;var _0x544864=_0x2bbd[_0x140212];return _0x544864;};'use strict';var _=require(_0xd2bb('0x0'));var util=require('util');var logger=require(_0xd2bb('0x1'))(_0xd2bb('0x2'));var moment=require('moment');var BPromise=require(_0xd2bb('0x3'));var rp=require(_0xd2bb('0x4'));var fs=require('fs');var path=require(_0xd2bb('0x5'));var rimraf=require('rimraf');var config=require(_0xd2bb('0x6'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x1e22f3,_0x1be800){return _0x1e22f3[_0xd2bb('0x7')]('WhatsappTransferReport',attributes,{'tableName':_0xd2bb('0x8'),'paranoid':![],'indexes':[{'name':_0xd2bb('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x22db=['WhatsappTransferReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define'];(function(_0x1ca5f9,_0x5d36d9){var _0x4c6f4c=function(_0x5b0efa){while(--_0x5b0efa){_0x1ca5f9['push'](_0x1ca5f9['shift']());}};_0x4c6f4c(++_0x5d36d9);}(_0x22db,0xd2));var _0xb22d=function(_0x2f7048,_0x27bf94){_0x2f7048=_0x2f7048-0x0;var _0x5e1499=_0x22db[_0x2f7048];return _0x5e1499;};'use strict';var _=require(_0xb22d('0x0'));var util=require(_0xb22d('0x1'));var logger=require('../../config/logger')(_0xb22d('0x2'));var moment=require(_0xb22d('0x3'));var BPromise=require(_0xb22d('0x4'));var rp=require(_0xb22d('0x5'));var fs=require('fs');var path=require(_0xb22d('0x6'));var rimraf=require(_0xb22d('0x7'));var config=require('../../config/environment');var attributes=require(_0xb22d('0x8'));module[_0xb22d('0x9')]=function(_0x1bc365,_0x26094a){return _0x1bc365[_0xb22d('0xa')](_0xb22d('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xb22d('0xc'),'fields':[_0xb22d('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 3477242..5d07d51 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 _0x3bf0=['info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x132c03,_0x8b245d){var _0xbacd39=function(_0x36c165){while(--_0x36c165){_0x132c03['push'](_0x132c03['shift']());}};_0xbacd39(++_0x8b245d);}(_0x3bf0,0x83));var _0x03bf=function(_0x4b0ab1,_0x4749da){_0x4b0ab1=_0x4b0ab1-0x0;var _0x31a8e8=_0x3bf0[_0x4b0ab1];return _0x31a8e8;};'use strict';var _=require(_0x03bf('0x0'));var util=require(_0x03bf('0x1'));var moment=require(_0x03bf('0x2'));var BPromise=require(_0x03bf('0x3'));var rs=require(_0x03bf('0x4'));var fs=require('fs');var Redis=require(_0x03bf('0x5'));var db=require(_0x03bf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x03bf('0x7'))(_0x03bf('0x8'));var config=require(_0x03bf('0x9'));var jayson=require(_0x03bf('0xa'));var client=jayson[_0x03bf('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c37c7,_0xf513cf,_0x537662){return new BPromise(function(_0x1ae46b,_0x143717){return client[_0x03bf('0xc')](_0x2c37c7,_0x537662)['then'](function(_0x126981){logger[_0x03bf('0xd')](_0x03bf('0xe'),_0xf513cf,_0x03bf('0xf'));logger[_0x03bf('0x10')](_0x03bf('0x11'),_0xf513cf,_0x03bf('0xf'),JSON[_0x03bf('0x12')](_0x126981));if(_0x126981[_0x03bf('0x13')]){if(_0x126981[_0x03bf('0x13')][_0x03bf('0x14')]===0x1f4){logger[_0x03bf('0x13')](_0x03bf('0xe'),_0xf513cf,_0x126981[_0x03bf('0x13')][_0x03bf('0x15')]);return _0x143717(_0x126981[_0x03bf('0x13')][_0x03bf('0x15')]);}logger[_0x03bf('0x13')](_0x03bf('0xe'),_0xf513cf,_0x126981[_0x03bf('0x13')]['message']);return _0x1ae46b(_0x126981['error'][_0x03bf('0x15')]);}else{logger[_0x03bf('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0xf513cf,_0x03bf('0xf'));_0x1ae46b(_0x126981[_0x03bf('0x16')][_0x03bf('0x15')]);}})[_0x03bf('0x17')](function(_0x46bc4f){logger[_0x03bf('0x13')](_0x03bf('0xe'),_0xf513cf,_0x46bc4f);_0x143717(_0x46bc4f);});});} \ No newline at end of file +var _0x1475=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x1475,0x1e8));var _0x5147=function(_0x12b83d,_0x4bcec7){_0x12b83d=_0x12b83d-0x0;var _0x1fd39d=_0x1475[_0x12b83d];return _0x1fd39d;};'use strict';var _=require(_0x5147('0x0'));var util=require(_0x5147('0x1'));var moment=require(_0x5147('0x2'));var BPromise=require(_0x5147('0x3'));var rs=require(_0x5147('0x4'));var fs=require('fs');var Redis=require(_0x5147('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5147('0x6'));var logger=require(_0x5147('0x7'))(_0x5147('0x8'));var config=require(_0x5147('0x9'));var jayson=require(_0x5147('0xa'));var client=jayson['client'][_0x5147('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc247f0,_0x3d183a,_0x36205f){return new BPromise(function(_0xe0d471,_0xdead0e){return client['request'](_0xc247f0,_0x36205f)['then'](function(_0x15125a){logger[_0x5147('0xc')](_0x5147('0xd'),_0x3d183a,_0x5147('0xe'));logger['debug'](_0x5147('0xf'),_0x3d183a,_0x5147('0xe'),JSON[_0x5147('0x10')](_0x15125a));if(_0x15125a[_0x5147('0x11')]){if(_0x15125a[_0x5147('0x11')][_0x5147('0x12')]===0x1f4){logger[_0x5147('0x11')](_0x5147('0xd'),_0x3d183a,_0x15125a[_0x5147('0x11')][_0x5147('0x13')]);return _0xdead0e(_0x15125a[_0x5147('0x11')][_0x5147('0x13')]);}logger['error'](_0x5147('0xd'),_0x3d183a,_0x15125a[_0x5147('0x11')]['message']);return _0xe0d471(_0x15125a[_0x5147('0x11')][_0x5147('0x13')]);}else{logger[_0x5147('0xc')](_0x5147('0xd'),_0x3d183a,_0x5147('0xe'));_0xe0d471(_0x15125a[_0x5147('0x14')][_0x5147('0x13')]);}})[_0x5147('0x15')](function(_0x4cd5a9){logger[_0x5147('0x11')](_0x5147('0xd'),_0x3d183a,_0x4cd5a9);_0xdead0e(_0x4cd5a9);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 61c556b..3bd4f18 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c42=['join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','then','seedDB','default','listen','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online'];(function(_0x4c6386,_0x149395){var _0x45fe05=function(_0xe52d45){while(--_0xe52d45){_0x4c6386['push'](_0x4c6386['shift']());}};_0x45fe05(++_0x149395);}(_0x0c42,0x191));var _0x20c4=function(_0x455359,_0x5b586b){_0x455359=_0x455359-0x0;var _0x4abae0=_0x0c42[_0x455359];return _0x4abae0;};'use strict';var _=require(_0x20c4('0x0'));var db=require(_0x20c4('0x1'))['db'];var seedDb=require(_0x20c4('0x2'));var checkLicense=require(_0x20c4('0x3'));var rpc=require(_0x20c4('0x4'));var config=require('./config/environment');var logger=require('./config/logger')(_0x20c4('0x5'));var pm2=require(_0x20c4('0x6'));var pm2Config=require(_0x20c4('0x7'));var schedule=require(_0x20c4('0x8'));var chat=require(_0x20c4('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x20c4('0xa'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x20c4('0xb')]['sync']()[_0x20c4('0xc')](function(){if(config[_0x20c4('0xd')]){return seedDb[_0x20c4('0xe')]();}})['then'](function(){return checkLicense[_0x20c4('0xe')]();})[_0x20c4('0xc')](function(){return rpc[_0x20c4('0xf')]();})[_0x20c4('0xc')](function(_0xdc42c3){logger[_0x20c4('0x10')](_0xdc42c3);return chat[_0x20c4('0x11')]();})[_0x20c4('0xc')](function(){return whatsapp[_0x20c4('0x11')]();})[_0x20c4('0xc')](function(){return schedule[_0x20c4('0x11')]();})[_0x20c4('0xc')](function(){return transcribe[_0x20c4('0x11')]();})['then'](function(){return provider[_0x20c4('0x11')]();})['then'](function(_0x34eaf2){logger[_0x20c4('0x10')](_0x34eaf2);return pm2['start'](pm2Config);})[_0x20c4('0xc')](function(_0x4c6dae){var _0x13213d=_0x4c6dae[_0x20c4('0x12')](function(_0x30831a){return typeof _0x30831a['exitCode']===_0x20c4('0x13')&&_0x30831a[_0x20c4('0x14')]>=0x0;});if(_0x13213d[_0x20c4('0x15')]>0x0){throw new Error(_0x13213d[_0x20c4('0x15')]+_0x20c4('0x16')+_[_0x20c4('0x17')](_0x13213d,function(_0x2f79a0){return'\x22'+_0x2f79a0[_0x20c4('0x18')][_0x20c4('0x19')]+'\x22';}));}logger[_0x20c4('0x10')](_0x20c4('0x1a'),_['map'](_['filter'](_0x4c6dae,{'status':_0x20c4('0x1b')}),'name')[_0x20c4('0x1c')]());logger[_0x20c4('0x10')](_0x20c4('0x1d'),_[_0x20c4('0x17')](_[_0x20c4('0x12')](_0x4c6dae,function(_0x47071e){return _0x47071e[_0x20c4('0x1e')]!==_0x20c4('0x1b');}),_0x20c4('0x19'))[_0x20c4('0x1c')]()||_0x20c4('0x1f'));console[_0x20c4('0x20')](_0x20c4('0x21'));})[_0x20c4('0x22')](function(_0x498d4){console[_0x20c4('0x20')](_0x20c4('0x23'),_0x498d4);logger[_0x20c4('0x24')](_0x20c4('0x25'),_0x498d4);process[_0x20c4('0x26')](0x1);});}main(); \ No newline at end of file +var _0x2e3b=['./config/schedule/cloud-provider','sync','then','default','listen','start','info','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','name','Online\x20apps:','map','online','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe'];(function(_0x49780a,_0x301366){var _0x1e93af=function(_0x252eef){while(--_0x252eef){_0x49780a['push'](_0x49780a['shift']());}};_0x1e93af(++_0x301366);}(_0x2e3b,0x81));var _0xb2e3=function(_0x173329,_0x128602){_0x173329=_0x173329-0x0;var _0xc7fd7=_0x2e3b[_0x173329];return _0xc7fd7;};'use strict';var _=require('lodash');var db=require(_0xb2e3('0x0'))['db'];var seedDb=require(_0xb2e3('0x1'));var checkLicense=require(_0xb2e3('0x2'));var rpc=require(_0xb2e3('0x3'));var config=require(_0xb2e3('0x4'));var logger=require(_0xb2e3('0x5'))(_0xb2e3('0x6'));var pm2=require(_0xb2e3('0x7'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xb2e3('0x8'));var chat=require(_0xb2e3('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xb2e3('0xa'));var provider=require(_0xb2e3('0xb'));function main(){return db['sequelize'][_0xb2e3('0xc')]()[_0xb2e3('0xd')](function(){if(config['seedDB']){return seedDb[_0xb2e3('0xe')]();}})[_0xb2e3('0xd')](function(){return checkLicense[_0xb2e3('0xe')]();})[_0xb2e3('0xd')](function(){return rpc[_0xb2e3('0xf')]();})['then'](function(_0x146c29){logger['info'](_0x146c29);return chat[_0xb2e3('0x10')]();})[_0xb2e3('0xd')](function(){return whatsapp[_0xb2e3('0x10')]();})[_0xb2e3('0xd')](function(){return schedule[_0xb2e3('0x10')]();})[_0xb2e3('0xd')](function(){return transcribe[_0xb2e3('0x10')]();})['then'](function(){return provider['start']();})['then'](function(_0x3061ac){logger[_0xb2e3('0x11')](_0x3061ac);return pm2[_0xb2e3('0x10')](pm2Config);})[_0xb2e3('0xd')](function(_0x51e55b){var _0x312210=_0x51e55b[_0xb2e3('0x12')](function(_0x2f40ed){return typeof _0x2f40ed[_0xb2e3('0x13')]===_0xb2e3('0x14')&&_0x2f40ed[_0xb2e3('0x13')]>=0x0;});if(_0x312210[_0xb2e3('0x15')]>0x0){throw new Error(_0x312210[_0xb2e3('0x15')]+_0xb2e3('0x16')+_['map'](_0x312210,function(_0x5e10a9){return'\x22'+_0x5e10a9['pm2_env'][_0xb2e3('0x17')]+'\x22';}));}logger[_0xb2e3('0x11')](_0xb2e3('0x18'),_[_0xb2e3('0x19')](_[_0xb2e3('0x12')](_0x51e55b,{'status':_0xb2e3('0x1a')}),_0xb2e3('0x17'))['join']());logger[_0xb2e3('0x11')]('Offline\x20apps:',_[_0xb2e3('0x19')](_[_0xb2e3('0x12')](_0x51e55b,function(_0x101d96){return _0x101d96[_0xb2e3('0x1b')]!=='online';}),_0xb2e3('0x17'))['join']()||_0xb2e3('0x1c'));console[_0xb2e3('0x1d')](_0xb2e3('0x1e'));})[_0xb2e3('0x1f')](function(_0x59e4a4){console[_0xb2e3('0x1d')](_0xb2e3('0x20'),_0x59e4a4);logger[_0xb2e3('0x21')](_0xb2e3('0x22'),_0x59e4a4);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 5f0f675..b7c4d7c 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 _0x34e8=['validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','encryptString','join','promisify','sign','secret','secrets','payload','options','verify','toString','hex','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','user','ChatInteraction','params','closed','disposition','unmanaged','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','Basic','User','find','pass','status','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','getUuid','then','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','minutes','User\x20not\x20found.','canUpdate','use','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'];(function(_0x5895f4,_0x5f3a7d){var _0x2d3caf=function(_0x552bef){while(--_0x552bef){_0x5895f4['push'](_0x5895f4['shift']());}};_0x2d3caf(++_0x5f3a7d);}(_0x34e8,0x12c));var _0x834e=function(_0x130c74,_0x5aa0f0){_0x130c74=_0x130c74-0x0;var _0x16a522=_0x34e8[_0x130c74];return _0x16a522;};'use strict';var db=require(_0x834e('0x0'))['db'];var config=require(_0x834e('0x1'));var hardwareConf=require(_0x834e('0x2'));var licenseUtil=require(_0x834e('0x3'));var encryptor=require('../encryptor');var _=require(_0x834e('0x4'));var jwt=require(_0x834e('0x5'));var expressJwt=require(_0x834e('0x6'));var compose=require(_0x834e('0x7'));var basicAuth=require(_0x834e('0x8'));var crypto=require(_0x834e('0x9'));var BPromise=require(_0x834e('0xa'));var util=require('util');var moment=require(_0x834e('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x834e('0xc')]});var userAttributes=['id',_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10'),_0x834e('0x11'),_0x834e('0x12'),_0x834e('0x13'),_0x834e('0x14'),_0x834e('0x15'),_0x834e('0x16'),_0x834e('0x17'),_0x834e('0x18'),_0x834e('0x19'),_0x834e('0x1a'),_0x834e('0x1b'),_0x834e('0x1c'),'lastLoginAt',_0x834e('0x1d'),_0x834e('0x1e'),'allowmessenger',_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),'phoneBarDnd',_0x834e('0x23'),_0x834e('0x24'),'phoneBarEnableSettings',_0x834e('0x25'),'phoneBarPrefixRequired',_0x834e('0x26'),_0x834e('0x27'),'hotdesk',_0x834e('0x28'),_0x834e('0x29'),_0x834e('0x2a'),'settingsEnabled',_0x834e('0x2b'),_0x834e('0x2c'),_0x834e('0x2d'),_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30'),_0x834e('0x31'),'chatAutoanswerDelay',_0x834e('0x32'),_0x834e('0x33'),_0x834e('0x34'),_0x834e('0x35'),'openchannelAutoanswer',_0x834e('0x36'),_0x834e('0x37'),'faxAutoanswerDelay',_0x834e('0x38'),_0x834e('0x39')];exports[_0x834e('0x3a')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x231619,_0x34563b,_0x589dde){if(_0x231619[_0x834e('0x3b')]){_0x589dde();}else{return db[_0x834e('0x3c')]['findOne']({'where':{'id':_0x231619[_0x834e('0x3d')]['id']},'attributes':['id',_0x834e('0x3e'),_0x834e('0x3f')],'raw':!![]})['then'](function(_0x24fcf7){if(_0x24fcf7&&_0x24fcf7[_0x834e('0x3e')]){return _0x34563b['status'](_0x24fcf7['disposition']===_0x834e('0x40')?0x195:0x193)['json']({'message':_0x24fcf7[_0x834e('0x3f')]===_0x834e('0x40')?_0x834e('0x41'):_0x834e('0x42')});}else{_0x589dde();}})[_0x834e('0x43')](function(_0x130cc5){_0x589dde(_0x130cc5);});}});};exports['isAuthenticated']=function isAuthenticated(_0x510780){return compose()['use'](function(_0x58c1d7,_0x2c7a8d,_0x567cea){var _0x106d6a;if(_0x58c1d7['headers'][_0x834e('0x44')]){if(_[_0x834e('0x45')](_0x58c1d7[_0x834e('0x46')][_0x834e('0x44')],_0x834e('0x47'))){var _0x390119=basicAuth(_0x58c1d7);db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'name':_0x390119[_0x834e('0xf')]}})['then'](function(_0xef9ec2){if(!_0xef9ec2||!_0xef9ec2['authenticate'](_0x390119[_0x834e('0x4a')])){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x4d')});}_0x58c1d7[_0x834e('0x3b')]={'id':_0xef9ec2['id']};_0x567cea();})[_0x834e('0x43')](function(_0x4696a1){_0x567cea(_0x4696a1);});}else if(_[_0x834e('0x45')](_0x58c1d7[_0x834e('0x46')][_0x834e('0x44')],'Bearer')){validateJwt(_0x58c1d7,_0x2c7a8d,_0x567cea);}else{if(_0x510780){_0x567cea();}else{return _0x2c7a8d[_0x834e('0x4b')](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x4e')});}}}else if(_0x58c1d7[_0x834e('0x4f')]['apikey']){try{var _0x3f88ad={'audience':hardwareConf[_0x834e('0x50')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x58c1d7['query']['apikey'],_0x3f88ad)[_0x834e('0x51')](function(_0x41bf4d){return db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'id':_0x41bf4d[_0x834e('0x52')]}})[_0x834e('0x51')](function(_0x4c2ef6){_0x106d6a=_0x4c2ef6;return db[_0x834e('0x53')]['findOne']({'where':{'id':0x1},'attributes':[_0x834e('0x54'),_0x834e('0x55')],'raw':!![]});})['then'](function(_0x18ac3b){if(!_0x106d6a||!_[_0x834e('0x56')](_0x106d6a['apiKeyNonce'],_0x41bf4d['nonce'])){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x57')});}if(_0x106d6a[_0x834e('0x58')]){return _0x2c7a8d[_0x834e('0x4b')](0x191)['json']({'message':_0x834e('0x59')});}if(_0x106d6a['blocked']){if(_0x18ac3b['blockDuration']>0x0){if(moment(_0x106d6a[_0x834e('0x5a')])['add'](_0x18ac3b[_0x834e('0x55')],_0x834e('0x5b'))>moment()){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x59')});}}else{return _0x2c7a8d['status'](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x59')});}}_0x58c1d7[_0x834e('0x3b')]={'id':_0x106d6a['id']};_0x567cea();});})['catch'](function(){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1e3e71){_0x567cea(_0x1e3e71);}}else if(_0x510780){_0x567cea();}else{return _0x2c7a8d['status'](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x4e')});}})['use'](function(_0x4a6942,_0x22ea21,_0x16969b){if(_0x4a6942[_0x834e('0x3b')]){db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'id':_0x4a6942[_0x834e('0x3b')]['id']},'attributes':userAttributes})[_0x834e('0x51')](function(_0x4a3381){if(!_0x4a3381){return _0x22ea21[_0x834e('0x4b')](0x194)['json']({'message':_0x834e('0x5c')});}_0x4a6942['user']=_0x4a3381;_0x16969b();})[_0x834e('0x43')](function(_0x5a5807){_0x16969b(_0x5a5807);});}else if(_0x510780){_0x16969b();}else{return _0x22ea21[_0x834e('0x4b')](0x194)[_0x834e('0x4c')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x834e('0x5d')]=function canUpdate(){return compose()[_0x834e('0x5e')](function(_0xa880cb,_0xd55cc3,_0x252ea0){return licenseUtil[_0x834e('0x5f')]()[_0x834e('0x51')](function(_0x3ccd8e){if(_0x3ccd8e[_0x834e('0x60')]){_0x252ea0();}else{return _0xd55cc3[_0x834e('0x4b')](0x193)['json']({'message':_0x834e('0x61')});}})[_0x834e('0x43')](function(_0x47a8a9){_0x252ea0(_0x47a8a9);});});};exports[_0x834e('0x62')]=function isWebrtcLicence(){return compose()[_0x834e('0x5e')](function(_0x25b035,_0x2112d5,_0x19b5ef){return licenseUtil[_0x834e('0x5f')]()['then'](function(_0x59c855){if(_0x59c855[_0x834e('0x63')]){_0x19b5ef();}else{return _0x2112d5[_0x834e('0x4b')](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x61')});}})[_0x834e('0x43')](function(_0xd1d83b){_0x19b5ef(_0xd1d83b);});});};exports[_0x834e('0x64')]=function(_0x43f599,_0x1419eb,_0x390c45){_0x43f599[_0x834e('0x64')]=!![];return _0x390c45();};exports[_0x834e('0x65')]=function signToken(_0x1a28f6){return signJwt(_0x1a28f6);};exports[_0x834e('0x66')]=function(_0x2aa072,_0x1a3855){if(!_0x2aa072[_0x834e('0x3b')]){return _0x1a3855[_0x834e('0x4b')](0x194)[_0x834e('0x4c')]({'message':_0x834e('0x67')});}var _0x4cfacd={'payload':{'id':_0x2aa072[_0x834e('0x3b')]['id'],'role':_0x2aa072[_0x834e('0x3b')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x4cfacd)[_0x834e('0x51')](function(_0x3b0988){_0x1a3855['cookie'](_0x834e('0x68'),_0x3b0988);_0x1a3855[_0x834e('0x69')](_0x834e('0x6a'));})[_0x834e('0x43')](function(_0x4288e4){return _0x1a3855[_0x834e('0x4b')](0x1f4)[_0x834e('0x6b')](_0x4288e4);});};exports['retrieveApiKey']=function(_0x1ad7fe){if(_[_0x834e('0x6c')](_0x1ad7fe[_0x834e('0x6d')])||_[_0x834e('0x6c')](_0x1ad7fe[_0x834e('0x6e')])){return null;}else{return createJwt(_0x1ad7fe);}};exports[_0x834e('0x6f')]=function(_0x344b51){_0x344b51[_0x834e('0x6d')]=generateNonce();_0x344b51['apiKeyIat']=generateIssuedAt();return createJwt(_0x344b51);};exports[_0x834e('0x70')]=function(_0x4dc104,_0x2f4bde){var _0x53a9ee=_0x4dc104[_0x834e('0x4f')]['apikey'];if(_0x53a9ee){var _0x527eef={'nonce':_0x2f4bde[_0x834e('0x6d')],'iat':_0x2f4bde[_0x834e('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x53a9ee,_0x527eef)[_0x834e('0x51')](function(){return generateApiKey(_0x2f4bde);});}else{throw{'message':_0x834e('0x71')};}};exports[_0x834e('0x72')]=function(_0x387365){var _0x21c417=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x21c417[_0x834e('0x73')](_0x387365))throw new db[(_0x834e('0x74'))][(_0x834e('0x75'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x834e('0x76')]=function(_0x3c70bf,_0x5d5ac2,_0x281342){var _0x4e2b22=encryptor[_0x834e('0x77')](_0x5d5ac2)[_0x834e('0x78')](',');for(var _0x5160c4=0x0;_0x5160c4<_0x281342;_0x5160c4++){if(!_0x4e2b22[_0x5160c4])break;if(_0x3c70bf[_0x834e('0x79')]()===_0x4e2b22[_0x5160c4][_0x834e('0x79')]()){var _0x2de29a=util[_0x834e('0x7a')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x281342);if(_0x281342===0x1){_0x2de29a=_0x834e('0x7b');}throw new db[(_0x834e('0x74'))][(_0x834e('0x75'))](_0x2de29a);}}return;};exports['updatePasswordsHistory']=function(_0x246b8e,_0x1fcae9){var _0x3a7683=_0x1fcae9?encryptor[_0x834e('0x77')](_0x1fcae9)[_0x834e('0x78')](','):[];if(_0x3a7683[_0x834e('0x7c')]===0x5){_0x3a7683[_0x834e('0x7d')](-0x1,0x1);}_0x3a7683[_0x834e('0x7e')](_0x246b8e);return encryptor[_0x834e('0x7f')](_0x3a7683[_0x834e('0x80')](','));};function signJwt(_0x1e4310){var _0x1dfa95=BPromise[_0x834e('0x81')](jwt[_0x834e('0x82')],{'context':jwt});var _0x460a7a=_0x1e4310[_0x834e('0x83')]||config[_0x834e('0x84')][_0x834e('0xc')];return new BPromise(function(_0x193a15,_0x3e3467){_0x1dfa95(_0x1e4310[_0x834e('0x85')],_0x460a7a,_0x1e4310[_0x834e('0x86')])['then'](function(_0x2145cf){_0x193a15(_0x2145cf);})[_0x834e('0x43')](function(_0x45bcc2){_0x3e3467(_0x45bcc2);});});}function verifyJwt(_0x36cc14,_0x4ca099,_0x30faa8){var _0x5a9c70=BPromise['promisify'](jwt[_0x834e('0x87')],{'context':jwt});var _0x2b1ec7=_0x30faa8||config[_0x834e('0x84')][_0x834e('0xc')];return new BPromise(function(_0x216105,_0x3821ad){_0x5a9c70(_0x36cc14,_0x2b1ec7,_0x4ca099)[_0x834e('0x51')](function(_0xe5c8f6){_0x216105(_0xe5c8f6);})['catch'](function(_0xdef8c4){_0x3821ad(_0xdef8c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x834e('0x88')](_0x834e('0x89'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x834e('0x88')]();}function createJwt(_0x82f2a7){var _0x363cc2={'payload':{'iat':_0x82f2a7[_0x834e('0x6e')],'nonce':_0x82f2a7[_0x834e('0x6d')]},'options':{'algorithm':'HS512','subject':_0x82f2a7['id'][_0x834e('0x88')](),'issuer':hardwareConf[_0x834e('0x50')](),'audience':hardwareConf[_0x834e('0x50')]()}};return signJwt(_0x363cc2)[_0x834e('0x51')](function(_0x3181af){return{'iat':_0x82f2a7[_0x834e('0x6e')],'nonce':_0x82f2a7[_0x834e('0x6d')],'token':_0x3181af};});} \ No newline at end of file +var _0x34e8=['validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','encryptString','join','promisify','sign','secret','secrets','payload','options','verify','toString','hex','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','user','ChatInteraction','params','closed','disposition','unmanaged','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','Basic','User','find','pass','status','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','getUuid','then','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','minutes','User\x20not\x20found.','canUpdate','use','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'];(function(_0x5de76b,_0x340b53){var _0x2a02f7=function(_0x20227f){while(--_0x20227f){_0x5de76b['push'](_0x5de76b['shift']());}};_0x2a02f7(++_0x340b53);}(_0x34e8,0x12c));var _0x834e=function(_0x2d8ca3,_0x2cae41){_0x2d8ca3=_0x2d8ca3-0x0;var _0x4976af=_0x34e8[_0x2d8ca3];return _0x4976af;};'use strict';var db=require(_0x834e('0x0'))['db'];var config=require(_0x834e('0x1'));var hardwareConf=require(_0x834e('0x2'));var licenseUtil=require(_0x834e('0x3'));var encryptor=require('../encryptor');var _=require(_0x834e('0x4'));var jwt=require(_0x834e('0x5'));var expressJwt=require(_0x834e('0x6'));var compose=require(_0x834e('0x7'));var basicAuth=require(_0x834e('0x8'));var crypto=require(_0x834e('0x9'));var BPromise=require(_0x834e('0xa'));var util=require('util');var moment=require(_0x834e('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x834e('0xc')]});var userAttributes=['id',_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10'),_0x834e('0x11'),_0x834e('0x12'),_0x834e('0x13'),_0x834e('0x14'),_0x834e('0x15'),_0x834e('0x16'),_0x834e('0x17'),_0x834e('0x18'),_0x834e('0x19'),_0x834e('0x1a'),_0x834e('0x1b'),_0x834e('0x1c'),'lastLoginAt',_0x834e('0x1d'),_0x834e('0x1e'),'allowmessenger',_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),'phoneBarDnd',_0x834e('0x23'),_0x834e('0x24'),'phoneBarEnableSettings',_0x834e('0x25'),'phoneBarPrefixRequired',_0x834e('0x26'),_0x834e('0x27'),'hotdesk',_0x834e('0x28'),_0x834e('0x29'),_0x834e('0x2a'),'settingsEnabled',_0x834e('0x2b'),_0x834e('0x2c'),_0x834e('0x2d'),_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30'),_0x834e('0x31'),'chatAutoanswerDelay',_0x834e('0x32'),_0x834e('0x33'),_0x834e('0x34'),_0x834e('0x35'),'openchannelAutoanswer',_0x834e('0x36'),_0x834e('0x37'),'faxAutoanswerDelay',_0x834e('0x38'),_0x834e('0x39')];exports[_0x834e('0x3a')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x231619,_0x34563b,_0x589dde){if(_0x231619[_0x834e('0x3b')]){_0x589dde();}else{return db[_0x834e('0x3c')]['findOne']({'where':{'id':_0x231619[_0x834e('0x3d')]['id']},'attributes':['id',_0x834e('0x3e'),_0x834e('0x3f')],'raw':!![]})['then'](function(_0x24fcf7){if(_0x24fcf7&&_0x24fcf7[_0x834e('0x3e')]){return _0x34563b['status'](_0x24fcf7['disposition']===_0x834e('0x40')?0x195:0x193)['json']({'message':_0x24fcf7[_0x834e('0x3f')]===_0x834e('0x40')?_0x834e('0x41'):_0x834e('0x42')});}else{_0x589dde();}})[_0x834e('0x43')](function(_0x130cc5){_0x589dde(_0x130cc5);});}});};exports['isAuthenticated']=function isAuthenticated(_0x510780){return compose()['use'](function(_0x58c1d7,_0x2c7a8d,_0x567cea){var _0x106d6a;if(_0x58c1d7['headers'][_0x834e('0x44')]){if(_[_0x834e('0x45')](_0x58c1d7[_0x834e('0x46')][_0x834e('0x44')],_0x834e('0x47'))){var _0x390119=basicAuth(_0x58c1d7);db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'name':_0x390119[_0x834e('0xf')]}})['then'](function(_0xef9ec2){if(!_0xef9ec2||!_0xef9ec2['authenticate'](_0x390119[_0x834e('0x4a')])){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x4d')});}_0x58c1d7[_0x834e('0x3b')]={'id':_0xef9ec2['id']};_0x567cea();})[_0x834e('0x43')](function(_0x4696a1){_0x567cea(_0x4696a1);});}else if(_[_0x834e('0x45')](_0x58c1d7[_0x834e('0x46')][_0x834e('0x44')],'Bearer')){validateJwt(_0x58c1d7,_0x2c7a8d,_0x567cea);}else{if(_0x510780){_0x567cea();}else{return _0x2c7a8d[_0x834e('0x4b')](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x4e')});}}}else if(_0x58c1d7[_0x834e('0x4f')]['apikey']){try{var _0x3f88ad={'audience':hardwareConf[_0x834e('0x50')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x58c1d7['query']['apikey'],_0x3f88ad)[_0x834e('0x51')](function(_0x41bf4d){return db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'id':_0x41bf4d[_0x834e('0x52')]}})[_0x834e('0x51')](function(_0x4c2ef6){_0x106d6a=_0x4c2ef6;return db[_0x834e('0x53')]['findOne']({'where':{'id':0x1},'attributes':[_0x834e('0x54'),_0x834e('0x55')],'raw':!![]});})['then'](function(_0x18ac3b){if(!_0x106d6a||!_[_0x834e('0x56')](_0x106d6a['apiKeyNonce'],_0x41bf4d['nonce'])){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x57')});}if(_0x106d6a[_0x834e('0x58')]){return _0x2c7a8d[_0x834e('0x4b')](0x191)['json']({'message':_0x834e('0x59')});}if(_0x106d6a['blocked']){if(_0x18ac3b['blockDuration']>0x0){if(moment(_0x106d6a[_0x834e('0x5a')])['add'](_0x18ac3b[_0x834e('0x55')],_0x834e('0x5b'))>moment()){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x59')});}}else{return _0x2c7a8d['status'](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x59')});}}_0x58c1d7[_0x834e('0x3b')]={'id':_0x106d6a['id']};_0x567cea();});})['catch'](function(){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1e3e71){_0x567cea(_0x1e3e71);}}else if(_0x510780){_0x567cea();}else{return _0x2c7a8d['status'](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x4e')});}})['use'](function(_0x4a6942,_0x22ea21,_0x16969b){if(_0x4a6942[_0x834e('0x3b')]){db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'id':_0x4a6942[_0x834e('0x3b')]['id']},'attributes':userAttributes})[_0x834e('0x51')](function(_0x4a3381){if(!_0x4a3381){return _0x22ea21[_0x834e('0x4b')](0x194)['json']({'message':_0x834e('0x5c')});}_0x4a6942['user']=_0x4a3381;_0x16969b();})[_0x834e('0x43')](function(_0x5a5807){_0x16969b(_0x5a5807);});}else if(_0x510780){_0x16969b();}else{return _0x22ea21[_0x834e('0x4b')](0x194)[_0x834e('0x4c')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x834e('0x5d')]=function canUpdate(){return compose()[_0x834e('0x5e')](function(_0xa880cb,_0xd55cc3,_0x252ea0){return licenseUtil[_0x834e('0x5f')]()[_0x834e('0x51')](function(_0x3ccd8e){if(_0x3ccd8e[_0x834e('0x60')]){_0x252ea0();}else{return _0xd55cc3[_0x834e('0x4b')](0x193)['json']({'message':_0x834e('0x61')});}})[_0x834e('0x43')](function(_0x47a8a9){_0x252ea0(_0x47a8a9);});});};exports[_0x834e('0x62')]=function isWebrtcLicence(){return compose()[_0x834e('0x5e')](function(_0x25b035,_0x2112d5,_0x19b5ef){return licenseUtil[_0x834e('0x5f')]()['then'](function(_0x59c855){if(_0x59c855[_0x834e('0x63')]){_0x19b5ef();}else{return _0x2112d5[_0x834e('0x4b')](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x61')});}})[_0x834e('0x43')](function(_0xd1d83b){_0x19b5ef(_0xd1d83b);});});};exports[_0x834e('0x64')]=function(_0x43f599,_0x1419eb,_0x390c45){_0x43f599[_0x834e('0x64')]=!![];return _0x390c45();};exports[_0x834e('0x65')]=function signToken(_0x1a28f6){return signJwt(_0x1a28f6);};exports[_0x834e('0x66')]=function(_0x2aa072,_0x1a3855){if(!_0x2aa072[_0x834e('0x3b')]){return _0x1a3855[_0x834e('0x4b')](0x194)[_0x834e('0x4c')]({'message':_0x834e('0x67')});}var _0x4cfacd={'payload':{'id':_0x2aa072[_0x834e('0x3b')]['id'],'role':_0x2aa072[_0x834e('0x3b')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x4cfacd)[_0x834e('0x51')](function(_0x3b0988){_0x1a3855['cookie'](_0x834e('0x68'),_0x3b0988);_0x1a3855[_0x834e('0x69')](_0x834e('0x6a'));})[_0x834e('0x43')](function(_0x4288e4){return _0x1a3855[_0x834e('0x4b')](0x1f4)[_0x834e('0x6b')](_0x4288e4);});};exports['retrieveApiKey']=function(_0x1ad7fe){if(_[_0x834e('0x6c')](_0x1ad7fe[_0x834e('0x6d')])||_[_0x834e('0x6c')](_0x1ad7fe[_0x834e('0x6e')])){return null;}else{return createJwt(_0x1ad7fe);}};exports[_0x834e('0x6f')]=function(_0x344b51){_0x344b51[_0x834e('0x6d')]=generateNonce();_0x344b51['apiKeyIat']=generateIssuedAt();return createJwt(_0x344b51);};exports[_0x834e('0x70')]=function(_0x4dc104,_0x2f4bde){var _0x53a9ee=_0x4dc104[_0x834e('0x4f')]['apikey'];if(_0x53a9ee){var _0x527eef={'nonce':_0x2f4bde[_0x834e('0x6d')],'iat':_0x2f4bde[_0x834e('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x53a9ee,_0x527eef)[_0x834e('0x51')](function(){return generateApiKey(_0x2f4bde);});}else{throw{'message':_0x834e('0x71')};}};exports[_0x834e('0x72')]=function(_0x387365){var _0x21c417=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x21c417[_0x834e('0x73')](_0x387365))throw new db[(_0x834e('0x74'))][(_0x834e('0x75'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x834e('0x76')]=function(_0x3c70bf,_0x5d5ac2,_0x281342){var _0x4e2b22=encryptor[_0x834e('0x77')](_0x5d5ac2)[_0x834e('0x78')](',');for(var _0x5160c4=0x0;_0x5160c4<_0x281342;_0x5160c4++){if(!_0x4e2b22[_0x5160c4])break;if(_0x3c70bf[_0x834e('0x79')]()===_0x4e2b22[_0x5160c4][_0x834e('0x79')]()){var _0x2de29a=util[_0x834e('0x7a')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x281342);if(_0x281342===0x1){_0x2de29a=_0x834e('0x7b');}throw new db[(_0x834e('0x74'))][(_0x834e('0x75'))](_0x2de29a);}}return;};exports['updatePasswordsHistory']=function(_0x246b8e,_0x1fcae9){var _0x3a7683=_0x1fcae9?encryptor[_0x834e('0x77')](_0x1fcae9)[_0x834e('0x78')](','):[];if(_0x3a7683[_0x834e('0x7c')]===0x5){_0x3a7683[_0x834e('0x7d')](-0x1,0x1);}_0x3a7683[_0x834e('0x7e')](_0x246b8e);return encryptor[_0x834e('0x7f')](_0x3a7683[_0x834e('0x80')](','));};function signJwt(_0x1e4310){var _0x1dfa95=BPromise[_0x834e('0x81')](jwt[_0x834e('0x82')],{'context':jwt});var _0x460a7a=_0x1e4310[_0x834e('0x83')]||config[_0x834e('0x84')][_0x834e('0xc')];return new BPromise(function(_0x193a15,_0x3e3467){_0x1dfa95(_0x1e4310[_0x834e('0x85')],_0x460a7a,_0x1e4310[_0x834e('0x86')])['then'](function(_0x2145cf){_0x193a15(_0x2145cf);})[_0x834e('0x43')](function(_0x45bcc2){_0x3e3467(_0x45bcc2);});});}function verifyJwt(_0x36cc14,_0x4ca099,_0x30faa8){var _0x5a9c70=BPromise['promisify'](jwt[_0x834e('0x87')],{'context':jwt});var _0x2b1ec7=_0x30faa8||config[_0x834e('0x84')][_0x834e('0xc')];return new BPromise(function(_0x216105,_0x3821ad){_0x5a9c70(_0x36cc14,_0x2b1ec7,_0x4ca099)[_0x834e('0x51')](function(_0xe5c8f6){_0x216105(_0xe5c8f6);})['catch'](function(_0xdef8c4){_0x3821ad(_0xdef8c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x834e('0x88')](_0x834e('0x89'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x834e('0x88')]();}function createJwt(_0x82f2a7){var _0x363cc2={'payload':{'iat':_0x82f2a7[_0x834e('0x6e')],'nonce':_0x82f2a7[_0x834e('0x6d')]},'options':{'algorithm':'HS512','subject':_0x82f2a7['id'][_0x834e('0x88')](),'issuer':hardwareConf[_0x834e('0x50')](),'audience':hardwareConf[_0x834e('0x50')]()}};return signJwt(_0x363cc2)[_0x834e('0x51')](function(_0x3181af){return{'iat':_0x82f2a7[_0x834e('0x6e')],'nonce':_0x82f2a7[_0x834e('0x6d')],'token':_0x3181af};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 06b1441..1bb7612 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 _0x6acf=['base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','binary','write','end','final','close','unlink','decryptFile','createDecipher','secret','createCipher','utf8'];(function(_0x3d1e6d,_0x1ad9ca){var _0x3ed7fc=function(_0x2a4ade){while(--_0x2a4ade){_0x3d1e6d['push'](_0x3d1e6d['shift']());}};_0x3ed7fc(++_0x1ad9ca);}(_0x6acf,0xe0));var _0xf6ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6acf[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0xf6ac('0x0'));var fs=require('fs');var BPromise=require(_0xf6ac('0x1'));var _=require(_0xf6ac('0x2'));var config=require(_0xf6ac('0x3'));var logger=require(_0xf6ac('0x4'))(_0xf6ac('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xf6ac('0x6')][_0xf6ac('0x7')],'algorithm':_0xf6ac('0x8')};const fileOptions={'algorithm':_0xf6ac('0x9')};if(config[_0xf6ac('0xa')]&&config[_0xf6ac('0xa')][_0xf6ac('0xb')]){var isSupported=isAlgorithmSupported(config[_0xf6ac('0xa')]['algorithm']);if(isSupported){fileOptions[_0xf6ac('0xb')]=config[_0xf6ac('0xa')][_0xf6ac('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xf6ac('0xc')](',\x20');logger[_0xf6ac('0xd')](config['encrypt'][_0xf6ac('0xb')],_0xf6ac('0xe'),supportedAlgorithms);}}function isASupportedCipher(_0x312db5){return AES_SUPPORTED_RX[_0xf6ac('0xf')](_0x312db5);}function getSupportedCiphers(){return crypto[_0xf6ac('0x10')]()[_0xf6ac('0x11')](isASupportedCipher);}function isAlgorithmSupported(_0x315a36){return getSupportedCiphers()['indexOf'](_0x315a36)>-0x1;}function combineOptions(_0x16e44c){var _0x2a2144={};for(var _0x24bef0 in fileOptions){if(fileOptions[_0xf6ac('0x12')](_0x24bef0)){_0x2a2144[_0x24bef0]=fileOptions[_0x24bef0];}}if(_0x16e44c){for(var _0x203fe7 in _0x16e44c){if(_0x16e44c[_0xf6ac('0x12')](_0x203fe7)){_0x2a2144[_0x203fe7]=_0x16e44c[_0x203fe7];}}}return _0x2a2144;}exports[_0xf6ac('0x13')]=function(_0x3d51a6,_0x2a5dfb,_0x31c792,_0x38f63a){return new BPromise(function(_0x140de7,_0x193922){_0x38f63a=combineOptions(_0x38f63a);var _0x3c3a08=new Buffer(_0x31c792);var _0x6dfd92=fs[_0xf6ac('0x14')](_0x3d51a6);var _0x362269=fs[_0xf6ac('0x15')](_0x2a5dfb);var _0x4beb28=crypto['createCipher'](_0x38f63a['algorithm'],_0x3c3a08);_0x6dfd92['on'](_0xf6ac('0x16'),function(_0x389c39){var _0xdf1bf5=new Buffer(_0x4beb28[_0xf6ac('0x17')](_0x389c39),_0xf6ac('0x18'));_0x362269[_0xf6ac('0x19')](_0xdf1bf5);});_0x6dfd92['on'](_0xf6ac('0x1a'),function(){try{var _0x1574b6=new Buffer(_0x4beb28[_0xf6ac('0x1b')](_0xf6ac('0x18')),'binary');_0x362269['write'](_0x1574b6);_0x362269[_0xf6ac('0x1a')]();_0x362269['on'](_0xf6ac('0x1c'),function(){return _0x140de7(_0x2a5dfb);});}catch(_0x29a6f5){fs[_0xf6ac('0x1d')](_0x2a5dfb);return _0x193922(_0x29a6f5);}});});};exports[_0xf6ac('0x1e')]=function(_0x42f831,_0x481298,_0x601926,_0x2f5ae9){return new BPromise(function(_0x34ddd8,_0x279bc1){_0x2f5ae9=combineOptions(_0x2f5ae9);var _0x1a9fe7=new Buffer(_0x601926);var _0xdc1284=fs[_0xf6ac('0x14')](_0x42f831);var _0x2e2a08=fs['createWriteStream'](_0x481298);var _0x17ae63=crypto[_0xf6ac('0x1f')](_0x2f5ae9[_0xf6ac('0xb')],_0x1a9fe7);_0xdc1284['on']('data',function(_0x17d5d0){var _0x127733=new Buffer(_0x17ae63[_0xf6ac('0x17')](_0x17d5d0),_0xf6ac('0x18'));_0x2e2a08[_0xf6ac('0x19')](_0x127733);});_0xdc1284['on'](_0xf6ac('0x1a'),function(){try{var _0x22618c=new Buffer(_0x17ae63[_0xf6ac('0x1b')](_0xf6ac('0x18')),'binary');_0x2e2a08['write'](_0x22618c);_0x2e2a08[_0xf6ac('0x1a')]();_0x2e2a08['on']('close',function(){return _0x34ddd8(_0x481298);});}catch(_0x31e02b){fs[_0xf6ac('0x1d')](_0x481298);return _0x279bc1(_0x31e02b);}});});};exports['encryptString']=function(_0x4cb0f8,_0x47741e,_0x3e9622){var _0x53fccf=_0x3e9622||stringOptions[_0xf6ac('0xb')];var _0x465368=_0x47741e||stringOptions[_0xf6ac('0x20')];var _0x18d0f4=crypto[_0xf6ac('0x21')](_0x53fccf,_0x465368);var _0x18833d=_0x18d0f4[_0xf6ac('0x17')](_0x4cb0f8,_0xf6ac('0x22'),'base64');_0x18833d+=_0x18d0f4[_0xf6ac('0x1b')](_0xf6ac('0x23'));return _0x18833d;};exports[_0xf6ac('0x24')]=function(_0xa522,_0x4ebcb4,_0x440010){var _0x481576=_0x440010||stringOptions['algorithm'];var _0x1e6644=_0x4ebcb4||stringOptions[_0xf6ac('0x20')];var _0xc460b=crypto[_0xf6ac('0x1f')](_0x481576,_0x1e6644);var _0x3dafb3=_0xc460b[_0xf6ac('0x17')](_0xa522,_0xf6ac('0x23'),'utf8');_0x3dafb3+=_0xc460b[_0xf6ac('0x1b')](_0xf6ac('0x22'));return _0x3dafb3;}; \ No newline at end of file +var _0xa26d=['createWriteStream','createCipher','update','write','final','binary','end','unlink','createDecipher','data','close','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','filter','indexOf','createReadStream'];(function(_0x5d347a,_0x13c656){var _0x2eee8b=function(_0x27d50f){while(--_0x27d50f){_0x5d347a['push'](_0x5d347a['shift']());}};_0x2eee8b(++_0x13c656);}(_0xa26d,0x12f));var _0xda26=function(_0x4356ab,_0x358782){_0x4356ab=_0x4356ab-0x0;var _0x9010bc=_0xa26d[_0x4356ab];return _0x9010bc;};'use strict';var crypto=require(_0xda26('0x0'));var fs=require('fs');var BPromise=require(_0xda26('0x1'));var _=require(_0xda26('0x2'));var config=require(_0xda26('0x3'));var logger=require('../../config/logger')(_0xda26('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xda26('0x5')][_0xda26('0x6')],'algorithm':_0xda26('0x7')};const fileOptions={'algorithm':_0xda26('0x8')};if(config[_0xda26('0x9')]&&config[_0xda26('0x9')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xda26('0x9')][_0xda26('0xa')]);if(isSupported){fileOptions[_0xda26('0xa')]=config[_0xda26('0x9')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xda26('0xb')](',\x20');logger[_0xda26('0xc')](config['encrypt']['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x31d041){return AES_SUPPORTED_RX[_0xda26('0xd')](_0x31d041);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xda26('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x1cd9d8){return getSupportedCiphers()[_0xda26('0xf')](_0x1cd9d8)>-0x1;}function combineOptions(_0x411623){var _0x23b91c={};for(var _0x34bd1d in fileOptions){if(fileOptions['hasOwnProperty'](_0x34bd1d)){_0x23b91c[_0x34bd1d]=fileOptions[_0x34bd1d];}}if(_0x411623){for(var _0x2a461e in _0x411623){if(_0x411623['hasOwnProperty'](_0x2a461e)){_0x23b91c[_0x2a461e]=_0x411623[_0x2a461e];}}}return _0x23b91c;}exports['encryptFile']=function(_0x5ab1c6,_0x2b72ab,_0x1bc237,_0x9adb6f){return new BPromise(function(_0x472488,_0x288735){_0x9adb6f=combineOptions(_0x9adb6f);var _0x166240=new Buffer(_0x1bc237);var _0x56f382=fs[_0xda26('0x10')](_0x5ab1c6);var _0x151ec0=fs[_0xda26('0x11')](_0x2b72ab);var _0x19680a=crypto[_0xda26('0x12')](_0x9adb6f[_0xda26('0xa')],_0x166240);_0x56f382['on']('data',function(_0x1bb9a3){var _0x440c5c=new Buffer(_0x19680a[_0xda26('0x13')](_0x1bb9a3),'binary');_0x151ec0[_0xda26('0x14')](_0x440c5c);});_0x56f382['on']('end',function(){try{var _0x371b89=new Buffer(_0x19680a[_0xda26('0x15')](_0xda26('0x16')),'binary');_0x151ec0[_0xda26('0x14')](_0x371b89);_0x151ec0[_0xda26('0x17')]();_0x151ec0['on']('close',function(){return _0x472488(_0x2b72ab);});}catch(_0x258141){fs[_0xda26('0x18')](_0x2b72ab);return _0x288735(_0x258141);}});});};exports['decryptFile']=function(_0x336da2,_0x42f26d,_0x2daa79,_0x31607d){return new BPromise(function(_0x26d855,_0x3be339){_0x31607d=combineOptions(_0x31607d);var _0x4805f7=new Buffer(_0x2daa79);var _0xa06651=fs['createReadStream'](_0x336da2);var _0x5abaaa=fs[_0xda26('0x11')](_0x42f26d);var _0x5b28f6=crypto[_0xda26('0x19')](_0x31607d[_0xda26('0xa')],_0x4805f7);_0xa06651['on'](_0xda26('0x1a'),function(_0x189a4e){var _0x18f1fd=new Buffer(_0x5b28f6[_0xda26('0x13')](_0x189a4e),'binary');_0x5abaaa['write'](_0x18f1fd);});_0xa06651['on'](_0xda26('0x17'),function(){try{var _0x3df39d=new Buffer(_0x5b28f6[_0xda26('0x15')](_0xda26('0x16')),'binary');_0x5abaaa['write'](_0x3df39d);_0x5abaaa[_0xda26('0x17')]();_0x5abaaa['on'](_0xda26('0x1b'),function(){return _0x26d855(_0x42f26d);});}catch(_0x269603){fs[_0xda26('0x18')](_0x42f26d);return _0x3be339(_0x269603);}});});};exports['encryptString']=function(_0x36edaf,_0x5b6ad2,_0x200374){var _0x2c21ad=_0x200374||stringOptions[_0xda26('0xa')];var _0xcce3c3=_0x5b6ad2||stringOptions[_0xda26('0x1c')];var _0x2c5996=crypto['createCipher'](_0x2c21ad,_0xcce3c3);var _0x4b3372=_0x2c5996[_0xda26('0x13')](_0x36edaf,_0xda26('0x1d'),_0xda26('0x1e'));_0x4b3372+=_0x2c5996[_0xda26('0x15')](_0xda26('0x1e'));return _0x4b3372;};exports[_0xda26('0x1f')]=function(_0x3ef88a,_0x15df5c,_0x23bae1){var _0x435941=_0x23bae1||stringOptions[_0xda26('0xa')];var _0x16a2cd=_0x15df5c||stringOptions[_0xda26('0x1c')];var _0x2b68a6=crypto['createDecipher'](_0x435941,_0x16a2cd);var _0xb56f1a=_0x2b68a6[_0xda26('0x13')](_0x3ef88a,_0xda26('0x1e'),_0xda26('0x1d'));_0xb56f1a+=_0x2b68a6['final'](_0xda26('0x1d'));return _0xb56f1a;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index bf35ebf..646e851 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 _0xffb8=['range','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.csv','existsSync','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','argv','AnalyticExtractedReport','update','format','CSV','Setting','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','split','length'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0xffb8,0xd7));var _0x8ffb=function(_0x5f22f9,_0x260e19){_0x5f22f9=_0x5f22f9-0x0;var _0x665fa9=_0xffb8[_0x5f22f9];return _0x665fa9;};'use strict';var util=require('util');var path=require(_0x8ffb('0x0'));var _=require(_0x8ffb('0x1'));var csv=require(_0x8ffb('0x2'));var fs=require('fs');var BPromise=require(_0x8ffb('0x3'));var zipdir=require(_0x8ffb('0x4'));var rimraf=require(_0x8ffb('0x5'));var db=require(_0x8ffb('0x6'))['db'];var dbH=require(_0x8ffb('0x6'))[_0x8ffb('0x7')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x8ffb('0x8')][0x2]);var QUERY=process[_0x8ffb('0x8')][0x3];var PATH=process[_0x8ffb('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x63da15,_0x5edd1e){var _0x1abedb={'status':_0x63da15};var _0x59c9ab={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5edd1e){_0x1abedb['savename']=_0x5edd1e;}return db[_0x8ffb('0x9')][_0x8ffb('0xa')](_0x1abedb,_0x59c9ab);}function main(){var _0x2fd2fd=0x1388;var _0x4e396f;logger['info'](util[_0x8ffb('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8ffb('0xc')));return db[_0x8ffb('0xd')][_0x8ffb('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8ffb('0xf')]})[_0x8ffb('0x10')](function(_0x3757bc){if(_0x3757bc){_0x4e396f=_0x3757bc;_0x2fd2fd=_0x4e396f['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x8ffb('0x11')][_0x8ffb('0x12')](util[_0x8ffb('0xb')](_0x8ffb('0x13'),QUERY),{'type':dbH[_0x8ffb('0x11')][_0x8ffb('0x14')][_0x8ffb('0x15')]});})[_0x8ffb('0x10')](function(_0x2d9425){if(!_0x2d9425[0x0][_0x8ffb('0x16')]){return analyticExtractedReport('Empty');}var _0x4b8935=[];var _0x12da50=0x0;if(_0x4e396f[_0x8ffb('0x17')]){if(_0x2d9425&&_0x2d9425[_0x8ffb('0x18')]){var _0x4d458f=_[_0x8ffb('0x19')](_0x2d9425[0x0][_0x8ffb('0x16')]/_0x2fd2fd);var _0x546cd2=Number['isInteger'](_0x2d9425[0x0]['num']/_0x2fd2fd)?_0x2d9425[0x0][_0x8ffb('0x16')]%_0x2fd2fd:0x0;_0x4d458f[_0x8ffb('0x1a')](function(_0x1ba3c3){if(_0x1ba3c3>0x0){_0x12da50+=_0x2fd2fd;}_0x4b8935['push'](dbH['sequelize'][_0x8ffb('0x12')](util[_0x8ffb('0xb')](_0x8ffb('0x1b'),QUERY,_0x2fd2fd,_0x12da50),{'type':dbH['sequelize']['QueryTypes'][_0x8ffb('0x15')]}));});if(_0x546cd2>0x0){_0x12da50+=_0x2fd2fd;_0x4b8935[_0x8ffb('0x1c')](dbH['sequelize'][_0x8ffb('0x12')](util[_0x8ffb('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x546cd2,_0x12da50),{'type':dbH['sequelize']['QueryTypes'][_0x8ffb('0x15')]}));}}}else{_0x4b8935['push'](dbH[_0x8ffb('0x11')][_0x8ffb('0x12')](QUERY,{'type':dbH['sequelize'][_0x8ffb('0x14')][_0x8ffb('0x15')]}));}var _0x18a99a=path[_0x8ffb('0x1d')](PATH);var _0x39af75=path[_0x8ffb('0x1e')](PATH,_0x8ffb('0x1f'));var _0x132874=_0x4e396f[_0x8ffb('0x17')]&&_0x4b8935[_0x8ffb('0x18')]>0x1;var _0x30b77f=[];if(!fs[_0x8ffb('0x20')](path[_0x8ffb('0x21')](_0x18a99a,_0x39af75))&&_0x132874){fs[_0x8ffb('0x22')](path[_0x8ffb('0x21')](_0x18a99a,_0x39af75));}return BPromise['each'](_0x4b8935,function(_0x3240ef){_0x30b77f[_0x8ffb('0x1c')](_0x3240ef);})['then'](function(){for(var _0x1dac99=0x0;_0x1dac99<_0x30b77f[_0x8ffb('0x18')];_0x1dac99+=0x1){var _0x319c7f;var _0x462fde=_0x30b77f[_0x1dac99];if(_0x132874){_0x319c7f=path['join'](_0x18a99a,_0x39af75,util[_0x8ffb('0xb')](_0x8ffb('0x23'),_0x39af75,_0x1dac99,_0x8ffb('0x24')));}else{_0x319c7f=path[_0x8ffb('0x21')](_0x18a99a,util[_0x8ffb('0xb')](_0x8ffb('0x25'),_0x39af75,_0x8ffb('0x24')));}fs[_0x8ffb('0x26')](_0x319c7f,csv(_0x462fde));}})[_0x8ffb('0x10')](function(){if(_0x132874){return new Promise(function(_0xb96a12){zipdir(path[_0x8ffb('0x21')](_0x18a99a,_0x39af75),{'saveTo':path[_0x8ffb('0x21')](_0x18a99a,util[_0x8ffb('0xb')](_0x8ffb('0x25'),_0x39af75,_0x8ffb('0x27')))},function(_0x1582c6,_0x4dcaa8){rimraf(path[_0x8ffb('0x21')](_0x18a99a,_0x39af75),function(){});_0xb96a12(_0x8ffb('0x28'));});});}})[_0x8ffb('0x10')](function(){logger[_0x8ffb('0x29')](util[_0x8ffb('0xb')](_0x8ffb('0x2a'),EXTRACTED_REPORT_ID,_0x8ffb('0xc')));return analyticExtractedReport(_0x8ffb('0x2b'),_0x132874?util[_0x8ffb('0xb')]('%s.%s',_0x39af75,_0x132874?_0x8ffb('0x27'):_0x8ffb('0x24')):null);});})[_0x8ffb('0x2c')](function(_0x34d408){logger[_0x8ffb('0x29')](util[_0x8ffb('0xb')](_0x8ffb('0x2d'),EXTRACTED_REPORT_ID,_0x8ffb('0xc')),util[_0x8ffb('0x2e')](_0x34d408,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x8ffb('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x46d5=['to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','isInteger','forEach','query','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','length','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash'];(function(_0x5a8a53,_0x59a2ae){var _0xf1861=function(_0x19cd0d){while(--_0x19cd0d){_0x5a8a53['push'](_0x5a8a53['shift']());}};_0xf1861(++_0x59a2ae);}(_0x46d5,0x1e4));var _0x546d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x46d5[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x546d('0x0'));var path=require('path');var _=require(_0x546d('0x1'));var csv=require(_0x546d('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x546d('0x3'));var rimraf=require(_0x546d('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x546d('0x5'))[_0x546d('0x6')];var logger=require(_0x546d('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x546d('0x8')][0x2]);var QUERY=process[_0x546d('0x8')][0x3];var PATH=process[_0x546d('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2377ca,_0x5070a1){var _0xd572f3={'status':_0x2377ca};var _0x1ec603={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5070a1){_0xd572f3[_0x546d('0x9')]=_0x5070a1;}return db[_0x546d('0xa')][_0x546d('0xb')](_0xd572f3,_0x1ec603);}function main(){var _0x689478=0x1388;var _0xac5c7b;logger[_0x546d('0xc')](util[_0x546d('0xd')](_0x546d('0xe'),EXTRACTED_REPORT_ID,_0x546d('0xf')));return db[_0x546d('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x546d('0x11'),_0x546d('0x12')]})['then'](function(_0x31dd8b){if(_0x31dd8b){_0xac5c7b=_0x31dd8b;_0x689478=_0xac5c7b[_0x546d('0x12')]||0x1388;}})[_0x546d('0x13')](function(){return dbH[_0x546d('0x14')]['query'](util[_0x546d('0xd')](_0x546d('0x15'),QUERY),{'type':dbH[_0x546d('0x14')][_0x546d('0x16')][_0x546d('0x17')]});})[_0x546d('0x13')](function(_0x4bfe85){if(!_0x4bfe85[0x0][_0x546d('0x18')]){return analyticExtractedReport(_0x546d('0x19'));}var _0x440571=[];var _0x21c0e3=0x0;if(_0xac5c7b[_0x546d('0x11')]){if(_0x4bfe85&&_0x4bfe85['length']){var _0x4a6b6f=_[_0x546d('0x1a')](_0x4bfe85[0x0][_0x546d('0x18')]/_0x689478);var _0x598d6e=Number[_0x546d('0x1b')](_0x4bfe85[0x0]['num']/_0x689478)?_0x4bfe85[0x0][_0x546d('0x18')]%_0x689478:0x0;_0x4a6b6f[_0x546d('0x1c')](function(_0xc6ed3){if(_0xc6ed3>0x0){_0x21c0e3+=_0x689478;}_0x440571['push'](dbH[_0x546d('0x14')][_0x546d('0x1d')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x689478,_0x21c0e3),{'type':dbH[_0x546d('0x14')][_0x546d('0x16')][_0x546d('0x17')]}));});if(_0x598d6e>0x0){_0x21c0e3+=_0x689478;_0x440571[_0x546d('0x1e')](dbH[_0x546d('0x14')][_0x546d('0x1d')](util[_0x546d('0xd')](_0x546d('0x1f'),QUERY,_0x598d6e,_0x21c0e3),{'type':dbH['sequelize'][_0x546d('0x16')][_0x546d('0x17')]}));}}}else{_0x440571[_0x546d('0x1e')](dbH[_0x546d('0x14')][_0x546d('0x1d')](QUERY,{'type':dbH[_0x546d('0x14')][_0x546d('0x16')]['SELECT']}));}var _0x3ba019=path[_0x546d('0x20')](PATH);var _0x3a8cee=path[_0x546d('0x21')](PATH,_0x546d('0x22'));var _0x1e5485=_0xac5c7b['split']&&_0x440571[_0x546d('0x23')]>0x1;var _0x5c95b3=[];if(!fs[_0x546d('0x24')](path[_0x546d('0x25')](_0x3ba019,_0x3a8cee))&&_0x1e5485){fs[_0x546d('0x26')](path['join'](_0x3ba019,_0x3a8cee));}return BPromise[_0x546d('0x27')](_0x440571,function(_0x45703d){_0x5c95b3[_0x546d('0x1e')](_0x45703d);})[_0x546d('0x13')](function(){for(var _0x52ec21=0x0;_0x52ec21<_0x5c95b3['length'];_0x52ec21+=0x1){var _0x3c4354;var _0x3c641c=_0x5c95b3[_0x52ec21];if(_0x1e5485){_0x3c4354=path['join'](_0x3ba019,_0x3a8cee,util[_0x546d('0xd')](_0x546d('0x28'),_0x3a8cee,_0x52ec21,_0x546d('0x29')));}else{_0x3c4354=path[_0x546d('0x25')](_0x3ba019,util[_0x546d('0xd')](_0x546d('0x2a'),_0x3a8cee,'csv'));}fs[_0x546d('0x2b')](_0x3c4354,csv(_0x3c641c));}})[_0x546d('0x13')](function(){if(_0x1e5485){return new Promise(function(_0x30fad3){zipdir(path['join'](_0x3ba019,_0x3a8cee),{'saveTo':path[_0x546d('0x25')](_0x3ba019,util[_0x546d('0xd')]('%s.%s',_0x3a8cee,_0x546d('0x2c')))},function(_0x32a0d2,_0x5ee928){rimraf(path[_0x546d('0x25')](_0x3ba019,_0x3a8cee),function(){});_0x30fad3(_0x546d('0x2d'));});});}})[_0x546d('0x13')](function(){logger[_0x546d('0xc')](util['format'](_0x546d('0x2e'),EXTRACTED_REPORT_ID,_0x546d('0xf')));return analyticExtractedReport(_0x546d('0x2f'),_0x1e5485?util['format']('%s.%s',_0x3a8cee,_0x1e5485?_0x546d('0x2c'):_0x546d('0x29')):null);});})[_0x546d('0x30')](function(_0x15e0a8){logger[_0x546d('0xc')](util[_0x546d('0xd')](_0x546d('0x31'),EXTRACTED_REPORT_ID,_0x546d('0xf')),util[_0x546d('0x32')](_0x15e0a8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x546d('0x33'));})[_0x546d('0x34')](function(){process[_0x546d('0x35')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 524ed3f..9992f91 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 _0x6294=['landscape','footer','Arial','black','right','Setting','find','split','splitSizePdf','then','range','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','basename','.pdf','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','pdf','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','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','path','lodash','util','moment','html-to-pdfmake','pdfmake/src/printer','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','toString','value','fill','length','auto','body','concat','chunk','keys','forEach','push','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','format','header','pageBreak','margin'];(function(_0x50eaaa,_0x32e9c9){var _0xb135ca=function(_0x1d43a2){while(--_0x1d43a2){_0x50eaaa['push'](_0x50eaaa['shift']());}};_0xb135ca(++_0x32e9c9);}(_0x6294,0xf7));var _0x4629=function(_0x57fbf0,_0x3af7c3){_0x57fbf0=_0x57fbf0-0x0;var _0x42c7ba=_0x6294[_0x57fbf0];return _0x42c7ba;};'use strict';var _=require(_0x4629('0x0'));var fs=require('fs');var util=require(_0x4629('0x1'));var path=require('path');var moment=require(_0x4629('0x2'));var htmlToPdfmake=require(_0x4629('0x3'));var PdfPrinter=require(_0x4629('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0x4629('0x5'))[_0x4629('0x6')];var window=new JSDOM('')[_0x4629('0x7')];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require(_0x4629('0x8'))[_0x4629('0x9')];var logger=require(_0x4629('0xa'))(_0x4629('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4629('0xc')][0x3];var PATH=process[_0x4629('0xc')][0x4];var NAME=process[_0x4629('0xc')][0x5];var FORMAT=_0x4629('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x25c8b6,_0xe5d3f7){var _0x12942b={'status':_0x25c8b6};var _0x36055f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xe5d3f7){_0x12942b[_0x4629('0xe')]=_0xe5d3f7;}return db[_0x4629('0xf')]['update'](_0x12942b,_0x36055f);}function getHeaders(_0x4c1418){return _[_0x4629('0x10')](_0x4c1418,function(_0x18a2b7){return{'text':_0x18a2b7,'style':_0x4629('0x11')};});}function getRows(_0x48f1e5,_0x2eca87){return _[_0x4629('0x10')](_0x2eca87,function(_0x5f2987){return _(_0x5f2987)[_0x4629('0x12')](_0x48f1e5)[_0x4629('0x10')](function(_0x5db526){return _0x5db526?_[_0x4629('0x13')](_0x5db526):'';})[_0x4629('0x14')]();});}function createTable(_0x14c65c,_0x3c2d8c){var _0x26e307={'widths':_[_0x4629('0x15')](Array(_0x14c65c[_0x4629('0x16')]),0x91),'heights':function(_0x54a1b9){return _0x54a1b9===0x0?_0x4629('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5a1530=getHeaders(_0x14c65c);_0x26e307['body']['push'](_0x5a1530);var _0x1c4e9f=getRows(_0x14c65c,_0x3c2d8c);_0x26e307[_0x4629('0x18')]=_0x26e307[_0x4629('0x18')][_0x4629('0x19')](_0x1c4e9f);return _0x26e307;}function createTables(_0x582f79){var _0x44446c=[];var _0x1ddeed=_[_0x4629('0x1a')](Object[_0x4629('0x1b')](_0x582f79[0x0]),0x5);_0x1ddeed[_0x4629('0x1c')](function(_0x14af5d){_0x44446c[_0x4629('0x1d')](createTable(_0x14af5d,_0x582f79));});return _0x44446c;}function getPDFDocDefinition(_0x17981d){var _0x1c0585=util['format'](_0x4629('0x1e'),NAME,EXTRACTED_REPORT[_0x4629('0x1f')],moment(EXTRACTED_REPORT[_0x4629('0x20')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x4629('0x21')])[_0x4629('0x22')](FORMAT));var _0x5702c4=[];for(var _0x3585d8=0x0;_0x3585d8<_0x17981d[_0x4629('0x16')];_0x3585d8++){var _0x2b5c6d=[];if(_0x3585d8===0x0){_0x2b5c6d[_0x4629('0x1d')]({'text':_0x1c0585,'style':_0x4629('0x23')});}var _0x485b61={'table':_0x17981d[_0x3585d8]};if(_0x3585d8>0x0){_0x485b61[_0x4629('0x24')]='before';_0x485b61[_0x4629('0x25')]=[0x0,0x46,0x0,0x0];}_0x2b5c6d[_0x4629('0x1d')](_0x485b61);_0x5702c4['push'](_0x2b5c6d);}return{'pageSize':'A4','pageOrientation':_0x4629('0x26'),'content':_0x5702c4,'footer':function(_0x338235,_0x5e0593){return{'text':_0x338235[_0x4629('0x13')]()+'\x20/\x20'+_0x5e0593,'style':_0x4629('0x27')};},'defaultStyle':{'font':_0x4629('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x4629('0x29')},'footer':{'alignment':_0x4629('0x2a'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1a96bc){var _0x4718e6=0x1388;var _0x54e8b9;if(!_0x1a96bc[0x0]['num']){return analyticExtractedReport('Empty');}return db[_0x4629('0x2b')][_0x4629('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4629('0x2d'),_0x4629('0x2e')]})[_0x4629('0x2f')](function(_0x2b8392){if(_0x2b8392){_0x54e8b9=_0x2b8392;_0x4718e6=_0x54e8b9[_0x4629('0x2e')]||0x3e8;}})[_0x4629('0x2f')](function(){var _0x4f567f=[];var _0x415646=0x0;if(_0x54e8b9[_0x4629('0x2d')]){if(_0x1a96bc&&_0x1a96bc[_0x4629('0x16')]){var _0x161fd2=_[_0x4629('0x30')](_0x1a96bc[0x0][_0x4629('0x31')]/_0x4718e6);var _0x28ccf0=Number[_0x4629('0x32')](_0x1a96bc[0x0][_0x4629('0x31')]/_0x4718e6)?_0x1a96bc[0x0][_0x4629('0x31')]%_0x4718e6:0x0;_0x161fd2[_0x4629('0x1c')](function(_0x57fabe){if(_0x57fabe>0x0){_0x415646+=_0x4718e6;}_0x4f567f[_0x4629('0x1d')](dbH[_0x4629('0x33')][_0x4629('0x34')](util['format'](_0x4629('0x35'),QUERY,_0x4718e6,_0x415646),{'type':dbH[_0x4629('0x33')]['QueryTypes'][_0x4629('0x36')]}));});if(_0x28ccf0>0x0){_0x415646+=_0x4718e6;_0x4f567f[_0x4629('0x1d')](dbH[_0x4629('0x33')][_0x4629('0x34')](util[_0x4629('0x22')](_0x4629('0x35'),QUERY,_0x28ccf0,_0x415646),{'type':dbH[_0x4629('0x33')][_0x4629('0x37')]['SELECT']}));}}}else{_0x4f567f[_0x4629('0x1d')](dbH[_0x4629('0x33')][_0x4629('0x34')](QUERY,{'type':dbH[_0x4629('0x33')][_0x4629('0x37')][_0x4629('0x36')]}));}var _0x1a0d6b=path['dirname'](PATH);var _0x356665=path[_0x4629('0x38')](PATH,_0x4629('0x39'));var _0x17b232=_0x54e8b9[_0x4629('0x2d')]&&_0x4f567f[_0x4629('0x16')]>0x1;var _0x2ff3c8=[];if(!fs['existsSync'](path[_0x4629('0x3a')](_0x1a0d6b,_0x356665))&&_0x17b232){fs[_0x4629('0x3b')](path[_0x4629('0x3a')](_0x1a0d6b,_0x356665));}return BPromise[_0x4629('0x3c')](_0x4f567f,function(_0x92b4c4){_0x2ff3c8['push'](_0x92b4c4);})[_0x4629('0x2f')](function(){var _0x32329c=[];for(var _0x110f8=0x0;_0x110f8<_0x2ff3c8[_0x4629('0x16')];_0x110f8+=0x1){var _0x27eee6=_0x2ff3c8[_0x110f8];var _0x58314d=createTables(_[_0x4629('0x3d')](_0x27eee6));var _0x2a4a63;var _0x5c5ad7=getPDFDocDefinition(_0x58314d);var _0x40f29a=getPDFPrinter();var _0x3e4c5d=_0x40f29a[_0x4629('0x3e')](_0x5c5ad7);if(_0x17b232){_0x2a4a63=path[_0x4629('0x3a')](_0x1a0d6b,_0x356665,util[_0x4629('0x22')](_0x4629('0x3f'),_0x356665,_0x110f8,'pdf'));}else{_0x2a4a63=path[_0x4629('0x3a')](_0x1a0d6b,util[_0x4629('0x22')](_0x4629('0x40'),_0x356665,'pdf'));}_0x32329c[_0x4629('0x1d')](writePDFDocument(_0x3e4c5d,_0x2a4a63));}return Promise[_0x4629('0x41')](_0x32329c);})[_0x4629('0x2f')](function(){if(_0x17b232){return new Promise(function(_0x4239ed){zipdir(path[_0x4629('0x3a')](_0x1a0d6b,_0x356665),{'saveTo':path[_0x4629('0x3a')](_0x1a0d6b,util[_0x4629('0x22')](_0x4629('0x40'),_0x356665,_0x4629('0x42')))},function(){rimraf(path['join'](_0x1a0d6b,_0x356665),function(){});_0x4239ed(_0x4629('0x43'));});});}})[_0x4629('0x2f')](function(){if(!_0x17b232)return;rimraf(path[_0x4629('0x3a')](_0x1a0d6b,_0x356665),function(){});})[_0x4629('0x2f')](function(){logger['info'](util[_0x4629('0x22')](_0x4629('0x44'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x4629('0x45'),_0x17b232?util[_0x4629('0x22')](_0x4629('0x40'),_0x356665,_0x17b232?'zip':_0x4629('0x46')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x4629('0x47')](util[_0x4629('0x22')](_0x4629('0x48'),EXTRACTED_REPORT_ID,_0x4629('0x49')));return db[_0x4629('0xf')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x4629('0x2f')](function(_0x5bc293){EXTRACTED_REPORT=_0x5bc293;return dbH[_0x4629('0x33')][_0x4629('0x34')](util[_0x4629('0x22')](_0x4629('0x4a'),QUERY),{'type':dbH['sequelize'][_0x4629('0x37')]['SELECT']});})[_0x4629('0x2f')](extractReport)[_0x4629('0x4b')](function(_0x37c85a){logger[_0x4629('0x47')](util['format'](_0x4629('0x4c'),EXTRACTED_REPORT_ID,_0x4629('0x49')),util[_0x4629('0x4d')](_0x37c85a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4629('0x4e')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2ee741=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x4629('0x4f'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x4629('0x50')}});return _0x2ee741;}function getPDFDocDefinitionFromHTML(_0x2beec4,_0x465256){var _0x3f127a=util[_0x4629('0x22')](_0x4629('0x51'),_0x465256[_0x4629('0x52')],_0x465256[_0x4629('0x53')]);var _0x3c4d68=moment()['format'](_0x4629('0x54'))[_0x4629('0x13')]();var _0x2ce16d=htmlToPdfmake(_0x2beec4,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2ce16d],'defaultStyle':{'font':_0x4629('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x4629('0x55')}},'header':function(){return[{'text':_0x4629('0x56'),'style':_0x4629('0x23')}];},'footer':function(_0x339f7e,_0x3f7b98){return[{'text':util['format'](_0x4629('0x57'),_0x3f127a,_0x339f7e,_0x3f7b98,_0x3c4d68),'style':'footer'}];}};}function writePDFDocument(_0x15f77d,_0x1a1b8b){return new Promise(function(_0x2937a6,_0x1073bb){var _0x55a642=_0x15f77d[_0x4629('0x58')](fs[_0x4629('0x59')](_0x1a1b8b));_0x55a642['on'](_0x4629('0x5a'),function(){_0x2937a6(_0x4629('0x5a'));});_0x55a642['on'](_0x4629('0x5b'),function(_0x306def){_0x1073bb(_0x306def);});_0x15f77d[_0x4629('0x5c')]();});}exports[_0x4629('0x5d')]=function(_0xf5b5a8,_0x437dff){var _0x1539c5=getPDFPrinter();var _0x14e4f8=getPDFDocDefinitionFromHTML(_0xf5b5a8,_0x437dff);var _0x5b89ec=_0x1539c5[_0x4629('0x3e')](_0x14e4f8);return writePDFDocument(_0x5b89ec,_0x437dff[_0x4629('0x5e')])[_0x4629('0x4b')](function(_0x4c9be6){throw _0x4c9be6;});}; \ No newline at end of file +var _0x7be7=['Empty','Setting','find','split','splitSizePdf','then','range','num','isInteger','forEach','sequelize','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','query','QueryTypes','dirname','basename','.pdf','existsSync','join','mkdirSync','each','createPdfKitDocument','%s%d.%s','%s.%s','all','zip','info','PDF','Completed','pdf','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','center','Interaction\x20Transcript','pipe','finish','error','end','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','value','fill','length','auto','body','push','concat','chunk','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','format','endDate','header','pageBreak','margin','landscape','\x20/\x20','footer','Arial','black','right'];(function(_0x4673d4,_0x3d2597){var _0x41a926=function(_0x43ef5e){while(--_0x43ef5e){_0x4673d4['push'](_0x4673d4['shift']());}};_0x41a926(++_0x3d2597);}(_0x7be7,0x19b));var _0x77be=function(_0x658218,_0x5d42ab){_0x658218=_0x658218-0x0;var _0x5541e6=_0x7be7[_0x658218];return _0x5541e6;};'use strict';var _=require(_0x77be('0x0'));var fs=require('fs');var util=require(_0x77be('0x1'));var path=require(_0x77be('0x2'));var moment=require(_0x77be('0x3'));var htmlToPdfmake=require(_0x77be('0x4'));var PdfPrinter=require(_0x77be('0x5'));var zipdir=require('zip-dir');var rimraf=require(_0x77be('0x6'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0x77be('0x7')];var BPromise=require(_0x77be('0x8'));var db=require(_0x77be('0x9'))['db'];var dbH=require('../../mysqldb')[_0x77be('0xa')];var logger=require(_0x77be('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x77be('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x77be('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x20b234,_0x5e173a){var _0x5400b5={'status':_0x20b234};var _0x2cd392={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5e173a){_0x5400b5[_0x77be('0xe')]=_0x5e173a;}return db[_0x77be('0xf')]['update'](_0x5400b5,_0x2cd392);}function getHeaders(_0x3a59c6){return _[_0x77be('0x10')](_0x3a59c6,function(_0x343a94){return{'text':_0x343a94,'style':_0x77be('0x11')};});}function getRows(_0xbe3f46,_0x684d79){return _[_0x77be('0x10')](_0x684d79,function(_0x149fd5){return _(_0x149fd5)['pick'](_0xbe3f46)[_0x77be('0x10')](function(_0x25e0de){return _0x25e0de?_['toString'](_0x25e0de):'';})[_0x77be('0x12')]();});}function createTable(_0x4810bc,_0x151fee){var _0x1cb9a1={'widths':_[_0x77be('0x13')](Array(_0x4810bc[_0x77be('0x14')]),0x91),'heights':function(_0x4eab13){return _0x4eab13===0x0?_0x77be('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xac76cc=getHeaders(_0x4810bc);_0x1cb9a1[_0x77be('0x16')][_0x77be('0x17')](_0xac76cc);var _0x221bb8=getRows(_0x4810bc,_0x151fee);_0x1cb9a1[_0x77be('0x16')]=_0x1cb9a1[_0x77be('0x16')][_0x77be('0x18')](_0x221bb8);return _0x1cb9a1;}function createTables(_0x4ba4fd){var _0x147382=[];var _0x172d7b=_[_0x77be('0x19')](Object['keys'](_0x4ba4fd[0x0]),0x5);_0x172d7b['forEach'](function(_0x161b59){_0x147382['push'](createTable(_0x161b59,_0x4ba4fd));});return _0x147382;}function getPDFDocDefinition(_0x54b857){var _0x25dbd0=util['format'](_0x77be('0x1a'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x77be('0x1b')])[_0x77be('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x77be('0x1d')])[_0x77be('0x1c')](FORMAT));var _0x16aba5=[];for(var _0x1d1b5a=0x0;_0x1d1b5a<_0x54b857[_0x77be('0x14')];_0x1d1b5a++){var _0x396131=[];if(_0x1d1b5a===0x0){_0x396131[_0x77be('0x17')]({'text':_0x25dbd0,'style':_0x77be('0x1e')});}var _0x347cb9={'table':_0x54b857[_0x1d1b5a]};if(_0x1d1b5a>0x0){_0x347cb9[_0x77be('0x1f')]='before';_0x347cb9[_0x77be('0x20')]=[0x0,0x46,0x0,0x0];}_0x396131['push'](_0x347cb9);_0x16aba5[_0x77be('0x17')](_0x396131);}return{'pageSize':'A4','pageOrientation':_0x77be('0x21'),'content':_0x16aba5,'footer':function(_0x58d1b3,_0x26d437){return{'text':_0x58d1b3['toString']()+_0x77be('0x22')+_0x26d437,'style':_0x77be('0x23')};},'defaultStyle':{'font':_0x77be('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x77be('0x25')},'footer':{'alignment':_0x77be('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x8bc5df){var _0x615802=0x1388;var _0xbc20f4;if(!_0x8bc5df[0x0]['num']){return analyticExtractedReport(_0x77be('0x27'));}return db[_0x77be('0x28')][_0x77be('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x77be('0x2a'),_0x77be('0x2b')]})[_0x77be('0x2c')](function(_0x5975aa){if(_0x5975aa){_0xbc20f4=_0x5975aa;_0x615802=_0xbc20f4['splitSizePdf']||0x3e8;}})[_0x77be('0x2c')](function(){var _0x5e0561=[];var _0x3217dd=0x0;if(_0xbc20f4[_0x77be('0x2a')]){if(_0x8bc5df&&_0x8bc5df['length']){var _0x5dabc1=_[_0x77be('0x2d')](_0x8bc5df[0x0][_0x77be('0x2e')]/_0x615802);var _0x43b2ef=Number[_0x77be('0x2f')](_0x8bc5df[0x0][_0x77be('0x2e')]/_0x615802)?_0x8bc5df[0x0][_0x77be('0x2e')]%_0x615802:0x0;_0x5dabc1[_0x77be('0x30')](function(_0x18bef3){if(_0x18bef3>0x0){_0x3217dd+=_0x615802;}_0x5e0561['push'](dbH[_0x77be('0x31')]['query'](util[_0x77be('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x615802,_0x3217dd),{'type':dbH[_0x77be('0x31')]['QueryTypes'][_0x77be('0x32')]}));});if(_0x43b2ef>0x0){_0x3217dd+=_0x615802;_0x5e0561[_0x77be('0x17')](dbH[_0x77be('0x31')]['query'](util[_0x77be('0x1c')](_0x77be('0x33'),QUERY,_0x43b2ef,_0x3217dd),{'type':dbH['sequelize']['QueryTypes'][_0x77be('0x32')]}));}}}else{_0x5e0561[_0x77be('0x17')](dbH[_0x77be('0x31')][_0x77be('0x34')](QUERY,{'type':dbH[_0x77be('0x31')][_0x77be('0x35')][_0x77be('0x32')]}));}var _0xb098bd=path[_0x77be('0x36')](PATH);var _0x5db7c6=path[_0x77be('0x37')](PATH,_0x77be('0x38'));var _0x44ce7a=_0xbc20f4[_0x77be('0x2a')]&&_0x5e0561[_0x77be('0x14')]>0x1;var _0x12d224=[];if(!fs[_0x77be('0x39')](path[_0x77be('0x3a')](_0xb098bd,_0x5db7c6))&&_0x44ce7a){fs[_0x77be('0x3b')](path[_0x77be('0x3a')](_0xb098bd,_0x5db7c6));}return BPromise[_0x77be('0x3c')](_0x5e0561,function(_0x1f1c0b){_0x12d224[_0x77be('0x17')](_0x1f1c0b);})[_0x77be('0x2c')](function(){var _0x1a4b87=[];for(var _0x3a9706=0x0;_0x3a9706<_0x12d224[_0x77be('0x14')];_0x3a9706+=0x1){var _0x284cd7=_0x12d224[_0x3a9706];var _0x4db94c=createTables(_['flatten'](_0x284cd7));var _0x172af9;var _0x4c65d6=getPDFDocDefinition(_0x4db94c);var _0x317ff4=getPDFPrinter();var _0x28653a=_0x317ff4[_0x77be('0x3d')](_0x4c65d6);if(_0x44ce7a){_0x172af9=path[_0x77be('0x3a')](_0xb098bd,_0x5db7c6,util['format'](_0x77be('0x3e'),_0x5db7c6,_0x3a9706,'pdf'));}else{_0x172af9=path[_0x77be('0x3a')](_0xb098bd,util[_0x77be('0x1c')](_0x77be('0x3f'),_0x5db7c6,'pdf'));}_0x1a4b87[_0x77be('0x17')](writePDFDocument(_0x28653a,_0x172af9));}return Promise[_0x77be('0x40')](_0x1a4b87);})[_0x77be('0x2c')](function(){if(_0x44ce7a){return new Promise(function(_0x5c2204){zipdir(path[_0x77be('0x3a')](_0xb098bd,_0x5db7c6),{'saveTo':path[_0x77be('0x3a')](_0xb098bd,util[_0x77be('0x1c')]('%s.%s',_0x5db7c6,_0x77be('0x41')))},function(){rimraf(path[_0x77be('0x3a')](_0xb098bd,_0x5db7c6),function(){});_0x5c2204('zip\x20finished');});});}})[_0x77be('0x2c')](function(){if(!_0x44ce7a)return;rimraf(path[_0x77be('0x3a')](_0xb098bd,_0x5db7c6),function(){});})[_0x77be('0x2c')](function(){logger[_0x77be('0x42')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x77be('0x43')));return analyticExtractedReport(_0x77be('0x44'),_0x44ce7a?util[_0x77be('0x1c')]('%s.%s',_0x5db7c6,_0x44ce7a?_0x77be('0x41'):_0x77be('0x45')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x77be('0x42')](util[_0x77be('0x1c')](_0x77be('0x46'),EXTRACTED_REPORT_ID,_0x77be('0x43')));return db[_0x77be('0xf')][_0x77be('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x77be('0x2c')](function(_0x2b24be){EXTRACTED_REPORT=_0x2b24be;return dbH[_0x77be('0x31')]['query'](util['format'](_0x77be('0x48'),QUERY),{'type':dbH[_0x77be('0x31')][_0x77be('0x35')]['SELECT']});})[_0x77be('0x2c')](extractReport)[_0x77be('0x49')](function(_0x28bc34){logger[_0x77be('0x42')](util[_0x77be('0x1c')](_0x77be('0x4a'),EXTRACTED_REPORT_ID,_0x77be('0x43')),util['inspect'](_0x28bc34,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x77be('0x4b'));})[_0x77be('0x4c')](function(){process[_0x77be('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2118b9=new PdfPrinter({'Arial':{'normal':__dirname+_0x77be('0x4e'),'bold':__dirname+_0x77be('0x4f'),'italics':__dirname+_0x77be('0x50'),'bolditalics':__dirname+_0x77be('0x51')}});return _0x2118b9;}function getPDFDocDefinitionFromHTML(_0x1f7c58,_0x513231){var _0x1e5f23=util['format'](_0x77be('0x52'),_0x513231['channel'],_0x513231[_0x77be('0x53')]);var _0x168d51=moment()[_0x77be('0x1c')]('YYYY-MM-DD')['toString']();var _0x46c010=htmlToPdfmake(_0x1f7c58,{'window':window,'tableAutoSize':!![]});return{'content':[_0x46c010],'defaultStyle':{'font':_0x77be('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x77be('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x77be('0x55'),'style':'header'}];},'footer':function(_0x438e2a,_0x5ee98c){return[{'text':util[_0x77be('0x1c')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x1e5f23,_0x438e2a,_0x5ee98c,_0x168d51),'style':_0x77be('0x23')}];}};}function writePDFDocument(_0x163ce4,_0x5f319b){return new Promise(function(_0x186d2c,_0x40ed91){var _0x33033e=_0x163ce4[_0x77be('0x56')](fs['createWriteStream'](_0x5f319b));_0x33033e['on'](_0x77be('0x57'),function(){_0x186d2c(_0x77be('0x57'));});_0x33033e['on'](_0x77be('0x58'),function(_0x350f4e){_0x40ed91(_0x350f4e);});_0x163ce4[_0x77be('0x59')]();});}exports['createPdfFromHTML']=function(_0x52e0b4,_0x5ca465){var _0x1eec5d=getPDFPrinter();var _0x275f8f=getPDFDocDefinitionFromHTML(_0x52e0b4,_0x5ca465);var _0x1aede8=_0x1eec5d[_0x77be('0x3d')](_0x275f8f);return writePDFDocument(_0x1aede8,_0x5ca465[_0x77be('0x2')])[_0x77be('0x49')](function(_0x5cbf9b){throw _0x5cbf9b;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index cc0d471..c59610f 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 _0x4dc5=['analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','sequelize','QueryTypes','num','Empty','length','range','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','existsSync','join','each','%s%d.%s','xlsx','%s.%s','binary','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger'];(function(_0x37a405,_0x2c1e0e){var _0x2724ff=function(_0xf4b0dd){while(--_0xf4b0dd){_0x37a405['push'](_0x37a405['shift']());}};_0x2724ff(++_0x2c1e0e);}(_0x4dc5,0x96));var _0x54dc=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x4dc5[_0xc4001c];return _0x49f7bc;};'use strict';var util=require('util');var path=require(_0x54dc('0x0'));var _=require(_0x54dc('0x1'));var fs=require('fs');var json2xls=require(_0x54dc('0x2'));var BPromise=require(_0x54dc('0x3'));var zipdir=require(_0x54dc('0x4'));var rimraf=require(_0x54dc('0x5'));var db=require(_0x54dc('0x6'))['db'];var dbH=require(_0x54dc('0x6'))[_0x54dc('0x7')];var logger=require(_0x54dc('0x8'))(_0x54dc('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x54dc('0xa')][0x2]);var QUERY=process[_0x54dc('0xa')][0x3];var PATH=process[_0x54dc('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x391dc6,_0x208b8d){var _0x303743={'status':_0x391dc6};var _0x53348d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x208b8d){_0x303743[_0x54dc('0xb')]=_0x208b8d;}return db[_0x54dc('0xc')][_0x54dc('0xd')](_0x303743,_0x53348d);}function main(){var _0x1edcc9=0x1388;var _0x26b585;logger[_0x54dc('0xe')](util[_0x54dc('0xf')](_0x54dc('0x10'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x54dc('0x11')][_0x54dc('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x54dc('0x13'),_0x54dc('0x14')]})[_0x54dc('0x15')](function(_0x5ac423){if(_0x5ac423){_0x26b585=_0x5ac423;_0x1edcc9=_0x26b585[_0x54dc('0x14')]||0x1388;}})['then'](function(){return dbH[_0x54dc('0x16')]['query'](util[_0x54dc('0xf')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x54dc('0x16')][_0x54dc('0x17')]['SELECT']});})['then'](function(_0x28799f){if(!_0x28799f[0x0][_0x54dc('0x18')]){return analyticExtractedReport(_0x54dc('0x19'));}var _0x38361f=[];var _0x13010a=0x0;if(_0x26b585[_0x54dc('0x13')]){if(_0x28799f&&_0x28799f[_0x54dc('0x1a')]){var _0x168674=_[_0x54dc('0x1b')](_0x28799f[0x0][_0x54dc('0x18')]/_0x1edcc9);var _0x281944=Number[_0x54dc('0x1c')](_0x28799f[0x0][_0x54dc('0x18')]/_0x1edcc9)?_0x28799f[0x0][_0x54dc('0x18')]%_0x1edcc9:0x0;_0x168674[_0x54dc('0x1d')](function(_0x56313c){if(_0x56313c>0x0){_0x13010a+=_0x1edcc9;}_0x38361f[_0x54dc('0x1e')](dbH[_0x54dc('0x16')][_0x54dc('0x1f')](util[_0x54dc('0xf')](_0x54dc('0x20'),QUERY,_0x1edcc9,_0x13010a),{'type':dbH[_0x54dc('0x16')][_0x54dc('0x17')][_0x54dc('0x21')]}));});if(_0x281944>0x0){_0x13010a+=_0x1edcc9;_0x38361f['push'](dbH[_0x54dc('0x16')][_0x54dc('0x1f')](util[_0x54dc('0xf')](_0x54dc('0x20'),QUERY,_0x281944,_0x13010a),{'type':dbH[_0x54dc('0x16')][_0x54dc('0x17')][_0x54dc('0x21')]}));}}}else{_0x38361f[_0x54dc('0x1e')](dbH[_0x54dc('0x16')]['query'](QUERY,{'type':dbH[_0x54dc('0x16')]['QueryTypes'][_0x54dc('0x21')]}));}var _0x148a69=path[_0x54dc('0x22')](PATH);var _0xd95d84=path[_0x54dc('0x23')](PATH,_0x54dc('0x24'));var _0x3e6455=_0x26b585['split']&&_0x38361f[_0x54dc('0x1a')]>0x1;var _0x45d892=[];if(!fs[_0x54dc('0x25')](path[_0x54dc('0x26')](_0x148a69,_0xd95d84))&&_0x3e6455){fs['mkdirSync'](path[_0x54dc('0x26')](_0x148a69,_0xd95d84));}return BPromise[_0x54dc('0x27')](_0x38361f,function(_0xe49eb2){_0x45d892[_0x54dc('0x1e')](_0xe49eb2);})['then'](function(){for(var _0x14a108=0x0;_0x14a108<_0x45d892[_0x54dc('0x1a')];_0x14a108+=0x1){var _0x4bb229;var _0x1f8285=_0x45d892[_0x14a108];if(_0x3e6455){_0x4bb229=path[_0x54dc('0x26')](_0x148a69,_0xd95d84,util[_0x54dc('0xf')](_0x54dc('0x28'),_0xd95d84,_0x14a108,_0x54dc('0x29')));}else{_0x4bb229=path[_0x54dc('0x26')](_0x148a69,util[_0x54dc('0xf')](_0x54dc('0x2a'),_0xd95d84,'xlsx'));}fs['writeFileSync'](_0x4bb229,json2xls(_0x1f8285),_0x54dc('0x2b'));}})[_0x54dc('0x15')](function(){if(_0x3e6455){return new Promise(function(_0x4dba2e){zipdir(path['join'](_0x148a69,_0xd95d84),{'saveTo':path[_0x54dc('0x26')](_0x148a69,util[_0x54dc('0xf')](_0x54dc('0x2a'),_0xd95d84,_0x54dc('0x2c')))},function(_0x5a6d30,_0x99f41e){rimraf(path[_0x54dc('0x26')](_0x148a69,_0xd95d84),function(){});_0x4dba2e(_0x54dc('0x2d'));});});}})[_0x54dc('0x15')](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x54dc('0x2e'),_0x3e6455?util[_0x54dc('0xf')](_0x54dc('0x2a'),_0xd95d84,_0x3e6455?_0x54dc('0x2c'):_0x54dc('0x29')):null);});})[_0x54dc('0x2f')](function(_0xe6cbb3){logger[_0x54dc('0xe')](util['format'](_0x54dc('0x30'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x54dc('0x31')](_0xe6cbb3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x54dc('0x32'));})[_0x54dc('0x33')](function(){process[_0x54dc('0x34')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xd1fb=['join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','writeFileSync','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','length','range','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','.xlsx','existsSync'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0xd1fb,0xa2));var _0xbd1f=function(_0x54d267,_0x57d7fc){_0x54d267=_0x54d267-0x0;var _0x4c0b1b=_0xd1fb[_0x54d267];return _0x4c0b1b;};'use strict';var util=require(_0xbd1f('0x0'));var path=require(_0xbd1f('0x1'));var _=require(_0xbd1f('0x2'));var fs=require('fs');var json2xls=require(_0xbd1f('0x3'));var BPromise=require(_0xbd1f('0x4'));var zipdir=require(_0xbd1f('0x5'));var rimraf=require(_0xbd1f('0x6'));var db=require(_0xbd1f('0x7'))['db'];var dbH=require(_0xbd1f('0x7'))[_0xbd1f('0x8')];var logger=require('../../config/logger')(_0xbd1f('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xbd1f('0xa')][0x2]);var QUERY=process[_0xbd1f('0xa')][0x3];var PATH=process[_0xbd1f('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xbaf62b,_0xace629){var _0x5cc94f={'status':_0xbaf62b};var _0x933b50={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xace629){_0x5cc94f[_0xbd1f('0xb')]=_0xace629;}return db[_0xbd1f('0xc')][_0xbd1f('0xd')](_0x5cc94f,_0x933b50);}function main(){var _0x10536f=0x1388;var _0x3cacee;logger['info'](util['format'](_0xbd1f('0xe'),EXTRACTED_REPORT_ID,_0xbd1f('0xf')));return db[_0xbd1f('0x10')][_0xbd1f('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbd1f('0x12'),_0xbd1f('0x13')]})[_0xbd1f('0x14')](function(_0x3e1238){if(_0x3e1238){_0x3cacee=_0x3e1238;_0x10536f=_0x3cacee[_0xbd1f('0x13')]||0x1388;}})[_0xbd1f('0x14')](function(){return dbH[_0xbd1f('0x15')][_0xbd1f('0x16')](util[_0xbd1f('0x17')](_0xbd1f('0x18'),QUERY),{'type':dbH[_0xbd1f('0x15')]['QueryTypes']['SELECT']});})[_0xbd1f('0x14')](function(_0x1c7c53){if(!_0x1c7c53[0x0][_0xbd1f('0x19')]){return analyticExtractedReport('Empty');}var _0x452931=[];var _0x382251=0x0;if(_0x3cacee[_0xbd1f('0x12')]){if(_0x1c7c53&&_0x1c7c53[_0xbd1f('0x1a')]){var _0x31233c=_[_0xbd1f('0x1b')](_0x1c7c53[0x0][_0xbd1f('0x19')]/_0x10536f);var _0x1465e5=Number['isInteger'](_0x1c7c53[0x0][_0xbd1f('0x19')]/_0x10536f)?_0x1c7c53[0x0][_0xbd1f('0x19')]%_0x10536f:0x0;_0x31233c['forEach'](function(_0xc46665){if(_0xc46665>0x0){_0x382251+=_0x10536f;}_0x452931[_0xbd1f('0x1c')](dbH[_0xbd1f('0x15')]['query'](util[_0xbd1f('0x17')](_0xbd1f('0x1d'),QUERY,_0x10536f,_0x382251),{'type':dbH[_0xbd1f('0x15')]['QueryTypes'][_0xbd1f('0x1e')]}));});if(_0x1465e5>0x0){_0x382251+=_0x10536f;_0x452931['push'](dbH[_0xbd1f('0x15')]['query'](util[_0xbd1f('0x17')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1465e5,_0x382251),{'type':dbH[_0xbd1f('0x15')][_0xbd1f('0x1f')][_0xbd1f('0x1e')]}));}}}else{_0x452931['push'](dbH[_0xbd1f('0x15')][_0xbd1f('0x16')](QUERY,{'type':dbH[_0xbd1f('0x15')]['QueryTypes'][_0xbd1f('0x1e')]}));}var _0x4d9dc8=path['dirname'](PATH);var _0x3bca7b=path['basename'](PATH,_0xbd1f('0x20'));var _0x268548=_0x3cacee['split']&&_0x452931['length']>0x1;var _0x2721bb=[];if(!fs[_0xbd1f('0x21')](path[_0xbd1f('0x22')](_0x4d9dc8,_0x3bca7b))&&_0x268548){fs[_0xbd1f('0x23')](path[_0xbd1f('0x22')](_0x4d9dc8,_0x3bca7b));}return BPromise[_0xbd1f('0x24')](_0x452931,function(_0x1a0ac5){_0x2721bb[_0xbd1f('0x1c')](_0x1a0ac5);})[_0xbd1f('0x14')](function(){for(var _0x47f7b7=0x0;_0x47f7b7<_0x2721bb['length'];_0x47f7b7+=0x1){var _0x184200;var _0x455bea=_0x2721bb[_0x47f7b7];if(_0x268548){_0x184200=path[_0xbd1f('0x22')](_0x4d9dc8,_0x3bca7b,util[_0xbd1f('0x17')](_0xbd1f('0x25'),_0x3bca7b,_0x47f7b7,'xlsx'));}else{_0x184200=path[_0xbd1f('0x22')](_0x4d9dc8,util[_0xbd1f('0x17')](_0xbd1f('0x26'),_0x3bca7b,_0xbd1f('0x27')));}fs[_0xbd1f('0x28')](_0x184200,json2xls(_0x455bea),'binary');}})[_0xbd1f('0x14')](function(){if(_0x268548){return new Promise(function(_0x19f48a){zipdir(path[_0xbd1f('0x22')](_0x4d9dc8,_0x3bca7b),{'saveTo':path[_0xbd1f('0x22')](_0x4d9dc8,util['format'](_0xbd1f('0x26'),_0x3bca7b,_0xbd1f('0x29')))},function(_0x17d96a,_0x126621){rimraf(path[_0xbd1f('0x22')](_0x4d9dc8,_0x3bca7b),function(){});_0x19f48a(_0xbd1f('0x2a'));});});}})['then'](function(){logger[_0xbd1f('0x2b')](util['format'](_0xbd1f('0x2c'),EXTRACTED_REPORT_ID,_0xbd1f('0xf')));return analyticExtractedReport(_0xbd1f('0x2d'),_0x268548?util[_0xbd1f('0x17')](_0xbd1f('0x26'),_0x3bca7b,_0x268548?'zip':_0xbd1f('0x27')):null);});})['catch'](function(_0x362e2a){logger['info'](util['format'](_0xbd1f('0x2e'),EXTRACTED_REPORT_ID,_0xbd1f('0xf')),util['inspect'](_0x362e2a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbd1f('0x2f'));})['finally'](function(){process[_0xbd1f('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 8cd9aac..c431e3e 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 _0x979c=['updatedAt','interval','IntervalId','map','tag','CDR(tag)=','callerID','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','rewrite','lodash','util','Interval','findAll','then','intervals','models','VoiceExtension','uniq','exten','filter','groupBy','queue','hasOwnProperty','priority','extensions','extension','find','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','inbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt'];(function(_0x1fd70b,_0x8e1724){var _0x443de6=function(_0x3d21f6){while(--_0x3d21f6){_0x1fd70b['push'](_0x1fd70b['shift']());}};_0x443de6(++_0x8e1724);}(_0x979c,0x1c5));var _0xc979=function(_0x30c2ed,_0x5e9654){_0x30c2ed=_0x30c2ed-0x0;var _0x4990f8=_0x979c[_0x30c2ed];return _0x4990f8;};'use strict';var _=require(_0xc979('0x0'));var util=require(_0xc979('0x1'));function rewrite(_0x55e7ec,_0x5f08e6){var _0x5e0451=this;return _0x55e7ec['models'][_0xc979('0x2')][_0xc979('0x3')]({'raw':!![]})[_0xc979('0x4')](function(_0x38fa1f){_0x5e0451[_0xc979('0x5')]=_0x38fa1f;return _0x55e7ec[_0xc979('0x6')][_0xc979('0x7')][_0xc979('0x3')]({'where':{'IntervalId':_0x5f08e6['IntervalId']},'raw':!![]});})['then'](function(_0x138ddc){return _0x55e7ec[_0xc979('0x6')]['VoiceExtension'][_0xc979('0x3')]({'where':{'exten':{'$in':_[_0xc979('0x8')](_['map'](_0x138ddc,_0xc979('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xc979('0x4')](function(_0x23b357){var _0x42ee9d=_[_0xc979('0xa')](_0x23b357,{'priority':'1'});var _0x3fbc53=_['filter'](_0x23b357,{'isApp':0x1});var _0x150422=_[_0xc979('0xb')](_0x3fbc53,_0xc979('0x9'));var _0x4e2729=[_0xc979('0xc'),'playback'];var _0x159d4d=[];var _0x4d6b17=[];for(var _0x52e5d7 in _0x150422){if(_0x150422[_0xc979('0xd')](_0x52e5d7)){_0x5e0451[_0xc979('0xe')]=0x2;_0x5e0451[_0xc979('0xf')]=[];_0x5e0451[_0xc979('0x10')]=_[_0xc979('0x11')](_0x42ee9d,{'exten':_0x150422[_0x52e5d7][0x0]['exten']});_0x5e0451[_0xc979('0xf')][_0xc979('0x12')]({'type':_0x150422[_0x52e5d7][0x0][_0xc979('0x13')],'app':_0xc979('0x14'),'appdata':util['format'](_0xc979('0x15'),_0x150422[_0x52e5d7][0x0]['type']),'context':_0x150422[_0x52e5d7][0x0][_0xc979('0x16')],'exten':_0x150422[_0x52e5d7][0x0][_0xc979('0x9')],'priority':_0x5e0451[_0xc979('0xe')]++,'VoiceExtensionId':_0x150422[_0x52e5d7][0x0][_0xc979('0x17')]});if(_0x150422[_0x52e5d7][0x0][_0xc979('0x13')]===_0xc979('0x18')){_0x5e0451[_0xc979('0xf')][_0xc979('0x12')]({'type':_0x150422[_0x52e5d7][0x0][_0xc979('0x13')],'app':_0xc979('0x14'),'appdata':'CDR(routeid)='+_0x150422[_0x52e5d7][0x0][_0xc979('0x17')],'context':_0x150422[_0x52e5d7][0x0][_0xc979('0x16')],'exten':_0x150422[_0x52e5d7][0x0][_0xc979('0x9')],'priority':_0x5e0451['priority']++,'VoiceExtensionId':_0x150422[_0x52e5d7][0x0][_0xc979('0x17')]});}else if(_0x150422[_0x52e5d7][0x0]['type']===_0xc979('0x19')){if(_0x5e0451[_0xc979('0x10')]){_0x5e0451[_0xc979('0xf')][_0xc979('0x12')]({'type':_0x150422[_0x52e5d7][0x0]['type'],'app':_0xc979('0x14'),'appdata':_0xc979('0x1a')+(_0x5e0451[_0xc979('0x10')][_0xc979('0x1b')]?_0xc979('0x1c')+_0x5e0451['extension'][_0xc979('0x1b')]+'}':_0xc979('0x1d')),'context':_0x150422[_0x52e5d7][0x0][_0xc979('0x16')],'exten':_0x150422[_0x52e5d7][0x0][_0xc979('0x9')],'priority':_0x5e0451[_0xc979('0xe')]++,'VoiceExtensionId':_0x150422[_0x52e5d7][0x0][_0xc979('0x17')]});}_0x5e0451[_0xc979('0xf')]['push']({'type':_0x150422[_0x52e5d7][0x0][_0xc979('0x13')],'app':_0xc979('0x14'),'appdata':_0xc979('0x1e')+_0x150422[_0x52e5d7][0x0][_0xc979('0x17')],'context':_0x150422[_0x52e5d7][0x0][_0xc979('0x16')],'exten':_0x150422[_0x52e5d7][0x0][_0xc979('0x9')],'priority':_0x5e0451[_0xc979('0xe')]++,'VoiceExtensionId':_0x150422[_0x52e5d7][0x0][_0xc979('0x17')]});var _0x3d612a=_0x5e0451[_0xc979('0xe')]++;_0x5e0451[_0xc979('0xf')][_0xc979('0x12')]({'type':_0x150422[_0x52e5d7][0x0][_0xc979('0x13')],'app':_0xc979('0x1f'),'appdata':_0xc979('0x20')+(_0x3d612a+0x2)+_0xc979('0x21')+(_0x3d612a+0x1)+')','context':_0x150422[_0x52e5d7][0x0][_0xc979('0x16')],'exten':_0x150422[_0x52e5d7][0x0][_0xc979('0x9')],'priority':_0x3d612a,'VoiceExtensionId':_0x150422[_0x52e5d7][0x0]['VoiceExtensionId']});if(_0x5e0451[_0xc979('0x10')]){_0x5e0451['extensions'][_0xc979('0x12')]({'type':_0x150422[_0x52e5d7][0x0][_0xc979('0x13')],'app':_0xc979('0x14'),'appdata':_0x5e0451['extension'][_0xc979('0x1b')]?'CDR(prefix)=${EXTEN:0:'+_0x5e0451['extension'][_0xc979('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x150422[_0x52e5d7][0x0][_0xc979('0x16')],'exten':_0x150422[_0x52e5d7][0x0][_0xc979('0x9')],'priority':_0x5e0451[_0xc979('0xe')]++,'VoiceExtensionId':_0x150422[_0x52e5d7][0x0][_0xc979('0x17')]});}_0x5e0451['extensions'][_0xc979('0x12')]({'type':_0x150422[_0x52e5d7][0x0]['type'],'app':_0xc979('0x14'),'appdata':_0xc979('0x22')+_0x150422[_0x52e5d7][0x0][_0xc979('0x17')],'context':_0x150422[_0x52e5d7][0x0][_0xc979('0x16')],'exten':_0x150422[_0x52e5d7][0x0]['exten'],'priority':_0x5e0451[_0xc979('0xe')]++,'VoiceExtensionId':_0x150422[_0x52e5d7][0x0]['VoiceExtensionId']});if(_0x5e0451[_0xc979('0x10')]&&_0x5e0451[_0xc979('0x10')][_0xc979('0xd')](_0xc979('0x23'))&&_0x5e0451['extension'][_0xc979('0x23')]!==_0xc979('0x24')){_0x5e0451[_0xc979('0xf')][_0xc979('0x12')]({'type':_0x150422[_0x52e5d7][0x0][_0xc979('0x13')],'app':_0xc979('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x150422[_0x52e5d7][0x0][_0xc979('0x16')],'exten':_0x150422[_0x52e5d7][0x0]['exten'],'priority':_0x5e0451[_0xc979('0xe')]++,'VoiceExtensionId':_0x150422[_0x52e5d7][0x0][_0xc979('0x17')]});_0x5e0451[_0xc979('0xf')][_0xc979('0x12')]({'type':_0x150422[_0x52e5d7][0x0][_0xc979('0x13')],'app':_0xc979('0x14'),'appdata':_0xc979('0x25')+_0x5e0451[_0xc979('0x10')][_0xc979('0x23')]||_0xc979('0x26'),'context':_0x150422[_0x52e5d7][0x0]['context'],'exten':_0x150422[_0x52e5d7][0x0][_0xc979('0x9')],'priority':_0x5e0451[_0xc979('0xe')]++,'VoiceExtensionId':_0x150422[_0x52e5d7][0x0]['VoiceExtensionId']});}}_0x5e0451['extensions'][_0xc979('0x12')]({'type':_0x150422[_0x52e5d7][0x0]['type'],'app':'Set','appdata':_0xc979('0x27'),'context':_0x150422[_0x52e5d7][0x0][_0xc979('0x16')],'exten':_0x150422[_0x52e5d7][0x0][_0xc979('0x9')],'priority':_0x5e0451['priority']++,'VoiceExtensionId':_0x150422[_0x52e5d7][0x0][_0xc979('0x17')]});_0x5e0451[_0xc979('0xf')]['push']({'type':_0x150422[_0x52e5d7][0x0][_0xc979('0x13')],'app':'Set','appdata':_0xc979('0x28'),'context':_0x150422[_0x52e5d7][0x0]['context'],'exten':_0x150422[_0x52e5d7][0x0][_0xc979('0x9')],'priority':_0x5e0451[_0xc979('0xe')]++,'VoiceExtensionId':_0x150422[_0x52e5d7][0x0][_0xc979('0x17')]});_0x5e0451[_0xc979('0xf')][_0xc979('0x12')]({'type':_0x150422[_0x52e5d7][0x0][_0xc979('0x13')],'app':'Set','appdata':_0xc979('0x29'),'context':_0x150422[_0x52e5d7][0x0][_0xc979('0x16')],'exten':_0x150422[_0x52e5d7][0x0][_0xc979('0x9')],'priority':_0x5e0451[_0xc979('0xe')]++,'VoiceExtensionId':_0x150422[_0x52e5d7][0x0][_0xc979('0x17')]});for(var _0x4390d8=0x0,_0x4fe26f=0x0;_0x4390d8<_0x150422[_0x52e5d7]['length'];_0x4390d8+=0x1,_0x4fe26f=0x0){var _0x4be565=_0x150422[_0x52e5d7][_0x4390d8];if(_0x4be565['type']){_0x4be565[_0xc979('0x13')]=_0x4be565[_0xc979('0x13')][_0xc979('0x2a')]();}var _0x49cb4b=[];var _0x1348da=[];delete _0x4be565['id'];delete _0x4be565[_0xc979('0x2b')];delete _0x4be565[_0xc979('0x2c')];var _0xf9cc0c=_0x4be565[_0xc979('0x2d')]!=='*,*,*,*'?[_0x4be565[_0xc979('0x2d')]]:_0x4be565[_0xc979('0x2e')]?_[_0xc979('0x2f')](_['filter'](_0x5e0451[_0xc979('0x5')],{'IntervalId':_0x4be565[_0xc979('0x2e')]}),_0xc979('0x2d')):[];if(_0x4be565[_0xc979('0xd')]('tag')){if(_0x4be565[_0xc979('0x30')]&&_0x4be565['tag']!=='--'){_0x49cb4b[_0xc979('0x12')]({'type':_0x4be565['type'],'app':'Set','appdata':_0xc979('0x31')+_0x4be565[_0xc979('0x30')],'context':_0x4be565[_0xc979('0x16')],'exten':_0x4be565[_0xc979('0x9')],'priority':_0xf9cc0c['length']+_0x5e0451['priority']+_0x4fe26f++,'VoiceExtensionId':_0x4be565[_0xc979('0x17')]});}}if(_0x4be565['type']===_0xc979('0x19')&&_0x4be565[_0xc979('0xd')](_0xc979('0x32'))){if(_0x4be565['callerID']){_0x49cb4b[_0xc979('0x12')]({'type':_0x4be565[_0xc979('0x13')],'app':_0xc979('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x4be565['callerID']+')','context':_0x4be565[_0xc979('0x16')],'exten':_0x4be565[_0xc979('0x9')],'priority':_0xf9cc0c[_0xc979('0x33')]+_0x5e0451[_0xc979('0xe')]+_0x4fe26f++,'VoiceExtensionId':_0x4be565['VoiceExtensionId']});}else{_0x49cb4b[_0xc979('0x12')]({'type':_0x4be565[_0xc979('0x13')],'app':_0xc979('0x1f'),'appdata':_0xc979('0x34'),'context':_0x4be565[_0xc979('0x16')],'exten':_0x4be565[_0xc979('0x9')],'priority':_0xf9cc0c[_0xc979('0x33')]+_0x5e0451[_0xc979('0xe')]+_0x4fe26f++,'VoiceExtensionId':_0x4be565[_0xc979('0x17')]});}}if(_0x4be565[_0xc979('0xd')](_0xc979('0x35'))){if(_0x4e2729[_0xc979('0x36')](_0x4be565[_0xc979('0x37')]['toLowerCase']())>=0x0&&_0x4be565[_0xc979('0x38')]!=='custom'){if(_0x4be565[_0xc979('0x35')]){_0x49cb4b[_0xc979('0x12')]({'type':_0x4be565[_0xc979('0x13')],'app':_0xc979('0x1f'),'appdata':_0xc979('0x39'),'context':_0x4be565[_0xc979('0x16')],'exten':_0x4be565['exten'],'priority':_0xf9cc0c[_0xc979('0x33')]+_0x5e0451[_0xc979('0xe')]+_0x4fe26f++,'VoiceExtensionId':_0x4be565['VoiceExtensionId']});_0x49cb4b[_0xc979('0x12')]({'type':_0x4be565[_0xc979('0x13')],'app':_0xc979('0x14'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4be565[_0xc979('0x16')],'exten':_0x4be565[_0xc979('0x9')],'priority':_0xf9cc0c[_0xc979('0x33')]+_0x5e0451[_0xc979('0xe')]+_0x4fe26f++,'VoiceExtensionId':_0x4be565[_0xc979('0x17')]});}else{_0x49cb4b[_0xc979('0x12')]({'type':_0x4be565[_0xc979('0x13')],'app':_0xc979('0x1f'),'appdata':_0xc979('0x3a'),'context':_0x4be565['context'],'exten':_0x4be565[_0xc979('0x9')],'priority':_0xf9cc0c[_0xc979('0x33')]+_0x5e0451['priority']+_0x4fe26f++,'VoiceExtensionId':_0x4be565[_0xc979('0x17')]});_0x49cb4b['push']({'type':_0x4be565[_0xc979('0x13')],'app':_0xc979('0x14'),'appdata':_0xc979('0x3b'),'context':_0x4be565['context'],'exten':_0x4be565[_0xc979('0x9')],'priority':_0xf9cc0c[_0xc979('0x33')]+_0x5e0451[_0xc979('0xe')]+_0x4fe26f++,'VoiceExtensionId':_0x4be565[_0xc979('0x17')]});}}}for(var _0x5d9dba=0x0;_0x5d9dba<_0xf9cc0c[_0xc979('0x33')];_0x5d9dba+=0x1){var _0x41a6b2=_0x5e0451[_0xc979('0xe')]+_0xf9cc0c[_0xc979('0x33')];var _0x448a2a=_0x5d9dba===_0xf9cc0c[_0xc979('0x33')]-0x1?_0x5e0451[_0xc979('0xe')]+_0x49cb4b[_0xc979('0x33')]+_0x1348da['length']+0x2:_0x5e0451[_0xc979('0xe')]+_0x5d9dba+0x1;_0x49cb4b[_0xc979('0x3c')](_0x5d9dba,0x0,{'type':_0x4be565[_0xc979('0x13')],'app':_0xc979('0x3d'),'appdata':_0xf9cc0c[_0x5d9dba]+'?'+_0x4be565['context']+_0xc979('0x3e')+_0x41a6b2+':'+_0x4be565[_0xc979('0x16')]+',${EXTEN},'+_0x448a2a,'exten':_0x4be565[_0xc979('0x9')],'context':_0x4be565[_0xc979('0x16')],'priority':_0x5e0451[_0xc979('0xe')]+_0x5d9dba,'VoiceExtensionId':_0x150422[_0x52e5d7][0x0]['VoiceExtensionId']});}_0x4be565[_0xc979('0xe')]=_0x49cb4b[_0xc979('0x33')]?_[_0xc979('0x3f')](_0x49cb4b)[_0xc979('0xe')]+0x1:_0x5e0451[_0xc979('0xe')];_0x5e0451[_0xc979('0xe')]=(_0x1348da[_0xc979('0x33')]?_[_0xc979('0x3f')](_0x1348da)[_0xc979('0xe')]:_0x4be565['priority'])+0x1;_0x5e0451[_0xc979('0xf')]=_[_0xc979('0x40')](_0x5e0451[_0xc979('0xf')],_0x49cb4b,[_0x4be565],_0x1348da);}_0x5e0451['extensions']['push']({'type':_0x150422[_0x52e5d7][0x0][_0xc979('0x13')],'app':'Hangup','exten':_0x150422[_0x52e5d7][0x0][_0xc979('0x9')],'context':_0x150422[_0x52e5d7][0x0]['context'],'priority':_0x5e0451['priority'],'VoiceExtensionId':_0x150422[_0x52e5d7][0x0][_0xc979('0x17')]});_0x159d4d['push'](_0x150422[_0x52e5d7][0x0][_0xc979('0x17')]);_0x4d6b17=_[_0xc979('0x40')](_0x4d6b17,_0x5e0451[_0xc979('0xf')]);}}return _0x55e7ec[_0xc979('0x41')](function(_0x47ca57){return _0x55e7ec[_0xc979('0x6')]['VoiceExtension'][_0xc979('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x159d4d}},'transaction':_0x47ca57})[_0xc979('0x4')](function(_0x2fcba3){return _0x55e7ec[_0xc979('0x6')][_0xc979('0x7')][_0xc979('0x43')](_[_0xc979('0x44')](_0x4d6b17,_0xc979('0xe')),{'transaction':_0x47ca57});});});})[_0xc979('0x45')](function(_0x26b4f6){console['error'](_0x26b4f6);});}exports[_0xc979('0x46')]=rewrite; \ No newline at end of file +var _0x2b3f=['tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','error','rewrite','util','models','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','extension','find','push','type','format','CDR(type)=%s','context','VoiceExtensionId','inbound','Set','CDR(routeid)=','priority','outbound','extensions','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','createdAt','updatedAt','interval','*,*,*,*'];(function(_0xff03b9,_0x5b3def){var _0x2f9a9f=function(_0x303cc0){while(--_0x303cc0){_0xff03b9['push'](_0xff03b9['shift']());}};_0x2f9a9f(++_0x5b3def);}(_0x2b3f,0x9b));var _0xf2b3=function(_0x330851,_0x329b34){_0x330851=_0x330851-0x0;var _0x272ba7=_0x2b3f[_0x330851];return _0x272ba7;};'use strict';var _=require('lodash');var util=require(_0xf2b3('0x0'));function rewrite(_0x485d3c,_0x316a91){var _0x5c2998=this;return _0x485d3c[_0xf2b3('0x1')]['Interval'][_0xf2b3('0x2')]({'raw':!![]})[_0xf2b3('0x3')](function(_0x1d6c66){_0x5c2998[_0xf2b3('0x4')]=_0x1d6c66;return _0x485d3c[_0xf2b3('0x1')][_0xf2b3('0x5')][_0xf2b3('0x2')]({'where':{'IntervalId':_0x316a91[_0xf2b3('0x6')]},'raw':!![]});})[_0xf2b3('0x3')](function(_0x153449){return _0x485d3c[_0xf2b3('0x1')][_0xf2b3('0x5')][_0xf2b3('0x2')]({'where':{'exten':{'$in':_[_0xf2b3('0x7')](_[_0xf2b3('0x8')](_0x153449,_0xf2b3('0x9')))}},'order':[{'raw':_0xf2b3('0xa')}],'raw':!![]});})[_0xf2b3('0x3')](function(_0x1abd12){var _0x548f15=_[_0xf2b3('0xb')](_0x1abd12,{'priority':'1'});var _0x52c902=_[_0xf2b3('0xb')](_0x1abd12,{'isApp':0x1});var _0x5e5e8f=_[_0xf2b3('0xc')](_0x52c902,'exten');var _0x112c10=['queue',_0xf2b3('0xd')];var _0x32d2ff=[];var _0x5d0cb3=[];for(var _0x45db2b in _0x5e5e8f){if(_0x5e5e8f['hasOwnProperty'](_0x45db2b)){_0x5c2998['priority']=0x2;_0x5c2998['extensions']=[];_0x5c2998[_0xf2b3('0xe')]=_[_0xf2b3('0xf')](_0x548f15,{'exten':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x9')]});_0x5c2998['extensions'][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':'Set','appdata':util[_0xf2b3('0x12')](_0xf2b3('0x13'),_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')]),'context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x9')],'priority':_0x5c2998['priority']++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});if(_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')]===_0xf2b3('0x16')){_0x5c2998['extensions'][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':_0xf2b3('0x17'),'appdata':_0xf2b3('0x18')+_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')],'context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x9')],'priority':_0x5c2998[_0xf2b3('0x19')]++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});}else if(_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')]===_0xf2b3('0x1a')){if(_0x5c2998['extension']){_0x5c2998[_0xf2b3('0x1b')][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0]['type'],'app':_0xf2b3('0x17'),'appdata':_0xf2b3('0x1c')+(_0x5c2998['extension'][_0xf2b3('0x1d')]?'${EXTEN:'+_0x5c2998[_0xf2b3('0xe')][_0xf2b3('0x1d')]+'}':_0xf2b3('0x1e')),'context':_0x5e5e8f[_0x45db2b][0x0]['context'],'exten':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x9')],'priority':_0x5c2998['priority']++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});}_0x5c2998[_0xf2b3('0x1b')][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':_0xf2b3('0x17'),'appdata':_0xf2b3('0x18')+_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')],'context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0]['exten'],'priority':_0x5c2998[_0xf2b3('0x19')]++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});var _0x2653a9=_0x5c2998[_0xf2b3('0x19')]++;_0x5c2998[_0xf2b3('0x1b')]['push']({'type':_0x5e5e8f[_0x45db2b][0x0]['type'],'app':_0xf2b3('0x1f'),'appdata':_0xf2b3('0x20')+(_0x2653a9+0x2)+_0xf2b3('0x21')+(_0x2653a9+0x1)+')','context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x9')],'priority':_0x2653a9,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});if(_0x5c2998['extension']){_0x5c2998[_0xf2b3('0x1b')][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':_0xf2b3('0x17'),'appdata':_0x5c2998[_0xf2b3('0xe')][_0xf2b3('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x5c2998[_0xf2b3('0xe')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x5e5e8f[_0x45db2b][0x0]['context'],'exten':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x9')],'priority':_0x5c2998['priority']++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0]['VoiceExtensionId']});}_0x5c2998[_0xf2b3('0x1b')]['push']({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':'Set','appdata':'outboundrouteid='+_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')],'context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x9')],'priority':_0x5c2998[_0xf2b3('0x19')]++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});if(_0x5c2998['extension']&&_0x5c2998['extension'][_0xf2b3('0x22')](_0xf2b3('0x23'))&&_0x5c2998[_0xf2b3('0xe')][_0xf2b3('0x23')]!==_0xf2b3('0x24')){_0x5c2998['extensions'][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':_0xf2b3('0x17'),'appdata':_0xf2b3('0x25'),'context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0]['exten'],'priority':_0x5c2998[_0xf2b3('0x19')]++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});_0x5c2998['extensions'][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':_0xf2b3('0x17'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5c2998[_0xf2b3('0xe')]['recordingFormat']||_0xf2b3('0x26'),'context':_0x5e5e8f[_0x45db2b][0x0]['context'],'exten':_0x5e5e8f[_0x45db2b][0x0]['exten'],'priority':_0x5c2998['priority']++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});}}_0x5c2998[_0xf2b3('0x1b')][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':_0xf2b3('0x17'),'appdata':_0xf2b3('0x27'),'context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x9')],'priority':_0x5c2998['priority']++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0]['VoiceExtensionId']});_0x5c2998[_0xf2b3('0x1b')][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':_0xf2b3('0x17'),'appdata':_0xf2b3('0x28'),'context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0]['exten'],'priority':_0x5c2998[_0xf2b3('0x19')]++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0]['VoiceExtensionId']});_0x5c2998[_0xf2b3('0x1b')][_0xf2b3('0x10')]({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x14')],'exten':_0x5e5e8f[_0x45db2b][0x0]['exten'],'priority':_0x5c2998['priority']++,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0]['VoiceExtensionId']});for(var _0x5d4a7b=0x0,_0x4d0679=0x0;_0x5d4a7b<_0x5e5e8f[_0x45db2b][_0xf2b3('0x29')];_0x5d4a7b+=0x1,_0x4d0679=0x0){var _0x58a468=_0x5e5e8f[_0x45db2b][_0x5d4a7b];if(_0x58a468[_0xf2b3('0x11')]){_0x58a468[_0xf2b3('0x11')]=_0x58a468[_0xf2b3('0x11')]['toLowerCase']();}var _0x487aa8=[];var _0x4828d2=[];delete _0x58a468['id'];delete _0x58a468[_0xf2b3('0x2a')];delete _0x58a468[_0xf2b3('0x2b')];var _0x1987fe=_0x58a468[_0xf2b3('0x2c')]!==_0xf2b3('0x2d')?[_0x58a468[_0xf2b3('0x2c')]]:_0x58a468[_0xf2b3('0x6')]?_[_0xf2b3('0x8')](_[_0xf2b3('0xb')](_0x5c2998[_0xf2b3('0x4')],{'IntervalId':_0x58a468[_0xf2b3('0x6')]}),_0xf2b3('0x2c')):[];if(_0x58a468[_0xf2b3('0x22')]('tag')){if(_0x58a468[_0xf2b3('0x2e')]&&_0x58a468[_0xf2b3('0x2e')]!=='--'){_0x487aa8[_0xf2b3('0x10')]({'type':_0x58a468['type'],'app':_0xf2b3('0x17'),'appdata':'CDR(tag)='+_0x58a468[_0xf2b3('0x2e')],'context':_0x58a468[_0xf2b3('0x14')],'exten':_0x58a468['exten'],'priority':_0x1987fe[_0xf2b3('0x29')]+_0x5c2998[_0xf2b3('0x19')]+_0x4d0679++,'VoiceExtensionId':_0x58a468[_0xf2b3('0x15')]});}}if(_0x58a468[_0xf2b3('0x11')]===_0xf2b3('0x1a')&&_0x58a468[_0xf2b3('0x22')](_0xf2b3('0x2f'))){if(_0x58a468[_0xf2b3('0x2f')]){_0x487aa8[_0xf2b3('0x10')]({'type':_0x58a468[_0xf2b3('0x11')],'app':'ExecIf','appdata':_0xf2b3('0x30')+_0x58a468[_0xf2b3('0x2f')]+')','context':_0x58a468['context'],'exten':_0x58a468[_0xf2b3('0x9')],'priority':_0x1987fe[_0xf2b3('0x29')]+_0x5c2998[_0xf2b3('0x19')]+_0x4d0679++,'VoiceExtensionId':_0x58a468[_0xf2b3('0x15')]});}else{_0x487aa8['push']({'type':_0x58a468['type'],'app':_0xf2b3('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x58a468[_0xf2b3('0x14')],'exten':_0x58a468['exten'],'priority':_0x1987fe[_0xf2b3('0x29')]+_0x5c2998[_0xf2b3('0x19')]+_0x4d0679++,'VoiceExtensionId':_0x58a468[_0xf2b3('0x15')]});}}if(_0x58a468[_0xf2b3('0x22')](_0xf2b3('0x31'))){if(_0x112c10[_0xf2b3('0x32')](_0x58a468[_0xf2b3('0x33')]['toLowerCase']())>=0x0&&_0x58a468['appType']!==_0xf2b3('0x34')){if(_0x58a468[_0xf2b3('0x31')]){_0x487aa8[_0xf2b3('0x10')]({'type':_0x58a468[_0xf2b3('0x11')],'app':_0xf2b3('0x1f'),'appdata':_0xf2b3('0x35'),'context':_0x58a468[_0xf2b3('0x14')],'exten':_0x58a468[_0xf2b3('0x9')],'priority':_0x1987fe[_0xf2b3('0x29')]+_0x5c2998['priority']+_0x4d0679++,'VoiceExtensionId':_0x58a468[_0xf2b3('0x15')]});_0x487aa8[_0xf2b3('0x10')]({'type':_0x58a468[_0xf2b3('0x11')],'app':_0xf2b3('0x17'),'appdata':_0xf2b3('0x36'),'context':_0x58a468[_0xf2b3('0x14')],'exten':_0x58a468[_0xf2b3('0x9')],'priority':_0x1987fe[_0xf2b3('0x29')]+_0x5c2998[_0xf2b3('0x19')]+_0x4d0679++,'VoiceExtensionId':_0x58a468[_0xf2b3('0x15')]});}else{_0x487aa8[_0xf2b3('0x10')]({'type':_0x58a468[_0xf2b3('0x11')],'app':_0xf2b3('0x1f'),'appdata':_0xf2b3('0x37'),'context':_0x58a468['context'],'exten':_0x58a468[_0xf2b3('0x9')],'priority':_0x1987fe['length']+_0x5c2998['priority']+_0x4d0679++,'VoiceExtensionId':_0x58a468[_0xf2b3('0x15')]});_0x487aa8[_0xf2b3('0x10')]({'type':_0x58a468['type'],'app':_0xf2b3('0x17'),'appdata':_0xf2b3('0x38'),'context':_0x58a468[_0xf2b3('0x14')],'exten':_0x58a468[_0xf2b3('0x9')],'priority':_0x1987fe[_0xf2b3('0x29')]+_0x5c2998[_0xf2b3('0x19')]+_0x4d0679++,'VoiceExtensionId':_0x58a468[_0xf2b3('0x15')]});}}}for(var _0xd3625e=0x0;_0xd3625e<_0x1987fe[_0xf2b3('0x29')];_0xd3625e+=0x1){var _0x196f26=_0x5c2998[_0xf2b3('0x19')]+_0x1987fe['length'];var _0x56eb96=_0xd3625e===_0x1987fe[_0xf2b3('0x29')]-0x1?_0x5c2998[_0xf2b3('0x19')]+_0x487aa8[_0xf2b3('0x29')]+_0x4828d2[_0xf2b3('0x29')]+0x2:_0x5c2998[_0xf2b3('0x19')]+_0xd3625e+0x1;_0x487aa8['splice'](_0xd3625e,0x0,{'type':_0x58a468['type'],'app':_0xf2b3('0x39'),'appdata':_0x1987fe[_0xd3625e]+'?'+_0x58a468[_0xf2b3('0x14')]+_0xf2b3('0x3a')+_0x196f26+':'+_0x58a468[_0xf2b3('0x14')]+_0xf2b3('0x3a')+_0x56eb96,'exten':_0x58a468[_0xf2b3('0x9')],'context':_0x58a468['context'],'priority':_0x5c2998[_0xf2b3('0x19')]+_0xd3625e,'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0]['VoiceExtensionId']});}_0x58a468[_0xf2b3('0x19')]=_0x487aa8['length']?_[_0xf2b3('0x3b')](_0x487aa8)[_0xf2b3('0x19')]+0x1:_0x5c2998[_0xf2b3('0x19')];_0x5c2998['priority']=(_0x4828d2[_0xf2b3('0x29')]?_[_0xf2b3('0x3b')](_0x4828d2)['priority']:_0x58a468[_0xf2b3('0x19')])+0x1;_0x5c2998[_0xf2b3('0x1b')]=_[_0xf2b3('0x3c')](_0x5c2998[_0xf2b3('0x1b')],_0x487aa8,[_0x58a468],_0x4828d2);}_0x5c2998['extensions']['push']({'type':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x11')],'app':_0xf2b3('0x3d'),'exten':_0x5e5e8f[_0x45db2b][0x0]['exten'],'context':_0x5e5e8f[_0x45db2b][0x0]['context'],'priority':_0x5c2998[_0xf2b3('0x19')],'VoiceExtensionId':_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]});_0x32d2ff['push'](_0x5e5e8f[_0x45db2b][0x0][_0xf2b3('0x15')]);_0x5d0cb3=_[_0xf2b3('0x3c')](_0x5d0cb3,_0x5c2998['extensions']);}}return _0x485d3c['transaction'](function(_0x29e820){return _0x485d3c[_0xf2b3('0x1')][_0xf2b3('0x5')][_0xf2b3('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x32d2ff}},'transaction':_0x29e820})[_0xf2b3('0x3')](function(_0x363cfe){return _0x485d3c[_0xf2b3('0x1')][_0xf2b3('0x5')][_0xf2b3('0x3f')](_[_0xf2b3('0x40')](_0x5d0cb3,_0xf2b3('0x19')),{'transaction':_0x29e820});});});})['catch'](function(_0x5d7946){console[_0xf2b3('0x41')](_0x5d7946);});}exports[_0xf2b3('0x42')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 61a2af8..e0a3fce 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 _0xac64=['pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','defaults','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','split','Missing\x20ListId\x20parameter!','contact','index','isNil','error','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','pick','stringify','checkHopper','inspect','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','into','fromQuery','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','get','always','sequelize','query','catch','VoiceQueueId','all','BlackLists','Campaign','onlyIfOpen','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse'];(function(_0xd7f131,_0xf632e5){var _0x3de516=function(_0x5aacdd){while(--_0x5aacdd){_0xd7f131['push'](_0xd7f131['shift']());}};_0x3de516(++_0xf632e5);}(_0xac64,0x1af));var _0x4ac6=function(_0x5b307d,_0x5dca02){_0x5b307d=_0x5b307d-0x0;var _0x14ea34=_0xac64[_0x5b307d];return _0x14ea34;};'use strict';var BPromise=require(_0x4ac6('0x0'));var util=require('util');var _=require(_0x4ac6('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x4ac6('0x2'));var Redis=require(_0x4ac6('0x3'));var db=require(_0x4ac6('0x4'))['db'];var config=require(_0x4ac6('0x5'));var logger=require('../../../config/logger')(_0x4ac6('0x6'));config['redis']=_[_0x4ac6('0x7')](config[_0x4ac6('0x8')],{'host':_0x4ac6('0x9'),'port':0x18eb});var socket=require(_0x4ac6('0xa'))(new Redis(config[_0x4ac6('0x8')]));require('../../../api/cmContact/cmContact.socket')[_0x4ac6('0xb')](socket);try{if(!process[_0x4ac6('0xc')][0x2]||process[_0x4ac6('0xc')][0x2]===_0x4ac6('0xd')||process[_0x4ac6('0xc')][0x2]===_0x4ac6('0xe')){throw new Error(_0x4ac6('0xf'));}var FILEPATH=process[_0x4ac6('0xc')][0x2];if(!process[_0x4ac6('0xc')][0x3]||process[_0x4ac6('0xc')][0x3]===_0x4ac6('0xd')||process[_0x4ac6('0xc')][0x3]===_0x4ac6('0xe')||!process['argv'][0x4]||process[_0x4ac6('0xc')][0x4]===_0x4ac6('0xd')||process[_0x4ac6('0xc')][0x4]===_0x4ac6('0xe')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process['argv'][0x3][_0x4ac6('0x10')](','),process['argv'][0x4]['split'](','));if(!process[_0x4ac6('0xc')][0x5]||process[_0x4ac6('0xc')][0x5]===_0x4ac6('0xd')||process[_0x4ac6('0xc')][0x5]===_0x4ac6('0xe')){throw new Error(_0x4ac6('0x11'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x4ac6('0xc')][0x6]&&process[_0x4ac6('0xc')][0x6]!==_0x4ac6('0xd')&&process[_0x4ac6('0xc')][0x6]!==_0x4ac6('0xe')?process[_0x4ac6('0xc')][0x6]:null;var DUPLICATES=process[_0x4ac6('0xc')][0x7]&&process[_0x4ac6('0xc')][0x7]!==_0x4ac6('0xd')&&process[_0x4ac6('0xc')][0x7]!=='null'?process[_0x4ac6('0xc')][0x7]:null;if(!process[_0x4ac6('0xc')][0x8]||process[_0x4ac6('0xc')][0x8]===_0x4ac6('0xd')||process[_0x4ac6('0xc')][0x8]===_0x4ac6('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x4ac6('0xc')][0x8];}catch(_0x528237){logger['error'](_0x528237);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(_0x45fca5,_0x1c5d37,_0x412d35,_0x379e1f){var _0x5b67de={'message':_0x1c5d37};_0x5b67de[_0x45fca5]=!![];if(_0x412d35){_0x5b67de[_0x4ac6('0x12')]=_0x412d35;}if(_0x379e1f){_0x5b67de[_0x4ac6('0x13')]=_0x379e1f;}return _0x5b67de;}function isEmail(_0x14de11){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x14de11);}function checkRow(_0x2a7821,_0x1888ec,_0x2f59bd){return new BPromise(function(_0x1b7876,_0x5bf2a8){if(_[_0x4ac6('0x14')](_0x2a7821)){return _0x5bf2a8(handleCheckRowError(_0x4ac6('0x15'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x2f59bd));}if(_0x2a7821[_0x4ac6('0x16')]&&_0x2a7821[_0x4ac6('0x16')][_0x4ac6('0x17')]){var _0x137065=_[_0x4ac6('0x18')](_0x2a7821[_0x4ac6('0x16')],_0x4ac6('0x19'))[_0x4ac6('0x1a')](';');return _0x5bf2a8(handleCheckRowError(_0x4ac6('0x15'),_0x137065,null,_0x2f59bd));}var _0x28b1db={};for(var _0x11fc9d in FIELDS){if(FIELDS[_0x4ac6('0x1b')](_0x11fc9d)&&FIELDS[_0x11fc9d]){_0x28b1db[_0x11fc9d]=_0x2a7821[_0x4ac6('0x1c')][0x0][FIELDS[_0x11fc9d]]||_0x2a7821['data'][0x0]['\ufeff'+FIELDS[_0x11fc9d]];}}if(!_0x28b1db[_0x4ac6('0x1d')]){return _0x5bf2a8(handleCheckRowError(_0x4ac6('0x15'),_0x4ac6('0x1e'),null,_0x2f59bd));}if(!_0x28b1db['phone']){return _0x5bf2a8(handleCheckRowError(_0x4ac6('0x15'),_0x4ac6('0x1f'),null,_0x2f59bd));}if(_0x28b1db['birthDate']){var _0x20f5a6=moment(_0x28b1db[_0x4ac6('0x20')],'YYYY-MM-DD');if(!_0x20f5a6['isValid']()){return _0x5bf2a8(handleCheckRowError('error',_0x4ac6('0x21'),null,_0x2f59bd));}}if(_0x28b1db[_0x4ac6('0x22')]){if(!isEmail(_0x28b1db[_0x4ac6('0x22')])){return _0x5bf2a8(handleCheckRowError('error',_0x4ac6('0x23'),null,_0x2f59bd));}}_0x28b1db[_0x4ac6('0x24')]=LISTID;_0x28b1db[_0x4ac6('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x4ac6('0x17')]&&_0x1888ec){var _0x535eb6={};for(var _0x116d34=0x0,_0x140aad=DUPLICATES[_0x4ac6('0x17')];_0x116d34<_0x140aad;_0x116d34+=0x1){_0x535eb6[DUPLICATES[_0x116d34]]=_0x28b1db[DUPLICATES[_0x116d34]];}var _0x521533=_['find'](_0x1888ec,_0x535eb6);if(_0x521533){return _0x5bf2a8(handleCheckRowError(_0x4ac6('0x26'),_0x4ac6('0x27'),_0x521533,_0x2f59bd));}}return db[_0x4ac6('0x28')]['create'](_0x28b1db,{'raw':!![],'hooks':![],'fields':_[_0x4ac6('0x29')](_0x28b1db)})[_0x4ac6('0x2a')](function(_0x63467c){if(DUPLICATES&&DUPLICATES['length']&&_0x1888ec){_0x1888ec[_0x4ac6('0x2b')](_[_0x4ac6('0x2c')](_0x28b1db,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x63467c['id'];return _0x1b7876();})['catch'](function(_0x6aa001){return _0x5bf2a8(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x6aa001[_0x4ac6('0x19')]||JSON[_0x4ac6('0x2d')](_0x6aa001)),null,_0x2f59bd));});});}function checkHopper(){function _0x45edc3(){return function(_0x53da85){logger[_0x4ac6('0x15')]('cmContact',_0x4ac6('0x2e'),util[_0x4ac6('0x2f')](_0x53da85,{'showHidden':![],'depth':null}));};}var _0x1ce98d=function(_0x2c166b,_0x5a727f){var _0x11a456=squel['insert']()['into'](_0x4ac6('0x30'))['fromQuery']([_0x4ac6('0x31'),'scheduledAt',_0x4ac6('0x32'),_0x4ac6('0x24'),_0x5a727f,_0x4ac6('0x33'),_0x4ac6('0x34')],squel[_0x4ac6('0x35')]()[_0x4ac6('0x36')](_0x4ac6('0x31'),_0x4ac6('0x31'))[_0x4ac6('0x36')](_0x4ac6('0x37'),_0x4ac6('0x38'))['field']('id',_0x4ac6('0x32'))[_0x4ac6('0x36')](LISTID['toString'](),_0x4ac6('0x24'))['field'](_0x2c166b['id'][_0x4ac6('0x39')](),_0x5a727f)[_0x4ac6('0x36')]('NOW()',_0x4ac6('0x33'))[_0x4ac6('0x36')](_0x4ac6('0x37'),_0x4ac6('0x34'))[_0x4ac6('0x3a')](_0x4ac6('0x3b'))[_0x4ac6('0x3c')](_0x4ac6('0x3d'))['where'](_0x4ac6('0x3e'),LISTID[_0x4ac6('0x39')]())['where'](_0x4ac6('0x3f'))[_0x4ac6('0x3c')](_0x4ac6('0x40'),squel[_0x4ac6('0x35')]()[_0x4ac6('0x36')]('phone')[_0x4ac6('0x3a')](_0x4ac6('0x30'))[_0x4ac6('0x3c')](_0x5a727f+_0x4ac6('0x41'),_0x2c166b['id'][_0x4ac6('0x39')]())))['toString']();return _0x11a456;};var _0x22f480=function(_0x5a7778,_0x3b8cde){var _0x241b27=squel[_0x4ac6('0x42')]()[_0x4ac6('0x43')](_0x4ac6('0x30'))[_0x4ac6('0x44')]([_0x4ac6('0x31'),_0x4ac6('0x38'),_0x4ac6('0x32'),_0x4ac6('0x24'),_0x3b8cde,'createdAt','updatedAt'],squel[_0x4ac6('0x35')]()['field'](_0x4ac6('0x31'),'phone')['field']('NOW()',_0x4ac6('0x38'))[_0x4ac6('0x36')]('id',_0x4ac6('0x32'))[_0x4ac6('0x36')](LISTID[_0x4ac6('0x39')](),_0x4ac6('0x24'))[_0x4ac6('0x36')](_0x5a7778['id'][_0x4ac6('0x39')](),_0x3b8cde)[_0x4ac6('0x36')](_0x4ac6('0x37'),'createdAt')[_0x4ac6('0x36')](_0x4ac6('0x37'),_0x4ac6('0x34'))[_0x4ac6('0x3a')](_0x4ac6('0x3b'))[_0x4ac6('0x3c')](_0x4ac6('0x3d'))[_0x4ac6('0x3c')](_0x4ac6('0x3e'),LISTID[_0x4ac6('0x39')]())[_0x4ac6('0x3c')](_0x4ac6('0x45'),squel[_0x4ac6('0x46')](hopperContacts))[_0x4ac6('0x3c')](_0x4ac6('0x3f'))['where'](_0x4ac6('0x40'),squel[_0x4ac6('0x35')]()[_0x4ac6('0x36')](_0x4ac6('0x47'))[_0x4ac6('0x3a')](_0x4ac6('0x48'))[_0x4ac6('0x3c')](_0x3b8cde+_0x4ac6('0x41'),_0x5a7778['id'][_0x4ac6('0x39')]()))[_0x4ac6('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x4ac6('0x36')](_0x4ac6('0x31'))['from'](_0x4ac6('0x30'))['where'](_0x3b8cde+'\x20=\x20?',_0x5a7778['id'][_0x4ac6('0x39')]())))[_0x4ac6('0x39')]();return _0x241b27;};function _0x7fe6e6(_0x40af67,_0x2f1387){var _0x1f9a05=squel[_0x4ac6('0x42')]()[_0x4ac6('0x43')]('cm_hopper')['fromQuery']([_0x4ac6('0x31'),_0x4ac6('0x38'),_0x4ac6('0x32'),_0x4ac6('0x24'),_0x2f1387,_0x4ac6('0x33'),'updatedAt'],squel[_0x4ac6('0x35')]()[_0x4ac6('0x36')]('phone',_0x4ac6('0x31'))[_0x4ac6('0x36')](_0x4ac6('0x37'),_0x4ac6('0x38'))[_0x4ac6('0x36')]('id',_0x4ac6('0x32'))[_0x4ac6('0x36')](LISTID[_0x4ac6('0x39')](),_0x4ac6('0x24'))[_0x4ac6('0x36')](_0x40af67['id'][_0x4ac6('0x39')](),_0x2f1387)[_0x4ac6('0x36')](_0x4ac6('0x37'),_0x4ac6('0x33'))['field']('NOW()',_0x4ac6('0x34'))[_0x4ac6('0x3a')]('cm_contacts')[_0x4ac6('0x3c')](_0x4ac6('0x3d'))[_0x4ac6('0x3c')](_0x4ac6('0x3e'),LISTID[_0x4ac6('0x39')]())[_0x4ac6('0x3c')](_0x4ac6('0x45'),squel[_0x4ac6('0x46')](hopperContacts))['where'](_0x4ac6('0x3f')))[_0x4ac6('0x39')]();return _0x1f9a05;}function _0x4e797e(_0x49d1d2,_0x260beb){var _0x36e8f5=squel[_0x4ac6('0x42')]()['into'](_0x4ac6('0x49'))[_0x4ac6('0x44')]([_0x4ac6('0x31'),_0x4ac6('0x32'),_0x4ac6('0x24'),_0x260beb,_0x4ac6('0x33'),_0x4ac6('0x34')],squel[_0x4ac6('0x35')]()['field'](_0x4ac6('0x31'),_0x4ac6('0x31'))[_0x4ac6('0x36')]('id','ContactId')['field'](LISTID[_0x4ac6('0x39')](),_0x4ac6('0x24'))[_0x4ac6('0x36')](_0x49d1d2['id'][_0x4ac6('0x39')](),_0x260beb)['field'](_0x4ac6('0x37'),'createdAt')['field'](_0x4ac6('0x37'),_0x4ac6('0x34'))[_0x4ac6('0x3a')](_0x4ac6('0x3b'))['where'](_0x4ac6('0x3d'))[_0x4ac6('0x3c')](_0x4ac6('0x3e'),LISTID[_0x4ac6('0x39')]())['where'](_0x4ac6('0x45'),squel['str'](hopperContacts))[_0x4ac6('0x3c')](_0x4ac6('0x3f')))[_0x4ac6('0x39')]();return _0x36e8f5;}return db[_0x4ac6('0x4a')][_0x4ac6('0x4b')]({'where':{'type':_0x4ac6('0x4c')},'attributes':['id',_0x4ac6('0x4d')],'include':[{'model':db[_0x4ac6('0x4e')],'as':'Lists','where':{'id':LISTID}}]})[_0x4ac6('0x2a')](function(_0x367336){var _0x56c902=[];if(_0x367336){var _0x558013;for(var _0x5c86f2=0x0,_0x2ec5b9;_0x5c86f2<_0x367336[_0x4ac6('0x17')];_0x5c86f2+=0x1){_0x2ec5b9=_0x367336[_0x5c86f2][_0x4ac6('0x4f')]({'plain':!![]});switch(_0x2ec5b9['dialCheckDuplicateType']){case _0x4ac6('0x50'):_0x56c902[_0x4ac6('0x2b')](db[_0x4ac6('0x51')][_0x4ac6('0x52')](_0x22f480(_0x2ec5b9,'VoiceQueueId'))[_0x4ac6('0x2a')](function(){})[_0x4ac6('0x53')](_0x45edc3()));break;case'onlyIfOpen':_0x56c902[_0x4ac6('0x2b')](db['sequelize'][_0x4ac6('0x52')](_0x1ce98d(_0x2ec5b9,_0x4ac6('0x54')))[_0x4ac6('0x2a')](function(){})[_0x4ac6('0x53')](_0x45edc3()));break;default:_0x56c902[_0x4ac6('0x2b')](db[_0x4ac6('0x51')][_0x4ac6('0x52')](_0x7fe6e6(_0x2ec5b9,_0x4ac6('0x54')))[_0x4ac6('0x2a')](function(){})[_0x4ac6('0x53')](_0x45edc3()));}}}return _0x56c902;})[_0x4ac6('0x55')]()['then'](function(){return db[_0x4ac6('0x4a')][_0x4ac6('0x4b')]({'where':{'type':_0x4ac6('0x4c')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x4ac6('0x56'),'where':{'id':LISTID}}]})['then'](function(_0x1c9176){var _0x837d90=[];if(_0x1c9176){var _0x48b867;for(var _0x3c7f96=0x0,_0x1fec2a;_0x3c7f96<_0x1c9176['length'];_0x3c7f96+=0x1){_0x1fec2a=_0x1c9176[_0x3c7f96][_0x4ac6('0x4f')]({'plain':!![]});_0x837d90[_0x4ac6('0x2b')](db[_0x4ac6('0x51')][_0x4ac6('0x52')](_0x4e797e(_0x1fec2a,'VoiceQueueId'))[_0x4ac6('0x2a')](function(){})[_0x4ac6('0x53')](_0x45edc3()));}}return _0x837d90;})[_0x4ac6('0x55')]();})[_0x4ac6('0x2a')](function(){return db[_0x4ac6('0x57')][_0x4ac6('0x4b')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x4ac6('0x2a')](function(_0x1041ce){var _0xa5bccf=[];if(_0x1041ce){for(var _0x1ae511=0x0,_0x335ba6;_0x1ae511<_0x1041ce[_0x4ac6('0x17')];_0x1ae511+=0x1){_0x335ba6=_0x1041ce[_0x1ae511][_0x4ac6('0x4f')]({'plain':!![]});switch(_0x335ba6['dialCheckDuplicateType']){case _0x4ac6('0x50'):_0xa5bccf['push'](db['sequelize'][_0x4ac6('0x52')](_0x22f480(_0x335ba6,'CampaignId'))[_0x4ac6('0x2a')](function(){})[_0x4ac6('0x53')](_0x45edc3()));break;case _0x4ac6('0x58'):_0xa5bccf[_0x4ac6('0x2b')](db[_0x4ac6('0x51')][_0x4ac6('0x52')](_0x1ce98d(_0x335ba6,_0x4ac6('0x59')))[_0x4ac6('0x2a')](function(){})[_0x4ac6('0x53')](_0x45edc3()));break;default:_0xa5bccf[_0x4ac6('0x2b')](db[_0x4ac6('0x51')][_0x4ac6('0x52')](_0x7fe6e6(_0x335ba6,_0x4ac6('0x59')))[_0x4ac6('0x2a')](function(){})[_0x4ac6('0x53')](_0x45edc3()));}}}return _0xa5bccf;})['all']();})[_0x4ac6('0x2a')](function(){return db[_0x4ac6('0x57')][_0x4ac6('0x4b')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x4ac6('0x56'),'where':{'id':LISTID}}]})[_0x4ac6('0x2a')](function(_0x2e1d60){var _0x9be764=[];if(_0x2e1d60){for(var _0xc88166=0x0,_0xd09b07;_0xc88166<_0x2e1d60[_0x4ac6('0x17')];_0xc88166+=0x1){_0xd09b07=_0x2e1d60[_0xc88166][_0x4ac6('0x4f')]({'plain':!![]});_0x9be764[_0x4ac6('0x2b')](db['sequelize'][_0x4ac6('0x52')](_0x4e797e(_0xd09b07,_0x4ac6('0x59')))[_0x4ac6('0x2a')](function(){})[_0x4ac6('0x53')](_0x45edc3()));}}return _0x9be764;})[_0x4ac6('0x55')]();})['catch'](function(_0x3b5520){logger[_0x4ac6('0x15')](_0x4ac6('0x5a'),_0x4ac6('0x5b'),_0x3b5520['message']);});}var processPromises=function(_0x31ce5f){return BPromise[_0x4ac6('0x55')](promises)[_0x4ac6('0x2a')](function(_0x2c58cd){})['catch'](function(_0x2612db){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0x4ac6('0x2d')](_0x2612db));})[_0x4ac6('0x5c')](function(){socket[_0x4ac6('0x5d')](_0x4ac6('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x31ce5f){return _0x31ce5f[_0x4ac6('0x5f')]();}});};var endCsv=function(){return BPromise[_0x4ac6('0x60')]()[_0x4ac6('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0x4ac6('0x2a')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x4ac6('0x61')](FILEPATH);}catch(_0xe5d819){logger[_0x4ac6('0x15')](_0x4ac6('0x62'),JSON['stringify'](_0xe5d819));}finally{process[_0x4ac6('0x63')](0x0);}});};process['on'](_0x4ac6('0x64'),function(){logger[_0x4ac6('0x65')](_0x4ac6('0x66'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x4ac6('0x10')](',');return db[_0x4ac6('0x28')][_0x4ac6('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x4ac6('0x2a')](function(_0x599f61){var _0x3a56a4=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x4ac6('0x67')](_0x3a56a4,{'header':!![],'skipEmptyLines':!![],'step':function(_0xf976dd,_0xeffdcf){total+=0x1;var _0x5cd88a=total;promises['push'](checkRow(_0xf976dd,_0x599f61,_0x5cd88a)[_0x4ac6('0x2a')](function(){success+=0x1;})[_0x4ac6('0x53')](function(_0x20faa8){if(_0x20faa8[_0x4ac6('0x15')]){errors+=0x1;delete _0x20faa8[_0x4ac6('0x15')];}else if(_0x20faa8['duplicate']){duplicates+=0x1;delete _0x20faa8[_0x4ac6('0x26')];}rows['push'](_0x20faa8);}));if(total%0xc8===0x0){_0xeffdcf[_0x4ac6('0x68')]();return processPromises(_0xeffdcf);}},'complete':function(){return processPromises()[_0x4ac6('0x2a')](function(){logger[_0x4ac6('0x65')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x8e8dfe,_0x9d9ee6){logger[_0x4ac6('0x65')](_0x4ac6('0x69'),JSON[_0x4ac6('0x2d')](_0x8e8dfe));endCsv();}});})[_0x4ac6('0x53')](function(_0x244d77){logger[_0x4ac6('0x15')](_0x4ac6('0x6a'),JSON[_0x4ac6('0x2d')](_0x244d77));});}main(); \ No newline at end of file +var _0xcfd7=['YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','message','stringify','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','from','cm_contacts','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','findAll','outbound','BlackLists','Campaign','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','papaparse','ioredis','../../../config/logger','api','redis','localhost','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','error','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','join','data','phone','birthDate'];(function(_0x9d7494,_0x19c86a){var _0x5b4804=function(_0x2a0160){while(--_0x2a0160){_0x9d7494['push'](_0x9d7494['shift']());}};_0x5b4804(++_0x19c86a);}(_0xcfd7,0x1da));var _0x7cfd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcfd7[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0x7cfd('0x0'));var util=require(_0x7cfd('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0x7cfd('0x2'));var Redis=require(_0x7cfd('0x3'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x7cfd('0x4'))(_0x7cfd('0x5'));config[_0x7cfd('0x6')]=_['defaults'](config[_0x7cfd('0x6')],{'host':_0x7cfd('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7cfd('0x6')]));require(_0x7cfd('0x8'))['register'](socket);try{if(!process['argv'][0x2]||process[_0x7cfd('0x9')][0x2]===_0x7cfd('0xa')||process[_0x7cfd('0x9')][0x2]===_0x7cfd('0xb')){throw new Error(_0x7cfd('0xc'));}var FILEPATH=process[_0x7cfd('0x9')][0x2];if(!process[_0x7cfd('0x9')][0x3]||process[_0x7cfd('0x9')][0x3]===_0x7cfd('0xa')||process[_0x7cfd('0x9')][0x3]===_0x7cfd('0xb')||!process[_0x7cfd('0x9')][0x4]||process[_0x7cfd('0x9')][0x4]==='undefined'||process[_0x7cfd('0x9')][0x4]===_0x7cfd('0xb')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x7cfd('0xd')](process[_0x7cfd('0x9')][0x3][_0x7cfd('0xe')](','),process[_0x7cfd('0x9')][0x4][_0x7cfd('0xe')](','));if(!process[_0x7cfd('0x9')][0x5]||process[_0x7cfd('0x9')][0x5]===_0x7cfd('0xa')||process['argv'][0x5]==='null'){throw new Error(_0x7cfd('0xf'));}var LISTID=process[_0x7cfd('0x9')][0x5];var COMPANYID=process[_0x7cfd('0x9')][0x6]&&process[_0x7cfd('0x9')][0x6]!==_0x7cfd('0xa')&&process[_0x7cfd('0x9')][0x6]!==_0x7cfd('0xb')?process[_0x7cfd('0x9')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x7cfd('0x9')][0x7]!==_0x7cfd('0xa')&&process[_0x7cfd('0x9')][0x7]!==_0x7cfd('0xb')?process[_0x7cfd('0x9')][0x7]:null;if(!process[_0x7cfd('0x9')][0x8]||process[_0x7cfd('0x9')][0x8]==='undefined'||process[_0x7cfd('0x9')][0x8]===_0x7cfd('0xb')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7cfd('0x9')][0x8];}catch(_0x5e5fc7){logger[_0x7cfd('0x10')](_0x5e5fc7);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(_0x5653fb,_0x541c93,_0x3df8a0,_0x1cb7f5){var _0x33c412={'message':_0x541c93};_0x33c412[_0x5653fb]=!![];if(_0x3df8a0){_0x33c412['contact']=_0x3df8a0;}if(_0x1cb7f5){_0x33c412['index']=_0x1cb7f5;}return _0x33c412;}function isEmail(_0x2e299e){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))*$/[_0x7cfd('0x11')](_0x2e299e);}function checkRow(_0x31f726,_0x1fda95,_0x5afb39){return new BPromise(function(_0x2011a4,_0x37148f){if(_[_0x7cfd('0x12')](_0x31f726)){return _0x37148f(handleCheckRowError('error',_0x7cfd('0x13'),null,_0x5afb39));}if(_0x31f726['errors']&&_0x31f726[_0x7cfd('0x14')][_0x7cfd('0x15')]){var _0x3dceee=_['map'](_0x31f726[_0x7cfd('0x14')],'message')[_0x7cfd('0x16')](';');return _0x37148f(handleCheckRowError(_0x7cfd('0x10'),_0x3dceee,null,_0x5afb39));}var _0x4ab0bc={};for(var _0x574a4c in FIELDS){if(FIELDS['hasOwnProperty'](_0x574a4c)&&FIELDS[_0x574a4c]){_0x4ab0bc[_0x574a4c]=_0x31f726[_0x7cfd('0x17')][0x0][FIELDS[_0x574a4c]]||_0x31f726['data'][0x0]['\ufeff'+FIELDS[_0x574a4c]];}}if(!_0x4ab0bc['firstName']){return _0x37148f(handleCheckRowError(_0x7cfd('0x10'),'firstName\x20not\x20specified!',null,_0x5afb39));}if(!_0x4ab0bc[_0x7cfd('0x18')]){return _0x37148f(handleCheckRowError(_0x7cfd('0x10'),'phone\x20not\x20specified!',null,_0x5afb39));}if(_0x4ab0bc[_0x7cfd('0x19')]){var _0x38f7fc=moment(_0x4ab0bc['birthDate'],_0x7cfd('0x1a'));if(!_0x38f7fc[_0x7cfd('0x1b')]()){return _0x37148f(handleCheckRowError('error',_0x7cfd('0x1c'),null,_0x5afb39));}}if(_0x4ab0bc['email']){if(!isEmail(_0x4ab0bc[_0x7cfd('0x1d')])){return _0x37148f(handleCheckRowError('error','email\x20format\x20is\x20not\x20valid!',null,_0x5afb39));}}_0x4ab0bc[_0x7cfd('0x1e')]=LISTID;_0x4ab0bc[_0x7cfd('0x1f')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7cfd('0x15')]&&_0x1fda95){var _0x1010d9={};for(var _0x55e9b7=0x0,_0xc98b5=DUPLICATES[_0x7cfd('0x15')];_0x55e9b7<_0xc98b5;_0x55e9b7+=0x1){_0x1010d9[DUPLICATES[_0x55e9b7]]=_0x4ab0bc[DUPLICATES[_0x55e9b7]];}var _0x428cd9=_[_0x7cfd('0x20')](_0x1fda95,_0x1010d9);if(_0x428cd9){return _0x37148f(handleCheckRowError(_0x7cfd('0x21'),_0x7cfd('0x22'),_0x428cd9,_0x5afb39));}}return db[_0x7cfd('0x23')][_0x7cfd('0x24')](_0x4ab0bc,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4ab0bc)})[_0x7cfd('0x25')](function(_0x18da05){if(DUPLICATES&&DUPLICATES[_0x7cfd('0x15')]&&_0x1fda95){_0x1fda95[_0x7cfd('0x26')](_[_0x7cfd('0x27')](_0x4ab0bc,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18da05['id'];return _0x2011a4();})[_0x7cfd('0x28')](function(_0x3b793b){return _0x37148f(handleCheckRowError(_0x7cfd('0x10'),'Error\x20while\x20creating\x20contact:\x20'+(_0x3b793b[_0x7cfd('0x29')]||JSON[_0x7cfd('0x2a')](_0x3b793b)),null,_0x5afb39));});});}function checkHopper(){function _0x15a226(){return function(_0x5c6ddb){logger['error']('cmContact',_0x7cfd('0x2b'),util[_0x7cfd('0x2c')](_0x5c6ddb,{'showHidden':![],'depth':null}));};}var _0x35530d=function(_0x572c2f,_0x1cc9f6){var _0x18f0c1=squel[_0x7cfd('0x2d')]()[_0x7cfd('0x2e')](_0x7cfd('0x2f'))[_0x7cfd('0x30')]([_0x7cfd('0x18'),_0x7cfd('0x31'),_0x7cfd('0x32'),_0x7cfd('0x1e'),_0x1cc9f6,_0x7cfd('0x33'),_0x7cfd('0x34')],squel[_0x7cfd('0x35')]()['field'](_0x7cfd('0x18'),'phone')[_0x7cfd('0x36')](_0x7cfd('0x37'),_0x7cfd('0x31'))[_0x7cfd('0x36')]('id',_0x7cfd('0x32'))['field'](LISTID['toString'](),_0x7cfd('0x1e'))[_0x7cfd('0x36')](_0x572c2f['id'][_0x7cfd('0x38')](),_0x1cc9f6)['field']('NOW()',_0x7cfd('0x33'))[_0x7cfd('0x36')]('NOW()',_0x7cfd('0x34'))['from']('cm_contacts')[_0x7cfd('0x39')](_0x7cfd('0x3a'))[_0x7cfd('0x39')](_0x7cfd('0x3b'),LISTID[_0x7cfd('0x38')]())[_0x7cfd('0x39')](_0x7cfd('0x3c'))[_0x7cfd('0x39')](_0x7cfd('0x3d'),squel['select']()[_0x7cfd('0x36')](_0x7cfd('0x18'))['from'](_0x7cfd('0x2f'))[_0x7cfd('0x39')](_0x1cc9f6+_0x7cfd('0x3e'),_0x572c2f['id'][_0x7cfd('0x38')]())))[_0x7cfd('0x38')]();return _0x18f0c1;};var _0x382f4c=function(_0x28b8b6,_0x2c8dfe){var _0xb9888c=squel['insert']()[_0x7cfd('0x2e')](_0x7cfd('0x2f'))[_0x7cfd('0x30')](['phone',_0x7cfd('0x31'),'ContactId',_0x7cfd('0x1e'),_0x2c8dfe,_0x7cfd('0x33'),'updatedAt'],squel[_0x7cfd('0x35')]()[_0x7cfd('0x36')](_0x7cfd('0x18'),'phone')[_0x7cfd('0x36')](_0x7cfd('0x37'),'scheduledAt')[_0x7cfd('0x36')]('id',_0x7cfd('0x32'))[_0x7cfd('0x36')](LISTID['toString'](),_0x7cfd('0x1e'))[_0x7cfd('0x36')](_0x28b8b6['id'][_0x7cfd('0x38')](),_0x2c8dfe)[_0x7cfd('0x36')](_0x7cfd('0x37'),_0x7cfd('0x33'))['field'](_0x7cfd('0x37'),_0x7cfd('0x34'))[_0x7cfd('0x3f')](_0x7cfd('0x40'))[_0x7cfd('0x39')](_0x7cfd('0x3a'))[_0x7cfd('0x39')]('ListId\x20=\x20?',LISTID[_0x7cfd('0x38')]())[_0x7cfd('0x39')]('id\x20IN\x20?',squel[_0x7cfd('0x41')](hopperContacts))[_0x7cfd('0x39')](_0x7cfd('0x3c'))[_0x7cfd('0x39')](_0x7cfd('0x3d'),squel[_0x7cfd('0x35')]()[_0x7cfd('0x36')](_0x7cfd('0x42'))[_0x7cfd('0x3f')](_0x7cfd('0x43'))['where'](_0x2c8dfe+_0x7cfd('0x3e'),_0x28b8b6['id'][_0x7cfd('0x38')]()))[_0x7cfd('0x39')](_0x7cfd('0x3d'),squel[_0x7cfd('0x35')]()[_0x7cfd('0x36')]('phone')[_0x7cfd('0x3f')](_0x7cfd('0x2f'))[_0x7cfd('0x39')](_0x2c8dfe+_0x7cfd('0x3e'),_0x28b8b6['id'][_0x7cfd('0x38')]())))['toString']();return _0xb9888c;};function _0x2527b8(_0x4fe42d,_0x4610f8){var _0x58f651=squel[_0x7cfd('0x2d')]()[_0x7cfd('0x2e')](_0x7cfd('0x2f'))[_0x7cfd('0x30')]([_0x7cfd('0x18'),_0x7cfd('0x31'),'ContactId','ListId',_0x4610f8,_0x7cfd('0x33'),_0x7cfd('0x34')],squel[_0x7cfd('0x35')]()['field'](_0x7cfd('0x18'),'phone')[_0x7cfd('0x36')]('NOW()','scheduledAt')[_0x7cfd('0x36')]('id','ContactId')[_0x7cfd('0x36')](LISTID['toString'](),_0x7cfd('0x1e'))[_0x7cfd('0x36')](_0x4fe42d['id'][_0x7cfd('0x38')](),_0x4610f8)[_0x7cfd('0x36')]('NOW()','createdAt')['field'](_0x7cfd('0x37'),_0x7cfd('0x34'))[_0x7cfd('0x3f')]('cm_contacts')[_0x7cfd('0x39')](_0x7cfd('0x3a'))['where'](_0x7cfd('0x3b'),LISTID['toString']())[_0x7cfd('0x39')](_0x7cfd('0x44'),squel[_0x7cfd('0x41')](hopperContacts))[_0x7cfd('0x39')](_0x7cfd('0x3c')))[_0x7cfd('0x38')]();return _0x58f651;}function _0x1e528f(_0x362e0e,_0x1a6559){var _0x401565=squel['insert']()[_0x7cfd('0x2e')](_0x7cfd('0x45'))[_0x7cfd('0x30')](['phone','ContactId','ListId',_0x1a6559,_0x7cfd('0x33'),_0x7cfd('0x34')],squel[_0x7cfd('0x35')]()['field']('phone',_0x7cfd('0x18'))[_0x7cfd('0x36')]('id','ContactId')[_0x7cfd('0x36')](LISTID[_0x7cfd('0x38')](),_0x7cfd('0x1e'))['field'](_0x362e0e['id'][_0x7cfd('0x38')](),_0x1a6559)[_0x7cfd('0x36')](_0x7cfd('0x37'),_0x7cfd('0x33'))['field']('NOW()','updatedAt')[_0x7cfd('0x3f')](_0x7cfd('0x40'))[_0x7cfd('0x39')](_0x7cfd('0x3a'))[_0x7cfd('0x39')](_0x7cfd('0x3b'),LISTID[_0x7cfd('0x38')]())[_0x7cfd('0x39')]('id\x20IN\x20?',squel[_0x7cfd('0x41')](hopperContacts))[_0x7cfd('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0x7cfd('0x38')]();return _0x401565;}return db[_0x7cfd('0x46')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x7cfd('0x47')],'include':[{'model':db[_0x7cfd('0x48')],'as':_0x7cfd('0x49'),'where':{'id':LISTID}}]})[_0x7cfd('0x25')](function(_0x391a08){var _0x5de403=[];if(_0x391a08){var _0x415811;for(var _0x3ab2d9=0x0,_0xa372dd;_0x3ab2d9<_0x391a08['length'];_0x3ab2d9+=0x1){_0xa372dd=_0x391a08[_0x3ab2d9][_0x7cfd('0x4a')]({'plain':!![]});switch(_0xa372dd[_0x7cfd('0x47')]){case _0x7cfd('0x4b'):_0x5de403['push'](db[_0x7cfd('0x4c')][_0x7cfd('0x4d')](_0x382f4c(_0xa372dd,_0x7cfd('0x4e')))[_0x7cfd('0x25')](function(){})[_0x7cfd('0x28')](_0x15a226()));break;case _0x7cfd('0x4f'):_0x5de403[_0x7cfd('0x26')](db[_0x7cfd('0x4c')][_0x7cfd('0x4d')](_0x35530d(_0xa372dd,'VoiceQueueId'))[_0x7cfd('0x25')](function(){})['catch'](_0x15a226()));break;default:_0x5de403[_0x7cfd('0x26')](db[_0x7cfd('0x4c')]['query'](_0x2527b8(_0xa372dd,_0x7cfd('0x4e')))['then'](function(){})[_0x7cfd('0x28')](_0x15a226()));}}}return _0x5de403;})[_0x7cfd('0x50')]()[_0x7cfd('0x25')](function(){return db[_0x7cfd('0x46')][_0x7cfd('0x51')]({'where':{'type':_0x7cfd('0x52')},'attributes':['id'],'include':[{'model':db[_0x7cfd('0x48')],'as':_0x7cfd('0x53'),'where':{'id':LISTID}}]})['then'](function(_0xc3d635){var _0x556927=[];if(_0xc3d635){var _0x263a28;for(var _0x2c6b62=0x0,_0x1847e9;_0x2c6b62<_0xc3d635[_0x7cfd('0x15')];_0x2c6b62+=0x1){_0x1847e9=_0xc3d635[_0x2c6b62][_0x7cfd('0x4a')]({'plain':!![]});_0x556927[_0x7cfd('0x26')](db[_0x7cfd('0x4c')][_0x7cfd('0x4d')](_0x1e528f(_0x1847e9,_0x7cfd('0x4e')))[_0x7cfd('0x25')](function(){})[_0x7cfd('0x28')](_0x15a226()));}}return _0x556927;})[_0x7cfd('0x50')]();})[_0x7cfd('0x25')](function(){return db[_0x7cfd('0x54')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7cfd('0x48')],'as':_0x7cfd('0x49'),'where':{'id':LISTID}}]})['then'](function(_0x452007){var _0x2117c3=[];if(_0x452007){for(var _0x23889e=0x0,_0x2314d6;_0x23889e<_0x452007[_0x7cfd('0x15')];_0x23889e+=0x1){_0x2314d6=_0x452007[_0x23889e]['get']({'plain':!![]});switch(_0x2314d6[_0x7cfd('0x47')]){case'always':_0x2117c3[_0x7cfd('0x26')](db['sequelize']['query'](_0x382f4c(_0x2314d6,_0x7cfd('0x55')))[_0x7cfd('0x25')](function(){})['catch'](_0x15a226()));break;case _0x7cfd('0x4f'):_0x2117c3['push'](db[_0x7cfd('0x4c')][_0x7cfd('0x4d')](_0x35530d(_0x2314d6,_0x7cfd('0x55')))[_0x7cfd('0x25')](function(){})[_0x7cfd('0x28')](_0x15a226()));break;default:_0x2117c3['push'](db[_0x7cfd('0x4c')][_0x7cfd('0x4d')](_0x2527b8(_0x2314d6,_0x7cfd('0x55')))[_0x7cfd('0x25')](function(){})['catch'](_0x15a226()));}}}return _0x2117c3;})[_0x7cfd('0x50')]();})[_0x7cfd('0x25')](function(){return db[_0x7cfd('0x54')][_0x7cfd('0x51')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7cfd('0x53'),'where':{'id':LISTID}}]})[_0x7cfd('0x25')](function(_0x46ab4e){var _0x4b7010=[];if(_0x46ab4e){for(var _0x3ffaa4=0x0,_0x40d08b;_0x3ffaa4<_0x46ab4e['length'];_0x3ffaa4+=0x1){_0x40d08b=_0x46ab4e[_0x3ffaa4][_0x7cfd('0x4a')]({'plain':!![]});_0x4b7010['push'](db[_0x7cfd('0x4c')]['query'](_0x1e528f(_0x40d08b,'CampaignId'))[_0x7cfd('0x25')](function(){})['catch'](_0x15a226()));}}return _0x4b7010;})[_0x7cfd('0x50')]();})['catch'](function(_0x23fe70){logger[_0x7cfd('0x10')]('cmContact,\x20%s,\x20%s',_0x7cfd('0x56'),_0x23fe70[_0x7cfd('0x29')]);});}var processPromises=function(_0x24460b){return BPromise['all'](promises)[_0x7cfd('0x25')](function(_0x157f84){})['catch'](function(_0x14f788){logger[_0x7cfd('0x10')](_0x7cfd('0x57'),JSON['stringify'](_0x14f788));})['finally'](function(){socket[_0x7cfd('0x58')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x24460b){return _0x24460b[_0x7cfd('0x59')]();}});};var endCsv=function(){return BPromise[_0x7cfd('0x5a')]()[_0x7cfd('0x25')](function(){if(hopperContacts){return checkHopper();}})[_0x7cfd('0x25')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7cfd('0x5b')](FILEPATH);}catch(_0x2e63c7){logger[_0x7cfd('0x10')](_0x7cfd('0x5c'),JSON[_0x7cfd('0x2a')](_0x2e63c7));}finally{process[_0x7cfd('0x5d')](0x0);}});};process['on']('SIGINT',function(){logger[_0x7cfd('0x5e')](_0x7cfd('0x5f'));endCsv();});function main(){return BPromise['resolve']()[_0x7cfd('0x25')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7cfd('0xe')](',');return db[_0x7cfd('0x23')][_0x7cfd('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7cfd('0x25')](function(_0x5ddb4f){var _0x283580=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7cfd('0x60')](_0x283580,{'header':!![],'skipEmptyLines':!![],'step':function(_0xf67055,_0x3e72ab){total+=0x1;var _0x1c4faf=total;promises[_0x7cfd('0x26')](checkRow(_0xf67055,_0x5ddb4f,_0x1c4faf)[_0x7cfd('0x25')](function(){success+=0x1;})['catch'](function(_0x4336e0){if(_0x4336e0[_0x7cfd('0x10')]){errors+=0x1;delete _0x4336e0[_0x7cfd('0x10')];}else if(_0x4336e0[_0x7cfd('0x21')]){duplicates+=0x1;delete _0x4336e0[_0x7cfd('0x21')];}rows[_0x7cfd('0x26')](_0x4336e0);}));if(total%0xc8===0x0){_0x3e72ab['pause']();return processPromises(_0x3e72ab);}},'complete':function(){return processPromises()['then'](function(){logger[_0x7cfd('0x5e')](_0x7cfd('0x61'));endCsv();});},'error':function(_0x1e8b26,_0x5f220e){logger[_0x7cfd('0x5e')](_0x7cfd('0x62'),JSON[_0x7cfd('0x2a')](_0x1e8b26));endCsv();}});})[_0x7cfd('0x28')](function(_0x23d569){logger[_0x7cfd('0x10')](_0x7cfd('0x63'),JSON[_0x7cfd('0x2a')](_0x23d569));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 9908cfb..0f5860b 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 _0x8292=['insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','set','offset','info','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','keys','header',',utcOffset','writeFileSync','parse','createReadStream','rows','data','hasOwnProperty','replace','isValid','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','step','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','format','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','duplicates','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x8292,0x1d5));var _0x2829=function(_0x274208,_0x3182ff){_0x274208=_0x274208-0x0;var _0x209164=_0x8292[_0x274208];return _0x209164;};'use strict';var fs=require('fs');var path=require(_0x2829('0x0'));var _=require(_0x2829('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x2829('0x2'));var moment=require(_0x2829('0x3'));var squel=require('squel');var Redis=require(_0x2829('0x4'));var db=require(_0x2829('0x5'))['db'];var config=require(_0x2829('0x6'));var shared=require(_0x2829('0x7'));var logger=require(_0x2829('0x8'))(_0x2829('0x9'));config[_0x2829('0xa')]=_['defaults'](config[_0x2829('0xa')],{'host':_0x2829('0xb'),'port':0x18eb});var socket=require(_0x2829('0xc'))(new Redis(config[_0x2829('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x2829('0xd'));function isEmail(_0x27f54f){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))*$/[_0x2829('0xe')](_0x27f54f);}function selectNotIn(_0x55b8b0,_0x3c55d8,_0x48fc8a,_0x2db632,_0x422265){return squel[_0x2829('0xf')]()[_0x2829('0x10')](_0x2829('0x11'))[_0x2829('0x12')](_0x2db632)[_0x2829('0x13')](_0x3c55d8,null,_0x3c55d8+_0x2829('0x14')+_0x2db632+'.'+_0x48fc8a)[_0x2829('0x15')](_0x2db632+'.'+_0x48fc8a+_0x2829('0x16')+_0x55b8b0+'.'+_0x48fc8a)[_0x2829('0x15')](_0x3c55d8+_0x2829('0x17')+_0x422265[_0x2829('0x13')]()+')');}function insertCmHopper(_0x847f9c,_0x5c4ed6,_0x48183c,_0x3a6138,_0x34c438){var _0x58e59c=[_0x2829('0x18'),_0x2829('0x19'),_0x2829('0x1a'),_0x2829('0x1b'),_0x5c4ed6+'.'+_0x3a6138,_0x2829('0x1c'),_0x2829('0x1d'),_0x2829('0x1e'),_0x2829('0x1f'),'\x22'+_0x34c438+'\x22'];return squel[_0x2829('0x20')]()[_0x2829('0x21')](_0x2829('0x22'))[_0x2829('0x23')]([_0x2829('0x11'),_0x2829('0x24'),_0x2829('0x25'),_0x2829('0x26'),_0x3a6138,_0x2829('0x27'),_0x2829('0x28'),_0x2829('0x29'),_0x2829('0x2a'),_0x2829('0x2b')],squel[_0x2829('0xf')]()[_0x2829('0x2c')](_0x58e59c)[_0x2829('0x12')](_0x5c4ed6)[_0x2829('0x13')](_0x2829('0x2d'),null,_0x2829('0x2e')+_0x5c4ed6+_0x2829('0x2f'))[_0x2829('0x13')](_0x48183c,null,_0x48183c+'.id\x20=\x20'+_0x5c4ed6+'.'+_0x3a6138)[_0x2829('0x15')](_0x5c4ed6+_0x2829('0x30'),_0x847f9c)['where'](_0x2829('0x31'),NOW)[_0x2829('0x15')](_0x2829('0x32'),selectNotIn(_0x5c4ed6,_0x48183c,_0x3a6138,_0x2829('0x22'),[_0x2829('0x33'),_0x2829('0x34')]))['where'](_0x2829('0x32'),selectNotIn(_0x5c4ed6,_0x48183c,_0x3a6138,_0x2829('0x22'),[_0x2829('0x33')])))[_0x2829('0x35')]();}function insertCmHopperBlack(_0x5e368f,_0x22d284,_0x312129,_0x729010){var _0x395962=[_0x2829('0x18'),'cm_contacts.id','cm_contacts.ListId',_0x22d284+'.'+_0x729010,_0x2829('0x1c'),_0x2829('0x1d')];return squel[_0x2829('0x20')]()[_0x2829('0x21')]('cm_hopper_black')[_0x2829('0x23')](['phone',_0x2829('0x25'),_0x2829('0x26'),_0x729010,'createdAt',_0x2829('0x28')],squel['select']()['fields'](_0x395962)[_0x2829('0x12')](_0x22d284)[_0x2829('0x13')]('cm_contacts',null,_0x2829('0x2e')+_0x22d284+_0x2829('0x2f'))[_0x2829('0x13')](_0x312129,null,_0x312129+_0x2829('0x14')+_0x22d284+'.'+_0x729010)['where'](_0x22d284+_0x2829('0x30'),_0x5e368f)[_0x2829('0x15')](_0x2829('0x31'),NOW)[_0x2829('0x15')](_0x2829('0x32'),squel['select']()[_0x2829('0x10')](_0x2829('0x11'))[_0x2829('0x12')](_0x2829('0x36'))[_0x2829('0x15')](_0x2829('0x37'),_0x5e368f)[_0x2829('0x15')](_0x729010+_0x2829('0x38'),_0x22d284+'.'+_0x729010)))[_0x2829('0x35')]();}function insertTzCmHopper(_0x37d0b6,_0x4a32ee,_0x3f0093,_0x2fa43f,_0xd44922,_0x353abd){var _0x3c2e0e=['cm_contacts.phone',_0x2829('0x39')+_0x353abd+_0x2829('0x3a'),_0x2829('0x1a'),_0x2829('0x1b'),_0x4a32ee+'.'+_0x2fa43f,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x2829('0x1e'),'cm_contacts.UserId','\x22'+_0xd44922+'\x22'];var _0xbdce7d=squel[_0x2829('0x20')]()[_0x2829('0x21')](_0x2829('0x22'))[_0x2829('0x23')](['phone',_0x2829('0x24'),_0x2829('0x25'),_0x2829('0x26'),_0x2fa43f,_0x2829('0x27'),_0x2829('0x28'),_0x2829('0x29'),'UserId',_0x2829('0x2b')],squel['select']()[_0x2829('0x2c')](_0x3c2e0e)[_0x2829('0x12')](_0x4a32ee)['join'](_0x2829('0x2d'),null,_0x2829('0x2e')+_0x4a32ee+_0x2829('0x2f'))[_0x2829('0x13')](_0x3f0093,null,_0x3f0093+_0x2829('0x14')+_0x4a32ee+'.'+_0x2fa43f)[_0x2829('0x13')](_0x353abd,null,_0x353abd+'.id\x20=\x20'+_0x4a32ee+'.'+_0x2fa43f)['where'](_0x4a32ee+_0x2829('0x30'),_0x37d0b6)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x2829('0x32'),selectNotIn(_0x4a32ee,_0x3f0093,_0x2fa43f,'cm_hopper',[_0x2829('0x33'),_0x2829('0x34')]))[_0x2829('0x15')](_0x2829('0x32'),selectNotIn(_0x4a32ee,_0x3f0093,_0x2fa43f,_0x2829('0x22'),[_0x2829('0x33')])))[_0x2829('0x35')]();return _0xbdce7d;}function insertTzCmHopperBlack(_0x1c8b8d,_0x3d0bcf,_0x59b50e,_0x4113e8){var _0x4b9826=['cm_contacts.phone',_0x2829('0x1a'),'cm_contacts.ListId',_0x3d0bcf+'.'+_0x4113e8,_0x2829('0x1c'),_0x2829('0x1d')];return squel[_0x2829('0x20')]()['into'](_0x2829('0x36'))[_0x2829('0x23')]([_0x2829('0x11'),_0x2829('0x25'),'ListId',_0x4113e8,_0x2829('0x27'),_0x2829('0x28')],squel[_0x2829('0xf')]()[_0x2829('0x2c')](_0x4b9826)['from'](_0x3d0bcf)[_0x2829('0x13')]('cm_contacts',null,_0x2829('0x2e')+_0x3d0bcf+_0x2829('0x2f'))[_0x2829('0x13')](_0x59b50e,null,_0x59b50e+_0x2829('0x14')+_0x3d0bcf+'.'+_0x4113e8)['where'](_0x3d0bcf+'.CmListId\x20=\x20?',_0x1c8b8d)[_0x2829('0x15')](_0x2829('0x31'),NOW)[_0x2829('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x2829('0x10')]('phone')['from'](_0x2829('0x36'))[_0x2829('0x15')](_0x2829('0x37'),_0x1c8b8d)['where'](_0x4113e8+_0x2829('0x38'),_0x3d0bcf+'.'+_0x4113e8)))[_0x2829('0x35')]();}function insertCmContact(_0x1c640f,_0x5790cd,_0x278360,_0x53f275){var _0x28b97c=_['concat'](_['keys'](_0x53f275),[_0x2829('0x26'),'CompanyId',_0x2829('0x27'),_0x2829('0x28')]);return squel[_0x2829('0x20')]()[_0x2829('0x21')](_0x2829('0x2d'))[_0x2829('0x23')](_0x28b97c,squel[_0x2829('0xf')]()[_0x2829('0x2c')](_0x28b97c)['from'](_0x5790cd)[_0x2829('0x15')]('('+_0x278360[_0x2829('0x13')](',')+_0x2829('0x3b'),squel[_0x2829('0xf')]()[_0x2829('0x2c')](_0x278360)[_0x2829('0x12')](_0x2829('0x2d'))[_0x2829('0x15')](_0x2829('0x37'),_0x1c640f)['where'](_0x2829('0x3c')))[_0x2829('0x15')](_0x2829('0x3d'),squel[_0x2829('0xf')]()[_0x2829('0x10')](_0x2829('0x3e'),_0x2829('0x3f'))[_0x2829('0x12')](_0x5790cd)[_0x2829('0x40')](_0x278360[_0x2829('0x13')](','))))[_0x2829('0x35')]();}function handleStop(){logger['info'](_0x2829('0x41'));stopped=!![];}function handleUncaughtException(_0x497ae6){logger[_0x2829('0x42')](_0x497ae6[_0x2829('0x43')]);process[_0x2829('0x44')](0x1);}function handleError(_0x2a7cbd,_0x3ee7d6){stats[_0x2829('0x45')][_0x2829('0x46')]({'name':_0x3ee7d6[_0x2829('0x47')],'message':_0x3ee7d6['message'],'row':_0x2a7cbd});}function handleQuery(_0x4dc53e){logger['info'](_0x4dc53e);return db[_0x2829('0x48')][_0x2829('0x49')](_0x4dc53e)[_0x2829('0x4a')](function(_0x42c681){results['push'](_0x42c681);})[_0x2829('0x4b')](function(_0x242c5a){logger[_0x2829('0x42')](_0x242c5a['message']);});}function updateTzCampaigns(_0x2109c2){return new Promise(function(_0x592ece,_0x4af06d){var _0x105571=squel[_0x2829('0xf')]()[_0x2829('0x2c')]([_0x2829('0x4c'),_0x2829('0x4d')])['from'](_0x2829('0x4e'))[_0x2829('0x13')](_0x2829('0x4f'),null,_0x2829('0x50'))[_0x2829('0x15')](_0x2829('0x51')+_0x2109c2);db[_0x2829('0x48')][_0x2829('0x49')](_0x105571[_0x2829('0x35')]())[_0x2829('0x4a')](function(_0xddd627){var _0x3c68e6=[];for(var _0x503a6c=0x0;_0x503a6c<_0xddd627[_0x2829('0x52')];_0x503a6c++){_0x3c68e6['push'](getTimezoneData(_0xddd627[_0x503a6c],tmp_campaigns));}BPromise[_0x2829('0x53')](_0x3c68e6)[_0x2829('0x54')](function(){_0x592ece({'val':0x1});});})[_0x2829('0x4b')](function(_0x42b9b9){logger[_0x2829('0x42')](_0x42b9b9['message']);_0x592ece({'val':0x0});});});}function updateTzVoiceQueues(_0x554c6a){return new Promise(function(_0x4a8faf,_0x21d3d1){var _0x5745c4=squel[_0x2829('0xf')]()[_0x2829('0x2c')]([_0x2829('0x55'),'voice_queues.dialTimezone'])[_0x2829('0x12')](_0x2829('0x56'))['join'](_0x2829('0x57'),null,_0x2829('0x58'))[_0x2829('0x15')](_0x2829('0x59')+_0x554c6a);db[_0x2829('0x48')][_0x2829('0x49')](_0x5745c4[_0x2829('0x35')]())[_0x2829('0x4a')](function(_0x137ebd){var _0x5f57bf=[];for(var _0x2ee1f0=0x0;_0x2ee1f0<_0x137ebd[_0x2829('0x52')];_0x2ee1f0++){_0x5f57bf['push'](getTimezoneData(_0x137ebd[_0x2ee1f0],tmp_voice_queues));}BPromise[_0x2829('0x53')](_0x5f57bf)[_0x2829('0x54')](function(){_0x4a8faf({'val':0x1});});})[_0x2829('0x4b')](function(_0x405d0c){logger[_0x2829('0x42')](_0x405d0c[_0x2829('0x43')]);_0x4a8faf({'val':0x0});});});}function getTimezoneData(_0x568cf9,_0xf72806){return new Promise(function(_0x50f839,_0x2a2809){var _0x12464e=shared[_0x2829('0x5a')];var _0x29cf62=_0x12464e[_0x568cf9[_0x2829('0x5b')]];if(_[_0x2829('0x5c')](_0x29cf62)){_0x50f839({'ret':0x1});}else{var _0x33e1d1=_0x29cf62['utcOffset'];var _0xc1996=squel[_0x2829('0x20')]()[_0x2829('0x21')](_0xf72806)[_0x2829('0x5d')]('id',_0x568cf9['id'])['set'](_0x2829('0x5e'),_0x33e1d1)[_0x2829('0x5d')](_0x2829('0x5b'),_0x568cf9[_0x2829('0x5b')])[_0x2829('0x35')]();return db[_0x2829('0x48')][_0x2829('0x49')](_0xc1996)[_0x2829('0x4a')](function(_0xb78767){_0x50f839({'ret':0x1});})['catch'](function(_0x4b2906){logger[_0x2829('0x42')](_0x4b2906[_0x2829('0x43')]);_0x2a2809({'ret':0x1});});}});}function handleTZQuery(_0x17dbf6){logger[_0x2829('0x5f')](_0x17dbf6);return db['sequelize'][_0x2829('0x49')](_0x17dbf6)[_0x2829('0x4a')](function(_0x36b2d1){})[_0x2829('0x4b')](function(_0x221c10){logger[_0x2829('0x42')](_0x221c10[_0x2829('0x43')]);});}function main(_0x550de7,_0x2bd6f7,_0x3d1670,_0xfbdd5f){logger['info'](_0x2829('0x60'),_0x550de7,JSON[_0x2829('0x61')](_0x2bd6f7));process[_0x2829('0x62')](_0x2829('0x63'));var _0x158065=_0x2bd6f7[_0x2829('0x64')];var _0x4be041=_0x2bd6f7[_0x2829('0x65')];var _0x1ebb5b=path[_0x2829('0x13')](config[_0x2829('0x66')],_0x2829('0x67'),_0x4be041+_0x2829('0x68'));hasTZ=_[_0x2829('0x69')](_0x158065)['includes'](_0x2829('0x5b'));var _0x3845b2=_['keys'](_0x158065)[_0x2829('0x13')]();logger[_0x2829('0x5f')](_0x2829('0x6a'),_0x3845b2);if(hasTZ)_0x3845b2+=_0x2829('0x6b');fs[_0x2829('0x6c')](_0x1ebb5b,_0x3845b2+'\x0a');Papa[_0x2829('0x6d')](fs[_0x2829('0x6e')](_0x550de7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2fbedc,_0x3f460b){try{for(var _0x192ef0=0x0,_0xc94cb7=[];_0x192ef0<_0x2fbedc['data'][_0x2829('0x52')];_0x192ef0++){stats[_0x2829('0x6f')]+=0x1;if(_0x2fbedc[_0x2829('0x45')][_0x192ef0]){handleError(_0x2fbedc[_0x2829('0x70')][_0x192ef0],_0x2fbedc[_0x2829('0x45')][_0x192ef0]);}else{var _0xffd86d=[];for(var _0x5f3b2e in _0x158065){if(_0x158065[_0x2829('0x71')](_0x5f3b2e)){if(_0x2fbedc[_0x2829('0x70')][_0x192ef0][_0x158065[_0x5f3b2e]]){var _0x2c4068=_['trim'](_0x2fbedc[_0x2829('0x70')][_0x192ef0][_0x158065[_0x5f3b2e]][_0x2829('0x72')](/"/g,'\x27'));switch(_0x5f3b2e){case _0x2829('0x24'):var _0x4ac5af=moment(_0x2c4068,_0x2829('0xd'),!![]);if(_0x4ac5af[_0x2829('0x73')]()){_0xc94cb7[_0x2829('0x46')]('\x22'+_0x2c4068+'\x22');}else{_0xffd86d[_0x2829('0x46')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x2829('0x29'):var _0x3c8b0f=parseInt(_0x2c4068);_0x2c4068=_[_0x2829('0x74')](_0x3c8b0f)||_0x3c8b0f<0x0||_0x3c8b0f>0x4?_0xfbdd5f?0x3:0x2:_0x3c8b0f;_0xc94cb7[_0x2829('0x46')]('\x22'+_0x2c4068+'\x22');break;case _0x2829('0x2a'):var _0x37571b=parseInt(_0x2c4068);if(_[_0x2829('0x75')](_0x37571b)&&_[_0x2829('0x76')](_0x3d1670,_0x37571b)){_0xc94cb7[_0x2829('0x46')]('\x22'+_0x37571b+'\x22');}else{_0xffd86d[_0x2829('0x46')](_0x2829('0x77'));}break;case _0x2829('0x78'):if(isEmail(_0x2c4068)){_0xc94cb7[_0x2829('0x46')]('\x22'+_0x2c4068+'\x22');}else{_0xffd86d[_0x2829('0x46')](_0x2829('0x79'));}break;case _0x2829('0x7a'):var _0x119019=moment(_0x2c4068,_0x2829('0x7b'),!![]);if(_0x119019[_0x2829('0x73')]()){_0xc94cb7[_0x2829('0x46')]('\x22'+_0x2c4068+'\x22');}else{_0xffd86d[_0x2829('0x46')](_0x2829('0x7c'));}break;case _0x2829('0x5b'):var _0x1a407c=shared['timezones'];var _0x4834c3=_0x1a407c[_0x2c4068];if(!_[_0x2829('0x5c')](_0x4834c3)){var _0x15b36e=_0x4834c3[_0x2829('0x7d')];_0xc94cb7[_0x2829('0x46')]('\x22'+_0x2c4068+'\x22');_0xc94cb7['push']('\x22'+_0x15b36e+'\x22');}break;default:_0xc94cb7['push']('\x22'+_0x2c4068+'\x22');}}else{switch(_0x5f3b2e){case _0x2829('0x7e'):case _0x2829('0x11'):_0xffd86d[_0x2829('0x46')](_0x5f3b2e+_0x2829('0x7f'));break;default:_0xc94cb7[_0x2829('0x46')]('\x22\x22');}}}}if(_0xffd86d['length']){handleError(_0x2fbedc[_0x2829('0x70')][_0x192ef0],{'code':_0x2829('0x80'),'message':_0xffd86d['join']()});}else{fs[_0x2829('0x81')](_0x1ebb5b,_0xc94cb7[_0x2829('0x13')]()+'\x0a');}_0xc94cb7=[];}if(!(stats[_0x2829('0x6f')]%0xc8)){socket[_0x2829('0x82')](_0x2829('0x83')+_0x4be041,stats);stats[_0x2829('0x45')]=[];}}if(stopped){logger[_0x2829('0x5f')](_0x2829('0x84'));_0x3f460b['abort']();}}catch(_0x38f403){handleError(_0x2fbedc[_0x2829('0x70')][_0x192ef0],{'code':_0x2829('0x85'),'message':_0x38f403['message']});logger[_0x2829('0x42')](_0x2829('0x86'),_0x38f403[_0x2829('0x43')]);}},'complete':function(){try{var _0x1cb413=[];var _0x339950=[];var _0x320206=_0x2829('0x2d');if(_0x2bd6f7['duplicates']&&_0x2bd6f7['duplicates']['length']){_0x320206=_0x2829('0x87')+_0x4be041;_0x1cb413['push']('CREATE\x20TABLE\x20'+_0x320206+_0x2829('0x88'));}tmp_campaigns=_0x2829('0x89')+_0x4be041;tmp_voice_queues=_0x2829('0x8a')+_0x4be041;_0x339950['push'](_0x2829('0x8b')+tmp_campaigns+_0x2829('0x8c'));_0x339950[_0x2829('0x46')](_0x2829('0x8b')+tmp_voice_queues+_0x2829('0x8c'));BPromise[_0x2829('0x8d')](_0x339950,handleTZQuery)[_0x2829('0x54')](function(_0x24d4ea){updateTzCampaigns(_0x2bd6f7[_0x2829('0x26')])['then'](function(_0x3c7948){updateTzVoiceQueues(_0x2bd6f7[_0x2829('0x26')])[_0x2829('0x54')](function(_0x5160f3){var _0x3ce6f6=util[_0x2829('0x8e')](_0x2829('0x8f'),_0x1ebb5b,_0x320206,_0x3845b2,_0x2bd6f7[_0x2829('0x26')],_0x2bd6f7[_0x2829('0x90')]||null,NOW,NOW);if(_['isNil'](_0x158065['scheduledat'])){_0x3ce6f6+=_0x2829('0x91');}_0x1cb413[_0x2829('0x46')](_0x3ce6f6);if(_0x2bd6f7[_0x2829('0x92')]&&_0x2bd6f7['duplicates'][_0x2829('0x52')]){_0x1cb413['push'](insertCmContact(_0x2bd6f7[_0x2829('0x26')],_0x320206,_0x2bd6f7[_0x2829('0x92')],_0x158065));_0x1cb413[_0x2829('0x46')](_0x2829('0x93')+_0x320206+';');}if(hasTZ){_0x1cb413[_0x2829('0x46')](insertTzCmHopper(_0x2bd6f7['ListId'],_0x2829('0x57'),'voice_queues',_0x2829('0x94'),_0xfbdd5f,tmp_voice_queues));_0x1cb413['push'](insertTzCmHopperBlack(_0x2bd6f7[_0x2829('0x26')],_0x2829('0x95'),_0x2829('0x56'),_0x2829('0x94')));_0x1cb413['push'](insertTzCmHopper(_0x2bd6f7[_0x2829('0x26')],_0x2829('0x4f'),_0x2829('0x4e'),'CampaignId',_0xfbdd5f,tmp_campaigns));_0x1cb413['push'](insertTzCmHopperBlack(_0x2bd6f7[_0x2829('0x26')],'campaigns_has_cm_blacklists','campaigns',_0x2829('0x96')));}else{_0x1cb413[_0x2829('0x46')](insertCmHopper(_0x2bd6f7[_0x2829('0x26')],_0x2829('0x57'),_0x2829('0x56'),_0x2829('0x94'),_0xfbdd5f));_0x1cb413[_0x2829('0x46')](insertCmHopperBlack(_0x2bd6f7['ListId'],_0x2829('0x95'),_0x2829('0x56'),_0x2829('0x94')));_0x1cb413[_0x2829('0x46')](insertCmHopper(_0x2bd6f7['ListId'],_0x2829('0x4f'),'campaigns','CampaignId',_0xfbdd5f));_0x1cb413[_0x2829('0x46')](insertCmHopperBlack(_0x2bd6f7[_0x2829('0x26')],_0x2829('0x97'),_0x2829('0x4e'),_0x2829('0x96')));}_0x1cb413[_0x2829('0x46')](_0x2829('0x93')+tmp_campaigns+';');_0x1cb413[_0x2829('0x46')](_0x2829('0x93')+tmp_voice_queues+';');BPromise['each'](_0x1cb413,handleQuery)[_0x2829('0x54')](function(_0x19116c){stats[_0x2829('0x98')]=!![];stats[_0x2829('0x99')]=_0x2bd6f7['duplicates']&&_0x2bd6f7[_0x2829('0x92')][_0x2829('0x52')]?results[0x2][_0x2829('0x99')]:results[0x0]['affectedRows'];socket['emit'](_0x2829('0x83')+_0x4be041,stats);fs['unlink'](_0x550de7);fs[_0x2829('0x9a')](_0x1ebb5b);process[_0x2829('0x44')](0x0);})['catch'](function(_0x1b3457){logger[_0x2829('0x42')](_0x1b3457['message']);process[_0x2829('0x44')](0x1);});});});});}catch(_0xf22d01){logger[_0x2829('0x42')](_0x2829('0x9b'),_0xf22d01[_0x2829('0x43')]);process[_0x2829('0x44')](0x1);}},'error':function(_0x98af24,_0x167e81,_0x334607,_0x32b508){throw new Error(_0x32b508);}});}function validate(){if(process[_0x2829('0x9c')]&&process['argv']['length']<0x4){throw new Error(_0x2829('0x9d'));}var _0x572dfa=path['join'](config[_0x2829('0x66')],_0x2829('0x67'),process[_0x2829('0x9c')][0x2]);if(!fs[_0x2829('0x9e')](_0x572dfa)){throw new Error(_0x2829('0x9f'));}var _0x437da5={};try{_0x437da5=JSON[_0x2829('0x6d')](process[_0x2829('0x9c')][0x3]);if(!_0x437da5[_0x2829('0x64')]){throw new Error(_0x2829('0xa0'));}if(!_0x437da5['binding'][_0x2829('0x11')]){throw new Error(_0x2829('0xa1'));}if(!_0x437da5[_0x2829('0x64')][_0x2829('0x7e')]){throw new Error('firstName\x20is\x20mandatory');}var _0x22f095=0x0;if(_0x437da5[_0x2829('0x64')]['UserId']){_0x22f095=0x1;}if(!_0x437da5[_0x2829('0x26')]){throw new Error(_0x2829('0xa2'));}}catch(_0x11e8fd){throw new Error(_0x2829('0xa3'));}var _0x3390b1=[];try{_0x3390b1=_[_0x2829('0xa4')](JSON[_0x2829('0x6d')](process[_0x2829('0x9c')][0x4]),'id');}catch(_0x141d05){logger['info'](_0x2829('0xa5'));}main(_0x572dfa,_0x437da5,_0x3390b1,_0x22f095);}validate();process['on'](_0x2829('0xa6'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x7cf4=['voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','CampaignId','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','from','where','\x20=\x20','join','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','fromQuery','scheduledat','ContactId','ListId','updatedAt','recallme','select','fields','cm_contacts','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_hopper_black','phone','createdAt','cm_contacts.ListId\x20=\x20','\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','insert','priority','UserId','ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','field','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','push','all','then','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','timezones','dialTimezone','isNil','set','offset','main','stringify','start','binding','socket_timestamp','root','server/files/tmp','.csv','includes','header',',utcOffset','parse','createReadStream','data','rows','errors','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','SystemRow','appendFileSync','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','(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','DROP\x20TABLE\x20','VoiceQueueId'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x7cf4,0xb0));var _0x47cf=function(_0x2f700b,_0x1508cd){_0x2f700b=_0x2f700b-0x0;var _0x368f17=_0x7cf4[_0x2f700b];return _0x368f17;};'use strict';var fs=require('fs');var path=require(_0x47cf('0x0'));var _=require(_0x47cf('0x1'));var Papa=require(_0x47cf('0x2'));var util=require(_0x47cf('0x3'));var BPromise=require(_0x47cf('0x4'));var moment=require(_0x47cf('0x5'));var squel=require('squel');var Redis=require(_0x47cf('0x6'));var db=require(_0x47cf('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x47cf('0x8'));var logger=require(_0x47cf('0x9'))('import');config[_0x47cf('0xa')]=_[_0x47cf('0xb')](config['redis'],{'host':_0x47cf('0xc'),'port':0x18eb});var socket=require(_0x47cf('0xd'))(new Redis(config[_0x47cf('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x47cf('0xe')](_0x47cf('0xf'));function isEmail(_0x5119ea){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x5119ea);}function selectNotIn(_0x182f83,_0x280837,_0x44c654,_0x5b4284,_0x3f4466){return squel['select']()['field']('phone')[_0x47cf('0x10')](_0x5b4284)['join'](_0x280837,null,_0x280837+'.id\x20=\x20'+_0x5b4284+'.'+_0x44c654)[_0x47cf('0x11')](_0x5b4284+'.'+_0x44c654+_0x47cf('0x12')+_0x182f83+'.'+_0x44c654)['where'](_0x280837+'.dialCheckDuplicateType\x20IN\x20('+_0x3f4466[_0x47cf('0x13')]()+')');}function insertCmHopper(_0x5eca93,_0x1640db,_0xab2e31,_0x1ec242,_0xf13a4f){var _0x906f57=['cm_contacts.phone',_0x47cf('0x14'),_0x47cf('0x15'),_0x47cf('0x16'),_0x1640db+'.'+_0x1ec242,_0x47cf('0x17'),_0x47cf('0x18'),_0x47cf('0x19'),_0x47cf('0x1a'),'\x22'+_0xf13a4f+'\x22'];return squel['insert']()[_0x47cf('0x1b')]('cm_hopper')[_0x47cf('0x1c')](['phone',_0x47cf('0x1d'),_0x47cf('0x1e'),_0x47cf('0x1f'),_0x1ec242,'createdAt',_0x47cf('0x20'),'priority','UserId',_0x47cf('0x21')],squel[_0x47cf('0x22')]()[_0x47cf('0x23')](_0x906f57)[_0x47cf('0x10')](_0x1640db)[_0x47cf('0x13')](_0x47cf('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x1640db+_0x47cf('0x25'))[_0x47cf('0x13')](_0xab2e31,null,_0xab2e31+_0x47cf('0x26')+_0x1640db+'.'+_0x1ec242)[_0x47cf('0x11')](_0x1640db+_0x47cf('0x27'),_0x5eca93)[_0x47cf('0x11')](_0x47cf('0x28'),NOW)[_0x47cf('0x11')](_0x47cf('0x29'),selectNotIn(_0x1640db,_0xab2e31,_0x1ec242,_0x47cf('0x2a'),[_0x47cf('0x2b'),_0x47cf('0x2c')]))[_0x47cf('0x11')](_0x47cf('0x29'),selectNotIn(_0x1640db,_0xab2e31,_0x1ec242,_0x47cf('0x2a'),[_0x47cf('0x2b')])))[_0x47cf('0x2d')]();}function insertCmHopperBlack(_0x1a91e6,_0x49bdc4,_0x665eab,_0x539fe7){var _0x32e531=[_0x47cf('0x2e'),'cm_contacts.id','cm_contacts.ListId',_0x49bdc4+'.'+_0x539fe7,'cm_contacts.createdAt',_0x47cf('0x18')];return squel['insert']()['into'](_0x47cf('0x2f'))['fromQuery']([_0x47cf('0x30'),_0x47cf('0x1e'),_0x47cf('0x1f'),_0x539fe7,_0x47cf('0x31'),_0x47cf('0x20')],squel[_0x47cf('0x22')]()[_0x47cf('0x23')](_0x32e531)[_0x47cf('0x10')](_0x49bdc4)['join'](_0x47cf('0x24'),null,_0x47cf('0x32')+_0x49bdc4+'.CmListId')[_0x47cf('0x13')](_0x665eab,null,_0x665eab+'.id\x20=\x20'+_0x49bdc4+'.'+_0x539fe7)[_0x47cf('0x11')](_0x49bdc4+_0x47cf('0x27'),_0x1a91e6)[_0x47cf('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x47cf('0x11')](_0x47cf('0x29'),squel[_0x47cf('0x22')]()['field'](_0x47cf('0x30'))['from'](_0x47cf('0x2f'))[_0x47cf('0x11')]('ListId\x20=\x20?',_0x1a91e6)['where'](_0x539fe7+_0x47cf('0x33'),_0x49bdc4+'.'+_0x539fe7)))[_0x47cf('0x2d')]();}function insertTzCmHopper(_0x3d6e26,_0x2f9852,_0x18530d,_0x28051d,_0x4e5e21,_0x5bfedd){var _0x36a7ab=[_0x47cf('0x2e'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x5bfedd+_0x47cf('0x34'),_0x47cf('0x15'),_0x47cf('0x16'),_0x2f9852+'.'+_0x28051d,_0x47cf('0x17'),'cm_contacts.updatedAt',_0x47cf('0x19'),_0x47cf('0x1a'),'\x22'+_0x4e5e21+'\x22'];var _0x67a8c5=squel[_0x47cf('0x35')]()['into'](_0x47cf('0x2a'))[_0x47cf('0x1c')]([_0x47cf('0x30'),'scheduledat',_0x47cf('0x1e'),'ListId',_0x28051d,'createdAt',_0x47cf('0x20'),_0x47cf('0x36'),_0x47cf('0x37'),_0x47cf('0x21')],squel['select']()[_0x47cf('0x23')](_0x36a7ab)[_0x47cf('0x10')](_0x2f9852)['join'](_0x47cf('0x24'),null,_0x47cf('0x32')+_0x2f9852+_0x47cf('0x25'))[_0x47cf('0x13')](_0x18530d,null,_0x18530d+'.id\x20=\x20'+_0x2f9852+'.'+_0x28051d)[_0x47cf('0x13')](_0x5bfedd,null,_0x5bfedd+_0x47cf('0x26')+_0x2f9852+'.'+_0x28051d)[_0x47cf('0x11')](_0x2f9852+'.CmListId\x20=\x20?',_0x3d6e26)[_0x47cf('0x11')](_0x47cf('0x28'),NOW)[_0x47cf('0x11')](_0x47cf('0x29'),selectNotIn(_0x2f9852,_0x18530d,_0x28051d,_0x47cf('0x2a'),[_0x47cf('0x2b'),_0x47cf('0x2c')]))[_0x47cf('0x11')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2f9852,_0x18530d,_0x28051d,_0x47cf('0x2a'),[_0x47cf('0x2b')])))[_0x47cf('0x2d')]();return _0x67a8c5;}function insertTzCmHopperBlack(_0x247ed6,_0x38cf5c,_0x53fdb3,_0x5766e1){var _0x3ad3b3=[_0x47cf('0x2e'),_0x47cf('0x15'),_0x47cf('0x16'),_0x38cf5c+'.'+_0x5766e1,_0x47cf('0x17'),'cm_contacts.updatedAt'];return squel[_0x47cf('0x35')]()[_0x47cf('0x1b')](_0x47cf('0x2f'))[_0x47cf('0x1c')]([_0x47cf('0x30'),_0x47cf('0x1e'),'ListId',_0x5766e1,_0x47cf('0x31'),_0x47cf('0x20')],squel[_0x47cf('0x22')]()[_0x47cf('0x23')](_0x3ad3b3)[_0x47cf('0x10')](_0x38cf5c)[_0x47cf('0x13')](_0x47cf('0x24'),null,_0x47cf('0x32')+_0x38cf5c+'.CmListId')[_0x47cf('0x13')](_0x53fdb3,null,_0x53fdb3+_0x47cf('0x26')+_0x38cf5c+'.'+_0x5766e1)['where'](_0x38cf5c+'.CmListId\x20=\x20?',_0x247ed6)['where'](_0x47cf('0x28'),NOW)[_0x47cf('0x11')](_0x47cf('0x29'),squel[_0x47cf('0x22')]()['field'](_0x47cf('0x30'))[_0x47cf('0x10')](_0x47cf('0x2f'))[_0x47cf('0x11')](_0x47cf('0x38'),_0x247ed6)['where'](_0x5766e1+'\x20=\x20?',_0x38cf5c+'.'+_0x5766e1)))[_0x47cf('0x2d')]();}function insertCmContact(_0x25741a,_0x125d78,_0x23b6eb,_0x2cd57c){var _0x171aa5=_[_0x47cf('0x39')](_[_0x47cf('0x3a')](_0x2cd57c),[_0x47cf('0x1f'),_0x47cf('0x3b'),_0x47cf('0x31'),_0x47cf('0x20')]);return squel[_0x47cf('0x35')]()[_0x47cf('0x1b')](_0x47cf('0x24'))[_0x47cf('0x1c')](_0x171aa5,squel[_0x47cf('0x22')]()[_0x47cf('0x23')](_0x171aa5)[_0x47cf('0x10')](_0x125d78)[_0x47cf('0x11')]('('+_0x23b6eb[_0x47cf('0x13')](',')+_0x47cf('0x3c'),squel[_0x47cf('0x22')]()['fields'](_0x23b6eb)[_0x47cf('0x10')](_0x47cf('0x24'))[_0x47cf('0x11')](_0x47cf('0x38'),_0x25741a)[_0x47cf('0x11')]('deletedAt\x20IS\x20NULL'))[_0x47cf('0x11')](_0x47cf('0x3d'),squel[_0x47cf('0x22')]()[_0x47cf('0x3e')](_0x47cf('0x3f'),_0x47cf('0x40'))[_0x47cf('0x10')](_0x125d78)[_0x47cf('0x41')](_0x23b6eb[_0x47cf('0x13')](','))))[_0x47cf('0x2d')]();}function handleStop(){logger[_0x47cf('0x42')](_0x47cf('0x43'));stopped=!![];}function handleUncaughtException(_0x5d39ab){logger[_0x47cf('0x44')](_0x5d39ab[_0x47cf('0x45')]);process[_0x47cf('0x46')](0x1);}function handleError(_0x2a6e28,_0x755df2){stats['errors']['push']({'name':_0x755df2[_0x47cf('0x47')],'message':_0x755df2['message'],'row':_0x2a6e28});}function handleQuery(_0x43bed8){logger['info'](_0x43bed8);return db[_0x47cf('0x48')][_0x47cf('0x49')](_0x43bed8)[_0x47cf('0x4a')](function(_0x1a4b4e){results['push'](_0x1a4b4e);})[_0x47cf('0x4b')](function(_0x293041){logger[_0x47cf('0x44')](_0x293041[_0x47cf('0x45')]);});}function updateTzCampaigns(_0x2f584a){return new Promise(function(_0x5202bf,_0x11eb9e){var _0x1f26ff=squel[_0x47cf('0x22')]()[_0x47cf('0x23')]([_0x47cf('0x4c'),_0x47cf('0x4d')])[_0x47cf('0x10')](_0x47cf('0x4e'))['join'](_0x47cf('0x4f'),null,_0x47cf('0x50'))['where'](_0x47cf('0x51')+_0x2f584a);db[_0x47cf('0x48')]['query'](_0x1f26ff[_0x47cf('0x2d')]())['spread'](function(_0x4b1316){var _0x2202e5=[];for(var _0xc32a91=0x0;_0xc32a91<_0x4b1316[_0x47cf('0x52')];_0xc32a91++){_0x2202e5[_0x47cf('0x53')](getTimezoneData(_0x4b1316[_0xc32a91],tmp_campaigns));}BPromise[_0x47cf('0x54')](_0x2202e5)[_0x47cf('0x55')](function(){_0x5202bf({'val':0x1});});})['catch'](function(_0x5235b5){logger[_0x47cf('0x44')](_0x5235b5[_0x47cf('0x45')]);_0x5202bf({'val':0x0});});});}function updateTzVoiceQueues(_0x21cce8){return new Promise(function(_0x11b811,_0xf24298){var _0x39883f=squel[_0x47cf('0x22')]()[_0x47cf('0x23')]([_0x47cf('0x56'),_0x47cf('0x57')])['from'](_0x47cf('0x58'))[_0x47cf('0x13')](_0x47cf('0x59'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where']('voice_queues_has_cm_lists.CmListId='+_0x21cce8);db[_0x47cf('0x48')][_0x47cf('0x49')](_0x39883f[_0x47cf('0x2d')]())[_0x47cf('0x4a')](function(_0x10becd){var _0x1bc954=[];for(var _0x2b0800=0x0;_0x2b0800<_0x10becd['length'];_0x2b0800++){_0x1bc954[_0x47cf('0x53')](getTimezoneData(_0x10becd[_0x2b0800],tmp_voice_queues));}BPromise[_0x47cf('0x54')](_0x1bc954)['then'](function(){_0x11b811({'val':0x1});});})[_0x47cf('0x4b')](function(_0x1fae9c){logger['error'](_0x1fae9c[_0x47cf('0x45')]);_0x11b811({'val':0x0});});});}function getTimezoneData(_0x18ad8e,_0x7130a9){return new Promise(function(_0x15c691,_0x1654cd){var _0x347563=shared[_0x47cf('0x5a')];var _0x518678=_0x347563[_0x18ad8e[_0x47cf('0x5b')]];if(_[_0x47cf('0x5c')](_0x518678)){_0x15c691({'ret':0x1});}else{var _0x10c669=_0x518678['utcOffset'];var _0x46e520=squel[_0x47cf('0x35')]()[_0x47cf('0x1b')](_0x7130a9)[_0x47cf('0x5d')]('id',_0x18ad8e['id'])[_0x47cf('0x5d')](_0x47cf('0x5e'),_0x10c669)['set'](_0x47cf('0x5b'),_0x18ad8e[_0x47cf('0x5b')])['toString']();return db[_0x47cf('0x48')][_0x47cf('0x49')](_0x46e520)[_0x47cf('0x4a')](function(_0xed149){_0x15c691({'ret':0x1});})[_0x47cf('0x4b')](function(_0x16df19){logger[_0x47cf('0x44')](_0x16df19[_0x47cf('0x45')]);_0x1654cd({'ret':0x1});});}});}function handleTZQuery(_0x2f9383){logger['info'](_0x2f9383);return db[_0x47cf('0x48')][_0x47cf('0x49')](_0x2f9383)[_0x47cf('0x4a')](function(_0x61b4d1){})[_0x47cf('0x4b')](function(_0xb0deb2){logger[_0x47cf('0x44')](_0xb0deb2[_0x47cf('0x45')]);});}function main(_0x2781fb,_0x57fb07,_0x3cc368,_0x4f73b6){logger[_0x47cf('0x42')](_0x47cf('0x5f'),_0x2781fb,JSON[_0x47cf('0x60')](_0x57fb07));process['send'](_0x47cf('0x61'));var _0x5cdf63=_0x57fb07[_0x47cf('0x62')];var _0x206013=_0x57fb07[_0x47cf('0x63')];var _0x191242=path[_0x47cf('0x13')](config[_0x47cf('0x64')],_0x47cf('0x65'),_0x206013+_0x47cf('0x66'));hasTZ=_[_0x47cf('0x3a')](_0x5cdf63)[_0x47cf('0x67')](_0x47cf('0x5b'));var _0x29162a=_[_0x47cf('0x3a')](_0x5cdf63)[_0x47cf('0x13')]();logger[_0x47cf('0x42')](_0x47cf('0x68'),_0x29162a);if(hasTZ)_0x29162a+=_0x47cf('0x69');fs['writeFileSync'](_0x191242,_0x29162a+'\x0a');Papa[_0x47cf('0x6a')](fs[_0x47cf('0x6b')](_0x2781fb),{'header':!![],'skipEmptyLines':!![],'step':function(_0x14bb5e,_0x2451c8){try{for(var _0x487a16=0x0,_0x1c6c35=[];_0x487a16<_0x14bb5e[_0x47cf('0x6c')]['length'];_0x487a16++){stats[_0x47cf('0x6d')]+=0x1;if(_0x14bb5e[_0x47cf('0x6e')][_0x487a16]){handleError(_0x14bb5e[_0x47cf('0x6c')][_0x487a16],_0x14bb5e['errors'][_0x487a16]);}else{var _0x2fed35=[];for(var _0x589edd in _0x5cdf63){if(_0x5cdf63[_0x47cf('0x6f')](_0x589edd)){if(_0x14bb5e[_0x47cf('0x6c')][_0x487a16][_0x5cdf63[_0x589edd]]){var _0x3a07e2=_[_0x47cf('0x70')](_0x14bb5e[_0x47cf('0x6c')][_0x487a16][_0x5cdf63[_0x589edd]][_0x47cf('0x71')](/"/g,'\x27'));switch(_0x589edd){case _0x47cf('0x1d'):var _0x5d487b=moment(_0x3a07e2,_0x47cf('0xf'),!![]);if(_0x5d487b[_0x47cf('0x72')]()){_0x1c6c35[_0x47cf('0x53')]('\x22'+_0x3a07e2+'\x22');}else{_0x2fed35[_0x47cf('0x53')](_0x47cf('0x73'));}break;case _0x47cf('0x36'):var _0x1ee900=parseInt(_0x3a07e2);_0x3a07e2=_[_0x47cf('0x74')](_0x1ee900)||_0x1ee900<0x0||_0x1ee900>0x4?_0x4f73b6?0x3:0x2:_0x1ee900;_0x1c6c35[_0x47cf('0x53')]('\x22'+_0x3a07e2+'\x22');break;case _0x47cf('0x37'):var _0x3165df=parseInt(_0x3a07e2);if(_[_0x47cf('0x75')](_0x3165df)&&_['includes'](_0x3cc368,_0x3165df)){_0x1c6c35['push']('\x22'+_0x3165df+'\x22');}else{_0x2fed35[_0x47cf('0x53')](_0x47cf('0x76'));}break;case _0x47cf('0x77'):if(isEmail(_0x3a07e2)){_0x1c6c35[_0x47cf('0x53')]('\x22'+_0x3a07e2+'\x22');}else{_0x2fed35['push'](_0x47cf('0x78'));}break;case _0x47cf('0x79'):var _0x3f673e=moment(_0x3a07e2,_0x47cf('0x7a'),!![]);if(_0x3f673e[_0x47cf('0x72')]()){_0x1c6c35['push']('\x22'+_0x3a07e2+'\x22');}else{_0x2fed35[_0x47cf('0x53')](_0x47cf('0x7b'));}break;case _0x47cf('0x5b'):var _0x1446cd=shared[_0x47cf('0x5a')];var _0x58d339=_0x1446cd[_0x3a07e2];if(!_[_0x47cf('0x5c')](_0x58d339)){var _0x59ed82=_0x58d339[_0x47cf('0x7c')];_0x1c6c35[_0x47cf('0x53')]('\x22'+_0x3a07e2+'\x22');_0x1c6c35[_0x47cf('0x53')]('\x22'+_0x59ed82+'\x22');}break;default:_0x1c6c35[_0x47cf('0x53')]('\x22'+_0x3a07e2+'\x22');}}else{switch(_0x589edd){case _0x47cf('0x7d'):case'phone':_0x2fed35[_0x47cf('0x53')](_0x589edd+'\x20not\x20specified');break;default:_0x1c6c35[_0x47cf('0x53')]('\x22\x22');}}}}if(_0x2fed35[_0x47cf('0x52')]){handleError(_0x14bb5e[_0x47cf('0x6c')][_0x487a16],{'code':_0x47cf('0x7e'),'message':_0x2fed35[_0x47cf('0x13')]()});}else{fs[_0x47cf('0x7f')](_0x191242,_0x1c6c35[_0x47cf('0x13')]()+'\x0a');}_0x1c6c35=[];}if(!(stats[_0x47cf('0x6d')]%0xc8)){socket['emit'](_0x47cf('0x80')+_0x206013,stats);stats[_0x47cf('0x6e')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x2451c8[_0x47cf('0x81')]();}}catch(_0x59fdc3){handleError(_0x14bb5e[_0x47cf('0x6c')][_0x487a16],{'code':_0x47cf('0x82'),'message':_0x59fdc3[_0x47cf('0x45')]});logger[_0x47cf('0x44')](_0x47cf('0x83'),_0x59fdc3[_0x47cf('0x45')]);}},'complete':function(){try{var _0x1a4a36=[];var _0x5d48c9=[];var _0x2dd0ee=_0x47cf('0x24');if(_0x57fb07[_0x47cf('0x84')]&&_0x57fb07['duplicates'][_0x47cf('0x52')]){_0x2dd0ee=_0x47cf('0x85')+_0x206013;_0x1a4a36[_0x47cf('0x53')](_0x47cf('0x86')+_0x2dd0ee+_0x47cf('0x87'));}tmp_campaigns='campaigns_'+_0x206013;tmp_voice_queues=_0x47cf('0x88')+_0x206013;_0x5d48c9[_0x47cf('0x53')](_0x47cf('0x86')+tmp_campaigns+_0x47cf('0x89'));_0x5d48c9[_0x47cf('0x53')](_0x47cf('0x86')+tmp_voice_queues+_0x47cf('0x89'));BPromise[_0x47cf('0x8a')](_0x5d48c9,handleTZQuery)[_0x47cf('0x55')](function(_0x110969){updateTzCampaigns(_0x57fb07[_0x47cf('0x1f')])[_0x47cf('0x55')](function(_0x25377f){updateTzVoiceQueues(_0x57fb07[_0x47cf('0x1f')])['then'](function(_0x4bbc47){var _0x8dcbac=util['format'](_0x47cf('0x8b'),_0x191242,_0x2dd0ee,_0x29162a,_0x57fb07['ListId'],_0x57fb07[_0x47cf('0x3b')]||null,NOW,NOW);if(_[_0x47cf('0x5c')](_0x5cdf63[_0x47cf('0x1d')])){_0x8dcbac+=',\x20scheduledAt\x20=\x20NOW()';}_0x1a4a36['push'](_0x8dcbac);if(_0x57fb07['duplicates']&&_0x57fb07[_0x47cf('0x84')][_0x47cf('0x52')]){_0x1a4a36[_0x47cf('0x53')](insertCmContact(_0x57fb07['ListId'],_0x2dd0ee,_0x57fb07['duplicates'],_0x5cdf63));_0x1a4a36[_0x47cf('0x53')](_0x47cf('0x8c')+_0x2dd0ee+';');}if(hasTZ){_0x1a4a36['push'](insertTzCmHopper(_0x57fb07[_0x47cf('0x1f')],_0x47cf('0x59'),_0x47cf('0x58'),_0x47cf('0x8d'),_0x4f73b6,tmp_voice_queues));_0x1a4a36[_0x47cf('0x53')](insertTzCmHopperBlack(_0x57fb07[_0x47cf('0x1f')],_0x47cf('0x8e'),'voice_queues','VoiceQueueId'));_0x1a4a36[_0x47cf('0x53')](insertTzCmHopper(_0x57fb07[_0x47cf('0x1f')],_0x47cf('0x4f'),_0x47cf('0x4e'),'CampaignId',_0x4f73b6,tmp_campaigns));_0x1a4a36['push'](insertTzCmHopperBlack(_0x57fb07['ListId'],_0x47cf('0x8f'),'campaigns',_0x47cf('0x90')));}else{_0x1a4a36[_0x47cf('0x53')](insertCmHopper(_0x57fb07[_0x47cf('0x1f')],_0x47cf('0x59'),_0x47cf('0x58'),_0x47cf('0x8d'),_0x4f73b6));_0x1a4a36['push'](insertCmHopperBlack(_0x57fb07[_0x47cf('0x1f')],'voice_queues_has_cm_blacklists',_0x47cf('0x58'),_0x47cf('0x8d')));_0x1a4a36[_0x47cf('0x53')](insertCmHopper(_0x57fb07[_0x47cf('0x1f')],'campaigns_has_cm_lists',_0x47cf('0x4e'),_0x47cf('0x90'),_0x4f73b6));_0x1a4a36[_0x47cf('0x53')](insertCmHopperBlack(_0x57fb07[_0x47cf('0x1f')],_0x47cf('0x8f'),_0x47cf('0x4e'),'CampaignId'));}_0x1a4a36[_0x47cf('0x53')](_0x47cf('0x8c')+tmp_campaigns+';');_0x1a4a36[_0x47cf('0x53')](_0x47cf('0x8c')+tmp_voice_queues+';');BPromise['each'](_0x1a4a36,handleQuery)[_0x47cf('0x55')](function(_0x58ea61){stats[_0x47cf('0x91')]=!![];stats[_0x47cf('0x92')]=_0x57fb07['duplicates']&&_0x57fb07[_0x47cf('0x84')][_0x47cf('0x52')]?results[0x2][_0x47cf('0x92')]:results[0x0][_0x47cf('0x92')];socket[_0x47cf('0x93')]('contact:import:'+_0x206013,stats);fs[_0x47cf('0x94')](_0x2781fb);fs['unlink'](_0x191242);process[_0x47cf('0x46')](0x0);})[_0x47cf('0x4b')](function(_0x34901a){logger[_0x47cf('0x44')](_0x34901a['message']);process[_0x47cf('0x46')](0x1);});});});});}catch(_0x2dc9b4){logger[_0x47cf('0x44')](_0x47cf('0x95'),_0x2dc9b4[_0x47cf('0x45')]);process[_0x47cf('0x46')](0x1);}},'error':function(_0x30b2e1,_0x2f449e,_0x5aba97,_0x39b90b){throw new Error(_0x39b90b);}});}function validate(){if(process['argv']&&process[_0x47cf('0x96')][_0x47cf('0x52')]<0x4){throw new Error(_0x47cf('0x97'));}var _0x13bd21=path['join'](config[_0x47cf('0x64')],_0x47cf('0x65'),process['argv'][0x2]);if(!fs['existsSync'](_0x13bd21)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x32d75a={};try{_0x32d75a=JSON[_0x47cf('0x6a')](process[_0x47cf('0x96')][0x3]);if(!_0x32d75a[_0x47cf('0x62')]){throw new Error(_0x47cf('0x98'));}if(!_0x32d75a[_0x47cf('0x62')][_0x47cf('0x30')]){throw new Error(_0x47cf('0x99'));}if(!_0x32d75a[_0x47cf('0x62')][_0x47cf('0x7d')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5c239d=0x0;if(_0x32d75a[_0x47cf('0x62')][_0x47cf('0x37')]){_0x5c239d=0x1;}if(!_0x32d75a['ListId']){throw new Error(_0x47cf('0x9a'));}}catch(_0x4cafea){throw new Error(_0x47cf('0x9b'));}var _0x7fad24=[];try{_0x7fad24=_['map'](JSON[_0x47cf('0x6a')](process['argv'][0x4]),'id');}catch(_0x306504){logger['info'](_0x47cf('0x9c'));}main(_0x13bd21,_0x32d75a,_0x7fad24,_0x5c239d);}validate();process['on'](_0x47cf('0x9d'),handleStop);process['on'](_0x47cf('0x9e'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 445352a..044a3a0 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 _0x8c57=['outbound','Outbound\x20Call','destcalleridnum','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','calleridname','destexten','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','agentcompleteAt','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','Answer\x20Time','answertime','endtime','Duration','duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','variable','queue','push'];(function(_0x514e5a,_0x255124){var _0x1f87c7=function(_0x365bd1){while(--_0x365bd1){_0x514e5a['push'](_0x514e5a['shift']());}};_0x1f87c7(++_0x255124);}(_0x8c57,0x95));var _0x78c5=function(_0x5c436e,_0x145ed8){_0x5c436e=_0x5c436e-0x0;var _0x51d618=_0x8c57[_0x5c436e];return _0x51d618;};'use strict';exports[_0x78c5('0x0')]=function(_0x9e80fb,_0xa85bb){var _0x128762=[{'type':_0x78c5('0x1'),'content':_0x78c5('0x2'),'variableName':null}];switch(_0x9e80fb[_0x78c5('0x3')]()){case'voice':switch(_0xa85bb[_0x78c5('0x3')]()){case'inbound':_0x128762['push']({'type':_0x78c5('0x4'),'content':'','variableName':_0x78c5('0x5')});_0x128762[_0x78c5('0x6')]({'type':'variable','content':'','variableName':'calleridnum'});break;case _0x78c5('0x7'):_0x128762[_0x78c5('0x6')]({'type':_0x78c5('0x1'),'content':_0x78c5('0x8'),'variableName':null});_0x128762['push']({'type':_0x78c5('0x4'),'content':'','variableName':_0x78c5('0x9')});break;}}return _0x128762;};exports['getDescriptions']=function(_0x2884f5,_0x5e3b6c){var _0x40edf2=[];switch(_0x2884f5[_0x78c5('0x3')]()){case'voice':switch(_0x5e3b6c['toLowerCase']()){case'inbound':_0x40edf2=[{'type':_0x78c5('0x1'),'content':_0x78c5('0xa'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x78c5('0xb'),'keyType':_0x78c5('0x4'),'variableName':'calleridnum'},{'type':_0x78c5('0xc'),'content':'','key':_0x78c5('0xd'),'keyType':_0x78c5('0x4'),'variableName':_0x78c5('0xe')},{'type':_0x78c5('0xc'),'content':'','key':'Call\x20To','keyType':_0x78c5('0x4'),'variableName':_0x78c5('0xf')},{'type':_0x78c5('0xc'),'content':'','key':'Queue','keyType':_0x78c5('0x4'),'variableName':_0x78c5('0x5')},{'type':_0x78c5('0xc'),'content':'','key':_0x78c5('0x10'),'keyType':_0x78c5('0x4'),'variableName':_0x78c5('0x11')},{'type':_0x78c5('0xc'),'content':'','key':_0x78c5('0x12'),'keyType':_0x78c5('0x4'),'variableName':_0x78c5('0x13')},{'type':_0x78c5('0x1'),'content':_0x78c5('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x78c5('0xc'),'content':'','key':_0x78c5('0x15'),'keyType':_0x78c5('0x4'),'variableName':_0x78c5('0x16')},{'type':_0x78c5('0xc'),'content':'','key':'Agent\x20Number','keyType':'variable','variableName':_0x78c5('0x9')},{'type':'string','content':_0x78c5('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x78c5('0xc'),'content':'','key':_0x78c5('0x18'),'keyType':_0x78c5('0x4'),'variableName':_0x78c5('0x13')},{'type':'keyValue','content':'','key':_0x78c5('0x19'),'keyType':_0x78c5('0x4'),'variableName':_0x78c5('0x1a')},{'type':_0x78c5('0xc'),'content':'','key':'Agent\x20Complete','keyType':_0x78c5('0x4'),'variableName':_0x78c5('0x1b')},{'type':'keyValue','content':'','key':'Hold\x20Time','keyType':'variable','variableName':'holdtime'},{'type':_0x78c5('0xc'),'content':'','key':_0x78c5('0x1c'),'keyType':'variable','variableName':_0x78c5('0x1d')}];break;case'outbound':_0x40edf2=[{'type':_0x78c5('0x1'),'content':_0x78c5('0xa'),'variableName':null},{'type':_0x78c5('0xc'),'content':'','key':_0x78c5('0x1e'),'keyType':_0x78c5('0x4'),'keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':_0x78c5('0x1f'),'keyType':_0x78c5('0x4'),'keyContent':'','variableName':_0x78c5('0x20')},{'type':_0x78c5('0xc'),'content':'','key':_0x78c5('0x10'),'keyType':_0x78c5('0x4'),'keyContent':'','variableName':'uniqueid'},{'type':_0x78c5('0xc'),'content':'','key':_0x78c5('0x12'),'keyType':'variable','keyContent':'','variableName':'starttime'},{'type':_0x78c5('0x1'),'content':_0x78c5('0x17')},{'type':_0x78c5('0xc'),'content':'','key':_0x78c5('0x21'),'keyType':_0x78c5('0x4'),'keyContent':'','variableName':_0x78c5('0x22')},{'type':_0x78c5('0xc'),'content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':_0x78c5('0x23')},{'type':_0x78c5('0xc'),'content':'','key':_0x78c5('0x24'),'keyType':_0x78c5('0x4'),'keyContent':'','variableName':_0x78c5('0x25')},{'type':_0x78c5('0xc'),'content':'','key':'Billable\x20Time','keyType':_0x78c5('0x4'),'keyContent':'','variableName':_0x78c5('0x26')}];break;}}return _0x40edf2;}; \ No newline at end of file +var _0x2e0d=['Billable\x20Time','getSubjects','string','voice','toLowerCase','inbound','queue','variable','outbound','push','Outbound\x20Call','***\x20Call\x20Info\x20***','Caller\x20Number','calleridnum','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','destcalleridnum','Member\x20Name','membername','UniqueId','uniqueid','starttime','endtime','duration'];(function(_0x4f8d61,_0x29eff0){var _0x3bc078=function(_0x4c7203){while(--_0x4c7203){_0x4f8d61['push'](_0x4f8d61['shift']());}};_0x3bc078(++_0x29eff0);}(_0x2e0d,0xc9));var _0xd2e0=function(_0x3988b2,_0x42b98b){_0x3988b2=_0x3988b2-0x0;var _0x3adf85=_0x2e0d[_0x3988b2];return _0x3adf85;};'use strict';exports[_0xd2e0('0x0')]=function(_0x7a972c,_0x58a6fd){var _0x57f6e6=[{'type':_0xd2e0('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x7a972c['toLowerCase']()){case _0xd2e0('0x2'):switch(_0x58a6fd[_0xd2e0('0x3')]()){case _0xd2e0('0x4'):_0x57f6e6['push']({'type':'variable','content':'','variableName':_0xd2e0('0x5')});_0x57f6e6['push']({'type':_0xd2e0('0x6'),'content':'','variableName':'calleridnum'});break;case _0xd2e0('0x7'):_0x57f6e6[_0xd2e0('0x8')]({'type':'string','content':_0xd2e0('0x9'),'variableName':null});_0x57f6e6[_0xd2e0('0x8')]({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0x57f6e6;};exports['getDescriptions']=function(_0x262079,_0x2acaaf){var _0x51d127=[];switch(_0x262079[_0xd2e0('0x3')]()){case _0xd2e0('0x2'):switch(_0x2acaaf['toLowerCase']()){case _0xd2e0('0x4'):_0x51d127=[{'type':_0xd2e0('0x1'),'content':_0xd2e0('0xa'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xd2e0('0xb'),'keyType':_0xd2e0('0x6'),'variableName':_0xd2e0('0xc')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0xe'),'keyType':_0xd2e0('0x6'),'variableName':_0xd2e0('0xf')},{'type':'keyValue','content':'','key':_0xd2e0('0x10'),'keyType':_0xd2e0('0x6'),'variableName':_0xd2e0('0x11')},{'type':'keyValue','content':'','key':'Queue','keyType':_0xd2e0('0x6'),'variableName':'queue'},{'type':_0xd2e0('0xd'),'content':'','key':'UniqueId','keyType':_0xd2e0('0x6'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0xd2e0('0x12'),'keyType':'variable','variableName':_0xd2e0('0x13')},{'type':_0xd2e0('0x1'),'content':_0xd2e0('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0xd2e0('0xd'),'content':'','key':'Agent\x20Name','keyType':_0xd2e0('0x6'),'variableName':'destcalleridname'},{'type':'keyValue','content':'','key':_0xd2e0('0x15'),'keyType':_0xd2e0('0x6'),'variableName':'destcalleridnum'},{'type':'string','content':_0xd2e0('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0xd2e0('0xd'),'content':'','key':'Agent\x20Ring','keyType':_0xd2e0('0x6'),'variableName':_0xd2e0('0x13')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x17'),'keyType':'variable','variableName':_0xd2e0('0x18')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x19'),'keyType':_0xd2e0('0x6'),'variableName':_0xd2e0('0x1a')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x1b'),'keyType':_0xd2e0('0x6'),'variableName':_0xd2e0('0x1c')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x1d'),'keyType':_0xd2e0('0x6'),'variableName':'talktime'}];break;case _0xd2e0('0x7'):_0x51d127=[{'type':_0xd2e0('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x1e'),'keyType':_0xd2e0('0x6'),'keyContent':'','variableName':_0xd2e0('0x1f')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x20'),'keyType':_0xd2e0('0x6'),'keyContent':'','variableName':_0xd2e0('0x21')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x22'),'keyType':_0xd2e0('0x6'),'keyContent':'','variableName':_0xd2e0('0x23')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x12'),'keyType':_0xd2e0('0x6'),'keyContent':'','variableName':_0xd2e0('0x24')},{'type':_0xd2e0('0x1'),'content':_0xd2e0('0x16')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0xd2e0('0x6'),'keyContent':'','variableName':'answertime'},{'type':_0xd2e0('0xd'),'content':'','key':'Complete\x20Time','keyType':_0xd2e0('0x6'),'keyContent':'','variableName':_0xd2e0('0x25')},{'type':_0xd2e0('0xd'),'content':'','key':'Duration','keyType':_0xd2e0('0x6'),'keyContent':'','variableName':_0xd2e0('0x26')},{'type':_0xd2e0('0xd'),'content':'','key':_0xd2e0('0x27'),'keyType':'variable','keyContent':'','variableName':'billableseconds'}];break;}}return _0x51d127;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 46349c4..346e2b5 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 _0x7693=['InteractionId','upperFirst','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','Interaction','then','update','info','user','query','clone','body','omit','html','fax','mobile','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions'];(function(_0x1b7922,_0x3b2b63){var _0x20e061=function(_0x4dab7c){while(--_0x4dab7c){_0x1b7922['push'](_0x1b7922['shift']());}};_0x20e061(++_0x3b2b63);}(_0x7693,0xfe));var _0x3769=function(_0x40506c,_0x5870b7){_0x40506c=_0x40506c-0x0;var _0x5c1e8e=_0x7693[_0x40506c];return _0x5c1e8e;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x3769('0x0'))(_0x3769('0x1')),'mail':require('../../config/logger')(_0x3769('0x2')),'fax':require('../../config/logger')(_0x3769('0x3')),'sms':require(_0x3769('0x0'))(_0x3769('0x4')),'chat':require(_0x3769('0x0'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0x3769('0x5'))};function getInteractionId(_0x1b40dd,_0x29be78,_0x32bc14){if(_0x1b40dd&&_0x1b40dd[_['upperFirst'](_0x32bc14)+_0x3769('0x6')]){return _0x1b40dd[_[_0x3769('0x7')](_0x32bc14)+_0x3769('0x6')];}else if(_0x1b40dd&&_0x1b40dd['id']){return _0x1b40dd['id'];}else if(_0x29be78&&_0x29be78['id']){return _0x29be78['id'];}else{return _0x3769('0x8');}}function log(_0x37576c,_0x86985a,_0xf6e1c2,_0x1d51c8,_0x5ecd22,_0x3c460f){loggers[_0x5ecd22['toLowerCase']()][_0x37576c](_0x3769('0x9'),_0x3c460f[_0x3769('0xa')](),_0x86985a?_0x86985a['id']:null,_0x86985a?_0x86985a['name']:null,_0x86985a?_0x86985a[_0x3769('0xb')]:null,getInteractionId(_0xf6e1c2,_0x1d51c8,_0x5ecd22),_0xf6e1c2?JSON[_0x3769('0xc')](_0xf6e1c2):_0x3769('0xd'));}function updateUser(_0x202d8b,_0x4048e5,_0x5abcca,_0x5945eb,_0x263f31){db[_[_0x3769('0x7')](_0x5945eb)+_0x3769('0xe')]['findOne']({'where':{'id':getInteractionId(_0x4048e5,_0x5abcca,_0x5945eb)}})[_0x3769('0xf')](function(_0x39b2e0){if(_0x39b2e0){return _0x39b2e0[_0x3769('0x10')]({'UserId':_0x202d8b?_0x202d8b['id']:null});}})[_0x3769('0xf')](function(_0x26afcb){if(_0x26afcb){log(_0x3769('0x11'),_0x202d8b,_0x4048e5,_0x5abcca,_0x5945eb,_0x263f31);}})['catch'](function(){log('error',_0x202d8b,_0x4048e5,_0x5abcca,_0x5945eb,_0x263f31);});}exports['tracked']=function(_0x4f9726,_0x10cf38){return function(_0x271e4a,_0x1f5e11,_0x15432d){var _0x211a1b=_0x271e4a[_0x3769('0x12')];var _0xed93a4={};var _0x1672a6=_0x271e4a[_0x3769('0x13')];if(_0xed93a4){_0xed93a4=_[_0x3769('0x14')](_0x271e4a[_0x3769('0x15')]);_0xed93a4=_[_0x3769('0x16')](_0xed93a4,['body',_0x3769('0x17'),'phone',_0x3769('0x18'),_0x3769('0x19')]);}updateUser(_0x211a1b,_0xed93a4,_0x1672a6,_0x4f9726,_0x10cf38);_0x15432d(null);};}; \ No newline at end of file +var _0x737d=['clone','body','omit','html','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','toLowerCase','toUpperCase','name','role','stringify','null','Interaction','findOne','then','info','catch','user','query'];(function(_0x4cc85f,_0x335b29){var _0x4560de=function(_0x4ecee3){while(--_0x4ecee3){_0x4cc85f['push'](_0x4cc85f['shift']());}};_0x4560de(++_0x335b29);}(_0x737d,0x7a));var _0xd737=function(_0x5e1c64,_0x289764){_0x5e1c64=_0x5e1c64-0x0;var _0x38ea78=_0x737d[_0x5e1c64];return _0x38ea78;};'use strict';var _=require(_0xd737('0x0'));var db=require(_0xd737('0x1'))['db'];var loggers={'openchannel':require(_0xd737('0x2'))(_0xd737('0x3')),'mail':require(_0xd737('0x2'))(_0xd737('0x4')),'fax':require(_0xd737('0x2'))(_0xd737('0x5')),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0xd737('0x2'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0xd737('0x6'))};function getInteractionId(_0x63705f,_0x5ef8af,_0x362713){if(_0x63705f&&_0x63705f[_['upperFirst'](_0x362713)+_0xd737('0x7')]){return _0x63705f[_[_0xd737('0x8')](_0x362713)+'InteractionId'];}else if(_0x63705f&&_0x63705f['id']){return _0x63705f['id'];}else if(_0x5ef8af&&_0x5ef8af['id']){return _0x5ef8af['id'];}else{return _0xd737('0x9');}}function log(_0x15475a,_0x4c9e9a,_0x3b54ba,_0x3752bc,_0x1d6f66,_0x30793e){loggers[_0x1d6f66[_0xd737('0xa')]()][_0x15475a]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x30793e[_0xd737('0xb')](),_0x4c9e9a?_0x4c9e9a['id']:null,_0x4c9e9a?_0x4c9e9a[_0xd737('0xc')]:null,_0x4c9e9a?_0x4c9e9a[_0xd737('0xd')]:null,getInteractionId(_0x3b54ba,_0x3752bc,_0x1d6f66),_0x3b54ba?JSON[_0xd737('0xe')](_0x3b54ba):_0xd737('0xf'));}function updateUser(_0x26976d,_0x473066,_0x4c586c,_0x16c7fc,_0xfd1765){db[_['upperFirst'](_0x16c7fc)+_0xd737('0x10')][_0xd737('0x11')]({'where':{'id':getInteractionId(_0x473066,_0x4c586c,_0x16c7fc)}})[_0xd737('0x12')](function(_0x4917f8){if(_0x4917f8){return _0x4917f8['update']({'UserId':_0x26976d?_0x26976d['id']:null});}})[_0xd737('0x12')](function(_0x1573fd){if(_0x1573fd){log(_0xd737('0x13'),_0x26976d,_0x473066,_0x4c586c,_0x16c7fc,_0xfd1765);}})[_0xd737('0x14')](function(){log('error',_0x26976d,_0x473066,_0x4c586c,_0x16c7fc,_0xfd1765);});}exports['tracked']=function(_0x10002a,_0x23ca01){return function(_0x4a5c0f,_0x4b6f4b,_0x436afa){var _0x470c97=_0x4a5c0f[_0xd737('0x15')];var _0x2f5dee={};var _0x4f2a5e=_0x4a5c0f[_0xd737('0x16')];if(_0x2f5dee){_0x2f5dee=_[_0xd737('0x17')](_0x4a5c0f[_0xd737('0x18')]);_0x2f5dee=_[_0xd737('0x19')](_0x2f5dee,[_0xd737('0x18'),_0xd737('0x1a'),'phone',_0xd737('0x1b'),_0xd737('0x1c')]);}updateUser(_0x470c97,_0x2f5dee,_0x4f2a5e,_0x10002a,_0x23ca01);_0x436afa(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 5383a2f..a34fbe8 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 _0x3309=['%s:%s:%s','update','utf8','parse','hasOwnProperty','use','findOne','then','count','status','json','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','license','split','createDecipher','aes-256-ctr','format'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x3309,0x13a));var _0x9330=function(_0xe6bfb6,_0x123119){_0xe6bfb6=_0xe6bfb6-0x0;var _0x491226=_0x3309[_0xe6bfb6];return _0x491226;};'use strict';var crypto=require(_0x9330('0x0'));var util=require(_0x9330('0x1'));var compose=require(_0x9330('0x2'));var db=require(_0x9330('0x3'))['db'];var config=require(_0x9330('0x4'));function getValueFromLicense(_0x5c6d12,_0x2193c5){if(_0x5c6d12&&_0x2193c5){if(_0x2193c5['data1']&&_0x2193c5[_0x9330('0x5')]){var _0x54af49=_0x2193c5['data1'];var _0x4e09f8=_0x2193c5[_0x9330('0x5')];var _0x1213f0=_0x54af49[_0x9330('0x6')]('-')[0x4];var _0x2d95df=_0x54af49[_0x9330('0x6')]('-')[0x0];var _0x368bd5=crypto[_0x9330('0x7')](_0x9330('0x8'),util[_0x9330('0x9')](_0x9330('0xa'),_0x1213f0,_0x54af49,_0x2d95df));var _0x5d1839=_0x368bd5[_0x9330('0xb')](_0x4e09f8,'base64',_0x9330('0xc'));_0x5d1839+=_0x368bd5['final'](_0x9330('0xc'));var _0x5319a6=JSON[_0x9330('0xd')](_0x5d1839);return _0x5319a6[_0x9330('0xe')](_0x5c6d12)?_0x5319a6[_0x5c6d12]:null;}}return null;}function isLimit(_0x4f148d,_0x29754f,_0x287c8f,_0x2852d8){var _0x3190b9=_0x29754f;return compose()[_0x9330('0xf')](function(_0x1bf9ec,_0xb3ab00,_0x2da514){return db['License'][_0x9330('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x9330('0x11')](function(_0x423741){var _0x3be5cc=getValueFromLicense(_0x4f148d,_0x423741);return _0x3be5cc?_0x3be5cc:_0x3190b9;})[_0x9330('0x11')](function(_0x580a0a){_0x3190b9=_0x580a0a;return _0x287c8f[_0x9330('0x12')](_0x2852d8);})[_0x9330('0x11')](function(_0x36d1fc){if(_0x36d1fc>=_0x3190b9){return _0xb3ab00[_0x9330('0x13')](0x193)[_0x9330('0x14')]({'message':util[_0x9330('0x9')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x4f148d)});}_0x2da514();})[_0x9330('0x15')](function(_0x5f0c19){_0x2da514(_0x5f0c19);});});}function isUserLimit(){return isLimit(_0x9330('0x16'),0x1,db[_0x9330('0x17')],{'where':{'$or':[{'role':_0x9330('0x18')},{'role':_0x9330('0x19')}]}});}exports[_0x9330('0x1a')]=isUserLimit; \ No newline at end of file +var _0xa6a2=['License','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','use'];(function(_0x315902,_0xb6d9ad){var _0x8190b9=function(_0xc82d9a){while(--_0xc82d9a){_0x315902['push'](_0x315902['shift']());}};_0x8190b9(++_0xb6d9ad);}(_0xa6a2,0x133));var _0x2a6a=function(_0x3cade8,_0x5d674f){_0x3cade8=_0x3cade8-0x0;var _0x18be8c=_0xa6a2[_0x3cade8];return _0x18be8c;};'use strict';var crypto=require(_0x2a6a('0x0'));var util=require(_0x2a6a('0x1'));var compose=require(_0x2a6a('0x2'));var db=require(_0x2a6a('0x3'))['db'];var config=require(_0x2a6a('0x4'));function getValueFromLicense(_0x1a1b9d,_0xf8be8e){if(_0x1a1b9d&&_0xf8be8e){if(_0xf8be8e[_0x2a6a('0x5')]&&_0xf8be8e[_0x2a6a('0x6')]){var _0x441d81=_0xf8be8e['data1'];var _0x3812e9=_0xf8be8e['license'];var _0x140eb9=_0x441d81[_0x2a6a('0x7')]('-')[0x4];var _0x2cf2c4=_0x441d81[_0x2a6a('0x7')]('-')[0x0];var _0x180977=crypto[_0x2a6a('0x8')]('aes-256-ctr',util[_0x2a6a('0x9')](_0x2a6a('0xa'),_0x140eb9,_0x441d81,_0x2cf2c4));var _0x422474=_0x180977[_0x2a6a('0xb')](_0x3812e9,_0x2a6a('0xc'),_0x2a6a('0xd'));_0x422474+=_0x180977[_0x2a6a('0xe')](_0x2a6a('0xd'));var _0x5541bc=JSON['parse'](_0x422474);return _0x5541bc[_0x2a6a('0xf')](_0x1a1b9d)?_0x5541bc[_0x1a1b9d]:null;}}return null;}function isLimit(_0x49a239,_0x3942af,_0x15b92e,_0x390afd){var _0x555055=_0x3942af;return compose()[_0x2a6a('0x10')](function(_0x1def43,_0x55c26e,_0x198812){return db[_0x2a6a('0x11')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x2a6a('0x12')](function(_0x3041f5){var _0x33f607=getValueFromLicense(_0x49a239,_0x3041f5);return _0x33f607?_0x33f607:_0x555055;})['then'](function(_0x676b55){_0x555055=_0x676b55;return _0x15b92e[_0x2a6a('0x13')](_0x390afd);})[_0x2a6a('0x12')](function(_0x38ab56){if(_0x38ab56>=_0x555055){return _0x55c26e['status'](0x193)[_0x2a6a('0x14')]({'message':util[_0x2a6a('0x9')](_0x2a6a('0x15'),_0x49a239)});}_0x198812();})['catch'](function(_0x55dd7c){_0x198812(_0x55dd7c);});});}function isUserLimit(){return isLimit(_0x2a6a('0x16'),0x1,db[_0x2a6a('0x17')],{'where':{'$or':[{'role':_0x2a6a('0x18')},{'role':_0x2a6a('0x19')}]}});}exports[_0x2a6a('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 713f228..f2715eb 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 _0xb203=['split','match','filter','indexOf','conditions','buildExpression','$eq','operator','$between','includes','$gt','value','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$lte','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','pop','utcOffset','lodash','moment','startsWith','and','[$and]','replace','[$or]','slice','forEach'];(function(_0x17d92d,_0x53820a){var _0x4406c4=function(_0x345d84){while(--_0x345d84){_0x17d92d['push'](_0x17d92d['shift']());}};_0x4406c4(++_0x53820a);}(_0xb203,0x197));var _0x3b20=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb203[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x3b20('0x0'));var moment=require(_0x3b20('0x1'));exports['parseSearch']=function(_0x5e6c1b){var _0x470139={'conditions':[]};_0x470139['sqlOperator']=_[_0x3b20('0x2')](_0x5e6c1b,'[$or]')?'or':_0x3b20('0x3');var _0x20949e=_0x5e6c1b['replace'](_0x3b20('0x4'),'')[_0x3b20('0x5')](_0x3b20('0x6'),'')['split']('||');for(var _0x2149c4=0x0;_0x2149c4<_0x20949e['length'];_0x2149c4++){var _0x54b1a9=_0x20949e[_0x2149c4]['split'](':=');var _0x520a0f=_0x54b1a9[0x0];var _0x206594=_0x54b1a9[_0x3b20('0x7')](0x1);_0x206594[_0x3b20('0x8')](function(_0x3a2be4){var _0x25b58f=_0x3a2be4[_0x3b20('0x9')]('[')['shift']();var _0x5efc47=_0x3a2be4[_0x3b20('0xa')](/\[(.*?)\]/g);_0x5efc47[_0x3b20('0x8')](function(_0x512339){var _0x5b3a81=_0x512339[_0x3b20('0x9')]('[')[_0x3b20('0xb')](function(_0x1f6d39){return _0x1f6d39[_0x3b20('0xc')](']')>-0x1;})['map'](function(_0xff3bd){return _0xff3bd[_0x3b20('0x9')](']')[0x0];})[0x0];_0x470139[_0x3b20('0xd')]['push']({'field':_0x520a0f,'operator':_0x25b58f,'value':_0x5b3a81});});});}return _0x470139;};exports[_0x3b20('0xe')]=function(_0x2b0228,_0x48f915,_0x20f6b9){var _0x194f4e={};if(_0x48f915==='DATE'){if(_0x20f6b9['operator']===_0x3b20('0xf')){_0x20f6b9[_0x3b20('0x10')]=_0x3b20('0x11');_0x20f6b9['value']+=','+_0x20f6b9['value'];}else if(_[_0x3b20('0x12')]([_0x3b20('0x13'),'$lte'],_0x20f6b9[_0x3b20('0x10')])){_0x20f6b9[_0x3b20('0x14')]=moment(_0x20f6b9[_0x3b20('0x14')])[_0x3b20('0x15')](0x1,_0x3b20('0x16'))[_0x3b20('0x17')](_0x3b20('0x18'));}}if(_0x20f6b9[_0x3b20('0x19')]){_0x48f915=_0x20f6b9['castTo'];_0x194f4e[_0x3b20('0x1a')]=_0x3b20('0x1b')+_0x2b0228+'.'+_0x20f6b9[_0x3b20('0x1c')]+'\x20AS\x20'+_0x20f6b9[_0x3b20('0x19')]+')\x20'+parseOperator(_0x20f6b9['operator']);}else{_0x194f4e['text']=_0x2b0228+'.'+_0x20f6b9[_0x3b20('0x1c')]+'\x20'+parseOperator(_0x20f6b9['operator']);}if(_[_0x3b20('0x12')]([_0x3b20('0x1d'),'$notIn'],_0x20f6b9[_0x3b20('0x10')]))_0x194f4e[_0x3b20('0x1a')]='('+_0x194f4e[_0x3b20('0x1a')]+_0x3b20('0x1e')+_0x2b0228+'.'+_0x20f6b9[_0x3b20('0x1c')]+_0x3b20('0x1f');_0x194f4e[_0x3b20('0x14')]=parseValue(_0x48f915,_0x20f6b9[_0x3b20('0x10')],_0x20f6b9[_0x3b20('0x14')]);return _0x194f4e;};function parseOperator(_0x321521){var _0x531d24;switch(_0x321521){case _0x3b20('0x20'):_0x531d24=_0x3b20('0x21');break;case _0x3b20('0x22'):_0x531d24=_0x3b20('0x23');break;case _0x3b20('0xf'):_0x531d24='=\x20?';break;case'$ne':_0x531d24=_0x3b20('0x24');break;case _0x3b20('0x25'):case _0x3b20('0x26'):case _0x3b20('0x27'):_0x531d24=_0x3b20('0x28');break;case _0x3b20('0x29'):_0x531d24=_0x3b20('0x2a');break;case _0x3b20('0x13'):_0x531d24=_0x3b20('0x2b');break;case _0x3b20('0x2c'):_0x531d24=_0x3b20('0x2d');break;case'$gte':_0x531d24=_0x3b20('0x2e');break;case _0x3b20('0x11'):_0x531d24=_0x3b20('0x2f');break;}return _0x531d24;}function parseValue(_0x52e265,_0x3f6032,_0x3219ab){var _0x4e9425={'start':undefined,'end':undefined};switch(_0x3f6032){case'$in':case'$notIn':_0x4e9425['start']=_0x3219ab['split'](',');break;case _0x3b20('0x25'):_0x4e9425['start']='%'+_0x3219ab+'%';break;case'$startsWith':_0x4e9425[_0x3b20('0x30')]=_0x3219ab+'%';break;case'$endsWith':_0x4e9425['start']='%'+_0x3219ab;break;case _0x3b20('0x11'):var _0x513baa=_0x3219ab[_0x3b20('0x9')](',');var _0x3219ab=_0x513baa[_0x3b20('0x31')]();var _0x2da71e=_0x513baa[_0x3b20('0x32')]();if(_0x52e265==='DATE'){_0x3219ab=moment(_0x3219ab)['utcOffset'](0x0,!![])['format']();_0x2da71e=moment(_0x2da71e)[_0x3b20('0x33')](0x0,!![])[_0x3b20('0x15')](0x17,'hours')[_0x3b20('0x15')](0x3b,'minutes')[_0x3b20('0x15')](0x3b,'seconds')[_0x3b20('0x17')]();}_0x4e9425={'start':_0x3219ab,'end':_0x2da71e};break;default:_0x4e9425[_0x3b20('0x30')]=_0x3219ab;break;}return _0x4e9425;} \ No newline at end of file +var _0x6049=['<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','split','slice','shift','match','forEach','filter','indexOf','map','conditions','buildExpression','$eq','operator','$between','value','includes','$gt','$lte','add','days','format','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?'];(function(_0x58767b,_0x443cab){var _0x4e25e8=function(_0x1457da){while(--_0x1457da){_0x58767b['push'](_0x58767b['shift']());}};_0x4e25e8(++_0x443cab);}(_0x6049,0x85));var _0x9604=function(_0x5e4d61,_0x5a5e1d){_0x5e4d61=_0x5e4d61-0x0;var _0x27d8ad=_0x6049[_0x5e4d61];return _0x27d8ad;};'use strict';var _=require('lodash');var moment=require(_0x9604('0x0'));exports[_0x9604('0x1')]=function(_0x40c3f8){var _0x4d96f8={'conditions':[]};_0x4d96f8[_0x9604('0x2')]=_[_0x9604('0x3')](_0x40c3f8,_0x9604('0x4'))?'or':_0x9604('0x5');var _0x347781=_0x40c3f8[_0x9604('0x6')](_0x9604('0x7'),'')[_0x9604('0x6')](_0x9604('0x4'),'')['split']('||');for(var _0x42a6e5=0x0;_0x42a6e5<_0x347781[_0x9604('0x8')];_0x42a6e5++){var _0x2eab1c=_0x347781[_0x42a6e5][_0x9604('0x9')](':=');var _0x7ebcf2=_0x2eab1c[0x0];var _0x224bfc=_0x2eab1c[_0x9604('0xa')](0x1);_0x224bfc['forEach'](function(_0xb5b0c2){var _0x4a4294=_0xb5b0c2[_0x9604('0x9')]('[')[_0x9604('0xb')]();var _0x50ca5c=_0xb5b0c2[_0x9604('0xc')](/\[(.*?)\]/g);_0x50ca5c[_0x9604('0xd')](function(_0x2b7788){var _0x1bc91b=_0x2b7788['split']('[')[_0x9604('0xe')](function(_0x199a22){return _0x199a22[_0x9604('0xf')](']')>-0x1;})[_0x9604('0x10')](function(_0x3f5c6c){return _0x3f5c6c[_0x9604('0x9')](']')[0x0];})[0x0];_0x4d96f8[_0x9604('0x11')]['push']({'field':_0x7ebcf2,'operator':_0x4a4294,'value':_0x1bc91b});});});}return _0x4d96f8;};exports[_0x9604('0x12')]=function(_0x24e17a,_0x5d3fec,_0x1ca9b6){var _0x30d900={};if(_0x5d3fec==='DATE'){if(_0x1ca9b6['operator']===_0x9604('0x13')){_0x1ca9b6[_0x9604('0x14')]=_0x9604('0x15');_0x1ca9b6[_0x9604('0x16')]+=','+_0x1ca9b6[_0x9604('0x16')];}else if(_[_0x9604('0x17')]([_0x9604('0x18'),_0x9604('0x19')],_0x1ca9b6['operator'])){_0x1ca9b6[_0x9604('0x16')]=moment(_0x1ca9b6[_0x9604('0x16')])[_0x9604('0x1a')](0x1,_0x9604('0x1b'))[_0x9604('0x1c')]('YYYY-MM-DD');}}if(_0x1ca9b6[_0x9604('0x1d')]){_0x5d3fec=_0x1ca9b6[_0x9604('0x1d')];_0x30d900[_0x9604('0x1e')]='CAST('+_0x24e17a+'.'+_0x1ca9b6[_0x9604('0x1f')]+_0x9604('0x20')+_0x1ca9b6[_0x9604('0x1d')]+')\x20'+parseOperator(_0x1ca9b6['operator']);}else{_0x30d900[_0x9604('0x1e')]=_0x24e17a+'.'+_0x1ca9b6['field']+'\x20'+parseOperator(_0x1ca9b6['operator']);}if(_[_0x9604('0x17')]([_0x9604('0x21'),_0x9604('0x22')],_0x1ca9b6[_0x9604('0x14')]))_0x30d900['text']='('+_0x30d900[_0x9604('0x1e')]+_0x9604('0x23')+_0x24e17a+'.'+_0x1ca9b6[_0x9604('0x1f')]+_0x9604('0x24');_0x30d900[_0x9604('0x16')]=parseValue(_0x5d3fec,_0x1ca9b6[_0x9604('0x14')],_0x1ca9b6[_0x9604('0x16')]);return _0x30d900;};function parseOperator(_0x416096){var _0x28e338;switch(_0x416096){case _0x9604('0x25'):_0x28e338=_0x9604('0x26');break;case _0x9604('0x22'):_0x28e338=_0x9604('0x27');break;case _0x9604('0x13'):_0x28e338=_0x9604('0x28');break;case'$ne':_0x28e338=_0x9604('0x29');break;case _0x9604('0x2a'):case _0x9604('0x2b'):case _0x9604('0x2c'):_0x28e338=_0x9604('0x2d');break;case _0x9604('0x2e'):_0x28e338=_0x9604('0x2f');break;case _0x9604('0x18'):_0x28e338=_0x9604('0x30');break;case _0x9604('0x19'):_0x28e338=_0x9604('0x31');break;case'$gte':_0x28e338=_0x9604('0x32');break;case'$between':_0x28e338=_0x9604('0x33');break;}return _0x28e338;}function parseValue(_0x2f4fa6,_0x15410a,_0x387043){var _0x240546={'start':undefined,'end':undefined};switch(_0x15410a){case _0x9604('0x25'):case _0x9604('0x22'):_0x240546[_0x9604('0x34')]=_0x387043[_0x9604('0x9')](',');break;case _0x9604('0x2a'):_0x240546[_0x9604('0x34')]='%'+_0x387043+'%';break;case _0x9604('0x2b'):_0x240546[_0x9604('0x34')]=_0x387043+'%';break;case _0x9604('0x2c'):_0x240546[_0x9604('0x34')]='%'+_0x387043;break;case _0x9604('0x15'):var _0x24eb66=_0x387043[_0x9604('0x9')](',');var _0x387043=_0x24eb66[_0x9604('0xb')]();var _0x1af6e2=_0x24eb66[_0x9604('0x35')]();if(_0x2f4fa6===_0x9604('0x36')){_0x387043=moment(_0x387043)[_0x9604('0x37')](0x0,!![])[_0x9604('0x1c')]();_0x1af6e2=moment(_0x1af6e2)[_0x9604('0x37')](0x0,!![])['add'](0x17,'hours')[_0x9604('0x1a')](0x3b,_0x9604('0x38'))[_0x9604('0x1a')](0x3b,_0x9604('0x39'))[_0x9604('0x1c')]();}_0x240546={'start':_0x387043,'end':_0x1af6e2};break;default:_0x240546['start']=_0x387043;break;}return _0x240546;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index fa2a416..27814c1 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 _0xd13e=['DESC','ASC','omit','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','replace','push','join','getOptions','query','$id','model','map','intersection','attributes','hasOwnProperty','order','where','filter','object','value','merge','VIRTUAL','lower','lodash','sequelize','moment','includes','keys','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','$gte','YYYY-MM-DD','format','utc','subtract','name','uniqueid','isArray','limit','offset','sort','cast','col','priority','unsigned','substr'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xd13e,0x193));var _0xed13=function(_0x352cb1,_0x1126aa){_0x352cb1=_0x352cb1-0x0;var _0x12728f=_0xd13e[_0x352cb1];return _0x12728f;};'use strict';var _=require(_0xed13('0x0'));var sequelize=require(_0xed13('0x1'));var moment=require(_0xed13('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x32c6ee){var _0x50b476=['ne'];try{var _0x1a064e=JSON['parse'](_0x32c6ee);var _0x282bda=Object['keys'](_0x1a064e)[0x0];return _0x50b476[_0xed13('0x3')](_0x282bda);}catch(_0xcba1c4){return![];}}function getOperatorValue(_0x5e3571){var _0x50de44=JSON['parse'](_0x5e3571);var _0x95ff4c=Object[_0xed13('0x4')](_0x50de44)[0x0];var _0xab0fff=_0x50de44[_0x95ff4c];return{['$'+_0x95ff4c]:_0xab0fff};}exports[_0xed13('0x5')]=function(_0x369798){var _0x2ba0d2=null;if(_0x369798){_0x2ba0d2=_0x369798[_0xed13('0x6')](',');}return _0x2ba0d2;};exports[_0xed13('0x7')]=function(_0x8543ad,_0x4e1e07){var _0x26442d={};if(!_[_0xed13('0x8')](_0x8543ad)){_[_0xed13('0x9')](_0x8543ad,function(_0x39575c,_0x2b290c){try{if(_0x4e1e07){var _0x57f4d4=_[_0xed13('0xa')](_0x4e1e07,{'name':_0x2b290c})||{};if(hasSequelizeOperator(_0x39575c)){_0x26442d[_0x2b290c]=getOperatorValue(_0x39575c);}else if(_0x57f4d4[_0xed13('0xb')]===_0xed13('0xc')&&_[_0xed13('0xd')](_0x39575c)){var _0x936103=JSON[_0xed13('0xe')](_0x39575c);var _0x5b950a={'$gte':moment(moment(_0x936103[_0xed13('0xf')])['format'](_0xed13('0x10')))['utc']()[_0xed13('0x11')](),'$lte':moment(moment(_0x936103['$lte'])[_0xed13('0x11')]('YYYY-MM-DD'))[_0xed13('0x12')]()[_0xed13('0x13')](0x1,'s')[_0xed13('0x11')]()};_0x26442d[_0x2b290c]=_0x5b950a;}else if(_0x57f4d4[_0xed13('0x14')]===_0xed13('0x15')){_0x26442d[_0x2b290c]=_0x39575c;}else{_0x26442d[_0x2b290c]=_[_0xed13('0x16')](_0x39575c)?_0x39575c:JSON[_0xed13('0xe')](_0x39575c);}}else{_0x26442d[_0x2b290c]=_[_0xed13('0x16')](_0x39575c)?_0x39575c:JSON[_0xed13('0xe')](_0x39575c);}}catch(_0x1e161f){_0x26442d[_0x2b290c]=_0x39575c[_0xed13('0x6')](',');}});}return _0x26442d;};exports[_0xed13('0x17')]=function(_0x2893d2){_0x2893d2=parseInt(_0x2893d2,0xa);if(!_0x2893d2||_0x2893d2<0x0){_0x2893d2=LIMIT_VALUE;}return _0x2893d2;};exports[_0xed13('0x18')]=function(_0x356344){_0x356344=parseInt(_0x356344,0xa);if(!_0x356344||_0x356344<0x0){_0x356344=0x0;}return _0x356344;};exports[_0xed13('0x19')]=function(_0x580870){var _0x50512a,_0x1f3646=null;if(_0x580870){_0x50512a=_0x580870[_0xed13('0x6')](',');_0x1f3646=_['map'](_0x50512a,function(_0x40dd86){if(_0x40dd86['indexOf']('-')===0x0){return[_0x40dd86==='priority'?sequelize[_0xed13('0x1a')](sequelize[_0xed13('0x1b')](_0xed13('0x1c')),_0xed13('0x1d')):_0x40dd86[_0xed13('0x1e')](0x1),_0xed13('0x1f')];}else{return[_0x40dd86==='priority'?sequelize['cast'](sequelize['col'](_0xed13('0x1c')),_0xed13('0x1d')):_0x40dd86,_0xed13('0x20')];}});}return _0x1f3646;};exports[_0xed13('0x21')]=function(_0x1a0458,_0x28f8b8){if(_[_0xed13('0x8')](_0x1a0458)){return _0x1a0458;}if(_[_0xed13('0x16')](_0x1a0458)){for(var _0x2410e2=0x0;_0x2410e2<_0x1a0458[_0xed13('0x22')];_0x2410e2+=0x1){_0x1a0458[_0x2410e2]=this[_0xed13('0x21')](_0x1a0458[_0x2410e2],_0x28f8b8);}return _0x1a0458;}if(!_[_0xed13('0x23')](_0x1a0458)){return _0x1a0458;}if(_[_0xed13('0x24')](_0x28f8b8)){_0x28f8b8=[_0x28f8b8];}if(!_[_0xed13('0x16')](_0x28f8b8)){return _0x1a0458;}for(var _0x4e03d1=0x0;_0x4e03d1<_0x28f8b8['length'];_0x4e03d1+=0x1){_[_0xed13('0x25')](_0x1a0458,_0x28f8b8[_0x4e03d1]);}for(var _0x2ebdf6 in _0x1a0458){if(_0x1a0458['hasOwnProperty'](_0x2ebdf6)){_0x1a0458[_0x2ebdf6]=this[_0xed13('0x21')](_0x1a0458[_0x2ebdf6],_0x28f8b8);}}return _0x1a0458;};exports[_0xed13('0x26')]=function(_0x4ed119){return _0x4ed119[_0xed13('0x27')](RegExp(_0xed13('0x28')))?!![]:![];};exports[_0xed13('0x29')]=function(_0x570929){return _0x570929[_0xed13('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0xed13('0x2a')]=function(_0x489840){var _0x433665=[];_0x489840[_0xed13('0x6')](/[ ,]+/)['forEach'](function(_0x11cb93){_0x11cb93=_0x11cb93[_0xed13('0x2b')](/([^:]")"+/g,'$1');_0x11cb93='+'+_0x11cb93+'*';var _0x2bcc8b=/[ `!@#$%^&*()_\-?~]/;if(_0x11cb93[_0xed13('0x27')](_0x2bcc8b))_0x11cb93='\x22'+_0x11cb93+'\x22';_0x433665[_0xed13('0x2c')](_0x11cb93);});return _0x433665[_0xed13('0x2d')]('\x20');};exports[_0xed13('0x2e')]=function(_0x5b3828,_0x7ee14a,_0x55c1db){var _0x590a4a={},_0x3ac2f7={};if(_0x7ee14a[_0xed13('0x2f')][_0xed13('0x30')]){_0x7ee14a['query']['id']=_0x7ee14a[_0xed13('0x2f')][_0xed13('0x30')];delete _0x7ee14a[_0xed13('0x2f')]['$id'];}_0x590a4a[_0xed13('0x31')]=_[_0xed13('0x32')](_0x5b3828,_0xed13('0x14'));_0x590a4a[_0xed13('0x2f')]=_['keys'](_0x7ee14a[_0xed13('0x2f')]);_0x590a4a[_0xed13('0x7')]=_[_0xed13('0x33')](_0x590a4a[_0xed13('0x31')],_0x590a4a[_0xed13('0x2f')]);_0x3ac2f7[_0xed13('0x34')]=_[_0xed13('0x33')](_0x590a4a[_0xed13('0x31')],this[_0xed13('0x5')](_0x7ee14a[_0xed13('0x2f')]['fields']));_0x3ac2f7[_0xed13('0x34')]=_0x3ac2f7[_0xed13('0x34')]['length']?_0x3ac2f7['attributes']:_0x590a4a['model'];if(!_0x7ee14a[_0xed13('0x2f')][_0xed13('0x35')]('nolimit')){_0x3ac2f7['limit']=this[_0xed13('0x17')](_0x7ee14a[_0xed13('0x2f')][_0xed13('0x17')]);_0x3ac2f7[_0xed13('0x18')]=this[_0xed13('0x18')](_0x7ee14a['query']['offset']);}_0x3ac2f7[_0xed13('0x36')]=this['sort'](_0x7ee14a[_0xed13('0x2f')]['sort']);_0x3ac2f7[_0xed13('0x37')]=this['filters'](_['pick'](_0x7ee14a['query'],_0x590a4a[_0xed13('0x7')]),_0x5b3828);if(_0x7ee14a[_0xed13('0x2f')][_0xed13('0x38')]){var _0x42d5f7=_0x5b3828;var _0x2d29aa=_0x7ee14a['query'][_0xed13('0x38')];if(typeof _0x2d29aa===_0xed13('0x39')){_0x42d5f7=_[_0xed13('0x38')](_0x5b3828,function(_0x166bf4){return _[_0xed13('0x3')](_0x2d29aa['columns'],_0x166bf4[_0xed13('0x14')]);});_0x2d29aa=_0x2d29aa[_0xed13('0x3a')];}_0x3ac2f7[_0xed13('0x37')]=_[_0xed13('0x3b')](_0x3ac2f7[_0xed13('0x37')],{'$or':_[_0xed13('0x32')](_0x42d5f7,function(_0x535de7){if(_0x535de7[_0xed13('0xb')]!==_0xed13('0x3c')){if(_0x55c1db){return sequelize[_0xed13('0x37')](sequelize['fn'](_0xed13('0x3d'),sequelize[_0xed13('0x1b')](_0x535de7[_0xed13('0x14')])),{'$like':sequelize['fn'](_0xed13('0x3d'),'%'+_0x7ee14a[_0xed13('0x2f')][_0xed13('0x38')]+'%')});}else{var _0x25a734={};_0x25a734[_0x535de7[_0xed13('0x14')]]={'$like':'%'+_0x7ee14a[_0xed13('0x2f')][_0xed13('0x38')]+'%'};return _0x25a734;}}})});}_0x3ac2f7=_[_0xed13('0x3b')]({},_0x3ac2f7,_0x7ee14a['options']);return _0x3ac2f7;}; \ No newline at end of file +var _0x7da7=['attributes','length','nolimit','where','pick','filter','object','columns','value','merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','split','forOwn','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte','subtract','name','uniqueid','limit','offset','sort','map','indexOf','priority','cast','unsigned','DESC','col','ASC','isEmpty','isArray','omit','isObject','isString','unset','hasOwnProperty','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','filters'];(function(_0x4ba015,_0x1cd065){var _0x2f31ad=function(_0x1f1510){while(--_0x1f1510){_0x4ba015['push'](_0x4ba015['shift']());}};_0x2f31ad(++_0x1cd065);}(_0x7da7,0x10d));var _0x77da=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0x7da7[_0x3e7804];return _0x56efda;};'use strict';var _=require(_0x77da('0x0'));var sequelize=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x571213){var _0x59892b=['ne'];try{var _0x37667b=JSON[_0x77da('0x3')](_0x571213);var _0x4f60c3=Object[_0x77da('0x4')](_0x37667b)[0x0];return _0x59892b[_0x77da('0x5')](_0x4f60c3);}catch(_0x56458c){return![];}}function getOperatorValue(_0x19331c){var _0xc54a12=JSON['parse'](_0x19331c);var _0x30afe0=Object['keys'](_0xc54a12)[0x0];var _0x1191de=_0xc54a12[_0x30afe0];return{['$'+_0x30afe0]:_0x1191de};}exports[_0x77da('0x6')]=function(_0x37c5ab){var _0x910e5b=null;if(_0x37c5ab){_0x910e5b=_0x37c5ab[_0x77da('0x7')](',');}return _0x910e5b;};exports['filters']=function(_0x40c86e,_0xb55827){var _0x172d7f={};if(!_['isEmpty'](_0x40c86e)){_[_0x77da('0x8')](_0x40c86e,function(_0x1ab717,_0x163350){try{if(_0xb55827){var _0x2a675a=_['find'](_0xb55827,{'name':_0x163350})||{};if(hasSequelizeOperator(_0x1ab717)){_0x172d7f[_0x163350]=getOperatorValue(_0x1ab717);}else if(_0x2a675a[_0x77da('0x9')]===_0x77da('0xa')&&_[_0x77da('0xb')](_0x1ab717)){var _0x5d6e2f=JSON['parse'](_0x1ab717);var _0x26e3ff={'$gte':moment(moment(_0x5d6e2f[_0x77da('0xc')])['format'](_0x77da('0xd')))[_0x77da('0xe')]()[_0x77da('0xf')](),'$lte':moment(moment(_0x5d6e2f[_0x77da('0x10')])['format'](_0x77da('0xd')))['utc']()[_0x77da('0x11')](0x1,'s')[_0x77da('0xf')]()};_0x172d7f[_0x163350]=_0x26e3ff;}else if(_0x2a675a[_0x77da('0x12')]===_0x77da('0x13')){_0x172d7f[_0x163350]=_0x1ab717;}else{_0x172d7f[_0x163350]=_['isArray'](_0x1ab717)?_0x1ab717:JSON['parse'](_0x1ab717);}}else{_0x172d7f[_0x163350]=_['isArray'](_0x1ab717)?_0x1ab717:JSON['parse'](_0x1ab717);}}catch(_0x103e46){_0x172d7f[_0x163350]=_0x1ab717[_0x77da('0x7')](',');}});}return _0x172d7f;};exports[_0x77da('0x14')]=function(_0x335dcb){_0x335dcb=parseInt(_0x335dcb,0xa);if(!_0x335dcb||_0x335dcb<0x0){_0x335dcb=LIMIT_VALUE;}return _0x335dcb;};exports[_0x77da('0x15')]=function(_0x12d2b1){_0x12d2b1=parseInt(_0x12d2b1,0xa);if(!_0x12d2b1||_0x12d2b1<0x0){_0x12d2b1=0x0;}return _0x12d2b1;};exports[_0x77da('0x16')]=function(_0x3b6dde){var _0x544104,_0x492063=null;if(_0x3b6dde){_0x544104=_0x3b6dde[_0x77da('0x7')](',');_0x492063=_[_0x77da('0x17')](_0x544104,function(_0x507979){if(_0x507979[_0x77da('0x18')]('-')===0x0){return[_0x507979===_0x77da('0x19')?sequelize[_0x77da('0x1a')](sequelize['col']('priority'),_0x77da('0x1b')):_0x507979['substr'](0x1),_0x77da('0x1c')];}else{return[_0x507979===_0x77da('0x19')?sequelize[_0x77da('0x1a')](sequelize[_0x77da('0x1d')](_0x77da('0x19')),_0x77da('0x1b')):_0x507979,_0x77da('0x1e')];}});}return _0x492063;};exports['omit']=function(_0x4885ec,_0xfd160){if(_[_0x77da('0x1f')](_0x4885ec)){return _0x4885ec;}if(_[_0x77da('0x20')](_0x4885ec)){for(var _0xbd06b7=0x0;_0xbd06b7<_0x4885ec['length'];_0xbd06b7+=0x1){_0x4885ec[_0xbd06b7]=this[_0x77da('0x21')](_0x4885ec[_0xbd06b7],_0xfd160);}return _0x4885ec;}if(!_[_0x77da('0x22')](_0x4885ec)){return _0x4885ec;}if(_[_0x77da('0x23')](_0xfd160)){_0xfd160=[_0xfd160];}if(!_[_0x77da('0x20')](_0xfd160)){return _0x4885ec;}for(var _0x446ae7=0x0;_0x446ae7<_0xfd160['length'];_0x446ae7+=0x1){_[_0x77da('0x24')](_0x4885ec,_0xfd160[_0x446ae7]);}for(var _0x3e090d in _0x4885ec){if(_0x4885ec[_0x77da('0x25')](_0x3e090d)){_0x4885ec[_0x3e090d]=this[_0x77da('0x21')](_0x4885ec[_0x3e090d],_0xfd160);}}return _0x4885ec;};exports['isNumeric']=function(_0x5b4638){return _0x5b4638['match'](RegExp(_0x77da('0x26')))?!![]:![];};exports[_0x77da('0x27')]=function(_0x410d09){return _0x410d09[_0x77da('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0x77da('0x29')]=function(_0x4eeb99){var _0x350b4e=[];_0x4eeb99[_0x77da('0x7')](/[ ,]+/)[_0x77da('0x2a')](function(_0x1d381b){_0x1d381b=_0x1d381b[_0x77da('0x2b')](/([^:]")"+/g,'$1');_0x1d381b='+'+_0x1d381b+'*';var _0x46e6b4=/[ `!@#$%^&*()_\-?~]/;if(_0x1d381b['match'](_0x46e6b4))_0x1d381b='\x22'+_0x1d381b+'\x22';_0x350b4e[_0x77da('0x2c')](_0x1d381b);});return _0x350b4e[_0x77da('0x2d')]('\x20');};exports[_0x77da('0x2e')]=function(_0x38643a,_0x3c3c64,_0x12ea16){var _0x3343b4={},_0x2c790d={};if(_0x3c3c64['query']['$id']){_0x3c3c64[_0x77da('0x2f')]['id']=_0x3c3c64[_0x77da('0x2f')]['$id'];delete _0x3c3c64[_0x77da('0x2f')][_0x77da('0x30')];}_0x3343b4[_0x77da('0x31')]=_[_0x77da('0x17')](_0x38643a,_0x77da('0x12'));_0x3343b4[_0x77da('0x2f')]=_[_0x77da('0x4')](_0x3c3c64['query']);_0x3343b4[_0x77da('0x32')]=_['intersection'](_0x3343b4['model'],_0x3343b4['query']);_0x2c790d[_0x77da('0x33')]=_['intersection'](_0x3343b4[_0x77da('0x31')],this[_0x77da('0x6')](_0x3c3c64[_0x77da('0x2f')][_0x77da('0x6')]));_0x2c790d[_0x77da('0x33')]=_0x2c790d[_0x77da('0x33')][_0x77da('0x34')]?_0x2c790d['attributes']:_0x3343b4[_0x77da('0x31')];if(!_0x3c3c64[_0x77da('0x2f')][_0x77da('0x25')](_0x77da('0x35'))){_0x2c790d[_0x77da('0x14')]=this[_0x77da('0x14')](_0x3c3c64['query'][_0x77da('0x14')]);_0x2c790d[_0x77da('0x15')]=this[_0x77da('0x15')](_0x3c3c64['query'][_0x77da('0x15')]);}_0x2c790d['order']=this['sort'](_0x3c3c64['query']['sort']);_0x2c790d[_0x77da('0x36')]=this[_0x77da('0x32')](_[_0x77da('0x37')](_0x3c3c64['query'],_0x3343b4[_0x77da('0x32')]),_0x38643a);if(_0x3c3c64['query'][_0x77da('0x38')]){var _0x517bd0=_0x38643a;var _0x3c216f=_0x3c3c64[_0x77da('0x2f')][_0x77da('0x38')];if(typeof _0x3c216f===_0x77da('0x39')){_0x517bd0=_[_0x77da('0x38')](_0x38643a,function(_0x5ecf12){return _[_0x77da('0x5')](_0x3c216f[_0x77da('0x3a')],_0x5ecf12[_0x77da('0x12')]);});_0x3c216f=_0x3c216f[_0x77da('0x3b')];}_0x2c790d[_0x77da('0x36')]=_[_0x77da('0x3c')](_0x2c790d['where'],{'$or':_[_0x77da('0x17')](_0x517bd0,function(_0x2f0495){if(_0x2f0495[_0x77da('0x9')]!==_0x77da('0x3d')){if(_0x12ea16){return sequelize[_0x77da('0x36')](sequelize['fn'](_0x77da('0x3e'),sequelize['col'](_0x2f0495[_0x77da('0x12')])),{'$like':sequelize['fn']('lower','%'+_0x3c3c64[_0x77da('0x2f')][_0x77da('0x38')]+'%')});}else{var _0x40a492={};_0x40a492[_0x2f0495['name']]={'$like':'%'+_0x3c3c64[_0x77da('0x2f')][_0x77da('0x38')]+'%'};return _0x40a492;}}})});}_0x2c790d=_[_0x77da('0x3c')]({},_0x2c790d,_0x3c3c64[_0x77da('0x3f')]);return _0x2c790d;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 7cd4331..49db951 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(_0xffc0df,_0x28ac48){var _0x22f4a8=function(_0x2ab137){while(--_0x2ab137){_0xffc0df['push'](_0xffc0df['shift']());}};_0x22f4a8(++_0x28ac48);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x23840e,_0x2fb0cb){var _0x277300=function(_0x246e5a){while(--_0x246e5a){_0x23840e['push'](_0x23840e['shift']());}};_0x277300(++_0x2fb0cb);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index f17fea6..f71b039 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 _0xcb06=['win32','utf8','replace','hostname','ipAddress','md5','substring','lodash','bimedia-machine-uuid','execSync','../environment','networkInterfaces','keys','length','filter','family','IPv4','internal','concat','mac','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','createHash','update','digest','hex','platform','test','licenseToken'];(function(_0x1d606d,_0x376e51){var _0x3c38bd=function(_0x2ea4e2){while(--_0x2ea4e2){_0x1d606d['push'](_0x1d606d['shift']());}};_0x3c38bd(++_0x376e51);}(_0xcb06,0x8f));var _0x6cb0=function(_0x3bf3f1,_0x5b8238){_0x3bf3f1=_0x3bf3f1-0x0;var _0x5a0c0c=_0xcb06[_0x3bf3f1];return _0x5a0c0c;};'use strict';var _=require(_0x6cb0('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x6cb0('0x1'));var exec=require('child_process')[_0x6cb0('0x2')];var config=require(_0x6cb0('0x3'));function getInterfaces(){var _0x10b8b4=[];var _0x321fdb=os[_0x6cb0('0x4')]();var _0x8020b=_['orderBy'](_[_0x6cb0('0x5')](_0x321fdb));for(var _0x281bfe=0x0;_0x281bfe<_0x8020b[_0x6cb0('0x6')];_0x281bfe++){var _0x1b1be8=_0x321fdb[_0x8020b[_0x281bfe]][_0x6cb0('0x7')](function(_0x3e4bd9){return _0x3e4bd9[_0x6cb0('0x8')]===_0x6cb0('0x9')&&_0x3e4bd9[_0x6cb0('0xa')]===![];});_0x10b8b4=_0x10b8b4[_0x6cb0('0xb')](_0x1b1be8);}return _0x10b8b4;}function getFirstInterface(){var _0x71a457=_['head'](getInterfaces());return{'macAddress':_0x71a457&&_0x71a457[_0x6cb0('0xc')]?_0x71a457[_0x6cb0('0xc')]:'00:00:00:00:00:00','ipAddress':_0x71a457&&_0x71a457[_0x6cb0('0xd')]?_0x71a457[_0x6cb0('0xd')]:_0x6cb0('0xe')};}exports[_0x6cb0('0xf')]=getFirstInterface;function getCPUhash(){var _0xe79bd=_[_0x6cb0('0x10')](os[_0x6cb0('0x11')]()[_0x6cb0('0x12')](function(_0x255d5d){return _0x255d5d[_0x6cb0('0x13')];}))['join'](':');return crypto[_0x6cb0('0x14')]('md5')[_0x6cb0('0x15')](_0xe79bd)[_0x6cb0('0x16')](_0x6cb0('0x17'));}exports['getUuid']=function(){var _0x370b59=os[_0x6cb0('0x18')]();var _0xb159c3=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0xb159c3[_0x6cb0('0x19')](config[_0x6cb0('0x1a')])){return config[_0x6cb0('0x1a')];}else if(_0x370b59===_0x6cb0('0x1b')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x6cb0('0x1c')})[_0x6cb0('0x1d')]('\x0d\x0a','');}else{var _0x261e5=getFirstInterface();var _0x2de290=getCPUhash();var _0x219906=_0x2de290+'|'+os[_0x6cb0('0x1e')]()+'|'+_0x261e5['macAddress']+'|'+_0x261e5[_0x6cb0('0x1f')];var _0x121383=crypto[_0x6cb0('0x14')](_0x6cb0('0x20'))[_0x6cb0('0x15')](_0x219906)[_0x6cb0('0x16')]('hex');return _0x121383[_0x6cb0('0x21')](0x0,0x8)+'-'+_0x121383[_0x6cb0('0x21')](0x8,0xc)+'-'+_0x121383['substring'](0xc,0x10)+'-'+_0x121383['substring'](0x10,0x14)+'-'+_0x121383['substring'](0x14);}}; \ No newline at end of file +var _0x0be2=['join','createHash','update','digest','platform','licenseToken','test','win32','utf8','replace','hostname','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','length','family','internal','concat','head','address','127.0.0.1','cpus','model'];(function(_0x3d4a33,_0x260982){var _0x4ec13e=function(_0x225e6e){while(--_0x225e6e){_0x3d4a33['push'](_0x3d4a33['shift']());}};_0x4ec13e(++_0x260982);}(_0x0be2,0x125));var _0x20be=function(_0x20cc29,_0x30a46d){_0x20cc29=_0x20cc29-0x0;var _0x28d513=_0x0be2[_0x20cc29];return _0x28d513;};'use strict';var _=require(_0x20be('0x0'));var os=require('os');var crypto=require(_0x20be('0x1'));var machine=require(_0x20be('0x2'));var exec=require('child_process')[_0x20be('0x3')];var config=require(_0x20be('0x4'));function getInterfaces(){var _0x7c3982=[];var _0x4677fd=os[_0x20be('0x5')]();var _0x27d2ae=_[_0x20be('0x6')](_[_0x20be('0x7')](_0x4677fd));for(var _0x1663cc=0x0;_0x1663cc<_0x27d2ae[_0x20be('0x8')];_0x1663cc++){var _0x2813f4=_0x4677fd[_0x27d2ae[_0x1663cc]]['filter'](function(_0x5ef7c0){return _0x5ef7c0[_0x20be('0x9')]==='IPv4'&&_0x5ef7c0[_0x20be('0xa')]===![];});_0x7c3982=_0x7c3982[_0x20be('0xb')](_0x2813f4);}return _0x7c3982;}function getFirstInterface(){var _0x13f179=_[_0x20be('0xc')](getInterfaces());return{'macAddress':_0x13f179&&_0x13f179['mac']?_0x13f179['mac']:'00:00:00:00:00:00','ipAddress':_0x13f179&&_0x13f179[_0x20be('0xd')]?_0x13f179[_0x20be('0xd')]:_0x20be('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x5a6aa1=_[_0x20be('0x6')](os[_0x20be('0xf')]()['map'](function(_0x161ad2){return _0x161ad2[_0x20be('0x10')];}))[_0x20be('0x11')](':');return crypto[_0x20be('0x12')]('md5')[_0x20be('0x13')](_0x5a6aa1)[_0x20be('0x14')]('hex');}exports['getUuid']=function(){var _0x3fce97=os[_0x20be('0x15')]();var _0x404396=/[0-9a-f-]{36}/;if(config[_0x20be('0x16')]&&_0x404396[_0x20be('0x17')](config[_0x20be('0x16')])){return config[_0x20be('0x16')];}else if(_0x3fce97===_0x20be('0x18')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x20be('0x19')})[_0x20be('0x1a')]('\x0d\x0a','');}else{var _0x4548eb=getFirstInterface();var _0x3487fe=getCPUhash();var _0x367c1b=_0x3487fe+'|'+os[_0x20be('0x1b')]()+'|'+_0x4548eb['macAddress']+'|'+_0x4548eb[_0x20be('0x1c')];var _0x44cfc5=crypto[_0x20be('0x12')]('md5')['update'](_0x367c1b)['digest'](_0x20be('0x1d'));return _0x44cfc5[_0x20be('0x1e')](0x0,0x8)+'-'+_0x44cfc5[_0x20be('0x1e')](0x8,0xc)+'-'+_0x44cfc5['substring'](0xc,0x10)+'-'+_0x44cfc5['substring'](0x10,0x14)+'-'+_0x44cfc5[_0x20be('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index f9eaf97..9d5090a 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 _0xd681=['License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','data1','data2','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','toUpperCase','format','YYYY-MM-DD\x20HH:mm','encryptString','diff','catch','error','message','finally','getUuid'];(function(_0x746f4e,_0x4e9e3f){var _0xbbfc3a=function(_0x47f14a){while(--_0x47f14a){_0x746f4e['push'](_0x746f4e['shift']());}};_0xbbfc3a(++_0x4e9e3f);}(_0xd681,0xe9));var _0x1d68=function(_0x471bca,_0x7640da){_0x471bca=_0x471bca-0x0;var _0x2231f1=_0xd681[_0x471bca];return _0x2231f1;};'use strict';var util=require(_0x1d68('0x0'));var moment=require(_0x1d68('0x1'));var rp=require(_0x1d68('0x2'));var BPromise=require(_0x1d68('0x3'));var pkginfo=require(_0x1d68('0x4'))(module,_0x1d68('0x5'));var db=require(_0x1d68('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0x1d68('0x7'))(_0x1d68('0x8'));var HOST=_0x1d68('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2efa74){return new BPromise(function(_0x12538e,_0x58395c){var _0x40cf3b=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x2efa74,module['exports'][_0x1d68('0x5')]);if(oldToken){_0x40cf3b=util['format'](_0x1d68('0xa'),HOST,_0x2efa74,module['exports'][_0x1d68('0x5')],oldToken);}var _0x4a7f4f={'uri':_0x40cf3b,'method':_0x1d68('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x4a7f4f)[_0x1d68('0xc')](function(_0x338f8d){_0x12538e(_0x338f8d);})['catch'](function(_0x1a9715){_0x58395c(_0x1a9715);});});}function manageLicense(_0x4a2ed0,_0x20ff92){var _0xbcf868=_0x20ff92['get']({'plain':!![]});if(!isOldTokenSent&&_0xbcf868[_0x1d68('0xd')]!==_0x4a2ed0&&!_0xbcf868[_0x1d68('0xe')]){oldToken=_0xbcf868['data1'];}httpRequest(_0x4a2ed0)[_0x1d68('0xc')](function(_0x1f0bd8){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1f0bd8['active']){isOldTokenSent=![];if(!_0xbcf868[_0x1d68('0x8')]&&_0xbcf868[_0x1d68('0x8')]!=_0x1f0bd8['license']||_0xbcf868[_0x1d68('0x8')]&&_0xbcf868[_0x1d68('0xe')]){logger[_0x1d68('0xf')](_0x1d68('0x10'));}if(_0xbcf868[_0x1d68('0x8')]&&!_0xbcf868[_0x1d68('0xe')]&&_0xbcf868[_0x1d68('0x8')]!=_0x1f0bd8[_0x1d68('0x8')]){logger[_0x1d68('0xf')](_0x1d68('0x11'));}if(_0xbcf868[_0x1d68('0x8')]&&!_0xbcf868[_0x1d68('0xe')]&&_0xbcf868['license']==_0x1f0bd8[_0x1d68('0x8')]){return _0x20ff92;}return _0x20ff92[_0x1d68('0x12')]({'data1':_0x4a2ed0,'data2':null,'license':_0x1f0bd8[_0x1d68('0x8')]});}else{if(_0x1f0bd8[_0x1d68('0x8')]||_0xbcf868['license']){if(!_0xbcf868[_0x1d68('0xe')]){if(_0xbcf868[_0x1d68('0xd')]==_0x4a2ed0){GRAY_PERIOD_REASON=_0x1d68('0x13');logger[_0x1d68('0xf')](_0x1d68('0x14'));}else{GRAY_PERIOD_REASON=_0x1d68('0x15');logger[_0x1d68('0xf')](_0x1d68('0x16'),_0xbcf868[_0x1d68('0xd')],_0x4a2ed0);}logger[_0x1d68('0xf')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x1d68('0x17')](),moment()[_0x1d68('0x18')](_0x1d68('0x19')));return _0x20ff92[_0x1d68('0x12')]({'data2':encryptor[_0x1d68('0x1a')](moment()['format'](_0x1d68('0x19')))});}else{if(moment()[_0x1d68('0x1b')](encryptor['decryptString'](_0xbcf868[_0x1d68('0xe')]),'days')>DAYS){logger[_0x1d68('0xf')]('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x1d68('0x19')));isOldTokenSent=![];return _0x20ff92[_0x1d68('0x12')]({'data1':_0x4a2ed0,'data2':null,'license':null});}}}else{if(_0xbcf868['data1']!=_0x4a2ed0){logger[_0x1d68('0xf')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xbcf868[_0x1d68('0xd')],_0x4a2ed0);return _0x20ff92[_0x1d68('0x12')]({'data1':_0x4a2ed0,'data2':null,'license':null});}}}return _0x20ff92;})[_0x1d68('0xc')](function(_0x22d436){_0x20ff92=_0x22d436;})[_0x1d68('0x1c')](function(_0x2621fe){logger[_0x1d68('0x1d')](_0x2621fe[_0x1d68('0x1e')]);})[_0x1d68('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0x1d68('0x20')](),_0x20ff92);},TIME);});}function defaultLicense(){var _0x31b74b=hardware[_0x1d68('0x20')]();if(_0x31b74b){return db[_0x1d68('0x21')][_0x1d68('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x31b74b}})[_0x1d68('0x23')](function(_0x50b55,_0xf2a1ed){logger[_0x1d68('0xf')](_0x1d68('0x24'),_0x31b74b);manageLicense(_0x31b74b,_0x50b55);})[_0x1d68('0x1c')](function(_0x72d020){logger[_0x1d68('0x1d')](_0x72d020['message']);});}}exports[_0x1d68('0x25')]=defaultLicense; \ No newline at end of file +var _0xa66f=['YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','message','finally','getUuid','License','findOrCreate','spread','util','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','format','%s/api/servers/%s/check?version=%s','exports','GET','catch','get','data1','data2','then','active','license','info','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xa66f,0xf9));var _0xfa66=function(_0x1664cb,_0x57a951){_0x1664cb=_0x1664cb-0x0;var _0x4edd61=_0xa66f[_0x1664cb];return _0x4edd61;};'use strict';var util=require(_0xfa66('0x0'));var moment=require('moment');var rp=require(_0xfa66('0x1'));var BPromise=require(_0xfa66('0x2'));var pkginfo=require(_0xfa66('0x3'))(module,_0xfa66('0x4'));var db=require(_0xfa66('0x5'))['db'];var encryptor=require(_0xfa66('0x6'));var hardware=require('./hardware');var logger=require('../logger')('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x46461d){return new BPromise(function(_0x395117,_0x18f628){var _0x208773=util[_0xfa66('0x7')](_0xfa66('0x8'),HOST,_0x46461d,module[_0xfa66('0x9')]['version']);if(oldToken){_0x208773=util[_0xfa66('0x7')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x46461d,module['exports']['version'],oldToken);}var _0x14d51d={'uri':_0x208773,'method':_0xfa66('0xa'),'timeout':0xea60,'json':!![]};return rp(_0x14d51d)['then'](function(_0x23c2b6){_0x395117(_0x23c2b6);})[_0xfa66('0xb')](function(_0x475633){_0x18f628(_0x475633);});});}function manageLicense(_0x3a5e8a,_0x14b37f){var _0xf89884=_0x14b37f[_0xfa66('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0xf89884[_0xfa66('0xd')]!==_0x3a5e8a&&!_0xf89884[_0xfa66('0xe')]){oldToken=_0xf89884[_0xfa66('0xd')];}httpRequest(_0x3a5e8a)[_0xfa66('0xf')](function(_0x1f4731){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1f4731[_0xfa66('0x10')]){isOldTokenSent=![];if(!_0xf89884[_0xfa66('0x11')]&&_0xf89884[_0xfa66('0x11')]!=_0x1f4731[_0xfa66('0x11')]||_0xf89884[_0xfa66('0x11')]&&_0xf89884['data2']){logger[_0xfa66('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0xf89884[_0xfa66('0x11')]&&!_0xf89884[_0xfa66('0xe')]&&_0xf89884[_0xfa66('0x11')]!=_0x1f4731[_0xfa66('0x11')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0xf89884[_0xfa66('0x11')]&&!_0xf89884[_0xfa66('0xe')]&&_0xf89884[_0xfa66('0x11')]==_0x1f4731[_0xfa66('0x11')]){return _0x14b37f;}return _0x14b37f[_0xfa66('0x13')]({'data1':_0x3a5e8a,'data2':null,'license':_0x1f4731[_0xfa66('0x11')]});}else{if(_0x1f4731[_0xfa66('0x11')]||_0xf89884['license']){if(!_0xf89884[_0xfa66('0xe')]){if(_0xf89884[_0xfa66('0xd')]==_0x3a5e8a){GRAY_PERIOD_REASON='Disabled';logger['info'](_0xfa66('0x14'));}else{GRAY_PERIOD_REASON=_0xfa66('0x15');logger[_0xfa66('0x12')](_0xfa66('0x16'),_0xf89884[_0xfa66('0xd')],_0x3a5e8a);}logger[_0xfa66('0x12')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0xfa66('0x17')));return _0x14b37f[_0xfa66('0x13')]({'data2':encryptor[_0xfa66('0x18')](moment()[_0xfa66('0x7')](_0xfa66('0x17')))});}else{if(moment()[_0xfa66('0x19')](encryptor[_0xfa66('0x1a')](_0xf89884[_0xfa66('0xe')]),_0xfa66('0x1b'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0xfa66('0x7')](_0xfa66('0x17')));isOldTokenSent=![];return _0x14b37f[_0xfa66('0x13')]({'data1':_0x3a5e8a,'data2':null,'license':null});}}}else{if(_0xf89884[_0xfa66('0xd')]!=_0x3a5e8a){logger[_0xfa66('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xf89884[_0xfa66('0xd')],_0x3a5e8a);return _0x14b37f['update']({'data1':_0x3a5e8a,'data2':null,'license':null});}}}return _0x14b37f;})[_0xfa66('0xf')](function(_0x46335a){_0x14b37f=_0x46335a;})[_0xfa66('0xb')](function(_0x42ad6e){logger['error'](_0x42ad6e[_0xfa66('0x1c')]);})[_0xfa66('0x1d')](function(){setTimeout(function(){manageLicense(hardware[_0xfa66('0x1e')](),_0x14b37f);},TIME);});}function defaultLicense(){var _0x55ce73=hardware[_0xfa66('0x1e')]();if(_0x55ce73){return db[_0xfa66('0x1f')][_0xfa66('0x20')]({'where':{'id':0x1},'defaults':{'data1':_0x55ce73}})[_0xfa66('0x21')](function(_0x4a97d9,_0x315dc7){logger[_0xfa66('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x55ce73);manageLicense(_0x55ce73,_0x4a97d9);})[_0xfa66('0xb')](function(_0x2effa1){logger['error'](_0x2effa1['message']);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index dfa5663..72e2e49 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 _0x7dc2=['then','catch','uuid','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','deadline','add','days','grayReason','changed','message','User','findAll','role','sequelize','COUNT','count','admin','user','telephone','users','telephones','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults'];(function(_0xdc81db,_0x6d3e9f){var _0x277401=function(_0x446e7a){while(--_0x446e7a){_0xdc81db['push'](_0xdc81db['shift']());}};_0x277401(++_0x6d3e9f);}(_0x7dc2,0x154));var _0x27dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7dc2[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x27dc('0x0'));var _=require(_0x27dc('0x1'));var moment=require(_0x27dc('0x2'));var BPromise=require(_0x27dc('0x3'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0x27dc('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x27dc('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x27dc('0x6'),'machineUuid':hardware[_0x27dc('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x27dc('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x27dc('0x8'),'machineUuid':hardware[_0x27dc('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x29bd61){return new BPromise(function(_0x48f05a,_0x23f777){return db[_0x27dc('0x9')][_0x27dc('0xa')](_[_0x27dc('0xb')](_0x29bd61,{'raw':!![],'where':{'id':0x1}}))[_0x27dc('0xc')](function(_0x57c9fa){return checkLicense(_0x57c9fa,null);})[_0x27dc('0xc')](function(_0x575b6f){_0x48f05a(_0x575b6f);return;})[_0x27dc('0xd')](function(_0x37aac1){_0x23f777(_0x37aac1);});});}function checkLicense(_0x55f5fb,_0x4fdd54){if(!_0x55f5fb){demoLicense[_0x27dc('0xe')]=_0x55f5fb['data1'];return demoLicense;}try{var _0x1bd2b4=_0x4fdd54||_0x55f5fb['license'];if(_[_0x27dc('0xf')](_0x1bd2b4)){throw new Error(_0x27dc('0x10'));}var _0x22d2a2=_0x55f5fb['data1'];var _0xfdb20c=_0x55f5fb['data2'];var _0x4a0f0a=_0x22d2a2[_0x27dc('0x11')]('-')[0x4];var _0x302153=_0x22d2a2[_0x27dc('0x11')]('-')[0x0];var _0x5542a1=encryptor[_0x27dc('0x12')](_0x1bd2b4,util[_0x27dc('0x13')](_0x27dc('0x14'),_0x4a0f0a,_0x22d2a2,_0x302153));var _0x44ad7f=JSON[_0x27dc('0x15')](_0x5542a1);_0x44ad7f[_0x27dc('0x16')]=![];_0x44ad7f[_0x27dc('0xe')]=_0x22d2a2;_0x44ad7f[_0x27dc('0x17')]=hardware['getUuid']();if(_0xfdb20c){var _0xeb51c8=encryptor[_0x27dc('0x12')](_0xfdb20c);_0x44ad7f['gray']=_0xeb51c8;_0x44ad7f[_0x27dc('0x18')]=moment(_0xeb51c8)[_0x27dc('0x19')](0x7,_0x27dc('0x1a'))[_0x27dc('0x13')]();_0x44ad7f[_0x27dc('0x1b')]=_0x44ad7f[_0x27dc('0xe')]!=_0x44ad7f['machineUuid']?_0x27dc('0x1c'):'disabled';}return _0x44ad7f;}catch(_0x334eb7){breakingLicense[_0x27dc('0xe')]=_0x55f5fb['data1'];breakingLicense[_0x27dc('0x1d')]=_0x334eb7[_0x27dc('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x462342,_0x403f73){getLicense()[_0x27dc('0xc')](function(_0x1cf961){return db[_0x27dc('0x1e')][_0x27dc('0x1f')]({'attributes':[_0x27dc('0x20'),[db[_0x27dc('0x21')]['fn'](_0x27dc('0x22'),db[_0x27dc('0x21')]['col']('role')),_0x27dc('0x23')]],'group':_0x27dc('0x20'),'where':{'role':{'$or':[_0x27dc('0x24'),_0x27dc('0x25'),_0x27dc('0x26')]}},'raw':!![]})[_0x27dc('0xc')](function(_0x4ba6bb){var _0x250577={'user':_0x1cf961[_0x27dc('0x27')]||0x0,'telephone':_0x1cf961[_0x27dc('0x28')]||0x0};_0x4ba6bb['forEach'](function(_0x199388){var _0x24621c=_0x199388[_0x27dc('0x20')]===_0x27dc('0x24')?'user':_0x199388[_0x27dc('0x20')];_0x250577[_0x24621c]-=_0x199388[_0x27dc('0x23')];if(_0x250577[_0x24621c]<0x0)_0x250577[_0x24621c]=0x0;});_0x462342(_0x250577);return;});})['catch'](function(_0x2e519a){_0x403f73(_0x2e519a);});});}function checkUserLimits(_0x2d1e5a){return new BPromise(function(_0xf02c8b,_0x4da6c4){getLimits()[_0x27dc('0xc')](function(_0x91749b){var _0x3391f6=_['pick'](_[_0x27dc('0x29')](_0x2d1e5a,_0x27dc('0x20')),[_0x27dc('0x24'),'user',_0x27dc('0x26')]);var _0x43272f=(_0x3391f6['admin']||0x0)+(_0x3391f6[_0x27dc('0x25')]||0x0);var _0xe68643=_0x3391f6[_0x27dc('0x26')]||0x0;if(_0x43272f>_0x91749b['user'])return _0x4da6c4(_0x27dc('0x2a'));if(_0xe68643>_0x91749b['telephone'])return _0x4da6c4('License\x20limit\x20reached\x20for\x20telephones');return _0xf02c8b();})['catch'](function(_0x5107cf){_0x4da6c4(_0x5107cf);});});}module[_0x27dc('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x8b1a=['then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','uuid','machineUuid','gray','deadline','add','days','changed','disabled','message','User','sequelize','COUNT','col','role','admin','user','telephone','users','telephones','forEach','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','defaults'];(function(_0x5087b7,_0x117485){var _0x3b4c2b=function(_0x3d25db){while(--_0x3d25db){_0x5087b7['push'](_0x5087b7['shift']());}};_0x3b4c2b(++_0x117485);}(_0x8b1a,0x131));var _0xa8b1=function(_0x189aa6,_0x1ac764){_0x189aa6=_0x189aa6-0x0;var _0x4810a6=_0x8b1a[_0x189aa6];return _0x4810a6;};'use strict';var util=require(_0xa8b1('0x0'));var _=require(_0xa8b1('0x1'));var moment=require('moment');var BPromise=require(_0xa8b1('0x2'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0xa8b1('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa8b1('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xa8b1('0x5'),'machineUuid':hardware[_0xa8b1('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa8b1('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xa8b1('0x7'),'machineUuid':hardware[_0xa8b1('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3e8775){return new BPromise(function(_0x5e3759,_0x29c720){return db['License'][_0xa8b1('0x8')](_[_0xa8b1('0x9')](_0x3e8775,{'raw':!![],'where':{'id':0x1}}))[_0xa8b1('0xa')](function(_0x57f1b2){return checkLicense(_0x57f1b2,null);})[_0xa8b1('0xa')](function(_0x599339){_0x5e3759(_0x599339);return;})[_0xa8b1('0xb')](function(_0x5b6c45){_0x29c720(_0x5b6c45);});});}function checkLicense(_0x586bd2,_0x591931){if(!_0x586bd2){demoLicense['uuid']=_0x586bd2[_0xa8b1('0xc')];return demoLicense;}try{var _0xdc36c1=_0x591931||_0x586bd2[_0xa8b1('0xd')];if(_[_0xa8b1('0xe')](_0xdc36c1)){throw new Error(_0xa8b1('0xf'));}var _0x209691=_0x586bd2['data1'];var _0x4a5694=_0x586bd2[_0xa8b1('0x10')];var _0x591be2=_0x209691[_0xa8b1('0x11')]('-')[0x4];var _0x147e50=_0x209691['split']('-')[0x0];var _0x36fcef=encryptor[_0xa8b1('0x12')](_0xdc36c1,util[_0xa8b1('0x13')]('%s:%s:%s',_0x591be2,_0x209691,_0x147e50));var _0x265b45=JSON[_0xa8b1('0x14')](_0x36fcef);_0x265b45['demo']=![];_0x265b45[_0xa8b1('0x15')]=_0x209691;_0x265b45[_0xa8b1('0x16')]=hardware['getUuid']();if(_0x4a5694){var _0x89c42c=encryptor['decryptString'](_0x4a5694);_0x265b45[_0xa8b1('0x17')]=_0x89c42c;_0x265b45[_0xa8b1('0x18')]=moment(_0x89c42c)[_0xa8b1('0x19')](0x7,_0xa8b1('0x1a'))[_0xa8b1('0x13')]();_0x265b45['grayReason']=_0x265b45[_0xa8b1('0x15')]!=_0x265b45[_0xa8b1('0x16')]?_0xa8b1('0x1b'):_0xa8b1('0x1c');}return _0x265b45;}catch(_0x5b67f1){breakingLicense[_0xa8b1('0x15')]=_0x586bd2[_0xa8b1('0xc')];breakingLicense['message']=_0x5b67f1[_0xa8b1('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x121a65,_0x3d79b8){getLicense()[_0xa8b1('0xa')](function(_0x74e933){return db[_0xa8b1('0x1e')]['findAll']({'attributes':['role',[db[_0xa8b1('0x1f')]['fn'](_0xa8b1('0x20'),db[_0xa8b1('0x1f')][_0xa8b1('0x21')](_0xa8b1('0x22'))),'count']],'group':_0xa8b1('0x22'),'where':{'role':{'$or':[_0xa8b1('0x23'),_0xa8b1('0x24'),_0xa8b1('0x25')]}},'raw':!![]})[_0xa8b1('0xa')](function(_0xd7e9be){var _0x5ed784={'user':_0x74e933[_0xa8b1('0x26')]||0x0,'telephone':_0x74e933[_0xa8b1('0x27')]||0x0};_0xd7e9be[_0xa8b1('0x28')](function(_0x54bcb4){var _0x138295=_0x54bcb4['role']==='admin'?'user':_0x54bcb4[_0xa8b1('0x22')];_0x5ed784[_0x138295]-=_0x54bcb4['count'];if(_0x5ed784[_0x138295]<0x0)_0x5ed784[_0x138295]=0x0;});_0x121a65(_0x5ed784);return;});})[_0xa8b1('0xb')](function(_0x138297){_0x3d79b8(_0x138297);});});}function checkUserLimits(_0x1a3c6c){return new BPromise(function(_0x52cf7c,_0x450141){getLimits()[_0xa8b1('0xa')](function(_0x54fafb){var _0x5302d1=_['pick'](_[_0xa8b1('0x29')](_0x1a3c6c,_0xa8b1('0x22')),['admin',_0xa8b1('0x24'),_0xa8b1('0x25')]);var _0x289143=(_0x5302d1['admin']||0x0)+(_0x5302d1[_0xa8b1('0x24')]||0x0);var _0x5b7226=_0x5302d1[_0xa8b1('0x25')]||0x0;if(_0x289143>_0x54fafb[_0xa8b1('0x24')])return _0x450141(_0xa8b1('0x2a'));if(_0x5b7226>_0x54fafb[_0xa8b1('0x25')])return _0x450141(_0xa8b1('0x2b'));return _0x52cf7c();})[_0xa8b1('0xb')](function(_0x266389){_0x450141(_0x266389);});});}module[_0xa8b1('0x2c')]={'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 97e3d97..bde049e 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 _0x0424=['myappanuglar-secret','app-id','secret'];(function(_0x275875,_0x228e3e){var _0x591126=function(_0xc31b29){while(--_0xc31b29){_0x275875['push'](_0x275875['shift']());}};_0x591126(++_0x228e3e);}(_0x0424,0x159));var _0x4042=function(_0x342782,_0x4236e0){_0x342782=_0x342782-0x0;var _0xadb50c=_0x0424[_0x342782];return _0xadb50c;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x4042('0x0'),'GOOGLE_ID':_0x4042('0x1'),'GOOGLE_SECRET':_0x4042('0x2'),'DEBUG':''}; \ No newline at end of file +var _0xf7b4=['app-id','secret','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7b4,0x152));var _0x4f7b=function(_0x5aed5d,_0x26ee01){_0x5aed5d=_0x5aed5d-0x0;var _0x4f5949=_0xf7b4[_0x5aed5d];return _0x4f5949;};'use strict';module[_0x4f7b('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4f7b('0x1'),'GOOGLE_SECRET':_0x4f7b('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 3b2348a..cf4dcdc 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc777=['fileLogger','../utils/loggers'];(function(_0x166e71,_0x3a1cd4){var _0x2ebc75=function(_0x4889d9){while(--_0x4889d9){_0x166e71['push'](_0x166e71['shift']());}};_0x2ebc75(++_0x3a1cd4);}(_0xc777,0xb9));var _0x7c77=function(_0x195260,_0x388faf){_0x195260=_0x195260-0x0;var _0x163b1c=_0xc777[_0x195260];return _0x163b1c;};'use strict';var fileLogger=require(_0x7c77('0x0'))[_0x7c77('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x0594=['fileLogger','exports','../utils/loggers'];(function(_0x2221df,_0x3c6cca){var _0x47da80=function(_0x5f2502){while(--_0x5f2502){_0x2221df['push'](_0x2221df['shift']());}};_0x47da80(++_0x3c6cca);}(_0x0594,0x107));var _0x4059=function(_0xea716a,_0x13fd90){_0xea716a=_0xea716a-0x0;var _0x3ce469=_0x0594[_0xea716a];return _0x3ce469;};'use strict';var fileLogger=require(_0x4059('0x0'))[_0x4059('0x1')];module[_0x4059('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 7470281..3d54f65 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 _0x32d5=['express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','xdr','exports','path'];(function(_0x4f4ca5,_0x4c02b8){var _0x4a2021=function(_0x1fb3dc){while(--_0x1fb3dc){_0x4f4ca5['push'](_0x4f4ca5['shift']());}};_0x4a2021(++_0x4c02b8);}(_0x32d5,0x9b));var _0x532d=function(_0x51e034,_0x51994a){_0x51e034=_0x51e034-0x0;var _0x864778=_0x32d5[_0x51e034];return _0x864778;};'use strict';var path=require(_0x532d('0x0'));var os=require('os');var config={'apps':[{'name':_0x532d('0x1'),'script':path[_0x532d('0x2')](__dirname,_0x532d('0x3'))},{'name':_0x532d('0x4'),'script':path[_0x532d('0x2')](__dirname,_0x532d('0x5'))},{'name':_0x532d('0x6'),'script':path[_0x532d('0x2')](__dirname,_0x532d('0x7'))},{'name':_0x532d('0x8'),'script':path[_0x532d('0x2')](__dirname,_0x532d('0x9'))},{'name':'routing','script':path[_0x532d('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x532d('0xa'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module[_0x532d('0xb')]=config; \ No newline at end of file +var _0xbd79=['../../services/routing/index.js','xdr','../../services/express/index.js','ami','join','agi','../../services/agi/index.js','email','routing'];(function(_0x4b7d9b,_0x52fe91){var _0x53711f=function(_0x45d05e){while(--_0x45d05e){_0x4b7d9b['push'](_0x4b7d9b['shift']());}};_0x53711f(++_0x52fe91);}(_0xbd79,0x197));var _0x9bd7=function(_0x9ead33,_0x330699){_0x9ead33=_0x9ead33-0x0;var _0x18eff0=_0xbd79[_0x9ead33];return _0x18eff0;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,_0x9bd7('0x0'))},{'name':_0x9bd7('0x1'),'script':path[_0x9bd7('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x9bd7('0x3'),'script':path['join'](__dirname,_0x9bd7('0x4'))},{'name':_0x9bd7('0x5'),'script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0x9bd7('0x6'),'script':path[_0x9bd7('0x2')](__dirname,_0x9bd7('0x7'))},{'name':_0x9bd7('0x8'),'script':path[_0x9bd7('0x2')](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 1e94077..f153b1e 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 _0x1d1a=['restart','list','describe','delete','dump','saved','./config','connect','start','disconnect','stop','then'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1d1a,0x156));var _0xa1d1=function(_0x112339,_0x23f4d9){_0x112339=_0x112339-0x0;var _0x113f74=_0x1d1a[_0x112339];return _0x113f74;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0xa1d1('0x0'));function connect(){return new BPromise(function(_0x46ea7d,_0x1926b2){return pm2[_0xa1d1('0x1')](function(_0x2f0f4c){if(_0x2f0f4c){return _0x1926b2(_0x2f0f4c);}return _0x46ea7d('connected');});});};exports[_0xa1d1('0x2')]=function(_0x3d4471){return connect()['then'](function(){return new BPromise(function(_0x22069e,_0x1e2499){return pm2[_0xa1d1('0x2')](_0x3d4471,function(_0x29b9dc,_0x239e2e){if(_0x29b9dc){return _0x1e2499(_0x29b9dc);}pm2[_0xa1d1('0x3')]();return _0x22069e(_0x239e2e);});});});};exports[_0xa1d1('0x4')]=function(_0x48c7b7){return connect()[_0xa1d1('0x5')](function(){return new BPromise(function(_0x480bd0,_0x918841){return pm2[_0xa1d1('0x4')](_0x48c7b7,function(_0x18dcc9,_0x5bfe9e){if(_0x18dcc9){return _0x918841(_0x18dcc9);}pm2[_0xa1d1('0x3')]();return _0x480bd0(_0x5bfe9e);});});});};exports[_0xa1d1('0x6')]=function(_0x4a571e){return connect()['then'](function(){return new BPromise(function(_0x3f4a33,_0x54953f){return pm2['restart'](_0x4a571e,function(_0x4cfc6c,_0x106e2e){if(_0x4cfc6c){return _0x54953f(_0x4cfc6c);}pm2[_0xa1d1('0x3')]();return _0x3f4a33(_0x106e2e);});});});};exports['list']=function(){return connect()[_0xa1d1('0x5')](function(){return new BPromise(function(_0x3db256,_0xd033b5){return pm2[_0xa1d1('0x7')](function(_0x3fb66b,_0x1db4a2){if(_0x3fb66b){return _0xd033b5(_0x3fb66b);}pm2[_0xa1d1('0x3')]();return _0x3db256(_0x1db4a2);});});});};exports[_0xa1d1('0x8')]=function(_0x210390){return connect()['then'](function(){return new BPromise(function(_0x29e7d4,_0x384266){return pm2[_0xa1d1('0x8')](_0x210390,function(_0xd265af,_0xb42fde){if(_0xd265af){return _0x384266(_0xd265af);}pm2['disconnect']();return _0x29e7d4(_0xb42fde);});});});};exports[_0xa1d1('0x9')]=function(_0x586f63){return connect()[_0xa1d1('0x5')](function(){return new BPromise(function(_0x23297a,_0x25e22e){return pm2[_0xa1d1('0x9')](_0x586f63,function(_0x4b61ad,_0x1297e8){if(_0x4b61ad){return _0x25e22e(_0x4b61ad);}pm2[_0xa1d1('0x3')]();return _0x23297a(_0x1297e8);});});});};exports[_0xa1d1('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x39fb9c,_0x39afa1){return pm2[_0xa1d1('0xa')](function(_0x41aa1d){if(_0x41aa1d){return _0x39afa1(_0x41aa1d);}return _0x39fb9c(_0xa1d1('0xb'));});});});}; \ No newline at end of file +var _0xa51d=['list','describe','delete','dump','saved','pm2','./config','connected','start','disconnect','stop','then','restart'];(function(_0x56fedd,_0x376499){var _0x426e8c=function(_0x446dcb){while(--_0x446dcb){_0x56fedd['push'](_0x56fedd['shift']());}};_0x426e8c(++_0x376499);}(_0xa51d,0x1a5));var _0xda51=function(_0x448422,_0x362248){_0x448422=_0x448422-0x0;var _0xcc0afd=_0xa51d[_0x448422];return _0xcc0afd;};'use strict';var pm2=require(_0xda51('0x0'));var BPromise=require('bluebird');var config=require(_0xda51('0x1'));function connect(){return new BPromise(function(_0x148fca,_0x3a67c9){return pm2['connect'](function(_0x2d538b){if(_0x2d538b){return _0x3a67c9(_0x2d538b);}return _0x148fca(_0xda51('0x2'));});});};exports[_0xda51('0x3')]=function(_0x4de16f){return connect()['then'](function(){return new BPromise(function(_0x52d2fd,_0x435d65){return pm2[_0xda51('0x3')](_0x4de16f,function(_0x54226b,_0x3c8166){if(_0x54226b){return _0x435d65(_0x54226b);}pm2[_0xda51('0x4')]();return _0x52d2fd(_0x3c8166);});});});};exports[_0xda51('0x5')]=function(_0xae9f7a){return connect()[_0xda51('0x6')](function(){return new BPromise(function(_0x4b8067,_0x4ce51e){return pm2[_0xda51('0x5')](_0xae9f7a,function(_0x25d8ae,_0x26a2d9){if(_0x25d8ae){return _0x4ce51e(_0x25d8ae);}pm2[_0xda51('0x4')]();return _0x4b8067(_0x26a2d9);});});});};exports[_0xda51('0x7')]=function(_0x290cdb){return connect()[_0xda51('0x6')](function(){return new BPromise(function(_0x502cf6,_0x2ba4c7){return pm2['restart'](_0x290cdb,function(_0x479400,_0x263d31){if(_0x479400){return _0x2ba4c7(_0x479400);}pm2[_0xda51('0x4')]();return _0x502cf6(_0x263d31);});});});};exports[_0xda51('0x8')]=function(){return connect()[_0xda51('0x6')](function(){return new BPromise(function(_0x378d23,_0x58d4ec){return pm2[_0xda51('0x8')](function(_0x161d0b,_0x41d7bb){if(_0x161d0b){return _0x58d4ec(_0x161d0b);}pm2[_0xda51('0x4')]();return _0x378d23(_0x41d7bb);});});});};exports[_0xda51('0x9')]=function(_0x68b690){return connect()[_0xda51('0x6')](function(){return new BPromise(function(_0x2a598b,_0xa93674){return pm2[_0xda51('0x9')](_0x68b690,function(_0x561595,_0x42d838){if(_0x561595){return _0xa93674(_0x561595);}pm2[_0xda51('0x4')]();return _0x2a598b(_0x42d838);});});});};exports['delete']=function(_0x5a3b13){return connect()[_0xda51('0x6')](function(){return new BPromise(function(_0x36e0c4,_0x2f85f5){return pm2[_0xda51('0xa')](_0x5a3b13,function(_0x361fd0,_0x1cefb6){if(_0x361fd0){return _0x2f85f5(_0x361fd0);}pm2['disconnect']();return _0x36e0c4(_0x1cefb6);});});});};exports[_0xda51('0xb')]=function(){return connect()[_0xda51('0x6')](function(){return new BPromise(function(_0x2b47cf,_0x59b221){return pm2[_0xda51('0xb')](function(_0x2764ff){if(_0x2764ff){return _0x59b221(_0x2764ff);}return _0x2b47cf(_0xda51('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index c0b79b3..08abfd5 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 _0x1545=['ioredis','../../config/environment','../logger','schedule','defaults','redis','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','inspect','moment'];(function(_0x2921c4,_0x305f80){var _0x2571e3=function(_0x42d6ba){while(--_0x42d6ba){_0x2921c4['push'](_0x2921c4['shift']());}};_0x2571e3(++_0x305f80);}(_0x1545,0x9f));var _0x5154=function(_0x1a87a8,_0x127bc9){_0x1a87a8=_0x1a87a8-0x0;var _0x51b8b7=_0x1545[_0x1a87a8];return _0x51b8b7;};'use strict';var _=require('lodash');var moment=require(_0x5154('0x0'));var Redis=require(_0x5154('0x1'));var util=require('util');var config=require(_0x5154('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x5154('0x3'))(_0x5154('0x4'));config['redis']=_[_0x5154('0x5')](config[_0x5154('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x5154('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x4c2eab=0x0;var _0x42769b=[];return db[_0x5154('0x8')][_0x5154('0x9')]({'raw':!![],'attributes':['id',_0x5154('0xa')],'where':{'id':0x1}})[_0x5154('0xb')](function(_0x20196d){_0x4c2eab=_0x20196d['chatTimeout'];if(_0x4c2eab){return db[_0x5154('0xc')][_0x5154('0xd')]({'raw':!![],'attributes':['id',_0x5154('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5154('0xf')](_0x20196d[_0x5154('0xa')],_0x5154('0x10'))}}});}else{return[];}})[_0x5154('0xb')](function(_0xf2e10a){if(_0xf2e10a&&_0xf2e10a[_0x5154('0x11')]){_0x42769b=_[_0x5154('0x12')](_0xf2e10a||[],'id');logger[_0x5154('0x13')](_0x5154('0x14'),_0x42769b[_0x5154('0x15')]());return db[_0x5154('0xc')][_0x5154('0x16')]({'closeReason':_0x5154('0x17'),'disposition':_0x5154('0x18'),'closed':!![],'closedAt':moment()['format'](_0x5154('0x19'))},{'where':{'id':_0x42769b}});}})[_0x5154('0xb')](function(){if(_0x42769b&&_0x42769b[_0x5154('0x11')]){logger[_0x5154('0x13')](_0x5154('0x1a'),_0x42769b[_0x5154('0x15')]());for(var _0x5db635=0x0;_0x5db635<_0x42769b[_0x5154('0x11')];_0x5db635++){io[_0x5154('0x1b')](_0x5154('0x1c'),{'id':_0x42769b[_0x5db635],'closed':!![]});}}})[_0x5154('0x1d')](function(_0x276459){logger[_0x5154('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x276459?util[_0x5154('0x1f')](_0x276459,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb30a=['update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','inspect','lodash','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','map','[CHAT]\x20Interactions\x20to\x20close:','join'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xb30a,0xad));var _0xab30=function(_0x2246e0,_0x2403df){_0x2246e0=_0x2246e0-0x0;var _0x5325a3=_0xb30a[_0x2246e0];return _0x5325a3;};'use strict';var _=require(_0xab30('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0xab30('0x1'));var config=require(_0xab30('0x2'));var db=require(_0xab30('0x3'))['db'];var logger=require(_0xab30('0x4'))(_0xab30('0x5'));config['redis']=_['defaults'](config[_0xab30('0x6')],{'host':_0xab30('0x7'),'port':0x18eb});var io=require(_0xab30('0x8'))(new Redis(config[_0xab30('0x6')]));function closeInteractions(){var _0x5273bd=0x0;var _0x555104=[];return db[_0xab30('0x9')]['find']({'raw':!![],'attributes':['id',_0xab30('0xa')],'where':{'id':0x1}})[_0xab30('0xb')](function(_0x30e109){_0x5273bd=_0x30e109['chatTimeout'];if(_0x5273bd){return db[_0xab30('0xc')][_0xab30('0xd')]({'raw':!![],'attributes':['id',_0xab30('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xab30('0xf')](_0x30e109['chatTimeout'],'minutes')}}});}else{return[];}})['then'](function(_0x681ca1){if(_0x681ca1&&_0x681ca1['length']){_0x555104=_[_0xab30('0x10')](_0x681ca1||[],'id');logger['info'](_0xab30('0x11'),_0x555104[_0xab30('0x12')]());return db['ChatInteraction'][_0xab30('0x13')]({'closeReason':_0xab30('0x14'),'disposition':_0xab30('0x15'),'closed':!![],'closedAt':moment()[_0xab30('0x16')](_0xab30('0x17'))},{'where':{'id':_0x555104}});}})[_0xab30('0xb')](function(){if(_0x555104&&_0x555104[_0xab30('0x18')]){logger[_0xab30('0x19')](_0xab30('0x1a'),_0x555104[_0xab30('0x12')]());for(var _0x4ab4d9=0x0;_0x4ab4d9<_0x555104['length'];_0x4ab4d9++){io[_0xab30('0x1b')](_0xab30('0x1c'),{'id':_0x555104[_0x4ab4d9],'closed':!![]});}}})[_0xab30('0x1d')](function(_0x5171cb){logger[_0xab30('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x5171cb?util[_0xab30('0x1f')](_0x5171cb,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 53a0896..db7d82c 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 _0xaf21=['../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x5920a,_0x3fcb00){var _0x1402ea=function(_0x416aab){while(--_0x416aab){_0x5920a['push'](_0x5920a['shift']());}};_0x1402ea(++_0x3fcb00);}(_0xaf21,0x128));var _0x1af2=function(_0x1b6b14,_0x510105){_0x1b6b14=_0x1b6b14-0x0;var _0x339ea5=_0xaf21[_0x1b6b14];return _0x339ea5;};'use strict';function start(){var _0x2a7f61=require(_0x1af2('0x0'));return _0x2a7f61['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0xe250=['exports'];(function(_0xc35e79,_0x37df8f){var _0x2f2750=function(_0x33ab91){while(--_0x33ab91){_0xc35e79['push'](_0xc35e79['shift']());}};_0x2f2750(++_0x37df8f);}(_0xe250,0xe8));var _0x0e25=function(_0x55f645,_0x39d392){_0x55f645=_0x55f645-0x0;var _0xfa9292=_0xe250[_0x55f645];return _0xfa9292;};'use strict';function start(){var _0x259f66=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x259f66['startAllRefreshIntervals']();}module[_0x0e25('0x0')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 21bdfce..287a916 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 _0x7467=['Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','%s.%s','savename','zip','join','existsSync','Sent','message','attachments','text','sendIfEmpty','request','then','error\x20mail','email\x20sent','error','stringify','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','jobs','map','toString','difference','intersection','length','exists','stop','delete\x20cron','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','add\x20cron','stop\x20cron','update','update\x20cron','deleteJob','catch','start','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc'];(function(_0x5400a1,_0x2275aa){var _0x4006c7=function(_0x5002dc){while(--_0x5002dc){_0x5400a1['push'](_0x5400a1['shift']());}};_0x4006c7(++_0x2275aa);}(_0x7467,0xe9));var _0x7746=function(_0x1555d0,_0x1e6ff5){_0x1555d0=_0x1555d0-0x0;var _0x48dbd6=_0x7467[_0x1555d0];return _0x48dbd6;};'use strict';var fs=require('fs');var util=require(_0x7746('0x0'));var path=require(_0x7746('0x1'));var _=require(_0x7746('0x2'));var moment=require(_0x7746('0x3'));var CronJobManager=require(_0x7746('0x4'));var jayson=require(_0x7746('0x5'));var BPromise=require(_0x7746('0x6'));var logger=require(_0x7746('0x7'))('schedule');var db=require(_0x7746('0x8'))['db'];var analyticCustomReportController=require(_0x7746('0x9'));var analyticDefaultReportController=require(_0x7746('0xa'));var client=jayson['client'][_0x7746('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4bd9a0,_0x6072e8){return function(){logger[_0x7746('0xc')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x4bd9a0[_0x7746('0xd')]);var _0x3d0d5d=!![];var _0x134e34={'tls':{'rejectUnauthorized':![]}};if(_0x4bd9a0[_0x7746('0xe')][_0x7746('0xf')]['service']){_0x134e34[_0x7746('0x10')]=_0x4bd9a0[_0x7746('0xe')][_0x7746('0xf')][_0x7746('0x10')];}else{_0x134e34[_0x7746('0x11')]=_0x4bd9a0[_0x7746('0xe')]['Smtp']['host'];_0x134e34[_0x7746('0x12')]=_0x4bd9a0[_0x7746('0xe')]['Smtp'][_0x7746('0x12')];_0x134e34[_0x7746('0x13')]=_0x4bd9a0[_0x7746('0xe')][_0x7746('0xf')][_0x7746('0x13')];}if(_0x4bd9a0[_0x7746('0xe')][_0x7746('0xf')][_0x7746('0x14')]){_0x134e34[_0x7746('0x15')]={'user':_0x4bd9a0[_0x7746('0xe')][_0x7746('0xf')][_0x7746('0x16')],'pass':_0x4bd9a0['MailAccount'][_0x7746('0xf')][_0x7746('0x17')]};}var _0x41b401={'account':_0x134e34,'message':{'from':util[_0x7746('0x18')](_0x7746('0x19'),_0x4bd9a0[_0x7746('0xe')][_0x7746('0x1a')],_0x4bd9a0[_0x7746('0xe')][_0x7746('0xd')]||_0x4bd9a0[_0x7746('0xe')][_0x7746('0xf')]['user']),'to':_0x4bd9a0['email'],'cc':_0x4bd9a0['cc'],'bcc':_0x4bd9a0[_0x7746('0x1b')],'subject':util[_0x7746('0x18')](_0x7746('0x1c'),_0x6072e8['name'],_0x4bd9a0[_0x7746('0x1d')],_0x4bd9a0[_0x7746('0x1e')])}};var _0x5047e3=path['join'](__dirname,_0x7746('0x1f'));var _0x493de5=_0x6072e8['savename'];var _0x3e5a84=util['format'](_0x7746('0x20'),path['basename'](_0x6072e8['savename'],path['extname'](_0x6072e8[_0x7746('0x21')])),_0x7746('0x22'));var _0x41efac=path[_0x7746('0x23')](_0x5047e3,_0x493de5);var _0x539353=path[_0x7746('0x23')](_0x5047e3,_0x3e5a84);if(fs[_0x7746('0x24')](_0x41efac)){_0x6072e8['status']=_0x7746('0x25');_0x41b401[_0x7746('0x26')][_0x7746('0x27')]=[{'filename':_0x493de5,'path':_0x41efac}];_0x41b401[_0x7746('0x26')][_0x7746('0x28')]=util[_0x7746('0x18')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x6072e8,null,0x2));}else if(fs[_0x7746('0x24')](_0x539353)){_0x6072e8['status']=_0x7746('0x25');_0x41b401[_0x7746('0x26')][_0x7746('0x27')]=[{'filename':_0x3e5a84,'path':_0x539353}];}else{_0x41b401[_0x7746('0x26')][_0x7746('0x28')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x4bd9a0[_0x7746('0x29')]){_0x3d0d5d=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x3d0d5d){return client[_0x7746('0x2a')]('SendMail',_0x41b401)[_0x7746('0x2b')](function(_0x170288){if(_0x170288['error']){return logger['error'](_0x7746('0x2c'),JSON['stringify'](_0x170288));}return logger[_0x7746('0xc')](_0x7746('0x2d'));})['catch'](function(_0x4dc153){return logger[_0x7746('0x2e')]('error\x20mail',JSON[_0x7746('0x2f')](_0x4dc153));});}};}function handleError(){return function(_0xb47a02){return logger[_0x7746('0x2e')](JSON[_0x7746('0x2f')](_0xb47a02));};}function handleResult(_0x5a97a2){return function(_0x2a8948){logger[_0x7746('0xc')](_0x7746('0x30'),JSON['stringify'](_0x2a8948));if(_0x5a97a2['MailAccount']&&_0x5a97a2[_0x7746('0xe')][_0x7746('0xf')]&&!_[_0x7746('0x31')](_0x5a97a2[_0x7746('0xd')])){setTimeout(handleSendEmail(_0x5a97a2,_0x2a8948),0x3c*0x3e8);}};}function handleJob(_0x3a1e61){return function(){try{if(_[_0x7746('0x31')](_0x3a1e61[_0x7746('0x1d')])){return logger[_0x7746('0xc')](_0x7746('0x32'));}if(_[_0x7746('0x31')](_0x3a1e61[_0x7746('0x1e')])){return logger[_0x7746('0xc')]('subtractUnit\x20null\x20or\x20undefined');}var _0x2d05b6={'startDate':moment()[_0x7746('0x33')](_0x3a1e61[_0x7746('0x1d')],_0x3a1e61['subtractUnit'])[_0x7746('0x18')](_0x7746('0x34')),'endDate':moment()[_0x7746('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x7746('0x35'),'output':_0x3a1e61[_0x7746('0x36')],'name':_0x3a1e61[_0x7746('0x1a')]};if(!_[_0x7746('0x31')](_0x3a1e61[_0x7746('0x37')])){logger['info'](_0x7746('0x38'),_0x3a1e61[_0x7746('0x37')]);return analyticDefaultReportController[_0x7746('0x39')]({'id':_0x3a1e61[_0x7746('0x37')]},_0x2d05b6)[_0x7746('0x2b')](handleResult(_0x3a1e61))['catch'](handleError());}if(!_[_0x7746('0x31')](_0x3a1e61[_0x7746('0x3a')])){logger[_0x7746('0xc')](_0x7746('0x3b'),_0x3a1e61[_0x7746('0x3a')]);return analyticCustomReportController['runReport']({'id':_0x3a1e61[_0x7746('0x3a')]},_0x2d05b6)[_0x7746('0x2b')](handleResult(_0x3a1e61))['catch'](handleError());}}catch(_0x326d4a){logger[_0x7746('0x2e')](JSON['stringify'](_0x326d4a));}return logger[_0x7746('0xc')](_0x7746('0x3c'));};}function getJobs(_0x1101ba){var _0x416fd2={};if(_0x1101ba){_0x416fd2['id']=_0x1101ba;}return db['Schedule'][_0x7746('0x3d')]({'where':_0x416fd2,'include':[{'model':db['MailAccount'],'attributes':['id',_0x7746('0x1a'),_0x7746('0xd')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]}]})['then'](function(_0x26b21c){var _0x5d5235=_['keys'](manager[_0x7746('0x3e')]);var _0x170721=_[_0x7746('0x3f')](_0x26b21c,function(_0x4cf9a0){return _0x4cf9a0['id'][_0x7746('0x40')]();});var _0x34d5d9=_['keyBy'](_0x26b21c,function(_0x1c368e){return _0x1c368e['id']['toString']();});var _0x45b0ba=_0x1101ba?_0x170721:_[_0x7746('0x41')](_0x170721,_0x5d5235);var _0x295469=_[_0x7746('0x42')](_0x170721,_0x5d5235);var _0x6f4ce9=_[_0x7746('0x41')](_0x5d5235,_0x170721);var _0xe6bee6;var _0x10218a;for(_0xe6bee6=0x0;_0xe6bee6<_0x6f4ce9[_0x7746('0x43')]&&!_0x1101ba;_0xe6bee6+=0x1){_0x10218a=_0x6f4ce9[_0xe6bee6][_0x7746('0x40')]();if(manager[_0x7746('0x44')](_0x10218a)){manager[_0x7746('0x45')](_0x10218a);manager['deleteJob'](_0x10218a);logger[_0x7746('0xc')](_0x7746('0x46'),_0x10218a);}}logger[_0x7746('0xc')]('toRun',JSON['stringify'](_0x45b0ba));for(_0xe6bee6=0x0;_0xe6bee6<_0x45b0ba['length'];_0xe6bee6+=0x1){_0x10218a=_0x45b0ba[_0xe6bee6]['toString']();logger[_0x7746('0xc')]('index',_0x10218a);if(_0x1101ba){logger[_0x7746('0xc')](_0x7746('0x47'),_0x1101ba);logger[_0x7746('0xc')](JSON[_0x7746('0x2f')](_0x34d5d9[_0x10218a]));BPromise[_0x7746('0x48')]()[_0x7746('0x2b')](handleJob(_0x34d5d9[_0x10218a]));logger[_0x7746('0xc')](_0x7746('0x49'),_0x34d5d9[_0x10218a][_0x7746('0x1a')],_0x34d5d9[_0x10218a][_0x7746('0x4a')]);}else if(_0x34d5d9[_0x10218a][_0x7746('0x4a')]&&_0x34d5d9[_0x10218a][_0x7746('0x4b')]&&moment()[_0x7746('0x4c')](_0x34d5d9[_0x10218a][_0x7746('0x4d')],_0x34d5d9[_0x10218a][_0x7746('0x4e')])){manager[_0x7746('0x4f')](_0x10218a,_0x34d5d9[_0x10218a][_0x7746('0x4a')],handleJob(_0x34d5d9[_0x10218a]));manager['start'](_0x10218a);logger[_0x7746('0xc')](_0x7746('0x50'),_0x34d5d9[_0x10218a][_0x7746('0x1a')],_0x34d5d9[_0x10218a][_0x7746('0x4a')]);}else if(manager[_0x7746('0x44')](_0x10218a)){manager[_0x7746('0x45')](_0x10218a);manager['deleteJob'](_0x10218a);logger[_0x7746('0xc')](_0x7746('0x51'),_0x34d5d9[_0x10218a][_0x7746('0x1a')],_0x34d5d9[_0x10218a][_0x7746('0x4a')]);}}for(_0xe6bee6=0x0,_0x10218a;_0xe6bee6<_0x295469['length']&&!_0x1101ba;_0xe6bee6+=0x1){_0x10218a=_0x295469[_0xe6bee6][_0x7746('0x40')]();if(manager[_0x7746('0x44')](_0x10218a)){if(_0x34d5d9[_0x10218a][_0x7746('0x4a')]&&_0x34d5d9[_0x10218a][_0x7746('0x4b')]&&moment()[_0x7746('0x4c')](_0x34d5d9[_0x10218a]['startAt'],_0x34d5d9[_0x10218a][_0x7746('0x4e')])){manager[_0x7746('0x52')](_0x10218a,_0x34d5d9[_0x10218a][_0x7746('0x4a')],handleJob(_0x34d5d9[_0x10218a]));logger['info'](_0x7746('0x53'),_0x34d5d9[_0x10218a][_0x7746('0x1a')],_0x34d5d9[_0x10218a]['cron']);}else{manager[_0x7746('0x45')](_0x10218a);manager[_0x7746('0x54')](_0x10218a);logger[_0x7746('0xc')](_0x7746('0x51'),_0x34d5d9[_0x10218a][_0x7746('0x1a')],_0x34d5d9[_0x10218a]['cron']);}}}})[_0x7746('0x55')](function(_0x39669a){logger[_0x7746('0x2e')](JSON[_0x7746('0x2f')](_0x39669a));});}exports['run']=function(_0x1f58f7){return getJobs(_0x1f58f7);};exports[_0x7746('0x56')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xd937=['add\x20cron','update','stop\x20cron','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','info','Try\x20to\x20send\x20a\x20mail\x20to','Smtp','service','MailAccount','host','port','secure','authentication','auth','user','format','name','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','SendMail','error','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','email','MailServerOut','keyBy','toString','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start'];(function(_0x3a032a,_0x2ac8b5){var _0x48a76d=function(_0x45d4ac){while(--_0x45d4ac){_0x3a032a['push'](_0x3a032a['shift']());}};_0x48a76d(++_0x2ac8b5);}(_0xd937,0xad));var _0x7d93=function(_0x4a90ef,_0x2c3d81){_0x4a90ef=_0x4a90ef-0x0;var _0x50e65c=_0xd937[_0x4a90ef];return _0x50e65c;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require('lodash');var moment=require(_0x7d93('0x0'));var CronJobManager=require(_0x7d93('0x1'));var jayson=require(_0x7d93('0x2'));var BPromise=require(_0x7d93('0x3'));var logger=require('../logger')(_0x7d93('0x4'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x7d93('0x5'));var analyticDefaultReportController=require(_0x7d93('0x6'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xce5056,_0x4eda1f){return function(){logger[_0x7d93('0x7')](_0x7d93('0x8'),_0xce5056['email']);var _0x33d883=!![];var _0x4f4030={'tls':{'rejectUnauthorized':![]}};if(_0xce5056['MailAccount'][_0x7d93('0x9')][_0x7d93('0xa')]){_0x4f4030[_0x7d93('0xa')]=_0xce5056[_0x7d93('0xb')][_0x7d93('0x9')][_0x7d93('0xa')];}else{_0x4f4030[_0x7d93('0xc')]=_0xce5056[_0x7d93('0xb')]['Smtp']['host'];_0x4f4030['port']=_0xce5056['MailAccount'][_0x7d93('0x9')][_0x7d93('0xd')];_0x4f4030[_0x7d93('0xe')]=_0xce5056[_0x7d93('0xb')][_0x7d93('0x9')][_0x7d93('0xe')];}if(_0xce5056['MailAccount']['Smtp'][_0x7d93('0xf')]){_0x4f4030[_0x7d93('0x10')]={'user':_0xce5056[_0x7d93('0xb')][_0x7d93('0x9')][_0x7d93('0x11')],'pass':_0xce5056[_0x7d93('0xb')][_0x7d93('0x9')]['pass']};}var _0x5db1bb={'account':_0x4f4030,'message':{'from':util[_0x7d93('0x12')]('\x22%s\x22\x20<%s>',_0xce5056[_0x7d93('0xb')][_0x7d93('0x13')],_0xce5056[_0x7d93('0xb')]['email']||_0xce5056[_0x7d93('0xb')]['Smtp'][_0x7d93('0x11')]),'to':_0xce5056['email'],'cc':_0xce5056['cc'],'bcc':_0xce5056['bcc'],'subject':util[_0x7d93('0x12')](_0x7d93('0x14'),_0x4eda1f['name'],_0xce5056[_0x7d93('0x15')],_0xce5056['subtractUnit'])}};var _0x1006ea=path[_0x7d93('0x16')](__dirname,_0x7d93('0x17'));var _0x5cfe62=_0x4eda1f[_0x7d93('0x18')];var _0x1444cf=util[_0x7d93('0x12')](_0x7d93('0x19'),path[_0x7d93('0x1a')](_0x4eda1f[_0x7d93('0x18')],path[_0x7d93('0x1b')](_0x4eda1f[_0x7d93('0x18')])),_0x7d93('0x1c'));var _0x19aae4=path[_0x7d93('0x16')](_0x1006ea,_0x5cfe62);var _0x51ba56=path[_0x7d93('0x16')](_0x1006ea,_0x1444cf);if(fs[_0x7d93('0x1d')](_0x19aae4)){_0x4eda1f[_0x7d93('0x1e')]=_0x7d93('0x1f');_0x5db1bb['message']['attachments']=[{'filename':_0x5cfe62,'path':_0x19aae4}];_0x5db1bb[_0x7d93('0x20')][_0x7d93('0x21')]=util['format'](_0x7d93('0x22'),JSON[_0x7d93('0x23')](_0x4eda1f,null,0x2));}else if(fs['existsSync'](_0x51ba56)){_0x4eda1f['status']=_0x7d93('0x1f');_0x5db1bb['message'][_0x7d93('0x24')]=[{'filename':_0x1444cf,'path':_0x51ba56}];}else{_0x5db1bb['message']['text']=_0x7d93('0x25');if(!_0xce5056[_0x7d93('0x26')]){_0x33d883=![];logger[_0x7d93('0x7')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x33d883){return client['request'](_0x7d93('0x27'),_0x5db1bb)['then'](function(_0x4dc72b){if(_0x4dc72b[_0x7d93('0x28')]){return logger[_0x7d93('0x28')](_0x7d93('0x29'),JSON[_0x7d93('0x23')](_0x4dc72b));}return logger[_0x7d93('0x7')]('email\x20sent');})['catch'](function(_0x34e442){return logger[_0x7d93('0x28')]('error\x20mail',JSON[_0x7d93('0x23')](_0x34e442));});}};}function handleError(){return function(_0xc3edd){return logger[_0x7d93('0x28')](JSON[_0x7d93('0x23')](_0xc3edd));};}function handleResult(_0x77de1c){return function(_0x5164fe){logger[_0x7d93('0x7')](_0x7d93('0x2a'),JSON[_0x7d93('0x23')](_0x5164fe));if(_0x77de1c[_0x7d93('0xb')]&&_0x77de1c[_0x7d93('0xb')]['Smtp']&&!_[_0x7d93('0x2b')](_0x77de1c['email'])){setTimeout(handleSendEmail(_0x77de1c,_0x5164fe),0x3c*0x3e8);}};}function handleJob(_0x2ee784){return function(){try{if(_[_0x7d93('0x2b')](_0x2ee784[_0x7d93('0x15')])){return logger['info'](_0x7d93('0x2c'));}if(_[_0x7d93('0x2b')](_0x2ee784[_0x7d93('0x2d')])){return logger[_0x7d93('0x7')](_0x7d93('0x2e'));}var _0x9c0ecc={'startDate':moment()[_0x7d93('0x2f')](_0x2ee784['subtractNumber'],_0x2ee784[_0x7d93('0x2d')])[_0x7d93('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x7d93('0x30')),'type':_0x7d93('0x31'),'output':_0x2ee784['output'],'name':_0x2ee784[_0x7d93('0x13')]};if(!_[_0x7d93('0x2b')](_0x2ee784[_0x7d93('0x32')])){logger['info'](_0x7d93('0x33'),_0x2ee784[_0x7d93('0x32')]);return analyticDefaultReportController[_0x7d93('0x34')]({'id':_0x2ee784[_0x7d93('0x32')]},_0x9c0ecc)[_0x7d93('0x35')](handleResult(_0x2ee784))[_0x7d93('0x36')](handleError());}if(!_[_0x7d93('0x2b')](_0x2ee784[_0x7d93('0x37')])){logger['info'](_0x7d93('0x38'),_0x2ee784[_0x7d93('0x37')]);return analyticCustomReportController['runReport']({'id':_0x2ee784['CustomReportId']},_0x9c0ecc)[_0x7d93('0x35')](handleResult(_0x2ee784))[_0x7d93('0x36')](handleError());}}catch(_0x28e68a){logger[_0x7d93('0x28')](JSON[_0x7d93('0x23')](_0x28e68a));}return logger[_0x7d93('0x7')]('no\x20report\x20id');};}function getJobs(_0xeb6725){var _0x5cc07f={};if(_0xeb6725){_0x5cc07f['id']=_0xeb6725;}return db[_0x7d93('0x39')][_0x7d93('0x3a')]({'where':_0x5cc07f,'include':[{'model':db[_0x7d93('0xb')],'attributes':['id',_0x7d93('0x13'),_0x7d93('0x3b')],'include':[{'model':db[_0x7d93('0x3c')],'as':_0x7d93('0x9')}]}]})[_0x7d93('0x35')](function(_0x2addff){var _0x28ddae=_['keys'](manager['jobs']);var _0x4a1251=_['map'](_0x2addff,function(_0x432d64){return _0x432d64['id']['toString']();});var _0x34a5e8=_[_0x7d93('0x3d')](_0x2addff,function(_0xc09577){return _0xc09577['id'][_0x7d93('0x3e')]();});var _0x165a02=_0xeb6725?_0x4a1251:_[_0x7d93('0x3f')](_0x4a1251,_0x28ddae);var _0x2cdaae=_[_0x7d93('0x40')](_0x4a1251,_0x28ddae);var _0x2b04df=_[_0x7d93('0x3f')](_0x28ddae,_0x4a1251);var _0x4eecd9;var _0x19a6fe;for(_0x4eecd9=0x0;_0x4eecd9<_0x2b04df[_0x7d93('0x41')]&&!_0xeb6725;_0x4eecd9+=0x1){_0x19a6fe=_0x2b04df[_0x4eecd9][_0x7d93('0x3e')]();if(manager[_0x7d93('0x42')](_0x19a6fe)){manager[_0x7d93('0x43')](_0x19a6fe);manager[_0x7d93('0x44')](_0x19a6fe);logger[_0x7d93('0x7')](_0x7d93('0x45'),_0x19a6fe);}}logger[_0x7d93('0x7')](_0x7d93('0x46'),JSON[_0x7d93('0x23')](_0x165a02));for(_0x4eecd9=0x0;_0x4eecd9<_0x165a02[_0x7d93('0x41')];_0x4eecd9+=0x1){_0x19a6fe=_0x165a02[_0x4eecd9][_0x7d93('0x3e')]();logger[_0x7d93('0x7')](_0x7d93('0x47'),_0x19a6fe);if(_0xeb6725){logger[_0x7d93('0x7')](_0x7d93('0x48'),_0xeb6725);logger[_0x7d93('0x7')](JSON[_0x7d93('0x23')](_0x34a5e8[_0x19a6fe]));BPromise[_0x7d93('0x49')]()[_0x7d93('0x35')](handleJob(_0x34a5e8[_0x19a6fe]));logger[_0x7d93('0x7')](_0x7d93('0x4a'),_0x34a5e8[_0x19a6fe][_0x7d93('0x13')],_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')]);}else if(_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')]&&_0x34a5e8[_0x19a6fe][_0x7d93('0x4c')]&&moment()[_0x7d93('0x4d')](_0x34a5e8[_0x19a6fe][_0x7d93('0x4e')],_0x34a5e8[_0x19a6fe][_0x7d93('0x4f')])){manager[_0x7d93('0x50')](_0x19a6fe,_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')],handleJob(_0x34a5e8[_0x19a6fe]));manager[_0x7d93('0x51')](_0x19a6fe);logger[_0x7d93('0x7')](_0x7d93('0x52'),_0x34a5e8[_0x19a6fe][_0x7d93('0x13')],_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')]);}else if(manager['exists'](_0x19a6fe)){manager[_0x7d93('0x43')](_0x19a6fe);manager[_0x7d93('0x44')](_0x19a6fe);logger[_0x7d93('0x7')]('stop\x20cron',_0x34a5e8[_0x19a6fe]['name'],_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')]);}}for(_0x4eecd9=0x0,_0x19a6fe;_0x4eecd9<_0x2cdaae[_0x7d93('0x41')]&&!_0xeb6725;_0x4eecd9+=0x1){_0x19a6fe=_0x2cdaae[_0x4eecd9][_0x7d93('0x3e')]();if(manager[_0x7d93('0x42')](_0x19a6fe)){if(_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')]&&_0x34a5e8[_0x19a6fe][_0x7d93('0x4c')]&&moment()[_0x7d93('0x4d')](_0x34a5e8[_0x19a6fe][_0x7d93('0x4e')],_0x34a5e8[_0x19a6fe]['endAt'])){manager[_0x7d93('0x53')](_0x19a6fe,_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')],handleJob(_0x34a5e8[_0x19a6fe]));logger['info']('update\x20cron',_0x34a5e8[_0x19a6fe][_0x7d93('0x13')],_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')]);}else{manager[_0x7d93('0x43')](_0x19a6fe);manager[_0x7d93('0x44')](_0x19a6fe);logger[_0x7d93('0x7')](_0x7d93('0x54'),_0x34a5e8[_0x19a6fe][_0x7d93('0x13')],_0x34a5e8[_0x19a6fe][_0x7d93('0x4b')]);}}}})[_0x7d93('0x36')](function(_0x19da7d){logger['error'](JSON[_0x7d93('0x23')](_0x19da7d));});}exports['run']=function(_0x593229){return getJobs(_0x593229);};exports[_0x7d93('0x51')]=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 ebc3822..370684a 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 _0xd1f1=['data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','Sentiment','SentimentScore','Positive','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','bucket','findOne','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Negative','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','catch','SequelizeValidationError','start','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName'];(function(_0x4bd910,_0x3dae32){var _0x2e8266=function(_0x50cb26){while(--_0x50cb26){_0x4bd910['push'](_0x4bd910['shift']());}};_0x2e8266(++_0x3dae32);}(_0xd1f1,0x84));var _0x1d1f=function(_0x38deb6,_0x587445){_0x38deb6=_0x38deb6-0x0;var _0x3cf12e=_0xd1f1[_0x38deb6];return _0x3cf12e;};var _=require(_0x1d1f('0x0'));var AWS=require(_0x1d1f('0x1'));var rp=require(_0x1d1f('0x2'));var util=require(_0x1d1f('0x3'));var BPromise=require(_0x1d1f('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x1d1f('0x5'))(_0x1d1f('0x6'));function getTranscriptionJob(_0x35d347,_0x5ede62,_0x389400,_0x13e896){return new Promise(function(_0x54e8a0,_0x2337fc){var _0x5c285a=new AWS[(_0x1d1f('0x7'))]({'accessKeyId':_0x5ede62,'secretAccessKey':_0x35d347,'region':_0x389400});_0x5c285a[_0x1d1f('0x8')]({'TranscriptionJobName':_0x13e896},function(_0x44f6c1,_0x20d937){if(_0x44f6c1){return _0x2337fc(_0x44f6c1);}else{return _0x54e8a0(_0x20d937);}});});}function sentiment(_0x522f5e,_0x55e80c,_0x5372be,_0x6de58c,_0x2bc44f){return new Promise(function(_0xff11b6,_0x390baf){var _0x5485c9=new AWS[(_0x1d1f('0x9'))]({'accessKeyId':_0x55e80c,'secretAccessKey':_0x522f5e,'region':_0x5372be});_0x5485c9[_0x1d1f('0xa')]({'Text':_0x6de58c,'LanguageCode':_0x2bc44f[_0x1d1f('0xb')](0x0,0x2)},function(_0x3cd128,_0x17b47c){if(_0x3cd128){return _0x390baf(_0x3cd128);}else{return _0xff11b6(_0x17b47c);}});});}function checkTranscribeJob(_0x1a3ec7,_0x4ce793,_0x4c92c1){var _0x48e2c0;return new BPromise(function(_0x3e6316,_0xcff9d5){logger[_0x1d1f('0xc')](util[_0x1d1f('0xd')](_0x1d1f('0xe'),_0x1a3ec7['id'],_0x1a3ec7[_0x1d1f('0xf')]));return getTranscriptionJob(_0x4c92c1[_0x1d1f('0x10')],_0x4c92c1[_0x1d1f('0x11')],_0x4ce793[_0x1d1f('0x12')],_0x1a3ec7[_0x1d1f('0xf')])[_0x1d1f('0x13')](function(_0x397f74){logger[_0x1d1f('0xc')](util['format'](_0x1d1f('0x14'),_0x1a3ec7['id'],_0x1a3ec7[_0x1d1f('0xf')],_0x397f74[_0x1d1f('0x15')][_0x1d1f('0x16')]));if(!_0x1a3ec7[_0x1d1f('0x17')]){switch(_0x397f74[_0x1d1f('0x15')][_0x1d1f('0x16')]){case _0x1d1f('0x18'):var _0x2ee2dc={'transcribeStatus':_0x397f74[_0x1d1f('0x15')][_0x1d1f('0x16')],'fileUri':_0x397f74[_0x1d1f('0x15')][_0x1d1f('0x19')][_0x1d1f('0x1a')]};logger[_0x1d1f('0xc')](util[_0x1d1f('0xd')](_0x1d1f('0x1b'),_0x1a3ec7['id']));return rp({'uri':_0x397f74[_0x1d1f('0x15')][_0x1d1f('0x19')]['TranscriptFileUri'],'json':!![]})[_0x1d1f('0x13')](function(_0x2ca72d){logger['info'](util[_0x1d1f('0xd')](_0x1d1f('0x1c'),_0x1a3ec7['id']));if(_0x2ca72d&&_0x2ca72d[_0x1d1f('0x1d')]&&_0x2ca72d[_0x1d1f('0x1d')][_0x1d1f('0x1e')]&&_0x2ca72d[_0x1d1f('0x1d')]['transcripts'][_0x1d1f('0x1f')]){_0x2ee2dc[_0x1d1f('0x17')]='';for(var _0x3e8139=0x0;_0x3e8139<_0x2ca72d[_0x1d1f('0x1d')][_0x1d1f('0x1e')]['length'];_0x3e8139++){_0x2ee2dc[_0x1d1f('0x17')]+=_0x2ca72d[_0x1d1f('0x1d')]['transcripts'][_0x3e8139]['transcript']+'';}}return _0x1a3ec7[_0x1d1f('0x20')](_0x2ee2dc);})[_0x1d1f('0x13')](function(){logger[_0x1d1f('0xc')](util[_0x1d1f('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1a3ec7['id']));if(!_0x1a3ec7['tempSentiment']){throw new db[(_0x1d1f('0x21'))][(_0x1d1f('0x22'))](_0x1d1f('0x23'));}if(!_0x4ce793[_0x1d1f('0x24')]||!_0x4ce793[_0x1d1f('0x25')]||!_0x4ce793[_0x1d1f('0x26')]||!_0x4ce793['language']||!_0x4ce793['bucket']){throw new db['Sequelize'][(_0x1d1f('0x22'))](_0x1d1f('0x27'));}if(!_0x2ee2dc[_0x1d1f('0x17')]){throw new Error('Transcript\x20not\x20available');}if(_0x4ce793[_0x1d1f('0x25')]===_0x4c92c1['id']){return _0x4c92c1;}else{return db[_0x1d1f('0x28')]['findOne']({'where':{'id':_settings[_0x1d1f('0x25')]}});}})[_0x1d1f('0x13')](function(_0x8ca112){if(!_0x8ca112){throw new db[(_0x1d1f('0x21'))][(_0x1d1f('0x22'))](_0x1d1f('0x29'));}if(!_0x8ca112[_0x1d1f('0x10')]||!_0x8ca112[_0x1d1f('0x11')]){throw new db[(_0x1d1f('0x21'))][(_0x1d1f('0x22'))](_0x1d1f('0x2a'));}_0x48e2c0=_0x8ca112;logger[_0x1d1f('0xc')](util[_0x1d1f('0xd')](_0x1d1f('0x2b'),_0x1a3ec7['id']));return sentiment(_0x48e2c0[_0x1d1f('0x10')],_0x48e2c0[_0x1d1f('0x11')],_0x4ce793[_0x1d1f('0x26')],_0x2ee2dc[_0x1d1f('0x17')],_0x4ce793[_0x1d1f('0x2c')]);})[_0x1d1f('0x13')](function(_0x89dbc2){logger[_0x1d1f('0xc')](util[_0x1d1f('0xd')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1a3ec7['id']));return _0x1a3ec7[_0x1d1f('0x20')]({'sentiment':_0x89dbc2[_0x1d1f('0x2d')],'sPositive':_0x89dbc2[_0x1d1f('0x2e')][_0x1d1f('0x2f')],'sNegative':_0x89dbc2['SentimentScore']['Negative'],'sMixed':_0x89dbc2[_0x1d1f('0x2e')][_0x1d1f('0x30')],'sNeutral':_0x89dbc2[_0x1d1f('0x2e')][_0x1d1f('0x31')]});})[_0x1d1f('0x13')](function(){logger[_0x1d1f('0xc')](util['format'](_0x1d1f('0x32'),_0x1a3ec7['id']));_0x3e6316();});case'FAILED':return _0x1a3ec7['update']({'transcribeStatus':_0x1d1f('0x33'),'failureReason':_0x397f74[_0x1d1f('0x15')]['FailureReason']})[_0x1d1f('0x13')](function(){logger[_0x1d1f('0xc')](util[_0x1d1f('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1a3ec7['id']));_0x3e6316();});default:logger[_0x1d1f('0xc')](util['format'](_0x1d1f('0x34'),_0x1a3ec7['id']));break;}}else{return BPromise['resolve']()[_0x1d1f('0x13')](function(){if(!_0x1a3ec7[_0x1d1f('0x35')]){throw new db['Sequelize'][(_0x1d1f('0x22'))](_0x1d1f('0x23'));}if(!_0x4ce793[_0x1d1f('0x24')]||!_0x4ce793[_0x1d1f('0x25')]||!_0x4ce793[_0x1d1f('0x26')]||!_0x4ce793[_0x1d1f('0x2c')]||!_0x4ce793[_0x1d1f('0x36')]){throw new db['Sequelize'][(_0x1d1f('0x22'))](_0x1d1f('0x27'));}if(!_0x1a3ec7[_0x1d1f('0x17')]){throw new Error('Transcript\x20not\x20available');}if(_0x4ce793['sentimentAccountId']===_0x4c92c1['id']){return _0x4c92c1;}else{return db[_0x1d1f('0x28')][_0x1d1f('0x37')]({'where':{'id':_settings[_0x1d1f('0x25')]}});}})['then'](function(_0x1ea5b1){if(!_0x1ea5b1){throw new db[(_0x1d1f('0x21'))][(_0x1d1f('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1ea5b1[_0x1d1f('0x10')]||!_0x1ea5b1[_0x1d1f('0x11')]){throw new db[(_0x1d1f('0x21'))][(_0x1d1f('0x22'))](_0x1d1f('0x2a'));}_0x48e2c0=_0x1ea5b1;logger[_0x1d1f('0xc')](util[_0x1d1f('0xd')](_0x1d1f('0x2b'),_0x1a3ec7['id']));return sentiment(_0x48e2c0[_0x1d1f('0x10')],_0x48e2c0[_0x1d1f('0x11')],_0x4ce793[_0x1d1f('0x26')],_0x1a3ec7[_0x1d1f('0x17')],_0x4ce793[_0x1d1f('0x2c')]);})[_0x1d1f('0x13')](function(_0x32363e){logger['info'](util[_0x1d1f('0xd')](_0x1d1f('0x38'),_0x1a3ec7['id']));return _0x1a3ec7['update']({'sentiment':_0x32363e[_0x1d1f('0x2d')],'sPositive':_0x32363e[_0x1d1f('0x2e')]['Positive'],'sNegative':_0x32363e[_0x1d1f('0x2e')][_0x1d1f('0x39')],'sMixed':_0x32363e[_0x1d1f('0x2e')][_0x1d1f('0x30')],'sNeutral':_0x32363e[_0x1d1f('0x2e')][_0x1d1f('0x31')],'transcribeStatus':_0x1d1f('0x18')});})[_0x1d1f('0x13')](function(){logger[_0x1d1f('0xc')](util['format'](_0x1d1f('0x32'),_0x1a3ec7['id']));_0x3e6316();});}})['catch'](function(_0x5b5e32){if(_0x5b5e32){if(!_0x5b5e32[_0x1d1f('0x3a')]||_0x5b5e32['name']!=='SequelizeValidationError'){logger[_0x1d1f('0x3b')](util[_0x1d1f('0xd')](_0x1d1f('0x3c'),_0x1a3ec7['id']),util[_0x1d1f('0x3d')](_0x5b5e32,{'showHidden':![],'depth':null}));}}_0x3e6316();});});}function checkTranscribe(){var _0x53f2bf;var _0x20aecf;var _0x4d3216;return db[_0x1d1f('0x3e')][_0x1d1f('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x1d1f('0x13')](function(_0x364b25){if(!_0x364b25||!_0x364b25[_0x1d1f('0x1f')]){throw new db[(_0x1d1f('0x21'))]['ValidationError'](_0x1d1f('0x40'));}_0x53f2bf=_0x364b25;return db[_0x1d1f('0x41')][_0x1d1f('0x37')]({'where':{'id':0x1}});})[_0x1d1f('0x13')](function(_0x1193fc){if(!_0x1193fc){throw new db['Sequelize'][(_0x1d1f('0x22'))](_0x1d1f('0x42'));}_0x20aecf=_0x1193fc;if(!_0x20aecf[_0x1d1f('0x6')]||!_0x20aecf[_0x1d1f('0x43')]||!_0x20aecf[_0x1d1f('0x12')]||!_0x20aecf['language']||!_0x20aecf[_0x1d1f('0x36')]){throw new db[(_0x1d1f('0x21'))][(_0x1d1f('0x22'))](_0x1d1f('0x44'));}return db[_0x1d1f('0x28')][_0x1d1f('0x37')]({'where':{'id':_0x20aecf[_0x1d1f('0x43')]}});})[_0x1d1f('0x13')](function(_0x53c86c){if(!_0x53c86c){throw new db[(_0x1d1f('0x21'))][(_0x1d1f('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x53c86c[_0x1d1f('0x10')]||!_0x53c86c[_0x1d1f('0x11')]){throw new db[(_0x1d1f('0x21'))][(_0x1d1f('0x22'))](_0x1d1f('0x2a'));}_0x4d3216=_0x53c86c;var _0x26760b=[];_0x53f2bf[_0x1d1f('0x45')](function(_0x26d513){_0x26760b[_0x1d1f('0x46')](checkTranscribeJob(_0x26d513,_0x20aecf,_0x4d3216));});return BPromise['all'](_0x26760b);})[_0x1d1f('0x47')](function(_0x144ffc){if(_0x144ffc){if(!_0x144ffc[_0x1d1f('0x3a')]||_0x144ffc[_0x1d1f('0x3a')]!==_0x1d1f('0x48')){logger[_0x1d1f('0x3b')](util[_0x1d1f('0x3d')](_0x144ffc,{'showHidden':![],'depth':null}));}}});}exports[_0x1d1f('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xf53d=['[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','Sentiment','SentimentScore','Mixed','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Negative','Neutral','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','findOne','Settings\x20not\x20available','Transcribe\x20not\x20configured','push','all','catch','inspect','lodash','aws-sdk','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri'];(function(_0x261b84,_0x5bda10){var _0x1fcf21=function(_0x1dcc8e){while(--_0x1dcc8e){_0x261b84['push'](_0x261b84['shift']());}};_0x1fcf21(++_0x5bda10);}(_0xf53d,0x199));var _0xdf53=function(_0x5bb865,_0x151d2d){_0x5bb865=_0x5bb865-0x0;var _0x548b1e=_0xf53d[_0x5bb865];return _0x548b1e;};var _=require(_0xdf53('0x0'));var AWS=require(_0xdf53('0x1'));var rp=require('request-promise');var util=require(_0xdf53('0x2'));var BPromise=require(_0xdf53('0x3'));var db=require(_0xdf53('0x4'))['db'];var logger=require('../../config/logger')(_0xdf53('0x5'));function getTranscriptionJob(_0x5d9500,_0x3ae2e2,_0x5e66f4,_0x531636){return new Promise(function(_0xa9fb11,_0x4cf8d5){var _0x1500ae=new AWS[(_0xdf53('0x6'))]({'accessKeyId':_0x3ae2e2,'secretAccessKey':_0x5d9500,'region':_0x5e66f4});_0x1500ae[_0xdf53('0x7')]({'TranscriptionJobName':_0x531636},function(_0x3a449,_0x328fd3){if(_0x3a449){return _0x4cf8d5(_0x3a449);}else{return _0xa9fb11(_0x328fd3);}});});}function sentiment(_0x1549ef,_0x14af2f,_0x3cb753,_0x4c0fb1,_0x29152a){return new Promise(function(_0x2293f3,_0x5e1df7){var _0x1e54dd=new AWS['Comprehend']({'accessKeyId':_0x14af2f,'secretAccessKey':_0x1549ef,'region':_0x3cb753});_0x1e54dd[_0xdf53('0x8')]({'Text':_0x4c0fb1,'LanguageCode':_0x29152a[_0xdf53('0x9')](0x0,0x2)},function(_0x2412ce,_0x39f5c7){if(_0x2412ce){return _0x5e1df7(_0x2412ce);}else{return _0x2293f3(_0x39f5c7);}});});}function checkTranscribeJob(_0xc8937d,_0x336304,_0x4c1eee){var _0x4082e3;return new BPromise(function(_0x5d5447,_0x493d4e){logger['info'](util[_0xdf53('0xa')](_0xdf53('0xb'),_0xc8937d['id'],_0xc8937d[_0xdf53('0xc')]));return getTranscriptionJob(_0x4c1eee['data1'],_0x4c1eee[_0xdf53('0xd')],_0x336304[_0xdf53('0xe')],_0xc8937d[_0xdf53('0xc')])[_0xdf53('0xf')](function(_0x22deb2){logger[_0xdf53('0x10')](util[_0xdf53('0xa')](_0xdf53('0x11'),_0xc8937d['id'],_0xc8937d[_0xdf53('0xc')],_0x22deb2[_0xdf53('0x12')][_0xdf53('0x13')]));if(!_0xc8937d[_0xdf53('0x14')]){switch(_0x22deb2['TranscriptionJob'][_0xdf53('0x13')]){case'COMPLETED':var _0x22d112={'transcribeStatus':_0x22deb2[_0xdf53('0x12')][_0xdf53('0x13')],'fileUri':_0x22deb2['TranscriptionJob'][_0xdf53('0x15')][_0xdf53('0x16')]};logger[_0xdf53('0x10')](util['format'](_0xdf53('0x17'),_0xc8937d['id']));return rp({'uri':_0x22deb2['TranscriptionJob']['Transcript'][_0xdf53('0x16')],'json':!![]})['then'](function(_0x1e003d){logger[_0xdf53('0x10')](util[_0xdf53('0xa')](_0xdf53('0x18'),_0xc8937d['id']));if(_0x1e003d&&_0x1e003d[_0xdf53('0x19')]&&_0x1e003d[_0xdf53('0x19')][_0xdf53('0x1a')]&&_0x1e003d['results'][_0xdf53('0x1a')][_0xdf53('0x1b')]){_0x22d112[_0xdf53('0x14')]='';for(var _0x260cb3=0x0;_0x260cb3<_0x1e003d['results'][_0xdf53('0x1a')][_0xdf53('0x1b')];_0x260cb3++){_0x22d112[_0xdf53('0x14')]+=_0x1e003d[_0xdf53('0x19')][_0xdf53('0x1a')][_0x260cb3][_0xdf53('0x1c')]+'';}}return _0xc8937d[_0xdf53('0x1d')](_0x22d112);})[_0xdf53('0xf')](function(){logger[_0xdf53('0x10')](util[_0xdf53('0xa')](_0xdf53('0x1e'),_0xc8937d['id']));if(!_0xc8937d[_0xdf53('0x1f')]){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x22'));}if(!_0x336304['sentiment']||!_0x336304[_0xdf53('0x23')]||!_0x336304['sentimentRegion']||!_0x336304['language']||!_0x336304[_0xdf53('0x24')]){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x25'));}if(!_0x22d112[_0xdf53('0x14')]){throw new Error(_0xdf53('0x26'));}if(_0x336304[_0xdf53('0x23')]===_0x4c1eee['id']){return _0x4c1eee;}else{return db[_0xdf53('0x27')]['findOne']({'where':{'id':_settings[_0xdf53('0x23')]}});}})[_0xdf53('0xf')](function(_0x2afa60){if(!_0x2afa60){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x28'));}if(!_0x2afa60[_0xdf53('0x29')]||!_0x2afa60[_0xdf53('0xd')]){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x2a'));}_0x4082e3=_0x2afa60;logger[_0xdf53('0x10')](util[_0xdf53('0xa')](_0xdf53('0x2b'),_0xc8937d['id']));return sentiment(_0x4082e3['data1'],_0x4082e3[_0xdf53('0xd')],_0x336304['sentimentRegion'],_0x22d112[_0xdf53('0x14')],_0x336304[_0xdf53('0x2c')]);})['then'](function(_0x3a993d){logger['info'](util[_0xdf53('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xc8937d['id']));return _0xc8937d[_0xdf53('0x1d')]({'sentiment':_0x3a993d[_0xdf53('0x2d')],'sPositive':_0x3a993d[_0xdf53('0x2e')]['Positive'],'sNegative':_0x3a993d[_0xdf53('0x2e')]['Negative'],'sMixed':_0x3a993d['SentimentScore'][_0xdf53('0x2f')],'sNeutral':_0x3a993d['SentimentScore']['Neutral']});})[_0xdf53('0xf')](function(){logger[_0xdf53('0x10')](util[_0xdf53('0xa')](_0xdf53('0x1e'),_0xc8937d['id']));_0x5d5447();});case'FAILED':return _0xc8937d[_0xdf53('0x1d')]({'transcribeStatus':'FAILED','failureReason':_0x22deb2[_0xdf53('0x12')]['FailureReason']})[_0xdf53('0xf')](function(){logger[_0xdf53('0x10')](util['format'](_0xdf53('0x1e'),_0xc8937d['id']));_0x5d5447();});default:logger[_0xdf53('0x10')](util[_0xdf53('0xa')](_0xdf53('0x30'),_0xc8937d['id']));break;}}else{return BPromise[_0xdf53('0x31')]()[_0xdf53('0xf')](function(){if(!_0xc8937d[_0xdf53('0x1f')]){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x22'));}if(!_0x336304[_0xdf53('0x32')]||!_0x336304[_0xdf53('0x23')]||!_0x336304['sentimentRegion']||!_0x336304[_0xdf53('0x2c')]||!_0x336304[_0xdf53('0x24')]){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x25'));}if(!_0xc8937d[_0xdf53('0x14')]){throw new Error(_0xdf53('0x26'));}if(_0x336304[_0xdf53('0x23')]===_0x4c1eee['id']){return _0x4c1eee;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0xdf53('0x23')]}});}})[_0xdf53('0xf')](function(_0x4a5b42){if(!_0x4a5b42){throw new db['Sequelize'][(_0xdf53('0x21'))](_0xdf53('0x28'));}if(!_0x4a5b42['data1']||!_0x4a5b42[_0xdf53('0xd')]){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x2a'));}_0x4082e3=_0x4a5b42;logger['info'](util[_0xdf53('0xa')](_0xdf53('0x2b'),_0xc8937d['id']));return sentiment(_0x4082e3[_0xdf53('0x29')],_0x4082e3[_0xdf53('0xd')],_0x336304[_0xdf53('0x33')],_0xc8937d[_0xdf53('0x14')],_0x336304['language']);})['then'](function(_0x2d339f){logger['info'](util['format'](_0xdf53('0x34'),_0xc8937d['id']));return _0xc8937d[_0xdf53('0x1d')]({'sentiment':_0x2d339f['Sentiment'],'sPositive':_0x2d339f[_0xdf53('0x2e')][_0xdf53('0x35')],'sNegative':_0x2d339f[_0xdf53('0x2e')][_0xdf53('0x36')],'sMixed':_0x2d339f['SentimentScore'][_0xdf53('0x2f')],'sNeutral':_0x2d339f[_0xdf53('0x2e')][_0xdf53('0x37')],'transcribeStatus':'COMPLETED'});})[_0xdf53('0xf')](function(){logger[_0xdf53('0x10')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xc8937d['id']));_0x5d5447();});}})['catch'](function(_0x368e7b){if(_0x368e7b){if(!_0x368e7b[_0xdf53('0x38')]||_0x368e7b[_0xdf53('0x38')]!==_0xdf53('0x39')){logger[_0xdf53('0x3a')](util[_0xdf53('0xa')](_0xdf53('0x3b'),_0xc8937d['id']),util['inspect'](_0x368e7b,{'showHidden':![],'depth':null}));}}_0x5d5447();});});}function checkTranscribe(){var _0x4fca5f;var _0x94f1d9;var _0x37f56c;return db[_0xdf53('0x3c')][_0xdf53('0x3d')]({'where':{'transcribeStatus':_0xdf53('0x3e')}})[_0xdf53('0xf')](function(_0x1c98d7){if(!_0x1c98d7||!_0x1c98d7[_0xdf53('0x1b')]){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x3f'));}_0x4fca5f=_0x1c98d7;return db[_0xdf53('0x40')][_0xdf53('0x41')]({'where':{'id':0x1}});})[_0xdf53('0xf')](function(_0x3808fd){if(!_0x3808fd){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x42'));}_0x94f1d9=_0x3808fd;if(!_0x94f1d9[_0xdf53('0x5')]||!_0x94f1d9['transcribeAccountId']||!_0x94f1d9[_0xdf53('0xe')]||!_0x94f1d9[_0xdf53('0x2c')]||!_0x94f1d9[_0xdf53('0x24')]){throw new db['Sequelize'][(_0xdf53('0x21'))](_0xdf53('0x43'));}return db['CloudProvider'][_0xdf53('0x41')]({'where':{'id':_0x94f1d9['transcribeAccountId']}});})[_0xdf53('0xf')](function(_0x33853b){if(!_0x33853b){throw new db['Sequelize'][(_0xdf53('0x21'))](_0xdf53('0x28'));}if(!_0x33853b[_0xdf53('0x29')]||!_0x33853b[_0xdf53('0xd')]){throw new db[(_0xdf53('0x20'))][(_0xdf53('0x21'))](_0xdf53('0x2a'));}_0x37f56c=_0x33853b;var _0x2fdef4=[];_0x4fca5f['forEach'](function(_0x5cbfc3){_0x2fdef4[_0xdf53('0x44')](checkTranscribeJob(_0x5cbfc3,_0x94f1d9,_0x37f56c));});return BPromise[_0xdf53('0x45')](_0x2fdef4);})[_0xdf53('0x46')](function(_0x40cff4){if(_0x40cff4){if(!_0x40cff4[_0xdf53('0x38')]||_0x40cff4['name']!=='SequelizeValidationError'){logger['error'](util[_0xdf53('0x47')](_0x40cff4,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index de5e071..d8f34c8 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 _0x1e6b=['socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','map','info','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost'];(function(_0xc54faf,_0x3ad988){var _0x88476f=function(_0x1a2d62){while(--_0x1a2d62){_0xc54faf['push'](_0xc54faf['shift']());}};_0x88476f(++_0x3ad988);}(_0x1e6b,0x118));var _0xb1e6=function(_0x47b419,_0x5ab14c){_0x47b419=_0x47b419-0x0;var _0x5a1149=_0x1e6b[_0x47b419];return _0x5a1149;};'use strict';var _=require(_0xb1e6('0x0'));var moment=require(_0xb1e6('0x1'));var Redis=require(_0xb1e6('0x2'));var util=require(_0xb1e6('0x3'));var config=require(_0xb1e6('0x4'));var db=require(_0xb1e6('0x5'))['db'];var logger=require(_0xb1e6('0x6'))('schedule');config[_0xb1e6('0x7')]=_[_0xb1e6('0x8')](config[_0xb1e6('0x7')],{'host':_0xb1e6('0x9'),'port':0x18eb});var io=require(_0xb1e6('0xa'))(new Redis(config[_0xb1e6('0x7')]));function closeInteractions(){var _0x4d989f=[];return db[_0xb1e6('0xb')][_0xb1e6('0xc')]({'raw':!![],'attributes':['id',_0xb1e6('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xb1e6('0xe')](0x18,_0xb1e6('0xf'))}}})['then'](function(_0x406974){if(_0x406974&&_0x406974['length']){_0x4d989f=_[_0xb1e6('0x10')](_0x406974||[],'id');logger[_0xb1e6('0x11')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4d989f[_0xb1e6('0x12')]());return db[_0xb1e6('0xb')][_0xb1e6('0x13')]({'closeReason':_0xb1e6('0x14'),'disposition':_0xb1e6('0x15'),'closed':!![],'closedAt':moment()['format'](_0xb1e6('0x16'))},{'where':{'id':_0x4d989f}});}})[_0xb1e6('0x17')](function(){if(_0x4d989f&&_0x4d989f['length']){logger[_0xb1e6('0x11')](_0xb1e6('0x18'),_0x4d989f[_0xb1e6('0x12')]());for(var _0x4ae719=0x0;_0x4ae719<_0x4d989f['length'];_0x4ae719++){io['emit'](_0xb1e6('0x19'),{'id':_0x4d989f[_0x4ae719],'closed':!![]});}}})[_0xb1e6('0x1a')](function(_0x3d3d32){logger['error'](_0xb1e6('0x1b'),_0x3d3d32?util['inspect'](_0x3d3d32,{'showHidden':![],'depth':null}):'');});}exports[_0xb1e6('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9ad2=['lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','findAll','lastMsgAt','hours','join','update','timeout','YYYY-MM-DD\x20HH:mm:ss','then','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start'];(function(_0x56fa5c,_0x46b71e){var _0x5cf91b=function(_0x4f3f03){while(--_0x4f3f03){_0x56fa5c['push'](_0x56fa5c['shift']());}};_0x5cf91b(++_0x46b71e);}(_0x9ad2,0xe0));var _0x29ad=function(_0x11c3e1,_0x2272ee){_0x11c3e1=_0x11c3e1-0x0;var _0x5bde8e=_0x9ad2[_0x11c3e1];return _0x5bde8e;};'use strict';var _=require(_0x29ad('0x0'));var moment=require(_0x29ad('0x1'));var Redis=require(_0x29ad('0x2'));var util=require(_0x29ad('0x3'));var config=require(_0x29ad('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x29ad('0x5'))(_0x29ad('0x6'));config[_0x29ad('0x7')]=_[_0x29ad('0x8')](config[_0x29ad('0x7')],{'host':_0x29ad('0x9'),'port':0x18eb});var io=require(_0x29ad('0xa'))(new Redis(config[_0x29ad('0x7')]));function closeInteractions(){var _0x2ec01e=[];return db['WhatsappInteraction'][_0x29ad('0xb')]({'raw':!![],'attributes':['id',_0x29ad('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x29ad('0xd'))}}})['then'](function(_0x454e72){if(_0x454e72&&_0x454e72['length']){_0x2ec01e=_['map'](_0x454e72||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x2ec01e[_0x29ad('0xe')]());return db['WhatsappInteraction'][_0x29ad('0xf')]({'closeReason':'system','disposition':_0x29ad('0x10'),'closed':!![],'closedAt':moment()['format'](_0x29ad('0x11'))},{'where':{'id':_0x2ec01e}});}})[_0x29ad('0x12')](function(){if(_0x2ec01e&&_0x2ec01e[_0x29ad('0x13')]){logger['info'](_0x29ad('0x14'),_0x2ec01e[_0x29ad('0xe')]());for(var _0x19e843=0x0;_0x19e843<_0x2ec01e[_0x29ad('0x13')];_0x19e843++){io[_0x29ad('0x15')](_0x29ad('0x16'),{'id':_0x2ec01e[_0x19e843],'closed':!![]});}}})[_0x29ad('0x17')](function(_0xed88e4){logger[_0x29ad('0x18')](_0x29ad('0x19'),_0xed88e4?util[_0x29ad('0x1a')](_0xed88e4,{'showHidden':![],'depth':null}):'');});}exports[_0x29ad('0x1b')]=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 138c2e3..8cf7472 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf54e=['hopper2','catch','../mysqldb','Biondo','innocenzo.biondo','@xcally.com','now','push','Innocenzo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','contacts2'];(function(_0x1046f2,_0x177f91){var _0x2a0f5a=function(_0x3e1971){while(--_0x3e1971){_0x1046f2['push'](_0x1046f2['shift']());}};_0x2a0f5a(++_0x177f91);}(_0xf54e,0x1e8));var _0xef54=function(_0x2ab3c5,_0x35a3ef){_0x2ab3c5=_0x2ab3c5-0x0;var _0x2733aa=_0xf54e[_0x2ab3c5];return _0x2733aa;};'use strict';var util=require('util');var db=require(_0xef54('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xef54('0x1')+i,'phone':0xf879fb460+i,'email':_0xef54('0x2')+i+_0xef54('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xef54('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xef54('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xef54('0x5')]({'id':i,'firstName':_0xef54('0x6')+i,'lastName':_0xef54('0x1')+i,'phone':0xf879fb460+i,'email':_0xef54('0x2')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xef54('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xef54('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xef54('0x4')](),'updatedAt':Date['now']()});}db[_0xef54('0x7')][_0xef54('0x8')]({'where':{}})[_0xef54('0x9')](function(){return db[_0xef54('0x7')][_0xef54('0xa')](contacts);})[_0xef54('0x9')](function(){console[_0xef54('0xb')](_0xef54('0xc'),_0xef54('0xd'));return db['CmHopper'][_0xef54('0x8')]({'where':{}});})[_0xef54('0x9')](function(){return db[_0xef54('0xe')]['bulkCreate'](hopper);})['then'](function(){console[_0xef54('0xb')](_0xef54('0xc'),'hopper1');return db[_0xef54('0x7')][_0xef54('0xa')](contacts2);})[_0xef54('0x9')](function(){console[_0xef54('0xb')](_0xef54('0xc'),_0xef54('0xf'));return db[_0xef54('0xe')][_0xef54('0xa')](hopper2);})[_0xef54('0x9')](function(){console['log']('finished\x20populating',_0xef54('0x10'));})[_0xef54('0x11')](function(_0x32dd27){console[_0xef54('0xb')](_0x32dd27);}); \ No newline at end of file +var _0x0a4b=['log','finished\x20populating','CmHopper','hopper1','contacts2','catch','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','then'];(function(_0x1f6a60,_0x1465de){var _0x526310=function(_0x18fef2){while(--_0x18fef2){_0x1f6a60['push'](_0x1f6a60['shift']());}};_0x526310(++_0x1465de);}(_0x0a4b,0xf4));var _0xb0a4=function(_0x8eca22,_0x172a81){_0x8eca22=_0x8eca22-0x0;var _0x108523=_0x0a4b[_0x8eca22];return _0x108523;};'use strict';var util=require('util');var db=require(_0xb0a4('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xb0a4('0x1')]({'id':i,'firstName':_0xb0a4('0x2')+i,'lastName':_0xb0a4('0x3')+i,'phone':0xf879fb460+i,'email':_0xb0a4('0x4')+i+_0xb0a4('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb0a4('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xb0a4('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb0a4('0x6')](),'updatedAt':Date[_0xb0a4('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xb0a4('0x2')+i,'lastName':_0xb0a4('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xb0a4('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xb0a4('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xb0a4('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xb0a4('0x6')]()});}db[_0xb0a4('0x7')][_0xb0a4('0x8')]({'where':{}})['then'](function(){return db[_0xb0a4('0x7')][_0xb0a4('0x9')](contacts);})[_0xb0a4('0xa')](function(){console[_0xb0a4('0xb')](_0xb0a4('0xc'),'contacts1');return db[_0xb0a4('0xd')]['destroy']({'where':{}});})[_0xb0a4('0xa')](function(){return db[_0xb0a4('0xd')][_0xb0a4('0x9')](hopper);})[_0xb0a4('0xa')](function(){console[_0xb0a4('0xb')](_0xb0a4('0xc'),_0xb0a4('0xe'));return db[_0xb0a4('0x7')]['bulkCreate'](contacts2);})[_0xb0a4('0xa')](function(){console['log'](_0xb0a4('0xc'),_0xb0a4('0xf'));return db[_0xb0a4('0xd')][_0xb0a4('0x9')](hopper2);})[_0xb0a4('0xa')](function(){console[_0xb0a4('0xb')](_0xb0a4('0xc'),'hopper2');})[_0xb0a4('0x10')](function(_0x36fb42){console['log'](_0x36fb42);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index c55f5b9..89eecea 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7ad=['log','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then'];(function(_0x40e849,_0x4879bc){var _0x28602d=function(_0x3325a7){while(--_0x3325a7){_0x40e849['push'](_0x40e849['shift']());}};_0x28602d(++_0x4879bc);}(_0xf7ad,0x178));var _0xdf7a=function(_0x7cb9a9,_0x31cbfd){_0x7cb9a9=_0x7cb9a9-0x0;var _0x52d159=_0xf7ad[_0x7cb9a9];return _0x52d159;};'use strict';var util=require(_0xdf7a('0x0'));var db=require(_0xdf7a('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xdf7a('0x2')]({'name':util[_0xdf7a('0x3')](_0xdf7a('0x4'),'agent',i),'fullname':util['format']('%s%s',_0xdf7a('0x5'),i),'email':util[_0xdf7a('0x3')](_0xdf7a('0x6'),'agent',i),'role':_0xdf7a('0x5'),'password':_0xdf7a('0x7'),'internal':0xfa0+i,'type':_0xdf7a('0x8'),'transport':[_0xdf7a('0x9'),'ws',_0xdf7a('0xa')],'disallow':[_0xdf7a('0xb')],'allow':[_0xdf7a('0xc')],'defaultuser':util[_0xdf7a('0x3')](_0xdf7a('0x4'),_0xdf7a('0x5'),i),'encryption':_0xdf7a('0xd'),'avpf':_0xdf7a('0xd'),'force_avp':'yes','icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xdf7a('0xe'),'dtlsprivatekey':_0xdf7a('0xf'),'dtlssetup':_0xdf7a('0x10'),'callerid':util[_0xdf7a('0x3')](_0xdf7a('0x11'),util[_0xdf7a('0x3')](_0xdf7a('0x4'),'agent',i),0xfa0+i)});}db['User'][_0xdf7a('0x12')](users)[_0xdf7a('0x13')](function(){console[_0xdf7a('0x14')]('add\x20user');})[_0xdf7a('0x15')](function(_0x54ccd9){console[_0xdf7a('0x14')](_0x54ccd9);}); \ No newline at end of file +var _0x2a9d=['%s%s@xcally.com','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','%s%s','agent','format'];(function(_0x2ed345,_0x59c3c2){var _0x1e812c=function(_0xdb7f76){while(--_0xdb7f76){_0x2ed345['push'](_0x2ed345['shift']());}};_0x1e812c(++_0x59c3c2);}(_0x2a9d,0x174));var _0xd2a9=function(_0x148c09,_0x4fd39f){_0x148c09=_0x148c09-0x0;var _0x18e613=_0x2a9d[_0x148c09];return _0x18e613;};'use strict';var util=require(_0xd2a9('0x0'));var db=require(_0xd2a9('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd2a9('0x2')]({'name':util['format'](_0xd2a9('0x3'),_0xd2a9('0x4'),i),'fullname':util[_0xd2a9('0x5')](_0xd2a9('0x3'),_0xd2a9('0x4'),i),'email':util[_0xd2a9('0x5')](_0xd2a9('0x6'),'agent',i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0xd2a9('0x7'),'transport':[_0xd2a9('0x8'),'ws','wss'],'disallow':[_0xd2a9('0x9')],'allow':[_0xd2a9('0xa')],'defaultuser':util[_0xd2a9('0x5')](_0xd2a9('0x3'),_0xd2a9('0x4'),i),'encryption':_0xd2a9('0xb'),'avpf':_0xd2a9('0xb'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0xd2a9('0xb'),'dtlsverify':'no','dtlscertfile':_0xd2a9('0xc'),'dtlsprivatekey':_0xd2a9('0xd'),'dtlssetup':_0xd2a9('0xe'),'callerid':util[_0xd2a9('0x5')](_0xd2a9('0xf'),util['format'](_0xd2a9('0x3'),_0xd2a9('0x4'),i),0xfa0+i)});}db['User'][_0xd2a9('0x10')](users)[_0xd2a9('0x11')](function(){console[_0xd2a9('0x12')](_0xd2a9('0x13'));})[_0xd2a9('0x14')](function(_0xa7c429){console['log'](_0xa7c429);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index c0992df..748bbda 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa498=['UserProfileResource','resourceId','Campaign','format','%s:queue:%s','Agents','length','user:%s','handshake','query','find','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','userProfileId','FaxQueue','SmsQueues','MailQueues','WhatsappQueues','Telephones','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','user_has_chat_interactions:remove','emit','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','address','request','log','nsp','disconnect','lodash','util','bluebird','./environment','name','User','role','agent','telephone','type','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','OpenchannelQueues','findAll','Trunks'];(function(_0x2c6d00,_0x4a14a2){var _0x4d426e=function(_0x1d3c88){while(--_0x1d3c88){_0x2c6d00['push'](_0x2c6d00['shift']());}};_0x4d426e(++_0x4a14a2);}(_0xa498,0x179));var _0x8a49=function(_0x422ac3,_0x48bbd4){_0x422ac3=_0x422ac3-0x0;var _0x53c0d4=_0xa498[_0x422ac3];return _0x53c0d4;};'use strict';var _=require(_0x8a49('0x0'));var util=require(_0x8a49('0x1'));var BPromise=require(_0x8a49('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x8a49('0x3'));var queryQueues={'attributes':['id',_0x8a49('0x4')],'include':[{'as':'Agents','model':db[_0x8a49('0x5')],'attributes':['id',_0x8a49('0x4'),_0x8a49('0x6')],'raw':!![],'where':{'role':_0x8a49('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8a49('0x4')],'where':{'role':_0x8a49('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x8a49('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x8a49('0x9')],'where':{'type':_0x8a49('0xa')}};function getAssociatedResources(_0x3f8837,_0x43f5ff,_0x26ee03){return db[_0x8a49('0xb')]['findOne']({'where':{'name':_0x3f8837,'userProfileId':_0x43f5ff},'raw':!![]})[_0x8a49('0xc')](function(_0x224a4b){if(_0x224a4b){if(_0x224a4b[_0x8a49('0xd')]){switch(_0x3f8837){case _0x8a49('0xe'):case _0x8a49('0xf'):case'FaxQueues':case'SmsQueues':case'MailQueues':case _0x8a49('0x10'):case'WhatsappQueues':return db[_0x26ee03][_0x8a49('0x11')](queryQueues);case'Telephones':return db[_0x26ee03]['findAll'](queryTelephones);case _0x8a49('0x12'):return db[_0x26ee03][_0x8a49('0x11')](queryTrunks);case'IvrCampaigns':return db[_0x26ee03][_0x8a49('0x11')](queryCampaigns);}}else{return db[_0x8a49('0x13')]['findAll']({'attributes':[_0x8a49('0x14')],'where':{'sectionId':_0x224a4b['id']},'raw':!![]})[_0x8a49('0xc')](function(_0x4a6aec){if(_0x4a6aec){var _0x1fdaf4={'where':{'id':_['map'](_0x4a6aec,_0x8a49('0x14'))},'raw':!![]};switch(_0x26ee03){case'User':_0x1fdaf4['where']['role']=_0x8a49('0x8');break;case _0x8a49('0x15'):_0x1fdaf4['where'][_0x8a49('0x9')]=_0x8a49('0xa');break;}return db[_0x26ee03][_0x8a49('0x11')](_0x1fdaf4);}else{return[];}});}}else{return[];}})[_0x8a49('0xc')](function(_0x2f7001){return _0x2f7001;});}function joinOrLeaveQueues(_0x42c2a5,_0x545725,_0x1460dd,_0x546c25){_0x42c2a5[_0x545725](util[_0x8a49('0x16')](_0x8a49('0x17'),_0x1460dd,_0x546c25['name']));if(_0x546c25['Agents']){for(var _0x14bfb2=0x0;_0x14bfb2<_0x546c25[_0x8a49('0x18')][_0x8a49('0x19')];_0x14bfb2+=0x1){_0x42c2a5[_0x545725](util[_0x8a49('0x16')](_0x8a49('0x1a'),_0x546c25['Agents'][_0x14bfb2][_0x8a49('0x4')]));}}}function joinOrLeave(_0x139777,_0x19f79b,_0x2d47f4){var _0x4b895f;if(_0x139777[_0x8a49('0x1b')][_0x8a49('0x1c')]['id']){db[_0x8a49('0x5')][_0x8a49('0x1d')]({'attributes':['id',_0x8a49('0x4'),'role','userProfileId'],'where':{'id':_0x139777[_0x8a49('0x1b')][_0x8a49('0x1c')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x8a49('0x1e'),'attributes':['id'],'raw':!![]},{'model':db[_0x8a49('0x1f')],'as':_0x8a49('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x8a49('0x21')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8a49('0x22')],'as':_0x8a49('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x8a49('0x24')],'as':_0x8a49('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x8a49('0x26')],'as':_0x8a49('0x27'),'attributes':['id'],'raw':!![]}]})[_0x8a49('0xc')](function(_0x3eadad){if(_0x3eadad){_0x4b895f=_0x3eadad;_0x139777[_0x19f79b](util[_0x8a49('0x16')](_0x8a49('0x1a'),_0x3eadad[_0x8a49('0x4')]));var _0x106cb6=[];switch(_0x3eadad['role']){case'admin':_0x139777[_0x19f79b](_0x8a49('0x28'));_0x139777[_0x19f79b](_0x8a49('0x29'));if(queryQueues[_0x8a49('0x2a')](_0x8a49('0x2b'))){delete queryQueues['include'];}_0x106cb6[_0x8a49('0x2c')](db[_0x8a49('0x2d')][_0x8a49('0x11')](queryQueues));_0x106cb6[_0x8a49('0x2c')](db[_0x8a49('0x2e')]['findAll'](queryQueues));_0x106cb6[_0x8a49('0x2c')](db['FaxQueue'][_0x8a49('0x11')](queryQueues));_0x106cb6[_0x8a49('0x2c')](db[_0x8a49('0x2f')][_0x8a49('0x11')](queryQueues));_0x106cb6['push'](db[_0x8a49('0x30')][_0x8a49('0x11')](queryQueues));_0x106cb6[_0x8a49('0x2c')](db[_0x8a49('0x31')][_0x8a49('0x11')](queryQueues));_0x106cb6['push'](db[_0x8a49('0x32')][_0x8a49('0x11')](queryQueues));_0x106cb6[_0x8a49('0x2c')](db[_0x8a49('0x5')]['findAll'](queryTelephones));_0x106cb6[_0x8a49('0x2c')](db[_0x8a49('0x33')]['findAll'](queryTrunks));_0x106cb6['push'](db[_0x8a49('0x15')][_0x8a49('0x11')](queryCampaigns));_0x106cb6[_0x8a49('0x2c')](db[_0x8a49('0x5')]['findAll'](queryAgents));break;case _0x8a49('0x34'):_0x139777[_0x19f79b]('voice:inbound');_0x139777[_0x19f79b](_0x8a49('0x29'));_0x106cb6[_0x8a49('0x2c')](getAssociatedResources(_0x8a49('0xe'),_0x3eadad[_0x8a49('0x35')],_0x8a49('0x2d')));_0x106cb6[_0x8a49('0x2c')](getAssociatedResources(_0x8a49('0xf'),_0x3eadad[_0x8a49('0x35')],_0x8a49('0x2e')));_0x106cb6[_0x8a49('0x2c')](getAssociatedResources('FaxQueues',_0x3eadad[_0x8a49('0x35')],_0x8a49('0x36')));_0x106cb6[_0x8a49('0x2c')](getAssociatedResources(_0x8a49('0x37'),_0x3eadad[_0x8a49('0x35')],_0x8a49('0x2f')));_0x106cb6[_0x8a49('0x2c')](getAssociatedResources(_0x8a49('0x38'),_0x3eadad[_0x8a49('0x35')],_0x8a49('0x30')));_0x106cb6[_0x8a49('0x2c')](getAssociatedResources('OpenchannelQueues',_0x3eadad[_0x8a49('0x35')],'OpenchannelQueue'));_0x106cb6[_0x8a49('0x2c')](getAssociatedResources(_0x8a49('0x39'),_0x3eadad[_0x8a49('0x35')],_0x8a49('0x32')));_0x106cb6[_0x8a49('0x2c')](getAssociatedResources(_0x8a49('0x3a'),_0x3eadad[_0x8a49('0x35')],_0x8a49('0x5')));_0x106cb6[_0x8a49('0x2c')](getAssociatedResources(_0x8a49('0x12'),_0x3eadad[_0x8a49('0x35')],_0x8a49('0x33')));_0x106cb6[_0x8a49('0x2c')](getAssociatedResources(_0x8a49('0x3b'),_0x3eadad[_0x8a49('0x35')],'Campaign'));_0x106cb6['push'](db[_0x8a49('0x5')][_0x8a49('0x11')](queryAgents));break;case _0x8a49('0x7'):_0x139777[_0x19f79b]('voice:inbound');_0x139777[_0x19f79b](_0x8a49('0x29'));_0x106cb6['push'](_0x3eadad[_0x8a49('0x3c')]({'attributes':['id',_0x8a49('0x4')]}));_0x106cb6[_0x8a49('0x2c')](_0x3eadad[_0x8a49('0x3d')]({'attributes':['id',_0x8a49('0x4')]}));_0x106cb6[_0x8a49('0x2c')](_0x3eadad[_0x8a49('0x3e')]({'attributes':['id',_0x8a49('0x4')]}));_0x106cb6[_0x8a49('0x2c')](_0x3eadad[_0x8a49('0x3f')]({'attributes':['id',_0x8a49('0x4')]}));_0x106cb6['push'](_0x3eadad[_0x8a49('0x40')]({'attributes':['id',_0x8a49('0x4')]}));_0x106cb6[_0x8a49('0x2c')](_0x3eadad[_0x8a49('0x41')]({'attributes':['id',_0x8a49('0x4')]}));_0x106cb6['push'](_0x3eadad[_0x8a49('0x42')]({'attributes':['id',_0x8a49('0x4')]}));break;}return BPromise[_0x8a49('0x43')](_0x106cb6);}})['then'](function(_0x540879){if(_0x540879&&_0x540879[_0x8a49('0x19')]){for(var _0x248beb=0x0;_0x248beb<_0x540879['length'];_0x248beb+=0x1){for(var _0x330a9c=0x0;_0x330a9c<_0x540879[_0x248beb][_0x8a49('0x19')];_0x330a9c+=0x1){switch(_0x248beb){case 0x0:joinOrLeaveQueues(_0x139777,_0x19f79b,_0x8a49('0x44'),_0x540879[_0x248beb][_0x330a9c]);break;case 0x1:joinOrLeaveQueues(_0x139777,_0x19f79b,_0x8a49('0x45'),_0x540879[_0x248beb][_0x330a9c]);break;case 0x2:joinOrLeaveQueues(_0x139777,_0x19f79b,_0x8a49('0x46'),_0x540879[_0x248beb][_0x330a9c]);break;case 0x3:joinOrLeaveQueues(_0x139777,_0x19f79b,_0x8a49('0x47'),_0x540879[_0x248beb][_0x330a9c]);break;case 0x4:joinOrLeaveQueues(_0x139777,_0x19f79b,_0x8a49('0x48'),_0x540879[_0x248beb][_0x330a9c]);break;case 0x5:joinOrLeaveQueues(_0x139777,_0x19f79b,_0x8a49('0x49'),_0x540879[_0x248beb][_0x330a9c]);break;case 0x6:joinOrLeaveQueues(_0x139777,_0x19f79b,_0x8a49('0x4a'),_0x540879[_0x248beb][_0x330a9c]);break;case 0x7:if(_0x4b895f[_0x8a49('0x6')]!=='agent')_0x139777[_0x19f79b](util['format'](_0x8a49('0x4b'),_0x540879[_0x248beb][_0x330a9c][_0x8a49('0x4')]));break;case 0x8:if(_0x4b895f[_0x8a49('0x6')]!==_0x8a49('0x7'))_0x139777[_0x19f79b](util[_0x8a49('0x16')](_0x8a49('0x4c'),_0x540879[_0x248beb][_0x330a9c][_0x8a49('0x4')]));break;case 0x9:if(_0x4b895f[_0x8a49('0x6')]!==_0x8a49('0x7'))_0x139777[_0x19f79b](util[_0x8a49('0x16')](_0x8a49('0x4d'),_0x540879[_0x248beb][_0x330a9c][_0x8a49('0x9')],_0x540879[_0x248beb][_0x330a9c][_0x8a49('0x4')]));break;case 0xa:_0x139777[_0x19f79b](util[_0x8a49('0x16')](_0x8a49('0x1a'),_0x540879[_0x248beb][_0x330a9c]['name']));break;}}}}})[_0x8a49('0xc')](function(){if(_0x19f79b===_0x8a49('0x4e')){var _0x3aae2f=_[_0x8a49('0x4f')](_0x4b895f[_0x8a49('0x1e')],'id');return _0x4b895f[_0x8a49('0x50')](_0x3aae2f)[_0x8a49('0xc')](function(){for(var _0x53707f=0x0;_0x53707f<_0x3aae2f['length'];_0x53707f+=0x1){_0x2d47f4['emit'](_0x8a49('0x51'),{'ChatInteractionId':Number(_0x3aae2f[_0x53707f]),'UserId':Number(_0x4b895f['id'])});}});}})['then'](function(){if(_0x19f79b===_0x8a49('0x4e')){var _0x851c92=_[_0x8a49('0x4f')](_0x4b895f[_0x8a49('0x20')],'id');return _0x4b895f['removeMailInteractions'](_0x851c92)['then'](function(){for(var _0x2aa4a4=0x0;_0x2aa4a4<_0x851c92[_0x8a49('0x19')];_0x2aa4a4+=0x1){_0x2d47f4[_0x8a49('0x52')](_0x8a49('0x53'),{'MailInteractionId':Number(_0x851c92[_0x2aa4a4]),'UserId':Number(_0x4b895f['id'])});}});}})[_0x8a49('0xc')](function(){if(_0x19f79b===_0x8a49('0x4e')){var _0xb938ce=_['map'](_0x4b895f[_0x8a49('0x54')],'id');return _0x4b895f[_0x8a49('0x55')](_0xb938ce)['then'](function(){for(var _0x411176=0x0;_0x411176<_0xb938ce[_0x8a49('0x19')];_0x411176+=0x1){_0x2d47f4[_0x8a49('0x52')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0xb938ce[_0x411176]),'UserId':Number(_0x4b895f['id'])});}});}})['then'](function(){if(_0x19f79b===_0x8a49('0x4e')){var _0x1312dc=_[_0x8a49('0x4f')](_0x4b895f['SmsInteractions'],'id');return _0x4b895f['removeSmsInteractions'](_0x1312dc)[_0x8a49('0xc')](function(){for(var _0x46ab5f=0x0;_0x46ab5f<_0x1312dc[_0x8a49('0x19')];_0x46ab5f+=0x1){_0x2d47f4[_0x8a49('0x52')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x1312dc[_0x46ab5f]),'UserId':Number(_0x4b895f['id'])});}});}})[_0x8a49('0xc')](function(){if(_0x19f79b===_0x8a49('0x4e')){var _0x157dd8=_[_0x8a49('0x4f')](_0x4b895f[_0x8a49('0x25')],'id');return _0x4b895f[_0x8a49('0x56')](_0x157dd8)[_0x8a49('0xc')](function(){for(var _0x3e918f=0x0;_0x3e918f<_0x157dd8[_0x8a49('0x19')];_0x3e918f+=0x1){_0x2d47f4['emit'](_0x8a49('0x57'),{'OpenchannelInteractionId':Number(_0x157dd8[_0x3e918f]),'UserId':Number(_0x4b895f['id'])});}});}})[_0x8a49('0xc')](function(){if(_0x19f79b===_0x8a49('0x4e')){var _0x21bc51=_[_0x8a49('0x4f')](_0x4b895f[_0x8a49('0x27')],'id');return _0x4b895f[_0x8a49('0x58')](_0x21bc51)['then'](function(){for(var _0x2b5193=0x0;_0x2b5193<_0x21bc51[_0x8a49('0x19')];_0x2b5193+=0x1){_0x2d47f4['emit'](_0x8a49('0x59'),{'WhatsappInteractionId':Number(_0x21bc51[_0x2b5193]),'UserId':Number(_0x4b895f['id'])});}});}})[_0x8a49('0x5a')](function(_0xa1be08){_0x139777['log'](_0xa1be08);});}}function onDisconnect(_0x255d47,_0x1a742d){joinOrLeave(_0x255d47,_0x8a49('0x4e'),_0x1a742d);}function onConnect(_0x1e245b){joinOrLeave(_0x1e245b,_0x8a49('0x5b'));}exports[_0x8a49('0x5c')]=function(_0x455f5d){_0x455f5d['on'](_0x8a49('0x5d'),function(_0x4d2e89){_0x4d2e89['setMaxListeners'](0x0);_0x4d2e89[_0x8a49('0x5e')]=_0x4d2e89[_0x8a49('0x5f')][_0x8a49('0x5d')]['remoteAddress']+':'+_0x4d2e89['request'][_0x8a49('0x5d')]['remotePort'];_0x4d2e89['connectedAt']=new Date();_0x4d2e89[_0x8a49('0x60')]=function(_0x37795b){console[_0x8a49('0x60')]('SocketIO\x20'+_0x4d2e89[_0x8a49('0x61')]['name']+'['+_0x4d2e89[_0x8a49('0x5e')]+']',_0x37795b);};_0x4d2e89['on'](_0x8a49('0x62'),function(){onDisconnect(_0x4d2e89,_0x455f5d);_0x4d2e89['log']('DISCONNECTED');});onConnect(_0x4d2e89);_0x4d2e89[_0x8a49('0x60')]('CONNECTED');});}; \ No newline at end of file +var _0x80e6=['type','ivr','UserProfileSection','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','where','Campaign','format','Agents','handshake','query','find','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','push','VoiceQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','userProfileId','ChatQueue','MailQueue','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','fax','sms','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','remoteAddress','request','remotePort','connectedAt','log','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','util','bluebird','./environment','name','User','role','agent','telephone'];(function(_0x5eb816,_0x1cdf68){var _0x5d948b=function(_0x444cfb){while(--_0x444cfb){_0x5eb816['push'](_0x5eb816['shift']());}};_0x5d948b(++_0x1cdf68);}(_0x80e6,0x1e7));var _0x680e=function(_0x205dc2,_0x104851){_0x205dc2=_0x205dc2-0x0;var _0x11e4b8=_0x80e6[_0x205dc2];return _0x11e4b8;};'use strict';var _=require('lodash');var util=require(_0x680e('0x0'));var BPromise=require(_0x680e('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x680e('0x2'));var queryQueues={'attributes':['id',_0x680e('0x3')],'include':[{'as':'Agents','model':db[_0x680e('0x4')],'attributes':['id','name',_0x680e('0x5')],'raw':!![],'where':{'role':_0x680e('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x680e('0x3')],'where':{'role':_0x680e('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x680e('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x680e('0x3')],'where':{'role':_0x680e('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x680e('0x3'),_0x680e('0x8')],'where':{'type':_0x680e('0x9')}};function getAssociatedResources(_0x1a691c,_0x1ec107,_0x18f7e3){return db[_0x680e('0xa')]['findOne']({'where':{'name':_0x1a691c,'userProfileId':_0x1ec107},'raw':!![]})['then'](function(_0x4d80a1){if(_0x4d80a1){if(_0x4d80a1[_0x680e('0xb')]){switch(_0x1a691c){case _0x680e('0xc'):case _0x680e('0xd'):case _0x680e('0xe'):case'SmsQueues':case _0x680e('0xf'):case _0x680e('0x10'):case _0x680e('0x11'):return db[_0x18f7e3][_0x680e('0x12')](queryQueues);case'Telephones':return db[_0x18f7e3][_0x680e('0x12')](queryTelephones);case _0x680e('0x13'):return db[_0x18f7e3][_0x680e('0x12')](queryTrunks);case _0x680e('0x14'):return db[_0x18f7e3][_0x680e('0x12')](queryCampaigns);}}else{return db[_0x680e('0x15')][_0x680e('0x12')]({'attributes':[_0x680e('0x16')],'where':{'sectionId':_0x4d80a1['id']},'raw':!![]})[_0x680e('0x17')](function(_0x3b1d9b){if(_0x3b1d9b){var _0x1993aa={'where':{'id':_[_0x680e('0x18')](_0x3b1d9b,_0x680e('0x16'))},'raw':!![]};switch(_0x18f7e3){case'User':_0x1993aa[_0x680e('0x19')][_0x680e('0x5')]=_0x680e('0x7');break;case _0x680e('0x1a'):_0x1993aa[_0x680e('0x19')][_0x680e('0x8')]=_0x680e('0x9');break;}return db[_0x18f7e3][_0x680e('0x12')](_0x1993aa);}else{return[];}});}}else{return[];}})['then'](function(_0x561f51){return _0x561f51;});}function joinOrLeaveQueues(_0x9c69d4,_0x1b00e3,_0x2ee5b0,_0x113969){_0x9c69d4[_0x1b00e3](util[_0x680e('0x1b')]('%s:queue:%s',_0x2ee5b0,_0x113969[_0x680e('0x3')]));if(_0x113969[_0x680e('0x1c')]){for(var _0x5fc8d0=0x0;_0x5fc8d0<_0x113969[_0x680e('0x1c')]['length'];_0x5fc8d0+=0x1){_0x9c69d4[_0x1b00e3](util[_0x680e('0x1b')]('user:%s',_0x113969[_0x680e('0x1c')][_0x5fc8d0][_0x680e('0x3')]));}}}function joinOrLeave(_0x5f1666,_0x27ad3d,_0x5d22e1){var _0x1e1eb6;if(_0x5f1666[_0x680e('0x1d')][_0x680e('0x1e')]['id']){db[_0x680e('0x4')][_0x680e('0x1f')]({'attributes':['id',_0x680e('0x3'),_0x680e('0x5'),'userProfileId'],'where':{'id':_0x5f1666[_0x680e('0x1d')][_0x680e('0x1e')]['id']},'include':[{'model':db[_0x680e('0x20')],'as':_0x680e('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x680e('0x22')],'as':_0x680e('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x680e('0x24')],'as':_0x680e('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x680e('0x26')],'as':_0x680e('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x680e('0x28')],'as':_0x680e('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x680e('0x2a')],'as':_0x680e('0x2b'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x545973){if(_0x545973){_0x1e1eb6=_0x545973;_0x5f1666[_0x27ad3d](util[_0x680e('0x1b')](_0x680e('0x2c'),_0x545973['name']));var _0x1042e2=[];switch(_0x545973[_0x680e('0x5')]){case _0x680e('0x2d'):_0x5f1666[_0x27ad3d](_0x680e('0x2e'));_0x5f1666[_0x27ad3d](_0x680e('0x2f'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues['include'];}_0x1042e2[_0x680e('0x30')](db[_0x680e('0x31')][_0x680e('0x12')](queryQueues));_0x1042e2[_0x680e('0x30')](db['ChatQueue'][_0x680e('0x12')](queryQueues));_0x1042e2[_0x680e('0x30')](db[_0x680e('0x32')][_0x680e('0x12')](queryQueues));_0x1042e2[_0x680e('0x30')](db[_0x680e('0x33')][_0x680e('0x12')](queryQueues));_0x1042e2[_0x680e('0x30')](db['MailQueue'][_0x680e('0x12')](queryQueues));_0x1042e2[_0x680e('0x30')](db[_0x680e('0x34')][_0x680e('0x12')](queryQueues));_0x1042e2[_0x680e('0x30')](db[_0x680e('0x35')][_0x680e('0x12')](queryQueues));_0x1042e2[_0x680e('0x30')](db['User'][_0x680e('0x12')](queryTelephones));_0x1042e2[_0x680e('0x30')](db[_0x680e('0x36')]['findAll'](queryTrunks));_0x1042e2[_0x680e('0x30')](db[_0x680e('0x1a')][_0x680e('0x12')](queryCampaigns));_0x1042e2[_0x680e('0x30')](db['User'][_0x680e('0x12')](queryAgents));break;case'user':_0x5f1666[_0x27ad3d](_0x680e('0x2e'));_0x5f1666[_0x27ad3d](_0x680e('0x2f'));_0x1042e2[_0x680e('0x30')](getAssociatedResources(_0x680e('0xc'),_0x545973[_0x680e('0x37')],_0x680e('0x31')));_0x1042e2[_0x680e('0x30')](getAssociatedResources(_0x680e('0xd'),_0x545973[_0x680e('0x37')],_0x680e('0x38')));_0x1042e2['push'](getAssociatedResources(_0x680e('0xe'),_0x545973[_0x680e('0x37')],_0x680e('0x32')));_0x1042e2['push'](getAssociatedResources('SmsQueues',_0x545973['userProfileId'],_0x680e('0x33')));_0x1042e2[_0x680e('0x30')](getAssociatedResources(_0x680e('0xf'),_0x545973[_0x680e('0x37')],_0x680e('0x39')));_0x1042e2[_0x680e('0x30')](getAssociatedResources(_0x680e('0x10'),_0x545973[_0x680e('0x37')],_0x680e('0x34')));_0x1042e2[_0x680e('0x30')](getAssociatedResources('WhatsappQueues',_0x545973[_0x680e('0x37')],_0x680e('0x35')));_0x1042e2[_0x680e('0x30')](getAssociatedResources(_0x680e('0x3a'),_0x545973[_0x680e('0x37')],_0x680e('0x4')));_0x1042e2[_0x680e('0x30')](getAssociatedResources(_0x680e('0x13'),_0x545973[_0x680e('0x37')],_0x680e('0x36')));_0x1042e2['push'](getAssociatedResources(_0x680e('0x14'),_0x545973[_0x680e('0x37')],_0x680e('0x1a')));_0x1042e2[_0x680e('0x30')](db[_0x680e('0x4')][_0x680e('0x12')](queryAgents));break;case _0x680e('0x6'):_0x5f1666[_0x27ad3d](_0x680e('0x2e'));_0x5f1666[_0x27ad3d](_0x680e('0x2f'));_0x1042e2['push'](_0x545973[_0x680e('0x3b')]({'attributes':['id',_0x680e('0x3')]}));_0x1042e2[_0x680e('0x30')](_0x545973[_0x680e('0x3c')]({'attributes':['id',_0x680e('0x3')]}));_0x1042e2[_0x680e('0x30')](_0x545973[_0x680e('0x3d')]({'attributes':['id','name']}));_0x1042e2[_0x680e('0x30')](_0x545973[_0x680e('0x3e')]({'attributes':['id',_0x680e('0x3')]}));_0x1042e2['push'](_0x545973[_0x680e('0x3f')]({'attributes':['id','name']}));_0x1042e2['push'](_0x545973[_0x680e('0x40')]({'attributes':['id','name']}));_0x1042e2[_0x680e('0x30')](_0x545973[_0x680e('0x41')]({'attributes':['id',_0x680e('0x3')]}));break;}return BPromise['all'](_0x1042e2);}})['then'](function(_0x1cae1e){if(_0x1cae1e&&_0x1cae1e[_0x680e('0x42')]){for(var _0x138a27=0x0;_0x138a27<_0x1cae1e[_0x680e('0x42')];_0x138a27+=0x1){for(var _0x3e3716=0x0;_0x3e3716<_0x1cae1e[_0x138a27][_0x680e('0x42')];_0x3e3716+=0x1){switch(_0x138a27){case 0x0:joinOrLeaveQueues(_0x5f1666,_0x27ad3d,_0x680e('0x43'),_0x1cae1e[_0x138a27][_0x3e3716]);break;case 0x1:joinOrLeaveQueues(_0x5f1666,_0x27ad3d,'chat',_0x1cae1e[_0x138a27][_0x3e3716]);break;case 0x2:joinOrLeaveQueues(_0x5f1666,_0x27ad3d,_0x680e('0x44'),_0x1cae1e[_0x138a27][_0x3e3716]);break;case 0x3:joinOrLeaveQueues(_0x5f1666,_0x27ad3d,_0x680e('0x45'),_0x1cae1e[_0x138a27][_0x3e3716]);break;case 0x4:joinOrLeaveQueues(_0x5f1666,_0x27ad3d,'mail',_0x1cae1e[_0x138a27][_0x3e3716]);break;case 0x5:joinOrLeaveQueues(_0x5f1666,_0x27ad3d,'openchannel',_0x1cae1e[_0x138a27][_0x3e3716]);break;case 0x6:joinOrLeaveQueues(_0x5f1666,_0x27ad3d,_0x680e('0x46'),_0x1cae1e[_0x138a27][_0x3e3716]);break;case 0x7:if(_0x1e1eb6[_0x680e('0x5')]!==_0x680e('0x6'))_0x5f1666[_0x27ad3d](util[_0x680e('0x1b')](_0x680e('0x47'),_0x1cae1e[_0x138a27][_0x3e3716][_0x680e('0x3')]));break;case 0x8:if(_0x1e1eb6[_0x680e('0x5')]!==_0x680e('0x6'))_0x5f1666[_0x27ad3d](util['format'](_0x680e('0x48'),_0x1cae1e[_0x138a27][_0x3e3716][_0x680e('0x3')]));break;case 0x9:if(_0x1e1eb6['role']!==_0x680e('0x6'))_0x5f1666[_0x27ad3d](util[_0x680e('0x1b')](_0x680e('0x49'),_0x1cae1e[_0x138a27][_0x3e3716][_0x680e('0x8')],_0x1cae1e[_0x138a27][_0x3e3716][_0x680e('0x3')]));break;case 0xa:_0x5f1666[_0x27ad3d](util['format'](_0x680e('0x2c'),_0x1cae1e[_0x138a27][_0x3e3716]['name']));break;}}}}})[_0x680e('0x17')](function(){if(_0x27ad3d===_0x680e('0x4a')){var _0x382487=_[_0x680e('0x18')](_0x1e1eb6[_0x680e('0x21')],'id');return _0x1e1eb6['removeChatInteractions'](_0x382487)['then'](function(){for(var _0x175072=0x0;_0x175072<_0x382487[_0x680e('0x42')];_0x175072+=0x1){_0x5d22e1[_0x680e('0x4b')](_0x680e('0x4c'),{'ChatInteractionId':Number(_0x382487[_0x175072]),'UserId':Number(_0x1e1eb6['id'])});}});}})[_0x680e('0x17')](function(){if(_0x27ad3d===_0x680e('0x4a')){var _0x36b3dc=_['map'](_0x1e1eb6[_0x680e('0x23')],'id');return _0x1e1eb6[_0x680e('0x4d')](_0x36b3dc)[_0x680e('0x17')](function(){for(var _0x9150a8=0x0;_0x9150a8<_0x36b3dc['length'];_0x9150a8+=0x1){_0x5d22e1[_0x680e('0x4b')](_0x680e('0x4e'),{'MailInteractionId':Number(_0x36b3dc[_0x9150a8]),'UserId':Number(_0x1e1eb6['id'])});}});}})['then'](function(){if(_0x27ad3d===_0x680e('0x4a')){var _0x1b685b=_[_0x680e('0x18')](_0x1e1eb6[_0x680e('0x25')],'id');return _0x1e1eb6['removeFaxInteractions'](_0x1b685b)[_0x680e('0x17')](function(){for(var _0xc2497a=0x0;_0xc2497a<_0x1b685b[_0x680e('0x42')];_0xc2497a+=0x1){_0x5d22e1[_0x680e('0x4b')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x1b685b[_0xc2497a]),'UserId':Number(_0x1e1eb6['id'])});}});}})[_0x680e('0x17')](function(){if(_0x27ad3d===_0x680e('0x4a')){var _0x251983=_[_0x680e('0x18')](_0x1e1eb6[_0x680e('0x27')],'id');return _0x1e1eb6[_0x680e('0x4f')](_0x251983)[_0x680e('0x17')](function(){for(var _0x41bb34=0x0;_0x41bb34<_0x251983['length'];_0x41bb34+=0x1){_0x5d22e1[_0x680e('0x4b')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x251983[_0x41bb34]),'UserId':Number(_0x1e1eb6['id'])});}});}})['then'](function(){if(_0x27ad3d==='leave'){var _0x27a4cf=_[_0x680e('0x18')](_0x1e1eb6[_0x680e('0x29')],'id');return _0x1e1eb6[_0x680e('0x50')](_0x27a4cf)[_0x680e('0x17')](function(){for(var _0x996eb6=0x0;_0x996eb6<_0x27a4cf[_0x680e('0x42')];_0x996eb6+=0x1){_0x5d22e1[_0x680e('0x4b')](_0x680e('0x51'),{'OpenchannelInteractionId':Number(_0x27a4cf[_0x996eb6]),'UserId':Number(_0x1e1eb6['id'])});}});}})[_0x680e('0x17')](function(){if(_0x27ad3d===_0x680e('0x4a')){var _0x1dc0f6=_[_0x680e('0x18')](_0x1e1eb6[_0x680e('0x2b')],'id');return _0x1e1eb6[_0x680e('0x52')](_0x1dc0f6)[_0x680e('0x17')](function(){for(var _0x417368=0x0;_0x417368<_0x1dc0f6[_0x680e('0x42')];_0x417368+=0x1){_0x5d22e1['emit'](_0x680e('0x53'),{'WhatsappInteractionId':Number(_0x1dc0f6[_0x417368]),'UserId':Number(_0x1e1eb6['id'])});}});}})[_0x680e('0x54')](function(_0x1ea8a2){_0x5f1666['log'](_0x1ea8a2);});}}function onDisconnect(_0x5ee9c1,_0xfb5948){joinOrLeave(_0x5ee9c1,_0x680e('0x4a'),_0xfb5948);}function onConnect(_0x48c128){joinOrLeave(_0x48c128,_0x680e('0x55'));}exports[_0x680e('0x56')]=function(_0x4227fd){_0x4227fd['on'](_0x680e('0x57'),function(_0xb8f6a3){_0xb8f6a3[_0x680e('0x58')](0x0);_0xb8f6a3[_0x680e('0x59')]=_0xb8f6a3['request'][_0x680e('0x57')][_0x680e('0x5a')]+':'+_0xb8f6a3[_0x680e('0x5b')][_0x680e('0x57')][_0x680e('0x5c')];_0xb8f6a3[_0x680e('0x5d')]=new Date();_0xb8f6a3[_0x680e('0x5e')]=function(_0x19095f){console[_0x680e('0x5e')](_0x680e('0x5f')+_0xb8f6a3[_0x680e('0x60')][_0x680e('0x3')]+'['+_0xb8f6a3[_0x680e('0x59')]+']',_0x19095f);};_0xb8f6a3['on']('disconnect',function(){onDisconnect(_0xb8f6a3,_0x4227fd);_0xb8f6a3[_0x680e('0x5e')](_0x680e('0x61'));});onConnect(_0xb8f6a3);_0xb8f6a3[_0x680e('0x5e')](_0x680e('0x62'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index c33ad04..e53c843 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 _0x78c5=['EventManager','error','code','Trigger,\x20%s','catch','get','motionChannel','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','SIP/%s','name','channel','incomingmessage','outgoingmessage','event','opened','resolve','AfterCreate','changed','closed','substatus','format','AfterUpdate','User','fullname','email','internal','default','length','hasOwnProperty','model','callback','toLowerCase','condition','util','../../mysqldb','../logger','triggers','client','Chat','newinteraction','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','info'];(function(_0x526378,_0x3eb2c6){var _0x3234f4=function(_0x104535){while(--_0x104535){_0x526378['push'](_0x526378['shift']());}};_0x3234f4(++_0x3eb2c6);}(_0x78c5,0x10c));var _0x578c=function(_0x1d9934,_0x15c292){_0x1d9934=_0x1d9934-0x0;var _0x3f8856=_0x78c5[_0x1d9934];return _0x3f8856;};'use strict';var util=require(_0x578c('0x0'));var db=require(_0x578c('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x578c('0x2'))(_0x578c('0x3'));var client=jayson[_0x578c('0x4')]['http']({'port':0x232a});var triggers=[{'channel':_0x578c('0x5'),'model':'ChatInteraction','event':'afterCreate','condition':_0x578c('0x6'),'callback':afterCreate},{'channel':_0x578c('0x5'),'model':_0x578c('0x7'),'event':_0x578c('0x8'),'condition':_0x578c('0x9'),'callback':afterUpdate},{'channel':'Chat','model':_0x578c('0xa'),'event':_0x578c('0xb'),'condition':_0x578c('0xc'),'callback':afterCreateMessage},{'channel':_0x578c('0x5'),'model':_0x578c('0xd'),'event':_0x578c('0xb'),'condition':_0x578c('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0x578c('0xe'),'model':_0x578c('0xf'),'event':'afterCreate','condition':_0x578c('0x6'),'callback':afterCreate},{'channel':_0x578c('0xe'),'model':'SmsInteraction','event':'afterUpdate','condition':_0x578c('0x9'),'callback':afterUpdate},{'channel':'Sms','model':_0x578c('0x10'),'event':_0x578c('0xb'),'condition':_0x578c('0xc'),'callback':afterCreateMessage},{'channel':_0x578c('0x11'),'model':_0x578c('0x12'),'event':_0x578c('0xb'),'condition':_0x578c('0x6'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x578c('0x12'),'event':_0x578c('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x578c('0x11'),'model':_0x578c('0x13'),'event':_0x578c('0xb'),'condition':_0x578c('0xc'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x578c('0x14'),'event':_0x578c('0xb'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x578c('0x15'),'model':'FaxInteraction','event':'afterUpdate','condition':_0x578c('0x9'),'callback':afterUpdate},{'channel':_0x578c('0x15'),'model':_0x578c('0x16'),'event':_0x578c('0xb'),'condition':_0x578c('0xc'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x578c('0x17'),'event':_0x578c('0xb'),'condition':_0x578c('0x6'),'callback':afterCreate},{'channel':'Mail','model':_0x578c('0x17'),'event':_0x578c('0x8'),'condition':_0x578c('0x9'),'callback':afterUpdate},{'channel':_0x578c('0x18'),'model':_0x578c('0x19'),'event':_0x578c('0xb'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x578c('0x1a'),'model':'OpenchannelInteraction','event':_0x578c('0xb'),'condition':_0x578c('0x6'),'callback':afterCreate},{'channel':'Openchannel','model':_0x578c('0x1b'),'event':_0x578c('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x578c('0x1a'),'model':_0x578c('0x1c'),'event':'afterCreate','condition':_0x578c('0xc'),'callback':afterCreateMessage}];function request(_0x51be76){return client[_0x578c('0x1d')]('EventManager',_0x51be76)[_0x578c('0x1e')](function(_0x49ed38){logger[_0x578c('0x1f')]('Trigger,\x20%s',_0x578c('0x20'),_0x49ed38);if(_0x49ed38[_0x578c('0x21')]){if(_0x49ed38['error'][_0x578c('0x22')]===0x1f4){logger[_0x578c('0x21')](_0x578c('0x23'),_0x578c('0x20'),_0x49ed38[_0x578c('0x21')]);}}})[_0x578c('0x24')](function(_0x432d19){logger['error'](_0x578c('0x23'),_0x578c('0x20'),_0x432d19);});}function afterCreateMessage(_0x4faf80){return function(_0x3d5322){_0x3d5322=_0x3d5322[_0x578c('0x25')]({'plain':!![]});_0x3d5322['channel']=_0x4faf80;_0x3d5322[_0x578c('0x26')]=_0x4faf80;_0x3d5322['event']=_0x3d5322['direction'];Promise['resolve']()[_0x578c('0x1e')](function(){if(typeof _0x3d5322[_0x578c('0x27')]===_0x578c('0x28'))return null;var _0x2db50d=_0x578c('0x29')+_0x3d5322[_0x578c('0x27')];return db[_0x578c('0x2a')][_0x578c('0x2b')](_0x2db50d,{'type':db[_0x578c('0x2c')][_0x578c('0x2d')][_0x578c('0x2e')],'raw':!![]});})[_0x578c('0x1e')](function(_0xff0d63){if(_0xff0d63){_0x3d5322[_0x578c('0x2f')]=_0xff0d63[0x0];}if(typeof _0x3d5322[_0x578c('0x30')]===_0x578c('0x28'))return;return getAgent(_0x3d5322[_0x578c('0x30')]);})[_0x578c('0x1e')](function(_0x24d775){if(_0x24d775){_0x3d5322[_0x578c('0x31')]=util['format'](_0x578c('0x32'),_0x24d775[_0x578c('0x33')]);_0x3d5322['agent']=_0x24d775;_0x3d5322[_0x578c('0x34')]=_0x4faf80;return request({'event':_0x578c('0x35'),'message':_0x3d5322});}else{return request({'event':_0x578c('0x36'),'message':_0x3d5322});}})[_0x578c('0x24')](function(_0x2a4f37){logger[_0x578c('0x21')](_0x578c('0x23'),'AfterCreateMessage',_0x2a4f37);});};}function afterCreateOfflineMessage(_0x1a8234){return function(_0x323f47){_0x323f47=_0x323f47['get']({'plain':!![]});_0x323f47[_0x578c('0x34')]=_0x1a8234;_0x323f47[_0x578c('0x26')]=_0x1a8234;_0x323f47[_0x578c('0x37')]='offlineMessage';return request({'event':_0x323f47[_0x578c('0x37')],'message':_0x323f47});};}function afterCreate(_0x3c6e31,_0x225b10){return function(_0x23f9fd){_0x23f9fd=_0x23f9fd[_0x578c('0x25')]({'plain':!![]});_0x23f9fd[_0x578c('0x34')]=_0x3c6e31;_0x23f9fd['motionChannel']=_0x3c6e31;_0x23f9fd['event']=_0x578c('0x38');Promise[_0x578c('0x39')]()['then'](function(){var _0x1cd6ad=_0x578c('0x29')+_0x23f9fd[_0x578c('0x27')];return db[_0x578c('0x2a')]['query'](_0x1cd6ad,{'type':db[_0x578c('0x2c')][_0x578c('0x2d')][_0x578c('0x2e')],'raw':!![]});})[_0x578c('0x1e')](function(_0xbcf42f){if(_0xbcf42f){_0x23f9fd[_0x578c('0x2f')]=_0xbcf42f[0x0];}if(typeof _0x23f9fd[_0x578c('0x30')]===_0x578c('0x28'))return;return getAgent(_0x23f9fd[_0x578c('0x30')]);})[_0x578c('0x1e')](function(_0x5770a5){if(_0x5770a5){_0x23f9fd['interface']=util['format'](_0x578c('0x32'),_0x5770a5[_0x578c('0x33')]);_0x23f9fd['agent']=_0x5770a5;}return request({'event':_0x225b10,'message':_0x23f9fd});})[_0x578c('0x24')](function(_0x5eb044){logger[_0x578c('0x21')](_0x578c('0x23'),_0x578c('0x3a'),_0x5eb044);});};}function afterUpdate(_0x7252a4){return function(_0x116efd){var _0x19afb1=_0x116efd[_0x578c('0x3b')](_0x578c('0x3c'))&&_0x116efd[_0x578c('0x3c')];var _0x3df1ef=_0x116efd[_0x578c('0x3b')](_0x578c('0x3d'));if(_0x19afb1||_0x3df1ef){var _0x5e273d=_0x19afb1?_0x578c('0x9'):_0x578c('0x3d');var _0x1f3afc=_0x116efd['get']({'plain':!![]});_0x1f3afc[_0x578c('0x34')]=_0x7252a4;_0x1f3afc[_0x578c('0x26')]=_0x7252a4;_0x1f3afc['event']=_0x19afb1?'closed':_0x578c('0x3d');var _0x88100b=_0x578c('0x29')+_0x1f3afc['ContactId'];return db[_0x578c('0x2a')][_0x578c('0x2b')](_0x88100b,{'type':db[_0x578c('0x2c')][_0x578c('0x2d')][_0x578c('0x2e')],'raw':!![]})['then'](function(_0x288c22){if(_0x288c22){_0x1f3afc['contact']=_0x288c22[0x0];}if(typeof _0x1f3afc[_0x578c('0x30')]===_0x578c('0x28'))return;return getAgent(_0x1f3afc[_0x578c('0x30')]);})['then'](function(_0x2d9b30){if(_0x2d9b30){_0x1f3afc[_0x578c('0x31')]=util[_0x578c('0x3e')]('SIP/%s',_0x2d9b30['name']);_0x1f3afc['agent']=_0x2d9b30;}return request({'event':_0x5e273d,'message':_0x1f3afc});})['catch'](function(_0x4a6c2b){logger[_0x578c('0x21')](_0x578c('0x23'),_0x578c('0x3f'),_0x4a6c2b);});}};}function getAgent(_0x3197d2){return db[_0x578c('0x40')]['find']({'where':{'id':_0x3197d2},'attributes':['id',_0x578c('0x33'),_0x578c('0x41'),_0x578c('0x42'),_0x578c('0x43')],'raw':!![]})[_0x578c('0x1e')](function(_0x21a166){return _0x21a166;});}exports[_0x578c('0x44')]=function(){for(var _0x1c115b=0x0;_0x1c115b=_0x18f2d8[_0xab55('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x4f4c86(_0x4bf6c5);})[_0xab55('0x12')](function(_0x18a0f8){_0x3662e6(_0x18a0f8);});});}; \ No newline at end of file +var _0x02d7=['./license/util','mail','chat','fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','blockedAt','updateAttributes','getLicense','role','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0x02d7,0xfa));var _0x702d=function(_0x3fb7f3,_0x531c03){_0x3fb7f3=_0x3fb7f3-0x0;var _0x4ab2ce=_0x02d7[_0x3fb7f3];return _0x4ab2ce;};'use strict';var _=require(_0x702d('0x0'));var BPromise=require('bluebird');var db=require(_0x702d('0x1'))['db'];var util=require(_0x702d('0x2'));var channels=['voice',_0x702d('0x3'),_0x702d('0x4'),_0x702d('0x5'),_0x702d('0x6'),'whatsapp',_0x702d('0x7')];exports[_0x702d('0x8')]=function(){return channels;};exports[_0x702d('0x9')]=function(_0x123db2){_0x123db2=_0x123db2[_0x702d('0xa')]();return _['includes'](channels,_0x123db2);};exports['clearBlockUser']=function(_0x25b91a,_0x3ca65a,_0x28c63d,_0x9055a5){var _0x389c47={'loginAttempts':_0x3ca65a,'blocked':_0x28c63d};if(!_['isUndefined'](_0x9055a5)){_0x389c47[_0x702d('0xb')]=_0x9055a5;}return _0x25b91a[_0x702d('0xc')](_0x389c47);};exports[_0x702d('0xd')]=function(_0x2fc8fd){return new BPromise(function(_0x2eb2e9,_0x1e3f47){var _0xc58405=0x0;if(_0x2fc8fd[_0x702d('0xe')]!==_0x702d('0xf')){_0x2eb2e9(_0x2fc8fd);}db['User'][_0x702d('0x10')]({'where':{'role':_0x702d('0xf'),'online':!![],'id':{'$ne':_0x2fc8fd['id']}}})['then'](function(_0x9b4d15){_0xc58405=_0x9b4d15;return util[_0x702d('0xd')]();})[_0x702d('0x11')](function(_0x7578fb){if(_0x7578fb&&_0x7578fb[_0x702d('0x12')]&&_0xc58405>=_0x7578fb['agents']){throw Error(_0x702d('0x13'));}_0x2eb2e9(_0x2fc8fd);})[_0x702d('0x14')](function(_0x6b141c){_0x1e3f47(_0x6b141c);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index f4d7829..a101d1c 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdcb9=['render','status','json','exports'];(function(_0x12d53f,_0x3173f7){var _0x2f4ec8=function(_0x252adb){while(--_0x252adb){_0x12d53f['push'](_0x12d53f['shift']());}};_0x2f4ec8(++_0x3173f7);}(_0xdcb9,0xa7));var _0x9dcb=function(_0x4ff402,_0x36e130){_0x4ff402=_0x4ff402-0x0;var _0x2cab12=_0xdcb9[_0x4ff402];return _0x2cab12;};'use strict';module[_0x9dcb('0x0')][0x194]=function pageNotFound(_0x4d5d7b,_0x2b9170){var _0x455718='404';var _0x396477=0x194;var _0x556d03={'status':_0x396477};_0x2b9170['status'](_0x556d03['status']);_0x2b9170[_0x9dcb('0x1')](_0x455718,{},function(_0x217bc1,_0x111039){if(_0x217bc1){return _0x2b9170[_0x9dcb('0x2')](_0x556d03['status'])[_0x9dcb('0x3')](_0x556d03);}_0x2b9170['send'](_0x111039);});}; \ No newline at end of file +var _0x9a5c=['status','json','send','exports','404'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9a5c,0x184));var _0xc9a5=function(_0x5b3e50,_0xa7a3cb){_0x5b3e50=_0x5b3e50-0x0;var _0x89a0c9=_0x9a5c[_0x5b3e50];return _0x89a0c9;};'use strict';module[_0xc9a5('0x0')][0x194]=function pageNotFound(_0x33a93d,_0x5cd502){var _0x35a64a=_0xc9a5('0x1');var _0x4374c0=0x194;var _0x1ad288={'status':_0x4374c0};_0x5cd502[_0xc9a5('0x2')](_0x1ad288[_0xc9a5('0x2')]);_0x5cd502['render'](_0x35a64a,{},function(_0x4b0a4b,_0x320e96){if(_0x4b0a4b){return _0x5cd502[_0xc9a5('0x2')](_0x1ad288[_0xc9a5('0x2')])[_0xc9a5('0x3')](_0x1ad288);}_0x5cd502[_0xc9a5('0x4')](_0x320e96);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 85c3ce6..0963644 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5e7=['fax_interaction_has_tags','FaxInteractionId','Interaction','AttachmentId','team_has_fax_queues','ContactId','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Queue','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Members','ChatProactiveAction','CompanyId','Company','cm_contact_has_tags','Campaign','OwnerId','CampaignId','OneAll','AutomationAllId','Any','AutomationId','ParentId','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','Mohs','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','Actions','TriggerId','CustomReportId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','int_desk_configuration_has_tags','ZohoAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','VtigerConfiguration','VtigerField','ServicenowConfiguration','FreshsalesField','FromId','ToId','JscriptyAnswerReport','ProjectId','VoiceQueues','team_has_mail_queues','team_has_whatsapp_queues','WhatsappQueues','HopperBlacks','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAgent','ToUserId','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Queues','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','name','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserOpenchannelQueue','UserWhatsappQueue','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Template','../api/template/template.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','hasOne','VoiceMail','UserId','userSetting','cascade','Recordings','UserVoiceQueueRt','VoiceQueuesRt','hasMany','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','SenderId','belongsTo','UserProfile','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','ChatInteraction','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueue','OpenchannelQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceExtension','ChanSpyId','Sound','moh_has_sounds','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','Trunk','TrunkId','TrunkBackupId','IntervalId','Agents','Teams','TeamVoiceQueue','BlackLists','ScreenRecording','VoiceMailMessage','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','AgentReports','Contact','MailAccountId','CloudProvider','restrict','CloudProviderId','Imap','Smtp','Dispositions','Interactions','Applications','ListId','mandatoryDispositionPause','mandatoryDispositionPauseId','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','ChatOfflineMessageId','TagId','List','DashboardItem','Items','FaxAccountId','Answers'];(function(_0x379f23,_0x48f142){var _0x457c86=function(_0x5cecef){while(--_0x5cecef){_0x379f23['push'](_0x379f23['shift']());}};_0x457c86(++_0x48f142);}(_0xc5e7,0x7e));var _0x7c5e=function(_0x135f39,_0x55ffc6){_0x135f39=_0x135f39-0x0;var _0x328550=_0xc5e7[_0x135f39];return _0x328550;};'use strict';var config=require(_0x7c5e('0x0'));var Sequelize=require(_0x7c5e('0x1'));var _=require(_0x7c5e('0x2'));var jstz=require('jstz');var timezone=jstz[_0x7c5e('0x3')]();config[_0x7c5e('0x1')]=_['defaultsDeep'](config['sequelize'],{'database':_0x7c5e('0x4'),'username':_0x7c5e('0x5'),'password':_0x7c5e('0x6'),'options':{'host':_0x7c5e('0x7'),'port':0xcea,'dialect':_0x7c5e('0x8'),'dialectOptions':{'charset':_0x7c5e('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x7c5e('0xa'),'collate':_0x7c5e('0xb')}}});config[_0x7c5e('0xc')]=_[_0x7c5e('0xd')](config[_0x7c5e('0xc')],{'database':_0x7c5e('0x4'),'username':_0x7c5e('0x5'),'password':_0x7c5e('0x6'),'options':{'host':_0x7c5e('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x7c5e('0x9')},'logging':![],'timezone':timezone[_0x7c5e('0xe')](),'define':{'charset':_0x7c5e('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7c5e('0x1')][_0x7c5e('0xf')],config[_0x7c5e('0x1')][_0x7c5e('0x10')],config[_0x7c5e('0x1')][_0x7c5e('0x11')],config['sequelize'][_0x7c5e('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0x7c5e('0xc')]['username'],config[_0x7c5e('0xc')][_0x7c5e('0x11')],config[_0x7c5e('0xc')][_0x7c5e('0x12')])};db['User']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x14'));db[_0x7c5e('0x15')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x16'));db[_0x7c5e('0x17')]=db['sequelize']['import'](_0x7c5e('0x18'));db['VoiceExtension']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x19'));db[_0x7c5e('0x1a')]=db['sequelize'][_0x7c5e('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x7c5e('0x1b')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0x1c'));db[_0x7c5e('0x1d')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0x1e'));db['ScreenRecording']=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x1f'));db['VoiceMailMessage']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x20'));db[_0x7c5e('0x21')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0x22'));db[_0x7c5e('0x23')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x24'));db[_0x7c5e('0x25')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0x26'));db[_0x7c5e('0x27')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x28'));db['MemberReport']=db[_0x7c5e('0x1')]['import']('../api/memberReport/memberReport.model');db['Trunk']=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0x29'));db['VoiceTransferReport']=db['sequelize']['import'](_0x7c5e('0x2a'));db['UserVoiceQueueRt']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x2b'));db[_0x7c5e('0x2c')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0x2d'));db[_0x7c5e('0x2e')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x2f'));db[_0x7c5e('0x30')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0x7c5e('0x31')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0x32'));db['UserSmsQueue']=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/userSmsQueue/userSmsQueue.model');db[_0x7c5e('0x33')]=db['sequelize'][_0x7c5e('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x7c5e('0x34')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x7c5e('0x35')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/mailServerIn/mailServerIn.model');db[_0x7c5e('0x36')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x37'));db[_0x7c5e('0x38')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0x39'));db[_0x7c5e('0x3a')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x3b'));db[_0x7c5e('0x3c')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x3d'));db[_0x7c5e('0x3e')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x3f'));db[_0x7c5e('0x40')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/mailMessage/mailMessage.model');db[_0x7c5e('0x41')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/mailApplication/mailApplication.model');db[_0x7c5e('0x42')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x43'));db[_0x7c5e('0x44')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x45'));db['DashboardItem']=db[_0x7c5e('0x1')]['import'](_0x7c5e('0x46'));db[_0x7c5e('0x47')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x48'));db[_0x7c5e('0x49')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0x4a'));db[_0x7c5e('0x4b')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0x7c5e('0x4c')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x4d'));db[_0x7c5e('0x4e')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/faxQueue/faxQueue.model');db[_0x7c5e('0x4f')]=db['sequelize'][_0x7c5e('0x13')]('../api/faxQueueReport/faxQueueReport.model');db[_0x7c5e('0x50')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0x51'));db[_0x7c5e('0x52')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x53'));db[_0x7c5e('0x54')]=db['sequelize']['import']('../api/smsInteraction/smsInteraction.model');db[_0x7c5e('0x55')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x56'));db[_0x7c5e('0x57')]=db[_0x7c5e('0x1')]['import']('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x58'));db[_0x7c5e('0x59')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x5a'));db[_0x7c5e('0x5b')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0x5c'));db[_0x7c5e('0x5d')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x5e'));db[_0x7c5e('0x5f')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0x60'));db[_0x7c5e('0x61')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0x62'));db[_0x7c5e('0x63')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0x64'));db['ChatInteraction']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x65'));db[_0x7c5e('0x66')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x67'));db[_0x7c5e('0x68')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x69'));db[_0x7c5e('0x6a')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/chatQueue/chatQueue.model');db[_0x7c5e('0x6b')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x6c'));db['ChatProactiveAction']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x6d'));db[_0x7c5e('0x6e')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x6f'));db[_0x7c5e('0x70')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0x71'));db[_0x7c5e('0x72')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0x73'));db[_0x7c5e('0x74')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x75'));db[_0x7c5e('0x76')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0x77'));db['CmHopperHistory']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x78'));db[_0x7c5e('0x79')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x7a'));db[_0x7c5e('0x7b')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0x7c'));db[_0x7c5e('0x7d')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x7e'));db[_0x7c5e('0x7f')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x80'));db[_0x7c5e('0x81')]=db[_0x7c5e('0x1')]['import']('../api/disposition/disposition.model');db[_0x7c5e('0x82')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x83'));db[_0x7c5e('0x84')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x85'));db[_0x7c5e('0x86')]=db[_0x7c5e('0x1')]['import']('../api/pause/pause.model');db[_0x7c5e('0x87')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x88'));db[_0x7c5e('0x89')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x8a'));db[_0x7c5e('0x8b')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0x8c'));db['Sound']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x8d'));db['Tag']=db[_0x7c5e('0x1')]['import']('../api/tag/tag.model');db[_0x7c5e('0x8e')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0x8f'));db['Trigger']=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/trigger/trigger.model');db[_0x7c5e('0x90')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x91'));db[_0x7c5e('0x92')]=db['sequelize']['import']('../api/integration/integration.model');db[_0x7c5e('0x93')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x94'));db[_0x7c5e('0x95')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x7c5e('0x96')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x97'));db['AnalyticExtractedReport']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x98'));db['AnalyticMetric']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x99'));db[_0x7c5e('0x9a')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0x9b'));db[_0x7c5e('0x9c')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0x9d'));db[_0x7c5e('0x9e')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0x9f'));db[_0x7c5e('0xa0')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xa1'));db[_0x7c5e('0xa2')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0x7c5e('0xa3')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0xa4'));db[_0x7c5e('0xa5')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xa6'));db[_0x7c5e('0xa7')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x7c5e('0xa8')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xa9'));db[_0x7c5e('0xaa')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xab'));db[_0x7c5e('0xac')]=db[_0x7c5e('0x1')]['import']('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0x7c5e('0x1')]['import'](_0x7c5e('0xad'));db[_0x7c5e('0xae')]=db['sequelize'][_0x7c5e('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x7c5e('0xaf')]=db[_0x7c5e('0x1')]['import']('../api/intZohoField/intZohoField.model');db[_0x7c5e('0xb0')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xb1'));db['ZendeskConfiguration']=db[_0x7c5e('0x1')]['import'](_0x7c5e('0xb2'));db[_0x7c5e('0xb3')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0xb4'));db[_0x7c5e('0xb5')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xb6'));db[_0x7c5e('0xb7')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x7c5e('0xb8')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xb9'));db[_0x7c5e('0xba')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xbb'));db['VtigerConfiguration']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xbc'));db['VtigerField']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xbd'));db[_0x7c5e('0xbe')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xbf'));db['ServicenowConfiguration']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xc0'));db[_0x7c5e('0xc1')]=db['sequelize'][_0x7c5e('0x13')]('../api/intServicenowField/intServicenowField.model');db[_0x7c5e('0xc2')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0xc3'));db[_0x7c5e('0xc4')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xc5'));db[_0x7c5e('0xc6')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0xc7'));db[_0x7c5e('0xc8')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0xc9'));db[_0x7c5e('0xca')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xcb'));db['FreshsalesField']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xcc'));db[_0x7c5e('0x92')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0xcd'));db[_0x7c5e('0xce')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xcf'));db[_0x7c5e('0xd0')]=db['sequelize']['import'](_0x7c5e('0xd1'));db[_0x7c5e('0xd2')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xd3'));db['JscriptyAnswerReport']=db[_0x7c5e('0x1')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x7c5e('0xd4')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xd5'));db[_0x7c5e('0xd6')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0xd7'));db[_0x7c5e('0xd8')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xd9'));db[_0x7c5e('0xda')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/squareReport/squareReport.model');db[_0x7c5e('0xdb')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xdc'));db[_0x7c5e('0xdd')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xde'));db[_0x7c5e('0xdf')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0xe0'));db[_0x7c5e('0xe1')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0xe2'));db[_0x7c5e('0xe3')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xe4'));db[_0x7c5e('0xe5')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0xe6'));db['SquareMessage']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xe7'));db['Team']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xe8'));db[_0x7c5e('0xe9')]=db[_0x7c5e('0x1')]['import']('../api/license/license.model');db['Campaign']=db[_0x7c5e('0x1')]['import'](_0x7c5e('0xea'));db[_0x7c5e('0xeb')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xec'));db[_0x7c5e('0xed')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/attachment/attachment.model');db[_0x7c5e('0xee')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xef'));db[_0x7c5e('0xf0')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0xf1'));db[_0x7c5e('0xf2')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xf3'));db[_0x7c5e('0xf4')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xf5'));db[_0x7c5e('0xf6')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0xf7'));db[_0x7c5e('0xf8')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0xf9'));db[_0x7c5e('0xfa')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xfb'));db[_0x7c5e('0xfc')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0xfd'));db['UserProfile']=db[_0x7c5e('0x1')]['import']('../api/userProfile/userProfile.model');db[_0x7c5e('0xfe')]=db['sequelize'][_0x7c5e('0x13')]('../api/userProfileSection/userProfileSection.model');db[_0x7c5e('0xff')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x100'));db[_0x7c5e('0x101')]=db[_0x7c5e('0x1')]['import']('../api/userNotification/userNotification.model');db[_0x7c5e('0x102')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x103'));db[_0x7c5e('0x104')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/whatsappApplication/whatsappApplication.model');db[_0x7c5e('0x105')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x7c5e('0x106')]=db[_0x7c5e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x7c5e('0x107')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x108'));db[_0x7c5e('0x109')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0x10a'));db[_0x7c5e('0x10b')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x10c'));db['CloudProvider']=db['sequelize'][_0x7c5e('0x13')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x10d'));db[_0x7c5e('0x10e')]=db[_0x7c5e('0x1')]['import'](_0x7c5e('0x10f'));db[_0x7c5e('0x110')]=db[_0x7c5e('0x1')][_0x7c5e('0x13')](_0x7c5e('0x111'));db[_0x7c5e('0x112')]=db['sequelize'][_0x7c5e('0x13')](_0x7c5e('0x113'));db[_0x7c5e('0x114')][_0x7c5e('0x115')](db[_0x7c5e('0x116')],{'as':_0x7c5e('0x116'),'onDelete':'cascade','foreignKey':_0x7c5e('0x117')});db[_0x7c5e('0x114')]['hasOne'](db[_0x7c5e('0x112')],{'as':_0x7c5e('0x118'),'onDelete':_0x7c5e('0x119'),'foreignKey':'UserId'});db[_0x7c5e('0x114')]['hasMany'](db['VoiceRecording'],{'as':_0x7c5e('0x11a'),'foreignKey':_0x7c5e('0x117')});db['User']['hasMany'](db[_0x7c5e('0x11b')],{'as':_0x7c5e('0x11c'),'foreignKey':_0x7c5e('0x117')});db[_0x7c5e('0x114')][_0x7c5e('0x11d')](db['VoiceExtension'],{'as':_0x7c5e('0x11e'),'onDelete':_0x7c5e('0x119'),'hooks':!![]});db[_0x7c5e('0x114')]['hasMany'](db[_0x7c5e('0x76')],{'as':_0x7c5e('0x11f'),'foreignKey':'UserId'});db[_0x7c5e('0x114')]['hasMany'](db[_0x7c5e('0x120')],{'as':_0x7c5e('0x121'),'foreignKey':_0x7c5e('0x117')});db[_0x7c5e('0x114')][_0x7c5e('0x11d')](db['ReportAgentPreview'],{'as':_0x7c5e('0x79'),'foreignKey':'UserId'});db[_0x7c5e('0x114')]['hasMany'](db[_0x7c5e('0x5b')],{'as':_0x7c5e('0x122'),'foreignKey':_0x7c5e('0x117')});db[_0x7c5e('0x114')][_0x7c5e('0x11d')](db['ChatInteraction'],{'as':_0x7c5e('0x123'),'foreignKey':'UserId'});db[_0x7c5e('0x114')]['hasMany'](db[_0x7c5e('0x54')],{'as':_0x7c5e('0x124'),'foreignKey':'UserId'});db[_0x7c5e('0x114')][_0x7c5e('0x11d')](db[_0x7c5e('0x4b')],{'as':_0x7c5e('0x125'),'foreignKey':_0x7c5e('0x117')});db[_0x7c5e('0x114')][_0x7c5e('0x11d')](db[_0x7c5e('0x3e')],{'as':_0x7c5e('0x126'),'foreignKey':_0x7c5e('0x117')});db[_0x7c5e('0x114')][_0x7c5e('0x11d')](db[_0x7c5e('0x105')],{'as':'WhatsappInteractions','foreignKey':_0x7c5e('0x117')});db['User'][_0x7c5e('0x11d')](db['UserNotification'],{'as':'UserNotifications','foreignKey':_0x7c5e('0x127')});db['User'][_0x7c5e('0x128')](db[_0x7c5e('0x129')],{'as':_0x7c5e('0x129'),'foreignKey':'userProfileId'});db[_0x7c5e('0x114')][_0x7c5e('0x12a')](db[_0x7c5e('0x6b')],{'as':_0x7c5e('0x12b'),'through':_0x7c5e('0x12c')});db[_0x7c5e('0x114')][_0x7c5e('0x12a')](db['CmContact'],{'as':_0x7c5e('0x12d'),'through':_0x7c5e('0x12e')});db[_0x7c5e('0x114')][_0x7c5e('0x12a')](db[_0x7c5e('0xfa')],{'as':_0x7c5e('0x12f'),'through':_0x7c5e('0x130')});db['User']['belongsToMany'](db[_0x7c5e('0x131')],{'through':_0x7c5e('0x132')});db[_0x7c5e('0x114')][_0x7c5e('0x12a')](db[_0x7c5e('0x3e')],{'as':_0x7c5e('0x126'),'through':_0x7c5e('0x133')});db[_0x7c5e('0x114')][_0x7c5e('0x12a')](db[_0x7c5e('0x134')],{'as':'ChatInteractions','through':_0x7c5e('0x135')});db[_0x7c5e('0x114')][_0x7c5e('0x12a')](db[_0x7c5e('0x4b')],{'as':_0x7c5e('0x125'),'through':_0x7c5e('0x136')});db[_0x7c5e('0x114')][_0x7c5e('0x12a')](db[_0x7c5e('0x54')],{'as':'SmsInteractions','through':_0x7c5e('0x137')});db['User']['belongsToMany'](db[_0x7c5e('0x5b')],{'as':_0x7c5e('0x122'),'through':_0x7c5e('0x138')});db[_0x7c5e('0x114')][_0x7c5e('0x12a')](db[_0x7c5e('0x105')],{'as':_0x7c5e('0x139'),'through':'user_has_whatsapp_interactions'});db[_0x7c5e('0x114')]['belongsToMany'](db[_0x7c5e('0x1b')],{'as':'VoiceQueues','through':_0x7c5e('0x2c'),'required':![]});db[_0x7c5e('0x114')][_0x7c5e('0x12a')](db[_0x7c5e('0xfc')],{'as':_0x7c5e('0x13a'),'through':_0x7c5e('0x110'),'required':![]});db[_0x7c5e('0x114')][_0x7c5e('0x12a')](db['MailQueue'],{'as':_0x7c5e('0x13b'),'through':_0x7c5e('0x30'),'required':![]});db[_0x7c5e('0x114')][_0x7c5e('0x12a')](db[_0x7c5e('0x6a')],{'as':_0x7c5e('0x13c'),'through':_0x7c5e('0x2e'),'required':![],'hooks':!![]});db[_0x7c5e('0x114')][_0x7c5e('0x12a')](db['FaxQueue'],{'as':_0x7c5e('0x13d'),'through':_0x7c5e('0x31'),'required':![]});db[_0x7c5e('0x114')][_0x7c5e('0x12a')](db['SmsQueue'],{'as':_0x7c5e('0x13e'),'through':_0x7c5e('0x13f'),'required':![]});db['User'][_0x7c5e('0x12a')](db[_0x7c5e('0x140')],{'as':_0x7c5e('0x141'),'through':_0x7c5e('0x33'),'required':![]});db['User'][_0x7c5e('0x12a')](db['WhatsappQueue'],{'as':'WhatsappQueues','through':_0x7c5e('0x34'),'required':![]});db['User'][_0x7c5e('0x12a')](db['CmList'],{'through':_0x7c5e('0x130')});db['User'][_0x7c5e('0x12a')](db[_0x7c5e('0x5f')],{'as':_0x7c5e('0x142'),'through':_0x7c5e('0x143')});db[_0x7c5e('0x114')][_0x7c5e('0x12a')](db[_0x7c5e('0x47')],{'as':_0x7c5e('0x144'),'through':_0x7c5e('0x145')});db['User'][_0x7c5e('0x12a')](db[_0x7c5e('0x38')],{'as':_0x7c5e('0x146'),'through':'user_has_mail_accounts'});db['User']['belongsToMany'](db['OpenchannelAccount'],{'as':_0x7c5e('0x147'),'through':_0x7c5e('0x148')});db['User'][_0x7c5e('0x12a')](db[_0x7c5e('0x50')],{'as':_0x7c5e('0x149'),'through':_0x7c5e('0x14a')});db[_0x7c5e('0x114')][_0x7c5e('0x12a')](db[_0x7c5e('0x102')],{'as':'WhatsappAccounts','through':_0x7c5e('0x14b')});db['User'][_0x7c5e('0x12a')](db[_0x7c5e('0xe3')],{'as':_0x7c5e('0x14c'),'through':_0x7c5e('0x14d')});db[_0x7c5e('0x15')][_0x7c5e('0x11d')](db[_0x7c5e('0x14e')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0x7c5e('0x14f')});db[_0x7c5e('0x17')][_0x7c5e('0x11d')](db['VoiceExtension'],{'onDelete':_0x7c5e('0x119')});db[_0x7c5e('0x14e')][_0x7c5e('0x11d')](db[_0x7c5e('0x14e')],{'as':'Applications','onDelete':_0x7c5e('0x119')});db[_0x7c5e('0x1a')][_0x7c5e('0x12a')](db[_0x7c5e('0x150')],{'as':'Sounds','through':_0x7c5e('0x151')});db['VoiceQueue']['hasMany'](db[_0x7c5e('0x11b')],{'as':'Members','foreignKey':_0x7c5e('0x152')});db['VoiceQueue'][_0x7c5e('0x11d')](db[_0x7c5e('0x72')],{'as':_0x7c5e('0x153'),'foreignKey':_0x7c5e('0x152')});db[_0x7c5e('0x1b')][_0x7c5e('0x11d')](db[_0x7c5e('0x76')],{'as':_0x7c5e('0x11f'),'foreignKey':_0x7c5e('0x152')});db[_0x7c5e('0x1b')][_0x7c5e('0x11d')](db[_0x7c5e('0x120')],{'as':_0x7c5e('0x154'),'foreignKey':_0x7c5e('0x152')});db[_0x7c5e('0x1b')][_0x7c5e('0x11d')](db[_0x7c5e('0x79')],{'as':_0x7c5e('0x79'),'foreignKey':_0x7c5e('0x152')});db[_0x7c5e('0x1b')][_0x7c5e('0x11d')](db[_0x7c5e('0x74')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x7c5e('0x11d')](db[_0x7c5e('0xd6')],{'as':_0x7c5e('0x155'),'foreignKey':_0x7c5e('0x152')});db[_0x7c5e('0x1b')][_0x7c5e('0x128')](db[_0x7c5e('0x156')],{'as':_0x7c5e('0x156'),'foreignKey':_0x7c5e('0x157')});db[_0x7c5e('0x1b')][_0x7c5e('0x128')](db[_0x7c5e('0x156')],{'as':'TrunkBackup','foreignKey':_0x7c5e('0x158')});db['VoiceQueue'][_0x7c5e('0x128')](db[_0x7c5e('0x84')],{'as':_0x7c5e('0x84'),'foreignKey':_0x7c5e('0x159')});db[_0x7c5e('0x1b')][_0x7c5e('0x128')](db[_0x7c5e('0x86')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x7c5e('0x1b')]['belongsToMany'](db[_0x7c5e('0xfa')],{'as':_0x7c5e('0x12f'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0x7c5e('0x12a')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x15a'),'through':_0x7c5e('0x2c')});db[_0x7c5e('0x1b')][_0x7c5e('0x12a')](db[_0x7c5e('0x131')],{'as':_0x7c5e('0x15b'),'through':_0x7c5e('0x15c')});db[_0x7c5e('0x1b')]['belongsToMany'](db[_0x7c5e('0xfa')],{'as':_0x7c5e('0x15d'),'through':'voice_queues_has_cm_blacklists'});db[_0x7c5e('0x1d')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'as':'User','foreignKey':_0x7c5e('0x117')});db[_0x7c5e('0x15e')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x114'),'foreignKey':_0x7c5e('0x117')});db[_0x7c5e('0x116')][_0x7c5e('0x11d')](db[_0x7c5e('0x15f')],{'as':_0x7c5e('0x160'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0x7c5e('0x161')});db['VoiceMailMessage'][_0x7c5e('0x128')](db[_0x7c5e('0x116')],{'foreignKey':_0x7c5e('0x162'),'targetKey':_0x7c5e('0x161')});db['VoiceCallReport'][_0x7c5e('0x11d')](db[_0x7c5e('0x27')],{'as':_0x7c5e('0x163'),'foreignKey':_0x7c5e('0x164'),'constraints':![]});db[_0x7c5e('0x21')]['hasMany'](db[_0x7c5e('0x25')],{'as':_0x7c5e('0x165'),'foreignKey':_0x7c5e('0x164'),'constraints':![]});db[_0x7c5e('0x21')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x114'),'foreignKey':'UserId'});db[_0x7c5e('0x21')][_0x7c5e('0x128')](db[_0x7c5e('0x70')],{'as':_0x7c5e('0x166'),'foreignKey':'ContactId'});db[_0x7c5e('0x35')]['belongsTo'](db[_0x7c5e('0x38')],{'as':_0x7c5e('0x38'),'foreignKey':_0x7c5e('0x167')});db[_0x7c5e('0x35')][_0x7c5e('0x128')](db[_0x7c5e('0x168')],{'as':_0x7c5e('0x168'),'foreignKey':'CloudProviderId','onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x36')][_0x7c5e('0x128')](db[_0x7c5e('0x38')],{'as':_0x7c5e('0x38'),'foreignKey':'MailAccountId'});db[_0x7c5e('0x36')][_0x7c5e('0x128')](db[_0x7c5e('0x168')],{'as':_0x7c5e('0x168'),'foreignKey':_0x7c5e('0x16a'),'onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x38')][_0x7c5e('0x115')](db[_0x7c5e('0x35')],{'as':_0x7c5e('0x16b'),'onDelete':_0x7c5e('0x119')});db[_0x7c5e('0x38')][_0x7c5e('0x115')](db['MailServerOut'],{'as':_0x7c5e('0x16c'),'onDelete':_0x7c5e('0x119')});db['MailAccount'][_0x7c5e('0x11d')](db[_0x7c5e('0x81')],{'as':_0x7c5e('0x16d'),'foreignKey':_0x7c5e('0x167'),'onDelete':_0x7c5e('0x119')});db[_0x7c5e('0x38')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x7c5e('0x167')});db['MailAccount'][_0x7c5e('0x11d')](db[_0x7c5e('0x40')],{'as':_0x7c5e('0x160'),'foreignKey':_0x7c5e('0x167')});db['MailAccount'][_0x7c5e('0x11d')](db['MailInteraction'],{'as':_0x7c5e('0x16e')});db[_0x7c5e('0x38')][_0x7c5e('0x11d')](db['MailApplication'],{'as':_0x7c5e('0x16f')});db['MailAccount']['belongsTo'](db[_0x7c5e('0xfa')],{'as':'List','foreignKey':_0x7c5e('0x170')});db['MailAccount'][_0x7c5e('0x128')](db['Template'],{'as':_0x7c5e('0x8e'),'foreignKey':'TemplateId'});db[_0x7c5e('0x38')][_0x7c5e('0x128')](db[_0x7c5e('0x86')],{'as':_0x7c5e('0x171'),'foreignKey':_0x7c5e('0x172')});db['MailAccount'][_0x7c5e('0x12a')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x15a'),'through':'user_has_mail_accounts'});db['MailQueue'][_0x7c5e('0x12a')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x15a'),'through':_0x7c5e('0x30')});db[_0x7c5e('0x3a')][_0x7c5e('0x12a')](db[_0x7c5e('0x131')],{'through':'team_has_mail_queues','as':_0x7c5e('0x15b')});db[_0x7c5e('0x3e')][_0x7c5e('0x11d')](db[_0x7c5e('0x40')],{'as':'Messages','onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x173')});db[_0x7c5e('0x3e')][_0x7c5e('0x128')](db[_0x7c5e('0x38')],{'as':_0x7c5e('0x174'),'foreignKey':_0x7c5e('0x167')});db['MailInteraction'][_0x7c5e('0x128')](db[_0x7c5e('0x70')],{'as':_0x7c5e('0x166'),'foreignKey':'ContactId'});db[_0x7c5e('0x3e')]['belongsTo'](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x175'),'foreignKey':'UserId'});db['MailInteraction']['belongsToMany'](db[_0x7c5e('0x176')],{'through':_0x7c5e('0x177'),'as':_0x7c5e('0x178')});db[_0x7c5e('0x3e')][_0x7c5e('0x12a')](db[_0x7c5e('0x176')],{'through':_0x7c5e('0x177'),'as':_0x7c5e('0x179')});db['MailInteraction'][_0x7c5e('0x12a')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x17a'),'through':'user_has_mail_interactions','foreignKey':_0x7c5e('0x173')});db[_0x7c5e('0x40')][_0x7c5e('0x11d')](db['Attachment'],{'as':_0x7c5e('0x17b'),'onDelete':_0x7c5e('0x119')});db[_0x7c5e('0x40')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x114')});db[_0x7c5e('0x40')][_0x7c5e('0x128')](db[_0x7c5e('0x70')],{'onDelete':'cascade','as':_0x7c5e('0x166')});db['MailMessage']['belongsTo'](db['MailInteraction'],{'as':'Interaction','foreignKey':_0x7c5e('0x173')});db[_0x7c5e('0x40')][_0x7c5e('0x128')](db[_0x7c5e('0x38')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x7c5e('0x40')]['belongsTo'](db['ChatWebsite'],{'as':_0x7c5e('0x5f'),'foreignKey':'ChatWebsiteId'});db[_0x7c5e('0x40')][_0x7c5e('0x128')](db[_0x7c5e('0x68')],{'as':_0x7c5e('0x68'),'foreignKey':_0x7c5e('0x17c')});db[_0x7c5e('0x41')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x41')]['belongsTo'](db[_0x7c5e('0x3a')],{'onDelete':'restrict'});db['MailApplication'][_0x7c5e('0x128')](db[_0x7c5e('0x38')],{'onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x41')][_0x7c5e('0x128')](db[_0x7c5e('0x84')],{'onDelete':_0x7c5e('0x169'),'foreignKey':'IntervalId'});db[_0x7c5e('0x41')][_0x7c5e('0x128')](db[_0x7c5e('0x176')],{'onDelete':_0x7c5e('0x169'),'foreignKey':_0x7c5e('0x17d')});db[_0x7c5e('0x42')][_0x7c5e('0x128')](db[_0x7c5e('0x38')],{});db[_0x7c5e('0x42')][_0x7c5e('0x128')](db[_0x7c5e('0xfa')],{'as':_0x7c5e('0x17e'),'foreignKey':'ListId'});db[_0x7c5e('0x42')][_0x7c5e('0x128')](db[_0x7c5e('0x70')],{'as':_0x7c5e('0x166'),'foreignKey':'ContactId'});db[_0x7c5e('0x42')][_0x7c5e('0x128')](db[_0x7c5e('0x3e')],{});db['MailQueueReport'][_0x7c5e('0x128')](db['MailMessage'],{});db[_0x7c5e('0x42')]['belongsTo'](db[_0x7c5e('0x114')],{});db[_0x7c5e('0x42')][_0x7c5e('0x128')](db[_0x7c5e('0x3a')],{});db[_0x7c5e('0x44')][_0x7c5e('0x11d')](db[_0x7c5e('0x17f')],{'as':_0x7c5e('0x180'),'onDelete':'cascade'});db[_0x7c5e('0x47')][_0x7c5e('0x11d')](db[_0x7c5e('0x81')],{'as':_0x7c5e('0x16d'),'foreignKey':_0x7c5e('0x181'),'onDelete':_0x7c5e('0x119')});db[_0x7c5e('0x47')][_0x7c5e('0x11d')](db[_0x7c5e('0x7f')],{'as':_0x7c5e('0x182'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0x7c5e('0x11d')](db[_0x7c5e('0x4b')],{'as':'Interactions'});db[_0x7c5e('0x47')]['hasMany'](db[_0x7c5e('0x49')],{'as':_0x7c5e('0x16f')});db[_0x7c5e('0x47')][_0x7c5e('0x11d')](db[_0x7c5e('0x14e')],{'as':'Exntensions','onDelete':_0x7c5e('0x119')});db[_0x7c5e('0x47')]['hasMany'](db[_0x7c5e('0x4c')],{'as':_0x7c5e('0x160')});db[_0x7c5e('0x47')][_0x7c5e('0x128')](db[_0x7c5e('0x156')],{'as':_0x7c5e('0x156')});db[_0x7c5e('0x47')][_0x7c5e('0x128')](db[_0x7c5e('0xfa')],{'as':_0x7c5e('0x17e'),'foreignKey':_0x7c5e('0x170')});db[_0x7c5e('0x47')][_0x7c5e('0x128')](db[_0x7c5e('0x86')],{'as':_0x7c5e('0x171'),'foreignKey':_0x7c5e('0x172')});db[_0x7c5e('0x47')][_0x7c5e('0x12a')](db['User'],{'as':'Agents','through':'user_has_fax_accounts'});db[_0x7c5e('0x49')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'onDelete':'restrict'});db[_0x7c5e('0x49')][_0x7c5e('0x128')](db['FaxQueue'],{'onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x49')][_0x7c5e('0x128')](db[_0x7c5e('0x47')],{'onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x49')][_0x7c5e('0x128')](db['Tag'],{'onDelete':_0x7c5e('0x169'),'foreignKey':_0x7c5e('0x17d')});db[_0x7c5e('0x4b')][_0x7c5e('0x11d')](db[_0x7c5e('0x4c')],{'as':_0x7c5e('0x160'),'onDelete':_0x7c5e('0x119'),'foreignKey':'FaxInteractionId'});db[_0x7c5e('0x4b')][_0x7c5e('0x128')](db['FaxAccount'],{'as':_0x7c5e('0x174'),'foreignKey':_0x7c5e('0x181')});db['FaxInteraction']['belongsTo'](db[_0x7c5e('0x70')],{'as':_0x7c5e('0x166'),'foreignKey':'ContactId'});db[_0x7c5e('0x4b')]['belongsTo'](db['User'],{'as':_0x7c5e('0x175'),'foreignKey':_0x7c5e('0x117')});db['FaxInteraction'][_0x7c5e('0x12a')](db['Tag'],{'through':_0x7c5e('0x183'),'as':_0x7c5e('0x178')});db['FaxInteraction'][_0x7c5e('0x12a')](db[_0x7c5e('0x176')],{'through':_0x7c5e('0x183'),'as':_0x7c5e('0x179')});db[_0x7c5e('0x4b')][_0x7c5e('0x12a')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x17a'),'through':'user_has_fax_interactions','foreignKey':_0x7c5e('0x184')});db[_0x7c5e('0x4c')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'onDelete':'cascade','as':_0x7c5e('0x114')});db[_0x7c5e('0x4c')][_0x7c5e('0x128')](db[_0x7c5e('0x4b')],{'as':_0x7c5e('0x185'),'foreignKey':'FaxInteractionId'});db[_0x7c5e('0x4c')]['belongsTo'](db[_0x7c5e('0x70')],{'onDelete':_0x7c5e('0x119'),'as':'Contact'});db[_0x7c5e('0x4c')]['belongsTo'](db[_0x7c5e('0xed')],{'as':_0x7c5e('0xed'),'foreignKey':_0x7c5e('0x186')});db[_0x7c5e('0x4c')][_0x7c5e('0x128')](db[_0x7c5e('0x47')],{'as':'Account','foreignKey':_0x7c5e('0x181')});db[_0x7c5e('0x4e')][_0x7c5e('0x12a')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x15a'),'through':'UserFaxQueue'});db['FaxQueue']['belongsToMany'](db[_0x7c5e('0x131')],{'through':_0x7c5e('0x187'),'as':_0x7c5e('0x15b')});db[_0x7c5e('0x4f')][_0x7c5e('0x128')](db[_0x7c5e('0x47')],{});db[_0x7c5e('0x4f')][_0x7c5e('0x128')](db[_0x7c5e('0xfa')],{'as':_0x7c5e('0x17e'),'foreignKey':_0x7c5e('0x170')});db[_0x7c5e('0x4f')][_0x7c5e('0x128')](db['CmContact'],{'as':_0x7c5e('0x166'),'foreignKey':_0x7c5e('0x188')});db[_0x7c5e('0x4f')][_0x7c5e('0x128')](db[_0x7c5e('0x4b')],{});db[_0x7c5e('0x4f')][_0x7c5e('0x128')](db[_0x7c5e('0x4c')],{});db['FaxQueueReport']['belongsTo'](db[_0x7c5e('0x114')],{});db[_0x7c5e('0x4f')]['belongsTo'](db['FaxQueue'],{});db['SmsAccount'][_0x7c5e('0x11d')](db[_0x7c5e('0x81')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0x7c5e('0x50')][_0x7c5e('0x11d')](db[_0x7c5e('0x7f')],{'as':'Answers','foreignKey':_0x7c5e('0x189')});db['SmsAccount'][_0x7c5e('0x11d')](db[_0x7c5e('0x55')],{'as':_0x7c5e('0x160'),'foreignKey':_0x7c5e('0x189')});db['SmsAccount']['hasMany'](db[_0x7c5e('0x54')],{'as':_0x7c5e('0x16e')});db[_0x7c5e('0x50')][_0x7c5e('0x11d')](db[_0x7c5e('0x52')],{'as':_0x7c5e('0x16f')});db['SmsAccount'][_0x7c5e('0x128')](db[_0x7c5e('0xfa')],{'as':_0x7c5e('0x17e'),'foreignKey':_0x7c5e('0x170')});db['SmsAccount'][_0x7c5e('0x128')](db[_0x7c5e('0x86')],{'as':_0x7c5e('0x171'),'foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount'][_0x7c5e('0x12a')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x15a'),'through':'user_has_sms_accounts'});db[_0x7c5e('0x52')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x52')]['belongsTo'](db[_0x7c5e('0x57')],{'onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x52')][_0x7c5e('0x128')](db[_0x7c5e('0x50')],{'onDelete':_0x7c5e('0x169')});db['SmsApplication']['belongsTo'](db[_0x7c5e('0x84')],{'onDelete':_0x7c5e('0x169'),'foreignKey':'IntervalId'});db[_0x7c5e('0x52')][_0x7c5e('0x128')](db[_0x7c5e('0x176')],{'onDelete':_0x7c5e('0x169'),'foreignKey':_0x7c5e('0x17d')});db[_0x7c5e('0x54')][_0x7c5e('0x11d')](db[_0x7c5e('0x55')],{'as':_0x7c5e('0x160'),'onDelete':'cascade','foreignKey':_0x7c5e('0x18a')});db[_0x7c5e('0x54')][_0x7c5e('0x128')](db[_0x7c5e('0x50')],{'as':_0x7c5e('0x174'),'foreignKey':_0x7c5e('0x189')});db[_0x7c5e('0x54')][_0x7c5e('0x128')](db['CmContact'],{'as':'Contact','foreignKey':_0x7c5e('0x188')});db[_0x7c5e('0x54')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x175'),'foreignKey':_0x7c5e('0x117')});db[_0x7c5e('0x54')][_0x7c5e('0x12a')](db[_0x7c5e('0x176')],{'through':_0x7c5e('0x18b'),'as':'Tags'});db['SmsInteraction'][_0x7c5e('0x12a')](db[_0x7c5e('0x176')],{'through':_0x7c5e('0x18b'),'as':_0x7c5e('0x179')});db[_0x7c5e('0x54')][_0x7c5e('0x12a')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x17a'),'through':_0x7c5e('0x137'),'foreignKey':_0x7c5e('0x18a')});db['SmsMessage']['belongsTo'](db['User'],{'as':_0x7c5e('0x114')});db[_0x7c5e('0x55')][_0x7c5e('0x128')](db[_0x7c5e('0x70')],{'onDelete':_0x7c5e('0x119'),'as':_0x7c5e('0x166')});db[_0x7c5e('0x55')]['belongsTo'](db['SmsInteraction'],{'onDelete':_0x7c5e('0x119'),'as':'Interaction','foreignKey':_0x7c5e('0x18a')});db[_0x7c5e('0x55')][_0x7c5e('0x128')](db['SmsAccount'],{'as':'Account','foreignKey':_0x7c5e('0x189')});db[_0x7c5e('0x57')][_0x7c5e('0x12a')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x15a'),'through':_0x7c5e('0x13f'),'foreignKey':'SmsQueueId'});db['SmsQueue'][_0x7c5e('0x12a')](db[_0x7c5e('0x131')],{'through':_0x7c5e('0x18c'),'as':'Teams'});db[_0x7c5e('0x18d')]['hasMany'](db[_0x7c5e('0x81')],{'as':_0x7c5e('0x16d'),'foreignKey':_0x7c5e('0x18e'),'onDelete':_0x7c5e('0x119')});db[_0x7c5e('0x18d')][_0x7c5e('0x11d')](db[_0x7c5e('0x7f')],{'as':_0x7c5e('0x182'),'foreignKey':_0x7c5e('0x18e')});db[_0x7c5e('0x18d')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x7c5e('0x16e'),'foreignKey':_0x7c5e('0x18e')});db[_0x7c5e('0x18d')][_0x7c5e('0x11d')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x7c5e('0x18d')][_0x7c5e('0x11d')](db[_0x7c5e('0x59')],{'as':'Applications','foreignKey':_0x7c5e('0x18e')});db[_0x7c5e('0x18d')][_0x7c5e('0x128')](db[_0x7c5e('0xfa')],{'as':_0x7c5e('0x17e'),'foreignKey':_0x7c5e('0x170')});db[_0x7c5e('0x18d')][_0x7c5e('0x128')](db[_0x7c5e('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0x7c5e('0x172')});db[_0x7c5e('0x18d')][_0x7c5e('0x12a')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x15a'),'through':_0x7c5e('0x148')});db[_0x7c5e('0x59')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x59')][_0x7c5e('0x128')](db[_0x7c5e('0x140')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0x7c5e('0x59')][_0x7c5e('0x128')](db[_0x7c5e('0x18d')],{'onDelete':_0x7c5e('0x169'),'foreignKey':'OpenchannelAccountId'});db[_0x7c5e('0x59')][_0x7c5e('0x128')](db[_0x7c5e('0x84')],{'onDelete':_0x7c5e('0x169'),'foreignKey':_0x7c5e('0x159')});db['OpenchannelApplication']['belongsTo'](db[_0x7c5e('0x176')],{'onDelete':_0x7c5e('0x169'),'foreignKey':_0x7c5e('0x17d')});db[_0x7c5e('0x5b')][_0x7c5e('0x11d')](db[_0x7c5e('0x5d')],{'as':_0x7c5e('0x160'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x18f')});db[_0x7c5e('0x5b')][_0x7c5e('0x128')](db[_0x7c5e('0x18d')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x7c5e('0x5b')][_0x7c5e('0x128')](db['CmContact'],{'as':_0x7c5e('0x166'),'foreignKey':_0x7c5e('0x188')});db[_0x7c5e('0x5b')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x175'),'foreignKey':_0x7c5e('0x117')});db[_0x7c5e('0x5b')][_0x7c5e('0x12a')](db[_0x7c5e('0x176')],{'through':_0x7c5e('0x190'),'as':_0x7c5e('0x178')});db[_0x7c5e('0x5b')][_0x7c5e('0x12a')](db[_0x7c5e('0x176')],{'through':_0x7c5e('0x190'),'as':'ThroughTags'});db[_0x7c5e('0x5b')][_0x7c5e('0x12a')](db[_0x7c5e('0x114')],{'as':'Users','through':_0x7c5e('0x138'),'foreignKey':_0x7c5e('0x18f')});db[_0x7c5e('0x5d')]['belongsTo'](db['User'],{'onDelete':_0x7c5e('0x119'),'as':'User'});db[_0x7c5e('0x5d')][_0x7c5e('0x128')](db[_0x7c5e('0x70')],{'onDelete':_0x7c5e('0x119'),'as':_0x7c5e('0x166')});db['OpenchannelMessage'][_0x7c5e('0x128')](db[_0x7c5e('0x5b')],{'onDelete':_0x7c5e('0x119'),'as':_0x7c5e('0x185'),'foreignKey':_0x7c5e('0x18f')});db[_0x7c5e('0x5d')][_0x7c5e('0x128')](db[_0x7c5e('0xed')],{'as':_0x7c5e('0xed'),'foreignKey':'AttachmentId'});db[_0x7c5e('0x5d')][_0x7c5e('0x128')](db[_0x7c5e('0x18d')],{'as':_0x7c5e('0x174'),'foreignKey':_0x7c5e('0x18e')});db[_0x7c5e('0x140')][_0x7c5e('0x12a')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x15a'),'through':'UserOpenchannelQueue','foreignKey':_0x7c5e('0x191')});db[_0x7c5e('0x140')][_0x7c5e('0x12a')](db['Team'],{'through':_0x7c5e('0x192'),'as':_0x7c5e('0x15b')});db[_0x7c5e('0x5f')][_0x7c5e('0x11d')](db[_0x7c5e('0x81')],{'as':_0x7c5e('0x16d'),'foreignKey':_0x7c5e('0x193'),'onDelete':_0x7c5e('0x119')});db['ChatWebsite'][_0x7c5e('0x11d')](db['CannedAnswer'],{'as':'Answers','foreignKey':'ChatWebsiteId'});db[_0x7c5e('0x5f')]['hasMany'](db['ChatProactiveAction'],{'as':_0x7c5e('0x194')});db[_0x7c5e('0x5f')][_0x7c5e('0x11d')](db[_0x7c5e('0x134')],{'as':_0x7c5e('0x16e')});db[_0x7c5e('0x5f')][_0x7c5e('0x11d')](db[_0x7c5e('0x63')],{'as':_0x7c5e('0x16f')});db[_0x7c5e('0x5f')]['hasMany'](db[_0x7c5e('0x66')],{'as':_0x7c5e('0x160')});db[_0x7c5e('0x5f')][_0x7c5e('0x128')](db[_0x7c5e('0xfa')],{'as':_0x7c5e('0x17e'),'foreignKey':_0x7c5e('0x170')});db[_0x7c5e('0x5f')]['belongsTo'](db[_0x7c5e('0x84')],{'as':_0x7c5e('0x84'),'foreignKey':_0x7c5e('0x159')});db[_0x7c5e('0x5f')][_0x7c5e('0x128')](db['MailAccount'],{'as':_0x7c5e('0x38'),'foreignKey':_0x7c5e('0x167')});db[_0x7c5e('0x5f')]['belongsTo'](db[_0x7c5e('0x86')],{'as':_0x7c5e('0x171'),'foreignKey':_0x7c5e('0x172')});db[_0x7c5e('0x5f')][_0x7c5e('0x12a')](db['User'],{'as':'Agents','through':_0x7c5e('0x143')});db['OpenchannelQueueReport']['belongsTo'](db[_0x7c5e('0x18d')],{});db[_0x7c5e('0x61')]['belongsTo'](db[_0x7c5e('0xfa')],{'as':'List','foreignKey':_0x7c5e('0x170')});db[_0x7c5e('0x61')][_0x7c5e('0x128')](db[_0x7c5e('0x70')],{'as':_0x7c5e('0x166'),'foreignKey':_0x7c5e('0x188')});db[_0x7c5e('0x61')][_0x7c5e('0x128')](db[_0x7c5e('0x5b')],{});db[_0x7c5e('0x61')][_0x7c5e('0x128')](db[_0x7c5e('0x5d')],{});db[_0x7c5e('0x61')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{});db[_0x7c5e('0x61')][_0x7c5e('0x128')](db[_0x7c5e('0x140')],{});db[_0x7c5e('0x63')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'as':'Agent','foreignKey':'UserId','onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x63')][_0x7c5e('0x128')](db[_0x7c5e('0x6a')],{'as':_0x7c5e('0x195'),'foreignKey':'ChatQueueId','onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x63')]['belongsTo'](db[_0x7c5e('0x5f')],{'as':_0x7c5e('0x196'),'foreignKey':'ChatWebsiteId','onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x63')][_0x7c5e('0x128')](db[_0x7c5e('0x176')],{'onDelete':'restrict','foreignKey':_0x7c5e('0x17d')});db['ChatInteraction']['hasMany'](db[_0x7c5e('0x66')],{'as':_0x7c5e('0x160'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x197')});db['ChatInteraction']['belongsTo'](db[_0x7c5e('0x5f')],{'as':'Account','foreignKey':_0x7c5e('0x193')});db[_0x7c5e('0x134')]['belongsTo'](db[_0x7c5e('0x70')],{'as':_0x7c5e('0x166'),'foreignKey':_0x7c5e('0x188')});db[_0x7c5e('0x134')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x175'),'foreignKey':_0x7c5e('0x117')});db[_0x7c5e('0x134')][_0x7c5e('0x12a')](db[_0x7c5e('0x176')],{'through':_0x7c5e('0x198'),'as':_0x7c5e('0x178')});db[_0x7c5e('0x134')][_0x7c5e('0x12a')](db[_0x7c5e('0x176')],{'through':_0x7c5e('0x198'),'as':'ThroughTags'});db['ChatInteraction'][_0x7c5e('0x12a')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x17a'),'through':_0x7c5e('0x135'),'foreignKey':'ChatInteractionId'});db[_0x7c5e('0x66')]['belongsTo'](db[_0x7c5e('0x114')],{'onDelete':_0x7c5e('0x119'),'as':_0x7c5e('0x114')});db[_0x7c5e('0x66')][_0x7c5e('0x128')](db[_0x7c5e('0x70')],{'onDelete':_0x7c5e('0x119'),'as':_0x7c5e('0x166'),'foreignKey':_0x7c5e('0x188')});db[_0x7c5e('0x66')][_0x7c5e('0x128')](db[_0x7c5e('0x134')],{'onDelete':_0x7c5e('0x119'),'as':_0x7c5e('0x185'),'foreignKey':_0x7c5e('0x197')});db[_0x7c5e('0x66')][_0x7c5e('0x128')](db[_0x7c5e('0xed')],{'as':_0x7c5e('0xed'),'foreignKey':_0x7c5e('0x186')});db['ChatMessage']['belongsTo'](db[_0x7c5e('0x5f')],{'as':_0x7c5e('0x174'),'foreignKey':_0x7c5e('0x193')});db[_0x7c5e('0x68')][_0x7c5e('0x11d')](db[_0x7c5e('0xed')],{'as':_0x7c5e('0x17b'),'foreignKey':_0x7c5e('0x17c'),'onDelete':_0x7c5e('0x119'),'hooks':!![]});db['ChatOfflineMessage'][_0x7c5e('0x128')](db[_0x7c5e('0x70')],{'onDelete':'cascade','as':_0x7c5e('0x166'),'foreignKey':'ContactId'});db[_0x7c5e('0x68')][_0x7c5e('0x128')](db[_0x7c5e('0x5f')],{'as':'Account','foreignKey':_0x7c5e('0x193')});db[_0x7c5e('0x6a')]['belongsToMany'](db[_0x7c5e('0x114')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0x7c5e('0x6a')][_0x7c5e('0x12a')](db['Team'],{'through':_0x7c5e('0x199'),'as':'Teams'});db[_0x7c5e('0x6b')]['hasMany'](db[_0x7c5e('0xd2')],{'as':_0x7c5e('0x160'),'foreignKey':_0x7c5e('0x19a'),'onDelete':_0x7c5e('0x119')});db['ChatGroup']['belongsToMany'](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x19b'),'through':_0x7c5e('0x12c')});db[_0x7c5e('0x19c')][_0x7c5e('0x128')](db['ChatWebsite'],{'as':'Website','foreignKey':_0x7c5e('0x193')});db[_0x7c5e('0x6e')][_0x7c5e('0x11d')](db[_0x7c5e('0x70')],{'as':'Contacts','foreignKey':_0x7c5e('0x19d')});db[_0x7c5e('0x70')]['hasMany'](db[_0x7c5e('0x72')],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x7c5e('0x70')][_0x7c5e('0x11d')](db['CmHopperFinal'],{'as':_0x7c5e('0x11f'),'foreignKey':_0x7c5e('0x188')});db[_0x7c5e('0x70')][_0x7c5e('0x11d')](db[_0x7c5e('0x120')],{'as':_0x7c5e('0x154'),'foreignKey':_0x7c5e('0x188')});db['CmContact'][_0x7c5e('0x11d')](db[_0x7c5e('0x79')],{'as':_0x7c5e('0x79'),'foreignKey':_0x7c5e('0x188')});db[_0x7c5e('0x70')][_0x7c5e('0x11d')](db['JscriptySessionReport'],{'as':_0x7c5e('0x155'),'foreignKey':'ContactId'});db[_0x7c5e('0x70')][_0x7c5e('0x11d')](db[_0x7c5e('0x5b')],{'as':_0x7c5e('0x122'),'foreignKey':_0x7c5e('0x188'),'onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x70')]['hasMany'](db[_0x7c5e('0x134')],{'as':_0x7c5e('0x123'),'foreignKey':'ContactId','onDelete':_0x7c5e('0x169')});db['CmContact']['hasMany'](db['SmsInteraction'],{'as':_0x7c5e('0x124'),'foreignKey':_0x7c5e('0x188'),'onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x70')][_0x7c5e('0x11d')](db[_0x7c5e('0x4b')],{'as':_0x7c5e('0x125'),'foreignKey':_0x7c5e('0x188'),'onDelete':'restrict'});db[_0x7c5e('0x70')]['hasMany'](db[_0x7c5e('0x3e')],{'as':_0x7c5e('0x126'),'foreignKey':'ContactId','onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x70')][_0x7c5e('0x128')](db[_0x7c5e('0x6e')],{'as':_0x7c5e('0x19e'),'foreignKey':_0x7c5e('0x19d')});db[_0x7c5e('0x70')]['belongsTo'](db[_0x7c5e('0xfa')],{'as':_0x7c5e('0x17e'),'foreignKey':'ListId','onDelete':_0x7c5e('0x119')});db[_0x7c5e('0x70')]['belongsToMany'](db['User'],{'as':'Users','through':'cm_user_has_contacts'});db[_0x7c5e('0x70')]['belongsToMany'](db[_0x7c5e('0x176')],{'as':_0x7c5e('0x178'),'through':_0x7c5e('0x19f')});db['CmContact'][_0x7c5e('0x12a')](db[_0x7c5e('0x176')],{'through':_0x7c5e('0x19f'),'as':_0x7c5e('0x179')});db[_0x7c5e('0x72')][_0x7c5e('0x128')](db['CmContact'],{'as':_0x7c5e('0x166'),'foreignKey':_0x7c5e('0x188'),'onDelete':_0x7c5e('0x119')});db[_0x7c5e('0x72')][_0x7c5e('0x128')](db[_0x7c5e('0xfa')],{'as':_0x7c5e('0x17e'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x7c5e('0x72')]['belongsTo'](db[_0x7c5e('0x114')],{'as':'Agent','foreignKey':_0x7c5e('0x117')});db[_0x7c5e('0x72')][_0x7c5e('0x128')](db[_0x7c5e('0x1b')],{'as':_0x7c5e('0x195'),'foreignKey':_0x7c5e('0x152'),'onDelete':'cascade'});db[_0x7c5e('0x72')]['belongsTo'](db[_0x7c5e('0x1a0')],{'as':_0x7c5e('0x1a0'),'foreignKey':'CampaignId','onDelete':_0x7c5e('0x119')});db[_0x7c5e('0x72')][_0x7c5e('0x128')](db['User'],{'as':_0x7c5e('0x175'),'foreignKey':_0x7c5e('0x1a1')});db[_0x7c5e('0x74')][_0x7c5e('0x128')](db[_0x7c5e('0x70')],{'as':'Contact','foreignKey':_0x7c5e('0x188'),'onDelete':_0x7c5e('0x119')});db[_0x7c5e('0x74')][_0x7c5e('0x128')](db[_0x7c5e('0xfa')],{'as':_0x7c5e('0x17e'),'foreignKey':_0x7c5e('0x170'),'onDelete':_0x7c5e('0x119')});db['CmHopperBlack']['belongsTo'](db[_0x7c5e('0x1b')],{'as':'Queue','foreignKey':_0x7c5e('0x152'),'onDelete':_0x7c5e('0x119')});db['CmHopperBlack'][_0x7c5e('0x128')](db['Campaign'],{'as':_0x7c5e('0x1a0'),'foreignKey':_0x7c5e('0x1a2'),'onDelete':_0x7c5e('0x119')});db['Automation']['hasMany'](db[_0x7c5e('0x82')],{'as':{'plural':'All','singular':_0x7c5e('0x1a3')},'foreignKey':_0x7c5e('0x1a4'),'onDelete':_0x7c5e('0x119'),'hooks':!![]});db[_0x7c5e('0x7d')][_0x7c5e('0x11d')](db[_0x7c5e('0x82')],{'as':{'plural':_0x7c5e('0x1a5'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x7c5e('0x119'),'hooks':!![]});db['Automation'][_0x7c5e('0x11d')](db[_0x7c5e('0x7b')],{'as':'Actions','foreignKey':_0x7c5e('0x1a6'),'onDelete':_0x7c5e('0x119'),'hooks':!![]});db[_0x7c5e('0x81')][_0x7c5e('0x11d')](db[_0x7c5e('0x81')],{'as':_0x7c5e('0x16d'),'foreignKey':_0x7c5e('0x1a7'),'onDelete':_0x7c5e('0x119')});db[_0x7c5e('0x84')][_0x7c5e('0x11d')](db['Interval'],{'as':'Intervals','foreignKey':_0x7c5e('0x159'),'onDelete':_0x7c5e('0x119'),'hooks':!![],'required':![]});db[_0x7c5e('0x84')][_0x7c5e('0x11d')](db[_0x7c5e('0x14e')],{'as':'Extensions','foreignKey':_0x7c5e('0x159'),'onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x84')][_0x7c5e('0x11d')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0x7c5e('0x159')});db[_0x7c5e('0x84')][_0x7c5e('0x11d')](db[_0x7c5e('0x63')],{'as':_0x7c5e('0x1a8'),'foreignKey':_0x7c5e('0x159')});db[_0x7c5e('0x84')][_0x7c5e('0x11d')](db[_0x7c5e('0x49')],{'as':_0x7c5e('0x1a9'),'foreignKey':_0x7c5e('0x159')});db['Interval'][_0x7c5e('0x11d')](db[_0x7c5e('0x52')],{'as':_0x7c5e('0x1aa'),'foreignKey':'IntervalId'});db['Schedule']['belongsTo'](db[_0x7c5e('0x38')],{});db[_0x7c5e('0x8b')][_0x7c5e('0x128')](db[_0x7c5e('0x96')],{'foreignKey':_0x7c5e('0x1ab')});db['Schedule'][_0x7c5e('0x128')](db[_0x7c5e('0x95')],{'foreignKey':'CustomReportId'});db[_0x7c5e('0x150')][_0x7c5e('0x12a')](db[_0x7c5e('0x1a')],{'as':_0x7c5e('0x1ac'),'through':_0x7c5e('0x151'),'onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x176')][_0x7c5e('0x12a')](db[_0x7c5e('0x70')],{'through':_0x7c5e('0x19f')});db['Tag'][_0x7c5e('0x12a')](db[_0x7c5e('0x134')],{'through':_0x7c5e('0x198')});db[_0x7c5e('0x176')][_0x7c5e('0x12a')](db[_0x7c5e('0x3e')],{'through':_0x7c5e('0x177')});db['Tag'][_0x7c5e('0x12a')](db[_0x7c5e('0x54')],{'through':_0x7c5e('0x18b')});db[_0x7c5e('0x176')]['belongsToMany'](db[_0x7c5e('0x4b')],{'through':'fax_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x7c5e('0x5b')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0x7c5e('0x12a')](db[_0x7c5e('0x105')],{'through':'whatsapp_interaction_has_tags'});db[_0x7c5e('0x1ad')][_0x7c5e('0x11d')](db[_0x7c5e('0x82')],{'as':{'plural':_0x7c5e('0x1ae'),'singular':_0x7c5e('0x1af')},'foreignKey':_0x7c5e('0x1b0'),'onDelete':_0x7c5e('0x119'),'hooks':!![]});db[_0x7c5e('0x1ad')][_0x7c5e('0x11d')](db['Condition'],{'as':{'plural':_0x7c5e('0x1b1'),'singular':'AnyCondition'},'foreignKey':_0x7c5e('0x1b2'),'onDelete':_0x7c5e('0x119'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x7c5e('0x7b')],{'as':_0x7c5e('0x1b3'),'foreignKey':_0x7c5e('0x1b4'),'onDelete':_0x7c5e('0x119'),'hooks':!![]});db[_0x7c5e('0x95')][_0x7c5e('0x11d')](db[_0x7c5e('0x9a')],{'as':'Fields','onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1b5'),'hooks':!![]});db[_0x7c5e('0x96')][_0x7c5e('0x11d')](db[_0x7c5e('0x9a')],{'as':_0x7c5e('0x1b6'),'onDelete':'cascade','foreignKey':_0x7c5e('0x1ab')});db[_0x7c5e('0x1b7')]['hasMany'](db[_0x7c5e('0x9a')],{'as':'Fields','onDelete':_0x7c5e('0x119'),'foreignKey':'MetricId'});db['AnalyticFieldReport']['belongsTo'](db[_0x7c5e('0x1b7')],{'foreignKey':_0x7c5e('0x1b8')});db['SalesforceAccount'][_0x7c5e('0x11d')](db[_0x7c5e('0xa0')],{'as':_0x7c5e('0x1b9'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1ba')});db[_0x7c5e('0xa0')]['hasMany'](db[_0x7c5e('0xa2')],{'as':_0x7c5e('0x1bb'),'onDelete':'cascade','foreignKey':_0x7c5e('0x1bc')});db[_0x7c5e('0xa0')][_0x7c5e('0x11d')](db[_0x7c5e('0xa2')],{'as':_0x7c5e('0x1bd'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1be')});db['SalesforceConfiguration'][_0x7c5e('0x11d')](db['SalesforceField'],{'as':_0x7c5e('0x1b6'),'onDelete':'cascade','foreignKey':_0x7c5e('0x1bf')});db[_0x7c5e('0xa0')]['belongsTo'](db[_0x7c5e('0x9e')],{'as':_0x7c5e('0x174'),'foreignKey':_0x7c5e('0x1ba')});db['SalesforceField'][_0x7c5e('0x11d')](db[_0x7c5e('0xa2')],{'as':_0x7c5e('0x1c0'),'foreignKey':_0x7c5e('0x1bc')});db[_0x7c5e('0xa2')]['hasMany'](db[_0x7c5e('0xa2')],{'as':_0x7c5e('0x1c1'),'foreignKey':'DescriptionId'});db['SalesforceField']['hasMany'](db[_0x7c5e('0xa2')],{'as':_0x7c5e('0x1c2'),'foreignKey':_0x7c5e('0x1bf')});db[_0x7c5e('0xa2')][_0x7c5e('0x128')](db[_0x7c5e('0x90')],{'as':_0x7c5e('0x90'),'foreignKey':_0x7c5e('0x1c3')});db['SugarcrmAccount']['hasMany'](db[_0x7c5e('0xa5')],{'as':_0x7c5e('0x1b9'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1ba')});db[_0x7c5e('0xa5')][_0x7c5e('0x11d')](db[_0x7c5e('0xa7')],{'as':_0x7c5e('0x1bb'),'onDelete':'cascade','foreignKey':_0x7c5e('0x1bc')});db['SugarcrmConfiguration']['hasMany'](db[_0x7c5e('0xa7')],{'as':'Descriptions','onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1be')});db[_0x7c5e('0xa5')][_0x7c5e('0x11d')](db[_0x7c5e('0xa7')],{'as':_0x7c5e('0x1b6'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1bf')});db[_0x7c5e('0xa5')][_0x7c5e('0x128')](db[_0x7c5e('0xa3')],{'as':_0x7c5e('0x174'),'foreignKey':_0x7c5e('0x1ba')});db['SugarcrmField'][_0x7c5e('0x11d')](db[_0x7c5e('0xa7')],{'as':_0x7c5e('0x1c0'),'foreignKey':_0x7c5e('0x1bc')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':'Description','foreignKey':_0x7c5e('0x1be')});db[_0x7c5e('0xa7')][_0x7c5e('0x11d')](db['SugarcrmField'],{'as':'Field','foreignKey':_0x7c5e('0x1bf')});db[_0x7c5e('0xa7')][_0x7c5e('0x128')](db[_0x7c5e('0x90')],{'as':_0x7c5e('0x90'),'foreignKey':'VariableId'});db[_0x7c5e('0xa8')][_0x7c5e('0x11d')](db[_0x7c5e('0xaa')],{'as':_0x7c5e('0x1b9'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1ba')});db[_0x7c5e('0xaa')][_0x7c5e('0x11d')](db[_0x7c5e('0xac')],{'as':_0x7c5e('0x1bb'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1bc')});db['DeskConfiguration'][_0x7c5e('0x11d')](db[_0x7c5e('0xac')],{'as':_0x7c5e('0x1bd'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1be')});db[_0x7c5e('0xaa')][_0x7c5e('0x11d')](db[_0x7c5e('0xac')],{'as':'Fields','onDelete':_0x7c5e('0x119'),'foreignKey':'FieldId'});db[_0x7c5e('0xaa')]['belongsTo'](db[_0x7c5e('0xa8')],{'as':_0x7c5e('0x174'),'foreignKey':'AccountId'});db[_0x7c5e('0xaa')][_0x7c5e('0x12a')](db['Tag'],{'through':_0x7c5e('0x1c4')});db[_0x7c5e('0xac')][_0x7c5e('0x11d')](db[_0x7c5e('0xac')],{'as':_0x7c5e('0x1c0'),'foreignKey':_0x7c5e('0x1bc')});db[_0x7c5e('0xac')][_0x7c5e('0x11d')](db[_0x7c5e('0xac')],{'as':_0x7c5e('0x1c1'),'foreignKey':_0x7c5e('0x1be')});db[_0x7c5e('0xac')]['hasMany'](db[_0x7c5e('0xac')],{'as':_0x7c5e('0x1c2'),'foreignKey':_0x7c5e('0x1bf')});db[_0x7c5e('0xac')][_0x7c5e('0x128')](db[_0x7c5e('0x90')],{'as':_0x7c5e('0x90'),'foreignKey':_0x7c5e('0x1c3')});db[_0x7c5e('0x1c5')]['hasMany'](db[_0x7c5e('0xae')],{'as':'Configurations','onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1ba')});db[_0x7c5e('0xae')][_0x7c5e('0x11d')](db[_0x7c5e('0xaf')],{'as':'Subjects','onDelete':_0x7c5e('0x119'),'foreignKey':'SubjectId'});db[_0x7c5e('0xae')][_0x7c5e('0x11d')](db[_0x7c5e('0xaf')],{'as':_0x7c5e('0x1bd'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1be')});db[_0x7c5e('0xae')]['hasMany'](db['ZohoField'],{'as':'Fields','onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1bf')});db['ZohoConfiguration'][_0x7c5e('0x128')](db[_0x7c5e('0x1c5')],{'as':_0x7c5e('0x174'),'foreignKey':'AccountId'});db[_0x7c5e('0xaf')]['hasMany'](db['ZohoField'],{'as':_0x7c5e('0x1c0'),'foreignKey':'SubjectId'});db[_0x7c5e('0xaf')][_0x7c5e('0x11d')](db[_0x7c5e('0xaf')],{'as':_0x7c5e('0x1c1'),'foreignKey':_0x7c5e('0x1be')});db[_0x7c5e('0xaf')][_0x7c5e('0x11d')](db[_0x7c5e('0xaf')],{'as':_0x7c5e('0x1c2'),'foreignKey':'FieldId'});db[_0x7c5e('0xaf')][_0x7c5e('0x128')](db[_0x7c5e('0x90')],{'as':_0x7c5e('0x90'),'foreignKey':'VariableId'});db['ZendeskAccount'][_0x7c5e('0x11d')](db['ZendeskConfiguration'],{'as':_0x7c5e('0x1b9'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1ba')});db['ZendeskConfiguration'][_0x7c5e('0x11d')](db['ZendeskField'],{'as':_0x7c5e('0x1bb'),'foreignKey':_0x7c5e('0x1bc')});db[_0x7c5e('0x1c6')][_0x7c5e('0x11d')](db[_0x7c5e('0xb3')],{'as':_0x7c5e('0x1bd'),'foreignKey':_0x7c5e('0x1be')});db[_0x7c5e('0x1c6')][_0x7c5e('0x11d')](db[_0x7c5e('0xb3')],{'as':_0x7c5e('0x1b6'),'foreignKey':_0x7c5e('0x1bf')});db[_0x7c5e('0x1c6')]['belongsTo'](db[_0x7c5e('0xb0')],{'as':_0x7c5e('0x174'),'foreignKey':_0x7c5e('0x1ba')});db[_0x7c5e('0x1c6')][_0x7c5e('0x12a')](db[_0x7c5e('0x176')],{'through':_0x7c5e('0x1c7')});db[_0x7c5e('0xb3')][_0x7c5e('0x11d')](db[_0x7c5e('0xb3')],{'as':'Subject','foreignKey':_0x7c5e('0x1bc')});db[_0x7c5e('0xb3')][_0x7c5e('0x11d')](db[_0x7c5e('0xb3')],{'as':'Description','foreignKey':_0x7c5e('0x1be')});db[_0x7c5e('0xb3')][_0x7c5e('0x11d')](db['ZendeskField'],{'as':'Field','foreignKey':_0x7c5e('0x1bf')});db[_0x7c5e('0xb3')][_0x7c5e('0x128')](db[_0x7c5e('0x90')],{'as':_0x7c5e('0x90'),'foreignKey':_0x7c5e('0x1c3')});db[_0x7c5e('0xb5')]['hasMany'](db[_0x7c5e('0xb7')],{'as':_0x7c5e('0x1b9'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x7c5e('0xb7')]['hasMany'](db[_0x7c5e('0xb8')],{'as':_0x7c5e('0x1bb'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1bc')});db[_0x7c5e('0xb7')][_0x7c5e('0x11d')](db['FreshdeskField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x7c5e('0xb7')][_0x7c5e('0x11d')](db[_0x7c5e('0xb8')],{'as':_0x7c5e('0x1b6'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1bf')});db[_0x7c5e('0xb7')][_0x7c5e('0x128')](db[_0x7c5e('0xb5')],{'as':_0x7c5e('0x174'),'foreignKey':_0x7c5e('0x1ba')});db[_0x7c5e('0xb7')]['belongsToMany'](db[_0x7c5e('0x176')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x7c5e('0xb8')][_0x7c5e('0x11d')](db[_0x7c5e('0xb8')],{'as':_0x7c5e('0x1c0'),'foreignKey':_0x7c5e('0x1bc')});db[_0x7c5e('0xb8')]['hasMany'](db['FreshdeskField'],{'as':_0x7c5e('0x1c1'),'foreignKey':'DescriptionId'});db[_0x7c5e('0xb8')][_0x7c5e('0x11d')](db['FreshdeskField'],{'as':_0x7c5e('0x1c2'),'foreignKey':'FieldId'});db[_0x7c5e('0xb8')]['belongsTo'](db[_0x7c5e('0x90')],{'as':_0x7c5e('0x90'),'foreignKey':_0x7c5e('0x1c3')});db[_0x7c5e('0xba')][_0x7c5e('0x11d')](db[_0x7c5e('0x1c8')],{'as':_0x7c5e('0x1b9'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x7c5e('0x1c8')][_0x7c5e('0x11d')](db[_0x7c5e('0x1c9')],{'as':'Subjects','foreignKey':_0x7c5e('0x1bc')});db[_0x7c5e('0x1c8')][_0x7c5e('0x11d')](db[_0x7c5e('0x1c9')],{'as':_0x7c5e('0x1bd'),'foreignKey':'DescriptionId'});db[_0x7c5e('0x1c8')]['hasMany'](db[_0x7c5e('0x1c9')],{'as':_0x7c5e('0x1b6'),'foreignKey':_0x7c5e('0x1bf')});db[_0x7c5e('0x1c8')][_0x7c5e('0x128')](db[_0x7c5e('0xba')],{'as':_0x7c5e('0x174'),'foreignKey':_0x7c5e('0x1ba')});db[_0x7c5e('0x1c9')][_0x7c5e('0x11d')](db['VtigerField'],{'as':_0x7c5e('0x1c0'),'foreignKey':'SubjectId'});db[_0x7c5e('0x1c9')][_0x7c5e('0x11d')](db[_0x7c5e('0x1c9')],{'as':_0x7c5e('0x1c1'),'foreignKey':'DescriptionId'});db[_0x7c5e('0x1c9')][_0x7c5e('0x11d')](db[_0x7c5e('0x1c9')],{'as':_0x7c5e('0x1c2'),'foreignKey':_0x7c5e('0x1bf')});db['VtigerField'][_0x7c5e('0x128')](db['Variable'],{'as':_0x7c5e('0x90'),'foreignKey':_0x7c5e('0x1c3')});db[_0x7c5e('0xbe')][_0x7c5e('0x11d')](db[_0x7c5e('0x1ca')],{'as':_0x7c5e('0x1b9'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1ba')});db['ServicenowConfiguration'][_0x7c5e('0x11d')](db[_0x7c5e('0xc1')],{'as':_0x7c5e('0x1bb'),'foreignKey':'SubjectId'});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':'Descriptions','foreignKey':_0x7c5e('0x1be')});db[_0x7c5e('0x1ca')][_0x7c5e('0x11d')](db[_0x7c5e('0xc1')],{'as':_0x7c5e('0x1b6'),'foreignKey':_0x7c5e('0x1bf')});db[_0x7c5e('0x1ca')]['belongsTo'](db[_0x7c5e('0xbe')],{'as':_0x7c5e('0x174'),'foreignKey':'AccountId'});db[_0x7c5e('0xc1')][_0x7c5e('0x11d')](db['ServicenowField'],{'as':_0x7c5e('0x1c0'),'foreignKey':'SubjectId'});db[_0x7c5e('0xc1')]['hasMany'](db[_0x7c5e('0xc1')],{'as':_0x7c5e('0x1c1'),'foreignKey':_0x7c5e('0x1be')});db['ServicenowField']['hasMany'](db[_0x7c5e('0xc1')],{'as':_0x7c5e('0x1c2'),'foreignKey':'FieldId'});db[_0x7c5e('0xc1')][_0x7c5e('0x128')](db[_0x7c5e('0x90')],{'as':_0x7c5e('0x90'),'foreignKey':_0x7c5e('0x1c3')});db['Dynamics365Account'][_0x7c5e('0x11d')](db[_0x7c5e('0xc4')],{'as':_0x7c5e('0x1b9'),'onDelete':_0x7c5e('0x119'),'foreignKey':'AccountId'});db[_0x7c5e('0xc4')][_0x7c5e('0x11d')](db[_0x7c5e('0xc6')],{'as':_0x7c5e('0x1bb'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1bc')});db[_0x7c5e('0xc4')][_0x7c5e('0x11d')](db[_0x7c5e('0xc6')],{'as':_0x7c5e('0x1bd'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1be')});db['Dynamics365Configuration'][_0x7c5e('0x11d')](db[_0x7c5e('0xc6')],{'as':_0x7c5e('0x1b6'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1bf')});db[_0x7c5e('0xc4')]['belongsTo'](db[_0x7c5e('0xc2')],{'as':_0x7c5e('0x174'),'foreignKey':'AccountId'});db[_0x7c5e('0xc6')][_0x7c5e('0x11d')](db[_0x7c5e('0xc6')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x7c5e('0xc6')][_0x7c5e('0x11d')](db['Dynamics365Field'],{'as':'Description','foreignKey':_0x7c5e('0x1be')});db[_0x7c5e('0xc6')][_0x7c5e('0x11d')](db[_0x7c5e('0xc6')],{'as':'Field','foreignKey':_0x7c5e('0x1bf')});db[_0x7c5e('0xc6')][_0x7c5e('0x128')](db[_0x7c5e('0x90')],{'as':_0x7c5e('0x90'),'foreignKey':'VariableId'});db[_0x7c5e('0xc8')][_0x7c5e('0x11d')](db[_0x7c5e('0xca')],{'as':'Configurations','onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1ba')});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x7c5e('0x1bc')});db[_0x7c5e('0xca')][_0x7c5e('0x11d')](db['FreshsalesField'],{'as':_0x7c5e('0x1bd'),'foreignKey':_0x7c5e('0x1be')});db[_0x7c5e('0xca')][_0x7c5e('0x11d')](db['FreshsalesField'],{'as':_0x7c5e('0x1b6'),'foreignKey':_0x7c5e('0x1bf')});db[_0x7c5e('0xca')][_0x7c5e('0x128')](db[_0x7c5e('0xc8')],{'as':'Account','foreignKey':_0x7c5e('0x1ba')});db[_0x7c5e('0x1cb')][_0x7c5e('0x11d')](db['FreshsalesField'],{'as':_0x7c5e('0x1c0'),'foreignKey':_0x7c5e('0x1bc')});db[_0x7c5e('0x1cb')][_0x7c5e('0x11d')](db[_0x7c5e('0x1cb')],{'as':'Description','foreignKey':_0x7c5e('0x1be')});db['FreshsalesField'][_0x7c5e('0x11d')](db[_0x7c5e('0x1cb')],{'as':_0x7c5e('0x1c2'),'foreignKey':_0x7c5e('0x1bf')});db[_0x7c5e('0x1cb')]['belongsTo'](db[_0x7c5e('0x90')],{'as':_0x7c5e('0x90'),'foreignKey':_0x7c5e('0x1c3')});db['ChatQueueReport']['belongsTo'](db[_0x7c5e('0x5f')],{});db[_0x7c5e('0xd0')]['belongsTo'](db['CmList'],{'as':_0x7c5e('0x17e'),'foreignKey':_0x7c5e('0x170')});db[_0x7c5e('0xd0')]['belongsTo'](db[_0x7c5e('0x70')],{'as':'Contact','foreignKey':_0x7c5e('0x188')});db[_0x7c5e('0xd0')][_0x7c5e('0x128')](db[_0x7c5e('0x134')],{});db['ChatQueueReport']['belongsTo'](db[_0x7c5e('0x66')],{});db[_0x7c5e('0xd0')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{});db[_0x7c5e('0xd0')][_0x7c5e('0x128')](db[_0x7c5e('0x6a')],{});db[_0x7c5e('0xd2')]['belongsTo'](db[_0x7c5e('0x114')],{'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1cc')});db[_0x7c5e('0xd2')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1cd')});db[_0x7c5e('0xd6')][_0x7c5e('0x11d')](db[_0x7c5e('0xd4')],{'foreignKey':'SessionId','onDelete':_0x7c5e('0x119')});db[_0x7c5e('0xd6')][_0x7c5e('0x11d')](db[_0x7c5e('0x1ce')],{'foreignKey':'SessionId','onDelete':_0x7c5e('0x119')});db[_0x7c5e('0xd8')][_0x7c5e('0x128')](db[_0x7c5e('0x50')],{});db[_0x7c5e('0xd8')][_0x7c5e('0x128')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['SmsQueueReport'][_0x7c5e('0x128')](db[_0x7c5e('0x70')],{'as':_0x7c5e('0x166'),'foreignKey':'ContactId'});db[_0x7c5e('0xd8')][_0x7c5e('0x128')](db['SmsInteraction'],{});db[_0x7c5e('0xd8')][_0x7c5e('0x128')](db[_0x7c5e('0x55')],{});db['SmsQueueReport']['belongsTo'](db[_0x7c5e('0x114')],{});db[_0x7c5e('0xd8')][_0x7c5e('0x128')](db[_0x7c5e('0x57')],{});db[_0x7c5e('0xdd')][_0x7c5e('0x11d')](db[_0x7c5e('0xd6')],{'foreignKey':_0x7c5e('0x1cf')});db[_0x7c5e('0xdd')]['hasMany'](db[_0x7c5e('0xd4')],{'foreignKey':_0x7c5e('0x1cf')});db['JscriptyProject'][_0x7c5e('0x11d')](db['JscriptyAnswerReport'],{'foreignKey':_0x7c5e('0x1cf')});db[_0x7c5e('0xe3')][_0x7c5e('0x12a')](db['User'],{'as':_0x7c5e('0x17a'),'through':_0x7c5e('0x14d')});db[_0x7c5e('0x131')][_0x7c5e('0x12a')](db[_0x7c5e('0x114')],{'as':'Agents','through':_0x7c5e('0x132')});db['Team'][_0x7c5e('0x12a')](db[_0x7c5e('0x1b')],{'through':_0x7c5e('0x15c'),'as':_0x7c5e('0x1d0')});db[_0x7c5e('0x131')]['belongsToMany'](db[_0x7c5e('0x3a')],{'through':_0x7c5e('0x1d1'),'as':_0x7c5e('0x13b')});db[_0x7c5e('0x131')]['belongsToMany'](db['ChatQueue'],{'through':_0x7c5e('0x199'),'as':'ChatQueues'});db[_0x7c5e('0x131')][_0x7c5e('0x12a')](db[_0x7c5e('0x4e')],{'through':_0x7c5e('0x187'),'as':'FaxQueues'});db[_0x7c5e('0x131')][_0x7c5e('0x12a')](db[_0x7c5e('0x57')],{'through':_0x7c5e('0x18c'),'as':_0x7c5e('0x13e')});db[_0x7c5e('0x131')]['belongsToMany'](db[_0x7c5e('0x140')],{'through':_0x7c5e('0x192'),'as':'OpenchannelQueues'});db[_0x7c5e('0x131')][_0x7c5e('0x12a')](db[_0x7c5e('0x10b')],{'through':_0x7c5e('0x1d2'),'as':_0x7c5e('0x1d3')});db[_0x7c5e('0x131')][_0x7c5e('0x12a')](db['VoicePrefix'],{'through':_0x7c5e('0x10e'),'as':_0x7c5e('0x13a')});db[_0x7c5e('0x1a0')]['hasMany'](db[_0x7c5e('0x72')],{'as':_0x7c5e('0x153'),'foreignKey':_0x7c5e('0x1a2')});db[_0x7c5e('0x1a0')][_0x7c5e('0x11d')](db[_0x7c5e('0x76')],{'as':_0x7c5e('0x11f'),'foreignKey':_0x7c5e('0x1a2')});db[_0x7c5e('0x1a0')]['hasMany'](db[_0x7c5e('0x120')],{'as':_0x7c5e('0x154'),'foreignKey':_0x7c5e('0x1a2')});db[_0x7c5e('0x1a0')]['hasMany'](db['CmHopperBlack'],{'as':_0x7c5e('0x1d4'),'foreignKey':'CampaignId'});db[_0x7c5e('0x1a0')][_0x7c5e('0x128')](db[_0x7c5e('0x156')],{'as':'Trunk','foreignKey':_0x7c5e('0x157')});db[_0x7c5e('0x1a0')][_0x7c5e('0x128')](db[_0x7c5e('0x156')],{'as':_0x7c5e('0x1d5'),'foreignKey':_0x7c5e('0x158')});db[_0x7c5e('0x1a0')][_0x7c5e('0x128')](db['Interval'],{'as':_0x7c5e('0x84'),'foreignKey':'IntervalId'});db[_0x7c5e('0x1a0')]['belongsTo'](db['SquareProject'],{'as':_0x7c5e('0xe3'),'foreignKey':_0x7c5e('0x1d6')});db[_0x7c5e('0x1a0')][_0x7c5e('0x12a')](db['CmList'],{'as':_0x7c5e('0x12f'),'through':_0x7c5e('0x1d7')});db[_0x7c5e('0x1a0')]['belongsToMany'](db[_0x7c5e('0xfa')],{'as':'BlackLists','through':_0x7c5e('0x1d8')});db['Attachment']['belongsTo'](db[_0x7c5e('0x68')],{'as':_0x7c5e('0x68'),'foreignKey':_0x7c5e('0x17c')});db[_0x7c5e('0xf0')][_0x7c5e('0x128')](db[_0x7c5e('0x40')],{});db[_0x7c5e('0xf0')][_0x7c5e('0x128')](db[_0x7c5e('0x3e')],{});db['MailTransferReport']['belongsTo'](db[_0x7c5e('0x38')],{'foreignKey':_0x7c5e('0x1d9'),'as':_0x7c5e('0x1da')});db['MailTransferReport'][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'foreignKey':_0x7c5e('0x1db'),'as':'FromAgent'});db[_0x7c5e('0xf0')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'foreignKey':'ToUserId','as':_0x7c5e('0x1dc')});db[_0x7c5e('0xf0')][_0x7c5e('0x128')](db[_0x7c5e('0x3a')],{'foreignKey':_0x7c5e('0x1dd'),'as':'ToQueue'});db[_0x7c5e('0xf0')][_0x7c5e('0x128')](db[_0x7c5e('0x38')],{'foreignKey':_0x7c5e('0x1de'),'as':_0x7c5e('0x1df')});db[_0x7c5e('0xf2')][_0x7c5e('0x128')](db[_0x7c5e('0x66')],{});db[_0x7c5e('0xf2')][_0x7c5e('0x128')](db[_0x7c5e('0x134')],{});db[_0x7c5e('0xf2')][_0x7c5e('0x128')](db[_0x7c5e('0x5f')],{'foreignKey':_0x7c5e('0x1e0'),'as':_0x7c5e('0x1da')});db[_0x7c5e('0xf2')][_0x7c5e('0x128')](db['User'],{'foreignKey':'FromUserId','as':_0x7c5e('0x1e1')});db['ChatTransferReport']['belongsTo'](db[_0x7c5e('0x114')],{'foreignKey':_0x7c5e('0x1e2'),'as':_0x7c5e('0x1dc')});db[_0x7c5e('0xf2')][_0x7c5e('0x128')](db[_0x7c5e('0x6a')],{'foreignKey':_0x7c5e('0x1e3'),'as':_0x7c5e('0x1e4')});db[_0x7c5e('0xf2')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x7c5e('0x1e5'),'as':_0x7c5e('0x1df')});db['FaxTransferReport'][_0x7c5e('0x128')](db[_0x7c5e('0x4c')],{});db['FaxTransferReport'][_0x7c5e('0x128')](db[_0x7c5e('0x4b')],{});db[_0x7c5e('0xf4')]['belongsTo'](db[_0x7c5e('0x47')],{'foreignKey':_0x7c5e('0x1e6'),'as':_0x7c5e('0x1da')});db[_0x7c5e('0xf4')]['belongsTo'](db[_0x7c5e('0x114')],{'foreignKey':_0x7c5e('0x1db'),'as':_0x7c5e('0x1e1')});db[_0x7c5e('0xf4')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'foreignKey':_0x7c5e('0x1e2'),'as':_0x7c5e('0x1dc')});db[_0x7c5e('0xf4')][_0x7c5e('0x128')](db[_0x7c5e('0x4e')],{'foreignKey':_0x7c5e('0x1e7'),'as':_0x7c5e('0x1e4')});db[_0x7c5e('0xf4')]['belongsTo'](db[_0x7c5e('0x47')],{'foreignKey':_0x7c5e('0x1e8'),'as':_0x7c5e('0x1df')});db[_0x7c5e('0xf6')]['belongsTo'](db[_0x7c5e('0x5d')],{});db['OpenchannelTransferReport'][_0x7c5e('0x128')](db['OpenchannelInteraction'],{});db[_0x7c5e('0xf6')]['belongsTo'](db[_0x7c5e('0x18d')],{'foreignKey':_0x7c5e('0x1e9'),'as':'FromAccount'});db[_0x7c5e('0xf6')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'foreignKey':'FromUserId','as':_0x7c5e('0x1e1')});db[_0x7c5e('0xf6')][_0x7c5e('0x128')](db['User'],{'foreignKey':_0x7c5e('0x1e2'),'as':_0x7c5e('0x1dc')});db[_0x7c5e('0xf6')][_0x7c5e('0x128')](db['OpenchannelQueue'],{'foreignKey':_0x7c5e('0x1ea'),'as':_0x7c5e('0x1e4')});db[_0x7c5e('0xf6')][_0x7c5e('0x128')](db[_0x7c5e('0x18d')],{'foreignKey':_0x7c5e('0x1eb'),'as':_0x7c5e('0x1df')});db[_0x7c5e('0xf8')][_0x7c5e('0x128')](db[_0x7c5e('0x55')],{});db['SmsTransferReport'][_0x7c5e('0x128')](db[_0x7c5e('0x54')],{});db['SmsTransferReport']['belongsTo'](db['SmsAccount'],{'foreignKey':_0x7c5e('0x1ec'),'as':_0x7c5e('0x1da')});db[_0x7c5e('0xf8')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'foreignKey':_0x7c5e('0x1db'),'as':_0x7c5e('0x1e1')});db[_0x7c5e('0xf8')]['belongsTo'](db[_0x7c5e('0x114')],{'foreignKey':_0x7c5e('0x1e2'),'as':'ToAgent'});db[_0x7c5e('0xf8')]['belongsTo'](db['SmsQueue'],{'foreignKey':_0x7c5e('0x1ed'),'as':_0x7c5e('0x1e4')});db[_0x7c5e('0xf8')][_0x7c5e('0x128')](db[_0x7c5e('0x50')],{'foreignKey':_0x7c5e('0x1ee'),'as':'ToAccount'});db['CmList'][_0x7c5e('0x11d')](db['Disposition'],{'as':_0x7c5e('0x16d'),'foreignKey':_0x7c5e('0x170'),'onDelete':_0x7c5e('0x119')});db[_0x7c5e('0xfa')]['hasMany'](db[_0x7c5e('0x1ef')],{'as':_0x7c5e('0x1f0'),'foreignKey':'ListId'});db[_0x7c5e('0xfa')][_0x7c5e('0x11d')](db[_0x7c5e('0x70')],{'as':_0x7c5e('0x12d'),'onDelete':_0x7c5e('0x119'),'foreignKey':'ListId'});db[_0x7c5e('0xfa')]['hasMany'](db['CmHopperFinal'],{'as':_0x7c5e('0x11f'),'foreignKey':'ListId'});db[_0x7c5e('0xfa')][_0x7c5e('0x11d')](db[_0x7c5e('0x120')],{'as':_0x7c5e('0x121'),'foreignKey':_0x7c5e('0x170')});db[_0x7c5e('0xfa')][_0x7c5e('0x11d')](db[_0x7c5e('0x79')],{'as':_0x7c5e('0x79'),'foreignKey':_0x7c5e('0x170')});db[_0x7c5e('0xfa')][_0x7c5e('0x12a')](db[_0x7c5e('0x1b')],{'as':_0x7c5e('0x1f1'),'through':_0x7c5e('0x1f2')});db[_0x7c5e('0xfa')]['belongsToMany'](db['User'],{'as':_0x7c5e('0x15a'),'through':_0x7c5e('0x130')});db['VoicePrefix']['hasMany'](db[_0x7c5e('0x14e')],{'as':_0x7c5e('0x11e'),'onDelete':_0x7c5e('0x119')});db['VoicePrefix'][_0x7c5e('0x12a')](db[_0x7c5e('0x114')],{'as':_0x7c5e('0x15a'),'through':_0x7c5e('0x110')});db[_0x7c5e('0xfc')][_0x7c5e('0x12a')](db[_0x7c5e('0x131')],{'through':'TeamVoicePrefix','as':_0x7c5e('0x15b')});db[_0x7c5e('0x129')][_0x7c5e('0x11d')](db['User'],{'as':'Users','foreignKey':_0x7c5e('0x1f3')});db[_0x7c5e('0x129')][_0x7c5e('0x11d')](db[_0x7c5e('0xfe')],{'as':_0x7c5e('0x1f4'),'foreignKey':_0x7c5e('0x1f3'),'onDelete':_0x7c5e('0x119')});db[_0x7c5e('0xfe')]['hasMany'](db[_0x7c5e('0xff')],{'as':_0x7c5e('0x1f5'),'foreignKey':_0x7c5e('0x1f6'),'onDelete':_0x7c5e('0x119')});db[_0x7c5e('0x102')][_0x7c5e('0x11d')](db['Disposition'],{'as':_0x7c5e('0x16d'),'foreignKey':_0x7c5e('0x1f7'),'onDelete':_0x7c5e('0x119')});db[_0x7c5e('0x102')][_0x7c5e('0x11d')](db[_0x7c5e('0x7f')],{'as':_0x7c5e('0x182'),'foreignKey':'WhatsappAccountId'});db[_0x7c5e('0x102')][_0x7c5e('0x11d')](db[_0x7c5e('0x106')],{'as':_0x7c5e('0x160'),'foreignKey':_0x7c5e('0x1f7')});db[_0x7c5e('0x102')]['hasMany'](db[_0x7c5e('0x105')],{'as':'Interactions'});db[_0x7c5e('0x102')][_0x7c5e('0x11d')](db['WhatsappApplication'],{'as':_0x7c5e('0x16f')});db[_0x7c5e('0x102')][_0x7c5e('0x128')](db['CmList'],{'as':_0x7c5e('0x17e'),'foreignKey':_0x7c5e('0x170')});db[_0x7c5e('0x102')][_0x7c5e('0x128')](db[_0x7c5e('0x86')],{'as':_0x7c5e('0x171'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x7c5e('0x102')][_0x7c5e('0x12a')](db['User'],{'as':'Agents','through':'user_has_whatsapp_accounts'});db[_0x7c5e('0x104')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x104')][_0x7c5e('0x128')](db[_0x7c5e('0x10b')],{'onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x104')][_0x7c5e('0x128')](db[_0x7c5e('0x102')],{'onDelete':_0x7c5e('0x169')});db[_0x7c5e('0x104')][_0x7c5e('0x128')](db[_0x7c5e('0x84')],{'onDelete':'restrict','foreignKey':_0x7c5e('0x159')});db[_0x7c5e('0x104')][_0x7c5e('0x128')](db[_0x7c5e('0x176')],{'onDelete':_0x7c5e('0x169'),'foreignKey':_0x7c5e('0x17d')});db[_0x7c5e('0x105')][_0x7c5e('0x11d')](db['WhatsappMessage'],{'as':_0x7c5e('0x160'),'onDelete':_0x7c5e('0x119'),'foreignKey':_0x7c5e('0x1f8')});db['WhatsappInteraction'][_0x7c5e('0x128')](db['WhatsappAccount'],{'as':_0x7c5e('0x174'),'foreignKey':'WhatsappAccountId'});db[_0x7c5e('0x105')][_0x7c5e('0x128')](db['CmContact'],{'as':_0x7c5e('0x166'),'foreignKey':'ContactId'});db[_0x7c5e('0x105')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'as':'Owner','foreignKey':'UserId'});db['WhatsappInteraction'][_0x7c5e('0x12a')](db['Tag'],{'through':_0x7c5e('0x1f9'),'as':_0x7c5e('0x178')});db['WhatsappInteraction']['belongsToMany'](db['Tag'],{'through':_0x7c5e('0x1f9'),'as':_0x7c5e('0x179')});db['WhatsappInteraction']['belongsToMany'](db['User'],{'as':'Users','through':_0x7c5e('0x1fa'),'foreignKey':_0x7c5e('0x1f8')});db['WhatsappMessage']['belongsTo'](db['User'],{'as':_0x7c5e('0x114')});db[_0x7c5e('0x106')][_0x7c5e('0x128')](db['CmContact'],{'onDelete':_0x7c5e('0x119'),'as':_0x7c5e('0x166')});db[_0x7c5e('0x106')][_0x7c5e('0x128')](db[_0x7c5e('0x105')],{'onDelete':'cascade','as':_0x7c5e('0x185'),'foreignKey':_0x7c5e('0x1f8')});db['WhatsappMessage'][_0x7c5e('0x128')](db[_0x7c5e('0x102')],{'as':_0x7c5e('0x174'),'foreignKey':_0x7c5e('0x1f7')});db[_0x7c5e('0x107')][_0x7c5e('0x128')](db['WhatsappAccount'],{});db[_0x7c5e('0x107')]['belongsTo'](db[_0x7c5e('0xfa')],{'as':_0x7c5e('0x17e'),'foreignKey':_0x7c5e('0x170')});db[_0x7c5e('0x107')][_0x7c5e('0x128')](db[_0x7c5e('0x70')],{'as':_0x7c5e('0x166'),'foreignKey':_0x7c5e('0x188')});db[_0x7c5e('0x107')][_0x7c5e('0x128')](db[_0x7c5e('0x105')],{});db[_0x7c5e('0x107')][_0x7c5e('0x128')](db[_0x7c5e('0x10b')],{});db[_0x7c5e('0x107')]['belongsTo'](db[_0x7c5e('0x106')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x7c5e('0x114')],{});db[_0x7c5e('0x109')][_0x7c5e('0x128')](db[_0x7c5e('0x106')],{});db['WhatsappTransferReport'][_0x7c5e('0x128')](db[_0x7c5e('0x105')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x7c5e('0x102')],{'foreignKey':_0x7c5e('0x1fb'),'as':'FromAccount'});db[_0x7c5e('0x109')][_0x7c5e('0x128')](db['WhatsappAccount'],{'foreignKey':_0x7c5e('0x1fc'),'as':'ToAccount'});db[_0x7c5e('0x109')][_0x7c5e('0x128')](db[_0x7c5e('0x10b')],{'foreignKey':_0x7c5e('0x1fd'),'as':'ToQueue'});db['WhatsappTransferReport'][_0x7c5e('0x128')](db['User'],{'foreignKey':_0x7c5e('0x1db'),'as':'FromAgent'});db[_0x7c5e('0x109')][_0x7c5e('0x128')](db[_0x7c5e('0x114')],{'foreignKey':_0x7c5e('0x1e2'),'as':_0x7c5e('0x1dc')});db['WhatsappQueue'][_0x7c5e('0x12a')](db['User'],{'as':_0x7c5e('0x15a'),'through':_0x7c5e('0x34'),'foreignKey':_0x7c5e('0x1fe')});db['WhatsappQueue'][_0x7c5e('0x12a')](db[_0x7c5e('0x131')],{'through':'team_has_whatsapp_queues','as':_0x7c5e('0x15b')});db['UserSetting']['belongsTo'](db['User'],{'as':_0x7c5e('0x1ff'),'foreignKey':_0x7c5e('0x117'),'onDelete':'cascade','hooks':!![]});db[_0x7c5e('0x168')]['hasOne'](db[_0x7c5e('0x35')],{'as':'Imap','onDelete':_0x7c5e('0x169')});db['CloudProvider'][_0x7c5e('0x115')](db['MailServerOut'],{'as':_0x7c5e('0x16c'),'onDelete':_0x7c5e('0x169')});module[_0x7c5e('0x200')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xaac8=['Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','hasOne','cascade','UserId','hasMany','Recordings','UserVoiceQueueRt','VoiceExtension','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','SenderId','belongsTo','belongsToMany','Groups','CmContact','cm_user_has_contacts','cm_user_has_lists','Team','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','UserVoicePrefix','ChatQueues','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueue','WhatsappQueues','user_has_chat_websites','FaxAccount','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','Interval','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Answers','MailMessage','Interactions','List','TemplateId','Pause','MailInteractionId','Account','Owner','mail_interaction_has_tags','ThroughTags','Attachment','Attachments','ChatWebsiteId','IntervalId','TagId','Items','Dispositions','FaxAccountId','Exntensions','ListId','FaxApplication','fax_interaction_has_tags','Tags','FaxInteractionId','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','Users','SmsQueueId','OpenchannelAccountId','OpenchannelInteraction','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','ChatMessage','Agent','ChatApplication','ChatQueue','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','chat_group_has_users','Contacts','CompanyId','Hoppers','CmCompany','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','ParentId','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','Trigger','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Description','Field','VariableId','SugarcrmConfiguration','int_desk_configuration_has_tags','ZohoField','ZendeskConfiguration','int_freshdesk_configuration_has_tags','FreshsalesAccount','ChatQueueReport','FromId','SessionId','ProjectId','user_has_teams','team_has_sms_queues','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','Lists','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromAccount','FromUserId','FromAgent','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsQueueId','ToSmsAccountId','Queues','userProfileId','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','username','password','database','options','User','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','VoiceTransferReport','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatOfflineMessage','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','CmCustomField','Action','../api/action/action.model','Automation','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','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','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model'];(function(_0xa76112,_0x3e48ae){var _0x597fd1=function(_0x5c0002){while(--_0x5c0002){_0xa76112['push'](_0xa76112['shift']());}};_0x597fd1(++_0x3e48ae);}(_0xaac8,0x118));var _0x8aac=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xaac8[_0x47fd36];return _0x21a0fc;};'use strict';var config=require(_0x8aac('0x0'));var Sequelize=require(_0x8aac('0x1'));var _=require(_0x8aac('0x2'));var jstz=require(_0x8aac('0x3'));var timezone=jstz[_0x8aac('0x4')]();config[_0x8aac('0x1')]=_[_0x8aac('0x5')](config[_0x8aac('0x1')],{'database':'motion2','username':'xcall','password':_0x8aac('0x6'),'options':{'host':_0x8aac('0x7'),'port':0xcea,'dialect':_0x8aac('0x8'),'dialectOptions':{'charset':_0x8aac('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x8aac('0xa'),'collate':_0x8aac('0xb')}}});config[_0x8aac('0xc')]=_[_0x8aac('0x5')](config[_0x8aac('0xc')],{'database':'motion2','username':'xcall','password':_0x8aac('0x6'),'options':{'host':_0x8aac('0x7'),'port':0xcea,'dialect':_0x8aac('0x8'),'dialectOptions':{'charset':_0x8aac('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x8aac('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8aac('0x1')]['database'],config[_0x8aac('0x1')][_0x8aac('0xd')],config['sequelize'][_0x8aac('0xe')],config[_0x8aac('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8aac('0xc')][_0x8aac('0xf')],config[_0x8aac('0xc')][_0x8aac('0xd')],config[_0x8aac('0xc')][_0x8aac('0xe')],config['sequelizeHistory'][_0x8aac('0x10')])};db[_0x8aac('0x11')]=db['sequelize'][_0x8aac('0x12')]('../api/user/user.model');db['VoiceChanSpy']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x13'));db[_0x8aac('0x14')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x15'));db['VoiceExtension']=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x8aac('0x16')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x17'));db[_0x8aac('0x18')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x19'));db['ScreenRecording']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x1a'));db[_0x8aac('0x1b')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x1c'));db[_0x8aac('0x1d')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x8aac('0x1e')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x1f'));db[_0x8aac('0x20')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x21'));db[_0x8aac('0x22')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x23'));db[_0x8aac('0x24')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x25'));db[_0x8aac('0x26')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/memberReport/memberReport.model');db[_0x8aac('0x27')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/trunk/trunk.model');db[_0x8aac('0x28')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x29'));db[_0x8aac('0x2a')]=db[_0x8aac('0x1')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0x8aac('0x2b')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/userChatQueue/userChatQueue.model');db[_0x8aac('0x2c')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x2d'));db['UserFaxQueue']=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x2e'));db[_0x8aac('0x2f')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x30'));db[_0x8aac('0x31')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x8aac('0x32')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x33'));db[_0x8aac('0x34')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x35'));db[_0x8aac('0x36')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x37'));db['MailAccount']=db[_0x8aac('0x1')]['import'](_0x8aac('0x38'));db[_0x8aac('0x39')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x3a'));db[_0x8aac('0x3b')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x3c'));db[_0x8aac('0x3d')]=db['sequelize']['import'](_0x8aac('0x3e'));db['MailMessage']=db['sequelize']['import'](_0x8aac('0x3f'));db[_0x8aac('0x40')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x41'));db[_0x8aac('0x42')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x43'));db[_0x8aac('0x44')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x45'));db[_0x8aac('0x46')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x47'));db['FaxAccount']=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/faxApplication/faxApplication.model');db[_0x8aac('0x48')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x49'));db[_0x8aac('0x4a')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x4b'));db[_0x8aac('0x4c')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x4d'));db[_0x8aac('0x4e')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x4f'));db[_0x8aac('0x50')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x51'));db[_0x8aac('0x52')]=db['sequelize']['import'](_0x8aac('0x53'));db[_0x8aac('0x54')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x55'));db[_0x8aac('0x56')]=db['sequelize'][_0x8aac('0x12')]('../api/smsMessage/smsMessage.model');db[_0x8aac('0x57')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x58'));db[_0x8aac('0x59')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x5a'));db['OpenchannelApplication']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x5b'));db['OpenchannelInteraction']=db[_0x8aac('0x1')]['import'](_0x8aac('0x5c'));db[_0x8aac('0x5d')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x5e'));db['OpenchannelQueue']=db[_0x8aac('0x1')]['import'](_0x8aac('0x5f'));db[_0x8aac('0x60')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x61'));db[_0x8aac('0x62')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x63'));db['ChatInteraction']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x64'));db['ChatMessage']=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/chatMessage/chatMessage.model');db[_0x8aac('0x65')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0x8aac('0x1')]['import'](_0x8aac('0x66'));db[_0x8aac('0x67')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x68'));db[_0x8aac('0x69')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x6a'));db['CmCompany']=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x6b'));db['CmContact']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x6c'));db[_0x8aac('0x6d')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/cmHopper/cmHopper.model');db[_0x8aac('0x6e')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x6f'));db[_0x8aac('0x70')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x71'));db['CmHopperHistory']=db[_0x8aac('0x1')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0x8aac('0x72')]=db[_0x8aac('0x1')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0x8aac('0x73')]=db['sequelize'][_0x8aac('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x8aac('0x74')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x75'));db[_0x8aac('0x76')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/automation/automation.model');db[_0x8aac('0x77')]=db['sequelize'][_0x8aac('0x12')]('../api/cannedAnswer/cannedAnswer.model');db[_0x8aac('0x78')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x79'));db[_0x8aac('0x7a')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x7b'));db['Interval']=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x7c'));db['Pause']=db[_0x8aac('0x1')]['import'](_0x8aac('0x7d'));db['Cdr']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x7e'));db[_0x8aac('0x7f')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x8aac('0x80')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x81'));db[_0x8aac('0x82')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x83'));db[_0x8aac('0x84')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/tag/tag.model');db[_0x8aac('0x85')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x86'));db['Trigger']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x87'));db[_0x8aac('0x88')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x89'));db[_0x8aac('0x8a')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x8b'));db[_0x8aac('0x8c')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x8d'));db['AnalyticCustomReport']=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x8aac('0x8e')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x8f'));db[_0x8aac('0x90')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x91'));db['AnalyticFieldReport']=db[_0x8aac('0x1')]['import'](_0x8aac('0x92'));db[_0x8aac('0x93')]=db[_0x8aac('0x1')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x8aac('0x94')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x8aac('0x95')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x96'));db[_0x8aac('0x97')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x98'));db[_0x8aac('0x99')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x9a'));db['SugarcrmConfiguration']=db['sequelize']['import'](_0x8aac('0x9b'));db[_0x8aac('0x9c')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x8aac('0x9d')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intDeskAccount/intDeskAccount.model');db[_0x8aac('0x9e')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x9f'));db[_0x8aac('0xa0')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xa1'));db[_0x8aac('0xa2')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intZohoAccount/intZohoAccount.model');db[_0x8aac('0xa3')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xa4'));db['ZohoField']=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intZohoField/intZohoField.model');db[_0x8aac('0xa5')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xa6'));db['ZendeskConfiguration']=db['sequelize']['import'](_0x8aac('0xa7'));db[_0x8aac('0xa8')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xa9'));db[_0x8aac('0xaa')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xab'));db[_0x8aac('0xac')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xad'));db[_0x8aac('0xae')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x8aac('0xaf')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xb0'));db[_0x8aac('0xb1')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xb2'));db[_0x8aac('0xb3')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xb4'));db[_0x8aac('0xb5')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x8aac('0xb6')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xb7'));db[_0x8aac('0xb8')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xb9'));db[_0x8aac('0xba')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x8aac('0xbb')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xbc'));db[_0x8aac('0xbd')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db[_0x8aac('0x1')]['import'](_0x8aac('0xbe'));db[_0x8aac('0xbf')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xc0'));db[_0x8aac('0xc1')]=db[_0x8aac('0x1')]['import'](_0x8aac('0xc2'));db[_0x8aac('0x8a')]=db['sequelize'][_0x8aac('0x12')]('../api/integration/integration.model');db[_0x8aac('0xc3')]=db[_0x8aac('0x1')]['import'](_0x8aac('0xc4'));db['ChatQueueReport']=db['sequelize']['import']('../api/chatQueueReport/chatQueueReport.model');db[_0x8aac('0xc5')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xc6'));db[_0x8aac('0xc7')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xc8'));db[_0x8aac('0xc9')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xca'));db[_0x8aac('0xcb')]=db[_0x8aac('0x1')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x8aac('0xcc')]=db['sequelize']['import'](_0x8aac('0xcd'));db[_0x8aac('0xce')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/squareReport/squareReport.model');db[_0x8aac('0xcf')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xd0'));db[_0x8aac('0xd1')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xd2'));db[_0x8aac('0xd3')]=db['sequelize'][_0x8aac('0x12')]('../api/setting/setting.model');db[_0x8aac('0xd4')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xd5'));db[_0x8aac('0xd6')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xd7'));db[_0x8aac('0xd8')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xd9'));db[_0x8aac('0xda')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xdb'));db['Team']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xdc'));db[_0x8aac('0xdd')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xde'));db[_0x8aac('0xdf')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xe0'));db[_0x8aac('0xe1')]=db[_0x8aac('0x1')]['import'](_0x8aac('0xe2'));db['Attachment']=db[_0x8aac('0x1')]['import'](_0x8aac('0xe3'));db['Plugin']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xe4'));db[_0x8aac('0xe5')]=db[_0x8aac('0x1')]['import'](_0x8aac('0xe6'));db[_0x8aac('0xe7')]=db[_0x8aac('0x1')]['import']('../api/chatTransferReport/chatTransferReport.model');db[_0x8aac('0xe8')]=db['sequelize'][_0x8aac('0x12')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xe9'));db['SmsTransferReport']=db[_0x8aac('0x1')]['import'](_0x8aac('0xea'));db[_0x8aac('0xeb')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xec'));db[_0x8aac('0xed')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xee'));db[_0x8aac('0xef')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xf0'));db[_0x8aac('0xf1')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xf2'));db[_0x8aac('0xf3')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xf4'));db[_0x8aac('0xf5')]=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0xf6'));db[_0x8aac('0xf7')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xf8'));db['WhatsappApplication']=db['sequelize'][_0x8aac('0x12')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xf9'));db[_0x8aac('0xfa')]=db[_0x8aac('0x1')]['import'](_0x8aac('0xfb'));db[_0x8aac('0xfc')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0xfd'));db[_0x8aac('0xfe')]=db[_0x8aac('0x1')]['import'](_0x8aac('0xff'));db[_0x8aac('0x100')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x101'));db[_0x8aac('0x102')]=db['sequelize'][_0x8aac('0x12')](_0x8aac('0x103'));db['TeamVoiceQueue']=db[_0x8aac('0x1')]['import'](_0x8aac('0x104'));db[_0x8aac('0x105')]=db[_0x8aac('0x1')]['import'](_0x8aac('0x106'));db['UserVoicePrefix']=db[_0x8aac('0x1')][_0x8aac('0x12')](_0x8aac('0x107'));db[_0x8aac('0x108')]=db[_0x8aac('0x1')][_0x8aac('0x12')]('../api/user-setting/user-setting.model');db[_0x8aac('0x11')][_0x8aac('0x109')](db[_0x8aac('0x1b')],{'as':_0x8aac('0x1b'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11')][_0x8aac('0x109')](db[_0x8aac('0x108')],{'as':'userSetting','onDelete':'cascade','foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11')][_0x8aac('0x10c')](db[_0x8aac('0x18')],{'as':_0x8aac('0x10d'),'foreignKey':_0x8aac('0x10b')});db['User'][_0x8aac('0x10c')](db[_0x8aac('0x10e')],{'as':'VoiceQueuesRt','foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11')]['hasMany'](db[_0x8aac('0x10f')],{'as':_0x8aac('0x110'),'onDelete':_0x8aac('0x10a'),'hooks':!![]});db[_0x8aac('0x11')][_0x8aac('0x10c')](db[_0x8aac('0x70')],{'as':_0x8aac('0x111'),'foreignKey':_0x8aac('0x10b')});db['User']['hasMany'](db[_0x8aac('0x112')],{'as':_0x8aac('0x113'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11')][_0x8aac('0x10c')](db['ReportAgentPreview'],{'as':_0x8aac('0x72'),'foreignKey':'UserId'});db[_0x8aac('0x11')][_0x8aac('0x10c')](db['OpenchannelInteraction'],{'as':_0x8aac('0x114'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11')][_0x8aac('0x10c')](db[_0x8aac('0x115')],{'as':_0x8aac('0x116'),'foreignKey':'UserId'});db[_0x8aac('0x11')][_0x8aac('0x10c')](db[_0x8aac('0x54')],{'as':_0x8aac('0x117'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11')]['hasMany'](db[_0x8aac('0x48')],{'as':_0x8aac('0x118'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11')][_0x8aac('0x10c')](db[_0x8aac('0x3d')],{'as':_0x8aac('0x119'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11')][_0x8aac('0x10c')](db[_0x8aac('0x11a')],{'as':_0x8aac('0x11b'),'foreignKey':'UserId'});db[_0x8aac('0x11')][_0x8aac('0x10c')](db[_0x8aac('0xf5')],{'as':_0x8aac('0x11c'),'foreignKey':_0x8aac('0x11d')});db[_0x8aac('0x11')][_0x8aac('0x11e')](db['UserProfile'],{'as':_0x8aac('0xef'),'foreignKey':'userProfileId'});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0x67')],{'as':_0x8aac('0x120'),'through':'chat_group_has_users'});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0x121')],{'as':'Contacts','through':_0x8aac('0x122')});db['User'][_0x8aac('0x11f')](db[_0x8aac('0xeb')],{'as':'Lists','through':_0x8aac('0x123')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0x124')],{'through':'user_has_teams'});db[_0x8aac('0x11')]['belongsToMany'](db[_0x8aac('0x3d')],{'as':_0x8aac('0x119'),'through':_0x8aac('0x125')});db['User'][_0x8aac('0x11f')](db[_0x8aac('0x115')],{'as':_0x8aac('0x116'),'through':_0x8aac('0x126')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x8aac('0x127')});db['User'][_0x8aac('0x11f')](db[_0x8aac('0x54')],{'as':_0x8aac('0x117'),'through':_0x8aac('0x128')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db['OpenchannelInteraction'],{'as':_0x8aac('0x114'),'through':_0x8aac('0x129')});db['User']['belongsToMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db['User'][_0x8aac('0x11f')](db[_0x8aac('0x16')],{'as':_0x8aac('0x12a'),'through':_0x8aac('0x2a'),'required':![]});db['User'][_0x8aac('0x11f')](db[_0x8aac('0xed')],{'as':'VoicePrefixes','through':_0x8aac('0x12b'),'required':![]});db[_0x8aac('0x11')][_0x8aac('0x11f')](db['MailQueue'],{'as':'MailQueues','through':_0x8aac('0x2c'),'required':![]});db[_0x8aac('0x11')][_0x8aac('0x11f')](db['ChatQueue'],{'as':_0x8aac('0x12c'),'through':_0x8aac('0x2b'),'required':![],'hooks':!![]});db['User'][_0x8aac('0x11f')](db[_0x8aac('0x4c')],{'as':_0x8aac('0x12d'),'through':_0x8aac('0x12e'),'required':![]});db[_0x8aac('0x11')]['belongsToMany'](db['SmsQueue'],{'as':_0x8aac('0x12f'),'through':'UserSmsQueue','required':![]});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0x130')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0x8aac('0x11')]['belongsToMany'](db[_0x8aac('0x100')],{'as':_0x8aac('0x131'),'through':_0x8aac('0x32'),'required':![]});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0xeb')],{'through':_0x8aac('0x123')});db['User'][_0x8aac('0x11f')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0x8aac('0x132')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0x133')],{'as':'FaxAccounts','through':_0x8aac('0x134')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0x135')],{'as':_0x8aac('0x136'),'through':_0x8aac('0x137')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0x59')],{'as':_0x8aac('0x138'),'through':_0x8aac('0x139')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0x50')],{'as':_0x8aac('0x13a'),'through':_0x8aac('0x13b')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db[_0x8aac('0xf7')],{'as':_0x8aac('0x13c'),'through':_0x8aac('0x13d')});db[_0x8aac('0x11')][_0x8aac('0x11f')](db['SquareProject'],{'as':_0x8aac('0x13e'),'through':_0x8aac('0x13f')});db[_0x8aac('0x140')][_0x8aac('0x10c')](db[_0x8aac('0x10f')],{'as':_0x8aac('0x141'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x142')});db['VoiceContext'][_0x8aac('0x10c')](db[_0x8aac('0x10f')],{'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x10f')]['hasMany'](db['VoiceExtension'],{'as':_0x8aac('0x143'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x144')]['belongsToMany'](db['Sound'],{'as':_0x8aac('0x145'),'through':_0x8aac('0x146')});db[_0x8aac('0x16')]['hasMany'](db[_0x8aac('0x10e')],{'as':_0x8aac('0x147'),'foreignKey':'VoiceQueueId'});db[_0x8aac('0x16')][_0x8aac('0x10c')](db[_0x8aac('0x6d')],{'as':'Hoppers','foreignKey':_0x8aac('0x148')});db['VoiceQueue'][_0x8aac('0x10c')](db[_0x8aac('0x70')],{'as':_0x8aac('0x111'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x8aac('0x10c')](db['CmHopperHistory'],{'as':_0x8aac('0x149'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db['ReportAgentPreview'],{'as':_0x8aac('0x72'),'foreignKey':_0x8aac('0x148')});db[_0x8aac('0x16')][_0x8aac('0x10c')](db[_0x8aac('0x6e')],{'as':_0x8aac('0x14a'),'foreignKey':_0x8aac('0x148')});db['VoiceQueue']['hasMany'](db[_0x8aac('0xcb')],{'as':_0x8aac('0x14b'),'foreignKey':_0x8aac('0x148')});db['VoiceQueue']['belongsTo'](db[_0x8aac('0x27')],{'as':_0x8aac('0x27'),'foreignKey':_0x8aac('0x14c')});db['VoiceQueue'][_0x8aac('0x11e')](db[_0x8aac('0x27')],{'as':_0x8aac('0x14d'),'foreignKey':'TrunkBackupId'});db[_0x8aac('0x16')][_0x8aac('0x11e')](db[_0x8aac('0x14e')],{'as':_0x8aac('0x14e'),'foreignKey':'IntervalId'});db[_0x8aac('0x16')][_0x8aac('0x11e')](db['Pause'],{'as':_0x8aac('0x14f'),'foreignKey':_0x8aac('0x150')});db['VoiceQueue'][_0x8aac('0x11f')](db[_0x8aac('0xeb')],{'as':'Lists','through':_0x8aac('0x151')});db[_0x8aac('0x16')]['belongsToMany'](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':'UserVoiceQueue'});db[_0x8aac('0x16')][_0x8aac('0x11f')](db[_0x8aac('0x124')],{'as':_0x8aac('0x153'),'through':_0x8aac('0x154')});db['VoiceQueue'][_0x8aac('0x11f')](db['CmList'],{'as':'BlackLists','through':_0x8aac('0x155')});db[_0x8aac('0x18')][_0x8aac('0x11e')](db['User'],{'as':_0x8aac('0x11'),'foreignKey':_0x8aac('0x10b')});db['ScreenRecording'][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'as':_0x8aac('0x11'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x1b')][_0x8aac('0x10c')](db[_0x8aac('0x1d')],{'as':_0x8aac('0x156'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x157'),'sourceKey':_0x8aac('0x158')});db[_0x8aac('0x1d')][_0x8aac('0x11e')](db[_0x8aac('0x1b')],{'foreignKey':'mailboxuser','targetKey':_0x8aac('0x158')});db[_0x8aac('0x1e')][_0x8aac('0x10c')](db[_0x8aac('0x24')],{'as':_0x8aac('0x159'),'foreignKey':_0x8aac('0x15a'),'constraints':![]});db['VoiceCallReport']['hasMany'](db[_0x8aac('0x22')],{'as':'AgentReports','foreignKey':_0x8aac('0x15a'),'constraints':![]});db[_0x8aac('0x1e')]['belongsTo'](db[_0x8aac('0x11')],{'as':_0x8aac('0x11'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x1e')][_0x8aac('0x11e')](db['CmContact'],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x34')][_0x8aac('0x11e')](db[_0x8aac('0x135')],{'as':'MailAccount','foreignKey':_0x8aac('0x15d')});db[_0x8aac('0x34')][_0x8aac('0x11e')](db[_0x8aac('0x102')],{'as':'CloudProvider','foreignKey':_0x8aac('0x15e'),'onDelete':_0x8aac('0x15f')});db['MailServerOut'][_0x8aac('0x11e')](db[_0x8aac('0x135')],{'as':_0x8aac('0x135'),'foreignKey':_0x8aac('0x15d')});db[_0x8aac('0x36')][_0x8aac('0x11e')](db[_0x8aac('0x102')],{'as':_0x8aac('0x102'),'foreignKey':'CloudProviderId','onDelete':_0x8aac('0x15f')});db[_0x8aac('0x135')][_0x8aac('0x109')](db['MailServerIn'],{'as':_0x8aac('0x160'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x135')][_0x8aac('0x109')](db[_0x8aac('0x36')],{'as':_0x8aac('0x161'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x135')][_0x8aac('0x10c')](db[_0x8aac('0x78')],{'as':'Dispositions','foreignKey':_0x8aac('0x15d'),'onDelete':'cascade'});db[_0x8aac('0x135')][_0x8aac('0x10c')](db[_0x8aac('0x77')],{'as':_0x8aac('0x162'),'foreignKey':_0x8aac('0x15d')});db['MailAccount'][_0x8aac('0x10c')](db[_0x8aac('0x163')],{'as':_0x8aac('0x156'),'foreignKey':'MailAccountId'});db[_0x8aac('0x135')][_0x8aac('0x10c')](db[_0x8aac('0x3d')],{'as':_0x8aac('0x164')});db[_0x8aac('0x135')]['hasMany'](db[_0x8aac('0x40')],{'as':_0x8aac('0x143')});db[_0x8aac('0x135')][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':_0x8aac('0x165'),'foreignKey':'ListId'});db[_0x8aac('0x135')][_0x8aac('0x11e')](db[_0x8aac('0x85')],{'as':_0x8aac('0x85'),'foreignKey':_0x8aac('0x166')});db[_0x8aac('0x135')][_0x8aac('0x11e')](db[_0x8aac('0x167')],{'as':_0x8aac('0x14f'),'foreignKey':_0x8aac('0x150')});db[_0x8aac('0x135')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':_0x8aac('0x137')});db[_0x8aac('0x39')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':'UserMailQueue'});db[_0x8aac('0x39')]['belongsToMany'](db[_0x8aac('0x124')],{'through':'team_has_mail_queues','as':'Teams'});db[_0x8aac('0x3d')][_0x8aac('0x10c')](db['MailMessage'],{'as':_0x8aac('0x156'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x168')});db[_0x8aac('0x3d')][_0x8aac('0x11e')](db['MailAccount'],{'as':_0x8aac('0x169'),'foreignKey':'MailAccountId'});db['MailInteraction']['belongsTo'](db[_0x8aac('0x121')],{'as':'Contact','foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x3d')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'as':_0x8aac('0x16a'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x3d')][_0x8aac('0x11f')](db['Tag'],{'through':_0x8aac('0x16b'),'as':'Tags'});db[_0x8aac('0x3d')][_0x8aac('0x11f')](db[_0x8aac('0x84')],{'through':_0x8aac('0x16b'),'as':_0x8aac('0x16c')});db[_0x8aac('0x3d')]['belongsToMany'](db[_0x8aac('0x11')],{'as':'Users','through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x8aac('0x163')]['hasMany'](db[_0x8aac('0x16d')],{'as':_0x8aac('0x16e'),'onDelete':_0x8aac('0x10a')});db['MailMessage'][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'as':_0x8aac('0x11')});db[_0x8aac('0x163')]['belongsTo'](db[_0x8aac('0x121')],{'onDelete':_0x8aac('0x10a'),'as':'Contact'});db[_0x8aac('0x163')][_0x8aac('0x11e')](db['MailInteraction'],{'as':'Interaction','foreignKey':_0x8aac('0x168')});db[_0x8aac('0x163')][_0x8aac('0x11e')](db[_0x8aac('0x135')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x15d')});db[_0x8aac('0x163')][_0x8aac('0x11e')](db[_0x8aac('0x60')],{'as':_0x8aac('0x60'),'foreignKey':_0x8aac('0x16f')});db[_0x8aac('0x163')][_0x8aac('0x11e')](db[_0x8aac('0x65')],{'as':_0x8aac('0x65'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0x8aac('0x11e')](db['User'],{'onDelete':_0x8aac('0x15f')});db[_0x8aac('0x40')]['belongsTo'](db[_0x8aac('0x39')],{'onDelete':_0x8aac('0x15f')});db[_0x8aac('0x40')][_0x8aac('0x11e')](db[_0x8aac('0x135')],{'onDelete':_0x8aac('0x15f')});db[_0x8aac('0x40')][_0x8aac('0x11e')](db['Interval'],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x170')});db[_0x8aac('0x40')][_0x8aac('0x11e')](db['Tag'],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x171')});db[_0x8aac('0x42')]['belongsTo'](db[_0x8aac('0x135')],{});db[_0x8aac('0x42')][_0x8aac('0x11e')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x8aac('0x42')]['belongsTo'](db[_0x8aac('0x121')],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db['MailQueueReport']['belongsTo'](db[_0x8aac('0x3d')],{});db[_0x8aac('0x42')][_0x8aac('0x11e')](db['MailMessage'],{});db[_0x8aac('0x42')][_0x8aac('0x11e')](db['User'],{});db[_0x8aac('0x42')][_0x8aac('0x11e')](db[_0x8aac('0x39')],{});db[_0x8aac('0x44')][_0x8aac('0x10c')](db[_0x8aac('0x46')],{'as':_0x8aac('0x172'),'onDelete':_0x8aac('0x10a')});db['FaxAccount'][_0x8aac('0x10c')](db[_0x8aac('0x78')],{'as':_0x8aac('0x173'),'foreignKey':_0x8aac('0x174'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x133')][_0x8aac('0x10c')](db['CannedAnswer'],{'as':_0x8aac('0x162'),'foreignKey':_0x8aac('0x174')});db['FaxAccount'][_0x8aac('0x10c')](db[_0x8aac('0x48')],{'as':'Interactions'});db[_0x8aac('0x133')][_0x8aac('0x10c')](db['FaxApplication'],{'as':_0x8aac('0x143')});db[_0x8aac('0x133')][_0x8aac('0x10c')](db[_0x8aac('0x10f')],{'as':_0x8aac('0x175'),'onDelete':_0x8aac('0x10a')});db['FaxAccount']['hasMany'](db[_0x8aac('0x4a')],{'as':_0x8aac('0x156')});db[_0x8aac('0x133')]['belongsTo'](db['Trunk'],{'as':_0x8aac('0x27')});db['FaxAccount'][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':_0x8aac('0x165'),'foreignKey':_0x8aac('0x176')});db[_0x8aac('0x133')][_0x8aac('0x11e')](db[_0x8aac('0x167')],{'as':_0x8aac('0x14f'),'foreignKey':_0x8aac('0x150')});db[_0x8aac('0x133')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':_0x8aac('0x134')});db[_0x8aac('0x177')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'onDelete':'restrict'});db['FaxApplication']['belongsTo'](db[_0x8aac('0x4c')],{'onDelete':_0x8aac('0x15f')});db['FaxApplication'][_0x8aac('0x11e')](db[_0x8aac('0x133')],{'onDelete':_0x8aac('0x15f')});db[_0x8aac('0x177')][_0x8aac('0x11e')](db[_0x8aac('0x84')],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x171')});db['FaxInteraction'][_0x8aac('0x10c')](db[_0x8aac('0x4a')],{'as':_0x8aac('0x156'),'onDelete':_0x8aac('0x10a'),'foreignKey':'FaxInteractionId'});db[_0x8aac('0x48')][_0x8aac('0x11e')](db['FaxAccount'],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x174')});db['FaxInteraction'][_0x8aac('0x11e')](db['CmContact'],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x48')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'as':_0x8aac('0x16a'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x48')][_0x8aac('0x11f')](db[_0x8aac('0x84')],{'through':_0x8aac('0x178'),'as':_0x8aac('0x179')});db[_0x8aac('0x48')]['belongsToMany'](db[_0x8aac('0x84')],{'through':'fax_interaction_has_tags','as':_0x8aac('0x16c')});db[_0x8aac('0x48')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':'Users','through':_0x8aac('0x127'),'foreignKey':_0x8aac('0x17a')});db[_0x8aac('0x4a')]['belongsTo'](db[_0x8aac('0x11')],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x11')});db[_0x8aac('0x4a')]['belongsTo'](db[_0x8aac('0x48')],{'as':_0x8aac('0x17b'),'foreignKey':_0x8aac('0x17a')});db[_0x8aac('0x4a')]['belongsTo'](db[_0x8aac('0x121')],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x15b')});db[_0x8aac('0x4a')][_0x8aac('0x11e')](db[_0x8aac('0x16d')],{'as':'Attachment','foreignKey':_0x8aac('0x17c')});db['FaxMessage'][_0x8aac('0x11e')](db['FaxAccount'],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x174')});db[_0x8aac('0x4c')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':_0x8aac('0x12e')});db[_0x8aac('0x4c')][_0x8aac('0x11f')](db[_0x8aac('0x124')],{'through':_0x8aac('0x17d'),'as':'Teams'});db['FaxQueueReport']['belongsTo'](db[_0x8aac('0x133')],{});db[_0x8aac('0x4e')][_0x8aac('0x11e')](db['CmList'],{'as':_0x8aac('0x165'),'foreignKey':_0x8aac('0x176')});db['FaxQueueReport'][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'as':'Contact','foreignKey':'ContactId'});db[_0x8aac('0x4e')]['belongsTo'](db['FaxInteraction'],{});db[_0x8aac('0x4e')]['belongsTo'](db[_0x8aac('0x4a')],{});db['FaxQueueReport'][_0x8aac('0x11e')](db['User'],{});db[_0x8aac('0x4e')][_0x8aac('0x11e')](db[_0x8aac('0x4c')],{});db[_0x8aac('0x50')][_0x8aac('0x10c')](db[_0x8aac('0x78')],{'as':_0x8aac('0x173'),'foreignKey':_0x8aac('0x17e'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x50')][_0x8aac('0x10c')](db['CannedAnswer'],{'as':_0x8aac('0x162'),'foreignKey':_0x8aac('0x17e')});db[_0x8aac('0x50')][_0x8aac('0x10c')](db[_0x8aac('0x56')],{'as':_0x8aac('0x156'),'foreignKey':_0x8aac('0x17e')});db['SmsAccount']['hasMany'](db[_0x8aac('0x54')],{'as':_0x8aac('0x164')});db[_0x8aac('0x50')][_0x8aac('0x10c')](db[_0x8aac('0x52')],{'as':_0x8aac('0x143')});db[_0x8aac('0x50')][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':'List','foreignKey':_0x8aac('0x176')});db[_0x8aac('0x50')][_0x8aac('0x11e')](db[_0x8aac('0x167')],{'as':_0x8aac('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8aac('0x50')]['belongsToMany'](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':_0x8aac('0x13b')});db[_0x8aac('0x52')][_0x8aac('0x11e')](db['User'],{'onDelete':_0x8aac('0x15f')});db[_0x8aac('0x52')]['belongsTo'](db[_0x8aac('0x57')],{'onDelete':'restrict'});db[_0x8aac('0x52')][_0x8aac('0x11e')](db[_0x8aac('0x50')],{'onDelete':'restrict'});db[_0x8aac('0x52')][_0x8aac('0x11e')](db['Interval'],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x170')});db[_0x8aac('0x52')][_0x8aac('0x11e')](db['Tag'],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x171')});db[_0x8aac('0x54')][_0x8aac('0x10c')](db['SmsMessage'],{'as':_0x8aac('0x156'),'onDelete':'cascade','foreignKey':_0x8aac('0x17f')});db['SmsInteraction'][_0x8aac('0x11e')](db[_0x8aac('0x50')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x17e')});db[_0x8aac('0x54')][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x54')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'as':_0x8aac('0x16a'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x54')][_0x8aac('0x11f')](db[_0x8aac('0x84')],{'through':_0x8aac('0x180'),'as':_0x8aac('0x179')});db[_0x8aac('0x54')][_0x8aac('0x11f')](db['Tag'],{'through':_0x8aac('0x180'),'as':'ThroughTags'});db[_0x8aac('0x54')]['belongsToMany'](db['User'],{'as':_0x8aac('0x181'),'through':'user_has_sms_interactions','foreignKey':_0x8aac('0x17f')});db[_0x8aac('0x56')][_0x8aac('0x11e')](db['User'],{'as':_0x8aac('0x11')});db[_0x8aac('0x56')]['belongsTo'](db['CmContact'],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x15b')});db[_0x8aac('0x56')]['belongsTo'](db['SmsInteraction'],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x17b'),'foreignKey':'SmsInteractionId'});db[_0x8aac('0x56')]['belongsTo'](db[_0x8aac('0x50')],{'as':'Account','foreignKey':_0x8aac('0x17e')});db[_0x8aac('0x57')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':'Agents','through':_0x8aac('0x2f'),'foreignKey':_0x8aac('0x182')});db[_0x8aac('0x57')][_0x8aac('0x11f')](db[_0x8aac('0x124')],{'through':'team_has_sms_queues','as':'Teams'});db[_0x8aac('0x59')]['hasMany'](db[_0x8aac('0x78')],{'as':_0x8aac('0x173'),'foreignKey':_0x8aac('0x183'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x59')][_0x8aac('0x10c')](db[_0x8aac('0x77')],{'as':'Answers','foreignKey':_0x8aac('0x183')});db['OpenchannelAccount'][_0x8aac('0x10c')](db[_0x8aac('0x184')],{'as':_0x8aac('0x164'),'foreignKey':_0x8aac('0x183')});db[_0x8aac('0x59')][_0x8aac('0x10c')](db[_0x8aac('0x5d')],{'as':_0x8aac('0x156'),'foreignKey':_0x8aac('0x183')});db[_0x8aac('0x59')][_0x8aac('0x10c')](db[_0x8aac('0x185')],{'as':_0x8aac('0x143'),'foreignKey':_0x8aac('0x183')});db[_0x8aac('0x59')][_0x8aac('0x11e')](db['CmList'],{'as':_0x8aac('0x165'),'foreignKey':_0x8aac('0x176')});db[_0x8aac('0x59')][_0x8aac('0x11e')](db['Pause'],{'as':_0x8aac('0x14f'),'foreignKey':_0x8aac('0x150')});db[_0x8aac('0x59')][_0x8aac('0x11f')](db['User'],{'as':_0x8aac('0x152'),'through':_0x8aac('0x139')});db[_0x8aac('0x185')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'onDelete':'restrict'});db[_0x8aac('0x185')][_0x8aac('0x11e')](db['OpenchannelQueue'],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x186')});db[_0x8aac('0x185')][_0x8aac('0x11e')](db[_0x8aac('0x59')],{'onDelete':_0x8aac('0x15f'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0x8aac('0x11e')](db[_0x8aac('0x14e')],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x170')});db[_0x8aac('0x185')][_0x8aac('0x11e')](db[_0x8aac('0x84')],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x171')});db[_0x8aac('0x184')][_0x8aac('0x10c')](db[_0x8aac('0x5d')],{'as':_0x8aac('0x156'),'onDelete':'cascade','foreignKey':_0x8aac('0x187')});db[_0x8aac('0x184')][_0x8aac('0x11e')](db[_0x8aac('0x59')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x183')});db[_0x8aac('0x184')][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'as':'Contact','foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x184')][_0x8aac('0x11e')](db['User'],{'as':_0x8aac('0x16a'),'foreignKey':_0x8aac('0x10b')});db['OpenchannelInteraction']['belongsToMany'](db[_0x8aac('0x84')],{'through':_0x8aac('0x188'),'as':_0x8aac('0x179')});db['OpenchannelInteraction']['belongsToMany'](db[_0x8aac('0x84')],{'through':_0x8aac('0x188'),'as':_0x8aac('0x16c')});db[_0x8aac('0x184')]['belongsToMany'](db['User'],{'as':_0x8aac('0x181'),'through':_0x8aac('0x129'),'foreignKey':_0x8aac('0x187')});db[_0x8aac('0x5d')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'onDelete':'cascade','as':_0x8aac('0x11')});db[_0x8aac('0x5d')][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x15b')});db['OpenchannelMessage'][_0x8aac('0x11e')](db['OpenchannelInteraction'],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x17b'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage']['belongsTo'](db[_0x8aac('0x16d')],{'as':_0x8aac('0x16d'),'foreignKey':_0x8aac('0x17c')});db[_0x8aac('0x5d')][_0x8aac('0x11e')](db[_0x8aac('0x59')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x183')});db[_0x8aac('0x130')][_0x8aac('0x11f')](db['User'],{'as':_0x8aac('0x152'),'through':_0x8aac('0x31'),'foreignKey':_0x8aac('0x186')});db[_0x8aac('0x130')][_0x8aac('0x11f')](db[_0x8aac('0x124')],{'through':_0x8aac('0x189'),'as':_0x8aac('0x153')});db[_0x8aac('0x60')][_0x8aac('0x10c')](db['Disposition'],{'as':_0x8aac('0x173'),'foreignKey':_0x8aac('0x16f'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x60')]['hasMany'](db[_0x8aac('0x77')],{'as':_0x8aac('0x162'),'foreignKey':_0x8aac('0x16f')});db[_0x8aac('0x60')][_0x8aac('0x10c')](db[_0x8aac('0x69')],{'as':_0x8aac('0x18a')});db['ChatWebsite'][_0x8aac('0x10c')](db[_0x8aac('0x115')],{'as':_0x8aac('0x164')});db[_0x8aac('0x60')][_0x8aac('0x10c')](db['ChatApplication'],{'as':_0x8aac('0x143')});db['ChatWebsite'][_0x8aac('0x10c')](db[_0x8aac('0x18b')],{'as':_0x8aac('0x156')});db[_0x8aac('0x60')][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':'List','foreignKey':_0x8aac('0x176')});db[_0x8aac('0x60')][_0x8aac('0x11e')](db['Interval'],{'as':_0x8aac('0x14e'),'foreignKey':_0x8aac('0x170')});db[_0x8aac('0x60')][_0x8aac('0x11e')](db[_0x8aac('0x135')],{'as':_0x8aac('0x135'),'foreignKey':'MailAccountId'});db[_0x8aac('0x60')][_0x8aac('0x11e')](db['Pause'],{'as':_0x8aac('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8aac('0x60')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':_0x8aac('0x132')});db[_0x8aac('0x62')][_0x8aac('0x11e')](db['OpenchannelAccount'],{});db[_0x8aac('0x62')][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':_0x8aac('0x165'),'foreignKey':_0x8aac('0x176')});db[_0x8aac('0x62')][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'as':'Contact','foreignKey':'ContactId'});db[_0x8aac('0x62')]['belongsTo'](db[_0x8aac('0x184')],{});db['OpenchannelQueueReport'][_0x8aac('0x11e')](db[_0x8aac('0x5d')],{});db[_0x8aac('0x62')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{});db[_0x8aac('0x62')][_0x8aac('0x11e')](db['OpenchannelQueue'],{});db['ChatApplication'][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'as':_0x8aac('0x18c'),'foreignKey':_0x8aac('0x10b'),'onDelete':'restrict'});db[_0x8aac('0x18d')][_0x8aac('0x11e')](db[_0x8aac('0x18e')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x8aac('0x15f')});db[_0x8aac('0x18d')]['belongsTo'](db[_0x8aac('0x60')],{'as':_0x8aac('0x18f'),'foreignKey':_0x8aac('0x16f'),'onDelete':_0x8aac('0x15f')});db[_0x8aac('0x18d')][_0x8aac('0x11e')](db[_0x8aac('0x84')],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x171')});db[_0x8aac('0x115')]['hasMany'](db[_0x8aac('0x18b')],{'as':_0x8aac('0x156'),'onDelete':'cascade','foreignKey':_0x8aac('0x190')});db['ChatInteraction'][_0x8aac('0x11e')](db['ChatWebsite'],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x16f')});db[_0x8aac('0x115')][_0x8aac('0x11e')](db['CmContact'],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x115')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'as':_0x8aac('0x16a'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x115')][_0x8aac('0x11f')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x8aac('0x179')});db[_0x8aac('0x115')][_0x8aac('0x11f')](db[_0x8aac('0x84')],{'through':_0x8aac('0x191'),'as':_0x8aac('0x16c')});db[_0x8aac('0x115')]['belongsToMany'](db[_0x8aac('0x11')],{'as':'Users','through':_0x8aac('0x126'),'foreignKey':_0x8aac('0x190')});db['ChatMessage'][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'onDelete':_0x8aac('0x10a'),'as':'User'});db[_0x8aac('0x18b')][_0x8aac('0x11e')](db['CmContact'],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db['ChatMessage'][_0x8aac('0x11e')](db[_0x8aac('0x115')],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x17b'),'foreignKey':_0x8aac('0x190')});db[_0x8aac('0x18b')]['belongsTo'](db[_0x8aac('0x16d')],{'as':'Attachment','foreignKey':_0x8aac('0x17c')});db[_0x8aac('0x18b')][_0x8aac('0x11e')](db[_0x8aac('0x60')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x16f')});db['ChatOfflineMessage'][_0x8aac('0x10c')](db[_0x8aac('0x16d')],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0x8aac('0x10a'),'hooks':!![]});db[_0x8aac('0x65')][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x65')][_0x8aac('0x11e')](db[_0x8aac('0x60')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x16f')});db[_0x8aac('0x18e')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':_0x8aac('0x2b'),'hooks':!![]});db['ChatQueue'][_0x8aac('0x11f')](db[_0x8aac('0x124')],{'through':_0x8aac('0x192'),'as':_0x8aac('0x153')});db['ChatGroup'][_0x8aac('0x10c')](db['ChatInternalMessage'],{'as':_0x8aac('0x156'),'foreignKey':_0x8aac('0x193'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x67')][_0x8aac('0x11f')](db['User'],{'as':_0x8aac('0x147'),'through':_0x8aac('0x194')});db[_0x8aac('0x69')][_0x8aac('0x11e')](db[_0x8aac('0x60')],{'as':_0x8aac('0x18f'),'foreignKey':_0x8aac('0x16f')});db['CmCompany'][_0x8aac('0x10c')](db[_0x8aac('0x121')],{'as':_0x8aac('0x195'),'foreignKey':_0x8aac('0x196')});db[_0x8aac('0x121')][_0x8aac('0x10c')](db[_0x8aac('0x6d')],{'as':_0x8aac('0x197'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x121')]['hasMany'](db[_0x8aac('0x70')],{'as':_0x8aac('0x111'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x121')]['hasMany'](db[_0x8aac('0x112')],{'as':'HopperHistories','foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x121')][_0x8aac('0x10c')](db[_0x8aac('0x72')],{'as':_0x8aac('0x72'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0x121')][_0x8aac('0x10c')](db[_0x8aac('0xcb')],{'as':_0x8aac('0x14b'),'foreignKey':'ContactId'});db['CmContact'][_0x8aac('0x10c')](db[_0x8aac('0x184')],{'as':_0x8aac('0x114'),'foreignKey':_0x8aac('0x15c'),'onDelete':_0x8aac('0x15f')});db['CmContact'][_0x8aac('0x10c')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x8aac('0x15c'),'onDelete':'restrict'});db['CmContact'][_0x8aac('0x10c')](db[_0x8aac('0x54')],{'as':_0x8aac('0x117'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x8aac('0x121')]['hasMany'](db['FaxInteraction'],{'as':_0x8aac('0x118'),'foreignKey':_0x8aac('0x15c'),'onDelete':_0x8aac('0x15f')});db['CmContact'][_0x8aac('0x10c')](db[_0x8aac('0x3d')],{'as':_0x8aac('0x119'),'foreignKey':_0x8aac('0x15c'),'onDelete':_0x8aac('0x15f')});db[_0x8aac('0x121')]['belongsTo'](db[_0x8aac('0x198')],{'as':_0x8aac('0x199'),'foreignKey':_0x8aac('0x196')});db['CmContact'][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':'List','foreignKey':_0x8aac('0x176'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x121')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x181'),'through':'cm_user_has_contacts'});db[_0x8aac('0x121')][_0x8aac('0x11f')](db[_0x8aac('0x84')],{'as':_0x8aac('0x179'),'through':_0x8aac('0x19a')});db[_0x8aac('0x121')]['belongsToMany'](db['Tag'],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0x8aac('0x6d')][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x6d')]['belongsTo'](db['CmList'],{'as':_0x8aac('0x165'),'foreignKey':_0x8aac('0x176'),'onDelete':_0x8aac('0x10a')});db['CmHopper'][_0x8aac('0x11e')](db['User'],{'as':_0x8aac('0x18c'),'foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x6d')][_0x8aac('0x11e')](db[_0x8aac('0x16')],{'as':_0x8aac('0x19b'),'foreignKey':'VoiceQueueId','onDelete':_0x8aac('0x10a')});db[_0x8aac('0x6d')][_0x8aac('0x11e')](db[_0x8aac('0xdf')],{'as':'Campaign','foreignKey':_0x8aac('0x19c'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0x6d')]['belongsTo'](db[_0x8aac('0x11')],{'as':'Owner','foreignKey':_0x8aac('0x19d')});db[_0x8aac('0x6e')]['belongsTo'](db[_0x8aac('0x121')],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c'),'onDelete':_0x8aac('0x10a')});db['CmHopperBlack'][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':_0x8aac('0x165'),'foreignKey':_0x8aac('0x176'),'onDelete':'cascade'});db[_0x8aac('0x6e')]['belongsTo'](db[_0x8aac('0x16')],{'as':_0x8aac('0x19b'),'foreignKey':_0x8aac('0x148'),'onDelete':'cascade'});db[_0x8aac('0x6e')][_0x8aac('0x11e')](db[_0x8aac('0xdf')],{'as':_0x8aac('0xdf'),'foreignKey':_0x8aac('0x19c'),'onDelete':'cascade'});db['Automation']['hasMany'](db[_0x8aac('0x7a')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0x8aac('0x19e'),'onDelete':_0x8aac('0x10a'),'hooks':!![]});db[_0x8aac('0x76')][_0x8aac('0x10c')](db['Condition'],{'as':{'plural':_0x8aac('0x19f'),'singular':_0x8aac('0x1a0')},'foreignKey':_0x8aac('0x1a1'),'onDelete':'cascade','hooks':!![]});db[_0x8aac('0x76')]['hasMany'](db[_0x8aac('0x74')],{'as':'Actions','foreignKey':_0x8aac('0x1a2'),'onDelete':'cascade','hooks':!![]});db['Disposition'][_0x8aac('0x10c')](db[_0x8aac('0x78')],{'as':_0x8aac('0x173'),'foreignKey':_0x8aac('0x1a3'),'onDelete':'cascade'});db['Interval'][_0x8aac('0x10c')](db[_0x8aac('0x14e')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0x8aac('0x10a'),'hooks':!![],'required':![]});db['Interval'][_0x8aac('0x10c')](db[_0x8aac('0x10f')],{'as':_0x8aac('0x110'),'foreignKey':_0x8aac('0x170'),'onDelete':_0x8aac('0x15f')});db['Interval'][_0x8aac('0x10c')](db['MailApplication'],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0x8aac('0x14e')][_0x8aac('0x10c')](db[_0x8aac('0x18d')],{'as':_0x8aac('0x1a4'),'foreignKey':'IntervalId'});db['Interval'][_0x8aac('0x10c')](db['FaxApplication'],{'as':_0x8aac('0x1a5'),'foreignKey':_0x8aac('0x170')});db[_0x8aac('0x14e')]['hasMany'](db[_0x8aac('0x52')],{'as':_0x8aac('0x1a6'),'foreignKey':_0x8aac('0x170')});db[_0x8aac('0x80')]['belongsTo'](db[_0x8aac('0x135')],{});db[_0x8aac('0x80')][_0x8aac('0x11e')](db[_0x8aac('0x8e')],{'foreignKey':_0x8aac('0x1a7')});db[_0x8aac('0x80')]['belongsTo'](db[_0x8aac('0x1a8')],{'foreignKey':_0x8aac('0x1a9')});db[_0x8aac('0x82')]['belongsToMany'](db[_0x8aac('0x144')],{'as':_0x8aac('0x1aa'),'through':_0x8aac('0x146'),'onDelete':_0x8aac('0x15f')});db[_0x8aac('0x84')][_0x8aac('0x11f')](db[_0x8aac('0x121')],{'through':'cm_contact_has_tags'});db[_0x8aac('0x84')][_0x8aac('0x11f')](db[_0x8aac('0x115')],{'through':_0x8aac('0x191')});db['Tag'][_0x8aac('0x11f')](db['MailInteraction'],{'through':_0x8aac('0x16b')});db['Tag']['belongsToMany'](db[_0x8aac('0x54')],{'through':_0x8aac('0x180')});db[_0x8aac('0x84')]['belongsToMany'](db[_0x8aac('0x48')],{'through':_0x8aac('0x178')});db['Tag']['belongsToMany'](db['OpenchannelInteraction'],{'through':_0x8aac('0x188')});db[_0x8aac('0x84')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0x8aac('0x1ab')});db[_0x8aac('0x1ac')][_0x8aac('0x10c')](db['Condition'],{'as':{'plural':_0x8aac('0x1ad'),'singular':'AllCondition'},'foreignKey':_0x8aac('0x1ae'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x8aac('0x10c')](db[_0x8aac('0x7a')],{'as':{'plural':_0x8aac('0x1af'),'singular':_0x8aac('0x1b0')},'foreignKey':_0x8aac('0x1b1'),'onDelete':_0x8aac('0x10a'),'hooks':!![]});db[_0x8aac('0x1ac')][_0x8aac('0x10c')](db[_0x8aac('0x74')],{'as':_0x8aac('0x1b2'),'foreignKey':_0x8aac('0x1b3'),'onDelete':_0x8aac('0x10a'),'hooks':!![]});db[_0x8aac('0x1a8')][_0x8aac('0x10c')](db[_0x8aac('0x1b4')],{'as':'Fields','onDelete':_0x8aac('0x10a'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x8aac('0x8e')][_0x8aac('0x10c')](db['AnalyticFieldReport'],{'as':_0x8aac('0x1b5'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x8aac('0x90')][_0x8aac('0x10c')](db[_0x8aac('0x1b4')],{'as':_0x8aac('0x1b5'),'onDelete':'cascade','foreignKey':_0x8aac('0x1b6')});db['AnalyticFieldReport'][_0x8aac('0x11e')](db[_0x8aac('0x90')],{'foreignKey':_0x8aac('0x1b6')});db[_0x8aac('0x94')][_0x8aac('0x10c')](db[_0x8aac('0x95')],{'as':_0x8aac('0x1b7'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x8aac('0x95')]['hasMany'](db['SalesforceField'],{'as':_0x8aac('0x1b8'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0x95')]['hasMany'](db[_0x8aac('0x97')],{'as':_0x8aac('0x1ba'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0x95')][_0x8aac('0x10c')](db['SalesforceField'],{'as':_0x8aac('0x1b5'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0x95')][_0x8aac('0x11e')](db[_0x8aac('0x94')],{'as':'Account','foreignKey':_0x8aac('0x1bd')});db['SalesforceField'][_0x8aac('0x10c')](db[_0x8aac('0x97')],{'as':_0x8aac('0x1be'),'foreignKey':_0x8aac('0x1b9')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0x8aac('0x1bf'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0x97')][_0x8aac('0x10c')](db['SalesforceField'],{'as':_0x8aac('0x1c0'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0x97')][_0x8aac('0x11e')](db[_0x8aac('0x88')],{'as':_0x8aac('0x88'),'foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0x99')][_0x8aac('0x10c')](db[_0x8aac('0x1c2')],{'as':_0x8aac('0x1b7'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bd')});db['SugarcrmConfiguration'][_0x8aac('0x10c')](db[_0x8aac('0x9c')],{'as':_0x8aac('0x1b8'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0x1c2')][_0x8aac('0x10c')](db['SugarcrmField'],{'as':_0x8aac('0x1ba'),'onDelete':_0x8aac('0x10a'),'foreignKey':'DescriptionId'});db[_0x8aac('0x1c2')]['hasMany'](db[_0x8aac('0x9c')],{'as':'Fields','onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0x1c2')][_0x8aac('0x11e')](db[_0x8aac('0x99')],{'as':_0x8aac('0x169'),'foreignKey':'AccountId'});db[_0x8aac('0x9c')][_0x8aac('0x10c')](db['SugarcrmField'],{'as':'Subject','foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0x9c')]['hasMany'](db['SugarcrmField'],{'as':_0x8aac('0x1bf'),'foreignKey':_0x8aac('0x1bb')});db['SugarcrmField'][_0x8aac('0x10c')](db[_0x8aac('0x9c')],{'as':_0x8aac('0x1c0'),'foreignKey':'FieldId'});db[_0x8aac('0x9c')][_0x8aac('0x11e')](db[_0x8aac('0x88')],{'as':'Variable','foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0x9d')][_0x8aac('0x10c')](db[_0x8aac('0x9e')],{'as':_0x8aac('0x1b7'),'onDelete':_0x8aac('0x10a'),'foreignKey':'AccountId'});db[_0x8aac('0x9e')][_0x8aac('0x10c')](db[_0x8aac('0xa0')],{'as':_0x8aac('0x1b8'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0x9e')][_0x8aac('0x10c')](db['DeskField'],{'as':_0x8aac('0x1ba'),'onDelete':_0x8aac('0x10a'),'foreignKey':'DescriptionId'});db[_0x8aac('0x9e')][_0x8aac('0x10c')](db[_0x8aac('0xa0')],{'as':_0x8aac('0x1b5'),'onDelete':'cascade','foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0x9e')][_0x8aac('0x11e')](db['DeskAccount'],{'as':_0x8aac('0x169'),'foreignKey':'AccountId'});db[_0x8aac('0x9e')]['belongsToMany'](db[_0x8aac('0x84')],{'through':_0x8aac('0x1c3')});db[_0x8aac('0xa0')][_0x8aac('0x10c')](db[_0x8aac('0xa0')],{'as':'Subject','foreignKey':_0x8aac('0x1b9')});db['DeskField']['hasMany'](db[_0x8aac('0xa0')],{'as':_0x8aac('0x1bf'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xa0')][_0x8aac('0x10c')](db[_0x8aac('0xa0')],{'as':_0x8aac('0x1c0'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xa0')][_0x8aac('0x11e')](db[_0x8aac('0x88')],{'as':_0x8aac('0x88'),'foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0xa2')][_0x8aac('0x10c')](db[_0x8aac('0xa3')],{'as':_0x8aac('0x1b7'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0xa3')]['hasMany'](db[_0x8aac('0x1c4')],{'as':_0x8aac('0x1b8'),'onDelete':_0x8aac('0x10a'),'foreignKey':'SubjectId'});db[_0x8aac('0xa3')][_0x8aac('0x10c')](db[_0x8aac('0x1c4')],{'as':_0x8aac('0x1ba'),'onDelete':'cascade','foreignKey':_0x8aac('0x1bb')});db['ZohoConfiguration'][_0x8aac('0x10c')](db[_0x8aac('0x1c4')],{'as':'Fields','onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xa3')][_0x8aac('0x11e')](db[_0x8aac('0xa2')],{'as':'Account','foreignKey':_0x8aac('0x1bd')});db['ZohoField'][_0x8aac('0x10c')](db[_0x8aac('0x1c4')],{'as':_0x8aac('0x1be'),'foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0x1c4')][_0x8aac('0x10c')](db[_0x8aac('0x1c4')],{'as':'Description','foreignKey':'DescriptionId'});db['ZohoField'][_0x8aac('0x10c')](db[_0x8aac('0x1c4')],{'as':_0x8aac('0x1c0'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0x1c4')][_0x8aac('0x11e')](db['Variable'],{'as':_0x8aac('0x88'),'foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0xa5')]['hasMany'](db[_0x8aac('0x1c5')],{'as':_0x8aac('0x1b7'),'onDelete':'cascade','foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0x1c5')][_0x8aac('0x10c')](db[_0x8aac('0xa8')],{'as':_0x8aac('0x1b8'),'foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0x1c5')][_0x8aac('0x10c')](db[_0x8aac('0xa8')],{'as':_0x8aac('0x1ba'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration']['hasMany'](db[_0x8aac('0xa8')],{'as':_0x8aac('0x1b5'),'foreignKey':'FieldId'});db[_0x8aac('0x1c5')][_0x8aac('0x11e')](db[_0x8aac('0xa5')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0x1c5')][_0x8aac('0x11f')](db[_0x8aac('0x84')],{'through':'int_zendesk_configuration_has_tags'});db[_0x8aac('0xa8')][_0x8aac('0x10c')](db['ZendeskField'],{'as':_0x8aac('0x1be'),'foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0xa8')]['hasMany'](db[_0x8aac('0xa8')],{'as':_0x8aac('0x1bf'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xa8')][_0x8aac('0x10c')](db[_0x8aac('0xa8')],{'as':'Field','foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xa8')][_0x8aac('0x11e')](db['Variable'],{'as':_0x8aac('0x88'),'foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0xaa')]['hasMany'](db[_0x8aac('0xac')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x8aac('0xac')][_0x8aac('0x10c')](db[_0x8aac('0xae')],{'as':_0x8aac('0x1b8'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0xac')][_0x8aac('0x10c')](db[_0x8aac('0xae')],{'as':'Descriptions','onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xac')][_0x8aac('0x10c')](db[_0x8aac('0xae')],{'as':_0x8aac('0x1b5'),'onDelete':_0x8aac('0x10a'),'foreignKey':'FieldId'});db[_0x8aac('0xac')]['belongsTo'](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0xac')]['belongsToMany'](db[_0x8aac('0x84')],{'through':_0x8aac('0x1c6')});db[_0x8aac('0xae')][_0x8aac('0x10c')](db[_0x8aac('0xae')],{'as':_0x8aac('0x1be'),'foreignKey':_0x8aac('0x1b9')});db['FreshdeskField']['hasMany'](db[_0x8aac('0xae')],{'as':'Description','foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xae')][_0x8aac('0x10c')](db[_0x8aac('0xae')],{'as':_0x8aac('0x1c0'),'foreignKey':'FieldId'});db[_0x8aac('0xae')]['belongsTo'](db[_0x8aac('0x88')],{'as':_0x8aac('0x88'),'foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0xaf')][_0x8aac('0x10c')](db[_0x8aac('0xb1')],{'as':_0x8aac('0x1b7'),'onDelete':'cascade','foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0xb1')][_0x8aac('0x10c')](db[_0x8aac('0xb3')],{'as':_0x8aac('0x1b8'),'foreignKey':_0x8aac('0x1b9')});db['VtigerConfiguration'][_0x8aac('0x10c')](db[_0x8aac('0xb3')],{'as':_0x8aac('0x1ba'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xb1')][_0x8aac('0x10c')](db[_0x8aac('0xb3')],{'as':_0x8aac('0x1b5'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xb1')][_0x8aac('0x11e')](db[_0x8aac('0xaf')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x1bd')});db['VtigerField'][_0x8aac('0x10c')](db[_0x8aac('0xb3')],{'as':'Subject','foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0xb3')][_0x8aac('0x10c')](db[_0x8aac('0xb3')],{'as':_0x8aac('0x1bf'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xb3')][_0x8aac('0x10c')](db['VtigerField'],{'as':_0x8aac('0x1c0'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xb3')]['belongsTo'](db[_0x8aac('0x88')],{'as':_0x8aac('0x88'),'foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0xb5')]['hasMany'](db[_0x8aac('0xb6')],{'as':'Configurations','onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bd')});db['ServicenowConfiguration'][_0x8aac('0x10c')](db[_0x8aac('0xb8')],{'as':_0x8aac('0x1b8'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x8aac('0x10c')](db[_0x8aac('0xb8')],{'as':_0x8aac('0x1ba'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xb6')][_0x8aac('0x10c')](db[_0x8aac('0xb8')],{'as':_0x8aac('0x1b5'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xb6')][_0x8aac('0x11e')](db[_0x8aac('0xb5')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0xb8')]['hasMany'](db[_0x8aac('0xb8')],{'as':_0x8aac('0x1be'),'foreignKey':'SubjectId'});db['ServicenowField'][_0x8aac('0x10c')](db[_0x8aac('0xb8')],{'as':_0x8aac('0x1bf'),'foreignKey':_0x8aac('0x1bb')});db['ServicenowField'][_0x8aac('0x10c')](db[_0x8aac('0xb8')],{'as':_0x8aac('0x1c0'),'foreignKey':_0x8aac('0x1bc')});db['ServicenowField'][_0x8aac('0x11e')](db[_0x8aac('0x88')],{'as':_0x8aac('0x88'),'foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0xba')][_0x8aac('0x10c')](db['Dynamics365Configuration'],{'as':_0x8aac('0x1b7'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0xbb')][_0x8aac('0x10c')](db[_0x8aac('0xbd')],{'as':_0x8aac('0x1b8'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1b9')});db[_0x8aac('0xbb')]['hasMany'](db['Dynamics365Field'],{'as':_0x8aac('0x1ba'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bb')});db['Dynamics365Configuration'][_0x8aac('0x10c')](db[_0x8aac('0xbd')],{'as':_0x8aac('0x1b5'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xbb')][_0x8aac('0x11e')](db['Dynamics365Account'],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0xbd')][_0x8aac('0x10c')](db[_0x8aac('0xbd')],{'as':'Subject','foreignKey':_0x8aac('0x1b9')});db['Dynamics365Field'][_0x8aac('0x10c')](db[_0x8aac('0xbd')],{'as':_0x8aac('0x1bf'),'foreignKey':'DescriptionId'});db[_0x8aac('0xbd')][_0x8aac('0x10c')](db[_0x8aac('0xbd')],{'as':_0x8aac('0x1c0'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xbd')]['belongsTo'](db[_0x8aac('0x88')],{'as':_0x8aac('0x88'),'foreignKey':_0x8aac('0x1c1')});db[_0x8aac('0x1c7')]['hasMany'](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0x8aac('0x10a'),'foreignKey':'AccountId'});db[_0x8aac('0xbf')][_0x8aac('0x10c')](db[_0x8aac('0xc1')],{'as':_0x8aac('0x1b8'),'foreignKey':'SubjectId'});db[_0x8aac('0xbf')][_0x8aac('0x10c')](db[_0x8aac('0xc1')],{'as':_0x8aac('0x1ba'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xbf')]['hasMany'](db[_0x8aac('0xc1')],{'as':_0x8aac('0x1b5'),'foreignKey':_0x8aac('0x1bc')});db[_0x8aac('0xbf')][_0x8aac('0x11e')](db[_0x8aac('0x1c7')],{'as':'Account','foreignKey':_0x8aac('0x1bd')});db[_0x8aac('0xc1')][_0x8aac('0x10c')](db['FreshsalesField'],{'as':_0x8aac('0x1be'),'foreignKey':'SubjectId'});db[_0x8aac('0xc1')]['hasMany'](db[_0x8aac('0xc1')],{'as':_0x8aac('0x1bf'),'foreignKey':_0x8aac('0x1bb')});db[_0x8aac('0xc1')][_0x8aac('0x10c')](db[_0x8aac('0xc1')],{'as':_0x8aac('0x1c0'),'foreignKey':_0x8aac('0x1bc')});db['FreshsalesField'][_0x8aac('0x11e')](db[_0x8aac('0x88')],{'as':'Variable','foreignKey':'VariableId'});db[_0x8aac('0x1c8')]['belongsTo'](db[_0x8aac('0x60')],{});db[_0x8aac('0x1c8')]['belongsTo'](db[_0x8aac('0xeb')],{'as':_0x8aac('0x165'),'foreignKey':_0x8aac('0x176')});db['ChatQueueReport'][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db['ChatQueueReport'][_0x8aac('0x11e')](db[_0x8aac('0x115')],{});db[_0x8aac('0x1c8')][_0x8aac('0x11e')](db[_0x8aac('0x18b')],{});db[_0x8aac('0x1c8')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{});db['ChatQueueReport'][_0x8aac('0x11e')](db['ChatQueue'],{});db['ChatInternalMessage'][_0x8aac('0x11e')](db['User'],{'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1c9')});db[_0x8aac('0xc5')]['belongsTo'](db[_0x8aac('0x11')],{'onDelete':_0x8aac('0x10a'),'foreignKey':'ToId'});db[_0x8aac('0xcb')][_0x8aac('0x10c')](db[_0x8aac('0xc9')],{'foreignKey':_0x8aac('0x1ca'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0xcb')]['hasMany'](db[_0x8aac('0xc7')],{'foreignKey':_0x8aac('0x1ca'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0xcc')][_0x8aac('0x11e')](db['SmsAccount'],{});db[_0x8aac('0xcc')][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':_0x8aac('0x165'),'foreignKey':_0x8aac('0x176')});db[_0x8aac('0xcc')][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db[_0x8aac('0xcc')]['belongsTo'](db[_0x8aac('0x54')],{});db[_0x8aac('0xcc')][_0x8aac('0x11e')](db[_0x8aac('0x56')],{});db['SmsQueueReport'][_0x8aac('0x11e')](db[_0x8aac('0x11')],{});db[_0x8aac('0xcc')][_0x8aac('0x11e')](db['SmsQueue'],{});db[_0x8aac('0xd1')][_0x8aac('0x10c')](db[_0x8aac('0xcb')],{'foreignKey':_0x8aac('0x1cb')});db['JscriptyProject'][_0x8aac('0x10c')](db['JscriptyQuestionReport'],{'foreignKey':_0x8aac('0x1cb')});db[_0x8aac('0xd1')][_0x8aac('0x10c')](db[_0x8aac('0xc7')],{'foreignKey':_0x8aac('0x1cb')});db[_0x8aac('0xd6')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x181'),'through':'user_has_square_projects'});db['Team']['belongsToMany'](db['User'],{'as':_0x8aac('0x152'),'through':_0x8aac('0x1cc')});db[_0x8aac('0x124')][_0x8aac('0x11f')](db['VoiceQueue'],{'through':'TeamVoiceQueue','as':_0x8aac('0x12a')});db[_0x8aac('0x124')][_0x8aac('0x11f')](db['MailQueue'],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0x8aac('0x124')][_0x8aac('0x11f')](db[_0x8aac('0x18e')],{'through':_0x8aac('0x192'),'as':_0x8aac('0x12c')});db[_0x8aac('0x124')]['belongsToMany'](db['FaxQueue'],{'through':_0x8aac('0x17d'),'as':'FaxQueues'});db[_0x8aac('0x124')]['belongsToMany'](db[_0x8aac('0x57')],{'through':_0x8aac('0x1cd'),'as':_0x8aac('0x12f')});db['Team'][_0x8aac('0x11f')](db[_0x8aac('0x130')],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x8aac('0x124')][_0x8aac('0x11f')](db[_0x8aac('0x100')],{'through':_0x8aac('0x1ce'),'as':'WhatsappQueues'});db[_0x8aac('0x124')][_0x8aac('0x11f')](db[_0x8aac('0xed')],{'through':_0x8aac('0x105'),'as':'VoicePrefixes'});db[_0x8aac('0xdf')][_0x8aac('0x10c')](db['CmHopper'],{'as':_0x8aac('0x197'),'foreignKey':_0x8aac('0x19c')});db['Campaign'][_0x8aac('0x10c')](db[_0x8aac('0x70')],{'as':_0x8aac('0x111'),'foreignKey':'CampaignId'});db[_0x8aac('0xdf')]['hasMany'](db[_0x8aac('0x112')],{'as':_0x8aac('0x149'),'foreignKey':'CampaignId'});db[_0x8aac('0xdf')][_0x8aac('0x10c')](db[_0x8aac('0x6e')],{'as':_0x8aac('0x14a'),'foreignKey':_0x8aac('0x19c')});db[_0x8aac('0xdf')][_0x8aac('0x11e')](db['Trunk'],{'as':'Trunk','foreignKey':_0x8aac('0x14c')});db[_0x8aac('0xdf')][_0x8aac('0x11e')](db[_0x8aac('0x27')],{'as':_0x8aac('0x14d'),'foreignKey':_0x8aac('0x1cf')});db[_0x8aac('0xdf')][_0x8aac('0x11e')](db[_0x8aac('0x14e')],{'as':_0x8aac('0x14e'),'foreignKey':_0x8aac('0x170')});db['Campaign'][_0x8aac('0x11e')](db[_0x8aac('0xd6')],{'as':_0x8aac('0xd6'),'foreignKey':_0x8aac('0x1d0')});db[_0x8aac('0xdf')][_0x8aac('0x11f')](db[_0x8aac('0xeb')],{'as':_0x8aac('0x1d1'),'through':_0x8aac('0x1d2')});db[_0x8aac('0xdf')][_0x8aac('0x11f')](db[_0x8aac('0xeb')],{'as':_0x8aac('0x1d3'),'through':_0x8aac('0x1d4')});db[_0x8aac('0x16d')][_0x8aac('0x11e')](db[_0x8aac('0x65')],{'as':_0x8aac('0x65'),'foreignKey':'ChatOfflineMessageId'});db[_0x8aac('0xe5')][_0x8aac('0x11e')](db['MailMessage'],{});db[_0x8aac('0xe5')]['belongsTo'](db['MailInteraction'],{});db['MailTransferReport'][_0x8aac('0x11e')](db[_0x8aac('0x135')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db[_0x8aac('0xe5')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'foreignKey':'FromUserId','as':'FromAgent'});db['MailTransferReport']['belongsTo'](db[_0x8aac('0x11')],{'foreignKey':'ToUserId','as':_0x8aac('0x1d5')});db['MailTransferReport'][_0x8aac('0x11e')](db[_0x8aac('0x39')],{'foreignKey':_0x8aac('0x1d6'),'as':_0x8aac('0x1d7')});db[_0x8aac('0xe5')][_0x8aac('0x11e')](db['MailAccount'],{'foreignKey':_0x8aac('0x1d8'),'as':_0x8aac('0x1d9')});db[_0x8aac('0xe7')]['belongsTo'](db[_0x8aac('0x18b')],{});db[_0x8aac('0xe7')]['belongsTo'](db[_0x8aac('0x115')],{});db[_0x8aac('0xe7')][_0x8aac('0x11e')](db[_0x8aac('0x60')],{'foreignKey':'FromChatWebsiteId','as':_0x8aac('0x1da')});db['ChatTransferReport'][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'foreignKey':_0x8aac('0x1db'),'as':_0x8aac('0x1dc')});db[_0x8aac('0xe7')][_0x8aac('0x11e')](db['User'],{'foreignKey':_0x8aac('0x1dd'),'as':_0x8aac('0x1d5')});db[_0x8aac('0xe7')][_0x8aac('0x11e')](db[_0x8aac('0x18e')],{'foreignKey':_0x8aac('0x1de'),'as':_0x8aac('0x1d7')});db['ChatTransferReport'][_0x8aac('0x11e')](db['ChatWebsite'],{'foreignKey':_0x8aac('0x1df'),'as':_0x8aac('0x1d9')});db[_0x8aac('0xe8')][_0x8aac('0x11e')](db['FaxMessage'],{});db[_0x8aac('0xe8')]['belongsTo'](db[_0x8aac('0x48')],{});db[_0x8aac('0xe8')][_0x8aac('0x11e')](db[_0x8aac('0x133')],{'foreignKey':_0x8aac('0x1e0'),'as':'FromAccount'});db[_0x8aac('0xe8')]['belongsTo'](db['User'],{'foreignKey':_0x8aac('0x1db'),'as':_0x8aac('0x1dc')});db[_0x8aac('0xe8')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'foreignKey':'ToUserId','as':_0x8aac('0x1d5')});db[_0x8aac('0xe8')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x8aac('0x1e1'),'as':_0x8aac('0x1d7')});db[_0x8aac('0xe8')][_0x8aac('0x11e')](db[_0x8aac('0x133')],{'foreignKey':_0x8aac('0x1e2'),'as':_0x8aac('0x1d9')});db[_0x8aac('0x1e3')][_0x8aac('0x11e')](db[_0x8aac('0x5d')],{});db[_0x8aac('0x1e3')][_0x8aac('0x11e')](db[_0x8aac('0x184')],{});db[_0x8aac('0x1e3')][_0x8aac('0x11e')](db[_0x8aac('0x59')],{'foreignKey':_0x8aac('0x1e4'),'as':_0x8aac('0x1da')});db[_0x8aac('0x1e3')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'foreignKey':_0x8aac('0x1db'),'as':_0x8aac('0x1dc')});db['OpenchannelTransferReport']['belongsTo'](db[_0x8aac('0x11')],{'foreignKey':_0x8aac('0x1dd'),'as':_0x8aac('0x1d5')});db[_0x8aac('0x1e3')][_0x8aac('0x11e')](db[_0x8aac('0x130')],{'foreignKey':_0x8aac('0x1e5'),'as':_0x8aac('0x1d7')});db[_0x8aac('0x1e3')][_0x8aac('0x11e')](db[_0x8aac('0x59')],{'foreignKey':_0x8aac('0x1e6'),'as':_0x8aac('0x1d9')});db[_0x8aac('0x1e7')][_0x8aac('0x11e')](db['SmsMessage'],{});db[_0x8aac('0x1e7')][_0x8aac('0x11e')](db[_0x8aac('0x54')],{});db[_0x8aac('0x1e7')]['belongsTo'](db[_0x8aac('0x50')],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db[_0x8aac('0x1e7')]['belongsTo'](db[_0x8aac('0x11')],{'foreignKey':'FromUserId','as':_0x8aac('0x1dc')});db['SmsTransferReport']['belongsTo'](db[_0x8aac('0x11')],{'foreignKey':_0x8aac('0x1dd'),'as':_0x8aac('0x1d5')});db[_0x8aac('0x1e7')]['belongsTo'](db['SmsQueue'],{'foreignKey':_0x8aac('0x1e8'),'as':_0x8aac('0x1d7')});db['SmsTransferReport']['belongsTo'](db[_0x8aac('0x50')],{'foreignKey':_0x8aac('0x1e9'),'as':_0x8aac('0x1d9')});db[_0x8aac('0xeb')][_0x8aac('0x10c')](db[_0x8aac('0x78')],{'as':_0x8aac('0x173'),'foreignKey':_0x8aac('0x176'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0xeb')][_0x8aac('0x10c')](db[_0x8aac('0x73')],{'as':'CustomFields','foreignKey':_0x8aac('0x176')});db[_0x8aac('0xeb')][_0x8aac('0x10c')](db[_0x8aac('0x121')],{'as':'Contacts','onDelete':_0x8aac('0x10a'),'foreignKey':'ListId'});db[_0x8aac('0xeb')][_0x8aac('0x10c')](db[_0x8aac('0x70')],{'as':_0x8aac('0x111'),'foreignKey':_0x8aac('0x176')});db['CmList']['hasMany'](db[_0x8aac('0x112')],{'as':'HopperHistory','foreignKey':_0x8aac('0x176')});db[_0x8aac('0xeb')]['hasMany'](db[_0x8aac('0x72')],{'as':'ReportAgentPreview','foreignKey':_0x8aac('0x176')});db[_0x8aac('0xeb')][_0x8aac('0x11f')](db[_0x8aac('0x16')],{'as':_0x8aac('0x1ea'),'through':'voice_queues_has_cm_lists'});db[_0x8aac('0xeb')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':'Agents','through':_0x8aac('0x123')});db[_0x8aac('0xed')][_0x8aac('0x10c')](db['VoiceExtension'],{'as':_0x8aac('0x110'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0xed')]['belongsToMany'](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':'UserVoicePrefix'});db['VoicePrefix']['belongsToMany'](db[_0x8aac('0x124')],{'through':_0x8aac('0x105'),'as':_0x8aac('0x153')});db[_0x8aac('0xef')][_0x8aac('0x10c')](db['User'],{'as':'Users','foreignKey':_0x8aac('0x1eb')});db[_0x8aac('0xef')][_0x8aac('0x10c')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x8aac('0x1eb'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0xf1')][_0x8aac('0x10c')](db[_0x8aac('0xf3')],{'as':_0x8aac('0x1ec'),'foreignKey':_0x8aac('0x1ed'),'onDelete':_0x8aac('0x10a')});db['WhatsappAccount']['hasMany'](db[_0x8aac('0x78')],{'as':_0x8aac('0x173'),'foreignKey':_0x8aac('0x1ee'),'onDelete':_0x8aac('0x10a')});db[_0x8aac('0xf7')]['hasMany'](db[_0x8aac('0x77')],{'as':'Answers','foreignKey':_0x8aac('0x1ee')});db[_0x8aac('0xf7')][_0x8aac('0x10c')](db['WhatsappMessage'],{'as':_0x8aac('0x156'),'foreignKey':_0x8aac('0x1ee')});db[_0x8aac('0xf7')][_0x8aac('0x10c')](db[_0x8aac('0x11a')],{'as':'Interactions'});db[_0x8aac('0xf7')][_0x8aac('0x10c')](db[_0x8aac('0x1ef')],{'as':_0x8aac('0x143')});db[_0x8aac('0xf7')][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':'List','foreignKey':_0x8aac('0x176')});db['WhatsappAccount'][_0x8aac('0x11e')](db[_0x8aac('0x167')],{'as':_0x8aac('0x14f'),'foreignKey':_0x8aac('0x150')});db[_0x8aac('0xf7')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':'user_has_whatsapp_accounts'});db[_0x8aac('0x1ef')]['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0x8aac('0x1ef')]['belongsTo'](db[_0x8aac('0x100')],{'onDelete':_0x8aac('0x15f')});db['WhatsappApplication'][_0x8aac('0x11e')](db['WhatsappAccount'],{'onDelete':_0x8aac('0x15f')});db['WhatsappApplication'][_0x8aac('0x11e')](db[_0x8aac('0x14e')],{'onDelete':_0x8aac('0x15f'),'foreignKey':'IntervalId'});db[_0x8aac('0x1ef')][_0x8aac('0x11e')](db[_0x8aac('0x84')],{'onDelete':_0x8aac('0x15f'),'foreignKey':_0x8aac('0x171')});db['WhatsappInteraction'][_0x8aac('0x10c')](db[_0x8aac('0xfa')],{'as':_0x8aac('0x156'),'onDelete':_0x8aac('0x10a'),'foreignKey':_0x8aac('0x1f0')});db['WhatsappInteraction']['belongsTo'](db[_0x8aac('0xf7')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x1ee')});db[_0x8aac('0x11a')][_0x8aac('0x11e')](db[_0x8aac('0x121')],{'as':_0x8aac('0x15b'),'foreignKey':'ContactId'});db['WhatsappInteraction']['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x8aac('0x10b')});db[_0x8aac('0x11a')][_0x8aac('0x11f')](db[_0x8aac('0x84')],{'through':_0x8aac('0x1ab'),'as':_0x8aac('0x179')});db[_0x8aac('0x11a')]['belongsToMany'](db['Tag'],{'through':_0x8aac('0x1ab'),'as':_0x8aac('0x16c')});db[_0x8aac('0x11a')]['belongsToMany'](db[_0x8aac('0x11')],{'as':_0x8aac('0x181'),'through':_0x8aac('0x1f1'),'foreignKey':'WhatsappInteractionId'});db[_0x8aac('0xfa')][_0x8aac('0x11e')](db[_0x8aac('0x11')],{'as':'User'});db[_0x8aac('0xfa')]['belongsTo'](db['CmContact'],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x15b')});db['WhatsappMessage'][_0x8aac('0x11e')](db[_0x8aac('0x11a')],{'onDelete':_0x8aac('0x10a'),'as':_0x8aac('0x17b'),'foreignKey':'WhatsappInteractionId'});db[_0x8aac('0xfa')][_0x8aac('0x11e')](db[_0x8aac('0xf7')],{'as':_0x8aac('0x169'),'foreignKey':_0x8aac('0x1ee')});db[_0x8aac('0xfc')][_0x8aac('0x11e')](db[_0x8aac('0xf7')],{});db[_0x8aac('0xfc')][_0x8aac('0x11e')](db[_0x8aac('0xeb')],{'as':_0x8aac('0x165'),'foreignKey':'ListId'});db[_0x8aac('0xfc')][_0x8aac('0x11e')](db['CmContact'],{'as':_0x8aac('0x15b'),'foreignKey':_0x8aac('0x15c')});db['WhatsappQueueReport'][_0x8aac('0x11e')](db['WhatsappInteraction'],{});db[_0x8aac('0xfc')][_0x8aac('0x11e')](db[_0x8aac('0x100')],{});db[_0x8aac('0xfc')][_0x8aac('0x11e')](db[_0x8aac('0xfa')],{});db[_0x8aac('0xfc')][_0x8aac('0x11e')](db['User'],{});db[_0x8aac('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x8aac('0xfe')][_0x8aac('0x11e')](db['WhatsappInteraction'],{});db[_0x8aac('0xfe')][_0x8aac('0x11e')](db[_0x8aac('0xf7')],{'foreignKey':_0x8aac('0x1f2'),'as':_0x8aac('0x1da')});db[_0x8aac('0xfe')]['belongsTo'](db[_0x8aac('0xf7')],{'foreignKey':_0x8aac('0x1f3'),'as':_0x8aac('0x1d9')});db[_0x8aac('0xfe')][_0x8aac('0x11e')](db[_0x8aac('0x100')],{'foreignKey':_0x8aac('0x1f4'),'as':_0x8aac('0x1d7')});db[_0x8aac('0xfe')][_0x8aac('0x11e')](db['User'],{'foreignKey':_0x8aac('0x1db'),'as':_0x8aac('0x1dc')});db[_0x8aac('0xfe')]['belongsTo'](db[_0x8aac('0x11')],{'foreignKey':'ToUserId','as':_0x8aac('0x1d5')});db[_0x8aac('0x100')][_0x8aac('0x11f')](db[_0x8aac('0x11')],{'as':_0x8aac('0x152'),'through':_0x8aac('0x32'),'foreignKey':'WhatsappQueueId'});db[_0x8aac('0x100')][_0x8aac('0x11f')](db[_0x8aac('0x124')],{'through':_0x8aac('0x1ce'),'as':_0x8aac('0x153')});db[_0x8aac('0x108')]['belongsTo'](db[_0x8aac('0x11')],{'as':_0x8aac('0x1f5'),'foreignKey':_0x8aac('0x10b'),'onDelete':_0x8aac('0x10a'),'hooks':!![]});db['CloudProvider']['hasOne'](db[_0x8aac('0x34')],{'as':_0x8aac('0x160'),'onDelete':_0x8aac('0x15f')});db['CloudProvider'][_0x8aac('0x109')](db[_0x8aac('0x36')],{'as':_0x8aac('0x161'),'onDelete':_0x8aac('0x15f')});module[_0x8aac('0x1f6')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 47daf80..b71518e 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d0e=['/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappQueue','/api/cloudProviders','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','/plugins','/server/files/plugins','route','get','sendFile','resolve','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction'];(function(_0x29cee8,_0x2d2dd0){var _0x4ba56b=function(_0x178967){while(--_0x178967){_0x29cee8['push'](_0x29cee8['shift']());}};_0x4ba56b(++_0x2d2dd0);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x82263c,_0x40cf9a){_0x82263c=_0x82263c-0x0;var _0x4c1e4d=_0x8d0e[_0x82263c];return _0x4c1e4d;};'use strict';var path=require(_0xe8d0('0x0'));var express=require(_0xe8d0('0x1'));var errors=require(_0xe8d0('0x2'));var config=require(_0xe8d0('0x3'));var setupLoggers=require(_0xe8d0('0x4'))[_0xe8d0('0x5')];var clientSideLogs=require(_0xe8d0('0x6'));exports[_0xe8d0('0x7')]=function(_0x32cee9){return setupLoggers(_0x32cee9)['then'](function(){_0x32cee9[_0xe8d0('0x8')]('/api/users',require('./api/user'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x9'),require(_0xe8d0('0xa')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xb'),require(_0xe8d0('0xc')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xd'),require('./api/voiceExtension'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xe'),require(_0xe8d0('0xf')));_0x32cee9['use']('/api/voice/queues',require(_0xe8d0('0x10')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x11'),require(_0xe8d0('0x12')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x13'),require('./api/screenRecording'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x14'),require('./api/voiceMail'));_0x32cee9[_0xe8d0('0x8')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x15'),require(_0xe8d0('0x16')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x17'),require(_0xe8d0('0x18')));_0x32cee9['use'](_0xe8d0('0x19'),require('./api/voiceAgentReport'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x1a'),require(_0xe8d0('0x1b')));_0x32cee9['use']('/api/members/reports',require('./api/memberReport'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x1c'),require(_0xe8d0('0x1d')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x1e'),require('./api/voiceTransferReport'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x1f'),require('./api/mailServerOut'));_0x32cee9['use']('/api/mail/accounts',require(_0xe8d0('0x20')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x21'),require(_0xe8d0('0x22')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x23'),require(_0xe8d0('0x24')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x25'),require('./api/mailInteraction'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x26'),require('./api/mailMessage'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x27'),require(_0xe8d0('0x28')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x29'),require(_0xe8d0('0x2a')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x2b'),require(_0xe8d0('0x2c')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x2d'),require('./api/dashboardItem'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x2e'),require(_0xe8d0('0x2f')));_0x32cee9['use'](_0xe8d0('0x30'),require(_0xe8d0('0x31')));_0x32cee9['use'](_0xe8d0('0x32'),require(_0xe8d0('0x33')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x34'),require(_0xe8d0('0x35')));_0x32cee9['use'](_0xe8d0('0x36'),require('./api/faxQueue'));_0x32cee9['use']('/api/fax/reports/queue',require(_0xe8d0('0x37')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x38'),require('./api/smsAccount'));_0x32cee9['use'](_0xe8d0('0x39'),require('./api/smsApplication'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x3a'),require(_0xe8d0('0x3b')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x3c'),require('./api/smsMessage'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x3d'),require(_0xe8d0('0x3e')));_0x32cee9[_0xe8d0('0x8')]('/api/openchannel/accounts',require(_0xe8d0('0x3f')));_0x32cee9[_0xe8d0('0x8')]('/api/openchannel/applications',require(_0xe8d0('0x40')));_0x32cee9['use'](_0xe8d0('0x41'),require('./api/openchannelInteraction'));_0x32cee9[_0xe8d0('0x8')]('/api/openchannel/messages',require(_0xe8d0('0x42')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x43'),require(_0xe8d0('0x44')));_0x32cee9['use'](_0xe8d0('0x45'),require(_0xe8d0('0x46')));_0x32cee9[_0xe8d0('0x8')]('/api/openchannel/reports/queue',require(_0xe8d0('0x47')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x48'),require(_0xe8d0('0x49')));_0x32cee9[_0xe8d0('0x8')]('/api/chat/interactions',require(_0xe8d0('0x4a')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x4b'),require(_0xe8d0('0x4c')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x4d'),require(_0xe8d0('0x4e')));_0x32cee9[_0xe8d0('0x8')]('/api/chat/queues',require('./api/chatQueue'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x4f'),require(_0xe8d0('0x50')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x51'),require('./api/chatProactiveAction'));_0x32cee9[_0xe8d0('0x8')]('/api/cm/companies',require(_0xe8d0('0x52')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x53'),require('./api/cmContact'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x54'),require(_0xe8d0('0x55')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x56'),require('./api/cmHopperBlack'));_0x32cee9['use']('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x32cee9[_0xe8d0('0x8')]('/api/cm/hopper_history',require(_0xe8d0('0x57')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x58'),require(_0xe8d0('0x59')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x5a'),require(_0xe8d0('0x5b')));_0x32cee9[_0xe8d0('0x8')]('/api/automations',require(_0xe8d0('0x5c')));_0x32cee9[_0xe8d0('0x8')]('/api/canned_answers',require('./api/cannedAnswer'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x5d'),require(_0xe8d0('0x5e')));_0x32cee9['use'](_0xe8d0('0x5f'),require(_0xe8d0('0x60')));_0x32cee9['use'](_0xe8d0('0x61'),require(_0xe8d0('0x62')));_0x32cee9['use'](_0xe8d0('0x63'),require(_0xe8d0('0x64')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x65'),require(_0xe8d0('0x66')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x67'),require(_0xe8d0('0x68')));_0x32cee9['use'](_0xe8d0('0x69'),require(_0xe8d0('0x6a')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x6b'),require(_0xe8d0('0x6c')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x6d'),require(_0xe8d0('0x6e')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x6f'),require(_0xe8d0('0x70')));_0x32cee9[_0xe8d0('0x8')]('/api/triggers',require(_0xe8d0('0x71')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x72'),require(_0xe8d0('0x73')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x74'),require(_0xe8d0('0x75')));_0x32cee9['use'](_0xe8d0('0x76'),require(_0xe8d0('0x77')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x78'),require('./api/analyticCustomReport'));_0x32cee9[_0xe8d0('0x8')]('/api/analytics/default_reports',require(_0xe8d0('0x79')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x7a'),require(_0xe8d0('0x7b')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x7c'),require(_0xe8d0('0x7d')));_0x32cee9['use'](_0xe8d0('0x7e'),require('./api/analyticFieldReport'));_0x32cee9['use'](_0xe8d0('0x7f'),require('./api/analyticTreeReport'));_0x32cee9[_0xe8d0('0x8')]('/api/integrations/salesforce/accounts',require(_0xe8d0('0x80')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x81'),require(_0xe8d0('0x82')));_0x32cee9['use'](_0xe8d0('0x83'),require(_0xe8d0('0x84')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x85'),require(_0xe8d0('0x86')));_0x32cee9['use'](_0xe8d0('0x87'),require(_0xe8d0('0x88')));_0x32cee9[_0xe8d0('0x8')]('/api/integrations/sugarcrm/fields',require(_0xe8d0('0x89')));_0x32cee9['use']('/api/integrations/desk/accounts',require(_0xe8d0('0x8a')));_0x32cee9[_0xe8d0('0x8')]('/api/integrations/desk/configurations',require(_0xe8d0('0x8b')));_0x32cee9[_0xe8d0('0x8')]('/api/integrations/desk/fields',require(_0xe8d0('0x8c')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x8d'),require(_0xe8d0('0x8e')));_0x32cee9['use'](_0xe8d0('0x8f'),require(_0xe8d0('0x90')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x91'),require('./api/intZohoField'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x92'),require(_0xe8d0('0x93')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x94'),require(_0xe8d0('0x95')));_0x32cee9['use']('/api/integrations/zendesk/fields',require(_0xe8d0('0x96')));_0x32cee9['use'](_0xe8d0('0x97'),require(_0xe8d0('0x98')));_0x32cee9['use']('/api/integrations/freshdesk/configurations',require(_0xe8d0('0x99')));_0x32cee9['use'](_0xe8d0('0x9a'),require('./api/intFreshdeskField'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x9b'),require(_0xe8d0('0x9c')));_0x32cee9['use'](_0xe8d0('0x9d'),require(_0xe8d0('0x9e')));_0x32cee9['use'](_0xe8d0('0x9f'),require('./api/intVtigerField'));_0x32cee9[_0xe8d0('0x8')]('/api/integrations/servicenow/accounts',require(_0xe8d0('0xa0')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xa1'),require(_0xe8d0('0xa2')));_0x32cee9[_0xe8d0('0x8')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x32cee9[_0xe8d0('0x8')]('/api/integrations/dynamics365/accounts',require(_0xe8d0('0xa3')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xa4'),require(_0xe8d0('0xa5')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xa6'),require(_0xe8d0('0xa7')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xa8'),require(_0xe8d0('0xa9')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xaa'),require(_0xe8d0('0xab')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xac'),require('./api/intFreshsalesField'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xad'),require(_0xe8d0('0xae')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xaf'),require('./api/chatQueueReport'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xb0'),require(_0xe8d0('0xb1')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xb2'),require(_0xe8d0('0xb3')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xb4'),require(_0xe8d0('0xb5')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xb6'),require(_0xe8d0('0xb7')));_0x32cee9['use']('/api/sms/reports/queue',require(_0xe8d0('0xb8')));_0x32cee9['use'](_0xe8d0('0xb9'),require(_0xe8d0('0xba')));_0x32cee9['use'](_0xe8d0('0xbb'),require(_0xe8d0('0xbc')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xbd'),require(_0xe8d0('0xbe')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xbf'),require(_0xe8d0('0xc0')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xc1'),require(_0xe8d0('0xc2')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xc3'),require(_0xe8d0('0xc4')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xc5'),require(_0xe8d0('0xc6')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xc7'),require('./api/squareMessage'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xc8'),require(_0xe8d0('0xc9')));_0x32cee9['use'](_0xe8d0('0xca'),require('./api/license'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xcb'),require(_0xe8d0('0xcc')));_0x32cee9['use'](_0xe8d0('0xcd'),require(_0xe8d0('0xce')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xcf'),require(_0xe8d0('0xd0')));_0x32cee9['use'](_0xe8d0('0xd1'),require(_0xe8d0('0xd2')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xd3'),require(_0xe8d0('0xd4')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xd5'),require(_0xe8d0('0xd6')));_0x32cee9['use'](_0xe8d0('0xd7'),require(_0xe8d0('0xd8')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xd9'),require('./api/openchannelTransferReport'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xda'),require(_0xe8d0('0xdb')));_0x32cee9['use'](_0xe8d0('0xdc'),require('./api/cmList'));_0x32cee9[_0xe8d0('0x8')]('/api/voice/prefixes',require(_0xe8d0('0xdd')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xde'),require(_0xe8d0('0xdf')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xe0'),require(_0xe8d0('0xe1')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xe2'),require(_0xe8d0('0xe3')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xe4'),require('./api/userNotification'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xe5'),require(_0xe8d0('0xe6')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xe7'),require(_0xe8d0('0xe8')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xe9'),require(_0xe8d0('0xea')));_0x32cee9[_0xe8d0('0x8')]('/api/whatsapp/messages',require(_0xe8d0('0xeb')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xec'),require(_0xe8d0('0xed')));_0x32cee9[_0xe8d0('0x8')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x32cee9[_0xe8d0('0x8')]('/api/whatsapp/queues',require(_0xe8d0('0xee')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xef'),require('./api/cloudProvider'));_0x32cee9[_0xe8d0('0x8')]('/api/realtime',require(_0xe8d0('0xf0')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xf1'),require(_0xe8d0('0xf2')));_0x32cee9[_0xe8d0('0x8')]('/api/auth/local',require('./api/authLocal'));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xf3'),require(_0xe8d0('0xf4')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xf5'),require(_0xe8d0('0xf6')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xf7'),require(_0xe8d0('0xf8')));_0x32cee9['use'](_0xe8d0('0xf9'),require(_0xe8d0('0xfa')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xfb'),require('./api/version'));_0x32cee9['use'](_0xe8d0('0xfc'),require(_0xe8d0('0xfd')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0xfe'),require(_0xe8d0('0xff')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x100'),require(_0xe8d0('0x101')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x102'),clientSideLogs);_0x32cee9['use'](_0xe8d0('0x103'),express[_0xe8d0('0x104')](path[_0xe8d0('0x105')](config[_0xe8d0('0x106')],_0xe8d0('0x103'))));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x107'),express[_0xe8d0('0x104')](path[_0xe8d0('0x105')](config['root'],'/www')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x108'),express['static'](path[_0xe8d0('0x105')](config[_0xe8d0('0x106')],_0xe8d0('0x108'))));_0x32cee9['use'](_0xe8d0('0x109'),express[_0xe8d0('0x104')](path[_0xe8d0('0x105')](config[_0xe8d0('0x106')],'snippet','3.0.0')));_0x32cee9[_0xe8d0('0x8')](_0xe8d0('0x10a'),express['static'](path['join'](config[_0xe8d0('0x106')],_0xe8d0('0x10b'))));_0x32cee9[_0xe8d0('0x10c')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xe8d0('0x10d')](errors[0x194]);_0x32cee9['route']('/*')['get'](function(_0x44a4bd,_0x3fd5d1){_0x3fd5d1[_0xe8d0('0x10e')](path[_0xe8d0('0x10f')](_0x32cee9[_0xe8d0('0x10d')]('appPath')+_0xe8d0('0x110')));});return _0x32cee9;});}; \ No newline at end of file +var _0x008c=['/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','/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/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareMessage','/api/teams','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','static','root','join','/demo','/snippet','snippet','3.0.0','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceContext','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/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/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport'];(function(_0x19fbf7,_0x630038){var _0x27046c=function(_0x219610){while(--_0x219610){_0x19fbf7['push'](_0x19fbf7['shift']());}};_0x27046c(++_0x630038);}(_0x008c,0x188));var _0xc008=function(_0x54501d,_0x42e8a6){_0x54501d=_0x54501d-0x0;var _0x2b9b2c=_0x008c[_0x54501d];return _0x2b9b2c;};'use strict';var path=require(_0xc008('0x0'));var express=require(_0xc008('0x1'));var errors=require(_0xc008('0x2'));var config=require(_0xc008('0x3'));var setupLoggers=require(_0xc008('0x4'))['setupLoggers'];var clientSideLogs=require(_0xc008('0x5'));exports[_0xc008('0x6')]=function(_0x10b33c){return setupLoggers(_0x10b33c)[_0xc008('0x7')](function(){_0x10b33c[_0xc008('0x8')](_0xc008('0x9'),require(_0xc008('0xa')));_0x10b33c[_0xc008('0x8')](_0xc008('0xb'),require('./api/voiceChanSpy'));_0x10b33c[_0xc008('0x8')]('/api/voice/contexts',require(_0xc008('0xc')));_0x10b33c['use']('/api/voice/extensions',require(_0xc008('0xd')));_0x10b33c[_0xc008('0x8')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x10b33c['use'](_0xc008('0xe'),require(_0xc008('0xf')));_0x10b33c['use'](_0xc008('0x10'),require(_0xc008('0x11')));_0x10b33c[_0xc008('0x8')](_0xc008('0x12'),require(_0xc008('0x13')));_0x10b33c[_0xc008('0x8')](_0xc008('0x14'),require('./api/voiceMail'));_0x10b33c['use'](_0xc008('0x15'),require('./api/voiceMailMessage'));_0x10b33c[_0xc008('0x8')](_0xc008('0x16'),require(_0xc008('0x17')));_0x10b33c[_0xc008('0x8')](_0xc008('0x18'),require('./api/voiceDialReport'));_0x10b33c['use']('/api/voice/agents/reports',require(_0xc008('0x19')));_0x10b33c[_0xc008('0x8')](_0xc008('0x1a'),require(_0xc008('0x1b')));_0x10b33c['use']('/api/members/reports',require('./api/memberReport'));_0x10b33c['use'](_0xc008('0x1c'),require(_0xc008('0x1d')));_0x10b33c['use'](_0xc008('0x1e'),require('./api/voiceTransferReport'));_0x10b33c['use']('/api/mail/out_servers',require('./api/mailServerOut'));_0x10b33c[_0xc008('0x8')]('/api/mail/accounts',require('./api/mailAccount'));_0x10b33c['use']('/api/mail/queues',require('./api/mailQueue'));_0x10b33c[_0xc008('0x8')](_0xc008('0x1f'),require(_0xc008('0x20')));_0x10b33c[_0xc008('0x8')](_0xc008('0x21'),require(_0xc008('0x22')));_0x10b33c['use'](_0xc008('0x23'),require('./api/mailMessage'));_0x10b33c['use'](_0xc008('0x24'),require(_0xc008('0x25')));_0x10b33c[_0xc008('0x8')](_0xc008('0x26'),require('./api/mailQueueReport'));_0x10b33c['use']('/api/dashboards',require(_0xc008('0x27')));_0x10b33c[_0xc008('0x8')](_0xc008('0x28'),require(_0xc008('0x29')));_0x10b33c['use']('/api/fax/accounts',require('./api/faxAccount'));_0x10b33c['use']('/api/fax/applications',require(_0xc008('0x2a')));_0x10b33c[_0xc008('0x8')](_0xc008('0x2b'),require('./api/faxInteraction'));_0x10b33c[_0xc008('0x8')](_0xc008('0x2c'),require(_0xc008('0x2d')));_0x10b33c[_0xc008('0x8')]('/api/fax/queues',require(_0xc008('0x2e')));_0x10b33c[_0xc008('0x8')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x10b33c['use'](_0xc008('0x2f'),require(_0xc008('0x30')));_0x10b33c[_0xc008('0x8')](_0xc008('0x31'),require(_0xc008('0x32')));_0x10b33c[_0xc008('0x8')](_0xc008('0x33'),require(_0xc008('0x34')));_0x10b33c[_0xc008('0x8')](_0xc008('0x35'),require(_0xc008('0x36')));_0x10b33c[_0xc008('0x8')]('/api/sms/queues',require(_0xc008('0x37')));_0x10b33c[_0xc008('0x8')]('/api/openchannel/accounts',require(_0xc008('0x38')));_0x10b33c[_0xc008('0x8')](_0xc008('0x39'),require(_0xc008('0x3a')));_0x10b33c[_0xc008('0x8')](_0xc008('0x3b'),require(_0xc008('0x3c')));_0x10b33c[_0xc008('0x8')](_0xc008('0x3d'),require('./api/openchannelMessage'));_0x10b33c[_0xc008('0x8')](_0xc008('0x3e'),require(_0xc008('0x3f')));_0x10b33c[_0xc008('0x8')](_0xc008('0x40'),require(_0xc008('0x41')));_0x10b33c[_0xc008('0x8')]('/api/openchannel/reports/queue',require(_0xc008('0x42')));_0x10b33c[_0xc008('0x8')]('/api/chat/applications',require(_0xc008('0x43')));_0x10b33c[_0xc008('0x8')]('/api/chat/interactions',require(_0xc008('0x44')));_0x10b33c[_0xc008('0x8')](_0xc008('0x45'),require('./api/chatMessage'));_0x10b33c['use']('/api/chat/offline_messages',require(_0xc008('0x46')));_0x10b33c['use'](_0xc008('0x47'),require(_0xc008('0x48')));_0x10b33c[_0xc008('0x8')](_0xc008('0x49'),require(_0xc008('0x4a')));_0x10b33c[_0xc008('0x8')](_0xc008('0x4b'),require(_0xc008('0x4c')));_0x10b33c[_0xc008('0x8')](_0xc008('0x4d'),require(_0xc008('0x4e')));_0x10b33c[_0xc008('0x8')](_0xc008('0x4f'),require(_0xc008('0x50')));_0x10b33c['use'](_0xc008('0x51'),require(_0xc008('0x52')));_0x10b33c[_0xc008('0x8')](_0xc008('0x53'),require('./api/cmHopperBlack'));_0x10b33c[_0xc008('0x8')](_0xc008('0x54'),require(_0xc008('0x55')));_0x10b33c[_0xc008('0x8')](_0xc008('0x56'),require('./api/cmHopperHistory'));_0x10b33c[_0xc008('0x8')](_0xc008('0x57'),require(_0xc008('0x58')));_0x10b33c[_0xc008('0x8')](_0xc008('0x59'),require('./api/action'));_0x10b33c[_0xc008('0x8')](_0xc008('0x5a'),require(_0xc008('0x5b')));_0x10b33c[_0xc008('0x8')]('/api/canned_answers',require(_0xc008('0x5c')));_0x10b33c[_0xc008('0x8')](_0xc008('0x5d'),require('./api/disposition'));_0x10b33c[_0xc008('0x8')]('/api/conditions',require(_0xc008('0x5e')));_0x10b33c['use'](_0xc008('0x5f'),require(_0xc008('0x60')));_0x10b33c['use'](_0xc008('0x61'),require(_0xc008('0x62')));_0x10b33c[_0xc008('0x8')]('/api/cdr',require(_0xc008('0x63')));_0x10b33c[_0xc008('0x8')](_0xc008('0x64'),require(_0xc008('0x65')));_0x10b33c[_0xc008('0x8')](_0xc008('0x66'),require('./api/schedule'));_0x10b33c['use']('/api/sounds',require(_0xc008('0x67')));_0x10b33c[_0xc008('0x8')](_0xc008('0x68'),require(_0xc008('0x69')));_0x10b33c[_0xc008('0x8')](_0xc008('0x6a'),require(_0xc008('0x6b')));_0x10b33c[_0xc008('0x8')]('/api/triggers',require('./api/trigger'));_0x10b33c['use'](_0xc008('0x6c'),require(_0xc008('0x6d')));_0x10b33c[_0xc008('0x8')]('/api/integrations',require(_0xc008('0x6e')));_0x10b33c[_0xc008('0x8')](_0xc008('0x6f'),require(_0xc008('0x70')));_0x10b33c[_0xc008('0x8')](_0xc008('0x71'),require(_0xc008('0x72')));_0x10b33c[_0xc008('0x8')](_0xc008('0x73'),require(_0xc008('0x74')));_0x10b33c['use']('/api/analytics/extracted_reports',require(_0xc008('0x75')));_0x10b33c['use'](_0xc008('0x76'),require(_0xc008('0x77')));_0x10b33c[_0xc008('0x8')]('/api/analytics/field_reports',require(_0xc008('0x78')));_0x10b33c[_0xc008('0x8')](_0xc008('0x79'),require(_0xc008('0x7a')));_0x10b33c[_0xc008('0x8')]('/api/integrations/salesforce/accounts',require(_0xc008('0x7b')));_0x10b33c[_0xc008('0x8')]('/api/integrations/salesforce/configurations',require(_0xc008('0x7c')));_0x10b33c[_0xc008('0x8')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x10b33c[_0xc008('0x8')](_0xc008('0x7d'),require(_0xc008('0x7e')));_0x10b33c[_0xc008('0x8')](_0xc008('0x7f'),require('./api/intSugarcrmConfiguration'));_0x10b33c['use'](_0xc008('0x80'),require('./api/intSugarcrmField'));_0x10b33c[_0xc008('0x8')](_0xc008('0x81'),require(_0xc008('0x82')));_0x10b33c[_0xc008('0x8')](_0xc008('0x83'),require(_0xc008('0x84')));_0x10b33c['use'](_0xc008('0x85'),require(_0xc008('0x86')));_0x10b33c[_0xc008('0x8')](_0xc008('0x87'),require(_0xc008('0x88')));_0x10b33c['use'](_0xc008('0x89'),require('./api/intZohoConfiguration'));_0x10b33c['use']('/api/integrations/zoho/fields',require(_0xc008('0x8a')));_0x10b33c[_0xc008('0x8')](_0xc008('0x8b'),require('./api/intZendeskAccount'));_0x10b33c[_0xc008('0x8')](_0xc008('0x8c'),require(_0xc008('0x8d')));_0x10b33c['use'](_0xc008('0x8e'),require(_0xc008('0x8f')));_0x10b33c[_0xc008('0x8')](_0xc008('0x90'),require('./api/intFreshdeskAccount'));_0x10b33c[_0xc008('0x8')]('/api/integrations/freshdesk/configurations',require(_0xc008('0x91')));_0x10b33c[_0xc008('0x8')](_0xc008('0x92'),require(_0xc008('0x93')));_0x10b33c[_0xc008('0x8')](_0xc008('0x94'),require('./api/intVtigerAccount'));_0x10b33c[_0xc008('0x8')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x10b33c[_0xc008('0x8')](_0xc008('0x95'),require('./api/intVtigerField'));_0x10b33c[_0xc008('0x8')](_0xc008('0x96'),require(_0xc008('0x97')));_0x10b33c[_0xc008('0x8')](_0xc008('0x98'),require(_0xc008('0x99')));_0x10b33c[_0xc008('0x8')]('/api/integrations/servicenow/fields',require(_0xc008('0x9a')));_0x10b33c[_0xc008('0x8')](_0xc008('0x9b'),require(_0xc008('0x9c')));_0x10b33c[_0xc008('0x8')](_0xc008('0x9d'),require(_0xc008('0x9e')));_0x10b33c[_0xc008('0x8')](_0xc008('0x9f'),require(_0xc008('0xa0')));_0x10b33c[_0xc008('0x8')](_0xc008('0xa1'),require(_0xc008('0xa2')));_0x10b33c[_0xc008('0x8')]('/api/integrations/freshsales/configurations',require(_0xc008('0xa3')));_0x10b33c[_0xc008('0x8')](_0xc008('0xa4'),require('./api/intFreshsalesField'));_0x10b33c[_0xc008('0x8')](_0xc008('0xa5'),require('./api/network'));_0x10b33c['use'](_0xc008('0xa6'),require(_0xc008('0xa7')));_0x10b33c[_0xc008('0x8')](_0xc008('0xa8'),require(_0xc008('0xa9')));_0x10b33c[_0xc008('0x8')](_0xc008('0xaa'),require(_0xc008('0xab')));_0x10b33c[_0xc008('0x8')](_0xc008('0xac'),require(_0xc008('0xad')));_0x10b33c['use'](_0xc008('0xae'),require(_0xc008('0xaf')));_0x10b33c[_0xc008('0x8')](_0xc008('0xb0'),require('./api/smsQueueReport'));_0x10b33c[_0xc008('0x8')]('/api/square/reports',require(_0xc008('0xb1')));_0x10b33c[_0xc008('0x8')](_0xc008('0xb2'),require('./api/squareReportDetail'));_0x10b33c[_0xc008('0x8')](_0xc008('0xb3'),require(_0xc008('0xb4')));_0x10b33c['use'](_0xc008('0xb5'),require('./api/setting'));_0x10b33c[_0xc008('0x8')](_0xc008('0xb6'),require(_0xc008('0xb7')));_0x10b33c[_0xc008('0x8')](_0xc008('0xb8'),require('./api/squareProject'));_0x10b33c[_0xc008('0x8')](_0xc008('0xb9'),require('./api/squareRecording'));_0x10b33c[_0xc008('0x8')]('/api/square/messages',require(_0xc008('0xba')));_0x10b33c['use'](_0xc008('0xbb'),require('./api/team'));_0x10b33c[_0xc008('0x8')](_0xc008('0xbc'),require(_0xc008('0xbd')));_0x10b33c[_0xc008('0x8')]('/api/campaigns',require(_0xc008('0xbe')));_0x10b33c[_0xc008('0x8')](_0xc008('0xbf'),require(_0xc008('0xc0')));_0x10b33c[_0xc008('0x8')](_0xc008('0xc1'),require(_0xc008('0xc2')));_0x10b33c[_0xc008('0x8')]('/api/plugins',require(_0xc008('0xc3')));_0x10b33c['use']('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x10b33c[_0xc008('0x8')](_0xc008('0xc4'),require(_0xc008('0xc5')));_0x10b33c[_0xc008('0x8')](_0xc008('0xc6'),require(_0xc008('0xc7')));_0x10b33c[_0xc008('0x8')](_0xc008('0xc8'),require(_0xc008('0xc9')));_0x10b33c['use'](_0xc008('0xca'),require(_0xc008('0xcb')));_0x10b33c[_0xc008('0x8')](_0xc008('0xcc'),require(_0xc008('0xcd')));_0x10b33c[_0xc008('0x8')](_0xc008('0xce'),require(_0xc008('0xcf')));_0x10b33c[_0xc008('0x8')](_0xc008('0xd0'),require(_0xc008('0xd1')));_0x10b33c[_0xc008('0x8')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x10b33c[_0xc008('0x8')](_0xc008('0xd2'),require(_0xc008('0xd3')));_0x10b33c['use'](_0xc008('0xd4'),require(_0xc008('0xd5')));_0x10b33c['use']('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x10b33c[_0xc008('0x8')](_0xc008('0xd6'),require(_0xc008('0xd7')));_0x10b33c[_0xc008('0x8')](_0xc008('0xd8'),require(_0xc008('0xd9')));_0x10b33c[_0xc008('0x8')](_0xc008('0xda'),require(_0xc008('0xdb')));_0x10b33c[_0xc008('0x8')]('/api/whatsapp/reports/queue',require('./api/whatsappQueueReport'));_0x10b33c[_0xc008('0x8')](_0xc008('0xdc'),require(_0xc008('0xdd')));_0x10b33c[_0xc008('0x8')](_0xc008('0xde'),require(_0xc008('0xdf')));_0x10b33c['use']('/api/cloudProviders',require(_0xc008('0xe0')));_0x10b33c[_0xc008('0x8')](_0xc008('0xe1'),require('./api/realtime'));_0x10b33c['use']('/api/user-settings',require('./api/user-setting'));_0x10b33c['use']('/api/auth/local',require(_0xc008('0xe2')));_0x10b33c['use'](_0xc008('0xe3'),require('./api/authGoogle'));_0x10b33c[_0xc008('0x8')](_0xc008('0xe4'),require(_0xc008('0xe5')));_0x10b33c['use']('/api/jira',require(_0xc008('0xe6')));_0x10b33c['use'](_0xc008('0xe7'),require(_0xc008('0xe8')));_0x10b33c['use'](_0xc008('0xe9'),require('./api/version'));_0x10b33c['use'](_0xc008('0xea'),require(_0xc008('0xeb')));_0x10b33c['use'](_0xc008('0xec'),require(_0xc008('0xed')));_0x10b33c[_0xc008('0x8')]('/api/webbar',require(_0xc008('0xee')));_0x10b33c[_0xc008('0x8')](_0xc008('0xef'),clientSideLogs);_0x10b33c[_0xc008('0x8')](_0xc008('0xf0'),express[_0xc008('0xf1')](path['join'](config[_0xc008('0xf2')],_0xc008('0xf0'))));_0x10b33c[_0xc008('0x8')]('/www',express[_0xc008('0xf1')](path[_0xc008('0xf3')](config[_0xc008('0xf2')],'/www')));_0x10b33c['use']('/demo',express[_0xc008('0xf1')](path[_0xc008('0xf3')](config[_0xc008('0xf2')],_0xc008('0xf4'))));_0x10b33c[_0xc008('0x8')](_0xc008('0xf5'),express[_0xc008('0xf1')](path[_0xc008('0xf3')](config['root'],_0xc008('0xf6'),_0xc008('0xf7'))));_0x10b33c['use']('/plugins',express[_0xc008('0xf1')](path[_0xc008('0xf3')](config[_0xc008('0xf2')],_0xc008('0xf8'))));_0x10b33c[_0xc008('0xf9')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xc008('0xfa')](errors[0x194]);_0x10b33c[_0xc008('0xf9')]('/*')['get'](function(_0xb02bd,_0x1cc68f){_0x1cc68f[_0xc008('0xfb')](path[_0xc008('0xfc')](_0x10b33c['get'](_0xc008('0xfd'))+_0xc008('0xfe')));});return _0x10b33c;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index d536f8f..dbf4df5 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b49=['../api/mailAccount/mailAccount.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.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/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc'];(function(_0x7d3c37,_0x3e6c64){var _0x3cdefd=function(_0x111c98){while(--_0x111c98){_0x7d3c37['push'](_0x7d3c37['shift']());}};_0x3cdefd(++_0x3e6c64);}(_0x1b49,0x1f0));var _0x91b4=function(_0x5ee2db,_0x47ea25){_0x5ee2db=_0x5ee2db-0x0;var _0x2cab07=_0x1b49[_0x5ee2db];return _0x2cab07;};'use strict';var jayson=require(_0x91b4('0x0'));var _=require('lodash');var config=require(_0x91b4('0x1'));exports[_0x91b4('0x2')]=function(){return new Promise(function(_0x4e5dc6,_0x3e0730){var _0x2e39cd={};_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x4')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x5')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x6')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x7')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0x8')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x9')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0xa')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0xb')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0xc')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0xd')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0xe')));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0xf')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require('../api/mailQueue/mailQueue.rpc'));_0x2e39cd=_['merge'](_0x2e39cd,require('../api/mailInteraction/mailInteraction.rpc'));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x10')));_0x2e39cd=_['merge'](_0x2e39cd,require('../api/mailApplication/mailApplication.rpc'));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x11')));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0x12')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require('../api/faxApplication/faxApplication.rpc'));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x13')));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0x14')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require('../api/faxQueue/faxQueue.rpc'));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x15')));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0x16')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x17')));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0x18')));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0x19')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x1a')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x1b')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x1c')));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0x1d')));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0x1e')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x1f')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x20')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x21')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x22')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x23')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x24')));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0x25')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x26')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x27')));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0x28')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require('../api/trigger/trigger.rpc'));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0x29')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x2a')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x2b')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x2c')));_0x2e39cd=_['merge'](_0x2e39cd,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x2d')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x2e')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x2f')));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0x30')));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0x31')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x32')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x33')));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0x34')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require('../api/setting/setting.rpc'));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x35')));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0x36')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x37')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require('../api/squareMessage/squareMessage.rpc'));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x38')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x39')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x3a')));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0x3b')));_0x2e39cd=_['merge'](_0x2e39cd,require(_0x91b4('0x3c')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x3d')));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x2e39cd=_[_0x91b4('0x3')](_0x2e39cd,require(_0x91b4('0x3e')));var _0xd629ed=jayson[_0x91b4('0x3f')](_0x2e39cd)[_0x91b4('0x40')]();var _0x4e5991=config[_0x91b4('0x41')]['port']||config[_0x91b4('0x42')]+0x1;var _0x5ece14=config[_0x91b4('0x41')]['ip']||_0x91b4('0x43');_0xd629ed['on'](_0x91b4('0x44'),function(_0x4c8a77){return _0x3e0730(_0x4c8a77);});_0xd629ed['listen'](_0x4e5991,_0x5ece14,function(){console[_0x91b4('0x45')](_0x91b4('0x46'),_0x5ece14,_0x4e5991);require(_0x91b4('0x47'))['default']();return _0x4e5dc6(_0x91b4('0x48')+_0x5ece14+':'+_0x4e5991);});});}; \ No newline at end of file +var _0xca02=['../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xca02,0x1e0));var _0x2ca0=function(_0x485e7a,_0x3fd29d){_0x485e7a=_0x485e7a-0x0;var _0x366deb=_0xca02[_0x485e7a];return _0x366deb;};'use strict';var jayson=require('jayson/promise');var _=require(_0x2ca0('0x0'));var config=require(_0x2ca0('0x1'));exports[_0x2ca0('0x2')]=function(){return new Promise(function(_0x45bce3,_0x5b1626){var _0x3a1816={};_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x3')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x5')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x6')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x7')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x8')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x9')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0xa')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/memberReport/memberReport.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0xb')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/mailServerIn/mailServerIn.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0xc')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/mailQueue/mailQueue.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0xd')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0xe')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/mailApplication/mailApplication.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0xf')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x10')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x11')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x12')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x13')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x14')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x15')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x16')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x17')));_0x3a1816=_['merge'](_0x3a1816,require('../api/smsMessage/smsMessage.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x18')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x19')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x1a')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x1b')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x1c')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x1d')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/cmContact/cmContact.rpc'));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x1e')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x1f')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x20')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x21')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x22')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x23')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x24')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/sound/sound.rpc'));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x25')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x26')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x27')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x28')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x29')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x2a')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x2b')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x2c')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x2d')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x2e')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x2f')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x30')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x31')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x32')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x33')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x34')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/squareRecording/squareRecording.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x35')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x36')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x37')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x38')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x39')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x3a')));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x3a1816=_[_0x2ca0('0x4')](_0x3a1816,require(_0x2ca0('0x3b')));_0x3a1816=_['merge'](_0x3a1816,require(_0x2ca0('0x3c')));var _0x19f1b2=jayson['server'](_0x3a1816)[_0x2ca0('0x3d')]();var _0x579410=config[_0x2ca0('0x3e')][_0x2ca0('0x3f')]||config[_0x2ca0('0x3f')]+0x1;var _0x3b1d1e=config['rpc']['ip']||_0x2ca0('0x40');_0x19f1b2['on'](_0x2ca0('0x41'),function(_0x146ac0){return _0x5b1626(_0x146ac0);});_0x19f1b2[_0x2ca0('0x2')](_0x579410,_0x3b1d1e,function(){console[_0x2ca0('0x42')](_0x2ca0('0x43'),_0x3b1d1e,_0x579410);require(_0x2ca0('0x44'))[_0x2ca0('0x45')]();return _0x45bce3('RPC\x20listening\x20on\x20'+_0x3b1d1e+':'+_0x579410);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 4cd3ec8..350c3fa 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 _0x2b10=['prototype','sendRequest','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','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','exec','AGI','wait','WAIT','label','exports','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','write','inherits'];(function(_0x56f227,_0x5211b7){var _0x374c65=function(_0x12d4a0){while(--_0x12d4a0){_0x56f227['push'](_0x56f227['shift']());}};_0x374c65(++_0x5211b7);}(_0x2b10,0x114));var _0x02b1=function(_0x6bc53,_0x5955dc){_0x6bc53=_0x6bc53-0x0;var _0x51cbc4=_0x2b10[_0x6bc53];return _0x51cbc4;};'use strict';var util=require(_0x02b1('0x0'));var _=require('lodash');var EventEmitter=require(_0x02b1('0x1'))[_0x02b1('0x2')];var AGIReply=require(_0x02b1('0x3'));var AGIError=require(_0x02b1('0x4'));function AGIChannel(_0xba11ee){var _0x582561=this,_0x24f889=new AGIReply(),_0x5900ca=![],_0x51f63e={};EventEmitter[_0x02b1('0x5')](_0x582561);_0xba11ee[_0x02b1('0x6')](_0x02b1('0x7'));_0xba11ee[_0x02b1('0x8')](0x8*0x3c*0x3c*0x3e8);_0x24f889['setEncoding'](_0x02b1('0x7'));_0x24f889['on'](_0x02b1('0x9'),function(_0x88baeb){for(var _0x647b17 in _0x88baeb){_0x582561[_0x647b17]=_0x88baeb[_0x647b17];}_0x582561[_0x02b1('0xa')](_0x02b1('0xb'));});_0x24f889['on'](_0x02b1('0xc'),function(_0x5d18f2){if(_0x5d18f2['toLowerCase']()==_0x02b1('0xd')){_0x582561[_0x02b1('0xa')](_0x02b1('0xd'));return;}if(_0x5d18f2['substring'](0x0,0xb)==_0x02b1('0xe')){_0x5900ca=!![];}if(_0x5900ca){_0x51f63e['rx']+=_0x5d18f2+'\x0a';if(_0x5d18f2[_0x02b1('0xf')](_0x02b1('0x10'))!=-0x1){_0x5900ca=![];}}else{_0x51f63e['rx']=_0x5d18f2;}if(_0x5900ca){return;}if(typeof _0x51f63e['cb']==_0x02b1('0x11')){var _0x1be1fc=_0x51f63e['rx'][_0x02b1('0x12')](0x0,0x3),_0x4908a3=null,_0x2920c9=null;_0x1be1fc=parseInt(_0x1be1fc);if(isNaN(_0x1be1fc)){_0x51f63e['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x1be1fc!=0xc8){_0x51f63e['cb'](null,{'code':_0x1be1fc,'result':-0x1,'extra':'KO'});return;}_0x4908a3=_0x51f63e['rx'][_0x02b1('0x12')](0x4)[_0x02b1('0x13')]('result=','');if(_0x4908a3[_0x02b1('0x14')]('\x20')!=-0x1){_0x4908a3=_0x4908a3[_0x02b1('0x15')](0x0,_0x4908a3[_0x02b1('0x14')]('\x20'));}if(_[_0x02b1('0x16')](_0x4908a3,'-1')){_0x4908a3=parseInt(_0x4908a3);}_0x2920c9=_0x51f63e['rx'][_0x02b1('0x17')]('\x20');if(_0x2920c9[_0x02b1('0x18')]==0x3){_0x2920c9=_0x2920c9[0x2][_0x02b1('0x12')](0x1,_0x2920c9[0x2][_0x02b1('0x18')]-0x1);}else if(_0x2920c9['length']>0x3){var _0x311cb7=/\((.+)\)/;var _0x3a6cf5=_0x51f63e['rx'][_0x02b1('0x19')](_0x311cb7);if(_0x3a6cf5){_0x2920c9=_0x3a6cf5[0x1];}else{_0x2920c9=null;}}else{_0x2920c9=null;}_0x51f63e['cb'](null,{'code':_0x1be1fc,'result':_0x4908a3,'extra':_0x2920c9});}});_0xba11ee['on'](_0x02b1('0x1a'),function(_0x3054e8){_0x582561[_0x02b1('0xa')](_0x02b1('0x1a'),new AGIError(_0x02b1('0x1b'),_0x3054e8['code']));});_0xba11ee['on'](_0x02b1('0x1c'),function(){_0x582561[_0x02b1('0xa')](_0x02b1('0x1c'),new AGIError(_0x02b1('0x1d')));});_0xba11ee['on']('timeout',function(){_0x582561[_0x02b1('0xa')](_0x02b1('0x1e'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0xba11ee[_0x02b1('0x1f')]();});_0xba11ee[_0x02b1('0x20')](_0x24f889);this[_0x02b1('0x21')]=function(_0x57960a,_0x6622fb){var _0x57960a=_0x57960a||'',_0x6622fb=typeof _0x6622fb==_0x02b1('0x11')?_0x6622fb:new Function();_0x51f63e={'tx':_0x57960a,'rx':'','cb':_0x6622fb};_0xba11ee[_0x02b1('0x22')](_0x57960a+'\x0a');},this[_0x02b1('0x1c')]=function(){_0xba11ee['destroy']();};}util[_0x02b1('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x02b1('0x24')][_0x02b1('0x25')]=function(_0x24a373){return this[_0x02b1('0x21')]['sync'](this,_0x24a373);};AGIChannel[_0x02b1('0x24')][_0x02b1('0x26')]=function(){return this[_0x02b1('0x25')](_0x02b1('0x27'));};AGIChannel[_0x02b1('0x24')][_0x02b1('0x28')]=function(_0x568286,_0x1e49f7,_0x3ab546){_0x568286=_0x568286===undefined?_0x02b1('0x29'):_0x568286;_0x1e49f7=_0x1e49f7===undefined?'5':_0x1e49f7;_0x3ab546=_0x3ab546===undefined?'1':_0x3ab546;return this[_0x02b1('0x25')](util[_0x02b1('0x2a')](_0x02b1('0x2b'),_0x568286,_0x1e49f7*0x3e8,_0x3ab546));};AGIChannel[_0x02b1('0x24')][_0x02b1('0x2c')]=function(_0x46751b){_0x46751b=_0x46751b||'NO\x20MESSAGE';return this[_0x02b1('0x25')](util[_0x02b1('0x2a')](_0x02b1('0x2d'),_0x46751b));};AGIChannel[_0x02b1('0x24')]['exec']=function(_0x1fbfaa,_0xf50e00){if(_[_0x02b1('0x2e')](_0xf50e00)){return this[_0x02b1('0x25')](util['format'](_0x02b1('0x2f'),_0x1fbfaa,_0xf50e00[_0x02b1('0x30')](',')));}return this['sendRequest'](util[_0x02b1('0x2a')](_0x02b1('0x2f'),_0x1fbfaa,_0xf50e00));};AGIChannel['prototype']['setContext']=function(_0x216682){return this[_0x02b1('0x25')](util['format'](_0x02b1('0x31'),_0x216682));};AGIChannel[_0x02b1('0x24')][_0x02b1('0x32')]=function(_0x277f11){return this[_0x02b1('0x25')](util[_0x02b1('0x2a')](_0x02b1('0x33'),_0x277f11));};AGIChannel[_0x02b1('0x24')][_0x02b1('0x34')]=function(_0x26d09b){return this[_0x02b1('0x25')](util[_0x02b1('0x2a')](_0x02b1('0x35'),_0x26d09b));};AGIChannel['prototype'][_0x02b1('0xd')]=function(){return this[_0x02b1('0x25')](_0x02b1('0x36'));};AGIChannel[_0x02b1('0x24')]['setVariable']=function(_0x27fb45,_0xf67267){var _0x11ae4a=_[_0x02b1('0x37')](_0xf67267)||_['isNumber'](_0xf67267)?_0xf67267['toString']():_0xf67267;return this[_0x02b1('0x25')](util[_0x02b1('0x2a')](_0x02b1('0x38'),_0x27fb45,_0x11ae4a?_0x11ae4a['toString']()[_0x02b1('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x02b1('0x24')]['sayNumber']=function(_0x213dac,_0x1c60ba){return this['sendRequest'](util[_0x02b1('0x2a')](_0x02b1('0x39'),_0x213dac,_0x1c60ba));};AGIChannel[_0x02b1('0x24')][_0x02b1('0x3a')]=function(_0xedffd0,_0x311172){return this[_0x02b1('0x25')](util[_0x02b1('0x2a')](_0x02b1('0x3b'),_0xedffd0,_0x311172));};AGIChannel[_0x02b1('0x24')]['sayPhonetic']=function(_0x577733,_0x332001){return this['sendRequest'](util[_0x02b1('0x2a')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x577733,_0x332001));};AGIChannel[_0x02b1('0x24')][_0x02b1('0x3c')]=function(_0x545203,_0x4613b7,_0xc37a82){_0x4613b7=_0x4613b7||this[_0x02b1('0x3d')];_0xc37a82=_0xc37a82||0x1;this[_0x02b1('0x3e')](_0x545203);this[_0x02b1('0x32')](_0x4613b7);this[_0x02b1('0x34')](_0xc37a82);return this[_0x02b1('0x2c')](util['format'](_0x02b1('0x3f'),_0x545203,_0x4613b7,_0xc37a82));};AGIChannel[_0x02b1('0x24')][_0x02b1('0x40')]=function(_0x1d6c20){return this[_0x02b1('0x25')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x1d6c20));};AGIChannel['prototype'][_0x02b1('0x41')]=function(_0x17604a,_0x26aed0,_0x36e6ba,_0x51347e,_0x15485d,_0x4df65d){_0x26aed0=_0x26aed0||_0x02b1('0x42');_0x36e6ba=_0x36e6ba||'';_0x51347e=_0x51347e===undefined?-0x1:_0x51347e==='-1'?-0x1:_0x51347e*0x3e8;_0x15485d=_0x15485d===undefined?'':'s='+_0x15485d;_0x4df65d=_0x4df65d?_0x02b1('0x43'):'';return this[_0x02b1('0x25')](util[_0x02b1('0x2a')](_0x02b1('0x44'),_0x17604a,_0x26aed0,_0x36e6ba,_0x51347e,_0x4df65d,_0x15485d));};AGIChannel[_0x02b1('0x24')][_0x02b1('0x45')]=function(_0x1494ce,_0x390acb){_0x390acb=_0x390acb||'';return this['sendRequest'](util[_0x02b1('0x2a')](_0x02b1('0x46'),_0x1494ce,_0x390acb));};AGIChannel[_0x02b1('0x24')][_0x02b1('0x47')]=function(_0x44f25c){return this[_0x02b1('0x48')](_0x02b1('0x49'),_0x44f25c);};AGIChannel['prototype'][_0x02b1('0x4a')]=function(_0xb7a475){return this['exec'](_0x02b1('0x4b'),_0xb7a475);};AGIChannel[_0x02b1('0x24')]['error']=function(_0x47adf2,_0x2eae51){this[_0x02b1('0x2c')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x47adf2['id'],_0x47adf2[_0x02b1('0x4c')],_0x2eae51));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x02b1('0x4d')]=AGIChannel; \ No newline at end of file +var _0xf271=['startsWith','split','length','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','sendRequest','sync','prototype','answer','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','events','EventEmitter','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','result=','indexOf','substr'];(function(_0x57a154,_0x5b0077){var _0x4bbb7e=function(_0x10fa34){while(--_0x10fa34){_0x57a154['push'](_0x57a154['shift']());}};_0x4bbb7e(++_0x5b0077);}(_0xf271,0x10b));var _0x1f27=function(_0x42be10,_0x44767f){_0x42be10=_0x42be10-0x0;var _0x4322ce=_0xf271[_0x42be10];return _0x4322ce;};'use strict';var util=require(_0x1f27('0x0'));var _=require('lodash');var EventEmitter=require(_0x1f27('0x1'))[_0x1f27('0x2')];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x192c2e){var _0x1bec69=this,_0xc86d8c=new AGIReply(),_0x2a5241=![],_0x3704e3={};EventEmitter[_0x1f27('0x3')](_0x1bec69);_0x192c2e[_0x1f27('0x4')](_0x1f27('0x5'));_0x192c2e[_0x1f27('0x6')](0x8*0x3c*0x3c*0x3e8);_0xc86d8c[_0x1f27('0x4')](_0x1f27('0x5'));_0xc86d8c['on'](_0x1f27('0x7'),function(_0xf12834){for(var _0x1eee62 in _0xf12834){_0x1bec69[_0x1eee62]=_0xf12834[_0x1eee62];}_0x1bec69[_0x1f27('0x8')](_0x1f27('0x9'));});_0xc86d8c['on'](_0x1f27('0xa'),function(_0x1913f4){if(_0x1913f4[_0x1f27('0xb')]()=='hangup'){_0x1bec69[_0x1f27('0x8')]('hangup');return;}if(_0x1913f4[_0x1f27('0xc')](0x0,0xb)==_0x1f27('0xd')){_0x2a5241=!![];}if(_0x2a5241){_0x3704e3['rx']+=_0x1913f4+'\x0a';if(_0x1913f4[_0x1f27('0xe')](_0x1f27('0xf'))!=-0x1){_0x2a5241=![];}}else{_0x3704e3['rx']=_0x1913f4;}if(_0x2a5241){return;}if(typeof _0x3704e3['cb']==_0x1f27('0x10')){var _0x46adbd=_0x3704e3['rx'][_0x1f27('0xc')](0x0,0x3),_0x2781fc=null,_0x4ce87d=null;_0x46adbd=parseInt(_0x46adbd);if(isNaN(_0x46adbd)){_0x3704e3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1f27('0x11')});return;}if(_0x46adbd!=0xc8){_0x3704e3['cb'](null,{'code':_0x46adbd,'result':-0x1,'extra':'KO'});return;}_0x2781fc=_0x3704e3['rx'][_0x1f27('0xc')](0x4)['replace'](_0x1f27('0x12'),'');if(_0x2781fc[_0x1f27('0x13')]('\x20')!=-0x1){_0x2781fc=_0x2781fc[_0x1f27('0x14')](0x0,_0x2781fc[_0x1f27('0x13')]('\x20'));}if(_[_0x1f27('0x15')](_0x2781fc,'-1')){_0x2781fc=parseInt(_0x2781fc);}_0x4ce87d=_0x3704e3['rx'][_0x1f27('0x16')]('\x20');if(_0x4ce87d[_0x1f27('0x17')]==0x3){_0x4ce87d=_0x4ce87d[0x2]['substring'](0x1,_0x4ce87d[0x2][_0x1f27('0x17')]-0x1);}else if(_0x4ce87d[_0x1f27('0x17')]>0x3){var _0x3cda5b=/\((.+)\)/;var _0xb7a71a=_0x3704e3['rx']['match'](_0x3cda5b);if(_0xb7a71a){_0x4ce87d=_0xb7a71a[0x1];}else{_0x4ce87d=null;}}else{_0x4ce87d=null;}_0x3704e3['cb'](null,{'code':_0x46adbd,'result':_0x2781fc,'extra':_0x4ce87d});}});_0x192c2e['on'](_0x1f27('0x18'),function(_0x338680){_0x1bec69[_0x1f27('0x8')](_0x1f27('0x18'),new AGIError(_0x1f27('0x19'),_0x338680['code']));});_0x192c2e['on'](_0x1f27('0x1a'),function(){_0x1bec69[_0x1f27('0x8')](_0x1f27('0x1a'),new AGIError(_0x1f27('0x1b')));});_0x192c2e['on']('timeout',function(){_0x1bec69[_0x1f27('0x8')]('timeout',new AGIError(_0x1f27('0x1c')));_0x192c2e[_0x1f27('0x1d')]();});_0x192c2e[_0x1f27('0x1e')](_0xc86d8c);this[_0x1f27('0x1f')]=function(_0x1df49f,_0x1831d1){var _0x1df49f=_0x1df49f||'',_0x1831d1=typeof _0x1831d1==_0x1f27('0x10')?_0x1831d1:new Function();_0x3704e3={'tx':_0x1df49f,'rx':'','cb':_0x1831d1};_0x192c2e[_0x1f27('0x20')](_0x1df49f+'\x0a');},this[_0x1f27('0x1a')]=function(){_0x192c2e['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x1f27('0x21')]=function(_0x3d00c2){return this[_0x1f27('0x1f')][_0x1f27('0x22')](this,_0x3d00c2);};AGIChannel[_0x1f27('0x23')][_0x1f27('0x24')]=function(){return this[_0x1f27('0x21')]('ANSWER');};AGIChannel['prototype']['getData']=function(_0x1ed51d,_0x16e115,_0x5e090a){_0x1ed51d=_0x1ed51d===undefined?_0x1f27('0x25'):_0x1ed51d;_0x16e115=_0x16e115===undefined?'5':_0x16e115;_0x5e090a=_0x5e090a===undefined?'1':_0x5e090a;return this[_0x1f27('0x21')](util[_0x1f27('0x26')](_0x1f27('0x27'),_0x1ed51d,_0x16e115*0x3e8,_0x5e090a));};AGIChannel['prototype'][_0x1f27('0x28')]=function(_0x3975e1){_0x3975e1=_0x3975e1||_0x1f27('0x29');return this[_0x1f27('0x21')](util[_0x1f27('0x26')](_0x1f27('0x2a'),_0x3975e1));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x2b')]=function(_0x276f2d,_0x43728e){if(_[_0x1f27('0x2c')](_0x43728e)){return this[_0x1f27('0x21')](util['format'](_0x1f27('0x2d'),_0x276f2d,_0x43728e[_0x1f27('0x2e')](',')));}return this[_0x1f27('0x21')](util[_0x1f27('0x26')](_0x1f27('0x2d'),_0x276f2d,_0x43728e));};AGIChannel['prototype'][_0x1f27('0x2f')]=function(_0x10c2bf){return this['sendRequest'](util[_0x1f27('0x26')](_0x1f27('0x30'),_0x10c2bf));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x31')]=function(_0x1a8993){return this[_0x1f27('0x21')](util['format']('SET\x20EXTENSION\x20%s',_0x1a8993));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x32')]=function(_0x3eabb1){return this[_0x1f27('0x21')](util[_0x1f27('0x26')]('SET\x20PRIORITY\x20%s',_0x3eabb1));};AGIChannel[_0x1f27('0x23')]['hangup']=function(){return this[_0x1f27('0x21')](_0x1f27('0x33'));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x34')]=function(_0x1574a7,_0x5792ea){var _0x341101=_[_0x1f27('0x35')](_0x5792ea)||_[_0x1f27('0x36')](_0x5792ea)?_0x5792ea['toString']():_0x5792ea;return this[_0x1f27('0x21')](util['format'](_0x1f27('0x37'),_0x1574a7,_0x341101?_0x341101[_0x1f27('0x38')]()[_0x1f27('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x3a')]=function(_0x3dd784,_0x1daedd){return this[_0x1f27('0x21')](util[_0x1f27('0x26')]('SAY\x20NUMBER\x20%s\x20%s',_0x3dd784,_0x1daedd));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x3b')]=function(_0x205ba0,_0x37aba4){return this[_0x1f27('0x21')](util[_0x1f27('0x26')](_0x1f27('0x3c'),_0x205ba0,_0x37aba4));};AGIChannel[_0x1f27('0x23')]['sayPhonetic']=function(_0x119d99,_0x367b2c){return this[_0x1f27('0x21')](util[_0x1f27('0x26')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x119d99,_0x367b2c));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x3d')]=function(_0x477d8b,_0x31c625,_0x423845){_0x31c625=_0x31c625||this[_0x1f27('0x3e')];_0x423845=_0x423845||0x1;this[_0x1f27('0x2f')](_0x477d8b);this[_0x1f27('0x31')](_0x31c625);this[_0x1f27('0x32')](_0x423845);return this[_0x1f27('0x28')](util['format']('GOTO\x20%s\x20%s\x20%s',_0x477d8b,_0x31c625,_0x423845));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x3f')]=function(_0x5957a8){return this[_0x1f27('0x21')](util[_0x1f27('0x26')](_0x1f27('0x40'),_0x5957a8));};AGIChannel['prototype']['recordFile']=function(_0x37c95a,_0x5e151f,_0x19ce84,_0x25d7d5,_0x40461b,_0x756f67){_0x5e151f=_0x5e151f||_0x1f27('0x41');_0x19ce84=_0x19ce84||'';_0x25d7d5=_0x25d7d5===undefined?-0x1:_0x25d7d5==='-1'?-0x1:_0x25d7d5*0x3e8;_0x40461b=_0x40461b===undefined?'':'s='+_0x40461b;_0x756f67=_0x756f67?_0x1f27('0x42'):'';return this[_0x1f27('0x21')](util[_0x1f27('0x26')](_0x1f27('0x43'),_0x37c95a,_0x5e151f,_0x19ce84,_0x25d7d5,_0x756f67,_0x40461b));};AGIChannel[_0x1f27('0x23')][_0x1f27('0x44')]=function(_0x50145b,_0x53d0cb){_0x53d0cb=_0x53d0cb||'';return this['sendRequest'](util[_0x1f27('0x26')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x50145b,_0x53d0cb));};AGIChannel['prototype']['agi']=function(_0x11d5e0){return this['exec']('AGI',_0x11d5e0);};AGIChannel[_0x1f27('0x23')]['wait']=function(_0x126199){return this[_0x1f27('0x2b')](_0x1f27('0x45'),_0x126199);};AGIChannel[_0x1f27('0x23')][_0x1f27('0x18')]=function(_0x3f4155,_0x1aba03){this[_0x1f27('0x28')](util['format'](_0x1f27('0x46'),_0x3f4155['id'],_0x3f4155['label'],_0x1aba03));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x1f27('0x47')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 9a1cff5..71c9d66 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 _0x7593=['Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x35650e,_0x532e58){var _0x40951f=function(_0x4fe87d){while(--_0x4fe87d){_0x35650e['push'](_0x35650e['shift']());}};_0x40951f(++_0x532e58);}(_0x7593,0xb5));var _0x3759=function(_0x13b442,_0x448c33){_0x13b442=_0x13b442-0x0;var _0x49d09c=_0x7593[_0x13b442];return _0x49d09c;};'use strict';var util=require(_0x3759('0x0'));var error={'E_AGI_UNDEFINED':_0x3759('0x1'),'E_AGI_ARGUMENT_PORT':_0x3759('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x3759('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x3759('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x3759('0x5'),'E_AGI_SOCKET_ERROR':_0x3759('0x6'),'E_AGI_SOCKET_CLOSE':_0x3759('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x3759('0x8'),'E_AGI_COMMAND_EMPTY':_0x3759('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x3759('0xa'),'E_AGI_IVR_ENTRY':_0x3759('0xb')};function AGIError(_0x5b31f8){var _0x5b31f8=_0x5b31f8||null,_0x5f3b20=_0x5f3b20||[],_0x136aae=0x1,_0x50638c='';if(!error[_0x5b31f8]){_0x5b31f8=_0x3759('0xc');}_0x5f3b20[_0x3759('0xd')](error[_0x5b31f8]);while(arguments[_0x136aae]){_0x5f3b20[_0x3759('0xd')](arguments[_0x136aae]);_0x136aae++;}_0x50638c=util['format'][_0x3759('0xe')](util,_0x5f3b20);this[_0x3759('0xf')]=_0x50638c;this['name']=_0x5b31f8;}module[_0x3759('0x10')]=AGIError; \ No newline at end of file +var _0x3538=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x3c2cc6,_0x3285fa){var _0x11c0a6=function(_0x3fd419){while(--_0x3fd419){_0x3c2cc6['push'](_0x3c2cc6['shift']());}};_0x11c0a6(++_0x3285fa);}(_0x3538,0x14e));var _0x8353=function(_0x4e3a1f,_0x3dbd3f){_0x4e3a1f=_0x4e3a1f-0x0;var _0x6d4971=_0x3538[_0x4e3a1f];return _0x6d4971;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x8353('0x0'),'E_AGI_ARGUMENT_PORT':_0x8353('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x8353('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x8353('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x8353('0x4'),'E_AGI_SOCKET_CLOSE':_0x8353('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x8353('0x6'),'E_AGI_IVR_ENTRY':_0x8353('0x7')};function AGIError(_0x1a1037){var _0x1a1037=_0x1a1037||null,_0x4c6f5a=_0x4c6f5a||[],_0x339467=0x1,_0x25ca13='';if(!error[_0x1a1037]){_0x1a1037=_0x8353('0x8');}_0x4c6f5a['push'](error[_0x1a1037]);while(arguments[_0x339467]){_0x4c6f5a[_0x8353('0x9')](arguments[_0x339467]);_0x339467++;}_0x25ca13=util['format'][_0x8353('0xa')](util,_0x4c6f5a);this[_0x8353('0xb')]=_0x25ca13;this[_0x8353('0xc')]=_0x1a1037;}module[_0x8353('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index f4da06d..31571d0 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 _0xccf2=['vswitch','target','default','menu','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','no\x20edge/s\x20available','length','condition','split','agicommand'];(function(_0x417baa,_0x3923d0){var _0x42724f=function(_0x276146){while(--_0x276146){_0x417baa['push'](_0x417baa['shift']());}};_0x42724f(++_0x3923d0);}(_0xccf2,0xc4));var _0x2ccf=function(_0x537c24,_0x5960f6){_0x537c24=_0x537c24-0x0;var _0x193c2f=_0xccf2[_0x537c24];return _0x193c2f;};'use strict';var _=require(_0x2ccf('0x0'));var logger=require(_0x2ccf('0x1'))(_0x2ccf('0x2'));var verticesWithRetry=['menu','getdigits','getsecretdigits'];var Graph=function(){this[_0x2ccf('0x3')]={};this[_0x2ccf('0x4')]={};this[_0x2ccf('0x5')]=0x0;};Graph[_0x2ccf('0x6')][_0x2ccf('0x7')]=function(_0x3436ea){this[_0x2ccf('0x3')][_0x3436ea['id']]=_0x3436ea;this[_0x2ccf('0x4')][_0x3436ea['id']]=[];};Graph[_0x2ccf('0x6')][_0x2ccf('0x8')]=function(_0x5dda1d,_0x21d1ab,_0x350318){this['edges'][_0x5dda1d][_0x2ccf('0x9')]({'target':_0x21d1ab,'condition':_0x350318});this[_0x2ccf('0x5')]+=0x1;};Graph[_0x2ccf('0x6')]['size']=function(){return _[_0x2ccf('0xa')](this[_0x2ccf('0x3')]);};Graph[_0x2ccf('0x6')][_0x2ccf('0xb')]=function(){return this['numberOfEdges'];};Graph['prototype']['getVertex']=function(_0x496881){return this[_0x2ccf('0x3')][_0x496881];};Graph['prototype'][_0x2ccf('0xc')]=function(_0x4b3f84,_0x576925){if(!this[_0x2ccf('0x3')][_0x4b3f84]){return logger['info'](_0x2ccf('0xd'));}var _0x398e15=_0x576925(this[_0x2ccf('0x3')][_0x4b3f84]);if(!_0x398e15){return logger[_0x2ccf('0xe')](_0x2ccf('0xf'));}if(this[_0x2ccf('0x4')][_0x4b3f84]['length']===0x0){return logger[_0x2ccf('0xe')](_0x2ccf('0x10'));}for(var _0x2177a1=0x0,_0x15ee14=[],_0x130893=![];_0x2177a1\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','evtHangup','sync','production','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','lodash','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./vertices','defaults','agi','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','[%s]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','calleridname','mxGraphModel','root','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source'];(function(_0x1db29a,_0x5263e6){var _0x53525b=function(_0x469d7d){while(--_0x469d7d){_0x1db29a['push'](_0x1db29a['shift']());}};_0x53525b(++_0x5263e6);}(_0xd11c,0x88));var _0xcd11=function(_0x24f018,_0x4814a9){_0x24f018=_0x24f018-0x0;var _0x1144ca=_0xd11c[_0x24f018];return _0x1144ca;};'use strict';var parser=require('xml2json');var _=require(_0xcd11('0x0'));var syncho=require(_0xcd11('0x1'));var util=require(_0xcd11('0x2'));var moment=require(_0xcd11('0x3'));var config=require(_0xcd11('0x4'));var logger=require(_0xcd11('0x5'))('agi');var utilLicense=require(_0xcd11('0x6'));var rpc=require(_0xcd11('0x7'));var mailRpc=require(_0xcd11('0x8'));var Graph=require('./graph');var Vertices=require(_0xcd11('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xcd11('0xa')](config[_0xcd11('0xb')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x2ed165){process[_0xcd11('0xc')](function(){syncho(function(){try{setChannelVariables(_0x2ed165);agiHandler(_0x2ed165);}catch(_0x2df602){logger[_0xcd11('0xd')](_0x2df602['stack']);}});});}function listeningHandler(){console[_0xcd11('0xe')](_0xcd11('0xf'),config[_0xcd11('0xb')]['port']);logger[_0xcd11('0x10')](util[_0xcd11('0x11')](_0xcd11('0x12'),config[_0xcd11('0xb')]['ip'],config[_0xcd11('0xb')][_0xcd11('0x13')]));}function errorHandler(_0x3fa425){if(_0x3fa425&&_0x3fa425[_0xcd11('0x14')]&&_0x3fa425[_0xcd11('0x15')]){logger[_0xcd11('0xd')](util[_0xcd11('0x11')](_0xcd11('0x16'),_0x3fa425[_0xcd11('0x14')],_0x3fa425[_0xcd11('0x15')]));}else{logger[_0xcd11('0xd')](util[_0xcd11('0x11')]('[ERROR]\x20%s',_0x3fa425[_0xcd11('0x17')]));}}function closeHandler(){logger[_0xcd11('0x10')](util[_0xcd11('0x11')](_0xcd11('0x18'),this[_0xcd11('0x19')],this['calleridname'],this[_0xcd11('0x1a')],this[_0xcd11('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0xb6e484){logger['error'](_0xb6e484[_0xcd11('0x17')]);}}function timeoutHandler(){logger['info'](util['format'](_0xcd11('0x1c'),this['arg_1'],this['calleridname'],this[_0xcd11('0x1a')],this[_0xcd11('0x1b')],this[_0xcd11('0x1d')]));}function hangupHandler(){logger['info'](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xcd11('0x19')],this[_0xcd11('0x1e')],this[_0xcd11('0x1a')],this[_0xcd11('0x1b')],this[_0xcd11('0x1d')]));this['evtHangup']=!![];}function getRoot(_0x42516e){return parser['toJson'](_0x42516e,{'object':!![]})[_0xcd11('0x1f')][_0xcd11('0x20')];}function addVertex(_0x3464c1,_0x3c1ba5,_0x4d2ce1){_0x3c1ba5[_0xcd11('0x21')]=_0x4d2ce1;if(_0x3c1ba5[_0xcd11('0x22')](_0xcd11('0x23'))){_0x3c1ba5['maxRetry']=parseInt(_0x3c1ba5[_0xcd11('0x23')],0xa);}_0x3464c1[_0xcd11('0x24')](_[_0xcd11('0x25')](_0x3c1ba5,_0xcd11('0x26')));}function initGraph(_0x57b192,_0xa964d0){var _0x1f8608=new Graph();for(var _0x14c8ba in _0x57b192){if(_0x57b192['hasOwnProperty'](_0x14c8ba)){if(_[_0xcd11('0x27')](_0x57b192[_0x14c8ba])){for(var _0x30f816=0x0;_0x30f816<_0x57b192[_0x14c8ba][_0xcd11('0x28')];_0x30f816+=0x1){addVertex(_0x1f8608,_0x57b192[_0x14c8ba][_0x30f816],_0x14c8ba);}}else{addVertex(_0x1f8608,_0x57b192[_0x14c8ba],_0x14c8ba);}}}for(var _0xf28e9f=0x0;_0xf28e9f<_0xa964d0[_0xcd11('0x28')];_0xf28e9f+=0x1){if(_0xa964d0[_0xf28e9f][_0xcd11('0x29')]&&_0xa964d0[_0xf28e9f][_0xcd11('0x2a')]){_0x1f8608[_0xcd11('0x2b')](_0xa964d0[_0xf28e9f][_0xcd11('0x29')],_0xa964d0[_0xf28e9f][_0xcd11('0x2a')],_0xa964d0[_0xf28e9f][_0xcd11('0x2c')]);}}return _0x1f8608;}function getSquareProject(_0x344d57,_0x4c390c){rpc[_0xcd11('0x2d')](_0x344d57)[_0xcd11('0x2e')](function(_0x3f4ae0){_0x4c390c(null,_0x3f4ae0);})['catch'](function(_0x659e9c){_0x4c390c(null,_0x659e9c);});}function createSquareReport(_0x3eb79d,_0x5c0722){rpc[_0xcd11('0x2f')](_0x3eb79d)[_0xcd11('0x2e')](function(_0x308fb0){if(_0x5c0722){_0x5c0722(null,_0x308fb0);}})[_0xcd11('0x30')](function(_0x2b5a7f){if(_0x5c0722){_0x5c0722(null,_0x2b5a7f);}});}function setChannelVariables(_0x704a48){for(var _0x49b244 in _0x704a48){if(_0x704a48[_0xcd11('0x22')](_0x49b244)){if(_0x49b244[_0xcd11('0x31')]('agi_')===0x0){_0x704a48[_0x49b244[_0xcd11('0x32')](0x4)]=_0x704a48[_0x49b244];delete _0x704a48[_0x49b244];}}}}function getLogFromObject(_0x196688){return util['inspect'](_0x196688,{'showHidden':![],'depth':null});}function agiHandler(_0xa6a25a){var _0x11520d,_0x5f09b1,_0x4448f2,_0x3bc193,_0x11f898;logger[_0xcd11('0x33')](_0xcd11('0x34'),JSON[_0xcd11('0x35')](_0xa6a25a,null,0x2));logger['info'](util[_0xcd11('0x11')](_0xcd11('0x36'),_0xa6a25a[_0xcd11('0x19')],_0xa6a25a[_0xcd11('0x1e')],_0xa6a25a[_0xcd11('0x1a')],_0xa6a25a['dnid'],_0xa6a25a[_0xcd11('0x1d')]));_0xa6a25a['on'](_0xcd11('0xd'),errorHandler);_0xa6a25a['on']('close',closeHandler);_0xa6a25a['on'](_0xcd11('0x37'),timeoutHandler);_0xa6a25a[_0xcd11('0x38')]=![];_0xa6a25a['on']('hangup',hangupHandler);var _0x245f0d=getSquareProject[_0xcd11('0x39')](null,_0xa6a25a[_0xcd11('0x19')]);if(_0x245f0d){if(_0x245f0d[_0xcd11('0x3a')]){_0x11520d=getRoot(_0x245f0d[_0xcd11('0x3a')]);if(_0x11520d&&_0x11520d['start']){logger[_0xcd11('0x33')](_0xcd11('0x20'),JSON[_0xcd11('0x35')](_0x11520d,null,0x2));_0xa6a25a['joinAt']=moment()[_0xcd11('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x5f09b1=initGraph(_[_0xcd11('0x25')](_0x11520d,_0xcd11('0x26')),_0x11520d[_0xcd11('0x26')]);_0x4448f2=new Vertices(_0xa6a25a,rpc,mailRpc);logger[_0xcd11('0x10')](util[_0xcd11('0x11')](_0xcd11('0x3b'),_0xa6a25a[_0xcd11('0x19')],_0xa6a25a[_0xcd11('0x1e')],_0xa6a25a['callerid'],_0xa6a25a['dnid'],_0xa6a25a[_0xcd11('0x1d')]));_0x5f09b1[_0xcd11('0x3c')](_0x11520d['start']['id'],function(_0x4acc9c){try{_0x4acc9c=_0x4448f2[_0xcd11('0x3d')](_0x4acc9c);logger[_0xcd11('0x33')](_0xcd11('0x3e'),JSON['stringify'](_0x4acc9c,null,0x2));if(_0x4acc9c[_0xcd11('0x21')]===_0xcd11('0x3f')){logger[_0xcd11('0x10')](_0xcd11('0x40'));_0xa6a25a[_0xcd11('0x41')]=_0x4acc9c[_0xcd11('0x41')]||_0xa6a25a['context'];_0xa6a25a[_0xcd11('0x42')]=_0x4acc9c[_0xcd11('0x42')];_0xa6a25a[_0xcd11('0x43')]=_0x4acc9c['priority']?_0x4acc9c['priority']-0x1:0x1;return null;}else if(_0x4acc9c&&_0x4448f2[_0x4acc9c[_0xcd11('0x21')]]){_0x11f898=_0x4448f2[_0x4acc9c[_0xcd11('0x21')]](_0x4acc9c);logger[_0xcd11('0x10')](_0xcd11('0x44'),JSON[_0xcd11('0x35')](_0x11f898,null,0x2));if(_0x11f898&&_0x11f898[_0xcd11('0x45')]===AGI_CODE_SUCCESS&&_0x11f898['result']!==AGI_RESULT_ERROR&&!_0xa6a25a['evtHangup']){logger[_0xcd11('0x33')](_0xcd11('0x44'),getLogFromObject(_0x11f898));return _[_0xcd11('0x46')](_0x11f898[_0xcd11('0x47')])?null:_0x11f898['result']['toString']();}else{logger[_0xcd11('0xd')](_0xcd11('0x44'),getLogFromObject(_0x11f898));return null;}}else{logger[_0xcd11('0xd')](_0xcd11('0x48'));return null;}}catch(_0x2cc1e0){logger[_0xcd11('0xd')](_0x2cc1e0[_0xcd11('0x17')]);return null;}});if(_0x11520d[_0xcd11('0x49')]){logger[_0xcd11('0x10')](util[_0xcd11('0x11')](_0xcd11('0x4a'),_0xa6a25a['arg_1'],_0xa6a25a[_0xcd11('0x1e')],_0xa6a25a['callerid'],_0xa6a25a['dnid'],_0xa6a25a[_0xcd11('0x1d')]));_0x5f09b1[_0xcd11('0x3c')](_0x11520d[_0xcd11('0x49')]['id'],function(_0x1edaec){try{_0x1edaec=_0x4448f2[_0xcd11('0x3d')](_0x1edaec);logger['debug']('vertex',JSON[_0xcd11('0x35')](_0x1edaec,null,0x2));if(_0x1edaec&&_0x4448f2[_0x1edaec[_0xcd11('0x21')]]){_0x11f898=_0x4448f2[_0x1edaec[_0xcd11('0x21')]](_0x1edaec);if(_0x11f898){logger['debug'](_0xcd11('0x44'),getLogFromObject(_0x11f898));return _[_0xcd11('0x46')](_0x11f898[_0xcd11('0x47')])?null:_0x11f898['result'][_0xcd11('0x4b')]();}else{logger[_0xcd11('0xd')](_0xcd11('0x44'),getLogFromObject(_0x11f898));return null;}}else{logger[_0xcd11('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x21b0bf){logger['error'](_0x21b0bf['stack']);return null;}});}logger['info'](util[_0xcd11('0x11')](_0xcd11('0x4c'),_0xa6a25a[_0xcd11('0x19')],_0xa6a25a[_0xcd11('0x1e')],_0xa6a25a[_0xcd11('0x1a')],_0xa6a25a[_0xcd11('0x1b')],_0xa6a25a[_0xcd11('0x1d')]));logger[_0xcd11('0x10')](util[_0xcd11('0x11')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0xa6a25a['context'],_0xa6a25a[_0xcd11('0x42')],parseInt(_0xa6a25a[_0xcd11('0x43')],0xa)+0x1));_0xa6a25a[_0xcd11('0x4d')](_0xa6a25a[_0xcd11('0x41')],_0xa6a25a[_0xcd11('0x42')],parseInt(_0xa6a25a[_0xcd11('0x43')],0xa)+0x1);_0xa6a25a[_0xcd11('0x4e')]();}}else{logger[_0xcd11('0xd')](util[_0xcd11('0x11')](_0xcd11('0x4f'),_0xa6a25a['arg_1']));_0xa6a25a['continueAt'](_0xa6a25a[_0xcd11('0x41')],_0xa6a25a[_0xcd11('0x42')],parseInt(_0xa6a25a['priority'],0xa)+0x1);_0xa6a25a[_0xcd11('0x4e')]();}}else{logger[_0xcd11('0xd')](util['format']('Project\x20%s\x20not\x20found',_0xa6a25a[_0xcd11('0x19')]));_0xa6a25a[_0xcd11('0x4d')](_0xa6a25a[_0xcd11('0x41')],_0xa6a25a['extension'],parseInt(_0xa6a25a[_0xcd11('0x43')],0xa)+0x1);_0xa6a25a[_0xcd11('0x4e')]();}}function main(){var _0x504fa5;return utilLicense[_0xcd11('0x50')]()[_0xcd11('0x2e')](function(_0x4c0f6c){if(_0x4c0f6c){if(_0x4c0f6c[_0xcd11('0x51')]){if(_0x4c0f6c[_0xcd11('0x52')]&&_0x4c0f6c['callysquare']>0x0){logger[_0xcd11('0x10')](util['format'](_0xcd11('0x53'),_0x4c0f6c[_0xcd11('0x52')]));_0x504fa5=_0x4c0f6c['callysquare'];}else{logger['info'](_0xcd11('0x54'));}}else{logger[_0xcd11('0x10')](_0xcd11('0x55'));_0x504fa5=-0x1;}}})[_0xcd11('0x30')](function(_0x218a83){logger[_0xcd11('0xd')](_0xcd11('0x56'),_0x218a83['stack']);})[_0xcd11('0x49')](function(){var _0x5d0c=require(_0xcd11('0x57'))(config[_0xcd11('0xb')][_0xcd11('0x13')],config[_0xcd11('0xb')]['ip'],_0x504fa5);_0x5d0c['on'](_0xcd11('0xd'),errorHandler);_0x5d0c['on']('listening',listeningHandler);_0x5d0c['on'](_0xcd11('0x58'),connectionHandler);_0x5d0c['on'](_0xcd11('0x4e'),closeHandler);});}main(); \ No newline at end of file +var _0xd9ec=['mxCell','length','target','addEdge','source','value','catch','createSquareReport','debug','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','sync','production','start','joinAt','traverseBFS','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','isUndefined','continueAt','Project\x20%s\x20not\x20found','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','listening','connection','lodash','util','moment','../../config/logger','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','stack','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','error','[%s]\x20%s','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd9ec,0x77));var _0xcd9e=function(_0x2813f7,_0x38c480){_0x2813f7=_0x2813f7-0x0;var _0x155923=_0xd9ec[_0x2813f7];return _0x155923;};'use strict';var parser=require('xml2json');var _=require(_0xcd9e('0x0'));var syncho=require('syncho');var util=require(_0xcd9e('0x1'));var moment=require(_0xcd9e('0x2'));var config=require('../../config/environment');var logger=require(_0xcd9e('0x3'))('agi');var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var mailRpc=require(_0xcd9e('0x4'));var Graph=require(_0xcd9e('0x5'));var Vertices=require(_0xcd9e('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xcd9e('0x7')]=_[_0xcd9e('0x8')](config['agi'],{'ip':_0xcd9e('0x9'),'port':0x11dd});function connectionHandler(_0x6b4ed4){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x6b4ed4);agiHandler(_0x6b4ed4);}catch(_0x42b0c2){logger['error'](_0x42b0c2[_0xcd9e('0xa')]);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xcd9e('0x7')][_0xcd9e('0xb')]);logger['info'](util[_0xcd9e('0xc')](_0xcd9e('0xd'),config['agi']['ip'],config['agi'][_0xcd9e('0xb')]));}function errorHandler(_0x2edee9){if(_0x2edee9&&_0x2edee9[_0xcd9e('0xe')]&&_0x2edee9[_0xcd9e('0xf')]){logger[_0xcd9e('0x10')](util[_0xcd9e('0xc')](_0xcd9e('0x11'),_0x2edee9['name'],_0x2edee9['message']));}else{logger[_0xcd9e('0x10')](util[_0xcd9e('0xc')](_0xcd9e('0x12'),_0x2edee9[_0xcd9e('0xa')]));}}function closeHandler(){logger[_0xcd9e('0x13')](util[_0xcd9e('0xc')](_0xcd9e('0x14'),this['arg_1'],this['calleridname'],this[_0xcd9e('0x15')],this[_0xcd9e('0x16')],this[_0xcd9e('0x17')]));try{createSquareReport(this);}catch(_0x398387){logger[_0xcd9e('0x10')](_0x398387[_0xcd9e('0xa')]);}}function timeoutHandler(){logger[_0xcd9e('0x13')](util[_0xcd9e('0xc')](_0xcd9e('0x18'),this[_0xcd9e('0x19')],this[_0xcd9e('0x1a')],this['callerid'],this['dnid'],this[_0xcd9e('0x17')]));}function hangupHandler(){logger[_0xcd9e('0x13')](util[_0xcd9e('0xc')](_0xcd9e('0x1b'),this[_0xcd9e('0x19')],this['calleridname'],this['callerid'],this['dnid'],this[_0xcd9e('0x17')]));this['evtHangup']=!![];}function getRoot(_0x355034){return parser['toJson'](_0x355034,{'object':!![]})['mxGraphModel'][_0xcd9e('0x1c')];}function addVertex(_0x53171f,_0x3b2130,_0x41a2a2){_0x3b2130[_0xcd9e('0x1d')]=_0x41a2a2;if(_0x3b2130[_0xcd9e('0x1e')](_0xcd9e('0x1f'))){_0x3b2130[_0xcd9e('0x20')]=parseInt(_0x3b2130[_0xcd9e('0x1f')],0xa);}_0x53171f[_0xcd9e('0x21')](_[_0xcd9e('0x22')](_0x3b2130,_0xcd9e('0x23')));}function initGraph(_0xebbb55,_0x435397){var _0x40ca08=new Graph();for(var _0x56c206 in _0xebbb55){if(_0xebbb55['hasOwnProperty'](_0x56c206)){if(_['isArray'](_0xebbb55[_0x56c206])){for(var _0x57a11d=0x0;_0x57a11d<_0xebbb55[_0x56c206][_0xcd9e('0x24')];_0x57a11d+=0x1){addVertex(_0x40ca08,_0xebbb55[_0x56c206][_0x57a11d],_0x56c206);}}else{addVertex(_0x40ca08,_0xebbb55[_0x56c206],_0x56c206);}}}for(var _0x1da9fe=0x0;_0x1da9fe<_0x435397[_0xcd9e('0x24')];_0x1da9fe+=0x1){if(_0x435397[_0x1da9fe]['source']&&_0x435397[_0x1da9fe][_0xcd9e('0x25')]){_0x40ca08[_0xcd9e('0x26')](_0x435397[_0x1da9fe][_0xcd9e('0x27')],_0x435397[_0x1da9fe][_0xcd9e('0x25')],_0x435397[_0x1da9fe][_0xcd9e('0x28')]);}}return _0x40ca08;}function getSquareProject(_0x4ae2a0,_0x240842){rpc['getSquareProject'](_0x4ae2a0)['then'](function(_0x29b853){_0x240842(null,_0x29b853);})[_0xcd9e('0x29')](function(_0x2b7845){_0x240842(null,_0x2b7845);});}function createSquareReport(_0xdb6bc1,_0x5ac772){rpc[_0xcd9e('0x2a')](_0xdb6bc1)['then'](function(_0x44c977){if(_0x5ac772){_0x5ac772(null,_0x44c977);}})[_0xcd9e('0x29')](function(_0x3b1611){if(_0x5ac772){_0x5ac772(null,_0x3b1611);}});}function setChannelVariables(_0x2e1f28){for(var _0xcb5be1 in _0x2e1f28){if(_0x2e1f28['hasOwnProperty'](_0xcb5be1)){if(_0xcb5be1['indexOf']('agi_')===0x0){_0x2e1f28[_0xcb5be1['substring'](0x4)]=_0x2e1f28[_0xcb5be1];delete _0x2e1f28[_0xcb5be1];}}}}function getLogFromObject(_0x5e49cc){return util['inspect'](_0x5e49cc,{'showHidden':![],'depth':null});}function agiHandler(_0x3b34fd){var _0x138303,_0x260b00,_0x564fed,_0x4adb33,_0x417bc0;logger[_0xcd9e('0x2b')]('variables',JSON['stringify'](_0x3b34fd,null,0x2));logger[_0xcd9e('0x13')](util[_0xcd9e('0xc')](_0xcd9e('0x2c'),_0x3b34fd[_0xcd9e('0x19')],_0x3b34fd[_0xcd9e('0x1a')],_0x3b34fd['callerid'],_0x3b34fd[_0xcd9e('0x16')],_0x3b34fd[_0xcd9e('0x17')]));_0x3b34fd['on'](_0xcd9e('0x10'),errorHandler);_0x3b34fd['on'](_0xcd9e('0x2d'),closeHandler);_0x3b34fd['on'](_0xcd9e('0x2e'),timeoutHandler);_0x3b34fd[_0xcd9e('0x2f')]=![];_0x3b34fd['on'](_0xcd9e('0x30'),hangupHandler);var _0x39a47e=getSquareProject[_0xcd9e('0x31')](null,_0x3b34fd['arg_1']);if(_0x39a47e){if(_0x39a47e['production']){_0x138303=getRoot(_0x39a47e[_0xcd9e('0x32')]);if(_0x138303&&_0x138303[_0xcd9e('0x33')]){logger[_0xcd9e('0x2b')](_0xcd9e('0x1c'),JSON['stringify'](_0x138303,null,0x2));_0x3b34fd[_0xcd9e('0x34')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x260b00=initGraph(_[_0xcd9e('0x22')](_0x138303,_0xcd9e('0x23')),_0x138303[_0xcd9e('0x23')]);_0x564fed=new Vertices(_0x3b34fd,rpc,mailRpc);logger[_0xcd9e('0x13')](util[_0xcd9e('0xc')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3b34fd['arg_1'],_0x3b34fd[_0xcd9e('0x1a')],_0x3b34fd[_0xcd9e('0x15')],_0x3b34fd[_0xcd9e('0x16')],_0x3b34fd[_0xcd9e('0x17')]));_0x260b00[_0xcd9e('0x35')](_0x138303[_0xcd9e('0x33')]['id'],function(_0x1a4ef1){try{_0x1a4ef1=_0x564fed['clear'](_0x1a4ef1);logger['debug']('vertex',JSON[_0xcd9e('0x36')](_0x1a4ef1,null,0x2));if(_0x1a4ef1[_0xcd9e('0x1d')]===_0xcd9e('0x37')){logger[_0xcd9e('0x13')](_0xcd9e('0x38'));_0x3b34fd[_0xcd9e('0x39')]=_0x1a4ef1[_0xcd9e('0x39')]||_0x3b34fd[_0xcd9e('0x39')];_0x3b34fd['extension']=_0x1a4ef1[_0xcd9e('0x3a')];_0x3b34fd[_0xcd9e('0x3b')]=_0x1a4ef1[_0xcd9e('0x3b')]?_0x1a4ef1[_0xcd9e('0x3b')]-0x1:0x1;return null;}else if(_0x1a4ef1&&_0x564fed[_0x1a4ef1[_0xcd9e('0x1d')]]){_0x417bc0=_0x564fed[_0x1a4ef1['agicommand']](_0x1a4ef1);logger['info'](_0xcd9e('0x3c'),JSON['stringify'](_0x417bc0,null,0x2));if(_0x417bc0&&_0x417bc0['code']===AGI_CODE_SUCCESS&&_0x417bc0[_0xcd9e('0x3d')]!==AGI_RESULT_ERROR&&!_0x3b34fd[_0xcd9e('0x2f')]){logger[_0xcd9e('0x2b')](_0xcd9e('0x3c'),getLogFromObject(_0x417bc0));return _['isUndefined'](_0x417bc0[_0xcd9e('0x3d')])?null:_0x417bc0['result'][_0xcd9e('0x3e')]();}else{logger[_0xcd9e('0x10')]('response',getLogFromObject(_0x417bc0));return null;}}else{logger[_0xcd9e('0x10')](_0xcd9e('0x3f'));return null;}}catch(_0x38a1b3){logger[_0xcd9e('0x10')](_0x38a1b3[_0xcd9e('0xa')]);return null;}});if(_0x138303[_0xcd9e('0x40')]){logger['info'](util[_0xcd9e('0xc')](_0xcd9e('0x41'),_0x3b34fd['arg_1'],_0x3b34fd[_0xcd9e('0x1a')],_0x3b34fd[_0xcd9e('0x15')],_0x3b34fd['dnid'],_0x3b34fd[_0xcd9e('0x17')]));_0x260b00[_0xcd9e('0x35')](_0x138303[_0xcd9e('0x40')]['id'],function(_0x3612d8){try{_0x3612d8=_0x564fed[_0xcd9e('0x42')](_0x3612d8);logger[_0xcd9e('0x2b')]('vertex',JSON[_0xcd9e('0x36')](_0x3612d8,null,0x2));if(_0x3612d8&&_0x564fed[_0x3612d8['agicommand']]){_0x417bc0=_0x564fed[_0x3612d8[_0xcd9e('0x1d')]](_0x3612d8);if(_0x417bc0){logger[_0xcd9e('0x2b')]('response',getLogFromObject(_0x417bc0));return _[_0xcd9e('0x43')](_0x417bc0['result'])?null:_0x417bc0[_0xcd9e('0x3d')][_0xcd9e('0x3e')]();}else{logger[_0xcd9e('0x10')](_0xcd9e('0x3c'),getLogFromObject(_0x417bc0));return null;}}else{logger[_0xcd9e('0x10')](_0xcd9e('0x3f'));return null;}}catch(_0x47e4e8){logger['error'](_0x47e4e8['stack']);return null;}});}logger[_0xcd9e('0x13')](util[_0xcd9e('0xc')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3b34fd[_0xcd9e('0x19')],_0x3b34fd[_0xcd9e('0x1a')],_0x3b34fd[_0xcd9e('0x15')],_0x3b34fd[_0xcd9e('0x16')],_0x3b34fd[_0xcd9e('0x17')]));logger[_0xcd9e('0x13')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x3b34fd[_0xcd9e('0x39')],_0x3b34fd[_0xcd9e('0x3a')],parseInt(_0x3b34fd[_0xcd9e('0x3b')],0xa)+0x1));_0x3b34fd[_0xcd9e('0x44')](_0x3b34fd[_0xcd9e('0x39')],_0x3b34fd[_0xcd9e('0x3a')],parseInt(_0x3b34fd[_0xcd9e('0x3b')],0xa)+0x1);_0x3b34fd['close']();}}else{logger['error'](util['format']('Project\x20%s\x20not\x20published',_0x3b34fd['arg_1']));_0x3b34fd[_0xcd9e('0x44')](_0x3b34fd[_0xcd9e('0x39')],_0x3b34fd[_0xcd9e('0x3a')],parseInt(_0x3b34fd[_0xcd9e('0x3b')],0xa)+0x1);_0x3b34fd[_0xcd9e('0x2d')]();}}else{logger[_0xcd9e('0x10')](util[_0xcd9e('0xc')](_0xcd9e('0x45'),_0x3b34fd[_0xcd9e('0x19')]));_0x3b34fd[_0xcd9e('0x44')](_0x3b34fd[_0xcd9e('0x39')],_0x3b34fd['extension'],parseInt(_0x3b34fd[_0xcd9e('0x3b')],0xa)+0x1);_0x3b34fd[_0xcd9e('0x2d')]();}}function main(){var _0x4251e9;return utilLicense['getLicense']()[_0xcd9e('0x46')](function(_0x283483){if(_0x283483){if(_0x283483[_0xcd9e('0x47')]){if(_0x283483[_0xcd9e('0x48')]&&_0x283483['callysquare']>0x0){logger[_0xcd9e('0x13')](util[_0xcd9e('0xc')]('[LICENSE]\x20CHANNELS:\x20%s',_0x283483[_0xcd9e('0x48')]));_0x4251e9=_0x283483[_0xcd9e('0x48')];}else{logger['info'](_0xcd9e('0x49'));}}else{logger[_0xcd9e('0x13')](_0xcd9e('0x4a'));_0x4251e9=-0x1;}}})[_0xcd9e('0x29')](function(_0x29f40a){logger[_0xcd9e('0x10')]('[LICENSE]',_0x29f40a[_0xcd9e('0xa')]);})[_0xcd9e('0x40')](function(){var _0x211ed9=require('./server')(config[_0xcd9e('0x7')][_0xcd9e('0xb')],config[_0xcd9e('0x7')]['ip'],_0x4251e9);_0x211ed9['on'](_0xcd9e('0x10'),errorHandler);_0x211ed9['on'](_0xcd9e('0x4b'),listeningHandler);_0x211ed9['on'](_0xcd9e('0x4c'),connectionHandler);_0x211ed9['on'](_0xcd9e('0x2d'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 2118f3d..ae33453 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 _0x1a70=['error','message','result','catch','sendMailMessage','bluebird','client','request','then'];(function(_0x2837f1,_0x571485){var _0x5aeb48=function(_0x2ee56a){while(--_0x2ee56a){_0x2837f1['push'](_0x2837f1['shift']());}};_0x5aeb48(++_0x571485);}(_0x1a70,0x1b5));var _0x01a7=function(_0x54fc1f,_0x1703c2){_0x54fc1f=_0x54fc1f-0x0;var _0x53f699=_0x1a70[_0x54fc1f];return _0x53f699;};'use strict';var BPromise=require(_0x01a7('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x01a7('0x1')]['http']({'port':0x232b});function request(_0x545b3a,_0x5295cb){return new BPromise(function(_0x26515e,_0x5d4c37){return client[_0x01a7('0x2')](_0x545b3a,_0x5295cb)[_0x01a7('0x3')](function(_0x441dbc){if(_0x441dbc['error']){return _0x5d4c37(_0x441dbc[_0x01a7('0x4')][_0x01a7('0x5')]);}else{return _0x26515e(_0x441dbc[_0x01a7('0x6')]);}})[_0x01a7('0x7')](function(_0x274fc5){return _0x5d4c37(_0x274fc5);});});}exports[_0x01a7('0x8')]=function(_0x56a6f5,_0x4daed8){return request('SendMail',{'account':_0x56a6f5,'message':_0x4daed8});}; \ No newline at end of file +var _0x52d3=['sendMailMessage','jayson/promise','client','http','request','then','error','message','result'];(function(_0x35d06a,_0x81abc0){var _0x3cf8a5=function(_0x2693f){while(--_0x2693f){_0x35d06a['push'](_0x35d06a['shift']());}};_0x3cf8a5(++_0x81abc0);}(_0x52d3,0x1a8));var _0x352d=function(_0x3c1fa3,_0x508676){_0x3c1fa3=_0x3c1fa3-0x0;var _0x39b034=_0x52d3[_0x3c1fa3];return _0x39b034;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x352d('0x0'));var client=jayson[_0x352d('0x1')][_0x352d('0x2')]({'port':0x232b});function request(_0x421187,_0x41d6c0){return new BPromise(function(_0x5e1397,_0x4da045){return client[_0x352d('0x3')](_0x421187,_0x41d6c0)[_0x352d('0x4')](function(_0x482257){if(_0x482257[_0x352d('0x5')]){return _0x4da045(_0x482257[_0x352d('0x5')][_0x352d('0x6')]);}else{return _0x5e1397(_0x482257[_0x352d('0x7')]);}})['catch'](function(_0x258568){return _0x4da045(_0x258568);});});}exports[_0x352d('0x8')]=function(_0x166da0,_0xe9a2ef){return request('SendMail',{'account':_0x166da0,'message':_0xe9a2ef});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index bcac115..4c678d7 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 _0x79d2=['toString','_localBuffer','indexOf','substring','length','split','slice','headers','line','exports','stream','Transform','call','_inBody','inherits','prototype','_transform'];(function(_0x4cb660,_0x5cebf6){var _0x59cbba=function(_0x2b239b){while(--_0x2b239b){_0x4cb660['push'](_0x4cb660['shift']());}};_0x59cbba(++_0x5cebf6);}(_0x79d2,0xd6));var _0x279d=function(_0x3e3064,_0x3dd6f5){_0x3e3064=_0x3e3064-0x0;var _0x4547e1=_0x79d2[_0x3e3064];return _0x4547e1;};'use strict';var util=require('util');var Transform=require(_0x279d('0x0'))[_0x279d('0x1')];function AGIReply(_0x52df08){Transform[_0x279d('0x2')](this,_0x52df08);this['_localBuffer']='';this[_0x279d('0x3')]=![];}util[_0x279d('0x4')](AGIReply,Transform);AGIReply[_0x279d('0x5')][_0x279d('0x6')]=function(_0x1e0e30,_0x377b5a,_0x200d5f){var _0x323614='\x0a',_0x1ce4b0=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x4de989=-0x1,_0x35b2b5=-0x1,_0xb2384e='',_0x3ccb79=0x0,_0x317cc1='',_0x5f5544='';this['_localBuffer']+=_0x1e0e30[_0x279d('0x7')]();_0x317cc1=this[_0x279d('0x8')];if(!this['_inBody']){_0x3ccb79=0x0;while(_0x1ce4b0[_0x3ccb79]){while((_0x35b2b5=_0x317cc1[_0x279d('0x9')](_0x1ce4b0[_0x3ccb79]))!=-0x1){_0xb2384e=_0x1ce4b0[_0x3ccb79];_0x5f5544=_0x317cc1[_0x279d('0xa')](0x0,_0x35b2b5);_0x317cc1=_0x317cc1[_0x279d('0xa')](_0x35b2b5+_0xb2384e[_0x279d('0xb')]);var _0x2de0fc=_0x5f5544[_0x279d('0xc')](_0x323614),_0x1bbd73=0x0,_0x12ed9e={},_0x1bea3c='',_0x1e73e1='',_0x431667=-0x1;while(_0x2de0fc[_0x1bbd73]){_0x431667=_0x2de0fc[_0x1bbd73][_0x279d('0x9')](':');if(_0x431667!=-0x1){_0x1bea3c=_0x2de0fc[_0x1bbd73][_0x279d('0xd')](0x0,_0x431667)['trim']();_0x1e73e1=_0x2de0fc[_0x1bbd73][_0x279d('0xd')](_0x431667+0x1)['trim']();if(_0x1bea3c[_0x279d('0xb')]>0x0){_0x12ed9e[_0x1bea3c]=_0x1e73e1;}}else{}_0x1bbd73++;}this['emit'](_0x279d('0xe'),_0x12ed9e);this[_0x279d('0x3')]=!![];}_0x3ccb79++;}this[_0x279d('0x8')]=_0x317cc1;}else{while((_0x4de989=_0x317cc1[_0x279d('0x9')](_0x323614))!=-0x1){_0x5f5544=_0x317cc1[_0x279d('0xa')](0x0,_0x4de989);this['emit'](_0x279d('0xf'),_0x5f5544);_0x317cc1=_0x317cc1[_0x279d('0xa')](_0x4de989+_0x323614['length']);}this[_0x279d('0x8')]=_0x317cc1;}_0x200d5f();};module[_0x279d('0x10')]=AGIReply; \ No newline at end of file +var _0x5e65=['substring','length','split','slice','trim','emit','headers','exports','util','_localBuffer','inherits','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf'];(function(_0x2bb30a,_0x13c669){var _0x1d0ae8=function(_0x3083b5){while(--_0x3083b5){_0x2bb30a['push'](_0x2bb30a['shift']());}};_0x1d0ae8(++_0x13c669);}(_0x5e65,0x152));var _0x55e6=function(_0x1d16e8,_0xcc4b08){_0x1d16e8=_0x1d16e8-0x0;var _0xeb1321=_0x5e65[_0x1d16e8];return _0xeb1321;};'use strict';var util=require(_0x55e6('0x0'));var Transform=require('stream')['Transform'];function AGIReply(_0xbbaa87){Transform['call'](this,_0xbbaa87);this[_0x55e6('0x1')]='';this['_inBody']=![];}util[_0x55e6('0x2')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x44da02,_0x29950c,_0x70cd2f){var _0x2e4a86='\x0a',_0x1ac851=['\x0a\x0a',_0x55e6('0x3')],_0x4e2707=-0x1,_0x347488=-0x1,_0x4e5a46='',_0x5e0895=0x0,_0x4dd854='',_0x41cd76='';this[_0x55e6('0x1')]+=_0x44da02[_0x55e6('0x4')]();_0x4dd854=this['_localBuffer'];if(!this[_0x55e6('0x5')]){_0x5e0895=0x0;while(_0x1ac851[_0x5e0895]){while((_0x347488=_0x4dd854[_0x55e6('0x6')](_0x1ac851[_0x5e0895]))!=-0x1){_0x4e5a46=_0x1ac851[_0x5e0895];_0x41cd76=_0x4dd854[_0x55e6('0x7')](0x0,_0x347488);_0x4dd854=_0x4dd854[_0x55e6('0x7')](_0x347488+_0x4e5a46[_0x55e6('0x8')]);var _0x219b3b=_0x41cd76[_0x55e6('0x9')](_0x2e4a86),_0x591a77=0x0,_0x43d369={},_0x4d6c07='',_0x530246='',_0x5e0e02=-0x1;while(_0x219b3b[_0x591a77]){_0x5e0e02=_0x219b3b[_0x591a77][_0x55e6('0x6')](':');if(_0x5e0e02!=-0x1){_0x4d6c07=_0x219b3b[_0x591a77][_0x55e6('0xa')](0x0,_0x5e0e02)[_0x55e6('0xb')]();_0x530246=_0x219b3b[_0x591a77][_0x55e6('0xa')](_0x5e0e02+0x1)['trim']();if(_0x4d6c07[_0x55e6('0x8')]>0x0){_0x43d369[_0x4d6c07]=_0x530246;}}else{}_0x591a77++;}this[_0x55e6('0xc')](_0x55e6('0xd'),_0x43d369);this[_0x55e6('0x5')]=!![];}_0x5e0895++;}this[_0x55e6('0x1')]=_0x4dd854;}else{while((_0x4e2707=_0x4dd854['indexOf'](_0x2e4a86))!=-0x1){_0x41cd76=_0x4dd854[_0x55e6('0x7')](0x0,_0x4e2707);this[_0x55e6('0xc')]('line',_0x41cd76);_0x4dd854=_0x4dd854[_0x55e6('0x7')](_0x4e2707+_0x2e4a86[_0x55e6('0x8')]);}this['_localBuffer']=_0x4dd854;}_0x70cd2f();};module[_0x55e6('0xe')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 7fd4e8d..9e49be4 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 _0x28e3=['phone','getTrunkById','getSoundById','ShowSound','save_name','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','bluebird','moment','lodash','util','client','http','request','then','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x28e3,0x106));var _0x328e=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0x28e3[_0xc77819];return _0x1c9434;};'use strict';var BPromise=require(_0x328e('0x0'));var moment=require(_0x328e('0x1'));var _=require(_0x328e('0x2'));var util=require(_0x328e('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x328e('0x4')][_0x328e('0x5')]({'port':0x2329});function request(_0x106c30,_0x168893){return new BPromise(function(_0x8cdc14,_0x15aade){return client[_0x328e('0x6')](_0x106c30,_0x168893)[_0x328e('0x7')](function(_0x5e5bcf){if(_0x5e5bcf['error']){return _0x15aade(_0x5e5bcf['error'][_0x328e('0x8')]);}else{return _0x8cdc14(_0x5e5bcf[_0x328e('0x9')]);}})[_0x328e('0xa')](function(_0x6a5414){return _0x15aade(_0x6a5414);});});}exports[_0x328e('0xb')]=function(_0x4a4f53){return request(_0x328e('0xc'),{'options':{'raw':![],'where':{'name':_0x4a4f53},'attributes':[_0x328e('0xd')]}});};exports[_0x328e('0xe')]=function(_0x5368fb){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x5368fb},'include':[{'model':'MailServerOut','as':_0x328e('0xf')}],'attributes':['id',_0x328e('0x10'),_0x328e('0x11')]}});};exports[_0x328e('0x12')]=function(_0x32e15b){return request(_0x328e('0xc'),{'options':{'where':{'id':_0x32e15b},'attributes':[_0x328e('0x10')]}});};exports[_0x328e('0x13')]=function(_0x1d3e4a){return request(_0x328e('0x14'),{'options':{'where':{'id':_0x1d3e4a},'attributes':[_0x328e('0x10')]}});};exports['getVariableById']=function(_0x89600b){return request(_0x328e('0x15'),{'options':{'where':{'id':_0x89600b},'attributes':[_0x328e('0x10')]}});};exports[_0x328e('0x16')]=function(_0x29f8bf){return request(_0x328e('0x17'),{'options':{'where':{'id':_0x29f8bf},'attributes':[_0x328e('0x18')]}});};exports[_0x328e('0x19')]=function(_0x20901e){return request('ShowUser',{'options':{'where':{'id':_0x20901e},'attributes':[_0x328e('0x10')]}});};exports[_0x328e('0x1a')]=function(_0x116f46){return request(_0x328e('0x1b'),{'options':{'where':{'phone':_0x116f46[_0x328e('0x1c')]},'attributes':['id']}});};exports[_0x328e('0x1d')]=function(_0x41a6bb){return request('ShowTrunk',{'options':{'where':{'id':_0x41a6bb},'attributes':[_0x328e('0x10')]}});};exports[_0x328e('0x1e')]=function(_0x448f5a){return request(_0x328e('0x1f'),{'options':{'where':{'id':_0x448f5a},'attributes':[_0x328e('0x20')]}});};exports['getIntervalById']=function(_0x62e84d){return request(_0x328e('0x21'),{'options':{'raw':![],'where':{'id':_0x62e84d},'include':[{'model':_0x328e('0x22'),'as':'Intervals'}]}});};exports[_0x328e('0x23')]=function(_0x3bafb1){return request(_0x328e('0x24'),{'options':{'where':{'id':_0x3bafb1},'attributes':['id',_0x328e('0x10')]}});};exports[_0x328e('0x25')]=function(_0x1c43f8){return request(_0x328e('0x26'),{'body':_0x1c43f8});};exports[_0x328e('0x27')]=function(_0x3878d7){return request('CreateSquareDetailsReport',{'body':_0x3878d7});};exports['createSquareReport']=function(_0x139ef3){return request(_0x328e('0x28'),{'body':_[_0x328e('0x29')](_0x139ef3,{'project_name':_0x139ef3[_0x328e('0x2a')],'prev_project_name':_0x139ef3[_0x328e('0x2b')]||'','is_subproject':_0x139ef3['arg_2']?!![]:![],'leaveAt':moment()[_0x328e('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x328e('0x2d')]=function(_0x476b6a){return request(_0x328e('0x2e'),{'body':_0x476b6a});};exports[_0x328e('0x2f')]=function(_0x108f0d){return request('CreateSquareMessage',{'body':_0x108f0d});};exports['createCmContact']=function(_0x3bd897){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x3bd897['phone'],'ListId':_0x3bd897[_0x328e('0x30')]}}})[_0x328e('0x7')](function(_0x5873d1){if(_0x5873d1){return _0x5873d1;}return request(_0x328e('0x31'),{'body':_0x3bd897});});};exports[_0x328e('0x32')]=function(_0x4bdadc){return request(_0x328e('0x33'),{'options':{'where':{'id':_0x4bdadc},'attributes':[_0x328e('0x10')]}});};exports[_0x328e('0x34')]=function(_0x2304b6,_0x24702c){return request('LoginUser',{'body':{'interface':_0x24702c},'options':{'where':_0x2304b6}});};exports[_0x328e('0x35')]=function(_0x14d79e,_0x3da580,_0x35f27e){return request(_0x328e('0x36'),{'body':{'type':_0x3da580,'uniqueid':_0x35f27e},'options':{'where':_0x14d79e}});};exports[_0x328e('0x37')]=function(_0x37ba2e){return request(_0x328e('0x38'),{'body':{},'options':{'where':_0x37ba2e}});};exports[_0x328e('0x39')]=function(_0x56a1ea){return request('LogoutUser',{'body':{},'options':{'where':_0x56a1ea}});}; \ No newline at end of file +var _0x34f8=['CreateSquareReport','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','jayson/promise','request','then','message','result','catch','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','GetContactByPhone','phone','getTrunkById','getSoundById','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport'];(function(_0x4e4423,_0x530265){var _0x466c57=function(_0x1433f){while(--_0x1433f){_0x4e4423['push'](_0x4e4423['shift']());}};_0x466c57(++_0x530265);}(_0x34f8,0x80));var _0x834f=function(_0x29e2ba,_0x1b171f){_0x29e2ba=_0x29e2ba-0x0;var _0x5c5920=_0x34f8[_0x29e2ba];return _0x5c5920;};'use strict';var BPromise=require(_0x834f('0x0'));var moment=require(_0x834f('0x1'));var _=require(_0x834f('0x2'));var util=require(_0x834f('0x3'));var jayson=require(_0x834f('0x4'));var client=jayson['client']['http']({'port':0x2329});function request(_0xe34aa5,_0x92264b){return new BPromise(function(_0x4d23b1,_0x4652f9){return client[_0x834f('0x5')](_0xe34aa5,_0x92264b)[_0x834f('0x6')](function(_0x3498dd){if(_0x3498dd['error']){return _0x4652f9(_0x3498dd['error'][_0x834f('0x7')]);}else{return _0x4d23b1(_0x3498dd[_0x834f('0x8')]);}})[_0x834f('0x9')](function(_0x436eb3){return _0x4652f9(_0x436eb3);});});}exports['getSquareProject']=function(_0x4210cf){return request(_0x834f('0xa'),{'options':{'raw':![],'where':{'name':_0x4210cf},'attributes':['production']}});};exports[_0x834f('0xb')]=function(_0x353699){return request(_0x834f('0xc'),{'options':{'raw':![],'where':{'id':_0x353699},'include':[{'model':_0x834f('0xd'),'as':_0x834f('0xe')}],'attributes':['id',_0x834f('0xf'),_0x834f('0x10')]}});};exports[_0x834f('0x11')]=function(_0x4f919a){return request(_0x834f('0xa'),{'options':{'where':{'id':_0x4f919a},'attributes':[_0x834f('0xf')]}});};exports[_0x834f('0x12')]=function(_0xda9f2d){return request(_0x834f('0x13'),{'options':{'where':{'id':_0xda9f2d},'attributes':['name']}});};exports[_0x834f('0x14')]=function(_0x2f8592){return request('ShowVariable',{'options':{'where':{'id':_0x2f8592},'attributes':[_0x834f('0xf')]}});};exports[_0x834f('0x15')]=function(_0x55bc81){return request(_0x834f('0x16'),{'options':{'where':{'id':_0x55bc81},'attributes':['dsn']}});};exports[_0x834f('0x17')]=function(_0x438187){return request(_0x834f('0x18'),{'options':{'where':{'id':_0x438187},'attributes':[_0x834f('0xf')]}});};exports['getContactByPhone']=function(_0x58154d){return request(_0x834f('0x19'),{'options':{'where':{'phone':_0x58154d[_0x834f('0x1a')]},'attributes':['id']}});};exports[_0x834f('0x1b')]=function(_0x320ee2){return request('ShowTrunk',{'options':{'where':{'id':_0x320ee2},'attributes':[_0x834f('0xf')]}});};exports[_0x834f('0x1c')]=function(_0x29cccd){return request('ShowSound',{'options':{'where':{'id':_0x29cccd},'attributes':['save_name']}});};exports[_0x834f('0x1d')]=function(_0x5535e9){return request(_0x834f('0x1e'),{'options':{'raw':![],'where':{'id':_0x5535e9},'include':[{'model':_0x834f('0x1f'),'as':'Intervals'}]}});};exports[_0x834f('0x20')]=function(_0x5e4fa2){return request(_0x834f('0x21'),{'options':{'where':{'id':_0x5e4fa2},'attributes':['id',_0x834f('0xf')]}});};exports[_0x834f('0x22')]=function(_0x24cf5d){return request('CreateSmsMessage',{'body':_0x24cf5d});};exports[_0x834f('0x23')]=function(_0x4f62c8){return request(_0x834f('0x24'),{'body':_0x4f62c8});};exports['createSquareReport']=function(_0x536907){return request(_0x834f('0x25'),{'body':_['merge'](_0x536907,{'project_name':_0x536907['arg_1'],'prev_project_name':_0x536907['arg_2']||'','is_subproject':_0x536907[_0x834f('0x26')]?!![]:![],'leaveAt':moment()[_0x834f('0x27')](_0x834f('0x28'))})});};exports[_0x834f('0x29')]=function(_0x44355b){return request(_0x834f('0x2a'),{'body':_0x44355b});};exports[_0x834f('0x2b')]=function(_0x139495){return request(_0x834f('0x2c'),{'body':_0x139495});};exports[_0x834f('0x2d')]=function(_0x2338de){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x2338de[_0x834f('0x1a')],'ListId':_0x2338de[_0x834f('0x2e')]}}})[_0x834f('0x6')](function(_0x586324){if(_0x586324){return _0x586324;}return request(_0x834f('0x2f'),{'body':_0x2338de});});};exports[_0x834f('0x30')]=function(_0x20da2d){return request(_0x834f('0x31'),{'options':{'where':{'id':_0x20da2d},'attributes':['name']}});};exports[_0x834f('0x32')]=function(_0x2a68b1,_0xd411e){return request(_0x834f('0x33'),{'body':{'interface':_0xd411e},'options':{'where':_0x2a68b1}});};exports['agentPause']=function(_0x3fc0ef,_0x345acc,_0x55d4af){return request(_0x834f('0x34'),{'body':{'type':_0x345acc,'uniqueid':_0x55d4af},'options':{'where':_0x3fc0ef}});};exports['agentUnpause']=function(_0x38f165){return request(_0x834f('0x35'),{'body':{},'options':{'where':_0x38f165}});};exports['agentLogout']=function(_0x456a78){return request(_0x834f('0x36'),{'body':{},'options':{'where':_0x456a78}});}; \ 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 deb0167..e5d2c47 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 _0xcf98=['exports','./lex'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xcf98,0x8d));var _0x8cf9=function(_0xa4843c,_0x2a1998){_0xa4843c=_0xa4843c-0x0;var _0x90badf=_0xcf98[_0xa4843c];return _0x90badf;};var polly=require('./polly');var lex=require(_0x8cf9('0x0'));module[_0x8cf9('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xc319=['./lex','exports','./polly'];(function(_0x15d409,_0x16c2ee){var _0x379106=function(_0x3ab526){while(--_0x3ab526){_0x15d409['push'](_0x15d409['shift']());}};_0x379106(++_0x16c2ee);}(_0xc319,0x12e));var _0x9c31=function(_0x5e589f,_0x30c06f){_0x5e589f=_0x5e589f-0x0;var _0x3e6d35=_0xc319[_0x5e589f];return _0x3e6d35;};var polly=require(_0x9c31('0x0'));var lex=require(_0x9c31('0x1'));module[_0x9c31('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 34fbd46..1ae8a3c 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa571=['exports','./lib/api'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0xa571,0x107));var _0x1a57=function(_0xbf6d20,_0x55d1b1){_0xbf6d20=_0xbf6d20-0x0;var _0x1e6b38=_0xa571[_0xbf6d20];return _0x1e6b38;};'use strict';var lex=require(_0x1a57('0x0'));module[_0x1a57('0x1')]=function(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a){return lex(_0x206f1b,_0x1067d9,_0x48485e,_0x1a071f,_0x2eebaa,_0x4d5f7a);}; \ No newline at end of file +var _0x4483=['exports','./lib/api'];(function(_0x281ec2,_0x27257c){var _0x2ea8d5=function(_0x196fae){while(--_0x196fae){_0x281ec2['push'](_0x281ec2['shift']());}};_0x2ea8d5(++_0x27257c);}(_0x4483,0x1a3));var _0x3448=function(_0x2c9bc9,_0x9797d3){_0x2c9bc9=_0x2c9bc9-0x0;var _0x652fc3=_0x4483[_0x2c9bc9];return _0x652fc3;};'use strict';var lex=require(_0x3448('0x0'));module[_0x3448('0x1')]=function(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178){return lex(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178);}; \ 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 7d01d75..7a3d50b 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(_0x133e75,_0x58044d){var _0x13941d=function(_0x1d75ad){while(--_0x1d75ad){_0x133e75['push'](_0x133e75['shift']());}};_0x13941d(++_0x58044d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0xe60d50,_0x1fb66d){var _0x789475=function(_0x334e9d){while(--_0x334e9d){_0xe60d50['push'](_0xe60d50['shift']());}};_0x789475(++_0x1fb66d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 065f7e7..e7b6806 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var polly=require('./lib/api');module['exports']=function(_0x344330,_0x12f840,_0x4cabdd,_0x3fd229,_0x4c5213,_0x27a5fa,_0x15132c){return polly(_0x344330,_0x12f840,_0x4cabdd,_0x3fd229,_0x4c5213,_0x27a5fa,_0x15132c);}; \ No newline at end of file +var _0xa854=['exports'];(function(_0x2e2ee0,_0x4497e4){var _0x1d04a6=function(_0x71dabe){while(--_0x71dabe){_0x2e2ee0['push'](_0x2e2ee0['shift']());}};_0x1d04a6(++_0x4497e4);}(_0xa854,0xfc));var _0x4a85=function(_0x1dcf64,_0x387af5){_0x1dcf64=_0x1dcf64-0x0;var _0x13b700=_0xa854[_0x1dcf64];return _0x13b700;};'use strict';var polly=require('./lib/api');module[_0x4a85('0x0')]=function(_0x401b73,_0x55b5d4,_0x3b1c92,_0xc0a9ec,_0x126204,_0x2eddae,_0x365a2b){return polly(_0x401b73,_0x55b5d4,_0x3b1c92,_0xc0a9ec,_0x126204,_0x2eddae,_0x365a2b);}; \ 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 f23ab25..bea77e0 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 _0xf1be=['bluebird','randomstring','synthesizeSpeech','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0xf1be,0xc5));var _0xef1b=function(_0x99fe82,_0xea142e){_0x99fe82=_0x99fe82-0x0;var _0x31d21f=_0xf1be[_0x99fe82];return _0x31d21f;};'use strict';var fs=require('fs');var path=require(_0xef1b('0x0'));var BPromise=require(_0xef1b('0x1'));var rs=require(_0xef1b('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x43ca18,_0x168a5d,_0xec1a80){return new BPromise(function(_0x4a4282,_0x5c33ea){_0x43ca18[_0xef1b('0x3')](_0x168a5d,function(_0x3af34e,_0x57ec38){if(_0x3af34e){_0x5c33ea(_0x3af34e);}else if(_0x57ec38){if(_0x57ec38[_0xef1b('0x4')]instanceof Buffer){fs['writeFile'](_0xec1a80,_0x57ec38[_0xef1b('0x4')],function(_0x3eda6f){if(_0x3eda6f){_0x5c33ea(_0x3eda6f);}else{_0x4a4282();}});}else{_0x5c33ea(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x5c33ea(new Error(_0xef1b('0x5')));}});});}module['exports']=function(_0x2bd65d,_0x11f885,_0x47e864,_0x477fcd,_0x21ff06,_0x5bf0ed,_0x1eda27){var _0x26d382=new AWS[(_0xef1b('0x6'))]({'accessKeyId':_0x2bd65d,'secretAccessKey':_0x11f885,'region':_0x47e864});var _0x45c4f3={'Text':_0x21ff06,'TextType':_0x5bf0ed||_0xef1b('0x7'),'OutputFormat':_0xef1b('0x8'),'VoiceId':_0x477fcd};return pollyResult(_0x26d382,_0x45c4f3,_0x1eda27);}; \ No newline at end of file +var _0x5bc6=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','bluebird','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x5bc6,0x9a));var _0x65bc=function(_0x5e566c,_0x2ff6cc){_0x5e566c=_0x5e566c-0x0;var _0x416b06=_0x5bc6[_0x5e566c];return _0x416b06;};'use strict';var fs=require('fs');var path=require(_0x65bc('0x0'));var BPromise=require(_0x65bc('0x1'));var rs=require('randomstring');var AWS=require(_0x65bc('0x2'));function pollyResult(_0x35096c,_0xfd78db,_0x2c5f58){return new BPromise(function(_0x178ba6,_0x3dcfc8){_0x35096c[_0x65bc('0x3')](_0xfd78db,function(_0x4885e6,_0x1df563){if(_0x4885e6){_0x3dcfc8(_0x4885e6);}else if(_0x1df563){if(_0x1df563[_0x65bc('0x4')]instanceof Buffer){fs[_0x65bc('0x5')](_0x2c5f58,_0x1df563['AudioStream'],function(_0x54c1e6){if(_0x54c1e6){_0x3dcfc8(_0x54c1e6);}else{_0x178ba6();}});}else{_0x3dcfc8(new Error(_0x65bc('0x6')));}}else{_0x3dcfc8(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x65bc('0x7')]=function(_0x10dd9c,_0x3e533b,_0x1eb235,_0x34faaa,_0x4d2a13,_0x118d74,_0x1fdaa5){var _0x4ad176=new AWS[(_0x65bc('0x8'))]({'accessKeyId':_0x10dd9c,'secretAccessKey':_0x3e533b,'region':_0x1eb235});var _0x47fe6d={'Text':_0x4d2a13,'TextType':_0x118d74||_0x65bc('0x9'),'OutputFormat':'mp3','VoiceId':_0x34faaa};return pollyResult(_0x4ad176,_0x47fe6d,_0x1fdaa5);}; \ 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 efe61ed..f438386 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 _0x314e=['exports'];(function(_0xa28533,_0x2475d0){var _0x4d3d4b=function(_0x575577){while(--_0x575577){_0xa28533['push'](_0xa28533['shift']());}};_0x4d3d4b(++_0x2475d0);}(_0x314e,0x156));var _0xe314=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x314e[_0x20a584];return _0x4b41a8;};'use strict';var asr=require('./lib/api');module[_0xe314('0x0')]=function(_0x17b052,_0x58fd45,_0x487412,_0x495d70){return asr(_0x17b052,_0x58fd45,_0x487412);}; \ No newline at end of file +var _0x0155=['./lib/api','exports'];(function(_0x375bbc,_0x26b3e8){var _0x4a2f03=function(_0x331db4){while(--_0x331db4){_0x375bbc['push'](_0x375bbc['shift']());}};_0x4a2f03(++_0x26b3e8);}(_0x0155,0x10a));var _0x5015=function(_0x180791,_0x4ec373){_0x180791=_0x180791-0x0;var _0x1dc7d7=_0x0155[_0x180791];return _0x1dc7d7;};'use strict';var asr=require(_0x5015('0x0'));module[_0x5015('0x1')]=function(_0x5274e2,_0x5e3502,_0x5a3251,_0x36bd3a){return asr(_0x5274e2,_0x5e3502,_0x5a3251);}; \ 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 cf394b7..50b36df 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 _0xf257=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','LINEAR16','https://speech.googleapis.com','exports'];(function(_0x206083,_0x583850){var _0x484145=function(_0x29f5f8){while(--_0x29f5f8){_0x206083['push'](_0x206083['shift']());}};_0x484145(++_0x583850);}(_0xf257,0x82));var _0x7f25=function(_0x28d0f7,_0x579973){_0x28d0f7=_0x28d0f7-0x0;var _0x45d26b=_0xf257[_0x28d0f7];return _0x45d26b;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x7f25('0x0');module[_0x7f25('0x1')]=function(_0x3f7a94,_0x22d4a9,_0x5c712c){return new BPromise(function(_0x159dd1,_0x2aca61){var _0xd94d7a;if(typeof _0x3f7a94!==_0x7f25('0x2')||_0x3f7a94[_0x7f25('0x3')]===0x0){return _0x2aca61(_0x7f25('0x4'));}if(typeof _0x22d4a9!==_0x7f25('0x2')||_0x22d4a9[_0x7f25('0x3')]===0x0){return _0x2aca61(_0x7f25('0x5'));}if(typeof _0x5c712c!==_0x7f25('0x6')&&(typeof _0x5c712c!==_0x7f25('0x2')||_0x5c712c[_0x7f25('0x3')]===0x0)){return _0x2aca61(_0x7f25('0x7'));}try{_0xd94d7a=fs[_0x7f25('0x8')](_0x3f7a94)['toString'](_0x7f25('0x9'));}catch(_0x362a80){return _0x2aca61(_0x362a80);}return _0x159dd1({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x22d4a9,'body':{'config':{'encoding':_0x7f25('0xa'),'sampleRateHertz':'8000','languageCode':_0x5c712c},'audio':{'content':_0xd94d7a}},'json':!![]});});}; \ No newline at end of file +var _0xadb8=['key\x20should\x20be\x20a\x20string','undefined','base64','LINEAR16','8000','https://speech.googleapis.com','string','filepath\x20should\x20be\x20a\x20string','length'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xadb8,0x1d0));var _0x8adb=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0xadb8[_0x810e4d];return _0x13f01c;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x8adb('0x0');module['exports']=function(_0x2b8a76,_0x2a0b30,_0x24f912){return new BPromise(function(_0x1bf88c,_0x44fdf7){var _0x2baedb;if(typeof _0x2b8a76!==_0x8adb('0x1')||_0x2b8a76['length']===0x0){return _0x44fdf7(_0x8adb('0x2'));}if(typeof _0x2a0b30!==_0x8adb('0x1')||_0x2a0b30[_0x8adb('0x3')]===0x0){return _0x44fdf7(_0x8adb('0x4'));}if(typeof _0x24f912!==_0x8adb('0x5')&&(typeof _0x24f912!==_0x8adb('0x1')||_0x24f912[_0x8adb('0x3')]===0x0)){return _0x44fdf7('lang\x20should\x20be\x20a\x20string');}try{_0x2baedb=fs['readFileSync'](_0x2b8a76)['toString'](_0x8adb('0x6'));}catch(_0x5be2f4){return _0x44fdf7(_0x5be2f4);}return _0x1bf88c({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x2a0b30,'body':{'config':{'encoding':_0x8adb('0x7'),'sampleRateHertz':_0x8adb('0x8'),'languageCode':_0x24f912},'audio':{'content':_0x2baedb}},'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 56b82fa..3a4ad76 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 _0x6960=['./asr','exports'];(function(_0x16bd21,_0x3410da){var _0x3224c0=function(_0x460adc){while(--_0x460adc){_0x16bd21['push'](_0x16bd21['shift']());}};_0x3224c0(++_0x3410da);}(_0x6960,0x132));var _0x0696=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x6960[_0x4a9fb1];return _0x348672;};var asr=require(_0x0696('0x0'));module[_0x0696('0x1')]={'asr':asr}; \ No newline at end of file +var _0xca70=['./asr'];(function(_0x5855c6,_0x272865){var _0x1e65b5=function(_0x20b078){while(--_0x20b078){_0x5855c6['push'](_0x5855c6['shift']());}};_0x1e65b5(++_0x272865);}(_0xca70,0xb4));var _0x0ca7=function(_0x49d5ef,_0x24f7bf){_0x49d5ef=_0x49d5ef-0x0;var _0x1398a5=_0xca70[_0x49d5ef];return _0x1398a5;};var asr=require(_0x0ca7('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index f627633..d9a1c08 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 _0xddd7=['join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','googleDialogflow','textRequest','result','source','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','util','./aws','./sestek','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','input','voice','audioConfig','MP3','text:synthesize','POST','then','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','null','generic','parse\x20response\x20failed:\x0a','length','googleASR','asr','uri','results','map','alternatives'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xddd7,0x1ce));var _0x7ddd=function(_0x5ed2a7,_0x5ed97f){_0x5ed2a7=_0x5ed2a7-0x0;var _0x42d807=_0xddd7[_0x5ed2a7];return _0x42d807;};'use strict';var apiai=require(_0x7ddd('0x0'));var BPromise=require(_0x7ddd('0x1'));var dialogflow=require(_0x7ddd('0x2'));var fs=require('fs');var http=require(_0x7ddd('0x3'));var https=require(_0x7ddd('0x4'));var md5=require(_0x7ddd('0x5'));var path=require(_0x7ddd('0x6'));var querystring=require('querystring');var rp=require(_0x7ddd('0x7'));var rs=require(_0x7ddd('0x8'));var sox=require(_0x7ddd('0x9'));var tts=require(_0x7ddd('0xa'));var urlParse=require('url')['parse'];var util=require(_0x7ddd('0xb'));var aws=require(_0x7ddd('0xc'));var google=require('./google');var sestek=require(_0x7ddd('0xd'));var tilde=require('./tilde');var logger=require('../../../config/logger')(_0x7ddd('0xe'));var ISPEECH_API=_0x7ddd('0xf');function downloadFile(_0x1cf75b,_0x4095c6){return new BPromise(function(_0xb541a9,_0x199e26){var _0x5d5b80=urlParse(_0x1cf75b);var _0x2152af=_0x5d5b80[_0x7ddd('0x10')]===_0x7ddd('0x11')?https:http;var _0x1dd4ee={'host':_0x5d5b80['host'],'path':_0x5d5b80[_0x7ddd('0x6')],'headers':{'user-agent':_0x7ddd('0x12')}};_0x2152af[_0x7ddd('0x13')](_0x1dd4ee,function(_0x902c56){if(_0x902c56[_0x7ddd('0x14')]!==0xc8){logger[_0x7ddd('0x15')](_0x7ddd('0x16')+_0x1cf75b+_0x7ddd('0x17')+_0x902c56[_0x7ddd('0x14')]+'\x20('+_0x902c56[_0x7ddd('0x18')]+')');_0x199e26(new Error(_0x7ddd('0x16')+_0x1cf75b+_0x7ddd('0x17')+_0x902c56[_0x7ddd('0x14')]+'\x20('+_0x902c56['statusMessage']+')'));return;}var _0x55893c=fs['createWriteStream'](_0x4095c6);_0x55893c['on'](_0x7ddd('0x19'),function(){logger['info'](_0x7ddd('0x1a'));_0x55893c[_0x7ddd('0x1b')](_0xb541a9);});_0x55893c['on'](_0x7ddd('0x15'),function(_0x140678){fs[_0x7ddd('0x1c')](_0x4095c6);logger[_0x7ddd('0x15')](_0x7ddd('0x1d'),_0x140678);_0x199e26(_0x140678);});_0x902c56[_0x7ddd('0x1e')](_0x55893c);})['on'](_0x7ddd('0x15'),function(_0x5ae67f){logger['error'](_0x5ae67f);_0x199e26(_0x5ae67f);})[_0x7ddd('0x1f')]();});}function uploadFile(_0x5decf4){return new BPromise(function(_0x140476,_0xc6cd16){var _0x1874d2=urlParse(_0x5decf4);var _0x24a916=_0x1874d2[_0x7ddd('0x10')]===_0x7ddd('0x11')?https:http;var _0x43d15d={'host':_0x1874d2['host'],'path':_0x1874d2[_0x7ddd('0x6')],'headers':{'user-agent':_0x7ddd('0x12')}};_0x24a916[_0x7ddd('0x13')](_0x43d15d,function(_0x29b4a3){if(_0x29b4a3[_0x7ddd('0x14')]!==0xc8){_0xc6cd16(new Error(_0x7ddd('0x16')+_0x5decf4+_0x7ddd('0x17')+_0x29b4a3[_0x7ddd('0x14')]+'\x20('+_0x29b4a3[_0x7ddd('0x18')]+')'));return;}var _0x265af0='';_0x29b4a3['on'](_0x7ddd('0x20'),function(_0xdca9c){_0x265af0+=_0xdca9c;});_0x29b4a3['on'](_0x7ddd('0x1f'),function(){_0x140476(_0x265af0);});})['on'](_0x7ddd('0x15'),function(_0x1221e6){_0xc6cd16(_0x1221e6);})[_0x7ddd('0x1f')]();});}function convertFile(_0x1dac7e,_0x5148ad){return new BPromise(function(_0x56dddc,_0x369dfc){var _0x2102f9=sox[_0x7ddd('0x21')](_0x1dac7e,_0x5148ad,{'sampleRate':0x1f40,'format':_0x7ddd('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2102f9['on']('error',function(_0x58f159){logger[_0x7ddd('0x15')](_0x7ddd('0x23'),_0x58f159);_0x369dfc(_0x58f159);});_0x2102f9['on'](_0x7ddd('0x1f'),function(){logger[_0x7ddd('0x24')](_0x7ddd('0x25'));_0x56dddc();});_0x2102f9[_0x7ddd('0x26')]();});}function base64Decode(_0x3e3686,_0x3f8ffe){var _0x21294f=path[_0x7ddd('0x27')](__dirname,_0x7ddd('0x28'),rs[_0x7ddd('0x29')](0x4)+_0x7ddd('0x2a'));fs[_0x7ddd('0x2b')](_0x21294f,_0x3e3686,_0x7ddd('0x2c'));return convertFile(_0x21294f,_0x3f8ffe)['then'](function(){try{fs[_0x7ddd('0x1c')](_0x21294f);fs[_0x7ddd('0x2d')](_0x3f8ffe,_0x7ddd('0x2e'));}catch(_0x193b0c){logger[_0x7ddd('0x15')](_0x193b0c);}return _0x3f8ffe[_0x7ddd('0x2f')]('.')[0x0];});}function base64Encode(_0x1ea406){var _0x5e1f7f=fs[_0x7ddd('0x30')](_0x1ea406);return new Buffer(_0x5e1f7f)['toString']('base64');}exports[_0x7ddd('0x31')]=function(_0xd32dd0,_0x3b8fea,_0x12e7c3,_0x1ae21c,_0x16a567,_0xe3b554){var _0x560797,_0x4975dc;var _0x46192b=_0x7ddd('0x32');var _0x45494d='?key='+_0xd32dd0;var _0xaa1f87={};if(_0x3b8fea==='ssml'){_0xaa1f87[_0x7ddd('0x33')]={'ssml':_0x12e7c3};}else{_0xaa1f87[_0x7ddd('0x33')]={'text':_0x12e7c3};};_0xaa1f87[_0x7ddd('0x34')]={'languageCode':_0x1ae21c,'ssmlGender':_0x16a567};_0xaa1f87[_0x7ddd('0x35')]={'audioEncoding':_0x7ddd('0x36'),'sampleRateHertz':0x1f40};var _0x591a5e={'url':_0x46192b+_0x7ddd('0x37')+_0x45494d,'method':_0x7ddd('0x38'),'json':!![],'body':_0xaa1f87};return rp(_0x591a5e)[_0x7ddd('0x39')](function(_0x240b99){return new BPromise(function(_0x850430,_0x10b7cc){_0x560797=path[_0x7ddd('0x27')](__dirname,_0x7ddd('0x28'),rs[_0x7ddd('0x29')](0x4)+_0x7ddd('0x3a'));var _0x1e7eb3=Buffer[_0x7ddd('0x3b')](_0x240b99[_0x7ddd('0x3c')],_0x7ddd('0x2c'));return fs[_0x7ddd('0x3d')](_0x560797,_0x1e7eb3,function(_0x484613){_0x10b7cc(_0x484613);},function(_0xcdcf20){fs[_0x7ddd('0x2d')](_0x560797,_0x7ddd('0x2e'));_0x850430(_0xcdcf20);});});})[_0x7ddd('0x39')](function(_0x2dd1b2){_0x4975dc=path['resolve'](__dirname,_0x7ddd('0x28'),rs[_0x7ddd('0x29')](0x4)+_0x7ddd('0x2a'));return convertFile(_0x560797,_0x4975dc);})['then'](function(){try{fs[_0x7ddd('0x1c')](_0x560797);fs[_0x7ddd('0x2d')](_0x4975dc,_0x7ddd('0x2e'));}catch(_0xee1487){logger['error'](_0xee1487);}logger[_0x7ddd('0x24')](_0x7ddd('0x3e'),_0x4975dc[_0x7ddd('0x2f')]('.')[0x0]);return _0x4975dc[_0x7ddd('0x2f')]('.')[0x0];});};exports[_0x7ddd('0x3f')]=function(_0x14847d,_0x4c3ea1){var _0x279179=_0x7ddd('0x40');var _0x3b92f1,_0x355ba;var _0x2effa0;var _0xaae26c={'encoding':_0x7ddd('0x41'),'method':_0x7ddd('0x38'),'timeout':0x2710,'url':_0x279179,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x7ddd('0x42')+encodeURIComponent(JSON[_0x7ddd('0x43')]([[['jQ1olc',JSON[_0x7ddd('0x43')]([_0x14847d,_0x4c3ea1||'en',![],_0x7ddd('0x44')]),null,_0x7ddd('0x45')]]]))};return rp(_0xaae26c)[_0x7ddd('0x39')](function(_0x2abd24){try{_0x2effa0=eval(_0x2abd24['slice'](0x5))[0x0][0x2];}catch(_0x4f9a38){throw new Error(_0x7ddd('0x46')+_0x2abd24[_0x7ddd('0x20')]);}if(!_0x2effa0){if(_0x14847d[_0x7ddd('0x47')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x4c3ea1+'\x22\x20might\x20not\x20exist');}}try{_0x2effa0=eval(_0x2effa0)[0x0];}catch(_0x233c28){throw new Error(_0x7ddd('0x46')+res[_0x7ddd('0x20')]);}const _0x65e8f2=_0x2effa0;_0x3b92f1=path['resolve'](__dirname,_0x7ddd('0x28'),rs[_0x7ddd('0x29')](0x4)+_0x7ddd('0x3a'));fs['writeFileSync'](_0x3b92f1,_0x2effa0,{'encoding':'base64'});_0x355ba=path['resolve'](__dirname,_0x7ddd('0x28'),rs[_0x7ddd('0x29')](0x4)+_0x7ddd('0x2a'));return convertFile(_0x3b92f1,_0x355ba);})['then'](function(){try{fs['unlink'](_0x3b92f1);fs['chmodSync'](_0x355ba,_0x7ddd('0x2e'));}catch(_0x4081dd){logger['error'](_0x4081dd);}logger[_0x7ddd('0x24')]('goggleTTS\x20path',_0x355ba[_0x7ddd('0x2f')]('.')[0x0]);return _0x355ba[_0x7ddd('0x2f')]('.')[0x0];});};exports[_0x7ddd('0x48')]=function(_0x5e506f,_0x14e746,_0xd997c2){return google[_0x7ddd('0x49')](_0x5e506f,_0x14e746,_0xd997c2)['then'](function(_0x24c00a){logger[_0x7ddd('0x24')](_0x24c00a[_0x7ddd('0x4a')]);return rp(_0x24c00a);})[_0x7ddd('0x39')](function(_0x12ff50){var _0x33a560='';var _0x106157=0x0;try{fs[_0x7ddd('0x1c')](_0x5e506f);}catch(_0x3a9740){logger['error'](_0x3a9740);}if(_0x12ff50&&_0x12ff50[_0x7ddd('0x4b')]){_0x33a560=_0x12ff50['results'][_0x7ddd('0x4c')](function(_0x144959){return _0x144959&&_0x144959[_0x7ddd('0x4d')][0x0]&&_0x144959[_0x7ddd('0x4d')][0x0]['transcript']?_0x144959[_0x7ddd('0x4d')][0x0]['transcript']:'';})[_0x7ddd('0x4e')]('\x0a');_0x106157=_0x12ff50['results'][_0x7ddd('0x4c')](function(_0x170713){return _0x170713&&_0x170713[_0x7ddd('0x4d')][0x0]&&_0x170713[_0x7ddd('0x4d')][0x0][_0x7ddd('0x4f')]?_0x170713[_0x7ddd('0x4d')][0x0][_0x7ddd('0x4f')]:0x0;})['join']('\x0a');}logger[_0x7ddd('0x24')](_0x7ddd('0x50'),_0x33a560);logger[_0x7ddd('0x24')](_0x7ddd('0x51'),_0x106157);return{'transcript':_0x33a560,'confidence':_0x106157};})[_0x7ddd('0x52')](function(_0x68d255){logger['error']('[%s]\x20%s:%s',_0x68d255['statusCode'],_0x68d255[_0x7ddd('0x53')],_0x68d255['message']);});};exports[_0x7ddd('0x54')]=function(_0x3b03f5,_0x4dd703,_0x4a68ab,_0x37a415){var _0x4947cc=apiai(_0x4dd703,{'language':_0x37a415||'en'});return _0x4947cc[_0x7ddd('0x55')](_0x4a68ab,{'sessionId':md5(_0x3b03f5)})[_0x7ddd('0x39')](function(_0x29eec6){logger[_0x7ddd('0x24')](JSON[_0x7ddd('0x43')](_0x29eec6));return{'source':_0x29eec6[_0x7ddd('0x56')][_0x7ddd('0x57')],'resolvedQuery':_0x29eec6[_0x7ddd('0x56')]['resolvedQuery'],'action':_0x29eec6[_0x7ddd('0x56')]['action'],'actionIncomplete':_0x29eec6[_0x7ddd('0x56')][_0x7ddd('0x58')],'speech':_0x29eec6[_0x7ddd('0x56')][_0x7ddd('0x59')][_0x7ddd('0x5a')],'score':_0x29eec6[_0x7ddd('0x56')][_0x7ddd('0x5b')],'statusCode':_0x29eec6[_0x7ddd('0x5c')][_0x7ddd('0x5d')],'endConversation':_0x29eec6[_0x7ddd('0x56')][_0x7ddd('0x5e')][_0x7ddd('0x5f')]||![],'isFallbackIntent':_0x29eec6[_0x7ddd('0x56')][_0x7ddd('0x5e')]['isFallbackIntent']};});};exports[_0x7ddd('0x60')]=function(_0x1b8fbc,_0xc4dcf3,_0x4d3ad2,_0x5631c0,_0x27238b,_0x2d34a8){var _0x21ce16=_0x5631c0[_0x7ddd('0x61')](/\\n/g,'\x0a');var _0x12e261={'credentials':{'private_key':_0x21ce16,'client_email':_0x4d3ad2}};var _0xfaaf24=new dialogflow[(_0x7ddd('0x62'))](_0x12e261);var _0x444b89=_0xfaaf24[_0x7ddd('0x63')](_0xc4dcf3,md5(_0x1b8fbc));var _0x20883d={'session':_0x444b89,'queryInput':{'text':{'text':_0x27238b,'languageCode':_0x2d34a8}}};return _0xfaaf24[_0x7ddd('0x64')](_0x20883d)[_0x7ddd('0x39')](function(_0x507d47){if(_0x507d47&&_0x507d47[_0x7ddd('0x47')]){logger[_0x7ddd('0x24')]('Dialogflow\x20V2\x20response:',JSON[_0x7ddd('0x43')](_0x507d47));var _0x31b401=_0x507d47[0x0];if(_0x31b401){var _0x201765={'action':_0x31b401[_0x7ddd('0x65')][_0x7ddd('0x66')],'allRequiredParamsPresent':_0x31b401[_0x7ddd('0x65')][_0x7ddd('0x67')],'endConversation':_0x31b401['queryResult']['diagnosticInfo']&&_0x31b401[_0x7ddd('0x65')][_0x7ddd('0x68')][_0x7ddd('0x69')]?_0x31b401[_0x7ddd('0x65')][_0x7ddd('0x68')][_0x7ddd('0x69')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x31b401[_0x7ddd('0x65')][_0x7ddd('0x6a')],'intentName':_0x31b401['queryResult'][_0x7ddd('0x6b')]['name'],'intentDisplayName':_0x31b401[_0x7ddd('0x65')][_0x7ddd('0x6b')][_0x7ddd('0x6c')],'isFallbackIntent':_0x31b401[_0x7ddd('0x65')][_0x7ddd('0x6b')][_0x7ddd('0x6d')],'languageCode':_0x31b401[_0x7ddd('0x65')][_0x7ddd('0x6e')],'queryText':_0x31b401[_0x7ddd('0x65')][_0x7ddd('0x6f')],'responseId':_0x31b401[_0x7ddd('0x70')],'score':_0x31b401[_0x7ddd('0x65')][_0x7ddd('0x71')],'speech':_0x31b401['queryResult'][_0x7ddd('0x6a')],'providerResponse':JSON['stringify'](_0x507d47)};return _0x201765;}}});};exports[_0x7ddd('0x72')]=function(_0xda04e3,_0x241296,_0x16a186,_0xe89025){return tilde['asr'](_0xda04e3,_0x241296,_0x16a186,_0xe89025)['then'](function(_0x597e3c){try{fs[_0x7ddd('0x1c')](_0xda04e3);}catch(_0x3167fb){logger[_0x7ddd('0x15')](_0x3167fb);}logger[_0x7ddd('0x24')](_0x7ddd('0x73'),_0x597e3c['transcript']);logger[_0x7ddd('0x24')](_0x7ddd('0x74'),_0x597e3c[_0x7ddd('0x4f')]);return _0x597e3c;});};exports['awsPolly']=function(_0x3d552f,_0x47d273,_0x4f9247,_0x17a2a3,_0x1d1663,_0x56436b){var _0x2686b5=path['resolve'](__dirname,'tmp',rs[_0x7ddd('0x29')](0x4)+_0x7ddd('0x3a'));var _0x1256bb;return aws[_0x7ddd('0x75')](_0x3d552f,_0x47d273,_0x4f9247,_0x17a2a3,_0x1d1663,_0x56436b,_0x2686b5)['then'](function(){_0x1256bb=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x7ddd('0x2a'));return convertFile(_0x2686b5,_0x1256bb);})['then'](function(){try{fs[_0x7ddd('0x1c')](_0x2686b5);fs[_0x7ddd('0x2d')](_0x1256bb,_0x7ddd('0x2e'));}catch(_0x1c5d4e){logger[_0x7ddd('0x15')](_0x1c5d4e);}return _0x1256bb[_0x7ddd('0x2f')]('.')[0x0];});};exports[_0x7ddd('0x76')]=function(_0x3b522b,_0x48039c,_0x1a24ac,_0x2fb308,_0x4ce56f,_0x2853c8){return aws[_0x7ddd('0x77')](_0x3b522b,_0x48039c,_0x1a24ac,_0x2fb308,_0x4ce56f,_0x2853c8)['then'](function(_0xc5dd62){logger['info'](JSON[_0x7ddd('0x43')](_0xc5dd62));return _0xc5dd62;});};exports[_0x7ddd('0x78')]=function(_0x1aca84,_0x167fbb,_0x46ec11,_0x1ef3c8){var _0x405270=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x1aca84,encodeURIComponent(_0x167fbb),_0x46ec11,_0x1ef3c8);var _0x32786b=path['resolve'](__dirname,_0x7ddd('0x28'),rs['generate'](0x4)+_0x7ddd('0x3a'));var _0x29c4b4;return downloadFile(_0x405270,_0x32786b)[_0x7ddd('0x39')](function(){_0x29c4b4=path['resolve'](__dirname,'tmp',rs[_0x7ddd('0x29')](0x4)+_0x7ddd('0x2a'));return convertFile(_0x32786b,_0x29c4b4);})[_0x7ddd('0x39')](function(){try{fs[_0x7ddd('0x1c')](_0x32786b);fs[_0x7ddd('0x2d')](_0x29c4b4,_0x7ddd('0x2e'));}catch(_0x9d76a3){logger[_0x7ddd('0x15')](_0x9d76a3);}return _0x29c4b4[_0x7ddd('0x2f')]('.')[0x0];});};exports['ispeechASR']=function(_0x1d9a9b,_0x453c57,_0x27fbea,_0x370f4f){var _0x24e545=util[_0x7ddd('0x79')](_0x7ddd('0x7a'),ISPEECH_API,_0x453c57,_0x27fbea,base64Encode(_0x1d9a9b),_0x370f4f?util[_0x7ddd('0x79')](_0x7ddd('0x7b'),encodeURIComponent(_0x370f4f)):_0x7ddd('0x7c'));return uploadFile(_0x24e545)[_0x7ddd('0x39')](function(_0x27e8e6){return querystring[_0x7ddd('0x7d')](_0x27e8e6);});};exports[_0x7ddd('0x7e')]=function(_0x37e204,_0x628eab){return sestek[_0x7ddd('0x7f')](_0x37e204,_0x628eab)[_0x7ddd('0x39')](function(_0x55a198){logger[_0x7ddd('0x24')](JSON[_0x7ddd('0x43')](_0x55a198));var _0x24336c={'speech':_0x55a198[_0x7ddd('0x80')],'action':_0x55a198[_0x7ddd('0x81')]?_0x55a198[_0x7ddd('0x81')][_0x7ddd('0x82')]:undefined,'actiondata':_0x55a198[_0x7ddd('0x81')]?_0x55a198[_0x7ddd('0x81')]['CustomActionData']:undefined};if(_0x55a198[_0x7ddd('0x81')]&&_0x55a198[_0x7ddd('0x81')][_0x7ddd('0x83')]){return base64Decode(_0x55a198[_0x7ddd('0x81')][_0x7ddd('0x83')][_0x7ddd('0x84')],path['resolve'](__dirname,'tmp',rs[_0x7ddd('0x29')](0x4)+_0x7ddd('0x2a')))[_0x7ddd('0x39')](function(_0x11de1d){_0x24336c[_0x7ddd('0x85')]=_0x11de1d;return _0x24336c;});}return _0x24336c;});};exports[_0x7ddd('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0xc7cd=['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','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','dirName','apiai-promise','dialogflow','http','https','md5','path','sox','google-tts-api','url','util','./aws','./sestek','./tilde','../../../config/logger','https:','host','WHAT_EVER','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','finish','info','finish\x20download\x20file','error','unlink','download\x20error','pipe','protocol','get','end','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','jQ1olc','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','data','writeFileSync','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','result','source','action','fulfillment','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','.mp3','polly','awsLex','lex'];(function(_0x145cf9,_0x3c95cf){var _0x472300=function(_0x265bad){while(--_0x265bad){_0x145cf9['push'](_0x145cf9['shift']());}};_0x472300(++_0x3c95cf);}(_0xc7cd,0x196));var _0xdc7c=function(_0x57a7a1,_0x43bfc3){_0x57a7a1=_0x57a7a1-0x0;var _0x14f5fd=_0xc7cd[_0x57a7a1];return _0x14f5fd;};'use strict';var apiai=require(_0xdc7c('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xdc7c('0x1'));var fs=require('fs');var http=require(_0xdc7c('0x2'));var https=require(_0xdc7c('0x3'));var md5=require(_0xdc7c('0x4'));var path=require(_0xdc7c('0x5'));var querystring=require('querystring');var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0xdc7c('0x6'));var tts=require(_0xdc7c('0x7'));var urlParse=require(_0xdc7c('0x8'))['parse'];var util=require(_0xdc7c('0x9'));var aws=require(_0xdc7c('0xa'));var google=require('./google');var sestek=require(_0xdc7c('0xb'));var tilde=require(_0xdc7c('0xc'));var logger=require(_0xdc7c('0xd'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x13b36f,_0x122bea){return new BPromise(function(_0x5ef5e1,_0x37ea42){var _0x4b2f8b=urlParse(_0x13b36f);var _0x55a564=_0x4b2f8b['protocol']===_0xdc7c('0xe')?https:http;var _0x5ccef0={'host':_0x4b2f8b[_0xdc7c('0xf')],'path':_0x4b2f8b[_0xdc7c('0x5')],'headers':{'user-agent':_0xdc7c('0x10')}};_0x55a564['get'](_0x5ccef0,function(_0x45a22e){if(_0x45a22e['statusCode']!==0xc8){logger['error'](_0xdc7c('0x11')+_0x13b36f+_0xdc7c('0x12')+_0x45a22e[_0xdc7c('0x13')]+'\x20('+_0x45a22e['statusMessage']+')');_0x37ea42(new Error(_0xdc7c('0x11')+_0x13b36f+_0xdc7c('0x12')+_0x45a22e['statusCode']+'\x20('+_0x45a22e[_0xdc7c('0x14')]+')'));return;}var _0x4d4b6f=fs['createWriteStream'](_0x122bea);_0x4d4b6f['on'](_0xdc7c('0x15'),function(){logger[_0xdc7c('0x16')](_0xdc7c('0x17'));_0x4d4b6f['close'](_0x5ef5e1);});_0x4d4b6f['on'](_0xdc7c('0x18'),function(_0x549af0){fs[_0xdc7c('0x19')](_0x122bea);logger[_0xdc7c('0x18')](_0xdc7c('0x1a'),_0x549af0);_0x37ea42(_0x549af0);});_0x45a22e[_0xdc7c('0x1b')](_0x4d4b6f);})['on'](_0xdc7c('0x18'),function(_0x14c3b9){logger[_0xdc7c('0x18')](_0x14c3b9);_0x37ea42(_0x14c3b9);})['end']();});}function uploadFile(_0x4c3aa0){return new BPromise(function(_0x1b7c22,_0x519ac2){var _0xaec7c2=urlParse(_0x4c3aa0);var _0x561142=_0xaec7c2[_0xdc7c('0x1c')]===_0xdc7c('0xe')?https:http;var _0x269fd0={'host':_0xaec7c2[_0xdc7c('0xf')],'path':_0xaec7c2[_0xdc7c('0x5')],'headers':{'user-agent':_0xdc7c('0x10')}};_0x561142[_0xdc7c('0x1d')](_0x269fd0,function(_0x34135c){if(_0x34135c[_0xdc7c('0x13')]!==0xc8){_0x519ac2(new Error(_0xdc7c('0x11')+_0x4c3aa0+_0xdc7c('0x12')+_0x34135c['statusCode']+'\x20('+_0x34135c[_0xdc7c('0x14')]+')'));return;}var _0x220611='';_0x34135c['on']('data',function(_0x50e537){_0x220611+=_0x50e537;});_0x34135c['on'](_0xdc7c('0x1e'),function(){_0x1b7c22(_0x220611);});})['on'](_0xdc7c('0x18'),function(_0x2345f5){_0x519ac2(_0x2345f5);})[_0xdc7c('0x1e')]();});}function convertFile(_0x247dae,_0x39407f){return new BPromise(function(_0x3c38dc,_0x53eee1){var _0x2f066b=sox['transcode'](_0x247dae,_0x39407f,{'sampleRate':0x1f40,'format':_0xdc7c('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2f066b['on'](_0xdc7c('0x18'),function(_0x40f604){logger[_0xdc7c('0x18')](_0xdc7c('0x20'),_0x40f604);_0x53eee1(_0x40f604);});_0x2f066b['on'](_0xdc7c('0x1e'),function(){logger['info'](_0xdc7c('0x21'));_0x3c38dc();});_0x2f066b[_0xdc7c('0x22')]();});}function base64Decode(_0x3f86ac,_0x553288){var _0x18f43e=path['resolve'](__dirname,_0xdc7c('0x23'),rs[_0xdc7c('0x24')](0x4)+_0xdc7c('0x25'));fs['writeFileSync'](_0x18f43e,_0x3f86ac,_0xdc7c('0x26'));return convertFile(_0x18f43e,_0x553288)[_0xdc7c('0x27')](function(){try{fs['unlink'](_0x18f43e);fs[_0xdc7c('0x28')](_0x553288,_0xdc7c('0x29'));}catch(_0x54d8f5){logger['error'](_0x54d8f5);}return _0x553288[_0xdc7c('0x2a')]('.')[0x0];});}function base64Encode(_0x2bb4e9){var _0x38d695=fs[_0xdc7c('0x2b')](_0x2bb4e9);return new Buffer(_0x38d695)[_0xdc7c('0x2c')]('base64');}exports[_0xdc7c('0x2d')]=function(_0x549a9c,_0x501a67,_0x473739,_0x2a6199,_0x395abf,_0x3e7b88){var _0x2087a5,_0x55e3a8;var _0x49ba46=_0xdc7c('0x2e');var _0x390691=_0xdc7c('0x2f')+_0x549a9c;var _0x5de50d={};if(_0x501a67===_0xdc7c('0x30')){_0x5de50d[_0xdc7c('0x31')]={'ssml':_0x473739};}else{_0x5de50d[_0xdc7c('0x31')]={'text':_0x473739};};_0x5de50d[_0xdc7c('0x32')]={'languageCode':_0x2a6199,'ssmlGender':_0x395abf};_0x5de50d[_0xdc7c('0x33')]={'audioEncoding':_0xdc7c('0x34'),'sampleRateHertz':0x1f40};var _0x1b97fa={'url':_0x49ba46+_0xdc7c('0x35')+_0x390691,'method':_0xdc7c('0x36'),'json':!![],'body':_0x5de50d};return rp(_0x1b97fa)['then'](function(_0x51af73){return new BPromise(function(_0x84e660,_0x278acf){_0x2087a5=path[_0xdc7c('0x37')](__dirname,_0xdc7c('0x23'),rs[_0xdc7c('0x24')](0x4)+'.mp3');var _0x3d7029=Buffer['from'](_0x51af73['audioContent'],_0xdc7c('0x26'));return fs[_0xdc7c('0x38')](_0x2087a5,_0x3d7029,function(_0x1dc2d4){_0x278acf(_0x1dc2d4);},function(_0x3b53d6){fs[_0xdc7c('0x28')](_0x2087a5,_0xdc7c('0x29'));_0x84e660(_0x3b53d6);});});})[_0xdc7c('0x27')](function(_0x917082){_0x55e3a8=path['resolve'](__dirname,_0xdc7c('0x23'),rs['generate'](0x4)+_0xdc7c('0x25'));return convertFile(_0x2087a5,_0x55e3a8);})['then'](function(){try{fs[_0xdc7c('0x19')](_0x2087a5);fs[_0xdc7c('0x28')](_0x55e3a8,'777');}catch(_0x4cc550){logger['error'](_0x4cc550);}logger[_0xdc7c('0x16')](_0xdc7c('0x39'),_0x55e3a8[_0xdc7c('0x2a')]('.')[0x0]);return _0x55e3a8[_0xdc7c('0x2a')]('.')[0x0];});};exports['googleTTS']=function(_0x2e4762,_0xc92013){var _0x37799d=_0xdc7c('0x3a');var _0x1f36d2,_0x4176b0;var _0x31f5f2;var _0x3dd8ef={'encoding':'utf8','method':_0xdc7c('0x36'),'timeout':0x2710,'url':_0x37799d,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xdc7c('0x3b')+encodeURIComponent(JSON['stringify']([[[_0xdc7c('0x3c'),JSON[_0xdc7c('0x3d')]([_0x2e4762,_0xc92013||'en',![],_0xdc7c('0x3e')]),null,_0xdc7c('0x3f')]]]))};return rp(_0x3dd8ef)[_0xdc7c('0x27')](function(_0x4c73e4){try{_0x31f5f2=eval(_0x4c73e4[_0xdc7c('0x40')](0x5))[0x0][0x2];}catch(_0x2a403a){throw new Error(_0xdc7c('0x41')+_0x4c73e4['data']);}if(!_0x31f5f2){if(_0x2e4762[_0xdc7c('0x42')]>0xc8){throw new Error(_0xdc7c('0x43'));}else{throw new Error('lang\x20\x22'+_0xc92013+'\x22\x20might\x20not\x20exist');}}try{_0x31f5f2=eval(_0x31f5f2)[0x0];}catch(_0x3e2436){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xdc7c('0x44')]);}const _0x46aefa=_0x31f5f2;_0x1f36d2=path[_0xdc7c('0x37')](__dirname,_0xdc7c('0x23'),rs[_0xdc7c('0x24')](0x4)+'.mp3');fs[_0xdc7c('0x45')](_0x1f36d2,_0x31f5f2,{'encoding':_0xdc7c('0x26')});_0x4176b0=path[_0xdc7c('0x37')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x1f36d2,_0x4176b0);})[_0xdc7c('0x27')](function(){try{fs[_0xdc7c('0x19')](_0x1f36d2);fs['chmodSync'](_0x4176b0,_0xdc7c('0x29'));}catch(_0x19f8fd){logger[_0xdc7c('0x18')](_0x19f8fd);}logger['info']('goggleTTS\x20path',_0x4176b0[_0xdc7c('0x2a')]('.')[0x0]);return _0x4176b0[_0xdc7c('0x2a')]('.')[0x0];});};exports[_0xdc7c('0x46')]=function(_0x33880c,_0x4bcc56,_0x53bcb8){return google[_0xdc7c('0x47')](_0x33880c,_0x4bcc56,_0x53bcb8)[_0xdc7c('0x27')](function(_0x54315b){logger['info'](_0x54315b['uri']);return rp(_0x54315b);})[_0xdc7c('0x27')](function(_0xd930e9){var _0xe3ff4c='';var _0x4b0bc1=0x0;try{fs['unlink'](_0x33880c);}catch(_0x29d789){logger[_0xdc7c('0x18')](_0x29d789);}if(_0xd930e9&&_0xd930e9['results']){_0xe3ff4c=_0xd930e9[_0xdc7c('0x48')][_0xdc7c('0x49')](function(_0x50cf1d){return _0x50cf1d&&_0x50cf1d[_0xdc7c('0x4a')][0x0]&&_0x50cf1d[_0xdc7c('0x4a')][0x0][_0xdc7c('0x4b')]?_0x50cf1d['alternatives'][0x0][_0xdc7c('0x4b')]:'';})[_0xdc7c('0x4c')]('\x0a');_0x4b0bc1=_0xd930e9['results'][_0xdc7c('0x49')](function(_0x1f495c){return _0x1f495c&&_0x1f495c[_0xdc7c('0x4a')][0x0]&&_0x1f495c['alternatives'][0x0][_0xdc7c('0x4d')]?_0x1f495c[_0xdc7c('0x4a')][0x0][_0xdc7c('0x4d')]:0x0;})[_0xdc7c('0x4c')]('\x0a');}logger[_0xdc7c('0x16')]('googleASR\x20transcription',_0xe3ff4c);logger['info'](_0xdc7c('0x4e'),_0x4b0bc1);return{'transcript':_0xe3ff4c,'confidence':_0x4b0bc1};})[_0xdc7c('0x4f')](function(_0x1ac223){logger[_0xdc7c('0x18')](_0xdc7c('0x50'),_0x1ac223[_0xdc7c('0x13')],_0x1ac223[_0xdc7c('0x51')],_0x1ac223[_0xdc7c('0x52')]);});};exports['googleDialogflow']=function(_0x443884,_0x3fe5d0,_0x234add,_0x2b4aec){var _0x1841ff=apiai(_0x3fe5d0,{'language':_0x2b4aec||'en'});return _0x1841ff['textRequest'](_0x234add,{'sessionId':md5(_0x443884)})[_0xdc7c('0x27')](function(_0x1d8d3f){logger[_0xdc7c('0x16')](JSON[_0xdc7c('0x3d')](_0x1d8d3f));return{'source':_0x1d8d3f[_0xdc7c('0x53')][_0xdc7c('0x54')],'resolvedQuery':_0x1d8d3f['result']['resolvedQuery'],'action':_0x1d8d3f[_0xdc7c('0x53')][_0xdc7c('0x55')],'actionIncomplete':_0x1d8d3f[_0xdc7c('0x53')]['actionIncomplete'],'speech':_0x1d8d3f['result'][_0xdc7c('0x56')]['speech'],'score':_0x1d8d3f[_0xdc7c('0x53')][_0xdc7c('0x57')],'statusCode':_0x1d8d3f[_0xdc7c('0x58')]['code'],'endConversation':_0x1d8d3f[_0xdc7c('0x53')][_0xdc7c('0x59')][_0xdc7c('0x5a')]||![],'isFallbackIntent':_0x1d8d3f[_0xdc7c('0x53')][_0xdc7c('0x59')][_0xdc7c('0x5b')]};});};exports[_0xdc7c('0x5c')]=function(_0x5a0d2a,_0x12f325,_0x34aa76,_0x348ec3,_0x256770,_0x2aed9d){var _0x55270a=_0x348ec3['replace'](/\\n/g,'\x0a');var _0x15abb8={'credentials':{'private_key':_0x55270a,'client_email':_0x34aa76}};var _0x24edd3=new dialogflow[(_0xdc7c('0x5d'))](_0x15abb8);var _0x577ac4=_0x24edd3[_0xdc7c('0x5e')](_0x12f325,md5(_0x5a0d2a));var _0x3eb13e={'session':_0x577ac4,'queryInput':{'text':{'text':_0x256770,'languageCode':_0x2aed9d}}};return _0x24edd3[_0xdc7c('0x5f')](_0x3eb13e)[_0xdc7c('0x27')](function(_0x55dac3){if(_0x55dac3&&_0x55dac3[_0xdc7c('0x42')]){logger['info'](_0xdc7c('0x60'),JSON['stringify'](_0x55dac3));var _0x28d412=_0x55dac3[0x0];if(_0x28d412){var _0x3c7fc9={'action':_0x28d412[_0xdc7c('0x61')][_0xdc7c('0x55')],'allRequiredParamsPresent':_0x28d412[_0xdc7c('0x61')][_0xdc7c('0x62')],'endConversation':_0x28d412[_0xdc7c('0x61')]['diagnosticInfo']&&_0x28d412[_0xdc7c('0x61')][_0xdc7c('0x63')][_0xdc7c('0x64')]?_0x28d412[_0xdc7c('0x61')][_0xdc7c('0x63')][_0xdc7c('0x64')][_0xdc7c('0x65')][_0xdc7c('0x66')]:![],'fulfillmentText':_0x28d412['queryResult'][_0xdc7c('0x67')],'intentName':_0x28d412[_0xdc7c('0x61')][_0xdc7c('0x68')][_0xdc7c('0x51')],'intentDisplayName':_0x28d412[_0xdc7c('0x61')]['intent'][_0xdc7c('0x69')],'isFallbackIntent':_0x28d412['queryResult'][_0xdc7c('0x68')][_0xdc7c('0x6a')],'languageCode':_0x28d412[_0xdc7c('0x61')][_0xdc7c('0x6b')],'queryText':_0x28d412[_0xdc7c('0x61')]['queryText'],'responseId':_0x28d412[_0xdc7c('0x6c')],'score':_0x28d412[_0xdc7c('0x61')][_0xdc7c('0x6d')],'speech':_0x28d412[_0xdc7c('0x61')]['fulfillmentText'],'providerResponse':JSON[_0xdc7c('0x3d')](_0x55dac3)};return _0x3c7fc9;}}});};exports[_0xdc7c('0x6e')]=function(_0x578cf9,_0x50f062,_0x1dbd99,_0x18f938){return tilde['asr'](_0x578cf9,_0x50f062,_0x1dbd99,_0x18f938)[_0xdc7c('0x27')](function(_0x511e0b){try{fs[_0xdc7c('0x19')](_0x578cf9);}catch(_0x17258e){logger[_0xdc7c('0x18')](_0x17258e);}logger[_0xdc7c('0x16')](_0xdc7c('0x6f'),_0x511e0b[_0xdc7c('0x4b')]);logger[_0xdc7c('0x16')](_0xdc7c('0x70'),_0x511e0b[_0xdc7c('0x4d')]);return _0x511e0b;});};exports[_0xdc7c('0x71')]=function(_0x3fcb95,_0x4cc544,_0x1f34ca,_0x3aa510,_0x445ec1,_0x3097f9){var _0x50ea5e=path[_0xdc7c('0x37')](__dirname,_0xdc7c('0x23'),rs[_0xdc7c('0x24')](0x4)+_0xdc7c('0x72'));var _0x139bc6;return aws[_0xdc7c('0x73')](_0x3fcb95,_0x4cc544,_0x1f34ca,_0x3aa510,_0x445ec1,_0x3097f9,_0x50ea5e)[_0xdc7c('0x27')](function(){_0x139bc6=path[_0xdc7c('0x37')](__dirname,'tmp',rs['generate'](0x4)+_0xdc7c('0x25'));return convertFile(_0x50ea5e,_0x139bc6);})[_0xdc7c('0x27')](function(){try{fs['unlink'](_0x50ea5e);fs[_0xdc7c('0x28')](_0x139bc6,'777');}catch(_0xb56b15){logger[_0xdc7c('0x18')](_0xb56b15);}return _0x139bc6[_0xdc7c('0x2a')]('.')[0x0];});};exports[_0xdc7c('0x74')]=function(_0x1cc8c8,_0x4e49f8,_0x37f545,_0x394f38,_0x56043f,_0x2d6011){return aws[_0xdc7c('0x75')](_0x1cc8c8,_0x4e49f8,_0x37f545,_0x394f38,_0x56043f,_0x2d6011)[_0xdc7c('0x27')](function(_0x382f26){logger[_0xdc7c('0x16')](JSON[_0xdc7c('0x3d')](_0x382f26));return _0x382f26;});};exports['ispeechTTS']=function(_0x499808,_0x2f7dda,_0x250922,_0x2b131f){var _0x15a5aa=util[_0xdc7c('0x76')](_0xdc7c('0x77'),ISPEECH_API,_0x499808,encodeURIComponent(_0x2f7dda),_0x250922,_0x2b131f);var _0x269377=path[_0xdc7c('0x37')](__dirname,_0xdc7c('0x23'),rs['generate'](0x4)+_0xdc7c('0x72'));var _0x343941;return downloadFile(_0x15a5aa,_0x269377)[_0xdc7c('0x27')](function(){_0x343941=path['resolve'](__dirname,_0xdc7c('0x23'),rs[_0xdc7c('0x24')](0x4)+_0xdc7c('0x25'));return convertFile(_0x269377,_0x343941);})[_0xdc7c('0x27')](function(){try{fs[_0xdc7c('0x19')](_0x269377);fs[_0xdc7c('0x28')](_0x343941,_0xdc7c('0x29'));}catch(_0x3c1283){logger[_0xdc7c('0x18')](_0x3c1283);}return _0x343941['split']('.')[0x0];});};exports[_0xdc7c('0x78')]=function(_0x48013a,_0x447afc,_0x32384c,_0x1a184c){var _0x2eb523=util[_0xdc7c('0x76')](_0xdc7c('0x79'),ISPEECH_API,_0x447afc,_0x32384c,base64Encode(_0x48013a),_0x1a184c?util[_0xdc7c('0x76')]('model=%s',encodeURIComponent(_0x1a184c)):_0xdc7c('0x7a'));return uploadFile(_0x2eb523)[_0xdc7c('0x27')](function(_0x1bb85c){return querystring['parse'](_0x1bb85c);});};exports[_0xdc7c('0x7b')]=function(_0x6e37f4,_0x14a2f2){return sestek[_0xdc7c('0x7c')](_0x6e37f4,_0x14a2f2)['then'](function(_0x3c6a7f){logger['info'](JSON[_0xdc7c('0x3d')](_0x3c6a7f));var _0x51d62c={'speech':_0x3c6a7f[_0xdc7c('0x7d')],'action':_0x3c6a7f[_0xdc7c('0x7e')]?_0x3c6a7f[_0xdc7c('0x7e')][_0xdc7c('0x7f')]:undefined,'actiondata':_0x3c6a7f[_0xdc7c('0x7e')]?_0x3c6a7f[_0xdc7c('0x7e')][_0xdc7c('0x80')]:undefined};if(_0x3c6a7f['channelData']&&_0x3c6a7f['channelData'][_0xdc7c('0x81')]){return base64Decode(_0x3c6a7f['channelData'][_0xdc7c('0x81')]['Data'],path[_0xdc7c('0x37')](__dirname,_0xdc7c('0x23'),rs[_0xdc7c('0x24')](0x4)+_0xdc7c('0x25')))[_0xdc7c('0x27')](function(_0x1a1482){_0x51d62c['audiofile']=_0x1a1482;return _0x51d62c;});}return _0x51d62c;});};exports[_0xdc7c('0x82')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 5f8a0af..6842761 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 _0x488d=['exports','./nda'];(function(_0x351226,_0x3c9d4c){var _0x1768cb=function(_0x23b38e){while(--_0x23b38e){_0x351226['push'](_0x351226['shift']());}};_0x1768cb(++_0x3c9d4c);}(_0x488d,0xc1));var _0xd488=function(_0x4870ec,_0x4acbea){_0x4870ec=_0x4870ec-0x0;var _0x40122a=_0x488d[_0x4870ec];return _0x40122a;};var nda=require(_0xd488('0x0'));module[_0xd488('0x1')]={'nda':nda}; \ No newline at end of file +var _0x09cc=['exports','./nda'];(function(_0x58ed42,_0x21ee5c){var _0x16f61c=function(_0x2cd3fb){while(--_0x2cd3fb){_0x58ed42['push'](_0x58ed42['shift']());}};_0x16f61c(++_0x21ee5c);}(_0x09cc,0x6b));var _0xc09c=function(_0x39cf70,_0x3ec55b){_0x39cf70=_0x39cf70-0x0;var _0x580424=_0x09cc[_0x39cf70];return _0x580424;};var nda=require(_0xc09c('0x0'));module[_0xc09c('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 55bfca2..8fc7b56 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 _0xe3ee=['project','ProjectName','body','channelData','AudioOutputSettings','custom_action','custom_action_data','stringify','../../../../../config/logger','agi','resolve','/token','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token'];(function(_0x618d5d,_0x5e8256){var _0x5a1c85=function(_0x346de4){while(--_0x346de4){_0x618d5d['push'](_0x618d5d['shift']());}};_0x5a1c85(++_0x5e8256);}(_0xe3ee,0x116));var _0xee3e=function(_0xe4a1f3,_0x583583){_0xe4a1f3=_0xe4a1f3-0x0;var _0x2c1347=_0xe3ee[_0xe4a1f3];return _0x2c1347;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0xee3e('0x0'))(_0xee3e('0x1'));module['exports']=function(_0x52bcf2,_0x45bf25){var _0x4a7031={'method':'POST','uri':url[_0xee3e('0x2')](_0x45bf25['ndauth_url'],_0xee3e('0x3')),'form':{'grant_type':_0xee3e('0x4'),'username':_0x45bf25[_0xee3e('0x5')],'password':_0x45bf25[_0xee3e('0x4')]},'json':!![]};return rp(_0x4a7031)[_0xee3e('0x6')](function(_0x39a770){var _0x43ab67={'method':_0xee3e('0x7'),'uri':url['resolve'](_0x45bf25[_0xee3e('0x8')],_0xee3e('0x9')),'body':{'type':_0x45bf25['ndaactivity_type']||_0xee3e('0xa'),'channelId':_0xee3e('0xb'),'conversation':{'id':_0x52bcf2['uniqueid']},'from':{'id':_0x52bcf2[_0xee3e('0xc')],'name':_0x52bcf2[_0xee3e('0xd')]},'recipient':{'id':_0x52bcf2[_0xee3e('0xe')],'name':_0x52bcf2[_0xee3e('0xf')]},'text':_0x45bf25[_0xee3e('0x10')],'channelData':{}},'headers':{'Authorization':_0xee3e('0x11')+_0x39a770[_0xee3e('0x12')]},'json':!![]};if(_0x45bf25[_0xee3e('0x13')]){_0x43ab67['body']['channelData'][_0xee3e('0x14')]=_0x45bf25[_0xee3e('0x13')];}if(_0x45bf25['ndagenerate_audio']=='1'){_0x43ab67[_0xee3e('0x15')][_0xee3e('0x16')][_0xee3e('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x45bf25[_0xee3e('0x18')]){_0x43ab67[_0xee3e('0x15')]['channelData']['CustomAction']=_0x45bf25[_0xee3e('0x18')];if(_0x45bf25[_0xee3e('0x19')]){_0x43ab67[_0xee3e('0x15')]['channelData']['CustomActionData']=_0x45bf25['custom_action_data'];}}logger['info'](JSON[_0xee3e('0x1a')](_0x43ab67));return rp(_0x43ab67);});}; \ No newline at end of file +var _0xc718=['CustomActionData','stringify','request-promise','../../../../../config/logger','agi','resolve','username','then','POST','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data'];(function(_0xc4f63c,_0x1bce35){var _0x2b8374=function(_0x5b6d09){while(--_0x5b6d09){_0xc4f63c['push'](_0xc4f63c['shift']());}};_0x2b8374(++_0x1bce35);}(_0xc718,0xb6));var _0x8c71=function(_0x1cb12f,_0x21db54){_0x1cb12f=_0x1cb12f-0x0;var _0x192de5=_0xc718[_0x1cb12f];return _0x192de5;};'use strict';var rp=require(_0x8c71('0x0'));var url=require('url');var logger=require(_0x8c71('0x1'))(_0x8c71('0x2'));module['exports']=function(_0x6f90b5,_0x28f8a8){var _0x5402e6={'method':'POST','uri':url[_0x8c71('0x3')](_0x28f8a8['ndauth_url'],'/token'),'form':{'grant_type':'password','username':_0x28f8a8[_0x8c71('0x4')],'password':_0x28f8a8['password']},'json':!![]};return rp(_0x5402e6)[_0x8c71('0x5')](function(_0x10c4a){var _0x29f3b7={'method':_0x8c71('0x6'),'uri':url[_0x8c71('0x3')](_0x28f8a8['ndassistant_url'],_0x8c71('0x7')),'body':{'type':_0x28f8a8[_0x8c71('0x8')]||_0x8c71('0x9'),'channelId':_0x8c71('0xa'),'conversation':{'id':_0x6f90b5[_0x8c71('0xb')]},'from':{'id':_0x6f90b5[_0x8c71('0xc')],'name':_0x6f90b5[_0x8c71('0xd')]},'recipient':{'id':_0x6f90b5[_0x8c71('0xe')],'name':_0x6f90b5[_0x8c71('0xf')]},'text':_0x28f8a8['text'],'channelData':{}},'headers':{'Authorization':_0x8c71('0x10')+_0x10c4a[_0x8c71('0x11')]},'json':!![]};if(_0x28f8a8[_0x8c71('0x12')]){_0x29f3b7[_0x8c71('0x13')][_0x8c71('0x14')][_0x8c71('0x15')]=_0x28f8a8[_0x8c71('0x12')];}if(_0x28f8a8[_0x8c71('0x16')]=='1'){_0x29f3b7[_0x8c71('0x13')][_0x8c71('0x14')][_0x8c71('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x8c71('0x18')};}if(_0x28f8a8[_0x8c71('0x19')]){_0x29f3b7[_0x8c71('0x13')][_0x8c71('0x14')][_0x8c71('0x1a')]=_0x28f8a8[_0x8c71('0x19')];if(_0x28f8a8[_0x8c71('0x1b')]){_0x29f3b7['body'][_0x8c71('0x14')][_0x8c71('0x1c')]=_0x28f8a8['custom_action_data'];}}logger['info'](JSON[_0x8c71('0x1d')](_0x29f3b7));return rp(_0x29f3b7);});}; \ 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 8b3a6c9..2d4ef8a 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 _0xf13f=['./lib/api','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf13f,0x170));var _0xff13=function(_0x5d2c21,_0x358209){_0x5d2c21=_0x5d2c21-0x0;var _0x4bb99e=_0xf13f[_0x5d2c21];return _0x4bb99e;};'use strict';var asr=require(_0xff13('0x0'));module[_0xff13('0x1')]=function(_0x40a4bb,_0x54b784,_0xb8c7c,_0x5c013b){return asr(_0x40a4bb,_0x54b784,_0xb8c7c,_0x5c013b);}; \ No newline at end of file +var _0x43fb=['./lib/api','exports'];(function(_0x3e6d1b,_0x2da3b4){var _0x10376d=function(_0x1acd03){while(--_0x1acd03){_0x3e6d1b['push'](_0x3e6d1b['shift']());}};_0x10376d(++_0x2da3b4);}(_0x43fb,0x170));var _0xb43f=function(_0x1af843,_0x7f237d){_0x1af843=_0x1af843-0x0;var _0x4b832b=_0x43fb[_0x1af843];return _0x4b832b;};'use strict';var asr=require(_0xb43f('0x0'));module[_0xb43f('0x1')]=function(_0x28ecfb,_0x1220f4,_0x215a20,_0x35231c){return asr(_0x28ecfb,_0x1220f4,_0x215a20,_0x35231c);}; \ 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 c60f9f4..d5eb89d 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 _0xc6ab=['sha1','update','digest','hex','info','createReadStream','send','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','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'];(function(_0x95bb1a,_0x52c969){var _0x3a64f3=function(_0x1bc060){while(--_0x1bc060){_0x95bb1a['push'](_0x95bb1a['shift']());}};_0x3a64f3(++_0x52c969);}(_0xc6ab,0x1e4));var _0xbc6a=function(_0x1580b6,_0x24be78){_0x1580b6=_0x1580b6-0x0;var _0x436e3b=_0xc6ab[_0x1580b6];return _0x436e3b;};'use strict';var BPromise=require(_0xbc6a('0x0'));var _=require(_0xbc6a('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xbc6a('0x2'));var crypto=require(_0xbc6a('0x3'));var logger=require(_0xbc6a('0x4'))(_0xbc6a('0x5'));module['exports']=function(_0x5f31e8,_0x20f8e6,_0x546024,_0x159670){return new BPromise(function(_0x740242,_0xb46a2c){logger['info'](_0xbc6a('0x6'),_0x159670||_0xbc6a('0x7'));var _0x360c6b=new WebSocket(_0x159670||_0xbc6a('0x7'),{'perMessageDeflate':![]});var _0x39dfd7='';var _0x1c08d5='0';var _0x5d9d1d='1';var _0x80ef44=_0xbc6a('0x8');function _0x208df9(_0x16d715){var _0x1f9de1=crypto[_0xbc6a('0x9')](_0xbc6a('0xa'));_0x1f9de1[_0xbc6a('0xb')](_0x16d715);return _0x1f9de1[_0xbc6a('0xc')](_0xbc6a('0xd'));}function _0x5806fa(){try{logger[_0xbc6a('0xe')]('Open\x20Tilde\x20ASR\x20socket');var _0x51cb2c=moment()['unix']();var _0x1cf2f7=_0x208df9(_0x51cb2c+_0x20f8e6+_0x546024);_0x360c6b['send'](JSON['stringify']({'appID':_0x20f8e6,'timestamp':_0x51cb2c,'appKey':_0x1cf2f7}));var _0x2982b6=fs[_0xbc6a('0xf')](_0x5f31e8);_0x2982b6['on']('data',function(_0x1ce42e){_0x360c6b['send'](_0x1ce42e);});_0x2982b6['on']('close',function(){_0x360c6b[_0xbc6a('0x10')](_0xbc6a('0x11'));});}catch(_0x5709f2){logger[_0xbc6a('0x12')](_0xbc6a('0x13'),JSON[_0xbc6a('0x14')](_0x5709f2));_0x360c6b['terminate']();}}function _0x395072(_0x527fe9){try{if(_0x527fe9){var _0x2d9914=JSON[_0xbc6a('0x15')](_0x527fe9);switch(_0x2d9914[_0xbc6a('0x16')]){case 0x0:if(_0x2d9914['result']){if(_0x2d9914[_0xbc6a('0x17')]['final']){logger[_0xbc6a('0xe')](_0xbc6a('0x18'),JSON[_0xbc6a('0x14')](_0x2d9914[_0xbc6a('0x17')][_0xbc6a('0x19')]));_0x39dfd7=_0x2d9914['result'][_0xbc6a('0x19')][0x0][_0xbc6a('0x1a')];_0x1c08d5=_0x2d9914[_0xbc6a('0x17')][_0xbc6a('0x19')][0x0][_0xbc6a('0x1b')];_0x5d9d1d='0';_0x80ef44=_0xbc6a('0x1c');_0x360c6b[_0xbc6a('0x1d')]();}}break;case 0x1:logger[_0xbc6a('0xe')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x5d9d1d='1';_0x80ef44='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info'](_0xbc6a('0x1e'));_0x5d9d1d='2';_0x80ef44=_0xbc6a('0x1e');break;case 0x9:logger['info'](_0xbc6a('0x1f'));_0x5d9d1d='9';_0x80ef44=_0xbc6a('0x1f');break;case 0xa:logger['info'](_0xbc6a('0x20'));_0x5d9d1d='10';_0x80ef44='Authentication\x20failed.';break;case 0xb:logger[_0xbc6a('0xe')](_0xbc6a('0x21'));_0x5d9d1d='11';_0x80ef44=_0xbc6a('0x21');}}}catch(_0x13fed8){logger[_0xbc6a('0x12')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xbc6a('0x14')](_0x13fed8));_0x360c6b[_0xbc6a('0x1d')]();}}function _0x2a6e40(){logger['info'](_0xbc6a('0x22'));_0x740242({'transcript':_0x39dfd7,'confidence':_0x1c08d5,'status':_0x5d9d1d,'status_message':_0x80ef44});}function _0x4cfc06(_0x256202){logger['error'](_0xbc6a('0x23'));if(!_['isNil'](_0x256202)){logger['error'](_[_0xbc6a('0x24')](_0x256202)?JSON['stringify'](_0x256202):_0x256202);}}_0x360c6b['on']('open',_0x5806fa);_0x360c6b['on']('message',_0x395072);_0x360c6b['on'](_0xbc6a('0x25'),_0x2a6e40);_0x360c6b['on'](_0xbc6a('0x12'),_0x4cfc06);});}; \ No newline at end of file +var _0x01a8=['status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','lodash','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','info','unix','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse'];(function(_0x435f7c,_0x3c50e5){var _0x11be96=function(_0x4b91e3){while(--_0x4b91e3){_0x435f7c['push'](_0x435f7c['shift']());}};_0x11be96(++_0x3c50e5);}(_0x01a8,0x64));var _0x801a=function(_0x4ea3e3,_0x2a7e29){_0x4ea3e3=_0x4ea3e3-0x0;var _0x13c5a7=_0x01a8[_0x4ea3e3];return _0x13c5a7;};'use strict';var BPromise=require('bluebird');var _=require(_0x801a('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x801a('0x1'));var crypto=require(_0x801a('0x2'));var logger=require(_0x801a('0x3'))(_0x801a('0x4'));module[_0x801a('0x5')]=function(_0x17b9d3,_0x387eca,_0x5c1796,_0x4ae0a5){return new BPromise(function(_0x1b5ae5,_0x3bef58){logger['info'](_0x801a('0x6'),_0x4ae0a5||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x1bb8eb=new WebSocket(_0x4ae0a5||_0x801a('0x7'),{'perMessageDeflate':![]});var _0x5bcde0='';var _0x96ee16='0';var _0x5ad086='1';var _0x2e052f='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x3e24b5(_0x1d353b){var _0x3dacb7=crypto[_0x801a('0x8')](_0x801a('0x9'));_0x3dacb7[_0x801a('0xa')](_0x1d353b);return _0x3dacb7[_0x801a('0xb')]('hex');}function _0x100301(){try{logger[_0x801a('0xc')]('Open\x20Tilde\x20ASR\x20socket');var _0x4d0062=moment()[_0x801a('0xd')]();var _0xd0cbe4=_0x3e24b5(_0x4d0062+_0x387eca+_0x5c1796);_0x1bb8eb[_0x801a('0xe')](JSON[_0x801a('0xf')]({'appID':_0x387eca,'timestamp':_0x4d0062,'appKey':_0xd0cbe4}));var _0x23d0f7=fs[_0x801a('0x10')](_0x17b9d3);_0x23d0f7['on'](_0x801a('0x11'),function(_0x2bab20){_0x1bb8eb['send'](_0x2bab20);});_0x23d0f7['on'](_0x801a('0x12'),function(){_0x1bb8eb['send'](_0x801a('0x13'));});}catch(_0x5ad6eb){logger['error'](_0x801a('0x14'),JSON['stringify'](_0x5ad6eb));_0x1bb8eb[_0x801a('0x15')]();}}function _0xfb253e(_0x5a1003){try{if(_0x5a1003){var _0x47df83=JSON[_0x801a('0x16')](_0x5a1003);switch(_0x47df83[_0x801a('0x17')]){case 0x0:if(_0x47df83[_0x801a('0x18')]){if(_0x47df83[_0x801a('0x18')]['final']){logger[_0x801a('0xc')](_0x801a('0x19'),JSON[_0x801a('0xf')](_0x47df83[_0x801a('0x18')][_0x801a('0x1a')]));_0x5bcde0=_0x47df83[_0x801a('0x18')]['hypotheses'][0x0][_0x801a('0x1b')];_0x96ee16=_0x47df83[_0x801a('0x18')][_0x801a('0x1a')][0x0]['likelihood'];_0x5ad086='0';_0x2e052f=_0x801a('0x1c');_0x1bb8eb[_0x801a('0x15')]();}}break;case 0x1:logger['info'](_0x801a('0x1d'));_0x5ad086='1';_0x2e052f=_0x801a('0x1d');break;case 0x2:logger['info'](_0x801a('0x1e'));_0x5ad086='2';_0x2e052f=_0x801a('0x1e');break;case 0x9:logger[_0x801a('0xc')](_0x801a('0x1f'));_0x5ad086='9';_0x2e052f='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x801a('0xc')]('Authentication\x20failed.');_0x5ad086='10';_0x2e052f=_0x801a('0x20');break;case 0xb:logger[_0x801a('0xc')](_0x801a('0x21'));_0x5ad086='11';_0x2e052f=_0x801a('0x21');}}}catch(_0x443676){logger[_0x801a('0x22')](_0x801a('0x23'),JSON[_0x801a('0xf')](_0x443676));_0x1bb8eb[_0x801a('0x15')]();}}function _0x5601b8(){logger[_0x801a('0xc')](_0x801a('0x24'));_0x1b5ae5({'transcript':_0x5bcde0,'confidence':_0x96ee16,'status':_0x5ad086,'status_message':_0x2e052f});}function _0x4e9d99(_0xebdc23){logger[_0x801a('0x22')](_0x801a('0x25'));if(!_[_0x801a('0x26')](_0xebdc23)){logger[_0x801a('0x22')](_[_0x801a('0x27')](_0xebdc23)?JSON[_0x801a('0xf')](_0xebdc23):_0xebdc23);}}_0x1bb8eb['on'](_0x801a('0x28'),_0x100301);_0x1bb8eb['on']('message',_0xfb253e);_0x1bb8eb['on']('close',_0x5601b8);_0x1bb8eb['on'](_0x801a('0x22'),_0x4e9d99);});}; \ 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 62a15c6..0dc7543 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 _0x8ec0=['./asr'];(function(_0x3d5ebc,_0x354479){var _0x1a9911=function(_0x1da1ea){while(--_0x1da1ea){_0x3d5ebc['push'](_0x3d5ebc['shift']());}};_0x1a9911(++_0x354479);}(_0x8ec0,0x7f));var _0x08ec=function(_0x35e3cd,_0x1f1d66){_0x35e3cd=_0x35e3cd-0x0;var _0x1021ad=_0x8ec0[_0x35e3cd];return _0x1021ad;};var asr=require(_0x08ec('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xc84e=['./asr','exports'];(function(_0xe341c4,_0xdaa216){var _0x47174e=function(_0x297a94){while(--_0x297a94){_0xe341c4['push'](_0xe341c4['shift']());}};_0x47174e(++_0xdaa216);}(_0xc84e,0x1ca));var _0xec84=function(_0x204227,_0x4d1b12){_0x204227=_0x204227-0x0;var _0x3783a6=_0xc84e[_0x204227];return _0x3783a6;};var asr=require(_0xec84('0x0'));module[_0xec84('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 0782c2b..a84b7da 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 _0x146c=['127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','destroy','ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','./error','./channel'];(function(_0x98db33,_0x397f20){var _0x5ae63a=function(_0x411f1c){while(--_0x411f1c){_0x98db33['push'](_0x98db33['shift']());}};_0x5ae63a(++_0x397f20);}(_0x146c,0x90));var _0xc146=function(_0x112eec,_0x408898){_0x112eec=_0x112eec-0x0;var _0x21700f=_0x146c[_0x112eec];return _0x21700f;};'use strict';var util=require(_0xc146('0x0'));var net=require('net');var EventEmitter=require('events')['EventEmitter'];var AGIError=require(_0xc146('0x1'));var AGIChannel=require(_0xc146('0x2'));var AGIServer=function(_0x1767b1,_0x2e6445,_0x4f6328){var _0x11e2a2=this,_0x1767b1=_0x1767b1||0x11dd,_0x2e6445=_0x2e6445||_0xc146('0x3'),_0x32a24f=null,_0x1ccadd=0x0;EventEmitter[_0xc146('0x4')](_0x11e2a2);function _0x4692d8(){if(!_0x1767b1){_0x11e2a2[_0xc146('0x5')](_0xc146('0x6'),new AGIError(_0xc146('0x7')));return![];}_0x32a24f=net[_0xc146('0x8')]();_0x32a24f[_0xc146('0x9')](_0x1767b1,_0x2e6445);_0x32a24f['on']('listening',function(){_0x11e2a2[_0xc146('0x5')](_0xc146('0xa'));});_0x32a24f['on'](_0xc146('0xb'),function(_0x3353e0){_0x32a24f[_0xc146('0xc')](function(_0x2f8317,_0x52dc93){if(_0x2f8317){_0x11e2a2[_0xc146('0x5')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x2f8317));}else if(_0x4f6328&&_0x4f6328<0x0){_0x11e2a2[_0xc146('0x5')](_0xc146('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x3353e0['destroy']();}else if(_0x4f6328&&_0x4f6328>0x0&&_0x4f6328<_0x52dc93){_0x1ccadd+=0x1;_0x11e2a2[_0xc146('0x5')]('error',new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x1ccadd));_0x3353e0[_0xc146('0xd')]();}else{var _0x2efd34=new AGIChannel(_0x3353e0);_0x2efd34['on'](_0xc146('0xe'),function(){_0x11e2a2[_0xc146('0x5')](_0xc146('0xb'),_0x2efd34);});}});});_0x32a24f['on'](_0xc146('0x6'),function(_0x570157){_0x11e2a2[_0xc146('0x5')]('error',new AGIError(_0xc146('0xf'),_0x570157['code']));});_0x32a24f['on'](_0xc146('0x10'),function(){_0x11e2a2[_0xc146('0x5')](_0xc146('0x10'),new AGIError(_0xc146('0x11')));});}process[_0xc146('0x12')](function(){_0x4692d8();});};util[_0xc146('0x13')](AGIServer,EventEmitter);module[_0xc146('0x14')]=function(_0x435f07,_0x1b3b15,_0x5bac31){return new AGIServer(_0x435f07,_0x1b3b15,_0x5bac31);}; \ No newline at end of file +var _0xc41c=['E_AGI_SERVER_MAXCONNECTION','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','util','net','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','createServer','listening','getConnections','E_AGI_SERVER_ERROR','destroy'];(function(_0x5ee4e2,_0x3bdcd4){var _0x5e85d4=function(_0x393da1){while(--_0x393da1){_0x5ee4e2['push'](_0x5ee4e2['shift']());}};_0x5e85d4(++_0x3bdcd4);}(_0xc41c,0x6a));var _0xcc41=function(_0xf670f0,_0x353747){_0xf670f0=_0xf670f0-0x0;var _0x3c21c6=_0xc41c[_0xf670f0];return _0x3c21c6;};'use strict';var util=require(_0xcc41('0x0'));var net=require(_0xcc41('0x1'));var EventEmitter=require('events')[_0xcc41('0x2')];var AGIError=require(_0xcc41('0x3'));var AGIChannel=require(_0xcc41('0x4'));var AGIServer=function(_0x9c082a,_0x2c8e80,_0xf26592){var _0x47f108=this,_0x9c082a=_0x9c082a||0x11dd,_0x2c8e80=_0x2c8e80||_0xcc41('0x5'),_0x23dd6a=null,_0x235b00=0x0;EventEmitter[_0xcc41('0x6')](_0x47f108);function _0x2ae9eb(){if(!_0x9c082a){_0x47f108[_0xcc41('0x7')](_0xcc41('0x8'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x23dd6a=net[_0xcc41('0x9')]();_0x23dd6a['listen'](_0x9c082a,_0x2c8e80);_0x23dd6a['on'](_0xcc41('0xa'),function(){_0x47f108[_0xcc41('0x7')](_0xcc41('0xa'));});_0x23dd6a['on']('connection',function(_0x43bab3){_0x23dd6a[_0xcc41('0xb')](function(_0x177f63,_0xb2a282){if(_0x177f63){_0x47f108[_0xcc41('0x7')](_0xcc41('0x8'),new AGIError(_0xcc41('0xc'),_0x177f63));}else if(_0xf26592&&_0xf26592<0x0){_0x47f108[_0xcc41('0x7')]('error',new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x43bab3[_0xcc41('0xd')]();}else if(_0xf26592&&_0xf26592>0x0&&_0xf26592<_0xb2a282){_0x235b00+=0x1;_0x47f108[_0xcc41('0x7')]('error',new AGIError(_0xcc41('0xe'),_0x235b00));_0x43bab3[_0xcc41('0xd')]();}else{var _0x8ae82d=new AGIChannel(_0x43bab3);_0x8ae82d['on']('ready',function(){_0x47f108[_0xcc41('0x7')](_0xcc41('0xf'),_0x8ae82d);});}});});_0x23dd6a['on'](_0xcc41('0x8'),function(_0x16b807){_0x47f108[_0xcc41('0x7')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x16b807[_0xcc41('0x10')]));});_0x23dd6a['on'](_0xcc41('0x11'),function(){_0x47f108[_0xcc41('0x7')](_0xcc41('0x11'),new AGIError(_0xcc41('0x12')));});}process[_0xcc41('0x13')](function(){_0x2ae9eb();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x265ad3,_0x2b2a8f,_0x3d8a99){return new AGIServer(_0x265ad3,_0x2b2a8f,_0x3d8a99);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 180360b..91c6732 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 _0xc906=['map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','calleridname','context','extension','priority','dnid','file','isNil','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','has','dialTimezone','getContactByPhone','timezones','utcOffset','scheduledat','minutes','insertContact','add','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','body','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','client_email','private_key','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_lex_region','googleASR','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','isEmpty','%s.%s','length','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','exec','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','createCmContact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','createSquareMessage','out','dialogflow','Dialogflow\x20Result\x20%s','speech','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','dialogflowV2','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','success','math','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','menu','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','createSquareRecording','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','Smtp','user','bcc','subject','service','port','secure','authentication','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','debug','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProjectById','getSquareOdbc','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval'];(function(_0x5df59f,_0xf11a72){var _0x190e3b=function(_0x2b983e){while(--_0x2b983e){_0x5df59f['push'](_0x5df59f['shift']());}};_0x190e3b(++_0xf11a72);}(_0xc906,0x1ad));var _0x6c90=function(_0x553425,_0x2ad9ff){_0x553425=_0x553425-0x0;var _0x498f9a=_0xc906[_0x553425];return _0x498f9a;};'use strict';var fs=require('fs');var path=require(_0x6c90('0x0'));var util=require(_0x6c90('0x1'));var _=require('lodash');var sh=require(_0x6c90('0x2'));var odbc=require(_0x6c90('0x3'))();var rs=require(_0x6c90('0x4'));var moment=require('moment');var Mustache=require(_0x6c90('0x5'));var rp=require(_0x6c90('0x6'));var logger=require(_0x6c90('0x7'))(_0x6c90('0x8'));var config=require(_0x6c90('0x9'));var shared=require(_0x6c90('0xa'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x6c90('0xb')];var verticesWithRetry=['menu',_0x6c90('0xc'),_0x6c90('0xd')];var AGIVertices=function(_0x244dc8,_0x207e03,_0x417974){this[_0x6c90('0xe')]=_0x244dc8;this[_0x6c90('0xf')]=_0x207e03;this[_0x6c90('0x10')]=_0x417974;};AGIVertices[_0x6c90('0x11')][_0x6c90('0x12')]=function(_0x3a09a7,_0x441c1d){this[_0x6c90('0xf')][_0x6c90('0x13')](_0x3a09a7)['then'](function(_0x51814c){_0x441c1d(null,_0x51814c?_0x51814c[_0x6c90('0x14')]:![]);})[_0x6c90('0x15')](function(_0xe093a5){_0x441c1d(_0xe093a5);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x16')]=function(_0x3cf02d,_0x117da5){this[_0x6c90('0xf')][_0x6c90('0x17')](_0x3cf02d)[_0x6c90('0x18')](function(_0x49e7ef){_0x117da5(null,_0x49e7ef?_0x49e7ef[_0x6c90('0x14')]:![]);})[_0x6c90('0x15')](function(_0x273ed1){_0x117da5(_0x273ed1);});};AGIVertices[_0x6c90('0x11')]['getSquareProject']=function(_0x111217,_0x2020d6){this['rpc'][_0x6c90('0x19')](_0x111217)[_0x6c90('0x18')](function(_0x1701d5){_0x2020d6(null,_0x1701d5?_0x1701d5[_0x6c90('0x14')]:![]);})[_0x6c90('0x15')](function(_0x3442ac){_0x2020d6(_0x3442ac);});};AGIVertices['prototype'][_0x6c90('0x1a')]=function(_0x326767,_0x2dbe51){this['rpc']['getSquareOdbcById'](_0x326767)[_0x6c90('0x18')](function(_0x6f0a46){_0x2dbe51(null,_0x6f0a46?_0x6f0a46['dsn']:![]);})[_0x6c90('0x15')](function(_0x522692){_0x2dbe51(_0x522692);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x1b')]=function(_0x4f8818,_0x137285){this['rpc']['getUserById'](_0x4f8818)[_0x6c90('0x18')](function(_0x59ba0e){_0x137285(null,_0x59ba0e?_0x59ba0e[_0x6c90('0x14')]:![]);})['catch'](function(_0xc3f320){_0x137285(_0xc3f320);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x1c')]=function(_0x1ddc4,_0xf51b92){this['rpc'][_0x6c90('0x1d')](_0x1ddc4)[_0x6c90('0x18')](function(_0x4a5818){_0xf51b92(null,_0x4a5818?_0x4a5818[_0x6c90('0x14')]:![]);})['catch'](function(_0x315c78){_0xf51b92(_0x315c78);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x1e')]=function(_0x20e4f7,_0x1dad84){var _0x5a9cba=this;this[_0x6c90('0xf')][_0x6c90('0x1f')](_0x20e4f7)[_0x6c90('0x18')](function(_0x4cffd0){_0x1dad84(null,_0x4cffd0?_0x5a9cba[_0x6c90('0x20')](_0x4cffd0[_0x6c90('0x21')]):![]);})[_0x6c90('0x15')](function(_0xfe451c){_0x1dad84(_0xfe451c);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x22')]=function(_0x341e37,_0x4a010e){this[_0x6c90('0xf')][_0x6c90('0x23')](_0x341e37)[_0x6c90('0x18')](function(_0x497090){_0x4a010e(null,_0x497090?_0x497090:![]);})[_0x6c90('0x15')](function(_0x3f9500){_0x4a010e(_0x3f9500);});};AGIVertices[_0x6c90('0x11')]['sendMailMessage']=function(_0xdc5acc,_0x57277c,_0x3cac66){this['mailRpc'][_0x6c90('0x24')](_0xdc5acc,_0x57277c)['then'](function(){_0x3cac66(null);})[_0x6c90('0x15')](function(_0x56e0ca){_0x3cac66(_0x56e0ca);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x25')]=function(_0x585b08,_0x52191f){this[_0x6c90('0xf')]['getIntervalById'](_0x585b08)[_0x6c90('0x18')](function(_0x19ad54){if(_0x19ad54){if(_0x19ad54[_0x6c90('0x26')]){_0x52191f(null,[_0x19ad54[_0x6c90('0x27')]]);}else{_0x52191f(null,_[_0x6c90('0x28')](_0x19ad54[_0x6c90('0x29')],_0x6c90('0x27')));}}else{_0x52191f(null,![]);}})['catch'](function(_0x3c43d7){_0x52191f(_0x3c43d7);});};AGIVertices[_0x6c90('0x11')]['getSoundPath']=function(_0x312dcf){return util[_0x6c90('0x2a')](_0x6c90('0x2b'),FILES_PATH,_0x312dcf);};AGIVertices[_0x6c90('0x11')][_0x6c90('0x2c')]=function(_0x458638,_0x57113a,_0x579cd5){odbc[_0x6c90('0x2d')](_0x458638,function(_0x3cf1cb){if(_0x3cf1cb){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x3cf1cb);_0x579cd5(_0x3cf1cb);}else{logger[_0x6c90('0x2e')](_0x6c90('0x2f'));odbc[_0x6c90('0x30')](_0x57113a,function(_0x26c921,_0x447a7b){if(_0x26c921){logger[_0x6c90('0x2e')]('Error\x20executing\x20query\x20%s',_0x57113a);_0x579cd5(_0x26c921);}else{logger[_0x6c90('0x2e')](_0x6c90('0x31'),_0x57113a);odbc[_0x6c90('0x32')](function(_0x50c554){if(_0x50c554){logger[_0x6c90('0x33')](_0x6c90('0x34'),_0x50c554);}_0x579cd5(null,_0x447a7b);});}});}});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x35')]=function(_0x1894c0,_0xcdd612){this['rpc'][_0x6c90('0x36')](_0x1894c0)[_0x6c90('0x18')](function(_0x10743b){_0xcdd612(null,_0x10743b?_0x10743b:![]);})['catch'](function(_0x1183c8){_0xcdd612(_0x1183c8);});};AGIVertices['prototype']['createSmsMessage']=function(_0x338dcd,_0x8d7079){this[_0x6c90('0xf')][_0x6c90('0x37')](_0x338dcd)[_0x6c90('0x18')](function(_0x1040d9){_0x8d7079(null,_0x1040d9);})[_0x6c90('0x15')](function(_0x4b97fa){_0x8d7079(_0x4b97fa);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x38')]=function(_0x8d1ef,_0xa9f0d8,_0x44f4c8){this[_0x6c90('0xf')][_0x6c90('0x38')]({'uniqueid':this['channel'][_0x6c90('0x39')],'node':_0x8d1ef[_0x6c90('0x3a')],'application':_0x8d1ef[_0x6c90('0x3b')],'data':_0xa9f0d8||null,'project_name':this[_0x6c90('0xe')][_0x6c90('0x3c')],'callerid':this['channel'][_0x6c90('0x3d')]})['then'](function(_0x59343b){if(_0x44f4c8){_0x44f4c8(null,_0x59343b);}})[_0x6c90('0x15')](function(_0x357504){if(_0x44f4c8){_0x44f4c8(_0x357504);}});};AGIVertices['prototype']['createSquareRecording']=function(_0x1b0a52,_0x2acd8f,_0x120029,_0x3458ba){this[_0x6c90('0xf')]['createSquareRecording']({'uniqueid':this['channel'][_0x6c90('0x39')],'callerid':this[_0x6c90('0xe')][_0x6c90('0x3d')],'calleridname':this['channel'][_0x6c90('0x3e')],'context':this[_0x6c90('0xe')][_0x6c90('0x3f')],'extension':this[_0x6c90('0xe')][_0x6c90('0x40')],'priority':this[_0x6c90('0xe')][_0x6c90('0x41')],'accountcode':this[_0x6c90('0xe')]['accountcode'],'dnid':this['channel'][_0x6c90('0x42')],'projectName':this[_0x6c90('0xe')][_0x6c90('0x3c')],'saveName':_0x2acd8f,'filename':_0x1b0a52[_0x6c90('0x43')]||_0x2acd8f,'savePath':_0x120029})['then'](function(_0xf7b0fb){_0x3458ba(null,_0xf7b0fb);})[_0x6c90('0x15')](function(_0x25e8d0){_0x3458ba(_0x25e8d0);});};AGIVertices[_0x6c90('0x11')]['createSquareMessage']=function(_0x2976c7,_0x551b0f,_0xdf76e3,_0xf5eda,_0x4fa2b3){this[_0x6c90('0xf')]['createSquareMessage']({'uniqueid':this[_0x6c90('0xe')][_0x6c90('0x39')],'body':_0x2976c7,'direction':_0x551b0f,'providerName':_0xdf76e3,'providerResponse':_0xf5eda})['then'](function(_0x3ff153){if(_0x4fa2b3){_0x4fa2b3(null,_0x3ff153);}})[_0x6c90('0x15')](function(_0x546938){if(_0x4fa2b3){_0x4fa2b3(_0x546938);}});};AGIVertices['prototype']['createCmContact']=function(_0x3e0232,_0x5ac95b){var _0x3a0441=this;var _0x510d7d=0x0;var _0x2224c5={'firstName':_['isEmpty'](_0x3e0232[_0x6c90('0x14')])||_[_0x6c90('0x44')](_0x3e0232[_0x6c90('0x14')])?'callback_'+Math[_0x6c90('0x45')]():_0x3e0232[_0x6c90('0x14')],'lastName':_['isEmpty'](_0x3e0232[_0x6c90('0x46')])||_[_0x6c90('0x44')](_0x3e0232[_0x6c90('0x46')])?null:_0x3e0232[_0x6c90('0x46')],'phone':_0x3e0232['phone'],'ListId':_0x3e0232[_0x6c90('0x47')],'scheduledat':_0x3e0232[_0x6c90('0x48')],'callbackUniqueid':this[_0x6c90('0xe')]['uniqueid'],'tags':_0x6c90('0x49'),'description':_0x6c90('0x4a')+_0x3e0232[_0x6c90('0x48')][_0x6c90('0x4b')](),'priority':_0x3e0232[_0x6c90('0x4c')]};if(_[_0x6c90('0x4d')](_0x3e0232,_0x6c90('0x4e'))){if(!_[_0x6c90('0x44')](_0x3e0232[_0x6c90('0x4e')])){var _0x3103e1=_0x3e0232[_0x6c90('0x4e')];if(_0x3e0232[_0x6c90('0x4e')]=='CALLERID(dialTimezone)'){this['rpc'][_0x6c90('0x4f')]({'phone':_0x3e0232['phone']})[_0x6c90('0x18')](function(_0x401236){if(!_[_0x6c90('0x44')](_0x401236)){var _0x3d480d=_0x401236['dialTimezone'];if(!_[_0x6c90('0x44')](_0x3d480d)){var _0x18f576=shared[_0x6c90('0x50')][_0x3d480d];if(!_[_0x6c90('0x44')](_0x18f576)){var _0x59ae0c=-0x1*_0x18f576[_0x6c90('0x51')];_0x2224c5['scheduledat']=moment(_0x3e0232[_0x6c90('0x52')])['add'](_0x59ae0c,_0x6c90('0x53'));_0x3a0441['insertContact'](_0x2224c5,_0x3e0232,_0x5ac95b);}else{_0x3a0441[_0x6c90('0x54')](_0x2224c5,_0x3e0232,_0x5ac95b);}}else{_0x3a0441[_0x6c90('0x54')](_0x2224c5,_0x3e0232,_0x5ac95b);}}else{_0x3a0441['insertContact'](_0x2224c5,_0x3e0232,_0x5ac95b);}});}else{var _0x510d7d=shared[_0x6c90('0x50')][_0x3103e1];if(!_[_0x6c90('0x44')](_0x510d7d)){var _0x2cc115=-0x1*_0x510d7d[_0x6c90('0x51')];_0x2224c5[_0x6c90('0x52')]=moment(_0x3e0232['scheduledat'])[_0x6c90('0x55')](_0x2cc115,_0x6c90('0x53'));_0x3a0441[_0x6c90('0x54')](_0x2224c5,_0x3e0232,_0x5ac95b);}else{_0x3a0441[_0x6c90('0x54')](_0x2224c5,_0x3e0232,_0x5ac95b);}}}else{_0x3a0441['insertContact'](_0x2224c5,_0x3e0232,_0x5ac95b);}}else{_0x3a0441[_0x6c90('0x54')](_0x2224c5,_0x3e0232,_0x5ac95b);}};AGIVertices[_0x6c90('0x11')][_0x6c90('0x56')]=function(_0x4085f3,_0x1a7831){this[_0x6c90('0xf')][_0x6c90('0x57')](_0x4085f3)[_0x6c90('0x18')](function(_0x4c26d6){_0x1a7831(null,_0x4c26d6?_0x4c26d6[_0x6c90('0x14')]:![]);})[_0x6c90('0x15')](function(_0x363937){_0x1a7831(_0x363937);});};AGIVertices['prototype']['agentPause']=function(_0x3d0c74,_0x5c04c7,_0x4a5318){var _0x55ef71={'role':_0x6c90('0x58')};_0x55ef71[_0x3d0c74]=this['channel'][_0x6c90('0x3d')];this['rpc'][_0x6c90('0x59')](_0x55ef71,_0x5c04c7,this['channel']['uniqueid'])[_0x6c90('0x18')](function(_0x4e1bcb){_0x4a5318(null,_[_0x6c90('0x44')](_0x4e1bcb)?![]:!![]);})[_0x6c90('0x15')](function(_0x480353){logger['error'](_0x480353);_0x4a5318(null,![]);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x5a')]=function(_0x4f2bf7,_0x3a80b8){var _0x375481={'role':_0x6c90('0x58')};_0x375481[_0x4f2bf7]=this[_0x6c90('0xe')]['callerid'];this[_0x6c90('0xf')][_0x6c90('0x5a')](_0x375481)['then'](function(_0x275f0c){_0x3a80b8(null,_[_0x6c90('0x44')](_0x275f0c)?![]:!![]);})[_0x6c90('0x15')](function(_0x49b68a){logger[_0x6c90('0x33')](_0x49b68a);_0x3a80b8(null,![]);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x5b')]=function(_0x290e4d,_0x1922bd){var _0xbc6b9f={'role':_0x6c90('0x58')};_0xbc6b9f[_0x290e4d]=this[_0x6c90('0xe')]['callerid'];this[_0x6c90('0xf')][_0x6c90('0x5b')](_0xbc6b9f)[_0x6c90('0x18')](function(_0x1102bb){_0x1922bd(null,_[_0x6c90('0x44')](_0x1102bb)?![]:!![]);})['catch'](function(_0x3ccf59){logger[_0x6c90('0x33')](_0x3ccf59);_0x1922bd(null,![]);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x5c')]=function(_0x58fe65,_0x40bc39){var _0xa5735d={'role':_0x6c90('0x58')};_0xa5735d[_0x58fe65]=this[_0x6c90('0xe')][_0x6c90('0x3d')];var _0x59c0ae=_0x58fe65!='internal'?util[_0x6c90('0x2a')](_0x6c90('0x5d'),_0x6c90('0x5e'),this[_0x6c90('0xe')][_0x6c90('0x3d')]):undefined;this[_0x6c90('0xf')][_0x6c90('0x5c')](_0xa5735d,_0x59c0ae)[_0x6c90('0x18')](function(_0x1f7857){_0x40bc39(null,_[_0x6c90('0x44')](_0x1f7857)?![]:!![]);})[_0x6c90('0x15')](function(_0x1412ee){logger['error'](_0x1412ee);_0x40bc39(null,![]);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x5f')]=function(_0x3a994f,_0x475414){sh['exec'](_['trim'](_0x3a994f),function(_0x5915b1,_0x1af53f){var _0x4ee00d=_0x1af53f['replace'](/(\r\n|\n|\r)/gm,'');_0x475414(null,_0x4ee00d);});};AGIVertices[_0x6c90('0x11')]['googleCloudTTS']=function(_0x23ccbd,_0x408369){scripts[_0x6c90('0x60')](_0x23ccbd[_0x6c90('0x61')],_0x23ccbd[_0x6c90('0x62')]||_0x6c90('0x63'),_0x23ccbd['text'],_0x23ccbd['languageCode']||_0x6c90('0x64'),_0x23ccbd['ssmlGender']||_0x6c90('0x65'),_0x23ccbd['audioEncoding']||_0x6c90('0x66'))[_0x6c90('0x18')](function(_0x6ee7f6){_0x408369(null,_0x6ee7f6);})['catch'](function(_0x1bf330){_0x408369(_0x1bf330);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x67')]=function(_0x50361d,_0x187caf){scripts[_0x6c90('0x67')](_0x50361d[_0x6c90('0x63')],_0x50361d[_0x6c90('0x68')]||'en',0x1)[_0x6c90('0x18')](function(_0x4c55c9){_0x187caf(null,_0x4c55c9);})[_0x6c90('0x15')](function(_0xf40d7b){_0x187caf(_0xf40d7b);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x69')]=function(_0x93402,_0x35f9fa){var _0x585614={'uri':_0x93402[_0x6c90('0x6a')],'method':_0x93402[_0x6c90('0x6b')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x93402[_0x6c90('0x6c')])==='number'&&parseInt(_0x93402[_0x6c90('0x6c')])>=0x1?parseInt(_0x93402[_0x6c90('0x6c')])*0x3e8:0x5*0x3e8};if(_[_0x6c90('0x6d')]([_0x6c90('0x6e'),_0x6c90('0x6f')],_0x585614[_0x6c90('0x6b')][_0x6c90('0x70')]())){try{_0x585614['body']=_0x93402['rawBody']?JSON[_0x6c90('0x71')](_0x93402[_0x6c90('0xb')]):{};}catch(_0x14117e){logger[_0x6c90('0x33')](_0x6c90('0x72'),_0x14117e);}}try{_0x585614[_0x6c90('0x73')]=_0x93402['rawHeaders']?JSON['parse'](_0x93402[_0x6c90('0x74')]):{};}catch(_0x355f85){logger[_0x6c90('0x33')](_0x6c90('0x75'),_0x355f85);}if(_0x93402[_0x6c90('0x76')]){try{var _0x2bc53b=require(_0x93402[_0x6c90('0x76')])['sync'](this,_0x585614);_0x585614[_0x6c90('0x77')]=Mustache[_0x6c90('0x78')](_0x93402[_0x6c90('0x6a')],_0x2bc53b,{},['$$','$$']);if(_0x585614[_0x6c90('0x73')]){_0x585614[_0x6c90('0x73')]=JSON[_0x6c90('0x71')](Mustache[_0x6c90('0x78')](JSON['stringify'](_0x585614[_0x6c90('0x73')]),_0x2bc53b,{},['$$','$$']));}if(_0x585614[_0x6c90('0x79')]){_0x585614[_0x6c90('0x79')]=JSON[_0x6c90('0x71')](Mustache[_0x6c90('0x78')](JSON[_0x6c90('0x7a')](_0x585614[_0x6c90('0x79')]),_0x2bc53b,{},['$$','$$']));}}catch(_0xd7e04f){logger[_0x6c90('0x33')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0xd7e04f);}}rp(_0x585614)[_0x6c90('0x18')](function(_0x5634af){var _0x205680={'statusCode':_0x5634af[_0x6c90('0x7b')]||0xc8,'statusMessage':_0x5634af[_0x6c90('0x7c')]||'OK','headers':_0x5634af[_0x6c90('0x73')]||{},'body':_0x5634af[_0x6c90('0x79')]||{}};_0x35f9fa(null,_0x205680);})['catch'](function(_0x478b1f){var _0x4ed34a={'statusCode':_0x478b1f['statusCode']||0x1f4,'statusMessage':_0x478b1f[_0x6c90('0x7d')]||_0x6c90('0x7e'),'headers':_0x478b1f[_0x6c90('0x7f')][_0x6c90('0x73')]||{},'body':_0x478b1f[_0x6c90('0x7f')][_0x6c90('0x79')]||{}};_0x35f9fa(null,_0x4ed34a);});};AGIVertices[_0x6c90('0x11')]['googleDialogflow']=function(_0x5a782b,_0xa39259){scripts[_0x6c90('0x80')](this[_0x6c90('0xe')][_0x6c90('0x39')],_0x5a782b[_0x6c90('0x81')],_0x5a782b[_0x6c90('0x63')],_0x5a782b['dialogflow_language']||'en')['then'](function(_0x57d5e4){_0xa39259(null,_0x57d5e4);})[_0x6c90('0x15')](function(_0x3663c3){_0xa39259(_0x3663c3);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x82')]=function(_0x48fd78,_0x3e6171){scripts['googleDialogflowV2'](this[_0x6c90('0xe')][_0x6c90('0x39')],_0x48fd78['dialogflowV2_project_id'],_0x48fd78[_0x6c90('0x83')],_0x48fd78[_0x6c90('0x84')],_0x48fd78[_0x6c90('0x63')],_0x48fd78['dialogflowV2_language']||'en')[_0x6c90('0x18')](function(_0x516a51){_0x3e6171(null,_0x516a51);})[_0x6c90('0x15')](function(_0x106dc6){_0x3e6171(_0x106dc6);});};AGIVertices['prototype'][_0x6c90('0x85')]=function(_0x140f63,_0xf3153){scripts['sestekNDA'](this[_0x6c90('0xe')],_0x140f63)[_0x6c90('0x18')](function(_0x189c57){_0xf3153(null,_0x189c57);})[_0x6c90('0x15')](function(_0x57fb35){_0xf3153(_0x57fb35);});};AGIVertices['prototype'][_0x6c90('0x86')]=function(_0x1984e2,_0x525855){scripts[_0x6c90('0x86')](_0x1984e2['key'],_0x1984e2[_0x6c90('0x63')],_0x1984e2['ispeech_tts_language']||_0x6c90('0x64'),_0x1984e2[_0x6c90('0x87')])['then'](function(_0x39dc14){_0x525855(null,_0x39dc14);})[_0x6c90('0x15')](function(_0x5050c5){_0x525855(_0x5050c5);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x88')]=function(_0x45cc43,_0x3d1770,_0x1d4c13){scripts[_0x6c90('0x88')](_0x3d1770,_0x45cc43[_0x6c90('0x81')],_0x45cc43[_0x6c90('0x89')]||_0x6c90('0x64'),this[_0x6c90('0x8a')](_0x45cc43[_0x6c90('0x8b')])?_0x45cc43['model']:undefined)[_0x6c90('0x18')](function(_0x30d86a){_0x1d4c13(null,_0x30d86a);})[_0x6c90('0x15')](function(_0x32695c){_0x1d4c13(_0x32695c);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x8c')]=function(_0x298a0d,_0x2d7f6b){scripts[_0x6c90('0x8c')](_0x298a0d[_0x6c90('0x8d')],_0x298a0d[_0x6c90('0x8e')],_0x298a0d[_0x6c90('0x8f')],_0x298a0d['aws_polly_voice']||_0x6c90('0x90'),_0x298a0d[_0x6c90('0x63')],_0x298a0d['aws_text_type']||'text')['then'](function(_0x424796){_0x2d7f6b(null,_0x424796);})[_0x6c90('0x15')](function(_0x4ff5bb){_0x2d7f6b(_0x4ff5bb);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x91')]=function(_0x2e88e2,_0x28b1d6){scripts[_0x6c90('0x91')](this['channel'][_0x6c90('0x39')],_0x2e88e2[_0x6c90('0x8d')],_0x2e88e2['aws_secret_access_key'],_0x2e88e2[_0x6c90('0x92')],_0x2e88e2[_0x6c90('0x63')],_0x2e88e2['aws_bot_name'])[_0x6c90('0x18')](function(_0x3fda71){_0x28b1d6(null,_0x3fda71);})['catch'](function(_0x2a6f11){_0x28b1d6(_0x2a6f11);});};AGIVertices['prototype']['googleASR']=function(_0x57c5fb,_0x26ddac,_0x32bebf){scripts[_0x6c90('0x93')](_0x26ddac,_0x57c5fb['key'],_0x57c5fb['google_asr_language']||'en-US')[_0x6c90('0x18')](function(_0x44e826){_0x32bebf(null,_0x44e826);})[_0x6c90('0x15')](function(_0x2abea4){_0x32bebf(_0x2abea4);});};AGIVertices[_0x6c90('0x11')][_0x6c90('0x94')]=function(_0x40160e,_0x22e403,_0x2dc56b){scripts['tildeASR'](_0x22e403,_0x40160e[_0x6c90('0x95')],_0x40160e[_0x6c90('0x96')],_0x40160e['uri'])[_0x6c90('0x18')](function(_0x725cdc){_0x2dc56b(null,_0x725cdc);})['catch'](function(_0x18670e){_0x2dc56b(_0x18670e);});};AGIVertices['prototype'][_0x6c90('0x97')]=function(_0x14000d){var _0x43aa20=_[_0x6c90('0x6d')](verticesWithRetry,_0x14000d[_0x6c90('0x3b')])?_0x14000d:_[_0x6c90('0x98')](_0x14000d);for(var _0x3637fb in _0x43aa20){if(_0x43aa20[_0x6c90('0x99')](_0x3637fb)){if(_0x43aa20[_0x3637fb]&&_[_0x6c90('0x9a')](_0x43aa20[_0x3637fb])){if(_['includes'](recursiveMapAttributes,_0x3637fb)){_0x43aa20[_0x3637fb]=this[_0x6c90('0x9b')](_0x43aa20[_0x3637fb]);}else{_0x43aa20[_0x3637fb]=this[_0x6c90('0x9c')](_0x43aa20[_0x3637fb]);}}}}return _0x43aa20;};AGIVertices[_0x6c90('0x11')][_0x6c90('0x9d')]=function(_0x52be3c){for(var _0x5e9bb6 in _0x52be3c){if(_0x52be3c['hasOwnProperty'](_0x5e9bb6)){if(_[_0x6c90('0x9e')](_0x52be3c[_0x5e9bb6])){this['recursiveNodeIndex'](_0x52be3c[_0x5e9bb6]);}else if(_[_0x6c90('0x9f')](_0x52be3c[_0x5e9bb6])){for(var _0x5eb1a0=0x0;_0x5eb1a0<_0x52be3c[_0x5e9bb6]['length'];_0x5eb1a0++){this[_0x6c90('0x9d')](_0x52be3c[_0x5e9bb6][_0x5eb1a0]);}}else if(_[_0x6c90('0x9a')](_0x52be3c[_0x5e9bb6])){_0x52be3c[_0x5e9bb6]=this[_0x6c90('0x9c')](_0x52be3c[_0x5e9bb6]);}}}};AGIVertices[_0x6c90('0x11')][_0x6c90('0xa0')]=function(_0x5c085a,_0x2a6513){for(var _0x25a946 in _0x5c085a){if(_0x5c085a[_0x6c90('0x99')](_0x25a946)){if(_[_0x6c90('0x9e')](_0x5c085a[_0x25a946])){if(!_[_0x6c90('0xa1')](_0x5c085a[_0x25a946])){this[_0x6c90('0xa0')](_0x5c085a[_0x25a946],util[_0x6c90('0x2a')](_0x6c90('0xa2'),_0x2a6513,_0x25a946));}}else if(_['isArray'](_0x5c085a[_0x25a946])){for(var _0x43046e=0x0;_0x43046e<_0x5c085a[_0x25a946][_0x6c90('0xa3')];_0x43046e++){this[_0x6c90('0xa0')](_0x5c085a[_0x25a946][_0x43046e],util[_0x6c90('0x2a')](_0x6c90('0xa2'),_0x2a6513,_0x25a946+'['+_0x43046e+']'));}}else{if(!_[_0x6c90('0x44')](_0x5c085a[_0x25a946])){this['channel'][_0x6c90('0xa4')](util[_0x6c90('0x2a')](_0x6c90('0xa2'),_0x2a6513,_0x25a946),_0x5c085a[_0x25a946]);}}}}};AGIVertices[_0x6c90('0x11')]['replaceObjectAllVariables']=function(_0x5d5cd8){try{var _0x5bcaa2=JSON[_0x6c90('0x71')](_0x5d5cd8);this[_0x6c90('0x9d')](_0x5bcaa2);return JSON['stringify'](_0x5bcaa2);}catch(_0xdb2fb9){return this['replaceAllVariables'](_0x5d5cd8);}};AGIVertices['prototype'][_0x6c90('0x9c')]=function(_0x535064){var _0x35db2e=_0x535064[_0x6c90('0xa5')]('{');for(var _0x1b73c4=0x1;_0x1b73c4<_0x35db2e[_0x6c90('0xa3')];_0x1b73c4+=0x1){var _0x4c2d05=_0x35db2e[_0x1b73c4][_0x6c90('0xa5')]('}');if(_0x4c2d05[_0x6c90('0xa3')]>0x1){_0x535064=_0x535064[_0x6c90('0xa6')]('{'+_0x4c2d05[0x0]+'}',this[_0x6c90('0xe')]['getVariable'](_0x4c2d05[0x0])[_0x6c90('0xa7')]||_0x4c2d05[0x0]);}}if(_0x35db2e[_0x6c90('0xa3')]===0x1){return _0x535064[_0x6c90('0x4b')]();}return this[_0x6c90('0x9c')](_0x535064);};AGIVertices['prototype'][_0x6c90('0xa8')]=function(_0x322593,_0x47d9d4){var _0x53c4f2=this[_0x6c90('0xe')][_0x6c90('0x12')](_0x322593);if(_0x53c4f2[_0x6c90('0xa9')]===-0x1){return _0x53c4f2;}logger['info'](util[_0x6c90('0x2a')](_0x6c90('0xaa'),_0x47d9d4,_0x53c4f2[_0x6c90('0xa7')]));return this[_0x6c90('0xe')][_0x6c90('0xa4')](_0x47d9d4,_0x53c4f2[_0x6c90('0xa7')]);};AGIVertices[_0x6c90('0x11')][_0x6c90('0x8a')]=function(_0x31eeee){return _0x31eeee&&_0x31eeee!=='0'&&_0x31eeee!=='-1'&&_0x31eeee!=='';};AGIVertices[_0x6c90('0x11')][_0x6c90('0xab')]=function(_0x83e77e){this[_0x6c90('0x38')][_0x6c90('0xac')](this,_0x83e77e,'-');_0x83e77e[_0x6c90('0xad')]=_0x83e77e[_0x6c90('0xab')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x6c90('0x11')][_0x6c90('0xae')]=function(_0xfc10b8){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0xaf'),_0xfc10b8[_0x6c90('0x3a')]));if(!this[_0x6c90('0x8a')](_0xfc10b8[_0x6c90('0x63')])){return this['channel']['noop'](_0x6c90('0xb0'));}var _0x28da4e='\x22'+_0xfc10b8[_0x6c90('0x63')]+'\x22';if(this[_0x6c90('0x8a')](_0xfc10b8[_0x6c90('0x7f')])){_0x28da4e+=','+_0xfc10b8[_0x6c90('0x7f')];}var _0x35f392=this['channel'][_0x6c90('0xb1')](_0x6c90('0xb2'),_0x28da4e);if(_0x35f392[_0x6c90('0xa9')]===-0x1){return _0x35f392;}return this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0xb4'),_0x28da4e));};AGIVertices[_0x6c90('0x11')][_0x6c90('0xb5')]=function(_0x27dc38){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0xb6'),_0x27dc38[_0x6c90('0x3a')]));if(!this[_0x6c90('0x8a')](_0x27dc38[_0x6c90('0xb7')])){return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0xb8'));}var _0x154242=_0x27dc38['grammar'];if(this['isConfigured'](_0x27dc38[_0x6c90('0x7f')])){_0x154242+=','+_0x27dc38[_0x6c90('0x7f')];}var _0x19b8f6=this[_0x6c90('0xe')]['exec'](_0x6c90('0xb9'),_0x154242);if(_0x19b8f6['result']===-0x1){return _0x19b8f6;}var _0x48e1db=this[_0x6c90('0xa8')](_0x6c90('0xba'),_0x6c90('0xbb'));if(_0x48e1db['result']===-0x1){return _0x48e1db;}var _0x5a294d=this[_0x6c90('0xa8')](_0x6c90('0xbc'),'MRCP_RECOG_TRANSCRIPT');if(_0x5a294d[_0x6c90('0xa9')]===-0x1){return _0x5a294d;}var _0x1f1a6b=this[_0x6c90('0xa8')](_0x6c90('0xbd'),_0x6c90('0xbe'));if(_0x1f1a6b[_0x6c90('0xa9')]===-0x1){return _0x1f1a6b;}return this['channel'][_0x6c90('0xb3')](util['format'](_0x6c90('0xbf'),_0x154242));};AGIVertices[_0x6c90('0x11')][_0x6c90('0x8')]=function(_0xa01e26){logger['info'](util['format'](_0x6c90('0xc0'),_0xa01e26[_0x6c90('0x3a')]));return this[_0x6c90('0xe')][_0x6c90('0x8')]([_0xa01e26[_0x6c90('0xc1')],_0xa01e26['args']]);};AGIVertices[_0x6c90('0x11')][_0x6c90('0xc2')]=function(_0x3de0db){logger[_0x6c90('0x2e')](util['format'](_0x6c90('0xc3'),_0x3de0db[_0x6c90('0x3a')]));if(this['isConfigured'](_0x3de0db[_0x6c90('0x6c')])){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0xc4'),_0x3de0db[_0x6c90('0x6c')]));var _0x5f1cc4=this[_0x6c90('0xe')][_0x6c90('0xc5')](_0x3de0db['timeout']);if(_0x5f1cc4[_0x6c90('0xa9')]===-0x1){return _0x5f1cc4;}}return this[_0x6c90('0xe')][_0x6c90('0xc2')]();};AGIVertices[_0x6c90('0x11')][_0x6c90('0x49')]=function(_0x56f3cd){logger['info'](util['format'](_0x6c90('0xc6'),_0x56f3cd['label']));if(!this[_0x6c90('0x8a')](_0x56f3cd[_0x6c90('0x47')])){return this['channel']['error'](_0x56f3cd,'no\x20list\x20selected');}_0x56f3cd[_0x6c90('0x48')]=moment();if(this[_0x6c90('0x8a')](_0x56f3cd['delay'])){_0x56f3cd[_0x6c90('0x48')]=moment()[_0x6c90('0x55')](_0x56f3cd[_0x6c90('0xc7')],'minutes');}if(!this[_0x6c90('0x8a')](_0x56f3cd['callback_priority'])){_0x56f3cd[_0x6c90('0x4c')]=0x2;}this[_0x6c90('0xc8')][_0x6c90('0xac')](this,_0x56f3cd);return this[_0x6c90('0xe')]['noop'](util[_0x6c90('0x2a')](_0x6c90('0xc9'),_0x56f3cd[_0x6c90('0xca')],_0x56f3cd[_0x6c90('0x47')],_0x56f3cd['scheduledAt']));};AGIVertices[_0x6c90('0x11')][_0x6c90('0xcb')]=function(_0x31b35a){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0xcc'),_0x31b35a[_0x6c90('0x3a')]));var _0x4bf681=this[_0x6c90('0xe')][_0x6c90('0xb1')](_0x31b35a['application'],_0x31b35a[_0x6c90('0x7f')]);if(_0x4bf681[_0x6c90('0xa9')]===-0x1){return _0x4bf681;}return this['channel'][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0xcd'),_0x31b35a['application'],_0x31b35a[_0x6c90('0x7f')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x3941e7){logger['info'](util[_0x6c90('0x2a')](_0x6c90('0xce'),_0x3941e7['label']));if(!this['isConfigured'](_0x3941e7[_0x6c90('0x63')])){return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0xb0'));}var _0x2239ff='\x22'+_0x3941e7[_0x6c90('0x63')]+'\x22';if(this[_0x6c90('0x8a')](_0x3941e7[_0x6c90('0x7f')])){_0x2239ff+=','+_0x3941e7[_0x6c90('0x7f')];}var _0x14491b=this['channel'][_0x6c90('0xb1')](_0x6c90('0xb2'),_0x2239ff);if(_0x14491b[_0x6c90('0xa9')]===-0x1){return _0x14491b;}return this[_0x6c90('0xe')]['noop'](util['format'](_0x6c90('0xb4'),_0x2239ff));};AGIVertices['prototype'][_0x6c90('0xcf')]=function(_0x592154){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0xd0'),_0x592154[_0x6c90('0x3a')]));if(!this[_0x6c90('0x8a')](_0x592154['text'])){return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0xb0'));}var _0x35cc23='\x22'+_0x592154[_0x6c90('0x63')]+'\x22';if(this[_0x6c90('0x8a')](_0x592154['options'])){_0x35cc23+=','+_0x592154[_0x6c90('0x7f')];}var _0x53a6d1=this[_0x6c90('0xe')][_0x6c90('0xb1')]('MRCPSynth',_0x35cc23);if(_0x53a6d1[_0x6c90('0xa9')]===-0x1){return _0x53a6d1;}return this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0xb4'),_0x35cc23));};AGIVertices[_0x6c90('0x11')][_0x6c90('0xd1')]=function(_0x494b9a){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0xd2'),_0x494b9a['label']));if(!this[_0x6c90('0x8a')](_0x494b9a[_0x6c90('0xb7')])){return this['channel'][_0x6c90('0xb3')](_0x6c90('0xb8'));}var _0xb4003d=_0x494b9a[_0x6c90('0xb7')];if(this[_0x6c90('0x8a')](_0x494b9a[_0x6c90('0x7f')])){_0xb4003d+=','+_0x494b9a[_0x6c90('0x7f')];}var _0x23e0d3=this[_0x6c90('0xe')][_0x6c90('0xb1')](_0x6c90('0xb9'),_0xb4003d);if(_0x23e0d3[_0x6c90('0xa9')]===-0x1){return _0x23e0d3;}var _0x1036c9=this['getAndSetVariable'](_0x6c90('0xba'),_0x6c90('0xd3'));if(_0x1036c9[_0x6c90('0xa9')]===-0x1){return _0x1036c9;}var _0x33e4d4=this['getAndSetVariable'](_0x6c90('0xbc'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x33e4d4['result']===-0x1){return _0x33e4d4;}var _0x354f23=this[_0x6c90('0xa8')](_0x6c90('0xbd'),_0x6c90('0xd4'));if(_0x354f23[_0x6c90('0xa9')]===-0x1){return _0x354f23;}return this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0xbf'),_0xb4003d));};AGIVertices[_0x6c90('0x11')][_0x6c90('0xd5')]=function(_0xf747d2){logger['info'](util[_0x6c90('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0xf747d2[_0x6c90('0x3a')]));if(!this[_0x6c90('0x8a')](_0xf747d2[_0x6c90('0xb7')])){return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0xb8'));}var _0x47f485=_0xf747d2['grammar'];if(this['isConfigured'](_0xf747d2['options'])){_0x47f485+=','+_0xf747d2[_0x6c90('0x7f')];}var _0x3132ae=this[_0x6c90('0xe')][_0x6c90('0xb1')]('MRCPRecog',_0x47f485);if(_0x3132ae['result']===-0x1){return _0x3132ae;}var _0x59f037=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x6c90('0xd6'));if(_0x59f037[_0x6c90('0xa9')]===-0x1){return _0x59f037;}var _0x210623=this[_0x6c90('0xa8')]('RECOG_INPUT()',_0x6c90('0xd7'));if(_0x210623[_0x6c90('0xa9')]===-0x1){return _0x210623;}var _0x31ed71=this['getAndSetVariable']('RECOG_INSTANCE()',_0x6c90('0xd8'));if(_0x31ed71['result']===-0x1){return _0x31ed71;}return this[_0x6c90('0xe')][_0x6c90('0xb3')](util['format'](_0x6c90('0xbf'),_0x47f485));};AGIVertices['prototype']['database']=function(_0x471925){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0xd9'),_0x471925['label']));if(!this[_0x6c90('0x8a')](_0x471925[_0x6c90('0xda')])){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x471925,_0x6c90('0xdb'));}var _0x35f9c5=this[_0x6c90('0x1a')][_0x6c90('0xac')](this,_0x471925[_0x6c90('0xda')]);if(!_0x35f9c5){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x471925,_0x6c90('0xdc'));}if(!this[_0x6c90('0x8a')](_0x471925['query'])){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x471925,_0x6c90('0xdd'));}var _0x41fdf2=_0x471925[_0x6c90('0x30')][_0x6c90('0xde')](/(\r\n|\n|\r)/gm,'\x20');this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')]('query:\x20%s',_0x41fdf2));var _0x2b96a9=this['getQueryOdbc']['sync'](this,_0x35f9c5,_0x41fdf2);this[_0x6c90('0x38')]['sync'](this,_0x471925,_0x41fdf2);if(!this[_0x6c90('0x8a')](_0x471925[_0x6c90('0xdf')])){return this['channel']['noop'](_0x6c90('0xe0'));}var _0x4f3d1c=this[_0x6c90('0x12')][_0x6c90('0xac')](this,_0x471925[_0x6c90('0xdf')]);if(!_0x4f3d1c){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x471925,'no\x20variable\x20found');}var _0x4d1b44=this;_0x2b96a9[_0x6c90('0xe1')](function(_0x4a1c7b,_0x4ae382){Object[_0x6c90('0xe2')](_0x4a1c7b)[_0x6c90('0xe1')](function(_0x1ab254){_0x4d1b44[_0x6c90('0xe')]['setVariable'](util[_0x6c90('0x2a')](_0x6c90('0xe3'),_0x4f3d1c,_0x4ae382,_0x1ab254),_0x4a1c7b[_0x1ab254]);});});this['channel'][_0x6c90('0xa4')](util[_0x6c90('0x2a')]('%s_ROWS_COUNT',_0x4f3d1c),_0x2b96a9[_0x6c90('0xa3')]);return this[_0x6c90('0xe')]['noop'](util[_0x6c90('0x2a')](_0x6c90('0xe4'),_0x4f3d1c));};AGIVertices[_0x6c90('0x11')]['dial']=function(_0x1a9b4e){logger['debug'](util[_0x6c90('0x2a')](_0x6c90('0xe5'),_0x1a9b4e[_0x6c90('0x3a')]));if(!this['isConfigured'](_0x1a9b4e[_0x6c90('0xe6')])){return this[_0x6c90('0xe')]['error'](_0x1a9b4e,_0x6c90('0xe7'));}var _0x5e91ef=this[_0x6c90('0x1b')]['sync'](this,_0x1a9b4e[_0x6c90('0xe6')]);if(!_0x5e91ef){return this[_0x6c90('0xe')]['error'](_0x1a9b4e,'no\x20user\x20found');}var _0x1bfe09=this[_0x6c90('0xe')][_0x6c90('0xb1')](_0x6c90('0xe8'),[util[_0x6c90('0x2a')](_0x6c90('0xe9'),_0x5e91ef),_0x1a9b4e['timeout'],_0x1a9b4e[_0x6c90('0xea')],_0x1a9b4e[_0x6c90('0x6a')]]);if(_0x1bfe09[_0x6c90('0xa9')]===-0x1){return _0x1bfe09;}return this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')]('Executed\x20command\x20%s',_0x6c90('0xe8')));};AGIVertices[_0x6c90('0x11')]['dialogflow']=function(_0x2c4b71){logger[_0x6c90('0x2e')](util['format'](_0x6c90('0xeb'),_0x2c4b71[_0x6c90('0x3a')]));if(!this[_0x6c90('0x8a')](_0x2c4b71[_0x6c90('0x81')])){return this['channel'][_0x6c90('0xb3')](_0x6c90('0xec'));}if(!this['isConfigured'](_0x2c4b71[_0x6c90('0x63')])){return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0xb0'));}this[_0x6c90('0xe')][_0x6c90('0xed')]=!![];this['createSquareDetailsReport'](_0x2c4b71);this[_0x6c90('0xee')](_0x2c4b71[_0x6c90('0x63')],'in','','');this['channel']['noop'](util[_0x6c90('0x2a')]('Trying\x20Dialogflow:\x20%s',_0x2c4b71[_0x6c90('0x63')]));var _0x39f257=this[_0x6c90('0x80')][_0x6c90('0xac')](this,_0x2c4b71);if(_0x39f257){for(var _0x172c29 in _0x39f257){if(_0x39f257[_0x6c90('0x99')](_0x172c29)){this[_0x6c90('0xe')][_0x6c90('0xa4')](util[_0x6c90('0x2a')]('DIALOGFLOW_%s',_0x172c29[_0x6c90('0x70')]()),_0x39f257[_0x172c29]);}}this[_0x6c90('0xee')](_0x39f257['speech'],_0x6c90('0xef'),_0x6c90('0xf0'),'');return this[_0x6c90('0xe')]['noop'](util[_0x6c90('0x2a')](_0x6c90('0xf1'),_0x39f257[_0x6c90('0xf2')]));}return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x2c4b71,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x6c90('0x11')]['dialogflowV2']=function(_0x5b7ba7){logger[_0x6c90('0x2e')](util['format'](_0x6c90('0xf3'),_0x5b7ba7['label']));if(!this[_0x6c90('0x8a')](_0x5b7ba7[_0x6c90('0xf4')])){return this['channel'][_0x6c90('0xb3')](_0x6c90('0xf5'));}if(!this[_0x6c90('0x8a')](_0x5b7ba7[_0x6c90('0x83')])){return this[_0x6c90('0xe')]['noop']('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x5b7ba7[_0x6c90('0x84')])){return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0xf6'));}if(!this[_0x6c90('0x8a')](_0x5b7ba7['dialogflowV2_language'])){return this['channel']['noop'](_0x6c90('0xf7'));}if(!this[_0x6c90('0x8a')](_0x5b7ba7[_0x6c90('0x63')])){return this['channel']['noop'](_0x6c90('0xb0'));}this[_0x6c90('0xe')][_0x6c90('0xed')]=!![];this[_0x6c90('0x38')](_0x5b7ba7);this['createSquareMessage'](_0x5b7ba7[_0x6c90('0x63')],'in','','');this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0xf8'),_0x5b7ba7[_0x6c90('0x63')]));var _0x15baf4=this['googleDialogflowV2'][_0x6c90('0xac')](this,_0x5b7ba7);if(_0x15baf4){for(var _0x32c029 in _0x15baf4){if(_0x15baf4['hasOwnProperty'](_0x32c029)){if(_0x32c029!==_0x6c90('0xf9')){this[_0x6c90('0xe')][_0x6c90('0xa4')](util[_0x6c90('0x2a')](_0x6c90('0xfa'),_0x32c029[_0x6c90('0x70')]()),_0x15baf4[_0x32c029]);}}}this[_0x6c90('0xee')](_0x15baf4[_0x6c90('0xf2')],_0x6c90('0xef'),_0x6c90('0xfb'),_0x15baf4['providerResponse']);return this[_0x6c90('0xe')][_0x6c90('0xb3')](util['format'](_0x6c90('0xfc'),_0x15baf4['speech']));}return this[_0x6c90('0xe')]['error'](_0x5b7ba7,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x6c90('0x11')][_0x6c90('0xfd')]=function(_0x502762){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0xfe'),_0x502762[_0x6c90('0x3a')]));if(!this[_0x6c90('0x8a')](_0x502762[_0x6c90('0xff')])){return this['channel'][_0x6c90('0xb3')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x6c90('0x8a')](_0x502762[_0x6c90('0x100')])){return this[_0x6c90('0xe')]['noop'](_0x6c90('0x101'));}if(!this[_0x6c90('0x8a')](_0x502762[_0x6c90('0x102')])){return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0x103'));}if(!this[_0x6c90('0x8a')](_0x502762[_0x6c90('0x104')])){return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0xb0'));}this['channel'][_0x6c90('0xed')]=!![];this['createSquareDetailsReport'](_0x502762);this['createSquareMessage'](_0x502762['text'],'in','','');this[_0x6c90('0xe')]['noop'](util['format'](_0x6c90('0x105'),_0x502762[_0x6c90('0x63')]));var _0x5d750a=this[_0x6c90('0x85')][_0x6c90('0xac')](this,_0x502762);if(_0x5d750a){for(var _0x4884ad in _0x5d750a){if(_0x5d750a['hasOwnProperty'](_0x4884ad)){this['channel'][_0x6c90('0xa4')](util[_0x6c90('0x2a')](_0x6c90('0x106'),_0x4884ad[_0x6c90('0x70')]()),_0x5d750a[_0x4884ad]);}}this[_0x6c90('0xee')](_0x5d750a[_0x6c90('0xf2')],_0x6c90('0xef'),_0x6c90('0xfd'),'');if(_0x5d750a[_0x6c90('0x107')]){this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0x108'),_0x5d750a[_0x6c90('0x107')]));var _0x379d28=this[_0x6c90('0xe')][_0x6c90('0x109')](_0x5d750a[_0x6c90('0x107')]);try{fs[_0x6c90('0x10a')](_0x5d750a['audiofile']+_0x6c90('0x10b'));}catch(_0x2c35b0){logger[_0x6c90('0x33')](_0x2c35b0);}return _0x379d28;}else{return this['channel']['noop'](util[_0x6c90('0x2a')](_0x6c90('0x10c'),_0x5d750a[_0x6c90('0xf2')]));}}return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x502762,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x6c90('0x11')]['end']=function(_0x154160){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x10d'),_0x154160[_0x6c90('0x3a')]));return this[_0x6c90('0xe')][_0x6c90('0xb3')]('end');};AGIVertices[_0x6c90('0x11')]['ext_dial']=function(_0x1cde81){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x10e'),_0x1cde81[_0x6c90('0x3a')]));var _0x458e4f='';if(_0x1cde81['trunk_id']){if(!this['isConfigured'](_0x1cde81[_0x6c90('0x10f')])){return this[_0x6c90('0xe')]['error'](_0x1cde81,_0x6c90('0x110'));}else{var _0x28e42a=parseInt(_0x1cde81[_0x6c90('0x10f')],0xa);if(isNaN(_0x28e42a)){_0x458e4f=_0x1cde81[_0x6c90('0x10f')];}else{_0x458e4f=this[_0x6c90('0x1c')][_0x6c90('0xac')](this,_0x1cde81[_0x6c90('0x10f')]);if(!_0x458e4f){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x1cde81,_0x6c90('0x111'));}}}}else if(_0x1cde81[_0x6c90('0x112')]){_0x458e4f=_0x1cde81[_0x6c90('0x112')];}else{return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x1cde81,_0x6c90('0x110'));}var _0x5d7b3f=this[_0x6c90('0xe')][_0x6c90('0xb1')](_0x6c90('0xe8'),[util['format'](_0x6c90('0x113'),_0x458e4f,_0x1cde81[_0x6c90('0xca')]),_0x1cde81[_0x6c90('0x6c')],_0x1cde81[_0x6c90('0xea')],_0x1cde81['url']]);if(_0x5d7b3f[_0x6c90('0xa9')]===-0x1){return _0x5d7b3f;}return this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0x114'),_0x6c90('0xe8')));};AGIVertices[_0x6c90('0x11')][_0x6c90('0x115')]=function(_0x41ca61){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x116'),_0x41ca61['label']));return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0x115'));};AGIVertices[_0x6c90('0x11')][_0x6c90('0xc')]=function(_0x1a2d8f){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x1a2d8f[_0x6c90('0x3a')]));if(_0x1a2d8f[_0x6c90('0xad')]===0x0){return this[_0x6c90('0xab')](_0x1a2d8f);}_0x1a2d8f[_0x6c90('0xad')]-=0x1;if(!this[_0x6c90('0x8a')](_0x1a2d8f['file_id'])){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x1a2d8f,'no\x20file\x20audio\x20selected');}var _0x35fb60=this[_0x6c90('0x1e')][_0x6c90('0xac')](this,_0x1a2d8f[_0x6c90('0x117')]);if(!_0x35fb60){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x1a2d8f,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0x1a2d8f['variable_id'])){return this[_0x6c90('0xe')]['error'](_0x6c90('0xe0'));}var _0x2417a1=this[_0x6c90('0xe')][_0x6c90('0x118')](_0x35fb60,_0x1a2d8f[_0x6c90('0x119')],_0x1a2d8f[_0x6c90('0x11a')]);var _0x354390=_0x2417a1[_0x6c90('0xa9')]?_0x2417a1[_0x6c90('0xa9')]['toString']():'';logger[_0x6c90('0x2e')](_0x6c90('0x11b'),JSON[_0x6c90('0x7a')](_0x2417a1));if(_0x2417a1[_0x6c90('0xa9')]===-0x1){this[_0x6c90('0x38')]['sync'](this,_0x1a2d8f,_0x354390);return _0x2417a1;}else if(_0x2417a1['extra']==='timeout'){_0x2417a1[_0x6c90('0xa9')]=_0x354390[_0x6c90('0xa3')]>=parseInt(_0x1a2d8f[_0x6c90('0x11c')])?'x':'i';}else{_0x2417a1['result']=_0x354390['length']>=parseInt(_0x1a2d8f[_0x6c90('0x11c')])&&_0x354390[_0x6c90('0xa3')]<=parseInt(_0x1a2d8f['maxdigit'])?'x':'i';}var _0x4a105d=this[_0x6c90('0x12')][_0x6c90('0xac')](this,_0x1a2d8f[_0x6c90('0xdf')]);if(!_0x4a105d){return this[_0x6c90('0xe')]['error'](_0x1a2d8f,_0x6c90('0x11d'));}this[_0x6c90('0xe')][_0x6c90('0xa4')](_0x4a105d,_0x354390);if(this[_0x6c90('0x8a')](_0x1a2d8f['hiddendigitsnum'])){var _0x52fe89=parseInt(_0x1a2d8f[_0x6c90('0x11e')],0xa);var _0x222e7c=rs[_0x6c90('0x11f')]({'charset':'*','length':_0x52fe89});var _0x5b6a33=_0x354390[_0x6c90('0xa3')];if(_0x5b6a33>0x0){if(_0x5b6a33>_0x52fe89){this[_0x6c90('0x38')][_0x6c90('0xac')](this,_0x1a2d8f,_0x1a2d8f[_0x6c90('0x120')]==='first'?_0x222e7c+_0x354390['substr'](_0x52fe89):_0x354390[_0x6c90('0x121')](0x0,_0x5b6a33-_0x52fe89)+_0x222e7c);}else{this[_0x6c90('0x38')][_0x6c90('0xac')](this,_0x1a2d8f,rs[_0x6c90('0x11f')]({'charset':'*','length':_0x5b6a33}));}}else{this[_0x6c90('0x38')]['sync'](this,_0x1a2d8f,'');}}else{this['createSquareDetailsReport'][_0x6c90('0xac')](this,_0x1a2d8f,_0x354390);}return _0x2417a1;};AGIVertices['prototype'][_0x6c90('0xd')]=function(_0x1c39a4){logger[_0x6c90('0x2e')](util['format'](_0x6c90('0x122'),_0x1c39a4[_0x6c90('0x3a')]));return this[_0x6c90('0xc')](_0x1c39a4);};AGIVertices[_0x6c90('0x11')][_0x6c90('0x123')]=function(_0x51808b){logger[_0x6c90('0x2e')](util['format'](_0x6c90('0x124'),_0x51808b[_0x6c90('0x3a')]));this[_0x6c90('0x38')]['sync'](this,_0x51808b,_0x51808b[_0x6c90('0x125')]);return this[_0x6c90('0xe')][_0x6c90('0xb3')](util['format'](_0x6c90('0x126'),_0x51808b[_0x6c90('0x125')]));};AGIVertices[_0x6c90('0x11')][_0x6c90('0x127')]=function(_0x4e2f9a){logger[_0x6c90('0x2e')](util['format'](_0x6c90('0x128'),_0x4e2f9a[_0x6c90('0x3a')]));if(!this['isConfigured'](_0x4e2f9a[_0x6c90('0x8d')])||!this[_0x6c90('0x8a')](_0x4e2f9a['aws_secret_access_key'])){return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0x129'));}if(!this[_0x6c90('0x8a')](_0x4e2f9a[_0x6c90('0x63')])){return this[_0x6c90('0xe')][_0x6c90('0xb3')]('no\x20text\x20configured');}this['channel'][_0x6c90('0xb3')](util[_0x6c90('0x2a')]('Trying\x20aws\x20Polly\x20%s',_0x4e2f9a[_0x6c90('0x63')]));var _0x2828e5=this[_0x6c90('0x8c')][_0x6c90('0xac')](this,_0x4e2f9a);if(_0x2828e5){this[_0x6c90('0xe')][_0x6c90('0xb3')](util['format'](_0x6c90('0x12a'),_0x2828e5));var _0x33383e=this['channel'][_0x6c90('0x109')](_0x2828e5);try{fs[_0x6c90('0x10a')](_0x2828e5+_0x6c90('0x10b'));}catch(_0x18febc){logger[_0x6c90('0x33')](_0x18febc);}return _0x33383e;}return this['channel'][_0x6c90('0x33')](_0x4e2f9a,_0x6c90('0x12b'));};AGIVertices[_0x6c90('0x11')][_0x6c90('0x12c')]=function(_0x56d173){logger[_0x6c90('0x2e')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x56d173[_0x6c90('0x3a')]));if(!this[_0x6c90('0x8a')](_0x56d173[_0x6c90('0x8d')])||!this['isConfigured'](_0x56d173[_0x6c90('0x8e')])){return this['channel']['noop'](_0x6c90('0x129'));}if(!this[_0x6c90('0x8a')](_0x56d173[_0x6c90('0x12d')])){return this[_0x6c90('0xe')][_0x6c90('0xb3')]('no\x20bot\x20name\x20configured');}if(!this[_0x6c90('0x8a')](_0x56d173[_0x6c90('0x63')])){return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0xb0'));}this['channel'][_0x6c90('0xed')]=!![];this[_0x6c90('0x38')](_0x56d173);this[_0x6c90('0xee')](_0x56d173[_0x6c90('0x63')],'in','','');this['channel'][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0x12e'),_0x56d173[_0x6c90('0x63')]));var _0x4e9afe=this[_0x6c90('0x91')][_0x6c90('0xac')](this,_0x56d173);if(_0x4e9afe){for(var _0x418868 in _0x4e9afe){if(_0x4e9afe[_0x6c90('0x99')](_0x418868)&&_[_0x6c90('0x9a')](_0x4e9afe[_0x418868])){this[_0x6c90('0xe')][_0x6c90('0xa4')](util[_0x6c90('0x2a')](_0x6c90('0x12f'),_0x418868[_0x6c90('0x70')]()),_0x4e9afe[_0x418868]);}}if(_[_0x6c90('0x44')](_0x4e9afe[_0x6c90('0x7d')])){return this['channel']['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x6c90('0xee')](_0x4e9afe[_0x6c90('0x7d')],_0x6c90('0xef'),_0x6c90('0x130'),'');return this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0x131'),_0x4e9afe[_0x6c90('0x7d')]));}}return this[_0x6c90('0xe')]['error'](_0x56d173,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x6c90('0x11')]['googleasr']=function(_0x55435a){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x132'),_0x55435a['label'],_0x55435a[_0x6c90('0x6c')]));if(!this['isConfigured'](_0x55435a[_0x6c90('0x81')])){return this[_0x6c90('0xe')]['noop'](_0x6c90('0xec'));}var _0x5b207f=_0x6c90('0x133');var _0x1c4a0b=util[_0x6c90('0x2a')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1a3d5c=util[_0x6c90('0x2a')](_0x6c90('0xa2'),_0x1c4a0b,_0x5b207f);var _0x1a4865=!![];if(_0x55435a[_0x6c90('0x134')]===_0x6c90('0x135')){_0x1a4865=![];}var _0x53530d=this['channel'][_0x6c90('0x136')](_0x1c4a0b,_0x5b207f,_0x55435a[_0x6c90('0x137')],_0x55435a['timeout'],undefined,_0x1a4865);if(_0x53530d[_0x6c90('0xa9')]!==-0x1){this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0x138'),_0x1a3d5c));var _0x329a96=this[_0x6c90('0x93')][_0x6c90('0xac')](this,_0x55435a,_0x1a3d5c);if(_0x329a96){for(var _0x3ca870 in _0x329a96){if(_0x329a96[_0x6c90('0x99')](_0x3ca870)){this['channel'][_0x6c90('0xa4')](util['format'](_0x6c90('0x139'),_0x3ca870[_0x6c90('0x70')]()),_0x329a96[_0x3ca870]);}}return this[_0x6c90('0xe')]['noop'](util[_0x6c90('0x2a')](_0x6c90('0x13a'),JSON[_0x6c90('0x7a')](_0x329a96)));}}return _0x53530d;};AGIVertices['prototype'][_0x6c90('0x13b')]=function(_0x65f9c3){logger['info'](util[_0x6c90('0x2a')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x65f9c3[_0x6c90('0x3a')]));if(!this['isConfigured'](_0x65f9c3['appid'])){return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0x13c'));}if(!this[_0x6c90('0x8a')](_0x65f9c3[_0x6c90('0x96')])){return this[_0x6c90('0xe')]['noop'](_0x6c90('0x13d'));}var _0x2aba59=_0x6c90('0x133');var _0x40e352=util[_0x6c90('0x2a')](_0x6c90('0x13e'),FILES_PATH,rs[_0x6c90('0x11f')](0x4));var _0x636244=util['format'](_0x6c90('0xa2'),_0x40e352,_0x2aba59);var _0x300fa4=!![];if(_0x65f9c3[_0x6c90('0x134')]===_0x6c90('0x135')){_0x300fa4=![];}var _0x52d691=this[_0x6c90('0xe')][_0x6c90('0x136')](_0x40e352,_0x2aba59,_0x65f9c3['intKey'],_0x65f9c3[_0x6c90('0x6c')],undefined,_0x300fa4);if(_0x52d691[_0x6c90('0xa9')]!==-0x1){this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0x13f'),_0x636244));var _0xf3ace0=this[_0x6c90('0x94')][_0x6c90('0xac')](this,_0x65f9c3,_0x636244);if(_0xf3ace0){for(var _0x137f0e in _0xf3ace0){if(_0xf3ace0[_0x6c90('0x99')](_0x137f0e)){this[_0x6c90('0xe')][_0x6c90('0xa4')](util[_0x6c90('0x2a')](_0x6c90('0x140'),_0x137f0e[_0x6c90('0x70')]()),_0xf3ace0[_0x137f0e]);}}return this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0xf3ace0)));}}return _0x52d691;};AGIVertices[_0x6c90('0x11')][_0x6c90('0x141')]=function(_0x2cb941){logger[_0x6c90('0x2e')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x2cb941[_0x6c90('0x3a')]));return this[_0x6c90('0xe')][_0x6c90('0x142')](_0x2cb941[_0x6c90('0x3f')],_0x2cb941['extension'],_0x2cb941['priority']);};AGIVertices[_0x6c90('0x11')][_0x6c90('0x143')]=function(_0x331b4c){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x144'),_0x331b4c['label']));if(!this[_0x6c90('0x8a')](_0x331b4c['condition'])){return this[_0x6c90('0xe')]['error'](_0x331b4c,'no\x20condition\x20configured');}try{var _0x3dfd6f=eval(_0x331b4c[_0x6c90('0x145')])?'true':_0x6c90('0x146');this[_0x6c90('0xe')][_0x6c90('0xb3')](util['format'](_0x6c90('0x147'),_0x331b4c[_0x6c90('0x145')],_0x3dfd6f));return{'code':0xc8,'result':_0x3dfd6f};}catch(_0x29f4aa){return{'code':0xc8,'result':_0x6c90('0x146')};}};AGIVertices[_0x6c90('0x11')][_0x6c90('0x148')]=function(_0x4268d7){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x149'),_0x4268d7['label']));if(!this['isConfigured'](_0x4268d7[_0x6c90('0x14a')])){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x4268d7,_0x6c90('0x14b'));}var _0x1a6ed5=this[_0x6c90('0x25')][_0x6c90('0xac')](this,_0x4268d7[_0x6c90('0x14a')]);if(!_0x1a6ed5){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x4268d7,_0x6c90('0x14c'));}for(var _0x93173d=0x0;_0x93173d<_0x1a6ed5[_0x6c90('0xa3')];_0x93173d+=0x1){var _0x40fb26=this[_0x6c90('0xe')][_0x6c90('0x12')](util[_0x6c90('0x2a')](_0x6c90('0x14d'),_0x1a6ed5[_0x93173d]));if(_0x40fb26[_0x6c90('0xa9')]===-0x1){return _0x40fb26;}logger['info'](util[_0x6c90('0x2a')](_0x6c90('0x14e'),_0x1a6ed5[_0x93173d],_0x40fb26['extra']));if(_0x40fb26[_0x6c90('0xa7')]==='true'){logger['info'](util[_0x6c90('0x2a')]('IFTIME\x20%s\x20%s',_0x1a6ed5[_0x93173d],_0x6c90('0x14f')));this[_0x6c90('0xe')]['noop'](util[_0x6c90('0x2a')](_0x6c90('0x14e'),_0x1a6ed5[_0x93173d],_0x6c90('0x14f')));return{'code':0xc8,'result':_0x6c90('0x14f')};}else{logger['info'](util[_0x6c90('0x2a')](_0x6c90('0x14e'),_0x1a6ed5[_0x93173d],_0x6c90('0x146')));this['channel'][_0x6c90('0xb3')](util[_0x6c90('0x2a')]('IFTIME\x20%s\x20%s',_0x1a6ed5[_0x93173d],_0x6c90('0x146')));}}return{'code':0xc8,'result':_0x6c90('0x146')};};AGIVertices[_0x6c90('0x11')]['hangup']=function(_0x4791e9){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x150'),_0x4791e9['label']));return this['channel']['hangup']();};AGIVertices[_0x6c90('0x11')]['ispeechasr']=function(_0x1b0ad0){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x151'),_0x1b0ad0['label']));if(!this['isConfigured'](_0x1b0ad0[_0x6c90('0x81')])){return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0xec'));}var _0x3afbc7='wav';var _0x145873=util[_0x6c90('0x2a')](_0x6c90('0x13e'),FILES_PATH,rs['generate'](0x4));var _0x33056e=util[_0x6c90('0x2a')]('%s.%s',_0x145873,_0x3afbc7);var _0x46f2e1=!![];if(_0x1b0ad0[_0x6c90('0x134')]===_0x6c90('0x135')){_0x46f2e1=![];}var _0x529b26=this[_0x6c90('0xe')]['recordFile'](_0x145873,_0x3afbc7,_0x1b0ad0[_0x6c90('0x137')],_0x1b0ad0['timeout'],undefined,_0x46f2e1);if(_0x529b26[_0x6c90('0xa9')]!==-0x1){this[_0x6c90('0xe')][_0x6c90('0xb3')](util['format'](_0x6c90('0x152'),_0x33056e));var _0x3ba13f=this[_0x6c90('0x88')]['sync'](this,_0x1b0ad0,_0x33056e);if(_0x3ba13f){for(var _0x77a7f in _0x3ba13f){if(_0x3ba13f[_0x6c90('0x99')](_0x77a7f)){this[_0x6c90('0xe')][_0x6c90('0xa4')](util[_0x6c90('0x2a')](_0x6c90('0x153'),_0x77a7f[_0x6c90('0x70')]()),_0x3ba13f[_0x77a7f]);}}return this['channel'][_0x6c90('0xb3')](util[_0x6c90('0x2a')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x3ba13f)));}}return _0x529b26;};AGIVertices['prototype'][_0x6c90('0x154')]=function(_0x100b57){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x155'),_0x100b57[_0x6c90('0x3a')]));if(!this[_0x6c90('0x8a')](_0x100b57[_0x6c90('0x81')])){return this[_0x6c90('0xe')]['noop'](_0x6c90('0xec'));}if(!this[_0x6c90('0x8a')](_0x100b57[_0x6c90('0x63')])){return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0xb0'));}this[_0x6c90('0xe')][_0x6c90('0xb3')](util['format'](_0x6c90('0x156'),_0x100b57[_0x6c90('0x63')]));var _0x29e413=this['ispeechTTS'][_0x6c90('0xac')](this,_0x100b57);if(_0x29e413){this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0x152'),_0x29e413));var _0x3d4814=this[_0x6c90('0xe')]['streamFile'](_0x29e413,_0x100b57[_0x6c90('0x137')]);try{fs[_0x6c90('0x10a')](_0x29e413+'.wav');}catch(_0x2ef01c){logger[_0x6c90('0x33')](_0x2ef01c);}return _0x3d4814;}return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x100b57,_0x6c90('0x157'));};AGIVertices['prototype'][_0x6c90('0x158')]=function(_0x2f719f){logger[_0x6c90('0x2e')](util['format'](_0x6c90('0x159'),_0x2f719f['label']));if(!this['isConfigured'](_0x2f719f[_0x6c90('0x15a')])){return this['channel'][_0x6c90('0x33')](_0x2f719f,_0x6c90('0x15b'));}logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x15c'),this[_0x6c90('0xe')][_0x6c90('0x3d')],_0x2f719f[_0x6c90('0x15a')]));var _0x384b55=this['agentLogin'][_0x6c90('0xac')](this,_0x2f719f['findBy']);if(_0x384b55){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x15d'),this['channel'][_0x6c90('0x3d')],_0x2f719f[_0x6c90('0x15a')]));this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0x15d'),this[_0x6c90('0xe')]['callerid'],_0x2f719f['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x15e'),this[_0x6c90('0xe')][_0x6c90('0x3d')],_0x2f719f['findBy']));this['channel']['noop'](util[_0x6c90('0x2a')](_0x6c90('0x15e'),this[_0x6c90('0xe')][_0x6c90('0x3d')],_0x2f719f[_0x6c90('0x15a')]));return{'code':0xc8,'result':_0x6c90('0x15f')};}};AGIVertices['prototype'][_0x6c90('0x160')]=function(_0x108d5b){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x108d5b['label']));if(!this[_0x6c90('0x8a')](_0x108d5b['findBy'])){return this['channel']['error'](_0x108d5b,_0x6c90('0x15b'));}logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x15c'),this['channel'][_0x6c90('0x3d')],_0x108d5b['findBy']));var _0x2bbdc9=this['agentLogout']['sync'](this,_0x108d5b[_0x6c90('0x15a')]);if(_0x2bbdc9){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x15d'),this[_0x6c90('0xe')][_0x6c90('0x3d')],_0x108d5b[_0x6c90('0x15a')]));this['channel'][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0x15d'),this[_0x6c90('0xe')][_0x6c90('0x3d')],_0x108d5b['findBy']));return{'code':0xc8,'result':_0x6c90('0x161')};}else{logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x15e'),this[_0x6c90('0xe')][_0x6c90('0x3d')],_0x108d5b[_0x6c90('0x15a')]));this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6c90('0xe')][_0x6c90('0x3d')],_0x108d5b[_0x6c90('0x15a')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x6c90('0x11')][_0x6c90('0x162')]=function(_0x1ec8be){logger[_0x6c90('0x2e')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x1ec8be[_0x6c90('0x3a')]));if(!this['isConfigured'](_0x1ec8be[_0x6c90('0x163')])){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x1ec8be,_0x6c90('0x164'));}this[_0x6c90('0xe')][_0x6c90('0xb3')](util['format']('math\x20%s',_0x1ec8be[_0x6c90('0x163')]));var _0x3d25e1=eval(_0x1ec8be[_0x6c90('0x163')]);if(!this[_0x6c90('0x8a')](_0x1ec8be['variable_id'])){return this['channel'][_0x6c90('0xb3')](_0x6c90('0xe0'));}var _0x22dc13=this['getVariable'][_0x6c90('0xac')](this,_0x1ec8be[_0x6c90('0xdf')]);if(!_0x22dc13){return this[_0x6c90('0xe')]['error'](_0x1ec8be,_0x6c90('0x11d'));}if(_[_0x6c90('0x9f')](_0x3d25e1)){var _0x2de8e0=this;_0x3d25e1[_0x6c90('0xe1')](function(_0x20462e,_0x5cc6ee){_0x2de8e0[_0x6c90('0xe')]['setVariable'](util[_0x6c90('0x2a')](_0x6c90('0x165'),_0x22dc13,_0x5cc6ee),_0x20462e);});return this[_0x6c90('0xe')]['noop'](util[_0x6c90('0x2a')](_0x6c90('0x166'),_0x22dc13));}else{return this[_0x6c90('0xe')]['setVariable'](_0x22dc13,_0x3d25e1);}};AGIVertices[_0x6c90('0x11')][_0x6c90('0x167')]=function(_0x945f1c){logger['info'](util[_0x6c90('0x2a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x945f1c[_0x6c90('0x3a')]));if(_0x945f1c[_0x6c90('0xad')]===0x0){return this['maxRetry'](_0x945f1c);}_0x945f1c[_0x6c90('0xad')]-=0x1;if(!this[_0x6c90('0x8a')](_0x945f1c[_0x6c90('0x117')])){return this['channel'][_0x6c90('0x33')](_0x945f1c,_0x6c90('0x168'));}var _0x2ce01d=this[_0x6c90('0x1e')][_0x6c90('0xac')](this,_0x945f1c[_0x6c90('0x117')]);if(!_0x2ce01d){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x945f1c,_0x6c90('0x169'));}var _0x26c6da=this[_0x6c90('0xe')]['getData'](_0x2ce01d,_0x945f1c[_0x6c90('0x119')],_0x945f1c[_0x6c90('0x16a')]);var _0x342d2a=_0x26c6da['result'];if(_0x26c6da[_0x6c90('0xa9')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x945f1c,'-1');return _0x26c6da;}else if(_0x26c6da[_0x6c90('0xa7')]===_0x6c90('0x6c')){_0x26c6da['result']=_0x26c6da['result'][_0x6c90('0xa3')]>0x0?_0x26c6da[_0x6c90('0xa9')]:'t';}else if(_['isEmpty'](_0x26c6da[_0x6c90('0xa9')])){_0x26c6da[_0x6c90('0xa9')]='#';_0x342d2a='#';}if(!this[_0x6c90('0x8a')](_0x945f1c[_0x6c90('0xdf')])){this['channel']['noop'](_0x6c90('0xe0'));}else{var _0x217725=this[_0x6c90('0x12')][_0x6c90('0xac')](this,_0x945f1c[_0x6c90('0xdf')]);if(!_0x217725){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x945f1c,_0x6c90('0x11d'));}this[_0x6c90('0xe')][_0x6c90('0xa4')](_0x217725,_0x342d2a);}this[_0x6c90('0x38')][_0x6c90('0xac')](this,_0x945f1c,_0x342d2a);return _0x26c6da;};AGIVertices['prototype'][_0x6c90('0xb3')]=function(_0x34023b){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x34023b[_0x6c90('0x3a')]));return this['channel']['noop'](_0x34023b[_0x6c90('0x16b')]||_0x34023b[_0x6c90('0x3a')]);};AGIVertices[_0x6c90('0x11')][_0x6c90('0x16c')]=function(_0x350ae2){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x16d'),_0x350ae2[_0x6c90('0x3a')]));if(!this['isConfigured'](_0x350ae2[_0x6c90('0x15a')])){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x350ae2,_0x6c90('0x15b'));}logger[_0x6c90('0x2e')](util['format'](_0x6c90('0x15c'),this[_0x6c90('0xe')][_0x6c90('0x3d')],_0x350ae2[_0x6c90('0x15a')]));var _0x3404f3=this[_0x6c90('0x56')][_0x6c90('0xac')](this,_0x350ae2[_0x6c90('0x16e')]);var _0x422b0e=this['agentPause'][_0x6c90('0xac')](this,_0x350ae2['findBy'],_0x3404f3);if(_0x422b0e){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x15d'),this['channel'][_0x6c90('0x3d')],_0x350ae2['findBy']));this['channel']['noop'](util[_0x6c90('0x2a')](_0x6c90('0x15d'),this[_0x6c90('0xe')][_0x6c90('0x3d')],_0x350ae2['findBy']));return{'code':0xc8,'result':_0x6c90('0x161')};}else{logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x15e'),this[_0x6c90('0xe')][_0x6c90('0x3d')],_0x350ae2[_0x6c90('0x15a')]));this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x350ae2[_0x6c90('0x15a')]));return{'code':0xc8,'result':_0x6c90('0x15f')};}};AGIVertices[_0x6c90('0x11')]['playback']=function(_0x40d2df){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x16f'),_0x40d2df['label']));if(!this['isConfigured'](_0x40d2df[_0x6c90('0x117')])){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x40d2df,_0x6c90('0x168'));}var _0x364b5e=this[_0x6c90('0x1e')][_0x6c90('0xac')](this,_0x40d2df[_0x6c90('0x117')]);if(!_0x364b5e){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x40d2df,_0x6c90('0x169'));}var _0x582e0c=this[_0x6c90('0xe')][_0x6c90('0xb1')](_0x6c90('0x170'),[_0x364b5e,_0x40d2df[_0x6c90('0xea')]]);if(_0x582e0c['result']===-0x1){return _0x582e0c;}return this[_0x6c90('0xe')]['noop'](util[_0x6c90('0x2a')](_0x6c90('0xcd'),_0x6c90('0x170'),_0x364b5e));};AGIVertices['prototype'][_0x6c90('0x171')]=function(_0x14c770){logger['info'](util[_0x6c90('0x2a')](_0x6c90('0x172'),_0x14c770[_0x6c90('0x3a')]));if(!this['isConfigured'](_0x14c770['queue_id'])){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x14c770,_0x6c90('0x173'));}var _0x2a397c='';var _0x7a14e5=parseInt(_0x14c770[_0x6c90('0x174')],0xa);if(isNaN(_0x7a14e5)){_0x2a397c=_0x14c770[_0x6c90('0x174')];}else{_0x2a397c=this[_0x6c90('0x16')][_0x6c90('0xac')](this,_0x14c770[_0x6c90('0x174')]);if(!_0x2a397c){return this['channel'][_0x6c90('0x33')](_0x14c770,'no\x20queue\x20found');}}var _0xf91301='';if(this['isConfigured'](_0x14c770[_0x6c90('0x117')])){var _0x498e2f=this[_0x6c90('0x1e')][_0x6c90('0xac')](this,_0x14c770[_0x6c90('0x117')]);if(_0x498e2f){_0xf91301=_0x498e2f;}}this['createSquareDetailsReport']['sync'](this,_0x14c770,_0x2a397c);if(_0x14c770['opts'][_0x6c90('0x175')]('x')<0x0){_0x14c770[_0x6c90('0xea')]+='x';}if(_0x14c770[_0x6c90('0xea')][_0x6c90('0x175')]('X')<0x0){_0x14c770[_0x6c90('0xea')]+='X';}this[_0x6c90('0xe')][_0x6c90('0xa4')](_0x6c90('0x176'),_0x2a397c?_0x2a397c[_0x6c90('0x177')]():'');var _0xcba344=this['channel'][_0x6c90('0xb1')](_0x6c90('0x178'),[_0x2a397c,_0x14c770[_0x6c90('0xea')],_0x14c770[_0x6c90('0x6a')],_0xf91301,_0x14c770[_0x6c90('0x6c')],_0x14c770['agi'],_0x14c770[_0x6c90('0x179')],_0x14c770[_0x6c90('0x17a')],'',_0x14c770[_0x6c90('0x17b')]]);if(_0xcba344[_0x6c90('0xa9')]===-0x1){return _0xcba344;}return this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')]('Executed\x20command\x20%s\x20%s',_0x6c90('0x178'),_0x2a397c));};AGIVertices['prototype']['record']=function(_0x114c61){logger['info'](util[_0x6c90('0x2a')](_0x6c90('0x17c'),_0x114c61[_0x6c90('0x3a')]));var _0x118700=_0x114c61[_0x6c90('0x17d')]||'wav';var _0x1206af=util[_0x6c90('0x2a')]('%s_%s',this[_0x6c90('0xe')][_0x6c90('0x39')],rs['generate'](0x5));var _0x3036ef=util[_0x6c90('0x2a')](_0x6c90('0x17e'),FILES_PATH,_0x1206af,_0x118700);var _0x272f83=util[_0x6c90('0x2a')](_0x6c90('0x13e'),FILES_PATH,_0x1206af);this[_0x6c90('0x17f')]['sync'](this,_0x114c61,_0x1206af,_0x3036ef);this[_0x6c90('0xe')]['setVariable']('RECORDING_SAVENAME',_0x1206af);logger[_0x6c90('0x2e')](_0x6c90('0x180'),_0x272f83,_0x118700,_0x114c61['escape_digits'],_0x114c61['timeout']);return this[_0x6c90('0xe')][_0x6c90('0x136')](_0x272f83,_0x118700,_0x114c61[_0x6c90('0x181')],_0x114c61[_0x6c90('0x6c')],undefined,!![]);};AGIVertices[_0x6c90('0x11')][_0x6c90('0x182')]=function(_0x4c6dc1){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x183'),_0x4c6dc1['label']));if(!this[_0x6c90('0x8a')](_0x4c6dc1[_0x6c90('0x6a')])){return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0x184'));}var _0x97b2cf=this['restAPI']['sync'](this,_0x4c6dc1);logger[_0x6c90('0x2e')](util['format'](_0x6c90('0x185'),util[_0x6c90('0x186')](_0x97b2cf,{'showHidden':![],'depth':null})));if(!this[_0x6c90('0x8a')](_0x4c6dc1[_0x6c90('0xdf')])){return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0x187'));}var _0x562237=this[_0x6c90('0x12')][_0x6c90('0xac')](this,_0x4c6dc1[_0x6c90('0xdf')]);if(!_0x562237){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x4c6dc1,_0x6c90('0x11d'));}this[_0x6c90('0xe')][_0x6c90('0xa4')](util[_0x6c90('0x2a')]('%s_STATUS_CODE',_0x562237),_0x97b2cf['statusCode']?_0x97b2cf['statusCode']:_0x6c90('0x188'));this[_0x6c90('0xe')][_0x6c90('0xa4')](util['format'](_0x6c90('0x189'),_0x562237),_0x97b2cf[_0x6c90('0x7c')]?_0x97b2cf[_0x6c90('0x7c')]:'OK');if(_0x97b2cf[_0x6c90('0x79')]){try{this['saveRestApiResult'](_0x97b2cf[_0x6c90('0x79')],_0x562237);}catch(_0x4d30b8){logger['error'](util['format'](_0x6c90('0x18a'),_0x562237));}}return this['channel']['noop'](util['format']('variable\x20%s\x20set',_0x562237));};AGIVertices[_0x6c90('0x11')][_0x6c90('0x18b')]=function(_0x38d80c){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x18c'),_0x38d80c['label']));return this[_0x6c90('0xe')][_0x6c90('0x18d')](_0x38d80c[_0x6c90('0x18e')][_0x6c90('0xde')](/\s+/g,''),_0x38d80c[_0x6c90('0x181')]);};AGIVertices[_0x6c90('0x11')][_0x6c90('0x18f')]=function(_0x34a541){logger[_0x6c90('0x2e')](util['format'](_0x6c90('0x190'),_0x34a541[_0x6c90('0x3a')]));return this['channel'][_0x6c90('0x191')](_0x34a541[_0x6c90('0x192')][_0x6c90('0xde')](/\s+/g,''),_0x34a541[_0x6c90('0x181')]);};AGIVertices[_0x6c90('0x11')][_0x6c90('0x193')]=function(_0x377d6e){logger['info'](util['format'](_0x6c90('0x194'),_0x377d6e[_0x6c90('0x3a')]));return this[_0x6c90('0xe')][_0x6c90('0x195')](_0x377d6e[_0x6c90('0x63')],_0x377d6e[_0x6c90('0x181')]);};AGIVertices[_0x6c90('0x11')][_0x6c90('0x196')]=function(_0x134a33){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x134a33[_0x6c90('0x3a')]));if(!this[_0x6c90('0x8a')](_0x134a33[_0x6c90('0x197')])){return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0x198'));}var _0x45e53b=this[_0x6c90('0x22')]['sync'](this,_0x134a33[_0x6c90('0x197')]);if(!_0x45e53b||!_0x45e53b['Smtp']){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x134a33,'no\x20mail\x20account\x20found');}var _0x1375b2={'from':util[_0x6c90('0x2a')](_0x6c90('0x199'),_0x45e53b[_0x6c90('0x14')],_0x45e53b['email']||_0x45e53b[_0x6c90('0x19a')][_0x6c90('0x19b')]),'to':_0x134a33['to']||'','cc':_0x134a33['cc']||'','bcc':_0x134a33[_0x6c90('0x19c')]||'','subject':_0x134a33[_0x6c90('0x19d')],'html':_0x134a33[_0x6c90('0x63')],'text':_0x134a33['text']};var _0x519798={'tls':{'rejectUnauthorized':![]}};if(_0x45e53b[_0x6c90('0x19a')]['service']){_0x519798[_0x6c90('0x19e')]=_0x45e53b[_0x6c90('0x19a')][_0x6c90('0x19e')];}else{_0x519798['host']=_0x45e53b['Smtp']['host'];_0x519798[_0x6c90('0x19f')]=_0x45e53b['Smtp'][_0x6c90('0x19f')];_0x519798[_0x6c90('0x1a0')]=_0x45e53b['Smtp'][_0x6c90('0x1a0')];}if(_0x45e53b[_0x6c90('0x19a')][_0x6c90('0x1a1')]){_0x519798['auth']={'user':_0x45e53b[_0x6c90('0x19a')][_0x6c90('0x19b')],'pass':_0x45e53b[_0x6c90('0x19a')][_0x6c90('0x1a2')]};}if(this['isConfigured'](_0x134a33[_0x6c90('0x1a3')])){}logger['debug'](_0x6c90('0x1a4'),JSON[_0x6c90('0x7a')](_0x1375b2));this[_0x6c90('0x38')][_0x6c90('0xac')](this,_0x134a33,_0x134a33[_0x6c90('0x197')]);this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0x1a5'),_0x45e53b[_0x6c90('0x14')]));this[_0x6c90('0x24')]['sync'](this,_0x519798,_0x1375b2);return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0x1a6'));};AGIVertices['prototype'][_0x6c90('0x1a7')]=function(_0x2baef7){logger['info'](util[_0x6c90('0x2a')](_0x6c90('0x1a8'),_0x2baef7['label']));return this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0x1a9'));};AGIVertices[_0x6c90('0x11')]['sendSMS']=function(_0x2f88d8){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x2f88d8[_0x6c90('0x3a')]));if(!this[_0x6c90('0x8a')](_0x2f88d8[_0x6c90('0x1aa')])){return this['channel'][_0x6c90('0xb3')](_0x6c90('0x1ab'));}var _0x4662cc=this[_0x6c90('0x35')]['sync'](this,_0x2f88d8[_0x6c90('0x1aa')]);if(!_0x4662cc){return this['channel'][_0x6c90('0x33')](_0x2f88d8,_0x6c90('0x1ac'));}var _0x386048={'body':_0x2f88d8['sms_text'],'phone':_0x2f88d8['to']||'','SmsAccountId':_0x4662cc['id']};logger[_0x6c90('0x1ad')](_0x6c90('0x1ae'),JSON[_0x6c90('0x7a')](_0x386048));this[_0x6c90('0x38')][_0x6c90('0xac')](this,_0x2f88d8,_0x2f88d8[_0x6c90('0x1aa')]);this[_0x6c90('0xe')][_0x6c90('0xb3')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x4662cc['name']));this[_0x6c90('0x37')][_0x6c90('0xac')](this,_0x386048);return this[_0x6c90('0xe')]['noop'](_0x6c90('0x1af'));};AGIVertices[_0x6c90('0x11')][_0x6c90('0x1b0')]=function(_0x44f7a8){logger['info'](util[_0x6c90('0x2a')](_0x6c90('0x1b1'),_0x44f7a8[_0x6c90('0x3a')]));if(!this['isConfigured'](_0x44f7a8[_0x6c90('0xdf')])){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x44f7a8,'no\x20variable\x20selected');}var _0x40a1cf=this[_0x6c90('0x12')][_0x6c90('0xac')](this,_0x44f7a8['variable_id']);if(!_0x40a1cf){return this[_0x6c90('0xe')]['error'](_0x44f7a8,_0x6c90('0x11d'));}return this[_0x6c90('0xe')][_0x6c90('0xa4')](_0x40a1cf,_0x44f7a8['variable_value']);};AGIVertices['prototype']['start']=function(_0xa6cdba){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x1b2'),_0xa6cdba[_0x6c90('0x3a')]));this[_0x6c90('0xe')]['noop'](_0x6c90('0x1b3'));if(_0xa6cdba['answer']===_0x6c90('0x1b4')){this[_0x6c90('0xe')][_0x6c90('0xb3')](_0x6c90('0x1b5'));return this[_0x6c90('0xe')]['answer']();}return this['channel'][_0x6c90('0xb3')](_0x6c90('0x1b6'));};AGIVertices[_0x6c90('0x11')][_0x6c90('0x1b7')]=function(_0x5bd739){logger[_0x6c90('0x2e')](util['format'](_0x6c90('0x1b8'),_0x5bd739[_0x6c90('0x3a')]));if(!this[_0x6c90('0x8a')](_0x5bd739[_0x6c90('0x1b9')])){return this['channel'][_0x6c90('0x33')](_0x5bd739,_0x6c90('0x1ba'));}var _0x2d4874=this[_0x6c90('0x1bb')][_0x6c90('0xac')](this,_0x5bd739['project_id']);if(!this[_0x6c90('0x8a')](_0x2d4874)){return this['channel']['error'](_0x5bd739,util[_0x6c90('0x2a')](_0x6c90('0x1bc'),_0x5bd739[_0x6c90('0x1b9')]));}if(_0x2d4874===this[_0x6c90('0xe')]['arg_1']){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x5bd739,_0x6c90('0x1bd'));}this['createSquareDetailsReport'][_0x6c90('0xac')](this,_0x5bd739,_0x2d4874);var _0x4eac06=this[_0x6c90('0xe')][_0x6c90('0xb1')]('AGI',util[_0x6c90('0x2a')](_0x6c90('0x1be'),config[_0x6c90('0x8')][_0x6c90('0x1bf')]||_0x6c90('0x1c0'),_0x2d4874,this[_0x6c90('0xe')][_0x6c90('0x3c')]));if(_0x4eac06['result']===-0x1){return _0x4eac06;}return this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0xcd'),_0x6c90('0x1c1'),_0x2d4874));};AGIVertices[_0x6c90('0x11')][_0x6c90('0x1c2')]=function(_0x4105f2){logger['info'](util[_0x6c90('0x2a')](_0x6c90('0x1c3'),_0x4105f2[_0x6c90('0x3a')]));var _0x32d66b=this['shellCommand'][_0x6c90('0xac')](this,_0x4105f2[_0x6c90('0xc1')]);this[_0x6c90('0x38')]['sync'](this,_0x4105f2,_0x4105f2['command']);if(this[_0x6c90('0x8a')](_0x4105f2[_0x6c90('0xdf')])){var _0x1dc680=this[_0x6c90('0x12')][_0x6c90('0xac')](this,_0x4105f2[_0x6c90('0xdf')]);if(_0x1dc680){this[_0x6c90('0xe')][_0x6c90('0xa4')](_0x1dc680,_0x32d66b);return this['channel'][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0x1c4'),_0x4105f2[_0x6c90('0xc1')],_0x1dc680));}}return this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0x1c5'),_0x4105f2['command']));};AGIVertices[_0x6c90('0x11')]['google_cloud_tts']=function(_0x2fefc4){logger['info'](util['format'](_0x6c90('0x1c6'),_0x2fefc4[_0x6c90('0x3a')]));_0x2fefc4[_0x6c90('0x63')]=_0x2fefc4[_0x6c90('0x63')][_0x6c90('0xde')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6c90('0x8a')](_0x2fefc4['apiKey'])){return this['channel'][_0x6c90('0xb3')]('no\x20apiKey\x20configured');}if(!this[_0x6c90('0x8a')](_0x2fefc4[_0x6c90('0x63')])){return this['channel'][_0x6c90('0xb3')](_0x6c90('0xb0'));}this['channel']['noop'](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x2fefc4['text']));var _0x13d799=this['googleCloudTTS'][_0x6c90('0xac')](this,_0x2fefc4);if(_0x13d799){this[_0x6c90('0xe')]['noop'](util[_0x6c90('0x2a')](_0x6c90('0x1c7'),_0x13d799));var _0x46969b=this['channel'][_0x6c90('0x109')](_0x13d799);try{fs[_0x6c90('0x10a')](_0x13d799+_0x6c90('0x10b'));}catch(_0x2a83d2){logger[_0x6c90('0x33')](_0x2a83d2);}return _0x46969b;}return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x2fefc4,_0x6c90('0x1c8'));};AGIVertices[_0x6c90('0x11')]['tts']=function(_0x1f3c63){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x1f3c63[_0x6c90('0x3a')]));_0x1f3c63[_0x6c90('0x63')]=_0x1f3c63[_0x6c90('0x63')][_0x6c90('0xde')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6c90('0x8a')](_0x1f3c63[_0x6c90('0x63')])){return this[_0x6c90('0xe')][_0x6c90('0xb3')]('no\x20text\x20configured');}this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0x1c9'),_0x1f3c63[_0x6c90('0x63')]));var _0x4f0ffb=this['googleTTS'][_0x6c90('0xac')](this,_0x1f3c63);if(_0x4f0ffb){this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0x1ca'),_0x4f0ffb));var _0x9cd01d=this[_0x6c90('0xe')][_0x6c90('0x109')](_0x4f0ffb);try{fs[_0x6c90('0x10a')](_0x4f0ffb+_0x6c90('0x10b'));}catch(_0x12f2b4){logger['error'](_0x12f2b4);}return _0x9cd01d;}return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x1f3c63,_0x6c90('0x1cb'));};AGIVertices['prototype']['unpause']=function(_0x57dc18){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x1cc'),_0x57dc18['label']));if(!this['isConfigured'](_0x57dc18[_0x6c90('0x15a')])){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0x57dc18,_0x6c90('0x15b'));}logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x15c'),this['channel'][_0x6c90('0x3d')],_0x57dc18[_0x6c90('0x15a')]));var _0x4c3a71=this[_0x6c90('0x5a')][_0x6c90('0xac')](this,_0x57dc18[_0x6c90('0x15a')]);if(_0x4c3a71){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x15d'),this[_0x6c90('0xe')][_0x6c90('0x3d')],_0x57dc18[_0x6c90('0x15a')]));this[_0x6c90('0xe')][_0x6c90('0xb3')](util['format'](_0x6c90('0x15d'),this[_0x6c90('0xe')][_0x6c90('0x3d')],_0x57dc18[_0x6c90('0x15a')]));return{'code':0xc8,'result':_0x6c90('0x161')};}else{logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x15e'),this[_0x6c90('0xe')][_0x6c90('0x3d')],_0x57dc18[_0x6c90('0x15a')]));this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0x15e'),this[_0x6c90('0xe')][_0x6c90('0x3d')],_0x57dc18['findBy']));return{'code':0xc8,'result':_0x6c90('0x15f')};}};AGIVertices[_0x6c90('0x11')][_0x6c90('0x1cd')]=function(_0x4b69b1){logger['info'](util[_0x6c90('0x2a')](_0x6c90('0x1ce'),_0x4b69b1[_0x6c90('0x3a')]));var _0x4345f0=this[_0x6c90('0xe')][_0x6c90('0xb1')](_0x6c90('0x1cf'),[_0x4b69b1[_0x6c90('0x1d0')],_0x4b69b1[_0x6c90('0x7f')]]);if(_0x4345f0['result']===-0x1){return _0x4345f0;}return this[_0x6c90('0xe')][_0x6c90('0xb3')](util[_0x6c90('0x2a')](_0x6c90('0xcd'),_0x6c90('0x1cf'),_0x4b69b1[_0x6c90('0x1d0')]));};AGIVertices[_0x6c90('0x11')][_0x6c90('0x1d1')]=function(_0xeee9d5){logger[_0x6c90('0x2e')](util[_0x6c90('0x2a')](_0x6c90('0x1d2'),_0xeee9d5[_0x6c90('0x3a')]));if(!this['isConfigured'](_0xeee9d5['variable_id'])){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0xeee9d5,'no\x20variable\x20selected');}var _0x11a0d4=this['getVariable']['sync'](this,_0xeee9d5[_0x6c90('0xdf')]);if(!_0x11a0d4){return this[_0x6c90('0xe')][_0x6c90('0x33')](_0xeee9d5,_0x6c90('0x11d'));}var _0xc94aea=this[_0x6c90('0xe')][_0x6c90('0x12')](_0x11a0d4);return{'code':0xc8,'result':_0xc94aea['extra']?_0xc94aea[_0x6c90('0xa7')]:'-'};};String[_0x6c90('0x11')][_0x6c90('0xa6')]=function(_0x54b3ee,_0x403a36){return this[_0x6c90('0xa5')](_0x54b3ee)[_0x6c90('0x1d3')](_0x403a36);};module[_0x6c90('0x1d4')]=AGIVertices; \ No newline at end of file +var _0xd4d1=['Enter\x20in\x20MRCPRecog\x20(%s)\x20block','label','grammar','noop','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','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','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','SIP/%s','Executed\x20command\x20%s','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','speech','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','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','getSound','getData','response','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20is\x20unreachable','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','no\x20find\x20by\x20configured','findBy','agentLogin','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','operation','math\x20%s','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','opts','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','record','%s_%s','%s/recordings/%s.%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','service','host','port','secure','authentication','auth','pass','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','googleTTS','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','exports','path','util','lodash','shelljs','odbc','moment','request-promise','agi','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawBody','getdigits','rpc','mailRpc','prototype','getVariableById','then','name','catch','getSquareProject','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','has','dialTimezone','phone','timezones','utcOffset','scheduledat','add','minutes','insertContact','getPause','agentPause','agentUnpause','agent','error','agentLogout','internal','%s/%s@from-sip/n','shellCommand','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','google_tts_language','restAPI','method','timeout','number','POST','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','url','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','Amy','aws_text_type','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','includes','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','mrcpsynth','no\x20text\x20configured','exec','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog'];(function(_0x27d9eb,_0x42276c){var _0x360665=function(_0xeddd30){while(--_0xeddd30){_0x27d9eb['push'](_0x27d9eb['shift']());}};_0x360665(++_0x42276c);}(_0xd4d1,0x123));var _0x1d4d=function(_0x18a098,_0x248e70){_0x18a098=_0x18a098-0x0;var _0x292df6=_0xd4d1[_0x18a098];return _0x292df6;};'use strict';var fs=require('fs');var path=require(_0x1d4d('0x0'));var util=require(_0x1d4d('0x1'));var _=require(_0x1d4d('0x2'));var sh=require(_0x1d4d('0x3'));var odbc=require(_0x1d4d('0x4'))();var rs=require('randomstring');var moment=require(_0x1d4d('0x5'));var Mustache=require('mustache');var rp=require(_0x1d4d('0x6'));var logger=require('../../config/logger')(_0x1d4d('0x7'));var config=require('../../config/environment');var shared=require(_0x1d4d('0x8'));var scripts=require(_0x1d4d('0x9'));var FILES_PATH=_0x1d4d('0xa');var recursiveMapAttributes=['rawHeaders',_0x1d4d('0xb')];var verticesWithRetry=['menu',_0x1d4d('0xc'),'getsecretdigits'];var AGIVertices=function(_0x46c8f6,_0x2b72da,_0x324f5b){this['channel']=_0x46c8f6;this[_0x1d4d('0xd')]=_0x2b72da;this[_0x1d4d('0xe')]=_0x324f5b;};AGIVertices[_0x1d4d('0xf')]['getVariable']=function(_0x448c4e,_0x338a05){this[_0x1d4d('0xd')][_0x1d4d('0x10')](_0x448c4e)[_0x1d4d('0x11')](function(_0x9f5623){_0x338a05(null,_0x9f5623?_0x9f5623[_0x1d4d('0x12')]:![]);})[_0x1d4d('0x13')](function(_0x1dc105){_0x338a05(_0x1dc105);});};AGIVertices[_0x1d4d('0xf')]['getVoiceQueue']=function(_0x2941e6,_0x4561e3){this['rpc']['getVoiceQueueById'](_0x2941e6)['then'](function(_0x14a98c){_0x4561e3(null,_0x14a98c?_0x14a98c['name']:![]);})[_0x1d4d('0x13')](function(_0x59de78){_0x4561e3(_0x59de78);});};AGIVertices['prototype'][_0x1d4d('0x14')]=function(_0x9469d3,_0x566807){this[_0x1d4d('0xd')]['getSquareProjectById'](_0x9469d3)[_0x1d4d('0x11')](function(_0x1b591b){_0x566807(null,_0x1b591b?_0x1b591b[_0x1d4d('0x12')]:![]);})[_0x1d4d('0x13')](function(_0x470935){_0x566807(_0x470935);});};AGIVertices['prototype'][_0x1d4d('0x15')]=function(_0x37b6d3,_0x4b43ba){this['rpc'][_0x1d4d('0x16')](_0x37b6d3)[_0x1d4d('0x11')](function(_0x3a2f35){_0x4b43ba(null,_0x3a2f35?_0x3a2f35['dsn']:![]);})['catch'](function(_0x5500e8){_0x4b43ba(_0x5500e8);});};AGIVertices['prototype'][_0x1d4d('0x17')]=function(_0x227278,_0x321e00){this['rpc'][_0x1d4d('0x18')](_0x227278)['then'](function(_0x4b985b){_0x321e00(null,_0x4b985b?_0x4b985b[_0x1d4d('0x12')]:![]);})[_0x1d4d('0x13')](function(_0x544f7a){_0x321e00(_0x544f7a);});};AGIVertices['prototype'][_0x1d4d('0x19')]=function(_0x41b7b2,_0x28f827){this[_0x1d4d('0xd')]['getTrunkById'](_0x41b7b2)[_0x1d4d('0x11')](function(_0x2b1b8b){_0x28f827(null,_0x2b1b8b?_0x2b1b8b[_0x1d4d('0x12')]:![]);})['catch'](function(_0x310ec0){_0x28f827(_0x310ec0);});};AGIVertices['prototype']['getSound']=function(_0x1a0cd3,_0x9cb611){var _0x2e1955=this;this[_0x1d4d('0xd')][_0x1d4d('0x1a')](_0x1a0cd3)['then'](function(_0xc9f05b){_0x9cb611(null,_0xc9f05b?_0x2e1955[_0x1d4d('0x1b')](_0xc9f05b['save_name']):![]);})[_0x1d4d('0x13')](function(_0x30a08d){_0x9cb611(_0x30a08d);});};AGIVertices['prototype'][_0x1d4d('0x1c')]=function(_0x18bb03,_0x89cd09){this[_0x1d4d('0xd')][_0x1d4d('0x1d')](_0x18bb03)[_0x1d4d('0x11')](function(_0x221463){_0x89cd09(null,_0x221463?_0x221463:![]);})['catch'](function(_0x2ba411){_0x89cd09(_0x2ba411);});};AGIVertices[_0x1d4d('0xf')]['sendMailMessage']=function(_0x3b63fd,_0x5b99eb,_0x10338b){this[_0x1d4d('0xe')][_0x1d4d('0x1e')](_0x3b63fd,_0x5b99eb)[_0x1d4d('0x11')](function(){_0x10338b(null);})[_0x1d4d('0x13')](function(_0x1df322){_0x10338b(_0x1df322);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1f')]=function(_0x3cf167,_0x5e81d1){this['rpc'][_0x1d4d('0x20')](_0x3cf167)['then'](function(_0x2765dc){if(_0x2765dc){if(_0x2765dc[_0x1d4d('0x21')]){_0x5e81d1(null,[_0x2765dc[_0x1d4d('0x22')]]);}else{_0x5e81d1(null,_[_0x1d4d('0x23')](_0x2765dc[_0x1d4d('0x24')],_0x1d4d('0x22')));}}else{_0x5e81d1(null,![]);}})[_0x1d4d('0x13')](function(_0x3146a3){_0x5e81d1(_0x3146a3);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1b')]=function(_0x29bfc0){return util[_0x1d4d('0x25')](_0x1d4d('0x26'),FILES_PATH,_0x29bfc0);};AGIVertices['prototype'][_0x1d4d('0x27')]=function(_0x534ac8,_0x1fc1c6,_0xc74357){odbc['open'](_0x534ac8,function(_0x3e24b3){if(_0x3e24b3){logger['error'](_0x1d4d('0x28'),_0x3e24b3);_0xc74357(_0x3e24b3);}else{logger[_0x1d4d('0x29')](_0x1d4d('0x2a'));odbc[_0x1d4d('0x2b')](_0x1fc1c6,function(_0x49fbb6,_0x24cc17){if(_0x49fbb6){logger[_0x1d4d('0x29')]('Error\x20executing\x20query\x20%s',_0x1fc1c6);_0xc74357(_0x49fbb6);}else{logger[_0x1d4d('0x29')](_0x1d4d('0x2c'),_0x1fc1c6);odbc[_0x1d4d('0x2d')](function(_0x422c72){if(_0x422c72){logger['error'](_0x1d4d('0x2e'),_0x422c72);}_0xc74357(null,_0x24cc17);});}});}});};AGIVertices['prototype'][_0x1d4d('0x2f')]=function(_0x1e9434,_0x7b40b0){this['rpc']['getSmsAccountById'](_0x1e9434)[_0x1d4d('0x11')](function(_0x108ded){_0x7b40b0(null,_0x108ded?_0x108ded:![]);})['catch'](function(_0x2eb4c0){_0x7b40b0(_0x2eb4c0);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x30')]=function(_0x2b9c38,_0x438ec7){this[_0x1d4d('0xd')]['createSmsMessage'](_0x2b9c38)[_0x1d4d('0x11')](function(_0x3d3010){_0x438ec7(null,_0x3d3010);})[_0x1d4d('0x13')](function(_0x4c028f){_0x438ec7(_0x4c028f);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x31')]=function(_0x5e171e,_0xf975d6,_0x148bd6){this[_0x1d4d('0xd')][_0x1d4d('0x31')]({'uniqueid':this['channel']['uniqueid'],'node':_0x5e171e['label'],'application':_0x5e171e['agicommand'],'data':_0xf975d6||null,'project_name':this[_0x1d4d('0x32')][_0x1d4d('0x33')],'callerid':this[_0x1d4d('0x32')][_0x1d4d('0x34')]})[_0x1d4d('0x11')](function(_0x34ef4b){if(_0x148bd6){_0x148bd6(null,_0x34ef4b);}})[_0x1d4d('0x13')](function(_0x3c3bc0){if(_0x148bd6){_0x148bd6(_0x3c3bc0);}});};AGIVertices['prototype'][_0x1d4d('0x35')]=function(_0x4700f3,_0x20e064,_0xb5a76f,_0x5e16a1){this[_0x1d4d('0xd')][_0x1d4d('0x35')]({'uniqueid':this[_0x1d4d('0x32')][_0x1d4d('0x36')],'callerid':this[_0x1d4d('0x32')][_0x1d4d('0x34')],'calleridname':this['channel'][_0x1d4d('0x37')],'context':this[_0x1d4d('0x32')][_0x1d4d('0x38')],'extension':this['channel'][_0x1d4d('0x39')],'priority':this['channel']['priority'],'accountcode':this[_0x1d4d('0x32')][_0x1d4d('0x3a')],'dnid':this['channel']['dnid'],'projectName':this[_0x1d4d('0x32')]['arg_1'],'saveName':_0x20e064,'filename':_0x4700f3[_0x1d4d('0x3b')]||_0x20e064,'savePath':_0xb5a76f})[_0x1d4d('0x11')](function(_0x9dd1a5){_0x5e16a1(null,_0x9dd1a5);})[_0x1d4d('0x13')](function(_0x5ae8aa){_0x5e16a1(_0x5ae8aa);});};AGIVertices[_0x1d4d('0xf')]['createSquareMessage']=function(_0x4afb4b,_0x5424a8,_0x41cd94,_0x300df2,_0x11fd27){this[_0x1d4d('0xd')][_0x1d4d('0x3c')]({'uniqueid':this[_0x1d4d('0x32')][_0x1d4d('0x36')],'body':_0x4afb4b,'direction':_0x5424a8,'providerName':_0x41cd94,'providerResponse':_0x300df2})[_0x1d4d('0x11')](function(_0x32b3c4){if(_0x11fd27){_0x11fd27(null,_0x32b3c4);}})[_0x1d4d('0x13')](function(_0x28ea46){if(_0x11fd27){_0x11fd27(_0x28ea46);}});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x3d')]=function(_0x3b84ce,_0x50fd38){var _0x5ed40f=this;var _0x34da01=0x0;var _0x6a0612={'firstName':_[_0x1d4d('0x3e')](_0x3b84ce[_0x1d4d('0x12')])||_[_0x1d4d('0x3f')](_0x3b84ce[_0x1d4d('0x12')])?_0x1d4d('0x40')+Math['random']():_0x3b84ce['name'],'lastName':_[_0x1d4d('0x3e')](_0x3b84ce['lastName'])||_[_0x1d4d('0x3f')](_0x3b84ce[_0x1d4d('0x41')])?null:_0x3b84ce['lastName'],'phone':_0x3b84ce['phone'],'ListId':_0x3b84ce[_0x1d4d('0x42')],'scheduledat':_0x3b84ce[_0x1d4d('0x43')],'callbackUniqueid':this[_0x1d4d('0x32')][_0x1d4d('0x36')],'tags':'callback','description':_0x1d4d('0x44')+_0x3b84ce['scheduledAt'][_0x1d4d('0x45')](),'priority':_0x3b84ce[_0x1d4d('0x46')]};if(_[_0x1d4d('0x47')](_0x3b84ce,_0x1d4d('0x48'))){if(!_[_0x1d4d('0x3f')](_0x3b84ce[_0x1d4d('0x48')])){var _0x4bc657=_0x3b84ce[_0x1d4d('0x48')];if(_0x3b84ce['dialTimezone']=='CALLERID(dialTimezone)'){this[_0x1d4d('0xd')]['getContactByPhone']({'phone':_0x3b84ce[_0x1d4d('0x49')]})[_0x1d4d('0x11')](function(_0x744dd2){if(!_[_0x1d4d('0x3f')](_0x744dd2)){var _0x13dd96=_0x744dd2[_0x1d4d('0x48')];if(!_['isNil'](_0x13dd96)){var _0xc071d9=shared[_0x1d4d('0x4a')][_0x13dd96];if(!_[_0x1d4d('0x3f')](_0xc071d9)){var _0x1e4d91=-0x1*_0xc071d9[_0x1d4d('0x4b')];_0x6a0612[_0x1d4d('0x4c')]=moment(_0x3b84ce['scheduledat'])[_0x1d4d('0x4d')](_0x1e4d91,_0x1d4d('0x4e'));_0x5ed40f[_0x1d4d('0x4f')](_0x6a0612,_0x3b84ce,_0x50fd38);}else{_0x5ed40f[_0x1d4d('0x4f')](_0x6a0612,_0x3b84ce,_0x50fd38);}}else{_0x5ed40f[_0x1d4d('0x4f')](_0x6a0612,_0x3b84ce,_0x50fd38);}}else{_0x5ed40f[_0x1d4d('0x4f')](_0x6a0612,_0x3b84ce,_0x50fd38);}});}else{var _0x34da01=shared[_0x1d4d('0x4a')][_0x4bc657];if(!_['isNil'](_0x34da01)){var _0x1ad0b7=-0x1*_0x34da01[_0x1d4d('0x4b')];_0x6a0612[_0x1d4d('0x4c')]=moment(_0x3b84ce[_0x1d4d('0x4c')])[_0x1d4d('0x4d')](_0x1ad0b7,_0x1d4d('0x4e'));_0x5ed40f['insertContact'](_0x6a0612,_0x3b84ce,_0x50fd38);}else{_0x5ed40f[_0x1d4d('0x4f')](_0x6a0612,_0x3b84ce,_0x50fd38);}}}else{_0x5ed40f[_0x1d4d('0x4f')](_0x6a0612,_0x3b84ce,_0x50fd38);}}else{_0x5ed40f[_0x1d4d('0x4f')](_0x6a0612,_0x3b84ce,_0x50fd38);}};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x50')]=function(_0x29739f,_0x50055d){this[_0x1d4d('0xd')]['getPauseById'](_0x29739f)['then'](function(_0xa1012d){_0x50055d(null,_0xa1012d?_0xa1012d[_0x1d4d('0x12')]:![]);})['catch'](function(_0xc8316a){_0x50055d(_0xc8316a);});};AGIVertices['prototype'][_0x1d4d('0x51')]=function(_0x447e8e,_0x13b0db,_0xba4d55){var _0x5a9cdc={'role':'agent'};_0x5a9cdc[_0x447e8e]=this[_0x1d4d('0x32')][_0x1d4d('0x34')];this[_0x1d4d('0xd')][_0x1d4d('0x51')](_0x5a9cdc,_0x13b0db,this[_0x1d4d('0x32')][_0x1d4d('0x36')])[_0x1d4d('0x11')](function(_0x5593b2){_0xba4d55(null,_['isNil'](_0x5593b2)?![]:!![]);})['catch'](function(_0x469f16){logger['error'](_0x469f16);_0xba4d55(null,![]);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x52')]=function(_0x57a8ad,_0x3776bc){var _0x241546={'role':_0x1d4d('0x53')};_0x241546[_0x57a8ad]=this[_0x1d4d('0x32')]['callerid'];this['rpc']['agentUnpause'](_0x241546)[_0x1d4d('0x11')](function(_0x23d621){_0x3776bc(null,_['isNil'](_0x23d621)?![]:!![]);})[_0x1d4d('0x13')](function(_0x3b1e32){logger[_0x1d4d('0x54')](_0x3b1e32);_0x3776bc(null,![]);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x55')]=function(_0x2f2b6d,_0xc6a7f8){var _0x36bd1e={'role':_0x1d4d('0x53')};_0x36bd1e[_0x2f2b6d]=this[_0x1d4d('0x32')][_0x1d4d('0x34')];this[_0x1d4d('0xd')][_0x1d4d('0x55')](_0x36bd1e)[_0x1d4d('0x11')](function(_0x44a0f8){_0xc6a7f8(null,_[_0x1d4d('0x3f')](_0x44a0f8)?![]:!![]);})[_0x1d4d('0x13')](function(_0x9fd657){logger[_0x1d4d('0x54')](_0x9fd657);_0xc6a7f8(null,![]);});};AGIVertices[_0x1d4d('0xf')]['agentLogin']=function(_0x23dce0,_0x5122f8){var _0x1e0aee={'role':_0x1d4d('0x53')};_0x1e0aee[_0x23dce0]=this[_0x1d4d('0x32')][_0x1d4d('0x34')];var _0x1829ce=_0x23dce0!=_0x1d4d('0x56')?util[_0x1d4d('0x25')](_0x1d4d('0x57'),'LOCAL',this['channel'][_0x1d4d('0x34')]):undefined;this[_0x1d4d('0xd')]['agentLogin'](_0x1e0aee,_0x1829ce)[_0x1d4d('0x11')](function(_0x737b8){_0x5122f8(null,_[_0x1d4d('0x3f')](_0x737b8)?![]:!![]);})[_0x1d4d('0x13')](function(_0xc593ef){logger['error'](_0xc593ef);_0x5122f8(null,![]);});};AGIVertices['prototype'][_0x1d4d('0x58')]=function(_0x384c46,_0x3a1c48){sh['exec'](_['trim'](_0x384c46),function(_0x443cc4,_0x71162){var _0x3a4025=_0x71162[_0x1d4d('0x59')](/(\r\n|\n|\r)/gm,'');_0x3a1c48(null,_0x3a4025);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x4ae1e8,_0x13b20d){scripts[_0x1d4d('0x5a')](_0x4ae1e8['apiKey'],_0x4ae1e8[_0x1d4d('0x5b')]||_0x1d4d('0x5c'),_0x4ae1e8[_0x1d4d('0x5c')],_0x4ae1e8[_0x1d4d('0x5d')]||_0x1d4d('0x5e'),_0x4ae1e8[_0x1d4d('0x5f')]||'MALE',_0x4ae1e8[_0x1d4d('0x60')]||_0x1d4d('0x61'))[_0x1d4d('0x11')](function(_0x58c0b6){_0x13b20d(null,_0x58c0b6);})[_0x1d4d('0x13')](function(_0x56e541){_0x13b20d(_0x56e541);});};AGIVertices[_0x1d4d('0xf')]['googleTTS']=function(_0x564d9e,_0x33c62d){scripts['googleTTS'](_0x564d9e['text'],_0x564d9e[_0x1d4d('0x62')]||'en',0x1)[_0x1d4d('0x11')](function(_0x42f756){_0x33c62d(null,_0x42f756);})[_0x1d4d('0x13')](function(_0x26a98c){_0x33c62d(_0x26a98c);});};AGIVertices['prototype'][_0x1d4d('0x63')]=function(_0x534597,_0x1c1c22){var _0x268b86={'uri':_0x534597['url'],'method':_0x534597[_0x1d4d('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x534597[_0x1d4d('0x65')])===_0x1d4d('0x66')&&parseInt(_0x534597[_0x1d4d('0x65')])>=0x1?parseInt(_0x534597['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x1d4d('0x67'),'PUT'],_0x268b86[_0x1d4d('0x64')]['toUpperCase']())){try{_0x268b86[_0x1d4d('0x68')]=_0x534597[_0x1d4d('0xb')]?JSON[_0x1d4d('0x69')](_0x534597[_0x1d4d('0xb')]):{};}catch(_0x338e5f){logger[_0x1d4d('0x54')](_0x1d4d('0x6a'),_0x338e5f);}}try{_0x268b86[_0x1d4d('0x6b')]=_0x534597[_0x1d4d('0x6c')]?JSON[_0x1d4d('0x69')](_0x534597[_0x1d4d('0x6c')]):{};}catch(_0xce1df0){logger['error'](_0x1d4d('0x6d'),_0xce1df0);}if(_0x534597[_0x1d4d('0x6e')]){try{var _0x414493=require(_0x534597[_0x1d4d('0x6e')])['sync'](this,_0x268b86);_0x268b86[_0x1d4d('0x6f')]=Mustache[_0x1d4d('0x70')](_0x534597[_0x1d4d('0x71')],_0x414493,{},['$$','$$']);if(_0x268b86['headers']){_0x268b86[_0x1d4d('0x6b')]=JSON['parse'](Mustache[_0x1d4d('0x70')](JSON[_0x1d4d('0x72')](_0x268b86[_0x1d4d('0x6b')]),_0x414493,{},['$$','$$']));}if(_0x268b86[_0x1d4d('0x68')]){_0x268b86[_0x1d4d('0x68')]=JSON['parse'](Mustache[_0x1d4d('0x70')](JSON['stringify'](_0x268b86[_0x1d4d('0x68')]),_0x414493,{},['$$','$$']));}}catch(_0x3308e8){logger[_0x1d4d('0x54')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3308e8);}}rp(_0x268b86)[_0x1d4d('0x11')](function(_0x5740e8){var _0x441d07={'statusCode':_0x5740e8[_0x1d4d('0x73')]||0xc8,'statusMessage':_0x5740e8[_0x1d4d('0x74')]||'OK','headers':_0x5740e8[_0x1d4d('0x6b')]||{},'body':_0x5740e8[_0x1d4d('0x68')]||{}};_0x1c1c22(null,_0x441d07);})[_0x1d4d('0x13')](function(_0x59d5e8){var _0x2d26d9={'statusCode':_0x59d5e8[_0x1d4d('0x73')]||0x1f4,'statusMessage':_0x59d5e8[_0x1d4d('0x75')]||_0x1d4d('0x76'),'headers':_0x59d5e8[_0x1d4d('0x77')][_0x1d4d('0x6b')]||{},'body':_0x59d5e8[_0x1d4d('0x77')][_0x1d4d('0x68')]||{}};_0x1c1c22(null,_0x2d26d9);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x78')]=function(_0x193fe4,_0x263664){scripts[_0x1d4d('0x78')](this[_0x1d4d('0x32')][_0x1d4d('0x36')],_0x193fe4['key'],_0x193fe4[_0x1d4d('0x5c')],_0x193fe4[_0x1d4d('0x79')]||'en')['then'](function(_0x3cd114){_0x263664(null,_0x3cd114);})['catch'](function(_0x314b61){_0x263664(_0x314b61);});};AGIVertices[_0x1d4d('0xf')]['googleDialogflowV2']=function(_0x3274d9,_0x151f26){scripts[_0x1d4d('0x7a')](this[_0x1d4d('0x32')][_0x1d4d('0x36')],_0x3274d9['dialogflowV2_project_id'],_0x3274d9[_0x1d4d('0x7b')],_0x3274d9[_0x1d4d('0x7c')],_0x3274d9[_0x1d4d('0x5c')],_0x3274d9[_0x1d4d('0x7d')]||'en')['then'](function(_0x1c1e26){_0x151f26(null,_0x1c1e26);})[_0x1d4d('0x13')](function(_0x1664e6){_0x151f26(_0x1664e6);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x7e')]=function(_0x1aa09f,_0x1ffb9b){scripts['sestekNDA'](this[_0x1d4d('0x32')],_0x1aa09f)[_0x1d4d('0x11')](function(_0x5ec254){_0x1ffb9b(null,_0x5ec254);})[_0x1d4d('0x13')](function(_0x1b7713){_0x1ffb9b(_0x1b7713);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x7f')]=function(_0x183bea,_0x2cf6f7){scripts['ispeechTTS'](_0x183bea[_0x1d4d('0x80')],_0x183bea[_0x1d4d('0x5c')],_0x183bea[_0x1d4d('0x81')]||_0x1d4d('0x5e'),_0x183bea[_0x1d4d('0x82')])[_0x1d4d('0x11')](function(_0x49d726){_0x2cf6f7(null,_0x49d726);})[_0x1d4d('0x13')](function(_0x20a539){_0x2cf6f7(_0x20a539);});};AGIVertices['prototype'][_0x1d4d('0x83')]=function(_0x47f4a0,_0x19b6b6,_0x4b4d63){scripts[_0x1d4d('0x83')](_0x19b6b6,_0x47f4a0[_0x1d4d('0x80')],_0x47f4a0[_0x1d4d('0x84')]||_0x1d4d('0x5e'),this[_0x1d4d('0x85')](_0x47f4a0[_0x1d4d('0x86')])?_0x47f4a0[_0x1d4d('0x86')]:undefined)['then'](function(_0x16e1ec){_0x4b4d63(null,_0x16e1ec);})['catch'](function(_0x56a7cc){_0x4b4d63(_0x56a7cc);});};AGIVertices['prototype'][_0x1d4d('0x87')]=function(_0x22bcf4,_0x42f841){scripts[_0x1d4d('0x87')](_0x22bcf4[_0x1d4d('0x88')],_0x22bcf4['aws_secret_access_key'],_0x22bcf4[_0x1d4d('0x89')],_0x22bcf4['aws_polly_voice']||_0x1d4d('0x8a'),_0x22bcf4['text'],_0x22bcf4[_0x1d4d('0x8b')]||_0x1d4d('0x5c'))[_0x1d4d('0x11')](function(_0x4624aa){_0x42f841(null,_0x4624aa);})[_0x1d4d('0x13')](function(_0x1e33b2){_0x42f841(_0x1e33b2);});};AGIVertices[_0x1d4d('0xf')]['awsLex']=function(_0x414c03,_0x3e18d8){scripts['awsLex'](this[_0x1d4d('0x32')]['uniqueid'],_0x414c03['aws_access_key_id'],_0x414c03['aws_secret_access_key'],_0x414c03['aws_lex_region'],_0x414c03[_0x1d4d('0x5c')],_0x414c03[_0x1d4d('0x8c')])[_0x1d4d('0x11')](function(_0x58f26c){_0x3e18d8(null,_0x58f26c);})[_0x1d4d('0x13')](function(_0x24a614){_0x3e18d8(_0x24a614);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x8d')]=function(_0x6814f,_0x571a5a,_0x221022){scripts[_0x1d4d('0x8d')](_0x571a5a,_0x6814f[_0x1d4d('0x80')],_0x6814f[_0x1d4d('0x8e')]||'en-US')[_0x1d4d('0x11')](function(_0x10737d){_0x221022(null,_0x10737d);})[_0x1d4d('0x13')](function(_0x3177cf){_0x221022(_0x3177cf);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x8f')]=function(_0x3b7c50,_0x275f4d,_0x146977){scripts[_0x1d4d('0x8f')](_0x275f4d,_0x3b7c50[_0x1d4d('0x90')],_0x3b7c50[_0x1d4d('0x91')],_0x3b7c50[_0x1d4d('0x6f')])[_0x1d4d('0x11')](function(_0x5a3252){_0x146977(null,_0x5a3252);})[_0x1d4d('0x13')](function(_0x45a380){_0x146977(_0x45a380);});};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x92')]=function(_0x3a1e00){var _0x2941aa=_['includes'](verticesWithRetry,_0x3a1e00['agicommand'])?_0x3a1e00:_[_0x1d4d('0x93')](_0x3a1e00);for(var _0x3938b2 in _0x2941aa){if(_0x2941aa['hasOwnProperty'](_0x3938b2)){if(_0x2941aa[_0x3938b2]&&_['isString'](_0x2941aa[_0x3938b2])){if(_[_0x1d4d('0x94')](recursiveMapAttributes,_0x3938b2)){_0x2941aa[_0x3938b2]=this[_0x1d4d('0x95')](_0x2941aa[_0x3938b2]);}else{_0x2941aa[_0x3938b2]=this[_0x1d4d('0x96')](_0x2941aa[_0x3938b2]);}}}}return _0x2941aa;};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x97')]=function(_0x1742de){for(var _0x1ce5bd in _0x1742de){if(_0x1742de[_0x1d4d('0x98')](_0x1ce5bd)){if(_[_0x1d4d('0x99')](_0x1742de[_0x1ce5bd])){this[_0x1d4d('0x97')](_0x1742de[_0x1ce5bd]);}else if(_[_0x1d4d('0x9a')](_0x1742de[_0x1ce5bd])){for(var _0x479821=0x0;_0x479821<_0x1742de[_0x1ce5bd][_0x1d4d('0x9b')];_0x479821++){this[_0x1d4d('0x97')](_0x1742de[_0x1ce5bd][_0x479821]);}}else if(_[_0x1d4d('0x9c')](_0x1742de[_0x1ce5bd])){_0x1742de[_0x1ce5bd]=this[_0x1d4d('0x96')](_0x1742de[_0x1ce5bd]);}}}};AGIVertices['prototype'][_0x1d4d('0x9d')]=function(_0x5b085f,_0x52573e){for(var _0x34a2b1 in _0x5b085f){if(_0x5b085f[_0x1d4d('0x98')](_0x34a2b1)){if(_[_0x1d4d('0x99')](_0x5b085f[_0x34a2b1])){if(!_[_0x1d4d('0x3e')](_0x5b085f[_0x34a2b1])){this['saveRestApiResult'](_0x5b085f[_0x34a2b1],util[_0x1d4d('0x25')](_0x1d4d('0x9e'),_0x52573e,_0x34a2b1));}}else if(_[_0x1d4d('0x9a')](_0x5b085f[_0x34a2b1])){for(var _0x5350d7=0x0;_0x5350d7<_0x5b085f[_0x34a2b1]['length'];_0x5350d7++){this[_0x1d4d('0x9d')](_0x5b085f[_0x34a2b1][_0x5350d7],util[_0x1d4d('0x25')](_0x1d4d('0x9e'),_0x52573e,_0x34a2b1+'['+_0x5350d7+']'));}}else{if(!_[_0x1d4d('0x3f')](_0x5b085f[_0x34a2b1])){this[_0x1d4d('0x32')][_0x1d4d('0x9f')](util[_0x1d4d('0x25')](_0x1d4d('0x9e'),_0x52573e,_0x34a2b1),_0x5b085f[_0x34a2b1]);}}}}};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x95')]=function(_0x4c4070){try{var _0x5c6cc5=JSON[_0x1d4d('0x69')](_0x4c4070);this['recursiveNodeIndex'](_0x5c6cc5);return JSON[_0x1d4d('0x72')](_0x5c6cc5);}catch(_0x58890c){return this['replaceAllVariables'](_0x4c4070);}};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x96')]=function(_0x408e6f){var _0x6ebda4=_0x408e6f[_0x1d4d('0xa0')]('{');for(var _0x57ba17=0x1;_0x57ba17<_0x6ebda4['length'];_0x57ba17+=0x1){var _0x228a2a=_0x6ebda4[_0x57ba17][_0x1d4d('0xa0')]('}');if(_0x228a2a[_0x1d4d('0x9b')]>0x1){_0x408e6f=_0x408e6f[_0x1d4d('0xa1')]('{'+_0x228a2a[0x0]+'}',this[_0x1d4d('0x32')][_0x1d4d('0xa2')](_0x228a2a[0x0])[_0x1d4d('0xa3')]||_0x228a2a[0x0]);}}if(_0x6ebda4['length']===0x1){return _0x408e6f[_0x1d4d('0x45')]();}return this[_0x1d4d('0x96')](_0x408e6f);};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xa4')]=function(_0x1f492a,_0x1e0f6a){var _0x2bcae7=this[_0x1d4d('0x32')][_0x1d4d('0xa2')](_0x1f492a);if(_0x2bcae7[_0x1d4d('0xa5')]===-0x1){return _0x2bcae7;}logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0xa6'),_0x1e0f6a,_0x2bcae7[_0x1d4d('0xa3')]));return this['channel'][_0x1d4d('0x9f')](_0x1e0f6a,_0x2bcae7['extra']);};AGIVertices['prototype'][_0x1d4d('0x85')]=function(_0x565a30){return _0x565a30&&_0x565a30!=='0'&&_0x565a30!=='-1'&&_0x565a30!=='';};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xa7')]=function(_0x3b4531){this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x3b4531,'-');_0x3b4531[_0x1d4d('0xa9')]=_0x3b4531['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xaa')]=function(_0xcd2413){logger['info'](util[_0x1d4d('0x25')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0xcd2413['label']));if(!this[_0x1d4d('0x85')](_0xcd2413[_0x1d4d('0x5c')])){return this[_0x1d4d('0x32')]['noop'](_0x1d4d('0xab'));}var _0x12d6f3='\x22'+_0xcd2413['text']+'\x22';if(this['isConfigured'](_0xcd2413[_0x1d4d('0x77')])){_0x12d6f3+=','+_0xcd2413[_0x1d4d('0x77')];}var _0x36bdc1=this[_0x1d4d('0x32')][_0x1d4d('0xac')]('MRCPSynth',_0x12d6f3);if(_0x36bdc1[_0x1d4d('0xa5')]===-0x1){return _0x36bdc1;}return this[_0x1d4d('0x32')]['noop'](util['format'](_0x1d4d('0xad'),_0x12d6f3));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xae')]=function(_0x2ee361){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0xaf'),_0x2ee361[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x2ee361[_0x1d4d('0xb1')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('no\x20grammar\x20configured');}var _0xaee551=_0x2ee361[_0x1d4d('0xb1')];if(this[_0x1d4d('0x85')](_0x2ee361[_0x1d4d('0x77')])){_0xaee551+=','+_0x2ee361['options'];}var _0x4c6e22=this[_0x1d4d('0x32')]['exec'](_0x1d4d('0xb3'),_0xaee551);if(_0x4c6e22[_0x1d4d('0xa5')]===-0x1){return _0x4c6e22;}var _0x59a0b3=this[_0x1d4d('0xa4')](_0x1d4d('0xb4'),_0x1d4d('0xb5'));if(_0x59a0b3[_0x1d4d('0xa5')]===-0x1){return _0x59a0b3;}var _0x48beef=this[_0x1d4d('0xa4')](_0x1d4d('0xb6'),_0x1d4d('0xb7'));if(_0x48beef[_0x1d4d('0xa5')]===-0x1){return _0x48beef;}var _0x3ad3b7=this[_0x1d4d('0xa4')](_0x1d4d('0xb8'),'MRCP_RECOG_INSTANCE');if(_0x3ad3b7[_0x1d4d('0xa5')]===-0x1){return _0x3ad3b7;}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0xb9'),_0xaee551));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x7')]=function(_0x5da7a6){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0xba'),_0x5da7a6[_0x1d4d('0xb0')]));return this[_0x1d4d('0x32')][_0x1d4d('0x7')]([_0x5da7a6[_0x1d4d('0xbb')],_0x5da7a6[_0x1d4d('0xbc')]]);};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xbd')]=function(_0x280d84){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x280d84[_0x1d4d('0xb0')]));if(this[_0x1d4d('0x85')](_0x280d84[_0x1d4d('0x65')])){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0xbe'),_0x280d84['timeout']));var _0x46e547=this[_0x1d4d('0x32')][_0x1d4d('0xbf')](_0x280d84[_0x1d4d('0x65')]);if(_0x46e547['result']===-0x1){return _0x46e547;}}return this[_0x1d4d('0x32')][_0x1d4d('0xbd')]();};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xc0')]=function(_0x10079){logger[_0x1d4d('0x29')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x10079['label']));if(!this[_0x1d4d('0x85')](_0x10079['list_id'])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x10079,_0x1d4d('0xc1'));}_0x10079['scheduledAt']=moment();if(this[_0x1d4d('0x85')](_0x10079['delay'])){_0x10079['scheduledAt']=moment()[_0x1d4d('0x4d')](_0x10079[_0x1d4d('0xc2')],_0x1d4d('0x4e'));}if(!this[_0x1d4d('0x85')](_0x10079['callback_priority'])){_0x10079[_0x1d4d('0x46')]=0x2;}this[_0x1d4d('0x3d')][_0x1d4d('0xa8')](this,_0x10079);return this[_0x1d4d('0x32')]['noop'](util['format'](_0x1d4d('0xc3'),_0x10079[_0x1d4d('0x49')],_0x10079[_0x1d4d('0x42')],_0x10079['scheduledAt']));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xc4')]=function(_0x2c603b){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0xc5'),_0x2c603b[_0x1d4d('0xb0')]));var _0x163851=this[_0x1d4d('0x32')][_0x1d4d('0xac')](_0x2c603b['application'],_0x2c603b[_0x1d4d('0x77')]);if(_0x163851[_0x1d4d('0xa5')]===-0x1){return _0x163851;}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0xc6'),_0x2c603b[_0x1d4d('0xc7')],_0x2c603b[_0x1d4d('0x77')]));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xc8')]=function(_0x29ab74){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0xc9'),_0x29ab74['label']));if(!this['isConfigured'](_0x29ab74['text'])){return this[_0x1d4d('0x32')]['noop'](_0x1d4d('0xab'));}var _0x1a1e61='\x22'+_0x29ab74['text']+'\x22';if(this[_0x1d4d('0x85')](_0x29ab74['options'])){_0x1a1e61+=','+_0x29ab74[_0x1d4d('0x77')];}var _0x15e056=this['channel']['exec'](_0x1d4d('0xca'),_0x1a1e61);if(_0x15e056['result']===-0x1){return _0x15e056;}return this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1a1e61));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xcb')]=function(_0x7ea3fa){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0xcc'),_0x7ea3fa[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x7ea3fa[_0x1d4d('0x5c')])){return this['channel']['noop']('no\x20text\x20configured');}var _0xa442dc='\x22'+_0x7ea3fa[_0x1d4d('0x5c')]+'\x22';if(this[_0x1d4d('0x85')](_0x7ea3fa[_0x1d4d('0x77')])){_0xa442dc+=','+_0x7ea3fa[_0x1d4d('0x77')];}var _0x586b57=this[_0x1d4d('0x32')]['exec']('MRCPSynth',_0xa442dc);if(_0x586b57[_0x1d4d('0xa5')]===-0x1){return _0x586b57;}return this['channel'][_0x1d4d('0xb2')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0xa442dc));};AGIVertices[_0x1d4d('0xf')]['lumenvoxasr']=function(_0x4b8a63){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0xcd'),_0x4b8a63['label']));if(!this[_0x1d4d('0x85')](_0x4b8a63['grammar'])){return this['channel'][_0x1d4d('0xb2')](_0x1d4d('0xce'));}var _0x26b293=_0x4b8a63[_0x1d4d('0xb1')];if(this[_0x1d4d('0x85')](_0x4b8a63[_0x1d4d('0x77')])){_0x26b293+=','+_0x4b8a63[_0x1d4d('0x77')];}var _0x34aec5=this[_0x1d4d('0x32')][_0x1d4d('0xac')](_0x1d4d('0xb3'),_0x26b293);if(_0x34aec5['result']===-0x1){return _0x34aec5;}var _0x123535=this[_0x1d4d('0xa4')](_0x1d4d('0xb4'),_0x1d4d('0xcf'));if(_0x123535[_0x1d4d('0xa5')]===-0x1){return _0x123535;}var _0x176e60=this[_0x1d4d('0xa4')](_0x1d4d('0xb6'),_0x1d4d('0xd0'));if(_0x176e60[_0x1d4d('0xa5')]===-0x1){return _0x176e60;}var _0x20e067=this['getAndSetVariable'](_0x1d4d('0xb8'),_0x1d4d('0xd1'));if(_0x20e067[_0x1d4d('0xa5')]===-0x1){return _0x20e067;}return this['channel'][_0x1d4d('0xb2')](util[_0x1d4d('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x26b293));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xd2')]=function(_0x87d9d1){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0xd3'),_0x87d9d1[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x87d9d1[_0x1d4d('0xb1')])){return this['channel'][_0x1d4d('0xb2')](_0x1d4d('0xce'));}var _0x2cde6b=_0x87d9d1[_0x1d4d('0xb1')];if(this['isConfigured'](_0x87d9d1[_0x1d4d('0x77')])){_0x2cde6b+=','+_0x87d9d1['options'];}var _0x2ac222=this[_0x1d4d('0x32')][_0x1d4d('0xac')]('MRCPRecog',_0x2cde6b);if(_0x2ac222['result']===-0x1){return _0x2ac222;}var _0x5dad17=this[_0x1d4d('0xa4')](_0x1d4d('0xb4'),_0x1d4d('0xd4'));if(_0x5dad17['result']===-0x1){return _0x5dad17;}var _0x4d350c=this['getAndSetVariable'](_0x1d4d('0xb6'),_0x1d4d('0xd5'));if(_0x4d350c[_0x1d4d('0xa5')]===-0x1){return _0x4d350c;}var _0x4259d0=this[_0x1d4d('0xa4')](_0x1d4d('0xb8'),_0x1d4d('0xd6'));if(_0x4259d0[_0x1d4d('0xa5')]===-0x1){return _0x4259d0;}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0xb9'),_0x2cde6b));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xd7')]=function(_0x1618b5){logger[_0x1d4d('0x29')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x1618b5[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x1618b5['odbc_id'])){return this[_0x1d4d('0x32')]['error'](_0x1618b5,_0x1d4d('0xd8'));}var _0x18f840=this[_0x1d4d('0x15')]['sync'](this,_0x1618b5[_0x1d4d('0xd9')]);if(!_0x18f840){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x1618b5,_0x1d4d('0xda'));}if(!this[_0x1d4d('0x85')](_0x1618b5['query'])){return this[_0x1d4d('0x32')]['error'](_0x1618b5,'no\x20query\x20configured');}var _0x14e4d5=_0x1618b5[_0x1d4d('0x2b')][_0x1d4d('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')](_0x1d4d('0xdb'),_0x14e4d5));var _0x130eac=this[_0x1d4d('0x27')][_0x1d4d('0xa8')](this,_0x18f840,_0x14e4d5);this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x1618b5,_0x14e4d5);if(!this['isConfigured'](_0x1618b5['variable_id'])){return this[_0x1d4d('0x32')]['noop'](_0x1d4d('0xdc'));}var _0x53ec9c=this['getVariable'][_0x1d4d('0xa8')](this,_0x1618b5[_0x1d4d('0xdd')]);if(!_0x53ec9c){return this[_0x1d4d('0x32')]['error'](_0x1618b5,_0x1d4d('0xde'));}var _0x1ea731=this;_0x130eac[_0x1d4d('0xdf')](function(_0x408863,_0x45d450){Object[_0x1d4d('0xe0')](_0x408863)[_0x1d4d('0xdf')](function(_0x15353f){_0x1ea731[_0x1d4d('0x32')][_0x1d4d('0x9f')](util[_0x1d4d('0x25')]('%s[%s][%s]',_0x53ec9c,_0x45d450,_0x15353f),_0x408863[_0x15353f]);});});this[_0x1d4d('0x32')][_0x1d4d('0x9f')](util['format'](_0x1d4d('0xe1'),_0x53ec9c),_0x130eac[_0x1d4d('0x9b')]);return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util['format'](_0x1d4d('0xe2'),_0x53ec9c));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xe3')]=function(_0x156c34){logger['debug'](util[_0x1d4d('0x25')](_0x1d4d('0xe4'),_0x156c34[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x156c34[_0x1d4d('0xe5')])){return this['channel'][_0x1d4d('0x54')](_0x156c34,_0x1d4d('0xe6'));}var _0x3213d1=this[_0x1d4d('0x17')][_0x1d4d('0xa8')](this,_0x156c34[_0x1d4d('0xe5')]);if(!_0x3213d1){return this['channel']['error'](_0x156c34,'no\x20user\x20found');}var _0x24fda4=this[_0x1d4d('0x32')][_0x1d4d('0xac')]('DIAL',[util['format'](_0x1d4d('0xe7'),_0x3213d1),_0x156c34[_0x1d4d('0x65')],_0x156c34['opts'],_0x156c34[_0x1d4d('0x71')]]);if(_0x24fda4['result']===-0x1){return _0x24fda4;}return this[_0x1d4d('0x32')]['noop'](util['format'](_0x1d4d('0xe8'),_0x1d4d('0xe9')));};AGIVertices[_0x1d4d('0xf')]['dialogflow']=function(_0x1e0ad0){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0xea'),_0x1e0ad0[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x1e0ad0[_0x1d4d('0x80')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0xeb'));}if(!this[_0x1d4d('0x85')](_0x1e0ad0['text'])){return this['channel'][_0x1d4d('0xb2')](_0x1d4d('0xab'));}this[_0x1d4d('0x32')][_0x1d4d('0xec')]=!![];this[_0x1d4d('0x31')](_0x1e0ad0);this['createSquareMessage'](_0x1e0ad0[_0x1d4d('0x5c')],'in','','');this[_0x1d4d('0x32')]['noop'](util['format'](_0x1d4d('0xed'),_0x1e0ad0['text']));var _0x435949=this[_0x1d4d('0x78')][_0x1d4d('0xa8')](this,_0x1e0ad0);if(_0x435949){for(var _0x5aa9ed in _0x435949){if(_0x435949[_0x1d4d('0x98')](_0x5aa9ed)){this[_0x1d4d('0x32')][_0x1d4d('0x9f')](util[_0x1d4d('0x25')](_0x1d4d('0xee'),_0x5aa9ed[_0x1d4d('0xef')]()),_0x435949[_0x5aa9ed]);}}this['createSquareMessage'](_0x435949['speech'],_0x1d4d('0xf0'),_0x1d4d('0xf1'),'');return this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')](_0x1d4d('0xf2'),_0x435949['speech']));}return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x1e0ad0,_0x1d4d('0xf3'));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xf4')]=function(_0x2c8852){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x2c8852[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x2c8852['dialogflowV2_project_id'])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('no\x20project_id\x20configured');}if(!this[_0x1d4d('0x85')](_0x2c8852['client_email'])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('no\x20client_email\x20configured');}if(!this[_0x1d4d('0x85')](_0x2c8852[_0x1d4d('0x7c')])){return this[_0x1d4d('0x32')]['noop'](_0x1d4d('0xf5'));}if(!this[_0x1d4d('0x85')](_0x2c8852[_0x1d4d('0x7d')])){return this[_0x1d4d('0x32')]['noop']('no\x20anguage\x20configured');}if(!this[_0x1d4d('0x85')](_0x2c8852['text'])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0xab'));}this[_0x1d4d('0x32')][_0x1d4d('0xec')]=!![];this['createSquareDetailsReport'](_0x2c8852);this[_0x1d4d('0x3c')](_0x2c8852[_0x1d4d('0x5c')],'in','','');this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0xf6'),_0x2c8852[_0x1d4d('0x5c')]));var _0x416fd6=this[_0x1d4d('0x7a')][_0x1d4d('0xa8')](this,_0x2c8852);if(_0x416fd6){for(var _0x4328a4 in _0x416fd6){if(_0x416fd6['hasOwnProperty'](_0x4328a4)){if(_0x4328a4!==_0x1d4d('0xf7')){this[_0x1d4d('0x32')][_0x1d4d('0x9f')](util[_0x1d4d('0x25')](_0x1d4d('0xee'),_0x4328a4[_0x1d4d('0xef')]()),_0x416fd6[_0x4328a4]);}}}this[_0x1d4d('0x3c')](_0x416fd6[_0x1d4d('0xf8')],_0x1d4d('0xf0'),_0x1d4d('0xf4'),_0x416fd6[_0x1d4d('0xf7')]);return this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')]('DialogflowV2\x20Result\x20%s',_0x416fd6[_0x1d4d('0xf8')]));}return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x2c8852,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xf9')]=function(_0x543f0b){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0xfa'),_0x543f0b[_0x1d4d('0xb0')]));if(!this['isConfigured'](_0x543f0b[_0x1d4d('0xfb')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0xfc'));}if(!this['isConfigured'](_0x543f0b[_0x1d4d('0xfd')])){return this[_0x1d4d('0x32')]['noop'](_0x1d4d('0xfe'));}if(!this['isConfigured'](_0x543f0b[_0x1d4d('0xff')])){return this[_0x1d4d('0x32')]['noop'](_0x1d4d('0x100'));}if(!this[_0x1d4d('0x85')](_0x543f0b[_0x1d4d('0x101')])){return this['channel'][_0x1d4d('0xb2')](_0x1d4d('0xab'));}this[_0x1d4d('0x32')][_0x1d4d('0xec')]=!![];this[_0x1d4d('0x31')](_0x543f0b);this[_0x1d4d('0x3c')](_0x543f0b[_0x1d4d('0x5c')],'in','','');this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util['format'](_0x1d4d('0x102'),_0x543f0b[_0x1d4d('0x5c')]));var _0x2ffc4a=this[_0x1d4d('0x7e')][_0x1d4d('0xa8')](this,_0x543f0b);if(_0x2ffc4a){for(var _0x1e01e1 in _0x2ffc4a){if(_0x2ffc4a['hasOwnProperty'](_0x1e01e1)){this[_0x1d4d('0x32')][_0x1d4d('0x9f')](util[_0x1d4d('0x25')](_0x1d4d('0x103'),_0x1e01e1[_0x1d4d('0xef')]()),_0x2ffc4a[_0x1e01e1]);}}this[_0x1d4d('0x3c')](_0x2ffc4a[_0x1d4d('0xf8')],_0x1d4d('0xf0'),_0x1d4d('0xf9'),'');if(_0x2ffc4a[_0x1d4d('0x104')]){this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util['format'](_0x1d4d('0x105'),_0x2ffc4a[_0x1d4d('0x104')]));var _0x888aa6=this['channel'][_0x1d4d('0x106')](_0x2ffc4a['audiofile']);try{fs[_0x1d4d('0x107')](_0x2ffc4a['audiofile']+_0x1d4d('0x108'));}catch(_0x51a483){logger[_0x1d4d('0x54')](_0x51a483);}return _0x888aa6;}else{return this['channel'][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x109'),_0x2ffc4a[_0x1d4d('0xf8')]));}}return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x543f0b,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0x1d4d('0x10a')]=function(_0x2e0759){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x2e0759[_0x1d4d('0xb0')]));return this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('end');};AGIVertices['prototype'][_0x1d4d('0x10b')]=function(_0x57e191){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x10c'),_0x57e191[_0x1d4d('0xb0')]));var _0x46f50e='';if(_0x57e191['trunk_id']){if(!this[_0x1d4d('0x85')](_0x57e191[_0x1d4d('0x10d')])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x57e191,_0x1d4d('0x10e'));}else{var _0x3322f8=parseInt(_0x57e191['trunk_id'],0xa);if(isNaN(_0x3322f8)){_0x46f50e=_0x57e191['trunk_id'];}else{_0x46f50e=this['getTrunk'][_0x1d4d('0xa8')](this,_0x57e191['trunk_id']);if(!_0x46f50e){return this[_0x1d4d('0x32')]['error'](_0x57e191,_0x1d4d('0x10f'));}}}}else if(_0x57e191[_0x1d4d('0x110')]){_0x46f50e=_0x57e191[_0x1d4d('0x110')];}else{return this[_0x1d4d('0x32')]['error'](_0x57e191,_0x1d4d('0x10e'));}var _0x49d54c=this[_0x1d4d('0x32')][_0x1d4d('0xac')]('DIAL',[util[_0x1d4d('0x25')](_0x1d4d('0x111'),_0x46f50e,_0x57e191[_0x1d4d('0x49')]),_0x57e191['timeout'],_0x57e191['opts'],_0x57e191[_0x1d4d('0x71')]]);if(_0x49d54c[_0x1d4d('0xa5')]===-0x1){return _0x49d54c;}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util['format'](_0x1d4d('0xe8'),_0x1d4d('0xe9')));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x112')]=function(_0xac4a9){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x113'),_0xac4a9[_0x1d4d('0xb0')]));return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0x112'));};AGIVertices['prototype'][_0x1d4d('0xc')]=function(_0x3688d2){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0x114'),_0x3688d2[_0x1d4d('0xb0')]));if(_0x3688d2[_0x1d4d('0xa9')]===0x0){return this[_0x1d4d('0xa7')](_0x3688d2);}_0x3688d2[_0x1d4d('0xa9')]-=0x1;if(!this[_0x1d4d('0x85')](_0x3688d2[_0x1d4d('0x115')])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x3688d2,_0x1d4d('0x116'));}var _0x34b992=this[_0x1d4d('0x117')][_0x1d4d('0xa8')](this,_0x3688d2[_0x1d4d('0x115')]);if(!_0x34b992){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x3688d2,'no\x20file\x20audio\x20found');}if(!this[_0x1d4d('0x85')](_0x3688d2[_0x1d4d('0xdd')])){return this[_0x1d4d('0x32')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3bee41=this[_0x1d4d('0x32')][_0x1d4d('0x118')](_0x34b992,_0x3688d2[_0x1d4d('0x119')],_0x3688d2['maxdigit']);var _0xe2d9db=_0x3bee41[_0x1d4d('0xa5')]?_0x3bee41[_0x1d4d('0xa5')]['toString']():'';logger[_0x1d4d('0x29')]('test',JSON[_0x1d4d('0x72')](_0x3bee41));if(_0x3bee41[_0x1d4d('0xa5')]===-0x1){this[_0x1d4d('0x31')]['sync'](this,_0x3688d2,_0xe2d9db);return _0x3bee41;}else if(_0x3bee41[_0x1d4d('0xa3')]===_0x1d4d('0x65')){_0x3bee41[_0x1d4d('0xa5')]=_0xe2d9db['length']>=parseInt(_0x3688d2[_0x1d4d('0x11a')])?'x':'i';}else{_0x3bee41[_0x1d4d('0xa5')]=_0xe2d9db[_0x1d4d('0x9b')]>=parseInt(_0x3688d2[_0x1d4d('0x11a')])&&_0xe2d9db['length']<=parseInt(_0x3688d2[_0x1d4d('0x11b')])?'x':'i';}var _0x156ce0=this['getVariable']['sync'](this,_0x3688d2['variable_id']);if(!_0x156ce0){return this[_0x1d4d('0x32')]['error'](_0x3688d2,'no\x20variable\x20found');}this['channel'][_0x1d4d('0x9f')](_0x156ce0,_0xe2d9db);if(this['isConfigured'](_0x3688d2[_0x1d4d('0x11c')])){var _0x2c80aa=parseInt(_0x3688d2['hiddendigitsnum'],0xa);var _0x360860=rs[_0x1d4d('0x11d')]({'charset':'*','length':_0x2c80aa});var _0x32ac8c=_0xe2d9db[_0x1d4d('0x9b')];if(_0x32ac8c>0x0){if(_0x32ac8c>_0x2c80aa){this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x3688d2,_0x3688d2[_0x1d4d('0x11e')]===_0x1d4d('0x11f')?_0x360860+_0xe2d9db[_0x1d4d('0x120')](_0x2c80aa):_0xe2d9db[_0x1d4d('0x120')](0x0,_0x32ac8c-_0x2c80aa)+_0x360860);}else{this[_0x1d4d('0x31')]['sync'](this,_0x3688d2,rs['generate']({'charset':'*','length':_0x32ac8c}));}}else{this[_0x1d4d('0x31')]['sync'](this,_0x3688d2,'');}}else{this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x3688d2,_0xe2d9db);}return _0x3bee41;};AGIVertices[_0x1d4d('0xf')]['getsecretdigits']=function(_0x1d3402){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x121'),_0x1d3402[_0x1d4d('0xb0')]));return this['getdigits'](_0x1d3402);};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x122')]=function(_0x446419){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x446419[_0x1d4d('0xb0')]));this[_0x1d4d('0x31')]['sync'](this,_0x446419,_0x446419[_0x1d4d('0x123')]);return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x124'),_0x446419[_0x1d4d('0x123')]));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x125')]=function(_0x51b4c5){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x126'),_0x51b4c5[_0x1d4d('0xb0')]));if(!this['isConfigured'](_0x51b4c5[_0x1d4d('0x88')])||!this['isConfigured'](_0x51b4c5[_0x1d4d('0x127')])){return this['channel']['noop'](_0x1d4d('0x128'));}if(!this['isConfigured'](_0x51b4c5[_0x1d4d('0x5c')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0xab'));}this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')]('Trying\x20aws\x20Polly\x20%s',_0x51b4c5[_0x1d4d('0x5c')]));var _0x5161b0=this['awsPolly']['sync'](this,_0x51b4c5);if(_0x5161b0){this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')]('aws\x20Polly\x20%s\x20file\x20created',_0x5161b0));var _0x7b75e0=this[_0x1d4d('0x32')]['streamFile'](_0x5161b0);try{fs[_0x1d4d('0x107')](_0x5161b0+'.wav');}catch(_0x291a17){logger['error'](_0x291a17);}return _0x7b75e0;}return this['channel'][_0x1d4d('0x54')](_0x51b4c5,_0x1d4d('0x129'));};AGIVertices[_0x1d4d('0xf')]['awslex']=function(_0x38f9d7){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x38f9d7[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x38f9d7[_0x1d4d('0x88')])||!this[_0x1d4d('0x85')](_0x38f9d7[_0x1d4d('0x127')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0x128'));}if(!this['isConfigured'](_0x38f9d7[_0x1d4d('0x8c')])){return this[_0x1d4d('0x32')]['noop'](_0x1d4d('0x12a'));}if(!this[_0x1d4d('0x85')](_0x38f9d7[_0x1d4d('0x5c')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0xab'));}this['channel'][_0x1d4d('0xec')]=!![];this['createSquareDetailsReport'](_0x38f9d7);this[_0x1d4d('0x3c')](_0x38f9d7['text'],'in','','');this['channel'][_0x1d4d('0xb2')](util[_0x1d4d('0x25')]('Trying\x20Amazon\x20Lex:\x20%s',_0x38f9d7['text']));var _0x17eed5=this['awsLex'][_0x1d4d('0xa8')](this,_0x38f9d7);if(_0x17eed5){for(var _0x17f379 in _0x17eed5){if(_0x17eed5['hasOwnProperty'](_0x17f379)&&_[_0x1d4d('0x9c')](_0x17eed5[_0x17f379])){this[_0x1d4d('0x32')]['setVariable'](util[_0x1d4d('0x25')](_0x1d4d('0x12b'),_0x17f379[_0x1d4d('0xef')]()),_0x17eed5[_0x17f379]);}}if(_[_0x1d4d('0x3f')](_0x17eed5[_0x1d4d('0x75')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0x12c'));}else{this[_0x1d4d('0x3c')](_0x17eed5[_0x1d4d('0x75')],_0x1d4d('0xf0'),_0x1d4d('0x12d'),'');return this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')](_0x1d4d('0x12e'),_0x17eed5[_0x1d4d('0x75')]));}}return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x38f9d7,_0x1d4d('0x12f'));};AGIVertices[_0x1d4d('0xf')]['googleasr']=function(_0x146dc7){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x130'),_0x146dc7['label'],_0x146dc7[_0x1d4d('0x65')]));if(!this[_0x1d4d('0x85')](_0x146dc7[_0x1d4d('0x80')])){return this['channel'][_0x1d4d('0xb2')](_0x1d4d('0xeb'));}var _0x4ad942=_0x1d4d('0x131');var _0x4be5b2=util[_0x1d4d('0x25')](_0x1d4d('0x132'),FILES_PATH,rs['generate'](0x4));var _0x21c5a9=util[_0x1d4d('0x25')]('%s.%s',_0x4be5b2,_0x4ad942);var _0x4b7cee=!![];if(_0x146dc7[_0x1d4d('0x133')]===_0x1d4d('0x134')){_0x4b7cee=![];}var _0x523cee=this['channel'][_0x1d4d('0x135')](_0x4be5b2,_0x4ad942,_0x146dc7[_0x1d4d('0x136')],_0x146dc7[_0x1d4d('0x65')],undefined,_0x4b7cee);if(_0x523cee[_0x1d4d('0xa5')]!==-0x1){this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x137'),_0x21c5a9));var _0x301b21=this['googleASR'][_0x1d4d('0xa8')](this,_0x146dc7,_0x21c5a9);if(_0x301b21){for(var _0x7bfede in _0x301b21){if(_0x301b21[_0x1d4d('0x98')](_0x7bfede)){this[_0x1d4d('0x32')][_0x1d4d('0x9f')](util[_0x1d4d('0x25')](_0x1d4d('0x138'),_0x7bfede[_0x1d4d('0xef')]()),_0x301b21[_0x7bfede]);}}return this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')](_0x1d4d('0x139'),JSON[_0x1d4d('0x72')](_0x301b21)));}}return _0x523cee;};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x13a')]=function(_0x34e1f0){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0x13b'),_0x34e1f0[_0x1d4d('0xb0')]));if(!this['isConfigured'](_0x34e1f0[_0x1d4d('0x90')])){return this['channel'][_0x1d4d('0xb2')](_0x1d4d('0x13c'));}if(!this[_0x1d4d('0x85')](_0x34e1f0[_0x1d4d('0x91')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('no\x20appsecret\x20configured');}var _0x100601=_0x1d4d('0x131');var _0x35c752=util[_0x1d4d('0x25')](_0x1d4d('0x132'),FILES_PATH,rs[_0x1d4d('0x11d')](0x4));var _0x5beb46=util[_0x1d4d('0x25')](_0x1d4d('0x9e'),_0x35c752,_0x100601);var _0x25c79d=!![];if(_0x34e1f0['beep']==='NOBEEP'){_0x25c79d=![];}var _0x24cbb8=this[_0x1d4d('0x32')]['recordFile'](_0x35c752,_0x100601,_0x34e1f0[_0x1d4d('0x136')],_0x34e1f0['timeout'],undefined,_0x25c79d);if(_0x24cbb8[_0x1d4d('0xa5')]!==-0x1){this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x13d'),_0x5beb46));var _0x34581e=this[_0x1d4d('0x8f')][_0x1d4d('0xa8')](this,_0x34e1f0,_0x5beb46);if(_0x34581e){for(var _0x54b0a1 in _0x34581e){if(_0x34581e[_0x1d4d('0x98')](_0x54b0a1)){this['channel'][_0x1d4d('0x9f')](util[_0x1d4d('0x25')](_0x1d4d('0x13e'),_0x54b0a1['toUpperCase']()),_0x34581e[_0x54b0a1]);}}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x13f'),JSON[_0x1d4d('0x72')](_0x34581e)));}}return _0x24cbb8;};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x140')]=function(_0x3953d4){logger['info'](util['format'](_0x1d4d('0x141'),_0x3953d4[_0x1d4d('0xb0')]));return this[_0x1d4d('0x32')][_0x1d4d('0x142')](_0x3953d4[_0x1d4d('0x38')],_0x3953d4[_0x1d4d('0x39')],_0x3953d4[_0x1d4d('0x143')]);};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x144')]=function(_0xe2f27e){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x145'),_0xe2f27e[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0xe2f27e[_0x1d4d('0x146')])){return this['channel'][_0x1d4d('0x54')](_0xe2f27e,_0x1d4d('0x147'));}try{var _0x3dc19f=eval(_0xe2f27e[_0x1d4d('0x146')])?_0x1d4d('0x148'):'false';this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x149'),_0xe2f27e[_0x1d4d('0x146')],_0x3dc19f));return{'code':0xc8,'result':_0x3dc19f};}catch(_0x458072){return{'code':0xc8,'result':_0x1d4d('0x14a')};}};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x14b')]=function(_0x19dc7f){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x14c'),_0x19dc7f[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x19dc7f['interval_id'])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x19dc7f,_0x1d4d('0x14d'));}var _0x4942bf=this[_0x1d4d('0x1f')][_0x1d4d('0xa8')](this,_0x19dc7f[_0x1d4d('0x14e')]);if(!_0x4942bf){return this[_0x1d4d('0x32')]['error'](_0x19dc7f,_0x1d4d('0x14f'));}for(var _0xebef3c=0x0;_0xebef3c<_0x4942bf[_0x1d4d('0x9b')];_0xebef3c+=0x1){var _0x350d29=this[_0x1d4d('0x32')]['getVariable'](util[_0x1d4d('0x25')]('IFTIME(%s?true:false)',_0x4942bf[_0xebef3c]));if(_0x350d29[_0x1d4d('0xa5')]===-0x1){return _0x350d29;}logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0x150'),_0x4942bf[_0xebef3c],_0x350d29[_0x1d4d('0xa3')]));if(_0x350d29[_0x1d4d('0xa3')]===_0x1d4d('0x148')){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x150'),_0x4942bf[_0xebef3c],_0x1d4d('0x148')));this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x150'),_0x4942bf[_0xebef3c],_0x1d4d('0x148')));return{'code':0xc8,'result':'true'};}else{logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x150'),_0x4942bf[_0xebef3c],_0x1d4d('0x14a')));this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')](_0x1d4d('0x150'),_0x4942bf[_0xebef3c],_0x1d4d('0x14a')));}}return{'code':0xc8,'result':_0x1d4d('0x14a')};};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x151')]=function(_0x431642){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0x152'),_0x431642['label']));return this['channel'][_0x1d4d('0x151')]();};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x153')]=function(_0x15280c){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x154'),_0x15280c[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x15280c[_0x1d4d('0x80')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0xeb'));}var _0x3c0dbe='wav';var _0x32a671=util[_0x1d4d('0x25')](_0x1d4d('0x132'),FILES_PATH,rs['generate'](0x4));var _0x204adb=util[_0x1d4d('0x25')](_0x1d4d('0x9e'),_0x32a671,_0x3c0dbe);var _0x2a263d=!![];if(_0x15280c['beep']==='NOBEEP'){_0x2a263d=![];}var _0x738057=this[_0x1d4d('0x32')][_0x1d4d('0x135')](_0x32a671,_0x3c0dbe,_0x15280c['intKey'],_0x15280c[_0x1d4d('0x65')],undefined,_0x2a263d);if(_0x738057[_0x1d4d('0xa5')]!==-0x1){this['channel'][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x155'),_0x204adb));var _0x22105d=this[_0x1d4d('0x83')]['sync'](this,_0x15280c,_0x204adb);if(_0x22105d){for(var _0x106a73 in _0x22105d){if(_0x22105d[_0x1d4d('0x98')](_0x106a73)){this[_0x1d4d('0x32')]['setVariable'](util[_0x1d4d('0x25')](_0x1d4d('0x156'),_0x106a73[_0x1d4d('0xef')]()),_0x22105d[_0x106a73]);}}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')]('IspeechASR\x20Result\x20%s',JSON[_0x1d4d('0x72')](_0x22105d)));}}return _0x738057;};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x157')]=function(_0x18b3a9){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x158'),_0x18b3a9[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x18b3a9[_0x1d4d('0x80')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0xeb'));}if(!this[_0x1d4d('0x85')](_0x18b3a9['text'])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0xab'));}this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x159'),_0x18b3a9[_0x1d4d('0x5c')]));var _0x341598=this['ispeechTTS'][_0x1d4d('0xa8')](this,_0x18b3a9);if(_0x341598){this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x155'),_0x341598));var _0x43ac02=this[_0x1d4d('0x32')][_0x1d4d('0x106')](_0x341598,_0x18b3a9['intKey']);try{fs[_0x1d4d('0x107')](_0x341598+_0x1d4d('0x108'));}catch(_0x33091a){logger[_0x1d4d('0x54')](_0x33091a);}return _0x43ac02;}return this['channel']['error'](_0x18b3a9,_0x1d4d('0x15a'));};AGIVertices[_0x1d4d('0xf')]['login']=function(_0x2f43a6){logger['info'](util[_0x1d4d('0x25')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x2f43a6['label']));if(!this[_0x1d4d('0x85')](_0x2f43a6['findBy'])){return this[_0x1d4d('0x32')]['error'](_0x2f43a6,_0x1d4d('0x15b'));}logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x2f43a6[_0x1d4d('0x15c')]));var _0x1923b6=this[_0x1d4d('0x15d')][_0x1d4d('0xa8')](this,_0x2f43a6['findBy']);if(_0x1923b6){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x15e'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x2f43a6['findBy']));this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x15e'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x2f43a6['findBy']));return{'code':0xc8,'result':_0x1d4d('0x15f')};}else{logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x160'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x2f43a6['findBy']));this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x160'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x2f43a6[_0x1d4d('0x15c')]));return{'code':0xc8,'result':_0x1d4d('0x161')};}};AGIVertices['prototype'][_0x1d4d('0x162')]=function(_0x2ee30a){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x163'),_0x2ee30a[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x2ee30a[_0x1d4d('0x15c')])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x2ee30a,_0x1d4d('0x15b'));}logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0x164'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x2ee30a[_0x1d4d('0x15c')]));var _0x5d07ae=this[_0x1d4d('0x55')][_0x1d4d('0xa8')](this,_0x2ee30a[_0x1d4d('0x15c')]);if(_0x5d07ae){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x15e'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x2ee30a[_0x1d4d('0x15c')]));this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')](_0x1d4d('0x15e'),this['channel'][_0x1d4d('0x34')],_0x2ee30a[_0x1d4d('0x15c')]));return{'code':0xc8,'result':_0x1d4d('0x15f')};}else{logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x160'),this[_0x1d4d('0x32')]['callerid'],_0x2ee30a[_0x1d4d('0x15c')]));this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util['format'](_0x1d4d('0x160'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x2ee30a[_0x1d4d('0x15c')]));return{'code':0xc8,'result':_0x1d4d('0x161')};}};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x165')]=function(_0x171844){logger['info'](util[_0x1d4d('0x25')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x171844[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x171844[_0x1d4d('0x166')])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x171844,'no\x20operation\x20configured');}this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x167'),_0x171844[_0x1d4d('0x166')]));var _0x3d4391=eval(_0x171844[_0x1d4d('0x166')]);if(!this[_0x1d4d('0x85')](_0x171844[_0x1d4d('0xdd')])){return this['channel']['noop'](_0x1d4d('0xdc'));}var _0x3b75b3=this['getVariable'][_0x1d4d('0xa8')](this,_0x171844[_0x1d4d('0xdd')]);if(!_0x3b75b3){return this[_0x1d4d('0x32')]['error'](_0x171844,_0x1d4d('0xde'));}if(_[_0x1d4d('0x9a')](_0x3d4391)){var _0xf3bfac=this;_0x3d4391[_0x1d4d('0xdf')](function(_0x247063,_0x4d9cff){_0xf3bfac[_0x1d4d('0x32')][_0x1d4d('0x9f')](util[_0x1d4d('0x25')](_0x1d4d('0x168'),_0x3b75b3,_0x4d9cff),_0x247063);});return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')]('variable\x20%s[key]\x20set',_0x3b75b3));}else{return this['channel'][_0x1d4d('0x9f')](_0x3b75b3,_0x3d4391);}};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x169')]=function(_0x5b437a){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x16a'),_0x5b437a[_0x1d4d('0xb0')]));if(_0x5b437a[_0x1d4d('0xa9')]===0x0){return this[_0x1d4d('0xa7')](_0x5b437a);}_0x5b437a[_0x1d4d('0xa9')]-=0x1;if(!this['isConfigured'](_0x5b437a[_0x1d4d('0x115')])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x5b437a,'no\x20file\x20audio\x20selected');}var _0x1807e7=this[_0x1d4d('0x117')][_0x1d4d('0xa8')](this,_0x5b437a[_0x1d4d('0x115')]);if(!_0x1807e7){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x5b437a,_0x1d4d('0x16b'));}var _0x20db3e=this[_0x1d4d('0x32')][_0x1d4d('0x118')](_0x1807e7,_0x5b437a[_0x1d4d('0x119')],_0x5b437a[_0x1d4d('0x16c')]);var _0x59558c=_0x20db3e['result'];if(_0x20db3e['result']===-0x1){this['createSquareDetailsReport'][_0x1d4d('0xa8')](this,_0x5b437a,'-1');return _0x20db3e;}else if(_0x20db3e[_0x1d4d('0xa3')]===_0x1d4d('0x65')){_0x20db3e[_0x1d4d('0xa5')]=_0x20db3e[_0x1d4d('0xa5')][_0x1d4d('0x9b')]>0x0?_0x20db3e[_0x1d4d('0xa5')]:'t';}else if(_['isEmpty'](_0x20db3e[_0x1d4d('0xa5')])){_0x20db3e['result']='#';_0x59558c='#';}if(!this[_0x1d4d('0x85')](_0x5b437a[_0x1d4d('0xdd')])){this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x362aab=this[_0x1d4d('0xa2')][_0x1d4d('0xa8')](this,_0x5b437a['variable_id']);if(!_0x362aab){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x5b437a,_0x1d4d('0xde'));}this[_0x1d4d('0x32')][_0x1d4d('0x9f')](_0x362aab,_0x59558c);}this['createSquareDetailsReport'][_0x1d4d('0xa8')](this,_0x5b437a,_0x59558c);return _0x20db3e;};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0xb2')]=function(_0x10c1bd){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0x16d'),_0x10c1bd['label']));return this['channel'][_0x1d4d('0xb2')](_0x10c1bd['output']||_0x10c1bd[_0x1d4d('0xb0')]);};AGIVertices['prototype']['pause']=function(_0x501d6e){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x501d6e[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x501d6e[_0x1d4d('0x15c')])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x501d6e,_0x1d4d('0x15b'));}logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x164'),this['channel'][_0x1d4d('0x34')],_0x501d6e['findBy']));var _0x65b3ec=this[_0x1d4d('0x50')][_0x1d4d('0xa8')](this,_0x501d6e['pause_id']);var _0x51c7e4=this[_0x1d4d('0x51')][_0x1d4d('0xa8')](this,_0x501d6e['findBy'],_0x65b3ec);if(_0x51c7e4){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x15e'),this['channel']['callerid'],_0x501d6e['findBy']));this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x15e'),this['channel'][_0x1d4d('0x34')],_0x501d6e['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x1d4d('0x29')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x501d6e[_0x1d4d('0x15c')]));this[_0x1d4d('0x32')]['noop'](util['format'](_0x1d4d('0x15e'),this['channel'][_0x1d4d('0x34')],_0x501d6e[_0x1d4d('0x15c')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x16e')]=function(_0x5eeb14){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0x16f'),_0x5eeb14['label']));if(!this[_0x1d4d('0x85')](_0x5eeb14['file_id'])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x5eeb14,'no\x20file\x20audio\x20selected');}var _0x255b3f=this[_0x1d4d('0x117')]['sync'](this,_0x5eeb14[_0x1d4d('0x115')]);if(!_0x255b3f){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x5eeb14,_0x1d4d('0x16b'));}var _0x51791c=this[_0x1d4d('0x32')][_0x1d4d('0xac')](_0x1d4d('0x170'),[_0x255b3f,_0x5eeb14[_0x1d4d('0x171')]]);if(_0x51791c['result']===-0x1){return _0x51791c;}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0xc6'),_0x1d4d('0x170'),_0x255b3f));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x172')]=function(_0x42546e){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x173'),_0x42546e[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x42546e['queue_id'])){return this['channel'][_0x1d4d('0x54')](_0x42546e,_0x1d4d('0x174'));}var _0xd93b33='';var _0x4f0989=parseInt(_0x42546e['queue_id'],0xa);if(isNaN(_0x4f0989)){_0xd93b33=_0x42546e[_0x1d4d('0x175')];}else{_0xd93b33=this['getVoiceQueue'][_0x1d4d('0xa8')](this,_0x42546e['queue_id']);if(!_0xd93b33){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x42546e,_0x1d4d('0x176'));}}var _0x2b2300='';if(this[_0x1d4d('0x85')](_0x42546e[_0x1d4d('0x115')])){var _0x4d2c11=this['getSound'][_0x1d4d('0xa8')](this,_0x42546e['file_id']);if(_0x4d2c11){_0x2b2300=_0x4d2c11;}}this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x42546e,_0xd93b33);if(_0x42546e[_0x1d4d('0x171')][_0x1d4d('0x177')]('x')<0x0){_0x42546e[_0x1d4d('0x171')]+='x';}if(_0x42546e[_0x1d4d('0x171')]['indexOf']('X')<0x0){_0x42546e[_0x1d4d('0x171')]+='X';}this[_0x1d4d('0x32')][_0x1d4d('0x9f')](_0x1d4d('0x178'),_0xd93b33?_0xd93b33['toLowerCase']():'');var _0x173eaa=this[_0x1d4d('0x32')][_0x1d4d('0xac')](_0x1d4d('0x179'),[_0xd93b33,_0x42546e['opts'],_0x42546e[_0x1d4d('0x71')],_0x2b2300,_0x42546e[_0x1d4d('0x65')],_0x42546e[_0x1d4d('0x7')],_0x42546e[_0x1d4d('0x17a')],_0x42546e[_0x1d4d('0x17b')],'',_0x42546e[_0x1d4d('0x17c')]]);if(_0x173eaa[_0x1d4d('0xa5')]===-0x1){return _0x173eaa;}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util['format'](_0x1d4d('0xc6'),_0x1d4d('0x179'),_0xd93b33));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x17d')]=function(_0x1c68a0){logger['info'](util[_0x1d4d('0x25')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x1c68a0[_0x1d4d('0xb0')]));var _0x44d572=_0x1c68a0['recordingFormat']||_0x1d4d('0x131');var _0x4485c7=util[_0x1d4d('0x25')](_0x1d4d('0x17e'),this[_0x1d4d('0x32')][_0x1d4d('0x36')],rs[_0x1d4d('0x11d')](0x5));var _0x2f7573=util['format'](_0x1d4d('0x17f'),FILES_PATH,_0x4485c7,_0x44d572);var _0x7ca289=util[_0x1d4d('0x25')](_0x1d4d('0x132'),FILES_PATH,_0x4485c7);this[_0x1d4d('0x35')][_0x1d4d('0xa8')](this,_0x1c68a0,_0x4485c7,_0x2f7573);this[_0x1d4d('0x32')]['setVariable']('RECORDING_SAVENAME',_0x4485c7);logger[_0x1d4d('0x29')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x7ca289,_0x44d572,_0x1c68a0[_0x1d4d('0x180')],_0x1c68a0[_0x1d4d('0x65')]);return this[_0x1d4d('0x32')][_0x1d4d('0x135')](_0x7ca289,_0x44d572,_0x1c68a0[_0x1d4d('0x180')],_0x1c68a0[_0x1d4d('0x65')],undefined,!![]);};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x181')]=function(_0x971588){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x182'),_0x971588[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x971588[_0x1d4d('0x71')])){return this['channel'][_0x1d4d('0xb2')]('no\x20url\x20configured');}var _0x403893=this[_0x1d4d('0x63')]['sync'](this,_0x971588);logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x183'),util['inspect'](_0x403893,{'showHidden':![],'depth':null})));if(!this[_0x1d4d('0x85')](_0x971588[_0x1d4d('0xdd')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x236222=this[_0x1d4d('0xa2')][_0x1d4d('0xa8')](this,_0x971588['variable_id']);if(!_0x236222){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x971588,_0x1d4d('0xde'));}this['channel'][_0x1d4d('0x9f')](util['format'](_0x1d4d('0x184'),_0x236222),_0x403893['statusCode']?_0x403893['statusCode']:_0x1d4d('0x185'));this[_0x1d4d('0x32')][_0x1d4d('0x9f')](util['format'](_0x1d4d('0x186'),_0x236222),_0x403893[_0x1d4d('0x74')]?_0x403893[_0x1d4d('0x74')]:'OK');if(_0x403893[_0x1d4d('0x68')]){try{this[_0x1d4d('0x9d')](_0x403893[_0x1d4d('0x68')],_0x236222);}catch(_0x19484e){logger['error'](util['format'](_0x1d4d('0x187'),_0x236222));}}return this[_0x1d4d('0x32')]['noop'](util['format']('variable\x20%s\x20set',_0x236222));};AGIVertices[_0x1d4d('0xf')]['saydigits']=function(_0x1f949a){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x188'),_0x1f949a[_0x1d4d('0xb0')]));return this['channel'][_0x1d4d('0x189')](_0x1f949a[_0x1d4d('0x18a')][_0x1d4d('0x59')](/\s+/g,''),_0x1f949a['escape_digits']);};AGIVertices[_0x1d4d('0xf')]['saynumber']=function(_0x484874){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x18b'),_0x484874['label']));return this[_0x1d4d('0x32')][_0x1d4d('0x18c')](_0x484874[_0x1d4d('0x66')]['replace'](/\s+/g,''),_0x484874[_0x1d4d('0x180')]);};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x18d')]=function(_0x10c0b0){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x18e'),_0x10c0b0[_0x1d4d('0xb0')]));return this[_0x1d4d('0x32')][_0x1d4d('0x18f')](_0x10c0b0[_0x1d4d('0x5c')],_0x10c0b0['escape_digits']);};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x190')]=function(_0x16228a){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x191'),_0x16228a[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x16228a[_0x1d4d('0x192')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('no\x20mail\x20account\x20configured');}var _0x3dcbed=this['getMailAccount']['sync'](this,_0x16228a[_0x1d4d('0x192')]);if(!_0x3dcbed||!_0x3dcbed['Smtp']){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x16228a,_0x1d4d('0x193'));}var _0x28c15a={'from':util[_0x1d4d('0x25')](_0x1d4d('0x194'),_0x3dcbed[_0x1d4d('0x12')],_0x3dcbed[_0x1d4d('0x195')]||_0x3dcbed[_0x1d4d('0x196')][_0x1d4d('0x197')]),'to':_0x16228a['to']||'','cc':_0x16228a['cc']||'','bcc':_0x16228a['bcc']||'','subject':_0x16228a['subject'],'html':_0x16228a[_0x1d4d('0x5c')],'text':_0x16228a[_0x1d4d('0x5c')]};var _0xdb36cf={'tls':{'rejectUnauthorized':![]}};if(_0x3dcbed[_0x1d4d('0x196')][_0x1d4d('0x198')]){_0xdb36cf['service']=_0x3dcbed[_0x1d4d('0x196')][_0x1d4d('0x198')];}else{_0xdb36cf['host']=_0x3dcbed['Smtp'][_0x1d4d('0x199')];_0xdb36cf[_0x1d4d('0x19a')]=_0x3dcbed[_0x1d4d('0x196')][_0x1d4d('0x19a')];_0xdb36cf[_0x1d4d('0x19b')]=_0x3dcbed[_0x1d4d('0x196')]['secure'];}if(_0x3dcbed['Smtp'][_0x1d4d('0x19c')]){_0xdb36cf[_0x1d4d('0x19d')]={'user':_0x3dcbed[_0x1d4d('0x196')][_0x1d4d('0x197')],'pass':_0x3dcbed[_0x1d4d('0x196')][_0x1d4d('0x19e')]};}if(this[_0x1d4d('0x85')](_0x16228a[_0x1d4d('0x19f')])){}logger[_0x1d4d('0x1a0')]('sendMail\x20message',JSON['stringify'](_0x28c15a));this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x16228a,_0x16228a[_0x1d4d('0x192')]);this['channel'][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x1a1'),_0x3dcbed[_0x1d4d('0x12')]));this['sendMailMessage'][_0x1d4d('0xa8')](this,_0xdb36cf,_0x28c15a);return this['channel']['noop'](_0x1d4d('0x1a2'));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1a3')]=function(_0x494f15){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x1a4'),_0x494f15['label']));return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0x1a5'));};AGIVertices[_0x1d4d('0xf')]['sendSMS']=function(_0x4a47a1){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x4a47a1['label']));if(!this[_0x1d4d('0x85')](_0x4a47a1[_0x1d4d('0x1a6')])){return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0x1a7'));}var _0x3eaaa7=this['getSmsAccount'][_0x1d4d('0xa8')](this,_0x4a47a1['sms_account_id']);if(!_0x3eaaa7){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x4a47a1,_0x1d4d('0x1a8'));}var _0x17a343={'body':_0x4a47a1[_0x1d4d('0x1a9')],'phone':_0x4a47a1['to']||'','SmsAccountId':_0x3eaaa7['id']};logger[_0x1d4d('0x1a0')](_0x1d4d('0x1aa'),JSON[_0x1d4d('0x72')](_0x17a343));this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x4a47a1,_0x4a47a1[_0x1d4d('0x1a6')]);this['channel'][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x1ab'),_0x3eaaa7[_0x1d4d('0x12')]));this[_0x1d4d('0x30')][_0x1d4d('0xa8')](this,_0x17a343);return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0x1ac'));};AGIVertices[_0x1d4d('0xf')]['set']=function(_0x4c5329){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x1ad'),_0x4c5329[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x4c5329[_0x1d4d('0xdd')])){return this['channel']['error'](_0x4c5329,_0x1d4d('0x1ae'));}var _0x4d0e5d=this[_0x1d4d('0xa2')][_0x1d4d('0xa8')](this,_0x4c5329[_0x1d4d('0xdd')]);if(!_0x4d0e5d){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x4c5329,_0x1d4d('0xde'));}return this[_0x1d4d('0x32')][_0x1d4d('0x9f')](_0x4d0e5d,_0x4c5329[_0x1d4d('0x1af')]);};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1b0')]=function(_0x5829f1){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x1b1'),_0x5829f1[_0x1d4d('0xb0')]));this['channel'][_0x1d4d('0xb2')]('START\x20CALLY\x20SQUARE');if(_0x5829f1['answer']===_0x1d4d('0x1b2')){this[_0x1d4d('0x32')][_0x1d4d('0xb2')]('Answer');return this[_0x1d4d('0x32')][_0x1d4d('0xbd')]();}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](_0x1d4d('0x1b3'));};AGIVertices['prototype']['subproject']=function(_0x321b90){logger['info'](util[_0x1d4d('0x25')](_0x1d4d('0x1b4'),_0x321b90['label']));if(!this[_0x1d4d('0x85')](_0x321b90[_0x1d4d('0x1b5')])){return this[_0x1d4d('0x32')]['error'](_0x321b90,_0x1d4d('0x1b6'));}var _0x2f345f=this[_0x1d4d('0x14')][_0x1d4d('0xa8')](this,_0x321b90['project_id']);if(!this['isConfigured'](_0x2f345f)){return this['channel'][_0x1d4d('0x54')](_0x321b90,util['format'](_0x1d4d('0x1b7'),_0x321b90[_0x1d4d('0x1b5')]));}if(_0x2f345f===this[_0x1d4d('0x32')]['arg_1']){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x321b90,_0x1d4d('0x1b8'));}this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x321b90,_0x2f345f);var _0x4cb252=this[_0x1d4d('0x32')][_0x1d4d('0xac')](_0x1d4d('0x1b9'),util[_0x1d4d('0x25')](_0x1d4d('0x1ba'),config[_0x1d4d('0x7')][_0x1d4d('0x199')]||_0x1d4d('0x1bb'),_0x2f345f,this[_0x1d4d('0x32')][_0x1d4d('0x33')]));if(_0x4cb252[_0x1d4d('0xa5')]===-0x1){return _0x4cb252;}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0xc6'),_0x1d4d('0x1b9'),_0x2f345f));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1bc')]=function(_0x2220fa){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x2220fa['label']));var _0x11634b=this[_0x1d4d('0x58')]['sync'](this,_0x2220fa[_0x1d4d('0xbb')]);this[_0x1d4d('0x31')][_0x1d4d('0xa8')](this,_0x2220fa,_0x2220fa[_0x1d4d('0xbb')]);if(this[_0x1d4d('0x85')](_0x2220fa['variable_id'])){var _0x45ab7e=this[_0x1d4d('0xa2')]['sync'](this,_0x2220fa['variable_id']);if(_0x45ab7e){this[_0x1d4d('0x32')][_0x1d4d('0x9f')](_0x45ab7e,_0x11634b);return this['channel'][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x1bd'),_0x2220fa[_0x1d4d('0xbb')],_0x45ab7e));}}return this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x2220fa['command']));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1be')]=function(_0x20db3c){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x1bf'),_0x20db3c[_0x1d4d('0xb0')]));_0x20db3c[_0x1d4d('0x5c')]=_0x20db3c['text'][_0x1d4d('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1d4d('0x85')](_0x20db3c[_0x1d4d('0x1c0')])){return this['channel']['noop'](_0x1d4d('0x1c1'));}if(!this['isConfigured'](_0x20db3c[_0x1d4d('0x5c')])){return this['channel'][_0x1d4d('0xb2')]('no\x20text\x20configured');}this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x1c2'),_0x20db3c[_0x1d4d('0x5c')]));var _0x15587a=this[_0x1d4d('0x5a')]['sync'](this,_0x20db3c);if(_0x15587a){this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x1c3'),_0x15587a));var _0xe176d6=this[_0x1d4d('0x32')][_0x1d4d('0x106')](_0x15587a);try{fs[_0x1d4d('0x107')](_0x15587a+'.wav');}catch(_0x290b49){logger[_0x1d4d('0x54')](_0x290b49);}return _0xe176d6;}return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x20db3c,_0x1d4d('0x1c4'));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1c5')]=function(_0x2b0380){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x1c6'),_0x2b0380[_0x1d4d('0xb0')]));_0x2b0380[_0x1d4d('0x5c')]=_0x2b0380[_0x1d4d('0x5c')][_0x1d4d('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1d4d('0x85')](_0x2b0380[_0x1d4d('0x5c')])){return this['channel'][_0x1d4d('0xb2')](_0x1d4d('0xab'));}this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')]('Trying\x20Google\x20TTS\x20%s',_0x2b0380[_0x1d4d('0x5c')]));var _0x34da29=this[_0x1d4d('0x1c7')][_0x1d4d('0xa8')](this,_0x2b0380);if(_0x34da29){this['channel'][_0x1d4d('0xb2')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x34da29));var _0x234011=this[_0x1d4d('0x32')][_0x1d4d('0x106')](_0x34da29);try{fs[_0x1d4d('0x107')](_0x34da29+'.wav');}catch(_0xb84ce0){logger[_0x1d4d('0x54')](_0xb84ce0);}return _0x234011;}return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x2b0380,_0x1d4d('0x1c8'));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1c9')]=function(_0x1005cb){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x1ca'),_0x1005cb[_0x1d4d('0xb0')]));if(!this[_0x1d4d('0x85')](_0x1005cb[_0x1d4d('0x15c')])){return this['channel']['error'](_0x1005cb,_0x1d4d('0x15b'));}logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x164'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x1005cb['findBy']));var _0x39508c=this[_0x1d4d('0x52')][_0x1d4d('0xa8')](this,_0x1005cb[_0x1d4d('0x15c')]);if(_0x39508c){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x15e'),this['channel'][_0x1d4d('0x34')],_0x1005cb[_0x1d4d('0x15c')]));this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util['format'](_0x1d4d('0x15e'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x1005cb['findBy']));return{'code':0xc8,'result':_0x1d4d('0x15f')};}else{logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')](_0x1d4d('0x160'),this['channel']['callerid'],_0x1005cb[_0x1d4d('0x15c')]));this[_0x1d4d('0x32')][_0x1d4d('0xb2')](util[_0x1d4d('0x25')](_0x1d4d('0x160'),this[_0x1d4d('0x32')][_0x1d4d('0x34')],_0x1005cb[_0x1d4d('0x15c')]));return{'code':0xc8,'result':_0x1d4d('0x161')};}};AGIVertices['prototype'][_0x1d4d('0x1cb')]=function(_0x39e940){logger[_0x1d4d('0x29')](util['format'](_0x1d4d('0x1cc'),_0x39e940[_0x1d4d('0xb0')]));var _0x20bde0=this[_0x1d4d('0x32')]['exec'](_0x1d4d('0x1cd'),[_0x39e940[_0x1d4d('0x1ce')],_0x39e940[_0x1d4d('0x77')]]);if(_0x20bde0[_0x1d4d('0xa5')]===-0x1){return _0x20bde0;}return this[_0x1d4d('0x32')]['noop'](util[_0x1d4d('0x25')]('Executed\x20command\x20%s\x20%s',_0x1d4d('0x1cd'),_0x39e940[_0x1d4d('0x1ce')]));};AGIVertices[_0x1d4d('0xf')][_0x1d4d('0x1cf')]=function(_0x55ddfa){logger[_0x1d4d('0x29')](util[_0x1d4d('0x25')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x55ddfa['label']));if(!this[_0x1d4d('0x85')](_0x55ddfa[_0x1d4d('0xdd')])){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x55ddfa,_0x1d4d('0x1ae'));}var _0x1454e3=this[_0x1d4d('0xa2')][_0x1d4d('0xa8')](this,_0x55ddfa[_0x1d4d('0xdd')]);if(!_0x1454e3){return this[_0x1d4d('0x32')][_0x1d4d('0x54')](_0x55ddfa,_0x1d4d('0xde'));}var _0x5066f8=this[_0x1d4d('0x32')][_0x1d4d('0xa2')](_0x1454e3);return{'code':0xc8,'result':_0x5066f8[_0x1d4d('0xa3')]?_0x5066f8[_0x1d4d('0xa3')]:'-'};};String[_0x1d4d('0xf')]['replaceAll']=function(_0x547009,_0x2b95ca){return this[_0x1d4d('0xa0')](_0x547009)[_0x1d4d('0x1d0')](_0x2b95ca);};module[_0x1d4d('0x1d1')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index c402ed8..d04813b 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 _0x81ff=['blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','info','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnect]\x20%s','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer'];(function(_0x179c4a,_0x10eb06){var _0x5d1879=function(_0x1f1dcd){while(--_0x1f1dcd){_0x179c4a['push'](_0x179c4a['shift']());}};_0x5d1879(++_0x10eb06);}(_0x81ff,0x1f0));var _0xf81f=function(_0x3dbf9e,_0xa9f235){_0x3dbf9e=_0x3dbf9e-0x0;var _0x17dbfc=_0x81ff[_0x3dbf9e];return _0x17dbfc;};'use strict';var util=require(_0xf81f('0x0'));var _=require(_0xf81f('0x1'));var moment=require(_0xf81f('0x2'));var ami=require('../ami');var logger=require(_0xf81f('0x3'))(_0xf81f('0x4'));var RpcUser=require(_0xf81f('0x5'));var RpcVoiceAgentReport=require(_0xf81f('0x6'));function Acw(_0x3f8585){this[_0xf81f('0x7')]=_0x3f8585[_0xf81f('0x7')];this[_0xf81f('0x8')]=_0x3f8585[_0xf81f('0x8')];this[_0xf81f('0x9')]=_0x3f8585[_0xf81f('0x9')];this[_0xf81f('0xa')]={};ami['on'](_0xf81f('0xb'),this[_0xf81f('0xc')][_0xf81f('0xd')](this));ami['on']('hanguprequest',this[_0xf81f('0xe')][_0xf81f('0xd')](this));ami['on'](_0xf81f('0xf'),this[_0xf81f('0x10')][_0xf81f('0xd')](this));ami['on'](_0xf81f('0x11'),this[_0xf81f('0x12')][_0xf81f('0xd')](this));ami['on']('attendedtransfer',this[_0xf81f('0x13')][_0xf81f('0xd')](this));ami['on'](_0xf81f('0x14'),this[_0xf81f('0x15')][_0xf81f('0xd')](this));ami['on']('custom:agentConnectPreview',this[_0xf81f('0x16')][_0xf81f('0xd')](this));}function getDiff(_0xb38849){var _0x33efcf=moment()[_0xf81f('0x17')](0x0);var _0x591797=moment(_0xb38849)['milliseconds'](0x0);return _0x33efcf['diff'](_0x591797,_0xf81f('0x18'));}Acw[_0xf81f('0x19')][_0xf81f('0x1a')]=function(_0x398760){try{var _0x5ac6cd=this;var _0x4fe9ba=this[_0xf81f('0xa')][_0x398760][_0xf81f('0x1b')];var _0x2f9704=this[_0xf81f('0xa')][_0x398760][_0xf81f('0x1c')];var _0x51e95f=this['voiceQueues'][_0x2f9704];var _0x5e61f4=![];var _0x4a89d0=_0xf81f('0x1d');if(_0x51e95f['mandatoryDisposition']){if(_0x51e95f[_0xf81f('0x1e')][_0xf81f('0x1f')]){_0x5e61f4=!![];_0x4a89d0=_0x51e95f['mandatoryDispositionPause'][_0xf81f('0x1f')];}}ami[_0xf81f('0x20')]({'action':_0xf81f('0x21'),'interface':_0x4fe9ba,'paused':!![],'reason':_0x4a89d0})[_0xf81f('0x22')](function(_0x1b7964){if(_0x5ac6cd[_0xf81f('0x8')][_0x4fe9ba]){return RpcUser[_0xf81f('0x23')](_0x5ac6cd['agents'][_0x4fe9ba]['id'])[_0xf81f('0x22')](function(_0x40512b){if(_0x40512b&&!_0x40512b['voicePause']){logger[_0xf81f('0x24')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x398760,_0x4fe9ba,_0x2f9704);var _0x324c58=_0x5ac6cd[_0xf81f('0xa')][_0x398760][_0xf81f('0x25')]&&_0x5ac6cd['channels'][_0x398760]['destlinkedid']?_0x5ac6cd[_0xf81f('0xa')][_0x398760][_0xf81f('0x26')]:_0x398760;return RpcUser['savePause'](_0x5ac6cd[_0xf81f('0x8')][_0x4fe9ba],_0x4a89d0,_0x324c58)[_0xf81f('0x22')](function(_0x3dfa77){if(!_0x5e61f4){_0x5ac6cd[_0xf81f('0x9')][_0x4fe9ba]={};logger[_0xf81f('0x24')](_0xf81f('0x27'),_0x398760,_0x5ac6cd[_0xf81f('0x7')][_0x2f9704][_0xf81f('0x28')],_0x4fe9ba,_0x2f9704);_0x5ac6cd[_0xf81f('0x9')][_0x4fe9ba]['timer']=setTimeout(_0x5ac6cd[_0xf81f('0x29')][_0xf81f('0xd')](_0x5ac6cd,_0x4fe9ba),_0x5ac6cd[_0xf81f('0x7')][_0x2f9704]['acwTimeout']*0x3e8);_0x5ac6cd[_0xf81f('0x9')][_0x4fe9ba][_0xf81f('0x2a')]=moment()[_0xf81f('0x2b')](_0xf81f('0x2c'));_0x5ac6cd['timers'][_0x4fe9ba][_0xf81f('0x2d')]=_0x398760;_0x5ac6cd['timers'][_0x4fe9ba][_0xf81f('0x1c')]=_0x2f9704;_0x5ac6cd['timers'][_0x4fe9ba][_0xf81f('0x2e')]=function(){var _0x9a31ac=getDiff(_0x5ac6cd[_0xf81f('0x9')][_0x4fe9ba][_0xf81f('0x2a')]);clearTimeout(_0x5ac6cd[_0xf81f('0x9')][_0x4fe9ba][_0xf81f('0x2f')]);_0x5ac6cd['timers'][_0x4fe9ba]['timer']=![];RpcVoiceAgentReport[_0xf81f('0x30')]({'acwtime':_0x9a31ac},_0x5ac6cd[_0xf81f('0x9')][_0x4fe9ba][_0xf81f('0x2d')],_0x4fe9ba)['then'](function(_0x41a0b5){logger[_0xf81f('0x24')](_0xf81f('0x31'),_0x398760,_0x9a31ac,_0x41a0b5);})[_0xf81f('0x32')](function(_0x33d875){logger[_0xf81f('0x33')](_0xf81f('0x34'),_0x398760,_0x33d875);});delete _0x5ac6cd['timers'][_0x4fe9ba];};}});}else{logger['info'](_0xf81f('0x35'),_0x398760,_0x4fe9ba,_0x2f9704);}});}})[_0xf81f('0x32')](function(_0x2fa6e6){logger[_0xf81f('0x33')](_0xf81f('0x27'),_0x398760,_0x5ac6cd[_0xf81f('0x7')][_0x2f9704][_0xf81f('0x28')],_0x4fe9ba,_0x2f9704);})[_0xf81f('0x36')](function(){delete _0x5ac6cd[_0xf81f('0xa')][_0x398760];});}catch(_0x2cbddb){logger[_0xf81f('0x33')](_0xf81f('0x37'),_0x2cbddb[_0xf81f('0x38')]);}};Acw[_0xf81f('0x19')][_0xf81f('0x29')]=function(_0x5f2b2d){try{var _0x5dd1e3=this;if(_0x5dd1e3['timers'][_0x5f2b2d]){_0x5dd1e3[_0xf81f('0x9')][_0x5f2b2d]['timer']=![];var _0x4e5b07=_0x5dd1e3[_0xf81f('0x9')][_0x5f2b2d][_0xf81f('0x2d')];var _0x542b82=_0x5dd1e3['timers'][_0x5f2b2d][_0xf81f('0x1c')];var _0x822a39=_0x5dd1e3[_0xf81f('0x7')][_0x542b82]['acwTimeout'];logger['info'](_0xf81f('0x39'),_0x4e5b07,_0x5f2b2d);RpcUser['saveUnpause'](this['agents'][_0x5f2b2d]);RpcVoiceAgentReport['update']({'acwtime':_0x822a39,'agentacw':!![]},_0x4e5b07,_0x5f2b2d)[_0xf81f('0x22')](function(_0x2dd176){logger['info'](_0xf81f('0x31'),_0x4e5b07,_0x822a39,_0x2dd176);})['catch'](function(_0x4f19d3){logger[_0xf81f('0x33')](_0xf81f('0x34'),_0x4e5b07,_0x4f19d3);});}else{logger['error'](_0xf81f('0x3a'),_0x5f2b2d);if(_0x5dd1e3[_0xf81f('0x9')]){logger[_0xf81f('0x24')](_0xf81f('0x3b'),JSON[_0xf81f('0x3c')](_0x5dd1e3[_0xf81f('0x9')]));}}}catch(_0x4b896e){logger['error']('[ACW][STOP]\x20%s',_0x4b896e['message']);}};Acw[_0xf81f('0x19')][_0xf81f('0xc')]=function(_0x5170){try{if(this[_0xf81f('0x7')][_0x5170[_0xf81f('0x1c')]]&&(this[_0xf81f('0x7')][_0x5170['queue']]['acw']||this['voiceQueues'][_0x5170[_0xf81f('0x1c')]]['mandatoryDisposition'])){if(this[_0xf81f('0x8')][_0x5170[_0xf81f('0x1b')]]){this['channels'][_0x5170['uniqueid']]={'queue':_0x5170[_0xf81f('0x1c')],'interface':_0x5170[_0xf81f('0x1b')],'destlinkedid':_0x5170[_0xf81f('0x26')]};}}}catch(_0x4a1c15){logger[_0xf81f('0x33')](_0xf81f('0x3d'),_0x4a1c15[_0xf81f('0x38')]);}};Acw[_0xf81f('0x19')][_0xf81f('0x16')]=function(_0x9c8d96){try{if(this[_0xf81f('0x7')][_0x9c8d96[_0xf81f('0x1c')]]&&(this['voiceQueues'][_0x9c8d96[_0xf81f('0x1c')]][_0xf81f('0x4')]||this[_0xf81f('0x7')][_0x9c8d96['queue']][_0xf81f('0x3e')])){if(this['agents'][_0x9c8d96[_0xf81f('0x1b')]]){this[_0xf81f('0xa')][_0x9c8d96[_0xf81f('0x2d')]]={'queue':_0x9c8d96[_0xf81f('0x1c')],'interface':_0x9c8d96[_0xf81f('0x1b')]};}}}catch(_0x52acaa){logger['error'](_0xf81f('0x3f'),_0x52acaa[_0xf81f('0x38')]);}};Acw[_0xf81f('0x19')][_0xf81f('0xe')]=function(_0x491388){try{if(this[_0xf81f('0xa')][_0x491388[_0xf81f('0x2d')]]&&_[_0xf81f('0x40')](this[_0xf81f('0xa')][_0x491388[_0xf81f('0x2d')]][_0xf81f('0x25')])){logger['info'](_0xf81f('0x41'),_0x491388[_0xf81f('0x2d')]);this[_0xf81f('0x1a')](_0x491388[_0xf81f('0x2d')]);}else if(this[_0xf81f('0xa')][_0x491388[_0xf81f('0x42')]]&&_[_0xf81f('0x40')](this[_0xf81f('0xa')][_0x491388[_0xf81f('0x42')]]['attended'])){logger['info'](_0xf81f('0x43'),_0x491388[_0xf81f('0x42')]);this[_0xf81f('0x1a')](_0x491388[_0xf81f('0x42')]);}}catch(_0xf64f5d){logger[_0xf81f('0x33')](_0xf81f('0x44'),_0xf64f5d[_0xf81f('0x38')]);}};Acw[_0xf81f('0x19')]['syncHangup']=function(_0x36a1d7){try{if(this[_0xf81f('0xa')][_0x36a1d7['uniqueid']]&&this['channels'][_0x36a1d7[_0xf81f('0x2d')]][_0xf81f('0x25')]){logger[_0xf81f('0x24')](_0xf81f('0x45'),_0x36a1d7['uniqueid']);this[_0xf81f('0x1a')](_0x36a1d7[_0xf81f('0x2d')]);}else if(this['channels'][_0x36a1d7[_0xf81f('0x42')]]&&this[_0xf81f('0xa')][_0x36a1d7[_0xf81f('0x42')]][_0xf81f('0x25')]){logger[_0xf81f('0x24')](_0xf81f('0x46'),_0x36a1d7[_0xf81f('0x42')]);this['startAcw'](_0x36a1d7[_0xf81f('0x42')]);}}catch(_0x318db8){logger[_0xf81f('0x33')](_0xf81f('0x47'),_0x318db8['message']);}};Acw[_0xf81f('0x19')][_0xf81f('0x13')]=function(_0x1838db){try{if(!_['isNil'](this['channels'][_0x1838db[_0xf81f('0x48')]])){this['startAcw'](_0x1838db[_0xf81f('0x48')]);if(this[_0xf81f('0xa')][_0x1838db[_0xf81f('0x49')]]){this[_0xf81f('0xa')][_0x1838db[_0xf81f('0x49')]][_0xf81f('0x25')]=!![];this[_0xf81f('0xa')][_0x1838db[_0xf81f('0x4a')]]=this[_0xf81f('0xa')][_0x1838db['secondtransfereruniqueid']];delete this['channels'][_0x1838db[_0xf81f('0x49')]];}}else if(!_[_0xf81f('0x4b')](this[_0xf81f('0xa')][_0x1838db[_0xf81f('0x4a')]])){this[_0xf81f('0x1a')](_0x1838db['transfertargetuniqueid']);if(this[_0xf81f('0xa')][_0x1838db[_0xf81f('0x4c')]]){this[_0xf81f('0xa')][_0x1838db[_0xf81f('0x4c')]][_0xf81f('0x25')]=!![];this[_0xf81f('0xa')][_0x1838db[_0xf81f('0x48')]]=this[_0xf81f('0xa')][_0x1838db['origtransfereruniqueid']];delete this[_0xf81f('0xa')][_0x1838db[_0xf81f('0x4c')]];}}}catch(_0x1323da){logger['error'](_0xf81f('0x4d'),_0x1323da['message']);}};Acw[_0xf81f('0x19')][_0xf81f('0x15')]=function(_0x51f485){try{if(this[_0xf81f('0xa')][_0x51f485[_0xf81f('0x4e')]]){logger['info'](_0xf81f('0x4f'),JSON['stringify'](_0x51f485[_0xf81f('0x4e')]));this['startAcw'](_0x51f485[_0xf81f('0x4e')]);}else if(this[_0xf81f('0xa')][_0x51f485[_0xf81f('0x50')]]){logger[_0xf81f('0x24')](_0xf81f('0x51'),JSON[_0xf81f('0x3c')](_0x51f485[_0xf81f('0x50')]));this['startAcw'](_0x51f485['transfererlinkedid']);}}catch(_0x109b7b){logger[_0xf81f('0x33')](_0xf81f('0x52'),_0x109b7b['message']);}};Acw['prototype'][_0xf81f('0x12')]=function(_0x4ac503){try{if(this['voiceQueues'][_0x4ac503[_0xf81f('0x1c')]]&&this[_0xf81f('0x7')][_0x4ac503[_0xf81f('0x1c')]]['autopause']==='all'){if(this[_0xf81f('0x8')][_0x4ac503['interface']]){logger[_0xf81f('0x24')](_0xf81f('0x53'),_0x4ac503[_0xf81f('0x2d')],_0x4ac503['interface'],_0x4ac503[_0xf81f('0x1c')]);return RpcUser['savePause'](this[_0xf81f('0x8')][_0x4ac503[_0xf81f('0x1b')]],_0xf81f('0x54'),_0x4ac503[_0xf81f('0x2d')]);}}}catch(_0x1acbb3){logger[_0xf81f('0x33')](_0xf81f('0x55'),_0x1acbb3[_0xf81f('0x38')]);}};module['exports']=Acw; \ No newline at end of file +var _0xfa11=['uniqueid','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','finally','[ACW][START]\x20%s','message','saveUnpause','[%s][UPDATE][ACWTIME:%s]','stringify','[ACW][syncAgentConnect]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x244325,_0x1e3d6c){var _0x5693db=function(_0x24a6b7){while(--_0x24a6b7){_0x244325['push'](_0x244325['shift']());}};_0x5693db(++_0x1e3d6c);}(_0xfa11,0x1d5));var _0x1fa1=function(_0x542735,_0x723cb8){_0x542735=_0x542735-0x0;var _0x54570e=_0xfa11[_0x542735];return _0x54570e;};'use strict';var util=require(_0x1fa1('0x0'));var _=require(_0x1fa1('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require('../../../config/logger')(_0x1fa1('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x1fa1('0x3'));function Acw(_0x385f00){this[_0x1fa1('0x4')]=_0x385f00['voiceQueues'];this[_0x1fa1('0x5')]=_0x385f00[_0x1fa1('0x5')];this[_0x1fa1('0x6')]=_0x385f00[_0x1fa1('0x6')];this['channels']={};ami['on'](_0x1fa1('0x7'),this[_0x1fa1('0x8')][_0x1fa1('0x9')](this));ami['on'](_0x1fa1('0xa'),this[_0x1fa1('0xb')][_0x1fa1('0x9')](this));ami['on'](_0x1fa1('0xc'),this['syncHangup'][_0x1fa1('0x9')](this));ami['on'](_0x1fa1('0xd'),this['syncAgentRingNoAnswer'][_0x1fa1('0x9')](this));ami['on'](_0x1fa1('0xe'),this[_0x1fa1('0xf')][_0x1fa1('0x9')](this));ami['on'](_0x1fa1('0x10'),this[_0x1fa1('0x11')]['bind'](this));ami['on'](_0x1fa1('0x12'),this[_0x1fa1('0x13')]['bind'](this));}function getDiff(_0x5d14b4){var _0x20fd39=moment()[_0x1fa1('0x14')](0x0);var _0x50073d=moment(_0x5d14b4)[_0x1fa1('0x14')](0x0);return _0x20fd39['diff'](_0x50073d,_0x1fa1('0x15'));}Acw[_0x1fa1('0x16')]['startAcw']=function(_0x2177a4){try{var _0x11b268=this;var _0x149765=this[_0x1fa1('0x17')][_0x2177a4][_0x1fa1('0x18')];var _0x27321e=this[_0x1fa1('0x17')][_0x2177a4][_0x1fa1('0x19')];var _0x990233=this[_0x1fa1('0x4')][_0x27321e];var _0x36b129=![];var _0x7d7d9d=_0x1fa1('0x1a');if(_0x990233[_0x1fa1('0x1b')]){if(_0x990233[_0x1fa1('0x1c')][_0x1fa1('0x1d')]){_0x36b129=!![];_0x7d7d9d=_0x990233[_0x1fa1('0x1c')]['name'];}}ami['Action']({'action':'QueuePause','interface':_0x149765,'paused':!![],'reason':_0x7d7d9d})[_0x1fa1('0x1e')](function(_0x3f0ccb){if(_0x11b268[_0x1fa1('0x5')][_0x149765]){return RpcUser[_0x1fa1('0x1f')](_0x11b268['agents'][_0x149765]['id'])[_0x1fa1('0x1e')](function(_0xa088fa){if(_0xa088fa&&!_0xa088fa[_0x1fa1('0x20')]){logger[_0x1fa1('0x21')](_0x1fa1('0x22'),_0x2177a4,_0x149765,_0x27321e);var _0x47fb3a=_0x11b268[_0x1fa1('0x17')][_0x2177a4]['attended']&&_0x11b268[_0x1fa1('0x17')][_0x2177a4]['destlinkedid']?_0x11b268[_0x1fa1('0x17')][_0x2177a4][_0x1fa1('0x23')]:_0x2177a4;return RpcUser[_0x1fa1('0x24')](_0x11b268[_0x1fa1('0x5')][_0x149765],_0x7d7d9d,_0x47fb3a)[_0x1fa1('0x1e')](function(_0x537494){if(!_0x36b129){_0x11b268[_0x1fa1('0x6')][_0x149765]={};logger[_0x1fa1('0x21')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2177a4,_0x11b268['voiceQueues'][_0x27321e]['acwTimeout'],_0x149765,_0x27321e);_0x11b268[_0x1fa1('0x6')][_0x149765][_0x1fa1('0x25')]=setTimeout(_0x11b268[_0x1fa1('0x26')]['bind'](_0x11b268,_0x149765),_0x11b268[_0x1fa1('0x4')][_0x27321e]['acwTimeout']*0x3e8);_0x11b268[_0x1fa1('0x6')][_0x149765]['lastPauseAt']=moment()[_0x1fa1('0x27')](_0x1fa1('0x28'));_0x11b268[_0x1fa1('0x6')][_0x149765][_0x1fa1('0x29')]=_0x2177a4;_0x11b268[_0x1fa1('0x6')][_0x149765][_0x1fa1('0x19')]=_0x27321e;_0x11b268[_0x1fa1('0x6')][_0x149765][_0x1fa1('0x2a')]=function(){var _0x79886d=getDiff(_0x11b268[_0x1fa1('0x6')][_0x149765]['lastPauseAt']);clearTimeout(_0x11b268[_0x1fa1('0x6')][_0x149765][_0x1fa1('0x25')]);_0x11b268['timers'][_0x149765]['timer']=![];RpcVoiceAgentReport[_0x1fa1('0x2b')]({'acwtime':_0x79886d},_0x11b268['timers'][_0x149765]['uniqueid'],_0x149765)[_0x1fa1('0x1e')](function(_0x260b84){logger[_0x1fa1('0x21')]('[%s][UPDATE][ACWTIME:%s]',_0x2177a4,_0x79886d,_0x260b84);})[_0x1fa1('0x2c')](function(_0x37607b){logger[_0x1fa1('0x2d')](_0x1fa1('0x2e'),_0x2177a4,_0x37607b);});delete _0x11b268[_0x1fa1('0x6')][_0x149765];};}});}else{logger[_0x1fa1('0x21')](_0x1fa1('0x2f'),_0x2177a4,_0x149765,_0x27321e);}});}})[_0x1fa1('0x2c')](function(_0x105251){logger[_0x1fa1('0x2d')](_0x1fa1('0x30'),_0x2177a4,_0x11b268[_0x1fa1('0x4')][_0x27321e][_0x1fa1('0x31')],_0x149765,_0x27321e);})[_0x1fa1('0x32')](function(){delete _0x11b268['channels'][_0x2177a4];});}catch(_0x5b5c67){logger[_0x1fa1('0x2d')](_0x1fa1('0x33'),_0x5b5c67[_0x1fa1('0x34')]);}};Acw[_0x1fa1('0x16')][_0x1fa1('0x26')]=function(_0x30d294){try{var _0x304d80=this;if(_0x304d80[_0x1fa1('0x6')][_0x30d294]){_0x304d80[_0x1fa1('0x6')][_0x30d294][_0x1fa1('0x25')]=![];var _0xcb3dda=_0x304d80['timers'][_0x30d294]['uniqueid'];var _0x5592fb=_0x304d80['timers'][_0x30d294][_0x1fa1('0x19')];var _0x5d713d=_0x304d80[_0x1fa1('0x4')][_0x5592fb][_0x1fa1('0x31')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0xcb3dda,_0x30d294);RpcUser[_0x1fa1('0x35')](this['agents'][_0x30d294]);RpcVoiceAgentReport['update']({'acwtime':_0x5d713d,'agentacw':!![]},_0xcb3dda,_0x30d294)[_0x1fa1('0x1e')](function(_0x410e11){logger[_0x1fa1('0x21')](_0x1fa1('0x36'),_0xcb3dda,_0x5d713d,_0x410e11);})['catch'](function(_0x4f963c){logger['error'](_0x1fa1('0x2e'),_0xcb3dda,_0x4f963c);});}else{logger[_0x1fa1('0x2d')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x30d294);if(_0x304d80['timers']){logger[_0x1fa1('0x21')]('[ACW][TIMERS]',JSON[_0x1fa1('0x37')](_0x304d80[_0x1fa1('0x6')]));}}}catch(_0x4e2feb){logger[_0x1fa1('0x2d')]('[ACW][STOP]\x20%s',_0x4e2feb['message']);}};Acw[_0x1fa1('0x16')]['syncAgentConnect']=function(_0x4bc30d){try{if(this[_0x1fa1('0x4')][_0x4bc30d[_0x1fa1('0x19')]]&&(this[_0x1fa1('0x4')][_0x4bc30d[_0x1fa1('0x19')]][_0x1fa1('0x2')]||this[_0x1fa1('0x4')][_0x4bc30d[_0x1fa1('0x19')]][_0x1fa1('0x1b')])){if(this[_0x1fa1('0x5')][_0x4bc30d[_0x1fa1('0x18')]]){this[_0x1fa1('0x17')][_0x4bc30d[_0x1fa1('0x29')]]={'queue':_0x4bc30d[_0x1fa1('0x19')],'interface':_0x4bc30d['interface'],'destlinkedid':_0x4bc30d[_0x1fa1('0x23')]};}}}catch(_0x1da7c5){logger[_0x1fa1('0x2d')](_0x1fa1('0x38'),_0x1da7c5['message']);}};Acw[_0x1fa1('0x16')][_0x1fa1('0x13')]=function(_0x2cc8d1){try{if(this[_0x1fa1('0x4')][_0x2cc8d1[_0x1fa1('0x19')]]&&(this['voiceQueues'][_0x2cc8d1[_0x1fa1('0x19')]]['acw']||this[_0x1fa1('0x4')][_0x2cc8d1[_0x1fa1('0x19')]][_0x1fa1('0x1b')])){if(this[_0x1fa1('0x5')][_0x2cc8d1['interface']]){this[_0x1fa1('0x17')][_0x2cc8d1[_0x1fa1('0x29')]]={'queue':_0x2cc8d1[_0x1fa1('0x19')],'interface':_0x2cc8d1[_0x1fa1('0x18')]};}}}catch(_0x4a6c65){logger[_0x1fa1('0x2d')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4a6c65[_0x1fa1('0x34')]);}};Acw['prototype']['syncHangupRequest']=function(_0x22cb96){try{if(this[_0x1fa1('0x17')][_0x22cb96[_0x1fa1('0x29')]]&&_[_0x1fa1('0x39')](this['channels'][_0x22cb96['uniqueid']][_0x1fa1('0x3a')])){logger[_0x1fa1('0x21')](_0x1fa1('0x3b'),_0x22cb96[_0x1fa1('0x29')]);this[_0x1fa1('0x3c')](_0x22cb96[_0x1fa1('0x29')]);}else if(this[_0x1fa1('0x17')][_0x22cb96['linkedid']]&&_['isUndefined'](this[_0x1fa1('0x17')][_0x22cb96[_0x1fa1('0x3d')]][_0x1fa1('0x3a')])){logger['info'](_0x1fa1('0x3e'),_0x22cb96['linkedid']);this[_0x1fa1('0x3c')](_0x22cb96[_0x1fa1('0x3d')]);}}catch(_0x7ae8dd){logger['error'](_0x1fa1('0x3f'),_0x7ae8dd['message']);}};Acw[_0x1fa1('0x16')][_0x1fa1('0x40')]=function(_0x1dead2){try{if(this[_0x1fa1('0x17')][_0x1dead2[_0x1fa1('0x29')]]&&this[_0x1fa1('0x17')][_0x1dead2[_0x1fa1('0x29')]][_0x1fa1('0x3a')]){logger[_0x1fa1('0x21')](_0x1fa1('0x41'),_0x1dead2[_0x1fa1('0x29')]);this[_0x1fa1('0x3c')](_0x1dead2['uniqueid']);}else if(this['channels'][_0x1dead2['linkedid']]&&this[_0x1fa1('0x17')][_0x1dead2[_0x1fa1('0x3d')]][_0x1fa1('0x3a')]){logger[_0x1fa1('0x21')](_0x1fa1('0x42'),_0x1dead2[_0x1fa1('0x3d')]);this['startAcw'](_0x1dead2[_0x1fa1('0x3d')]);}}catch(_0x59bb3a){logger[_0x1fa1('0x2d')](_0x1fa1('0x43'),_0x59bb3a[_0x1fa1('0x34')]);}};Acw['prototype'][_0x1fa1('0xf')]=function(_0x2b1e44){try{if(!_[_0x1fa1('0x44')](this[_0x1fa1('0x17')][_0x2b1e44['transfereeuniqueid']])){this[_0x1fa1('0x3c')](_0x2b1e44[_0x1fa1('0x45')]);if(this[_0x1fa1('0x17')][_0x2b1e44['secondtransfereruniqueid']]){this[_0x1fa1('0x17')][_0x2b1e44['secondtransfereruniqueid']][_0x1fa1('0x3a')]=!![];this[_0x1fa1('0x17')][_0x2b1e44['transfertargetuniqueid']]=this[_0x1fa1('0x17')][_0x2b1e44['secondtransfereruniqueid']];delete this[_0x1fa1('0x17')][_0x2b1e44[_0x1fa1('0x46')]];}}else if(!_[_0x1fa1('0x44')](this[_0x1fa1('0x17')][_0x2b1e44['transfertargetuniqueid']])){this[_0x1fa1('0x3c')](_0x2b1e44[_0x1fa1('0x47')]);if(this[_0x1fa1('0x17')][_0x2b1e44[_0x1fa1('0x48')]]){this[_0x1fa1('0x17')][_0x2b1e44['origtransfereruniqueid']][_0x1fa1('0x3a')]=!![];this['channels'][_0x2b1e44[_0x1fa1('0x45')]]=this[_0x1fa1('0x17')][_0x2b1e44['origtransfereruniqueid']];delete this[_0x1fa1('0x17')][_0x2b1e44[_0x1fa1('0x48')]];}}}catch(_0x5afb52){logger[_0x1fa1('0x2d')](_0x1fa1('0x49'),_0x5afb52['message']);}};Acw[_0x1fa1('0x16')][_0x1fa1('0x11')]=function(_0x11aee8){try{if(this[_0x1fa1('0x17')][_0x11aee8[_0x1fa1('0x4a')]]){logger[_0x1fa1('0x21')](_0x1fa1('0x4b'),JSON[_0x1fa1('0x37')](_0x11aee8[_0x1fa1('0x4a')]));this[_0x1fa1('0x3c')](_0x11aee8[_0x1fa1('0x4a')]);}else if(this['channels'][_0x11aee8[_0x1fa1('0x4c')]]){logger[_0x1fa1('0x21')](_0x1fa1('0x4d'),JSON[_0x1fa1('0x37')](_0x11aee8[_0x1fa1('0x4c')]));this['startAcw'](_0x11aee8[_0x1fa1('0x4c')]);}}catch(_0x23b33a){logger[_0x1fa1('0x2d')]('[ACW][syncBlindTransfer]\x20%s',_0x23b33a['message']);}};Acw['prototype'][_0x1fa1('0x4e')]=function(_0xb159f){try{if(this[_0x1fa1('0x4')][_0xb159f[_0x1fa1('0x19')]]&&this[_0x1fa1('0x4')][_0xb159f[_0x1fa1('0x19')]][_0x1fa1('0x4f')]===_0x1fa1('0x50')){if(this[_0x1fa1('0x5')][_0xb159f['interface']]){logger[_0x1fa1('0x21')](_0x1fa1('0x51'),_0xb159f[_0x1fa1('0x29')],_0xb159f[_0x1fa1('0x18')],_0xb159f[_0x1fa1('0x19')]);return RpcUser[_0x1fa1('0x24')](this['agents'][_0xb159f[_0x1fa1('0x18')]],_0x1fa1('0x52'),_0xb159f[_0x1fa1('0x29')]);}}}catch(_0x26a215){logger[_0x1fa1('0x2d')](_0x1fa1('0x53'),_0x26a215[_0x1fa1('0x34')]);}};module[_0x1fa1('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 67681c9..3c3b8f7 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 _0xb10b=['asterisk','port','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','[ami.js][fullybooted]','asterisk-manager','moment','util','lodash','ami','../../config/environment'];(function(_0xf4e94c,_0x3e7531){var _0xf655a6=function(_0xc6f755){while(--_0xc6f755){_0xf4e94c['push'](_0xf4e94c['shift']());}};_0xf655a6(++_0x3e7531);}(_0xb10b,0x12a));var _0xbb10=function(_0x3126b6,_0x450061){_0x3126b6=_0x3126b6-0x0;var _0x116531=_0xb10b[_0x3126b6];return _0x116531;};'use strict';var Manager=require(_0xbb10('0x0'));var BPromise=require('bluebird');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var _=require(_0xbb10('0x3'));var logger=require('../../config/logger')(_0xbb10('0x4'));var config=require(_0xbb10('0x5'));var ami=new Manager(config[_0xbb10('0x6')][_0xbb10('0x7')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['username'],config[_0xbb10('0x6')][_0xbb10('0x8')],!![]);ami['keepConnected']();ami[_0xbb10('0x9')]=BPromise[_0xbb10('0xa')](ami[_0xbb10('0xb')]);function error(_0x1c3ee5){logger[_0xbb10('0xc')](util[_0xbb10('0xd')](_0xbb10('0xe'),config[_0xbb10('0x6')]['username'],config['asterisk']['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x1c3ee5,![],null)));}function close(){logger['error'](util[_0xbb10('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')]));}ami[_0xbb10('0x11')]=function(){return function(){return ami['Action']({'action':_0xbb10('0x12')});};};ami[_0xbb10('0x13')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x14')});};};ami[_0xbb10('0x15')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x16')});};};ami[_0xbb10('0x17')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x18')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x19')});};};function connect(_0x133ac2){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x1b'),config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['port']));ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami[_0xbb10('0x1c')](_0xbb10('0x1d'),close);}ami['on'](_0xbb10('0x1e'),connect);ami['on'](_0xbb10('0x1f'),function(_0x4deb49){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x4deb49,![],null)));});ami['on'](_0xbb10('0x20'),function(_0x407cb4){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x21'),config[_0xbb10('0x6')][_0xbb10('0x10')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0xbb10('0x22')]()[_0xbb10('0x23')](ami[_0xbb10('0x11')]())['then'](ami[_0xbb10('0x13')]())[_0xbb10('0x23')](ami[_0xbb10('0x15')]())[_0xbb10('0x23')](ami[_0xbb10('0x17')]())[_0xbb10('0x23')](ami[_0xbb10('0x24')]())['catch'](function(_0x3796c7){logger[_0xbb10('0xc')](_0xbb10('0x25'),util[_0xbb10('0xf')](_0x3796c7,{'showHidden':![],'depth':null}));});});ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami['once'](_0xbb10('0x1d'),close);module['exports']=ami; \ No newline at end of file +var _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x450781,_0x33b54c){var _0x8fc838=function(_0x206536){while(--_0x206536){_0x450781['push'](_0x450781['shift']());}};_0x8fc838(++_0x33b54c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x52b91f,_0x499757){_0x52b91f=_0x52b91f-0x0;var _0x15f8f5=_0x0b0e[_0x52b91f];return _0x15f8f5;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),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 ca096ff..d363c5c 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 _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0xcb91[_0x34d275];return _0x1379cc;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file +var _0x0713=['rpc','memberReport','error','message','result','catch','exports','../../config/logger','ami','client','http','Request','request','then','debug'];(function(_0x2c96de,_0x4624f1){var _0x1610af=function(_0x330906){while(--_0x330906){_0x2c96de['push'](_0x2c96de['shift']());}};_0x1610af(++_0x4624f1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var client=jayson[_0x3071('0x2')][_0x3071('0x3')]({'port':0x2329});client[_0x3071('0x4')]=function(_0x52b5fb,_0x2c547f){return new BPromise(function(_0x7b18a4,_0x33a70c){return client[_0x3071('0x5')](_0x52b5fb,_0x2c547f)[_0x3071('0x6')](function(_0x41cf76){logger[_0x3071('0x7')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x2c547f,_0x41cf76);if(_0x41cf76[_0x3071('0xa')]){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x41cf76['error'][_0x3071('0xb')],_0x2c547f);return _0x33a70c(_0x41cf76[_0x3071('0xa')][_0x3071('0xb')]);}else{return _0x7b18a4(_0x41cf76[_0x3071('0xc')]);}})[_0x3071('0xd')](function(_0x4a470a){logger[_0x3071('0xa')](_0x3071('0x8'),_0x3071('0x9'),_0x52b5fb,_0x4a470a,_0x2c547f);return _0x33a70c(_0x4a470a);});});};module[_0x3071('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 15c6a7a..5d00f54 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 _0xcf4d=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','ContactFirstName','firstName','starttime','format','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','queue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x47d6c8,_0x4195c5){var _0x42e495=function(_0x37503e){while(--_0x37503e){_0x47d6c8['push'](_0x47d6c8['shift']());}};_0x42e495(++_0x4195c5);}(_0xcf4d,0xc9));var _0xdcf4=function(_0x235c5b,_0x11eda7){_0x235c5b=_0x235c5b-0x0;var _0x1f3ac6=_0xcf4d[_0x235c5b];return _0x1f3ac6;};'use strict';var util=require(_0xdcf4('0x0'));var _=require(_0xdcf4('0x1'));var moment=require(_0xdcf4('0x2'));function checkNameSurname(_0x2665c,_0x3ede27,_0x209136){var _0x5f478f='';if(!_[_0xdcf4('0x3')](_0x3ede27)&&'string'===typeof _0x3ede27){_0x5f478f+=_0x3ede27;}if(!_[_0xdcf4('0x3')](_0x209136)&&_0xdcf4('0x4')===typeof _0x209136){_0x5f478f+='\x20'+_0x209136;}if(_0x5f478f!==''){return _0x5f478f;}return _0x2665c;}function Action(_0x4422f5,_0x5b9e0c,_0x403d05){this[_0xdcf4('0x5')]=_0x4422f5;this[_0xdcf4('0x6')]=_0x403d05||undefined;this[_0xdcf4('0x7')]=checkNameSurname(_0x5b9e0c[_0xdcf4('0x8')][_0xdcf4('0x9')],_0x5b9e0c['Contact']['firstName'],_0x5b9e0c[_0xdcf4('0x8')][_0xdcf4('0xa')]);this[_0xdcf4('0xb')]=_0x5b9e0c['Contact'][_0xdcf4('0x9')];this['queue']=_0x4422f5[_0xdcf4('0x7')];this[_0xdcf4('0xc')]=_0x5b9e0c[_0xdcf4('0xc')]||![];this['type']=_0x4422f5[_0xdcf4('0xd')];this['dialQueueTimeout']=_0x4422f5[_0xdcf4('0xe')]||0x3;this[_0xdcf4('0xf')]=_0x5b9e0c[_0xdcf4('0xf')];this[_0xdcf4('0x10')]=_0x5b9e0c[_0xdcf4('0x10')];this[_0xdcf4('0x11')]=_0x5b9e0c[_0xdcf4('0x11')];this[_0xdcf4('0x12')]=_0x5b9e0c[_0xdcf4('0x12')];this[_0xdcf4('0x13')]=_0x5b9e0c[_0xdcf4('0x13')];this[_0xdcf4('0x14')]=_0x5b9e0c[_0xdcf4('0x14')];this['countabandonedretry']=_0x5b9e0c[_0xdcf4('0x15')];this['countmachineretry']=_0x5b9e0c[_0xdcf4('0x16')];this[_0xdcf4('0x17')]=_0x5b9e0c[_0xdcf4('0x17')];this[_0xdcf4('0x18')]=_0x5b9e0c[_0xdcf4('0x18')];this[_0xdcf4('0x19')]=_0x5b9e0c[_0xdcf4('0x19')];this[_0xdcf4('0x1a')]=_0x5b9e0c['UserId'];this[_0xdcf4('0x1b')]=_0x5b9e0c[_0xdcf4('0x1b')];this['CampaignId']=_0x5b9e0c['CampaignId'];this['idHopper']=_0x5b9e0c['id'];this[_0xdcf4('0x1c')]=_0x5b9e0c['Contact'][_0xdcf4('0x1d')]||'';this[_0xdcf4('0x1e')]=moment()[_0xdcf4('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x5b9e0c['callback'];this['callbackuniqueid']=_0x5b9e0c[_0xdcf4('0x20')];this[_0xdcf4('0x21')]=_0x5b9e0c[_0xdcf4('0x21')];this[_0xdcf4('0x22')]=_0x5b9e0c[_0xdcf4('0x22')];this[_0xdcf4('0x23')]='';this[_0xdcf4('0x24')]='';}Action[_0xdcf4('0x25')][_0xdcf4('0x26')]=function(){return util[_0xdcf4('0x1f')](_0xdcf4('0x27'),this[_0xdcf4('0x7')],this[_0xdcf4('0x5')][_0xdcf4('0x28')]>0x0?this[_0xdcf4('0xb')]['substring'](this['voiceQueue'][_0xdcf4('0x28')]):this[_0xdcf4('0xb')]);};Action[_0xdcf4('0x25')][_0xdcf4('0x29')]=function(){return this[_0xdcf4('0x2a')];};module[_0xdcf4('0x2b')]=Action; \ No newline at end of file +var _0xbec0=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','util','lodash','string','isNil','voiceQueue','uniqueid','Contact','lastName','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry'];(function(_0x493de0,_0x458795){var _0x421d14=function(_0x4ec67d){while(--_0x4ec67d){_0x493de0['push'](_0x493de0['shift']());}};_0x421d14(++_0x458795);}(_0xbec0,0x125));var _0x0bec=function(_0x2c2530,_0x1635ce){_0x2c2530=_0x2c2530-0x0;var _0x20ee16=_0xbec0[_0x2c2530];return _0x20ee16;};'use strict';var util=require(_0x0bec('0x0'));var _=require(_0x0bec('0x1'));var moment=require('moment');function checkNameSurname(_0x3b2926,_0x70d7b1,_0x5dbba8){var _0x11c61c='';if(!_['isNil'](_0x70d7b1)&&_0x0bec('0x2')===typeof _0x70d7b1){_0x11c61c+=_0x70d7b1;}if(!_[_0x0bec('0x3')](_0x5dbba8)&&_0x0bec('0x2')===typeof _0x5dbba8){_0x11c61c+='\x20'+_0x5dbba8;}if(_0x11c61c!==''){return _0x11c61c;}return _0x3b2926;}function Action(_0x2cb991,_0x554246,_0x49a360){this[_0x0bec('0x4')]=_0x2cb991;this[_0x0bec('0x5')]=_0x49a360||undefined;this['name']=checkNameSurname(_0x554246['Contact']['phone'],_0x554246[_0x0bec('0x6')]['firstName'],_0x554246[_0x0bec('0x6')][_0x0bec('0x7')]);this['number']=_0x554246[_0x0bec('0x6')]['phone'];this[_0x0bec('0x8')]=_0x2cb991[_0x0bec('0x9')];this['active']=_0x554246[_0x0bec('0xa')]||![];this[_0x0bec('0xb')]=_0x2cb991['type'];this[_0x0bec('0xc')]=_0x2cb991[_0x0bec('0xc')]||0x3;this['scheduledat']=_0x554246[_0x0bec('0xd')];this[_0x0bec('0xe')]=_0x554246[_0x0bec('0xe')];this['countcongestionretry']=_0x554246[_0x0bec('0xf')];this['countnoanswerretry']=_0x554246[_0x0bec('0x10')];this[_0x0bec('0x11')]=_0x554246[_0x0bec('0x11')];this[_0x0bec('0x12')]=_0x554246['countdropretry'];this[_0x0bec('0x13')]=_0x554246[_0x0bec('0x13')];this[_0x0bec('0x14')]=_0x554246[_0x0bec('0x14')];this['countagentrejectretry']=_0x554246[_0x0bec('0x15')];this[_0x0bec('0x16')]=_0x554246[_0x0bec('0x16')];this[_0x0bec('0x17')]=_0x554246['ListId'];this[_0x0bec('0x18')]=_0x554246[_0x0bec('0x18')];this[_0x0bec('0x19')]=_0x554246[_0x0bec('0x19')];this[_0x0bec('0x1a')]=_0x554246[_0x0bec('0x1a')];this[_0x0bec('0x1b')]=_0x554246['id'];this[_0x0bec('0x1c')]=_0x554246['Contact']['firstName']||'';this[_0x0bec('0x1d')]=moment()['format'](_0x0bec('0x1e'));this[_0x0bec('0x1f')]=_0x554246['callback'];this[_0x0bec('0x20')]=_0x554246['callbackuniqueid'];this[_0x0bec('0x21')]=_0x554246[_0x0bec('0x21')];this[_0x0bec('0x22')]=_0x554246[_0x0bec('0x22')];this[_0x0bec('0x23')]='';this[_0x0bec('0x24')]='';}Action[_0x0bec('0x25')][_0x0bec('0x26')]=function(){return util[_0x0bec('0x27')](_0x0bec('0x28'),this['name'],this[_0x0bec('0x4')][_0x0bec('0x29')]>0x0?this[_0x0bec('0x2a')][_0x0bec('0x2b')](this[_0x0bec('0x4')][_0x0bec('0x29')]):this[_0x0bec('0x2a')]);};Action[_0x0bec('0x25')]['getQueue']=function(){return this[_0x0bec('0x8')];};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 7b2e0a7..ea0892e 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 _0x3945=['number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','queue','membername','reason','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','state','Answer','scheduledat','campaigntype','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3945,0x165));var _0x5394=function(_0x46b07c,_0x1b9f41){_0x46b07c=_0x46b07c-0x0;var _0x4f750e=_0x3945[_0x46b07c];return _0x4f750e;};'use strict';var util=require(_0x5394('0x0'));var _=require(_0x5394('0x1'));var moment=require(_0x5394('0x2'));function getSeconds(_0x5135df,_0x22a73f){var _0x15060d=moment(_0x5135df)[_0x5394('0x3')](0x0);var _0x820494=moment(_0x22a73f)[_0x5394('0x3')](0x0);return _0x15060d[_0x5394('0x4')](_0x820494,'seconds');}function AgentComplete(_0x1e7672,_0x2753c0){this[_0x5394('0x5')]=0x4;this['statedesc']=_0x5394('0x6');this[_0x5394('0x7')]=_0x1e7672['scheduledat'];this['type']=_0x1e7672['type'];this[_0x5394('0x8')]=_0x1e7672[_0x5394('0x9')]==='outbound'?'queue':_0x1e7672[_0x5394('0x9')];this[_0x5394('0xa')]=_0x1e7672['countbusyretry'];this[_0x5394('0xb')]=_0x1e7672[_0x5394('0xb')];this[_0x5394('0xc')]=_0x1e7672['countnoanswerretry'];this[_0x5394('0xd')]=_0x1e7672[_0x5394('0xa')]+_0x1e7672[_0x5394('0xb')]+_0x1e7672[_0x5394('0xc')]+_0x1e7672['countnosuchnumberretry']+_0x1e7672[_0x5394('0xe')]+_0x1e7672['countabandonedretry']+_0x1e7672[_0x5394('0xf')]+_0x1e7672[_0x5394('0x10')];this[_0x5394('0x11')]=_0x1e7672[_0x5394('0x11')];this[_0x5394('0xe')]=_0x1e7672['countdropretry'];this[_0x5394('0x12')]=_0x1e7672[_0x5394('0x12')];this[_0x5394('0xf')]=_0x1e7672[_0x5394('0xf')];this[_0x5394('0x10')]=_0x1e7672[_0x5394('0x10')];this['uniqueid']=_0x2753c0[_0x5394('0x13')];this['calleridname']=_0x1e7672[_0x5394('0x14')];this['calleridnum']=_0x1e7672[_0x5394('0x15')];this[_0x5394('0x16')]=_0x1e7672[_0x5394('0x16')];this[_0x5394('0x17')]=_0x1e7672[_0x5394('0x17')];this[_0x5394('0x18')]=_0x1e7672[_0x5394('0x18')];this[_0x5394('0x19')]=moment()[_0x5394('0x1a')](_0x5394('0x1b'));this[_0x5394('0x1c')]=getSeconds(_0x1e7672[_0x5394('0x17')],_0x1e7672['starttime']);this['holdtime']=getSeconds(_0x1e7672[_0x5394('0x18')],_0x1e7672['responsetime']);this[_0x5394('0x1d')]=getSeconds(this[_0x5394('0x19')],_0x1e7672[_0x5394('0x18')]);this[_0x5394('0x1e')]=_0x2753c0[_0x5394('0x1e')];this[_0x5394('0x1f')]=_0x2753c0['membername'];this['reason']=_0x2753c0[_0x5394('0x20')];this['callback']=_0x1e7672['callback'];this[_0x5394('0x21')]=_0x1e7672[_0x5394('0x21')];this['callbackat']=_0x1e7672['callbackat'];this['recallme']=_0x1e7672[_0x5394('0x22')];this[_0x5394('0x23')]=_0x1e7672[_0x5394('0x23')];this[_0x5394('0x24')]=_0x1e7672[_0x5394('0x24')];this[_0x5394('0x25')]=_0x1e7672[_0x5394('0x25')];this['VoiceQueueId']=_0x1e7672[_0x5394('0x26')];this[_0x5394('0x27')]=_0x1e7672[_0x5394('0x27')];this['originatecalleridnum']=_0x1e7672[_0x5394('0x28')]||'';this[_0x5394('0x29')]=_0x1e7672[_0x5394('0x29')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x236f=['countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','responsetime','answertime','endtime','ringtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x34ad72,_0x1e43f6){var _0x5c9aa8=function(_0x144388){while(--_0x144388){_0x34ad72['push'](_0x34ad72['shift']());}};_0x5c9aa8(++_0x1e43f6);}(_0x236f,0x1b2));var _0xf236=function(_0xf3d675,_0x18b880){_0xf3d675=_0xf3d675-0x0;var _0xa41008=_0x236f[_0xf3d675];return _0xa41008;};'use strict';var util=require(_0xf236('0x0'));var _=require(_0xf236('0x1'));var moment=require(_0xf236('0x2'));function getSeconds(_0x5de6e4,_0x3e2a1a){var _0x5698e1=moment(_0x5de6e4)[_0xf236('0x3')](0x0);var _0xc290ac=moment(_0x3e2a1a)[_0xf236('0x3')](0x0);return _0x5698e1['diff'](_0xc290ac,'seconds');}function AgentComplete(_0x52d1d9,_0x19238f){this[_0xf236('0x4')]=0x4;this[_0xf236('0x5')]='Answer';this['scheduledat']=_0x52d1d9[_0xf236('0x6')];this[_0xf236('0x7')]=_0x52d1d9['type'];this[_0xf236('0x8')]=_0x52d1d9[_0xf236('0x7')]===_0xf236('0x9')?_0xf236('0xa'):_0x52d1d9[_0xf236('0x7')];this[_0xf236('0xb')]=_0x52d1d9[_0xf236('0xb')];this[_0xf236('0xc')]=_0x52d1d9[_0xf236('0xc')];this[_0xf236('0xd')]=_0x52d1d9[_0xf236('0xd')];this[_0xf236('0xe')]=_0x52d1d9[_0xf236('0xb')]+_0x52d1d9[_0xf236('0xc')]+_0x52d1d9[_0xf236('0xd')]+_0x52d1d9[_0xf236('0xf')]+_0x52d1d9[_0xf236('0x10')]+_0x52d1d9[_0xf236('0x11')]+_0x52d1d9[_0xf236('0x12')]+_0x52d1d9[_0xf236('0x13')];this[_0xf236('0xf')]=_0x52d1d9[_0xf236('0xf')];this[_0xf236('0x10')]=_0x52d1d9['countdropretry'];this['countabandonedretry']=_0x52d1d9[_0xf236('0x11')];this[_0xf236('0x12')]=_0x52d1d9[_0xf236('0x12')];this[_0xf236('0x13')]=_0x52d1d9[_0xf236('0x13')];this['uniqueid']=_0x19238f['uniqueid'];this[_0xf236('0x14')]=_0x52d1d9[_0xf236('0x15')];this[_0xf236('0x16')]=_0x52d1d9['number'];this['starttime']=_0x52d1d9['starttime'];this['responsetime']=_0x52d1d9[_0xf236('0x17')];this[_0xf236('0x18')]=_0x52d1d9[_0xf236('0x18')];this[_0xf236('0x19')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xf236('0x1a')]=getSeconds(_0x52d1d9[_0xf236('0x17')],_0x52d1d9['starttime']);this[_0xf236('0x1b')]=getSeconds(_0x52d1d9[_0xf236('0x18')],_0x52d1d9['responsetime']);this['talktime']=getSeconds(this[_0xf236('0x19')],_0x52d1d9[_0xf236('0x18')]);this['queue']=_0x19238f[_0xf236('0xa')];this['membername']=_0x19238f[_0xf236('0x1c')];this[_0xf236('0x1d')]=_0x19238f[_0xf236('0x1d')];this[_0xf236('0x1e')]=_0x52d1d9[_0xf236('0x1e')];this[_0xf236('0x1f')]=_0x52d1d9['callbackuniqueid'];this[_0xf236('0x20')]=_0x52d1d9[_0xf236('0x20')];this[_0xf236('0x21')]=_0x52d1d9[_0xf236('0x21')];this[_0xf236('0x22')]=_0x52d1d9[_0xf236('0x22')];this[_0xf236('0x23')]=_0x52d1d9[_0xf236('0x23')];this['UserId']=_0x52d1d9['UserId'];this[_0xf236('0x24')]=_0x52d1d9[_0xf236('0x24')];this[_0xf236('0x25')]=_0x52d1d9[_0xf236('0x25')];this[_0xf236('0x26')]=_0x52d1d9[_0xf236('0x26')]||'';this['originatecalleridname']=_0x52d1d9[_0xf236('0x27')]||'';}module[_0xf236('0x28')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 9bbaea2..21a8943 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 _0x7f42=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','diff','uniqueid'];(function(_0xf1f37e,_0x159a20){var _0x2e3a6d=function(_0x4163cd){while(--_0x4163cd){_0xf1f37e['push'](_0xf1f37e['shift']());}};_0x2e3a6d(++_0x159a20);}(_0x7f42,0x1dd));var _0x27f4=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7f42[_0x5d6456];return _0x4d66c1;};'use strict';var util=require(_0x27f4('0x0'));var _=require('lodash');var moment=require(_0x27f4('0x1'));function getSeconds(_0xd1035c,_0x48e553){var _0x66342a=moment(_0xd1035c)['milliseconds'](0x0);var _0x10627e=moment(_0x48e553)['milliseconds'](0x0);return _0x66342a[_0x27f4('0x2')](_0x10627e,'seconds');}function Final(_0xe8eabe){this['uniqueid']=_0xe8eabe[_0x27f4('0x3')];this[_0x27f4('0x4')]=_0xe8eabe[_0x27f4('0x4')];this[_0x27f4('0x5')]=_0xe8eabe[_0x27f4('0x5')];this[_0x27f4('0x6')]=_0xe8eabe[_0x27f4('0x5')]===_0x27f4('0x7')?_0x27f4('0x8'):_0xe8eabe[_0x27f4('0x5')];this[_0x27f4('0x9')]=_0xe8eabe[_0x27f4('0x9')];this[_0x27f4('0xa')]=_0xe8eabe[_0x27f4('0xa')];this[_0x27f4('0xb')]=_0xe8eabe[_0x27f4('0xb')];this[_0x27f4('0xc')]=_0xe8eabe[_0x27f4('0x9')]+_0xe8eabe['countcongestionretry']+_0xe8eabe['countnoanswerretry']+_0xe8eabe[_0x27f4('0xd')]+_0xe8eabe[_0x27f4('0xe')]+_0xe8eabe[_0x27f4('0xf')]+_0xe8eabe[_0x27f4('0x10')]+_0xe8eabe[_0x27f4('0x11')];this[_0x27f4('0xd')]=_0xe8eabe[_0x27f4('0xd')];this[_0x27f4('0xe')]=_0xe8eabe['countdropretry'];this['countabandonedretry']=_0xe8eabe[_0x27f4('0xf')];this[_0x27f4('0x10')]=_0xe8eabe[_0x27f4('0x10')];this[_0x27f4('0x11')]=_0xe8eabe['countagentrejectretry'];this[_0x27f4('0x8')]=_0xe8eabe[_0x27f4('0x8')];this[_0x27f4('0x12')]=_0xe8eabe['calleridname'];this[_0x27f4('0x13')]=_0xe8eabe[_0x27f4('0x13')];this[_0x27f4('0x14')]=_0xe8eabe['starttime'];this[_0x27f4('0x15')]=_0xe8eabe[_0x27f4('0x15')];this['endtime']=_0xe8eabe['responsetime'];this[_0x27f4('0x16')]=_0xe8eabe[_0x27f4('0x16')]||0x0;this[_0x27f4('0x17')]=_0xe8eabe[_0x27f4('0x17')]||0x0;this[_0x27f4('0x18')]=_0xe8eabe[_0x27f4('0x18')]||0x0;this[_0x27f4('0x19')]=_0xe8eabe[_0x27f4('0x19')];this[_0x27f4('0x1a')]=_0xe8eabe[_0x27f4('0x1a')];this[_0x27f4('0x1b')]=_0xe8eabe[_0x27f4('0x1b')];this[_0x27f4('0x1c')]=_0xe8eabe[_0x27f4('0x1c')];this[_0x27f4('0x1d')]=_0xe8eabe['ContactId'];this[_0x27f4('0x1e')]=_0xe8eabe[_0x27f4('0x1e')];this[_0x27f4('0x1f')]=_0xe8eabe[_0x27f4('0x1f')];this[_0x27f4('0x20')]=_0xe8eabe[_0x27f4('0x20')];this[_0x27f4('0x21')]=_0xe8eabe[_0x27f4('0x21')];this[_0x27f4('0x22')]=_0xe8eabe[_0x27f4('0x22')]||'';this[_0x27f4('0x23')]=_0xe8eabe[_0x27f4('0x23')]||'';}module[_0x27f4('0x24')]=Final; \ No newline at end of file +var _0x0faf=['originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x5b1861,_0x162600){var _0x1058fd=function(_0x21587d){while(--_0x21587d){_0x5b1861['push'](_0x5b1861['shift']());}};_0x1058fd(++_0x162600);}(_0x0faf,0x132));var _0xf0fa=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0x0faf[_0x2d486b];return _0x4291d1;};'use strict';var util=require(_0xf0fa('0x0'));var _=require('lodash');var moment=require(_0xf0fa('0x1'));function getSeconds(_0x1b4763,_0x2c6207){var _0x35a260=moment(_0x1b4763)[_0xf0fa('0x2')](0x0);var _0xdc9ce3=moment(_0x2c6207)[_0xf0fa('0x2')](0x0);return _0x35a260[_0xf0fa('0x3')](_0xdc9ce3,_0xf0fa('0x4'));}function Final(_0x5d9b58){this[_0xf0fa('0x5')]=_0x5d9b58[_0xf0fa('0x5')];this[_0xf0fa('0x6')]=_0x5d9b58[_0xf0fa('0x6')];this[_0xf0fa('0x7')]=_0x5d9b58['type'];this[_0xf0fa('0x8')]=_0x5d9b58[_0xf0fa('0x7')]==='outbound'?'queue':_0x5d9b58[_0xf0fa('0x7')];this[_0xf0fa('0x9')]=_0x5d9b58[_0xf0fa('0x9')];this[_0xf0fa('0xa')]=_0x5d9b58[_0xf0fa('0xa')];this[_0xf0fa('0xb')]=_0x5d9b58[_0xf0fa('0xb')];this[_0xf0fa('0xc')]=_0x5d9b58['countbusyretry']+_0x5d9b58[_0xf0fa('0xa')]+_0x5d9b58['countnoanswerretry']+_0x5d9b58[_0xf0fa('0xd')]+_0x5d9b58['countdropretry']+_0x5d9b58[_0xf0fa('0xe')]+_0x5d9b58[_0xf0fa('0xf')]+_0x5d9b58[_0xf0fa('0x10')];this['countnosuchnumberretry']=_0x5d9b58['countnosuchnumberretry'];this[_0xf0fa('0x11')]=_0x5d9b58['countdropretry'];this[_0xf0fa('0xe')]=_0x5d9b58[_0xf0fa('0xe')];this[_0xf0fa('0xf')]=_0x5d9b58[_0xf0fa('0xf')];this[_0xf0fa('0x10')]=_0x5d9b58[_0xf0fa('0x10')];this[_0xf0fa('0x12')]=_0x5d9b58[_0xf0fa('0x12')];this['calleridname']=_0x5d9b58[_0xf0fa('0x13')];this[_0xf0fa('0x14')]=_0x5d9b58[_0xf0fa('0x14')];this[_0xf0fa('0x15')]=_0x5d9b58[_0xf0fa('0x15')];this[_0xf0fa('0x16')]=_0x5d9b58['responsetime'];this['endtime']=_0x5d9b58[_0xf0fa('0x16')];this[_0xf0fa('0x17')]=_0x5d9b58[_0xf0fa('0x17')]||0x0;this[_0xf0fa('0x18')]=_0x5d9b58[_0xf0fa('0x18')]||0x0;this[_0xf0fa('0x19')]=_0x5d9b58[_0xf0fa('0x19')]||0x0;this[_0xf0fa('0x1a')]=_0x5d9b58[_0xf0fa('0x1a')];this[_0xf0fa('0x1b')]=_0x5d9b58[_0xf0fa('0x1b')];this['callbackat']=_0x5d9b58[_0xf0fa('0x1c')];this[_0xf0fa('0x1d')]=_0x5d9b58[_0xf0fa('0x1d')];this[_0xf0fa('0x1e')]=_0x5d9b58[_0xf0fa('0x1e')];this[_0xf0fa('0x1f')]=_0x5d9b58[_0xf0fa('0x1f')];this[_0xf0fa('0x20')]=_0x5d9b58[_0xf0fa('0x20')];this['VoiceQueueId']=_0x5d9b58[_0xf0fa('0x21')];this[_0xf0fa('0x22')]=_0x5d9b58['CampaignId'];this[_0xf0fa('0x23')]=_0x5d9b58[_0xf0fa('0x23')]||'';this[_0xf0fa('0x24')]=_0x5d9b58['originatecalleridname']||'';}module[_0xf0fa('0x25')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 9dacc7c..b5db53d 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 _0x8c37=['diff','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name','calleridnum','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','endtime','queue','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds'];(function(_0x321c60,_0x587481){var _0x37f21a=function(_0x368b30){while(--_0x368b30){_0x321c60['push'](_0x321c60['shift']());}};_0x37f21a(++_0x587481);}(_0x8c37,0x1c4));var _0x78c3=function(_0x5e95f0,_0x10b37a){_0x5e95f0=_0x5e95f0-0x0;var _0x31b660=_0x8c37[_0x5e95f0];return _0x31b660;};'use strict';var util=require(_0x78c3('0x0'));var _=require(_0x78c3('0x1'));var moment=require(_0x78c3('0x2'));function getSeconds(_0x4a6719,_0x9a73e8){var _0xe2b683=moment(_0x4a6719)[_0x78c3('0x3')](0x0);var _0x42dfb7=moment(_0x9a73e8)[_0x78c3('0x3')](0x0);return _0xe2b683[_0x78c3('0x4')](_0x42dfb7,'seconds');}function Hangup(_0x4d4669,_0xdb65fa){this['state']=0x4;this['statedesc']='Answer';this[_0x78c3('0x5')]=_0x4d4669[_0x78c3('0x5')];this[_0x78c3('0x6')]=_0x4d4669[_0x78c3('0x6')];this[_0x78c3('0x7')]=_0x4d4669[_0x78c3('0x6')]==='outbound'?'queue':_0x4d4669[_0x78c3('0x6')];this[_0x78c3('0x8')]=_0x4d4669['countbusyretry'];this[_0x78c3('0x9')]=_0x4d4669[_0x78c3('0x9')];this[_0x78c3('0xa')]=_0x4d4669[_0x78c3('0xa')];this[_0x78c3('0xb')]=_0x4d4669[_0x78c3('0x8')]+_0x4d4669[_0x78c3('0x9')]+_0x4d4669[_0x78c3('0xa')]+_0x4d4669[_0x78c3('0xc')]+_0x4d4669[_0x78c3('0xd')]+_0x4d4669[_0x78c3('0xe')]+_0x4d4669['countmachineretry']+_0x4d4669[_0x78c3('0xf')];this['countnosuchnumberretry']=_0x4d4669['countnosuchnumberretry'];this[_0x78c3('0xd')]=_0x4d4669[_0x78c3('0xd')];this['countabandonedretry']=_0x4d4669[_0x78c3('0xe')];this['countmachineretry']=_0x4d4669[_0x78c3('0x10')];this[_0x78c3('0xf')]=_0x4d4669['countagentrejectretry'];this['uniqueid']=_0xdb65fa[_0x78c3('0x11')];this['calleridname']=_0x4d4669[_0x78c3('0x12')];this[_0x78c3('0x13')]=_0x4d4669['number'];this['starttime']=_0x4d4669[_0x78c3('0x14')];this[_0x78c3('0x15')]=_0x4d4669[_0x78c3('0x15')];this['endtime']=moment()['format'](_0x78c3('0x16'));this[_0x78c3('0x17')]=getSeconds(_0x4d4669[_0x78c3('0x15')],_0x4d4669['starttime']);this['holdtime']=0x0;this[_0x78c3('0x18')]=getSeconds(this[_0x78c3('0x19')],_0x4d4669[_0x78c3('0x15')]);this[_0x78c3('0x1a')]=_0x4d4669[_0x78c3('0x1a')];this['membername']=_0x78c3('0x1b');this[_0x78c3('0x1c')]=_0xdb65fa['cause-txt'];this[_0x78c3('0x1d')]=_0x4d4669['callback'];this[_0x78c3('0x1e')]=_0x4d4669[_0x78c3('0x1e')];this[_0x78c3('0x1f')]=_0x4d4669[_0x78c3('0x1f')];this[_0x78c3('0x20')]=_0x4d4669[_0x78c3('0x20')];this[_0x78c3('0x21')]=_0x4d4669[_0x78c3('0x21')];this[_0x78c3('0x22')]=_0x4d4669[_0x78c3('0x22')];this['UserId']=_0x4d4669[_0x78c3('0x23')];this[_0x78c3('0x24')]=_0x4d4669[_0x78c3('0x24')];this[_0x78c3('0x25')]=_0x4d4669[_0x78c3('0x25')];}module['exports']=Hangup; \ No newline at end of file +var _0xad16=['seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad16,0x174));var _0x6ad1=function(_0x5ab658,_0xcea814){_0x5ab658=_0x5ab658-0x0;var _0x11e196=_0xad16[_0x5ab658];return _0x11e196;};'use strict';var util=require(_0x6ad1('0x0'));var _=require(_0x6ad1('0x1'));var moment=require(_0x6ad1('0x2'));function getSeconds(_0x23f278,_0x51f745){var _0x3468b9=moment(_0x23f278)[_0x6ad1('0x3')](0x0);var _0x29ebaf=moment(_0x51f745)[_0x6ad1('0x3')](0x0);return _0x3468b9['diff'](_0x29ebaf,_0x6ad1('0x4'));}function Hangup(_0x47cd84,_0x818d71){this[_0x6ad1('0x5')]=0x4;this[_0x6ad1('0x6')]=_0x6ad1('0x7');this[_0x6ad1('0x8')]=_0x47cd84['scheduledat'];this['type']=_0x47cd84[_0x6ad1('0x9')];this[_0x6ad1('0xa')]=_0x47cd84[_0x6ad1('0x9')]===_0x6ad1('0xb')?_0x6ad1('0xc'):_0x47cd84[_0x6ad1('0x9')];this['countbusyretry']=_0x47cd84['countbusyretry'];this['countcongestionretry']=_0x47cd84[_0x6ad1('0xd')];this[_0x6ad1('0xe')]=_0x47cd84[_0x6ad1('0xe')];this[_0x6ad1('0xf')]=_0x47cd84[_0x6ad1('0x10')]+_0x47cd84[_0x6ad1('0xd')]+_0x47cd84['countnoanswerretry']+_0x47cd84[_0x6ad1('0x11')]+_0x47cd84[_0x6ad1('0x12')]+_0x47cd84[_0x6ad1('0x13')]+_0x47cd84[_0x6ad1('0x14')]+_0x47cd84[_0x6ad1('0x15')];this[_0x6ad1('0x11')]=_0x47cd84[_0x6ad1('0x11')];this['countdropretry']=_0x47cd84['countdropretry'];this[_0x6ad1('0x13')]=_0x47cd84[_0x6ad1('0x13')];this[_0x6ad1('0x14')]=_0x47cd84[_0x6ad1('0x14')];this[_0x6ad1('0x15')]=_0x47cd84[_0x6ad1('0x15')];this['uniqueid']=_0x818d71[_0x6ad1('0x16')];this['calleridname']=_0x47cd84[_0x6ad1('0x17')];this[_0x6ad1('0x18')]=_0x47cd84[_0x6ad1('0x19')];this[_0x6ad1('0x1a')]=_0x47cd84[_0x6ad1('0x1a')];this[_0x6ad1('0x1b')]=_0x47cd84[_0x6ad1('0x1b')];this['endtime']=moment()[_0x6ad1('0x1c')](_0x6ad1('0x1d'));this[_0x6ad1('0x1e')]=getSeconds(_0x47cd84[_0x6ad1('0x1b')],_0x47cd84[_0x6ad1('0x1a')]);this[_0x6ad1('0x1f')]=0x0;this[_0x6ad1('0x20')]=getSeconds(this[_0x6ad1('0x21')],_0x47cd84['responsetime']);this[_0x6ad1('0xc')]=_0x47cd84[_0x6ad1('0xc')];this[_0x6ad1('0x22')]=_0x6ad1('0x23');this['reason']=_0x818d71[_0x6ad1('0x24')];this[_0x6ad1('0x25')]=_0x47cd84[_0x6ad1('0x25')];this[_0x6ad1('0x26')]=_0x47cd84[_0x6ad1('0x26')];this['callbackat']=_0x47cd84[_0x6ad1('0x27')];this[_0x6ad1('0x28')]=_0x47cd84['recallme'];this[_0x6ad1('0x29')]=_0x47cd84[_0x6ad1('0x29')];this[_0x6ad1('0x2a')]=_0x47cd84[_0x6ad1('0x2a')];this[_0x6ad1('0x2b')]=_0x47cd84['UserId'];this[_0x6ad1('0x2c')]=_0x47cd84[_0x6ad1('0x2c')];this[_0x6ad1('0x2d')]=_0x47cd84[_0x6ad1('0x2d')];}module[_0x6ad1('0x2e')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index e2d5f39..e925bf1 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 _0x0b48=['countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','starttime','responsetime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x24507a,_0x58e59b){var _0x20ed6a=function(_0x3ed6e8){while(--_0x3ed6e8){_0x24507a['push'](_0x24507a['shift']());}};_0x20ed6a(++_0x58e59b);}(_0x0b48,0x1ce));var _0x80b4=function(_0x44eafa,_0x4b4ddb){_0x44eafa=_0x44eafa-0x0;var _0x3c39ad=_0x0b48[_0x44eafa];return _0x3c39ad;};'use strict';var util=require(_0x80b4('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0xcec29a,_0x49861c){var _0x54e8cb=moment(_0xcec29a)['milliseconds'](0x0);var _0x482f9b=moment(_0x49861c)[_0x80b4('0x1')](0x0);return _0x54e8cb[_0x80b4('0x2')](_0x482f9b,'seconds');}function History(_0x49fc17){this[_0x80b4('0x3')]=_0x49fc17[_0x80b4('0x3')];this[_0x80b4('0x4')]=_0x49fc17[_0x80b4('0x4')]||undefined;this[_0x80b4('0x5')]=_0x49fc17[_0x80b4('0x5')];this['campaigntype']=_0x49fc17['type']===_0x80b4('0x6')?_0x80b4('0x7'):_0x49fc17[_0x80b4('0x5')];this[_0x80b4('0x8')]=_0x49fc17['countbusyretry'];this[_0x80b4('0x9')]=_0x49fc17[_0x80b4('0x9')];this[_0x80b4('0xa')]=_0x49fc17[_0x80b4('0xa')];this[_0x80b4('0xb')]=_0x49fc17[_0x80b4('0x8')]+_0x49fc17['countcongestionretry']+_0x49fc17['countnoanswerretry']+_0x49fc17[_0x80b4('0xc')]+_0x49fc17[_0x80b4('0xd')]+_0x49fc17[_0x80b4('0xe')]+_0x49fc17[_0x80b4('0xf')]+_0x49fc17[_0x80b4('0x10')];this[_0x80b4('0xc')]=_0x49fc17[_0x80b4('0xc')];this[_0x80b4('0xd')]=_0x49fc17['countdropretry'];this['countabandonedretry']=_0x49fc17['countabandonedretry'];this[_0x80b4('0xf')]=_0x49fc17[_0x80b4('0xf')];this['countagentrejectretry']=_0x49fc17[_0x80b4('0x10')];this[_0x80b4('0x7')]=_0x49fc17[_0x80b4('0x7')];this[_0x80b4('0x11')]=_0x49fc17[_0x80b4('0x12')];this['calleridnum']=_0x49fc17['number'];this[_0x80b4('0x13')]=_0x49fc17[_0x80b4('0x13')];this[_0x80b4('0x14')]=_0x49fc17[_0x80b4('0x14')];this['endtime']=_0x49fc17['responsetime'];this['ringtime']=getSeconds(_0x49fc17['responsetime'],_0x49fc17['starttime']);this['holdtime']=0x0;this[_0x80b4('0x15')]=0x0;this['callback']=_0x49fc17[_0x80b4('0x16')];this[_0x80b4('0x17')]=_0x49fc17[_0x80b4('0x17')];this[_0x80b4('0x18')]=_0x49fc17[_0x80b4('0x18')];this[_0x80b4('0x19')]=_0x49fc17[_0x80b4('0x19')];this['ContactId']=_0x49fc17[_0x80b4('0x1a')];this['ListId']=_0x49fc17[_0x80b4('0x1b')];this[_0x80b4('0x1c')]=_0x49fc17[_0x80b4('0x1c')];this[_0x80b4('0x1d')]=_0x49fc17[_0x80b4('0x1d')];this[_0x80b4('0x1e')]=_0x49fc17[_0x80b4('0x1e')];this[_0x80b4('0x1f')]=_0x49fc17[_0x80b4('0x1f')]||'';this[_0x80b4('0x20')]=_0x49fc17['originatecalleridname']||'';}module[_0x80b4('0x21')]=History; \ No newline at end of file +var _0xca6c=['countmachineretry','countabandonedretry','countagentrejectretry','calleridnum','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x3f7861,_0x13619b){var _0x36fdae=function(_0x6aa7b8){while(--_0x6aa7b8){_0x3f7861['push'](_0x3f7861['shift']());}};_0x36fdae(++_0x13619b);}(_0xca6c,0xa1));var _0xcca6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca6c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xcca6('0x0'));var _=require(_0xcca6('0x1'));var moment=require(_0xcca6('0x2'));function getSeconds(_0x45b4f3,_0x25286d){var _0x296b9b=moment(_0x45b4f3)[_0xcca6('0x3')](0x0);var _0x22efe4=moment(_0x25286d)['milliseconds'](0x0);return _0x296b9b['diff'](_0x22efe4,_0xcca6('0x4'));}function History(_0x5dbcff){this['uniqueid']=_0x5dbcff[_0xcca6('0x5')];this[_0xcca6('0x6')]=_0x5dbcff['scheduledat']||undefined;this['type']=_0x5dbcff[_0xcca6('0x7')];this[_0xcca6('0x8')]=_0x5dbcff[_0xcca6('0x7')]==='outbound'?_0xcca6('0x9'):_0x5dbcff[_0xcca6('0x7')];this[_0xcca6('0xa')]=_0x5dbcff['countbusyretry'];this['countcongestionretry']=_0x5dbcff[_0xcca6('0xb')];this[_0xcca6('0xc')]=_0x5dbcff[_0xcca6('0xc')];this['countglobal']=_0x5dbcff[_0xcca6('0xa')]+_0x5dbcff['countcongestionretry']+_0x5dbcff['countnoanswerretry']+_0x5dbcff[_0xcca6('0xd')]+_0x5dbcff['countdropretry']+_0x5dbcff['countabandonedretry']+_0x5dbcff[_0xcca6('0xe')]+_0x5dbcff['countagentrejectretry'];this[_0xcca6('0xd')]=_0x5dbcff[_0xcca6('0xd')];this['countdropretry']=_0x5dbcff['countdropretry'];this[_0xcca6('0xf')]=_0x5dbcff[_0xcca6('0xf')];this['countmachineretry']=_0x5dbcff['countmachineretry'];this['countagentrejectretry']=_0x5dbcff[_0xcca6('0x10')];this[_0xcca6('0x9')]=_0x5dbcff['queue'];this['calleridname']=_0x5dbcff['name'];this[_0xcca6('0x11')]=_0x5dbcff[_0xcca6('0x12')];this['starttime']=_0x5dbcff[_0xcca6('0x13')];this[_0xcca6('0x14')]=_0x5dbcff[_0xcca6('0x14')];this['endtime']=_0x5dbcff[_0xcca6('0x14')];this[_0xcca6('0x15')]=getSeconds(_0x5dbcff['responsetime'],_0x5dbcff[_0xcca6('0x13')]);this[_0xcca6('0x16')]=0x0;this[_0xcca6('0x17')]=0x0;this[_0xcca6('0x18')]=_0x5dbcff[_0xcca6('0x18')];this[_0xcca6('0x19')]=_0x5dbcff['callbackuniqueid'];this['callbackat']=_0x5dbcff[_0xcca6('0x1a')];this[_0xcca6('0x1b')]=_0x5dbcff[_0xcca6('0x1b')];this[_0xcca6('0x1c')]=_0x5dbcff[_0xcca6('0x1c')];this[_0xcca6('0x1d')]=_0x5dbcff['ListId'];this[_0xcca6('0x1e')]=_0x5dbcff[_0xcca6('0x1e')];this['VoiceQueueId']=_0x5dbcff['VoiceQueueId'];this[_0xcca6('0x1f')]=_0x5dbcff[_0xcca6('0x1f')];this['originatecalleridnum']=_0x5dbcff[_0xcca6('0x20')]||'';this[_0xcca6('0x21')]=_0x5dbcff[_0xcca6('0x21')]||'';}module[_0xcca6('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 8f5895b..41914f6 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 _0xfbd1=['\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','stringify','milliseconds','diff','seconds','type','outbound','strategy','available','sumBillable','sumDuration','talking','total','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','format','voice_queue:save','campaign:ivr:%s','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','handlePredictive','ivr','string','\x22%s\x22\x20<%s>','error','stack','inspect','length','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','undefined','isNil','Action','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','[countReScheduled]\x20','resolve','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','saveInDb','pick','ContactId','ListId','UserId','[emptyContact]','isSuccess','Success','status','SIP/%s','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','outboundAnswerCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','[syncHangupInAMD]','value','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','VoiceQueueId','HANGUP','state','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialMachineMaxRetry','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','Unknow','reason','agent','agiafterat','dialQueueProject2','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','calleridname','calleridnum','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','actionid','locked','paused','stateinterface','push','queueStatusComplete','idHopper','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','Failure','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','handlePower','predictive','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','loggedIn','checkIfTime','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','checkDialMethod','[syncQueueSummary]','dialPreviewRecallmeReminder','\x5cw{0,','pow','replace','match','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','Contact','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNUM','trim','substring','dialCutDigit','SIP/%s/%s%s','from-sip','dialOriginateTimeout','[originate][error]','Error','originate\x20action\x20Error','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','round','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','agentBusyFactor','[CatchErlangB]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose]','Blacklist','inBlackList','handleIvr','[getContactCampaign2][Empty]','[actionOriginate]\x20','Contact.phone','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','dialOrderByScheduledAt','RUNNING','loggerHandler','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\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','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictiveCalls','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./final','./agentComplete','./hangup','env','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name'];(function(_0xf2b0c4,_0x5c9f52){var _0x5db9fb=function(_0x16e26f){while(--_0x16e26f){_0xf2b0c4['push'](_0xf2b0c4['shift']());}};_0x5db9fb(++_0x5c9f52);}(_0xfbd1,0x1c5));var _0x1fbd=function(_0x533897,_0x34e7c8){_0x533897=_0x533897-0x0;var _0x340bbd=_0xfbd1[_0x533897];return _0x340bbd;};'use strict';var util=require(_0x1fbd('0x0'));var _=require(_0x1fbd('0x1'));var BPromise=require(_0x1fbd('0x2'));var uuid=require(_0x1fbd('0x3'));var moment=require(_0x1fbd('0x4'));var rr=require('rr');var md5=require(_0x1fbd('0x5'));var Redis=require(_0x1fbd('0x6'));var ut=require(_0x1fbd('0x7'));var config=require(_0x1fbd('0x8'));var logger=require('../../../config/logger')(_0x1fbd('0x9'));var loggerBooked=require(_0x1fbd('0xa'))(_0x1fbd('0xb'));var loggerPredictive=require(_0x1fbd('0xa'))('predictive');var loggerPredictiveCalls=require(_0x1fbd('0xa'))(_0x1fbd('0xc'));var loggerSyncQueueSummary=require(_0x1fbd('0xa'))(_0x1fbd('0xd'));var ami=require(_0x1fbd('0xe'));config[_0x1fbd('0xf')]=_['defaults'](config[_0x1fbd('0xf')],{'host':'localhost','port':0x18eb});var io=require(_0x1fbd('0x10'))(new Redis(config[_0x1fbd('0xf')]));var cmHopper=require(_0x1fbd('0x11'));var cmHopperHistory=require(_0x1fbd('0x12'));var cmHopperBlack=require(_0x1fbd('0x13'));var voiceQueueRt=require(_0x1fbd('0x14'));var RpcSetting=require(_0x1fbd('0x15'));var Action=require(_0x1fbd('0x16'));var History=require('./history');var Final=require(_0x1fbd('0x17'));var AgentComplete=require(_0x1fbd('0x18'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x1fbd('0x19'));var ipAgi=process[_0x1fbd('0x1a')][_0x1fbd('0x1b')]||'127.0.0.1';var strategy={'rrmemory':_0x1fbd('0x1c'),'roundrobin':_0x1fbd('0x1d')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x1fbd('0x1e')][_0x1fbd('0x1f')]=function(_0x27daa9){this[_0x1fbd('0x20')]=this[_0x1fbd('0x20')]?this[_0x1fbd('0x20')][_0x1fbd('0x21')](_0x27daa9):_0x27daa9();};function Dialer(_0x4e87f2,_0x1076fe){this['sequence']=new Sequence();this[_0x1fbd('0x22')]=_0x1076fe;this[_0x1fbd('0x23')]=_0x4e87f2[_0x1fbd('0x23')];this[_0x1fbd('0x24')]=_0x4e87f2[_0x1fbd('0x24')];this['agents']=_0x4e87f2[_0x1fbd('0x25')];this[_0x1fbd('0x26')]=_0x4e87f2['trunks'];this[_0x1fbd('0x27')]=config['maxNumberOriginate']||0x2;this[_0x1fbd('0x28')]={};this[_0x1fbd('0x29')]={};this[_0x1fbd('0x2a')]={};this[_0x1fbd('0x2b')]={};this[_0x1fbd('0x2c')]={};this[_0x1fbd('0x2d')]={};this[_0x1fbd('0x2e')]={};this[_0x1fbd('0x2f')]={};this[_0x1fbd('0x30')]={};this[_0x1fbd('0x31')]={};ami['on'](_0x1fbd('0x32'),this[_0x1fbd('0x33')][_0x1fbd('0x34')](this));ami['on']('queuecallerabandon',this[_0x1fbd('0x35')][_0x1fbd('0x34')](this));ami['on'](_0x1fbd('0x36'),this[_0x1fbd('0x37')][_0x1fbd('0x34')](this));ami['on'](_0x1fbd('0x38'),this['syncAgentComplete']['bind'](this));ami['on']('custom:queuesummary',this[_0x1fbd('0xd')]['bind'](this));ami['on'](_0x1fbd('0x39'),this[_0x1fbd('0x3a')][_0x1fbd('0x34')](this));ami['on'](_0x1fbd('0x3b'),this[_0x1fbd('0x3c')][_0x1fbd('0x34')](this));ami['on'](_0x1fbd('0x3d'),this[_0x1fbd('0x3e')][_0x1fbd('0x34')](this));ami['on'](_0x1fbd('0x3f'),this[_0x1fbd('0x40')][_0x1fbd('0x34')](this));ami['on'](_0x1fbd('0x41'),this[_0x1fbd('0x42')]['bind'](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting[_0x1fbd('0x43')]()[_0x1fbd('0x44')](function(_0x48929a){previewRecallmeReminderInterval=_0x48929a[_0x1fbd('0x45')];});}function isNotNull(_0x3a5c86){return _0x3a5c86!==null&&!_[_0x1fbd('0x46')](_0x3a5c86);}function checkIsLoggedIn(_0x1ad585,_0x3fc05e){return function(){if(_0x3fc05e<=0x0){_0x1ad585[_0x1fbd('0x47')]=_0x1fbd('0x48');throw _0x1ad585[_0x1fbd('0x49')]+_0x1fbd('0x4a');}};}function isActive(_0x4cdd01){return _0x4cdd01;}function checkIsActive(_0x368ec2,_0x172e89){return function(){if(!isActive(_0x172e89)){_0x368ec2[_0x1fbd('0x47')]=_0x1fbd('0x4b');throw _0x368ec2[_0x1fbd('0x49')]+'\x20NOT\x20Active';}};}function checkInterval(_0x333f4f){return function(){if(!isNotNull(_0x333f4f[_0x1fbd('0x4c')])){_0x333f4f[_0x1fbd('0x47')]=_0x1fbd('0x4d');throw _0x333f4f['name']+_0x1fbd('0x4e');}if(!isNotNull(_0x333f4f[_0x1fbd('0x4c')][_0x1fbd('0x4f')])){_0x333f4f[_0x1fbd('0x47')]=_0x1fbd('0x4d');throw _0x333f4f['name']+_0x1fbd('0x4e');}if(!isNotNull(_[_0x1fbd('0x50')](_0x333f4f[_0x1fbd('0x4c')][_0x1fbd('0x4f')]))){_0x333f4f['message']=_0x1fbd('0x4d');throw _0x333f4f[_0x1fbd('0x49')]+_0x1fbd('0x4e');}};}function msgResponse(_0x422c34,_0x46f338,_0x2420d0){return{'action':_0x422c34,'response':_0x46f338,'message':_0x2420d0,'stack':_0x2420d0};}function myreject(_0x22cd63){return function(_0x3e59f){return _0x22cd63(msgResponse(_0x1fbd('0x51'),'Error',JSON[_0x1fbd('0x52')](_0x3e59f)));};}function getSeconds(_0x377ff4,_0x44b0d3){var _0x82770d=moment(_0x377ff4)['milliseconds'](0x0);var _0x4c9522=moment(_0x44b0d3)[_0x1fbd('0x53')](0x0);return _0x82770d[_0x1fbd('0x54')](_0x4c9522,_0x1fbd('0x55'));}function emit(_0x3553b8,_0x4d9f1e,_0xae99cc){io['to'](_0x3553b8)['emit'](_0x4d9f1e,_0xae99cc);}function emitVoiceQueueSummary(_0x45c016){if(_0x45c016[_0x1fbd('0x56')]===_0x1fbd('0x57')){var _0x4d790b={'id':_0x45c016['id'],'name':_0x45c016[_0x1fbd('0x49')],'strategy':_0x45c016[_0x1fbd('0x58')],'answered':_0x45c016['answered'],'available':_0x45c016[_0x1fbd('0x59')],'loggedIn':_0x45c016['loggedIn'],'pTalking':_0x45c016['pTalking'],'sumBillable':_0x45c016[_0x1fbd('0x5a')],'sumDuration':_0x45c016[_0x1fbd('0x5b')],'sumHoldTime':_0x45c016['sumHoldTime']||0x0,'talking':_0x45c016[_0x1fbd('0x5c')],'total':_0x45c016[_0x1fbd('0x5d')],'type':_0x45c016[_0x1fbd('0x56')],'unmanaged':_0x45c016[_0x1fbd('0x5e')],'abandoned':_0x45c016['abandoned'],'waiting':_0x45c016['waiting'],'loggedInDb':_0x45c016[_0x1fbd('0x5f')],'dialActive':_0x45c016[_0x1fbd('0x60')],'dialMethod':_0x45c016[_0x1fbd('0x61')],'dialOriginateCallerIdName':_0x45c016[_0x1fbd('0x62')],'dialOriginateCallerIdNumber':_0x45c016['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x45c016['dialOriginateTimeout'],'dialPrefix':_0x45c016[_0x1fbd('0x63')],'outboundAnswerAgiCallsDay':_0x45c016[_0x1fbd('0x64')],'outboundAnswerCallsDay':_0x45c016['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x45c016[_0x1fbd('0x65')],'outboundBusyCallsDay':_0x45c016['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x45c016['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x45c016[_0x1fbd('0x66')],'outboundDropCallsDayCallersExit':_0x45c016[_0x1fbd('0x67')],'outboundDropCallsDayTimeout':_0x45c016[_0x1fbd('0x68')],'outboundNoAnswerCallsDay':_0x45c016[_0x1fbd('0x69')],'outboundNoSuchCallsDay':_0x45c016[_0x1fbd('0x6a')],'outboundOriginateFailureCallsDay':_0x45c016[_0x1fbd('0x6b')],'outboundReCallsDay':_0x45c016[_0x1fbd('0x6c')],'outboundRejectCallsDay':_0x45c016[_0x1fbd('0x6d')],'outboundUnknownCallsDay':_0x45c016['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x45c016[_0x1fbd('0x6e')],'predictiveIntervalAvgHoldtime':_0x45c016[_0x1fbd('0x6f')],'predictiveIntervalAvgTalktime':_0x45c016['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x45c016['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x45c016[_0x1fbd('0x70')],'predictiveIntervalErlangCalls':_0x45c016[_0x1fbd('0x71')],'predictiveIntervalErlangCallsDroppedCalls':_0x45c016[_0x1fbd('0x72')],'predictiveIntervalHitRate':_0x45c016[_0x1fbd('0x73')],'predictiveIntervalMultiplicativeFactor':_0x45c016[_0x1fbd('0x74')],'predictiveIntervalPauses':_0x45c016[_0x1fbd('0x75')],'predictiveIntervalAvailable':_0x45c016[_0x1fbd('0x76')],'predictiveIntervalTotalCalls':_0x45c016[_0x1fbd('0x77')],'message':_0x45c016[_0x1fbd('0x47')],'originated':_0x45c016['originated'],'erlangCalls':_0x45c016[_0x1fbd('0x78')],'erlangCallToSecond':_0x45c016[_0x1fbd('0x79')],'erlangAbandonmentRate':_0x45c016['erlangAbandonmentRate'],'erlangBusyFactor':_0x45c016[_0x1fbd('0x7a')],'startPredictive':_0x45c016[_0x1fbd('0x2d')],'startProgressive':_0x45c016[_0x1fbd('0x2e')]};if(_0x45c016[_0x1fbd('0x7b')]){_0x4d790b[_0x1fbd('0x7b')]={'id':_0x45c016['Trunk']['id'],'name':_0x45c016[_0x1fbd('0x7b')][_0x1fbd('0x49')],'active':_0x45c016[_0x1fbd('0x7b')][_0x1fbd('0x7c')],'callerid':_0x45c016[_0x1fbd('0x7b')][_0x1fbd('0x7d')]};}if(_0x45c016[_0x1fbd('0x4c')]){_0x4d790b[_0x1fbd('0x4c')]={'id':_0x45c016['Interval']['id'],'name':_0x45c016[_0x1fbd('0x4c')][_0x1fbd('0x49')]};}var _0x56fa99=md5(JSON[_0x1fbd('0x52')](_0x4d790b));if(_0x45c016['md5']!==_0x56fa99){_0x45c016['md5']=_0x56fa99;emit(util[_0x1fbd('0x7e')]('voice:queue:%s',_0x4d790b[_0x1fbd('0x49')]),_0x1fbd('0x7f'),_0x4d790b);}}}function emitCampaignSummary(_0x3e7fb8){if(_0x3e7fb8['type']==='ivr'){emit(util[_0x1fbd('0x7e')](_0x1fbd('0x80'),_0x3e7fb8[_0x1fbd('0x49')]),'campaign:save',_0x3e7fb8);}}function checkGetDataPredictive(_0x1af393){if(isNotNull(_0x1af393)&&!_['isEmpty'](_0x1af393)){loggerPredictive['info'](_0x1fbd('0x81'));loggerPredictive['info'](_0x1fbd('0x82'),_0x1af393[_0x1fbd('0x77')]);loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x84'),_0x1af393[_0x1fbd('0x6e')]);loggerPredictive[_0x1fbd('0x83')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1af393[_0x1fbd('0x70')]);loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x85'),_0x1af393[_0x1fbd('0x86')]);loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x87'),_0x1af393[_0x1fbd('0x6f')]);loggerPredictive[_0x1fbd('0x83')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1af393['predictiveIntervalAvgTalktime']);loggerPredictive['info']('---------------------------');if(_0x1af393[_0x1fbd('0x77')]>0x0){if(!_[_0x1fbd('0x46')](_0x1af393[_0x1fbd('0x88')])&&_0x1af393[_0x1fbd('0x88')]>0x0){return!![];}loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x89'));if(!_[_0x1fbd('0x46')](_0x1af393[_0x1fbd('0x6f')])&&_0x1af393['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x1fbd('0x83')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x8a'));}}else{loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x8b'));}return![];}function mergeDataErlangB(_0x53e3ba){return function(_0xce7005){loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x8c'));loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x8d'),_0xce7005['erlangCalls']);loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x8e'),_0xce7005[_0x1fbd('0x79')]);loggerPredictive[_0x1fbd('0x83')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xce7005[_0x1fbd('0x8f')]);loggerPredictive[_0x1fbd('0x83')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xce7005[_0x1fbd('0x7a')]);loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x90'),_0xce7005[_0x1fbd('0x8f')]);loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x91'));_[_0x1fbd('0x92')](_0x53e3ba,_0xce7005);};}function getDiff(_0x200e91){var _0x3a6b2b=moment()[_0x1fbd('0x53')](0x0);var _0x3e1648=moment(_0x200e91)['milliseconds'](0x0);return _0x3a6b2b[_0x1fbd('0x54')](_0x3e1648,_0x1fbd('0x55'));}function ifInterval(_0x300dde,_0x2d12bc){if(_[_0x1fbd('0x46')](_0x2d12bc)){return![];}return getDiff(_0x2d12bc)<_0x300dde*0x3c;}function freeVariablesPredictive(_0x116f34){if(isNotNull(_0x116f34)){if(!_['isUndefined'](_0x116f34[_0x1fbd('0x2e')])){_0x116f34['startProgressive']=undefined;loggerPredictive[_0x1fbd('0x83')](_0x116f34['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x1fbd('0x46')](_0x116f34[_0x1fbd('0x2d')])){_0x116f34[_0x1fbd('0x2d')]=undefined;loggerPredictive['info'](_0x116f34[_0x1fbd('0x49')],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x116f34[_0x1fbd('0x93')])){clearInterval(_0x116f34[_0x1fbd('0x93')]);_0x116f34[_0x1fbd('0x93')]=undefined;loggerPredictive[_0x1fbd('0x83')](_0x116f34['name'],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x1db2cc,_0x336a92){if(_0x336a92===0x0){return 0x0;}var _0x5386f9=0x1;for(var _0x2a09a0=0x1;_0x2a09a0<=_0x336a92;_0x2a09a0+=0x1){_0x5386f9=0x1+_0x5386f9*_0x2a09a0/_0x1db2cc;}return 0x1/_0x5386f9;}function isVoiceQueueOutbound(_0x2cd7bf){return _0x2cd7bf===_0x1fbd('0x57');}function isNotPreview(_0x8e7545){return _0x8e7545!==_0x1fbd('0x22');}function isCampaignIvr(_0x582b00){return _0x582b00===_0x1fbd('0x94');}function getCallerId(_0x3ce38d,_0x156cb8,_0x416356){if(!_[_0x1fbd('0x46')](_0x416356)&&typeof _0x416356==='string'&&!_[_0x1fbd('0x50')](_0x416356)){if(!_[_0x1fbd('0x46')](_0x156cb8)&&typeof _0x156cb8===_0x1fbd('0x95')&&!_[_0x1fbd('0x50')](_0x156cb8)){return util[_0x1fbd('0x7e')](_0x1fbd('0x96'),_0x156cb8,_0x416356);}return util[_0x1fbd('0x7e')]('\x22%s\x22\x20<%s>',_0x416356,_0x416356);}if(!_[_0x1fbd('0x46')](_0x3ce38d)&&typeof _0x3ce38d===_0x1fbd('0x95')&&!_[_0x1fbd('0x50')](_0x3ce38d)){return _0x3ce38d;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x381e9b,_0x32c0f7){return function(_0x2ffcda){freeVariablesPredictive(_0x32c0f7);emitVoiceQueueSummary(_0x32c0f7);emitCampaignSummary(_0x32c0f7);loggerSyncQueueSummary[_0x1fbd('0x97')](_0x381e9b,util['inspect'](_0x2ffcda,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3c0f6e,_0x27f860){return function(_0x2721f6){loggerPredictive[_0x1fbd('0x97')](_0x27f860[_0x1fbd('0x49')],_0x3c0f6e);loggerPredictive[_0x1fbd('0x97')](_0x2721f6[_0x1fbd('0x98')]);freeVariablesPredictive(_0x27f860);};}function loggerCatch(_0x19ff39){return function(_0x232a09){logger[_0x1fbd('0x97')](_0x19ff39,util[_0x1fbd('0x99')](_0x232a09,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x22f488){return _0x22f488&&!_[_0x1fbd('0x46')](_0x22f488)&&_0x22f488[_0x1fbd('0x9a')]>0x0;}function decremetOriginate(_0x324105){if(!_[_0x1fbd('0x46')](_0x324105)&&_0x324105!==null){if(typeof _0x324105[_0x1fbd('0x9b')]!=='undefined'){if(_0x324105[_0x1fbd('0x9b')]>0x0){_0x324105['originated']-=0x1;}else{logger[_0x1fbd('0x97')](_0x1fbd('0x9c'));}}}else{logger[_0x1fbd('0x97')](_0x1fbd('0x9d'));}}function checkContactLowerLimitOriginate(_0x1c8c6c,_0x3cd94a,_0x11aa4b){if(_0x3cd94a>_0x11aa4b){for(var _0x43ae90=0x0;_0x43ae90<_0x3cd94a-_0x11aa4b;_0x43ae90+=0x1){decremetOriginate(_0x1c8c6c);}}}function loggerGetContactDialer(_0x3faae1,_0x5c1829,_0x1966f4){return function(_0x20a168){checkContactLowerLimitOriginate(_0x5c1829,_0x1966f4,0x0);logger[_0x1fbd('0x97')](_0x3faae1,util[_0x1fbd('0x99')](_0x20a168,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x96a460){return function(_0x4caaa0){if(isNotNull(_0x4caaa0)&&isNotNull(_0x4caaa0[0x0])){if(_0x4caaa0[0x0][_0x1fbd('0x9e')]>0x0){_0x96a460[_0x1fbd('0x47')]=_0x1fbd('0x9f');logger['info'](_0x1fbd('0xa0')+_0x96a460['name'],_0x4caaa0[0x0][_0x1fbd('0x9e')],_0x1fbd('0xa1'));}else{_0x96a460[_0x1fbd('0x47')]=_0x1fbd('0xa2');logger['info'](_0x1fbd('0xa3')+_0x96a460['name']);}}};}function notSendMessagesQueue(_0x4d278e){if(_0x4d278e[_0x1fbd('0xa4')]){freeVariablesPredictive(_0x4d278e);if(_0x4d278e[_0x1fbd('0x9b')]===0x0&&_0x4d278e[_0x1fbd('0x5c')]===0x0&&_0x4d278e[_0x1fbd('0xa5')]===0x0&&(_0x4d278e[_0x1fbd('0xa6')]||0x0)===0x0){_0x4d278e['sendMessageOneNotActive']=![];_0x4d278e[_0x1fbd('0x59')]=0x0;_0x4d278e[_0x1fbd('0x47')]=_0x1fbd('0x4b');loggerSyncQueueSummary[_0x1fbd('0x97')](_0x1fbd('0xa7'),_0x4d278e['name'],_0x1fbd('0xa8'));}else{_0x4d278e['message']=_0x1fbd('0xa9');loggerSyncQueueSummary[_0x1fbd('0x97')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x4d278e['name'],_0x1fbd('0xaa'));}emitVoiceQueueSummary(_0x4d278e);}}function notSendMessagesCampaign(_0x1a93fd){if(_0x1a93fd[_0x1fbd('0xa4')]){if(_0x1a93fd[_0x1fbd('0x9b')]===0x0){_0x1a93fd[_0x1fbd('0xa4')]=![];_0x1a93fd[_0x1fbd('0x47')]=_0x1fbd('0x4b');loggerSyncQueueSummary['error'](_0x1fbd('0xab'),_0x1a93fd[_0x1fbd('0x49')],_0x1fbd('0xa8'));}else{_0x1a93fd[_0x1fbd('0x47')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x1fbd('0x97')](_0x1fbd('0xab'),_0x1a93fd[_0x1fbd('0x49')],'is\x20disactive');}emitCampaignSummary(_0x1a93fd);}}function createObjHistory(_0x2ec003,_0x482d4f,_0x4c98b5,_0x5b850a,_0x3e400a){_0x2ec003['message']=_0x4c98b5;var _0x1087ee=new Action(_0x2ec003,_0x482d4f);var _0x4ad9c1=new History(_0x1087ee);_0x4ad9c1['state']=_0x5b850a;_0x4ad9c1[_0x1fbd('0xac')]=_0x3e400a;_0x4ad9c1[_0x1fbd('0xad')]=_0x1087ee[_0x1fbd('0xae')];return _0x4ad9c1;}Dialer[_0x1fbd('0x1e')][_0x1fbd('0xaf')]=function(){var _0xef0c8e=this;setInterval(function(){_0xef0c8e[_0x1fbd('0xb0')](_0xef0c8e[_0x1fbd('0x2b')],_0x1fbd('0xb1'));_0xef0c8e['clearZombieChannels'](_0xef0c8e[_0x1fbd('0x29')],_0x1fbd('0xb2'));},0x32c8);};Dialer['prototype'][_0x1fbd('0xb0')]=function(_0xd00a12,_0xa3a65c){var _0x14c2d4=this;for(var _0x28e252 in _0xd00a12){if(typeof _0xd00a12[_0x28e252]!==_0x1fbd('0xb3')){this['sequence']['enqueue'](function(){if(!_[_0x1fbd('0xb4')](_0xd00a12[_0x28e252])){return ami[_0x1fbd('0xb5')]({'action':'status','channel':_0xd00a12[_0x28e252][_0x1fbd('0xb6')]})[_0x1fbd('0xb7')](function(_0x1f067d){if(_0x1f067d[_0x1fbd('0x47')]===_0x1fbd('0xb8')){setTimeout(function(){if(_0xd00a12[_0x28e252]&&_0xd00a12[_0x28e252][_0x1fbd('0x56')]!=='ivr'){_0x14c2d4[_0x1fbd('0xb9')](_0x14c2d4[_0x1fbd('0x23')][_0xd00a12[_0x28e252][_0x1fbd('0xba')]]);logger['error'](_0x1fbd('0xbb'),_0xa3a65c,_0x28e252,_0xd00a12[_0x28e252][_0x1fbd('0xba')]);delete _0xd00a12[_0x28e252];}if(_0xd00a12[_0x28e252]&&_0xd00a12[_0x28e252][_0x1fbd('0x56')]==='ivr'){_0x14c2d4[_0x1fbd('0xb9')](_0x14c2d4[_0x1fbd('0x24')][_0xd00a12[_0x28e252][_0x1fbd('0xba')]]);logger['error'](_0x1fbd('0xbc'),_0xa3a65c,_0x28e252,_0xd00a12[_0x28e252][_0x1fbd('0xba')]);delete _0xd00a12[_0x28e252];}},0x2328);}});}});}}};Dialer['prototype'][_0x1fbd('0xbd')]=function(_0x500fc1){return BPromise['resolve']()[_0x1fbd('0x44')](cmHopper[_0x1fbd('0xbd')](_0x500fc1))[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0xbe')));};Dialer[_0x1fbd('0x1e')]['checkIsBlackList']=function(_0x5e6494){return BPromise[_0x1fbd('0xbf')]()[_0x1fbd('0x44')](cmHopperBlack[_0x1fbd('0xc0')](_0x5e6494))[_0x1fbd('0xb7')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x1fbd('0x1e')]['checkIsBlackListIvr']=function(_0x484e25){return BPromise[_0x1fbd('0xbf')]()[_0x1fbd('0x44')](cmHopperBlack[_0x1fbd('0xc1')](_0x484e25))['catch'](loggerCatch(_0x1fbd('0xc2')));};Dialer[_0x1fbd('0x1e')][_0x1fbd('0xc3')]=function(_0x448856){return BPromise[_0x1fbd('0xbf')]()['then'](cmHopperHistory[_0x1fbd('0xc4')](_0x448856))[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0xc5')));};Dialer[_0x1fbd('0x1e')][_0x1fbd('0xc6')]=function(_0xd7915c){return BPromise['resolve']()[_0x1fbd('0x44')](cmHopper[_0x1fbd('0xc6')](_0xd7915c))[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0xc7')));};Dialer[_0x1fbd('0x1e')][_0x1fbd('0xc8')]=function(_0x2e8a4a,_0x1ea274,_0x24c7b6){return BPromise[_0x1fbd('0xbf')]()[_0x1fbd('0x44')](cmHopper[_0x1fbd('0xc8')](_0x2e8a4a,_0x1ea274,_0x24c7b6))[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0xc9')));};Dialer['prototype'][_0x1fbd('0xca')]=function(_0x5b2f87,_0x13c2bb,_0x50d47e,_0x9f824b,_0x5ab2d2){return BPromise[_0x1fbd('0xbf')]()[_0x1fbd('0x44')](cmHopper[_0x1fbd('0xca')](_0x5b2f87,_0x13c2bb,_0x50d47e,_0x9f824b))[_0x1fbd('0xb7')](function(_0x33bd96){_0x5ab2d2['temp']-=_0x50d47e;_0x5ab2d2[_0x1fbd('0xcb')]=_0x5ab2d2['temp']>0x0?_0x5ab2d2['temp']:0x0;loggerCatch(_0x1fbd('0xcc'))(_0x33bd96);});};Dialer[_0x1fbd('0x1e')][_0x1fbd('0xcd')]=function(_0x494b76,_0x316387,_0x38e26a,_0x36edc5){return BPromise[_0x1fbd('0xbf')]()['then'](cmHopper[_0x1fbd('0xcd')](_0x494b76,_0x316387,_0x38e26a))[_0x1fbd('0xb7')](function(_0x32802c){_0x36edc5[_0x1fbd('0xcb')]-=_0x316387;_0x36edc5[_0x1fbd('0xcb')]=_0x36edc5[_0x1fbd('0xcb')]>0x0?_0x36edc5['temp']:0x0;loggerCatch(_0x1fbd('0xce'))(_0x32802c);});};Dialer[_0x1fbd('0x1e')][_0x1fbd('0xcf')]=function(_0x521771){return BPromise[_0x1fbd('0xbf')]()[_0x1fbd('0x44')](voiceQueueRt[_0x1fbd('0xcf')](_0x521771))[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0xd0')));};Dialer[_0x1fbd('0x1e')][_0x1fbd('0xd1')]=function(_0x168b7b){return BPromise[_0x1fbd('0xbf')]()[_0x1fbd('0x44')](cmHopper['moveContactManagedDialer'](_0x168b7b))[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0xd2')));};Dialer['prototype'][_0x1fbd('0xd3')]=function(_0x49a1f7){return BPromise[_0x1fbd('0xbf')]()['then'](cmHopperHistory[_0x1fbd('0xd3')](_0x49a1f7))[_0x1fbd('0xb7')](loggerCatch('[createHistory]\x20'));};Dialer[_0x1fbd('0x1e')]['updateOriginated']=function(_0x470941){if(!_[_0x1fbd('0x46')](_0x470941)&&_0x470941!==null){if(typeof _0x470941[_0x1fbd('0x9b')]!==_0x1fbd('0xb3')){if(_0x470941[_0x1fbd('0x9b')]>0x0){_0x470941['originated']-=0x1;}else{logger[_0x1fbd('0x97')](_0x1fbd('0xd4'));}}}else{logger[_0x1fbd('0x97')](_0x1fbd('0xd5'));}};Dialer['prototype']['loggerHandler']=function(_0x28fc00,_0x53a5bd){var _0x208e87=this;return function(_0x1a255d){_0x208e87['updateOriginated'](_0x53a5bd);logger[_0x1fbd('0x97')](_0x28fc00,util[_0x1fbd('0x99')](_0x1a255d,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x1fbd('0xd6')]=function(_0x338fdb,_0x3064df,_0x9de9e){var _0x1a6466={'state':0x19,'statedesc':'notFound'};this[_0x1fbd('0xb9')](_0x3064df);this[_0x1fbd('0xd7')](_[_0x1fbd('0x92')](_0x1a6466,_[_0x1fbd('0xd8')](_0x9de9e,[_0x1fbd('0xd9'),_0x1fbd('0xda'),_0x1fbd('0xdb'),'VoiceQueueId','CampaignId'])),'[emptyContact][createHistory]',_0x1fbd('0xdc'));logger['error'](_0x338fdb);};Dialer[_0x1fbd('0x1e')][_0x1fbd('0xdd')]=function(_0x46bb15){return _0x46bb15===_0x1fbd('0xde');};Dialer['prototype']['isTrunkReachable']=function(_0x4325d4){return!_['isUndefined'](_0x4325d4)&&_0x4325d4&&!_['isUndefined'](_0x4325d4[_0x1fbd('0x49')])&&!_[_0x1fbd('0x46')](_0x4325d4['active'])&&_0x4325d4[_0x1fbd('0x7c')]&&(this[_0x1fbd('0x26')][util[_0x1fbd('0x7e')]('SIP/%s',_0x4325d4[_0x1fbd('0x49')])][_0x1fbd('0xdf')]==='reachable'||this[_0x1fbd('0x26')][util[_0x1fbd('0x7e')](_0x1fbd('0xe0'),_0x4325d4[_0x1fbd('0x49')])]['status']===_0x1fbd('0xe1'));};Dialer[_0x1fbd('0x1e')]['saveInDb']=function(_0x1e4f51,_0x154c6f,_0x180fef){this[_0x1fbd('0xd3')](_0x1e4f51)[_0x1fbd('0xb7')](loggerCatch(_0x154c6f));this[_0x1fbd('0xd1')](_0x1e4f51)[_0x1fbd('0xb7')](loggerCatch(_0x180fef));};Dialer[_0x1fbd('0x1e')][_0x1fbd('0x3e')]=function(_0x2c461c){var _0x3ec3d2=this[_0x1fbd('0x2b')][_0x2c461c[_0x1fbd('0xe2')]];var _0x13f0db;if(!_[_0x1fbd('0xb4')](_0x2c461c)&&!_[_0x1fbd('0xb4')](_0x2c461c[_0x1fbd('0xe3')])&&!_['isNil'](_0x2c461c['variable'][_0x1fbd('0xe4')])&&_0x2c461c[_0x1fbd('0xe5')]===_0x1fbd('0xe6')&&_0x3ec3d2){if(_0x3ec3d2[_0x1fbd('0x56')]!=='ivr'&&this[_0x1fbd('0x23')][_0x3ec3d2['queue']][_0x1fbd('0xe7')]&&_0x2c461c['value']==='HANGUP'){delete this[_0x1fbd('0x2b')][_0x2c461c['uniqueid']];this['updateOriginated'](this[_0x1fbd('0x23')][_0x3ec3d2[_0x1fbd('0xba')]]);this[_0x1fbd('0x23')][_0x3ec3d2[_0x1fbd('0xba')]][_0x1fbd('0xe8')]+=0x1;this[_0x1fbd('0x23')][_0x3ec3d2[_0x1fbd('0xba')]][_0x1fbd('0x64')]+=0x1;_0x13f0db=new Hangup(_0x3ec3d2,_0x2c461c);_0x13f0db['state']=0x12;_0x13f0db['statedesc']=_0x1fbd('0xe9');_0x13f0db[_0x1fbd('0xea')]=_0x1fbd('0xeb');ami[_0x1fbd('0xec')](_0x1fbd('0xed'),ut[_0x1fbd('0xee')](_0x13f0db,'amd'));this[_0x1fbd('0xd7')](_0x13f0db,'[syncHangupInAMD][createHistory]',_0x1fbd('0xef'));}if(_0x3ec3d2['type']!==_0x1fbd('0x94')&&this['voiceQueues'][_0x3ec3d2[_0x1fbd('0xba')]][_0x1fbd('0xe7')]&&_0x2c461c[_0x1fbd('0xf0')]===_0x1fbd('0xf1')){var _0x206f0d=this;return new BPromise(function(_0x23ee68,_0x1292d5){delete _0x206f0d[_0x1fbd('0x2b')][_0x2c461c['uniqueid']];_0x206f0d[_0x1fbd('0xb9')](_0x206f0d[_0x1fbd('0x23')][_0x3ec3d2[_0x1fbd('0xba')]]);_0x206f0d['voiceQueues'][_0x3ec3d2[_0x1fbd('0xba')]][_0x1fbd('0xe8')]+=0x1;_0x206f0d[_0x1fbd('0x23')][_0x3ec3d2['queue']][_0x1fbd('0x64')]+=0x1;var _0x2ce11f=_0x206f0d[_0x1fbd('0x23')][_0x3ec3d2['queue']];var _0x4ea8fe=new Hangup(_0x3ec3d2,_0x2c461c);_0x4ea8fe['state']=0x13;_0x4ea8fe[_0x1fbd('0xac')]=_0x1fbd('0xf2');_0x4ea8fe[_0x1fbd('0xea')]=_0x1fbd('0xeb');_0x4ea8fe[_0x1fbd('0xf3')]+=0x1;_0x4ea8fe[_0x1fbd('0xf4')]+=0x1;_0x4ea8fe[_0x1fbd('0xf5')]=!![];ami[_0x1fbd('0xec')](_0x1fbd('0xed'),ut['buildObj'](_0x4ea8fe,_0x1fbd('0xf5')));_0x206f0d[_0x1fbd('0xd3')](_0x4ea8fe)[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0xf6')));if(_0x4ea8fe[_0x1fbd('0xf7')]+_0x4ea8fe[_0x1fbd('0xf8')]+_0x4ea8fe[_0x1fbd('0xf9')]+_0x4ea8fe[_0x1fbd('0xfa')]+_0x4ea8fe[_0x1fbd('0xfb')]+_0x4ea8fe[_0x1fbd('0xfc')]+_0x4ea8fe[_0x1fbd('0xf3')]+_0x4ea8fe[_0x1fbd('0xfd')]>=_0x2ce11f[_0x1fbd('0xfe')]){_0x206f0d[_0x1fbd('0xff')](_0x4ea8fe,_0x23ee68,_0x1292d5,_0x1fbd('0x100'));}else{if(_0x4ea8fe['countmachineretry']>=_0x2ce11f['dialMachineMaxRetry']){_0x206f0d[_0x1fbd('0x101')](_0x4ea8fe,_0x23ee68,_0x1292d5,_0x1fbd('0x102'));}else{_0x206f0d['rescheduleContact']({'active':![],'countmachineretry':_0x4ea8fe[_0x1fbd('0xf3')],'scheduledat':moment()[_0x1fbd('0x103')](_0x2ce11f[_0x1fbd('0x104')],_0x1fbd('0x105'))[_0x1fbd('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4ea8fe[_0x1fbd('0xd9')],'ListId':_0x4ea8fe[_0x1fbd('0xda')],'VoiceQueueId':_0x4ea8fe[_0x1fbd('0x106')]||undefined,'CampaignId':_0x4ea8fe['CampaignId']||undefined})[_0x1fbd('0xb7')](loggerCatch('[rescheduleContact][Machine]'));_0x23ee68({'reschedule':0x1});}}});}if(_0x3ec3d2['type']==='ivr'&&this[_0x1fbd('0x24')][_0x3ec3d2[_0x1fbd('0xba')]][_0x1fbd('0xe7')]&&_0x2c461c[_0x1fbd('0xf0')]===_0x1fbd('0x107')){delete this[_0x1fbd('0x2b')][_0x2c461c[_0x1fbd('0xe2')]];this[_0x1fbd('0xb9')](this[_0x1fbd('0x24')][_0x3ec3d2[_0x1fbd('0xba')]]);_0x13f0db=new Hangup(_0x3ec3d2,_0x2c461c);_0x13f0db[_0x1fbd('0x108')]=0x12;_0x13f0db[_0x1fbd('0xac')]=_0x1fbd('0xe9');_0x13f0db[_0x1fbd('0xea')]=_0x1fbd('0xeb');ami['emit'](_0x1fbd('0xed'),ut['buildObj'](_0x13f0db,_0x1fbd('0xf5')));this[_0x1fbd('0xd7')](_0x13f0db,_0x1fbd('0x109'),_0x1fbd('0x10a'));}if(_0x3ec3d2[_0x1fbd('0x56')]===_0x1fbd('0x94')&&this[_0x1fbd('0x24')][_0x3ec3d2['queue']][_0x1fbd('0xe7')]&&_0x2c461c[_0x1fbd('0xf0')]===_0x1fbd('0xf1')){var _0x206f0d=this;return new BPromise(function(_0x286df4,_0x1649b5){delete _0x206f0d[_0x1fbd('0x2b')][_0x2c461c['uniqueid']];_0x206f0d[_0x1fbd('0xb9')](_0x206f0d['campaigns'][_0x3ec3d2['queue']]);_0x206f0d[_0x1fbd('0x24')][_0x3ec3d2[_0x1fbd('0xba')]][_0x1fbd('0xe8')]+=0x1;_0x206f0d[_0x1fbd('0x24')][_0x3ec3d2[_0x1fbd('0xba')]][_0x1fbd('0x64')]+=0x1;var _0xa5798d=_0x206f0d[_0x1fbd('0x24')][_0x3ec3d2[_0x1fbd('0xba')]];var _0x1a87d3=new Hangup(_0x3ec3d2,_0x2c461c);_0x1a87d3[_0x1fbd('0x108')]=0x13;_0x1a87d3[_0x1fbd('0xac')]=_0x1fbd('0xf2');_0x1a87d3[_0x1fbd('0xea')]=_0x1fbd('0xeb');_0x1a87d3[_0x1fbd('0xf3')]+=0x1;_0x1a87d3['countglobal']+=0x1;_0x1a87d3['amd']=!![];ami[_0x1fbd('0xec')]('custom:amd',ut['buildObj'](_0x1a87d3,_0x1fbd('0xf5')));_0x206f0d[_0x1fbd('0xd3')](_0x1a87d3)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1a87d3['countbusyretry']+_0x1a87d3['countcongestionretry']+_0x1a87d3[_0x1fbd('0xf9')]+_0x1a87d3[_0x1fbd('0xfa')]+_0x1a87d3['countdropretry']+_0x1a87d3[_0x1fbd('0xfc')]+_0x1a87d3[_0x1fbd('0xf3')]+_0x1a87d3[_0x1fbd('0xfd')]>=_0xa5798d[_0x1fbd('0xfe')]){_0x206f0d['stateGlobal'](_0x1a87d3,_0x286df4,_0x1649b5,_0x1fbd('0x100'));}else{if(_0x1a87d3[_0x1fbd('0xf3')]>=_0xa5798d[_0x1fbd('0x10b')]){_0x206f0d['createStateFinal'](_0x1a87d3,_0x286df4,_0x1649b5,'reason\x2019\x20machine....');}else{_0x206f0d[_0x1fbd('0xc6')]({'active':![],'countmachineretry':_0x1a87d3[_0x1fbd('0xf3')],'scheduledat':moment()[_0x1fbd('0x103')](_0xa5798d[_0x1fbd('0x104')],_0x1fbd('0x105'))[_0x1fbd('0x7e')](_0x1fbd('0x10c')),'ContactId':_0x1a87d3[_0x1fbd('0xd9')],'ListId':_0x1a87d3[_0x1fbd('0xda')],'VoiceQueueId':_0x1a87d3[_0x1fbd('0x106')]||undefined,'CampaignId':_0x1a87d3[_0x1fbd('0x10d')]||undefined})['catch'](loggerCatch(_0x1fbd('0x10e')));_0x286df4({'reschedule':0x1});}}});}}};Dialer[_0x1fbd('0x1e')][_0x1fbd('0x3a')]=function(_0x16ed69){var _0x3e3791=this['uniqueId'][_0x16ed69[_0x1fbd('0xe2')]];var _0x2deffb=this;var _0xb377dd;if(_0x3e3791&&_0x3e3791[_0x1fbd('0x56')]==='ivr'){delete this[_0x1fbd('0x2b')][_0x16ed69[_0x1fbd('0xe2')]];this[_0x1fbd('0xb9')](this[_0x1fbd('0x24')][_0x3e3791[_0x1fbd('0xba')]]);this[_0x1fbd('0x24')][_0x3e3791['queue']]['ivrAnswerCallsDay']+=0x1;_0xb377dd=new Hangup(_0x3e3791,_0x16ed69);this[_0x1fbd('0xd3')](_0xb377dd)[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x10f')));this[_0x1fbd('0xd1')](_0xb377dd)[_0x1fbd('0xb7')](loggerCatch('[syncHangupIvr]'));}if(_0x3e3791&&_0x3e3791[_0x1fbd('0x56')]!==_0x1fbd('0x94')&&isNotNull(this['voiceQueues'][_0x3e3791['queue']][_0x1fbd('0x110')])){delete this['uniqueId'][_0x16ed69[_0x1fbd('0xe2')]];this[_0x1fbd('0xb9')](this[_0x1fbd('0x23')][_0x3e3791[_0x1fbd('0xba')]]);this[_0x1fbd('0x23')][_0x3e3791[_0x1fbd('0xba')]][_0x1fbd('0xe8')]+=0x1;this[_0x1fbd('0x23')][_0x3e3791[_0x1fbd('0xba')]]['outboundAnswerAgiCallsDay']+=0x1;_0xb377dd=new Hangup(_0x3e3791,_0x16ed69);_0xb377dd[_0x1fbd('0x108')]=0x10;_0xb377dd[_0x1fbd('0xac')]=_0x1fbd('0x111');_0xb377dd[_0x1fbd('0xea')]=_0x1fbd('0x112');this[_0x1fbd('0xd3')](_0xb377dd)[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x10f')));this[_0x1fbd('0xd1')](_0xb377dd)['catch'](loggerCatch(_0x1fbd('0x113')));}if(_0x3e3791&&_0x3e3791[_0x1fbd('0x56')]!==_0x1fbd('0x94')&&!isNotNull(this[_0x1fbd('0x23')][_0x3e3791[_0x1fbd('0xba')]][_0x1fbd('0x110')])){delete this['uniqueId'][_0x16ed69['uniqueid']];this['updateOriginated'](this[_0x1fbd('0x23')][_0x3e3791[_0x1fbd('0xba')]]);this[_0x1fbd('0x23')][_0x3e3791['queue']]['outboundUnknownCallsDay']+=0x1;_0xb377dd=new Hangup(_0x3e3791,_0x16ed69);_0xb377dd[_0x1fbd('0x108')]=0xc;_0xb377dd[_0x1fbd('0xac')]=_0x16ed69['cause-txt'];_0xb377dd[_0x1fbd('0xea')]=_0x1fbd('0x114');this[_0x1fbd('0xd3')](_0xb377dd)[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x10f')));this[_0x1fbd('0xd1')](_0xb377dd)[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x113')));}};Dialer[_0x1fbd('0x1e')]['syncAgentComplete']=function(_0x4956f1){var _0x49f8b7=this[_0x1fbd('0x2b')][_0x4956f1['uniqueid']];var _0x5db32a=this;if(this[_0x1fbd('0x23')][_0x4956f1[_0x1fbd('0xba')]]){if(_0x49f8b7&&_0x49f8b7[_0x1fbd('0x56')]!==_0x1fbd('0x94')){delete this[_0x1fbd('0x2b')][_0x4956f1[_0x1fbd('0xe2')]];this['voiceQueues'][_0x4956f1[_0x1fbd('0xba')]][_0x1fbd('0xe8')]+=0x1;var _0x3c5721=new AgentComplete(_0x49f8b7,_0x4956f1);if(_0x4956f1[_0x1fbd('0x115')]===_0x1fbd('0x116')){_0x3c5721[_0x1fbd('0x117')]=this['voiceQueues'][_0x4956f1[_0x1fbd('0xba')]][_0x1fbd('0x118')]&&this[_0x1fbd('0x23')][_0x4956f1[_0x1fbd('0xba')]]['dialAgiAfterHangupAgent']?moment()[_0x1fbd('0x7e')](_0x1fbd('0x10c')):undefined;}this[_0x1fbd('0xd3')](_0x3c5721)[_0x1fbd('0xb7')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x1fbd('0xd1')](_0x3c5721)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x1fbd('0x1e')][_0x1fbd('0x33')]=function(_0x439066){if(this[_0x1fbd('0x23')][_0x439066['queue']]){if(this[_0x1fbd('0x2b')][_0x439066[_0x1fbd('0xe2')]]&&this['uniqueId'][_0x439066[_0x1fbd('0xe2')]]['type']!=='ivr'){this[_0x1fbd('0xb9')](this['voiceQueues'][_0x439066[_0x1fbd('0xba')]]);this[_0x1fbd('0x2b')][_0x439066[_0x1fbd('0xe2')]]['answertime']=moment()[_0x1fbd('0x7e')](_0x1fbd('0x10c'));}}};Dialer['prototype'][_0x1fbd('0x119')]=function(_0x2f804c){this[_0x1fbd('0xd3')](_0x2f804c)[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x11a')));this[_0x1fbd('0xd1')](_0x2f804c)[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x11b')));};Dialer['prototype'][_0x1fbd('0x35')]=function(_0x2b7816){var _0x115f28=this[_0x1fbd('0x2b')][_0x2b7816['uniqueid']];var _0x24517a=this;if(this[_0x1fbd('0x23')][_0x2b7816[_0x1fbd('0xba')]]){if(_0x115f28&&_0x115f28[_0x1fbd('0x56')]!==_0x1fbd('0x94')){delete this[_0x1fbd('0x2b')][_0x2b7816[_0x1fbd('0xe2')]];this['updateOriginated'](this['voiceQueues'][_0x2b7816[_0x1fbd('0xba')]]);_0x115f28[_0x1fbd('0x11c')]=moment()[_0x1fbd('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3e78f4=new QueueCallerAbandon(_0x115f28,_0x2b7816);if(getSeconds(_0x115f28['droptime'],_0x115f28[_0x1fbd('0x11d')])>=_0x115f28[_0x1fbd('0x11e')]){this[_0x1fbd('0x23')][_0x2b7816[_0x1fbd('0xba')]][_0x1fbd('0x70')]+=0x1;this[_0x1fbd('0x23')][_0x2b7816['queue']][_0x1fbd('0x68')]+=0x1;this['voiceQueues'][_0x2b7816[_0x1fbd('0xba')]][_0x1fbd('0x72')]+=0x1;_0x3e78f4[_0x1fbd('0x108')]=0xa;_0x3e78f4['statedesc']=_0x1fbd('0x11f');_0x3e78f4['dropreason']='TIMEOUT';_0x3e78f4['agiafterat']=this[_0x1fbd('0x23')][_0x2b7816[_0x1fbd('0xba')]][_0x1fbd('0x118')]?moment()[_0x1fbd('0x7e')](_0x1fbd('0x10c')):undefined;_0x3e78f4[_0x1fbd('0xfb')]+=0x1;_0x3e78f4[_0x1fbd('0xf4')]+=0x1;if(_0x3e78f4[_0x1fbd('0xfb')]>=this[_0x1fbd('0x23')][_0x2b7816[_0x1fbd('0xba')]]['dialDropMaxRetry']){this['queueCallerAbandonCreateState'](_0x3e78f4);}else{this[_0x1fbd('0xc6')]({'active':![],'countdropretry':_0x3e78f4[_0x1fbd('0xfb')],'scheduledat':moment()[_0x1fbd('0x103')](this['voiceQueues'][_0x2b7816[_0x1fbd('0xba')]]['dialDropRetryFrequency'],_0x1fbd('0x105'))[_0x1fbd('0x7e')](_0x1fbd('0x10c')),'ContactId':_0x115f28['ContactId'],'ListId':_0x115f28[_0x1fbd('0xda')],'VoiceQueueId':_0x115f28[_0x1fbd('0x106')]||undefined,'CampaignId':_0x115f28[_0x1fbd('0x10d')]||undefined})[_0x1fbd('0xb7')](loggerCatch('[rescheduleContact][Drop]'));var _0x324fa1=new History(_0x3e78f4);_0x324fa1['state']=0xa;_0x324fa1[_0x1fbd('0xac')]=_0x1fbd('0x11f');_0x324fa1[_0x1fbd('0xae')]=moment()[_0x1fbd('0x7e')](_0x1fbd('0x10c'));_0x324fa1['endtime']=_0x324fa1[_0x1fbd('0xae')];_0x324fa1[_0x1fbd('0x120')]=_0x3e78f4[_0x1fbd('0x120')];_0x324fa1[_0x1fbd('0x121')]=_0x3e78f4[_0x1fbd('0x121')];this['createHistory'](_0x324fa1)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this['voiceQueues'][_0x2b7816[_0x1fbd('0xba')]][_0x1fbd('0x86')]+=0x1;this[_0x1fbd('0x23')][_0x2b7816[_0x1fbd('0xba')]][_0x1fbd('0x67')]+=0x1;_0x3e78f4['state']=0xb;_0x3e78f4['statedesc']=_0x1fbd('0x122');_0x3e78f4['dropreason']='CALLEREXIT';_0x3e78f4[_0x1fbd('0xfc')]+=0x1;_0x3e78f4[_0x1fbd('0xf4')]+=0x1;if(_0x3e78f4['countabandonedretry']>=this[_0x1fbd('0x23')][_0x2b7816[_0x1fbd('0xba')]][_0x1fbd('0x123')]){this[_0x1fbd('0x119')](_0x3e78f4);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x3e78f4[_0x1fbd('0xfc')],'scheduledat':moment()[_0x1fbd('0x103')](this[_0x1fbd('0x23')][_0x2b7816['queue']][_0x1fbd('0x124')],_0x1fbd('0x105'))[_0x1fbd('0x7e')](_0x1fbd('0x10c')),'ContactId':_0x115f28['ContactId'],'ListId':_0x115f28[_0x1fbd('0xda')],'VoiceQueueId':_0x115f28[_0x1fbd('0x106')]||undefined,'CampaignId':_0x115f28[_0x1fbd('0x10d')]||undefined})[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x125')));var _0x324fa1=new History(_0x3e78f4);_0x324fa1[_0x1fbd('0x108')]=0xb;_0x324fa1[_0x1fbd('0xac')]='Abandoned';_0x324fa1[_0x1fbd('0xae')]=moment()[_0x1fbd('0x7e')](_0x1fbd('0x10c'));_0x324fa1[_0x1fbd('0xad')]=_0x324fa1['starttime'];_0x324fa1[_0x1fbd('0x120')]=_0x3e78f4[_0x1fbd('0x120')];_0x324fa1[_0x1fbd('0x121')]=_0x3e78f4[_0x1fbd('0x121')];this[_0x1fbd('0xd3')](_0x324fa1)[_0x1fbd('0xb7')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x1fbd('0x1e')]['syncNewExten']=function(_0x8c7e8){if(this[_0x1fbd('0x29')][_0x8c7e8[_0x1fbd('0xe2')]]){this[_0x1fbd('0x29')][_0x8c7e8['uniqueid']][_0x1fbd('0xb6')]=_0x8c7e8[_0x1fbd('0xb6')];}if(this[_0x1fbd('0x2b')][_0x8c7e8[_0x1fbd('0xe2')]]){this[_0x1fbd('0x2b')][_0x8c7e8[_0x1fbd('0xe2')]][_0x1fbd('0xb6')]=_0x8c7e8[_0x1fbd('0xb6')];}};Dialer[_0x1fbd('0x1e')]['syncQueueMember']=function(_0x49e622){if(strategy[this[_0x1fbd('0x23')][this['actions'][_0x49e622[_0x1fbd('0x126')]]['queue']]['strategy']]===_0x1fbd('0x1d')){if(this[_0x1fbd('0x29')][_0x49e622[_0x1fbd('0x126')]]&&_['isNil'](this['actions'][_0x49e622[_0x1fbd('0x126')]][_0x1fbd('0x127')])&&_0x49e622[_0x1fbd('0xdf')]==='1'&&_0x49e622[_0x1fbd('0x128')]==='0'){if(this[_0x1fbd('0x25')][_0x49e622['stateinterface']]){if(!this[_0x1fbd('0x25')][_0x49e622[_0x1fbd('0x129')]][_0x1fbd('0x127')]){this[_0x1fbd('0x25')][_0x49e622['stateinterface']][_0x1fbd('0x127')]=!![];this[_0x1fbd('0x29')][_0x49e622[_0x1fbd('0x126')]]['locked']=!![];this[_0x1fbd('0x29')][_0x49e622[_0x1fbd('0x126')]][_0x1fbd('0x129')]=_0x49e622[_0x1fbd('0x129')];}}}}else if((strategy[this[_0x1fbd('0x23')][this['actions'][_0x49e622[_0x1fbd('0x126')]][_0x1fbd('0xba')]][_0x1fbd('0x58')]]||_0x1fbd('0x1c'))==='rrmemory'){if(this[_0x1fbd('0x29')][_0x49e622['actionid']]){if(this[_0x1fbd('0x25')][_0x49e622[_0x1fbd('0x129')]]){this[_0x1fbd('0x29')][_0x49e622[_0x1fbd('0x126')]][_0x1fbd('0x129')]=_0x49e622[_0x1fbd('0x129')];if(_[_0x1fbd('0xb4')](this[_0x1fbd('0x30')][this[_0x1fbd('0x29')][_0x49e622[_0x1fbd('0x126')]][_0x1fbd('0xba')]])){this[_0x1fbd('0x30')][this['actions'][_0x49e622[_0x1fbd('0x126')]][_0x1fbd('0xba')]]=[];}this[_0x1fbd('0x30')][this[_0x1fbd('0x29')][_0x49e622[_0x1fbd('0x126')]][_0x1fbd('0xba')]][_0x1fbd('0x12a')](_['merge'](_['pick'](this[_0x1fbd('0x29')][_0x49e622[_0x1fbd('0x126')]],['idHopper',_0x1fbd('0x129')]),{'status':_0x49e622[_0x1fbd('0xdf')],'paused':_0x49e622[_0x1fbd('0x128')]}));}}}};function unlockQueueStatus(_0x141fa7,_0x300bd2){setTimeout(function(){if(_[_0x1fbd('0x46')](_0x141fa7['queueStatusComplete'])){loggerBooked[_0x1fbd('0x97')]('[unlockQueueStatus][undefined]',_0x300bd2);}_0x141fa7['queueStatusComplete']=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x300bd2,JSON[_0x1fbd('0x52')](_['pick'](_0x141fa7,[_0x1fbd('0x49'),_0x1fbd('0x12b')])));},0x1f3);}Dialer[_0x1fbd('0x1e')][_0x1fbd('0x42')]=function(_0x32965b){var _0x594b3b=this;var _0x1e7ec0=_0x594b3b[_0x1fbd('0x23')][_0x594b3b[_0x1fbd('0x29')][_0x32965b[_0x1fbd('0x126')]][_0x1fbd('0xba')]];if(strategy[this[_0x1fbd('0x23')][this[_0x1fbd('0x29')][_0x32965b[_0x1fbd('0x126')]][_0x1fbd('0xba')]][_0x1fbd('0x58')]]===_0x1fbd('0x1d')){if(this[_0x1fbd('0x29')][_0x32965b[_0x1fbd('0x126')]]&&this[_0x1fbd('0x29')][_0x32965b[_0x1fbd('0x126')]][_0x1fbd('0x129')]){this[_0x1fbd('0x22')]['run'](this['actions'][_0x32965b[_0x1fbd('0x126')]][_0x1fbd('0x12c')],this[_0x1fbd('0x29')][_0x32965b[_0x1fbd('0x126')]][_0x1fbd('0x129')])[_0x1fbd('0xb7')](function(_0x295ef1){logger[_0x1fbd('0x97')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x1fbd('0x99')](_0x295ef1,{'showHidden':![],'depth':null}));})[_0x1fbd('0x21')](function(){_0x594b3b['updateOriginated'](_0x594b3b['voiceQueues'][_0x594b3b[_0x1fbd('0x29')][_0x32965b[_0x1fbd('0x126')]][_0x1fbd('0xba')]]);_0x594b3b['agents'][_0x594b3b[_0x1fbd('0x29')][_0x32965b[_0x1fbd('0x126')]][_0x1fbd('0x129')]][_0x1fbd('0x127')]=![];delete _0x594b3b[_0x1fbd('0x29')][_0x32965b[_0x1fbd('0x126')]];unlockQueueStatus(_0x1e7ec0);});}else{this[_0x1fbd('0xb9')](this[_0x1fbd('0x23')][this['actions'][_0x32965b[_0x1fbd('0x126')]][_0x1fbd('0xba')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x1fbd('0x29')][_0x32965b['actionid']]['ContactId'],'ListId':this[_0x1fbd('0x29')][_0x32965b[_0x1fbd('0x126')]][_0x1fbd('0xda')],'VoiceQueueId':this[_0x1fbd('0x29')][_0x32965b[_0x1fbd('0x126')]][_0x1fbd('0x106')]||undefined,'CampaignId':this['actions'][_0x32965b[_0x1fbd('0x126')]][_0x1fbd('0x10d')]||undefined})[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x12d')));delete this[_0x1fbd('0x29')][_0x32965b[_0x1fbd('0x126')]];unlockQueueStatus(_0x1e7ec0);}}else if((strategy[this[_0x1fbd('0x23')][this['actions'][_0x32965b[_0x1fbd('0x126')]][_0x1fbd('0xba')]][_0x1fbd('0x58')]]||_0x1fbd('0x1c'))===_0x1fbd('0x1c')){var _0x1f37e5;if(this['actions'][_0x32965b['actionid']]&&!_[_0x1fbd('0x50')](this['queueBooked'][this['actions'][_0x32965b[_0x1fbd('0x126')]][_0x1fbd('0xba')]])){if(this['queueBookedRR'][_0x594b3b[_0x1fbd('0x29')][_0x32965b[_0x1fbd('0x126')]][_0x1fbd('0xba')]]){this['queueBookedRR'][_0x594b3b[_0x1fbd('0x29')][_0x32965b[_0x1fbd('0x126')]]['queue']]=this[_0x1fbd('0x31')][this['actions'][_0x32965b[_0x1fbd('0x126')]][_0x1fbd('0xba')]]?this[_0x1fbd('0x31')][this['actions'][_0x32965b['actionid']]['queue']]:this['queueBooked'][this[_0x1fbd('0x29')][_0x32965b[_0x1fbd('0x126')]]['queue']]?this[_0x1fbd('0x30')][this[_0x1fbd('0x29')][_0x32965b[_0x1fbd('0x126')]][_0x1fbd('0xba')]][_0x1fbd('0x12e')]||0x0:0x0;}this[_0x1fbd('0x30')][this[_0x1fbd('0x29')][_0x32965b['actionid']][_0x1fbd('0xba')]][_0x1fbd('0x12e')]=this[_0x1fbd('0x31')][this['actions'][_0x32965b[_0x1fbd('0x126')]][_0x1fbd('0xba')]];for(var _0x5eda24=0x0;_0x5eda24=0x0;})['catch'](myreject(_0x294261)));}}else{_0x3786c2['push'](ami[_0x1fbd('0xb5')]({'action':_0x1fbd('0x144'),'command':util[_0x1fbd('0x7e')]('iftime\x20%s,%s',_0x302d4e,!_[_0x1fbd('0x46')](config[_0x1fbd('0x140')][_0x2ee8c2])?_0x2ee8c2:'')})[_0x1fbd('0x44')](function(_0x136b8f){return _0x136b8f[_0x1fbd('0x146')][_0x1fbd('0x147')](_0x1fbd('0x148'))>=0x0;})[_0x1fbd('0xb7')](myreject(_0x294261)));}BPromise[_0x1fbd('0x149')](_0x3786c2)[_0x1fbd('0x44')](function(_0x35d0af){var _0x555595=_[_0x1fbd('0x14a')](_0x35d0af);if(_0x555595){return _0x2f245f(_0x555595);}else{_0x37f87d[_0x1fbd('0x47')]=_0x4d2122?_0x1fbd('0x14b'):_0x1fbd('0x14c');return _0x294261(msgResponse(_0x1fbd('0x14d'),_0x1fbd('0x13e'),_0x1fbd('0x14e')+_0x4d2122+'\x20'+_0x14f585+_0x1fbd('0x14f')+util['inspect'](_0x302d4e,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x2ee8c2));}})[_0x1fbd('0xb7')](function(_0x1ed94c){return _0x294261(msgResponse(_0x1fbd('0x13d'),_0x1fbd('0x13e'),JSON[_0x1fbd('0x52')](_0x1ed94c)));});});};Dialer[_0x1fbd('0x1e')]['checkDialMethod']=function(_0x2e08db){var _0x14f9ad=this;return function(){switch(_0x2e08db[_0x1fbd('0x61')]){case'progressive':freeVariablesPredictive(_0x2e08db);_0x14f9ad[_0x1fbd('0x150')](_0x2e08db,0x1);break;case'power':freeVariablesPredictive(_0x2e08db);_0x14f9ad['handlePower'](_0x2e08db,_0x2e08db['dialPowerLevel']);break;case _0x1fbd('0x151'):_0x14f9ad['predictive'](_0x2e08db);break;case _0x1fbd('0xb'):freeVariablesPredictive(_0x2e08db);_0x14f9ad[_0x1fbd('0x150')](_0x2e08db,0x1);break;default:freeVariablesPredictive(_0x2e08db);logger[_0x1fbd('0x97')](_0x1fbd('0x152'),_0x2e08db[_0x1fbd('0x49')],_0x1fbd('0x153'));}};};Dialer['prototype'][_0x1fbd('0x154')]=function(_0xef24e7){return BPromise[_0x1fbd('0xbf')]()[_0x1fbd('0x44')](cmHopper[_0x1fbd('0x155')](_0xef24e7['id'],previewRecallmeReminderInterval))[_0x1fbd('0x44')](function(_0x2458e0){for(var _0x348c0e=0x0;_0x348c0e<_0x2458e0[_0x1fbd('0x9a')];_0x348c0e++){var _0x53238d=_0x2458e0[_0x348c0e][_0x1fbd('0x156')][_0x1fbd('0x49')];if(_0x53238d)io['to'](util[_0x1fbd('0x7e')](_0x1fbd('0x157'),_0x53238d))['emit'](_0x1fbd('0x158'),{'hopper':_0x2458e0[_0x348c0e]});}})[_0x1fbd('0xb7')](function(_0x212498){});};Dialer['prototype'][_0x1fbd('0x159')]=function(_0x3e3a1f){var _0x397e2e=this;return function(){_0x397e2e['handleIvr'](_0x3e3a1f);};};Dialer[_0x1fbd('0x1e')][_0x1fbd('0xd')]=function(_0x1c2d51){var _0x13d27b=this;if(isNotPreview(_0x1c2d51['dialMethod'])){if(isVoiceQueueOutbound(_0x1c2d51['type'])&&isActive(_0x1c2d51[_0x1fbd('0x60')])){_0x1c2d51[_0x1fbd('0xa4')]=!![];BPromise[_0x1fbd('0xbf')]()[_0x1fbd('0x44')](checkIsLoggedIn(_0x1c2d51,_0x1c2d51[_0x1fbd('0x15a')]))[_0x1fbd('0x44')](checkIsActive(_0x1c2d51,_0x1c2d51[_0x1fbd('0x60')]))[_0x1fbd('0x44')](checkInterval(_0x1c2d51))[_0x1fbd('0x44')](_0x13d27b[_0x1fbd('0x138')](_0x1c2d51))[_0x1fbd('0x44')](_0x13d27b[_0x1fbd('0x15b')](_0x1c2d51[_0x1fbd('0x15c')],_0x1c2d51[_0x1fbd('0x15d')],_0x1c2d51['name'],_0x1c2d51))[_0x1fbd('0x44')](_0x13d27b[_0x1fbd('0x15e')](_0x1c2d51[_0x1fbd('0x4c')],_0x1c2d51[_0x1fbd('0x15d')],_0x1c2d51[_0x1fbd('0x49')],_0x1c2d51))['then'](_0x13d27b[_0x1fbd('0x15f')](_0x1c2d51))[_0x1fbd('0xb7')](loggerCatchQueueSummary(_0x1fbd('0x160'),_0x1c2d51));}else{notSendMessagesQueue(_0x1c2d51);}}else{freeVariablesPredictive(_0x1c2d51);if(_0x1c2d51[_0x1fbd('0x161')]){_0x13d27b[_0x1fbd('0x154')](_0x1c2d51);}}};Dialer['prototype'][_0x1fbd('0x137')]=function(){var _0x4c6caf=this;var _0x330153;for(var _0x49f9ac in this['campaigns']){if(typeof this[_0x1fbd('0x24')][_0x49f9ac]!==_0x1fbd('0xb3')){_0x330153=this[_0x1fbd('0x24')][_0x49f9ac];if(isCampaignIvr(_0x330153[_0x1fbd('0x56')])&&isActive(_0x330153[_0x1fbd('0x7c')])){_0x330153['sendMessageOneNotActive']=!![];BPromise[_0x1fbd('0xbf')]()['then'](checkIsActive(_0x330153,_0x330153[_0x1fbd('0x7c')]))[_0x1fbd('0x44')](checkInterval(_0x330153))['then'](_0x4c6caf[_0x1fbd('0x138')](_0x330153))['then'](_0x4c6caf[_0x1fbd('0x15b')](_0x330153[_0x1fbd('0x15c')],_0x330153['dialTimezone'],_0x330153[_0x1fbd('0x49')],_0x330153))[_0x1fbd('0x44')](_0x4c6caf['checkIfTimeIntervals'](_0x330153[_0x1fbd('0x4c')],_0x330153[_0x1fbd('0x15d')],_0x330153[_0x1fbd('0x49')],_0x330153))[_0x1fbd('0x44')](_0x4c6caf[_0x1fbd('0x159')](_0x330153))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x330153));}else{notSendMessagesCampaign(_0x330153);}}}};function getCallerIdRandom(_0x41f78a,_0x58784d){var _0x468251;var _0x20447d;var _0x24c4ab;if(_0x58784d<=0x0){_0x58784d=0x1;}_0x468251=new RegExp(_0x1fbd('0x162')+_0x58784d+'}$');_0x20447d=Math['pow'](0xa,_0x58784d-0x1);_0x24c4ab=Math[_0x1fbd('0x163')](0xa,_0x58784d)-0x1;return util[_0x1fbd('0x7e')]('%s',_[_0x1fbd('0x164')](_0x41f78a,_0x468251,_['random'](_0x20447d,_0x24c4ab)));}function extractCalleridName(_0x2f001e){var _0x22c39b=_0x2f001e[_0x1fbd('0x165')](/"(.*?)"/);return _0x22c39b?_0x22c39b[0x1]:_0x2f001e;}function extractCalleridNumber(_0x5d1873){var _0x2f191c=_0x5d1873[_0x1fbd('0x165')](/<(.*?)>/);return _0x2f191c?_0x2f191c[0x1]:_0x5d1873;}Dialer[_0x1fbd('0x1e')][_0x1fbd('0x166')]=function(_0x181982,_0x266fe7){var _0x2e20d5=this;var _0x18c130=uuid['v4']();this[_0x1fbd('0x29')][_0x18c130]=new Action(_0x181982,_0x266fe7,_0x18c130);return new BPromise(function(_0x33ee59,_0x181e34){if(_[_0x1fbd('0x46')](_0x181982)&&typeof _0x181982!==_0x1fbd('0x167')){return _0x181e34(msgResponse('originate',_0x1fbd('0x13e'),_0x1fbd('0x168')));}if(_[_0x1fbd('0x46')](_0x266fe7['Contact'][_0x1fbd('0x169')])||_0x266fe7[_0x1fbd('0x16a')][_0x1fbd('0x169')]===null){return _0x181e34(msgResponse(_0x1fbd('0x16b'),'Failure',_0x1fbd('0x16c')));}var _0x2e1254={'XMD-CALLERID':_0x2e20d5[_0x1fbd('0x29')][_0x18c130][_0x1fbd('0x16d')](),'XMD-AGI':_0x181982[_0x1fbd('0x110')]?util[_0x1fbd('0x7e')](_0x1fbd('0x16e'),ipAgi,_0x181982['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x181982[_0x1fbd('0x118')]?util[_0x1fbd('0x7e')](_0x1fbd('0x16e'),ipAgi,_0x181982[_0x1fbd('0x118')]):_0x1fbd('0x16f'),'XMD-QUEUE':_0x181982[_0x1fbd('0x56')]===_0x1fbd('0x57')?util[_0x1fbd('0x7e')]('\x22%s,%s%s,,,%s\x22',_0x181982[_0x1fbd('0x49')],_0x181982[_0x1fbd('0x170')]||'',_0x181982[_0x1fbd('0x171')]?'c':'',_0x181982[_0x1fbd('0x11e')]||0x3):_0x1fbd('0x16f'),'XMD-CONTACTID':_0x266fe7[_0x1fbd('0xd9')],'XMD-CDRTYPE':_0x1fbd('0x9'),'CALLERID(all)':_0x2e20d5[_0x1fbd('0x29')][_0x18c130]['getCaller'](),'XMD-AMD':_0x181982[_0x1fbd('0xe7')]?_0x1fbd('0x172'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x181982[_0x1fbd('0xe7')]){_0x2e1254[_0x1fbd('0x173')]=_0x181982[_0x1fbd('0x174')]||0x9c4;_0x2e1254[_0x1fbd('0x175')]=_0x181982[_0x1fbd('0x176')]||0x5dc;_0x2e1254[_0x1fbd('0x177')]=_0x181982[_0x1fbd('0x178')]||0x320;_0x2e1254['XMD-AMDTOTALANALYSISTIME']=_0x181982[_0x1fbd('0x179')]||0x1388;_0x2e1254[_0x1fbd('0x17a')]=_0x181982[_0x1fbd('0x17b')]||0x64;_0x2e1254[_0x1fbd('0x17c')]=_0x181982[_0x1fbd('0x17d')]||0x32;_0x2e1254[_0x1fbd('0x17e')]=_0x181982['dialAMDMaximumNumberOfWords']||0x3;_0x2e1254['XMD-AMDSILENCETHRESHOLD']=_0x181982[_0x1fbd('0x17f')]||0x100;_0x2e1254[_0x1fbd('0x180')]=_0x181982[_0x1fbd('0x181')]||0x1388;}if(_0x181982[_0x1fbd('0x56')]==='outbound'){_0x2e1254[_0x1fbd('0x182')]=_0x266fe7[_0x1fbd('0x106')];}else{_0x2e1254[_0x1fbd('0x183')]=_0x266fe7[_0x1fbd('0x10d')];}for(var _0x4949a0 in _0x266fe7[_0x1fbd('0x16a')]){if(typeof _0x266fe7[_0x1fbd('0x16a')][_0x4949a0]!==_0x1fbd('0xb3')){if(isNotNull(_0x266fe7[_0x1fbd('0x16a')][_0x4949a0])&&_0x4949a0!=='id'&&_0x4949a0!==_0x1fbd('0x184')&&_0x4949a0!==_0x1fbd('0x185')&&_0x4949a0!==_0x1fbd('0x186')){_0x2e1254[util['format']('%s%s',_0x1fbd('0x187'),_['toUpper'](_0x4949a0))]=_0x266fe7[_0x1fbd('0x16a')][_0x4949a0];}}}var _0x4a52ba=_0x2e20d5[_0x1fbd('0x139')](_0x181982['Trunk'])?getCallerId(_0x181982[_0x1fbd('0x7b')][_0x1fbd('0x7d')],_0x181982[_0x1fbd('0x62')],_0x181982[_0x1fbd('0x188')]>0x0?getCallerIdRandom(_0x181982[_0x1fbd('0x189')],_0x181982[_0x1fbd('0x188')]):_0x181982[_0x1fbd('0x189')]):getCallerId(_[_0x1fbd('0xb4')](_0x181982[_0x1fbd('0x13a')])?_0x181982[_0x1fbd('0x7b')][_0x1fbd('0x7d')]:_0x181982[_0x1fbd('0x13a')][_0x1fbd('0x7d')],_0x181982['dialOriginateCallerIdName'],_0x181982['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x181982[_0x1fbd('0x189')],_0x181982[_0x1fbd('0x188')]):_0x181982[_0x1fbd('0x189')]);if(_0x4a52ba){_0x2e1254['XMD-ORIGINATECALLERIDNAME']=_0x2e20d5[_0x1fbd('0x29')][_0x18c130]['originatecalleridname']=extractCalleridName(_0x4a52ba);_0x2e1254[_0x1fbd('0x18a')]=_0x2e20d5['actions'][_0x18c130]['originatecalleridnum']=extractCalleridNumber(_0x4a52ba);}return ami[_0x1fbd('0xb5')]({'actionid':_0x18c130,'action':'originate','channel':_0x2e20d5[_0x1fbd('0x139')](_0x181982[_0x1fbd('0x7b')])?util[_0x1fbd('0x7e')]('SIP/%s/%s%s',_0x181982[_0x1fbd('0x7b')][_0x1fbd('0x49')],isNotNull(_0x181982[_0x1fbd('0x63')])?_0x181982[_0x1fbd('0x63')][_0x1fbd('0x18b')]()||'':'',_0x181982['dialCutDigit']>0x0?_0x266fe7['Contact'][_0x1fbd('0x169')][_0x1fbd('0x18c')](_0x181982[_0x1fbd('0x18d')]):_0x266fe7[_0x1fbd('0x16a')][_0x1fbd('0x169')]):util[_0x1fbd('0x7e')](_0x1fbd('0x18e'),_['isNil'](_0x181982[_0x1fbd('0x13a')])?_0x181982[_0x1fbd('0x7b')][_0x1fbd('0x49')]:_0x181982[_0x1fbd('0x13a')][_0x1fbd('0x49')],isNotNull(_0x181982[_0x1fbd('0x63')])?_0x181982[_0x1fbd('0x63')][_0x1fbd('0x18b')]()||'':'',_0x181982['dialCutDigit']>0x0?_0x266fe7[_0x1fbd('0x16a')][_0x1fbd('0x169')][_0x1fbd('0x18c')](_0x181982[_0x1fbd('0x18d')]):_0x266fe7[_0x1fbd('0x16a')][_0x1fbd('0x169')]),'callerid':_0x4a52ba,'Exten':_0x1fbd('0xe6'),'Context':_0x1fbd('0x18f'),'Priority':'1','variable':_0x2e1254,'timeout':(_0x181982[_0x1fbd('0x190')]||0x1e)*0x3e8,'async':!![],'channelid':_0x18c130})['then'](function(_0x29d21a){return _0x33ee59(_0x29d21a);})['catch'](function(_0x4f8485){_0x181982[_0x1fbd('0x6b')]+=0x1;var _0x1ee2fa=new History(_0x2e20d5[_0x1fbd('0x29')][_0x18c130]);logger['error'](util[_0x1fbd('0x7e')]('[originateError]:\x20%s',JSON[_0x1fbd('0x52')](_0x4f8485)));_0x1ee2fa[_0x1fbd('0x108')]=0xe;_0x1ee2fa[_0x1fbd('0xac')]='OriginateError';_0x1ee2fa[_0x1fbd('0xae')]=moment()['format'](_0x1fbd('0x10c'));_0x1ee2fa[_0x1fbd('0xad')]=_0x1ee2fa[_0x1fbd('0xae')];_0x2e20d5[_0x1fbd('0xd3')](_0x1ee2fa)[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x191')));_0x2e20d5['moveContactManagedDialer'](_0x1ee2fa)[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x191')))[_0x1fbd('0x21')](function(){delete _0x2e20d5[_0x1fbd('0x29')][_0x18c130];return _0x181e34(msgResponse(_0x1fbd('0x16b'),_0x1fbd('0x192'),_0x1fbd('0x193')));});});});};Dialer[_0x1fbd('0x1e')]['syncOriginateResponse']=function(_0x106ce6){var _0x1601f0=this[_0x1fbd('0x29')][_0x106ce6[_0x1fbd('0x126')]];if(_0x1601f0){delete this['actions'][_0x106ce6[_0x1fbd('0x126')]];_0x1601f0[_0x1fbd('0x11d')]=moment()['format'](_0x1fbd('0x10c'));var _0x13d40c=_0x1601f0['type']===_0x1fbd('0x94')?this[_0x1fbd('0x24')][_0x1601f0['queue']]:this['voiceQueues'][_0x1601f0['getQueue']()];if(!this[_0x1fbd('0xdd')](_0x106ce6['response'])){this['updateOriginated'](_0x13d40c);return this[_0x1fbd('0x194')](_0x1601f0,_0x13d40c,_0x106ce6)[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x195')));}this[_0x1fbd('0x2b')][_0x106ce6[_0x1fbd('0xe2')]]=_0x1601f0;}};Dialer[_0x1fbd('0x1e')][_0x1fbd('0x196')]=function(_0x26f175,_0x4093b7,_0x365e5e){var _0x537624=new History(_0x4093b7);if(_0x537624[_0x1fbd('0xf7')]+_0x537624[_0x1fbd('0xf8')]+_0x537624[_0x1fbd('0xf9')]+_0x537624[_0x1fbd('0xfa')]+_0x537624[_0x1fbd('0xfb')]+_0x537624[_0x1fbd('0xfc')]+_0x537624[_0x1fbd('0xf3')]+_0x537624[_0x1fbd('0xfd')]>=_0x365e5e[_0x1fbd('0xfe')]-0x1){return!![];}switch(_0x26f175){case 0x3:if(_0x537624[_0x1fbd('0xf9')]>=_0x365e5e['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x537624[_0x1fbd('0xf9')]+=0x1,'scheduledat':moment()[_0x1fbd('0x103')](_0x365e5e[_0x1fbd('0x197')],'minutes')['format'](_0x1fbd('0x10c')),'ContactId':_0x537624[_0x1fbd('0xd9')],'ListId':_0x537624[_0x1fbd('0xda')],'VoiceQueueId':_0x537624[_0x1fbd('0x106')]||undefined,'CampaignId':_0x537624['CampaignId']||undefined})[_0x1fbd('0xb7')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x537624[_0x1fbd('0xf7')]>=_0x365e5e[_0x1fbd('0x198')]-0x1){return!![];}this[_0x1fbd('0xc6')]({'active':![],'countbusyretry':_0x537624['countbusyretry']+=0x1,'scheduledat':moment()[_0x1fbd('0x103')](_0x365e5e[_0x1fbd('0x199')],_0x1fbd('0x105'))[_0x1fbd('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x537624['ContactId'],'ListId':_0x537624['ListId'],'VoiceQueueId':_0x537624['VoiceQueueId']||undefined,'CampaignId':_0x537624[_0x1fbd('0x10d')]||undefined})[_0x1fbd('0xb7')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x537624[_0x1fbd('0xf8')]>=_0x365e5e[_0x1fbd('0x19a')]-0x1){return!![];}this[_0x1fbd('0xc6')]({'active':![],'countcongestionretry':_0x537624[_0x1fbd('0xf8')]+=0x1,'scheduledat':moment()[_0x1fbd('0x103')](_0x365e5e['dialCongestionRetryFrequency'],_0x1fbd('0x105'))['format'](_0x1fbd('0x10c')),'ContactId':_0x537624[_0x1fbd('0xd9')],'ListId':_0x537624['ListId'],'VoiceQueueId':_0x537624[_0x1fbd('0x106')]||undefined,'CampaignId':_0x537624[_0x1fbd('0x10d')]||undefined})[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x19b')));break;case 0x0:if(_0x537624['countnosuchnumberretry']>=_0x365e5e[_0x1fbd('0x19c')]-0x1){return!![];}else{this[_0x1fbd('0xc6')]({'active':![],'countnosuchnumberretry':_0x537624[_0x1fbd('0xfa')]+=0x1,'scheduledat':moment()['add'](_0x365e5e[_0x1fbd('0x19d')],_0x1fbd('0x105'))[_0x1fbd('0x7e')](_0x1fbd('0x10c')),'ContactId':_0x537624[_0x1fbd('0xd9')],'ListId':_0x537624[_0x1fbd('0xda')],'VoiceQueueId':_0x537624[_0x1fbd('0x106')]||undefined,'CampaignId':_0x537624['CampaignId']||undefined})[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x19e')));}break;case 0xa:if(_0x537624[_0x1fbd('0xfb')]>=_0x365e5e['dialDropMaxRetry']-0x1){return!![];}this[_0x1fbd('0xc6')]({'active':![],'countdropretry':_0x537624[_0x1fbd('0xfb')]+=0x1,'scheduledat':moment()[_0x1fbd('0x103')](_0x365e5e['dialDropRetryFrequency'],_0x1fbd('0x105'))['format'](_0x1fbd('0x10c')),'ContactId':_0x537624[_0x1fbd('0xd9')],'ListId':_0x537624['ListId'],'VoiceQueueId':_0x537624[_0x1fbd('0x106')]||undefined,'CampaignId':_0x537624[_0x1fbd('0x10d')]||undefined})[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x19f')));break;case 0xb:if(_0x537624[_0x1fbd('0xfc')]>=_0x365e5e[_0x1fbd('0x123')]-0x1){return!![];}this[_0x1fbd('0xc6')]({'active':![],'countabandonedretry':_0x537624[_0x1fbd('0xfc')]+=0x1,'scheduledat':moment()[_0x1fbd('0x103')](_0x365e5e[_0x1fbd('0x124')],_0x1fbd('0x105'))[_0x1fbd('0x7e')](_0x1fbd('0x10c')),'ContactId':_0x537624[_0x1fbd('0xd9')],'ListId':_0x537624['ListId'],'VoiceQueueId':_0x537624[_0x1fbd('0x106')]||undefined,'CampaignId':_0x537624['CampaignId']||undefined})[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x125')));break;case 0x13:if(_0x537624[_0x1fbd('0xf3')]>=_0x365e5e['dialMachineMaxRetry']-0x1){return!![];}this[_0x1fbd('0xc6')]({'active':![],'countmachineretry':_0x537624[_0x1fbd('0xf3')]+=0x1,'scheduledat':moment()[_0x1fbd('0x103')](_0x365e5e[_0x1fbd('0x104')],'minutes')[_0x1fbd('0x7e')](_0x1fbd('0x10c')),'ContactId':_0x537624[_0x1fbd('0xd9')],'ListId':_0x537624[_0x1fbd('0xda')],'VoiceQueueId':_0x537624[_0x1fbd('0x106')]||undefined,'CampaignId':_0x537624[_0x1fbd('0x10d')]||undefined})[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x10e')));break;case 0x14:if(_0x537624[_0x1fbd('0xfd')]>=_0x365e5e['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x1fbd('0xc6')]({'active':![],'countagentrejectretry':_0x537624['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x365e5e['dialAgentRejectRetryFrequency'],'minutes')[_0x1fbd('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x537624[_0x1fbd('0xd9')],'ListId':_0x537624['ListId'],'VoiceQueueId':_0x537624[_0x1fbd('0x106')]||undefined,'CampaignId':_0x537624[_0x1fbd('0x10d')]||undefined})['catch'](loggerCatch(_0x1fbd('0x1a0')));break;default:return!![];}};Dialer[_0x1fbd('0x1e')][_0x1fbd('0x194')]=function(_0x47e110,_0x524c24,_0x194a76){var _0x394223=this;var _0xeca528=new History(_0x47e110);return new BPromise(function(_0x27ca9b,_0x2a81ac){if(_[_0x1fbd('0x46')](_0x524c24)&&typeof _0x524c24!==_0x1fbd('0x167')){return _0x2a81ac(msgResponse(_0x1fbd('0x1a1'),_0x1fbd('0x13e'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x194a76)&&typeof _0x194a76!=='object'){return _0x2a81ac(msgResponse(_0x1fbd('0x1a1'),'Failure',_0x1fbd('0x1a2')));}switch(_0x194a76[_0x1fbd('0x115')]){case'0':_0x524c24[_0x1fbd('0x6a')]+=0x1;_0xeca528[_0x1fbd('0x108')]=0x0;_0xeca528[_0x1fbd('0xac')]=_0x1fbd('0x1a3');_0xeca528['countnosuchnumberretry']+=0x1;_0xeca528['countglobal']+=0x1;ami[_0x1fbd('0xec')](_0x1fbd('0x1a4'),ut[_0x1fbd('0xee')](_0x47e110,_0x1fbd('0x1a5')));_0x394223['createHistory'](_0xeca528)[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0xf6')));if(_0x394223[_0x1fbd('0x196')](0x0,_0x47e110,_0x524c24)){if(_0xeca528[_0x1fbd('0xfa')]>=_0x524c24[_0x1fbd('0x19c')]){_0x394223[_0x1fbd('0x101')](_0xeca528,_0x27ca9b,_0x2a81ac,_0x1fbd('0x1a6'));}else{_0x394223[_0x1fbd('0xff')](_0xeca528,_0x27ca9b,_0x2a81ac,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x524c24[_0x1fbd('0x69')]+=0x1;_0xeca528[_0x1fbd('0x108')]=0x3;_0xeca528['statedesc']=_0x1fbd('0x1a7');_0xeca528[_0x1fbd('0xf9')]+=0x1;_0xeca528[_0x1fbd('0xf4')]+=0x1;ami[_0x1fbd('0xec')](_0x1fbd('0x1a8'),ut[_0x1fbd('0xee')](_0x47e110,_0x1fbd('0x1a9')));_0x394223['createHistory'](_0xeca528)[_0x1fbd('0xb7')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x394223[_0x1fbd('0x196')](0x3,_0x47e110,_0x524c24)){if(_0xeca528[_0x1fbd('0xf9')]>=_0x524c24['dialNoAnswerMaxRetry']){_0x394223[_0x1fbd('0x101')](_0xeca528,_0x27ca9b,_0x2a81ac,_0x1fbd('0x1aa'));}else{_0x394223[_0x1fbd('0xff')](_0xeca528,_0x27ca9b,_0x2a81ac,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x524c24[_0x1fbd('0x1ab')]+=0x1;_0xeca528[_0x1fbd('0x108')]=0x5;_0xeca528['statedesc']=_0x1fbd('0x1ac');_0xeca528[_0x1fbd('0xf7')]+=0x1;_0xeca528[_0x1fbd('0xf4')]+=0x1;ami[_0x1fbd('0xec')](_0x1fbd('0x1ad'),ut[_0x1fbd('0xee')](_0x47e110,_0x1fbd('0x1ae')));_0x394223[_0x1fbd('0xd3')](_0xeca528)[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x1af')));if(_0x394223[_0x1fbd('0x196')](0x5,_0x47e110,_0x524c24)){if(_0xeca528[_0x1fbd('0xf7')]>=_0x524c24[_0x1fbd('0x198')]){_0x394223['createStateFinal'](_0xeca528,_0x27ca9b,_0x2a81ac,_0x1fbd('0x1b0'));}else{_0x394223[_0x1fbd('0xff')](_0xeca528,_0x27ca9b,_0x2a81ac,'reason\x205\x20busy');}}break;case'8':_0x524c24['outboundCongestionCallsDay']+=0x1;_0xeca528[_0x1fbd('0x108')]=0x8;_0xeca528['statedesc']=_0x1fbd('0x1b1');_0xeca528[_0x1fbd('0xf8')]+=0x1;_0xeca528[_0x1fbd('0xf4')]+=0x1;ami[_0x1fbd('0xec')](_0x1fbd('0x1b2'),ut['buildObj'](_0x47e110,_0x1fbd('0x1b3')));_0x394223[_0x1fbd('0xd3')](_0xeca528)[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x1b4')));if(_0x394223['checkRetriveMax'](0x8,_0x47e110,_0x524c24)){if(_0xeca528['countcongestionretry']>=_0x524c24[_0x1fbd('0x19a')]){_0x394223[_0x1fbd('0x101')](_0xeca528,_0x27ca9b,_0x2a81ac,_0x1fbd('0x1b5'));}else{_0x394223[_0x1fbd('0xff')](_0xeca528,_0x27ca9b,_0x2a81ac,_0x1fbd('0x1b5'));}}break;case'11':_0x524c24[_0x1fbd('0x1b6')]+=0x1;_0xeca528[_0x1fbd('0x108')]=0xb;_0xeca528[_0x1fbd('0xac')]=_0x1fbd('0x122');_0xeca528[_0x1fbd('0xfc')]+=0x1;_0xeca528['countglobal']+=0x1;_0x394223[_0x1fbd('0xd3')](_0xeca528)[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x1b7')));if(_0x394223[_0x1fbd('0x196')](0xb,_0x47e110,_0x524c24)){if(_0xeca528[_0x1fbd('0xfc')]>=_0x524c24['dialAbandonedMaxRetry']){_0x394223[_0x1fbd('0x101')](_0xeca528,_0x27ca9b,_0x2a81ac,'reason\x2011\x20abandoned');}else{_0x394223[_0x1fbd('0xff')](_0xeca528,_0x27ca9b,_0x2a81ac,_0x1fbd('0x1b8'));}}break;case'20':_0x524c24[_0x1fbd('0x6d')]+=0x1;_0xeca528[_0x1fbd('0x108')]=0x14;_0xeca528[_0x1fbd('0xac')]=_0x1fbd('0x1b9');_0xeca528[_0x1fbd('0xfd')]+=0x1;_0xeca528[_0x1fbd('0xf4')]+=0x1;ami[_0x1fbd('0xec')](_0x1fbd('0x1ba'),ut[_0x1fbd('0xee')](_0x47e110,'agentreject'));_0x394223[_0x1fbd('0xd3')](_0xeca528)['catch'](loggerCatch(_0x1fbd('0x1bb')));if(_0x394223[_0x1fbd('0x196')](0x14,_0x47e110,_0x524c24)){if(_0xeca528[_0x1fbd('0xfd')]>=_0x524c24[_0x1fbd('0x1bc')]){_0x394223[_0x1fbd('0x101')](_0xeca528,_0x27ca9b,_0x2a81ac,_0x1fbd('0x1bd'));}else{_0x394223[_0x1fbd('0xff')](_0xeca528,_0x27ca9b,_0x2a81ac,_0x1fbd('0x1bd'));}}break;default:_0x524c24[_0x1fbd('0x1be')]+=0x1;_0xeca528[_0x1fbd('0x108')]=0xc;_0xeca528[_0x1fbd('0xac')]=_0x194a76[_0x1fbd('0x115')];_0x394223[_0x1fbd('0xd3')](_0xeca528)[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x1bf')));if(_0x394223['checkRetriveMax'](_0x194a76[_0x1fbd('0x115')],_0x47e110,_0x524c24)){if(_0xeca528[_0x1fbd('0xf7')]+_0xeca528['countcongestionretry']+_0xeca528['countnoanswerretry']+_0xeca528[_0x1fbd('0xfa')]+_0xeca528[_0x1fbd('0xfb')]+_0xeca528[_0x1fbd('0xfc')]+_0xeca528[_0x1fbd('0xf3')]+_0xeca528[_0x1fbd('0xfd')]>=_0x524c24[_0x1fbd('0xfe')]){_0x394223[_0x1fbd('0xff')](_0xeca528,_0x27ca9b,_0x2a81ac,_0x194a76[_0x1fbd('0x115')]);}else{_0x394223[_0x1fbd('0x101')](_0xeca528,_0x27ca9b,_0x2a81ac,_0x194a76[_0x1fbd('0x115')]);}}}});};Dialer[_0x1fbd('0x1e')]['stateGlobal']=function(_0x389f18,_0x1291af,_0x4aef08,_0x22b603){var _0x1c9450=new Final(_0x389f18);_0x1c9450['state']=0xf;_0x1c9450[_0x1fbd('0xac')]=_0x1fbd('0x1c0');this[_0x1fbd('0x101')](_0x1c9450,_0x1291af,_0x4aef08,_0x22b603);};Dialer[_0x1fbd('0x1e')][_0x1fbd('0x101')]=function(_0x50e21c,_0x191d70,_0xc77982,_0x1723d6){this[_0x1fbd('0xd1')](_0x50e21c)['then'](function(){return _0x191d70(msgResponse(_0x1fbd('0x1a1'),_0x1fbd('0xde'),_0x1723d6));})['catch'](function(){return _0xc77982(msgResponse('[moveContactManagedDialer][0]',_0x1fbd('0x13e'),'contact\x20not\x20moved'));});};Dialer[_0x1fbd('0x1e')][_0x1fbd('0x151')]=function(_0x1cd073){var _0x49029a=_0x1cd073['dialPredictiveOptimizationPercentage']/0x64;var _0xc9bb46=_0x1cd073[_0x1fbd('0x68')]/(_0x1cd073[_0x1fbd('0x68')]+_0x1cd073[_0x1fbd('0xe8')]);var _0x489948=Math[_0x1fbd('0x1c1')](_0x1cd073[_0x1fbd('0x76')]*(_0x1cd073['predictiveIntervalMaxThreshold']/0x64));var _0x4ffd88=Math[_0x1fbd('0x1c1')](_0x1cd073[_0x1fbd('0x76')]*(_0x1cd073[_0x1fbd('0x1c2')]/0x64));var _0x56ded7=_0x1cd073[_0x1fbd('0x59')]+_0x1cd073['talking'];var _0x2a7e23=Math[_0x1fbd('0x1c3')](_0x1cd073[_0x1fbd('0x78')]*_0x1cd073['erlangAbandonmentRate']*_0x1cd073[_0x1fbd('0x73')]*_0x1cd073[_0x1fbd('0x74')]);if(_['isUndefined'](_0x1cd073['startProgressive'])){if(!_[_0x1fbd('0x46')](_0x1cd073[_0x1fbd('0x2d')])){_0x1cd073['startPredictive']=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x1fbd('0x1c4'));}if(!_[_0x1fbd('0x46')](_0x1cd073[_0x1fbd('0x93')])){loggerPredictive['error'](_0x1fbd('0x1c5'),_0x1fbd('0x1c6'));clearInterval(_0x1cd073[_0x1fbd('0x93')]);_0x1cd073[_0x1fbd('0x93')]=undefined;}_0x1cd073['startProgressive']=moment()[_0x1fbd('0x7e')](_0x1fbd('0x10c'));loggerPredictive['info'](_0x1cd073[_0x1fbd('0x49')],_0x1fbd('0x1c7'),_0x1cd073['startProgressive']);this[_0x1fbd('0x150')](_0x1cd073,0x1);}else if(ifInterval(_0x1cd073[_0x1fbd('0x1c8')],_0x1cd073[_0x1fbd('0x2e')])){this[_0x1fbd('0x150')](_0x1cd073,0x1);loggerPredictiveCalls[_0x1fbd('0x83')](_0x1fbd('0x1c9'),_0x1cd073['startProgressive'],_0x1cd073['name']);_0x1cd073[_0x1fbd('0x78')]=0x0;_0x1cd073[_0x1fbd('0x72')]=0x0;}else if(_0x49029a<_0xc9bb46&&_0x1cd073[_0x1fbd('0x1ca')]===_0x1fbd('0x1cb')){freeVariablesPredictive(_0x1cd073);loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x1cc'),_0x1fbd('0x1cd'),_0xc9bb46,_0x1fbd('0x2e'),_0x1cd073[_0x1fbd('0x49')]);}else if(_0x2a7e23<_0x1cd073['predictiveIntervalErlangCallsDroppedCalls']&&_0x1cd073[_0x1fbd('0x1ca')]===_0x1fbd('0x1cb')){freeVariablesPredictive(_0x1cd073);loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x1ce'),_0x1fbd('0x1cf'),_0x2a7e23,_0x1fbd('0x1d0'),_0x1cd073['predictiveIntervalErlangCallsDroppedCalls'],_0x1fbd('0x2e'),_0x1cd073[_0x1fbd('0x49')]);}else if(!ifInterval(_0x1cd073[_0x1fbd('0x1c8')],_0x1cd073[_0x1fbd('0x2e')])&&_[_0x1fbd('0x46')](_0x1cd073[_0x1fbd('0x2d')])&&!_[_0x1fbd('0x46')](_0x1cd073['startProgressive'])){_0x1cd073[_0x1fbd('0x2d')]=moment()[_0x1fbd('0x7e')](_0x1fbd('0x10c'));loggerPredictive['info'](_0x1cd073[_0x1fbd('0x49')],_0x1fbd('0x1d1'),_0x1cd073[_0x1fbd('0x2d')]);this['averageHandleTime'](_0x1cd073[_0x1fbd('0x1c8')])['then'](this[_0x1fbd('0x1d2')](_0x1cd073))[_0x1fbd('0x44')](mergeDataErlangB(_0x1cd073))[_0x1fbd('0x44')](this[_0x1fbd('0x1d3')](_0x1cd073))[_0x1fbd('0xb7')](loggerCatchPredictive(_0x1fbd('0x1d4'),_0x1cd073));}else if(!ifInterval(_0x1cd073['dialPredictiveInterval'],_0x1cd073['startPredictive'])){_0x1cd073[_0x1fbd('0x72')]=0x0;_0x1cd073[_0x1fbd('0x2d')]=moment()[_0x1fbd('0x7e')](_0x1fbd('0x10c'));loggerPredictive['info'](_0x1cd073['name'],_0x1fbd('0x1d5'),_0x1cd073['startPredictive']);clearInterval(_0x1cd073[_0x1fbd('0x93')]);_0x1cd073[_0x1fbd('0x93')]=undefined;this[_0x1fbd('0xc3')](_0x1cd073[_0x1fbd('0x1c8')])[_0x1fbd('0x44')](this['getDataPredictive'](_0x1cd073))[_0x1fbd('0x44')](mergeDataErlangB(_0x1cd073))[_0x1fbd('0x44')](this[_0x1fbd('0x1d3')](_0x1cd073))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x1cd073));}else if(_0x1cd073['predictiveIntervalAvailable']&&_0x56ded7<_0x1cd073[_0x1fbd('0x76')]-_0x4ffd88){freeVariablesPredictive(_0x1cd073);loggerPredictive[_0x1fbd('0x83')](_0x1cd073[_0x1fbd('0x49')],_0x1fbd('0x1d6'),_0x56ded7,_0x1fbd('0x1d7'),_0x1cd073[_0x1fbd('0x76')],'-',_0x4ffd88,'=',_0x1cd073['predictiveIntervalAvailable']-_0x4ffd88,')');}else if(_0x1cd073[_0x1fbd('0x76')]&&_0x56ded7>_0x1cd073[_0x1fbd('0x76')]+_0x489948){freeVariablesPredictive(_0x1cd073);loggerPredictive[_0x1fbd('0x83')](_0x1cd073[_0x1fbd('0x49')],_0x1fbd('0x1d6'),_0x56ded7,_0x1fbd('0x1d8'),_0x1cd073[_0x1fbd('0x76')],'+',_0x489948,'=',_0x1cd073[_0x1fbd('0x76')]+_0x489948,')');}};Dialer['prototype'][_0x1fbd('0x1d2')]=function(_0x42da8b){var _0xb11ddc=this;return function(_0x194cca){return new BPromise(function(_0x540a2f,_0x57b174){_[_0x1fbd('0x92')](_0x42da8b,_0x194cca[0x0]);if(checkGetDataPredictive(_0x194cca[0x0])){var _0x2cfbc4=_0x42da8b['predictiveIntervalAvailable']=_0x42da8b[_0x1fbd('0x5c')]+_0x42da8b[_0x1fbd('0x59')];var _0x3d3e50=_0x42da8b['dialPredictiveInterval']*0x3c;var _0x29964e=_0x194cca[0x0][_0x1fbd('0x88')]+_0x194cca[0x0][_0x1fbd('0x6f')];var _0x2d2870=(_0x194cca[0x0]['predictiveIntervalAnsweredCalls']+_0x194cca[0x0][_0x1fbd('0x70')]+_0x194cca[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x194cca[0x0][_0x1fbd('0x77')];_0x42da8b[_0x1fbd('0x73')]=_0x2d2870>0x0?_0x2d2870:0x1;switch(_0x42da8b[_0x1fbd('0x1ca')]){case _0x1fbd('0x1cb'):var _0x30c281=_0x42da8b[_0x1fbd('0x1d9')]/0x64;return _0xb11ddc[_0x1fbd('0x1da')](_0x2cfbc4,_0x3d3e50,_0x29964e,_0x2d2870,_0x30c281)[_0x1fbd('0x44')](function(_0x2252cb){return _0x540a2f(_0x2252cb);});case'agentBusyFactor':var _0x3825be=_0x42da8b['dialPredictiveOptimizationPercentage']/0x64;return _0xb11ddc[_0x1fbd('0x1db')](_0x2cfbc4,_0x3d3e50,_0x29964e,_0x2d2870,_0x3825be)[_0x1fbd('0x44')](function(_0x3fd66a){return _0x540a2f(_0x3fd66a);});default:return _0x57b174(msgResponse(_0x1fbd('0x1dc'),_0x1fbd('0x13e'),'Unknown\x20Predictive'));}}else{return _0x57b174(msgResponse(_0x1fbd('0x1dc'),_0x1fbd('0x13e'),_0x1fbd('0x1dd')));}});};};Dialer[_0x1fbd('0x1e')][_0x1fbd('0x1de')]=function(_0x15d40a){var _0x3bb62b=this;return function(_0x2c4fc5){return new BPromise(function(_0x4d1147,_0x3b3b26){_[_0x1fbd('0x92')](_0x15d40a,_0x2c4fc5[0x0]);if(checkGetDataPredictive(_0x2c4fc5[0x0])){loggerPredictive[_0x1fbd('0x83')](JSON[_0x1fbd('0x52')](_0x2c4fc5[0x0]));if(_0x15d40a['dialPredictiveOptimization']===_0x1fbd('0x1cb')){return _0x3bb62b[_0x1fbd('0xcf')](_0x15d40a['id'])[_0x1fbd('0x44')](function(_0x88190f){var _0x23463f=_0x15d40a[_0x1fbd('0x15a')]-_0x88190f[0x0][_0x1fbd('0x1df')];var _0x41e968=_0x15d40a[_0x1fbd('0x1c8')]*0x3c;var _0x3ca489=_0x2c4fc5[0x0][_0x1fbd('0x88')]+_0x2c4fc5[0x0][_0x1fbd('0x6f')];var _0x33ba34=(_0x2c4fc5[0x0][_0x1fbd('0x6e')]+_0x2c4fc5[0x0][_0x1fbd('0x70')]+_0x2c4fc5[0x0][_0x1fbd('0x86')])/_0x2c4fc5[0x0]['predictiveIntervalTotalCalls'];var _0x2b4e1e=_0x15d40a[_0x1fbd('0x1d9')]/0x64;_0x15d40a['predictiveIntervalPauses']=_0x88190f[0x0][_0x1fbd('0x1df')]||0x0;_0x15d40a[_0x1fbd('0x73')]=_0x33ba34>0x0?_0x33ba34:0x1;return _0x3bb62b[_0x1fbd('0x1da')](_0x23463f,_0x41e968,_0x3ca489,_0x33ba34,_0x2b4e1e);})[_0x1fbd('0x44')](function(_0x46810e){return _0x4d1147(_0x46810e);})[_0x1fbd('0xb7')](function(_0x3fcc1a){return _0x3b3b26(msgResponse('[CatchErlangB]',_0x1fbd('0x13e'),JSON['stringify'](_0x3fcc1a)));});}if(_0x15d40a['dialPredictiveOptimization']===_0x1fbd('0x1e0')){return _0x3bb62b[_0x1fbd('0xcf')](_0x15d40a['id'])['then'](function(_0x1d467b){var _0x34bb76=_0x15d40a['loggedIn']-_0x1d467b[0x0]['outboundQueuePauses'];var _0x162bb3=_0x15d40a[_0x1fbd('0x1c8')]*0x3c;var _0xc9c18d=_0x2c4fc5[0x0][_0x1fbd('0x88')]+_0x2c4fc5[0x0][_0x1fbd('0x6f')];var _0x4bd111=(_0x2c4fc5[0x0]['predictiveIntervalAnsweredCalls']+_0x2c4fc5[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2c4fc5[0x0][_0x1fbd('0x86')])/_0x2c4fc5[0x0]['predictiveIntervalTotalCalls'];var _0x966d85=_0x15d40a[_0x1fbd('0x1d9')]/0x64;_0x15d40a[_0x1fbd('0x75')]=_0x1d467b[0x0][_0x1fbd('0x1df')]||0x0;_0x15d40a[_0x1fbd('0x73')]=_0x4bd111>0x0?_0x4bd111:0x1;return _0x3bb62b['busyFactor'](_0x34bb76,_0x162bb3,_0xc9c18d,_0x4bd111,_0x966d85);})[_0x1fbd('0x44')](function(_0x4044c9){return _0x4d1147(_0x4044c9);})[_0x1fbd('0xb7')](function(_0x52de68){return _0x3b3b26(msgResponse(_0x1fbd('0x1e1'),'Failure',JSON[_0x1fbd('0x52')](_0x52de68)));});}}else{return _0x3b3b26(msgResponse(_0x1fbd('0x1dc'),'Failure','check\x20failure'));}});};};Dialer[_0x1fbd('0x1e')]['startMethodPredictive']=function(_0x1964a5){var _0x3aadb5=this;return function(){var _0x509552=0x0;var _0x4623af=Math['floor'](_0x1964a5[_0x1fbd('0x79')]*0x3e8);if(_0x4623af>0x0){_0x4623af=_0x4623af<0x64?0x64:_0x4623af;loggerPredictive[_0x1fbd('0x83')](_0x1964a5['name'],'one\x20call\x20every:',_0x4623af,'milliseconds');_0x1964a5[_0x1fbd('0x93')]=setInterval(function(){_0x3aadb5[_0x1fbd('0x93')](_0x1964a5);loggerPredictiveCalls[_0x1fbd('0x83')]('[handlePredictive]',_0x509552+=0x1);},_0x4623af);}else{loggerPredictive['info'](_0x1964a5[_0x1fbd('0x49')],_0x1fbd('0x1e2'));}};};Dialer[_0x1fbd('0x1e')][_0x1fbd('0x1e3')]=function(_0x237207,_0x529fe3){var _0x28abf9=this;return function(_0x41f37f){if(_[_0x1fbd('0x50')](_0x41f37f)){if(_[_0x1fbd('0xb4')](_0x529fe3['UserId'])||!_0x529fe3['recallme']){if(_0x237207['dialMethod']===_0x1fbd('0xb')){_0x237207['queueStatusComplete']=_[_0x1fbd('0x46')](_0x237207['queueStatusComplete'])?!![]:_0x237207[_0x1fbd('0x12b')];var _0x3c6b97=uuid['v4']();_0x28abf9['actions'][_0x3c6b97]=new Action(_0x237207,_0x529fe3,_0x3c6b97);loggerBooked[_0x1fbd('0x83')](_0x1fbd('0x1e4'),_0x3c6b97,'queueStatusComplete:\x20',JSON[_0x1fbd('0x52')](_0x237207[_0x1fbd('0x12b')]),'Queue:\x20',_0x237207['name']);if(_0x237207[_0x1fbd('0x12b')]){_0x237207[_0x1fbd('0x12b')]=![];_0x28abf9[_0x1fbd('0x30')][_0x28abf9[_0x1fbd('0x29')][_0x3c6b97][_0x1fbd('0xba')]]=[];ami[_0x1fbd('0xb5')]({'actionid':_0x3c6b97,'action':'queuestatus','queue':_0x237207['name']})[_0x1fbd('0xb7')](function(){_0x28abf9['updateOriginated'](_0x237207);_0x28abf9[_0x1fbd('0xc6')]({'active':![],'ContactId':_0x28abf9['actions'][_0x3c6b97][_0x1fbd('0xd9')],'ListId':_0x28abf9['actions'][_0x3c6b97][_0x1fbd('0xda')],'VoiceQueueId':_0x28abf9[_0x1fbd('0x29')][_0x3c6b97][_0x1fbd('0x106')]||undefined,'CampaignId':_0x28abf9[_0x1fbd('0x29')][_0x3c6b97][_0x1fbd('0x10d')]||undefined})[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x1e5')));delete _0x28abf9[_0x1fbd('0x29')][_0x3c6b97];});}else{loggerBooked['info'](_0x1fbd('0x1e6'),JSON['stringify'](_0x237207[_0x1fbd('0x12b')]),'Queue:\x20',_0x237207[_0x1fbd('0x49')]);_0x28abf9[_0x1fbd('0xb9')](_0x237207);_0x28abf9[_0x1fbd('0xc6')]({'active':![],'ContactId':_0x28abf9[_0x1fbd('0x29')][_0x3c6b97][_0x1fbd('0xd9')],'ListId':_0x28abf9[_0x1fbd('0x29')][_0x3c6b97]['ListId'],'VoiceQueueId':_0x28abf9[_0x1fbd('0x29')][_0x3c6b97]['VoiceQueueId']||undefined,'CampaignId':_0x28abf9['actions'][_0x3c6b97][_0x1fbd('0x10d')]||undefined})['catch'](loggerCatch(_0x1fbd('0x1e5')));delete _0x28abf9['actions'][_0x3c6b97];}}else{return _0x28abf9[_0x1fbd('0x166')](_0x237207,_0x529fe3);}}else{if(getDiff(_0x529fe3[_0x1fbd('0x1e7')])<_0x237207['dialRecallMeTimeout']*0x3c){if(_0x529fe3[_0x1fbd('0x156')]&&!_0x529fe3['Agent'][_0x1fbd('0x1e8')]){_0x28abf9['preview'][_0x1fbd('0x133')](_0x529fe3['id'])[_0x1fbd('0x21')](function(){_0x28abf9[_0x1fbd('0xb9')](_0x237207);});}else{_0x28abf9[_0x1fbd('0xc8')]({'active':![]},_0x529fe3['id'],0x1)['finally'](function(){_0x28abf9[_0x1fbd('0xb9')](_0x237207);});}}else{_0x237207[_0x1fbd('0x6c')]+=0x1;_0x28abf9[_0x1fbd('0xb9')](_0x237207);if(_0x237207['dialRecallInQueue']){_0x28abf9[_0x1fbd('0xc6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x529fe3[_0x1fbd('0xd9')],'ListId':_0x529fe3[_0x1fbd('0xda')],'VoiceQueueId':_0x529fe3[_0x1fbd('0x106')]||undefined,'CampaignId':_0x529fe3['CampaignId']||undefined})['catch'](loggerCatch(_0x1fbd('0x1e9')));_0x28abf9['createHistory'](createObjHistory(_0x237207,_0x529fe3,'RECALLINQUEUE',0x17,_0x1fbd('0x1ea')))[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0x1eb')));}else{_0x28abf9[_0x1fbd('0xd7')](createObjHistory(_0x237207,_0x529fe3,_0x1fbd('0x1ec'),0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0x1fbd('0x1ed'));}}}}else{_0x237207[_0x1fbd('0x65')]+=0x1;_0x28abf9[_0x1fbd('0xd7')](createObjHistory(_0x237207,_0x529fe3,'BLACKLIST',0xd,_0x1fbd('0x1ee')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0x1fbd('0x1ef');}};};Dialer[_0x1fbd('0x1e')][_0x1fbd('0x1f0')]=function(_0x16140c){var _0x50bc16=this;var _0x2c5144=_0x16140c['limitCalls']-_0x16140c[_0x1fbd('0x9b')]-_0x16140c[_0x1fbd('0xcb')];emitCampaignSummary(_0x16140c);if(_0x2c5144>0x0){if(_0x2c5144>this[_0x1fbd('0x27')]){_0x2c5144=this[_0x1fbd('0x27')];}_0x16140c['temp']+=_0x2c5144;this['getContactDialerIvr'](_0x16140c['id'],_0x2c5144,_0x16140c['dialOrderByScheduledAt'],_0x16140c)[_0x1fbd('0x44')](function(_0x135b82){_0x16140c['temp']-=_0x2c5144;_0x16140c['temp']=_0x16140c[_0x1fbd('0xcb')]>0x0?_0x16140c[_0x1fbd('0xcb')]:0x0;if(!checkContactEmpty(_0x135b82)){_0x16140c[_0x1fbd('0x47')]=_0x1fbd('0xa2');logger['info'](_0x1fbd('0x1f1')+_0x16140c[_0x1fbd('0x49')]);}else{_0x16140c[_0x1fbd('0x9b')]+=_0x135b82[_0x1fbd('0x9a')];_0x16140c['message']='RUNNING';for(var _0x3c07c9=0x0;_0x3c07c9<_0x135b82[_0x1fbd('0x9a')];_0x3c07c9+=0x1){_0x16140c['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x135b82[_0x3c07c9])||_[_0x1fbd('0xb4')](_0x135b82[_0x3c07c9][_0x1fbd('0x16a')])||_[_0x1fbd('0xb4')](_0x135b82[_0x3c07c9][_0x1fbd('0x16a')][_0x1fbd('0x169')])){_0x50bc16[_0x1fbd('0xd6')](_0x1fbd('0x1f2'),_0x16140c,_0x135b82[_0x3c07c9]);}else{_0x50bc16[_0x1fbd('0xc1')](_[_0x1fbd('0xd8')](_0x135b82[_0x3c07c9],[_0x1fbd('0x10d'),_0x1fbd('0x1f3')]))[_0x1fbd('0x44')](_0x50bc16[_0x1fbd('0x1e3')](_0x16140c,_0x135b82[_0x3c07c9]))[_0x1fbd('0xb7')](_0x50bc16['loggerHandler']('[actionOriginateIvr]\x20',_0x16140c));}}}})[_0x1fbd('0xb7')](loggerGetContactDialer(_0x1fbd('0x1f4'),_0x16140c,_0x2c5144));}};Dialer[_0x1fbd('0x1e')][_0x1fbd('0x150')]=function(_0x1bd9f8,_0x18bd01){var _0x451732=this;var _0x145c76=[];var _0x45f99d=_0x18bd01>=0x1?_0x18bd01:0x1;if(_0x1bd9f8[_0x1fbd('0x61')]===_0x1fbd('0xb')){_0x45f99d=0x1;}var _0x596300=Math['floor'](_0x1bd9f8[_0x1fbd('0x59')]*_0x45f99d)-_0x1bd9f8['originated']-_0x1bd9f8[_0x1fbd('0xcb')];emitVoiceQueueSummary(_0x1bd9f8);if(_0x1bd9f8['dialLimitQueue']>0x0){var _0x35e905=_0x1bd9f8[_0x1fbd('0x1f5')]-_0x1bd9f8[_0x1fbd('0x9b')]-_0x1bd9f8[_0x1fbd('0x5c')]-_0x1bd9f8[_0x1fbd('0xcb')]-_0x1bd9f8[_0x1fbd('0xa6')];if(_0x596300>_0x35e905){_0x596300=_0x35e905;}}if(_0x596300>0x0){if(_0x1bd9f8[_0x1fbd('0x61')]===_0x1fbd('0xb')){_0x596300=0x1;}if(_0x596300>this[_0x1fbd('0x27')]){_0x596300=this[_0x1fbd('0x27')];}_0x1bd9f8[_0x1fbd('0xcb')]+=_0x596300;for(var _0x2c7198 in this['agents']){if(typeof this[_0x1fbd('0x25')][_0x2c7198]!==_0x1fbd('0xb3')){if(this['agents'][_0x2c7198][_0x1fbd('0x108')]===_0x1fbd('0x1f6')&&this[_0x1fbd('0x25')][_0x2c7198][_0x1fbd('0xdf')]===_0x1fbd('0x1f7')){_0x145c76[_0x1fbd('0x12a')](this[_0x1fbd('0x25')][_0x2c7198]['id']);}}}this[_0x1fbd('0xca')](_0x1bd9f8['id'],_0x145c76,_0x596300,_0x1bd9f8[_0x1fbd('0x1f8')],_0x1bd9f8)['then'](function(_0x4eaa4b){_0x1bd9f8['temp']-=_0x596300;_0x1bd9f8[_0x1fbd('0xcb')]=_0x1bd9f8['temp']>0x0?_0x1bd9f8[_0x1fbd('0xcb')]:0x0;if(!checkContactEmpty(_0x4eaa4b)){_0x451732[_0x1fbd('0xbd')](_0x1bd9f8)[_0x1fbd('0x44')](sendMessageReschedule(_0x1bd9f8))[_0x1fbd('0xb7')](loggerCatch(_0x1fbd('0xbe')));}else{_0x1bd9f8[_0x1fbd('0x9b')]+=_0x4eaa4b['length'];_0x1bd9f8[_0x1fbd('0x47')]=_0x1bd9f8[_0x1fbd('0x61')]===_0x1fbd('0xb')?_0x1fbd('0x172'):_0x1fbd('0x1f9');for(var _0xa3a7e=0x0;_0xa3a7e<_0x4eaa4b[_0x1fbd('0x9a')];_0xa3a7e+=0x1){if(_[_0x1fbd('0xb4')](_0x4eaa4b[_0xa3a7e])||_[_0x1fbd('0xb4')](_0x4eaa4b[_0xa3a7e][_0x1fbd('0x16a')])||_[_0x1fbd('0xb4')](_0x4eaa4b[_0xa3a7e]['Contact']['phone'])){_0x451732[_0x1fbd('0xd6')](_0x1fbd('0x1f2'),_0x1bd9f8,_0x4eaa4b[_0xa3a7e]);}else{_0x451732[_0x1fbd('0xc0')](_[_0x1fbd('0xd8')](_0x4eaa4b[_0xa3a7e],[_0x1fbd('0x106'),_0x1fbd('0x1f3')]))[_0x1fbd('0x44')](_0x451732[_0x1fbd('0x1e3')](_0x1bd9f8,_0x4eaa4b[_0xa3a7e]))[_0x1fbd('0xb7')](_0x451732[_0x1fbd('0x1fa')](_0x1fbd('0x1f2'),_0x1bd9f8));}}}})[_0x1fbd('0xb7')](loggerGetContactDialer(_0x1fbd('0x1fb'),_0x1bd9f8,_0x596300));}};Dialer[_0x1fbd('0x1e')][_0x1fbd('0x93')]=function(_0x18f22d){if(_0x18f22d[_0x1fbd('0x1f5')]>0x0){var _0x243647=_0x18f22d[_0x1fbd('0x1f5')]-_0x18f22d[_0x1fbd('0x9b')]-_0x18f22d[_0x1fbd('0x5c')];if(_0x243647>0x0){this[_0x1fbd('0x1fc')](_0x18f22d);}else{loggerPredictiveCalls[_0x1fbd('0x83')](_0x1fbd('0x1fd'));}}else{this[_0x1fbd('0x1fc')](_0x18f22d);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x5b4715){var _0x349e12=this;var _0x2ac1b0=[];_0x5b4715[_0x1fbd('0x9b')]+=0x1;for(var _0x561705 in this['agents']){if(typeof this[_0x1fbd('0x25')][_0x561705]!=='undefined'){if(this[_0x1fbd('0x25')][_0x561705][_0x1fbd('0x108')]===_0x1fbd('0x1f6')&&this[_0x1fbd('0x25')][_0x561705]['status']===_0x1fbd('0x1f7')){_0x2ac1b0[_0x1fbd('0x12a')](this['agents'][_0x561705]['id']);}}}this['getContactDialer'](_0x5b4715['id'],_0x2ac1b0,0x1,_0x5b4715[_0x1fbd('0x1f8')],_0x5b4715)[_0x1fbd('0x44')](function(_0x2197c5){if(!checkContactEmpty(_0x2197c5)){checkContactLowerLimitOriginate(_0x5b4715,0x1,0x0);_0x349e12[_0x1fbd('0xbd')](_0x5b4715)[_0x1fbd('0x44')](sendMessageReschedule(_0x5b4715))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x5b4715[_0x1fbd('0x47')]=_0x1fbd('0x1f9');if(_[_0x1fbd('0xb4')](_0x2197c5[0x0])||_[_0x1fbd('0xb4')](_0x2197c5[0x0]['Contact'])||_[_0x1fbd('0xb4')](_0x2197c5[0x0][_0x1fbd('0x16a')][_0x1fbd('0x169')])){_0x349e12[_0x1fbd('0xd6')](_0x1fbd('0x1f2'),_0x5b4715,_0x2197c5[0x0]);}else{_0x349e12['checkIsBlackList'](_[_0x1fbd('0xd8')](_0x2197c5[0x0],[_0x1fbd('0x106'),_0x1fbd('0x1f3')]))[_0x1fbd('0x44')](_0x349e12[_0x1fbd('0x1e3')](_0x5b4715,_0x2197c5[0x0]))['catch'](_0x349e12[_0x1fbd('0x1fa')](_0x1fbd('0x1fe'),_0x5b4715));}}})[_0x1fbd('0xb7')](loggerGetContactDialer(_0x1fbd('0x1ff'),_0x5b4715,0x1));emitVoiceQueueSummary(_0x5b4715);};Dialer[_0x1fbd('0x1e')][_0x1fbd('0x1da')]=function(_0x380aed,_0x1432c7,_0xc29250,_0x3e8308,_0x1f7464,_0x18ea84){loggerPredictive[_0x1fbd('0x83')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0x1fbd('0x200'),_0x380aed);loggerPredictive[_0x1fbd('0x83')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1432c7);loggerPredictive['info'](_0x1fbd('0x201'),_0xc29250);loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x202'),_0x3e8308);loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x203'),_0x1f7464);loggerPredictive[_0x1fbd('0x83')]('---------------------------');return new BPromise(function(_0x56e83f,_0x43a931){if(_0x380aed<=0x0||isNaN(_0x380aed)){return _0x43a931(msgResponse(_0x1fbd('0x204'),_0x1fbd('0x192'),_0x1fbd('0x205')+_0x380aed));}if(_0xc29250<=0x0||isNaN(_0xc29250)){return _0x43a931(msgResponse(_0x1fbd('0x204'),'Error',_0x1fbd('0x206')+_0xc29250));}if(_0x3e8308<=0x0||isNaN(_0x3e8308)){return _0x43a931(msgResponse('[abandonmentRate]',_0x1fbd('0x192'),_0x1fbd('0x207')+_0x3e8308));}if(_0x1432c7<=0x0||isNaN(_0x1432c7)){return _0x43a931(msgResponse(_0x1fbd('0x204'),_0x1fbd('0x192'),_0x1fbd('0x208')+_0x1432c7));}if(_0x1f7464<=0x0||isNaN(_0x1f7464)){return _0x43a931(msgResponse('[abandonmentRate]',_0x1fbd('0x192'),_0x1fbd('0x209')+_0x1f7464));}_0x18ea84=_0x18ea84||0x0;var _0x1d61d1=0x1/_0xc29250;var _0x468483=0x0;var _0x37e673=0x0;var _0x2effbd=0x0;var _0x52ea10=0x0;for(var _0x3f3c2d=0x0;_0x2effbd<_0x1f7464;_0x3f3c2d+=0x1){_0x37e673=_0x3f3c2d/_0x1432c7;_0x468483=(_0x3e8308*_0x37e673+_0x18ea84)/_0x1d61d1;_0x2effbd=erlangb(_0x468483,_0x380aed);_0x52ea10=_0x468483/_0x380aed*(0x1-erlangb(_0x468483,_0x380aed));}return _0x56e83f({'erlangCalls':_0x3f3c2d,'erlangCallToSecond':_0x1432c7/_0x3f3c2d,'erlangAbandonmentRate':_0x2effbd,'erlangBusyFactor':_0x52ea10});});};Dialer[_0x1fbd('0x1e')]['busyFactor']=function(_0x3fb410,_0x38eb3f,_0x34a302,_0x12b76c,_0x55e3f4,_0x1bf262){loggerPredictive['info'](_0x1fbd('0x20a'));loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x200'),_0x3fb410);loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x20b'),_0x38eb3f);loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x201'),_0x34a302);loggerPredictive['info'](_0x1fbd('0x202'),_0x12b76c);loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x20c'),_0x55e3f4);loggerPredictive[_0x1fbd('0x83')](_0x1fbd('0x91'));return new BPromise(function(_0x1774ff,_0x322ded){if(_0x3fb410<=0x0||isNaN(_0x3fb410)){return _0x322ded(msgResponse(_0x1fbd('0x20d'),_0x1fbd('0x192'),_0x1fbd('0x205')+_0x3fb410));}if(_0x34a302<=0x0||isNaN(_0x34a302)){return _0x322ded(msgResponse(_0x1fbd('0x20d'),_0x1fbd('0x192'),_0x1fbd('0x206')+_0x34a302));}if(_0x12b76c<=0x0||isNaN(_0x12b76c)){return _0x322ded(msgResponse(_0x1fbd('0x20d'),_0x1fbd('0x192'),_0x1fbd('0x207')+_0x12b76c));}if(_0x38eb3f<=0x0||isNaN(_0x38eb3f)){return _0x322ded(msgResponse('[busyFactor]',_0x1fbd('0x192'),_0x1fbd('0x208')+_0x38eb3f));}if(_0x55e3f4<=0x0||isNaN(_0x55e3f4)){return _0x322ded(msgResponse('[busyFactor]','Error',_0x1fbd('0x20e')+_0x55e3f4));}_0x1bf262=_0x1bf262||0x0;var _0x563654=0x1/_0x34a302;var _0x40faa2=0x0;var _0x38bf92=0x0;var _0x3026b3=0x0;var _0xe5a6e=0x0;for(var _0x19e719=0x0;_0xe5a6e<_0x55e3f4;_0x19e719+=0x1){_0x38bf92=_0x19e719/_0x38eb3f;_0x40faa2=(_0x12b76c*_0x38bf92+_0x1bf262)/_0x563654;_0x3026b3=erlangb(_0x40faa2,_0x3fb410);_0xe5a6e=_0x40faa2/_0x3fb410*(0x1-erlangb(_0x40faa2,_0x3fb410));}return _0x1774ff({'erlangCalls':_0x19e719,'erlangCallToSecond':_0x38eb3f/_0x19e719,'erlangAbandonmentRate':_0x3026b3,'erlangBusyFactor':_0xe5a6e});});};module['exports']=Dialer; \ No newline at end of file +var _0xc1c1=['tags','createdAt','%s%s','XMD-','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','trim','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','getQueue','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','object','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','countglobal','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','stateGlobal','Busy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','busyFactor','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','RUNNING','[actionOriginate]\x20','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','emptyContact','[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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./queueCallerAbandon','127.0.0.1','rrmemory','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','Error','stringify','milliseconds','diff','seconds','emit','type','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','startProgressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','undefined','isNil','Action','status','channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','catch','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','notFound','saveInDb','pick','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','SIP/%s','reachable','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD]','MACHINE','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','outboundAnswerAgiCallsDay','Machine','countdropretry','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','TIMEOUT','dialDropMaxRetry','minutes','[rescheduleContact][Drop]','calleridname','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridnum','[syncAgentComplete][createHistory][11]','actionid','strategy','roundrobin','locked','agents','stateinterface','push','idHopper','paused','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','queueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','interval','content','true','iftime\x20%s,%s','indexOf','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','dialActive','dialGlobalInterval','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','syncCampaigns','pow','replace','random','match','originate','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','outbound','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc1c1,0x9c));var _0x1c1c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc1c1[_0x167cc1];return _0x10bc4b;};'use strict';var util=require(_0x1c1c('0x0'));var _=require(_0x1c1c('0x1'));var BPromise=require(_0x1c1c('0x2'));var uuid=require(_0x1c1c('0x3'));var moment=require(_0x1c1c('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x1c1c('0x5'));var ut=require(_0x1c1c('0x6'));var config=require(_0x1c1c('0x7'));var logger=require(_0x1c1c('0x8'))(_0x1c1c('0x9'));var loggerBooked=require(_0x1c1c('0x8'))(_0x1c1c('0xa'));var loggerPredictive=require('../../../config/logger')(_0x1c1c('0xb'));var loggerPredictiveCalls=require('../../../config/logger')(_0x1c1c('0xc'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x1c1c('0xd'));var ami=require(_0x1c1c('0xe'));config[_0x1c1c('0xf')]=_[_0x1c1c('0x10')](config['redis'],{'host':_0x1c1c('0x11'),'port':0x18eb});var io=require(_0x1c1c('0x12'))(new Redis(config[_0x1c1c('0xf')]));var cmHopper=require(_0x1c1c('0x13'));var cmHopperHistory=require(_0x1c1c('0x14'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x1c1c('0x15'));var RpcSetting=require('../rpc/setting');var Action=require(_0x1c1c('0x16'));var History=require(_0x1c1c('0x17'));var Final=require(_0x1c1c('0x18'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x1c1c('0x19'));var Hangup=require('./hangup');var ipAgi=process['env']['XCALLY_IP_AGI']||_0x1c1c('0x1a');var strategy={'rrmemory':_0x1c1c('0x1b'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x1c1c('0x1c')][_0x1c1c('0x1d')]=function(_0x34e2ce){this['tail']=this[_0x1c1c('0x1e')]?this['tail']['finally'](_0x34e2ce):_0x34e2ce();};function Dialer(_0x14abc0,_0x39db67){this[_0x1c1c('0x1f')]=new Sequence();this[_0x1c1c('0x20')]=_0x39db67;this[_0x1c1c('0x21')]=_0x14abc0[_0x1c1c('0x21')];this[_0x1c1c('0x22')]=_0x14abc0[_0x1c1c('0x22')];this['agents']=_0x14abc0['agents'];this[_0x1c1c('0x23')]=_0x14abc0[_0x1c1c('0x23')];this[_0x1c1c('0x24')]=config[_0x1c1c('0x24')]||0x2;this['channels']={};this[_0x1c1c('0x25')]={};this[_0x1c1c('0x26')]={};this[_0x1c1c('0x27')]={};this[_0x1c1c('0x28')]={};this[_0x1c1c('0x29')]={};this['startProgressive']={};this[_0x1c1c('0x2a')]={};this[_0x1c1c('0x2b')]={};this[_0x1c1c('0x2c')]={};ami['on']('agentconnect',this[_0x1c1c('0x2d')][_0x1c1c('0x2e')](this));ami['on'](_0x1c1c('0x2f'),this['syncQueueCallerAbandon'][_0x1c1c('0x2e')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x1c1c('0x2e')](this));ami['on'](_0x1c1c('0x30'),this[_0x1c1c('0x31')][_0x1c1c('0x2e')](this));ami['on'](_0x1c1c('0x32'),this[_0x1c1c('0xd')]['bind'](this));ami['on'](_0x1c1c('0x33'),this[_0x1c1c('0x34')][_0x1c1c('0x2e')](this));ami['on'](_0x1c1c('0x35'),this['syncNewExten'][_0x1c1c('0x2e')](this));ami['on'](_0x1c1c('0x36'),this[_0x1c1c('0x37')][_0x1c1c('0x2e')](this));ami['on'](_0x1c1c('0x38'),this[_0x1c1c('0x39')][_0x1c1c('0x2e')](this));ami['on']('queuestatuscomplete',this[_0x1c1c('0x3a')][_0x1c1c('0x2e')](this));this[_0x1c1c('0x3b')]();this['loopClearZombieChannels']();RpcSetting[_0x1c1c('0x3c')]()[_0x1c1c('0x3d')](function(_0x4bef1e){previewRecallmeReminderInterval=_0x4bef1e[_0x1c1c('0x3e')];});}function isNotNull(_0x12e372){return _0x12e372!==null&&!_['isUndefined'](_0x12e372);}function checkIsLoggedIn(_0x36ea24,_0x1c3bb1){return function(){if(_0x1c3bb1<=0x0){_0x36ea24[_0x1c1c('0x3f')]='AGENTS_NOT_LOGGED';throw _0x36ea24[_0x1c1c('0x40')]+_0x1c1c('0x41');}};}function isActive(_0x24f510){return _0x24f510;}function checkIsActive(_0x11a19e,_0x41d06a){return function(){if(!isActive(_0x41d06a)){_0x11a19e[_0x1c1c('0x3f')]=_0x1c1c('0x42');throw _0x11a19e[_0x1c1c('0x40')]+_0x1c1c('0x43');}};}function checkInterval(_0x27baef){return function(){if(!isNotNull(_0x27baef[_0x1c1c('0x44')])){_0x27baef[_0x1c1c('0x3f')]=_0x1c1c('0x45');throw _0x27baef['name']+_0x1c1c('0x46');}if(!isNotNull(_0x27baef[_0x1c1c('0x44')][_0x1c1c('0x47')])){_0x27baef[_0x1c1c('0x3f')]=_0x1c1c('0x45');throw _0x27baef['name']+_0x1c1c('0x46');}if(!isNotNull(_['isEmpty'](_0x27baef[_0x1c1c('0x44')][_0x1c1c('0x47')]))){_0x27baef[_0x1c1c('0x3f')]='INTERVAL_IS_NULL';throw _0x27baef[_0x1c1c('0x40')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x53dc2d,_0x115675,_0x2c4e45){return{'action':_0x53dc2d,'response':_0x115675,'message':_0x2c4e45,'stack':_0x2c4e45};}function myreject(_0x235661){return function(_0x1e5616){return _0x235661(msgResponse('[ifTime][Action]',_0x1c1c('0x48'),JSON[_0x1c1c('0x49')](_0x1e5616)));};}function getSeconds(_0x197132,_0x1fcea4){var _0x37ac77=moment(_0x197132)[_0x1c1c('0x4a')](0x0);var _0xcc76ca=moment(_0x1fcea4)[_0x1c1c('0x4a')](0x0);return _0x37ac77[_0x1c1c('0x4b')](_0xcc76ca,_0x1c1c('0x4c'));}function emit(_0x1e3658,_0x2f85b2,_0x983e53){io['to'](_0x1e3658)[_0x1c1c('0x4d')](_0x2f85b2,_0x983e53);}function emitVoiceQueueSummary(_0x5546bc){if(_0x5546bc[_0x1c1c('0x4e')]==='outbound'){var _0x2c9bae={'id':_0x5546bc['id'],'name':_0x5546bc[_0x1c1c('0x40')],'strategy':_0x5546bc['strategy'],'answered':_0x5546bc['answered'],'available':_0x5546bc[_0x1c1c('0x4f')],'loggedIn':_0x5546bc[_0x1c1c('0x50')],'pTalking':_0x5546bc[_0x1c1c('0x51')],'sumBillable':_0x5546bc[_0x1c1c('0x52')],'sumDuration':_0x5546bc[_0x1c1c('0x53')],'sumHoldTime':_0x5546bc[_0x1c1c('0x54')]||0x0,'talking':_0x5546bc[_0x1c1c('0x55')],'total':_0x5546bc[_0x1c1c('0x56')],'type':_0x5546bc[_0x1c1c('0x4e')],'unmanaged':_0x5546bc['unmanaged'],'abandoned':_0x5546bc[_0x1c1c('0x57')],'waiting':_0x5546bc[_0x1c1c('0x58')],'loggedInDb':_0x5546bc[_0x1c1c('0x59')],'dialActive':_0x5546bc['dialActive'],'dialMethod':_0x5546bc[_0x1c1c('0x5a')],'dialOriginateCallerIdName':_0x5546bc[_0x1c1c('0x5b')],'dialOriginateCallerIdNumber':_0x5546bc[_0x1c1c('0x5c')],'dialOriginateTimeout':_0x5546bc[_0x1c1c('0x5d')],'dialPrefix':_0x5546bc[_0x1c1c('0x5e')],'outboundAnswerAgiCallsDay':_0x5546bc['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x5546bc['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x5546bc[_0x1c1c('0x5f')],'outboundBusyCallsDay':_0x5546bc[_0x1c1c('0x60')],'outboundCongestionCallsDay':_0x5546bc['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x5546bc[_0x1c1c('0x61')],'outboundDropCallsDayCallersExit':_0x5546bc[_0x1c1c('0x62')],'outboundDropCallsDayTimeout':_0x5546bc[_0x1c1c('0x63')],'outboundNoAnswerCallsDay':_0x5546bc[_0x1c1c('0x64')],'outboundNoSuchCallsDay':_0x5546bc['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x5546bc['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5546bc['outboundReCallsDay'],'outboundRejectCallsDay':_0x5546bc[_0x1c1c('0x65')],'outboundUnknownCallsDay':_0x5546bc[_0x1c1c('0x66')],'predictiveIntervalAnsweredCalls':_0x5546bc[_0x1c1c('0x67')],'predictiveIntervalAvgHoldtime':_0x5546bc[_0x1c1c('0x68')],'predictiveIntervalAvgTalktime':_0x5546bc[_0x1c1c('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x5546bc[_0x1c1c('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x5546bc[_0x1c1c('0x6b')],'predictiveIntervalErlangCalls':_0x5546bc['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x5546bc[_0x1c1c('0x6c')],'predictiveIntervalHitRate':_0x5546bc[_0x1c1c('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x5546bc[_0x1c1c('0x6e')],'predictiveIntervalPauses':_0x5546bc['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x5546bc[_0x1c1c('0x6f')],'predictiveIntervalTotalCalls':_0x5546bc[_0x1c1c('0x70')],'message':_0x5546bc[_0x1c1c('0x3f')],'originated':_0x5546bc[_0x1c1c('0x71')],'erlangCalls':_0x5546bc[_0x1c1c('0x72')],'erlangCallToSecond':_0x5546bc[_0x1c1c('0x73')],'erlangAbandonmentRate':_0x5546bc[_0x1c1c('0x74')],'erlangBusyFactor':_0x5546bc['erlangBusyFactor'],'startPredictive':_0x5546bc[_0x1c1c('0x29')],'startProgressive':_0x5546bc['startProgressive']};if(_0x5546bc[_0x1c1c('0x75')]){_0x2c9bae['Trunk']={'id':_0x5546bc[_0x1c1c('0x75')]['id'],'name':_0x5546bc[_0x1c1c('0x75')]['name'],'active':_0x5546bc[_0x1c1c('0x75')][_0x1c1c('0x76')],'callerid':_0x5546bc['Trunk']['callerid']};}if(_0x5546bc[_0x1c1c('0x44')]){_0x2c9bae[_0x1c1c('0x44')]={'id':_0x5546bc[_0x1c1c('0x44')]['id'],'name':_0x5546bc['Interval']['name']};}var _0x4654ab=md5(JSON[_0x1c1c('0x49')](_0x2c9bae));if(_0x5546bc[_0x1c1c('0x77')]!==_0x4654ab){_0x5546bc[_0x1c1c('0x77')]=_0x4654ab;emit(util[_0x1c1c('0x78')](_0x1c1c('0x79'),_0x2c9bae[_0x1c1c('0x40')]),_0x1c1c('0x7a'),_0x2c9bae);}}}function emitCampaignSummary(_0x1e17be){if(_0x1e17be[_0x1c1c('0x4e')]===_0x1c1c('0x7b')){emit(util['format'](_0x1c1c('0x7c'),_0x1e17be[_0x1c1c('0x40')]),_0x1c1c('0x7d'),_0x1e17be);}}function checkGetDataPredictive(_0xc5a583){if(isNotNull(_0xc5a583)&&!_['isEmpty'](_0xc5a583)){loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x7f'));loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x80'),_0xc5a583[_0x1c1c('0x70')]);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x81'),_0xc5a583[_0x1c1c('0x67')]);loggerPredictive[_0x1c1c('0x7e')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xc5a583['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x82'),_0xc5a583[_0x1c1c('0x6a')]);loggerPredictive['info'](_0x1c1c('0x83'),_0xc5a583[_0x1c1c('0x68')]);loggerPredictive[_0x1c1c('0x7e')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xc5a583[_0x1c1c('0x69')]);loggerPredictive['info'](_0x1c1c('0x84'));if(_0xc5a583[_0x1c1c('0x70')]>0x0){if(!_[_0x1c1c('0x85')](_0xc5a583[_0x1c1c('0x69')])&&_0xc5a583[_0x1c1c('0x69')]>0x0){return!![];}loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x86'));if(!_[_0x1c1c('0x85')](_0xc5a583['predictiveIntervalAvgHoldtime'])&&_0xc5a583[_0x1c1c('0x68')]>0x0){return!![];}loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x87'));}else{loggerPredictive['info'](_0x1c1c('0x88'));}}else{loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x89'));}return![];}function mergeDataErlangB(_0x1eb583){return function(_0x3eb907){loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x8a'));loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x8b'),_0x3eb907[_0x1c1c('0x72')]);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x8c'),_0x3eb907['erlangCallToSecond']);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x8d'),_0x3eb907[_0x1c1c('0x74')]);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x8e'),_0x3eb907['erlangBusyFactor']);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x8d'),_0x3eb907['erlangAbandonmentRate']);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x84'));_[_0x1c1c('0x8f')](_0x1eb583,_0x3eb907);};}function getDiff(_0x3a7a21){var _0x2cf974=moment()['milliseconds'](0x0);var _0x191e26=moment(_0x3a7a21)['milliseconds'](0x0);return _0x2cf974[_0x1c1c('0x4b')](_0x191e26,_0x1c1c('0x4c'));}function ifInterval(_0x2edde5,_0x29be10){if(_[_0x1c1c('0x85')](_0x29be10)){return![];}return getDiff(_0x29be10)<_0x2edde5*0x3c;}function freeVariablesPredictive(_0x13d732){if(isNotNull(_0x13d732)){if(!_[_0x1c1c('0x85')](_0x13d732[_0x1c1c('0x90')])){_0x13d732[_0x1c1c('0x90')]=undefined;loggerPredictive['info'](_0x13d732['name'],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x13d732[_0x1c1c('0x29')])){_0x13d732[_0x1c1c('0x29')]=undefined;loggerPredictive[_0x1c1c('0x7e')](_0x13d732[_0x1c1c('0x40')],_0x1c1c('0x91'));}if(!_[_0x1c1c('0x85')](_0x13d732[_0x1c1c('0x92')])){clearInterval(_0x13d732[_0x1c1c('0x92')]);_0x13d732[_0x1c1c('0x92')]=undefined;loggerPredictive['info'](_0x13d732[_0x1c1c('0x40')],_0x1c1c('0x93'));}}}function erlangb(_0x3f3f5d,_0x2b47ad){if(_0x2b47ad===0x0){return 0x0;}var _0x994735=0x1;for(var _0x2bc1aa=0x1;_0x2bc1aa<=_0x2b47ad;_0x2bc1aa+=0x1){_0x994735=0x1+_0x994735*_0x2bc1aa/_0x3f3f5d;}return 0x1/_0x994735;}function isVoiceQueueOutbound(_0x368b5d){return _0x368b5d==='outbound';}function isNotPreview(_0x181453){return _0x181453!==_0x1c1c('0x20');}function isCampaignIvr(_0x341942){return _0x341942===_0x1c1c('0x7b');}function getCallerId(_0x48b7e0,_0x5b3176,_0x196eca){if(!_[_0x1c1c('0x85')](_0x196eca)&&typeof _0x196eca===_0x1c1c('0x94')&&!_[_0x1c1c('0x95')](_0x196eca)){if(!_[_0x1c1c('0x85')](_0x5b3176)&&typeof _0x5b3176===_0x1c1c('0x94')&&!_[_0x1c1c('0x95')](_0x5b3176)){return util[_0x1c1c('0x78')]('\x22%s\x22\x20<%s>',_0x5b3176,_0x196eca);}return util[_0x1c1c('0x78')](_0x1c1c('0x96'),_0x196eca,_0x196eca);}if(!_[_0x1c1c('0x85')](_0x48b7e0)&&typeof _0x48b7e0===_0x1c1c('0x94')&&!_[_0x1c1c('0x95')](_0x48b7e0)){return _0x48b7e0;}return _0x1c1c('0x97');}function loggerCatchQueueSummary(_0x334b79,_0x1d30dc){return function(_0x18ee9c){freeVariablesPredictive(_0x1d30dc);emitVoiceQueueSummary(_0x1d30dc);emitCampaignSummary(_0x1d30dc);loggerSyncQueueSummary[_0x1c1c('0x98')](_0x334b79,util[_0x1c1c('0x99')](_0x18ee9c,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x345368,_0x23e9f9){return function(_0xfc7893){loggerPredictive[_0x1c1c('0x98')](_0x23e9f9[_0x1c1c('0x40')],_0x345368);loggerPredictive[_0x1c1c('0x98')](_0xfc7893['stack']);freeVariablesPredictive(_0x23e9f9);};}function loggerCatch(_0x339df0){return function(_0x5d4240){logger[_0x1c1c('0x98')](_0x339df0,util[_0x1c1c('0x99')](_0x5d4240,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x23d042){return _0x23d042&&!_['isUndefined'](_0x23d042)&&_0x23d042[_0x1c1c('0x9a')]>0x0;}function decremetOriginate(_0x87be34){if(!_[_0x1c1c('0x85')](_0x87be34)&&_0x87be34!==null){if(typeof _0x87be34['originated']!=='undefined'){if(_0x87be34['originated']>0x0){_0x87be34[_0x1c1c('0x71')]-=0x1;}else{logger['error'](_0x1c1c('0x9b'));}}}else{logger['error'](_0x1c1c('0x9c'));}}function checkContactLowerLimitOriginate(_0xaabbf0,_0x25ad92,_0x385cb9){if(_0x25ad92>_0x385cb9){for(var _0x4fb742=0x0;_0x4fb742<_0x25ad92-_0x385cb9;_0x4fb742+=0x1){decremetOriginate(_0xaabbf0);}}}function loggerGetContactDialer(_0x4c4f98,_0x427d48,_0x227bdc){return function(_0xb01563){checkContactLowerLimitOriginate(_0x427d48,_0x227bdc,0x0);logger[_0x1c1c('0x98')](_0x4c4f98,util[_0x1c1c('0x99')](_0xb01563,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xbd8607){return function(_0x44c5cb){if(isNotNull(_0x44c5cb)&&isNotNull(_0x44c5cb[0x0])){if(_0x44c5cb[0x0]['contactsRescheduled']>0x0){_0xbd8607['message']=_0x1c1c('0x9d');logger[_0x1c1c('0x7e')](_0x1c1c('0x9e')+_0xbd8607['name'],_0x44c5cb[0x0][_0x1c1c('0x9f')],_0x1c1c('0xa0'));}else{_0xbd8607[_0x1c1c('0x3f')]='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x1c1c('0xa1')+_0xbd8607[_0x1c1c('0x40')]);}}};}function notSendMessagesQueue(_0x53dd9b){if(_0x53dd9b[_0x1c1c('0xa2')]){freeVariablesPredictive(_0x53dd9b);if(_0x53dd9b['originated']===0x0&&_0x53dd9b[_0x1c1c('0x55')]===0x0&&_0x53dd9b['waiting']===0x0&&(_0x53dd9b['pTalking']||0x0)===0x0){_0x53dd9b[_0x1c1c('0xa2')]=![];_0x53dd9b[_0x1c1c('0x4f')]=0x0;_0x53dd9b[_0x1c1c('0x3f')]=_0x1c1c('0x42');loggerSyncQueueSummary[_0x1c1c('0x98')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x53dd9b[_0x1c1c('0x40')],_0x1c1c('0xa3'));}else{_0x53dd9b[_0x1c1c('0x3f')]=_0x1c1c('0xa4');loggerSyncQueueSummary[_0x1c1c('0x98')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x53dd9b[_0x1c1c('0x40')],_0x1c1c('0xa5'));}emitVoiceQueueSummary(_0x53dd9b);}}function notSendMessagesCampaign(_0x484c79){if(_0x484c79[_0x1c1c('0xa2')]){if(_0x484c79[_0x1c1c('0x71')]===0x0){_0x484c79['sendMessageOneNotActive']=![];_0x484c79[_0x1c1c('0x3f')]=_0x1c1c('0x42');loggerSyncQueueSummary[_0x1c1c('0x98')](_0x1c1c('0xa6'),_0x484c79[_0x1c1c('0x40')],_0x1c1c('0xa3'));}else{_0x484c79[_0x1c1c('0x3f')]=_0x1c1c('0xa4');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x484c79['name'],_0x1c1c('0xa5'));}emitCampaignSummary(_0x484c79);}}function createObjHistory(_0x3e975e,_0x31d5c2,_0x2c0cb3,_0x2d2ad2,_0x111d8b){_0x3e975e['message']=_0x2c0cb3;var _0xf2070e=new Action(_0x3e975e,_0x31d5c2);var _0x171b09=new History(_0xf2070e);_0x171b09[_0x1c1c('0xa7')]=_0x2d2ad2;_0x171b09[_0x1c1c('0xa8')]=_0x111d8b;_0x171b09[_0x1c1c('0xa9')]=_0xf2070e[_0x1c1c('0xaa')];return _0x171b09;}Dialer[_0x1c1c('0x1c')][_0x1c1c('0xab')]=function(){var _0x3eaea9=this;setInterval(function(){_0x3eaea9[_0x1c1c('0xac')](_0x3eaea9[_0x1c1c('0x27')],_0x1c1c('0xad'));_0x3eaea9[_0x1c1c('0xac')](_0x3eaea9[_0x1c1c('0x25')],_0x1c1c('0xae'));},0x32c8);};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xac')]=function(_0x5e53e4,_0x380f10){var _0x119496=this;for(var _0x1c5b35 in _0x5e53e4){if(typeof _0x5e53e4[_0x1c5b35]!==_0x1c1c('0xaf')){this[_0x1c1c('0x1f')][_0x1c1c('0x1d')](function(){if(!_[_0x1c1c('0xb0')](_0x5e53e4[_0x1c5b35])){return ami[_0x1c1c('0xb1')]({'action':_0x1c1c('0xb2'),'channel':_0x5e53e4[_0x1c5b35][_0x1c1c('0xb3')]})['catch'](function(_0xde707){if(_0xde707[_0x1c1c('0x3f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5e53e4[_0x1c5b35]&&_0x5e53e4[_0x1c5b35]['type']!==_0x1c1c('0x7b')){_0x119496['updateOriginated'](_0x119496[_0x1c1c('0x21')][_0x5e53e4[_0x1c5b35][_0x1c1c('0xb4')]]);logger[_0x1c1c('0x98')](_0x1c1c('0xb5'),_0x380f10,_0x1c5b35,_0x5e53e4[_0x1c5b35][_0x1c1c('0xb4')]);delete _0x5e53e4[_0x1c5b35];}if(_0x5e53e4[_0x1c5b35]&&_0x5e53e4[_0x1c5b35]['type']===_0x1c1c('0x7b')){_0x119496[_0x1c1c('0xb6')](_0x119496[_0x1c1c('0x22')][_0x5e53e4[_0x1c5b35]['queue']]);logger[_0x1c1c('0x98')](_0x1c1c('0xb7'),_0x380f10,_0x1c5b35,_0x5e53e4[_0x1c5b35][_0x1c1c('0xb4')]);delete _0x5e53e4[_0x1c5b35];}},0x2328);}});}});}}};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xb8')]=function(_0x3c567a){return BPromise['resolve']()[_0x1c1c('0x3d')](cmHopper[_0x1c1c('0xb8')](_0x3c567a))[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xba')));};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xbb')]=function(_0x573f24){return BPromise[_0x1c1c('0xbc')]()['then'](cmHopperBlack['checkIsBlackList'](_0x573f24))['catch'](loggerCatch(_0x1c1c('0xbd')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x38b911){return BPromise[_0x1c1c('0xbc')]()['then'](cmHopperBlack[_0x1c1c('0xbe')](_0x38b911))[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xbf')));};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xc0')]=function(_0x1046bd){return BPromise[_0x1c1c('0xbc')]()[_0x1c1c('0x3d')](cmHopperHistory['avgHandleTime'](_0x1046bd))[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xc1')));};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xc2')]=function(_0x5cd24c){return BPromise[_0x1c1c('0xbc')]()[_0x1c1c('0x3d')](cmHopper['rescheduleContact'](_0x5cd24c))['catch'](loggerCatch(_0x1c1c('0xc3')));};Dialer[_0x1c1c('0x1c')]['unlockContact']=function(_0x250a5e,_0x265128,_0x5becf7){return BPromise[_0x1c1c('0xbc')]()[_0x1c1c('0x3d')](cmHopper[_0x1c1c('0xc4')](_0x250a5e,_0x265128,_0x5becf7))[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xc5')));};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xc6')]=function(_0x145d9d,_0x35cb20,_0x5a2ac6,_0x3e2a20,_0x5444e1){return BPromise[_0x1c1c('0xbc')]()[_0x1c1c('0x3d')](cmHopper[_0x1c1c('0xc6')](_0x145d9d,_0x35cb20,_0x5a2ac6,_0x3e2a20))[_0x1c1c('0xb9')](function(_0x5197e6){_0x5444e1[_0x1c1c('0xc7')]-=_0x5a2ac6;_0x5444e1[_0x1c1c('0xc7')]=_0x5444e1[_0x1c1c('0xc7')]>0x0?_0x5444e1[_0x1c1c('0xc7')]:0x0;loggerCatch(_0x1c1c('0xc8'))(_0x5197e6);});};Dialer['prototype'][_0x1c1c('0xc9')]=function(_0x1c716f,_0x120cc5,_0x10d08c,_0x1ee3f4){return BPromise[_0x1c1c('0xbc')]()[_0x1c1c('0x3d')](cmHopper['getContactDialerIvr'](_0x1c716f,_0x120cc5,_0x10d08c))['catch'](function(_0x35b464){_0x1ee3f4['temp']-=_0x120cc5;_0x1ee3f4[_0x1c1c('0xc7')]=_0x1ee3f4[_0x1c1c('0xc7')]>0x0?_0x1ee3f4[_0x1c1c('0xc7')]:0x0;loggerCatch(_0x1c1c('0xca'))(_0x35b464);});};Dialer[_0x1c1c('0x1c')]['getVoiceQueueRtPauses']=function(_0x466122){return BPromise['resolve']()[_0x1c1c('0x3d')](voiceQueueRt[_0x1c1c('0xcb')](_0x466122))[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xcc')));};Dialer['prototype'][_0x1c1c('0xcd')]=function(_0x107320){return BPromise[_0x1c1c('0xbc')]()['then'](cmHopper['moveContactManagedDialer'](_0x107320))['catch'](loggerCatch(_0x1c1c('0xce')));};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xcf')]=function(_0x2719c0){return BPromise[_0x1c1c('0xbc')]()['then'](cmHopperHistory[_0x1c1c('0xcf')](_0x2719c0))[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xd0')));};Dialer['prototype'][_0x1c1c('0xb6')]=function(_0x2d9828){if(!_[_0x1c1c('0x85')](_0x2d9828)&&_0x2d9828!==null){if(typeof _0x2d9828[_0x1c1c('0x71')]!==_0x1c1c('0xaf')){if(_0x2d9828[_0x1c1c('0x71')]>0x0){_0x2d9828[_0x1c1c('0x71')]-=0x1;}else{logger[_0x1c1c('0x98')](_0x1c1c('0xd1'));}}}else{logger['error'](_0x1c1c('0xd2'));}};Dialer[_0x1c1c('0x1c')]['loggerHandler']=function(_0x3d70e9,_0x484f18){var _0x3144e8=this;return function(_0x1de8fb){_0x3144e8[_0x1c1c('0xb6')](_0x484f18);logger['error'](_0x3d70e9,util[_0x1c1c('0x99')](_0x1de8fb,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x586e7a,_0xf6e31d,_0x62961){var _0x2ebfc7={'state':0x19,'statedesc':_0x1c1c('0xd3')};this[_0x1c1c('0xb6')](_0xf6e31d);this[_0x1c1c('0xd4')](_[_0x1c1c('0x8f')](_0x2ebfc7,_[_0x1c1c('0xd5')](_0x62961,[_0x1c1c('0xd6'),_0x1c1c('0xd7'),_0x1c1c('0xd8'),'VoiceQueueId',_0x1c1c('0xd9')])),_0x1c1c('0xda'),_0x1c1c('0xdb'));logger[_0x1c1c('0x98')](_0x586e7a);};Dialer[_0x1c1c('0x1c')]['isSuccess']=function(_0x538586){return _0x538586===_0x1c1c('0xdc');};Dialer['prototype'][_0x1c1c('0xdd')]=function(_0x38ae0e){return!_['isUndefined'](_0x38ae0e)&&_0x38ae0e&&!_[_0x1c1c('0x85')](_0x38ae0e[_0x1c1c('0x40')])&&!_['isUndefined'](_0x38ae0e[_0x1c1c('0x76')])&&_0x38ae0e[_0x1c1c('0x76')]&&(this[_0x1c1c('0x23')][util[_0x1c1c('0x78')](_0x1c1c('0xde'),_0x38ae0e[_0x1c1c('0x40')])][_0x1c1c('0xb2')]===_0x1c1c('0xdf')||this[_0x1c1c('0x23')][util[_0x1c1c('0x78')]('SIP/%s',_0x38ae0e['name'])][_0x1c1c('0xb2')]==='unmonitored');};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xd4')]=function(_0x5c7daf,_0x2d7b49,_0x5b6e52){this[_0x1c1c('0xcf')](_0x5c7daf)['catch'](loggerCatch(_0x2d7b49));this['moveContactManagedDialer'](_0x5c7daf)['catch'](loggerCatch(_0x5b6e52));};Dialer[_0x1c1c('0x1c')][_0x1c1c('0x37')]=function(_0x2c4e55){var _0x17cd15=this[_0x1c1c('0x27')][_0x2c4e55[_0x1c1c('0xe0')]];var _0x4e1ec7;if(!_[_0x1c1c('0xb0')](_0x2c4e55)&&!_[_0x1c1c('0xb0')](_0x2c4e55[_0x1c1c('0xe1')])&&!_[_0x1c1c('0xb0')](_0x2c4e55[_0x1c1c('0xe1')][_0x1c1c('0xe2')])&&_0x2c4e55[_0x1c1c('0xe3')]===_0x1c1c('0xe4')&&_0x17cd15){if(_0x17cd15[_0x1c1c('0x4e')]!=='ivr'&&this[_0x1c1c('0x21')][_0x17cd15[_0x1c1c('0xb4')]][_0x1c1c('0xe5')]&&_0x2c4e55[_0x1c1c('0xe6')]===_0x1c1c('0xe7')){delete this[_0x1c1c('0x27')][_0x2c4e55[_0x1c1c('0xe0')]];this[_0x1c1c('0xb6')](this[_0x1c1c('0x21')][_0x17cd15['queue']]);this[_0x1c1c('0x21')][_0x17cd15['queue']][_0x1c1c('0xe8')]+=0x1;this[_0x1c1c('0x21')][_0x17cd15['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x4e1ec7=new Hangup(_0x17cd15,_0x2c4e55);_0x4e1ec7['state']=0x12;_0x4e1ec7[_0x1c1c('0xa8')]=_0x1c1c('0xe9');_0x4e1ec7[_0x1c1c('0xea')]=_0x1c1c('0xeb');ami[_0x1c1c('0x4d')](_0x1c1c('0xec'),ut[_0x1c1c('0xed')](_0x4e1ec7,_0x1c1c('0xee')));this[_0x1c1c('0xd4')](_0x4e1ec7,'[syncHangupInAMD][createHistory]',_0x1c1c('0xef'));}if(_0x17cd15[_0x1c1c('0x4e')]!==_0x1c1c('0x7b')&&this[_0x1c1c('0x21')][_0x17cd15[_0x1c1c('0xb4')]]['dialAMDActive']&&_0x2c4e55[_0x1c1c('0xe6')]===_0x1c1c('0xf0')){var _0x43b2da=this;return new BPromise(function(_0x2b9f00,_0x1197e7){delete _0x43b2da[_0x1c1c('0x27')][_0x2c4e55[_0x1c1c('0xe0')]];_0x43b2da[_0x1c1c('0xb6')](_0x43b2da[_0x1c1c('0x21')][_0x17cd15['queue']]);_0x43b2da['voiceQueues'][_0x17cd15[_0x1c1c('0xb4')]][_0x1c1c('0xe8')]+=0x1;_0x43b2da[_0x1c1c('0x21')][_0x17cd15[_0x1c1c('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x1b31c0=_0x43b2da[_0x1c1c('0x21')][_0x17cd15['queue']];var _0x1627a8=new Hangup(_0x17cd15,_0x2c4e55);_0x1627a8[_0x1c1c('0xa7')]=0x13;_0x1627a8[_0x1c1c('0xa8')]='Machine';_0x1627a8['membername']=_0x1c1c('0xeb');_0x1627a8[_0x1c1c('0xf1')]+=0x1;_0x1627a8['countglobal']+=0x1;_0x1627a8[_0x1c1c('0xee')]=!![];ami[_0x1c1c('0x4d')](_0x1c1c('0xec'),ut[_0x1c1c('0xed')](_0x1627a8,_0x1c1c('0xee')));_0x43b2da[_0x1c1c('0xcf')](_0x1627a8)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xf2')));if(_0x1627a8[_0x1c1c('0xf3')]+_0x1627a8[_0x1c1c('0xf4')]+_0x1627a8[_0x1c1c('0xf5')]+_0x1627a8[_0x1c1c('0xf6')]+_0x1627a8['countdropretry']+_0x1627a8[_0x1c1c('0xf7')]+_0x1627a8['countmachineretry']+_0x1627a8[_0x1c1c('0xf8')]>=_0x1b31c0[_0x1c1c('0xf9')]){_0x43b2da['stateGlobal'](_0x1627a8,_0x2b9f00,_0x1197e7,_0x1c1c('0xfa'));}else{if(_0x1627a8['countmachineretry']>=_0x1b31c0[_0x1c1c('0xfb')]){_0x43b2da[_0x1c1c('0xfc')](_0x1627a8,_0x2b9f00,_0x1197e7,_0x1c1c('0xfd'));}else{_0x43b2da[_0x1c1c('0xc2')]({'active':![],'countmachineretry':_0x1627a8[_0x1c1c('0xf1')],'scheduledat':moment()[_0x1c1c('0xfe')](_0x1b31c0[_0x1c1c('0xff')],'minutes')[_0x1c1c('0x78')](_0x1c1c('0x100')),'ContactId':_0x1627a8['ContactId'],'ListId':_0x1627a8[_0x1c1c('0xd7')],'VoiceQueueId':_0x1627a8[_0x1c1c('0x101')]||undefined,'CampaignId':_0x1627a8[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch('[rescheduleContact][Machine]'));_0x2b9f00({'reschedule':0x1});}}});}if(_0x17cd15[_0x1c1c('0x4e')]===_0x1c1c('0x7b')&&this[_0x1c1c('0x22')][_0x17cd15[_0x1c1c('0xb4')]][_0x1c1c('0xe5')]&&_0x2c4e55[_0x1c1c('0xe6')]===_0x1c1c('0xe7')){delete this[_0x1c1c('0x27')][_0x2c4e55['uniqueid']];this['updateOriginated'](this[_0x1c1c('0x22')][_0x17cd15[_0x1c1c('0xb4')]]);_0x4e1ec7=new Hangup(_0x17cd15,_0x2c4e55);_0x4e1ec7[_0x1c1c('0xa7')]=0x12;_0x4e1ec7[_0x1c1c('0xa8')]=_0x1c1c('0xe9');_0x4e1ec7[_0x1c1c('0xea')]=_0x1c1c('0xeb');ami[_0x1c1c('0x4d')](_0x1c1c('0xec'),ut['buildObj'](_0x4e1ec7,_0x1c1c('0xee')));this[_0x1c1c('0xd4')](_0x4e1ec7,_0x1c1c('0x102'),_0x1c1c('0x103'));}if(_0x17cd15[_0x1c1c('0x4e')]==='ivr'&&this['campaigns'][_0x17cd15[_0x1c1c('0xb4')]][_0x1c1c('0xe5')]&&_0x2c4e55[_0x1c1c('0xe6')]==='MACHINE'){var _0x43b2da=this;return new BPromise(function(_0x33b1e8,_0x2ea58e){delete _0x43b2da[_0x1c1c('0x27')][_0x2c4e55[_0x1c1c('0xe0')]];_0x43b2da[_0x1c1c('0xb6')](_0x43b2da['campaigns'][_0x17cd15['queue']]);_0x43b2da[_0x1c1c('0x22')][_0x17cd15[_0x1c1c('0xb4')]]['outboundAnswerCallsDay']+=0x1;_0x43b2da[_0x1c1c('0x22')][_0x17cd15[_0x1c1c('0xb4')]][_0x1c1c('0x104')]+=0x1;var _0x54c834=_0x43b2da[_0x1c1c('0x22')][_0x17cd15[_0x1c1c('0xb4')]];var _0x2941cd=new Hangup(_0x17cd15,_0x2c4e55);_0x2941cd[_0x1c1c('0xa7')]=0x13;_0x2941cd['statedesc']=_0x1c1c('0x105');_0x2941cd['membername']=_0x1c1c('0xeb');_0x2941cd[_0x1c1c('0xf1')]+=0x1;_0x2941cd['countglobal']+=0x1;_0x2941cd['amd']=!![];ami[_0x1c1c('0x4d')](_0x1c1c('0xec'),ut['buildObj'](_0x2941cd,'amd'));_0x43b2da[_0x1c1c('0xcf')](_0x2941cd)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xf2')));if(_0x2941cd[_0x1c1c('0xf3')]+_0x2941cd[_0x1c1c('0xf4')]+_0x2941cd[_0x1c1c('0xf5')]+_0x2941cd['countnosuchnumberretry']+_0x2941cd[_0x1c1c('0x106')]+_0x2941cd[_0x1c1c('0xf7')]+_0x2941cd[_0x1c1c('0xf1')]+_0x2941cd[_0x1c1c('0xf8')]>=_0x54c834[_0x1c1c('0xf9')]){_0x43b2da['stateGlobal'](_0x2941cd,_0x33b1e8,_0x2ea58e,_0x1c1c('0xfa'));}else{if(_0x2941cd['countmachineretry']>=_0x54c834[_0x1c1c('0xfb')]){_0x43b2da['createStateFinal'](_0x2941cd,_0x33b1e8,_0x2ea58e,_0x1c1c('0xfd'));}else{_0x43b2da['rescheduleContact']({'active':![],'countmachineretry':_0x2941cd['countmachineretry'],'scheduledat':moment()[_0x1c1c('0xfe')](_0x54c834[_0x1c1c('0xff')],'minutes')[_0x1c1c('0x78')](_0x1c1c('0x100')),'ContactId':_0x2941cd['ContactId'],'ListId':_0x2941cd['ListId'],'VoiceQueueId':_0x2941cd['VoiceQueueId']||undefined,'CampaignId':_0x2941cd[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x107')));_0x33b1e8({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x1c1c('0x34')]=function(_0x5ccdbe){var _0x16f312=this[_0x1c1c('0x27')][_0x5ccdbe['uniqueid']];var _0x1333eb=this;var _0x114692;if(_0x16f312&&_0x16f312[_0x1c1c('0x4e')]===_0x1c1c('0x7b')){delete this[_0x1c1c('0x27')][_0x5ccdbe[_0x1c1c('0xe0')]];this[_0x1c1c('0xb6')](this[_0x1c1c('0x22')][_0x16f312[_0x1c1c('0xb4')]]);this[_0x1c1c('0x22')][_0x16f312[_0x1c1c('0xb4')]][_0x1c1c('0x108')]+=0x1;_0x114692=new Hangup(_0x16f312,_0x5ccdbe);this[_0x1c1c('0xcf')](_0x114692)['catch'](loggerCatch(_0x1c1c('0x109')));this[_0x1c1c('0xcd')](_0x114692)['catch'](loggerCatch(_0x1c1c('0x10a')));}if(_0x16f312&&_0x16f312[_0x1c1c('0x4e')]!==_0x1c1c('0x7b')&&isNotNull(this[_0x1c1c('0x21')][_0x16f312['queue']][_0x1c1c('0x10b')])){delete this[_0x1c1c('0x27')][_0x5ccdbe[_0x1c1c('0xe0')]];this[_0x1c1c('0xb6')](this[_0x1c1c('0x21')][_0x16f312[_0x1c1c('0xb4')]]);this[_0x1c1c('0x21')][_0x16f312[_0x1c1c('0xb4')]][_0x1c1c('0xe8')]+=0x1;this[_0x1c1c('0x21')][_0x16f312[_0x1c1c('0xb4')]][_0x1c1c('0x104')]+=0x1;_0x114692=new Hangup(_0x16f312,_0x5ccdbe);_0x114692[_0x1c1c('0xa7')]=0x10;_0x114692[_0x1c1c('0xa8')]=_0x1c1c('0x10c');_0x114692[_0x1c1c('0xea')]=_0x1c1c('0x10d');this[_0x1c1c('0xcf')](_0x114692)['catch'](loggerCatch(_0x1c1c('0x109')));this[_0x1c1c('0xcd')](_0x114692)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x10a')));}if(_0x16f312&&_0x16f312[_0x1c1c('0x4e')]!=='ivr'&&!isNotNull(this[_0x1c1c('0x21')][_0x16f312[_0x1c1c('0xb4')]][_0x1c1c('0x10b')])){delete this[_0x1c1c('0x27')][_0x5ccdbe[_0x1c1c('0xe0')]];this[_0x1c1c('0xb6')](this[_0x1c1c('0x21')][_0x16f312[_0x1c1c('0xb4')]]);this[_0x1c1c('0x21')][_0x16f312[_0x1c1c('0xb4')]]['outboundUnknownCallsDay']+=0x1;_0x114692=new Hangup(_0x16f312,_0x5ccdbe);_0x114692[_0x1c1c('0xa7')]=0xc;_0x114692['statedesc']=_0x5ccdbe[_0x1c1c('0x10e')];_0x114692['membername']='Unknow';this[_0x1c1c('0xcf')](_0x114692)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x109')));this[_0x1c1c('0xcd')](_0x114692)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x1c1c('0x1c')][_0x1c1c('0x31')]=function(_0x154e60){var _0xfa26a8=this[_0x1c1c('0x27')][_0x154e60[_0x1c1c('0xe0')]];var _0x4a3003=this;if(this[_0x1c1c('0x21')][_0x154e60[_0x1c1c('0xb4')]]){if(_0xfa26a8&&_0xfa26a8[_0x1c1c('0x4e')]!==_0x1c1c('0x7b')){delete this[_0x1c1c('0x27')][_0x154e60['uniqueid']];this[_0x1c1c('0x21')][_0x154e60['queue']][_0x1c1c('0xe8')]+=0x1;var _0x17deaf=new AgentComplete(_0xfa26a8,_0x154e60);if(_0x154e60['reason']===_0x1c1c('0x10f')){_0x17deaf[_0x1c1c('0x110')]=this[_0x1c1c('0x21')][_0x154e60[_0x1c1c('0xb4')]][_0x1c1c('0x111')]&&this[_0x1c1c('0x21')][_0x154e60[_0x1c1c('0xb4')]][_0x1c1c('0x112')]?moment()[_0x1c1c('0x78')](_0x1c1c('0x100')):undefined;}this['createHistory'](_0x17deaf)[_0x1c1c('0xb9')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x1c1c('0xcd')](_0x17deaf)[_0x1c1c('0xb9')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0x1c1c('0x2d')]=function(_0x247bed){if(this[_0x1c1c('0x21')][_0x247bed['queue']]){if(this[_0x1c1c('0x27')][_0x247bed[_0x1c1c('0xe0')]]&&this[_0x1c1c('0x27')][_0x247bed[_0x1c1c('0xe0')]][_0x1c1c('0x4e')]!=='ivr'){this[_0x1c1c('0xb6')](this[_0x1c1c('0x21')][_0x247bed[_0x1c1c('0xb4')]]);this['uniqueId'][_0x247bed[_0x1c1c('0xe0')]][_0x1c1c('0x113')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0x1c1c('0x114')]=function(_0x745ebc){this['createHistory'](_0x745ebc)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x115')));this[_0x1c1c('0xcd')](_0x745ebc)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x116')));};Dialer[_0x1c1c('0x1c')][_0x1c1c('0x117')]=function(_0x39f323){var _0x12da7e=this[_0x1c1c('0x27')][_0x39f323[_0x1c1c('0xe0')]];var _0x5eb2bd=this;if(this['voiceQueues'][_0x39f323['queue']]){if(_0x12da7e&&_0x12da7e['type']!==_0x1c1c('0x7b')){delete this['uniqueId'][_0x39f323[_0x1c1c('0xe0')]];this[_0x1c1c('0xb6')](this['voiceQueues'][_0x39f323[_0x1c1c('0xb4')]]);_0x12da7e[_0x1c1c('0x118')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x37bd07=new QueueCallerAbandon(_0x12da7e,_0x39f323);if(getSeconds(_0x12da7e[_0x1c1c('0x118')],_0x12da7e[_0x1c1c('0x119')])>=_0x12da7e[_0x1c1c('0x11a')]){this[_0x1c1c('0x21')][_0x39f323[_0x1c1c('0xb4')]][_0x1c1c('0x6b')]+=0x1;this[_0x1c1c('0x21')][_0x39f323[_0x1c1c('0xb4')]][_0x1c1c('0x63')]+=0x1;this['voiceQueues'][_0x39f323[_0x1c1c('0xb4')]][_0x1c1c('0x6c')]+=0x1;_0x37bd07[_0x1c1c('0xa7')]=0xa;_0x37bd07['statedesc']=_0x1c1c('0x11b');_0x37bd07['dropreason']=_0x1c1c('0x11c');_0x37bd07[_0x1c1c('0x110')]=this[_0x1c1c('0x21')][_0x39f323[_0x1c1c('0xb4')]][_0x1c1c('0x111')]?moment()[_0x1c1c('0x78')](_0x1c1c('0x100')):undefined;_0x37bd07[_0x1c1c('0x106')]+=0x1;_0x37bd07['countglobal']+=0x1;if(_0x37bd07[_0x1c1c('0x106')]>=this[_0x1c1c('0x21')][_0x39f323[_0x1c1c('0xb4')]][_0x1c1c('0x11d')]){this[_0x1c1c('0x114')](_0x37bd07);}else{this[_0x1c1c('0xc2')]({'active':![],'countdropretry':_0x37bd07[_0x1c1c('0x106')],'scheduledat':moment()[_0x1c1c('0xfe')](this['voiceQueues'][_0x39f323['queue']]['dialDropRetryFrequency'],_0x1c1c('0x11e'))[_0x1c1c('0x78')](_0x1c1c('0x100')),'ContactId':_0x12da7e[_0x1c1c('0xd6')],'ListId':_0x12da7e['ListId'],'VoiceQueueId':_0x12da7e[_0x1c1c('0x101')]||undefined,'CampaignId':_0x12da7e['CampaignId']||undefined})['catch'](loggerCatch(_0x1c1c('0x11f')));var _0x40ec78=new History(_0x37bd07);_0x40ec78[_0x1c1c('0xa7')]=0xa;_0x40ec78[_0x1c1c('0xa8')]=_0x1c1c('0x11b');_0x40ec78['starttime']=moment()[_0x1c1c('0x78')](_0x1c1c('0x100'));_0x40ec78[_0x1c1c('0xa9')]=_0x40ec78[_0x1c1c('0xaa')];_0x40ec78[_0x1c1c('0x120')]=_0x37bd07[_0x1c1c('0x120')];_0x40ec78['calleridnum']=_0x37bd07['calleridnum'];this[_0x1c1c('0xcf')](_0x40ec78)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x121')));}}else{this[_0x1c1c('0x21')][_0x39f323[_0x1c1c('0xb4')]][_0x1c1c('0x6a')]+=0x1;this[_0x1c1c('0x21')][_0x39f323[_0x1c1c('0xb4')]][_0x1c1c('0x62')]+=0x1;_0x37bd07[_0x1c1c('0xa7')]=0xb;_0x37bd07['statedesc']=_0x1c1c('0x122');_0x37bd07[_0x1c1c('0x123')]='CALLEREXIT';_0x37bd07[_0x1c1c('0xf7')]+=0x1;_0x37bd07['countglobal']+=0x1;if(_0x37bd07['countabandonedretry']>=this[_0x1c1c('0x21')][_0x39f323['queue']]['dialAbandonedMaxRetry']){this[_0x1c1c('0x114')](_0x37bd07);}else{this[_0x1c1c('0xc2')]({'active':![],'countabandonedretry':_0x37bd07[_0x1c1c('0xf7')],'scheduledat':moment()['add'](this[_0x1c1c('0x21')][_0x39f323[_0x1c1c('0xb4')]][_0x1c1c('0x124')],_0x1c1c('0x11e'))[_0x1c1c('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x12da7e[_0x1c1c('0xd6')],'ListId':_0x12da7e[_0x1c1c('0xd7')],'VoiceQueueId':_0x12da7e[_0x1c1c('0x101')]||undefined,'CampaignId':_0x12da7e[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x125')));var _0x40ec78=new History(_0x37bd07);_0x40ec78['state']=0xb;_0x40ec78['statedesc']=_0x1c1c('0x122');_0x40ec78[_0x1c1c('0xaa')]=moment()[_0x1c1c('0x78')](_0x1c1c('0x100'));_0x40ec78[_0x1c1c('0xa9')]=_0x40ec78[_0x1c1c('0xaa')];_0x40ec78['calleridname']=_0x37bd07['calleridname'];_0x40ec78[_0x1c1c('0x126')]=_0x37bd07['calleridnum'];this[_0x1c1c('0xcf')](_0x40ec78)['catch'](loggerCatch(_0x1c1c('0x127')));}}}}};Dialer[_0x1c1c('0x1c')]['syncNewExten']=function(_0x1be4b0){if(this[_0x1c1c('0x25')][_0x1be4b0['uniqueid']]){this[_0x1c1c('0x25')][_0x1be4b0[_0x1c1c('0xe0')]][_0x1c1c('0xb3')]=_0x1be4b0[_0x1c1c('0xb3')];}if(this['uniqueId'][_0x1be4b0[_0x1c1c('0xe0')]]){this[_0x1c1c('0x27')][_0x1be4b0['uniqueid']][_0x1c1c('0xb3')]=_0x1be4b0[_0x1c1c('0xb3')];}};Dialer[_0x1c1c('0x1c')][_0x1c1c('0x39')]=function(_0x2bd121){if(strategy[this[_0x1c1c('0x21')][this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]][_0x1c1c('0xb4')]][_0x1c1c('0x129')]]===_0x1c1c('0x12a')){if(this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]]&&_[_0x1c1c('0xb0')](this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]][_0x1c1c('0x12b')])&&_0x2bd121[_0x1c1c('0xb2')]==='1'&&_0x2bd121['paused']==='0'){if(this[_0x1c1c('0x12c')][_0x2bd121[_0x1c1c('0x12d')]]){if(!this['agents'][_0x2bd121[_0x1c1c('0x12d')]][_0x1c1c('0x12b')]){this[_0x1c1c('0x12c')][_0x2bd121[_0x1c1c('0x12d')]][_0x1c1c('0x12b')]=!![];this[_0x1c1c('0x25')][_0x2bd121['actionid']][_0x1c1c('0x12b')]=!![];this['actions'][_0x2bd121['actionid']][_0x1c1c('0x12d')]=_0x2bd121[_0x1c1c('0x12d')];}}}}else if((strategy[this['voiceQueues'][this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]][_0x1c1c('0xb4')]]['strategy']]||_0x1c1c('0x1b'))===_0x1c1c('0x1b')){if(this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]]){if(this[_0x1c1c('0x12c')][_0x2bd121[_0x1c1c('0x12d')]]){this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]][_0x1c1c('0x12d')]=_0x2bd121[_0x1c1c('0x12d')];if(_[_0x1c1c('0xb0')](this[_0x1c1c('0x2b')][this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]]['queue']])){this['queueBooked'][this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]][_0x1c1c('0xb4')]]=[];}this[_0x1c1c('0x2b')][this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]][_0x1c1c('0xb4')]][_0x1c1c('0x12e')](_[_0x1c1c('0x8f')](_[_0x1c1c('0xd5')](this[_0x1c1c('0x25')][_0x2bd121[_0x1c1c('0x128')]],[_0x1c1c('0x12f'),_0x1c1c('0x12d')]),{'status':_0x2bd121[_0x1c1c('0xb2')],'paused':_0x2bd121[_0x1c1c('0x130')]}));}}}};function unlockQueueStatus(_0x6fc0d4,_0x328598){setTimeout(function(){if(_[_0x1c1c('0x85')](_0x6fc0d4['queueStatusComplete'])){loggerBooked[_0x1c1c('0x98')](_0x1c1c('0x131'),_0x328598);}_0x6fc0d4['queueStatusComplete']=!![];loggerBooked[_0x1c1c('0x7e')](_0x1c1c('0x132'),_0x328598,JSON[_0x1c1c('0x49')](_[_0x1c1c('0xd5')](_0x6fc0d4,[_0x1c1c('0x40'),_0x1c1c('0x133')])));},0x1f3);}Dialer['prototype'][_0x1c1c('0x3a')]=function(_0x45b92a){var _0x55f3ee=this;var _0x1b9521=_0x55f3ee[_0x1c1c('0x21')][_0x55f3ee['actions'][_0x45b92a['actionid']]['queue']];if(strategy[this[_0x1c1c('0x21')][this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]]['queue']][_0x1c1c('0x129')]]===_0x1c1c('0x12a')){if(this['actions'][_0x45b92a[_0x1c1c('0x128')]]&&this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]]['stateinterface']){this[_0x1c1c('0x20')][_0x1c1c('0x134')](this['actions'][_0x45b92a['actionid']][_0x1c1c('0x12f')],this[_0x1c1c('0x25')][_0x45b92a['actionid']]['stateinterface'])[_0x1c1c('0xb9')](function(_0x443464){logger[_0x1c1c('0x98')](_0x1c1c('0x135'),util[_0x1c1c('0x99')](_0x443464,{'showHidden':![],'depth':null}));})[_0x1c1c('0x136')](function(){_0x55f3ee[_0x1c1c('0xb6')](_0x55f3ee[_0x1c1c('0x21')][_0x55f3ee[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0xb4')]]);_0x55f3ee[_0x1c1c('0x12c')][_0x55f3ee[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0x12d')]][_0x1c1c('0x12b')]=![];delete _0x55f3ee[_0x1c1c('0x25')][_0x45b92a['actionid']];unlockQueueStatus(_0x1b9521);});}else{this[_0x1c1c('0xb6')](this[_0x1c1c('0x21')][this[_0x1c1c('0x25')][_0x45b92a['actionid']][_0x1c1c('0xb4')]]);this[_0x1c1c('0xc2')]({'active':![],'ContactId':this[_0x1c1c('0x25')][_0x45b92a['actionid']][_0x1c1c('0xd6')],'ListId':this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0xd7')],'VoiceQueueId':this['actions'][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0x101')]||undefined,'CampaignId':this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x137')));delete this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]];unlockQueueStatus(_0x1b9521);}}else if((strategy[this[_0x1c1c('0x21')][this[_0x1c1c('0x25')][_0x45b92a['actionid']][_0x1c1c('0xb4')]][_0x1c1c('0x129')]]||'rrmemory')==='rrmemory'){var _0x1bb005;if(this['actions'][_0x45b92a[_0x1c1c('0x128')]]&&!_[_0x1c1c('0x95')](this[_0x1c1c('0x2b')][this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0xb4')]])){if(this[_0x1c1c('0x2c')][_0x55f3ee[_0x1c1c('0x25')][_0x45b92a['actionid']][_0x1c1c('0xb4')]]){this[_0x1c1c('0x2c')][_0x55f3ee[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0xb4')]]=this['queueBookedRR'][this[_0x1c1c('0x25')][_0x45b92a['actionid']][_0x1c1c('0xb4')]]?this[_0x1c1c('0x2c')][this[_0x1c1c('0x25')][_0x45b92a['actionid']]['queue']]:this[_0x1c1c('0x2b')][this['actions'][_0x45b92a[_0x1c1c('0x128')]]['queue']]?this[_0x1c1c('0x2b')][this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0xb4')]][_0x1c1c('0x138')]||0x0:0x0;}this[_0x1c1c('0x2b')][this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]]['queue']][_0x1c1c('0x138')]=this[_0x1c1c('0x2c')][this[_0x1c1c('0x25')][_0x45b92a[_0x1c1c('0x128')]][_0x1c1c('0xb4')]];for(var _0x3e2aed=0x0;_0x3e2aed=0x0;})['catch'](myreject(_0x31f806)));}}else{_0x5596b7['push'](ami[_0x1c1c('0xb1')]({'action':'command','command':util['format'](_0x1c1c('0x154'),_0x58392e,!_['isUndefined'](config[_0x1c1c('0x14d')][_0x2e2545])?_0x2e2545:'')})['then'](function(_0x1ce373){return _0x1ce373[_0x1c1c('0x152')][_0x1c1c('0x155')](_0x1c1c('0x153'))>=0x0;})[_0x1c1c('0xb9')](myreject(_0x31f806)));}BPromise['all'](_0x5596b7)[_0x1c1c('0x3d')](function(_0x1607e3){var _0x3b30e9=_[_0x1c1c('0x156')](_0x1607e3);if(_0x3b30e9){return _0x2dfa3d(_0x3b30e9);}else{_0x2e53cd[_0x1c1c('0x3f')]=_0x5c0ecb?'GLOBAL_INTERVAL_IS_OVERTIME':_0x1c1c('0x157');return _0x31f806(msgResponse(_0x1c1c('0x158'),'Failure',_0x1c1c('0x159')+_0x5c0ecb+'\x20'+_0x415892+_0x1c1c('0x15a')+util['inspect'](_0x58392e,{'showHidden':![],'depth':null})+_0x1c1c('0x15b')+_0x2e2545));}})[_0x1c1c('0xb9')](function(_0x417cd9){return _0x31f806(msgResponse(_0x1c1c('0x147'),'Failure',JSON['stringify'](_0x417cd9)));});});};Dialer[_0x1c1c('0x1c')][_0x1c1c('0x15c')]=function(_0x323771){var _0x77cce5=this;return function(){switch(_0x323771['dialMethod']){case _0x1c1c('0x15d'):freeVariablesPredictive(_0x323771);_0x77cce5['handlePower'](_0x323771,0x1);break;case _0x1c1c('0x15e'):freeVariablesPredictive(_0x323771);_0x77cce5[_0x1c1c('0x15f')](_0x323771,_0x323771[_0x1c1c('0x160')]);break;case _0x1c1c('0xb'):_0x77cce5[_0x1c1c('0xb')](_0x323771);break;case _0x1c1c('0xa'):freeVariablesPredictive(_0x323771);_0x77cce5[_0x1c1c('0x15f')](_0x323771,0x1);break;default:freeVariablesPredictive(_0x323771);logger[_0x1c1c('0x98')](_0x1c1c('0x161'),_0x323771[_0x1c1c('0x40')],_0x1c1c('0x162'));}};};Dialer['prototype'][_0x1c1c('0x163')]=function(_0x4609e2){return BPromise[_0x1c1c('0xbc')]()[_0x1c1c('0x3d')](cmHopper[_0x1c1c('0x164')](_0x4609e2['id'],previewRecallmeReminderInterval))['then'](function(_0x2ed4dd){for(var _0xf7e14a=0x0;_0xf7e14a<_0x2ed4dd[_0x1c1c('0x9a')];_0xf7e14a++){var _0x5660de=_0x2ed4dd[_0xf7e14a][_0x1c1c('0x165')][_0x1c1c('0x40')];if(_0x5660de)io['to'](util['format']('user:%s',_0x5660de))[_0x1c1c('0x4d')](_0x1c1c('0x166'),{'hopper':_0x2ed4dd[_0xf7e14a]});}})['catch'](function(_0x14eac0){});};Dialer['prototype'][_0x1c1c('0x167')]=function(_0x8c0acf){var _0x22d1ce=this;return function(){_0x22d1ce[_0x1c1c('0x168')](_0x8c0acf);};};Dialer['prototype'][_0x1c1c('0xd')]=function(_0x40e4d7){var _0x205449=this;if(isNotPreview(_0x40e4d7[_0x1c1c('0x5a')])){if(isVoiceQueueOutbound(_0x40e4d7['type'])&&isActive(_0x40e4d7[_0x1c1c('0x169')])){_0x40e4d7[_0x1c1c('0xa2')]=!![];BPromise['resolve']()[_0x1c1c('0x3d')](checkIsLoggedIn(_0x40e4d7,_0x40e4d7[_0x1c1c('0x50')]))[_0x1c1c('0x3d')](checkIsActive(_0x40e4d7,_0x40e4d7['dialActive']))[_0x1c1c('0x3d')](checkInterval(_0x40e4d7))[_0x1c1c('0x3d')](_0x205449[_0x1c1c('0x142')](_0x40e4d7))[_0x1c1c('0x3d')](_0x205449['checkIfTime'](_0x40e4d7[_0x1c1c('0x16a')],_0x40e4d7[_0x1c1c('0x16b')],_0x40e4d7['name'],_0x40e4d7))[_0x1c1c('0x3d')](_0x205449[_0x1c1c('0x148')](_0x40e4d7[_0x1c1c('0x44')],_0x40e4d7[_0x1c1c('0x16b')],_0x40e4d7[_0x1c1c('0x40')],_0x40e4d7))[_0x1c1c('0x3d')](_0x205449[_0x1c1c('0x15c')](_0x40e4d7))[_0x1c1c('0xb9')](loggerCatchQueueSummary(_0x1c1c('0x16c'),_0x40e4d7));}else{notSendMessagesQueue(_0x40e4d7);}}else{freeVariablesPredictive(_0x40e4d7);if(_0x40e4d7[_0x1c1c('0x16d')]){_0x205449[_0x1c1c('0x163')](_0x40e4d7);}}};Dialer['prototype'][_0x1c1c('0x16e')]=function(){var _0x5714d2=this;var _0x3f09b2;for(var _0x3b40ec in this[_0x1c1c('0x22')]){if(typeof this[_0x1c1c('0x22')][_0x3b40ec]!==_0x1c1c('0xaf')){_0x3f09b2=this[_0x1c1c('0x22')][_0x3b40ec];if(isCampaignIvr(_0x3f09b2[_0x1c1c('0x4e')])&&isActive(_0x3f09b2[_0x1c1c('0x76')])){_0x3f09b2[_0x1c1c('0xa2')]=!![];BPromise['resolve']()[_0x1c1c('0x3d')](checkIsActive(_0x3f09b2,_0x3f09b2[_0x1c1c('0x76')]))[_0x1c1c('0x3d')](checkInterval(_0x3f09b2))[_0x1c1c('0x3d')](_0x5714d2[_0x1c1c('0x142')](_0x3f09b2))[_0x1c1c('0x3d')](_0x5714d2[_0x1c1c('0x146')](_0x3f09b2['dialGlobalInterval'],_0x3f09b2['dialTimezone'],_0x3f09b2[_0x1c1c('0x40')],_0x3f09b2))[_0x1c1c('0x3d')](_0x5714d2['checkIfTimeIntervals'](_0x3f09b2['Interval'],_0x3f09b2[_0x1c1c('0x16b')],_0x3f09b2[_0x1c1c('0x40')],_0x3f09b2))[_0x1c1c('0x3d')](_0x5714d2['launchHandleIvr'](_0x3f09b2))[_0x1c1c('0xb9')](loggerCatchQueueSummary('[syncCampaigns]',_0x3f09b2));}else{notSendMessagesCampaign(_0x3f09b2);}}}};function getCallerIdRandom(_0xb6950b,_0x2f8359){var _0x2b799a;var _0x2116cc;var _0x2f473c;if(_0x2f8359<=0x0){_0x2f8359=0x1;}_0x2b799a=new RegExp('\x5cw{0,'+_0x2f8359+'}$');_0x2116cc=Math[_0x1c1c('0x16f')](0xa,_0x2f8359-0x1);_0x2f473c=Math[_0x1c1c('0x16f')](0xa,_0x2f8359)-0x1;return util[_0x1c1c('0x78')]('%s',_[_0x1c1c('0x170')](_0xb6950b,_0x2b799a,_[_0x1c1c('0x171')](_0x2116cc,_0x2f473c)));}function extractCalleridName(_0x2e9485){var _0x4ca266=_0x2e9485[_0x1c1c('0x172')](/"(.*?)"/);return _0x4ca266?_0x4ca266[0x1]:_0x2e9485;}function extractCalleridNumber(_0x107e9e){var _0x50a0f6=_0x107e9e[_0x1c1c('0x172')](/<(.*?)>/);return _0x50a0f6?_0x50a0f6[0x1]:_0x107e9e;}Dialer['prototype']['actionOriginate']=function(_0x2b8036,_0x2a6f37){var _0x1ae099=this;var _0x259655=uuid['v4']();this['actions'][_0x259655]=new Action(_0x2b8036,_0x2a6f37,_0x259655);return new BPromise(function(_0x238e3d,_0x483149){if(_['isUndefined'](_0x2b8036)&&typeof _0x2b8036!=='object'){return _0x483149(msgResponse(_0x1c1c('0x173'),_0x1c1c('0x149'),'voiceQueue\x20is\x20undefine'));}if(_[_0x1c1c('0x85')](_0x2a6f37[_0x1c1c('0x174')][_0x1c1c('0x175')])||_0x2a6f37[_0x1c1c('0x174')][_0x1c1c('0x175')]===null){return _0x483149(msgResponse(_0x1c1c('0x173'),_0x1c1c('0x149'),_0x1c1c('0x176')));}var _0x13b6dc={'XMD-CALLERID':_0x1ae099['actions'][_0x259655][_0x1c1c('0x177')](),'XMD-AGI':_0x2b8036[_0x1c1c('0x10b')]?util[_0x1c1c('0x78')](_0x1c1c('0x178'),ipAgi,_0x2b8036['dialQueueProject']):_0x1c1c('0x179'),'XMD-AGIAFTER':_0x2b8036['dialQueueProject2']?util[_0x1c1c('0x78')](_0x1c1c('0x178'),ipAgi,_0x2b8036['dialQueueProject2']):_0x1c1c('0x179'),'XMD-QUEUE':_0x2b8036[_0x1c1c('0x4e')]===_0x1c1c('0x17a')?util['format']('\x22%s,%s%s,,,%s\x22',_0x2b8036['name'],_0x2b8036[_0x1c1c('0x17b')]||'',_0x2b8036['dialAgiAfterHangupAgent']?'c':'',_0x2b8036[_0x1c1c('0x11a')]||0x3):'NONE','XMD-CONTACTID':_0x2a6f37[_0x1c1c('0xd6')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1ae099[_0x1c1c('0x25')][_0x259655][_0x1c1c('0x177')](),'XMD-AMD':_0x2b8036[_0x1c1c('0xe5')]?_0x1c1c('0x17c'):_0x1c1c('0x179'),'XMD-DESTINATION':_0x1c1c('0xe4')};if(_0x2b8036['dialAMDActive']){_0x13b6dc[_0x1c1c('0x17d')]=_0x2b8036['dialAMDInitialSilence']||0x9c4;_0x13b6dc[_0x1c1c('0x17e')]=_0x2b8036[_0x1c1c('0x17f')]||0x5dc;_0x13b6dc[_0x1c1c('0x180')]=_0x2b8036[_0x1c1c('0x181')]||0x320;_0x13b6dc[_0x1c1c('0x182')]=_0x2b8036[_0x1c1c('0x183')]||0x1388;_0x13b6dc[_0x1c1c('0x184')]=_0x2b8036[_0x1c1c('0x185')]||0x64;_0x13b6dc[_0x1c1c('0x186')]=_0x2b8036[_0x1c1c('0x187')]||0x32;_0x13b6dc[_0x1c1c('0x188')]=_0x2b8036[_0x1c1c('0x189')]||0x3;_0x13b6dc[_0x1c1c('0x18a')]=_0x2b8036['dialAMDSilenceThreshold']||0x100;_0x13b6dc[_0x1c1c('0x18b')]=_0x2b8036[_0x1c1c('0x18c')]||0x1388;}if(_0x2b8036['type']==='outbound'){_0x13b6dc['XMD-VOICEQUEUEID']=_0x2a6f37[_0x1c1c('0x101')];}else{_0x13b6dc['XMD-CAMPAIGNID']=_0x2a6f37[_0x1c1c('0xd9')];}for(var _0x3aeb8a in _0x2a6f37[_0x1c1c('0x174')]){if(typeof _0x2a6f37[_0x1c1c('0x174')][_0x3aeb8a]!=='undefined'){if(isNotNull(_0x2a6f37[_0x1c1c('0x174')][_0x3aeb8a])&&_0x3aeb8a!=='id'&&_0x3aeb8a!==_0x1c1c('0x18d')&&_0x3aeb8a!==_0x1c1c('0x18e')&&_0x3aeb8a!=='updatedAt'){_0x13b6dc[util[_0x1c1c('0x78')](_0x1c1c('0x18f'),_0x1c1c('0x190'),_['toUpper'](_0x3aeb8a))]=_0x2a6f37[_0x1c1c('0x174')][_0x3aeb8a];}}}var _0x264c7f=_0x1ae099['isTrunkReachable'](_0x2b8036['Trunk'])?getCallerId(_0x2b8036[_0x1c1c('0x75')][_0x1c1c('0x191')],_0x2b8036[_0x1c1c('0x5b')],_0x2b8036[_0x1c1c('0x192')]>0x0?getCallerIdRandom(_0x2b8036['dialOriginateCallerIdNumber'],_0x2b8036[_0x1c1c('0x192')]):_0x2b8036['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x2b8036['TrunkBackup'])?_0x2b8036[_0x1c1c('0x75')]['callerid']:_0x2b8036['TrunkBackup'][_0x1c1c('0x191')],_0x2b8036[_0x1c1c('0x5b')],_0x2b8036[_0x1c1c('0x192')]>0x0?getCallerIdRandom(_0x2b8036[_0x1c1c('0x5c')],_0x2b8036[_0x1c1c('0x192')]):_0x2b8036['dialOriginateCallerIdNumber']);if(_0x264c7f){_0x13b6dc[_0x1c1c('0x193')]=_0x1ae099[_0x1c1c('0x25')][_0x259655][_0x1c1c('0x194')]=extractCalleridName(_0x264c7f);_0x13b6dc['XMD-ORIGINATECALLERIDNUM']=_0x1ae099[_0x1c1c('0x25')][_0x259655][_0x1c1c('0x195')]=extractCalleridNumber(_0x264c7f);}return ami[_0x1c1c('0xb1')]({'actionid':_0x259655,'action':_0x1c1c('0x173'),'channel':_0x1ae099['isTrunkReachable'](_0x2b8036[_0x1c1c('0x75')])?util['format'](_0x1c1c('0x196'),_0x2b8036['Trunk'][_0x1c1c('0x40')],isNotNull(_0x2b8036[_0x1c1c('0x5e')])?_0x2b8036[_0x1c1c('0x5e')]['trim']()||'':'',_0x2b8036[_0x1c1c('0x197')]>0x0?_0x2a6f37[_0x1c1c('0x174')][_0x1c1c('0x175')]['substring'](_0x2b8036[_0x1c1c('0x197')]):_0x2a6f37['Contact'][_0x1c1c('0x175')]):util[_0x1c1c('0x78')](_0x1c1c('0x196'),_[_0x1c1c('0xb0')](_0x2b8036[_0x1c1c('0x143')])?_0x2b8036['Trunk'][_0x1c1c('0x40')]:_0x2b8036[_0x1c1c('0x143')][_0x1c1c('0x40')],isNotNull(_0x2b8036[_0x1c1c('0x5e')])?_0x2b8036[_0x1c1c('0x5e')][_0x1c1c('0x198')]()||'':'',_0x2b8036['dialCutDigit']>0x0?_0x2a6f37[_0x1c1c('0x174')][_0x1c1c('0x175')][_0x1c1c('0x199')](_0x2b8036[_0x1c1c('0x197')]):_0x2a6f37['Contact'][_0x1c1c('0x175')]),'callerid':_0x264c7f,'Exten':_0x1c1c('0xe4'),'Context':_0x1c1c('0x19a'),'Priority':'1','variable':_0x13b6dc,'timeout':(_0x2b8036[_0x1c1c('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x259655})[_0x1c1c('0x3d')](function(_0x130428){return _0x238e3d(_0x130428);})[_0x1c1c('0xb9')](function(_0x49edd6){_0x2b8036[_0x1c1c('0x19b')]+=0x1;var _0x281101=new History(_0x1ae099[_0x1c1c('0x25')][_0x259655]);logger[_0x1c1c('0x98')](util[_0x1c1c('0x78')](_0x1c1c('0x19c'),JSON[_0x1c1c('0x49')](_0x49edd6)));_0x281101[_0x1c1c('0xa7')]=0xe;_0x281101[_0x1c1c('0xa8')]=_0x1c1c('0x19d');_0x281101[_0x1c1c('0xaa')]=moment()[_0x1c1c('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x281101['endtime']=_0x281101[_0x1c1c('0xaa')];_0x1ae099[_0x1c1c('0xcf')](_0x281101)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x19e')));_0x1ae099[_0x1c1c('0xcd')](_0x281101)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x19e')))['finally'](function(){delete _0x1ae099[_0x1c1c('0x25')][_0x259655];return _0x483149(msgResponse(_0x1c1c('0x173'),_0x1c1c('0x48'),_0x1c1c('0x19f')));});});});};Dialer['prototype'][_0x1c1c('0x1a0')]=function(_0x10199e){var _0x24d02b=this['actions'][_0x10199e['actionid']];if(_0x24d02b){delete this['actions'][_0x10199e[_0x1c1c('0x128')]];_0x24d02b[_0x1c1c('0x119')]=moment()[_0x1c1c('0x78')](_0x1c1c('0x100'));var _0x15a673=_0x24d02b[_0x1c1c('0x4e')]==='ivr'?this[_0x1c1c('0x22')][_0x24d02b[_0x1c1c('0xb4')]]:this[_0x1c1c('0x21')][_0x24d02b[_0x1c1c('0x1a1')]()];if(!this[_0x1c1c('0x1a2')](_0x10199e[_0x1c1c('0x1a3')])){this[_0x1c1c('0xb6')](_0x15a673);return this[_0x1c1c('0x1a4')](_0x24d02b,_0x15a673,_0x10199e)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x1a5')));}this[_0x1c1c('0x27')][_0x10199e[_0x1c1c('0xe0')]]=_0x24d02b;}};Dialer[_0x1c1c('0x1c')]['checkRetriveMax']=function(_0x5afce7,_0x57915c,_0x3f5f02){var _0x3f9393=new History(_0x57915c);if(_0x3f9393['countbusyretry']+_0x3f9393['countcongestionretry']+_0x3f9393[_0x1c1c('0xf5')]+_0x3f9393[_0x1c1c('0xf6')]+_0x3f9393[_0x1c1c('0x106')]+_0x3f9393[_0x1c1c('0xf7')]+_0x3f9393[_0x1c1c('0xf1')]+_0x3f9393[_0x1c1c('0xf8')]>=_0x3f5f02['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x5afce7){case 0x3:if(_0x3f9393[_0x1c1c('0xf5')]>=_0x3f5f02[_0x1c1c('0x1a6')]-0x1){return!![];}this[_0x1c1c('0xc2')]({'active':![],'countnoanswerretry':_0x3f9393[_0x1c1c('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x3f5f02[_0x1c1c('0x1a7')],_0x1c1c('0x11e'))[_0x1c1c('0x78')](_0x1c1c('0x100')),'ContactId':_0x3f9393[_0x1c1c('0xd6')],'ListId':_0x3f9393[_0x1c1c('0xd7')],'VoiceQueueId':_0x3f9393[_0x1c1c('0x101')]||undefined,'CampaignId':_0x3f9393[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x3f9393['countbusyretry']>=_0x3f5f02[_0x1c1c('0x1a8')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x3f9393[_0x1c1c('0xf3')]+=0x1,'scheduledat':moment()[_0x1c1c('0xfe')](_0x3f5f02['dialBusyRetryFrequency'],_0x1c1c('0x11e'))[_0x1c1c('0x78')](_0x1c1c('0x100')),'ContactId':_0x3f9393[_0x1c1c('0xd6')],'ListId':_0x3f9393[_0x1c1c('0xd7')],'VoiceQueueId':_0x3f9393[_0x1c1c('0x101')]||undefined,'CampaignId':_0x3f9393[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x3f9393[_0x1c1c('0xf4')]>=_0x3f5f02['dialCongestionMaxRetry']-0x1){return!![];}this[_0x1c1c('0xc2')]({'active':![],'countcongestionretry':_0x3f9393[_0x1c1c('0xf4')]+=0x1,'scheduledat':moment()[_0x1c1c('0xfe')](_0x3f5f02[_0x1c1c('0x1a9')],_0x1c1c('0x11e'))['format'](_0x1c1c('0x100')),'ContactId':_0x3f9393[_0x1c1c('0xd6')],'ListId':_0x3f9393[_0x1c1c('0xd7')],'VoiceQueueId':_0x3f9393[_0x1c1c('0x101')]||undefined,'CampaignId':_0x3f9393[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x1aa')));break;case 0x0:if(_0x3f9393['countnosuchnumberretry']>=_0x3f5f02['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x1c1c('0xc2')]({'active':![],'countnosuchnumberretry':_0x3f9393[_0x1c1c('0xf6')]+=0x1,'scheduledat':moment()[_0x1c1c('0xfe')](_0x3f5f02[_0x1c1c('0x1ab')],_0x1c1c('0x11e'))[_0x1c1c('0x78')](_0x1c1c('0x100')),'ContactId':_0x3f9393[_0x1c1c('0xd6')],'ListId':_0x3f9393[_0x1c1c('0xd7')],'VoiceQueueId':_0x3f9393[_0x1c1c('0x101')]||undefined,'CampaignId':_0x3f9393['CampaignId']||undefined})['catch'](loggerCatch(_0x1c1c('0x1ac')));}break;case 0xa:if(_0x3f9393['countdropretry']>=_0x3f5f02[_0x1c1c('0x11d')]-0x1){return!![];}this[_0x1c1c('0xc2')]({'active':![],'countdropretry':_0x3f9393[_0x1c1c('0x106')]+=0x1,'scheduledat':moment()['add'](_0x3f5f02['dialDropRetryFrequency'],_0x1c1c('0x11e'))[_0x1c1c('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f9393[_0x1c1c('0xd6')],'ListId':_0x3f9393['ListId'],'VoiceQueueId':_0x3f9393[_0x1c1c('0x101')]||undefined,'CampaignId':_0x3f9393[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x11f')));break;case 0xb:if(_0x3f9393[_0x1c1c('0xf7')]>=_0x3f5f02[_0x1c1c('0x1ad')]-0x1){return!![];}this[_0x1c1c('0xc2')]({'active':![],'countabandonedretry':_0x3f9393['countabandonedretry']+=0x1,'scheduledat':moment()[_0x1c1c('0xfe')](_0x3f5f02['dialAbandonedRetryFrequency'],_0x1c1c('0x11e'))[_0x1c1c('0x78')](_0x1c1c('0x100')),'ContactId':_0x3f9393['ContactId'],'ListId':_0x3f9393[_0x1c1c('0xd7')],'VoiceQueueId':_0x3f9393[_0x1c1c('0x101')]||undefined,'CampaignId':_0x3f9393[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x125')));break;case 0x13:if(_0x3f9393[_0x1c1c('0xf1')]>=_0x3f5f02[_0x1c1c('0xfb')]-0x1){return!![];}this[_0x1c1c('0xc2')]({'active':![],'countmachineretry':_0x3f9393['countmachineretry']+=0x1,'scheduledat':moment()[_0x1c1c('0xfe')](_0x3f5f02[_0x1c1c('0xff')],_0x1c1c('0x11e'))[_0x1c1c('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f9393[_0x1c1c('0xd6')],'ListId':_0x3f9393[_0x1c1c('0xd7')],'VoiceQueueId':_0x3f9393[_0x1c1c('0x101')]||undefined,'CampaignId':_0x3f9393[_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x3f9393[_0x1c1c('0xf8')]>=_0x3f5f02[_0x1c1c('0x1ae')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x3f9393[_0x1c1c('0xf8')]+=0x1,'scheduledat':moment()['add'](_0x3f5f02[_0x1c1c('0x1af')],_0x1c1c('0x11e'))[_0x1c1c('0x78')](_0x1c1c('0x100')),'ContactId':_0x3f9393[_0x1c1c('0xd6')],'ListId':_0x3f9393[_0x1c1c('0xd7')],'VoiceQueueId':_0x3f9393[_0x1c1c('0x101')]||undefined,'CampaignId':_0x3f9393[_0x1c1c('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x4de369,_0x35188b,_0x5d4931){var _0x430d96=this;var _0x15185c=new History(_0x4de369);return new BPromise(function(_0x581928,_0xaf687){if(_[_0x1c1c('0x85')](_0x35188b)&&typeof _0x35188b!=='object'){return _0xaf687(msgResponse(_0x1c1c('0x1b0'),_0x1c1c('0x149'),'entity\x20is\x20undefine'));}if(_[_0x1c1c('0x85')](_0x5d4931)&&typeof _0x5d4931!==_0x1c1c('0x1b1')){return _0xaf687(msgResponse('[callProgressDetecting]',_0x1c1c('0x149'),_0x1c1c('0x1b2')));}switch(_0x5d4931[_0x1c1c('0x1b3')]){case'0':_0x35188b[_0x1c1c('0x1b4')]+=0x1;_0x15185c[_0x1c1c('0xa7')]=0x0;_0x15185c[_0x1c1c('0xa8')]=_0x1c1c('0x1b5');_0x15185c[_0x1c1c('0xf6')]+=0x1;_0x15185c['countglobal']+=0x1;ami[_0x1c1c('0x4d')](_0x1c1c('0x1b6'),ut['buildObj'](_0x4de369,'nosuchnumber'));_0x430d96['createHistory'](_0x15185c)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xf2')));if(_0x430d96[_0x1c1c('0x1b7')](0x0,_0x4de369,_0x35188b)){if(_0x15185c[_0x1c1c('0xf6')]>=_0x35188b[_0x1c1c('0x1b8')]){_0x430d96[_0x1c1c('0xfc')](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1b9'));}else{_0x430d96['stateGlobal'](_0x15185c,_0x581928,_0xaf687,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x35188b[_0x1c1c('0x64')]+=0x1;_0x15185c[_0x1c1c('0xa7')]=0x3;_0x15185c[_0x1c1c('0xa8')]=_0x1c1c('0x1ba');_0x15185c[_0x1c1c('0xf5')]+=0x1;_0x15185c[_0x1c1c('0x1bb')]+=0x1;ami[_0x1c1c('0x4d')](_0x1c1c('0x1bc'),ut[_0x1c1c('0xed')](_0x4de369,_0x1c1c('0x1bd')));_0x430d96[_0x1c1c('0xcf')](_0x15185c)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x1be')));if(_0x430d96[_0x1c1c('0x1b7')](0x3,_0x4de369,_0x35188b)){if(_0x15185c[_0x1c1c('0xf5')]>=_0x35188b[_0x1c1c('0x1a6')]){_0x430d96[_0x1c1c('0xfc')](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1bf'));}else{_0x430d96[_0x1c1c('0x1c0')](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1bf'));}}break;case'5':_0x35188b['outboundBusyCallsDay']+=0x1;_0x15185c['state']=0x5;_0x15185c[_0x1c1c('0xa8')]=_0x1c1c('0x1c1');_0x15185c[_0x1c1c('0xf3')]+=0x1;_0x15185c[_0x1c1c('0x1bb')]+=0x1;ami[_0x1c1c('0x4d')]('custom:agentbusy',ut[_0x1c1c('0xed')](_0x4de369,_0x1c1c('0x1c2')));_0x430d96[_0x1c1c('0xcf')](_0x15185c)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x1c3')));if(_0x430d96[_0x1c1c('0x1b7')](0x5,_0x4de369,_0x35188b)){if(_0x15185c[_0x1c1c('0xf3')]>=_0x35188b[_0x1c1c('0x1a8')]){_0x430d96['createStateFinal'](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1c4'));}else{_0x430d96[_0x1c1c('0x1c0')](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1c4'));}}break;case'8':_0x35188b['outboundCongestionCallsDay']+=0x1;_0x15185c['state']=0x8;_0x15185c[_0x1c1c('0xa8')]=_0x1c1c('0x1c5');_0x15185c[_0x1c1c('0xf4')]+=0x1;_0x15185c[_0x1c1c('0x1bb')]+=0x1;ami[_0x1c1c('0x4d')](_0x1c1c('0x1c6'),ut[_0x1c1c('0xed')](_0x4de369,'congestion'));_0x430d96[_0x1c1c('0xcf')](_0x15185c)['catch'](loggerCatch(_0x1c1c('0x1c7')));if(_0x430d96[_0x1c1c('0x1b7')](0x8,_0x4de369,_0x35188b)){if(_0x15185c[_0x1c1c('0xf4')]>=_0x35188b[_0x1c1c('0x1c8')]){_0x430d96[_0x1c1c('0xfc')](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1c9'));}else{_0x430d96[_0x1c1c('0x1c0')](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1c9'));}}break;case'11':_0x35188b['outboundAbandonedCallsDay']+=0x1;_0x15185c[_0x1c1c('0xa7')]=0xb;_0x15185c[_0x1c1c('0xa8')]='Abandoned';_0x15185c[_0x1c1c('0xf7')]+=0x1;_0x15185c[_0x1c1c('0x1bb')]+=0x1;_0x430d96[_0x1c1c('0xcf')](_0x15185c)[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x127')));if(_0x430d96['checkRetriveMax'](0xb,_0x4de369,_0x35188b)){if(_0x15185c[_0x1c1c('0xf7')]>=_0x35188b[_0x1c1c('0x1ad')]){_0x430d96[_0x1c1c('0xfc')](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1ca'));}else{_0x430d96[_0x1c1c('0x1c0')](_0x15185c,_0x581928,_0xaf687,'reason\x2011\x20abandoned');}}break;case'20':_0x35188b[_0x1c1c('0x65')]+=0x1;_0x15185c[_0x1c1c('0xa7')]=0x14;_0x15185c[_0x1c1c('0xa8')]='AgentReject';_0x15185c[_0x1c1c('0xf8')]+=0x1;_0x15185c[_0x1c1c('0x1bb')]+=0x1;ami[_0x1c1c('0x4d')](_0x1c1c('0x1cb'),ut[_0x1c1c('0xed')](_0x4de369,_0x1c1c('0x1cc')));_0x430d96[_0x1c1c('0xcf')](_0x15185c)['catch'](loggerCatch(_0x1c1c('0x1cd')));if(_0x430d96[_0x1c1c('0x1b7')](0x14,_0x4de369,_0x35188b)){if(_0x15185c['countagentrejectretry']>=_0x35188b['dialAgentRejectMaxRetry']){_0x430d96['createStateFinal'](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1ce'));}else{_0x430d96['stateGlobal'](_0x15185c,_0x581928,_0xaf687,_0x1c1c('0x1ce'));}}break;default:_0x35188b[_0x1c1c('0x66')]+=0x1;_0x15185c[_0x1c1c('0xa7')]=0xc;_0x15185c[_0x1c1c('0xa8')]=_0x5d4931[_0x1c1c('0x1b3')];_0x430d96[_0x1c1c('0xcf')](_0x15185c)[_0x1c1c('0xb9')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x430d96['checkRetriveMax'](_0x5d4931['reason'],_0x4de369,_0x35188b)){if(_0x15185c[_0x1c1c('0xf3')]+_0x15185c[_0x1c1c('0xf4')]+_0x15185c['countnoanswerretry']+_0x15185c['countnosuchnumberretry']+_0x15185c[_0x1c1c('0x106')]+_0x15185c[_0x1c1c('0xf7')]+_0x15185c[_0x1c1c('0xf1')]+_0x15185c['countagentrejectretry']>=_0x35188b['dialGlobalMaxRetry']){_0x430d96[_0x1c1c('0x1c0')](_0x15185c,_0x581928,_0xaf687,_0x5d4931[_0x1c1c('0x1b3')]);}else{_0x430d96[_0x1c1c('0xfc')](_0x15185c,_0x581928,_0xaf687,_0x5d4931[_0x1c1c('0x1b3')]);}}}});};Dialer[_0x1c1c('0x1c')]['stateGlobal']=function(_0x42cc7b,_0xca82fb,_0x2da6bc,_0x29d74c){var _0xa905eb=new Final(_0x42cc7b);_0xa905eb[_0x1c1c('0xa7')]=0xf;_0xa905eb['statedesc']=_0x1c1c('0x1cf');this[_0x1c1c('0xfc')](_0xa905eb,_0xca82fb,_0x2da6bc,_0x29d74c);};Dialer['prototype'][_0x1c1c('0xfc')]=function(_0x460d1c,_0x335bc2,_0x19ff2a,_0x48427c){this[_0x1c1c('0xcd')](_0x460d1c)[_0x1c1c('0x3d')](function(){return _0x335bc2(msgResponse(_0x1c1c('0x1b0'),_0x1c1c('0xdc'),_0x48427c));})[_0x1c1c('0xb9')](function(){return _0x19ff2a(msgResponse(_0x1c1c('0x1d0'),'Failure',_0x1c1c('0x1d1')));});};Dialer[_0x1c1c('0x1c')][_0x1c1c('0xb')]=function(_0x11e20c){var _0xe86ffe=_0x11e20c[_0x1c1c('0x1d2')]/0x64;var _0x33a8b0=_0x11e20c[_0x1c1c('0x63')]/(_0x11e20c[_0x1c1c('0x63')]+_0x11e20c[_0x1c1c('0xe8')]);var _0xf61718=Math[_0x1c1c('0x1d3')](_0x11e20c[_0x1c1c('0x6f')]*(_0x11e20c[_0x1c1c('0x1d4')]/0x64));var _0x3355a7=Math[_0x1c1c('0x1d3')](_0x11e20c[_0x1c1c('0x6f')]*(_0x11e20c[_0x1c1c('0x1d5')]/0x64));var _0x23d7e7=_0x11e20c[_0x1c1c('0x4f')]+_0x11e20c[_0x1c1c('0x55')];var _0x114231=Math[_0x1c1c('0x1d6')](_0x11e20c['erlangCalls']*_0x11e20c[_0x1c1c('0x74')]*_0x11e20c[_0x1c1c('0x6d')]*_0x11e20c[_0x1c1c('0x6e')]);if(_[_0x1c1c('0x85')](_0x11e20c[_0x1c1c('0x90')])){if(!_[_0x1c1c('0x85')](_0x11e20c[_0x1c1c('0x29')])){_0x11e20c[_0x1c1c('0x29')]=undefined;loggerPredictive['error'](_0x1c1c('0x1d7'),_0x1c1c('0x1d8'));}if(!_['isUndefined'](_0x11e20c[_0x1c1c('0x92')])){loggerPredictive[_0x1c1c('0x98')](_0x1c1c('0x1d7'),_0x1c1c('0x1d9'));clearInterval(_0x11e20c[_0x1c1c('0x92')]);_0x11e20c[_0x1c1c('0x92')]=undefined;}_0x11e20c[_0x1c1c('0x90')]=moment()[_0x1c1c('0x78')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x11e20c[_0x1c1c('0x40')],'collection\x20data\x20in\x20progressive\x20at',_0x11e20c[_0x1c1c('0x90')]);this[_0x1c1c('0x15f')](_0x11e20c,0x1);}else if(ifInterval(_0x11e20c[_0x1c1c('0x1da')],_0x11e20c[_0x1c1c('0x90')])){this['handlePower'](_0x11e20c,0x1);loggerPredictiveCalls['info'](_0x1c1c('0x1db'),_0x11e20c[_0x1c1c('0x90')],_0x11e20c[_0x1c1c('0x40')]);_0x11e20c['erlangCalls']=0x0;_0x11e20c[_0x1c1c('0x6c')]=0x0;}else if(_0xe86ffe<_0x33a8b0&&_0x11e20c[_0x1c1c('0x1dc')]===_0x1c1c('0x1dd')){freeVariablesPredictive(_0x11e20c);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x1de'),_0x1c1c('0x1df'),_0x33a8b0,'startProgressive',_0x11e20c['name']);}else if(_0x114231<_0x11e20c['predictiveIntervalErlangCallsDroppedCalls']&&_0x11e20c[_0x1c1c('0x1dc')]===_0x1c1c('0x1dd')){freeVariablesPredictive(_0x11e20c);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x1e0'),_0x1c1c('0x1e1'),_0x114231,_0x1c1c('0x1e2'),_0x11e20c['predictiveIntervalErlangCallsDroppedCalls'],_0x1c1c('0x90'),_0x11e20c[_0x1c1c('0x40')]);}else if(!ifInterval(_0x11e20c[_0x1c1c('0x1da')],_0x11e20c[_0x1c1c('0x90')])&&_[_0x1c1c('0x85')](_0x11e20c[_0x1c1c('0x29')])&&!_[_0x1c1c('0x85')](_0x11e20c[_0x1c1c('0x90')])){_0x11e20c[_0x1c1c('0x29')]=moment()[_0x1c1c('0x78')](_0x1c1c('0x100'));loggerPredictive[_0x1c1c('0x7e')](_0x11e20c[_0x1c1c('0x40')],_0x1c1c('0x1e3'),_0x11e20c['startPredictive']);this[_0x1c1c('0xc0')](_0x11e20c[_0x1c1c('0x1da')])[_0x1c1c('0x3d')](this[_0x1c1c('0x1e4')](_0x11e20c))[_0x1c1c('0x3d')](mergeDataErlangB(_0x11e20c))[_0x1c1c('0x3d')](this[_0x1c1c('0x1e5')](_0x11e20c))[_0x1c1c('0xb9')](loggerCatchPredictive(_0x1c1c('0x1e6'),_0x11e20c));}else if(!ifInterval(_0x11e20c['dialPredictiveInterval'],_0x11e20c[_0x1c1c('0x29')])){_0x11e20c[_0x1c1c('0x6c')]=0x0;_0x11e20c[_0x1c1c('0x29')]=moment()[_0x1c1c('0x78')](_0x1c1c('0x100'));loggerPredictive[_0x1c1c('0x7e')](_0x11e20c[_0x1c1c('0x40')],_0x1c1c('0x1e7'),_0x11e20c[_0x1c1c('0x29')]);clearInterval(_0x11e20c[_0x1c1c('0x92')]);_0x11e20c[_0x1c1c('0x92')]=undefined;this['averageHandleTime'](_0x11e20c['dialPredictiveInterval'])['then'](this[_0x1c1c('0x1e4')](_0x11e20c))[_0x1c1c('0x3d')](mergeDataErlangB(_0x11e20c))[_0x1c1c('0x3d')](this['startMethodPredictive'](_0x11e20c))[_0x1c1c('0xb9')](loggerCatchPredictive(_0x1c1c('0x1e8'),_0x11e20c));}else if(_0x11e20c[_0x1c1c('0x6f')]&&_0x23d7e7<_0x11e20c[_0x1c1c('0x6f')]-_0x3355a7){freeVariablesPredictive(_0x11e20c);loggerPredictive['info'](_0x11e20c[_0x1c1c('0x40')],_0x1c1c('0x1e9'),_0x23d7e7,_0x1c1c('0x1ea'),_0x11e20c[_0x1c1c('0x6f')],'-',_0x3355a7,'=',_0x11e20c[_0x1c1c('0x6f')]-_0x3355a7,')');}else if(_0x11e20c[_0x1c1c('0x6f')]&&_0x23d7e7>_0x11e20c[_0x1c1c('0x6f')]+_0xf61718){freeVariablesPredictive(_0x11e20c);loggerPredictive['info'](_0x11e20c[_0x1c1c('0x40')],_0x1c1c('0x1e9'),_0x23d7e7,_0x1c1c('0x1eb'),_0x11e20c['predictiveIntervalAvailable'],'+',_0xf61718,'=',_0x11e20c[_0x1c1c('0x6f')]+_0xf61718,')');}};Dialer[_0x1c1c('0x1c')]['getDataPredictive']=function(_0x5388a5){var _0x4bad39=this;return function(_0x1a61fe){return new BPromise(function(_0x160b60,_0x5be204){_[_0x1c1c('0x8f')](_0x5388a5,_0x1a61fe[0x0]);if(checkGetDataPredictive(_0x1a61fe[0x0])){var _0x58346c=_0x5388a5[_0x1c1c('0x6f')]=_0x5388a5[_0x1c1c('0x55')]+_0x5388a5[_0x1c1c('0x4f')];var _0x2e8bf9=_0x5388a5[_0x1c1c('0x1da')]*0x3c;var _0x1536d0=_0x1a61fe[0x0]['predictiveIntervalAvgTalktime']+_0x1a61fe[0x0]['predictiveIntervalAvgHoldtime'];var _0x3ea48f=(_0x1a61fe[0x0][_0x1c1c('0x67')]+_0x1a61fe[0x0][_0x1c1c('0x6b')]+_0x1a61fe[0x0][_0x1c1c('0x6a')])/_0x1a61fe[0x0][_0x1c1c('0x70')];_0x5388a5[_0x1c1c('0x6d')]=_0x3ea48f>0x0?_0x3ea48f:0x1;switch(_0x5388a5[_0x1c1c('0x1dc')]){case _0x1c1c('0x1dd'):var _0x414aa1=_0x5388a5[_0x1c1c('0x1d2')]/0x64;return _0x4bad39[_0x1c1c('0x1ec')](_0x58346c,_0x2e8bf9,_0x1536d0,_0x3ea48f,_0x414aa1)[_0x1c1c('0x3d')](function(_0x620db1){return _0x160b60(_0x620db1);});case _0x1c1c('0x1ed'):var _0x33affb=_0x5388a5[_0x1c1c('0x1d2')]/0x64;return _0x4bad39['busyFactor'](_0x58346c,_0x2e8bf9,_0x1536d0,_0x3ea48f,_0x33affb)[_0x1c1c('0x3d')](function(_0x2a5bed){return _0x160b60(_0x2a5bed);});default:return _0x5be204(msgResponse(_0x1c1c('0x1ee'),'Failure',_0x1c1c('0x1ef')));}}else{return _0x5be204(msgResponse(_0x1c1c('0x1ee'),'Failure',_0x1c1c('0x1f0')));}});};};Dialer[_0x1c1c('0x1c')]['getDataPredictiveOld']=function(_0x4efce7){var _0x296b28=this;return function(_0x2543fb){return new BPromise(function(_0x427914,_0x461587){_[_0x1c1c('0x8f')](_0x4efce7,_0x2543fb[0x0]);if(checkGetDataPredictive(_0x2543fb[0x0])){loggerPredictive[_0x1c1c('0x7e')](JSON['stringify'](_0x2543fb[0x0]));if(_0x4efce7[_0x1c1c('0x1dc')]===_0x1c1c('0x1dd')){return _0x296b28[_0x1c1c('0xcb')](_0x4efce7['id'])[_0x1c1c('0x3d')](function(_0x48aed8){var _0x56d6a1=_0x4efce7['loggedIn']-_0x48aed8[0x0][_0x1c1c('0x1f1')];var _0x25b235=_0x4efce7[_0x1c1c('0x1da')]*0x3c;var _0x624d92=_0x2543fb[0x0][_0x1c1c('0x69')]+_0x2543fb[0x0]['predictiveIntervalAvgHoldtime'];var _0x3365f6=(_0x2543fb[0x0]['predictiveIntervalAnsweredCalls']+_0x2543fb[0x0][_0x1c1c('0x6b')]+_0x2543fb[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2543fb[0x0]['predictiveIntervalTotalCalls'];var _0x2364c1=_0x4efce7[_0x1c1c('0x1d2')]/0x64;_0x4efce7[_0x1c1c('0x1f2')]=_0x48aed8[0x0][_0x1c1c('0x1f1')]||0x0;_0x4efce7['predictiveIntervalHitRate']=_0x3365f6>0x0?_0x3365f6:0x1;return _0x296b28[_0x1c1c('0x1ec')](_0x56d6a1,_0x25b235,_0x624d92,_0x3365f6,_0x2364c1);})[_0x1c1c('0x3d')](function(_0x36db00){return _0x427914(_0x36db00);})['catch'](function(_0x16fd6a){return _0x461587(msgResponse(_0x1c1c('0x1f3'),_0x1c1c('0x149'),JSON[_0x1c1c('0x49')](_0x16fd6a)));});}if(_0x4efce7[_0x1c1c('0x1dc')]===_0x1c1c('0x1ed')){return _0x296b28[_0x1c1c('0xcb')](_0x4efce7['id'])['then'](function(_0x3940e6){var _0x3d4658=_0x4efce7[_0x1c1c('0x50')]-_0x3940e6[0x0][_0x1c1c('0x1f1')];var _0x58fe87=_0x4efce7[_0x1c1c('0x1da')]*0x3c;var _0x42ce6c=_0x2543fb[0x0][_0x1c1c('0x69')]+_0x2543fb[0x0][_0x1c1c('0x68')];var _0x2b0950=(_0x2543fb[0x0][_0x1c1c('0x67')]+_0x2543fb[0x0][_0x1c1c('0x6b')]+_0x2543fb[0x0][_0x1c1c('0x6a')])/_0x2543fb[0x0][_0x1c1c('0x70')];var _0x495cf2=_0x4efce7[_0x1c1c('0x1d2')]/0x64;_0x4efce7[_0x1c1c('0x1f2')]=_0x3940e6[0x0][_0x1c1c('0x1f1')]||0x0;_0x4efce7[_0x1c1c('0x6d')]=_0x2b0950>0x0?_0x2b0950:0x1;return _0x296b28[_0x1c1c('0x1f4')](_0x3d4658,_0x58fe87,_0x42ce6c,_0x2b0950,_0x495cf2);})[_0x1c1c('0x3d')](function(_0x121a82){return _0x427914(_0x121a82);})[_0x1c1c('0xb9')](function(_0xf4e21d){return _0x461587(msgResponse(_0x1c1c('0x1f3'),'Failure',JSON[_0x1c1c('0x49')](_0xf4e21d)));});}}else{return _0x461587(msgResponse(_0x1c1c('0x1ee'),_0x1c1c('0x149'),_0x1c1c('0x1f0')));}});};};Dialer[_0x1c1c('0x1c')][_0x1c1c('0x1e5')]=function(_0x2e85cd){var _0x3eddad=this;return function(){var _0x2b2bbe=0x0;var _0x5c07fb=Math['floor'](_0x2e85cd['erlangCallToSecond']*0x3e8);if(_0x5c07fb>0x0){_0x5c07fb=_0x5c07fb<0x64?0x64:_0x5c07fb;loggerPredictive[_0x1c1c('0x7e')](_0x2e85cd[_0x1c1c('0x40')],'one\x20call\x20every:',_0x5c07fb,_0x1c1c('0x4a'));_0x2e85cd[_0x1c1c('0x92')]=setInterval(function(){_0x3eddad[_0x1c1c('0x92')](_0x2e85cd);loggerPredictiveCalls[_0x1c1c('0x7e')](_0x1c1c('0x1f5'),_0x2b2bbe+=0x1);},_0x5c07fb);}else{loggerPredictive[_0x1c1c('0x7e')](_0x2e85cd[_0x1c1c('0x40')],_0x1c1c('0x1f6'));}};};Dialer[_0x1c1c('0x1c')][_0x1c1c('0x1f7')]=function(_0x133192,_0xfe609b){var _0x2198ef=this;return function(_0x34f9f7){if(_['isEmpty'](_0x34f9f7)){if(_['isNil'](_0xfe609b[_0x1c1c('0xd8')])||!_0xfe609b[_0x1c1c('0x1f8')]){if(_0x133192[_0x1c1c('0x5a')]==='booked'){_0x133192[_0x1c1c('0x133')]=_[_0x1c1c('0x85')](_0x133192[_0x1c1c('0x133')])?!![]:_0x133192[_0x1c1c('0x133')];var _0x5332f7=uuid['v4']();_0x2198ef[_0x1c1c('0x25')][_0x5332f7]=new Action(_0x133192,_0xfe609b,_0x5332f7);loggerBooked[_0x1c1c('0x7e')](_0x1c1c('0x1f9'),_0x5332f7,'queueStatusComplete:\x20',JSON[_0x1c1c('0x49')](_0x133192[_0x1c1c('0x133')]),_0x1c1c('0x1fa'),_0x133192[_0x1c1c('0x40')]);if(_0x133192[_0x1c1c('0x133')]){_0x133192['queueStatusComplete']=![];_0x2198ef[_0x1c1c('0x2b')][_0x2198ef[_0x1c1c('0x25')][_0x5332f7][_0x1c1c('0xb4')]]=[];ami[_0x1c1c('0xb1')]({'actionid':_0x5332f7,'action':'queuestatus','queue':_0x133192[_0x1c1c('0x40')]})[_0x1c1c('0xb9')](function(){_0x2198ef[_0x1c1c('0xb6')](_0x133192);_0x2198ef[_0x1c1c('0xc2')]({'active':![],'ContactId':_0x2198ef['actions'][_0x5332f7]['ContactId'],'ListId':_0x2198ef['actions'][_0x5332f7][_0x1c1c('0xd7')],'VoiceQueueId':_0x2198ef['actions'][_0x5332f7][_0x1c1c('0x101')]||undefined,'CampaignId':_0x2198ef['actions'][_0x5332f7]['CampaignId']||undefined})[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x1fb')));delete _0x2198ef['actions'][_0x5332f7];});}else{loggerBooked[_0x1c1c('0x7e')](_0x1c1c('0x1fc'),JSON['stringify'](_0x133192['queueStatusComplete']),_0x1c1c('0x1fa'),_0x133192[_0x1c1c('0x40')]);_0x2198ef[_0x1c1c('0xb6')](_0x133192);_0x2198ef['rescheduleContact']({'active':![],'ContactId':_0x2198ef[_0x1c1c('0x25')][_0x5332f7][_0x1c1c('0xd6')],'ListId':_0x2198ef[_0x1c1c('0x25')][_0x5332f7]['ListId'],'VoiceQueueId':_0x2198ef[_0x1c1c('0x25')][_0x5332f7][_0x1c1c('0x101')]||undefined,'CampaignId':_0x2198ef[_0x1c1c('0x25')][_0x5332f7][_0x1c1c('0xd9')]||undefined})[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x1fb')));delete _0x2198ef[_0x1c1c('0x25')][_0x5332f7];}}else{return _0x2198ef[_0x1c1c('0x1fd')](_0x133192,_0xfe609b);}}else{if(getDiff(_0xfe609b['scheduledat'])<_0x133192[_0x1c1c('0x1fe')]*0x3c){if(_0xfe609b[_0x1c1c('0x165')]&&!_0xfe609b[_0x1c1c('0x165')][_0x1c1c('0x1ff')]){_0x2198ef[_0x1c1c('0x20')][_0x1c1c('0x134')](_0xfe609b['id'])[_0x1c1c('0x136')](function(){_0x2198ef[_0x1c1c('0xb6')](_0x133192);});}else{_0x2198ef[_0x1c1c('0xc4')]({'active':![]},_0xfe609b['id'],0x1)[_0x1c1c('0x136')](function(){_0x2198ef[_0x1c1c('0xb6')](_0x133192);});}}else{_0x133192[_0x1c1c('0x200')]+=0x1;_0x2198ef[_0x1c1c('0xb6')](_0x133192);if(_0x133192[_0x1c1c('0x201')]){_0x2198ef[_0x1c1c('0xc2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xfe609b[_0x1c1c('0xd6')],'ListId':_0xfe609b[_0x1c1c('0xd7')],'VoiceQueueId':_0xfe609b[_0x1c1c('0x101')]||undefined,'CampaignId':_0xfe609b[_0x1c1c('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x2198ef[_0x1c1c('0xcf')](createObjHistory(_0x133192,_0xfe609b,_0x1c1c('0x202'),0x17,'RecallInQueue'))[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0x203')));}else{_0x2198ef[_0x1c1c('0xd4')](createObjHistory(_0x133192,_0xfe609b,_0x1c1c('0x204'),0x16,_0x1c1c('0x205')),_0x1c1c('0x206'),_0x1c1c('0x207'));}}}}else{_0x133192[_0x1c1c('0x5f')]+=0x1;_0x2198ef[_0x1c1c('0xd4')](createObjHistory(_0x133192,_0xfe609b,'BLACKLIST',0xd,_0x1c1c('0x208')),_0x1c1c('0x209'),_0x1c1c('0x20a'));throw'inBlackList';}};};Dialer[_0x1c1c('0x1c')]['handleIvr']=function(_0x59b230){var _0x151053=this;var _0x3accee=_0x59b230[_0x1c1c('0x20b')]-_0x59b230[_0x1c1c('0x71')]-_0x59b230['temp'];emitCampaignSummary(_0x59b230);if(_0x3accee>0x0){if(_0x3accee>this['maxNumberOriginate']){_0x3accee=this['maxNumberOriginate'];}_0x59b230[_0x1c1c('0xc7')]+=_0x3accee;this[_0x1c1c('0xc9')](_0x59b230['id'],_0x3accee,_0x59b230[_0x1c1c('0x20c')],_0x59b230)['then'](function(_0x46974c){_0x59b230[_0x1c1c('0xc7')]-=_0x3accee;_0x59b230['temp']=_0x59b230[_0x1c1c('0xc7')]>0x0?_0x59b230[_0x1c1c('0xc7')]:0x0;if(!checkContactEmpty(_0x46974c)){_0x59b230[_0x1c1c('0x3f')]=_0x1c1c('0x20d');logger[_0x1c1c('0x7e')]('[getContactCampaign2][Empty]'+_0x59b230['name']);}else{_0x59b230['originated']+=_0x46974c['length'];_0x59b230[_0x1c1c('0x3f')]=_0x1c1c('0x20e');for(var _0x1f91bb=0x0;_0x1f91bb<_0x46974c[_0x1c1c('0x9a')];_0x1f91bb+=0x1){_0x59b230['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x46974c[_0x1f91bb])||_[_0x1c1c('0xb0')](_0x46974c[_0x1f91bb][_0x1c1c('0x174')])||_['isNil'](_0x46974c[_0x1f91bb][_0x1c1c('0x174')][_0x1c1c('0x175')])){_0x151053['emptyContact'](_0x1c1c('0x20f'),_0x59b230,_0x46974c[_0x1f91bb]);}else{_0x151053[_0x1c1c('0xbe')](_[_0x1c1c('0xd5')](_0x46974c[_0x1f91bb],[_0x1c1c('0xd9'),_0x1c1c('0x210')]))[_0x1c1c('0x3d')](_0x151053[_0x1c1c('0x1f7')](_0x59b230,_0x46974c[_0x1f91bb]))['catch'](_0x151053[_0x1c1c('0x211')](_0x1c1c('0x212'),_0x59b230));}}}})[_0x1c1c('0xb9')](loggerGetContactDialer(_0x1c1c('0x213'),_0x59b230,_0x3accee));}};Dialer['prototype'][_0x1c1c('0x15f')]=function(_0x37deba,_0x3f9f75){var _0x1b90df=this;var _0x2dfcf7=[];var _0x10f2b2=_0x3f9f75>=0x1?_0x3f9f75:0x1;if(_0x37deba[_0x1c1c('0x5a')]===_0x1c1c('0xa')){_0x10f2b2=0x1;}var _0xb19da7=Math[_0x1c1c('0x1d6')](_0x37deba[_0x1c1c('0x4f')]*_0x10f2b2)-_0x37deba[_0x1c1c('0x71')]-_0x37deba[_0x1c1c('0xc7')];emitVoiceQueueSummary(_0x37deba);if(_0x37deba['dialLimitQueue']>0x0){var _0x5ed3ee=_0x37deba[_0x1c1c('0x214')]-_0x37deba['originated']-_0x37deba[_0x1c1c('0x55')]-_0x37deba['temp']-_0x37deba['pTalking'];if(_0xb19da7>_0x5ed3ee){_0xb19da7=_0x5ed3ee;}}if(_0xb19da7>0x0){if(_0x37deba['dialMethod']===_0x1c1c('0xa')){_0xb19da7=0x1;}if(_0xb19da7>this[_0x1c1c('0x24')]){_0xb19da7=this['maxNumberOriginate'];}_0x37deba[_0x1c1c('0xc7')]+=_0xb19da7;for(var _0x4d176a in this[_0x1c1c('0x12c')]){if(typeof this[_0x1c1c('0x12c')][_0x4d176a]!==_0x1c1c('0xaf')){if(this[_0x1c1c('0x12c')][_0x4d176a]['state']===_0x1c1c('0x215')&&this['agents'][_0x4d176a]['status']===_0x1c1c('0xdf')){_0x2dfcf7[_0x1c1c('0x12e')](this[_0x1c1c('0x12c')][_0x4d176a]['id']);}}}this['getContactDialer'](_0x37deba['id'],_0x2dfcf7,_0xb19da7,_0x37deba[_0x1c1c('0x20c')],_0x37deba)[_0x1c1c('0x3d')](function(_0x2ebfb1){_0x37deba[_0x1c1c('0xc7')]-=_0xb19da7;_0x37deba['temp']=_0x37deba[_0x1c1c('0xc7')]>0x0?_0x37deba[_0x1c1c('0xc7')]:0x0;if(!checkContactEmpty(_0x2ebfb1)){_0x1b90df[_0x1c1c('0xb8')](_0x37deba)[_0x1c1c('0x3d')](sendMessageReschedule(_0x37deba))['catch'](loggerCatch(_0x1c1c('0xba')));}else{_0x37deba['originated']+=_0x2ebfb1[_0x1c1c('0x9a')];_0x37deba['message']=_0x37deba[_0x1c1c('0x5a')]===_0x1c1c('0xa')?'ACTIVE':_0x1c1c('0x20e');for(var _0x5a622e=0x0;_0x5a622e<_0x2ebfb1['length'];_0x5a622e+=0x1){if(_['isNil'](_0x2ebfb1[_0x5a622e])||_[_0x1c1c('0xb0')](_0x2ebfb1[_0x5a622e]['Contact'])||_['isNil'](_0x2ebfb1[_0x5a622e][_0x1c1c('0x174')]['phone'])){_0x1b90df[_0x1c1c('0x216')](_0x1c1c('0x20f'),_0x37deba,_0x2ebfb1[_0x5a622e]);}else{_0x1b90df[_0x1c1c('0xbb')](_[_0x1c1c('0xd5')](_0x2ebfb1[_0x5a622e],[_0x1c1c('0x101'),'Contact.phone']))[_0x1c1c('0x3d')](_0x1b90df[_0x1c1c('0x1f7')](_0x37deba,_0x2ebfb1[_0x5a622e]))[_0x1c1c('0xb9')](_0x1b90df[_0x1c1c('0x211')](_0x1c1c('0x20f'),_0x37deba));}}}})['catch'](loggerGetContactDialer(_0x1c1c('0x217'),_0x37deba,_0xb19da7));}};Dialer[_0x1c1c('0x1c')]['handlePredictive']=function(_0x2345af){if(_0x2345af[_0x1c1c('0x214')]>0x0){var _0x574103=_0x2345af['dialLimitQueue']-_0x2345af['originated']-_0x2345af['talking'];if(_0x574103>0x0){this[_0x1c1c('0x218')](_0x2345af);}else{loggerPredictiveCalls['info'](_0x1c1c('0x219'));}}else{this[_0x1c1c('0x218')](_0x2345af);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x17e988){var _0x149f24=this;var _0x26ce18=[];_0x17e988[_0x1c1c('0x71')]+=0x1;for(var _0x2c0875 in this[_0x1c1c('0x12c')]){if(typeof this[_0x1c1c('0x12c')][_0x2c0875]!=='undefined'){if(this[_0x1c1c('0x12c')][_0x2c0875][_0x1c1c('0xa7')]===_0x1c1c('0x215')&&this[_0x1c1c('0x12c')][_0x2c0875]['status']===_0x1c1c('0xdf')){_0x26ce18[_0x1c1c('0x12e')](this[_0x1c1c('0x12c')][_0x2c0875]['id']);}}}this[_0x1c1c('0xc6')](_0x17e988['id'],_0x26ce18,0x1,_0x17e988[_0x1c1c('0x20c')],_0x17e988)[_0x1c1c('0x3d')](function(_0x470630){if(!checkContactEmpty(_0x470630)){checkContactLowerLimitOriginate(_0x17e988,0x1,0x0);_0x149f24[_0x1c1c('0xb8')](_0x17e988)['then'](sendMessageReschedule(_0x17e988))[_0x1c1c('0xb9')](loggerCatch(_0x1c1c('0xba')));}else{_0x17e988[_0x1c1c('0x3f')]=_0x1c1c('0x20e');if(_['isNil'](_0x470630[0x0])||_[_0x1c1c('0xb0')](_0x470630[0x0][_0x1c1c('0x174')])||_['isNil'](_0x470630[0x0][_0x1c1c('0x174')][_0x1c1c('0x175')])){_0x149f24[_0x1c1c('0x216')](_0x1c1c('0x20f'),_0x17e988,_0x470630[0x0]);}else{_0x149f24[_0x1c1c('0xbb')](_[_0x1c1c('0xd5')](_0x470630[0x0],[_0x1c1c('0x101'),_0x1c1c('0x210')]))['then'](_0x149f24['checkContactBlack'](_0x17e988,_0x470630[0x0]))[_0x1c1c('0xb9')](_0x149f24[_0x1c1c('0x211')]('[actionOriginatePredictive]\x20',_0x17e988));}}})[_0x1c1c('0xb9')](loggerGetContactDialer(_0x1c1c('0x21a'),_0x17e988,0x1));emitVoiceQueueSummary(_0x17e988);};Dialer['prototype'][_0x1c1c('0x1ec')]=function(_0x354047,_0x59ffd8,_0x170960,_0x566a35,_0x41670b,_0x31be76){loggerPredictive['info'](_0x1c1c('0x21b'));loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x21c'),_0x354047);loggerPredictive['info'](_0x1c1c('0x21d'),_0x59ffd8);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x21e'),_0x170960);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x21f'),_0x566a35);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',_0x41670b);loggerPredictive['info'](_0x1c1c('0x84'));return new BPromise(function(_0x460e0f,_0x48b033){if(_0x354047<=0x0||isNaN(_0x354047)){return _0x48b033(msgResponse(_0x1c1c('0x220'),'Error','m\x20=\x20'+_0x354047));}if(_0x170960<=0x0||isNaN(_0x170960)){return _0x48b033(msgResponse(_0x1c1c('0x220'),_0x1c1c('0x48'),_0x1c1c('0x221')+_0x170960));}if(_0x566a35<=0x0||isNaN(_0x566a35)){return _0x48b033(msgResponse('[abandonmentRate]',_0x1c1c('0x48'),'p\x20=\x20'+_0x566a35));}if(_0x59ffd8<=0x0||isNaN(_0x59ffd8)){return _0x48b033(msgResponse(_0x1c1c('0x220'),'Error',_0x1c1c('0x222')+_0x59ffd8));}if(_0x41670b<=0x0||isNaN(_0x41670b)){return _0x48b033(msgResponse(_0x1c1c('0x220'),_0x1c1c('0x48'),_0x1c1c('0x223')+_0x41670b));}_0x31be76=_0x31be76||0x0;var _0x10a9a9=0x1/_0x170960;var _0x4da2da=0x0;var _0x36f6bf=0x0;var _0x278711=0x0;var _0x496f78=0x0;for(var _0x11c0e9=0x0;_0x278711<_0x41670b;_0x11c0e9+=0x1){_0x36f6bf=_0x11c0e9/_0x59ffd8;_0x4da2da=(_0x566a35*_0x36f6bf+_0x31be76)/_0x10a9a9;_0x278711=erlangb(_0x4da2da,_0x354047);_0x496f78=_0x4da2da/_0x354047*(0x1-erlangb(_0x4da2da,_0x354047));}return _0x460e0f({'erlangCalls':_0x11c0e9,'erlangCallToSecond':_0x59ffd8/_0x11c0e9,'erlangAbandonmentRate':_0x278711,'erlangBusyFactor':_0x496f78});});};Dialer['prototype'][_0x1c1c('0x1f4')]=function(_0x58338f,_0x369e21,_0x232352,_0x54c528,_0x38336a,_0x39ea1e){loggerPredictive[_0x1c1c('0x7e')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x21c'),_0x58338f);loggerPredictive['info'](_0x1c1c('0x21d'),_0x369e21);loggerPredictive['info'](_0x1c1c('0x21e'),_0x232352);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x21f'),_0x54c528);loggerPredictive[_0x1c1c('0x7e')](_0x1c1c('0x224'),_0x38336a);loggerPredictive[_0x1c1c('0x7e')]('---------------------------');return new BPromise(function(_0x3f562,_0x536c32){if(_0x58338f<=0x0||isNaN(_0x58338f)){return _0x536c32(msgResponse(_0x1c1c('0x225'),_0x1c1c('0x48'),'m\x20=\x20'+_0x58338f));}if(_0x232352<=0x0||isNaN(_0x232352)){return _0x536c32(msgResponse(_0x1c1c('0x225'),_0x1c1c('0x48'),_0x1c1c('0x221')+_0x232352));}if(_0x54c528<=0x0||isNaN(_0x54c528)){return _0x536c32(msgResponse(_0x1c1c('0x225'),_0x1c1c('0x48'),_0x1c1c('0x226')+_0x54c528));}if(_0x369e21<=0x0||isNaN(_0x369e21)){return _0x536c32(msgResponse(_0x1c1c('0x225'),_0x1c1c('0x48'),_0x1c1c('0x222')+_0x369e21));}if(_0x38336a<=0x0||isNaN(_0x38336a)){return _0x536c32(msgResponse(_0x1c1c('0x225'),'Error',_0x1c1c('0x227')+_0x38336a));}_0x39ea1e=_0x39ea1e||0x0;var _0x43c715=0x1/_0x232352;var _0x5ad108=0x0;var _0x35108d=0x0;var _0x2d3904=0x0;var _0x437a47=0x0;for(var _0x4dd55f=0x0;_0x437a47<_0x38336a;_0x4dd55f+=0x1){_0x35108d=_0x4dd55f/_0x369e21;_0x5ad108=(_0x54c528*_0x35108d+_0x39ea1e)/_0x43c715;_0x2d3904=erlangb(_0x5ad108,_0x58338f);_0x437a47=_0x5ad108/_0x58338f*(0x1-erlangb(_0x5ad108,_0x58338f));}return _0x3f562({'erlangCalls':_0x4dd55f,'erlangCallToSecond':_0x369e21/_0x4dd55f,'erlangAbandonmentRate':_0x2d3904,'erlangBusyFactor':_0x437a47});});};module[_0x1c1c('0x228')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 33ae521..5307632 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 _0x42ab=['countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridnum','number','starttime','responsetime','droptime','endtime','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0x42ab,0x10b));var _0xb42a=function(_0xbf52f3,_0x2b2bb2){_0xbf52f3=_0xbf52f3-0x0;var _0x25edcc=_0x42ab[_0xbf52f3];return _0x25edcc;};'use strict';var util=require(_0xb42a('0x0'));var _=require('lodash');var moment=require(_0xb42a('0x1'));function getSeconds(_0x4d27ec,_0x753e06){var _0xe62eb6=moment(_0x4d27ec)[_0xb42a('0x2')](0x0);var _0x1e049d=moment(_0x753e06)[_0xb42a('0x2')](0x0);return _0xe62eb6[_0xb42a('0x3')](_0x1e049d,_0xb42a('0x4'));}function QueueCallerAbandon(_0x31173e,_0x578f86){this[_0xb42a('0x5')]=_0x31173e[_0xb42a('0x5')];this[_0xb42a('0x6')]=_0x31173e[_0xb42a('0x6')];this[_0xb42a('0x7')]=_0x31173e['type']==='outbound'?'queue':_0x31173e['type'];this[_0xb42a('0x8')]=_0x31173e[_0xb42a('0x8')];this[_0xb42a('0x9')]=_0x31173e[_0xb42a('0x9')];this[_0xb42a('0xa')]=_0x31173e['countnoanswerretry'];this[_0xb42a('0xb')]=_0x31173e[_0xb42a('0x8')]+_0x31173e[_0xb42a('0x9')]+_0x31173e[_0xb42a('0xa')]+_0x31173e['countnosuchnumberretry']+_0x31173e[_0xb42a('0xc')]+_0x31173e[_0xb42a('0xd')]+_0x31173e[_0xb42a('0xe')]+_0x31173e[_0xb42a('0xf')];this[_0xb42a('0x10')]=_0x31173e['countnosuchnumberretry'];this[_0xb42a('0xc')]=_0x31173e[_0xb42a('0xc')];this[_0xb42a('0xd')]=_0x31173e[_0xb42a('0xd')];this['countmachineretry']=_0x31173e[_0xb42a('0xe')];this[_0xb42a('0xf')]=_0x31173e[_0xb42a('0xf')];this[_0xb42a('0x11')]=_0x578f86[_0xb42a('0x11')];this['calleridname']=_0x31173e['name'];this[_0xb42a('0x12')]=_0x31173e[_0xb42a('0x13')];this[_0xb42a('0x14')]=_0x31173e['starttime'];this[_0xb42a('0x15')]=_0x31173e[_0xb42a('0x15')];this[_0xb42a('0x16')]=_0x31173e[_0xb42a('0x16')];this[_0xb42a('0x17')]=this[_0xb42a('0x16')];this['ringtime']=getSeconds(_0x31173e['responsetime'],_0x31173e[_0xb42a('0x14')]);this['holdtime']=getSeconds(this[_0xb42a('0x16')],_0x31173e[_0xb42a('0x15')]);this[_0xb42a('0x18')]=0x0;this[_0xb42a('0x19')]=_0x578f86[_0xb42a('0x19')];this['membername']=_0x578f86[_0xb42a('0x1a')];this[_0xb42a('0x1b')]=_0x578f86[_0xb42a('0x1b')];this['callback']=_0x31173e[_0xb42a('0x1c')];this['callbackuniqueid']=_0x31173e[_0xb42a('0x1d')];this[_0xb42a('0x1e')]=_0x31173e[_0xb42a('0x1e')];this[_0xb42a('0x1f')]=_0x31173e[_0xb42a('0x1f')];this[_0xb42a('0x20')]=_0x31173e[_0xb42a('0x20')];this[_0xb42a('0x21')]=_0x31173e[_0xb42a('0x21')];this['UserId']=_0x31173e[_0xb42a('0x22')];this[_0xb42a('0x23')]=_0x31173e[_0xb42a('0x23')];this[_0xb42a('0x24')]=_0x31173e['CampaignId'];this[_0xb42a('0x25')]=_0x31173e[_0xb42a('0x25')]||'';this['originatecalleridname']=_0x31173e[_0xb42a('0x26')]||'';}module[_0xb42a('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x909f=['countabandonedretry','countagentrejectretry','countmachineretry','calleridnum','number','responsetime','endtime','droptime','starttime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x110a83,_0x7532){var _0xfe8725=function(_0x3580fb){while(--_0x3580fb){_0x110a83['push'](_0x110a83['shift']());}};_0xfe8725(++_0x7532);}(_0x909f,0x1eb));var _0xf909=function(_0x3bb028,_0x36d70f){_0x3bb028=_0x3bb028-0x0;var _0x95983=_0x909f[_0x3bb028];return _0x95983;};'use strict';var util=require(_0xf909('0x0'));var _=require('lodash');var moment=require(_0xf909('0x1'));function getSeconds(_0x2e4637,_0x822f33){var _0x4c00c8=moment(_0x2e4637)[_0xf909('0x2')](0x0);var _0x24dfe3=moment(_0x822f33)['milliseconds'](0x0);return _0x4c00c8[_0xf909('0x3')](_0x24dfe3,_0xf909('0x4'));}function QueueCallerAbandon(_0x16a484,_0x346cf6){this['scheduledat']=_0x16a484[_0xf909('0x5')];this['type']=_0x16a484['type'];this[_0xf909('0x6')]=_0x16a484[_0xf909('0x7')]===_0xf909('0x8')?_0xf909('0x9'):_0x16a484[_0xf909('0x7')];this['countbusyretry']=_0x16a484[_0xf909('0xa')];this[_0xf909('0xb')]=_0x16a484[_0xf909('0xb')];this[_0xf909('0xc')]=_0x16a484[_0xf909('0xc')];this[_0xf909('0xd')]=_0x16a484[_0xf909('0xa')]+_0x16a484['countcongestionretry']+_0x16a484[_0xf909('0xc')]+_0x16a484[_0xf909('0xe')]+_0x16a484[_0xf909('0xf')]+_0x16a484[_0xf909('0x10')]+_0x16a484['countmachineretry']+_0x16a484[_0xf909('0x11')];this[_0xf909('0xe')]=_0x16a484['countnosuchnumberretry'];this['countdropretry']=_0x16a484[_0xf909('0xf')];this[_0xf909('0x10')]=_0x16a484[_0xf909('0x10')];this[_0xf909('0x12')]=_0x16a484[_0xf909('0x12')];this[_0xf909('0x11')]=_0x16a484[_0xf909('0x11')];this['uniqueid']=_0x346cf6['uniqueid'];this['calleridname']=_0x16a484['name'];this[_0xf909('0x13')]=_0x16a484[_0xf909('0x14')];this['starttime']=_0x16a484['starttime'];this[_0xf909('0x15')]=_0x16a484[_0xf909('0x15')];this['droptime']=_0x16a484['droptime'];this[_0xf909('0x16')]=this[_0xf909('0x17')];this['ringtime']=getSeconds(_0x16a484[_0xf909('0x15')],_0x16a484[_0xf909('0x18')]);this['holdtime']=getSeconds(this['droptime'],_0x16a484['responsetime']);this['talktime']=0x0;this[_0xf909('0x9')]=_0x346cf6[_0xf909('0x9')];this[_0xf909('0x19')]=_0x346cf6[_0xf909('0x1a')];this[_0xf909('0x1b')]=_0x346cf6['reason'];this[_0xf909('0x1c')]=_0x16a484['callback'];this['callbackuniqueid']=_0x16a484[_0xf909('0x1d')];this[_0xf909('0x1e')]=_0x16a484[_0xf909('0x1e')];this[_0xf909('0x1f')]=_0x16a484[_0xf909('0x1f')];this[_0xf909('0x20')]=_0x16a484['ContactId'];this[_0xf909('0x21')]=_0x16a484[_0xf909('0x21')];this[_0xf909('0x22')]=_0x16a484['UserId'];this['VoiceQueueId']=_0x16a484['VoiceQueueId'];this[_0xf909('0x23')]=_0x16a484[_0xf909('0x23')];this[_0xf909('0x24')]=_0x16a484[_0xf909('0x24')]||'';this[_0xf909('0x25')]=_0x16a484['originatecalleridname']||'';}module[_0xf909('0x26')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index c90b868..1ae7b0e 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(_0x2fa13f,_0x1c1baf){var _0x4dbcab=function(_0x1a6d30){while(--_0x1a6d30){_0x2fa13f['push'](_0x2fa13f['shift']());}};_0x4dbcab(++_0x1c1baf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x491914,_0x509711){var _0x1f4c24=function(_0x35ebe1){while(--_0x35ebe1){_0x491914['push'](_0x491914['shift']());}};_0x1f4c24(++_0x509711);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 29dbf18..98d1f81 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 _0x34b7=['channelstatedesc','value','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','create','parse','.pdf','notify','catch','stringify','\x20receiveFax\x20','merge','response','reason','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','then','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','isValid','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','format','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','Trunk\x20not\x20working','fax','Empty\x20Fax','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','faxAccounts','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x34b7,0x196));var _0x734b=function(_0x6d6f7,_0x4ba1a9){_0x6d6f7=_0x6d6f7-0x0;var _0x2a6afe=_0x34b7[_0x6d6f7];return _0x2a6afe;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x734b('0x0'));var uuid=require(_0x734b('0x1'));var moment=require(_0x734b('0x2'));var path=require(_0x734b('0x3'));var tiff2pdf=require(_0x734b('0x4'));var gs=require(_0x734b('0x5'));var logger=require('../../../config/logger')('fax');var ami=require(_0x734b('0x6'));var rpcDb=require(_0x734b('0x7'));var Channel=require(_0x734b('0x8'));var ut=require(_0x734b('0x9'));var Action=require(_0x734b('0xa'));var faxAccount=require(_0x734b('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x734b('0xc'));function Fax(_0x2e7932){this['channels']={};this['faxAccounts']=_0x2e7932['faxAccounts'];this[_0x734b('0xd')]=_0x2e7932['trunks'];this[_0x734b('0xe')]={};ami['on'](_0x734b('0xf'),this[_0x734b('0x10')][_0x734b('0x11')](this));ami['on'](_0x734b('0x12'),this[_0x734b('0x13')][_0x734b('0x11')](this));ami['on'](_0x734b('0x14'),this[_0x734b('0x15')][_0x734b('0x11')](this));ami['on'](_0x734b('0x16'),this[_0x734b('0x17')][_0x734b('0x11')](this));ami['on'](_0x734b('0x18'),this['syncFaxStatus'][_0x734b('0x11')](this));ami['on'](_0x734b('0x19'),this[_0x734b('0x1a')][_0x734b('0x11')](this));ami['on'](_0x734b('0x1b'),this[_0x734b('0x1c')][_0x734b('0x11')](this));ami['on'](_0x734b('0x1d'),this[_0x734b('0x1e')][_0x734b('0x11')](this));}Fax[_0x734b('0x1f')]['syncNewchannel']=function(_0x461df5){if(_0x461df5[_0x734b('0x20')]===_0x734b('0x21')){for(var _0x5edbe9 in this['faxAccounts']){if(this['faxAccounts'][_0x734b('0x22')](_0x5edbe9)){if(_0x461df5[_0x734b('0x23')]===this[_0x734b('0x24')][_0x5edbe9][_0x734b('0x25')]){this[_0x734b('0x26')][_0x461df5[_0x734b('0x27')]]={};this[_0x734b('0x26')][_0x461df5[_0x734b('0x27')]][_0x734b('0x28')]=_0x461df5[_0x734b('0x28')];this[_0x734b('0x26')][_0x461df5[_0x734b('0x27')]]['id']=this[_0x734b('0x24')][_0x5edbe9]['id'];this[_0x734b('0x26')][_0x461df5['uniqueid']][_0x734b('0x29')]=this[_0x734b('0x24')][_0x5edbe9]['name'];logger[_0x734b('0x2a')](_0x461df5[_0x734b('0x27')],_0x734b('0x2b'));}}}}if(this[_0x734b('0xe')][_0x461df5[_0x734b('0x27')]]){this[_0x734b('0x26')][_0x461df5[_0x734b('0x27')]]={};this[_0x734b('0x26')][_0x461df5[_0x734b('0x27')]][_0x734b('0x28')]=_0x461df5[_0x734b('0x28')];logger[_0x734b('0x2a')](_0x461df5[_0x734b('0x27')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0x734b('0x13')]=function(_0x3680a0){if(this['channels'][_0x3680a0[_0x734b('0x27')]]){for(var _0x2dd51a in _0x3680a0[_0x734b('0x2c')]){if(_0x3680a0[_0x734b('0x2c')][_0x734b('0x22')](_0x2dd51a)){this[_0x734b('0x26')][_0x3680a0[_0x734b('0x27')]][_0x2dd51a]=_0x3680a0['value'];}}}};Fax[_0x734b('0x1f')][_0x734b('0x15')]=function(_0x42e9ae){if(this[_0x734b('0x26')][_0x42e9ae[_0x734b('0x27')]]){this[_0x734b('0x26')][_0x42e9ae[_0x734b('0x27')]][_0x734b('0x2d')]=_0x42e9ae[_0x734b('0x2d')];this[_0x734b('0x26')][_0x42e9ae['uniqueid']][_0x734b('0x2e')]=_0x42e9ae[_0x734b('0x2e')];}};Fax['prototype'][_0x734b('0x17')]=function(_0x3cfce2){if(this[_0x734b('0x26')][_0x3cfce2[_0x734b('0x27')]]){for(var _0x21cb04 in _0x3cfce2[_0x734b('0x2c')]){if(_0x3cfce2[_0x734b('0x2c')][_0x734b('0x22')](_0x21cb04)){this[_0x734b('0x26')][_0x3cfce2[_0x734b('0x27')]][_0x21cb04]=_0x3cfce2[_0x734b('0x2f')];}}}};Fax[_0x734b('0x1f')][_0x734b('0x30')]=function(_0x34a851){if(this[_0x734b('0x26')][_0x34a851['uniqueid']]){this[_0x734b('0x26')][_0x34a851['uniqueid']][_0x734b('0x31')]=_0x34a851[_0x734b('0x31')];this[_0x734b('0x26')][_0x34a851[_0x734b('0x27')]][_0x734b('0x32')]=_0x34a851[_0x734b('0x32')];this['channels'][_0x34a851['uniqueid']][_0x734b('0x25')]=_0x34a851['localstationid'];this[_0x734b('0x26')][_0x34a851['uniqueid']][_0x734b('0x33')]=_0x34a851['filename'];logger[_0x734b('0x2a')](_0x34a851['uniqueid'],_0x734b('0x34'));}};Fax[_0x734b('0x1f')][_0x734b('0x1a')]=function(_0x34a504){var _0x37876a=this;if(this[_0x734b('0x26')][_0x34a504[_0x734b('0x27')]]){var _0x54e863=this[_0x734b('0x26')][_0x34a504[_0x734b('0x27')]]['id'];this['channels'][_0x34a504[_0x734b('0x27')]][_0x734b('0x35')]=_0x34a504[_0x734b('0x35')];this[_0x734b('0x26')][_0x34a504['uniqueid']][_0x734b('0x36')]=_0x34a504[_0x734b('0x36')];this['channels'][_0x34a504[_0x734b('0x27')]][_0x734b('0x25')]=_0x34a504['localstationid'];this[_0x734b('0x26')][_0x34a504[_0x734b('0x27')]][_0x734b('0x37')]=_0x34a504[_0x734b('0x37')];this['channels'][_0x34a504['uniqueid']][_0x734b('0x38')]=_0x34a504['transferrate'];this['channels'][_0x34a504[_0x734b('0x27')]]['filename']=_0x34a504[_0x734b('0x33')];this['channels'][_0x34a504[_0x734b('0x27')]][_0x734b('0x39')]=_0x34a504[_0x734b('0x39')];if(this['channels'][_0x34a504['uniqueid']][_0x734b('0x36')]>0x0){tiff2pdf(_0x34a504['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x464f56){logger[_0x734b('0x2a')](_0x34a504['uniqueid'],_0x734b('0x3a'),_0x464f56['message']);attachment[_0x734b('0x3b')]({'name':path[_0x734b('0x3c')](_0x34a504[_0x734b('0x33')])['name'],'basename':path[_0x734b('0x3c')](_0x34a504[_0x734b('0x33')])[_0x734b('0x29')]+_0x734b('0x3d'),'type':'application/pdf'})['then'](function(_0x509c64){faxAccount[_0x734b('0x3e')](_0x54e863,{'from':_0x34a504['calleridnum'],'mapKey':'fax','body':path[_0x734b('0x3c')](_0x34a504['filename'])[_0x734b('0x29')]+_0x734b('0x3d'),'AttachmentId':_0x509c64['id']})[_0x734b('0x3f')](function(_0x26d78e){logger['error'](_0x34a504[_0x734b('0x27')],'\x20notify\x20',JSON[_0x734b('0x40')](_0x26d78e));});})[_0x734b('0x3f')](function(_0x452532){logger['error'](_0x34a504[_0x734b('0x27')],'\x20receiveFax\x20',JSON[_0x734b('0x40')](_0x452532));});});}logger[_0x734b('0x2a')](_0x34a504['uniqueid'],_0x734b('0x41'));}};Fax[_0x734b('0x1f')][_0x734b('0x1e')]=function(_0x38125a){if(this[_0x734b('0xe')][_0x38125a['uniqueid']]){_[_0x734b('0x42')](this['channels'][_0x38125a[_0x734b('0x27')]],_['pick'](_0x38125a,[_0x734b('0x43'),_0x734b('0x44')]));}};function updateStatus(_0x1a7e12){if(_0x1a7e12[_0x734b('0x45')]){faxMessage[_0x734b('0x46')](_0x1a7e12['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x284a4e){ut[_0x734b('0x47')]('[Fax][Message][Error][Updated]',_0x284a4e);})[_0x734b('0x3f')](function(_0x32f24e){ut['logger'](_0x734b('0x48'),_0x32f24e);});}else{ut[_0x734b('0x47')](_0x734b('0x49'));}}Fax['prototype'][_0x734b('0x4a')]=function(_0x226f6c,_0x423b22,_0xe605be){var _0x5e2d7c=this;var _0x44cc7d={};if(_0x423b22){_0x44cc7d={'read':_0x423b22};}else{_0x44cc7d={'failMessage':_0xe605be};}if(this[_0x734b('0xe')][_0x226f6c][_0x734b('0x45')]){faxMessage[_0x734b('0x46')](this['actions'][_0x226f6c][_0x734b('0x45')],_0x44cc7d)['then'](function(_0x3d79d9){ut[_0x734b('0x47')](_0x734b('0x4b'),_0x3d79d9);})[_0x734b('0x3f')](function(_0x58d665){ut[_0x734b('0x47')](_0x734b('0x4c'),_0x58d665);})['finally'](function(){delete _0x5e2d7c['channels'][_0x226f6c];delete _0x5e2d7c[_0x734b('0xe')][_0x226f6c];});}else{ut['logger'](_0x734b('0x4d'));delete this[_0x734b('0x26')][_0x226f6c];delete this[_0x734b('0xe')][_0x226f6c];}};Fax['prototype'][_0x734b('0x1c')]=function(_0x588cd8){var _0xfc2d8d=this;if(this[_0x734b('0x26')][_0x588cd8[_0x734b('0x27')]]){if(this[_0x734b('0xe')][_0x588cd8['uniqueid']]){this[_0x734b('0x26')][_0x588cd8['uniqueid']]['id']=this[_0x734b('0xe')][_0x588cd8[_0x734b('0x27')]]['id'];this[_0x734b('0x26')][_0x588cd8['uniqueid']][_0x734b('0x29')]=this['actions'][_0x588cd8[_0x734b('0x27')]][_0x734b('0x29')];}logger[_0x734b('0x2a')](_0x588cd8[_0x734b('0x27')],this['actions'][_0x588cd8[_0x734b('0x27')]]?'\x20hangup\x20sendFile\x20':_0x734b('0x4e'),JSON[_0x734b('0x40')](this[_0x734b('0x26')][_0x588cd8['uniqueid']]));if(this[_0x734b('0xe')][_0x588cd8[_0x734b('0x27')]]){if(this[_0x734b('0x26')][_0x588cd8[_0x734b('0x27')]][_0x734b('0x4f')]>0x0&&this[_0x734b('0x26')][_0x588cd8[_0x734b('0x27')]]['faxstatus']===_0x734b('0x50')){this[_0x734b('0x4a')](_0x588cd8[_0x734b('0x27')],!![]);}else{this['updateStatus'](_0x588cd8['uniqueid'],![],this[_0x734b('0x26')][_0x588cd8[_0x734b('0x27')]][_0x734b('0x51')]?_0x734b('0x52')+this['channels'][_0x588cd8['uniqueid']]['faxstatusstring']:_0x734b('0x53'));}}}};Fax[_0x734b('0x1f')][_0x734b('0x54')]=function(_0x292c68){var _0x1b57c5=this;return new BPromise(function(_0x140232,_0x113931){_0x1b57c5[_0x734b('0x55')](_0x292c68,_0x1b57c5[_0x734b('0x24')][_0x292c68[_0x734b('0x56')]])[_0x734b('0x57')](function(_0x69b605){ut[_0x734b('0x47')](_0x734b('0x58'),_0x69b605);_0x140232(ut[_0x734b('0x59')](_0x734b('0x5a')));})[_0x734b('0x3f')](function(_0x9438ff){ut[_0x734b('0x47')](_0x734b('0x5b'),_0x9438ff);updateStatus(_0x292c68);_0x113931(ut[_0x734b('0x59')]('Fax\x20failed'));});});};Fax[_0x734b('0x1f')][_0x734b('0x5c')]=function(_0x1f7617){var _0x448634=this;return new BPromise(function(_0x118409,_0x54e712){var _0x17ab9a=_0x448634[_0x734b('0x5d')](_0x448634[_0x734b('0x24')][_0x1f7617[_0x734b('0x56')]][_0x734b('0x5e')],_0x1f7617);if(_0x17ab9a[_0x734b('0x5f')]){_0x118409(ut['message']('Trunk\x20Reachable'));}else{_0x54e712(ut['message'](_0x17ab9a['message']));}});};function originate(_0x4d95c7,_0x3ce4bc,_0x30ffea){return new BPromise(function(_0x16c9d2,_0xb23b61){if(_0x30ffea){var _0x496070=util['format'](_0x734b('0x60'),path[_0x734b('0x3c')](_0x4d95c7[_0x734b('0x3')])[_0x734b('0x29')],_0x4d95c7['path']);gs[_0x734b('0x61')](_0x496070)[_0x734b('0x57')](function(){_0x4d95c7[_0x734b('0x3')]=util[_0x734b('0x62')]('%s/%s.tif',path[_0x734b('0x3c')](_0x4d95c7['path'])[_0x734b('0x63')],path[_0x734b('0x3c')](_0x4d95c7[_0x734b('0x3')])[_0x734b('0x29')]);_0x3ce4bc[_0x734b('0x64')]=_0x4d95c7['path'];ut[_0x734b('0x47')](_0x734b('0x65'),'');ami[_0x734b('0x66')](ut[_0x734b('0x67')](_0x4d95c7,_0x3ce4bc))[_0x734b('0x57')](function(_0x599ed1){_0x16c9d2(_0x599ed1);})[_0x734b('0x3f')](function(_0x2dcb30){_0xb23b61(_0x2dcb30);});})[_0x734b('0x3f')](function(_0x37d96d){_0xb23b61(_0x37d96d);});}else{ami['Action'](ut[_0x734b('0x67')](_0x4d95c7,_0x3ce4bc))[_0x734b('0x57')](function(_0x10d5a8){_0x16c9d2(_0x10d5a8);})[_0x734b('0x3f')](function(_0x2182fd){_0xb23b61(_0x2182fd);});}});}Fax['prototype'][_0x734b('0x55')]=function(_0x49f6d0,_0x460868){var _0x2126e2=this;return new BPromise(function(_0x1f5b9d,_0x27fd22){var _0x4624c7=uuid['v4']();var _0x40128b=ut['addVariables'](_0x49f6d0,_0x460868);_0x2126e2['actions'][_0x4624c7]=new Action(_0x4624c7,_0x460868,_0x49f6d0);var _0x55b28e=_0x2126e2[_0x734b('0xe')][_0x4624c7];if(path['parse'](_0x49f6d0[_0x734b('0x3')])[_0x734b('0x68')]==='.pdf'){originate(_0x55b28e,_0x40128b,!![])[_0x734b('0x57')](function(_0x3ec9e1){_0x1f5b9d(_0x3ec9e1);})[_0x734b('0x3f')](function(_0x2a3c8d){_0x27fd22(_0x2a3c8d);});}else{originate(_0x55b28e,_0x40128b,![])[_0x734b('0x57')](function(_0xfcd081){_0x1f5b9d(_0xfcd081);})[_0x734b('0x3f')](function(_0x45f05b){_0x27fd22(_0x45f05b);});}});};Fax[_0x734b('0x1f')][_0x734b('0x69')]=function(_0x5de89a){return!_[_0x734b('0x6a')](_0x5de89a)&&!_[_0x734b('0x6a')](_0x5de89a[_0x734b('0x29')])&&!_['isNil'](_0x5de89a[_0x734b('0x6b')])&&_0x5de89a[_0x734b('0x6b')]&&!_[_0x734b('0x6a')](this[_0x734b('0xd')][util[_0x734b('0x62')](_0x734b('0x6c'),_0x5de89a[_0x734b('0x29')])])&&!_[_0x734b('0x6a')](this['trunks'][util[_0x734b('0x62')](_0x734b('0x6c'),_0x5de89a[_0x734b('0x29')])][_0x734b('0x32')])&&(this[_0x734b('0xd')][util[_0x734b('0x62')](_0x734b('0x6c'),_0x5de89a[_0x734b('0x29')])][_0x734b('0x32')]==='reachable'||this[_0x734b('0xd')][util[_0x734b('0x62')](_0x734b('0x6c'),_0x5de89a['name'])][_0x734b('0x32')]===_0x734b('0x6d'));};Fax[_0x734b('0x1f')][_0x734b('0x5d')]=function(_0x9befc7,_0x3eed4d){if(!this['isTrunkReachable'](_0x9befc7)){ut[_0x734b('0x47')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_['isNil'](_0x9befc7)?'':_0x9befc7['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x734b('0x6e')};}if(_[_0x734b('0x6a')](_0x3eed4d[_0x734b('0x6f')])){ut[_0x734b('0x47')]('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x3eed4d));return{'isValid':![],'message':_0x734b('0x70')};}if(_['isNil'](_0x3eed4d[_0x734b('0x3')])){ut[_0x734b('0x47')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x734b('0x40')](_0x3eed4d));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0xa74f=['[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','bluebird','path','tiff2pdf','./util/gs','../../../config/logger','../ami','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','calleridnum','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','actions','merge','reason','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]'];(function(_0x5c1473,_0x18dfbb){var _0x233cc1=function(_0x5c6a15){while(--_0x5c6a15){_0x5c1473['push'](_0x5c1473['shift']());}};_0x233cc1(++_0x18dfbb);}(_0xa74f,0x9a));var _0xfa74=function(_0xa30766,_0x6f613e){_0xa30766=_0xa30766-0x0;var _0x24e780=_0xa74f[_0xa30766];return _0x24e780;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xfa74('0x0'));var uuid=require('uuid');var moment=require('moment');var path=require(_0xfa74('0x1'));var tiff2pdf=require(_0xfa74('0x2'));var gs=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('fax');var ami=require(_0xfa74('0x5'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0xfa74('0x6'));var Action=require(_0xfa74('0x7'));var faxAccount=require(_0xfa74('0x8'));var attachment=require(_0xfa74('0x9'));var faxMessage=require(_0xfa74('0xa'));function Fax(_0x344e04){this['channels']={};this[_0xfa74('0xb')]=_0x344e04[_0xfa74('0xb')];this[_0xfa74('0xc')]=_0x344e04[_0xfa74('0xc')];this['actions']={};ami['on'](_0xfa74('0xd'),this[_0xfa74('0xe')]['bind'](this));ami['on'](_0xfa74('0xf'),this[_0xfa74('0x10')][_0xfa74('0x11')](this));ami['on'](_0xfa74('0x12'),this['syncNewState'][_0xfa74('0x11')](this));ami['on'](_0xfa74('0x13'),this[_0xfa74('0x14')][_0xfa74('0x11')](this));ami['on']('faxstatus',this[_0xfa74('0x15')][_0xfa74('0x11')](this));ami['on'](_0xfa74('0x16'),this[_0xfa74('0x17')][_0xfa74('0x11')](this));ami['on']('hangup',this[_0xfa74('0x18')][_0xfa74('0x11')](this));ami['on'](_0xfa74('0x19'),this[_0xfa74('0x1a')][_0xfa74('0x11')](this));}Fax[_0xfa74('0x1b')][_0xfa74('0xe')]=function(_0x48c119){if(_0x48c119[_0xfa74('0x1c')]===_0xfa74('0x1d')){for(var _0x51dda1 in this['faxAccounts']){if(this[_0xfa74('0xb')][_0xfa74('0x1e')](_0x51dda1)){if(_0x48c119[_0xfa74('0x1f')]===this['faxAccounts'][_0x51dda1][_0xfa74('0x20')]){this[_0xfa74('0x21')][_0x48c119[_0xfa74('0x22')]]={};this['channels'][_0x48c119[_0xfa74('0x22')]][_0xfa74('0x23')]=_0x48c119[_0xfa74('0x23')];this['channels'][_0x48c119['uniqueid']]['id']=this[_0xfa74('0xb')][_0x51dda1]['id'];this[_0xfa74('0x21')][_0x48c119[_0xfa74('0x22')]][_0xfa74('0x24')]=this[_0xfa74('0xb')][_0x51dda1]['name'];logger['info'](_0x48c119[_0xfa74('0x22')],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x48c119['uniqueid']]){this[_0xfa74('0x21')][_0x48c119[_0xfa74('0x22')]]={};this[_0xfa74('0x21')][_0x48c119['uniqueid']]['channel']=_0x48c119[_0xfa74('0x23')];logger[_0xfa74('0x25')](_0x48c119['uniqueid'],_0xfa74('0x26'));}};Fax['prototype'][_0xfa74('0x10')]=function(_0x153b2a){if(this['channels'][_0x153b2a[_0xfa74('0x22')]]){for(var _0x1130de in _0x153b2a[_0xfa74('0x27')]){if(_0x153b2a[_0xfa74('0x27')]['hasOwnProperty'](_0x1130de)){this[_0xfa74('0x21')][_0x153b2a[_0xfa74('0x22')]][_0x1130de]=_0x153b2a[_0xfa74('0x28')];}}}};Fax['prototype']['syncNewState']=function(_0x1322a4){if(this[_0xfa74('0x21')][_0x1322a4['uniqueid']]){this['channels'][_0x1322a4[_0xfa74('0x22')]]['channelstate']=_0x1322a4[_0xfa74('0x29')];this['channels'][_0x1322a4[_0xfa74('0x22')]][_0xfa74('0x2a')]=_0x1322a4[_0xfa74('0x2a')];}};Fax[_0xfa74('0x1b')]['syncNewExten']=function(_0x25e1fb){if(this[_0xfa74('0x21')][_0x25e1fb[_0xfa74('0x22')]]){for(var _0x16f9dc in _0x25e1fb[_0xfa74('0x27')]){if(_0x25e1fb[_0xfa74('0x27')][_0xfa74('0x1e')](_0x16f9dc)){this['channels'][_0x25e1fb[_0xfa74('0x22')]][_0x16f9dc]=_0x25e1fb['value'];}}}};Fax[_0xfa74('0x1b')][_0xfa74('0x15')]=function(_0xcc5e32){if(this[_0xfa74('0x21')][_0xcc5e32['uniqueid']]){this['channels'][_0xcc5e32[_0xfa74('0x22')]][_0xfa74('0x2b')]=_0xcc5e32[_0xfa74('0x2b')];this[_0xfa74('0x21')][_0xcc5e32['uniqueid']][_0xfa74('0x2c')]=_0xcc5e32[_0xfa74('0x2c')];this['channels'][_0xcc5e32['uniqueid']]['localstationid']=_0xcc5e32['localstationid'];this['channels'][_0xcc5e32[_0xfa74('0x22')]][_0xfa74('0x2d')]=_0xcc5e32[_0xfa74('0x2d')];logger[_0xfa74('0x25')](_0xcc5e32[_0xfa74('0x22')],_0xfa74('0x2e'));}};Fax[_0xfa74('0x1b')][_0xfa74('0x17')]=function(_0x1a2d52){var _0x5368c9=this;if(this[_0xfa74('0x21')][_0x1a2d52[_0xfa74('0x22')]]){var _0x430339=this[_0xfa74('0x21')][_0x1a2d52[_0xfa74('0x22')]]['id'];this[_0xfa74('0x21')][_0x1a2d52['uniqueid']][_0xfa74('0x2f')]=_0x1a2d52[_0xfa74('0x2f')];this[_0xfa74('0x21')][_0x1a2d52[_0xfa74('0x22')]]['pagestransferred']=_0x1a2d52[_0xfa74('0x30')];this[_0xfa74('0x21')][_0x1a2d52[_0xfa74('0x22')]][_0xfa74('0x20')]=_0x1a2d52['localstationid'];this[_0xfa74('0x21')][_0x1a2d52[_0xfa74('0x22')]][_0xfa74('0x31')]=_0x1a2d52['resolution'];this['channels'][_0x1a2d52[_0xfa74('0x22')]][_0xfa74('0x32')]=_0x1a2d52[_0xfa74('0x32')];this[_0xfa74('0x21')][_0x1a2d52['uniqueid']][_0xfa74('0x2d')]=_0x1a2d52[_0xfa74('0x2d')];this['channels'][_0x1a2d52['uniqueid']]['calleridnum']=_0x1a2d52['calleridnum'];if(this[_0xfa74('0x21')][_0x1a2d52[_0xfa74('0x22')]][_0xfa74('0x30')]>0x0){tiff2pdf(_0x1a2d52[_0xfa74('0x2d')],_0xfa74('0x33'),function(_0x193110){logger[_0xfa74('0x25')](_0x1a2d52['uniqueid'],_0xfa74('0x34'),_0x193110[_0xfa74('0x35')]);attachment[_0xfa74('0x36')]({'name':path[_0xfa74('0x37')](_0x1a2d52[_0xfa74('0x2d')])['name'],'basename':path[_0xfa74('0x37')](_0x1a2d52[_0xfa74('0x2d')])[_0xfa74('0x24')]+_0xfa74('0x38'),'type':_0xfa74('0x39')})[_0xfa74('0x3a')](function(_0x96eeb3){faxAccount[_0xfa74('0x3b')](_0x430339,{'from':_0x1a2d52[_0xfa74('0x3c')],'mapKey':_0xfa74('0x3d'),'body':path['parse'](_0x1a2d52[_0xfa74('0x2d')])['name']+_0xfa74('0x38'),'AttachmentId':_0x96eeb3['id']})[_0xfa74('0x3e')](function(_0x2bb3a4){logger[_0xfa74('0x3f')](_0x1a2d52['uniqueid'],_0xfa74('0x40'),JSON[_0xfa74('0x41')](_0x2bb3a4));});})['catch'](function(_0x1cffca){logger[_0xfa74('0x3f')](_0x1a2d52['uniqueid'],_0xfa74('0x42'),JSON[_0xfa74('0x41')](_0x1cffca));});});}logger[_0xfa74('0x25')](_0x1a2d52[_0xfa74('0x22')],_0xfa74('0x42'));}};Fax['prototype']['syncOriginateResponse']=function(_0x36f6ca){if(this[_0xfa74('0x43')][_0x36f6ca['uniqueid']]){_[_0xfa74('0x44')](this[_0xfa74('0x21')][_0x36f6ca[_0xfa74('0x22')]],_['pick'](_0x36f6ca,['response',_0xfa74('0x45')]));}};function updateStatus(_0x3cd48c){if(_0x3cd48c[_0xfa74('0x46')]){faxMessage[_0xfa74('0x47')](_0x3cd48c[_0xfa74('0x46')],{'failMessage':_0xfa74('0x48')})[_0xfa74('0x3a')](function(_0x30992b){ut['logger'](_0xfa74('0x49'),_0x30992b);})[_0xfa74('0x3e')](function(_0x26bb7e){ut[_0xfa74('0x4a')]('[Fax][Message][Error][NoUpdate1]',_0x26bb7e);});}else{ut['logger'](_0xfa74('0x4b'));}}Fax['prototype'][_0xfa74('0x4c')]=function(_0x221dc7,_0x427469,_0x33e31e){var _0x262f75=this;var _0x144c80={};if(_0x427469){_0x144c80={'read':_0x427469};}else{_0x144c80={'failMessage':_0x33e31e};}if(this[_0xfa74('0x43')][_0x221dc7]['AttachmentId']){faxMessage[_0xfa74('0x47')](this['actions'][_0x221dc7][_0xfa74('0x46')],_0x144c80)['then'](function(_0x480c4e){ut[_0xfa74('0x4a')](_0xfa74('0x4d'),_0x480c4e);})['catch'](function(_0x5dcc3c){ut[_0xfa74('0x4a')](_0xfa74('0x4e'),_0x5dcc3c);})[_0xfa74('0x4f')](function(){delete _0x262f75[_0xfa74('0x21')][_0x221dc7];delete _0x262f75[_0xfa74('0x43')][_0x221dc7];});}else{ut[_0xfa74('0x4a')](_0xfa74('0x50'));delete this[_0xfa74('0x21')][_0x221dc7];delete this[_0xfa74('0x43')][_0x221dc7];}};Fax[_0xfa74('0x1b')]['syncHangup']=function(_0x42ca2a){var _0xc89005=this;if(this['channels'][_0x42ca2a['uniqueid']]){if(this[_0xfa74('0x43')][_0x42ca2a[_0xfa74('0x22')]]){this[_0xfa74('0x21')][_0x42ca2a[_0xfa74('0x22')]]['id']=this[_0xfa74('0x43')][_0x42ca2a['uniqueid']]['id'];this[_0xfa74('0x21')][_0x42ca2a['uniqueid']][_0xfa74('0x24')]=this[_0xfa74('0x43')][_0x42ca2a[_0xfa74('0x22')]]['name'];}logger['info'](_0x42ca2a[_0xfa74('0x22')],this[_0xfa74('0x43')][_0x42ca2a[_0xfa74('0x22')]]?_0xfa74('0x51'):'\x20hangup\x20faxRiceive\x20',JSON[_0xfa74('0x41')](this[_0xfa74('0x21')][_0x42ca2a['uniqueid']]));if(this[_0xfa74('0x43')][_0x42ca2a[_0xfa74('0x22')]]){if(this[_0xfa74('0x21')][_0x42ca2a[_0xfa74('0x22')]]['faxpages']>0x0&&this[_0xfa74('0x21')][_0x42ca2a['uniqueid']][_0xfa74('0x52')]===_0xfa74('0x53')){this[_0xfa74('0x4c')](_0x42ca2a[_0xfa74('0x22')],!![]);}else{this[_0xfa74('0x4c')](_0x42ca2a[_0xfa74('0x22')],![],this[_0xfa74('0x21')][_0x42ca2a[_0xfa74('0x22')]][_0xfa74('0x54')]?_0xfa74('0x55')+this[_0xfa74('0x21')][_0x42ca2a[_0xfa74('0x22')]][_0xfa74('0x54')]:_0xfa74('0x56'));}}}};Fax[_0xfa74('0x1b')]['send']=function(_0x2361d2){var _0x3b0dd5=this;return new BPromise(function(_0x5035dd,_0x57a923){_0x3b0dd5[_0xfa74('0x57')](_0x2361d2,_0x3b0dd5['faxAccounts'][_0x2361d2[_0xfa74('0x58')]])[_0xfa74('0x3a')](function(_0x29270f){ut['logger'](_0xfa74('0x59'),_0x29270f);_0x5035dd(ut['message']('Fax\x20received'));})[_0xfa74('0x3e')](function(_0x1fccac){ut[_0xfa74('0x4a')](_0xfa74('0x5a'),_0x1fccac);updateStatus(_0x2361d2);_0x57a923(ut[_0xfa74('0x35')](_0xfa74('0x5b')));});});};Fax[_0xfa74('0x1b')][_0xfa74('0x5c')]=function(_0x3dff70){var _0xa16e7b=this;return new BPromise(function(_0x2588bb,_0x4fde10){var _0x3ed6e4=_0xa16e7b['checkTrunk'](_0xa16e7b[_0xfa74('0xb')][_0x3dff70[_0xfa74('0x58')]][_0xfa74('0x5d')],_0x3dff70);if(_0x3ed6e4['isValid']){_0x2588bb(ut[_0xfa74('0x35')](_0xfa74('0x5e')));}else{_0x4fde10(ut[_0xfa74('0x35')](_0x3ed6e4['message']));}});};function originate(_0x1b8c06,_0x34e772,_0x474462){return new BPromise(function(_0x1105e5,_0x10e5f5){if(_0x474462){var _0x5bd0e5=util[_0xfa74('0x5f')](_0xfa74('0x60'),path[_0xfa74('0x37')](_0x1b8c06[_0xfa74('0x1')])[_0xfa74('0x24')],_0x1b8c06[_0xfa74('0x1')]);gs[_0xfa74('0x61')](_0x5bd0e5)[_0xfa74('0x3a')](function(){_0x1b8c06[_0xfa74('0x1')]=util[_0xfa74('0x5f')](_0xfa74('0x62'),path[_0xfa74('0x37')](_0x1b8c06['path'])[_0xfa74('0x63')],path[_0xfa74('0x37')](_0x1b8c06[_0xfa74('0x1')])[_0xfa74('0x24')]);_0x34e772[_0xfa74('0x64')]=_0x1b8c06[_0xfa74('0x1')];ut[_0xfa74('0x4a')](_0xfa74('0x65'),'');ami['Action'](ut[_0xfa74('0x66')](_0x1b8c06,_0x34e772))[_0xfa74('0x3a')](function(_0x176916){_0x1105e5(_0x176916);})[_0xfa74('0x3e')](function(_0x54cc2e){_0x10e5f5(_0x54cc2e);});})[_0xfa74('0x3e')](function(_0x352332){_0x10e5f5(_0x352332);});}else{ami[_0xfa74('0x67')](ut[_0xfa74('0x66')](_0x1b8c06,_0x34e772))['then'](function(_0x2b22d5){_0x1105e5(_0x2b22d5);})['catch'](function(_0x5cc8bf){_0x10e5f5(_0x5cc8bf);});}});}Fax[_0xfa74('0x1b')]['execOriginate']=function(_0x1cc0fe,_0x2d24c7){var _0x4b2f59=this;return new BPromise(function(_0x5121ff,_0xb605a1){var _0x3651ea=uuid['v4']();var _0xc8a671=ut[_0xfa74('0x68')](_0x1cc0fe,_0x2d24c7);_0x4b2f59['actions'][_0x3651ea]=new Action(_0x3651ea,_0x2d24c7,_0x1cc0fe);var _0x5acb9b=_0x4b2f59['actions'][_0x3651ea];if(path[_0xfa74('0x37')](_0x1cc0fe[_0xfa74('0x1')])[_0xfa74('0x69')]===_0xfa74('0x38')){originate(_0x5acb9b,_0xc8a671,!![])[_0xfa74('0x3a')](function(_0x52e8ac){_0x5121ff(_0x52e8ac);})[_0xfa74('0x3e')](function(_0x21c7c3){_0xb605a1(_0x21c7c3);});}else{originate(_0x5acb9b,_0xc8a671,![])[_0xfa74('0x3a')](function(_0x3d8ad8){_0x5121ff(_0x3d8ad8);})[_0xfa74('0x3e')](function(_0x3bf8e5){_0xb605a1(_0x3bf8e5);});}});};Fax[_0xfa74('0x1b')][_0xfa74('0x6a')]=function(_0x8d123c){return!_['isNil'](_0x8d123c)&&!_['isNil'](_0x8d123c['name'])&&!_[_0xfa74('0x6b')](_0x8d123c[_0xfa74('0x6c')])&&_0x8d123c[_0xfa74('0x6c')]&&!_[_0xfa74('0x6b')](this[_0xfa74('0xc')][util['format'](_0xfa74('0x6d'),_0x8d123c[_0xfa74('0x24')])])&&!_['isNil'](this[_0xfa74('0xc')][util['format'](_0xfa74('0x6d'),_0x8d123c[_0xfa74('0x24')])][_0xfa74('0x2c')])&&(this[_0xfa74('0xc')][util[_0xfa74('0x5f')](_0xfa74('0x6d'),_0x8d123c[_0xfa74('0x24')])][_0xfa74('0x2c')]==='reachable'||this['trunks'][util['format'](_0xfa74('0x6d'),_0x8d123c[_0xfa74('0x24')])]['status']===_0xfa74('0x6e'));};Fax[_0xfa74('0x1b')][_0xfa74('0x6f')]=function(_0x1364ca,_0x4a65dc){if(!this[_0xfa74('0x6a')](_0x1364ca)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0xfa74('0x6b')](_0x1364ca)?'':_0x1364ca[_0xfa74('0x24')]+_0xfa74('0x70'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xfa74('0x6b')](_0x4a65dc[_0xfa74('0x3d')])){ut['logger'](_0xfa74('0x71'),JSON['stringify'](_0x4a65dc));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x4a65dc[_0xfa74('0x1')])){ut[_0xfa74('0x4a')](_0xfa74('0x72'),JSON[_0xfa74('0x41')](_0x4a65dc));return{'isValid':![],'message':_0xfa74('0x73')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index b9feb33..05705e0 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 _0x1756=['catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','resolve','then'];(function(_0x51331d,_0x586bc9){var _0xb7c3b1=function(_0x1e3bf0){while(--_0x1e3bf0){_0x51331d['push'](_0x51331d['shift']());}};_0xb7c3b1(++_0x586bc9);}(_0x1756,0x178));var _0x6175=function(_0x19edb4,_0x40ec5d){_0x19edb4=_0x19edb4-0x0;var _0x2816b7=_0x1756[_0x19edb4];return _0x2816b7;};'use strict';var util=require(_0x6175('0x0'));var BPromise=require(_0x6175('0x1'));var logger=require(_0x6175('0x2'))(_0x6175('0x3'));var _=require(_0x6175('0x4'));var faxAccount=require(_0x6175('0x5'));function loggerCatch(_0x1b243c){return function(_0x54f73a){logger[_0x6175('0x6')](_0x1b243c,util['inspect'](_0x54f73a,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x856732,_0x37c6e4){return BPromise[_0x6175('0x7')]()[_0x6175('0x8')](faxAccount['notify'](_0x856732,_0x37c6e4))[_0x6175('0x9')](loggerCatch(_0x6175('0xa')));}; \ No newline at end of file +var _0xa3f8=['lodash','../rpc/faxAccount','error','inspect','notify','then','util','../../../config/logger','preview'];(function(_0x57d73c,_0x526dcc){var _0x5a207d=function(_0x5cf38d){while(--_0x5cf38d){_0x57d73c['push'](_0x57d73c['shift']());}};_0x5a207d(++_0x526dcc);}(_0xa3f8,0xc3));var _0x8a3f=function(_0x1e5068,_0x31e9c4){_0x1e5068=_0x1e5068-0x0;var _0x2230b6=_0xa3f8[_0x1e5068];return _0x2230b6;};'use strict';var util=require(_0x8a3f('0x0'));var BPromise=require('bluebird');var logger=require(_0x8a3f('0x1'))(_0x8a3f('0x2'));var _=require(_0x8a3f('0x3'));var faxAccount=require(_0x8a3f('0x4'));function loggerCatch(_0x1a0d97){return function(_0x3a444e){logger[_0x8a3f('0x5')](_0x1a0d97,util[_0x8a3f('0x6')](_0x3a444e,{'showHidden':![],'depth':null}));};}exports[_0x8a3f('0x7')]=function(_0x4ac832,_0x45bf3b){return BPromise['resolve']()[_0x8a3f('0x8')](faxAccount[_0x8a3f('0x7')](_0x4ac832,_0x45bf3b))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index d9f04e0..4874cb7 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 _0xb60a=['fax','bluebird','child_process','exec','execute','Exec\x20gs','info','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x3cc115,_0xabbcb7){var _0x4e93eb=function(_0x5e54f4){while(--_0x5e54f4){_0x3cc115['push'](_0x3cc115['shift']());}};_0x4e93eb(++_0xabbcb7);}(_0xb60a,0x106));var _0xab60=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb60a[_0x3ab51d];return _0x29a04e;};'use strict';var util=require(_0xab60('0x0'));var logger=require(_0xab60('0x1'))(_0xab60('0x2'));var BPromise=require(_0xab60('0x3'));var exec=require(_0xab60('0x4'))[_0xab60('0x5')];exports[_0xab60('0x6')]=function(_0x1ef79b){return new BPromise(function(_0xcec198,_0x2488cb){exec(_0x1ef79b,function(_0x257ba6,_0x45d95d,_0x106426){logger['info'](_0xab60('0x7'),_0x45d95d);if(_0x257ba6){logger[_0xab60('0x8')](_0xab60('0x7'),_0xab60('0x9'),util[_0xab60('0xa')](_0x257ba6,{'showHidden':![],'depth':null}),_0x45d95d,_0x106426);_0x2488cb(_0x257ba6);}_0xcec198(_0x45d95d);});});}; \ No newline at end of file +var _0x5246=['child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','bluebird'];(function(_0x3461a5,_0x1eb1cd){var _0xad8a90=function(_0x497906){while(--_0x497906){_0x3461a5['push'](_0x3461a5['shift']());}};_0xad8a90(++_0x1eb1cd);}(_0x5246,0xe3));var _0x6524=function(_0x10d7d6,_0xbef48a){_0x10d7d6=_0x10d7d6-0x0;var _0x63ce53=_0x5246[_0x10d7d6];return _0x63ce53;};'use strict';var util=require(_0x6524('0x0'));var logger=require(_0x6524('0x1'))('fax');var BPromise=require(_0x6524('0x2'));var exec=require(_0x6524('0x3'))[_0x6524('0x4')];exports[_0x6524('0x5')]=function(_0x22cac0){return new BPromise(function(_0x22db98,_0x33386c){exec(_0x22cac0,function(_0x3749d0,_0x3c3bee,_0x526cc5){logger[_0x6524('0x6')](_0x6524('0x7'),_0x3c3bee);if(_0x3749d0){logger[_0x6524('0x6')](_0x6524('0x7'),_0x6524('0x8'),util[_0x6524('0x9')](_0x3749d0,{'showHidden':![],'depth':null}),_0x3c3bee,_0x526cc5);_0x33386c(_0x3749d0);}_0x22db98(_0x3c3bee);});});}; \ 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 0b86008..953a76f 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 _0x6f73=['maxrate','format','modem','faxdetect','localstationid','path','variablesAction','originate','channel','\x22%s\x22\x20<%s>','uniqueid','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo'];(function(_0x3ef5d3,_0x2f8838){var _0x8b3c9d=function(_0x25917d){while(--_0x25917d){_0x3ef5d3['push'](_0x3ef5d3['shift']());}};_0x8b3c9d(++_0x2f8838);}(_0x6f73,0x10f));var _0x36f7=function(_0xa983f5,_0x39c156){_0xa983f5=_0xa983f5-0x0;var _0x30dd98=_0x6f73[_0xa983f5];return _0x30dd98;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');var logger=require(_0x36f7('0x0'))(_0x36f7('0x1'));exports[_0x36f7('0x2')]=function(_0x21d05a){return{'message':_0x21d05a};};exports[_0x36f7('0x3')]=function(_0x27e8a8,_0x3ffe0f){logger[_0x36f7('0x4')](_0x27e8a8,util[_0x36f7('0x5')](_0x3ffe0f,{'showHidden':![],'depth':null}));};exports[_0x36f7('0x6')]=function(_0x21005c,_0x4d1438){var _0x20ff85={'XMF-ECM':_0x4d1438[_0x36f7('0x7')],'XMF-HEADERINFO':_0x4d1438[_0x36f7('0x8')],'XMF-MINRATE':_0x4d1438['minrate'],'XMF-MAXRATE':_0x4d1438[_0x36f7('0x9')],'XMF-MODEM':util[_0x36f7('0xa')]('\x22%s\x22',_0x4d1438[_0x36f7('0xb')]),'XMF-GATEWAY':_0x4d1438['gateway'],'XMF-FAXDETECT':_0x4d1438[_0x36f7('0xc')],'XMF-T38TIMEOUT':_0x4d1438['t38timeout'],'XMF-LOCALSTATIONID':_0x4d1438[_0x36f7('0xd')],'XMF-PATH':_0x21005c[_0x36f7('0xe')]};return _0x20ff85;};exports[_0x36f7('0xf')]=function(_0x1a3f29,_0x10208d){return{'actionid':_0x1a3f29['uniqueid'],'action':_0x36f7('0x10'),'channel':_0x1a3f29[_0x36f7('0x11')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util['format'](_0x36f7('0x12'),_0x1a3f29['headerinfo']?_0x1a3f29['headerinfo']:'',_0x1a3f29[_0x36f7('0xd')]),'variable':_0x10208d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1a3f29[_0x36f7('0x13')]};}; \ No newline at end of file +var _0xa40c=['ecm','headerinfo','maxrate','format','gateway','faxdetect','t38timeout','path','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','localstationid','util','lodash','moment','fax','message','logger','inspect'];(function(_0x3342af,_0xe71ed){var _0x17ff38=function(_0x390d19){while(--_0x390d19){_0x3342af['push'](_0x3342af['shift']());}};_0x17ff38(++_0xe71ed);}(_0xa40c,0x1f1));var _0xca40=function(_0x52cc29,_0x5568a1){_0x52cc29=_0x52cc29-0x0;var _0x3fd87c=_0xa40c[_0x52cc29];return _0x3fd87c;};'use strict';var util=require(_0xca40('0x0'));var _=require(_0xca40('0x1'));var moment=require(_0xca40('0x2'));var logger=require('../../../../config/logger')(_0xca40('0x3'));exports[_0xca40('0x4')]=function(_0x5cb505){return{'message':_0x5cb505};};exports[_0xca40('0x5')]=function(_0x58c946,_0x58b62d){logger['info'](_0x58c946,util[_0xca40('0x6')](_0x58b62d,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x9943a0,_0x1d8e29){var _0x4a3bfb={'XMF-ECM':_0x1d8e29[_0xca40('0x7')],'XMF-HEADERINFO':_0x1d8e29[_0xca40('0x8')],'XMF-MINRATE':_0x1d8e29['minrate'],'XMF-MAXRATE':_0x1d8e29[_0xca40('0x9')],'XMF-MODEM':util[_0xca40('0xa')]('\x22%s\x22',_0x1d8e29['modem']),'XMF-GATEWAY':_0x1d8e29[_0xca40('0xb')],'XMF-FAXDETECT':_0x1d8e29[_0xca40('0xc')],'XMF-T38TIMEOUT':_0x1d8e29[_0xca40('0xd')],'XMF-LOCALSTATIONID':_0x1d8e29['localstationid'],'XMF-PATH':_0x9943a0[_0xca40('0xe')]};return _0x4a3bfb;};exports['variablesAction']=function(_0x16c022,_0xa50a09){return{'actionid':_0x16c022[_0xca40('0xf')],'action':_0xca40('0x10'),'channel':_0x16c022[_0xca40('0x11')],'Exten':_0xca40('0x12'),'Context':'from-sip','Priority':'1','callerid':util[_0xca40('0xa')](_0xca40('0x13'),_0x16c022['headerinfo']?_0x16c022[_0xca40('0x8')]:'',_0x16c022[_0xca40('0x14')]),'variable':_0xa50a09,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x16c022[_0xca40('0xf')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 6a28f8f..266da3f 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 _0x7da1=['initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','inspect','sync','[index.js][main]','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','hour','resolve','getAgents','then','initAgents','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts'];(function(_0x5d7d2d,_0x3f8044){var _0x2c5086=function(_0x28e716){while(--_0x28e716){_0x5d7d2d['push'](_0x5d7d2d['shift']());}};_0x2c5086(++_0x3f8044);}(_0x7da1,0x1bb));var _0x17da=function(_0xe256c5,_0x55722a){_0xe256c5=_0xe256c5-0x0;var _0x1d6a58=_0x7da1[_0xe256c5];return _0x1d6a58;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require(_0x17da('0x0'));var server=require(_0x17da('0x1'));var Realtime=require(_0x17da('0x2'));var Report=require(_0x17da('0x3'));var Acw=require(_0x17da('0x4'));var Trigger=require('./trigger');var Dialer=require(_0x17da('0x5'));var Preview=require(_0x17da('0x6'));var Fax=require(_0x17da('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x17da('0x8'));var voiceQueueReport=require(_0x17da('0x9'));var voiceCallReport=require(_0x17da('0xa'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0x17da('0xb'));var cmHopperHistory=require(_0x17da('0xc'));var campaign=require(_0x17da('0xd'));var voiceExtension=require(_0x17da('0xe'));var faxAccount=require(_0x17da('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x17da('0x10'));var sugarcrm=require(_0x17da('0x11'));var freshdesk=require(_0x17da('0x12'));var desk=require(_0x17da('0x13'));var zoho=require(_0x17da('0x14'));var vtiger=require(_0x17da('0x15'));var freshsales=require(_0x17da('0x16'));var servicenow=require(_0x17da('0x17'));var dynamics365=require(_0x17da('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x17da('0x19'))(_0x17da('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x17da('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x17da('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x17da('0x1c')]()['then'](user[_0x17da('0x1d')]())[_0x17da('0x1e')](realtime[_0x17da('0x1f')]())[_0x17da('0x1e')](user['getTelephones']())[_0x17da('0x1e')](realtime[_0x17da('0x20')]())[_0x17da('0x1e')](trunk['getTrunks']())[_0x17da('0x1e')](realtime[_0x17da('0x21')]())[_0x17da('0x1e')](voiceQueue[_0x17da('0x22')]())['then'](realtime[_0x17da('0x23')]())[_0x17da('0x1e')](trigger[_0x17da('0x24')]())[_0x17da('0x1e')](realtime[_0x17da('0x25')]())[_0x17da('0x1e')](template[_0x17da('0x26')]())[_0x17da('0x1e')](realtime[_0x17da('0x27')]())[_0x17da('0x1e')](zendesk[_0x17da('0x28')]())[_0x17da('0x1e')](realtime[_0x17da('0x29')]())[_0x17da('0x1e')](salesforce[_0x17da('0x2a')]())[_0x17da('0x1e')](realtime[_0x17da('0x2b')]())[_0x17da('0x1e')](sugarcrm[_0x17da('0x2c')]())['then'](realtime[_0x17da('0x2d')]())['then'](freshdesk[_0x17da('0x2e')]())[_0x17da('0x1e')](realtime['initFreshdeskAccounts']())['then'](desk['getDeskAccounts']())[_0x17da('0x1e')](realtime[_0x17da('0x2f')]())[_0x17da('0x1e')](zoho[_0x17da('0x30')]())['then'](realtime[_0x17da('0x31')]())[_0x17da('0x1e')](vtiger[_0x17da('0x32')]())[_0x17da('0x1e')](realtime['initVtigerAccounts']())[_0x17da('0x1e')](freshsales[_0x17da('0x33')]())[_0x17da('0x1e')](realtime[_0x17da('0x34')]())['then'](servicenow['getServicenowAccounts']())[_0x17da('0x1e')](realtime[_0x17da('0x35')]())[_0x17da('0x1e')](dynamics365[_0x17da('0x36')]())[_0x17da('0x1e')](realtime['initDynamics365Accounts']())[_0x17da('0x1e')](campaign[_0x17da('0x37')]())[_0x17da('0x1e')](realtime[_0x17da('0x38')]())[_0x17da('0x1e')](voiceExtension[_0x17da('0x39')]())[_0x17da('0x1e')](realtime[_0x17da('0x3a')]())[_0x17da('0x1e')](faxAccount['getFaxAccounts']())[_0x17da('0x1e')](realtime['initFaxAccounts']())[_0x17da('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0x17da('0x1c')]()[_0x17da('0x1e')](voiceQueueReport[_0x17da('0x3b')]())[_0x17da('0x1e')](realtime[_0x17da('0x3c')]())[_0x17da('0x1e')](cmHopperHistory[_0x17da('0x3d')]())['then'](realtime[_0x17da('0x3e')]())[_0x17da('0x1e')](cmHopperHistory['getCampaignHopperHistory']())[_0x17da('0x1e')](realtime[_0x17da('0x3f')]())['then'](voiceCallReport[_0x17da('0x40')]())['then'](realtime['initVoiceCallReports']())[_0x17da('0x41')](function(_0x231a16){logger[_0x17da('0x42')]('[index.js][initParams]',util[_0x17da('0x43')](_0x231a16,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x17da('0x1e')](function(_0x11ace3){return initRealtime();})[_0x17da('0x1e')](function(){return initParams();})[_0x17da('0x1e')](function(){report[_0x17da('0x44')]();setInterval(initRealtime,0x1388);})[_0x17da('0x41')](function(_0x3e35c0){logger['error'](_0x17da('0x45'),util[_0x17da('0x43')](_0x3e35c0,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x807f=['error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','moment','./server','./realtime','./report','./acw','./dialer','./preview','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','then','getAgents','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0x807f,0x8a));var _0xf807=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x807f[_0x386c3e];return _0x4b8e13;};'use strict';var BPromise=require(_0xf807('0x0'));var util=require('util');var moment=require(_0xf807('0x1'));var server=require(_0xf807('0x2'));var Realtime=require(_0xf807('0x3'));var Report=require(_0xf807('0x4'));var Acw=require(_0xf807('0x5'));var Trigger=require('./trigger');var Dialer=require(_0xf807('0x6'));var Preview=require(_0xf807('0x7'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0xf807('0x8'));var voiceQueueReport=require(_0xf807('0x9'));var voiceCallReport=require(_0xf807('0xa'));var trunk=require(_0xf807('0xb'));var trigger=require(_0xf807('0xc'));var template=require(_0xf807('0xd'));var cmHopperHistory=require(_0xf807('0xe'));var campaign=require(_0xf807('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xf807('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xf807('0x11'));var sugarcrm=require(_0xf807('0x12'));var freshdesk=require(_0xf807('0x13'));var desk=require(_0xf807('0x14'));var zoho=require(_0xf807('0x15'));var vtiger=require(_0xf807('0x16'));var freshsales=require(_0xf807('0x17'));var servicenow=require(_0xf807('0x18'));var dynamics365=require(_0xf807('0x19'));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('../../config/logger')(_0xf807('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xf807('0x1b')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xf807('0x1b')](_0xf807('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xf807('0x1d')](user[_0xf807('0x1e')]())[_0xf807('0x1d')](realtime['initAgents']())['then'](user['getTelephones']())[_0xf807('0x1d')](realtime[_0xf807('0x1f')]())['then'](trunk[_0xf807('0x20')]())['then'](realtime[_0xf807('0x21')]())['then'](voiceQueue['getVoiceQueues']())['then'](realtime[_0xf807('0x22')]())[_0xf807('0x1d')](trigger['getTriggers']())[_0xf807('0x1d')](realtime['initTriggers']())[_0xf807('0x1d')](template[_0xf807('0x23')]())[_0xf807('0x1d')](realtime[_0xf807('0x24')]())[_0xf807('0x1d')](zendesk[_0xf807('0x25')]())[_0xf807('0x1d')](realtime['initZendeskAccounts']())[_0xf807('0x1d')](salesforce[_0xf807('0x26')]())['then'](realtime['initSalesforceAccounts']())[_0xf807('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0xf807('0x1d')](realtime['initSugarcrmAccounts']())[_0xf807('0x1d')](freshdesk[_0xf807('0x27')]())['then'](realtime['initFreshdeskAccounts']())[_0xf807('0x1d')](desk['getDeskAccounts']())[_0xf807('0x1d')](realtime[_0xf807('0x28')]())['then'](zoho[_0xf807('0x29')]())[_0xf807('0x1d')](realtime[_0xf807('0x2a')]())[_0xf807('0x1d')](vtiger[_0xf807('0x2b')]())[_0xf807('0x1d')](realtime[_0xf807('0x2c')]())[_0xf807('0x1d')](freshsales[_0xf807('0x2d')]())[_0xf807('0x1d')](realtime['initFreshsalesAccounts']())[_0xf807('0x1d')](servicenow[_0xf807('0x2e')]())[_0xf807('0x1d')](realtime[_0xf807('0x2f')]())[_0xf807('0x1d')](dynamics365[_0xf807('0x30')]())['then'](realtime[_0xf807('0x31')]())[_0xf807('0x1d')](campaign[_0xf807('0x32')]())[_0xf807('0x1d')](realtime[_0xf807('0x33')]())['then'](voiceExtension[_0xf807('0x34')]())[_0xf807('0x1d')](realtime[_0xf807('0x35')]())[_0xf807('0x1d')](faxAccount['getFaxAccounts']())[_0xf807('0x1d')](realtime[_0xf807('0x36')]())[_0xf807('0x1d')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xf807('0x1d')](voiceQueueReport[_0xf807('0x37')]())[_0xf807('0x1d')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0xf807('0x38')]())[_0xf807('0x1d')](realtime['initVoiceQueueHopperHistory']())[_0xf807('0x1d')](cmHopperHistory['getCampaignHopperHistory']())[_0xf807('0x1d')](realtime['initCampaignHopperHistory']())[_0xf807('0x1d')](voiceCallReport[_0xf807('0x39')]())[_0xf807('0x1d')](realtime[_0xf807('0x3a')]())[_0xf807('0x3b')](function(_0x29e03e){logger[_0xf807('0x3c')](_0xf807('0x3d'),util[_0xf807('0x3e')](_0x29e03e,{'showHidden':![],'depth':null}));});}function main(){return server[_0xf807('0x3f')](realtime,preview,fax)[_0xf807('0x1d')](function(_0x4126bb){return initRealtime();})[_0xf807('0x1d')](function(){return initParams();})[_0xf807('0x1d')](function(){report[_0xf807('0x40')]();setInterval(initRealtime,0x1388);})[_0xf807('0x3b')](function(_0x57c0bc){logger[_0xf807('0x3c')](_0xf807('0x41'),util[_0xf807('0x3e')](_0x57c0bc,{'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 7e8d8e2..db1de70 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x454b02,_0x181ac3){var _0x29bb9c=function(_0x489b36){while(--_0x489b36){_0x454b02['push'](_0x454b02['shift']());}};_0x29bb9c(++_0x181ac3);}(_0x70e0,0x17b));var _0x070e=function(_0x1f5f43,_0x199948){_0x1f5f43=_0x1f5f43-0x0;var _0x49b312=_0x70e0[_0x1f5f43];return _0x49b312;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};module['exports']=Agent; \ No newline at end of file +var _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0xf8636f,_0x3f1e84){var _0x58f657=function(_0x3afaad){while(--_0x3afaad){_0xf8636f['push'](_0xf8636f['shift']());}};_0x58f657(++_0x3f1e84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 097a26f..a101435 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 _0x4622=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence'];(function(_0x5db002,_0x598b28){var _0x3229ba=function(_0x5b0855){while(--_0x5b0855){_0x5db002['push'](_0x5db002['shift']());}};_0x3229ba(++_0x598b28);}(_0x4622,0x1f2));var _0x2462=function(_0x47c5bf,_0x45977e){_0x47c5bf=_0x47c5bf-0x0;var _0x11b779=_0x4622[_0x47c5bf];return _0x11b779;};'use strict';function Campaign(_0x1090ab){this['id']=_0x1090ab['id']||0x0;this[_0x2462('0x0')]=_0x1090ab[_0x2462('0x0')]||'';this['type']=_0x1090ab[_0x2462('0x1')]||_0x2462('0x2');this[_0x2462('0x3')]=0x0;this[_0x2462('0x4')]=0x0;this[_0x2462('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x2462('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0x2462('0x7')]=_0x1090ab[_0x2462('0x7')];this[_0x2462('0x8')]=_0x1090ab[_0x2462('0x8')];this[_0x2462('0x9')]=_0x1090ab[_0x2462('0x9')]||null;this[_0x2462('0xa')]=_0x1090ab[_0x2462('0xa')]?_0x1090ab['dialGlobalInterval']:null;this[_0x2462('0xb')]=_0x1090ab[_0x2462('0xb')];this[_0x2462('0xc')]=_0x1090ab['dialOriginateCallerIdNumber'];this[_0x2462('0xd')]=_0x1090ab[_0x2462('0xd')]||0x1e;this[_0x2462('0xe')]=_0x1090ab['dialCongestionMaxRetry'];this[_0x2462('0xf')]=_0x1090ab[_0x2462('0xf')];this[_0x2462('0x10')]=_0x1090ab[_0x2462('0x10')];this[_0x2462('0x11')]=_0x1090ab['dialBusyRetryFrequency'];this[_0x2462('0x12')]=_0x1090ab['dialNoAnswerMaxRetry'];this[_0x2462('0x13')]=_0x1090ab[_0x2462('0x13')];this[_0x2462('0x14')]=_0x1090ab['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x1090ab[_0x2462('0x15')]||0x3;this[_0x2462('0x16')]=_0x1090ab[_0x2462('0x16')]||0x96;this[_0x2462('0x17')]=_0x1090ab[_0x2462('0x17')]||0x3;this[_0x2462('0x18')]=_0x1090ab['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x1090ab[_0x2462('0x19')]||0x3;this[_0x2462('0x1a')]=_0x1090ab[_0x2462('0x1a')]||0x96;this[_0x2462('0x1b')]=_0x1090ab[_0x2462('0x1b')]||0x3;this['dialMachineRetryFrequency']=_0x1090ab[_0x2462('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x1090ab['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x1090ab[_0x2462('0x1d')]||0x96;this[_0x2462('0x1e')]=_0x1090ab[_0x2462('0x1e')]||'DESC';this[_0x2462('0x1f')]=_0x1090ab[_0x2462('0x1f')]||undefined;this[_0x2462('0x20')]=_0x1090ab[_0x2462('0x20')]||undefined;this[_0x2462('0x21')]=_0x1090ab[_0x2462('0x21')]||undefined;this[_0x2462('0x22')]=_0x1090ab[_0x2462('0x22')]?_0x1090ab['TrunkBackup']:undefined;this[_0x2462('0x23')]=_0x1090ab[_0x2462('0x23')]?_0x1090ab[_0x2462('0x23')]:undefined;this[_0x2462('0x24')]=_0x1090ab[_0x2462('0x24')]?_0x1090ab[_0x2462('0x24')]:undefined;this[_0x2462('0x25')]=_0x1090ab[_0x2462('0x25')]?_0x1090ab[_0x2462('0x25')]:undefined;this[_0x2462('0x26')]=_0x1090ab[_0x2462('0x25')]?_0x1090ab[_0x2462('0x25')]['name']:undefined;this[_0x2462('0x27')]=_0x1090ab[_0x2462('0x27')]||![];this['dialAMDInitialSilence']=_0x1090ab[_0x2462('0x28')];this['dialAMDGreeting']=_0x1090ab[_0x2462('0x29')];this[_0x2462('0x2a')]=_0x1090ab[_0x2462('0x2a')];this[_0x2462('0x2b')]=_0x1090ab['dialAMDTotalAnalysisTime'];this[_0x2462('0x2c')]=_0x1090ab['dialAMDMinWordLength'];this[_0x2462('0x2d')]=_0x1090ab[_0x2462('0x2d')];this[_0x2462('0x2e')]=_0x1090ab[_0x2462('0x2e')];this[_0x2462('0x2f')]=_0x1090ab[_0x2462('0x2f')];this[_0x2462('0x30')]=_0x1090ab[_0x2462('0x30')];}module['exports']=Campaign; \ No newline at end of file +var _0x6263=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6263,0x170));var _0x3626=function(_0x594168,_0x3ac22f){_0x594168=_0x594168-0x0;var _0x31645f=_0x6263[_0x594168];return _0x31645f;};'use strict';function Campaign(_0x46235c){this['id']=_0x46235c['id']||0x0;this['name']=_0x46235c[_0x3626('0x0')]||'';this[_0x3626('0x1')]=_0x46235c[_0x3626('0x1')]||_0x3626('0x2');this['originated']=0x0;this[_0x3626('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x3626('0x4')]=0x0;this[_0x3626('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0x3626('0x6')]=_0x46235c[_0x3626('0x6')];this[_0x3626('0x7')]=_0x46235c['limitCalls'];this['dialTimezone']=_0x46235c[_0x3626('0x8')]||null;this[_0x3626('0x9')]=_0x46235c['dialGlobalInterval']?_0x46235c[_0x3626('0x9')]:null;this[_0x3626('0xa')]=_0x46235c[_0x3626('0xa')];this['dialOriginateCallerIdNumber']=_0x46235c[_0x3626('0xb')];this['dialOriginateTimeout']=_0x46235c[_0x3626('0xc')]||0x1e;this[_0x3626('0xd')]=_0x46235c['dialCongestionMaxRetry'];this[_0x3626('0xe')]=_0x46235c['dialCongestionRetryFrequency'];this[_0x3626('0xf')]=_0x46235c[_0x3626('0xf')];this['dialBusyRetryFrequency']=_0x46235c[_0x3626('0x10')];this[_0x3626('0x11')]=_0x46235c[_0x3626('0x11')];this[_0x3626('0x12')]=_0x46235c[_0x3626('0x12')];this[_0x3626('0x13')]=_0x46235c[_0x3626('0x13')];this[_0x3626('0x14')]=_0x46235c['dialNoSuchNumberMaxRetry']||0x3;this[_0x3626('0x15')]=_0x46235c[_0x3626('0x15')]||0x96;this[_0x3626('0x16')]=_0x46235c[_0x3626('0x16')]||0x3;this[_0x3626('0x17')]=_0x46235c[_0x3626('0x17')]||0x96;this[_0x3626('0x18')]=_0x46235c[_0x3626('0x18')]||0x3;this[_0x3626('0x19')]=_0x46235c[_0x3626('0x19')]||0x96;this[_0x3626('0x1a')]=_0x46235c[_0x3626('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x46235c[_0x3626('0x1b')]||0x96;this[_0x3626('0x1c')]=_0x46235c['dialAgentRejectMaxRetry']||0x3;this[_0x3626('0x1d')]=_0x46235c['dialAgentRejectRetryFrequency']||0x96;this[_0x3626('0x1e')]=_0x46235c[_0x3626('0x1e')]||'DESC';this[_0x3626('0x1f')]=_0x46235c[_0x3626('0x1f')]||undefined;this[_0x3626('0x20')]=_0x46235c['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x3626('0x21')]=_0x46235c[_0x3626('0x21')]||undefined;this[_0x3626('0x22')]=_0x46235c[_0x3626('0x22')]?_0x46235c[_0x3626('0x22')]:undefined;this['Trunk']=_0x46235c[_0x3626('0x23')]?_0x46235c[_0x3626('0x23')]:undefined;this['Interval']=_0x46235c[_0x3626('0x24')]?_0x46235c[_0x3626('0x24')]:undefined;this[_0x3626('0x25')]=_0x46235c[_0x3626('0x25')]?_0x46235c[_0x3626('0x25')]:undefined;this[_0x3626('0x26')]=_0x46235c['SquareProject']?_0x46235c['SquareProject'][_0x3626('0x0')]:undefined;this['dialAMDActive']=_0x46235c[_0x3626('0x27')]||![];this['dialAMDInitialSilence']=_0x46235c[_0x3626('0x28')];this[_0x3626('0x29')]=_0x46235c[_0x3626('0x29')];this[_0x3626('0x2a')]=_0x46235c[_0x3626('0x2a')];this['dialAMDTotalAnalysisTime']=_0x46235c[_0x3626('0x2b')];this[_0x3626('0x2c')]=_0x46235c[_0x3626('0x2c')];this[_0x3626('0x2d')]=_0x46235c[_0x3626('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x46235c['dialAMDMaximumNumberOfWords'];this[_0x3626('0x2e')]=_0x46235c[_0x3626('0x2e')];this[_0x3626('0x2f')]=_0x46235c[_0x3626('0x2f')];}module[_0x3626('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index b0ce4e4..3c91f1f 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 _0x5b0d=['transferType','mohtime','exports','channel','calleridnum','accountcode','uniqueid','linkedid','exten','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','type','tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum'];(function(_0xe7ebb7,_0x5ecf25){var _0x419680=function(_0x3803c8){while(--_0x3803c8){_0xe7ebb7['push'](_0xe7ebb7['shift']());}};_0x419680(++_0x5ecf25);}(_0x5b0d,0x153));var _0xd5b0=function(_0x4bbc03,_0x5c2d5d){_0x4bbc03=_0x4bbc03-0x0;var _0x1f62a9=_0x5b0d[_0x4bbc03];return _0x1f62a9;};'use strict';function Channel(){this['starttime']=null;this[_0xd5b0('0x0')]='';this['destinationchannel']='';this[_0xd5b0('0x1')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0xd5b0('0x2')]=0x0;this['context']='';this[_0xd5b0('0x3')]=0x0;this[_0xd5b0('0x4')]=0x0;this[_0xd5b0('0x5')]=0x0;this['answered']=![];this['answertime']=null;this[_0xd5b0('0x6')]=null;this[_0xd5b0('0x7')]=![];this[_0xd5b0('0x8')]=![];this[_0xd5b0('0x9')]='';this[_0xd5b0('0xa')]='';this[_0xd5b0('0xb')]=0x0;this[_0xd5b0('0xc')]=0x0;this['holdtime']=0x0;this[_0xd5b0('0xd')]=null;this[_0xd5b0('0xe')]=null;this[_0xd5b0('0xf')]=null;this[_0xd5b0('0x10')]=![];this[_0xd5b0('0x11')]=null;this['queue']=null;this[_0xd5b0('0x12')]=[];this[_0xd5b0('0x13')]=undefined;this[_0xd5b0('0x14')]=undefined;this[_0xd5b0('0x15')]=undefined;this[_0xd5b0('0x16')]=0x0;}module[_0xd5b0('0x17')]=Channel; \ No newline at end of file +var _0x9af6=['context','uniqueid','linkedid','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','exports','starttime','channel','destinationchannel','connectedlinenum'];(function(_0x3d0632,_0x213d47){var _0x2637dd=function(_0x344469){while(--_0x344469){_0x3d0632['push'](_0x3d0632['shift']());}};_0x2637dd(++_0x213d47);}(_0x9af6,0x1d7));var _0x69af=function(_0x92d72e,_0x6e0a25){_0x92d72e=_0x92d72e-0x0;var _0x5760c1=_0x9af6[_0x92d72e];return _0x5760c1;};'use strict';function Channel(){this[_0x69af('0x0')]=null;this[_0x69af('0x1')]='';this[_0x69af('0x2')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0x69af('0x3')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0x69af('0x4')]='';this[_0x69af('0x5')]=0x0;this[_0x69af('0x6')]=0x0;this['exten']=0x0;this[_0x69af('0x7')]=![];this['answertime']=null;this[_0x69af('0x8')]=null;this[_0x69af('0x9')]=![];this[_0x69af('0xa')]=![];this[_0x69af('0xb')]='';this[_0x69af('0xc')]='';this[_0x69af('0xd')]=0x0;this[_0x69af('0xe')]=0x0;this[_0x69af('0xf')]=0x0;this['type']=null;this['tag']=null;this[_0x69af('0x10')]=null;this[_0x69af('0x11')]=![];this[_0x69af('0x12')]=null;this[_0x69af('0x13')]=null;this[_0x69af('0x14')]=[];this[_0x69af('0x15')]=undefined;this[_0x69af('0x16')]=undefined;this[_0x69af('0x17')]=undefined;this['mohtime']=0x0;}module[_0x69af('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index eac28e3..33ea990 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 _0x8619=['password','consumerKey','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x22d426,_0x10d8d4){var _0x37e5e6=function(_0x30e4c0){while(--_0x30e4c0){_0x22d426['push'](_0x22d426['shift']());}};_0x37e5e6(++_0x10d8d4);}(_0x8619,0xf8));var _0x9861=function(_0xe75596,_0x181f3c){_0xe75596=_0xe75596-0x0;var _0x2dc99a=_0x8619[_0xe75596];return _0x2dc99a;};'use strict';function DeskAccount(_0x5bcb83){this['id']=_0x5bcb83['id']||0x0;this[_0x9861('0x0')]=_0x5bcb83[_0x9861('0x0')]||'';this[_0x9861('0x1')]=_0x5bcb83[_0x9861('0x1')]||'';this[_0x9861('0x2')]=_0x5bcb83[_0x9861('0x2')]||'';this[_0x9861('0x3')]=_0x5bcb83[_0x9861('0x3')]||'';this['password']=_0x5bcb83[_0x9861('0x4')]||'';this[_0x9861('0x5')]=_0x5bcb83['consumerKey']||'';this['consumerSecret']=_0x5bcb83['consumerSecret']||'';this[_0x9861('0x6')]=_0x5bcb83[_0x9861('0x6')]||'';this[_0x9861('0x7')]=_0x5bcb83[_0x9861('0x7')]||'';this[_0x9861('0x8')]=_0x5bcb83[_0x9861('0x8')]||'';this['serverUrl']=_0x5bcb83[_0x9861('0x9')]||'';this['Configurations']=_0x5bcb83[_0x9861('0xa')]||{};}module[_0x9861('0xb')]=DeskAccount; \ No newline at end of file +var _0x3ce4=['tokenSecret','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','token'];(function(_0x481401,_0x2d75a6){var _0x169a4c=function(_0x1fdc1f){while(--_0x1fdc1f){_0x481401['push'](_0x481401['shift']());}};_0x169a4c(++_0x2d75a6);}(_0x3ce4,0x1a7));var _0x43ce=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x3ce4[_0x11005e];return _0x29338f;};'use strict';function DeskAccount(_0x30550b){this['id']=_0x30550b['id']||0x0;this[_0x43ce('0x0')]=_0x30550b[_0x43ce('0x0')]||'';this[_0x43ce('0x1')]=_0x30550b[_0x43ce('0x1')]||'';this[_0x43ce('0x2')]=_0x30550b[_0x43ce('0x2')]||'';this[_0x43ce('0x3')]=_0x30550b['authType']||'';this[_0x43ce('0x4')]=_0x30550b[_0x43ce('0x4')]||'';this[_0x43ce('0x5')]=_0x30550b['consumerKey']||'';this['consumerSecret']=_0x30550b['consumerSecret']||'';this[_0x43ce('0x6')]=_0x30550b['token']||'';this[_0x43ce('0x7')]=_0x30550b[_0x43ce('0x7')]||'';this['type']=_0x30550b['type']||'';this['serverUrl']=_0x30550b[_0x43ce('0x8')]||'';this[_0x43ce('0x9')]=_0x30550b[_0x43ce('0x9')]||{};}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 8d51bcd..540cd03 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 _0x80ed=['clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x525dde,_0x37d407){var _0x4149df=function(_0x1e2126){while(--_0x1e2126){_0x525dde['push'](_0x525dde['shift']());}};_0x4149df(++_0x37d407);}(_0x80ed,0x11c));var _0xd80e=function(_0x44b78d,_0x1600ee){_0x44b78d=_0x44b78d-0x0;var _0x18b3b9=_0x80ed[_0x44b78d];return _0x18b3b9;};'use strict';function Dynamics365Account(_0x4a9e0a){this['id']=_0x4a9e0a['id']||0x0;this['name']=_0x4a9e0a[_0xd80e('0x0')]||'';this[_0xd80e('0x1')]=_0x4a9e0a[_0xd80e('0x1')]||'';this['password']=_0x4a9e0a[_0xd80e('0x2')]||'';this[_0xd80e('0x3')]=_0x4a9e0a[_0xd80e('0x3')]||'';this[_0xd80e('0x4')]=_0x4a9e0a['tenantId']||'';this[_0xd80e('0x5')]=_0x4a9e0a[_0xd80e('0x5')]||'';this[_0xd80e('0x6')]=_0x4a9e0a['clientSecret']||{};this[_0xd80e('0x7')]=_0x4a9e0a[_0xd80e('0x7')]||'';this[_0xd80e('0x8')]=_0x4a9e0a[_0xd80e('0x8')]||{};}module[_0xd80e('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x878f=['serverUrl','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x422965,_0x3c52a7){var _0xe01813=function(_0x2ae045){while(--_0x2ae045){_0x422965['push'](_0x422965['shift']());}};_0xe01813(++_0x3c52a7);}(_0x878f,0x173));var _0xf878=function(_0x141946,_0xb52142){_0x141946=_0x141946-0x0;var _0x229d95=_0x878f[_0x141946];return _0x229d95;};'use strict';function Dynamics365Account(_0x51758f){this['id']=_0x51758f['id']||0x0;this[_0xf878('0x0')]=_0x51758f[_0xf878('0x0')]||'';this[_0xf878('0x1')]=_0x51758f[_0xf878('0x1')]||'';this[_0xf878('0x2')]=_0x51758f[_0xf878('0x2')]||'';this[_0xf878('0x3')]=_0x51758f[_0xf878('0x3')]||'';this[_0xf878('0x4')]=_0x51758f[_0xf878('0x4')]||'';this[_0xf878('0x5')]=_0x51758f['clientId']||'';this['clientSecret']=_0x51758f[_0xf878('0x6')]||{};this[_0xf878('0x7')]=_0x51758f['serverUrl']||'';this['Configurations']=_0x51758f['Configurations']||{};}module[_0xf878('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index fb5ff67..1b1f369 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 _0x5d78=['faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','minrate','maxrate','modem','gateway'];(function(_0x2d64a8,_0x5b3d59){var _0x6a11e2=function(_0x51d8d2){while(--_0x51d8d2){_0x2d64a8['push'](_0x2d64a8['shift']());}};_0x6a11e2(++_0x5b3d59);}(_0x5d78,0x9d));var _0x85d7=function(_0x387d9f,_0x1f8b7a){_0x387d9f=_0x387d9f-0x0;var _0x5dc02c=_0x5d78[_0x387d9f];return _0x5dc02c;};'use strict';function FaxAccount(_0x9da9a7){this['id']=_0x9da9a7['id']||0x0;this[_0x85d7('0x0')]=_0x9da9a7[_0x85d7('0x0')]||'';this[_0x85d7('0x1')]=_0x9da9a7[_0x85d7('0x1')];this[_0x85d7('0x2')]=_0x9da9a7[_0x85d7('0x2')];this[_0x85d7('0x3')]=_0x9da9a7['headerinfo'];this['localstationid']=_0x9da9a7['localstationid'];this[_0x85d7('0x4')]=_0x9da9a7[_0x85d7('0x4')]||0x960;this[_0x85d7('0x5')]=_0x9da9a7['maxrate']||0x3840;this['modem']=_0x9da9a7[_0x85d7('0x6')]||'v17,v27,v29';this[_0x85d7('0x7')]=_0x9da9a7[_0x85d7('0x7')]||'no';this[_0x85d7('0x8')]=_0x9da9a7[_0x85d7('0x8')]||'no';this['t38timeout']=_0x9da9a7[_0x85d7('0x9')]||0x1388;this[_0x85d7('0xa')]=_0x9da9a7[_0x85d7('0xa')]||_0x85d7('0xb');this['Trunk']=_0x9da9a7[_0x85d7('0xc')]?_0x9da9a7[_0x85d7('0xc')]:undefined;this[_0x85d7('0xd')]=_0x9da9a7[_0x85d7('0xd')];this[_0x85d7('0xe')]=_0x9da9a7['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0x1a93=['SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech'];(function(_0x22dda1,_0x48d7f0){var _0x509548=function(_0x19b042){while(--_0x19b042){_0x22dda1['push'](_0x22dda1['shift']());}};_0x509548(++_0x48d7f0);}(_0x1a93,0x184));var _0x31a9=function(_0x46e326,_0x29eb81){_0x46e326=_0x46e326-0x0;var _0x75f642=_0x1a93[_0x46e326];return _0x75f642;};'use strict';function FaxAccount(_0xabfd0b){this['id']=_0xabfd0b['id']||0x0;this[_0x31a9('0x0')]=_0xabfd0b[_0x31a9('0x0')]||'';this[_0x31a9('0x1')]=_0xabfd0b[_0x31a9('0x1')];this['ecm']=_0xabfd0b[_0x31a9('0x2')];this[_0x31a9('0x3')]=_0xabfd0b[_0x31a9('0x3')];this[_0x31a9('0x4')]=_0xabfd0b[_0x31a9('0x4')];this['minrate']=_0xabfd0b[_0x31a9('0x5')]||0x960;this[_0x31a9('0x6')]=_0xabfd0b[_0x31a9('0x6')]||0x3840;this[_0x31a9('0x7')]=_0xabfd0b['modem']||'v17,v27,v29';this[_0x31a9('0x8')]=_0xabfd0b['gateway']||'no';this['faxdetect']=_0xabfd0b[_0x31a9('0x9')]||'no';this[_0x31a9('0xa')]=_0xabfd0b[_0x31a9('0xa')]||0x1388;this[_0x31a9('0xb')]=_0xabfd0b[_0x31a9('0xb')]||_0x31a9('0xc');this[_0x31a9('0xd')]=_0xabfd0b[_0x31a9('0xd')]?_0xabfd0b['Trunk']:undefined;this[_0x31a9('0xe')]=_0xabfd0b['ListId'];this['key']=_0xabfd0b[_0x31a9('0xf')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 2559794..850b075 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 _0xc346=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xc346,0x1cc));var _0x6c34=function(_0x34788c,_0x596fce){_0x34788c=_0x34788c-0x0;var _0x26a4e6=_0xc346[_0x34788c];return _0x26a4e6;};'use strict';function FreshdeskAccount(_0x1649f1){this['id']=_0x1649f1['id']||0x0;this[_0x6c34('0x0')]=_0x1649f1[_0x6c34('0x0')]||'';this[_0x6c34('0x1')]=_0x1649f1['username']||'';this[_0x6c34('0x2')]=_0x1649f1[_0x6c34('0x3')]||'';this['remoteUri']=_0x1649f1[_0x6c34('0x4')]||'';this[_0x6c34('0x5')]=_0x1649f1[_0x6c34('0x5')]||'';this[_0x6c34('0x6')]=_0x1649f1['Configurations']||{};}module[_0x6c34('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x857c=['remoteUri','serverUrl','Configurations','exports','username','apiKey','token'];(function(_0x15a738,_0x180324){var _0x2cd2f8=function(_0x3dc413){while(--_0x3dc413){_0x15a738['push'](_0x15a738['shift']());}};_0x2cd2f8(++_0x180324);}(_0x857c,0x162));var _0xc857=function(_0x53f715,_0x52587b){_0x53f715=_0x53f715-0x0;var _0x16c757=_0x857c[_0x53f715];return _0x16c757;};'use strict';function FreshdeskAccount(_0x47de14){this['id']=_0x47de14['id']||0x0;this['name']=_0x47de14['name']||'';this[_0xc857('0x0')]=_0x47de14[_0xc857('0x0')]||'';this[_0xc857('0x1')]=_0x47de14[_0xc857('0x2')]||'';this[_0xc857('0x3')]=_0x47de14['remoteUri']||'';this['serverUrl']=_0x47de14[_0xc857('0x4')]||'';this[_0xc857('0x5')]=_0x47de14[_0xc857('0x5')]||{};}module[_0xc857('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 f93b8e6..de28b50 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 _0x51f2=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x51f2,0xeb));var _0x251f=function(_0x3718de,_0xde1acf){_0x3718de=_0x3718de-0x0;var _0x274164=_0x51f2[_0x3718de];return _0x274164;};'use strict';function FreshsalesAccount(_0x1cf463){this['id']=_0x1cf463['id']||0x0;this[_0x251f('0x0')]=_0x1cf463[_0x251f('0x0')]||'';this[_0x251f('0x1')]=_0x1cf463[_0x251f('0x1')]||'';this[_0x251f('0x2')]=_0x1cf463[_0x251f('0x3')]||'';this[_0x251f('0x4')]=_0x1cf463[_0x251f('0x4')]||'';this['serverUrl']=_0x1cf463[_0x251f('0x5')]||'';this[_0x251f('0x6')]=_0x1cf463[_0x251f('0x6')]||{};}module[_0x251f('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xcca7=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1fb11c,_0x48f107){var _0x3ae58d=function(_0x2feae1){while(--_0x2feae1){_0x1fb11c['push'](_0x1fb11c['shift']());}};_0x3ae58d(++_0x48f107);}(_0xcca7,0x1aa));var _0x7cca=function(_0x2beae2,_0x3ce49b){_0x2beae2=_0x2beae2-0x0;var _0xd226a6=_0xcca7[_0x2beae2];return _0xd226a6;};'use strict';function FreshsalesAccount(_0x58285f){this['id']=_0x58285f['id']||0x0;this[_0x7cca('0x0')]=_0x58285f[_0x7cca('0x0')]||'';this[_0x7cca('0x1')]=_0x58285f['username']||'';this['apiKey']=_0x58285f[_0x7cca('0x2')]||'';this['remoteUri']=_0x58285f[_0x7cca('0x3')]||'';this[_0x7cca('0x4')]=_0x58285f[_0x7cca('0x4')]||'';this[_0x7cca('0x5')]=_0x58285f[_0x7cca('0x5')]||{};}module[_0x7cca('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 97ccfa4..eabae26 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 _0x4b71=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','assigned','lastAssignedTo','motionChannel','mohtime','variables','exports','type'];(function(_0x298f7d,_0x59b478){var _0x46e224=function(_0x45147b){while(--_0x45147b){_0x298f7d['push'](_0x298f7d['shift']());}};_0x46e224(++_0x59b478);}(_0x4b71,0x1e5));var _0x14b7=function(_0x1e7ebb,_0x165ff0){_0x1e7ebb=_0x1e7ebb-0x0;var _0x2f4c0c=_0x4b71[_0x1e7ebb];return _0x2f4c0c;};'use strict';function QueueReport(){this[_0x14b7('0x0')]='inbound';this[_0x14b7('0x1')]='';this[_0x14b7('0x2')]='';this[_0x14b7('0x3')]='';this[_0x14b7('0x4')]='';this[_0x14b7('0x5')]=null;this[_0x14b7('0x6')]=null;this[_0x14b7('0x7')]=0x1;this[_0x14b7('0x8')]=0x1;this['queuecallerabandon']=![];this[_0x14b7('0x9')]=null;this[_0x14b7('0xa')]=![];this[_0x14b7('0xb')]=null;this[_0x14b7('0xc')]=![];this[_0x14b7('0xd')]=null;this['originalposition']=0x1;this[_0x14b7('0xe')]='';this[_0x14b7('0xf')]='';this[_0x14b7('0x10')]='';this[_0x14b7('0x11')]='';this[_0x14b7('0x12')]='';this[_0x14b7('0x13')]='';this[_0x14b7('0x14')]='';this['holdtime']=0x0;this[_0x14b7('0x15')]=![];this[_0x14b7('0x16')]='';this[_0x14b7('0x17')]='voice';this[_0x14b7('0x18')]=0x0;this[_0x14b7('0x19')]={};}module[_0x14b7('0x1a')]=QueueReport; \ No newline at end of file +var _0x9bff=['holdtime','lastAssignedTo','motionChannel','mohtime','variables','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','context','exten','priority'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9bff,0x109));var _0xf9bf=function(_0x58418a,_0x3d9f06){_0x58418a=_0x58418a-0x0;var _0x2716bf=_0x9bff[_0x58418a];return _0x2716bf;};'use strict';function QueueReport(){this[_0xf9bf('0x0')]=_0xf9bf('0x1');this[_0xf9bf('0x2')]='';this[_0xf9bf('0x3')]='';this[_0xf9bf('0x4')]='';this[_0xf9bf('0x5')]='';this[_0xf9bf('0x6')]=null;this[_0xf9bf('0x7')]=null;this[_0xf9bf('0x8')]=0x1;this[_0xf9bf('0x9')]=0x1;this[_0xf9bf('0xa')]=![];this[_0xf9bf('0xb')]=null;this[_0xf9bf('0xc')]=![];this['queuecallercompleteAt']=null;this[_0xf9bf('0xd')]=![];this[_0xf9bf('0xe')]=null;this[_0xf9bf('0xf')]=0x1;this[_0xf9bf('0x10')]='';this['connectedlinenum']='';this[_0xf9bf('0x11')]='';this['accountcode']='';this[_0xf9bf('0x12')]='';this[_0xf9bf('0x13')]='';this[_0xf9bf('0x14')]='';this[_0xf9bf('0x15')]=0x0;this['assigned']=![];this[_0xf9bf('0x16')]='';this[_0xf9bf('0x17')]='voice';this[_0xf9bf('0x18')]=0x0;this[_0xf9bf('0x19')]={};}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 a60e61a..57f5784 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 _0x70af=['integrationTab','serverUrl','Configurations','exports','name','username','password','clientId','clientSecret','securityToken','type'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x70af,0xa9));var _0xf70a=function(_0x266a56,_0x3913bd){_0x266a56=_0x266a56-0x0;var _0x15ed23=_0x70af[_0x266a56];return _0x15ed23;};'use strict';function SalesforceAccount(_0x14964c){this['id']=_0x14964c['id']||0x0;this[_0xf70a('0x0')]=_0x14964c[_0xf70a('0x0')]||'';this[_0xf70a('0x1')]=_0x14964c[_0xf70a('0x1')]||'';this['remoteUri']=_0x14964c['remoteUri']||'';this['password']=_0x14964c[_0xf70a('0x2')]||'';this[_0xf70a('0x3')]=_0x14964c[_0xf70a('0x3')]||'';this[_0xf70a('0x4')]=_0x14964c[_0xf70a('0x4')]||'';this[_0xf70a('0x5')]=_0x14964c[_0xf70a('0x5')]||'';this[_0xf70a('0x6')]=_0x14964c[_0xf70a('0x6')]||_0xf70a('0x7');this['serverUrl']=_0x14964c[_0xf70a('0x8')]||'';this['Configurations']=_0x14964c[_0xf70a('0x9')]||{};}module[_0xf70a('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x9934=['integrationTab','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x1e9d62,_0x25bb8e){var _0x56c490=function(_0x19f4e7){while(--_0x19f4e7){_0x1e9d62['push'](_0x1e9d62['shift']());}};_0x56c490(++_0x25bb8e);}(_0x9934,0x7c));var _0x4993=function(_0x1d5ba8,_0x412a52){_0x1d5ba8=_0x1d5ba8-0x0;var _0x1022a2=_0x9934[_0x1d5ba8];return _0x1022a2;};'use strict';function SalesforceAccount(_0x1e6890){this['id']=_0x1e6890['id']||0x0;this[_0x4993('0x0')]=_0x1e6890['name']||'';this[_0x4993('0x1')]=_0x1e6890[_0x4993('0x1')]||'';this[_0x4993('0x2')]=_0x1e6890[_0x4993('0x2')]||'';this['password']=_0x1e6890[_0x4993('0x3')]||'';this[_0x4993('0x4')]=_0x1e6890[_0x4993('0x4')]||'';this[_0x4993('0x5')]=_0x1e6890[_0x4993('0x5')]||'';this[_0x4993('0x6')]=_0x1e6890['securityToken']||'';this['type']=_0x1e6890[_0x4993('0x7')]||_0x4993('0x8');this['serverUrl']=_0x1e6890['serverUrl']||'';this['Configurations']=_0x1e6890[_0x4993('0x9')]||{};}module[_0x4993('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index dd1e078..be0c6e5 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 _0xd11d=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x43bafa,_0x4b5baf){var _0x56041e=function(_0x3b09af){while(--_0x3b09af){_0x43bafa['push'](_0x43bafa['shift']());}};_0x56041e(++_0x4b5baf);}(_0xd11d,0x177));var _0xdd11=function(_0x42b040,_0x3d04bb){_0x42b040=_0x42b040-0x0;var _0x3f8b4f=_0xd11d[_0x42b040];return _0x3f8b4f;};'use strict';function ServicenowAccount(_0x561044){this['id']=_0x561044['id']||0x0;this[_0xdd11('0x0')]=_0x561044['name']||'';this[_0xdd11('0x1')]=_0x561044[_0xdd11('0x1')]||'';this[_0xdd11('0x2')]=_0x561044[_0xdd11('0x2')]||'';this[_0xdd11('0x3')]=_0x561044['remoteUri']||'';this[_0xdd11('0x4')]=_0x561044[_0xdd11('0x4')]||'';this[_0xdd11('0x5')]=_0x561044[_0xdd11('0x5')]||{};}module[_0xdd11('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x8ab7=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x3072ee,_0x40b136){var _0x47041d=function(_0x47c8ee){while(--_0x47c8ee){_0x3072ee['push'](_0x3072ee['shift']());}};_0x47041d(++_0x40b136);}(_0x8ab7,0x9c));var _0x78ab=function(_0x39ed5e,_0x5b730d){_0x39ed5e=_0x39ed5e-0x0;var _0x12396f=_0x8ab7[_0x39ed5e];return _0x12396f;};'use strict';function ServicenowAccount(_0x456f8a){this['id']=_0x456f8a['id']||0x0;this[_0x78ab('0x0')]=_0x456f8a[_0x78ab('0x0')]||'';this[_0x78ab('0x1')]=_0x456f8a[_0x78ab('0x1')]||'';this['password']=_0x456f8a[_0x78ab('0x2')]||'';this[_0x78ab('0x3')]=_0x456f8a['remoteUri']||'';this[_0x78ab('0x4')]=_0x456f8a[_0x78ab('0x4')]||'';this[_0x78ab('0x5')]=_0x456f8a[_0x78ab('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index b13676d..3528175 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 _0xcdb0=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0xcdb0,0xd7));var _0x0cdb=function(_0x17d755,_0x607257){_0x17d755=_0x17d755-0x0;var _0xf0a042=_0xcdb0[_0x17d755];return _0xf0a042;};'use strict';function SugarcrmAccount(_0x2765f9){this['id']=_0x2765f9['id']||0x0;this[_0x0cdb('0x0')]=_0x2765f9['name']||'';this[_0x0cdb('0x1')]=_0x2765f9[_0x0cdb('0x1')]||'';this[_0x0cdb('0x2')]=_0x2765f9['password']||'';this[_0x0cdb('0x3')]=_0x2765f9[_0x0cdb('0x3')]||'';this[_0x0cdb('0x4')]=_0x2765f9[_0x0cdb('0x4')]||'';this[_0x0cdb('0x5')]=_0x2765f9['Configurations']||{};}module[_0x0cdb('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x70a3=['username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0x70a3,0x16e));var _0x370a=function(_0x18fb50,_0x2d4cc9){_0x18fb50=_0x18fb50-0x0;var _0x38b3bc=_0x70a3[_0x18fb50];return _0x38b3bc;};'use strict';function SugarcrmAccount(_0x5b5273){this['id']=_0x5b5273['id']||0x0;this['name']=_0x5b5273['name']||'';this[_0x370a('0x0')]=_0x5b5273['username']||'';this[_0x370a('0x1')]=_0x5b5273[_0x370a('0x1')]||'';this[_0x370a('0x2')]=_0x5b5273[_0x370a('0x2')]||'';this[_0x370a('0x3')]=_0x5b5273[_0x370a('0x3')]||'';this['Configurations']=_0x5b5273[_0x370a('0x4')]||{};}module[_0x370a('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index f58e509..984a810 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 _0x7355=['state','unknown','stateTime','exports','name','accountcode'];(function(_0x338b4c,_0x48f49e){var _0x3442f8=function(_0x2d81d4){while(--_0x2d81d4){_0x338b4c['push'](_0x338b4c['shift']());}};_0x3442f8(++_0x48f49e);}(_0x7355,0xa0));var _0x5735=function(_0x14ccdb,_0x527d09){_0x14ccdb=_0x14ccdb-0x0;var _0x22d4bf=_0x7355[_0x14ccdb];return _0x22d4bf;};'use strict';function Telephone(_0x387db3){this['id']=_0x387db3['id']||0x0;this[_0x5735('0x0')]=_0x387db3['name']||'';this[_0x5735('0x1')]=_0x387db3[_0x5735('0x1')]||'';this[_0x5735('0x2')]=_0x5735('0x3');this[_0x5735('0x4')]=0x0;this['status']=_0x5735('0x3');this['address']='';}module[_0x5735('0x5')]=Telephone; \ No newline at end of file +var _0x556d=['accountcode','state','stateTime','address','exports','name'];(function(_0x57dd9b,_0xa77869){var _0x18ce60=function(_0x4529c9){while(--_0x4529c9){_0x57dd9b['push'](_0x57dd9b['shift']());}};_0x18ce60(++_0xa77869);}(_0x556d,0x83));var _0xd556=function(_0x2880f8,_0x1ff873){_0x2880f8=_0x2880f8-0x0;var _0x53960d=_0x556d[_0x2880f8];return _0x53960d;};'use strict';function Telephone(_0x32000d){this['id']=_0x32000d['id']||0x0;this[_0xd556('0x0')]=_0x32000d[_0xd556('0x0')]||'';this['accountcode']=_0x32000d[_0xd556('0x1')]||'';this[_0xd556('0x2')]='unknown';this[_0xd556('0x3')]=0x0;this['status']='unknown';this[_0xd556('0x4')]='';}module[_0xd556('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 67f7b91..be2f3b1 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(_0x8c663d,_0x2592ee){var _0x57b37b=function(_0x4c620b){while(--_0x4c620b){_0x8c663d['push'](_0x8c663d['shift']());}};_0x57b37b(++_0x2592ee);}(_0xb10b,0x12a));var _0xbb10=function(_0x5466e0,_0x586206){_0x5466e0=_0x5466e0-0x0;var _0xf32c89=_0xb10b[_0x5466e0];return _0xf32c89;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x57396b,_0x16ce1a){var _0x11b293=function(_0x3999a6){while(--_0x3999a6){_0x57396b['push'](_0x57396b['shift']());}};_0x11b293(++_0x16ce1a);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d9295,_0x5f5bc6){_0x5d9295=_0x5d9295-0x0;var _0x4f2534=_0xb10b[_0x5d9295];return _0x4f2534;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 4b8c436..9f1736a 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 _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x4e8497,_0x1da59e){var _0xd5262f=function(_0x51a607){while(--_0x51a607){_0x4e8497['push'](_0x4e8497['shift']());}};_0xd5262f(++_0x1da59e);}(_0x757a,0xde));var _0xa757=function(_0x3bc28f,_0x486357){_0x3bc28f=_0x3bc28f-0x0;var _0x1be694=_0x757a[_0x3bc28f];return _0x1be694;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file +var _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x23eaf0,_0x347b70){var _0x353da4=function(_0x22a504){while(--_0x22a504){_0x23eaf0['push'](_0x23eaf0['shift']());}};_0x353da4(++_0x347b70);}(_0xb7e7,0x121));var _0x7b7e=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xb7e7[_0x50aa2e];return _0x5e07f0;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('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 f08d2c7..b891860 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 _0x7139=['address','defaultuser','exports','active','name','state','unknown','stateTime','registry','indexOf','split','host','port','domainport','stateRegistry','registrationtime'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7139,0x1e3));var _0x9713=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7139[_0x2641f9];return _0x585741;};'use strict';function Trunk(_0x19a35c){this['id']=_0x19a35c['id']||0x0;this[_0x9713('0x0')]=_0x19a35c[_0x9713('0x0')]||![];this['name']=_0x19a35c[_0x9713('0x1')]||'';this[_0x9713('0x2')]=_0x9713('0x3');this[_0x9713('0x4')]=0x0;this['status']=_0x9713('0x3');this[_0x9713('0x5')]=_0x19a35c['registry']&&_0x19a35c['registry'][_0x9713('0x6')](':')?_0x19a35c[_0x9713('0x5')][_0x9713('0x7')](':')[0x0]:'';this[_0x9713('0x8')]='';this[_0x9713('0x9')]='';this['domain']='';this[_0x9713('0xa')]='';this['refresh']='';this[_0x9713('0xb')]=_0x9713('0x3');this[_0x9713('0xc')]='';this[_0x9713('0xd')]='';this[_0x9713('0xe')]=_0x19a35c[_0x9713('0xe')]||'';}module[_0x9713('0xf')]=Trunk; \ No newline at end of file +var _0x34bd=['stateTime','registry','indexOf','split','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','unknown'];(function(_0x5724bf,_0x47a94a){var _0xc36b04=function(_0x102a52){while(--_0x102a52){_0x5724bf['push'](_0x5724bf['shift']());}};_0xc36b04(++_0x47a94a);}(_0x34bd,0xbd));var _0xd34b=function(_0x1ab313,_0x12bccc){_0x1ab313=_0x1ab313-0x0;var _0x2d73f4=_0x34bd[_0x1ab313];return _0x2d73f4;};'use strict';function Trunk(_0x2c6588){this['id']=_0x2c6588['id']||0x0;this[_0xd34b('0x0')]=_0x2c6588[_0xd34b('0x0')]||![];this[_0xd34b('0x1')]=_0x2c6588['name']||'';this['state']=_0xd34b('0x2');this[_0xd34b('0x3')]=0x0;this['status']='unknown';this[_0xd34b('0x4')]=_0x2c6588['registry']&&_0x2c6588[_0xd34b('0x4')][_0xd34b('0x5')](':')?_0x2c6588['registry'][_0xd34b('0x6')](':')[0x0]:'';this['host']='';this[_0xd34b('0x7')]='';this[_0xd34b('0x8')]='';this[_0xd34b('0x9')]='';this[_0xd34b('0xa')]='';this[_0xd34b('0xb')]=_0xd34b('0x2');this[_0xd34b('0xc')]='';this[_0xd34b('0xd')]='';this['defaultuser']=_0x2c6588[_0xd34b('0xe')]||'';}module[_0xd34b('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 59fd3cc..693c55c 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 _0x91f2=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x3859cf,_0x8ccd28){var _0x63f87f=function(_0x109cca){while(--_0x109cca){_0x3859cf['push'](_0x3859cf['shift']());}};_0x63f87f(++_0x8ccd28);}(_0x91f2,0x19e));var _0x291f=function(_0x771334,_0x22d048){_0x771334=_0x771334-0x0;var _0x1a14ab=_0x91f2[_0x771334];return _0x1a14ab;};'use strict';function voiceExtension(_0x4eb330){this['id']=_0x4eb330['id']||0x0;this[_0x291f('0x0')]=_0x4eb330[_0x291f('0x0')]||'';this[_0x291f('0x1')]=_0x4eb330[_0x291f('0x1')]||_0x291f('0x2');this[_0x291f('0x3')]=_0x4eb330[_0x291f('0x3')]||![];}module[_0x291f('0x4')]=voiceExtension; \ No newline at end of file +var _0xeea0=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0xb04261,_0x50e162){var _0x430e34=function(_0x28e7f5){while(--_0x28e7f5){_0xb04261['push'](_0xb04261['shift']());}};_0x430e34(++_0x50e162);}(_0xeea0,0xe8));var _0x0eea=function(_0x54731d,_0x1ba564){_0x54731d=_0x54731d-0x0;var _0x57e50d=_0xeea0[_0x54731d];return _0x57e50d;};'use strict';function voiceExtension(_0x334805){this['id']=_0x334805['id']||0x0;this['exten']=_0x334805[_0x0eea('0x0')]||'';this['recordingFormat']=_0x334805[_0x0eea('0x1')]||_0x0eea('0x2');this[_0x0eea('0x3')]=_0x334805[_0x0eea('0x3')]||![];}module[_0x0eea('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index a59129b..6126517 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 _0xfee8=['temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid','unavailable','ringinuse','onhold','wav','gsm','rrmemory','name','monitor_format','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','acw','acwTimeout','sendMessageOneNotActive','message'];(function(_0x4dcb2d,_0x52e704){var _0x5c7b7a=function(_0x41ff59){while(--_0x41ff59){_0x4dcb2d['push'](_0x4dcb2d['shift']());}};_0x5c7b7a(++_0x52e704);}(_0xfee8,0x13c));var _0x8fee=function(_0x593752,_0xfc3827){_0x593752=_0x593752-0x0;var _0x4612be=_0xfee8[_0x593752];return _0x4612be;};'use strict';var statusDesc=[_0x8fee('0x0'),_0x8fee('0x1'),'inuse',_0x8fee('0x2'),_0x8fee('0x3'),_0x8fee('0x4'),'ringing',_0x8fee('0x5'),_0x8fee('0x6')];var monitorFormat={'wav':_0x8fee('0x7'),'wav49':'wav49','gsm':_0x8fee('0x8')};var strategy={'rrmemory':_0x8fee('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x2f0c79){this['id']=_0x2f0c79['id']||0x0;this[_0x8fee('0xa')]=_0x2f0c79[_0x8fee('0xa')]||'';this[_0x8fee('0xb')]=_0x2f0c79[_0x8fee('0xb')]||'';this['type']=_0x2f0c79['type']||'inbound';this[_0x8fee('0xc')]=0x0;this[_0x8fee('0xd')]=0x0;this[_0x8fee('0xe')]=0x0;this[_0x8fee('0xf')]=0x0;this[_0x8fee('0x10')]=0x0;this[_0x8fee('0x11')]=0x0;this[_0x8fee('0x12')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this['loggedIn']=0x0;this['available']=0x0;this[_0x8fee('0x13')]=_0x2f0c79[_0x8fee('0x13')]||![];this[_0x8fee('0x14')]=_0x2f0c79['acwTimeout']||0xa;this['autopause']=_0x2f0c79['autopause']||'no';this[_0x8fee('0x15')]=!![];this[_0x8fee('0x16')]='';this['originated']=0x0;this[_0x8fee('0x17')]=0x0;this[_0x8fee('0x18')]=_0x2f0c79['dialTimezone']||null;this['dialGlobalInterval']=_0x2f0c79[_0x8fee('0x19')]?_0x2f0c79[_0x8fee('0x19')]:null;this['dialActive']=_0x2f0c79[_0x8fee('0x1a')];this[_0x8fee('0x1b')]=_0x2f0c79[_0x8fee('0x1b')]||_0x8fee('0x1c');this[_0x8fee('0x1d')]=_0x2f0c79['dialLimitChannel']||0x0;this[_0x8fee('0x1e')]=_0x2f0c79[_0x8fee('0x1e')]||0x0;this[_0x8fee('0x1f')]=_0x2f0c79[_0x8fee('0x1f')]||0x1;this[_0x8fee('0x20')]=_0x2f0c79[_0x8fee('0x20')]||_0x8fee('0x21');this[_0x8fee('0x22')]=_0x2f0c79['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x2f0c79[_0x8fee('0x23')]||0x258;this[_0x8fee('0x24')]=_0x2f0c79[_0x8fee('0x24')]||_0x8fee('0x25');this[_0x8fee('0x26')]=_0x2f0c79[_0x8fee('0x26')]||_0x8fee('0x25');this[_0x8fee('0x27')]=_0x2f0c79[_0x8fee('0x27')]||0x1e;this['dialQueueOptions']=_0x2f0c79[_0x8fee('0x28')]||'tTxX';this['dialQueueTimeout']=_0x2f0c79['dialQueueTimeout']||0x3;this[_0x8fee('0x29')]=_0x2f0c79[_0x8fee('0x29')]||undefined;this[_0x8fee('0x2a')]=_0x2f0c79[_0x8fee('0x2a')]||0x3;this['dialCongestionRetryFrequency']=_0x2f0c79[_0x8fee('0x2b')]||0x96;this[_0x8fee('0x2c')]=_0x2f0c79[_0x8fee('0x2c')]||0x3;this[_0x8fee('0x2d')]=_0x2f0c79[_0x8fee('0x2d')]||0x96;this[_0x8fee('0x2e')]=_0x2f0c79[_0x8fee('0x2e')]||0x3;this[_0x8fee('0x2f')]=_0x2f0c79[_0x8fee('0x2f')]||0x96;this[_0x8fee('0x30')]=_0x2f0c79[_0x8fee('0x30')]||0x3;this[_0x8fee('0x31')]=_0x2f0c79[_0x8fee('0x31')]||0x96;this[_0x8fee('0x32')]=_0x2f0c79[_0x8fee('0x32')]||0x3;this[_0x8fee('0x33')]=_0x2f0c79['dialDropRetryFrequency']||0x96;this[_0x8fee('0x34')]=_0x2f0c79[_0x8fee('0x34')]||0x3;this['dialAbandonedRetryFrequency']=_0x2f0c79['dialAbandonedRetryFrequency']||0x96;this[_0x8fee('0x35')]=_0x2f0c79[_0x8fee('0x35')]||0x3;this['dialMachineRetryFrequency']=_0x2f0c79[_0x8fee('0x36')]||0x96;this[_0x8fee('0x37')]=_0x2f0c79['dialAgentRejectMaxRetry']||0x3;this[_0x8fee('0x38')]=_0x2f0c79['dialAgentRejectRetryFrequency']||0x96;this[_0x8fee('0x39')]=_0x2f0c79[_0x8fee('0x39')]||0x4;this[_0x8fee('0x3a')]=_0x2f0c79['Trunk']?_0x2f0c79[_0x8fee('0x3a')]:undefined;this['TrunkBackup']=_0x2f0c79[_0x8fee('0x3b')]?_0x2f0c79['TrunkBackup']:undefined;this[_0x8fee('0x3c')]=_0x2f0c79[_0x8fee('0x3c')]||undefined;this['Interval']=_0x2f0c79[_0x8fee('0x3d')]?_0x2f0c79[_0x8fee('0x3d')]:undefined;this[_0x8fee('0x3e')]=_0x2f0c79[_0x8fee('0x3e')]||_0x8fee('0x3f');this[_0x8fee('0x40')]=_0x2f0c79[_0x8fee('0x40')]||undefined;this[_0x8fee('0x41')]=_0x2f0c79[_0x8fee('0x41')]||undefined;this[_0x8fee('0x42')]=strategy[_0x2f0c79[_0x8fee('0x42')]]||'rrmemory';this[_0x8fee('0x43')]=!![];this['dialAMDActive']=_0x2f0c79[_0x8fee('0x44')]||![];this[_0x8fee('0x45')]=_0x2f0c79[_0x8fee('0x45')];this['dialAMDGreeting']=_0x2f0c79['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x2f0c79['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x2f0c79[_0x8fee('0x46')];this[_0x8fee('0x47')]=_0x2f0c79[_0x8fee('0x47')];this[_0x8fee('0x48')]=_0x2f0c79['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x2f0c79[_0x8fee('0x49')];this[_0x8fee('0x4a')]=_0x2f0c79[_0x8fee('0x4a')];this['dialAMDMaximumWordLength']=_0x2f0c79['dialAMDMaximumWordLength'];this[_0x8fee('0x4b')]=0x0;this[_0x8fee('0x4c')]=0x0;this[_0x8fee('0x4d')]=_0x2f0c79[_0x8fee('0x4d')];this[_0x8fee('0x4e')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x8fee('0x4f')]=0x0;this[_0x8fee('0x50')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x8fee('0x51')]=0x0;this[_0x8fee('0x52')]=0x0;this[_0x8fee('0x53')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x8fee('0x54')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x8fee('0x55')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x8fee('0x56')]=undefined;this[_0x8fee('0x57')]=undefined;this[_0x8fee('0x58')]=undefined;this[_0x8fee('0x59')]=1.05;this[_0x8fee('0x5a')]=0x0;this[_0x8fee('0x5b')]=0x0;this[_0x8fee('0x5c')]=0x0;this[_0x8fee('0x5d')]=0x0;this[_0x8fee('0x5e')]=0x0;this[_0x8fee('0x5f')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x8fee('0x60')]=0x0;this[_0x8fee('0x61')]=_0x2f0c79['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x8fee('0x62')]=_0x2f0c79['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x8fee('0x63')]=0x0;this[_0x8fee('0x64')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x8fee('0x65')]=0x0;this[_0x8fee('0x66')]=0x0;this[_0x8fee('0x67')]=0x0;this['erlangBusyFactor']=0x0;this[_0x8fee('0x68')]=_0x2f0c79[_0x8fee('0x68')]||0x1e;this[_0x8fee('0x69')]=_0x2f0c79['dialRecallInQueue']||![];this[_0x8fee('0x6a')]=!!_0x2f0c79[_0x8fee('0x6a')]||![];this[_0x8fee('0x6b')]=!!_0x2f0c79[_0x8fee('0x6b')]||![];this[_0x8fee('0x6c')]=_0x2f0c79['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x2f0c79['dialAgiAfterHangupClient']||![];this[_0x8fee('0x6d')]=_0x2f0c79['dialAgiAfterHangupAgent']||![];this[_0x8fee('0xb')]=monitorFormat[_0x2f0c79[_0x8fee('0xb')]]?monitorFormat[_0x2f0c79[_0x8fee('0xb')]]:undefined;this[_0x8fee('0x6e')]=_0x2f0c79['mandatoryDisposition']||![];this[_0x8fee('0x6f')]=_0x2f0c79[_0x8fee('0x6f')]?_0x2f0c79[_0x8fee('0x6f')]:undefined;}module[_0x8fee('0x70')]=VoiceQueue; \ No newline at end of file +var _0x32c0=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','monitor_format','type','waiting','talking','total','answered','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls'];(function(_0x1c289a,_0x277fe7){var _0x28d68e=function(_0x2f8e98){while(--_0x2f8e98){_0x1c289a['push'](_0x1c289a['shift']());}};_0x28d68e(++_0x277fe7);}(_0x32c0,0x16c));var _0x032c=function(_0x351074,_0x29d945){_0x351074=_0x351074-0x0;var _0x4deb47=_0x32c0[_0x351074];return _0x4deb47;};'use strict';var statusDesc=['unknown',_0x032c('0x0'),_0x032c('0x1'),_0x032c('0x2'),_0x032c('0x3'),_0x032c('0x4'),_0x032c('0x5'),_0x032c('0x6'),_0x032c('0x7')];var monitorFormat={'wav':_0x032c('0x8'),'wav49':_0x032c('0x9'),'gsm':_0x032c('0xa')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x43b3ca){this['id']=_0x43b3ca['id']||0x0;this['name']=_0x43b3ca['name']||'';this[_0x032c('0xb')]=_0x43b3ca[_0x032c('0xb')]||'';this['type']=_0x43b3ca[_0x032c('0xc')]||'inbound';this[_0x032c('0xd')]=0x0;this[_0x032c('0xe')]=0x0;this[_0x032c('0xf')]=0x0;this[_0x032c('0x10')]=0x0;this[_0x032c('0x11')]=0x0;this['sumHoldTime']=0x0;this[_0x032c('0x12')]=0x0;this[_0x032c('0x13')]=0x0;this[_0x032c('0x14')]=0x0;this[_0x032c('0x15')]=0x0;this[_0x032c('0x16')]=0x0;this[_0x032c('0x17')]=_0x43b3ca[_0x032c('0x17')]||![];this[_0x032c('0x18')]=_0x43b3ca['acwTimeout']||0xa;this[_0x032c('0x19')]=_0x43b3ca[_0x032c('0x19')]||'no';this[_0x032c('0x1a')]=!![];this[_0x032c('0x1b')]='';this[_0x032c('0x1c')]=0x0;this[_0x032c('0x1d')]=0x0;this[_0x032c('0x1e')]=_0x43b3ca[_0x032c('0x1e')]||null;this[_0x032c('0x1f')]=_0x43b3ca[_0x032c('0x1f')]?_0x43b3ca[_0x032c('0x1f')]:null;this[_0x032c('0x20')]=_0x43b3ca['dialActive'];this['dialMethod']=_0x43b3ca['dialMethod']||_0x032c('0x21');this[_0x032c('0x22')]=_0x43b3ca['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x43b3ca['dialLimitQueue']||0x0;this[_0x032c('0x23')]=_0x43b3ca[_0x032c('0x23')]||0x1;this[_0x032c('0x24')]=_0x43b3ca[_0x032c('0x24')]||_0x032c('0x25');this[_0x032c('0x26')]=_0x43b3ca[_0x032c('0x26')]||0.03;this[_0x032c('0x27')]=_0x43b3ca[_0x032c('0x27')]||0x258;this[_0x032c('0x28')]=_0x43b3ca[_0x032c('0x28')]||_0x032c('0x29');this[_0x032c('0x2a')]=_0x43b3ca['dialOriginateCallerIdNumber']||_0x032c('0x29');this[_0x032c('0x2b')]=_0x43b3ca['dialOriginateTimeout']||0x1e;this[_0x032c('0x2c')]=_0x43b3ca[_0x032c('0x2c')]||_0x032c('0x2d');this[_0x032c('0x2e')]=_0x43b3ca[_0x032c('0x2e')]||0x3;this[_0x032c('0x2f')]=_0x43b3ca['dialQueueProject']||undefined;this[_0x032c('0x30')]=_0x43b3ca[_0x032c('0x30')]||0x3;this[_0x032c('0x31')]=_0x43b3ca['dialCongestionRetryFrequency']||0x96;this[_0x032c('0x32')]=_0x43b3ca['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x43b3ca[_0x032c('0x33')]||0x96;this['dialNoAnswerMaxRetry']=_0x43b3ca['dialNoAnswerMaxRetry']||0x3;this[_0x032c('0x34')]=_0x43b3ca[_0x032c('0x34')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x43b3ca[_0x032c('0x35')]||0x3;this[_0x032c('0x36')]=_0x43b3ca[_0x032c('0x36')]||0x96;this[_0x032c('0x37')]=_0x43b3ca['dialDropMaxRetry']||0x3;this[_0x032c('0x38')]=_0x43b3ca[_0x032c('0x38')]||0x96;this[_0x032c('0x39')]=_0x43b3ca[_0x032c('0x39')]||0x3;this[_0x032c('0x3a')]=_0x43b3ca[_0x032c('0x3a')]||0x96;this[_0x032c('0x3b')]=_0x43b3ca[_0x032c('0x3b')]||0x3;this[_0x032c('0x3c')]=_0x43b3ca[_0x032c('0x3c')]||0x96;this['dialAgentRejectMaxRetry']=_0x43b3ca['dialAgentRejectMaxRetry']||0x3;this[_0x032c('0x3d')]=_0x43b3ca[_0x032c('0x3d')]||0x96;this[_0x032c('0x3e')]=_0x43b3ca[_0x032c('0x3e')]||0x4;this[_0x032c('0x3f')]=_0x43b3ca['Trunk']?_0x43b3ca['Trunk']:undefined;this[_0x032c('0x40')]=_0x43b3ca[_0x032c('0x40')]?_0x43b3ca[_0x032c('0x40')]:undefined;this['dialPrefix']=_0x43b3ca['dialPrefix']||undefined;this[_0x032c('0x41')]=_0x43b3ca[_0x032c('0x41')]?_0x43b3ca[_0x032c('0x41')]:undefined;this[_0x032c('0x42')]=_0x43b3ca['dialOrderByScheduledAt']||_0x032c('0x43');this[_0x032c('0x44')]=_0x43b3ca[_0x032c('0x44')]||undefined;this[_0x032c('0x45')]=_0x43b3ca['dialCutDigit']||undefined;this[_0x032c('0x46')]=strategy[_0x43b3ca[_0x032c('0x46')]]||_0x032c('0x47');this[_0x032c('0x48')]=!![];this[_0x032c('0x49')]=_0x43b3ca[_0x032c('0x49')]||![];this['dialAMDInitialSilence']=_0x43b3ca[_0x032c('0x4a')];this['dialAMDGreeting']=_0x43b3ca['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x43b3ca['dialAMDAfterGreetingSilence'];this[_0x032c('0x4b')]=_0x43b3ca[_0x032c('0x4b')];this[_0x032c('0x4c')]=_0x43b3ca[_0x032c('0x4c')];this[_0x032c('0x4d')]=_0x43b3ca[_0x032c('0x4d')];this[_0x032c('0x4e')]=_0x43b3ca['dialAMDMaximumNumberOfWords'];this[_0x032c('0x4f')]=_0x43b3ca[_0x032c('0x4f')];this[_0x032c('0x50')]=_0x43b3ca[_0x032c('0x50')];this[_0x032c('0x51')]=0x0;this['pTalking']=0x0;this[_0x032c('0x52')]=_0x43b3ca[_0x032c('0x52')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x032c('0x53')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x032c('0x54')]=0x0;this[_0x032c('0x55')]=0x0;this[_0x032c('0x56')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x032c('0x57')]=0x0;this[_0x032c('0x58')]=0x0;this[_0x032c('0x59')]=0x0;this[_0x032c('0x5a')]=0x0;this[_0x032c('0x5b')]=0x0;this[_0x032c('0x5c')]=undefined;this['startPredictive']=undefined;this[_0x032c('0x5d')]=undefined;this[_0x032c('0x5e')]=1.05;this[_0x032c('0x5f')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x032c('0x60')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x032c('0x61')]=0x0;this[_0x032c('0x62')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x032c('0x63')]=0x0;this['predictiveIntervalMaxThreshold']=_0x43b3ca[_0x032c('0x64')]||0x14;this[_0x032c('0x65')]=_0x43b3ca['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x032c('0x66')]=0x1;this[_0x032c('0x67')]=0x0;this[_0x032c('0x68')]=0x0;this[_0x032c('0x69')]=0x0;this['erlangBusyFactor']=0x0;this[_0x032c('0x6a')]=_0x43b3ca[_0x032c('0x6a')]||0x1e;this[_0x032c('0x6b')]=_0x43b3ca[_0x032c('0x6b')]||![];this['dialPreviewAutoRecallMe']=!!_0x43b3ca['dialPreviewAutoRecallMe']||![];this[_0x032c('0x6c')]=!!_0x43b3ca[_0x032c('0x6c')]||![];this[_0x032c('0x6d')]=_0x43b3ca[_0x032c('0x6d')]||undefined;this[_0x032c('0x6e')]=_0x43b3ca[_0x032c('0x6e')]||![];this[_0x032c('0x6f')]=_0x43b3ca[_0x032c('0x6f')]||![];this[_0x032c('0xb')]=monitorFormat[_0x43b3ca[_0x032c('0xb')]]?monitorFormat[_0x43b3ca[_0x032c('0xb')]]:undefined;this[_0x032c('0x70')]=_0x43b3ca[_0x032c('0x70')]||![];this['mandatoryDispositionPause']=_0x43b3ca[_0x032c('0x71')]?_0x43b3ca[_0x032c('0x71')]:undefined;}module[_0x032c('0x72')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 5cc2dc9..de66999 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 _0xa7a8=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x5e782e,_0x3c9779){var _0x40081d=function(_0x59460f){while(--_0x59460f){_0x5e782e['push'](_0x5e782e['shift']());}};_0x40081d(++_0x3c9779);}(_0xa7a8,0x183));var _0x8a7a=function(_0x43e740,_0xb29e3d){_0x43e740=_0x43e740-0x0;var _0x213327=_0xa7a8[_0x43e740];return _0x213327;};'use strict';function VtigerAccount(_0xabf9c8){this['id']=_0xabf9c8['id']||0x0;this['name']=_0xabf9c8[_0x8a7a('0x0')]||'';this['username']=_0xabf9c8[_0x8a7a('0x1')]||'';this[_0x8a7a('0x2')]=_0xabf9c8[_0x8a7a('0x2')]||'';this[_0x8a7a('0x3')]=_0xabf9c8[_0x8a7a('0x3')]||'';this[_0x8a7a('0x4')]=_0xabf9c8['serverUrl']||'';this[_0x8a7a('0x5')]=_0xabf9c8[_0x8a7a('0x5')]||{};}module[_0x8a7a('0x6')]=VtigerAccount; \ No newline at end of file +var _0x3764=['serverUrl','Configurations','name','accessKey','remoteUri'];(function(_0x533528,_0x409d05){var _0x3189f1=function(_0x5e63d2){while(--_0x5e63d2){_0x533528['push'](_0x533528['shift']());}};_0x3189f1(++_0x409d05);}(_0x3764,0x124));var _0x4376=function(_0x55a863,_0x5f0459){_0x55a863=_0x55a863-0x0;var _0x47edb0=_0x3764[_0x55a863];return _0x47edb0;};'use strict';function VtigerAccount(_0x536a5c){this['id']=_0x536a5c['id']||0x0;this[_0x4376('0x0')]=_0x536a5c[_0x4376('0x0')]||'';this['username']=_0x536a5c['username']||'';this[_0x4376('0x1')]=_0x536a5c[_0x4376('0x1')]||'';this[_0x4376('0x2')]=_0x536a5c[_0x4376('0x2')]||'';this[_0x4376('0x3')]=_0x536a5c[_0x4376('0x3')]||'';this['Configurations']=_0x536a5c[_0x4376('0x4')]||{};}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 7f0c6b2..c7e8f34 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 _0xb987=['password','token','remoteUri','type','integrationTab','serverUrl','Configurations','exports','username'];(function(_0x48cb09,_0x4b22e0){var _0x176771=function(_0x114f7c){while(--_0x114f7c){_0x48cb09['push'](_0x48cb09['shift']());}};_0x176771(++_0x4b22e0);}(_0xb987,0x19d));var _0x7b98=function(_0x86ba47,_0x41c11f){_0x86ba47=_0x86ba47-0x0;var _0x549dff=_0xb987[_0x86ba47];return _0x549dff;};'use strict';function ZendeskAccount(_0x54e059){this['id']=_0x54e059['id']||0x0;this['name']=_0x54e059['name']||'';this[_0x7b98('0x0')]=_0x54e059['username']||'';this[_0x7b98('0x1')]=_0x54e059[_0x7b98('0x1')]||'';this[_0x7b98('0x2')]=_0x54e059[_0x7b98('0x2')]||'';this[_0x7b98('0x3')]=_0x54e059[_0x7b98('0x3')]||'';this['authType']=_0x54e059['authType']||'';this['type']=_0x54e059[_0x7b98('0x4')]||_0x7b98('0x5');this[_0x7b98('0x6')]=_0x54e059[_0x7b98('0x6')]||'';this['Configurations']=_0x54e059[_0x7b98('0x7')]||{};}module[_0x7b98('0x8')]=ZendeskAccount; \ No newline at end of file +var _0xaff6=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0xaff6,0x15f));var _0x6aff=function(_0x163157,_0x59eea5){_0x163157=_0x163157-0x0;var _0x3db535=_0xaff6[_0x163157];return _0x3db535;};'use strict';function ZendeskAccount(_0x232498){this['id']=_0x232498['id']||0x0;this[_0x6aff('0x0')]=_0x232498['name']||'';this[_0x6aff('0x1')]=_0x232498[_0x6aff('0x1')]||'';this['password']=_0x232498[_0x6aff('0x2')]||'';this['token']=_0x232498[_0x6aff('0x3')]||'';this[_0x6aff('0x4')]=_0x232498['remoteUri']||'';this['authType']=_0x232498[_0x6aff('0x5')]||'';this[_0x6aff('0x6')]=_0x232498['type']||_0x6aff('0x7');this[_0x6aff('0x8')]=_0x232498[_0x6aff('0x8')]||'';this[_0x6aff('0x9')]=_0x232498[_0x6aff('0x9')]||{};}module[_0x6aff('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 97a3e20..d1fe2c7 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 _0x16c3=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientSecret'];(function(_0x9c48a3,_0xca37f3){var _0x4b161=function(_0xf25324){while(--_0xf25324){_0x9c48a3['push'](_0x9c48a3['shift']());}};_0x4b161(++_0xca37f3);}(_0x16c3,0xd7));var _0x316c=function(_0x4901af,_0x40d214){_0x4901af=_0x4901af-0x0;var _0x1f224c=_0x16c3[_0x4901af];return _0x1f224c;};'use strict';function ZohoAccount(_0x367010){this['id']=_0x367010['id']||0x0;this[_0x316c('0x0')]=_0x367010['name']||'';this['description']=_0x367010[_0x316c('0x1')]||'';this[_0x316c('0x2')]=_0x367010[_0x316c('0x2')]||'';this[_0x316c('0x3')]=_0x367010[_0x316c('0x3')]||'';this['clientId']=_0x367010['clientId']||'';this[_0x316c('0x4')]=_0x367010[_0x316c('0x4')]||'';this[_0x316c('0x5')]=_0x367010['serverUrl']||'';this[_0x316c('0x6')]=_0x367010['code']||'';this['refreshToken']=_0x367010[_0x316c('0x7')]||'';this[_0x316c('0x8')]=_0x367010[_0x316c('0x8')]||{};}module[_0x316c('0x9')]=ZohoAccount; \ No newline at end of file +var _0x935c=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','exports','name'];(function(_0x292e87,_0x9b2eb5){var _0x5186f6=function(_0x2eb5b6){while(--_0x2eb5b6){_0x292e87['push'](_0x292e87['shift']());}};_0x5186f6(++_0x9b2eb5);}(_0x935c,0x1ad));var _0xc935=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x935c[_0x21a9d9];return _0x46adce;};'use strict';function ZohoAccount(_0xe69165){this['id']=_0xe69165['id']||0x0;this[_0xc935('0x0')]=_0xe69165[_0xc935('0x0')]||'';this['description']=_0xe69165[_0xc935('0x1')]||'';this[_0xc935('0x2')]=_0xe69165['host']||'';this[_0xc935('0x3')]=_0xe69165[_0xc935('0x3')]||'';this[_0xc935('0x4')]=_0xe69165['clientId']||'';this[_0xc935('0x5')]=_0xe69165[_0xc935('0x5')]||'';this[_0xc935('0x6')]=_0xe69165[_0xc935('0x6')]||'';this['code']=_0xe69165[_0xc935('0x7')]||'';this[_0xc935('0x8')]=_0xe69165[_0xc935('0x8')]||'';this['Configurations']=_0xe69165['Configurations']||{};}module[_0xc935('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 2598c35..505ed49 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 _0x401c=['Agent','channelAgent','format','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','calleridname','number','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername'];(function(_0xc7e246,_0x5619d4){var _0x8a3c24=function(_0x151df1){while(--_0x151df1){_0xc7e246['push'](_0xc7e246['shift']());}};_0x8a3c24(++_0x5619d4);}(_0x401c,0x153));var _0xc401=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0x401c[_0x2e50a2];return _0x47e5de;};'use strict';var util=require(_0xc401('0x0'));var _=require(_0xc401('0x1'));var moment=require(_0xc401('0x2'));function checkNameSurname(_0x531b03,_0x40993f,_0x27b069){var _0x4abaa7='';if(!_[_0xc401('0x3')](_0x40993f)&&'string'===typeof _0x40993f){_0x4abaa7+=_0x40993f;}if(!_[_0xc401('0x3')](_0x27b069)&&_0xc401('0x4')===typeof _0x27b069){_0x4abaa7+='\x20'+_0x27b069;}if(_0x4abaa7!==''){return _0x4abaa7;}return _0x531b03;}function Action(_0x2a05c4,_0x3370e8,_0x42e576,_0xe89687,_0x3ce718){this[_0xc401('0x5')]=_0x42e576||undefined;this[_0xc401('0x6')]=_0x2a05c4['id'];this[_0xc401('0x7')]=_0x3370e8[_0xc401('0x8')];this['type']=_0x3370e8[_0xc401('0x9')];this[_0xc401('0xa')]=_0xc401('0x7');this[_0xc401('0xb')]=![];this[_0xc401('0xc')]=_[_0xc401('0x3')](_0x2a05c4[_0xc401('0xd')])?undefined:_0x2a05c4['Agent'][_0xc401('0x8')];this[_0xc401('0xe')]=this[_0xc401('0xc')]?util[_0xc401('0xf')]('SIP/%s',this[_0xc401('0xc')]):_0xe89687||undefined;this['calleridname']=checkNameSurname(_0x2a05c4[_0xc401('0x10')][_0xc401('0x11')],_0x2a05c4[_0xc401('0x10')][_0xc401('0x12')],_0x2a05c4[_0xc401('0x10')]['lastName']);this[_0xc401('0x13')]=_0x2a05c4['active']||![];this[_0xc401('0x14')]=_0x2a05c4[_0xc401('0x10')][_0xc401('0x11')];this[_0xc401('0x15')]=_0x2a05c4[_0xc401('0x15')];this['countbusyretry']=_0x2a05c4[_0xc401('0x16')]||0x0;this[_0xc401('0x17')]=_0x2a05c4[_0xc401('0x17')]||0x0;this[_0xc401('0x18')]=_0x2a05c4[_0xc401('0x18')]||0x0;this[_0xc401('0x19')]=(_0x2a05c4[_0xc401('0x16')]||0x0)+(_0x2a05c4[_0xc401('0x17')]||0x0)+(_0x2a05c4[_0xc401('0x18')]||0x0)+(_0x2a05c4[_0xc401('0x1a')]||0x0)+(_0x2a05c4[_0xc401('0x1b')]||0x0)+(_0x2a05c4[_0xc401('0x1c')]||0x0)+(_0x2a05c4[_0xc401('0x1d')]||0x0)+(_0x2a05c4['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x2a05c4[_0xc401('0x1a')]||0x0;this['countdropretry']=_0x2a05c4['countdropretry']||0x0;this[_0xc401('0x1c')]=_0x2a05c4[_0xc401('0x1c')]||0x0;this[_0xc401('0x1d')]=_0x2a05c4[_0xc401('0x1d')]||0x0;this[_0xc401('0x1e')]=_0x2a05c4['countagentrejectretry']||0x0;this[_0xc401('0x1f')]=_0x2a05c4[_0xc401('0x1f')];this[_0xc401('0x20')]=_0x2a05c4[_0xc401('0x20')];this['callbackat']=_0x2a05c4[_0xc401('0x21')];this[_0xc401('0x22')]=_0x2a05c4[_0xc401('0x22')];this[_0xc401('0x23')]=_0x2a05c4[_0xc401('0x23')];this[_0xc401('0x24')]=_0x2a05c4['ListId'];this[_0xc401('0x25')]=_[_0xc401('0x3')](_0x2a05c4[_0xc401('0xd')])?_0x2a05c4[_0xc401('0x25')]:_0x2a05c4['Agent']['id'];this[_0xc401('0x26')]=_0x2a05c4[_0xc401('0x26')];this[_0xc401('0x27')]='';this['originatecalleridname']='';}Action[_0xc401('0x28')]['getCaller']=function(){return util['format'](_0xc401('0x29'),this[_0xc401('0x2a')],this[_0xc401('0x2b')]);};module['exports']=Action; \ No newline at end of file +var _0x6a53=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','isNil','string','uniqueid','type','campaigntype','queue','dialAnswer','membername','Agent','name','SIP/%s','Contact','firstName','lastName','active','phone','scheduledat','countbusyretry'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x6a53,0xdc));var _0x36a5=function(_0x53c2b9,_0x1dbc82){_0x53c2b9=_0x53c2b9-0x0;var _0x2c677b=_0x6a53[_0x53c2b9];return _0x2c677b;};'use strict';var util=require(_0x36a5('0x0'));var _=require(_0x36a5('0x1'));var moment=require('moment');function checkNameSurname(_0x14c8ed,_0x4cb36a,_0x361fdb){var _0x1a7bff='';if(!_[_0x36a5('0x2')](_0x4cb36a)&&_0x36a5('0x3')===typeof _0x4cb36a){_0x1a7bff+=_0x4cb36a;}if(!_['isNil'](_0x361fdb)&&_0x36a5('0x3')===typeof _0x361fdb){_0x1a7bff+='\x20'+_0x361fdb;}if(_0x1a7bff!==''){return _0x1a7bff;}return _0x14c8ed;}function Action(_0x1c108d,_0x485fa0,_0x3923de,_0x2e2808,_0x29c6d7){this[_0x36a5('0x4')]=_0x3923de||undefined;this['idContact']=_0x1c108d['id'];this['queue']=_0x485fa0['name'];this['type']=_0x485fa0[_0x36a5('0x5')];this[_0x36a5('0x6')]=_0x36a5('0x7');this[_0x36a5('0x8')]=![];this[_0x36a5('0x9')]=_['isNil'](_0x1c108d[_0x36a5('0xa')])?undefined:_0x1c108d[_0x36a5('0xa')][_0x36a5('0xb')];this['channelAgent']=this['membername']?util['format'](_0x36a5('0xc'),this[_0x36a5('0x9')]):_0x2e2808||undefined;this['calleridname']=checkNameSurname(_0x1c108d['Contact']['phone'],_0x1c108d[_0x36a5('0xd')][_0x36a5('0xe')],_0x1c108d['Contact'][_0x36a5('0xf')]);this[_0x36a5('0x10')]=_0x1c108d[_0x36a5('0x10')]||![];this['calleridnum']=_0x1c108d['Contact'][_0x36a5('0x11')];this['scheduledat']=_0x1c108d[_0x36a5('0x12')];this[_0x36a5('0x13')]=_0x1c108d['countbusyretry']||0x0;this[_0x36a5('0x14')]=_0x1c108d[_0x36a5('0x14')]||0x0;this['countnoanswerretry']=_0x1c108d[_0x36a5('0x15')]||0x0;this['countglobal']=(_0x1c108d['countbusyretry']||0x0)+(_0x1c108d[_0x36a5('0x14')]||0x0)+(_0x1c108d[_0x36a5('0x15')]||0x0)+(_0x1c108d[_0x36a5('0x16')]||0x0)+(_0x1c108d[_0x36a5('0x17')]||0x0)+(_0x1c108d['countabandonedretry']||0x0)+(_0x1c108d[_0x36a5('0x18')]||0x0)+(_0x1c108d[_0x36a5('0x19')]||0x0);this['countnosuchnumberretry']=_0x1c108d[_0x36a5('0x16')]||0x0;this[_0x36a5('0x17')]=_0x1c108d[_0x36a5('0x17')]||0x0;this[_0x36a5('0x1a')]=_0x1c108d['countabandonedretry']||0x0;this['countmachineretry']=_0x1c108d[_0x36a5('0x18')]||0x0;this[_0x36a5('0x19')]=_0x1c108d[_0x36a5('0x19')]||0x0;this['callback']=_0x1c108d[_0x36a5('0x1b')];this['callbackuniqueid']=_0x1c108d[_0x36a5('0x1c')];this[_0x36a5('0x1d')]=_0x1c108d['callbackat'];this[_0x36a5('0x1e')]=_0x1c108d[_0x36a5('0x1e')];this[_0x36a5('0x1f')]=_0x1c108d[_0x36a5('0x1f')];this[_0x36a5('0x20')]=_0x1c108d[_0x36a5('0x20')];this[_0x36a5('0x21')]=_[_0x36a5('0x2')](_0x1c108d[_0x36a5('0xa')])?_0x1c108d[_0x36a5('0x21')]:_0x1c108d[_0x36a5('0xa')]['id'];this[_0x36a5('0x22')]=_0x1c108d[_0x36a5('0x22')];this[_0x36a5('0x23')]='';this[_0x36a5('0x24')]='';}Action['prototype'][_0x36a5('0x25')]=function(){return util['format'](_0x36a5('0x26'),this['calleridname'],this['number']);};module[_0x36a5('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 9b1492d..e24b0ad 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 _0xb138=['dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','activeContact','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','createAgentHistory','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','Contact','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','checkInBlack','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','substring','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridnum','addVariables','merge','toLowerVariables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','response','unlockContact','idContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','addVariable','variables','filterKey','keys','variable','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','preview','../ami','./rpcDb','./util/util','redis','defaults','localhost','socket.io-emitter','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','strategy','answered','available','loggedIn','sumBillable','sumDuration','talking','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','format','voice:queue:%s','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','emit','voice_queue_presence:remove','pTalking','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','prototype','syncCampaigns','hasOwnProperty','booked','setMessage','recallMe','clearZombieChannel','isNil','actions','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','originated','pTalking:\x20','stringify','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','sendMessageOneNotActive','IsNotLoggedIn','isActive','dialActive','isTrunkReachable','ACTIVE','countnosuchnumberretry','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','decrementTalkink','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]'];(function(_0x8b63e6,_0x24e75f){var _0x6f92c5=function(_0x1a7698){while(--_0x1a7698){_0x8b63e6['push'](_0x8b63e6['shift']());}};_0x6f92c5(++_0x24e75f);}(_0xb138,0x1dd));var _0x8b13=function(_0x20f020,_0xe32256){_0x20f020=_0x20f020-0x0;var _0x2307ed=_0xb138[_0x20f020];return _0x2307ed;};'use strict';var util=require(_0x8b13('0x0'));var _=require(_0x8b13('0x1'));var BPromise=require(_0x8b13('0x2'));var uuid=require(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var md5=require(_0x8b13('0x5'));var Redis=require(_0x8b13('0x6'));var config=require('../../../config/environment');var logger=require(_0x8b13('0x7'))(_0x8b13('0x8'));var loggerAction=require(_0x8b13('0x7'))('actionPreview');var ami=require(_0x8b13('0x9'));var rpcDb=require(_0x8b13('0xa'));var Action=require('./action');var ut=require(_0x8b13('0xb'));config[_0x8b13('0xc')]=_[_0x8b13('0xd')](config['redis'],{'host':_0x8b13('0xe'),'port':0x18eb});var io=require(_0x8b13('0xf'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0x8b13('0x10')]=function(_0x21fcd9){this[_0x8b13('0x11')]=this[_0x8b13('0x11')]?this[_0x8b13('0x11')]['finally'](_0x21fcd9):_0x21fcd9();};function Preview(_0x11bc89){this[_0x8b13('0x12')]=new Sequence();this[_0x8b13('0x13')]=_0x11bc89[_0x8b13('0x14')];this[_0x8b13('0x15')]=_0x11bc89[_0x8b13('0x15')];this['actions']={};this['agents']=_0x11bc89[_0x8b13('0x16')];this[_0x8b13('0x17')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));ami['on'](_0x8b13('0x18'),this[_0x8b13('0x19')][_0x8b13('0x1a')](this));ami['on'](_0x8b13('0x1b'),this[_0x8b13('0x1c')]['bind'](this));ami['on'](_0x8b13('0x1d'),this[_0x8b13('0x1e')][_0x8b13('0x1a')](this));ami['on'](_0x8b13('0x1f'),this[_0x8b13('0x20')][_0x8b13('0x1a')](this));ami['on'](_0x8b13('0x21'),this[_0x8b13('0x22')]['bind'](this));ami['on']('attendedtransfer',this[_0x8b13('0x23')][_0x8b13('0x1a')](this));ami['on'](_0x8b13('0x24'),this[_0x8b13('0x25')][_0x8b13('0x1a')](this));this[_0x8b13('0x26')](this['campaignsPreview']);}function emit(_0x1e8a48,_0x3c4d4f,_0x1595d8){io['to'](_0x1e8a48)['emit'](_0x3c4d4f,_0x1595d8);}function emitCampaignPreview(_0x51dd1d){if(_0x51dd1d[_0x8b13('0x27')]===_0x8b13('0x28')){var _0x4f9902={'id':_0x51dd1d['id'],'name':_0x51dd1d[_0x8b13('0x29')],'strategy':_0x51dd1d[_0x8b13('0x2a')],'answered':_0x51dd1d[_0x8b13('0x2b')],'available':_0x51dd1d[_0x8b13('0x2c')],'loggedIn':_0x51dd1d[_0x8b13('0x2d')],'pTalking':_0x51dd1d['pTalking'],'sumBillable':_0x51dd1d[_0x8b13('0x2e')],'sumDuration':_0x51dd1d[_0x8b13('0x2f')],'sumHoldTime':_0x51dd1d['sumHoldTime']||0x0,'talking':_0x51dd1d[_0x8b13('0x30')],'total':_0x51dd1d['total'],'type':_0x51dd1d[_0x8b13('0x27')],'unmanaged':_0x51dd1d[_0x8b13('0x31')],'abandoned':_0x51dd1d['abandoned'],'waiting':_0x51dd1d[_0x8b13('0x32')],'loggedInDb':_0x51dd1d[_0x8b13('0x33')],'dialActive':_0x51dd1d['dialActive'],'dialMethod':_0x51dd1d[_0x8b13('0x34')],'dialOriginateCallerIdName':_0x51dd1d[_0x8b13('0x35')],'dialOriginateCallerIdNumber':_0x51dd1d[_0x8b13('0x36')],'dialOriginateTimeout':_0x51dd1d[_0x8b13('0x37')],'dialPrefix':_0x51dd1d[_0x8b13('0x38')],'outboundAnswerAgiCallsDay':_0x51dd1d['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x51dd1d[_0x8b13('0x39')],'outboundBlacklistCallsDay':_0x51dd1d[_0x8b13('0x3a')],'outboundBusyCallsDay':_0x51dd1d[_0x8b13('0x3b')],'outboundCongestionCallsDay':_0x51dd1d[_0x8b13('0x3c')],'outboundDropCallsDayACS':_0x51dd1d[_0x8b13('0x3d')],'outboundDropCallsDayCallersExit':_0x51dd1d[_0x8b13('0x3e')],'outboundDropCallsDayTimeout':_0x51dd1d['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x51dd1d[_0x8b13('0x3f')],'outboundNoSuchCallsDay':_0x51dd1d[_0x8b13('0x40')],'outboundOriginateFailureCallsDay':_0x51dd1d[_0x8b13('0x41')],'outboundReCallsDay':_0x51dd1d[_0x8b13('0x42')],'outboundRejectCallsDay':_0x51dd1d[_0x8b13('0x43')],'outboundUnknownCallsDay':_0x51dd1d[_0x8b13('0x44')],'outboundAbandonedCallsDay':_0x51dd1d[_0x8b13('0x45')],'predictiveIntervalAnsweredCalls':_0x51dd1d[_0x8b13('0x46')],'predictiveIntervalAvgHoldtime':_0x51dd1d[_0x8b13('0x47')],'predictiveIntervalAvgTalktime':_0x51dd1d['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x51dd1d[_0x8b13('0x48')],'predictiveIntervalDroppedCallsTimeout':_0x51dd1d[_0x8b13('0x49')],'predictiveIntervalErlangCalls':_0x51dd1d[_0x8b13('0x4a')],'predictiveIntervalErlangCallsDroppedCalls':_0x51dd1d[_0x8b13('0x4b')],'predictiveIntervalHitRate':_0x51dd1d['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x51dd1d['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x51dd1d[_0x8b13('0x4c')],'predictiveIntervalAvailable':_0x51dd1d['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x51dd1d['predictiveIntervalTotalCalls'],'message':_0x51dd1d[_0x8b13('0x4d')],'originated':_0x51dd1d['originated'],'erlangCalls':_0x51dd1d[_0x8b13('0x4e')],'erlangCallToSecond':_0x51dd1d[_0x8b13('0x4f')],'erlangAbandonmentRate':_0x51dd1d[_0x8b13('0x50')],'erlangBusyFactor':_0x51dd1d[_0x8b13('0x51')],'startPredictive':_0x51dd1d[_0x8b13('0x52')],'startProgressive':_0x51dd1d[_0x8b13('0x53')]};if(_0x51dd1d[_0x8b13('0x54')]){_0x4f9902[_0x8b13('0x54')]={'id':_0x51dd1d[_0x8b13('0x54')]['id'],'name':_0x51dd1d[_0x8b13('0x54')]['name'],'active':_0x51dd1d[_0x8b13('0x54')][_0x8b13('0x55')],'callerid':_0x51dd1d[_0x8b13('0x54')][_0x8b13('0x56')]};}if(_0x51dd1d[_0x8b13('0x57')]){_0x4f9902[_0x8b13('0x57')]={'id':_0x51dd1d[_0x8b13('0x57')]['id'],'name':_0x51dd1d[_0x8b13('0x57')]['name']};}var _0x219bdf=md5(JSON['stringify'](_0x4f9902));if(_0x51dd1d[_0x8b13('0x5')]!==_0x219bdf){_0x51dd1d[_0x8b13('0x5')]=_0x219bdf;emit(util[_0x8b13('0x58')](_0x8b13('0x59'),_0x4f9902[_0x8b13('0x29')]),_0x8b13('0x5a'),_0x4f9902);}}}function emitVoiceQueueChannelRemove(_0x4ec1a5){logger['info'](_0x8b13('0x5b'),JSON['stringify'](_0x4ec1a5));emit(util[_0x8b13('0x58')]('voice:queue:%s',_0x4ec1a5[_0x8b13('0x29')]),_0x8b13('0x5c'),_0x4ec1a5);io[_0x8b13('0x5d')](_0x8b13('0x5e'),_0x4ec1a5);}function notSendMessagesQueue(_0x3a221d){if(_0x3a221d['sendMessageOneNotActive']){if(_0x3a221d['originated']===0x0&&_0x3a221d[_0x8b13('0x5f')]===0x0){_0x3a221d['sendMessageOneNotActive']=![];_0x3a221d[_0x8b13('0x2c')]=0x0;_0x3a221d[_0x8b13('0x60')]=0x0;_0x3a221d['message']=_0x8b13('0x61');ut[_0x8b13('0x62')](_0x8b13('0x63'),_0x3a221d[_0x8b13('0x29')]+_0x8b13('0x64'));}else{_0x3a221d[_0x8b13('0x4d')]=_0x8b13('0x65');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3a221d['name']+_0x8b13('0x66'));}emitCampaignPreview(_0x3a221d);}}Preview[_0x8b13('0x67')][_0x8b13('0x26')]=function(){var _0x3968bf=this;setInterval(function(){_0x3968bf[_0x8b13('0x68')]();},0x7cf);};Preview[_0x8b13('0x67')]['syncCampaigns']=function(){var _0x4342db=this['campaignsPreview'];this[_0x8b13('0x17')]+=0x1;for(var _0x5ce9c8 in _0x4342db){if(_0x4342db[_0x8b13('0x69')](_0x5ce9c8)&&(_0x4342db[_0x5ce9c8][_0x8b13('0x34')]===_0x8b13('0x8')||_0x4342db[_0x5ce9c8][_0x8b13('0x34')]===_0x8b13('0x6a'))&&_0x4342db[_0x5ce9c8][_0x8b13('0x27')]===_0x8b13('0x28')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x4342db[_0x8b13('0x69')](_0x5ce9c8)&&_0x4342db[_0x5ce9c8][_0x8b13('0x34')]===_0x8b13('0x8')&&_0x4342db[_0x5ce9c8][_0x8b13('0x27')]==='outbound'){if(_0x4342db[_0x5ce9c8]['dialActive']){this[_0x8b13('0x6b')](_0x4342db[_0x5ce9c8]);if(_0x4342db[_0x5ce9c8]['dialPreviewAutoRecallMe'])this[_0x8b13('0x6c')](_0x4342db[_0x5ce9c8]);}else{notSendMessagesQueue(_0x4342db[_0x5ce9c8]);}}}};Preview[_0x8b13('0x67')][_0x8b13('0x6d')]=function(_0x28ae75){var _0x46556f=this;this['sequence'][_0x8b13('0x10')](function(){if(!_[_0x8b13('0x6e')](_0x46556f[_0x8b13('0x6f')][_0x28ae75])){loggerAction[_0x8b13('0x70')](_0x8b13('0x71'),_0x28ae75,_0x8b13('0x72'),_0x46556f[_0x8b13('0x6f')][_0x28ae75][_0x8b13('0x73')],_0x8b13('0x74'),JSON['stringify'](_0x46556f[_0x8b13('0x13')][_0x46556f['actions'][_0x28ae75][_0x8b13('0x73')]][_0x8b13('0x75')]),_0x8b13('0x76'),JSON['stringify'](_0x46556f[_0x8b13('0x13')][_0x46556f[_0x8b13('0x6f')][_0x28ae75][_0x8b13('0x73')]][_0x8b13('0x5f')]),JSON[_0x8b13('0x77')](_0x46556f[_0x8b13('0x6f')][_0x28ae75][_0x8b13('0x78')]),JSON['stringify'](_[_0x8b13('0x79')](_0x46556f['actions'][_0x28ae75],[_0x8b13('0x7a'),_0x8b13('0x7b'),_0x8b13('0x7c'),_0x8b13('0x7d')])));return ami[_0x8b13('0x7e')]({'action':_0x8b13('0x7f'),'channel':_0x46556f[_0x8b13('0x6f')][_0x28ae75][_0x8b13('0x80')]})[_0x8b13('0x81')](function(_0xce98f7){if(_0xce98f7[_0x8b13('0x4d')]===_0x8b13('0x82')){setTimeout(function(){if(_0x46556f[_0x8b13('0x6f')][_0x28ae75]){ut[_0x8b13('0x83')](_0x46556f[_0x8b13('0x13')][_0x46556f[_0x8b13('0x6f')][_0x28ae75][_0x8b13('0x73')]],'[clearZombieChannel]');if(_0x46556f[_0x8b13('0x6f')][_0x28ae75][_0x8b13('0x78')]===!![]){ut['decrementTalkink'](_0x46556f[_0x8b13('0x13')][_0x46556f[_0x8b13('0x6f')][_0x28ae75][_0x8b13('0x73')]],_0x8b13('0x84'));ut[_0x8b13('0x85')](_0x8b13('0x86')+_0x28ae75,_0x46556f[_0x8b13('0x6f')][_0x28ae75][_0x8b13('0x73')]);}ut[_0x8b13('0x85')](_0x8b13('0x87')+_0x28ae75,_0x46556f[_0x8b13('0x6f')][_0x28ae75][_0x8b13('0x73')]);delete _0x46556f[_0x8b13('0x6f')][_0x28ae75];}},0x2328);}});}});};Preview[_0x8b13('0x67')][_0x8b13('0x88')]=function(){var _0x49e5f4=this;loggerAction[_0x8b13('0x70')](_0x8b13('0x89'),_['size'](this[_0x8b13('0x6f')]));for(var _0x73aba5 in this[_0x8b13('0x6f')]){if(_0x49e5f4[_0x8b13('0x6f')][_0x8b13('0x69')](_0x73aba5)){_0x49e5f4['clearZombieChannel'](_0x73aba5);}}};Preview[_0x8b13('0x67')][_0x8b13('0x6c')]=function(_0x46850a){var _0x52e2a6=this;rpcDb[_0x8b13('0x8a')](_0x46850a['id'],ut[_0x8b13('0x8b')](this['agents']))[_0x8b13('0x8c')](function(_0x348c11){if(!_[_0x8b13('0x6e')](_0x348c11)){for(var _0xd29067=0x0;_0xd29067<_0x348c11['length'];_0xd29067+=0x1){if(ut[_0x8b13('0x8d')](_0x348c11[_0xd29067][_0x8b13('0x8e')])<_0x46850a['dialRecallMeTimeout']*0x3c){if(_0x348c11[_0xd29067][_0x8b13('0x8f')]&&!_0x348c11[_0xd29067][_0x8b13('0x8f')][_0x8b13('0x90')]){_0x52e2a6[_0x8b13('0x91')](_0x348c11[_0xd29067]['id'])['then'](ut[_0x8b13('0x92')](_0x8b13('0x93')))[_0x8b13('0x81')](ut[_0x8b13('0x92')](_0x8b13('0x93')));}else{rpcDb[_0x8b13('0x94')](_0x348c11[_0xd29067]['id']);}}else{var _0x571e89=new Action(_0x348c11[_0xd29067],_0x46850a);_0x571e89[_0x8b13('0x95')]=moment()[_0x8b13('0x58')](_0x8b13('0x96'));_0x46850a['outboundReCallsDay']+=0x1;ut[_0x8b13('0x97')](_0x571e89,0x17,_0x8b13('0x98'));if(_0x46850a[_0x8b13('0x99')]){rpcDb[_0x8b13('0x9a')](ut['createBody'](_0x348c11[_0xd29067]));rpcDb['createCustomerHistory'](_0x571e89,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x571e89,0x16,'RecallFailedTimeout');rpcDb[_0x8b13('0x9b')](_0x571e89,_0x8b13('0x9c'));rpcDb['createCustomerFinal'](_0x571e89,_0x8b13('0x9c'));}}}}})['catch'](ut[_0x8b13('0x92')](_0x8b13('0x9d')));};Preview[_0x8b13('0x67')][_0x8b13('0x6b')]=function(_0x43f12a){_0x43f12a[_0x8b13('0x9e')]=!![];if(ut[_0x8b13('0x9f')](_0x43f12a['loggedIn'])){_0x43f12a[_0x8b13('0x4d')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x8b13('0xa0')](_0x43f12a[_0x8b13('0xa1')])){_0x43f12a[_0x8b13('0x4d')]=_0x8b13('0x61');}else if(!this[_0x8b13('0xa2')](_0x43f12a[_0x8b13('0x54')])){if(!this[_0x8b13('0xa2')](_0x43f12a['TrunkBackup'])){_0x43f12a[_0x8b13('0x4d')]='TRUNK_IS_NOT_REACHABLE';}else{_0x43f12a[_0x8b13('0x4d')]=_0x8b13('0xa3');}}else{_0x43f12a[_0x8b13('0x4d')]=_0x8b13('0xa3');}emitCampaignPreview(_0x43f12a);};Preview[_0x8b13('0x67')]['callProgressDetectingCustomer']=function(_0x52b546,_0x319923,_0x37a243){var _0x5ccf4e=this;var _0x180866=this[_0x8b13('0x6f')][_0x319923];var _0x670b3e=this['campaignsPreview'][_0x180866[_0x8b13('0x73')]];var _0x215a8a;if(_0x670b3e){switch(_0x37a243){case'1':_0x670b3e[_0x8b13('0x40')]+=0x1;_0x180866[_0x8b13('0xa4')]+=0x1;_0x180866['countglobal']=ut[_0x8b13('0xa5')](_0x180866);ut[_0x8b13('0x97')](_0x180866,0x0,'NoSuchNumber');ami[_0x8b13('0x5d')](_0x8b13('0xa6'),ut[_0x8b13('0xa7')](_0x180866,_0x8b13('0xa8')));rpcDb[_0x8b13('0x9b')](_0x180866,_0x8b13('0xa9'));if(ut[_0x8b13('0xa5')](_0x180866)>=_0x670b3e[_0x8b13('0xaa')]){_0x215a8a=ut[_0x8b13('0xab')](_0x180866,0xf,_0x8b13('0xac'));rpcDb[_0x8b13('0xad')](_0x215a8a,_0x8b13('0xae'));}else{if(_0x180866[_0x8b13('0xa4')]>=_0x670b3e[_0x8b13('0xaf')]){rpcDb['createCustomerFinal'](_0x180866,_0x8b13('0xae'));}else{rpcDb['rescheduleContact'](ut[_0x8b13('0xb0')](_0x180866,_0x8b13('0xa4'),_0x670b3e[_0x8b13('0xb1')]),_0x180866[_0x8b13('0xb2')],_0x180866['activeContact']);}}delete this['actions'][_0x52b546[_0x8b13('0xb3')]];break;case _0x8b13('0xb4'):var _0x4d8c62=moment()[_0x8b13('0x58')](_0x8b13('0x96'));_0x180866[_0x8b13('0xb5')]=_0x4d8c62;_0x180866[_0x8b13('0xb6')]=_0x4d8c62;_0x180866[_0x8b13('0x78')]=!![];_0x670b3e[_0x8b13('0x5f')]+=0x1;logger[_0x8b13('0x70')](_0x8b13('0xb7'),_0x180866[_0x8b13('0xb8')],_0x8b13('0xb9'),_0x670b3e['name'],_0x8b13('0x76'),_0x670b3e[_0x8b13('0x5f')]);ami['emit'](_0x8b13('0xba'),ut[_0x8b13('0xa7')](_0x180866,'connect',this[_0x8b13('0x13')][_0x180866[_0x8b13('0x73')]]));if(_0x670b3e[_0x8b13('0xbb')]){ami[_0x8b13('0x5d')](_0x8b13('0xbc'),ut[_0x8b13('0xbd')](_0x180866));}break;case'16':ami[_0x8b13('0x5d')](_0x8b13('0xbe'),ut['buildObj'](_0x180866,_0x8b13('0xbf'),this[_0x8b13('0x13')][_0x180866[_0x8b13('0x73')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x180866,_0x8b13('0xbf')));_0x670b3e['outboundAnswerCallsDay']+=0x1;_0x670b3e[_0x8b13('0xc0')]+=0x1;_0x670b3e[_0x8b13('0x2b')]+=0x1;ut[_0x8b13('0xc1')](_0x670b3e,_0x8b13('0xc2'));_0x180866[_0x8b13('0xc3')]=ut[_0x8b13('0xa5')](_0x180866);ut[_0x8b13('0x97')](_0x180866,0x4,_0x8b13('0xc4'));rpcDb[_0x8b13('0x9b')](_0x180866,_0x8b13('0xc5'));rpcDb['createCustomerFinal'](_0x180866,_0x8b13('0xc6'));rpcDb[_0x8b13('0xc7')](_0x180866);_0x670b3e[_0x8b13('0x2f')]+=_0x180866[_0x8b13('0xc8')];_0x670b3e[_0x8b13('0x2e')]+=_0x180866[_0x8b13('0xc8')];logger[_0x8b13('0x70')](_0x8b13('0xc9'),_0x180866[_0x8b13('0xb8')],_0x8b13('0xb9'),_0x670b3e[_0x8b13('0x29')],_0x8b13('0x76'),_0x670b3e[_0x8b13('0x5f')]);delete this['actions'][_0x52b546['linkedid']];break;case _0x8b13('0xca'):_0x670b3e['outboundBusyCallsDay']+=0x1;_0x180866[_0x8b13('0xcb')]+=0x1;_0x180866[_0x8b13('0xc3')]=ut['totalGlobal'](_0x180866);ut['logCustomer'](_0x180866,0x5,_0x8b13('0xcc'));ami[_0x8b13('0x5d')](_0x8b13('0xcd'),ut[_0x8b13('0xa7')](_0x180866,_0x8b13('0xce')));rpcDb['createCustomerHistory'](_0x180866,_0x8b13('0xcf'));if(ut['totalGlobal'](_0x180866)>=_0x670b3e[_0x8b13('0xaa')]){_0x215a8a=ut[_0x8b13('0xab')](_0x180866,0xf,'Global');rpcDb[_0x8b13('0xad')](_0x215a8a,_0x8b13('0xd0'));}else{if(_0x180866[_0x8b13('0xcb')]>=_0x670b3e[_0x8b13('0xd1')]){rpcDb[_0x8b13('0xad')](_0x180866,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x8b13('0xd2')](ut[_0x8b13('0xb0')](_0x180866,_0x8b13('0xcb'),_0x670b3e['dialBusyRetryFrequency']),_0x180866[_0x8b13('0xb2')],_0x180866['activeContact']);}}break;case _0x8b13('0xd3'):_0x670b3e[_0x8b13('0x3f')]+=0x1;_0x180866[_0x8b13('0xd4')]+=0x1;_0x180866[_0x8b13('0xc3')]=ut[_0x8b13('0xa5')](_0x180866);ut[_0x8b13('0x97')](_0x180866,0x3,_0x8b13('0xd5'));ami[_0x8b13('0x5d')](_0x8b13('0xd6'),ut[_0x8b13('0xa7')](_0x180866,'noanswer'));rpcDb[_0x8b13('0x9b')](_0x180866,_0x8b13('0xd7'));if(ut[_0x8b13('0xa5')](_0x180866)>=_0x670b3e[_0x8b13('0xaa')]){_0x215a8a=ut[_0x8b13('0xab')](_0x180866,0xf,'Global');rpcDb[_0x8b13('0xad')](_0x215a8a,_0x8b13('0xd8'));}else{if(_0x180866[_0x8b13('0xd4')]>=_0x670b3e[_0x8b13('0xd9')]){rpcDb[_0x8b13('0xad')](_0x180866,_0x8b13('0xd7'));}else{rpcDb['rescheduleContact'](ut[_0x8b13('0xb0')](_0x180866,_0x8b13('0xd4'),_0x670b3e['dialNoAnswerRetryFrequency']),_0x180866[_0x8b13('0xb2')],_0x180866['activeContact']);}}break;case _0x8b13('0xda'):_0x670b3e['outboundCongestionCallsDay']+=0x1;_0x180866[_0x8b13('0xdb')]+=0x1;_0x180866[_0x8b13('0xc3')]=ut[_0x8b13('0xa5')](_0x180866);ut[_0x8b13('0x97')](_0x180866,0x8,_0x8b13('0xdc'));ami[_0x8b13('0x5d')](_0x8b13('0xdd'),ut[_0x8b13('0xa7')](_0x180866,'congestion'));rpcDb[_0x8b13('0x9b')](_0x180866,_0x8b13('0xde'));if(ut['totalGlobal'](_0x180866)>=_0x670b3e[_0x8b13('0xaa')]){_0x215a8a=ut[_0x8b13('0xab')](_0x180866,0xf,'Global');rpcDb[_0x8b13('0xad')](_0x215a8a,_0x8b13('0xdf'));}else{if(_0x180866[_0x8b13('0xdb')]>=_0x670b3e[_0x8b13('0xe0')]){rpcDb[_0x8b13('0xad')](_0x180866,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x8b13('0xb0')](_0x180866,_0x8b13('0xdb'),_0x670b3e[_0x8b13('0xe1')]),_0x180866[_0x8b13('0xb2')],_0x180866[_0x8b13('0xe2')]);}}break;case _0x8b13('0xe3'):_0x670b3e[_0x8b13('0x43')]+=0x1;_0x180866[_0x8b13('0xe4')]+=0x1;_0x180866[_0x8b13('0xc3')]=ut[_0x8b13('0xa5')](_0x180866);ut[_0x8b13('0x97')](_0x180866,0x14,_0x8b13('0xe5'));ami[_0x8b13('0x5d')](_0x8b13('0xe6'),ut[_0x8b13('0xa7')](_0x180866,_0x8b13('0xe7')));rpcDb['createCustomerHistory'](_0x180866,_0x8b13('0xe8'));if(ut['totalGlobal'](_0x180866)>=_0x670b3e[_0x8b13('0xaa')]){_0x215a8a=ut[_0x8b13('0xab')](_0x180866,0x14,_0x8b13('0xe5'));rpcDb[_0x8b13('0xad')](_0x215a8a,_0x8b13('0xe9'));}else{if(_0x180866[_0x8b13('0xe4')]>=_0x670b3e[_0x8b13('0xea')]){rpcDb['createCustomerFinal'](_0x180866,_0x8b13('0xe9'));}else{rpcDb['rescheduleContact'](ut[_0x8b13('0xb0')](_0x180866,_0x8b13('0xe4'),_0x670b3e['dialAgentRejectRetryFrequency']),_0x180866['unlockAgent'],_0x180866[_0x8b13('0xe2')]);}}break;case _0x8b13('0xeb'):_0x670b3e[_0x8b13('0x45')]+=0x1;_0x180866[_0x8b13('0xec')]+=0x1;_0x180866[_0x8b13('0xc3')]=ut[_0x8b13('0xa5')](_0x180866);ut['logCustomer'](_0x180866,0xb,_0x8b13('0xed'));rpcDb[_0x8b13('0x9b')](_0x180866,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x180866)>=_0x670b3e['dialGlobalMaxRetry']){_0x215a8a=ut[_0x8b13('0xab')](_0x180866,0xf,_0x8b13('0xac'));rpcDb[_0x8b13('0xad')](_0x215a8a,_0x8b13('0xee'));}else{if(_0x180866[_0x8b13('0xef')]>=_0x670b3e[_0x8b13('0xf0')]){rpcDb[_0x8b13('0xad')](_0x180866,_0x8b13('0xee'));}else{rpcDb['rescheduleContact'](ut[_0x8b13('0xb0')](_0x180866,'countabandonedretry',_0x670b3e[_0x8b13('0xf1')]),_0x180866['unlockAgent'],_0x180866[_0x8b13('0xe2')]);}}break;case'18':_0x670b3e[_0x8b13('0x44')]+=0x1;_0x180866['countmachineretry']+=0x1;_0x180866[_0x8b13('0xc3')]=ut[_0x8b13('0xa5')](_0x180866);ut[_0x8b13('0x97')](_0x180866,0x12,_0x52b546[_0x8b13('0xf2')]||_0x52b546[_0x8b13('0xf3')]);ami['emit'](_0x8b13('0xf4'),ut[_0x8b13('0xa7')](_0x180866,_0x8b13('0xf5')));rpcDb[_0x8b13('0x9b')](_0x180866,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0x8b13('0xa5')](_0x180866)>=_0x670b3e['dialGlobalMaxRetry']){_0x215a8a=ut[_0x8b13('0xab')](_0x180866,0xf,_0x8b13('0xac'));rpcDb[_0x8b13('0xad')](_0x215a8a,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x180866,'[callProgressDetectingCustomer][hangupInAMD]');}delete this['actions'][_0x52b546[_0x8b13('0xb3')]];break;case'19':_0x670b3e['outboundUnknownCallsDay']+=0x1;_0x180866[_0x8b13('0xc3')]=ut['totalGlobal'](_0x180866);ut[_0x8b13('0x97')](_0x180866,0x13,_0x52b546[_0x8b13('0xf2')]||_0x52b546[_0x8b13('0xf3')]);ami[_0x8b13('0x5d')](_0x8b13('0xf4'),ut[_0x8b13('0xa7')](_0x180866,_0x8b13('0xf5')));rpcDb[_0x8b13('0x9b')](_0x180866,_0x8b13('0xf6'));if(ut[_0x8b13('0xa5')](_0x180866)>=_0x670b3e[_0x8b13('0xaa')]){_0x215a8a=ut[_0x8b13('0xab')](_0x180866,0xf,_0x8b13('0xac'));rpcDb['createCustomerFinal'](_0x215a8a,_0x8b13('0xf6'));}else{rpcDb['createCustomerFinal'](_0x180866,'[callProgressDetectingCustomer][machine]');}delete this['actions'][_0x52b546[_0x8b13('0xb3')]];break;default:if(_0x180866[_0x8b13('0x78')]){ut[_0x8b13('0xc1')](_0x670b3e,_0x8b13('0xf7'));ut['loggerError'](_0x8b13('0xf8')+_0x670b3e['name'],_0x52b546);}_0x670b3e[_0x8b13('0x44')]+=0x1;_0x180866[_0x8b13('0xc3')]=ut['totalGlobal'](_0x180866);ut[_0x8b13('0x97')](_0x180866,0xc,_0x52b546[_0x8b13('0xf2')]||_0x52b546[_0x8b13('0xf3')]);rpcDb['createCustomerHistory'](_0x180866,_0x8b13('0xf9'));if(ut[_0x8b13('0xa5')](_0x180866)>=_0x670b3e[_0x8b13('0xaa')]){_0x215a8a=ut[_0x8b13('0xab')](_0x180866,0xf,_0x8b13('0xac'));rpcDb[_0x8b13('0xad')](_0x215a8a,_0x8b13('0xfa'));}else{rpcDb[_0x8b13('0xad')](_0x180866,_0x8b13('0xfa'));}delete this[_0x8b13('0x6f')][_0x52b546[_0x8b13('0xb3')]];}if(!(_0x180866[_0x8b13('0x78')]&&_0x37a243==='16')){ut[_0x8b13('0x83')](_0x670b3e,_0x8b13('0xfb'));logger[_0x8b13('0x70')](_0x8b13('0xfc'),_0x180866['uniqueid'],_0x8b13('0xb9'),_0x670b3e[_0x8b13('0x29')],_0x8b13('0x74'),_0x670b3e['originated']);}if(_0x37a243!==_0x8b13('0xb4')){delete this['actions'][_0x52b546[_0x8b13('0xb3')]];delete this[_0x8b13('0x6f')][_0x52b546[_0x8b13('0xfd')]];}}};Preview['prototype'][_0x8b13('0xfe')]=function(_0x1a5ecb,_0x506ab2,_0x52ca71){if(_[_0x8b13('0xff')](_0x506ab2)&&_0x8b13('0x100')!==typeof _0x506ab2){return;}if(_['isUndefined'](_0x52ca71)&&_0x8b13('0x100')!==typeof _0x52ca71){return;}switch(_0x52ca71[_0x8b13('0x101')]){case'0':ut[_0x8b13('0x102')](_0x1a5ecb,0x0,_0x8b13('0x103'));rpcDb['createAgentHistory'](_0x1a5ecb,_0x8b13('0x104'));break;case'3':ut[_0x8b13('0x102')](_0x1a5ecb,0x3,_0x8b13('0xd5'));rpcDb['createAgentHistory'](_0x1a5ecb,_0x8b13('0x105'));break;case'5':ut[_0x8b13('0x102')](_0x1a5ecb,0x5,'Busy');rpcDb[_0x8b13('0x106')](_0x1a5ecb,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x8b13('0x102')](_0x1a5ecb,0x8,_0x8b13('0xdc'));rpcDb['createAgentHistory'](_0x1a5ecb,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x8b13('0x102')](_0x1a5ecb,0x16,_0x8b13('0x107'));rpcDb[_0x8b13('0x106')](_0x1a5ecb,_0x8b13('0x108'));break;default:ut[_0x8b13('0x102')](_0x1a5ecb,0xc,_0x52ca71[_0x8b13('0x101')]);rpcDb[_0x8b13('0x106')](_0x1a5ecb,_0x8b13('0x109'));}ut[_0x8b13('0x83')](_0x506ab2,_0x8b13('0x10a'));logger[_0x8b13('0x70')]('[originated][decrement][callProgressDetectingAgent]',_0x1a5ecb[_0x8b13('0xb8')],_0x8b13('0xb9'),_0x506ab2['name'],_0x8b13('0x74'),_0x506ab2['originated']);delete this[_0x8b13('0x6f')][_0x1a5ecb[_0x8b13('0xb8')]];};Preview[_0x8b13('0x67')]['checkInBlack']=function(_0x46bc13,_0x169609,_0xbd12b2,_0x3e0cf8,_0x117b27){var _0x58bc60=this;return new BPromise(function(_0x1d87f1,_0x2dba23){if(_[_0x8b13('0x6e')](_0x169609)||_[_0x8b13('0x6e')](_0x169609[_0x8b13('0x10b')])||_[_0x8b13('0x6e')](_0x169609['Contact'][_0x8b13('0x10c')])||_[_0x8b13('0x6e')](_0x169609[_0x8b13('0x7c')])){_0x2dba23(ut[_0x8b13('0x4d')]('Contact\x20is\x20undefined',_0x3e0cf8,_0x117b27));return;}var _0x1eb8cf=uuid['v4']();var _0x4c7f95=_0x58bc60['campaignsPreview'][_0x169609[_0x8b13('0x72')][_0x8b13('0x29')]];var _0x4d98b2=_0xbd12b2?_0x58bc60[_0x8b13('0x16')][_0xbd12b2]['id']:undefined;_0x58bc60['actions'][_0x1eb8cf]=new Action(_0x169609,_0x4c7f95,_0x1eb8cf,_0xbd12b2,_0x4d98b2);var _0x38cbc5=_0x58bc60['actions'][_0x1eb8cf];_0x38cbc5[_0x8b13('0xb2')]=_0x3e0cf8;_0x38cbc5[_0x8b13('0xe2')]=_0x117b27;_0x38cbc5[_0x8b13('0x10d')]=_0xbd12b2;if(_[_0x8b13('0x10e')](_0x46bc13)){_0x58bc60[_0x8b13('0x10f')](_0x38cbc5,_0x4c7f95,_0x169609,_0xbd12b2)[_0x8b13('0x8c')](function(_0x38fc1d){logger[_0x8b13('0x70')](_0x8b13('0x110'),'Queue:\x20'+_0x38cbc5[_0x8b13('0x73')]+_0x8b13('0x111')+_0x38cbc5['idContact'],JSON[_0x8b13('0x77')](_0x38fc1d));ami[_0x8b13('0x5d')](_0x8b13('0x112'),ut['buildObj'](_0x38cbc5,_0x8b13('0x113'),_0x58bc60[_0x8b13('0x13')][_0x38cbc5[_0x8b13('0x73')]]));_0x1d87f1(ut[_0x8b13('0x4d')]('Calling'));})[_0x8b13('0x81')](function(_0x1f8c53){ut[_0x8b13('0x62')](_0x8b13('0x114'),_0x1f8c53);_0x2dba23(ut[_0x8b13('0x4d')](_0x8b13('0x115'),_0x3e0cf8,_0x117b27));});}else{_0x4c7f95[_0x8b13('0x3a')]+=0x1;ut[_0x8b13('0x116')](_0x38cbc5);rpcDb[_0x8b13('0x117')](_0x38cbc5,_0x8b13('0x118'));delete _0x58bc60[_0x8b13('0x6f')][_0x1eb8cf];_0x2dba23(ut['message'](_0x8b13('0x119'),_0x3e0cf8,_0x117b27));}});};Preview[_0x8b13('0x67')]['isTrunkReachable']=function(_0x191ddf){return!_['isNil'](_0x191ddf)&&!_[_0x8b13('0x6e')](_0x191ddf[_0x8b13('0x29')])&&!_[_0x8b13('0x6e')](_0x191ddf[_0x8b13('0x55')])&&_0x191ddf[_0x8b13('0x55')]&&!_[_0x8b13('0x6e')](this[_0x8b13('0x15')][util[_0x8b13('0x58')](_0x8b13('0x11a'),_0x191ddf[_0x8b13('0x29')])])&&!_[_0x8b13('0x6e')](this[_0x8b13('0x15')][util[_0x8b13('0x58')](_0x8b13('0x11a'),_0x191ddf[_0x8b13('0x29')])][_0x8b13('0x7f')])&&(this[_0x8b13('0x15')][util[_0x8b13('0x58')](_0x8b13('0x11a'),_0x191ddf[_0x8b13('0x29')])]['status']===_0x8b13('0x11b')||this['trunks'][util[_0x8b13('0x58')]('SIP/%s',_0x191ddf[_0x8b13('0x29')])]['status']===_0x8b13('0x11c'));};Preview['prototype'][_0x8b13('0x91')]=function(_0x33d707,_0x3629cb){var _0x4dd9fc=this;return new BPromise(function(_0x416e4f,_0x41782b){_0x4dd9fc[_0x8b13('0x11d')](_0x33d707,_0x3629cb)[_0x8b13('0x8c')](function(_0x4f0b0b){_0x416e4f(_[_0x8b13('0x79')](_0x4f0b0b,[_0x8b13('0x4d')]));})[_0x8b13('0x81')](function(_0x2abab6){if(_0x2abab6[_0x8b13('0x11e')]){rpcDb['unlockContact'](_0x33d707);}if(_0x2abab6[_0x8b13('0x55')]){rpcDb[_0x8b13('0x94')](_0x33d707);}_0x41782b(_[_0x8b13('0x79')](_0x2abab6,[_0x8b13('0x4d')]));});});};Preview[_0x8b13('0x67')]['execRun']=function(_0x521da5,_0x408300){var _0x5d6aeb=this;return new BPromise(function(_0x35d90b,_0x3ce2f6){var _0x467779,_0x905cf6;rpcDb[_0x8b13('0x11f')](_0x521da5)[_0x8b13('0x8c')](function(_0x360e01){if(!_[_0x8b13('0x6e')](_0x360e01[0x0])){_0x905cf6=_0x360e01[0x0][_0x8b13('0x120')]?![]:!![];_0x467779=_0x360e01[0x0][_0x8b13('0x120')]?!![]:![];_0x467779=_0x408300?!![]:_0x467779;}var _0x147eed=_0x5d6aeb[_0x8b13('0x121')](_0x360e01);if(_0x147eed['isValid']){rpcDb['checkIsBlackList'](_['pick'](_0x360e01[0x0],['VoiceQueueId','Contact.phone']))[_0x8b13('0x8c')](function(_0x10c97f){_0x5d6aeb[_0x8b13('0x122')](_0x10c97f,_0x360e01[0x0],_0x408300,_0x905cf6,_0x467779)[_0x8b13('0x8c')](function(_0x28c8ab){_0x35d90b(_0x28c8ab);})[_0x8b13('0x81')](function(_0x33ab8d){_0x3ce2f6(_0x33ab8d);});})[_0x8b13('0x81')](function(_0x33afb6){ut[_0x8b13('0x62')]('[Preview][checkIsBlackList]',_0x33afb6);_0x3ce2f6(ut[_0x8b13('0x4d')](_0x8b13('0x123'),_0x905cf6,_0x467779));});}else{_0x3ce2f6(ut[_0x8b13('0x4d')](_0x147eed['message'],_0x905cf6,_0x467779));}})['catch'](function(_0x12e91a){ut[_0x8b13('0x62')]('[Preview][getContactPreview]',_0x12e91a);_0x3ce2f6(ut[_0x8b13('0x4d')](_0x8b13('0x123'),![],!![]));});});};Preview['prototype'][_0x8b13('0x121')]=function(_0x112d5c){if(_[_0x8b13('0x6e')](_0x112d5c)||_[_0x8b13('0x10e')](_0x112d5c)||!_[_0x8b13('0x6e')](_0x112d5c[0x0]['Agent'])&&_['isNil'](_0x112d5c[0x0][_0x8b13('0x8f')]['name'])){ut[_0x8b13('0x62')](_0x8b13('0x124'),_0x112d5c);return{'isValid':![],'message':_0x8b13('0x125')};}var _0x58b8af=this[_0x8b13('0x13')][_0x112d5c[0x0][_0x8b13('0x72')][_0x8b13('0x29')]];_0x58b8af[_0x8b13('0x4d')]='ACTIVE';if(_[_0x8b13('0x6e')](_0x58b8af)){ut['logger'](_0x8b13('0x126'),_0x58b8af);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x8b13('0xa2')](_0x58b8af[_0x8b13('0x54')])){ut[_0x8b13('0x62')](_0x8b13('0x127'),_0x8b13('0x128')+_0x58b8af[_0x8b13('0x29')]+_0x8b13('0x129'));if(!this[_0x8b13('0xa2')](_0x58b8af[_0x8b13('0x12a')])){ut[_0x8b13('0x62')](_0x8b13('0x127'),_0x58b8af['name']+_0x8b13('0x12b'));return{'isValid':![],'message':_0x8b13('0x12c')};}}if(!ut['isActive'](_0x58b8af[_0x8b13('0xa1')])){ut[_0x8b13('0x62')](_0x8b13('0x12d'),_0x58b8af[_0x8b13('0x29')]+_0x8b13('0x12e'));return{'isValid':![],'message':_0x8b13('0x128')+_0x58b8af[_0x8b13('0x29')]+_0x8b13('0x12e')};}return{'isValid':!![],'message':_0x8b13('0x12f')};};Preview[_0x8b13('0x67')]['execCall']=function(_0x1b8bf6,_0x4908d3,_0x360b37,_0x52f93b){var _0x2955b4=this;return new BPromise(function(_0x577931,_0x3a6b62){var _0x545b33=_0x1b8bf6[_0x8b13('0xb8')];var _0x31aa09=_0x2955b4[_0x8b13('0xa2')](_0x4908d3[_0x8b13('0x54')])?util[_0x8b13('0x58')](_0x8b13('0x130'),_0x4908d3[_0x8b13('0x54')][_0x8b13('0x29')],_[_0x8b13('0x6e')](_0x4908d3[_0x8b13('0x38')])?'':_0x4908d3[_0x8b13('0x38')]['trim']()||'',_0x4908d3[_0x8b13('0x131')]>0x0?_0x360b37[_0x8b13('0x10b')][_0x8b13('0x10c')][_0x8b13('0x132')](_0x4908d3['dialCutDigit']):_0x360b37[_0x8b13('0x10b')][_0x8b13('0x10c')]):util[_0x8b13('0x58')](_0x8b13('0x130'),_[_0x8b13('0x6e')](_0x4908d3[_0x8b13('0x12a')])?_0x4908d3['Trunk'][_0x8b13('0x29')]:_0x4908d3[_0x8b13('0x12a')][_0x8b13('0x29')],_[_0x8b13('0x6e')](_0x4908d3[_0x8b13('0x38')])?'':_0x4908d3[_0x8b13('0x38')][_0x8b13('0x133')]()||'',_0x4908d3[_0x8b13('0x131')]>0x0?_0x360b37[_0x8b13('0x10b')][_0x8b13('0x10c')]['substring'](_0x4908d3[_0x8b13('0x131')]):_0x360b37[_0x8b13('0x10b')]['phone']);var _0x457873=_0x2955b4['isTrunkReachable'](_0x4908d3[_0x8b13('0x54')])?ut[_0x8b13('0x134')](_0x4908d3[_0x8b13('0x54')][_0x8b13('0x56')],_0x4908d3['dialOriginateCallerIdName'],_0x4908d3[_0x8b13('0x135')]>0x0?ut[_0x8b13('0x136')](_0x4908d3['dialOriginateCallerIdNumber'],_0x4908d3[_0x8b13('0x135')]):_0x4908d3['dialOriginateCallerIdNumber']):ut[_0x8b13('0x134')](_[_0x8b13('0x6e')](_0x4908d3[_0x8b13('0x12a')])?_0x4908d3[_0x8b13('0x54')][_0x8b13('0x56')]:_0x4908d3[_0x8b13('0x12a')][_0x8b13('0x56')],_0x4908d3['dialOriginateCallerIdName'],_0x4908d3[_0x8b13('0x135')]>0x0?ut[_0x8b13('0x136')](_0x4908d3[_0x8b13('0x36')],_0x4908d3[_0x8b13('0x135')]):_0x4908d3['dialOriginateCallerIdNumber']);if(_0x457873){_0x1b8bf6['originatecalleridname']=ut['extractCalleridName'](_0x457873);_0x1b8bf6[_0x8b13('0x137')]=ut['extractCalleridNumber'](_0x457873);}var _0x4cb020=ut[_0x8b13('0x138')](_0x4908d3,_0x360b37,_0x31aa09,_0x457873,_0x545b33,_0x1b8bf6);_[_0x8b13('0x139')](_0x1b8bf6,ut[_0x8b13('0x13a')](_0x4cb020));_0x1b8bf6[_0x8b13('0x95')]=moment()[_0x8b13('0x58')](_0x8b13('0x96'));ami[_0x8b13('0x7e')](ut['variablesAction'](_0x1b8bf6,_0x4908d3,_0x4cb020,_0x1b8bf6['activeContact'],_0x52f93b))[_0x8b13('0x8c')](function(_0x4e6a68){_0x4908d3[_0x8b13('0x75')]+=0x1;logger[_0x8b13('0x70')](_0x8b13('0x13b'),_0x545b33,'\x20Queue',_0x4908d3[_0x8b13('0x29')],'originated:\x20',_0x4908d3[_0x8b13('0x75')]);_0x577931(_0x4e6a68);})[_0x8b13('0x81')](function(_0x4176d9){ut['logAgent'](_0x1b8bf6,0xe,_0x8b13('0x13c'));rpcDb[_0x8b13('0x106')](_0x1b8bf6,_0x8b13('0x13d'));_0x3a6b62(_0x4176d9);});});};Preview[_0x8b13('0x67')][_0x8b13('0x20')]=function(_0x28bb5c){if(this[_0x8b13('0x6f')][_0x28bb5c['linkedid']]){this['actions'][_0x28bb5c['linkedid']][_0x8b13('0x80')]=_0x28bb5c[_0x8b13('0x80')];}};Preview['prototype'][_0x8b13('0x13e')]=function(_0x58dd3b){var _0x32bfff=this;var _0x2ca28a=this['actions'][_0x58dd3b[_0x8b13('0x13f')]];if(_0x2ca28a){if(_0x2ca28a[_0x8b13('0x10d')]&&this[_0x8b13('0x16')][_0x2ca28a[_0x8b13('0x10d')]]){ut[_0x8b13('0x140')](_0x2ca28a,this['agents'][_0x2ca28a['lookAgent']][_0x8b13('0x29')],this[_0x8b13('0x16')][_0x2ca28a[_0x8b13('0x10d')]]['id']);}var _0x1e3cc8=_[_0x8b13('0x141')](_0x2ca28a);_0x1e3cc8[_0x8b13('0xb5')]=moment()[_0x8b13('0x58')](_0x8b13('0x96'));var _0x4ac60d=_0x32bfff[_0x8b13('0x13')][_0x2ca28a['queue']];if(ut[_0x8b13('0x142')](_0x58dd3b[_0x8b13('0x143')])){if(_0x2ca28a[_0x8b13('0xb2')]){rpcDb[_0x8b13('0x144')](_0x2ca28a[_0x8b13('0x145')]);}if(_0x2ca28a[_0x8b13('0xe2')]){rpcDb[_0x8b13('0x94')](_0x2ca28a[_0x8b13('0x145')]);}ami[_0x8b13('0x5d')](_0x8b13('0x146'),ut[_0x8b13('0xa7')](_0x2ca28a,_0x8b13('0x147'),this[_0x8b13('0x13')][_0x2ca28a[_0x8b13('0x73')]]));this['callProgressDetectingAgent'](_0x1e3cc8,_0x4ac60d,_0x58dd3b);}else{_0x2ca28a[_0x8b13('0x95')]=moment()[_0x8b13('0x58')](_0x8b13('0x96'));ut[_0x8b13('0x102')](_0x1e3cc8,0x4,_0x8b13('0xc4'));rpcDb[_0x8b13('0x106')](_0x1e3cc8,_0x8b13('0x148'));}}};Preview[_0x8b13('0x67')][_0x8b13('0x19')]=function(_0x3ca469){var _0xddccf7=this;var _0x170d79=this[_0x8b13('0x6f')][_0x3ca469['linkedid']];var _0x571ff2;if(_0x170d79){_0x571ff2=this[_0x8b13('0x13')][_0x170d79[_0x8b13('0x73')]];logger['info'](_0x8b13('0x149'),_0x3ca469[_0x8b13('0xb3')],_0x8b13('0xb9'),_0x571ff2[_0x8b13('0x29')],'pTalking:\x20',_0x571ff2['pTalking']);}if(this[_0x8b13('0x6f')][_0x3ca469[_0x8b13('0xb3')]]&&_0x3ca469[_0x8b13('0xb3')]!==_0x3ca469[_0x8b13('0xb8')]){if(_0x3ca469[_0x8b13('0x14a')]==='16'&&this[_0x8b13('0x6f')][_0x3ca469['linkedid']][_0x8b13('0x78')]){this[_0x8b13('0x14b')](_0x3ca469,_0x3ca469['linkedid'],_0x3ca469['cause']);}else if(this[_0x8b13('0x6f')][_0x3ca469[_0x8b13('0xb3')]][_0x8b13('0x78')]){logger['info'](_0x8b13('0x14c'),_0x3ca469['linkedid'],_0x3ca469['cause'],_0x8b13('0xb9'),_0x571ff2[_0x8b13('0x29')],'pTalking:\x20',_0x571ff2['pTalking']);this[_0x8b13('0x14b')](_0x3ca469,_0x3ca469['linkedid'],_0x3ca469[_0x8b13('0x14a')]);}}else if(_0x170d79&&_[_0x8b13('0x6e')](_0x170d79[_0x8b13('0x14d')])&&_0x571ff2[_0x8b13('0x14e')]&&_0x3ca469[_0x8b13('0xb3')]===_0x3ca469['uniqueid']&&_['isNil'](_0x3ca469[_0x8b13('0x101')])&&_0x3ca469['cause']==='16'&&_0x3ca469['channelstate']==='6'&&_[_0x8b13('0xff')](_0x170d79[_0x8b13('0x14f')])){if(_0x170d79[_0x8b13('0xb2')]){rpcDb[_0x8b13('0x144')](_0x170d79[_0x8b13('0x145')]);}if(_0x170d79[_0x8b13('0xe2')]){rpcDb['disableContact'](_0x170d79[_0x8b13('0x145')]);}_0x3ca469[_0x8b13('0x101')]='22';this[_0x8b13('0xfe')](_0x170d79,_0x571ff2,_0x3ca469);}else if(_0x170d79&&_0x170d79[_0x8b13('0x14f')]){if(_0x3ca469['cause']==='16'&&this['actions'][_0x3ca469[_0x8b13('0xb3')]][_0x8b13('0x78')]){logger[_0x8b13('0x70')](_0x8b13('0x150'),_0x3ca469[_0x8b13('0xb3')],_0x3ca469['cause'],_0x8b13('0xb9'),_0x571ff2['name'],_0x8b13('0x76'),_0x571ff2[_0x8b13('0x5f')]);this[_0x8b13('0x14b')](_0x3ca469,_0x3ca469['linkedid'],_0x3ca469[_0x8b13('0x14a')]);}else if(this[_0x8b13('0x6f')][_0x3ca469[_0x8b13('0xb3')]]['dialAnswer']){logger[_0x8b13('0x70')](_0x8b13('0x14c'),_0x3ca469[_0x8b13('0xb3')],_0x3ca469[_0x8b13('0x14a')],_0x8b13('0xb9'),_0x571ff2[_0x8b13('0x29')],'pTalking:\x20',_0x571ff2[_0x8b13('0x5f')]);this[_0x8b13('0x14b')](_0x3ca469,_0x3ca469['linkedid'],_0x3ca469['cause']);}}};Preview['prototype'][_0x8b13('0x1e')]=function(_0x5dbd68){if(this[_0x8b13('0x6f')][_0x5dbd68[_0x8b13('0xfd')]]&&_0x5dbd68[_0x8b13('0xfd')]!==_0x5dbd68['destuniqueid']){this['callProgressDetectingCustomer'](_0x5dbd68,_0x5dbd68['destlinkedid'],_0x5dbd68[_0x8b13('0xf3')]);}};Preview[_0x8b13('0x67')][_0x8b13('0x1c')]=function(_0x54a76f){if(this[_0x8b13('0x6f')][_0x54a76f['linkedid']]&&_0x54a76f[_0x8b13('0xb3')]!==_0x54a76f['uniqueid']&&!this['actions'][_0x54a76f[_0x8b13('0xb3')]][_0x8b13('0x78')]){if(_0x54a76f[_0x8b13('0x14a')]==='1'){this[_0x8b13('0x14b')](_0x54a76f,_0x54a76f['linkedid'],_0x54a76f['cause']);}}};Preview[_0x8b13('0x67')][_0x8b13('0x151')]=function(_0x490945,_0x4e3219,_0x36cf0c){if(this[_0x8b13('0x6f')][_0x490945]){if(_[_0x8b13('0x6e')](this[_0x8b13('0x6f')][_0x490945][_0x8b13('0x152')])){this[_0x8b13('0x6f')][_0x490945]['variables']={};}this[_0x8b13('0x6f')][_0x490945][_0x8b13('0x152')][_0x4e3219]=_0x36cf0c;}};Preview[_0x8b13('0x67')][_0x8b13('0x22')]=function(_0x49e85f){try{if(!_['isNil'](_0x49e85f)){if(ut[_0x8b13('0x153')](_[_0x8b13('0x154')](_0x49e85f[_0x8b13('0x155')])[0x0])){this[_0x8b13('0x151')](_0x49e85f['uniqueid'],_[_0x8b13('0x154')](_0x49e85f[_0x8b13('0x155')])[0x0],_0x49e85f['value']);}}}catch(_0x43222c){logger['error'](_0x8b13('0x156'),util[_0x8b13('0x157')](_0x43222c,{'showHidden':![],'depth':null}));}};Preview[_0x8b13('0x67')][_0x8b13('0x23')]=function(_0x39ae60){if(_0x39ae60){if(this[_0x8b13('0x6f')][_0x39ae60[_0x8b13('0x158')]]){this['actions'][_0x39ae60[_0x8b13('0x158')]]['transfer']=!![];}}};Preview['prototype'][_0x8b13('0x25')]=function(_0x14a2b2){if(_0x14a2b2){if(this[_0x8b13('0x6f')][_0x14a2b2[_0x8b13('0x159')]]){this['actions'][_0x14a2b2[_0x8b13('0x159')]][_0x8b13('0x14f')]=!![];}}};module[_0x8b13('0x15a')]=Preview; \ No newline at end of file +var _0x0ba7=['merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','channel','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','available','sumBillable','sumHoldTime','talking','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','startProgressive','Trunk','active','callerid','Interval','stringify','format','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','paused','message','\x20is\x20not\x20active','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','prototype','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','catch','updateOriginated','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','[action]','getContactRecallMe','then','length','dialRecallMeTimeout','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','RecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentcomplete','complete','answered','decrementTalkink','[16]','Answer','createCustomerFinal','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyRetryFrequency','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','outboundRejectCallsDay','AgentReject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','status','unmonitored','execRun','unlock','unlockContact','recallme','isValid','Contact.phone','[Preview][checkIsBlackList]','validateContact','Agent','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','trim','dialCutDigit','Contact','substring','getCallerId','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables'];(function(_0x377c86,_0x2e9e19){var _0x3f1fcb=function(_0x14f71f){while(--_0x14f71f){_0x377c86['push'](_0x377c86['shift']());}};_0x3f1fcb(++_0x2e9e19);}(_0x0ba7,0x16d));var _0x70ba=function(_0x289f58,_0x453764){_0x289f58=_0x289f58-0x0;var _0x1fb125=_0x0ba7[_0x289f58];return _0x1fb125;};'use strict';var util=require(_0x70ba('0x0'));var _=require('lodash');var BPromise=require(_0x70ba('0x1'));var uuid=require(_0x70ba('0x2'));var moment=require(_0x70ba('0x3'));var md5=require(_0x70ba('0x4'));var Redis=require('ioredis');var config=require(_0x70ba('0x5'));var logger=require(_0x70ba('0x6'))(_0x70ba('0x7'));var loggerAction=require(_0x70ba('0x6'))(_0x70ba('0x8'));var ami=require(_0x70ba('0x9'));var rpcDb=require(_0x70ba('0xa'));var Action=require(_0x70ba('0xb'));var ut=require(_0x70ba('0xc'));config[_0x70ba('0xd')]=_[_0x70ba('0xe')](config[_0x70ba('0xd')],{'host':_0x70ba('0xf'),'port':0x18eb});var io=require(_0x70ba('0x10'))(new Redis(config[_0x70ba('0xd')]));var Sequence=function(){};Sequence['prototype'][_0x70ba('0x11')]=function(_0x4de64d){this[_0x70ba('0x12')]=this[_0x70ba('0x12')]?this[_0x70ba('0x12')][_0x70ba('0x13')](_0x4de64d):_0x4de64d();};function Preview(_0x593fe9){this['sequence']=new Sequence();this[_0x70ba('0x14')]=_0x593fe9['voiceQueues'];this[_0x70ba('0x15')]=_0x593fe9['trunks'];this[_0x70ba('0x16')]={};this[_0x70ba('0x17')]=_0x593fe9['agents'];this[_0x70ba('0x18')]=0x0;ami['on']('originateresponse',this[_0x70ba('0x19')][_0x70ba('0x1a')](this));ami['on'](_0x70ba('0x1b'),this[_0x70ba('0x1c')][_0x70ba('0x1a')](this));ami['on'](_0x70ba('0x1d'),this[_0x70ba('0x1e')][_0x70ba('0x1a')](this));ami['on'](_0x70ba('0x1f'),this[_0x70ba('0x20')][_0x70ba('0x1a')](this));ami['on'](_0x70ba('0x21'),this[_0x70ba('0x22')][_0x70ba('0x1a')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x70ba('0x23'),this[_0x70ba('0x24')][_0x70ba('0x1a')](this));ami['on'](_0x70ba('0x25'),this[_0x70ba('0x26')][_0x70ba('0x1a')](this));this[_0x70ba('0x27')](this[_0x70ba('0x14')]);}function emit(_0x415879,_0x40b82c,_0x26c039){io['to'](_0x415879)[_0x70ba('0x28')](_0x40b82c,_0x26c039);}function emitCampaignPreview(_0x2a1328){if(_0x2a1328[_0x70ba('0x29')]===_0x70ba('0x2a')){var _0x5ebe9d={'id':_0x2a1328['id'],'name':_0x2a1328[_0x70ba('0x2b')],'strategy':_0x2a1328[_0x70ba('0x2c')],'answered':_0x2a1328['answered'],'available':_0x2a1328[_0x70ba('0x2d')],'loggedIn':_0x2a1328['loggedIn'],'pTalking':_0x2a1328['pTalking'],'sumBillable':_0x2a1328[_0x70ba('0x2e')],'sumDuration':_0x2a1328['sumDuration'],'sumHoldTime':_0x2a1328[_0x70ba('0x2f')]||0x0,'talking':_0x2a1328[_0x70ba('0x30')],'total':_0x2a1328['total'],'type':_0x2a1328[_0x70ba('0x29')],'unmanaged':_0x2a1328['unmanaged'],'abandoned':_0x2a1328['abandoned'],'waiting':_0x2a1328[_0x70ba('0x31')],'loggedInDb':_0x2a1328['loggedInDb'],'dialActive':_0x2a1328[_0x70ba('0x32')],'dialMethod':_0x2a1328[_0x70ba('0x33')],'dialOriginateCallerIdName':_0x2a1328[_0x70ba('0x34')],'dialOriginateCallerIdNumber':_0x2a1328[_0x70ba('0x35')],'dialOriginateTimeout':_0x2a1328[_0x70ba('0x36')],'dialPrefix':_0x2a1328[_0x70ba('0x37')],'outboundAnswerAgiCallsDay':_0x2a1328['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x2a1328[_0x70ba('0x38')],'outboundBlacklistCallsDay':_0x2a1328[_0x70ba('0x39')],'outboundBusyCallsDay':_0x2a1328[_0x70ba('0x3a')],'outboundCongestionCallsDay':_0x2a1328['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x2a1328[_0x70ba('0x3b')],'outboundDropCallsDayCallersExit':_0x2a1328['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x2a1328['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x2a1328['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x2a1328[_0x70ba('0x3c')],'outboundOriginateFailureCallsDay':_0x2a1328[_0x70ba('0x3d')],'outboundReCallsDay':_0x2a1328['outboundReCallsDay'],'outboundRejectCallsDay':_0x2a1328['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x2a1328[_0x70ba('0x3e')],'outboundAbandonedCallsDay':_0x2a1328['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x2a1328[_0x70ba('0x3f')],'predictiveIntervalAvgHoldtime':_0x2a1328[_0x70ba('0x40')],'predictiveIntervalAvgTalktime':_0x2a1328[_0x70ba('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x2a1328[_0x70ba('0x42')],'predictiveIntervalDroppedCallsTimeout':_0x2a1328[_0x70ba('0x43')],'predictiveIntervalErlangCalls':_0x2a1328[_0x70ba('0x44')],'predictiveIntervalErlangCallsDroppedCalls':_0x2a1328[_0x70ba('0x45')],'predictiveIntervalHitRate':_0x2a1328[_0x70ba('0x46')],'predictiveIntervalMultiplicativeFactor':_0x2a1328[_0x70ba('0x47')],'predictiveIntervalPauses':_0x2a1328[_0x70ba('0x48')],'predictiveIntervalAvailable':_0x2a1328[_0x70ba('0x49')],'predictiveIntervalTotalCalls':_0x2a1328['predictiveIntervalTotalCalls'],'message':_0x2a1328['message'],'originated':_0x2a1328[_0x70ba('0x4a')],'erlangCalls':_0x2a1328[_0x70ba('0x4b')],'erlangCallToSecond':_0x2a1328[_0x70ba('0x4c')],'erlangAbandonmentRate':_0x2a1328['erlangAbandonmentRate'],'erlangBusyFactor':_0x2a1328['erlangBusyFactor'],'startPredictive':_0x2a1328['startPredictive'],'startProgressive':_0x2a1328[_0x70ba('0x4d')]};if(_0x2a1328[_0x70ba('0x4e')]){_0x5ebe9d[_0x70ba('0x4e')]={'id':_0x2a1328['Trunk']['id'],'name':_0x2a1328[_0x70ba('0x4e')]['name'],'active':_0x2a1328['Trunk'][_0x70ba('0x4f')],'callerid':_0x2a1328['Trunk'][_0x70ba('0x50')]};}if(_0x2a1328[_0x70ba('0x51')]){_0x5ebe9d['Interval']={'id':_0x2a1328[_0x70ba('0x51')]['id'],'name':_0x2a1328[_0x70ba('0x51')][_0x70ba('0x2b')]};}var _0x48328e=md5(JSON[_0x70ba('0x52')](_0x5ebe9d));if(_0x2a1328[_0x70ba('0x4')]!==_0x48328e){_0x2a1328[_0x70ba('0x4')]=_0x48328e;emit(util[_0x70ba('0x53')]('voice:queue:%s',_0x5ebe9d[_0x70ba('0x2b')]),'voice_queue:save',_0x5ebe9d);}}}function emitVoiceQueueChannelRemove(_0x17707a){logger[_0x70ba('0x54')](_0x70ba('0x55'),JSON[_0x70ba('0x52')](_0x17707a));emit(util[_0x70ba('0x53')](_0x70ba('0x56'),_0x17707a[_0x70ba('0x2b')]),'voice_queue_channel:remove',_0x17707a);io[_0x70ba('0x28')](_0x70ba('0x57'),_0x17707a);}function notSendMessagesQueue(_0x31e713){if(_0x31e713[_0x70ba('0x58')]){if(_0x31e713[_0x70ba('0x4a')]===0x0&&_0x31e713[_0x70ba('0x59')]===0x0){_0x31e713['sendMessageOneNotActive']=![];_0x31e713[_0x70ba('0x2d')]=0x0;_0x31e713[_0x70ba('0x5a')]=0x0;_0x31e713[_0x70ba('0x5b')]='NOT_ACTIVE';ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x31e713[_0x70ba('0x2b')]+_0x70ba('0x5c'));}else{_0x31e713[_0x70ba('0x5b')]='IS_DISACTIVED';ut[_0x70ba('0x5d')](_0x70ba('0x5e'),_0x31e713[_0x70ba('0x2b')]+_0x70ba('0x5f'));}emitCampaignPreview(_0x31e713);}}Preview[_0x70ba('0x60')]['loopCampaigns']=function(){var _0x5ee74c=this;setInterval(function(){_0x5ee74c[_0x70ba('0x61')]();},0x7cf);};Preview[_0x70ba('0x60')][_0x70ba('0x61')]=function(){var _0x5a1edb=this['campaignsPreview'];this[_0x70ba('0x18')]+=0x1;for(var _0x4d6467 in _0x5a1edb){if(_0x5a1edb[_0x70ba('0x62')](_0x4d6467)&&(_0x5a1edb[_0x4d6467][_0x70ba('0x33')]===_0x70ba('0x7')||_0x5a1edb[_0x4d6467][_0x70ba('0x33')]===_0x70ba('0x63'))&&_0x5a1edb[_0x4d6467]['type']===_0x70ba('0x2a')){if(this[_0x70ba('0x18')]>0x7){this[_0x70ba('0x18')]=0x0;this[_0x70ba('0x64')]();}}if(_0x5a1edb[_0x70ba('0x62')](_0x4d6467)&&_0x5a1edb[_0x4d6467][_0x70ba('0x33')]===_0x70ba('0x7')&&_0x5a1edb[_0x4d6467][_0x70ba('0x29')]===_0x70ba('0x2a')){if(_0x5a1edb[_0x4d6467][_0x70ba('0x32')]){this[_0x70ba('0x65')](_0x5a1edb[_0x4d6467]);if(_0x5a1edb[_0x4d6467][_0x70ba('0x66')])this[_0x70ba('0x67')](_0x5a1edb[_0x4d6467]);}else{notSendMessagesQueue(_0x5a1edb[_0x4d6467]);}}}};Preview[_0x70ba('0x60')][_0x70ba('0x68')]=function(_0x529e38){var _0xd7638f=this;this[_0x70ba('0x69')]['enqueue'](function(){if(!_[_0x70ba('0x6a')](_0xd7638f[_0x70ba('0x16')][_0x529e38])){loggerAction[_0x70ba('0x54')](_0x70ba('0x6b'),_0x529e38,_0x70ba('0x6c'),_0xd7638f[_0x70ba('0x16')][_0x529e38][_0x70ba('0x6d')],'originated:\x20',JSON[_0x70ba('0x52')](_0xd7638f[_0x70ba('0x14')][_0xd7638f[_0x70ba('0x16')][_0x529e38][_0x70ba('0x6d')]][_0x70ba('0x4a')]),_0x70ba('0x6e'),JSON[_0x70ba('0x52')](_0xd7638f[_0x70ba('0x14')][_0xd7638f[_0x70ba('0x16')][_0x529e38][_0x70ba('0x6d')]][_0x70ba('0x59')]),JSON[_0x70ba('0x52')](_0xd7638f[_0x70ba('0x16')][_0x529e38][_0x70ba('0x6f')]),JSON[_0x70ba('0x52')](_[_0x70ba('0x70')](_0xd7638f[_0x70ba('0x16')][_0x529e38],['contactId',_0x70ba('0x71'),_0x70ba('0x72'),_0x70ba('0x73')])));return ami[_0x70ba('0x74')]({'action':'status','channel':_0xd7638f['actions'][_0x529e38]['channel']})[_0x70ba('0x75')](function(_0x32b54f){if(_0x32b54f['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0xd7638f[_0x70ba('0x16')][_0x529e38]){ut[_0x70ba('0x76')](_0xd7638f[_0x70ba('0x14')][_0xd7638f[_0x70ba('0x16')][_0x529e38][_0x70ba('0x6d')]],_0x70ba('0x77'));if(_0xd7638f[_0x70ba('0x16')][_0x529e38]['dialAnswer']===!![]){ut['decrementTalkink'](_0xd7638f[_0x70ba('0x14')][_0xd7638f[_0x70ba('0x16')][_0x529e38][_0x70ba('0x6d')]],_0x70ba('0x77'));ut['loggerError'](_0x70ba('0x78')+_0x529e38,_0xd7638f[_0x70ba('0x16')][_0x529e38]['queue']);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x529e38,_0xd7638f['actions'][_0x529e38][_0x70ba('0x6d')]);delete _0xd7638f[_0x70ba('0x16')][_0x529e38];}},0x2328);}});}});};Preview[_0x70ba('0x60')]['clearZombieChannels']=function(){var _0x30a1b3=this;loggerAction[_0x70ba('0x54')](_0x70ba('0x79'),_['size'](this[_0x70ba('0x16')]));for(var _0x7ebcc5 in this['actions']){if(_0x30a1b3['actions'][_0x70ba('0x62')](_0x7ebcc5)){_0x30a1b3[_0x70ba('0x68')](_0x7ebcc5);}}};Preview[_0x70ba('0x60')][_0x70ba('0x67')]=function(_0x10e824){var _0x3717a0=this;rpcDb[_0x70ba('0x7a')](_0x10e824['id'],ut['agentReadyId'](this[_0x70ba('0x17')]))[_0x70ba('0x7b')](function(_0x4de412){if(!_['isNil'](_0x4de412)){for(var _0x137b7d=0x0;_0x137b7d<_0x4de412[_0x70ba('0x7c')];_0x137b7d+=0x1){if(ut['getDiff'](_0x4de412[_0x137b7d]['scheduledat'])<_0x10e824[_0x70ba('0x7d')]*0x3c){if(_0x4de412[_0x137b7d]['Agent']&&!_0x4de412[_0x137b7d]['Agent'][_0x70ba('0x7e')]){_0x3717a0[_0x70ba('0x7f')](_0x4de412[_0x137b7d]['id'])[_0x70ba('0x7b')](ut[_0x70ba('0x80')](_0x70ba('0x81')))[_0x70ba('0x75')](ut[_0x70ba('0x80')]('[RecallMe]'));}else{rpcDb[_0x70ba('0x82')](_0x4de412[_0x137b7d]['id']);}}else{var _0x46b32a=new Action(_0x4de412[_0x137b7d],_0x10e824);_0x46b32a[_0x70ba('0x83')]=moment()[_0x70ba('0x53')](_0x70ba('0x84'));_0x10e824[_0x70ba('0x85')]+=0x1;ut['logCustomer'](_0x46b32a,0x17,_0x70ba('0x86'));if(_0x10e824['dialRecallInQueue']){rpcDb[_0x70ba('0x87')](ut['createBody'](_0x4de412[_0x137b7d]));rpcDb[_0x70ba('0x88')](_0x46b32a,_0x70ba('0x89'));}else{ut[_0x70ba('0x8a')](_0x46b32a,0x16,_0x70ba('0x8b'));rpcDb[_0x70ba('0x88')](_0x46b32a,_0x70ba('0x8c'));rpcDb['createCustomerFinal'](_0x46b32a,_0x70ba('0x8c'));}}}}})['catch'](ut['logger2'](_0x70ba('0x8d')));};Preview[_0x70ba('0x60')]['setMessage']=function(_0x208333){_0x208333['sendMessageOneNotActive']=!![];if(ut[_0x70ba('0x8e')](_0x208333[_0x70ba('0x8f')])){_0x208333[_0x70ba('0x5b')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x70ba('0x90')](_0x208333['dialActive'])){_0x208333[_0x70ba('0x5b')]='NOT_ACTIVE';}else if(!this[_0x70ba('0x91')](_0x208333[_0x70ba('0x4e')])){if(!this[_0x70ba('0x91')](_0x208333[_0x70ba('0x92')])){_0x208333['message']=_0x70ba('0x93');}else{_0x208333['message']=_0x70ba('0x94');}}else{_0x208333[_0x70ba('0x5b')]=_0x70ba('0x94');}emitCampaignPreview(_0x208333);};Preview[_0x70ba('0x60')]['callProgressDetectingCustomer']=function(_0x101c11,_0x90d90c,_0x3a2132){var _0x353918=this;var _0x14c761=this[_0x70ba('0x16')][_0x90d90c];var _0x2f3b29=this[_0x70ba('0x14')][_0x14c761['queue']];var _0x8b243b;if(_0x2f3b29){switch(_0x3a2132){case'1':_0x2f3b29[_0x70ba('0x3c')]+=0x1;_0x14c761[_0x70ba('0x95')]+=0x1;_0x14c761[_0x70ba('0x96')]=ut[_0x70ba('0x97')](_0x14c761);ut[_0x70ba('0x8a')](_0x14c761,0x0,_0x70ba('0x98'));ami['emit'](_0x70ba('0x99'),ut[_0x70ba('0x9a')](_0x14c761,_0x70ba('0x9b')));rpcDb[_0x70ba('0x88')](_0x14c761,_0x70ba('0x9c'));if(ut[_0x70ba('0x97')](_0x14c761)>=_0x2f3b29[_0x70ba('0x9d')]){_0x8b243b=ut[_0x70ba('0x9e')](_0x14c761,0xf,'Global');rpcDb['createCustomerFinal'](_0x8b243b,_0x70ba('0x9f'));}else{if(_0x14c761[_0x70ba('0x95')]>=_0x2f3b29[_0x70ba('0xa0')]){rpcDb['createCustomerFinal'](_0x14c761,_0x70ba('0x9f'));}else{rpcDb[_0x70ba('0xa1')](ut[_0x70ba('0xa2')](_0x14c761,'countnosuchnumberretry',_0x2f3b29[_0x70ba('0xa3')]),_0x14c761[_0x70ba('0xa4')],_0x14c761[_0x70ba('0xa5')]);}}delete this[_0x70ba('0x16')][_0x101c11[_0x70ba('0xa6')]];break;case _0x70ba('0xa7'):var _0x22e520=moment()['format'](_0x70ba('0x84'));_0x14c761['responsetime']=_0x22e520;_0x14c761['answertime']=_0x22e520;_0x14c761[_0x70ba('0x6f')]=!![];_0x2f3b29[_0x70ba('0x59')]+=0x1;logger[_0x70ba('0x54')](_0x70ba('0xa8'),_0x14c761[_0x70ba('0xa9')],_0x70ba('0xaa'),_0x2f3b29[_0x70ba('0x2b')],_0x70ba('0x6e'),_0x2f3b29['pTalking']);ami[_0x70ba('0x28')](_0x70ba('0xab'),ut[_0x70ba('0x9a')](_0x14c761,'connect',this['campaignsPreview'][_0x14c761['queue']]));if(_0x2f3b29[_0x70ba('0xac')]){ami['emit']('custom:agentConnectPreview',ut['buildAcw'](_0x14c761));}break;case'16':ami[_0x70ba('0x28')](_0x70ba('0xad'),ut[_0x70ba('0x9a')](_0x14c761,_0x70ba('0xae'),this[_0x70ba('0x14')][_0x14c761['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x14c761,_0x70ba('0xae')));_0x2f3b29[_0x70ba('0x38')]+=0x1;_0x2f3b29['total']+=0x1;_0x2f3b29[_0x70ba('0xaf')]+=0x1;ut[_0x70ba('0xb0')](_0x2f3b29,_0x70ba('0xb1'));_0x14c761['countglobal']=ut[_0x70ba('0x97')](_0x14c761);ut['logCustomer'](_0x14c761,0x4,_0x70ba('0xb2'));rpcDb[_0x70ba('0x88')](_0x14c761,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x70ba('0xb3')](_0x14c761,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x70ba('0xb4')](_0x14c761);_0x2f3b29[_0x70ba('0xb5')]+=_0x14c761['talktime'];_0x2f3b29[_0x70ba('0x2e')]+=_0x14c761[_0x70ba('0xb6')];logger[_0x70ba('0x54')](_0x70ba('0xb7'),_0x14c761[_0x70ba('0xa9')],_0x70ba('0xaa'),_0x2f3b29[_0x70ba('0x2b')],_0x70ba('0x6e'),_0x2f3b29[_0x70ba('0x59')]);delete this[_0x70ba('0x16')][_0x101c11['linkedid']];break;case _0x70ba('0xb8'):_0x2f3b29[_0x70ba('0x3a')]+=0x1;_0x14c761[_0x70ba('0xb9')]+=0x1;_0x14c761[_0x70ba('0x96')]=ut['totalGlobal'](_0x14c761);ut[_0x70ba('0x8a')](_0x14c761,0x5,'Busy');ami[_0x70ba('0x28')]('custom:agentbusy',ut[_0x70ba('0x9a')](_0x14c761,_0x70ba('0xba')));rpcDb['createCustomerHistory'](_0x14c761,_0x70ba('0xbb'));if(ut[_0x70ba('0x97')](_0x14c761)>=_0x2f3b29[_0x70ba('0x9d')]){_0x8b243b=ut[_0x70ba('0x9e')](_0x14c761,0xf,_0x70ba('0xbc'));rpcDb[_0x70ba('0xb3')](_0x8b243b,_0x70ba('0xbd'));}else{if(_0x14c761[_0x70ba('0xb9')]>=_0x2f3b29['dialBusyMaxRetry']){rpcDb[_0x70ba('0xb3')](_0x14c761,_0x70ba('0xbb'));}else{rpcDb[_0x70ba('0xa1')](ut[_0x70ba('0xa2')](_0x14c761,_0x70ba('0xb9'),_0x2f3b29[_0x70ba('0xbe')]),_0x14c761[_0x70ba('0xa4')],_0x14c761[_0x70ba('0xa5')]);}}break;case'NOANSWER':_0x2f3b29[_0x70ba('0xbf')]+=0x1;_0x14c761[_0x70ba('0xc0')]+=0x1;_0x14c761[_0x70ba('0x96')]=ut['totalGlobal'](_0x14c761);ut[_0x70ba('0x8a')](_0x14c761,0x3,_0x70ba('0xc1'));ami[_0x70ba('0x28')]('custom:agentnoanswer',ut['buildObj'](_0x14c761,_0x70ba('0xc2')));rpcDb['createCustomerHistory'](_0x14c761,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x70ba('0x97')](_0x14c761)>=_0x2f3b29[_0x70ba('0x9d')]){_0x8b243b=ut[_0x70ba('0x9e')](_0x14c761,0xf,_0x70ba('0xbc'));rpcDb[_0x70ba('0xb3')](_0x8b243b,_0x70ba('0xc3'));}else{if(_0x14c761['countnoanswerretry']>=_0x2f3b29['dialNoAnswerMaxRetry']){rpcDb[_0x70ba('0xb3')](_0x14c761,_0x70ba('0xc4'));}else{rpcDb[_0x70ba('0xa1')](ut[_0x70ba('0xa2')](_0x14c761,'countnoanswerretry',_0x2f3b29[_0x70ba('0xc5')]),_0x14c761[_0x70ba('0xa4')],_0x14c761[_0x70ba('0xa5')]);}}break;case _0x70ba('0xc6'):_0x2f3b29[_0x70ba('0xc7')]+=0x1;_0x14c761[_0x70ba('0xc8')]+=0x1;_0x14c761[_0x70ba('0x96')]=ut[_0x70ba('0x97')](_0x14c761);ut[_0x70ba('0x8a')](_0x14c761,0x8,_0x70ba('0xc9'));ami[_0x70ba('0x28')](_0x70ba('0xca'),ut[_0x70ba('0x9a')](_0x14c761,_0x70ba('0xcb')));rpcDb['createCustomerHistory'](_0x14c761,_0x70ba('0xcc'));if(ut[_0x70ba('0x97')](_0x14c761)>=_0x2f3b29[_0x70ba('0x9d')]){_0x8b243b=ut['cloneAction'](_0x14c761,0xf,'Global');rpcDb['createCustomerFinal'](_0x8b243b,_0x70ba('0xcd'));}else{if(_0x14c761[_0x70ba('0xc8')]>=_0x2f3b29[_0x70ba('0xce')]){rpcDb[_0x70ba('0xb3')](_0x14c761,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x70ba('0xa1')](ut[_0x70ba('0xa2')](_0x14c761,_0x70ba('0xc8'),_0x2f3b29[_0x70ba('0xbe')]),_0x14c761['unlockAgent'],_0x14c761['activeContact']);}}break;case'CANCEL':_0x2f3b29[_0x70ba('0xcf')]+=0x1;_0x14c761['countagentrejectretry']+=0x1;_0x14c761[_0x70ba('0x96')]=ut['totalGlobal'](_0x14c761);ut[_0x70ba('0x8a')](_0x14c761,0x14,_0x70ba('0xd0'));ami['emit']('custom:agentreject',ut[_0x70ba('0x9a')](_0x14c761,'agentreject'));rpcDb['createCustomerHistory'](_0x14c761,_0x70ba('0xd1'));if(ut[_0x70ba('0x97')](_0x14c761)>=_0x2f3b29[_0x70ba('0x9d')]){_0x8b243b=ut[_0x70ba('0x9e')](_0x14c761,0x14,_0x70ba('0xd0'));rpcDb[_0x70ba('0xb3')](_0x8b243b,_0x70ba('0xd2'));}else{if(_0x14c761[_0x70ba('0xd3')]>=_0x2f3b29[_0x70ba('0xd4')]){rpcDb[_0x70ba('0xb3')](_0x14c761,_0x70ba('0xd2'));}else{rpcDb[_0x70ba('0xa1')](ut[_0x70ba('0xa2')](_0x14c761,_0x70ba('0xd3'),_0x2f3b29[_0x70ba('0xd5')]),_0x14c761['unlockAgent'],_0x14c761[_0x70ba('0xa5')]);}}break;case _0x70ba('0xd6'):_0x2f3b29[_0x70ba('0xd7')]+=0x1;_0x14c761['countabandonedretry']+=0x1;_0x14c761[_0x70ba('0x96')]=ut[_0x70ba('0x97')](_0x14c761);ut['logCustomer'](_0x14c761,0xb,_0x70ba('0xd8'));rpcDb['createCustomerHistory'](_0x14c761,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x70ba('0x97')](_0x14c761)>=_0x2f3b29['dialGlobalMaxRetry']){_0x8b243b=ut[_0x70ba('0x9e')](_0x14c761,0xf,'Global');rpcDb[_0x70ba('0xb3')](_0x8b243b,_0x70ba('0xd9'));}else{if(_0x14c761[_0x70ba('0xda')]>=_0x2f3b29[_0x70ba('0xdb')]){rpcDb[_0x70ba('0xb3')](_0x14c761,_0x70ba('0xd9'));}else{rpcDb[_0x70ba('0xa1')](ut[_0x70ba('0xa2')](_0x14c761,_0x70ba('0xdc'),_0x2f3b29['dialAbandonedRetryFrequency']),_0x14c761[_0x70ba('0xa4')],_0x14c761['activeContact']);}}break;case'18':_0x2f3b29[_0x70ba('0x3e')]+=0x1;_0x14c761[_0x70ba('0xdd')]+=0x1;_0x14c761[_0x70ba('0x96')]=ut[_0x70ba('0x97')](_0x14c761);ut[_0x70ba('0x8a')](_0x14c761,0x12,_0x101c11[_0x70ba('0xde')]||_0x101c11[_0x70ba('0xdf')]);ami[_0x70ba('0x28')](_0x70ba('0xe0'),ut['buildObj'](_0x14c761,'amd'));rpcDb['createCustomerHistory'](_0x14c761,_0x70ba('0xe1'));if(ut['totalGlobal'](_0x14c761)>=_0x2f3b29[_0x70ba('0x9d')]){_0x8b243b=ut[_0x70ba('0x9e')](_0x14c761,0xf,_0x70ba('0xbc'));rpcDb['createCustomerFinal'](_0x8b243b,_0x70ba('0xe1'));}else{rpcDb[_0x70ba('0xb3')](_0x14c761,_0x70ba('0xe1'));}delete this[_0x70ba('0x16')][_0x101c11[_0x70ba('0xa6')]];break;case'19':_0x2f3b29[_0x70ba('0x3e')]+=0x1;_0x14c761['countglobal']=ut['totalGlobal'](_0x14c761);ut[_0x70ba('0x8a')](_0x14c761,0x13,_0x101c11[_0x70ba('0xde')]||_0x101c11['dialstatus']);ami[_0x70ba('0x28')]('custom:amd',ut[_0x70ba('0x9a')](_0x14c761,_0x70ba('0xe2')));rpcDb['createCustomerHistory'](_0x14c761,_0x70ba('0xe3'));if(ut[_0x70ba('0x97')](_0x14c761)>=_0x2f3b29[_0x70ba('0x9d')]){_0x8b243b=ut[_0x70ba('0x9e')](_0x14c761,0xf,'Global');rpcDb[_0x70ba('0xb3')](_0x8b243b,_0x70ba('0xe3'));}else{rpcDb[_0x70ba('0xb3')](_0x14c761,_0x70ba('0xe3'));}delete this['actions'][_0x101c11[_0x70ba('0xa6')]];break;default:if(_0x14c761[_0x70ba('0x6f')]){ut[_0x70ba('0xb0')](_0x2f3b29,_0x70ba('0xe4'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x2f3b29[_0x70ba('0x2b')],_0x101c11);}_0x2f3b29[_0x70ba('0x3e')]+=0x1;_0x14c761['countglobal']=ut[_0x70ba('0x97')](_0x14c761);ut[_0x70ba('0x8a')](_0x14c761,0xc,_0x101c11[_0x70ba('0xde')]||_0x101c11[_0x70ba('0xdf')]);rpcDb[_0x70ba('0x88')](_0x14c761,_0x70ba('0xe5'));if(ut[_0x70ba('0x97')](_0x14c761)>=_0x2f3b29[_0x70ba('0x9d')]){_0x8b243b=ut[_0x70ba('0x9e')](_0x14c761,0xf,_0x70ba('0xbc'));rpcDb[_0x70ba('0xb3')](_0x8b243b,_0x70ba('0xe6'));}else{rpcDb[_0x70ba('0xb3')](_0x14c761,_0x70ba('0xe6'));}delete this[_0x70ba('0x16')][_0x101c11[_0x70ba('0xa6')]];}if(!(_0x14c761[_0x70ba('0x6f')]&&_0x3a2132==='16')){ut['updateOriginated'](_0x2f3b29,_0x70ba('0xe7'));logger[_0x70ba('0x54')](_0x70ba('0xe8'),_0x14c761[_0x70ba('0xa9')],_0x70ba('0xaa'),_0x2f3b29[_0x70ba('0x2b')],_0x70ba('0xe9'),_0x2f3b29['originated']);}if(_0x3a2132!=='ANSWER'){delete this[_0x70ba('0x16')][_0x101c11['linkedid']];delete this[_0x70ba('0x16')][_0x101c11[_0x70ba('0xea')]];}}};Preview[_0x70ba('0x60')][_0x70ba('0xeb')]=function(_0x3a01e9,_0x4109c8,_0x370cb4){if(_['isUndefined'](_0x4109c8)&&_0x70ba('0xec')!==typeof _0x4109c8){return;}if(_[_0x70ba('0xed')](_0x370cb4)&&_0x70ba('0xec')!==typeof _0x370cb4){return;}switch(_0x370cb4[_0x70ba('0xee')]){case'0':ut[_0x70ba('0xef')](_0x3a01e9,0x0,_0x70ba('0x98'));rpcDb['createAgentHistory'](_0x3a01e9,_0x70ba('0xf0'));break;case'3':ut[_0x70ba('0xef')](_0x3a01e9,0x3,_0x70ba('0xc1'));rpcDb[_0x70ba('0xf1')](_0x3a01e9,_0x70ba('0xf2'));break;case'5':ut[_0x70ba('0xef')](_0x3a01e9,0x5,_0x70ba('0xf3'));rpcDb['createAgentHistory'](_0x3a01e9,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x70ba('0xef')](_0x3a01e9,0x8,_0x70ba('0xc9'));rpcDb['createAgentHistory'](_0x3a01e9,_0x70ba('0xf4'));break;case'22':ut['logAgent'](_0x3a01e9,0x16,_0x70ba('0xf5'));rpcDb[_0x70ba('0xf1')](_0x3a01e9,_0x70ba('0xf6'));break;default:ut[_0x70ba('0xef')](_0x3a01e9,0xc,_0x370cb4[_0x70ba('0xee')]);rpcDb[_0x70ba('0xf1')](_0x3a01e9,_0x70ba('0xf4'));}ut[_0x70ba('0x76')](_0x4109c8,_0x70ba('0xf7'));logger['info'](_0x70ba('0xf8'),_0x3a01e9[_0x70ba('0xa9')],_0x70ba('0xaa'),_0x4109c8['name'],_0x70ba('0xe9'),_0x4109c8[_0x70ba('0x4a')]);delete this['actions'][_0x3a01e9[_0x70ba('0xa9')]];};Preview[_0x70ba('0x60')][_0x70ba('0xf9')]=function(_0x43a657,_0x45e2fb,_0x3016dd,_0x1dc54c,_0x3732f0){var _0x2baf5d=this;return new BPromise(function(_0x48c6c0,_0x36bdb4){if(_[_0x70ba('0x6a')](_0x45e2fb)||_[_0x70ba('0x6a')](_0x45e2fb['Contact'])||_[_0x70ba('0x6a')](_0x45e2fb['Contact'][_0x70ba('0xfa')])||_[_0x70ba('0x6a')](_0x45e2fb['VoiceQueueId'])){_0x36bdb4(ut['message']('Contact\x20is\x20undefined',_0x1dc54c,_0x3732f0));return;}var _0x28e339=uuid['v4']();var _0x43aba3=_0x2baf5d[_0x70ba('0x14')][_0x45e2fb[_0x70ba('0x6c')][_0x70ba('0x2b')]];var _0x5cb03a=_0x3016dd?_0x2baf5d['agents'][_0x3016dd]['id']:undefined;_0x2baf5d[_0x70ba('0x16')][_0x28e339]=new Action(_0x45e2fb,_0x43aba3,_0x28e339,_0x3016dd,_0x5cb03a);var _0x5830c4=_0x2baf5d[_0x70ba('0x16')][_0x28e339];_0x5830c4[_0x70ba('0xa4')]=_0x1dc54c;_0x5830c4[_0x70ba('0xa5')]=_0x3732f0;_0x5830c4[_0x70ba('0xfb')]=_0x3016dd;if(_[_0x70ba('0xfc')](_0x43a657)){_0x2baf5d[_0x70ba('0xfd')](_0x5830c4,_0x43aba3,_0x45e2fb,_0x3016dd)[_0x70ba('0x7b')](function(_0x3d82d5){logger[_0x70ba('0x54')](_0x70ba('0xfe'),_0x70ba('0xff')+_0x5830c4[_0x70ba('0x6d')]+_0x70ba('0x100')+_0x5830c4[_0x70ba('0x101')],JSON[_0x70ba('0x52')](_0x3d82d5));ami[_0x70ba('0x28')]('custom:agentcalled',ut[_0x70ba('0x9a')](_0x5830c4,'called',_0x2baf5d[_0x70ba('0x14')][_0x5830c4['queue']]));_0x48c6c0(ut[_0x70ba('0x5b')](_0x70ba('0x102')));})['catch'](function(_0x296bc9){ut[_0x70ba('0x5d')](_0x70ba('0x103'),_0x296bc9);_0x36bdb4(ut[_0x70ba('0x5b')](_0x70ba('0x104'),_0x1dc54c,_0x3732f0));});}else{_0x43aba3[_0x70ba('0x39')]+=0x1;ut[_0x70ba('0x105')](_0x5830c4);rpcDb[_0x70ba('0x106')](_0x5830c4,_0x70ba('0x107'));delete _0x2baf5d[_0x70ba('0x16')][_0x28e339];_0x36bdb4(ut[_0x70ba('0x5b')]('Contact\x20in\x20black\x20List',_0x1dc54c,_0x3732f0));}});};Preview[_0x70ba('0x60')][_0x70ba('0x91')]=function(_0x1e1133){return!_['isNil'](_0x1e1133)&&!_[_0x70ba('0x6a')](_0x1e1133['name'])&&!_[_0x70ba('0x6a')](_0x1e1133['active'])&&_0x1e1133[_0x70ba('0x4f')]&&!_[_0x70ba('0x6a')](this[_0x70ba('0x15')][util[_0x70ba('0x53')](_0x70ba('0x108'),_0x1e1133[_0x70ba('0x2b')])])&&!_[_0x70ba('0x6a')](this[_0x70ba('0x15')][util[_0x70ba('0x53')](_0x70ba('0x108'),_0x1e1133['name'])]['status'])&&(this['trunks'][util[_0x70ba('0x53')](_0x70ba('0x108'),_0x1e1133[_0x70ba('0x2b')])][_0x70ba('0x109')]==='reachable'||this[_0x70ba('0x15')][util[_0x70ba('0x53')](_0x70ba('0x108'),_0x1e1133[_0x70ba('0x2b')])]['status']===_0x70ba('0x10a'));};Preview[_0x70ba('0x60')]['run']=function(_0x13ce5d,_0x45a1f0){var _0x5d596a=this;return new BPromise(function(_0x20e690,_0x57a62f){_0x5d596a[_0x70ba('0x10b')](_0x13ce5d,_0x45a1f0)[_0x70ba('0x7b')](function(_0x32f8fd){_0x20e690(_[_0x70ba('0x70')](_0x32f8fd,['message']));})[_0x70ba('0x75')](function(_0x26f86f){if(_0x26f86f[_0x70ba('0x10c')]){rpcDb[_0x70ba('0x10d')](_0x13ce5d);}if(_0x26f86f[_0x70ba('0x4f')]){rpcDb['disableContact'](_0x13ce5d);}_0x57a62f(_[_0x70ba('0x70')](_0x26f86f,[_0x70ba('0x5b')]));});});};Preview['prototype'][_0x70ba('0x10b')]=function(_0x7d0cfa,_0x234fed){var _0x1b492c=this;return new BPromise(function(_0x2fcee0,_0x484ce6){var _0x17e3b4,_0x5cfc51;rpcDb['getContactPreview'](_0x7d0cfa)[_0x70ba('0x7b')](function(_0x1e1b11){if(!_['isNil'](_0x1e1b11[0x0])){_0x5cfc51=_0x1e1b11[0x0][_0x70ba('0x10e')]?![]:!![];_0x17e3b4=_0x1e1b11[0x0][_0x70ba('0x10e')]?!![]:![];_0x17e3b4=_0x234fed?!![]:_0x17e3b4;}var _0x4ad225=_0x1b492c['validateContact'](_0x1e1b11);if(_0x4ad225[_0x70ba('0x10f')]){rpcDb['checkIsBlackList'](_[_0x70ba('0x70')](_0x1e1b11[0x0],[_0x70ba('0x72'),_0x70ba('0x110')]))[_0x70ba('0x7b')](function(_0x54fa03){_0x1b492c[_0x70ba('0xf9')](_0x54fa03,_0x1e1b11[0x0],_0x234fed,_0x5cfc51,_0x17e3b4)[_0x70ba('0x7b')](function(_0x2c40c3){_0x2fcee0(_0x2c40c3);})[_0x70ba('0x75')](function(_0x45bde8){_0x484ce6(_0x45bde8);});})['catch'](function(_0xe76d93){ut['logger'](_0x70ba('0x111'),_0xe76d93);_0x484ce6(ut[_0x70ba('0x5b')]('Call\x20unsuccessful',_0x5cfc51,_0x17e3b4));});}else{_0x484ce6(ut[_0x70ba('0x5b')](_0x4ad225[_0x70ba('0x5b')],_0x5cfc51,_0x17e3b4));}})[_0x70ba('0x75')](function(_0x46d97c){ut[_0x70ba('0x5d')]('[Preview][getContactPreview]',_0x46d97c);_0x484ce6(ut[_0x70ba('0x5b')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x70ba('0x60')][_0x70ba('0x112')]=function(_0x29b478){if(_[_0x70ba('0x6a')](_0x29b478)||_[_0x70ba('0xfc')](_0x29b478)||!_[_0x70ba('0x6a')](_0x29b478[0x0]['Agent'])&&_[_0x70ba('0x6a')](_0x29b478[0x0][_0x70ba('0x113')][_0x70ba('0x2b')])){ut[_0x70ba('0x5d')]('[Preview][validateContact][Empty\x20Contact]',_0x29b478);return{'isValid':![],'message':_0x70ba('0x114')};}var _0x130a16=this[_0x70ba('0x14')][_0x29b478[0x0][_0x70ba('0x6c')][_0x70ba('0x2b')]];_0x130a16['message']=_0x70ba('0x94');if(_[_0x70ba('0x6a')](_0x130a16)){ut[_0x70ba('0x5d')](_0x70ba('0x115'),_0x130a16);return{'isValid':![],'message':_0x70ba('0x116')};}if(!this['isTrunkReachable'](_0x130a16[_0x70ba('0x4e')])){ut[_0x70ba('0x5d')](_0x70ba('0x117'),_0x70ba('0x118')+_0x130a16['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x70ba('0x91')](_0x130a16[_0x70ba('0x92')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x130a16[_0x70ba('0x2b')]+_0x70ba('0x119'));return{'isValid':![],'message':_0x70ba('0x11a')};}}if(!ut['isActive'](_0x130a16[_0x70ba('0x32')])){ut['logger'](_0x70ba('0x11b'),_0x130a16[_0x70ba('0x2b')]+_0x70ba('0x11c'));return{'isValid':![],'message':_0x70ba('0x118')+_0x130a16[_0x70ba('0x2b')]+_0x70ba('0x11c')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x70ba('0x60')]['execCall']=function(_0x32cabd,_0x1811cd,_0x296c66,_0xa5dc50){var _0x1025d8=this;return new BPromise(function(_0x1cf059,_0x37a6b1){var _0x1e08dd=_0x32cabd[_0x70ba('0xa9')];var _0x288811=_0x1025d8[_0x70ba('0x91')](_0x1811cd[_0x70ba('0x4e')])?util[_0x70ba('0x53')](_0x70ba('0x11d'),_0x1811cd[_0x70ba('0x4e')]['name'],_['isNil'](_0x1811cd[_0x70ba('0x37')])?'':_0x1811cd[_0x70ba('0x37')][_0x70ba('0x11e')]()||'',_0x1811cd[_0x70ba('0x11f')]>0x0?_0x296c66[_0x70ba('0x120')][_0x70ba('0xfa')][_0x70ba('0x121')](_0x1811cd[_0x70ba('0x11f')]):_0x296c66[_0x70ba('0x120')][_0x70ba('0xfa')]):util['format'](_0x70ba('0x11d'),_[_0x70ba('0x6a')](_0x1811cd[_0x70ba('0x92')])?_0x1811cd[_0x70ba('0x4e')][_0x70ba('0x2b')]:_0x1811cd[_0x70ba('0x92')][_0x70ba('0x2b')],_[_0x70ba('0x6a')](_0x1811cd[_0x70ba('0x37')])?'':_0x1811cd[_0x70ba('0x37')][_0x70ba('0x11e')]()||'',_0x1811cd[_0x70ba('0x11f')]>0x0?_0x296c66[_0x70ba('0x120')][_0x70ba('0xfa')]['substring'](_0x1811cd[_0x70ba('0x11f')]):_0x296c66[_0x70ba('0x120')][_0x70ba('0xfa')]);var _0x4871d9=_0x1025d8[_0x70ba('0x91')](_0x1811cd[_0x70ba('0x4e')])?ut[_0x70ba('0x122')](_0x1811cd[_0x70ba('0x4e')][_0x70ba('0x50')],_0x1811cd['dialOriginateCallerIdName'],_0x1811cd['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x70ba('0x123')](_0x1811cd[_0x70ba('0x35')],_0x1811cd['dialRandomLastDigitCallerIdNumber']):_0x1811cd[_0x70ba('0x35')]):ut[_0x70ba('0x122')](_['isNil'](_0x1811cd[_0x70ba('0x92')])?_0x1811cd[_0x70ba('0x4e')][_0x70ba('0x50')]:_0x1811cd['TrunkBackup'][_0x70ba('0x50')],_0x1811cd[_0x70ba('0x34')],_0x1811cd[_0x70ba('0x124')]>0x0?ut[_0x70ba('0x123')](_0x1811cd['dialOriginateCallerIdNumber'],_0x1811cd[_0x70ba('0x124')]):_0x1811cd['dialOriginateCallerIdNumber']);if(_0x4871d9){_0x32cabd['originatecalleridname']=ut[_0x70ba('0x125')](_0x4871d9);_0x32cabd[_0x70ba('0x126')]=ut[_0x70ba('0x127')](_0x4871d9);}var _0x4488ac=ut[_0x70ba('0x128')](_0x1811cd,_0x296c66,_0x288811,_0x4871d9,_0x1e08dd,_0x32cabd);_[_0x70ba('0x129')](_0x32cabd,ut[_0x70ba('0x12a')](_0x4488ac));_0x32cabd[_0x70ba('0x83')]=moment()['format'](_0x70ba('0x84'));ami[_0x70ba('0x74')](ut[_0x70ba('0x12b')](_0x32cabd,_0x1811cd,_0x4488ac,_0x32cabd[_0x70ba('0xa5')],_0xa5dc50))['then'](function(_0x2ffc7f){_0x1811cd['originated']+=0x1;logger['info']('[originated][increment]',_0x1e08dd,'\x20Queue',_0x1811cd[_0x70ba('0x2b')],_0x70ba('0xe9'),_0x1811cd['originated']);_0x1cf059(_0x2ffc7f);})[_0x70ba('0x75')](function(_0x101f0c){ut[_0x70ba('0xef')](_0x32cabd,0xe,_0x70ba('0x12c'));rpcDb[_0x70ba('0xf1')](_0x32cabd,_0x70ba('0x12d'));_0x37a6b1(_0x101f0c);});});};Preview['prototype'][_0x70ba('0x22')]=function(_0xba9e86){if(this[_0x70ba('0x16')][_0xba9e86[_0x70ba('0xa6')]]){this['actions'][_0xba9e86['linkedid']][_0x70ba('0x12e')]=_0xba9e86[_0x70ba('0x12e')];}};Preview[_0x70ba('0x60')][_0x70ba('0x19')]=function(_0x4aa467){var _0x4f0cc2=this;var _0x5b4710=this[_0x70ba('0x16')][_0x4aa467['actionid']];if(_0x5b4710){if(_0x5b4710['lookAgent']&&this[_0x70ba('0x17')][_0x5b4710[_0x70ba('0xfb')]]){ut[_0x70ba('0x12f')](_0x5b4710,this['agents'][_0x5b4710['lookAgent']]['name'],this[_0x70ba('0x17')][_0x5b4710[_0x70ba('0xfb')]]['id']);}var _0xe41962=_[_0x70ba('0x130')](_0x5b4710);_0xe41962['responsetime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x2b8e7d=_0x4f0cc2['campaignsPreview'][_0x5b4710['queue']];if(ut[_0x70ba('0x131')](_0x4aa467[_0x70ba('0x132')])){if(_0x5b4710['unlockAgent']){rpcDb['unlockContact'](_0x5b4710[_0x70ba('0x101')]);}if(_0x5b4710[_0x70ba('0xa5')]){rpcDb[_0x70ba('0x82')](_0x5b4710['idContact']);}ami[_0x70ba('0x28')](_0x70ba('0x133'),ut['buildObj'](_0x5b4710,'rejected',this[_0x70ba('0x14')][_0x5b4710['queue']]));this[_0x70ba('0xeb')](_0xe41962,_0x2b8e7d,_0x4aa467);}else{_0x5b4710[_0x70ba('0x83')]=moment()[_0x70ba('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x70ba('0xef')](_0xe41962,0x4,_0x70ba('0xb2'));rpcDb[_0x70ba('0xf1')](_0xe41962,_0x70ba('0x134'));}}};Preview[_0x70ba('0x60')][_0x70ba('0x1c')]=function(_0x1b21cf){var _0x2ba231=this;var _0x17d5e0=this['actions'][_0x1b21cf[_0x70ba('0xa6')]];var _0x5da6f3;if(_0x17d5e0){_0x5da6f3=this[_0x70ba('0x14')][_0x17d5e0['queue']];logger['info']('[syncHangup][talking]',_0x1b21cf[_0x70ba('0xa6')],_0x70ba('0xaa'),_0x5da6f3[_0x70ba('0x2b')],_0x70ba('0x6e'),_0x5da6f3[_0x70ba('0x59')]);}if(this[_0x70ba('0x16')][_0x1b21cf[_0x70ba('0xa6')]]&&_0x1b21cf[_0x70ba('0xa6')]!==_0x1b21cf[_0x70ba('0xa9')]){if(_0x1b21cf[_0x70ba('0x135')]==='16'&&this[_0x70ba('0x16')][_0x1b21cf[_0x70ba('0xa6')]]['dialAnswer']){this[_0x70ba('0x136')](_0x1b21cf,_0x1b21cf[_0x70ba('0xa6')],_0x1b21cf[_0x70ba('0x135')]);}else if(this[_0x70ba('0x16')][_0x1b21cf['linkedid']][_0x70ba('0x6f')]){logger[_0x70ba('0x54')](_0x70ba('0x137'),_0x1b21cf['linkedid'],_0x1b21cf[_0x70ba('0x135')],_0x70ba('0xaa'),_0x5da6f3[_0x70ba('0x2b')],_0x70ba('0x6e'),_0x5da6f3['pTalking']);this[_0x70ba('0x136')](_0x1b21cf,_0x1b21cf['linkedid'],_0x1b21cf[_0x70ba('0x135')]);}}else if(_0x17d5e0&&_[_0x70ba('0x6a')](_0x17d5e0[_0x70ba('0x138')])&&_0x5da6f3[_0x70ba('0x139')]&&_0x1b21cf['linkedid']===_0x1b21cf[_0x70ba('0xa9')]&&_[_0x70ba('0x6a')](_0x1b21cf[_0x70ba('0xee')])&&_0x1b21cf['cause']==='16'&&_0x1b21cf[_0x70ba('0x13a')]==='6'&&_[_0x70ba('0xed')](_0x17d5e0[_0x70ba('0x13b')])){if(_0x17d5e0[_0x70ba('0xa4')]){rpcDb[_0x70ba('0x10d')](_0x17d5e0[_0x70ba('0x101')]);}if(_0x17d5e0[_0x70ba('0xa5')]){rpcDb[_0x70ba('0x82')](_0x17d5e0[_0x70ba('0x101')]);}_0x1b21cf['reason']='22';this[_0x70ba('0xeb')](_0x17d5e0,_0x5da6f3,_0x1b21cf);}else if(_0x17d5e0&&_0x17d5e0['transfer']){if(_0x1b21cf[_0x70ba('0x135')]==='16'&&this[_0x70ba('0x16')][_0x1b21cf[_0x70ba('0xa6')]][_0x70ba('0x6f')]){logger[_0x70ba('0x54')](_0x70ba('0x13c'),_0x1b21cf[_0x70ba('0xa6')],_0x1b21cf['cause'],'\x20Queue',_0x5da6f3[_0x70ba('0x2b')],_0x70ba('0x6e'),_0x5da6f3[_0x70ba('0x59')]);this[_0x70ba('0x136')](_0x1b21cf,_0x1b21cf[_0x70ba('0xa6')],_0x1b21cf['cause']);}else if(this[_0x70ba('0x16')][_0x1b21cf['linkedid']]['dialAnswer']){logger[_0x70ba('0x54')](_0x70ba('0x137'),_0x1b21cf['linkedid'],_0x1b21cf[_0x70ba('0x135')],'\x20Queue',_0x5da6f3[_0x70ba('0x2b')],_0x70ba('0x6e'),_0x5da6f3[_0x70ba('0x59')]);this['callProgressDetectingCustomer'](_0x1b21cf,_0x1b21cf[_0x70ba('0xa6')],_0x1b21cf[_0x70ba('0x135')]);}}};Preview[_0x70ba('0x60')][_0x70ba('0x20')]=function(_0x13ed34){if(this[_0x70ba('0x16')][_0x13ed34['destlinkedid']]&&_0x13ed34['destlinkedid']!==_0x13ed34[_0x70ba('0x13d')]){this[_0x70ba('0x136')](_0x13ed34,_0x13ed34[_0x70ba('0xea')],_0x13ed34[_0x70ba('0xdf')]);}};Preview[_0x70ba('0x60')][_0x70ba('0x1e')]=function(_0x273095){if(this[_0x70ba('0x16')][_0x273095[_0x70ba('0xa6')]]&&_0x273095['linkedid']!==_0x273095[_0x70ba('0xa9')]&&!this[_0x70ba('0x16')][_0x273095[_0x70ba('0xa6')]][_0x70ba('0x6f')]){if(_0x273095[_0x70ba('0x135')]==='1'){this[_0x70ba('0x136')](_0x273095,_0x273095[_0x70ba('0xa6')],_0x273095['cause']);}}};Preview[_0x70ba('0x60')][_0x70ba('0x13e')]=function(_0x17b77e,_0x393f9f,_0x2b60a3){if(this[_0x70ba('0x16')][_0x17b77e]){if(_[_0x70ba('0x6a')](this[_0x70ba('0x16')][_0x17b77e][_0x70ba('0x13f')])){this[_0x70ba('0x16')][_0x17b77e]['variables']={};}this['actions'][_0x17b77e][_0x70ba('0x13f')][_0x393f9f]=_0x2b60a3;}};Preview[_0x70ba('0x60')][_0x70ba('0x140')]=function(_0x3e42f4){try{if(!_[_0x70ba('0x6a')](_0x3e42f4)){if(ut[_0x70ba('0x141')](_[_0x70ba('0x142')](_0x3e42f4['variable'])[0x0])){this[_0x70ba('0x13e')](_0x3e42f4[_0x70ba('0xa9')],_[_0x70ba('0x142')](_0x3e42f4[_0x70ba('0x143')])[0x0],_0x3e42f4[_0x70ba('0x144')]);}}}catch(_0x241596){logger[_0x70ba('0x145')](_0x70ba('0x146'),util[_0x70ba('0x147')](_0x241596,{'showHidden':![],'depth':null}));}};Preview[_0x70ba('0x60')]['syncAttendedTransfer']=function(_0x50eafc){if(_0x50eafc){if(this[_0x70ba('0x16')][_0x50eafc[_0x70ba('0x148')]]){this[_0x70ba('0x16')][_0x50eafc[_0x70ba('0x148')]][_0x70ba('0x13b')]=!![];}}};Preview[_0x70ba('0x60')][_0x70ba('0x26')]=function(_0x440cb7){if(_0x440cb7){if(this[_0x70ba('0x16')][_0x440cb7[_0x70ba('0x149')]]){this['actions'][_0x440cb7[_0x70ba('0x149')]][_0x70ba('0x13b')]=!![];}}};module[_0x70ba('0x14a')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index d1f4941..ba6ea2f 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 _0xd41b=['rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20'];(function(_0x5f3bfb,_0x2ab7d9){var _0xa3e1a9=function(_0x2fde2c){while(--_0x2fde2c){_0x5f3bfb['push'](_0x5f3bfb['shift']());}};_0xa3e1a9(++_0x2ab7d9);}(_0xd41b,0x198));var _0xbd41=function(_0x2bc04a,_0x7786ee){_0x2bc04a=_0x2bc04a-0x0;var _0x3eb6c7=_0xd41b[_0x2bc04a];return _0x3eb6c7;};'use strict';var util=require(_0xbd41('0x0'));var BPromise=require('bluebird');var logger=require(_0xbd41('0x1'))(_0xbd41('0x2'));var _=require(_0xbd41('0x3'));var cmHopper=require(_0xbd41('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xbd41('0x5'));var cmHopperBlack=require(_0xbd41('0x6'));var voiceQueueRt=require(_0xbd41('0x7'));var agentReportPreview=require(_0xbd41('0x8'));var voiceQueueReport=require(_0xbd41('0x9'));function loggerCatch(_0x5abd83){return function(_0x1cf2d3){logger['error'](_0x5abd83,util[_0xbd41('0xa')](_0x1cf2d3,{'showHidden':![],'depth':null}));};}function create(_0x175e45){return BPromise['resolve']()[_0xbd41('0xb')](cmHopperHistory[_0xbd41('0xc')](_0x175e45))[_0xbd41('0xd')](loggerCatch(_0xbd41('0xe')));}function createAgent(_0x3a63d2){return BPromise[_0xbd41('0xf')]()['then'](agentReportPreview['createHistory'](_0x3a63d2))[_0xbd41('0xd')](loggerCatch(_0xbd41('0xe')));}function moveContact(_0x47aa9f){return BPromise[_0xbd41('0xf')]()[_0xbd41('0xb')](cmHopper[_0xbd41('0x10')](_0x47aa9f,!![]))[_0xbd41('0xd')](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x50e262){return BPromise[_0xbd41('0xf')]()[_0xbd41('0xb')](cmHopperBlack[_0xbd41('0x11')](_0x50e262))[_0xbd41('0xd')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xbd41('0x12')]=function(_0x4dd6ea){return BPromise[_0xbd41('0xf')]()[_0xbd41('0xb')](cmHopper[_0xbd41('0x12')](_0x4dd6ea))[_0xbd41('0xd')](loggerCatch(_0xbd41('0x13')));};exports[_0xbd41('0xc')]=function(_0x2866be,_0x3f5c5f){create(_0x2866be)[_0xbd41('0xd')](loggerCatch(_0x3f5c5f));moveContact(_0x2866be)[_0xbd41('0xd')](loggerCatch(_0x3f5c5f));};exports['createAgentHistory']=function(_0x344d4c,_0x389303){createAgent(_0x344d4c)[_0xbd41('0xd')](loggerCatch(_0x389303));};exports[_0xbd41('0x14')]=function(_0x1a4f6c,_0xad1292){create(_0x1a4f6c)[_0xbd41('0xd')](loggerCatch(_0xad1292));};exports[_0xbd41('0x15')]=function(_0x35f747,_0x555c60){moveContact(_0x35f747)[_0xbd41('0xd')](loggerCatch(_0x555c60));};exports[_0xbd41('0x16')]=function(_0x36adae,_0x5181fc,_0x45505b){if(_0x5181fc){_0x36adae[_0xbd41('0x17')]=null;}if(_0x45505b){_0x36adae[_0xbd41('0x18')]=![];}return BPromise[_0xbd41('0xf')]()[_0xbd41('0xb')](cmHopper[_0xbd41('0x16')](_0x36adae))['catch'](loggerCatch(_0xbd41('0x19')));};exports['countReScheduled']=function(_0x564de1){return BPromise[_0xbd41('0xf')]()[_0xbd41('0xb')](cmHopper[_0xbd41('0x1a')](_0x564de1))[_0xbd41('0xd')](loggerCatch(_0xbd41('0x1b')));};exports['unlockContact']=function(_0x334427){return BPromise[_0xbd41('0xf')]()[_0xbd41('0xb')](cmHopper[_0xbd41('0x1c')]({'UserId':null},_0x334427,0x1))[_0xbd41('0xd')](loggerCatch(_0xbd41('0x1d')));};exports[_0xbd41('0x1e')]=function(_0x2a47bb){return BPromise[_0xbd41('0xf')]()['then'](cmHopper[_0xbd41('0x1c')]({'active':![]},_0x2a47bb,0x1))[_0xbd41('0xd')](loggerCatch(_0xbd41('0x1f')));};exports[_0xbd41('0x20')]=function(_0x1e4daa){var _0x8929e1={};_0x8929e1[_0xbd41('0x21')]=_0x1e4daa[_0xbd41('0x21')];_0x8929e1[_0xbd41('0x22')]=_0x1e4daa['uniqueid'];_0x8929e1[_0xbd41('0x23')]=_0x1e4daa[_0xbd41('0x23')];_0x8929e1[_0xbd41('0x24')]=_0x1e4daa[_0xbd41('0x24')];_0x8929e1['queue']=_0x1e4daa[_0xbd41('0x25')];_0x8929e1['queuecallerjoinAt']=_0x1e4daa['answertime'];_0x8929e1[_0xbd41('0x26')]=_0x1e4daa[_0xbd41('0x27')];_0x8929e1[_0xbd41('0x28')]=0x1;_0x8929e1[_0xbd41('0x29')]=_0x1e4daa[_0xbd41('0x2a')];_0x8929e1[_0xbd41('0x2b')]=_0x1e4daa[_0xbd41('0x2c')];_0x8929e1[_0xbd41('0x2d')]='from-sip';_0x8929e1[_0xbd41('0x2e')]=_0xbd41('0x2f');_0x8929e1['holdtime']=0x0;_0x8929e1[_0xbd41('0x30')]=0x1;_0x8929e1[_0xbd41('0x31')]=_0x1e4daa['membername'];_0x8929e1[_0xbd41('0x32')]=_0xbd41('0x33');return BPromise[_0xbd41('0xf')]()[_0xbd41('0xb')](voiceQueueReport[_0xbd41('0x34')](_0x8929e1))[_0xbd41('0xd')](loggerCatch(_0xbd41('0x35')));};exports[_0xbd41('0x36')]=function(_0x49b898,_0xbcab9e){return BPromise[_0xbd41('0xf')]()['then'](cmHopper[_0xbd41('0x36')](_0x49b898,_0xbcab9e))['catch'](loggerCatch(_0xbd41('0x37')));};exports[_0xbd41('0x38')]=function(_0x2c1bf6){return BPromise['resolve']()['then'](cmHopper[_0xbd41('0x16')](_0x2c1bf6,!![],!![]))['catch'](loggerCatch(_0xbd41('0x39')));}; \ No newline at end of file +var _0x4290=['resolve','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createHistory','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','then','catch','[createHistory]\x20'];(function(_0x183c00,_0x5327b8){var _0x4a8361=function(_0x126739){while(--_0x126739){_0x183c00['push'](_0x183c00['shift']());}};_0x4a8361(++_0x5327b8);}(_0x4290,0xc1));var _0x0429=function(_0x3d7941,_0x38b97b){_0x3d7941=_0x3d7941-0x0;var _0x452573=_0x4290[_0x3d7941];return _0x452573;};'use strict';var util=require(_0x0429('0x0'));var BPromise=require(_0x0429('0x1'));var logger=require('../../../config/logger')('preview');var _=require('lodash');var cmHopper=require(_0x0429('0x2'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x0429('0x3'));var cmHopperBlack=require(_0x0429('0x4'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x0429('0x5'));function loggerCatch(_0x5194d2){return function(_0x327c29){logger[_0x0429('0x6')](_0x5194d2,util[_0x0429('0x7')](_0x327c29,{'showHidden':![],'depth':null}));};}function create(_0x3e17f5){return BPromise['resolve']()[_0x0429('0x8')](cmHopperHistory['createHistory'](_0x3e17f5))[_0x0429('0x9')](loggerCatch(_0x0429('0xa')));}function createAgent(_0xae2757){return BPromise[_0x0429('0xb')]()['then'](agentReportPreview['createHistory'](_0xae2757))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5c2187){return BPromise[_0x0429('0xb')]()[_0x0429('0x8')](cmHopper[_0x0429('0xc')](_0x5c2187,!![]))[_0x0429('0x9')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x0429('0xd')]=function(_0x416eb2){return BPromise[_0x0429('0xb')]()[_0x0429('0x8')](cmHopperBlack[_0x0429('0xd')](_0x416eb2))[_0x0429('0x9')](loggerCatch(_0x0429('0xe')));};exports['getContactPreview']=function(_0x81b85){return BPromise[_0x0429('0xb')]()[_0x0429('0x8')](cmHopper[_0x0429('0xf')](_0x81b85))['catch'](loggerCatch(_0x0429('0x10')));};exports[_0x0429('0x11')]=function(_0x387573,_0x31682e){create(_0x387573)[_0x0429('0x9')](loggerCatch(_0x31682e));moveContact(_0x387573)[_0x0429('0x9')](loggerCatch(_0x31682e));};exports[_0x0429('0x12')]=function(_0xa47e3a,_0x399ec0){createAgent(_0xa47e3a)[_0x0429('0x9')](loggerCatch(_0x399ec0));};exports[_0x0429('0x13')]=function(_0xf2c007,_0x311ccd){create(_0xf2c007)[_0x0429('0x9')](loggerCatch(_0x311ccd));};exports[_0x0429('0x14')]=function(_0x2fc94d,_0x3ead49){moveContact(_0x2fc94d)[_0x0429('0x9')](loggerCatch(_0x3ead49));};exports[_0x0429('0x15')]=function(_0x5e5334,_0x29c2fb,_0x43b35b){if(_0x29c2fb){_0x5e5334['UserId']=null;}if(_0x43b35b){_0x5e5334['active']=![];}return BPromise[_0x0429('0xb')]()[_0x0429('0x8')](cmHopper['rescheduleContact'](_0x5e5334))[_0x0429('0x9')](loggerCatch(_0x0429('0x16')));};exports[_0x0429('0x17')]=function(_0x1e81cf){return BPromise[_0x0429('0xb')]()['then'](cmHopper['countReScheduled'](_0x1e81cf))['catch'](loggerCatch(_0x0429('0x18')));};exports['unlockContact']=function(_0x555573){return BPromise[_0x0429('0xb')]()[_0x0429('0x8')](cmHopper['unlockContact']({'UserId':null},_0x555573,0x1))['catch'](loggerCatch(_0x0429('0x19')));};exports[_0x0429('0x1a')]=function(_0x421cbc){return BPromise['resolve']()[_0x0429('0x8')](cmHopper['unlockContact']({'active':![]},_0x421cbc,0x1))['catch'](loggerCatch('[activeContact]\x20'));};exports[_0x0429('0x1b')]=function(_0x1a7470){var _0x5572ed={};_0x5572ed['type']=_0x1a7470['type'];_0x5572ed[_0x0429('0x1c')]=_0x1a7470[_0x0429('0x1c')];_0x5572ed['calleridnum']=_0x1a7470[_0x0429('0x1d')];_0x5572ed[_0x0429('0x1e')]=_0x1a7470['calleridname'];_0x5572ed[_0x0429('0x1f')]=_0x1a7470['queue'];_0x5572ed[_0x0429('0x20')]=_0x1a7470[_0x0429('0x21')];_0x5572ed['queuecallerleaveAt']=_0x1a7470['answertime'];_0x5572ed[_0x0429('0x22')]=0x1;_0x5572ed[_0x0429('0x23')]=_0x1a7470[_0x0429('0x24')];_0x5572ed[_0x0429('0x25')]=_0x1a7470[_0x0429('0x26')];_0x5572ed[_0x0429('0x27')]='from-sip';_0x5572ed['exten']=_0x0429('0x28');_0x5572ed[_0x0429('0x29')]=0x0;_0x5572ed[_0x0429('0x2a')]=0x1;_0x5572ed[_0x0429('0x2b')]=_0x1a7470[_0x0429('0x26')];_0x5572ed[_0x0429('0x2c')]=_0x0429('0x2d');return BPromise[_0x0429('0xb')]()[_0x0429('0x8')](voiceQueueReport[_0x0429('0x2e')](_0x5572ed))['catch'](loggerCatch(_0x0429('0x2f')));};exports[_0x0429('0x30')]=function(_0x4aaeb4,_0x759517){return BPromise['resolve']()[_0x0429('0x8')](cmHopper[_0x0429('0x30')](_0x4aaeb4,_0x759517))[_0x0429('0x9')](loggerCatch(_0x0429('0x31')));};exports['rescheduleContactInQueue']=function(_0x1477de){return BPromise['resolve']()[_0x0429('0x8')](cmHopper[_0x0429('0x15')](_0x1477de,!![],!![]))[_0x0429('0x9')](loggerCatch(_0x0429('0x32')));}; \ 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 7ffa2f7..d85d324 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 _0x1445=['buildAcw','queue','agentReadyId','not_inuse','status','push','getDiff','createBody','CampaignId','filterKey','idContact','type','dialAnswer','countnoanswerretry','countglobal','callback','callbackuniqueid','ListId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','lodash','moment','preview','env','milliseconds','diff','seconds','loggerCatch','error','inspect','logger2','info','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialQueueProject','NONE','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','membername','UserId','logCustomer','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','channelAgent','calleridnum','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ContactId','decrementTalkink','isNil','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','interface','voice','mandatoryDisposition'];(function(_0x3cfe76,_0x1d9d61){var _0x1f6f12=function(_0x1f2148){while(--_0x1f2148){_0x3cfe76['push'](_0x3cfe76['shift']());}};_0x1f6f12(++_0x1d9d61);}(_0x1445,0xbd));var _0x5144=function(_0x1fafdc,_0x55e96c){_0x1fafdc=_0x1fafdc-0x0;var _0x3f8801=_0x1445[_0x1fafdc];return _0x3f8801;};'use strict';var util=require('util');var _=require(_0x5144('0x0'));var moment=require(_0x5144('0x1'));var logger=require('../../../../config/logger')(_0x5144('0x2'));var ipAgi=process[_0x5144('0x3')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x16528c,_0x5cb38d){var _0x147324=moment(_0x16528c)[_0x5144('0x4')](0x0);var _0x433ae6=moment(_0x5cb38d)[_0x5144('0x4')](0x0);return _0x147324[_0x5144('0x5')](_0x433ae6,_0x5144('0x6'));}exports[_0x5144('0x7')]=function(_0x5d28fc){return function(_0x4274b5){logger[_0x5144('0x8')](_0x5d28fc,util[_0x5144('0x9')](_0x4274b5,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x25ffa1,_0xae433f){logger['info'](_0x25ffa1,util['inspect'](_0xae433f,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x5da86b,_0x15fb67){logger[_0x5144('0x8')](_0x5da86b,util[_0x5144('0x9')](_0x15fb67,{'showHidden':![],'depth':null}));};exports[_0x5144('0xa')]=function(_0x4532c1){return function(_0x99a81c){logger[_0x5144('0xb')](_0x4532c1,util[_0x5144('0x9')](_0x99a81c,{'showHidden':![],'depth':null}));};};exports[_0x5144('0xc')]=function(_0x2306ae,_0x576e34,_0x230cc4){return{'message':_0x2306ae,'unlock':_0x576e34,'active':_0x230cc4};};exports[_0x5144('0xd')]=function(_0x16ba6a,_0x180503,_0x262018){if(!_['isUndefined'](_0x262018)&&_0x5144('0xe')===typeof _0x262018&&!_[_0x5144('0xf')](_0x262018)){if(!_[_0x5144('0x10')](_0x180503)&&_0x5144('0xe')===typeof _0x180503&&!_[_0x5144('0xf')](_0x180503)){return util[_0x5144('0x11')]('\x22%s\x22\x20<%s>',_0x180503,_0x262018);}return util[_0x5144('0x11')](_0x5144('0x12'),_0x262018,_0x262018);}if(!_[_0x5144('0x10')](_0x16ba6a)&&'string'===typeof _0x16ba6a&&!_['isEmpty'](_0x16ba6a)){return _0x16ba6a;}return _0x5144('0x13');};exports[_0x5144('0x14')]=function(_0x170a95){if(_['isNil'](_0x170a95)){return![];}return _0x170a95;};exports[_0x5144('0x15')]=function(_0x3c6101,_0x39f137,_0x2aa9a7,_0x40d1b7,_0x488cd0,_0x204c54){var _0x2bfc2a={'XMD-QUEUE':_0x39f137[_0x5144('0x16')]?_0x39f137[_0x5144('0x16')][_0x5144('0x17')]:'','XMD-CALLERID':_0x40d1b7,'XMD-CALLERID-PREVIEW':_0x204c54?util['format'](_0x5144('0x12'),_0x204c54[_0x5144('0x18')],_0x204c54['calleridnum']):_0x40d1b7,'XMD-DIALID':_0x488cd0,'XMD-CONTACTID':_0x39f137['ContactId'],'XMD-CDRTYPE':_0x5144('0x19'),'CALLERID(all)':_0x40d1b7,'XMD-VOICEQUEUEID':_0x39f137[_0x5144('0x1a')],'XMD-DIALCHANNEL':_0x2aa9a7,'XMD-DIALTIMEOUT':_0x3c6101[_0x5144('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x5144('0x11')](_0x5144('0x1c'),_0x3c6101['dialQueueProject2']?'g':'',_[_0x5144('0xf')](_0x3c6101[_0x5144('0x1d')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x3c6101['dialPreviewUrl']||'','XMD-AGI':_0x3c6101[_0x5144('0x1e')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x3c6101[_0x5144('0x1e')]):_0x5144('0x1f'),'XMD-AGIAFTER':_0x3c6101['dialQueueProject2']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x3c6101['dialQueueProject2']):_0x5144('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x204c54?_0x204c54['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x204c54?_0x204c54[_0x5144('0x20')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x5144('0x21')};if(!_[_0x5144('0xf')](_0x3c6101[_0x5144('0x1d')])){_0x2bfc2a[util[_0x5144('0x11')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3c6101[_0x5144('0x1d')];_0x2bfc2a[util['format']('%s',_0x5144('0x22'))]=_0x488cd0;}if(_0x39f137&&_0x39f137['Contact']){for(var _0x3b879d in _0x39f137['Contact']){if(_0x39f137[_0x5144('0x23')][_0x5144('0x24')](_0x3b879d)){if(!_['isNil'](_0x39f137[_0x5144('0x23')][_0x3b879d])&&_0x3b879d!=='id'&&_0x3b879d!==_0x5144('0x25')&&_0x3b879d!==_0x5144('0x26')&&_0x3b879d!==_0x5144('0x27')){_0x2bfc2a[util['format']('%s%s',_0x5144('0x28'),_[_0x5144('0x29')](_0x3b879d))]=_0x39f137['Contact'][_0x3b879d];}}}}return _0x2bfc2a;};exports[_0x5144('0x2a')]=function(_0x7b652f){var _0x4936c5={};for(var _0x1d0b8c in _0x7b652f){if(_0x7b652f[_0x5144('0x24')](_0x1d0b8c)){_0x4936c5[util[_0x5144('0x11')]('%s',_[_0x5144('0x2b')](_0x1d0b8c))]=_0x7b652f[_0x1d0b8c];}}return{'variables':_0x4936c5};};exports[_0x5144('0x2c')]=function(_0x52184c,_0x22ee0a){if(!_['isNil'](_0x52184c)){if(_0x52184c[_0x5144('0x24')](_0x5144('0x2d'))){if(_0x52184c[_0x5144('0x2d')]>0x0){_0x52184c[_0x5144('0x2d')]-=0x1;}else{logger[_0x5144('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x22ee0a);}}}else{logger['error'](_0x5144('0x2e'),_0x22ee0a);}};exports[_0x5144('0x2f')]=function(_0x31125a){var _0x1d3d1e=moment()['format'](_0x5144('0x30'));_0x31125a[_0x5144('0x31')]=0xd;_0x31125a[_0x5144('0x32')]=_0x5144('0x33');_0x31125a[_0x5144('0x34')]=_0x1d3d1e;_0x31125a[_0x5144('0x35')]=_0x1d3d1e;_0x31125a[_0x5144('0x36')]=_0x1d3d1e;};exports[_0x5144('0x37')]=function(_0x123702,_0x1ea5e3,_0x48c5db){var _0xbd9ed0=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x123702[_0x5144('0x31')]=_0x1ea5e3;_0x123702[_0x5144('0x32')]=_0x48c5db;_0x123702['responsetime']=_0xbd9ed0;_0x123702[_0x5144('0x38')]=getSeconds(_0x123702['responsetime'],_0x123702['starttime']);};exports['logLookAgent']=function(_0x20ee92,_0x5774de,_0x3b6857){_0x20ee92[_0x5144('0x39')]=_0x5774de;_0x20ee92[_0x5144('0x3a')]=_0x3b6857;};exports[_0x5144('0x3b')]=function(_0x78514c,_0x599620,_0x52f501){var _0x38eb67=moment()['format'](_0x5144('0x30'));_0x78514c[_0x5144('0x31')]=_0x599620;_0x78514c['statedesc']=_0x52f501;_0x78514c[_0x5144('0x35')]=_0x78514c[_0x5144('0x35')]?_0x78514c[_0x5144('0x35')]:_0x38eb67;_0x78514c['endtime']=_0x78514c[_0x5144('0x36')]?_0x78514c[_0x5144('0x36')]:_0x38eb67;_0x78514c[_0x5144('0x38')]=getSeconds(_0x78514c[_0x5144('0x35')]||0x0,_0x78514c['starttime']||0x0);_0x78514c['talktime']=_0x78514c[_0x5144('0x3c')]?getSeconds(_0x78514c[_0x5144('0x36')],_0x78514c[_0x5144('0x3c')]):0x0;};exports[_0x5144('0x3d')]=function(_0x4ba9c2){return _0x4ba9c2===_0x5144('0x3e');};exports[_0x5144('0x3f')]=function(_0x1f79af,_0x55dfcd,_0x47abeb,_0x56f83e,_0x3c5d43){var _0x2019ac=_0x56f83e?_0x5144('0x40'):_0x1f79af['calleridname'];_0x2019ac=_0x3c5d43?'BOOKED':_0x2019ac;return{'actionid':_0x1f79af[_0x5144('0x41')],'action':_0x5144('0x42'),'channel':_0x1f79af[_0x5144('0x43')],'callerid':util[_0x5144('0x11')]('\x22%s\x22\x20<%s>',_0x2019ac,_0x1f79af[_0x5144('0x44')]),'Exten':_0x5144('0x45'),'Context':_0x5144('0x46'),'Priority':'1','variable':_0x47abeb,'timeout':(_0x55dfcd[_0x5144('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1f79af[_0x5144('0x41')]};};exports[_0x5144('0x48')]=function(_0x3179de){return _0x3179de[_0x5144('0x49')]+_0x3179de[_0x5144('0x4a')]+_0x3179de['countnoanswerretry']+_0x3179de['countagentrejectretry']+_0x3179de[_0x5144('0x4b')];};exports[_0x5144('0x4c')]=function(_0x4b4f72){var _0x30b169=_[_0x5144('0x4d')](_0x4b4f72);_0x30b169[_0x5144('0x31')]=0xf;_0x30b169[_0x5144('0x32')]=_0x5144('0x4e');return _0x30b169;};exports[_0x5144('0x4f')]=function(_0x40cfc5,_0x52bb00,_0x5dd2b0){var _0x3a56a9={};_0x3a56a9[_0x52bb00]=_0x40cfc5[_0x52bb00];_0x3a56a9[_0x5144('0x50')]=![];_0x3a56a9[_0x5144('0x51')]=moment()[_0x5144('0x52')](_0x5dd2b0,_0x5144('0x53'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3a56a9[_0x5144('0x54')]=_0x40cfc5[_0x5144('0x54')];_0x3a56a9['ListId']=_0x40cfc5['ListId'];_0x3a56a9[_0x5144('0x1a')]=_0x40cfc5[_0x5144('0x1a')]||undefined;return _0x3a56a9;};exports[_0x5144('0x55')]=function(_0x17914d,_0xf55092){if(!_[_0x5144('0x56')](_0x17914d)){if(_0x17914d[_0x5144('0x57')]>0x0){_0x17914d['pTalking']-=0x1;}else{logger[_0x5144('0x8')](_0xf55092,_0x5144('0x58'));}}else{logger[_0x5144('0x8')](_0xf55092,_0x5144('0x59'));}};exports['IsNotLoggedIn']=function(_0x21d1c7){if(_0x21d1c7<=0x0){return!![];}return![];};exports[_0x5144('0x5a')]=function(_0x554e2e,_0x32279c,_0x3cd5f5){_0x554e2e[_0x5144('0x5b')]=_0x32279c;_0x554e2e[_0x5144('0x17')]=_0x554e2e['queue'];_0x554e2e[_0x5144('0x5c')]=_0x554e2e[_0x5144('0x43')];_0x554e2e['motionChannel']=_0x5144('0x5d');if(_0x3cd5f5){_0x554e2e[_0x5144('0x5e')]=_0x3cd5f5[_0x5144('0x5e')];}return _0x554e2e;};exports[_0x5144('0x5f')]=function(_0xc83c14){var _0x1c9520={};_0x1c9520['queue']=_0xc83c14[_0x5144('0x60')];_0x1c9520[_0x5144('0x5c')]=_0xc83c14[_0x5144('0x43')];_0x1c9520['uniqueid']=_0xc83c14[_0x5144('0x41')];return _0x1c9520;};exports[_0x5144('0x61')]=function(_0xb4a040){var _0x28e8f7=[];for(var _0x2ce22b in _0xb4a040){if(_0xb4a040[_0x5144('0x24')](_0x2ce22b)){if(!_[_0x5144('0x56')](_0xb4a040[_0x2ce22b])&&_0xb4a040[_0x2ce22b][_0x5144('0x31')]===_0x5144('0x62')&&_0xb4a040[_0x2ce22b][_0x5144('0x63')]==='reachable'){_0x28e8f7[_0x5144('0x64')](_0xb4a040[_0x2ce22b]['id']);}}}return _0x28e8f7;};exports[_0x5144('0x65')]=function(_0x1660f4){var _0x3eb253=moment()[_0x5144('0x4')](0x0);var _0x3044d1=moment(_0x1660f4)[_0x5144('0x4')](0x0);return _0x3eb253[_0x5144('0x5')](_0x3044d1,_0x5144('0x6'));};exports[_0x5144('0x66')]=function(_0x2a9eae){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2a9eae[_0x5144('0x54')],'ListId':_0x2a9eae['ListId'],'VoiceQueueId':_0x2a9eae[_0x5144('0x1a')]||undefined,'CampaignId':_0x2a9eae[_0x5144('0x67')]||undefined};};exports[_0x5144('0x68')]=function(_0x11dce7){if(_0x11dce7===_0x5144('0x41')||_0x11dce7===_0x5144('0x69')||_0x11dce7===_0x5144('0x60')||_0x11dce7===_0x5144('0x6a')||_0x11dce7==='campaigntype'||_0x11dce7===_0x5144('0x6b')||_0x11dce7==='membername'||_0x11dce7===_0x5144('0x43')||_0x11dce7===_0x5144('0x18')||_0x11dce7===_0x5144('0x50')||_0x11dce7===_0x5144('0x44')||_0x11dce7===_0x5144('0x51')||_0x11dce7===_0x5144('0x49')||_0x11dce7===_0x5144('0x4a')||_0x11dce7===_0x5144('0x6c')||_0x11dce7===_0x5144('0x6d')||_0x11dce7===_0x5144('0x6e')||_0x11dce7===_0x5144('0x6f')||_0x11dce7==='callbackat'||_0x11dce7==='recallme'||_0x11dce7==='ContactId'||_0x11dce7===_0x5144('0x70')||_0x11dce7===_0x5144('0x3a')||_0x11dce7===_0x5144('0x1a')||_0x11dce7===_0x5144('0x71')||_0x11dce7===_0x5144('0x72')||_0x11dce7===_0x5144('0x73')||_0x11dce7==='xmd-phone'||_0x11dce7===_0x5144('0x74')||_0x11dce7===_0x5144('0x75')||_0x11dce7==='xmd-dialtimeout'||_0x11dce7===_0x5144('0x76')||_0x11dce7===_0x5144('0x77')||_0x11dce7===_0x5144('0x78')||_0x11dce7===_0x5144('0x79')||_0x11dce7===_0x5144('0x7a')||_0x11dce7===_0x5144('0x7b')||_0x11dce7===_0x5144('0x7c')||_0x11dce7===_0x5144('0x7d')||_0x11dce7===_0x5144('0x7e')||_0x11dce7===_0x5144('0x7f')||_0x11dce7===_0x5144('0x80')||_0x11dce7==='rtpaudioqosjitterbridged'||_0x11dce7===_0x5144('0x81')||_0x11dce7===_0x5144('0x82')||_0x11dce7===_0x5144('0x83')||_0x11dce7===_0x5144('0x84')||_0x11dce7===_0x5144('0x7e')||_0x11dce7==='rtpaudioqosbridged'||_0x11dce7===_0x5144('0x80')||_0x11dce7===_0x5144('0x85')||_0x11dce7==='rtpaudioqosloss'||_0x11dce7===_0x5144('0x82')||_0x11dce7==='rtpaudioqosrtt'||_0x11dce7==='rtpaudioqosrttbridged'||_0x11dce7===_0x5144('0x86')||_0x11dce7===_0x5144('0x87')||_0x11dce7===_0x5144('0x31')||_0x11dce7==='statedesc'){return![];}return!![];};exports[_0x5144('0x88')]=function(_0x1db53f,_0x77a359){var _0x34e5d2,_0xc8d69d,_0x1d9240;if(_0x77a359<=0x0){_0x77a359=0x1;}_0x34e5d2=new RegExp(_0x5144('0x89')+_0x77a359+'}$');_0xc8d69d=Math[_0x5144('0x8a')](0xa,_0x77a359-0x1);_0x1d9240=Math['pow'](0xa,_0x77a359)-0x1;return util[_0x5144('0x11')]('%s',_[_0x5144('0x8b')](_0x1db53f,_0x34e5d2,_[_0x5144('0x8c')](_0xc8d69d,_0x1d9240)));};exports['extractCalleridName']=function(_0x252596){var _0x17eb4d=_0x252596[_0x5144('0x8d')](/"(.*?)"/);return _0x17eb4d?_0x17eb4d[0x1]:_0x252596;};exports['extractCalleridNumber']=function(_0x18bca4){var _0x10f9aa=_0x18bca4['match'](/<(.*?)>/);return _0x10f9aa?_0x10f9aa[0x1]:_0x18bca4;}; \ No newline at end of file +var _0xf2f1=['totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','reachable','push','getDiff','seconds','createBody','CampaignId','idContact','type','dialAnswer','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','error','inspect','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','format','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','Contact','isNil','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','uniqueid','channelAgent','from-sip'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0xf2f1,0xda));var _0x1f2f=function(_0x5a4a1e,_0x5f014c){_0x5a4a1e=_0x5a4a1e-0x0;var _0x13b91d=_0xf2f1[_0x5a4a1e];return _0x13b91d;};'use strict';var util=require(_0x1f2f('0x0'));var _=require(_0x1f2f('0x1'));var moment=require(_0x1f2f('0x2'));var logger=require(_0x1f2f('0x3'))(_0x1f2f('0x4'));var ipAgi=process[_0x1f2f('0x5')][_0x1f2f('0x6')]||'127.0.0.1';function getSeconds(_0x4d3a32,_0x23b89d){var _0x4ab288=moment(_0x4d3a32)[_0x1f2f('0x7')](0x0);var _0x1c4699=moment(_0x23b89d)[_0x1f2f('0x7')](0x0);return _0x4ab288[_0x1f2f('0x8')](_0x1c4699,'seconds');}exports['loggerCatch']=function(_0x4d5b47){return function(_0x5e1ae5){logger[_0x1f2f('0x9')](_0x4d5b47,util[_0x1f2f('0xa')](_0x5e1ae5,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x109cad,_0x4d0249){logger['info'](_0x109cad,util[_0x1f2f('0xa')](_0x4d0249,{'showHidden':![],'depth':null}));};exports[_0x1f2f('0xb')]=function(_0x46d048,_0x5e05f6){logger[_0x1f2f('0x9')](_0x46d048,util[_0x1f2f('0xa')](_0x5e05f6,{'showHidden':![],'depth':null}));};exports[_0x1f2f('0xc')]=function(_0x5146ab){return function(_0x4d07ca){logger['info'](_0x5146ab,util['inspect'](_0x4d07ca,{'showHidden':![],'depth':null}));};};exports[_0x1f2f('0xd')]=function(_0x54ba8d,_0x4f6005,_0x16789c){return{'message':_0x54ba8d,'unlock':_0x4f6005,'active':_0x16789c};};exports[_0x1f2f('0xe')]=function(_0x1f3f80,_0x4f665e,_0x270c5b){if(!_[_0x1f2f('0xf')](_0x270c5b)&&_0x1f2f('0x10')===typeof _0x270c5b&&!_[_0x1f2f('0x11')](_0x270c5b)){if(!_[_0x1f2f('0xf')](_0x4f665e)&&'string'===typeof _0x4f665e&&!_[_0x1f2f('0x11')](_0x4f665e)){return util['format'](_0x1f2f('0x12'),_0x4f665e,_0x270c5b);}return util['format'](_0x1f2f('0x12'),_0x270c5b,_0x270c5b);}if(!_[_0x1f2f('0xf')](_0x1f3f80)&&_0x1f2f('0x10')===typeof _0x1f3f80&&!_['isEmpty'](_0x1f3f80)){return _0x1f3f80;}return _0x1f2f('0x13');};exports[_0x1f2f('0x14')]=function(_0xe37616){if(_['isNil'](_0xe37616)){return![];}return _0xe37616;};exports[_0x1f2f('0x15')]=function(_0x400862,_0x88838,_0x36d63e,_0x44d85b,_0x11adb9,_0x595b77){var _0x1d85f0={'XMD-QUEUE':_0x88838[_0x1f2f('0x16')]?_0x88838['Queue'][_0x1f2f('0x17')]:'','XMD-CALLERID':_0x44d85b,'XMD-CALLERID-PREVIEW':_0x595b77?util['format']('\x22%s\x22\x20<%s>',_0x595b77['calleridname'],_0x595b77[_0x1f2f('0x18')]):_0x44d85b,'XMD-DIALID':_0x11adb9,'XMD-CONTACTID':_0x88838[_0x1f2f('0x19')],'XMD-CDRTYPE':_0x1f2f('0x1a'),'CALLERID(all)':_0x44d85b,'XMD-VOICEQUEUEID':_0x88838['VoiceQueueId'],'XMD-DIALCHANNEL':_0x36d63e,'XMD-DIALTIMEOUT':_0x400862[_0x1f2f('0x1b')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x1f2f('0x1c'),_0x400862[_0x1f2f('0x1d')]?'g':'',_[_0x1f2f('0x11')](_0x400862[_0x1f2f('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x400862[_0x1f2f('0x1f')]||'','XMD-AGI':_0x400862[_0x1f2f('0x20')]?util[_0x1f2f('0x21')](_0x1f2f('0x22'),ipAgi,_0x400862[_0x1f2f('0x20')]):_0x1f2f('0x23'),'XMD-AGIAFTER':_0x400862[_0x1f2f('0x1d')]?util[_0x1f2f('0x21')](_0x1f2f('0x22'),ipAgi,_0x400862[_0x1f2f('0x1d')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x595b77?_0x595b77[_0x1f2f('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x595b77?_0x595b77['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x1f2f('0x25')};if(!_[_0x1f2f('0x11')](_0x400862['monitor_format'])){_0x1d85f0[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x400862[_0x1f2f('0x1e')];_0x1d85f0[util[_0x1f2f('0x21')]('%s',_0x1f2f('0x26'))]=_0x11adb9;}if(_0x88838&&_0x88838[_0x1f2f('0x27')]){for(var _0x1f12c5 in _0x88838[_0x1f2f('0x27')]){if(_0x88838[_0x1f2f('0x27')]['hasOwnProperty'](_0x1f12c5)){if(!_[_0x1f2f('0x28')](_0x88838['Contact'][_0x1f12c5])&&_0x1f12c5!=='id'&&_0x1f12c5!=='tags'&&_0x1f12c5!==_0x1f2f('0x29')&&_0x1f12c5!==_0x1f2f('0x2a')){_0x1d85f0[util[_0x1f2f('0x21')](_0x1f2f('0x2b'),_0x1f2f('0x2c'),_[_0x1f2f('0x2d')](_0x1f12c5))]=_0x88838[_0x1f2f('0x27')][_0x1f12c5];}}}}return _0x1d85f0;};exports[_0x1f2f('0x2e')]=function(_0x2b4514){var _0x3f051b={};for(var _0x5776a7 in _0x2b4514){if(_0x2b4514['hasOwnProperty'](_0x5776a7)){_0x3f051b[util[_0x1f2f('0x21')]('%s',_['toLower'](_0x5776a7))]=_0x2b4514[_0x5776a7];}}return{'variables':_0x3f051b};};exports[_0x1f2f('0x2f')]=function(_0x1cf0d7,_0x1644c1){if(!_[_0x1f2f('0x28')](_0x1cf0d7)){if(_0x1cf0d7[_0x1f2f('0x30')](_0x1f2f('0x31'))){if(_0x1cf0d7[_0x1f2f('0x31')]>0x0){_0x1cf0d7[_0x1f2f('0x31')]-=0x1;}else{logger[_0x1f2f('0x9')](_0x1f2f('0x32'),_0x1644c1);}}}else{logger[_0x1f2f('0x9')](_0x1f2f('0x33'),_0x1644c1);}};exports[_0x1f2f('0x34')]=function(_0x5bf356){var _0x1f6ec7=moment()[_0x1f2f('0x21')](_0x1f2f('0x35'));_0x5bf356[_0x1f2f('0x36')]=0xd;_0x5bf356['statedesc']=_0x1f2f('0x37');_0x5bf356[_0x1f2f('0x38')]=_0x1f6ec7;_0x5bf356[_0x1f2f('0x39')]=_0x1f6ec7;_0x5bf356[_0x1f2f('0x3a')]=_0x1f6ec7;};exports[_0x1f2f('0x3b')]=function(_0xb24283,_0x2dc84c,_0x18f4ee){var _0x407f18=moment()['format'](_0x1f2f('0x35'));_0xb24283[_0x1f2f('0x36')]=_0x2dc84c;_0xb24283[_0x1f2f('0x3c')]=_0x18f4ee;_0xb24283['responsetime']=_0x407f18;_0xb24283[_0x1f2f('0x3d')]=getSeconds(_0xb24283[_0x1f2f('0x39')],_0xb24283['starttime']);};exports[_0x1f2f('0x3e')]=function(_0x50bf97,_0x2983ca,_0x391863){_0x50bf97[_0x1f2f('0x3f')]=_0x2983ca;_0x50bf97[_0x1f2f('0x40')]=_0x391863;};exports[_0x1f2f('0x41')]=function(_0x11cb50,_0x2f7fe7,_0x5518b7){var _0x4f0c35=moment()[_0x1f2f('0x21')](_0x1f2f('0x35'));_0x11cb50[_0x1f2f('0x36')]=_0x2f7fe7;_0x11cb50['statedesc']=_0x5518b7;_0x11cb50[_0x1f2f('0x39')]=_0x11cb50['responsetime']?_0x11cb50[_0x1f2f('0x39')]:_0x4f0c35;_0x11cb50[_0x1f2f('0x3a')]=_0x11cb50[_0x1f2f('0x3a')]?_0x11cb50[_0x1f2f('0x3a')]:_0x4f0c35;_0x11cb50[_0x1f2f('0x3d')]=getSeconds(_0x11cb50[_0x1f2f('0x39')]||0x0,_0x11cb50['starttime']||0x0);_0x11cb50[_0x1f2f('0x42')]=_0x11cb50[_0x1f2f('0x43')]?getSeconds(_0x11cb50['endtime'],_0x11cb50[_0x1f2f('0x43')]):0x0;};exports[_0x1f2f('0x44')]=function(_0x981741){return _0x981741===_0x1f2f('0x45');};exports[_0x1f2f('0x46')]=function(_0x1abcd9,_0x503372,_0x4e97ea,_0x17d0f5,_0x236727){var _0x4aa91d=_0x17d0f5?_0x1f2f('0x47'):_0x1abcd9[_0x1f2f('0x48')];_0x4aa91d=_0x236727?'BOOKED':_0x4aa91d;return{'actionid':_0x1abcd9[_0x1f2f('0x49')],'action':'originate','channel':_0x1abcd9[_0x1f2f('0x4a')],'callerid':util[_0x1f2f('0x21')]('\x22%s\x22\x20<%s>',_0x4aa91d,_0x1abcd9[_0x1f2f('0x18')]),'Exten':'xcally-motion-preview','Context':_0x1f2f('0x4b'),'Priority':'1','variable':_0x4e97ea,'timeout':(_0x503372['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1abcd9['uniqueid']};};exports[_0x1f2f('0x4c')]=function(_0x2ea1d6){return _0x2ea1d6[_0x1f2f('0x4d')]+_0x2ea1d6[_0x1f2f('0x4e')]+_0x2ea1d6[_0x1f2f('0x4f')]+_0x2ea1d6[_0x1f2f('0x50')]+_0x2ea1d6[_0x1f2f('0x51')];};exports[_0x1f2f('0x52')]=function(_0x2cf55d){var _0x1d62a3=_[_0x1f2f('0x53')](_0x2cf55d);_0x1d62a3[_0x1f2f('0x36')]=0xf;_0x1d62a3[_0x1f2f('0x3c')]=_0x1f2f('0x54');return _0x1d62a3;};exports[_0x1f2f('0x55')]=function(_0x52fb29,_0x2cea52,_0x599129){var _0x4e3991={};_0x4e3991[_0x2cea52]=_0x52fb29[_0x2cea52];_0x4e3991[_0x1f2f('0x56')]=![];_0x4e3991[_0x1f2f('0x57')]=moment()['add'](_0x599129,_0x1f2f('0x58'))[_0x1f2f('0x21')](_0x1f2f('0x35'));_0x4e3991[_0x1f2f('0x19')]=_0x52fb29[_0x1f2f('0x19')];_0x4e3991[_0x1f2f('0x59')]=_0x52fb29[_0x1f2f('0x59')];_0x4e3991[_0x1f2f('0x5a')]=_0x52fb29['VoiceQueueId']||undefined;return _0x4e3991;};exports['decrementTalkink']=function(_0x1b23d4,_0x5de82a){if(!_[_0x1f2f('0x28')](_0x1b23d4)){if(_0x1b23d4[_0x1f2f('0x5b')]>0x0){_0x1b23d4['pTalking']-=0x1;}else{logger[_0x1f2f('0x9')](_0x5de82a,_0x1f2f('0x5c'));}}else{logger[_0x1f2f('0x9')](_0x5de82a,_0x1f2f('0x5d'));}};exports[_0x1f2f('0x5e')]=function(_0x57c899){if(_0x57c899<=0x0){return!![];}return![];};exports[_0x1f2f('0x5f')]=function(_0x556fdc,_0x22a2db,_0xb307a5){_0x556fdc[_0x1f2f('0x60')]=_0x22a2db;_0x556fdc['name']=_0x556fdc[_0x1f2f('0x61')];_0x556fdc[_0x1f2f('0x62')]=_0x556fdc[_0x1f2f('0x4a')];_0x556fdc[_0x1f2f('0x63')]=_0x1f2f('0x64');if(_0xb307a5){_0x556fdc[_0x1f2f('0x65')]=_0xb307a5['mandatoryDisposition'];}return _0x556fdc;};exports[_0x1f2f('0x66')]=function(_0x176ad7){var _0x28021a={};_0x28021a[_0x1f2f('0x61')]=_0x176ad7['queue'];_0x28021a[_0x1f2f('0x62')]=_0x176ad7[_0x1f2f('0x4a')];_0x28021a['uniqueid']=_0x176ad7[_0x1f2f('0x49')];return _0x28021a;};exports[_0x1f2f('0x67')]=function(_0x23c1f7){var _0x1c0782=[];for(var _0x1f209e in _0x23c1f7){if(_0x23c1f7['hasOwnProperty'](_0x1f209e)){if(!_[_0x1f2f('0x28')](_0x23c1f7[_0x1f209e])&&_0x23c1f7[_0x1f209e][_0x1f2f('0x36')]===_0x1f2f('0x68')&&_0x23c1f7[_0x1f209e]['status']===_0x1f2f('0x69')){_0x1c0782[_0x1f2f('0x6a')](_0x23c1f7[_0x1f209e]['id']);}}}return _0x1c0782;};exports[_0x1f2f('0x6b')]=function(_0x351ab8){var _0x4a26e0=moment()[_0x1f2f('0x7')](0x0);var _0x466469=moment(_0x351ab8)[_0x1f2f('0x7')](0x0);return _0x4a26e0['diff'](_0x466469,_0x1f2f('0x6c'));};exports[_0x1f2f('0x6d')]=function(_0x3f4733){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3f4733[_0x1f2f('0x19')],'ListId':_0x3f4733['ListId'],'VoiceQueueId':_0x3f4733[_0x1f2f('0x5a')]||undefined,'CampaignId':_0x3f4733[_0x1f2f('0x6e')]||undefined};};exports['filterKey']=function(_0x50043e){if(_0x50043e===_0x1f2f('0x49')||_0x50043e===_0x1f2f('0x6f')||_0x50043e===_0x1f2f('0x61')||_0x50043e===_0x1f2f('0x70')||_0x50043e==='campaigntype'||_0x50043e===_0x1f2f('0x71')||_0x50043e===_0x1f2f('0x3f')||_0x50043e===_0x1f2f('0x4a')||_0x50043e===_0x1f2f('0x48')||_0x50043e==='active'||_0x50043e===_0x1f2f('0x18')||_0x50043e===_0x1f2f('0x57')||_0x50043e===_0x1f2f('0x4d')||_0x50043e===_0x1f2f('0x4e')||_0x50043e===_0x1f2f('0x4f')||_0x50043e==='countglobal'||_0x50043e===_0x1f2f('0x72')||_0x50043e===_0x1f2f('0x73')||_0x50043e===_0x1f2f('0x74')||_0x50043e===_0x1f2f('0x75')||_0x50043e===_0x1f2f('0x19')||_0x50043e==='ListId'||_0x50043e==='UserId'||_0x50043e==='VoiceQueueId'||_0x50043e===_0x1f2f('0x76')||_0x50043e==='xmd-voicequeueid'||_0x50043e===_0x1f2f('0x77')||_0x50043e===_0x1f2f('0x78')||_0x50043e===_0x1f2f('0x79')||_0x50043e===_0x1f2f('0x7a')||_0x50043e===_0x1f2f('0x7b')||_0x50043e===_0x1f2f('0x7c')||_0x50043e===_0x1f2f('0x7d')||_0x50043e===_0x1f2f('0x7e')||_0x50043e===_0x1f2f('0x7f')||_0x50043e===_0x1f2f('0x80')||_0x50043e===_0x1f2f('0x81')||_0x50043e===_0x1f2f('0x82')||_0x50043e==='xmd-agi'||_0x50043e===_0x1f2f('0x83')||_0x50043e==='rtpaudioqosbridged'||_0x50043e===_0x1f2f('0x84')||_0x50043e==='rtpaudioqosjitterbridged'||_0x50043e===_0x1f2f('0x85')||_0x50043e===_0x1f2f('0x86')||_0x50043e==='rtpaudioqosrtt'||_0x50043e===_0x1f2f('0x87')||_0x50043e===_0x1f2f('0x83')||_0x50043e===_0x1f2f('0x88')||_0x50043e===_0x1f2f('0x84')||_0x50043e===_0x1f2f('0x89')||_0x50043e==='rtpaudioqosloss'||_0x50043e===_0x1f2f('0x86')||_0x50043e===_0x1f2f('0x8a')||_0x50043e===_0x1f2f('0x87')||_0x50043e==='bridgepeer'||_0x50043e===_0x1f2f('0x8b')||_0x50043e===_0x1f2f('0x36')||_0x50043e===_0x1f2f('0x3c')){return![];}return!![];};exports[_0x1f2f('0x8c')]=function(_0x571fa0,_0x204148){var _0x52409e,_0x4735a0,_0x59735a;if(_0x204148<=0x0){_0x204148=0x1;}_0x52409e=new RegExp(_0x1f2f('0x8d')+_0x204148+'}$');_0x4735a0=Math[_0x1f2f('0x8e')](0xa,_0x204148-0x1);_0x59735a=Math[_0x1f2f('0x8e')](0xa,_0x204148)-0x1;return util['format']('%s',_[_0x1f2f('0x8f')](_0x571fa0,_0x52409e,_[_0x1f2f('0x90')](_0x4735a0,_0x59735a)));};exports[_0x1f2f('0x91')]=function(_0x14b1ae){var _0xe5796c=_0x14b1ae[_0x1f2f('0x92')](/"(.*?)"/);return _0xe5796c?_0xe5796c[0x1]:_0x14b1ae;};exports['extractCalleridNumber']=function(_0x5ec02e){var _0x4ec495=_0x5ec02e['match'](/<(.*?)>/);return _0x4ec495?_0x4ec495[0x1]:_0x5ec02e;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index d656d68..33c654a 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 _0x1a1e=['voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause','reload'];(function(_0xe2df24,_0x44cdb9){var _0x36cf7b=function(_0x2aede6){while(--_0x2aede6){_0xe2df24['push'](_0xe2df24['shift']());}};_0x36cf7b(++_0x44cdb9);}(_0x1a1e,0xbf));var _0xe1a1=function(_0x46753c,_0x1d8501){_0x46753c=_0x46753c-0x0;var _0x5edd01=_0x1a1e[_0x46753c];return _0x5edd01;};'use strict';exports[_0xe1a1('0x0')]={'queue':{'type':_0xe1a1('0x1'),'required':!![]},'interface':{'type':_0xe1a1('0x1'),'required':!![]},'membername':{'type':_0xe1a1('0x1'),'required':!![]},'penalty':{'type':_0xe1a1('0x2'),'required':![]},'paused':{'type':_0xe1a1('0x3'),'required':![]}};exports[_0xe1a1('0x4')]={'queue':{'type':_0xe1a1('0x1'),'required':!![]},'interface':{'type':_0xe1a1('0x1'),'required':!![]}};exports[_0xe1a1('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xe1a1('0x3')},'reason':{'type':'string','required':![]}};exports[_0xe1a1('0x6')]={'module':{'type':'string','required':![]}};exports[_0xe1a1('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xe1a1('0x8')]={'uniqueid':{'type':_0xe1a1('0x1'),'required':!![]},'filename':{'type':_0xe1a1('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xe1a1('0x1')}};exports[_0xe1a1('0x9')]={'uniqueid':{'type':_0xe1a1('0x1'),'required':!![]}};exports[_0xe1a1('0xa')]={'uniqueid':{'type':_0xe1a1('0x1'),'required':!![]},'exten':{'type':_0xe1a1('0x1'),'required':!![]},'context':{'type':_0xe1a1('0x1')}}; \ No newline at end of file +var _0xb9fa=['queuepause','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','queueremove'];(function(_0x33e114,_0x77cc5a){var _0x17e9b6=function(_0xd1cb2f){while(--_0xd1cb2f){_0x33e114['push'](_0x33e114['shift']());}};_0x17e9b6(++_0x77cc5a);}(_0xb9fa,0xa1));var _0xab9f=function(_0x5d8824,_0x164edc){_0x5d8824=_0x5d8824-0x0;var _0x5359d9=_0xb9fa[_0x5d8824];return _0x5359d9;};'use strict';exports[_0xab9f('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xab9f('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xab9f('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xab9f('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xab9f('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xab9f('0x5')},'reason':{'type':_0xab9f('0x1'),'required':![]}};exports[_0xab9f('0x6')]={'module':{'type':_0xab9f('0x1'),'required':![]}};exports[_0xab9f('0x7')]={'uniqueid':{'type':_0xab9f('0x1'),'required':!![]}};exports[_0xab9f('0x8')]={'uniqueid':{'type':_0xab9f('0x1'),'required':!![]},'filename':{'type':_0xab9f('0x1')},'format':{'type':_0xab9f('0x1')},'mixmonitorid':{'type':_0xab9f('0x1')}};exports[_0xab9f('0x9')]={'uniqueid':{'type':_0xab9f('0x1'),'required':!![]}};exports[_0xab9f('0xa')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xab9f('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 2d8bf1c..7db5dea 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 _0xc11a=['initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','name','interface','SIP/%s','total','answered','sumHoldTime','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isNil','isUndefined','initTrunks','voiceQueues','initTriggers','triggers','initTemplates','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','sumBillable'];(function(_0xe65c25,_0x4786e0){var _0x43cfc4=function(_0x49883a){while(--_0x49883a){_0xe65c25['push'](_0xe65c25['shift']());}};_0x43cfc4(++_0x4786e0);}(_0xc11a,0x1b8));var _0xac11=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xc11a[_0x68ee8b];return _0x5148f7;};'use strict';var BPromise=require('bluebird');var util=require(_0xac11('0x0'));var _=require('lodash');var moment=require(_0xac11('0x1'));var Agent=require(_0xac11('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0xac11('0x3'));var VoiceQueue=require(_0xac11('0x4'));var Trigger=require(_0xac11('0x5'));var Template=require('../model/template');var Campaign=require(_0xac11('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xac11('0x7'));var SalesforceAccount=require(_0xac11('0x8'));var FreshdeskAccount=require(_0xac11('0x9'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xac11('0xa'));var DeskAccount=require(_0xac11('0xb'));var VtigerAccount=require(_0xac11('0xc'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xac11('0xd'));var Realtime=function(){this[_0xac11('0xe')]={};this[_0xac11('0xf')]={};this[_0xac11('0x10')]={};this['voiceQueues']={};this['triggers']={};this[_0xac11('0x11')]={};this[_0xac11('0x12')]={};this[_0xac11('0x13')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0xac11('0x14')]={};this[_0xac11('0x15')]={};this[_0xac11('0x16')]={};this[_0xac11('0x17')]={};this[_0xac11('0x18')]={};this[_0xac11('0x19')]={};this[_0xac11('0x1a')]={};this['freshdeskAccounts']={};this[_0xac11('0x1b')]={};this[_0xac11('0x1c')]={};this[_0xac11('0x1d')]={};this[_0xac11('0x1e')]={};this[_0xac11('0x1f')]={};this[_0xac11('0x20')]={};this[_0xac11('0x21')]={};};function freeIsNotKey(_0x3e7b1b,_0x4da881,_0x846e8b){var _0x36aa70=_['mapKeys'](_0x3e7b1b,function(_0x4332c1,_0x4ad7f4){return _0x4332c1[_0x846e8b];});for(var _0x54ed88 in _0x4da881){if(_0x4da881[_0xac11('0x22')](_0x54ed88)){if(!_0x36aa70[_0x54ed88]){delete _0x4da881[_0x54ed88];}}}}function freeIsNotKeySip(_0x2e909c,_0x570bff){var _0x5c2c6e=_[_0xac11('0x23')](_0x2e909c,function(_0x170588,_0x30faf0){return util[_0xac11('0x24')]('SIP/%s',_0x170588[_0xac11('0x25')]);});for(var _0x50a096 in _0x570bff){if(_0x570bff[_0xac11('0x22')](_0x50a096)){if(!_0x5c2c6e[_0x50a096]){delete _0x570bff[_0x50a096];}}}}function freeIsNotKeyAgent(_0x2e61a8,_0x1395df){var _0x1ea55f=_[_0xac11('0x23')](_0x2e61a8,function(_0x12c060,_0x57b426){var _0x177c9b=_['isNil'](_0x12c060[_0xac11('0x26')])?util[_0xac11('0x24')](_0xac11('0x27'),_0x12c060['name']):_0x12c060[_0xac11('0x26')];return _0x177c9b;});for(var _0x10781c in _0x1395df){if(_0x1395df[_0xac11('0x22')](_0x10781c)){if(!_0x1ea55f[_0x10781c]){delete _0x1395df[_0x10781c];}}}}function clearVoiceCallReports(_0x5c0ce6){_0x5c0ce6[_0xac11('0x28')]=0x0;_0x5c0ce6[_0xac11('0x29')]=0x0;_0x5c0ce6[_0xac11('0x2a')]=0x0;_0x5c0ce6['sumDuration']=0x0;_0x5c0ce6['sumBillable']=0x0;}function clearCampaigns(_0x55ec50){if(!_[_0xac11('0x2b')](_0x55ec50)){for(var _0x274ec0 in _0x55ec50){if(_0x55ec50['hasOwnProperty'](_0x274ec0)){_0x55ec50[_0x274ec0]['ivrTotalCallsDays']=0x0;_0x55ec50[_0x274ec0][_0xac11('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x338123){if(!_[_0xac11('0x2b')](_0x338123)){for(var _0x45f734 in _0x338123){if(_0x338123['hasOwnProperty'](_0x45f734)){_0x338123[_0x45f734][_0xac11('0x28')]=0x0;_0x338123[_0x45f734]['answered']=0x0;_0x338123[_0x45f734][_0xac11('0x2d')]=0x0;_0x338123[_0x45f734][_0xac11('0x2e')]=0x0;_0x338123[_0x45f734][_0xac11('0x2a')]=0x0;_0x338123[_0x45f734][_0xac11('0x2f')]=0x0;_0x338123[_0x45f734]['sumBillable']=0x0;_0x338123[_0x45f734][_0xac11('0x30')]=0x0;_0x338123[_0x45f734][_0xac11('0x31')]=0x0;_0x338123[_0x45f734][_0xac11('0x32')]=0x0;_0x338123[_0x45f734][_0xac11('0x33')]=0x0;_0x338123[_0x45f734][_0xac11('0x34')]=0x0;_0x338123[_0x45f734][_0xac11('0x35')]=0x0;_0x338123[_0x45f734][_0xac11('0x36')]=0x0;_0x338123[_0x45f734]['outboundDropCallsDayCallersExit']=0x0;_0x338123[_0x45f734][_0xac11('0x37')]=0x0;_0x338123[_0x45f734][_0xac11('0x38')]=0x0;_0x338123[_0x45f734]['outboundRejectCallsDay']=0x0;_0x338123[_0x45f734]['outboundReCallsDay']=0x0;_0x338123[_0x45f734][_0xac11('0x30')]=0x0;_0x338123[_0x45f734][_0xac11('0x39')]=0x0;_0x338123[_0x45f734][_0xac11('0x3a')]=!![];}}}}Realtime[_0xac11('0x3b')][_0xac11('0x3c')]=function(_0x5d394b,_0x111a04){for(var _0xa98843 in _0x111a04){if(_0x5d394b[_0xac11('0x22')](_0xa98843)){_0x5d394b[_0xa98843]=_0x111a04[_0xa98843];}}};Realtime[_0xac11('0x3b')][_0xac11('0x3d')]=function(){var _0x3a6104=this;return function(_0x285730){if(_0x285730){freeIsNotKeyAgent(_0x285730,_0x3a6104[_0xac11('0xe')]);for(var _0x5cdda4=0x0,_0x332d1b={},_0xf1e3f3={};_0x5cdda4<_0x285730[_0xac11('0x3e')];_0x5cdda4+=0x1){_0x332d1b=_0x285730[_0x5cdda4];var _0x4429c4=_[_0xac11('0x3f')](_0x332d1b[_0xac11('0x26')])?util[_0xac11('0x24')](_0xac11('0x27'),_0x332d1b['name']):_0x332d1b[_0xac11('0x26')];if(_['isUndefined'](_0x3a6104[_0xac11('0xe')][_0x4429c4])){_0x3a6104[_0xac11('0xe')][_0x4429c4]=new Agent(_0x332d1b);}else{_0x3a6104['mergeFromDatabase'](_0x3a6104[_0xac11('0xe')][_0x4429c4],_0x332d1b);}}}return _0x3a6104[_0xac11('0xe')];};};Realtime[_0xac11('0x3b')]['initTelephones']=function(){var _0x564e5b=this;return function(_0x26063d){if(_0x26063d){freeIsNotKeySip(_0x26063d,_0x564e5b['telephones']);for(var _0x52c279=0x0,_0x53368a={},_0x1e3d5f={};_0x52c279<_0x26063d['length'];_0x52c279+=0x1){_0x53368a=_0x26063d[_0x52c279];if(_[_0xac11('0x40')](_0x564e5b['telephones'][util[_0xac11('0x24')](_0xac11('0x27'),_0x53368a[_0xac11('0x25')])])){_0x564e5b[_0xac11('0xf')][util['format'](_0xac11('0x27'),_0x53368a[_0xac11('0x25')])]=new Telephone(_0x53368a);}else{_0x564e5b[_0xac11('0x3c')](_0x564e5b[_0xac11('0xf')][util[_0xac11('0x24')](_0xac11('0x27'),_0x53368a[_0xac11('0x25')])],_0x53368a);}}}return _0x564e5b[_0xac11('0xf')];};};Realtime[_0xac11('0x3b')][_0xac11('0x41')]=function(){var _0xd2fb77=this;return function(_0x3564b4){if(_0x3564b4){freeIsNotKeySip(_0x3564b4,_0xd2fb77[_0xac11('0x10')]);for(var _0x300e86=0x0,_0x53396d={},_0x19c7cc={};_0x300e86<_0x3564b4[_0xac11('0x3e')];_0x300e86+=0x1){_0x53396d=_0x3564b4[_0x300e86];if(_[_0xac11('0x40')](_0xd2fb77['trunks'][util[_0xac11('0x24')](_0xac11('0x27'),_0x53396d[_0xac11('0x25')])])){_0xd2fb77[_0xac11('0x10')][util[_0xac11('0x24')](_0xac11('0x27'),_0x53396d[_0xac11('0x25')])]=new Trunk(_0x53396d);}else{_0xd2fb77['mergeFromDatabase'](_0xd2fb77[_0xac11('0x10')][util[_0xac11('0x24')](_0xac11('0x27'),_0x53396d[_0xac11('0x25')])],_0x53396d);}}}return _0xd2fb77[_0xac11('0x10')];};};Realtime[_0xac11('0x3b')]['initVoiceQueues']=function(){var _0x1a68b4=this;return function(_0x205335){if(_0x205335){freeIsNotKey(_0x205335,_0x1a68b4[_0xac11('0x42')],'name');for(var _0x1a0754=0x0,_0x526143={},_0xd3ae43={};_0x1a0754<_0x205335[_0xac11('0x3e')];_0x1a0754+=0x1){_0x526143=_0x205335[_0x1a0754];if(_[_0xac11('0x40')](_0x1a68b4[_0xac11('0x42')][_0x526143[_0xac11('0x25')]])){_0x1a68b4[_0xac11('0x42')][_0x526143['name']]=new VoiceQueue(_0x526143);}else{_0x1a68b4[_0xac11('0x3c')](_0x1a68b4[_0xac11('0x42')][_0x526143[_0xac11('0x25')]],_0x526143);}}}return _0x1a68b4['voiceQueues'];};};Realtime[_0xac11('0x3b')][_0xac11('0x43')]=function(){var _0x1c9f1b=this;return function(_0x152f5a){if(_0x152f5a){freeIsNotKey(_0x152f5a,_0x1c9f1b['triggers'],'id');for(var _0x25508b=0x0,_0xd9d699={},_0x39eb01={};_0x25508b<_0x152f5a[_0xac11('0x3e')];_0x25508b+=0x1){_0xd9d699=_0x152f5a[_0x25508b];if(_[_0xac11('0x40')](_0x1c9f1b[_0xac11('0x44')][_0xd9d699['id']])){_0x1c9f1b[_0xac11('0x44')][_0xd9d699['id']]=new Trigger(_0xd9d699);}else{_0x1c9f1b[_0xac11('0x3c')](_0x1c9f1b['triggers'][_0xd9d699['id']],_0xd9d699);}}}return _0x1c9f1b[_0xac11('0x44')];};};Realtime[_0xac11('0x3b')][_0xac11('0x45')]=function(){var _0x2e2a10=this;return function(_0x7f1648){if(_0x7f1648){freeIsNotKey(_0x7f1648,_0x2e2a10[_0xac11('0x12')],'id');for(var _0x4b7b40=0x0,_0x55102f={},_0x3f5c00={};_0x4b7b40<_0x7f1648[_0xac11('0x3e')];_0x4b7b40+=0x1){_0x55102f=_0x7f1648[_0x4b7b40];if(_[_0xac11('0x40')](_0x2e2a10[_0xac11('0x12')][_0x55102f['id']])){_0x2e2a10[_0xac11('0x12')][_0x55102f['id']]=new Template(_0x55102f);}else{_0x2e2a10['mergeFromDatabase'](_0x2e2a10[_0xac11('0x12')][_0x55102f['id']],_0x55102f);}}}return _0x2e2a10[_0xac11('0x12')];};};Realtime[_0xac11('0x3b')]['initZendeskAccounts']=function(){var _0xe1cd7c=this;return function(_0x232e1a){if(_0x232e1a){freeIsNotKey(_0x232e1a,_0xe1cd7c['zendeskAccounts'],'id');for(var _0x3f2ce2=0x0,_0x2ce156={},_0x3a0d20={};_0x3f2ce2<_0x232e1a[_0xac11('0x3e')];_0x3f2ce2+=0x1){_0x2ce156=_0x232e1a[_0x3f2ce2];if(_[_0xac11('0x40')](_0xe1cd7c['zendeskAccounts'][_0x2ce156['id']])){_0xe1cd7c[_0xac11('0x18')][_0x2ce156['id']]=new ZendeskAccount(_0x2ce156);}else{_0xe1cd7c['mergeFromDatabase'](_0xe1cd7c['zendeskAccounts'][_0x2ce156['id']],_0x2ce156);}}}return _0xe1cd7c[_0xac11('0x18')];};};Realtime['prototype'][_0xac11('0x46')]=function(){var _0x4bc74f=this;return function(_0x5ea5ed){if(_0x5ea5ed){freeIsNotKey(_0x5ea5ed,_0x4bc74f['salesforceAccounts'],'id');for(var _0x43e53e=0x0,_0x4ba61e={},_0x349759={};_0x43e53e<_0x5ea5ed[_0xac11('0x3e')];_0x43e53e+=0x1){_0x4ba61e=_0x5ea5ed[_0x43e53e];if(_[_0xac11('0x40')](_0x4bc74f[_0xac11('0x19')][_0x4ba61e['id']])){_0x4bc74f[_0xac11('0x19')][_0x4ba61e['id']]=new SalesforceAccount(_0x4ba61e);}else{_0x4bc74f['mergeFromDatabase'](_0x4bc74f['salesforceAccounts'][_0x4ba61e['id']],_0x4ba61e);}}}return _0x4bc74f[_0xac11('0x19')];};};Realtime[_0xac11('0x3b')][_0xac11('0x47')]=function(){var _0x2fb813=this;return function(_0x27e1b4){if(_0x27e1b4){freeIsNotKey(_0x27e1b4,_0x2fb813[_0xac11('0x48')],'id');for(var _0x2f4b8e=0x0,_0x4b6871={},_0x303fca={};_0x2f4b8e<_0x27e1b4['length'];_0x2f4b8e+=0x1){_0x4b6871=_0x27e1b4[_0x2f4b8e];if(_[_0xac11('0x40')](_0x2fb813[_0xac11('0x48')][_0x4b6871['id']])){_0x2fb813['freshdeskAccounts'][_0x4b6871['id']]=new FreshdeskAccount(_0x4b6871);}else{_0x2fb813['mergeFromDatabase'](_0x2fb813[_0xac11('0x48')][_0x4b6871['id']],_0x4b6871);}}}return _0x2fb813[_0xac11('0x48')];};};Realtime[_0xac11('0x3b')][_0xac11('0x49')]=function(){var _0x2a79b4=this;return function(_0x165205){if(_0x165205){freeIsNotKey(_0x165205,_0x2a79b4[_0xac11('0x1b')],'id');for(var _0x1191dc=0x0,_0x4e2b4f={},_0x55daf9={};_0x1191dc<_0x165205['length'];_0x1191dc+=0x1){_0x4e2b4f=_0x165205[_0x1191dc];if(_['isUndefined'](_0x2a79b4[_0xac11('0x1b')][_0x4e2b4f['id']])){_0x2a79b4[_0xac11('0x1b')][_0x4e2b4f['id']]=new ZohoAccount(_0x4e2b4f);}else{_0x2a79b4[_0xac11('0x3c')](_0x2a79b4[_0xac11('0x1b')][_0x4e2b4f['id']],_0x4e2b4f);}}}return _0x2a79b4[_0xac11('0x1b')];};};Realtime[_0xac11('0x3b')]['initDeskAccounts']=function(){var _0x31a309=this;return function(_0x372357){if(_0x372357){freeIsNotKey(_0x372357,_0x31a309[_0xac11('0x1c')],'id');for(var _0x25f4d5=0x0,_0x90ea34={},_0x5c70da={};_0x25f4d5<_0x372357[_0xac11('0x3e')];_0x25f4d5+=0x1){_0x90ea34=_0x372357[_0x25f4d5];if(_['isUndefined'](_0x31a309[_0xac11('0x1c')][_0x90ea34['id']])){_0x31a309[_0xac11('0x1c')][_0x90ea34['id']]=new DeskAccount(_0x90ea34);}else{_0x31a309['mergeFromDatabase'](_0x31a309[_0xac11('0x1c')][_0x90ea34['id']],_0x90ea34);}}}return _0x31a309['deskAccounts'];};};Realtime[_0xac11('0x3b')][_0xac11('0x4a')]=function(){var _0xdc5c3f=this;return function(_0x4f9623){if(_0x4f9623){freeIsNotKey(_0x4f9623,_0xdc5c3f['sugarcrmAccounts'],'id');for(var _0x292a5f=0x0,_0x4d6b4f={},_0x1bd48d={};_0x292a5f<_0x4f9623[_0xac11('0x3e')];_0x292a5f+=0x1){_0x4d6b4f=_0x4f9623[_0x292a5f];if(_['isUndefined'](_0xdc5c3f[_0xac11('0x1a')][_0x4d6b4f['id']])){_0xdc5c3f[_0xac11('0x1a')][_0x4d6b4f['id']]=new SugarcrmAccount(_0x4d6b4f);}else{_0xdc5c3f[_0xac11('0x3c')](_0xdc5c3f[_0xac11('0x1a')][_0x4d6b4f['id']],_0x4d6b4f);}}}return _0xdc5c3f[_0xac11('0x1a')];};};Realtime[_0xac11('0x3b')][_0xac11('0x4b')]=function(){var _0xbf46af=this;return function(_0xc54755){if(_0xc54755){freeIsNotKey(_0xc54755,_0xbf46af[_0xac11('0x1d')],'id');for(var _0x28f041=0x0,_0x5c4054={},_0x570683={};_0x28f041<_0xc54755[_0xac11('0x3e')];_0x28f041+=0x1){_0x5c4054=_0xc54755[_0x28f041];if(_['isUndefined'](_0xbf46af[_0xac11('0x1d')][_0x5c4054['id']])){_0xbf46af[_0xac11('0x1d')][_0x5c4054['id']]=new VtigerAccount(_0x5c4054);}else{_0xbf46af[_0xac11('0x3c')](_0xbf46af['vtigerAccounts'][_0x5c4054['id']],_0x5c4054);}}}return _0xbf46af[_0xac11('0x1d')];};};Realtime[_0xac11('0x3b')][_0xac11('0x4c')]=function(){var _0x4335c5=this;return function(_0x39d294){if(_0x39d294){freeIsNotKey(_0x39d294,_0x4335c5[_0xac11('0x1e')],'id');for(var _0x2c09ad=0x0,_0x27eb37={},_0xa8f3eb={};_0x2c09ad<_0x39d294['length'];_0x2c09ad+=0x1){_0x27eb37=_0x39d294[_0x2c09ad];if(_[_0xac11('0x40')](_0x4335c5[_0xac11('0x1e')][_0x27eb37['id']])){_0x4335c5[_0xac11('0x1e')][_0x27eb37['id']]=new ServicenowAccount(_0x27eb37);}else{_0x4335c5[_0xac11('0x3c')](_0x4335c5[_0xac11('0x1e')][_0x27eb37['id']],_0x27eb37);}}}return _0x4335c5['servicenowAccounts'];};};Realtime[_0xac11('0x3b')][_0xac11('0x4d')]=function(){var _0x535109=this;return function(_0xcf629b){if(_0xcf629b){freeIsNotKey(_0xcf629b,_0x535109['dynamics365Accounts'],'id');for(var _0x26f211=0x0,_0x1ec987={},_0x1febb1={};_0x26f211<_0xcf629b[_0xac11('0x3e')];_0x26f211+=0x1){_0x1ec987=_0xcf629b[_0x26f211];if(_[_0xac11('0x40')](_0x535109['dynamics365Accounts'][_0x1ec987['id']])){_0x535109[_0xac11('0x1f')][_0x1ec987['id']]=new Dynamics365Account(_0x1ec987);}else{_0x535109['mergeFromDatabase'](_0x535109[_0xac11('0x1f')][_0x1ec987['id']],_0x1ec987);}}}return _0x535109[_0xac11('0x1f')];};};Realtime['prototype'][_0xac11('0x4e')]=function(){var _0x4f7b2a=this;return function(_0x602f33){if(_0x602f33){freeIsNotKey(_0x602f33,_0x4f7b2a[_0xac11('0x20')],'id');for(var _0x3cfc96=0x0,_0x5c4536={},_0x4dfec7={};_0x3cfc96<_0x602f33[_0xac11('0x3e')];_0x3cfc96+=0x1){_0x5c4536=_0x602f33[_0x3cfc96];if(_[_0xac11('0x40')](_0x4f7b2a[_0xac11('0x20')][_0x5c4536['id']])){_0x4f7b2a[_0xac11('0x20')][_0x5c4536['id']]=new FreshsalesAccount(_0x5c4536);}else{_0x4f7b2a[_0xac11('0x3c')](_0x4f7b2a[_0xac11('0x20')][_0x5c4536['id']],_0x5c4536);}}}return _0x4f7b2a['freshsalesAccounts'];};};Realtime['prototype'][_0xac11('0x4f')]=function(){var _0xb73b64=this;return function(_0xbea37f){for(var _0x39ed2e=0x0;_0x39ed2e<_0xbea37f[_0xac11('0x3e')];_0x39ed2e+=0x1){_[_0xac11('0x50')](_0xb73b64['voiceQueues'][_0xbea37f[_0x39ed2e][_0xac11('0x25')]],_0xbea37f[_0x39ed2e]);}return _0xb73b64[_0xac11('0x42')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x38630a=this;return function(_0x3ef8d9){clearVoiceQueues(_0x38630a[_0xac11('0x42')]);if(_0x3ef8d9){_0x3ef8d9=_[_0xac11('0x51')](_0x3ef8d9,_0xac11('0x52'));for(var _0x5ea25d in _0x3ef8d9){if(_0x3ef8d9['hasOwnProperty'](_0x5ea25d)){var _0x2bfac7={};for(var _0x39d9a0=0x0;_0x39d9a0<_0x3ef8d9[_0x5ea25d][_0xac11('0x3e')];_0x39d9a0+=0x1){var _0x459ccd=_0x3ef8d9[_0x5ea25d][_0x39d9a0][_0xac11('0x53')];if(_0x38630a[_0xac11('0x42')][_0x459ccd]){if(_0x3ef8d9[_0x5ea25d][_0x39d9a0][_0xac11('0x54')]){_0x38630a[_0xac11('0x42')][_0x459ccd][_0xac11('0x2d')]+=0x1;}if(_0x3ef8d9[_0x5ea25d][_0x39d9a0][_0xac11('0x55')]){_0x38630a[_0xac11('0x42')][_0x459ccd]['abandoned']+=0x1;}_0x38630a['voiceQueues'][_0x459ccd][_0xac11('0x2a')]+=moment(_0x3ef8d9[_0x5ea25d][_0x39d9a0][_0xac11('0x56')])[_0xac11('0x57')](moment(_0x3ef8d9[_0x5ea25d][_0x39d9a0][_0xac11('0x58')]),_0xac11('0x59'))||0x0;if(_0x39d9a0===_0x3ef8d9[_0x5ea25d][_0xac11('0x3e')]-0x1){_0x38630a['voiceQueues'][_0x459ccd][_0xac11('0x2f')]+=moment(_0x3ef8d9[_0x5ea25d][_0x39d9a0][_0xac11('0x5a')]||_0x3ef8d9[_0x5ea25d][_0x39d9a0][_0xac11('0x5b')]||_0x3ef8d9[_0x5ea25d][_0x39d9a0][_0xac11('0x5c')])[_0xac11('0x57')](moment(_0x3ef8d9[_0x5ea25d][_0x39d9a0][_0xac11('0x58')]),'seconds')||0x0;_0x38630a[_0xac11('0x42')][_0x459ccd]['total']+=0x1;if(_0x3ef8d9[_0x5ea25d][_0x39d9a0][_0xac11('0x5d')]){_0x38630a[_0xac11('0x42')][_0x459ccd][_0xac11('0x29')]+=0x1;_0x38630a[_0xac11('0x42')][_0x459ccd][_0xac11('0x5e')]+=moment(_0x3ef8d9[_0x5ea25d][_0x39d9a0][_0xac11('0x5a')])[_0xac11('0x57')](moment(_0x3ef8d9[_0x5ea25d][_0x39d9a0][_0xac11('0x56')]),'seconds')||0x0;}}else{_0x38630a[_0xac11('0x42')][_0x459ccd]['sumDuration']+=_0x38630a[_0xac11('0x42')][_0x459ccd][_0xac11('0x2a')]||0x0;}}}}}}return _0x38630a[_0xac11('0x42')];};};Realtime['prototype'][_0xac11('0x5f')]=function(){var _0x163b41=this;return function(_0x3e6817){clearVoiceCallReports(_0x163b41['outbound']);if(_0x3e6817){for(var _0x53652d=0x0;_0x53652d<_0x3e6817[_0xac11('0x3e')];_0x53652d+=0x1){_0x163b41['outbound'][_0xac11('0x28')]+=0x1;_0x163b41[_0xac11('0x13')][_0xac11('0x2f')]+=_0x3e6817[_0x53652d][_0xac11('0x60')];if(_0x3e6817[_0x53652d][_0xac11('0x61')]===_0xac11('0x62')){_0x163b41[_0xac11('0x13')]['answered']+=0x1;_0x163b41['outbound'][_0xac11('0x2a')]+=_0x3e6817[_0x53652d]['duration']-_0x3e6817[_0x53652d][_0xac11('0x63')]||0x0;_0x163b41[_0xac11('0x13')][_0xac11('0x5e')]+=_0x3e6817[_0x53652d][_0xac11('0x63')];}}}return _0x163b41['outbound'];};};Realtime[_0xac11('0x3b')][_0xac11('0x64')]=function(){var _0x3f0359=this;return function(_0x277a15){if(_0x277a15){freeIsNotKey(_0x277a15,_0x3f0359[_0xac11('0x11')],_0xac11('0x25'));for(var _0x187dc0=0x0,_0x2ed082={};_0x187dc0<_0x277a15[_0xac11('0x3e')];_0x187dc0+=0x1){_0x2ed082=_0x277a15[_0x187dc0];if(_[_0xac11('0x40')](_0x3f0359[_0xac11('0x11')][_0x2ed082['name']])){_0x3f0359[_0xac11('0x11')][_0x2ed082['name']]=new Campaign(_0x2ed082);}else{_0x3f0359[_0xac11('0x3c')](_0x3f0359[_0xac11('0x11')][_0x2ed082[_0xac11('0x25')]],_0x2ed082);_0x3f0359['campaigns'][_0x2ed082[_0xac11('0x25')]][_0xac11('0x65')]=_0x2ed082[_0xac11('0x66')]?_0x2ed082[_0xac11('0x66')][_0xac11('0x25')]:undefined;}}}return _0x3f0359['campaigns'];};};Realtime[_0xac11('0x3b')]['initVoiceExtensions']=function(){var _0x5bb289=this;return function(_0x43db1f){if(_0x43db1f){freeIsNotKey(_0x43db1f,_0x5bb289[_0xac11('0x67')],'id');for(var _0x5d38fb=0x0,_0x4b4adb={};_0x5d38fb<_0x43db1f['length'];_0x5d38fb+=0x1){_0x4b4adb=_0x43db1f[_0x5d38fb];if(_[_0xac11('0x40')](_0x5bb289[_0xac11('0x67')][_0x4b4adb['id']])){_0x5bb289[_0xac11('0x67')][_0x4b4adb['id']]=new VoiceExtension(_0x4b4adb);}else{_0x5bb289[_0xac11('0x3c')](_0x5bb289[_0xac11('0x67')][_0x4b4adb['id']],_0x4b4adb);}}}return _0x5bb289[_0xac11('0x67')];};};Realtime['prototype'][_0xac11('0x68')]=function(){var _0x5b1699=this;return function(_0x100b7){clearCampaigns(_0x5b1699[_0xac11('0x11')]);for(var _0x4bee81=0x0;_0x4bee81<_0x100b7[_0xac11('0x3e')];_0x4bee81+=0x1){_[_0xac11('0x50')](_0x5b1699[_0xac11('0x11')][_0x100b7[_0x4bee81][_0xac11('0x25')]],_0x100b7[_0x4bee81]);}return _0x5b1699[_0xac11('0x11')];};};Realtime[_0xac11('0x3b')][_0xac11('0x69')]=function(){var _0x1eda17=this;return function(_0x3eb352){if(_0x3eb352){freeIsNotKey(_0x3eb352,_0x1eda17['faxAccounts'],'id');for(var _0x22ed9a=0x0,_0x239f9d={},_0xb82618={};_0x22ed9a<_0x3eb352['length'];_0x22ed9a+=0x1){_0x239f9d=_0x3eb352[_0x22ed9a];if(_[_0xac11('0x40')](_0x1eda17[_0xac11('0x21')][_0x239f9d['id']])){_0x1eda17[_0xac11('0x21')][_0x239f9d['id']]=new FaxAccount(_0x239f9d);}else{_0x1eda17[_0xac11('0x3c')](_0x1eda17[_0xac11('0x21')][_0x239f9d['id']],_0x239f9d);}}}return _0x1eda17['faxAccounts'];};};module[_0xac11('0x6a')]=Realtime; \ No newline at end of file +var _0x1fe2=['queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','seconds','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','agents','telephones','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','interface','total','answered','sumHoldTime','sumBillable','ivrTotalCallsDays','isEmpty','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','length','name','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon'];(function(_0x23ab94,_0x3ffe14){var _0x3be1aa=function(_0x385fa5){while(--_0x385fa5){_0x23ab94['push'](_0x23ab94['shift']());}};_0x3be1aa(++_0x3ffe14);}(_0x1fe2,0x1d1));var _0x21fe=function(_0xec2a9f,_0x53c0ed){_0xec2a9f=_0xec2a9f-0x0;var _0x294158=_0x1fe2[_0xec2a9f];return _0x294158;};'use strict';var BPromise=require(_0x21fe('0x0'));var util=require(_0x21fe('0x1'));var _=require(_0x21fe('0x2'));var moment=require('moment');var Agent=require(_0x21fe('0x3'));var Telephone=require(_0x21fe('0x4'));var Trunk=require(_0x21fe('0x5'));var VoiceQueue=require(_0x21fe('0x6'));var Trigger=require(_0x21fe('0x7'));var Template=require(_0x21fe('0x8'));var Campaign=require(_0x21fe('0x9'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x21fe('0xa'));var SalesforceAccount=require(_0x21fe('0xb'));var FreshdeskAccount=require(_0x21fe('0xc'));var SugarcrmAccount=require(_0x21fe('0xd'));var ZohoAccount=require(_0x21fe('0xe'));var DeskAccount=require(_0x21fe('0xf'));var VtigerAccount=require(_0x21fe('0x10'));var ServicenowAccount=require(_0x21fe('0x11'));var Dynamics365Account=require(_0x21fe('0x12'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x21fe('0x13')]={};this[_0x21fe('0x14')]={};this[_0x21fe('0x15')]={};this[_0x21fe('0x16')]={};this[_0x21fe('0x17')]={};this[_0x21fe('0x18')]={};this['templates']={};this[_0x21fe('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x21fe('0x1a')]={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0x21fe('0x1b')]={};this['settings']={};this[_0x21fe('0x1c')]={};this[_0x21fe('0x1d')]={};this['sugarcrmAccounts']={};this[_0x21fe('0x1e')]={};this[_0x21fe('0x1f')]={};this['deskAccounts']={};this['vtigerAccounts']={};this[_0x21fe('0x20')]={};this[_0x21fe('0x21')]={};this[_0x21fe('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0x21f3a3,_0x1ab0f0,_0x23855e){var _0x4719b5=_[_0x21fe('0x23')](_0x21f3a3,function(_0x37f34f,_0x2c8a57){return _0x37f34f[_0x23855e];});for(var _0x2611af in _0x1ab0f0){if(_0x1ab0f0[_0x21fe('0x24')](_0x2611af)){if(!_0x4719b5[_0x2611af]){delete _0x1ab0f0[_0x2611af];}}}}function freeIsNotKeySip(_0x4a8ad5,_0x4a2428){var _0x31c2dd=_[_0x21fe('0x23')](_0x4a8ad5,function(_0x3ec2bc,_0x2998b3){return util[_0x21fe('0x25')](_0x21fe('0x26'),_0x3ec2bc['name']);});for(var _0x6b5831 in _0x4a2428){if(_0x4a2428[_0x21fe('0x24')](_0x6b5831)){if(!_0x31c2dd[_0x6b5831]){delete _0x4a2428[_0x6b5831];}}}}function freeIsNotKeyAgent(_0x27906b,_0x1de74b){var _0x5033b7=_[_0x21fe('0x23')](_0x27906b,function(_0x3f0194,_0x329dd7){var _0x446729=_['isNil'](_0x3f0194[_0x21fe('0x27')])?util[_0x21fe('0x25')](_0x21fe('0x26'),_0x3f0194['name']):_0x3f0194['interface'];return _0x446729;});for(var _0x5b0696 in _0x1de74b){if(_0x1de74b[_0x21fe('0x24')](_0x5b0696)){if(!_0x5033b7[_0x5b0696]){delete _0x1de74b[_0x5b0696];}}}}function clearVoiceCallReports(_0x14a260){_0x14a260[_0x21fe('0x28')]=0x0;_0x14a260[_0x21fe('0x29')]=0x0;_0x14a260[_0x21fe('0x2a')]=0x0;_0x14a260['sumDuration']=0x0;_0x14a260[_0x21fe('0x2b')]=0x0;}function clearCampaigns(_0x16f022){if(!_['isEmpty'](_0x16f022)){for(var _0x10ea61 in _0x16f022){if(_0x16f022['hasOwnProperty'](_0x10ea61)){_0x16f022[_0x10ea61][_0x21fe('0x2c')]=0x0;_0x16f022[_0x10ea61]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2bcf6b){if(!_[_0x21fe('0x2d')](_0x2bcf6b)){for(var _0x5395c2 in _0x2bcf6b){if(_0x2bcf6b[_0x21fe('0x24')](_0x5395c2)){_0x2bcf6b[_0x5395c2][_0x21fe('0x28')]=0x0;_0x2bcf6b[_0x5395c2]['answered']=0x0;_0x2bcf6b[_0x5395c2]['unmanaged']=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x2e')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x2a')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x2f')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x2b')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x30')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x31')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x32')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x33')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x34')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x35')]=0x0;_0x2bcf6b[_0x5395c2]['outboundDropCallsDayTimeout']=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x36')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x37')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x38')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x39')]=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x3a')]=0x0;_0x2bcf6b[_0x5395c2]['outboundAnswerAgiCallsDay']=0x0;_0x2bcf6b[_0x5395c2][_0x21fe('0x3b')]=0x0;_0x2bcf6b[_0x5395c2]['queueStatusComplete']=!![];}}}}Realtime[_0x21fe('0x3c')][_0x21fe('0x3d')]=function(_0x65fec,_0x2e8055){for(var _0x49ddd3 in _0x2e8055){if(_0x65fec['hasOwnProperty'](_0x49ddd3)){_0x65fec[_0x49ddd3]=_0x2e8055[_0x49ddd3];}}};Realtime['prototype'][_0x21fe('0x3e')]=function(){var _0x343488=this;return function(_0x967a10){if(_0x967a10){freeIsNotKeyAgent(_0x967a10,_0x343488[_0x21fe('0x13')]);for(var _0x703cfd=0x0,_0x2ca38c={},_0x1415a={};_0x703cfd<_0x967a10[_0x21fe('0x3f')];_0x703cfd+=0x1){_0x2ca38c=_0x967a10[_0x703cfd];var _0x3e0eaa=_['isNil'](_0x2ca38c[_0x21fe('0x27')])?util['format']('SIP/%s',_0x2ca38c[_0x21fe('0x40')]):_0x2ca38c[_0x21fe('0x27')];if(_[_0x21fe('0x41')](_0x343488[_0x21fe('0x13')][_0x3e0eaa])){_0x343488['agents'][_0x3e0eaa]=new Agent(_0x2ca38c);}else{_0x343488['mergeFromDatabase'](_0x343488[_0x21fe('0x13')][_0x3e0eaa],_0x2ca38c);}}}return _0x343488[_0x21fe('0x13')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x42')]=function(){var _0x56ae5b=this;return function(_0x815087){if(_0x815087){freeIsNotKeySip(_0x815087,_0x56ae5b[_0x21fe('0x14')]);for(var _0x4bb553=0x0,_0x1e2328={},_0x3238b3={};_0x4bb553<_0x815087[_0x21fe('0x3f')];_0x4bb553+=0x1){_0x1e2328=_0x815087[_0x4bb553];if(_[_0x21fe('0x41')](_0x56ae5b[_0x21fe('0x14')][util['format']('SIP/%s',_0x1e2328['name'])])){_0x56ae5b[_0x21fe('0x14')][util[_0x21fe('0x25')](_0x21fe('0x26'),_0x1e2328['name'])]=new Telephone(_0x1e2328);}else{_0x56ae5b['mergeFromDatabase'](_0x56ae5b[_0x21fe('0x14')][util[_0x21fe('0x25')](_0x21fe('0x26'),_0x1e2328['name'])],_0x1e2328);}}}return _0x56ae5b[_0x21fe('0x14')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x43')]=function(){var _0x5b304d=this;return function(_0x5720b5){if(_0x5720b5){freeIsNotKeySip(_0x5720b5,_0x5b304d[_0x21fe('0x15')]);for(var _0x2e2be2=0x0,_0x409a6a={},_0x4dd1b4={};_0x2e2be2<_0x5720b5[_0x21fe('0x3f')];_0x2e2be2+=0x1){_0x409a6a=_0x5720b5[_0x2e2be2];if(_[_0x21fe('0x41')](_0x5b304d['trunks'][util['format']('SIP/%s',_0x409a6a[_0x21fe('0x40')])])){_0x5b304d[_0x21fe('0x15')][util[_0x21fe('0x25')](_0x21fe('0x26'),_0x409a6a[_0x21fe('0x40')])]=new Trunk(_0x409a6a);}else{_0x5b304d[_0x21fe('0x3d')](_0x5b304d[_0x21fe('0x15')][util[_0x21fe('0x25')](_0x21fe('0x26'),_0x409a6a[_0x21fe('0x40')])],_0x409a6a);}}}return _0x5b304d['trunks'];};};Realtime['prototype'][_0x21fe('0x44')]=function(){var _0x560117=this;return function(_0x11028e){if(_0x11028e){freeIsNotKey(_0x11028e,_0x560117['voiceQueues'],_0x21fe('0x40'));for(var _0x5d958a=0x0,_0xb0904e={},_0x339ad3={};_0x5d958a<_0x11028e[_0x21fe('0x3f')];_0x5d958a+=0x1){_0xb0904e=_0x11028e[_0x5d958a];if(_[_0x21fe('0x41')](_0x560117[_0x21fe('0x16')][_0xb0904e[_0x21fe('0x40')]])){_0x560117[_0x21fe('0x16')][_0xb0904e[_0x21fe('0x40')]]=new VoiceQueue(_0xb0904e);}else{_0x560117[_0x21fe('0x3d')](_0x560117[_0x21fe('0x16')][_0xb0904e['name']],_0xb0904e);}}}return _0x560117['voiceQueues'];};};Realtime['prototype']['initTriggers']=function(){var _0x2bfde3=this;return function(_0x4b65de){if(_0x4b65de){freeIsNotKey(_0x4b65de,_0x2bfde3['triggers'],'id');for(var _0x1e33d2=0x0,_0x40ed0b={},_0x1aca9f={};_0x1e33d2<_0x4b65de[_0x21fe('0x3f')];_0x1e33d2+=0x1){_0x40ed0b=_0x4b65de[_0x1e33d2];if(_[_0x21fe('0x41')](_0x2bfde3[_0x21fe('0x17')][_0x40ed0b['id']])){_0x2bfde3['triggers'][_0x40ed0b['id']]=new Trigger(_0x40ed0b);}else{_0x2bfde3['mergeFromDatabase'](_0x2bfde3['triggers'][_0x40ed0b['id']],_0x40ed0b);}}}return _0x2bfde3['triggers'];};};Realtime['prototype'][_0x21fe('0x45')]=function(){var _0x53f887=this;return function(_0x5a9d4c){if(_0x5a9d4c){freeIsNotKey(_0x5a9d4c,_0x53f887[_0x21fe('0x46')],'id');for(var _0x229232=0x0,_0x2188a3={},_0x4576ad={};_0x229232<_0x5a9d4c[_0x21fe('0x3f')];_0x229232+=0x1){_0x2188a3=_0x5a9d4c[_0x229232];if(_[_0x21fe('0x41')](_0x53f887[_0x21fe('0x46')][_0x2188a3['id']])){_0x53f887['templates'][_0x2188a3['id']]=new Template(_0x2188a3);}else{_0x53f887['mergeFromDatabase'](_0x53f887['templates'][_0x2188a3['id']],_0x2188a3);}}}return _0x53f887['templates'];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x47')]=function(){var _0x1ebd32=this;return function(_0x354edf){if(_0x354edf){freeIsNotKey(_0x354edf,_0x1ebd32[_0x21fe('0x1c')],'id');for(var _0x208bd1=0x0,_0x529087={},_0x5d9425={};_0x208bd1<_0x354edf[_0x21fe('0x3f')];_0x208bd1+=0x1){_0x529087=_0x354edf[_0x208bd1];if(_[_0x21fe('0x41')](_0x1ebd32['zendeskAccounts'][_0x529087['id']])){_0x1ebd32[_0x21fe('0x1c')][_0x529087['id']]=new ZendeskAccount(_0x529087);}else{_0x1ebd32[_0x21fe('0x3d')](_0x1ebd32[_0x21fe('0x1c')][_0x529087['id']],_0x529087);}}}return _0x1ebd32[_0x21fe('0x1c')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x48')]=function(){var _0x586d21=this;return function(_0x27dc91){if(_0x27dc91){freeIsNotKey(_0x27dc91,_0x586d21[_0x21fe('0x1d')],'id');for(var _0x3142dc=0x0,_0xad5a45={},_0x46f59d={};_0x3142dc<_0x27dc91['length'];_0x3142dc+=0x1){_0xad5a45=_0x27dc91[_0x3142dc];if(_[_0x21fe('0x41')](_0x586d21[_0x21fe('0x1d')][_0xad5a45['id']])){_0x586d21['salesforceAccounts'][_0xad5a45['id']]=new SalesforceAccount(_0xad5a45);}else{_0x586d21['mergeFromDatabase'](_0x586d21['salesforceAccounts'][_0xad5a45['id']],_0xad5a45);}}}return _0x586d21[_0x21fe('0x1d')];};};Realtime['prototype'][_0x21fe('0x49')]=function(){var _0x34b936=this;return function(_0x452d78){if(_0x452d78){freeIsNotKey(_0x452d78,_0x34b936[_0x21fe('0x1e')],'id');for(var _0x253edf=0x0,_0x3b9554={},_0x5ebe6a={};_0x253edf<_0x452d78[_0x21fe('0x3f')];_0x253edf+=0x1){_0x3b9554=_0x452d78[_0x253edf];if(_[_0x21fe('0x41')](_0x34b936[_0x21fe('0x1e')][_0x3b9554['id']])){_0x34b936[_0x21fe('0x1e')][_0x3b9554['id']]=new FreshdeskAccount(_0x3b9554);}else{_0x34b936[_0x21fe('0x3d')](_0x34b936[_0x21fe('0x1e')][_0x3b9554['id']],_0x3b9554);}}}return _0x34b936[_0x21fe('0x1e')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x4a')]=function(){var _0xe6418c=this;return function(_0x55d46f){if(_0x55d46f){freeIsNotKey(_0x55d46f,_0xe6418c[_0x21fe('0x1f')],'id');for(var _0x24b4bd=0x0,_0xd7b9e5={},_0x3fe1b8={};_0x24b4bd<_0x55d46f[_0x21fe('0x3f')];_0x24b4bd+=0x1){_0xd7b9e5=_0x55d46f[_0x24b4bd];if(_[_0x21fe('0x41')](_0xe6418c[_0x21fe('0x1f')][_0xd7b9e5['id']])){_0xe6418c[_0x21fe('0x1f')][_0xd7b9e5['id']]=new ZohoAccount(_0xd7b9e5);}else{_0xe6418c[_0x21fe('0x3d')](_0xe6418c['zohoAccounts'][_0xd7b9e5['id']],_0xd7b9e5);}}}return _0xe6418c[_0x21fe('0x1f')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x4b')]=function(){var _0x241c86=this;return function(_0x3f8134){if(_0x3f8134){freeIsNotKey(_0x3f8134,_0x241c86['deskAccounts'],'id');for(var _0x5ee2ad=0x0,_0x9d4ab4={},_0x21919a={};_0x5ee2ad<_0x3f8134[_0x21fe('0x3f')];_0x5ee2ad+=0x1){_0x9d4ab4=_0x3f8134[_0x5ee2ad];if(_[_0x21fe('0x41')](_0x241c86[_0x21fe('0x4c')][_0x9d4ab4['id']])){_0x241c86[_0x21fe('0x4c')][_0x9d4ab4['id']]=new DeskAccount(_0x9d4ab4);}else{_0x241c86[_0x21fe('0x3d')](_0x241c86['deskAccounts'][_0x9d4ab4['id']],_0x9d4ab4);}}}return _0x241c86[_0x21fe('0x4c')];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x1a39b6=this;return function(_0xf10837){if(_0xf10837){freeIsNotKey(_0xf10837,_0x1a39b6[_0x21fe('0x4d')],'id');for(var _0x2bf30c=0x0,_0x3f3d3f={},_0x33cffc={};_0x2bf30c<_0xf10837[_0x21fe('0x3f')];_0x2bf30c+=0x1){_0x3f3d3f=_0xf10837[_0x2bf30c];if(_[_0x21fe('0x41')](_0x1a39b6[_0x21fe('0x4d')][_0x3f3d3f['id']])){_0x1a39b6[_0x21fe('0x4d')][_0x3f3d3f['id']]=new SugarcrmAccount(_0x3f3d3f);}else{_0x1a39b6[_0x21fe('0x3d')](_0x1a39b6[_0x21fe('0x4d')][_0x3f3d3f['id']],_0x3f3d3f);}}}return _0x1a39b6[_0x21fe('0x4d')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x4e')]=function(){var _0x42a04d=this;return function(_0x2f1787){if(_0x2f1787){freeIsNotKey(_0x2f1787,_0x42a04d['vtigerAccounts'],'id');for(var _0x3533a6=0x0,_0x1be0a7={},_0x35f7e4={};_0x3533a6<_0x2f1787[_0x21fe('0x3f')];_0x3533a6+=0x1){_0x1be0a7=_0x2f1787[_0x3533a6];if(_['isUndefined'](_0x42a04d[_0x21fe('0x4f')][_0x1be0a7['id']])){_0x42a04d[_0x21fe('0x4f')][_0x1be0a7['id']]=new VtigerAccount(_0x1be0a7);}else{_0x42a04d['mergeFromDatabase'](_0x42a04d['vtigerAccounts'][_0x1be0a7['id']],_0x1be0a7);}}}return _0x42a04d['vtigerAccounts'];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x50')]=function(){var _0x94b04b=this;return function(_0x39cd17){if(_0x39cd17){freeIsNotKey(_0x39cd17,_0x94b04b['servicenowAccounts'],'id');for(var _0x4b141a=0x0,_0x3963ee={},_0x2dd33f={};_0x4b141a<_0x39cd17[_0x21fe('0x3f')];_0x4b141a+=0x1){_0x3963ee=_0x39cd17[_0x4b141a];if(_['isUndefined'](_0x94b04b[_0x21fe('0x20')][_0x3963ee['id']])){_0x94b04b[_0x21fe('0x20')][_0x3963ee['id']]=new ServicenowAccount(_0x3963ee);}else{_0x94b04b[_0x21fe('0x3d')](_0x94b04b[_0x21fe('0x20')][_0x3963ee['id']],_0x3963ee);}}}return _0x94b04b[_0x21fe('0x20')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x51')]=function(){var _0x1e9fa4=this;return function(_0x5c8337){if(_0x5c8337){freeIsNotKey(_0x5c8337,_0x1e9fa4[_0x21fe('0x21')],'id');for(var _0x43676e=0x0,_0x561a80={},_0x16414f={};_0x43676e<_0x5c8337[_0x21fe('0x3f')];_0x43676e+=0x1){_0x561a80=_0x5c8337[_0x43676e];if(_[_0x21fe('0x41')](_0x1e9fa4[_0x21fe('0x21')][_0x561a80['id']])){_0x1e9fa4[_0x21fe('0x21')][_0x561a80['id']]=new Dynamics365Account(_0x561a80);}else{_0x1e9fa4[_0x21fe('0x3d')](_0x1e9fa4[_0x21fe('0x21')][_0x561a80['id']],_0x561a80);}}}return _0x1e9fa4['dynamics365Accounts'];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x52')]=function(){var _0xf588c5=this;return function(_0x89145a){if(_0x89145a){freeIsNotKey(_0x89145a,_0xf588c5['freshsalesAccounts'],'id');for(var _0x191c14=0x0,_0x65b4eb={},_0x3e20e0={};_0x191c14<_0x89145a[_0x21fe('0x3f')];_0x191c14+=0x1){_0x65b4eb=_0x89145a[_0x191c14];if(_['isUndefined'](_0xf588c5['freshsalesAccounts'][_0x65b4eb['id']])){_0xf588c5['freshsalesAccounts'][_0x65b4eb['id']]=new FreshsalesAccount(_0x65b4eb);}else{_0xf588c5[_0x21fe('0x3d')](_0xf588c5['freshsalesAccounts'][_0x65b4eb['id']],_0x65b4eb);}}}return _0xf588c5[_0x21fe('0x22')];};};Realtime[_0x21fe('0x3c')]['initVoiceQueueHopperHistory']=function(){var _0x5b5b48=this;return function(_0x3c1e97){for(var _0x186136=0x0;_0x186136<_0x3c1e97[_0x21fe('0x3f')];_0x186136+=0x1){_[_0x21fe('0x53')](_0x5b5b48[_0x21fe('0x16')][_0x3c1e97[_0x186136]['name']],_0x3c1e97[_0x186136]);}return _0x5b5b48[_0x21fe('0x16')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x54')]=function(){var _0x1cbb5d=this;return function(_0x10a4d0){clearVoiceQueues(_0x1cbb5d[_0x21fe('0x16')]);if(_0x10a4d0){_0x10a4d0=_[_0x21fe('0x55')](_0x10a4d0,_0x21fe('0x56'));for(var _0x227cbf in _0x10a4d0){if(_0x10a4d0['hasOwnProperty'](_0x227cbf)){var _0x511c4d={};for(var _0x2dea31=0x0;_0x2dea31<_0x10a4d0[_0x227cbf][_0x21fe('0x3f')];_0x2dea31+=0x1){var _0xcfdc90=_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x57')];if(_0x1cbb5d[_0x21fe('0x16')][_0xcfdc90]){if(_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x58')]){_0x1cbb5d['voiceQueues'][_0xcfdc90]['unmanaged']+=0x1;}if(_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x59')]){_0x1cbb5d[_0x21fe('0x16')][_0xcfdc90][_0x21fe('0x2e')]+=0x1;}_0x1cbb5d['voiceQueues'][_0xcfdc90][_0x21fe('0x2a')]+=moment(_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x5a')])[_0x21fe('0x5b')](moment(_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x5c')]),'seconds')||0x0;if(_0x2dea31===_0x10a4d0[_0x227cbf][_0x21fe('0x3f')]-0x1){_0x1cbb5d[_0x21fe('0x16')][_0xcfdc90][_0x21fe('0x2f')]+=moment(_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x5d')]||_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x5e')]||_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x5f')])[_0x21fe('0x5b')](moment(_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x5c')]),'seconds')||0x0;_0x1cbb5d['voiceQueues'][_0xcfdc90][_0x21fe('0x28')]+=0x1;if(_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x60')]){_0x1cbb5d[_0x21fe('0x16')][_0xcfdc90][_0x21fe('0x29')]+=0x1;_0x1cbb5d[_0x21fe('0x16')][_0xcfdc90][_0x21fe('0x2b')]+=moment(_0x10a4d0[_0x227cbf][_0x2dea31][_0x21fe('0x5d')])[_0x21fe('0x5b')](moment(_0x10a4d0[_0x227cbf][_0x2dea31]['queuecallerleaveAt']),_0x21fe('0x61'))||0x0;}}else{_0x1cbb5d[_0x21fe('0x16')][_0xcfdc90][_0x21fe('0x2f')]+=_0x1cbb5d[_0x21fe('0x16')][_0xcfdc90][_0x21fe('0x2a')]||0x0;}}}}}}return _0x1cbb5d[_0x21fe('0x16')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x62')]=function(){var _0x4e36bf=this;return function(_0x4852cd){clearVoiceCallReports(_0x4e36bf['outbound']);if(_0x4852cd){for(var _0x5e01e6=0x0;_0x5e01e6<_0x4852cd[_0x21fe('0x3f')];_0x5e01e6+=0x1){_0x4e36bf[_0x21fe('0x19')][_0x21fe('0x28')]+=0x1;_0x4e36bf[_0x21fe('0x19')][_0x21fe('0x2f')]+=_0x4852cd[_0x5e01e6][_0x21fe('0x63')];if(_0x4852cd[_0x5e01e6][_0x21fe('0x64')]===_0x21fe('0x65')){_0x4e36bf[_0x21fe('0x19')][_0x21fe('0x29')]+=0x1;_0x4e36bf[_0x21fe('0x19')][_0x21fe('0x2a')]+=_0x4852cd[_0x5e01e6]['duration']-_0x4852cd[_0x5e01e6]['billableseconds']||0x0;_0x4e36bf[_0x21fe('0x19')][_0x21fe('0x2b')]+=_0x4852cd[_0x5e01e6][_0x21fe('0x66')];}}}return _0x4e36bf[_0x21fe('0x19')];};};Realtime['prototype'][_0x21fe('0x67')]=function(){var _0x11371d=this;return function(_0x165e40){if(_0x165e40){freeIsNotKey(_0x165e40,_0x11371d[_0x21fe('0x18')],_0x21fe('0x40'));for(var _0x17d046=0x0,_0x3dcd0a={};_0x17d046<_0x165e40[_0x21fe('0x3f')];_0x17d046+=0x1){_0x3dcd0a=_0x165e40[_0x17d046];if(_[_0x21fe('0x41')](_0x11371d['campaigns'][_0x3dcd0a[_0x21fe('0x40')]])){_0x11371d[_0x21fe('0x18')][_0x3dcd0a['name']]=new Campaign(_0x3dcd0a);}else{_0x11371d['mergeFromDatabase'](_0x11371d[_0x21fe('0x18')][_0x3dcd0a['name']],_0x3dcd0a);_0x11371d[_0x21fe('0x18')][_0x3dcd0a[_0x21fe('0x40')]][_0x21fe('0x68')]=_0x3dcd0a['SquareProject']?_0x3dcd0a[_0x21fe('0x69')][_0x21fe('0x40')]:undefined;}}}return _0x11371d[_0x21fe('0x18')];};};Realtime['prototype'][_0x21fe('0x6a')]=function(){var _0x30cd51=this;return function(_0x310972){if(_0x310972){freeIsNotKey(_0x310972,_0x30cd51['voiceExtensions'],'id');for(var _0x4efdff=0x0,_0x37773c={};_0x4efdff<_0x310972[_0x21fe('0x3f')];_0x4efdff+=0x1){_0x37773c=_0x310972[_0x4efdff];if(_[_0x21fe('0x41')](_0x30cd51[_0x21fe('0x1a')][_0x37773c['id']])){_0x30cd51[_0x21fe('0x1a')][_0x37773c['id']]=new VoiceExtension(_0x37773c);}else{_0x30cd51[_0x21fe('0x3d')](_0x30cd51[_0x21fe('0x1a')][_0x37773c['id']],_0x37773c);}}}return _0x30cd51[_0x21fe('0x1a')];};};Realtime[_0x21fe('0x3c')][_0x21fe('0x6b')]=function(){var _0xe0f51=this;return function(_0x4b4bd3){clearCampaigns(_0xe0f51[_0x21fe('0x18')]);for(var _0x8b8e80=0x0;_0x8b8e80<_0x4b4bd3['length'];_0x8b8e80+=0x1){_['merge'](_0xe0f51[_0x21fe('0x18')][_0x4b4bd3[_0x8b8e80]['name']],_0x4b4bd3[_0x8b8e80]);}return _0xe0f51['campaigns'];};};Realtime['prototype'][_0x21fe('0x6c')]=function(){var _0x633218=this;return function(_0x2ec2ee){if(_0x2ec2ee){freeIsNotKey(_0x2ec2ee,_0x633218[_0x21fe('0x6d')],'id');for(var _0xb5ac8c=0x0,_0x1e116f={},_0xad97e0={};_0xb5ac8c<_0x2ec2ee['length'];_0xb5ac8c+=0x1){_0x1e116f=_0x2ec2ee[_0xb5ac8c];if(_[_0x21fe('0x41')](_0x633218['faxAccounts'][_0x1e116f['id']])){_0x633218[_0x21fe('0x6d')][_0x1e116f['id']]=new FaxAccount(_0x1e116f);}else{_0x633218[_0x21fe('0x3d')](_0x633218[_0x21fe('0x6d')][_0x1e116f['id']],_0x1e116f);}}}return _0x633218[_0x21fe('0x6d')];};};module[_0x21fe('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index ef02e02..331c31d 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 _0xbc5d=['length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','match','getAgentByInternal','keys','channel','split','calleridnum','internal','destination','exten','dialer','queue','lastdata','context','from-voip-provider','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','type','getCallType','UserId','membername','createdAt','monitors','connectedlinename','create','isArray','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','util','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','name','isNil','find','accountcode','interface','format','SIP/%s'];(function(_0x174566,_0x4172cf){var _0x11c188=function(_0x5220fc){while(--_0x5220fc){_0x174566['push'](_0x174566['shift']());}};_0x11c188(++_0x4172cf);}(_0xbc5d,0x13d));var _0xdbc5=function(_0x18739a,_0x5ca14a){_0x18739a=_0x18739a-0x0;var _0x52300d=_0xbc5d[_0x18739a];return _0x52300d;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xdbc5('0x0'));var config=require('../../../config/environment');var ami=require(_0xdbc5('0x1'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xdbc5('0x2'));var RpcMemberReport=require(_0xdbc5('0x3'));var RpcVoiceQueueReport=require(_0xdbc5('0x4'));var RpcVoiceRecording=require(_0xdbc5('0x5'));var RpcVoiceTransferReport=require(_0xdbc5('0x6'));var VoiceQueueReport=require(_0xdbc5('0x7'));var VoiceCallReport=require(_0xdbc5('0x8'));var VoiceAgentReport=require(_0xdbc5('0x9'));var VoiceDialReport=require(_0xdbc5('0xa'));var UserReport=require(_0xdbc5('0xb'));function Report(_0x2657c6){this[_0xdbc5('0xc')]=_0x2657c6;this['agents']=_0x2657c6[_0xdbc5('0xd')];this['telephones']=_0x2657c6[_0xdbc5('0xe')];}Report[_0xdbc5('0xf')][_0xdbc5('0x10')]=function(_0x29849a){var _0x4620fd=new VoiceQueueReport(this[_0xdbc5('0xc')]);var _0x40dcd5=new VoiceAgentReport(this['realtime']);var _0x5eb684=new VoiceDialReport(this[_0xdbc5('0xc')]);var _0x4dc188=new VoiceCallReport(this[_0xdbc5('0xc')]);var _0x266371=new UserReport(this[_0xdbc5('0xc')]);if(config[_0xdbc5('0x11')]&&config[_0xdbc5('0x11')][_0xdbc5('0x12')]){ami['on'](_0xdbc5('0x13'),this[_0xdbc5('0x14')]['bind'](this));ami['on'](_0xdbc5('0x15'),this[_0xdbc5('0x16')][_0xdbc5('0x17')](this));ami['on'](_0xdbc5('0x18'),this[_0xdbc5('0x19')]['bind'](this));ami['on'](_0xdbc5('0x1a'),this[_0xdbc5('0x1b')]['bind'](this));ami['on']('blindtransfer',this[_0xdbc5('0x1c')][_0xdbc5('0x17')](this));ami['on'](_0xdbc5('0x1d'),this[_0xdbc5('0x1e')][_0xdbc5('0x17')](this));}};Report[_0xdbc5('0xf')][_0xdbc5('0x1f')]=function(_0x57f3a1){var _0x21989f;_0x21989f=_['find'](this[_0xdbc5('0xd')],function(_0x22b34e){return _0x22b34e['accountcode']==_0x57f3a1||_0x22b34e[_0xdbc5('0x20')]==_0x57f3a1;});if(_[_0xdbc5('0x21')](_0x21989f)){var _0x1b0977=_[_0xdbc5('0x22')](this[_0xdbc5('0xe')],function(_0x41f6df){return _0x41f6df[_0xdbc5('0x23')]==_0x57f3a1||_0x41f6df[_0xdbc5('0x20')]==_0x57f3a1;});if(_0x1b0977){_0x21989f=_['find'](this[_0xdbc5('0xd')],function(_0x69b98c){return _0x69b98c[_0xdbc5('0x24')]==util[_0xdbc5('0x25')](_0xdbc5('0x26'),_0x1b0977['name']);});}}return _0x21989f;};Report[_0xdbc5('0xf')][_0xdbc5('0x14')]=function(_0x201502){for(var _0x3af2fb=0x0;_0x3af2fb<_0x201502[_0xdbc5('0x27')];_0x3af2fb+=0x1){var _0x76ab99=this['findAgent'](_0x201502[_0x3af2fb][_0xdbc5('0x28')]);if(_0x76ab99){_0x201502[_0x3af2fb][_0xdbc5('0x23')]=_0x76ab99[_0xdbc5('0x23')];_0x201502[_0x3af2fb][_0xdbc5('0x29')]=!![];_0x201502[_0x3af2fb][_0xdbc5('0x2a')]=_0x76ab99[_0xdbc5('0x20')];_0x201502[_0x3af2fb]['interface']=_[_0xdbc5('0x21')](_0x76ab99[_0xdbc5('0x24')])?util[_0xdbc5('0x25')](_0xdbc5('0x26'),_0x76ab99['name']):_0x76ab99['interface'];if(_0x201502[_0x3af2fb][_0xdbc5('0x2b')]){_0x201502[_0x3af2fb]['queuecallercompleteAt']=moment()[_0xdbc5('0x25')](_0xdbc5('0x2c'));}if(_0x201502[_0x3af2fb][_0xdbc5('0x2d')]){_0x201502[_0x3af2fb]['queuecallerexitAt']=moment()[_0xdbc5('0x25')](_0xdbc5('0x2c'));}RpcMemberReport['voiceQueueReport'](_0x201502[_0x3af2fb]);}RpcVoiceQueueReport['create'](_0x201502[_0x3af2fb]);}};function extractCalleridNumber(_0x2ba73e){var _0x277e59=_0x2ba73e[_0xdbc5('0x2e')](/<(.*?)>/);return _0x277e59?_0x277e59[0x1]:_0x2ba73e;}Report[_0xdbc5('0xf')][_0xdbc5('0x2f')]=function(_0x4d704d){for(var _0x23be74=0x0;_0x23be74','calleridname','linkedid','transfers','transfereelinkedid','UserId','monitor','monitors','monitorFilename','filename','createdAt','exten','xcally-motion-preview','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','forEach','startsWith','substring','indexOf','mobile','phone','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','bind','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','interface','format','SIP/%s','length','connectedlinenum','assigned','queuecallercomplete','queuecallerexit','queuecallerexitAt','voiceQueueReport','create','getAgentByInternal','keys','getCallType','split','outbound','internal','voiceCallReport','destination','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip'];(function(_0x18fa98,_0x5a594b){var _0x1cce1f=function(_0x6ab354){while(--_0x6ab354){_0x18fa98['push'](_0x18fa98['shift']());}};_0x1cce1f(++_0x5a594b);}(_0x3fa2,0x1f4));var _0x23fa=function(_0x40a44b,_0x2b8785){_0x40a44b=_0x40a44b-0x0;var _0x2b656d=_0x3fa2[_0x40a44b];return _0x2b656d;};'use strict';var _=require(_0x23fa('0x0'));var moment=require(_0x23fa('0x1'));var util=require(_0x23fa('0x2'));var config=require(_0x23fa('0x3'));var ami=require(_0x23fa('0x4'));var RpcVoiceAgentReport=require(_0x23fa('0x5'));var RpcVoiceCallReport=require(_0x23fa('0x6'));var RpcVoiceDialReport=require(_0x23fa('0x7'));var RpcMemberReport=require(_0x23fa('0x8'));var RpcVoiceQueueReport=require(_0x23fa('0x9'));var RpcVoiceRecording=require(_0x23fa('0xa'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x23fa('0xb'));var VoiceCallReport=require(_0x23fa('0xc'));var VoiceAgentReport=require(_0x23fa('0xd'));var VoiceDialReport=require(_0x23fa('0xe'));var UserReport=require(_0x23fa('0xf'));function Report(_0x3a592d){this[_0x23fa('0x10')]=_0x3a592d;this[_0x23fa('0x11')]=_0x3a592d[_0x23fa('0x11')];this[_0x23fa('0x12')]=_0x3a592d['telephones'];}Report[_0x23fa('0x13')][_0x23fa('0x14')]=function(_0x2788a2){var _0x1aecde=new VoiceQueueReport(this[_0x23fa('0x10')]);var _0x4f0f77=new VoiceAgentReport(this[_0x23fa('0x10')]);var _0x1651b9=new VoiceDialReport(this[_0x23fa('0x10')]);var _0x5f2ce6=new VoiceCallReport(this[_0x23fa('0x10')]);var _0x5ad79b=new UserReport(this[_0x23fa('0x10')]);if(config[_0x23fa('0x15')]&&config['xdr'][_0x23fa('0x16')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport']['bind'](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0x23fa('0x17')](this));ami['on'](_0x23fa('0x18'),this['voiceAgentReport'][_0x23fa('0x17')](this));ami['on'](_0x23fa('0x19'),this[_0x23fa('0x1a')][_0x23fa('0x17')](this));ami['on'](_0x23fa('0x1b'),this[_0x23fa('0x1c')][_0x23fa('0x17')](this));ami['on'](_0x23fa('0x1d'),this[_0x23fa('0x1e')][_0x23fa('0x17')](this));}};Report[_0x23fa('0x13')][_0x23fa('0x1f')]=function(_0x281f36){var _0x4266e9;_0x4266e9=_['find'](this[_0x23fa('0x11')],function(_0x3a939d){return _0x3a939d[_0x23fa('0x20')]==_0x281f36||_0x3a939d[_0x23fa('0x21')]==_0x281f36;});if(_[_0x23fa('0x22')](_0x4266e9)){var _0x177ea3=_['find'](this[_0x23fa('0x12')],function(_0x70a87d){return _0x70a87d[_0x23fa('0x20')]==_0x281f36||_0x70a87d[_0x23fa('0x21')]==_0x281f36;});if(_0x177ea3){_0x4266e9=_[_0x23fa('0x23')](this[_0x23fa('0x11')],function(_0x408dd6){return _0x408dd6[_0x23fa('0x24')]==util[_0x23fa('0x25')](_0x23fa('0x26'),_0x177ea3[_0x23fa('0x21')]);});}}return _0x4266e9;};Report[_0x23fa('0x13')]['voiceQueueReport']=function(_0x50ba88){for(var _0x4c3c6e=0x0;_0x4c3c6e<_0x50ba88[_0x23fa('0x27')];_0x4c3c6e+=0x1){var _0x38d967=this['findAgent'](_0x50ba88[_0x4c3c6e][_0x23fa('0x28')]);if(_0x38d967){_0x50ba88[_0x4c3c6e][_0x23fa('0x20')]=_0x38d967[_0x23fa('0x20')];_0x50ba88[_0x4c3c6e][_0x23fa('0x29')]=!![];_0x50ba88[_0x4c3c6e]['lastAssignedTo']=_0x38d967['name'];_0x50ba88[_0x4c3c6e][_0x23fa('0x24')]=_[_0x23fa('0x22')](_0x38d967[_0x23fa('0x24')])?util[_0x23fa('0x25')](_0x23fa('0x26'),_0x38d967['name']):_0x38d967[_0x23fa('0x24')];if(_0x50ba88[_0x4c3c6e][_0x23fa('0x2a')]){_0x50ba88[_0x4c3c6e]['queuecallercompleteAt']=moment()[_0x23fa('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x50ba88[_0x4c3c6e][_0x23fa('0x2b')]){_0x50ba88[_0x4c3c6e][_0x23fa('0x2c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x23fa('0x2d')](_0x50ba88[_0x4c3c6e]);}RpcVoiceQueueReport[_0x23fa('0x2e')](_0x50ba88[_0x4c3c6e]);}};function extractCalleridNumber(_0x4dce52){var _0x5bae8e=_0x4dce52['match'](/<(.*?)>/);return _0x5bae8e?_0x5bae8e[0x1]:_0x4dce52;}Report[_0x23fa('0x13')][_0x23fa('0x2f')]=function(_0x2a03d3){for(var _0x200e86=0x0;_0x200e860x0?_0x1abc6a:0x0;this['voiceQueues'][_0x3f6cfe[_0x515a('0x62')]][_0x515a('0x54')]=this[_0x515a('0x10')][_0x3f6cfe['queue']][_0x515a('0x54')]>_[_0x515a('0x67')](_0x3f6cfe['loggedin'])?_[_0x515a('0x67')](_0x3f6cfe[_0x515a('0x69')]):this[_0x515a('0x10')][_0x3f6cfe[_0x515a('0x62')]][_0x515a('0x54')];this['emitVoiceQueueSummary'](this[_0x515a('0x10')][_0x3f6cfe[_0x515a('0x62')]],_0x515a('0x13'));}logger[_0x515a('0x42')](_0x515a('0x6a'),util[_0x515a('0x3b')](this[_0x515a('0x10')][_0x3f6cfe[_0x515a('0x62')]],{'showHidden':![],'depth':null}));ami[_0x515a('0x41')](_0x515a('0x6b'),this[_0x515a('0x10')][_0x3f6cfe[_0x515a('0x62')]]);}}}catch(_0x1b98bc){logger[_0x515a('0x37')](_0x515a('0x61'),util[_0x515a('0x3b')](_0x1b98bc,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x515a('0x16')]=function(_0x1451e3){logger[_0x515a('0x42')](_0x515a('0x6c'),util[_0x515a('0x3b')](_0x1451e3,{'showHidden':![],'depth':null}));this[_0x515a('0x11')]=!![];};VoiceQueueReport[_0x515a('0xb')][_0x515a('0x6d')]=function(_0x54d464){try{if(this[_0x515a('0x5c')](_0x54d464)){logger[_0x515a('0x42')](_0x515a('0x6e'),_0x54d464[_0x515a('0x43')],util['inspect'](_0x54d464,{'showHidden':![],'depth':null}));if(_[_0x515a('0x5d')](this[_0x515a('0x39')][_0x54d464[_0x515a('0x43')]]))this[_0x515a('0x39')][_0x54d464[_0x515a('0x43')]]=[];if(_[_0x515a('0x5d')](this[_0x515a('0x2f')][_0x54d464['uniqueid']]))this[_0x515a('0x2f')][_0x54d464[_0x515a('0x43')]]={};var _0x33dff0=new QueueReport();_0x33dff0[_0x515a('0x46')]=_0x54d464[_0x515a('0x62')];_0x33dff0[_0x515a('0x4d')]=this[_0x515a('0x10')][_0x33dff0['name']]&&this[_0x515a('0x10')][_0x33dff0[_0x515a('0x46')]]['type']?this['voiceQueues'][_0x33dff0[_0x515a('0x46')]]['type']||_0x515a('0x6f'):_0x515a('0x6f');_0x33dff0[_0x515a('0x62')]=_0x54d464[_0x515a('0x62')];_0x33dff0[_0x515a('0x70')]=moment()[_0x515a('0x44')](_0x515a('0x71'));_0x33dff0[_0x515a('0x72')]=_0x54d464[_0x515a('0x72')];_0x33dff0[_0x515a('0x73')]=_0x54d464[_0x515a('0x73')];_0x33dff0[_0x515a('0x43')]=_0x54d464['uniqueid'];_0x33dff0[_0x515a('0x74')]=this[_0x515a('0x2f')][_0x54d464[_0x515a('0x43')]][_0x515a('0x74')];logger[_0x515a('0x64')](_0x515a('0x75'),_0x33dff0['name'],_0x33dff0[_0x515a('0x4d')]);_[_0x515a('0x76')](_0x33dff0,_[_0x515a('0x77')](_0x54d464,_[_0x515a('0x78')](_0x33dff0)));this[_0x515a('0x39')][_0x54d464['uniqueid']][_0x515a('0x79')](_0x33dff0);this['channels'][_0x54d464[_0x515a('0x43')]]=_0x33dff0;this[_0x515a('0x7a')](_0x33dff0,_0x515a('0x18'));}}catch(_0x3931bc){logger['error'](_0x515a('0x6e'),_0x54d464[_0x515a('0x43')],util[_0x515a('0x3b')](_0x3931bc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x515a('0xb')][_0x515a('0x7b')]=function(_0x2ad05e){try{if(this[_0x515a('0x5c')](_0x2ad05e)){logger[_0x515a('0x42')](_0x515a('0x7c'),_0x2ad05e[_0x515a('0x43')],util[_0x515a('0x3b')](_0x2ad05e,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2ad05e[_0x515a('0x43')]]){var _0x70ee5e=_[_0x515a('0x7d')](this[_0x515a('0x39')][_0x2ad05e['uniqueid']]);_0x70ee5e[_0x515a('0x7e')]=![];_0x70ee5e[_0x515a('0x7f')]=null;_0x70ee5e['holdtime']=_0x2ad05e['holdtime'];_0x70ee5e[_0x515a('0x80')]=_0x2ad05e['originalposition'];_0x70ee5e[_0x515a('0x81')]=!![];_0x70ee5e[_0x515a('0x82')]=moment()['format'](_0x515a('0x71'));_0x70ee5e[_0x515a('0x83')]=_0x515a('0x84');_0x70ee5e[_0x515a('0x85')]=null;logger[_0x515a('0x64')](_0x515a('0x86'),_0x70ee5e['name'],_0x70ee5e[_0x515a('0x4d')]);this['channels'][_0x2ad05e['uniqueid']]=_0x70ee5e;this[_0x515a('0x49')](_0x70ee5e,_0x515a('0x81'));}}}catch(_0x51ebcc){logger[_0x515a('0x37')](_0x515a('0x7c'),_0x2ad05e[_0x515a('0x43')],util[_0x515a('0x3b')](_0x51ebcc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x515a('0xb')][_0x515a('0x19')]=function(_0x56269a){try{if(this[_0x515a('0x5c')](_0x56269a)){logger[_0x515a('0x42')](_0x515a('0x87'),_0x56269a['uniqueid'],util[_0x515a('0x3b')](_0x56269a,{'showHidden':![],'depth':null}));if(this[_0x515a('0x39')][_0x56269a[_0x515a('0x43')]]){var _0x37060=_['last'](this[_0x515a('0x39')][_0x56269a[_0x515a('0x43')]]);_0x37060['queuecallerleaveAt']=moment()[_0x515a('0x44')](_0x515a('0x71'));_0x37060[_0x515a('0x88')]=_0x56269a['connectedlinenum'];_0x37060['connectedlinename']=_0x56269a[_0x515a('0x89')];logger[_0x515a('0x64')](_0x515a('0x8a'),_0x37060[_0x515a('0x46')],_0x37060[_0x515a('0x4d')],_0x56269a[_0x515a('0x88')],_0x56269a[_0x515a('0x89')]);this['channels'][_0x56269a[_0x515a('0x43')]]=_0x37060;this[_0x515a('0x7a')](_0x37060,_0x515a('0x8b'));}}}catch(_0x5f332f){logger[_0x515a('0x37')](_0x515a('0x87'),_0x56269a[_0x515a('0x43')],util[_0x515a('0x3b')](_0x5f332f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x515a('0xb')]['syncAgentConnect']=function(_0x17705b){try{if(this[_0x515a('0x5c')](_0x17705b)){logger[_0x515a('0x42')](_0x515a('0x8c'),_0x17705b[_0x515a('0x43')],util[_0x515a('0x3b')](_0x17705b,{'showHidden':![],'depth':null}));if(this[_0x515a('0x39')][_0x17705b[_0x515a('0x43')]]){var _0x12d4a7=_[_0x515a('0x7d')](this[_0x515a('0x39')][_0x17705b[_0x515a('0x43')]]);_0x12d4a7[_0x515a('0x7e')]=!![];_0x12d4a7[_0x515a('0x83')]=_0x515a('0x8d');logger['info'](_0x515a('0x8e'),_0x12d4a7['name'],_0x12d4a7[_0x515a('0x4d')]);}}}catch(_0x3f6c02){logger[_0x515a('0x37')](_0x515a('0x8c'),_0x17705b[_0x515a('0x43')],util['inspect'](_0x3f6c02,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x515a('0xb')][_0x515a('0x1b')]=function(_0x1a4433){try{if(this[_0x515a('0x5c')](_0x1a4433)){logger[_0x515a('0x42')]('[%s][voiceQueueReport][agentcomplete]',_0x1a4433[_0x515a('0x43')],util[_0x515a('0x3b')](_0x1a4433,{'showHidden':![],'depth':null}));if(this[_0x515a('0x39')][_0x1a4433[_0x515a('0x43')]]){var _0x3e56bf=_[_0x515a('0x7d')](this[_0x515a('0x39')][_0x1a4433[_0x515a('0x43')]]);_0x3e56bf[_0x515a('0x81')]=![];_0x3e56bf[_0x515a('0x82')]=null;_0x3e56bf['assigned']=!![];_0x3e56bf[_0x515a('0x85')]=_0x1a4433['membername'];_0x3e56bf[_0x515a('0x8f')]=_0x1a4433[_0x515a('0x8f')];_0x3e56bf[_0x515a('0x7e')]=!![];_0x3e56bf[_0x515a('0x90')]=![];_0x3e56bf['queuecallerexitAt']=null;if(!_0x3e56bf[_0x515a('0x91')]){if(_0x1a4433[_0x515a('0x92')]==_0x515a('0x91')){_0x3e56bf[_0x515a('0x83')]='COMPLETED';logger[_0x515a('0x64')](_0x515a('0x93'),_0x3e56bf[_0x515a('0x46')],_0x3e56bf[_0x515a('0x4d')]);}else{if(_[_0x515a('0x94')](_0x1a4433['channel']['toLowerCase'](),'local/')){if(this['queueReports'][_0x1a4433[_0x515a('0x95')]]){var _0x3b41be=_[_0x515a('0x7d')](this[_0x515a('0x39')][_0x1a4433[_0x515a('0x95')]]);_0x3b41be[_0x515a('0x7e')]=![];_0x3b41be[_0x515a('0x90')]=!![];_0x3b41be['queuecallerexitAt']=moment(_0x3e56bf[_0x515a('0x70')])[_0x515a('0x96')](_0x1a4433['holdtime'],_0x515a('0x97'))[_0x515a('0x44')](_0x515a('0x71'));_0x3b41be['queuecallerexitreason']=_0x515a('0x98');_0x3b41be[_0x515a('0x91')]=!![];_0x3b41be[_0x515a('0x99')]=_0x515a('0x9a');_0x3b41be[_0x515a('0x9b')]=_0x1a4433[_0x515a('0x9c')];_0x3b41be[_0x515a('0x9d')]=_0x1a4433[_0x515a('0x43')];logger[_0x515a('0x64')](_0x515a('0x9e'),_0x3b41be[_0x515a('0x46')],_0x3b41be[_0x515a('0x4d')]);var _0x2a7b8b=this['queueReports'][_0x1a4433[_0x515a('0x95')]];this[_0x515a('0x39')][_0x1a4433[_0x515a('0x95')]]=this[_0x515a('0x39')][_0x1a4433[_0x515a('0x43')]];this[_0x515a('0x39')][_0x1a4433[_0x515a('0x43')]]=_0x2a7b8b;}}else{_0x3e56bf[_0x515a('0x83')]=_0x515a('0x9f')+_0x1a4433['reason']['toUpperCase']();logger['info'](_0x515a('0xa0'),_0x3e56bf[_0x515a('0x46')],_0x3e56bf[_0x515a('0x4d')],_0x3e56bf['queuecallerexitreason']);}}}this[_0x515a('0x2f')][_0x1a4433[_0x515a('0x43')]]=_0x3e56bf;this[_0x515a('0x49')](_0x3e56bf,_0x515a('0x1a'));}}}catch(_0x3384c2){logger[_0x515a('0x37')]('[%s][voiceQueueReport][agentcomplete]',_0x1a4433[_0x515a('0x43')],util[_0x515a('0x3b')](_0x3384c2,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x3df971){try{if(this[_0x515a('0x5c')](_0x3df971)){logger[_0x515a('0x42')](_0x515a('0xa1'),_0x3df971['uniqueid'],util[_0x515a('0x3b')](_0x3df971,{'showHidden':![],'depth':null}));this['addVariable'](_0x3df971[_0x515a('0x43')],_[_0x515a('0x78')](_0x3df971['variable'])[0x0],_0x3df971['value']);if(this[_0x515a('0x39')][_0x3df971[_0x515a('0x43')]]){var _0x29c426=_[_0x515a('0x7d')](this[_0x515a('0x39')][_0x3df971[_0x515a('0x43')]]);if(_0x29c426){if(this['isNotNull'](_0x3df971[_0x515a('0xa2')])&&this[_0x515a('0x5c')](_0x3df971['variable'][_0x515a('0xa3')])){switch(_0x3df971['value']){case'CONTINUE':_0x29c426[_0x515a('0x90')]=![];_0x29c426[_0x515a('0xa4')]=null;break;case _0x515a('0xa5'):_0x29c426[_0x515a('0xa6')]=_0x515a('0xa7');_0x29c426[_0x515a('0x90')]=!![];_0x29c426[_0x515a('0xa4')]=moment()[_0x515a('0x44')](_0x515a('0x71'));_0x29c426['queuecallerleaveAt']=moment()[_0x515a('0x44')](_0x515a('0x71'));logger['debug'](_0x515a('0xa8'),_0x3df971[_0x515a('0x43')],util[_0x515a('0x3b')](_0x29c426,{'showHidden':![],'depth':null}));ami[_0x515a('0x41')](_0x515a('0xa9'),_0x29c426);break;default:_0x29c426['queuecallerexit']=!![];_0x29c426['queuecallerexitAt']=moment()[_0x515a('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x29c426[_0x515a('0xaa')]=moment()[_0x515a('0x44')](_0x515a('0x71'));}_0x29c426[_0x515a('0x81')]=![];_0x29c426[_0x515a('0x82')]=null;_0x29c426[_0x515a('0x83')]=_0x3df971[_0x515a('0xab')];this['channels'][_0x3df971['uniqueid']]=_0x29c426;this[_0x515a('0x49')](_0x29c426,_0x515a('0x1e'));}else if(this[_0x515a('0x5c')](_0x3df971[_0x515a('0xa2')])&&this['isNotNull'](_0x3df971[_0x515a('0xa2')][_0x515a('0xac')])){if(!_0x29c426['queuecallerabandon']){_0x29c426['queuecallerexit']=!![];_0x29c426['queuecallerexitAt']=moment()[_0x515a('0x44')](_0x515a('0x71'));_0x29c426['queuecallerexitreason']=_0x515a('0xad');_0x29c426[_0x515a('0xaa')]=moment()['format'](_0x515a('0x71'));this['channels'][_0x3df971[_0x515a('0x43')]]=_0x29c426;}}logger[_0x515a('0x64')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x3df971[_0x515a('0x43')],_0x29c426[_0x515a('0x46')],_0x29c426[_0x515a('0x4d')],_[_0x515a('0x78')](_0x3df971[_0x515a('0xa2')])[0x0],_0x3df971[_0x515a('0xab')]);_0x29c426[_0x515a('0x3c')]=this['variables'][_0x3df971[_0x515a('0x43')]];}}}}catch(_0x1a17f9){logger[_0x515a('0x37')](_0x515a('0xa1'),_0x3df971[_0x515a('0x43')],util[_0x515a('0x3b')](_0x1a17f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x515a('0xb')][_0x515a('0xae')]=function(_0x921c60,_0x2d6f3a,_0x27ff2f){var _0x6560a2=[_0x515a('0xaf'),'rtpaudioqosbridged',_0x515a('0xb0'),_0x515a('0xb1'),_0x515a('0xb2'),_0x515a('0xb3'),'rtpaudioqosrtt',_0x515a('0xb4'),'sipcallid',_0x515a('0xb5'),_0x515a('0xb6'),'bridgepvtcallid',_0x515a('0xb7'),_0x515a('0xb8'),'memberinterface','memberlastcall',_0x515a('0xb9'),_0x515a('0xba'),'memberrealtime'];if(!_[_0x515a('0x31')](_0x2d6f3a)&&!_[_0x515a('0xbb')](_0x6560a2,_0x2d6f3a)){if(_[_0x515a('0x5d')](this[_0x515a('0x3c')][_0x921c60])){this[_0x515a('0x3c')][_0x921c60]={};}this[_0x515a('0x3c')][_0x921c60][_0x2d6f3a]=_0x27ff2f;}};VoiceQueueReport['prototype'][_0x515a('0xbc')]=function(_0x18ad05){try{if(this[_0x515a('0x5c')](_0x18ad05)){logger[_0x515a('0x42')](_0x515a('0xbd'),_0x18ad05[_0x515a('0x43')],util[_0x515a('0x3b')](_0x18ad05,{'showHidden':![],'depth':null}));if(this[_0x515a('0x39')][_0x18ad05[_0x515a('0x43')]]){for(var _0xeb12d=0x0,_0x487e34={};_0xeb12d0x0?_0x597859:0x0;this[_0xca61('0x14')][_0x25bee7['queue']][_0xca61('0x31')]=this['voiceQueues'][_0x25bee7[_0xca61('0x68')]]['talking']>_[_0xca61('0x6c')](_0x25bee7[_0xca61('0x6d')])?_[_0xca61('0x6c')](_0x25bee7['loggedin']):this[_0xca61('0x14')][_0x25bee7[_0xca61('0x68')]][_0xca61('0x31')];this[_0xca61('0x4d')](this[_0xca61('0x14')][_0x25bee7[_0xca61('0x68')]],_0xca61('0x65'));}logger['debug'](_0xca61('0x6e'),util[_0xca61('0x3c')](this['voiceQueues'][_0x25bee7[_0xca61('0x68')]],{'showHidden':![],'depth':null}));ami[_0xca61('0x43')]('custom:queuesummary',this[_0xca61('0x14')][_0x25bee7[_0xca61('0x68')]]);}}}catch(_0x2f9991){logger[_0xca61('0x3b')](_0xca61('0x66'),util[_0xca61('0x3c')](_0x2f9991,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xca61('0xc')][_0xca61('0x19')]=function(_0x2caaaa){logger[_0xca61('0x69')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xca61('0x3c')](_0x2caaaa,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0xca61('0xc')][_0xca61('0x6f')]=function(_0xea6188){try{if(this['isNotNull'](_0xea6188)){logger[_0xca61('0x69')](_0xca61('0x70'),_0xea6188[_0xca61('0x46')],util[_0xca61('0x3c')](_0xea6188,{'showHidden':![],'depth':null}));if(_[_0xca61('0x71')](this[_0xca61('0x10')][_0xea6188[_0xca61('0x46')]]))this[_0xca61('0x10')][_0xea6188[_0xca61('0x46')]]=[];if(_[_0xca61('0x71')](this['channels'][_0xea6188['uniqueid']]))this[_0xca61('0x12')][_0xea6188[_0xca61('0x46')]]={};var _0x105ff0=new QueueReport();_0x105ff0['name']=_0xea6188[_0xca61('0x68')];_0x105ff0[_0xca61('0x4e')]=this[_0xca61('0x14')][_0x105ff0[_0xca61('0x49')]]&&this[_0xca61('0x14')][_0x105ff0[_0xca61('0x49')]][_0xca61('0x4e')]?this[_0xca61('0x14')][_0x105ff0['name']]['type']||_0xca61('0x72'):_0xca61('0x72');_0x105ff0[_0xca61('0x68')]=_0xea6188[_0xca61('0x68')];_0x105ff0[_0xca61('0x73')]=moment()[_0xca61('0x47')](_0xca61('0x74'));_0x105ff0[_0xca61('0x75')]=_0xea6188[_0xca61('0x75')];_0x105ff0[_0xca61('0x76')]=_0xea6188['count'];_0x105ff0[_0xca61('0x46')]=_0xea6188['uniqueid'];_0x105ff0['routealias']=this[_0xca61('0x12')][_0xea6188[_0xca61('0x46')]][_0xca61('0x77')];logger[_0xca61('0x6a')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x105ff0[_0xca61('0x49')],_0x105ff0['type']);_[_0xca61('0x78')](_0x105ff0,_[_0xca61('0x79')](_0xea6188,_['keys'](_0x105ff0)));this[_0xca61('0x10')][_0xea6188[_0xca61('0x46')]][_0xca61('0x7a')](_0x105ff0);this[_0xca61('0x12')][_0xea6188['uniqueid']]=_0x105ff0;this[_0xca61('0x44')](_0x105ff0,'queuecallerjoin');}}catch(_0x30446a){logger[_0xca61('0x3b')]('[%s][voiceQueueReport][queuecallerjoin]',_0xea6188[_0xca61('0x46')],util[_0xca61('0x3c')](_0x30446a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xca61('0xc')][_0xca61('0x1c')]=function(_0xffa920){try{if(this[_0xca61('0x61')](_0xffa920)){logger[_0xca61('0x69')](_0xca61('0x7b'),_0xffa920[_0xca61('0x46')],util['inspect'](_0xffa920,{'showHidden':![],'depth':null}));if(this[_0xca61('0x10')][_0xffa920['uniqueid']]){var _0x467497=_[_0xca61('0x7c')](this['queueReports'][_0xffa920[_0xca61('0x46')]]);_0x467497[_0xca61('0x7d')]=![];_0x467497['queuecallercompleteAt']=null;_0x467497[_0xca61('0x7e')]=_0xffa920[_0xca61('0x7e')];_0x467497[_0xca61('0x7f')]=_0xffa920['originalposition'];_0x467497[_0xca61('0x1b')]=!![];_0x467497[_0xca61('0x80')]=moment()[_0xca61('0x47')](_0xca61('0x74'));_0x467497[_0xca61('0x81')]='ABANDONED';_0x467497[_0xca61('0x82')]=null;logger[_0xca61('0x6a')](_0xca61('0x83'),_0x467497[_0xca61('0x49')],_0x467497[_0xca61('0x4e')]);this['channels'][_0xffa920[_0xca61('0x46')]]=_0x467497;this[_0xca61('0x41')](_0x467497,_0xca61('0x1b'));}}}catch(_0x94125a){logger[_0xca61('0x3b')]('[%s][voiceQueueReport][queuecallerabandon]',_0xffa920[_0xca61('0x46')],util[_0xca61('0x3c')](_0x94125a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xca61('0xc')][_0xca61('0x1e')]=function(_0x53ca04){try{if(this[_0xca61('0x61')](_0x53ca04)){logger[_0xca61('0x69')](_0xca61('0x84'),_0x53ca04[_0xca61('0x46')],util[_0xca61('0x3c')](_0x53ca04,{'showHidden':![],'depth':null}));if(this[_0xca61('0x10')][_0x53ca04[_0xca61('0x46')]]){var _0x479853=_[_0xca61('0x7c')](this[_0xca61('0x10')][_0x53ca04['uniqueid']]);_0x479853[_0xca61('0x85')]=moment()[_0xca61('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x479853[_0xca61('0x86')]=_0x53ca04['connectedlinenum'];_0x479853[_0xca61('0x87')]=_0x53ca04[_0xca61('0x87')];logger[_0xca61('0x6a')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x479853['name'],_0x479853[_0xca61('0x4e')],_0x53ca04[_0xca61('0x86')],_0x53ca04[_0xca61('0x87')]);this[_0xca61('0x12')][_0x53ca04['uniqueid']]=_0x479853;this['emitVoiceQueueChannelSave'](_0x479853,_0xca61('0x1d'));}}}catch(_0x102904){logger[_0xca61('0x3b')]('[%s][voiceQueueReport][queuecallerleave]',_0x53ca04[_0xca61('0x46')],util[_0xca61('0x3c')](_0x102904,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xca61('0x21')]=function(_0x47cd40){try{if(this[_0xca61('0x61')](_0x47cd40)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x47cd40[_0xca61('0x46')],util[_0xca61('0x3c')](_0x47cd40,{'showHidden':![],'depth':null}));if(this[_0xca61('0x10')][_0x47cd40['uniqueid']]){var _0x38bc67=_[_0xca61('0x7c')](this[_0xca61('0x10')][_0x47cd40['uniqueid']]);_0x38bc67[_0xca61('0x7d')]=!![];_0x38bc67[_0xca61('0x81')]=_0xca61('0x88');logger[_0xca61('0x6a')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x38bc67[_0xca61('0x49')],_0x38bc67[_0xca61('0x4e')]);}}}catch(_0x5c9b72){logger[_0xca61('0x3b')](_0xca61('0x89'),_0x47cd40[_0xca61('0x46')],util[_0xca61('0x3c')](_0x5c9b72,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xca61('0xc')]['syncAgentComplete']=function(_0x140d33){try{if(this[_0xca61('0x61')](_0x140d33)){logger[_0xca61('0x69')](_0xca61('0x8a'),_0x140d33[_0xca61('0x46')],util[_0xca61('0x3c')](_0x140d33,{'showHidden':![],'depth':null}));if(this[_0xca61('0x10')][_0x140d33[_0xca61('0x46')]]){var _0x22dcb7=_[_0xca61('0x7c')](this[_0xca61('0x10')][_0x140d33['uniqueid']]);_0x22dcb7[_0xca61('0x1b')]=![];_0x22dcb7[_0xca61('0x80')]=null;_0x22dcb7[_0xca61('0x8b')]=!![];_0x22dcb7[_0xca61('0x82')]=_0x140d33[_0xca61('0x8c')];_0x22dcb7[_0xca61('0x7e')]=_0x140d33[_0xca61('0x7e')];_0x22dcb7['queuecallercomplete']=!![];_0x22dcb7['queuecallerexit']=![];_0x22dcb7[_0xca61('0x8d')]=null;if(!_0x22dcb7[_0xca61('0x8e')]){if(_0x140d33[_0xca61('0x8f')]=='transfer'){_0x22dcb7['queuecallerexitreason']=_0xca61('0x90');logger[_0xca61('0x6a')](_0xca61('0x91'),_0x22dcb7[_0xca61('0x49')],_0x22dcb7[_0xca61('0x4e')]);}else{if(_[_0xca61('0x92')](_0x140d33[_0xca61('0x93')][_0xca61('0x94')](),_0xca61('0x95'))){if(this[_0xca61('0x10')][_0x140d33['linkedid']]){var _0x5acb85=_['last'](this[_0xca61('0x10')][_0x140d33[_0xca61('0x96')]]);_0x5acb85['queuecallercomplete']=![];_0x5acb85[_0xca61('0x97')]=!![];_0x5acb85['queuecallerexitAt']=moment(_0x22dcb7['queuecallerjoinAt'])[_0xca61('0x98')](_0x140d33[_0xca61('0x7e')],_0xca61('0x99'))[_0xca61('0x47')](_0xca61('0x74'));_0x5acb85[_0xca61('0x81')]=_0xca61('0x9a');_0x5acb85[_0xca61('0x8e')]=!![];_0x5acb85['transfertype']=_0xca61('0x9b');_0x5acb85[_0xca61('0x9c')]=_0x140d33[_0xca61('0x9d')];_0x5acb85[_0xca61('0x9e')]=_0x140d33['uniqueid'];logger['info'](_0xca61('0x9f'),_0x5acb85[_0xca61('0x49')],_0x5acb85['type']);var _0x3877b4=this['queueReports'][_0x140d33[_0xca61('0x96')]];this[_0xca61('0x10')][_0x140d33[_0xca61('0x96')]]=this[_0xca61('0x10')][_0x140d33['uniqueid']];this['queueReports'][_0x140d33['uniqueid']]=_0x3877b4;}}else{_0x22dcb7['queuecallerexitreason']=_0xca61('0xa0')+_0x140d33[_0xca61('0x8f')][_0xca61('0xa1')]();logger[_0xca61('0x6a')](_0xca61('0xa2'),_0x22dcb7[_0xca61('0x49')],_0x22dcb7[_0xca61('0x4e')],_0x22dcb7[_0xca61('0x81')]);}}}this['channels'][_0x140d33[_0xca61('0x46')]]=_0x22dcb7;this['emitVoiceQueueChannelRemove'](_0x22dcb7,_0xca61('0x1f'));}}}catch(_0x27170a){logger[_0xca61('0x3b')](_0xca61('0x8a'),_0x140d33['uniqueid'],util[_0xca61('0x3c')](_0x27170a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xca61('0xc')][_0xca61('0x22')]=function(_0x252514){try{if(this[_0xca61('0x61')](_0x252514)){logger['debug']('[%s][voiceQueueReport][varset]',_0x252514[_0xca61('0x46')],util[_0xca61('0x3c')](_0x252514,{'showHidden':![],'depth':null}));this['addVariable'](_0x252514[_0xca61('0x46')],_['keys'](_0x252514[_0xca61('0xa3')])[0x0],_0x252514[_0xca61('0xa4')]);if(this[_0xca61('0x10')][_0x252514[_0xca61('0x46')]]){var _0x20f7f8=_[_0xca61('0x7c')](this[_0xca61('0x10')][_0x252514[_0xca61('0x46')]]);if(_0x20f7f8){if(this[_0xca61('0x61')](_0x252514[_0xca61('0xa3')])&&this[_0xca61('0x61')](_0x252514[_0xca61('0xa3')][_0xca61('0xa5')])){switch(_0x252514[_0xca61('0xa4')]){case _0xca61('0xa6'):_0x20f7f8[_0xca61('0x97')]=![];_0x20f7f8[_0xca61('0x8d')]=null;break;case _0xca61('0xa7'):_0x20f7f8[_0xca61('0xa8')]=_0xca61('0xa9');_0x20f7f8[_0xca61('0x97')]=!![];_0x20f7f8[_0xca61('0x8d')]=moment()[_0xca61('0x47')](_0xca61('0x74'));_0x20f7f8['queuecallerleaveAt']=moment()[_0xca61('0x47')](_0xca61('0x74'));logger[_0xca61('0x69')](_0xca61('0xaa'),_0x252514[_0xca61('0x46')],util[_0xca61('0x3c')](_0x20f7f8,{'showHidden':![],'depth':null}));ami['emit'](_0xca61('0xab'),_0x20f7f8);break;default:_0x20f7f8[_0xca61('0x97')]=!![];_0x20f7f8[_0xca61('0x8d')]=moment()[_0xca61('0x47')](_0xca61('0x74'));_0x20f7f8[_0xca61('0x85')]=moment()[_0xca61('0x47')]('YYYY-MM-DD\x20HH:mm:ss');}_0x20f7f8[_0xca61('0x1b')]=![];_0x20f7f8[_0xca61('0x80')]=null;_0x20f7f8[_0xca61('0x81')]=_0x252514[_0xca61('0xa4')];this['channels'][_0x252514[_0xca61('0x46')]]=_0x20f7f8;this[_0xca61('0x41')](_0x20f7f8,_0xca61('0xac'));}else if(this[_0xca61('0x61')](_0x252514['variable'])&&this[_0xca61('0x61')](_0x252514[_0xca61('0xa3')][_0xca61('0xad')])){if(!_0x20f7f8[_0xca61('0x1b')]){_0x20f7f8[_0xca61('0x97')]=!![];_0x20f7f8[_0xca61('0x8d')]=moment()[_0xca61('0x47')](_0xca61('0x74'));_0x20f7f8[_0xca61('0x81')]='EXITWITHKEY';_0x20f7f8[_0xca61('0x85')]=moment()[_0xca61('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xca61('0x12')][_0x252514[_0xca61('0x46')]]=_0x20f7f8;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x252514['uniqueid'],_0x20f7f8[_0xca61('0x49')],_0x20f7f8[_0xca61('0x4e')],_[_0xca61('0xae')](_0x252514[_0xca61('0xa3')])[0x0],_0x252514[_0xca61('0xa4')]);_0x20f7f8[_0xca61('0x16')]=this[_0xca61('0x16')][_0x252514[_0xca61('0x46')]];}}}}catch(_0x3228ce){logger['error'](_0xca61('0xaf'),_0x252514['uniqueid'],util['inspect'](_0x3228ce,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xca61('0xc')][_0xca61('0xb0')]=function(_0x3c2bdf,_0x42c287,_0x495bdf){var _0x56abdd=[_0xca61('0xb1'),_0xca61('0xb2'),'rtpaudioqosjitter',_0xca61('0xb3'),_0xca61('0xb4'),'rtpaudioqoslossbridged',_0xca61('0xb5'),_0xca61('0xb6'),_0xca61('0xb7'),'sipuri','bridgepeer',_0xca61('0xb8'),'membercalls',_0xca61('0xb9'),_0xca61('0xba'),_0xca61('0xbb'),_0xca61('0x8c'),_0xca61('0xbc'),_0xca61('0xbd')];if(!_[_0xca61('0x36')](_0x42c287)&&!_[_0xca61('0xbe')](_0x56abdd,_0x42c287)){if(_[_0xca61('0x71')](this[_0xca61('0x16')][_0x3c2bdf])){this[_0xca61('0x16')][_0x3c2bdf]={};}this[_0xca61('0x16')][_0x3c2bdf][_0x42c287]=_0x495bdf;}};VoiceQueueReport[_0xca61('0xc')][_0xca61('0x24')]=function(_0x5ebc37){try{if(this['isNotNull'](_0x5ebc37)){logger[_0xca61('0x69')](_0xca61('0xbf'),_0x5ebc37[_0xca61('0x46')],util[_0xca61('0x3c')](_0x5ebc37,{'showHidden':![],'depth':null}));if(this[_0xca61('0x10')][_0x5ebc37[_0xca61('0x46')]]){for(var _0x20d5a5=0x0,_0x15e7d4={};_0x20d5a5=0x0?moment(_0x428d14[_0x86a4('0x19')])[_0x86a4('0xa')](_0x428d14[_0x86a4('0x18')],_0x86a4('0xc')):null,'data1':_0x86a4('0x1a'),'data2':_0x428d14[_0x86a4('0x11')],'data3':_0x428d14['exten'],'data4':_0x428d14['dialstring']||null,'role':_0x86a4('0x10'),'internal':_0x428d14['accountcode']?_[_0x86a4('0x12')](_0x428d14[_0x86a4('0x11')]):undefined,'uniqueid':_0x428d14[_0x86a4('0x13')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x53ab=['format','SIP/%s','TALKING','queuecallerleaveAt','diff','inbound','exten','queue','agent','accountcode','toNumber','uniqueid','voice','starttime','endtime','seconds','outbound','dialstring','lodash','util','../client','voiceQueueReport','queuecallerexitAt','CreateMemberReport','lastAssignedTo','isNil','interface'];(function(_0x331122,_0xd3ea30){var _0x45d2c5=function(_0x512420){while(--_0x512420){_0x331122['push'](_0x331122['shift']());}};_0x45d2c5(++_0xd3ea30);}(_0x53ab,0x105));var _0xb53a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53ab[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var _=require(_0xb53a('0x0'));var util=require(_0xb53a('0x1'));var client=require(_0xb53a('0x2'));exports[_0xb53a('0x3')]=function(_0x5c927d){var _0x369984=_0x5c927d['queuecallercompleteAt']||_0x5c927d[_0xb53a('0x4')];return client['Request'](_0xb53a('0x5'),{'body':{'channel':'voice','membername':_0x5c927d[_0xb53a('0x6')],'interface':_[_0xb53a('0x7')](_0x5c927d[_0xb53a('0x8')])?util[_0xb53a('0x9')](_0xb53a('0xa'),_0x5c927d[_0xb53a('0x6')]):_0x5c927d['interface'],'type':_0xb53a('0xb'),'enterAt':_0x5c927d[_0xb53a('0xc')],'exitAt':_0x369984,'duration':moment(_0x369984)[_0xb53a('0xd')](_0x5c927d[_0xb53a('0xc')],'seconds'),'data1':_0xb53a('0xe'),'data2':_0x5c927d['calleridnum'],'data3':_0x5c927d[_0xb53a('0xf')],'data4':null,'data5':_0x5c927d[_0xb53a('0x10')],'role':_0xb53a('0x11'),'internal':_0x5c927d[_0xb53a('0x12')]?_[_0xb53a('0x13')](_0x5c927d[_0xb53a('0x12')]):undefined,'uniqueid':_0x5c927d[_0xb53a('0x14')]},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0x5dee14){return client['Request'](_0xb53a('0x5'),{'body':{'channel':_0xb53a('0x15'),'membername':_0x5dee14['membername'],'interface':_0x5dee14[_0xb53a('0x8')],'type':'TALKING','enterAt':_0x5dee14[_0xb53a('0x16')],'exitAt':_0x5dee14[_0xb53a('0x17')],'duration':moment(_0x5dee14[_0xb53a('0x17')])['diff'](_0x5dee14[_0xb53a('0x16')],_0xb53a('0x18'))>=0x0?moment(_0x5dee14['endtime'])[_0xb53a('0xd')](_0x5dee14[_0xb53a('0x16')],'seconds'):null,'data1':_0xb53a('0x19'),'data2':_0x5dee14[_0xb53a('0x12')],'data3':_0x5dee14[_0xb53a('0xf')],'data4':_0x5dee14[_0xb53a('0x1a')]||null,'role':_0xb53a('0x11'),'internal':_0x5dee14[_0xb53a('0x12')]?_[_0xb53a('0x13')](_0x5dee14[_0xb53a('0x12')]):undefined,'uniqueid':_0x5dee14[_0xb53a('0x14')]},'log':_0xb53a('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 4b3cc32..5f3d316 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 _0x95c3=['GetSettings','Request','ShowSetting'];(function(_0x48631a,_0x1779fe){var _0x163a9f=function(_0x4db70f){while(--_0x4db70f){_0x48631a['push'](_0x48631a['shift']());}};_0x163a9f(++_0x1779fe);}(_0x95c3,0x6d));var _0x395c=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x95c3[_0x543084];return _0x306a57;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x395c('0x0')](_0x395c('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer','previewRecallmeReminderInterval']},'log':_0x395c('0x2')});}; \ No newline at end of file +var _0x13cf=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request'];(function(_0xc838b8,_0x2f4309){var _0x18c0be=function(_0x2d81cd){while(--_0x2d81cd){_0xc838b8['push'](_0xc838b8['shift']());}};_0x18c0be(++_0x2f4309);}(_0x13cf,0x11d));var _0xf13c=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x13cf[_0x4bfac3];return _0x15f0f2;};'use strict';var client=require(_0xf13c('0x0'));exports[_0xf13c('0x1')]=function(){return client[_0xf13c('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf13c('0x3'),_0xf13c('0x4')]},'log':_0xf13c('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index d663c95..44e6338 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 _0x7de9=['Request','GetTemplate','name','getTemplates'];(function(_0x1ffc4b,_0xbc7981){var _0x86de7e=function(_0x20ed17){while(--_0x20ed17){_0x1ffc4b['push'](_0x1ffc4b['shift']());}};_0x86de7e(++_0xbc7981);}(_0x7de9,0xdb));var _0x97de=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x7de9[_0x255d5b];return _0x3e141a;};'use strict';var client=require('../client');exports[_0x97de('0x0')]=function(_0x5a8080){return function(_0x1daa15){return client[_0x97de('0x1')](_0x97de('0x2'),{'options':{'raw':!![],'attributes':['id',_0x97de('0x3'),'html']},'log':_0x97de('0x2')});};}; \ No newline at end of file +var _0x728e=['getTemplates','Request','html','GetTemplate','../client'];(function(_0x436fd5,_0x15b4a9){var _0x4bad21=function(_0x3da866){while(--_0x3da866){_0x436fd5['push'](_0x436fd5['shift']());}};_0x4bad21(++_0x15b4a9);}(_0x728e,0x153));var _0xe728=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x728e[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xe728('0x0'));exports[_0xe728('0x1')]=function(_0x3ebcc6){return function(_0x22f903){return client[_0xe728('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0xe728('0x3')]},'log':_0xe728('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 028dd9e..36dc2b6 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 _0x735d=['channel','status','AllConditions','value','Condition','AnyConditions','field','operator','Action','action','data1','data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name'];(function(_0x1935e2,_0x385d77){var _0x49dc16=function(_0x17da61){while(--_0x17da61){_0x1935e2['push'](_0x1935e2['shift']());}};_0x49dc16(++_0x385d77);}(_0x735d,0x175));var _0xd735=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0x735d[_0x15cdcb];return _0x37b069;};'use strict';var client=require(_0xd735('0x0'));exports[_0xd735('0x1')]=function(_0x50a0f7){return function(_0x5a6c82){return client[_0xd735('0x2')](_0xd735('0x3'),{'options':{'raw':![],'attributes':['id',_0xd735('0x4'),_0xd735('0x5'),_0xd735('0x6')],'include':[{'model':'Condition','as':_0xd735('0x7'),'attributes':['id','field','operator',_0xd735('0x8')]},{'model':_0xd735('0x9'),'as':_0xd735('0xa'),'attributes':['id',_0xd735('0xb'),_0xd735('0xc'),'value']},{'model':_0xd735('0xd'),'as':'Actions','attributes':['id',_0xd735('0xe'),_0xd735('0xf'),'data2',_0xd735('0x10'),_0xd735('0x11'),_0xd735('0x12'),_0xd735('0x13'),_0xd735('0x14')]}]},'log':_0xd735('0x3')});};}; \ No newline at end of file +var _0x7de4=['GetTrigger','getTriggers','Request','name','Condition','AllConditions','field','value','AnyConditions','operator','data3','data4','data5','data6','data7'];(function(_0x2d9535,_0x4bc592){var _0xb4e710=function(_0x50b9a9){while(--_0x50b9a9){_0x2d9535['push'](_0x2d9535['shift']());}};_0xb4e710(++_0x4bc592);}(_0x7de4,0x178));var _0x47de=function(_0x1d4288,_0x4da6aa){_0x1d4288=_0x1d4288-0x0;var _0x4e5cae=_0x7de4[_0x1d4288];return _0x4e5cae;};'use strict';var client=require('../client');exports[_0x47de('0x0')]=function(_0x8e8ffc){return function(_0x1353ec){return client[_0x47de('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x47de('0x2'),'channel','status'],'include':[{'model':_0x47de('0x3'),'as':_0x47de('0x4'),'attributes':['id',_0x47de('0x5'),'operator',_0x47de('0x6')]},{'model':_0x47de('0x3'),'as':_0x47de('0x7'),'attributes':['id','field',_0x47de('0x8'),_0x47de('0x6')]},{'model':'Action','as':'Actions','attributes':['id','action','data1','data2',_0x47de('0x9'),_0x47de('0xa'),_0x47de('0xb'),_0x47de('0xc'),_0x47de('0xd')]}]},'log':_0x47de('0xe')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 3b0aa1d..dd8aeac 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 _0x2a31=['GetTrunk','name','registry','defaultuser','../client','getTrunks','Request'];(function(_0x20d2c1,_0x5ce7b3){var _0x57948a=function(_0x10cd89){while(--_0x10cd89){_0x20d2c1['push'](_0x20d2c1['shift']());}};_0x57948a(++_0x5ce7b3);}(_0x2a31,0xe4));var _0x12a3=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x2a31[_0x5608a3];return _0x1ed50a;};'use strict';var client=require(_0x12a3('0x0'));exports[_0x12a3('0x1')]=function(_0x1b53aa){return function(_0x104512){return client[_0x12a3('0x2')](_0x12a3('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x12a3('0x4'),_0x12a3('0x5'),_0x12a3('0x6')]},'log':_0x12a3('0x3')});};}; \ No newline at end of file +var _0xa85d=['getTrunks','Request','defaultuser','GetTrunk','../client'];(function(_0x596c43,_0x28647a){var _0x4e1315=function(_0x58e910){while(--_0x58e910){_0x596c43['push'](_0x596c43['shift']());}};_0x4e1315(++_0x28647a);}(_0xa85d,0x68));var _0xda85=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xa85d[_0x13ce0c];return _0x4388fb;};'use strict';var client=require(_0xda85('0x0'));exports[_0xda85('0x1')]=function(_0x3ac5c5){return function(_0x4c9d0a){return client[_0xda85('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0xda85('0x3')]},'log':_0xda85('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index cc00758..acc1e0d 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x385595,_0x55411a){var _0x33a04a=function(_0xb6e544){while(--_0xb6e544){_0x385595['push'](_0x385595['shift']());}};_0x33a04a(++_0x55411a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 2f7510f..0f162cf 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 _0x0a0e=['update','UpdateVoiceAgentReport','create','Request'];(function(_0x108afe,_0x73cc48){var _0x26037f=function(_0x4a2f66){while(--_0x4a2f66){_0x108afe['push'](_0x108afe['shift']());}};_0x26037f(++_0x73cc48);}(_0x0a0e,0xba));var _0xe0a0=function(_0x147b36,_0x2f20c1){_0x147b36=_0x147b36-0x0;var _0x3f5ac4=_0x0a0e[_0x147b36];return _0x3f5ac4;};'use strict';var client=require('../client');exports[_0xe0a0('0x0')]=function(_0x404cdb){return client[_0xe0a0('0x1')]('CreateVoiceAgentReport',{'body':_0x404cdb,'log':'CreateVoiceAgentReport'});};exports[_0xe0a0('0x2')]=function(_0x399cbf,_0x201c99,_0x44711b){return client[_0xe0a0('0x1')](_0xe0a0('0x3'),{'body':_0x399cbf,'options':{'where':{'uniqueid':_0x201c99,'interface':_0x44711b,'agentcomplete':!![]}},'log':_0xe0a0('0x3')});}; \ No newline at end of file +var _0x17cb=['update','UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport'];(function(_0x545cb9,_0xc07f0e){var _0x4b37e2=function(_0x487388){while(--_0x487388){_0x545cb9['push'](_0x545cb9['shift']());}};_0x4b37e2(++_0xc07f0e);}(_0x17cb,0x14c));var _0xb17c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x17cb[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xb17c('0x0'));exports['create']=function(_0xce741d){return client[_0xb17c('0x1')](_0xb17c('0x2'),{'body':_0xce741d,'log':_0xb17c('0x2')});};exports[_0xb17c('0x3')]=function(_0x4f3d6b,_0x477769,_0x553253){return client['Request'](_0xb17c('0x4'),{'body':_0x4f3d6b,'options':{'where':{'uniqueid':_0x477769,'interface':_0x553253,'agentcomplete':!![]}},'log':_0xb17c('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 6cd71f6..3c8d127 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 _0xb74f=['getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','create','Request','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport'];(function(_0x34aa0f,_0x1013c5){var _0x554266=function(_0x58f58f){while(--_0x58f58f){_0x34aa0f['push'](_0x34aa0f['shift']());}};_0x554266(++_0x1013c5);}(_0xb74f,0x1a5));var _0xfb74=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb74f[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var util=require(_0xfb74('0x0'));var _=require(_0xfb74('0x1'));var client=require(_0xfb74('0x2'));exports[_0xfb74('0x3')]=function(_0x5ad3bc){return client[_0xfb74('0x4')]('CreateVoiceCallReport',{'body':_[_0xfb74('0x5')](_0x5ad3bc,{'source':_0x5ad3bc[_0xfb74('0x6')],'destinationcontext':_0x5ad3bc[_0xfb74('0x7')],'callerid':_0x5ad3bc[_0xfb74('0x8')],'amaflags':_0xfb74('0x9')}),'log':_0xfb74('0xa')});};exports[_0xfb74('0xb')]=function(){return function(){return client[_0xfb74('0x4')](_0xfb74('0xc'),{'options':{'where':{'type':[_0xfb74('0xd')],'createdAt':{'$between':[moment()[_0xfb74('0xe')](_0xfb74('0xf'))[_0xfb74('0x10')](_0xfb74('0x11')),moment()[_0xfb74('0x12')](_0xfb74('0xf'))[_0xfb74('0x10')](_0xfb74('0x11'))]}},'attributes':[_0xfb74('0x13'),_0xfb74('0x14'),_0xfb74('0x15'),_0xfb74('0x16')]},'log':_0xfb74('0x17')});};}; \ No newline at end of file +var _0x47c4=['startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','create','Request','CreateVoiceCallReport','context','DOCUMENTATION','GetVoiceCallReport','outbound'];(function(_0x1bd19f,_0x51cf4d){var _0x4d25c4=function(_0x270912){while(--_0x270912){_0x1bd19f['push'](_0x1bd19f['shift']());}};_0x4d25c4(++_0x51cf4d);}(_0x47c4,0xdb));var _0x447c=function(_0x4d672c,_0x15a6e0){_0x4d672c=_0x4d672c-0x0;var _0x22dc61=_0x47c4[_0x4d672c];return _0x22dc61;};'use strict';var moment=require(_0x447c('0x0'));var util=require(_0x447c('0x1'));var _=require('lodash');var client=require('../client');exports[_0x447c('0x2')]=function(_0x3872ab){return client[_0x447c('0x3')](_0x447c('0x4'),{'body':_['merge'](_0x3872ab,{'source':_0x3872ab['calleridnum'],'destinationcontext':_0x3872ab[_0x447c('0x5')],'callerid':_0x3872ab['callerid'],'amaflags':_0x447c('0x6')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0x447c('0x3')](_0x447c('0x7'),{'options':{'where':{'type':[_0x447c('0x8')],'createdAt':{'$between':[moment()[_0x447c('0x9')]('day')[_0x447c('0xa')](_0x447c('0xb')),moment()[_0x447c('0xc')](_0x447c('0xd'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x447c('0xe'),_0x447c('0xf'),_0x447c('0x10'),_0x447c('0x11')]},'log':_0x447c('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 8ec4922..d93321a 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 _0xb1e0=['CreateVoiceDialReport','create'];(function(_0x436824,_0x48515d){var _0x5eea6b=function(_0x198543){while(--_0x198543){_0x436824['push'](_0x436824['shift']());}};_0x5eea6b(++_0x48515d);}(_0xb1e0,0x177));var _0x0b1e=function(_0x11e07b,_0x491e78){_0x11e07b=_0x11e07b-0x0;var _0x52473a=_0xb1e0[_0x11e07b];return _0x52473a;};'use strict';var client=require('../client');exports[_0x0b1e('0x0')]=function(_0x24a9b1){return client['Request'](_0x0b1e('0x1'),{'body':_0x24a9b1,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xb0a0=['Request','../client','create'];(function(_0x2b65ac,_0x268f43){var _0x5cc58f=function(_0x4126cd){while(--_0x4126cd){_0x2b65ac['push'](_0x2b65ac['shift']());}};_0x5cc58f(++_0x268f43);}(_0xb0a0,0x1e4));var _0x0b0a=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0xb0a0[_0x32b30c];return _0xcfc212;};'use strict';var client=require(_0x0b0a('0x0'));exports[_0x0b0a('0x1')]=function(_0x1cf8c1){return client[_0x0b0a('0x2')]('CreateVoiceDialReport',{'body':_0x1cf8c1,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index cc4cbd5..fa512cc 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 _0x4d46=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x15f6a9,_0x592255){var _0x5b1c0c=function(_0x4f7ce7){while(--_0x4f7ce7){_0x15f6a9['push'](_0x15f6a9['shift']());}};_0x5b1c0c(++_0x592255);}(_0x4d46,0x197));var _0x64d4=function(_0xddd4c8,_0x2db6ae){_0xddd4c8=_0xddd4c8-0x0;var _0x20e104=_0x4d46[_0xddd4c8];return _0x20e104;};'use strict';var client=require(_0x64d4('0x0'));exports[_0x64d4('0x1')]=function(){return function(){return client[_0x64d4('0x2')](_0x64d4('0x3'),{'options':{'raw':!![],'attributes':['id',_0x64d4('0x4'),_0x64d4('0x5')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x5eb1=['Request','GetVoiceExtension','exten','recordingFormat','getVoiceExtensions'];(function(_0x1f16e2,_0x3b851f){var _0x38c370=function(_0x50b884){while(--_0x50b884){_0x1f16e2['push'](_0x1f16e2['shift']());}};_0x38c370(++_0x3b851f);}(_0x5eb1,0x7c));var _0x15eb=function(_0x4ddc7a,_0x5b6cb8){_0x4ddc7a=_0x4ddc7a-0x0;var _0x4547c1=_0x5eb1[_0x4ddc7a];return _0x4547c1;};'use strict';var client=require('../client');exports[_0x15eb('0x0')]=function(){return function(){return client[_0x15eb('0x1')](_0x15eb('0x2'),{'options':{'raw':!![],'attributes':['id',_0x15eb('0x3'),_0x15eb('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x15eb('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index c02e092..ff9fdcd 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 _0x7385=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x7385,0x188));var _0x5738=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7385[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x5738('0x0'));exports[_0x5738('0x1')]=function(){return function(){return client['Request'](_0x5738('0x2'),{'options':{'raw':![],'attributes':['id',_0x5738('0x3'),_0x5738('0x4'),_0x5738('0x5'),_0x5738('0x6'),_0x5738('0x7'),'type','dialActive','dialMethod',_0x5738('0x8'),_0x5738('0x9'),_0x5738('0xa'),_0x5738('0xb'),_0x5738('0xc'),_0x5738('0xd'),_0x5738('0xe'),_0x5738('0xf'),'dialOriginateTimeout',_0x5738('0x10'),_0x5738('0x11'),_0x5738('0x12'),_0x5738('0x13'),_0x5738('0x14'),_0x5738('0x15'),_0x5738('0x16'),_0x5738('0x17'),_0x5738('0x18'),_0x5738('0x19'),_0x5738('0x1a'),_0x5738('0x1b'),_0x5738('0x1c'),_0x5738('0x1d'),_0x5738('0x1e'),_0x5738('0x1f'),_0x5738('0x20'),_0x5738('0x21'),_0x5738('0x22'),_0x5738('0x23'),'dialAMDBetweenWordsSilence',_0x5738('0x24'),'dialAMDSilenceThreshold',_0x5738('0x25'),_0x5738('0x26'),_0x5738('0x27'),_0x5738('0x28'),'dialOrderByScheduledAt',_0x5738('0x29'),_0x5738('0x2a'),'dialQueueProject2',_0x5738('0x7'),_0x5738('0x2b'),_0x5738('0x2c'),_0x5738('0x2d'),_0x5738('0x2e'),_0x5738('0x2f'),_0x5738('0x30'),'dialDropRetryFrequency',_0x5738('0x31'),_0x5738('0x32'),'dialMachineMaxRetry',_0x5738('0x33'),_0x5738('0x34'),_0x5738('0x35'),'mandatoryDisposition',_0x5738('0x36'),_0x5738('0x37'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0x5738('0x38'),'as':_0x5738('0x38'),'attributes':['id',_0x5738('0x3'),'callerid',_0x5738('0x39')]},{'model':_0x5738('0x3a'),'as':_0x5738('0x3b'),'attributes':['id','name']},{'model':_0x5738('0x38'),'as':'TrunkBackup','attributes':['id',_0x5738('0x3'),'callerid',_0x5738('0x39')]},{'model':_0x5738('0x3c'),'as':_0x5738('0x3c'),'attributes':['id',_0x5738('0x3')],'include':[{'model':_0x5738('0x3c'),'as':_0x5738('0x3d'),'attributes':['id','name',_0x5738('0x3e')]}]}]},'log':_0x5738('0x1')});};}; \ No newline at end of file +var _0x167b=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x5e1f45,_0x3bfbcc){var _0x13cb83=function(_0x3b2f5d){while(--_0x3b2f5d){_0x5e1f45['push'](_0x5e1f45['shift']());}};_0x13cb83(++_0x3bfbcc);}(_0x167b,0x1bb));var _0xb167=function(_0xfc3d39,_0x46cd30){_0xfc3d39=_0xfc3d39-0x0;var _0x5deb87=_0x167b[_0xfc3d39];return _0x5deb87;};'use strict';var client=require(_0xb167('0x0'));exports[_0xb167('0x1')]=function(){return function(){return client[_0xb167('0x2')](_0xb167('0x3'),{'options':{'raw':![],'attributes':['id',_0xb167('0x4'),'acw',_0xb167('0x5'),_0xb167('0x6'),_0xb167('0x7'),'type',_0xb167('0x8'),_0xb167('0x9'),_0xb167('0xa'),_0xb167('0xb'),'dialPowerLevel',_0xb167('0xc'),_0xb167('0xd'),_0xb167('0xe'),_0xb167('0xf'),'dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions',_0xb167('0x10'),_0xb167('0x11'),'dialCongestionMaxRetry',_0xb167('0x12'),_0xb167('0x13'),_0xb167('0x14'),_0xb167('0x15'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0xb167('0x16'),_0xb167('0x17'),'dialPrefix','dialCheckDuplicateType',_0xb167('0x18'),_0xb167('0x19'),_0xb167('0x1a'),'dialAMDAfterGreetingSilence',_0xb167('0x1b'),_0xb167('0x1c'),_0xb167('0x1d'),_0xb167('0x1e'),'dialAMDSilenceThreshold',_0xb167('0x1f'),_0xb167('0x20'),_0xb167('0x21'),_0xb167('0x22'),'dialOrderByScheduledAt',_0xb167('0x23'),'dialAgiAfterHangupClient',_0xb167('0x24'),_0xb167('0x7'),_0xb167('0x25'),_0xb167('0x26'),_0xb167('0x27'),_0xb167('0x28'),_0xb167('0x29'),_0xb167('0x2a'),'dialDropRetryFrequency',_0xb167('0x2b'),_0xb167('0x2c'),_0xb167('0x2d'),_0xb167('0x2e'),_0xb167('0x2f'),_0xb167('0x30'),_0xb167('0x31'),'dialPredictiveIntervalMaxThreshold',_0xb167('0x32'),_0xb167('0x33'),_0xb167('0x34')],'include':[{'model':_0xb167('0x35'),'as':_0xb167('0x35'),'attributes':['id',_0xb167('0x4'),_0xb167('0x36'),_0xb167('0x37')]},{'model':_0xb167('0x38'),'as':_0xb167('0x39'),'attributes':['id',_0xb167('0x4')]},{'model':_0xb167('0x35'),'as':'TrunkBackup','attributes':['id',_0xb167('0x4'),_0xb167('0x36'),'active']},{'model':_0xb167('0x3a'),'as':_0xb167('0x3a'),'attributes':['id',_0xb167('0x4')],'include':[{'model':'Interval','as':_0xb167('0x3b'),'attributes':['id','name',_0xb167('0x3c')]}]}]},'log':_0xb167('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 8f30d92..246b5ae 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(_0x14e836,_0x398aeb){var _0x28f092=function(_0x2bec2a){while(--_0x2bec2a){_0x14e836['push'](_0x14e836['shift']());}};_0x28f092(++_0x398aeb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x1e2349,_0x4da941){var _0x49bb8e=function(_0x2443f5){while(--_0x2443f5){_0x1e2349['push'](_0x1e2349['shift']());}};_0x49bb8e(++_0x4da941);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 5c54eae..bad2e71 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 _0x7bcb=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x3a5669,_0x254930){var _0x271625=function(_0xb06da6){while(--_0xb06da6){_0x3a5669['push'](_0x3a5669['shift']());}};_0x271625(++_0x254930);}(_0x7bcb,0x79));var _0xb7bc=function(_0x4fab3f,_0x5b0e8a){_0x4fab3f=_0x4fab3f-0x0;var _0x27364e=_0x7bcb[_0x4fab3f];return _0x27364e;};'use strict';var client=require(_0xb7bc('0x0'));exports[_0xb7bc('0x1')]=function(_0x5e874a){return function(){return client[_0xb7bc('0x2')](_0xb7bc('0x3'),{'options':{'where':{'VoiceQueueId':_0x5e874a,'paused':!![]},'raw':!![]},'log':_0xb7bc('0x1')});};}; \ No newline at end of file +var _0x05b6=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x05b6,0xb0));var _0x605b=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0x05b6[_0x9edfd5];return _0x330738;};'use strict';var client=require(_0x605b('0x0'));exports[_0x605b('0x1')]=function(_0x5e8d96){return function(){return client[_0x605b('0x2')](_0x605b('0x3'),{'options':{'where':{'VoiceQueueId':_0x5e8d96,'paused':!![]},'raw':!![]},'log':_0x605b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index caf702f..bbbfd35 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0xd7489f,_0x54c6ff){var _0x9a0c4b=function(_0x1f2c70){while(--_0x1f2c70){_0xd7489f['push'](_0xd7489f['shift']());}};_0x9a0c4b(++_0x54c6ff);}(_0x7a54,0x106));var _0x47a5=function(_0x1cdbd7,_0x49dc0b){_0x1cdbd7=_0x1cdbd7-0x0;var _0x3437be=_0x7a54[_0x1cdbd7];return _0x3437be;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x25540b,_0xd5ea7a){var _0x516594=function(_0x238af3){while(--_0x238af3){_0x25540b['push'](_0x25540b['shift']());}};_0x516594(++_0xd5ea7a);}(_0x7a54,0x106));var _0x47a5=function(_0x632b94,_0x257e2f){_0x632b94=_0x632b94-0x0;var _0x17174d=_0x7a54[_0x632b94];return _0x17174d;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 8699bce..b32d254 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 _0xe562=['transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','isexternal','context','extension','blind','attendedTransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x4fcba1,_0x5ba0fa){var _0x1adead=function(_0x57d551){while(--_0x57d551){_0x4fcba1['push'](_0x4fcba1['shift']());}};_0x1adead(++_0x5ba0fa);}(_0xe562,0xc3));var _0x2e56=function(_0x5d25a5,_0x179f91){_0x5d25a5=_0x5d25a5-0x0;var _0x328298=_0xe562[_0x5d25a5];return _0x328298;};'use strict';var client=require('../client');exports[_0x2e56('0x0')]={};exports[_0x2e56('0x1')]=function(_0x2d9fe2){return client[_0x2e56('0x2')](_0x2e56('0x3'),{'body':{'result':_0x2d9fe2[_0x2e56('0x4')],'transfererchannel':_0x2d9fe2['transfererchannel'],'transferercalleridnum':_0x2d9fe2[_0x2e56('0x5')],'transferercalleridname':_0x2d9fe2[_0x2e56('0x6')],'transfererconnectedlinenum':_0x2d9fe2[_0x2e56('0x7')],'transfererconnectedlinename':_0x2d9fe2[_0x2e56('0x8')],'transfereraccountcode':_0x2d9fe2['transfereraccountcode'],'transferercontext':_0x2d9fe2['transferercontext'],'transfererexten':_0x2d9fe2['transfererexten'],'transfererlinkedid':_0x2d9fe2[_0x2e56('0x9')],'transfereechannel':_0x2d9fe2[_0x2e56('0xa')],'transfereecalleridnum':_0x2d9fe2[_0x2e56('0xb')],'transfereecalleridname':_0x2d9fe2['transfereecalleridname'],'transfereeconnectedlinenum':_0x2d9fe2[_0x2e56('0xc')],'transfereeconnectedlinename':_0x2d9fe2[_0x2e56('0xd')],'transfereeaccountcode':_0x2d9fe2['transfereeaccountcode'],'transfereecontext':_0x2d9fe2[_0x2e56('0xe')],'transfereeexten':_0x2d9fe2['transfereeexten'],'transfereelinkedid':_0x2d9fe2['transfereelinkedid'],'isexternal':_0x2d9fe2[_0x2e56('0xf')],'context':_0x2d9fe2[_0x2e56('0x10')],'extension':_0x2d9fe2[_0x2e56('0x11')],'type':_0x2e56('0x12')},'log':_0x2e56('0x3')});};exports[_0x2e56('0x13')]=function(_0x312b0b){return client[_0x2e56('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x312b0b['result'],'transfererchannel':_0x312b0b['origtransfererchannel'],'transferercalleridnum':_0x312b0b[_0x2e56('0x14')],'transferercalleridname':_0x312b0b[_0x2e56('0x15')],'transfererconnectedlinenum':_0x312b0b[_0x2e56('0x16')],'transfererconnectedlinename':_0x312b0b[_0x2e56('0x17')],'transfereraccountcode':_0x312b0b[_0x2e56('0x18')],'transferercontext':_0x312b0b[_0x2e56('0x19')],'transfererexten':_0x312b0b[_0x2e56('0x1a')],'transfererlinkedid':_0x312b0b['origtransfererlinkedid'],'transfereechannel':_0x312b0b[_0x2e56('0x1b')],'transfereecalleridnum':_0x312b0b[_0x2e56('0x1c')],'transfereecalleridname':_0x312b0b['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x312b0b[_0x2e56('0x1d')],'transfereeconnectedlinename':_0x312b0b[_0x2e56('0x1e')],'transfereeaccountcode':_0x312b0b[_0x2e56('0x1f')],'transfereecontext':_0x312b0b[_0x2e56('0x20')],'transfereeexten':_0x312b0b[_0x2e56('0x21')],'transfereelinkedid':_0x312b0b[_0x2e56('0x22')],'isexternal':_0x312b0b[_0x2e56('0xf')],'context':_0x312b0b[_0x2e56('0x23')],'extension':_0x312b0b[_0x2e56('0x24')],'type':_0x2e56('0x25')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x1da5=['origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten'];(function(_0x78f30c,_0x1c1190){var _0x405bf8=function(_0x178d5a){while(--_0x178d5a){_0x78f30c['push'](_0x78f30c['shift']());}};_0x405bf8(++_0x1c1190);}(_0x1da5,0xd9));var _0x51da=function(_0x5b9b95,_0x2ffa51){_0x5b9b95=_0x5b9b95-0x0;var _0x584e72=_0x1da5[_0x5b9b95];return _0x584e72;};'use strict';var client=require(_0x51da('0x0'));exports[_0x51da('0x1')]={};exports[_0x51da('0x2')]=function(_0x18e659){return client[_0x51da('0x3')](_0x51da('0x4'),{'body':{'result':_0x18e659[_0x51da('0x5')],'transfererchannel':_0x18e659[_0x51da('0x6')],'transferercalleridnum':_0x18e659[_0x51da('0x7')],'transferercalleridname':_0x18e659[_0x51da('0x8')],'transfererconnectedlinenum':_0x18e659[_0x51da('0x9')],'transfererconnectedlinename':_0x18e659[_0x51da('0xa')],'transfereraccountcode':_0x18e659[_0x51da('0xb')],'transferercontext':_0x18e659[_0x51da('0xc')],'transfererexten':_0x18e659['transfererexten'],'transfererlinkedid':_0x18e659[_0x51da('0xd')],'transfereechannel':_0x18e659['transfereechannel'],'transfereecalleridnum':_0x18e659[_0x51da('0xe')],'transfereecalleridname':_0x18e659['transfereecalleridname'],'transfereeconnectedlinenum':_0x18e659[_0x51da('0xf')],'transfereeconnectedlinename':_0x18e659['transfereeconnectedlinename'],'transfereeaccountcode':_0x18e659[_0x51da('0x10')],'transfereecontext':_0x18e659[_0x51da('0x11')],'transfereeexten':_0x18e659[_0x51da('0x12')],'transfereelinkedid':_0x18e659[_0x51da('0x13')],'isexternal':_0x18e659[_0x51da('0x14')],'context':_0x18e659['context'],'extension':_0x18e659[_0x51da('0x15')],'type':_0x51da('0x16')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x3b0387){return client[_0x51da('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x3b0387[_0x51da('0x5')],'transfererchannel':_0x3b0387[_0x51da('0x17')],'transferercalleridnum':_0x3b0387['origtransferercalleridnum'],'transferercalleridname':_0x3b0387['origtransferercalleridname'],'transfererconnectedlinenum':_0x3b0387[_0x51da('0x18')],'transfererconnectedlinename':_0x3b0387[_0x51da('0x19')],'transfereraccountcode':_0x3b0387[_0x51da('0x1a')],'transferercontext':_0x3b0387[_0x51da('0x1b')],'transfererexten':_0x3b0387[_0x51da('0x1c')],'transfererlinkedid':_0x3b0387[_0x51da('0x1d')],'transfereechannel':_0x3b0387[_0x51da('0x1e')],'transfereecalleridnum':_0x3b0387[_0x51da('0x1f')],'transfereecalleridname':_0x3b0387[_0x51da('0x20')],'transfereeconnectedlinenum':_0x3b0387[_0x51da('0x21')],'transfereeconnectedlinename':_0x3b0387[_0x51da('0x22')],'transfereeaccountcode':_0x3b0387[_0x51da('0x23')],'transfereecontext':_0x3b0387[_0x51da('0x24')],'transfereeexten':_0x3b0387['transfertargetexten'],'transfereelinkedid':_0x3b0387[_0x51da('0x25')],'isexternal':_0x3b0387[_0x51da('0x14')],'context':_0x3b0387[_0x51da('0x26')],'extension':_0x3b0387[_0x51da('0x27')],'type':_0x51da('0x28')},'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 34da9e4..3c19b5d 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 _0x82c4=['message','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','channels','resolve','destinationchannel','StopMixMonitor','stop','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','telephones','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','catch','isConnected','Command','then','content','voiceQueues','hasOwnProperty','strategy','available','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','find','omit','values','voicechannel','map'];(function(_0x38a896,_0x539bd5){var _0x16d384=function(_0x554b6c){while(--_0x554b6c){_0x38a896['push'](_0x38a896['shift']());}};_0x16d384(++_0x539bd5);}(_0x82c4,0x1ca));var _0x482c=function(_0x58c9fd,_0x34100c){_0x58c9fd=_0x58c9fd-0x0;var _0x4284f9=_0x82c4[_0x58c9fd];return _0x4284f9;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var jayson=require(_0x482c('0x2'));var schema=require(_0x482c('0x3'));var BPromise=require(_0x482c('0x4'));var moment=require(_0x482c('0x5'));var config=require(_0x482c('0x6'));var properties=require('../properties');var ami=require(_0x482c('0x7'));exports['listen']=function(_0x4556c8,_0x47edb6,_0x477cf4){return new BPromise(function(_0x5d7c76,_0xfdb92){var _0x32a503={'QueuePause':function(_0x35cdab){return new Promise(function(_0x1c10f2,_0x3846d8){var _0x478bd2=util[_0x482c('0x8')](_0x482c('0x9'),_0x482c('0xa'),_0x35cdab[_0x482c('0xb')]);if(_0x4556c8[_0x482c('0xc')]&&_0x4556c8[_0x482c('0xc')][_0x478bd2]&&_0x4556c8['timers'][_0x478bd2][_0x482c('0xd')]){_0x4556c8[_0x482c('0xc')][_0x478bd2][_0x482c('0xe')]();}if(_0x4556c8['agents'][_0x478bd2]){_0x4556c8[_0x482c('0xf')][_0x478bd2][_0x482c('0x10')]({'statePause':_0x35cdab[_0x482c('0x11')]?!![]:![]});}_0x1c10f2({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x4bfb3a){var _0x7b12cf=this;return new Promise(function(_0x30e02b,_0x59837f){if(ami['isConnected']()==![]){return _0x59837f(_0x7b12cf[_0x482c('0x12')](0x1f4,[config[_0x482c('0x13')]['ip'],config[_0x482c('0x13')][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}_0x4bfb3a=_[_0x482c('0x17')](_0x4bfb3a,_[_0x482c('0x18')](properties[_0x482c('0x19')]));_0x4bfb3a[_0x482c('0x1a')]=_0x482c('0x1b');return ami[_0x482c('0x1c')](_0x4bfb3a)['then'](function(_0x244bb9){_0x30e02b({'code':0xc8,'message':_0x244bb9['message']});})[_0x482c('0x1d')](function(_0x258148){_0x59837f(_0x7b12cf['error'](0x1f5,_0x258148['message']));});});},'Command':function(_0x357965){var _0x584656=this;return new Promise(function(_0x16fe9a,_0x4784a2){if(ami[_0x482c('0x1e')]()==![]){return _0x4784a2(_0x584656[_0x482c('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x482c('0x13')][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}_0x357965=_[_0x482c('0x17')](_0x357965,'command');_0x357965['action']=_0x482c('0x1f');return ami[_0x482c('0x1c')](_0x357965)[_0x482c('0x20')](function(_0x5c4e9c){_0x16fe9a({'code':0xc8,'message':_0x5c4e9c[_0x482c('0x21')]});})['catch'](function(_0x2f3f96){_0x4784a2(_0x584656[_0x482c('0x12')](0x1f5,_0x2f3f96['message']));});});},'VoiceQueues':function(_0x466583){return new Promise(function(_0x5436e2,_0x589bc6){var _0x2165af=[];for(var _0x27f1b5 in _0x4556c8[_0x482c('0x22')]){if(_0x4556c8[_0x482c('0x22')][_0x482c('0x23')](_0x27f1b5)){var _0x215826=_0x4556c8[_0x482c('0x22')][_0x27f1b5];var _0x5ad788={'id':_0x215826['id'],'name':_0x215826[_0x482c('0xb')],'strategy':_0x215826[_0x482c('0x24')],'answered':_0x215826['answered'],'available':_0x215826[_0x482c('0x25')],'loggedIn':_0x215826['loggedIn'],'pTalking':_0x215826['pTalking'],'sumBillable':_0x215826[_0x482c('0x26')],'sumDuration':_0x215826['sumDuration'],'sumHoldTime':_0x215826[_0x482c('0x27')]||0x0,'talking':_0x215826[_0x482c('0x28')],'total':_0x215826[_0x482c('0x29')],'type':_0x215826[_0x482c('0x2a')],'unmanaged':_0x215826[_0x482c('0x2b')],'abandoned':_0x215826[_0x482c('0x2c')],'waiting':_0x215826[_0x482c('0x2d')],'loggedInDb':_0x215826[_0x482c('0x2e')]};if(_0x215826[_0x482c('0x2a')]===_0x482c('0x2f')){_0x5ad788[_0x482c('0x30')]=_0x215826[_0x482c('0x30')];_0x5ad788[_0x482c('0x31')]=_0x215826[_0x482c('0x31')];_0x5ad788[_0x482c('0x32')]=_0x215826[_0x482c('0x32')];_0x5ad788[_0x482c('0x33')]=_0x215826[_0x482c('0x33')];_0x5ad788['dialOriginateTimeout']=_0x215826['dialOriginateTimeout'];_0x5ad788['dialPrefix']=_0x215826[_0x482c('0x34')];_0x5ad788[_0x482c('0x35')]=_0x215826[_0x482c('0x35')];_0x5ad788[_0x482c('0x36')]=_0x215826['outboundAnswerAgiCallsDay'];_0x5ad788[_0x482c('0x37')]=_0x215826['outboundAnswerCallsDay'];_0x5ad788[_0x482c('0x38')]=_0x215826[_0x482c('0x38')];_0x5ad788[_0x482c('0x39')]=_0x215826[_0x482c('0x39')];_0x5ad788[_0x482c('0x3a')]=_0x215826[_0x482c('0x3a')];_0x5ad788[_0x482c('0x3b')]=_0x215826[_0x482c('0x3b')];_0x5ad788['outboundDropCallsDayCallersExit']=_0x215826['outboundDropCallsDayCallersExit'];_0x5ad788[_0x482c('0x3c')]=_0x215826['outboundDropCallsDayTimeout'];_0x5ad788[_0x482c('0x3d')]=_0x215826[_0x482c('0x3d')];_0x5ad788[_0x482c('0x3e')]=_0x215826['outboundNoSuchCallsDay'];_0x5ad788[_0x482c('0x3f')]=_0x215826[_0x482c('0x3f')];_0x5ad788[_0x482c('0x40')]=_0x215826[_0x482c('0x40')];_0x5ad788['outboundRejectCallsDay']=_0x215826[_0x482c('0x41')];_0x5ad788['outboundUnknownCallsDay']=_0x215826[_0x482c('0x42')];_0x5ad788['predictiveIntervalAnsweredCalls']=_0x215826[_0x482c('0x43')];_0x5ad788['predictiveIntervalAvgHoldtime']=_0x215826[_0x482c('0x44')];_0x5ad788[_0x482c('0x45')]=_0x215826['predictiveIntervalAvgTalktime'];_0x5ad788[_0x482c('0x46')]=_0x215826['predictiveIntervalDroppedCallsCallersExit'];_0x5ad788['predictiveIntervalDroppedCallsTimeout']=_0x215826[_0x482c('0x47')];_0x5ad788['predictiveIntervalErlangCalls']=_0x215826['predictiveIntervalErlangCalls'];_0x5ad788['predictiveIntervalErlangCallsDroppedCalls']=_0x215826['predictiveIntervalErlangCallsDroppedCalls'];_0x5ad788[_0x482c('0x48')]=_0x215826[_0x482c('0x48')];_0x5ad788[_0x482c('0x49')]=_0x215826[_0x482c('0x49')];_0x5ad788[_0x482c('0x4a')]=_0x215826['predictiveIntervalPauses'];_0x5ad788[_0x482c('0x4b')]=_0x215826[_0x482c('0x4b')];_0x5ad788[_0x482c('0x4c')]=_0x215826[_0x482c('0x4c')];_0x5ad788['message']=_0x215826['message'];_0x5ad788[_0x482c('0x4d')]=_0x215826[_0x482c('0x4d')];_0x5ad788[_0x482c('0x4e')]=_0x215826[_0x482c('0x4e')];_0x5ad788[_0x482c('0x4f')]=_0x215826[_0x482c('0x4f')];_0x5ad788[_0x482c('0x50')]=_0x215826[_0x482c('0x50')];_0x5ad788[_0x482c('0x51')]=_0x215826[_0x482c('0x51')];_0x5ad788[_0x482c('0x52')]=_0x215826['startPredictive'];_0x5ad788[_0x482c('0x53')]=_0x215826[_0x482c('0x53')];}if(_0x215826[_0x482c('0x54')]){_0x5ad788[_0x482c('0x54')]={'id':_0x215826[_0x482c('0x54')]['id'],'name':_0x215826[_0x482c('0x54')][_0x482c('0xb')],'active':_0x215826['Trunk']['active'],'callerid':_0x215826[_0x482c('0x54')][_0x482c('0x55')]};}if(_0x215826[_0x482c('0x56')]){_0x5ad788['Interval']={'id':_0x215826[_0x482c('0x56')]['id'],'name':_0x215826['Interval'][_0x482c('0xb')]};}_0x2165af[_0x482c('0x57')](_0x5ad788);}}_0x5436e2({'count':_0x2165af[_0x482c('0x58')],'rows':_0x2165af});});},'UpdateVoiceQueue':function(_0x16b893){return new Promise(function(_0x5f4e0a,_0x1ff623){var _0x2c37f3=_[_0x482c('0x59')](_0x4556c8['voiceQueues'],{'id':parseInt(_0x16b893['id'])});var _0x407471=_[_0x482c('0x5a')](_0x16b893,['id']);if(_0x2c37f3){for(var _0xcf89c4 in _0x407471){if(typeof _0x407471[_0xcf89c4]!=='undefined'&&typeof _0x2c37f3[_0xcf89c4]!=='undefined'){_0x2c37f3[_0xcf89c4]=_0x407471[_0xcf89c4];}}_0x5f4e0a(_0x2c37f3);}else{_0x1ff623();}});},'VoiceChannels':function(_0x4a677d){return new Promise(function(_0x4998a5,_0x596ec2){var _0x56b6c5=_[_0x482c('0x5b')](_0x4556c8['channels']);_0x4998a5({'count':_0x56b6c5[_0x482c('0x58')],'rows':_0x56b6c5});});},'VoiceChannelMixMonitor':function(_0xbdbd1b){var _0x3ecf00=this;return new Promise(function(_0x2fa930,_0x40174a){if(ami[_0x482c('0x1e')]()==![]){return _0x40174a(_0x3ecf00[_0x482c('0x12')](0x1f4,[config[_0x482c('0x13')]['ip'],config[_0x482c('0x13')][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}var _0x1126b7=schema(properties[_0x482c('0x5c')])[_0x482c('0x3')](_0xbdbd1b);if(_0x1126b7[_0x482c('0x58')]>0x0){return _0x40174a(_0x3ecf00[_0x482c('0x12')](0x1f4,_[_0x482c('0x5d')](_0x1126b7,_0x482c('0x5e'))['join'](',\x20')));}var _0x107b1b=_[_0x482c('0x59')](_0x4556c8['channels'],{'uniqueid':_0xbdbd1b[_0x482c('0x5f')]});if(_0x107b1b&&_0x107b1b[_0x482c('0x60')]){var _0x1f5e5b=util[_0x482c('0x8')](_0x482c('0x61'),_0xbdbd1b['filename']||_0xbdbd1b['uniqueid'],_0xbdbd1b[_0x482c('0x8')]||_0x482c('0x62'));return ami[_0x482c('0x1c')]({'action':_0x482c('0x63'),'channel':_0x107b1b[_0x482c('0x60')],'file':_0x1f5e5b,'options':_0x482c('0x64')})[_0x482c('0x20')](function(_0x55925a){var _0x508a10=_['find'](_0x107b1b[_0x482c('0x65')],{'filename':_0x482c('0x66')+_0x1f5e5b[_0x482c('0x67')]()});if(_[_0x482c('0x68')](_0x508a10)){_0x107b1b[_0x482c('0x65')][_0x482c('0x57')]({'filename':_0x482c('0x66')+_0x1f5e5b[_0x482c('0x67')](),'createdAt':moment()[_0x482c('0x8')](_0x482c('0x69')),'mixmonitorid':_0x55925a[_0x482c('0x6a')],'status':'rec'});}else{_0x508a10[_0x482c('0x6a')]=_0x55925a[_0x482c('0x6a')];_0x508a10[_0x482c('0x6b')]=_0x482c('0x6c');}_0x2fa930({'code':0xc8,'message':[_0xbdbd1b[_0x482c('0x5f')],_0x482c('0x6d'),_0x55925a[_0x482c('0x6a')]][_0x482c('0x16')]('\x20'),'mixmonitorid':_0x55925a[_0x482c('0x6a')]});})[_0x482c('0x1d')](function(_0x3981cf){_0x40174a(_0x3ecf00[_0x482c('0x12')](0x1f5,[_0xbdbd1b['uniqueid'],_0x3981cf['message'][_0x482c('0x67')]()][_0x482c('0x16')]('\x20')));});}else{return _0x40174a(_0x3ecf00[_0x482c('0x12')](0x1f5,_0x482c('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0xa5ffff){var _0x313155=this;return new Promise(function(_0x5382b0,_0x231353){if(ami[_0x482c('0x1e')]()==![]){return _0x231353(_0x313155[_0x482c('0x12')](0x1f4,[config[_0x482c('0x13')]['ip'],config[_0x482c('0x13')][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}var _0x1840a9=schema(properties[_0x482c('0x5c')])[_0x482c('0x3')](_0xa5ffff);if(_0x1840a9[_0x482c('0x58')]>0x0){return _0x231353(_0x313155['error'](0x1f4,_[_0x482c('0x5d')](_0x1840a9,'message')[_0x482c('0x16')](',\x20')));}var _0x1bb8d1=_[_0x482c('0x59')](_0x4556c8[_0x482c('0x6f')],{'uniqueid':_0xa5ffff[_0x482c('0x5f')]});if(_0x1bb8d1){return BPromise[_0x482c('0x70')]()['then'](function(){if(_0x1bb8d1[_0x482c('0x60')]){return ami[_0x482c('0x1c')]({'action':'StopMixMonitor','channel':_0x1bb8d1['channel'],'mixmonitorid':_0xa5ffff[_0x482c('0x6a')]})[_0x482c('0x1d')](function(_0x481241){});}})[_0x482c('0x20')](function(){if(_0x1bb8d1[_0x482c('0x71')]){return ami[_0x482c('0x1c')]({'action':_0x482c('0x72'),'channel':_0x1bb8d1['destinationchannel'],'mixmonitorid':_0xa5ffff[_0x482c('0x6a')]})[_0x482c('0x1d')](function(_0x21a0c5){});}})[_0x482c('0x20')](function(_0x3a37f5){var _0x2fc65f=_['find'](_0x1bb8d1['monitors'],{'mixmonitorid':_0xa5ffff[_0x482c('0x6a')]});if(_0x2fc65f){_0x2fc65f[_0x482c('0x6b')]=_0x482c('0x73');}})['then'](function(){var _0x23349f=util[_0x482c('0x8')](_0x482c('0x61'),_0xa5ffff[_0x482c('0x74')]||_0xa5ffff[_0x482c('0x5f')],_0xa5ffff[_0x482c('0x8')]||_0x482c('0x62'));var _0x37e456=_[_0x482c('0x59')](_0x1bb8d1['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x23349f[_0x482c('0x67')]()});if(_0x37e456){_0x37e456[_0x482c('0x6b')]='stop';}})['then'](function(){_0x5382b0({'code':0xc8,'message':[_0xa5ffff[_0x482c('0x5f')],_0x482c('0x75')][_0x482c('0x16')]('\x20')});})['catch'](function(_0x510f07){_0x231353(_0x313155['error'](0x1f5,[_0xa5ffff[_0x482c('0x5f')],_0x510f07[_0x482c('0x5e')][_0x482c('0x67')]()][_0x482c('0x16')]('\x20')));});}else{return _0x231353(_0x313155[_0x482c('0x12')](0x1f5,_0x482c('0x6e')));}});},'VoiceQueuesChannels':function(_0x4839f2){return new Promise(function(_0x5e5e76,_0x2ec137){var _0x1d878f=_[_0x482c('0x5b')](_0x4556c8[_0x482c('0x76')]);_0x5e5e76({'count':_0x1d878f[_0x482c('0x58')],'rows':_0x1d878f});});},'VoiceQueuesChannel':function(_0x1c9531){var _0x2444a8=this;return new Promise(function(_0x445edb,_0x1c771f){var _0x142809=schema(properties[_0x482c('0x77')])[_0x482c('0x3')](_0x1c9531);if(_0x142809['length']>0x0){return _0x1c771f(_0x2444a8[_0x482c('0x12')](0x1f4,_[_0x482c('0x5d')](_0x142809,_0x482c('0x5e'))['join'](',\x20')));}var _0x2f781d=_[_0x482c('0x59')](_0x4556c8[_0x482c('0x76')],{'uniqueid':_0x1c9531['uniqueid']});if(_0x2f781d){_0x445edb(_0x2f781d);}else{return _0x1c771f(_0x2444a8[_0x482c('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x4bd929){var _0xcf240d=this;return new Promise(function(_0x14c94c,_0x383254){if(ami[_0x482c('0x1e')]()==![]){return _0x383254(_0xcf240d[_0x482c('0x12')](0x1f4,[config[_0x482c('0x13')]['ip'],config[_0x482c('0x13')]['username'],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}var _0x5eb509=schema(properties[_0x482c('0x78')])['validate'](_0x4bd929);if(_0x5eb509['length']>0x0){return _0x383254(_0xcf240d['error'](0x1f4,_[_0x482c('0x5d')](_0x5eb509,'message')['join'](',\x20')));}var _0xc7bebc=_[_0x482c('0x59')](_0x4556c8['queueChannels'],{'uniqueid':_0x4bd929[_0x482c('0x5f')]});if(_0xc7bebc&&_0xc7bebc['channel']){return ami['Action']({'action':'Hangup','channel':_0xc7bebc[_0x482c('0x60')]})[_0x482c('0x20')](function(_0x4fc3ef){_0x14c94c({'code':0xc8,'message':[_0x4bd929['uniqueid'],_0x4fc3ef['message'][_0x482c('0x67')]()][_0x482c('0x16')]('\x20')});})[_0x482c('0x1d')](function(_0x58eebf){_0x383254(_0xcf240d['error'](0x1f5,[_0x4bd929[_0x482c('0x5f')],_0x58eebf['message'][_0x482c('0x67')]()][_0x482c('0x16')]('\x20')));});}else{return _0x383254(_0xcf240d['error'](0x1f5,_0x482c('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x5b804f){var _0x48b9c2=this;return new Promise(function(_0x2c0056,_0x4d6926){if(ami[_0x482c('0x1e')]()==![]){return _0x4d6926(_0x48b9c2['error'](0x1f4,[config[_0x482c('0x13')]['ip'],config['asterisk'][_0x482c('0x14')],_0x482c('0x15')][_0x482c('0x16')]('\x20')));}var _0x5b9153=schema(properties[_0x482c('0x79')])[_0x482c('0x3')](_0x5b804f);if(_0x5b9153[_0x482c('0x58')]>0x0){return _0x4d6926(_0x48b9c2['error'](0x1f4,_[_0x482c('0x5d')](_0x5b9153,_0x482c('0x5e'))[_0x482c('0x16')](',\x20')));}var _0x38eafd=_[_0x482c('0x59')](_0x4556c8[_0x482c('0x76')],{'uniqueid':_0x5b804f[_0x482c('0x5f')]});if(_0x38eafd&&_0x38eafd['channel']){return ami[_0x482c('0x1c')]({'action':_0x482c('0x7a'),'channel':_0x38eafd[_0x482c('0x60')],'exten':_0x5b804f['exten'],'context':_0x5b804f['context']||_0x38eafd['context'],'priority':0x1})[_0x482c('0x20')](function(_0x5b3629){_0x2c0056({'code':0xc8,'message':[_0x5b804f['uniqueid'],_0x5b3629[_0x482c('0x5e')]['toLowerCase']()][_0x482c('0x16')]('\x20')});})[_0x482c('0x1d')](function(_0x17be77){_0x4d6926(_0x48b9c2[_0x482c('0x12')](0x1f5,[_0x5b804f['uniqueid'],_0x17be77[_0x482c('0x5e')]['toLowerCase']()][_0x482c('0x16')]('\x20')));});}else{return _0x4d6926(_0x48b9c2[_0x482c('0x12')](0x1f5,_0x482c('0x6e')));}});},'Agents':function(_0x492ab0){return new Promise(function(_0x590d97,_0x145c5e){var _0x45011c=_['values'](_0x4556c8[_0x482c('0xf')]);_0x590d97({'count':_0x45011c['length'],'rows':_0x45011c});});},'Telephones':function(_0x929a4){return new Promise(function(_0x2c683f,_0x2f5799){var _0x549dec=_[_0x482c('0x5b')](_0x4556c8[_0x482c('0x7b')]);_0x2c683f({'count':_0x549dec[_0x482c('0x58')],'rows':_0x549dec});});},'Trunks':function(_0x573455){return new Promise(function(_0x27b6d2,_0x34f49f){var _0x56a961=_['values'](_0x4556c8['trunks']);_0x27b6d2({'count':_0x56a961[_0x482c('0x58')],'rows':_0x56a961});});},'OutboundChannels':function(_0x88661b){return new Promise(function(_0x3f0561,_0x4903f1){var _0xd5f6df=_[_0x482c('0x5b')](_0x4556c8['outboundChannels']);_0x3f0561({'count':_0xd5f6df[_0x482c('0x58')],'rows':_0xd5f6df});});},'Outbound':function(_0x5516d6){return new Promise(function(_0x106aa1,_0x363735){_0x106aa1(_0x4556c8[_0x482c('0x2f')]);});},'Campaigns':function(_0x1b4c75){return new Promise(function(_0x2db600,_0x255894){var _0x4dbd16=_['values'](_0x4556c8[_0x482c('0x7c')]);_0x2db600({'count':_0x4dbd16[_0x482c('0x58')],'rows':_0x4dbd16});});},'VoiceQueuesPreview':function(_0x2156af){var _0x319fc3=this;return new Promise(function(_0x7d0afa,_0x13df33){_0x47edb6[_0x482c('0x7d')](_0x2156af['id'])['then'](function(_0x3f5eac){_0x7d0afa({'code':0xc8,'message':_0x3f5eac[_0x482c('0x5e')]});})[_0x482c('0x1d')](function(_0x483e29){_0x13df33(_0x319fc3[_0x482c('0x12')](0x1f4,_0x483e29[_0x482c('0x5e')]));});});},'EventManager':function(_0x2eca83){var _0x190ee5=this;return new Promise(function(_0x45fe30,_0x1f4fd0){if(!_0x2eca83[_0x482c('0x7e')]){return _0x1f4fd0(_0x190ee5['error'](0x1f4,_0x482c('0x7f')));}ami[_0x482c('0x80')](_0x482c('0x81')+_0x2eca83['event'],_0x2eca83[_0x482c('0x5e')]);_0x45fe30({'code':0xc8,'message':_0x2eca83});});},'FaxAccounts':function(_0x55a8a6){return new Promise(function(_0x335a76,_0x3b948c){var _0x3e00e2=_[_0x482c('0x5b')](_0x4556c8['faxAccounts']);_0x335a76({'count':_0x3e00e2[_0x482c('0x58')],'rows':_0x3e00e2});});},'SendFax':function(_0xeaee3d){var _0x1120e1=this;return new Promise(function(_0xf8ac35,_0x5e3619){_0x477cf4[_0x482c('0x82')](_0xeaee3d)[_0x482c('0x20')](function(_0x157896){_0xf8ac35({'code':0xc8,'message':_0x157896[_0x482c('0x5e')]});})[_0x482c('0x1d')](function(_0x4aead3){_0x5e3619(_0x1120e1[_0x482c('0x12')](0x1f4,_0x4aead3[_0x482c('0x5e')]));});});},'CheckAfterSend':function(_0x1911f1){var _0x308dc8=this;return new Promise(function(_0x10fb1f,_0x5cd466){_0x477cf4[_0x482c('0x83')](_0x1911f1)[_0x482c('0x20')](function(_0x44da80){_0x10fb1f({'code':0xc8,'message':_0x44da80['message']});})[_0x482c('0x1d')](function(_0x1f2546){_0x5cd466(_0x308dc8[_0x482c('0x12')](0x1f4,_0x1f2546[_0x482c('0x5e')]));});});}};var _0x519225=jayson[_0x482c('0x84')](_0x32a503)[_0x482c('0x85')]();_0x519225['on'](_0x482c('0x12'),function(_0x5cbf1a){return _0xfdb92(_0x5cbf1a);});_0x519225[_0x482c('0x86')](0x232a,_0x482c('0x87'),function(){console[_0x482c('0x88')](_0x482c('0x89'),0x232a);return _0x5d7c76('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xcaf2=['lodash','jayson/promise','validate','moment','../../../config/environment','../ami','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','username','join','pick','keys','module','Reload','then','catch','error','message','asterisk','ami\x20disconnected','command','action','Command','Action','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','%s.%s','filename','wav','MixMonitor','channel','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','destinationchannel','StopMixMonitor','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outbound','campaigns','run','event','emit','faxAccounts','send','checkAfterSend','http','listen','127.0.0.1','RPC\x20listening\x20on\x20port:'];(function(_0x49eac2,_0x289d4f){var _0x47d127=function(_0x502479){while(--_0x502479){_0x49eac2['push'](_0x49eac2['shift']());}};_0x47d127(++_0x289d4f);}(_0xcaf2,0x8a));var _0x2caf=function(_0x3e4285,_0x83a4f0){_0x3e4285=_0x3e4285-0x0;var _0xce09e7=_0xcaf2[_0x3e4285];return _0xce09e7;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var jayson=require(_0x2caf('0x1'));var schema=require(_0x2caf('0x2'));var BPromise=require('bluebird');var moment=require(_0x2caf('0x3'));var config=require(_0x2caf('0x4'));var properties=require('../properties');var ami=require(_0x2caf('0x5'));exports['listen']=function(_0x335e3c,_0xae320c,_0x249a4b){return new BPromise(function(_0x599ce7,_0xc44e4e){var _0x314486={'QueuePause':function(_0x4667c6){return new Promise(function(_0x34e792,_0x5611aa){var _0x4050ab=util[_0x2caf('0x6')](_0x2caf('0x7'),_0x2caf('0x8'),_0x4667c6[_0x2caf('0x9')]);if(_0x335e3c[_0x2caf('0xa')]&&_0x335e3c[_0x2caf('0xa')][_0x4050ab]&&_0x335e3c[_0x2caf('0xa')][_0x4050ab][_0x2caf('0xb')]){_0x335e3c['timers'][_0x4050ab][_0x2caf('0xc')]();}if(_0x335e3c[_0x2caf('0xd')][_0x4050ab]){_0x335e3c[_0x2caf('0xd')][_0x4050ab][_0x2caf('0xe')]({'statePause':_0x4667c6[_0x2caf('0xf')]?!![]:![]});}_0x34e792({'code':0xc8,'message':_0x2caf('0x10')});});},'Reload':function(_0x252147){var _0x3b2e0a=this;return new Promise(function(_0x5106fd,_0x7258b1){if(ami[_0x2caf('0x11')]()==![]){return _0x7258b1(_0x3b2e0a['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x2caf('0x12')],'ami\x20disconnected'][_0x2caf('0x13')]('\x20')));}_0x252147=_[_0x2caf('0x14')](_0x252147,_[_0x2caf('0x15')](properties[_0x2caf('0x16')]));_0x252147['action']=_0x2caf('0x17');return ami['Action'](_0x252147)[_0x2caf('0x18')](function(_0x57f3cd){_0x5106fd({'code':0xc8,'message':_0x57f3cd['message']});})[_0x2caf('0x19')](function(_0x58047b){_0x7258b1(_0x3b2e0a[_0x2caf('0x1a')](0x1f5,_0x58047b[_0x2caf('0x1b')]));});});},'Command':function(_0x5c5d98){var _0x12624b=this;return new Promise(function(_0x1eeb76,_0x6b3778){if(ami[_0x2caf('0x11')]()==![]){return _0x6b3778(_0x12624b[_0x2caf('0x1a')](0x1f4,[config['asterisk']['ip'],config[_0x2caf('0x1c')][_0x2caf('0x12')],_0x2caf('0x1d')][_0x2caf('0x13')]('\x20')));}_0x5c5d98=_[_0x2caf('0x14')](_0x5c5d98,_0x2caf('0x1e'));_0x5c5d98[_0x2caf('0x1f')]=_0x2caf('0x20');return ami[_0x2caf('0x21')](_0x5c5d98)[_0x2caf('0x18')](function(_0x6814bc){_0x1eeb76({'code':0xc8,'message':_0x6814bc['content']});})[_0x2caf('0x19')](function(_0x14bfd2){_0x6b3778(_0x12624b[_0x2caf('0x1a')](0x1f5,_0x14bfd2[_0x2caf('0x1b')]));});});},'VoiceQueues':function(_0x3efa4e){return new Promise(function(_0x25ebea,_0x392196){var _0x164da=[];for(var _0x2e0a75 in _0x335e3c[_0x2caf('0x22')]){if(_0x335e3c['voiceQueues'][_0x2caf('0x23')](_0x2e0a75)){var _0x325eda=_0x335e3c[_0x2caf('0x22')][_0x2e0a75];var _0x37b08f={'id':_0x325eda['id'],'name':_0x325eda[_0x2caf('0x9')],'strategy':_0x325eda[_0x2caf('0x24')],'answered':_0x325eda[_0x2caf('0x25')],'available':_0x325eda[_0x2caf('0x26')],'loggedIn':_0x325eda[_0x2caf('0x27')],'pTalking':_0x325eda[_0x2caf('0x28')],'sumBillable':_0x325eda[_0x2caf('0x29')],'sumDuration':_0x325eda[_0x2caf('0x2a')],'sumHoldTime':_0x325eda[_0x2caf('0x2b')]||0x0,'talking':_0x325eda['talking'],'total':_0x325eda[_0x2caf('0x2c')],'type':_0x325eda[_0x2caf('0x2d')],'unmanaged':_0x325eda[_0x2caf('0x2e')],'abandoned':_0x325eda[_0x2caf('0x2f')],'waiting':_0x325eda[_0x2caf('0x30')],'loggedInDb':_0x325eda[_0x2caf('0x31')]};if(_0x325eda[_0x2caf('0x2d')]==='outbound'){_0x37b08f[_0x2caf('0x32')]=_0x325eda[_0x2caf('0x32')];_0x37b08f['dialMethod']=_0x325eda[_0x2caf('0x33')];_0x37b08f[_0x2caf('0x34')]=_0x325eda[_0x2caf('0x34')];_0x37b08f['dialOriginateCallerIdNumber']=_0x325eda[_0x2caf('0x35')];_0x37b08f['dialOriginateTimeout']=_0x325eda['dialOriginateTimeout'];_0x37b08f[_0x2caf('0x36')]=_0x325eda[_0x2caf('0x36')];_0x37b08f[_0x2caf('0x37')]=_0x325eda[_0x2caf('0x37')];_0x37b08f[_0x2caf('0x38')]=_0x325eda[_0x2caf('0x38')];_0x37b08f[_0x2caf('0x39')]=_0x325eda[_0x2caf('0x39')];_0x37b08f[_0x2caf('0x3a')]=_0x325eda['outboundBlacklistCallsDay'];_0x37b08f[_0x2caf('0x3b')]=_0x325eda[_0x2caf('0x3b')];_0x37b08f[_0x2caf('0x3c')]=_0x325eda[_0x2caf('0x3c')];_0x37b08f[_0x2caf('0x3d')]=_0x325eda[_0x2caf('0x3d')];_0x37b08f[_0x2caf('0x3e')]=_0x325eda[_0x2caf('0x3e')];_0x37b08f[_0x2caf('0x3f')]=_0x325eda[_0x2caf('0x3f')];_0x37b08f[_0x2caf('0x40')]=_0x325eda[_0x2caf('0x40')];_0x37b08f['outboundNoSuchCallsDay']=_0x325eda['outboundNoSuchCallsDay'];_0x37b08f[_0x2caf('0x41')]=_0x325eda[_0x2caf('0x41')];_0x37b08f[_0x2caf('0x42')]=_0x325eda[_0x2caf('0x42')];_0x37b08f['outboundRejectCallsDay']=_0x325eda[_0x2caf('0x43')];_0x37b08f[_0x2caf('0x44')]=_0x325eda[_0x2caf('0x44')];_0x37b08f[_0x2caf('0x45')]=_0x325eda[_0x2caf('0x45')];_0x37b08f[_0x2caf('0x46')]=_0x325eda[_0x2caf('0x46')];_0x37b08f[_0x2caf('0x47')]=_0x325eda['predictiveIntervalAvgTalktime'];_0x37b08f['predictiveIntervalDroppedCallsCallersExit']=_0x325eda[_0x2caf('0x48')];_0x37b08f[_0x2caf('0x49')]=_0x325eda[_0x2caf('0x49')];_0x37b08f[_0x2caf('0x4a')]=_0x325eda[_0x2caf('0x4a')];_0x37b08f[_0x2caf('0x4b')]=_0x325eda[_0x2caf('0x4b')];_0x37b08f[_0x2caf('0x4c')]=_0x325eda[_0x2caf('0x4c')];_0x37b08f[_0x2caf('0x4d')]=_0x325eda[_0x2caf('0x4d')];_0x37b08f['predictiveIntervalPauses']=_0x325eda[_0x2caf('0x4e')];_0x37b08f[_0x2caf('0x4f')]=_0x325eda[_0x2caf('0x4f')];_0x37b08f['predictiveIntervalTotalCalls']=_0x325eda[_0x2caf('0x50')];_0x37b08f[_0x2caf('0x1b')]=_0x325eda[_0x2caf('0x1b')];_0x37b08f['originated']=_0x325eda[_0x2caf('0x51')];_0x37b08f[_0x2caf('0x52')]=_0x325eda['erlangCalls'];_0x37b08f[_0x2caf('0x53')]=_0x325eda[_0x2caf('0x53')];_0x37b08f['erlangAbandonmentRate']=_0x325eda[_0x2caf('0x54')];_0x37b08f[_0x2caf('0x55')]=_0x325eda[_0x2caf('0x55')];_0x37b08f[_0x2caf('0x56')]=_0x325eda[_0x2caf('0x56')];_0x37b08f[_0x2caf('0x57')]=_0x325eda[_0x2caf('0x57')];}if(_0x325eda[_0x2caf('0x58')]){_0x37b08f['Trunk']={'id':_0x325eda[_0x2caf('0x58')]['id'],'name':_0x325eda['Trunk'][_0x2caf('0x9')],'active':_0x325eda[_0x2caf('0x58')][_0x2caf('0x59')],'callerid':_0x325eda['Trunk']['callerid']};}if(_0x325eda[_0x2caf('0x5a')]){_0x37b08f['Interval']={'id':_0x325eda[_0x2caf('0x5a')]['id'],'name':_0x325eda[_0x2caf('0x5a')][_0x2caf('0x9')]};}_0x164da[_0x2caf('0x5b')](_0x37b08f);}}_0x25ebea({'count':_0x164da[_0x2caf('0x5c')],'rows':_0x164da});});},'UpdateVoiceQueue':function(_0x334cfa){return new Promise(function(_0x18dc5b,_0x61ca34){var _0x100681=_[_0x2caf('0x5d')](_0x335e3c[_0x2caf('0x22')],{'id':parseInt(_0x334cfa['id'])});var _0x319452=_[_0x2caf('0x5e')](_0x334cfa,['id']);if(_0x100681){for(var _0x9a62bd in _0x319452){if(typeof _0x319452[_0x9a62bd]!==_0x2caf('0x5f')&&typeof _0x100681[_0x9a62bd]!==_0x2caf('0x5f')){_0x100681[_0x9a62bd]=_0x319452[_0x9a62bd];}}_0x18dc5b(_0x100681);}else{_0x61ca34();}});},'VoiceChannels':function(_0x123bab){return new Promise(function(_0x1e691a,_0x36fb19){var _0x3a598b=_[_0x2caf('0x60')](_0x335e3c['channels']);_0x1e691a({'count':_0x3a598b[_0x2caf('0x5c')],'rows':_0x3a598b});});},'VoiceChannelMixMonitor':function(_0x17ea46){var _0x4fe096=this;return new Promise(function(_0x589c57,_0x44bca0){if(ami[_0x2caf('0x11')]()==![]){return _0x44bca0(_0x4fe096['error'](0x1f4,[config[_0x2caf('0x1c')]['ip'],config[_0x2caf('0x1c')][_0x2caf('0x12')],_0x2caf('0x1d')][_0x2caf('0x13')]('\x20')));}var _0xb69a31=schema(properties[_0x2caf('0x61')])[_0x2caf('0x2')](_0x17ea46);if(_0xb69a31[_0x2caf('0x5c')]>0x0){return _0x44bca0(_0x4fe096[_0x2caf('0x1a')](0x1f4,_[_0x2caf('0x62')](_0xb69a31,_0x2caf('0x1b'))[_0x2caf('0x13')](',\x20')));}var _0x5b8d66=_[_0x2caf('0x5d')](_0x335e3c[_0x2caf('0x63')],{'uniqueid':_0x17ea46[_0x2caf('0x64')]});if(_0x5b8d66&&_0x5b8d66['channel']){var _0x473188=util[_0x2caf('0x6')](_0x2caf('0x65'),_0x17ea46[_0x2caf('0x66')]||_0x17ea46[_0x2caf('0x64')],_0x17ea46[_0x2caf('0x6')]||_0x2caf('0x67'));return ami[_0x2caf('0x21')]({'action':_0x2caf('0x68'),'channel':_0x5b8d66[_0x2caf('0x69')],'file':_0x473188,'options':'ai(mixmonitorid)'})[_0x2caf('0x18')](function(_0x106930){var _0xa325cd=_['find'](_0x5b8d66[_0x2caf('0x6a')],{'filename':_0x2caf('0x6b')+_0x473188[_0x2caf('0x6c')]()});if(_['isNil'](_0xa325cd)){_0x5b8d66[_0x2caf('0x6a')][_0x2caf('0x5b')]({'filename':_0x2caf('0x6b')+_0x473188[_0x2caf('0x6c')](),'createdAt':moment()['format'](_0x2caf('0x6d')),'mixmonitorid':_0x106930[_0x2caf('0x6e')],'status':_0x2caf('0x6f')});}else{_0xa325cd['mixmonitorid']=_0x106930[_0x2caf('0x6e')];_0xa325cd[_0x2caf('0x70')]='rec';}_0x589c57({'code':0xc8,'message':[_0x17ea46[_0x2caf('0x64')],_0x2caf('0x71'),_0x106930[_0x2caf('0x6e')]]['join']('\x20'),'mixmonitorid':_0x106930[_0x2caf('0x6e')]});})['catch'](function(_0x96960a){_0x44bca0(_0x4fe096[_0x2caf('0x1a')](0x1f5,[_0x17ea46['uniqueid'],_0x96960a['message'][_0x2caf('0x6c')]()][_0x2caf('0x13')]('\x20')));});}else{return _0x44bca0(_0x4fe096[_0x2caf('0x1a')](0x1f5,_0x2caf('0x72')));}});},'VoiceChannelStopMixMonitor':function(_0xb3d0c){var _0x4ea3d5=this;return new Promise(function(_0x2787eb,_0x17451c){if(ami['isConnected']()==![]){return _0x17451c(_0x4ea3d5[_0x2caf('0x1a')](0x1f4,[config[_0x2caf('0x1c')]['ip'],config['asterisk']['username'],_0x2caf('0x1d')]['join']('\x20')));}var _0x2e8de2=schema(properties[_0x2caf('0x61')])[_0x2caf('0x2')](_0xb3d0c);if(_0x2e8de2[_0x2caf('0x5c')]>0x0){return _0x17451c(_0x4ea3d5[_0x2caf('0x1a')](0x1f4,_['map'](_0x2e8de2,_0x2caf('0x1b'))['join'](',\x20')));}var _0x21a167=_['find'](_0x335e3c[_0x2caf('0x63')],{'uniqueid':_0xb3d0c['uniqueid']});if(_0x21a167){return BPromise['resolve']()[_0x2caf('0x18')](function(){if(_0x21a167['channel']){return ami[_0x2caf('0x21')]({'action':'StopMixMonitor','channel':_0x21a167['channel'],'mixmonitorid':_0xb3d0c[_0x2caf('0x6e')]})[_0x2caf('0x19')](function(_0x380c2e){});}})[_0x2caf('0x18')](function(){if(_0x21a167[_0x2caf('0x73')]){return ami['Action']({'action':_0x2caf('0x74'),'channel':_0x21a167[_0x2caf('0x73')],'mixmonitorid':_0xb3d0c['mixmonitorid']})[_0x2caf('0x19')](function(_0x4b0360){});}})[_0x2caf('0x18')](function(_0x1bfd2a){var _0x4399ec=_[_0x2caf('0x5d')](_0x21a167[_0x2caf('0x6a')],{'mixmonitorid':_0xb3d0c['mixmonitorid']});if(_0x4399ec){_0x4399ec['status']=_0x2caf('0x75');}})[_0x2caf('0x18')](function(){var _0x90ddb1=util[_0x2caf('0x6')](_0x2caf('0x65'),_0xb3d0c[_0x2caf('0x66')]||_0xb3d0c[_0x2caf('0x64')],_0xb3d0c['format']||_0x2caf('0x67'));var _0x34d3ec=_[_0x2caf('0x5d')](_0x21a167[_0x2caf('0x6a')],{'filename':_0x2caf('0x6b')+_0x90ddb1['toLowerCase']()});if(_0x34d3ec){_0x34d3ec[_0x2caf('0x70')]='stop';}})[_0x2caf('0x18')](function(){_0x2787eb({'code':0xc8,'message':[_0xb3d0c[_0x2caf('0x64')],_0x2caf('0x76')][_0x2caf('0x13')]('\x20')});})[_0x2caf('0x19')](function(_0x4ebedc){_0x17451c(_0x4ea3d5[_0x2caf('0x1a')](0x1f5,[_0xb3d0c['uniqueid'],_0x4ebedc[_0x2caf('0x1b')][_0x2caf('0x6c')]()]['join']('\x20')));});}else{return _0x17451c(_0x4ea3d5[_0x2caf('0x1a')](0x1f5,_0x2caf('0x72')));}});},'VoiceQueuesChannels':function(_0x131b1c){return new Promise(function(_0x6f5797,_0x172f98){var _0xd851ee=_['values'](_0x335e3c[_0x2caf('0x77')]);_0x6f5797({'count':_0xd851ee['length'],'rows':_0xd851ee});});},'VoiceQueuesChannel':function(_0x1bc5d7){var _0x5ad1be=this;return new Promise(function(_0x1b127c,_0x232120){var _0x42bf85=schema(properties['voicequeuechannel'])[_0x2caf('0x2')](_0x1bc5d7);if(_0x42bf85[_0x2caf('0x5c')]>0x0){return _0x232120(_0x5ad1be[_0x2caf('0x1a')](0x1f4,_[_0x2caf('0x62')](_0x42bf85,_0x2caf('0x1b'))['join'](',\x20')));}var _0x366c5d=_[_0x2caf('0x5d')](_0x335e3c[_0x2caf('0x77')],{'uniqueid':_0x1bc5d7[_0x2caf('0x64')]});if(_0x366c5d){_0x1b127c(_0x366c5d);}else{return _0x232120(_0x5ad1be[_0x2caf('0x1a')](0x1f5,_0x2caf('0x72')));}});},'VoiceQueuesChannelHangup':function(_0x5ae8de){var _0x3f2745=this;return new Promise(function(_0x5a2633,_0xaee725){if(ami[_0x2caf('0x11')]()==![]){return _0xaee725(_0x3f2745[_0x2caf('0x1a')](0x1f4,[config[_0x2caf('0x1c')]['ip'],config[_0x2caf('0x1c')][_0x2caf('0x12')],_0x2caf('0x1d')][_0x2caf('0x13')]('\x20')));}var _0x5702b4=schema(properties[_0x2caf('0x78')])[_0x2caf('0x2')](_0x5ae8de);if(_0x5702b4[_0x2caf('0x5c')]>0x0){return _0xaee725(_0x3f2745['error'](0x1f4,_[_0x2caf('0x62')](_0x5702b4,_0x2caf('0x1b'))[_0x2caf('0x13')](',\x20')));}var _0x4a29cd=_[_0x2caf('0x5d')](_0x335e3c[_0x2caf('0x77')],{'uniqueid':_0x5ae8de[_0x2caf('0x64')]});if(_0x4a29cd&&_0x4a29cd[_0x2caf('0x69')]){return ami['Action']({'action':'Hangup','channel':_0x4a29cd[_0x2caf('0x69')]})[_0x2caf('0x18')](function(_0x11d10d){_0x5a2633({'code':0xc8,'message':[_0x5ae8de[_0x2caf('0x64')],_0x11d10d[_0x2caf('0x1b')][_0x2caf('0x6c')]()][_0x2caf('0x13')]('\x20')});})[_0x2caf('0x19')](function(_0x20fb6e){_0xaee725(_0x3f2745[_0x2caf('0x1a')](0x1f5,[_0x5ae8de[_0x2caf('0x64')],_0x20fb6e[_0x2caf('0x1b')][_0x2caf('0x6c')]()][_0x2caf('0x13')]('\x20')));});}else{return _0xaee725(_0x3f2745['error'](0x1f5,_0x2caf('0x72')));}});},'VoiceQueuesChannelRedirect':function(_0x13e931){var _0x4e1493=this;return new Promise(function(_0x23e2ce,_0x265068){if(ami[_0x2caf('0x11')]()==![]){return _0x265068(_0x4e1493['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x2caf('0x12')],_0x2caf('0x1d')][_0x2caf('0x13')]('\x20')));}var _0x5e0e3c=schema(properties[_0x2caf('0x79')])[_0x2caf('0x2')](_0x13e931);if(_0x5e0e3c[_0x2caf('0x5c')]>0x0){return _0x265068(_0x4e1493['error'](0x1f4,_[_0x2caf('0x62')](_0x5e0e3c,_0x2caf('0x1b'))['join'](',\x20')));}var _0x3cd498=_[_0x2caf('0x5d')](_0x335e3c[_0x2caf('0x77')],{'uniqueid':_0x13e931['uniqueid']});if(_0x3cd498&&_0x3cd498[_0x2caf('0x69')]){return ami[_0x2caf('0x21')]({'action':_0x2caf('0x7a'),'channel':_0x3cd498[_0x2caf('0x69')],'exten':_0x13e931[_0x2caf('0x7b')],'context':_0x13e931[_0x2caf('0x7c')]||_0x3cd498['context'],'priority':0x1})['then'](function(_0x2137b7){_0x23e2ce({'code':0xc8,'message':[_0x13e931[_0x2caf('0x64')],_0x2137b7[_0x2caf('0x1b')][_0x2caf('0x6c')]()][_0x2caf('0x13')]('\x20')});})[_0x2caf('0x19')](function(_0x5fd9c3){_0x265068(_0x4e1493[_0x2caf('0x1a')](0x1f5,[_0x13e931[_0x2caf('0x64')],_0x5fd9c3[_0x2caf('0x1b')][_0x2caf('0x6c')]()][_0x2caf('0x13')]('\x20')));});}else{return _0x265068(_0x4e1493['error'](0x1f5,_0x2caf('0x72')));}});},'Agents':function(_0x313273){return new Promise(function(_0x217778,_0x52bf38){var _0x3def55=_['values'](_0x335e3c['agents']);_0x217778({'count':_0x3def55['length'],'rows':_0x3def55});});},'Telephones':function(_0x2cc9fc){return new Promise(function(_0x509ff1,_0xc9ee15){var _0x2069f0=_['values'](_0x335e3c[_0x2caf('0x7d')]);_0x509ff1({'count':_0x2069f0[_0x2caf('0x5c')],'rows':_0x2069f0});});},'Trunks':function(_0x4a21d2){return new Promise(function(_0x492b49,_0x22cd27){var _0xb1f581=_[_0x2caf('0x60')](_0x335e3c['trunks']);_0x492b49({'count':_0xb1f581['length'],'rows':_0xb1f581});});},'OutboundChannels':function(_0x107d05){return new Promise(function(_0x584efc,_0x3add33){var _0x51df18=_[_0x2caf('0x60')](_0x335e3c['outboundChannels']);_0x584efc({'count':_0x51df18['length'],'rows':_0x51df18});});},'Outbound':function(_0x19e2bd){return new Promise(function(_0x54d8d7,_0x485d4a){_0x54d8d7(_0x335e3c[_0x2caf('0x7e')]);});},'Campaigns':function(_0x3c20b4){return new Promise(function(_0x2aab58,_0x387a48){var _0x1663d3=_['values'](_0x335e3c[_0x2caf('0x7f')]);_0x2aab58({'count':_0x1663d3['length'],'rows':_0x1663d3});});},'VoiceQueuesPreview':function(_0x4c456b){var _0x2998ef=this;return new Promise(function(_0x5559fc,_0x4b7b6a){_0xae320c[_0x2caf('0x80')](_0x4c456b['id'])[_0x2caf('0x18')](function(_0x84a87d){_0x5559fc({'code':0xc8,'message':_0x84a87d['message']});})[_0x2caf('0x19')](function(_0x1b63b1){_0x4b7b6a(_0x2998ef['error'](0x1f4,_0x1b63b1[_0x2caf('0x1b')]));});});},'EventManager':function(_0x528336){var _0x2fec57=this;return new Promise(function(_0xc1697,_0x2fdba6){if(!_0x528336[_0x2caf('0x81')]){return _0x2fdba6(_0x2fec57['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x2caf('0x82')]('custom:'+_0x528336[_0x2caf('0x81')],_0x528336['message']);_0xc1697({'code':0xc8,'message':_0x528336});});},'FaxAccounts':function(_0x55811d){return new Promise(function(_0x598610,_0x50f721){var _0x340e20=_[_0x2caf('0x60')](_0x335e3c[_0x2caf('0x83')]);_0x598610({'count':_0x340e20[_0x2caf('0x5c')],'rows':_0x340e20});});},'SendFax':function(_0x297abb){var _0x3f569f=this;return new Promise(function(_0x1c506e,_0x33b627){_0x249a4b[_0x2caf('0x84')](_0x297abb)['then'](function(_0x290b6b){_0x1c506e({'code':0xc8,'message':_0x290b6b[_0x2caf('0x1b')]});})['catch'](function(_0x49b03e){_0x33b627(_0x3f569f[_0x2caf('0x1a')](0x1f4,_0x49b03e[_0x2caf('0x1b')]));});});},'CheckAfterSend':function(_0x170070){var _0x199d4e=this;return new Promise(function(_0x5ee03e,_0x274b11){_0x249a4b[_0x2caf('0x85')](_0x170070)[_0x2caf('0x18')](function(_0x44aafd){_0x5ee03e({'code':0xc8,'message':_0x44aafd[_0x2caf('0x1b')]});})[_0x2caf('0x19')](function(_0x58c736){_0x274b11(_0x199d4e[_0x2caf('0x1a')](0x1f4,_0x58c736[_0x2caf('0x1b')]));});});}};var _0x102599=jayson['server'](_0x314486)[_0x2caf('0x86')]();_0x102599['on'](_0x2caf('0x1a'),function(_0x511202){return _0xc44e4e(_0x511202);});_0x102599[_0x2caf('0x87')](0x232a,_0x2caf('0x88'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x599ce7(_0x2caf('0x89')+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 c6d68d6..2324842 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 _0x9c44=['','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','destcalleridnum','push','format','name','trigger:%s','action','merge','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','socket.io-emitter','info','[CM][%s][%s]','stringify','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','firstName','lastName','mobile','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridnum','calleridname'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0x49c4('0x0'));var util=require(_0x49c4('0x1'));var config=require(_0x49c4('0x2'));var logger=require(_0x49c4('0x3'))(_0x49c4('0x4'));var cmContactRpc=require(_0x49c4('0x5'));config['redis']=_['defaults'](config[_0x49c4('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x7'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x69bc41,_0x2c4e2e,_0x436234,_0x511d53,_0x11c586){logger[_0x49c4('0x8')](_0x49c4('0x9'),_0x69bc41,_0x2c4e2e['id'],_0x436234,_0x511d53,JSON[_0x49c4('0xa')](_0x11c586));io['to'](_0x436234)['emit'](_0x511d53,_0x11c586);}exports['exec']=function(_0x451ea6,_0x313e73,_0x58cad7,_0xb611a1){var _0x459d09,_0x4adb3c;var _0x536d42={};var _0x1d19bf=Number(_0x58cad7[_0x49c4('0xb')]);var _0x5487cd=_0x58cad7[_0x49c4('0xc')]?Boolean(Number(_0x58cad7[_0x49c4('0xc')])):![];var _0x5f2fd9;var _0x1909fe=![];if(!_[_0x49c4('0xd')](_0x58cad7[_0x49c4('0xe')])){if(_0x58cad7[_0x49c4('0xe')]=='1')_0x1909fe=!![];}if(!_0x1909fe){if(_0xb611a1[_0x49c4('0xf')]){_0x536d42['id']=_0xb611a1[_0x49c4('0xf')];}}if(!_0x536d42['id']){_0x536d42[_0x49c4('0x10')]=_0x1d19bf;_0x5f2fd9=_0x58cad7[_0x49c4('0x11')]&&_0x58cad7['data3']!=='0'?_0x58cad7[_0x49c4('0x11')][_0x49c4('0x12')](','):[_0x49c4('0x13')];_0x536d42[_0x49c4('0x14')]=_[_0x49c4('0x15')](_0x5f2fd9,function(_0x53e3a2){var _0x44e607={};_0x44e607[_0x53e3a2]=_0xb611a1[_0x49c4('0x16')]?_0xb611a1['destcalleridnum']:_0xb611a1['calleridnum'];return _0x44e607;});}var _0x3c782d=['id',_0x49c4('0x17'),_0x49c4('0x18'),'phone',_0x49c4('0x19'),'fax',_0x49c4('0x10'),_0x49c4('0x1a'),_0x49c4('0x1b'),_0x49c4('0x1c')];var _0x382040=_[_0x49c4('0x1d')](_0x3c782d,_0x5f2fd9);BPromise[_0x49c4('0x1e')]()[_0x49c4('0x1f')](cmContactRpc[_0x49c4('0x20')]({'attributes':_0x382040,'where':_0x536d42}))['then'](function(_0x527126){_0x4adb3c=_0x527126;if(!_['isEmpty'](_0x4adb3c)){if(_0x4adb3c[_0x49c4('0x21')]===0x1){_0x459d09=_0x4adb3c[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0xb611a1[_0x49c4('0x22')],_0x313e73['id'],_0x459d09['id']);}else{logger[_0x49c4('0x8')](_0x49c4('0x23'),_0xb611a1[_0x49c4('0x22')],_0x313e73['id'],_['map'](_0x4adb3c,'id')['join'](','));}return;}else{logger[_0x49c4('0x8')](_0x49c4('0x24'),_0xb611a1['uniqueid'],_0x313e73['id']);var _0x207358={'ListId':_0x1d19bf};var _0x43e014=_0x58cad7[_0x49c4('0x25')]&&_0x58cad7[_0x49c4('0x25')]!=='0'?_0x58cad7['data4']:'phone';if(_0x5487cd){logger[_0x49c4('0x8')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0xb611a1[_0x49c4('0x22')],_0x313e73['id']);_0x207358[_0x43e014]=_[_0x49c4('0xd')](_0xb611a1[_0x49c4('0x16')])?_0xb611a1[_0x49c4('0x26')]:_0xb611a1['destcalleridnum'];if(_[_0x49c4('0xd')](_0xb611a1[_0x49c4('0x16')])){_0x207358[_0x49c4('0x17')]=_0xb611a1[_0x49c4('0x27')]&&_0xb611a1[_0x49c4('0x27')]!==_0x49c4('0x28')?_0xb611a1[_0x49c4('0x27')]:_0x49c4('0x29');}else{_0x207358[_0x49c4('0x17')]=_0xb611a1[_0x49c4('0x2a')]&&_0xb611a1[_0x49c4('0x2a')]!==''?_0xb611a1['destcalleridname']:'Unknown';}return BPromise[_0x49c4('0x1e')]()[_0x49c4('0x1f')](cmContactRpc[_0x49c4('0x2b')](_0x207358))[_0x49c4('0x1f')](function(_0x28eb47){_0x459d09=_0x28eb47;_0x4adb3c['push'](_0x28eb47);if(_0x459d09){logger[_0x49c4('0x8')](_0x49c4('0x2c'),_0xb611a1[_0x49c4('0x22')],_0x313e73['id'],_0x459d09['id']);}return;});}else{logger[_0x49c4('0x8')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0xb611a1['uniqueid'],_0x313e73['id']);_0x207358[_0x43e014]=_[_0x49c4('0xd')](_0xb611a1[_0x49c4('0x16')])?_0xb611a1[_0x49c4('0x26')]:_0xb611a1[_0x49c4('0x2d')];if(_[_0x49c4('0xd')](_0xb611a1['routeId'])){_0x207358[_0x49c4('0x17')]=_0xb611a1[_0x49c4('0x27')]&&_0xb611a1[_0x49c4('0x27')]!==''?_0xb611a1['calleridname']:_0x49c4('0x29');}else{_0x207358[_0x49c4('0x17')]=_0xb611a1[_0x49c4('0x2a')]&&_0xb611a1[_0x49c4('0x2a')]!==_0x49c4('0x28')?_0xb611a1[_0x49c4('0x2a')]:_0x49c4('0x29');}_0x459d09=_0x207358;_0x4adb3c[_0x49c4('0x2e')](_0x207358);return;}}})[_0x49c4('0x1f')](function(){if(_0x451ea6){emit(_0xb611a1['uniqueid'],_0x313e73,util[_0x49c4('0x2f')]('user:%s',_0x451ea6[_0x49c4('0x30')]),util[_0x49c4('0x2f')](_0x49c4('0x31'),_0x58cad7[_0x49c4('0x32')]['toLowerCase']()),{'evt':_[_0x49c4('0x33')](_0xb611a1,{'autoCreate':_0x5487cd}),'contact':_0x459d09===undefined?{}:_0x459d09,'contacts':_0x4adb3c[_0x49c4('0x21')]===0x0?undefined:_0x4adb3c});}});}; \ No newline at end of file +var _0x207c=['defaults','redis','info','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','action','merge','length','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact'];(function(_0x58e8cf,_0x16ff42){var _0x1baba0=function(_0x538707){while(--_0x538707){_0x58e8cf['push'](_0x58e8cf['shift']());}};_0x1baba0(++_0x16ff42);}(_0x207c,0x1e8));var _0xc207=function(_0x3e6aed,_0x97a2f1){_0x3e6aed=_0x3e6aed-0x0;var _0x3220dd=_0x207c[_0x3e6aed];return _0x3220dd;};'use strict';var _=require('lodash');var BPromise=require(_0xc207('0x0'));var Redis=require(_0xc207('0x1'));var util=require(_0xc207('0x2'));var config=require(_0xc207('0x3'));var logger=require(_0xc207('0x4'))(_0xc207('0x5'));var cmContactRpc=require(_0xc207('0x6'));config['redis']=_[_0xc207('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc207('0x8')]));function emit(_0x314561,_0x3395e4,_0x59ff6f,_0x25cb97,_0xad159b){logger[_0xc207('0x9')]('[CM][%s][%s]',_0x314561,_0x3395e4['id'],_0x59ff6f,_0x25cb97,JSON[_0xc207('0xa')](_0xad159b));io['to'](_0x59ff6f)[_0xc207('0xb')](_0x25cb97,_0xad159b);}exports[_0xc207('0xc')]=function(_0x13ec41,_0x201162,_0x347549,_0x487d95){var _0x574425,_0x5b556f;var _0x19b297={};var _0x491062=Number(_0x347549[_0xc207('0xd')]);var _0x2782ce=_0x347549['data2']?Boolean(Number(_0x347549[_0xc207('0xe')])):![];var _0xb86b06;var _0x3062f5=![];if(!_[_0xc207('0xf')](_0x347549[_0xc207('0x10')])){if(_0x347549['data5']=='1')_0x3062f5=!![];}if(!_0x3062f5){if(_0x487d95[_0xc207('0x11')]){_0x19b297['id']=_0x487d95[_0xc207('0x11')];}}if(!_0x19b297['id']){_0x19b297[_0xc207('0x12')]=_0x491062;_0xb86b06=_0x347549[_0xc207('0x13')]&&_0x347549['data3']!=='0'?_0x347549['data3']['split'](','):[_0xc207('0x14')];_0x19b297[_0xc207('0x15')]=_[_0xc207('0x16')](_0xb86b06,function(_0x65f539){var _0x4b8f44={};_0x4b8f44[_0x65f539]=_0x487d95[_0xc207('0x17')]?_0x487d95[_0xc207('0x18')]:_0x487d95[_0xc207('0x19')];return _0x4b8f44;});}var _0x5f288e=['id',_0xc207('0x1a'),'lastName',_0xc207('0x14'),_0xc207('0x1b'),_0xc207('0x1c'),_0xc207('0x12'),_0xc207('0x1d'),_0xc207('0x1e'),_0xc207('0x1f')];var _0x464dea=_[_0xc207('0x20')](_0x5f288e,_0xb86b06);BPromise[_0xc207('0x21')]()[_0xc207('0x22')](cmContactRpc[_0xc207('0x23')]({'attributes':_0x464dea,'where':_0x19b297}))[_0xc207('0x22')](function(_0x4b52a7){_0x5b556f=_0x4b52a7;if(!_[_0xc207('0x24')](_0x5b556f)){if(_0x5b556f['length']===0x1){_0x574425=_0x5b556f[0x0];logger[_0xc207('0x9')](_0xc207('0x25'),_0x487d95[_0xc207('0x26')],_0x201162['id'],_0x574425['id']);}else{logger[_0xc207('0x9')](_0xc207('0x27'),_0x487d95[_0xc207('0x26')],_0x201162['id'],_[_0xc207('0x16')](_0x5b556f,'id')[_0xc207('0x28')](','));}return;}else{logger[_0xc207('0x9')](_0xc207('0x29'),_0x487d95[_0xc207('0x26')],_0x201162['id']);var _0x27df03={'ListId':_0x491062};var _0x3f738e=_0x347549[_0xc207('0x2a')]&&_0x347549[_0xc207('0x2a')]!=='0'?_0x347549['data4']:_0xc207('0x14');if(_0x2782ce){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x487d95[_0xc207('0x26')],_0x201162['id']);_0x27df03[_0x3f738e]=_[_0xc207('0xf')](_0x487d95[_0xc207('0x17')])?_0x487d95[_0xc207('0x19')]:_0x487d95[_0xc207('0x18')];if(_['isNil'](_0x487d95[_0xc207('0x17')])){_0x27df03[_0xc207('0x1a')]=_0x487d95[_0xc207('0x2b')]&&_0x487d95[_0xc207('0x2b')]!==_0xc207('0x2c')?_0x487d95[_0xc207('0x2b')]:_0xc207('0x2d');}else{_0x27df03[_0xc207('0x1a')]=_0x487d95[_0xc207('0x2e')]&&_0x487d95[_0xc207('0x2e')]!==_0xc207('0x2c')?_0x487d95[_0xc207('0x2e')]:_0xc207('0x2d');}return BPromise['resolve']()[_0xc207('0x22')](cmContactRpc[_0xc207('0x2f')](_0x27df03))[_0xc207('0x22')](function(_0x448df1){_0x574425=_0x448df1;_0x5b556f[_0xc207('0x30')](_0x448df1);if(_0x574425){logger[_0xc207('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x487d95[_0xc207('0x26')],_0x201162['id'],_0x574425['id']);}return;});}else{logger[_0xc207('0x9')](_0xc207('0x31'),_0x487d95[_0xc207('0x26')],_0x201162['id']);_0x27df03[_0x3f738e]=_['isNil'](_0x487d95[_0xc207('0x17')])?_0x487d95[_0xc207('0x19')]:_0x487d95[_0xc207('0x18')];if(_[_0xc207('0xf')](_0x487d95[_0xc207('0x17')])){_0x27df03[_0xc207('0x1a')]=_0x487d95[_0xc207('0x2b')]&&_0x487d95[_0xc207('0x2b')]!==_0xc207('0x2c')?_0x487d95['calleridname']:'Unknown';}else{_0x27df03[_0xc207('0x1a')]=_0x487d95[_0xc207('0x2e')]&&_0x487d95[_0xc207('0x2e')]!==_0xc207('0x2c')?_0x487d95['destcalleridname']:_0xc207('0x2d');}_0x574425=_0x27df03;_0x5b556f[_0xc207('0x30')](_0x27df03);return;}}})[_0xc207('0x22')](function(){if(_0x13ec41){emit(_0x487d95[_0xc207('0x26')],_0x201162,util[_0xc207('0x32')]('user:%s',_0x13ec41[_0xc207('0x33')]),util[_0xc207('0x32')]('trigger:%s',_0x347549[_0xc207('0x34')]['toLowerCase']()),{'evt':_[_0xc207('0x35')](_0x487d95,{'autoCreate':_0x2782ce}),'contact':_0x574425===undefined?{}:_0x574425,'contacts':_0x5b556f[_0xc207('0x36')]===0x0?undefined:_0x5b556f});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 282476f..7fd9541 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 _0x66fa=['checkConditions','channel','AnyConditions','some','field','account','chat','value','ChatWebsiteId','upperFirst','AccountId','operator','interaction','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','created','exports','util','lodash','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../ami','redis','defaults','localhost','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','accounts','freshdeskAccounts','deskAccounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','emit','info','stringify','prototype','clone','undefined','motionChannel','voice','syncAgentDial','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','action','contactmanager','browser','popup','TemplateId','data2','render','html','template\x20not\x20found','url','uri','isNil','data3','uriLocation','data4','windowWidth','data5','800','windowHeight','data6','winapp','winApplication','format','user:%s','trigger:%s:%s','toLowerCase','data1','trigger:%s','exec','integration','queue','routeId','urlforward','script','buildUri','parse','query','search','AllConditions'];(function(_0x28766c,_0x10024b){var _0x5b1f54=function(_0x234128){while(--_0x234128){_0x28766c['push'](_0x28766c['shift']());}};_0x5b1f54(++_0x10024b);}(_0x66fa,0x117));var _0xa66f=function(_0x10e0d0,_0x99ef12){_0x10e0d0=_0x10e0d0-0x0;var _0x24ba22=_0x66fa[_0x10e0d0];return _0x24ba22;};'use strict';var util=require(_0xa66f('0x0'));var _=require(_0xa66f('0x1'));var url=require('url');var Mustache=require(_0xa66f('0x2'));var Redis=require(_0xa66f('0x3'));var urlforward=require(_0xa66f('0x4'));var integration=require(_0xa66f('0x5'));var cmContact=require(_0xa66f('0x6'));var script=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var logger=require('../../../config/logger')('trigger');var ami=require(_0xa66f('0x9'));config[_0xa66f('0xa')]=_[_0xa66f('0xb')](config[_0xa66f('0xa')],{'host':_0xa66f('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa66f('0xa')]));var operators={'equals':function(_0x4f6717,_0x46c788){return _0x4f6717==_0x46c788;},'not_equals':function(_0x597c7c,_0x101e10){return _0x597c7c!=_0x101e10;}};var barAndWebActions=['popup','url','winapp'];function Trigger(_0x1e1997){this[_0xa66f('0xd')]=_0x1e1997['triggers'];this[_0xa66f('0xe')]=_0x1e1997['agents'];this[_0xa66f('0xf')]=_0x1e1997['voiceQueues'];this[_0xa66f('0x10')]=_0x1e1997[_0xa66f('0x10')];this[_0xa66f('0x11')]=_0x1e1997['voiceExtensions'];this['zendeskAccounts']=_0x1e1997[_0xa66f('0x12')];this['freshdeskAccounts']=_0x1e1997['freshdeskAccounts'];this['salesforceAccounts']=_0x1e1997[_0xa66f('0x13')];this[_0xa66f('0x14')]=_0x1e1997[_0xa66f('0x14')];this[_0xa66f('0x15')]=_0x1e1997[_0xa66f('0x15')];this['deskAccounts']=_0x1e1997['deskAccounts'];this[_0xa66f('0x16')]=_0x1e1997[_0xa66f('0x16')];this[_0xa66f('0x17')]=_0x1e1997[_0xa66f('0x17')];this['dynamics365Accounts']=_0x1e1997[_0xa66f('0x18')];this['freshsalesAccounts']=_0x1e1997['freshsalesAccounts'];this[_0xa66f('0x19')]={'zendesk':this[_0xa66f('0x12')],'salesforce':this[_0xa66f('0x13')],'freshdesk':this[_0xa66f('0x1a')],'sugarcrm':this[_0xa66f('0x14')],'zoho':this[_0xa66f('0x15')],'desk':this[_0xa66f('0x1b')],'vtiger':this[_0xa66f('0x16')],'dynamics365':this[_0xa66f('0x18')],'freshsales':this[_0xa66f('0x1c')],'servicenow':this[_0xa66f('0x17')]};ami['on'](_0xa66f('0x1d'),this[_0xa66f('0x1e')][_0xa66f('0x1f')](this));ami['on'](_0xa66f('0x20'),this['syncCustomEvent'][_0xa66f('0x1f')](this));ami['on'](_0xa66f('0x21'),this[_0xa66f('0x1e')][_0xa66f('0x1f')](this));ami['on']('custom:agentcomplete',this[_0xa66f('0x1e')][_0xa66f('0x1f')](this));ami['on'](_0xa66f('0x22'),this[_0xa66f('0x1e')]['bind'](this));ami['on']('custom:agentnoanswer',this[_0xa66f('0x1e')]['bind'](this));ami['on'](_0xa66f('0x23'),this[_0xa66f('0x1e')][_0xa66f('0x1f')](this));ami['on']('custom:agentcongestion',this[_0xa66f('0x1e')][_0xa66f('0x1f')](this));ami['on'](_0xa66f('0x24'),this[_0xa66f('0x1e')][_0xa66f('0x1f')](this));ami['on'](_0xa66f('0x25'),this[_0xa66f('0x1e')][_0xa66f('0x1f')](this));ami['on'](_0xa66f('0x26'),this[_0xa66f('0x1e')][_0xa66f('0x1f')](this));ami['on'](_0xa66f('0x27'),this[_0xa66f('0x1e')][_0xa66f('0x1f')](this));ami['on']('custom:dialbegin',this['syncAgentDial'][_0xa66f('0x1f')](this));ami['on'](_0xa66f('0x28'),this['syncAgentDial'][_0xa66f('0x1f')](this));ami['on'](_0xa66f('0x29'),this['syncAgentDial'][_0xa66f('0x1f')](this));ami['on'](_0xa66f('0x2a'),this[_0xa66f('0x1e')][_0xa66f('0x1f')](this));ami['on'](_0xa66f('0x2b'),this['syncCustomEvent'][_0xa66f('0x1f')](this));ami['on']('custom:substatus',this[_0xa66f('0x1e')][_0xa66f('0x1f')](this));ami['on'](_0xa66f('0x2c'),this['syncCustomEvent'][_0xa66f('0x1f')](this));ami['on'](_0xa66f('0x2d'),this['syncCustomEvent'][_0xa66f('0x1f')](this));ami['on'](_0xa66f('0x2e'),this[_0xa66f('0x1e')][_0xa66f('0x1f')](this));ami['on'](_0xa66f('0x2f'),this[_0xa66f('0x1e')][_0xa66f('0x1f')](this));ami['on'](_0xa66f('0x30'),this[_0xa66f('0x1e')][_0xa66f('0x1f')](this));}Trigger['prototype'][_0xa66f('0x31')]=function(_0x5bf736,_0x1c7eda,_0x46f6cc){logger[_0xa66f('0x32')](_0x5bf736,_0x1c7eda,JSON[_0xa66f('0x33')](_0x46f6cc));io['to'](_0x5bf736)[_0xa66f('0x31')](_0x1c7eda,_0x46f6cc);};Trigger[_0xa66f('0x34')][_0xa66f('0x1e')]=function(_0xcee582){var _0x54d740=_[_0xa66f('0x35')](_0xcee582);if(typeof _0x54d740['motionChannel']===_0xa66f('0x36')){_0x54d740[_0xa66f('0x37')]=_0xa66f('0x38');}this['checkTriggers'](_0x54d740);};Trigger['prototype'][_0xa66f('0x39')]=function(_0x4214db){if(this[_0xa66f('0xe')][_0x4214db[_0xa66f('0x3a')]]){this[_0xa66f('0x1e')](_0x4214db);}};Trigger['prototype']['checkTriggers']=function(_0x49b869){var _0x30f7de;for(var _0x4aeeb4 in this['triggers']){if(this['triggers'][_0xa66f('0x3b')](_0x4aeeb4)){if(this['triggers'][_0x4aeeb4][_0xa66f('0x3c')]){_0x30f7de=this[_0xa66f('0x3d')](this[_0xa66f('0xd')][_0x4aeeb4],_0x49b869);if(_0x30f7de){_[_0xa66f('0x3e')](_0x49b869,_0x49b869[_0xa66f('0x3f')]);for(var _0x360e61=0x0,_0x192033,_0x261089,_0x32ba8b;_0x360e610x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x35f8a2,_0x1a85c7){var _0x46ebfe=function(_0x1fe50d){while(--_0x1fe50d){_0x35f8a2['push'](_0x35f8a2['shift']());}};_0x46ebfe(++_0x1a85c7);}(_0x3e74,0x175));var _0x43e7=function(_0x22154d,_0x14382d){_0x22154d=_0x22154d-0x0;var _0x1272da=_0x3e74[_0x22154d];return _0x1272da;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ 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 a8062d1..e2ce6c5 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 _0xd56c=['%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','string','picklist','type','nameField','idField','indexOf','content','ticketType','incident','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','queue','callDirection','phonecalls','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','userEmail','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','userId','toLowerCase','outbound','calleridnum','contacts','headers','substring','enduserId','destcalleridnum','replace'];(function(_0x2d7a07,_0x55c136){var _0x90f5a9=function(_0x55cb45){while(--_0x55cb45){_0x2d7a07['push'](_0x2d7a07['shift']());}};_0x90f5a9(++_0x55c136);}(_0xd56c,0x106));var _0xcd56=function(_0xf40f8,_0x594f30){_0xf40f8=_0xf40f8-0x0;var _0x1ac5b6=_0xd56c[_0xf40f8];return _0x1ac5b6;};'use strict';var _=require(_0xcd56('0x0'));var BPromise=require(_0xcd56('0x1'));var rp=require('request-promise');var util=require(_0xcd56('0x2'));var intUtil=require(_0xcd56('0x3'));var md5=require(_0xcd56('0x4'));var Redis=require(_0xcd56('0x5'));var logger=require(_0xcd56('0x6'))('dynamics365');var config=require(_0xcd56('0x7'));config[_0xcd56('0x8')]=_[_0xcd56('0x9')](config['redis'],{'host':_0xcd56('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcd56('0x8')]));function getAuthToken(_0x227380,_0x4bc9f4,_0x546fac){var _0x3c494a={'method':_0xcd56('0xb'),'uri':_0x4bc9f4,'form':{'client_id':_0x227380[_0xcd56('0xc')],'resource':_0x227380[_0xcd56('0xd')],'username':_0x227380[_0xcd56('0xe')],'password':_0x227380[_0xcd56('0xf')],'grant_type':_0xcd56('0xf'),'client_secret':_0x227380[_0xcd56('0x10')]},'json':!![]};return rp(_0x3c494a)[_0xcd56('0x11')](function(_0x10060c){return _0x10060c[_0xcd56('0x12')];})[_0xcd56('0x13')](function(_0x641aa){logger['error']('['+[_0x546fac[_0xcd56('0x14')]()]+_0xcd56('0x15'));return _0x641aa[_0xcd56('0x16')];});}function getUser(_0x54e255,_0x837b8c,_0x4f98ab,_0xea2293,_0x4c4185,_0x23fe87){return new BPromise(function(_0x24381d,_0x478f2e){return getAuthToken(_0x837b8c,_0xea2293,_0x23fe87)[_0xcd56('0x11')](function(_0x3c0dd6){var _0x2d020b={'method':'GET','uri':_0x4c4185+_0xcd56('0x17'),'headers':{'Authorization':_0xcd56('0x18')+_0x3c0dd6,'OData-Version':_0xcd56('0x19')},'json':!![]};return rp(_0x2d020b);})[_0xcd56('0x11')](function(_0x40b469){var _0x228a34=_0x40b469[_0xcd56('0x1a')];var _0x1eb126=![];var _0x13d833=null;if(!_[_0xcd56('0x1b')](_0x4f98ab)){if(intUtil['validateEmail'](_0x4f98ab[_0xcd56('0x1c')])){_0x54e255[_0xcd56('0x1d')]=_0x4f98ab['email'];for(_0x13d833=0x0;_0x13d833<_0x228a34['length'];_0x13d833++){if(_0x228a34[_0x13d833][_0xcd56('0x1e')]===_0x4f98ab[_0xcd56('0x1c')]&&!_0x228a34[_0x13d833][_0xcd56('0x1f')]){_0x1eb126=!![];logger['info']('['+[_0x23fe87[_0xcd56('0x14')]()]+_0xcd56('0x20')+_0x228a34[_0x13d833][_0xcd56('0x21')]+'!');_0x54e255['userId']=_0x228a34[_0x13d833][_0xcd56('0x21')];}}}}if(!_0x1eb126){logger[_0xcd56('0x22')]('['+[_0x23fe87[_0xcd56('0x14')]()]+_0xcd56('0x23'));_0x54e255[_0xcd56('0x1d')]=_0x837b8c[_0xcd56('0xe')];for(_0x13d833=0x0;_0x13d833<_0x228a34[_0xcd56('0x24')];_0x13d833++){if(_0x228a34[_0x13d833][_0xcd56('0x1e')]===_0x837b8c[_0xcd56('0xe')]){_0x54e255[_0xcd56('0x25')]=_0x228a34[_0x13d833][_0xcd56('0x21')];}}}_0x24381d(_0x54e255);})[_0xcd56('0x13')](function(_0x3edede){_0x478f2e(_0x3edede[_0xcd56('0x16')]);});});}function createEndUser(_0x1f9538,_0x565482,_0x5a9f12,_0x2d9056,_0xb29b8d,_0x16c278){return new BPromise(function(_0x3ceec1,_0x4bf611){return getAuthToken(_0x565482,_0x5a9f12,_0x16c278)[_0xcd56('0x11')](function(_0xa77c88){var _0x3fe59e=_0x16c278[_0xcd56('0x26')]()===_0xcd56('0x27')?_0xb29b8d['destcalleridnum']:_0xb29b8d[_0xcd56('0x28')];var _0x44d8c9={'method':'POST','uri':_0x2d9056+_0xcd56('0x29'),'body':{'telephone1':_0x3fe59e,'fullname':_0x3fe59e,'firstname':_0x3fe59e,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x1f9538[_0xcd56('0x25')]+')'},'headers':{'Authorization':_0xcd56('0x18')+_0xa77c88,'OData-Version':_0xcd56('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x44d8c9);})['then'](function(_0x346b0c){var _0x53af9a=_0x346b0c[_0xcd56('0x2a')]['odata-entityid'];var _0xcd38dc=_0x53af9a[_0xcd56('0x2b')](_0x53af9a['lastIndexOf']('(')+0x1,_0x53af9a['lastIndexOf'](')'));_0x1f9538[_0xcd56('0x2c')]=_0xcd38dc;_0x3ceec1(_0x1f9538);})[_0xcd56('0x13')](function(_0x555c6d){_0x4bf611(_0x555c6d[_0xcd56('0x16')]);});});}function getEndUser(_0x10d49e,_0xf3203e,_0x268228,_0xdd672c,_0x4ed819,_0x1032ca,_0x14401a){var _0x4d9f05=_0x1032ca[_0xcd56('0x26')]()===_0xcd56('0x27')?_0x4ed819[_0xcd56('0x2d')]:_0x4ed819[_0xcd56('0x28')];return getAuthToken(_0xf3203e,_0x268228,_0x1032ca)[_0xcd56('0x11')](function(_0x24cbc0){var _0x8f5057={'method':'GET','uri':_0xdd672c+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x4d9f05[_0xcd56('0x2e')]('+',_0xcd56('0x2f'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x24cbc0,'If-None-Match':null,'OData-Version':_0xcd56('0x19')},'json':!![]};return rp(_0x8f5057);})[_0xcd56('0x11')](function(_0x5a3b30){var _0x3a6fb4=![];if(!_0x5a3b30)return _0x3a6fb4;var _0x886fea=_0x5a3b30[_0xcd56('0x1a')];for(var _0x53f520=0x0;_0x53f520<_0x886fea['length'];_0x53f520++){if(_0x886fea[_0x53f520]['telephone1']===_0x4d9f05){_0x3a6fb4=!![];_0x10d49e[_0xcd56('0x2c')]=_0x886fea[_0x53f520][_0xcd56('0x30')];}}return _0x3a6fb4;})[_0xcd56('0x11')](function(_0x72df8e){if(_0x72df8e)return _0x10d49e;if(_0x14401a===_0xcd56('0x31')){logger[_0xcd56('0x22')]('['+[_0x1032ca['toUpperCase']()]+_0xcd56('0x32'));return _0x10d49e;}return createEndUser(_0x10d49e,_0xf3203e,_0x268228,_0xdd672c,_0x4ed819,_0x1032ca)[_0xcd56('0x11')](function(_0x4424ab){logger[_0xcd56('0x22')]('['+[_0x1032ca[_0xcd56('0x14')]()]+_0xcd56('0x33'),_0x4424ab[_0xcd56('0x2c')]);return _0x4424ab;});});}function getCustomFields(_0xbb5c76,_0x533a33,_0x5c2868){var _0x59f8aa={};if(_0xbb5c76['length']>0x0){_['forEach'](_0xbb5c76,function(_0x38cb05){if(_[_0xcd56('0x34')]([_0xcd56('0x35'),_0xcd56('0x36')],_0x38cb05[_0xcd56('0x37')])&&_0x38cb05[_0xcd56('0x38')]&&!_0x38cb05['customField']){var _0x244d3f=_0x38cb05[_0xcd56('0x39')][_0xcd56('0x26')]();var _0x6fe105=_0x244d3f[_0xcd56('0x2b')](0x0,_0x244d3f[_0xcd56('0x3a')]('_'));var _0x3a686c=_0x244d3f[_0xcd56('0x2b')](_0x244d3f[_0xcd56('0x3a')]('_')+0x1);if(_0x6fe105===_0x5c2868){_0x59f8aa[_0x3a686c]=_0x38cb05[_0xcd56('0x3b')];}}});}return _0x59f8aa;}function getTicket(_0xab5ec3,_0x18c21f,_0x415d69,_0xd62d8d,_0x438fc3,_0x247b41,_0x1a0b14){return new BPromise(function(_0x33b5ea,_0x304377){var _0x3bd040;return getAuthToken(_0x18c21f,_0x415d69,_0x1a0b14)['then'](function(_0x3863b4){if(_0x247b41[_0xcd56('0x3c')]===_0xcd56('0x3d')){_0x3bd040={'method':_0xcd56('0xb'),'uri':_0xd62d8d+'incidents','body':Object[_0xcd56('0x3e')]({},{'title':intUtil[_0xcd56('0x3f')](_0x247b41[_0xcd56('0x40')],_0x438fc3,'\x20'),'description':intUtil[_0xcd56('0x3f')](_0x247b41[_0xcd56('0x41')],_0x438fc3,'\x0a'),'customerid_contact@odata.bind':_0xab5ec3['enduserId']?_0xcd56('0x42')+_0xab5ec3[_0xcd56('0x2c')]+')':undefined,'ownerid@odata.bind':_0xcd56('0x43')+_0xab5ec3['userId']+')','caseorigincode':'1'},getCustomFields(_0x247b41[_0xcd56('0x44')],_0x438fc3,_0x247b41[_0xcd56('0x3c')])),'headers':{'Authorization':'Bearer\x20'+_0x3863b4,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x247b41['ticketType']===_0xcd56('0x45')){var _0x40cedc=_0xab5ec3[_0xcd56('0x2c')]?[{'partyid_systemuser@odata.bind':_0xcd56('0x43')+_0xab5ec3[_0xcd56('0x25')]+')','participationtypemask':_0xab5ec3['callDirection']===_0xcd56('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0xcd56('0x42')+_0xab5ec3[_0xcd56('0x2c')]+')','participationtypemask':_0xab5ec3[_0xcd56('0x47')]===_0xcd56('0x46')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xcd56('0x43')+_0xab5ec3[_0xcd56('0x25')]+')','participationtypemask':_0xab5ec3[_0xcd56('0x47')]===_0xcd56('0x46')?0x2:0x1}];_0x3bd040={'method':_0xcd56('0xb'),'uri':_0xd62d8d+_0xcd56('0x48'),'body':Object['assign']({},{'subject':intUtil[_0xcd56('0x3f')](_0x247b41[_0xcd56('0x40')],_0x438fc3,'\x20'),'phonenumber':String(_0x438fc3[_0xcd56('0x28')]),'description':intUtil[_0xcd56('0x3f')](_0x247b41[_0xcd56('0x41')],_0x438fc3,'\x0a'),'regardingobjectid_contact@odata.bind':_0xab5ec3[_0xcd56('0x2c')]?_0xcd56('0x42')+_0xab5ec3[_0xcd56('0x2c')]+')':undefined,'ownerid@odata.bind':_0xcd56('0x43')+_0xab5ec3[_0xcd56('0x25')]+')','directioncode':_0xab5ec3[_0xcd56('0x47')]===_0xcd56('0x46')?![]:!![],'phonecall_activity_parties':_0x40cedc},getCustomFields(_0x247b41[_0xcd56('0x44')],_0x438fc3,_0x247b41['ticketType'])),'headers':{'Authorization':_0xcd56('0x18')+_0x3863b4,'OData-Version':_0xcd56('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3bd040);})['then'](function(_0x519bce){var _0x61bb1c=_0x519bce['headers'][_0xcd56('0x49')];var _0x5d4bc9=_0x61bb1c[_0xcd56('0x2b')](_0x61bb1c['lastIndexOf']('(')+0x1,_0x61bb1c['lastIndexOf'](')'));_0xab5ec3[_0xcd56('0x4a')]=_0x5d4bc9;_0x33b5ea(_0xab5ec3);})[_0xcd56('0x13')](function(_0x424f64){_0x304377(_0x424f64[_0xcd56('0x16')]);});});}function emit(_0x2f1387,_0x51b9c6,_0x29b0e0,_0xfc9d8a){var _0x49a4e5={'uri':util[_0xcd56('0x4b')](_0xcd56('0x4c'),_0x2f1387,_0x29b0e0,_0xfc9d8a)};io['to'](util[_0xcd56('0x4b')](_0xcd56('0x4d'),_0x51b9c6))[_0xcd56('0x4e')](_0xcd56('0x4f'),_0x49a4e5);}exports['cs']=function(_0x3f2fb2,_0x20649b,_0x2c3408,_0x1875ae,_0x297c18,_0x344744,_0x46ee61,_0x1c95c6){var _0x18c28c={};_0x344744[_0xcd56('0xd')]=intUtil[_0xcd56('0x50')](_0x344744[_0xcd56('0xd')]);_0x344744[_0xcd56('0x51')]=intUtil[_0xcd56('0x50')](_0x344744[_0xcd56('0x51')]);_0x18c28c[_0xcd56('0x47')]=_0x1c95c6===_0xcd56('0x46')||_0x1c95c6===_0xcd56('0x52')?'queue':'outbound';var _0x238b11=util[_0xcd56('0x4b')](_0xcd56('0x53'),_0x344744[_0xcd56('0xd')]);var _0xa3d4f0=util['format'](_0xcd56('0x54'),_0x344744[_0xcd56('0x55')]);var _0x47c3ed=util['format'](_0xcd56('0x56'),_0x344744[_0xcd56('0x51')],_0x20649b[_0xcd56('0x57')],md5(_0x20649b[_0xcd56('0x57')]));if(_0x297c18&&_0x297c18[_0xcd56('0x58')]){logger[_0xcd56('0x22')](_0xcd56('0x59'),_0xcd56('0x5a'));_0x20649b['recordingURL']=_0x47c3ed;}else if(_0x46ee61&&_0x46ee61[_0xcd56('0x5b')]&&_0x46ee61[_0xcd56('0x5b')]!=='none'){logger[_0xcd56('0x22')](_0xcd56('0x5c'),_0xcd56('0x5a'));_0x20649b[_0xcd56('0x5d')]=_0x47c3ed;}else{_0x20649b[_0xcd56('0x5d')]='';}return getUser(_0x18c28c,_0x344744,_0x1875ae,_0xa3d4f0,_0x238b11,_0x1c95c6)[_0xcd56('0x11')](function(_0x2e10f7){logger[_0xcd56('0x22')]('['+_0x1c95c6['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x2e10f7[_0xcd56('0x25')]);logger[_0xcd56('0x22')]('['+_0x1c95c6[_0xcd56('0x14')]()+_0xcd56('0x5e'),_0x2e10f7['userEmail']);return getEndUser(_0x2e10f7,_0x344744,_0xa3d4f0,_0x238b11,_0x20649b,_0x1c95c6,_0x2c3408[_0xcd56('0x5f')]);})[_0xcd56('0x11')](function(_0x594a36){logger['info']('['+_0x1c95c6[_0xcd56('0x14')]()+_0xcd56('0x60'),_0x594a36[_0xcd56('0x2c')]);logger[_0xcd56('0x22')]('['+_0x1c95c6['toUpperCase']()+_0xcd56('0x61'),_0x20649b['calleridnum']);return getTicket(_0x594a36,_0x344744,_0xa3d4f0,_0x238b11,_0x20649b,_0x2c3408,_0x1c95c6);})[_0xcd56('0x11')](function(_0x22957d){logger[_0xcd56('0x22')](util['format']('['+_0x1c95c6[_0xcd56('0x14')]()+_0xcd56('0x62'),_0x2c3408[_0xcd56('0x3c')],_0x22957d[_0xcd56('0x4a')]));logger[_0xcd56('0x22')](util[_0xcd56('0x4b')]('['+_0x1c95c6[_0xcd56('0x14')]()+_0xcd56('0x63'),_0x1c95c6));if(_0x1c95c6!==_0xcd56('0x52')){logger['info']('['+_0x1c95c6[_0xcd56('0x14')]()+']',_0xcd56('0x64'));emit(_0x344744[_0xcd56('0xd')],_0x1875ae['name'],_0x2c3408[_0xcd56('0x3c')],_0x22957d[_0xcd56('0x4a')]);}})['catch'](function(_0x57da0f){logger['error']('['+_0x1c95c6['toUpperCase']()+_0xcd56('0x65'),util[_0xcd56('0x66')](_0x57da0f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x47ab=['systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','outbound','destcalleridnum','calleridnum','POST','headers','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','indexOf','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','/systemusers(','phonecall','queue','callDirection','phonecalls','Subjects','Fields','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','util','./util','ioredis','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','clientId','remoteUri','password','then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET'];(function(_0x68d20a,_0xcb3e9f){var _0x442660=function(_0x431c6a){while(--_0x431c6a){_0x68d20a['push'](_0x68d20a['shift']());}};_0x442660(++_0xcb3e9f);}(_0x47ab,0xb9));var _0xb47a=function(_0x3fc702,_0x2f60d5){_0x3fc702=_0x3fc702-0x0;var _0x379946=_0x47ab[_0x3fc702];return _0x379946;};'use strict';var _=require(_0xb47a('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var util=require(_0xb47a('0x1'));var intUtil=require(_0xb47a('0x2'));var md5=require('md5');var Redis=require(_0xb47a('0x3'));var logger=require('../../../../config/logger')(_0xb47a('0x4'));var config=require(_0xb47a('0x5'));config[_0xb47a('0x6')]=_['defaults'](config[_0xb47a('0x6')],{'host':_0xb47a('0x7'),'port':0x18eb});var io=require(_0xb47a('0x8'))(new Redis(config[_0xb47a('0x6')]));function getAuthToken(_0x18846e,_0x1951b0,_0x1b3856){var _0x3477dc={'method':'POST','uri':_0x1951b0,'form':{'client_id':_0x18846e[_0xb47a('0x9')],'resource':_0x18846e[_0xb47a('0xa')],'username':_0x18846e['username'],'password':_0x18846e[_0xb47a('0xb')],'grant_type':'password','client_secret':_0x18846e['clientSecret']},'json':!![]};return rp(_0x3477dc)[_0xb47a('0xc')](function(_0x97edf0){return _0x97edf0['access_token'];})[_0xb47a('0xd')](function(_0x38a7fa){logger[_0xb47a('0xe')]('['+[_0x1b3856[_0xb47a('0xf')]()]+_0xb47a('0x10'));return _0x38a7fa[_0xb47a('0x11')];});}function getUser(_0x145414,_0x1806aa,_0x2aa0c8,_0x384e34,_0x2ae058,_0x17bc8c){return new BPromise(function(_0x11e5a9,_0x428f20){return getAuthToken(_0x1806aa,_0x384e34,_0x17bc8c)[_0xb47a('0xc')](function(_0x36e4b8){var _0x5602bb={'method':_0xb47a('0x12'),'uri':_0x2ae058+_0xb47a('0x13'),'headers':{'Authorization':_0xb47a('0x14')+_0x36e4b8,'OData-Version':_0xb47a('0x15')},'json':!![]};return rp(_0x5602bb);})['then'](function(_0x2e1bbc){var _0x52b791=_0x2e1bbc[_0xb47a('0x16')];var _0x247028=![];var _0x5c46cf=null;if(!_[_0xb47a('0x17')](_0x2aa0c8)){if(intUtil[_0xb47a('0x18')](_0x2aa0c8[_0xb47a('0x19')])){_0x145414[_0xb47a('0x1a')]=_0x2aa0c8[_0xb47a('0x19')];for(_0x5c46cf=0x0;_0x5c46cf<_0x52b791[_0xb47a('0x1b')];_0x5c46cf++){if(_0x52b791[_0x5c46cf][_0xb47a('0x1c')]===_0x2aa0c8[_0xb47a('0x19')]&&!_0x52b791[_0x5c46cf][_0xb47a('0x1d')]){_0x247028=!![];logger[_0xb47a('0x1e')]('['+[_0x17bc8c['toUpperCase']()]+_0xb47a('0x1f')+_0x52b791[_0x5c46cf][_0xb47a('0x20')]+'!');_0x145414[_0xb47a('0x21')]=_0x52b791[_0x5c46cf][_0xb47a('0x20')];}}}}if(!_0x247028){logger[_0xb47a('0x1e')]('['+[_0x17bc8c[_0xb47a('0xf')]()]+_0xb47a('0x22'));_0x145414[_0xb47a('0x1a')]=_0x1806aa[_0xb47a('0x23')];for(_0x5c46cf=0x0;_0x5c46cf<_0x52b791['length'];_0x5c46cf++){if(_0x52b791[_0x5c46cf][_0xb47a('0x1c')]===_0x1806aa[_0xb47a('0x23')]){_0x145414['userId']=_0x52b791[_0x5c46cf][_0xb47a('0x20')];}}}_0x11e5a9(_0x145414);})[_0xb47a('0xd')](function(_0x59ca8c){_0x428f20(_0x59ca8c[_0xb47a('0x11')]);});});}function createEndUser(_0x1fb2b5,_0x574769,_0x35bb22,_0x1328ba,_0x214397,_0xefcb7c){return new BPromise(function(_0x59423b,_0x18ae51){return getAuthToken(_0x574769,_0x35bb22,_0xefcb7c)['then'](function(_0x5a1946){var _0x442d30=_0xefcb7c['toLowerCase']()===_0xb47a('0x24')?_0x214397[_0xb47a('0x25')]:_0x214397[_0xb47a('0x26')];var _0x5bd543={'method':_0xb47a('0x27'),'uri':_0x1328ba+'contacts','body':{'telephone1':_0x442d30,'fullname':_0x442d30,'firstname':_0x442d30,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x1fb2b5[_0xb47a('0x21')]+')'},'headers':{'Authorization':_0xb47a('0x14')+_0x5a1946,'OData-Version':_0xb47a('0x15')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5bd543);})[_0xb47a('0xc')](function(_0x2b8578){var _0x2b4737=_0x2b8578[_0xb47a('0x28')][_0xb47a('0x29')];var _0x4df9d3=_0x2b4737[_0xb47a('0x2a')](_0x2b4737[_0xb47a('0x2b')]('(')+0x1,_0x2b4737[_0xb47a('0x2b')](')'));_0x1fb2b5[_0xb47a('0x2c')]=_0x4df9d3;_0x59423b(_0x1fb2b5);})[_0xb47a('0xd')](function(_0x3bc502){_0x18ae51(_0x3bc502[_0xb47a('0x11')]);});});}function getEndUser(_0x38332a,_0x1f2437,_0x5ec6c5,_0x1d947a,_0x22a189,_0x2517f9,_0x538c59){var _0x169c38=_0x2517f9[_0xb47a('0x2d')]()==='outbound'?_0x22a189['destcalleridnum']:_0x22a189[_0xb47a('0x26')];return getAuthToken(_0x1f2437,_0x5ec6c5,_0x2517f9)['then'](function(_0x315d83){var _0x114ffc={'method':'GET','uri':_0x1d947a+_0xb47a('0x2e')+_0x169c38[_0xb47a('0x2f')]('+',_0xb47a('0x30'))+'\x27','headers':{'Authorization':_0xb47a('0x14')+_0x315d83,'If-None-Match':null,'OData-Version':_0xb47a('0x15')},'json':!![]};return rp(_0x114ffc);})[_0xb47a('0xc')](function(_0x2abd7f){var _0x300961=![];if(!_0x2abd7f)return _0x300961;var _0x17905f=_0x2abd7f[_0xb47a('0x16')];for(var _0x48dac1=0x0;_0x48dac1<_0x17905f[_0xb47a('0x1b')];_0x48dac1++){if(_0x17905f[_0x48dac1]['telephone1']===_0x169c38){_0x300961=!![];_0x38332a['enduserId']=_0x17905f[_0x48dac1][_0xb47a('0x31')];}}return _0x300961;})[_0xb47a('0xc')](function(_0x174f46){if(_0x174f46)return _0x38332a;if(_0x538c59===_0xb47a('0x32')){logger[_0xb47a('0x1e')]('['+[_0x2517f9[_0xb47a('0xf')]()]+_0xb47a('0x33'));return _0x38332a;}return createEndUser(_0x38332a,_0x1f2437,_0x5ec6c5,_0x1d947a,_0x22a189,_0x2517f9)[_0xb47a('0xc')](function(_0x3b3d5d){logger['info']('['+[_0x2517f9['toUpperCase']()]+_0xb47a('0x34'),_0x3b3d5d[_0xb47a('0x2c')]);return _0x3b3d5d;});});}function getCustomFields(_0x391bb6,_0x253ba1,_0xfac48a){var _0x354e89={};if(_0x391bb6['length']>0x0){_[_0xb47a('0x35')](_0x391bb6,function(_0x1be8e6){if(_[_0xb47a('0x36')]([_0xb47a('0x37'),'picklist'],_0x1be8e6[_0xb47a('0x38')])&&_0x1be8e6[_0xb47a('0x39')]&&!_0x1be8e6[_0xb47a('0x3a')]){var _0x162721=_0x1be8e6['idField']['toLowerCase']();var _0x376f0e=_0x162721[_0xb47a('0x2a')](0x0,_0x162721[_0xb47a('0x3b')]('_'));var _0x8f49ef=_0x162721['substring'](_0x162721[_0xb47a('0x3b')]('_')+0x1);if(_0x376f0e===_0xfac48a){_0x354e89[_0x8f49ef]=_0x1be8e6['content'];}}});}return _0x354e89;}function getTicket(_0x209699,_0x2675bc,_0x1212d5,_0x510e6f,_0x3ce76e,_0x345e1f,_0x486eca){return new BPromise(function(_0x1d579e,_0x5c1495){var _0x1d8ac6;return getAuthToken(_0x2675bc,_0x1212d5,_0x486eca)[_0xb47a('0xc')](function(_0x120cc3){if(_0x345e1f[_0xb47a('0x3c')]===_0xb47a('0x3d')){_0x1d8ac6={'method':_0xb47a('0x27'),'uri':_0x510e6f+_0xb47a('0x3e'),'body':Object[_0xb47a('0x3f')]({},{'title':intUtil[_0xb47a('0x40')](_0x345e1f['Subjects'],_0x3ce76e,'\x20'),'description':intUtil[_0xb47a('0x40')](_0x345e1f[_0xb47a('0x41')],_0x3ce76e,'\x0a'),'customerid_contact@odata.bind':_0x209699[_0xb47a('0x2c')]?_0xb47a('0x42')+_0x209699['enduserId']+')':undefined,'ownerid@odata.bind':_0xb47a('0x43')+_0x209699[_0xb47a('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x345e1f['Fields'],_0x3ce76e,_0x345e1f[_0xb47a('0x3c')])),'headers':{'Authorization':'Bearer\x20'+_0x120cc3,'OData-Version':_0xb47a('0x15')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x345e1f['ticketType']===_0xb47a('0x44')){var _0x57d180=_0x209699[_0xb47a('0x2c')]?[{'partyid_systemuser@odata.bind':_0xb47a('0x43')+_0x209699[_0xb47a('0x21')]+')','participationtypemask':_0x209699['callDirection']===_0xb47a('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0xb47a('0x42')+_0x209699[_0xb47a('0x2c')]+')','participationtypemask':_0x209699[_0xb47a('0x46')]===_0xb47a('0x45')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xb47a('0x43')+_0x209699['userId']+')','participationtypemask':_0x209699[_0xb47a('0x46')]===_0xb47a('0x45')?0x2:0x1}];_0x1d8ac6={'method':_0xb47a('0x27'),'uri':_0x510e6f+_0xb47a('0x47'),'body':Object[_0xb47a('0x3f')]({},{'subject':intUtil[_0xb47a('0x40')](_0x345e1f[_0xb47a('0x48')],_0x3ce76e,'\x20'),'phonenumber':String(_0x3ce76e[_0xb47a('0x26')]),'description':intUtil[_0xb47a('0x40')](_0x345e1f[_0xb47a('0x41')],_0x3ce76e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x209699[_0xb47a('0x2c')]?_0xb47a('0x42')+_0x209699[_0xb47a('0x2c')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x209699[_0xb47a('0x21')]+')','directioncode':_0x209699[_0xb47a('0x46')]===_0xb47a('0x45')?![]:!![],'phonecall_activity_parties':_0x57d180},getCustomFields(_0x345e1f[_0xb47a('0x49')],_0x3ce76e,_0x345e1f['ticketType'])),'headers':{'Authorization':_0xb47a('0x14')+_0x120cc3,'OData-Version':_0xb47a('0x15')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1d8ac6);})[_0xb47a('0xc')](function(_0x461afa){var _0xaa1f41=_0x461afa[_0xb47a('0x28')][_0xb47a('0x29')];var _0x22a8d6=_0xaa1f41[_0xb47a('0x2a')](_0xaa1f41[_0xb47a('0x2b')]('(')+0x1,_0xaa1f41[_0xb47a('0x2b')](')'));_0x209699[_0xb47a('0x4a')]=_0x22a8d6;_0x1d579e(_0x209699);})[_0xb47a('0xd')](function(_0xbfd34e){_0x5c1495(_0xbfd34e[_0xb47a('0x11')]);});});}function emit(_0x4008ca,_0x301c9e,_0x224752,_0x14c61a){var _0x1ebb55={'uri':util['format'](_0xb47a('0x4b'),_0x4008ca,_0x224752,_0x14c61a)};io['to'](util[_0xb47a('0x4c')](_0xb47a('0x4d'),_0x301c9e))[_0xb47a('0x4e')](_0xb47a('0x4f'),_0x1ebb55);}exports['cs']=function(_0x16d0e4,_0x446887,_0x2b37a8,_0x59640b,_0xc955aa,_0x15f4a1,_0x16e3a6,_0x28c1eb){var _0x2b00ab={};_0x15f4a1['remoteUri']=intUtil[_0xb47a('0x50')](_0x15f4a1[_0xb47a('0xa')]);_0x15f4a1[_0xb47a('0x51')]=intUtil[_0xb47a('0x50')](_0x15f4a1[_0xb47a('0x51')]);_0x2b00ab[_0xb47a('0x46')]=_0x28c1eb==='queue'||_0x28c1eb===_0xb47a('0x52')?_0xb47a('0x45'):_0xb47a('0x24');var _0x5ebd08=util[_0xb47a('0x4c')](_0xb47a('0x53'),_0x15f4a1[_0xb47a('0xa')]);var _0x20baa0=util[_0xb47a('0x4c')](_0xb47a('0x54'),_0x15f4a1[_0xb47a('0x55')]);var _0x9b7818=util[_0xb47a('0x4c')](_0xb47a('0x56'),_0x15f4a1['serverUrl'],_0x446887[_0xb47a('0x57')],md5(_0x446887['uniqueid']));if(_0xc955aa&&_0xc955aa[_0xb47a('0x58')]){logger[_0xb47a('0x1e')](_0xb47a('0x59'),_0xb47a('0x5a'));_0x446887['recordingURL']=_0x9b7818;}else if(_0x16e3a6&&_0x16e3a6[_0xb47a('0x5b')]&&_0x16e3a6[_0xb47a('0x5b')]!=='none'){logger['info'](_0xb47a('0x5c'),_0xb47a('0x5a'));_0x446887[_0xb47a('0x5d')]=_0x9b7818;}else{_0x446887[_0xb47a('0x5d')]='';}return getUser(_0x2b00ab,_0x15f4a1,_0x59640b,_0x20baa0,_0x5ebd08,_0x28c1eb)[_0xb47a('0xc')](function(_0x58dfb2){logger['info']('['+_0x28c1eb[_0xb47a('0xf')]()+_0xb47a('0x5e'),_0x58dfb2[_0xb47a('0x21')]);logger[_0xb47a('0x1e')]('['+_0x28c1eb[_0xb47a('0xf')]()+']\x20The\x20User\x20email\x20is:',_0x58dfb2[_0xb47a('0x1a')]);return getEndUser(_0x58dfb2,_0x15f4a1,_0x20baa0,_0x5ebd08,_0x446887,_0x28c1eb,_0x2b37a8[_0xb47a('0x5f')]);})[_0xb47a('0xc')](function(_0x10f806){logger[_0xb47a('0x1e')]('['+_0x28c1eb[_0xb47a('0xf')]()+_0xb47a('0x60'),_0x10f806['enduserId']);logger[_0xb47a('0x1e')]('['+_0x28c1eb[_0xb47a('0xf')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x446887[_0xb47a('0x26')]);return getTicket(_0x10f806,_0x15f4a1,_0x20baa0,_0x5ebd08,_0x446887,_0x2b37a8,_0x28c1eb);})['then'](function(_0x36d969){logger[_0xb47a('0x1e')](util[_0xb47a('0x4c')]('['+_0x28c1eb[_0xb47a('0xf')]()+_0xb47a('0x61'),_0x2b37a8['ticketType'],_0x36d969[_0xb47a('0x4a')]));logger[_0xb47a('0x1e')](util[_0xb47a('0x4c')]('['+_0x28c1eb['toUpperCase']()+_0xb47a('0x62'),_0x28c1eb));if(_0x28c1eb!==_0xb47a('0x52')){logger['info']('['+_0x28c1eb[_0xb47a('0xf')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x15f4a1[_0xb47a('0xa')],_0x59640b[_0xb47a('0x63')],_0x2b37a8['ticketType'],_0x36d969[_0xb47a('0x4a')]);}})['catch'](function(_0x48685a){logger[_0xb47a('0xe')]('['+_0x28c1eb[_0xb47a('0xf')]()+_0xb47a('0x64'),util[_0xb47a('0x65')](_0x48685a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index bb8154e..cbbdd64 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 _0x87a9=['serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','unmanaged','lastevent','toUpperCase','Authorization','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','application/json','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridnum','Subjects','getString','
','Fields','custom_fields','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','includes','picklist','type','nameField','customField','toLowerCase','string','push','idField','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash'];(function(_0x4e906d,_0x50cbd7){var _0x239d66=function(_0x1ba739){while(--_0x1ba739){_0x4e906d['push'](_0x4e906d['shift']());}};_0x239d66(++_0x50cbd7);}(_0x87a9,0x1d6));var _0x987a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x87a9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x987a('0x0'));var rp=require(_0x987a('0x1'));var md5=require(_0x987a('0x2'));var util=require(_0x987a('0x3'));var Redis=require(_0x987a('0x4'));var intUtil=require(_0x987a('0x5'));var config=require(_0x987a('0x6'));var logger=require('../../../../config/logger')(_0x987a('0x7'));config[_0x987a('0x8')]=_[_0x987a('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x987a('0xa'),'Accept':'application/json'};function emit(_0x2e5902,_0x1fa78e,_0x4e9bd9){io['to'](_0x2e5902)['emit'](_0x1fa78e,_0x4e9bd9);}function getTicket(_0x3a75ff,_0x232d8c,_0x139192,_0x3bd276,_0x361cec){logger[_0x987a('0xb')](_0x987a('0xc'));var _0x3fc35c=_['merge']({'responder_id':_0x232d8c['id'],'requester_id':_0x139192['id'],'name':util[_0x987a('0xd')](_0x987a('0xe'),_0x361cec['calleridname']),'phone':_0x361cec[_0x987a('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x3bd276[_0x987a('0x10')],_0x361cec,'\x20'),'description':intUtil[_0x987a('0x11')](_0x3bd276['Descriptions'],_0x361cec,_0x987a('0x12')),'tags':getTags(_0x3bd276['Tags'],'name')},getCustomFields(_0x3bd276[_0x987a('0x13')],_0x361cec));_0x3fc35c[_0x987a('0x14')]=_['mapValues'](_['keyBy'](_0x3fc35c[_0x987a('0x14')],'id'),'value');return request({'uri':util[_0x987a('0xd')](_0x987a('0x15'),_0x3a75ff[_0x987a('0x16')]),'method':_0x987a('0x17'),'body':_0x3fc35c})[_0x987a('0x18')](function(_0x32037b){logger[_0x987a('0xb')](_0x987a('0x19'));return _0x32037b;});}function getUser(_0x460f2a,_0x1a77d0){if(intUtil['validateEmail'](_0x1a77d0)){return request({'uri':util[_0x987a('0xd')](_0x987a('0x1a'),_0x460f2a[_0x987a('0x16')]),'qs':{'email':_0x1a77d0}})['then'](function(_0x50828a){if(_0x50828a[_0x987a('0x1b')]){logger['info'](_0x987a('0x1c'));return _[_0x987a('0x1d')](_0x50828a,function(_0x343bcb){return _0x343bcb[_0x987a('0x1e')][_0x987a('0x1f')]===_0x1a77d0;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x987a('0xd')](_0x987a('0x20'),_0x460f2a[_0x987a('0x16')])})['then'](function(_0x47c817){logger[_0x987a('0xb')]('Admin\x20account\x20selected.');return _0x47c817;});}});}else{logger[_0x987a('0xb')](_0x987a('0x21'));return request({'uri':util[_0x987a('0xd')](_0x987a('0x20'),_0x460f2a['remoteUri'])})['then'](function(_0x37258b){logger['info'](_0x987a('0x22'));return _0x37258b;});}}function getEndUser(_0x59eccf,_0x5efe19,_0x8cfbe8){logger['info'](_0x987a('0x23'),_0x8cfbe8);return request({'uri':util[_0x987a('0xd')](_0x987a('0x24'),_0x59eccf['remoteUri']),'qs':{'phone':_0x8cfbe8}})[_0x987a('0x18')](function(_0x18d39d){if(_0x18d39d[_0x987a('0x1b')]){logger['info'](_0x987a('0x25'));return _['find'](_0x18d39d,{'phone':_0x8cfbe8});}else{logger['info'](_0x987a('0x26'));return request({'uri':util['format'](_0x987a('0x24'),_0x59eccf[_0x987a('0x16')]),'method':_0x987a('0x17'),'body':{'name':_0x5efe19,'phone':_0x8cfbe8}})[_0x987a('0x18')](function(_0x218b57){logger[_0x987a('0xb')](_0x987a('0x27'));return _0x218b57;});}});}function getAuth(_0x378cd2){return util[_0x987a('0xd')](_0x987a('0x28'),new Buffer(_0x378cd2[_0x987a('0x29')]+':X')[_0x987a('0x2a')](_0x987a('0x2b')));}function request(_0x336801){logger[_0x987a('0x2c')](_0x987a('0x2d'),JSON[_0x987a('0x2e')](_0x336801));return rp(_[_0x987a('0x9')](_0x336801,{'method':_0x987a('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x130048,_0x5a836d){var _0xdec6d6=[];if(_0x130048&&_0x130048[_0x987a('0x1b')]>0x0){_0xdec6d6=_['map'](_0x130048,_0x5a836d);}return _0xdec6d6;}function getCustomFields(_0x5140f8,_0x2d1352){var _0x8804fb=[];var _0x55ed92={'custom_fields':[]};if(_0x5140f8[_0x987a('0x1b')]>0x0){_['forEach'](_0x5140f8,function(_0x55c538){if(_[_0x987a('0x30')](['string',_0x987a('0x31')],_0x55c538[_0x987a('0x32')])&&_0x55c538[_0x987a('0x33')]&&!_0x55c538[_0x987a('0x34')]){_0x55ed92[_0x55c538[_0x987a('0x33')][_0x987a('0x35')]()]=_0x55c538['content'][_0x987a('0x2a')]();}else if(_[_0x987a('0x30')]([_0x987a('0x36'),_0x987a('0x31')],_0x55c538[_0x987a('0x32')])&&_0x55c538['idField']&&_0x55c538[_0x987a('0x34')]){_0x55ed92[_0x987a('0x14')][_0x987a('0x37')]({'id':_0x55c538[_0x987a('0x38')],'value':_0x55c538['content'][_0x987a('0x2a')]()});}else if(_0x55c538['type']===_0x987a('0x39')&&_0x55c538[_0x987a('0x3a')]&&_0x55c538[_0x987a('0x38')]&&_0x55c538[_0x987a('0x34')]){_0x2d1352[_0x55c538['variableName']]&&_0x55ed92[_0x987a('0x14')]['push']({'id':_0x55c538['idField'],'value':_0x2d1352[_0x55c538[_0x987a('0x3a')]][_0x987a('0x2a')]()});}else if(_0x55c538[_0x987a('0x32')]===_0x987a('0x3b')&&_0x55c538[_0x987a('0x3c')]&&_0x55c538['Variable'][_0x987a('0x3d')]&&_0x55c538[_0x987a('0x38')]&&_0x55c538[_0x987a('0x34')]){_0x2d1352[_0x55c538[_0x987a('0x3c')][_0x987a('0x3d')][_0x987a('0x35')]()]&&_0x55ed92[_0x987a('0x14')]['push']({'id':_0x55c538['idField'],'value':_0x2d1352[_0x55c538['Variable'][_0x987a('0x3d')]['toLowerCase']()][_0x987a('0x2a')]()});}});}return _0x55ed92;}exports[_0x987a('0x3e')]=function(_0x523725,_0x11bde5,_0x529d89,_0x4a59f9,_0xcff1e0,_0xe713c5){var _0x118e31,_0x58e833;_0xe713c5[_0x987a('0x16')]=intUtil[_0x987a('0x3f')](_0xe713c5[_0x987a('0x16')]);_0xe713c5[_0x987a('0x40')]=intUtil[_0x987a('0x3f')](_0xe713c5[_0x987a('0x40')]);if(_0xcff1e0&&_0xcff1e0[_0x987a('0x41')]){logger[_0x987a('0xb')](_0x987a('0x42'),_0x987a('0x43'));_0x11bde5[_0x987a('0x44')]=util[_0x987a('0xd')](_0x987a('0x45'),_0xe713c5[_0x987a('0x40')],_0x11bde5[_0x987a('0x46')],md5(_0x11bde5['uniqueid']));}else{_0x11bde5['recordingURL']='';}headers['Authorization']=getAuth(_0xe713c5);return getUser(_0xe713c5,_0x4a59f9[_0x987a('0x1f')])[_0x987a('0x18')](function(_0x58b330){_0x118e31=_0x58b330;logger[_0x987a('0xb')](_0x987a('0x47'),_0x118e31['id']);return getEndUser(_0xe713c5,_0x11bde5[_0x987a('0x48')],_0x11bde5[_0x987a('0xf')]);})[_0x987a('0x18')](function(_0x5e8b41){_0x58e833=_0x5e8b41;logger['info'](_0x987a('0x49'),_0x58e833['id']);return getTicket(_0xe713c5,_0x118e31,_0x58e833,_0x529d89,_0x11bde5);})[_0x987a('0x18')](function(_0x143183){if(_0x143183&&_0x143183['id']){logger[_0x987a('0xb')](_0x987a('0x19'));logger['info'](_0x987a('0x4a'),_0x143183['id']);logger[_0x987a('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x987a('0xd')](_0x987a('0x4b'),_0x4a59f9[_0x987a('0x3d')]),_0x987a('0x4c'),{'uri':util[_0x987a('0xd')]('%s/helpdesk/tickets/%d',_0xe713c5['remoteUri'],_0x143183['id'])});}})['catch'](function(_0x20280a){logger[_0x987a('0x4d')](_0x987a('0x42'),JSON['stringify'](_0x20280a));});};exports[_0x987a('0x4e')]=function(_0x1e645d,_0x5c47cd,_0x5aaa9e,_0xf802f2,_0x59893b,_0x114cc2,_0x198a51){var _0x1145de,_0x3bf79c;_0x114cc2['remoteUri']=intUtil[_0x987a('0x3f')](_0x114cc2[_0x987a('0x16')]);_0x114cc2[_0x987a('0x40')]=intUtil['stripTrailingSlash'](_0x114cc2['serverUrl']);if(_0x198a51&&_0x198a51[_0x987a('0x4f')]&&_0x198a51[_0x987a('0x4f')]!==_0x987a('0x50')){logger[_0x987a('0xb')](_0x987a('0x51'),'Recording\x20is\x20enabled!');_0x5c47cd['recordingURL']=util[_0x987a('0xd')](_0x987a('0x45'),_0x114cc2[_0x987a('0x40')],_0x5c47cd[_0x987a('0x46')],md5(_0x5c47cd[_0x987a('0x46')]));}headers['Authorization']=getAuth(_0x114cc2);return getUser(_0x114cc2,_0xf802f2['email'])[_0x987a('0x18')](function(_0x268165){_0x1145de=_0x268165;logger[_0x987a('0xb')](_0x987a('0x47'),_0x1145de['id']);return getEndUser(_0x114cc2,_0x5c47cd[_0x987a('0x52')],_0x5c47cd['destcalleridnum']);})[_0x987a('0x18')](function(_0xa21811){_0x3bf79c=_0xa21811;logger['info'](_0x987a('0x49'),_0x3bf79c['id']);return getTicket(_0x114cc2,_0x1145de,_0x3bf79c,_0x5aaa9e,_0x5c47cd);})[_0x987a('0x18')](function(_0x376c70){if(_0x376c70&&_0x376c70['id']){logger[_0x987a('0xb')](_0x987a('0x19'));logger[_0x987a('0xb')](_0x987a('0x4a'),_0x376c70['id']);logger[_0x987a('0xb')](_0x987a('0x51'),_0x987a('0x53'));emit(util[_0x987a('0xd')](_0x987a('0x4b'),_0xf802f2['name']),_0x987a('0x4c'),{'uri':util[_0x987a('0xd')]('%s/helpdesk/tickets/%d',_0x114cc2['remoteUri'],_0x376c70['id'])});}})[_0x987a('0x54')](function(_0x111dba){logger['error']('[OUTBOUND]',JSON['stringify'](_0x111dba));});};exports[_0x987a('0x55')]=function(_0x4d3180,_0x946596,_0x5656b2,_0x111863,_0x2f00e5,_0x5527b8){var _0x28f0c9,_0x40b553;_0x5527b8[_0x987a('0x16')]=intUtil[_0x987a('0x3f')](_0x5527b8[_0x987a('0x16')]);_0x5527b8[_0x987a('0x40')]=intUtil[_0x987a('0x3f')](_0x5527b8[_0x987a('0x40')]);if(_0x2f00e5&&_0x2f00e5['monitor_format']){logger['info']('['+_0x946596[_0x987a('0x56')][_0x987a('0x57')]()+']','Recording\x20is\x20enabled!');_0x946596[_0x987a('0x44')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5527b8[_0x987a('0x40')],_0x946596[_0x987a('0x46')],md5(_0x946596[_0x987a('0x46')]));}else{_0x946596[_0x987a('0x44')]='';}headers[_0x987a('0x58')]=getAuth(_0x5527b8);return getUser(_0x5527b8,'')[_0x987a('0x18')](function(_0x165199){_0x28f0c9=_0x165199;logger[_0x987a('0xb')]('The\x20User\x20ID\x20is:',_0x28f0c9['id']);return getEndUser(_0x5527b8,_0x946596[_0x987a('0x48')],_0x946596[_0x987a('0xf')]);})[_0x987a('0x18')](function(_0x34046b){_0x40b553=_0x34046b;logger[_0x987a('0xb')](_0x987a('0x49'),_0x40b553['id']);return getTicket(_0x5527b8,_0x28f0c9,_0x40b553,_0x5656b2,_0x946596);})[_0x987a('0x18')](function(_0x3b234f){if(_0x3b234f){logger['info'](_0x987a('0x19'));logger[_0x987a('0xb')](_0x987a('0x4a'),_0x3b234f['id']);}})[_0x987a('0x54')](function(_0x33afe3){logger[_0x987a('0x4d')]('['+_0x946596[_0x987a('0x56')][_0x987a('0x57')]()+']',JSON[_0x987a('0x2e')](_0x33afe3));});}; \ No newline at end of file +var _0x2c29=['Enduser\x20created.','Basic\x20%s','toString','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','customField','toLowerCase','content','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','The\x20Enduser\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','none','[OUTBOUND]','destcalleridname','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','The\x20User\x20ID\x20is:','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','Agent\x20found!','find','info','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0x13cfb5,_0x1b6568){var _0x4e86b8=function(_0x11a361){while(--_0x11a361){_0x13cfb5['push'](_0x13cfb5['shift']());}};_0x4e86b8(++_0x1b6568);}(_0x2c29,0x8d));var _0x92c2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2c29[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x92c2('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x92c2('0x1'));var Redis=require(_0x92c2('0x2'));var intUtil=require(_0x92c2('0x3'));var config=require(_0x92c2('0x4'));var logger=require('../../../../config/logger')(_0x92c2('0x5'));config[_0x92c2('0x6')]=_[_0x92c2('0x7')](config['redis'],{'host':_0x92c2('0x8'),'port':0x18eb});var io=require(_0x92c2('0x9'))(new Redis(config[_0x92c2('0x6')]));var headers={'Content-Type':_0x92c2('0xa'),'Accept':_0x92c2('0xa')};function emit(_0x3f429a,_0x5bbaad,_0x265842){io['to'](_0x3f429a)[_0x92c2('0xb')](_0x5bbaad,_0x265842);}function getTicket(_0x290a6e,_0x5aee13,_0x285257,_0x1ba4bb,_0x454626){logger['info'](_0x92c2('0xc'));var _0x569cc5=_[_0x92c2('0xd')]({'responder_id':_0x5aee13['id'],'requester_id':_0x285257['id'],'name':util[_0x92c2('0xe')](_0x92c2('0xf'),_0x454626['calleridname']),'phone':_0x454626[_0x92c2('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x92c2('0x11')](_0x1ba4bb[_0x92c2('0x12')],_0x454626,'\x20'),'description':intUtil[_0x92c2('0x11')](_0x1ba4bb[_0x92c2('0x13')],_0x454626,'
'),'tags':getTags(_0x1ba4bb[_0x92c2('0x14')],_0x92c2('0x15'))},getCustomFields(_0x1ba4bb[_0x92c2('0x16')],_0x454626));_0x569cc5[_0x92c2('0x17')]=_[_0x92c2('0x18')](_[_0x92c2('0x19')](_0x569cc5['custom_fields'],'id'),_0x92c2('0x1a'));return request({'uri':util['format'](_0x92c2('0x1b'),_0x290a6e[_0x92c2('0x1c')]),'method':_0x92c2('0x1d'),'body':_0x569cc5})[_0x92c2('0x1e')](function(_0x4b84ff){logger['info'](_0x92c2('0x1f'));return _0x4b84ff;});}function getUser(_0x330f8e,_0x48cc5d){if(intUtil[_0x92c2('0x20')](_0x48cc5d)){return request({'uri':util[_0x92c2('0xe')]('%s/api/v2/agents',_0x330f8e[_0x92c2('0x1c')]),'qs':{'email':_0x48cc5d}})[_0x92c2('0x1e')](function(_0x3d1900){if(_0x3d1900['length']){logger['info'](_0x92c2('0x21'));return _[_0x92c2('0x22')](_0x3d1900,function(_0x12d4fa){return _0x12d4fa['contact']['email']===_0x48cc5d;});}else{logger[_0x92c2('0x23')](_0x92c2('0x24'));return request({'uri':util[_0x92c2('0xe')](_0x92c2('0x25'),_0x330f8e['remoteUri'])})['then'](function(_0x5e689f){logger[_0x92c2('0x23')](_0x92c2('0x26'));return _0x5e689f;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x92c2('0xe')](_0x92c2('0x25'),_0x330f8e[_0x92c2('0x1c')])})[_0x92c2('0x1e')](function(_0x593637){logger[_0x92c2('0x23')](_0x92c2('0x26'));return _0x593637;});}}function getEndUser(_0x599558,_0x1d72f2,_0x41d4fe){logger['info']('Searching\x20enduser\x20with\x20phone',_0x41d4fe);return request({'uri':util[_0x92c2('0xe')](_0x92c2('0x27'),_0x599558[_0x92c2('0x1c')]),'qs':{'phone':_0x41d4fe}})[_0x92c2('0x1e')](function(_0x4c21fa){if(_0x4c21fa[_0x92c2('0x28')]){logger[_0x92c2('0x23')](_0x92c2('0x29'));return _[_0x92c2('0x22')](_0x4c21fa,{'phone':_0x41d4fe});}else{logger[_0x92c2('0x23')](_0x92c2('0x2a'));return request({'uri':util[_0x92c2('0xe')]('%s/api/v2/contacts',_0x599558[_0x92c2('0x1c')]),'method':'POST','body':{'name':_0x1d72f2,'phone':_0x41d4fe}})[_0x92c2('0x1e')](function(_0xedd020){logger[_0x92c2('0x23')](_0x92c2('0x2b'));return _0xedd020;});}});}function getAuth(_0x22a107){return util[_0x92c2('0xe')](_0x92c2('0x2c'),new Buffer(_0x22a107['apiKey']+':X')[_0x92c2('0x2d')]('base64'));}function request(_0x514f7e){logger['debug'](_0x92c2('0x2e'),JSON[_0x92c2('0x2f')](_0x514f7e));return rp(_[_0x92c2('0x7')](_0x514f7e,{'method':_0x92c2('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x2d7633,_0x2ea21b){var _0x4bb3fa=[];if(_0x2d7633&&_0x2d7633[_0x92c2('0x28')]>0x0){_0x4bb3fa=_[_0x92c2('0x31')](_0x2d7633,_0x2ea21b);}return _0x4bb3fa;}function getCustomFields(_0x4bfbcb,_0x4f81d3){var _0x51e176=[];var _0x451db0={'custom_fields':[]};if(_0x4bfbcb[_0x92c2('0x28')]>0x0){_[_0x92c2('0x32')](_0x4bfbcb,function(_0x401c49){if(_[_0x92c2('0x33')]([_0x92c2('0x34'),_0x92c2('0x35')],_0x401c49[_0x92c2('0x36')])&&_0x401c49['nameField']&&!_0x401c49[_0x92c2('0x37')]){_0x451db0[_0x401c49['nameField'][_0x92c2('0x38')]()]=_0x401c49[_0x92c2('0x39')][_0x92c2('0x2d')]();}else if(_['includes'](['string',_0x92c2('0x35')],_0x401c49[_0x92c2('0x36')])&&_0x401c49[_0x92c2('0x3a')]&&_0x401c49[_0x92c2('0x37')]){_0x451db0[_0x92c2('0x17')][_0x92c2('0x3b')]({'id':_0x401c49[_0x92c2('0x3a')],'value':_0x401c49['content'][_0x92c2('0x2d')]()});}else if(_0x401c49[_0x92c2('0x36')]===_0x92c2('0x3c')&&_0x401c49['variableName']&&_0x401c49[_0x92c2('0x3a')]&&_0x401c49[_0x92c2('0x37')]){_0x4f81d3[_0x401c49[_0x92c2('0x3d')]]&&_0x451db0[_0x92c2('0x17')]['push']({'id':_0x401c49[_0x92c2('0x3a')],'value':_0x4f81d3[_0x401c49[_0x92c2('0x3d')]][_0x92c2('0x2d')]()});}else if(_0x401c49[_0x92c2('0x36')]===_0x92c2('0x3e')&&_0x401c49[_0x92c2('0x3f')]&&_0x401c49[_0x92c2('0x3f')][_0x92c2('0x15')]&&_0x401c49[_0x92c2('0x3a')]&&_0x401c49[_0x92c2('0x37')]){_0x4f81d3[_0x401c49['Variable']['name'][_0x92c2('0x38')]()]&&_0x451db0[_0x92c2('0x17')][_0x92c2('0x3b')]({'id':_0x401c49[_0x92c2('0x3a')],'value':_0x4f81d3[_0x401c49[_0x92c2('0x3f')][_0x92c2('0x15')][_0x92c2('0x38')]()][_0x92c2('0x2d')]()});}});}return _0x451db0;}exports[_0x92c2('0x40')]=function(_0x413ada,_0x7c6d73,_0x29d90a,_0xa590eb,_0x32de0a,_0x3f2fe5){var _0x359dc6,_0xbbf237;_0x3f2fe5['remoteUri']=intUtil[_0x92c2('0x41')](_0x3f2fe5['remoteUri']);_0x3f2fe5[_0x92c2('0x42')]=intUtil[_0x92c2('0x41')](_0x3f2fe5[_0x92c2('0x42')]);if(_0x32de0a&&_0x32de0a[_0x92c2('0x43')]){logger[_0x92c2('0x23')](_0x92c2('0x44'),_0x92c2('0x45'));_0x7c6d73[_0x92c2('0x46')]=util[_0x92c2('0xe')](_0x92c2('0x47'),_0x3f2fe5[_0x92c2('0x42')],_0x7c6d73[_0x92c2('0x48')],md5(_0x7c6d73[_0x92c2('0x48')]));}else{_0x7c6d73[_0x92c2('0x46')]='';}headers[_0x92c2('0x49')]=getAuth(_0x3f2fe5);return getUser(_0x3f2fe5,_0xa590eb[_0x92c2('0x4a')])[_0x92c2('0x1e')](function(_0x470ac3){_0x359dc6=_0x470ac3;logger[_0x92c2('0x23')]('The\x20User\x20ID\x20is:',_0x359dc6['id']);return getEndUser(_0x3f2fe5,_0x7c6d73[_0x92c2('0x4b')],_0x7c6d73['calleridnum']);})[_0x92c2('0x1e')](function(_0x1c287d){_0xbbf237=_0x1c287d;logger[_0x92c2('0x23')](_0x92c2('0x4c'),_0xbbf237['id']);return getTicket(_0x3f2fe5,_0x359dc6,_0xbbf237,_0x29d90a,_0x7c6d73);})['then'](function(_0x2ffec2){if(_0x2ffec2&&_0x2ffec2['id']){logger[_0x92c2('0x23')]('Ticket\x20created!');logger[_0x92c2('0x23')]('The\x20Ticket\x20ID\x20is:',_0x2ffec2['id']);logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x92c2('0xe')](_0x92c2('0x4d'),_0xa590eb[_0x92c2('0x15')]),_0x92c2('0x4e'),{'uri':util['format'](_0x92c2('0x4f'),_0x3f2fe5[_0x92c2('0x1c')],_0x2ffec2['id'])});}})[_0x92c2('0x50')](function(_0x42946a){logger[_0x92c2('0x51')]('[QUEUE]',JSON[_0x92c2('0x2f')](_0x42946a));});};exports[_0x92c2('0x52')]=function(_0x204e2f,_0x30e445,_0x4f83fa,_0x40c22d,_0x559a4b,_0x129eea,_0x4aa9be){var _0x1b680f,_0x3d098a;_0x129eea[_0x92c2('0x1c')]=intUtil['stripTrailingSlash'](_0x129eea[_0x92c2('0x1c')]);_0x129eea['serverUrl']=intUtil[_0x92c2('0x41')](_0x129eea[_0x92c2('0x42')]);if(_0x4aa9be&&_0x4aa9be['recordingFormat']&&_0x4aa9be['recordingFormat']!==_0x92c2('0x53')){logger['info'](_0x92c2('0x54'),_0x92c2('0x45'));_0x30e445[_0x92c2('0x46')]=util['format'](_0x92c2('0x47'),_0x129eea[_0x92c2('0x42')],_0x30e445[_0x92c2('0x48')],md5(_0x30e445[_0x92c2('0x48')]));}headers[_0x92c2('0x49')]=getAuth(_0x129eea);return getUser(_0x129eea,_0x40c22d[_0x92c2('0x4a')])['then'](function(_0x1663b4){_0x1b680f=_0x1663b4;logger[_0x92c2('0x23')]('The\x20User\x20ID\x20is:',_0x1b680f['id']);return getEndUser(_0x129eea,_0x30e445[_0x92c2('0x55')],_0x30e445['destcalleridnum']);})[_0x92c2('0x1e')](function(_0xda1593){_0x3d098a=_0xda1593;logger[_0x92c2('0x23')](_0x92c2('0x4c'),_0x3d098a['id']);return getTicket(_0x129eea,_0x1b680f,_0x3d098a,_0x4f83fa,_0x30e445);})[_0x92c2('0x1e')](function(_0x40f087){if(_0x40f087&&_0x40f087['id']){logger[_0x92c2('0x23')](_0x92c2('0x1f'));logger[_0x92c2('0x23')](_0x92c2('0x56'),_0x40f087['id']);logger[_0x92c2('0x23')](_0x92c2('0x54'),_0x92c2('0x57'));emit(util['format'](_0x92c2('0x4d'),_0x40c22d[_0x92c2('0x15')]),'trigger:browser:url',{'uri':util[_0x92c2('0xe')](_0x92c2('0x4f'),_0x129eea[_0x92c2('0x1c')],_0x40f087['id'])});}})[_0x92c2('0x50')](function(_0xaf7337){logger['error']('[OUTBOUND]',JSON['stringify'](_0xaf7337));});};exports[_0x92c2('0x58')]=function(_0x5df709,_0x27a089,_0x3207f1,_0x2de024,_0x4b04a9,_0x154f8d){var _0x3232b2,_0x17ae42;_0x154f8d[_0x92c2('0x1c')]=intUtil[_0x92c2('0x41')](_0x154f8d[_0x92c2('0x1c')]);_0x154f8d[_0x92c2('0x42')]=intUtil[_0x92c2('0x41')](_0x154f8d[_0x92c2('0x42')]);if(_0x4b04a9&&_0x4b04a9[_0x92c2('0x43')]){logger[_0x92c2('0x23')]('['+_0x27a089['lastevent']['toUpperCase']()+']',_0x92c2('0x45'));_0x27a089['recordingURL']=util[_0x92c2('0xe')](_0x92c2('0x47'),_0x154f8d['serverUrl'],_0x27a089[_0x92c2('0x48')],md5(_0x27a089[_0x92c2('0x48')]));}else{_0x27a089[_0x92c2('0x46')]='';}headers[_0x92c2('0x49')]=getAuth(_0x154f8d);return getUser(_0x154f8d,'')[_0x92c2('0x1e')](function(_0x362006){_0x3232b2=_0x362006;logger['info'](_0x92c2('0x59'),_0x3232b2['id']);return getEndUser(_0x154f8d,_0x27a089['calleridname'],_0x27a089[_0x92c2('0x10')]);})[_0x92c2('0x1e')](function(_0x3a87c5){_0x17ae42=_0x3a87c5;logger[_0x92c2('0x23')]('The\x20Enduser\x20ID\x20is:',_0x17ae42['id']);return getTicket(_0x154f8d,_0x3232b2,_0x17ae42,_0x3207f1,_0x27a089);})[_0x92c2('0x1e')](function(_0xec5b39){if(_0xec5b39){logger[_0x92c2('0x23')]('Ticket\x20created!');logger[_0x92c2('0x23')]('The\x20Ticket\x20ID\x20is:',_0xec5b39['id']);}})[_0x92c2('0x50')](function(_0x43041b){logger['error']('['+_0x27a089[_0x92c2('0x5a')][_0x92c2('0x5b')]()+']',JSON[_0x92c2('0x2f')](_0x43041b));});}; \ 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 c301c00..cce8b7a 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 _0x5ed2=['/api/tasks','getString','Subjects','Contact','add','Task\x20created:','ticketId','/contacts/','user:%s','Token\x20token=','apiKey','remoteUri','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','GET','/api/selector/owners','headers','info','then','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','catch','/api/lookup?q=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task'];(function(_0x3d8265,_0x7b74f5){var _0x31bcd7=function(_0x5e2b72){while(--_0x5e2b72){_0x3d8265['push'](_0x3d8265['shift']());}};_0x31bcd7(++_0x7b74f5);}(_0x5ed2,0x159));var _0x25ed=function(_0x17d133,_0x3aebc5){_0x17d133=_0x17d133-0x0;var _0xf4f7a2=_0x5ed2[_0x17d133];return _0xf4f7a2;};'use strict';var _=require(_0x25ed('0x0'));var rp=require(_0x25ed('0x1'));var md5=require(_0x25ed('0x2'));var util=require(_0x25ed('0x3'));var moment=require('moment');var Promise=require(_0x25ed('0x4'));var Redis=require(_0x25ed('0x5'));var intUtil=require(_0x25ed('0x6'));var config=require(_0x25ed('0x7'));var logger=require(_0x25ed('0x8'))(_0x25ed('0x9'));config[_0x25ed('0xa')]=_['defaults'](config[_0x25ed('0xa')],{'host':_0x25ed('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x25ed('0xa')]));function getAdminId(_0x4eff1c,_0x4c11fd,_0x476380,_0x325da4){return new Promise(function(_0x1c4a50,_0x4d63fb){var _0x27bc8f=![];var _0x2ae69d={'method':_0x25ed('0xc'),'uri':_0x325da4+_0x25ed('0xd'),'json':!![]};_0x2ae69d[_0x25ed('0xe')]=_0x476380;logger[_0x25ed('0xf')]('Getting\x20admin\x20information');return rp(_0x2ae69d)[_0x25ed('0x10')](function(_0x56fea4){if(_0x56fea4){var _0x3150aa=_0x56fea4[_0x25ed('0x11')];var _0x2e9afe=null;for(_0x2e9afe=0x0;_0x2e9afe<_0x3150aa[_0x25ed('0x12')];_0x2e9afe++){if(_0x3150aa[_0x2e9afe][_0x25ed('0x13')]===_0x4eff1c[_0x25ed('0x14')]){_0x4eff1c[_0x25ed('0x15')]=_0x3150aa[_0x2e9afe]['id'];_0x27bc8f=!![];}}if(_0x27bc8f){logger[_0x25ed('0xf')]('Admin\x20found:',_0x4eff1c[_0x25ed('0x15')]);_0x1c4a50(_0x4eff1c);}else{_0x4d63fb({'statusCode':0x194,'message':_0x25ed('0x16')});}}else{_0x4d63fb({'statusCode':0x194,'message':_0x25ed('0x16')});}})['catch'](function(_0x2d3cac){logger[_0x25ed('0x17')]('['+[_0x4c11fd[_0x25ed('0x18')]()]+']',_0x2d3cac[_0x25ed('0x19')]);_0x4d63fb(_0x2d3cac);});});}function getUser(_0x544d1b,_0x1759cc,_0x2dd559){return function(_0x33a858){return new Promise(function(_0x7b476,_0x2feda0){var _0x2ccfcf={'method':_0x25ed('0xc'),'uri':_0x2dd559+'/api/selector/owners','json':!![]};_0x2ccfcf[_0x25ed('0xe')]=_0x1759cc;logger[_0x25ed('0xf')](_0x25ed('0x1a'));return rp(_0x2ccfcf)[_0x25ed('0x10')](function(_0x28ce81){if(_0x28ce81){var _0x463b22=_0x28ce81['users'];var _0x407a23=![];var _0x19591a=null;if(_0x33a858[_0x25ed('0x1b')]!==null){logger[_0x25ed('0xf')]('Getting\x20user\x20with\x20email',_0x33a858[_0x25ed('0x1b')]);_0x33a858[_0x25ed('0x1c')]=_0x33a858[_0x25ed('0x1b')];for(_0x19591a=0x0;_0x19591a<_0x463b22[_0x25ed('0x12')];_0x19591a++){if(_0x463b22[_0x19591a][_0x25ed('0x13')]===_0x33a858[_0x25ed('0x1b')]){_0x407a23=!![];_0x33a858[_0x25ed('0x1d')]=_0x463b22[_0x19591a]['id'];logger[_0x25ed('0xf')](_0x25ed('0x1e'),_0x33a858['userId']);}}}if(!_0x407a23){logger['info'](_0x25ed('0x1f'));_0x33a858[_0x25ed('0x1c')]=_0x33a858['adminEmail'];_0x33a858[_0x25ed('0x1d')]=_0x33a858[_0x25ed('0x15')];_0x407a23=!![];}if(_0x407a23){_0x7b476(_0x33a858);}else{_0x2feda0({'statusCode':0x194,'message':_0x25ed('0x16')});}}else{_0x2feda0({'statusCode':0x194,'message':_0x25ed('0x16')});}})[_0x25ed('0x20')](function(_0x254398){logger[_0x25ed('0x17')]('['+[_0x544d1b[_0x25ed('0x18')]()]+']',_0x254398[_0x25ed('0x19')]);_0x2feda0(_0x254398);});});};}function searchContact(_0x45251a,_0x4a7605,_0x332353,_0x2dce1d){return new Promise(function(_0x684543,_0x4b3628){var _0x5ee393={'method':_0x25ed('0xc'),'headers':_0x4a7605,'uri':_0x45251a+_0x25ed('0x21')+_0x2dce1d+'&f='+_0x332353+_0x25ed('0x22'),'json':!![]};rp(_0x5ee393)[_0x25ed('0x10')](function(_0x59bbe6){var _0x355ee0=_[_0x25ed('0x23')](_0x59bbe6['contacts'][_0x25ed('0x24')],[_0x332353,_0x2dce1d]);_0x684543(_0x355ee0);})[_0x25ed('0x20')](function(_0x154226){_0x4b3628(_0x154226);});});}function getEndUser(_0x56468a,_0xc67f1e,_0x2be125){return function(_0x495b75){return new Promise(function(_0x26b5d1,_0x344e33){logger[_0x25ed('0xf')](util[_0x25ed('0x25')]('Searching\x20contact\x20with\x20phone\x20%s',_0x495b75[_0x25ed('0x26')]));searchContact(_0x2be125,_0xc67f1e,_0x25ed('0x27'),_0x495b75[_0x25ed('0x26')])[_0x25ed('0x10')](function(_0x366cff){if(_0x366cff){_0x495b75[_0x25ed('0x28')]=_0x366cff['id'];logger[_0x25ed('0xf')]('Contact\x20found\x20mobile_number:',_0x495b75[_0x25ed('0x28')]);return _0x26b5d1(_0x495b75);}searchContact(_0x2be125,_0xc67f1e,_0x25ed('0x29'),_0x495b75[_0x25ed('0x26')])['then'](function(_0x4890cb){if(_0x4890cb){_0x495b75[_0x25ed('0x28')]=_0x4890cb['id'];logger[_0x25ed('0xf')](_0x25ed('0x2a'),_0x495b75[_0x25ed('0x28')]);return _0x26b5d1(_0x495b75);}createEndUser(_0x495b75,_0x56468a,_0xc67f1e,_0x2be125)['then'](function(_0x3df22d){logger[_0x25ed('0xf')](_0x25ed('0x2b'),_0x3df22d['endUserId']);return _0x26b5d1(_0x3df22d);});});})[_0x25ed('0x20')](function(_0x2ebbab){_0x344e33(_0x2ebbab);});});};}function createEndUser(_0x14601c,_0x89121c,_0x2cd2b6,_0x2c9d22){return new Promise(function(_0x205556,_0x167121){var _0x4da070=moment();var _0x4b0695={'method':_0x25ed('0x2c'),'uri':_0x2c9d22+_0x25ed('0x2d'),'body':{'contact':{'last_name':_0x14601c[_0x25ed('0x26')],'work_number':_0x14601c['contactNumber'],'mobile_number':_0x14601c[_0x25ed('0x26')],'owner_id':_0x14601c['userId'],'created_at':_0x4da070[_0x25ed('0x25')](_0x25ed('0x2e'))}},'json':!![]};_0x4b0695[_0x25ed('0xe')]=_0x2cd2b6;logger[_0x25ed('0xf')](_0x25ed('0x2f'));return rp(_0x4b0695)[_0x25ed('0x10')](function(_0x719812){_0x14601c['endUserId']=_0x719812[_0x25ed('0x30')]['id'];_0x205556(_0x14601c);})[_0x25ed('0x20')](function(_0x59943f){logger[_0x25ed('0x17')]('['+[_0x89121c[_0x25ed('0x18')]()]+']',_0x59943f[_0x25ed('0x19')]);_0x167121(_0x59943f[_0x25ed('0x19')]);});});}function getTicket(_0xb27d80,_0x13f188,_0x5de235,_0x96a470,_0x1de425){return function(_0x48a249){logger[_0x25ed('0xf')](_0x25ed('0x31'));return new Promise(function(_0x50bf27,_0x5e6f06){var _0x465a6a=moment();var _0x1845be={'method':_0x25ed('0x2c'),'uri':_0x5de235+_0x25ed('0x32'),'body':{'title':intUtil[_0x25ed('0x33')](_0x96a470[_0x25ed('0x34')],_0x1de425,'\x20'),'description':intUtil[_0x25ed('0x33')](_0x96a470['Descriptions'],_0x1de425,'\x0a'),'owner_id':_0x48a249['userId'],'creater_id':_0x48a249[_0x25ed('0x15')],'targetable_id':_0x48a249[_0x25ed('0x28')],'targetable_type':_0x25ed('0x35'),'created_at':_0x465a6a['format'](_0x25ed('0x2e')),'due_date':_0x465a6a[_0x25ed('0x36')](0x1e,'m')[_0x25ed('0x25')](_0x25ed('0x2e'))},'json':!![]};_0x1845be[_0x25ed('0xe')]=_0x13f188;return rp(_0x1845be)[_0x25ed('0x10')](function(_0x5587fa){_0x48a249['ticketId']=_0x5587fa['task']['id'];logger[_0x25ed('0xf')](_0x25ed('0x37'),_0x48a249[_0x25ed('0x38')]);_0x50bf27(_0x48a249);})[_0x25ed('0x20')](function(_0xade57b){logger[_0x25ed('0x17')]('['+[_0xb27d80[_0x25ed('0x18')]()]+']',_0xade57b[_0x25ed('0x19')]);_0x5e6f06(_0xade57b['message']);});});};}function emit(_0x4adbc2,_0x4e58cc,_0x5788b5){var _0x2dfc4e={'uri':_0x4adbc2+_0x25ed('0x39')+_0x5788b5};io['to'](util['format'](_0x25ed('0x3a'),_0x4e58cc))['emit']('trigger:browser:url',_0x2dfc4e);}exports['cs']=function(_0x479fd7,_0x1b0117,_0x5b0784,_0x5c18e9,_0x2c5ee9,_0xb802c5,_0x71e3c4,_0xa6316f){var _0x18637f={};var _0x56b2bf={'Authorization':_0x25ed('0x3b')+_0xb802c5[_0x25ed('0x3c')]};_0xb802c5[_0x25ed('0x3d')]=intUtil['stripTrailingSlash'](_0xb802c5[_0x25ed('0x3d')]);_0xb802c5[_0x25ed('0x3e')]=intUtil['stripTrailingSlash'](_0xb802c5[_0x25ed('0x3e')]);var _0x4e45f8=_0xb802c5['remoteUri'];_0x18637f[_0x25ed('0x14')]=_0xb802c5[_0x25ed('0x3f')];_0x18637f[_0x25ed('0x26')]=_0xa6316f['toLowerCase']()===_0x25ed('0x40')?_0x1b0117[_0x25ed('0x41')]:_0x1b0117[_0x25ed('0x42')];_0x18637f[_0x25ed('0x43')]=_0xa6316f==='queue'||_0xa6316f===_0x25ed('0x44')?'queue':_0x25ed('0x40');if(_0x5c18e9){_0x18637f[_0x25ed('0x1b')]=_0x5c18e9[_0x25ed('0x13')];}var _0x3b6d72=util[_0x25ed('0x25')](_0x25ed('0x45'),_0xb802c5[_0x25ed('0x3e')],_0x1b0117[_0x25ed('0x46')],md5(_0x1b0117[_0x25ed('0x46')]));if(_0x2c5ee9&&_0x2c5ee9['monitor_format']){logger[_0x25ed('0xf')]('[QUEUE]',_0x25ed('0x47'));_0x1b0117['recordingURL']=_0x3b6d72;}else if(_0x71e3c4&&_0x71e3c4[_0x25ed('0x48')]&&_0x71e3c4[_0x25ed('0x48')]!==_0x25ed('0x49')){logger[_0x25ed('0xf')](_0x25ed('0x4a'),_0x25ed('0x47'));_0x1b0117[_0x25ed('0x4b')]=_0x3b6d72;}else{_0x1b0117[_0x25ed('0x4b')]='';}return getAdminId(_0x18637f,_0xa6316f,_0x56b2bf,_0x4e45f8)['then'](getUser(_0xa6316f,_0x56b2bf,_0x4e45f8))[_0x25ed('0x10')](getEndUser(_0xa6316f,_0x56b2bf,_0x4e45f8))[_0x25ed('0x10')](getTicket(_0xa6316f,_0x56b2bf,_0x4e45f8,_0x5b0784,_0x1b0117))[_0x25ed('0x10')](function(_0x314ddf){logger[_0x25ed('0xf')](util[_0x25ed('0x25')](_0x25ed('0x4c'),_0x314ddf[_0x25ed('0x38')]));if(_0xa6316f!==_0x25ed('0x44')){logger[_0x25ed('0xf')]('['+[_0xa6316f[_0x25ed('0x18')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x4e45f8,_0x5c18e9[_0x25ed('0x4d')],_0x314ddf['endUserId']);}})[_0x25ed('0x20')](function(_0x544bcc){logger[_0x25ed('0x17')]('['+[_0xa6316f['toUpperCase']()]+_0x25ed('0x4e'),util['inspect'](_0x544bcc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x81b0=['toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','then','agentEmail','email','userId','User\x20found:','Admin\x20selected','userEmail','/api/lookup?q=','&f=','&entities=contact','find','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Descriptions','Contact','add','task','Task\x20created:','ticketId','/contacts/','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','lodash','md5','moment','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','info','Getting\x20admin\x20information','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x81b0,0x93));var _0x081b=function(_0xb71d11,_0x534077){_0xb71d11=_0xb71d11-0x0;var _0x4eb52f=_0x81b0[_0xb71d11];return _0x4eb52f;};'use strict';var _=require(_0x081b('0x0'));var rp=require('request-promise');var md5=require(_0x081b('0x1'));var util=require('util');var moment=require(_0x081b('0x2'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x081b('0x3'));var logger=require(_0x081b('0x4'))(_0x081b('0x5'));config[_0x081b('0x6')]=_[_0x081b('0x7')](config[_0x081b('0x6')],{'host':_0x081b('0x8'),'port':0x18eb});var io=require(_0x081b('0x9'))(new Redis(config[_0x081b('0x6')]));function getAdminId(_0x3773a7,_0x39b872,_0xf7377d,_0x244c53){return new Promise(function(_0x521bfd,_0x446212){var _0x5e9f4d=![];var _0x566f06={'method':_0x081b('0xa'),'uri':_0x244c53+'/api/selector/owners','json':!![]};_0x566f06['headers']=_0xf7377d;logger[_0x081b('0xb')](_0x081b('0xc'));return rp(_0x566f06)['then'](function(_0x243553){if(_0x243553){var _0x4df46c=_0x243553[_0x081b('0xd')];var _0x3fbb1c=null;for(_0x3fbb1c=0x0;_0x3fbb1c<_0x4df46c[_0x081b('0xe')];_0x3fbb1c++){if(_0x4df46c[_0x3fbb1c]['email']===_0x3773a7[_0x081b('0xf')]){_0x3773a7[_0x081b('0x10')]=_0x4df46c[_0x3fbb1c]['id'];_0x5e9f4d=!![];}}if(_0x5e9f4d){logger[_0x081b('0xb')](_0x081b('0x11'),_0x3773a7[_0x081b('0x10')]);_0x521bfd(_0x3773a7);}else{_0x446212({'statusCode':0x194,'message':_0x081b('0x12')});}}else{_0x446212({'statusCode':0x194,'message':_0x081b('0x12')});}})[_0x081b('0x13')](function(_0x5b81dd){logger[_0x081b('0x14')]('['+[_0x39b872[_0x081b('0x15')]()]+']',_0x5b81dd[_0x081b('0x16')]);_0x446212(_0x5b81dd);});});}function getUser(_0x16d402,_0x5dc7de,_0x13f678){return function(_0x2442b1){return new Promise(function(_0xf208f1,_0x4593a8){var _0x5438bd={'method':_0x081b('0xa'),'uri':_0x13f678+_0x081b('0x17'),'json':!![]};_0x5438bd['headers']=_0x5dc7de;logger[_0x081b('0xb')](_0x081b('0x18'));return rp(_0x5438bd)[_0x081b('0x19')](function(_0x862c8){if(_0x862c8){var _0x5a57c3=_0x862c8[_0x081b('0xd')];var _0x187f81=![];var _0x20429b=null;if(_0x2442b1[_0x081b('0x1a')]!==null){logger[_0x081b('0xb')]('Getting\x20user\x20with\x20email',_0x2442b1['agentEmail']);_0x2442b1['userEmail']=_0x2442b1['agentEmail'];for(_0x20429b=0x0;_0x20429b<_0x5a57c3[_0x081b('0xe')];_0x20429b++){if(_0x5a57c3[_0x20429b][_0x081b('0x1b')]===_0x2442b1['agentEmail']){_0x187f81=!![];_0x2442b1[_0x081b('0x1c')]=_0x5a57c3[_0x20429b]['id'];logger['info'](_0x081b('0x1d'),_0x2442b1[_0x081b('0x1c')]);}}}if(!_0x187f81){logger[_0x081b('0xb')](_0x081b('0x1e'));_0x2442b1[_0x081b('0x1f')]=_0x2442b1[_0x081b('0xf')];_0x2442b1[_0x081b('0x1c')]=_0x2442b1[_0x081b('0x10')];_0x187f81=!![];}if(_0x187f81){_0xf208f1(_0x2442b1);}else{_0x4593a8({'statusCode':0x194,'message':_0x081b('0x12')});}}else{_0x4593a8({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x081b('0x13')](function(_0x20d169){logger[_0x081b('0x14')]('['+[_0x16d402[_0x081b('0x15')]()]+']',_0x20d169[_0x081b('0x16')]);_0x4593a8(_0x20d169);});});};}function searchContact(_0x137a66,_0x94d1c4,_0x232337,_0x56a6ce){return new Promise(function(_0x3e338a,_0x495e8b){var _0x502c1b={'method':'GET','headers':_0x94d1c4,'uri':_0x137a66+_0x081b('0x20')+_0x56a6ce+_0x081b('0x21')+_0x232337+_0x081b('0x22'),'json':!![]};rp(_0x502c1b)[_0x081b('0x19')](function(_0xcae817){var _0x157486=_[_0x081b('0x23')](_0xcae817['contacts']['contacts'],[_0x232337,_0x56a6ce]);_0x3e338a(_0x157486);})[_0x081b('0x13')](function(_0x1d0c20){_0x495e8b(_0x1d0c20);});});}function getEndUser(_0x4ec9f6,_0x181007,_0x348628){return function(_0x92ac){return new Promise(function(_0x16e74f,_0x4cb864){logger[_0x081b('0xb')](util[_0x081b('0x24')](_0x081b('0x25'),_0x92ac[_0x081b('0x26')]));searchContact(_0x348628,_0x181007,_0x081b('0x27'),_0x92ac[_0x081b('0x26')])[_0x081b('0x19')](function(_0x237725){if(_0x237725){_0x92ac['endUserId']=_0x237725['id'];logger[_0x081b('0xb')](_0x081b('0x28'),_0x92ac[_0x081b('0x29')]);return _0x16e74f(_0x92ac);}searchContact(_0x348628,_0x181007,_0x081b('0x2a'),_0x92ac['contactNumber'])[_0x081b('0x19')](function(_0x67e4c4){if(_0x67e4c4){_0x92ac[_0x081b('0x29')]=_0x67e4c4['id'];logger[_0x081b('0xb')](_0x081b('0x2b'),_0x92ac[_0x081b('0x29')]);return _0x16e74f(_0x92ac);}createEndUser(_0x92ac,_0x4ec9f6,_0x181007,_0x348628)['then'](function(_0x2ba859){logger[_0x081b('0xb')](_0x081b('0x2c'),_0x2ba859[_0x081b('0x29')]);return _0x16e74f(_0x2ba859);});});})[_0x081b('0x13')](function(_0x3c9bf7){_0x4cb864(_0x3c9bf7);});});};}function createEndUser(_0x4acfe9,_0x314102,_0x5d4f2c,_0x328a4e){return new Promise(function(_0x3b98e9,_0x322d76){var _0x11855b=moment();var _0x10c0f8={'method':_0x081b('0x2d'),'uri':_0x328a4e+_0x081b('0x2e'),'body':{'contact':{'last_name':_0x4acfe9[_0x081b('0x26')],'work_number':_0x4acfe9['contactNumber'],'mobile_number':_0x4acfe9[_0x081b('0x26')],'owner_id':_0x4acfe9[_0x081b('0x1c')],'created_at':_0x11855b[_0x081b('0x24')](_0x081b('0x2f'))}},'json':!![]};_0x10c0f8[_0x081b('0x30')]=_0x5d4f2c;logger[_0x081b('0xb')](_0x081b('0x31'));return rp(_0x10c0f8)[_0x081b('0x19')](function(_0x45c803){_0x4acfe9[_0x081b('0x29')]=_0x45c803[_0x081b('0x32')]['id'];_0x3b98e9(_0x4acfe9);})[_0x081b('0x13')](function(_0x2934d1){logger[_0x081b('0x14')]('['+[_0x314102[_0x081b('0x15')]()]+']',_0x2934d1[_0x081b('0x16')]);_0x322d76(_0x2934d1[_0x081b('0x16')]);});});}function getTicket(_0x11598e,_0x2acb05,_0x5f403f,_0xe1bdb8,_0x49c276){return function(_0x4b887c){logger[_0x081b('0xb')]('Creating\x20new\x20task');return new Promise(function(_0x111b12,_0x297545){var _0x161e88=moment();var _0x3a4b8f={'method':_0x081b('0x2d'),'uri':_0x5f403f+_0x081b('0x33'),'body':{'title':intUtil[_0x081b('0x34')](_0xe1bdb8['Subjects'],_0x49c276,'\x20'),'description':intUtil['getString'](_0xe1bdb8[_0x081b('0x35')],_0x49c276,'\x0a'),'owner_id':_0x4b887c[_0x081b('0x1c')],'creater_id':_0x4b887c['adminId'],'targetable_id':_0x4b887c[_0x081b('0x29')],'targetable_type':_0x081b('0x36'),'created_at':_0x161e88['format'](_0x081b('0x2f')),'due_date':_0x161e88[_0x081b('0x37')](0x1e,'m')[_0x081b('0x24')](_0x081b('0x2f'))},'json':!![]};_0x3a4b8f[_0x081b('0x30')]=_0x2acb05;return rp(_0x3a4b8f)[_0x081b('0x19')](function(_0x13c144){_0x4b887c['ticketId']=_0x13c144[_0x081b('0x38')]['id'];logger[_0x081b('0xb')](_0x081b('0x39'),_0x4b887c[_0x081b('0x3a')]);_0x111b12(_0x4b887c);})[_0x081b('0x13')](function(_0x33c3b2){logger[_0x081b('0x14')]('['+[_0x11598e[_0x081b('0x15')]()]+']',_0x33c3b2[_0x081b('0x16')]);_0x297545(_0x33c3b2['message']);});});};}function emit(_0x49b13d,_0x4b7972,_0x516e86){var _0x1a77a4={'uri':_0x49b13d+_0x081b('0x3b')+_0x516e86};io['to'](util[_0x081b('0x24')]('user:%s',_0x4b7972))[_0x081b('0x3c')](_0x081b('0x3d'),_0x1a77a4);}exports['cs']=function(_0x35b756,_0x305d1f,_0x3cf3ca,_0x5d50fe,_0x2c7c58,_0x29ae17,_0x3b332a,_0x3be622){var _0x539bdc={};var _0x3217c7={'Authorization':_0x081b('0x3e')+_0x29ae17['apiKey']};_0x29ae17[_0x081b('0x3f')]=intUtil[_0x081b('0x40')](_0x29ae17[_0x081b('0x3f')]);_0x29ae17[_0x081b('0x41')]=intUtil[_0x081b('0x40')](_0x29ae17[_0x081b('0x41')]);var _0x36419b=_0x29ae17[_0x081b('0x3f')];_0x539bdc[_0x081b('0xf')]=_0x29ae17[_0x081b('0x42')];_0x539bdc[_0x081b('0x26')]=_0x3be622[_0x081b('0x43')]()===_0x081b('0x44')?_0x305d1f[_0x081b('0x45')]:_0x305d1f[_0x081b('0x46')];_0x539bdc[_0x081b('0x47')]=_0x3be622===_0x081b('0x48')||_0x3be622===_0x081b('0x49')?_0x081b('0x48'):_0x081b('0x44');if(_0x5d50fe){_0x539bdc[_0x081b('0x1a')]=_0x5d50fe[_0x081b('0x1b')];}var _0x11abe2=util[_0x081b('0x24')](_0x081b('0x4a'),_0x29ae17[_0x081b('0x41')],_0x305d1f[_0x081b('0x4b')],md5(_0x305d1f[_0x081b('0x4b')]));if(_0x2c7c58&&_0x2c7c58['monitor_format']){logger[_0x081b('0xb')](_0x081b('0x4c'),_0x081b('0x4d'));_0x305d1f[_0x081b('0x4e')]=_0x11abe2;}else if(_0x3b332a&&_0x3b332a[_0x081b('0x4f')]&&_0x3b332a['recordingFormat']!=='none'){logger[_0x081b('0xb')](_0x081b('0x50'),'Recording\x20is\x20enabled!');_0x305d1f[_0x081b('0x4e')]=_0x11abe2;}else{_0x305d1f['recordingURL']='';}return getAdminId(_0x539bdc,_0x3be622,_0x3217c7,_0x36419b)[_0x081b('0x19')](getUser(_0x3be622,_0x3217c7,_0x36419b))[_0x081b('0x19')](getEndUser(_0x3be622,_0x3217c7,_0x36419b))['then'](getTicket(_0x3be622,_0x3217c7,_0x36419b,_0x3cf3ca,_0x305d1f))[_0x081b('0x19')](function(_0x185c30){logger[_0x081b('0xb')](util[_0x081b('0x24')](_0x081b('0x51'),_0x185c30[_0x081b('0x3a')]));if(_0x3be622!==_0x081b('0x49')){logger[_0x081b('0xb')]('['+[_0x3be622[_0x081b('0x15')]()]+']',_0x081b('0x52'));emit(_0x36419b,_0x5d50fe[_0x081b('0x53')],_0x185c30['endUserId']);}})[_0x081b('0x13')](function(_0x196e11){logger[_0x081b('0x14')]('['+[_0x3be622['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x196e11,{'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 f90d63d..f7497ea 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 _0xea75=['./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','exec','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','freshsales','servicenow','log','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','data2','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger'];(function(_0x5678c2,_0xd8cb89){var _0x263105=function(_0x4bb4e9){while(--_0x4bb4e9){_0x5678c2['push'](_0x5678c2['shift']());}};_0x263105(++_0xd8cb89);}(_0xea75,0x90));var _0x5ea7=function(_0x2d24aa,_0x2e4d44){_0x2d24aa=_0x2d24aa-0x0;var _0x489d74=_0xea75[_0x2d24aa];return _0x489d74;};'use strict';var _=require('lodash');var util=require(_0x5ea7('0x0'));var zendesk=require(_0x5ea7('0x1'));var salesforce=require(_0x5ea7('0x2'));var sugarcrm=require(_0x5ea7('0x3'));var freshdesk=require(_0x5ea7('0x4'));var zoho=require(_0x5ea7('0x5'));var desk=require(_0x5ea7('0x6'));var vtiger=require(_0x5ea7('0x7'));var servicenow=require(_0x5ea7('0x8'));var dynamics365=require(_0x5ea7('0x9'));var freshsales=require('./freshsales');var integrations=[_0x5ea7('0xa'),_0x5ea7('0xb'),_0x5ea7('0xc'),_0x5ea7('0xd'),_0x5ea7('0xe'),_0x5ea7('0xf'),_0x5ea7('0x10'),'dynamics365','freshsales','servicenow'];exports[_0x5ea7('0x11')]=function(_0x395b99,_0x33e348,_0x83f232,_0x1be013,_0x290280,_0x13be05){if(_0x83f232){if(_['includes'](integrations,_0x395b99[_0x5ea7('0x12')][_0x5ea7('0x13')]())){try{var _0x1900f5=null;var _0x4de88b='';var _0xc4afa2=_0x83f232[_0x395b99[_0x5ea7('0x12')]['toLowerCase']()];if(_0xc4afa2){var _0x33feb4=_0xc4afa2[_0x395b99['data2']];if(_0x33feb4){var _0xac4ace=_[_0x5ea7('0x14')](_0x33feb4[_0x5ea7('0x15')],{'id':parseInt(_0x395b99[_0x5ea7('0x16')],0xa)});if(_0xac4ace){if(_0x1be013){if(_0x290280&&_0x33e348[_0x5ea7('0x17')]){_0x4de88b='queue';}else if(_0x33e348[_0x5ea7('0x18')]){_0x4de88b=_0x5ea7('0x19');}else{console['log'](_0x5ea7('0x1a'),_0x33e348);}}else{_0x4de88b=_0x5ea7('0x1b');}switch(_0x395b99[_0x5ea7('0x12')][_0x5ea7('0x13')]()){case _0x5ea7('0xa'):zendesk[_0x4de88b](_0x395b99,_0x33e348,_0xac4ace,_0x1be013,_0x290280,_0x33feb4,_0x13be05);break;case'salesforce':salesforce[_0x4de88b](_0x395b99,_0x33e348,_0xac4ace,_0x1be013,_0x290280,_0x33feb4,_0x13be05);break;case _0x5ea7('0xc'):sugarcrm[_0x4de88b](_0x395b99,_0x33e348,_0xac4ace,_0x1be013,_0x290280,_0x33feb4,_0x13be05);break;case _0x5ea7('0xd'):freshdesk[_0x4de88b](_0x395b99,_0x33e348,_0xac4ace,_0x1be013,_0x290280,_0x33feb4,_0x13be05);break;case'zoho':zoho[_0x4de88b](_0x395b99,_0x33e348,_0xac4ace,_0x1be013,_0x290280,_0x33feb4,_0x13be05);break;case _0x5ea7('0xf'):desk[_0x4de88b](_0x395b99,_0x33e348,_0xac4ace,_0x1be013,_0x290280,_0x33feb4,_0x13be05);break;case'vtiger':vtiger[_0x4de88b](_0x395b99,_0x33e348,_0xac4ace,_0x1be013,_0x290280,_0x33feb4,_0x13be05);break;case _0x5ea7('0x1c'):freshsales['cs'](_0x395b99,_0x33e348,_0xac4ace,_0x1be013,_0x290280,_0x33feb4,_0x13be05,_0x4de88b);break;case _0x5ea7('0x1d'):servicenow['cs'](_0x395b99,_0x33e348,_0xac4ace,_0x1be013,_0x290280,_0x33feb4,_0x13be05,_0x4de88b);break;case'dynamics365':dynamics365['cs'](_0x395b99,_0x33e348,_0xac4ace,_0x1be013,_0x290280,_0x33feb4,_0x13be05,_0x4de88b);break;default:console[_0x5ea7('0x1e')](_0x5ea7('0x1f'));}}else{_0x1900f5=require('../../../../config/logger')(_0x395b99['data1'][_0x5ea7('0x13')]());_0x1900f5[_0x5ea7('0x20')](_0x5ea7('0x21'),util[_0x5ea7('0x22')](_0x5ea7('0x23'),_0x395b99[_0x5ea7('0x12')][_0x5ea7('0x13')](),_0x395b99[_0x5ea7('0x16')]));}}else{_0x1900f5=require(_0x5ea7('0x24'))(_0x395b99[_0x5ea7('0x12')][_0x5ea7('0x13')]());_0x1900f5[_0x5ea7('0x20')](_0x5ea7('0x21'),util[_0x5ea7('0x22')]('%s\x20account\x20#%s\x20not\x20found',_0x395b99[_0x5ea7('0x12')]['toLowerCase'](),_0x395b99[_0x5ea7('0x25')]));}}else{}}catch(_0x3067f2){console[_0x5ea7('0x20')](_0x3067f2);}}}}; \ No newline at end of file +var _0xdeca=['./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','routeId','sugarcrm','freshdesk','log','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xdeca,0x1b8));var _0xadec=function(_0x33eafa,_0x96575f){_0x33eafa=_0x33eafa-0x0;var _0x308a1d=_0xdeca[_0x33eafa];return _0x308a1d;};'use strict';var _=require(_0xadec('0x0'));var util=require(_0xadec('0x1'));var zendesk=require(_0xadec('0x2'));var salesforce=require(_0xadec('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xadec('0x4'));var zoho=require(_0xadec('0x5'));var desk=require(_0xadec('0x6'));var vtiger=require(_0xadec('0x7'));var servicenow=require(_0xadec('0x8'));var dynamics365=require(_0xadec('0x9'));var freshsales=require('./freshsales');var integrations=[_0xadec('0xa'),_0xadec('0xb'),'sugarcrm','freshdesk',_0xadec('0xc'),_0xadec('0xd'),_0xadec('0xe'),_0xadec('0xf'),_0xadec('0x10'),_0xadec('0x11')];exports[_0xadec('0x12')]=function(_0x3e4517,_0x3c5c79,_0x5f35e3,_0x1c8323,_0x83b06b,_0x4369d3){if(_0x5f35e3){if(_[_0xadec('0x13')](integrations,_0x3e4517[_0xadec('0x14')]['toLowerCase']())){try{var _0x4e4547=null;var _0x3724ef='';var _0x35502d=_0x5f35e3[_0x3e4517[_0xadec('0x14')][_0xadec('0x15')]()];if(_0x35502d){var _0x8624a5=_0x35502d[_0x3e4517['data2']];if(_0x8624a5){var _0xca5245=_[_0xadec('0x16')](_0x8624a5[_0xadec('0x17')],{'id':parseInt(_0x3e4517[_0xadec('0x18')],0xa)});if(_0xca5245){if(_0x1c8323){if(_0x83b06b&&_0x3c5c79['queue']){_0x3724ef=_0xadec('0x19');}else if(_0x3c5c79[_0xadec('0x1a')]){_0x3724ef='outbound';}else{console['log']('EVENT\x20UNKNOWN',_0x3c5c79);}}else{_0x3724ef='unmanaged';}switch(_0x3e4517[_0xadec('0x14')][_0xadec('0x15')]()){case _0xadec('0xa'):zendesk[_0x3724ef](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3);break;case _0xadec('0xb'):salesforce[_0x3724ef](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3);break;case _0xadec('0x1b'):sugarcrm[_0x3724ef](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3);break;case _0xadec('0x1c'):freshdesk[_0x3724ef](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3);break;case _0xadec('0xc'):zoho[_0x3724ef](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3);break;case _0xadec('0xd'):desk[_0x3724ef](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3);break;case'vtiger':vtiger[_0x3724ef](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3);break;case _0xadec('0x10'):freshsales['cs'](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3,_0x3724ef);break;case'servicenow':servicenow['cs'](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3,_0x3724ef);break;case _0xadec('0xf'):dynamics365['cs'](_0x3e4517,_0x3c5c79,_0xca5245,_0x1c8323,_0x83b06b,_0x8624a5,_0x4369d3,_0x3724ef);break;default:console[_0xadec('0x1d')]('unknown\x20integration');}}else{_0x4e4547=require(_0xadec('0x1e'))(_0x3e4517['data1'][_0xadec('0x15')]());_0x4e4547[_0xadec('0x1f')](_0xadec('0x20'),util[_0xadec('0x21')](_0xadec('0x22'),_0x3e4517[_0xadec('0x14')]['toLowerCase'](),_0x3e4517['data3']));}}else{_0x4e4547=require(_0xadec('0x1e'))(_0x3e4517['data1'][_0xadec('0x15')]());_0x4e4547[_0xadec('0x1f')](_0xadec('0x20'),util['format'](_0xadec('0x23'),_0x3e4517[_0xadec('0x14')]['toLowerCase'](),_0x3e4517[_0xadec('0x24')]));}}else{}}catch(_0x5a487e){console['error'](_0x5a487e);}}}}; \ 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 f41f610..f266c21 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 _0x70bc=['Agent\x20%s\x20found.','resolve','Name','identity','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','Company','No\x20Company','forEach','includes','string','picklist','idField','content','variableName','toString','customVariable','Variable','name','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','calleridname','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','instanceUrl','error','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil','lodash','moment','md5','util','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','User','find','execute','then','length','Email'];(function(_0x53c076,_0x2be7b7){var _0x46cfe7=function(_0x2fabe8){while(--_0x2fabe8){_0x53c076['push'](_0x53c076['shift']());}};_0x46cfe7(++_0x2be7b7);}(_0x70bc,0x1c6));var _0xc70b=function(_0x40d191,_0x45e3c8){_0x40d191=_0x40d191-0x0;var _0x47a93e=_0x70bc[_0x40d191];return _0x47a93e;};'use strict';var _=require(_0xc70b('0x0'));var rp=require('request-promise');var moment=require(_0xc70b('0x1'));var BPromise=require('bluebird');var md5=require(_0xc70b('0x2'));var jsforce=require('jsforce');var util=require(_0xc70b('0x3'));var Redis=require('ioredis');var intUtil=require(_0xc70b('0x4'));var config=require(_0xc70b('0x5'));var logger=require(_0xc70b('0x6'))(_0xc70b('0x7'));config['redis']=_[_0xc70b('0x8')](config[_0xc70b('0x9')],{'host':_0xc70b('0xa'),'port':0x18eb});var io=require(_0xc70b('0xb'))(new Redis(config[_0xc70b('0x9')]));function emit(_0x16b0e9,_0x2d4615,_0x4c9825){io['to'](_0x16b0e9)[_0xc70b('0xc')](_0x2d4615,_0x4c9825);}function getTicket(_0x5cf5f2,_0x51a6f9,_0xeedaf1,_0x4b50b4,_0x47ebb3,_0x10ce8d,_0x3a5bb6,_0x3cf8ff){var _0x459de6=Object[_0xc70b('0xd')]({},{'OwnerId':_0x51a6f9['id'],'Subject':intUtil[_0xc70b('0xe')](_0x4b50b4[_0xc70b('0xf')],_0x47ebb3,'\x20'),'Description':intUtil[_0xc70b('0xe')](_0x4b50b4[_0xc70b('0x10')],_0x47ebb3,'\x0a')},getCustomFields(_0x10ce8d,_0x47ebb3));if(_0xeedaf1){if(_0x4b50b4[_0xc70b('0x11')]==='Task'){_0x459de6[_0xc70b('0x12')]=moment[_0xc70b('0x13')]();_0x459de6[_0xc70b('0x14')]=![];_0x459de6[_0xc70b('0x15')]=![];if(_0xeedaf1[_0xc70b('0x16')]===_0xc70b('0x17')||_0xeedaf1[_0xc70b('0x16')]===_0xc70b('0x18')){_0x459de6[_0xc70b('0x19')]=_0xeedaf1['id'];}else if(_0xeedaf1['endUserType']===_0xc70b('0x1a')){_0x459de6['WhatId']=_0xeedaf1['id'];}}else if(_0x4b50b4[_0xc70b('0x11')]===_0xc70b('0x1b')){if(_0xeedaf1[_0xc70b('0x16')]===_0xc70b('0x17')){_0x459de6[_0xc70b('0x1c')]=_0xeedaf1['id'];}else if(_0xeedaf1[_0xc70b('0x16')]===_0xc70b('0x1a')){_0x459de6[_0xc70b('0x1d')]=_0xeedaf1['id'];}else if(_0xeedaf1[_0xc70b('0x16')]===_0xc70b('0x18')&&_0x4b50b4[_0xc70b('0x1e')]){_0x459de6[_0x4b50b4[_0xc70b('0x1e')]]=_0xeedaf1['id'];}else{logger[_0xc70b('0x1f')](_0xc70b('0x20'));}}}return _0x3a5bb6[_0xc70b('0x21')](_0x4b50b4[_0xc70b('0x11')])[_0xc70b('0x22')](_0x459de6);}function getUser(_0x4866e7,_0x5c46d9,_0x355d1f){if(!_['isNil'](_0x5c46d9)&&intUtil[_0xc70b('0x23')](_0x5c46d9)){var _0x594e6e={'Email':_0x5c46d9};var _0x3763e8={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x355d1f[_0xc70b('0x21')](_0xc70b('0x24'))[_0xc70b('0x25')](_0x594e6e,_0x3763e8)[_0xc70b('0x26')]()[_0xc70b('0x27')](function(_0x4c6121){if(_0x4c6121[_0xc70b('0x28')]){var _0x27e5c6=_[_0xc70b('0x25')](_0x4c6121,function(_0xa52eb1){return _0xa52eb1[_0xc70b('0x29')]===_0x5c46d9;});if(_0x27e5c6){logger['info'](_0xc70b('0x2a'),_0x5c46d9);return BPromise[_0xc70b('0x2b')]({'id':_0x27e5c6['Id'],'name':_0x27e5c6[_0xc70b('0x2c')]});}}else{logger[_0xc70b('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5c46d9);return _0x355d1f[_0xc70b('0x2d')]()[_0xc70b('0x27')](function(_0x5c14f8){return BPromise[_0xc70b('0x2b')]({'id':_0x5c14f8['user_id'],'name':_0x5c14f8[_0xc70b('0x2e')]});});}});}else{logger['info'](_0xc70b('0x2f'),_0x5c46d9);return _0x355d1f[_0xc70b('0x2d')]()[_0xc70b('0x27')](function(_0x22db0a){return BPromise[_0xc70b('0x2b')]({'id':_0x22db0a[_0xc70b('0x30')],'name':_0x22db0a[_0xc70b('0x2e')]});});}}function getEndUser(_0x1fd0bb,_0x35ceeb,_0x31df71,_0x3cbcc6,_0x18be1f){var _0x1fde04={'$or':{'Phone':_0x3cbcc6}};var _0x5d4545={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xc70b('0x2b')]()['then'](function(){logger[_0xc70b('0x1f')](_0xc70b('0x31'),_0x3cbcc6,_0x35ceeb['moduleSearch']);switch(_0x35ceeb[_0xc70b('0x32')]){case _0xc70b('0x33'):var _0x4ef9c8=_[_0xc70b('0x34')](_0x1fde04);if(_0x35ceeb[_0xc70b('0x35')]){var _0x4088a8={};_0x4088a8[_0x35ceeb[_0xc70b('0x35')]]=_0x3cbcc6;_[_0xc70b('0x36')](_0x4ef9c8['$or'],_0x4088a8);}return _0x18be1f['sobject'](_0xc70b('0x37'))[_0xc70b('0x25')](_0x4ef9c8,_0x5d4545)[_0xc70b('0x26')]()[_0xc70b('0x27')](function(_0x4854a5){if(_0x4854a5&&_0x4854a5['length']){return _0x4854a5;}else{var _0x56353b=_[_0xc70b('0x34')](_0x1fde04);if(_0x35ceeb['additionalSearchLead']){var _0x383f3e={};_0x383f3e[_0x35ceeb[_0xc70b('0x38')]]=_0x3cbcc6;_[_0xc70b('0x36')](_0x56353b[_0xc70b('0x39')],_0x383f3e);}return _0x18be1f[_0xc70b('0x21')](_0xc70b('0x3a'))[_0xc70b('0x25')](_0x56353b,_0x5d4545);}});case _0xc70b('0x3b'):var _0x5a3f80=_['cloneDeep'](_0x1fde04);if(_0x35ceeb[_0xc70b('0x3c')]){var _0x4088a8={};_0x4088a8[_0x35ceeb['additionalSearchAccount']]=_0x3cbcc6;_['merge'](_0x5a3f80[_0xc70b('0x39')],_0x4088a8);}return _0x18be1f[_0xc70b('0x21')]('Account')[_0xc70b('0x25')](_0x5a3f80,_0x5d4545)[_0xc70b('0x26')]()[_0xc70b('0x27')](function(_0xcac420){if(_0xcac420&&_0xcac420[_0xc70b('0x28')]){return _0xcac420;}else{var _0x402c0c=_[_0xc70b('0x34')](_0x1fde04);if(_0x35ceeb[_0xc70b('0x35')]){var _0x1c7e6c={};_0x1c7e6c[_0x35ceeb['additionalSearchContact']]=_0x3cbcc6;_[_0xc70b('0x36')](_0x402c0c['$or'],_0x1c7e6c);}return _0x18be1f[_0xc70b('0x21')](_0xc70b('0x37'))['find'](_0x402c0c,_0x5d4545)[_0xc70b('0x27')](function(_0x336506){if(_0x336506&&_0x336506['length']){return _0x336506;}else{var _0x237a3a=_[_0xc70b('0x34')](_0x1fde04);if(_0x35ceeb[_0xc70b('0x38')]){var _0x2b06bb={};_0x2b06bb[_0x35ceeb[_0xc70b('0x38')]]=_0x3cbcc6;_[_0xc70b('0x36')](_0x237a3a[_0xc70b('0x39')],_0x2b06bb);}return _0x18be1f[_0xc70b('0x21')]('Lead')[_0xc70b('0x25')](_0x237a3a,_0x5d4545);}});}});case _0xc70b('0x17'):var _0x4ef9c8=_[_0xc70b('0x34')](_0x1fde04);if(_0x35ceeb[_0xc70b('0x35')]){var _0x4088a8={};_0x4088a8[_0x35ceeb[_0xc70b('0x35')]]=_0x3cbcc6;_['merge'](_0x4ef9c8[_0xc70b('0x39')],_0x4088a8);}return _0x18be1f[_0xc70b('0x21')](_0xc70b('0x37'))[_0xc70b('0x25')](_0x4ef9c8,_0x5d4545)[_0xc70b('0x26')]();case _0xc70b('0x18'):var _0x293ba9=_[_0xc70b('0x34')](_0x1fde04);if(_0x35ceeb['additionalSearchLead']){var _0x4088a8={};_0x4088a8[_0x35ceeb[_0xc70b('0x38')]]=_0x3cbcc6;_['merge'](_0x293ba9[_0xc70b('0x39')],_0x4088a8);}return _0x18be1f[_0xc70b('0x21')](_0xc70b('0x3a'))[_0xc70b('0x25')](_0x293ba9,_0x5d4545);case _0xc70b('0x1a'):var _0x5a3f80=_[_0xc70b('0x34')](_0x1fde04);if(_0x35ceeb[_0xc70b('0x3c')]){var _0x4088a8={};_0x4088a8[_0x35ceeb[_0xc70b('0x3c')]]=_0x3cbcc6;_[_0xc70b('0x36')](_0x5a3f80['$or'],_0x4088a8);}return _0x18be1f['sobject'](_0xc70b('0x3d'))['find'](_0x5a3f80,_0x5d4545);default:return null;}})[_0xc70b('0x27')](function(_0x273199){if(_0x273199&&_0x273199[_0xc70b('0x28')]){var _0x34d7f5=_['first'](_0x273199);if(_0x34d7f5){return BPromise[_0xc70b('0x2b')]({'id':_0x34d7f5['Id'],'name':_0x34d7f5[_0xc70b('0x2c')],'phone':_0x34d7f5['Phone'],'endUserType':_0x34d7f5['attributes'][_0xc70b('0x3e')][_0xc70b('0x3f')]()});}}})[_0xc70b('0x27')](function(_0x230f49){if(_0x230f49){logger[_0xc70b('0x1f')](_0xc70b('0x40'),_0x230f49['endUserType'],_0x3cbcc6);return BPromise['resolve'](_0x230f49);}else{logger['info'](_0xc70b('0x41'),_0x3cbcc6);var _0x5463e3={'Phone':_0x3cbcc6};if(_0x35ceeb[_0xc70b('0x42')]){if(_0x35ceeb['moduleCreate']==='contact'){logger[_0xc70b('0x1f')](_0xc70b('0x43'),_0x3cbcc6,_0x35ceeb[_0xc70b('0x42')]);_0x5463e3[_0xc70b('0x44')]=_0x31df71!==''?_0x31df71:util[_0xc70b('0x45')](_0xc70b('0x46'),_0x3cbcc6);}else if(_0x35ceeb[_0xc70b('0x42')]===_0xc70b('0x18')){logger[_0xc70b('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3cbcc6,_0x35ceeb[_0xc70b('0x42')]);_0x5463e3[_0xc70b('0x44')]=_0x31df71!==_0xc70b('0x47')?_0x31df71:util[_0xc70b('0x45')](_0xc70b('0x46'),_0x3cbcc6);_0x5463e3[_0xc70b('0x48')]=_0xc70b('0x49');}else if(_0x35ceeb[_0xc70b('0x42')]===_0xc70b('0x1a')){logger['info'](_0xc70b('0x43'),_0x3cbcc6,_0x35ceeb[_0xc70b('0x42')]);_0x5463e3[_0xc70b('0x2c')]=_0x31df71!==_0xc70b('0x47')?_0x31df71:util[_0xc70b('0x45')](_0xc70b('0x46'),_0x3cbcc6);}else{return null;}}return _0x18be1f[_0xc70b('0x21')](_['upperFirst'](_0x35ceeb[_0xc70b('0x42')]))[_0xc70b('0x22')](_0x5463e3)[_0xc70b('0x27')](function(_0x5484ac){return BPromise['resolve']({'id':_0x5484ac['id'],'endUserType':_0x35ceeb[_0xc70b('0x42')]});});}});}function getCustomFields(_0x1f020f,_0x241b32){var _0x5d23b5={};if(_0x1f020f[_0xc70b('0x28')]>0x0){_[_0xc70b('0x4a')](_0x1f020f,function(_0x3d0108){if(_[_0xc70b('0x4b')]([_0xc70b('0x4c'),_0xc70b('0x4d')],_0x3d0108[_0xc70b('0x3e')])&&_0x3d0108[_0xc70b('0x4e')]){_0x5d23b5[_0x3d0108[_0xc70b('0x4e')]]=_0x3d0108[_0xc70b('0x4f')]['toString']();}else if(_0x3d0108[_0xc70b('0x3e')]==='variable'&&_0x3d0108[_0xc70b('0x50')]&&_0x3d0108[_0xc70b('0x4e')]){_0x241b32[_0x3d0108[_0xc70b('0x50')]]&&(_0x5d23b5[_0x3d0108[_0xc70b('0x4e')]]=_0x241b32[_0x3d0108[_0xc70b('0x50')]][_0xc70b('0x51')]());}else if(_0x3d0108['type']===_0xc70b('0x52')&&_0x3d0108[_0xc70b('0x53')]&&_0x3d0108[_0xc70b('0x53')][_0xc70b('0x54')]&&_0x3d0108[_0xc70b('0x4e')]){_0x241b32[_0x3d0108[_0xc70b('0x53')][_0xc70b('0x54')]['toLowerCase']()]&&(_0x5d23b5[_0x3d0108[_0xc70b('0x4e')]]=_0x241b32[_0x3d0108[_0xc70b('0x53')][_0xc70b('0x54')][_0xc70b('0x3f')]()][_0xc70b('0x51')]());}});}return _0x5d23b5;}function getConnection(_0x2d8925){var _0x35a247=_0x2d8925['password']['concat'](_0x2d8925[_0xc70b('0x55')]);var _0x147d56=new jsforce[(_0xc70b('0x56'))]({'oauth2':{'loginUrl':_0x2d8925[_0xc70b('0x57')]||_0xc70b('0x58'),'clientId':_0x2d8925[_0xc70b('0x59')],'clientSecret':_0x2d8925['clientSecret']}});return _0x147d56[_0xc70b('0x5a')](_0x2d8925[_0xc70b('0x5b')],_0x35a247)[_0xc70b('0x27')](function(){logger['info'](_0xc70b('0x5c'));return _0x147d56;});}exports[_0xc70b('0x5d')]=function(_0x2985cf,_0x9a8781,_0x50efde,_0x5d13d8,_0xeb9b81,_0x4051db){var _0x10fc67,_0x2393b0,_0x575a7d,_0x26b0de;_0x4051db[_0xc70b('0x5e')]=intUtil[_0xc70b('0x5f')](_0x4051db[_0xc70b('0x5e')]);_0x4051db[_0xc70b('0x57')]=intUtil[_0xc70b('0x5f')](_0x4051db[_0xc70b('0x57')]);if(_0xeb9b81&&_0xeb9b81[_0xc70b('0x60')]){logger[_0xc70b('0x1f')](_0xc70b('0x61'),_0xc70b('0x62'));_0x9a8781['recordingURL']=util[_0xc70b('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4051db[_0xc70b('0x5e')],_0x9a8781[_0xc70b('0x63')],md5(_0x9a8781[_0xc70b('0x63')]));}else{_0x9a8781[_0xc70b('0x64')]='';}return getConnection(_0x4051db)[_0xc70b('0x27')](function(_0x717871){_0x26b0de=_0x717871;return getUser(_0x4051db,_0x5d13d8['email'],_0x26b0de);})[_0xc70b('0x27')](function(_0x14a97e){_0x10fc67=_0x14a97e;return getEndUser(_0x4051db,_0x50efde,_0x9a8781[_0xc70b('0x65')],_0x9a8781[_0xc70b('0x66')],_0x26b0de);})['then'](function(_0x1b155b){_0x2393b0=_0x1b155b;return getTicket(_0x4051db,_0x10fc67,_0x2393b0,_0x50efde,_0x9a8781,_0x50efde['Fields'],_0x26b0de,_0xc70b('0x5d'));})[_0xc70b('0x27')](function(_0x54df91){_0x575a7d=_0x54df91;logger[_0xc70b('0x1f')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x575a7d['id']);logger[_0xc70b('0x1f')](_0xc70b('0x67'),_0x575a7d['id'],_0x5d13d8[_0xc70b('0x54')],_0x4051db[_0xc70b('0x3e')]);switch(_0x4051db[_0xc70b('0x3e')]){case _0xc70b('0x68'):emit(util[_0xc70b('0x45')](_0xc70b('0x69'),_0x5d13d8['name']),'trigger:salesforce:display',{'recordId':_0x575a7d['id']});break;case _0xc70b('0x6a'):emit(util[_0xc70b('0x45')](_0xc70b('0x69'),_0x5d13d8[_0xc70b('0x54')]),_0xc70b('0x6b'),{'uri':util[_0xc70b('0x45')]('%s/%s/e',_0x26b0de[_0xc70b('0x6c')],_0x575a7d['id'])});break;default:logger[_0xc70b('0x6d')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xc70b('0x6e')](function(_0xfc9803){logger[_0xc70b('0x6d')](_0xc70b('0x61'),_0xfc9803);});};exports[_0xc70b('0x6f')]=function(_0x33dadd,_0x223dee,_0x2e85f1,_0xff5b20,_0x42b1c4,_0x3b7119,_0x1fcd72){var _0x9591f5,_0x147876,_0x3c2e45,_0x46e384;_0x3b7119[_0xc70b('0x5e')]=intUtil[_0xc70b('0x5f')](_0x3b7119[_0xc70b('0x5e')]);_0x3b7119['remoteUri']=intUtil[_0xc70b('0x5f')](_0x3b7119['remoteUri']);if(_0x1fcd72&&_0x1fcd72[_0xc70b('0x70')]&&_0x1fcd72[_0xc70b('0x70')]!==_0xc70b('0x71')){logger[_0xc70b('0x1f')](_0xc70b('0x72'),_0xc70b('0x62'));_0x223dee[_0xc70b('0x64')]=util[_0xc70b('0x45')](_0xc70b('0x73'),_0x3b7119[_0xc70b('0x5e')],_0x223dee[_0xc70b('0x63')],md5(_0x223dee['uniqueid']));}return getConnection(_0x3b7119)[_0xc70b('0x27')](function(_0x3b1872){_0x46e384=_0x3b1872;return getUser(_0x3b7119,_0xff5b20[_0xc70b('0x74')],_0x46e384);})[_0xc70b('0x27')](function(_0x2222be){_0x9591f5=_0x2222be;return getEndUser(_0x3b7119,_0x2e85f1,_0x223dee['destcalleridname'],_0x223dee['destcalleridnum'],_0x46e384);})[_0xc70b('0x27')](function(_0x35e883){_0x147876=_0x35e883;return getTicket(_0x3b7119,_0x9591f5,_0x147876,_0x2e85f1,_0x223dee,_0x2e85f1[_0xc70b('0x75')],_0x46e384,_0xc70b('0x6f'));})[_0xc70b('0x27')](function(_0x2c2216){_0x3c2e45=_0x2c2216;logger[_0xc70b('0x1f')](_0xc70b('0x76'),_0x3c2e45['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3c2e45['id'],_0xff5b20['name'],_0x3b7119['type']);switch(_0x3b7119[_0xc70b('0x3e')]){case _0xc70b('0x68'):emit(util['format'](_0xc70b('0x69'),_0xff5b20['name']),'trigger:salesforce:display',{'recordId':_0x3c2e45['id']});break;case _0xc70b('0x6a'):emit(util[_0xc70b('0x45')](_0xc70b('0x69'),_0xff5b20[_0xc70b('0x54')]),'trigger:browser:url',{'uri':util[_0xc70b('0x45')]('%s/%s/e',_0x46e384[_0xc70b('0x6c')],_0x3c2e45['id'])});break;default:logger[_0xc70b('0x6d')]('[OUTBOUND]',_0xc70b('0x77'));}})[_0xc70b('0x6e')](function(_0x1643f7){logger[_0xc70b('0x6d')]('[OUTBOUND]',_0x1643f7);});};exports[_0xc70b('0x78')]=function(_0x15c42e,_0x3a8a43,_0x5eea39,_0x43bfe6,_0x404342,_0x343e89){var _0x34bdc0,_0x226f3e,_0x3ca6cf,_0x9c961;_0x343e89['serverUrl']=intUtil[_0xc70b('0x5f')](_0x343e89[_0xc70b('0x5e')]);_0x343e89['remoteUri']=intUtil[_0xc70b('0x5f')](_0x343e89[_0xc70b('0x57')]);if(_0x404342&&_0x404342[_0xc70b('0x60')]){logger['info']('['+_0x3a8a43[_0xc70b('0x79')][_0xc70b('0x7a')]()+']','Recording\x20is\x20enabled!');_0x3a8a43[_0xc70b('0x64')]=util[_0xc70b('0x45')](_0xc70b('0x73'),_0x343e89[_0xc70b('0x5e')],_0x3a8a43['uniqueid'],md5(_0x3a8a43[_0xc70b('0x63')]));}else{_0x3a8a43[_0xc70b('0x64')]='';}return getConnection(_0x343e89)[_0xc70b('0x27')](function(_0x23c1e4){_0x9c961=_0x23c1e4;if(!_[_0xc70b('0x7b')](_0x43bfe6)){return getUser(_0x343e89,_0x43bfe6[_0xc70b('0x54')],_0x9c961);}else{return getUser(_0x343e89,null,_0x9c961);}})[_0xc70b('0x27')](function(_0x516202){_0x34bdc0=_0x516202;return getEndUser(_0x343e89,_0x5eea39,_0x3a8a43[_0xc70b('0x65')],_0x3a8a43[_0xc70b('0x66')],_0x9c961);})[_0xc70b('0x27')](function(_0x4a1a1b){_0x226f3e=_0x4a1a1b;return getTicket(_0x343e89,_0x34bdc0,_0x226f3e,_0x5eea39,_0x3a8a43,_0x5eea39[_0xc70b('0x75')],_0x9c961);})[_0xc70b('0x27')](function(_0x34a3ec){_0x3ca6cf=_0x34a3ec;logger[_0xc70b('0x1f')]('['+_0x3a8a43[_0xc70b('0x79')][_0xc70b('0x7a')]()+']\x20Ticket\x20%s\x20created.',_0x3ca6cf['id']);logger['info']('['+_0x3a8a43[_0xc70b('0x79')][_0xc70b('0x7a')]()+']\x20Integration\x20account\x20type\x20%s.',_0x343e89[_0xc70b('0x3e')]);})[_0xc70b('0x6e')](function(_0x259531){logger[_0xc70b('0x6d')]('['+_0x3a8a43[_0xc70b('0x79')]['toUpperCase']()+']',_0x259531);});}; \ No newline at end of file +var _0x7e5c=['account_contact_lead','additionalSearchAccount','Account','Lead','first','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','securityToken','Connection','remoteUri','clientSecret','username','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','trigger:browser:url','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','error','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','%s/%s/e','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','moment','jsforce','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','Task','ActivityDate','IsRecurrence','endUserType','lead','WhatId','ticketType','Case','contact','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','User','execute','then','length','find','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','sobject','Contact','additionalSearchLead'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7e5c,0xc6));var _0xc7e5=function(_0x5d2d9,_0x1f79ce){_0x5d2d9=_0x5d2d9-0x0;var _0x250ef3=_0x7e5c[_0x5d2d9];return _0x250ef3;};'use strict';var _=require(_0xc7e5('0x0'));var rp=require('request-promise');var moment=require(_0xc7e5('0x1'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0xc7e5('0x2'));var util=require('util');var Redis=require(_0xc7e5('0x3'));var intUtil=require(_0xc7e5('0x4'));var config=require(_0xc7e5('0x5'));var logger=require('../../../../config/logger')(_0xc7e5('0x6'));config[_0xc7e5('0x7')]=_[_0xc7e5('0x8')](config['redis'],{'host':_0xc7e5('0x9'),'port':0x18eb});var io=require(_0xc7e5('0xa'))(new Redis(config[_0xc7e5('0x7')]));function emit(_0xd98d6c,_0x58c1e2,_0x17b0e6){io['to'](_0xd98d6c)[_0xc7e5('0xb')](_0x58c1e2,_0x17b0e6);}function getTicket(_0x23d506,_0x2d9f56,_0x351966,_0x2aaea9,_0x5d0690,_0x2ed8e4,_0x83aef0,_0x924e53){var _0x2d10da=Object[_0xc7e5('0xc')]({},{'OwnerId':_0x2d9f56['id'],'Subject':intUtil[_0xc7e5('0xd')](_0x2aaea9[_0xc7e5('0xe')],_0x5d0690,'\x20'),'Description':intUtil[_0xc7e5('0xd')](_0x2aaea9[_0xc7e5('0xf')],_0x5d0690,'\x0a')},getCustomFields(_0x2ed8e4,_0x5d0690));if(_0x351966){if(_0x2aaea9['ticketType']===_0xc7e5('0x10')){_0x2d10da[_0xc7e5('0x11')]=moment['utc']();_0x2d10da['IsReminderSet']=![];_0x2d10da[_0xc7e5('0x12')]=![];if(_0x351966['endUserType']==='contact'||_0x351966[_0xc7e5('0x13')]===_0xc7e5('0x14')){_0x2d10da['WhoId']=_0x351966['id'];}else if(_0x351966[_0xc7e5('0x13')]==='account'){_0x2d10da[_0xc7e5('0x15')]=_0x351966['id'];}}else if(_0x2aaea9[_0xc7e5('0x16')]===_0xc7e5('0x17')){if(_0x351966[_0xc7e5('0x13')]===_0xc7e5('0x18')){_0x2d10da[_0xc7e5('0x19')]=_0x351966['id'];}else if(_0x351966[_0xc7e5('0x13')]===_0xc7e5('0x1a')){_0x2d10da[_0xc7e5('0x1b')]=_0x351966['id'];}else if(_0x351966[_0xc7e5('0x13')]===_0xc7e5('0x14')&&_0x2aaea9[_0xc7e5('0x1c')]){_0x2d10da[_0x2aaea9[_0xc7e5('0x1c')]]=_0x351966['id'];}else{logger[_0xc7e5('0x1d')](_0xc7e5('0x1e'));}}}return _0x83aef0['sobject'](_0x2aaea9['ticketType'])[_0xc7e5('0x1f')](_0x2d10da);}function getUser(_0x559898,_0x10373f,_0x12d863){if(!_[_0xc7e5('0x20')](_0x10373f)&&intUtil[_0xc7e5('0x21')](_0x10373f)){var _0x47e749={'Email':_0x10373f};var _0x76ed9b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x12d863['sobject'](_0xc7e5('0x22'))['find'](_0x47e749,_0x76ed9b)[_0xc7e5('0x23')]()[_0xc7e5('0x24')](function(_0x180bb3){if(_0x180bb3[_0xc7e5('0x25')]){var _0x2ec9d9=_[_0xc7e5('0x26')](_0x180bb3,function(_0x541c84){return _0x541c84['Email']===_0x10373f;});if(_0x2ec9d9){logger['info'](_0xc7e5('0x27'),_0x10373f);return BPromise[_0xc7e5('0x28')]({'id':_0x2ec9d9['Id'],'name':_0x2ec9d9[_0xc7e5('0x29')]});}}else{logger[_0xc7e5('0x1d')](_0xc7e5('0x2a'),_0x10373f);return _0x12d863[_0xc7e5('0x2b')]()[_0xc7e5('0x24')](function(_0x16b6fc){return BPromise['resolve']({'id':_0x16b6fc[_0xc7e5('0x2c')],'name':_0x16b6fc[_0xc7e5('0x2d')]});});}});}else{logger[_0xc7e5('0x1d')](_0xc7e5('0x2a'),_0x10373f);return _0x12d863[_0xc7e5('0x2b')]()['then'](function(_0x293d89){return BPromise[_0xc7e5('0x28')]({'id':_0x293d89[_0xc7e5('0x2c')],'name':_0x293d89[_0xc7e5('0x2d')]});});}}function getEndUser(_0x5ce396,_0x3632f9,_0x25288e,_0x10738a,_0x63e5f6){var _0x3a42db={'$or':{'Phone':_0x10738a}};var _0x192ec4={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger['info'](_0xc7e5('0x2e'),_0x10738a,_0x3632f9[_0xc7e5('0x2f')]);switch(_0x3632f9[_0xc7e5('0x2f')]){case _0xc7e5('0x30'):var _0x554495=_[_0xc7e5('0x31')](_0x3a42db);if(_0x3632f9['additionalSearchContact']){var _0x4c6fb5={};_0x4c6fb5[_0x3632f9[_0xc7e5('0x32')]]=_0x10738a;_[_0xc7e5('0x33')](_0x554495[_0xc7e5('0x34')],_0x4c6fb5);}return _0x63e5f6[_0xc7e5('0x35')](_0xc7e5('0x36'))[_0xc7e5('0x26')](_0x554495,_0x192ec4)['execute']()[_0xc7e5('0x24')](function(_0x56994e){if(_0x56994e&&_0x56994e[_0xc7e5('0x25')]){return _0x56994e;}else{var _0x2017dc=_[_0xc7e5('0x31')](_0x3a42db);if(_0x3632f9[_0xc7e5('0x37')]){var _0x324324={};_0x324324[_0x3632f9[_0xc7e5('0x37')]]=_0x10738a;_[_0xc7e5('0x33')](_0x2017dc[_0xc7e5('0x34')],_0x324324);}return _0x63e5f6[_0xc7e5('0x35')]('Lead')[_0xc7e5('0x26')](_0x2017dc,_0x192ec4);}});case _0xc7e5('0x38'):var _0x53b8ea=_[_0xc7e5('0x31')](_0x3a42db);if(_0x3632f9[_0xc7e5('0x39')]){var _0x4c6fb5={};_0x4c6fb5[_0x3632f9[_0xc7e5('0x39')]]=_0x10738a;_['merge'](_0x53b8ea[_0xc7e5('0x34')],_0x4c6fb5);}return _0x63e5f6['sobject'](_0xc7e5('0x3a'))[_0xc7e5('0x26')](_0x53b8ea,_0x192ec4)['execute']()[_0xc7e5('0x24')](function(_0x92787){if(_0x92787&&_0x92787['length']){return _0x92787;}else{var _0x4affb3=_[_0xc7e5('0x31')](_0x3a42db);if(_0x3632f9[_0xc7e5('0x32')]){var _0x4e799a={};_0x4e799a[_0x3632f9[_0xc7e5('0x32')]]=_0x10738a;_[_0xc7e5('0x33')](_0x4affb3[_0xc7e5('0x34')],_0x4e799a);}return _0x63e5f6['sobject']('Contact')[_0xc7e5('0x26')](_0x4affb3,_0x192ec4)[_0xc7e5('0x24')](function(_0x1061d1){if(_0x1061d1&&_0x1061d1['length']){return _0x1061d1;}else{var _0x3d8578=_[_0xc7e5('0x31')](_0x3a42db);if(_0x3632f9['additionalSearchLead']){var _0x156328={};_0x156328[_0x3632f9[_0xc7e5('0x37')]]=_0x10738a;_[_0xc7e5('0x33')](_0x3d8578['$or'],_0x156328);}return _0x63e5f6[_0xc7e5('0x35')](_0xc7e5('0x3b'))['find'](_0x3d8578,_0x192ec4);}});}});case'contact':var _0x554495=_[_0xc7e5('0x31')](_0x3a42db);if(_0x3632f9[_0xc7e5('0x32')]){var _0x4c6fb5={};_0x4c6fb5[_0x3632f9[_0xc7e5('0x32')]]=_0x10738a;_['merge'](_0x554495[_0xc7e5('0x34')],_0x4c6fb5);}return _0x63e5f6[_0xc7e5('0x35')](_0xc7e5('0x36'))[_0xc7e5('0x26')](_0x554495,_0x192ec4)['execute']();case _0xc7e5('0x14'):var _0x4b6902=_[_0xc7e5('0x31')](_0x3a42db);if(_0x3632f9['additionalSearchLead']){var _0x4c6fb5={};_0x4c6fb5[_0x3632f9[_0xc7e5('0x37')]]=_0x10738a;_[_0xc7e5('0x33')](_0x4b6902[_0xc7e5('0x34')],_0x4c6fb5);}return _0x63e5f6[_0xc7e5('0x35')](_0xc7e5('0x3b'))[_0xc7e5('0x26')](_0x4b6902,_0x192ec4);case _0xc7e5('0x1a'):var _0x53b8ea=_['cloneDeep'](_0x3a42db);if(_0x3632f9[_0xc7e5('0x39')]){var _0x4c6fb5={};_0x4c6fb5[_0x3632f9['additionalSearchAccount']]=_0x10738a;_['merge'](_0x53b8ea['$or'],_0x4c6fb5);}return _0x63e5f6[_0xc7e5('0x35')](_0xc7e5('0x3a'))[_0xc7e5('0x26')](_0x53b8ea,_0x192ec4);default:return null;}})[_0xc7e5('0x24')](function(_0x39a969){if(_0x39a969&&_0x39a969[_0xc7e5('0x25')]){var _0x4d554e=_[_0xc7e5('0x3c')](_0x39a969);if(_0x4d554e){return BPromise[_0xc7e5('0x28')]({'id':_0x4d554e['Id'],'name':_0x4d554e[_0xc7e5('0x29')],'phone':_0x4d554e['Phone'],'endUserType':_0x4d554e['attributes'][_0xc7e5('0x3d')][_0xc7e5('0x3e')]()});}}})[_0xc7e5('0x24')](function(_0x17e2a6){if(_0x17e2a6){logger['info'](_0xc7e5('0x3f'),_0x17e2a6[_0xc7e5('0x13')],_0x10738a);return BPromise[_0xc7e5('0x28')](_0x17e2a6);}else{logger[_0xc7e5('0x1d')](_0xc7e5('0x40'),_0x10738a);var _0x101b8f={'Phone':_0x10738a};if(_0x3632f9[_0xc7e5('0x41')]){if(_0x3632f9[_0xc7e5('0x41')]===_0xc7e5('0x18')){logger[_0xc7e5('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x10738a,_0x3632f9[_0xc7e5('0x41')]);_0x101b8f[_0xc7e5('0x42')]=_0x25288e!==_0xc7e5('0x43')?_0x25288e:util[_0xc7e5('0x44')](_0xc7e5('0x45'),_0x10738a);}else if(_0x3632f9[_0xc7e5('0x41')]===_0xc7e5('0x14')){logger[_0xc7e5('0x1d')](_0xc7e5('0x46'),_0x10738a,_0x3632f9[_0xc7e5('0x41')]);_0x101b8f[_0xc7e5('0x42')]=_0x25288e!==''?_0x25288e:util[_0xc7e5('0x44')](_0xc7e5('0x45'),_0x10738a);_0x101b8f[_0xc7e5('0x47')]=_0xc7e5('0x48');}else if(_0x3632f9['moduleCreate']===_0xc7e5('0x1a')){logger[_0xc7e5('0x1d')](_0xc7e5('0x46'),_0x10738a,_0x3632f9[_0xc7e5('0x41')]);_0x101b8f[_0xc7e5('0x29')]=_0x25288e!==_0xc7e5('0x43')?_0x25288e:util[_0xc7e5('0x44')](_0xc7e5('0x45'),_0x10738a);}else{return null;}}return _0x63e5f6[_0xc7e5('0x35')](_[_0xc7e5('0x49')](_0x3632f9['moduleCreate']))['create'](_0x101b8f)[_0xc7e5('0x24')](function(_0x2db6c2){return BPromise[_0xc7e5('0x28')]({'id':_0x2db6c2['id'],'endUserType':_0x3632f9[_0xc7e5('0x41')]});});}});}function getCustomFields(_0x15d9b5,_0x2c43ae){var _0x1a309f={};if(_0x15d9b5[_0xc7e5('0x25')]>0x0){_['forEach'](_0x15d9b5,function(_0x33f301){if(_[_0xc7e5('0x4a')]([_0xc7e5('0x4b'),_0xc7e5('0x4c')],_0x33f301[_0xc7e5('0x3d')])&&_0x33f301[_0xc7e5('0x4d')]){_0x1a309f[_0x33f301[_0xc7e5('0x4d')]]=_0x33f301[_0xc7e5('0x4e')][_0xc7e5('0x4f')]();}else if(_0x33f301[_0xc7e5('0x3d')]===_0xc7e5('0x50')&&_0x33f301[_0xc7e5('0x51')]&&_0x33f301[_0xc7e5('0x4d')]){_0x2c43ae[_0x33f301[_0xc7e5('0x51')]]&&(_0x1a309f[_0x33f301['idField']]=_0x2c43ae[_0x33f301[_0xc7e5('0x51')]][_0xc7e5('0x4f')]());}else if(_0x33f301[_0xc7e5('0x3d')]===_0xc7e5('0x52')&&_0x33f301[_0xc7e5('0x53')]&&_0x33f301[_0xc7e5('0x53')][_0xc7e5('0x54')]&&_0x33f301[_0xc7e5('0x4d')]){_0x2c43ae[_0x33f301[_0xc7e5('0x53')][_0xc7e5('0x54')][_0xc7e5('0x3e')]()]&&(_0x1a309f[_0x33f301[_0xc7e5('0x4d')]]=_0x2c43ae[_0x33f301[_0xc7e5('0x53')][_0xc7e5('0x54')][_0xc7e5('0x3e')]()][_0xc7e5('0x4f')]());}});}return _0x1a309f;}function getConnection(_0x174007){var _0x33d665=_0x174007[_0xc7e5('0x55')]['concat'](_0x174007[_0xc7e5('0x56')]);var _0x30eb37=new jsforce[(_0xc7e5('0x57'))]({'oauth2':{'loginUrl':_0x174007[_0xc7e5('0x58')]||'https://login.salesforce.com','clientId':_0x174007['clientId'],'clientSecret':_0x174007[_0xc7e5('0x59')]}});return _0x30eb37['login'](_0x174007[_0xc7e5('0x5a')],_0x33d665)[_0xc7e5('0x24')](function(){logger['info']('Connection\x20established.');return _0x30eb37;});}exports[_0xc7e5('0x5b')]=function(_0x561bac,_0x59a8e1,_0x551146,_0x1c1218,_0x311af1,_0x3a6a32){var _0x305e62,_0x2b6455,_0x201e5c,_0x8258b3;_0x3a6a32[_0xc7e5('0x5c')]=intUtil['stripTrailingSlash'](_0x3a6a32[_0xc7e5('0x5c')]);_0x3a6a32[_0xc7e5('0x58')]=intUtil[_0xc7e5('0x5d')](_0x3a6a32[_0xc7e5('0x58')]);if(_0x311af1&&_0x311af1[_0xc7e5('0x5e')]){logger['info']('[QUEUE]',_0xc7e5('0x5f'));_0x59a8e1[_0xc7e5('0x60')]=util[_0xc7e5('0x44')](_0xc7e5('0x61'),_0x3a6a32[_0xc7e5('0x5c')],_0x59a8e1['uniqueid'],md5(_0x59a8e1['uniqueid']));}else{_0x59a8e1[_0xc7e5('0x60')]='';}return getConnection(_0x3a6a32)['then'](function(_0x1d96f7){_0x8258b3=_0x1d96f7;return getUser(_0x3a6a32,_0x1c1218[_0xc7e5('0x62')],_0x8258b3);})[_0xc7e5('0x24')](function(_0x340b3f){_0x305e62=_0x340b3f;return getEndUser(_0x3a6a32,_0x551146,_0x59a8e1[_0xc7e5('0x63')],_0x59a8e1[_0xc7e5('0x64')],_0x8258b3);})[_0xc7e5('0x24')](function(_0x4ac766){_0x2b6455=_0x4ac766;return getTicket(_0x3a6a32,_0x305e62,_0x2b6455,_0x551146,_0x59a8e1,_0x551146[_0xc7e5('0x65')],_0x8258b3,_0xc7e5('0x5b'));})[_0xc7e5('0x24')](function(_0x5cbe9b){_0x201e5c=_0x5cbe9b;logger[_0xc7e5('0x1d')](_0xc7e5('0x66'),_0x201e5c['id']);logger[_0xc7e5('0x1d')](_0xc7e5('0x67'),_0x201e5c['id'],_0x1c1218[_0xc7e5('0x54')],_0x3a6a32[_0xc7e5('0x3d')]);switch(_0x3a6a32[_0xc7e5('0x3d')]){case'integrationTab':emit(util[_0xc7e5('0x44')]('user:%s',_0x1c1218['name']),_0xc7e5('0x68'),{'recordId':_0x201e5c['id']});break;case _0xc7e5('0x69'):emit(util['format']('user:%s',_0x1c1218[_0xc7e5('0x54')]),_0xc7e5('0x6a'),{'uri':util['format']('%s/%s/e',_0x8258b3['instanceUrl'],_0x201e5c['id'])});break;default:logger['error'](_0xc7e5('0x6b'));}})['catch'](function(_0x35c76d){logger[_0xc7e5('0x6c')]('[QUEUE]',_0x35c76d);});};exports[_0xc7e5('0x6d')]=function(_0x52d4c8,_0x1c8f39,_0x26e526,_0x1d35a6,_0x1a4582,_0x37159e,_0x42513f){var _0x536eda,_0x4b1ea5,_0xe4608f,_0x1ff0ea;_0x37159e[_0xc7e5('0x5c')]=intUtil['stripTrailingSlash'](_0x37159e[_0xc7e5('0x5c')]);_0x37159e[_0xc7e5('0x58')]=intUtil[_0xc7e5('0x5d')](_0x37159e[_0xc7e5('0x58')]);if(_0x42513f&&_0x42513f['recordingFormat']&&_0x42513f[_0xc7e5('0x6e')]!==_0xc7e5('0x6f')){logger['info'](_0xc7e5('0x70'),_0xc7e5('0x5f'));_0x1c8f39[_0xc7e5('0x60')]=util[_0xc7e5('0x44')](_0xc7e5('0x61'),_0x37159e[_0xc7e5('0x5c')],_0x1c8f39[_0xc7e5('0x71')],md5(_0x1c8f39[_0xc7e5('0x71')]));}return getConnection(_0x37159e)[_0xc7e5('0x24')](function(_0x12ab1c){_0x1ff0ea=_0x12ab1c;return getUser(_0x37159e,_0x1d35a6['email'],_0x1ff0ea);})['then'](function(_0x571718){_0x536eda=_0x571718;return getEndUser(_0x37159e,_0x26e526,_0x1c8f39[_0xc7e5('0x72')],_0x1c8f39['destcalleridnum'],_0x1ff0ea);})['then'](function(_0x210243){_0x4b1ea5=_0x210243;return getTicket(_0x37159e,_0x536eda,_0x4b1ea5,_0x26e526,_0x1c8f39,_0x26e526[_0xc7e5('0x65')],_0x1ff0ea,_0xc7e5('0x6d'));})[_0xc7e5('0x24')](function(_0x1767e9){_0xe4608f=_0x1767e9;logger['info'](_0xc7e5('0x73'),_0xe4608f['id']);logger['info'](_0xc7e5('0x74'),_0xe4608f['id'],_0x1d35a6[_0xc7e5('0x54')],_0x37159e[_0xc7e5('0x3d')]);switch(_0x37159e[_0xc7e5('0x3d')]){case _0xc7e5('0x75'):emit(util['format'](_0xc7e5('0x76'),_0x1d35a6[_0xc7e5('0x54')]),'trigger:salesforce:display',{'recordId':_0xe4608f['id']});break;case _0xc7e5('0x69'):emit(util[_0xc7e5('0x44')](_0xc7e5('0x76'),_0x1d35a6['name']),'trigger:browser:url',{'uri':util[_0xc7e5('0x44')](_0xc7e5('0x77'),_0x1ff0ea[_0xc7e5('0x78')],_0xe4608f['id'])});break;default:logger['error']('[OUTBOUND]',_0xc7e5('0x79'));}})[_0xc7e5('0x7a')](function(_0x45f6e4){logger[_0xc7e5('0x6c')](_0xc7e5('0x70'),_0x45f6e4);});};exports[_0xc7e5('0x7b')]=function(_0x13deb8,_0x17947d,_0x5de951,_0x521cc9,_0x554e45,_0x392f70){var _0x1c6032,_0x399a1a,_0x1f71be,_0x514ebf;_0x392f70[_0xc7e5('0x5c')]=intUtil[_0xc7e5('0x5d')](_0x392f70[_0xc7e5('0x5c')]);_0x392f70[_0xc7e5('0x58')]=intUtil[_0xc7e5('0x5d')](_0x392f70[_0xc7e5('0x58')]);if(_0x554e45&&_0x554e45[_0xc7e5('0x5e')]){logger['info']('['+_0x17947d[_0xc7e5('0x7c')][_0xc7e5('0x7d')]()+']','Recording\x20is\x20enabled!');_0x17947d[_0xc7e5('0x60')]=util['format'](_0xc7e5('0x61'),_0x392f70[_0xc7e5('0x5c')],_0x17947d[_0xc7e5('0x71')],md5(_0x17947d[_0xc7e5('0x71')]));}else{_0x17947d[_0xc7e5('0x60')]='';}return getConnection(_0x392f70)[_0xc7e5('0x24')](function(_0x5a2a15){_0x514ebf=_0x5a2a15;if(!_[_0xc7e5('0x20')](_0x521cc9)){return getUser(_0x392f70,_0x521cc9[_0xc7e5('0x54')],_0x514ebf);}else{return getUser(_0x392f70,null,_0x514ebf);}})['then'](function(_0x5966a6){_0x1c6032=_0x5966a6;return getEndUser(_0x392f70,_0x5de951,_0x17947d[_0xc7e5('0x63')],_0x17947d[_0xc7e5('0x64')],_0x514ebf);})['then'](function(_0x4e2ddf){_0x399a1a=_0x4e2ddf;return getTicket(_0x392f70,_0x1c6032,_0x399a1a,_0x5de951,_0x17947d,_0x5de951['Fields'],_0x514ebf);})['then'](function(_0x3d2357){_0x1f71be=_0x3d2357;logger[_0xc7e5('0x1d')]('['+_0x17947d['lastevent'][_0xc7e5('0x7d')]()+_0xc7e5('0x7e'),_0x1f71be['id']);logger['info']('['+_0x17947d[_0xc7e5('0x7c')][_0xc7e5('0x7d')]()+']\x20Integration\x20account\x20type\x20%s.',_0x392f70[_0xc7e5('0x3d')]);})['catch'](function(_0x42b527){logger[_0xc7e5('0x6c')]('['+_0x17947d['lastevent']['toUpperCase']()+']',_0x42b527);});}; \ 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 9fe1e0b..cdd04f5 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 _0xd255=['content','toString','string','variable','variableName','idField','customVariable','Variable','name','incident','assign','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','label','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','outbound','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','then','active','true','userId','sys_id','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toLowerCase'];(function(_0x2375e1,_0x3d125a){var _0x2ccc7d=function(_0x343bb6){while(--_0x343bb6){_0x2375e1['push'](_0x2375e1['shift']());}};_0x2ccc7d(++_0x3d125a);}(_0xd255,0x10c));var _0x5d25=function(_0x47068c,_0x1dd92c){_0x47068c=_0x47068c-0x0;var _0x8427e3=_0xd255[_0x47068c];return _0x8427e3;};'use strict';var _=require(_0x5d25('0x0'));var Promise=require(_0x5d25('0x1'));var rp=require(_0x5d25('0x2'));var util=require(_0x5d25('0x3'));var md5=require(_0x5d25('0x4'));var Redis=require(_0x5d25('0x5'));var intUtil=require(_0x5d25('0x6'));var config=require(_0x5d25('0x7'));var logger=require(_0x5d25('0x8'))(_0x5d25('0x9'));config[_0x5d25('0xa')]=_[_0x5d25('0xb')](config[_0x5d25('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x5d25('0xc'))(new Redis(config[_0x5d25('0xa')]));function getAdminUser(_0x24e152,_0x275486,_0x5f3b00,_0x3609c1,_0x27be29,_0x78722b){return new Promise(function(_0x58193f,_0x3600d8){var _0x4f9fa4={'method':_0x5d25('0xd'),'uri':_0x3609c1+_0x5d25('0xe')+'&'+_0x27be29+'&'+_0x78722b,'auth':_0x275486,'json':!![]};return rp(_0x4f9fa4)['then'](function(_0x2d89f3){if(_0x2d89f3[_0x5d25('0xf')][_0x5d25('0x10')]>0x0){_0x5f3b00[_0x5d25('0x11')]=_0x2d89f3[_0x5d25('0xf')][0x0]['sys_id'];}logger[_0x5d25('0x12')]('['+[_0x24e152[_0x5d25('0x13')]()]+_0x5d25('0x14'),_0x5f3b00);_0x58193f(_0x5f3b00);})[_0x5d25('0x15')](function(_0xa9e8c5){logger['error']('['+[_0x24e152[_0x5d25('0x13')]()]+']',_0xa9e8c5[_0x5d25('0x16')]);_0x3600d8(_0xa9e8c5[_0x5d25('0x16')]);});});}function getUser(_0x5b0dcc,_0x1dc28d,_0x3880f2,_0x19f00f,_0x35ef29){return function(_0x523e23){logger[_0x5d25('0x12')]('['+[_0x5b0dcc[_0x5d25('0x13')]()]+_0x5d25('0x17'),_0x523e23);return new Promise(function(_0x141fc1,_0x26752d){if(intUtil['validateEmail'](_0x523e23[_0x5d25('0x18')])){var _0xdb2c96={'method':_0x5d25('0xd'),'uri':_0x3880f2+_0x5d25('0x19')+_0x523e23[_0x5d25('0x18')]+'&'+_0x19f00f+'&'+_0x35ef29,'auth':_0x1dc28d,'json':!![]};logger['info']('['+[_0x5b0dcc[_0x5d25('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0xdb2c96);return rp(_0xdb2c96)[_0x5d25('0x1a')](function(_0x138cde){logger['info']('['+[_0x5b0dcc[_0x5d25('0x13')]()]+'],\x20getUser\x20entity',_0x138cde);if(_0x138cde[_0x5d25('0xf')][_0x5d25('0x10')]>0x0&&String(_0x138cde[_0x5d25('0xf')][0x0][_0x5d25('0x1b')])===_0x5d25('0x1c')){_0x523e23[_0x5d25('0x1d')]=_0x138cde[_0x5d25('0xf')][0x0][_0x5d25('0x1e')];}else{_0x523e23[_0x5d25('0x1d')]=_0x523e23['adminId'];_0x523e23['userEmail']=_0x523e23[_0x5d25('0x1f')];}logger['info']('['+[_0x5b0dcc[_0x5d25('0x13')]()]+_0x5d25('0x20'),_0x523e23);_0x141fc1(_0x523e23);})[_0x5d25('0x15')](function(_0x38f14c){logger[_0x5d25('0x21')]('['+[_0x5b0dcc['toUpperCase']()]+']',_0x38f14c[_0x5d25('0x16')]);_0x26752d(_0x38f14c[_0x5d25('0x16')]);});}else{logger[_0x5d25('0x12')]('['+[_0x5b0dcc['toUpperCase']()]+_0x5d25('0x22'));_0x523e23[_0x5d25('0x1d')]=_0x523e23['adminId'];_0x523e23[_0x5d25('0x18')]=_0x523e23[_0x5d25('0x1f')];_0x141fc1(_0x523e23);}});};}function createEndUser(_0x17a7c2,_0x395ef8,_0x917ccd,_0x3a7511,_0x3ad59e){logger['info']('['+[_0x17a7c2[_0x5d25('0x13')]()]+_0x5d25('0x23'),_0x917ccd);return new Promise(function(_0x361846,_0x453572){var _0x5c7bb7={'method':_0x5d25('0x24'),'uri':_0x3a7511+_0x5d25('0x25')+_0x3ad59e,'body':{'user_name':_0x917ccd[_0x5d25('0x26')],'roles':_0x5d25('0x27'),'first_name':_0x917ccd[_0x5d25('0x26')],'active':_0x5d25('0x1c'),'date_format':_0x5d25('0x28'),'phone':_0x917ccd['endUserNumber']},'auth':_0x395ef8,'json':!![]};return rp(_0x5c7bb7)[_0x5d25('0x1a')](function(_0x551160){logger[_0x5d25('0x12')]('['+[_0x17a7c2[_0x5d25('0x13')]()]+'],\x20EndUser\x20schema',_0x551160['result']);_0x917ccd[_0x5d25('0x29')]=_0x551160['result'][_0x5d25('0x1e')];_0x361846(_0x917ccd);})[_0x5d25('0x15')](function(_0x266c75){logger[_0x5d25('0x21')]('['+[_0x17a7c2[_0x5d25('0x13')]()]+']',_0x266c75[_0x5d25('0x16')]);_0x453572(_0x266c75[_0x5d25('0x16')]);});});}function getEndUser(_0x143a4c,_0x1c962a,_0x274385,_0x27952e,_0x424f78){return function(_0x562559){logger[_0x5d25('0x12')]('['+[_0x143a4c['toUpperCase']()]+_0x5d25('0x2a'),_0x562559);return new Promise(function(_0x56fc41,_0x2fdce9){var _0xcb4806={'method':_0x5d25('0xd'),'uri':_0x274385+_0x5d25('0x2b')+_0x562559['endUserNumber']+'&'+_0x27952e+'&'+_0x424f78,'auth':_0x1c962a,'json':!![]};return rp(_0xcb4806)[_0x5d25('0x1a')](function(_0x91cfd1){if(_0x91cfd1[_0x5d25('0xf')]['length']>0x0){_0x562559[_0x5d25('0x29')]=_0x91cfd1[_0x5d25('0xf')][0x0][_0x5d25('0x1e')];logger[_0x5d25('0x12')]('['+[_0x143a4c[_0x5d25('0x13')]()]+_0x5d25('0x2c'),_0x562559);_0x56fc41(_0x562559);}else{return createEndUser(_0x143a4c,_0x1c962a,_0x562559,_0x274385,_0x27952e)[_0x5d25('0x1a')](function(_0x5433ac){logger[_0x5d25('0x12')]('['+[_0x143a4c[_0x5d25('0x13')]()]+_0x5d25('0x2d'),_0x5433ac);_0x56fc41(_0x5433ac);});}})[_0x5d25('0x15')](function(_0x1aacae){logger[_0x5d25('0x21')]('['+[_0x143a4c[_0x5d25('0x13')]()]+']',_0x1aacae[_0x5d25('0x16')]);_0x2fdce9(_0x1aacae[_0x5d25('0x16')]);});});};}function getCustomFields(_0x503bb1,_0x35ef59){var _0x1c7b9d={};if(_0x503bb1[_0x5d25('0x10')]>0x0){_[_0x5d25('0x2e')](_0x503bb1,function(_0x366a90){if(_[_0x5d25('0x2f')](['string',_0x5d25('0x30')],_0x366a90[_0x5d25('0x31')])&&_0x366a90[_0x5d25('0x32')]&&!_0x366a90[_0x5d25('0x33')]){_0x1c7b9d[_0x366a90[_0x5d25('0x32')][_0x5d25('0x34')]()]=_0x366a90[_0x5d25('0x35')][_0x5d25('0x36')]();}else if(_[_0x5d25('0x2f')]([_0x5d25('0x37'),_0x5d25('0x30')],_0x366a90[_0x5d25('0x31')])&&_0x366a90['idField']&&_0x366a90[_0x5d25('0x33')]){_0x1c7b9d[_0x366a90['idField']['toLowerCase']()]=_0x366a90['content']['toString']();}else if(_0x366a90[_0x5d25('0x31')]===_0x5d25('0x38')&&_0x366a90[_0x5d25('0x39')]&&_0x366a90[_0x5d25('0x3a')]&&_0x366a90[_0x5d25('0x33')]){_0x1c7b9d[_0x366a90[_0x5d25('0x3a')][_0x5d25('0x34')]()]=_0x35ef59[_0x366a90[_0x5d25('0x39')]][_0x5d25('0x36')]();}else if(_0x366a90[_0x5d25('0x31')]===_0x5d25('0x3b')&&_0x366a90[_0x5d25('0x3c')]&&_0x366a90['Variable'][_0x5d25('0x3d')]&&_0x366a90['idField']&&_0x366a90[_0x5d25('0x33')]){_0x1c7b9d[_0x366a90[_0x5d25('0x3a')]['toLowerCase']()]=_0x35ef59[_0x366a90[_0x5d25('0x3c')]['name']['toLowerCase']()][_0x5d25('0x36')]();}});}return _0x1c7b9d;}function getTicket(_0x35c602,_0x5a4d5a,_0x2e6732,_0x2d1fb5,_0xcaca33,_0x3b9413){return function(_0x4ae0ea){logger[_0x5d25('0x12')]('['+[_0x35c602[_0x5d25('0x13')]()]+']\x20getTicket\x20input\x20crm',_0x4ae0ea);return new Promise(function(_0xc77335,_0x1e9bd4){var _0x21bd5e=_0x35c602[_0x5d25('0x34')]()==='outbound'?_0x4ae0ea[_0x5d25('0x1d')]:_0x4ae0ea[_0x5d25('0x29')];var _0x5007aa={'method':_0x5d25('0x24'),'uri':_0x2e6732+_0x5d25('0x3e')+'?'+_0x3b9413,'body':Object[_0x5d25('0x3f')]({},{'active':_0x5d25('0x1c'),'caller_id':_0x21bd5e,'assigned_to':_0x4ae0ea[_0x5d25('0x1d')],'short_description':intUtil['getString'](_0x2d1fb5[_0x5d25('0x40')],_0xcaca33,'\x20'),'description':intUtil['getString'](_0x2d1fb5['Descriptions'],_0xcaca33,'\x0a')},getCustomFields(_0x2d1fb5[_0x5d25('0x41')],_0xcaca33)),'auth':_0x5a4d5a,'json':!![]};return rp(_0x5007aa)[_0x5d25('0x1a')](function(_0x3f020e){logger[_0x5d25('0x12')]('['+[_0x35c602['toUpperCase']()]+_0x5d25('0x42'),_0x3f020e[_0x5d25('0xf')]);_0x4ae0ea[_0x5d25('0x43')]=_0x3f020e[_0x5d25('0xf')]['sys_id'];_0x4ae0ea[_0x5d25('0x44')]=_0x3f020e[_0x5d25('0xf')]['number'];logger[_0x5d25('0x12')]('['+[_0x35c602[_0x5d25('0x13')]()]+']\x20getTicket\x20crm',_0x4ae0ea);_0xc77335(_0x4ae0ea);})['catch'](function(_0x5ef2d7){logger[_0x5d25('0x21')]('['+[_0x35c602[_0x5d25('0x13')]()]+']',_0x5ef2d7[_0x5d25('0x16')]);_0x1e9bd4(_0x5ef2d7[_0x5d25('0x16')]);});});};}function createRemoteTag(_0x4bedd8,_0x4afccd,_0x2b15cd,_0x2da0b5){return new Promise(function(_0x55359e,_0x1b79cf){var _0x1cad84={'method':_0x5d25('0x24'),'uri':_0x2b15cd+_0x5d25('0x45')+'?'+_0x2da0b5,'body':{'short_description':_0x4bedd8,'global':!![],'active':!![],'name':_0x4bedd8},'auth':_0x4afccd,'json':!![]};return rp(_0x1cad84)[_0x5d25('0x1a')](function(_0x573f9b){var _0x21ed05=_0x573f9b['result'][_0x5d25('0x1e')];_0x55359e(_0x21ed05);});});}function getRemoteTag(_0x3b5a18,_0x3b8cd5,_0x5dbd7c,_0x3f6929,_0x48943b){return new Promise(function(_0x350ff5,_0x289a3b){var _0x5e6bea={'method':'GET','uri':_0x5dbd7c+_0x5d25('0x45')+'?sysparm_query=name%3D'+_0x3b5a18+'&'+_0x3f6929,'auth':_0x3b8cd5,'json':!![]};return rp(_0x5e6bea)['then'](function(_0x1931f6){if(_0x1931f6['result'][_0x5d25('0x10')]>0x0){var _0x2fc015=_0x1931f6[_0x5d25('0xf')][0x0]['sys_id'];_0x350ff5(_0x2fc015);}else{return createRemoteTag(_0x3b5a18,_0x3b8cd5,_0x5dbd7c,_0x3f6929)['then'](function(_0x266267){_0x350ff5(_0x266267);});}});});}function assignTagToIncident(_0x23ede6,_0x14531b,_0x17d71c,_0x251395,_0x3b38be){return new Promise(function(_0x12e560,_0x10223e){var _0x40b2fa={'method':_0x5d25('0x24'),'uri':_0x17d71c+'label_entry'+'?'+_0x3b38be,'body':{'label':_0x23ede6,'table':_0x5d25('0x3e'),'id_type':_0x5d25('0x46'),'table_key':_0x251395[_0x5d25('0x43')],'title':_0x5d25('0x47')+_0x251395[_0x5d25('0x44')],'id_display':_0x251395['ticketNumber']},'auth':_0x14531b,'json':!![]};return rp(_0x40b2fa)[_0x5d25('0x1a')](function(_0x2536e1){_0x12e560();})['catch'](function(){_0x12e560();});});}function manageTags(_0x55af70,_0x1634ab,_0x45fe9a,_0x1e3ba2,_0x49d0ad,_0xc270a2,_0xeaed64){return new Promise(function(_0x479941,_0x496139){var _0x30f69f=[];_0x1634ab['forEach'](function(_0x1a06ad){_0x30f69f[_0x5d25('0x48')](getRemoteTag(_0x1a06ad,_0x45fe9a,_0x1e3ba2,_0xc270a2,_0xeaed64));});return Promise['all'](_0x30f69f)['then'](function(_0x1315ad){if(_0x1315ad[_0x5d25('0x10')]){logger['info']('['+[_0x55af70[_0x5d25('0x13')]()]+_0x5d25('0x49'),_0x1315ad);var _0x103d5e=[];_0x1315ad[_0x5d25('0x2e')](function(_0x15ef61){_0x103d5e[_0x5d25('0x48')](assignTagToIncident(_0x15ef61,_0x45fe9a,_0x1e3ba2,_0x49d0ad,_0xc270a2));});return Promise[_0x5d25('0x4a')](_0x103d5e)[_0x5d25('0x1a')](function(){_0x479941();})['catch'](function(){_0x479941();});}else{_0x479941();}});});}function getTags(_0x4aada3,_0x65aa19,_0x27eabc,_0x515598,_0x48fa5d,_0xd0b558){return function(_0x377a51){return new Promise(function(_0x199867,_0x2c0623){var _0xa83607=[];var _0x3d59ad=_0x515598[_0x5d25('0x4b')];if(_0x3d59ad&&_0x3d59ad[_0x5d25('0x10')]>0x0){_0xa83607=_[_0x5d25('0x4c')](_0x3d59ad,_0x5d25('0x3d'));}if(_0xa83607['length']>0x0){return manageTags(_0x4aada3,_0xa83607,_0x65aa19,_0x27eabc,_0x377a51,_0x48fa5d,_0xd0b558)['then'](function(){_0x199867(_0x377a51);});}else{_0x199867(_0x377a51);}});};}function emit(_0x138eff,_0x22b5c6,_0x12fe6f){var _0x90b8fe=_0x5d25('0x4d')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x5d25('0x4e')+'%255EORDERBYDESCnumber';var _0x29c7f5={'uri':_0x138eff+_0x5d25('0x4f')+_0x12fe6f+_0x90b8fe};io['to'](util[_0x5d25('0x50')](_0x5d25('0x51'),_0x22b5c6))[_0x5d25('0x52')](_0x5d25('0x53'),_0x29c7f5);}exports['cs']=function(_0x138d22,_0x4b6830,_0x19bbc4,_0x88dfcf,_0x1e247e,_0x19589f,_0x23b470,_0x553e18){var _0x58e890={};var _0x39a4a3={'user':_0x19589f[_0x5d25('0x54')],'pass':_0x19589f[_0x5d25('0x55')]};var _0x32e0f2=_0x5d25('0x56');var _0x272611='sysparm_display_value=true';_0x19589f[_0x5d25('0x57')]=intUtil[_0x5d25('0x58')](_0x19589f['remoteUri']);_0x19589f[_0x5d25('0x59')]=intUtil[_0x5d25('0x58')](_0x19589f[_0x5d25('0x59')]);var _0x421f3b=util[_0x5d25('0x50')](_0x5d25('0x5a'),_0x19589f[_0x5d25('0x57')]);_0x58e890['userEmail']=!_[_0x5d25('0x5b')](_0x88dfcf)?_0x88dfcf['email']:null;_0x58e890[_0x5d25('0x1f')]=_0x19589f['email'];_0x58e890[_0x5d25('0x26')]=_0x553e18[_0x5d25('0x34')]()===_0x5d25('0x5c')?_0x4b6830['destcalleridnum']:_0x4b6830[_0x5d25('0x5d')];_0x58e890['callDirection']=_0x553e18===_0x5d25('0x5e')||_0x553e18===_0x5d25('0x5f')?_0x5d25('0x5e'):'outbound';var _0x4e3e7f=util[_0x5d25('0x50')](_0x5d25('0x60'),_0x19589f[_0x5d25('0x59')],_0x4b6830[_0x5d25('0x61')],md5(_0x4b6830[_0x5d25('0x61')]));if(_0x1e247e&&_0x1e247e[_0x5d25('0x62')]){logger[_0x5d25('0x12')]('[QUEUE]',_0x5d25('0x63'));_0x4b6830[_0x5d25('0x64')]=_0x4e3e7f;}else if(_0x23b470&&_0x23b470[_0x5d25('0x65')]&&_0x23b470[_0x5d25('0x65')]!=='none'){logger[_0x5d25('0x12')](_0x5d25('0x66'),'Recording\x20is\x20enabled!');_0x4b6830[_0x5d25('0x64')]=_0x4e3e7f;}else{_0x4b6830['recordingURL']='';}return getAdminUser(_0x553e18,_0x39a4a3,_0x58e890,_0x421f3b,_0x272611,_0x32e0f2)['then'](getUser(_0x553e18,_0x39a4a3,_0x421f3b,_0x272611,_0x32e0f2))[_0x5d25('0x1a')](getEndUser(_0x553e18,_0x39a4a3,_0x421f3b,_0x272611,_0x32e0f2))[_0x5d25('0x1a')](getTicket(_0x553e18,_0x39a4a3,_0x421f3b,_0x19bbc4,_0x4b6830,_0x272611))[_0x5d25('0x1a')](function(_0x109f4d){logger[_0x5d25('0x12')](util['format'](_0x5d25('0x67'),_0x109f4d[_0x5d25('0x43')]));logger[_0x5d25('0x12')](util[_0x5d25('0x50')](_0x5d25('0x68'),_0x553e18));if(_0x553e18!=='unmanaged'){logger[_0x5d25('0x12')]('['+[_0x553e18['toUpperCase']()]+']',_0x5d25('0x69'));emit(_0x19589f[_0x5d25('0x57')],_0x88dfcf[_0x5d25('0x3d')],_0x109f4d[_0x5d25('0x43')]);}})[_0x5d25('0x15')](function(_0x2da966){logger[_0x5d25('0x21')]('['+[_0x553e18[_0x5d25('0x13')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x5d25('0x6a')](_0x2da966,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8193=['result','length','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','message','info','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','active','userId','adminId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Descriptions','Fields','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','lodash','bluebird','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin'];(function(_0x40409e,_0x517347){var _0x28b8ef=function(_0xd3135d){while(--_0xd3135d){_0x40409e['push'](_0x40409e['shift']());}};_0x28b8ef(++_0x517347);}(_0x8193,0x1a4));var _0x3819=function(_0x532a6c,_0x4982cf){_0x532a6c=_0x532a6c-0x0;var _0x4a54e8=_0x8193[_0x532a6c];return _0x4a54e8;};'use strict';var _=require(_0x3819('0x0'));var Promise=require(_0x3819('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0x3819('0x2'));var Redis=require('ioredis');var intUtil=require(_0x3819('0x3'));var config=require(_0x3819('0x4'));var logger=require(_0x3819('0x5'))(_0x3819('0x6'));config[_0x3819('0x7')]=_[_0x3819('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3819('0x9'))(new Redis(config[_0x3819('0x7')]));function getAdminUser(_0x3894b7,_0x542f28,_0x52bea1,_0x387c4e,_0x509db7,_0x54fa61){return new Promise(function(_0x3eb91c,_0x55dff1){var _0x38fb59={'method':_0x3819('0xa'),'uri':_0x387c4e+_0x3819('0xb')+'&'+_0x509db7+'&'+_0x54fa61,'auth':_0x542f28,'json':!![]};return rp(_0x38fb59)['then'](function(_0x4be07d){if(_0x4be07d[_0x3819('0xc')][_0x3819('0xd')]>0x0){_0x52bea1['adminId']=_0x4be07d[_0x3819('0xc')][0x0][_0x3819('0xe')];}logger['info']('['+[_0x3894b7[_0x3819('0xf')]()]+_0x3819('0x10'),_0x52bea1);_0x3eb91c(_0x52bea1);})[_0x3819('0x11')](function(_0x297ee2){logger['error']('['+[_0x3894b7[_0x3819('0xf')]()]+']',_0x297ee2[_0x3819('0x12')]);_0x55dff1(_0x297ee2['message']);});});}function getUser(_0x5c20c3,_0x4ee845,_0x2af629,_0xceeb12,_0x1e8d2f){return function(_0x13537f){logger[_0x3819('0x13')]('['+[_0x5c20c3[_0x3819('0xf')]()]+'],\x20getUser\x20input\x20crm',_0x13537f);return new Promise(function(_0x3cf183,_0x2a211a){if(intUtil[_0x3819('0x14')](_0x13537f[_0x3819('0x15')])){var _0x344254={'method':'GET','uri':_0x2af629+_0x3819('0x16')+_0x13537f['userEmail']+'&'+_0xceeb12+'&'+_0x1e8d2f,'auth':_0x4ee845,'json':!![]};logger[_0x3819('0x13')]('['+[_0x5c20c3[_0x3819('0xf')]()]+_0x3819('0x17'),_0x344254);return rp(_0x344254)[_0x3819('0x18')](function(_0x1770fa){logger['info']('['+[_0x5c20c3[_0x3819('0xf')]()]+'],\x20getUser\x20entity',_0x1770fa);if(_0x1770fa[_0x3819('0xc')][_0x3819('0xd')]>0x0&&String(_0x1770fa['result'][0x0][_0x3819('0x19')])==='true'){_0x13537f[_0x3819('0x1a')]=_0x1770fa[_0x3819('0xc')][0x0][_0x3819('0xe')];}else{_0x13537f['userId']=_0x13537f[_0x3819('0x1b')];_0x13537f[_0x3819('0x15')]=_0x13537f[_0x3819('0x1c')];}logger[_0x3819('0x13')]('['+[_0x5c20c3['toUpperCase']()]+_0x3819('0x1d'),_0x13537f);_0x3cf183(_0x13537f);})[_0x3819('0x11')](function(_0x5af48d){logger[_0x3819('0x1e')]('['+[_0x5c20c3[_0x3819('0xf')]()]+']',_0x5af48d[_0x3819('0x12')]);_0x2a211a(_0x5af48d[_0x3819('0x12')]);});}else{logger[_0x3819('0x13')]('['+[_0x5c20c3[_0x3819('0xf')]()]+_0x3819('0x1f'));_0x13537f[_0x3819('0x1a')]=_0x13537f[_0x3819('0x1b')];_0x13537f[_0x3819('0x15')]=_0x13537f[_0x3819('0x1c')];_0x3cf183(_0x13537f);}});};}function createEndUser(_0x10ac5d,_0x64e5e,_0x197585,_0x4fa8ff,_0x10cec9){logger[_0x3819('0x13')]('['+[_0x10ac5d[_0x3819('0xf')]()]+_0x3819('0x20'),_0x197585);return new Promise(function(_0x2417aa,_0x941220){var _0x212dc9={'method':_0x3819('0x21'),'uri':_0x4fa8ff+_0x3819('0x22')+_0x10cec9,'body':{'user_name':_0x197585['endUserNumber'],'roles':_0x3819('0x23'),'first_name':_0x197585[_0x3819('0x24')],'active':_0x3819('0x25'),'date_format':'System','phone':_0x197585[_0x3819('0x24')]},'auth':_0x64e5e,'json':!![]};return rp(_0x212dc9)[_0x3819('0x18')](function(_0x4051b4){logger[_0x3819('0x13')]('['+[_0x10ac5d[_0x3819('0xf')]()]+_0x3819('0x26'),_0x4051b4[_0x3819('0xc')]);_0x197585['endUserId']=_0x4051b4[_0x3819('0xc')]['sys_id'];_0x2417aa(_0x197585);})['catch'](function(_0x6c50dd){logger[_0x3819('0x1e')]('['+[_0x10ac5d[_0x3819('0xf')]()]+']',_0x6c50dd['message']);_0x941220(_0x6c50dd[_0x3819('0x12')]);});});}function getEndUser(_0x4e020f,_0x3bf448,_0x35a084,_0x39bc76,_0xe8ce){return function(_0x33fe8f){logger[_0x3819('0x13')]('['+[_0x4e020f[_0x3819('0xf')]()]+'],\x20getEndUser\x20input\x20crm',_0x33fe8f);return new Promise(function(_0x4b57e0,_0x641088){var _0x23f595={'method':'GET','uri':_0x35a084+'sys_user?sysparm_query=phone%3D'+_0x33fe8f[_0x3819('0x24')]+'&'+_0x39bc76+'&'+_0xe8ce,'auth':_0x3bf448,'json':!![]};return rp(_0x23f595)[_0x3819('0x18')](function(_0x42e258){if(_0x42e258[_0x3819('0xc')][_0x3819('0xd')]>0x0){_0x33fe8f[_0x3819('0x27')]=_0x42e258[_0x3819('0xc')][0x0][_0x3819('0xe')];logger[_0x3819('0x13')]('['+[_0x4e020f[_0x3819('0xf')]()]+_0x3819('0x28'),_0x33fe8f);_0x4b57e0(_0x33fe8f);}else{return createEndUser(_0x4e020f,_0x3bf448,_0x33fe8f,_0x35a084,_0x39bc76)[_0x3819('0x18')](function(_0x5e6a50){logger['info']('['+[_0x4e020f[_0x3819('0xf')]()]+'],\x20createEndUser\x20crm',_0x5e6a50);_0x4b57e0(_0x5e6a50);});}})[_0x3819('0x11')](function(_0x5c2b1d){logger[_0x3819('0x1e')]('['+[_0x4e020f['toUpperCase']()]+']',_0x5c2b1d[_0x3819('0x12')]);_0x641088(_0x5c2b1d[_0x3819('0x12')]);});});};}function getCustomFields(_0x532ec8,_0x452bd3){var _0x516cc2={};if(_0x532ec8['length']>0x0){_[_0x3819('0x29')](_0x532ec8,function(_0x281b2f){if(_[_0x3819('0x2a')]([_0x3819('0x2b'),_0x3819('0x2c')],_0x281b2f[_0x3819('0x2d')])&&_0x281b2f[_0x3819('0x2e')]&&!_0x281b2f[_0x3819('0x2f')]){_0x516cc2[_0x281b2f[_0x3819('0x2e')][_0x3819('0x30')]()]=_0x281b2f[_0x3819('0x31')][_0x3819('0x32')]();}else if(_['includes']([_0x3819('0x2b'),_0x3819('0x2c')],_0x281b2f[_0x3819('0x2d')])&&_0x281b2f[_0x3819('0x33')]&&_0x281b2f['customField']){_0x516cc2[_0x281b2f[_0x3819('0x33')][_0x3819('0x30')]()]=_0x281b2f[_0x3819('0x31')][_0x3819('0x32')]();}else if(_0x281b2f[_0x3819('0x2d')]===_0x3819('0x34')&&_0x281b2f[_0x3819('0x35')]&&_0x281b2f['idField']&&_0x281b2f[_0x3819('0x2f')]){_0x516cc2[_0x281b2f[_0x3819('0x33')]['toLowerCase']()]=_0x452bd3[_0x281b2f[_0x3819('0x35')]][_0x3819('0x32')]();}else if(_0x281b2f[_0x3819('0x2d')]===_0x3819('0x36')&&_0x281b2f[_0x3819('0x37')]&&_0x281b2f['Variable'][_0x3819('0x38')]&&_0x281b2f[_0x3819('0x33')]&&_0x281b2f[_0x3819('0x2f')]){_0x516cc2[_0x281b2f['idField'][_0x3819('0x30')]()]=_0x452bd3[_0x281b2f[_0x3819('0x37')][_0x3819('0x38')][_0x3819('0x30')]()][_0x3819('0x32')]();}});}return _0x516cc2;}function getTicket(_0x3ece50,_0x5210e,_0x15f682,_0x2e8f20,_0x173466,_0x4d104b){return function(_0x11300a){logger[_0x3819('0x13')]('['+[_0x3ece50[_0x3819('0xf')]()]+_0x3819('0x39'),_0x11300a);return new Promise(function(_0x4ea6bf,_0x227e8d){var _0x55ac8c=_0x3ece50[_0x3819('0x30')]()===_0x3819('0x3a')?_0x11300a[_0x3819('0x1a')]:_0x11300a['endUserId'];var _0xf03a20={'method':_0x3819('0x21'),'uri':_0x15f682+_0x3819('0x3b')+'?'+_0x4d104b,'body':Object['assign']({},{'active':_0x3819('0x25'),'caller_id':_0x55ac8c,'assigned_to':_0x11300a['userId'],'short_description':intUtil[_0x3819('0x3c')](_0x2e8f20[_0x3819('0x3d')],_0x173466,'\x20'),'description':intUtil['getString'](_0x2e8f20[_0x3819('0x3e')],_0x173466,'\x0a')},getCustomFields(_0x2e8f20[_0x3819('0x3f')],_0x173466)),'auth':_0x5210e,'json':!![]};return rp(_0xf03a20)[_0x3819('0x18')](function(_0x34b203){logger[_0x3819('0x13')]('['+[_0x3ece50[_0x3819('0xf')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x34b203[_0x3819('0xc')]);_0x11300a[_0x3819('0x40')]=_0x34b203[_0x3819('0xc')][_0x3819('0xe')];_0x11300a['ticketNumber']=_0x34b203['result'][_0x3819('0x41')];logger['info']('['+[_0x3ece50['toUpperCase']()]+_0x3819('0x42'),_0x11300a);_0x4ea6bf(_0x11300a);})[_0x3819('0x11')](function(_0x547978){logger[_0x3819('0x1e')]('['+[_0x3ece50[_0x3819('0xf')]()]+']',_0x547978['message']);_0x227e8d(_0x547978[_0x3819('0x12')]);});});};}function createRemoteTag(_0x2eb68f,_0x1d2633,_0xd4767e,_0x628574){return new Promise(function(_0x2278ee,_0x794f13){var _0x334729={'method':_0x3819('0x21'),'uri':_0xd4767e+_0x3819('0x43')+'?'+_0x628574,'body':{'short_description':_0x2eb68f,'global':!![],'active':!![],'name':_0x2eb68f},'auth':_0x1d2633,'json':!![]};return rp(_0x334729)[_0x3819('0x18')](function(_0x1777f8){var _0x3dc158=_0x1777f8['result']['sys_id'];_0x2278ee(_0x3dc158);});});}function getRemoteTag(_0x1b6616,_0xe14495,_0x1f4799,_0x2dae70,_0xbfb23a){return new Promise(function(_0x2b279e,_0x56992a){var _0x5cde4a={'method':_0x3819('0xa'),'uri':_0x1f4799+_0x3819('0x43')+_0x3819('0x44')+_0x1b6616+'&'+_0x2dae70,'auth':_0xe14495,'json':!![]};return rp(_0x5cde4a)[_0x3819('0x18')](function(_0x2d7a72){if(_0x2d7a72['result']['length']>0x0){var _0xd40eb8=_0x2d7a72[_0x3819('0xc')][0x0]['sys_id'];_0x2b279e(_0xd40eb8);}else{return createRemoteTag(_0x1b6616,_0xe14495,_0x1f4799,_0x2dae70)[_0x3819('0x18')](function(_0x4cdd13){_0x2b279e(_0x4cdd13);});}});});}function assignTagToIncident(_0x33b0f1,_0x1cc95b,_0x57fdce,_0x30199f,_0x5c749f){return new Promise(function(_0x4da0a2,_0x34aa08){var _0x2af99b={'method':_0x3819('0x21'),'uri':_0x57fdce+_0x3819('0x45')+'?'+_0x5c749f,'body':{'label':_0x33b0f1,'table':'incident','id_type':_0x3819('0x46'),'table_key':_0x30199f[_0x3819('0x40')],'title':_0x3819('0x47')+_0x30199f[_0x3819('0x48')],'id_display':_0x30199f['ticketNumber']},'auth':_0x1cc95b,'json':!![]};return rp(_0x2af99b)[_0x3819('0x18')](function(_0x2a8de5){_0x4da0a2();})[_0x3819('0x11')](function(){_0x4da0a2();});});}function manageTags(_0x189745,_0x45da6b,_0x57f26b,_0x1f679a,_0xaa59ff,_0x393d33,_0x599614){return new Promise(function(_0x6bde19,_0x15a02f){var _0x55872b=[];_0x45da6b['forEach'](function(_0x23a120){_0x55872b[_0x3819('0x49')](getRemoteTag(_0x23a120,_0x57f26b,_0x1f679a,_0x393d33,_0x599614));});return Promise['all'](_0x55872b)[_0x3819('0x18')](function(_0x5c700a){if(_0x5c700a[_0x3819('0xd')]){logger[_0x3819('0x13')]('['+[_0x189745['toUpperCase']()]+_0x3819('0x4a'),_0x5c700a);var _0x2b660f=[];_0x5c700a[_0x3819('0x29')](function(_0x1b850c){_0x2b660f[_0x3819('0x49')](assignTagToIncident(_0x1b850c,_0x57f26b,_0x1f679a,_0xaa59ff,_0x393d33));});return Promise[_0x3819('0x4b')](_0x2b660f)['then'](function(){_0x6bde19();})['catch'](function(){_0x6bde19();});}else{_0x6bde19();}});});}function getTags(_0x5ac667,_0x2bbe95,_0x28eb54,_0x2630a3,_0x4a4817,_0x375c84){return function(_0x2220c5){return new Promise(function(_0x4c3b95,_0x36b60b){var _0x29e4c1=[];var _0x579338=_0x2630a3[_0x3819('0x4c')];if(_0x579338&&_0x579338[_0x3819('0xd')]>0x0){_0x29e4c1=_['map'](_0x579338,_0x3819('0x38'));}if(_0x29e4c1['length']>0x0){return manageTags(_0x5ac667,_0x29e4c1,_0x2bbe95,_0x28eb54,_0x2220c5,_0x4a4817,_0x375c84)[_0x3819('0x18')](function(){_0x4c3b95(_0x2220c5);});}else{_0x4c3b95(_0x2220c5);}});};}function emit(_0x3046ee,_0x85ff39,_0xd39b1e){var _0xc59c5c=_0x3819('0x4d')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x3819('0x4e');var _0x31fad5={'uri':_0x3046ee+_0x3819('0x4f')+_0xd39b1e+_0xc59c5c};io['to'](util[_0x3819('0x50')](_0x3819('0x51'),_0x85ff39))[_0x3819('0x52')](_0x3819('0x53'),_0x31fad5);}exports['cs']=function(_0x5ca853,_0xc9df55,_0x19b0ee,_0xad866a,_0xab420d,_0x1c44ae,_0x4eb6f8,_0x3c730a){var _0xa02217={};var _0x3d2f77={'user':_0x1c44ae[_0x3819('0x54')],'pass':_0x1c44ae['password']};var _0x514c84=_0x3819('0x55');var _0x26bfc6=_0x3819('0x56');_0x1c44ae[_0x3819('0x57')]=intUtil[_0x3819('0x58')](_0x1c44ae[_0x3819('0x57')]);_0x1c44ae[_0x3819('0x59')]=intUtil[_0x3819('0x58')](_0x1c44ae['serverUrl']);var _0x111068=util[_0x3819('0x50')](_0x3819('0x5a'),_0x1c44ae[_0x3819('0x57')]);_0xa02217[_0x3819('0x15')]=!_[_0x3819('0x5b')](_0xad866a)?_0xad866a[_0x3819('0x5c')]:null;_0xa02217[_0x3819('0x1c')]=_0x1c44ae[_0x3819('0x5c')];_0xa02217[_0x3819('0x24')]=_0x3c730a[_0x3819('0x30')]()===_0x3819('0x3a')?_0xc9df55[_0x3819('0x5d')]:_0xc9df55[_0x3819('0x5e')];_0xa02217[_0x3819('0x5f')]=_0x3c730a===_0x3819('0x60')||_0x3c730a===_0x3819('0x61')?'queue':_0x3819('0x3a');var _0x4ef29b=util['format'](_0x3819('0x62'),_0x1c44ae['serverUrl'],_0xc9df55[_0x3819('0x63')],md5(_0xc9df55[_0x3819('0x63')]));if(_0xab420d&&_0xab420d[_0x3819('0x64')]){logger[_0x3819('0x13')]('[QUEUE]','Recording\x20is\x20enabled!');_0xc9df55[_0x3819('0x65')]=_0x4ef29b;}else if(_0x4eb6f8&&_0x4eb6f8['recordingFormat']&&_0x4eb6f8['recordingFormat']!==_0x3819('0x66')){logger[_0x3819('0x13')](_0x3819('0x67'),_0x3819('0x68'));_0xc9df55[_0x3819('0x65')]=_0x4ef29b;}else{_0xc9df55[_0x3819('0x65')]='';}return getAdminUser(_0x3c730a,_0x3d2f77,_0xa02217,_0x111068,_0x26bfc6,_0x514c84)[_0x3819('0x18')](getUser(_0x3c730a,_0x3d2f77,_0x111068,_0x26bfc6,_0x514c84))[_0x3819('0x18')](getEndUser(_0x3c730a,_0x3d2f77,_0x111068,_0x26bfc6,_0x514c84))[_0x3819('0x18')](getTicket(_0x3c730a,_0x3d2f77,_0x111068,_0x19b0ee,_0xc9df55,_0x26bfc6))[_0x3819('0x18')](function(_0x29ccf9){logger[_0x3819('0x13')](util[_0x3819('0x50')](_0x3819('0x69'),_0x29ccf9[_0x3819('0x40')]));logger[_0x3819('0x13')](util[_0x3819('0x50')](_0x3819('0x6a'),_0x3c730a));if(_0x3c730a!=='unmanaged'){logger['info']('['+[_0x3c730a[_0x3819('0xf')]()]+']',_0x3819('0x6b'));emit(_0x1c44ae[_0x3819('0x57')],_0xad866a[_0x3819('0x38')],_0x29ccf9[_0x3819('0x40')]);}})[_0x3819('0x11')](function(_0x119ba4){logger[_0x3819('0x1e')]('['+[_0x3c730a[_0x3819('0xf')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x119ba4,{'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 da41123..83c4f8f 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 _0x850b=['Descriptions','date_start','toISOString','slice','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','direction','forEach','variableName','push','idField','set_entry','JSON','Basic\x20%s','toString','base64','get_server_info','stringify','isNil','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','users','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','sugarcrm','redis','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','created_by','description'];(function(_0x58fcaa,_0x13c780){var _0x569e73=function(_0x494338){while(--_0x494338){_0x58fcaa['push'](_0x58fcaa['shift']());}};_0x569e73(++_0x13c780);}(_0x850b,0x1df));var _0xb850=function(_0x2dc863,_0x70eda6){_0x2dc863=_0x2dc863-0x0;var _0x53f84e=_0x850b[_0x2dc863];return _0x53f84e;};'use strict';var _=require(_0xb850('0x0'));var rp=require(_0xb850('0x1'));var BPromise=require('bluebird');var md5=require(_0xb850('0x2'));var util=require('util');var Redis=require(_0xb850('0x3'));var intUtil=require(_0xb850('0x4'));var config=require(_0xb850('0x5'));var logger=require('../../../../config/logger')(_0xb850('0x6'));config[_0xb850('0x7')]=_['defaults'](config[_0xb850('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xb850('0x8'))(new Redis(config['redis']));var def={'method':_0xb850('0x9'),'json':!![]};function emit(_0x356330,_0xab5891,_0xe9cf8b){io['to'](_0x356330)[_0xb850('0xa')](_0xab5891,_0xe9cf8b);}function getTicket(_0x54c7a4,_0x37c2d5,_0x40f1d6,_0x576182,_0x52da50,_0x1dcc4a,_0x2ea16e,_0x4f6ba4){logger[_0xb850('0xb')](_0xb850('0xc'));var _0x2ffc99=new Date();var _0x39a2c1=[{'name':'name','value':intUtil[_0xb850('0xd')](_0x576182[_0xb850('0xe')],_0x52da50,'\x20')},{'name':'assigned_user_id','value':_0x37c2d5['id']},{'name':_0xb850('0xf'),'value':_0x37c2d5['id']},{'name':_0xb850('0x10'),'value':intUtil['getString'](_0x576182[_0xb850('0x11')],_0x52da50,'\x0a')},{'name':_0xb850('0x12'),'value':_0x2ffc99[_0xb850('0x13')]()[_0xb850('0x14')](0x0,0x13)[_0xb850('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xb850('0x16'),'value':'15'},{'name':_0xb850('0x17'),'value':_0x40f1d6['id']},{'name':_0xb850('0x18'),'value':_0xb850('0x19')},{'name':_0xb850('0x1a'),'value':_0x40f1d6[_0xb850('0x1b')]},{'name':_0xb850('0x1c'),'value':_0x4f6ba4}];if(_0x1dcc4a['length']){_[_0xb850('0x1d')](_0x1dcc4a,function(_0x3d981e){if(_0x52da50[_0x3d981e[_0xb850('0x1e')]]){_0x39a2c1[_0xb850('0x1f')]({'name':_0x3d981e[_0xb850('0x20')],'value':_0x52da50[_0x3d981e[_0xb850('0x1e')]]});}});}return request({'form':{'method':_0xb850('0x21'),'input_type':_0xb850('0x22'),'response_type':_0xb850('0x22'),'rest_data':JSON['stringify']({'session':_0x2ea16e['id'],'module_name':'Calls','name_value_list':_0x39a2c1})}});}function getAuth(_0x51e0c5){return util['format'](_0xb850('0x23'),new Buffer(_0x51e0c5['apiKey']+':X')[_0xb850('0x24')](_0xb850('0x25')));}function getServerInfo(_0x3a4584){return request({'form':{'method':_0xb850('0x26'),'input_type':_0xb850('0x22'),'response_type':'JSON','rest_data':JSON[_0xb850('0x27')]({'session':_0x3a4584['id']})}});}function getUser(_0x59183e,_0x460850,_0x516de6){if(!_[_0xb850('0x28')](_0x460850)){logger[_0xb850('0xb')]('Getting\x20agent\x20with\x20name',_0x460850);return request({'form':{'method':_0xb850('0x29'),'input_type':_0xb850('0x22'),'response_type':'JSON','rest_data':JSON[_0xb850('0x27')]({'session':_0x516de6['id'],'module_name':_0xb850('0x2a'),'query':util[_0xb850('0x2b')](_0xb850('0x2c'),_0x460850),'order_by':'','offset':'0','select_fields':['id',_0xb850('0x1b'),_0xb850('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb850('0x2e')](function(_0x58d763){if(_0x58d763[_0xb850('0x2f')][_0xb850('0x30')]){var _0x371c98=_[_0xb850('0x31')](_0x58d763[_0xb850('0x2f')],function(_0x3b3947){return _0x3b3947[_0xb850('0x32')][_0xb850('0x2d')][_0xb850('0x33')]===_0x460850;});if(_0x371c98){logger[_0xb850('0xb')]('Agent\x20found!');return BPromise[_0xb850('0x34')]({'id':_0x371c98['name_value_list']['id'][_0xb850('0x33')],'name':_0x371c98[_0xb850('0x32')][_0xb850('0x1b')][_0xb850('0x33')]});}}logger[_0xb850('0xb')](_0xb850('0x35'));return BPromise[_0xb850('0x34')]({'id':_0x516de6['name_value_list'][_0xb850('0x36')][_0xb850('0x33')],'name':_0x516de6['name_value_list'][_0xb850('0x2d')][_0xb850('0x33')]});});}else{logger[_0xb850('0xb')](_0xb850('0x37'));return BPromise[_0xb850('0x34')]({'id':_0x516de6['name_value_list'][_0xb850('0x36')]['value'],'name':_0x516de6['name_value_list']['user_name'][_0xb850('0x33')]});}}function getEndUser(_0x3f2001,_0x38e9d4,_0x5e8831,_0x2291bd){logger['info'](_0xb850('0x38'),_0x5e8831);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xb850('0x22'),'rest_data':JSON['stringify']({'session':_0x2291bd['id'],'module_name':_0xb850('0x19'),'query':util[_0xb850('0x2b')](_0xb850('0x39'),_0x5e8831),'order_by':'','offset':'0','select_fields':['id',_0xb850('0x1b'),_0xb850('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb850('0x2e')](function(_0x214293){if(_0x214293[_0xb850('0x2f')][_0xb850('0x30')]){var _0x47296a=_[_0xb850('0x31')](_0x214293[_0xb850('0x2f')],function(_0x36e4dd){return _0x36e4dd[_0xb850('0x32')][_0xb850('0x3a')][_0xb850('0x33')]===_0x5e8831;});if(_0x47296a){logger[_0xb850('0xb')](_0xb850('0x3b'));return BPromise[_0xb850('0x34')]({'id':_0x47296a['name_value_list']['id']['value'],'name':_0x47296a[_0xb850('0x32')][_0xb850('0x1b')][_0xb850('0x33')],'phone':_0x47296a['name_value_list']['phone_home'][_0xb850('0x33')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xb850('0x21'),'input_type':_0xb850('0x22'),'response_type':'JSON','rest_data':JSON[_0xb850('0x27')]({'session':_0x2291bd['id'],'module_name':_0xb850('0x19'),'name_value_list':[{'name':_0xb850('0x3c'),'value':_0x38e9d4!==_0xb850('0x3d')?_0x38e9d4:util[_0xb850('0x2b')](_0xb850('0x3e'),_0x5e8831)},{'name':'phone_home','value':_0x5e8831}]})}})[_0xb850('0x2e')](function(_0x5de9ec){logger[_0xb850('0xb')](_0xb850('0x3f'));return BPromise[_0xb850('0x34')]({'id':_0x5de9ec['id'],'name':_0x5de9ec[_0xb850('0x2f')][_0xb850('0x3c')]['value'],'phone':_0x5de9ec[_0xb850('0x2f')][_0xb850('0x3a')][_0xb850('0x33')]});});}});}function request(_0x24f076){logger[_0xb850('0x40')](_0xb850('0x41'),JSON[_0xb850('0x27')](_0x24f076));return rp(_['merge'](def,_0x24f076));}function getTags(_0x4faa60,_0x26853a){var _0x416659=[];if(_0x4faa60&&_0x4faa60['length']>0x0){_0x416659=_[_0xb850('0x42')](_0x4faa60,_0x26853a);}return _0x416659;}function getCustomFields(_0x5575b2,_0x926329){var _0x33929f=[];var _0x4fa486={'custom_fields':[]};if(_0x5575b2[_0xb850('0x30')]>0x0){_[_0xb850('0x1d')](_0x5575b2,function(_0x2a88e4){if(_0x2a88e4[_0xb850('0x43')]===_0xb850('0x44')&&_0x2a88e4[_0xb850('0x45')]&&!_0x2a88e4[_0xb850('0x46')]){_0x4fa486[_0x2a88e4[_0xb850('0x45')][_0xb850('0x47')]()]=_0x2a88e4[_0xb850('0x48')]['toString']();}else if(_0x2a88e4[_0xb850('0x43')]===_0xb850('0x44')&&_0x2a88e4[_0xb850('0x20')]&&_0x2a88e4['customField']){_0x4fa486[_0xb850('0x49')][_0xb850('0x1f')]({'id':_0x2a88e4[_0xb850('0x20')],'value':_0x2a88e4['content']['toString']()});}else if(_0x2a88e4[_0xb850('0x43')]===_0xb850('0x4a')&&_0x2a88e4[_0xb850('0x1e')]&&_0x2a88e4[_0xb850('0x20')]&&_0x2a88e4[_0xb850('0x46')]){_0x926329[_0x2a88e4[_0xb850('0x1e')]]&&_0x4fa486[_0xb850('0x49')][_0xb850('0x1f')]({'id':_0x2a88e4[_0xb850('0x20')],'value':_0x926329[_0x2a88e4[_0xb850('0x1e')]]['toString']()});}else if(_0x2a88e4[_0xb850('0x43')]==='customVariable'&&_0x2a88e4['Variable']&&_0x2a88e4[_0xb850('0x4b')]['name']&&_0x2a88e4[_0xb850('0x20')]&&_0x2a88e4['customField']){_0x926329[_0x2a88e4['Variable'][_0xb850('0x1b')][_0xb850('0x47')]()]&&_0x4fa486[_0xb850('0x49')][_0xb850('0x1f')]({'id':_0x2a88e4[_0xb850('0x20')],'value':_0x926329[_0x2a88e4['Variable'][_0xb850('0x1b')][_0xb850('0x47')]()]['toString']()});}});}return _0x4fa486;}function getConnection(_0x39db24){return request({'method':_0xb850('0x9'),'form':{'method':_0xb850('0x4c'),'input_type':'JSON','response_type':_0xb850('0x22'),'rest_data':JSON[_0xb850('0x27')]({'user_auth':{'user_name':_0x39db24[_0xb850('0x4d')],'password':_0x39db24[_0xb850('0x4e')],'encryption':'PLAIN'},'application':_0xb850('0x4f')})}})['then'](function(_0x2f8f79){var _0x3977bf=_0x2f8f79;if(_0x3977bf['id']){def[_0xb850('0x50')]=_0x3977bf['id'];return BPromise[_0xb850('0x34')](_0x3977bf);}else{throw new Error(util[_0xb850('0x2b')](_0xb850('0x51'),_0x39db24['id']));}});}function setRelationship(_0x1ac4d3,_0x230a53,_0x3e6209,_0x2bfbfc){return request({'form':{'method':_0xb850('0x52'),'input_type':_0xb850('0x22'),'response_type':_0xb850('0x22'),'rest_data':JSON['stringify']({'session':_0x1ac4d3['id'],'module_name':_0xb850('0x53'),'module_id':_0x3e6209['id'],'link_field_name':_0x2bfbfc,'related_ids':[_0x230a53['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xb850('0x54')]=function(_0x387ce6,_0x5d12cd,_0x3782b2,_0x52c898,_0x48f609,_0x2c6ef5){var _0x178639,_0x2f341f,_0x11c57e,_0x28814d;_0x2c6ef5[_0xb850('0x55')]=intUtil[_0xb850('0x56')](_0x2c6ef5['remoteUri']);_0x2c6ef5[_0xb850('0x57')]=intUtil['stripTrailingSlash'](_0x2c6ef5[_0xb850('0x57')]);def[_0xb850('0x58')]=util[_0xb850('0x2b')](_0xb850('0x59'),_0x2c6ef5['remoteUri']);if(_0x48f609&&_0x48f609[_0xb850('0x5a')]){logger[_0xb850('0xb')](_0xb850('0x5b'),_0xb850('0x5c'));_0x5d12cd[_0xb850('0x5d')]=util[_0xb850('0x2b')](_0xb850('0x5e'),_0x2c6ef5['serverUrl'],_0x5d12cd[_0xb850('0x5f')],md5(_0x5d12cd[_0xb850('0x5f')]));}else{_0x5d12cd[_0xb850('0x5d')]='';}return getConnection(_0x2c6ef5)[_0xb850('0x2e')](function(_0x372ad3){_0x28814d=_0x372ad3;return getUser(_0x2c6ef5,_0x52c898['name'],_0x28814d);})[_0xb850('0x2e')](function(_0x5e0f4b){_0x178639=_0x5e0f4b;logger[_0xb850('0xb')](_0xb850('0x60'),_0x178639['id']);return getEndUser(_0x2c6ef5,_0x5d12cd['calleridname'],_0x5d12cd[_0xb850('0x61')],_0x28814d);})[_0xb850('0x2e')](function(_0x3b0771){_0x2f341f=_0x3b0771;logger[_0xb850('0xb')](_0xb850('0x62'),_0x2f341f['id']);return getTicket(_0x2c6ef5,_0x178639,_0x2f341f,_0x3782b2,_0x5d12cd,_0x3782b2[_0xb850('0x63')],_0x28814d,_0xb850('0x64'));})['then'](function(_0x54427a){_0x11c57e=_0x54427a;logger[_0xb850('0xb')](_0xb850('0x65'));logger['info'](_0xb850('0x66'),_0x11c57e['id']);return setRelationship(_0x28814d,_0x178639,_0x11c57e,'users');})[_0xb850('0x2e')](function(){return setRelationship(_0x28814d,_0x2f341f,_0x11c57e,_0xb850('0x67'));})[_0xb850('0x2e')](function(){return getServerInfo(_0x28814d);})[_0xb850('0x2e')](function(_0x38831c){var _0x5d179d=parseInt(_0x38831c[_0xb850('0x68')]['charAt'](0x0));var _0x285771=util[_0xb850('0x2b')](_0xb850('0x69'),_0x2c6ef5[_0xb850('0x55')],_0x11c57e['id']);if(_0x5d179d>0x6){_0x285771=util[_0xb850('0x2b')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2c6ef5[_0xb850('0x55')],_0x11c57e['id']);}logger[_0xb850('0xb')]('[QUEUE]',_0xb850('0x6a'));emit(util[_0xb850('0x2b')](_0xb850('0x6b'),_0x52c898[_0xb850('0x1b')]),_0xb850('0x6c'),{'uri':_0x285771});})[_0xb850('0x6d')](function(_0x18bbdc){logger[_0xb850('0x6e')](_0xb850('0x5b'),JSON[_0xb850('0x27')](_0x18bbdc));});};exports[_0xb850('0x6f')]=function(_0x2419b4,_0x1e7fd0,_0x2dc759,_0x795e8c,_0x3255db,_0x4168fe,_0x2e744a){var _0x4e76d7,_0x3c4359,_0x1de23d,_0x29524d;_0x4168fe[_0xb850('0x55')]=intUtil[_0xb850('0x56')](_0x4168fe['remoteUri']);_0x4168fe[_0xb850('0x57')]=intUtil[_0xb850('0x56')](_0x4168fe[_0xb850('0x57')]);def[_0xb850('0x58')]=util[_0xb850('0x2b')](_0xb850('0x59'),_0x4168fe[_0xb850('0x55')]);if(_0x2e744a&&_0x2e744a[_0xb850('0x70')]&&_0x2e744a[_0xb850('0x70')]!==_0xb850('0x71')){logger['info'](_0xb850('0x72'),_0xb850('0x5c'));_0x1e7fd0[_0xb850('0x5d')]=util['format'](_0xb850('0x5e'),_0x4168fe[_0xb850('0x57')],_0x1e7fd0[_0xb850('0x5f')],md5(_0x1e7fd0[_0xb850('0x5f')]));}return getConnection(_0x4168fe)['then'](function(_0x433f74){_0x29524d=_0x433f74;return getUser(_0x4168fe,_0x795e8c[_0xb850('0x1b')],_0x29524d);})['then'](function(_0x513140){_0x4e76d7=_0x513140;logger[_0xb850('0xb')](_0xb850('0x60'),_0x4e76d7['id']);return getEndUser(_0x4168fe,_0x1e7fd0['destcalleridname'],_0x1e7fd0[_0xb850('0x73')],_0x29524d);})[_0xb850('0x2e')](function(_0x3f0891){_0x3c4359=_0x3f0891;logger[_0xb850('0xb')](_0xb850('0x62'),_0x3c4359['id']);return getTicket(_0x4168fe,_0x4e76d7,_0x3c4359,_0x2dc759,_0x1e7fd0,_0x2dc759[_0xb850('0x63')],_0x29524d,_0xb850('0x74'));})[_0xb850('0x2e')](function(_0x40780e){_0x1de23d=_0x40780e;logger['info']('Ticket\x20created!');logger[_0xb850('0xb')]('The\x20Ticket\x20ID\x20is:',_0x1de23d['id']);return setRelationship(_0x29524d,_0x4e76d7,_0x1de23d,_0xb850('0x75'));})[_0xb850('0x2e')](function(){return setRelationship(_0x29524d,_0x3c4359,_0x1de23d,_0xb850('0x67'));})['then'](function(){return getServerInfo(_0x29524d);})[_0xb850('0x2e')](function(_0x5cf54f){var _0x51b333=parseInt(_0x5cf54f[_0xb850('0x68')][_0xb850('0x76')](0x0));var _0x5a5138=util[_0xb850('0x2b')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x4168fe[_0xb850('0x55')],_0x1de23d['id']);if(_0x51b333>0x6){_0x5a5138=util['format'](_0xb850('0x77'),_0x4168fe[_0xb850('0x55')],_0x1de23d['id']);}logger[_0xb850('0xb')]('[OUTBOUND]',_0xb850('0x6a'));emit(util[_0xb850('0x2b')](_0xb850('0x6b'),_0x795e8c[_0xb850('0x1b')]),_0xb850('0x6c'),{'uri':_0x5a5138});})[_0xb850('0x6d')](function(_0x5a6fc7){logger['error']('[OUTBOUND]',JSON[_0xb850('0x27')](_0x5a6fc7));});};exports[_0xb850('0x78')]=function(_0xd43e9f,_0x33d535,_0x124516,_0x49298b,_0x12207d,_0x174202){var _0x46ce53,_0x1ecef4,_0x51b202,_0x583abc;_0x174202['remoteUri']=intUtil['stripTrailingSlash'](_0x174202[_0xb850('0x55')]);_0x174202['serverUrl']=intUtil['stripTrailingSlash'](_0x174202['serverUrl']);def[_0xb850('0x58')]=util['format'](_0xb850('0x59'),_0x174202[_0xb850('0x55')]);if(_0x12207d&&_0x12207d['monitor_format']){logger['info']('['+_0x33d535[_0xb850('0x79')][_0xb850('0x7a')]()+']',_0xb850('0x5c'));_0x33d535[_0xb850('0x5d')]=util[_0xb850('0x2b')](_0xb850('0x5e'),_0x174202[_0xb850('0x57')],_0x33d535[_0xb850('0x5f')],md5(_0x33d535['uniqueid']));}else{_0x33d535[_0xb850('0x5d')]='';}return getConnection(_0x174202)[_0xb850('0x2e')](function(_0x3ecfcc){_0x583abc=_0x3ecfcc;if(!_[_0xb850('0x28')](_0x49298b)){return getUser(_0x174202,_0x49298b[_0xb850('0x1b')],_0x583abc);}else{return getUser(_0x174202,null,_0x583abc);}})['then'](function(_0x31ca4c){_0x46ce53=_0x31ca4c;logger[_0xb850('0xb')](_0xb850('0x60'),_0x46ce53['id']);return getEndUser(_0x174202,_0x33d535[_0xb850('0x7b')],_0x33d535[_0xb850('0x61')],_0x583abc);})[_0xb850('0x2e')](function(_0x482707){_0x1ecef4=_0x482707;logger['info'](_0xb850('0x62'),_0x1ecef4['id']);return getTicket(_0x174202,_0x46ce53,_0x1ecef4,_0x124516,_0x33d535,_0x124516[_0xb850('0x63')],_0x583abc,_0xb850('0x64'));})['then'](function(_0x205374){_0x51b202=_0x205374;logger[_0xb850('0xb')](_0xb850('0x65'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x51b202['id']);return setRelationship(_0x583abc,_0x46ce53,_0x51b202,_0xb850('0x75'));})[_0xb850('0x2e')](function(){return setRelationship(_0x583abc,_0x1ecef4,_0x51b202,_0xb850('0x67'));})[_0xb850('0x2e')](function(){return getServerInfo(_0x583abc);})[_0xb850('0x6d')](function(_0x2a92fb){logger[_0xb850('0x6e')]('['+_0x33d535[_0xb850('0x79')]['toUpperCase']()+']',JSON[_0xb850('0x27')](_0x2a92fb));});}; \ No newline at end of file +var _0x4744=['getString','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','map','forEach','type','nameField','toLowerCase','content','toString','string','customField','custom_fields','customVariable','Variable','login','username','password','PLAIN','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','catch','error','unmanaged','monitor_format','toUpperCase','Inbound','contacts','lastevent','lodash','request-promise','util','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description'];(function(_0xf44d98,_0x12a472){var _0x5ebb04=function(_0x930c33){while(--_0x930c33){_0xf44d98['push'](_0xf44d98['shift']());}};_0x5ebb04(++_0x12a472);}(_0x4744,0x1dd));var _0x4474=function(_0x5522f3,_0x40e0bf){_0x5522f3=_0x5522f3-0x0;var _0x84e4e=_0x4744[_0x5522f3];return _0x84e4e;};'use strict';var _=require(_0x4474('0x0'));var rp=require(_0x4474('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x4474('0x2'));var Redis=require('ioredis');var intUtil=require(_0x4474('0x3'));var config=require(_0x4474('0x4'));var logger=require('../../../../config/logger')(_0x4474('0x5'));config[_0x4474('0x6')]=_[_0x4474('0x7')](config['redis'],{'host':_0x4474('0x8'),'port':0x18eb});var io=require(_0x4474('0x9'))(new Redis(config[_0x4474('0x6')]));var def={'method':_0x4474('0xa'),'json':!![]};function emit(_0x2f58b6,_0x39fb62,_0x51c179){io['to'](_0x2f58b6)[_0x4474('0xb')](_0x39fb62,_0x51c179);}function getTicket(_0x2f0dfb,_0x223d81,_0x57f68e,_0x1dd4e5,_0x53defa,_0x25d88f,_0x2e89be,_0x71569a){logger[_0x4474('0xc')](_0x4474('0xd'));var _0x2a789d=new Date();var _0x9b3558=[{'name':_0x4474('0xe'),'value':intUtil['getString'](_0x1dd4e5[_0x4474('0xf')],_0x53defa,'\x20')},{'name':_0x4474('0x10'),'value':_0x223d81['id']},{'name':_0x4474('0x11'),'value':_0x223d81['id']},{'name':_0x4474('0x12'),'value':intUtil[_0x4474('0x13')](_0x1dd4e5[_0x4474('0x14')],_0x53defa,'\x0a')},{'name':_0x4474('0x15'),'value':_0x2a789d['toISOString']()[_0x4474('0x16')](0x0,0x13)[_0x4474('0x17')]('T','\x20')},{'name':_0x4474('0x18'),'value':'0'},{'name':_0x4474('0x19'),'value':'15'},{'name':_0x4474('0x1a'),'value':_0x57f68e['id']},{'name':_0x4474('0x1b'),'value':_0x4474('0x1c')},{'name':_0x4474('0x1d'),'value':_0x57f68e[_0x4474('0xe')]},{'name':'direction','value':_0x71569a}];if(_0x25d88f[_0x4474('0x1e')]){_['forEach'](_0x25d88f,function(_0x240a76){if(_0x53defa[_0x240a76[_0x4474('0x1f')]]){_0x9b3558[_0x4474('0x20')]({'name':_0x240a76[_0x4474('0x21')],'value':_0x53defa[_0x240a76[_0x4474('0x1f')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x4474('0x22'),'response_type':'JSON','rest_data':JSON[_0x4474('0x23')]({'session':_0x2e89be['id'],'module_name':_0x4474('0x24'),'name_value_list':_0x9b3558})}});}function getAuth(_0x24a8ad){return util[_0x4474('0x25')](_0x4474('0x26'),new Buffer(_0x24a8ad[_0x4474('0x27')]+':X')['toString'](_0x4474('0x28')));}function getServerInfo(_0x1240a4){return request({'form':{'method':_0x4474('0x29'),'input_type':_0x4474('0x22'),'response_type':'JSON','rest_data':JSON[_0x4474('0x23')]({'session':_0x1240a4['id']})}});}function getUser(_0x2100b8,_0x2e003f,_0x4e4d77){if(!_[_0x4474('0x2a')](_0x2e003f)){logger[_0x4474('0xc')](_0x4474('0x2b'),_0x2e003f);return request({'form':{'method':_0x4474('0x2c'),'input_type':_0x4474('0x22'),'response_type':_0x4474('0x22'),'rest_data':JSON[_0x4474('0x23')]({'session':_0x4e4d77['id'],'module_name':_0x4474('0x2d'),'query':util[_0x4474('0x25')](_0x4474('0x2e'),_0x2e003f),'order_by':'','offset':'0','select_fields':['id',_0x4474('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4474('0x2f')](function(_0x5a2e15){if(_0x5a2e15[_0x4474('0x30')][_0x4474('0x1e')]){var _0x22abfe=_[_0x4474('0x31')](_0x5a2e15[_0x4474('0x30')],function(_0x3617f2){return _0x3617f2[_0x4474('0x32')]['user_name'][_0x4474('0x33')]===_0x2e003f;});if(_0x22abfe){logger[_0x4474('0xc')](_0x4474('0x34'));return BPromise['resolve']({'id':_0x22abfe[_0x4474('0x32')]['id'][_0x4474('0x33')],'name':_0x22abfe[_0x4474('0x32')]['name'][_0x4474('0x33')]});}}logger[_0x4474('0xc')](_0x4474('0x35'));return BPromise[_0x4474('0x36')]({'id':_0x4e4d77[_0x4474('0x32')][_0x4474('0x37')][_0x4474('0x33')],'name':_0x4e4d77[_0x4474('0x32')][_0x4474('0x38')][_0x4474('0x33')]});});}else{logger[_0x4474('0xc')](_0x4474('0x39'));return BPromise[_0x4474('0x36')]({'id':_0x4e4d77[_0x4474('0x32')]['user_id']['value'],'name':_0x4e4d77[_0x4474('0x32')][_0x4474('0x38')]['value']});}}function getEndUser(_0x386d44,_0x34de14,_0x44ff29,_0xcd4b3b){logger[_0x4474('0xc')]('Searching\x20enduser\x20with\x20phone',_0x44ff29);return request({'form':{'method':_0x4474('0x2c'),'input_type':_0x4474('0x22'),'response_type':_0x4474('0x22'),'rest_data':JSON[_0x4474('0x23')]({'session':_0xcd4b3b['id'],'module_name':_0x4474('0x1c'),'query':util[_0x4474('0x25')](_0x4474('0x3a'),_0x44ff29),'order_by':'','offset':'0','select_fields':['id',_0x4474('0xe'),_0x4474('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4474('0x2f')](function(_0x2383fc){if(_0x2383fc[_0x4474('0x30')][_0x4474('0x1e')]){var _0xb19f96=_['find'](_0x2383fc[_0x4474('0x30')],function(_0x75c632){return _0x75c632[_0x4474('0x32')]['phone_home'][_0x4474('0x33')]===_0x44ff29;});if(_0xb19f96){logger[_0x4474('0xc')](_0x4474('0x3c'));return BPromise['resolve']({'id':_0xb19f96[_0x4474('0x32')]['id'][_0x4474('0x33')],'name':_0xb19f96[_0x4474('0x32')][_0x4474('0xe')][_0x4474('0x33')],'phone':_0xb19f96[_0x4474('0x32')][_0x4474('0x3b')][_0x4474('0x33')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0x4474('0x22'),'response_type':_0x4474('0x22'),'rest_data':JSON[_0x4474('0x23')]({'session':_0xcd4b3b['id'],'module_name':_0x4474('0x1c'),'name_value_list':[{'name':_0x4474('0x3d'),'value':_0x34de14!==_0x4474('0x3e')?_0x34de14:util[_0x4474('0x25')](_0x4474('0x3f'),_0x44ff29)},{'name':_0x4474('0x3b'),'value':_0x44ff29}]})}})['then'](function(_0x51d1e4){logger['info'](_0x4474('0x40'));return BPromise[_0x4474('0x36')]({'id':_0x51d1e4['id'],'name':_0x51d1e4[_0x4474('0x30')][_0x4474('0x3d')]['value'],'phone':_0x51d1e4['entry_list'][_0x4474('0x3b')][_0x4474('0x33')]});});}});}function request(_0x56c6ba){logger[_0x4474('0x41')]('[HTTP]',JSON['stringify'](_0x56c6ba));return rp(_['merge'](def,_0x56c6ba));}function getTags(_0x503878,_0x30679e){var _0xf8a7ac=[];if(_0x503878&&_0x503878[_0x4474('0x1e')]>0x0){_0xf8a7ac=_[_0x4474('0x42')](_0x503878,_0x30679e);}return _0xf8a7ac;}function getCustomFields(_0x2ec67b,_0x4531e4){var _0x4bfb57=[];var _0x2d50d8={'custom_fields':[]};if(_0x2ec67b[_0x4474('0x1e')]>0x0){_[_0x4474('0x43')](_0x2ec67b,function(_0x1ac93f){if(_0x1ac93f[_0x4474('0x44')]==='string'&&_0x1ac93f['nameField']&&!_0x1ac93f['customField']){_0x2d50d8[_0x1ac93f[_0x4474('0x45')][_0x4474('0x46')]()]=_0x1ac93f[_0x4474('0x47')][_0x4474('0x48')]();}else if(_0x1ac93f[_0x4474('0x44')]===_0x4474('0x49')&&_0x1ac93f['idField']&&_0x1ac93f[_0x4474('0x4a')]){_0x2d50d8[_0x4474('0x4b')]['push']({'id':_0x1ac93f[_0x4474('0x21')],'value':_0x1ac93f['content'][_0x4474('0x48')]()});}else if(_0x1ac93f['type']==='variable'&&_0x1ac93f[_0x4474('0x1f')]&&_0x1ac93f[_0x4474('0x21')]&&_0x1ac93f[_0x4474('0x4a')]){_0x4531e4[_0x1ac93f[_0x4474('0x1f')]]&&_0x2d50d8['custom_fields'][_0x4474('0x20')]({'id':_0x1ac93f[_0x4474('0x21')],'value':_0x4531e4[_0x1ac93f[_0x4474('0x1f')]][_0x4474('0x48')]()});}else if(_0x1ac93f[_0x4474('0x44')]===_0x4474('0x4c')&&_0x1ac93f[_0x4474('0x4d')]&&_0x1ac93f['Variable'][_0x4474('0xe')]&&_0x1ac93f[_0x4474('0x21')]&&_0x1ac93f[_0x4474('0x4a')]){_0x4531e4[_0x1ac93f[_0x4474('0x4d')]['name'][_0x4474('0x46')]()]&&_0x2d50d8[_0x4474('0x4b')][_0x4474('0x20')]({'id':_0x1ac93f['idField'],'value':_0x4531e4[_0x1ac93f[_0x4474('0x4d')][_0x4474('0xe')][_0x4474('0x46')]()]['toString']()});}});}return _0x2d50d8;}function getConnection(_0x4d113b){return request({'method':_0x4474('0xa'),'form':{'method':_0x4474('0x4e'),'input_type':_0x4474('0x22'),'response_type':'JSON','rest_data':JSON[_0x4474('0x23')]({'user_auth':{'user_name':_0x4d113b[_0x4474('0x4f')],'password':_0x4d113b[_0x4474('0x50')],'encryption':_0x4474('0x51')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x4474('0x2f')](function(_0xcad273){var _0x3dcdb4=_0xcad273;if(_0x3dcdb4['id']){def[_0x4474('0x52')]=_0x3dcdb4['id'];return BPromise[_0x4474('0x36')](_0x3dcdb4);}else{throw new Error(util[_0x4474('0x25')]('Account\x20%d\x20is\x20not\x20valid',_0x4d113b['id']));}});}function setRelationship(_0x2791fa,_0x22156f,_0x142d0e,_0x1bb005){return request({'form':{'method':_0x4474('0x53'),'input_type':_0x4474('0x22'),'response_type':'JSON','rest_data':JSON[_0x4474('0x23')]({'session':_0x2791fa['id'],'module_name':_0x4474('0x24'),'module_id':_0x142d0e['id'],'link_field_name':_0x1bb005,'related_ids':[_0x22156f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4474('0x54')]=function(_0x51dca9,_0x145947,_0x562c6a,_0x5e43a8,_0x55a060,_0x3c71e5){var _0x2fd884,_0x4a2c12,_0x2dc242,_0xf6526d;_0x3c71e5[_0x4474('0x55')]=intUtil['stripTrailingSlash'](_0x3c71e5['remoteUri']);_0x3c71e5['serverUrl']=intUtil[_0x4474('0x56')](_0x3c71e5[_0x4474('0x57')]);def[_0x4474('0x58')]=util[_0x4474('0x25')](_0x4474('0x59'),_0x3c71e5['remoteUri']);if(_0x55a060&&_0x55a060['monitor_format']){logger[_0x4474('0xc')](_0x4474('0x5a'),_0x4474('0x5b'));_0x145947[_0x4474('0x5c')]=util[_0x4474('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c71e5[_0x4474('0x57')],_0x145947[_0x4474('0x5d')],md5(_0x145947['uniqueid']));}else{_0x145947['recordingURL']='';}return getConnection(_0x3c71e5)[_0x4474('0x2f')](function(_0x3b42e5){_0xf6526d=_0x3b42e5;return getUser(_0x3c71e5,_0x5e43a8['name'],_0xf6526d);})[_0x4474('0x2f')](function(_0x32b0b2){_0x2fd884=_0x32b0b2;logger[_0x4474('0xc')](_0x4474('0x5e'),_0x2fd884['id']);return getEndUser(_0x3c71e5,_0x145947[_0x4474('0x5f')],_0x145947[_0x4474('0x60')],_0xf6526d);})[_0x4474('0x2f')](function(_0x279539){_0x4a2c12=_0x279539;logger[_0x4474('0xc')](_0x4474('0x61'),_0x4a2c12['id']);return getTicket(_0x3c71e5,_0x2fd884,_0x4a2c12,_0x562c6a,_0x145947,_0x562c6a[_0x4474('0x62')],_0xf6526d,'Inbound');})[_0x4474('0x2f')](function(_0x32a50e){_0x2dc242=_0x32a50e;logger[_0x4474('0xc')](_0x4474('0x63'));logger[_0x4474('0xc')](_0x4474('0x64'),_0x2dc242['id']);return setRelationship(_0xf6526d,_0x2fd884,_0x2dc242,_0x4474('0x65'));})['then'](function(){return setRelationship(_0xf6526d,_0x4a2c12,_0x2dc242,'contacts');})[_0x4474('0x2f')](function(){return getServerInfo(_0xf6526d);})['then'](function(_0x25d127){var _0x3244ff=parseInt(_0x25d127[_0x4474('0x66')][_0x4474('0x67')](0x0));var _0x1c93ef=util['format'](_0x4474('0x68'),_0x3c71e5[_0x4474('0x55')],_0x2dc242['id']);if(_0x3244ff>0x6){_0x1c93ef=util[_0x4474('0x25')](_0x4474('0x69'),_0x3c71e5['remoteUri'],_0x2dc242['id']);}logger[_0x4474('0xc')]('[QUEUE]',_0x4474('0x6a'));emit(util[_0x4474('0x25')](_0x4474('0x6b'),_0x5e43a8[_0x4474('0xe')]),_0x4474('0x6c'),{'uri':_0x1c93ef});})['catch'](function(_0x293e22){logger['error'](_0x4474('0x5a'),JSON['stringify'](_0x293e22));});};exports[_0x4474('0x6d')]=function(_0x44f8df,_0x275b05,_0x597f84,_0x1b8761,_0x15114f,_0x5cf1a0,_0x1dc28b){var _0x4342ee,_0x100978,_0x2e6d78,_0xcb3c36;_0x5cf1a0[_0x4474('0x55')]=intUtil['stripTrailingSlash'](_0x5cf1a0[_0x4474('0x55')]);_0x5cf1a0[_0x4474('0x57')]=intUtil[_0x4474('0x56')](_0x5cf1a0[_0x4474('0x57')]);def[_0x4474('0x58')]=util[_0x4474('0x25')](_0x4474('0x59'),_0x5cf1a0[_0x4474('0x55')]);if(_0x1dc28b&&_0x1dc28b[_0x4474('0x6e')]&&_0x1dc28b[_0x4474('0x6e')]!=='none'){logger[_0x4474('0xc')]('[OUTBOUND]',_0x4474('0x5b'));_0x275b05[_0x4474('0x5c')]=util[_0x4474('0x25')](_0x4474('0x6f'),_0x5cf1a0[_0x4474('0x57')],_0x275b05['uniqueid'],md5(_0x275b05[_0x4474('0x5d')]));}return getConnection(_0x5cf1a0)['then'](function(_0x42c0d6){_0xcb3c36=_0x42c0d6;return getUser(_0x5cf1a0,_0x1b8761[_0x4474('0xe')],_0xcb3c36);})[_0x4474('0x2f')](function(_0x58377c){_0x4342ee=_0x58377c;logger['info'](_0x4474('0x5e'),_0x4342ee['id']);return getEndUser(_0x5cf1a0,_0x275b05[_0x4474('0x70')],_0x275b05[_0x4474('0x71')],_0xcb3c36);})[_0x4474('0x2f')](function(_0x3fd50e){_0x100978=_0x3fd50e;logger[_0x4474('0xc')]('The\x20Enduser\x20ID\x20is:',_0x100978['id']);return getTicket(_0x5cf1a0,_0x4342ee,_0x100978,_0x597f84,_0x275b05,_0x597f84['Fields'],_0xcb3c36,_0x4474('0x72'));})[_0x4474('0x2f')](function(_0x56ba3c){_0x2e6d78=_0x56ba3c;logger[_0x4474('0xc')](_0x4474('0x63'));logger['info'](_0x4474('0x64'),_0x2e6d78['id']);return setRelationship(_0xcb3c36,_0x4342ee,_0x2e6d78,_0x4474('0x65'));})[_0x4474('0x2f')](function(){return setRelationship(_0xcb3c36,_0x100978,_0x2e6d78,'contacts');})['then'](function(){return getServerInfo(_0xcb3c36);})[_0x4474('0x2f')](function(_0x337f7b){var _0x3ba2c4=parseInt(_0x337f7b['version'][_0x4474('0x67')](0x0));var _0x47e58e=util[_0x4474('0x25')](_0x4474('0x68'),_0x5cf1a0[_0x4474('0x55')],_0x2e6d78['id']);if(_0x3ba2c4>0x6){_0x47e58e=util[_0x4474('0x25')](_0x4474('0x69'),_0x5cf1a0[_0x4474('0x55')],_0x2e6d78['id']);}logger['info'](_0x4474('0x73'),_0x4474('0x6a'));emit(util[_0x4474('0x25')]('user:%s',_0x1b8761[_0x4474('0xe')]),'trigger:browser:url',{'uri':_0x47e58e});})[_0x4474('0x74')](function(_0xf37fe6){logger[_0x4474('0x75')](_0x4474('0x73'),JSON['stringify'](_0xf37fe6));});};exports[_0x4474('0x76')]=function(_0x1a064b,_0x898407,_0x53addc,_0x1ff282,_0x3b2a5f,_0xeed424){var _0x170de5,_0x20453f,_0x3a5c0b,_0x2a02f6;_0xeed424[_0x4474('0x55')]=intUtil[_0x4474('0x56')](_0xeed424[_0x4474('0x55')]);_0xeed424['serverUrl']=intUtil[_0x4474('0x56')](_0xeed424[_0x4474('0x57')]);def[_0x4474('0x58')]=util[_0x4474('0x25')](_0x4474('0x59'),_0xeed424[_0x4474('0x55')]);if(_0x3b2a5f&&_0x3b2a5f[_0x4474('0x77')]){logger['info']('['+_0x898407['lastevent'][_0x4474('0x78')]()+']',_0x4474('0x5b'));_0x898407[_0x4474('0x5c')]=util[_0x4474('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xeed424['serverUrl'],_0x898407[_0x4474('0x5d')],md5(_0x898407[_0x4474('0x5d')]));}else{_0x898407[_0x4474('0x5c')]='';}return getConnection(_0xeed424)[_0x4474('0x2f')](function(_0x2d039b){_0x2a02f6=_0x2d039b;if(!_[_0x4474('0x2a')](_0x1ff282)){return getUser(_0xeed424,_0x1ff282['name'],_0x2a02f6);}else{return getUser(_0xeed424,null,_0x2a02f6);}})[_0x4474('0x2f')](function(_0x592545){_0x170de5=_0x592545;logger[_0x4474('0xc')](_0x4474('0x5e'),_0x170de5['id']);return getEndUser(_0xeed424,_0x898407[_0x4474('0x5f')],_0x898407[_0x4474('0x60')],_0x2a02f6);})['then'](function(_0x332b56){_0x20453f=_0x332b56;logger['info'](_0x4474('0x61'),_0x20453f['id']);return getTicket(_0xeed424,_0x170de5,_0x20453f,_0x53addc,_0x898407,_0x53addc['Fields'],_0x2a02f6,_0x4474('0x79'));})['then'](function(_0x5c0f63){_0x3a5c0b=_0x5c0f63;logger[_0x4474('0xc')](_0x4474('0x63'));logger[_0x4474('0xc')]('The\x20Ticket\x20ID\x20is:',_0x3a5c0b['id']);return setRelationship(_0x2a02f6,_0x170de5,_0x3a5c0b,_0x4474('0x65'));})[_0x4474('0x2f')](function(){return setRelationship(_0x2a02f6,_0x20453f,_0x3a5c0b,_0x4474('0x7a'));})[_0x4474('0x2f')](function(){return getServerInfo(_0x2a02f6);})[_0x4474('0x74')](function(_0x2499bd){logger[_0x4474('0x75')]('['+_0x898407[_0x4474('0x7b')][_0x4474('0x78')]()+']',JSON['stringify'](_0x2499bd));});}; \ 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 b1caa93..0b93c9b 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 _0xb206=['variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','validateEmail','isNil','getString','length','type','push','variable'];(function(_0x53bce9,_0x42a009){var _0x20a211=function(_0x3d0912){while(--_0x3d0912){_0x53bce9['push'](_0x53bce9['shift']());}};_0x20a211(++_0x42a009);}(_0xb206,0x10f));var _0x6b20=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xb206[_0x934425];return _0x31d596;};'use strict';var _=require('lodash');var util=require('util');exports[_0x6b20('0x0')]=function(_0x3046ec,_0x308e14,_0x2f167e){var _0x3700b9=[];if(_0x3046ec[_0x6b20('0x1')]>0x0){var _0x1d08ef=_['sortBy'](_0x3046ec,['id']);for(var _0x15a271=0x0;_0x15a271<_0x1d08ef[_0x6b20('0x1')];_0x15a271++){var _0x352356=_0x1d08ef[_0x15a271];if(_0x352356[_0x6b20('0x2')]==='string'){_0x3700b9[_0x6b20('0x3')](_0x352356['content']);}else if(_0x352356['type']===_0x6b20('0x4')&&_0x352356['variableName']){_0x308e14[_0x352356[_0x6b20('0x5')]]&&_0x3700b9[_0x6b20('0x3')](_0x308e14[_0x352356[_0x6b20('0x5')]]['toString']());}else if(_0x352356['type']===_0x6b20('0x6')&&_0x352356['Variable']&&_0x352356[_0x6b20('0x7')][_0x6b20('0x8')]){_0x308e14[_0x352356[_0x6b20('0x7')]['name'][_0x6b20('0x9')]()]&&_0x3700b9[_0x6b20('0x3')](_0x308e14[_0x352356['Variable'][_0x6b20('0x8')]['toLowerCase']()][_0x6b20('0xa')]());}else if(_0x352356['type']===_0x6b20('0xb')){if(_0x352356[_0x6b20('0xc')]===_0x6b20('0xd')&&_0x352356[_0x6b20('0xe')]){_0x3700b9[_0x6b20('0x3')](util[_0x6b20('0xf')](_0x6b20('0x10'),_0x352356['key'],_0x352356[_0x6b20('0x11')]));}else if(_0x352356[_0x6b20('0xc')]===_0x6b20('0x4')&&_0x352356[_0x6b20('0x5')]&&_0x352356[_0x6b20('0xe')]){_0x308e14[_0x352356['variableName']]&&_0x3700b9['push'](util[_0x6b20('0xf')](_0x6b20('0x10'),_0x352356[_0x6b20('0xe')],_0x308e14[_0x352356[_0x6b20('0x5')]]));}else if(_0x352356[_0x6b20('0xc')]===_0x6b20('0x6')&&_0x352356[_0x6b20('0x7')]&&_0x352356['Variable'][_0x6b20('0x8')]&&_0x352356['key']){_0x308e14[_0x352356['Variable']['name'][_0x6b20('0x9')]()]&&_0x3700b9[_0x6b20('0x3')](util['format'](_0x6b20('0x10'),_0x352356[_0x6b20('0xe')],_0x308e14[_0x352356['Variable'][_0x6b20('0x8')][_0x6b20('0x9')]()]));}}}}return _0x3700b9[_0x6b20('0x12')](_0x2f167e);};exports[_0x6b20('0x13')]=function(_0x411486){var _0x40a1b5=_0x411486[_0x6b20('0x14')](-0x1);if(_0x40a1b5==='/'){_0x411486=_0x411486['substring'](0x0,_0x411486['lastIndexOf'](_0x40a1b5));}return _0x411486;};exports[_0x6b20('0x15')]=function(_0x2bda1b){if(!_[_0x6b20('0x16')](_0x2bda1b)&&_0x2bda1b!==''){var _0xf0c48d=/^(([^<>()\[\]\\.,;:\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 _0xf0c48d['test'](String(_0x2bda1b)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x0895=['getString','length','sortBy','type','string','content','variable','variableName','push','toString','name','Variable','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','slice','substring','lastIndexOf','validateEmail','test','lodash','util'];(function(_0x5e237a,_0x459905){var _0x266859=function(_0x14e259){while(--_0x14e259){_0x5e237a['push'](_0x5e237a['shift']());}};_0x266859(++_0x459905);}(_0x0895,0x80));var _0x5089=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0895[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5089('0x0'));var util=require(_0x5089('0x1'));exports[_0x5089('0x2')]=function(_0x2a357d,_0x10c090,_0x1f0acf){var _0x41c5ef=[];if(_0x2a357d[_0x5089('0x3')]>0x0){var _0x18994e=_[_0x5089('0x4')](_0x2a357d,['id']);for(var _0x317d4a=0x0;_0x317d4a<_0x18994e[_0x5089('0x3')];_0x317d4a++){var _0x26d1b5=_0x18994e[_0x317d4a];if(_0x26d1b5[_0x5089('0x5')]===_0x5089('0x6')){_0x41c5ef['push'](_0x26d1b5[_0x5089('0x7')]);}else if(_0x26d1b5[_0x5089('0x5')]===_0x5089('0x8')&&_0x26d1b5[_0x5089('0x9')]){_0x10c090[_0x26d1b5[_0x5089('0x9')]]&&_0x41c5ef[_0x5089('0xa')](_0x10c090[_0x26d1b5[_0x5089('0x9')]][_0x5089('0xb')]());}else if(_0x26d1b5[_0x5089('0x5')]==='customVariable'&&_0x26d1b5['Variable']&&_0x26d1b5['Variable'][_0x5089('0xc')]){_0x10c090[_0x26d1b5[_0x5089('0xd')][_0x5089('0xc')][_0x5089('0xe')]()]&&_0x41c5ef[_0x5089('0xa')](_0x10c090[_0x26d1b5[_0x5089('0xd')]['name'][_0x5089('0xe')]()][_0x5089('0xb')]());}else if(_0x26d1b5[_0x5089('0x5')]===_0x5089('0xf')){if(_0x26d1b5[_0x5089('0x10')]===_0x5089('0x6')&&_0x26d1b5[_0x5089('0x11')]){_0x41c5ef[_0x5089('0xa')](util[_0x5089('0x12')](_0x5089('0x13'),_0x26d1b5[_0x5089('0x11')],_0x26d1b5['keyContent']));}else if(_0x26d1b5[_0x5089('0x10')]===_0x5089('0x8')&&_0x26d1b5['variableName']&&_0x26d1b5['key']){_0x10c090[_0x26d1b5[_0x5089('0x9')]]&&_0x41c5ef['push'](util[_0x5089('0x12')](_0x5089('0x13'),_0x26d1b5[_0x5089('0x11')],_0x10c090[_0x26d1b5[_0x5089('0x9')]]));}else if(_0x26d1b5[_0x5089('0x10')]==='customVariable'&&_0x26d1b5['Variable']&&_0x26d1b5[_0x5089('0xd')][_0x5089('0xc')]&&_0x26d1b5[_0x5089('0x11')]){_0x10c090[_0x26d1b5[_0x5089('0xd')]['name'][_0x5089('0xe')]()]&&_0x41c5ef[_0x5089('0xa')](util[_0x5089('0x12')](_0x5089('0x13'),_0x26d1b5[_0x5089('0x11')],_0x10c090[_0x26d1b5[_0x5089('0xd')][_0x5089('0xc')][_0x5089('0xe')]()]));}}}}return _0x41c5ef[_0x5089('0x14')](_0x1f0acf);};exports['stripTrailingSlash']=function(_0x52454a){var _0x47c906=_0x52454a[_0x5089('0x15')](-0x1);if(_0x47c906==='/'){_0x52454a=_0x52454a[_0x5089('0x16')](0x0,_0x52454a[_0x5089('0x17')](_0x47c906));}return _0x52454a;};exports[_0x5089('0x18')]=function(_0x5b0366){if(!_['isNil'](_0x5b0366)&&_0x5b0366!==''){var _0x53bcd5=/^(([^<>()\[\]\\.,;:\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 _0x53bcd5[_0x5089('0x19')](String(_0x5b0366)[_0x5089('0xe')]());}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 ec3cd73..cf5ffb1 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(_0x30d971,_0x1dbe05){var _0x4a78fc=function(_0x61e03){while(--_0x61e03){_0x30d971['push'](_0x30d971['shift']());}};_0x4a78fc(++_0x1dbe05);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'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 _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x1864ff,_0x71c448){var _0x3e9480=function(_0x521611){while(--_0x521611){_0x1864ff['push'](_0x1864ff['shift']());}};_0x3e9480(++_0x71c448);}(_0xe706,0xa3));var _0x6e70=function(_0x23ac30,_0x2a1d00){_0x23ac30=_0x23ac30-0x0;var _0x208fec=_0xe706[_0x23ac30];return _0x208fec;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 3dc192d..13ef371 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 _0xffeb=['md5','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','format','%s/tickets.json','merge','name','getString','Descriptions','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','user','Admin\x20account\x20selected.','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Caller\x20-\x20%s','Enduser\x20created.','password','username','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','stringify','defaults','GET','forEach','string','picklist','nameField','toLowerCase','content','type','customField','custom_fields','idField','variableName','push','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridnum','\x20Error\x20running\x20Zendesk\x20integration'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xffeb,0xd4));var _0xbffe=function(_0x597ab3,_0x264381){_0x597ab3=_0x597ab3-0x0;var _0x243015=_0xffeb[_0x597ab3];return _0x243015;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xbffe('0x0'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xbffe('0x1'));var config=require(_0xbffe('0x2'));var logger=require(_0xbffe('0x3'))(_0xbffe('0x4'));config[_0xbffe('0x5')]=_['defaults'](config[_0xbffe('0x5')],{'host':_0xbffe('0x6'),'port':0x18eb});var io=require(_0xbffe('0x7'))(new Redis(config[_0xbffe('0x5')]));function emit(_0x5caf3c,_0x3f79c6,_0x5e3eaf){io['to'](_0x5caf3c)[_0xbffe('0x8')](_0x3f79c6,_0x5e3eaf);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x4dfe5e,_0x940d76,_0x9ab900,_0x31c6f9,_0x2b238f){logger[_0xbffe('0x9')](_0xbffe('0xa'));return request({'uri':util[_0xbffe('0xb')](_0xbffe('0xc'),_0x4dfe5e['remoteUri']),'method':'POST','body':{'ticket':_[_0xbffe('0xd')]({'requester_id':_0x9ab900['id'],'submitter_id':_0x940d76?_0x940d76['id']:undefined,'assignee_id':_0x940d76?_0x940d76['id']:undefined,'tags':getTags(_0x31c6f9['Tags'],_0xbffe('0xe')),'subject':intUtil['getString'](_0x31c6f9['Subjects'],_0x2b238f,'\x20'),'description':intUtil[_0xbffe('0xf')](_0x31c6f9[_0xbffe('0x10')],_0x2b238f,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x31c6f9[_0xbffe('0x10')],_0x2b238f,'\x0a')}},getCustomFields(_0x31c6f9['Fields'],_0x2b238f))}})['then'](function(_0x51a771){logger[_0xbffe('0x9')](_0xbffe('0x11'));return _0x51a771[_0xbffe('0x12')];});}function getUser(_0x57ce5a,_0x4631a6){if(intUtil[_0xbffe('0x13')](_0x4631a6)){logger[_0xbffe('0x9')]('Getting\x20agent\x20with\x20email',_0x4631a6);return request({'uri':util[_0xbffe('0xb')](_0xbffe('0x14'),_0x57ce5a['remoteUri']),'qs':{'query':util[_0xbffe('0xb')](_0xbffe('0x15'),_0x4631a6)}})[_0xbffe('0x16')](function(_0x29aaab){if(_0x29aaab[_0xbffe('0x17')]){logger[_0xbffe('0x9')](_0xbffe('0x18'));return _[_0xbffe('0x19')](_0x29aaab[_0xbffe('0x1a')],{'email':_0x4631a6,'role':_0xbffe('0x1b')});}else{logger[_0xbffe('0x9')](_0xbffe('0x1c'));return request({'uri':util[_0xbffe('0xb')](_0xbffe('0x1d'),_0x57ce5a[_0xbffe('0x1e')])})[_0xbffe('0x16')](function(_0x491b7b){logger[_0xbffe('0x9')]('Admin\x20account\x20selected.');return _0x491b7b[_0xbffe('0x1f')];});}});}else{logger[_0xbffe('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xbffe('0xb')]('%s/users/me.json',_0x57ce5a[_0xbffe('0x1e')])})['then'](function(_0x34ffbe){logger['info'](_0xbffe('0x20'));return _0x34ffbe['user'];});}}function getEndUser(_0x9639d9,_0x56e125,_0x57adab){logger['info']('Searching\x20enduser\x20with\x20phone',_0x57adab);return request({'uri':util[_0xbffe('0xb')](_0xbffe('0x14'),_0x9639d9['remoteUri']),'qs':{'query':util[_0xbffe('0xb')](_0xbffe('0x21'),_0x57adab)}})['then'](function(_0x23dbac){var _0x533b66;if(_0x23dbac[_0xbffe('0x1a')][_0xbffe('0x22')]){_0x23dbac[_0xbffe('0x1a')]=_['filter'](_0x23dbac[_0xbffe('0x1a')],{'suspended':![],'role':_0xbffe('0x23')});if(_0x23dbac['results'][_0xbffe('0x22')]){_0x533b66=_[_0xbffe('0x24')](_0x23dbac['results']);}}if(_0x533b66){logger[_0xbffe('0x9')](_0xbffe('0x25'));return _0x533b66;}else{logger[_0xbffe('0x9')](_0xbffe('0x26'));return request({'uri':util[_0xbffe('0xb')]('%s/users.json',_0x9639d9[_0xbffe('0x1e')]),'method':_0xbffe('0x27'),'body':{'user':{'role':_0xbffe('0x23'),'name':util[_0xbffe('0xb')](_0xbffe('0x28'),_0x56e125||_0x57adab),'phone':_0x57adab}}})[_0xbffe('0x16')](function(_0x2b3fd7){logger[_0xbffe('0x9')](_0xbffe('0x29'));return _0x2b3fd7[_0xbffe('0x1f')];});}});}function getAuth(_0x8118ed){var _0x57d6c1;if(_0x8118ed['authType']===_0xbffe('0x2a')){_0x57d6c1=util[_0xbffe('0xb')]('%s:%s',_0x8118ed[_0xbffe('0x2b')],_0x8118ed[_0xbffe('0x2a')]);}else if(_0x8118ed['authType']===_0xbffe('0x2c')){_0x57d6c1=util[_0xbffe('0xb')](_0xbffe('0x2d'),_0x8118ed['username'],_0x8118ed['token']);}return util[_0xbffe('0xb')](_0xbffe('0x2e'),new Buffer(_0x57d6c1)[_0xbffe('0x2f')]('base64'));}function request(_0x11530f){logger[_0xbffe('0x30')](_0xbffe('0x31'),JSON[_0xbffe('0x32')](_0x11530f));return rp(_[_0xbffe('0x33')](_0x11530f,{'method':_0xbffe('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x29fb94,_0x369fda){var _0x459828=[];if(_0x29fb94&&_0x29fb94[_0xbffe('0x22')]>0x0){_0x459828=_['map'](_0x29fb94,_0x369fda);}return _0x459828;}function getCustomFields(_0x5c8ecf,_0x4825e1){var _0xd4a7d8=[];var _0x467dcb={'custom_fields':[]};if(_0x5c8ecf['length']>0x0){_[_0xbffe('0x35')](_0x5c8ecf,function(_0x1e3eff){if(_['includes']([_0xbffe('0x36'),_0xbffe('0x37')],_0x1e3eff['type'])&&_0x1e3eff['nameField']&&!_0x1e3eff['customField']){_0x467dcb[_0x1e3eff[_0xbffe('0x38')][_0xbffe('0x39')]()]=_0x1e3eff[_0xbffe('0x3a')]['toString']();}else if(_['includes']([_0xbffe('0x36'),_0xbffe('0x37')],_0x1e3eff[_0xbffe('0x3b')])&&_0x1e3eff['idField']&&_0x1e3eff[_0xbffe('0x3c')]){_0x467dcb[_0xbffe('0x3d')]['push']({'id':_0x1e3eff[_0xbffe('0x3e')],'value':_0x1e3eff[_0xbffe('0x3a')][_0xbffe('0x2f')]()});}else if(_0x1e3eff[_0xbffe('0x3b')]==='variable'&&_0x1e3eff[_0xbffe('0x3f')]&&_0x1e3eff[_0xbffe('0x3e')]&&_0x1e3eff[_0xbffe('0x3c')]){_0x4825e1[_0x1e3eff[_0xbffe('0x3f')]]&&_0x467dcb['custom_fields'][_0xbffe('0x40')]({'id':_0x1e3eff['idField'],'value':_0x4825e1[_0x1e3eff['variableName']][_0xbffe('0x2f')]()});}else if(_0x1e3eff['type']==='customVariable'&&_0x1e3eff['Variable']&&_0x1e3eff[_0xbffe('0x41')][_0xbffe('0xe')]&&_0x1e3eff[_0xbffe('0x3e')]&&_0x1e3eff[_0xbffe('0x3c')]){_0x4825e1[_0x1e3eff[_0xbffe('0x41')][_0xbffe('0xe')][_0xbffe('0x39')]()]&&_0x467dcb[_0xbffe('0x3d')][_0xbffe('0x40')]({'id':_0x1e3eff['idField'],'value':_0x4825e1[_0x1e3eff[_0xbffe('0x41')][_0xbffe('0xe')][_0xbffe('0x39')]()]['toString']()});}});}return _0x467dcb;}exports[_0xbffe('0x42')]=function(_0x369ec2,_0x36b21c,_0x53f7ed,_0x25cdae,_0x3972d2,_0x461e55){var _0x4fe2de,_0x52acc8;_0x461e55['remoteUri']=intUtil[_0xbffe('0x43')](_0x461e55['remoteUri']);_0x461e55[_0xbffe('0x44')]=intUtil[_0xbffe('0x43')](_0x461e55[_0xbffe('0x44')]);if(_0x3972d2&&_0x3972d2[_0xbffe('0x45')]){logger[_0xbffe('0x9')]('[QUEUE]',_0xbffe('0x46'));_0x36b21c[_0xbffe('0x47')]=util[_0xbffe('0xb')](_0xbffe('0x48'),_0x461e55[_0xbffe('0x44')],_0x36b21c['uniqueid'],md5(_0x36b21c[_0xbffe('0x49')]));}else{_0x36b21c[_0xbffe('0x47')]='';}headers[_0xbffe('0x4a')]=getAuth(_0x461e55);return getUser(_0x461e55,_0x25cdae[_0xbffe('0x4b')])[_0xbffe('0x16')](function(_0x36e60e){_0x4fe2de=_0x36e60e;logger[_0xbffe('0x9')](_0xbffe('0x4c'),_0x4fe2de['id']);return getEndUser(_0x461e55,_0x36b21c[_0xbffe('0x4d')],_0x36b21c['calleridnum']);})[_0xbffe('0x16')](function(_0x58970b){_0x52acc8=_0x58970b;logger[_0xbffe('0x9')](_0xbffe('0x4e'),_0x52acc8['id']);return getTicket(_0x461e55,_0x4fe2de,_0x52acc8,_0x53f7ed,_0x36b21c);})[_0xbffe('0x16')](function(_0x24a4b7){if(_0x24a4b7){logger['info'](_0xbffe('0x4f'),_0x24a4b7['id']);switch(_0x461e55[_0xbffe('0x3b')]){case _0xbffe('0x50'):logger[_0xbffe('0x9')](_0xbffe('0x51'),_0xbffe('0x52'));return request({'uri':util[_0xbffe('0xb')](_0xbffe('0x53'),_0x461e55[_0xbffe('0x1e')],_0x4fe2de['id'],_0x24a4b7['id']),'method':'POST'});case _0xbffe('0x54'):logger['info'](_0xbffe('0x51'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbffe('0xb')](_0xbffe('0x55'),_0x25cdae[_0xbffe('0xe')]),'trigger:browser:url',{'uri':util[_0xbffe('0xb')](_0xbffe('0x56'),_0x461e55['remoteUri'][_0xbffe('0x57')](_0xbffe('0x58'),''),_0x24a4b7['id'])});break;default:logger[_0xbffe('0x59')](_0xbffe('0x51'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xbffe('0x5a')](function(_0x35b014){logger[_0xbffe('0x59')](_0xbffe('0x5b'),util[_0xbffe('0x5c')](_0x35b014,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0xd10624,_0x379c46,_0x3f856b,_0x2558eb,_0x558740,_0x5d12d2,_0x8b280c){var _0x257161,_0x130cbf;_0x5d12d2[_0xbffe('0x1e')]=intUtil[_0xbffe('0x43')](_0x5d12d2[_0xbffe('0x1e')]);_0x5d12d2[_0xbffe('0x44')]=intUtil[_0xbffe('0x43')](_0x5d12d2['serverUrl']);if(_0x8b280c&&_0x8b280c['recordingFormat']&&_0x8b280c[_0xbffe('0x5d')]!==_0xbffe('0x5e')){logger[_0xbffe('0x9')]('[OUTBOUND]',_0xbffe('0x46'));_0x379c46[_0xbffe('0x47')]=util[_0xbffe('0xb')](_0xbffe('0x48'),_0x5d12d2[_0xbffe('0x44')],_0x379c46[_0xbffe('0x49')],md5(_0x379c46['uniqueid']));}headers[_0xbffe('0x4a')]=getAuth(_0x5d12d2);return getUser(_0x5d12d2,_0x2558eb['email'])[_0xbffe('0x16')](function(_0x41ca3b){_0x257161=_0x41ca3b;logger['info'](_0xbffe('0x4c'),_0x257161['id']);return getEndUser(_0x5d12d2,_0x379c46[_0xbffe('0x5f')],_0x379c46[_0xbffe('0x60')]);})[_0xbffe('0x16')](function(_0x5c8060){_0x130cbf=_0x5c8060;logger[_0xbffe('0x9')](_0xbffe('0x4e'),_0x130cbf['id']);return getTicket(_0x5d12d2,_0x257161,_0x130cbf,_0x3f856b,_0x379c46);})[_0xbffe('0x16')](function(_0x4926c7){if(_0x4926c7){logger[_0xbffe('0x9')](_0xbffe('0x4f'),_0x4926c7['id']);switch(_0x5d12d2['type']){case _0xbffe('0x50'):logger[_0xbffe('0x9')](_0xbffe('0x61'),_0xbffe('0x52'));return request({'uri':util[_0xbffe('0xb')](_0xbffe('0x53'),_0x5d12d2['remoteUri'],_0x257161['id'],_0x4926c7['id']),'method':'POST'});case _0xbffe('0x54'):logger['info'](_0xbffe('0x61'),_0xbffe('0x62'));emit(util[_0xbffe('0xb')](_0xbffe('0x55'),_0x2558eb[_0xbffe('0xe')]),'trigger:browser:url',{'uri':util[_0xbffe('0xb')](_0xbffe('0x56'),_0x5d12d2['remoteUri'][_0xbffe('0x57')](_0xbffe('0x58'),''),_0x4926c7['id'])});break;default:logger[_0xbffe('0x59')](_0xbffe('0x61'),_0xbffe('0x63'));}}})['catch'](function(_0x20a437){logger[_0xbffe('0x59')](_0xbffe('0x64'),util[_0xbffe('0x5c')](_0x20a437,{'showHidden':!![],'depth':null}));});};exports[_0xbffe('0x65')]=function(_0x3850c2,_0x2f113c,_0x14b813,_0x10f952,_0x561e0f,_0x36d250){var _0xa3af4c,_0xe7f18f;_0x36d250[_0xbffe('0x1e')]=intUtil['stripTrailingSlash'](_0x36d250[_0xbffe('0x1e')]);_0x36d250[_0xbffe('0x44')]=intUtil['stripTrailingSlash'](_0x36d250[_0xbffe('0x44')]);if(_0x561e0f&&_0x561e0f['monitor_format']){logger[_0xbffe('0x9')]('['+_0x2f113c[_0xbffe('0x66')][_0xbffe('0x67')]()+']','Recording\x20is\x20enabled!');_0x2f113c[_0xbffe('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x36d250[_0xbffe('0x44')],_0x2f113c[_0xbffe('0x49')],md5(_0x2f113c[_0xbffe('0x49')]));}else{_0x2f113c[_0xbffe('0x47')]='';}headers['Authorization']=getAuth(_0x36d250);return getUser(_0x36d250)[_0xbffe('0x16')](function(_0x493a37){_0xa3af4c=_0x493a37;logger[_0xbffe('0x9')]('The\x20User\x20ID\x20is:',_0xa3af4c['id']);return getEndUser(_0x36d250,_0x2f113c['calleridname'],_0x2f113c[_0xbffe('0x68')]);})[_0xbffe('0x16')](function(_0x203b00){_0xe7f18f=_0x203b00;logger[_0xbffe('0x9')](_0xbffe('0x4e'),_0xe7f18f['id']);return getTicket(_0x36d250,_0xa3af4c,_0xe7f18f,_0x14b813,_0x2f113c);})[_0xbffe('0x16')](function(_0x305221){if(_0x305221){logger[_0xbffe('0x9')](_0xbffe('0x4f'),_0x305221['id']);}})['catch'](function(_0x1f69fc){logger[_0xbffe('0x59')]('['+_0x2f113c[_0xbffe('0x66')][_0xbffe('0x67')]()+']'+_0xbffe('0x69'),util[_0xbffe('0x5c')](_0x1f69fc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5732=['The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','replace','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','Tags','name','getString','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','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','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','Basic\x20%s','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toString','idField','custom_fields','content','variableName','push','customVariable','Variable','toLowerCase','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','destcalleridnum'];(function(_0x260e32,_0x3d6daf){var _0x3dbd68=function(_0x1f03c5){while(--_0x1f03c5){_0x260e32['push'](_0x260e32['shift']());}};_0x3dbd68(++_0x3d6daf);}(_0x5732,0x7d));var _0x2573=function(_0x35ad91,_0x5635bc){_0x35ad91=_0x35ad91-0x0;var _0x202ecb=_0x5732[_0x35ad91];return _0x202ecb;};'use strict';var _=require(_0x2573('0x0'));var rp=require(_0x2573('0x1'));var md5=require(_0x2573('0x2'));var util=require(_0x2573('0x3'));var Redis=require(_0x2573('0x4'));var intUtil=require(_0x2573('0x5'));var config=require(_0x2573('0x6'));var logger=require('../../../../config/logger')(_0x2573('0x7'));config[_0x2573('0x8')]=_[_0x2573('0x9')](config[_0x2573('0x8')],{'host':_0x2573('0xa'),'port':0x18eb});var io=require(_0x2573('0xb'))(new Redis(config[_0x2573('0x8')]));function emit(_0x48dcac,_0x4404cc,_0x5e2ad2){io['to'](_0x48dcac)[_0x2573('0xc')](_0x4404cc,_0x5e2ad2);}var headers={'Content-Type':_0x2573('0xd'),'Accept':'application/json'};function getTicket(_0x471d24,_0x17db17,_0x2838ef,_0x1b59a4,_0x52b945){logger[_0x2573('0xe')](_0x2573('0xf'));return request({'uri':util[_0x2573('0x10')](_0x2573('0x11'),_0x471d24['remoteUri']),'method':_0x2573('0x12'),'body':{'ticket':_['merge']({'requester_id':_0x2838ef['id'],'submitter_id':_0x17db17?_0x17db17['id']:undefined,'assignee_id':_0x17db17?_0x17db17['id']:undefined,'tags':getTags(_0x1b59a4[_0x2573('0x13')],_0x2573('0x14')),'subject':intUtil['getString'](_0x1b59a4['Subjects'],_0x52b945,'\x20'),'description':intUtil[_0x2573('0x15')](_0x1b59a4[_0x2573('0x16')],_0x52b945,'\x0a'),'comment':{'public':![],'body':intUtil[_0x2573('0x15')](_0x1b59a4[_0x2573('0x16')],_0x52b945,'\x0a')}},getCustomFields(_0x1b59a4[_0x2573('0x17')],_0x52b945))}})['then'](function(_0x2eb4df){logger[_0x2573('0xe')](_0x2573('0x18'));return _0x2eb4df[_0x2573('0x19')];});}function getUser(_0x47e6a4,_0x231ab7){if(intUtil[_0x2573('0x1a')](_0x231ab7)){logger[_0x2573('0xe')](_0x2573('0x1b'),_0x231ab7);return request({'uri':util[_0x2573('0x10')](_0x2573('0x1c'),_0x47e6a4[_0x2573('0x1d')]),'qs':{'query':util['format'](_0x2573('0x1e'),_0x231ab7)}})[_0x2573('0x1f')](function(_0x5ed073){if(_0x5ed073[_0x2573('0x20')]){logger[_0x2573('0xe')](_0x2573('0x21'));return _[_0x2573('0x22')](_0x5ed073[_0x2573('0x23')],{'email':_0x231ab7,'role':_0x2573('0x24')});}else{logger[_0x2573('0xe')](_0x2573('0x25'));return request({'uri':util['format']('%s/users/me.json',_0x47e6a4[_0x2573('0x1d')])})[_0x2573('0x1f')](function(_0x512edf){logger[_0x2573('0xe')](_0x2573('0x26'));return _0x512edf[_0x2573('0x27')];});}});}else{logger['info'](_0x2573('0x25'));return request({'uri':util[_0x2573('0x10')](_0x2573('0x28'),_0x47e6a4[_0x2573('0x1d')])})['then'](function(_0x50ff99){logger[_0x2573('0xe')](_0x2573('0x26'));return _0x50ff99[_0x2573('0x27')];});}}function getEndUser(_0x135a00,_0x713277,_0x441209){logger['info'](_0x2573('0x29'),_0x441209);return request({'uri':util['format'](_0x2573('0x1c'),_0x135a00[_0x2573('0x1d')]),'qs':{'query':util[_0x2573('0x10')](_0x2573('0x2a'),_0x441209)}})['then'](function(_0x5e0b50){var _0x18e9f4;if(_0x5e0b50[_0x2573('0x23')][_0x2573('0x2b')]){_0x5e0b50[_0x2573('0x23')]=_[_0x2573('0x2c')](_0x5e0b50['results'],{'suspended':![],'role':_0x2573('0x2d')});if(_0x5e0b50['results'][_0x2573('0x2b')]){_0x18e9f4=_[_0x2573('0x2e')](_0x5e0b50['results']);}}if(_0x18e9f4){logger['info']('Enduser\x20found!');return _0x18e9f4;}else{logger[_0x2573('0xe')](_0x2573('0x2f'));return request({'uri':util[_0x2573('0x10')](_0x2573('0x30'),_0x135a00['remoteUri']),'method':'POST','body':{'user':{'role':_0x2573('0x2d'),'name':util[_0x2573('0x10')]('Caller\x20-\x20%s',_0x713277||_0x441209),'phone':_0x441209}}})[_0x2573('0x1f')](function(_0x3bdead){logger[_0x2573('0xe')](_0x2573('0x31'));return _0x3bdead[_0x2573('0x27')];});}});}function getAuth(_0x41bce5){var _0x104681;if(_0x41bce5['authType']===_0x2573('0x32')){_0x104681=util['format'](_0x2573('0x33'),_0x41bce5[_0x2573('0x34')],_0x41bce5[_0x2573('0x32')]);}else if(_0x41bce5[_0x2573('0x35')]===_0x2573('0x36')){_0x104681=util['format'](_0x2573('0x37'),_0x41bce5[_0x2573('0x34')],_0x41bce5[_0x2573('0x36')]);}return util[_0x2573('0x10')](_0x2573('0x38'),new Buffer(_0x104681)['toString']('base64'));}function request(_0x2f099){logger['debug'](_0x2573('0x39'),JSON[_0x2573('0x3a')](_0x2f099));return rp(_[_0x2573('0x9')](_0x2f099,{'method':_0x2573('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x1b19e1,_0x234ab3){var _0x1bb16a=[];if(_0x1b19e1&&_0x1b19e1[_0x2573('0x2b')]>0x0){_0x1bb16a=_[_0x2573('0x3c')](_0x1b19e1,_0x234ab3);}return _0x1bb16a;}function getCustomFields(_0x43f5f7,_0x8903cb){var _0x229234=[];var _0x4daea1={'custom_fields':[]};if(_0x43f5f7[_0x2573('0x2b')]>0x0){_[_0x2573('0x3d')](_0x43f5f7,function(_0x493ac){if(_[_0x2573('0x3e')]([_0x2573('0x3f'),_0x2573('0x40')],_0x493ac[_0x2573('0x41')])&&_0x493ac[_0x2573('0x42')]&&!_0x493ac[_0x2573('0x43')]){_0x4daea1[_0x493ac['nameField']['toLowerCase']()]=_0x493ac['content'][_0x2573('0x44')]();}else if(_['includes']([_0x2573('0x3f'),_0x2573('0x40')],_0x493ac[_0x2573('0x41')])&&_0x493ac[_0x2573('0x45')]&&_0x493ac[_0x2573('0x43')]){_0x4daea1[_0x2573('0x46')]['push']({'id':_0x493ac[_0x2573('0x45')],'value':_0x493ac[_0x2573('0x47')]['toString']()});}else if(_0x493ac[_0x2573('0x41')]==='variable'&&_0x493ac[_0x2573('0x48')]&&_0x493ac[_0x2573('0x45')]&&_0x493ac[_0x2573('0x43')]){_0x8903cb[_0x493ac[_0x2573('0x48')]]&&_0x4daea1[_0x2573('0x46')][_0x2573('0x49')]({'id':_0x493ac[_0x2573('0x45')],'value':_0x8903cb[_0x493ac[_0x2573('0x48')]][_0x2573('0x44')]()});}else if(_0x493ac[_0x2573('0x41')]===_0x2573('0x4a')&&_0x493ac[_0x2573('0x4b')]&&_0x493ac[_0x2573('0x4b')][_0x2573('0x14')]&&_0x493ac[_0x2573('0x45')]&&_0x493ac[_0x2573('0x43')]){_0x8903cb[_0x493ac[_0x2573('0x4b')]['name']['toLowerCase']()]&&_0x4daea1['custom_fields'][_0x2573('0x49')]({'id':_0x493ac['idField'],'value':_0x8903cb[_0x493ac['Variable'][_0x2573('0x14')][_0x2573('0x4c')]()][_0x2573('0x44')]()});}});}return _0x4daea1;}exports[_0x2573('0x4d')]=function(_0x355fe4,_0x1619af,_0xd753b4,_0x4816a0,_0x304066,_0xa95379){var _0x25e7d8,_0xd1016c;_0xa95379[_0x2573('0x1d')]=intUtil['stripTrailingSlash'](_0xa95379['remoteUri']);_0xa95379[_0x2573('0x4e')]=intUtil[_0x2573('0x4f')](_0xa95379['serverUrl']);if(_0x304066&&_0x304066['monitor_format']){logger['info']('[QUEUE]',_0x2573('0x50'));_0x1619af[_0x2573('0x51')]=util[_0x2573('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa95379['serverUrl'],_0x1619af[_0x2573('0x52')],md5(_0x1619af[_0x2573('0x52')]));}else{_0x1619af[_0x2573('0x51')]='';}headers['Authorization']=getAuth(_0xa95379);return getUser(_0xa95379,_0x4816a0[_0x2573('0x53')])['then'](function(_0x5d0e2a){_0x25e7d8=_0x5d0e2a;logger['info'](_0x2573('0x54'),_0x25e7d8['id']);return getEndUser(_0xa95379,_0x1619af[_0x2573('0x55')],_0x1619af[_0x2573('0x56')]);})['then'](function(_0x30ea7a){_0xd1016c=_0x30ea7a;logger[_0x2573('0xe')]('The\x20Enduser\x20ID\x20is:',_0xd1016c['id']);return getTicket(_0xa95379,_0x25e7d8,_0xd1016c,_0xd753b4,_0x1619af);})['then'](function(_0x2f575f){if(_0x2f575f){logger[_0x2573('0xe')]('The\x20Ticket\x20ID\x20is:',_0x2f575f['id']);switch(_0xa95379[_0x2573('0x41')]){case _0x2573('0x57'):logger[_0x2573('0xe')](_0x2573('0x58'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x2573('0x59'),_0xa95379['remoteUri'],_0x25e7d8['id'],_0x2f575f['id']),'method':_0x2573('0x12')});case _0x2573('0x5a'):logger[_0x2573('0xe')]('[QUEUE]',_0x2573('0x5b'));emit(util[_0x2573('0x10')](_0x2573('0x5c'),_0x4816a0[_0x2573('0x14')]),_0x2573('0x5d'),{'uri':util[_0x2573('0x10')](_0x2573('0x5e'),_0xa95379[_0x2573('0x1d')]['replace'](_0x2573('0x5f'),''),_0x2f575f['id'])});break;default:logger[_0x2573('0x60')](_0x2573('0x58'),_0x2573('0x61'));}}})[_0x2573('0x62')](function(_0x1b8c6a){logger[_0x2573('0x60')](_0x2573('0x63'),util[_0x2573('0x64')](_0x1b8c6a,{'showHidden':!![],'depth':null}));});};exports[_0x2573('0x65')]=function(_0x3f6ad9,_0x519c87,_0x50af29,_0x426958,_0x2de6aa,_0x4e2bac,_0x4ace94){var _0x21109b,_0x3fafaf;_0x4e2bac['remoteUri']=intUtil[_0x2573('0x4f')](_0x4e2bac[_0x2573('0x1d')]);_0x4e2bac['serverUrl']=intUtil[_0x2573('0x4f')](_0x4e2bac[_0x2573('0x4e')]);if(_0x4ace94&&_0x4ace94[_0x2573('0x66')]&&_0x4ace94['recordingFormat']!==_0x2573('0x67')){logger['info'](_0x2573('0x68'),_0x2573('0x50'));_0x519c87[_0x2573('0x51')]=util[_0x2573('0x10')](_0x2573('0x69'),_0x4e2bac[_0x2573('0x4e')],_0x519c87[_0x2573('0x52')],md5(_0x519c87[_0x2573('0x52')]));}headers[_0x2573('0x6a')]=getAuth(_0x4e2bac);return getUser(_0x4e2bac,_0x426958[_0x2573('0x53')])[_0x2573('0x1f')](function(_0x4cbcba){_0x21109b=_0x4cbcba;logger[_0x2573('0xe')]('The\x20User\x20ID\x20is:',_0x21109b['id']);return getEndUser(_0x4e2bac,_0x519c87[_0x2573('0x6b')],_0x519c87[_0x2573('0x6c')]);})[_0x2573('0x1f')](function(_0x2d043d){_0x3fafaf=_0x2d043d;logger[_0x2573('0xe')](_0x2573('0x6d'),_0x3fafaf['id']);return getTicket(_0x4e2bac,_0x21109b,_0x3fafaf,_0x50af29,_0x519c87);})[_0x2573('0x1f')](function(_0x17af39){if(_0x17af39){logger[_0x2573('0xe')]('The\x20Ticket\x20ID\x20is:',_0x17af39['id']);switch(_0x4e2bac[_0x2573('0x41')]){case _0x2573('0x57'):logger[_0x2573('0xe')](_0x2573('0x68'),_0x2573('0x6e'));return request({'uri':util[_0x2573('0x10')](_0x2573('0x59'),_0x4e2bac[_0x2573('0x1d')],_0x21109b['id'],_0x17af39['id']),'method':_0x2573('0x12')});case _0x2573('0x5a'):logger[_0x2573('0xe')](_0x2573('0x68'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x426958[_0x2573('0x14')]),_0x2573('0x5d'),{'uri':util[_0x2573('0x10')](_0x2573('0x5e'),_0x4e2bac[_0x2573('0x1d')][_0x2573('0x6f')](_0x2573('0x5f'),''),_0x17af39['id'])});break;default:logger[_0x2573('0x60')](_0x2573('0x68'),_0x2573('0x61'));}}})[_0x2573('0x62')](function(_0x38c572){logger[_0x2573('0x60')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x2573('0x64')](_0x38c572,{'showHidden':!![],'depth':null}));});};exports[_0x2573('0x70')]=function(_0x5ade92,_0x2840df,_0x54e188,_0x323882,_0x4f4368,_0x47127a){var _0x33fdf6,_0x33c1bb;_0x47127a[_0x2573('0x1d')]=intUtil[_0x2573('0x4f')](_0x47127a[_0x2573('0x1d')]);_0x47127a[_0x2573('0x4e')]=intUtil[_0x2573('0x4f')](_0x47127a[_0x2573('0x4e')]);if(_0x4f4368&&_0x4f4368['monitor_format']){logger[_0x2573('0xe')]('['+_0x2840df[_0x2573('0x71')][_0x2573('0x72')]()+']',_0x2573('0x50'));_0x2840df[_0x2573('0x51')]=util[_0x2573('0x10')](_0x2573('0x69'),_0x47127a[_0x2573('0x4e')],_0x2840df[_0x2573('0x52')],md5(_0x2840df['uniqueid']));}else{_0x2840df[_0x2573('0x51')]='';}headers[_0x2573('0x6a')]=getAuth(_0x47127a);return getUser(_0x47127a)[_0x2573('0x1f')](function(_0x514668){_0x33fdf6=_0x514668;logger[_0x2573('0xe')](_0x2573('0x54'),_0x33fdf6['id']);return getEndUser(_0x47127a,_0x2840df[_0x2573('0x55')],_0x2840df[_0x2573('0x56')]);})['then'](function(_0x3d339d){_0x33c1bb=_0x3d339d;logger[_0x2573('0xe')](_0x2573('0x6d'),_0x33c1bb['id']);return getTicket(_0x47127a,_0x33fdf6,_0x33c1bb,_0x54e188,_0x2840df);})[_0x2573('0x1f')](function(_0x41b4d2){if(_0x41b4d2){logger[_0x2573('0xe')](_0x2573('0x73'),_0x41b4d2['id']);}})['catch'](function(_0x2a8e86){logger[_0x2573('0x60')]('['+_0x2840df[_0x2573('0x71')][_0x2573('0x72')]()+']'+_0x2573('0x74'),util['inspect'](_0x2a8e86,{'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 95e687c..e348de3 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 _0x275c=['The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','calleridnum','lodash','request-promise','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','[HTTP]','length','forEach','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','clientId','clientSecret','then','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','details','moduleCreate','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Full_Name','First_Name','What_Id','$se_module','talktime','utc','mm:ss','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Call_Result','Called','connect','Answered','abandoned','Abandoned','timeout','Timeout','outbound','starttime','agentcalledAt','Call_Type','Call\x20created!','err','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','host','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','Inbound'];(function(_0x381bff,_0x19d01f){var _0x201ab1=function(_0x7d6446){while(--_0x7d6446){_0x381bff['push'](_0x381bff['shift']());}};_0x201ab1(++_0x19d01f);}(_0x275c,0x1d0));var _0xc275=function(_0x550887,_0x5897fd){_0x550887=_0x550887-0x0;var _0x3ebfbd=_0x275c[_0x550887];return _0x3ebfbd;};'use strict';var _=require(_0xc275('0x0'));var rp=require(_0xc275('0x1'));var md5=require('md5');var util=require(_0xc275('0x2'));var intUtil=require(_0xc275('0x3'));var moment=require(_0xc275('0x4'));var Redis=require(_0xc275('0x5'));var BPromise=require('bluebird');var config=require(_0xc275('0x6'));var logger=require(_0xc275('0x7'))(_0xc275('0x8'));config[_0xc275('0x9')]=_[_0xc275('0xa')](config[_0xc275('0x9')],{'host':_0xc275('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc275('0x9')]));function emit(_0x454c9d,_0x452dbe,_0x134ee4){io['to'](_0x454c9d)[_0xc275('0xc')](_0x452dbe,_0x134ee4);}function request(_0x20d24d){logger[_0xc275('0xd')](_0xc275('0xe'),JSON['stringify'](_0x20d24d));return rp(_0x20d24d);}function getCustomFields(_0xda3a3e,_0x2d7a4e){var _0x17a2e0={};if(_0xda3a3e[_0xc275('0xf')]>0x0){_[_0xc275('0x10')](_0xda3a3e,function(_0x17d468){if(_['includes'](['string','picklist'],_0x17d468[_0xc275('0x11')])&&_0x17d468[_0xc275('0x12')]){_0x17a2e0[_0x17d468[_0xc275('0x12')]]=_0x17d468[_0xc275('0x13')]['toString']();}else if(_0x17d468['type']===_0xc275('0x14')&&_0x17d468[_0xc275('0x15')]&&_0x17d468[_0xc275('0x12')]&&_0x2d7a4e[_0x17d468[_0xc275('0x15')]]){_0x17a2e0[_0x17d468[_0xc275('0x12')]]=_0x2d7a4e[_0x17d468[_0xc275('0x15')]][_0xc275('0x16')]();}else if(_0x17d468[_0xc275('0x11')]===_0xc275('0x17')&&_0x17d468[_0xc275('0x18')]&&_0x17d468[_0xc275('0x18')][_0xc275('0x19')]&&_0x17d468['idField']&&_0x2d7a4e[_0x17d468['Variable'][_0xc275('0x19')][_0xc275('0x1a')]()]){_0x17a2e0[_0x17d468['idField']]=_0x2d7a4e[_0x17d468['Variable'][_0xc275('0x19')]['toLowerCase']()]['toString']();}});}return _0x17a2e0;}function getName(_0x59eee6){if(_0x59eee6['indexOf']('\x20')>0x0){var _0x3ebdb8=_0x59eee6[_0xc275('0x1b')](/ (.+)/);if(_0x3ebdb8[0x1]){return _0x3ebdb8;}}return[_0x59eee6,_0x59eee6];}var accountsTokens={};function getAccessToken(_0x3ea4c5){return new Promise(function(_0x299e35,_0x22ba10){if(!_[_0xc275('0x1c')](accountsTokens[_0x3ea4c5['id']])&&!_['isNil'](accountsTokens[_0x3ea4c5['id']]['access_token'])){if(moment()[_0xc275('0x1d')](accountsTokens[_0x3ea4c5['id']][_0xc275('0x1e')])){_0x299e35(accountsTokens[_0x3ea4c5['id']][_0xc275('0x1f')]);}}var _0x237239;switch(_0x3ea4c5[_0xc275('0x20')]){case'US':_0x237239=_0xc275('0x21');break;case'AU':_0x237239=_0xc275('0x22');break;case'EU':_0x237239=_0xc275('0x23');break;case'IN':_0x237239=_0xc275('0x24');break;case'CN':_0x237239='https://accounts.zoho.com.cn';break;default:_0x237239=_0xc275('0x23');break;}var _0x17e77b={'method':'POST','uri':_0x237239+_0xc275('0x25'),'qs':{'refresh_token':_0x3ea4c5[_0xc275('0x26')],'client_id':_0x3ea4c5[_0xc275('0x27')],'client_secret':_0x3ea4c5[_0xc275('0x28')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x17e77b)[_0xc275('0x29')](function(_0x4354f){accountsTokens[_0x3ea4c5['id']]={'access_token':_0x4354f[_0xc275('0x1f')],'expires_in':moment()['add'](_0x4354f[_0xc275('0x1e')],'seconds')};_0x299e35(_0x4354f[_0xc275('0x1f')]);})[_0xc275('0x2a')](function(_0x9db5c8){logger[_0xc275('0x2b')](_0xc275('0x2c'),_0x9db5c8[_0xc275('0x2d')]);_0x22ba10(_0x9db5c8);});});}function getUser(_0x5cfe54,_0x40b109,_0x7ef860,_0xd4f14f){logger[_0xc275('0x2e')](_0xc275('0x2f'));return request({'method':_0xc275('0x30'),'uri':util[_0xc275('0x31')]('https://www.zohoapis.%s/crm/v2/users',_0x40b109),'qs':{'type':_0xc275('0x32')},'headers':{'Authorization':_0xc275('0x33')+_0x5cfe54},'json':!![]})[_0xc275('0x29')](function(_0x4a32b5){if(_0x4a32b5[_0xc275('0x34')]){var _0x31eaf5=-0x1;if(_['isArrayLikeObject'](_0x4a32b5[_0xc275('0x34')])){if(!_[_0xc275('0x1c')](_0xd4f14f)){_0x31eaf5=_[_0xc275('0x35')](_0x4a32b5[_0xc275('0x34')],function(_0x4ca3f1){return _0x4ca3f1[_0xc275('0x36')]===_0xd4f14f;});}if(_0x31eaf5>=0x0){logger[_0xc275('0x2e')](_0xc275('0x37'));}else{logger[_0xc275('0x2e')](_0xc275('0x38'));_0x31eaf5=_[_0xc275('0x35')](_0x4a32b5['users'],function(_0x44686e){return _0x44686e['profile'][_0xc275('0x19')]===_0xc275('0x39');});}return _0x4a32b5[_0xc275('0x34')][_0x31eaf5];}else{if(_0x4a32b5[_0xc275('0x3a')][_0xc275('0x3b')][_0xc275('0x19')]===_0xc275('0x39')){logger[_0xc275('0x2e')]('Using\x20the\x20admin\x20account!');user=_0x4a32b5['user'];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0xc275('0x3c')](_0x4a32b5));throw new Error(_0xc275('0x3d')+JSON[_0xc275('0x3c')](_0x4a32b5));}}}else{logger['error'](_0xc275('0x3e'),JSON[_0xc275('0x3c')](_0x4a32b5));throw new Error(_0xc275('0x3d')+JSON[_0xc275('0x3c')](_0x4a32b5));}})['catch'](function(_0x2f8006){console[_0xc275('0x2b')](_0x2f8006);});}function getZohoUser(_0x3a1f13,_0x317610){return new BPromise(function(_0x51ac97,_0x145796){request(_0x3a1f13)[_0xc275('0x29')](function(_0x25a019){var _0x35cd39=null;if(_0x25a019){_0x35cd39=_0x25a019[_0xc275('0x3f')][0x0];_0x35cd39[_0xc275('0x40')]=_0x317610;}_0x51ac97(_0x35cd39);})[_0xc275('0x2a')](function(_0x4538c7){_0x145796(_0x4538c7);});});}function createEndUser(_0x5145f8,_0x45b72a,_0x16229f,_0x89e498,_0x350cf6,_0x4ea3d8){var _0x16229f=getName(_0x16229f);return request({'method':_0xc275('0x41'),'uri':_0xc275('0x42')+_0x45b72a+_0xc275('0x43')+_[_0xc275('0x44')](_0x4ea3d8['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x16229f[0x1],'First_Name':_0x16229f[0x0],'Phone':_0x89e498,'Owner':{'name':!_[_0xc275('0x1c')](_0x350cf6[_0xc275('0x45')][_0xc275('0x19')])?_0x350cf6['role'][_0xc275('0x19')]:!_[_0xc275('0x1c')](_0x350cf6[_0xc275('0x46')])?_0x350cf6[_0xc275('0x46')]+'\x20'+_0x350cf6['last_name']:_0x350cf6[_0xc275('0x47')],'id':_0x350cf6['id']}}]},'headers':{'Authorization':_0xc275('0x33')+_0x5145f8},'json':!![]})[_0xc275('0x29')](function(_0xb4636){if(_0xb4636&&_0xb4636['data'][0x0][_0xc275('0x48')]===_0xc275('0x49')){var _0x5bcecc=_0xb4636[_0xc275('0x3f')][0x0][_0xc275('0x4a')];_0x5bcecc['enduserType']=_[_0xc275('0x44')](_0x4ea3d8[_0xc275('0x4b')])+'s';return _0x5bcecc;}logger[_0xc275('0x2b')]('The\x20failing\x20result\x20is',JSON[_0xc275('0x3c')](data));throw new Error('Error:\x20'+JSON[_0xc275('0x3c')](data));})['catch'](function(_0x7379e0){console[_0xc275('0x4c')](_0xc275('0x4d'),_0x7379e0);});}function getEndUser(_0x2c6692,_0x3e5e29,_0x1475c8,_0x52ebfd,_0x4fdf0c,_0x4ed07f,_0x4754d0){var _0x299f11={'method':_0xc275('0x30'),'uri':'','headers':{'Authorization':_0xc275('0x33')+_0x2c6692},'json':!![]};switch(_0x4754d0[_0xc275('0x4e')]){case _0xc275('0x4f'):_0x299f11[_0xc275('0x50')]=_0xc275('0x42')+_0x3e5e29+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4fdf0c+'))';return getZohoUser(_0x299f11,_0xc275('0x51'))['then'](function(_0x3925da){if(_0x3925da)return _0x3925da;_0x299f11['uri']='https://www.zohoapis.'+_0x3e5e29+_0xc275('0x52')+_0x4fdf0c+'))';return getZohoUser(_0x299f11,_0xc275('0x53'))[_0xc275('0x29')](function(_0x11d25e){if(_0x11d25e)return _0x11d25e;if(_0x4754d0[_0xc275('0x4b')]!=_0xc275('0x54')){return createEndUser(_0x2c6692,_0x3e5e29,_0x52ebfd,_0x4fdf0c,_0x4ed07f,_0x4754d0);}else{return{};}});});break;case _0xc275('0x55'):_0x299f11[_0xc275('0x50')]=_0xc275('0x42')+_0x3e5e29+_0xc275('0x56')+_0x4fdf0c+'))';return getZohoUser(_0x299f11,_0xc275('0x51'))[_0xc275('0x29')](function(_0x1087b6){if(_0x1087b6)return _0x1087b6;if(_0x4754d0[_0xc275('0x4b')]!='nothing'){return createEndUser(_0x2c6692,_0x3e5e29,_0x52ebfd,_0x4fdf0c,_0x4ed07f,_0x4754d0);}else{return{};}});break;case _0xc275('0x57'):_0x299f11[_0xc275('0x50')]=_0xc275('0x42')+_0x3e5e29+_0xc275('0x52')+_0x4fdf0c+'))';return getZohoUser(_0x299f11,_0xc275('0x53'))[_0xc275('0x29')](function(_0x3bb060){if(_0x3bb060)return _0x3bb060;if(_0x4754d0[_0xc275('0x4b')]!=_0xc275('0x54')){return createEndUser(_0x2c6692,_0x3e5e29,_0x52ebfd,_0x4fdf0c,_0x4ed07f,_0x4754d0);}else{return{};}});break;}}function getCall(_0x30e97b,_0x36f481,_0x279bb1,_0x441fee,_0x1c8073,_0x926937,_0x4bf3f8,_0xb04c46){logger[_0xc275('0x2e')](_0xc275('0x58'));var _0xa7dd3d={};_0xa7dd3d[_0xc275('0x59')]={'name':!_[_0xc275('0x1c')](_0x441fee['role']['name'])&&!_[_0xc275('0x1c')](_0x441fee[_0xc275('0x3b')][_0xc275('0x19')])&&_0x441fee[_0xc275('0x3b')][_0xc275('0x19')]===_0xc275('0x5a')?_0x441fee[_0xc275('0x45')][_0xc275('0x19')]:!_['isNil'](_0x441fee['first_name'])?_0x441fee[_0xc275('0x46')]+'\x20'+_0x441fee[_0xc275('0x47')]:_0x441fee[_0xc275('0x47')],'id':_0x441fee['id']};_0xa7dd3d[_0xc275('0x5b')]=intUtil['getString'](_0x926937[_0xc275('0x5c')],_0x4bf3f8,'\x20');_0xa7dd3d[_0xc275('0x5d')]=intUtil[_0xc275('0x5e')](_0x926937['Descriptions'],_0x4bf3f8,'\x0a');if(_0x1c8073['enduserType']===_0xc275('0x51')){_0xa7dd3d['Who_Id']={'name':!_[_0xc275('0x1c')](_0x1c8073[_0xc275('0x5f')])?_0x1c8073['Full_Name']:!_[_0xc275('0x1c')](_0x1c8073[_0xc275('0x60')])?_0x1c8073[_0xc275('0x60')]+'\x20'+_0x1c8073['Last_Name']:_0x1c8073['Last_Name'],'id':_0x1c8073['id']};}if(_0x1c8073[_0xc275('0x40')]==='Leads'){_0xa7dd3d[_0xc275('0x61')]={'name':!_[_0xc275('0x1c')](_0x1c8073['Full_Name'])?_0x1c8073[_0xc275('0x5f')]:!_[_0xc275('0x1c')](_0x1c8073[_0xc275('0x60')])?_0x1c8073[_0xc275('0x60')]+'\x20'+_0x1c8073['Last_Name']:_0x1c8073['Last_Name'],'id':_0x1c8073['id']};_0xa7dd3d[_0xc275('0x62')]=_[_0xc275('0x44')](_0x1c8073[_0xc275('0x40')]);}if(_0x4bf3f8[_0xc275('0x63')]){_0xa7dd3d['Call_Duration']=moment[_0xc275('0x64')](parseInt(_0x4bf3f8[_0xc275('0x63')])*0x3e8)['format'](_0xc275('0x65'));}else if(_0x4bf3f8['answertime']&&_0x4bf3f8[_0xc275('0x66')]){_0xa7dd3d[_0xc275('0x67')]=moment[_0xc275('0x64')](moment(_0x4bf3f8[_0xc275('0x66')],_0xc275('0x68'))[_0xc275('0x69')](moment(_0x4bf3f8['starttime'],_0xc275('0x68'))))['format'](_0xc275('0x65'));}switch(_0x4bf3f8[_0xc275('0x6a')]){case'called':_0xa7dd3d[_0xc275('0x6b')]=_0xc275('0x6c');break;case'complete':case _0xc275('0x6d'):_0xa7dd3d[_0xc275('0x6b')]=_0xc275('0x6e');break;case'rejected':_0xa7dd3d[_0xc275('0x6b')]='Rejected';break;case _0xc275('0x6f'):_0xa7dd3d['Call_Result']=_0xc275('0x70');break;case _0xc275('0x71'):_0xa7dd3d[_0xc275('0x6b')]=_0xc275('0x72');default:}_0xa7dd3d['Call_Start_Time']=(_0xb04c46===_0xc275('0x73')?moment(_0x4bf3f8[_0xc275('0x74')])[_0xc275('0x31')](_0xc275('0x68')):moment(_0x4bf3f8[_0xc275('0x75')])[_0xc275('0x31')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0xc275('0x68'));_0xa7dd3d[_0xc275('0x76')]=_0xb04c46||'Inbound';_0xa7dd3d=_['merge'](_0xa7dd3d,getCustomFields(_0x926937['Fields'],_0x4bf3f8));return request({'method':_0xc275('0x41'),'uri':_0xc275('0x42')+_0x36f481+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x30e97b},'body':{'data':[_0xa7dd3d]},'json':!![]})[_0xc275('0x29')](function(_0x50182d){if(_0x50182d&&_0x50182d[_0xc275('0x3f')][0x0][_0xc275('0x48')]===_0xc275('0x49')){logger[_0xc275('0x2e')](_0xc275('0x77'));return{'id':_0x50182d['data'][0x0]['details']['id']};}})[_0xc275('0x2a')](function(_0x49a0ec){logger[_0xc275('0x2e')](_0xc275('0x78'),_0x49a0ec[_0xc275('0x2d')]);console[_0xc275('0x4c')]('err',_0x49a0ec);});}exports[_0xc275('0x79')]=function(_0x587dce,_0x36fbfc,_0x244d0b,_0x1794b8,_0x3939b8,_0x27bb37){var _0x3f27c6,_0x2e7673,_0x3d84b7;_0x27bb37['host']=intUtil[_0xc275('0x7a')](_0x27bb37['host']);_0x27bb37[_0xc275('0x7b')]=intUtil['stripTrailingSlash'](_0x27bb37[_0xc275('0x7b')]);if(_0x3939b8&&_0x3939b8[_0xc275('0x7c')]){logger['info'](_0xc275('0x7d'),'Recording\x20is\x20enabled!');_0x36fbfc[_0xc275('0x7e')]=_0x27bb37[_0xc275('0x7b')]+_0xc275('0x7f')+_0x36fbfc[_0xc275('0x80')]+_0xc275('0x81')+md5(_0x36fbfc[_0xc275('0x80')]);}else{_0x36fbfc[_0xc275('0x7e')]='';}var _0x200672=_0x27bb37[_0xc275('0x82')]===_0xc275('0x83')?'eu':_0xc275('0x84');return getAccessToken(_0x27bb37)[_0xc275('0x29')](function(_0x3d0674){_0x3d84b7=_0x3d0674;return getUser(_0x3d84b7,_0x200672,_0x27bb37,_0x1794b8[_0xc275('0x36')]);})[_0xc275('0x29')](function(_0x4db122){_0x3f27c6=_0x4db122;logger[_0xc275('0x2e')](_0xc275('0x85'),_0x3f27c6['id']);return getEndUser(_0x3d84b7,_0x200672,_0x27bb37,_0x36fbfc[_0xc275('0x86')],_0x36fbfc['calleridnum'],_0x3f27c6,_0x244d0b);})[_0xc275('0x29')](function(_0x99ba15){_0x2e7673=_0x99ba15;return getCall(_0x3d84b7,_0x200672,_0x27bb37,_0x3f27c6,_0x2e7673,_0x244d0b,_0x36fbfc,_0xc275('0x87'));})[_0xc275('0x29')](function(_0x2b7856){if(_0x2b7856){logger[_0xc275('0x2e')](_0xc275('0x88'),_0x2b7856['id']);logger[_0xc275('0x2e')](_0xc275('0x7d'),_0xc275('0x89'));emit(util[_0xc275('0x31')](_0xc275('0x8a'),_0x1794b8['name']),_0xc275('0x8b'),{'uri':_0xc275('0x8c')+_0x27bb37[_0xc275('0x82')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2b7856['id']});}})[_0xc275('0x2a')](function(_0x164cb4){logger[_0xc275('0x2b')](_0xc275('0x7d'),JSON[_0xc275('0x3c')](_0x164cb4));});};exports[_0xc275('0x73')]=function(_0x2d1c4b,_0x21bce5,_0x5bfe1c,_0xd3ad5b,_0x4b1264,_0x55e0d9,_0x5e2e5c){var _0xecfc4f,_0x142829,_0x8a14e9;_0x55e0d9[_0xc275('0x82')]=intUtil[_0xc275('0x7a')](_0x55e0d9[_0xc275('0x82')]);_0x55e0d9['serverUrl']=intUtil[_0xc275('0x7a')](_0x55e0d9['serverUrl']);if(_0x5e2e5c&&_0x5e2e5c[_0xc275('0x8d')]&&_0x5e2e5c[_0xc275('0x8d')]!=='none'){logger['info'](_0xc275('0x8e'),_0xc275('0x8f'));_0x21bce5[_0xc275('0x7e')]=_0x55e0d9[_0xc275('0x7b')]+_0xc275('0x7f')+_0x21bce5[_0xc275('0x80')]+'/downloads?type=uniqueid&token='+md5(_0x21bce5[_0xc275('0x80')]);}var _0x211e6b=_0x55e0d9[_0xc275('0x82')]==='zoho.eu'?'eu':_0xc275('0x84');return getAccessToken(_0x55e0d9)['then'](function(_0x2ad80f){_0x8a14e9=_0x2ad80f;return getUser(_0x8a14e9,_0x211e6b,_0x55e0d9,_0xd3ad5b[_0xc275('0x36')]);})[_0xc275('0x29')](function(_0x5d2e24){_0xecfc4f=_0x5d2e24;logger[_0xc275('0x2e')](_0xc275('0x85'),_0xecfc4f['id']);return getEndUser(_0x8a14e9,_0x211e6b,_0x55e0d9,_0x21bce5[_0xc275('0x90')],_0x21bce5[_0xc275('0x91')],_0xecfc4f,_0x5bfe1c);})['then'](function(_0x471e66){_0x142829=_0x471e66;return getCall(_0x8a14e9,_0x211e6b,_0x55e0d9,_0xecfc4f,_0x142829,_0x5bfe1c,_0x21bce5,'Outbound');})[_0xc275('0x29')](function(_0x57f594){if(_0x57f594){logger[_0xc275('0x2e')](_0xc275('0x88'),_0x57f594['id']);logger[_0xc275('0x2e')](_0xc275('0x8e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc275('0x31')]('user:%s',_0xd3ad5b[_0xc275('0x19')]),'trigger:browser:url',{'uri':_0xc275('0x8c')+_0x55e0d9[_0xc275('0x82')]+_0xc275('0x92')+_0x57f594['id']});}})['catch'](function(_0x3fb79a){logger[_0xc275('0x2b')](_0xc275('0x8e'),JSON[_0xc275('0x3c')](_0x3fb79a));});};exports[_0xc275('0x93')]=function(_0x1fbea9,_0x1bf31b,_0x24f86b,_0xf1bdcd,_0x1f9c4a,_0xb3cbd5){var _0x1ab4f3,_0xd27d12,_0x1c341b;_0xb3cbd5['host']=intUtil[_0xc275('0x7a')](_0xb3cbd5['host']);_0xb3cbd5[_0xc275('0x7b')]=intUtil[_0xc275('0x7a')](_0xb3cbd5[_0xc275('0x7b')]);if(_0x1f9c4a&&_0x1f9c4a['monitor_format']){logger[_0xc275('0x2e')]('['+_0x1bf31b[_0xc275('0x6a')][_0xc275('0x94')]()+']',_0xc275('0x8f'));_0x1bf31b['recordingURL']=_0xb3cbd5['serverUrl']+_0xc275('0x7f')+_0x1bf31b[_0xc275('0x80')]+_0xc275('0x81')+md5(_0x1bf31b[_0xc275('0x80')]);}else{_0x1bf31b['recordingURL']='';}var _0x1fce1c=_0xb3cbd5['host']===_0xc275('0x83')?'eu':_0xc275('0x84');return getAccessToken(_0xb3cbd5)[_0xc275('0x29')](function(_0x2d4092){_0x1c341b=_0x2d4092;return getUser(_0x1c341b,_0x1fce1c,_0xb3cbd5);})[_0xc275('0x29')](function(_0x12e7ba){_0x1ab4f3=_0x12e7ba;logger[_0xc275('0x2e')](_0xc275('0x85'),_0x1ab4f3['id']);return getEndUser(_0x1c341b,_0x1fce1c,_0xb3cbd5,_0x1bf31b['calleridname'],_0x1bf31b[_0xc275('0x95')],_0x1ab4f3,_0x24f86b);})['then'](function(_0x48e59a){_0xd27d12=_0x48e59a;return getCall(_0x1c341b,_0x1fce1c,_0xb3cbd5,_0x1ab4f3,_0xd27d12,_0x24f86b,_0x1bf31b,_0xc275('0x87'));})[_0xc275('0x29')](function(_0x35b86b){if(_0x35b86b){logger['info'](_0xc275('0x88'),_0x35b86b['id']);}})[_0xc275('0x2a')](function(_0xc9ea7a){logger[_0xc275('0x2b')]('['+_0x1bf31b['lastevent'][_0xc275('0x94')]()+']',JSON[_0xc275('0x3c')](_0xc9ea7a));});}; \ No newline at end of file +var _0xd41f=['log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Leads','Creating\x20new\x20call...','Owner','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','unmanaged','lastevent','toUpperCase','request-promise','md5','./util','moment','ioredis','bluebird','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','length','includes','string','type','content','toString','variable','variableName','idField','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','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','clientSecret','then','seconds','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','stringify','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','Error:\x20'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd41f,0xf1));var _0xfd41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd41f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var rp=require(_0xfd41('0x0'));var md5=require(_0xfd41('0x1'));var util=require('util');var intUtil=require(_0xfd41('0x2'));var moment=require(_0xfd41('0x3'));var Redis=require(_0xfd41('0x4'));var BPromise=require(_0xfd41('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('zoho');config[_0xfd41('0x6')]=_['defaults'](config[_0xfd41('0x6')],{'host':_0xfd41('0x7'),'port':0x18eb});var io=require(_0xfd41('0x8'))(new Redis(config[_0xfd41('0x6')]));function emit(_0x5e9bf2,_0x898a79,_0xa0fd71){io['to'](_0x5e9bf2)[_0xfd41('0x9')](_0x898a79,_0xa0fd71);}function request(_0x4fdd6f){logger[_0xfd41('0xa')](_0xfd41('0xb'),JSON['stringify'](_0x4fdd6f));return rp(_0x4fdd6f);}function getCustomFields(_0x5037d8,_0x5368f0){var _0x59f7bd={};if(_0x5037d8[_0xfd41('0xc')]>0x0){_['forEach'](_0x5037d8,function(_0x5b5dd6){if(_[_0xfd41('0xd')]([_0xfd41('0xe'),'picklist'],_0x5b5dd6[_0xfd41('0xf')])&&_0x5b5dd6['idField']){_0x59f7bd[_0x5b5dd6['idField']]=_0x5b5dd6[_0xfd41('0x10')][_0xfd41('0x11')]();}else if(_0x5b5dd6['type']===_0xfd41('0x12')&&_0x5b5dd6[_0xfd41('0x13')]&&_0x5b5dd6[_0xfd41('0x14')]&&_0x5368f0[_0x5b5dd6[_0xfd41('0x13')]]){_0x59f7bd[_0x5b5dd6[_0xfd41('0x14')]]=_0x5368f0[_0x5b5dd6[_0xfd41('0x13')]][_0xfd41('0x11')]();}else if(_0x5b5dd6[_0xfd41('0xf')]===_0xfd41('0x15')&&_0x5b5dd6[_0xfd41('0x16')]&&_0x5b5dd6['Variable'][_0xfd41('0x17')]&&_0x5b5dd6[_0xfd41('0x14')]&&_0x5368f0[_0x5b5dd6['Variable'][_0xfd41('0x17')][_0xfd41('0x18')]()]){_0x59f7bd[_0x5b5dd6[_0xfd41('0x14')]]=_0x5368f0[_0x5b5dd6['Variable'][_0xfd41('0x17')][_0xfd41('0x18')]()][_0xfd41('0x11')]();}});}return _0x59f7bd;}function getName(_0x3401b4){if(_0x3401b4[_0xfd41('0x19')]('\x20')>0x0){var _0x810f0c=_0x3401b4[_0xfd41('0x1a')](/ (.+)/);if(_0x810f0c[0x1]){return _0x810f0c;}}return[_0x3401b4,_0x3401b4];}var accountsTokens={};function getAccessToken(_0x542863){return new Promise(function(_0x24a367,_0x51cb26){if(!_[_0xfd41('0x1b')](accountsTokens[_0x542863['id']])&&!_[_0xfd41('0x1b')](accountsTokens[_0x542863['id']]['access_token'])){if(moment()[_0xfd41('0x1c')](accountsTokens[_0x542863['id']][_0xfd41('0x1d')])){_0x24a367(accountsTokens[_0x542863['id']][_0xfd41('0x1e')]);}}var _0x595728;switch(_0x542863[_0xfd41('0x1f')]){case'US':_0x595728=_0xfd41('0x20');break;case'AU':_0x595728=_0xfd41('0x21');break;case'EU':_0x595728=_0xfd41('0x22');break;case'IN':_0x595728=_0xfd41('0x23');break;case'CN':_0x595728=_0xfd41('0x24');break;default:_0x595728=_0xfd41('0x22');break;}var _0x18ec63={'method':_0xfd41('0x25'),'uri':_0x595728+_0xfd41('0x26'),'qs':{'refresh_token':_0x542863['refreshToken'],'client_id':_0x542863['clientId'],'client_secret':_0x542863[_0xfd41('0x27')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x18ec63)[_0xfd41('0x28')](function(_0x238c5f){accountsTokens[_0x542863['id']]={'access_token':_0x238c5f['access_token'],'expires_in':moment()['add'](_0x238c5f[_0xfd41('0x1d')],_0xfd41('0x29'))};_0x24a367(_0x238c5f['access_token']);})['catch'](function(_0x46a0c0){logger['error']('Failing\x20creating\x20the\x20access_token',_0x46a0c0[_0xfd41('0x2a')]);_0x51cb26(_0x46a0c0);});});}function getUser(_0x4b450c,_0x25d658,_0x50d435,_0x338658){logger[_0xfd41('0x2b')]('Search\x20user');return request({'method':_0xfd41('0x2c'),'uri':util[_0xfd41('0x2d')](_0xfd41('0x2e'),_0x25d658),'qs':{'type':_0xfd41('0x2f')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4b450c},'json':!![]})[_0xfd41('0x28')](function(_0x3be7d6){if(_0x3be7d6['users']){var _0x114d43=-0x1;if(_[_0xfd41('0x30')](_0x3be7d6[_0xfd41('0x31')])){if(!_[_0xfd41('0x1b')](_0x338658)){_0x114d43=_[_0xfd41('0x32')](_0x3be7d6['users'],function(_0x29809e){return _0x29809e[_0xfd41('0x33')]===_0x338658;});}if(_0x114d43>=0x0){logger['info'](_0xfd41('0x34'));}else{logger['info'](_0xfd41('0x35'));_0x114d43=_[_0xfd41('0x32')](_0x3be7d6[_0xfd41('0x31')],function(_0x4e2f7a){return _0x4e2f7a[_0xfd41('0x36')][_0xfd41('0x17')]===_0xfd41('0x37');});}return _0x3be7d6[_0xfd41('0x31')][_0x114d43];}else{if(_0x3be7d6[_0xfd41('0x38')][_0xfd41('0x36')]['name']===_0xfd41('0x37')){logger[_0xfd41('0x2b')](_0xfd41('0x35'));user=_0x3be7d6[_0xfd41('0x38')];return user;}else{logger[_0xfd41('0x39')](_0xfd41('0x3a'),JSON[_0xfd41('0x3b')](_0x3be7d6));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x3be7d6));}}}else{logger['error'](_0xfd41('0x3a'),JSON[_0xfd41('0x3b')](_0x3be7d6));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xfd41('0x3b')](_0x3be7d6));}})[_0xfd41('0x3c')](function(_0x18ac43){console[_0xfd41('0x39')](_0x18ac43);});}function getZohoUser(_0x2817fb,_0x3caaf5){return new BPromise(function(_0x1b2f92,_0x1e0a68){request(_0x2817fb)['then'](function(_0x2a5a75){var _0x1169e3=null;if(_0x2a5a75){_0x1169e3=_0x2a5a75[_0xfd41('0x3d')][0x0];_0x1169e3[_0xfd41('0x3e')]=_0x3caaf5;}_0x1b2f92(_0x1169e3);})[_0xfd41('0x3c')](function(_0x179538){_0x1e0a68(_0x179538);});});}function createEndUser(_0x2aaa40,_0x51e01b,_0x1f2bd4,_0x25926d,_0x12ac4c,_0xb9f30){var _0x1f2bd4=getName(_0x1f2bd4);return request({'method':_0xfd41('0x25'),'uri':_0xfd41('0x3f')+_0x51e01b+_0xfd41('0x40')+_[_0xfd41('0x41')](_0xb9f30[_0xfd41('0x42')])+'s','body':{'data':[{'Last_Name':_0x1f2bd4[0x1],'First_Name':_0x1f2bd4[0x0],'Phone':_0x25926d,'Owner':{'name':!_[_0xfd41('0x1b')](_0x12ac4c[_0xfd41('0x43')]['name'])?_0x12ac4c[_0xfd41('0x43')]['name']:!_[_0xfd41('0x1b')](_0x12ac4c[_0xfd41('0x44')])?_0x12ac4c[_0xfd41('0x44')]+'\x20'+_0x12ac4c['last_name']:_0x12ac4c[_0xfd41('0x45')],'id':_0x12ac4c['id']}}]},'headers':{'Authorization':_0xfd41('0x46')+_0x2aaa40},'json':!![]})[_0xfd41('0x28')](function(_0x55f713){if(_0x55f713&&_0x55f713['data'][0x0][_0xfd41('0x47')]===_0xfd41('0x48')){var _0x56c494=_0x55f713[_0xfd41('0x3d')][0x0][_0xfd41('0x49')];_0x56c494[_0xfd41('0x3e')]=_[_0xfd41('0x41')](_0xb9f30[_0xfd41('0x42')])+'s';return _0x56c494;}logger[_0xfd41('0x39')](_0xfd41('0x3a'),JSON[_0xfd41('0x3b')](data));throw new Error(_0xfd41('0x4a')+JSON[_0xfd41('0x3b')](data));})[_0xfd41('0x3c')](function(_0x546f9d){console[_0xfd41('0x4b')](_0xfd41('0x4c'),_0x546f9d);});}function getEndUser(_0x1e74ce,_0x37256d,_0x472b4e,_0x37f465,_0x1e68b0,_0x57afb3,_0x3e4459){var _0x4356eb={'method':_0xfd41('0x2c'),'uri':'','headers':{'Authorization':_0xfd41('0x46')+_0x1e74ce},'json':!![]};switch(_0x3e4459[_0xfd41('0x4d')]){case _0xfd41('0x4e'):_0x4356eb['uri']=_0xfd41('0x3f')+_0x37256d+_0xfd41('0x4f')+_0x1e68b0+'))';return getZohoUser(_0x4356eb,_0xfd41('0x50'))['then'](function(_0x3a1113){if(_0x3a1113)return _0x3a1113;_0x4356eb[_0xfd41('0x51')]='https://www.zohoapis.'+_0x37256d+_0xfd41('0x52')+_0x1e68b0+'))';return getZohoUser(_0x4356eb,'Leads')[_0xfd41('0x28')](function(_0x591958){if(_0x591958)return _0x591958;if(_0x3e4459[_0xfd41('0x42')]!=_0xfd41('0x53')){return createEndUser(_0x1e74ce,_0x37256d,_0x37f465,_0x1e68b0,_0x57afb3,_0x3e4459);}else{return{};}});});break;case _0xfd41('0x54'):_0x4356eb['uri']=_0xfd41('0x3f')+_0x37256d+_0xfd41('0x4f')+_0x1e68b0+'))';return getZohoUser(_0x4356eb,_0xfd41('0x50'))['then'](function(_0x228c74){if(_0x228c74)return _0x228c74;if(_0x3e4459[_0xfd41('0x42')]!=_0xfd41('0x53')){return createEndUser(_0x1e74ce,_0x37256d,_0x37f465,_0x1e68b0,_0x57afb3,_0x3e4459);}else{return{};}});break;case _0xfd41('0x55'):_0x4356eb[_0xfd41('0x51')]='https://www.zohoapis.'+_0x37256d+_0xfd41('0x52')+_0x1e68b0+'))';return getZohoUser(_0x4356eb,_0xfd41('0x56'))[_0xfd41('0x28')](function(_0x461323){if(_0x461323)return _0x461323;if(_0x3e4459['moduleCreate']!='nothing'){return createEndUser(_0x1e74ce,_0x37256d,_0x37f465,_0x1e68b0,_0x57afb3,_0x3e4459);}else{return{};}});break;}}function getCall(_0x53161f,_0x1d383b,_0x3008ae,_0x46adec,_0x1a3944,_0x3d5500,_0x1fb12e,_0x2abe48){logger[_0xfd41('0x2b')](_0xfd41('0x57'));var _0x5baf8a={};_0x5baf8a[_0xfd41('0x58')]={'name':!_[_0xfd41('0x1b')](_0x46adec[_0xfd41('0x43')]['name'])&&!_['isNil'](_0x46adec['profile'][_0xfd41('0x17')])&&_0x46adec[_0xfd41('0x36')][_0xfd41('0x17')]==='administrator'?_0x46adec[_0xfd41('0x43')][_0xfd41('0x17')]:!_['isNil'](_0x46adec[_0xfd41('0x44')])?_0x46adec[_0xfd41('0x44')]+'\x20'+_0x46adec[_0xfd41('0x45')]:_0x46adec[_0xfd41('0x45')],'id':_0x46adec['id']};_0x5baf8a['Subject']=intUtil[_0xfd41('0x59')](_0x3d5500[_0xfd41('0x5a')],_0x1fb12e,'\x20');_0x5baf8a['Description']=intUtil[_0xfd41('0x59')](_0x3d5500[_0xfd41('0x5b')],_0x1fb12e,'\x0a');if(_0x1a3944[_0xfd41('0x3e')]===_0xfd41('0x50')){_0x5baf8a[_0xfd41('0x5c')]={'name':!_[_0xfd41('0x1b')](_0x1a3944[_0xfd41('0x5d')])?_0x1a3944[_0xfd41('0x5d')]:!_['isNil'](_0x1a3944[_0xfd41('0x5e')])?_0x1a3944['First_Name']+'\x20'+_0x1a3944['Last_Name']:_0x1a3944[_0xfd41('0x5f')],'id':_0x1a3944['id']};}if(_0x1a3944['enduserType']===_0xfd41('0x56')){_0x5baf8a[_0xfd41('0x60')]={'name':!_[_0xfd41('0x1b')](_0x1a3944['Full_Name'])?_0x1a3944[_0xfd41('0x5d')]:!_[_0xfd41('0x1b')](_0x1a3944[_0xfd41('0x5e')])?_0x1a3944[_0xfd41('0x5e')]+'\x20'+_0x1a3944[_0xfd41('0x5f')]:_0x1a3944['Last_Name'],'id':_0x1a3944['id']};_0x5baf8a[_0xfd41('0x61')]=_['startCase'](_0x1a3944['enduserType']);}if(_0x1fb12e[_0xfd41('0x62')]){_0x5baf8a[_0xfd41('0x63')]=moment[_0xfd41('0x64')](parseInt(_0x1fb12e[_0xfd41('0x62')])*0x3e8)[_0xfd41('0x2d')]('mm:ss');}else if(_0x1fb12e[_0xfd41('0x65')]&&_0x1fb12e[_0xfd41('0x66')]){_0x5baf8a[_0xfd41('0x63')]=moment[_0xfd41('0x64')](moment(_0x1fb12e['endtime'],_0xfd41('0x67'))[_0xfd41('0x68')](moment(_0x1fb12e[_0xfd41('0x69')],_0xfd41('0x67'))))[_0xfd41('0x2d')]('mm:ss');}switch(_0x1fb12e['lastevent']){case _0xfd41('0x6a'):_0x5baf8a[_0xfd41('0x6b')]=_0xfd41('0x6c');break;case _0xfd41('0x6d'):case _0xfd41('0x6e'):_0x5baf8a[_0xfd41('0x6b')]=_0xfd41('0x6f');break;case _0xfd41('0x70'):_0x5baf8a[_0xfd41('0x6b')]=_0xfd41('0x71');break;case _0xfd41('0x72'):_0x5baf8a['Call_Result']=_0xfd41('0x73');break;case _0xfd41('0x74'):_0x5baf8a['Call_Result']=_0xfd41('0x75');default:}_0x5baf8a[_0xfd41('0x76')]=(_0x2abe48==='outbound'?moment(_0x1fb12e[_0xfd41('0x69')])[_0xfd41('0x2d')](_0xfd41('0x67')):moment(_0x1fb12e[_0xfd41('0x77')])['format'](_0xfd41('0x67')))||moment()[_0xfd41('0x2d')](_0xfd41('0x67'));_0x5baf8a[_0xfd41('0x78')]=_0x2abe48||_0xfd41('0x79');_0x5baf8a=_[_0xfd41('0x7a')](_0x5baf8a,getCustomFields(_0x3d5500['Fields'],_0x1fb12e));return request({'method':'POST','uri':_0xfd41('0x3f')+_0x1d383b+_0xfd41('0x7b'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x53161f},'body':{'data':[_0x5baf8a]},'json':!![]})['then'](function(_0x38657d){if(_0x38657d&&_0x38657d['data'][0x0]['code']===_0xfd41('0x48')){logger[_0xfd41('0x2b')](_0xfd41('0x7c'));return{'id':_0x38657d[_0xfd41('0x3d')][0x0]['details']['id']};}})[_0xfd41('0x3c')](function(_0x3f07ff){logger[_0xfd41('0x2b')]('err',_0x3f07ff['stack']);console[_0xfd41('0x4b')](_0xfd41('0x7d'),_0x3f07ff);});}exports[_0xfd41('0x7e')]=function(_0x5c7cd3,_0x55cdf2,_0x1053a8,_0x15e073,_0x2a8ce8,_0x46d97c){var _0x291b77,_0x32a55d,_0x3cbfa2;_0x46d97c[_0xfd41('0x7f')]=intUtil[_0xfd41('0x80')](_0x46d97c[_0xfd41('0x7f')]);_0x46d97c[_0xfd41('0x81')]=intUtil[_0xfd41('0x80')](_0x46d97c['serverUrl']);if(_0x2a8ce8&&_0x2a8ce8[_0xfd41('0x82')]){logger['info']('[QUEUE]',_0xfd41('0x83'));_0x55cdf2[_0xfd41('0x84')]=_0x46d97c[_0xfd41('0x81')]+'/api/voice/recordings/'+_0x55cdf2[_0xfd41('0x85')]+_0xfd41('0x86')+md5(_0x55cdf2['uniqueid']);}else{_0x55cdf2[_0xfd41('0x84')]='';}var _0x304825=_0x46d97c[_0xfd41('0x7f')]===_0xfd41('0x87')?'eu':_0xfd41('0x88');return getAccessToken(_0x46d97c)[_0xfd41('0x28')](function(_0xb701e5){_0x3cbfa2=_0xb701e5;return getUser(_0x3cbfa2,_0x304825,_0x46d97c,_0x15e073[_0xfd41('0x33')]);})[_0xfd41('0x28')](function(_0x2cc6e8){_0x291b77=_0x2cc6e8;logger[_0xfd41('0x2b')](_0xfd41('0x89'),_0x291b77['id']);return getEndUser(_0x3cbfa2,_0x304825,_0x46d97c,_0x55cdf2[_0xfd41('0x8a')],_0x55cdf2[_0xfd41('0x8b')],_0x291b77,_0x1053a8);})[_0xfd41('0x28')](function(_0x2a833e){_0x32a55d=_0x2a833e;return getCall(_0x3cbfa2,_0x304825,_0x46d97c,_0x291b77,_0x32a55d,_0x1053a8,_0x55cdf2,_0xfd41('0x79'));})['then'](function(_0x30a778){if(_0x30a778){logger['info'](_0xfd41('0x8c'),_0x30a778['id']);logger[_0xfd41('0x2b')](_0xfd41('0x8d'),_0xfd41('0x8e'));emit(util[_0xfd41('0x2d')](_0xfd41('0x8f'),_0x15e073[_0xfd41('0x17')]),'trigger:browser:url',{'uri':_0xfd41('0x90')+_0x46d97c[_0xfd41('0x7f')]+_0xfd41('0x91')+_0x30a778['id']});}})[_0xfd41('0x3c')](function(_0x5b8c19){logger[_0xfd41('0x39')](_0xfd41('0x8d'),JSON[_0xfd41('0x3b')](_0x5b8c19));});};exports[_0xfd41('0x92')]=function(_0x25c9ba,_0x7b2989,_0x21bcdf,_0x41cda3,_0x58b845,_0x119378,_0x36e902){var _0x202bb4,_0x54cf83,_0x5a0bc9;_0x119378['host']=intUtil[_0xfd41('0x80')](_0x119378[_0xfd41('0x7f')]);_0x119378[_0xfd41('0x81')]=intUtil[_0xfd41('0x80')](_0x119378['serverUrl']);if(_0x36e902&&_0x36e902['recordingFormat']&&_0x36e902[_0xfd41('0x93')]!==_0xfd41('0x94')){logger[_0xfd41('0x2b')](_0xfd41('0x95'),_0xfd41('0x83'));_0x7b2989[_0xfd41('0x84')]=_0x119378[_0xfd41('0x81')]+_0xfd41('0x96')+_0x7b2989[_0xfd41('0x85')]+_0xfd41('0x86')+md5(_0x7b2989['uniqueid']);}var _0x4eed12=_0x119378['host']===_0xfd41('0x87')?'eu':_0xfd41('0x88');return getAccessToken(_0x119378)[_0xfd41('0x28')](function(_0x3d9aa0){_0x5a0bc9=_0x3d9aa0;return getUser(_0x5a0bc9,_0x4eed12,_0x119378,_0x41cda3['email']);})[_0xfd41('0x28')](function(_0x380866){_0x202bb4=_0x380866;logger[_0xfd41('0x2b')]('The\x20User\x20ID\x20is:',_0x202bb4['id']);return getEndUser(_0x5a0bc9,_0x4eed12,_0x119378,_0x7b2989[_0xfd41('0x97')],_0x7b2989[_0xfd41('0x98')],_0x202bb4,_0x21bcdf);})[_0xfd41('0x28')](function(_0x5a7613){_0x54cf83=_0x5a7613;return getCall(_0x5a0bc9,_0x4eed12,_0x119378,_0x202bb4,_0x54cf83,_0x21bcdf,_0x7b2989,_0xfd41('0x99'));})[_0xfd41('0x28')](function(_0x15224e){if(_0x15224e){logger[_0xfd41('0x2b')](_0xfd41('0x8c'),_0x15224e['id']);logger['info'](_0xfd41('0x95'),_0xfd41('0x8e'));emit(util[_0xfd41('0x2d')](_0xfd41('0x8f'),_0x41cda3[_0xfd41('0x17')]),_0xfd41('0x9a'),{'uri':_0xfd41('0x90')+_0x119378[_0xfd41('0x7f')]+_0xfd41('0x91')+_0x15224e['id']});}})[_0xfd41('0x3c')](function(_0x3796ce){logger[_0xfd41('0x39')](_0xfd41('0x95'),JSON[_0xfd41('0x3b')](_0x3796ce));});};exports[_0xfd41('0x9b')]=function(_0x23f1e2,_0x46f0a9,_0x2729f2,_0x116e0c,_0x3d126b,_0xa97db4){var _0x1cf542,_0x1a3194,_0x4a5d02;_0xa97db4[_0xfd41('0x7f')]=intUtil[_0xfd41('0x80')](_0xa97db4['host']);_0xa97db4[_0xfd41('0x81')]=intUtil[_0xfd41('0x80')](_0xa97db4[_0xfd41('0x81')]);if(_0x3d126b&&_0x3d126b[_0xfd41('0x82')]){logger[_0xfd41('0x2b')]('['+_0x46f0a9[_0xfd41('0x9c')][_0xfd41('0x9d')]()+']','Recording\x20is\x20enabled!');_0x46f0a9[_0xfd41('0x84')]=_0xa97db4[_0xfd41('0x81')]+_0xfd41('0x96')+_0x46f0a9['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x46f0a9[_0xfd41('0x85')]);}else{_0x46f0a9[_0xfd41('0x84')]='';}var _0x2e54d4=_0xa97db4[_0xfd41('0x7f')]==='zoho.eu'?'eu':_0xfd41('0x88');return getAccessToken(_0xa97db4)['then'](function(_0xaa2c62){_0x4a5d02=_0xaa2c62;return getUser(_0x4a5d02,_0x2e54d4,_0xa97db4);})[_0xfd41('0x28')](function(_0x54e74d){_0x1cf542=_0x54e74d;logger[_0xfd41('0x2b')](_0xfd41('0x89'),_0x1cf542['id']);return getEndUser(_0x4a5d02,_0x2e54d4,_0xa97db4,_0x46f0a9[_0xfd41('0x8a')],_0x46f0a9[_0xfd41('0x8b')],_0x1cf542,_0x2729f2);})['then'](function(_0x48b989){_0x1a3194=_0x48b989;return getCall(_0x4a5d02,_0x2e54d4,_0xa97db4,_0x1cf542,_0x1a3194,_0x2729f2,_0x46f0a9,'Inbound');})[_0xfd41('0x28')](function(_0x236729){if(_0x236729){logger['info'](_0xfd41('0x8c'),_0x236729['id']);}})[_0xfd41('0x3c')](function(_0x3dcfa9){logger[_0xfd41('0x39')]('['+_0x46f0a9[_0xfd41('0x9c')][_0xfd41('0x9d')]()+']',JSON[_0xfd41('0x3b')](_0x3dcfa9));});}; \ 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 0d74fcd..2c498d3 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 _0xdfb1=['../../../../config/logger','trigger','exec','data2','data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','format','util','mustache'];(function(_0x5c37c3,_0x1b0b87){var _0x4e6519=function(_0x328e4e){while(--_0x328e4e){_0x5c37c3['push'](_0x5c37c3['shift']());}};_0x4e6519(++_0x1b0b87);}(_0xdfb1,0xe5));var _0x1dfb=function(_0x5b7fbb,_0x2f7d02){_0x5b7fbb=_0x5b7fbb-0x0;var _0x1151c7=_0xdfb1[_0x5b7fbb];return _0x1151c7;};'use strict';var util=require(_0x1dfb('0x0'));var sh=require('shelljs');var Mustache=require(_0x1dfb('0x1'));var logger=require(_0x1dfb('0x2'))(_0x1dfb('0x3'));exports[_0x1dfb('0x4')]=function(_0x12686e,_0x5de022){var _0x30e6f9=_0x12686e['data2']?_0x12686e[_0x1dfb('0x5')]:'Script';var _0x535d78=_0x12686e[_0x1dfb('0x6')]?Mustache[_0x1dfb('0x7')](_0x12686e[_0x1dfb('0x6')],_0x5de022):_0x5de022;sh['exec'](_0x535d78,function(_0x185719,_0x3b5f3d,_0x3d4d56){if(_0x185719!==0x0){logger[_0x1dfb('0x8')](util['format'](_0x1dfb('0x9'),_0x30e6f9,_0x535d78,_0x185719,_0x3d4d56));}else{logger['info'](util[_0x1dfb('0xa')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x30e6f9,_0x535d78,_0x3b5f3d));}});}; \ No newline at end of file +var _0x4090=['info','shelljs','mustache','exec','data2','data3','render','format'];(function(_0x5c5399,_0x223bcc){var _0x24d976=function(_0x4e54b7){while(--_0x4e54b7){_0x5c5399['push'](_0x5c5399['shift']());}};_0x24d976(++_0x223bcc);}(_0x4090,0x161));var _0x0409=function(_0x5ec44e,_0x7f4d80){_0x5ec44e=_0x5ec44e-0x0;var _0x50e415=_0x4090[_0x5ec44e];return _0x50e415;};'use strict';var util=require('util');var sh=require(_0x0409('0x0'));var Mustache=require(_0x0409('0x1'));var logger=require('../../../../config/logger')('trigger');exports[_0x0409('0x2')]=function(_0x3d84b2,_0x192ec4){var _0x1b17c0=_0x3d84b2[_0x0409('0x3')]?_0x3d84b2[_0x0409('0x3')]:'Script';var _0x31fbad=_0x3d84b2[_0x0409('0x4')]?Mustache[_0x0409('0x5')](_0x3d84b2['data3'],_0x192ec4):_0x192ec4;sh[_0x0409('0x2')](_0x31fbad,function(_0x20ae39,_0x9e581d,_0x3d12c8){if(_0x20ae39!==0x0){logger['error'](util[_0x0409('0x6')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x1b17c0,_0x31fbad,_0x20ae39,_0x3d12c8));}else{logger[_0x0409('0x7')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x1b17c0,_0x31fbad,_0x9e581d));}});}; \ 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 bc4d91e..903372d 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 _0xe7aa=['util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','data6','parse','error','stack','GET','DELETE','POST','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','stringify','then','isNil',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise'];(function(_0x5b983b,_0x597959){var _0xb75216=function(_0x482122){while(--_0x482122){_0x5b983b['push'](_0x5b983b['shift']());}};_0xb75216(++_0x597959);}(_0xe7aa,0x1db));var _0xae7a=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xe7aa[_0x2dea24];return _0x309d58;};'use strict';var rp=require(_0xae7a('0x0'));var util=require(_0xae7a('0x1'));var _=require(_0xae7a('0x2'));var Mustache=require(_0xae7a('0x3'));var logger=require(_0xae7a('0x4'))(_0xae7a('0x5'));exports[_0xae7a('0x6')]=function(_0x290a76,_0x4b17a5){var _0x342353,_0x38cf43;var _0x339497={'method':_0x290a76[_0xae7a('0x7')][_0xae7a('0x8')](),'uri':Mustache[_0xae7a('0x9')](_0x290a76[_0xae7a('0xa')],_0x4b17a5),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x290a76[_0xae7a('0xb')])===_0xae7a('0xc')&&parseInt(_0x290a76['data5'])>=0x1&&parseInt(_0x290a76[_0xae7a('0xb')])<=0xa?parseInt(_0x290a76[_0xae7a('0xb')])*0x3e8:0x5*0x3e8};try{_0x339497[_0xae7a('0xd')]=_0x290a76[_0xae7a('0xe')]?JSON[_0xae7a('0xf')](Mustache[_0xae7a('0x9')](_0x290a76[_0xae7a('0xe')],_0x4b17a5)):{};}catch(_0x14bde9){logger[_0xae7a('0x10')](_0x14bde9[_0xae7a('0x11')]);}switch(_0x290a76[_0xae7a('0x7')]['toUpperCase']()){case _0xae7a('0x12'):case _0xae7a('0x13'):_0x342353=null;_0x339497['qs']=_0x4b17a5;break;case _0xae7a('0x14'):case'PUT':if(_0x290a76['data7']){try{_0x342353=JSON[_0xae7a('0xf')](Mustache[_0xae7a('0x9')](_0x290a76[_0xae7a('0x15')],_0x4b17a5));_0x339497[_0xae7a('0x16')]=_0x342353;}catch(_0x4f7112){logger['error'](_0x4f7112['stack']);logger[_0xae7a('0x10')](_0xae7a('0x17'));}}else{_0x342353=_0x4b17a5;_0x339497[_0xae7a('0x16')]=_0x342353;}break;}logger['info'](util[_0xae7a('0x18')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x290a76['data1'],_0x290a76[_0xae7a('0xa')],JSON[_0xae7a('0x19')](_0x339497)));rp(_0x339497)[_0xae7a('0x1a')](function(_0x1e1e04){_0x342353=!_[_0xae7a('0x1b')](_0x342353)?_0xae7a('0x1c')+_0x342353:'';_0x38cf43=typeof _0x1e1e04['body']==='object'?JSON[_0xae7a('0x19')](_0x1e1e04[_0xae7a('0x16')]):_0x1e1e04[_0xae7a('0x16')];logger['info'](util[_0xae7a('0x18')](_0xae7a('0x1d'),_0x290a76[_0xae7a('0x7')],_0x290a76[_0xae7a('0xa')],_0x1e1e04[_0xae7a('0x1e')],_0x38cf43));})['catch'](function(_0x1b12d1){logger[_0xae7a('0x10')](util[_0xae7a('0x18')](_0xae7a('0x1f'),_0x290a76['data1'],_0x290a76[_0xae7a('0xa')],_0x1b12d1['statusCode'],_0x1b12d1[_0xae7a('0x20')],_0x1b12d1[_0xae7a('0x21')]));});}; \ No newline at end of file +var _0xa293=['catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','data1','toUpperCase','render','data2','data5','headers','error','stack','DELETE','POST','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','stringify','then','isNil',',\x20request\x20body:\x20','object','statusCode'];(function(_0x24005a,_0x50d6f8){var _0x46a0fd=function(_0x24a830){while(--_0x24a830){_0x24005a['push'](_0x24005a['shift']());}};_0x46a0fd(++_0x50d6f8);}(_0xa293,0x7c));var _0x3a29=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa293[_0x4cf98e];return _0x1623ac;};'use strict';var rp=require(_0x3a29('0x0'));var util=require(_0x3a29('0x1'));var _=require(_0x3a29('0x2'));var Mustache=require(_0x3a29('0x3'));var logger=require(_0x3a29('0x4'))('trigger');exports['exec']=function(_0x22be61,_0x2c37dd){var _0x4af031,_0x35491e;var _0x4d6b56={'method':_0x22be61[_0x3a29('0x5')][_0x3a29('0x6')](),'uri':Mustache[_0x3a29('0x7')](_0x22be61[_0x3a29('0x8')],_0x2c37dd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x22be61['data5'])==='number'&&parseInt(_0x22be61['data5'])>=0x1&&parseInt(_0x22be61['data5'])<=0xa?parseInt(_0x22be61[_0x3a29('0x9')])*0x3e8:0x5*0x3e8};try{_0x4d6b56[_0x3a29('0xa')]=_0x22be61['data6']?JSON['parse'](Mustache[_0x3a29('0x7')](_0x22be61['data6'],_0x2c37dd)):{};}catch(_0x33f487){logger[_0x3a29('0xb')](_0x33f487[_0x3a29('0xc')]);}switch(_0x22be61[_0x3a29('0x5')]['toUpperCase']()){case'GET':case _0x3a29('0xd'):_0x4af031=null;_0x4d6b56['qs']=_0x2c37dd;break;case _0x3a29('0xe'):case'PUT':if(_0x22be61[_0x3a29('0xf')]){try{_0x4af031=JSON['parse'](Mustache[_0x3a29('0x7')](_0x22be61['data7'],_0x2c37dd));_0x4d6b56['body']=_0x4af031;}catch(_0x3fb2df){logger[_0x3a29('0xb')](_0x3fb2df[_0x3a29('0xc')]);logger[_0x3a29('0xb')](_0x3a29('0x10'));}}else{_0x4af031=_0x2c37dd;_0x4d6b56[_0x3a29('0x11')]=_0x4af031;}break;}logger[_0x3a29('0x12')](util[_0x3a29('0x13')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x22be61[_0x3a29('0x5')],_0x22be61[_0x3a29('0x8')],JSON[_0x3a29('0x14')](_0x4d6b56)));rp(_0x4d6b56)[_0x3a29('0x15')](function(_0x2fd5d6){_0x4af031=!_[_0x3a29('0x16')](_0x4af031)?_0x3a29('0x17')+_0x4af031:'';_0x35491e=typeof _0x2fd5d6['body']===_0x3a29('0x18')?JSON['stringify'](_0x2fd5d6[_0x3a29('0x11')]):_0x2fd5d6[_0x3a29('0x11')];logger['info'](util[_0x3a29('0x13')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x22be61[_0x3a29('0x5')],_0x22be61[_0x3a29('0x8')],_0x2fd5d6[_0x3a29('0x19')],_0x35491e));})[_0x3a29('0x1a')](function(_0x1013b1){logger[_0x3a29('0xb')](util['format'](_0x3a29('0x1b'),_0x22be61[_0x3a29('0x5')],_0x22be61['data2'],_0x1013b1[_0x3a29('0x19')],_0x1013b1[_0x3a29('0x1c')],_0x1013b1[_0x3a29('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 7139deb..99b8a27 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 _0x45fd=['routing','error','message','catch','bluebird','../../config/logger','client','http','then','debug','rpc'];(function(_0x2866f7,_0x9f3f8e){var _0x460b08=function(_0x4b260e){while(--_0x4b260e){_0x2866f7['push'](_0x2866f7['shift']());}};_0x460b08(++_0x9f3f8e);}(_0x45fd,0x9e));var _0xd45f=function(_0x5c3ad2,_0x4e7b6e){_0x5c3ad2=_0x5c3ad2-0x0;var _0x200405=_0x45fd[_0x5c3ad2];return _0x200405;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xd45f('0x0'));var logger=require(_0xd45f('0x1'))('routing');var client=jayson[_0xd45f('0x2')][_0xd45f('0x3')]({'port':0x2329});client['Request']=function(_0x5df0f0,_0x2819a4){return new BPromise(function(_0x319a12,_0x440bf0){return client['request'](_0x5df0f0,_0x2819a4)[_0xd45f('0x4')](function(_0x4106b4){logger[_0xd45f('0x5')](_0xd45f('0x6'),_0xd45f('0x7'),_0x5df0f0,_0x2819a4,_0x4106b4);if(_0x4106b4[_0xd45f('0x8')]){logger[_0xd45f('0x8')](_0xd45f('0x6'),_0xd45f('0x7'),_0x5df0f0,_0x4106b4[_0xd45f('0x8')][_0xd45f('0x9')],_0x2819a4);return _0x440bf0(_0x4106b4[_0xd45f('0x8')][_0xd45f('0x9')]);}else{return _0x319a12(_0x4106b4['result']);}})[_0xd45f('0xa')](function(_0x323a18){logger[_0xd45f('0x8')](_0xd45f('0x6'),_0xd45f('0x7'),_0x5df0f0,_0x323a18,_0x2819a4);return _0x440bf0(_0x323a18);});});};module['exports']=client; \ No newline at end of file +var _0xa6b2=['http','Request','request','debug','rpc','error','message','catch','exports','jayson/promise','../../config/logger','routing','client'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xa6b2,0x100));var _0x2a6b=function(_0x483b23,_0x5c6757){_0x483b23=_0x483b23-0x0;var _0xdfed24=_0xa6b2[_0x483b23];return _0xdfed24;};'use strict';var jayson=require(_0x2a6b('0x0'));var BPromise=require('bluebird');var logger=require(_0x2a6b('0x1'))(_0x2a6b('0x2'));var client=jayson[_0x2a6b('0x3')][_0x2a6b('0x4')]({'port':0x2329});client[_0x2a6b('0x5')]=function(_0x3485d1,_0x3c1c69){return new BPromise(function(_0x396dea,_0xd1e3ad){return client[_0x2a6b('0x6')](_0x3485d1,_0x3c1c69)['then'](function(_0x2a7472){logger[_0x2a6b('0x7')](_0x2a6b('0x8'),'routing',_0x3485d1,_0x3c1c69,_0x2a7472);if(_0x2a7472[_0x2a6b('0x9')]){logger[_0x2a6b('0x9')](_0x2a6b('0x8'),_0x2a6b('0x2'),_0x3485d1,_0x2a7472[_0x2a6b('0x9')][_0x2a6b('0xa')],_0x3c1c69);return _0xd1e3ad(_0x2a7472['error'][_0x2a6b('0xa')]);}else{return _0x396dea(_0x2a7472['result']);}})[_0x2a6b('0xb')](function(_0x1fa2d0){logger[_0x2a6b('0x9')](_0x2a6b('0x8'),_0x2a6b('0x2'),_0x3485d1,_0x1fa2d0,_0x3c1c69);return _0xd1e3ad(_0x1fa2d0);});});};module[_0x2a6b('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index b0cabf1..4893eee 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 _0x8d5f=['then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/setting','../../config/logger','email','resolve'];(function(_0x9ace37,_0x4d1159){var _0x23ecc0=function(_0xda11a){while(--_0xda11a){_0x9ace37['push'](_0x9ace37['shift']());}};_0x23ecc0(++_0x4d1159);}(_0x8d5f,0x161));var _0xf8d5=function(_0x2ba740,_0x62a305){_0x2ba740=_0x2ba740-0x0;var _0x358bda=_0x8d5f[_0x2ba740];return _0x358bda;};'use strict';var server=require(_0xf8d5('0x0'));var Realtime=require(_0xf8d5('0x1'));var EmailChannel=require(_0xf8d5('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xf8d5('0x3'));var logger=require(_0xf8d5('0x4'))(_0xf8d5('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xf8d5('0x6')]()[_0xf8d5('0x7')](mailAccount[_0xf8d5('0x8')]())[_0xf8d5('0x7')](realtime[_0xf8d5('0x9')]())['then'](function(){email[_0xf8d5('0xa')](realtime[_0xf8d5('0xb')]);return realtime;});}function main(){return server[_0xf8d5('0xc')](realtime,email)[_0xf8d5('0x7')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0xf8d5('0x7')](function(_0x3fb6f4){return setInterval(initRealtime,_0x3fb6f4['loginMailFrequency']*0x3e8);})['catch'](function(_0x26590e){logger[_0xf8d5('0xd')](_0xf8d5('0xe'),_0x26590e);});}main(); \ No newline at end of file +var _0xa5a0=['./rpc/mailAccount','../../config/logger','resolve','getMailAccounts','then','initMailAccounts','listen','loginMailFrequency','catch','./server','./realtime'];(function(_0x54b6ec,_0x462988){var _0x19b90f=function(_0x50a1b3){while(--_0x50a1b3){_0x54b6ec['push'](_0x54b6ec['shift']());}};_0x19b90f(++_0x462988);}(_0xa5a0,0x195));var _0x0a5a=function(_0x429c17,_0xb5ed6b){_0x429c17=_0x429c17-0x0;var _0x220352=_0xa5a0[_0x429c17];return _0x220352;};'use strict';var server=require(_0x0a5a('0x0'));var Realtime=require(_0x0a5a('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x0a5a('0x2'));var setting=require('./rpc/setting');var logger=require(_0x0a5a('0x3'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0a5a('0x4')]()['then'](mailAccount[_0x0a5a('0x5')]())[_0x0a5a('0x6')](realtime[_0x0a5a('0x7')]())['then'](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x0a5a('0x8')](realtime,email)[_0x0a5a('0x6')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x0a5a('0x6')](function(_0x28bca6){return setInterval(initRealtime,_0x28bca6[_0x0a5a('0x9')]*0x3e8);})[_0x0a5a('0xa')](function(_0x3d98da){logger['error']('Email\x20service\x20initialization',_0x3d98da);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 0c7662d..a57d1c7 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 _0x3ddf=['defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','key','active','Imap','messageStatus','total','isNil','stringify','refresh','hasOwnProperty','service','provider','email','box','handleImapBox','bind','end','handleImapEnd','handleImapError','status','name','messages','handleImapEmail','info','firstName','lastName','then','Mail\x20accepted\x20from\x20routing','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','send','verifySmtp','Smtp','verify','verified','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis'];(function(_0x8b0f78,_0x11707c){var _0x43d7ef=function(_0x51a7bb){while(--_0x51a7bb){_0x8b0f78['push'](_0x8b0f78['shift']());}};_0x43d7ef(++_0x11707c);}(_0x3ddf,0x64));var _0xf3dd=function(_0xab4f66,_0x58b710){_0xab4f66=_0xab4f66-0x0;var _0x43cc05=_0x3ddf[_0xab4f66];return _0x43cc05;};'use strict';var _=require(_0xf3dd('0x0'));var moment=require(_0xf3dd('0x1'));var BPromise=require(_0xf3dd('0x2'));var md5=require(_0xf3dd('0x3'));var Redis=require(_0xf3dd('0x4'));var config=require(_0xf3dd('0x5'));var logger=require(_0xf3dd('0x6'))('email');config[_0xf3dd('0x7')]=_[_0xf3dd('0x8')](config[_0xf3dd('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xf3dd('0x9'))(new Redis(config[_0xf3dd('0x7')]));var EmailImap=require(_0xf3dd('0xa'));var EmailSmtp=require(_0xf3dd('0xb'));var mailAccount=require(_0xf3dd('0xc'));var md5Accounts={};function EmailChannel(_0x24076c){logger['info'](_0xf3dd('0xd'));this[_0xf3dd('0xe')]=_0x24076c['mailAccounts'];this[_0xf3dd('0xf')]={};this[_0xf3dd('0x10')]=new EmailSmtp();}EmailChannel[_0xf3dd('0x11')][_0xf3dd('0x12')]=function(_0x13721b){var _0x3ee7ce=this[_0xf3dd('0xe')][_0x13721b];var _0x5dc765={'id':_0x3ee7ce['id'],'name':_0x3ee7ce['name'],'key':_0x3ee7ce[_0xf3dd('0x13')],'active':_0x3ee7ce[_0xf3dd('0x14')],'Imap':{'status':_0x3ee7ce[_0xf3dd('0x15')]['status'],'messageStatus':_0x3ee7ce['Imap'][_0xf3dd('0x16')],'total':_0x3ee7ce[_0xf3dd('0x15')][_0xf3dd('0x17')]}};if(_[_0xf3dd('0x18')](md5Accounts[_0x13721b])){md5Accounts[_0x13721b]={};}var _0x44ffd6=md5(JSON[_0xf3dd('0x19')](_0x5dc765));if(md5Accounts[_0x13721b][_0xf3dd('0x3')]!==_0x44ffd6){md5Accounts[_0x13721b]['md5']=_0x44ffd6;io[_0xf3dd('0x12')]('mailAccount:update',_0x5dc765);}};EmailChannel[_0xf3dd('0x11')][_0xf3dd('0x1a')]=function(_0x2eb20a){for(var _0xe99024 in _0x2eb20a){if(_0x2eb20a[_0xf3dd('0x1b')](_0xe99024)){if(_0x2eb20a[_0xe99024][_0xf3dd('0x15')]&&_0x2eb20a[_0xe99024][_0xf3dd('0x14')]){var _0x370372=_0x2eb20a[_0xe99024][_0xf3dd('0x15')];if(!_0x370372[_0xf3dd('0x1c')]&&_0x2eb20a[_0xe99024][_0xf3dd('0x1d')]!=='custom')_0x370372[_0xf3dd('0x1c')]=_0x2eb20a[_0xe99024][_0xf3dd('0x1d')];if(!this[_0xf3dd('0xf')][_0xf3dd('0x1b')](_0x370372['id'])){this[_0xf3dd('0xf')][_0x370372['id']]=new EmailImap(_0x370372,_0x2eb20a[_0xe99024][_0xf3dd('0x1e')]);this[_0xf3dd('0xf')][_0x370372['id']]['on'](_0xf3dd('0x1f'),this[_0xf3dd('0x20')][_0xf3dd('0x21')](this,_0xe99024));this[_0xf3dd('0xf')][_0x370372['id']]['on'](_0xf3dd('0x1e'),this['handleImapEmail'][_0xf3dd('0x21')](this,_0xe99024));this['imapAccounts'][_0x370372['id']]['on'](_0xf3dd('0x22'),this[_0xf3dd('0x23')][_0xf3dd('0x21')](this,_0xe99024));this[_0xf3dd('0xf')][_0x370372['id']]['on']('error',this[_0xf3dd('0x24')]['bind'](this,_0xe99024));}}else{if(_[_0xf3dd('0x18')](this['mailAccounts'][_0xe99024][_0xf3dd('0x15')])){this[_0xf3dd('0xe')][_0xe99024][_0xf3dd('0x15')]={};}this[_0xf3dd('0xe')][_0xe99024]['Imap'][_0xf3dd('0x25')]='disabled';this['mailAccounts'][_0xe99024][_0xf3dd('0x15')][_0xf3dd('0x16')]='';this[_0xf3dd('0x12')](_0xe99024);}}}};EmailChannel[_0xf3dd('0x11')][_0xf3dd('0x20')]=function(_0x20340a,_0x18c6a2){if(this[_0xf3dd('0xe')][_0x20340a]){this[_0xf3dd('0xe')][_0x20340a][_0xf3dd('0x15')]['status']='connected';this[_0xf3dd('0xe')][_0x20340a][_0xf3dd('0x15')]['messageStatus']=_0x18c6a2[_0xf3dd('0x26')];if(_0x18c6a2[_0xf3dd('0x27')]){this[_0xf3dd('0xe')][_0x20340a][_0xf3dd('0x15')][_0xf3dd('0x17')]=_0x18c6a2[_0xf3dd('0x27')][_0xf3dd('0x17')];}return this[_0xf3dd('0x12')](_0x20340a);}};EmailChannel['prototype'][_0xf3dd('0x28')]=function(_0x52f32e,_0x2fc895){logger[_0xf3dd('0x29')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x2fc895[_0xf3dd('0x2a')],_0x2fc895[_0xf3dd('0x2b')],_0x2fc895['from'],_0x52f32e);if(this[_0xf3dd('0xe')][_0x52f32e]){return mailAccount['notify'](_0x52f32e,_0x2fc895)[_0xf3dd('0x2c')](function(_0x4eda0a){if(_0x4eda0a){logger[_0xf3dd('0x29')](_0xf3dd('0x2d'));}})['catch'](function(_0x4d19d1){logger[_0xf3dd('0x2e')](_0xf3dd('0x2f'),JSON['stringify'](_0x4d19d1));});}};EmailChannel['prototype'][_0xf3dd('0x23')]=function(_0x3ce122){if(this[_0xf3dd('0xe')][_0x3ce122]&&this[_0xf3dd('0xe')][_0x3ce122][_0xf3dd('0x15')]){if(this['imapAccounts'][this[_0xf3dd('0xe')][_0x3ce122][_0xf3dd('0x15')]['id']]){delete this[_0xf3dd('0xf')][this[_0xf3dd('0xe')][_0x3ce122][_0xf3dd('0x15')]['id']];}this['mailAccounts'][_0x3ce122]['Imap'][_0xf3dd('0x30')]=moment();this[_0xf3dd('0x12')](_0x3ce122);}};EmailChannel['prototype'][_0xf3dd('0x24')]=function(_0x4c19b9,_0x51cbe6){if(this[_0xf3dd('0xe')][_0x4c19b9]){this[_0xf3dd('0xe')][_0x4c19b9][_0xf3dd('0x15')][_0xf3dd('0x25')]=_0xf3dd('0x2e');this[_0xf3dd('0xe')][_0x4c19b9][_0xf3dd('0x15')]['messageStatus']=_0x51cbe6;return this[_0xf3dd('0x12')](_0x4c19b9);}};EmailChannel[_0xf3dd('0x11')]['sendMail']=function(_0x54aaa5,_0x474071){return this[_0xf3dd('0x10')][_0xf3dd('0x31')](_0x54aaa5,_0x474071);};EmailChannel[_0xf3dd('0x11')][_0xf3dd('0x32')]=function(_0x563cd5){var _0x16b5b1=this;if(this[_0xf3dd('0xe')][_0x563cd5['id']]){if(_[_0xf3dd('0x18')](this[_0xf3dd('0xe')][_0x563cd5['id']][_0xf3dd('0x33')])){this['mailAccounts'][_0x563cd5['id']][_0xf3dd('0x33')]={};}this[_0xf3dd('0xe')][_0x563cd5['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x59aca4,_0x448b06){return _0x16b5b1[_0xf3dd('0x10')][_0xf3dd('0x34')](_0x563cd5)[_0xf3dd('0x2c')](function(_0x1052e7){_0x16b5b1['mailAccounts'][_0x563cd5['id']][_0xf3dd('0x33')]['status']=_0xf3dd('0x35');_0x16b5b1[_0xf3dd('0xe')][_0x563cd5['id']]['Smtp'][_0xf3dd('0x16')]='';_0x16b5b1[_0xf3dd('0x12')](_0x563cd5['id']);_0x59aca4(_0x1052e7);})['catch'](function(_0x148911){_0x16b5b1[_0xf3dd('0xe')][_0x563cd5['id']][_0xf3dd('0x33')][_0xf3dd('0x25')]='error';_0x16b5b1[_0xf3dd('0xe')][_0x563cd5['id']][_0xf3dd('0x33')]['messageStatus']=_0x148911;_0x16b5b1[_0xf3dd('0x12')](_0x563cd5['id']);_0x448b06(_0x148911);});});}return this[_0xf3dd('0x10')]['verify'](_0x563cd5);};module['exports']=EmailChannel; \ No newline at end of file +var _0x2812=['exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','name','key','active','messageStatus','Imap','total','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','service','custom','provider','box','handleImapBox','handleImapEmail','bind','handleImapEnd','handleImapError','status','disabled','emit','connected','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','verifySmtp','Smtp','verify','verified'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x2812,0x1d9));var _0x2281=function(_0x462fe4,_0x394d3e){_0x462fe4=_0x462fe4-0x0;var _0x82b23a=_0x2812[_0x462fe4];return _0x82b23a;};'use strict';var _=require(_0x2281('0x0'));var moment=require(_0x2281('0x1'));var BPromise=require(_0x2281('0x2'));var md5=require(_0x2281('0x3'));var Redis=require(_0x2281('0x4'));var config=require(_0x2281('0x5'));var logger=require(_0x2281('0x6'))(_0x2281('0x7'));config[_0x2281('0x8')]=_[_0x2281('0x9')](config['redis'],{'host':_0x2281('0xa'),'port':0x18eb});var io=require(_0x2281('0xb'))(new Redis(config['redis']));var EmailImap=require(_0x2281('0xc'));var EmailSmtp=require(_0x2281('0xd'));var mailAccount=require(_0x2281('0xe'));var md5Accounts={};function EmailChannel(_0xc6b45){logger[_0x2281('0xf')](_0x2281('0x10'));this['mailAccounts']=_0xc6b45[_0x2281('0x11')];this[_0x2281('0x12')]={};this[_0x2281('0x13')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x27fa44){var _0x53abb3=this[_0x2281('0x11')][_0x27fa44];var _0x5b84ad={'id':_0x53abb3['id'],'name':_0x53abb3[_0x2281('0x14')],'key':_0x53abb3[_0x2281('0x15')],'active':_0x53abb3[_0x2281('0x16')],'Imap':{'status':_0x53abb3['Imap']['status'],'messageStatus':_0x53abb3['Imap'][_0x2281('0x17')],'total':_0x53abb3[_0x2281('0x18')][_0x2281('0x19')]}};if(_[_0x2281('0x1a')](md5Accounts[_0x27fa44])){md5Accounts[_0x27fa44]={};}var _0x12ee75=md5(JSON[_0x2281('0x1b')](_0x5b84ad));if(md5Accounts[_0x27fa44][_0x2281('0x3')]!==_0x12ee75){md5Accounts[_0x27fa44]['md5']=_0x12ee75;io['emit'](_0x2281('0x1c'),_0x5b84ad);}};EmailChannel[_0x2281('0x1d')][_0x2281('0x1e')]=function(_0x3763cf){for(var _0x5dc35c in _0x3763cf){if(_0x3763cf[_0x2281('0x1f')](_0x5dc35c)){if(_0x3763cf[_0x5dc35c]['Imap']&&_0x3763cf[_0x5dc35c][_0x2281('0x16')]){var _0x22e860=_0x3763cf[_0x5dc35c][_0x2281('0x18')];if(!_0x22e860[_0x2281('0x20')]&&_0x3763cf[_0x5dc35c]['provider']!==_0x2281('0x21'))_0x22e860[_0x2281('0x20')]=_0x3763cf[_0x5dc35c][_0x2281('0x22')];if(!this[_0x2281('0x12')][_0x2281('0x1f')](_0x22e860['id'])){this[_0x2281('0x12')][_0x22e860['id']]=new EmailImap(_0x22e860,_0x3763cf[_0x5dc35c]['email']);this[_0x2281('0x12')][_0x22e860['id']]['on'](_0x2281('0x23'),this[_0x2281('0x24')]['bind'](this,_0x5dc35c));this[_0x2281('0x12')][_0x22e860['id']]['on']('email',this[_0x2281('0x25')][_0x2281('0x26')](this,_0x5dc35c));this[_0x2281('0x12')][_0x22e860['id']]['on']('end',this[_0x2281('0x27')][_0x2281('0x26')](this,_0x5dc35c));this['imapAccounts'][_0x22e860['id']]['on']('error',this[_0x2281('0x28')][_0x2281('0x26')](this,_0x5dc35c));}}else{if(_[_0x2281('0x1a')](this['mailAccounts'][_0x5dc35c][_0x2281('0x18')])){this['mailAccounts'][_0x5dc35c][_0x2281('0x18')]={};}this[_0x2281('0x11')][_0x5dc35c]['Imap'][_0x2281('0x29')]=_0x2281('0x2a');this[_0x2281('0x11')][_0x5dc35c][_0x2281('0x18')][_0x2281('0x17')]='';this[_0x2281('0x2b')](_0x5dc35c);}}}};EmailChannel[_0x2281('0x1d')][_0x2281('0x24')]=function(_0x4aa5b9,_0x57615e){if(this['mailAccounts'][_0x4aa5b9]){this[_0x2281('0x11')][_0x4aa5b9][_0x2281('0x18')][_0x2281('0x29')]=_0x2281('0x2c');this[_0x2281('0x11')][_0x4aa5b9][_0x2281('0x18')][_0x2281('0x17')]=_0x57615e[_0x2281('0x14')];if(_0x57615e['messages']){this[_0x2281('0x11')][_0x4aa5b9][_0x2281('0x18')][_0x2281('0x19')]=_0x57615e['messages']['total'];}return this[_0x2281('0x2b')](_0x4aa5b9);}};EmailChannel['prototype'][_0x2281('0x25')]=function(_0x46b15e,_0x48012d){logger[_0x2281('0xf')](_0x2281('0x2d'),_0x48012d['firstName'],_0x48012d['lastName'],_0x48012d[_0x2281('0x2e')],_0x46b15e);if(this[_0x2281('0x11')][_0x46b15e]){return mailAccount[_0x2281('0x2f')](_0x46b15e,_0x48012d)[_0x2281('0x30')](function(_0x253b2f){if(_0x253b2f){logger[_0x2281('0xf')](_0x2281('0x31'));}})[_0x2281('0x32')](function(_0x32da51){logger[_0x2281('0x33')](_0x2281('0x34'),JSON[_0x2281('0x1b')](_0x32da51));});}};EmailChannel[_0x2281('0x1d')]['handleImapEnd']=function(_0x4cb49f){if(this[_0x2281('0x11')][_0x4cb49f]&&this[_0x2281('0x11')][_0x4cb49f]['Imap']){if(this[_0x2281('0x12')][this[_0x2281('0x11')][_0x4cb49f]['Imap']['id']]){delete this['imapAccounts'][this[_0x2281('0x11')][_0x4cb49f][_0x2281('0x18')]['id']];}this[_0x2281('0x11')][_0x4cb49f][_0x2281('0x18')]['lastSync']=moment();this[_0x2281('0x2b')](_0x4cb49f);}};EmailChannel[_0x2281('0x1d')]['handleImapError']=function(_0x2e66b0,_0x331d36){if(this[_0x2281('0x11')][_0x2e66b0]){this[_0x2281('0x11')][_0x2e66b0][_0x2281('0x18')][_0x2281('0x29')]='error';this[_0x2281('0x11')][_0x2e66b0]['Imap'][_0x2281('0x17')]=_0x331d36;return this['emit'](_0x2e66b0);}};EmailChannel[_0x2281('0x1d')][_0x2281('0x35')]=function(_0x1e9930,_0x1c165f){return this[_0x2281('0x13')]['send'](_0x1e9930,_0x1c165f);};EmailChannel[_0x2281('0x1d')][_0x2281('0x36')]=function(_0x1f5c16){var _0x1afc08=this;if(this[_0x2281('0x11')][_0x1f5c16['id']]){if(_['isNil'](this[_0x2281('0x11')][_0x1f5c16['id']]['Smtp'])){this[_0x2281('0x11')][_0x1f5c16['id']][_0x2281('0x37')]={};}this[_0x2281('0x11')][_0x1f5c16['id']][_0x2281('0x37')]['lastSync']=moment();return new BPromise(function(_0x12c369,_0x2952d5){return _0x1afc08[_0x2281('0x13')][_0x2281('0x38')](_0x1f5c16)[_0x2281('0x30')](function(_0x31deb2){_0x1afc08[_0x2281('0x11')][_0x1f5c16['id']]['Smtp'][_0x2281('0x29')]=_0x2281('0x39');_0x1afc08[_0x2281('0x11')][_0x1f5c16['id']][_0x2281('0x37')][_0x2281('0x17')]='';_0x1afc08[_0x2281('0x2b')](_0x1f5c16['id']);_0x12c369(_0x31deb2);})['catch'](function(_0x5e8f4a){_0x1afc08[_0x2281('0x11')][_0x1f5c16['id']]['Smtp']['status']=_0x2281('0x33');_0x1afc08[_0x2281('0x11')][_0x1f5c16['id']][_0x2281('0x37')][_0x2281('0x17')]=_0x5e8f4a;_0x1afc08['emit'](_0x1f5c16['id']);_0x2952d5(_0x5e8f4a);});});}return this['smtp'][_0x2281('0x38')](_0x1f5c16);};module[_0x2281('0x3a')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index f1afbc6..eeff066 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 _0x781d=['handleFetchError','handleCloseBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','parser','closeBox','handleEnd','textCode','hasOwnProperty','upperFirst','exports','lodash','util','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','account','getAccount','imap','ready','handleReady','once','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','xoauth2','generateXOAuth2Token','CloudProvider','data5','anonymous@xcally.com','handleOpenBox','emit','readUnseen','end','handleReadUnseen','length','fetch','message'];(function(_0x34b87f,_0x28aef2){var _0x449805=function(_0x3735b7){while(--_0x3735b7){_0x34b87f['push'](_0x34b87f['shift']());}};_0x449805(++_0x28aef2);}(_0x781d,0x14a));var _0xd781=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x781d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var Imap=require('imap');var simpleParser=require('mailparser')[_0xd781('0x2')];var Iconv=require(_0xd781('0x3'))[_0xd781('0x4')];var EventEmitter=require(_0xd781('0x5'))[_0xd781('0x6')];var utils=require(_0xd781('0x7'));var logger=require(_0xd781('0x8'))(_0xd781('0x9'));function EmailImap(_0x830b,_0x2f98ee){this['mailbox']=_0xd781('0xa');this[_0xd781('0xb')]=this[_0xd781('0xc')](_0x830b,_0x2f98ee);this[_0xd781('0xd')]=new Imap(this['account']);this[_0xd781('0xd')]['once'](_0xd781('0xe'),this[_0xd781('0xf')]['bind'](this));this[_0xd781('0xd')][_0xd781('0x10')]('end',this['handleEnd'][_0xd781('0x11')](this));this[_0xd781('0xd')]['on'](_0xd781('0x12'),this[_0xd781('0x13')][_0xd781('0x11')](this));this[_0xd781('0xd')][_0xd781('0x14')]();}util[_0xd781('0x15')](EmailImap,EventEmitter);EmailImap[_0xd781('0x16')][_0xd781('0xc')]=function(_0xd454e7,_0x587953){var _0x477bdc={'connTimeout':_0xd454e7[_0xd781('0x17')]?_0xd454e7['connTimeout']*0x3e8:0x2710,'authTimeout':_0xd454e7[_0xd781('0x18')]?_0xd454e7['authTimeout']*0x3e8:0x1388};if(_[_0xd781('0x19')](_0xd454e7[_0xd781('0x1a')])){if(_0xd454e7[_0xd781('0x1b')]){_0x477bdc[_0xd781('0x1c')]=_0xd454e7[_0xd781('0x1c')];_0x477bdc[_0xd781('0x1d')]=_0xd454e7[_0xd781('0x1d')];}_0x477bdc['host']=_0xd454e7[_0xd781('0x1e')];_0x477bdc[_0xd781('0x1f')]=_0xd454e7[_0xd781('0x1f')]||0x3e1;if(_0xd454e7[_0xd781('0x20')]){_0x477bdc[_0xd781('0x20')]=!![];}else{_0x477bdc[_0xd781('0x20')]=![];_0x477bdc[_0xd781('0x21')]=_0xd781('0x22');}}else{if(_0xd454e7['modernAuthentication']){_0x477bdc[_0xd781('0x23')]=utils[_0xd781('0x24')](_0xd454e7[_0xd781('0x25')][_0xd781('0x26')],_0xd454e7[_0xd781('0x1c')]);_0x477bdc[_0xd781('0x1c')]=_0xd454e7[_0xd781('0x1c')];}else{_0x477bdc['user']=_0xd454e7[_0xd781('0x1c')];_0x477bdc['password']=_0xd454e7['password'];}_0x477bdc[_0xd781('0x1e')]=utils['getHost'](_0xd454e7[_0xd781('0x1a')]);_0x477bdc[_0xd781('0x1f')]=0x3e1;_0x477bdc[_0xd781('0x20')]=!![];}_0x477bdc[_0xd781('0x9')]=_0x587953||_0xd454e7[_0xd781('0x1c')]||_0xd781('0x27');return _0x477bdc;};EmailImap[_0xd781('0x16')][_0xd781('0xf')]=function(){this[_0xd781('0xd')]['openBox'](this['mailbox'],![],this[_0xd781('0x28')][_0xd781('0x11')](this));};EmailImap[_0xd781('0x16')]['handleOpenBox']=function(_0xa1349e,_0x5a431b){if(_0xa1349e){this['handleError'](_0xa1349e,!![]);}else{this[_0xd781('0x29')]('box',_0x5a431b);this[_0xd781('0x2a')]();}};EmailImap[_0xd781('0x16')]['handleCloseBox']=function(_0x5b6b9d){if(_0x5b6b9d){this[_0xd781('0x13')](_0x5b6b9d,!![]);}else{this['imap'][_0xd781('0x2b')]();}};EmailImap['prototype'][_0xd781('0x2a')]=function(){this[_0xd781('0xd')]['search'](['UNSEEN'],this[_0xd781('0x2c')][_0xd781('0x11')](this));};EmailImap[_0xd781('0x16')]['handleReadUnseen']=function(_0x5291f5,_0x360f72){if(_0x5291f5){this[_0xd781('0x13')](_0x5291f5,!![]);}else{if(_0x360f72[_0xd781('0x2d')]){try{var _0x5bcd40=this['imap'][_0xd781('0x2e')](_0x360f72,{'bodies':'','markSeen':!![]});_0x5bcd40['on'](_0xd781('0x2f'),this['handleFetchMessage'][_0xd781('0x11')](this));_0x5bcd40[_0xd781('0x10')]('error',this[_0xd781('0x30')][_0xd781('0x11')](this));_0x5bcd40[_0xd781('0x10')](_0xd781('0x2b'),this['handleFetchEnd'][_0xd781('0x11')](this));}catch(_0x13d59f){logger[_0xd781('0x12')](_0x13d59f);}}else{this[_0xd781('0xd')]['closeBox'](!![],this[_0xd781('0x31')][_0xd781('0x11')](this));}}};EmailImap['prototype'][_0xd781('0x32')]=function(_0x51d0b7){_0x51d0b7['on'](_0xd781('0x33'),this[_0xd781('0x34')]['bind'](this));_0x51d0b7[_0xd781('0x10')](_0xd781('0x35'),this['handleMessageAttributes'][_0xd781('0x11')](this));_0x51d0b7['once'](_0xd781('0x2b'),this[_0xd781('0x36')]['bind'](this));};EmailImap[_0xd781('0x16')][_0xd781('0x34')]=function(_0x5651de){simpleParser(_0x5651de,{'Iconv':Iconv},this[_0xd781('0x37')][_0xd781('0x11')](this));};EmailImap[_0xd781('0x16')]['handleMessageAttributes']=function(){};EmailImap[_0xd781('0x16')][_0xd781('0x36')]=function(){};EmailImap[_0xd781('0x16')][_0xd781('0x37')]=function(_0x2e8218,_0x282d30){if(_0x2e8218){logger[_0xd781('0x12')](_0x2e8218);}else{var _0x140567=this;utils[_0xd781('0x38')](this['account'],_0x282d30,function(_0x2a60d6){_0x140567['emit'](_0xd781('0x9'),_0x2a60d6);});}};EmailImap[_0xd781('0x16')]['handleFetchEnd']=function(){this[_0xd781('0xd')][_0xd781('0x39')](!![],this[_0xd781('0x31')][_0xd781('0x11')](this));};EmailImap['prototype'][_0xd781('0x30')]=function(_0x515357){this[_0xd781('0x13')](_0x515357);this[_0xd781('0xd')]['closeBox'](!![],this['handleCloseBox'][_0xd781('0x11')](this));};EmailImap[_0xd781('0x16')][_0xd781('0x3a')]=function(){this[_0xd781('0x29')]('end');};EmailImap[_0xd781('0x16')][_0xd781('0x13')]=function(_0x4f35b6,_0x4c9f47){logger[_0xd781('0x12')](_0xd781('0x13'),this[_0xd781('0xb')]['email'],JSON['stringify'](_0x4f35b6));var _0x46828e='';if(_0x4f35b6){if(_0x4f35b6[_0xd781('0x3b')]){_0x46828e=_0x4f35b6[_0xd781('0x3b')];}else{for(var _0x411b63 in _0x4f35b6){if(_0x4f35b6[_0xd781('0x3c')](_0x411b63)){_0x46828e+=_[_0xd781('0x3d')](_0x411b63)+':\x20'+_0x4f35b6[_0x411b63]+'\x0a';}}}}if(_0x4c9f47){this['imap']['end']();}else{this[_0xd781('0x29')](_0xd781('0x12'),_0x46828e);this[_0xd781('0x29')](_0xd781('0x2b'));}};module[_0xd781('0x3e')]=EmailImap; \ No newline at end of file +var _0xb016=['isNil','service','authentication','user','password','host','port','tls','autotls','required','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','getHost','anonymous@xcally.com','openBox','mailbox','handleOpenBox','handleError','emit','box','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','stringify','textCode','lodash','util','simpleParser','Iconv','events','EventEmitter','./utils','email','account','getAccount','imap','once','ready','handleReady','bind','end','handleEnd','error','inherits','prototype','connTimeout'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xb016,0x159));var _0x6b01=function(_0x1a9349,_0x57632e){_0x1a9349=_0x1a9349-0x0;var _0x4d60bb=_0xb016[_0x1a9349];return _0x4d60bb;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var Imap=require('imap');var simpleParser=require('mailparser')[_0x6b01('0x2')];var Iconv=require('iconv')[_0x6b01('0x3')];var EventEmitter=require(_0x6b01('0x4'))[_0x6b01('0x5')];var utils=require(_0x6b01('0x6'));var logger=require('../../../config/logger')(_0x6b01('0x7'));function EmailImap(_0x65407a,_0x192b2d){this['mailbox']='INBOX';this[_0x6b01('0x8')]=this[_0x6b01('0x9')](_0x65407a,_0x192b2d);this['imap']=new Imap(this['account']);this[_0x6b01('0xa')][_0x6b01('0xb')](_0x6b01('0xc'),this[_0x6b01('0xd')][_0x6b01('0xe')](this));this['imap']['once'](_0x6b01('0xf'),this[_0x6b01('0x10')][_0x6b01('0xe')](this));this['imap']['on'](_0x6b01('0x11'),this['handleError']['bind'](this));this[_0x6b01('0xa')]['connect']();}util[_0x6b01('0x12')](EmailImap,EventEmitter);EmailImap[_0x6b01('0x13')]['getAccount']=function(_0x2c305e,_0x4ea5fa){var _0x50d778={'connTimeout':_0x2c305e['connTimeout']?_0x2c305e[_0x6b01('0x14')]*0x3e8:0x2710,'authTimeout':_0x2c305e['authTimeout']?_0x2c305e['authTimeout']*0x3e8:0x1388};if(_[_0x6b01('0x15')](_0x2c305e[_0x6b01('0x16')])){if(_0x2c305e[_0x6b01('0x17')]){_0x50d778[_0x6b01('0x18')]=_0x2c305e[_0x6b01('0x18')];_0x50d778[_0x6b01('0x19')]=_0x2c305e[_0x6b01('0x19')];}_0x50d778[_0x6b01('0x1a')]=_0x2c305e[_0x6b01('0x1a')];_0x50d778[_0x6b01('0x1b')]=_0x2c305e[_0x6b01('0x1b')]||0x3e1;if(_0x2c305e['tls']){_0x50d778[_0x6b01('0x1c')]=!![];}else{_0x50d778[_0x6b01('0x1c')]=![];_0x50d778[_0x6b01('0x1d')]=_0x6b01('0x1e');}}else{if(_0x2c305e[_0x6b01('0x1f')]){_0x50d778[_0x6b01('0x20')]=utils[_0x6b01('0x21')](_0x2c305e[_0x6b01('0x22')]['data5'],_0x2c305e[_0x6b01('0x18')]);_0x50d778[_0x6b01('0x18')]=_0x2c305e[_0x6b01('0x18')];}else{_0x50d778[_0x6b01('0x18')]=_0x2c305e[_0x6b01('0x18')];_0x50d778[_0x6b01('0x19')]=_0x2c305e[_0x6b01('0x19')];}_0x50d778['host']=utils[_0x6b01('0x23')](_0x2c305e[_0x6b01('0x16')]);_0x50d778[_0x6b01('0x1b')]=0x3e1;_0x50d778['tls']=!![];}_0x50d778[_0x6b01('0x7')]=_0x4ea5fa||_0x2c305e[_0x6b01('0x18')]||_0x6b01('0x24');return _0x50d778;};EmailImap[_0x6b01('0x13')][_0x6b01('0xd')]=function(){this[_0x6b01('0xa')][_0x6b01('0x25')](this[_0x6b01('0x26')],![],this[_0x6b01('0x27')][_0x6b01('0xe')](this));};EmailImap[_0x6b01('0x13')][_0x6b01('0x27')]=function(_0x154dfc,_0x55ca4b){if(_0x154dfc){this[_0x6b01('0x28')](_0x154dfc,!![]);}else{this[_0x6b01('0x29')](_0x6b01('0x2a'),_0x55ca4b);this[_0x6b01('0x2b')]();}};EmailImap[_0x6b01('0x13')]['handleCloseBox']=function(_0x54f030){if(_0x54f030){this[_0x6b01('0x28')](_0x54f030,!![]);}else{this[_0x6b01('0xa')][_0x6b01('0xf')]();}};EmailImap[_0x6b01('0x13')][_0x6b01('0x2b')]=function(){this[_0x6b01('0xa')]['search']([_0x6b01('0x2c')],this['handleReadUnseen'][_0x6b01('0xe')](this));};EmailImap['prototype'][_0x6b01('0x2d')]=function(_0xa6b2b6,_0x473201){if(_0xa6b2b6){this[_0x6b01('0x28')](_0xa6b2b6,!![]);}else{if(_0x473201[_0x6b01('0x2e')]){try{var _0x54575c=this[_0x6b01('0xa')][_0x6b01('0x2f')](_0x473201,{'bodies':'','markSeen':!![]});_0x54575c['on'](_0x6b01('0x30'),this['handleFetchMessage']['bind'](this));_0x54575c[_0x6b01('0xb')]('error',this[_0x6b01('0x31')][_0x6b01('0xe')](this));_0x54575c[_0x6b01('0xb')]('end',this[_0x6b01('0x32')][_0x6b01('0xe')](this));}catch(_0x186a6d){logger['error'](_0x186a6d);}}else{this[_0x6b01('0xa')][_0x6b01('0x33')](!![],this[_0x6b01('0x34')][_0x6b01('0xe')](this));}}};EmailImap[_0x6b01('0x13')]['handleFetchMessage']=function(_0xa041ea){_0xa041ea['on'](_0x6b01('0x35'),this[_0x6b01('0x36')][_0x6b01('0xe')](this));_0xa041ea[_0x6b01('0xb')](_0x6b01('0x37'),this[_0x6b01('0x38')][_0x6b01('0xe')](this));_0xa041ea['once'](_0x6b01('0xf'),this['handleMessageEnd'][_0x6b01('0xe')](this));};EmailImap[_0x6b01('0x13')][_0x6b01('0x36')]=function(_0x318b8b){simpleParser(_0x318b8b,{'Iconv':Iconv},this[_0x6b01('0x39')][_0x6b01('0xe')](this));};EmailImap[_0x6b01('0x13')]['handleMessageAttributes']=function(){};EmailImap[_0x6b01('0x13')][_0x6b01('0x3a')]=function(){};EmailImap[_0x6b01('0x13')][_0x6b01('0x39')]=function(_0x1ca3aa,_0x2c4205){if(_0x1ca3aa){logger[_0x6b01('0x11')](_0x1ca3aa);}else{var _0x44bf46=this;utils['parser'](this[_0x6b01('0x8')],_0x2c4205,function(_0x55907f){_0x44bf46[_0x6b01('0x29')](_0x6b01('0x7'),_0x55907f);});}};EmailImap['prototype'][_0x6b01('0x32')]=function(){this[_0x6b01('0xa')][_0x6b01('0x33')](!![],this[_0x6b01('0x34')][_0x6b01('0xe')](this));};EmailImap[_0x6b01('0x13')][_0x6b01('0x31')]=function(_0x93737a){this[_0x6b01('0x28')](_0x93737a);this[_0x6b01('0xa')]['closeBox'](!![],this[_0x6b01('0x34')][_0x6b01('0xe')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x6b01('0x29')](_0x6b01('0xf'));};EmailImap['prototype'][_0x6b01('0x28')]=function(_0x3f9e46,_0x55bf71){logger[_0x6b01('0x11')]('handleError',this[_0x6b01('0x8')][_0x6b01('0x7')],JSON[_0x6b01('0x3b')](_0x3f9e46));var _0x50b13d='';if(_0x3f9e46){if(_0x3f9e46[_0x6b01('0x3c')]){_0x50b13d=_0x3f9e46[_0x6b01('0x3c')];}else{for(var _0x52cc57 in _0x3f9e46){if(_0x3f9e46['hasOwnProperty'](_0x52cc57)){_0x50b13d+=_['upperFirst'](_0x52cc57)+':\x20'+_0x3f9e46[_0x52cc57]+'\x0a';}}}}if(_0x55bf71){this[_0x6b01('0xa')][_0x6b01('0xf')]();}else{this[_0x6b01('0x29')](_0x6b01('0x11'),_0x50b13d);this[_0x6b01('0x29')](_0x6b01('0xf'));}};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 dd5ae0c..55a2279 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 _0xca2d=['compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','use'];(function(_0x3cc398,_0x763067){var _0xdea7b6=function(_0x4e427c){while(--_0x4e427c){_0x3cc398['push'](_0x3cc398['shift']());}};_0xdea7b6(++_0x763067);}(_0xca2d,0xf8));var _0xdca2=function(_0x5936ad,_0x199c60){_0x5936ad=_0x5936ad-0x0;var _0x26bed2=_0xca2d[_0x5936ad];return _0x26bed2;};'use strict';var nodemailer=require(_0xdca2('0x0'));var inlineBase64=require(_0xdca2('0x1'));function EmailSmtp(){}EmailSmtp[_0xdca2('0x2')]['send']=function(_0x581fa1,_0x4be567){return new Promise(function(_0x2230fe,_0x18e54e){var _0xb2ad41=nodemailer[_0xdca2('0x3')](_0x581fa1);_0xb2ad41[_0xdca2('0x4')](_0xdca2('0x5'),inlineBase64());_0xb2ad41[_0xdca2('0x6')](_0x4be567,function(_0x111eca,_0x5b8388){if(_0x111eca){_0x18e54e(_0x111eca[_0xdca2('0x7')]());}else{_0x2230fe(_0x5b8388);}});});};EmailSmtp[_0xdca2('0x2')][_0xdca2('0x8')]=function(_0x4b036b){return new Promise(function(_0x5920a5,_0x2d56d8){var _0x899403=nodemailer[_0xdca2('0x3')](_0x4b036b);_0x899403[_0xdca2('0x8')](function(_0x312c78,_0x49ad86){if(_0x312c78){_0x2d56d8(_0x312c78[_0xdca2('0x7')]());}else{if(_0x49ad86){_0x5920a5(_0x49ad86);}else{_0x2d56d8(_0xdca2('0x9'));}}});});};module[_0xdca2('0xa')]=EmailSmtp; \ No newline at end of file +var _0xea35=['Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','use','compile','sendMail','toString','verify','createTransport'];(function(_0x29fba8,_0x2b16f2){var _0x42f260=function(_0x2800a5){while(--_0x2800a5){_0x29fba8['push'](_0x29fba8['shift']());}};_0x42f260(++_0x2b16f2);}(_0xea35,0x86));var _0x5ea3=function(_0x25439d,_0x443288){_0x25439d=_0x25439d-0x0;var _0x363584=_0xea35[_0x25439d];return _0x363584;};'use strict';var nodemailer=require(_0x5ea3('0x0'));var inlineBase64=require(_0x5ea3('0x1'));function EmailSmtp(){}EmailSmtp[_0x5ea3('0x2')][_0x5ea3('0x3')]=function(_0x2eb501,_0x6de4d5){return new Promise(function(_0x8afef5,_0x4f0788){var _0x12398a=nodemailer['createTransport'](_0x2eb501);_0x12398a[_0x5ea3('0x4')](_0x5ea3('0x5'),inlineBase64());_0x12398a[_0x5ea3('0x6')](_0x6de4d5,function(_0x5969e1,_0x1efb66){if(_0x5969e1){_0x4f0788(_0x5969e1[_0x5ea3('0x7')]());}else{_0x8afef5(_0x1efb66);}});});};EmailSmtp['prototype'][_0x5ea3('0x8')]=function(_0x3042d3){return new Promise(function(_0x17d8eb,_0x30861c){var _0x499562=nodemailer[_0x5ea3('0x9')](_0x3042d3);_0x499562[_0x5ea3('0x8')](function(_0x415083,_0xe66665){if(_0x415083){_0x30861c(_0x415083['toString']());}else{if(_0xe66665){_0x17d8eb(_0xe66665);}else{_0x30861c(_0x5ea3('0xa'));}}});});};module[_0x5ea3('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 1beb91e..2eca8fc 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 _0x3220=['X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','parseBuffer','BodyHTML','

Empty\x20message

','Attachments','Title','Data','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','127.0.0.1','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','substring','indexOf','length','slice','Anonymous','split','pop','isEmpty','test','html','replace','attachments','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x2969d1[_0x0322('0x12')](0x0,-0x1)['join']('\x20'):_0x32bdb8['name'];}return _0x0322('0x13');}function getLastName(_0x315ac8){var _0x50cf58=_['head'](_0x315ac8[_0x0322('0x8')]);if(_0x50cf58&&_0x50cf58[_0x0322('0xe')]){var _0x180916=_0x50cf58[_0x0322('0xe')][_0x0322('0x14')](/\s+/);return _0x180916[_0x0322('0x11')]>0x1?_0x180916[_0x0322('0x15')]():'';}return'';}function getMails(_0x30a191,_0x32377a){var _0x4b5454='';for(var _0x1cf612=0x0;_0x1cf612<_0x32377a['value'][_0x0322('0x11')];_0x1cf612+=0x1){if(_0x32377a[_0x0322('0x8')][_0x1cf612][_0x0322('0x9')]!==_0x30a191){if(!_[_0x0322('0x16')](_0x4b5454)){_0x4b5454+=',';}_0x4b5454+=_0x32377a[_0x0322('0x8')][_0x1cf612][_0x0322('0xe')]||_0x32377a[_0x0322('0x8')][_0x1cf612][_0x0322('0x9')]||'';_0x4b5454+='\x20<';_0x4b5454+=_0x32377a[_0x0322('0x8')][_0x1cf612][_0x0322('0x9')]?_0x32377a[_0x0322('0x8')][_0x1cf612]['address']:_0x0322('0xa')+random['generate'](0x6)+_0x0322('0xc');_0x4b5454+='>';}}return _0x4b5454;}function parseEmail(_0x1f0449,_0x256d00,_0x3f1d28){if(_0x256d00['html']){var _0x173a80=/)<[^<]*)*<\/script>/gi;while(_0x173a80[_0x0322('0x17')](_0x256d00[_0x0322('0x18')])){_0x256d00[_0x0322('0x18')]=_0x256d00[_0x0322('0x18')][_0x0322('0x19')](_0x173a80,'');}if(_0x256d00[_0x0322('0x18')]['includes']('{_0x48c55b['push'](_0x479de2[_0x0322('0x1b')]);});var _0xf35e7f=/]+>/g;var _0x1d5d76=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3398d1=_0x256d00[_0x0322('0x18')]['replace'](_0x1d5d76,_0x0322('0x1c'));var _0x3e33ef=_0x3398d1[_0x0322('0x19')](_0xf35e7f,_0x0322('0x1d'));for(let _0x4e92b1=0x0;_0x4e92b1<_0x48c55b[_0x0322('0x11')];_0x4e92b1++){var _0x1d3927=_0x3e33ef['replace'](_0x0322('0x1d'),_0x0322('0x1e')+_0x48c55b[_0x4e92b1]+_0x0322('0x1f'));_0x3e33ef=_0x1d3927;}_0x256d00[_0x0322('0x18')]=_0x3e33ef;}_0x3f1d28['body']=_0x256d00[_0x0322('0x18')];}else{_0x3f1d28[_0x0322('0x20')]=_0x256d00[_0x0322('0x21')];}if(_0x3f1d28[_0x0322('0x20')]){_0x3f1d28['body']=_0x3f1d28[_0x0322('0x20')]['replace'](/0x0){var _0x4e7430=[_0x0322('0x30'),_0x0322('0x31'),_0x0322('0x32')];for(var _0x5183ad=0x0;_0x5183ad<_0x256d00[_0x0322('0x2f')][_0x0322('0x11')];_0x5183ad++){var _0x503bec=_[_0x0322('0x10')](_0x4e7430,_0x256d00[_0x0322('0x2f')][_0x5183ad][_0x0322('0x33')]);if(_0x503bec>=0x0){_0x3f1d28[_0x0322('0x34')]=!![];}}}return _0x3f1d28;}exports[_0x0322('0x35')]=function(_0x3324cc,_0x363c3c,_0x413b0d){var _0x33a568={'from':getAddress(_0x363c3c[_0x0322('0x36')]),'firstName':getFirstName(_0x363c3c['from']),'lastName':getLastName(_0x363c3c[_0x0322('0x36')]),'mapKey':_0x0322('0x6'),'message':{'from':getMails(_0x3324cc['email'],_0x363c3c['from']),'to':_0x3324cc[_0x0322('0x6')],'cc':'','subject':_0x363c3c[_0x0322('0x37')]||'','messageId':_0x363c3c[_0x0322('0x38')],'inReplyTo':_0x363c3c[_0x0322('0x39')],'sentAt':moment(_0x363c3c[_0x0322('0x3a')])[_0x0322('0x3b')](_0x0322('0x3c')),'attach':![],'attachments':[]}};if(!_0x363c3c[_0x0322('0x18')]&&!_0x363c3c['textAsHtml']){var _0x4dff06=_[_0x0322('0x3d')](_0x363c3c[_0x0322('0x1a')],{'contentType':_0x0322('0x3e')});if(_0x4dff06[_0x0322('0x11')]){logger[_0x0322('0x3f')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x363c3c[_0x0322('0x38')]));tnef[_0x0322('0x40')](_['first'](_0x4dff06)['content'],function(_0x5b613b,_0x1e777b){if(_0x1e777b){_0x363c3c[_0x0322('0x18')]=_0x1e777b[_0x0322('0x41')]||_0x0322('0x42');if(_0x1e777b[_0x0322('0x43')]){for(var _0x477046=0x0;_0x477046<_0x1e777b[_0x0322('0x43')][_0x0322('0x11')];_0x477046++){var _0x1bfa63=_0x1e777b[_0x0322('0x43')][_0x477046];_0x33a568[_0x0322('0x23')][_0x0322('0x1a')]['push']({'filename':_0x1bfa63[_0x0322('0x44')],'content':Buffer[_0x0322('0x36')](_0x1bfa63[_0x0322('0x45')])});}}}_0x413b0d(parseEmail(_0x3324cc,_0x363c3c,_0x33a568));});}else{_0x363c3c[_0x0322('0x18')]='

Empty\x20message

';_0x413b0d(parseEmail(_0x3324cc,_0x363c3c,_0x33a568));}}else{_0x413b0d(parseEmail(_0x3324cc,_0x363c3c,_0x33a568));}};exports['getHost']=function(_0x17ce58){switch(_0x17ce58){case _0x0322('0x46'):return _0x0322('0x47');case _0x0322('0x48'):return _0x0322('0x49');case _0x0322('0x4a'):return'imap-mail.outlook.com';case _0x0322('0x4b'):return'outlook.office365.com';}return _0x0322('0x4c');};exports[_0x0322('0x4d')]=function(_0x408a3d,_0x53326f){var _0x484be3=['user='+(_0x53326f||''),_0x0322('0x4e')+_0x408a3d,'',''];return Buffer[_0x0322('0x36')](_0x484be3[_0x0322('0x2b')](''),_0x0322('0x4f'))[_0x0322('0x50')](_0x0322('0x51'));}; \ No newline at end of file +var _0xe20b=['now','join','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','isAutoreply','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','Title','

Empty\x20message

','getHost','gmail','imap.gmail.com','imap-mail.outlook.com','outlook365','outlook.office365.com','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','../../../config/logger','email','../../../config/environment','address','anonymous','@xcally.com','head','name','substring','indexOf','length','Anonymous','value','isEmpty','generate','html','test','replace','includes','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x29bbfb['slice'](0x0,-0x1)['join']('\x20'):_0x17e033[_0xbe20('0xa')];}return _0xbe20('0xe');}function getLastName(_0x8b3a6b){var _0x423945=_[_0xbe20('0x9')](_0x8b3a6b[_0xbe20('0xf')]);if(_0x423945&&_0x423945[_0xbe20('0xa')]){var _0x11aab2=_0x423945[_0xbe20('0xa')]['split'](/\s+/);return _0x11aab2[_0xbe20('0xd')]>0x1?_0x11aab2['pop']():'';}return'';}function getMails(_0x430d50,_0x41ed43){var _0x596ac1='';for(var _0xb55720=0x0;_0xb55720<_0x41ed43['value'][_0xbe20('0xd')];_0xb55720+=0x1){if(_0x41ed43[_0xbe20('0xf')][_0xb55720]['address']!==_0x430d50){if(!_[_0xbe20('0x10')](_0x596ac1)){_0x596ac1+=',';}_0x596ac1+=_0x41ed43[_0xbe20('0xf')][_0xb55720]['name']||_0x41ed43[_0xbe20('0xf')][_0xb55720][_0xbe20('0x6')]||'';_0x596ac1+='\x20<';_0x596ac1+=_0x41ed43[_0xbe20('0xf')][_0xb55720]['address']?_0x41ed43['value'][_0xb55720]['address']:_0xbe20('0x7')+random[_0xbe20('0x11')](0x6)+_0xbe20('0x8');_0x596ac1+='>';}}return _0x596ac1;}function parseEmail(_0x1bffb3,_0x561692,_0x4d1c31){if(_0x561692[_0xbe20('0x12')]){var _0x524578=/)<[^<]*)*<\/script>/gi;while(_0x524578[_0xbe20('0x13')](_0x561692[_0xbe20('0x12')])){_0x561692[_0xbe20('0x12')]=_0x561692['html'][_0xbe20('0x14')](_0x524578,'');}if(_0x561692['html'][_0xbe20('0x15')](_0xbe20('0x16'))){var _0x30bccc=[];_0x561692['attachments'][_0xbe20('0x17')](_0xa391a1=>{_0x30bccc[_0xbe20('0x18')](_0xa391a1[_0xbe20('0x19')]);});var _0x3c6881=/]+>/g;var _0x2a8c9c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x20f8ce=_0x561692['html']['replace'](_0x2a8c9c,_0xbe20('0x1a'));var _0xd12fd8=_0x20f8ce[_0xbe20('0x14')](_0x3c6881,_0xbe20('0x1b'));for(let _0xb3b62c=0x0;_0xb3b62c<_0x30bccc[_0xbe20('0xd')];_0xb3b62c++){var _0x379591=_0xd12fd8[_0xbe20('0x14')]('_IMG',_0xbe20('0x1c')+_0x30bccc[_0xb3b62c]+'\x20]');_0xd12fd8=_0x379591;}_0x561692['html']=_0xd12fd8;}_0x4d1c31[_0xbe20('0x1d')]=_0x561692[_0xbe20('0x12')];}else{_0x4d1c31[_0xbe20('0x1d')]=_0x561692[_0xbe20('0x1e')];}if(_0x4d1c31[_0xbe20('0x1d')]){_0x4d1c31['body']=_0x4d1c31['body'][_0xbe20('0x14')](/0x0){var _0x285dc8=[_0xbe20('0x30'),_0xbe20('0x31'),_0xbe20('0x32')];for(var _0x188d4b=0x0;_0x188d4b<_0x561692['headerLines'][_0xbe20('0xd')];_0x188d4b++){var _0x303bb5=_[_0xbe20('0xc')](_0x285dc8,_0x561692[_0xbe20('0x2f')][_0x188d4b]['line']);if(_0x303bb5>=0x0){_0x4d1c31[_0xbe20('0x33')]=!![];}}}return _0x4d1c31;}exports[_0xbe20('0x34')]=function(_0x4c3cae,_0x12e4bf,_0x4a22c1){var _0x1a019c={'from':getAddress(_0x12e4bf[_0xbe20('0x35')]),'firstName':getFirstName(_0x12e4bf[_0xbe20('0x35')]),'lastName':getLastName(_0x12e4bf[_0xbe20('0x35')]),'mapKey':_0xbe20('0x4'),'message':{'from':getMails(_0x4c3cae['email'],_0x12e4bf[_0xbe20('0x35')]),'to':_0x4c3cae[_0xbe20('0x4')],'cc':'','subject':_0x12e4bf[_0xbe20('0x36')]||'','messageId':_0x12e4bf[_0xbe20('0x37')],'inReplyTo':_0x12e4bf[_0xbe20('0x38')],'sentAt':moment(_0x12e4bf[_0xbe20('0x39')])[_0xbe20('0x26')](_0xbe20('0x3a')),'attach':![],'attachments':[]}};if(!_0x12e4bf[_0xbe20('0x12')]&&!_0x12e4bf[_0xbe20('0x1e')]){var _0x5ec178=_[_0xbe20('0x3b')](_0x12e4bf[_0xbe20('0x22')],{'contentType':_0xbe20('0x3c')});if(_0x5ec178['length']){logger[_0xbe20('0x3d')](util[_0xbe20('0x26')](_0xbe20('0x3e'),_0x12e4bf[_0xbe20('0x37')]));tnef[_0xbe20('0x3f')](_[_0xbe20('0x40')](_0x5ec178)['content'],function(_0x42f75b,_0x7c1178){if(_0x7c1178){_0x12e4bf['html']=_0x7c1178[_0xbe20('0x41')]||'

Empty\x20message

';if(_0x7c1178['Attachments']){for(var _0x579af9=0x0;_0x579af9<_0x7c1178[_0xbe20('0x42')][_0xbe20('0xd')];_0x579af9++){var _0x550ddd=_0x7c1178[_0xbe20('0x42')][_0x579af9];_0x1a019c[_0xbe20('0x20')]['attachments'][_0xbe20('0x18')]({'filename':_0x550ddd[_0xbe20('0x43')],'content':Buffer[_0xbe20('0x35')](_0x550ddd['Data'])});}}}_0x4a22c1(parseEmail(_0x4c3cae,_0x12e4bf,_0x1a019c));});}else{_0x12e4bf[_0xbe20('0x12')]=_0xbe20('0x44');_0x4a22c1(parseEmail(_0x4c3cae,_0x12e4bf,_0x1a019c));}}else{_0x4a22c1(parseEmail(_0x4c3cae,_0x12e4bf,_0x1a019c));}};exports[_0xbe20('0x45')]=function(_0x11dc96){switch(_0x11dc96){case _0xbe20('0x46'):return _0xbe20('0x47');case'yahoo':return'imap.mail.yahoo.com';case'hotmail':return _0xbe20('0x48');case _0xbe20('0x49'):return _0xbe20('0x4a');}return'127.0.0.1';};exports[_0xbe20('0x4b')]=function(_0x32568e,_0x37d267){var _0x47d7a2=[_0xbe20('0x4c')+(_0x37d267||''),_0xbe20('0x4d')+_0x32568e,'',''];return Buffer[_0xbe20('0x35')](_0x47d7a2['join'](''),_0xbe20('0x4e'))[_0xbe20('0x4f')](_0xbe20('0x50'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 932b2b1..560675e 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 _0x6ae5=['Smtp','exports','name','Service','key','SERV','active','Imap'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ae5,0xc2));var _0x56ae=function(_0x34e394,_0x140e6a){_0x34e394=_0x34e394-0x0;var _0x418635=_0x6ae5[_0x34e394];return _0x418635;};'use strict';var _=require('lodash');function MailAccount(_0x234f3d){this['id']=_0x234f3d['id']||0x0;this['name']=_0x234f3d[_0x56ae('0x0')]||_0x56ae('0x1');this[_0x56ae('0x2')]=_0x234f3d[_0x56ae('0x2')]||_0x56ae('0x3');this[_0x56ae('0x4')]=_0x234f3d[_0x56ae('0x4')]||![];this['Imap']=_0x234f3d[_0x56ae('0x5')]||[];this[_0x56ae('0x6')]=_0x234f3d[_0x56ae('0x6')]||[];}module[_0x56ae('0x7')]=MailAccount; \ No newline at end of file +var _0xefa8=['Smtp','lodash','name','Service','key','active','Imap'];(function(_0x2a2cdf,_0x3f2801){var _0x5e8e12=function(_0x3cc5ef){while(--_0x3cc5ef){_0x2a2cdf['push'](_0x2a2cdf['shift']());}};_0x5e8e12(++_0x3f2801);}(_0xefa8,0x127));var _0x8efa=function(_0x21e11b,_0x55a9df){_0x21e11b=_0x21e11b-0x0;var _0x220006=_0xefa8[_0x21e11b];return _0x220006;};'use strict';var _=require(_0x8efa('0x0'));function MailAccount(_0x49a8c0){this['id']=_0x49a8c0['id']||0x0;this[_0x8efa('0x1')]=_0x49a8c0[_0x8efa('0x1')]||_0x8efa('0x2');this['key']=_0x49a8c0[_0x8efa('0x3')]||'SERV';this[_0x8efa('0x4')]=_0x49a8c0[_0x8efa('0x4')]||![];this['Imap']=_0x49a8c0[_0x8efa('0x5')]||[];this[_0x8efa('0x6')]=_0x49a8c0[_0x8efa('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index e2225e5..be8bd8a 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 _0x36d8=['../model/mailAccount','mailAccounts','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','length','merge','exports'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x36d8,0x18c));var _0x836d=function(_0xa4c834,_0x27b37a){_0xa4c834=_0xa4c834-0x0;var _0x1bb72b=_0x36d8[_0xa4c834];return _0x1bb72b;};'use strict';var _=require('lodash');var MailAccount=require(_0x836d('0x0'));var Realtime=function(){this[_0x836d('0x1')]={};};function freeIsNotKey(_0x19a2cd,_0x16fa49,_0x394cf5){var _0x383058=_[_0x836d('0x2')](_0x19a2cd,function(_0x57f265,_0x5373df){return _0x57f265[_0x394cf5];});for(var _0x2c5879 in _0x16fa49){if(_0x16fa49['hasOwnProperty'](_0x2c5879)){if(!_0x383058[_0x2c5879]){delete _0x16fa49[_0x2c5879];}}}}Realtime[_0x836d('0x3')][_0x836d('0x4')]=function(_0x153b4b,_0x218eab){for(var _0x2cd27b in _0x218eab){if(_0x153b4b[_0x836d('0x5')](_0x2cd27b)){_0x153b4b[_0x2cd27b]=_0x218eab[_0x2cd27b];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x19111=this;return function(_0x357c5e){if(_0x357c5e){freeIsNotKey(_0x357c5e,_0x19111['mailAccounts'],'id');for(var _0x1cd7d4=0x0,_0x472491={},_0x52fbc0={};_0x1cd7d4<_0x357c5e[_0x836d('0x6')];_0x1cd7d4+=0x1){_0x472491=_0x357c5e[_0x1cd7d4];if(_['isUndefined'](_0x19111[_0x836d('0x1')][_0x472491['id']])){_0x19111[_0x836d('0x1')][_0x472491['id']]=new MailAccount(_0x472491);}else{_[_0x836d('0x7')](_0x19111[_0x836d('0x1')][_0x472491['id']],_0x472491);}}}return _0x19111[_0x836d('0x1')];};};module[_0x836d('0x8')]=Realtime; \ No newline at end of file +var _0x46c4=['isUndefined','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','length'];(function(_0x810025,_0x34bb04){var _0x4dbc81=function(_0x2c3907){while(--_0x2c3907){_0x810025['push'](_0x810025['shift']());}};_0x4dbc81(++_0x34bb04);}(_0x46c4,0xde));var _0x446c=function(_0x117b1b,_0x4d0b7d){_0x117b1b=_0x117b1b-0x0;var _0x5429be=_0x46c4[_0x117b1b];return _0x5429be;};'use strict';var _=require(_0x446c('0x0'));var MailAccount=require(_0x446c('0x1'));var Realtime=function(){this[_0x446c('0x2')]={};};function freeIsNotKey(_0x32a6d9,_0x3a1361,_0x398618){var _0x3a00ce=_[_0x446c('0x3')](_0x32a6d9,function(_0x5de425,_0x5da839){return _0x5de425[_0x398618];});for(var _0x533466 in _0x3a1361){if(_0x3a1361['hasOwnProperty'](_0x533466)){if(!_0x3a00ce[_0x533466]){delete _0x3a1361[_0x533466];}}}}Realtime[_0x446c('0x4')][_0x446c('0x5')]=function(_0x547bcd,_0x87c067){for(var _0x1e88ff in _0x87c067){if(_0x547bcd[_0x446c('0x6')](_0x1e88ff)){_0x547bcd[_0x1e88ff]=_0x87c067[_0x1e88ff];}}};Realtime[_0x446c('0x4')][_0x446c('0x7')]=function(){var _0x484a74=this;return function(_0x16eb41){if(_0x16eb41){freeIsNotKey(_0x16eb41,_0x484a74[_0x446c('0x2')],'id');for(var _0x3b4c35=0x0,_0x15d7bf={},_0xa0dfff={};_0x3b4c35<_0x16eb41[_0x446c('0x8')];_0x3b4c35+=0x1){_0x15d7bf=_0x16eb41[_0x3b4c35];if(_[_0x446c('0x9')](_0x484a74[_0x446c('0x2')][_0x15d7bf['id']])){_0x484a74[_0x446c('0x2')][_0x15d7bf['id']]=new MailAccount(_0x15d7bf);}else{_['merge'](_0x484a74[_0x446c('0x2')][_0x15d7bf['id']],_0x15d7bf);}}}return _0x484a74[_0x446c('0x2')];};};module[_0x446c('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 81096bf..ed55556 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 _0x96e0=['name','type','Smtp','data5','notify','NotifyMailAccount','../client','Request','provider','service','email','active','MailServerIn','Imap','CloudProvider'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0x96e0,0x7e));var _0x096e=function(_0x54cf2d,_0x2d373c){_0x54cf2d=_0x54cf2d-0x0;var _0x5116ef=_0x96e0[_0x54cf2d];return _0x5116ef;};'use strict';var client=require(_0x096e('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x096e('0x1')]('GetMailAccount',{'options':{'attributes':['id','name',_0x096e('0x2'),_0x096e('0x3'),_0x096e('0x4'),_0x096e('0x5'),'key','ListId','TemplateId'],'raw':![],'include':[{'model':_0x096e('0x6'),'as':_0x096e('0x7'),'include':[{'model':_0x096e('0x8'),'attributes':['id',_0x096e('0x9'),_0x096e('0x3'),_0x096e('0xa'),'data5'],'as':_0x096e('0x8')}]},{'model':'MailServerOut','as':_0x096e('0xb'),'include':[{'model':_0x096e('0x8'),'attributes':['id',_0x096e('0x9'),'service',_0x096e('0xa'),_0x096e('0xc')],'as':_0x096e('0x8')}]}]},'log':'getMailAccount'});};};exports[_0x096e('0xd')]=function(_0x2d0a4f,_0x163d06){return client[_0x096e('0x1')](_0x096e('0xe'),{'account':{'id':_0x2d0a4f},'body':_0x163d06,'log':_0x096e('0xe')});}; \ No newline at end of file +var _0xdcd5=['CloudProvider','data5','MailServerOut','type','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','active','key','ListId','TemplateId','MailServerIn','Imap'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xdcd5,0x110));var _0x5dcd=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0xdcd5[_0x25e109];return _0xc0f7d6;};'use strict';var client=require(_0x5dcd('0x0'));exports[_0x5dcd('0x1')]=function(){return function(){return client[_0x5dcd('0x2')](_0x5dcd('0x3'),{'options':{'attributes':['id',_0x5dcd('0x4'),_0x5dcd('0x5'),_0x5dcd('0x6'),'email',_0x5dcd('0x7'),_0x5dcd('0x8'),_0x5dcd('0x9'),_0x5dcd('0xa')],'raw':![],'include':[{'model':_0x5dcd('0xb'),'as':_0x5dcd('0xc'),'include':[{'model':_0x5dcd('0xd'),'attributes':['id',_0x5dcd('0x4'),'service','type',_0x5dcd('0xe')],'as':_0x5dcd('0xd')}]},{'model':_0x5dcd('0xf'),'as':'Smtp','include':[{'model':_0x5dcd('0xd'),'attributes':['id',_0x5dcd('0x4'),_0x5dcd('0x6'),_0x5dcd('0x10'),_0x5dcd('0xe')],'as':_0x5dcd('0xd')}]}]},'log':_0x5dcd('0x11')});};};exports['notify']=function(_0x5873c8,_0x6de207){return client[_0x5dcd('0x2')]('NotifyMailAccount',{'account':{'id':_0x5873c8},'body':_0x6de207,'log':_0x5dcd('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 62f6f15..1c631ab 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 _0xe433=['GetSettings','../client','Request','ShowSetting'];(function(_0x29210d,_0x45648b){var _0x4a66e6=function(_0x1ec623){while(--_0x1ec623){_0x29210d['push'](_0x29210d['shift']());}};_0x4a66e6(++_0x45648b);}(_0xe433,0x171));var _0x3e43=function(_0xc737fa,_0x1509c6){_0xc737fa=_0xc737fa-0x0;var _0x2667fd=_0xe433[_0xc737fa];return _0x2667fd;};'use strict';var client=require(_0x3e43('0x0'));exports['getSettings']=function(){return client[_0x3e43('0x1')](_0x3e43('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x3e43('0x3')});}; \ No newline at end of file +var _0x5ddc=['Request','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x104c7a,_0x219911){var _0x2a7492=function(_0x40047e){while(--_0x40047e){_0x104c7a['push'](_0x104c7a['shift']());}};_0x2a7492(++_0x219911);}(_0x5ddc,0x14d));var _0xc5dd=function(_0x4afb20,_0xc39d7b){_0x4afb20=_0x4afb20-0x0;var _0x3947ad=_0x5ddc[_0x4afb20];return _0x3947ad;};'use strict';var client=require(_0xc5dd('0x0'));exports[_0xc5dd('0x1')]=function(){return client[_0xc5dd('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc5dd('0x3')]},'log':_0xc5dd('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 5f38a6b..f4af34e 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 e6645fe..cf687a3 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 _0x93df=['listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','listen','port','websocket','polling','redis','adapter','socket.io-redis','default','../../config/socketio','../../config/express','once'];(function(_0x302f93,_0x35550f){var _0x28a0ab=function(_0x564e3a){while(--_0x564e3a){_0x302f93['push'](_0x302f93['shift']());}};_0x28a0ab(++_0x35550f);}(_0x93df,0x1d1));var _0xf93d=function(_0x17dbd3,_0x3da50e){_0x17dbd3=_0x17dbd3-0x0;var _0x31a403=_0x93df[_0x17dbd3];return _0x31a403;};'use strict';var _=require(_0xf93d('0x0'));var http=require(_0xf93d('0x1'));var express=require(_0xf93d('0x2'));var sticky=require(_0xf93d('0x3'));var Redis=require(_0xf93d('0x4'));var config=require(_0xf93d('0x5'));var app=express();var server=http[_0xf93d('0x6')](app);server['timeout']=0xdbba0;if(sticky[_0xf93d('0x7')](server,config[_0xf93d('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0xf93d('0x9'),_0xf93d('0xa')]});config['redis']=_['defaults'](config[_0xf93d('0xb')],{'host':'localhost','port':0x18eb});socketio[_0xf93d('0xc')](require(_0xf93d('0xd'))({'pubClient':new Redis(config[_0xf93d('0xb')]),'subClient':new Redis(config[_0xf93d('0xb')])}));require('../../config/triggers')[_0xf93d('0xe')]();require(_0xf93d('0xf'))[_0xf93d('0xe')](socketio);require(_0xf93d('0x10'))[_0xf93d('0xe')](app);require('../../routes')['default'](app);}else{server[_0xf93d('0x11')](_0xf93d('0x12'),function(){console[_0xf93d('0x13')](_0xf93d('0x14'),config['port']);});}exports=module['exports']=app; \ No newline at end of file +var _0x5fe6=['Express\x20server\x20listening\x20on\x20port\x20%d!','port','lodash','express','sticky-session','ioredis','../../config/environment','listen','socket.io','websocket','polling','redis','localhost','../../config/triggers','default','once','log'];(function(_0x1f5e4a,_0x16111e){var _0x380da7=function(_0x49dbbb){while(--_0x49dbbb){_0x1f5e4a['push'](_0x1f5e4a['shift']());}};_0x380da7(++_0x16111e);}(_0x5fe6,0x123));var _0x65fe=function(_0x5e1fb8,_0x4e7879){_0x5e1fb8=_0x5e1fb8-0x0;var _0x2406da=_0x5fe6[_0x5e1fb8];return _0x2406da;};'use strict';var _=require(_0x65fe('0x0'));var http=require('http');var express=require(_0x65fe('0x1'));var sticky=require(_0x65fe('0x2'));var Redis=require(_0x65fe('0x3'));var config=require(_0x65fe('0x4'));var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0x65fe('0x5')](server,config['port'])){var socketio=require(_0x65fe('0x6'))(server,{'transports':[_0x65fe('0x7'),_0x65fe('0x8')]});config[_0x65fe('0x9')]=_['defaults'](config['redis'],{'host':_0x65fe('0xa'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0x65fe('0x9')]),'subClient':new Redis(config[_0x65fe('0x9')])}));require(_0x65fe('0xb'))['default']();require('../../config/socketio')[_0x65fe('0xc')](socketio);require('../../config/express')[_0x65fe('0xc')](app);require('../../routes')[_0x65fe('0xc')](app);}else{server[_0x65fe('0xd')]('listening',function(){console[_0x65fe('0xe')](_0x65fe('0xf'),config[_0x65fe('0x10')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index dceea3e..443a4a6 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 _0x2c15=['bluebird','../../config/logger','routing','client','http','request','then','error','rpc','message','result','catch','exports'];(function(_0x53eba7,_0x38744c){var _0x32491b=function(_0x61ea1d){while(--_0x61ea1d){_0x53eba7['push'](_0x53eba7['shift']());}};_0x32491b(++_0x38744c);}(_0x2c15,0xc3));var _0x52c1=function(_0x8bf705,_0x3cdd24){_0x8bf705=_0x8bf705-0x0;var _0x346805=_0x2c15[_0x8bf705];return _0x346805;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x52c1('0x0'));var logger=require(_0x52c1('0x1'))(_0x52c1('0x2'));var client=jayson[_0x52c1('0x3')][_0x52c1('0x4')]({'port':0x2329});client['Request']=function(_0x55662d,_0xd5c2f7){return new BPromise(function(_0xa532f7,_0x485aab){return client[_0x52c1('0x5')](_0x55662d,_0xd5c2f7)[_0x52c1('0x6')](function(_0x3ad4ac){logger['debug']('rpc',_0x52c1('0x2'),_0x55662d,_0xd5c2f7,_0x3ad4ac);if(_0x3ad4ac[_0x52c1('0x7')]){logger[_0x52c1('0x7')](_0x52c1('0x8'),_0x52c1('0x2'),_0x55662d,_0x3ad4ac[_0x52c1('0x7')][_0x52c1('0x9')],_0xd5c2f7);return _0x485aab(_0x3ad4ac[_0x52c1('0x7')][_0x52c1('0x9')]);}else{return _0xa532f7(_0x3ad4ac[_0x52c1('0xa')]);}})[_0x52c1('0xb')](function(_0x4c91f5){logger[_0x52c1('0x7')](_0x52c1('0x8'),_0x52c1('0x2'),_0x55662d,_0x4c91f5,_0xd5c2f7);return _0x485aab(_0x4c91f5);});});};module[_0x52c1('0xc')]=client; \ No newline at end of file +var _0xa411=['routing','exports','bluebird','../../config/logger','client','http','Request','then','debug','rpc','error','result','catch'];(function(_0x3a2a87,_0x4b34f0){var _0x525f7a=function(_0x2400ad){while(--_0x2400ad){_0x3a2a87['push'](_0x3a2a87['shift']());}};_0x525f7a(++_0x4b34f0);}(_0xa411,0x13a));var _0x1a41=function(_0xb07bff,_0x58193b){_0xb07bff=_0xb07bff-0x0;var _0x4c60f6=_0xa411[_0xb07bff];return _0x4c60f6;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x1a41('0x0'));var logger=require(_0x1a41('0x1'))('routing');var client=jayson[_0x1a41('0x2')][_0x1a41('0x3')]({'port':0x2329});client[_0x1a41('0x4')]=function(_0x20a3b2,_0x19a962){return new BPromise(function(_0x25611a,_0x25c440){return client['request'](_0x20a3b2,_0x19a962)[_0x1a41('0x5')](function(_0x3d4067){logger[_0x1a41('0x6')](_0x1a41('0x7'),'routing',_0x20a3b2,_0x19a962,_0x3d4067);if(_0x3d4067[_0x1a41('0x8')]){logger[_0x1a41('0x8')]('rpc','routing',_0x20a3b2,_0x3d4067[_0x1a41('0x8')]['message'],_0x19a962);return _0x25c440(_0x3d4067[_0x1a41('0x8')]['message']);}else{return _0x25611a(_0x3d4067[_0x1a41('0x9')]);}})[_0x1a41('0xa')](function(_0x252196){logger[_0x1a41('0x8')]('rpc',_0x1a41('0xb'),_0x20a3b2,_0x252196,_0x19a962);return _0x25c440(_0x252196);});});};module[_0x1a41('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 304106a..6756814 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 _0x2051=['initWhatsappQueues','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2051,0x177));var _0x1205=function(_0x5978af,_0x47914a){_0x5978af=_0x5978af-0x0;var _0x41948a=_0x2051[_0x5978af];return _0x41948a;};'use strict';var BPromise=require(_0x1205('0x0'));var server=require(_0x1205('0x1'));var Realtime=require(_0x1205('0x2'));var user=require(_0x1205('0x3'));var interval=require(_0x1205('0x4'));var openchannelQueue=require(_0x1205('0x5'));var chatQueue=require(_0x1205('0x6'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x1205('0x7'));var faxQueue=require(_0x1205('0x8'));var whatsappQueue=require(_0x1205('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x1205('0xa')]()[_0x1205('0xb')](user['getAgents']())[_0x1205('0xb')](realtime['initAgents']())['then'](interval[_0x1205('0xc')]())[_0x1205('0xb')](realtime['initIntervals']())['then'](openchannelQueue[_0x1205('0xd')]())[_0x1205('0xb')](realtime[_0x1205('0xe')]())[_0x1205('0xb')](chatQueue[_0x1205('0xf')]())[_0x1205('0xb')](realtime[_0x1205('0x10')]())[_0x1205('0xb')](smsQueue['getSmsQueues']())[_0x1205('0xb')](realtime['initSmsQueues']())[_0x1205('0xb')](mailQueue[_0x1205('0x11')]())['then'](realtime[_0x1205('0x12')]())[_0x1205('0xb')](faxQueue[_0x1205('0x13')]())['then'](realtime[_0x1205('0x14')]())['then'](whatsappQueue['getWhatsappQueues']())[_0x1205('0xb')](realtime[_0x1205('0x15')]())[_0x1205('0xb')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x1205('0xb')](function(_0x15c829){return initRealtime();})['then'](function(_0x8bc3c0){return setInterval(initRealtime,0x1388);})['catch'](function(_0x4157de){console['log'](_0x4157de);});}main(); \ No newline at end of file +var _0xdddc=['./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','initSmsQueues','getMailQueues','getWhatsappQueues','catch','log','bluebird','./realtime'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdddc,0x1b7));var _0xcddd=function(_0x483208,_0x1ac290){_0x483208=_0x483208-0x0;var _0x139673=_0xdddc[_0x483208];return _0x139673;};'use strict';var BPromise=require(_0xcddd('0x0'));var server=require('./server');var Realtime=require(_0xcddd('0x1'));var user=require(_0xcddd('0x2'));var interval=require(_0xcddd('0x3'));var openchannelQueue=require(_0xcddd('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xcddd('0x5'));var mailQueue=require(_0xcddd('0x6'));var faxQueue=require(_0xcddd('0x7'));var whatsappQueue=require(_0xcddd('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xcddd('0x9')](user[_0xcddd('0xa')]())['then'](realtime[_0xcddd('0xb')]())[_0xcddd('0x9')](interval['getIntervals']())[_0xcddd('0x9')](realtime[_0xcddd('0xc')]())[_0xcddd('0x9')](openchannelQueue[_0xcddd('0xd')]())[_0xcddd('0x9')](realtime[_0xcddd('0xe')]())[_0xcddd('0x9')](chatQueue['getChatQueues']())['then'](realtime[_0xcddd('0xf')]())[_0xcddd('0x9')](smsQueue['getSmsQueues']())[_0xcddd('0x9')](realtime[_0xcddd('0x10')]())[_0xcddd('0x9')](mailQueue[_0xcddd('0x11')]())[_0xcddd('0x9')](realtime['initMailQueues']())[_0xcddd('0x9')](faxQueue['getFaxQueues']())[_0xcddd('0x9')](realtime['initFaxQueues']())['then'](whatsappQueue[_0xcddd('0x12')]())['then'](realtime['initWhatsappQueues']())[_0xcddd('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x1bb6a6){return initRealtime();})['then'](function(_0x23a0b4){return setInterval(initRealtime,0x1388);})[_0xcddd('0x13')](function(_0x4e4ff4){console[_0xcddd('0x14')](_0x4e4ff4);});}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 08cc50d..156adca 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 _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0xc9c852,_0x4997e1){var _0x582094=function(_0x493264){while(--_0x493264){_0xc9c852['push'](_0xc9c852['shift']());}};_0x582094(++_0x4997e1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=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(_0x285824,_0x3da647){_0x285824=_0x285824-0x0;var _0x311d7e=_0x1261[_0x285824];return _0x311d7e;};'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 3d0537b..a1151f1 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 _0x7a92=['SendMail','bluebird','jayson/promise','client','then','error','message','result','catch'];(function(_0x26793e,_0x4db458){var _0x5b9310=function(_0x1918bd){while(--_0x1918bd){_0x26793e['push'](_0x26793e['shift']());}};_0x5b9310(++_0x4db458);}(_0x7a92,0x88));var _0x27a9=function(_0x43ae6a,_0x2dbc5b){_0x43ae6a=_0x43ae6a-0x0;var _0x40bd5d=_0x7a92[_0x43ae6a];return _0x40bd5d;};'use strict';var BPromise=require(_0x27a9('0x0'));var jayson=require(_0x27a9('0x1'));var client=jayson[_0x27a9('0x2')]['http']({'port':0x232b});function request(_0x342638,_0x5336ae){return new BPromise(function(_0x49b20c,_0x2b46b8){return client['request'](_0x342638,_0x5336ae)[_0x27a9('0x3')](function(_0x3e5452){if(_0x3e5452[_0x27a9('0x4')]){return _0x2b46b8(_0x3e5452[_0x27a9('0x4')][_0x27a9('0x5')]);}else{return _0x49b20c(_0x3e5452[_0x27a9('0x6')]);}})[_0x27a9('0x7')](function(_0x9b88c1){return _0x2b46b8(_0x9b88c1);});});}exports['sendMailMessage']=function(_0x384910,_0x9384d){return request(_0x27a9('0x8'),{'account':_0x384910,'message':_0x9384d});}; \ No newline at end of file +var _0xe8e9=['bluebird','jayson/promise','client','request','then','error','message','catch','sendMailMessage','SendMail'];(function(_0x187499,_0x5e416a){var _0x2965fe=function(_0xc6645e){while(--_0xc6645e){_0x187499['push'](_0x187499['shift']());}};_0x2965fe(++_0x5e416a);}(_0xe8e9,0x82));var _0x9e8e=function(_0x28ffc5,_0xe9b237){_0x28ffc5=_0x28ffc5-0x0;var _0x20bdcd=_0xe8e9[_0x28ffc5];return _0x20bdcd;};'use strict';var BPromise=require(_0x9e8e('0x0'));var jayson=require(_0x9e8e('0x1'));var client=jayson[_0x9e8e('0x2')]['http']({'port':0x232b});function request(_0x47b9df,_0x2cc296){return new BPromise(function(_0x1e9026,_0x307f87){return client[_0x9e8e('0x3')](_0x47b9df,_0x2cc296)[_0x9e8e('0x4')](function(_0x3f52b7){if(_0x3f52b7[_0x9e8e('0x5')]){return _0x307f87(_0x3f52b7[_0x9e8e('0x5')][_0x9e8e('0x6')]);}else{return _0x1e9026(_0x3f52b7['result']);}})[_0x9e8e('0x7')](function(_0x2ac82d){return _0x307f87(_0x2ac82d);});});}exports[_0x9e8e('0x8')]=function(_0x23b402,_0x867f68){return request(_0x9e8e('0x9'),{'account':_0x23b402,'message':_0x867f68});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index a0338a6..417c4c9 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 _0xfd11=['faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','working','idle','chat','openchannel','fax','Status','StatusTime','toNumber','format','chatStatus','chatStatusTime','emit','user:save','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity'];(function(_0x43073b,_0x26cd7c){var _0x5210e3=function(_0x12e176){while(--_0x12e176){_0x43073b['push'](_0x43073b['shift']());}};_0x5210e3(++_0x26cd7c);}(_0xfd11,0xf5));var _0x1fd1=function(_0x51ab83,_0x2721b9){_0x51ab83=_0x51ab83-0x0;var _0x14b6de=_0xfd11[_0x51ab83];return _0x14b6de;};'use strict';var _=require('lodash');var moment=require(_0x1fd1('0x0'));var md5=require(_0x1fd1('0x1'));var Redis=require(_0x1fd1('0x2'));var config=require('../../../config/environment');config[_0x1fd1('0x3')]=_[_0x1fd1('0x4')](config[_0x1fd1('0x3')],{'host':_0x1fd1('0x5'),'port':0x18eb});var io=require(_0x1fd1('0x6'))(new Redis(config[_0x1fd1('0x3')]));function Agent(_0x6ddb5){this['id']=_0x6ddb5['id']||0x0;this['name']=_0x6ddb5['name']||'';this[_0x1fd1('0x7')]=_0x6ddb5['online']||!![];this[_0x1fd1('0x8')]=_0x6ddb5[_0x1fd1('0x8')]||![];this[_0x1fd1('0x9')]=_0x6ddb5['chatPause']||![];this[_0x1fd1('0xa')]=_0x6ddb5[_0x1fd1('0xa')]||![];this['faxPause']=_0x6ddb5[_0x1fd1('0xb')]||![];this[_0x1fd1('0xc')]=_0x6ddb5[_0x1fd1('0xc')]||![];this[_0x1fd1('0xd')]=_0x6ddb5[_0x1fd1('0xd')]||![];this['chatStatus']=_0x1fd1('0xe');this['chatStatusTime']=0x0;this[_0x1fd1('0xf')]=_0x6ddb5[_0x1fd1('0xf')]||0x0;this[_0x1fd1('0x10')]=0x0;this['mailStatus']='unknown';this[_0x1fd1('0x11')]=0x0;this[_0x1fd1('0x12')]=_0x6ddb5[_0x1fd1('0x12')]||0x0;this[_0x1fd1('0x13')]=0x0;this[_0x1fd1('0x14')]=_0x1fd1('0xe');this[_0x1fd1('0x15')]=0x0;this[_0x1fd1('0x16')]=_0x6ddb5[_0x1fd1('0x16')]||0x0;this[_0x1fd1('0x17')]=0x0;this[_0x1fd1('0x18')]=_0x1fd1('0xe');this['smsStatusTime']=0x0;this['smsCapacity']=_0x6ddb5[_0x1fd1('0x19')]||0x0;this[_0x1fd1('0x1a')]=0x0;this[_0x1fd1('0x1b')]=_0x1fd1('0xe');this[_0x1fd1('0x1c')]=0x0;this['whatsappCapacity']=_0x6ddb5[_0x1fd1('0x1d')]||0x0;this[_0x1fd1('0x1e')]=0x0;this[_0x1fd1('0x1f')]='unknown';this['openchannelStatusTime']=0x0;this[_0x1fd1('0x20')]=_0x6ddb5[_0x1fd1('0x20')]||0x0;this[_0x1fd1('0x21')]=0x0;this[_0x1fd1('0x22')]=![];this[_0x1fd1('0x23')]=undefined;this[_0x1fd1('0x1')]='';this[_0x1fd1('0x24')]();}Agent[_0x1fd1('0x25')][_0x1fd1('0x26')]=function(_0x4b1560){if(this[_0x4b1560+_0x1fd1('0x27')]>0x0){if(this[_0x4b1560+'Capacity']>0x0&&this[_0x4b1560+'CurrentCapacity']>=this[_0x4b1560+'Capacity']){return'maxcapacity';}else{return _0x1fd1('0x28');}}else{return _0x1fd1('0x29');}};Agent[_0x1fd1('0x25')]['updateRealtime']=function(){var _0x59c8c2=['mail',_0x1fd1('0x2a'),_0x1fd1('0x2b'),_0x1fd1('0x2c'),'sms','whatsapp'];for(var _0x37b769=0x0;_0x37b769<_0x59c8c2['length'];_0x37b769+=0x1){var _0x10ccd1=this[_0x1fd1('0x26')](_0x59c8c2[_0x37b769]);if(this[_0x59c8c2[_0x37b769]+_0x1fd1('0x2d')]!==_0x10ccd1){this[_0x59c8c2[_0x37b769]+_0x1fd1('0x2e')]=_[_0x1fd1('0x2f')](moment()[_0x1fd1('0x30')]('x'));}this[_0x59c8c2[_0x37b769]+_0x1fd1('0x2d')]=_0x10ccd1;}var _0x44a7f3={'id':this['id'],'name':this['name'],'online':this[_0x1fd1('0x7')],'voicePause':this['voicePause'],'chatPause':this[_0x1fd1('0x9')],'mailPause':this[_0x1fd1('0xa')],'smsPause':this[_0x1fd1('0xc')],'faxPause':this[_0x1fd1('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x1fd1('0x31')],'chatStatusTime':this[_0x1fd1('0x32')],'chatCapacity':this[_0x1fd1('0xf')],'chatCurrentCapacity':this[_0x1fd1('0x10')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x1fd1('0x11')],'mailCapacity':this[_0x1fd1('0x12')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x1fd1('0x14')],'faxStatusTime':this[_0x1fd1('0x15')],'faxCapacity':this[_0x1fd1('0x16')],'faxCurrentCapacity':this[_0x1fd1('0x17')],'smsStatus':this[_0x1fd1('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x1fd1('0x19')],'smsCurrentCapacity':this[_0x1fd1('0x1a')],'whatsappStatus':this[_0x1fd1('0x1b')],'whatsappStatusTime':this[_0x1fd1('0x1c')],'whatsappCapacity':this[_0x1fd1('0x1d')],'whatsappCurrentCapacity':this[_0x1fd1('0x1e')],'openchannelStatus':this[_0x1fd1('0x1f')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x1fd1('0x20')],'openchannelCurrentCapacity':this[_0x1fd1('0x21')],'busy':this[_0x1fd1('0x22')],'busyQueue':this[_0x1fd1('0x23')]};var _0x59313b=md5(JSON['stringify'](_0x44a7f3));if(this['md5']!==_0x59313b){this[_0x1fd1('0x1')]=_0x59313b;io[_0x1fd1('0x33')](_0x1fd1('0x34'),_0x44a7f3);}};module['exports']=Agent; \ No newline at end of file +var _0x3f40=['whatsappStatus','whatsappCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','StatusTime','toNumber','format','Status','online','chatStatusTime','mailStatus','faxStatusTime','smsStatusTime','smsCurrentCapacity','whatsappCurrentCapacity','openchannelStatus','emit','user:save','exports','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x3f40,0xe0));var _0x03f4=function(_0x49ea92,_0x3900ef){_0x49ea92=_0x49ea92-0x0;var _0x3feb57=_0x3f40[_0x49ea92];return _0x3feb57;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require(_0x03f4('0x0'));config['redis']=_[_0x03f4('0x1')](config[_0x03f4('0x2')],{'host':_0x03f4('0x3'),'port':0x18eb});var io=require(_0x03f4('0x4'))(new Redis(config['redis']));function Agent(_0x157c36){this['id']=_0x157c36['id']||0x0;this[_0x03f4('0x5')]=_0x157c36[_0x03f4('0x5')]||'';this['online']=_0x157c36['online']||!![];this[_0x03f4('0x6')]=_0x157c36[_0x03f4('0x6')]||![];this[_0x03f4('0x7')]=_0x157c36['chatPause']||![];this[_0x03f4('0x8')]=_0x157c36[_0x03f4('0x8')]||![];this['faxPause']=_0x157c36[_0x03f4('0x9')]||![];this[_0x03f4('0xa')]=_0x157c36[_0x03f4('0xa')]||![];this[_0x03f4('0xb')]=_0x157c36[_0x03f4('0xb')]||![];this[_0x03f4('0xc')]=_0x03f4('0xd');this['chatStatusTime']=0x0;this['chatCapacity']=_0x157c36[_0x03f4('0xe')]||0x0;this[_0x03f4('0xf')]=0x0;this['mailStatus']=_0x03f4('0xd');this[_0x03f4('0x10')]=0x0;this['mailCapacity']=_0x157c36[_0x03f4('0x11')]||0x0;this[_0x03f4('0x12')]=0x0;this[_0x03f4('0x13')]=_0x03f4('0xd');this['faxStatusTime']=0x0;this[_0x03f4('0x14')]=_0x157c36[_0x03f4('0x14')]||0x0;this[_0x03f4('0x15')]=0x0;this[_0x03f4('0x16')]='unknown';this['smsStatusTime']=0x0;this[_0x03f4('0x17')]=_0x157c36[_0x03f4('0x17')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x03f4('0x18')]='unknown';this['whatsappStatusTime']=0x0;this[_0x03f4('0x19')]=_0x157c36['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x03f4('0xd');this[_0x03f4('0x1a')]=0x0;this['openchannelCapacity']=_0x157c36[_0x03f4('0x1b')]||0x0;this[_0x03f4('0x1c')]=0x0;this[_0x03f4('0x1d')]=![];this[_0x03f4('0x1e')]=undefined;this[_0x03f4('0x1f')]='';this[_0x03f4('0x20')]();}Agent[_0x03f4('0x21')][_0x03f4('0x22')]=function(_0x297a60){if(this[_0x297a60+'CurrentCapacity']>0x0){if(this[_0x297a60+_0x03f4('0x23')]>0x0&&this[_0x297a60+_0x03f4('0x24')]>=this[_0x297a60+_0x03f4('0x23')]){return _0x03f4('0x25');}else{return _0x03f4('0x26');}}else{return _0x03f4('0x27');}};Agent['prototype'][_0x03f4('0x20')]=function(){var _0x1a1d10=[_0x03f4('0x28'),_0x03f4('0x29'),_0x03f4('0x2a'),_0x03f4('0x2b'),_0x03f4('0x2c'),_0x03f4('0x2d')];for(var _0x42b358=0x0;_0x42b358<_0x1a1d10[_0x03f4('0x2e')];_0x42b358+=0x1){var _0x42a51d=this[_0x03f4('0x22')](_0x1a1d10[_0x42b358]);if(this[_0x1a1d10[_0x42b358]+'Status']!==_0x42a51d){this[_0x1a1d10[_0x42b358]+_0x03f4('0x2f')]=_[_0x03f4('0x30')](moment()[_0x03f4('0x31')]('x'));}this[_0x1a1d10[_0x42b358]+_0x03f4('0x32')]=_0x42a51d;}var _0x5529c1={'id':this['id'],'name':this[_0x03f4('0x5')],'online':this[_0x03f4('0x33')],'voicePause':this[_0x03f4('0x6')],'chatPause':this['chatPause'],'mailPause':this[_0x03f4('0x8')],'smsPause':this[_0x03f4('0xa')],'faxPause':this[_0x03f4('0x9')],'openchannelPause':this[_0x03f4('0xb')],'chatStatus':this[_0x03f4('0xc')],'chatStatusTime':this[_0x03f4('0x34')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x03f4('0x35')],'mailStatusTime':this[_0x03f4('0x10')],'mailCapacity':this[_0x03f4('0x11')],'mailCurrentCapacity':this[_0x03f4('0x12')],'faxStatus':this[_0x03f4('0x13')],'faxStatusTime':this[_0x03f4('0x36')],'faxCapacity':this[_0x03f4('0x14')],'faxCurrentCapacity':this[_0x03f4('0x15')],'smsStatus':this[_0x03f4('0x16')],'smsStatusTime':this[_0x03f4('0x37')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x03f4('0x38')],'whatsappStatus':this[_0x03f4('0x18')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x03f4('0x19')],'whatsappCurrentCapacity':this[_0x03f4('0x39')],'openchannelStatus':this[_0x03f4('0x3a')],'openchannelStatusTime':this[_0x03f4('0x1a')],'openchannelCapacity':this[_0x03f4('0x1b')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x03f4('0x1d')],'busyQueue':this['busyQueue']};var _0x2c4832=md5(JSON['stringify'](_0x5529c1));if(this[_0x03f4('0x1f')]!==_0x2c4832){this[_0x03f4('0x1f')]=_0x2c4832;io[_0x03f4('0x3b')](_0x03f4('0x3c'),_0x5529c1);}};module[_0x03f4('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 3145bfd..b4840cf 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 _0x1bd7=['available','stringify','format','emit','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause'];(function(_0xd147f3,_0x3e9ec6){var _0x1114e1=function(_0x384e4d){while(--_0x384e4d){_0xd147f3['push'](_0xd147f3['shift']());}};_0x1114e1(++_0x3e9ec6);}(_0x1bd7,0xc0));var _0x71bd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1bd7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require(_0x71bd('0x0'));var util=require(_0x71bd('0x1'));var Redis=require(_0x71bd('0x2'));var config=require(_0x71bd('0x3'));config[_0x71bd('0x4')]=_[_0x71bd('0x5')](config[_0x71bd('0x4')],{'host':_0x71bd('0x6'),'port':0x18eb});var io=require(_0x71bd('0x7'))(new Redis(config[_0x71bd('0x4')]));function ChatQueue(_0x360d15){this['id']=_0x360d15['id']||0x0;this[_0x71bd('0x8')]=_0x360d15[_0x71bd('0x8')]||'';this[_0x71bd('0x9')]=_0x360d15[_0x71bd('0x9')]||0xa;this[_0x71bd('0xa')]=_0x360d15[_0x71bd('0xa')]||_0x71bd('0xb');this['Agents']=_0x360d15[_0x71bd('0xc')];this[_0x71bd('0xd')]={};this[_0x71bd('0xe')]=0x0;this['md5']='';this[_0x71bd('0xf')]();this[_0x71bd('0x10')]();}ChatQueue[_0x71bd('0x11')][_0x71bd('0xf')]=function(){var _0xa115ae=this[_0x71bd('0xd')][_0x71bd('0x12')];this[_0x71bd('0xd')]=_[_0x71bd('0x13')](this[_0x71bd('0xc')],'id');this[_0x71bd('0xd')][_0x71bd('0x12')]=_0xa115ae;};ChatQueue[_0x71bd('0x11')]['updateRealtime']=function(){this[_0x71bd('0x14')]=0x0;this[_0x71bd('0x15')]=0x0;for(var _0x35ab34=0x0;_0x35ab34=0x0?this[_0x71bd('0x19')]:0x0;var _0x3871d6={'id':this['id'],'available':this[_0x71bd('0x19')],'loggedIn':this[_0x71bd('0x14')],'name':this[_0x71bd('0x8')],'paused':this[_0x71bd('0x15')],'waiting':this[_0x71bd('0xe')]};var _0x1b7580=md5(JSON[_0x71bd('0x1a')](_0x3871d6));if(this[_0x71bd('0x0')]!==_0x1b7580){this['md5']=_0x1b7580;io['to'](util[_0x71bd('0x1b')]('chat:queue:%s',_0x3871d6[_0x71bd('0x8')]))[_0x71bd('0x1c')](_0x71bd('0x1d'),_0x3871d6);}};module[_0x71bd('0x1e')]=ChatQueue; \ No newline at end of file +var _0x9007=['online','loggedIn','chatPause','available','stringify','format','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused'];(function(_0x54d8ac,_0x213a23){var _0x28c4d2=function(_0x1690dc){while(--_0x1690dc){_0x54d8ac['push'](_0x54d8ac['shift']());}};_0x28c4d2(++_0x213a23);}(_0x9007,0x17e));var _0x7900=function(_0x301148,_0x25b884){_0x301148=_0x301148-0x0;var _0x42ce24=_0x9007[_0x301148];return _0x42ce24;};'use strict';var _=require(_0x7900('0x0'));var md5=require(_0x7900('0x1'));var util=require(_0x7900('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x7900('0x3')]=_['defaults'](config[_0x7900('0x3')],{'host':_0x7900('0x4'),'port':0x18eb});var io=require(_0x7900('0x5'))(new Redis(config[_0x7900('0x3')]));function ChatQueue(_0x1bd40f){this['id']=_0x1bd40f['id']||0x0;this[_0x7900('0x6')]=_0x1bd40f[_0x7900('0x6')]||'';this[_0x7900('0x7')]=_0x1bd40f['timeout']||0xa;this[_0x7900('0x8')]=_0x1bd40f['strategy']||_0x7900('0x9');this[_0x7900('0xa')]=_0x1bd40f['Agents'];this[_0x7900('0xb')]={};this[_0x7900('0xc')]=0x0;this[_0x7900('0x1')]='';this[_0x7900('0xd')]();this[_0x7900('0xe')]();}ChatQueue[_0x7900('0xf')]['updateRouting']=function(){var _0x315ef4=this[_0x7900('0xb')]['_rr'];this[_0x7900('0xb')]=_['map'](this[_0x7900('0xa')],'id');this[_0x7900('0xb')][_0x7900('0x10')]=_0x315ef4;};ChatQueue[_0x7900('0xf')][_0x7900('0xe')]=function(){this['loggedIn']=0x0;this[_0x7900('0x11')]=0x0;for(var _0x4063b1=0x0;_0x4063b1=0x0?this['available']:0x0;var _0x463554={'id':this['id'],'available':this[_0x7900('0x15')],'loggedIn':this[_0x7900('0x13')],'name':this[_0x7900('0x6')],'paused':this[_0x7900('0x11')],'waiting':this[_0x7900('0xc')]};var _0x2f0314=md5(JSON[_0x7900('0x16')](_0x463554));if(this['md5']!==_0x2f0314){this[_0x7900('0x1')]=_0x2f0314;io['to'](util[_0x7900('0x17')]('chat:queue:%s',_0x463554[_0x7900('0x6')]))['emit']('chat_queue:save',_0x463554);}};module[_0x7900('0x18')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 86e0e83..dc8a198 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 _0x3d1d=['stringify','format','fax:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','loggedIn','paused','length','online','faxPause','available','waiting'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x3d1d,0xde));var _0xd3d1=function(_0x4bcd4c,_0x463173){_0x4bcd4c=_0x4bcd4c-0x0;var _0x4e1710=_0x3d1d[_0x4bcd4c];return _0x4e1710;};'use strict';var _=require(_0xd3d1('0x0'));var md5=require(_0xd3d1('0x1'));var util=require(_0xd3d1('0x2'));var Redis=require('ioredis');var config=require(_0xd3d1('0x3'));config[_0xd3d1('0x4')]=_[_0xd3d1('0x5')](config[_0xd3d1('0x4')],{'host':_0xd3d1('0x6'),'port':0x18eb});var io=require(_0xd3d1('0x7'))(new Redis(config[_0xd3d1('0x4')]));function FaxQueue(_0x4069d4){this['id']=_0x4069d4['id']||0x0;this[_0xd3d1('0x8')]=_0x4069d4[_0xd3d1('0x8')]||'';this[_0xd3d1('0x9')]=_0x4069d4[_0xd3d1('0x9')]||0xa;this['strategy']=_0x4069d4[_0xd3d1('0xa')]||_0xd3d1('0xb');this[_0xd3d1('0xc')]=_0x4069d4['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0xd3d1('0x1')]='';this[_0xd3d1('0xd')]();this['updateRealtime']();}FaxQueue[_0xd3d1('0xe')][_0xd3d1('0xd')]=function(){var _0xfaa1db=this[_0xd3d1('0xf')][_0xd3d1('0x10')];this['mapAgentsId']=_[_0xd3d1('0x11')](this['Agents'],'id');this[_0xd3d1('0xf')][_0xd3d1('0x10')]=_0xfaa1db;};FaxQueue[_0xd3d1('0xe')][_0xd3d1('0x12')]=function(){this[_0xd3d1('0x13')]=0x0;this[_0xd3d1('0x14')]=0x0;for(var _0x3f14e8=0x0;_0x3f14e8=0x0?this[_0xd3d1('0x18')]:0x0;var _0x4b1f3b={'id':this['id'],'available':this[_0xd3d1('0x18')],'loggedIn':this[_0xd3d1('0x13')],'name':this[_0xd3d1('0x8')],'paused':this[_0xd3d1('0x14')],'waiting':this[_0xd3d1('0x19')]};var _0xd09050=md5(JSON[_0xd3d1('0x1a')](_0x4b1f3b));if(this['md5']!==_0xd09050){this['md5']=_0xd09050;io['to'](util[_0xd3d1('0x1b')](_0xd3d1('0x1c'),_0x4b1f3b['name']))[_0xd3d1('0x1d')]('fax_queue:save',_0x4b1f3b);}};module[_0xd3d1('0x1e')]=FaxQueue; \ No newline at end of file +var _0x22d1=['map','_rr','loggedIn','paused','length','online','faxPause','available','fax:queue:%s','emit','fax_queue:save','exports','lodash','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype'];(function(_0x3f1132,_0x103f8e){var _0x2f2ef8=function(_0x41ecbe){while(--_0x41ecbe){_0x3f1132['push'](_0x3f1132['shift']());}};_0x2f2ef8(++_0x103f8e);}(_0x22d1,0x110));var _0x122d=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x22d1[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x122d('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x122d('0x1'));config[_0x122d('0x2')]=_[_0x122d('0x3')](config[_0x122d('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x122d('0x4'))(new Redis(config[_0x122d('0x2')]));function FaxQueue(_0x56ca2d){this['id']=_0x56ca2d['id']||0x0;this[_0x122d('0x5')]=_0x56ca2d[_0x122d('0x5')]||'';this[_0x122d('0x6')]=_0x56ca2d[_0x122d('0x6')]||0xa;this[_0x122d('0x7')]=_0x56ca2d['strategy']||'beepall';this[_0x122d('0x8')]=_0x56ca2d['Agents'];this[_0x122d('0x9')]={};this[_0x122d('0xa')]=0x0;this[_0x122d('0xb')]='';this['updateRouting']();this[_0x122d('0xc')]();}FaxQueue[_0x122d('0xd')]['updateRouting']=function(){var _0x59b340=this[_0x122d('0x9')]['_rr'];this[_0x122d('0x9')]=_[_0x122d('0xe')](this[_0x122d('0x8')],'id');this[_0x122d('0x9')][_0x122d('0xf')]=_0x59b340;};FaxQueue[_0x122d('0xd')][_0x122d('0xc')]=function(){this[_0x122d('0x10')]=0x0;this[_0x122d('0x11')]=0x0;for(var _0x1a0f27=0x0;_0x1a0f27=0x0?this[_0x122d('0x15')]:0x0;var _0x588df1={'id':this['id'],'available':this[_0x122d('0x15')],'loggedIn':this[_0x122d('0x10')],'name':this[_0x122d('0x5')],'paused':this['paused'],'waiting':this[_0x122d('0xa')]};var _0x391b48=md5(JSON['stringify'](_0x588df1));if(this[_0x122d('0xb')]!==_0x391b48){this[_0x122d('0xb')]=_0x391b48;io['to'](util['format'](_0x122d('0x16'),_0x588df1['name']))[_0x122d('0x17')](_0x122d('0x18'),_0x588df1);}};module[_0x122d('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 03bacbb..d1fff3f 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 _0x9b1f=['name','Intervals','exports'];(function(_0x4ea2ff,_0x44d6fc){var _0x2762bb=function(_0x538fef){while(--_0x538fef){_0x4ea2ff['push'](_0x4ea2ff['shift']());}};_0x2762bb(++_0x44d6fc);}(_0x9b1f,0x1e9));var _0xf9b1=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x9b1f[_0x20ef64];return _0x3707d8;};'use strict';function Interval(_0x4e4458){this['id']=_0x4e4458['id']||0x0;this[_0xf9b1('0x0')]=_0x4e4458['name']||'';this[_0xf9b1('0x1')]=_0x4e4458[_0xf9b1('0x1')]||{};}module[_0xf9b1('0x2')]=Interval; \ No newline at end of file +var _0x06fc=['exports','name','Intervals'];(function(_0x44a6bf,_0x2c7883){var _0x515b54=function(_0x22ae4b){while(--_0x22ae4b){_0x44a6bf['push'](_0x44a6bf['shift']());}};_0x515b54(++_0x2c7883);}(_0x06fc,0x10f));var _0xc06f=function(_0x320968,_0x171dcf){_0x320968=_0x320968-0x0;var _0x404e2a=_0x06fc[_0x320968];return _0x404e2a;};'use strict';function Interval(_0x867b26){this['id']=_0x867b26['id']||0x0;this[_0xc06f('0x0')]=_0x867b26['name']||'';this[_0xc06f('0x1')]=_0x867b26[_0xc06f('0x1')]||{};}module[_0xc06f('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 be5fca0..b84ed0f 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 _0xbff7=['mailPause','available','format','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online'];(function(_0x282cfd,_0x1a446b){var _0x20c647=function(_0x49f5dd){while(--_0x49f5dd){_0x282cfd['push'](_0x282cfd['shift']());}};_0x20c647(++_0x1a446b);}(_0xbff7,0x112));var _0x7bff=function(_0x402983,_0x5b1129){_0x402983=_0x402983-0x0;var _0x2dfa7e=_0xbff7[_0x402983];return _0x2dfa7e;};'use strict';var _=require(_0x7bff('0x0'));var md5=require(_0x7bff('0x1'));var util=require(_0x7bff('0x2'));var Redis=require(_0x7bff('0x3'));var config=require('../../../config/environment');config[_0x7bff('0x4')]=_['defaults'](config[_0x7bff('0x4')],{'host':_0x7bff('0x5'),'port':0x18eb});var io=require(_0x7bff('0x6'))(new Redis(config[_0x7bff('0x4')]));function MailQueue(_0x5acafb){this['id']=_0x5acafb['id']||0x0;this[_0x7bff('0x7')]=_0x5acafb[_0x7bff('0x7')]||'';this['timeout']=_0x5acafb[_0x7bff('0x8')]||0xa;this[_0x7bff('0x9')]=_0x5acafb['strategy']||_0x7bff('0xa');this[_0x7bff('0xb')]=_0x5acafb[_0x7bff('0xb')];this[_0x7bff('0xc')]={};this[_0x7bff('0xd')]=0x0;this[_0x7bff('0x1')]='';this[_0x7bff('0xe')]();this[_0x7bff('0xf')]();}MailQueue['prototype'][_0x7bff('0xe')]=function(){var _0xdc2fff=this[_0x7bff('0xc')][_0x7bff('0x10')];this[_0x7bff('0xc')]=_[_0x7bff('0x11')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0xdc2fff;};MailQueue[_0x7bff('0x12')][_0x7bff('0xf')]=function(){this[_0x7bff('0x13')]=0x0;this[_0x7bff('0x14')]=0x0;for(var _0x7be848=0x0;_0x7be848=0x0?this[_0x7bff('0x18')]:0x0;var _0xf3857a={'id':this['id'],'available':this[_0x7bff('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x7bff('0x7')],'paused':this[_0x7bff('0x14')],'waiting':this[_0x7bff('0xd')]};var _0x2a06c3=md5(JSON['stringify'](_0xf3857a));if(this['md5']!==_0x2a06c3){this[_0x7bff('0x1')]=_0x2a06c3;io['to'](util[_0x7bff('0x19')]('mail:queue:%s',_0xf3857a[_0x7bff('0x7')]))['emit']('mail_queue:save',_0xf3857a);}};module[_0x7bff('0x1a')]=MailQueue; \ No newline at end of file +var _0xaa43=['loggedIn','length','online','mailPause','paused','available','stringify','format','mail:queue:%s','emit','mail_queue:save','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x44ea11,_0x542e9b){var _0x5936c2=function(_0xb5256f){while(--_0xb5256f){_0x44ea11['push'](_0x44ea11['shift']());}};_0x5936c2(++_0x542e9b);}(_0xaa43,0x1bd));var _0x3aa4=function(_0x3e061f,_0x336054){_0x3e061f=_0x3e061f-0x0;var _0x2dd5bf=_0xaa43[_0x3e061f];return _0x2dd5bf;};'use strict';var _=require(_0x3aa4('0x0'));var md5=require(_0x3aa4('0x1'));var util=require('util');var Redis=require(_0x3aa4('0x2'));var config=require(_0x3aa4('0x3'));config['redis']=_[_0x3aa4('0x4')](config[_0x3aa4('0x5')],{'host':_0x3aa4('0x6'),'port':0x18eb});var io=require(_0x3aa4('0x7'))(new Redis(config[_0x3aa4('0x5')]));function MailQueue(_0x1c35cd){this['id']=_0x1c35cd['id']||0x0;this[_0x3aa4('0x8')]=_0x1c35cd[_0x3aa4('0x8')]||'';this['timeout']=_0x1c35cd[_0x3aa4('0x9')]||0xa;this[_0x3aa4('0xa')]=_0x1c35cd['strategy']||_0x3aa4('0xb');this[_0x3aa4('0xc')]=_0x1c35cd[_0x3aa4('0xc')];this[_0x3aa4('0xd')]={};this[_0x3aa4('0xe')]=0x0;this[_0x3aa4('0x1')]='';this[_0x3aa4('0xf')]();this[_0x3aa4('0x10')]();}MailQueue[_0x3aa4('0x11')][_0x3aa4('0xf')]=function(){var _0x50cfb6=this['mapAgentsId'][_0x3aa4('0x12')];this[_0x3aa4('0xd')]=_[_0x3aa4('0x13')](this[_0x3aa4('0xc')],'id');this[_0x3aa4('0xd')][_0x3aa4('0x12')]=_0x50cfb6;};MailQueue[_0x3aa4('0x11')]['updateRealtime']=function(){this[_0x3aa4('0x14')]=0x0;this['paused']=0x0;for(var _0x135248=0x0;_0x135248=0x0?this['available']:0x0;var _0x4dc522={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3aa4('0x14')],'name':this[_0x3aa4('0x8')],'paused':this[_0x3aa4('0x18')],'waiting':this['waiting']};var _0xeb9337=md5(JSON[_0x3aa4('0x1a')](_0x4dc522));if(this[_0x3aa4('0x1')]!==_0xeb9337){this[_0x3aa4('0x1')]=_0xeb9337;io['to'](util[_0x3aa4('0x1b')](_0x3aa4('0x1c'),_0x4dc522[_0x3aa4('0x8')]))[_0x3aa4('0x1d')](_0x3aa4('0x1e'),_0x4dc522);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index ca39313..bf78ffb 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x119a06,_0xc3f546){var _0x154d8c=function(_0x53722e){while(--_0x53722e){_0x119a06['push'](_0x119a06['shift']());}};_0x154d8c(++_0xc3f546);}(_0x814b,0x1a2));var _0xb814=function(_0x2850c0,_0x1363a7){_0x2850c0=_0x2850c0-0x0;var _0x21e830=_0x814b[_0x2850c0];return _0x21e830;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x7a54,0x106));var _0x47a5=function(_0x1a531d,_0x1c3a76){_0x1a531d=_0x1a531d-0x0;var _0x491a2f=_0x7a54[_0x1a531d];return _0x491a2f;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 92d62b9..b859f37 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 _0xc874=['format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','defaults','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify'];(function(_0x46a3e8,_0x2e1b35){var _0xf1442e=function(_0x37b5d4){while(--_0x37b5d4){_0x46a3e8['push'](_0x46a3e8['shift']());}};_0xf1442e(++_0x2e1b35);}(_0xc874,0x154));var _0x4c87=function(_0x55ef8b,_0x5deb5e){_0x55ef8b=_0x55ef8b-0x0;var _0x359c84=_0xc874[_0x55ef8b];return _0x359c84;};'use strict';var _=require(_0x4c87('0x0'));var md5=require('md5');var util=require(_0x4c87('0x1'));var Redis=require(_0x4c87('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x4c87('0x3')](config[_0x4c87('0x4')],{'host':_0x4c87('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4c87('0x4')]));function SmsQueue(_0xebd7d1){this['id']=_0xebd7d1['id']||0x0;this['name']=_0xebd7d1[_0x4c87('0x6')]||'';this[_0x4c87('0x7')]=_0xebd7d1[_0x4c87('0x7')]||0xa;this[_0x4c87('0x8')]=_0xebd7d1[_0x4c87('0x8')]||'beepall';this[_0x4c87('0x9')]=_0xebd7d1['Agents'];this[_0x4c87('0xa')]={};this[_0x4c87('0xb')]=0x0;this[_0x4c87('0xc')]='';this[_0x4c87('0xd')]();this[_0x4c87('0xe')]();}SmsQueue['prototype'][_0x4c87('0xd')]=function(){var _0x2b82cb=this['mapAgentsId'][_0x4c87('0xf')];this[_0x4c87('0xa')]=_[_0x4c87('0x10')](this[_0x4c87('0x9')],'id');this[_0x4c87('0xa')]['_rr']=_0x2b82cb;};SmsQueue['prototype']['updateRealtime']=function(){this[_0x4c87('0x11')]=0x0;this[_0x4c87('0x12')]=0x0;for(var _0x2c66bc=0x0;_0x2c66bc=0x0?this['available']:0x0;var _0x428144={'id':this['id'],'available':this['available'],'loggedIn':this[_0x4c87('0x11')],'name':this[_0x4c87('0x6')],'paused':this[_0x4c87('0x12')],'waiting':this[_0x4c87('0xb')]};var _0x4f6514=md5(JSON[_0x4c87('0x17')](_0x428144));if(this[_0x4c87('0xc')]!==_0x4f6514){this[_0x4c87('0xc')]=_0x4f6514;io['to'](util[_0x4c87('0x18')](_0x4c87('0x19'),_0x428144[_0x4c87('0x6')]))[_0x4c87('0x1a')](_0x4c87('0x1b'),_0x428144);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x3248=['_rr','loggedIn','paused','online','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','map'];(function(_0x451ce0,_0x3d5e2f){var _0x4808d2=function(_0x29ddc1){while(--_0x29ddc1){_0x451ce0['push'](_0x451ce0['shift']());}};_0x4808d2(++_0x3d5e2f);}(_0x3248,0x1bc));var _0x8324=function(_0x192566,_0x260c55){_0x192566=_0x192566-0x0;var _0x405259=_0x3248[_0x192566];return _0x405259;};'use strict';var _=require('lodash');var md5=require(_0x8324('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x8324('0x1'));config[_0x8324('0x2')]=_[_0x8324('0x3')](config[_0x8324('0x2')],{'host':_0x8324('0x4'),'port':0x18eb});var io=require(_0x8324('0x5'))(new Redis(config['redis']));function SmsQueue(_0x1d1033){this['id']=_0x1d1033['id']||0x0;this[_0x8324('0x6')]=_0x1d1033['name']||'';this[_0x8324('0x7')]=_0x1d1033[_0x8324('0x7')]||0xa;this[_0x8324('0x8')]=_0x1d1033[_0x8324('0x8')]||'beepall';this[_0x8324('0x9')]=_0x1d1033[_0x8324('0x9')];this[_0x8324('0xa')]={};this[_0x8324('0xb')]=0x0;this['md5']='';this[_0x8324('0xc')]();this[_0x8324('0xd')]();}SmsQueue['prototype'][_0x8324('0xc')]=function(){var _0x2c190e=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x8324('0xe')](this[_0x8324('0x9')],'id');this[_0x8324('0xa')][_0x8324('0xf')]=_0x2c190e;};SmsQueue['prototype'][_0x8324('0xd')]=function(){this[_0x8324('0x10')]=0x0;this[_0x8324('0x11')]=0x0;for(var _0x13a81f=0x0;_0x13a81f=0x0?this['available']:0x0;var _0x47b5e1={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8324('0x10')],'name':this[_0x8324('0x6')],'paused':this[_0x8324('0x11')],'waiting':this[_0x8324('0xb')]};var _0x50508e=md5(JSON[_0x8324('0x15')](_0x47b5e1));if(this[_0x8324('0x0')]!==_0x50508e){this[_0x8324('0x0')]=_0x50508e;io['to'](util[_0x8324('0x16')](_0x8324('0x17'),_0x47b5e1['name']))[_0x8324('0x18')](_0x8324('0x19'),_0x47b5e1);}};module[_0x8324('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 7a64d8f..88fac97 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 _0xbbec=['whatsapp_queue:save','exports','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','loggedIn','paused','online','whatsappPause','available','format','whatsapp:queue:%s'];(function(_0x3105ad,_0x57d140){var _0x51c358=function(_0x122acf){while(--_0x122acf){_0x3105ad['push'](_0x3105ad['shift']());}};_0x51c358(++_0x57d140);}(_0xbbec,0x1ab));var _0xcbbe=function(_0x2255e9,_0x17738b){_0x2255e9=_0x2255e9-0x0;var _0x399ac3=_0xbbec[_0x2255e9];return _0x399ac3;};'use strict';var _=require('lodash');var md5=require(_0xcbbe('0x0'));var util=require(_0xcbbe('0x1'));var Redis=require(_0xcbbe('0x2'));var config=require('../../../config/environment');config[_0xcbbe('0x3')]=_[_0xcbbe('0x4')](config[_0xcbbe('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xcbbe('0x5'))(new Redis(config[_0xcbbe('0x3')]));function WhatsappQueue(_0x135106){this['id']=_0x135106['id']||0x0;this['name']=_0x135106[_0xcbbe('0x6')]||'';this[_0xcbbe('0x7')]=_0x135106[_0xcbbe('0x7')]||0xa;this[_0xcbbe('0x8')]=_0x135106[_0xcbbe('0x8')]||'beepall';this[_0xcbbe('0x9')]=_0x135106[_0xcbbe('0x9')];this['mapAgentsId']={};this[_0xcbbe('0xa')]=0x0;this[_0xcbbe('0x0')]='';this[_0xcbbe('0xb')]();this[_0xcbbe('0xc')]();}WhatsappQueue[_0xcbbe('0xd')][_0xcbbe('0xb')]=function(){var _0x226e1b=this['mapAgentsId'][_0xcbbe('0xe')];this[_0xcbbe('0xf')]=_['map'](this[_0xcbbe('0x9')],'id');this[_0xcbbe('0xf')][_0xcbbe('0xe')]=_0x226e1b;};WhatsappQueue[_0xcbbe('0xd')][_0xcbbe('0xc')]=function(){this[_0xcbbe('0x10')]=0x0;this[_0xcbbe('0x11')]=0x0;for(var _0x1a2cb6=0x0;_0x1a2cb6=0x0?this[_0xcbbe('0x14')]:0x0;var _0x52b1c1={'id':this['id'],'available':this[_0xcbbe('0x14')],'loggedIn':this[_0xcbbe('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xcbbe('0xa')]};var _0x40c061=md5(JSON['stringify'](_0x52b1c1));if(this['md5']!==_0x40c061){this['md5']=_0x40c061;io['to'](util[_0xcbbe('0x15')](_0xcbbe('0x16'),_0x52b1c1[_0xcbbe('0x6')]))['emit'](_0xcbbe('0x17'),_0x52b1c1);}};module[_0xcbbe('0x18')]=WhatsappQueue; \ No newline at end of file +var _0xa0bd=['whatsappPause','available','stringify','emit','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','md5','updateRouting','mapAgentsId','_rr','Agents','prototype','updateRealtime','loggedIn','paused','length','online'];(function(_0x1176c7,_0xcb7727){var _0xc548df=function(_0x107218){while(--_0x107218){_0x1176c7['push'](_0x1176c7['shift']());}};_0xc548df(++_0xcb7727);}(_0xa0bd,0x1c8));var _0xda0b=function(_0x5bf1c5,_0x4219d1){_0x5bf1c5=_0x5bf1c5-0x0;var _0x25d951=_0xa0bd[_0x5bf1c5];return _0x25d951;};'use strict';var _=require(_0xda0b('0x0'));var md5=require('md5');var util=require(_0xda0b('0x1'));var Redis=require(_0xda0b('0x2'));var config=require(_0xda0b('0x3'));config[_0xda0b('0x4')]=_[_0xda0b('0x5')](config[_0xda0b('0x4')],{'host':_0xda0b('0x6'),'port':0x18eb});var io=require(_0xda0b('0x7'))(new Redis(config[_0xda0b('0x4')]));function WhatsappQueue(_0x320e34){this['id']=_0x320e34['id']||0x0;this[_0xda0b('0x8')]=_0x320e34[_0xda0b('0x8')]||'';this[_0xda0b('0x9')]=_0x320e34[_0xda0b('0x9')]||0xa;this[_0xda0b('0xa')]=_0x320e34[_0xda0b('0xa')]||_0xda0b('0xb');this['Agents']=_0x320e34['Agents'];this['mapAgentsId']={};this[_0xda0b('0xc')]=0x0;this[_0xda0b('0xd')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue['prototype'][_0xda0b('0xe')]=function(){var _0x52d0f6=this[_0xda0b('0xf')][_0xda0b('0x10')];this['mapAgentsId']=_['map'](this[_0xda0b('0x11')],'id');this[_0xda0b('0xf')]['_rr']=_0x52d0f6;};WhatsappQueue[_0xda0b('0x12')][_0xda0b('0x13')]=function(){this[_0xda0b('0x14')]=0x0;this[_0xda0b('0x15')]=0x0;for(var _0x84f423=0x0;_0x84f423=0x0?this['available']:0x0;var _0xd9050e={'id':this['id'],'available':this[_0xda0b('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xda0b('0x8')],'paused':this[_0xda0b('0x15')],'waiting':this[_0xda0b('0xc')]};var _0x20f9b2=md5(JSON[_0xda0b('0x1a')](_0xd9050e));if(this[_0xda0b('0xd')]!==_0x20f9b2){this['md5']=_0x20f9b2;io['to'](util['format']('whatsapp:queue:%s',_0xd9050e[_0xda0b('0x8')]))[_0xda0b('0x1b')](_0xda0b('0x1c'),_0xd9050e);}};module[_0xda0b('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 1cf6e46..7447a72 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 _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x488f4b,_0x28a3e8){var _0x26dd44=function(_0x4ba63d){while(--_0x4ba63d){_0x488f4b['push'](_0x488f4b['shift']());}};_0x26dd44(++_0x28a3e8);}(_0xb10b,0x12a));var _0xbb10=function(_0x369ee0,_0x57a15c){_0x369ee0=_0x369ee0-0x0;var _0x493a06=_0xb10b[_0x369ee0];return _0x493a06;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 693ad74..4d8526e 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 _0xfe3c=['../client','Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction'];(function(_0x16d575,_0xe97eda){var _0x54cfba=function(_0x1fe036){while(--_0x1fe036){_0x16d575['push'](_0x16d575['shift']());}};_0x54cfba(++_0xe97eda);}(_0xfe3c,0x14a));var _0xcfe3=function(_0x8e0379,_0x331a5b){_0x8e0379=_0x8e0379-0x0;var _0x4b0a7d=_0xfe3c[_0x8e0379];return _0x4b0a7d;};'use strict';var client=require(_0xcfe3('0x0'));exports['update']=function(_0x30f588,_0x44f8d1){return client[_0xcfe3('0x1')](_0xcfe3('0x2'),{'body':_0x44f8d1,'options':{'where':{'id':_0x30f588}},'log':_0xcfe3('0x3')});};exports['addTags']=function(_0x176637,_0x1f63ae){return client['Request'](_0xcfe3('0x4'),{'body':_0x1f63ae,'options':{'where':{'id':_0x176637}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x6a5d=['AddTagsToChatInteraction','addTagsToChatInteraction','update','Request','updateChatInteraction','addTags'];(function(_0x451fe2,_0x30c868){var _0x3f9fac=function(_0x49e7fb){while(--_0x49e7fb){_0x451fe2['push'](_0x451fe2['shift']());}};_0x3f9fac(++_0x30c868);}(_0x6a5d,0xd4));var _0xd6a5=function(_0x105dde,_0x1710e1){_0x105dde=_0x105dde-0x0;var _0x428585=_0x6a5d[_0x105dde];return _0x428585;};'use strict';var client=require('../client');exports[_0xd6a5('0x0')]=function(_0xb4fc23,_0xb12b5a){return client[_0xd6a5('0x1')]('UpdateChatInteraction',{'body':_0xb12b5a,'options':{'where':{'id':_0xb4fc23}},'log':_0xd6a5('0x2')});};exports[_0xd6a5('0x3')]=function(_0xb68a2,_0x50a50a){return client[_0xd6a5('0x1')](_0xd6a5('0x4'),{'body':_0x50a50a,'options':{'where':{'id':_0xb68a2}},'log':_0xd6a5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 8070494..caeea65 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 _0x802f=['createChatMessage'];(function(_0x25f818,_0x5af2be){var _0x5933eb=function(_0x2fc40b){while(--_0x2fc40b){_0x25f818['push'](_0x25f818['shift']());}};_0x5933eb(++_0x5af2be);}(_0x802f,0x1b1));var _0xf802=function(_0x2e8e5f,_0xdcb00){_0x2e8e5f=_0x2e8e5f-0x0;var _0x5aea41=_0x802f[_0x2e8e5f];return _0x5aea41;};'use strict';var client=require('../client');exports['create']=function(_0x25c7f5){return client['Request']('CreateChatMessage',{'body':_0x25c7f5,'log':_0xf802('0x0')});}; \ No newline at end of file +var _0x652e=['createChatMessage','create','Request'];(function(_0x38841c,_0x1af0bf){var _0x500610=function(_0x225955){while(--_0x225955){_0x38841c['push'](_0x38841c['shift']());}};_0x500610(++_0x1af0bf);}(_0x652e,0xdf));var _0xe652=function(_0x2df9cc,_0xe9bc32){_0x2df9cc=_0x2df9cc-0x0;var _0x2659a5=_0x652e[_0x2df9cc];return _0x2659a5;};'use strict';var client=require('../client');exports[_0xe652('0x0')]=function(_0x4b31b6){return client[_0xe652('0x1')]('CreateChatMessage',{'body':_0x4b31b6,'log':_0xe652('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 8fab0d0..9968aa2 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 _0x6b8f=['name','online','chatPause','getChatQueues','GetChatQueue','strategy','User'];(function(_0xb98825,_0x554182){var _0x451d90=function(_0x1e2b76){while(--_0x1e2b76){_0xb98825['push'](_0xb98825['shift']());}};_0x451d90(++_0x554182);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x1ecccb,_0x354d0c){_0x1ecccb=_0x1ecccb-0x0;var _0x9ebf3=_0x6b8f[_0x1ecccb];return _0x9ebf3;};'use strict';var client=require('../client');exports[_0xf6b8('0x0')]=function(){return function(){return client['Request'](_0xf6b8('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xf6b8('0x2')],'include':[{'model':_0xf6b8('0x3'),'as':'Agents','attributes':['id',_0xf6b8('0x4'),_0xf6b8('0x5'),_0xf6b8('0x6')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x5c1f=['User','chatPause','getChatQueues','../client','Request','GetChatQueue','timeout','strategy'];(function(_0x56c522,_0x516d15){var _0x4d48b9=function(_0x45c29d){while(--_0x45c29d){_0x56c522['push'](_0x56c522['shift']());}};_0x4d48b9(++_0x516d15);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x14363e,_0x4f0e0d){_0x14363e=_0x14363e-0x0;var _0x17c56d=_0x5c1f[_0x14363e];return _0x17c56d;};'use strict';var client=require(_0xf5c1('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xf5c1('0x1')](_0xf5c1('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xf5c1('0x3'),_0xf5c1('0x4')],'include':[{'model':_0xf5c1('0x5'),'as':'Agents','attributes':['id','name','online',_0xf5c1('0x6')]}]},'log':_0xf5c1('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 85e4209..32b98ac 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 _0x87f8=['update','UpdateChatQueueReport','DESC','Request','CreateChatQueueReport'];(function(_0x50faaa,_0x59d114){var _0x48300e=function(_0x4cdf0f){while(--_0x4cdf0f){_0x50faaa['push'](_0x50faaa['shift']());}};_0x48300e(++_0x59d114);}(_0x87f8,0x152));var _0x887f=function(_0x5e53bc,_0x2abdd8){_0x5e53bc=_0x5e53bc-0x0;var _0x253f1e=_0x87f8[_0x5e53bc];return _0x253f1e;};'use strict';var client=require('../client');exports['create']=function(_0x52e3a6){return client[_0x887f('0x0')](_0x887f('0x1'),{'body':_0x52e3a6,'log':'CreateChatQueueReport'});};exports[_0x887f('0x2')]=function(_0x591ca0,_0x46a51e){return client[_0x887f('0x0')](_0x887f('0x3'),{'body':_0x46a51e,'options':{'where':{'uniqueid':_0x591ca0},'order':[['id',_0x887f('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x3ef0=['../client','CreateChatQueueReport','update','DESC','UpdateChatQueueReport'];(function(_0x37216a,_0x339995){var _0x596ed1=function(_0x2e1fa8){while(--_0x2e1fa8){_0x37216a['push'](_0x37216a['shift']());}};_0x596ed1(++_0x339995);}(_0x3ef0,0x19a));var _0x03ef=function(_0x286305,_0x413532){_0x286305=_0x286305-0x0;var _0x130437=_0x3ef0[_0x286305];return _0x130437;};'use strict';var client=require(_0x03ef('0x0'));exports['create']=function(_0x34c8e7){return client['Request'](_0x03ef('0x1'),{'body':_0x34c8e7,'log':'CreateChatQueueReport'});};exports[_0x03ef('0x2')]=function(_0x2c05c5,_0x321d93){return client['Request']('UpdateChatQueueReport',{'body':_0x321d93,'options':{'where':{'uniqueid':_0x2c05c5},'order':[['id',_0x03ef('0x3')]],'limit':0x1},'log':_0x03ef('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 81e1f11..4daccb5 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(_0x237f36,_0x1c5614){var _0x12e837=function(_0x535524){while(--_0x535524){_0x237f36['push'](_0x237f36['shift']());}};_0x12e837(++_0x1c5614);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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(_0x542305,_0x331f9d){var _0xe21aa9=function(_0x22f7cd){while(--_0x22f7cd){_0x542305['push'](_0x542305['shift']());}};_0xe21aa9(++_0x331f9d);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 8ec590c..7949c93 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 _0x6fee=['../client','createFaxMessage'];(function(_0x2612d9,_0x5e15bd){var _0x35ef95=function(_0x406f84){while(--_0x406f84){_0x2612d9['push'](_0x2612d9['shift']());}};_0x35ef95(++_0x5e15bd);}(_0x6fee,0x128));var _0xe6fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fee[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xe6fe('0x0'));exports['create']=function(_0x33100d){return client['Request']('CreateFaxMessage',{'body':_0x33100d,'log':_0xe6fe('0x1')});}; \ No newline at end of file +var _0x967a=['../client','create','Request','CreateFaxMessage'];(function(_0x4bdda3,_0x25f960){var _0x3f8722=function(_0x341120){while(--_0x341120){_0x4bdda3['push'](_0x4bdda3['shift']());}};_0x3f8722(++_0x25f960);}(_0x967a,0x1b8));var _0xa967=function(_0x204684,_0x32733e){_0x204684=_0x204684-0x0;var _0x1eaec7=_0x967a[_0x204684];return _0x1eaec7;};'use strict';var client=require(_0xa967('0x0'));exports[_0xa967('0x1')]=function(_0xe37ddc){return client[_0xa967('0x2')](_0xa967('0x3'),{'body':_0xe37ddc,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 40ccc8a..c8728b5 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 _0x0560=['faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x47274f,_0x50ed9b){var _0x563b17=function(_0x5e22c4){while(--_0x5e22c4){_0x47274f['push'](_0x47274f['shift']());}};_0x563b17(++_0x50ed9b);}(_0x0560,0xb7));var _0x0056=function(_0x51f689,_0x353f23){_0x51f689=_0x51f689-0x0;var _0x23ab94=_0x0560[_0x51f689];return _0x23ab94;};'use strict';var client=require(_0x0056('0x0'));exports[_0x0056('0x1')]=function(){return function(){return client[_0x0056('0x2')](_0x0056('0x3'),{'options':{'raw':![],'attributes':['id',_0x0056('0x4'),_0x0056('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x0056('0x4'),'online',_0x0056('0x6')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x3b06=['User','faxPause','getFaxQueues','../client','Request','GetFaxQueue','name','timeout','strategy'];(function(_0x1382cb,_0xed117a){var _0x58d5af=function(_0x54efd5){while(--_0x54efd5){_0x1382cb['push'](_0x1382cb['shift']());}};_0x58d5af(++_0xed117a);}(_0x3b06,0xa5));var _0x63b0=function(_0x406115,_0x19f7a1){_0x406115=_0x406115-0x0;var _0xbbabdb=_0x3b06[_0x406115];return _0xbbabdb;};'use strict';var client=require(_0x63b0('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x63b0('0x1')](_0x63b0('0x2'),{'options':{'raw':![],'attributes':['id',_0x63b0('0x3'),_0x63b0('0x4'),_0x63b0('0x5')],'include':[{'model':_0x63b0('0x6'),'as':'Agents','attributes':['id',_0x63b0('0x3'),'online',_0x63b0('0x7')]}]},'log':_0x63b0('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0e9014d..74d80e0 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 _0x43d3=['create','CreateFaxQueueReport','Request','DESC','UpdateFaxQueueReport','../client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x43d3,0x15b));var _0x343d=function(_0x10bc66,_0x234087){_0x10bc66=_0x10bc66-0x0;var _0x26af1c=_0x43d3[_0x10bc66];return _0x26af1c;};'use strict';var client=require(_0x343d('0x0'));exports[_0x343d('0x1')]=function(_0x25eee1){return client['Request']('CreateFaxQueueReport',{'body':_0x25eee1,'log':_0x343d('0x2')});};exports['update']=function(_0x508d2d,_0x22a1b8){return client[_0x343d('0x3')]('UpdateFaxQueueReport',{'body':_0x22a1b8,'options':{'where':{'uniqueid':_0x508d2d},'order':[['id',_0x343d('0x4')]],'limit':0x1},'log':_0x343d('0x5')});}; \ No newline at end of file +var _0xc9aa=['create','CreateFaxQueueReport','Request','UpdateFaxQueueReport','DESC','../client'];(function(_0x1c445a,_0xea7543){var _0x33e4ad=function(_0xbf0ca7){while(--_0xbf0ca7){_0x1c445a['push'](_0x1c445a['shift']());}};_0x33e4ad(++_0xea7543);}(_0xc9aa,0x89));var _0xac9a=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0xc9aa[_0x380307];return _0x9ea14b;};'use strict';var client=require(_0xac9a('0x0'));exports[_0xac9a('0x1')]=function(_0x5a33b0){return client['Request'](_0xac9a('0x2'),{'body':_0x5a33b0,'log':_0xac9a('0x2')});};exports['update']=function(_0x2749d7,_0x4eea12){return client[_0xac9a('0x3')](_0xac9a('0x4'),{'body':_0x4eea12,'options':{'where':{'uniqueid':_0x2749d7},'order':[['id',_0xac9a('0x5')]],'limit':0x1},'log':_0xac9a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index a4c4bce..e263bc2 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 _0xea66=['name','Interval','Intervals','interval','../client','getIntervals','Request'];(function(_0x197f44,_0x132f0a){var _0x199e0d=function(_0x2b3fb3){while(--_0x2b3fb3){_0x197f44['push'](_0x197f44['shift']());}};_0x199e0d(++_0x132f0a);}(_0xea66,0x1e0));var _0x6ea6=function(_0x31e94f,_0x42ecd6){_0x31e94f=_0x31e94f-0x0;var _0x1b8494=_0xea66[_0x31e94f];return _0x1b8494;};'use strict';var client=require(_0x6ea6('0x0'));exports[_0x6ea6('0x1')]=function(){return function(){return client[_0x6ea6('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6ea6('0x3')],'include':[{'model':_0x6ea6('0x4'),'as':_0x6ea6('0x5'),'attributes':['id','name',_0x6ea6('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x9c3f=['Intervals','name','interval','getIntervals','../client','GetInterval','Interval'];(function(_0x1c8253,_0x1c4de2){var _0x380d59=function(_0x5bbf67){while(--_0x5bbf67){_0x1c8253['push'](_0x1c8253['shift']());}};_0x380d59(++_0x1c4de2);}(_0x9c3f,0x1d2));var _0xf9c3=function(_0xcaceaf,_0x50fce3){_0xcaceaf=_0xcaceaf-0x0;var _0x5c639d=_0x9c3f[_0xcaceaf];return _0x5c639d;};'use strict';var client=require(_0xf9c3('0x0'));exports['getIntervals']=function(){return function(){return client['Request'](_0xf9c3('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xf9c3('0x2'),'as':_0xf9c3('0x3'),'attributes':['id',_0xf9c3('0x4'),_0xf9c3('0x5')]}]},'log':_0xf9c3('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 20ae296..8657c38 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 _0x8aad=['addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x8aad,0x146));var _0xd8aa=function(_0x4939ca,_0x1ae562){_0x4939ca=_0x4939ca-0x0;var _0x25fa59=_0x8aad[_0x4939ca];return _0x25fa59;};'use strict';var client=require(_0xd8aa('0x0'));exports[_0xd8aa('0x1')]=function(_0x54a6de,_0x11554c){return client['Request'](_0xd8aa('0x2'),{'body':_0x11554c,'options':{'where':{'id':_0x54a6de}},'log':_0xd8aa('0x3')});};exports['addTags']=function(_0x4a4235,_0x401aef){return client['Request']('AddTagsToMailInteraction',{'body':_0x401aef,'options':{'where':{'id':_0x4a4235}},'log':_0xd8aa('0x4')});}; \ No newline at end of file +var _0x3266=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x5dee28,_0x1645f8){var _0x1207ad=function(_0xe61f2d){while(--_0xe61f2d){_0x5dee28['push'](_0x5dee28['shift']());}};_0x1207ad(++_0x1645f8);}(_0x3266,0x6a));var _0x6326=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0x3266[_0x59d0cc];return _0x2ae79f;};'use strict';var client=require(_0x6326('0x0'));exports[_0x6326('0x1')]=function(_0x3a3ebd,_0x2bed83){return client[_0x6326('0x2')](_0x6326('0x3'),{'body':_0x2bed83,'options':{'where':{'id':_0x3a3ebd}},'log':_0x6326('0x4')});};exports[_0x6326('0x5')]=function(_0x265264,_0x5a6b4d){return client[_0x6326('0x2')]('AddTagsToMailInteraction',{'body':_0x5a6b4d,'options':{'where':{'id':_0x265264}},'log':_0x6326('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 795921b..6ba685d 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 _0xc87d=['CreateMailMessage','createMailMessage','create','Request'];(function(_0x11accf,_0x392f5f){var _0x5ab9dd=function(_0x57bdfc){while(--_0x57bdfc){_0x11accf['push'](_0x11accf['shift']());}};_0x5ab9dd(++_0x392f5f);}(_0xc87d,0xf2));var _0xdc87=function(_0x4c3771,_0x430961){_0x4c3771=_0x4c3771-0x0;var _0x13da8d=_0xc87d[_0x4c3771];return _0x13da8d;};'use strict';var client=require('../client');exports[_0xdc87('0x0')]=function(_0x49f2dd){return client[_0xdc87('0x1')](_0xdc87('0x2'),{'body':_0x49f2dd,'log':_0xdc87('0x3')});}; \ No newline at end of file +var _0x9196=['CreateMailMessage','create'];(function(_0x153162,_0xd7921d){var _0x2f4492=function(_0x23c4ad){while(--_0x23c4ad){_0x153162['push'](_0x153162['shift']());}};_0x2f4492(++_0xd7921d);}(_0x9196,0xd9));var _0x6919=function(_0x283127,_0x54d4d5){_0x283127=_0x283127-0x0;var _0x43da5d=_0x9196[_0x283127];return _0x43da5d;};'use strict';var client=require('../client');exports[_0x6919('0x0')]=function(_0x286317){return client['Request'](_0x6919('0x1'),{'body':_0x286317,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index efb3988..3d464d7 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 _0x3062=['GetMailQueue','timeout','strategy','name','online','getMailQueues','Request'];(function(_0x8e0fc8,_0x30fa0d){var _0x3279c3=function(_0x620b0e){while(--_0x620b0e){_0x8e0fc8['push'](_0x8e0fc8['shift']());}};_0x3279c3(++_0x30fa0d);}(_0x3062,0x1c5));var _0x2306=function(_0x2e7087,_0x112eec){_0x2e7087=_0x2e7087-0x0;var _0xb5b3a6=_0x3062[_0x2e7087];return _0xb5b3a6;};'use strict';var client=require('../client');exports[_0x2306('0x0')]=function(){return function(){return client[_0x2306('0x1')](_0x2306('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x2306('0x3'),_0x2306('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x2306('0x5'),_0x2306('0x6'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0xa30f=['Request','GetMailQueue','name','strategy','User','Agents','online','mailPause','getMailQueues','../client'];(function(_0x28a5b8,_0x167f37){var _0x42d119=function(_0xba3c07){while(--_0xba3c07){_0x28a5b8['push'](_0x28a5b8['shift']());}};_0x42d119(++_0x167f37);}(_0xa30f,0x1d5));var _0xfa30=function(_0x513faa,_0x2d4262){_0x513faa=_0x513faa-0x0;var _0x21fe98=_0xa30f[_0x513faa];return _0x21fe98;};'use strict';var client=require(_0xfa30('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xfa30('0x1')](_0xfa30('0x2'),{'options':{'raw':![],'attributes':['id',_0xfa30('0x3'),'timeout',_0xfa30('0x4')],'include':[{'model':_0xfa30('0x5'),'as':_0xfa30('0x6'),'attributes':['id',_0xfa30('0x3'),_0xfa30('0x7'),_0xfa30('0x8')]}]},'log':_0xfa30('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index ae99e12..a70004b 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 _0x47e0=['Request','UpdateMailQueueReport','DESC','create','CreateMailQueueReport','update'];(function(_0x458c52,_0x5e3fb4){var _0x43f43b=function(_0x5cdfeb){while(--_0x5cdfeb){_0x458c52['push'](_0x458c52['shift']());}};_0x43f43b(++_0x5e3fb4);}(_0x47e0,0x18f));var _0x047e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x47e0[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0x047e('0x0')]=function(_0x24f5f8){return client['Request'](_0x047e('0x1'),{'body':_0x24f5f8,'log':_0x047e('0x1')});};exports[_0x047e('0x2')]=function(_0x3241e3,_0x2d9da9){return client[_0x047e('0x3')](_0x047e('0x4'),{'body':_0x2d9da9,'options':{'where':{'uniqueid':_0x3241e3},'order':[['id',_0x047e('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xa5f5=['../client','create','CreateMailQueueReport','update','Request','UpdateMailQueueReport'];(function(_0x289e6,_0x5e9b29){var _0x3864f3=function(_0x19b779){while(--_0x19b779){_0x289e6['push'](_0x289e6['shift']());}};_0x3864f3(++_0x5e9b29);}(_0xa5f5,0x198));var _0x5a5f=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xa5f5[_0x12f688];return _0x59c3de;};'use strict';var client=require(_0x5a5f('0x0'));exports[_0x5a5f('0x1')]=function(_0x34ecde){return client['Request'](_0x5a5f('0x2'),{'body':_0x34ecde,'log':_0x5a5f('0x2')});};exports[_0x5a5f('0x3')]=function(_0x180819,_0x2c23e8){return client[_0x5a5f('0x4')](_0x5a5f('0x5'),{'body':_0x2c23e8,'options':{'where':{'uniqueid':_0x180819},'order':[['id','DESC']],'limit':0x1},'log':_0x5a5f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 560b530..73f28e9 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 _0x387d=['../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction'];(function(_0x2f4755,_0x72c913){var _0x375bd0=function(_0x331fb3){while(--_0x331fb3){_0x2f4755['push'](_0x2f4755['shift']());}};_0x375bd0(++_0x72c913);}(_0x387d,0x150));var _0xd387=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x387d[_0x4243a3];return _0x1b2a33;};'use strict';var client=require(_0xd387('0x0'));exports['update']=function(_0x4def4b,_0x49a599){return client[_0xd387('0x1')](_0xd387('0x2'),{'body':_0x49a599,'options':{'where':{'id':_0x4def4b}},'log':_0xd387('0x3')});};exports[_0xd387('0x4')]=function(_0x59f4d5,_0x64b6d5){return client[_0xd387('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x64b6d5,'options':{'where':{'id':_0x59f4d5}},'log':_0xd387('0x5')});}; \ No newline at end of file +var _0x170c=['AddTagsToOpenchannelInteraction','../client','Request'];(function(_0x24c162,_0x109aa0){var _0xbfe017=function(_0x5d2330){while(--_0x5d2330){_0x24c162['push'](_0x24c162['shift']());}};_0xbfe017(++_0x109aa0);}(_0x170c,0x1de));var _0xc170=function(_0x3f8c34,_0x1ab4b3){_0x3f8c34=_0x3f8c34-0x0;var _0x237534=_0x170c[_0x3f8c34];return _0x237534;};'use strict';var client=require(_0xc170('0x0'));exports['update']=function(_0x51388f,_0x24251b){return client[_0xc170('0x1')]('UpdateOpenchannelInteraction',{'body':_0x24251b,'options':{'where':{'id':_0x51388f}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x4313dc,_0x5e68c6){return client[_0xc170('0x1')](_0xc170('0x2'),{'body':_0x5e68c6,'options':{'where':{'id':_0x4313dc}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 9940867..4155883 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 _0x879b=['../client','create','createOpenchannelMessage'];(function(_0x550e0c,_0x1102d8){var _0xe44c12=function(_0x3ff10a){while(--_0x3ff10a){_0x550e0c['push'](_0x550e0c['shift']());}};_0xe44c12(++_0x1102d8);}(_0x879b,0x198));var _0xb879=function(_0x23165a,_0x19d021){_0x23165a=_0x23165a-0x0;var _0x40c6c4=_0x879b[_0x23165a];return _0x40c6c4;};'use strict';var client=require(_0xb879('0x0'));exports[_0xb879('0x1')]=function(_0x2689aa){return client['Request']('CreateOpenchannelMessage',{'body':_0x2689aa,'log':_0xb879('0x2')});}; \ No newline at end of file +var _0xc6a1=['Request','CreateOpenchannelMessage','../client','create'];(function(_0x40388c,_0x4c418c){var _0x3c0701=function(_0x3ca095){while(--_0x3ca095){_0x40388c['push'](_0x40388c['shift']());}};_0x3c0701(++_0x4c418c);}(_0xc6a1,0x17e));var _0x1c6a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xc6a1[_0x3e5086];return _0xfeb102;};'use strict';var client=require(_0x1c6a('0x0'));exports[_0x1c6a('0x1')]=function(_0x4763b7){return client[_0x1c6a('0x2')](_0x1c6a('0x3'),{'body':_0x4763b7,'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 ab92f64..8ac8145 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 _0xa716=['Request','GetOpenchannelQueue','strategy','User','Agents','name','online','openchannelPause','getOpenchannelQueues'];(function(_0x3e151b,_0x3da110){var _0x20e9be=function(_0x3826ec){while(--_0x3826ec){_0x3e151b['push'](_0x3e151b['shift']());}};_0x20e9be(++_0x3da110);}(_0xa716,0x10d));var _0x6a71=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xa716[_0x1d1779];return _0x2377e9;};'use strict';var client=require('../client');exports[_0x6a71('0x0')]=function(){return function(){return client[_0x6a71('0x1')](_0x6a71('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x6a71('0x3')],'include':[{'model':_0x6a71('0x4'),'as':_0x6a71('0x5'),'attributes':['id',_0x6a71('0x6'),_0x6a71('0x7'),_0x6a71('0x8')]}]},'log':_0x6a71('0x0')});};}; \ No newline at end of file +var _0xf06f=['openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','User','Agents','online'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0xf06f,0x15f));var _0xff06=function(_0x5954d1,_0x4516d5){_0x5954d1=_0x5954d1-0x0;var _0x1212a5=_0xf06f[_0x5954d1];return _0x1212a5;};'use strict';var client=require(_0xff06('0x0'));exports[_0xff06('0x1')]=function(){return function(){return client[_0xff06('0x2')](_0xff06('0x3'),{'options':{'raw':![],'attributes':['id',_0xff06('0x4'),'timeout',_0xff06('0x5')],'include':[{'model':_0xff06('0x6'),'as':_0xff06('0x7'),'attributes':['id','name',_0xff06('0x8'),_0xff06('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index a5ecadb..daffa7e 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 _0xaaf7=['DESC','../client','create','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport'];(function(_0x7cf754,_0x1f12af){var _0x3a2744=function(_0x4f6505){while(--_0x4f6505){_0x7cf754['push'](_0x7cf754['shift']());}};_0x3a2744(++_0x1f12af);}(_0xaaf7,0x79));var _0x7aaf=function(_0x3f9fa2,_0x1fd8ff){_0x3f9fa2=_0x3f9fa2-0x0;var _0x1a9be8=_0xaaf7[_0x3f9fa2];return _0x1a9be8;};'use strict';var client=require(_0x7aaf('0x0'));exports[_0x7aaf('0x1')]=function(_0x2250b7){return client[_0x7aaf('0x2')](_0x7aaf('0x3'),{'body':_0x2250b7,'log':_0x7aaf('0x3')});};exports['update']=function(_0x43dda6,_0x9900e8){return client['Request'](_0x7aaf('0x4'),{'body':_0x9900e8,'options':{'where':{'uniqueid':_0x43dda6},'order':[['id',_0x7aaf('0x5')]],'limit':0x1},'log':_0x7aaf('0x4')});}; \ No newline at end of file +var _0xdf27=['UpdateOpenchannelQueueReport','DESC','../client','create','CreateOpenchannelQueueReport','Request'];(function(_0x67b075,_0x43557d){var _0x39d030=function(_0x4f25e1){while(--_0x4f25e1){_0x67b075['push'](_0x67b075['shift']());}};_0x39d030(++_0x43557d);}(_0xdf27,0x104));var _0x7df2=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdf27[_0x167cc1];return _0x10bc4b;};'use strict';var client=require(_0x7df2('0x0'));exports[_0x7df2('0x1')]=function(_0x5691ea){return client['Request'](_0x7df2('0x2'),{'body':_0x5691ea,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x5562d9,_0x15c07b){return client[_0x7df2('0x3')](_0x7df2('0x4'),{'body':_0x15c07b,'options':{'where':{'uniqueid':_0x5562d9},'order':[['id',_0x7df2('0x5')]],'limit':0x1},'log':_0x7df2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 6f0ab4a..b85682b 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 _0x5292=['Request','../client','update','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x39eb48,_0x5da47c){var _0x10f0b9=function(_0x2c1631){while(--_0x2c1631){_0x39eb48['push'](_0x39eb48['shift']());}};_0x10f0b9(++_0x5da47c);}(_0x5292,0xf7));var _0x2529=function(_0x2db4b2,_0x5a978b){_0x2db4b2=_0x2db4b2-0x0;var _0x1e993b=_0x5292[_0x2db4b2];return _0x1e993b;};'use strict';var client=require(_0x2529('0x0'));exports[_0x2529('0x1')]=function(_0x5d674c,_0x2ec817){return client['Request'](_0x2529('0x2'),{'body':_0x2ec817,'options':{'where':{'id':_0x5d674c}},'log':_0x2529('0x3')});};exports[_0x2529('0x4')]=function(_0x228165,_0x5d25dc){return client[_0x2529('0x5')]('AddTagsToSmsInteraction',{'body':_0x5d25dc,'options':{'where':{'id':_0x228165}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x383d=['addTags','AddTagsToSmsInteraction','Request','updateSmsInteraction'];(function(_0x5b7106,_0x1dbc12){var _0x390f28=function(_0x49d754){while(--_0x49d754){_0x5b7106['push'](_0x5b7106['shift']());}};_0x390f28(++_0x1dbc12);}(_0x383d,0x86));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports['update']=function(_0xced345,_0x326371){return client[_0xd383('0x0')]('UpdateSmsInteraction',{'body':_0x326371,'options':{'where':{'id':_0xced345}},'log':_0xd383('0x1')});};exports[_0xd383('0x2')]=function(_0x319f67,_0x3439dd){return client[_0xd383('0x0')](_0xd383('0x3'),{'body':_0x3439dd,'options':{'where':{'id':_0x319f67}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index f61c997..18f7add 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 _0xfa24=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x267672,_0x8ce7a5){var _0xa925af=function(_0x48c63d){while(--_0x48c63d){_0x267672['push'](_0x267672['shift']());}};_0xa925af(++_0x8ce7a5);}(_0xfa24,0xf7));var _0x4fa2=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0xfa24[_0x143a91];return _0x1906f5;};'use strict';var client=require(_0x4fa2('0x0'));exports[_0x4fa2('0x1')]=function(_0x14fc52){return client[_0x4fa2('0x2')](_0x4fa2('0x3'),{'body':_0x14fc52,'log':_0x4fa2('0x4')});}; \ No newline at end of file +var _0x3a59=['CreateSmsMessage','../client','create','Request'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x3a59,0xc5));var _0x93a5=function(_0x497b1e,_0x586379){_0x497b1e=_0x497b1e-0x0;var _0x3f72e1=_0x3a59[_0x497b1e];return _0x3f72e1;};'use strict';var client=require(_0x93a5('0x0'));exports[_0x93a5('0x1')]=function(_0x4dd82b){return client[_0x93a5('0x2')](_0x93a5('0x3'),{'body':_0x4dd82b,'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 1ca0a82..7e2f7d8 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(_0x58dab6,_0x1a1abc){var _0x442581=function(_0xb535c){while(--_0xb535c){_0x58dab6['push'](_0x58dab6['shift']());}};_0x442581(++_0x1a1abc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('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 _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x50adac,_0x5975fd){var _0x36f629=function(_0x27e1d8){while(--_0x27e1d8){_0x50adac['push'](_0x50adac['shift']());}};_0x36f629(++_0x5975fd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0xcb91[_0x1fd9e7];return _0x1781f2;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'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 4cb5aa9..e97659f 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 _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x18874d,_0x34181a){var _0x3de184=function(_0x5a874d){while(--_0x5a874d){_0x18874d['push'](_0x18874d['shift']());}};_0x3de184(++_0x34181a);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x4ceb68,_0x3e0a77){var _0x7b1ae=function(_0x4cd88c){while(--_0x4cd88c){_0x4ceb68['push'](_0x4ceb68['shift']());}};_0x7b1ae(++_0x3e0a77);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 941431e..54f3f9e 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(_0x2023bd,_0xc09229){var _0x179caf=function(_0x2e6e48){while(--_0x2e6e48){_0x2023bd['push'](_0x2023bd['shift']());}};_0x179caf(++_0xc09229);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x4d97da,_0x40b24f){var _0x276156=function(_0x298f70){while(--_0x298f70){_0x4d97da['push'](_0x4d97da['shift']());}};_0x276156(++_0x40b24f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 f7bd7e2..2d817ac 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 _0x8daf=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','Request','UpdateWhatsappInteraction'];(function(_0x58e253,_0x30a9c3){var _0x2ffe75=function(_0x22d30b){while(--_0x22d30b){_0x58e253['push'](_0x58e253['shift']());}};_0x2ffe75(++_0x30a9c3);}(_0x8daf,0x15c));var _0xf8da=function(_0x477358,_0x30f5b8){_0x477358=_0x477358-0x0;var _0x19bf04=_0x8daf[_0x477358];return _0x19bf04;};'use strict';var client=require('../client');exports['update']=function(_0x5836b2,_0x56529b){return client[_0xf8da('0x0')](_0xf8da('0x1'),{'body':_0x56529b,'options':{'where':{'id':_0x5836b2}},'log':'updateWhatsappInteraction'});};exports[_0xf8da('0x2')]=function(_0x109758,_0x258561){return client[_0xf8da('0x0')](_0xf8da('0x3'),{'body':_0x258561,'options':{'where':{'id':_0x109758}},'log':_0xf8da('0x4')});}; \ No newline at end of file +var _0x7ed1=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x32877b,_0x1fe47b){var _0x449a3e=function(_0xf246c4){while(--_0xf246c4){_0x32877b['push'](_0x32877b['shift']());}};_0x449a3e(++_0x1fe47b);}(_0x7ed1,0xca));var _0x17ed=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x7ed1[_0x5f09c5];return _0x426ad9;};'use strict';var client=require(_0x17ed('0x0'));exports['update']=function(_0x10553a,_0x257429){return client[_0x17ed('0x1')](_0x17ed('0x2'),{'body':_0x257429,'options':{'where':{'id':_0x10553a}},'log':_0x17ed('0x3')});};exports[_0x17ed('0x4')]=function(_0x54bf1f,_0x2fdcd3){return client[_0x17ed('0x1')](_0x17ed('0x5'),{'body':_0x2fdcd3,'options':{'where':{'id':_0x54bf1f}},'log':_0x17ed('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 3fcc476..b70d2fa 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 _0x5833=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x335dc6,_0x5f1e5f){var _0x334d3e=function(_0x3c77e3){while(--_0x3c77e3){_0x335dc6['push'](_0x335dc6['shift']());}};_0x334d3e(++_0x5f1e5f);}(_0x5833,0x186));var _0x3583=function(_0x7e56a0,_0x58044a){_0x7e56a0=_0x7e56a0-0x0;var _0x417086=_0x5833[_0x7e56a0];return _0x417086;};'use strict';var client=require(_0x3583('0x0'));exports[_0x3583('0x1')]=function(_0xf857d4){return client[_0x3583('0x2')](_0x3583('0x3'),{'body':_0xf857d4,'log':_0x3583('0x4')});}; \ No newline at end of file +var _0x494f=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x3a6a2b,_0x1cc6a4){var _0xe3ebf3=function(_0x4a1580){while(--_0x4a1580){_0x3a6a2b['push'](_0x3a6a2b['shift']());}};_0xe3ebf3(++_0x1cc6a4);}(_0x494f,0x19b));var _0xf494=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0x494f[_0x1e6b59];return _0x40d7c5;};'use strict';var client=require(_0xf494('0x0'));exports[_0xf494('0x1')]=function(_0x16d83a){return client[_0xf494('0x2')](_0xf494('0x3'),{'body':_0x16d83a,'log':_0xf494('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 51bf569..bc91339 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 _0xea74=['timeout','User','Agents','online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xea74,0x1c7));var _0x4ea7=function(_0xbec35,_0x11925e){_0xbec35=_0xbec35-0x0;var _0x49a10e=_0xea74[_0xbec35];return _0x49a10e;};'use strict';var client=require('../client');exports[_0x4ea7('0x0')]=function(){return function(){return client[_0x4ea7('0x1')](_0x4ea7('0x2'),{'options':{'raw':![],'attributes':['id',_0x4ea7('0x3'),_0x4ea7('0x4'),'strategy'],'include':[{'model':_0x4ea7('0x5'),'as':_0x4ea7('0x6'),'attributes':['id','name',_0x4ea7('0x7'),_0x4ea7('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x7cc9=['online','GetWhatsappQueue','name','strategy','User'];(function(_0x156920,_0x1b9d56){var _0x120315=function(_0x516dc5){while(--_0x516dc5){_0x156920['push'](_0x156920['shift']());}};_0x120315(++_0x1b9d56);}(_0x7cc9,0xe2));var _0x97cc=function(_0x5b8646,_0x3e1589){_0x5b8646=_0x5b8646-0x0;var _0x363e4c=_0x7cc9[_0x5b8646];return _0x363e4c;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x97cc('0x0'),{'options':{'raw':![],'attributes':['id',_0x97cc('0x1'),'timeout',_0x97cc('0x2')],'include':[{'model':_0x97cc('0x3'),'as':'Agents','attributes':['id',_0x97cc('0x1'),_0x97cc('0x4'),'whatsappPause']}]},'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 a1740ff..6cad1ac 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 _0xafb4=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x3a8097,_0x34e0ec){var _0x5cfe3d=function(_0x44fbd6){while(--_0x44fbd6){_0x3a8097['push'](_0x3a8097['shift']());}};_0x5cfe3d(++_0x34e0ec);}(_0xafb4,0x8a));var _0x4afb=function(_0x5b5f69,_0x1bd2c5){_0x5b5f69=_0x5b5f69-0x0;var _0x33f05f=_0xafb4[_0x5b5f69];return _0x33f05f;};'use strict';var client=require(_0x4afb('0x0'));exports[_0x4afb('0x1')]=function(_0x1d2a80){return client[_0x4afb('0x2')](_0x4afb('0x3'),{'body':_0x1d2a80,'log':_0x4afb('0x3')});};exports[_0x4afb('0x4')]=function(_0x5ddfdc,_0xc2712b){return client[_0x4afb('0x2')](_0x4afb('0x5'),{'body':_0xc2712b,'options':{'where':{'uniqueid':_0x5ddfdc},'order':[['id','DESC']],'limit':0x1},'log':_0x4afb('0x5')});}; \ No newline at end of file +var _0x8f1e=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create'];(function(_0x58198f,_0x6964e0){var _0x449084=function(_0x1f86a1){while(--_0x1f86a1){_0x58198f['push'](_0x58198f['shift']());}};_0x449084(++_0x6964e0);}(_0x8f1e,0x1eb));var _0xe8f1=function(_0x638108,_0x1c68cb){_0x638108=_0x638108-0x0;var _0x6cd7bc=_0x8f1e[_0x638108];return _0x6cd7bc;};'use strict';var client=require('../client');exports[_0xe8f1('0x0')]=function(_0x32f5b3){return client[_0xe8f1('0x1')](_0xe8f1('0x2'),{'body':_0x32f5b3,'log':_0xe8f1('0x2')});};exports[_0xe8f1('0x3')]=function(_0x11f5da,_0x58c14d){return client[_0xe8f1('0x1')](_0xe8f1('0x4'),{'body':_0x58c14d,'options':{'where':{'uniqueid':_0x11f5da},'order':[['id',_0xe8f1('0x5')]],'limit':0x1},'log':_0xe8f1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index fa5195e..3f07bf8 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 _0x5db6=['end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','message','stop','agents','timeout','createQueue','atimeout','channel','START:%s','rules'];(function(_0x4882d2,_0x11d8af){var _0x22c366=function(_0x5c5119){while(--_0x5c5119){_0x4882d2['push'](_0x4882d2['shift']());}};_0x22c366(++_0x11d8af);}(_0x5db6,0x88));var _0x65db=function(_0x481c41,_0x48ba3c){_0x481c41=_0x481c41-0x0;var _0xf91fd=_0x5db6[_0x481c41];return _0xf91fd;};'use strict';var schema=require(_0x65db('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x65db('0x1'));var strategy=require(_0x65db('0x2'));var queue=schema({'name':{'type':_0x65db('0x3'),'required':!![],'message':_0x65db('0x4')},'timeout':{'type':_0x65db('0x5'),'message':_0x65db('0x6')}});function writeLog(_0x27db95,_0x359e87,_0x45f65a){return logger[_0x65db('0x7')](util[_0x65db('0x8')](_0x65db('0x9'),_0x27db95,_0x359e87[_0x65db('0xa')],_0x45f65a));}function handleFindAgent(_0x439251){return function(_0x12052b){return _0x12052b[_0x65db('0xa')][_0x65db('0xb')]()===_0x439251[_0x65db('0xb')]();};}exports['consequence']=function(_0x411e29,_0x3a5e8a,_0x4991c7,_0x533bd0){return function(_0x184255){try{var _0x2fe874={'name':_0x3a5e8a[0x0],'timeout':_0x3a5e8a[0x1]};var _0x34f32b=queue['validate'](_0x2fe874,{'typecast':!![]});if(_0x34f32b[_0x65db('0xc')]){logger[_0x65db('0xd')](_0x65db('0xe'),_0x411e29,_['map'](_0x34f32b,_0x65db('0xf'))['join'](',\x20'));_0x184255[_0x65db('0x10')]();}else{var _0x419602=_['find'](_0x4991c7[_0x65db('0x11')],handleFindAgent(_0x2fe874[_0x65db('0xa')]));if(_0x419602){var _0x472e28=(_0x2fe874[_0x65db('0x12')]||0xa)*0x3e8;var _0x2c6c3f,_0x424af1;var _0x22ab95=seqqueue[_0x65db('0x13')](_0x472e28);_0x22ab95['id']=_0x411e29;_0x22ab95[_0x65db('0x14')]=_0x472e28;_0x22ab95[_0x65db('0x15')]=_0x533bd0['channel'];writeLog(_0x411e29,_0x419602,util[_0x65db('0x8')](_0x65db('0x16'),_0x472e28));_0x4991c7[_0x65db('0x17')][_0x411e29]['on'](_0x65db('0x18'),function(){logger[_0x65db('0x7')](_0x65db('0x19'),_0x411e29);clearTimeout(_0x424af1);_0x424af1=undefined;_0x22ab95[_0x65db('0x1a')]();if(_0x4991c7[_0x65db('0x17')][_0x411e29]){delete _0x4991c7[_0x65db('0x17')][_0x411e29];}_0x184255[_0x65db('0x10')]();});_0x4991c7[_0x65db('0x17')][_0x411e29]['on'](_0x65db('0x1b'),function(){if(_0x4991c7[_0x65db('0x17')][_0x411e29]){delete _0x4991c7[_0x65db('0x17')][_0x411e29];}});_0x424af1=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x411e29);clearTimeout(_0x424af1);_0x22ab95[_0x65db('0x1a')]();_0x184255['next']();},_0x472e28);strategy[_0x65db('0x1c')](_0x22ab95,_0x419602,_0x4991c7,_0x533bd0);}else{logger[_0x65db('0xd')](_0x65db('0x1d'),_0x411e29,_0x2fe874['name']);_0x184255[_0x65db('0x10')]();}}}catch(_0x3deae8){console['log'](_0x3deae8);logger[_0x65db('0xd')](_0x65db('0x1e'),_0x411e29,_0x3deae8[_0x65db('0x1f')]);_0x184255[_0x65db('0x10')]();}};}; \ No newline at end of file +var _0x8601=['log','[%s][QUEUE]\x20%s','stack','validate','lodash','../../../../config/logger','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','stop','find','agents','channel','START:%s','rules','end','complete','[%s][AGENT]\x20ROUTING\x20END','close','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x3ca9c6,_0x1588fe){var _0x32505f=function(_0x3a41ff){while(--_0x3a41ff){_0x3ca9c6['push'](_0x3ca9c6['shift']());}};_0x32505f(++_0x1588fe);}(_0x8601,0x123));var _0x1860=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8601[_0x432682];return _0x463d05;};'use strict';var schema=require(_0x1860('0x0'));var _=require(_0x1860('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x1860('0x2'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x1860('0x3'),'required':!![],'message':_0x1860('0x4')},'timeout':{'type':_0x1860('0x5'),'message':_0x1860('0x6')}});function writeLog(_0x4a5fef,_0x355cbb,_0x10e22a){return logger[_0x1860('0x7')](util[_0x1860('0x8')](_0x1860('0x9'),_0x4a5fef,_0x355cbb[_0x1860('0xa')],_0x10e22a));}function handleFindAgent(_0x32dc46){return function(_0x382d29){return _0x382d29[_0x1860('0xa')][_0x1860('0xb')]()===_0x32dc46[_0x1860('0xb')]();};}exports['consequence']=function(_0x302aca,_0x7ada1,_0x2b831b,_0x357d9e){return function(_0x1e83b6){try{var _0x13919d={'name':_0x7ada1[0x0],'timeout':_0x7ada1[0x1]};var _0x2c0d3a=queue[_0x1860('0x0')](_0x13919d,{'typecast':!![]});if(_0x2c0d3a[_0x1860('0xc')]){logger[_0x1860('0xd')](_0x1860('0xe'),_0x302aca,_[_0x1860('0xf')](_0x2c0d3a,_0x1860('0x10'))['join'](',\x20'));_0x1e83b6[_0x1860('0x11')]();}else{var _0x3d3a13=_[_0x1860('0x12')](_0x2b831b[_0x1860('0x13')],handleFindAgent(_0x13919d['name']));if(_0x3d3a13){var _0x494555=(_0x13919d['timeout']||0xa)*0x3e8;var _0x1fba98,_0x39f77e;var _0x4e5a34=seqqueue['createQueue'](_0x494555);_0x4e5a34['id']=_0x302aca;_0x4e5a34['atimeout']=_0x494555;_0x4e5a34[_0x1860('0x14')]=_0x357d9e['channel'];writeLog(_0x302aca,_0x3d3a13,util[_0x1860('0x8')](_0x1860('0x15'),_0x494555));_0x2b831b[_0x1860('0x16')][_0x302aca]['on'](_0x1860('0x17'),function(){logger[_0x1860('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x302aca);clearTimeout(_0x39f77e);_0x39f77e=undefined;_0x4e5a34['close']();if(_0x2b831b[_0x1860('0x16')][_0x302aca]){delete _0x2b831b[_0x1860('0x16')][_0x302aca];}_0x1e83b6[_0x1860('0x11')]();});_0x2b831b['rules'][_0x302aca]['on'](_0x1860('0x18'),function(){if(_0x2b831b[_0x1860('0x16')][_0x302aca]){delete _0x2b831b[_0x1860('0x16')][_0x302aca];}});_0x39f77e=setTimeout(function(){logger['info'](_0x1860('0x19'),_0x302aca);clearTimeout(_0x39f77e);_0x4e5a34[_0x1860('0x1a')]();_0x1e83b6['next']();},_0x494555);strategy[_0x1860('0x1b')](_0x4e5a34,_0x3d3a13,_0x2b831b,_0x357d9e);}else{logger[_0x1860('0xd')](_0x1860('0x1c'),_0x302aca,_0x13919d['name']);_0x1e83b6['stop']();}}}catch(_0x2292c0){console[_0x1860('0x1d')](_0x2292c0);logger[_0x1860('0xd')](_0x1860('0x1e'),_0x302aca,_0x2292c0[_0x1860('0x1f')]);_0x1e83b6[_0x1860('0x11')]();}};}; \ 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 504ec87..cc6d989 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 _0xd71d=['create','dialogState','stop','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','InteractionId','created','body','Message','then','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','LexRuntime','$LATEST','message','postText','amazonlex','providerName','providerResponse'];(function(_0x44097b,_0x5daa7d){var _0x581614=function(_0xb2120){while(--_0xb2120){_0x44097b['push'](_0x44097b['shift']());}};_0x581614(++_0x5daa7d);}(_0xd71d,0x1dc));var _0xdd71=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xd71d[_0x176329];return _0x31997c;};'use strict';var _=require(_0xdd71('0x0'));var moment=require(_0xdd71('0x1'));var AWS=require(_0xdd71('0x2'));var utils=require('./utils');var logger=require(_0xdd71('0x3'))(_0xdd71('0x4'));var rpc={'chatMessage':require(_0xdd71('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xdd71('0x6')),'smsMessage':require(_0xdd71('0x7')),'faxMessage':require(_0xdd71('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x11294f,_0x2474f3){return function(_0xdfb7ec){try{if(!_[_0xdd71('0x9')](this[_0xdd71('0xa')]['UserId'])){logger[_0xdd71('0xb')](_0xdd71('0xc'),_0x11294f,_0xdd71('0xd'));return _0xdfb7ec[_0xdd71('0xe')]();}var _0x47e1b4={'ContactId':this['contact']['id'],'sentAt':moment()[_0xdd71('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xdd71('0x10')};if(this[_0xdd71('0x11')]===_0xdd71('0x12')||this['channel']===_0xdd71('0x13')){_0x47e1b4[_0xdd71('0x14')]=this[_0xdd71('0xa')][_0xdd71('0x14')];}var _0x1c4137=this[_0xdd71('0x11')];if(_0x1c4137===_0xdd71('0x15')){_0x47e1b4[_0xdd71('0x16')]=this[_0xdd71('0x17')]['id'];}else{_0x47e1b4[_['upperFirst'](_0x1c4137)+'AccountId']=this['account']['id'];}_0x47e1b4[_['upperFirst'](_0x1c4137)+_0xdd71('0x18')]=this['interaction']['id'];if(this[_0xdd71('0xa')][_0xdd71('0x19')]){var _0x43b819=_0x2474f3[0x4];if(!_['isEmpty'](_0x43b819)){_0x47e1b4[_0xdd71('0x1a')]=utils['getMustacheRender'](_0x43b819,this);return rpc[_0x1c4137+_0xdd71('0x1b')]['create'](_0x47e1b4)[_0xdd71('0x1c')](function(_0x7a0b04){logger[_0xdd71('0xb')](_0xdd71('0xc'),_0x11294f,_0x47e1b4[_0xdd71('0x1a')]);})[_0xdd71('0x1d')](function(_0x339d07){logger[_0xdd71('0x1e')](_0xdd71('0xc'),_0x11294f,JSON[_0xdd71('0x1f')](_0x339d07));})['finally'](function(){logger[_0xdd71('0xb')](_0xdd71('0x20'),_0x11294f);_0xdfb7ec['stop']();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x11294f);_0xdfb7ec['stop']();}}else{var _0x3e9585=this;var _0x37c450=new AWS[(_0xdd71('0x21'))]({'accessKeyId':_0x2474f3[0x0],'secretAccessKey':_0x2474f3[0x1],'region':_0x2474f3[0x2]});var _0x58dfb6={'botAlias':_0xdd71('0x22'),'botName':_0x2474f3[0x3],'inputText':this[_0xdd71('0x23')][_0xdd71('0x1a')],'userId':this[_0xdd71('0x11')]+':'+this[_0xdd71('0xa')]['id']['toString']()};_0x37c450[_0xdd71('0x24')](_0x58dfb6,function(_0x1747ec,_0x5f4948){if(_0x1747ec){logger[_0xdd71('0x1e')](_0xdd71('0xc'),_0x11294f,_0x1747ec['message']);_0xdfb7ec[_0xdd71('0xe')]();}else if(_0x5f4948&&_0x5f4948[_0xdd71('0x23')]){_0x3e9585['body'][_0xdd71('0x25')]=_0x5f4948;_0x47e1b4[_0xdd71('0x1a')]=_0x5f4948[_0xdd71('0x23')];_0x47e1b4[_0xdd71('0x26')]='amazonlex';_0x47e1b4[_0xdd71('0x27')]=JSON[_0xdd71('0x1f')](_0x5f4948);return rpc[_0x1c4137+_0xdd71('0x1b')][_0xdd71('0x28')](_0x47e1b4)['then'](function(_0x524d4b){logger[_0xdd71('0xb')](_0xdd71('0xc'),_0x11294f,_0x47e1b4[_0xdd71('0x1a')]);if(_0x5f4948[_0xdd71('0x29')]=='Failed'){_0xdfb7ec[_0xdd71('0xe')]();}else{_0xdfb7ec[_0xdd71('0x2a')]();}})[_0xdd71('0x1d')](function(_0xbc63bb){logger[_0xdd71('0x1e')](_0xdd71('0xc'),_0x11294f,JSON[_0xdd71('0x1f')](_0xbc63bb));_0xdfb7ec[_0xdd71('0xe')]();});}else{_0xdfb7ec['next']();}});}}catch(_0x55cfd8){logger['error'](_0xdd71('0xc'),_0x11294f,JSON['stringify'](_0x55cfd8));_0xdfb7ec['stop']();}};}; \ No newline at end of file +var _0x000b=['phone','chat','ChatWebsiteId','account','upperFirst','AccountId','isEmpty','body','getMustacheRender','Message','create','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','postText','amazonlex','providerName','providerResponse','stringify','then','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel'];(function(_0x1d1331,_0x17d5d5){var _0x37e107=function(_0x450872){while(--_0x450872){_0x1d1331['push'](_0x1d1331['shift']());}};_0x37e107(++_0x17d5d5);}(_0x000b,0xd3));var _0xb000=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0x000b[_0x3ec1da];return _0x472358;};'use strict';var _=require(_0xb000('0x0'));var moment=require(_0xb000('0x1'));var AWS=require(_0xb000('0x2'));var utils=require(_0xb000('0x3'));var logger=require(_0xb000('0x4'))(_0xb000('0x5'));var rpc={'chatMessage':require(_0xb000('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb000('0x7')),'faxMessage':require(_0xb000('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x28849e,_0x4141f6){return function(_0x25d671){try{if(!_['isNil'](this[_0xb000('0x9')]['UserId'])){logger[_0xb000('0xa')](_0xb000('0xb'),_0x28849e,_0xb000('0xc'));return _0x25d671[_0xb000('0xd')]();}var _0x3bb88d={'ContactId':this[_0xb000('0xe')]['id'],'sentAt':moment()[_0xb000('0xf')](_0xb000('0x10')),'direction':_0xb000('0x11')};if(this[_0xb000('0x12')]==='sms'||this[_0xb000('0x12')]==='whatsapp'){_0x3bb88d[_0xb000('0x13')]=this[_0xb000('0x9')][_0xb000('0x13')];}var _0x4d7bf7=this[_0xb000('0x12')];if(_0x4d7bf7===_0xb000('0x14')){_0x3bb88d[_0xb000('0x15')]=this[_0xb000('0x16')]['id'];}else{_0x3bb88d[_[_0xb000('0x17')](_0x4d7bf7)+_0xb000('0x18')]=this[_0xb000('0x16')]['id'];}_0x3bb88d[_['upperFirst'](_0x4d7bf7)+'InteractionId']=this[_0xb000('0x9')]['id'];if(this[_0xb000('0x9')]['created']){var _0x18b16a=_0x4141f6[0x4];if(!_[_0xb000('0x19')](_0x18b16a)){_0x3bb88d[_0xb000('0x1a')]=utils[_0xb000('0x1b')](_0x18b16a,this);return rpc[_0x4d7bf7+_0xb000('0x1c')][_0xb000('0x1d')](_0x3bb88d)['then'](function(_0x55c821){logger[_0xb000('0xa')](_0xb000('0xb'),_0x28849e,_0x3bb88d[_0xb000('0x1a')]);})[_0xb000('0x1e')](function(_0x5517ed){logger[_0xb000('0x1f')](_0xb000('0xb'),_0x28849e,JSON['stringify'](_0x5517ed));})[_0xb000('0x20')](function(){logger[_0xb000('0xa')](_0xb000('0x21'),_0x28849e);_0x25d671[_0xb000('0x22')]();});}else{logger['info'](_0xb000('0x23'),_0x28849e);_0x25d671[_0xb000('0x22')]();}}else{var _0x3602d1=this;var _0x5e787c=new AWS[(_0xb000('0x24'))]({'accessKeyId':_0x4141f6[0x0],'secretAccessKey':_0x4141f6[0x1],'region':_0x4141f6[0x2]});var _0x356193={'botAlias':'$LATEST','botName':_0x4141f6[0x3],'inputText':this[_0xb000('0x25')][_0xb000('0x1a')],'userId':this[_0xb000('0x12')]+':'+this[_0xb000('0x9')]['id']['toString']()};_0x5e787c[_0xb000('0x26')](_0x356193,function(_0x38ab7a,_0x5679b1){if(_0x38ab7a){logger[_0xb000('0x1f')](_0xb000('0xb'),_0x28849e,_0x38ab7a[_0xb000('0x25')]);_0x25d671['next']();}else if(_0x5679b1&&_0x5679b1[_0xb000('0x25')]){_0x3602d1[_0xb000('0x1a')][_0xb000('0x27')]=_0x5679b1;_0x3bb88d['body']=_0x5679b1[_0xb000('0x25')];_0x3bb88d[_0xb000('0x28')]=_0xb000('0x27');_0x3bb88d[_0xb000('0x29')]=JSON[_0xb000('0x2a')](_0x5679b1);return rpc[_0x4d7bf7+_0xb000('0x1c')]['create'](_0x3bb88d)[_0xb000('0x2b')](function(_0x286eea){logger[_0xb000('0xa')](_0xb000('0xb'),_0x28849e,_0x3bb88d['body']);if(_0x5679b1[_0xb000('0x2c')]==_0xb000('0x2d')){_0x25d671[_0xb000('0xd')]();}else{_0x25d671[_0xb000('0x22')]();}})[_0xb000('0x1e')](function(_0x319c0a){logger[_0xb000('0x1f')](_0xb000('0xb'),_0x28849e,JSON['stringify'](_0x319c0a));_0x25d671[_0xb000('0xd')]();});}else{_0x25d671['next']();}});}}catch(_0x1ed6a7){logger[_0xb000('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x28849e,JSON['stringify'](_0x1ed6a7));_0x25d671[_0xb000('0x22')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index af692a7..5e31d19 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 _0x20f6=['sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','then','error','stringify','finally','resolve','Interaction','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','consequence','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','body','getMustacheRender','message','from','channel','phone','read','subject','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','Smtp','service','port','secure','authentication','user','inReplyTo','messageId','html','','replace','','headers','auto-replied','auto_reply'];(function(_0x2c3a47,_0x170687){var _0x1c04de=function(_0x367deb){while(--_0x367deb){_0x2c3a47['push'](_0x2c3a47['shift']());}};_0x1c04de(++_0x170687);}(_0x20f6,0x9c));var _0x620f=function(_0x5f1844,_0x593fdf){_0x5f1844=_0x5f1844-0x0;var _0x536d93=_0x20f6[_0x5f1844];return _0x536d93;};'use strict';var _=require(_0x620f('0x0'));var moment=require(_0x620f('0x1'));var utils=require(_0x620f('0x2'));var logger=require(_0x620f('0x3'))(_0x620f('0x4'));var rpc={'chatMessage':require(_0x620f('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x620f('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x620f('0x7')),'openchannelInteraction':require(_0x620f('0x8')),'mailInteraction':require(_0x620f('0x9')),'smsInteraction':require(_0x620f('0xa')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x620f('0xb'))};var mailRpc=require('../../mailRpc');exports[_0x620f('0xc')]=function(_0x3432fd,_0xddc565,_0x5e92c2,_0xdb3322){return function(_0x1acd85){try{var _0x2fa896=this['channel'];if(_0x2fa896===_0x620f('0xd')&&_0xdb3322['body'][_0x620f('0xe')]){logger[_0x620f('0xf')](_0x620f('0x10'),_0x3432fd,_0x620f('0x11'));return _0x1acd85['next']();}if(_0xddc565[0x0]==='1'&&(_[_0x620f('0x12')](this[_0x620f('0x13')][_0x620f('0x14')])||!this['interaction']['created'])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x3432fd,_0x620f('0x15'));return _0x1acd85[_0x620f('0x16')]();}if(_0xddc565[0x0]==='2'&&this[_0x620f('0x13')][_0x620f('0x17')]){logger[_0x620f('0xf')](_0x620f('0x18'),_0x3432fd,_0x620f('0x19'));return _0x1acd85[_0x620f('0x16')]();}var _0x3fc41c={'ContactId':this[_0x620f('0x1a')]['id'],'sentAt':moment()['format'](_0x620f('0x1b')),'direction':'out'};if(this['channel']==='mail'){_0x3fc41c[_0x620f('0x1c')]=utils[_0x620f('0x1d')](_0xddc565[0x2],this);}else{_0x3fc41c[_0x620f('0x1c')]=utils[_0x620f('0x1d')](_0xddc565[0x1],this);}if(this[_0x620f('0x1e')]){_0x3fc41c['to']=this[_0x620f('0x1e')][_0x620f('0x1f')]||'';if(this[_0x620f('0x20')]===_0x620f('0xd')&&_0xddc565[0x1]==='1'){_0x3fc41c['cc']=this['message']['cc']||'';}_0x3fc41c[_0x620f('0x1f')]=this[_0x620f('0x1e')]['to']||'';_0x3fc41c[_0x620f('0x21')]=this[_0x620f('0x1e')]['phone']||'';_0x3fc41c[_0x620f('0x22')]=!![];if(this[_0x620f('0x1e')][_0x620f('0x23')]){_0x3fc41c[_0x620f('0x23')]='';_0x3fc41c[_0x620f('0x23')]+=_['startsWith'](this['message'][_0x620f('0x23')],'Re:')?'':_0x620f('0x24');_0x3fc41c['subject']+=this['message'][_0x620f('0x23')];}}if(this['channel']===_0x620f('0x25')){_0x3fc41c[_0x620f('0x26')]=this[_0x620f('0x27')]['id'];}else{_0x3fc41c[_[_0x620f('0x28')](this[_0x620f('0x20')])+'AccountId']=this['account']['id'];}_0x3fc41c[_[_0x620f('0x28')](this[_0x620f('0x20')])+_0x620f('0x29')]=this[_0x620f('0x13')]['id'];var _0x581177=this[_0x620f('0x13')];if(rpc[this[_0x620f('0x20')]+_0x620f('0x2a')]){if(this['channel']===_0x620f('0xd')){var _0x5191de={'tls':{'rejectUnauthorized':![]}};if(this[_0x620f('0x27')][_0x620f('0x2b')][_0x620f('0x2c')]){_0x5191de[_0x620f('0x2c')]=this[_0x620f('0x27')][_0x620f('0x2b')][_0x620f('0x2c')];}else{_0x5191de['host']=this[_0x620f('0x27')][_0x620f('0x2b')]['host'];_0x5191de['port']=this['account']['Smtp'][_0x620f('0x2d')];_0x5191de[_0x620f('0x2e')]=this[_0x620f('0x27')]['Smtp'][_0x620f('0x2e')];}if(this['account'][_0x620f('0x2b')][_0x620f('0x2f')]){_0x5191de['auth']={'user':this[_0x620f('0x27')][_0x620f('0x2b')][_0x620f('0x30')],'pass':this[_0x620f('0x27')][_0x620f('0x2b')]['pass']};}_0x3fc41c[_0x620f('0x31')]=this[_0x620f('0x1e')][_0x620f('0x32')];_0x3fc41c[_0x620f('0x33')]=_0x620f('0x34')+_[_0x620f('0x35')](_0x3fc41c[_0x620f('0x1c')],_0x620f('0x36'),_0x620f('0x37'))+_0x620f('0x38');_0x3fc41c[_0x620f('0x39')]={'Auto-Submitted':_0x620f('0x3a'),'X-Auto-Response-Suppress':'All','Precedence':_0x620f('0x3b')};return mailRpc[_0x620f('0x3c')](_0x5191de,_0x3fc41c)['then'](function(_0x18d1a8){logger[_0x620f('0xf')](_0x620f('0x3d'),_0x3432fd);_0x3fc41c['messageId']=_0x18d1a8[_0x620f('0x1e')][_0x620f('0x32')];return rpc[_0x2fa896+_0x620f('0x2a')]['create'](_0x3fc41c);})[_0x620f('0x3e')](function(_0x5505eb){logger['info']('[%s][AUTOREPLY]\x20%s',_0x3432fd,JSON['stringify'](_0x5505eb));})['catch'](function(_0x461e13){logger[_0x620f('0x3f')]('[RPC][%s][AUTOREPLY]\x20%s',_0x3432fd,JSON[_0x620f('0x40')](_0x461e13));})[_0x620f('0x41')](function(){Promise[_0x620f('0x42')]()['then'](function(){if(_0xddc565[0x0]!=='2'||_0x581177[_0x620f('0x17')])return;return rpc[_0x2fa896+_0x620f('0x43')][_0x620f('0x44')](_0x581177['id'],{'autoreplyExecuted':!![]})[_0x620f('0x3e')](function(_0x16f71e){logger[_0x620f('0xf')](_0x620f('0x18'),_0x3432fd,JSON[_0x620f('0x40')](_0x16f71e));})[_0x620f('0x45')](function(_0x1bb180){logger[_0x620f('0x3f')](_0x620f('0x46'),_0x3432fd,JSON[_0x620f('0x40')](_0x1bb180));});})[_0x620f('0x3e')](function(){_0x1acd85[_0x620f('0x16')]();});});}else{return rpc[this[_0x620f('0x20')]+'Message'][_0x620f('0x47')](_0x3fc41c)['then'](function(_0x2c68da){logger[_0x620f('0xf')]('[%s][AUTOREPLY]\x20%s',_0x3432fd,_0x3fc41c[_0x620f('0x1c')]);})[_0x620f('0x45')](function(_0x2357d9){logger['error'](_0x620f('0x10'),_0x3432fd,JSON['stringify'](_0x2357d9));})[_0x620f('0x41')](function(){Promise[_0x620f('0x42')]()[_0x620f('0x3e')](function(){if(_0xddc565[0x0]!=='2'||_0x581177[_0x620f('0x17')])return;return rpc[_0x2fa896+'Interaction'][_0x620f('0x44')](_0x581177['id'],{'autoreplyExecuted':!![]})[_0x620f('0x3e')](function(_0x1bffd0){logger[_0x620f('0xf')](_0x620f('0x18'),_0x3432fd,JSON[_0x620f('0x40')](_0x1bffd0));})['catch'](function(_0x399fe9){logger[_0x620f('0x3f')](_0x620f('0x46'),_0x3432fd,JSON[_0x620f('0x40')](_0x399fe9));});})[_0x620f('0x3e')](function(){_0x1acd85[_0x620f('0x16')]();});});}}}catch(_0x46b363){logger[_0x620f('0x3f')](_0x620f('0x10'),_0x3432fd,JSON[_0x620f('0x40')](_0x46b363));_0x1acd85['stop']();}};}; \ No newline at end of file +var _0xca2a=['update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','finally','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','channel','mail','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','One\x20Time\x20already\x20sent','contact','out','body','getMustacheRender','from','message','phone','read','subject','startsWith','Re:','Re:\x20','account','upperFirst','AccountId','InteractionId','Message','Smtp','host','port','secure','authentication','user','inReplyTo','messageId','','replace','';_0x44718f[_0xaca2('0x34')]={'Auto-Submitted':_0xaca2('0x35'),'X-Auto-Response-Suppress':_0xaca2('0x36'),'Precedence':_0xaca2('0x37')};return mailRpc[_0xaca2('0x38')](_0x32314b,_0x44718f)[_0xaca2('0x39')](function(_0x2a9a7b){logger[_0xaca2('0x16')](_0xaca2('0x3a'),_0x59f978);_0x44718f[_0xaca2('0x30')]=_0x2a9a7b[_0xaca2('0x1d')]['messageId'];return rpc[_0x4089a1+_0xaca2('0x28')]['create'](_0x44718f);})[_0xaca2('0x39')](function(_0x3fc246){logger[_0xaca2('0x16')](_0xaca2('0x10'),_0x59f978,JSON[_0xaca2('0x3b')](_0x3fc246));})[_0xaca2('0x3c')](function(_0x14cd9a){logger[_0xaca2('0x3d')](_0xaca2('0x3e'),_0x59f978,JSON['stringify'](_0x14cd9a));})['finally'](function(){Promise[_0xaca2('0x3f')]()[_0xaca2('0x39')](function(){if(_0x4a73d7[0x0]!=='2'||_0x1564df[_0xaca2('0x40')])return;return rpc[_0x4089a1+'Interaction'][_0xaca2('0x41')](_0x1564df['id'],{'autoreplyExecuted':!![]})['then'](function(_0x57a8c2){logger['info'](_0xaca2('0x42'),_0x59f978,JSON[_0xaca2('0x3b')](_0x57a8c2));})['catch'](function(_0x4938ad){logger[_0xaca2('0x3d')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x59f978,JSON[_0xaca2('0x3b')](_0x4938ad));});})['then'](function(){_0x36b41e[_0xaca2('0x12')]();});});}else{return rpc[this[_0xaca2('0xd')]+_0xaca2('0x28')][_0xaca2('0x43')](_0x44718f)[_0xaca2('0x39')](function(_0x48c242){logger[_0xaca2('0x16')](_0xaca2('0x10'),_0x59f978,_0x44718f[_0xaca2('0x1a')]);})[_0xaca2('0x3c')](function(_0x50837d){logger[_0xaca2('0x3d')](_0xaca2('0x10'),_0x59f978,JSON[_0xaca2('0x3b')](_0x50837d));})[_0xaca2('0x44')](function(){Promise[_0xaca2('0x3f')]()['then'](function(){if(_0x4a73d7[0x0]!=='2'||_0x1564df[_0xaca2('0x40')])return;return rpc[_0x4089a1+'Interaction'][_0xaca2('0x41')](_0x1564df['id'],{'autoreplyExecuted':!![]})[_0xaca2('0x39')](function(_0x408505){logger[_0xaca2('0x16')](_0xaca2('0x42'),_0x59f978,JSON[_0xaca2('0x3b')](_0x408505));})[_0xaca2('0x3c')](function(_0x5c252a){logger[_0xaca2('0x3d')](_0xaca2('0x45'),_0x59f978,JSON[_0xaca2('0x3b')](_0x5c252a));});})[_0xaca2('0x39')](function(){_0x36b41e['next']();});});}}}catch(_0x2a2896){logger[_0xaca2('0x3d')](_0xaca2('0x10'),_0x59f978,JSON[_0xaca2('0x3b')](_0x2a2896));_0x36b41e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 9328661..f9483e4 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa943=['stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','error','[%s][CLOSE]\x20%s','stringify','finally'];(function(_0x4296c7,_0x149f77){var _0x21c86e=function(_0x3069d3){while(--_0x3069d3){_0x4296c7['push'](_0x4296c7['shift']());}};_0x21c86e(++_0x149f77);}(_0xa943,0x6a));var _0x3a94=function(_0x55e565,_0x371bf7){_0x55e565=_0x55e565-0x0;var _0x21b288=_0xa943[_0x55e565];return _0x21b288;};'use strict';var moment=require(_0x3a94('0x0'));var logger=require(_0x3a94('0x1'))(_0x3a94('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x3a94('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x3a94('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x3a94('0x5'))};exports['consequence']=function(_0x34d5c7,_0x359d81,_0x304ef1,_0xf58f83){return function(_0x3209a6){try{logger[_0x3a94('0x6')](_0x3a94('0x7'),_0x34d5c7,_0x359d81[0x0]);var _0x5184e2={'closed':0x1,'closedAt':moment()[_0x3a94('0x8')](_0x3a94('0x9')),'closeReason':'system','disposition':_0x359d81[0x0]};if(rpc[_0xf58f83[_0x3a94('0xa')]+_0x3a94('0xb')]){rpc[_0xf58f83[_0x3a94('0xa')]+_0x3a94('0xb')][_0x3a94('0xc')](_0xf58f83['interaction']['id'],_0x5184e2)[_0x3a94('0xd')](function(_0x5c6609){logger[_0x3a94('0x6')](_0x3a94('0xe'),_0x34d5c7,_0xf58f83[_0x3a94('0xf')]['id']);})['catch'](function(_0x3c2c64){logger[_0x3a94('0x10')](_0x3a94('0x11'),_0x34d5c7,JSON[_0x3a94('0x12')](_0x3c2c64));})[_0x3a94('0x13')](function(){_0x3209a6[_0x3a94('0x14')]();});}}catch(_0x38ee70){logger['error'](_0x3a94('0x11'),_0x34d5c7,JSON[_0x3a94('0x12')](_0x38ee70));_0x3209a6['stop']();}};}; \ No newline at end of file +var _0x18a2=['update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0x18a2,0x140));var _0x218a=function(_0x3968f3,_0x2700c2){_0x3968f3=_0x3968f3-0x0;var _0x4cd5b9=_0x18a2[_0x3968f3];return _0x4cd5b9;};'use strict';var moment=require(_0x218a('0x0'));var logger=require(_0x218a('0x1'))(_0x218a('0x2'));var rpc={'chatInteraction':require(_0x218a('0x3')),'openchannelInteraction':require(_0x218a('0x4')),'smsInteraction':require(_0x218a('0x5')),'mailInteraction':require(_0x218a('0x6')),'faxInteraction':require(_0x218a('0x7')),'whatsappInteraction':require(_0x218a('0x8'))};exports[_0x218a('0x9')]=function(_0x2d0a91,_0x3e1d49,_0x18cea4,_0x1132ea){return function(_0x428d78){try{logger[_0x218a('0xa')](_0x218a('0xb'),_0x2d0a91,_0x3e1d49[0x0]);var _0x49de98={'closed':0x1,'closedAt':moment()[_0x218a('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x218a('0xd'),'disposition':_0x3e1d49[0x0]};if(rpc[_0x1132ea[_0x218a('0xe')]+_0x218a('0xf')]){rpc[_0x1132ea['channel']+_0x218a('0xf')][_0x218a('0x10')](_0x1132ea['interaction']['id'],_0x49de98)[_0x218a('0x11')](function(_0x4be7f5){logger[_0x218a('0xa')](_0x218a('0x12'),_0x2d0a91,_0x1132ea[_0x218a('0x13')]['id']);})[_0x218a('0x14')](function(_0x254202){logger[_0x218a('0x15')](_0x218a('0x16'),_0x2d0a91,JSON['stringify'](_0x254202));})['finally'](function(){_0x428d78[_0x218a('0x17')]();});}}catch(_0xcd055d){logger[_0x218a('0x15')](_0x218a('0x16'),_0x2d0a91,JSON['stringify'](_0xcd055d));_0x428d78[_0x218a('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 2800cb3..4737e27 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad68=['isEmpty','body','getMustacheRender','create','then','info','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','dialogflow','providerName','providerResponse','Message','result','metadata','endConversation','next','apiai-promise','md5','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created'];(function(_0x157e35,_0x4ca307){var _0x125a14=function(_0x233f3a){while(--_0x233f3a){_0x157e35['push'](_0x157e35['shift']());}};_0x125a14(++_0x4ca307);}(_0xad68,0x100));var _0x8ad6=function(_0x1a5a53,_0x598a8c){_0x1a5a53=_0x1a5a53-0x0;var _0xf75355=_0xad68[_0x1a5a53];return _0xf75355;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require(_0x8ad6('0x0'));var md5=require(_0x8ad6('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x8ad6('0x2'));var rpc={'chatMessage':require(_0x8ad6('0x3')),'openchannelMessage':require(_0x8ad6('0x4')),'mailMessage':require(_0x8ad6('0x5')),'smsMessage':require(_0x8ad6('0x6')),'faxMessage':require(_0x8ad6('0x7')),'whatsappMessage':require(_0x8ad6('0x8'))};exports['consequence']=function(_0x144a85,_0x1ca47f){return function(_0x3e009f){try{if(!_[_0x8ad6('0x9')](this[_0x8ad6('0xa')]['UserId'])){logger['info'](_0x8ad6('0xb'),_0x144a85,_0x8ad6('0xc'));return _0x3e009f['next']();}var _0x4b5b88={'ContactId':this[_0x8ad6('0xd')]['id'],'sentAt':moment()[_0x8ad6('0xe')](_0x8ad6('0xf')),'direction':_0x8ad6('0x10')};if(this[_0x8ad6('0x11')]===_0x8ad6('0x12')||this[_0x8ad6('0x11')]===_0x8ad6('0x13')){_0x4b5b88['phone']=this[_0x8ad6('0xa')]['phone'];}var _0x5de67c=this[_0x8ad6('0x11')];if(_0x5de67c==='chat'){_0x4b5b88[_0x8ad6('0x14')]=this['account']['id'];}else{_0x4b5b88[_[_0x8ad6('0x15')](_0x5de67c)+_0x8ad6('0x16')]=this[_0x8ad6('0x17')]['id'];}_0x4b5b88[_['upperFirst'](_0x5de67c)+_0x8ad6('0x18')]=this[_0x8ad6('0xa')]['id'];if(this[_0x8ad6('0xa')][_0x8ad6('0x19')]){var _0x10a21c=_0x1ca47f[0x2];if(!_[_0x8ad6('0x1a')](_0x10a21c)){_0x4b5b88[_0x8ad6('0x1b')]=utils[_0x8ad6('0x1c')](_0x10a21c,this);return rpc[_0x5de67c+'Message'][_0x8ad6('0x1d')](_0x4b5b88)[_0x8ad6('0x1e')](function(_0x29e6a6){logger[_0x8ad6('0x1f')](_0x8ad6('0xb'),_0x144a85,_0x4b5b88[_0x8ad6('0x1b')]);})[_0x8ad6('0x20')](function(_0x58a393){logger[_0x8ad6('0x21')](_0x8ad6('0xb'),_0x144a85,JSON[_0x8ad6('0x22')](_0x58a393));})['finally'](function(){logger[_0x8ad6('0x1f')](_0x8ad6('0x23'),_0x144a85);_0x3e009f[_0x8ad6('0x24')]();});}else{logger[_0x8ad6('0x1f')](_0x8ad6('0x25'),_0x144a85);_0x3e009f[_0x8ad6('0x24')]();}}else{var _0x42f18b=this;var _0x5edc1=apiai(_0x1ca47f[0x0],{'language':_0x1ca47f[0x1]||'en'});return _0x5edc1[_0x8ad6('0x26')](this['message']['body'],{'sessionId':md5(this[_0x8ad6('0xa')]['id'])})[_0x8ad6('0x1e')](function(_0x558430){_0x42f18b[_0x8ad6('0x1b')][_0x8ad6('0x27')]=_0x558430;_0x4b5b88[_0x8ad6('0x1b')]=_0x558430['result']['fulfillment']['speech'];_0x4b5b88[_0x8ad6('0x28')]=_0x8ad6('0x27');_0x4b5b88[_0x8ad6('0x29')]=JSON[_0x8ad6('0x22')](_0x558430);return rpc[_0x5de67c+_0x8ad6('0x2a')][_0x8ad6('0x1d')](_0x4b5b88)[_0x8ad6('0x1e')](function(_0x3a6151){logger[_0x8ad6('0x1f')](_0x8ad6('0xb'),_0x144a85,_0x4b5b88[_0x8ad6('0x1b')]);if(_0x558430[_0x8ad6('0x2b')][_0x8ad6('0x2c')][_0x8ad6('0x2d')]){_0x3e009f[_0x8ad6('0x2e')]();}else{_0x3e009f[_0x8ad6('0x24')]();}})[_0x8ad6('0x20')](function(_0x3c2092){logger[_0x8ad6('0x21')](_0x8ad6('0xb'),_0x144a85,JSON['stringify'](_0x3c2092));_0x3e009f[_0x8ad6('0x2e')]();});})[_0x8ad6('0x20')](function(_0x105d07){logger['error'](_0x8ad6('0xb'),_0x144a85,_0x105d07['message']);_0x3e009f['next']();});}}catch(_0x56e99d){logger[_0x8ad6('0x21')](_0x8ad6('0xb'),_0x144a85,JSON['stringify'](_0x56e99d));_0x3e009f[_0x8ad6('0x24')]();}};}; \ No newline at end of file +var _0x7f59=['[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','stringify','Message','metadata','endConversation','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','isNil','interaction','UserId','next','contact','format','out','channel','sms','phone','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','body','getMustacheRender','create','then','info','[%s][DIALOGFLOW]\x20%s','catch','error','finally'];(function(_0x290a11,_0xca3b5b){var _0x1c1d6d=function(_0xf98851){while(--_0xf98851){_0x290a11['push'](_0x290a11['shift']());}};_0x1c1d6d(++_0xca3b5b);}(_0x7f59,0x12e));var _0x97f5=function(_0x451c40,_0x27ffed){_0x451c40=_0x451c40-0x0;var _0xb76daf=_0x7f59[_0x451c40];return _0xb76daf;};'use strict';var _=require(_0x97f5('0x0'));var moment=require(_0x97f5('0x1'));var apiai=require('apiai-promise');var md5=require(_0x97f5('0x2'));var utils=require(_0x97f5('0x3'));var logger=require(_0x97f5('0x4'))(_0x97f5('0x5'));var rpc={'chatMessage':require(_0x97f5('0x6')),'openchannelMessage':require(_0x97f5('0x7')),'mailMessage':require(_0x97f5('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x2ad891,_0x1d0a13){return function(_0x3d25ec){try{if(!_[_0x97f5('0x9')](this[_0x97f5('0xa')][_0x97f5('0xb')])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x2ad891,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3d25ec[_0x97f5('0xc')]();}var _0x4eb6d6={'ContactId':this[_0x97f5('0xd')]['id'],'sentAt':moment()[_0x97f5('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x97f5('0xf')};if(this[_0x97f5('0x10')]===_0x97f5('0x11')||this[_0x97f5('0x10')]==='whatsapp'){_0x4eb6d6[_0x97f5('0x12')]=this['interaction']['phone'];}var _0x4cce8b=this[_0x97f5('0x10')];if(_0x4cce8b==='chat'){_0x4eb6d6[_0x97f5('0x13')]=this['account']['id'];}else{_0x4eb6d6[_[_0x97f5('0x14')](_0x4cce8b)+_0x97f5('0x15')]=this[_0x97f5('0x16')]['id'];}_0x4eb6d6[_[_0x97f5('0x14')](_0x4cce8b)+_0x97f5('0x17')]=this[_0x97f5('0xa')]['id'];if(this[_0x97f5('0xa')][_0x97f5('0x18')]){var _0x5d8c2f=_0x1d0a13[0x2];if(!_['isEmpty'](_0x5d8c2f)){_0x4eb6d6[_0x97f5('0x19')]=utils[_0x97f5('0x1a')](_0x5d8c2f,this);return rpc[_0x4cce8b+'Message'][_0x97f5('0x1b')](_0x4eb6d6)[_0x97f5('0x1c')](function(_0x26caac){logger[_0x97f5('0x1d')](_0x97f5('0x1e'),_0x2ad891,_0x4eb6d6['body']);})[_0x97f5('0x1f')](function(_0x37eb16){logger[_0x97f5('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x2ad891,JSON['stringify'](_0x37eb16));})[_0x97f5('0x21')](function(){logger['info'](_0x97f5('0x22'),_0x2ad891);_0x3d25ec[_0x97f5('0x23')]();});}else{logger[_0x97f5('0x1d')](_0x97f5('0x24'),_0x2ad891);_0x3d25ec[_0x97f5('0x23')]();}}else{var _0x15201f=this;var _0xf7e42b=apiai(_0x1d0a13[0x0],{'language':_0x1d0a13[0x1]||'en'});return _0xf7e42b['textRequest'](this[_0x97f5('0x25')]['body'],{'sessionId':md5(this[_0x97f5('0xa')]['id'])})['then'](function(_0x297627){_0x15201f[_0x97f5('0x19')][_0x97f5('0x26')]=_0x297627;_0x4eb6d6['body']=_0x297627[_0x97f5('0x27')][_0x97f5('0x28')][_0x97f5('0x29')];_0x4eb6d6[_0x97f5('0x2a')]=_0x97f5('0x26');_0x4eb6d6[_0x97f5('0x2b')]=JSON[_0x97f5('0x2c')](_0x297627);return rpc[_0x4cce8b+_0x97f5('0x2d')]['create'](_0x4eb6d6)['then'](function(_0x4752b3){logger['info'](_0x97f5('0x1e'),_0x2ad891,_0x4eb6d6[_0x97f5('0x19')]);if(_0x297627[_0x97f5('0x27')][_0x97f5('0x2e')][_0x97f5('0x2f')]){_0x3d25ec['next']();}else{_0x3d25ec['stop']();}})[_0x97f5('0x1f')](function(_0x49bf8b){logger[_0x97f5('0x20')](_0x97f5('0x1e'),_0x2ad891,JSON[_0x97f5('0x2c')](_0x49bf8b));_0x3d25ec[_0x97f5('0xc')]();});})[_0x97f5('0x1f')](function(_0xf805db){logger[_0x97f5('0x20')](_0x97f5('0x1e'),_0x2ad891,_0xf805db[_0x97f5('0x25')]);_0x3d25ec[_0x97f5('0xc')]();});}}catch(_0x216554){logger[_0x97f5('0x20')](_0x97f5('0x1e'),_0x2ad891,JSON[_0x97f5('0x2c')](_0x216554));_0x3d25ec['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 263a752..0385960 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b14=['message','lodash','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','isNil','interaction','UserId','next','contact','format','sms','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','create','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all'];(function(_0x4a1856,_0x7a7551){var _0x3aba72=function(_0x275c73){while(--_0x275c73){_0x4a1856['push'](_0x4a1856['shift']());}};_0x3aba72(++_0x7a7551);}(_0x7b14,0x91));var _0x47b1=function(_0x307d9c,_0x4330f3){_0x307d9c=_0x307d9c-0x0;var _0x48e123=_0x7b14[_0x307d9c];return _0x48e123;};'use strict';var _=require(_0x47b1('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require('moment');var Promise=require('bluebird');var logger=require(_0x47b1('0x1'))(_0x47b1('0x2'));var utils=require(_0x47b1('0x3'));var rpc={'chatMessage':require(_0x47b1('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x47b1('0x5')),'faxMessage':require(_0x47b1('0x6')),'whatsappMessage':require(_0x47b1('0x7'))};function createMessage(_0x3bc66e,_0x6b58ff,_0x11ffdb,_0x1d77c2){return new Promise(function(_0x25ce55,_0x1f1926){var _0x1d3f8a=_[_0x47b1('0x8')](_0x11ffdb);_0x1d3f8a['body']=_0x1d77c2;return rpc[_0x6b58ff+'Message']['create'](_0x1d3f8a)[_0x47b1('0x9')](function(){logger[_0x47b1('0xa')](_0x47b1('0xb'),_0x3bc66e,_0x1d3f8a[_0x47b1('0xc')]);_0x25ce55();})[_0x47b1('0xd')](function(_0x563596){logger[_0x47b1('0xe')](_0x47b1('0xb'),_0x3bc66e,JSON['stringify'](_0x563596));_0x1f1926(_0x563596);});});}exports['consequence']=function(_0x21096b,_0x1c7dff){return function(_0x2b4ef0){try{if(!_[_0x47b1('0xf')](this[_0x47b1('0x10')][_0x47b1('0x11')])){logger['info'](_0x47b1('0xb'),_0x21096b,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2b4ef0[_0x47b1('0x12')]();}var _0x3c400c={'ContactId':this[_0x47b1('0x13')]['id'],'sentAt':moment()[_0x47b1('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0x47b1('0x15')||this[_0x47b1('0x16')]===_0x47b1('0x17')){_0x3c400c[_0x47b1('0x18')]=this[_0x47b1('0x10')][_0x47b1('0x18')];}var _0x42a66c=this[_0x47b1('0x16')];if(_0x42a66c===_0x47b1('0x19')){_0x3c400c['ChatWebsiteId']=this[_0x47b1('0x1a')]['id'];}else{_0x3c400c[_[_0x47b1('0x1b')](_0x42a66c)+_0x47b1('0x1c')]=this[_0x47b1('0x1a')]['id'];}_0x3c400c[_['upperFirst'](_0x42a66c)+_0x47b1('0x1d')]=this[_0x47b1('0x10')]['id'];if(this[_0x47b1('0x10')][_0x47b1('0x1e')]){var _0x45ff5c=_0x1c7dff[0x4];if(!_['isEmpty'](_0x45ff5c)){_0x3c400c['body']=utils[_0x47b1('0x1f')](_0x45ff5c,this);return rpc[_0x42a66c+'Message'][_0x47b1('0x20')](_0x3c400c)['then'](function(_0x521c12){logger['info'](_0x47b1('0xb'),_0x21096b,_0x3c400c['body']);})[_0x47b1('0xd')](function(_0x300cae){logger[_0x47b1('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x21096b,JSON[_0x47b1('0x21')](_0x300cae));})[_0x47b1('0x22')](function(){logger[_0x47b1('0xa')](_0x47b1('0x23'),_0x21096b);_0x2b4ef0[_0x47b1('0x24')]();});}else{logger[_0x47b1('0xa')](_0x47b1('0x25'),_0x21096b);_0x2b4ef0[_0x47b1('0x24')]();}}else{var _0x50cd3f=this;var _0x316cd1=_0x1c7dff[0x2][_0x47b1('0x26')](/\\n/g,'\x0a');var _0x4d67fa={'credentials':{'private_key':_0x316cd1,'client_email':_0x1c7dff[0x1]}};var _0xa4d7b5=new dialogflow['SessionsClient'](_0x4d67fa);var _0x397237=_0xa4d7b5[_0x47b1('0x27')](_0x1c7dff[0x0],md5(_0x50cd3f[_0x47b1('0x10')]['id']));var _0xf4fac={'session':_0x397237,'queryInput':{'text':{'text':_0x50cd3f['message'][_0x47b1('0xc')],'languageCode':_0x1c7dff[0x3]||'en'}}};return _0xa4d7b5[_0x47b1('0x28')](_0xf4fac)['then'](function(_0x151c5a){if(_0x151c5a&&_0x151c5a[_0x47b1('0x29')]){_0x50cd3f[_0x47b1('0xc')][_0x47b1('0x2a')]=_0x151c5a;var _0x959799=_0x151c5a[0x0];var _0xd8735d=_0x959799[_0x47b1('0x2b')][_0x47b1('0x2c')]&&_0x959799[_0x47b1('0x2b')][_0x47b1('0x2c')][_0x47b1('0x2d')]?_0x959799[_0x47b1('0x2b')]['diagnosticInfo']['fields']['end_conversation'][_0x47b1('0x2e')]:![];_0x50cd3f['body'][_0x47b1('0x2f')]=_0x959799[_0x47b1('0x2b')][_0x47b1('0x30')];_0x50cd3f['body'][_0x47b1('0x31')]=_0x959799['queryResult'][_0x47b1('0x32')];_0x50cd3f[_0x47b1('0xc')][_0x47b1('0x33')]=_0x959799['queryResult'][_0x47b1('0x2c')]&&_0x959799[_0x47b1('0x2b')][_0x47b1('0x2c')][_0x47b1('0x2d')]?_0x959799['queryResult'][_0x47b1('0x2c')][_0x47b1('0x2d')][_0x47b1('0x34')][_0x47b1('0x2e')]:![];_0x50cd3f[_0x47b1('0xc')][_0x47b1('0x35')]=_0x959799[_0x47b1('0x2b')][_0x47b1('0x36')][_0x47b1('0x37')];_0x50cd3f[_0x47b1('0xc')][_0x47b1('0x38')]=_0x959799[_0x47b1('0x2b')]['intent'][_0x47b1('0x39')];_0x50cd3f[_0x47b1('0xc')][_0x47b1('0x3a')]=_0x959799[_0x47b1('0x2b')][_0x47b1('0x36')][_0x47b1('0x3b')];_0x50cd3f[_0x47b1('0xc')][_0x47b1('0x3c')]=_0x959799[_0x47b1('0x2b')][_0x47b1('0x3d')];_0x50cd3f[_0x47b1('0xc')][_0x47b1('0x3e')]=_0x959799[_0x47b1('0x2b')][_0x47b1('0x3f')];_0x50cd3f[_0x47b1('0xc')][_0x47b1('0x40')]=_0x959799[_0x47b1('0x2b')][_0x47b1('0x41')];_0x3c400c[_0x47b1('0x42')]=_0x47b1('0x2a');_0x3c400c[_0x47b1('0x43')]=JSON[_0x47b1('0x21')](_0x151c5a);var _0x6d69b7=[];for(var _0x360f5f=0x0;_0x360f5f<_0x151c5a[_0x47b1('0x29')];_0x360f5f++){var _0x2e08b2=_0x151c5a[_0x360f5f];if(_0x2e08b2&&_0x2e08b2[_0x47b1('0x2b')]&&_0x2e08b2[_0x47b1('0x2b')][_0x47b1('0x44')]){_0x6d69b7[_0x47b1('0x45')](createMessage(_0x21096b,_0x42a66c,_0x3c400c,_0x2e08b2[_0x47b1('0x2b')][_0x47b1('0x44')]));}}return Promise[_0x47b1('0x46')](_0x6d69b7)[_0x47b1('0x9')](function(){if(_0xd8735d){_0x2b4ef0['next']();}else{_0x2b4ef0[_0x47b1('0x24')]();}})['catch'](function(_0x2fca05){logger[_0x47b1('0xe')](_0x47b1('0xb'),_0x21096b,JSON[_0x47b1('0x21')](_0x2fca05));_0x2b4ef0['next']();});}})['catch'](function(_0x1ff8d4){logger[_0x47b1('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x21096b,_0x1ff8d4[_0x47b1('0x47')]);_0x2b4ef0[_0x47b1('0x12')]();});}}catch(_0x3c2acd){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x21096b,JSON[_0x47b1('0x21')](_0x3c2acd));_0x2b4ef0[_0x47b1('0x24')]();}};}; \ No newline at end of file +var _0x8881=['intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','push','all','lodash','dialogflow','md5','moment','routing','./utils','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','interaction','chat','account','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','action','allRequiredParamsPresent','end_conversation'];(function(_0x5e4068,_0x3603ef){var _0x17910b=function(_0xd11f7f){while(--_0xd11f7f){_0x5e4068['push'](_0x5e4068['shift']());}};_0x17910b(++_0x3603ef);}(_0x8881,0xd0));var _0x1888=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0x8881[_0x47623f];return _0x282ce8;};'use strict';var _=require(_0x1888('0x0'));var dialogflow=require(_0x1888('0x1'));var md5=require(_0x1888('0x2'));var moment=require(_0x1888('0x3'));var Promise=require('bluebird');var logger=require('../../../../config/logger')(_0x1888('0x4'));var utils=require(_0x1888('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x1888('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x1888('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x1888('0x8'))};function createMessage(_0x39a92b,_0x13c2d0,_0x11a187,_0x352473){return new Promise(function(_0x4b8569,_0x30e37b){var _0x16bb5f=_[_0x1888('0x9')](_0x11a187);_0x16bb5f[_0x1888('0xa')]=_0x352473;return rpc[_0x13c2d0+_0x1888('0xb')][_0x1888('0xc')](_0x16bb5f)[_0x1888('0xd')](function(){logger[_0x1888('0xe')](_0x1888('0xf'),_0x39a92b,_0x16bb5f[_0x1888('0xa')]);_0x4b8569();})['catch'](function(_0x1c2dc2){logger[_0x1888('0x10')](_0x1888('0xf'),_0x39a92b,JSON[_0x1888('0x11')](_0x1c2dc2));_0x30e37b(_0x1c2dc2);});});}exports[_0x1888('0x12')]=function(_0x290e7f,_0x866bb6){return function(_0x2e5e9c){try{if(!_['isNil'](this['interaction'][_0x1888('0x13')])){logger[_0x1888('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x290e7f,_0x1888('0x14'));return _0x2e5e9c[_0x1888('0x15')]();}var _0x1bf6cc={'ContactId':this[_0x1888('0x16')]['id'],'sentAt':moment()[_0x1888('0x17')](_0x1888('0x18')),'direction':'out'};if(this[_0x1888('0x19')]==='sms'||this[_0x1888('0x19')]===_0x1888('0x1a')){_0x1bf6cc[_0x1888('0x1b')]=this[_0x1888('0x1c')][_0x1888('0x1b')];}var _0x352c7e=this[_0x1888('0x19')];if(_0x352c7e===_0x1888('0x1d')){_0x1bf6cc['ChatWebsiteId']=this[_0x1888('0x1e')]['id'];}else{_0x1bf6cc[_[_0x1888('0x1f')](_0x352c7e)+_0x1888('0x20')]=this[_0x1888('0x1e')]['id'];}_0x1bf6cc[_[_0x1888('0x1f')](_0x352c7e)+_0x1888('0x21')]=this[_0x1888('0x1c')]['id'];if(this['interaction']['created']){var _0x21962b=_0x866bb6[0x4];if(!_[_0x1888('0x22')](_0x21962b)){_0x1bf6cc['body']=utils[_0x1888('0x23')](_0x21962b,this);return rpc[_0x352c7e+_0x1888('0xb')][_0x1888('0xc')](_0x1bf6cc)['then'](function(_0x54486c){logger[_0x1888('0xe')](_0x1888('0xf'),_0x290e7f,_0x1bf6cc[_0x1888('0xa')]);})['catch'](function(_0x20d609){logger[_0x1888('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x290e7f,JSON[_0x1888('0x11')](_0x20d609));})[_0x1888('0x24')](function(){logger[_0x1888('0xe')](_0x1888('0x25'),_0x290e7f);_0x2e5e9c[_0x1888('0x26')]();});}else{logger[_0x1888('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x290e7f);_0x2e5e9c[_0x1888('0x26')]();}}else{var _0x4528d7=this;var _0x5be4ca=_0x866bb6[0x2][_0x1888('0x27')](/\\n/g,'\x0a');var _0x8fde5d={'credentials':{'private_key':_0x5be4ca,'client_email':_0x866bb6[0x1]}};var _0xcc72c9=new dialogflow[(_0x1888('0x28'))](_0x8fde5d);var _0x242c63=_0xcc72c9[_0x1888('0x29')](_0x866bb6[0x0],md5(_0x4528d7[_0x1888('0x1c')]['id']));var _0x2ace8e={'session':_0x242c63,'queryInput':{'text':{'text':_0x4528d7['message'][_0x1888('0xa')],'languageCode':_0x866bb6[0x3]||'en'}}};return _0xcc72c9[_0x1888('0x2a')](_0x2ace8e)['then'](function(_0x4b40c9){if(_0x4b40c9&&_0x4b40c9[_0x1888('0x2b')]){_0x4528d7[_0x1888('0xa')][_0x1888('0x2c')]=_0x4b40c9;var _0x5eedbd=_0x4b40c9[0x0];var _0x2e52ac=_0x5eedbd[_0x1888('0x2d')]['diagnosticInfo']&&_0x5eedbd[_0x1888('0x2d')][_0x1888('0x2e')]['fields']?_0x5eedbd[_0x1888('0x2d')]['diagnosticInfo'][_0x1888('0x2f')]['end_conversation'][_0x1888('0x30')]:![];_0x4528d7[_0x1888('0xa')]['DIALOGFLOWV2_ACTION']=_0x5eedbd[_0x1888('0x2d')][_0x1888('0x31')];_0x4528d7[_0x1888('0xa')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x5eedbd['queryResult'][_0x1888('0x32')];_0x4528d7[_0x1888('0xa')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x5eedbd[_0x1888('0x2d')][_0x1888('0x2e')]&&_0x5eedbd[_0x1888('0x2d')][_0x1888('0x2e')]['fields']?_0x5eedbd[_0x1888('0x2d')][_0x1888('0x2e')][_0x1888('0x2f')][_0x1888('0x33')][_0x1888('0x30')]:![];_0x4528d7['body']['DIALOGFLOWV2_INTENTNAME']=_0x5eedbd['queryResult'][_0x1888('0x34')][_0x1888('0x35')];_0x4528d7['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x5eedbd[_0x1888('0x2d')][_0x1888('0x34')][_0x1888('0x36')];_0x4528d7['body'][_0x1888('0x37')]=_0x5eedbd[_0x1888('0x2d')][_0x1888('0x34')]['isFallback'];_0x4528d7[_0x1888('0xa')][_0x1888('0x38')]=_0x5eedbd[_0x1888('0x2d')]['languageCode'];_0x4528d7[_0x1888('0xa')][_0x1888('0x39')]=_0x5eedbd[_0x1888('0x2d')][_0x1888('0x3a')];_0x4528d7[_0x1888('0xa')][_0x1888('0x3b')]=_0x5eedbd[_0x1888('0x2d')][_0x1888('0x3c')];_0x1bf6cc[_0x1888('0x3d')]=_0x1888('0x2c');_0x1bf6cc[_0x1888('0x3e')]=JSON[_0x1888('0x11')](_0x4b40c9);var _0x300529=[];for(var _0x1926d8=0x0;_0x1926d8<_0x4b40c9[_0x1888('0x2b')];_0x1926d8++){var _0x42a559=_0x4b40c9[_0x1926d8];if(_0x42a559&&_0x42a559[_0x1888('0x2d')]&&_0x42a559['queryResult']['fulfillmentText']){_0x300529[_0x1888('0x3f')](createMessage(_0x290e7f,_0x352c7e,_0x1bf6cc,_0x42a559[_0x1888('0x2d')]['fulfillmentText']));}}return Promise[_0x1888('0x40')](_0x300529)[_0x1888('0xd')](function(){if(_0x2e52ac){_0x2e5e9c['next']();}else{_0x2e5e9c[_0x1888('0x26')]();}})['catch'](function(_0x1fae04){logger[_0x1888('0x10')](_0x1888('0xf'),_0x290e7f,JSON[_0x1888('0x11')](_0x1fae04));_0x2e5e9c['next']();});}})['catch'](function(_0x1f8328){logger[_0x1888('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x290e7f,_0x1f8328['message']);_0x2e5e9c[_0x1888('0x15')]();});}}catch(_0x4ad294){logger['error'](_0x1888('0xf'),_0x290e7f,JSON[_0x1888('0x11')](_0x4ad294));_0x2e5e9c[_0x1888('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 2514d14..5bf97fb 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe734=['number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','stop','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0xd73239,_0x488346){var _0x41cee6=function(_0x4a8bb3){while(--_0x4a8bb3){_0xd73239['push'](_0xd73239['shift']());}};_0x41cee6(++_0x488346);}(_0xe734,0x1ba));var _0x4e73=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xe734[_0x42bdad];return _0x122626;};'use strict';var schema=require(_0x4e73('0x0'));var _=require(_0x4e73('0x1'));var htmlToText=require(_0x4e73('0x2'));var utils=require(_0x4e73('0x3'));var logger=require(_0x4e73('0x4'))(_0x4e73('0x5'));var gotoif=schema({'condition':{'type':_0x4e73('0x6'),'required':!![],'message':_0x4e73('0x7')},'priorityTrue':{'type':_0x4e73('0x8'),'message':_0x4e73('0x9')},'priorityFalse':{'type':_0x4e73('0x8'),'message':_0x4e73('0xa')}});exports[_0x4e73('0xb')]=function(_0x517c45,_0x18740f){return function(_0x16367e){try{var _0x148cfe={'condition':htmlToText[_0x4e73('0xc')](utils[_0x4e73('0xd')](_0x18740f[0x0],this),{'wordwrap':![]})[_0x4e73('0xe')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x18740f[0x1],'priorityFalse':_0x18740f[0x2]};var _0x30324a=gotoif[_0x4e73('0x0')](_0x148cfe,{'typecast':!![]});if(_0x30324a['length']){logger[_0x4e73('0xf')](_0x4e73('0x10'),_0x517c45,_[_0x4e73('0x11')](_0x30324a,_0x4e73('0x12'))[_0x4e73('0x13')](',\x20'));_0x16367e['stop']();}else{try{var _0x4fb9a7=eval('('+_0x148cfe[_0x4e73('0x14')]+')');var _0x5bea9a=_0x4fb9a7?_0x148cfe[_0x4e73('0x15')]:_0x148cfe[_0x4e73('0x16')];logger[_0x4e73('0x17')](_0x4e73('0x18'),_0x517c45,_0x148cfe[_0x4e73('0x14')],_0x4fb9a7,_0x5bea9a||_0x4e73('0x19'));if(_0x5bea9a){var _0x484967=_[_0x4e73('0x1a')](_0x16367e['rules'](),{'p':_0x5bea9a});if(_0x484967>=0x0){logger['info'](_0x4e73('0x1b'),_0x517c45,_0x5bea9a||'next',_0x484967);_0x16367e[_0x4e73('0x19')](_0x484967);}else{logger[_0x4e73('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x517c45,_0x5bea9a||_0x4e73('0x19'));_0x16367e[_0x4e73('0x1c')]();}}else{_0x16367e[_0x4e73('0x19')]();}}catch(_0x4633e0){logger[_0x4e73('0xf')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x517c45,_0x4633e0[_0x4e73('0x12')]);_0x16367e[_0x4e73('0x1c')]();}}}catch(_0x315a25){logger[_0x4e73('0xf')]('[%s][GOTOIF]\x20%s',_0x517c45,JSON[_0x4e73('0x1d')](_0x315a25));_0x16367e[_0x4e73('0x1c')]();}};}; \ No newline at end of file +var _0x2d7f=['validate','lodash','html-to-text','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','map','message','join','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify'];(function(_0x46aa51,_0x2aba08){var _0x5b07a5=function(_0x5dfc73){while(--_0x5dfc73){_0x46aa51['push'](_0x46aa51['shift']());}};_0x5b07a5(++_0x2aba08);}(_0x2d7f,0x12c));var _0xf2d7=function(_0x53492d,_0x473050){_0x53492d=_0x53492d-0x0;var _0x362cab=_0x2d7f[_0x53492d];return _0x362cab;};'use strict';var schema=require(_0xf2d7('0x0'));var _=require(_0xf2d7('0x1'));var htmlToText=require(_0xf2d7('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xf2d7('0x3'));var gotoif=schema({'condition':{'type':_0xf2d7('0x4'),'required':!![],'message':_0xf2d7('0x5')},'priorityTrue':{'type':_0xf2d7('0x6'),'message':_0xf2d7('0x7')},'priorityFalse':{'type':'number','message':_0xf2d7('0x8')}});exports[_0xf2d7('0x9')]=function(_0x4c2eb0,_0x4bb8c9){return function(_0x1200bf){try{var _0x2fb73b={'condition':htmlToText[_0xf2d7('0xa')](utils[_0xf2d7('0xb')](_0x4bb8c9[0x0],this),{'wordwrap':![]})[_0xf2d7('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4bb8c9[0x1],'priorityFalse':_0x4bb8c9[0x2]};var _0x19449f=gotoif[_0xf2d7('0x0')](_0x2fb73b,{'typecast':!![]});if(_0x19449f[_0xf2d7('0xd')]){logger[_0xf2d7('0xe')]('[%s][GOTOIF]\x20%s',_0x4c2eb0,_[_0xf2d7('0xf')](_0x19449f,_0xf2d7('0x10'))[_0xf2d7('0x11')](',\x20'));_0x1200bf['stop']();}else{try{var _0xc3afaa=eval('('+_0x2fb73b[_0xf2d7('0x12')]+')');var _0x53520e=_0xc3afaa?_0x2fb73b['priorityTrue']:_0x2fb73b[_0xf2d7('0x13')];logger[_0xf2d7('0x14')](_0xf2d7('0x15'),_0x4c2eb0,_0x2fb73b[_0xf2d7('0x12')],_0xc3afaa,_0x53520e||_0xf2d7('0x16'));if(_0x53520e){var _0x7e81fe=_[_0xf2d7('0x17')](_0x1200bf[_0xf2d7('0x18')](),{'p':_0x53520e});if(_0x7e81fe>=0x0){logger[_0xf2d7('0x14')](_0xf2d7('0x19'),_0x4c2eb0,_0x53520e||_0xf2d7('0x16'),_0x7e81fe);_0x1200bf['next'](_0x7e81fe);}else{logger[_0xf2d7('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x4c2eb0,_0x53520e||_0xf2d7('0x16'));_0x1200bf[_0xf2d7('0x1a')]();}}else{_0x1200bf[_0xf2d7('0x16')]();}}catch(_0x3080f5){logger['error'](_0xf2d7('0x1b'),_0x4c2eb0,_0x3080f5[_0xf2d7('0x10')]);_0x1200bf[_0xf2d7('0x1a')]();}}}catch(_0xa34a02){logger['error'](_0xf2d7('0x1c'),_0x4c2eb0,JSON[_0xf2d7('0x1d')](_0xa34a02));_0x1200bf['stop']();}};}; \ 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 8b96933..c71c094 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 _0x5d9c=['findIndex','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','error','stringify','validate','lodash','../../../../config/logger','routing','number','consequence','length','[%s][GOTOP]\x20%s','map','join','info','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x39c5b3,_0x3a5ac2){var _0x118f6c=function(_0x4cbcb6){while(--_0x4cbcb6){_0x39c5b3['push'](_0x39c5b3['shift']());}};_0x118f6c(++_0x3a5ac2);}(_0x5d9c,0x1e1));var _0xc5d9=function(_0x12a0ef,_0x4f9d18){_0x12a0ef=_0x12a0ef-0x0;var _0x2558d0=_0x5d9c[_0x12a0ef];return _0x2558d0;};'use strict';var schema=require(_0xc5d9('0x0'));var _=require(_0xc5d9('0x1'));var logger=require(_0xc5d9('0x2'))(_0xc5d9('0x3'));var gotop=schema({'priority':{'type':_0xc5d9('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xc5d9('0x5')]=function(_0x30826e,_0x2534d1){return function(_0x259408){try{var _0x5d9337={'priority':_0x2534d1[0x0]};var _0x2e9491=gotop[_0xc5d9('0x0')](_0x5d9337,{'typecast':!![]});if(_0x2e9491[_0xc5d9('0x6')]){logger['error'](_0xc5d9('0x7'),_0x30826e,_[_0xc5d9('0x8')](_0x2e9491,'message')[_0xc5d9('0x9')](',\x20'));_0x259408['stop']();}else{logger[_0xc5d9('0xa')](_0xc5d9('0xb'),_0x30826e,_0x5d9337[_0xc5d9('0xc')]);if(_0x5d9337[_0xc5d9('0xc')]){var _0x5be10f=_[_0xc5d9('0xd')](_0x259408['rules'](),{'p':_0x5d9337[_0xc5d9('0xc')]});if(_0x5be10f>=0x0){logger[_0xc5d9('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x30826e,_0x5d9337[_0xc5d9('0xc')]||_0xc5d9('0xe'),_0x5be10f);_0x259408[_0xc5d9('0xe')](_0x5be10f);}else{logger[_0xc5d9('0xa')](_0xc5d9('0xf'),_0x30826e,_0x5d9337['priority']||_0xc5d9('0xe'));_0x259408[_0xc5d9('0x10')]();}}else{_0x259408[_0xc5d9('0xe')]();}}}catch(_0x2941d3){logger[_0xc5d9('0x11')](_0xc5d9('0x7'),_0x30826e,JSON[_0xc5d9('0x12')](_0x2941d3));_0x259408[_0xc5d9('0x10')]();}};}; \ No newline at end of file +var _0xdfc3=['message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s'];(function(_0x411ded,_0x59b665){var _0x564124=function(_0x221a0e){while(--_0x221a0e){_0x411ded['push'](_0x411ded['shift']());}};_0x564124(++_0x59b665);}(_0xdfc3,0xe5));var _0x3dfc=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xdfc3[_0x3fba9f];return _0x192cf1;};'use strict';var schema=require(_0x3dfc('0x0'));var _=require(_0x3dfc('0x1'));var logger=require(_0x3dfc('0x2'))(_0x3dfc('0x3'));var gotop=schema({'priority':{'type':_0x3dfc('0x4'),'required':!![],'message':_0x3dfc('0x5')}});exports[_0x3dfc('0x6')]=function(_0x34b6e3,_0x422a37){return function(_0x316417){try{var _0x5100b1={'priority':_0x422a37[0x0]};var _0x40a064=gotop['validate'](_0x5100b1,{'typecast':!![]});if(_0x40a064['length']){logger[_0x3dfc('0x7')](_0x3dfc('0x8'),_0x34b6e3,_['map'](_0x40a064,_0x3dfc('0x9'))['join'](',\x20'));_0x316417[_0x3dfc('0xa')]();}else{logger[_0x3dfc('0xb')](_0x3dfc('0xc'),_0x34b6e3,_0x5100b1['priority']);if(_0x5100b1[_0x3dfc('0xd')]){var _0x5df529=_[_0x3dfc('0xe')](_0x316417[_0x3dfc('0xf')](),{'p':_0x5100b1[_0x3dfc('0xd')]});if(_0x5df529>=0x0){logger[_0x3dfc('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x34b6e3,_0x5100b1[_0x3dfc('0xd')]||_0x3dfc('0x10'),_0x5df529);_0x316417[_0x3dfc('0x10')](_0x5df529);}else{logger[_0x3dfc('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x34b6e3,_0x5100b1['priority']||'next');_0x316417[_0x3dfc('0xa')]();}}else{_0x316417['next']();}}}catch(_0x1feede){logger[_0x3dfc('0x7')](_0x3dfc('0x8'),_0x34b6e3,JSON['stringify'](_0x1feede));_0x316417[_0x3dfc('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 aed3c9b..bae82f9 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 _0x5971=['then','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','ChatWebsiteId','account','channel','upperFirst','InteractionId','interaction','Message','create'];(function(_0x25ba96,_0x5f2720){var _0x471ea5=function(_0x2f926f){while(--_0x2f926f){_0x25ba96['push'](_0x25ba96['shift']());}};_0x471ea5(++_0x5f2720);}(_0x5971,0x75));var _0x1597=function(_0x41085a,_0x586d81){_0x41085a=_0x41085a-0x0;var _0x5127a0=_0x5971[_0x41085a];return _0x5127a0;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x1597('0x0'))(_0x1597('0x1'));var rpc={'chatMessage':require(_0x1597('0x2')),'openchannelMessage':require(_0x1597('0x3')),'mailMessage':require(_0x1597('0x4')),'smsMessage':require(_0x1597('0x5')),'faxMessage':require(_0x1597('0x6')),'whatsappMessage':require(_0x1597('0x7'))};exports[_0x1597('0x8')]=function(_0x357b5f,_0x26da1b){return function(_0x3d30ec){try{var _0x33deb1={'body':utils['getMustacheRender'](_0x26da1b[0x0],this),'ContactId':this[_0x1597('0x9')]['id']};if(this['channel']==='chat'){_0x33deb1[_0x1597('0xa')]=this[_0x1597('0xb')]['id'];}else{_0x33deb1[_['upperFirst'](this[_0x1597('0xc')])+'AccountId']=this[_0x1597('0xb')]['id'];}_0x33deb1[_[_0x1597('0xd')](this[_0x1597('0xc')])+_0x1597('0xe')]=this[_0x1597('0xf')]['id'];if(rpc[this[_0x1597('0xc')]+_0x1597('0x10')]){return rpc[this[_0x1597('0xc')]+_0x1597('0x10')][_0x1597('0x11')](_0x33deb1)[_0x1597('0x12')](function(_0x35200e){logger[_0x1597('0x13')]('[%s][MESSAGE]\x20%s',_0x357b5f,_0x33deb1[_0x1597('0x14')]);_0x3d30ec[_0x1597('0x15')]();})[_0x1597('0x16')](function(_0x5e56af){logger[_0x1597('0x17')](_0x1597('0x18'),_0x357b5f,JSON['stringify'](_0x5e56af));_0x3d30ec['stop']();});}}catch(_0x45645a){logger['error']('[%s][MESSAGE]\x20%s',_0x357b5f,JSON[_0x1597('0x19')](_0x45645a));_0x3d30ec[_0x1597('0x1a')]();}};}; \ No newline at end of file +var _0xc64b=['stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','contact','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0xc64b,0xaf));var _0xbc64=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0xc64b[_0x1f7413];return _0x2d2775;};'use strict';var _=require(_0xbc64('0x0'));var utils=require(_0xbc64('0x1'));var logger=require(_0xbc64('0x2'))(_0xbc64('0x3'));var rpc={'chatMessage':require(_0xbc64('0x4')),'openchannelMessage':require(_0xbc64('0x5')),'mailMessage':require(_0xbc64('0x6')),'smsMessage':require(_0xbc64('0x7')),'faxMessage':require(_0xbc64('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xbc64('0x9')]=function(_0x3671e3,_0x4afa1d){return function(_0x38f6a1){try{var _0x33af86={'body':utils['getMustacheRender'](_0x4afa1d[0x0],this),'ContactId':this[_0xbc64('0xa')]['id']};if(this[_0xbc64('0xb')]==='chat'){_0x33af86[_0xbc64('0xc')]=this[_0xbc64('0xd')]['id'];}else{_0x33af86[_[_0xbc64('0xe')](this[_0xbc64('0xb')])+_0xbc64('0xf')]=this[_0xbc64('0xd')]['id'];}_0x33af86[_[_0xbc64('0xe')](this[_0xbc64('0xb')])+_0xbc64('0x10')]=this[_0xbc64('0x11')]['id'];if(rpc[this[_0xbc64('0xb')]+_0xbc64('0x12')]){return rpc[this['channel']+_0xbc64('0x12')][_0xbc64('0x13')](_0x33af86)[_0xbc64('0x14')](function(_0x804ebc){logger[_0xbc64('0x15')](_0xbc64('0x16'),_0x3671e3,_0x33af86[_0xbc64('0x17')]);_0x38f6a1[_0xbc64('0x18')]();})[_0xbc64('0x19')](function(_0xa24e14){logger[_0xbc64('0x1a')](_0xbc64('0x16'),_0x3671e3,JSON[_0xbc64('0x1b')](_0xa24e14));_0x38f6a1[_0xbc64('0x1c')]();});}}catch(_0x1c79d3){logger['error'](_0xbc64('0x16'),_0x3671e3,JSON[_0xbc64('0x1b')](_0x1c79d3));_0x38f6a1[_0xbc64('0x1c')]();}};}; \ 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 675f0a7..2227d94 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 _0x8755=['error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next'];(function(_0x13f2c6,_0xa9d0ee){var _0x42f8ac=function(_0x41f12b){while(--_0x41f12b){_0x13f2c6['push'](_0x13f2c6['shift']());}};_0x42f8ac(++_0xa9d0ee);}(_0x8755,0x1a5));var _0x5875=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8755[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0x5875('0x0'));var logger=require(_0x5875('0x1'))(_0x5875('0x2'));exports[_0x5875('0x3')]=function(_0x4a9292,_0x3973dd){return function(_0x51cce0){try{logger[_0x5875('0x4')](_0x5875('0x5'),_0x4a9292,utils[_0x5875('0x6')](_0x3973dd[0x0],this));_0x51cce0[_0x5875('0x7')]();}catch(_0xfff262){logger[_0x5875('0x8')](_0x5875('0x5'),_0x4a9292,JSON[_0x5875('0x9')](_0xfff262));_0x51cce0[_0x5875('0xa')]();}};}; \ No newline at end of file +var _0xf605=['getMustacheRender','next','error','stringify','stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x3835b5,_0x423301){var _0x23d8d6=function(_0x4c9cfa){while(--_0x4c9cfa){_0x3835b5['push'](_0x3835b5['shift']());}};_0x23d8d6(++_0x423301);}(_0xf605,0xd7));var _0x5f60=function(_0x2382e2,_0x1c07e6){_0x2382e2=_0x2382e2-0x0;var _0x5e9fab=_0xf605[_0x2382e2];return _0x5e9fab;};'use strict';var utils=require(_0x5f60('0x0'));var logger=require('../../../../config/logger')(_0x5f60('0x1'));exports[_0x5f60('0x2')]=function(_0x20841b,_0x293554){return function(_0x4bbe02){try{logger[_0x5f60('0x3')](_0x5f60('0x4'),_0x20841b,utils[_0x5f60('0x5')](_0x293554[0x0],this));_0x4bbe02[_0x5f60('0x6')]();}catch(_0x23fd1c){logger[_0x5f60('0x7')](_0x5f60('0x4'),_0x20841b,JSON[_0x5f60('0x8')](_0x23fd1c));_0x4bbe02[_0x5f60('0x9')]();}};}; \ 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 4fb2846..5d9365b 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 _0xe75e=['stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','redis','defaults','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','remove','pick','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','catch','error','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','[%s][QUEUE]\x20%s','map','stop','find','createQueue','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s'];(function(_0x235d23,_0x147b52){var _0x3a0d78=function(_0x564e77){while(--_0x564e77){_0x235d23['push'](_0x235d23['shift']());}};_0x3a0d78(++_0x147b52);}(_0xe75e,0x15f));var _0xee75=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xe75e[_0xa148b7];return _0x51efd3;};'use strict';var schema=require(_0xee75('0x0'));var _=require(_0xee75('0x1'));var util=require(_0xee75('0x2'));var seqqueue=require(_0xee75('0x3'));var moment=require('moment');var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0xee75('0x4'))(_0xee75('0x5'));var strategy=require('./strategy');config[_0xee75('0x6')]=_[_0xee75('0x7')](config[_0xee75('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xee75('0x6')]));var attributes=['id',_0xee75('0x8'),_0xee75('0x9'),_0xee75('0xa'),_0xee75('0xb'),_0xee75('0xc')];function emit(_0x4e5428,_0x573fac,_0x492660){io['to'](_0x4e5428)[_0xee75('0xd')](_0x573fac,_0x492660);}function emitChannelQueueInteraction(_0x277cc6,_0x3543e5,_0x21db92,_0x1b3c87,_0x1535c7,_0x27917a,_0x38927d,_0x25035a){var _0x279189=_[_0xee75('0xe')](_0x21db92);_0x279189[_0xee75('0x8')]=_0x25035a;_0x279189[_0xee75('0xa')]=_0x3543e5;_0x279189[_0xee75('0x9')]=_0x1b3c87;_0x279189['id']=_0x1535c7;if(_0x27917a){_0x38927d[util[_0xee75('0xf')](_0xee75('0x10'),_0x277cc6)][_0x1535c7]=_['pick'](_0x279189,attributes);}else{delete _0x38927d[util[_0xee75('0xf')]('%sQueuesWaitingInteractions',_0x277cc6)][_0x1535c7];}emit(util['format']('%s:queue:%s',_0x277cc6,_0x3543e5),util[_0xee75('0xf')]('%s_queue_waiting_interaction:%s',_0x277cc6,_0x27917a?'save':_0xee75('0x11')),_[_0xee75('0x12')](_0x279189,attributes));}var rpc={'openchannelQueueReport':require(_0xee75('0x13')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xee75('0x14')),'smsQueueReport':require(_0xee75('0x15')),'faxQueueReport':require(_0xee75('0x16')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xee75('0x17'),'required':!![],'message':_0xee75('0x18')},'timeout':{'type':'number','message':_0xee75('0x19')}});function startRouting(_0x1c0c49,_0x3b33f4,_0x2bda94,_0x153b4e){if(_0x1c0c49&&_0x3b33f4&&_0x2bda94){_0x3b33f4[_0xee75('0x1a')]+=0x1;var _0x3f7957={'uniqueid':_0x1c0c49,'from':_0x2bda94[_0xee75('0x1b')]?_0x2bda94['body'][_0xee75('0xb')]:'','joinAt':moment()[_0xee75('0xf')](_0xee75('0x1c')),'ContactId':_0x2bda94['contact']?_0x2bda94[_0xee75('0x1d')]['id']:null,'ListId':_0x2bda94[_0xee75('0x1e')]?_0x2bda94[_0xee75('0x1e')]['id']:null};_0x3f7957[_[_0xee75('0x1f')](_0x2bda94[_0xee75('0x20')])+_0xee75('0x21')]=_0x3b33f4['id']||null;_0x3f7957[_['upperFirst'](_0x2bda94[_0xee75('0x20')])+_0xee75('0x22')]=_0x2bda94[_0xee75('0x23')]?_0x2bda94[_0xee75('0x23')]['id']:null;_0x3f7957[_[_0xee75('0x1f')](_0x2bda94[_0xee75('0x20')])+_0xee75('0x24')]=_0x2bda94[_0xee75('0x25')]?_0x2bda94[_0xee75('0x25')]['id']:null;_0x3f7957[_[_0xee75('0x1f')](_0x2bda94[_0xee75('0x20')])+(_0x2bda94[_0xee75('0x20')]!==_0xee75('0x26')?_0xee75('0x27'):'WebsiteId')]=_0x2bda94[_0xee75('0x9')]?_0x2bda94[_0xee75('0x9')]['id']:null;logger[_0xee75('0x28')](util['format'](_0xee75('0x29'),_0x1c0c49,_0x3b33f4[_0xee75('0x2a')]));emitChannelQueueInteraction(_0x2bda94['channel'],_0x3b33f4['name'],_0x3f7957,_0x2bda94['account'][_0xee75('0x2a')],_0x2bda94['message']['id'],!![],_0x153b4e,_0x3b33f4['id']);if(rpc[_0x2bda94[_0xee75('0x20')]+_0xee75('0x2b')]){return rpc[_0x2bda94[_0xee75('0x20')]+_0xee75('0x2b')]['create'](_0x3f7957)['catch'](function(_0x13bc4e){logger['error'](_0xee75('0x2c'));});}}}function stopRouting(_0x56a9cf,_0x1bd523,_0x23dd30,_0x8dcea3){if(_0x56a9cf&&_0x1bd523){_0x1bd523[_0xee75('0x1a')]-=0x1;var _0x32eba2={'leaveAt':moment()[_0xee75('0xf')](_0xee75('0x1c')),'acceptAt':moment()[_0xee75('0xf')](_0xee75('0x1c')),'reason':_0xee75('0x2d')};logger[_0xee75('0x28')](util[_0xee75('0xf')](_0xee75('0x2e'),_0x56a9cf,_0x1bd523[_0xee75('0x2a')]));emitChannelQueueInteraction(_0x23dd30['channel'],_0x1bd523[_0xee75('0x2a')],_0x23dd30[_0xee75('0x1b')],_0x23dd30[_0xee75('0x9')][_0xee75('0x2a')],_0x23dd30[_0xee75('0x25')]['id'],![],_0x8dcea3,_0x1bd523['id']);if(rpc[_0x23dd30['channel']+'QueueReport']){return rpc[_0x23dd30[_0xee75('0x20')]+'QueueReport'][_0xee75('0x2f')](_0x56a9cf,_0x32eba2)[_0xee75('0x30')](function(_0x29f808){logger[_0xee75('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x4f263d,_0x140a1c,_0x253705,_0x586f47){if(_0x4f263d&&_0x140a1c){_0x140a1c['waiting']-=0x1;var _0x31078d={'leaveAt':moment()[_0xee75('0xf')](_0xee75('0x1c')),'exitAt':moment()[_0xee75('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xee75('0x32')};logger['info'](util[_0xee75('0xf')](_0xee75('0x33'),_0x4f263d,_0x140a1c[_0xee75('0x2a')]));emitChannelQueueInteraction(_0x253705['channel'],_0x140a1c[_0xee75('0x2a')],_0x253705[_0xee75('0x1b')],_0x253705[_0xee75('0x9')][_0xee75('0x2a')],_0x253705[_0xee75('0x25')]['id'],![],_0x586f47);if(rpc[_0x253705[_0xee75('0x20')]+'QueueReport']){return rpc[_0x253705[_0xee75('0x20')]+_0xee75('0x2b')][_0xee75('0x2f')](_0x4f263d,_0x31078d)[_0xee75('0x30')](function(_0x520ba4){logger['error'](_0xee75('0x34'));});}}}function handleFindQueue(_0x4d1685){return function(_0x4c5e1f){return _0x4c5e1f[_0xee75('0x2a')][_0xee75('0x35')]()===_0x4d1685['toLowerCase']();};}exports['consequence']=function(_0x3b157d,_0x34f2ba,_0x2f5710,_0x4cca0f){return function(_0x324b6f){try{var _0x2f1fe4={'name':_0x34f2ba[0x0],'timeout':_0x34f2ba[0x1]};var _0x3ea384=queue[_0xee75('0x0')](_0x2f1fe4,{'typecast':!![]});if(_0x3ea384['length']){logger[_0xee75('0x31')](_0xee75('0x36'),_0x3b157d,_[_0xee75('0x37')](_0x3ea384,'message')['join'](',\x20'));_0x324b6f[_0xee75('0x38')]();}else{var _0x537b3d=_[_0xee75('0x39')](_0x2f5710[_0x4cca0f[_0xee75('0x20')]+'Queues'],handleFindQueue(_0x2f1fe4['name']));if(_0x537b3d){startRouting(_0x3b157d,_0x537b3d,_0x4cca0f,_0x2f5710);var _0x32c4fc=(_0x537b3d[_0xee75('0x32')]||0xa)*0x3e8;var _0x48b9c6=(_0x2f1fe4[_0xee75('0x32')]||0x14)*0x3e8;var _0x1f9b78,_0x15a202;if(_0x32c4fc>_0x48b9c6){_0x48b9c6=_0x32c4fc;}var _0x286711=seqqueue[_0xee75('0x3a')](_0x32c4fc);_0x286711['id']=_0x3b157d;_0x286711['atimeout']=_0x32c4fc;_0x286711['qtimeout']=_0x48b9c6;_0x286711[_0xee75('0x20')]=_0x4cca0f['channel'];_0x2f5710[_0xee75('0x3b')][_0x3b157d]['on']('end',function(){logger[_0xee75('0x28')](_0xee75('0x3c'),_0x3b157d);stopRouting(_0x3b157d,_0x537b3d,_0x4cca0f,_0x2f5710);clearTimeout(_0x1f9b78);_0x1f9b78=undefined;_0x286711[_0xee75('0x3d')](!![]);if(_0x2f5710['rules'][_0x3b157d]){delete _0x2f5710['rules'][_0x3b157d];}_0x324b6f['stop']();});_0x2f5710[_0xee75('0x3b')][_0x3b157d]['on'](_0xee75('0x3e'),function(){if(_0x2f5710[_0xee75('0x3b')][_0x3b157d]){delete _0x2f5710[_0xee75('0x3b')][_0x3b157d];}});_0x1f9b78=setTimeout(function(){logger[_0xee75('0x28')](_0xee75('0x3f'),_0x3b157d);endRouting(_0x3b157d,_0x537b3d,_0x4cca0f,_0x2f5710);clearTimeout(_0x1f9b78);_0x286711[_0xee75('0x3d')](!![]);_0x324b6f[_0xee75('0x40')]();},_0x48b9c6);switch(_0x537b3d[_0xee75('0x41')]){case _0xee75('0x42'):strategy[_0xee75('0x42')](_0x286711,_0x537b3d,_0x2f5710,_0x4cca0f);break;default:strategy[_0xee75('0x43')](_0x286711,_0x537b3d,_0x2f5710,_0x4cca0f);}}else{logger['error'](_0xee75('0x44'),_0x3b157d,_0x2f1fe4[_0xee75('0x2a')]);_0x324b6f['stop']();}}}catch(_0x32ca5b){console['log'](_0x32ca5b);logger[_0xee75('0x31')](_0xee75('0x36'),_0x3b157d,_0x32ca5b[_0xee75('0x45')]);_0x324b6f['stop']();}};}; \ No newline at end of file +var _0xff47=['timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','QueueId','upperFirst','interaction','channel','MessageId','message','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','info','[%s][END:QUEUE][NAME:%s]','toLowerCase','validate','[%s][QUEUE]\x20%s','map','stop','Queues','createQueue','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','queue_id','account','queue','from','joinAt','emit','clone','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x1b57f9,_0x4b9858){var _0x53c7ae=function(_0x89d9e5){while(--_0x89d9e5){_0x1b57f9['push'](_0x1b57f9['shift']());}};_0x53c7ae(++_0x4b9858);}(_0xff47,0x15c));var _0x7ff4=function(_0x27031e,_0x1eb8cd){_0x27031e=_0x27031e-0x0;var _0xfd46b3=_0xff47[_0x27031e];return _0xfd46b3;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x7ff4('0x0'));var seqqueue=require(_0x7ff4('0x1'));var moment=require(_0x7ff4('0x2'));var Redis=require(_0x7ff4('0x3'));var config=require(_0x7ff4('0x4'));var logger=require(_0x7ff4('0x5'))(_0x7ff4('0x6'));var strategy=require('./strategy');config[_0x7ff4('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0x7ff4('0x8'),_0x7ff4('0x9'),_0x7ff4('0xa'),_0x7ff4('0xb'),_0x7ff4('0xc')];function emit(_0x30ae46,_0x2d0b00,_0x2690b8){io['to'](_0x30ae46)[_0x7ff4('0xd')](_0x2d0b00,_0x2690b8);}function emitChannelQueueInteraction(_0x28a02b,_0x459da3,_0x7bcb99,_0x260e6a,_0x2d7b51,_0x1da751,_0x4ecf01,_0x393b88){var _0x2a4ce7=_[_0x7ff4('0xe')](_0x7bcb99);_0x2a4ce7[_0x7ff4('0x8')]=_0x393b88;_0x2a4ce7[_0x7ff4('0xa')]=_0x459da3;_0x2a4ce7[_0x7ff4('0x9')]=_0x260e6a;_0x2a4ce7['id']=_0x2d7b51;if(_0x1da751){_0x4ecf01[util['format']('%sQueuesWaitingInteractions',_0x28a02b)][_0x2d7b51]=_[_0x7ff4('0xf')](_0x2a4ce7,attributes);}else{delete _0x4ecf01[util[_0x7ff4('0x10')](_0x7ff4('0x11'),_0x28a02b)][_0x2d7b51];}emit(util[_0x7ff4('0x10')](_0x7ff4('0x12'),_0x28a02b,_0x459da3),util[_0x7ff4('0x10')](_0x7ff4('0x13'),_0x28a02b,_0x1da751?_0x7ff4('0x14'):_0x7ff4('0x15')),_[_0x7ff4('0xf')](_0x2a4ce7,attributes));}var rpc={'openchannelQueueReport':require(_0x7ff4('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x7ff4('0x17')),'smsQueueReport':require(_0x7ff4('0x18')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x7ff4('0x19'),'required':!![],'message':_0x7ff4('0x1a')},'timeout':{'type':'number','message':_0x7ff4('0x1b')}});function startRouting(_0x4f9da7,_0x3ec51f,_0x16390d,_0x27651e){if(_0x4f9da7&&_0x3ec51f&&_0x16390d){_0x3ec51f[_0x7ff4('0x1c')]+=0x1;var _0x4ad58f={'uniqueid':_0x4f9da7,'from':_0x16390d[_0x7ff4('0x1d')]?_0x16390d[_0x7ff4('0x1d')][_0x7ff4('0xb')]:'','joinAt':moment()[_0x7ff4('0x10')](_0x7ff4('0x1e')),'ContactId':_0x16390d['contact']?_0x16390d[_0x7ff4('0x1f')]['id']:null,'ListId':_0x16390d[_0x7ff4('0x20')]?_0x16390d[_0x7ff4('0x20')]['id']:null};_0x4ad58f[_['upperFirst'](_0x16390d['channel'])+_0x7ff4('0x21')]=_0x3ec51f['id']||null;_0x4ad58f[_[_0x7ff4('0x22')](_0x16390d['channel'])+'InteractionId']=_0x16390d[_0x7ff4('0x23')]?_0x16390d[_0x7ff4('0x23')]['id']:null;_0x4ad58f[_[_0x7ff4('0x22')](_0x16390d[_0x7ff4('0x24')])+_0x7ff4('0x25')]=_0x16390d[_0x7ff4('0x26')]?_0x16390d[_0x7ff4('0x26')]['id']:null;_0x4ad58f[_[_0x7ff4('0x22')](_0x16390d[_0x7ff4('0x24')])+(_0x16390d[_0x7ff4('0x24')]!=='chat'?_0x7ff4('0x27'):_0x7ff4('0x28'))]=_0x16390d[_0x7ff4('0x9')]?_0x16390d[_0x7ff4('0x9')]['id']:null;logger['info'](util[_0x7ff4('0x10')](_0x7ff4('0x29'),_0x4f9da7,_0x3ec51f['name']));emitChannelQueueInteraction(_0x16390d[_0x7ff4('0x24')],_0x3ec51f[_0x7ff4('0x2a')],_0x4ad58f,_0x16390d['account'][_0x7ff4('0x2a')],_0x16390d['message']['id'],!![],_0x27651e,_0x3ec51f['id']);if(rpc[_0x16390d[_0x7ff4('0x24')]+_0x7ff4('0x2b')]){return rpc[_0x16390d['channel']+'QueueReport'][_0x7ff4('0x2c')](_0x4ad58f)[_0x7ff4('0x2d')](function(_0x757da5){logger[_0x7ff4('0x2e')](_0x7ff4('0x2f'));});}}}function stopRouting(_0x428369,_0x181218,_0xe2e48f,_0x58b84d){if(_0x428369&&_0x181218){_0x181218[_0x7ff4('0x1c')]-=0x1;var _0x1eced3={'leaveAt':moment()[_0x7ff4('0x10')](_0x7ff4('0x1e')),'acceptAt':moment()[_0x7ff4('0x10')](_0x7ff4('0x1e')),'reason':_0x7ff4('0x30')};logger['info'](util['format'](_0x7ff4('0x31'),_0x428369,_0x181218[_0x7ff4('0x2a')]));emitChannelQueueInteraction(_0xe2e48f['channel'],_0x181218[_0x7ff4('0x2a')],_0xe2e48f[_0x7ff4('0x1d')],_0xe2e48f[_0x7ff4('0x9')][_0x7ff4('0x2a')],_0xe2e48f[_0x7ff4('0x26')]['id'],![],_0x58b84d,_0x181218['id']);if(rpc[_0xe2e48f[_0x7ff4('0x24')]+'QueueReport']){return rpc[_0xe2e48f[_0x7ff4('0x24')]+_0x7ff4('0x2b')][_0x7ff4('0x32')](_0x428369,_0x1eced3)['catch'](function(_0x41a84f){logger[_0x7ff4('0x2e')](_0x7ff4('0x33'));});}}}function endRouting(_0xf90eab,_0x23b6fc,_0x592e39,_0x5b99e6){if(_0xf90eab&&_0x23b6fc){_0x23b6fc[_0x7ff4('0x1c')]-=0x1;var _0x12c84a={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x7ff4('0x10')](_0x7ff4('0x1e')),'reason':_0x7ff4('0x34')};logger[_0x7ff4('0x35')](util['format'](_0x7ff4('0x36'),_0xf90eab,_0x23b6fc[_0x7ff4('0x2a')]));emitChannelQueueInteraction(_0x592e39[_0x7ff4('0x24')],_0x23b6fc['name'],_0x592e39[_0x7ff4('0x1d')],_0x592e39['account'][_0x7ff4('0x2a')],_0x592e39[_0x7ff4('0x26')]['id'],![],_0x5b99e6);if(rpc[_0x592e39['channel']+_0x7ff4('0x2b')]){return rpc[_0x592e39[_0x7ff4('0x24')]+_0x7ff4('0x2b')][_0x7ff4('0x32')](_0xf90eab,_0x12c84a)[_0x7ff4('0x2d')](function(_0x4c8c72){logger['error'](_0x7ff4('0x33'));});}}}function handleFindQueue(_0x33b0f9){return function(_0x2d2f4c){return _0x2d2f4c['name'][_0x7ff4('0x37')]()===_0x33b0f9['toLowerCase']();};}exports['consequence']=function(_0x2fee0f,_0x58e907,_0x20113d,_0x7cb6e8){return function(_0x3d619b){try{var _0x5e6bc8={'name':_0x58e907[0x0],'timeout':_0x58e907[0x1]};var _0x3f8dd9=queue[_0x7ff4('0x38')](_0x5e6bc8,{'typecast':!![]});if(_0x3f8dd9['length']){logger[_0x7ff4('0x2e')](_0x7ff4('0x39'),_0x2fee0f,_[_0x7ff4('0x3a')](_0x3f8dd9,_0x7ff4('0x26'))['join'](',\x20'));_0x3d619b[_0x7ff4('0x3b')]();}else{var _0x3a1415=_['find'](_0x20113d[_0x7cb6e8[_0x7ff4('0x24')]+_0x7ff4('0x3c')],handleFindQueue(_0x5e6bc8[_0x7ff4('0x2a')]));if(_0x3a1415){startRouting(_0x2fee0f,_0x3a1415,_0x7cb6e8,_0x20113d);var _0x207727=(_0x3a1415[_0x7ff4('0x34')]||0xa)*0x3e8;var _0x1f95d0=(_0x5e6bc8['timeout']||0x14)*0x3e8;var _0x2b1ee5,_0x339f44;if(_0x207727>_0x1f95d0){_0x1f95d0=_0x207727;}var _0x31bc01=seqqueue[_0x7ff4('0x3d')](_0x207727);_0x31bc01['id']=_0x2fee0f;_0x31bc01['atimeout']=_0x207727;_0x31bc01[_0x7ff4('0x3e')]=_0x1f95d0;_0x31bc01[_0x7ff4('0x24')]=_0x7cb6e8[_0x7ff4('0x24')];_0x20113d['rules'][_0x2fee0f]['on'](_0x7ff4('0x3f'),function(){logger[_0x7ff4('0x35')](_0x7ff4('0x40'),_0x2fee0f);stopRouting(_0x2fee0f,_0x3a1415,_0x7cb6e8,_0x20113d);clearTimeout(_0x2b1ee5);_0x2b1ee5=undefined;_0x31bc01[_0x7ff4('0x41')](!![]);if(_0x20113d[_0x7ff4('0x42')][_0x2fee0f]){delete _0x20113d['rules'][_0x2fee0f];}_0x3d619b[_0x7ff4('0x3b')]();});_0x20113d[_0x7ff4('0x42')][_0x2fee0f]['on'](_0x7ff4('0x43'),function(){if(_0x20113d[_0x7ff4('0x42')][_0x2fee0f]){delete _0x20113d[_0x7ff4('0x42')][_0x2fee0f];}});_0x2b1ee5=setTimeout(function(){logger[_0x7ff4('0x35')](_0x7ff4('0x44'),_0x2fee0f);endRouting(_0x2fee0f,_0x3a1415,_0x7cb6e8,_0x20113d);clearTimeout(_0x2b1ee5);_0x31bc01[_0x7ff4('0x41')](!![]);_0x3d619b['next']();},_0x1f95d0);switch(_0x3a1415[_0x7ff4('0x45')]){case _0x7ff4('0x46'):strategy[_0x7ff4('0x46')](_0x31bc01,_0x3a1415,_0x20113d,_0x7cb6e8);break;default:strategy[_0x7ff4('0x47')](_0x31bc01,_0x3a1415,_0x20113d,_0x7cb6e8);}}else{logger[_0x7ff4('0x2e')](_0x7ff4('0x48'),_0x2fee0f,_0x5e6bc8['name']);_0x3d619b[_0x7ff4('0x3b')]();}}}catch(_0x2aac2a){console[_0x7ff4('0x49')](_0x2aac2a);logger[_0x7ff4('0x2e')](_0x7ff4('0x39'),_0x2fee0f,_0x2aac2a[_0x7ff4('0x4a')]);_0x3d619b['stop']();}};}; \ 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 62c5697..9952cd2 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 _0x6cf5=['isAgentAvailable','realtime','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','STOP','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','routing','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agents','forcedOwnership'];(function(_0x54dcf4,_0x1ea166){var _0x3df161=function(_0x36497d){while(--_0x36497d){_0x54dcf4['push'](_0x54dcf4['shift']());}};_0x3df161(++_0x1ea166);}(_0x6cf5,0x18c));var _0x56cf=function(_0x1c81d6,_0x4525b4){_0x1c81d6=_0x1c81d6-0x0;var _0x4000d7=_0x6cf5[_0x1c81d6];return _0x4000d7;};'use strict';var _=require(_0x56cf('0x0'));var uuid=require(_0x56cf('0x1'));var util=require(_0x56cf('0x2'));var logger=require(_0x56cf('0x3'))('routing');var Agent=function(_0x1f02f6,_0x589f4f,_0x1791fe,_0x115399){this[_0x56cf('0x4')]=uuid['v4']();this[_0x56cf('0x5')]=_0x1f02f6;this[_0x56cf('0x6')]=_0x589f4f;this['realtime']=_0x1791fe;this[_0x56cf('0x7')]=_0x115399;this[_0x56cf('0x5')][_0x56cf('0x8')](this[_0x56cf('0x9')]['bind'](this),this[_0x56cf('0xa')][_0x56cf('0xb')](this));this[_0x56cf('0x5')]['on'](_0x56cf('0xc'),this[_0x56cf('0xa')][_0x56cf('0xb')](this));this[_0x56cf('0x5')]['on'](_0x56cf('0xd'),this[_0x56cf('0xe')][_0x56cf('0xb')](this));};Agent[_0x56cf('0xf')][_0x56cf('0x8')]=function(){this['squeue'][_0x56cf('0x8')](this['handleRun']['bind'](this),this[_0x56cf('0xa')][_0x56cf('0xb')](this));};Agent['prototype'][_0x56cf('0xe')]=function(){this[_0x56cf('0xa')](!![]);};Agent[_0x56cf('0xf')][_0x56cf('0x9')]=function(_0x2804be){logger[_0x56cf('0x10')](_0x56cf('0x11'),this[_0x56cf('0x5')]['id'],this[_0x56cf('0x6')]['id']);if(_['isNil'](this['realtime'][_0x56cf('0x12')][this[_0x56cf('0x6')]['id']])){logger[_0x56cf('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x56cf('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x56cf('0x8')][_0x56cf('0xb')](this),0x3e8);}else{if(this[_0x56cf('0x7')][_0x56cf('0x13')]||util[_0x56cf('0x14')](this[_0x56cf('0x5')]['id'],this[_0x56cf('0x15')]['agents'][this[_0x56cf('0x6')]['id']],this['squeue']['channel'],![])){this[_0x56cf('0x15')][_0x56cf('0x12')][this['agent']['id']][_0x56cf('0x16')]=!![];this[_0x56cf('0x15')]['agents'][this[_0x56cf('0x6')]['id']][_0x56cf('0x17')]=undefined;util[_0x56cf('0x18')](this['notificationId'],this[_0x56cf('0x5')]['id'],this[_0x56cf('0x15')][_0x56cf('0x12')][this[_0x56cf('0x6')]['id']],null,this[_0x56cf('0x7')]);util[_0x56cf('0x19')](this['squeue']['id'],this['realtime'][_0x56cf('0x12')][this[_0x56cf('0x6')]['id']],_0x56cf('0x1a')+(this['routing'][_0x56cf('0x13')]?_0x56cf('0x1b'):''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x56cf('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x56cf('0x8')][_0x56cf('0xb')](this),0x3e8);}}};Agent[_0x56cf('0xf')][_0x56cf('0xa')]=function(_0x5c3383){if(_['isNil'](this['realtime'][_0x56cf('0x12')][this[_0x56cf('0x6')]['id']])){return logger['info'](_0x56cf('0x1c'),this[_0x56cf('0x5')]['id'],this[_0x56cf('0x6')]['id']);}else{logger[_0x56cf('0x10')](_0x56cf('0x1d'),this[_0x56cf('0x5')]['id'],this[_0x56cf('0x6')]['id']);util['hideNotification'](this[_0x56cf('0x4')],this[_0x56cf('0x5')]['id'],this['realtime'][_0x56cf('0x12')][this[_0x56cf('0x6')]['id']],null,this[_0x56cf('0x7')]);this[_0x56cf('0x15')][_0x56cf('0x12')][this[_0x56cf('0x6')]['id']]['busy']=![];this[_0x56cf('0x15')]['agents'][this[_0x56cf('0x6')]['id']]['busyQueue']=undefined;util['writeLog'](this['squeue']['id'],this[_0x56cf('0x15')][_0x56cf('0x12')][this[_0x56cf('0x6')]['id']],_0x5c3383?_0x56cf('0x1e'):'TIMEOUT');}if(!_0x5c3383){setTimeout(this[_0x56cf('0x8')][_0x56cf('0xb')](this),0x3e8);}};function agent(_0x46fd80,_0x4ad05e,_0x2a7e18,_0x17e15c){return new Agent(_0x46fd80,_0x4ad05e,_0x2a7e18,_0x17e15c);}module[_0x56cf('0x1f')]=agent; \ No newline at end of file +var _0x1e7c=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','realtime','routing','handleRun','bind','handleTimeout','handleDrained','prototype','push','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','agent','isAgentAvailable','busy','showNotification','writeLog','RINGING',':FORCED'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0x1e7c,0x1b7));var _0xc1e7=function(_0xe3fc30,_0x30f7e5){_0xe3fc30=_0xe3fc30-0x0;var _0x116a1e=_0x1e7c[_0xe3fc30];return _0x116a1e;};'use strict';var _=require(_0xc1e7('0x0'));var uuid=require(_0xc1e7('0x1'));var util=require(_0xc1e7('0x2'));var logger=require(_0xc1e7('0x3'))('routing');var Agent=function(_0x5c66b2,_0x4874bc,_0x186461,_0x29f116){this[_0xc1e7('0x4')]=uuid['v4']();this[_0xc1e7('0x5')]=_0x5c66b2;this['agent']=_0x4874bc;this[_0xc1e7('0x6')]=_0x186461;this[_0xc1e7('0x7')]=_0x29f116;this[_0xc1e7('0x5')]['push'](this[_0xc1e7('0x8')][_0xc1e7('0x9')](this),this['handleTimeout'][_0xc1e7('0x9')](this));this['squeue']['on']('timeout',this[_0xc1e7('0xa')][_0xc1e7('0x9')](this));this[_0xc1e7('0x5')]['on']('drained',this[_0xc1e7('0xb')][_0xc1e7('0x9')](this));};Agent[_0xc1e7('0xc')][_0xc1e7('0xd')]=function(){this[_0xc1e7('0x5')][_0xc1e7('0xd')](this[_0xc1e7('0x8')][_0xc1e7('0x9')](this),this[_0xc1e7('0xa')][_0xc1e7('0x9')](this));};Agent['prototype'][_0xc1e7('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0xc1e7('0xc')][_0xc1e7('0x8')]=function(_0x24d2a2){logger[_0xc1e7('0xe')](_0xc1e7('0xf'),this[_0xc1e7('0x5')]['id'],this['agent']['id']);if(_[_0xc1e7('0x10')](this[_0xc1e7('0x6')][_0xc1e7('0x11')][this[_0xc1e7('0x12')]['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xc1e7('0x5')]['id'],this[_0xc1e7('0x12')]['id']);setTimeout(this['push'][_0xc1e7('0x9')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0xc1e7('0x13')](this[_0xc1e7('0x5')]['id'],this[_0xc1e7('0x6')]['agents'][this[_0xc1e7('0x12')]['id']],this['squeue']['channel'],![])){this[_0xc1e7('0x6')][_0xc1e7('0x11')][this[_0xc1e7('0x12')]['id']][_0xc1e7('0x14')]=!![];this[_0xc1e7('0x6')][_0xc1e7('0x11')][this['agent']['id']]['busyQueue']=undefined;util[_0xc1e7('0x15')](this[_0xc1e7('0x4')],this[_0xc1e7('0x5')]['id'],this[_0xc1e7('0x6')][_0xc1e7('0x11')][this['agent']['id']],null,this['routing']);util[_0xc1e7('0x16')](this['squeue']['id'],this[_0xc1e7('0x6')]['agents'][this[_0xc1e7('0x12')]['id']],_0xc1e7('0x17')+(this[_0xc1e7('0x7')]['forcedOwnership']?_0xc1e7('0x18'):''));}else{logger[_0xc1e7('0xe')](_0xc1e7('0x19'),this[_0xc1e7('0x5')]['id'],this[_0xc1e7('0x12')]['id']);setTimeout(this[_0xc1e7('0xd')][_0xc1e7('0x9')](this),0x3e8);}}};Agent[_0xc1e7('0xc')]['handleTimeout']=function(_0x5a5359){if(_[_0xc1e7('0x10')](this[_0xc1e7('0x6')][_0xc1e7('0x11')][this['agent']['id']])){return logger[_0xc1e7('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xc1e7('0x5')]['id'],this['agent']['id']);}else{logger['info']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xc1e7('0x5')]['id'],this[_0xc1e7('0x12')]['id']);util['hideNotification'](this[_0xc1e7('0x4')],this['squeue']['id'],this[_0xc1e7('0x6')][_0xc1e7('0x11')][this[_0xc1e7('0x12')]['id']],null,this[_0xc1e7('0x7')]);this[_0xc1e7('0x6')]['agents'][this[_0xc1e7('0x12')]['id']][_0xc1e7('0x14')]=![];this[_0xc1e7('0x6')]['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0xc1e7('0x16')](this[_0xc1e7('0x5')]['id'],this['realtime'][_0xc1e7('0x11')][this['agent']['id']],_0x5a5359?_0xc1e7('0x1a'):_0xc1e7('0x1b'));}if(!_0x5a5359){setTimeout(this[_0xc1e7('0xd')][_0xc1e7('0x9')](this),0x3e8);}};function agent(_0x546ffb,_0x131c65,_0x39cced,_0x700254){return new Agent(_0x546ffb,_0x131c65,_0x39cced,_0x700254);}module[_0xc1e7('0x1c')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index ab1706b..013b154 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 _0x6c7b=['isNil','Agents','length','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','agents','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','notificationId','STOP','TIMEOUT','exports','lodash','routing','squeue','queue','realtime','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','push'];(function(_0x96baa6,_0x113c83){var _0x14c52b=function(_0x245500){while(--_0x245500){_0x96baa6['push'](_0x96baa6['shift']());}};_0x14c52b(++_0x113c83);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x11a7c9,_0x2de6e8){_0x11a7c9=_0x11a7c9-0x0;var _0x2bf3d8=_0x6c7b[_0x11a7c9];return _0x2bf3d8;};'use strict';var _=require(_0xb6c7('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require('../../../../../config/logger')(_0xb6c7('0x1'));var Beepall=function(_0x5528b3,_0x2b678a,_0x438aa8,_0x35674b){this['notificationId']=uuid['v4']();this[_0xb6c7('0x2')]=_0x5528b3;this[_0xb6c7('0x3')]=_0x2b678a;this[_0xb6c7('0x4')]=_0x438aa8;this[_0xb6c7('0x1')]=_0x35674b;this[_0xb6c7('0x2')]['push'](this[_0xb6c7('0x5')][_0xb6c7('0x6')](this),this[_0xb6c7('0x7')][_0xb6c7('0x6')](this));this[_0xb6c7('0x2')]['on'](_0xb6c7('0x8'),this[_0xb6c7('0x7')][_0xb6c7('0x6')](this));this['squeue']['on']('drained',this[_0xb6c7('0x9')][_0xb6c7('0x6')](this));};Beepall[_0xb6c7('0xa')][_0xb6c7('0xb')]=function(){this[_0xb6c7('0x2')][_0xb6c7('0xb')](this[_0xb6c7('0x5')]['bind'](this),this[_0xb6c7('0x7')][_0xb6c7('0x6')](this));};Beepall[_0xb6c7('0xa')][_0xb6c7('0x9')]=function(_0x4086a1){this[_0xb6c7('0x7')](!![]);};Beepall[_0xb6c7('0xa')]['handleRun']=function(_0x3c7ff4){var _0x4e4c3f=!![];if(!_['isNil'](this['queue'])&&!_[_0xb6c7('0xc')](this['queue'][_0xb6c7('0xd')])&&this[_0xb6c7('0x3')][_0xb6c7('0xd')][_0xb6c7('0xe')]>0x0){for(var _0x209659=0x0,_0x200833;_0x2096590x0){for(var _0x3d61bf=0x0,_0x45cc93;_0x3d61bf0x0&&_0x476a14[_0x4e07e1+_0x8488('0x23')]>=_0x476a14[_0x4e07e1+_0x8488('0x24')]){writeLog(_0x5123d0,_0x476a14,_0x4e07e1[_0x8488('0x25')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x8488('0x26')]=function(_0x38c137,_0xf9720e,_0x3df1f9,_0x460001,_0x27f5cf){return sendNotification(!![],_0x38c137,_0xf9720e,_0x3df1f9,_0x460001,_0x27f5cf);};exports[_0x8488('0x27')]=function(_0x296b6c,_0x368f9c,_0x1d9317,_0x888b24,_0x58d0cc){return sendNotification(![],_0x296b6c,_0x368f9c,_0x1d9317,_0x888b24,_0x58d0cc);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x8ca9=['user:%s','name','user:save','\x20interaction','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','save','remove','info','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','Capacity','CurrentCapacity','\x20MAXCAPACITY','hideNotification','writeLog','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','defaults','localhost','redis','emit','format'];(function(_0x8410b,_0x1fc9ae){var _0x1b716c=function(_0x3dbfac){while(--_0x3dbfac){_0x8410b['push'](_0x8410b['shift']());}};_0x1b716c(++_0x1fc9ae);}(_0x8ca9,0x9c));var _0x98ca=function(_0x5dadfd,_0x4df88e){_0x5dadfd=_0x5dadfd-0x0;var _0x5b5d4f=_0x8ca9[_0x5dadfd];return _0x5b5d4f;};'use strict';var _=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var utils=require(_0x98ca('0x2'));var Mustache=require(_0x98ca('0x3'));var Redis=require(_0x98ca('0x4'));var config=require(_0x98ca('0x5'));var logger=require(_0x98ca('0x6'))('routing');config['redis']=_[_0x98ca('0x7')](config['redis'],{'host':_0x98ca('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x98ca('0x9')]));function emit(_0xca4097,_0x18c349,_0x2852a0){io['to'](_0xca4097)[_0x98ca('0xa')](_0x18c349,_0x2852a0);}function sendNotification(_0x28a37a,_0x162bd0,_0x210234,_0x277c29,_0x404cc1,_0x572858){io['to'](util[_0x98ca('0xb')](_0x98ca('0xc'),_0x277c29[_0x98ca('0xd')]))[_0x98ca('0xa')](_0x98ca('0xe'),_0x277c29);var _0x276213=_0x572858||{};var _0x17ee87=_0x210234['split']('.');var _0x16221a={'uniqueid':_0x162bd0,'channel':_0x17ee87[0x0],'id':_0x17ee87[0x1],'title':_0x17ee87[0x0]+_0x98ca('0xf'),'interactionId':_0x17ee87[0x2],'queue':_0x404cc1?_0x404cc1[_0x98ca('0xd')]:null,'sound':_0x276213[_0x98ca('0x10')]['notificationSound'],'shake':_0x276213[_0x98ca('0x10')][_0x98ca('0x11')]};try{if(!_0x276213[_0x98ca('0x12')]){_0x276213[_0x98ca('0x12')]={};}if(_0x404cc1){_0x276213[_0x98ca('0x12')][_0x98ca('0x13')]=_0x404cc1;}else if(_0x276213[_0x98ca('0x12')]['queue']){delete _0x276213[_0x98ca('0x12')][_0x98ca('0x13')];}_0x16221a[_0x98ca('0x14')]=utils[_0x98ca('0x15')](_0x276213['account'][_0x98ca('0x16')],_0x276213);}catch(_0x3c2f65){_0x16221a[_0x98ca('0x14')]=_0x98ca('0x17');logger[_0x98ca('0x18')](util[_0x98ca('0xb')](_0x98ca('0x19'),_0x162bd0,_0x3c2f65[_0x98ca('0x1a')]));}io['to'](util[_0x98ca('0xb')](_0x98ca('0xc'),_0x277c29[_0x98ca('0xd')]))['emit'](util[_0x98ca('0xb')]('notification:%s',_0x28a37a?_0x98ca('0x1b'):_0x98ca('0x1c')),_0x16221a);}function writeLog(_0x50f8b4,_0x5ca905,_0x4620e3){return logger[_0x98ca('0x1d')](util[_0x98ca('0xb')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x50f8b4,_0x5ca905[_0x98ca('0xd')],_0x4620e3));}exports[_0x98ca('0x1e')]=function(_0x56f799,_0x6651c8,_0x5dc400,_0x3fd0bd){if(_0x6651c8[_0x98ca('0x1f')]){writeLog(_0x56f799,_0x6651c8,_0x98ca('0x20'));return![];}if(!_0x6651c8[_0x98ca('0x21')]){writeLog(_0x56f799,_0x6651c8,_0x98ca('0x22'));return![];}if(_0x6651c8[_0x5dc400+_0x98ca('0x23')]){writeLog(_0x56f799,_0x6651c8,_0x98ca('0x24'));return![];}if(_0x3fd0bd&&_0x6651c8['hasOwnProperty'](_0x5dc400+_0x98ca('0x25'))&&_0x6651c8['hasOwnProperty'](_0x5dc400+_0x98ca('0x26'))){if(_0x6651c8[_0x5dc400+_0x98ca('0x25')]>0x0&&_0x6651c8[_0x5dc400+'CurrentCapacity']>=_0x6651c8[_0x5dc400+_0x98ca('0x25')]){writeLog(_0x56f799,_0x6651c8,_0x5dc400['toUpperCase']()+_0x98ca('0x27'));return![];}}return!![];};exports['showNotification']=function(_0x5bf77d,_0x14bfb4,_0x540f45,_0x342a83,_0x35b920){return sendNotification(!![],_0x5bf77d,_0x14bfb4,_0x540f45,_0x342a83,_0x35b920);};exports[_0x98ca('0x28')]=function(_0x21a12a,_0x3b3e60,_0x1e7fcf,_0x11389a,_0x1bf154){return sendNotification(![],_0x21a12a,_0x3b3e60,_0x1e7fcf,_0x11389a,_0x1bf154);};exports[_0x98ca('0x29')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 5e7247e..d044344 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 _0xc39c=['message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','info','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','shelljs','lodash','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map'];(function(_0x4c15f1,_0x2f056c){var _0xc81295=function(_0x1f1eae){while(--_0x1f1eae){_0x4c15f1['push'](_0x4c15f1['shift']());}};_0xc81295(++_0x2f056c);}(_0xc39c,0x13a));var _0xcc39=function(_0x199517,_0x14328f){_0x199517=_0x199517-0x0;var _0x3ffd3c=_0xc39c[_0x199517];return _0x3ffd3c;};'use strict';var schema=require('validate');var sh=require(_0xcc39('0x0'));var _=require(_0xcc39('0x1'));var utils=require('./utils');var logger=require(_0xcc39('0x2'))(_0xcc39('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0xcc39('0x4')}});exports[_0xcc39('0x5')]=function(_0x145027,_0x10268e){return function(_0x5cc29a){try{var _0x1a4ef5={'command':_0x10268e[0x0]};var _0x56182e=system[_0xcc39('0x6')](_0x1a4ef5,{'typecast':!![]});if(_0x56182e[_0xcc39('0x7')]){logger[_0xcc39('0x8')](_0xcc39('0x9'),_0x145027,_[_0xcc39('0xa')](_0x56182e,_0xcc39('0xb'))[_0xcc39('0xc')](',\x20'));logger['info'](_0xcc39('0xd'),_0x145027);_0x5cc29a[_0xcc39('0xe')]();}else{var _0x5c8994=this;var _0x2fc0fc=utils['getMustacheRender'](_0x10268e[0x0],this);logger[_0xcc39('0xf')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x145027,_0x2fc0fc);sh[_0xcc39('0x10')](_[_0xcc39('0x11')](_0x2fc0fc),function(_0x316e17,_0x14dde8){logger[_0xcc39('0xf')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x145027,_0x316e17);if(_0x316e17==0x0){var _0x126dbe=_0x14dde8[_0xcc39('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xcc39('0x13')](_0x10268e[0x1])||_[_0xcc39('0x14')](_0x10268e[0x1])){logger[_0xcc39('0xf')](_0xcc39('0x15'),_0x145027);_0x5c8994[_0xcc39('0x16')][_0x10268e[0x1]]=_0x126dbe;}else{logger[_0xcc39('0xf')](_0xcc39('0x17'),_0x145027,_0x10268e[0x1],_0x126dbe);_0x5c8994['body'][_0x10268e[0x1]]=_0x126dbe;}}_0x5cc29a['next']();});}}catch(_0x28830f){logger[_0xcc39('0x8')](_0xcc39('0x9'),_0x145027,_[_0xcc39('0x18')](_0x28830f)?JSON['stringify'](_0x28830f):_0x28830f);logger['info'](_0xcc39('0xd'),_0x145027);_0x5cc29a['next']();}};}; \ No newline at end of file +var _0x1841=['length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','stringify','shelljs','lodash','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate'];(function(_0x54cda0,_0x3bf6e9){var _0x26f2c2=function(_0x18761f){while(--_0x18761f){_0x54cda0['push'](_0x54cda0['shift']());}};_0x26f2c2(++_0x3bf6e9);}(_0x1841,0xdf));var _0x1184=function(_0x4a6e03,_0x15174e){_0x4a6e03=_0x4a6e03-0x0;var _0x58854e=_0x1841[_0x4a6e03];return _0x58854e;};'use strict';var schema=require('validate');var sh=require(_0x1184('0x0'));var _=require(_0x1184('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x1184('0x2'));var system=schema({'command':{'type':_0x1184('0x3'),'required':!![],'message':_0x1184('0x4')}});exports[_0x1184('0x5')]=function(_0xc01198,_0x5a1882){return function(_0x31cb32){try{var _0x22d7c6={'command':_0x5a1882[0x0]};var _0x3e5b3d=system[_0x1184('0x6')](_0x22d7c6,{'typecast':!![]});if(_0x3e5b3d[_0x1184('0x7')]){logger[_0x1184('0x8')](_0x1184('0x9'),_0xc01198,_[_0x1184('0xa')](_0x3e5b3d,_0x1184('0xb'))[_0x1184('0xc')](',\x20'));logger[_0x1184('0xd')](_0x1184('0xe'),_0xc01198);_0x31cb32[_0x1184('0xf')]();}else{var _0x1c49fe=this;var _0xec26d7=utils[_0x1184('0x10')](_0x5a1882[0x0],this);logger[_0x1184('0xd')](_0x1184('0x11'),_0xc01198,_0xec26d7);sh[_0x1184('0x12')](_['trim'](_0xec26d7),function(_0xacebbb,_0x3f4515){logger[_0x1184('0xd')](_0x1184('0x13'),_0xc01198,_0xacebbb);if(_0xacebbb==0x0){var _0x3e2887=_0x3f4515['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x1184('0x14')](_0x5a1882[0x1])||_[_0x1184('0x15')](_0x5a1882[0x1])){logger[_0x1184('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0xc01198);_0x1c49fe['body'][_0x5a1882[0x1]]=_0x3e2887;}else{logger[_0x1184('0xd')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0xc01198,_0x5a1882[0x1],_0x3e2887);_0x1c49fe['body'][_0x5a1882[0x1]]=_0x3e2887;}}_0x31cb32[_0x1184('0xf')]();});}}catch(_0x103d99){logger[_0x1184('0x8')](_0x1184('0x9'),_0xc01198,_['isObject'](_0x103d99)?JSON[_0x1184('0x16')](_0x103d99):_0x103d99);logger[_0x1184('0xd')](_0x1184('0xe'),_0xc01198);_0x31cb32[_0x1184('0xf')]();}};}; \ 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 32fa0dc..adb52c5 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 _0x37c8=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','join','info','next','channel','Interaction','interaction','then','catch','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x1a06f0,_0x7984f){var _0x3f1ee6=function(_0x5f0fdb){while(--_0x5f0fdb){_0x1a06f0['push'](_0x1a06f0['shift']());}};_0x3f1ee6(++_0x7984f);}(_0x37c8,0x124));var _0x837c=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x37c8[_0x34bf97];return _0x292719;};'use strict';var schema=require(_0x837c('0x0'));var _=require(_0x837c('0x1'));var rpc={'chatInteraction':require(_0x837c('0x2')),'openchannelInteraction':require(_0x837c('0x3')),'smsInteraction':require(_0x837c('0x4')),'mailInteraction':require(_0x837c('0x5')),'faxInteraction':require(_0x837c('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x837c('0x7'))(_0x837c('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x837c('0x9')}});exports[_0x837c('0xa')]=function(_0x10e565,_0x828892,_0x4b3da1,_0x2ed9a6){return function(_0x1d8ca2){try{var _0x2ee48c={'tag':_0x828892[0x0]};var _0x4fd062=tag[_0x837c('0x0')](_0x2ee48c,{'typecast':!![]});if(_0x4fd062[_0x837c('0xb')]){logger[_0x837c('0xc')](_0x837c('0xd'),_0x10e565,_[_0x837c('0xe')](_0x4fd062,'message')[_0x837c('0xf')](',\x20'));logger[_0x837c('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x10e565);_0x1d8ca2[_0x837c('0x11')]();}else{var _0x51c5be={'ids':[_0x828892[0x0]]};if(rpc[_0x2ed9a6[_0x837c('0x12')]+_0x837c('0x13')]){rpc[_0x2ed9a6['channel']+_0x837c('0x13')]['addTags'](_0x2ed9a6[_0x837c('0x14')]['id'],_0x51c5be)[_0x837c('0x15')](function(_0x4b6a59){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x10e565,_0x828892[0x1],_0x2ed9a6['channel'],_0x2ed9a6[_0x837c('0x14')]['id']);})[_0x837c('0x16')](function(_0x3152f3){logger['error'](_0x837c('0xd'),_0x10e565,JSON['stringify'](_0x3152f3));logger[_0x837c('0x10')](_0x837c('0x17'),_0x10e565);})[_0x837c('0x18')](function(){_0x1d8ca2[_0x837c('0x11')]();});}}}catch(_0x3b7ed0){logger[_0x837c('0xc')](_0x837c('0xd'),_0x10e565,_[_0x837c('0x19')](_0x3b7ed0)?JSON[_0x837c('0x1a')](_0x3b7ed0):_0x3b7ed0);logger[_0x837c('0x10')](_0x837c('0x17'),_0x10e565);_0x1d8ca2[_0x837c('0x11')]();}};}; \ No newline at end of file +var _0x49b9=['interaction','stringify','finally','next','isObject','lodash','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','then','info'];(function(_0x4a3bb9,_0x477803){var _0x32fe1f=function(_0x19b38f){while(--_0x19b38f){_0x4a3bb9['push'](_0x4a3bb9['shift']());}};_0x32fe1f(++_0x477803);}(_0x49b9,0x1e5));var _0x949b=function(_0x2c8b14,_0x522352){_0x2c8b14=_0x2c8b14-0x0;var _0x19886a=_0x49b9[_0x2c8b14];return _0x19886a;};'use strict';var schema=require('validate');var _=require(_0x949b('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x949b('0x1')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x949b('0x2')),'whatsappInteraction':require(_0x949b('0x3'))};var logger=require(_0x949b('0x4'))(_0x949b('0x5'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x949b('0x6')}});exports[_0x949b('0x7')]=function(_0x9360f9,_0x49eda7,_0x23701f,_0x5efa88){return function(_0xf214bf){try{var _0xcdc17b={'tag':_0x49eda7[0x0]};var _0x225a87=tag['validate'](_0xcdc17b,{'typecast':!![]});if(_0x225a87[_0x949b('0x8')]){logger[_0x949b('0x9')](_0x949b('0xa'),_0x9360f9,_['map'](_0x225a87,_0x949b('0xb'))[_0x949b('0xc')](',\x20'));logger['info'](_0x949b('0xd'),_0x9360f9);_0xf214bf['next']();}else{var _0x426b10={'ids':[_0x49eda7[0x0]]};if(rpc[_0x5efa88[_0x949b('0xe')]+'Interaction']){rpc[_0x5efa88['channel']+_0x949b('0xf')][_0x949b('0x10')](_0x5efa88['interaction']['id'],_0x426b10)[_0x949b('0x11')](function(_0xbc4a8f){logger[_0x949b('0x12')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x9360f9,_0x49eda7[0x1],_0x5efa88[_0x949b('0xe')],_0x5efa88[_0x949b('0x13')]['id']);})['catch'](function(_0x2134c0){logger['error'](_0x949b('0xa'),_0x9360f9,JSON[_0x949b('0x14')](_0x2134c0));logger[_0x949b('0x12')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x9360f9);})[_0x949b('0x15')](function(){_0xf214bf[_0x949b('0x16')]();});}}}catch(_0x3b6958){logger[_0x949b('0x9')]('[%s][TAG]\x20%s',_0x9360f9,_[_0x949b('0x17')](_0x3b6958)?JSON['stringify'](_0x3b6958):_0x3b6958);logger['info'](_0x949b('0xd'),_0x9360f9);_0xf214bf['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 d5754d5..73054e2 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 _0xe944=['replace','\x20-\x20','includes','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','push','params','stringify','utf8','POST','application/json-rpc','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','lodash','consequence'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0xe944,0x124));var _0x4e94=function(_0x516813,_0x159e8e){_0x516813=_0x516813-0x0;var _0x22eaf1=_0xe944[_0x516813];return _0x22eaf1;};'use strict';var rp=require(_0x4e94('0x0'));var logger=require(_0x4e94('0x1'))(_0x4e94('0x2'));var _=require(_0x4e94('0x3'));var arr=[];exports[_0x4e94('0x4')]=function(_0x1fabe8,_0x42b15c){return function(_0x37e751){var _0x5360da=_0x42b15c[0xa];var _0x1d5560=_0x42b15c[0xb];var _0x556c32=_0x42b15c[0xc];var _0x2fec48=_0x42b15c[0xd];var _0x4f5603=_0x42b15c[0xe];var _0x591574=_0x42b15c[0xf][_0x4e94('0x5')](/\n/g,_0x4e94('0x6'));var _0x4fd64d=_0x42b15c[0x10][_0x4e94('0x5')](/\n/g,'\x20');if(!arr[_0x4e94('0x7')](_0x1d5560)){arr['push'](_0x1d5560);var _0x3f38ae=_0x42b15c[0x3];var _0x525eae=_0x42b15c[0x4];var _0x44ad11=_0x42b15c[0x1];var _0x6b21fe=_0x42b15c[0x0];var _0x1bfc48={};_0x1bfc48[_0x4e94('0x8')]=_0x42b15c[0x8]+_0x4e94('0x9')+_0x556c32+'|'+_0x5360da+'|'+_0x2fec48+'|'+_0x1d5560+'|'+_0x4f5603;_0x1bfc48['urlOnRing']=_0x42b15c[0x7]+'?params='+_0x556c32+'|'+_0x5360da+'|'+_0x2fec48+'|'+_0x1d5560+'|'+_0x4f5603+'|'+_0x591574+'|'+_0x4fd64d;_0x1bfc48[_0x4e94('0xa')]=_0x42b15c[0x9];var _0x2088e7={};_0x2088e7[_0x4e94('0xb')]=_0x4e94('0xc');_0x2088e7[_0x4e94('0xd')]=_0x4e94('0xe');var _0x31eb09=[];_0x31eb09[_0x4e94('0xf')](_0x42b15c[0x2]);_0x31eb09['push'](_0x42b15c[0x5]);_0x31eb09['push'](_0x42b15c[0x6]);_0x2088e7[_0x4e94('0x10')]=_0x31eb09;_0x2088e7['id']=0x1;var _0x298cd0=JSON[_0x4e94('0x11')](_0x2088e7);var _0x48dfdf={'encoding':_0x4e94('0x12'),'method':_0x4e94('0x13'),'timeout':0x2710,'url':_0x3f38ae,'headers':{'Content-Type':_0x4e94('0x14')},'body':_0x298cd0};return rp(_0x48dfdf)[_0x4e94('0x15')](function(_0x5bc815){const _0x409972=JSON['parse'](_0x5bc815);if(!_0x409972[_0x4e94('0x16')][_0x4e94('0x17')]){throw new Error(_0x4e94('0x18'));}var _0x2e6e91=_0x1d5560;var _0x4240d2=_0x4e94('0x19')+_0x44ad11+'&serviceId='+_0x6b21fe+'&sessionId='+_0x2e6e91+_0x4e94('0x1a')+JSON[_0x4e94('0x11')](_0x1bfc48);var _0x42e6b6=_0x525eae+'?'+_0x4240d2;return rp(_0x42e6b6);})['then'](function(_0x1dbd1b){logger[_0x4e94('0x1b')](_0x4e94('0x1c'),_0x1fabe8,_0x1dbd1b);_0x37e751['stop']();})[_0x4e94('0x1d')](function(_0x27a169){logger[_0x4e94('0x1e')]('[%s][TVOX]\x20%s',_0x1fabe8,_[_0x4e94('0x1f')](_0x27a169)?JSON['stringify'](_0x27a169):_0x27a169);_0x37e751['stop']();});}else{logger[_0x4e94('0x1b')](_0x4e94('0x20'),_0x1fabe8);_0x37e751['next']();}};}; \ No newline at end of file +var _0xee44=['then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','stringify','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','next','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','?params=','urlOnRing','2.0','method','login','push','params','utf8','application/json-rpc'];(function(_0x455e4b,_0x1e3882){var _0x47f093=function(_0x3315e7){while(--_0x3315e7){_0x455e4b['push'](_0x455e4b['shift']());}};_0x47f093(++_0x1e3882);}(_0xee44,0x1da));var _0x4ee4=function(_0x1602c4,_0x86f38f){_0x1602c4=_0x1602c4-0x0;var _0x4a0bc6=_0xee44[_0x1602c4];return _0x4a0bc6;};'use strict';var rp=require('request-promise');var logger=require(_0x4ee4('0x0'))(_0x4ee4('0x1'));var _=require(_0x4ee4('0x2'));var arr=[];exports[_0x4ee4('0x3')]=function(_0x596fff,_0x2a904f){return function(_0x48925a){var _0x25fc7f=_0x2a904f[0xa];var _0x5de9ac=_0x2a904f[0xb];var _0x295461=_0x2a904f[0xc];var _0x5ac85b=_0x2a904f[0xd];var _0x56dfc6=_0x2a904f[0xe];var _0x5e5f2b=_0x2a904f[0xf][_0x4ee4('0x4')](/\n/g,_0x4ee4('0x5'));var _0x194178=_0x2a904f[0x10][_0x4ee4('0x4')](/\n/g,'\x20');if(!arr[_0x4ee4('0x6')](_0x5de9ac)){arr['push'](_0x5de9ac);var _0x3d2076=_0x2a904f[0x3];var _0x178f8c=_0x2a904f[0x4];var _0x4c0d65=_0x2a904f[0x1];var _0x18149d=_0x2a904f[0x0];var _0x49ede0={};_0x49ede0['urlOnAnswer']=_0x2a904f[0x8]+_0x4ee4('0x7')+_0x295461+'|'+_0x25fc7f+'|'+_0x5ac85b+'|'+_0x5de9ac+'|'+_0x56dfc6;_0x49ede0[_0x4ee4('0x8')]=_0x2a904f[0x7]+_0x4ee4('0x7')+_0x295461+'|'+_0x25fc7f+'|'+_0x5ac85b+'|'+_0x5de9ac+'|'+_0x56dfc6+'|'+_0x5e5f2b+'|'+_0x194178;_0x49ede0['title']=_0x2a904f[0x9];var _0x4a04e8={};_0x4a04e8['jsonrpc']=_0x4ee4('0x9');_0x4a04e8[_0x4ee4('0xa')]=_0x4ee4('0xb');var _0x54af07=[];_0x54af07[_0x4ee4('0xc')](_0x2a904f[0x2]);_0x54af07[_0x4ee4('0xc')](_0x2a904f[0x5]);_0x54af07[_0x4ee4('0xc')](_0x2a904f[0x6]);_0x4a04e8[_0x4ee4('0xd')]=_0x54af07;_0x4a04e8['id']=0x1;var _0x46908b=JSON['stringify'](_0x4a04e8);var _0xaf418d={'encoding':_0x4ee4('0xe'),'method':'POST','timeout':0x2710,'url':_0x3d2076,'headers':{'Content-Type':_0x4ee4('0xf')},'body':_0x46908b};return rp(_0xaf418d)[_0x4ee4('0x10')](function(_0x3dde53){const _0x15c558=JSON[_0x4ee4('0x11')](_0x3dde53);if(!_0x15c558[_0x4ee4('0x12')][_0x4ee4('0x13')]){throw new Error(_0x4ee4('0x14'));}var _0x55f16a=_0x5de9ac;var _0x1e4e63=_0x4ee4('0x15')+_0x4c0d65+_0x4ee4('0x16')+_0x18149d+_0x4ee4('0x17')+_0x55f16a+_0x4ee4('0x18')+JSON[_0x4ee4('0x19')](_0x49ede0);var _0x4460b1=_0x178f8c+'?'+_0x1e4e63;return rp(_0x4460b1);})[_0x4ee4('0x10')](function(_0x66162c){logger[_0x4ee4('0x1a')](_0x4ee4('0x1b'),_0x596fff,_0x66162c);_0x48925a[_0x4ee4('0x1c')]();})[_0x4ee4('0x1d')](function(_0xa7308c){logger[_0x4ee4('0x1e')](_0x4ee4('0x1f'),_0x596fff,_[_0x4ee4('0x20')](_0xa7308c)?JSON[_0x4ee4('0x19')](_0xa7308c):_0xa7308c);_0x48925a[_0x4ee4('0x1c')]();});}else{logger['info'](_0x4ee4('0x21'),_0x596fff);_0x48925a[_0x4ee4('0x22')]();}};}; \ 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 10beb99..c1dc91c 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 _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x23aa57,_0x197a56){var _0x3a9d39=function(_0xddb91e){while(--_0xddb91e){_0x23aa57['push'](_0x23aa57['shift']());}};_0x3a9d39(++_0x197a56);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0xe80138,_0x59c70b){var _0x23a111=function(_0x3b4052){while(--_0x3b4052){_0xe80138['push'](_0xe80138['shift']());}};_0x23a111(++_0x59c70b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 4e3e843..02a5a26 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 _0x6836=['info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','paused','waiting','loggedIn','openchannelQueues','available','smsQueues','faxQueues','name','whatsappQueues','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','./applications/utils','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','split','push','dialogflow','slice','dialogflowv2','amazonlex','appdata','tag','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','./applications/','consequence','priority'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0x6836,0x1c0));var _0x6683=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x6836[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x6683('0x0'));var util=require(_0x6683('0x1'));var path=require(_0x6683('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x6683('0x3'));var uuid=require('uuid');var utils=require(_0x6683('0x4'));var config=require('../../../config/environment');var logger=require(_0x6683('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0x6683('0x6')),'mailQueueReport':require(_0x6683('0x7')),'chatQueueReport':require(_0x6683('0x8')),'smsQueueReport':require(_0x6683('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x6683('0xa'))};var RuleEngine=require(_0x6683('0xb'));function getId(_0x3d5224,_0x4673ea,_0x31fe4e){return util[_0x6683('0xc')]('%s.%s.%s',_0x3d5224,_0x4673ea||0x0,_0x31fe4e||0x0);}function getIntervals(_0x48e6a2,_0x1ccb60){var _0x3b478c=[];if(!_[_0x6683('0xd')](_0x1ccb60['IntervalId'])&&!_[_0x6683('0xd')](_0x48e6a2[_0x1ccb60['IntervalId']])&&!_[_0x6683('0xd')](_0x48e6a2[_0x1ccb60[_0x6683('0xe')]][_0x6683('0xf')])){_0x3b478c=_[_0x6683('0x10')](_0x48e6a2[_0x1ccb60[_0x6683('0xe')]][_0x6683('0xf')],_0x6683('0x11'));}else if(!_[_0x6683('0xd')](_0x1ccb60['interval'])){_0x3b478c=[_0x1ccb60[_0x6683('0x11')]];}return _0x3b478c;}exports[_0x6683('0x12')]=function(_0x4ccb6){_0x4ccb6[_0x6683('0x13')]={};return new BPromise(function(_0x2f6419,_0x5ea3c3){var _0x2a6c74={'Start':function(_0x44e850){var _0x3df040=this;return new Promise(function(_0x11fdef,_0xee9bd4){if(_0x44e850){try{var _0x1a689d=[];var _0x286695=getId(_0x44e850[_0x6683('0x14')],_0x44e850[_0x6683('0x15')]?_0x44e850[_0x6683('0x15')]['id']:0x0,_0x44e850['interaction']?_0x44e850[_0x6683('0x16')]['id']:0x0);if(_0x44e850[_0x6683('0x17')]&&_[_0x6683('0x18')](_0x44e850[_0x6683('0x17')])&&_0x44e850['applications'][_0x6683('0x19')]){for(var _0x153999=0x0;_0x153999<_0x44e850[_0x6683('0x17')][_0x6683('0x19')];_0x153999+=0x1){var _0x258708=_0x44e850[_0x6683('0x17')][_0x153999];if(fs[_0x6683('0x1a')](path[_0x6683('0x1b')](__dirname,_0x6683('0x17'),_0x258708[_0x6683('0x1c')]+_0x6683('0x1d')))){var _0x248177=[];switch(_0x258708[_0x6683('0x1c')][_0x6683('0x1e')]()){case _0x6683('0x1f'):var _0x28e1c1=_0x258708['appdata'][_0x6683('0x20')](',');if(_0x44e850[_0x6683('0x14')]==='mail'){_0x248177[_0x6683('0x21')](_0x28e1c1[0x0]);_0x248177[_0x6683('0x21')](_0x28e1c1[0x1]);_0x248177[_0x6683('0x21')](_0x28e1c1['slice'](0x2,_0x28e1c1[_0x6683('0x19')])[_0x6683('0x1b')](','));}else{_0x248177[_0x6683('0x21')](_0x28e1c1[0x0]);_0x248177[_0x6683('0x21')](_0x28e1c1['slice'](0x1,_0x28e1c1[_0x6683('0x19')])[_0x6683('0x1b')](','));}break;case _0x6683('0x22'):var _0x234d8f=_0x258708['appdata'][_0x6683('0x20')](',');_0x248177[_0x6683('0x21')](_0x234d8f[0x0]);_0x248177[_0x6683('0x21')](_0x234d8f[0x1]);_0x248177[_0x6683('0x21')](_0x234d8f[_0x6683('0x23')](0x2,_0x234d8f[_0x6683('0x19')])[_0x6683('0x1b')](','));break;case _0x6683('0x24'):var _0x1d2b1e=_0x258708['appdata'][_0x6683('0x20')](',');_0x248177[_0x6683('0x21')](_0x1d2b1e[0x0]);_0x248177['push'](_0x1d2b1e[0x1]);_0x248177[_0x6683('0x21')](_0x1d2b1e[0x2]);_0x248177[_0x6683('0x21')](_0x1d2b1e[0x3]);_0x248177['push'](_0x1d2b1e[_0x6683('0x23')](0x4,_0x1d2b1e['length'])[_0x6683('0x1b')](','));break;case _0x6683('0x25'):var _0x27fd8f=_0x258708[_0x6683('0x26')]['split'](',');_0x248177[_0x6683('0x21')](_0x27fd8f[0x0]);_0x248177[_0x6683('0x21')](_0x27fd8f[0x1]);_0x248177[_0x6683('0x21')](_0x27fd8f[0x2]);_0x248177[_0x6683('0x21')](_0x27fd8f[0x3]);_0x248177[_0x6683('0x21')](_0x27fd8f[_0x6683('0x23')](0x4,_0x27fd8f[_0x6683('0x19')])[_0x6683('0x1b')](','));break;case _0x6683('0x15'):_0x248177[_0x6683('0x21')](_0x258708[_0x6683('0x26')]);break;case _0x6683('0x27'):_0x248177[_0x6683('0x21')](_0x258708[_0x6683('0x28')]);_0x248177[_0x6683('0x21')](_0x258708['appdata']);break;case _0x6683('0x29'):var _0x5571ad=utils['getMustacheRender'](_0x44e850[_0x6683('0x2a')][_0x6683('0x2b')],_0x44e850);var _0x250a94=_0x258708[_0x6683('0x26')][_0x6683('0x20')](',');_0x248177[_0x6683('0x21')](_0x250a94[0x0]);_0x248177[_0x6683('0x21')](_0x250a94[0x1]);_0x248177[_0x6683('0x21')](_0x250a94[0x2]);_0x248177['push'](_0x250a94[0x3]);_0x248177[_0x6683('0x21')](_0x250a94[0x4]);_0x248177[_0x6683('0x21')](_0x250a94[0x5]);_0x248177[_0x6683('0x21')](_0x250a94[0x6]);_0x248177['push'](_0x250a94[0x7]);_0x248177['push'](_0x250a94[0x8]);_0x248177[_0x6683('0x21')](_0x250a94[0x9]);_0x248177['push'](_0x250a94[0xa]);_0x248177[_0x6683('0x21')](_0x44e850[_0x6683('0x16')]['id']);_0x248177['push'](_0x44e850[_0x6683('0x15')]['id']);_0x248177[_0x6683('0x21')](_0x258708[_0x6683('0x2c')]);_0x248177[_0x6683('0x21')](_0x44e850[_0x6683('0x16')][_0x6683('0x2d')]);_0x248177[_0x6683('0x21')](_0x44e850['body'][_0x6683('0x2e')]);_0x248177[_0x6683('0x21')](_0x5571ad);break;default:_0x248177=_[_0x6683('0xd')](_0x258708['appdata'])?[]:_0x258708['appdata'][_0x6683('0x20')](',');}var _0x14ae9c={'id':util['format'](_0x6683('0x2f'),_0x286695,_0x258708['id'],_0x258708[_0x6683('0x1c')]),'condition':require(_0x6683('0x30'))['condition'](_0x286695,getIntervals(_0x4ccb6['intervals'],_0x258708),_0x4ccb6),'consequence':require(_0x6683('0x31')+_0x258708[_0x6683('0x1c')])[_0x6683('0x32')](_0x286695,_0x248177,_0x4ccb6,_0x44e850),'p':_0x258708[_0x6683('0x33')]||0x0};logger[_0x6683('0x34')](_0x6683('0x35'),_0x14ae9c['id'],_0x6683('0x36'),getIntervals(_0x4ccb6[_0x6683('0x37')],_0x258708)['join'](_0x6683('0x38')));_0x1a689d['push'](_0x14ae9c);}else{logger[_0x6683('0x39')](_0x6683('0x3a'),path['join'](__dirname,'applications',_0x258708[_0x6683('0x1c')]+_0x6683('0x1d')));}}_0x4ccb6[_0x6683('0x13')][_0x286695]=new RuleEngine(_0x1a689d);_0x4ccb6[_0x6683('0x13')][_0x286695][_0x6683('0x3b')](_0x44e850,function(_0x1ce2a9){logger[_0x6683('0x34')]('Applications\x20executed',JSON[_0x6683('0x3c')](_0x1ce2a9[_0x6683('0x3d')]));if(_0x4ccb6[_0x6683('0x13')][_0x286695]){_0x4ccb6[_0x6683('0x13')][_0x286695][_0x6683('0x3e')](_0x6683('0x3f'));}});return _0x11fdef({'code':0xc8,'message':_0x44e850});}else{logger[_0x6683('0x34')](_0x6683('0x40'));return _0x11fdef({'code':0xc8,'message':_0x44e850});}}catch(_0x2225c6){logger[_0x6683('0x39')](_0x2225c6[_0x6683('0x41')]);return _0xee9bd4(_0x3df040[_0x6683('0x39')](0x1f4,_0x2225c6));}}return _0xee9bd4(_0x6683('0x42'));});},'AcceptMessage':function(_0x352c0b){var _0x27d98d=this;return new Promise(function(_0x3e942b,_0x36a8ee){if(_0x352c0b['agent']&&_0x352c0b['agent']['id']){if(_0x4ccb6['agents'][_0x352c0b[_0x6683('0x43')]['id']]){_0x4ccb6[_0x6683('0x44')][_0x352c0b[_0x6683('0x43')]['id']]['busy']=![];_0x4ccb6[_0x6683('0x44')][_0x352c0b[_0x6683('0x43')]['id']][_0x6683('0x45')]=undefined;}}if(_0x352c0b['message']&&_0x352c0b[_0x6683('0x15')]['id']){try{var _0x45253c=getId(_0x352c0b['channel'],_0x352c0b['message']?_0x352c0b['message']['id']:0x0,_0x352c0b['interaction']?_0x352c0b[_0x6683('0x16')]['id']:0x0);if(_0x4ccb6[_0x6683('0x13')][_0x45253c]){_0x4ccb6[_0x6683('0x13')][_0x45253c][_0x6683('0x3e')](_0x6683('0x46'));if(rpc[_0x352c0b[_0x6683('0x14')]+_0x6683('0x47')]){rpc[_0x352c0b['channel']+_0x6683('0x47')][_0x6683('0x48')](_0x45253c,{'UserId':_0x352c0b[_0x6683('0x15')][_0x6683('0x49')]})[_0x6683('0x4a')](function(_0x55bcf2){logger[_0x6683('0x39')](_0x6683('0x4b'));});}}return _0x3e942b({'code':0xc8,'message':_0x352c0b});}catch(_0x380dbb){logger[_0x6683('0x39')](_0x380dbb[_0x6683('0x41')]);return _0x36a8ee(_0x27d98d[_0x6683('0x39')](0x1f4,_0x380dbb));}}logger[_0x6683('0x39')](_0x6683('0x4c'));return _0x36a8ee(_0x27d98d[_0x6683('0x39')](0x1f4,_0x6683('0x4c')));});},'RejectMessage':function(_0x101626){var _0x197f99=this;return new Promise(function(_0x2b34fc,_0x41d082){if(_0x101626[_0x6683('0x43')]&&_0x101626[_0x6683('0x43')]['id']){try{if(_0x4ccb6['agents'][_0x101626[_0x6683('0x43')]['id']]){_0x4ccb6['agents'][_0x101626[_0x6683('0x43')]['id']]['busy']=![];_0x4ccb6[_0x6683('0x44')][_0x101626[_0x6683('0x43')]['id']]['busyQueue']=undefined;}return _0x2b34fc({'code':0xc8,'message':_0x101626});}catch(_0x2d8aef){logger[_0x6683('0x39')](_0x2d8aef[_0x6683('0x41')]);return _0x41d082(_0x197f99[_0x6683('0x39')](0x1f4,_0x2d8aef));}}logger[_0x6683('0x39')](_0x6683('0x4c'));return _0x41d082(_0x197f99[_0x6683('0x39')](0x1f4,_0x6683('0x4c')));});},'AbandonInteraction':function(_0x3cf45e){var _0x523877=this;return new Promise(function(_0x31ef45,_0x298049){if(_0x3cf45e[_0x6683('0x14')]&&_0x3cf45e[_0x6683('0x16')]&&_0x3cf45e[_0x6683('0x16')]['id']){try{var _0x2d2f28=getId(_0x3cf45e[_0x6683('0x14')],_0x3cf45e[_0x6683('0x15')]?_0x3cf45e[_0x6683('0x15')]['id']:0x0,_0x3cf45e[_0x6683('0x16')]?_0x3cf45e[_0x6683('0x16')]['id']:0x0);if(_0x4ccb6['rules'][_0x2d2f28]){_0x4ccb6[_0x6683('0x13')][_0x2d2f28][_0x6683('0x3e')]('end');}return _0x31ef45({'code':0xc8,'message':_0x3cf45e});}catch(_0x2d57e1){logger[_0x6683('0x39')](_0x2d57e1[_0x6683('0x41')]);return _0x298049(_0x523877[_0x6683('0x39')](0x1f4,_0x2d57e1));}}logger[_0x6683('0x39')](_0x6683('0x4c'));return _0x298049(_0x523877[_0x6683('0x39')](0x1f4,_0x6683('0x4c')));});},'AgentCapacity':function(_0x25f05e){var _0x32d56a=this;return new Promise(function(_0x1132ad,_0x3b4ca2){if(_0x4ccb6[_0x6683('0x44')][_0x6683('0x4d')](_0x25f05e['id'])){for(var _0x4b9f81 in _0x25f05e[_0x6683('0x4e')]){if(_0x25f05e[_0x6683('0x4e')][_0x6683('0x4d')](_0x4b9f81)){if(_0x4ccb6[_0x6683('0x44')][_0x25f05e['id']][_0x6683('0x4d')](_0x4b9f81+'CurrentCapacity')){_0x4ccb6[_0x6683('0x44')][_0x25f05e['id']][_0x4b9f81+_0x6683('0x4f')]=parseInt(_0x25f05e[_0x6683('0x4e')][_0x4b9f81],0xa);}}}_0x4ccb6[_0x6683('0x44')][_0x25f05e['id']]['updateRealtime']();return _0x1132ad({'code':0xc8,'message':_0x4ccb6['agents'][_0x25f05e['id']]});}else{return _0x3b4ca2(_0x32d56a[_0x6683('0x39')](0x1f4,_0x6683('0x50')));}});},'Agents':function(_0x41ce7f){return new Promise(function(_0x40a92b,_0x38d828){var _0x379d34=_[_0x6683('0x51')](_0x4ccb6[_0x6683('0x44')]);_0x40a92b({'count':_0x379d34[_0x6683('0x19')],'rows':_0x379d34});});},'ChatQueues':function(_0x1250d9){return new Promise(function(_0x2454dc,_0x120665){var _0x310354=[];for(var _0x3a2428 in _0x4ccb6[_0x6683('0x52')]){if(_0x4ccb6[_0x6683('0x52')][_0x6683('0x4d')](_0x3a2428)){var _0x340f72=_0x4ccb6[_0x6683('0x52')][_0x3a2428];var _0x17b45a={'id':_0x340f72['id'],'available':_0x340f72['available'],'loggedIn':_0x340f72['loggedIn'],'name':_0x340f72['name'],'paused':_0x340f72[_0x6683('0x53')],'waiting':_0x340f72[_0x6683('0x54')]};_0x310354[_0x6683('0x21')](_0x17b45a);}}_0x2454dc({'count':_0x310354['length'],'rows':_0x310354});});},'MailQueues':function(_0x433da4){return new Promise(function(_0x3251f1,_0x490939){var _0xba00a4=[];for(var _0x3f0b90 in _0x4ccb6['mailQueues']){if(_0x4ccb6['mailQueues'][_0x6683('0x4d')](_0x3f0b90)){var _0x3db114=_0x4ccb6['mailQueues'][_0x3f0b90];var _0x146cb5={'id':_0x3db114['id'],'available':_0x3db114['available'],'loggedIn':_0x3db114[_0x6683('0x55')],'name':_0x3db114['name'],'paused':_0x3db114[_0x6683('0x53')],'waiting':_0x3db114['waiting']};_0xba00a4[_0x6683('0x21')](_0x146cb5);}}_0x3251f1({'count':_0xba00a4['length'],'rows':_0xba00a4});});},'OpenchannelQueues':function(_0x449169){return new Promise(function(_0x455297,_0x275910){var _0x4ba4c6=[];for(var _0x4d1631 in _0x4ccb6[_0x6683('0x56')]){if(_0x4ccb6[_0x6683('0x56')][_0x6683('0x4d')](_0x4d1631)){var _0x27b711=_0x4ccb6[_0x6683('0x56')][_0x4d1631];var _0x15122c={'id':_0x27b711['id'],'available':_0x27b711[_0x6683('0x57')],'loggedIn':_0x27b711[_0x6683('0x55')],'name':_0x27b711['name'],'paused':_0x27b711[_0x6683('0x53')],'waiting':_0x27b711['waiting']};_0x4ba4c6[_0x6683('0x21')](_0x15122c);}}_0x455297({'count':_0x4ba4c6[_0x6683('0x19')],'rows':_0x4ba4c6});});},'SmsQueues':function(_0x534cd0){return new Promise(function(_0x42e858,_0x154103){var _0x1cc7cd=[];for(var _0x4230be in _0x4ccb6[_0x6683('0x58')]){if(_0x4ccb6[_0x6683('0x58')][_0x6683('0x4d')](_0x4230be)){var _0x35caef=_0x4ccb6['smsQueues'][_0x4230be];var _0x4f41ce={'id':_0x35caef['id'],'available':_0x35caef['available'],'loggedIn':_0x35caef[_0x6683('0x55')],'name':_0x35caef['name'],'paused':_0x35caef[_0x6683('0x53')],'waiting':_0x35caef[_0x6683('0x54')]};_0x1cc7cd[_0x6683('0x21')](_0x4f41ce);}}_0x42e858({'count':_0x1cc7cd['length'],'rows':_0x1cc7cd});});},'FaxQueues':function(_0x4012c5){return new Promise(function(_0x5bd921,_0x21b1d0){var _0x56a9ea=[];for(var _0x432015 in _0x4ccb6[_0x6683('0x59')]){if(_0x4ccb6[_0x6683('0x59')]['hasOwnProperty'](_0x432015)){var _0x31df33=_0x4ccb6[_0x6683('0x59')][_0x432015];var _0x55a951={'id':_0x31df33['id'],'available':_0x31df33['available'],'loggedIn':_0x31df33['loggedIn'],'name':_0x31df33[_0x6683('0x5a')],'paused':_0x31df33[_0x6683('0x53')],'waiting':_0x31df33[_0x6683('0x54')]};_0x56a9ea[_0x6683('0x21')](_0x55a951);}}_0x5bd921({'count':_0x56a9ea['length'],'rows':_0x56a9ea});});},'WhatsappQueues':function(_0x1653af){return new Promise(function(_0x163230,_0x378bc8){var _0x31a563=[];for(var _0x530c0a in _0x4ccb6[_0x6683('0x5b')]){if(_0x4ccb6['whatsappQueues'][_0x6683('0x4d')](_0x530c0a)){var _0x2b8724=_0x4ccb6[_0x6683('0x5b')][_0x530c0a];var _0x32390e={'id':_0x2b8724['id'],'available':_0x2b8724[_0x6683('0x57')],'loggedIn':_0x2b8724[_0x6683('0x55')],'name':_0x2b8724[_0x6683('0x5a')],'paused':_0x2b8724[_0x6683('0x53')],'waiting':_0x2b8724['waiting']};_0x31a563[_0x6683('0x21')](_0x32390e);}}_0x163230({'count':_0x31a563[_0x6683('0x19')],'rows':_0x31a563});});},'ChatQueuesWaitingInteractions':function(_0xe985c0){return new Promise(function(_0x31f638,_0xb48b66){var _0x343853=_['values'](_0x4ccb6['chatQueuesWaitingInteractions']);_0x31f638({'count':_0x343853[_0x6683('0x19')],'rows':_0x343853});});},'MailQueuesWaitingInteractions':function(_0x1d7438){return new Promise(function(_0x16027f,_0x2831fe){var _0x2b234c=_[_0x6683('0x51')](_0x4ccb6[_0x6683('0x5c')]);_0x16027f({'count':_0x2b234c['length'],'rows':_0x2b234c});});},'OpenchannelQueuesWaitingInteractions':function(_0x4d1207){return new Promise(function(_0x1a76e9,_0x1b4349){var _0x508801=_[_0x6683('0x51')](_0x4ccb6['openchannelQueuesWaitingInteractions']);_0x1a76e9({'count':_0x508801['length'],'rows':_0x508801});});},'SmsQueuesWaitingInteractions':function(_0x5a7a2d){return new Promise(function(_0x57694b,_0x43155b){var _0x51a122=_['values'](_0x4ccb6[_0x6683('0x5d')]);_0x57694b({'count':_0x51a122['length'],'rows':_0x51a122});});},'FaxQueuesWaitingInteractions':function(_0x394b33){return new Promise(function(_0x1961d5,_0x4ead0b){var _0x48af01=_['values'](_0x4ccb6[_0x6683('0x5e')]);_0x1961d5({'count':_0x48af01[_0x6683('0x19')],'rows':_0x48af01});});},'WhatsappQueuesWaitingInteractions':function(_0xa1955b){return new Promise(function(_0x2bc4c7,_0xf3d5e9){var _0x51fd31=_['values'](_0x4ccb6[_0x6683('0x5f')]);_0x2bc4c7({'count':_0x51fd31['length'],'rows':_0x51fd31});});}};var _0x5528fc=jayson['server'](_0x2a6c74)[_0x6683('0x60')]();_0x5528fc['on'](_0x6683('0x39'),function(_0x4187d5){logger[_0x6683('0x39')](JSON['stringify'](_0x4187d5));return _0x5ea3c3(_0x4187d5);});_0x5528fc[_0x6683('0x12')](0x232c,_0x6683('0x61'),function(){console[_0x6683('0x62')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x2f6419(_0x6683('0x63')+0x232c);});});}; \ No newline at end of file +var _0xe3db=['uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','applications','isArray','length','existsSync','join','app','.js','autoreply','split','mail','push','slice','dialogflowv2','appdata','amazonlex','TagId','getMustacheRender','account','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','channel','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','bluebird'];(function(_0x50f112,_0xd38e53){var _0x4ecf28=function(_0x62b75){while(--_0x62b75){_0x50f112['push'](_0x50f112['shift']());}};_0x4ecf28(++_0xd38e53);}(_0xe3db,0xc8));var _0xbe3d=function(_0xf0d8f9,_0x1e11d1){_0xf0d8f9=_0xf0d8f9-0x0;var _0x8ee7d4=_0xe3db[_0xf0d8f9];return _0x8ee7d4;};'use strict';var _=require(_0xbe3d('0x0'));var util=require(_0xbe3d('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0xbe3d('0x2'));var BPromise=require(_0xbe3d('0x3'));var uuid=require(_0xbe3d('0x4'));var utils=require(_0xbe3d('0x5'));var config=require(_0xbe3d('0x6'));var logger=require(_0xbe3d('0x7'))(_0xbe3d('0x8'));var rpc={'openchannelQueueReport':require(_0xbe3d('0x9')),'mailQueueReport':require(_0xbe3d('0xa')),'chatQueueReport':require(_0xbe3d('0xb')),'smsQueueReport':require(_0xbe3d('0xc')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xbe3d('0xd'))};var RuleEngine=require(_0xbe3d('0xe'));function getId(_0x24136a,_0x37e7c0,_0x55df34){return util[_0xbe3d('0xf')](_0xbe3d('0x10'),_0x24136a,_0x37e7c0||0x0,_0x55df34||0x0);}function getIntervals(_0x514464,_0x5eddd8){var _0x3b313c=[];if(!_[_0xbe3d('0x11')](_0x5eddd8[_0xbe3d('0x12')])&&!_[_0xbe3d('0x11')](_0x514464[_0x5eddd8[_0xbe3d('0x12')]])&&!_[_0xbe3d('0x11')](_0x514464[_0x5eddd8[_0xbe3d('0x12')]][_0xbe3d('0x13')])){_0x3b313c=_[_0xbe3d('0x14')](_0x514464[_0x5eddd8[_0xbe3d('0x12')]][_0xbe3d('0x13')],_0xbe3d('0x15'));}else if(!_['isNil'](_0x5eddd8[_0xbe3d('0x15')])){_0x3b313c=[_0x5eddd8[_0xbe3d('0x15')]];}return _0x3b313c;}exports[_0xbe3d('0x16')]=function(_0x1a142b){_0x1a142b[_0xbe3d('0x17')]={};return new BPromise(function(_0x2852e7,_0x20b01f){var _0x98ce08={'Start':function(_0x2bb8c2){var _0x1e8ecc=this;return new Promise(function(_0x2a45ef,_0x196b9a){if(_0x2bb8c2){try{var _0x113b23=[];var _0x3f8630=getId(_0x2bb8c2['channel'],_0x2bb8c2[_0xbe3d('0x18')]?_0x2bb8c2[_0xbe3d('0x18')]['id']:0x0,_0x2bb8c2[_0xbe3d('0x19')]?_0x2bb8c2[_0xbe3d('0x19')]['id']:0x0);if(_0x2bb8c2[_0xbe3d('0x1a')]&&_[_0xbe3d('0x1b')](_0x2bb8c2[_0xbe3d('0x1a')])&&_0x2bb8c2[_0xbe3d('0x1a')][_0xbe3d('0x1c')]){for(var _0x5f0b4b=0x0;_0x5f0b4b<_0x2bb8c2[_0xbe3d('0x1a')][_0xbe3d('0x1c')];_0x5f0b4b+=0x1){var _0x466c2a=_0x2bb8c2[_0xbe3d('0x1a')][_0x5f0b4b];if(fs[_0xbe3d('0x1d')](path[_0xbe3d('0x1e')](__dirname,_0xbe3d('0x1a'),_0x466c2a[_0xbe3d('0x1f')]+_0xbe3d('0x20')))){var _0x37b211=[];switch(_0x466c2a[_0xbe3d('0x1f')]['toLowerCase']()){case _0xbe3d('0x21'):var _0x36909d=_0x466c2a['appdata'][_0xbe3d('0x22')](',');if(_0x2bb8c2['channel']===_0xbe3d('0x23')){_0x37b211[_0xbe3d('0x24')](_0x36909d[0x0]);_0x37b211['push'](_0x36909d[0x1]);_0x37b211[_0xbe3d('0x24')](_0x36909d[_0xbe3d('0x25')](0x2,_0x36909d[_0xbe3d('0x1c')])[_0xbe3d('0x1e')](','));}else{_0x37b211[_0xbe3d('0x24')](_0x36909d[0x0]);_0x37b211[_0xbe3d('0x24')](_0x36909d[_0xbe3d('0x25')](0x1,_0x36909d[_0xbe3d('0x1c')])[_0xbe3d('0x1e')](','));}break;case'dialogflow':var _0x14a7f1=_0x466c2a['appdata'][_0xbe3d('0x22')](',');_0x37b211['push'](_0x14a7f1[0x0]);_0x37b211[_0xbe3d('0x24')](_0x14a7f1[0x1]);_0x37b211['push'](_0x14a7f1[_0xbe3d('0x25')](0x2,_0x14a7f1[_0xbe3d('0x1c')])[_0xbe3d('0x1e')](','));break;case _0xbe3d('0x26'):var _0x1f839f=_0x466c2a[_0xbe3d('0x27')][_0xbe3d('0x22')](',');_0x37b211['push'](_0x1f839f[0x0]);_0x37b211[_0xbe3d('0x24')](_0x1f839f[0x1]);_0x37b211[_0xbe3d('0x24')](_0x1f839f[0x2]);_0x37b211['push'](_0x1f839f[0x3]);_0x37b211['push'](_0x1f839f[_0xbe3d('0x25')](0x4,_0x1f839f[_0xbe3d('0x1c')])[_0xbe3d('0x1e')](','));break;case _0xbe3d('0x28'):var _0x2e8e2e=_0x466c2a[_0xbe3d('0x27')][_0xbe3d('0x22')](',');_0x37b211[_0xbe3d('0x24')](_0x2e8e2e[0x0]);_0x37b211['push'](_0x2e8e2e[0x1]);_0x37b211[_0xbe3d('0x24')](_0x2e8e2e[0x2]);_0x37b211[_0xbe3d('0x24')](_0x2e8e2e[0x3]);_0x37b211[_0xbe3d('0x24')](_0x2e8e2e[_0xbe3d('0x25')](0x4,_0x2e8e2e[_0xbe3d('0x1c')])['join'](','));break;case'message':_0x37b211[_0xbe3d('0x24')](_0x466c2a['appdata']);break;case'tag':_0x37b211['push'](_0x466c2a[_0xbe3d('0x29')]);_0x37b211[_0xbe3d('0x24')](_0x466c2a[_0xbe3d('0x27')]);break;case'tvox':var _0x3a23a1=utils[_0xbe3d('0x2a')](_0x2bb8c2[_0xbe3d('0x2b')]['notificationTemplate'],_0x2bb8c2);var _0x466020=_0x466c2a[_0xbe3d('0x27')][_0xbe3d('0x22')](',');_0x37b211[_0xbe3d('0x24')](_0x466020[0x0]);_0x37b211[_0xbe3d('0x24')](_0x466020[0x1]);_0x37b211[_0xbe3d('0x24')](_0x466020[0x2]);_0x37b211[_0xbe3d('0x24')](_0x466020[0x3]);_0x37b211[_0xbe3d('0x24')](_0x466020[0x4]);_0x37b211[_0xbe3d('0x24')](_0x466020[0x5]);_0x37b211[_0xbe3d('0x24')](_0x466020[0x6]);_0x37b211[_0xbe3d('0x24')](_0x466020[0x7]);_0x37b211[_0xbe3d('0x24')](_0x466020[0x8]);_0x37b211['push'](_0x466020[0x9]);_0x37b211[_0xbe3d('0x24')](_0x466020[0xa]);_0x37b211[_0xbe3d('0x24')](_0x2bb8c2[_0xbe3d('0x19')]['id']);_0x37b211[_0xbe3d('0x24')](_0x2bb8c2[_0xbe3d('0x18')]['id']);_0x37b211[_0xbe3d('0x24')](_0x466c2a[_0xbe3d('0x2c')]);_0x37b211[_0xbe3d('0x24')](_0x2bb8c2[_0xbe3d('0x19')][_0xbe3d('0x2d')]);_0x37b211[_0xbe3d('0x24')](_0x2bb8c2[_0xbe3d('0x2e')][_0xbe3d('0x2e')]);_0x37b211['push'](_0x3a23a1);break;default:_0x37b211=_[_0xbe3d('0x11')](_0x466c2a[_0xbe3d('0x27')])?[]:_0x466c2a[_0xbe3d('0x27')]['split'](',');}var _0x913c9d={'id':util[_0xbe3d('0xf')](_0xbe3d('0x2f'),_0x3f8630,_0x466c2a['id'],_0x466c2a[_0xbe3d('0x1f')]),'condition':require(_0xbe3d('0x30'))[_0xbe3d('0x31')](_0x3f8630,getIntervals(_0x1a142b[_0xbe3d('0x32')],_0x466c2a),_0x1a142b),'consequence':require(_0xbe3d('0x33')+_0x466c2a[_0xbe3d('0x1f')])['consequence'](_0x3f8630,_0x37b211,_0x1a142b,_0x2bb8c2),'p':_0x466c2a[_0xbe3d('0x34')]||0x0};logger[_0xbe3d('0x35')](_0xbe3d('0x36'),_0x913c9d['id'],_0xbe3d('0x37'),getIntervals(_0x1a142b[_0xbe3d('0x32')],_0x466c2a)['join'](_0xbe3d('0x38')));_0x113b23['push'](_0x913c9d);}else{logger[_0xbe3d('0x39')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0xbe3d('0x1a'),_0x466c2a[_0xbe3d('0x1f')]+_0xbe3d('0x20')));}}_0x1a142b[_0xbe3d('0x17')][_0x3f8630]=new RuleEngine(_0x113b23);_0x1a142b[_0xbe3d('0x17')][_0x3f8630][_0xbe3d('0x3a')](_0x2bb8c2,function(_0x15b187){logger['info'](_0xbe3d('0x3b'),JSON[_0xbe3d('0x3c')](_0x15b187[_0xbe3d('0x3d')]));if(_0x1a142b[_0xbe3d('0x17')][_0x3f8630]){_0x1a142b['rules'][_0x3f8630][_0xbe3d('0x3e')](_0xbe3d('0x3f'));}});return _0x2a45ef({'code':0xc8,'message':_0x2bb8c2});}else{logger[_0xbe3d('0x35')](_0xbe3d('0x40'));return _0x2a45ef({'code':0xc8,'message':_0x2bb8c2});}}catch(_0x3810c8){logger[_0xbe3d('0x39')](_0x3810c8[_0xbe3d('0x41')]);return _0x196b9a(_0x1e8ecc[_0xbe3d('0x39')](0x1f4,_0x3810c8));}}return _0x196b9a(_0xbe3d('0x42'));});},'AcceptMessage':function(_0x1d3c01){var _0x21f9ff=this;return new Promise(function(_0xc120a3,_0x4ad4ca){if(_0x1d3c01[_0xbe3d('0x43')]&&_0x1d3c01[_0xbe3d('0x43')]['id']){if(_0x1a142b[_0xbe3d('0x44')][_0x1d3c01['agent']['id']]){_0x1a142b[_0xbe3d('0x44')][_0x1d3c01[_0xbe3d('0x43')]['id']][_0xbe3d('0x45')]=![];_0x1a142b['agents'][_0x1d3c01[_0xbe3d('0x43')]['id']][_0xbe3d('0x46')]=undefined;}}if(_0x1d3c01[_0xbe3d('0x18')]&&_0x1d3c01['message']['id']){try{var _0x2dffaa=getId(_0x1d3c01['channel'],_0x1d3c01['message']?_0x1d3c01[_0xbe3d('0x18')]['id']:0x0,_0x1d3c01[_0xbe3d('0x19')]?_0x1d3c01[_0xbe3d('0x19')]['id']:0x0);if(_0x1a142b[_0xbe3d('0x17')][_0x2dffaa]){_0x1a142b[_0xbe3d('0x17')][_0x2dffaa]['emit'](_0xbe3d('0x47'));if(rpc[_0x1d3c01[_0xbe3d('0x48')]+'QueueReport']){rpc[_0x1d3c01[_0xbe3d('0x48')]+'QueueReport'][_0xbe3d('0x49')](_0x2dffaa,{'UserId':_0x1d3c01[_0xbe3d('0x18')]['UserId']})[_0xbe3d('0x4a')](function(_0x3aa7e2){logger[_0xbe3d('0x39')](_0xbe3d('0x4b'));});}}return _0xc120a3({'code':0xc8,'message':_0x1d3c01});}catch(_0x430803){logger[_0xbe3d('0x39')](_0x430803[_0xbe3d('0x41')]);return _0x4ad4ca(_0x21f9ff['error'](0x1f4,_0x430803));}}logger[_0xbe3d('0x39')](_0xbe3d('0x4c'));return _0x4ad4ca(_0x21f9ff[_0xbe3d('0x39')](0x1f4,_0xbe3d('0x4c')));});},'RejectMessage':function(_0x5e0787){var _0x1f7410=this;return new Promise(function(_0x36f4b3,_0x32ac09){if(_0x5e0787[_0xbe3d('0x43')]&&_0x5e0787['agent']['id']){try{if(_0x1a142b[_0xbe3d('0x44')][_0x5e0787[_0xbe3d('0x43')]['id']]){_0x1a142b['agents'][_0x5e0787[_0xbe3d('0x43')]['id']][_0xbe3d('0x45')]=![];_0x1a142b[_0xbe3d('0x44')][_0x5e0787[_0xbe3d('0x43')]['id']][_0xbe3d('0x46')]=undefined;}return _0x36f4b3({'code':0xc8,'message':_0x5e0787});}catch(_0x5e72ee){logger[_0xbe3d('0x39')](_0x5e72ee['stack']);return _0x32ac09(_0x1f7410['error'](0x1f4,_0x5e72ee));}}logger[_0xbe3d('0x39')](_0xbe3d('0x4c'));return _0x32ac09(_0x1f7410[_0xbe3d('0x39')](0x1f4,_0xbe3d('0x4c')));});},'AbandonInteraction':function(_0x566c61){var _0x4a9ad9=this;return new Promise(function(_0x3f4f7a,_0x5639a8){if(_0x566c61[_0xbe3d('0x48')]&&_0x566c61[_0xbe3d('0x19')]&&_0x566c61[_0xbe3d('0x19')]['id']){try{var _0x234548=getId(_0x566c61[_0xbe3d('0x48')],_0x566c61[_0xbe3d('0x18')]?_0x566c61['message']['id']:0x0,_0x566c61['interaction']?_0x566c61[_0xbe3d('0x19')]['id']:0x0);if(_0x1a142b[_0xbe3d('0x17')][_0x234548]){_0x1a142b[_0xbe3d('0x17')][_0x234548][_0xbe3d('0x3e')]('end');}return _0x3f4f7a({'code':0xc8,'message':_0x566c61});}catch(_0x3a8f18){logger[_0xbe3d('0x39')](_0x3a8f18['stack']);return _0x5639a8(_0x4a9ad9[_0xbe3d('0x39')](0x1f4,_0x3a8f18));}}logger[_0xbe3d('0x39')]('message\x20is\x20empty');return _0x5639a8(_0x4a9ad9[_0xbe3d('0x39')](0x1f4,_0xbe3d('0x4c')));});},'AgentCapacity':function(_0x5dde9e){var _0xffa8bd=this;return new Promise(function(_0x5c58da,_0x1b2162){if(_0x1a142b['agents'][_0xbe3d('0x4d')](_0x5dde9e['id'])){for(var _0x334175 in _0x5dde9e[_0xbe3d('0x4e')]){if(_0x5dde9e['capacity']['hasOwnProperty'](_0x334175)){if(_0x1a142b[_0xbe3d('0x44')][_0x5dde9e['id']][_0xbe3d('0x4d')](_0x334175+_0xbe3d('0x4f'))){_0x1a142b[_0xbe3d('0x44')][_0x5dde9e['id']][_0x334175+'CurrentCapacity']=parseInt(_0x5dde9e[_0xbe3d('0x4e')][_0x334175],0xa);}}}_0x1a142b[_0xbe3d('0x44')][_0x5dde9e['id']]['updateRealtime']();return _0x5c58da({'code':0xc8,'message':_0x1a142b[_0xbe3d('0x44')][_0x5dde9e['id']]});}else{return _0x1b2162(_0xffa8bd[_0xbe3d('0x39')](0x1f4,_0xbe3d('0x50')));}});},'Agents':function(_0x5110d4){return new Promise(function(_0x151138,_0x4dce3d){var _0x1dae76=_[_0xbe3d('0x51')](_0x1a142b[_0xbe3d('0x44')]);_0x151138({'count':_0x1dae76[_0xbe3d('0x1c')],'rows':_0x1dae76});});},'ChatQueues':function(_0xd5974f){return new Promise(function(_0x42ed62,_0x484e5d){var _0x2e3d95=[];for(var _0x4d045f in _0x1a142b[_0xbe3d('0x52')]){if(_0x1a142b[_0xbe3d('0x52')]['hasOwnProperty'](_0x4d045f)){var _0x59ed09=_0x1a142b['chatQueues'][_0x4d045f];var _0x269bd6={'id':_0x59ed09['id'],'available':_0x59ed09['available'],'loggedIn':_0x59ed09[_0xbe3d('0x53')],'name':_0x59ed09[_0xbe3d('0x54')],'paused':_0x59ed09[_0xbe3d('0x55')],'waiting':_0x59ed09[_0xbe3d('0x56')]};_0x2e3d95[_0xbe3d('0x24')](_0x269bd6);}}_0x42ed62({'count':_0x2e3d95[_0xbe3d('0x1c')],'rows':_0x2e3d95});});},'MailQueues':function(_0x213702){return new Promise(function(_0x36fec3,_0x430430){var _0x5235cf=[];for(var _0x2e02fc in _0x1a142b['mailQueues']){if(_0x1a142b[_0xbe3d('0x57')][_0xbe3d('0x4d')](_0x2e02fc)){var _0x1f6cca=_0x1a142b[_0xbe3d('0x57')][_0x2e02fc];var _0x315820={'id':_0x1f6cca['id'],'available':_0x1f6cca[_0xbe3d('0x58')],'loggedIn':_0x1f6cca[_0xbe3d('0x53')],'name':_0x1f6cca[_0xbe3d('0x54')],'paused':_0x1f6cca[_0xbe3d('0x55')],'waiting':_0x1f6cca['waiting']};_0x5235cf[_0xbe3d('0x24')](_0x315820);}}_0x36fec3({'count':_0x5235cf[_0xbe3d('0x1c')],'rows':_0x5235cf});});},'OpenchannelQueues':function(_0x13de5a){return new Promise(function(_0x2a533c,_0x38951a){var _0x252c90=[];for(var _0x4dbe69 in _0x1a142b[_0xbe3d('0x59')]){if(_0x1a142b[_0xbe3d('0x59')][_0xbe3d('0x4d')](_0x4dbe69)){var _0x32111e=_0x1a142b['openchannelQueues'][_0x4dbe69];var _0x52926f={'id':_0x32111e['id'],'available':_0x32111e[_0xbe3d('0x58')],'loggedIn':_0x32111e[_0xbe3d('0x53')],'name':_0x32111e['name'],'paused':_0x32111e[_0xbe3d('0x55')],'waiting':_0x32111e[_0xbe3d('0x56')]};_0x252c90[_0xbe3d('0x24')](_0x52926f);}}_0x2a533c({'count':_0x252c90[_0xbe3d('0x1c')],'rows':_0x252c90});});},'SmsQueues':function(_0x736cd6){return new Promise(function(_0x3109a8,_0x1acc28){var _0xf227e=[];for(var _0x53da5a in _0x1a142b[_0xbe3d('0x5a')]){if(_0x1a142b[_0xbe3d('0x5a')]['hasOwnProperty'](_0x53da5a)){var _0x49ae2a=_0x1a142b[_0xbe3d('0x5a')][_0x53da5a];var _0x28645f={'id':_0x49ae2a['id'],'available':_0x49ae2a[_0xbe3d('0x58')],'loggedIn':_0x49ae2a[_0xbe3d('0x53')],'name':_0x49ae2a[_0xbe3d('0x54')],'paused':_0x49ae2a[_0xbe3d('0x55')],'waiting':_0x49ae2a[_0xbe3d('0x56')]};_0xf227e[_0xbe3d('0x24')](_0x28645f);}}_0x3109a8({'count':_0xf227e[_0xbe3d('0x1c')],'rows':_0xf227e});});},'FaxQueues':function(_0x27a919){return new Promise(function(_0x57dd4c,_0x29d5d4){var _0x3195d0=[];for(var _0x322ca0 in _0x1a142b['faxQueues']){if(_0x1a142b[_0xbe3d('0x5b')]['hasOwnProperty'](_0x322ca0)){var _0x5d2eba=_0x1a142b['faxQueues'][_0x322ca0];var _0x3c395={'id':_0x5d2eba['id'],'available':_0x5d2eba[_0xbe3d('0x58')],'loggedIn':_0x5d2eba[_0xbe3d('0x53')],'name':_0x5d2eba[_0xbe3d('0x54')],'paused':_0x5d2eba[_0xbe3d('0x55')],'waiting':_0x5d2eba[_0xbe3d('0x56')]};_0x3195d0[_0xbe3d('0x24')](_0x3c395);}}_0x57dd4c({'count':_0x3195d0[_0xbe3d('0x1c')],'rows':_0x3195d0});});},'WhatsappQueues':function(_0x5d85c3){return new Promise(function(_0x541fd2,_0x435b74){var _0x46d997=[];for(var _0x5198ae in _0x1a142b[_0xbe3d('0x5c')]){if(_0x1a142b['whatsappQueues'][_0xbe3d('0x4d')](_0x5198ae)){var _0x3418db=_0x1a142b[_0xbe3d('0x5c')][_0x5198ae];var _0x3051c0={'id':_0x3418db['id'],'available':_0x3418db[_0xbe3d('0x58')],'loggedIn':_0x3418db[_0xbe3d('0x53')],'name':_0x3418db[_0xbe3d('0x54')],'paused':_0x3418db[_0xbe3d('0x55')],'waiting':_0x3418db['waiting']};_0x46d997[_0xbe3d('0x24')](_0x3051c0);}}_0x541fd2({'count':_0x46d997[_0xbe3d('0x1c')],'rows':_0x46d997});});},'ChatQueuesWaitingInteractions':function(_0x3d1e61){return new Promise(function(_0x3f5d83,_0x7f1a50){var _0x6b1123=_[_0xbe3d('0x51')](_0x1a142b[_0xbe3d('0x5d')]);_0x3f5d83({'count':_0x6b1123['length'],'rows':_0x6b1123});});},'MailQueuesWaitingInteractions':function(_0x380b00){return new Promise(function(_0x2ff7e9,_0x2a26a5){var _0x1c65ae=_[_0xbe3d('0x51')](_0x1a142b[_0xbe3d('0x5e')]);_0x2ff7e9({'count':_0x1c65ae['length'],'rows':_0x1c65ae});});},'OpenchannelQueuesWaitingInteractions':function(_0x41c707){return new Promise(function(_0x8aec3f,_0x320323){var _0x14fd9b=_[_0xbe3d('0x51')](_0x1a142b[_0xbe3d('0x5f')]);_0x8aec3f({'count':_0x14fd9b['length'],'rows':_0x14fd9b});});},'SmsQueuesWaitingInteractions':function(_0x561af1){return new Promise(function(_0x4f36ee,_0x20ed8a){var _0x11576c=_[_0xbe3d('0x51')](_0x1a142b['smsQueuesWaitingInteractions']);_0x4f36ee({'count':_0x11576c[_0xbe3d('0x1c')],'rows':_0x11576c});});},'FaxQueuesWaitingInteractions':function(_0x67adf){return new Promise(function(_0x1f079d,_0x594737){var _0xe1cd=_[_0xbe3d('0x51')](_0x1a142b[_0xbe3d('0x60')]);_0x1f079d({'count':_0xe1cd['length'],'rows':_0xe1cd});});},'WhatsappQueuesWaitingInteractions':function(_0x512b00){return new Promise(function(_0x31d44c,_0x258d4a){var _0xcf0a5d=_[_0xbe3d('0x51')](_0x1a142b[_0xbe3d('0x61')]);_0x31d44c({'count':_0xcf0a5d[_0xbe3d('0x1c')],'rows':_0xcf0a5d});});}};var _0x4fc1f4=jayson['server'](_0x98ce08)[_0xbe3d('0x62')]();_0x4fc1f4['on'](_0xbe3d('0x39'),function(_0x318b15){logger[_0xbe3d('0x39')](JSON[_0xbe3d('0x3c')](_0x318b15));return _0x20b01f(_0x318b15);});_0x4fc1f4[_0xbe3d('0x16')](0x232c,_0xbe3d('0x63'),function(){console[_0xbe3d('0x64')](_0xbe3d('0x65'),0x232c);return _0x2852e7('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 59939fe..9aead87 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 _0x1e9f=['[%s][INTERVAL]\x20%s','all','some','info','join','\x20|\x20','when','log','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','result','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','indexOf','true','catch'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x1e9f,0x92));var _0xf1e9=function(_0x3a32f6,_0x484fe1){_0x3a32f6=_0x3a32f6-0x0;var _0xd6708c=_0x1e9f[_0x3a32f6];return _0xd6708c;};'use strict';var util=require(_0xf1e9('0x0'));var BPromise=require(_0xf1e9('0x1'));var jayson=require(_0xf1e9('0x2'));var _=require(_0xf1e9('0x3'));var logger=require(_0xf1e9('0x4'))(_0xf1e9('0x5'));var client=jayson[_0xf1e9('0x6')][_0xf1e9('0x7')]({'port':0x232a});function request(_0x33c9a7,_0x5425a0){return new BPromise(function(_0x1907b1,_0x758c59){return client[_0xf1e9('0x8')](_0x33c9a7,_0x5425a0)[_0xf1e9('0x9')](function(_0x9a2b7e){if(_0x9a2b7e[_0xf1e9('0xa')]){return _0x758c59(_0x9a2b7e[_0xf1e9('0xa')][_0xf1e9('0xb')]);}else{return _0x1907b1(_0x9a2b7e[_0xf1e9('0xc')]);}})['catch'](function(_0x1365fe){return _0x758c59(_0x1365fe);});});}exports[_0xf1e9('0xd')]=function(_0x153dd6,_0x1945b8,_0x4e50e9){return function(_0xdb86bd){if(_0x4e50e9[_0xf1e9('0xe')]&&!_0x4e50e9[_0xf1e9('0xe')][_0x153dd6]){logger['info'](_0xf1e9('0xf'),_0x153dd6);return _0xdb86bd['stop']();}var _0x2ce128=[];for(var _0x119c20=0x0;_0x119c20<_0x1945b8[_0xf1e9('0x10')];_0x119c20+=0x1){_0x2ce128[_0xf1e9('0x11')](request(_0xf1e9('0x12'),{'command':util[_0xf1e9('0x13')](_0xf1e9('0x14'),_0x1945b8[_0x119c20])})[_0xf1e9('0x9')](function(_0x193808){return _0x193808&&_0x193808[_0xf1e9('0xb')]&&_0x193808[_0xf1e9('0xb')][_0xf1e9('0x15')](_0xf1e9('0x16'))>=0x0?!![]:![];})[_0xf1e9('0x17')](function(_0x9f7e55){logger[_0xf1e9('0xa')](_0xf1e9('0x18'),_0x153dd6,_0x1945b8[_0x119c20]);}));}BPromise[_0xf1e9('0x19')](_0x2ce128)['then'](function(_0xf86e31){var _0x2b4367=_[_0xf1e9('0x1a')](_0xf86e31);logger[_0xf1e9('0x1b')]('[%s][INTERVAL]\x20%s\x20%s',_0x153dd6,_0x1945b8[_0xf1e9('0x1c')](_0xf1e9('0x1d')),_0x2b4367);_0xdb86bd[_0xf1e9('0x1e')](_0x2b4367);})[_0xf1e9('0x17')](function(_0xa16fbf){console[_0xf1e9('0x1f')](_0xa16fbf);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x153dd6,_0x1945b8[_0xf1e9('0x1c')](_0xf1e9('0x1d')),_0xa16fbf[_0xf1e9('0x20')]);_0xdb86bd[_0xf1e9('0x21')]();});};}; \ No newline at end of file +var _0xfb2c=['bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','indexOf','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','util'];(function(_0x1d0fa7,_0x1ad70f){var _0x5b2d91=function(_0x4ff922){while(--_0x4ff922){_0x1d0fa7['push'](_0x1d0fa7['shift']());}};_0x5b2d91(++_0x1ad70f);}(_0xfb2c,0x6f));var _0xcfb2=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xfb2c[_0x220dbb];return _0x2b77de;};'use strict';var util=require(_0xcfb2('0x0'));var BPromise=require(_0xcfb2('0x1'));var jayson=require(_0xcfb2('0x2'));var _=require(_0xcfb2('0x3'));var logger=require(_0xcfb2('0x4'))(_0xcfb2('0x5'));var client=jayson[_0xcfb2('0x6')][_0xcfb2('0x7')]({'port':0x232a});function request(_0x90c762,_0x4ded8b){return new BPromise(function(_0x4a0863,_0x331edb){return client[_0xcfb2('0x8')](_0x90c762,_0x4ded8b)[_0xcfb2('0x9')](function(_0x246a9a){if(_0x246a9a[_0xcfb2('0xa')]){return _0x331edb(_0x246a9a[_0xcfb2('0xa')][_0xcfb2('0xb')]);}else{return _0x4a0863(_0x246a9a['result']);}})[_0xcfb2('0xc')](function(_0x3b2839){return _0x331edb(_0x3b2839);});});}exports[_0xcfb2('0xd')]=function(_0x45e974,_0x33c4ff,_0x2b89a7){return function(_0x16ae95){if(_0x2b89a7[_0xcfb2('0xe')]&&!_0x2b89a7[_0xcfb2('0xe')][_0x45e974]){logger[_0xcfb2('0xf')](_0xcfb2('0x10'),_0x45e974);return _0x16ae95[_0xcfb2('0x11')]();}var _0x363209=[];for(var _0x425d49=0x0;_0x425d49<_0x33c4ff['length'];_0x425d49+=0x1){_0x363209[_0xcfb2('0x12')](request(_0xcfb2('0x13'),{'command':util['format']('iftime\x20%s',_0x33c4ff[_0x425d49])})['then'](function(_0x210edb){return _0x210edb&&_0x210edb[_0xcfb2('0xb')]&&_0x210edb[_0xcfb2('0xb')][_0xcfb2('0x14')]('true')>=0x0?!![]:![];})[_0xcfb2('0xc')](function(_0x43fd01){logger[_0xcfb2('0xa')](_0xcfb2('0x15'),_0x45e974,_0x33c4ff[_0x425d49]);}));}BPromise[_0xcfb2('0x16')](_0x363209)[_0xcfb2('0x9')](function(_0x4389a1){var _0x5111ee=_['some'](_0x4389a1);logger['info'](_0xcfb2('0x17'),_0x45e974,_0x33c4ff[_0xcfb2('0x18')](_0xcfb2('0x19')),_0x5111ee);_0x16ae95['when'](_0x5111ee);})[_0xcfb2('0xc')](function(_0x261e5f){console[_0xcfb2('0x1a')](_0x261e5f);logger[_0xcfb2('0xa')](_0xcfb2('0x17'),_0x45e974,_0x33c4ff[_0xcfb2('0x18')](_0xcfb2('0x19')),_0x261e5f[_0xcfb2('0x1b')]);_0x16ae95[_0xcfb2('0x11')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 144cbf8..207334e 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 _0x9c00=['acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','format','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid','secondtransfereruniqueid','origtransfereruniqueid','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','[%s][agents][hangup]','lodash','util','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0x9c00,0x1a0));var _0x09c0=function(_0xfec81c,_0x3f7f63){_0xfec81c=_0xfec81c-0x0;var _0x5d21f6=_0x9c00[_0xfec81c];return _0x5d21f6;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x5e32e7,_0xe0d293){utils[_0x09c0('0x2')](util['format'](_0x09c0('0x3'),_0x5e32e7[_0x09c0('0x4')],_0x5e32e7[_0x09c0('0x5')],_0x5e32e7[_0x09c0('0x6')],_0x5e32e7[_0x09c0('0x7')],_0x5e32e7['interface'],_0x5e32e7['calleridnum'],_0x5e32e7[_0x09c0('0x8')],_0x5e32e7[_0x09c0('0x9')]));if(_0x5e32e7[_0x09c0('0x6')]){utils[_0x09c0('0xa')](_0x5e32e7[_0x09c0('0x6')])['then'](function(_0x6558ca){if(_0x6558ca){_0x5e32e7[_0x09c0('0xb')]=_0x6558ca[_0x09c0('0xb')];_0x5e32e7[_0x09c0('0xc')]=_0x5e32e7[_0x09c0('0xd')]?_0x6558ca[_0x09c0('0xe')]:![];_0x5e32e7[_0x09c0('0xf')]=_0x5e32e7[_0x09c0('0xc')]?_0x6558ca[_0x09c0('0x10')]:0x0;}utils[_0x09c0('0x11')](_0x09c0('0x12'),_0x5e32e7);});}else{utils[_0x09c0('0x11')](_0x09c0('0x12'),_0x5e32e7);}if(_0xe0d293){delete transfers[_0x5e32e7[_0x09c0('0x4')]];}else{delete agents[_0x5e32e7[_0x09c0('0x13')]];}}exports[_0x09c0('0x14')]=function(_0x6149a8){try{utils[_0x09c0('0x15')](util[_0x09c0('0x16')](_0x09c0('0x17'),_0x6149a8[_0x09c0('0x4')]),_0x6149a8);agents[_0x6149a8[_0x09c0('0x13')]]=_0x6149a8;agents[_0x6149a8[_0x09c0('0x13')]][_0x09c0('0x18')]=utils[_0x09c0('0x19')]();agents[_0x6149a8[_0x09c0('0x13')]]['lastevent']='called';agents[_0x6149a8['destuniqueid']][_0x09c0('0x8')]=null;agents[_0x6149a8[_0x09c0('0x13')]][_0x09c0('0x1a')]=null;utils[_0x09c0('0x2')](util['format'](_0x09c0('0x1b'),_0x6149a8['uniqueid'],agents[_0x6149a8['destuniqueid']][_0x09c0('0x7')],_0x6149a8['destuniqueid']));}catch(_0x2cda5e){utils[_0x09c0('0x1c')](util[_0x09c0('0x16')]('[%s][agents][agentcalled]',_0x6149a8[_0x09c0('0x4')]),_0x2cda5e);}};exports[_0x09c0('0x1d')]=function(_0x8ad645){try{if(!_[_0x09c0('0x1e')](agents[_0x8ad645[_0x09c0('0x13')]])){utils[_0x09c0('0x15')](util[_0x09c0('0x16')]('[%s][agents][agentringnoanswer]',_0x8ad645[_0x09c0('0x4')]),_0x8ad645);utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x1f'),_0x8ad645['uniqueid'],agents[_0x8ad645['destuniqueid']][_0x09c0('0x7')],_0x8ad645[_0x09c0('0x13')]));agents[_0x8ad645[_0x09c0('0x13')]][_0x09c0('0x1d')]=!![];agents[_0x8ad645['destuniqueid']][_0x09c0('0x20')]=utils[_0x09c0('0x19')]();agents[_0x8ad645['destuniqueid']][_0x09c0('0x9')]=_0x09c0('0x21');agents[_0x8ad645[_0x09c0('0x13')]][_0x09c0('0x22')]=_0x09c0('0x21');agents[_0x8ad645[_0x09c0('0x13')]][_0x09c0('0x23')]=_0x8ad645[_0x09c0('0x24')]?parseInt(_0x8ad645[_0x09c0('0x24')])/0x3e8:0x0;agents[_0x8ad645[_0x09c0('0x13')]][_0x09c0('0x25')]=0x0;unanswered['push'](_0x8ad645[_0x09c0('0x13')]);}}catch(_0x1bdde9){utils['error'](util[_0x09c0('0x16')]('[%s][agents][agentringnoanswer]',_0x8ad645[_0x09c0('0x4')]),_0x1bdde9);}};exports['queuecallerabandon']=function(_0x3ac8e4){try{_[_0x09c0('0x26')](agents,function(_0x108409,_0x4159bc){if(_0x108409['uniqueid']==_0x3ac8e4['uniqueid']&&!_[_0x09c0('0x27')](unanswered,_0x108409[_0x09c0('0x13')])){utils[_0x09c0('0x15')](util['format'](_0x09c0('0x28'),_0x3ac8e4['uniqueid']),_0x3ac8e4);utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x29'),_0x3ac8e4['uniqueid'],_0x108409[_0x09c0('0x7')],_0x108409[_0x09c0('0x13')]));_0x108409[_0x09c0('0x1d')]=!![];_0x108409[_0x09c0('0x20')]=utils[_0x09c0('0x19')]();_0x108409[_0x09c0('0x9')]=_0x09c0('0x2a');_0x108409['reason']=_0x09c0('0x2a');_0x108409[_0x09c0('0x23')]=_0x3ac8e4[_0x09c0('0x23')];_0x108409[_0x09c0('0x25')]=0x0;writeDB(_0x108409);}});}catch(_0x2c1ad3){utils['error'](util[_0x09c0('0x16')](_0x09c0('0x28'),_0x3ac8e4[_0x09c0('0x4')]),_0x2c1ad3);}};exports[_0x09c0('0x2b')]=function(_0x353454){try{if(agents[_0x353454['destuniqueid']]){utils[_0x09c0('0x15')](util[_0x09c0('0x16')](_0x09c0('0x2c'),_0x353454[_0x09c0('0x4')]),_0x353454);utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x2d'),_0x353454['uniqueid'],agents[_0x353454[_0x09c0('0x13')]][_0x09c0('0x7')],_0x353454[_0x09c0('0x13')]));agents[_0x353454[_0x09c0('0x13')]][_0x09c0('0x2e')]=utils['now']();agents[_0x353454['destuniqueid']]['connectedlinenum']=_0x353454['connectedlinenum'];agents[_0x353454[_0x09c0('0x13')]][_0x09c0('0x1a')]=_0x353454[_0x09c0('0x1a')];agents[_0x353454[_0x09c0('0x13')]][_0x09c0('0x23')]=_0x353454['ringtime'];agents[_0x353454[_0x09c0('0x13')]][_0x09c0('0x9')]='connect';_[_0x09c0('0x26')](agents,function(_0x5d50b9,_0x3ee063){if(_0x5d50b9['destuniqueid']!=_0x353454[_0x09c0('0x13')]&&_0x5d50b9[_0x09c0('0x4')]==_0x353454['uniqueid']){_0x5d50b9[_0x09c0('0x25')]=0x0;_0x5d50b9[_0x09c0('0x23')]=_0x353454['ringtime'];_0x5d50b9[_0x09c0('0x1d')]=!![];_0x5d50b9[_0x09c0('0x20')]=utils[_0x09c0('0x19')]();_0x5d50b9[_0x09c0('0x9')]=_0x09c0('0x2f');_0x5d50b9[_0x09c0('0x22')]='answered_elsewhere';_0x5d50b9[_0x09c0('0x30')]=_0x353454[_0x09c0('0x13')];_0x5d50b9[_0x09c0('0x31')]=_0x353454['membername'];writeDB(_0x5d50b9);}});}}catch(_0x193ed2){utils[_0x09c0('0x1c')](util[_0x09c0('0x16')]('[%s][agents][agentconnect]',_0x353454[_0x09c0('0x4')]),_0x193ed2);}};exports[_0x09c0('0xd')]=function(_0x52cd5c){try{if(!_['isNil'](agents[_0x52cd5c[_0x09c0('0x13')]])){utils[_0x09c0('0x15')](util['format'](_0x09c0('0x32'),_0x52cd5c[_0x09c0('0x4')]),_0x52cd5c);utils['info'](util[_0x09c0('0x16')](_0x09c0('0x33'),_0x52cd5c[_0x09c0('0x4')],agents[_0x52cd5c[_0x09c0('0x13')]][_0x09c0('0x7')],_0x52cd5c['destuniqueid']));agents[_0x52cd5c[_0x09c0('0x13')]]['agentcomplete']=!![];agents[_0x52cd5c['destuniqueid']][_0x09c0('0x34')]=utils[_0x09c0('0x19')]();agents[_0x52cd5c[_0x09c0('0x13')]][_0x09c0('0x25')]=utils[_0x09c0('0x35')](agents[_0x52cd5c[_0x09c0('0x13')]]['agentcompleteAt'],agents[_0x52cd5c['destuniqueid']]['agentconnectAt']);agents[_0x52cd5c[_0x09c0('0x13')]][_0x09c0('0x22')]=_0x52cd5c[_0x09c0('0x22')];agents[_0x52cd5c['destuniqueid']][_0x09c0('0x9')]=_0x09c0('0x36');writeDB(agents[_0x52cd5c[_0x09c0('0x13')]]);}}catch(_0x198517){utils[_0x09c0('0x1c')](util[_0x09c0('0x16')](_0x09c0('0x32'),_0x52cd5c[_0x09c0('0x4')]),_0x198517);}};exports[_0x09c0('0x37')]=function(_0x38085c){try{if(!_[_0x09c0('0x1e')](agents[_0x38085c[_0x09c0('0x38')]])){utils[_0x09c0('0x15')](util[_0x09c0('0x16')](_0x09c0('0x39'),_0x38085c[_0x09c0('0x4')]),_0x38085c);utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x3a'),_0x38085c[_0x09c0('0x4')],agents[_0x38085c['transfereruniqueid']][_0x09c0('0x7')],agents[_0x38085c[_0x09c0('0x38')]][_0x09c0('0x4')]));agents[_0x38085c[_0x09c0('0x38')]][_0x09c0('0x3b')]=!![];agents[_0x38085c['transfereruniqueid']][_0x09c0('0x3c')]=_0x09c0('0x3d');agents[_0x38085c[_0x09c0('0x38')]]['transferexten']=_0x38085c[_0x09c0('0x3e')];agents[_0x38085c[_0x09c0('0x38')]][_0x09c0('0x3f')]=agents[_0x38085c[_0x09c0('0x38')]][_0x09c0('0x4')];}}catch(_0xebfd6d){utils[_0x09c0('0x1c')](util['format'](_0x09c0('0x39'),_0x38085c[_0x09c0('0x4')]),_0xebfd6d);}};exports[_0x09c0('0x40')]=function(_0x428f9a){try{utils[_0x09c0('0x15')](util[_0x09c0('0x16')](_0x09c0('0x41'),_0x428f9a['origtransfereruniqueid']),_0x428f9a);if(_0x428f9a['origtransfereruniqueid']==_0x428f9a[_0x09c0('0x42')]){if(!_[_0x09c0('0x1e')](agents[_0x428f9a[_0x09c0('0x43')]])){utils['info'](util[_0x09c0('0x16')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x428f9a[_0x09c0('0x44')],agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x7')]));agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x3b')]=!![];agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x3c')]='ATTENDED';agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x45')]=_0x428f9a[_0x09c0('0x46')];agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x3f')]=_0x428f9a[_0x09c0('0x44')];}if(_0x428f9a[_0x09c0('0x47')]&&agents[_0x428f9a[_0x09c0('0x47')]]){agents[_0x428f9a[_0x09c0('0x47')]][_0x09c0('0x48')]=0x1;transfers[_0x428f9a[_0x09c0('0x47')]]=_['clone'](agents[_0x428f9a[_0x09c0('0x47')]]);transfers[_0x428f9a[_0x09c0('0x47')]][_0x09c0('0x49')]=agents[_0x428f9a[_0x09c0('0x43')]]['calleridnum'];transfers[_0x428f9a[_0x09c0('0x47')]]['calleridname']=agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x4a')];transfers[_0x428f9a[_0x09c0('0x47')]]['agentcalledAt']=utils['now']();transfers[_0x428f9a[_0x09c0('0x47')]][_0x09c0('0x2e')]=utils[_0x09c0('0x19')]();transfers[_0x428f9a[_0x09c0('0x47')]]['holdtime']=0x0;transfers[_0x428f9a[_0x09c0('0x47')]][_0x09c0('0x48')]=0x2;}}else if(_0x428f9a['secondtransfereruniqueid']==_0x428f9a[_0x09c0('0x4b')]){if(!_[_0x09c0('0x1e')](agents[_0x428f9a[_0x09c0('0x44')]])){utils[_0x09c0('0x2')](util['format'](_0x09c0('0x4c'),_0x428f9a[_0x09c0('0x44')],agents[_0x428f9a[_0x09c0('0x44')]][_0x09c0('0x7')]));agents[_0x428f9a[_0x09c0('0x44')]][_0x09c0('0x3b')]=!![];agents[_0x428f9a[_0x09c0('0x44')]][_0x09c0('0x3c')]=_0x09c0('0x4d');agents[_0x428f9a[_0x09c0('0x44')]][_0x09c0('0x45')]=_0x428f9a[_0x09c0('0x4e')];agents[_0x428f9a[_0x09c0('0x44')]]['transferuniqueid']=_0x428f9a[_0x09c0('0x43')];}if(_0x428f9a[_0x09c0('0x4f')]&&agents[_0x428f9a[_0x09c0('0x4f')]]){agents[_0x428f9a[_0x09c0('0x4f')]][_0x09c0('0x48')]=0x1;transfers[_0x428f9a['transfertargetuniqueid']]=_[_0x09c0('0x50')](agents[_0x428f9a[_0x09c0('0x4f')]]);transfers[_0x428f9a[_0x09c0('0x4f')]][_0x09c0('0x49')]=agents[_0x428f9a['origtransfereruniqueid']][_0x09c0('0x49')];transfers[_0x428f9a[_0x09c0('0x4f')]]['calleridname']=agents[_0x428f9a[_0x09c0('0x44')]][_0x09c0('0x4a')];transfers[_0x428f9a[_0x09c0('0x4f')]][_0x09c0('0x18')]=utils[_0x09c0('0x19')]();transfers[_0x428f9a['transfertargetuniqueid']][_0x09c0('0x2e')]=utils[_0x09c0('0x19')]();transfers[_0x428f9a[_0x09c0('0x4f')]][_0x09c0('0x23')]=0x0;transfers[_0x428f9a[_0x09c0('0x4f')]]['agententerreason']=0x2;}}}catch(_0x422046){utils[_0x09c0('0x1c')](util[_0x09c0('0x16')](_0x09c0('0x41'),_0x428f9a[_0x09c0('0x44')]),_0x422046);}};exports[_0x09c0('0x51')]=function(_0x59c57a){try{utils['debug'](util['format']('[%s][agents][hangup]',_0x59c57a[_0x09c0('0x4')]),_0x59c57a);if(agents[_0x59c57a[_0x09c0('0x4')]]&&agents[_0x59c57a[_0x09c0('0x4')]]['reason']===_0x09c0('0x21')){if(_0x59c57a['cause']==='21'){agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x22')]='rejected';agents[_0x59c57a[_0x09c0('0x4')]]['lastevent']='rejected';}utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x52'),_0x59c57a[_0x09c0('0x4')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x7')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x22')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x9')]));writeDB(agents[_0x59c57a['uniqueid']]);var _0x188af2=unanswered[_0x09c0('0x53')](_0x59c57a['uniqueid']);if(_0x188af2>-0x1){unanswered['splice'](_0x188af2,0x1);}}if(transfers[_0x59c57a[_0x09c0('0x4')]]){transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0xd')]=!![];transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x34')]=utils[_0x09c0('0x19')]();transfers[_0x59c57a[_0x09c0('0x4')]]['talktime']=utils[_0x09c0('0x35')](transfers[_0x59c57a['uniqueid']][_0x09c0('0x34')],transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x2e')]);transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x22')]='agent';transfers[_0x59c57a[_0x09c0('0x4')]]['lastevent']=_0x09c0('0x36');utils['info'](util[_0x09c0('0x16')](_0x09c0('0x52'),_0x59c57a[_0x09c0('0x4')],transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x7')],transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x22')],transfers[_0x59c57a['uniqueid']]['lastevent']));writeDB(transfers[_0x59c57a[_0x09c0('0x4')]],!![]);}if(agents[_0x59c57a[_0x09c0('0x4')]]&&agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x2e')]){agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0xd')]=!![];agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x34')]=utils[_0x09c0('0x19')]();agents[_0x59c57a[_0x09c0('0x4')]]['talktime']=utils['diffTime'](agents[_0x59c57a['uniqueid']][_0x09c0('0x34')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x2e')]);agents[_0x59c57a['uniqueid']]['reason']=agents[_0x59c57a[_0x09c0('0x4')]]['transfer']?_0x09c0('0x3b'):_0x09c0('0x54');agents[_0x59c57a['uniqueid']][_0x09c0('0x9')]='complete';utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x52'),_0x59c57a['uniqueid'],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x7')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x22')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x9')]));writeDB(agents[_0x59c57a[_0x09c0('0x4')]]);}}catch(_0x4345a8){utils[_0x09c0('0x1c')](util[_0x09c0('0x16')](_0x09c0('0x55'),_0x59c57a[_0x09c0('0x4')]),_0x4345a8);}}; \ No newline at end of file +var _0xda3f=['ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','holdtime','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfertargetuniqueid','agentcalledAt','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','util','./utils','format','uniqueid','channel','membername','interface','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','debug','called','connectedlinenum','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','reason'];(function(_0x4c583c,_0x167310){var _0x2d0b2d=function(_0x395dc9){while(--_0x395dc9){_0x4c583c['push'](_0x4c583c['shift']());}};_0x2d0b2d(++_0x167310);}(_0xda3f,0xec));var _0xfda3=function(_0x581b6f,_0x44137f){_0x581b6f=_0x581b6f-0x0;var _0x33b7bf=_0xda3f[_0x581b6f];return _0x33b7bf;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var utils=require(_0xfda3('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x534697,_0x5299b0){utils['info'](util[_0xfda3('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x534697[_0xfda3('0x3')],_0x534697[_0xfda3('0x4')],_0x534697['queue'],_0x534697[_0xfda3('0x5')],_0x534697[_0xfda3('0x6')],_0x534697['calleridnum'],_0x534697['connectedlinenum'],_0x534697[_0xfda3('0x7')]));if(_0x534697[_0xfda3('0x8')]){utils[_0xfda3('0x9')](_0x534697[_0xfda3('0x8')])[_0xfda3('0xa')](function(_0x20e790){if(_0x20e790){_0x534697[_0xfda3('0xb')]=_0x20e790[_0xfda3('0xb')];_0x534697[_0xfda3('0xc')]=_0x534697[_0xfda3('0xd')]?_0x20e790[_0xfda3('0xe')]:![];_0x534697[_0xfda3('0xf')]=_0x534697['agentacw']?_0x20e790[_0xfda3('0x10')]:0x0;}utils[_0xfda3('0x11')](_0xfda3('0x12'),_0x534697);});}else{utils[_0xfda3('0x11')](_0xfda3('0x12'),_0x534697);}if(_0x5299b0){delete transfers[_0x534697['uniqueid']];}else{delete agents[_0x534697[_0xfda3('0x13')]];}}exports['agentcalled']=function(_0x3fd031){try{utils[_0xfda3('0x14')](util['format']('[%s][agents][agentcalled]',_0x3fd031['uniqueid']),_0x3fd031);agents[_0x3fd031[_0xfda3('0x13')]]=_0x3fd031;agents[_0x3fd031[_0xfda3('0x13')]]['agentcalledAt']=utils['now']();agents[_0x3fd031['destuniqueid']][_0xfda3('0x7')]=_0xfda3('0x15');agents[_0x3fd031[_0xfda3('0x13')]][_0xfda3('0x16')]=null;agents[_0x3fd031[_0xfda3('0x13')]][_0xfda3('0x17')]=null;utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x19'),_0x3fd031[_0xfda3('0x3')],agents[_0x3fd031['destuniqueid']][_0xfda3('0x5')],_0x3fd031[_0xfda3('0x13')]));}catch(_0x12d568){utils[_0xfda3('0x1a')](util['format'](_0xfda3('0x1b'),_0x3fd031[_0xfda3('0x3')]),_0x12d568);}};exports[_0xfda3('0x1c')]=function(_0x51e731){try{if(!_['isNil'](agents[_0x51e731[_0xfda3('0x13')]])){utils[_0xfda3('0x14')](util[_0xfda3('0x2')]('[%s][agents][agentringnoanswer]',_0x51e731[_0xfda3('0x3')]),_0x51e731);utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x1d'),_0x51e731[_0xfda3('0x3')],agents[_0x51e731[_0xfda3('0x13')]][_0xfda3('0x5')],_0x51e731[_0xfda3('0x13')]));agents[_0x51e731[_0xfda3('0x13')]]['agentringnoanswer']=!![];agents[_0x51e731[_0xfda3('0x13')]][_0xfda3('0x1e')]=utils[_0xfda3('0x1f')]();agents[_0x51e731['destuniqueid']][_0xfda3('0x7')]=_0xfda3('0x20');agents[_0x51e731[_0xfda3('0x13')]][_0xfda3('0x21')]=_0xfda3('0x20');agents[_0x51e731[_0xfda3('0x13')]]['holdtime']=_0x51e731[_0xfda3('0x22')]?parseInt(_0x51e731[_0xfda3('0x22')])/0x3e8:0x0;agents[_0x51e731[_0xfda3('0x13')]][_0xfda3('0x23')]=0x0;unanswered[_0xfda3('0x24')](_0x51e731['destuniqueid']);}}catch(_0x3c1549){utils[_0xfda3('0x1a')](util[_0xfda3('0x2')](_0xfda3('0x25'),_0x51e731[_0xfda3('0x3')]),_0x3c1549);}};exports[_0xfda3('0x26')]=function(_0x26e544){try{_['forIn'](agents,function(_0x56ca3a,_0x3aef3c){if(_0x56ca3a['uniqueid']==_0x26e544['uniqueid']&&!_[_0xfda3('0x27')](unanswered,_0x56ca3a[_0xfda3('0x13')])){utils[_0xfda3('0x14')](util[_0xfda3('0x2')](_0xfda3('0x28'),_0x26e544[_0xfda3('0x3')]),_0x26e544);utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x29'),_0x26e544['uniqueid'],_0x56ca3a[_0xfda3('0x5')],_0x56ca3a[_0xfda3('0x13')]));_0x56ca3a[_0xfda3('0x1c')]=!![];_0x56ca3a[_0xfda3('0x1e')]=utils[_0xfda3('0x1f')]();_0x56ca3a[_0xfda3('0x7')]=_0xfda3('0x2a');_0x56ca3a[_0xfda3('0x21')]=_0xfda3('0x2a');_0x56ca3a['holdtime']=_0x26e544['holdtime'];_0x56ca3a[_0xfda3('0x23')]=0x0;writeDB(_0x56ca3a);}});}catch(_0x17cccb){utils['error'](util[_0xfda3('0x2')](_0xfda3('0x28'),_0x26e544[_0xfda3('0x3')]),_0x17cccb);}};exports['agentconnect']=function(_0x1d92a9){try{if(agents[_0x1d92a9[_0xfda3('0x13')]]){utils[_0xfda3('0x14')](util[_0xfda3('0x2')](_0xfda3('0x2b'),_0x1d92a9['uniqueid']),_0x1d92a9);utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x2c'),_0x1d92a9['uniqueid'],agents[_0x1d92a9[_0xfda3('0x13')]]['membername'],_0x1d92a9[_0xfda3('0x13')]));agents[_0x1d92a9[_0xfda3('0x13')]][_0xfda3('0x2d')]=utils[_0xfda3('0x1f')]();agents[_0x1d92a9[_0xfda3('0x13')]][_0xfda3('0x16')]=_0x1d92a9[_0xfda3('0x16')];agents[_0x1d92a9[_0xfda3('0x13')]]['connectedlinename']=_0x1d92a9[_0xfda3('0x17')];agents[_0x1d92a9[_0xfda3('0x13')]][_0xfda3('0x2e')]=_0x1d92a9[_0xfda3('0x22')];agents[_0x1d92a9['destuniqueid']][_0xfda3('0x7')]=_0xfda3('0x2f');_[_0xfda3('0x30')](agents,function(_0x5bad90,_0x5ac61e){if(_0x5bad90[_0xfda3('0x13')]!=_0x1d92a9[_0xfda3('0x13')]&&_0x5bad90[_0xfda3('0x3')]==_0x1d92a9[_0xfda3('0x3')]){_0x5bad90[_0xfda3('0x23')]=0x0;_0x5bad90[_0xfda3('0x2e')]=_0x1d92a9[_0xfda3('0x22')];_0x5bad90[_0xfda3('0x1c')]=!![];_0x5bad90[_0xfda3('0x1e')]=utils[_0xfda3('0x1f')]();_0x5bad90['lastevent']=_0xfda3('0x31');_0x5bad90[_0xfda3('0x21')]='answered_elsewhere';_0x5bad90[_0xfda3('0x32')]=_0x1d92a9['destuniqueid'];_0x5bad90['answeredelsewheremembername']=_0x1d92a9['membername'];writeDB(_0x5bad90);}});}}catch(_0x2208bc){utils[_0xfda3('0x1a')](util[_0xfda3('0x2')](_0xfda3('0x2b'),_0x1d92a9['uniqueid']),_0x2208bc);}};exports[_0xfda3('0xd')]=function(_0x25b9a6){try{if(!_[_0xfda3('0x33')](agents[_0x25b9a6[_0xfda3('0x13')]])){utils['debug'](util[_0xfda3('0x2')](_0xfda3('0x34'),_0x25b9a6[_0xfda3('0x3')]),_0x25b9a6);utils['info'](util['format'](_0xfda3('0x35'),_0x25b9a6[_0xfda3('0x3')],agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0x5')],_0x25b9a6[_0xfda3('0x13')]));agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0xd')]=!![];agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0x36')]=utils[_0xfda3('0x1f')]();agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0x23')]=utils[_0xfda3('0x37')](agents[_0x25b9a6[_0xfda3('0x13')]]['agentcompleteAt'],agents[_0x25b9a6['destuniqueid']][_0xfda3('0x2d')]);agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0x21')]=_0x25b9a6[_0xfda3('0x21')];agents[_0x25b9a6[_0xfda3('0x13')]][_0xfda3('0x7')]=_0xfda3('0x38');writeDB(agents[_0x25b9a6[_0xfda3('0x13')]]);}}catch(_0x1372ee){utils[_0xfda3('0x1a')](util['format'](_0xfda3('0x34'),_0x25b9a6[_0xfda3('0x3')]),_0x1372ee);}};exports[_0xfda3('0x39')]=function(_0x36aa3a){try{if(!_[_0xfda3('0x33')](agents[_0x36aa3a['transfereruniqueid']])){utils[_0xfda3('0x14')](util[_0xfda3('0x2')](_0xfda3('0x3a'),_0x36aa3a['uniqueid']),_0x36aa3a);utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x3b'),_0x36aa3a['uniqueid'],agents[_0x36aa3a[_0xfda3('0x3c')]][_0xfda3('0x5')],agents[_0x36aa3a[_0xfda3('0x3c')]][_0xfda3('0x3')]));agents[_0x36aa3a[_0xfda3('0x3c')]]['transfer']=!![];agents[_0x36aa3a[_0xfda3('0x3c')]]['transfertype']=_0xfda3('0x3d');agents[_0x36aa3a['transfereruniqueid']][_0xfda3('0x3e')]=_0x36aa3a[_0xfda3('0x3f')];agents[_0x36aa3a[_0xfda3('0x3c')]][_0xfda3('0x40')]=agents[_0x36aa3a['transfereruniqueid']][_0xfda3('0x3')];}}catch(_0x3b430d){utils[_0xfda3('0x1a')](util[_0xfda3('0x2')](_0xfda3('0x3a'),_0x36aa3a[_0xfda3('0x3')]),_0x3b430d);}};exports[_0xfda3('0x41')]=function(_0x54fba2){try{utils['debug'](util[_0xfda3('0x2')](_0xfda3('0x42'),_0x54fba2[_0xfda3('0x43')]),_0x54fba2);if(_0x54fba2['origtransfereruniqueid']==_0x54fba2['origtransfererlinkedid']){if(!_[_0xfda3('0x33')](agents[_0x54fba2[_0xfda3('0x44')]])){utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x45'),_0x54fba2['origtransfereruniqueid'],agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x5')]));agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x46')]=!![];agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x47')]=_0xfda3('0x48');agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x3e')]=_0x54fba2[_0xfda3('0x49')];agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x40')]=_0x54fba2['origtransfereruniqueid'];}if(_0x54fba2[_0xfda3('0x4a')]&&agents[_0x54fba2[_0xfda3('0x4a')]]){agents[_0x54fba2[_0xfda3('0x4a')]][_0xfda3('0x4b')]=0x1;transfers[_0x54fba2[_0xfda3('0x4a')]]=_[_0xfda3('0x4c')](agents[_0x54fba2[_0xfda3('0x4a')]]);transfers[_0x54fba2['transfereeuniqueid']]['calleridnum']=agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x4d')];transfers[_0x54fba2['transfereeuniqueid']][_0xfda3('0x4e')]=agents[_0x54fba2[_0xfda3('0x44')]][_0xfda3('0x4e')];transfers[_0x54fba2[_0xfda3('0x4a')]]['agentcalledAt']=utils['now']();transfers[_0x54fba2[_0xfda3('0x4a')]][_0xfda3('0x2d')]=utils[_0xfda3('0x1f')]();transfers[_0x54fba2['transfereeuniqueid']][_0xfda3('0x2e')]=0x0;transfers[_0x54fba2['transfereeuniqueid']][_0xfda3('0x4b')]=0x2;}}else if(_0x54fba2[_0xfda3('0x44')]==_0x54fba2[_0xfda3('0x4f')]){if(!_[_0xfda3('0x33')](agents[_0x54fba2[_0xfda3('0x43')]])){utils[_0xfda3('0x18')](util['format'](_0xfda3('0x45'),_0x54fba2[_0xfda3('0x43')],agents[_0x54fba2[_0xfda3('0x43')]][_0xfda3('0x5')]));agents[_0x54fba2[_0xfda3('0x43')]]['transfer']=!![];agents[_0x54fba2['origtransfereruniqueid']][_0xfda3('0x47')]=_0xfda3('0x48');agents[_0x54fba2['origtransfereruniqueid']]['transferexten']=_0x54fba2['secondtransfererexten'];agents[_0x54fba2[_0xfda3('0x43')]][_0xfda3('0x40')]=_0x54fba2['secondtransfereruniqueid'];}if(_0x54fba2[_0xfda3('0x50')]&&agents[_0x54fba2[_0xfda3('0x50')]]){agents[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x4b')]=0x1;transfers[_0x54fba2['transfertargetuniqueid']]=_[_0xfda3('0x4c')](agents[_0x54fba2[_0xfda3('0x50')]]);transfers[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x4d')]=agents[_0x54fba2[_0xfda3('0x43')]][_0xfda3('0x4d')];transfers[_0x54fba2['transfertargetuniqueid']]['calleridname']=agents[_0x54fba2[_0xfda3('0x43')]]['calleridname'];transfers[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x51')]=utils[_0xfda3('0x1f')]();transfers[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x2d')]=utils[_0xfda3('0x1f')]();transfers[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x2e')]=0x0;transfers[_0x54fba2[_0xfda3('0x50')]][_0xfda3('0x4b')]=0x2;}}}catch(_0x4aa383){utils[_0xfda3('0x1a')](util['format']('[%s][agents][attendedtransfer]',_0x54fba2[_0xfda3('0x43')]),_0x4aa383);}};exports[_0xfda3('0x52')]=function(_0x531874){try{utils[_0xfda3('0x14')](util[_0xfda3('0x2')](_0xfda3('0x53'),_0x531874['uniqueid']),_0x531874);if(agents[_0x531874[_0xfda3('0x3')]]&&agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x21')]===_0xfda3('0x20')){if(_0x531874[_0xfda3('0x54')]==='21'){agents[_0x531874['uniqueid']]['reason']='rejected';agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x7')]=_0xfda3('0x55');}utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x56'),_0x531874['uniqueid'],agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x5')],agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x21')],agents[_0x531874['uniqueid']][_0xfda3('0x7')]));writeDB(agents[_0x531874['uniqueid']]);var _0x311645=unanswered[_0xfda3('0x57')](_0x531874[_0xfda3('0x3')]);if(_0x311645>-0x1){unanswered[_0xfda3('0x58')](_0x311645,0x1);}}if(transfers[_0x531874[_0xfda3('0x3')]]){transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0xd')]=!![];transfers[_0x531874['uniqueid']][_0xfda3('0x36')]=utils[_0xfda3('0x1f')]();transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0x23')]=utils[_0xfda3('0x37')](transfers[_0x531874[_0xfda3('0x3')]]['agentcompleteAt'],transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0x2d')]);transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0x21')]=_0xfda3('0x59');transfers[_0x531874['uniqueid']][_0xfda3('0x7')]=_0xfda3('0x38');utils[_0xfda3('0x18')](util[_0xfda3('0x2')](_0xfda3('0x56'),_0x531874[_0xfda3('0x3')],transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0x5')],transfers[_0x531874[_0xfda3('0x3')]][_0xfda3('0x21')],transfers[_0x531874['uniqueid']][_0xfda3('0x7')]));writeDB(transfers[_0x531874[_0xfda3('0x3')]],!![]);}if(agents[_0x531874[_0xfda3('0x3')]]&&agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x2d')]){agents[_0x531874['uniqueid']]['agentcomplete']=!![];agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x36')]=utils[_0xfda3('0x1f')]();agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x23')]=utils[_0xfda3('0x37')](agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x36')],agents[_0x531874[_0xfda3('0x3')]][_0xfda3('0x2d')]);agents[_0x531874[_0xfda3('0x3')]]['reason']=agents[_0x531874[_0xfda3('0x3')]]['transfer']?'transfer':'agent';agents[_0x531874[_0xfda3('0x3')]]['lastevent']=_0xfda3('0x38');utils[_0xfda3('0x18')](util['format'](_0xfda3('0x56'),_0x531874[_0xfda3('0x3')],agents[_0x531874['uniqueid']][_0xfda3('0x5')],agents[_0x531874['uniqueid']][_0xfda3('0x21')],agents[_0x531874[_0xfda3('0x3')]]['lastevent']));writeDB(agents[_0x531874[_0xfda3('0x3')]]);}}catch(_0x2122e3){utils[_0xfda3('0x1a')](util[_0xfda3('0x2')](_0xfda3('0x53'),_0x531874['uniqueid']),_0x2122e3);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 3064c20..3c9ecc8 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 _0xdccd=['lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','blinds','uniqueid','transfereeuniqueid','info','format','channel','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','answertime','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','userfield','_attended','transfertargetchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue'];(function(_0x51b1db,_0x3d673b){var _0x38d3bf=function(_0x3206a6){while(--_0x3206a6){_0x51b1db['push'](_0x51b1db['shift']());}};_0x38d3bf(++_0x3d673b);}(_0xdccd,0x102));var _0xddcc=function(_0x2e2beb,_0x36c541){_0x2e2beb=_0x2e2beb-0x0;var _0x2283b2=_0xdccd[_0x2e2beb];return _0x2283b2;};'use strict';var _=require(_0xddcc('0x0'));var util=require(_0xddcc('0x1'));var utils=require(_0xddcc('0x2'));var transfers=require(_0xddcc('0x3'));var dispositions=[_0xddcc('0x4'),'FAILED',_0xddcc('0x5'),_0xddcc('0x4'),_0xddcc('0x4'),_0xddcc('0x4'),_0xddcc('0x6'),'BUSY',_0xddcc('0x5'),_0xddcc('0x5'),_0xddcc('0x5')];var channels={};function writeDB(_0x574326){var _0x27512a;if(transfers[_0xddcc('0x7')][_0x574326['uniqueid']]){_0x27512a=_0x574326[_0xddcc('0x8')];_0x574326[_0xddcc('0x8')]=transfers[_0xddcc('0x7')][_0x574326[_0xddcc('0x8')]][_0xddcc('0x9')];}utils[_0xddcc('0xa')](util[_0xddcc('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x574326[_0xddcc('0x8')],_0x574326[_0xddcc('0xc')],_0x574326[_0xddcc('0xd')],_0x574326['membername'],_0x574326[_0xddcc('0xe')],_0x574326[_0xddcc('0xf')],_0x574326[_0xddcc('0x10')],_0x574326[_0xddcc('0x11')]));if(_0x574326[_0xddcc('0x12')]){utils[_0xddcc('0x13')](_0x574326[_0xddcc('0x12')])['then'](function(_0x775a3c){if(_0x775a3c){_0x574326[_0xddcc('0x14')]=_0x775a3c['id'];}utils[_0xddcc('0x15')](_0xddcc('0x16'),_0x574326);});}else{utils[_0xddcc('0x15')](_0xddcc('0x16'),_0x574326);}if(channels[_0x574326[_0xddcc('0x8')]]){delete channels[_0x574326['uniqueid']];}else if(_0x27512a&&channels[_0x27512a]){if(!transfers['blinds'][_0x27512a][_0xddcc('0x17')])delete transfers[_0xddcc('0x7')][_0x27512a];delete channels[_0x27512a];}}exports[_0xddcc('0x18')]=function(_0x5349b1){try{utils[_0xddcc('0x19')](util[_0xddcc('0xb')]('[%s][calls][newchannel]',_0x5349b1[_0xddcc('0x8')]),_0x5349b1);if(_0x5349b1[_0xddcc('0x8')]==_0x5349b1[_0xddcc('0x1a')]&&_0x5349b1[_0xddcc('0xc')]!=_0xddcc('0x1b')){utils[_0xddcc('0xa')](util[_0xddcc('0xb')](_0xddcc('0x1c'),_0x5349b1['uniqueid'],_0x5349b1['context'],_0x5349b1[_0xddcc('0x1d')]));channels[_0x5349b1[_0xddcc('0x8')]]={'uniqueid':_0x5349b1[_0xddcc('0x8')],'accountcode':_0x5349b1[_0xddcc('0x12')],'source':_0x5349b1[_0xddcc('0xf')],'destination':_0x5349b1[_0xddcc('0x1d')],'destinationcontext':_0x5349b1[_0xddcc('0x1e')],'channel':_0x5349b1[_0xddcc('0xc')],'starttime':utils[_0xddcc('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x1b8d29){utils[_0xddcc('0x20')](util[_0xddcc('0xb')](_0xddcc('0x21'),_0x5349b1[_0xddcc('0x8')]),_0x1b8d29);}};exports[_0xddcc('0x22')]=function(_0x4a4ac1){try{utils[_0xddcc('0x19')](util[_0xddcc('0xb')](_0xddcc('0x23'),_0x4a4ac1['uniqueid']),_0x4a4ac1);if(!_[_0xddcc('0x24')](channels[_0x4a4ac1[_0xddcc('0x8')]])&&_0x4a4ac1[_0xddcc('0x25')]==0x6){utils[_0xddcc('0xa')](util[_0xddcc('0xb')](_0xddcc('0x26'),_0x4a4ac1[_0xddcc('0x8')],_0x4a4ac1[_0xddcc('0x1e')],_0x4a4ac1[_0xddcc('0xc')]));if(_[_0xddcc('0x24')](channels[_0x4a4ac1[_0xddcc('0x8')]][_0xddcc('0x27')])){channels[_0x4a4ac1[_0xddcc('0x8')]][_0xddcc('0x27')]=utils[_0xddcc('0x1f')]();}}else if(!_[_0xddcc('0x24')](channels[_0x4a4ac1[_0xddcc('0x1a')]])&&_0x4a4ac1[_0xddcc('0x25')]==0x6&&_0x4a4ac1[_0xddcc('0x1e')]!=_0xddcc('0x28')){utils[_0xddcc('0xa')](util['format'](_0xddcc('0x29'),_0x4a4ac1[_0xddcc('0x8')],_0x4a4ac1[_0xddcc('0x1a')],_0x4a4ac1[_0xddcc('0x1e')],_0x4a4ac1['channel']));channels[_0x4a4ac1['linkedid']]['accountcode']=_0x4a4ac1[_0xddcc('0x12')];channels[_0x4a4ac1[_0xddcc('0x1a')]][_0xddcc('0x2a')]=_0x4a4ac1[_0xddcc('0xc')];if(_[_0xddcc('0x24')](channels[_0x4a4ac1[_0xddcc('0x1a')]]['answertime'])){channels[_0x4a4ac1['linkedid']]['answertime']=utils['now']();}channels[_0x4a4ac1[_0xddcc('0x1a')]][_0xddcc('0x2b')]=dispositions[_[_0xddcc('0x2c')](_0x4a4ac1[_0xddcc('0x25')])]||_0xddcc('0x6');}}catch(_0x12bcd6){utils[_0xddcc('0x20')](util['format']('[%s][calls][newstate]',_0x4a4ac1[_0xddcc('0x8')]),_0x12bcd6);}};exports['hangup']=function(_0x4f679b){try{if(!_[_0xddcc('0x24')](channels[_0x4f679b[_0xddcc('0x8')]])){utils['debug'](util['format'](_0xddcc('0x2d'),_0x4f679b[_0xddcc('0x8')]),_0x4f679b);if(_[_0xddcc('0x24')](channels[_0x4f679b['uniqueid']]['callerid'])){channels[_0x4f679b['uniqueid']][_0xddcc('0x2e')]=_0x4f679b[_0xddcc('0x2f')]+'\x20<'+_0x4f679b[_0xddcc('0xf')]+'>';}utils[_0xddcc('0xa')](util[_0xddcc('0xb')](_0xddcc('0x30'),_0x4f679b[_0xddcc('0x8')],channels[_0x4f679b[_0xddcc('0x8')]][_0xddcc('0x2e')],_0x4f679b[_0xddcc('0x31')]));channels[_0x4f679b['uniqueid']][_0xddcc('0x32')]=utils[_0xddcc('0x1f')]();channels[_0x4f679b[_0xddcc('0x8')]][_0xddcc('0x33')]=utils[_0xddcc('0x34')](channels[_0x4f679b[_0xddcc('0x8')]][_0xddcc('0x32')],channels[_0x4f679b[_0xddcc('0x8')]][_0xddcc('0x35')]);channels[_0x4f679b[_0xddcc('0x8')]][_0xddcc('0x36')]=channels[_0x4f679b[_0xddcc('0x8')]][_0xddcc('0x37')]?utils[_0xddcc('0x34')](channels[_0x4f679b[_0xddcc('0x8')]]['endtime'],channels[_0x4f679b[_0xddcc('0x8')]][_0xddcc('0x37')]):0x0;writeDB(channels[_0x4f679b[_0xddcc('0x8')]]);}}catch(_0x21a68c){utils[_0xddcc('0x20')](util[_0xddcc('0xb')](_0xddcc('0x2d'),_0x4f679b[_0xddcc('0x8')]),_0x21a68c);}};exports[_0xddcc('0x38')]=function(_0xe87b64){try{if(!_[_0xddcc('0x24')](channels[_0xe87b64['localtwolinkedid']])){utils[_0xddcc('0x19')](util[_0xddcc('0xb')](_0xddcc('0x39'),_0xe87b64[_0xddcc('0x3a')]),_0xe87b64);if(channels[_0xe87b64[_0xddcc('0x3b')]][_0xddcc('0xc')]==_0xe87b64['transfereechannel']){utils[_0xddcc('0xa')](util['format'](_0xddcc('0x3c'),_0xe87b64[_0xddcc('0x3a')],_0xe87b64[_0xddcc('0x3b')],_0xe87b64['secondtransfererchannel']));channels[_0xe87b64[_0xddcc('0x3b')]]['destinationchannel']=_0xe87b64['secondtransfererchannel'];channels[_0xe87b64[_0xddcc('0x3b')]][_0xddcc('0x3d')]=_0xddcc('0x3e');}else if(channels[_0xe87b64[_0xddcc('0x3b')]][_0xddcc('0xc')]=_0xe87b64[_0xddcc('0x3f')]){utils[_0xddcc('0xa')](util['format'](_0xddcc('0x3c'),_0xe87b64[_0xddcc('0x3a')],_0xe87b64[_0xddcc('0x3b')],_0xe87b64['origtransfererchannel']));channels[_0xe87b64['localtwolinkedid']]['destinationchannel']=_0xe87b64['origtransfererchannel'];channels[_0xe87b64[_0xddcc('0x3b')]][_0xddcc('0x3d')]=_0xddcc('0x3e');}}}catch(_0x28a303){utils['error'](util[_0xddcc('0xb')]('[%s][calls][attendedtransfer]',_0xe87b64[_0xddcc('0x3a')]),_0x28a303);}};exports[_0xddcc('0x40')]=function(_0x500150){try{if(!_[_0xddcc('0x24')](channels[_0x500150[_0xddcc('0x8')]])){utils[_0xddcc('0x19')](util[_0xddcc('0xb')](_0xddcc('0x41'),_0x500150[_0xddcc('0x8')]),_0x500150);channels[_0x500150[_0xddcc('0x8')]]['musiconholdstartAt']=utils[_0xddcc('0x1f')]();utils['info'](util[_0xddcc('0xb')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x500150[_0xddcc('0x8')],channels[_0x500150[_0xddcc('0x8')]][_0xddcc('0x42')]));}}catch(_0x39bfcf){utils[_0xddcc('0x20')](util[_0xddcc('0xb')](_0xddcc('0x41'),_0x500150[_0xddcc('0x8')]),_0x39bfcf);}};exports['musiconholdstop']=function(_0x4f2720){try{if(!_[_0xddcc('0x24')](channels[_0x4f2720['uniqueid']])){utils[_0xddcc('0x19')](util[_0xddcc('0xb')](_0xddcc('0x43'),_0x4f2720[_0xddcc('0x8')]),_0x4f2720);if(!_[_0xddcc('0x24')](channels[_0x4f2720['uniqueid']]['musiconholdstartAt'])){channels[_0x4f2720[_0xddcc('0x8')]]['mohtime']+=utils['diffTime'](utils['now'](),channels[_0x4f2720['uniqueid']][_0xddcc('0x42')]);utils[_0xddcc('0xa')](util['format'](_0xddcc('0x44'),_0x4f2720[_0xddcc('0x8')],channels[_0x4f2720['uniqueid']][_0xddcc('0x45')]));delete channels[_0x4f2720[_0xddcc('0x8')]][_0xddcc('0x42')];}}}catch(_0x81e224){utils[_0xddcc('0x20')](util[_0xddcc('0xb')](_0xddcc('0x43'),_0x4f2720[_0xddcc('0x8')]),_0x81e224);}};exports[_0xddcc('0x46')]=function(_0x2667d2){try{if(!_['isNil'](channels[_0x2667d2[_0xddcc('0x8')]])){utils['debug'](util[_0xddcc('0xb')](_0xddcc('0x47'),_0x2667d2['uniqueid']),_0x2667d2);if(!_[_0xddcc('0x24')](_0x2667d2[_0xddcc('0x48')]['xmd-originatecalleridnum'])){utils['info'](util[_0xddcc('0xb')](_0xddcc('0x49'),_0x2667d2[_0xddcc('0x8')],_0x2667d2[_0xddcc('0x4a')]));channels[_0x2667d2[_0xddcc('0x8')]][_0xddcc('0x4b')]=_0x2667d2[_0xddcc('0x4a')];}if(!_[_0xddcc('0x24')](_0x2667d2[_0xddcc('0x48')][_0xddcc('0x4c')])){utils[_0xddcc('0xa')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x2667d2['uniqueid'],_0x2667d2[_0xddcc('0x4a')]));channels[_0x2667d2[_0xddcc('0x8')]][_0xddcc('0x4d')]=_0x2667d2[_0xddcc('0x4a')];channels[_0x2667d2[_0xddcc('0x8')]]['callerid']='\x22'+_0x2667d2[_0xddcc('0x4a')]+_0xddcc('0x4e')+_0x2667d2[_0xddcc('0x4a')]+'>';}if(!_[_0xddcc('0x24')](_0x2667d2['variable'][_0xddcc('0x4f')])||!_[_0xddcc('0x24')](_0x2667d2[_0xddcc('0x48')][_0xddcc('0x50')])){utils[_0xddcc('0xa')](util[_0xddcc('0xb')](_0xddcc('0x51'),_0x2667d2[_0xddcc('0x8')],!_['isNil'](_0x2667d2[_0xddcc('0x48')]['xmd-callerid-preview'])?'xmd-callerid-preview':_0xddcc('0x50'),_0x2667d2['value']));channels[_0x2667d2['uniqueid']][_0xddcc('0x2e')]=_0x2667d2[_0xddcc('0x4a')];}if(!_[_0xddcc('0x24')](_0x2667d2['variable'][_0xddcc('0x52')])||!_[_0xddcc('0x24')](_0x2667d2[_0xddcc('0x48')][_0xddcc('0x53')])){utils[_0xddcc('0xa')](util[_0xddcc('0xb')](_0xddcc('0x51'),_0x2667d2[_0xddcc('0x8')],!_[_0xddcc('0x24')](_0x2667d2[_0xddcc('0x48')]['xmd-queue'])?_0xddcc('0x52'):_0xddcc('0x53'),_0x2667d2['value']));channels[_0x2667d2['uniqueid']][_0xddcc('0x54')]=_0xddcc('0x55');channels[_0x2667d2['uniqueid']][_0xddcc('0x56')]=_0x2667d2[_0xddcc('0x4a')];channels[_0x2667d2[_0xddcc('0x8')]]['queue']=!![];}if(!_[_0xddcc('0x24')](_0x2667d2[_0xddcc('0x48')][_0xddcc('0x57')])){utils[_0xddcc('0xa')](util[_0xddcc('0xb')](_0xddcc('0x58'),_0x2667d2['uniqueid'],_0x2667d2[_0xddcc('0x4a')]));channels[_0x2667d2[_0xddcc('0x8')]][_0xddcc('0x59')]=_0x2667d2['value'];}if(!_[_0xddcc('0x24')](_0x2667d2[_0xddcc('0x48')][_0xddcc('0x5a')])){utils[_0xddcc('0xa')](util[_0xddcc('0xb')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x2667d2[_0xddcc('0x8')],_0x2667d2['value']));channels[_0x2667d2[_0xddcc('0x8')]][_0xddcc('0x5b')]=_0x2667d2['value'];}if(!_[_0xddcc('0x24')](_0x2667d2[_0xddcc('0x48')][_0xddcc('0x5c')])){utils[_0xddcc('0xa')](util[_0xddcc('0xb')](_0xddcc('0x5d'),_0x2667d2[_0xddcc('0x8')],_0x2667d2[_0xddcc('0x4a')]));channels[_0x2667d2[_0xddcc('0x8')]][_0xddcc('0x5e')]=_0x2667d2[_0xddcc('0x4a')];}if(!_[_0xddcc('0x24')](_0x2667d2[_0xddcc('0x48')][_0xddcc('0x5f')])){utils[_0xddcc('0xa')](util[_0xddcc('0xb')](_0xddcc('0x60'),_0x2667d2[_0xddcc('0x8')],_0x2667d2['value']));channels[_0x2667d2[_0xddcc('0x8')]][_0xddcc('0x5f')]=_0x2667d2[_0xddcc('0x4a')];}}}catch(_0x2b329d){utils[_0xddcc('0x20')](util['format'](_0xddcc('0x47'),_0x2667d2[_0xddcc('0x8')]),_0x2b329d);}};exports[_0xddcc('0x61')]=function(_0x5a7d1b){try{if(!_['isNil'](channels[_0x5a7d1b[_0xddcc('0x8')]])){utils['debug'](util[_0xddcc('0xb')](_0xddcc('0x62'),_0x5a7d1b[_0xddcc('0x8')]),_0x5a7d1b);utils[_0xddcc('0xa')](util[_0xddcc('0xb')](_0xddcc('0x63'),_0x5a7d1b[_0xddcc('0x8')],_0x5a7d1b[_0xddcc('0x64')],_0x5a7d1b[_0xddcc('0x65')]));if(_0x5a7d1b[_0xddcc('0x64')][_0xddcc('0x66')]()==_0xddcc('0x67')&&_[_0xddcc('0x68')](_0x5a7d1b[_0xddcc('0x65')][_0xddcc('0x66')](),_0xddcc('0x69'))){var _0x4e5778=_0x5a7d1b['appdata'][_0xddcc('0x6a')]('=');var _0x4461ca=_0x4e5778[0x0][_0xddcc('0x6b')](_0x4e5778[0x0][_0xddcc('0x6c')]('(')+0x1,_0x4e5778[0x0][_0xddcc('0x6c')](')'));var _0x23abe7=_0x4e5778[0x1];channels[_0x5a7d1b[_0xddcc('0x8')]][_0x4461ca]=_0x23abe7;}if(!_[_0xddcc('0x6d')]([_0xddcc('0x6e'),_0xddcc('0x6f'),_0xddcc('0x70'),_0xddcc('0x67'),_0xddcc('0x71')],_0x5a7d1b[_0xddcc('0x64')][_0xddcc('0x66')]())){channels[_0x5a7d1b['uniqueid']][_0xddcc('0x54')]=_0x5a7d1b[_0xddcc('0x64')];channels[_0x5a7d1b[_0xddcc('0x8')]][_0xddcc('0x56')]=_0x5a7d1b[_0xddcc('0x65')];}}}catch(_0x54cab0){utils['error'](util['format'](_0xddcc('0x62'),_0x5a7d1b[_0xddcc('0x8')]),_0x54cab0);}}; \ No newline at end of file +var _0xcf2e=['request','CreateVoiceCallReport','recording','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','accountcode','context','now','[%s][calls][newstate]','isNil','systemanswertime','transfer','destinationchannel','answertime','toNumber','channelstate','error','hangup','debug','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','substring','lastIndexOf','includes','noop','execif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum','lastevent','then','UserId'];(function(_0x42a721,_0x2098e5){var _0x300148=function(_0x585f3c){while(--_0x585f3c){_0x42a721['push'](_0x42a721['shift']());}};_0x300148(++_0x2098e5);}(_0xcf2e,0x197));var _0xecf2=function(_0x2a7c2a,_0x37cc9e){_0x2a7c2a=_0x2a7c2a-0x0;var _0x195732=_0xcf2e[_0x2a7c2a];return _0x195732;};'use strict';var _=require(_0xecf2('0x0'));var util=require(_0xecf2('0x1'));var utils=require(_0xecf2('0x2'));var transfers=require(_0xecf2('0x3'));var dispositions=[_0xecf2('0x4'),_0xecf2('0x5'),_0xecf2('0x5'),_0xecf2('0x4'),_0xecf2('0x4'),'NO\x20ANSWER',_0xecf2('0x6'),_0xecf2('0x7'),_0xecf2('0x5'),_0xecf2('0x5'),'FAILED'];var channels={};function writeDB(_0x1d4f99){var _0xc8c7f6;if(transfers[_0xecf2('0x8')][_0x1d4f99[_0xecf2('0x9')]]){_0xc8c7f6=_0x1d4f99[_0xecf2('0x9')];_0x1d4f99[_0xecf2('0x9')]=transfers[_0xecf2('0x8')][_0x1d4f99[_0xecf2('0x9')]]['transfereeuniqueid'];}utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0xc'),_0x1d4f99[_0xecf2('0x9')],_0x1d4f99[_0xecf2('0xd')],_0x1d4f99[_0xecf2('0xe')],_0x1d4f99['membername'],_0x1d4f99[_0xecf2('0xf')],_0x1d4f99[_0xecf2('0x10')],_0x1d4f99[_0xecf2('0x11')],_0x1d4f99[_0xecf2('0x12')]));if(_0x1d4f99['accountcode']){utils['getUserByInternal'](_0x1d4f99['accountcode'])[_0xecf2('0x13')](function(_0x2fa9a2){if(_0x2fa9a2){_0x1d4f99[_0xecf2('0x14')]=_0x2fa9a2['id'];}utils[_0xecf2('0x15')](_0xecf2('0x16'),_0x1d4f99);});}else{utils[_0xecf2('0x15')](_0xecf2('0x16'),_0x1d4f99);}if(channels[_0x1d4f99['uniqueid']]){delete channels[_0x1d4f99[_0xecf2('0x9')]];}else if(_0xc8c7f6&&channels[_0xc8c7f6]){if(!transfers['blinds'][_0xc8c7f6][_0xecf2('0x17')])delete transfers[_0xecf2('0x8')][_0xc8c7f6];delete channels[_0xc8c7f6];}}exports['newchannel']=function(_0x556c53){try{utils['debug'](util['format'](_0xecf2('0x18'),_0x556c53[_0xecf2('0x9')]),_0x556c53);if(_0x556c53[_0xecf2('0x9')]==_0x556c53[_0xecf2('0x19')]&&_0x556c53[_0xecf2('0xd')]!='OutgoingSpoolFailed'){utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x1a'),_0x556c53[_0xecf2('0x9')],_0x556c53['context'],_0x556c53['exten']));channels[_0x556c53[_0xecf2('0x9')]]={'uniqueid':_0x556c53[_0xecf2('0x9')],'accountcode':_0x556c53[_0xecf2('0x1b')],'source':_0x556c53[_0xecf2('0x10')],'destination':_0x556c53['exten'],'destinationcontext':_0x556c53[_0xecf2('0x1c')],'channel':_0x556c53[_0xecf2('0xd')],'starttime':utils[_0xecf2('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x3ee797){utils['error'](util['format']('[%s][calls][newchannel]',_0x556c53[_0xecf2('0x9')]),_0x3ee797);}};exports['newstate']=function(_0x29ae4a){try{utils['debug'](util[_0xecf2('0xb')](_0xecf2('0x1e'),_0x29ae4a[_0xecf2('0x9')]),_0x29ae4a);if(!_[_0xecf2('0x1f')](channels[_0x29ae4a[_0xecf2('0x9')]])&&_0x29ae4a['channelstate']==0x6){utils['info'](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x29ae4a['uniqueid'],_0x29ae4a[_0xecf2('0x1c')],_0x29ae4a[_0xecf2('0xd')]));if(_[_0xecf2('0x1f')](channels[_0x29ae4a[_0xecf2('0x9')]][_0xecf2('0x20')])){channels[_0x29ae4a[_0xecf2('0x9')]][_0xecf2('0x20')]=utils[_0xecf2('0x1d')]();}}else if(!_[_0xecf2('0x1f')](channels[_0x29ae4a[_0xecf2('0x19')]])&&_0x29ae4a['channelstate']==0x6&&_0x29ae4a[_0xecf2('0x1c')]!=_0xecf2('0x21')){utils[_0xecf2('0xa')](util[_0xecf2('0xb')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x29ae4a['uniqueid'],_0x29ae4a['linkedid'],_0x29ae4a[_0xecf2('0x1c')],_0x29ae4a[_0xecf2('0xd')]));channels[_0x29ae4a[_0xecf2('0x19')]][_0xecf2('0x1b')]=_0x29ae4a[_0xecf2('0x1b')];channels[_0x29ae4a[_0xecf2('0x19')]][_0xecf2('0x22')]=_0x29ae4a[_0xecf2('0xd')];if(_[_0xecf2('0x1f')](channels[_0x29ae4a[_0xecf2('0x19')]][_0xecf2('0x23')])){channels[_0x29ae4a[_0xecf2('0x19')]][_0xecf2('0x23')]=utils[_0xecf2('0x1d')]();}channels[_0x29ae4a[_0xecf2('0x19')]]['disposition']=dispositions[_[_0xecf2('0x24')](_0x29ae4a[_0xecf2('0x25')])]||_0xecf2('0x6');}}catch(_0x1a3577){utils[_0xecf2('0x26')](util['format'](_0xecf2('0x1e'),_0x29ae4a[_0xecf2('0x9')]),_0x1a3577);}};exports[_0xecf2('0x27')]=function(_0x54b9d3){try{if(!_[_0xecf2('0x1f')](channels[_0x54b9d3[_0xecf2('0x9')]])){utils[_0xecf2('0x28')](util[_0xecf2('0xb')](_0xecf2('0x29'),_0x54b9d3[_0xecf2('0x9')]),_0x54b9d3);if(_[_0xecf2('0x1f')](channels[_0x54b9d3[_0xecf2('0x9')]][_0xecf2('0x2a')])){channels[_0x54b9d3['uniqueid']][_0xecf2('0x2a')]=_0x54b9d3[_0xecf2('0x2b')]+'\x20<'+_0x54b9d3[_0xecf2('0x10')]+'>';}utils[_0xecf2('0xa')](util['format'](_0xecf2('0x2c'),_0x54b9d3['uniqueid'],channels[_0x54b9d3['uniqueid']][_0xecf2('0x2a')],_0x54b9d3['cause-txt']));channels[_0x54b9d3[_0xecf2('0x9')]][_0xecf2('0x2d')]=utils[_0xecf2('0x1d')]();channels[_0x54b9d3['uniqueid']][_0xecf2('0x2e')]=utils['diffTime'](channels[_0x54b9d3['uniqueid']][_0xecf2('0x2d')],channels[_0x54b9d3[_0xecf2('0x9')]][_0xecf2('0x2f')]);channels[_0x54b9d3[_0xecf2('0x9')]][_0xecf2('0x30')]=channels[_0x54b9d3[_0xecf2('0x9')]][_0xecf2('0x23')]?utils[_0xecf2('0x31')](channels[_0x54b9d3['uniqueid']][_0xecf2('0x2d')],channels[_0x54b9d3[_0xecf2('0x9')]][_0xecf2('0x23')]):0x0;writeDB(channels[_0x54b9d3[_0xecf2('0x9')]]);}}catch(_0x196981){utils[_0xecf2('0x26')](util[_0xecf2('0xb')](_0xecf2('0x29'),_0x54b9d3[_0xecf2('0x9')]),_0x196981);}};exports[_0xecf2('0x32')]=function(_0x4cd901){try{if(!_[_0xecf2('0x1f')](channels[_0x4cd901[_0xecf2('0x33')]])){utils[_0xecf2('0x28')](util[_0xecf2('0xb')]('[%s][calls][attendedtransfer]',_0x4cd901[_0xecf2('0x34')]),_0x4cd901);if(channels[_0x4cd901[_0xecf2('0x33')]][_0xecf2('0xd')]==_0x4cd901[_0xecf2('0x35')]){utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x36'),_0x4cd901[_0xecf2('0x34')],_0x4cd901[_0xecf2('0x33')],_0x4cd901[_0xecf2('0x37')]));channels[_0x4cd901[_0xecf2('0x33')]][_0xecf2('0x22')]=_0x4cd901[_0xecf2('0x37')];channels[_0x4cd901[_0xecf2('0x33')]]['userfield']=_0xecf2('0x38');}else if(channels[_0x4cd901[_0xecf2('0x33')]][_0xecf2('0xd')]=_0x4cd901['transfertargetchannel']){utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x36'),_0x4cd901['origtransfereruniqueid'],_0x4cd901[_0xecf2('0x33')],_0x4cd901[_0xecf2('0x39')]));channels[_0x4cd901[_0xecf2('0x33')]][_0xecf2('0x22')]=_0x4cd901[_0xecf2('0x39')];channels[_0x4cd901[_0xecf2('0x33')]][_0xecf2('0x3a')]=_0xecf2('0x38');}}}catch(_0x4228f7){utils[_0xecf2('0x26')](util['format']('[%s][calls][attendedtransfer]',_0x4cd901[_0xecf2('0x34')]),_0x4228f7);}};exports[_0xecf2('0x3b')]=function(_0x126eb9){try{if(!_['isNil'](channels[_0x126eb9[_0xecf2('0x9')]])){utils[_0xecf2('0x28')](util[_0xecf2('0xb')](_0xecf2('0x3c'),_0x126eb9[_0xecf2('0x9')]),_0x126eb9);channels[_0x126eb9[_0xecf2('0x9')]][_0xecf2('0x3d')]=utils['now']();utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x3e'),_0x126eb9[_0xecf2('0x9')],channels[_0x126eb9[_0xecf2('0x9')]]['musiconholdstartAt']));}}catch(_0x544a77){utils[_0xecf2('0x26')](util[_0xecf2('0xb')]('[%s][calls][musiconholdstart]',_0x126eb9[_0xecf2('0x9')]),_0x544a77);}};exports[_0xecf2('0x3f')]=function(_0x310ff5){try{if(!_[_0xecf2('0x1f')](channels[_0x310ff5[_0xecf2('0x9')]])){utils[_0xecf2('0x28')](util[_0xecf2('0xb')](_0xecf2('0x40'),_0x310ff5['uniqueid']),_0x310ff5);if(!_[_0xecf2('0x1f')](channels[_0x310ff5[_0xecf2('0x9')]]['musiconholdstartAt'])){channels[_0x310ff5['uniqueid']][_0xecf2('0x41')]+=utils[_0xecf2('0x31')](utils[_0xecf2('0x1d')](),channels[_0x310ff5[_0xecf2('0x9')]][_0xecf2('0x3d')]);utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x42'),_0x310ff5['uniqueid'],channels[_0x310ff5[_0xecf2('0x9')]][_0xecf2('0x41')]));delete channels[_0x310ff5[_0xecf2('0x9')]][_0xecf2('0x3d')];}}}catch(_0x2f1040){utils['error'](util[_0xecf2('0xb')](_0xecf2('0x40'),_0x310ff5[_0xecf2('0x9')]),_0x2f1040);}};exports[_0xecf2('0x43')]=function(_0x32bf7c){try{if(!_['isNil'](channels[_0x32bf7c[_0xecf2('0x9')]])){utils[_0xecf2('0x28')](util[_0xecf2('0xb')](_0xecf2('0x44'),_0x32bf7c[_0xecf2('0x9')]),_0x32bf7c);if(!_[_0xecf2('0x1f')](_0x32bf7c[_0xecf2('0x45')]['xmd-originatecalleridnum'])){utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x46'),_0x32bf7c[_0xecf2('0x9')],_0x32bf7c[_0xecf2('0x47')]));channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0x48')]=_0x32bf7c[_0xecf2('0x47')];}if(!_[_0xecf2('0x1f')](_0x32bf7c[_0xecf2('0x45')][_0xecf2('0x49')])){utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x4a'),_0x32bf7c[_0xecf2('0x9')],_0x32bf7c[_0xecf2('0x47')]));channels[_0x32bf7c['uniqueid']]['destination']=_0x32bf7c[_0xecf2('0x47')];channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0x2a')]='\x22'+_0x32bf7c['value']+_0xecf2('0x4b')+_0x32bf7c[_0xecf2('0x47')]+'>';}if(!_[_0xecf2('0x1f')](_0x32bf7c[_0xecf2('0x45')]['xmd-callerid-preview'])||!_[_0xecf2('0x1f')](_0x32bf7c['variable'][_0xecf2('0x4c')])){utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x4d'),_0x32bf7c[_0xecf2('0x9')],!_['isNil'](_0x32bf7c[_0xecf2('0x45')][_0xecf2('0x4e')])?_0xecf2('0x4e'):_0xecf2('0x4c'),_0x32bf7c[_0xecf2('0x47')]));channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0x2a')]=_0x32bf7c[_0xecf2('0x47')];}if(!_[_0xecf2('0x1f')](_0x32bf7c['variable'][_0xecf2('0x4f')])||!_[_0xecf2('0x1f')](_0x32bf7c['variable'][_0xecf2('0x50')])){utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x4d'),_0x32bf7c[_0xecf2('0x9')],!_[_0xecf2('0x1f')](_0x32bf7c[_0xecf2('0x45')][_0xecf2('0x4f')])?'xmd-queue':_0xecf2('0x50'),_0x32bf7c[_0xecf2('0x47')]));channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0x51')]=_0xecf2('0x52');channels[_0x32bf7c['uniqueid']][_0xecf2('0x53')]=_0x32bf7c[_0xecf2('0x47')];channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0xe')]=!![];}if(!_[_0xecf2('0x1f')](_0x32bf7c[_0xecf2('0x45')][_0xecf2('0x54')])){utils['info'](util[_0xecf2('0xb')](_0xecf2('0x55'),_0x32bf7c[_0xecf2('0x9')],_0x32bf7c['value']));channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0x56')]=_0x32bf7c[_0xecf2('0x47')];}if(!_['isNil'](_0x32bf7c[_0xecf2('0x45')][_0xecf2('0x57')])){utils['info'](util[_0xecf2('0xb')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x32bf7c['uniqueid'],_0x32bf7c[_0xecf2('0x47')]));channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0x58')]=_0x32bf7c[_0xecf2('0x47')];}if(!_[_0xecf2('0x1f')](_0x32bf7c['variable'][_0xecf2('0x59')])){utils[_0xecf2('0xa')](util['format'](_0xecf2('0x5a'),_0x32bf7c[_0xecf2('0x9')],_0x32bf7c['value']));channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0x5b')]=_0x32bf7c[_0xecf2('0x47')];}if(!_[_0xecf2('0x1f')](_0x32bf7c['variable']['sipcallid'])){utils[_0xecf2('0xa')](util['format'](_0xecf2('0x5c'),_0x32bf7c[_0xecf2('0x9')],_0x32bf7c[_0xecf2('0x47')]));channels[_0x32bf7c[_0xecf2('0x9')]][_0xecf2('0x5d')]=_0x32bf7c[_0xecf2('0x47')];}}}catch(_0x586817){utils[_0xecf2('0x26')](util[_0xecf2('0xb')](_0xecf2('0x44'),_0x32bf7c['uniqueid']),_0x586817);}};exports[_0xecf2('0x5e')]=function(_0x5060fe){try{if(!_['isNil'](channels[_0x5060fe[_0xecf2('0x9')]])){utils[_0xecf2('0x28')](util['format'](_0xecf2('0x5f'),_0x5060fe[_0xecf2('0x9')]),_0x5060fe);utils[_0xecf2('0xa')](util[_0xecf2('0xb')](_0xecf2('0x60'),_0x5060fe[_0xecf2('0x9')],_0x5060fe[_0xecf2('0x61')],_0x5060fe[_0xecf2('0x62')]));if(_0x5060fe[_0xecf2('0x61')][_0xecf2('0x63')]()==_0xecf2('0x64')&&_['startsWith'](_0x5060fe['appdata']['toLowerCase'](),_0xecf2('0x65'))){var _0x454e93=_0x5060fe[_0xecf2('0x62')]['split']('=');var _0x45d501=_0x454e93[0x0][_0xecf2('0x66')](_0x454e93[0x0][_0xecf2('0x67')]('(')+0x1,_0x454e93[0x0]['lastIndexOf'](')'));var _0x127a2f=_0x454e93[0x1];channels[_0x5060fe[_0xecf2('0x9')]][_0x45d501]=_0x127a2f;}if(!_[_0xecf2('0x68')]([_0xecf2('0x27'),_0xecf2('0x69'),_0xecf2('0x6a'),_0xecf2('0x64'),'gotoif'],_0x5060fe[_0xecf2('0x61')][_0xecf2('0x63')]())){channels[_0x5060fe[_0xecf2('0x9')]][_0xecf2('0x51')]=_0x5060fe['application'];channels[_0x5060fe['uniqueid']][_0xecf2('0x53')]=_0x5060fe[_0xecf2('0x62')];}}}catch(_0x1b2b40){utils[_0xecf2('0x26')](util[_0xecf2('0xb')](_0xecf2('0x5f'),_0x5060fe['uniqueid']),_0x1b2b40);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 14e719e..be605f0 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 _0xebcb=['[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20close','connect','info'];(function(_0x5edb22,_0x136394){var _0x3f9dba=function(_0x9dd4fa){while(--_0x9dd4fa){_0x5edb22['push'](_0x5edb22['shift']());}};_0x3f9dba(++_0x136394);}(_0xebcb,0x85));var _0xbebc=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0xebcb[_0x46361e];return _0x14e302;};'use strict';var utils=require('./utils');exports[_0xbebc('0x0')]=function(){utils[_0xbebc('0x1')](_0xbebc('0x2'));};exports[_0xbebc('0x3')]=function(){utils[_0xbebc('0x1')](_0xbebc('0x4'));};exports[_0xbebc('0x5')]=function(){utils['info'](_0xbebc('0x6'));};exports['error']=function(_0x411221){utils[_0xbebc('0x7')]('[core]\x20error',_0x411221);};exports['close']=function(){utils[_0xbebc('0x1')](_0xbebc('0x8'));};exports['managerevent']=function(_0x345573){}; \ No newline at end of file +var _0xf969=['connect','info','shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent'];(function(_0x1ae44a,_0x4a9881){var _0x3f15f2=function(_0x2573d6){while(--_0x2573d6){_0x1ae44a['push'](_0x1ae44a['shift']());}};_0x3f15f2(++_0x4a9881);}(_0xf969,0x96));var _0x9f96=function(_0x5367a1,_0x27dad3){_0x5367a1=_0x5367a1-0x0;var _0x303cac=_0xf969[_0x5367a1];return _0x303cac;};'use strict';var utils=require('./utils');exports[_0x9f96('0x0')]=function(){utils[_0x9f96('0x1')]('[core]\x20connected');};exports[_0x9f96('0x2')]=function(){utils[_0x9f96('0x1')](_0x9f96('0x3'));};exports['fullybooted']=function(){utils[_0x9f96('0x1')](_0x9f96('0x4'));};exports[_0x9f96('0x5')]=function(_0x32f517){utils[_0x9f96('0x5')](_0x9f96('0x6'),_0x32f517);};exports[_0x9f96('0x7')]=function(){utils[_0x9f96('0x1')](_0x9f96('0x8'));};exports[_0x9f96('0x9')]=function(_0xded515){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 4b2da6d..c7bf2c8 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 _0x6867=['[%s][dials][hangup]','util','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','format','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','uniqueid','application','appdata','set','startsWith','toLowerCase','split','error','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','cause-txt','duration','holdtime','diffTime','endtime','billableseconds'];(function(_0x3446a5,_0x77cf09){var _0x20c2a4=function(_0x476282){while(--_0x476282){_0x3446a5['push'](_0x3446a5['shift']());}};_0x20c2a4(++_0x77cf09);}(_0x6867,0x9d));var _0x7686=function(_0xf48e94,_0x3df690){_0xf48e94=_0xf48e94-0x0;var _0x5a41d3=_0x6867[_0xf48e94];return _0x5a41d3;};'use strict';var _=require('lodash');var util=require(_0x7686('0x0'));var utils=require(_0x7686('0x1'));var dials={};function writeDB(_0x3975c7){utils['info'](util['format'](_0x7686('0x2'),_0x3975c7['uniqueid'],_0x3975c7[_0x7686('0x3')],_0x3975c7[_0x7686('0x4')],_0x3975c7[_0x7686('0x5')],_0x3975c7[_0x7686('0x6')],_0x3975c7[_0x7686('0x7')]));utils[_0x7686('0x8')](_0x7686('0x9'),_0x3975c7);delete dials[_0x3975c7['uniqueid']];}exports['newexten']=function(_0x121656){try{utils[_0x7686('0xa')](util[_0x7686('0xb')](_0x7686('0xc'),_0x121656['uniqueid']),_0x121656);utils[_0x7686('0xd')](util['format'](_0x7686('0xe'),_0x121656[_0x7686('0xf')],_0x121656[_0x7686('0x10')],_0x121656[_0x7686('0x11')]));if(_0x121656[_0x7686('0x10')]['toLowerCase']()==_0x7686('0x12')&&_[_0x7686('0x13')](_0x121656[_0x7686('0x11')][_0x7686('0x14')](),'cdr(routeid)')){var _0x5b005e=_0x121656[_0x7686('0x11')][_0x7686('0x15')]('=');dials[_0x121656['uniqueid']]={'routeId':_0x5b005e[0x1]};}}catch(_0x46d486){utils[_0x7686('0x16')](util['format'](_0x7686('0xc'),_0x121656[_0x7686('0xf')]),_0x46d486);}};exports['varset']=function(_0x6f41fd){try{utils['debug'](util[_0x7686('0xb')](_0x7686('0x17'),_0x6f41fd[_0x7686('0xf')]),_0x6f41fd);if(!_[_0x7686('0x18')](_0x6f41fd[_0x7686('0x19')][_0x7686('0x1a')])){utils[_0x7686('0xd')](util['format'](_0x7686('0x1b'),_0x6f41fd[_0x7686('0xf')],_0x6f41fd['value']));dials[_0x6f41fd[_0x7686('0xf')]]={'routeId':_0x6f41fd[_0x7686('0x1c')]};}}catch(_0x3680c3){utils['error'](util[_0x7686('0xb')](_0x7686('0x17'),_0x6f41fd[_0x7686('0xf')]),_0x3680c3);}};exports[_0x7686('0x1d')]=function(_0x5f43b0){try{if(!_[_0x7686('0x18')](dials[_0x5f43b0['uniqueid']])){utils[_0x7686('0xa')](util['format'](_0x7686('0x1e'),_0x5f43b0['uniqueid']),_0x5f43b0);dials[_0x5f43b0[_0x7686('0xf')]]=_[_0x7686('0x1f')](dials[_0x5f43b0['uniqueid']],_0x5f43b0);dials[_0x5f43b0[_0x7686('0xf')]][_0x7686('0x20')]=utils[_0x7686('0x21')]();dials[_0x5f43b0['uniqueid']][_0x7686('0x22')]=_0x7686('0x23');utils[_0x7686('0xd')](util[_0x7686('0xb')](_0x7686('0x24'),_0x5f43b0[_0x7686('0xf')],dials[_0x5f43b0['uniqueid']][_0x7686('0x20')]));}}catch(_0x1d416d){utils['error'](util[_0x7686('0xb')](_0x7686('0x1e'),_0x5f43b0[_0x7686('0xf')]),_0x1d416d);}};exports[_0x7686('0x25')]=function(_0x526fbd){try{if(!_[_0x7686('0x18')](dials[_0x526fbd[_0x7686('0xf')]])){utils[_0x7686('0xa')](util[_0x7686('0xb')](_0x7686('0x26'),_0x526fbd[_0x7686('0xf')]),_0x526fbd);dials[_0x526fbd[_0x7686('0xf')]]['dialstatus']=_0x526fbd[_0x7686('0x7')];if(_0x526fbd[_0x7686('0x7')]==_0x7686('0x27')){dials[_0x526fbd['uniqueid']]=_['assign'](dials[_0x526fbd['uniqueid']],_0x526fbd);dials[_0x526fbd[_0x7686('0xf')]][_0x7686('0x28')]=utils[_0x7686('0x21')]();dials[_0x526fbd[_0x7686('0xf')]][_0x7686('0x22')]=_0x7686('0x29');utils['info'](util[_0x7686('0xb')](_0x7686('0x2a'),_0x526fbd[_0x7686('0xf')],_0x526fbd[_0x7686('0x7')],dials[_0x526fbd['uniqueid']][_0x7686('0x28')]));}else{utils[_0x7686('0xd')](util['format'](_0x7686('0x2b'),_0x526fbd[_0x7686('0xf')],_0x526fbd[_0x7686('0x7')]));}}}catch(_0x4aebd6){utils[_0x7686('0x16')](util['format']('[%s][dials][dialend]',_0x526fbd[_0x7686('0xf')]),_0x4aebd6);}};exports[_0x7686('0x2c')]=function(_0x11efa1){try{if(!_[_0x7686('0x18')](dials[_0x11efa1[_0x7686('0xf')]])){utils[_0x7686('0xa')](util[_0x7686('0xb')]('[%s][dials][hangup]',_0x11efa1['uniqueid']),_0x11efa1);utils[_0x7686('0xd')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x11efa1[_0x7686('0xf')],_0x11efa1[_0x7686('0x5')],_0x11efa1['calleridname'],_0x11efa1[_0x7686('0x2d')]));dials[_0x11efa1[_0x7686('0xf')]]=_[_0x7686('0x1f')](dials[_0x11efa1[_0x7686('0xf')]],{'endtime':utils[_0x7686('0x21')](),'lastevent':'complete'});dials[_0x11efa1[_0x7686('0xf')]][_0x7686('0x2e')]=utils['diffTime'](dials[_0x11efa1[_0x7686('0xf')]]['endtime'],dials[_0x11efa1['uniqueid']][_0x7686('0x20')]);dials[_0x11efa1[_0x7686('0xf')]][_0x7686('0x2f')]=utils[_0x7686('0x30')](dials[_0x11efa1[_0x7686('0xf')]][_0x7686('0x28')]||dials[_0x11efa1[_0x7686('0xf')]][_0x7686('0x31')],dials[_0x11efa1[_0x7686('0xf')]]['starttime']);dials[_0x11efa1[_0x7686('0xf')]][_0x7686('0x32')]=dials[_0x11efa1[_0x7686('0xf')]][_0x7686('0x28')]?utils[_0x7686('0x30')](dials[_0x11efa1['uniqueid']][_0x7686('0x31')],dials[_0x11efa1[_0x7686('0xf')]][_0x7686('0x28')]):0x0;writeDB(dials[_0x11efa1[_0x7686('0xf')]]);}}catch(_0xfc4add){utils[_0x7686('0x16')](util[_0x7686('0xb')](_0x7686('0x33'),_0x11efa1[_0x7686('0xf')]),_0xfc4add);}}; \ No newline at end of file +var _0x82c9=['[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','holdtime','billableseconds','endtime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','dialend','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup'];(function(_0x3d609b,_0xf285d){var _0x2dce8b=function(_0x2f4d8c){while(--_0x2f4d8c){_0x3d609b['push'](_0x3d609b['shift']());}};_0x2dce8b(++_0xf285d);}(_0x82c9,0xab));var _0x982c=function(_0x48edd7,_0x729f19){_0x48edd7=_0x48edd7-0x0;var _0xc27f7e=_0x82c9[_0x48edd7];return _0xc27f7e;};'use strict';var _=require(_0x982c('0x0'));var util=require(_0x982c('0x1'));var utils=require(_0x982c('0x2'));var dials={};function writeDB(_0xf270a0){utils[_0x982c('0x3')](util[_0x982c('0x4')](_0x982c('0x5'),_0xf270a0[_0x982c('0x6')],_0xf270a0[_0x982c('0x7')],_0xf270a0[_0x982c('0x8')],_0xf270a0[_0x982c('0x9')],_0xf270a0[_0x982c('0xa')],_0xf270a0[_0x982c('0xb')]));utils[_0x982c('0xc')](_0x982c('0xd'),_0xf270a0);delete dials[_0xf270a0['uniqueid']];}exports[_0x982c('0xe')]=function(_0x481e9b){try{utils[_0x982c('0xf')](util['format']('[%s][dials][newexten]',_0x481e9b[_0x982c('0x6')]),_0x481e9b);utils[_0x982c('0x3')](util[_0x982c('0x4')](_0x982c('0x10'),_0x481e9b[_0x982c('0x6')],_0x481e9b[_0x982c('0x11')],_0x481e9b[_0x982c('0x12')]));if(_0x481e9b[_0x982c('0x11')][_0x982c('0x13')]()==_0x982c('0x14')&&_[_0x982c('0x15')](_0x481e9b['appdata'][_0x982c('0x13')](),_0x982c('0x16'))){var _0x2e3705=_0x481e9b[_0x982c('0x12')][_0x982c('0x17')]('=');dials[_0x481e9b['uniqueid']]={'routeId':_0x2e3705[0x1]};}}catch(_0x35029e){utils['error'](util[_0x982c('0x4')](_0x982c('0x18'),_0x481e9b[_0x982c('0x6')]),_0x35029e);}};exports[_0x982c('0x19')]=function(_0x4eb018){try{utils[_0x982c('0xf')](util['format'](_0x982c('0x1a'),_0x4eb018[_0x982c('0x6')]),_0x4eb018);if(!_[_0x982c('0x1b')](_0x4eb018[_0x982c('0x1c')][_0x982c('0x1d')])){utils[_0x982c('0x3')](util[_0x982c('0x4')](_0x982c('0x1e'),_0x4eb018['uniqueid'],_0x4eb018[_0x982c('0x1f')]));dials[_0x4eb018[_0x982c('0x6')]]={'routeId':_0x4eb018[_0x982c('0x1f')]};}}catch(_0x11adb4){utils[_0x982c('0x20')](util[_0x982c('0x4')](_0x982c('0x1a'),_0x4eb018[_0x982c('0x6')]),_0x11adb4);}};exports['dialbegin']=function(_0x28f179){try{if(!_[_0x982c('0x1b')](dials[_0x28f179[_0x982c('0x6')]])){utils[_0x982c('0xf')](util[_0x982c('0x4')](_0x982c('0x21'),_0x28f179['uniqueid']),_0x28f179);dials[_0x28f179['uniqueid']]=_[_0x982c('0x22')](dials[_0x28f179['uniqueid']],_0x28f179);dials[_0x28f179[_0x982c('0x6')]][_0x982c('0x23')]=utils[_0x982c('0x24')]();dials[_0x28f179[_0x982c('0x6')]][_0x982c('0x25')]=_0x982c('0x26');utils[_0x982c('0x3')](util[_0x982c('0x4')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x28f179[_0x982c('0x6')],dials[_0x28f179[_0x982c('0x6')]]['starttime']));}}catch(_0x2bcc61){utils[_0x982c('0x20')](util[_0x982c('0x4')](_0x982c('0x21'),_0x28f179[_0x982c('0x6')]),_0x2bcc61);}};exports[_0x982c('0x27')]=function(_0x20fa3d){try{if(!_[_0x982c('0x1b')](dials[_0x20fa3d['uniqueid']])){utils['debug'](util[_0x982c('0x4')]('[%s][dials][dialend]',_0x20fa3d[_0x982c('0x6')]),_0x20fa3d);dials[_0x20fa3d['uniqueid']][_0x982c('0xb')]=_0x20fa3d[_0x982c('0xb')];if(_0x20fa3d[_0x982c('0xb')]==_0x982c('0x28')){dials[_0x20fa3d[_0x982c('0x6')]]=_[_0x982c('0x22')](dials[_0x20fa3d[_0x982c('0x6')]],_0x20fa3d);dials[_0x20fa3d[_0x982c('0x6')]][_0x982c('0x29')]=utils[_0x982c('0x24')]();dials[_0x20fa3d[_0x982c('0x6')]][_0x982c('0x25')]='connect';utils['info'](util['format'](_0x982c('0x2a'),_0x20fa3d['uniqueid'],_0x20fa3d[_0x982c('0xb')],dials[_0x20fa3d['uniqueid']][_0x982c('0x29')]));}else{utils[_0x982c('0x3')](util[_0x982c('0x4')](_0x982c('0x2b'),_0x20fa3d['uniqueid'],_0x20fa3d[_0x982c('0xb')]));}}}catch(_0x58fe6e){utils[_0x982c('0x20')](util['format']('[%s][dials][dialend]',_0x20fa3d[_0x982c('0x6')]),_0x58fe6e);}};exports[_0x982c('0x2c')]=function(_0x3cf8f7){try{if(!_[_0x982c('0x1b')](dials[_0x3cf8f7[_0x982c('0x6')]])){utils['debug'](util[_0x982c('0x4')](_0x982c('0x2d'),_0x3cf8f7[_0x982c('0x6')]),_0x3cf8f7);utils[_0x982c('0x3')](util[_0x982c('0x4')](_0x982c('0x2e'),_0x3cf8f7[_0x982c('0x6')],_0x3cf8f7[_0x982c('0x9')],_0x3cf8f7[_0x982c('0x2f')],_0x3cf8f7[_0x982c('0x30')]));dials[_0x3cf8f7['uniqueid']]=_[_0x982c('0x22')](dials[_0x3cf8f7[_0x982c('0x6')]],{'endtime':utils[_0x982c('0x24')](),'lastevent':'complete'});dials[_0x3cf8f7['uniqueid']][_0x982c('0x31')]=utils[_0x982c('0x32')](dials[_0x3cf8f7[_0x982c('0x6')]]['endtime'],dials[_0x3cf8f7['uniqueid']]['starttime']);dials[_0x3cf8f7[_0x982c('0x6')]][_0x982c('0x33')]=utils[_0x982c('0x32')](dials[_0x3cf8f7['uniqueid']][_0x982c('0x29')]||dials[_0x3cf8f7['uniqueid']]['endtime'],dials[_0x3cf8f7['uniqueid']]['starttime']);dials[_0x3cf8f7[_0x982c('0x6')]][_0x982c('0x34')]=dials[_0x3cf8f7[_0x982c('0x6')]][_0x982c('0x29')]?utils[_0x982c('0x32')](dials[_0x3cf8f7[_0x982c('0x6')]][_0x982c('0x35')],dials[_0x3cf8f7[_0x982c('0x6')]][_0x982c('0x29')]):0x0;writeDB(dials[_0x3cf8f7['uniqueid']]);}}catch(_0x52df41){utils[_0x982c('0x20')](util[_0x982c('0x4')](_0x982c('0x2d'),_0x3cf8f7['uniqueid']),_0x52df41);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index df25f0f..2ab42b1 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 _0x406e=['queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','util','xdr','disabled','env','production','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','devicestatechange','format','device','[%s][index][devicestatechange]','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0x406e,0xab));var _0xe406=function(_0x2d0b58,_0x153775){_0x2d0b58=_0x2d0b58-0x0;var _0x4f61b9=_0x406e[_0x2d0b58];return _0x4f61b9;};var AsteriskManager=require(_0xe406('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0xe406('0x1'));var isXDREnabled=config[_0xe406('0x2')]&&!config[_0xe406('0x2')][_0xe406('0x3')];var isProduction=config[_0xe406('0x4')]===_0xe406('0x5')||![];var isLocalAsterisk=config[_0xe406('0x2')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0xe406('0x6')][_0xe406('0x7')],config[_0xe406('0x6')]['ip'],config[_0xe406('0x6')][_0xe406('0x8')],config[_0xe406('0x6')][_0xe406('0x9')],!![]);ami[_0xe406('0xa')]();if(!isXDREnabled){utils[_0xe406('0xb')](_0xe406('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xe406('0xb')](_0xe406('0xd'));}else{var agents=require(_0xe406('0xe'));var calls=require(_0xe406('0xf'));var queues=require(_0xe406('0x10'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0xe406('0x11'));var transfers=require(_0xe406('0x12'));var core=require(_0xe406('0x13'));ami['on']('connect',core[_0xe406('0x14')]);ami['on'](_0xe406('0x15'),core[_0xe406('0x15')]);ami['on'](_0xe406('0x16'),core[_0xe406('0x16')]);ami['on'](_0xe406('0x17'),core[_0xe406('0x17')]);ami['on']('close',core[_0xe406('0x18')]);ami['on']('managerevent',core['managerevent']);ami['on'](_0xe406('0x19'),function(_0x48dc77){try{utils['debug'](util[_0xe406('0x1a')]('[%s][index][devicestatechange]',_0x48dc77[_0xe406('0x1b')]),_0x48dc77);members[_0xe406('0x19')](_0x48dc77);}catch(_0x23ebf4){utils[_0xe406('0x17')](util[_0xe406('0x1a')](_0xe406('0x1c'),_0x48dc77[_0xe406('0x1b')]),_0x23ebf4);}});ami['on'](_0xe406('0x1d'),function(_0x3899b2){try{utils[_0xe406('0x1e')](util[_0xe406('0x1a')](_0xe406('0x1f'),_0x3899b2[_0xe406('0x20')]),_0x3899b2);agents[_0xe406('0x1d')](_0x3899b2);}catch(_0x3f822b){utils['error'](util[_0xe406('0x1a')](_0xe406('0x1f'),_0x3899b2[_0xe406('0x20')]),_0x3f822b);}});ami['on'](_0xe406('0x21'),function(_0x4c414e){try{utils[_0xe406('0x1e')](util['format'](_0xe406('0x22'),_0x4c414e[_0xe406('0x20')]),_0x4c414e);agents[_0xe406('0x21')](_0x4c414e);}catch(_0xb77463){utils[_0xe406('0x17')](util[_0xe406('0x1a')](_0xe406('0x22'),_0x4c414e[_0xe406('0x20')]),_0xb77463);}});ami['on'](_0xe406('0x23'),function(_0x1ecbad){try{utils['debug'](util[_0xe406('0x1a')](_0xe406('0x24'),_0x1ecbad['uniqueid']),_0x1ecbad);agents[_0xe406('0x23')](_0x1ecbad);queues['agentconnect'](_0x1ecbad);}catch(_0x94ad70){utils[_0xe406('0x17')](util['format']('[%s][index][agentconnect]',_0x1ecbad[_0xe406('0x20')]),_0x94ad70);}});ami['on']('agentcomplete',function(_0x3f1b81){try{utils[_0xe406('0x1e')](util[_0xe406('0x1a')](_0xe406('0x25'),_0x3f1b81[_0xe406('0x20')]),_0x3f1b81);agents[_0xe406('0x26')](_0x3f1b81);queues['agentcomplete'](_0x3f1b81);members[_0xe406('0x26')](_0x3f1b81);}catch(_0x115474){utils[_0xe406('0x17')](util[_0xe406('0x1a')](_0xe406('0x25'),_0x3f1b81[_0xe406('0x20')]),_0x115474);}});ami['on'](_0xe406('0x27'),function(_0x3754da){try{utils[_0xe406('0x1e')](util['format']('[%s][index][queuecallerabandon]',_0x3754da[_0xe406('0x20')]),_0x3754da);agents[_0xe406('0x27')](_0x3754da);queues[_0xe406('0x27')](_0x3754da);}catch(_0x2c7fb2){utils[_0xe406('0x17')](util[_0xe406('0x1a')](_0xe406('0x28'),_0x3754da[_0xe406('0x20')]),_0x2c7fb2);}});ami['on']('queuecallerjoin',function(_0x85e1ad){try{utils['debug'](util[_0xe406('0x1a')]('[%s][index][queuecallerjoin]',_0x85e1ad[_0xe406('0x20')]),_0x85e1ad);queues[_0xe406('0x29')](_0x85e1ad);recordings[_0xe406('0x29')](_0x85e1ad);}catch(_0x51ff6f){utils[_0xe406('0x17')](util[_0xe406('0x1a')](_0xe406('0x2a'),_0x85e1ad[_0xe406('0x20')]),_0x51ff6f);}});ami['on']('queuecallerleave',function(_0x20640c){try{utils[_0xe406('0x1e')](util[_0xe406('0x1a')](_0xe406('0x2b'),_0x20640c[_0xe406('0x20')]),_0x20640c);queues[_0xe406('0x2c')](_0x20640c);}catch(_0x2c5678){utils['error'](util[_0xe406('0x1a')]('[%s][index][queuecallerleave]',_0x20640c[_0xe406('0x20')]),_0x2c5678);}});ami['on']('musiconholdstart',function(_0x4bed9a){try{utils['debug'](util['format'](_0xe406('0x2d'),_0x4bed9a[_0xe406('0x20')]),_0x4bed9a);queues[_0xe406('0x2e')](_0x4bed9a);calls[_0xe406('0x2e')](_0x4bed9a);}catch(_0x2460fd){utils[_0xe406('0x17')](util['format'](_0xe406('0x2d'),_0x4bed9a[_0xe406('0x20')]),_0x2460fd);}});ami['on'](_0xe406('0x2f'),function(_0x4397b7){try{utils['debug'](util[_0xe406('0x1a')](_0xe406('0x30'),_0x4397b7['uniqueid']),_0x4397b7);queues[_0xe406('0x2f')](_0x4397b7);calls[_0xe406('0x2f')](_0x4397b7);}catch(_0x1fff6f){utils['error'](util[_0xe406('0x1a')]('[%s][index][musiconholdstop]',_0x4397b7[_0xe406('0x20')]),_0x1fff6f);}});ami['on'](_0xe406('0x31'),function(_0x26fe7a){try{utils['debug'](util[_0xe406('0x1a')](_0xe406('0x32'),_0x26fe7a[_0xe406('0x20')]),_0x26fe7a);calls[_0xe406('0x31')](_0x26fe7a);recordings[_0xe406('0x31')](_0x26fe7a);}catch(_0x1b3d42){utils[_0xe406('0x17')](util['format'](_0xe406('0x32'),_0x26fe7a[_0xe406('0x20')]),_0x1b3d42);}});ami['on']('hangup',function(_0x27b2a4){try{utils['debug'](util[_0xe406('0x1a')](_0xe406('0x33'),_0x27b2a4[_0xe406('0x20')]),_0x27b2a4);calls[_0xe406('0x34')](_0x27b2a4);recordings[_0xe406('0x34')](_0x27b2a4);dials[_0xe406('0x34')](_0x27b2a4);agents[_0xe406('0x34')](_0x27b2a4);queues[_0xe406('0x34')](_0x27b2a4);}catch(_0xd3c8f9){utils['error'](util[_0xe406('0x1a')](_0xe406('0x33'),_0x27b2a4['uniqueid']),_0xd3c8f9);}});ami['on'](_0xe406('0x35'),function(_0xcd7518){try{utils[_0xe406('0x1e')](util['format']('[%s][index][cdr]',_0xcd7518[_0xe406('0x20')]),_0xcd7518);members[_0xe406('0x35')](_0xcd7518);}catch(_0x481b23){utils['error'](util[_0xe406('0x1a')](_0xe406('0x36'),_0xcd7518['uniqueid']),_0x481b23);}});ami['on']('blindtransfer',function(_0x18a34a){try{utils[_0xe406('0x1e')](util[_0xe406('0x1a')](_0xe406('0x37'),_0x18a34a[_0xe406('0x20')]),_0x18a34a);queues[_0xe406('0x38')](_0x18a34a);agents[_0xe406('0x38')](_0x18a34a);transfers['blindtransfer'](_0x18a34a);recordings[_0xe406('0x38')](_0x18a34a);}catch(_0x3dfba0){utils[_0xe406('0x17')](util['format'](_0xe406('0x37'),_0x18a34a[_0xe406('0x20')]),_0x3dfba0);}});ami['on'](_0xe406('0x39'),function(_0x6ae1aa){try{utils['debug'](util[_0xe406('0x1a')](_0xe406('0x3a'),_0x6ae1aa[_0xe406('0x3b')]),_0x6ae1aa);queues[_0xe406('0x39')](_0x6ae1aa);transfers[_0xe406('0x39')](_0x6ae1aa);agents[_0xe406('0x39')](_0x6ae1aa);calls[_0xe406('0x39')](_0x6ae1aa);}catch(_0x98a80f){utils[_0xe406('0x17')](util[_0xe406('0x1a')](_0xe406('0x3a'),_0x6ae1aa[_0xe406('0x3b')]),_0x98a80f);}});ami['on']('varset',function(_0x36f5d0){try{utils[_0xe406('0x1e')](util[_0xe406('0x1a')](_0xe406('0x3c'),_0x36f5d0['uniqueid']),_0x36f5d0);queues[_0xe406('0x3d')](_0x36f5d0);recordings['varset'](_0x36f5d0);calls[_0xe406('0x3d')](_0x36f5d0);dials[_0xe406('0x3d')](_0x36f5d0);}catch(_0x19cfeb){utils[_0xe406('0x17')](util[_0xe406('0x1a')]('[%s][index][varset]',_0x36f5d0['uniqueid']),_0x19cfeb);}});ami['on'](_0xe406('0x3e'),function(_0x10ae5f){try{utils[_0xe406('0x1e')](util[_0xe406('0x1a')](_0xe406('0x3f'),_0x10ae5f['uniqueid']),_0x10ae5f);calls[_0xe406('0x3e')](_0x10ae5f);recordings[_0xe406('0x3e')](_0x10ae5f);dials['newexten'](_0x10ae5f);}catch(_0x48577e){utils[_0xe406('0x17')](util[_0xe406('0x1a')](_0xe406('0x3f'),_0x10ae5f['uniqueid']),_0x48577e);}});ami['on'](_0xe406('0x40'),function(_0x3303d3){try{utils[_0xe406('0x1e')](util[_0xe406('0x1a')](_0xe406('0x41'),_0x3303d3[_0xe406('0x20')]),_0x3303d3);calls['newchannel'](_0x3303d3);recordings[_0xe406('0x40')](_0x3303d3);}catch(_0x19c57){utils[_0xe406('0x17')](util[_0xe406('0x1a')](_0xe406('0x41'),_0x3303d3[_0xe406('0x20')]),_0x19c57);}});ami['on']('dialbegin',function(_0x592889){try{utils[_0xe406('0x1e')](util[_0xe406('0x1a')]('[%s][index][dialbegin]',_0x592889[_0xe406('0x20')]),_0x592889);dials[_0xe406('0x42')](_0x592889);}catch(_0x43821d){utils['error'](util[_0xe406('0x1a')](_0xe406('0x43'),_0x592889[_0xe406('0x20')]),_0x43821d);}});ami['on']('dialend',function(_0x2e5699){try{utils[_0xe406('0x1e')](util[_0xe406('0x1a')](_0xe406('0x44'),_0x2e5699[_0xe406('0x20')]),_0x2e5699);dials[_0xe406('0x45')](_0x2e5699);}catch(_0x6685d4){utils[_0xe406('0x17')](util[_0xe406('0x1a')](_0xe406('0x44'),_0x2e5699[_0xe406('0x20')]),_0x6685d4);}});} \ No newline at end of file +var _0x7c22=['format','[%s][index][devicestatechange]','device','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','env','asterisk','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange'];(function(_0x204789,_0x2e6e57){var _0x2dded7=function(_0x2aa3af){while(--_0x2aa3af){_0x204789['push'](_0x204789['shift']());}};_0x2dded7(++_0x2e6e57);}(_0x7c22,0x6c));var _0x27c2=function(_0x245efb,_0x2620bc){_0x245efb=_0x245efb-0x0;var _0x3a57e9=_0x7c22[_0x245efb];return _0x3a57e9;};var AsteriskManager=require(_0x27c2('0x0'));var config=require(_0x27c2('0x1'));var utils=require('./utils');var util=require(_0x27c2('0x2'));var isXDREnabled=config[_0x27c2('0x3')]&&!config['xdr'][_0x27c2('0x4')];var isProduction=config[_0x27c2('0x5')]==='production'||![];var isLocalAsterisk=config['xdr']&&config[_0x27c2('0x3')]['local']===!![]||![];var ami=new AsteriskManager(config[_0x27c2('0x6')]['port'],config[_0x27c2('0x6')]['ip'],config[_0x27c2('0x6')]['username'],config[_0x27c2('0x6')][_0x27c2('0x7')],!![]);ami[_0x27c2('0x8')]();if(!isXDREnabled){utils[_0x27c2('0x9')](_0x27c2('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x27c2('0xb'));var calls=require(_0x27c2('0xc'));var queues=require(_0x27c2('0xd'));var recordings=require(_0x27c2('0xe'));var members=require('./members.controller');var dials=require(_0x27c2('0xf'));var transfers=require(_0x27c2('0x10'));var core=require(_0x27c2('0x11'));ami['on']('connect',core['connect']);ami['on'](_0x27c2('0x12'),core[_0x27c2('0x12')]);ami['on'](_0x27c2('0x13'),core[_0x27c2('0x13')]);ami['on'](_0x27c2('0x14'),core['error']);ami['on'](_0x27c2('0x15'),core['close']);ami['on'](_0x27c2('0x16'),core[_0x27c2('0x16')]);ami['on'](_0x27c2('0x17'),function(_0x2e2193){try{utils['debug'](util[_0x27c2('0x18')](_0x27c2('0x19'),_0x2e2193[_0x27c2('0x1a')]),_0x2e2193);members[_0x27c2('0x17')](_0x2e2193);}catch(_0x3cd844){utils[_0x27c2('0x14')](util[_0x27c2('0x18')](_0x27c2('0x19'),_0x2e2193[_0x27c2('0x1a')]),_0x3cd844);}});ami['on']('agentcalled',function(_0x1d122c){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')](_0x27c2('0x1c'),_0x1d122c['uniqueid']),_0x1d122c);agents['agentcalled'](_0x1d122c);}catch(_0x1e0f77){utils[_0x27c2('0x14')](util[_0x27c2('0x18')](_0x27c2('0x1c'),_0x1d122c[_0x27c2('0x1d')]),_0x1e0f77);}});ami['on'](_0x27c2('0x1e'),function(_0x49c307){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')](_0x27c2('0x1f'),_0x49c307[_0x27c2('0x1d')]),_0x49c307);agents[_0x27c2('0x1e')](_0x49c307);}catch(_0x307f6c){utils[_0x27c2('0x14')](util[_0x27c2('0x18')]('[%s][index][agentringnoanswer]',_0x49c307['uniqueid']),_0x307f6c);}});ami['on'](_0x27c2('0x20'),function(_0x185f26){try{utils['debug'](util[_0x27c2('0x18')](_0x27c2('0x21'),_0x185f26[_0x27c2('0x1d')]),_0x185f26);agents[_0x27c2('0x20')](_0x185f26);queues['agentconnect'](_0x185f26);}catch(_0x3e7563){utils[_0x27c2('0x14')](util[_0x27c2('0x18')](_0x27c2('0x21'),_0x185f26[_0x27c2('0x1d')]),_0x3e7563);}});ami['on'](_0x27c2('0x22'),function(_0x25aa9e){try{utils[_0x27c2('0x1b')](util['format'](_0x27c2('0x23'),_0x25aa9e[_0x27c2('0x1d')]),_0x25aa9e);agents[_0x27c2('0x22')](_0x25aa9e);queues['agentcomplete'](_0x25aa9e);members[_0x27c2('0x22')](_0x25aa9e);}catch(_0x34cf90){utils[_0x27c2('0x14')](util['format'](_0x27c2('0x23'),_0x25aa9e[_0x27c2('0x1d')]),_0x34cf90);}});ami['on'](_0x27c2('0x24'),function(_0x16636a){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')]('[%s][index][queuecallerabandon]',_0x16636a[_0x27c2('0x1d')]),_0x16636a);agents[_0x27c2('0x24')](_0x16636a);queues[_0x27c2('0x24')](_0x16636a);}catch(_0x524de2){utils[_0x27c2('0x14')](util[_0x27c2('0x18')](_0x27c2('0x25'),_0x16636a[_0x27c2('0x1d')]),_0x524de2);}});ami['on']('queuecallerjoin',function(_0x6b6f58){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')](_0x27c2('0x26'),_0x6b6f58[_0x27c2('0x1d')]),_0x6b6f58);queues[_0x27c2('0x27')](_0x6b6f58);recordings[_0x27c2('0x27')](_0x6b6f58);}catch(_0x131027){utils[_0x27c2('0x14')](util['format'](_0x27c2('0x26'),_0x6b6f58[_0x27c2('0x1d')]),_0x131027);}});ami['on'](_0x27c2('0x28'),function(_0x143e39){try{utils[_0x27c2('0x1b')](util['format'](_0x27c2('0x29'),_0x143e39[_0x27c2('0x1d')]),_0x143e39);queues[_0x27c2('0x28')](_0x143e39);}catch(_0x11f61b){utils['error'](util[_0x27c2('0x18')](_0x27c2('0x29'),_0x143e39[_0x27c2('0x1d')]),_0x11f61b);}});ami['on'](_0x27c2('0x2a'),function(_0x236b13){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')]('[%s][index][musiconholdstart]',_0x236b13[_0x27c2('0x1d')]),_0x236b13);queues[_0x27c2('0x2a')](_0x236b13);calls['musiconholdstart'](_0x236b13);}catch(_0x3a75fc){utils[_0x27c2('0x14')](util[_0x27c2('0x18')]('[%s][index][musiconholdstart]',_0x236b13[_0x27c2('0x1d')]),_0x3a75fc);}});ami['on'](_0x27c2('0x2b'),function(_0x1102c0){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')]('[%s][index][musiconholdstop]',_0x1102c0[_0x27c2('0x1d')]),_0x1102c0);queues['musiconholdstop'](_0x1102c0);calls[_0x27c2('0x2b')](_0x1102c0);}catch(_0x220562){utils[_0x27c2('0x14')](util[_0x27c2('0x18')](_0x27c2('0x2c'),_0x1102c0[_0x27c2('0x1d')]),_0x220562);}});ami['on']('newstate',function(_0x19f1d6){try{utils[_0x27c2('0x1b')](util['format'](_0x27c2('0x2d'),_0x19f1d6[_0x27c2('0x1d')]),_0x19f1d6);calls['newstate'](_0x19f1d6);recordings[_0x27c2('0x2e')](_0x19f1d6);}catch(_0x75ad52){utils['error'](util[_0x27c2('0x18')](_0x27c2('0x2d'),_0x19f1d6[_0x27c2('0x1d')]),_0x75ad52);}});ami['on']('hangup',function(_0x32b088){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')](_0x27c2('0x2f'),_0x32b088[_0x27c2('0x1d')]),_0x32b088);calls[_0x27c2('0x30')](_0x32b088);recordings['hangup'](_0x32b088);dials['hangup'](_0x32b088);agents[_0x27c2('0x30')](_0x32b088);queues[_0x27c2('0x30')](_0x32b088);}catch(_0x180feb){utils[_0x27c2('0x14')](util['format'](_0x27c2('0x2f'),_0x32b088[_0x27c2('0x1d')]),_0x180feb);}});ami['on'](_0x27c2('0x31'),function(_0x173ff1){try{utils['debug'](util[_0x27c2('0x18')](_0x27c2('0x32'),_0x173ff1[_0x27c2('0x1d')]),_0x173ff1);members['cdr'](_0x173ff1);}catch(_0x48fcc7){utils[_0x27c2('0x14')](util['format'](_0x27c2('0x32'),_0x173ff1[_0x27c2('0x1d')]),_0x48fcc7);}});ami['on'](_0x27c2('0x33'),function(_0x3c463c){try{utils[_0x27c2('0x1b')](util['format']('[%s][index][blindtransfer]',_0x3c463c[_0x27c2('0x1d')]),_0x3c463c);queues[_0x27c2('0x33')](_0x3c463c);agents[_0x27c2('0x33')](_0x3c463c);transfers[_0x27c2('0x33')](_0x3c463c);recordings[_0x27c2('0x33')](_0x3c463c);}catch(_0x4bba6f){utils['error'](util[_0x27c2('0x18')](_0x27c2('0x34'),_0x3c463c[_0x27c2('0x1d')]),_0x4bba6f);}});ami['on'](_0x27c2('0x35'),function(_0x3c6e71){try{utils['debug'](util[_0x27c2('0x18')](_0x27c2('0x36'),_0x3c6e71[_0x27c2('0x37')]),_0x3c6e71);queues[_0x27c2('0x35')](_0x3c6e71);transfers[_0x27c2('0x35')](_0x3c6e71);agents[_0x27c2('0x35')](_0x3c6e71);calls['attendedtransfer'](_0x3c6e71);}catch(_0x37927d){utils[_0x27c2('0x14')](util[_0x27c2('0x18')]('[%s][index][attendedtransfer]',_0x3c6e71[_0x27c2('0x37')]),_0x37927d);}});ami['on'](_0x27c2('0x38'),function(_0x1eaea9){try{utils['debug'](util[_0x27c2('0x18')](_0x27c2('0x39'),_0x1eaea9[_0x27c2('0x1d')]),_0x1eaea9);queues[_0x27c2('0x38')](_0x1eaea9);recordings[_0x27c2('0x38')](_0x1eaea9);calls[_0x27c2('0x38')](_0x1eaea9);dials[_0x27c2('0x38')](_0x1eaea9);}catch(_0x30c55d){utils['error'](util[_0x27c2('0x18')](_0x27c2('0x39'),_0x1eaea9['uniqueid']),_0x30c55d);}});ami['on'](_0x27c2('0x3a'),function(_0x26057e){try{utils[_0x27c2('0x1b')](util['format'](_0x27c2('0x3b'),_0x26057e[_0x27c2('0x1d')]),_0x26057e);calls[_0x27c2('0x3a')](_0x26057e);recordings[_0x27c2('0x3a')](_0x26057e);dials[_0x27c2('0x3a')](_0x26057e);}catch(_0x5924cd){utils['error'](util[_0x27c2('0x18')]('[%s][index][newexten]',_0x26057e[_0x27c2('0x1d')]),_0x5924cd);}});ami['on'](_0x27c2('0x3c'),function(_0x393f96){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')](_0x27c2('0x3d'),_0x393f96[_0x27c2('0x1d')]),_0x393f96);calls[_0x27c2('0x3c')](_0x393f96);recordings['newchannel'](_0x393f96);}catch(_0x2a716c){utils[_0x27c2('0x14')](util['format']('[%s][index][newchannel]',_0x393f96['uniqueid']),_0x2a716c);}});ami['on']('dialbegin',function(_0x17c131){try{utils[_0x27c2('0x1b')](util[_0x27c2('0x18')]('[%s][index][dialbegin]',_0x17c131[_0x27c2('0x1d')]),_0x17c131);dials[_0x27c2('0x3e')](_0x17c131);}catch(_0x5b4650){utils[_0x27c2('0x14')](util[_0x27c2('0x18')](_0x27c2('0x3f'),_0x17c131[_0x27c2('0x1d')]),_0x5b4650);}});ami['on'](_0x27c2('0x40'),function(_0x565131){try{utils[_0x27c2('0x1b')](util['format'](_0x27c2('0x41'),_0x565131[_0x27c2('0x1d')]),_0x565131);dials[_0x27c2('0x40')](_0x565131);}catch(_0x42716b){utils[_0x27c2('0x14')](util[_0x27c2('0x18')](_0x27c2('0x41'),_0x565131[_0x27c2('0x1d')]),_0x42716b);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index fdb6679..dcc4bfd 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 _0x7cca=['exitAt','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','lodash','util','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','error','[%s][members][writeDB]','some','devicestatechange','debug','[%s][members][devicestatechange]','device','state','INUSE','now','agent','isNil'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x7cca,0xff));var _0xa7cc=function(_0x403d28,_0x463ef7){_0x403d28=_0x403d28-0x0;var _0x598b05=_0x7cca[_0x403d28];return _0x598b05;};'use strict';var _=require(_0xa7cc('0x0'));var util=require(_0xa7cc('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer',_0xa7cc('0x2')];function writeDB(_0x23850f){utils[_0xa7cc('0x3')](util[_0xa7cc('0x4')](_0xa7cc('0x5'),_0x23850f[_0xa7cc('0x6')],_0x23850f[_0xa7cc('0x7')],_0x23850f[_0xa7cc('0x8')],_0x23850f[_0xa7cc('0x9')],_0x23850f[_0xa7cc('0xa')],_0x23850f[_0xa7cc('0xb')]));if(_0x23850f[_0xa7cc('0x7')]){utils[_0xa7cc('0xc')](_0x23850f[_0xa7cc('0x7')])[_0xa7cc('0xd')](function(_0x3b82d2){if(_0x3b82d2){_0x23850f[_0xa7cc('0xa')]=_0x3b82d2[_0xa7cc('0xe')];_0x23850f['internal']=_0x3b82d2[_0xa7cc('0xf')];utils[_0xa7cc('0x10')]('CreateMemberReport',_0x23850f);}else{utils[_0xa7cc('0x11')](_0x23850f[_0xa7cc('0x7')][_0xa7cc('0x12')]('/')[0x1])['then'](function(_0x5799f7){if(_0x5799f7){_0x23850f[_0xa7cc('0xa')]=_0x5799f7[_0xa7cc('0xe')];_0x23850f[_0xa7cc('0xf')]=_0x5799f7[_0xa7cc('0xf')];utils['request'](_0xa7cc('0x13'),_0x23850f);}});}})[_0xa7cc('0x14')](function(_0x529c96){utils[_0xa7cc('0x15')](util[_0xa7cc('0x4')](_0xa7cc('0x16'),_0x23850f['uniqueid']),_0x529c96);});}delete members[_0x23850f[_0xa7cc('0x7')]];}function startsWith(_0x176ac7,_0x590ced){return _[_0xa7cc('0x17')](_0x176ac7,function(_0x255949){return _['startsWith'](_0x590ced,_0x255949);});}exports[_0xa7cc('0x18')]=function(_0x2c4c93){try{utils[_0xa7cc('0x19')](util[_0xa7cc('0x4')](_0xa7cc('0x1a'),members[_0x2c4c93[_0xa7cc('0x1b')]]?members[_0x2c4c93[_0xa7cc('0x1b')]][_0xa7cc('0x6')]:_0x2c4c93[_0xa7cc('0x1b')]),_0x2c4c93);utils[_0xa7cc('0x3')](util[_0xa7cc('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x2c4c93[_0xa7cc('0x1b')]]?members[_0x2c4c93[_0xa7cc('0x1b')]]['uniqueid']:_0x2c4c93['device'],_0x2c4c93[_0xa7cc('0x1c')],_0x2c4c93[_0xa7cc('0x1b')]));switch(_0x2c4c93[_0xa7cc('0x1c')]){case _0xa7cc('0x1d'):case'BUSY':if(!startsWith(exclude,_0x2c4c93[_0xa7cc('0x1b')])){members[_0x2c4c93['device']]={'channel':'voice','interface':_0x2c4c93[_0xa7cc('0x1b')],'type':'TALKING','enterAt':utils[_0xa7cc('0x1e')](),'role':_0xa7cc('0x1f')};}break;case'NOT_INUSE':if(!_[_0xa7cc('0x20')](members[_0x2c4c93[_0xa7cc('0x1b')]])){members[_0x2c4c93[_0xa7cc('0x1b')]][_0xa7cc('0x21')]=utils[_0xa7cc('0x1e')]();members[_0x2c4c93[_0xa7cc('0x1b')]]['duration']=utils['diffTime'](members[_0x2c4c93[_0xa7cc('0x1b')]]['exitAt'],members[_0x2c4c93[_0xa7cc('0x1b')]][_0xa7cc('0x22')]);if(members[_0x2c4c93['device']]['uniqueid']){writeDB(members[_0x2c4c93[_0xa7cc('0x1b')]]);}}break;default:break;}}catch(_0x34017b){utils[_0xa7cc('0x15')](util['format']('[%s][members][devicestatechange]',members[_0x2c4c93[_0xa7cc('0x1b')]]?members[_0x2c4c93['device']][_0xa7cc('0x6')]:_0x2c4c93['device']),_0x34017b);}};exports[_0xa7cc('0x23')]=function(_0x4c8c4f){try{if(!_[_0xa7cc('0x20')](members[_0x4c8c4f[_0xa7cc('0x7')]])){utils['debug'](util['format'](_0xa7cc('0x24'),_0x4c8c4f[_0xa7cc('0x6')]),_0x4c8c4f);utils['info'](util[_0xa7cc('0x4')](_0xa7cc('0x25'),_0x4c8c4f[_0xa7cc('0x6')],_0x4c8c4f[_0xa7cc('0x7')],_0x4c8c4f[_0xa7cc('0x26')]));members[_0x4c8c4f['interface']]=_[_0xa7cc('0x27')](members[_0x4c8c4f[_0xa7cc('0x7')]],{'data4':_0x4c8c4f[_0xa7cc('0x26')],'uniqueid':_0x4c8c4f[_0xa7cc('0x6')]});}}catch(_0x1efb6c){utils[_0xa7cc('0x15')](util[_0xa7cc('0x4')]('[%s][members][agentcomplete]',_0x4c8c4f[_0xa7cc('0x6')]),_0x1efb6c);}};exports[_0xa7cc('0x28')]=function(_0x319ec0){try{utils[_0xa7cc('0x19')](util['format']('[%s][members][cdr]',_0x319ec0[_0xa7cc('0x6')]),_0x319ec0);if(_0x319ec0[_0xa7cc('0x8')]){var _0x4f0eeb=_0x319ec0['channel']['split']('-')[0x0];if(!_['isNil'](members[_0x4f0eeb])){members[_0x4f0eeb]=_[_0xa7cc('0x27')](members[_0x4f0eeb],{'data1':members[_0x4f0eeb][_0xa7cc('0x29')]||_0x319ec0['type'],'data2':members[_0x4f0eeb]['data2']||_0x319ec0[_0xa7cc('0x2a')],'data3':members[_0x4f0eeb][_0xa7cc('0x2b')]||_0x319ec0[_0xa7cc('0x2c')],'uniqueid':members[_0x4f0eeb]['uniqueid']||_0x319ec0['uniqueid']});utils[_0xa7cc('0x3')](util['format'](_0xa7cc('0x2d'),_0x319ec0[_0xa7cc('0x6')],members[_0x4f0eeb][_0xa7cc('0x29')],members[_0x4f0eeb][_0xa7cc('0x9')],members[_0x4f0eeb][_0xa7cc('0x2b')]));if(members[_0x4f0eeb]['exitAt']){writeDB(members[_0x4f0eeb]);}}}if(_0x319ec0['destinationchannel']){var _0x14acdf=_0x319ec0[_0xa7cc('0x2e')][_0xa7cc('0x12')]('-')[0x0];if(!_[_0xa7cc('0x20')](members[_0x14acdf])){members[_0x14acdf]=_['assign'](members[_0x14acdf],{'data1':members[_0x14acdf][_0xa7cc('0x29')]||_0x319ec0[_0xa7cc('0xb')],'data2':members[_0x14acdf][_0xa7cc('0x9')]||_0x319ec0['source'],'data3':members[_0x14acdf][_0xa7cc('0x2b')]||_0x319ec0[_0xa7cc('0x2c')],'uniqueid':members[_0x14acdf][_0xa7cc('0x6')]||_0x319ec0[_0xa7cc('0x6')]});utils['info'](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x319ec0[_0xa7cc('0x6')],members[_0x14acdf][_0xa7cc('0x29')],members[_0x14acdf][_0xa7cc('0x9')],members[_0x14acdf][_0xa7cc('0x2b')]));if(members[_0x14acdf]['exitAt']){writeDB(members[_0x14acdf]);}}}}catch(_0x1baef5){utils['error'](util[_0xa7cc('0x4')](_0xa7cc('0x2f'),_0x319ec0[_0xa7cc('0x6')]),_0x1baef5);}}; \ No newline at end of file +var _0x6484=['split','internal','request','catch','error','some','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','agent','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','data2','source','data3','data1','destinationchannel','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','[%s][members][cdr]','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','channel','membername','type','getUserByInterface','then','name','CreateMemberReport','getUserByName'];(function(_0x15251b,_0x1f22f0){var _0x181da3=function(_0x40600a){while(--_0x40600a){_0x15251b['push'](_0x15251b['shift']());}};_0x181da3(++_0x1f22f0);}(_0x6484,0x1bb));var _0x4648=function(_0x4e291e,_0x29e98a){_0x4e291e=_0x4e291e-0x0;var _0x25a005=_0x6484[_0x4e291e];return _0x25a005;};'use strict';var _=require('lodash');var util=require(_0x4648('0x0'));var utils=require(_0x4648('0x1'));var members={};var exclude=[_0x4648('0x2'),_0x4648('0x3')];function writeDB(_0x5393c3){utils[_0x4648('0x4')](util[_0x4648('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x5393c3[_0x4648('0x6')],_0x5393c3[_0x4648('0x7')],_0x5393c3[_0x4648('0x8')],_0x5393c3['data2'],_0x5393c3[_0x4648('0x9')],_0x5393c3[_0x4648('0xa')]));if(_0x5393c3[_0x4648('0x7')]){utils[_0x4648('0xb')](_0x5393c3[_0x4648('0x7')])[_0x4648('0xc')](function(_0x27d81b){if(_0x27d81b){_0x5393c3[_0x4648('0x9')]=_0x27d81b[_0x4648('0xd')];_0x5393c3['internal']=_0x27d81b['internal'];utils['request'](_0x4648('0xe'),_0x5393c3);}else{utils[_0x4648('0xf')](_0x5393c3[_0x4648('0x7')][_0x4648('0x10')]('/')[0x1])[_0x4648('0xc')](function(_0x2ff516){if(_0x2ff516){_0x5393c3[_0x4648('0x9')]=_0x2ff516[_0x4648('0xd')];_0x5393c3[_0x4648('0x11')]=_0x2ff516[_0x4648('0x11')];utils[_0x4648('0x12')](_0x4648('0xe'),_0x5393c3);}});}})[_0x4648('0x13')](function(_0x5bd3ef){utils[_0x4648('0x14')](util['format']('[%s][members][writeDB]',_0x5393c3[_0x4648('0x6')]),_0x5bd3ef);});}delete members[_0x5393c3[_0x4648('0x7')]];}function startsWith(_0x230dab,_0x43866f){return _[_0x4648('0x15')](_0x230dab,function(_0x1784eb){return _['startsWith'](_0x43866f,_0x1784eb);});}exports[_0x4648('0x16')]=function(_0x2e3adc){try{utils['debug'](util[_0x4648('0x5')](_0x4648('0x17'),members[_0x2e3adc[_0x4648('0x18')]]?members[_0x2e3adc['device']][_0x4648('0x6')]:_0x2e3adc['device']),_0x2e3adc);utils[_0x4648('0x4')](util[_0x4648('0x5')](_0x4648('0x19'),members[_0x2e3adc['device']]?members[_0x2e3adc[_0x4648('0x18')]]['uniqueid']:_0x2e3adc[_0x4648('0x18')],_0x2e3adc['state'],_0x2e3adc[_0x4648('0x18')]));switch(_0x2e3adc[_0x4648('0x1a')]){case _0x4648('0x1b'):case _0x4648('0x1c'):if(!startsWith(exclude,_0x2e3adc[_0x4648('0x18')])){members[_0x2e3adc[_0x4648('0x18')]]={'channel':_0x4648('0x1d'),'interface':_0x2e3adc[_0x4648('0x18')],'type':'TALKING','enterAt':utils[_0x4648('0x1e')](),'role':_0x4648('0x1f')};}break;case'NOT_INUSE':if(!_[_0x4648('0x20')](members[_0x2e3adc['device']])){members[_0x2e3adc[_0x4648('0x18')]][_0x4648('0x21')]=utils[_0x4648('0x1e')]();members[_0x2e3adc[_0x4648('0x18')]][_0x4648('0x22')]=utils[_0x4648('0x23')](members[_0x2e3adc[_0x4648('0x18')]][_0x4648('0x21')],members[_0x2e3adc[_0x4648('0x18')]][_0x4648('0x24')]);if(members[_0x2e3adc[_0x4648('0x18')]][_0x4648('0x6')]){writeDB(members[_0x2e3adc[_0x4648('0x18')]]);}}break;default:break;}}catch(_0x38075e){utils[_0x4648('0x14')](util[_0x4648('0x5')]('[%s][members][devicestatechange]',members[_0x2e3adc[_0x4648('0x18')]]?members[_0x2e3adc[_0x4648('0x18')]][_0x4648('0x6')]:_0x2e3adc[_0x4648('0x18')]),_0x38075e);}};exports[_0x4648('0x25')]=function(_0x17ca8b){try{if(!_['isNil'](members[_0x17ca8b['interface']])){utils[_0x4648('0x26')](util[_0x4648('0x5')](_0x4648('0x27'),_0x17ca8b[_0x4648('0x6')]),_0x17ca8b);utils[_0x4648('0x4')](util[_0x4648('0x5')](_0x4648('0x28'),_0x17ca8b['uniqueid'],_0x17ca8b[_0x4648('0x7')],_0x17ca8b[_0x4648('0x29')]));members[_0x17ca8b[_0x4648('0x7')]]=_['assign'](members[_0x17ca8b[_0x4648('0x7')]],{'data4':_0x17ca8b['queue'],'uniqueid':_0x17ca8b[_0x4648('0x6')]});}}catch(_0x312204){utils[_0x4648('0x14')](util['format'](_0x4648('0x27'),_0x17ca8b['uniqueid']),_0x312204);}};exports['cdr']=function(_0xcf4c8b){try{utils['debug'](util[_0x4648('0x5')]('[%s][members][cdr]',_0xcf4c8b[_0x4648('0x6')]),_0xcf4c8b);if(_0xcf4c8b[_0x4648('0x8')]){var _0x369ca6=_0xcf4c8b[_0x4648('0x8')][_0x4648('0x10')]('-')[0x0];if(!_['isNil'](members[_0x369ca6])){members[_0x369ca6]=_[_0x4648('0x2a')](members[_0x369ca6],{'data1':members[_0x369ca6]['data1']||_0xcf4c8b[_0x4648('0xa')],'data2':members[_0x369ca6][_0x4648('0x2b')]||_0xcf4c8b[_0x4648('0x2c')],'data3':members[_0x369ca6][_0x4648('0x2d')]||_0xcf4c8b['destination'],'uniqueid':members[_0x369ca6][_0x4648('0x6')]||_0xcf4c8b[_0x4648('0x6')]});utils['info'](util[_0x4648('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xcf4c8b[_0x4648('0x6')],members[_0x369ca6][_0x4648('0x2e')],members[_0x369ca6][_0x4648('0x2b')],members[_0x369ca6][_0x4648('0x2d')]));if(members[_0x369ca6][_0x4648('0x21')]){writeDB(members[_0x369ca6]);}}}if(_0xcf4c8b[_0x4648('0x2f')]){var _0x5d20b9=_0xcf4c8b[_0x4648('0x2f')][_0x4648('0x10')]('-')[0x0];if(!_[_0x4648('0x20')](members[_0x5d20b9])){members[_0x5d20b9]=_['assign'](members[_0x5d20b9],{'data1':members[_0x5d20b9]['data1']||_0xcf4c8b[_0x4648('0xa')],'data2':members[_0x5d20b9][_0x4648('0x2b')]||_0xcf4c8b[_0x4648('0x2c')],'data3':members[_0x5d20b9][_0x4648('0x2d')]||_0xcf4c8b[_0x4648('0x30')],'uniqueid':members[_0x5d20b9]['uniqueid']||_0xcf4c8b[_0x4648('0x6')]});utils[_0x4648('0x4')](util[_0x4648('0x5')](_0x4648('0x31'),_0xcf4c8b[_0x4648('0x6')],members[_0x5d20b9]['data1'],members[_0x5d20b9][_0x4648('0x2b')],members[_0x5d20b9][_0x4648('0x2d')]));if(members[_0x5d20b9][_0x4648('0x21')]){writeDB(members[_0x5d20b9]);}}}}catch(_0x33a5e2){utils[_0x4648('0x14')](util[_0x4648('0x5')](_0x4648('0x32'),_0xcf4c8b[_0x4648('0x6')]),_0x33a5e2);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index ec23499..f1785e4 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 _0x3341=['isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]','varset','debug','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','now','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','secondtransfererlinkedid','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','queuecallerenterreason','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','calleridnum','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','accountcode','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','[%s][queues][queuecallerjoin]','hangup'];(function(_0x9d5b3a,_0x3d7cca){var _0x185ec6=function(_0x9b9021){while(--_0x9b9021){_0x9d5b3a['push'](_0x9d5b3a['shift']());}};_0x185ec6(++_0x3d7cca);}(_0x3341,0x193));var _0x1334=function(_0xc4d6d4,_0x5cf684){_0xc4d6d4=_0xc4d6d4-0x0;var _0xf62f02=_0x3341[_0xc4d6d4];return _0xf62f02;};'use strict';var _=require(_0x1334('0x0'));var util=require('util');var utils=require(_0x1334('0x1'));var queues={};function writeDB(_0x3c4fe){utils[_0x1334('0x2')](util[_0x1334('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x3c4fe[_0x1334('0x4')],_0x3c4fe[_0x1334('0x5')],_0x3c4fe[_0x1334('0x6')],_0x3c4fe[_0x1334('0x7')],_0x3c4fe['calleridnum'],_0x3c4fe[_0x1334('0x8')],_0x3c4fe['queuecallerexitreason']));if(_0x3c4fe[_0x1334('0x6')]){utils['getVoiceQueueByName'](_0x3c4fe[_0x1334('0x6')])[_0x1334('0x9')](function(_0x1009f6){if(_0x1009f6){_0x3c4fe[_0x1334('0xa')]=_0x1009f6['type'];}utils['request'](_0x1334('0xb'),_0x3c4fe);});}else{utils[_0x1334('0xc')](_0x1334('0xb'),_0x3c4fe);}if(_0x3c4fe['transfereduniqueid']){delete queues[_0x3c4fe[_0x1334('0xd')]];}else{delete queues[_0x3c4fe[_0x1334('0x4')]];}}exports[_0x1334('0xe')]=function(_0x476e21){try{utils['debug'](util['format']('[%s][queues][queuecallerjoin]',_0x476e21['uniqueid']),_0x476e21);utils[_0x1334('0x2')](util[_0x1334('0x3')](_0x1334('0xf'),_0x476e21['uniqueid'],_0x476e21[_0x1334('0x6')],_0x476e21[_0x1334('0x10')]));queues[_0x476e21[_0x1334('0x4')]]=_[_0x1334('0x11')](_0x476e21,{'originalposition':_0x476e21[_0x1334('0x10')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x566f1c){utils[_0x1334('0x12')](util[_0x1334('0x3')](_0x1334('0x13'),_0x476e21[_0x1334('0x4')]),_0x566f1c);}};exports[_0x1334('0x14')]=function(_0x5f3bc8){try{if(!_[_0x1334('0x15')](queues[_0x5f3bc8[_0x1334('0x4')]])){utils['debug'](util[_0x1334('0x3')]('[%s][queues][hangup]',_0x5f3bc8[_0x1334('0x4')]),_0x5f3bc8);if(queues[_0x5f3bc8['uniqueid']][_0x1334('0x16')]){if(!queues[_0x5f3bc8['uniqueid']][_0x1334('0x17')]&&!queues[_0x5f3bc8[_0x1334('0x4')]][_0x1334('0x18')]){queues[_0x5f3bc8['uniqueid']]['queuecallercomplete']=!![];queues[_0x5f3bc8[_0x1334('0x4')]][_0x1334('0x19')]=utils['now']();queues[_0x5f3bc8[_0x1334('0x4')]][_0x1334('0x1a')]=_0x1334('0x1b');}utils[_0x1334('0x2')](util[_0x1334('0x3')](_0x1334('0x1c'),_0x5f3bc8['uniqueid'],queues[_0x5f3bc8[_0x1334('0x4')]][_0x1334('0x1d')],queues[_0x5f3bc8[_0x1334('0x4')]][_0x1334('0x1a')]));writeDB(queues[_0x5f3bc8[_0x1334('0x4')]]);}else if(queues[_0x5f3bc8[_0x1334('0x4')]][_0x1334('0xd')]){utils[_0x1334('0x2')](util[_0x1334('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x5f3bc8[_0x1334('0x4')],queues[_0x5f3bc8[_0x1334('0x4')]]['name'],queues[_0x5f3bc8[_0x1334('0x4')]]['transfereduniqueid']));queues[queues[_0x5f3bc8['uniqueid']][_0x1334('0xd')]]=queues[_0x5f3bc8['uniqueid']];queues[queues[_0x5f3bc8['uniqueid']]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x5f3bc8['uniqueid']];}}}catch(_0x454822){utils[_0x1334('0x12')](util[_0x1334('0x3')](_0x1334('0x1e'),_0x5f3bc8[_0x1334('0x4')]),_0x454822);}};exports[_0x1334('0x1f')]=function(_0x55f494){try{utils[_0x1334('0x20')](util[_0x1334('0x3')](_0x1334('0x21'),_0x55f494[_0x1334('0x4')]),_0x55f494);if(!_['isNil'](_0x55f494[_0x1334('0x22')][_0x1334('0x23')])&&_0x55f494[_0x1334('0x24')]['toUpperCase']()!==_0x1334('0x25')){if(!_[_0x1334('0x15')](queues[_0x55f494[_0x1334('0x4')]])){queues[_0x55f494[_0x1334('0x4')]][_0x1334('0x17')]=![];queues[_0x55f494[_0x1334('0x4')]]['queuecallerabandonAt']=null;queues[_0x55f494[_0x1334('0x4')]][_0x1334('0x18')]=!![];queues[_0x55f494[_0x1334('0x4')]][_0x1334('0x26')]=utils['now']();queues[_0x55f494[_0x1334('0x4')]][_0x1334('0x1a')]=_0x55f494[_0x1334('0x24')][_0x1334('0x27')]();utils[_0x1334('0x2')](util['format'](_0x1334('0x28'),_0x55f494[_0x1334('0x4')],queues[_0x55f494[_0x1334('0x4')]]['name'],_0x55f494['value'],queues[_0x55f494[_0x1334('0x4')]][_0x1334('0x1a')]));writeDB(queues[_0x55f494[_0x1334('0x4')]]);}}else if(!_[_0x1334('0x15')](_0x55f494[_0x1334('0x22')][_0x1334('0x29')])){if(!_['isNil'](queues[_0x55f494[_0x1334('0x4')]])&&!queues[_0x55f494['uniqueid']][_0x1334('0x17')]){queues[_0x55f494['uniqueid']][_0x1334('0x17')]=![];queues[_0x55f494[_0x1334('0x4')]][_0x1334('0x2a')]=null;queues[_0x55f494[_0x1334('0x4')]]['queuecallerexit']=!![];queues[_0x55f494[_0x1334('0x4')]][_0x1334('0x26')]=utils[_0x1334('0x2b')]();queues[_0x55f494['uniqueid']]['queuecallerexitreason']=_0x1334('0x2c');utils[_0x1334('0x2')](util[_0x1334('0x3')](_0x1334('0x2d'),_0x55f494[_0x1334('0x4')],queues[_0x55f494[_0x1334('0x4')]][_0x1334('0x1d')],_0x55f494[_0x1334('0x24')],queues[_0x55f494[_0x1334('0x4')]][_0x1334('0x1a')]));}}}catch(_0x88cded){utils[_0x1334('0x12')](util[_0x1334('0x3')]('[%s][queues][varset]',_0x55f494['uniqueid']),_0x88cded);}};exports[_0x1334('0x17')]=function(_0x2d9b8c){try{if(!_[_0x1334('0x15')](queues[_0x2d9b8c[_0x1334('0x4')]])){utils[_0x1334('0x20')](util['format']('[%s][queues][queuecallerabandon]',_0x2d9b8c[_0x1334('0x4')]),_0x2d9b8c);queues[_0x2d9b8c[_0x1334('0x4')]][_0x1334('0x18')]=![];queues[_0x2d9b8c[_0x1334('0x4')]][_0x1334('0x26')]=null;queues[_0x2d9b8c['uniqueid']][_0x1334('0x17')]=!![];queues[_0x2d9b8c[_0x1334('0x4')]]['queuecallerabandonAt']=utils['now']();queues[_0x2d9b8c[_0x1334('0x4')]][_0x1334('0x1a')]=_0x1334('0x2e');utils[_0x1334('0x2')](util[_0x1334('0x3')](_0x1334('0x2f'),_0x2d9b8c[_0x1334('0x4')],queues[_0x2d9b8c[_0x1334('0x4')]][_0x1334('0x1d')],queues[_0x2d9b8c['uniqueid']][_0x1334('0x1a')]));}}catch(_0x464b80){utils[_0x1334('0x12')](util[_0x1334('0x3')](_0x1334('0x30'),_0x2d9b8c['uniqueid']),_0x464b80);}};exports[_0x1334('0x31')]=function(_0x789496){try{if(!_['isNil'](queues[_0x789496[_0x1334('0x4')]])){utils[_0x1334('0x20')](util['format'](_0x1334('0x32'),_0x789496[_0x1334('0x4')]),_0x789496);utils[_0x1334('0x2')](util[_0x1334('0x3')](_0x1334('0x33'),_0x789496[_0x1334('0x4')],queues[_0x789496[_0x1334('0x4')]][_0x1334('0x1d')],_0x789496[_0x1334('0x34')],_0x789496['connectedlinename']));queues[_0x789496['uniqueid']]['queuecallerleave']=!![];queues[_0x789496['uniqueid']][_0x1334('0x16')]=utils[_0x1334('0x2b')]();queues[_0x789496[_0x1334('0x4')]][_0x1334('0x35')]=utils['diffTime'](queues[_0x789496[_0x1334('0x4')]]['queuecallerleaveAt'],queues[_0x789496[_0x1334('0x4')]][_0x1334('0x36')]);queues[_0x789496[_0x1334('0x4')]][_0x1334('0x10')]=_0x789496[_0x1334('0x10')];queues[_0x789496[_0x1334('0x4')]][_0x1334('0x37')]=_0x789496['count'];queues[_0x789496[_0x1334('0x4')]][_0x1334('0x34')]=_0x789496[_0x1334('0x34')];queues[_0x789496[_0x1334('0x4')]][_0x1334('0x38')]=_0x789496[_0x1334('0x38')];}}catch(_0x54c3f5){utils['error'](util[_0x1334('0x3')](_0x1334('0x32'),_0x789496[_0x1334('0x4')]),_0x54c3f5);}};exports[_0x1334('0x39')]=function(_0x1b2dc2){try{if(!_[_0x1334('0x15')](queues[_0x1b2dc2[_0x1334('0x4')]])){utils[_0x1334('0x20')](util['format'](_0x1334('0x3a'),_0x1b2dc2[_0x1334('0x4')]),_0x1b2dc2);utils[_0x1334('0x2')](util['format'](_0x1334('0x3b'),_0x1b2dc2['uniqueid'],queues[_0x1b2dc2[_0x1334('0x4')]][_0x1334('0x1d')],_0x1b2dc2[_0x1334('0x3c')],_0x1b2dc2[_0x1334('0x3d')]));queues[_0x1b2dc2['uniqueid']][_0x1334('0x17')]=![];queues[_0x1b2dc2[_0x1334('0x4')]][_0x1334('0x17')]=![];queues[_0x1b2dc2[_0x1334('0x4')]][_0x1334('0x2a')]=null;queues[_0x1b2dc2[_0x1334('0x4')]][_0x1334('0x18')]=![];queues[_0x1b2dc2[_0x1334('0x4')]][_0x1334('0x1a')]=null;queues[_0x1b2dc2['uniqueid']]['queuecallerexitAt']=null;queues[_0x1b2dc2[_0x1334('0x4')]][_0x1334('0x3e')]=!![];queues[_0x1b2dc2[_0x1334('0x4')]][_0x1334('0x8')]=_0x1b2dc2[_0x1334('0x3d')];queues[_0x1b2dc2[_0x1334('0x4')]][_0x1334('0x7')]=_0x1b2dc2[_0x1334('0x3c')];}}catch(_0xb5fb95){utils['error'](util[_0x1334('0x3')]('[%s][queues][agentconnect]',_0x1b2dc2['uniqueid']),_0xb5fb95);}};exports[_0x1334('0x3f')]=function(_0x1660d9){try{if(!_[_0x1334('0x15')](queues[_0x1660d9[_0x1334('0x4')]])){if(queues[_0x1660d9['uniqueid']]['queuecallerleaveAt']){utils['debug'](util[_0x1334('0x3')](_0x1334('0x40'),_0x1660d9['uniqueid']),_0x1660d9);queues[_0x1660d9['uniqueid']]['queuecallerabandon']=![];queues[_0x1660d9[_0x1334('0x4')]]['queuecallerabandon']=![];queues[_0x1660d9[_0x1334('0x4')]]['queuecallerabandonAt']=null;queues[_0x1660d9[_0x1334('0x4')]][_0x1334('0x18')]=![];queues[_0x1660d9[_0x1334('0x4')]][_0x1334('0x26')]=null;queues[_0x1660d9['uniqueid']]['assigned']=!![];queues[_0x1660d9[_0x1334('0x4')]][_0x1334('0x7')]=_0x1660d9['membername'];queues[_0x1660d9[_0x1334('0x4')]][_0x1334('0x41')]=!![];queues[_0x1660d9[_0x1334('0x4')]]['queuecallercompleteAt']=utils[_0x1334('0x2b')]();if(_0x1660d9[_0x1334('0x42')]=='transfer'){if(!queues[_0x1660d9[_0x1334('0x4')]][_0x1334('0x43')]){queues[_0x1660d9['uniqueid']][_0x1334('0x1a')]=_0x1334('0x44');}}else{queues[_0x1660d9[_0x1334('0x4')]][_0x1334('0x1a')]='COMPLETEDBY'+_0x1660d9[_0x1334('0x42')][_0x1334('0x27')]();}utils[_0x1334('0x2')](util[_0x1334('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x1660d9[_0x1334('0x4')],queues[_0x1660d9[_0x1334('0x4')]][_0x1334('0x1d')],_0x1660d9['membername'],queues[_0x1660d9['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x1660d9[_0x1334('0x4')]]);}}}catch(_0x2c810e){utils[_0x1334('0x12')](util[_0x1334('0x3')]('[%s][queues][agentcomplete]',_0x1660d9[_0x1334('0x4')]),_0x2c810e);}};exports[_0x1334('0x45')]=function(_0x48b24a){try{if(!_[_0x1334('0x15')](queues[_0x48b24a[_0x1334('0x46')]])){utils[_0x1334('0x20')](util[_0x1334('0x3')]('[%s][queues][blindtransfer]',_0x48b24a[_0x1334('0x4')]),_0x48b24a);queues[_0x48b24a[_0x1334('0x46')]]['transfer']=!![];queues[_0x48b24a[_0x1334('0x46')]][_0x1334('0x47')]='BLIND';queues[_0x48b24a['transfereeuniqueid']][_0x1334('0x48')]=_0x48b24a[_0x1334('0x49')];queues[_0x48b24a['transfereeuniqueid']][_0x1334('0x4a')]=_0x48b24a['transfereeuniqueid'];queues[_0x48b24a[_0x1334('0x46')]]['queuecallerexitreason']=_0x1334('0x4b');utils[_0x1334('0x2')](util[_0x1334('0x3')](_0x1334('0x4c'),_0x48b24a[_0x1334('0x4')],queues[_0x48b24a[_0x1334('0x46')]]['name'],_0x48b24a[_0x1334('0x46')],_0x48b24a[_0x1334('0x49')]));}}catch(_0x5d99d1){utils['error'](util[_0x1334('0x3')](_0x1334('0x4d'),_0x48b24a[_0x1334('0x4')]),_0x5d99d1);}};exports['attendedtransfer']=function(_0x3fe17e){try{utils[_0x1334('0x20')](util['format'](_0x1334('0x4e'),_0x3fe17e[_0x1334('0x4f')]),_0x3fe17e);if(_0x3fe17e[_0x1334('0x4f')]==_0x3fe17e[_0x1334('0x50')]){if(!_[_0x1334('0x15')](queues[_0x3fe17e['secondtransfererlinkedid']])){utils[_0x1334('0x2')](util['format'](_0x1334('0x51'),_0x3fe17e[_0x1334('0x4f')],queues[_0x3fe17e['secondtransfererlinkedid']][_0x1334('0x1d')],_0x3fe17e[_0x1334('0x52')]));queues[_0x3fe17e[_0x1334('0x53')]][_0x1334('0x43')]=!![];queues[_0x3fe17e[_0x1334('0x53')]]['transfertype']=_0x1334('0x54');queues[_0x3fe17e[_0x1334('0x53')]][_0x1334('0x48')]=_0x3fe17e[_0x1334('0x52')];queues[_0x3fe17e[_0x1334('0x53')]]['transferuniqueid']=_0x3fe17e[_0x1334('0x4f')];queues[_0x3fe17e[_0x1334('0x53')]][_0x1334('0x1a')]=_0x1334('0x55');}if(!_[_0x1334('0x15')](queues[_0x3fe17e['origtransfererlinkedid']])){if(_0x3fe17e['transfereelinkedid']&&queues[_0x3fe17e[_0x1334('0x56')]]){queues[_0x3fe17e[_0x1334('0x56')]]['queuecallerenterreason']=0x1;queues[_0x3fe17e[_0x1334('0x46')]]=_[_0x1334('0x57')](queues[_0x3fe17e[_0x1334('0x56')]]);queues[_0x3fe17e[_0x1334('0x46')]][_0x1334('0xd')]=_0x3fe17e[_0x1334('0x58')];queues[_0x3fe17e['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x3fe17e[_0x1334('0x46')]]['calleridnum']=queues[_0x3fe17e[_0x1334('0x53')]]['calleridnum'];queues[_0x3fe17e[_0x1334('0x46')]]['calleridname']=queues[_0x3fe17e['secondtransfererlinkedid']][_0x1334('0x59')];queues[_0x3fe17e[_0x1334('0x46')]][_0x1334('0x36')]=utils[_0x1334('0x2b')]();queues[_0x3fe17e['transfereeuniqueid']][_0x1334('0x16')]=utils['now']();queues[_0x3fe17e[_0x1334('0x46')]][_0x1334('0x35')]=0x0;queues[_0x3fe17e[_0x1334('0x46')]]['mohtime']=0x0;utils[_0x1334('0x2')](util[_0x1334('0x3')](_0x1334('0x5a'),_0x3fe17e[_0x1334('0x4f')],queues[_0x3fe17e[_0x1334('0x46')]]['name'],queues[_0x3fe17e[_0x1334('0x46')]]['calleridnum'],queues[_0x3fe17e[_0x1334('0x46')]][_0x1334('0x59')]));}else{utils['info'](util[_0x1334('0x3')](_0x1334('0x5b'),_0x3fe17e[_0x1334('0x4f')],queues[_0x3fe17e['origtransfererlinkedid']]['name'],_0x3fe17e[_0x1334('0x53')]));queues[_0x3fe17e[_0x1334('0x50')]][_0x1334('0xd')]=_0x3fe17e[_0x1334('0x53')];}}}else if(_0x3fe17e[_0x1334('0x5c')]==_0x3fe17e[_0x1334('0x53')]){if(!_[_0x1334('0x15')](queues[_0x3fe17e[_0x1334('0x50')]])){utils[_0x1334('0x2')](util[_0x1334('0x3')](_0x1334('0x5d'),_0x3fe17e[_0x1334('0x4f')],queues[_0x3fe17e['origtransfererlinkedid']][_0x1334('0x1d')],_0x3fe17e['secondtransfereruniqueid'],_0x3fe17e[_0x1334('0x5e')]));queues[_0x3fe17e[_0x1334('0x50')]]['transfer']=!![];queues[_0x3fe17e[_0x1334('0x50')]]['transfertype']=_0x1334('0x54');queues[_0x3fe17e[_0x1334('0x50')]][_0x1334('0x48')]=_0x3fe17e[_0x1334('0x5e')];queues[_0x3fe17e['origtransfererlinkedid']][_0x1334('0x4a')]=_0x3fe17e[_0x1334('0x5c')];queues[_0x3fe17e['origtransfererlinkedid']]['queuecallerexitreason']=_0x1334('0x55');}if(!_[_0x1334('0x15')](queues[_0x3fe17e['secondtransfererlinkedid']])){if(_0x3fe17e[_0x1334('0x5f')]&&queues[_0x3fe17e[_0x1334('0x5f')]]){queues[_0x3fe17e[_0x1334('0x5f')]][_0x1334('0x60')]=0x1;queues[_0x3fe17e[_0x1334('0x58')]]=_[_0x1334('0x57')](queues[_0x3fe17e[_0x1334('0x5f')]]);queues[_0x3fe17e[_0x1334('0x58')]][_0x1334('0xd')]=_0x3fe17e[_0x1334('0x58')];queues[_0x3fe17e[_0x1334('0x58')]][_0x1334('0x60')]=0x2;queues[_0x3fe17e['transfertargetuniqueid']]['calleridnum']=queues[_0x3fe17e[_0x1334('0x50')]]['calleridnum'];queues[_0x3fe17e['transfertargetuniqueid']][_0x1334('0x59')]=queues[_0x3fe17e[_0x1334('0x50')]][_0x1334('0x59')];queues[_0x3fe17e[_0x1334('0x58')]][_0x1334('0x36')]=utils[_0x1334('0x2b')]();queues[_0x3fe17e[_0x1334('0x58')]][_0x1334('0x16')]=utils[_0x1334('0x2b')]();queues[_0x3fe17e['transfertargetuniqueid']][_0x1334('0x35')]=0x0;queues[_0x3fe17e[_0x1334('0x58')]][_0x1334('0x61')]=0x0;utils['info'](util[_0x1334('0x3')](_0x1334('0x62'),_0x3fe17e[_0x1334('0x4f')],queues[_0x3fe17e[_0x1334('0x58')]][_0x1334('0x1d')],queues[_0x3fe17e['transfertargetuniqueid']][_0x1334('0xd')],queues[_0x3fe17e[_0x1334('0x58')]][_0x1334('0x63')],queues[_0x3fe17e[_0x1334('0x58')]][_0x1334('0x59')]));}else{utils[_0x1334('0x2')](util[_0x1334('0x3')](_0x1334('0x5b'),_0x3fe17e[_0x1334('0x4f')],queues[_0x3fe17e[_0x1334('0x53')]][_0x1334('0x1d')],_0x3fe17e[_0x1334('0x50')]));queues[_0x3fe17e[_0x1334('0x53')]][_0x1334('0xd')]=_0x3fe17e[_0x1334('0x50')];}}}}catch(_0x5546bb){utils['error'](util[_0x1334('0x3')](_0x1334('0x4e'),_0x3fe17e[_0x1334('0x4f')]),_0x5546bb);}};exports[_0x1334('0x64')]=function(_0x37fd63){try{if(!_['isNil'](queues[_0x37fd63[_0x1334('0x4')]])){utils['debug'](util[_0x1334('0x3')](_0x1334('0x65'),_0x37fd63['uniqueid']),_0x37fd63);queues[_0x37fd63[_0x1334('0x4')]][_0x1334('0x66')]=utils[_0x1334('0x2b')]();utils[_0x1334('0x2')](util[_0x1334('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x37fd63[_0x1334('0x4')],queues[_0x37fd63[_0x1334('0x4')]][_0x1334('0x1d')],queues[_0x37fd63[_0x1334('0x4')]][_0x1334('0x66')]));}}catch(_0x2ff05f){utils['error'](util[_0x1334('0x3')]('[%s][queues][musiconholdstart]',_0x37fd63[_0x1334('0x4')]),_0x2ff05f);}};exports[_0x1334('0x67')]=function(_0x53b6bd){try{if(!_[_0x1334('0x15')](queues[_0x53b6bd[_0x1334('0x4')]])){if(!_[_0x1334('0x15')](queues[_0x53b6bd['uniqueid']][_0x1334('0x66')])){utils['debug'](util['format'](_0x1334('0x68'),_0x53b6bd[_0x1334('0x4')]),_0x53b6bd);queues[_0x53b6bd[_0x1334('0x4')]]['mohtime']+=utils['diffTime'](utils['now'](),queues[_0x53b6bd[_0x1334('0x4')]][_0x1334('0x66')]);utils[_0x1334('0x2')](util['format'](_0x1334('0x69'),_0x53b6bd[_0x1334('0x4')],queues[_0x53b6bd[_0x1334('0x4')]][_0x1334('0x1d')],queues[_0x53b6bd[_0x1334('0x4')]]['mohtime']));delete queues[_0x53b6bd[_0x1334('0x4')]][_0x1334('0x66')];}}}catch(_0x13f607){utils[_0x1334('0x12')](util['format'](_0x1334('0x68'),_0x53b6bd[_0x1334('0x4')]),_0x13f607);}}; \ No newline at end of file +var _0x2373=['agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','origtransfererlinkedid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transferexten','transfertargetlinkedid','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','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','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','now','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','error','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%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]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','position','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x2373,0xf8));var _0x3237=function(_0x14eb8c,_0x53aad0){_0x14eb8c=_0x14eb8c-0x0;var _0x1a77cd=_0x2373[_0x14eb8c];return _0x1a77cd;};'use strict';var _=require(_0x3237('0x0'));var util=require(_0x3237('0x1'));var utils=require(_0x3237('0x2'));var queues={};function writeDB(_0x4691f7){utils[_0x3237('0x3')](util[_0x3237('0x4')](_0x3237('0x5'),_0x4691f7[_0x3237('0x6')],_0x4691f7[_0x3237('0x7')],_0x4691f7[_0x3237('0x8')],_0x4691f7[_0x3237('0x9')],_0x4691f7[_0x3237('0xa')],_0x4691f7['accountcode'],_0x4691f7[_0x3237('0xb')]));if(_0x4691f7[_0x3237('0x8')]){utils[_0x3237('0xc')](_0x4691f7[_0x3237('0x8')])['then'](function(_0x15390c){if(_0x15390c){_0x4691f7[_0x3237('0xd')]=_0x15390c[_0x3237('0xd')];}utils[_0x3237('0xe')](_0x3237('0xf'),_0x4691f7);});}else{utils[_0x3237('0xe')](_0x3237('0xf'),_0x4691f7);}if(_0x4691f7[_0x3237('0x10')]){delete queues[_0x4691f7[_0x3237('0x10')]];}else{delete queues[_0x4691f7['uniqueid']];}}exports[_0x3237('0x11')]=function(_0x1419a7){try{utils['debug'](util[_0x3237('0x4')](_0x3237('0x12'),_0x1419a7[_0x3237('0x6')]),_0x1419a7);utils[_0x3237('0x3')](util[_0x3237('0x4')](_0x3237('0x13'),_0x1419a7[_0x3237('0x6')],_0x1419a7[_0x3237('0x8')],_0x1419a7['position']));queues[_0x1419a7[_0x3237('0x6')]]=_['assign'](_0x1419a7,{'originalposition':_0x1419a7['position'],'queuecallerjoinAt':utils[_0x3237('0x14')](),'mohtime':0x0});}catch(_0x24c6f6){utils['error'](util[_0x3237('0x4')](_0x3237('0x12'),_0x1419a7[_0x3237('0x6')]),_0x24c6f6);}};exports[_0x3237('0x15')]=function(_0x3540cd){try{if(!_[_0x3237('0x16')](queues[_0x3540cd['uniqueid']])){utils[_0x3237('0x17')](util[_0x3237('0x4')](_0x3237('0x18'),_0x3540cd[_0x3237('0x6')]),_0x3540cd);if(queues[_0x3540cd['uniqueid']][_0x3237('0x19')]){if(!queues[_0x3540cd[_0x3237('0x6')]][_0x3237('0x1a')]&&!queues[_0x3540cd['uniqueid']][_0x3237('0x1b')]){queues[_0x3540cd['uniqueid']]['queuecallercomplete']=!![];queues[_0x3540cd[_0x3237('0x6')]][_0x3237('0x1c')]=utils['now']();queues[_0x3540cd[_0x3237('0x6')]]['queuecallerexitreason']=_0x3237('0x1d');}utils['info'](util[_0x3237('0x4')](_0x3237('0x1e'),_0x3540cd[_0x3237('0x6')],queues[_0x3540cd[_0x3237('0x6')]][_0x3237('0x1f')],queues[_0x3540cd[_0x3237('0x6')]][_0x3237('0xb')]));writeDB(queues[_0x3540cd[_0x3237('0x6')]]);}else if(queues[_0x3540cd[_0x3237('0x6')]]['transfereduniqueid']){utils[_0x3237('0x3')](util[_0x3237('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x3540cd[_0x3237('0x6')],queues[_0x3540cd[_0x3237('0x6')]]['name'],queues[_0x3540cd[_0x3237('0x6')]][_0x3237('0x10')]));queues[queues[_0x3540cd[_0x3237('0x6')]][_0x3237('0x10')]]=queues[_0x3540cd[_0x3237('0x6')]];queues[queues[_0x3540cd[_0x3237('0x6')]][_0x3237('0x10')]][_0x3237('0x20')]=0x2;delete queues[_0x3540cd[_0x3237('0x6')]];}}}catch(_0x3db865){utils[_0x3237('0x21')](util[_0x3237('0x4')](_0x3237('0x18'),_0x3540cd[_0x3237('0x6')]),_0x3db865);}};exports['varset']=function(_0x3cb9cb){try{utils[_0x3237('0x17')](util[_0x3237('0x4')](_0x3237('0x22'),_0x3cb9cb[_0x3237('0x6')]),_0x3cb9cb);if(!_[_0x3237('0x16')](_0x3cb9cb[_0x3237('0x23')][_0x3237('0x24')])&&_0x3cb9cb[_0x3237('0x25')][_0x3237('0x26')]()!==_0x3237('0x27')){if(!_[_0x3237('0x16')](queues[_0x3cb9cb[_0x3237('0x6')]])){queues[_0x3cb9cb['uniqueid']][_0x3237('0x1a')]=![];queues[_0x3cb9cb[_0x3237('0x6')]][_0x3237('0x28')]=null;queues[_0x3cb9cb['uniqueid']][_0x3237('0x1b')]=!![];queues[_0x3cb9cb['uniqueid']][_0x3237('0x29')]=utils['now']();queues[_0x3cb9cb[_0x3237('0x6')]][_0x3237('0xb')]=_0x3cb9cb[_0x3237('0x25')][_0x3237('0x26')]();utils['info'](util['format'](_0x3237('0x2a'),_0x3cb9cb[_0x3237('0x6')],queues[_0x3cb9cb['uniqueid']]['name'],_0x3cb9cb[_0x3237('0x25')],queues[_0x3cb9cb[_0x3237('0x6')]][_0x3237('0xb')]));writeDB(queues[_0x3cb9cb['uniqueid']]);}}else if(!_['isNil'](_0x3cb9cb[_0x3237('0x23')][_0x3237('0x2b')])){if(!_[_0x3237('0x16')](queues[_0x3cb9cb[_0x3237('0x6')]])&&!queues[_0x3cb9cb[_0x3237('0x6')]][_0x3237('0x1a')]){queues[_0x3cb9cb[_0x3237('0x6')]][_0x3237('0x1a')]=![];queues[_0x3cb9cb['uniqueid']]['queuecallerabandonAt']=null;queues[_0x3cb9cb['uniqueid']][_0x3237('0x1b')]=!![];queues[_0x3cb9cb['uniqueid']][_0x3237('0x29')]=utils[_0x3237('0x14')]();queues[_0x3cb9cb[_0x3237('0x6')]][_0x3237('0xb')]=_0x3237('0x2c');utils[_0x3237('0x3')](util[_0x3237('0x4')](_0x3237('0x2d'),_0x3cb9cb['uniqueid'],queues[_0x3cb9cb['uniqueid']][_0x3237('0x1f')],_0x3cb9cb[_0x3237('0x25')],queues[_0x3cb9cb['uniqueid']][_0x3237('0xb')]));}}}catch(_0x3a2dac){utils[_0x3237('0x21')](util[_0x3237('0x4')](_0x3237('0x22'),_0x3cb9cb['uniqueid']),_0x3a2dac);}};exports[_0x3237('0x1a')]=function(_0x4953b3){try{if(!_[_0x3237('0x16')](queues[_0x4953b3['uniqueid']])){utils[_0x3237('0x17')](util['format'](_0x3237('0x2e'),_0x4953b3[_0x3237('0x6')]),_0x4953b3);queues[_0x4953b3[_0x3237('0x6')]][_0x3237('0x1b')]=![];queues[_0x4953b3[_0x3237('0x6')]]['queuecallerexitAt']=null;queues[_0x4953b3[_0x3237('0x6')]][_0x3237('0x1a')]=!![];queues[_0x4953b3[_0x3237('0x6')]][_0x3237('0x28')]=utils['now']();queues[_0x4953b3[_0x3237('0x6')]][_0x3237('0xb')]=_0x3237('0x2f');utils[_0x3237('0x3')](util[_0x3237('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x4953b3[_0x3237('0x6')],queues[_0x4953b3[_0x3237('0x6')]][_0x3237('0x1f')],queues[_0x4953b3['uniqueid']][_0x3237('0xb')]));}}catch(_0x158b90){utils[_0x3237('0x21')](util[_0x3237('0x4')]('[%s][queues][queuecallerabandon]',_0x4953b3[_0x3237('0x6')]),_0x158b90);}};exports[_0x3237('0x30')]=function(_0x39dd31){try{if(!_['isNil'](queues[_0x39dd31[_0x3237('0x6')]])){utils['debug'](util[_0x3237('0x4')]('[%s][queues][queuecallerleave]',_0x39dd31[_0x3237('0x6')]),_0x39dd31);utils[_0x3237('0x3')](util[_0x3237('0x4')](_0x3237('0x31'),_0x39dd31[_0x3237('0x6')],queues[_0x39dd31[_0x3237('0x6')]][_0x3237('0x1f')],_0x39dd31[_0x3237('0x32')],_0x39dd31[_0x3237('0x33')]));queues[_0x39dd31[_0x3237('0x6')]][_0x3237('0x30')]=!![];queues[_0x39dd31[_0x3237('0x6')]]['queuecallerleaveAt']=utils[_0x3237('0x14')]();queues[_0x39dd31[_0x3237('0x6')]][_0x3237('0x34')]=utils[_0x3237('0x35')](queues[_0x39dd31[_0x3237('0x6')]][_0x3237('0x19')],queues[_0x39dd31['uniqueid']][_0x3237('0x36')]);queues[_0x39dd31[_0x3237('0x6')]][_0x3237('0x37')]=_0x39dd31[_0x3237('0x37')];queues[_0x39dd31['uniqueid']][_0x3237('0x38')]=_0x39dd31['count'];queues[_0x39dd31[_0x3237('0x6')]][_0x3237('0x32')]=_0x39dd31[_0x3237('0x32')];queues[_0x39dd31[_0x3237('0x6')]][_0x3237('0x33')]=_0x39dd31[_0x3237('0x33')];}}catch(_0x4a42d4){utils[_0x3237('0x21')](util[_0x3237('0x4')](_0x3237('0x39'),_0x39dd31[_0x3237('0x6')]),_0x4a42d4);}};exports[_0x3237('0x3a')]=function(_0x25dd1c){try{if(!_[_0x3237('0x16')](queues[_0x25dd1c['uniqueid']])){utils[_0x3237('0x17')](util[_0x3237('0x4')](_0x3237('0x3b'),_0x25dd1c[_0x3237('0x6')]),_0x25dd1c);utils['info'](util[_0x3237('0x4')](_0x3237('0x3c'),_0x25dd1c['uniqueid'],queues[_0x25dd1c['uniqueid']]['name'],_0x25dd1c[_0x3237('0x3d')],_0x25dd1c[_0x3237('0x3e')]));queues[_0x25dd1c[_0x3237('0x6')]][_0x3237('0x1a')]=![];queues[_0x25dd1c[_0x3237('0x6')]]['queuecallerabandon']=![];queues[_0x25dd1c['uniqueid']][_0x3237('0x28')]=null;queues[_0x25dd1c[_0x3237('0x6')]][_0x3237('0x1b')]=![];queues[_0x25dd1c[_0x3237('0x6')]][_0x3237('0xb')]=null;queues[_0x25dd1c[_0x3237('0x6')]]['queuecallerexitAt']=null;queues[_0x25dd1c[_0x3237('0x6')]][_0x3237('0x3f')]=!![];queues[_0x25dd1c[_0x3237('0x6')]]['accountcode']=_0x25dd1c['destaccountcode'];queues[_0x25dd1c[_0x3237('0x6')]][_0x3237('0x9')]=_0x25dd1c[_0x3237('0x3d')];}}catch(_0xf32d75){utils[_0x3237('0x21')](util[_0x3237('0x4')](_0x3237('0x3b'),_0x25dd1c[_0x3237('0x6')]),_0xf32d75);}};exports[_0x3237('0x40')]=function(_0x30f709){try{if(!_[_0x3237('0x16')](queues[_0x30f709[_0x3237('0x6')]])){if(queues[_0x30f709[_0x3237('0x6')]]['queuecallerleaveAt']){utils['debug'](util['format'](_0x3237('0x41'),_0x30f709[_0x3237('0x6')]),_0x30f709);queues[_0x30f709['uniqueid']][_0x3237('0x1a')]=![];queues[_0x30f709['uniqueid']][_0x3237('0x1a')]=![];queues[_0x30f709[_0x3237('0x6')]][_0x3237('0x28')]=null;queues[_0x30f709[_0x3237('0x6')]]['queuecallerexit']=![];queues[_0x30f709[_0x3237('0x6')]][_0x3237('0x29')]=null;queues[_0x30f709['uniqueid']][_0x3237('0x3f')]=!![];queues[_0x30f709[_0x3237('0x6')]][_0x3237('0x9')]=_0x30f709['membername'];queues[_0x30f709[_0x3237('0x6')]][_0x3237('0x42')]=!![];queues[_0x30f709[_0x3237('0x6')]][_0x3237('0x1c')]=utils[_0x3237('0x14')]();if(_0x30f709[_0x3237('0x43')]==_0x3237('0x44')){if(!queues[_0x30f709[_0x3237('0x6')]][_0x3237('0x44')]){queues[_0x30f709[_0x3237('0x6')]][_0x3237('0xb')]=_0x3237('0x45');}}else{queues[_0x30f709[_0x3237('0x6')]][_0x3237('0xb')]=_0x3237('0x46')+_0x30f709[_0x3237('0x43')]['toUpperCase']();}utils[_0x3237('0x3')](util['format'](_0x3237('0x47'),_0x30f709[_0x3237('0x6')],queues[_0x30f709[_0x3237('0x6')]][_0x3237('0x1f')],_0x30f709['membername'],queues[_0x30f709[_0x3237('0x6')]][_0x3237('0xb')]));writeDB(queues[_0x30f709[_0x3237('0x6')]]);}}}catch(_0x3dee76){utils[_0x3237('0x21')](util[_0x3237('0x4')](_0x3237('0x41'),_0x30f709[_0x3237('0x6')]),_0x3dee76);}};exports[_0x3237('0x48')]=function(_0x2e0af9){try{if(!_[_0x3237('0x16')](queues[_0x2e0af9['transfereeuniqueid']])){utils[_0x3237('0x17')](util['format'](_0x3237('0x49'),_0x2e0af9['uniqueid']),_0x2e0af9);queues[_0x2e0af9[_0x3237('0x4a')]][_0x3237('0x44')]=!![];queues[_0x2e0af9['transfereeuniqueid']][_0x3237('0x4b')]=_0x3237('0x4c');queues[_0x2e0af9[_0x3237('0x4a')]]['transferexten']=_0x2e0af9[_0x3237('0x4d')];queues[_0x2e0af9[_0x3237('0x4a')]][_0x3237('0x4e')]=_0x2e0af9[_0x3237('0x4a')];queues[_0x2e0af9[_0x3237('0x4a')]]['queuecallerexitreason']='BLINDTRANSFER';utils[_0x3237('0x3')](util[_0x3237('0x4')](_0x3237('0x4f'),_0x2e0af9[_0x3237('0x6')],queues[_0x2e0af9['transfereeuniqueid']][_0x3237('0x1f')],_0x2e0af9[_0x3237('0x4a')],_0x2e0af9[_0x3237('0x4d')]));}}catch(_0x52e810){utils['error'](util[_0x3237('0x4')](_0x3237('0x49'),_0x2e0af9[_0x3237('0x6')]),_0x52e810);}};exports['attendedtransfer']=function(_0x1b8475){try{utils[_0x3237('0x17')](util[_0x3237('0x4')](_0x3237('0x50'),_0x1b8475[_0x3237('0x51')]),_0x1b8475);if(_0x1b8475[_0x3237('0x51')]==_0x1b8475['origtransfererlinkedid']){if(!_['isNil'](queues[_0x1b8475[_0x3237('0x52')]])){utils[_0x3237('0x3')](util[_0x3237('0x4')](_0x3237('0x53'),_0x1b8475[_0x3237('0x51')],queues[_0x1b8475[_0x3237('0x52')]][_0x3237('0x1f')],_0x1b8475[_0x3237('0x54')]));queues[_0x1b8475[_0x3237('0x52')]]['transfer']=!![];queues[_0x1b8475[_0x3237('0x52')]][_0x3237('0x4b')]=_0x3237('0x55');queues[_0x1b8475[_0x3237('0x52')]]['transferexten']=_0x1b8475[_0x3237('0x54')];queues[_0x1b8475[_0x3237('0x52')]]['transferuniqueid']=_0x1b8475[_0x3237('0x51')];queues[_0x1b8475[_0x3237('0x52')]][_0x3237('0xb')]=_0x3237('0x56');}if(!_[_0x3237('0x16')](queues[_0x1b8475['origtransfererlinkedid']])){if(_0x1b8475[_0x3237('0x57')]&&queues[_0x1b8475['transfereelinkedid']]){queues[_0x1b8475['transfereelinkedid']][_0x3237('0x20')]=0x1;queues[_0x1b8475['transfereeuniqueid']]=_[_0x3237('0x58')](queues[_0x1b8475[_0x3237('0x57')]]);queues[_0x1b8475[_0x3237('0x4a')]]['transfereduniqueid']=_0x1b8475[_0x3237('0x59')];queues[_0x1b8475[_0x3237('0x4a')]][_0x3237('0x20')]=0x2;queues[_0x1b8475[_0x3237('0x4a')]][_0x3237('0xa')]=queues[_0x1b8475[_0x3237('0x52')]][_0x3237('0xa')];queues[_0x1b8475[_0x3237('0x4a')]][_0x3237('0x5a')]=queues[_0x1b8475[_0x3237('0x52')]][_0x3237('0x5a')];queues[_0x1b8475[_0x3237('0x4a')]][_0x3237('0x36')]=utils['now']();queues[_0x1b8475['transfereeuniqueid']][_0x3237('0x19')]=utils[_0x3237('0x14')]();queues[_0x1b8475[_0x3237('0x4a')]]['holdtime']=0x0;queues[_0x1b8475[_0x3237('0x4a')]][_0x3237('0x5b')]=0x0;utils[_0x3237('0x3')](util[_0x3237('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x1b8475[_0x3237('0x51')],queues[_0x1b8475[_0x3237('0x4a')]]['name'],queues[_0x1b8475[_0x3237('0x4a')]][_0x3237('0xa')],queues[_0x1b8475[_0x3237('0x4a')]]['calleridname']));}else{utils['info'](util[_0x3237('0x4')](_0x3237('0x5c'),_0x1b8475['origtransfereruniqueid'],queues[_0x1b8475[_0x3237('0x5d')]][_0x3237('0x1f')],_0x1b8475['secondtransfererlinkedid']));queues[_0x1b8475['origtransfererlinkedid']][_0x3237('0x10')]=_0x1b8475[_0x3237('0x52')];}}}else if(_0x1b8475[_0x3237('0x5e')]==_0x1b8475[_0x3237('0x52')]){if(!_[_0x3237('0x16')](queues[_0x1b8475[_0x3237('0x5d')]])){utils[_0x3237('0x3')](util[_0x3237('0x4')](_0x3237('0x5f'),_0x1b8475['origtransfereruniqueid'],queues[_0x1b8475[_0x3237('0x5d')]]['name'],_0x1b8475[_0x3237('0x5e')],_0x1b8475[_0x3237('0x60')]));queues[_0x1b8475['origtransfererlinkedid']][_0x3237('0x44')]=!![];queues[_0x1b8475[_0x3237('0x5d')]][_0x3237('0x4b')]=_0x3237('0x55');queues[_0x1b8475['origtransfererlinkedid']][_0x3237('0x61')]=_0x1b8475['secondtransfererexten'];queues[_0x1b8475[_0x3237('0x5d')]][_0x3237('0x4e')]=_0x1b8475[_0x3237('0x5e')];queues[_0x1b8475['origtransfererlinkedid']][_0x3237('0xb')]=_0x3237('0x56');}if(!_[_0x3237('0x16')](queues[_0x1b8475[_0x3237('0x52')]])){if(_0x1b8475[_0x3237('0x62')]&&queues[_0x1b8475['transfertargetlinkedid']]){queues[_0x1b8475[_0x3237('0x62')]][_0x3237('0x20')]=0x1;queues[_0x1b8475[_0x3237('0x59')]]=_[_0x3237('0x58')](queues[_0x1b8475[_0x3237('0x62')]]);queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0x10')]=_0x1b8475[_0x3237('0x59')];queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0x20')]=0x2;queues[_0x1b8475['transfertargetuniqueid']][_0x3237('0xa')]=queues[_0x1b8475['origtransfererlinkedid']]['calleridnum'];queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0x5a')]=queues[_0x1b8475[_0x3237('0x5d')]][_0x3237('0x5a')];queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0x36')]=utils[_0x3237('0x14')]();queues[_0x1b8475[_0x3237('0x59')]]['queuecallerleaveAt']=utils[_0x3237('0x14')]();queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0x34')]=0x0;queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0x5b')]=0x0;utils['info'](util[_0x3237('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x1b8475[_0x3237('0x51')],queues[_0x1b8475['transfertargetuniqueid']]['name'],queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0x10')],queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0xa')],queues[_0x1b8475[_0x3237('0x59')]][_0x3237('0x5a')]));}else{utils['info'](util[_0x3237('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1b8475['origtransfereruniqueid'],queues[_0x1b8475[_0x3237('0x52')]][_0x3237('0x1f')],_0x1b8475['origtransfererlinkedid']));queues[_0x1b8475[_0x3237('0x52')]][_0x3237('0x10')]=_0x1b8475[_0x3237('0x5d')];}}}}catch(_0x4d46e0){utils[_0x3237('0x21')](util[_0x3237('0x4')](_0x3237('0x50'),_0x1b8475[_0x3237('0x51')]),_0x4d46e0);}};exports['musiconholdstart']=function(_0x342708){try{if(!_[_0x3237('0x16')](queues[_0x342708[_0x3237('0x6')]])){utils[_0x3237('0x17')](util['format'](_0x3237('0x63'),_0x342708['uniqueid']),_0x342708);queues[_0x342708[_0x3237('0x6')]][_0x3237('0x64')]=utils[_0x3237('0x14')]();utils[_0x3237('0x3')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x342708[_0x3237('0x6')],queues[_0x342708[_0x3237('0x6')]][_0x3237('0x1f')],queues[_0x342708[_0x3237('0x6')]][_0x3237('0x64')]));}}catch(_0x171a99){utils['error'](util[_0x3237('0x4')](_0x3237('0x63'),_0x342708[_0x3237('0x6')]),_0x171a99);}};exports[_0x3237('0x65')]=function(_0x476342){try{if(!_['isNil'](queues[_0x476342[_0x3237('0x6')]])){if(!_['isNil'](queues[_0x476342['uniqueid']][_0x3237('0x64')])){utils[_0x3237('0x17')](util[_0x3237('0x4')](_0x3237('0x66'),_0x476342['uniqueid']),_0x476342);queues[_0x476342[_0x3237('0x6')]][_0x3237('0x5b')]+=utils[_0x3237('0x35')](utils['now'](),queues[_0x476342[_0x3237('0x6')]][_0x3237('0x64')]);utils['info'](util[_0x3237('0x4')](_0x3237('0x67'),_0x476342[_0x3237('0x6')],queues[_0x476342[_0x3237('0x6')]][_0x3237('0x1f')],queues[_0x476342[_0x3237('0x6')]][_0x3237('0x5b')]));delete queues[_0x476342[_0x3237('0x6')]][_0x3237('0x64')];}}}catch(_0x460974){utils[_0x3237('0x21')](util[_0x3237('0x4')](_0x3237('0x66'),_0x476342[_0x3237('0x6')]),_0x460974);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 64e2b81..2539979 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 _0x1f76=['[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','blinds','uniqueid','transfereeuniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','context','exten','channel','error','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][hangup]','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten'];(function(_0x372360,_0x3e75fc){var _0x1e31b7=function(_0x468249){while(--_0x468249){_0x372360['push'](_0x372360['shift']());}};_0x1e31b7(++_0x3e75fc);}(_0x1f76,0xa7));var _0x61f7=function(_0x20abaf,_0x1b8cdc){_0x20abaf=_0x20abaf-0x0;var _0x21e5ad=_0x1f76[_0x20abaf];return _0x21e5ad;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x61f7('0x0'));var transfers=require(_0x61f7('0x1'));var recordings={};function writeDB(_0x55e536){var _0x164059;utils[_0x61f7('0x2')](util[_0x61f7('0x3')](_0x61f7('0x4'),_0x55e536['uniqueid']));if(transfers[_0x61f7('0x5')][_0x55e536['uniqueid']]){_0x164059=_0x55e536[_0x61f7('0x6')];_0x55e536[_0x61f7('0x6')]=transfers[_0x61f7('0x5')][_0x55e536['uniqueid']][_0x61f7('0x7')];}if(_0x55e536[_0x61f7('0x8')]){utils[_0x61f7('0x9')](_0x55e536['accountcode'])['then'](function(_0x7baf99){if(_0x7baf99){_0x55e536[_0x61f7('0xa')]=_0x7baf99[_0x61f7('0xb')];_0x55e536[_0x61f7('0xc')]=_0x7baf99['id'];}utils[_0x61f7('0xd')](_0x61f7('0xe'),_0x55e536);});}else{utils[_0x61f7('0xd')]('CreateVoiceRecording',_0x55e536);}if(_0x164059)delete transfers[_0x61f7('0x5')][_0x164059];}exports[_0x61f7('0xf')]=function(_0x481392){try{utils[_0x61f7('0x10')](util['format'](_0x61f7('0x11'),_0x481392[_0x61f7('0x6')]),_0x481392);if(_0x481392[_0x61f7('0x6')]==_0x481392[_0x61f7('0x12')]){utils[_0x61f7('0x2')](util[_0x61f7('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x481392[_0x61f7('0x6')],_0x481392[_0x61f7('0x13')],_0x481392['exten']));recordings[_0x481392['uniqueid']]={'uniqueid':_0x481392['uniqueid'],'accountcode':_0x481392[_0x61f7('0x8')],'exten':_0x481392[_0x61f7('0x14')],'context':_0x481392[_0x61f7('0x13')],'channel':_0x481392[_0x61f7('0x15')],'monitors':[]};}}catch(_0x439d9b){utils[_0x61f7('0x16')](util[_0x61f7('0x3')](_0x61f7('0x11'),_0x481392[_0x61f7('0x6')]),_0x439d9b);}};exports['newstate']=function(_0x357644){try{utils[_0x61f7('0x10')](util[_0x61f7('0x3')](_0x61f7('0x17'),_0x357644[_0x61f7('0x6')]),_0x357644);if(!_['isNil'](recordings[_0x357644[_0x61f7('0x6')]])&&_0x357644[_0x61f7('0x18')]==0x6){utils['info'](util[_0x61f7('0x3')](_0x61f7('0x19'),_0x357644['uniqueid'],_0x357644[_0x61f7('0x13')],_0x357644[_0x61f7('0x15')]));}else if(!_[_0x61f7('0x1a')](recordings[_0x357644['linkedid']])&&_0x357644['channelstate']==0x6&&_0x357644[_0x61f7('0x13')]!=_0x61f7('0x1b')){utils[_0x61f7('0x2')](util[_0x61f7('0x3')](_0x61f7('0x1c'),_0x357644[_0x61f7('0x6')],_0x357644[_0x61f7('0x12')],_0x357644['context'],_0x357644['channel']));recordings[_0x357644[_0x61f7('0x12')]][_0x61f7('0x8')]=_0x357644[_0x61f7('0x8')];}}catch(_0x2df1fc){utils[_0x61f7('0x16')](util[_0x61f7('0x3')](_0x61f7('0x17'),_0x357644['uniqueid']),_0x2df1fc);}};exports[_0x61f7('0x1d')]=function(_0x481979){try{if(!_[_0x61f7('0x1a')](_0x481979['variable'])&&!_[_0x61f7('0x1a')](_0x481979[_0x61f7('0x1e')][_0x61f7('0x1f')])){utils[_0x61f7('0x10')](util['format'](_0x61f7('0x20'),_0x481979[_0x61f7('0x6')]),_0x481979);utils[_0x61f7('0x2')](util['format'](_0x61f7('0x21'),_0x481979[_0x61f7('0x6')],_0x481979['variable'],_0x481979[_0x61f7('0x22')]));if(_[_0x61f7('0x23')](_0x481979[_0x61f7('0x22')],_0x61f7('0x24'))){_0x481979[_0x61f7('0x22')]=_0x481979[_0x61f7('0x22')][_0x61f7('0x25')](_0x61f7('0x24'),_0x61f7('0x26'));}if(recordings[_0x481979[_0x61f7('0x12')]]){var _0x73fb41=_[_0x61f7('0x27')](recordings[_0x481979['linkedid']]['monitors'],{'value':_0x481979[_0x61f7('0x22')]});if(_['isNil'](_0x73fb41)){recordings[_0x481979['linkedid']][_0x61f7('0x28')][_0x61f7('0x29')]({'value':_0x481979[_0x61f7('0x22')]});}}}}catch(_0x4a44f8){utils[_0x61f7('0x16')](util[_0x61f7('0x3')](_0x61f7('0x20'),_0x481979[_0x61f7('0x6')]),_0x4a44f8);}};exports['hangup']=function(_0x11dff6){try{if(!_[_0x61f7('0x1a')](recordings[_0x11dff6[_0x61f7('0x6')]])){utils[_0x61f7('0x10')](util[_0x61f7('0x3')](_0x61f7('0x2a'),_0x11dff6[_0x61f7('0x6')]),_0x11dff6);utils[_0x61f7('0x2')](util[_0x61f7('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x11dff6[_0x61f7('0x6')],_0x11dff6['calleridnum'],_0x11dff6[_0x61f7('0x2b')],_0x11dff6[_0x61f7('0x2c')]));recordings[_0x11dff6[_0x61f7('0x6')]]['calleridnum']=_0x11dff6[_0x61f7('0x2d')];recordings[_0x11dff6[_0x61f7('0x6')]][_0x61f7('0x2b')]=_0x11dff6[_0x61f7('0x2b')];recordings[_0x11dff6[_0x61f7('0x6')]][_0x61f7('0x2e')]=_0x11dff6[_0x61f7('0x2e')];recordings[_0x11dff6[_0x61f7('0x6')]][_0x61f7('0x2f')]=_0x11dff6[_0x61f7('0x2f')];if(recordings[_0x11dff6[_0x61f7('0x6')]]['type']==_0x61f7('0x30')&&recordings[_0x11dff6[_0x61f7('0x6')]]['accountcode']){recordings[_0x11dff6[_0x61f7('0x6')]]['connectedlinenum']=recordings[_0x11dff6[_0x61f7('0x6')]]['accountcode'];recordings[_0x11dff6['uniqueid']][_0x61f7('0x2f')]='';}recordings[_0x11dff6[_0x61f7('0x6')]][_0x61f7('0x28')][_0x61f7('0x31')](function(_0x3dd254){var _0x522df5=_[_0x61f7('0x32')](recordings[_0x11dff6['uniqueid']]);_0x522df5[_0x61f7('0x22')]=_0x3dd254[_0x61f7('0x22')];writeDB(_0x522df5);});delete recordings[_0x11dff6[_0x61f7('0x6')]];}}catch(_0x5c506d){utils[_0x61f7('0x16')](util['format']('[%s][recordings][hangup]',_0x11dff6['uniqueid']),_0x5c506d);}};exports[_0x61f7('0x33')]=function(_0x53eb47){try{if(!_[_0x61f7('0x1a')](recordings[_0x53eb47[_0x61f7('0x6')]])){utils[_0x61f7('0x10')](util[_0x61f7('0x3')](_0x61f7('0x34'),_0x53eb47[_0x61f7('0x6')]),_0x53eb47);utils[_0x61f7('0x2')](util[_0x61f7('0x3')](_0x61f7('0x35'),_0x53eb47[_0x61f7('0x6')],_0x53eb47[_0x61f7('0x36')],_0x53eb47[_0x61f7('0x37')]));if(_0x53eb47[_0x61f7('0x36')][_0x61f7('0x38')]()==_0x61f7('0x39')&&_[_0x61f7('0x3a')](_0x53eb47[_0x61f7('0x37')]['toLowerCase'](),_0x61f7('0x3b'))){var _0x464178=_0x53eb47[_0x61f7('0x37')]['split']('=');var _0x5c80c8=_0x464178[0x0][_0x61f7('0x3c')](_0x464178[0x0]['lastIndexOf']('(')+0x1,_0x464178[0x0][_0x61f7('0x3d')](')'));var _0x3f4643=_0x464178[0x1];recordings[_0x53eb47['uniqueid']][_0x5c80c8]=_0x3f4643;}}}catch(_0x466d0b){utils['error'](util['format'](_0x61f7('0x34'),_0x53eb47[_0x61f7('0x6')]),_0x466d0b);}};exports[_0x61f7('0x3e')]=function(_0x27780b){try{if(!_[_0x61f7('0x1a')](recordings[_0x27780b[_0x61f7('0x6')]])){utils['debug'](util[_0x61f7('0x3')]('[%s][recordings][queuecallerjoin]',_0x27780b[_0x61f7('0x6')]),_0x27780b);utils[_0x61f7('0x2')](util[_0x61f7('0x3')](_0x61f7('0x3f'),_0x27780b[_0x61f7('0x6')],_0x27780b['queue']));recordings[_0x27780b['uniqueid']]['queue']=_0x27780b[_0x61f7('0x40')];}}catch(_0x38ac62){utils[_0x61f7('0x16')](util[_0x61f7('0x3')]('[%s][recordings][queuecallerjoin]',_0x27780b['uniqueid']),_0x38ac62);}};exports[_0x61f7('0x41')]=function(_0x31abb8){try{utils[_0x61f7('0x10')](util[_0x61f7('0x3')](_0x61f7('0x42'),_0x31abb8[_0x61f7('0x6')]),_0x31abb8);utils[_0x61f7('0x2')](util['format'](_0x61f7('0x43'),_0x31abb8['uniqueid'],_0x31abb8[_0x61f7('0x44')],_0x31abb8[_0x61f7('0x45')],_0x31abb8[_0x61f7('0x46')],_0x31abb8['transfereecalleridname']));if(recordings[_0x31abb8[_0x61f7('0x47')]]&&transfers[_0x61f7('0x5')][_0x31abb8[_0x61f7('0x47')]]){transfers['blinds'][_0x31abb8['transfereruniqueid']][_0x61f7('0x48')]=!![];}}catch(_0x1aae8b){utils[_0x61f7('0x16')](util[_0x61f7('0x3')](_0x61f7('0x42'),_0x31abb8[_0x61f7('0x6')]),_0x1aae8b);}}; \ No newline at end of file +var _0xef5b=['lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','lodash','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','transfereeuniqueid','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','blinds','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','newstate','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','[%s][recordings][newstate]','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','substring'];(function(_0x112a0f,_0x5d4daf){var _0x570da3=function(_0x47f138){while(--_0x47f138){_0x112a0f['push'](_0x112a0f['shift']());}};_0x570da3(++_0x5d4daf);}(_0xef5b,0x16f));var _0xbef5=function(_0x5009ed,_0x476a42){_0x5009ed=_0x5009ed-0x0;var _0x326706=_0xef5b[_0x5009ed];return _0x326706;};'use strict';var _=require(_0xbef5('0x0'));var util=require('util');var utils=require(_0xbef5('0x1'));var transfers=require(_0xbef5('0x2'));var recordings={};function writeDB(_0x5e4be3){var _0xf07c13;utils[_0xbef5('0x3')](util[_0xbef5('0x4')](_0xbef5('0x5'),_0x5e4be3[_0xbef5('0x6')]));if(transfers['blinds'][_0x5e4be3[_0xbef5('0x6')]]){_0xf07c13=_0x5e4be3[_0xbef5('0x6')];_0x5e4be3[_0xbef5('0x6')]=transfers['blinds'][_0x5e4be3[_0xbef5('0x6')]][_0xbef5('0x7')];}if(_0x5e4be3[_0xbef5('0x8')]){utils['getUserByInternal'](_0x5e4be3[_0xbef5('0x8')])[_0xbef5('0x9')](function(_0x5c43b8){if(_0x5c43b8){_0x5e4be3[_0xbef5('0xa')]=_0x5c43b8[_0xbef5('0xb')];_0x5e4be3[_0xbef5('0xc')]=_0x5c43b8['id'];}utils[_0xbef5('0xd')](_0xbef5('0xe'),_0x5e4be3);});}else{utils[_0xbef5('0xd')](_0xbef5('0xe'),_0x5e4be3);}if(_0xf07c13)delete transfers[_0xbef5('0xf')][_0xf07c13];}exports['newchannel']=function(_0x3ca6ad){try{utils[_0xbef5('0x10')](util[_0xbef5('0x4')]('[%s][recordings][newchannel]',_0x3ca6ad[_0xbef5('0x6')]),_0x3ca6ad);if(_0x3ca6ad['uniqueid']==_0x3ca6ad[_0xbef5('0x11')]){utils[_0xbef5('0x3')](util['format'](_0xbef5('0x12'),_0x3ca6ad[_0xbef5('0x6')],_0x3ca6ad['context'],_0x3ca6ad[_0xbef5('0x13')]));recordings[_0x3ca6ad['uniqueid']]={'uniqueid':_0x3ca6ad[_0xbef5('0x6')],'accountcode':_0x3ca6ad['accountcode'],'exten':_0x3ca6ad[_0xbef5('0x13')],'context':_0x3ca6ad[_0xbef5('0x14')],'channel':_0x3ca6ad['channel'],'monitors':[]};}}catch(_0x37c1ce){utils['error'](util['format']('[%s][recordings][newchannel]',_0x3ca6ad[_0xbef5('0x6')]),_0x37c1ce);}};exports[_0xbef5('0x15')]=function(_0x390855){try{utils[_0xbef5('0x10')](util[_0xbef5('0x4')]('[%s][recordings][newstate]',_0x390855[_0xbef5('0x6')]),_0x390855);if(!_[_0xbef5('0x16')](recordings[_0x390855[_0xbef5('0x6')]])&&_0x390855['channelstate']==0x6){utils['info'](util[_0xbef5('0x4')](_0xbef5('0x17'),_0x390855[_0xbef5('0x6')],_0x390855[_0xbef5('0x14')],_0x390855['channel']));}else if(!_['isNil'](recordings[_0x390855[_0xbef5('0x11')]])&&_0x390855[_0xbef5('0x18')]==0x6&&_0x390855[_0xbef5('0x14')]!=_0xbef5('0x19')){utils['info'](util[_0xbef5('0x4')](_0xbef5('0x1a'),_0x390855[_0xbef5('0x6')],_0x390855[_0xbef5('0x11')],_0x390855[_0xbef5('0x14')],_0x390855['channel']));recordings[_0x390855[_0xbef5('0x11')]][_0xbef5('0x8')]=_0x390855[_0xbef5('0x8')];}}catch(_0x26fc7e){utils[_0xbef5('0x1b')](util[_0xbef5('0x4')](_0xbef5('0x1c'),_0x390855[_0xbef5('0x6')]),_0x26fc7e);}};exports['varset']=function(_0xf312f4){try{if(!_[_0xbef5('0x16')](_0xf312f4['variable'])&&!_['isNil'](_0xf312f4[_0xbef5('0x1d')][_0xbef5('0x1e')])){utils['debug'](util[_0xbef5('0x4')](_0xbef5('0x1f'),_0xf312f4[_0xbef5('0x6')]),_0xf312f4);utils[_0xbef5('0x3')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0xf312f4[_0xbef5('0x6')],_0xf312f4['variable'],_0xf312f4[_0xbef5('0x20')]));if(_[_0xbef5('0x21')](_0xf312f4['value'],_0xbef5('0x22'))){_0xf312f4[_0xbef5('0x20')]=_0xf312f4['value'][_0xbef5('0x23')](_0xbef5('0x22'),_0xbef5('0x24'));}if(recordings[_0xf312f4[_0xbef5('0x11')]]){var _0x20bdc5=_[_0xbef5('0x25')](recordings[_0xf312f4[_0xbef5('0x11')]][_0xbef5('0x26')],{'value':_0xf312f4['value']});if(_[_0xbef5('0x16')](_0x20bdc5)){recordings[_0xf312f4[_0xbef5('0x11')]]['monitors'][_0xbef5('0x27')]({'value':_0xf312f4[_0xbef5('0x20')]});}}}}catch(_0x12d2d9){utils[_0xbef5('0x1b')](util[_0xbef5('0x4')](_0xbef5('0x1f'),_0xf312f4[_0xbef5('0x6')]),_0x12d2d9);}};exports[_0xbef5('0x28')]=function(_0xc36147){try{if(!_[_0xbef5('0x16')](recordings[_0xc36147[_0xbef5('0x6')]])){utils[_0xbef5('0x10')](util['format'](_0xbef5('0x29'),_0xc36147[_0xbef5('0x6')]),_0xc36147);utils[_0xbef5('0x3')](util['format'](_0xbef5('0x2a'),_0xc36147[_0xbef5('0x6')],_0xc36147[_0xbef5('0x2b')],_0xc36147[_0xbef5('0x2c')],_0xc36147['cause-txt']));recordings[_0xc36147[_0xbef5('0x6')]]['calleridnum']=_0xc36147[_0xbef5('0x2b')];recordings[_0xc36147[_0xbef5('0x6')]][_0xbef5('0x2c')]=_0xc36147[_0xbef5('0x2c')];recordings[_0xc36147[_0xbef5('0x6')]][_0xbef5('0x2d')]=_0xc36147[_0xbef5('0x2d')];recordings[_0xc36147[_0xbef5('0x6')]][_0xbef5('0x2e')]=_0xc36147[_0xbef5('0x2e')];if(recordings[_0xc36147[_0xbef5('0x6')]][_0xbef5('0x2f')]==_0xbef5('0x30')&&recordings[_0xc36147[_0xbef5('0x6')]][_0xbef5('0x8')]){recordings[_0xc36147[_0xbef5('0x6')]][_0xbef5('0x2d')]=recordings[_0xc36147[_0xbef5('0x6')]][_0xbef5('0x8')];recordings[_0xc36147[_0xbef5('0x6')]][_0xbef5('0x2e')]='';}recordings[_0xc36147['uniqueid']]['monitors']['forEach'](function(_0x29ca9f){var _0x172995=_[_0xbef5('0x31')](recordings[_0xc36147[_0xbef5('0x6')]]);_0x172995[_0xbef5('0x20')]=_0x29ca9f['value'];writeDB(_0x172995);});delete recordings[_0xc36147[_0xbef5('0x6')]];}}catch(_0x3c134a){utils[_0xbef5('0x1b')](util[_0xbef5('0x4')](_0xbef5('0x29'),_0xc36147[_0xbef5('0x6')]),_0x3c134a);}};exports[_0xbef5('0x32')]=function(_0x545f5a){try{if(!_[_0xbef5('0x16')](recordings[_0x545f5a[_0xbef5('0x6')]])){utils[_0xbef5('0x10')](util[_0xbef5('0x4')](_0xbef5('0x33'),_0x545f5a[_0xbef5('0x6')]),_0x545f5a);utils[_0xbef5('0x3')](util[_0xbef5('0x4')](_0xbef5('0x34'),_0x545f5a[_0xbef5('0x6')],_0x545f5a[_0xbef5('0x35')],_0x545f5a[_0xbef5('0x36')]));if(_0x545f5a[_0xbef5('0x35')][_0xbef5('0x37')]()=='set'&&_[_0xbef5('0x38')](_0x545f5a[_0xbef5('0x36')][_0xbef5('0x37')](),'cdr')){var _0x20a7c5=_0x545f5a['appdata'][_0xbef5('0x39')]('=');var _0x4eaa92=_0x20a7c5[0x0][_0xbef5('0x3a')](_0x20a7c5[0x0][_0xbef5('0x3b')]('(')+0x1,_0x20a7c5[0x0]['lastIndexOf'](')'));var _0x5493d6=_0x20a7c5[0x1];recordings[_0x545f5a[_0xbef5('0x6')]][_0x4eaa92]=_0x5493d6;}}}catch(_0x855011){utils[_0xbef5('0x1b')](util[_0xbef5('0x4')](_0xbef5('0x33'),_0x545f5a[_0xbef5('0x6')]),_0x855011);}};exports[_0xbef5('0x3c')]=function(_0x33ea5e){try{if(!_['isNil'](recordings[_0x33ea5e[_0xbef5('0x6')]])){utils['debug'](util[_0xbef5('0x4')](_0xbef5('0x3d'),_0x33ea5e[_0xbef5('0x6')]),_0x33ea5e);utils['info'](util[_0xbef5('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x33ea5e[_0xbef5('0x6')],_0x33ea5e[_0xbef5('0x3e')]));recordings[_0x33ea5e[_0xbef5('0x6')]][_0xbef5('0x3e')]=_0x33ea5e['queue'];}}catch(_0x261da6){utils[_0xbef5('0x1b')](util[_0xbef5('0x4')](_0xbef5('0x3d'),_0x33ea5e[_0xbef5('0x6')]),_0x261da6);}};exports[_0xbef5('0x3f')]=function(_0x1d7fc8){try{utils[_0xbef5('0x10')](util['format'](_0xbef5('0x40'),_0x1d7fc8[_0xbef5('0x6')]),_0x1d7fc8);utils[_0xbef5('0x3')](util[_0xbef5('0x4')](_0xbef5('0x41'),_0x1d7fc8['uniqueid'],_0x1d7fc8[_0xbef5('0x42')],_0x1d7fc8[_0xbef5('0x43')],_0x1d7fc8[_0xbef5('0x44')],_0x1d7fc8['transfereecalleridname']));if(recordings[_0x1d7fc8[_0xbef5('0x45')]]&&transfers['blinds'][_0x1d7fc8['transfereruniqueid']]){transfers[_0xbef5('0xf')][_0x1d7fc8[_0xbef5('0x45')]][_0xbef5('0x46')]=!![];}}catch(_0x1b374d){utils[_0xbef5('0x1b')](util['format']('[%s][recordings][blindtransfer]',_0x1d7fc8[_0xbef5('0x6')]),_0x1b374d);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 481943a..37fe417 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 _0xd99e=['attended','origtransfereruniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','[%s][transfers][attendedtransfer]','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xd99e,0x1ce));var _0xed99=function(_0x38fb8b,_0x70dd0a){_0x38fb8b=_0x38fb8b-0x0;var _0x1ec681=_0xd99e[_0x38fb8b];return _0x1ec681;};'use strict';var _=require('lodash');var util=require(_0xed99('0x0'));var utils=require(_0xed99('0x1'));function writeDB(_0x18fc0c){utils[_0xed99('0x2')](util[_0xed99('0x3')](_0xed99('0x4'),_0x18fc0c[_0xed99('0x5')]===_0xed99('0x6')?_0x18fc0c[_0xed99('0x7')]:_0x18fc0c['uniqueid'],_0x18fc0c[_0xed99('0x5')]));utils[_0xed99('0x8')](_0xed99('0x9'),_0x18fc0c);}exports[_0xed99('0xa')]={};exports[_0xed99('0xb')]=function(_0x2636e4){try{utils[_0xed99('0xc')](util['format'](_0xed99('0xd'),_0x2636e4[_0xed99('0xe')]),_0x2636e4);utils[_0xed99('0x2')](util['format'](_0xed99('0xf'),_0x2636e4[_0xed99('0xe')],_0x2636e4[_0xed99('0x10')],_0x2636e4[_0xed99('0x11')],_0x2636e4[_0xed99('0x12')],_0x2636e4[_0xed99('0x13')]));_0x2636e4[_0xed99('0x5')]=_0xed99('0x14');exports['blinds'][_0x2636e4[_0xed99('0x15')]]=_0x2636e4;writeDB(_0x2636e4);}catch(_0x5852a7){utils[_0xed99('0x16')](util[_0xed99('0x3')](_0xed99('0xd'),_0x2636e4['uniqueid']),_0x5852a7);}};exports['attendedtransfer']=function(_0x446c52){try{utils[_0xed99('0xc')](util[_0xed99('0x3')]('[%s][transfers][attendedtransfer]',_0x446c52[_0xed99('0x7')]),_0x446c52);utils['info'](util[_0xed99('0x3')](_0xed99('0x17'),_0x446c52[_0xed99('0x7')],_0x446c52['origtransferercalleridnum'],_0x446c52['origtransferercalleridname'],_0x446c52[_0xed99('0x18')],_0x446c52['transfertargetcalleridname']));_0x446c52=_[_0xed99('0x19')](_0x446c52,{'transfererchannel':_0x446c52[_0xed99('0x1a')],'transferercalleridnum':_0x446c52['origtransferercalleridnum'],'transferercalleridname':_0x446c52['origtransferercalleridname'],'transfererconnectedlinenum':_0x446c52[_0xed99('0x1b')],'transfererconnectedlinename':_0x446c52['secondtransfererconnectedlinename'],'transfereraccountcode':_0x446c52[_0xed99('0x1c')],'transferercontext':_0x446c52['secondtransferercontext'],'transfererexten':_0x446c52['secondtransfererexten'],'transfererlinkedid':_0x446c52[_0xed99('0x1d')],'context':_0x446c52[_0xed99('0x1e')],'extension':_0x446c52[_0xed99('0x1f')],'type':'attended'});if(_[_0xed99('0x20')](_0x446c52[_0xed99('0x21')])){_0x446c52=_[_0xed99('0x19')](_0x446c52,{'transfereechannel':_0x446c52['transfertargetchannel'],'transfereecalleridnum':_0x446c52[_0xed99('0x18')],'transfereecalleridname':_0x446c52[_0xed99('0x22')],'transfereeconnectedlinenum':_0x446c52['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x446c52[_0xed99('0x23')],'transfereeaccountcode':_0x446c52[_0xed99('0x24')],'transfereecontext':_0x446c52[_0xed99('0x25')],'transfereeexten':_0x446c52['transfertargetexten'],'transfereelinkedid':_0x446c52['transfertargetlinkedid']});}writeDB(_0x446c52);}catch(_0x1d876f){utils['error'](util[_0xed99('0x3')](_0xed99('0x26'),_0x446c52['origtransfereruniqueid']),_0x1d876f);}}; \ No newline at end of file +var _0x9e86=['transfertargetexten','transfertargetlinkedid','error','lodash','./utils','info','format','type','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','blind','[%s][transfers][blindtransfer]','attendedtransfer','debug','[%s][transfers][attendedtransfer]','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x1f635c,_0x4d8532){var _0x472cc8=function(_0x5eb126){while(--_0x5eb126){_0x1f635c['push'](_0x1f635c['shift']());}};_0x472cc8(++_0x4d8532);}(_0x9e86,0xc1));var _0x69e8=function(_0x34d0c0,_0x105e5f){_0x34d0c0=_0x34d0c0-0x0;var _0x91c92f=_0x9e86[_0x34d0c0];return _0x91c92f;};'use strict';var _=require(_0x69e8('0x0'));var util=require('util');var utils=require(_0x69e8('0x1'));function writeDB(_0x13173e){utils[_0x69e8('0x2')](util[_0x69e8('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x13173e[_0x69e8('0x4')]==='attended'?_0x13173e[_0x69e8('0x5')]:_0x13173e[_0x69e8('0x6')],_0x13173e['type']));utils['request'](_0x69e8('0x7'),_0x13173e);}exports[_0x69e8('0x8')]={};exports['blindtransfer']=function(_0x25cc4e){try{utils['debug'](util[_0x69e8('0x3')]('[%s][transfers][blindtransfer]',_0x25cc4e['uniqueid']),_0x25cc4e);utils[_0x69e8('0x2')](util[_0x69e8('0x3')](_0x69e8('0x9'),_0x25cc4e[_0x69e8('0x6')],_0x25cc4e['transferercalleridnum'],_0x25cc4e[_0x69e8('0xa')],_0x25cc4e['transfereecalleridnum'],_0x25cc4e[_0x69e8('0xb')]));_0x25cc4e[_0x69e8('0x4')]=_0x69e8('0xc');exports[_0x69e8('0x8')][_0x25cc4e['transfereruniqueid']]=_0x25cc4e;writeDB(_0x25cc4e);}catch(_0x4f3348){utils['error'](util[_0x69e8('0x3')](_0x69e8('0xd'),_0x25cc4e['uniqueid']),_0x4f3348);}};exports[_0x69e8('0xe')]=function(_0x439df8){try{utils[_0x69e8('0xf')](util['format'](_0x69e8('0x10'),_0x439df8[_0x69e8('0x5')]),_0x439df8);utils[_0x69e8('0x2')](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x439df8[_0x69e8('0x5')],_0x439df8['origtransferercalleridnum'],_0x439df8['origtransferercalleridname'],_0x439df8['transfertargetcalleridnum'],_0x439df8[_0x69e8('0x11')]));_0x439df8=_[_0x69e8('0x12')](_0x439df8,{'transfererchannel':_0x439df8[_0x69e8('0x13')],'transferercalleridnum':_0x439df8[_0x69e8('0x14')],'transferercalleridname':_0x439df8['origtransferercalleridname'],'transfererconnectedlinenum':_0x439df8[_0x69e8('0x15')],'transfererconnectedlinename':_0x439df8[_0x69e8('0x16')],'transfereraccountcode':_0x439df8[_0x69e8('0x17')],'transferercontext':_0x439df8[_0x69e8('0x18')],'transfererexten':_0x439df8[_0x69e8('0x19')],'transfererlinkedid':_0x439df8['origtransfererlinkedid'],'context':_0x439df8[_0x69e8('0x1a')],'extension':_0x439df8[_0x69e8('0x1b')],'type':_0x69e8('0x1c')});if(_[_0x69e8('0x1d')](_0x439df8[_0x69e8('0x1e')])){_0x439df8=_[_0x69e8('0x12')](_0x439df8,{'transfereechannel':_0x439df8[_0x69e8('0x1f')],'transfereecalleridnum':_0x439df8['transfertargetcalleridnum'],'transfereecalleridname':_0x439df8['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x439df8['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x439df8[_0x69e8('0x20')],'transfereeaccountcode':_0x439df8[_0x69e8('0x21')],'transfereecontext':_0x439df8[_0x69e8('0x22')],'transfereeexten':_0x439df8[_0x69e8('0x23')],'transfereelinkedid':_0x439df8[_0x69e8('0x24')]});}writeDB(_0x439df8);}catch(_0x2ba871){utils[_0x69e8('0x25')](util[_0x69e8('0x3')]('[%s][transfers][attendedtransfer]',_0x439df8[_0x69e8('0x5')]),_0x2ba871);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 0002b28..78f8e69 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 _0xb54a=['catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','getUserByInternal','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','result','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','util','client','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s'];(function(_0x2832c5,_0x468e93){var _0x381e07=function(_0x49af83){while(--_0x49af83){_0x2832c5['push'](_0x2832c5['shift']());}};_0x381e07(++_0x468e93);}(_0xb54a,0x84));var _0xab54=function(_0x5a962f,_0x1c152b){_0x5a962f=_0x5a962f-0x0;var _0x140d10=_0xb54a[_0x5a962f];return _0x140d10;};'use strict';var BPromise=require(_0xab54('0x0'));var jayson=require(_0xab54('0x1'));var moment=require('moment');var util=require(_0xab54('0x2'));var client=jayson[_0xab54('0x3')]['http']({'port':0x2329});var logger=require(_0xab54('0x4'))('xdr');exports['info']=function(_0x40148f,_0x23eab5){logger[_0xab54('0x5')](_0x40148f,_0x23eab5?util[_0xab54('0x6')](_0x23eab5,{'showHidden':![],'depth':null}):'');};exports[_0xab54('0x7')]=function(_0x52fd49,_0x13e9d0){logger[_0xab54('0x7')](_0x52fd49,_0x13e9d0?util[_0xab54('0x6')](_0x13e9d0,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x4ed26c,_0x54ddf9){logger[_0xab54('0x8')](_0x4ed26c,_0x54ddf9?util['inspect'](_0x54ddf9,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x48373c,_0x5221bb){return client[_0xab54('0x9')](_0x48373c,{'body':_0x5221bb})[_0xab54('0xa')](function(_0x15fa81){logger['debug'](_0xab54('0xb'),_0x48373c,_0x15fa81?util[_0xab54('0x6')](_0x15fa81,{'showHidden':![],'depth':null}):'');})[_0xab54('0xc')](function(_0x5d3c24){logger[_0xab54('0x8')](_0xab54('0xb'),_0x48373c,_0x5d3c24?util[_0xab54('0x6')](_0x5d3c24,{'showHidden':![],'depth':null}):'');});};function getUser(_0x399a6a){return client[_0xab54('0x9')](_0xab54('0xd'),{'options':{'raw':!![],'attributes':['id',_0xab54('0xe'),_0xab54('0xf'),_0xab54('0x10')],'where':_0x399a6a,'limit':0x1}})[_0xab54('0xa')](function(_0x15445a){logger[_0xab54('0x7')](_0xab54('0x11'),JSON[_0xab54('0x12')](_0x399a6a),_0x15445a?util[_0xab54('0x6')](_0x15445a,{'showHidden':![],'depth':null}):'');return _0x15445a['result'][_0xab54('0x13')]?_0x15445a['result'][0x0]:null;});}exports[_0xab54('0x14')]=function(_0xf37a88){return new BPromise(function(_0x583a1d,_0x402977){if(_0xf37a88){return getUser({'internal':_0xf37a88})[_0xab54('0xa')](function(_0x2d4e15){logger[_0xab54('0x5')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0xf37a88,_0x2d4e15?'found':_0xab54('0x15'));return _0x583a1d(_0x2d4e15);})[_0xab54('0xc')](function(_0x4e5ce2){logger[_0xab54('0x8')](_0xab54('0x16'),_0x4e5ce2?util[_0xab54('0x6')](_0x4e5ce2,{'showHidden':![],'depth':null}):'');return _0x583a1d(null);});}return _0x583a1d(null);});};exports[_0xab54('0x17')]=function(_0x320215){return new BPromise(function(_0x2bb8ee,_0x1fa48f){if(_0x320215){return getUser({'interface':_0x320215})[_0xab54('0xa')](function(_0x366ed0){logger['info'](_0xab54('0x18'),_0x320215,_0x366ed0?_0xab54('0x19'):'notfound');return _0x2bb8ee(_0x366ed0);})['catch'](function(_0x472c87){logger[_0xab54('0x8')](_0xab54('0x1a'),_0x472c87?util[_0xab54('0x6')](_0x472c87,{'showHidden':![],'depth':null}):'');return _0x2bb8ee(null);});}return _0x2bb8ee(null);});};exports[_0xab54('0x1b')]=function(_0xa00a53){return new BPromise(function(_0x20717e,_0x2b0467){if(_0xa00a53){return getUser({'name':_0xa00a53})[_0xab54('0xa')](function(_0x4a63ce){logger['info'](_0xab54('0x1c'),_0xa00a53,_0x4a63ce?_0xab54('0x19'):_0xab54('0x15'));return _0x20717e(_0x4a63ce);})[_0xab54('0xc')](function(_0x31b1f2){logger[_0xab54('0x8')](_0xab54('0x1d'),_0x31b1f2?util[_0xab54('0x6')](_0x31b1f2,{'showHidden':![],'depth':null}):'');return _0x20717e(null);});}return _0x20717e(null);});};exports['getVoiceQueueByName']=function(_0x1035d1){return new BPromise(function(_0x3b60c2,_0x5b4157){if(_0x1035d1){return client[_0xab54('0x9')](_0xab54('0x1e'),{'options':{'raw':!![],'attributes':['id','name','type',_0xab54('0x1f'),_0xab54('0x20')],'where':{'name':_0x1035d1},'limit':0x1}})[_0xab54('0xa')](function(_0x443e19){logger[_0xab54('0x7')](_0xab54('0x21'),_0x1035d1,_0x443e19?util[_0xab54('0x6')](_0x443e19,{'showHidden':![],'depth':null}):'');logger[_0xab54('0x5')](_0xab54('0x22'),_0x1035d1,_0x443e19?_0xab54('0x19'):_0xab54('0x15'));return _0x3b60c2(_0x443e19[_0xab54('0x23')][_0xab54('0x13')]?_0x443e19[_0xab54('0x23')][0x0]:null);})[_0xab54('0xc')](function(_0x90d353){logger[_0xab54('0x8')]('[utils][getVoiceQueueByName]',_0x90d353?util['inspect'](_0x90d353,{'showHidden':![],'depth':null}):'');return _0x3b60c2(null);});}return _0x3b60c2(null);});};exports['addTime']=function(_0x2d708c,_0x1d2c58){return moment(_0x2d708c)[_0xab54('0x24')](_0x1d2c58,_0xab54('0x25'))[_0xab54('0x26')](_0xab54('0x27'));};exports[_0xab54('0x28')]=function(_0x57d92f,_0x121ba6){return moment(_0x57d92f)[_0xab54('0x29')](_0x121ba6,_0xab54('0x25'))[_0xab54('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xab54('0x2a')]=function(_0x36e3ce,_0x42d043){return moment(_0x36e3ce)[_0xab54('0x2b')](moment(_0x42d043),_0xab54('0x25'));};exports[_0xab54('0x2c')]=function(_0x65d616,_0x4c60e4){return parseInt(_0x65d616,0xa)+parseInt(_0x4c60e4,0xa);};exports[_0xab54('0x2d')]=function(){return moment()['format'](_0xab54('0x27'));};exports[_0xab54('0x2e')]=function(_0x886134,_0x498413){if(_0x498413){return moment(_0x886134)[_0xab54('0x2e')](_0x498413);}return!![];};exports[_0xab54('0x2f')]=function(_0x188b50,_0xacb94a){if(_0xacb94a){return moment(_0x188b50)[_0xab54('0x2f')](_0xacb94a);}else if(_0x188b50){return!![];}return![];}; \ No newline at end of file +var _0x667c=['GetUser','internal','name','interface','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','sumTime','now','isAfter','isBefore','bluebird','util','client','http','../../config/logger','info','inspect','debug','error','request','then','[utils][request]\x20name:%s'];(function(_0x19aee6,_0xcb2918){var _0x511975=function(_0x4fbb42){while(--_0x4fbb42){_0x19aee6['push'](_0x19aee6['shift']());}};_0x511975(++_0xcb2918);}(_0x667c,0xcb));var _0xc667=function(_0x58fa4c,_0x336670){_0x58fa4c=_0x58fa4c-0x0;var _0x33d73f=_0x667c[_0x58fa4c];return _0x33d73f;};'use strict';var BPromise=require(_0xc667('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require(_0xc667('0x1'));var client=jayson[_0xc667('0x2')][_0xc667('0x3')]({'port':0x2329});var logger=require(_0xc667('0x4'))('xdr');exports['info']=function(_0x341efd,_0x3dd155){logger[_0xc667('0x5')](_0x341efd,_0x3dd155?util[_0xc667('0x6')](_0x3dd155,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x539ada,_0x2eb8d0){logger[_0xc667('0x7')](_0x539ada,_0x2eb8d0?util[_0xc667('0x6')](_0x2eb8d0,{'showHidden':![],'depth':null}):'');};exports[_0xc667('0x8')]=function(_0x3c616a,_0x2543a7){logger[_0xc667('0x8')](_0x3c616a,_0x2543a7?util['inspect'](_0x2543a7,{'showHidden':![],'depth':null}):'');};exports[_0xc667('0x9')]=function(_0x13386f,_0x13b5e6){return client[_0xc667('0x9')](_0x13386f,{'body':_0x13b5e6})[_0xc667('0xa')](function(_0x4e9ab2){logger[_0xc667('0x7')]('[utils][request]\x20name:%s',_0x13386f,_0x4e9ab2?util[_0xc667('0x6')](_0x4e9ab2,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x31819e){logger[_0xc667('0x8')](_0xc667('0xb'),_0x13386f,_0x31819e?util[_0xc667('0x6')](_0x31819e,{'showHidden':![],'depth':null}):'');});};function getUser(_0x7d6e7f){return client[_0xc667('0x9')](_0xc667('0xc'),{'options':{'raw':!![],'attributes':['id',_0xc667('0xd'),_0xc667('0xe'),_0xc667('0xf')],'where':_0x7d6e7f,'limit':0x1}})[_0xc667('0xa')](function(_0x4ea9df){logger[_0xc667('0x7')]('[utils][getUser]\x20where:%s',JSON['stringify'](_0x7d6e7f),_0x4ea9df?util[_0xc667('0x6')](_0x4ea9df,{'showHidden':![],'depth':null}):'');return _0x4ea9df[_0xc667('0x10')][_0xc667('0x11')]?_0x4ea9df[_0xc667('0x10')][0x0]:null;});}exports['getUserByInternal']=function(_0x170b3c){return new BPromise(function(_0x230d52,_0x4436c9){if(_0x170b3c){return getUser({'internal':_0x170b3c})[_0xc667('0xa')](function(_0x4c626f){logger[_0xc667('0x5')](_0xc667('0x12'),_0x170b3c,_0x4c626f?_0xc667('0x13'):_0xc667('0x14'));return _0x230d52(_0x4c626f);})[_0xc667('0x15')](function(_0x2d0500){logger['error']('[utils][getUserByInternal]',_0x2d0500?util[_0xc667('0x6')](_0x2d0500,{'showHidden':![],'depth':null}):'');return _0x230d52(null);});}return _0x230d52(null);});};exports[_0xc667('0x16')]=function(_0x94c6f2){return new BPromise(function(_0x58e5b8,_0x484051){if(_0x94c6f2){return getUser({'interface':_0x94c6f2})[_0xc667('0xa')](function(_0x2d7dbd){logger[_0xc667('0x5')](_0xc667('0x17'),_0x94c6f2,_0x2d7dbd?_0xc667('0x13'):_0xc667('0x14'));return _0x58e5b8(_0x2d7dbd);})[_0xc667('0x15')](function(_0x58bf7b){logger[_0xc667('0x8')](_0xc667('0x18'),_0x58bf7b?util['inspect'](_0x58bf7b,{'showHidden':![],'depth':null}):'');return _0x58e5b8(null);});}return _0x58e5b8(null);});};exports['getUserByName']=function(_0x5149dd){return new BPromise(function(_0x42c65d,_0x5be792){if(_0x5149dd){return getUser({'name':_0x5149dd})[_0xc667('0xa')](function(_0x1261aa){logger[_0xc667('0x5')](_0xc667('0x19'),_0x5149dd,_0x1261aa?'found':_0xc667('0x14'));return _0x42c65d(_0x1261aa);})[_0xc667('0x15')](function(_0xe7cc19){logger[_0xc667('0x8')](_0xc667('0x1a'),_0xe7cc19?util[_0xc667('0x6')](_0xe7cc19,{'showHidden':![],'depth':null}):'');return _0x42c65d(null);});}return _0x42c65d(null);});};exports[_0xc667('0x1b')]=function(_0x2f992a){return new BPromise(function(_0x1e91da,_0x4c5d16){if(_0x2f992a){return client[_0xc667('0x9')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xc667('0xe'),_0xc667('0x1c'),'acw',_0xc667('0x1d')],'where':{'name':_0x2f992a},'limit':0x1}})['then'](function(_0x2dffa3){logger[_0xc667('0x7')](_0xc667('0x1e'),_0x2f992a,_0x2dffa3?util[_0xc667('0x6')](_0x2dffa3,{'showHidden':![],'depth':null}):'');logger['info'](_0xc667('0x1f'),_0x2f992a,_0x2dffa3?_0xc667('0x13'):_0xc667('0x14'));return _0x1e91da(_0x2dffa3['result'][_0xc667('0x11')]?_0x2dffa3[_0xc667('0x10')][0x0]:null);})[_0xc667('0x15')](function(_0xaa32c1){logger[_0xc667('0x8')](_0xc667('0x20'),_0xaa32c1?util[_0xc667('0x6')](_0xaa32c1,{'showHidden':![],'depth':null}):'');return _0x1e91da(null);});}return _0x1e91da(null);});};exports['addTime']=function(_0x53643b,_0x5c2b9d){return moment(_0x53643b)['add'](_0x5c2b9d,'seconds')[_0xc667('0x21')](_0xc667('0x22'));};exports[_0xc667('0x23')]=function(_0x44acee,_0xa45446){return moment(_0x44acee)[_0xc667('0x24')](_0xa45446,_0xc667('0x25'))[_0xc667('0x21')](_0xc667('0x22'));};exports[_0xc667('0x26')]=function(_0x241c11,_0x35b7de){return moment(_0x241c11)['diff'](moment(_0x35b7de),_0xc667('0x25'));};exports[_0xc667('0x27')]=function(_0xc8637,_0x271d56){return parseInt(_0xc8637,0xa)+parseInt(_0x271d56,0xa);};exports[_0xc667('0x28')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xc667('0x29')]=function(_0x17d046,_0x308e95){if(_0x308e95){return moment(_0x17d046)[_0xc667('0x29')](_0x308e95);}return!![];};exports[_0xc667('0x2a')]=function(_0x133523,_0x218d05){if(_0x218d05){return moment(_0x133523)[_0xc667('0x2a')](_0x218d05);}else if(_0x133523){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 997d974..cca5ff5 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 _0x8984=['responseTime','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','agent_id','method','x-forwarded-for','url','device','agent_name','test','setupLoggers','fs-extra','express-winston','path','util','./loggers','fileLogger','maskSensitiveData','join','/var','client','role','name','ensureDir','then','catch','user','no-user','timestamp','error','api','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','format','headers','connection','remoteAddress','statusCode'];(function(_0x22fd75,_0x2fcd94){var _0x1219dd=function(_0x3e25a6){while(--_0x3e25a6){_0x22fd75['push'](_0x22fd75['shift']());}};_0x1219dd(++_0x2fcd94);}(_0x8984,0x1bb));var _0x4898=function(_0x53eae5,_0x5f1dd2){_0x53eae5=_0x53eae5-0x0;var _0x249d91=_0x8984[_0x53eae5];return _0x249d91;};var fs=require(_0x4898('0x0'));var _=require('lodash');var ewinston=require(_0x4898('0x1'));var path=require(_0x4898('0x2'));var util=require(_0x4898('0x3'));var fileLogger=require(_0x4898('0x4'))[_0x4898('0x5')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')[_0x4898('0x6')];function ClientSideLogger(){function _0x177aa2(_0x5aa992){var _0x3a25bd=path[_0x4898('0x7')](_0x4898('0x8'),'log','xcally');var _0x3cc7fe=path['join'](_0x4898('0x9'),_0x5aa992[_0x4898('0xa')]+'-'+_0x5aa992[_0x4898('0xb')]);return fs[_0x4898('0xc')](path[_0x4898('0x7')](_0x3a25bd,_0x3cc7fe))[_0x4898('0xd')](function(){var _0x1ac27a=fileLogger(_0x4898('0x9'),path[_0x4898('0x7')](_0x3a25bd,_0x3cc7fe));return _0x1ac27a;})[_0x4898('0xe')](function(_0xf83e54){throw _0xf83e54;});}this['log']=function(_0x460402,_0x5ca1ad,_0x54a975,_0x34cc70){return _0x177aa2(_0x460402[_0x4898('0xf')])[_0x4898('0xd')](function(_0x30d596){var _0x103775=_0x30d596[_0x5ca1ad];return _0x103775;})[_0x4898('0xd')](function(_0x1ce223){var _0xad1cfa=_0x460402[_0x4898('0xf')]?_0x460402[_0x4898('0xf')]['id']:_0x4898('0x10');var _0x4c1bb4=_0x34cc70['data'];var _0x296024=_0x34cc70[_0x4898('0x11')];var _0x5b8104=new Date(Number(_0x296024));return _0x1ce223(_0xad1cfa,_0x5b8104,_0x54a975,_0x4c1bb4);})[_0x4898('0xe')](function(_0x8621d0){fileLogger('client')[_0x4898('0x12')](_0x8621d0);});};}function setupLoggers(_0x58f6dd){return new Promise(function(_0x1f0754){var _0x13c974=new ClientSideLogger();var _0x320016=fileLogger(_0x4898('0x13'));var _0x289a1c=fileLogger(_0x4898('0x14'));_0x58f6dd[_0x4898('0x15')](_0x4898('0x16'),_0x13c974);_0x58f6dd['use'](ewinston[_0x4898('0x17')]({'winstonInstance':_0x320016,'meta':![],'statusLevels':!![],'msg':function(_0x573f6d,_0x4dd009){var _0x175147=_0x4898('0x18');if(!_['isEmpty'](_0x573f6d['body'])){_0x175147+='\x20body=%s';var _0x157cee=_0x573f6d['body'];maskSensitiveData(_0x157cee);}return safeTemplate(util[_0x4898('0x19')](_0x175147,_0x573f6d['method'],_0x573f6d[_0x4898('0x1a')]['x-forwarded-for']?_0x573f6d[_0x4898('0x1a')]['x-forwarded-for']:_0x573f6d[_0x4898('0x1b')][_0x4898('0x1c')]||_0x573f6d['ip'],_0x573f6d['url'],_0x4dd009[_0x4898('0x1d')],_0x4dd009[_0x4898('0x1e')],_0x573f6d['user']?_0x573f6d[_0x4898('0xf')]['id']:null,_0x573f6d['user']?_0x573f6d[_0x4898('0xf')][_0x4898('0xb')]:null,_0x573f6d[_0x4898('0xf')]?_0x573f6d[_0x4898('0xf')][_0x4898('0xa')]:null,_0x157cee?util[_0x4898('0x1f')](_0x157cee,![],null):''));}}));_0x58f6dd[_0x4898('0x20')](ewinston[_0x4898('0x17')]({'winstonInstance':_0x289a1c,'meta':![],'statusLevels':!![],'msg':function(_0x4f42f4,_0x36467b){var _0x31a5ff=_0x4898('0x21');if(_0x4f42f4[_0x4898('0x22')]&&_0x4f42f4[_0x4898('0x22')]['device']&&_0x4f42f4['body'][_0x4898('0x23')]){_0x31a5ff='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x4898('0x19')](_0x31a5ff,_0x4f42f4[_0x4898('0x24')],_0x4f42f4[_0x4898('0x1a')][_0x4898('0x25')]?_0x4f42f4[_0x4898('0x1a')][_0x4898('0x25')]:_0x4f42f4['connection'][_0x4898('0x1c')]||_0x4f42f4['ip'],_0x4f42f4[_0x4898('0x26')],_0x36467b[_0x4898('0x1d')],_0x36467b[_0x4898('0x1e')],_0x4f42f4[_0x4898('0xf')]?_0x4f42f4['user']['id']:null,_0x4f42f4[_0x4898('0xf')]?_0x4f42f4[_0x4898('0xf')][_0x4898('0xb')]:null,_0x4f42f4['user']?_0x4f42f4[_0x4898('0xf')]['role']:null,_0x4f42f4['body']&&_0x4f42f4[_0x4898('0x22')][_0x4898('0x27')]?_0x4f42f4[_0x4898('0x22')][_0x4898('0x27')]:'other',_0x4f42f4[_0x4898('0x22')]&&_0x4f42f4['body'][_0x4898('0x23')]?_0x4f42f4['body'][_0x4898('0x23')]:'',_0x4f42f4[_0x4898('0x22')]&&_0x4f42f4[_0x4898('0x22')][_0x4898('0x28')]?_0x4f42f4[_0x4898('0x22')][_0x4898('0x28')]:'');},'ignoreRoute':function(_0x441faa){var _0x5f06b9=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5f06b9[_0x4898('0x29')](_0x441faa['url']);}}));return _0x1f0754();});}exports[_0x4898('0x2a')]=setupLoggers; \ No newline at end of file +var _0x29da=['/var','role','name','ensureDir','then','catch','log','user','data','timestamp','client','error','api','auth','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','other','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join'];(function(_0x4d0d77,_0x5723de){var _0x56a9f4=function(_0x3dd5ab){while(--_0x3dd5ab){_0x4d0d77['push'](_0x4d0d77['shift']());}};_0x56a9f4(++_0x5723de);}(_0x29da,0x17d));var _0xa29d=function(_0x3922ec,_0x39fddb){_0x3922ec=_0x3922ec-0x0;var _0x26fc74=_0x29da[_0x3922ec];return _0x26fc74;};var fs=require(_0xa29d('0x0'));var _=require(_0xa29d('0x1'));var ewinston=require('express-winston');var path=require(_0xa29d('0x2'));var util=require(_0xa29d('0x3'));var fileLogger=require(_0xa29d('0x4'))[_0xa29d('0x5')];var safeTemplate=require(_0xa29d('0x6'))[_0xa29d('0x7')];var maskSensitiveData=require(_0xa29d('0x8'))[_0xa29d('0x9')];function ClientSideLogger(){function _0x1be427(_0xb7346c){var _0x3ecb26=path[_0xa29d('0xa')](_0xa29d('0xb'),'log','xcally');var _0x5786eb=path[_0xa29d('0xa')]('client',_0xb7346c[_0xa29d('0xc')]+'-'+_0xb7346c[_0xa29d('0xd')]);return fs[_0xa29d('0xe')](path[_0xa29d('0xa')](_0x3ecb26,_0x5786eb))[_0xa29d('0xf')](function(){var _0xc89d60=fileLogger('client',path['join'](_0x3ecb26,_0x5786eb));return _0xc89d60;})[_0xa29d('0x10')](function(_0x56ad89){throw _0x56ad89;});}this[_0xa29d('0x11')]=function(_0x6d322a,_0x59129b,_0x3ab145,_0x1075e7){return _0x1be427(_0x6d322a[_0xa29d('0x12')])[_0xa29d('0xf')](function(_0x3e3511){var _0x2e0218=_0x3e3511[_0x59129b];return _0x2e0218;})[_0xa29d('0xf')](function(_0x57c5d4){var _0x4d234a=_0x6d322a[_0xa29d('0x12')]?_0x6d322a['user']['id']:'no-user';var _0x107fbf=_0x1075e7[_0xa29d('0x13')];var _0x34b6a8=_0x1075e7[_0xa29d('0x14')];var _0x1689e6=new Date(Number(_0x34b6a8));return _0x57c5d4(_0x4d234a,_0x1689e6,_0x3ab145,_0x107fbf);})[_0xa29d('0x10')](function(_0x75a6a5){fileLogger(_0xa29d('0x15'))[_0xa29d('0x16')](_0x75a6a5);});};}function setupLoggers(_0x36d34b){return new Promise(function(_0xf79bfa){var _0x486580=new ClientSideLogger();var _0x45e0ee=fileLogger(_0xa29d('0x17'));var _0x1d2c87=fileLogger(_0xa29d('0x18'));_0x36d34b[_0xa29d('0x19')]('client-side-logger',_0x486580);_0x36d34b[_0xa29d('0x1a')](ewinston[_0xa29d('0x1b')]({'winstonInstance':_0x45e0ee,'meta':![],'statusLevels':!![],'msg':function(_0x2982a9,_0x59220b){var _0x1c6a3e=_0xa29d('0x1c');if(!_['isEmpty'](_0x2982a9[_0xa29d('0x1d')])){_0x1c6a3e+=_0xa29d('0x1e');var _0x3b319e=_0x2982a9[_0xa29d('0x1d')];maskSensitiveData(_0x3b319e);}return safeTemplate(util[_0xa29d('0x1f')](_0x1c6a3e,_0x2982a9[_0xa29d('0x20')],_0x2982a9[_0xa29d('0x21')][_0xa29d('0x22')]?_0x2982a9['headers'][_0xa29d('0x22')]:_0x2982a9[_0xa29d('0x23')][_0xa29d('0x24')]||_0x2982a9['ip'],_0x2982a9[_0xa29d('0x25')],_0x59220b[_0xa29d('0x26')],_0x59220b['responseTime'],_0x2982a9[_0xa29d('0x12')]?_0x2982a9[_0xa29d('0x12')]['id']:null,_0x2982a9['user']?_0x2982a9[_0xa29d('0x12')][_0xa29d('0xd')]:null,_0x2982a9[_0xa29d('0x12')]?_0x2982a9['user'][_0xa29d('0xc')]:null,_0x3b319e?util[_0xa29d('0x27')](_0x3b319e,![],null):''));}}));_0x36d34b['use'](ewinston['logger']({'winstonInstance':_0x1d2c87,'meta':![],'statusLevels':!![],'msg':function(_0x593438,_0x2504ae){var _0x120228=_0xa29d('0x28');if(_0x593438[_0xa29d('0x1d')]&&_0x593438[_0xa29d('0x1d')][_0xa29d('0x29')]&&_0x593438[_0xa29d('0x1d')]['agent_id']){_0x120228=_0xa29d('0x2a');}return util[_0xa29d('0x1f')](_0x120228,_0x593438['method'],_0x593438[_0xa29d('0x21')][_0xa29d('0x22')]?_0x593438[_0xa29d('0x21')][_0xa29d('0x22')]:_0x593438['connection'][_0xa29d('0x24')]||_0x593438['ip'],_0x593438[_0xa29d('0x25')],_0x2504ae[_0xa29d('0x26')],_0x2504ae[_0xa29d('0x2b')],_0x593438['user']?_0x593438[_0xa29d('0x12')]['id']:null,_0x593438[_0xa29d('0x12')]?_0x593438[_0xa29d('0x12')]['name']:null,_0x593438['user']?_0x593438[_0xa29d('0x12')]['role']:null,_0x593438[_0xa29d('0x1d')]&&_0x593438[_0xa29d('0x1d')][_0xa29d('0x29')]?_0x593438['body'][_0xa29d('0x29')]:_0xa29d('0x2c'),_0x593438[_0xa29d('0x1d')]&&_0x593438[_0xa29d('0x1d')][_0xa29d('0x2d')]?_0x593438[_0xa29d('0x1d')][_0xa29d('0x2d')]:'',_0x593438[_0xa29d('0x1d')]&&_0x593438[_0xa29d('0x1d')][_0xa29d('0x2e')]?_0x593438[_0xa29d('0x1d')][_0xa29d('0x2e')]:'');},'ignoreRoute':function(_0x24d6b9){var _0x359fca=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x359fca[_0xa29d('0x2f')](_0x24d6b9['url']);}}));return _0xf79bfa();});}exports[_0xa29d('0x30')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 121fe06..2897957 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc746=['level','Logger','transports','Console','File','%s-%s','error','warn','consoleLogger','fileLogger','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20white','bold\x20green','gray','bold\x20blue','bold\x20cyan','addColors','join','format','%s-%s.log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','}}}','keys','meta','length'];(function(_0x1082f1,_0x24e61a){var _0x113b42=function(_0x3a5596){while(--_0x3a5596){_0x1082f1['push'](_0x1082f1['shift']());}};_0x113b42(++_0x24e61a);}(_0xc746,0x14e));var _0x6c74=function(_0x4c5837,_0x205efd){_0x4c5837=_0x4c5837-0x0;var _0x359359=_0xc746[_0x4c5837];return _0x359359;};'use strict';var path=require('path');var util=require('util');var moment=require(_0x6c74('0x0'));var winston=require(_0x6c74('0x1'));var config=require(_0x6c74('0x2'));var debugLevel=config[_0x6c74('0x3')]?config['debugLevel'][_0x6c74('0x4')]():_0x6c74('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':_0x6c74('0x6'),'error':_0x6c74('0x7'),'warn':'bold\x20yellow','info':'white','print':_0x6c74('0x8'),'success':_0x6c74('0x9'),'http':_0x6c74('0xa'),'verbose':'bold\x20magenta','debug':_0x6c74('0xb'),'silly':_0x6c74('0xc')};winston[_0x6c74('0xd')](XC_LOG_COLORS);function getLogFileName(_0x4761a8,_0xd939cf,_0x1bcf17){var _0x442bd9=_0x4761a8||'/var/log/xcally';return path[_0x6c74('0xe')](_0x442bd9,util[_0x6c74('0xf')](_0x6c74('0x10'),_0xd939cf,_0x1bcf17));}function formatter(_0x4c02c9,_0x23b508){_0x23b508[_0x6c74('0x11')]=_0x23b508[_0x6c74('0x11')][_0x6c74('0x12')](/@@{/g,_0x6c74('0x13'))[_0x6c74('0x12')](/}@@/g,'}}}')[_0x6c74('0x12')](/@{/g,'{{')[_0x6c74('0x12')](/}@/g,'}}');return util['format'](_0x6c74('0x14'),moment()['format'](_0x6c74('0x15')),_0x23b508['level']['toUpperCase'](),_0x4c02c9,_0x23b508['message']);}function fileFormat(_0xf18d65,_0x2f015a){_0x2f015a[_0x6c74('0x11')]=_0x2f015a[_0x6c74('0x11')][_0x6c74('0x12')](/@@{/g,'{{{')[_0x6c74('0x12')](/}@@/g,_0x6c74('0x16'))[_0x6c74('0x12')](/@{/g,'{{')[_0x6c74('0x12')](/}@/g,'}}');var _0xcccb01=_0x2f015a['meta']&&Object[_0x6c74('0x17')](_0x2f015a[_0x6c74('0x18')])[_0x6c74('0x19')]?'\x0a\x09'+JSON['stringify'](_0x2f015a[_0x6c74('0x18')]):'';return util[_0x6c74('0xf')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x6c74('0xf')](_0x6c74('0x15')),_0x2f015a[_0x6c74('0x1a')]['toUpperCase'](),_0xf18d65,_0x2f015a[_0x6c74('0x11')],_0xcccb01);}function consoleLogger(){var _0x2dbcbf=new winston[(_0x6c74('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x6c74('0x1c'))][(_0x6c74('0x1d'))]({'level':'warn','json':![],'formatter':function(_0x4f7c63){return formatter('',_0x4f7c63);}})]});return _0x2dbcbf;}function fileLogger(_0x37e7fd,_0x21effe){var _0x3b8d86=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x6c74('0x1c'))][(_0x6c74('0x1e'))]({'name':util[_0x6c74('0xf')](_0x6c74('0x1f'),_0x37e7fd,_0x6c74('0x20')),'filename':getLogFileName(_0x21effe,_0x37e7fd,_0x6c74('0x20')),'level':_0x6c74('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x47ec4c){return fileFormat(_0x37e7fd,_0x47ec4c);}}),new winston[(_0x6c74('0x1c'))][(_0x6c74('0x1e'))]({'name':util[_0x6c74('0xf')](_0x6c74('0x1f'),_0x37e7fd,debugLevel),'filename':getLogFileName(_0x21effe,_0x37e7fd,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3ff241){return fileFormat(_0x37e7fd,_0x3ff241);}}),new winston[(_0x6c74('0x1c'))][(_0x6c74('0x1d'))]({'level':_0x6c74('0x21'),'json':![],'formatter':function(_0x51a73d){return fileFormat(_0x37e7fd,_0x51a73d);}})]});return _0x3b8d86;}exports[_0x6c74('0x22')]=consoleLogger;exports[_0x6c74('0x23')]=fileLogger; \ No newline at end of file +var _0x067d=['bold\x20cyan','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','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','%s-%s','error','path','util','moment','winston','debugLevel','toLowerCase','info','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue'];(function(_0x47f8cb,_0x44459e){var _0x24a7d6=function(_0x33aa4e){while(--_0x33aa4e){_0x47f8cb['push'](_0x47f8cb['shift']());}};_0x24a7d6(++_0x44459e);}(_0x067d,0xa4));var _0xd067=function(_0x243481,_0x33ba56){_0x243481=_0x243481-0x0;var _0x3c7a5c=_0x067d[_0x243481];return _0x3c7a5c;};'use strict';var path=require(_0xd067('0x0'));var util=require(_0xd067('0x1'));var moment=require(_0xd067('0x2'));var winston=require(_0xd067('0x3'));var config=require('../config/environment');var debugLevel=config[_0xd067('0x4')]?config[_0xd067('0x4')][_0xd067('0x5')]():_0xd067('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':'redBG\x20white','error':'red','warn':'bold\x20yellow','info':'white','print':_0xd067('0x7'),'success':_0xd067('0x8'),'http':'gray','verbose':_0xd067('0x9'),'debug':_0xd067('0xa'),'silly':_0xd067('0xb')};winston[_0xd067('0xc')](XC_LOG_COLORS);function getLogFileName(_0x2e1996,_0x1bb09f,_0x4ada05){var _0x34162a=_0x2e1996||_0xd067('0xd');return path[_0xd067('0xe')](_0x34162a,util['format'](_0xd067('0xf'),_0x1bb09f,_0x4ada05));}function formatter(_0x1bba7f,_0x50da08){_0x50da08[_0xd067('0x10')]=_0x50da08[_0xd067('0x10')]['replace'](/@@{/g,_0xd067('0x11'))[_0xd067('0x12')](/}@@/g,_0xd067('0x13'))[_0xd067('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xd067('0x14')](_0xd067('0x15'),moment()[_0xd067('0x14')](_0xd067('0x16')),_0x50da08[_0xd067('0x17')][_0xd067('0x18')](),_0x1bba7f,_0x50da08[_0xd067('0x10')]);}function fileFormat(_0x4dc62d,_0xd0b433){_0xd0b433[_0xd067('0x10')]=_0xd0b433[_0xd067('0x10')][_0xd067('0x12')](/@@{/g,'{{{')['replace'](/}@@/g,_0xd067('0x13'))[_0xd067('0x12')](/@{/g,'{{')[_0xd067('0x12')](/}@/g,'}}');var _0x3bd441=_0xd0b433[_0xd067('0x19')]&&Object['keys'](_0xd0b433['meta'])[_0xd067('0x1a')]?'\x0a\x09'+JSON[_0xd067('0x1b')](_0xd0b433[_0xd067('0x19')]):'';return util[_0xd067('0x14')](_0xd067('0x1c'),moment()['format'](_0xd067('0x16')),_0xd0b433[_0xd067('0x17')][_0xd067('0x18')](),_0x4dc62d,_0xd0b433[_0xd067('0x10')],_0x3bd441);}function consoleLogger(){var _0x4f92b8=new winston[(_0xd067('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xd067('0x1e'))][(_0xd067('0x1f'))]({'level':_0xd067('0x20'),'json':![],'formatter':function(_0x57588e){return formatter('',_0x57588e);}})]});return _0x4f92b8;}function fileLogger(_0x3f5d3a,_0x3b7373){var _0x3945f3=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util[_0xd067('0x14')](_0xd067('0x21'),_0x3f5d3a,'error'),'filename':getLogFileName(_0x3b7373,_0x3f5d3a,_0xd067('0x22')),'level':_0xd067('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5a0c88){return fileFormat(_0x3f5d3a,_0x5a0c88);}}),new winston['transports']['File']({'name':util[_0xd067('0x14')](_0xd067('0x21'),_0x3f5d3a,debugLevel),'filename':getLogFileName(_0x3b7373,_0x3f5d3a,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5aab49){return fileFormat(_0x3f5d3a,_0x5aab49);}}),new winston['transports'][(_0xd067('0x1f'))]({'level':_0xd067('0x20'),'json':![],'formatter':function(_0x4c0965){return fileFormat(_0x3f5d3a,_0x4c0965);}})]});return _0x3945f3;}exports['consoleLogger']=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 436f093..898d082 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 _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x4bc9f6,_0x184fb4){var _0x22b2f4=function(_0x4f3658){while(--_0x4f3658){_0x4bc9f6['push'](_0x4bc9f6['shift']());}};_0x22b2f4(++_0x184fb4);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5b47d9,_0x1327ce){_0x5b47d9=_0x5b47d9-0x0;var _0x4151f0=_0x0b0e[_0x5b47d9];return _0x4151f0;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0xdb28=['registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','exports','maskSensitiveData','lodash','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xdb28,0x106));var _0x8db2=function(_0x1c122f,_0x490a59){_0x1c122f=_0x1c122f-0x0;var _0x768473=_0xdb28[_0x1c122f];return _0x768473;};var _=require(_0x8db2('0x0'));var sensitiveFields=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3'),'apiKey',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'fax',_0x8db2('0x9'),_0x8db2('0xa'),'clientSecret','securityToken',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'authToken',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'calleridname',_0x8db2('0x15'),_0x8db2('0x16'),'vidaooApiKey',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'user','pass',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21')];function maskSensitiveData(_0x2f177a){const _0x3c96a7=/(?!^)[\s\S](?!$)/g;if(_[_0x8db2('0x22')](_0x2f177a)){for(const _0x16c8c2 in _0x2f177a){if(_['isArray'](_0x2f177a[_0x16c8c2])){for(let _0x13b0f5=0x0;_0x13b0f5<_0x2f177a[_0x16c8c2][_0x8db2('0x23')];_0x13b0f5++){maskSensitiveData(_0x2f177a[_0x16c8c2][_0x13b0f5]);}}else if(_['isPlainObject'](_0x2f177a[_0x16c8c2])){maskSensitiveData(_0x2f177a[_0x16c8c2]);}else if(_[_0x8db2('0x24')](_0x2f177a[_0x16c8c2])){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](/{{{/g,_0x8db2('0x26'))[_0x8db2('0x25')](/}}}/g,_0x8db2('0x27'))[_0x8db2('0x25')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x16c8c2)){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](_0x3c96a7,'*');}}}}}module[_0x8db2('0x28')][_0x8db2('0x29')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 5a4800b..15a1571 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 _0xd4a2=['exports','safeTemplate','lodash','\x20}\x20}','replace','map','isPlainObject','keys','reduce'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xd4a2,0x173));var _0x2d4a=function(_0x29150d,_0x221bfa){_0x29150d=_0x29150d-0x0;var _0x53666e=_0xd4a2[_0x29150d];return _0x53666e;};var _=require(_0x2d4a('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x5d70e1){return _0x5d70e1==='{{'?'{\x20{\x20':_0x2d4a('0x1');}function safeTemplate(_0x576ffe){var _0x2a8a71=_0x576ffe;if(typeof _0x576ffe==='string'){_0x2a8a71=_0x576ffe[_0x2d4a('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x576ffe)){_0x2a8a71=_0x576ffe[_0x2d4a('0x3')](function(_0x40d744){return safeTemplate(_0x40d744);});}else if(_[_0x2d4a('0x4')](_0x576ffe)){_0x2a8a71=Object[_0x2d4a('0x5')](_0x576ffe)[_0x2d4a('0x6')](function(_0x57058f,_0x45fefb){_0x57058f[_0x45fefb]=safeTemplate(_0x576ffe[_0x45fefb]);return _0x57058f;},{});}return _0x2a8a71;}module[_0x2d4a('0x7')][_0x2d4a('0x8')]=safeTemplate; \ No newline at end of file +var _0x4fc2=['reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map','keys'];(function(_0x2f541a,_0x37e68e){var _0xad10=function(_0x496e61){while(--_0x496e61){_0x2f541a['push'](_0x2f541a['shift']());}};_0xad10(++_0x37e68e);}(_0x4fc2,0x111));var _0x24fc=function(_0xa1f5c4,_0x247496){_0xa1f5c4=_0xa1f5c4-0x0;var _0x3f2f74=_0x4fc2[_0xa1f5c4];return _0x3f2f74;};var _=require(_0x24fc('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b05a5){return _0x2b05a5==='{{'?_0x24fc('0x1'):_0x24fc('0x2');}function safeTemplate(_0x5aaa74){var _0x365c56=_0x5aaa74;if(typeof _0x5aaa74===_0x24fc('0x3')){_0x365c56=_0x5aaa74[_0x24fc('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x5aaa74)){_0x365c56=_0x5aaa74[_0x24fc('0x5')](function(_0x3772eb){return safeTemplate(_0x3772eb);});}else if(_['isPlainObject'](_0x5aaa74)){_0x365c56=Object[_0x24fc('0x6')](_0x5aaa74)[_0x24fc('0x7')](function(_0x4889f4,_0x115851){_0x4889f4[_0x115851]=safeTemplate(_0x5aaa74[_0x115851]);return _0x4889f4;},{});}return _0x365c56;}module[_0x24fc('0x8')][_0x24fc('0x9')]=safeTemplate; \ No newline at end of file